From: support Date: Tue, 29 Nov 2022 09:14:03 +0000 (+0000) Subject: Built motion from commit cabca865.|2.6.23 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=dcce26384a8b3da655bb4aec64542169e5ff6aee;p=motion2.git Built motion from commit cabca865.|2.6.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ea30a20..e9ea638 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-29T08:42:16.195Z", + "time": "2022-11-29T09:05:16.663Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6b42cf4..95c2b39 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-29T08:42:16.195Z", + "time": "2022-11-29T09:05:16.663Z", "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 90e2143..484b638 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 _0x6da6=['exports','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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)]','TEXT'];(function(_0x50cac8,_0x538cf8){var _0x5afe65=function(_0x3c1211){while(--_0x3c1211){_0x50cac8['push'](_0x50cac8['shift']());}};_0x5afe65(++_0x538cf8);}(_0x6da6,0xa5));var _0x66da=function(_0x37f8ef,_0x48c182){_0x37f8ef=_0x37f8ef-0x0;var _0x135464=_0x6da6[_0x37f8ef];return _0x135464;};'use strict';var Sequelize=require('sequelize');module[_0x66da('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3844db){return this['getDataValue'](_0x66da('0x1'));}},'action':{'type':Sequelize[_0x66da('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x66da('0x3'),_0x66da('0x4'),_0x66da('0x5'),_0x66da('0x6'),_0x66da('0x7'),_0x66da('0x8'),_0x66da('0x9'),_0x66da('0xa')]],'msg':_0x66da('0xb')}},'comment':_0x66da('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x66da('0x2')](0x1000),'comment':_0x66da('0xc')},'data3':{'type':Sequelize[_0x66da('0x2')](0x1000),'comment':_0x66da('0xd')},'data4':{'type':Sequelize[_0x66da('0x2')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x66da('0x2')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x66da('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x334b=['getDataValue','action','STRING','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x334b,0x154));var _0xb334=function(_0x579fc0,_0x2396eb){_0x579fc0=_0x579fc0-0x0;var _0x1d2a7a=_0x334b[_0x579fc0];return _0x1d2a7a;};'use strict';var Sequelize=require('sequelize');module[_0xb334('0x0')]={'name':{'type':Sequelize[_0xb334('0x1')],'get':function(_0x3e0b52){return this[_0xb334('0x2')](_0xb334('0x3'));}},'action':{'type':Sequelize[_0xb334('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xb334('0x5'),_0xb334('0x6'),'jscripty',_0xb334('0x7'),_0xb334('0x8'),_0xb334('0x9'),'script']],'msg':_0xb334('0xa')}},'comment':_0xb334('0xa')},'data1':{'type':Sequelize[_0xb334('0x4')](0x1000),'comment':_0xb334('0xb')},'data2':{'type':Sequelize[_0xb334('0x4')](0x1000),'comment':_0xb334('0xc')},'data3':{'type':Sequelize[_0xb334('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xb334('0x4')](0x1000),'comments':_0xb334('0xd')},'data5':{'type':Sequelize[_0xb334('0x4')](0x1000),'comments':_0xb334('0xe')},'data6':{'type':Sequelize[_0xb334('0x4')],'comments':_0xb334('0xf')},'data7':{'type':Sequelize[_0xb334('0x10')],'comments':_0xb334('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5555915..92efa08 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 _0xf5a7=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','reject','save','then','destroy','error','name','send','body','Action','params','catch','find','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x3acb89,_0x2ca05e){var _0x4d38f2=function(_0x4cb6a9){while(--_0x4cb6a9){_0x3acb89['push'](_0x3acb89['shift']());}};_0x4d38f2(++_0x2ca05e);}(_0xf5a7,0xf5));var _0x7f5a=function(_0x56a171,_0x5383e7){_0x56a171=_0x56a171-0x0;var _0x56923e=_0xf5a7[_0x56a171];return _0x56923e;};'use strict';var emlformat=require(_0x7f5a('0x0'));var rimraf=require(_0x7f5a('0x1'));var zipdir=require(_0x7f5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f5a('0x3'));var moment=require(_0x7f5a('0x4'));var BPromise=require(_0x7f5a('0x5'));var Mustache=require('mustache');var util=require(_0x7f5a('0x6'));var path=require(_0x7f5a('0x7'));var sox=require(_0x7f5a('0x8'));var csv=require(_0x7f5a('0x9'));var ejs=require(_0x7f5a('0xa'));var fs=require('fs');var fs_extra=require(_0x7f5a('0xb'));var _=require(_0x7f5a('0xc'));var squel=require(_0x7f5a('0xd'));var crypto=require(_0x7f5a('0xe'));var jsforce=require(_0x7f5a('0xf'));var deskjs=require(_0x7f5a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7f5a('0x11'));var Papa=require(_0x7f5a('0x12'));var Redis=require(_0x7f5a('0x13'));var authService=require(_0x7f5a('0x14'));var qs=require(_0x7f5a('0x15'));var as=require(_0x7f5a('0x16'));var hardwareService=require(_0x7f5a('0x17'));var logger=require(_0x7f5a('0x18'))(_0x7f5a('0x19'));var utils=require(_0x7f5a('0x1a'));var config=require(_0x7f5a('0x1b'));var licenseUtil=require(_0x7f5a('0x1c'));var db=require(_0x7f5a('0x1d'))['db'];function respondWithStatusCode(_0x2ac7b0,_0x921346){_0x921346=_0x921346||0xcc;return function(_0x564200){if(_0x564200){return _0x2ac7b0[_0x7f5a('0x1e')](_0x921346);}return _0x2ac7b0['status'](_0x921346)[_0x7f5a('0x1f')]();};}function respondWithResult(_0x5a6941,_0x2eb1c9){_0x2eb1c9=_0x2eb1c9||0xc8;return function(_0x33da0a){if(_0x33da0a){return _0x5a6941[_0x7f5a('0x20')](_0x2eb1c9)[_0x7f5a('0x21')](_0x33da0a);}};}function respondWithFilteredResult(_0x5b8699,_0x539f77){return function(_0x1be689){if(_0x1be689){var _0x30f363=typeof _0x539f77['offset']===_0x7f5a('0x22')&&typeof _0x539f77['limit']==='undefined';var _0x235e2f=_0x1be689[_0x7f5a('0x23')];var _0x369e47=_0x30f363?0x0:_0x539f77[_0x7f5a('0x24')];var _0x461c05=_0x30f363?_0x1be689[_0x7f5a('0x23')]:_0x539f77[_0x7f5a('0x24')]+_0x539f77[_0x7f5a('0x25')];var _0x40a4fb;if(_0x461c05>=_0x235e2f){_0x461c05=_0x235e2f;_0x40a4fb=0xc8;}else{_0x40a4fb=0xce;}_0x5b8699['status'](_0x40a4fb);return _0x5b8699['set']('Content-Range',_0x369e47+'-'+_0x461c05+'/'+_0x235e2f)[_0x7f5a('0x21')](_0x1be689);}return null;};}function patchUpdates(_0x360436){return function(_0x13d9d9){try{jsonpatch['apply'](_0x13d9d9,_0x360436,!![]);}catch(_0x4ed4bd){return BPromise[_0x7f5a('0x26')](_0x4ed4bd);}return _0x13d9d9[_0x7f5a('0x27')]();};}function saveUpdates(_0x347778,_0x443ea1){return function(_0x2b23f8){if(_0x2b23f8){return _0x2b23f8['update'](_0x347778)[_0x7f5a('0x28')](function(_0x2efc1b){return _0x2efc1b;});}return null;};}function removeEntity(_0x3396e5,_0x1916e5){return function(_0x2c5115){if(_0x2c5115){return _0x2c5115[_0x7f5a('0x29')]()[_0x7f5a('0x28')](function(){_0x3396e5[_0x7f5a('0x20')](0xcc)[_0x7f5a('0x1f')]();});}};}function handleEntityNotFound(_0x1a87ea,_0x1f8df4){return function(_0x2f644f){if(!_0x2f644f){_0x1a87ea['sendStatus'](0x194);}return _0x2f644f;};}function handleError(_0x5cda26,_0x52bed8){_0x52bed8=_0x52bed8||0x1f4;return function(_0x3bea85){logger[_0x7f5a('0x2a')](_0x3bea85['stack']);if(_0x3bea85[_0x7f5a('0x2b')]){delete _0x3bea85['name'];}_0x5cda26[_0x7f5a('0x20')](_0x52bed8)[_0x7f5a('0x2c')](_0x3bea85);};}exports['update']=function(_0x3a311d,_0x916bbb){if(_0x3a311d['body']['id']){delete _0x3a311d[_0x7f5a('0x2d')]['id'];}return db[_0x7f5a('0x2e')]['find']({'where':{'id':_0x3a311d[_0x7f5a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x916bbb,null))['then'](saveUpdates(_0x3a311d['body'],null))[_0x7f5a('0x28')](respondWithResult(_0x916bbb,null))[_0x7f5a('0x30')](handleError(_0x916bbb,null));};exports[_0x7f5a('0x29')]=function(_0x241c56,_0xf0ac6c){return db[_0x7f5a('0x2e')][_0x7f5a('0x31')]({'where':{'id':_0x241c56[_0x7f5a('0x2f')]['id']}})['then'](handleEntityNotFound(_0xf0ac6c,null))[_0x7f5a('0x28')](removeEntity(_0xf0ac6c,null))['catch'](handleError(_0xf0ac6c,null));}; \ No newline at end of file +var _0x69aa=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','send','body','Action','find','catch','params','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69aa,0x1c4));var _0xa69a=function(_0x46b6ca,_0x19c484){_0x46b6ca=_0x46b6ca-0x0;var _0x588d96=_0x69aa[_0x46b6ca];return _0x588d96;};'use strict';var emlformat=require(_0xa69a('0x0'));var rimraf=require(_0xa69a('0x1'));var zipdir=require(_0xa69a('0x2'));var jsonpatch=require(_0xa69a('0x3'));var rp=require(_0xa69a('0x4'));var moment=require(_0xa69a('0x5'));var BPromise=require(_0xa69a('0x6'));var Mustache=require(_0xa69a('0x7'));var util=require(_0xa69a('0x8'));var path=require(_0xa69a('0x9'));var sox=require(_0xa69a('0xa'));var csv=require('to-csv');var ejs=require(_0xa69a('0xb'));var fs=require('fs');var fs_extra=require(_0xa69a('0xc'));var _=require('lodash');var squel=require(_0xa69a('0xd'));var crypto=require(_0xa69a('0xe'));var jsforce=require(_0xa69a('0xf'));var deskjs=require(_0xa69a('0x10'));var toCsv=require(_0xa69a('0x11'));var querystring=require(_0xa69a('0x12'));var Papa=require(_0xa69a('0x13'));var Redis=require(_0xa69a('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa69a('0x15'));var hardwareService=require(_0xa69a('0x16'));var logger=require(_0xa69a('0x17'))(_0xa69a('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa69a('0x19'));var db=require(_0xa69a('0x1a'))['db'];function respondWithStatusCode(_0x59dc60,_0x1e9fe3){_0x1e9fe3=_0x1e9fe3||0xcc;return function(_0x3df37d){if(_0x3df37d){return _0x59dc60[_0xa69a('0x1b')](_0x1e9fe3);}return _0x59dc60[_0xa69a('0x1c')](_0x1e9fe3)[_0xa69a('0x1d')]();};}function respondWithResult(_0x31b77a,_0x46439f){_0x46439f=_0x46439f||0xc8;return function(_0x3db1a9){if(_0x3db1a9){return _0x31b77a[_0xa69a('0x1c')](_0x46439f)[_0xa69a('0x1e')](_0x3db1a9);}};}function respondWithFilteredResult(_0xfcb35b,_0x432713){return function(_0x11fa71){if(_0x11fa71){var _0x2a0162=typeof _0x432713[_0xa69a('0x1f')]===_0xa69a('0x20')&&typeof _0x432713[_0xa69a('0x21')]===_0xa69a('0x20');var _0x52dcdb=_0x11fa71[_0xa69a('0x22')];var _0x50d1c6=_0x2a0162?0x0:_0x432713[_0xa69a('0x1f')];var _0x5aa622=_0x2a0162?_0x11fa71[_0xa69a('0x22')]:_0x432713[_0xa69a('0x1f')]+_0x432713[_0xa69a('0x21')];var _0x3dae57;if(_0x5aa622>=_0x52dcdb){_0x5aa622=_0x52dcdb;_0x3dae57=0xc8;}else{_0x3dae57=0xce;}_0xfcb35b[_0xa69a('0x1c')](_0x3dae57);return _0xfcb35b['set'](_0xa69a('0x23'),_0x50d1c6+'-'+_0x5aa622+'/'+_0x52dcdb)['json'](_0x11fa71);}return null;};}function patchUpdates(_0x412788){return function(_0x5c8871){try{jsonpatch[_0xa69a('0x24')](_0x5c8871,_0x412788,!![]);}catch(_0x507074){return BPromise[_0xa69a('0x25')](_0x507074);}return _0x5c8871['save']();};}function saveUpdates(_0x412756,_0x4e89fd){return function(_0x1a2546){if(_0x1a2546){return _0x1a2546[_0xa69a('0x26')](_0x412756)[_0xa69a('0x27')](function(_0x25a338){return _0x25a338;});}return null;};}function removeEntity(_0x70cdb8,_0x4d0965){return function(_0x4833b2){if(_0x4833b2){return _0x4833b2[_0xa69a('0x28')]()[_0xa69a('0x27')](function(){_0x70cdb8[_0xa69a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39e969,_0x5cccd2){return function(_0x3dc4e8){if(!_0x3dc4e8){_0x39e969['sendStatus'](0x194);}return _0x3dc4e8;};}function handleError(_0x387d4a,_0x5edf5f){_0x5edf5f=_0x5edf5f||0x1f4;return function(_0x1c292d){logger['error'](_0x1c292d['stack']);if(_0x1c292d['name']){delete _0x1c292d['name'];}_0x387d4a[_0xa69a('0x1c')](_0x5edf5f)[_0xa69a('0x29')](_0x1c292d);};}exports['update']=function(_0x321e9d,_0x580d2b){if(_0x321e9d[_0xa69a('0x2a')]['id']){delete _0x321e9d['body']['id'];}return db[_0xa69a('0x2b')][_0xa69a('0x2c')]({'where':{'id':_0x321e9d['params']['id']}})[_0xa69a('0x27')](handleEntityNotFound(_0x580d2b,null))['then'](saveUpdates(_0x321e9d['body'],null))[_0xa69a('0x27')](respondWithResult(_0x580d2b,null))[_0xa69a('0x2d')](handleError(_0x580d2b,null));};exports[_0xa69a('0x28')]=function(_0x137c4f,_0x6ac249){return db[_0xa69a('0x2b')][_0xa69a('0x2c')]({'where':{'id':_0x137c4f[_0xa69a('0x2e')]['id']}})[_0xa69a('0x27')](handleEntityNotFound(_0x6ac249,null))[_0xa69a('0x27')](removeEntity(_0x6ac249,null))['catch'](handleError(_0x6ac249,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 50b5ab0..d55e36f 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 _0x15b3=['exports','define','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./action.attributes'];(function(_0x28fe94,_0x120b9b){var _0x3560da=function(_0x4d4e25){while(--_0x4d4e25){_0x28fe94['push'](_0x28fe94['shift']());}};_0x3560da(++_0x120b9b);}(_0x15b3,0x115));var _0x315b=function(_0xe7cb0a,_0xeaffb6){_0xe7cb0a=_0xe7cb0a-0x0;var _0x503d88=_0x15b3[_0xe7cb0a];return _0x503d88;};'use strict';var _=require(_0x315b('0x0'));var util=require(_0x315b('0x1'));var logger=require(_0x315b('0x2'))(_0x315b('0x3'));var moment=require('moment');var BPromise=require(_0x315b('0x4'));var rp=require(_0x315b('0x5'));var fs=require('fs');var path=require(_0x315b('0x6'));var rimraf=require(_0x315b('0x7'));var config=require('../../config/environment');var attributes=require(_0x315b('0x8'));module[_0x315b('0x9')]=function(_0x243422,_0x406cbb){return _0x243422[_0x315b('0xa')](_0x315b('0xb'),attributes,{'tableName':_0x315b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x037e=['exports','define','Action','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5d9d1e,_0x2b8479){var _0x4388d3=function(_0x32a823){while(--_0x32a823){_0x5d9d1e['push'](_0x5d9d1e['shift']());}};_0x4388d3(++_0x2b8479);}(_0x037e,0x12c));var _0xe037=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x037e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe037('0x0'));var util=require(_0xe037('0x1'));var logger=require(_0xe037('0x2'))(_0xe037('0x3'));var moment=require(_0xe037('0x4'));var BPromise=require(_0xe037('0x5'));var rp=require(_0xe037('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe037('0x7'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xe037('0x8')]=function(_0x4ea0b6,_0x54f6e0){return _0x4ea0b6[_0xe037('0x9')](_0xe037('0xa'),attributes,{'tableName':'tools_actions','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 59f3de7..456f31c 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x4975,0x86));var _0x5497=function(_0x39d1b6,_0x4dc8e8){_0x39d1b6=_0x39d1b6-0x0;var _0x2ed9a4=_0x4975[_0x39d1b6];return _0x2ed9a4;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x4975,0x86));var _0x5497=function(_0x2c4260,_0x4dca4e){_0x2c4260=_0x2c4260-0x0;var _0x230e22=_0x4975[_0x2c4260];return _0x230e22;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 763f470..c8436b2 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 _0xae9f=['../../config/environment','put','/:id','update','isAuthenticated','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xae9f,0x1c2));var _0xfae9=function(_0x22f73e,_0x20ac9f){_0x22f73e=_0x22f73e-0x0;var _0x4d7831=_0xae9f[_0x22f73e];return _0x4d7831;};'use strict';var multer=require('multer');var util=require(_0xfae9('0x0'));var path=require(_0xfae9('0x1'));var timeout=require(_0xfae9('0x2'));var express=require(_0xfae9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfae9('0x4'));var interaction=require(_0xfae9('0x5'));var config=require(_0xfae9('0x6'));var controller=require('./action.controller');router[_0xfae9('0x7')](_0xfae9('0x8'),auth['isAuthenticated'](),controller[_0xfae9('0x9')]);router['delete']('/:id',auth[_0xfae9('0xa')](),controller[_0xfae9('0xb')]);module['exports']=router; \ No newline at end of file +var _0x11f9=['fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x5eabbb,_0x23fe06){var _0x4d205e=function(_0x385c9a){while(--_0x385c9a){_0x5eabbb['push'](_0x5eabbb['shift']());}};_0x4d205e(++_0x23fe06);}(_0x11f9,0x82));var _0x911f=function(_0x465145,_0x47c352){_0x465145=_0x465145-0x0;var _0x55e404=_0x11f9[_0x465145];return _0x55e404;};'use strict';var multer=require('multer');var util=require(_0x911f('0x0'));var path=require(_0x911f('0x1'));var timeout=require(_0x911f('0x2'));var express=require(_0x911f('0x3'));var router=express[_0x911f('0x4')]();var fs_extra=require(_0x911f('0x5'));var auth=require(_0x911f('0x6'));var interaction=require(_0x911f('0x7'));var config=require('../../config/environment');var controller=require(_0x911f('0x8'));router['put'](_0x911f('0x9'),auth[_0x911f('0xa')](),controller[_0x911f('0xb')]);router[_0x911f('0xc')](_0x911f('0x9'),auth['isAuthenticated'](),controller[_0x911f('0xd')]);module[_0x911f('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2290ae5..edc95e3 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 _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x424d59,_0x48d3e5){var _0x234c8c=function(_0x328754){while(--_0x328754){_0x424d59['push'](_0x424d59['shift']());}};_0x234c8c(++_0x48d3e5);}(_0x1883,0xab));var _0x3188=function(_0x1c8317,_0x10ba0e){_0x1c8317=_0x1c8317-0x0;var _0x58c0ac=_0x1883[_0x1c8317];return _0x58c0ac;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x3c64ce,_0x1a05d9){var _0x20fa96=function(_0x18af79){while(--_0x18af79){_0x3c64ce['push'](_0x3c64ce['shift']());}};_0x20fa96(++_0x1a05d9);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1a307c,_0x2db142){_0x1a307c=_0x1a307c-0x0;var _0x59a413=_0x3f8a[_0x1a307c];return _0x59a413;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 11abbd1..14bce74 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 _0x65fc=['AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','countTable','COUNT(*)','QueryTypes','run','from','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','params','preview','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','condition','value','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','function','replace','format','orderBy','order','DESC','field','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','right_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','getFields','Sequelize','metric','groupBy','alias','web','fullPath','%s-%s.%s','generate','output','csv','custom'];(function(_0x9a41ad,_0x2b6a8f){var _0x446d06=function(_0x31d936){while(--_0x31d936){_0x9a41ad['push'](_0x9a41ad['shift']());}};_0x446d06(++_0x2b6a8f);}(_0x65fc,0x15c));var _0xc65f=function(_0x1a48a0,_0x3c95f5){_0x1a48a0=_0x1a48a0-0x0;var _0x269714=_0x65fc[_0x1a48a0];return _0x269714;};'use strict';var emlformat=require(_0xc65f('0x0'));var rimraf=require(_0xc65f('0x1'));var zipdir=require(_0xc65f('0x2'));var jsonpatch=require(_0xc65f('0x3'));var rp=require('request-promise');var moment=require(_0xc65f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc65f('0x5'));var util=require(_0xc65f('0x6'));var path=require(_0xc65f('0x7'));var sox=require(_0xc65f('0x8'));var csv=require(_0xc65f('0x9'));var ejs=require(_0xc65f('0xa'));var fs=require('fs');var fs_extra=require(_0xc65f('0xb'));var _=require(_0xc65f('0xc'));var squel=require(_0xc65f('0xd'));var crypto=require(_0xc65f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc65f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc65f('0x10'));var Papa=require(_0xc65f('0x11'));var Redis=require(_0xc65f('0x12'));var authService=require(_0xc65f('0x13'));var qs=require(_0xc65f('0x14'));var as=require(_0xc65f('0x15'));var hardwareService=require(_0xc65f('0x16'));var logger=require(_0xc65f('0x17'))(_0xc65f('0x18'));var utils=require(_0xc65f('0x19'));var config=require(_0xc65f('0x1a'));var licenseUtil=require(_0xc65f('0x1b'));var db=require(_0xc65f('0x1c'))['db'];var dbH=require(_0xc65f('0x1c'))['dbH'];function respondWithStatusCode(_0x397306,_0x26a167){_0x26a167=_0x26a167||0xcc;return function(_0x24930f){if(_0x24930f){return _0x397306['sendStatus'](_0x26a167);}return _0x397306[_0xc65f('0x1d')](_0x26a167)[_0xc65f('0x1e')]();};}function respondWithResult(_0x41cba5,_0x4311b9){_0x4311b9=_0x4311b9||0xc8;return function(_0x149022){if(_0x149022){return _0x41cba5['status'](_0x4311b9)[_0xc65f('0x1f')](_0x149022);}};}function respondWithFilteredResult(_0x376673,_0x253c6c){return function(_0x3bb488){if(_0x3bb488){var _0x195143=typeof _0x253c6c[_0xc65f('0x20')]===_0xc65f('0x21')&&typeof _0x253c6c[_0xc65f('0x22')]===_0xc65f('0x21');var _0x2add9b=_0x3bb488[_0xc65f('0x23')];var _0x423324=_0x195143?0x0:_0x253c6c['offset'];var _0x3d86a6=_0x195143?_0x3bb488[_0xc65f('0x23')]:_0x253c6c[_0xc65f('0x20')]+_0x253c6c[_0xc65f('0x22')];var _0x2ad17d;if(_0x3d86a6>=_0x2add9b){_0x3d86a6=_0x2add9b;_0x2ad17d=0xc8;}else{_0x2ad17d=0xce;}_0x376673['status'](_0x2ad17d);return _0x376673['set'](_0xc65f('0x24'),_0x423324+'-'+_0x3d86a6+'/'+_0x2add9b)[_0xc65f('0x1f')](_0x3bb488);}return null;};}function patchUpdates(_0x589a28){return function(_0x519385){try{jsonpatch[_0xc65f('0x25')](_0x519385,_0x589a28,!![]);}catch(_0x15709b){return BPromise['reject'](_0x15709b);}return _0x519385['save']();};}function saveUpdates(_0x533821,_0x46b4be){return function(_0x2ccc41){if(_0x2ccc41){return _0x2ccc41[_0xc65f('0x26')](_0x533821)[_0xc65f('0x27')](function(_0x4d72ab){return _0x4d72ab;});}return null;};}function removeEntity(_0x46e98c,_0x2088a1){return function(_0x5773e6){if(_0x5773e6){return _0x5773e6[_0xc65f('0x28')]()[_0xc65f('0x27')](function(){var _0x4d8f03=_0x5773e6['get']({'plain':!![]});var _0x2ada56='CustomReports';return db['UserProfileResource'][_0xc65f('0x28')]({'where':{'type':_0x2ada56,'resourceId':_0x4d8f03['id']}})[_0xc65f('0x27')](function(){return _0x5773e6;});})['then'](function(){_0x46e98c[_0xc65f('0x1d')](0xcc)[_0xc65f('0x1e')]();});}};}function handleEntityNotFound(_0x1a36f8,_0x2ea0c8){return function(_0x62558a){if(!_0x62558a){_0x1a36f8[_0xc65f('0x29')](0x194);}return _0x62558a;};}function handleError(_0x2a8a5c,_0x3328a3){_0x3328a3=_0x3328a3||0x1f4;return function(_0x508563){logger['error'](_0x508563[_0xc65f('0x2a')]);if(_0x508563[_0xc65f('0x2b')]){delete _0x508563[_0xc65f('0x2b')];}_0x2a8a5c[_0xc65f('0x1d')](_0x3328a3)[_0xc65f('0x2c')](_0x508563);};}exports[_0xc65f('0x2d')]=function(_0x9cb8fe,_0x31c40f){var _0x544a47={},_0x29791a={},_0x522c41={'count':0x0,'rows':[]};var _0x2b3e2=_[_0xc65f('0x2e')](db[_0xc65f('0x2f')][_0xc65f('0x30')],function(_0x4e783d){return{'name':_0x4e783d['fieldName'],'type':_0x4e783d[_0xc65f('0x31')][_0xc65f('0x32')]};});_0x29791a[_0xc65f('0x33')]=_[_0xc65f('0x2e')](_0x2b3e2,_0xc65f('0x2b'));_0x29791a[_0xc65f('0x34')]=_[_0xc65f('0x35')](_0x9cb8fe[_0xc65f('0x34')]);_0x29791a[_0xc65f('0x36')]=_[_0xc65f('0x37')](_0x29791a[_0xc65f('0x33')],_0x29791a[_0xc65f('0x34')]);_0x544a47[_0xc65f('0x38')]=_['intersection'](_0x29791a[_0xc65f('0x33')],qs[_0xc65f('0x39')](_0x9cb8fe[_0xc65f('0x34')]['fields']));_0x544a47['attributes']=_0x544a47[_0xc65f('0x38')]['length']?_0x544a47[_0xc65f('0x38')]:_0x29791a[_0xc65f('0x33')];if(!_0x9cb8fe['query'][_0xc65f('0x3a')]('nolimit')){_0x544a47[_0xc65f('0x22')]=qs[_0xc65f('0x22')](_0x9cb8fe['query'][_0xc65f('0x22')]);_0x544a47[_0xc65f('0x20')]=qs[_0xc65f('0x20')](_0x9cb8fe[_0xc65f('0x34')][_0xc65f('0x20')]);}_0x544a47['order']=qs['sort'](_0x9cb8fe[_0xc65f('0x34')][_0xc65f('0x3b')]);_0x544a47[_0xc65f('0x3c')]=qs[_0xc65f('0x36')](_[_0xc65f('0x3d')](_0x9cb8fe[_0xc65f('0x34')],_0x29791a[_0xc65f('0x36')]),_0x2b3e2);if(_0x9cb8fe[_0xc65f('0x34')][_0xc65f('0x3e')]){_0x544a47['where']=_[_0xc65f('0x3f')](_0x544a47[_0xc65f('0x3c')],{'$or':_['map'](_0x2b3e2,function(_0x41b041){if(_0x41b041[_0xc65f('0x31')]!==_0xc65f('0x40')){var _0x233f80={};_0x233f80[_0x41b041['name']]={'$like':'%'+_0x9cb8fe[_0xc65f('0x34')][_0xc65f('0x3e')]+'%'};return _0x233f80;}})});}_0x544a47=_[_0xc65f('0x3f')]({},_0x544a47,_0x9cb8fe[_0xc65f('0x41')]);var _0x416bce={'where':_0x544a47[_0xc65f('0x3c')]};return db[_0xc65f('0x2f')]['count'](_0x416bce)[_0xc65f('0x27')](function(_0x1d4905){_0x522c41[_0xc65f('0x23')]=_0x1d4905;if(_0x9cb8fe['query'][_0xc65f('0x42')]){_0x544a47[_0xc65f('0x43')]=[{'all':!![]}];}return db[_0xc65f('0x2f')][_0xc65f('0x44')](_0x544a47);})[_0xc65f('0x27')](function(_0x262597){_0x522c41[_0xc65f('0x45')]=_0x262597;return _0x522c41;})['then'](respondWithFilteredResult(_0x31c40f,_0x544a47))[_0xc65f('0x46')](handleError(_0x31c40f,null));};exports[_0xc65f('0x47')]=function(_0x2419c1,_0x2970a0){var _0x272538={'raw':![],'where':{'id':_0x2419c1['params']['id']}},_0x449407={};_0x449407['model']=_['keys'](db['AnalyticCustomReport'][_0xc65f('0x30')]);_0x449407[_0xc65f('0x34')]=_[_0xc65f('0x35')](_0x2419c1['query']);_0x449407[_0xc65f('0x36')]=_['intersection'](_0x449407['model'],_0x449407[_0xc65f('0x34')]);_0x272538[_0xc65f('0x38')]=_[_0xc65f('0x37')](_0x449407['model'],qs[_0xc65f('0x39')](_0x2419c1['query'][_0xc65f('0x39')]));_0x272538[_0xc65f('0x38')]=_0x272538[_0xc65f('0x38')]['length']?_0x272538[_0xc65f('0x38')]:_0x449407['model'];if(_0x2419c1[_0xc65f('0x34')][_0xc65f('0x42')]){_0x272538[_0xc65f('0x43')]=[{'all':!![]}];}_0x272538=_[_0xc65f('0x3f')]({},_0x272538,_0x2419c1[_0xc65f('0x41')]);return db[_0xc65f('0x2f')][_0xc65f('0x48')](_0x272538)[_0xc65f('0x27')](handleEntityNotFound(_0x2970a0,null))[_0xc65f('0x27')](respondWithResult(_0x2970a0,null))[_0xc65f('0x46')](handleError(_0x2970a0,null));};exports['create']=function(_0x4e7813,_0x3a5b27){return db['AnalyticCustomReport'][_0xc65f('0x49')](_0x4e7813[_0xc65f('0x4a')],{})[_0xc65f('0x27')](function(_0x5954ab){var _0x106f1e=_0x4e7813[_0xc65f('0x4b')]['get']({'plain':!![]});if(!_0x106f1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106f1e['role']===_0xc65f('0x4b')){var _0x3db74d=_0x5954ab[_0xc65f('0x4c')]({'plain':!![]});var _0x5ecbc1='Reports';return db[_0xc65f('0x4d')][_0xc65f('0x48')]({'where':{'name':_0x5ecbc1,'userProfileId':_0x106f1e[_0xc65f('0x4e')]},'raw':!![]})[_0xc65f('0x27')](function(_0x1cc205){if(_0x1cc205&&_0x1cc205[_0xc65f('0x4f')]===0x0){return db[_0xc65f('0x50')][_0xc65f('0x49')]({'name':_0x3db74d[_0xc65f('0x2b')],'resourceId':_0x3db74d['id'],'type':'CustomReports','sectionId':_0x1cc205['id']},{})['then'](function(){return _0x5954ab;});}else{return _0x5954ab;}})[_0xc65f('0x46')](function(_0x3b4972){logger[_0xc65f('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b4972);throw _0x3b4972;});}return _0x5954ab;})['then'](respondWithResult(_0x3a5b27,0xc9))[_0xc65f('0x46')](handleError(_0x3a5b27,null));};exports[_0xc65f('0x26')]=function(_0xf2dd1c,_0x483239){if(_0xf2dd1c[_0xc65f('0x4a')]['id']){delete _0xf2dd1c[_0xc65f('0x4a')]['id'];}return db[_0xc65f('0x2f')][_0xc65f('0x48')]({'where':{'id':_0xf2dd1c[_0xc65f('0x52')]['id']}})[_0xc65f('0x27')](handleEntityNotFound(_0x483239,null))[_0xc65f('0x27')](saveUpdates(_0xf2dd1c[_0xc65f('0x4a')],null))[_0xc65f('0x27')](respondWithResult(_0x483239,null))['catch'](handleError(_0x483239,null));};exports[_0xc65f('0x28')]=function(_0x543a8c,_0x444bdd){return db[_0xc65f('0x2f')][_0xc65f('0x48')]({'where':{'id':_0x543a8c[_0xc65f('0x52')]['id']}})[_0xc65f('0x27')](handleEntityNotFound(_0x444bdd,null))[_0xc65f('0x27')](removeEntity(_0x444bdd,null))[_0xc65f('0x46')](handleError(_0x444bdd,null));};exports[_0xc65f('0x53')]=function(_0x4ecfde,_0x2e2ed6){var _0x2e28a4=0xa;var _0x2c820d=['join',_0xc65f('0x54'),'right_join',_0xc65f('0x55')];var _0x48f399={'SUM':_0xc65f('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc65f('0x57'),'MAX':'MAX(%s)','MIN':_0xc65f('0x58'),'AVG':_0xc65f('0x59'),'GROUP_CONCAT':_0xc65f('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x17b2eb={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc65f('0x5b'),'HOUR':_0xc65f('0x5c'),'ROUND':_0xc65f('0x5d'),'UNIX_TIMESTAMP':_0xc65f('0x5e')};var _0x590e4c=function(_0x1b1515){return!_[_0xc65f('0x5f')]([_0xc65f('0x60'),'IS\x20NOT\x20NULL',_0xc65f('0x61'),_0xc65f('0x62')],_0x1b1515);};var _0xb04060=function(_0x4d1579){if(!_0x4d1579||!_0x4d1579[_0xc65f('0x63')]['length']){return'';}for(var _0x311081='(',_0x1e3b76=0x0;_0x1e3b76<_0x4d1579[_0xc65f('0x63')][_0xc65f('0x64')];_0x1e3b76+=0x1){_0x1e3b76>0x0&&(_0x311081+='\x20'+_0x4d1579[_0xc65f('0x65')]+'\x20');_0x311081+=_0x4d1579['rules'][_0x1e3b76][_0xc65f('0x66')]?_0xb04060(_0x4d1579[_0xc65f('0x63')][_0x1e3b76]['group']):_0x4d1579[_0xc65f('0x63')][_0x1e3b76]['field']+'\x20'+_0x4d1579[_0xc65f('0x63')][_0x1e3b76][_0xc65f('0x67')]+(_0x590e4c(_0x4d1579[_0xc65f('0x63')][_0x1e3b76][_0xc65f('0x67')])?'\x20'+_0x4d1579[_0xc65f('0x63')][_0x1e3b76][_0xc65f('0x68')]:'');}return _0x311081+')';};var _0x5b914c={'where':{'id':_0x4ecfde[_0xc65f('0x52')]['id']}},_0x3331a7,_0x59e2e0,_0x24e57a,_0x16c3f6,_0x5f0e59;_0x5b914c=_['merge']({},_0x5b914c,_0x4ecfde[_0xc65f('0x41')]);return db[_0xc65f('0x2f')]['find'](_0x5b914c)[_0xc65f('0x27')](function(_0xb7481f){if(_0xb7481f){_0x3331a7=_0xb7481f;return _0xb7481f['getFields']();}return null;})[_0xc65f('0x27')](function(_0x12a3a6){if(_0x12a3a6){if(!_0x12a3a6[_0xc65f('0x64')]){throw new db['Sequelize'][(_0xc65f('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x59e2e0=_0x12a3a6;return db[_0xc65f('0x6a')]['findAll']({'raw':!![]});}return null;})[_0xc65f('0x27')](function(_0x403fb6){if(_0x403fb6){_0x24e57a=_[_0xc65f('0x6b')](_0x403fb6,'id');var _0x5499db;var _0x30e98a=squel[_0xc65f('0x6c')]();_0x30e98a['from'](_0x3331a7[_0xc65f('0x6d')]);for(var _0x353e54=0x0;_0x353e54<_0x59e2e0[_0xc65f('0x64')];_0x353e54+=0x1){_0x5499db=_0x59e2e0[_0x353e54]['MetricId']?_0x24e57a[_0x59e2e0[_0x353e54][_0xc65f('0x6e')]]['metric']:_0x59e2e0[_0x353e54]['field'];_0x5499db=_0x59e2e0[_0x353e54][_0xc65f('0x6f')]?_[_0xc65f('0x70')](_0x48f399[_0x59e2e0[_0x353e54]['function']],'%s',_0x5499db):_0x5499db;_0x5499db=_0x59e2e0[_0x353e54]['format']?_[_0xc65f('0x70')](_0x17b2eb[_0x59e2e0[_0x353e54][_0xc65f('0x71')]],'%s',_0x5499db):_0x5499db;if(_0x59e2e0[_0x353e54]['groupBy']){_0x30e98a[_0xc65f('0x66')](_0x5499db);}_0x59e2e0[_0x353e54][_0xc65f('0x72')]&&_0x30e98a[_0xc65f('0x73')](_0x5499db,_0x59e2e0[_0x353e54][_0xc65f('0x72')]===_0xc65f('0x74')?![]:!![]);_0x30e98a[_0xc65f('0x75')](_0x5499db,_0x59e2e0[_0x353e54]['alias']||_0x5499db);}if(_0x3331a7['joins']){_0x3331a7[_0xc65f('0x76')]=JSON['parse'](_0x3331a7[_0xc65f('0x76')]);for(var _0x338e10=0x0;_0x338e10<_0x3331a7['joins'][_0xc65f('0x64')];_0x338e10+=0x1){if(_0x3331a7[_0xc65f('0x76')][_0x338e10]['type']&&_[_0xc65f('0x5f')](_0x2c820d,_0x3331a7[_0xc65f('0x76')][_0x338e10]['type'])&&_0x3331a7['joins'][_0x338e10][_0xc65f('0x77')]&&_0x3331a7['joins'][_0x338e10][_0xc65f('0x78')]&&_0x3331a7[_0xc65f('0x76')][_0x338e10]['foreignKey']){_0x30e98a[_0x3331a7[_0xc65f('0x76')][_0x338e10][_0xc65f('0x31')]](_0x3331a7[_0xc65f('0x76')][_0x338e10]['foreignTable'],null,util[_0xc65f('0x71')](_0xc65f('0x79'),_0x3331a7[_0xc65f('0x6d')],_0x3331a7[_0xc65f('0x76')][_0x338e10][_0xc65f('0x77')],_0x3331a7[_0xc65f('0x76')][_0x338e10]['foreignTable'],_0x3331a7[_0xc65f('0x76')][_0x338e10][_0xc65f('0x7a')]));}}}if(_0x3331a7['conditions']){_0x3331a7[_0xc65f('0x7b')]=JSON[_0xc65f('0x7c')](_0x3331a7[_0xc65f('0x7b')]);_0x30e98a[_0xc65f('0x3c')](_0xb04060(_0x3331a7[_0xc65f('0x7b')][_0xc65f('0x66')]));}_0x5f0e59=_0x30e98a[_0xc65f('0x7d')]();_0x30e98a[_0xc65f('0x22')](_0x2e28a4);_0x30e98a['offset'](0x0);logger[_0xc65f('0x7e')](_0xc65f('0x7f'),_0x30e98a[_0xc65f('0x80')]());return dbH[_0xc65f('0x81')][_0xc65f('0x34')](_0x30e98a['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xc65f('0x82')]});}})['then'](respondWithResult(_0x2e2ed6,null))['catch'](handleError(_0x2e2ed6,null));};function runReport(_0x38c88f,_0x27698a,_0x3a4edc){var _0x147a89=_0x27698a[_0xc65f('0x2b')];var _0x2f506c=0xa;var _0x337f20=[_0xc65f('0x83'),_0xc65f('0x54'),_0xc65f('0x84'),_0xc65f('0x55')];var _0xc37179={'SUM':_0xc65f('0x56'),'COUNT':_0xc65f('0x85'),'COUNT DISTINCT':_0xc65f('0x57'),'MAX':'MAX(%s)','MIN':_0xc65f('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc65f('0x86'),'GROUP_CONCAT DESC':_0xc65f('0x87')};var _0x1e2e69={'SEC_TO_TIME':_0xc65f('0x88'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc65f('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x6264f5=function(_0x46bcb3){return!_[_0xc65f('0x5f')](['IS\x20NULL',_0xc65f('0x89'),_0xc65f('0x61'),_0xc65f('0x62')],_0x46bcb3);};var _0x4a6ec3=function(_0x547a23){if(!_0x547a23||!_0x547a23[_0xc65f('0x63')][_0xc65f('0x64')]){return'';}for(var _0xf850e='(',_0x2d36b2=0x0;_0x2d36b2<_0x547a23['rules'][_0xc65f('0x64')];_0x2d36b2+=0x1){_0x2d36b2>0x0&&(_0xf850e+='\x20'+_0x547a23[_0xc65f('0x65')]+'\x20');_0xf850e+=_0x547a23['rules'][_0x2d36b2][_0xc65f('0x66')]?_0x4a6ec3(_0x547a23[_0xc65f('0x63')][_0x2d36b2][_0xc65f('0x66')]):_0x547a23[_0xc65f('0x63')][_0x2d36b2][_0xc65f('0x75')]+'\x20'+_0x547a23[_0xc65f('0x63')][_0x2d36b2][_0xc65f('0x67')]+(_0x6264f5(_0x547a23['rules'][_0x2d36b2]['condition'])?'\x20'+_0x547a23['rules'][_0x2d36b2][_0xc65f('0x68')]:'');}return _0xf850e+')';};var _0x444485={'where':{'id':_0x38c88f['id']}},_0x211ba4,_0x4d9b1e,_0x442f05,_0xecdafe,_0x3088b7;_0x444485=_[_0xc65f('0x3f')]({},_0x444485,_0x3a4edc);return db[_0xc65f('0x2f')]['find'](_0x444485)[_0xc65f('0x27')](function(_0x14e0c5){if(_0x14e0c5){_0x211ba4=_0x14e0c5;return _0x14e0c5[_0xc65f('0x8a')]();}return null;})['then'](function(_0x26d129){if(_0x26d129){if(!_0x26d129[_0xc65f('0x64')]){throw new db[(_0xc65f('0x8b'))][(_0xc65f('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4d9b1e=_0x26d129;return db[_0xc65f('0x6a')][_0xc65f('0x44')]({'raw':!![]});}return null;})['then'](function(_0x4ffe75){if(_0x4ffe75){_0x442f05=_[_0xc65f('0x6b')](_0x4ffe75,'id');var _0x3b2015;var _0x1999f9=squel[_0xc65f('0x6c')]();_0x1999f9['from'](_0x211ba4[_0xc65f('0x6d')]);for(var _0x4f3eee=0x0;_0x4f3eee<_0x4d9b1e['length'];_0x4f3eee+=0x1){_0x3b2015=_0x4d9b1e[_0x4f3eee][_0xc65f('0x6e')]?_0x442f05[_0x4d9b1e[_0x4f3eee]['MetricId']][_0xc65f('0x8c')]:_0x4d9b1e[_0x4f3eee][_0xc65f('0x75')];_0x3b2015=_0x4d9b1e[_0x4f3eee][_0xc65f('0x6f')]?_[_0xc65f('0x70')](_0xc37179[_0x4d9b1e[_0x4f3eee][_0xc65f('0x6f')]],'%s',_0x3b2015):_0x3b2015;_0x3b2015=_0x4d9b1e[_0x4f3eee][_0xc65f('0x71')]?_[_0xc65f('0x70')](_0x1e2e69[_0x4d9b1e[_0x4f3eee][_0xc65f('0x71')]],'%s',_0x3b2015):_0x3b2015;if(_0x4d9b1e[_0x4f3eee][_0xc65f('0x8d')]){_0x1999f9[_0xc65f('0x66')](_0x3b2015);}_0x4d9b1e[_0x4f3eee][_0xc65f('0x72')]&&_0x1999f9[_0xc65f('0x73')](_0x3b2015,_0x4d9b1e[_0x4f3eee][_0xc65f('0x72')]===_0xc65f('0x74')?![]:!![]);_0x1999f9['field'](_0x3b2015,_0x4d9b1e[_0x4f3eee][_0xc65f('0x8e')]||_0x3b2015);}if(_0x211ba4[_0xc65f('0x76')]){_0x211ba4['joins']=JSON[_0xc65f('0x7c')](_0x211ba4['joins']);for(var _0x2f3347=0x0;_0x2f3347<_0x211ba4[_0xc65f('0x76')][_0xc65f('0x64')];_0x2f3347+=0x1){if(_0x211ba4['joins'][_0x2f3347][_0xc65f('0x31')]&&_['includes'](_0x337f20,_0x211ba4['joins'][_0x2f3347]['type'])&&_0x211ba4[_0xc65f('0x76')][_0x2f3347][_0xc65f('0x77')]&&_0x211ba4[_0xc65f('0x76')][_0x2f3347][_0xc65f('0x78')]&&_0x211ba4[_0xc65f('0x76')][_0x2f3347][_0xc65f('0x7a')]){_0x1999f9[_0x211ba4[_0xc65f('0x76')][_0x2f3347]['type']](_0x211ba4[_0xc65f('0x76')][_0x2f3347][_0xc65f('0x78')],null,util['format'](_0xc65f('0x79'),_0x211ba4[_0xc65f('0x6d')],_0x211ba4[_0xc65f('0x76')][_0x2f3347][_0xc65f('0x77')],_0x211ba4['joins'][_0x2f3347][_0xc65f('0x78')],_0x211ba4[_0xc65f('0x76')][_0x2f3347][_0xc65f('0x7a')]));}}}if(_0x211ba4[_0xc65f('0x7b')]){_0x211ba4[_0xc65f('0x7b')]=JSON['parse'](_0x211ba4['conditions']);_0x1999f9[_0xc65f('0x3c')](_0x4a6ec3(_0x211ba4[_0xc65f('0x7b')][_0xc65f('0x66')]));}_0x3088b7=_0x1999f9[_0xc65f('0x7d')]();_0x1999f9['limit'](_0x2f506c);_0x1999f9[_0xc65f('0x20')](0x0);return;}})['then'](function(){if(_0x27698a['output']===_0xc65f('0x8f')){return null;}var _0x38f356=_['merge'](_0x27698a,{'name':_0x27698a[_0xc65f('0x90')]||_0x27698a['name']||_0x211ba4['name'],'basename':_0x147a89,'savename':util[_0xc65f('0x71')](_0xc65f('0x91'),_0x27698a['name']||_0x211ba4[_0xc65f('0x2b')],require('randomstring')[_0xc65f('0x92')](0x4),_0x27698a[_0xc65f('0x93')]||_0xc65f('0x94')),'reportId':_0x211ba4['id'],'reportType':_0xc65f('0x95')});return db[_0xc65f('0x96')]['create'](_0x38f356,{'raw':!![]});})[_0xc65f('0x27')](function(_0xbee233){if(_0x211ba4['table']===_0xc65f('0x97')){_0x3088b7['where'](_0x211ba4[_0xc65f('0x6d')]+_0xc65f('0x98'),_0x27698a['startDate'],_0x27698a[_0xc65f('0x99')]);}else{_0x3088b7[_0xc65f('0x3c')](_0x211ba4[_0xc65f('0x6d')]+_0xc65f('0x9a'),_0x27698a[_0xc65f('0x9b')],_0x27698a[_0xc65f('0x99')]);}if(_0xbee233){logger[_0xc65f('0x9c')](_0xc65f('0x9d'),_0x3088b7['toString']());require(_0xc65f('0x9e'))[_0xc65f('0x9f')](path[_0xc65f('0x83')](__dirname,'../../components/export/',_0xbee233[_0xc65f('0x93')]),[_0xbee233['id'],_0x3088b7['toString'](),path[_0xc65f('0x83')](__dirname,_0xc65f('0xa0'),_0xbee233['savename']),_0x147a89]);return _0xbee233;}else{var _0x56d04b=squel[_0xc65f('0x6c')]();_0x56d04b['from']('('+_0x3088b7[_0xc65f('0x80')]()+')',_0xc65f('0xa1'));_0x56d04b[_0xc65f('0x75')](_0xc65f('0xa2'),_0xc65f('0x23'));_0x3088b7[_0xc65f('0x22')](_0x27698a['limit']||_0x2f506c);_0x3088b7['offset'](_0x27698a[_0xc65f('0x20')]||0x0);return dbH[_0xc65f('0x81')][_0xc65f('0x34')](_0x56d04b[_0xc65f('0x80')](),{'type':dbH['sequelize'][_0xc65f('0xa3')][_0xc65f('0x82')]})[_0xc65f('0x27')](function(_0x38c0a6){if(!_0x38c0a6[_0xc65f('0x64')]){_0xecdafe=0x0;}else{_0xecdafe=_0x38c0a6[0x0]['count']||0x0;}return dbH[_0xc65f('0x81')][_0xc65f('0x34')](_0x3088b7[_0xc65f('0x80')](),{'type':dbH['sequelize'][_0xc65f('0xa3')][_0xc65f('0x82')]});})[_0xc65f('0x27')](function(_0x4ce024){return{'rows':_0x4ce024||[],'count':_0xecdafe};});}});}exports[_0xc65f('0xa4')]=function(_0x39cb9c,_0x2e136d){return runReport(_0x39cb9c['params'],_0x39cb9c['query'],_0x39cb9c['options'])[_0xc65f('0x27')](respondWithResult(_0x2e136d,null))[_0xc65f('0x46')](handleError(_0x2e136d,null));};exports['runReport']=runReport;exports[_0xc65f('0x34')]=function(_0x38c783,_0x1c88e4){var _0x5b4381=0xa;var _0x4dd564=[_0xc65f('0x83'),_0xc65f('0x54'),_0xc65f('0x84'),_0xc65f('0x55')];var _0x164eba={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc65f('0x57'),'MAX':'MAX(%s)','MIN':_0xc65f('0x58'),'AVG':_0xc65f('0x59'),'GROUP_CONCAT':_0xc65f('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc65f('0x87')};var _0x44f435={'SEC_TO_TIME':_0xc65f('0x88'),'DATE':_0xc65f('0x5b'),'HOUR':_0xc65f('0x5c'),'ROUND':_0xc65f('0x5d'),'UNIX_TIMESTAMP':_0xc65f('0x5e')};var _0x2ca86e=function(_0x4abdd1){return!_[_0xc65f('0x5f')](['IS\x20NULL',_0xc65f('0x89'),'IS\x20EMPTY',_0xc65f('0x62')],_0x4abdd1);};var _0x270575=function(_0x34f2ee){if(!_0x34f2ee||!_0x34f2ee[_0xc65f('0x63')][_0xc65f('0x64')]){return'';}for(var _0x2cf828='(',_0x30533c=0x0;_0x30533c<_0x34f2ee[_0xc65f('0x63')][_0xc65f('0x64')];_0x30533c+=0x1){_0x30533c>0x0&&(_0x2cf828+='\x20'+_0x34f2ee[_0xc65f('0x65')]+'\x20');_0x2cf828+=_0x34f2ee[_0xc65f('0x63')][_0x30533c][_0xc65f('0x66')]?_0x270575(_0x34f2ee[_0xc65f('0x63')][_0x30533c]['group']):_0x34f2ee[_0xc65f('0x63')][_0x30533c][_0xc65f('0x75')]+'\x20'+_0x34f2ee[_0xc65f('0x63')][_0x30533c]['condition']+(_0x2ca86e(_0x34f2ee[_0xc65f('0x63')][_0x30533c]['condition'])?'\x20'+_0x34f2ee['rules'][_0x30533c][_0xc65f('0x68')]:'');}return _0x2cf828+')';};var _0x48df2c={'where':{'id':_0x38c783[_0xc65f('0x52')]['id']}},_0x45993d,_0x566bcb,_0x513857,_0x1553b1,_0x24f210;_0x48df2c=_[_0xc65f('0x3f')]({},_0x48df2c,_0x38c783['options']);return db['AnalyticCustomReport'][_0xc65f('0x48')](_0x48df2c)[_0xc65f('0x27')](function(_0x15ca08){if(_0x15ca08){_0x45993d=_0x15ca08;return _0x15ca08[_0xc65f('0x8a')]();}return null;})[_0xc65f('0x27')](function(_0x2b89fb){if(_0x2b89fb){if(!_0x2b89fb[_0xc65f('0x64')]){throw new db[(_0xc65f('0x8b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x566bcb=_0x2b89fb;return db[_0xc65f('0x6a')][_0xc65f('0x44')]({'raw':!![]});}return null;})[_0xc65f('0x27')](function(_0x518b3f){if(_0x518b3f){_0x513857=_[_0xc65f('0x6b')](_0x518b3f,'id');var _0x2fad82;var _0x54f890=squel[_0xc65f('0x6c')]();_0x54f890[_0xc65f('0xa5')](_0x45993d[_0xc65f('0x6d')]);for(var _0xfc90c=0x0;_0xfc90c<_0x566bcb['length'];_0xfc90c+=0x1){_0x2fad82=_0x566bcb[_0xfc90c]['MetricId']?_0x513857[_0x566bcb[_0xfc90c][_0xc65f('0x6e')]][_0xc65f('0x8c')]:_0x566bcb[_0xfc90c][_0xc65f('0x75')];_0x2fad82=_0x566bcb[_0xfc90c][_0xc65f('0x6f')]?_[_0xc65f('0x70')](_0x164eba[_0x566bcb[_0xfc90c]['function']],'%s',_0x2fad82):_0x2fad82;_0x2fad82=_0x566bcb[_0xfc90c][_0xc65f('0x71')]?_['replace'](_0x44f435[_0x566bcb[_0xfc90c][_0xc65f('0x71')]],'%s',_0x2fad82):_0x2fad82;if(_0x566bcb[_0xfc90c][_0xc65f('0x8d')]){_0x54f890[_0xc65f('0x66')](_0x2fad82);}_0x566bcb[_0xfc90c][_0xc65f('0x72')]&&_0x54f890[_0xc65f('0x73')](_0x2fad82,_0x566bcb[_0xfc90c][_0xc65f('0x72')]==='DESC'?![]:!![]);_0x54f890[_0xc65f('0x75')](_0x2fad82,_0x566bcb[_0xfc90c][_0xc65f('0x8e')]||_0x2fad82);}if(_0x45993d[_0xc65f('0x76')]){_0x45993d[_0xc65f('0x76')]=JSON[_0xc65f('0x7c')](_0x45993d[_0xc65f('0x76')]);for(var _0x5b5f1b=0x0;_0x5b5f1b<_0x45993d[_0xc65f('0x76')][_0xc65f('0x64')];_0x5b5f1b+=0x1){if(_0x45993d['joins'][_0x5b5f1b][_0xc65f('0x31')]&&_[_0xc65f('0x5f')](_0x4dd564,_0x45993d[_0xc65f('0x76')][_0x5b5f1b][_0xc65f('0x31')])&&_0x45993d[_0xc65f('0x76')][_0x5b5f1b][_0xc65f('0x77')]&&_0x45993d['joins'][_0x5b5f1b][_0xc65f('0x78')]&&_0x45993d['joins'][_0x5b5f1b]['foreignKey']){_0x54f890[_0x45993d[_0xc65f('0x76')][_0x5b5f1b][_0xc65f('0x31')]](_0x45993d[_0xc65f('0x76')][_0x5b5f1b][_0xc65f('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x45993d[_0xc65f('0x6d')],_0x45993d[_0xc65f('0x76')][_0x5b5f1b][_0xc65f('0x77')],_0x45993d['joins'][_0x5b5f1b][_0xc65f('0x78')],_0x45993d['joins'][_0x5b5f1b][_0xc65f('0x7a')]));}}}if(_0x45993d[_0xc65f('0x7b')]){_0x45993d['conditions']=JSON[_0xc65f('0x7c')](_0x45993d[_0xc65f('0x7b')]);_0x54f890[_0xc65f('0x3c')](_0x270575(_0x45993d[_0xc65f('0x7b')][_0xc65f('0x66')]));}_0x24f210=_0x54f890[_0xc65f('0x7d')]();_0x54f890['limit'](_0x5b4381);_0x54f890['offset'](0x0);logger[_0xc65f('0x7e')](_0xc65f('0x7f'),_0x54f890[_0xc65f('0x80')]());return dbH['sequelize'][_0xc65f('0x34')](_0x54f890[_0xc65f('0x80')](),{'type':dbH[_0xc65f('0x81')][_0xc65f('0xa3')][_0xc65f('0x82')]});}})['then'](function(){return{'sql':_0x24f210[_0xc65f('0x80')]()};})['then'](respondWithResult(_0x1c88e4,null))[_0xc65f('0x46')](handleError(_0x1c88e4,null));}; \ No newline at end of file +var _0x86c0=['../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','CustomReports','error','stack','name','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','left_join','right_join','cross_join','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)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','SUM(%s)','HOUR(%s)','IS\x20NULL','operator','groupBy','foreignKey','output','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','../../components/export/','../../files/reports','countTable','COUNT(*)','run','DESC','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x50889c,_0x202861){var _0x1b6024=function(_0x373eb0){while(--_0x373eb0){_0x50889c['push'](_0x50889c['shift']());}};_0x1b6024(++_0x202861);}(_0x86c0,0x8a));var _0x086c=function(_0x53ee43,_0x2a63ec){_0x53ee43=_0x53ee43-0x0;var _0x58b2ca=_0x86c0[_0x53ee43];return _0x58b2ca;};'use strict';var emlformat=require(_0x086c('0x0'));var rimraf=require(_0x086c('0x1'));var zipdir=require(_0x086c('0x2'));var jsonpatch=require(_0x086c('0x3'));var rp=require(_0x086c('0x4'));var moment=require(_0x086c('0x5'));var BPromise=require(_0x086c('0x6'));var Mustache=require(_0x086c('0x7'));var util=require(_0x086c('0x8'));var path=require(_0x086c('0x9'));var sox=require(_0x086c('0xa'));var csv=require(_0x086c('0xb'));var ejs=require(_0x086c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x086c('0xd'));var jsforce=require(_0x086c('0xe'));var deskjs=require(_0x086c('0xf'));var toCsv=require(_0x086c('0xb'));var querystring=require(_0x086c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x086c('0x11'));var qs=require(_0x086c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x086c('0x13'))(_0x086c('0x14'));var utils=require(_0x086c('0x15'));var config=require(_0x086c('0x16'));var licenseUtil=require(_0x086c('0x17'));var db=require(_0x086c('0x18'))['db'];var dbH=require(_0x086c('0x18'))[_0x086c('0x19')];function respondWithStatusCode(_0x2251e2,_0x683d64){_0x683d64=_0x683d64||0xcc;return function(_0x328be6){if(_0x328be6){return _0x2251e2[_0x086c('0x1a')](_0x683d64);}return _0x2251e2[_0x086c('0x1b')](_0x683d64)[_0x086c('0x1c')]();};}function respondWithResult(_0x340ed,_0x4412c2){_0x4412c2=_0x4412c2||0xc8;return function(_0x1b64dc){if(_0x1b64dc){return _0x340ed[_0x086c('0x1b')](_0x4412c2)[_0x086c('0x1d')](_0x1b64dc);}};}function respondWithFilteredResult(_0x3ac06a,_0x1c9e30){return function(_0x487d0a){if(_0x487d0a){var _0x4a095c=typeof _0x1c9e30[_0x086c('0x1e')]===_0x086c('0x1f')&&typeof _0x1c9e30[_0x086c('0x20')]===_0x086c('0x1f');var _0x2ef41d=_0x487d0a['count'];var _0x48e2e4=_0x4a095c?0x0:_0x1c9e30['offset'];var _0x303cfc=_0x4a095c?_0x487d0a[_0x086c('0x21')]:_0x1c9e30['offset']+_0x1c9e30[_0x086c('0x20')];var _0x9be560;if(_0x303cfc>=_0x2ef41d){_0x303cfc=_0x2ef41d;_0x9be560=0xc8;}else{_0x9be560=0xce;}_0x3ac06a[_0x086c('0x1b')](_0x9be560);return _0x3ac06a[_0x086c('0x22')](_0x086c('0x23'),_0x48e2e4+'-'+_0x303cfc+'/'+_0x2ef41d)[_0x086c('0x1d')](_0x487d0a);}return null;};}function patchUpdates(_0x1a7423){return function(_0x181b70){try{jsonpatch[_0x086c('0x24')](_0x181b70,_0x1a7423,!![]);}catch(_0xdbb867){return BPromise['reject'](_0xdbb867);}return _0x181b70['save']();};}function saveUpdates(_0x30ec3c,_0x4c1eee){return function(_0x4afb3a){if(_0x4afb3a){return _0x4afb3a[_0x086c('0x25')](_0x30ec3c)[_0x086c('0x26')](function(_0x57af26){return _0x57af26;});}return null;};}function removeEntity(_0x4b41d3,_0x5b6147){return function(_0x2702d5){if(_0x2702d5){return _0x2702d5['destroy']()[_0x086c('0x26')](function(){var _0x282c7f=_0x2702d5[_0x086c('0x27')]({'plain':!![]});var _0x3ca453=_0x086c('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3ca453,'resourceId':_0x282c7f['id']}})[_0x086c('0x26')](function(){return _0x2702d5;});})['then'](function(){_0x4b41d3[_0x086c('0x1b')](0xcc)[_0x086c('0x1c')]();});}};}function handleEntityNotFound(_0x468398,_0x381bf2){return function(_0x421227){if(!_0x421227){_0x468398[_0x086c('0x1a')](0x194);}return _0x421227;};}function handleError(_0x89f296,_0x34b895){_0x34b895=_0x34b895||0x1f4;return function(_0x24801b){logger[_0x086c('0x29')](_0x24801b[_0x086c('0x2a')]);if(_0x24801b[_0x086c('0x2b')]){delete _0x24801b[_0x086c('0x2b')];}_0x89f296['status'](_0x34b895)['send'](_0x24801b);};}exports['index']=function(_0x3f7496,_0x57b05a){var _0x1499f6={},_0x3f5a7f={},_0x513960={'count':0x0,'rows':[]};var _0x53fdf2=_[_0x086c('0x2c')](db['AnalyticCustomReport']['rawAttributes'],function(_0x535815){return{'name':_0x535815[_0x086c('0x2d')],'type':_0x535815[_0x086c('0x2e')][_0x086c('0x2f')]};});_0x3f5a7f[_0x086c('0x30')]=_[_0x086c('0x2c')](_0x53fdf2,_0x086c('0x2b'));_0x3f5a7f[_0x086c('0x31')]=_['keys'](_0x3f7496[_0x086c('0x31')]);_0x3f5a7f[_0x086c('0x32')]=_['intersection'](_0x3f5a7f[_0x086c('0x30')],_0x3f5a7f[_0x086c('0x31')]);_0x1499f6[_0x086c('0x33')]=_[_0x086c('0x34')](_0x3f5a7f[_0x086c('0x30')],qs[_0x086c('0x35')](_0x3f7496[_0x086c('0x31')]['fields']));_0x1499f6[_0x086c('0x33')]=_0x1499f6[_0x086c('0x33')][_0x086c('0x36')]?_0x1499f6[_0x086c('0x33')]:_0x3f5a7f[_0x086c('0x30')];if(!_0x3f7496[_0x086c('0x31')][_0x086c('0x37')](_0x086c('0x38'))){_0x1499f6[_0x086c('0x20')]=qs['limit'](_0x3f7496['query'][_0x086c('0x20')]);_0x1499f6[_0x086c('0x1e')]=qs['offset'](_0x3f7496[_0x086c('0x31')]['offset']);}_0x1499f6[_0x086c('0x39')]=qs[_0x086c('0x3a')](_0x3f7496[_0x086c('0x31')][_0x086c('0x3a')]);_0x1499f6[_0x086c('0x3b')]=qs[_0x086c('0x32')](_['pick'](_0x3f7496[_0x086c('0x31')],_0x3f5a7f[_0x086c('0x32')]),_0x53fdf2);if(_0x3f7496[_0x086c('0x31')][_0x086c('0x3c')]){_0x1499f6[_0x086c('0x3b')]=_[_0x086c('0x3d')](_0x1499f6['where'],{'$or':_['map'](_0x53fdf2,function(_0x2cf43d){if(_0x2cf43d[_0x086c('0x2e')]!==_0x086c('0x3e')){var _0x17dda2={};_0x17dda2[_0x2cf43d[_0x086c('0x2b')]]={'$like':'%'+_0x3f7496[_0x086c('0x31')][_0x086c('0x3c')]+'%'};return _0x17dda2;}})});}_0x1499f6=_[_0x086c('0x3d')]({},_0x1499f6,_0x3f7496[_0x086c('0x3f')]);var _0x186e1d={'where':_0x1499f6['where']};return db[_0x086c('0x40')][_0x086c('0x21')](_0x186e1d)[_0x086c('0x26')](function(_0x541e77){_0x513960[_0x086c('0x21')]=_0x541e77;if(_0x3f7496[_0x086c('0x31')][_0x086c('0x41')]){_0x1499f6['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x1499f6);})[_0x086c('0x26')](function(_0xa7bfd3){_0x513960[_0x086c('0x42')]=_0xa7bfd3;return _0x513960;})[_0x086c('0x26')](respondWithFilteredResult(_0x57b05a,_0x1499f6))[_0x086c('0x43')](handleError(_0x57b05a,null));};exports[_0x086c('0x44')]=function(_0x1dc3ad,_0x31ea4e){var _0xbcb935={'raw':![],'where':{'id':_0x1dc3ad[_0x086c('0x45')]['id']}},_0x57cd5e={};_0x57cd5e[_0x086c('0x30')]=_[_0x086c('0x46')](db['AnalyticCustomReport'][_0x086c('0x47')]);_0x57cd5e[_0x086c('0x31')]=_[_0x086c('0x46')](_0x1dc3ad[_0x086c('0x31')]);_0x57cd5e['filters']=_[_0x086c('0x34')](_0x57cd5e['model'],_0x57cd5e['query']);_0xbcb935[_0x086c('0x33')]=_[_0x086c('0x34')](_0x57cd5e['model'],qs[_0x086c('0x35')](_0x1dc3ad[_0x086c('0x31')][_0x086c('0x35')]));_0xbcb935[_0x086c('0x33')]=_0xbcb935[_0x086c('0x33')][_0x086c('0x36')]?_0xbcb935[_0x086c('0x33')]:_0x57cd5e[_0x086c('0x30')];if(_0x1dc3ad[_0x086c('0x31')][_0x086c('0x41')]){_0xbcb935[_0x086c('0x48')]=[{'all':!![]}];}_0xbcb935=_[_0x086c('0x3d')]({},_0xbcb935,_0x1dc3ad[_0x086c('0x3f')]);return db[_0x086c('0x40')]['find'](_0xbcb935)['then'](handleEntityNotFound(_0x31ea4e,null))[_0x086c('0x26')](respondWithResult(_0x31ea4e,null))[_0x086c('0x43')](handleError(_0x31ea4e,null));};exports[_0x086c('0x49')]=function(_0x564677,_0x3b0c15){return db[_0x086c('0x40')][_0x086c('0x49')](_0x564677[_0x086c('0x4a')],{})[_0x086c('0x26')](function(_0x2b1faa){var _0x20766c=_0x564677['user'][_0x086c('0x27')]({'plain':!![]});if(!_0x20766c)throw new Error(_0x086c('0x4b'));if(_0x20766c[_0x086c('0x4c')]==='user'){var _0x38edc9=_0x2b1faa[_0x086c('0x27')]({'plain':!![]});var _0x556d09=_0x086c('0x4d');return db[_0x086c('0x4e')][_0x086c('0x4f')]({'where':{'name':_0x556d09,'userProfileId':_0x20766c[_0x086c('0x50')]},'raw':!![]})[_0x086c('0x26')](function(_0x124de0){if(_0x124de0&&_0x124de0[_0x086c('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x38edc9[_0x086c('0x2b')],'resourceId':_0x38edc9['id'],'type':_0x086c('0x28'),'sectionId':_0x124de0['id']},{})['then'](function(){return _0x2b1faa;});}else{return _0x2b1faa;}})[_0x086c('0x43')](function(_0x1dad83){logger[_0x086c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dad83);throw _0x1dad83;});}return _0x2b1faa;})[_0x086c('0x26')](respondWithResult(_0x3b0c15,0xc9))[_0x086c('0x43')](handleError(_0x3b0c15,null));};exports[_0x086c('0x25')]=function(_0x43c166,_0x1efb07){if(_0x43c166[_0x086c('0x4a')]['id']){delete _0x43c166[_0x086c('0x4a')]['id'];}return db[_0x086c('0x40')][_0x086c('0x4f')]({'where':{'id':_0x43c166['params']['id']}})[_0x086c('0x26')](handleEntityNotFound(_0x1efb07,null))['then'](saveUpdates(_0x43c166['body'],null))[_0x086c('0x26')](respondWithResult(_0x1efb07,null))[_0x086c('0x43')](handleError(_0x1efb07,null));};exports['destroy']=function(_0x27fded,_0x1f6443){return db[_0x086c('0x40')][_0x086c('0x4f')]({'where':{'id':_0x27fded[_0x086c('0x45')]['id']}})[_0x086c('0x26')](handleEntityNotFound(_0x1f6443,null))[_0x086c('0x26')](removeEntity(_0x1f6443,null))[_0x086c('0x43')](handleError(_0x1f6443,null));};exports['preview']=function(_0x4d3efa,_0x2ee316){var _0x640a42=0xa;var _0x1e04b7=['join',_0x086c('0x52'),_0x086c('0x53'),_0x086c('0x54')];var _0x5a545c={'SUM':'SUM(%s)','COUNT':_0x086c('0x55'),'COUNT DISTINCT':_0x086c('0x56'),'MAX':_0x086c('0x57'),'MIN':_0x086c('0x58'),'AVG':_0x086c('0x59'),'GROUP_CONCAT':_0x086c('0x5a'),'GROUP_CONCAT ASC':_0x086c('0x5b'),'GROUP_CONCAT DESC':_0x086c('0x5c')};var _0x5a27c6={'SEC_TO_TIME':_0x086c('0x5d'),'DATE':_0x086c('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x086c('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x24f473=function(_0x466dd1){return!_[_0x086c('0x60')](['IS\x20NULL',_0x086c('0x61'),_0x086c('0x62'),_0x086c('0x63')],_0x466dd1);};var _0x48a83f=function(_0x4aff46){if(!_0x4aff46||!_0x4aff46[_0x086c('0x64')][_0x086c('0x36')]){return'';}for(var _0x231402='(',_0x471238=0x0;_0x471238<_0x4aff46[_0x086c('0x64')][_0x086c('0x36')];_0x471238+=0x1){_0x471238>0x0&&(_0x231402+='\x20'+_0x4aff46['operator']+'\x20');_0x231402+=_0x4aff46[_0x086c('0x64')][_0x471238][_0x086c('0x65')]?_0x48a83f(_0x4aff46[_0x086c('0x64')][_0x471238]['group']):_0x4aff46[_0x086c('0x64')][_0x471238]['field']+'\x20'+_0x4aff46[_0x086c('0x64')][_0x471238][_0x086c('0x66')]+(_0x24f473(_0x4aff46[_0x086c('0x64')][_0x471238][_0x086c('0x66')])?'\x20'+_0x4aff46[_0x086c('0x64')][_0x471238][_0x086c('0x67')]:'');}return _0x231402+')';};var _0x1f3a34={'where':{'id':_0x4d3efa[_0x086c('0x45')]['id']}},_0x50449b,_0x5e938b,_0x592c7f,_0xa06ec9,_0x20e6e8;_0x1f3a34=_[_0x086c('0x3d')]({},_0x1f3a34,_0x4d3efa['options']);return db[_0x086c('0x40')][_0x086c('0x4f')](_0x1f3a34)[_0x086c('0x26')](function(_0x1cf275){if(_0x1cf275){_0x50449b=_0x1cf275;return _0x1cf275[_0x086c('0x68')]();}return null;})[_0x086c('0x26')](function(_0x6f1586){if(_0x6f1586){if(!_0x6f1586['length']){throw new db[(_0x086c('0x69'))][(_0x086c('0x6a'))](_0x086c('0x6b'),0x193);}_0x5e938b=_0x6f1586;return db[_0x086c('0x6c')][_0x086c('0x6d')]({'raw':!![]});}return null;})[_0x086c('0x26')](function(_0x221007){if(_0x221007){_0x592c7f=_[_0x086c('0x6e')](_0x221007,'id');var _0x1a11ce;var _0x7233e9=squel[_0x086c('0x6f')]();_0x7233e9[_0x086c('0x70')](_0x50449b['table']);for(var _0x2a0dc3=0x0;_0x2a0dc3<_0x5e938b['length'];_0x2a0dc3+=0x1){_0x1a11ce=_0x5e938b[_0x2a0dc3][_0x086c('0x71')]?_0x592c7f[_0x5e938b[_0x2a0dc3][_0x086c('0x71')]][_0x086c('0x72')]:_0x5e938b[_0x2a0dc3][_0x086c('0x73')];_0x1a11ce=_0x5e938b[_0x2a0dc3][_0x086c('0x74')]?_[_0x086c('0x75')](_0x5a545c[_0x5e938b[_0x2a0dc3][_0x086c('0x74')]],'%s',_0x1a11ce):_0x1a11ce;_0x1a11ce=_0x5e938b[_0x2a0dc3][_0x086c('0x76')]?_[_0x086c('0x75')](_0x5a27c6[_0x5e938b[_0x2a0dc3][_0x086c('0x76')]],'%s',_0x1a11ce):_0x1a11ce;if(_0x5e938b[_0x2a0dc3]['groupBy']){_0x7233e9[_0x086c('0x65')](_0x1a11ce);}_0x5e938b[_0x2a0dc3][_0x086c('0x77')]&&_0x7233e9[_0x086c('0x39')](_0x1a11ce,_0x5e938b[_0x2a0dc3]['orderBy']==='DESC'?![]:!![]);_0x7233e9[_0x086c('0x73')](_0x1a11ce,_0x5e938b[_0x2a0dc3][_0x086c('0x78')]||_0x1a11ce);}if(_0x50449b[_0x086c('0x79')]){_0x50449b[_0x086c('0x79')]=JSON[_0x086c('0x7a')](_0x50449b[_0x086c('0x79')]);for(var _0x290a4f=0x0;_0x290a4f<_0x50449b[_0x086c('0x79')][_0x086c('0x36')];_0x290a4f+=0x1){if(_0x50449b['joins'][_0x290a4f][_0x086c('0x2e')]&&_[_0x086c('0x60')](_0x1e04b7,_0x50449b['joins'][_0x290a4f]['type'])&&_0x50449b[_0x086c('0x79')][_0x290a4f][_0x086c('0x7b')]&&_0x50449b[_0x086c('0x79')][_0x290a4f][_0x086c('0x7c')]&&_0x50449b[_0x086c('0x79')][_0x290a4f]['foreignKey']){_0x7233e9[_0x50449b[_0x086c('0x79')][_0x290a4f]['type']](_0x50449b[_0x086c('0x79')][_0x290a4f]['foreignTable'],null,util[_0x086c('0x76')]('%s.%s\x20=\x20%s.%s',_0x50449b[_0x086c('0x7d')],_0x50449b[_0x086c('0x79')][_0x290a4f][_0x086c('0x7b')],_0x50449b[_0x086c('0x79')][_0x290a4f][_0x086c('0x7c')],_0x50449b[_0x086c('0x79')][_0x290a4f]['foreignKey']));}}}if(_0x50449b['conditions']){_0x50449b[_0x086c('0x7e')]=JSON['parse'](_0x50449b['conditions']);_0x7233e9[_0x086c('0x3b')](_0x48a83f(_0x50449b['conditions']['group']));}_0x20e6e8=_0x7233e9[_0x086c('0x7f')]();_0x7233e9['limit'](_0x640a42);_0x7233e9['offset'](0x0);logger[_0x086c('0x80')](_0x086c('0x81'),_0x7233e9[_0x086c('0x82')]());return dbH[_0x086c('0x83')]['query'](_0x7233e9[_0x086c('0x82')](),{'type':dbH[_0x086c('0x83')][_0x086c('0x84')][_0x086c('0x85')]});}})[_0x086c('0x26')](respondWithResult(_0x2ee316,null))['catch'](handleError(_0x2ee316,null));};function runReport(_0xb5f891,_0x173fe0,_0x65107a){var _0x3f9a3d=_0x173fe0[_0x086c('0x2b')];var _0x3bb497=0xa;var _0x2329d8=[_0x086c('0x86'),'left_join',_0x086c('0x53'),_0x086c('0x54')];var _0xc4c8ad={'SUM':_0x086c('0x87'),'COUNT':_0x086c('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x086c('0x57'),'MIN':_0x086c('0x58'),'AVG':_0x086c('0x59'),'GROUP_CONCAT':_0x086c('0x5a'),'GROUP_CONCAT ASC':_0x086c('0x5b'),'GROUP_CONCAT DESC':_0x086c('0x5c')};var _0x37105f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x086c('0x5e'),'HOUR':_0x086c('0x88'),'ROUND':_0x086c('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3c9c2b=function(_0x5c6d9c){return!_['includes']([_0x086c('0x89'),_0x086c('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5c6d9c);};var _0x28d852=function(_0x103665){if(!_0x103665||!_0x103665[_0x086c('0x64')]['length']){return'';}for(var _0x2f5a8e='(',_0x1b80e4=0x0;_0x1b80e4<_0x103665[_0x086c('0x64')][_0x086c('0x36')];_0x1b80e4+=0x1){_0x1b80e4>0x0&&(_0x2f5a8e+='\x20'+_0x103665[_0x086c('0x8a')]+'\x20');_0x2f5a8e+=_0x103665[_0x086c('0x64')][_0x1b80e4][_0x086c('0x65')]?_0x28d852(_0x103665[_0x086c('0x64')][_0x1b80e4][_0x086c('0x65')]):_0x103665[_0x086c('0x64')][_0x1b80e4][_0x086c('0x73')]+'\x20'+_0x103665['rules'][_0x1b80e4][_0x086c('0x66')]+(_0x3c9c2b(_0x103665['rules'][_0x1b80e4]['condition'])?'\x20'+_0x103665[_0x086c('0x64')][_0x1b80e4][_0x086c('0x67')]:'');}return _0x2f5a8e+')';};var _0x2b1232={'where':{'id':_0xb5f891['id']}},_0x2f94ff,_0x1ebf8c,_0x22f29a,_0x5eae8,_0x2cd43c;_0x2b1232=_[_0x086c('0x3d')]({},_0x2b1232,_0x65107a);return db[_0x086c('0x40')][_0x086c('0x4f')](_0x2b1232)[_0x086c('0x26')](function(_0xef09c){if(_0xef09c){_0x2f94ff=_0xef09c;return _0xef09c['getFields']();}return null;})['then'](function(_0x232aac){if(_0x232aac){if(!_0x232aac[_0x086c('0x36')]){throw new db[(_0x086c('0x69'))][(_0x086c('0x6a'))](_0x086c('0x6b'),0x193);}_0x1ebf8c=_0x232aac;return db[_0x086c('0x6c')][_0x086c('0x6d')]({'raw':!![]});}return null;})[_0x086c('0x26')](function(_0x3e8d2c){if(_0x3e8d2c){_0x22f29a=_[_0x086c('0x6e')](_0x3e8d2c,'id');var _0x272f59;var _0x30fa91=squel[_0x086c('0x6f')]();_0x30fa91[_0x086c('0x70')](_0x2f94ff[_0x086c('0x7d')]);for(var _0x59903f=0x0;_0x59903f<_0x1ebf8c[_0x086c('0x36')];_0x59903f+=0x1){_0x272f59=_0x1ebf8c[_0x59903f][_0x086c('0x71')]?_0x22f29a[_0x1ebf8c[_0x59903f]['MetricId']][_0x086c('0x72')]:_0x1ebf8c[_0x59903f]['field'];_0x272f59=_0x1ebf8c[_0x59903f][_0x086c('0x74')]?_[_0x086c('0x75')](_0xc4c8ad[_0x1ebf8c[_0x59903f][_0x086c('0x74')]],'%s',_0x272f59):_0x272f59;_0x272f59=_0x1ebf8c[_0x59903f][_0x086c('0x76')]?_['replace'](_0x37105f[_0x1ebf8c[_0x59903f][_0x086c('0x76')]],'%s',_0x272f59):_0x272f59;if(_0x1ebf8c[_0x59903f][_0x086c('0x8b')]){_0x30fa91[_0x086c('0x65')](_0x272f59);}_0x1ebf8c[_0x59903f][_0x086c('0x77')]&&_0x30fa91[_0x086c('0x39')](_0x272f59,_0x1ebf8c[_0x59903f]['orderBy']==='DESC'?![]:!![]);_0x30fa91[_0x086c('0x73')](_0x272f59,_0x1ebf8c[_0x59903f][_0x086c('0x78')]||_0x272f59);}if(_0x2f94ff['joins']){_0x2f94ff[_0x086c('0x79')]=JSON['parse'](_0x2f94ff[_0x086c('0x79')]);for(var _0x1fae5d=0x0;_0x1fae5d<_0x2f94ff[_0x086c('0x79')][_0x086c('0x36')];_0x1fae5d+=0x1){if(_0x2f94ff[_0x086c('0x79')][_0x1fae5d][_0x086c('0x2e')]&&_[_0x086c('0x60')](_0x2329d8,_0x2f94ff[_0x086c('0x79')][_0x1fae5d]['type'])&&_0x2f94ff[_0x086c('0x79')][_0x1fae5d][_0x086c('0x7b')]&&_0x2f94ff[_0x086c('0x79')][_0x1fae5d][_0x086c('0x7c')]&&_0x2f94ff[_0x086c('0x79')][_0x1fae5d][_0x086c('0x8c')]){_0x30fa91[_0x2f94ff[_0x086c('0x79')][_0x1fae5d]['type']](_0x2f94ff[_0x086c('0x79')][_0x1fae5d][_0x086c('0x7c')],null,util[_0x086c('0x76')]('%s.%s\x20=\x20%s.%s',_0x2f94ff[_0x086c('0x7d')],_0x2f94ff['joins'][_0x1fae5d][_0x086c('0x7b')],_0x2f94ff[_0x086c('0x79')][_0x1fae5d][_0x086c('0x7c')],_0x2f94ff[_0x086c('0x79')][_0x1fae5d][_0x086c('0x8c')]));}}}if(_0x2f94ff[_0x086c('0x7e')]){_0x2f94ff[_0x086c('0x7e')]=JSON[_0x086c('0x7a')](_0x2f94ff['conditions']);_0x30fa91['where'](_0x28d852(_0x2f94ff[_0x086c('0x7e')][_0x086c('0x65')]));}_0x2cd43c=_0x30fa91['clone']();_0x30fa91[_0x086c('0x20')](_0x3bb497);_0x30fa91['offset'](0x0);return;}})[_0x086c('0x26')](function(){if(_0x173fe0[_0x086c('0x8d')]==='web'){return null;}var _0x2638dd=_[_0x086c('0x3d')](_0x173fe0,{'name':_0x173fe0[_0x086c('0x8e')]||_0x173fe0[_0x086c('0x2b')]||_0x2f94ff[_0x086c('0x2b')],'basename':_0x3f9a3d,'savename':util[_0x086c('0x76')](_0x086c('0x8f'),_0x173fe0[_0x086c('0x2b')]||_0x2f94ff[_0x086c('0x2b')],require('randomstring')['generate'](0x4),_0x173fe0[_0x086c('0x8d')]||_0x086c('0x90')),'reportId':_0x2f94ff['id'],'reportType':_0x086c('0x91')});return db[_0x086c('0x92')]['create'](_0x2638dd,{'raw':!![]});})[_0x086c('0x26')](function(_0x2047a9){if(_0x2f94ff[_0x086c('0x7d')]===_0x086c('0x93')){_0x2cd43c[_0x086c('0x3b')](_0x2f94ff['table']+_0x086c('0x94'),_0x173fe0[_0x086c('0x95')],_0x173fe0[_0x086c('0x96')]);}else{_0x2cd43c['where'](_0x2f94ff[_0x086c('0x7d')]+_0x086c('0x97'),_0x173fe0[_0x086c('0x95')],_0x173fe0['endDate']);}if(_0x2047a9){logger[_0x086c('0x98')]('Run\x20Query:',_0x2cd43c[_0x086c('0x82')]());require('child_process')['fork'](path['join'](__dirname,_0x086c('0x99'),_0x2047a9[_0x086c('0x8d')]),[_0x2047a9['id'],_0x2cd43c[_0x086c('0x82')](),path[_0x086c('0x86')](__dirname,_0x086c('0x9a'),_0x2047a9['savename']),_0x3f9a3d]);return _0x2047a9;}else{var _0x3504b3=squel['select']();_0x3504b3[_0x086c('0x70')]('('+_0x2cd43c['toString']()+')',_0x086c('0x9b'));_0x3504b3[_0x086c('0x73')](_0x086c('0x9c'),_0x086c('0x21'));_0x2cd43c['limit'](_0x173fe0[_0x086c('0x20')]||_0x3bb497);_0x2cd43c['offset'](_0x173fe0[_0x086c('0x1e')]||0x0);return dbH[_0x086c('0x83')][_0x086c('0x31')](_0x3504b3[_0x086c('0x82')](),{'type':dbH[_0x086c('0x83')][_0x086c('0x84')][_0x086c('0x85')]})[_0x086c('0x26')](function(_0x1ac06b){if(!_0x1ac06b[_0x086c('0x36')]){_0x5eae8=0x0;}else{_0x5eae8=_0x1ac06b[0x0][_0x086c('0x21')]||0x0;}return dbH[_0x086c('0x83')][_0x086c('0x31')](_0x2cd43c[_0x086c('0x82')](),{'type':dbH[_0x086c('0x83')][_0x086c('0x84')][_0x086c('0x85')]});})[_0x086c('0x26')](function(_0x2c2ae5){return{'rows':_0x2c2ae5||[],'count':_0x5eae8};});}});}exports[_0x086c('0x9d')]=function(_0x4da27f,_0x25bb66){return runReport(_0x4da27f[_0x086c('0x45')],_0x4da27f[_0x086c('0x31')],_0x4da27f[_0x086c('0x3f')])[_0x086c('0x26')](respondWithResult(_0x25bb66,null))[_0x086c('0x43')](handleError(_0x25bb66,null));};exports['runReport']=runReport;exports[_0x086c('0x31')]=function(_0xd9cac1,_0x47db41){var _0x485b4a=0xa;var _0x4e3d94=[_0x086c('0x86'),'left_join',_0x086c('0x53'),_0x086c('0x54')];var _0xfbc11c={'SUM':'SUM(%s)','COUNT':_0x086c('0x55'),'COUNT DISTINCT':_0x086c('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x086c('0x59'),'GROUP_CONCAT':_0x086c('0x5a'),'GROUP_CONCAT ASC':_0x086c('0x5b'),'GROUP_CONCAT DESC':_0x086c('0x5c')};var _0x17dd92={'SEC_TO_TIME':_0x086c('0x5d'),'DATE':_0x086c('0x5e'),'HOUR':_0x086c('0x88'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4a181e=function(_0x19620a){return!_[_0x086c('0x60')]([_0x086c('0x89'),_0x086c('0x61'),_0x086c('0x62'),_0x086c('0x63')],_0x19620a);};var _0x284162=function(_0x55dd90){if(!_0x55dd90||!_0x55dd90[_0x086c('0x64')][_0x086c('0x36')]){return'';}for(var _0x377862='(',_0x33494a=0x0;_0x33494a<_0x55dd90[_0x086c('0x64')][_0x086c('0x36')];_0x33494a+=0x1){_0x33494a>0x0&&(_0x377862+='\x20'+_0x55dd90[_0x086c('0x8a')]+'\x20');_0x377862+=_0x55dd90[_0x086c('0x64')][_0x33494a]['group']?_0x284162(_0x55dd90[_0x086c('0x64')][_0x33494a]['group']):_0x55dd90[_0x086c('0x64')][_0x33494a][_0x086c('0x73')]+'\x20'+_0x55dd90[_0x086c('0x64')][_0x33494a][_0x086c('0x66')]+(_0x4a181e(_0x55dd90[_0x086c('0x64')][_0x33494a][_0x086c('0x66')])?'\x20'+_0x55dd90[_0x086c('0x64')][_0x33494a][_0x086c('0x67')]:'');}return _0x377862+')';};var _0x227d65={'where':{'id':_0xd9cac1[_0x086c('0x45')]['id']}},_0x47feca,_0x333fca,_0x50a5d7,_0x46fadc,_0x1e0722;_0x227d65=_[_0x086c('0x3d')]({},_0x227d65,_0xd9cac1[_0x086c('0x3f')]);return db['AnalyticCustomReport']['find'](_0x227d65)['then'](function(_0x21361a){if(_0x21361a){_0x47feca=_0x21361a;return _0x21361a[_0x086c('0x68')]();}return null;})[_0x086c('0x26')](function(_0x3f3ba9){if(_0x3f3ba9){if(!_0x3f3ba9[_0x086c('0x36')]){throw new db['Sequelize'][(_0x086c('0x6a'))](_0x086c('0x6b'),0x193);}_0x333fca=_0x3f3ba9;return db[_0x086c('0x6c')][_0x086c('0x6d')]({'raw':!![]});}return null;})[_0x086c('0x26')](function(_0x543b97){if(_0x543b97){_0x50a5d7=_['keyBy'](_0x543b97,'id');var _0x1fcc7e;var _0x4d2f19=squel[_0x086c('0x6f')]();_0x4d2f19['from'](_0x47feca[_0x086c('0x7d')]);for(var _0x4cf8be=0x0;_0x4cf8be<_0x333fca[_0x086c('0x36')];_0x4cf8be+=0x1){_0x1fcc7e=_0x333fca[_0x4cf8be][_0x086c('0x71')]?_0x50a5d7[_0x333fca[_0x4cf8be][_0x086c('0x71')]][_0x086c('0x72')]:_0x333fca[_0x4cf8be][_0x086c('0x73')];_0x1fcc7e=_0x333fca[_0x4cf8be][_0x086c('0x74')]?_[_0x086c('0x75')](_0xfbc11c[_0x333fca[_0x4cf8be][_0x086c('0x74')]],'%s',_0x1fcc7e):_0x1fcc7e;_0x1fcc7e=_0x333fca[_0x4cf8be][_0x086c('0x76')]?_[_0x086c('0x75')](_0x17dd92[_0x333fca[_0x4cf8be]['format']],'%s',_0x1fcc7e):_0x1fcc7e;if(_0x333fca[_0x4cf8be]['groupBy']){_0x4d2f19[_0x086c('0x65')](_0x1fcc7e);}_0x333fca[_0x4cf8be][_0x086c('0x77')]&&_0x4d2f19[_0x086c('0x39')](_0x1fcc7e,_0x333fca[_0x4cf8be][_0x086c('0x77')]===_0x086c('0x9e')?![]:!![]);_0x4d2f19[_0x086c('0x73')](_0x1fcc7e,_0x333fca[_0x4cf8be][_0x086c('0x78')]||_0x1fcc7e);}if(_0x47feca[_0x086c('0x79')]){_0x47feca[_0x086c('0x79')]=JSON['parse'](_0x47feca['joins']);for(var _0x19083b=0x0;_0x19083b<_0x47feca[_0x086c('0x79')][_0x086c('0x36')];_0x19083b+=0x1){if(_0x47feca[_0x086c('0x79')][_0x19083b][_0x086c('0x2e')]&&_[_0x086c('0x60')](_0x4e3d94,_0x47feca[_0x086c('0x79')][_0x19083b][_0x086c('0x2e')])&&_0x47feca[_0x086c('0x79')][_0x19083b]['parentKey']&&_0x47feca['joins'][_0x19083b][_0x086c('0x7c')]&&_0x47feca['joins'][_0x19083b][_0x086c('0x8c')]){_0x4d2f19[_0x47feca[_0x086c('0x79')][_0x19083b][_0x086c('0x2e')]](_0x47feca[_0x086c('0x79')][_0x19083b][_0x086c('0x7c')],null,util[_0x086c('0x76')](_0x086c('0x9f'),_0x47feca[_0x086c('0x7d')],_0x47feca[_0x086c('0x79')][_0x19083b][_0x086c('0x7b')],_0x47feca['joins'][_0x19083b][_0x086c('0x7c')],_0x47feca[_0x086c('0x79')][_0x19083b][_0x086c('0x8c')]));}}}if(_0x47feca[_0x086c('0x7e')]){_0x47feca[_0x086c('0x7e')]=JSON['parse'](_0x47feca[_0x086c('0x7e')]);_0x4d2f19[_0x086c('0x3b')](_0x284162(_0x47feca[_0x086c('0x7e')]['group']));}_0x1e0722=_0x4d2f19[_0x086c('0x7f')]();_0x4d2f19[_0x086c('0x20')](_0x485b4a);_0x4d2f19[_0x086c('0x1e')](0x0);logger[_0x086c('0x80')](_0x086c('0x81'),_0x4d2f19['toString']());return dbH[_0x086c('0x83')][_0x086c('0x31')](_0x4d2f19[_0x086c('0x82')](),{'type':dbH[_0x086c('0x83')][_0x086c('0x84')][_0x086c('0x85')]});}})[_0x086c('0x26')](function(){return{'sql':_0x1e0722[_0x086c('0x82')]()};})['then'](respondWithResult(_0x47db41,null))[_0x086c('0x43')](handleError(_0x47db41,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 634533e..934e2b8 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 _0x0271=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','lodash','util','moment','bluebird'];(function(_0x5244f2,_0x4f2e11){var _0x4761de=function(_0x565aae){while(--_0x565aae){_0x5244f2['push'](_0x5244f2['shift']());}};_0x4761de(++_0x4f2e11);}(_0x0271,0x92));var _0x1027=function(_0x5e9f9d,_0xc1d10){_0x5e9f9d=_0x5e9f9d-0x0;var _0x3e23ce=_0x0271[_0x5e9f9d];return _0x3e23ce;};'use strict';var _=require(_0x1027('0x0'));var util=require(_0x1027('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1027('0x2'));var BPromise=require(_0x1027('0x3'));var rp=require(_0x1027('0x4'));var fs=require('fs');var path=require(_0x1027('0x5'));var rimraf=require(_0x1027('0x6'));var config=require(_0x1027('0x7'));var attributes=require(_0x1027('0x8'));module[_0x1027('0x9')]=function(_0xadc00f,_0x3eeb8f){return _0xadc00f['define']('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5aee=['moment','request-promise','path','rimraf','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x5aee,0xe3));var _0xe5ae=function(_0x3d153d,_0x192333){_0x3d153d=_0x3d153d-0x0;var _0x50d0b4=_0x5aee[_0x3d153d];return _0x50d0b4;};'use strict';var _=require(_0xe5ae('0x0'));var util=require(_0xe5ae('0x1'));var logger=require(_0xe5ae('0x2'))(_0xe5ae('0x3'));var moment=require(_0xe5ae('0x4'));var BPromise=require('bluebird');var rp=require(_0xe5ae('0x5'));var fs=require('fs');var path=require(_0xe5ae('0x6'));var rimraf=require(_0xe5ae('0x7'));var config=require('../../config/environment');var attributes=require(_0xe5ae('0x8'));module['exports']=function(_0x25ec4c,_0x5260cf){return _0x25ec4c[_0xe5ae('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xe5ae('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 228cc2d..70da070 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 _0x16a8=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16a8,0xf4));var _0x816a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x16a8[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x816a('0x0'));var util=require(_0x816a('0x1'));var moment=require(_0x816a('0x2'));var BPromise=require(_0x816a('0x3'));var rs=require(_0x816a('0x4'));var fs=require('fs');var Redis=require(_0x816a('0x5'));var db=require(_0x816a('0x6'))['db'];var utils=require(_0x816a('0x7'));var logger=require(_0x816a('0x8'))(_0x816a('0x9'));var config=require(_0x816a('0xa'));var jayson=require(_0x816a('0xb'));var client=jayson['client'][_0x816a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26857d,_0x514a8c,_0x18347){return new BPromise(function(_0xba22ec,_0x3dfac5){return client[_0x816a('0xd')](_0x26857d,_0x18347)[_0x816a('0xe')](function(_0x4e3838){logger[_0x816a('0xf')](_0x816a('0x10'),_0x514a8c,_0x816a('0x11'));logger[_0x816a('0x12')](_0x816a('0x13'),_0x514a8c,_0x816a('0x11'),JSON[_0x816a('0x14')](_0x4e3838));if(_0x4e3838[_0x816a('0x15')]){if(_0x4e3838[_0x816a('0x15')]['code']===0x1f4){logger[_0x816a('0x15')](_0x816a('0x10'),_0x514a8c,_0x4e3838[_0x816a('0x15')][_0x816a('0x16')]);return _0x3dfac5(_0x4e3838[_0x816a('0x15')][_0x816a('0x16')]);}logger['error'](_0x816a('0x10'),_0x514a8c,_0x4e3838['error'][_0x816a('0x16')]);return _0xba22ec(_0x4e3838[_0x816a('0x15')][_0x816a('0x16')]);}else{logger[_0x816a('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x514a8c,_0x816a('0x11'));_0xba22ec(_0x4e3838[_0x816a('0x17')]['message']);}})['catch'](function(_0x40910f){logger[_0x816a('0x15')](_0x816a('0x10'),_0x514a8c,_0x40910f);_0x3dfac5(_0x40910f);});});} \ No newline at end of file +var _0xf1cf=['../../config/environment','jayson/promise','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2eb4f5,_0x27f316){var _0x4e0896=function(_0x18c57d){while(--_0x18c57d){_0x2eb4f5['push'](_0x2eb4f5['shift']());}};_0x4e0896(++_0x27f316);}(_0xf1cf,0x1da));var _0xff1c=function(_0x5b75dd,_0x1bfc13){_0x5b75dd=_0x5b75dd-0x0;var _0x415132=_0xf1cf[_0x5b75dd];return _0x415132;};'use strict';var _=require('lodash');var util=require(_0xff1c('0x0'));var moment=require(_0xff1c('0x1'));var BPromise=require('bluebird');var rs=require(_0xff1c('0x2'));var fs=require('fs');var Redis=require(_0xff1c('0x3'));var db=require(_0xff1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff1c('0x5'))('rpc');var config=require(_0xff1c('0x6'));var jayson=require(_0xff1c('0x7'));var client=jayson[_0xff1c('0x8')][_0xff1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3f3a,_0x33ab5b,_0x22a2b){return new BPromise(function(_0x2f62cd,_0x121ab7){return client[_0xff1c('0xa')](_0x3c3f3a,_0x22a2b)['then'](function(_0x4ad629){logger['info'](_0xff1c('0xb'),_0x33ab5b,_0xff1c('0xc'));logger[_0xff1c('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x33ab5b,_0xff1c('0xc'),JSON[_0xff1c('0xe')](_0x4ad629));if(_0x4ad629[_0xff1c('0xf')]){if(_0x4ad629['error'][_0xff1c('0x10')]===0x1f4){logger[_0xff1c('0xf')](_0xff1c('0xb'),_0x33ab5b,_0x4ad629['error']['message']);return _0x121ab7(_0x4ad629[_0xff1c('0xf')][_0xff1c('0x11')]);}logger[_0xff1c('0xf')](_0xff1c('0xb'),_0x33ab5b,_0x4ad629[_0xff1c('0xf')][_0xff1c('0x11')]);return _0x2f62cd(_0x4ad629[_0xff1c('0xf')][_0xff1c('0x11')]);}else{logger[_0xff1c('0x12')](_0xff1c('0xb'),_0x33ab5b,'request\x20sent');_0x2f62cd(_0x4ad629['result']['message']);}})[_0xff1c('0x13')](function(_0x280c75){logger['error'](_0xff1c('0xb'),_0x33ab5b,_0x280c75);_0x121ab7(_0x280c75);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 0c7160e..41b052d 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 _0xc8a6=['/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put'];(function(_0x7e59be,_0x3c72eb){var _0x4e53dc=function(_0x161477){while(--_0x161477){_0x7e59be['push'](_0x7e59be['shift']());}};_0x4e53dc(++_0x3c72eb);}(_0xc8a6,0x77));var _0x6c8a=function(_0x522e11,_0x5ccedb){_0x522e11=_0x522e11-0x0;var _0x1f3c16=_0xc8a6[_0x522e11];return _0x1f3c16;};'use strict';var multer=require('multer');var util=require(_0x6c8a('0x0'));var path=require(_0x6c8a('0x1'));var timeout=require(_0x6c8a('0x2'));var express=require(_0x6c8a('0x3'));var router=express[_0x6c8a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6c8a('0x5'));var interaction=require(_0x6c8a('0x6'));var config=require('../../config/environment');var controller=require(_0x6c8a('0x7'));router[_0x6c8a('0x8')]('/',auth[_0x6c8a('0x9')](),controller[_0x6c8a('0xa')]);router['get']('/:id',auth[_0x6c8a('0x9')](),controller['show']);router['get'](_0x6c8a('0xb'),auth[_0x6c8a('0x9')](),controller[_0x6c8a('0xc')]);router[_0x6c8a('0x8')](_0x6c8a('0xd'),auth[_0x6c8a('0x9')](),controller[_0x6c8a('0xe')]);router['get'](_0x6c8a('0xf'),auth['isAuthenticated'](),controller[_0x6c8a('0x10')]);router['post']('/',auth[_0x6c8a('0x9')](),controller[_0x6c8a('0x11')]);router[_0x6c8a('0x12')](_0x6c8a('0x13'),auth[_0x6c8a('0x9')](),controller[_0x6c8a('0x14')]);router[_0x6c8a('0x15')](_0x6c8a('0x13'),auth['isAuthenticated'](),controller[_0x6c8a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6034=['/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x19ca7c,_0x34ac47){var _0x137d6d=function(_0x2c833a){while(--_0x2c833a){_0x19ca7c['push'](_0x19ca7c['shift']());}};_0x137d6d(++_0x34ac47);}(_0x6034,0xfe));var _0x4603=function(_0x3f5836,_0x3c9499){_0x3f5836=_0x3f5836-0x0;var _0x416593=_0x6034[_0x3f5836];return _0x416593;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4603('0x0'));var express=require(_0x4603('0x1'));var router=express[_0x4603('0x2')]();var fs_extra=require(_0x4603('0x3'));var auth=require(_0x4603('0x4'));var interaction=require(_0x4603('0x5'));var config=require(_0x4603('0x6'));var controller=require('./analyticCustomReport.controller');router[_0x4603('0x7')]('/',auth[_0x4603('0x8')](),controller[_0x4603('0x9')]);router[_0x4603('0x7')](_0x4603('0xa'),auth[_0x4603('0x8')](),controller[_0x4603('0xb')]);router['get'](_0x4603('0xc'),auth[_0x4603('0x8')](),controller[_0x4603('0xd')]);router[_0x4603('0x7')](_0x4603('0xe'),auth['isAuthenticated'](),controller[_0x4603('0xf')]);router[_0x4603('0x7')]('/:id/query',auth[_0x4603('0x8')](),controller[_0x4603('0x10')]);router[_0x4603('0x11')]('/',auth[_0x4603('0x8')](),controller[_0x4603('0x12')]);router['put'](_0x4603('0xa'),auth[_0x4603('0x8')](),controller[_0x4603('0x13')]);router[_0x4603('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4603('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e5ad64e..005646b 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 _0x207c=['STRING','TEXT','exports'];(function(_0x3ecb1f,_0x523cb2){var _0x503101=function(_0x72abc6){while(--_0x72abc6){_0x3ecb1f['push'](_0x3ecb1f['shift']());}};_0x503101(++_0x523cb2);}(_0x207c,0x1e8));var _0xc207=function(_0x141177,_0x2944fc){_0x141177=_0x141177-0x0;var _0x3014ad=_0x207c[_0x141177];return _0x3014ad;};'use strict';var Sequelize=require('sequelize');module[_0xc207('0x0')]={'name':{'type':Sequelize[_0xc207('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc207('0x1')]},'parent':{'type':Sequelize[_0xc207('0x1')]},'table':{'type':Sequelize[_0xc207('0x1')]},'conditions':{'type':Sequelize[_0xc207('0x2')]},'joins':{'type':Sequelize[_0xc207('0x2')]}}; \ No newline at end of file +var _0xae24=['sequelize','STRING'];(function(_0x15603e,_0x24c470){var _0x48dd6e=function(_0x20f157){while(--_0x20f157){_0x15603e['push'](_0x15603e['shift']());}};_0x48dd6e(++_0x24c470);}(_0xae24,0x182));var _0x4ae2=function(_0x33d19a,_0x5c85d4){_0x33d19a=_0x33d19a-0x0;var _0x559bdb=_0xae24[_0x33d19a];return _0x559bdb;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e340d44..92c1279 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x3390f9,_0x403cee){var _0x4bcf43=function(_0x1337c5){while(--_0x1337c5){_0x3390f9['push'](_0x3390f9['shift']());}};_0x4bcf43(++_0x403cee);}(_0x1967,0x173));var _0x7196=function(_0x5d237f,_0x415b2e){_0x5d237f=_0x5d237f-0x0;var _0x2e9f5a=_0x1967[_0x5d237f];return _0x2e9f5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x35f3cb,_0x114509){var _0x543d85=function(_0x58d61f){while(--_0x58d61f){_0x35f3cb['push'](_0x35f3cb['shift']());}};_0x543d85(++_0x114509);}(_0x187d,0x93));var _0xd187=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x187d[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index c1393b7..50d824c 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 _0xde0e=['analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','AnalyticDefaultReport'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xde0e,0x1bd));var _0xede0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde0e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xede0('0x0'));var util=require(_0xede0('0x1'));var logger=require(_0xede0('0x2'))(_0xede0('0x3'));var moment=require(_0xede0('0x4'));var BPromise=require('bluebird');var rp=require(_0xede0('0x5'));var fs=require('fs');var path=require(_0xede0('0x6'));var rimraf=require(_0xede0('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xede0('0x8')]=function(_0x1a697f,_0x3d677f){return _0x1a697f[_0xede0('0x9')](_0xede0('0xa'),attributes,{'tableName':_0xede0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x125f=['path','rimraf','define','analytics_default_reports','util','../../config/logger','api','moment','bluebird'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x125f,0x1b4));var _0xf125=function(_0x58a0bb,_0x3464b8){_0x58a0bb=_0x58a0bb-0x0;var _0x1f1146=_0x125f[_0x58a0bb];return _0x1f1146;};'use strict';var _=require('lodash');var util=require(_0xf125('0x0'));var logger=require(_0xf125('0x1'))(_0xf125('0x2'));var moment=require(_0xf125('0x3'));var BPromise=require(_0xf125('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf125('0x5'));var rimraf=require(_0xf125('0x6'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x1e1f85,_0x2b9634){return _0x1e1f85[_0xf125('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0xf125('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 5fb31c1..d56f817 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 _0x5dbd=['rpc','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x532a66,_0xb6f9a5){var _0x4c36fb=function(_0x980f9b){while(--_0x980f9b){_0x532a66['push'](_0x532a66['shift']());}};_0x4c36fb(++_0xb6f9a5);}(_0x5dbd,0x174));var _0xd5db=function(_0x479a4c,_0x2ebbd6){_0x479a4c=_0x479a4c-0x0;var _0x4cf0b9=_0x5dbd[_0x479a4c];return _0x4cf0b9;};'use strict';var _=require(_0xd5db('0x0'));var util=require(_0xd5db('0x1'));var moment=require('moment');var BPromise=require(_0xd5db('0x2'));var rs=require(_0xd5db('0x3'));var fs=require('fs');var Redis=require(_0xd5db('0x4'));var db=require(_0xd5db('0x5'))['db'];var utils=require(_0xd5db('0x6'));var logger=require(_0xd5db('0x7'))(_0xd5db('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd5db('0x9')][_0xd5db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40b647,_0x146a03,_0x37835b){return new BPromise(function(_0x58195a,_0x227e53){return client[_0xd5db('0xb')](_0x40b647,_0x37835b)[_0xd5db('0xc')](function(_0x34267c){logger[_0xd5db('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x146a03,'request\x20sent');logger['debug'](_0xd5db('0xe'),_0x146a03,'request\x20sent',JSON[_0xd5db('0xf')](_0x34267c));if(_0x34267c[_0xd5db('0x10')]){if(_0x34267c[_0xd5db('0x10')][_0xd5db('0x11')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x146a03,_0x34267c[_0xd5db('0x10')]['message']);return _0x227e53(_0x34267c[_0xd5db('0x10')][_0xd5db('0x12')]);}logger[_0xd5db('0x10')](_0xd5db('0x13'),_0x146a03,_0x34267c[_0xd5db('0x10')]['message']);return _0x58195a(_0x34267c[_0xd5db('0x10')][_0xd5db('0x12')]);}else{logger[_0xd5db('0xd')](_0xd5db('0x13'),_0x146a03,'request\x20sent');_0x58195a(_0x34267c['result'][_0xd5db('0x12')]);}})['catch'](function(_0x4e9ed3){logger[_0xd5db('0x10')](_0xd5db('0x13'),_0x146a03,_0x4e9ed3);_0x227e53(_0x4e9ed3);});});} \ No newline at end of file +var _0xf9ff=['error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x388060,_0x1559e9){var _0x1d3844=function(_0x29ce39){while(--_0x29ce39){_0x388060['push'](_0x388060['shift']());}};_0x1d3844(++_0x1559e9);}(_0xf9ff,0x1d1));var _0xff9f=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xf9ff[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xff9f('0x0'));var util=require(_0xff9f('0x1'));var moment=require(_0xff9f('0x2'));var BPromise=require(_0xff9f('0x3'));var rs=require(_0xff9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff9f('0x5'))['db'];var utils=require(_0xff9f('0x6'));var logger=require(_0xff9f('0x7'))(_0xff9f('0x8'));var config=require('../../config/environment');var jayson=require(_0xff9f('0x9'));var client=jayson['client'][_0xff9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x589a04,_0x16aed8,_0x2134d8){return new BPromise(function(_0x1951b1,_0x1bfb86){return client[_0xff9f('0xb')](_0x589a04,_0x2134d8)[_0xff9f('0xc')](function(_0x1e370b){logger[_0xff9f('0xd')](_0xff9f('0xe'),_0x16aed8,_0xff9f('0xf'));logger[_0xff9f('0x10')](_0xff9f('0x11'),_0x16aed8,_0xff9f('0xf'),JSON['stringify'](_0x1e370b));if(_0x1e370b[_0xff9f('0x12')]){if(_0x1e370b[_0xff9f('0x12')]['code']===0x1f4){logger[_0xff9f('0x12')](_0xff9f('0xe'),_0x16aed8,_0x1e370b[_0xff9f('0x12')][_0xff9f('0x13')]);return _0x1bfb86(_0x1e370b[_0xff9f('0x12')][_0xff9f('0x13')]);}logger[_0xff9f('0x12')](_0xff9f('0xe'),_0x16aed8,_0x1e370b[_0xff9f('0x12')][_0xff9f('0x13')]);return _0x1951b1(_0x1e370b[_0xff9f('0x12')][_0xff9f('0x13')]);}else{logger[_0xff9f('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x16aed8,'request\x20sent');_0x1951b1(_0x1e370b[_0xff9f('0x14')]['message']);}})['catch'](function(_0x1b62a1){logger[_0xff9f('0x12')](_0xff9f('0xe'),_0x16aed8,_0x1b62a1);_0x1bfb86(_0x1b62a1);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index cdde585..f1752d6 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 _0x3d8c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','create','put','update','exports'];(function(_0x411070,_0x2fcb64){var _0x123d7f=function(_0x3db763){while(--_0x3db763){_0x411070['push'](_0x411070['shift']());}};_0x123d7f(++_0x2fcb64);}(_0x3d8c,0x168));var _0xc3d8=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x3d8c[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require('multer');var util=require(_0xc3d8('0x0'));var path=require('path');var timeout=require(_0xc3d8('0x1'));var express=require(_0xc3d8('0x2'));var router=express[_0xc3d8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc3d8('0x4'));var interaction=require(_0xc3d8('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0xc3d8('0x6')](),controller[_0xc3d8('0x7')]);router[_0xc3d8('0x8')](_0xc3d8('0x9'),auth['isAuthenticated'](),controller[_0xc3d8('0xa')]);router[_0xc3d8('0x8')](_0xc3d8('0xb'),auth[_0xc3d8('0x6')](),controller[_0xc3d8('0xc')]);router['get'](_0xc3d8('0xd'),auth['isAuthenticated'](),controller[_0xc3d8('0xe')]);router[_0xc3d8('0x8')](_0xc3d8('0xf'),auth[_0xc3d8('0x6')](),controller['query']);router['post']('/',auth[_0xc3d8('0x6')](),controller[_0xc3d8('0x10')]);router[_0xc3d8('0x11')](_0xc3d8('0x9'),auth['isAuthenticated'](),controller[_0xc3d8('0x12')]);router['delete'](_0xc3d8('0x9'),auth[_0xc3d8('0x6')](),controller['destroy']);module[_0xc3d8('0x13')]=router; \ No newline at end of file +var _0xf14a=['show','/:id/preview','preview','/:id/query','query','post','put','update','destroy','exports','multer','path','express','Router','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0xf14a,0xaa));var _0xaf14=function(_0x328c61,_0x5a0aee){_0x328c61=_0x328c61-0x0;var _0x31fb39=_0xf14a[_0x328c61];return _0x31fb39;};'use strict';var multer=require(_0xaf14('0x0'));var util=require('util');var path=require(_0xaf14('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf14('0x2'));var router=express[_0xaf14('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf14('0x4'));var controller=require(_0xaf14('0x5'));router[_0xaf14('0x6')]('/',auth[_0xaf14('0x7')](),controller[_0xaf14('0x8')]);router[_0xaf14('0x6')](_0xaf14('0x9'),auth[_0xaf14('0x7')](),controller[_0xaf14('0xa')]);router[_0xaf14('0x6')](_0xaf14('0xb'),auth[_0xaf14('0x7')](),controller[_0xaf14('0xc')]);router['get']('/:id/run',auth[_0xaf14('0x7')](),controller['run']);router[_0xaf14('0x6')](_0xaf14('0xd'),auth[_0xaf14('0x7')](),controller[_0xaf14('0xe')]);router[_0xaf14('0xf')]('/',auth[_0xaf14('0x7')](),controller['create']);router[_0xaf14('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaf14('0x11')]);router['delete'](_0xaf14('0x9'),auth[_0xaf14('0x7')](),controller[_0xaf14('0x12')]);module[_0xaf14('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index eb2079f..113bd8d 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 _0x02ec=['INTEGER','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0xeb9b79,_0x57851a){var _0x4cdaa6=function(_0x2863fa){while(--_0x2863fa){_0xeb9b79['push'](_0xeb9b79['shift']());}};_0x4cdaa6(++_0x57851a);}(_0x02ec,0xcd));var _0xc02e=function(_0x8ad04b,_0x1b3eff){_0x8ad04b=_0x8ad04b-0x0;var _0x33dd8a=_0x02ec[_0x8ad04b];return _0x33dd8a;};'use strict';var Sequelize=require(_0xc02e('0x0'));var moment=require(_0xc02e('0x1'));module[_0xc02e('0x2')]={'name':{'type':Sequelize[_0xc02e('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xc02e('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xc02e('0x4')](_0xc02e('0x5'),_0xc02e('0x6'),_0xc02e('0x7')),'allowNull':![],'defaultValue':_0xc02e('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xc02e('0x8')]},'endDate':{'type':Sequelize[_0xc02e('0x8')]},'status':{'type':Sequelize[_0xc02e('0x3')],'defaultValue':_0xc02e('0x9')},'type':{'type':Sequelize['ENUM'](_0xc02e('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0xc02e('0xa')},'reportId':{'type':Sequelize[_0xc02e('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x30f1=['moment','exports','STRING','ENUM','xlsx','csv','DATE','Loading','manual','scheduled','UNSIGNED','sequelize'];(function(_0x2e7f98,_0x5f2dab){var _0x3fdb9d=function(_0x5c1a06){while(--_0x5c1a06){_0x2e7f98['push'](_0x2e7f98['shift']());}};_0x3fdb9d(++_0x5f2dab);}(_0x30f1,0x143));var _0x130f=function(_0x4e1828,_0x24b8cc){_0x4e1828=_0x4e1828-0x0;var _0x354147=_0x30f1[_0x4e1828];return _0x354147;};'use strict';var Sequelize=require(_0x130f('0x0'));var moment=require(_0x130f('0x1'));module[_0x130f('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x130f('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x130f('0x4')]('csv','pdf',_0x130f('0x5')),'allowNull':![],'defaultValue':_0x130f('0x6')},'savename':{'type':Sequelize[_0x130f('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x130f('0x7')]},'status':{'type':Sequelize[_0x130f('0x3')],'defaultValue':_0x130f('0x8')},'type':{'type':Sequelize['ENUM'](_0x130f('0x9'),_0x130f('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x130f('0xb')]},'reportType':{'type':Sequelize[_0x130f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index ca25153..df0fa3b 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 _0x9c65=['filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','catch','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','exists','format','%s.%s','toLowerCase','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','keys','query'];(function(_0x475da1,_0x30ceef){var _0x5c8772=function(_0x58e3cd){while(--_0x58e3cd){_0x475da1['push'](_0x475da1['shift']());}};_0x5c8772(++_0x30ceef);}(_0x9c65,0x1a0));var _0x59c6=function(_0x3bfbf7,_0x5ec8e8){_0x3bfbf7=_0x3bfbf7-0x0;var _0x1a673a=_0x9c65[_0x3bfbf7];return _0x1a673a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59c6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59c6('0x1'));var rp=require(_0x59c6('0x2'));var moment=require(_0x59c6('0x3'));var BPromise=require(_0x59c6('0x4'));var Mustache=require(_0x59c6('0x5'));var util=require(_0x59c6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x59c6('0x7'));var ejs=require(_0x59c6('0x8'));var fs=require('fs');var fs_extra=require(_0x59c6('0x9'));var _=require(_0x59c6('0xa'));var squel=require('squel');var crypto=require(_0x59c6('0xb'));var jsforce=require(_0x59c6('0xc'));var deskjs=require(_0x59c6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x59c6('0xe'));var Redis=require(_0x59c6('0xf'));var authService=require(_0x59c6('0x10'));var qs=require(_0x59c6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59c6('0x12'));var logger=require(_0x59c6('0x13'))(_0x59c6('0x14'));var utils=require('../../config/utils');var config=require(_0x59c6('0x15'));var licenseUtil=require(_0x59c6('0x16'));var db=require(_0x59c6('0x17'))['db'];function respondWithStatusCode(_0x28507f,_0x7e6766){_0x7e6766=_0x7e6766||0xcc;return function(_0x31d438){if(_0x31d438){return _0x28507f[_0x59c6('0x18')](_0x7e6766);}return _0x28507f[_0x59c6('0x19')](_0x7e6766)[_0x59c6('0x1a')]();};}function respondWithResult(_0x47965b,_0x24fdc5){_0x24fdc5=_0x24fdc5||0xc8;return function(_0x46b3cf){if(_0x46b3cf){return _0x47965b[_0x59c6('0x19')](_0x24fdc5)['json'](_0x46b3cf);}};}function respondWithFilteredResult(_0x3d90f6,_0x5a5599){return function(_0x9683aa){if(_0x9683aa){var _0x15b329=typeof _0x5a5599[_0x59c6('0x1b')]===_0x59c6('0x1c')&&typeof _0x5a5599['limit']===_0x59c6('0x1c');var _0x3894ce=_0x9683aa['count'];var _0xed3796=_0x15b329?0x0:_0x5a5599[_0x59c6('0x1b')];var _0x4016a6=_0x15b329?_0x9683aa[_0x59c6('0x1d')]:_0x5a5599[_0x59c6('0x1b')]+_0x5a5599[_0x59c6('0x1e')];var _0x1eafa0;if(_0x4016a6>=_0x3894ce){_0x4016a6=_0x3894ce;_0x1eafa0=0xc8;}else{_0x1eafa0=0xce;}_0x3d90f6[_0x59c6('0x19')](_0x1eafa0);return _0x3d90f6[_0x59c6('0x1f')](_0x59c6('0x20'),_0xed3796+'-'+_0x4016a6+'/'+_0x3894ce)['json'](_0x9683aa);}return null;};}function patchUpdates(_0x5ab5d3){return function(_0x1c954b){try{jsonpatch[_0x59c6('0x21')](_0x1c954b,_0x5ab5d3,!![]);}catch(_0x29cac5){return BPromise[_0x59c6('0x22')](_0x29cac5);}return _0x1c954b[_0x59c6('0x23')]();};}function saveUpdates(_0x5537a0,_0x3c5feb){return function(_0x133a6d){if(_0x133a6d){return _0x133a6d[_0x59c6('0x24')](_0x5537a0)['then'](function(_0x33fe81){return _0x33fe81;});}return null;};}function removeEntity(_0x49bc43,_0x3ca90f){return function(_0x37738f){if(_0x37738f){return _0x37738f[_0x59c6('0x25')]()[_0x59c6('0x26')](function(){var _0x5c7e80=_0x37738f[_0x59c6('0x27')]({'plain':!![]});var _0x3bb551=_0x59c6('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3bb551,'resourceId':_0x5c7e80['id']}})[_0x59c6('0x26')](function(){return _0x37738f;});})[_0x59c6('0x26')](function(){_0x49bc43[_0x59c6('0x19')](0xcc)[_0x59c6('0x1a')]();});}};}function handleEntityNotFound(_0x5d76a2,_0x277e35){return function(_0x496db5){if(!_0x496db5){_0x5d76a2['sendStatus'](0x194);}return _0x496db5;};}function handleError(_0x1a662f,_0x3533d2){_0x3533d2=_0x3533d2||0x1f4;return function(_0x2a1138){logger[_0x59c6('0x29')](_0x2a1138[_0x59c6('0x2a')]);if(_0x2a1138['name']){delete _0x2a1138[_0x59c6('0x2b')];}_0x1a662f[_0x59c6('0x19')](_0x3533d2)[_0x59c6('0x2c')](_0x2a1138);};}exports[_0x59c6('0x2d')]=function(_0x217624,_0x59a483){var _0x57ea15={},_0x4f2c0={},_0x4dfea7={'count':0x0,'rows':[]};var _0x385ce4=_[_0x59c6('0x2e')](db[_0x59c6('0x2f')][_0x59c6('0x30')],function(_0x58ce1d){return{'name':_0x58ce1d[_0x59c6('0x31')],'type':_0x58ce1d['type'][_0x59c6('0x32')]};});_0x4f2c0[_0x59c6('0x33')]=_[_0x59c6('0x2e')](_0x385ce4,_0x59c6('0x2b'));_0x4f2c0['query']=_[_0x59c6('0x34')](_0x217624[_0x59c6('0x35')]);_0x4f2c0[_0x59c6('0x36')]=_[_0x59c6('0x37')](_0x4f2c0[_0x59c6('0x33')],_0x4f2c0[_0x59c6('0x35')]);_0x57ea15[_0x59c6('0x38')]=_['intersection'](_0x4f2c0[_0x59c6('0x33')],qs[_0x59c6('0x39')](_0x217624['query'][_0x59c6('0x39')]));_0x57ea15[_0x59c6('0x38')]=_0x57ea15['attributes']['length']?_0x57ea15[_0x59c6('0x38')]:_0x4f2c0[_0x59c6('0x33')];if(!_0x217624[_0x59c6('0x35')][_0x59c6('0x3a')]('nolimit')){_0x57ea15[_0x59c6('0x1e')]=qs['limit'](_0x217624[_0x59c6('0x35')]['limit']);_0x57ea15[_0x59c6('0x1b')]=qs['offset'](_0x217624['query'][_0x59c6('0x1b')]);}_0x57ea15['order']=qs['sort'](_0x217624[_0x59c6('0x35')][_0x59c6('0x3b')]);_0x57ea15[_0x59c6('0x3c')]=qs['filters'](_[_0x59c6('0x3d')](_0x217624[_0x59c6('0x35')],_0x4f2c0[_0x59c6('0x36')]),_0x385ce4);if(_0x217624[_0x59c6('0x35')][_0x59c6('0x3e')]){_0x57ea15[_0x59c6('0x3c')]=_[_0x59c6('0x3f')](_0x57ea15['where'],{'$or':_[_0x59c6('0x2e')](_0x385ce4,function(_0x17d981){if(_0x17d981[_0x59c6('0x40')]!==_0x59c6('0x41')){var _0x16376e={};_0x16376e[_0x17d981[_0x59c6('0x2b')]]={'$like':'%'+_0x217624[_0x59c6('0x35')][_0x59c6('0x3e')]+'%'};return _0x16376e;}})});}_0x57ea15=_['merge']({},_0x57ea15,_0x217624[_0x59c6('0x42')]);var _0x50c7fe={'where':_0x57ea15['where']};return db[_0x59c6('0x2f')][_0x59c6('0x1d')](_0x50c7fe)[_0x59c6('0x26')](function(_0x510cdc){_0x4dfea7[_0x59c6('0x1d')]=_0x510cdc;if(_0x217624[_0x59c6('0x35')][_0x59c6('0x43')]){_0x57ea15[_0x59c6('0x44')]=[{'all':!![]}];}return db[_0x59c6('0x2f')][_0x59c6('0x45')](_0x57ea15);})[_0x59c6('0x26')](function(_0x4a2211){_0x4dfea7[_0x59c6('0x46')]=_0x4a2211;return _0x4dfea7;})[_0x59c6('0x26')](respondWithFilteredResult(_0x59a483,_0x57ea15))['catch'](handleError(_0x59a483,null));};exports[_0x59c6('0x47')]=function(_0x2fb169,_0x39ddab){var _0x70ddf9={'raw':!![],'where':{'id':_0x2fb169[_0x59c6('0x48')]['id']}},_0x364bb6={};_0x364bb6[_0x59c6('0x33')]=_['keys'](db[_0x59c6('0x2f')][_0x59c6('0x30')]);_0x364bb6['query']=_[_0x59c6('0x34')](_0x2fb169['query']);_0x364bb6[_0x59c6('0x36')]=_['intersection'](_0x364bb6[_0x59c6('0x33')],_0x364bb6[_0x59c6('0x35')]);_0x70ddf9[_0x59c6('0x38')]=_['intersection'](_0x364bb6[_0x59c6('0x33')],qs[_0x59c6('0x39')](_0x2fb169[_0x59c6('0x35')][_0x59c6('0x39')]));_0x70ddf9[_0x59c6('0x38')]=_0x70ddf9['attributes'][_0x59c6('0x49')]?_0x70ddf9[_0x59c6('0x38')]:_0x364bb6[_0x59c6('0x33')];if(_0x2fb169['query'][_0x59c6('0x43')]){_0x70ddf9['include']=[{'all':!![]}];}_0x70ddf9=_[_0x59c6('0x3f')]({},_0x70ddf9,_0x2fb169[_0x59c6('0x42')]);return db[_0x59c6('0x2f')][_0x59c6('0x4a')](_0x70ddf9)[_0x59c6('0x26')](handleEntityNotFound(_0x39ddab,null))[_0x59c6('0x26')](respondWithResult(_0x39ddab,null))['catch'](handleError(_0x39ddab,null));};exports[_0x59c6('0x4b')]=function(_0x1684e5,_0x5ad6d9){return db['AnalyticExtractedReport'][_0x59c6('0x4b')](_0x1684e5[_0x59c6('0x4c')],{})[_0x59c6('0x26')](function(_0x33c7e2){var _0x59b7df=_0x1684e5[_0x59c6('0x4d')][_0x59c6('0x27')]({'plain':!![]});if(!_0x59b7df)throw new Error(_0x59c6('0x4e'));if(_0x59b7df[_0x59c6('0x4f')]===_0x59c6('0x4d')){var _0x3a5244=_0x33c7e2[_0x59c6('0x27')]({'plain':!![]});var _0x4974ae='ExtractedReports';return db['UserProfileSection']['find']({'where':{'name':_0x4974ae,'userProfileId':_0x59b7df[_0x59c6('0x50')]},'raw':!![]})[_0x59c6('0x26')](function(_0x3b80eb){if(_0x3b80eb&&_0x3b80eb['autoAssociation']===0x0){return db['UserProfileResource'][_0x59c6('0x4b')]({'name':_0x3a5244['name'],'resourceId':_0x3a5244['id'],'type':_0x3b80eb[_0x59c6('0x2b')],'sectionId':_0x3b80eb['id']},{})[_0x59c6('0x26')](function(){return _0x33c7e2;});}else{return _0x33c7e2;}})[_0x59c6('0x51')](function(_0x1f80f1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f80f1);throw _0x1f80f1;});}return _0x33c7e2;})[_0x59c6('0x26')](respondWithResult(_0x5ad6d9,0xc9))['catch'](handleError(_0x5ad6d9,null));};exports[_0x59c6('0x24')]=function(_0x3da2c2,_0x36b2f5){if(_0x3da2c2[_0x59c6('0x4c')]['id']){delete _0x3da2c2['body']['id'];}return db['AnalyticExtractedReport'][_0x59c6('0x4a')]({'where':{'id':_0x3da2c2['params']['id']}})[_0x59c6('0x26')](handleEntityNotFound(_0x36b2f5,null))[_0x59c6('0x26')](saveUpdates(_0x3da2c2[_0x59c6('0x4c')],null))[_0x59c6('0x26')](respondWithResult(_0x36b2f5,null))[_0x59c6('0x51')](handleError(_0x36b2f5,null));};exports[_0x59c6('0x25')]=function(_0x5597f3,_0x336cb9){return db['AnalyticExtractedReport'][_0x59c6('0x4a')]({'where':{'id':_0x5597f3[_0x59c6('0x48')]['id']}})[_0x59c6('0x26')](handleEntityNotFound(_0x336cb9,null))[_0x59c6('0x26')](removeEntity(_0x336cb9,null))[_0x59c6('0x51')](handleError(_0x336cb9,null));};exports['download']=function(_0x41e2a6,_0x22b51f,_0xc9b47e){return db[_0x59c6('0x2f')][_0x59c6('0x4a')]({'where':{'id':_0x41e2a6[_0x59c6('0x48')]['id']},'attributes':[_0x59c6('0x2b'),_0x59c6('0x52'),_0x59c6('0x53'),_0x59c6('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x22b51f,null))[_0x59c6('0x26')](function(_0x5513e8){if(_0x5513e8){if(!fs[_0x59c6('0x55')](path[_0x59c6('0x56')](config[_0x59c6('0x57')],_0x59c6('0x58'),_0x5513e8['savename']))){throw new db['Sequelize'][(_0x59c6('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x41e2a6['query'][_0x59c6('0x5a')]){return _0x22b51f['sendStatus'](0xc8);}return _0x22b51f['download'](path[_0x59c6('0x56')](config['root'],_0x59c6('0x58'),_0x5513e8[_0x59c6('0x53')]),util[_0x59c6('0x5b')](_0x59c6('0x5c'),_0x5513e8[_0x59c6('0x52')]||_0x5513e8[_0x59c6('0x2b')],_0x5513e8[_0x59c6('0x54')][_0x59c6('0x5d')]()));}})[_0x59c6('0x51')](handleError(_0x22b51f,null));}; \ No newline at end of file +var _0x4b82=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','save','update','destroy','ExtractedReports','then','error','name','send','index','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1672f0,_0x149a55){var _0x75019e=function(_0x286a59){while(--_0x286a59){_0x1672f0['push'](_0x1672f0['shift']());}};_0x75019e(++_0x149a55);}(_0x4b82,0x180));var _0x24b8=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0x4b82[_0x32056c];return _0x317313;};'use strict';var emlformat=require(_0x24b8('0x0'));var rimraf=require(_0x24b8('0x1'));var zipdir=require(_0x24b8('0x2'));var jsonpatch=require(_0x24b8('0x3'));var rp=require('request-promise');var moment=require(_0x24b8('0x4'));var BPromise=require(_0x24b8('0x5'));var Mustache=require(_0x24b8('0x6'));var util=require(_0x24b8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x24b8('0x8'));var ejs=require(_0x24b8('0x9'));var fs=require('fs');var fs_extra=require(_0x24b8('0xa'));var _=require('lodash');var squel=require(_0x24b8('0xb'));var crypto=require(_0x24b8('0xc'));var jsforce=require(_0x24b8('0xd'));var deskjs=require(_0x24b8('0xe'));var toCsv=require(_0x24b8('0x8'));var querystring=require(_0x24b8('0xf'));var Papa=require(_0x24b8('0x10'));var Redis=require(_0x24b8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x24b8('0x12'));var as=require(_0x24b8('0x13'));var hardwareService=require(_0x24b8('0x14'));var logger=require(_0x24b8('0x15'))(_0x24b8('0x16'));var utils=require(_0x24b8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x24b8('0x18'));var db=require(_0x24b8('0x19'))['db'];function respondWithStatusCode(_0x282143,_0x287ff6){_0x287ff6=_0x287ff6||0xcc;return function(_0x1d4113){if(_0x1d4113){return _0x282143[_0x24b8('0x1a')](_0x287ff6);}return _0x282143[_0x24b8('0x1b')](_0x287ff6)[_0x24b8('0x1c')]();};}function respondWithResult(_0x56e26e,_0x287fdf){_0x287fdf=_0x287fdf||0xc8;return function(_0x32a16e){if(_0x32a16e){return _0x56e26e[_0x24b8('0x1b')](_0x287fdf)['json'](_0x32a16e);}};}function respondWithFilteredResult(_0x21b92d,_0x227c17){return function(_0x43311c){if(_0x43311c){var _0xd1d646=typeof _0x227c17['offset']===_0x24b8('0x1d')&&typeof _0x227c17[_0x24b8('0x1e')]==='undefined';var _0x2d6c8e=_0x43311c['count'];var _0x3ae605=_0xd1d646?0x0:_0x227c17[_0x24b8('0x1f')];var _0x577f3d=_0xd1d646?_0x43311c[_0x24b8('0x20')]:_0x227c17[_0x24b8('0x1f')]+_0x227c17[_0x24b8('0x1e')];var _0x292a0c;if(_0x577f3d>=_0x2d6c8e){_0x577f3d=_0x2d6c8e;_0x292a0c=0xc8;}else{_0x292a0c=0xce;}_0x21b92d[_0x24b8('0x1b')](_0x292a0c);return _0x21b92d['set'](_0x24b8('0x21'),_0x3ae605+'-'+_0x577f3d+'/'+_0x2d6c8e)[_0x24b8('0x22')](_0x43311c);}return null;};}function patchUpdates(_0x552ad7){return function(_0x47f3da){try{jsonpatch[_0x24b8('0x23')](_0x47f3da,_0x552ad7,!![]);}catch(_0x329685){return BPromise['reject'](_0x329685);}return _0x47f3da[_0x24b8('0x24')]();};}function saveUpdates(_0x2b4fdb,_0xb09421){return function(_0x286c2b){if(_0x286c2b){return _0x286c2b[_0x24b8('0x25')](_0x2b4fdb)['then'](function(_0x36262a){return _0x36262a;});}return null;};}function removeEntity(_0x2b9fc8,_0x449bdd){return function(_0x280c4e){if(_0x280c4e){return _0x280c4e[_0x24b8('0x26')]()['then'](function(){var _0x51b205=_0x280c4e['get']({'plain':!![]});var _0xe26b7e=_0x24b8('0x27');return db['UserProfileResource'][_0x24b8('0x26')]({'where':{'type':_0xe26b7e,'resourceId':_0x51b205['id']}})[_0x24b8('0x28')](function(){return _0x280c4e;});})[_0x24b8('0x28')](function(){_0x2b9fc8[_0x24b8('0x1b')](0xcc)[_0x24b8('0x1c')]();});}};}function handleEntityNotFound(_0x1eed6b,_0x565950){return function(_0x16fc68){if(!_0x16fc68){_0x1eed6b['sendStatus'](0x194);}return _0x16fc68;};}function handleError(_0x3f2b66,_0x2594ec){_0x2594ec=_0x2594ec||0x1f4;return function(_0x2b3164){logger[_0x24b8('0x29')](_0x2b3164['stack']);if(_0x2b3164[_0x24b8('0x2a')]){delete _0x2b3164['name'];}_0x3f2b66[_0x24b8('0x1b')](_0x2594ec)[_0x24b8('0x2b')](_0x2b3164);};}exports[_0x24b8('0x2c')]=function(_0x187bc0,_0xbe59fe){var _0x12d592={},_0x28ab31={},_0x27fb88={'count':0x0,'rows':[]};var _0x4bbc71=_['map'](db['AnalyticExtractedReport'][_0x24b8('0x2d')],function(_0x32ad9f){return{'name':_0x32ad9f['fieldName'],'type':_0x32ad9f[_0x24b8('0x2e')][_0x24b8('0x2f')]};});_0x28ab31['model']=_['map'](_0x4bbc71,_0x24b8('0x2a'));_0x28ab31[_0x24b8('0x30')]=_[_0x24b8('0x31')](_0x187bc0['query']);_0x28ab31[_0x24b8('0x32')]=_[_0x24b8('0x33')](_0x28ab31['model'],_0x28ab31[_0x24b8('0x30')]);_0x12d592[_0x24b8('0x34')]=_[_0x24b8('0x33')](_0x28ab31['model'],qs[_0x24b8('0x35')](_0x187bc0[_0x24b8('0x30')][_0x24b8('0x35')]));_0x12d592[_0x24b8('0x34')]=_0x12d592[_0x24b8('0x34')]['length']?_0x12d592['attributes']:_0x28ab31[_0x24b8('0x36')];if(!_0x187bc0[_0x24b8('0x30')][_0x24b8('0x37')](_0x24b8('0x38'))){_0x12d592[_0x24b8('0x1e')]=qs[_0x24b8('0x1e')](_0x187bc0[_0x24b8('0x30')][_0x24b8('0x1e')]);_0x12d592[_0x24b8('0x1f')]=qs[_0x24b8('0x1f')](_0x187bc0[_0x24b8('0x30')]['offset']);}_0x12d592[_0x24b8('0x39')]=qs['sort'](_0x187bc0[_0x24b8('0x30')][_0x24b8('0x3a')]);_0x12d592[_0x24b8('0x3b')]=qs['filters'](_[_0x24b8('0x3c')](_0x187bc0[_0x24b8('0x30')],_0x28ab31[_0x24b8('0x32')]),_0x4bbc71);if(_0x187bc0[_0x24b8('0x30')][_0x24b8('0x3d')]){_0x12d592[_0x24b8('0x3b')]=_[_0x24b8('0x3e')](_0x12d592[_0x24b8('0x3b')],{'$or':_[_0x24b8('0x3f')](_0x4bbc71,function(_0x1bc58a){if(_0x1bc58a[_0x24b8('0x2e')]!==_0x24b8('0x40')){var _0x581235={};_0x581235[_0x1bc58a[_0x24b8('0x2a')]]={'$like':'%'+_0x187bc0[_0x24b8('0x30')][_0x24b8('0x3d')]+'%'};return _0x581235;}})});}_0x12d592=_[_0x24b8('0x3e')]({},_0x12d592,_0x187bc0[_0x24b8('0x41')]);var _0x1d8c2a={'where':_0x12d592[_0x24b8('0x3b')]};return db[_0x24b8('0x42')][_0x24b8('0x20')](_0x1d8c2a)[_0x24b8('0x28')](function(_0x1af8b9){_0x27fb88[_0x24b8('0x20')]=_0x1af8b9;if(_0x187bc0[_0x24b8('0x30')][_0x24b8('0x43')]){_0x12d592[_0x24b8('0x44')]=[{'all':!![]}];}return db[_0x24b8('0x42')][_0x24b8('0x45')](_0x12d592);})['then'](function(_0xdade95){_0x27fb88[_0x24b8('0x46')]=_0xdade95;return _0x27fb88;})[_0x24b8('0x28')](respondWithFilteredResult(_0xbe59fe,_0x12d592))[_0x24b8('0x47')](handleError(_0xbe59fe,null));};exports[_0x24b8('0x48')]=function(_0x4557d9,_0x11aca3){var _0x52226c={'raw':!![],'where':{'id':_0x4557d9[_0x24b8('0x49')]['id']}},_0x28015e={};_0x28015e['model']=_[_0x24b8('0x31')](db[_0x24b8('0x42')]['rawAttributes']);_0x28015e[_0x24b8('0x30')]=_[_0x24b8('0x31')](_0x4557d9[_0x24b8('0x30')]);_0x28015e['filters']=_['intersection'](_0x28015e[_0x24b8('0x36')],_0x28015e[_0x24b8('0x30')]);_0x52226c[_0x24b8('0x34')]=_[_0x24b8('0x33')](_0x28015e[_0x24b8('0x36')],qs[_0x24b8('0x35')](_0x4557d9[_0x24b8('0x30')]['fields']));_0x52226c[_0x24b8('0x34')]=_0x52226c[_0x24b8('0x34')][_0x24b8('0x4a')]?_0x52226c[_0x24b8('0x34')]:_0x28015e['model'];if(_0x4557d9[_0x24b8('0x30')][_0x24b8('0x43')]){_0x52226c[_0x24b8('0x44')]=[{'all':!![]}];}_0x52226c=_[_0x24b8('0x3e')]({},_0x52226c,_0x4557d9['options']);return db[_0x24b8('0x42')][_0x24b8('0x4b')](_0x52226c)[_0x24b8('0x28')](handleEntityNotFound(_0x11aca3,null))[_0x24b8('0x28')](respondWithResult(_0x11aca3,null))[_0x24b8('0x47')](handleError(_0x11aca3,null));};exports['create']=function(_0x58d909,_0x8f163){return db[_0x24b8('0x42')][_0x24b8('0x4c')](_0x58d909[_0x24b8('0x4d')],{})[_0x24b8('0x28')](function(_0x537ef8){var _0x2635ad=_0x58d909[_0x24b8('0x4e')][_0x24b8('0x4f')]({'plain':!![]});if(!_0x2635ad)throw new Error(_0x24b8('0x50'));if(_0x2635ad['role']==='user'){var _0xf967f7=_0x537ef8[_0x24b8('0x4f')]({'plain':!![]});var _0x551c3d='ExtractedReports';return db[_0x24b8('0x51')][_0x24b8('0x4b')]({'where':{'name':_0x551c3d,'userProfileId':_0x2635ad[_0x24b8('0x52')]},'raw':!![]})[_0x24b8('0x28')](function(_0x14b9fc){if(_0x14b9fc&&_0x14b9fc[_0x24b8('0x53')]===0x0){return db[_0x24b8('0x54')][_0x24b8('0x4c')]({'name':_0xf967f7[_0x24b8('0x2a')],'resourceId':_0xf967f7['id'],'type':_0x14b9fc[_0x24b8('0x2a')],'sectionId':_0x14b9fc['id']},{})['then'](function(){return _0x537ef8;});}else{return _0x537ef8;}})[_0x24b8('0x47')](function(_0x41a24a){logger[_0x24b8('0x29')](_0x24b8('0x55'),_0x41a24a);throw _0x41a24a;});}return _0x537ef8;})['then'](respondWithResult(_0x8f163,0xc9))[_0x24b8('0x47')](handleError(_0x8f163,null));};exports[_0x24b8('0x25')]=function(_0x2bb725,_0x26d00d){if(_0x2bb725[_0x24b8('0x4d')]['id']){delete _0x2bb725[_0x24b8('0x4d')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x2bb725[_0x24b8('0x49')]['id']}})[_0x24b8('0x28')](handleEntityNotFound(_0x26d00d,null))[_0x24b8('0x28')](saveUpdates(_0x2bb725[_0x24b8('0x4d')],null))['then'](respondWithResult(_0x26d00d,null))[_0x24b8('0x47')](handleError(_0x26d00d,null));};exports[_0x24b8('0x26')]=function(_0x292dea,_0xc365c7){return db['AnalyticExtractedReport'][_0x24b8('0x4b')]({'where':{'id':_0x292dea[_0x24b8('0x49')]['id']}})['then'](handleEntityNotFound(_0xc365c7,null))[_0x24b8('0x28')](removeEntity(_0xc365c7,null))[_0x24b8('0x47')](handleError(_0xc365c7,null));};exports[_0x24b8('0x56')]=function(_0x4604d5,_0x96be99,_0x1e1a60){return db[_0x24b8('0x42')][_0x24b8('0x4b')]({'where':{'id':_0x4604d5[_0x24b8('0x49')]['id']},'attributes':['name',_0x24b8('0x57'),_0x24b8('0x58'),_0x24b8('0x59')],'raw':!![]})[_0x24b8('0x28')](handleEntityNotFound(_0x96be99,null))[_0x24b8('0x28')](function(_0x31e76b){if(_0x31e76b){if(!fs[_0x24b8('0x5a')](path[_0x24b8('0x5b')](config['root'],_0x24b8('0x5c'),_0x31e76b[_0x24b8('0x58')]))){throw new db[(_0x24b8('0x5d'))][(_0x24b8('0x5e'))](_0x24b8('0x5f'));}if(_0x4604d5[_0x24b8('0x30')]['exists']){return _0x96be99[_0x24b8('0x1a')](0xc8);}return _0x96be99[_0x24b8('0x56')](path[_0x24b8('0x5b')](config[_0x24b8('0x60')],'server/files/reports',_0x31e76b['savename']),util[_0x24b8('0x61')](_0x24b8('0x62'),_0x31e76b[_0x24b8('0x57')]||_0x31e76b['name'],_0x31e76b[_0x24b8('0x59')][_0x24b8('0x63')]()));}})[_0x24b8('0x47')](handleError(_0x96be99,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ef35d23..daf98bb 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 _0xb9c9=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x2640a0,_0xec872e){var _0x3b1aa3=function(_0x1e7ac8){while(--_0x1e7ac8){_0x2640a0['push'](_0x2640a0['shift']());}};_0x3b1aa3(++_0xec872e);}(_0xb9c9,0x17c));var _0x9b9c=function(_0xf6125c,_0x55beed){_0xf6125c=_0xf6125c-0x0;var _0x1121c2=_0xb9c9[_0xf6125c];return _0x1121c2;};'use strict';var _=require(_0x9b9c('0x0'));var util=require(_0x9b9c('0x1'));var logger=require(_0x9b9c('0x2'))(_0x9b9c('0x3'));var moment=require('moment');var BPromise=require(_0x9b9c('0x4'));var rp=require(_0x9b9c('0x5'));var fs=require('fs');var path=require(_0x9b9c('0x6'));var rimraf=require(_0x9b9c('0x7'));var config=require('../../config/environment');var attributes=require(_0x9b9c('0x8'));module[_0x9b9c('0x9')]=function(_0x7156cb,_0x4a24a7){return _0x7156cb[_0x9b9c('0xa')](_0x9b9c('0xb'),attributes,{'tableName':_0x9b9c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6d6=['rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment'];(function(_0x2d0978,_0xb28490){var _0x50f154=function(_0x228f83){while(--_0x228f83){_0x2d0978['push'](_0x2d0978['shift']());}};_0x50f154(++_0xb28490);}(_0xe6d6,0x1aa));var _0x6e6d=function(_0x30977b,_0x22be64){_0x30977b=_0x30977b-0x0;var _0x339a92=_0xe6d6[_0x30977b];return _0x339a92;};'use strict';var _=require('lodash');var util=require(_0x6e6d('0x0'));var logger=require(_0x6e6d('0x1'))(_0x6e6d('0x2'));var moment=require(_0x6e6d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6e6d('0x4'));var config=require(_0x6e6d('0x5'));var attributes=require(_0x6e6d('0x6'));module['exports']=function(_0x18a325,_0x3af7ba){return _0x18a325[_0x6e6d('0x7')](_0x6e6d('0x8'),attributes,{'tableName':_0x6e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 387457b..50bc387 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 _0x47b4=['message','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x496c0c,_0x1497aa){var _0x2f673b=function(_0xda6995){while(--_0xda6995){_0x496c0c['push'](_0x496c0c['shift']());}};_0x2f673b(++_0x1497aa);}(_0x47b4,0x144));var _0x447b=function(_0x1dd99b,_0x2a91e3){_0x1dd99b=_0x1dd99b-0x0;var _0x5af57c=_0x47b4[_0x1dd99b];return _0x5af57c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x447b('0x0'));var rs=require(_0x447b('0x1'));var fs=require('fs');var Redis=require(_0x447b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x447b('0x3'));var config=require(_0x447b('0x4'));var jayson=require(_0x447b('0x5'));var client=jayson[_0x447b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a62cc,_0x182a5a,_0x42bd56){return new BPromise(function(_0xfb9073,_0x201e43){return client[_0x447b('0x7')](_0x5a62cc,_0x42bd56)[_0x447b('0x8')](function(_0x5187e7){logger[_0x447b('0x9')](_0x447b('0xa'),_0x182a5a,'request\x20sent');logger[_0x447b('0xb')](_0x447b('0xc'),_0x182a5a,_0x447b('0xd'),JSON['stringify'](_0x5187e7));if(_0x5187e7[_0x447b('0xe')]){if(_0x5187e7['error'][_0x447b('0xf')]===0x1f4){logger['error'](_0x447b('0xa'),_0x182a5a,_0x5187e7[_0x447b('0xe')]['message']);return _0x201e43(_0x5187e7[_0x447b('0xe')][_0x447b('0x10')]);}logger[_0x447b('0xe')](_0x447b('0xa'),_0x182a5a,_0x5187e7[_0x447b('0xe')][_0x447b('0x10')]);return _0xfb9073(_0x5187e7['error'][_0x447b('0x10')]);}else{logger[_0x447b('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x182a5a,'request\x20sent');_0xfb9073(_0x5187e7['result'][_0x447b('0x10')]);}})['catch'](function(_0xdd5016){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x182a5a,_0xdd5016);_0x201e43(_0xdd5016);});});} \ No newline at end of file +var _0x2955=['client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5bf19e,_0x18e9ad){var _0x8304bb=function(_0x23071b){while(--_0x23071b){_0x5bf19e['push'](_0x5bf19e['shift']());}};_0x8304bb(++_0x18e9ad);}(_0x2955,0x106));var _0x5295=function(_0x5d25ed,_0x87cccc){_0x5d25ed=_0x5d25ed-0x0;var _0x3fbb1d=_0x2955[_0x5d25ed];return _0x3fbb1d;};'use strict';var _=require(_0x5295('0x0'));var util=require('util');var moment=require(_0x5295('0x1'));var BPromise=require('bluebird');var rs=require(_0x5295('0x2'));var fs=require('fs');var Redis=require(_0x5295('0x3'));var db=require(_0x5295('0x4'))['db'];var utils=require(_0x5295('0x5'));var logger=require('../../config/logger')(_0x5295('0x6'));var config=require(_0x5295('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5295('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32abcc,_0x1ac8fc,_0x332803){return new BPromise(function(_0x184d45,_0x1a7d2b){return client[_0x5295('0x9')](_0x32abcc,_0x332803)[_0x5295('0xa')](function(_0x190a6a){logger['info'](_0x5295('0xb'),_0x1ac8fc,_0x5295('0xc'));logger['debug'](_0x5295('0xd'),_0x1ac8fc,_0x5295('0xc'),JSON['stringify'](_0x190a6a));if(_0x190a6a[_0x5295('0xe')]){if(_0x190a6a[_0x5295('0xe')]['code']===0x1f4){logger[_0x5295('0xe')](_0x5295('0xb'),_0x1ac8fc,_0x190a6a[_0x5295('0xe')]['message']);return _0x1a7d2b(_0x190a6a[_0x5295('0xe')][_0x5295('0xf')]);}logger[_0x5295('0xe')](_0x5295('0xb'),_0x1ac8fc,_0x190a6a[_0x5295('0xe')][_0x5295('0xf')]);return _0x184d45(_0x190a6a[_0x5295('0xe')][_0x5295('0xf')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1ac8fc,'request\x20sent');_0x184d45(_0x190a6a[_0x5295('0x10')][_0x5295('0xf')]);}})[_0x5295('0x11')](function(_0x4f2abb){logger[_0x5295('0xe')](_0x5295('0xb'),_0x1ac8fc,_0x4f2abb);_0x1a7d2b(_0x4f2abb);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 3bcb786..6b5c514 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 _0xcd24=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','put','destroy'];(function(_0x11bab7,_0x4f329c){var _0xcb0ca6=function(_0x399e6a){while(--_0x399e6a){_0x11bab7['push'](_0x11bab7['shift']());}};_0xcb0ca6(++_0x4f329c);}(_0xcd24,0x19f));var _0x4cd2=function(_0x4ed5fe,_0x3ed102){_0x4ed5fe=_0x4ed5fe-0x0;var _0x3fa639=_0xcd24[_0x4ed5fe];return _0x3fa639;};'use strict';var multer=require(_0x4cd2('0x0'));var util=require(_0x4cd2('0x1'));var path=require(_0x4cd2('0x2'));var timeout=require(_0x4cd2('0x3'));var express=require(_0x4cd2('0x4'));var router=express[_0x4cd2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4cd2('0x6'));var config=require(_0x4cd2('0x7'));var controller=require(_0x4cd2('0x8'));router[_0x4cd2('0x9')]('/',auth[_0x4cd2('0xa')](),controller[_0x4cd2('0xb')]);router['get'](_0x4cd2('0xc'),auth[_0x4cd2('0xa')](),controller[_0x4cd2('0xd')]);router[_0x4cd2('0x9')](_0x4cd2('0xe'),auth[_0x4cd2('0xa')](),controller['download']);router['post']('/',auth[_0x4cd2('0xa')](),controller['create']);router[_0x4cd2('0xf')](_0x4cd2('0xc'),auth[_0x4cd2('0xa')](),controller['update']);router['delete'](_0x4cd2('0xc'),auth[_0x4cd2('0xa')](),controller[_0x4cd2('0x10')]);module[_0x4cd2('0x11')]=router; \ No newline at end of file +var _0xc295=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','put','update','delete'];(function(_0x4ccbe2,_0x11eacf){var _0x134525=function(_0x5c9da9){while(--_0x5c9da9){_0x4ccbe2['push'](_0x4ccbe2['shift']());}};_0x134525(++_0x11eacf);}(_0xc295,0x73));var _0x5c29=function(_0x508eaa,_0x5b6692){_0x508eaa=_0x508eaa-0x0;var _0x39ff43=_0xc295[_0x508eaa];return _0x39ff43;};'use strict';var multer=require(_0x5c29('0x0'));var util=require(_0x5c29('0x1'));var path=require(_0x5c29('0x2'));var timeout=require(_0x5c29('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c29('0x4'));var auth=require(_0x5c29('0x5'));var interaction=require(_0x5c29('0x6'));var config=require('../../config/environment');var controller=require(_0x5c29('0x7'));router[_0x5c29('0x8')]('/',auth[_0x5c29('0x9')](),controller[_0x5c29('0xa')]);router[_0x5c29('0x8')](_0x5c29('0xb'),auth[_0x5c29('0x9')](),controller[_0x5c29('0xc')]);router[_0x5c29('0x8')](_0x5c29('0xd'),auth['isAuthenticated'](),controller[_0x5c29('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5c29('0xf')](_0x5c29('0xb'),auth[_0x5c29('0x9')](),controller[_0x5c29('0x10')]);router[_0x5c29('0x11')]('/:id',auth[_0x5c29('0x9')](),controller['destroy']);module[_0x5c29('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 30e0782..89fe229 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 _0xd961=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd961,0x8c));var _0x1d96=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xd961[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0x1d96('0x0'));module[_0x1d96('0x1')]={'field':{'type':Sequelize[_0x1d96('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x1d96('0x3')]},'format':{'type':Sequelize[_0x1d96('0x3')]},'groupBy':{'type':Sequelize[_0x1d96('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1d96('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2e1d=['STRING','BOOLEAN','TEXT'];(function(_0x160b8a,_0x33e005){var _0x4dc6e6=function(_0xd349d1){while(--_0xd349d1){_0x160b8a['push'](_0x160b8a['shift']());}};_0x4dc6e6(++_0x33e005);}(_0x2e1d,0x1cd));var _0xd2e1=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x2e1d[_0x3f6bcf];return _0x1c5350;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0xd2e1('0x0')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xd2e1('0x1')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xd2e1('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd2e1('0x1')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2b185cd..4c7f4bf 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 _0x09b2=['includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','update','then','destroy','error','stack','name','index','map','AnalyticFieldReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','filter','merge','VIRTUAL','options'];(function(_0x53a415,_0x320391){var _0x49d11f=function(_0x54915c){while(--_0x54915c){_0x53a415['push'](_0x53a415['shift']());}};_0x49d11f(++_0x320391);}(_0x09b2,0x150));var _0x209b=function(_0x4cbb8e,_0x1047c8){_0x4cbb8e=_0x4cbb8e-0x0;var _0x17846f=_0x09b2[_0x4cbb8e];return _0x17846f;};'use strict';var emlformat=require(_0x209b('0x0'));var rimraf=require(_0x209b('0x1'));var zipdir=require(_0x209b('0x2'));var jsonpatch=require(_0x209b('0x3'));var rp=require('request-promise');var moment=require(_0x209b('0x4'));var BPromise=require(_0x209b('0x5'));var Mustache=require(_0x209b('0x6'));var util=require(_0x209b('0x7'));var path=require(_0x209b('0x8'));var sox=require(_0x209b('0x9'));var csv=require(_0x209b('0xa'));var ejs=require(_0x209b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x209b('0xc'));var squel=require(_0x209b('0xd'));var crypto=require(_0x209b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x209b('0xf'));var toCsv=require(_0x209b('0xa'));var querystring=require(_0x209b('0x10'));var Papa=require(_0x209b('0x11'));var Redis=require(_0x209b('0x12'));var authService=require(_0x209b('0x13'));var qs=require(_0x209b('0x14'));var as=require(_0x209b('0x15'));var hardwareService=require(_0x209b('0x16'));var logger=require(_0x209b('0x17'))(_0x209b('0x18'));var utils=require(_0x209b('0x19'));var config=require(_0x209b('0x1a'));var licenseUtil=require(_0x209b('0x1b'));var db=require(_0x209b('0x1c'))['db'];function respondWithStatusCode(_0xc4afd4,_0x2bd447){_0x2bd447=_0x2bd447||0xcc;return function(_0x397216){if(_0x397216){return _0xc4afd4[_0x209b('0x1d')](_0x2bd447);}return _0xc4afd4[_0x209b('0x1e')](_0x2bd447)[_0x209b('0x1f')]();};}function respondWithResult(_0x18a4ce,_0x3328d8){_0x3328d8=_0x3328d8||0xc8;return function(_0x4cd14c){if(_0x4cd14c){return _0x18a4ce[_0x209b('0x1e')](_0x3328d8)[_0x209b('0x20')](_0x4cd14c);}};}function respondWithFilteredResult(_0x186e9a,_0x4ca220){return function(_0x194073){if(_0x194073){var _0x4718cd=typeof _0x4ca220[_0x209b('0x21')]==='undefined'&&typeof _0x4ca220[_0x209b('0x22')]===_0x209b('0x23');var _0x1ab96e=_0x194073['count'];var _0x1da714=_0x4718cd?0x0:_0x4ca220[_0x209b('0x21')];var _0x3eefe8=_0x4718cd?_0x194073[_0x209b('0x24')]:_0x4ca220[_0x209b('0x21')]+_0x4ca220['limit'];var _0x39f8d5;if(_0x3eefe8>=_0x1ab96e){_0x3eefe8=_0x1ab96e;_0x39f8d5=0xc8;}else{_0x39f8d5=0xce;}_0x186e9a[_0x209b('0x1e')](_0x39f8d5);return _0x186e9a['set']('Content-Range',_0x1da714+'-'+_0x3eefe8+'/'+_0x1ab96e)[_0x209b('0x20')](_0x194073);}return null;};}function patchUpdates(_0x62186a){return function(_0x24bd23){try{jsonpatch[_0x209b('0x25')](_0x24bd23,_0x62186a,!![]);}catch(_0x810ec){return BPromise[_0x209b('0x26')](_0x810ec);}return _0x24bd23['save']();};}function saveUpdates(_0x1c67f1,_0x2ab186){return function(_0x40df85){if(_0x40df85){return _0x40df85[_0x209b('0x27')](_0x1c67f1)[_0x209b('0x28')](function(_0x453794){return _0x453794;});}return null;};}function removeEntity(_0x17dbfb,_0x8ff99b){return function(_0x36655a){if(_0x36655a){return _0x36655a[_0x209b('0x29')]()[_0x209b('0x28')](function(){_0x17dbfb[_0x209b('0x1e')](0xcc)[_0x209b('0x1f')]();});}};}function handleEntityNotFound(_0x1d7836,_0x1db69f){return function(_0x446f2e){if(!_0x446f2e){_0x1d7836[_0x209b('0x1d')](0x194);}return _0x446f2e;};}function handleError(_0x71a865,_0x2d3c5f){_0x2d3c5f=_0x2d3c5f||0x1f4;return function(_0x1af9b4){logger[_0x209b('0x2a')](_0x1af9b4[_0x209b('0x2b')]);if(_0x1af9b4[_0x209b('0x2c')]){delete _0x1af9b4[_0x209b('0x2c')];}_0x71a865[_0x209b('0x1e')](_0x2d3c5f)['send'](_0x1af9b4);};}exports[_0x209b('0x2d')]=function(_0x5780eb,_0x4abcc9){var _0x5a9344={},_0x8e3ea6={},_0x213bbe={'count':0x0,'rows':[]};var _0x352be9=_[_0x209b('0x2e')](db[_0x209b('0x2f')]['rawAttributes'],function(_0x5b12c1){return{'name':_0x5b12c1['fieldName'],'type':_0x5b12c1[_0x209b('0x30')][_0x209b('0x31')]};});_0x8e3ea6[_0x209b('0x32')]=_['map'](_0x352be9,_0x209b('0x2c'));_0x8e3ea6[_0x209b('0x33')]=_[_0x209b('0x34')](_0x5780eb['query']);_0x8e3ea6[_0x209b('0x35')]=_[_0x209b('0x36')](_0x8e3ea6['model'],_0x8e3ea6[_0x209b('0x33')]);_0x5a9344[_0x209b('0x37')]=_[_0x209b('0x36')](_0x8e3ea6[_0x209b('0x32')],qs[_0x209b('0x38')](_0x5780eb[_0x209b('0x33')][_0x209b('0x38')]));_0x5a9344[_0x209b('0x37')]=_0x5a9344[_0x209b('0x37')][_0x209b('0x39')]?_0x5a9344[_0x209b('0x37')]:_0x8e3ea6[_0x209b('0x32')];if(!_0x5780eb[_0x209b('0x33')]['hasOwnProperty']('nolimit')){_0x5a9344[_0x209b('0x22')]=qs[_0x209b('0x22')](_0x5780eb[_0x209b('0x33')][_0x209b('0x22')]);_0x5a9344['offset']=qs[_0x209b('0x21')](_0x5780eb['query'][_0x209b('0x21')]);}_0x5a9344[_0x209b('0x3a')]=qs['sort'](_0x5780eb['query']['sort']);_0x5a9344[_0x209b('0x3b')]=qs[_0x209b('0x35')](_['pick'](_0x5780eb['query'],_0x8e3ea6['filters']),_0x352be9);if(_0x5780eb[_0x209b('0x33')][_0x209b('0x3c')]){_0x5a9344[_0x209b('0x3b')]=_[_0x209b('0x3d')](_0x5a9344[_0x209b('0x3b')],{'$or':_[_0x209b('0x2e')](_0x352be9,function(_0x9de39){if(_0x9de39[_0x209b('0x30')]!==_0x209b('0x3e')){var _0x5c3c03={};_0x5c3c03[_0x9de39[_0x209b('0x2c')]]={'$like':'%'+_0x5780eb['query'][_0x209b('0x3c')]+'%'};return _0x5c3c03;}})});}_0x5a9344=_[_0x209b('0x3d')]({},_0x5a9344,_0x5780eb[_0x209b('0x3f')]);var _0x5aeb4a={'where':_0x5a9344['where']};return db[_0x209b('0x2f')][_0x209b('0x24')](_0x5aeb4a)[_0x209b('0x28')](function(_0x9e6476){_0x213bbe['count']=_0x9e6476;if(_0x5780eb[_0x209b('0x33')][_0x209b('0x40')]){_0x5a9344[_0x209b('0x41')]=[{'all':!![]}];}return db[_0x209b('0x2f')][_0x209b('0x42')](_0x5a9344);})[_0x209b('0x28')](function(_0x3cb822){_0x213bbe[_0x209b('0x43')]=_0x3cb822;return _0x213bbe;})[_0x209b('0x28')](respondWithFilteredResult(_0x4abcc9,_0x5a9344))[_0x209b('0x44')](handleError(_0x4abcc9,null));};exports[_0x209b('0x45')]=function(_0x33ae4f,_0x1010db){var _0x347b63={'raw':![],'where':{'id':_0x33ae4f[_0x209b('0x46')]['id']}},_0x48e16a={};_0x48e16a[_0x209b('0x32')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x48e16a[_0x209b('0x33')]=_[_0x209b('0x34')](_0x33ae4f[_0x209b('0x33')]);_0x48e16a[_0x209b('0x35')]=_[_0x209b('0x36')](_0x48e16a[_0x209b('0x32')],_0x48e16a[_0x209b('0x33')]);_0x347b63[_0x209b('0x37')]=_['intersection'](_0x48e16a[_0x209b('0x32')],qs[_0x209b('0x38')](_0x33ae4f['query'][_0x209b('0x38')]));_0x347b63[_0x209b('0x37')]=_0x347b63[_0x209b('0x37')][_0x209b('0x39')]?_0x347b63[_0x209b('0x37')]:_0x48e16a['model'];if(_0x33ae4f[_0x209b('0x33')][_0x209b('0x40')]){_0x347b63[_0x209b('0x41')]=[{'all':!![]}];}_0x347b63=_[_0x209b('0x3d')]({},_0x347b63,_0x33ae4f['options']);return db[_0x209b('0x2f')][_0x209b('0x47')](_0x347b63)[_0x209b('0x28')](handleEntityNotFound(_0x1010db,null))['then'](respondWithResult(_0x1010db,null))[_0x209b('0x44')](handleError(_0x1010db,null));};exports[_0x209b('0x48')]=function(_0x568edc,_0x54015f){return db[_0x209b('0x2f')]['create'](_0x568edc[_0x209b('0x49')],{})[_0x209b('0x28')](respondWithResult(_0x54015f,0xc9))[_0x209b('0x44')](handleError(_0x54015f,null));};exports[_0x209b('0x4a')]=function(_0x580f8f,_0x196379){return db[_0x209b('0x2f')][_0x209b('0x4a')](_0x580f8f[_0x209b('0x49')],{'raw':![],'individualHooks':!![]})[_0x209b('0x28')](respondWithResult(_0x196379,0xc9))[_0x209b('0x44')](handleError(_0x196379,null));};exports[_0x209b('0x27')]=function(_0x64f55f,_0x5c6f23){if(_0x64f55f[_0x209b('0x49')]['id']){delete _0x64f55f[_0x209b('0x49')]['id'];}return db['AnalyticFieldReport'][_0x209b('0x47')]({'where':{'id':_0x64f55f[_0x209b('0x46')]['id']}})[_0x209b('0x28')](handleEntityNotFound(_0x5c6f23,null))[_0x209b('0x28')](saveUpdates(_0x64f55f[_0x209b('0x49')],null))[_0x209b('0x28')](respondWithResult(_0x5c6f23,null))[_0x209b('0x44')](handleError(_0x5c6f23,null));};exports[_0x209b('0x29')]=function(_0x244a3f,_0x24ee40){return db[_0x209b('0x2f')][_0x209b('0x47')]({'where':{'id':_0x244a3f['params']['id']}})['then'](handleEntityNotFound(_0x24ee40,null))[_0x209b('0x28')](removeEntity(_0x24ee40,null))[_0x209b('0x44')](handleError(_0x24ee40,null));};exports[_0x209b('0x4b')]=function(_0x1bc6e0,_0x435483){return db[_0x209b('0x2f')]['destroy']({'where':{'id':_0x1bc6e0[_0x209b('0x33')][_0x209b('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x435483,0xcc))[_0x209b('0x44')](handleError(_0x435483,null));};exports['addFields']=function(_0x146285,_0x598cfd,_0x37a557){return db[_0x209b('0x4d')]['findOne']({'where':{'id':_0x146285['params']['id']}})[_0x209b('0x28')](handleEntityNotFound(_0x598cfd,null))[_0x209b('0x28')](function(_0x4aa979){if(_0x4aa979){return db[_0x209b('0x4e')]['transaction'](function(_0x28cf8c){return db[_0x209b('0x2f')]['destroy']({'where':{'CustomReportId':_0x146285['params']['id']},'transaction':_0x28cf8c})[_0x209b('0x28')](function(_0x4efff0){var _0x3d5048=_[_0x209b('0x2e')](_0x146285['body'],function(_0x151017){delete _0x151017['id'];_0x151017[_0x209b('0x4f')]=_0x146285['params']['id'];return _0x151017;});return db['AnalyticFieldReport'][_0x209b('0x4a')](_0x3d5048,{'transaction':_0x28cf8c});});})[_0x209b('0x28')](function(){return db['AnalyticFieldReport'][_0x209b('0x42')]({'where':{'CustomReportId':_0x146285[_0x209b('0x46')]['id']}});});}})['then'](respondWithResult(_0x598cfd,null))['catch'](handleError(_0x598cfd,null));}; \ No newline at end of file +var _0x93a6=['create','body','catch','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','destroy','end','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','then','findAll','show','params','keys','includeAll','include','find'];(function(_0x4d1965,_0x43152e){var _0xdcfade=function(_0x3d3b8a){while(--_0x3d3b8a){_0x4d1965['push'](_0x4d1965['shift']());}};_0xdcfade(++_0x43152e);}(_0x93a6,0x1ab));var _0x693a=function(_0x51b169,_0x5efbc2){_0x51b169=_0x51b169-0x0;var _0x12605a=_0x93a6[_0x51b169];return _0x12605a;};'use strict';var emlformat=require(_0x693a('0x0'));var rimraf=require(_0x693a('0x1'));var zipdir=require(_0x693a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x693a('0x3'));var moment=require(_0x693a('0x4'));var BPromise=require(_0x693a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x693a('0x6'));var csv=require(_0x693a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x693a('0x8'));var squel=require(_0x693a('0x9'));var crypto=require(_0x693a('0xa'));var jsforce=require(_0x693a('0xb'));var deskjs=require(_0x693a('0xc'));var toCsv=require(_0x693a('0x7'));var querystring=require(_0x693a('0xd'));var Papa=require(_0x693a('0xe'));var Redis=require(_0x693a('0xf'));var authService=require(_0x693a('0x10'));var qs=require(_0x693a('0x11'));var as=require(_0x693a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x693a('0x13'))(_0x693a('0x14'));var utils=require(_0x693a('0x15'));var config=require(_0x693a('0x16'));var licenseUtil=require(_0x693a('0x17'));var db=require(_0x693a('0x18'))['db'];function respondWithStatusCode(_0x583c58,_0x1ad41e){_0x1ad41e=_0x1ad41e||0xcc;return function(_0x15bee2){if(_0x15bee2){return _0x583c58[_0x693a('0x19')](_0x1ad41e);}return _0x583c58[_0x693a('0x1a')](_0x1ad41e)['end']();};}function respondWithResult(_0x2b1644,_0x5ba31b){_0x5ba31b=_0x5ba31b||0xc8;return function(_0x459b58){if(_0x459b58){return _0x2b1644[_0x693a('0x1a')](_0x5ba31b)[_0x693a('0x1b')](_0x459b58);}};}function respondWithFilteredResult(_0x1fffa7,_0x59dcb2){return function(_0x32f14e){if(_0x32f14e){var _0x2610ec=typeof _0x59dcb2['offset']===_0x693a('0x1c')&&typeof _0x59dcb2['limit']===_0x693a('0x1c');var _0x5b80b8=_0x32f14e[_0x693a('0x1d')];var _0x23ad46=_0x2610ec?0x0:_0x59dcb2['offset'];var _0x3bd15a=_0x2610ec?_0x32f14e[_0x693a('0x1d')]:_0x59dcb2[_0x693a('0x1e')]+_0x59dcb2[_0x693a('0x1f')];var _0x5402a;if(_0x3bd15a>=_0x5b80b8){_0x3bd15a=_0x5b80b8;_0x5402a=0xc8;}else{_0x5402a=0xce;}_0x1fffa7[_0x693a('0x1a')](_0x5402a);return _0x1fffa7[_0x693a('0x20')](_0x693a('0x21'),_0x23ad46+'-'+_0x3bd15a+'/'+_0x5b80b8)['json'](_0x32f14e);}return null;};}function patchUpdates(_0x498842){return function(_0x5e6149){try{jsonpatch[_0x693a('0x22')](_0x5e6149,_0x498842,!![]);}catch(_0x3ad203){return BPromise[_0x693a('0x23')](_0x3ad203);}return _0x5e6149['save']();};}function saveUpdates(_0x37e099,_0x47ca56){return function(_0x2d4971){if(_0x2d4971){return _0x2d4971['update'](_0x37e099)['then'](function(_0x315375){return _0x315375;});}return null;};}function removeEntity(_0xf9bb45,_0x1caf45){return function(_0xaa6a9c){if(_0xaa6a9c){return _0xaa6a9c[_0x693a('0x24')]()['then'](function(){_0xf9bb45['status'](0xcc)[_0x693a('0x25')]();});}};}function handleEntityNotFound(_0x483fdc,_0x4d7a09){return function(_0x30579d){if(!_0x30579d){_0x483fdc[_0x693a('0x19')](0x194);}return _0x30579d;};}function handleError(_0x1c511c,_0x385e95){_0x385e95=_0x385e95||0x1f4;return function(_0x42b039){logger[_0x693a('0x26')](_0x42b039[_0x693a('0x27')]);if(_0x42b039[_0x693a('0x28')]){delete _0x42b039[_0x693a('0x28')];}_0x1c511c[_0x693a('0x1a')](_0x385e95)['send'](_0x42b039);};}exports[_0x693a('0x29')]=function(_0x1c684d,_0x36d643){var _0x2b1d6e={},_0x3d5745={},_0x545b1e={'count':0x0,'rows':[]};var _0x4977a3=_[_0x693a('0x2a')](db[_0x693a('0x2b')][_0x693a('0x2c')],function(_0x433579){return{'name':_0x433579[_0x693a('0x2d')],'type':_0x433579[_0x693a('0x2e')][_0x693a('0x2f')]};});_0x3d5745['model']=_[_0x693a('0x2a')](_0x4977a3,_0x693a('0x28'));_0x3d5745[_0x693a('0x30')]=_['keys'](_0x1c684d[_0x693a('0x30')]);_0x3d5745['filters']=_[_0x693a('0x31')](_0x3d5745[_0x693a('0x32')],_0x3d5745[_0x693a('0x30')]);_0x2b1d6e[_0x693a('0x33')]=_[_0x693a('0x31')](_0x3d5745[_0x693a('0x32')],qs['fields'](_0x1c684d['query'][_0x693a('0x34')]));_0x2b1d6e[_0x693a('0x33')]=_0x2b1d6e[_0x693a('0x33')][_0x693a('0x35')]?_0x2b1d6e[_0x693a('0x33')]:_0x3d5745['model'];if(!_0x1c684d[_0x693a('0x30')][_0x693a('0x36')](_0x693a('0x37'))){_0x2b1d6e[_0x693a('0x1f')]=qs['limit'](_0x1c684d[_0x693a('0x30')]['limit']);_0x2b1d6e[_0x693a('0x1e')]=qs[_0x693a('0x1e')](_0x1c684d[_0x693a('0x30')][_0x693a('0x1e')]);}_0x2b1d6e[_0x693a('0x38')]=qs[_0x693a('0x39')](_0x1c684d[_0x693a('0x30')][_0x693a('0x39')]);_0x2b1d6e[_0x693a('0x3a')]=qs[_0x693a('0x3b')](_['pick'](_0x1c684d['query'],_0x3d5745[_0x693a('0x3b')]),_0x4977a3);if(_0x1c684d[_0x693a('0x30')][_0x693a('0x3c')]){_0x2b1d6e[_0x693a('0x3a')]=_['merge'](_0x2b1d6e[_0x693a('0x3a')],{'$or':_[_0x693a('0x2a')](_0x4977a3,function(_0x54bac){if(_0x54bac['type']!==_0x693a('0x3d')){var _0x2cc2a0={};_0x2cc2a0[_0x54bac[_0x693a('0x28')]]={'$like':'%'+_0x1c684d[_0x693a('0x30')][_0x693a('0x3c')]+'%'};return _0x2cc2a0;}})});}_0x2b1d6e=_[_0x693a('0x3e')]({},_0x2b1d6e,_0x1c684d['options']);var _0x1fe567={'where':_0x2b1d6e[_0x693a('0x3a')]};return db[_0x693a('0x2b')]['count'](_0x1fe567)[_0x693a('0x3f')](function(_0x2aac0c){_0x545b1e[_0x693a('0x1d')]=_0x2aac0c;if(_0x1c684d[_0x693a('0x30')]['includeAll']){_0x2b1d6e['include']=[{'all':!![]}];}return db[_0x693a('0x2b')][_0x693a('0x40')](_0x2b1d6e);})[_0x693a('0x3f')](function(_0x2f8a18){_0x545b1e['rows']=_0x2f8a18;return _0x545b1e;})[_0x693a('0x3f')](respondWithFilteredResult(_0x36d643,_0x2b1d6e))['catch'](handleError(_0x36d643,null));};exports[_0x693a('0x41')]=function(_0x18fa8c,_0x51fffd){var _0x11f4df={'raw':![],'where':{'id':_0x18fa8c[_0x693a('0x42')]['id']}},_0x33eb3d={};_0x33eb3d['model']=_[_0x693a('0x43')](db[_0x693a('0x2b')]['rawAttributes']);_0x33eb3d[_0x693a('0x30')]=_[_0x693a('0x43')](_0x18fa8c[_0x693a('0x30')]);_0x33eb3d['filters']=_['intersection'](_0x33eb3d[_0x693a('0x32')],_0x33eb3d['query']);_0x11f4df['attributes']=_[_0x693a('0x31')](_0x33eb3d['model'],qs[_0x693a('0x34')](_0x18fa8c[_0x693a('0x30')]['fields']));_0x11f4df[_0x693a('0x33')]=_0x11f4df['attributes'][_0x693a('0x35')]?_0x11f4df[_0x693a('0x33')]:_0x33eb3d[_0x693a('0x32')];if(_0x18fa8c[_0x693a('0x30')][_0x693a('0x44')]){_0x11f4df[_0x693a('0x45')]=[{'all':!![]}];}_0x11f4df=_[_0x693a('0x3e')]({},_0x11f4df,_0x18fa8c['options']);return db['AnalyticFieldReport'][_0x693a('0x46')](_0x11f4df)['then'](handleEntityNotFound(_0x51fffd,null))[_0x693a('0x3f')](respondWithResult(_0x51fffd,null))['catch'](handleError(_0x51fffd,null));};exports[_0x693a('0x47')]=function(_0xe99e12,_0x10ecf1){return db[_0x693a('0x2b')][_0x693a('0x47')](_0xe99e12[_0x693a('0x48')],{})[_0x693a('0x3f')](respondWithResult(_0x10ecf1,0xc9))[_0x693a('0x49')](handleError(_0x10ecf1,null));};exports['bulkCreate']=function(_0x5e0cf9,_0x56eca8){return db['AnalyticFieldReport'][_0x693a('0x4a')](_0x5e0cf9[_0x693a('0x48')],{'raw':![],'individualHooks':!![]})[_0x693a('0x3f')](respondWithResult(_0x56eca8,0xc9))[_0x693a('0x49')](handleError(_0x56eca8,null));};exports[_0x693a('0x4b')]=function(_0x176def,_0x4a1104){if(_0x176def[_0x693a('0x48')]['id']){delete _0x176def[_0x693a('0x48')]['id'];}return db[_0x693a('0x2b')][_0x693a('0x46')]({'where':{'id':_0x176def[_0x693a('0x42')]['id']}})[_0x693a('0x3f')](handleEntityNotFound(_0x4a1104,null))[_0x693a('0x3f')](saveUpdates(_0x176def[_0x693a('0x48')],null))[_0x693a('0x3f')](respondWithResult(_0x4a1104,null))[_0x693a('0x49')](handleError(_0x4a1104,null));};exports[_0x693a('0x24')]=function(_0x4eca7f,_0x2cb01c){return db[_0x693a('0x2b')][_0x693a('0x46')]({'where':{'id':_0x4eca7f[_0x693a('0x42')]['id']}})[_0x693a('0x3f')](handleEntityNotFound(_0x2cb01c,null))[_0x693a('0x3f')](removeEntity(_0x2cb01c,null))[_0x693a('0x49')](handleError(_0x2cb01c,null));};exports[_0x693a('0x4c')]=function(_0x2f8987,_0x3f2f80){return db[_0x693a('0x2b')][_0x693a('0x24')]({'where':{'id':_0x2f8987[_0x693a('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x693a('0x3f')](respondWithResult(_0x3f2f80,0xcc))[_0x693a('0x49')](handleError(_0x3f2f80,null));};exports[_0x693a('0x4d')]=function(_0x368e69,_0x2bac19,_0x1d1717){return db[_0x693a('0x4e')][_0x693a('0x4f')]({'where':{'id':_0x368e69[_0x693a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2bac19,null))[_0x693a('0x3f')](function(_0x276c43){if(_0x276c43){return db[_0x693a('0x50')][_0x693a('0x51')](function(_0xc93b65){return db['AnalyticFieldReport'][_0x693a('0x24')]({'where':{'CustomReportId':_0x368e69[_0x693a('0x42')]['id']},'transaction':_0xc93b65})[_0x693a('0x3f')](function(_0x591091){var _0x3448eb=_[_0x693a('0x2a')](_0x368e69[_0x693a('0x48')],function(_0xcf55fc){delete _0xcf55fc['id'];_0xcf55fc[_0x693a('0x52')]=_0x368e69['params']['id'];return _0xcf55fc;});return db[_0x693a('0x2b')][_0x693a('0x4a')](_0x3448eb,{'transaction':_0xc93b65});});})['then'](function(){return db[_0x693a('0x2b')][_0x693a('0x40')]({'where':{'CustomReportId':_0x368e69[_0x693a('0x42')]['id']}});});}})['then'](respondWithResult(_0x2bac19,null))[_0x693a('0x49')](handleError(_0x2bac19,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 118f8a2..e531907 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 _0x7628=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticFieldReport','util','../../config/logger','api'];(function(_0x34a402,_0x693a46){var _0x54302a=function(_0x5c09ed){while(--_0x5c09ed){_0x34a402['push'](_0x34a402['shift']());}};_0x54302a(++_0x693a46);}(_0x7628,0xef));var _0x8762=function(_0x535a31,_0x13ed3c){_0x535a31=_0x535a31-0x0;var _0x499f20=_0x7628[_0x535a31];return _0x499f20;};'use strict';var _=require('lodash');var util=require(_0x8762('0x0'));var logger=require(_0x8762('0x1'))(_0x8762('0x2'));var moment=require(_0x8762('0x3'));var BPromise=require(_0x8762('0x4'));var rp=require(_0x8762('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8762('0x6'));var config=require(_0x8762('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x8762('0x8')]=function(_0x101bdb,_0x4c9caa){return _0x101bdb[_0x8762('0x9')](_0x8762('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76d0=['api','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','util','../../config/logger'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x76d0,0x147));var _0x076d=function(_0x5ae0ae,_0x33bc65){_0x5ae0ae=_0x5ae0ae-0x0;var _0xef4f61=_0x76d0[_0x5ae0ae];return _0xef4f61;};'use strict';var _=require(_0x076d('0x0'));var util=require(_0x076d('0x1'));var logger=require(_0x076d('0x2'))(_0x076d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x076d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x076d('0x5'));var config=require(_0x076d('0x6'));var attributes=require(_0x076d('0x7'));module['exports']=function(_0x452317,_0x19aa13){return _0x452317[_0x076d('0x8')](_0x076d('0x9'),attributes,{'tableName':'analytics_report_fields','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 1975ed4..2ef180d 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 _0xef70=['rpc','../../config/environment','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x29ef41,_0x59230c){var _0x31fac3=function(_0x20d226){while(--_0x20d226){_0x29ef41['push'](_0x29ef41['shift']());}};_0x31fac3(++_0x59230c);}(_0xef70,0xbf));var _0x0ef7=function(_0x5460c3,_0x5c6afc){_0x5460c3=_0x5460c3-0x0;var _0xaccfd4=_0xef70[_0x5460c3];return _0xaccfd4;};'use strict';var _=require(_0x0ef7('0x0'));var util=require(_0x0ef7('0x1'));var moment=require(_0x0ef7('0x2'));var BPromise=require(_0x0ef7('0x3'));var rs=require(_0x0ef7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ef7('0x5'));var logger=require(_0x0ef7('0x6'))(_0x0ef7('0x7'));var config=require(_0x0ef7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5c77,_0x355ce3,_0x26d6d6){return new BPromise(function(_0x34069f,_0x338e85){return client[_0x0ef7('0x9')](_0x4a5c77,_0x26d6d6)[_0x0ef7('0xa')](function(_0xebd09f){logger[_0x0ef7('0xb')](_0x0ef7('0xc'),_0x355ce3,_0x0ef7('0xd'));logger[_0x0ef7('0xe')](_0x0ef7('0xf'),_0x355ce3,_0x0ef7('0xd'),JSON[_0x0ef7('0x10')](_0xebd09f));if(_0xebd09f['error']){if(_0xebd09f['error'][_0x0ef7('0x11')]===0x1f4){logger[_0x0ef7('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x355ce3,_0xebd09f['error'][_0x0ef7('0x13')]);return _0x338e85(_0xebd09f[_0x0ef7('0x12')][_0x0ef7('0x13')]);}logger[_0x0ef7('0x12')](_0x0ef7('0xc'),_0x355ce3,_0xebd09f[_0x0ef7('0x12')][_0x0ef7('0x13')]);return _0x34069f(_0xebd09f[_0x0ef7('0x12')][_0x0ef7('0x13')]);}else{logger[_0x0ef7('0xb')](_0x0ef7('0xc'),_0x355ce3,_0x0ef7('0xd'));_0x34069f(_0xebd09f[_0x0ef7('0x14')][_0x0ef7('0x13')]);}})[_0x0ef7('0x15')](function(_0x122d9e){logger[_0x0ef7('0x12')](_0x0ef7('0xc'),_0x355ce3,_0x122d9e);_0x338e85(_0x122d9e);});});} \ No newline at end of file +var _0xaa72=['code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3988c7,_0x159d77){var _0xa63b01=function(_0x23e766){while(--_0x23e766){_0x3988c7['push'](_0x3988c7['shift']());}};_0xa63b01(++_0x159d77);}(_0xaa72,0x101));var _0x2aa7=function(_0x10fcf6,_0x4c54eb){_0x10fcf6=_0x10fcf6-0x0;var _0x10c126=_0xaa72[_0x10fcf6];return _0x10c126;};'use strict';var _=require(_0x2aa7('0x0'));var util=require(_0x2aa7('0x1'));var moment=require(_0x2aa7('0x2'));var BPromise=require(_0x2aa7('0x3'));var rs=require(_0x2aa7('0x4'));var fs=require('fs');var Redis=require(_0x2aa7('0x5'));var db=require(_0x2aa7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2aa7('0x7'))(_0x2aa7('0x8'));var config=require(_0x2aa7('0x9'));var jayson=require(_0x2aa7('0xa'));var client=jayson['client'][_0x2aa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34c16d,_0xf7b08f,_0x3cf94e){return new BPromise(function(_0x23ecea,_0x12308b){return client['request'](_0x34c16d,_0x3cf94e)[_0x2aa7('0xc')](function(_0x1b0abe){logger[_0x2aa7('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0xf7b08f,_0x2aa7('0xe'));logger[_0x2aa7('0xf')](_0x2aa7('0x10'),_0xf7b08f,'request\x20sent',JSON[_0x2aa7('0x11')](_0x1b0abe));if(_0x1b0abe[_0x2aa7('0x12')]){if(_0x1b0abe[_0x2aa7('0x12')][_0x2aa7('0x13')]===0x1f4){logger[_0x2aa7('0x12')](_0x2aa7('0x14'),_0xf7b08f,_0x1b0abe[_0x2aa7('0x12')][_0x2aa7('0x15')]);return _0x12308b(_0x1b0abe[_0x2aa7('0x12')][_0x2aa7('0x15')]);}logger[_0x2aa7('0x12')](_0x2aa7('0x14'),_0xf7b08f,_0x1b0abe[_0x2aa7('0x12')][_0x2aa7('0x15')]);return _0x23ecea(_0x1b0abe[_0x2aa7('0x12')]['message']);}else{logger[_0x2aa7('0xd')](_0x2aa7('0x14'),_0xf7b08f,_0x2aa7('0xe'));_0x23ecea(_0x1b0abe['result'][_0x2aa7('0x15')]);}})[_0x2aa7('0x16')](function(_0x4747f8){logger[_0x2aa7('0x12')](_0x2aa7('0x14'),_0xf7b08f,_0x4747f8);_0x12308b(_0x4747f8);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 192354b..7591416 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(_0x23fe6d,_0x4ec422){var _0x3854c0=function(_0x60bda){while(--_0x60bda){_0x23fe6d['push'](_0x23fe6d['shift']());}};_0x3854c0(++_0x4ec422);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x47c0b1,_0x309f89){var _0x58210e=function(_0x139968){while(--_0x139968){_0x47c0b1['push'](_0x47c0b1['shift']());}};_0x58210e(++_0x309f89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 9ddba06..b83537d 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 _0x2c6a=['exports','STRING','name','sequelize'];(function(_0x3c83a7,_0x80bdc){var _0x5454aa=function(_0x5b6564){while(--_0x5b6564){_0x3c83a7['push'](_0x3c83a7['shift']());}};_0x5454aa(++_0x80bdc);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa2c6('0x0'));module[_0xa2c6('0x1')]={'name':{'type':Sequelize[_0xa2c6('0x2')],'allowNull':![],'unique':_0xa2c6('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xa2c6('0x2')]}}; \ No newline at end of file +var _0x5397=['TEXT','exports','STRING','name'];(function(_0x4b48e5,_0xc3c425){var _0x210b17=function(_0x43ccc1){while(--_0x43ccc1){_0x4b48e5['push'](_0x4b48e5['shift']());}};_0x210b17(++_0xc3c425);}(_0x5397,0x105));var _0x7539=function(_0x2be502,_0x456697){_0x2be502=_0x2be502-0x0;var _0x29a0f8=_0x5397[_0x2be502];return _0x29a0f8;};'use strict';var Sequelize=require('sequelize');module[_0x7539('0x0')]={'name':{'type':Sequelize[_0x7539('0x1')],'allowNull':![],'unique':_0x7539('0x2')},'table':{'type':Sequelize[_0x7539('0x1')]},'metric':{'type':Sequelize[_0x7539('0x3')]},'description':{'type':Sequelize[_0x7539('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 4075593..b961031 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 _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x21e45c,_0x58cb79){var _0x93e844=function(_0x4844dc){while(--_0x4844dc){_0x21e45c['push'](_0x21e45c['shift']());}};_0x93e844(++_0x58cb79);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xf2ca[_0x2becba];return _0x90b5dd;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54a8d8,_0x1e3aa6){_0x54a8d8=_0x54a8d8-0x0;var _0x359959=_0x1cb9[_0x54a8d8];return _0x359959;};'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'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d5e2c17..8fae839 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 _0xbcba=['util','api','moment','bluebird','request-promise','path','rimraf','exports','AnalyticMetric','analytics_metrics','lodash'];(function(_0x17de52,_0x3543b3){var _0x393d4e=function(_0x416f6f){while(--_0x416f6f){_0x17de52['push'](_0x17de52['shift']());}};_0x393d4e(++_0x3543b3);}(_0xbcba,0x6d));var _0xabcb=function(_0x3cb950,_0x43bf5c){_0x3cb950=_0x3cb950-0x0;var _0x7255b=_0xbcba[_0x3cb950];return _0x7255b;};'use strict';var _=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var logger=require('../../config/logger')(_0xabcb('0x2'));var moment=require(_0xabcb('0x3'));var BPromise=require(_0xabcb('0x4'));var rp=require(_0xabcb('0x5'));var fs=require('fs');var path=require(_0xabcb('0x6'));var rimraf=require(_0xabcb('0x7'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xabcb('0x8')]=function(_0x1290b2,_0x5c706e){return _0x1290b2['define'](_0xabcb('0x9'),attributes,{'tableName':_0xabcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x358d9b,_0x6e459c){var _0x3636c7=function(_0x29e277){while(--_0x29e277){_0x358d9b['push'](_0x358d9b['shift']());}};_0x3636c7(++_0x6e459c);}(_0x90b1,0x1bb));var _0x190b=function(_0x17d090,_0x4fc0c7){_0x17d090=_0x17d090-0x0;var _0x1c89b8=_0x90b1[_0x17d090];return _0x1c89b8;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 55128f2..3bc713a 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 _0x3ed1=['AnalyticMetric,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2164c6,_0x2c5930){var _0x2104de=function(_0x2ea8db){while(--_0x2ea8db){_0x2164c6['push'](_0x2164c6['shift']());}};_0x2104de(++_0x2c5930);}(_0x3ed1,0xa3));var _0x13ed=function(_0x23ca0b,_0x2c9a47){_0x23ca0b=_0x23ca0b-0x0;var _0x235eb6=_0x3ed1[_0x23ca0b];return _0x235eb6;};'use strict';var _=require(_0x13ed('0x0'));var util=require(_0x13ed('0x1'));var moment=require(_0x13ed('0x2'));var BPromise=require(_0x13ed('0x3'));var rs=require(_0x13ed('0x4'));var fs=require('fs');var Redis=require(_0x13ed('0x5'));var db=require(_0x13ed('0x6'))['db'];var utils=require(_0x13ed('0x7'));var logger=require(_0x13ed('0x8'))(_0x13ed('0x9'));var config=require(_0x13ed('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x13ed('0xb')][_0x13ed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4011d4,_0x5b18be,_0x30c216){return new BPromise(function(_0x3bf994,_0x3f7dc4){return client[_0x13ed('0xd')](_0x4011d4,_0x30c216)['then'](function(_0x587032){logger[_0x13ed('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x5b18be,_0x13ed('0xf'));logger[_0x13ed('0x10')](_0x13ed('0x11'),_0x5b18be,_0x13ed('0xf'),JSON[_0x13ed('0x12')](_0x587032));if(_0x587032['error']){if(_0x587032[_0x13ed('0x13')][_0x13ed('0x14')]===0x1f4){logger[_0x13ed('0x13')](_0x13ed('0x15'),_0x5b18be,_0x587032['error']['message']);return _0x3f7dc4(_0x587032['error'][_0x13ed('0x16')]);}logger[_0x13ed('0x13')](_0x13ed('0x15'),_0x5b18be,_0x587032['error']['message']);return _0x3bf994(_0x587032[_0x13ed('0x13')][_0x13ed('0x16')]);}else{logger[_0x13ed('0xe')](_0x13ed('0x15'),_0x5b18be,_0x13ed('0xf'));_0x3bf994(_0x587032['result'][_0x13ed('0x16')]);}})['catch'](function(_0xb66a10){logger['error'](_0x13ed('0x15'),_0x5b18be,_0xb66a10);_0x3f7dc4(_0xb66a10);});});} \ No newline at end of file +var _0x866e=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xe77cf5,_0x57f108){var _0x800f5=function(_0x26d365){while(--_0x26d365){_0xe77cf5['push'](_0xe77cf5['shift']());}};_0x800f5(++_0x57f108);}(_0x866e,0xaa));var _0xe866=function(_0xc25529,_0x26fe80){_0xc25529=_0xc25529-0x0;var _0x364e3e=_0x866e[_0xc25529];return _0x364e3e;};'use strict';var _=require(_0xe866('0x0'));var util=require(_0xe866('0x1'));var moment=require('moment');var BPromise=require(_0xe866('0x2'));var rs=require(_0xe866('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe866('0x4'))['db'];var utils=require(_0xe866('0x5'));var logger=require(_0xe866('0x6'))(_0xe866('0x7'));var config=require('../../config/environment');var jayson=require(_0xe866('0x8'));var client=jayson[_0xe866('0x9')][_0xe866('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5909ab,_0x51c398,_0x37c736){return new BPromise(function(_0x5efa25,_0x1b3cd8){return client[_0xe866('0xb')](_0x5909ab,_0x37c736)[_0xe866('0xc')](function(_0x3526ce){logger[_0xe866('0xd')](_0xe866('0xe'),_0x51c398,_0xe866('0xf'));logger[_0xe866('0x10')](_0xe866('0x11'),_0x51c398,'request\x20sent',JSON[_0xe866('0x12')](_0x3526ce));if(_0x3526ce[_0xe866('0x13')]){if(_0x3526ce[_0xe866('0x13')][_0xe866('0x14')]===0x1f4){logger[_0xe866('0x13')](_0xe866('0xe'),_0x51c398,_0x3526ce['error'][_0xe866('0x15')]);return _0x1b3cd8(_0x3526ce[_0xe866('0x13')][_0xe866('0x15')]);}logger['error'](_0xe866('0xe'),_0x51c398,_0x3526ce[_0xe866('0x13')][_0xe866('0x15')]);return _0x5efa25(_0x3526ce[_0xe866('0x13')][_0xe866('0x15')]);}else{logger['info'](_0xe866('0xe'),_0x51c398,'request\x20sent');_0x5efa25(_0x3526ce[_0xe866('0x16')][_0xe866('0x15')]);}})[_0xe866('0x17')](function(_0x118ed9){logger[_0xe866('0x13')](_0xe866('0xe'),_0x51c398,_0x118ed9);_0x1b3cd8(_0x118ed9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4d20f9e..38bf907 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 _0x7edb=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x7edb,0x158));var _0xb7ed=function(_0x2f8d85,_0x5a0553){_0x2f8d85=_0x2f8d85-0x0;var _0x3b29b9=_0x7edb[_0x2f8d85];return _0x3b29b9;};'use strict';var multer=require('multer');var util=require(_0xb7ed('0x0'));var path=require(_0xb7ed('0x1'));var timeout=require(_0xb7ed('0x2'));var express=require(_0xb7ed('0x3'));var router=express[_0xb7ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb7ed('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb7ed('0x6'));router[_0xb7ed('0x7')]('/',auth[_0xb7ed('0x8')](),controller[_0xb7ed('0x9')]);router[_0xb7ed('0x7')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xb')]);router[_0xb7ed('0xc')]('/',auth[_0xb7ed('0x8')](),controller['create']);router[_0xb7ed('0xd')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller[_0xb7ed('0xe')]);router[_0xb7ed('0xf')](_0xb7ed('0xa'),auth[_0xb7ed('0x8')](),controller['destroy']);module[_0xb7ed('0x10')]=router; \ No newline at end of file +var _0xbfe8=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get'];(function(_0x243a39,_0x4c9b51){var _0x5620a2=function(_0x16a997){while(--_0x16a997){_0x243a39['push'](_0x243a39['shift']());}};_0x5620a2(++_0x4c9b51);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x588d47,_0x279098){_0x588d47=_0x588d47-0x0;var _0x323be5=_0xbfe8[_0x588d47];return _0x323be5;};'use strict';var multer=require('multer');var util=require(_0x8bfe('0x0'));var path=require('path');var timeout=require(_0x8bfe('0x1'));var express=require(_0x8bfe('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8bfe('0x3'));var interaction=require(_0x8bfe('0x4'));var config=require('../../config/environment');var controller=require(_0x8bfe('0x5'));router[_0x8bfe('0x6')]('/',auth[_0x8bfe('0x7')](),controller['index']);router[_0x8bfe('0x6')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0x9')]);router[_0x8bfe('0xa')]('/',auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xb')]);router[_0x8bfe('0xc')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xd')]);router[_0x8bfe('0xe')](_0x8bfe('0x8'),auth[_0x8bfe('0x7')](),controller[_0x8bfe('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e1606fb..2aa9d09 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 _0xf57f=['TEXT','exports'];(function(_0x308de6,_0x4fb93d){var _0x3f342d=function(_0x210a1f){while(--_0x210a1f){_0x308de6['push'](_0x308de6['shift']());}};_0x3f342d(++_0x4fb93d);}(_0xf57f,0x6f));var _0xff57=function(_0x480b14,_0x397259){_0x480b14=_0x480b14-0x0;var _0x271f62=_0xf57f[_0x480b14];return _0x271f62;};'use strict';var Sequelize=require('sequelize');module[_0xff57('0x0')]={'tree':{'type':Sequelize[_0xff57('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4e71=['exports','TEXT','sequelize'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x4e71,0xb0));var _0x14e7=function(_0x1faf3d,_0x44a065){_0x1faf3d=_0x1faf3d-0x0;var _0x470ace=_0x4e71[_0x1faf3d];return _0x470ace;};'use strict';var Sequelize=require(_0x14e7('0x0'));module[_0x14e7('0x1')]={'tree':{'type':Sequelize[_0x14e7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 93d1474..22e412f 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 _0xe5f8=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticTreeReport','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3c691c,_0x75c10a){var _0x5703a0=function(_0x4ffc4a){while(--_0x4ffc4a){_0x3c691c['push'](_0x3c691c['shift']());}};_0x5703a0(++_0x75c10a);}(_0xe5f8,0x16d));var _0x8e5f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe5f8[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x8e5f('0x0'));var rimraf=require(_0x8e5f('0x1'));var zipdir=require(_0x8e5f('0x2'));var jsonpatch=require(_0x8e5f('0x3'));var rp=require(_0x8e5f('0x4'));var moment=require('moment');var BPromise=require(_0x8e5f('0x5'));var Mustache=require(_0x8e5f('0x6'));var util=require(_0x8e5f('0x7'));var path=require(_0x8e5f('0x8'));var sox=require(_0x8e5f('0x9'));var csv=require(_0x8e5f('0xa'));var ejs=require(_0x8e5f('0xb'));var fs=require('fs');var fs_extra=require(_0x8e5f('0xc'));var _=require('lodash');var squel=require(_0x8e5f('0xd'));var crypto=require(_0x8e5f('0xe'));var jsforce=require(_0x8e5f('0xf'));var deskjs=require(_0x8e5f('0x10'));var toCsv=require(_0x8e5f('0xa'));var querystring=require(_0x8e5f('0x11'));var Papa=require(_0x8e5f('0x12'));var Redis=require(_0x8e5f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8e5f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e5f('0x15'));var logger=require('../../config/logger')(_0x8e5f('0x16'));var utils=require(_0x8e5f('0x17'));var config=require(_0x8e5f('0x18'));var licenseUtil=require(_0x8e5f('0x19'));var db=require(_0x8e5f('0x1a'))['db'];function respondWithStatusCode(_0x12ea0a,_0x312010){_0x312010=_0x312010||0xcc;return function(_0x5c1434){if(_0x5c1434){return _0x12ea0a[_0x8e5f('0x1b')](_0x312010);}return _0x12ea0a[_0x8e5f('0x1c')](_0x312010)[_0x8e5f('0x1d')]();};}function respondWithResult(_0x306fe1,_0x1e41b8){_0x1e41b8=_0x1e41b8||0xc8;return function(_0x14396a){if(_0x14396a){return _0x306fe1[_0x8e5f('0x1c')](_0x1e41b8)[_0x8e5f('0x1e')](_0x14396a);}};}function respondWithFilteredResult(_0x19bc96,_0x1681de){return function(_0xa29040){if(_0xa29040){var _0x5d4445=typeof _0x1681de[_0x8e5f('0x1f')]==='undefined'&&typeof _0x1681de[_0x8e5f('0x20')]==='undefined';var _0x43e49d=_0xa29040[_0x8e5f('0x21')];var _0x5cceab=_0x5d4445?0x0:_0x1681de['offset'];var _0x445570=_0x5d4445?_0xa29040['count']:_0x1681de[_0x8e5f('0x1f')]+_0x1681de['limit'];var _0x21442c;if(_0x445570>=_0x43e49d){_0x445570=_0x43e49d;_0x21442c=0xc8;}else{_0x21442c=0xce;}_0x19bc96[_0x8e5f('0x1c')](_0x21442c);return _0x19bc96[_0x8e5f('0x22')](_0x8e5f('0x23'),_0x5cceab+'-'+_0x445570+'/'+_0x43e49d)[_0x8e5f('0x1e')](_0xa29040);}return null;};}function patchUpdates(_0x23bec1){return function(_0x4c7abb){try{jsonpatch[_0x8e5f('0x24')](_0x4c7abb,_0x23bec1,!![]);}catch(_0xfb6710){return BPromise[_0x8e5f('0x25')](_0xfb6710);}return _0x4c7abb[_0x8e5f('0x26')]();};}function saveUpdates(_0xb8889d,_0x3e1fd9){return function(_0x3d393a){if(_0x3d393a){return _0x3d393a[_0x8e5f('0x27')](_0xb8889d)['then'](function(_0x181d89){return _0x181d89;});}return null;};}function removeEntity(_0x4ed26e,_0x5ecd6b){return function(_0x19163b){if(_0x19163b){return _0x19163b[_0x8e5f('0x28')]()[_0x8e5f('0x29')](function(){_0x4ed26e['status'](0xcc)[_0x8e5f('0x1d')]();});}};}function handleEntityNotFound(_0x44af01,_0x492689){return function(_0x22ba09){if(!_0x22ba09){_0x44af01[_0x8e5f('0x1b')](0x194);}return _0x22ba09;};}function handleError(_0x2d7a61,_0x4fed50){_0x4fed50=_0x4fed50||0x1f4;return function(_0x4e6183){logger[_0x8e5f('0x2a')](_0x4e6183[_0x8e5f('0x2b')]);if(_0x4e6183[_0x8e5f('0x2c')]){delete _0x4e6183[_0x8e5f('0x2c')];}_0x2d7a61['status'](_0x4fed50)[_0x8e5f('0x2d')](_0x4e6183);};}exports['index']=function(_0x4ff383,_0x15568f){var _0x2dda56={},_0x217d98={},_0x607f72={'count':0x0,'rows':[]};var _0x333f02=_[_0x8e5f('0x2e')](db['AnalyticTreeReport']['rawAttributes'],function(_0x40eac0){return{'name':_0x40eac0[_0x8e5f('0x2f')],'type':_0x40eac0[_0x8e5f('0x30')][_0x8e5f('0x31')]};});_0x217d98[_0x8e5f('0x32')]=_[_0x8e5f('0x2e')](_0x333f02,_0x8e5f('0x2c'));_0x217d98[_0x8e5f('0x33')]=_[_0x8e5f('0x34')](_0x4ff383['query']);_0x217d98[_0x8e5f('0x35')]=_[_0x8e5f('0x36')](_0x217d98[_0x8e5f('0x32')],_0x217d98[_0x8e5f('0x33')]);_0x2dda56[_0x8e5f('0x37')]=_[_0x8e5f('0x36')](_0x217d98[_0x8e5f('0x32')],qs['fields'](_0x4ff383[_0x8e5f('0x33')]['fields']));_0x2dda56['attributes']=_0x2dda56[_0x8e5f('0x37')][_0x8e5f('0x38')]?_0x2dda56['attributes']:_0x217d98[_0x8e5f('0x32')];if(!_0x4ff383[_0x8e5f('0x33')]['hasOwnProperty']('nolimit')){_0x2dda56[_0x8e5f('0x20')]=qs[_0x8e5f('0x20')](_0x4ff383[_0x8e5f('0x33')]['limit']);_0x2dda56[_0x8e5f('0x1f')]=qs['offset'](_0x4ff383[_0x8e5f('0x33')][_0x8e5f('0x1f')]);}_0x2dda56['order']=qs[_0x8e5f('0x39')](_0x4ff383['query'][_0x8e5f('0x39')]);_0x2dda56[_0x8e5f('0x3a')]=qs['filters'](_[_0x8e5f('0x3b')](_0x4ff383['query'],_0x217d98[_0x8e5f('0x35')]),_0x333f02);if(_0x4ff383[_0x8e5f('0x33')][_0x8e5f('0x3c')]){_0x2dda56[_0x8e5f('0x3a')]=_['merge'](_0x2dda56[_0x8e5f('0x3a')],{'$or':_[_0x8e5f('0x2e')](_0x333f02,function(_0x4227e1){if(_0x4227e1[_0x8e5f('0x30')]!==_0x8e5f('0x3d')){var _0x1b93b2={};_0x1b93b2[_0x4227e1[_0x8e5f('0x2c')]]={'$like':'%'+_0x4ff383['query'][_0x8e5f('0x3c')]+'%'};return _0x1b93b2;}})});}_0x2dda56=_[_0x8e5f('0x3e')]({},_0x2dda56,_0x4ff383[_0x8e5f('0x3f')]);var _0x2a7cc5={'where':_0x2dda56['where']};return db[_0x8e5f('0x40')][_0x8e5f('0x21')](_0x2a7cc5)[_0x8e5f('0x29')](function(_0x5c8eb3){_0x607f72[_0x8e5f('0x21')]=_0x5c8eb3;if(_0x4ff383[_0x8e5f('0x33')][_0x8e5f('0x41')]){_0x2dda56[_0x8e5f('0x42')]=[{'all':!![]}];}return db[_0x8e5f('0x40')][_0x8e5f('0x43')](_0x2dda56);})[_0x8e5f('0x29')](function(_0x481046){_0x607f72[_0x8e5f('0x44')]=_0x481046;return _0x607f72;})[_0x8e5f('0x29')](respondWithFilteredResult(_0x15568f,_0x2dda56))['catch'](handleError(_0x15568f,null));};exports[_0x8e5f('0x45')]=function(_0x1fdc37,_0x4add28){var _0x5aee96={'raw':!![],'where':{'id':_0x1fdc37[_0x8e5f('0x46')]['id']}},_0x219d7e={};_0x219d7e['model']=_[_0x8e5f('0x34')](db[_0x8e5f('0x40')][_0x8e5f('0x47')]);_0x219d7e['query']=_[_0x8e5f('0x34')](_0x1fdc37['query']);_0x219d7e[_0x8e5f('0x35')]=_['intersection'](_0x219d7e[_0x8e5f('0x32')],_0x219d7e[_0x8e5f('0x33')]);_0x5aee96[_0x8e5f('0x37')]=_['intersection'](_0x219d7e[_0x8e5f('0x32')],qs['fields'](_0x1fdc37[_0x8e5f('0x33')][_0x8e5f('0x48')]));_0x5aee96['attributes']=_0x5aee96['attributes'][_0x8e5f('0x38')]?_0x5aee96[_0x8e5f('0x37')]:_0x219d7e[_0x8e5f('0x32')];if(_0x1fdc37[_0x8e5f('0x33')][_0x8e5f('0x41')]){_0x5aee96[_0x8e5f('0x42')]=[{'all':!![]}];}_0x5aee96=_[_0x8e5f('0x3e')]({},_0x5aee96,_0x1fdc37[_0x8e5f('0x3f')]);return db[_0x8e5f('0x40')][_0x8e5f('0x49')](_0x5aee96)[_0x8e5f('0x29')](handleEntityNotFound(_0x4add28,null))[_0x8e5f('0x29')](respondWithResult(_0x4add28,null))['catch'](handleError(_0x4add28,null));};exports[_0x8e5f('0x4a')]=function(_0x1eca42,_0x8a468f){return db[_0x8e5f('0x40')][_0x8e5f('0x4a')](_0x1eca42[_0x8e5f('0x4b')],{})[_0x8e5f('0x29')](respondWithResult(_0x8a468f,0xc9))[_0x8e5f('0x4c')](handleError(_0x8a468f,null));};exports[_0x8e5f('0x27')]=function(_0x1edb85,_0x5586ff){if(_0x1edb85[_0x8e5f('0x4b')]['id']){delete _0x1edb85[_0x8e5f('0x4b')]['id'];}return db[_0x8e5f('0x40')][_0x8e5f('0x49')]({'where':{'id':_0x1edb85[_0x8e5f('0x46')]['id']}})[_0x8e5f('0x29')](handleEntityNotFound(_0x5586ff,null))[_0x8e5f('0x29')](saveUpdates(_0x1edb85[_0x8e5f('0x4b')],null))[_0x8e5f('0x29')](respondWithResult(_0x5586ff,null))[_0x8e5f('0x4c')](handleError(_0x5586ff,null));};exports[_0x8e5f('0x28')]=function(_0x473dae,_0x30b542){return db[_0x8e5f('0x40')][_0x8e5f('0x49')]({'where':{'id':_0x473dae[_0x8e5f('0x46')]['id']}})[_0x8e5f('0x29')](handleEntityNotFound(_0x30b542,null))['then'](removeEntity(_0x30b542,null))['catch'](handleError(_0x30b542,null));}; \ No newline at end of file +var _0xd228=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd228,0xcb));var _0x8d22=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xd228[_0x414655];return _0x237884;};'use strict';var emlformat=require(_0x8d22('0x0'));var rimraf=require(_0x8d22('0x1'));var zipdir=require(_0x8d22('0x2'));var jsonpatch=require(_0x8d22('0x3'));var rp=require(_0x8d22('0x4'));var moment=require(_0x8d22('0x5'));var BPromise=require(_0x8d22('0x6'));var Mustache=require('mustache');var util=require(_0x8d22('0x7'));var path=require(_0x8d22('0x8'));var sox=require('sox');var csv=require(_0x8d22('0x9'));var ejs=require(_0x8d22('0xa'));var fs=require('fs');var fs_extra=require(_0x8d22('0xb'));var _=require(_0x8d22('0xc'));var squel=require(_0x8d22('0xd'));var crypto=require('crypto');var jsforce=require(_0x8d22('0xe'));var deskjs=require(_0x8d22('0xf'));var toCsv=require(_0x8d22('0x9'));var querystring=require(_0x8d22('0x10'));var Papa=require(_0x8d22('0x11'));var Redis=require(_0x8d22('0x12'));var authService=require(_0x8d22('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d22('0x14'));var logger=require('../../config/logger')(_0x8d22('0x15'));var utils=require(_0x8d22('0x16'));var config=require(_0x8d22('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x382bf9,_0x5c7a2c){_0x5c7a2c=_0x5c7a2c||0xcc;return function(_0x44059e){if(_0x44059e){return _0x382bf9[_0x8d22('0x18')](_0x5c7a2c);}return _0x382bf9[_0x8d22('0x19')](_0x5c7a2c)[_0x8d22('0x1a')]();};}function respondWithResult(_0x264695,_0x4d1ccf){_0x4d1ccf=_0x4d1ccf||0xc8;return function(_0x529980){if(_0x529980){return _0x264695[_0x8d22('0x19')](_0x4d1ccf)[_0x8d22('0x1b')](_0x529980);}};}function respondWithFilteredResult(_0x2bbe58,_0x923b4d){return function(_0x607759){if(_0x607759){var _0x7f323f=typeof _0x923b4d[_0x8d22('0x1c')]===_0x8d22('0x1d')&&typeof _0x923b4d[_0x8d22('0x1e')]===_0x8d22('0x1d');var _0x505973=_0x607759[_0x8d22('0x1f')];var _0x4aade2=_0x7f323f?0x0:_0x923b4d[_0x8d22('0x1c')];var _0x1cfab6=_0x7f323f?_0x607759[_0x8d22('0x1f')]:_0x923b4d[_0x8d22('0x1c')]+_0x923b4d['limit'];var _0x4ab8ca;if(_0x1cfab6>=_0x505973){_0x1cfab6=_0x505973;_0x4ab8ca=0xc8;}else{_0x4ab8ca=0xce;}_0x2bbe58['status'](_0x4ab8ca);return _0x2bbe58['set'](_0x8d22('0x20'),_0x4aade2+'-'+_0x1cfab6+'/'+_0x505973)['json'](_0x607759);}return null;};}function patchUpdates(_0x18d962){return function(_0x5e0bc7){try{jsonpatch[_0x8d22('0x21')](_0x5e0bc7,_0x18d962,!![]);}catch(_0x2e3827){return BPromise['reject'](_0x2e3827);}return _0x5e0bc7[_0x8d22('0x22')]();};}function saveUpdates(_0x13fd60,_0x12f929){return function(_0x468908){if(_0x468908){return _0x468908[_0x8d22('0x23')](_0x13fd60)[_0x8d22('0x24')](function(_0x5b1830){return _0x5b1830;});}return null;};}function removeEntity(_0x415202,_0x3daf3a){return function(_0x561120){if(_0x561120){return _0x561120[_0x8d22('0x25')]()['then'](function(){_0x415202['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x358667,_0x4022a3){return function(_0x4f82ef){if(!_0x4f82ef){_0x358667[_0x8d22('0x18')](0x194);}return _0x4f82ef;};}function handleError(_0x5cf9c3,_0x329c8c){_0x329c8c=_0x329c8c||0x1f4;return function(_0x53ebe5){logger[_0x8d22('0x26')](_0x53ebe5['stack']);if(_0x53ebe5[_0x8d22('0x27')]){delete _0x53ebe5[_0x8d22('0x27')];}_0x5cf9c3[_0x8d22('0x19')](_0x329c8c)[_0x8d22('0x28')](_0x53ebe5);};}exports[_0x8d22('0x29')]=function(_0x380c41,_0x54cdaa){var _0x3ca29c={},_0x470f58={},_0x188ec0={'count':0x0,'rows':[]};var _0x5dcc3b=_[_0x8d22('0x2a')](db[_0x8d22('0x2b')][_0x8d22('0x2c')],function(_0x20c167){return{'name':_0x20c167[_0x8d22('0x2d')],'type':_0x20c167[_0x8d22('0x2e')][_0x8d22('0x2f')]};});_0x470f58[_0x8d22('0x30')]=_[_0x8d22('0x2a')](_0x5dcc3b,'name');_0x470f58[_0x8d22('0x31')]=_['keys'](_0x380c41['query']);_0x470f58[_0x8d22('0x32')]=_['intersection'](_0x470f58[_0x8d22('0x30')],_0x470f58[_0x8d22('0x31')]);_0x3ca29c[_0x8d22('0x33')]=_[_0x8d22('0x34')](_0x470f58[_0x8d22('0x30')],qs[_0x8d22('0x35')](_0x380c41[_0x8d22('0x31')][_0x8d22('0x35')]));_0x3ca29c['attributes']=_0x3ca29c[_0x8d22('0x33')][_0x8d22('0x36')]?_0x3ca29c[_0x8d22('0x33')]:_0x470f58[_0x8d22('0x30')];if(!_0x380c41[_0x8d22('0x31')][_0x8d22('0x37')](_0x8d22('0x38'))){_0x3ca29c[_0x8d22('0x1e')]=qs[_0x8d22('0x1e')](_0x380c41[_0x8d22('0x31')][_0x8d22('0x1e')]);_0x3ca29c[_0x8d22('0x1c')]=qs[_0x8d22('0x1c')](_0x380c41[_0x8d22('0x31')][_0x8d22('0x1c')]);}_0x3ca29c['order']=qs[_0x8d22('0x39')](_0x380c41[_0x8d22('0x31')][_0x8d22('0x39')]);_0x3ca29c['where']=qs[_0x8d22('0x32')](_[_0x8d22('0x3a')](_0x380c41[_0x8d22('0x31')],_0x470f58[_0x8d22('0x32')]),_0x5dcc3b);if(_0x380c41[_0x8d22('0x31')][_0x8d22('0x3b')]){_0x3ca29c['where']=_['merge'](_0x3ca29c[_0x8d22('0x3c')],{'$or':_[_0x8d22('0x2a')](_0x5dcc3b,function(_0x4b43d5){if(_0x4b43d5[_0x8d22('0x2e')]!==_0x8d22('0x3d')){var _0x1b2755={};_0x1b2755[_0x4b43d5[_0x8d22('0x27')]]={'$like':'%'+_0x380c41[_0x8d22('0x31')][_0x8d22('0x3b')]+'%'};return _0x1b2755;}})});}_0x3ca29c=_[_0x8d22('0x3e')]({},_0x3ca29c,_0x380c41[_0x8d22('0x3f')]);var _0x4bce6d={'where':_0x3ca29c[_0x8d22('0x3c')]};return db['AnalyticTreeReport'][_0x8d22('0x1f')](_0x4bce6d)[_0x8d22('0x24')](function(_0xfcd229){_0x188ec0['count']=_0xfcd229;if(_0x380c41[_0x8d22('0x31')]['includeAll']){_0x3ca29c[_0x8d22('0x40')]=[{'all':!![]}];}return db[_0x8d22('0x2b')][_0x8d22('0x41')](_0x3ca29c);})[_0x8d22('0x24')](function(_0x13a3af){_0x188ec0[_0x8d22('0x42')]=_0x13a3af;return _0x188ec0;})['then'](respondWithFilteredResult(_0x54cdaa,_0x3ca29c))[_0x8d22('0x43')](handleError(_0x54cdaa,null));};exports[_0x8d22('0x44')]=function(_0x353394,_0x82e3c9){var _0x1ed2cd={'raw':!![],'where':{'id':_0x353394[_0x8d22('0x45')]['id']}},_0x54411c={};_0x54411c['model']=_[_0x8d22('0x46')](db[_0x8d22('0x2b')][_0x8d22('0x2c')]);_0x54411c[_0x8d22('0x31')]=_['keys'](_0x353394['query']);_0x54411c['filters']=_[_0x8d22('0x34')](_0x54411c[_0x8d22('0x30')],_0x54411c['query']);_0x1ed2cd[_0x8d22('0x33')]=_['intersection'](_0x54411c['model'],qs[_0x8d22('0x35')](_0x353394[_0x8d22('0x31')][_0x8d22('0x35')]));_0x1ed2cd['attributes']=_0x1ed2cd['attributes'][_0x8d22('0x36')]?_0x1ed2cd['attributes']:_0x54411c['model'];if(_0x353394[_0x8d22('0x31')][_0x8d22('0x47')]){_0x1ed2cd[_0x8d22('0x40')]=[{'all':!![]}];}_0x1ed2cd=_['merge']({},_0x1ed2cd,_0x353394[_0x8d22('0x3f')]);return db[_0x8d22('0x2b')][_0x8d22('0x48')](_0x1ed2cd)[_0x8d22('0x24')](handleEntityNotFound(_0x82e3c9,null))['then'](respondWithResult(_0x82e3c9,null))[_0x8d22('0x43')](handleError(_0x82e3c9,null));};exports[_0x8d22('0x49')]=function(_0x460f79,_0x183b31){return db[_0x8d22('0x2b')][_0x8d22('0x49')](_0x460f79[_0x8d22('0x4a')],{})['then'](respondWithResult(_0x183b31,0xc9))[_0x8d22('0x43')](handleError(_0x183b31,null));};exports['update']=function(_0x356076,_0x41645a){if(_0x356076[_0x8d22('0x4a')]['id']){delete _0x356076[_0x8d22('0x4a')]['id'];}return db[_0x8d22('0x2b')]['find']({'where':{'id':_0x356076[_0x8d22('0x45')]['id']}})['then'](handleEntityNotFound(_0x41645a,null))[_0x8d22('0x24')](saveUpdates(_0x356076[_0x8d22('0x4a')],null))['then'](respondWithResult(_0x41645a,null))[_0x8d22('0x43')](handleError(_0x41645a,null));};exports[_0x8d22('0x25')]=function(_0x1f638c,_0x36dd2e){return db['AnalyticTreeReport'][_0x8d22('0x48')]({'where':{'id':_0x1f638c[_0x8d22('0x45')]['id']}})[_0x8d22('0x24')](handleEntityNotFound(_0x36dd2e,null))[_0x8d22('0x24')](removeEntity(_0x36dd2e,null))['catch'](handleError(_0x36dd2e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e12ec7b..a776636 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 _0x8c3d=['bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','../../config/logger','api','moment'];(function(_0x5c46b6,_0x574451){var _0x56e9e7=function(_0x522951){while(--_0x522951){_0x5c46b6['push'](_0x5c46b6['shift']());}};_0x56e9e7(++_0x574451);}(_0x8c3d,0x1c5));var _0xd8c3=function(_0x19258d,_0x5f2768){_0x19258d=_0x19258d-0x0;var _0x2239d7=_0x8c3d[_0x19258d];return _0x2239d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8c3('0x0'))(_0xd8c3('0x1'));var moment=require(_0xd8c3('0x2'));var BPromise=require(_0xd8c3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8c3('0x4'));var rimraf=require(_0xd8c3('0x5'));var config=require(_0xd8c3('0x6'));var attributes=require(_0xd8c3('0x7'));module[_0xd8c3('0x8')]=function(_0x3c1fbd,_0x557979){return _0x3c1fbd[_0xd8c3('0x9')](_0xd8c3('0xa'),attributes,{'tableName':_0xd8c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb20a=['analytics_report_trees','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','AnalyticTreeReport'];(function(_0x2ff4d1,_0x4bddc9){var _0x56b9fe=function(_0x2dcf35){while(--_0x2dcf35){_0x2ff4d1['push'](_0x2ff4d1['shift']());}};_0x56b9fe(++_0x4bddc9);}(_0xb20a,0x1ae));var _0xab20=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb20a[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xab20('0x0'));var util=require(_0xab20('0x1'));var logger=require(_0xab20('0x2'))(_0xab20('0x3'));var moment=require('moment');var BPromise=require(_0xab20('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab20('0x5'));var rimraf=require(_0xab20('0x6'));var config=require(_0xab20('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xab20('0x8')]=function(_0x464a1d,_0x418b04){return _0x464a1d['define'](_0xab20('0x9'),attributes,{'tableName':_0xab20('0xa'),'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 bb50d28..6c96aef 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2d618c,_0x3303ec){var _0x4abe49=function(_0x4420cb){while(--_0x4420cb){_0x2d618c['push'](_0x2d618c['shift']());}};_0x4abe49(++_0x3303ec);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _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(_0x27a205,_0x192b63){var _0x24d9e7=function(_0x48314b){while(--_0x48314b){_0x27a205['push'](_0x27a205['shift']());}};_0x24d9e7(++_0x192b63);}(_0x5f2f,0x73));var _0xf5f2=function(_0x245690,_0x3bf938){_0x245690=_0x245690-0x0;var _0x3fb9a4=_0x5f2f[_0x245690];return _0x3fb9a4;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 043e72b..ad383e8 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 _0xf427=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','update','destroy','exports','multer','path','connect-timeout'];(function(_0x3092c9,_0x5d52fd){var _0x16f875=function(_0x502ee0){while(--_0x502ee0){_0x3092c9['push'](_0x3092c9['shift']());}};_0x16f875(++_0x5d52fd);}(_0xf427,0xcf));var _0x7f42=function(_0x4492a7,_0x712a){_0x4492a7=_0x4492a7-0x0;var _0x19b29b=_0xf427[_0x4492a7];return _0x19b29b;};'use strict';var multer=require(_0x7f42('0x0'));var util=require('util');var path=require(_0x7f42('0x1'));var timeout=require(_0x7f42('0x2'));var express=require(_0x7f42('0x3'));var router=express[_0x7f42('0x4')]();var fs_extra=require(_0x7f42('0x5'));var auth=require(_0x7f42('0x6'));var interaction=require(_0x7f42('0x7'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x7f42('0x8')]('/',auth[_0x7f42('0x9')](),controller['index']);router[_0x7f42('0x8')](_0x7f42('0xa'),auth[_0x7f42('0x9')](),controller['show']);router[_0x7f42('0xb')]('/',auth[_0x7f42('0x9')](),controller['create']);router['put']('/:id',auth[_0x7f42('0x9')](),controller[_0x7f42('0xc')]);router['delete'](_0x7f42('0xa'),auth[_0x7f42('0x9')](),controller[_0x7f42('0xd')]);module[_0x7f42('0xe')]=router; \ No newline at end of file +var _0xe133=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete','destroy'];(function(_0x18c937,_0x32d230){var _0xc920b3=function(_0x3f8610){while(--_0x3f8610){_0x18c937['push'](_0x18c937['shift']());}};_0xc920b3(++_0x32d230);}(_0xe133,0x169));var _0x3e13=function(_0x2a34dc,_0x52869d){_0x2a34dc=_0x2a34dc-0x0;var _0x1f39b8=_0xe133[_0x2a34dc];return _0x1f39b8;};'use strict';var multer=require(_0x3e13('0x0'));var util=require(_0x3e13('0x1'));var path=require(_0x3e13('0x2'));var timeout=require(_0x3e13('0x3'));var express=require(_0x3e13('0x4'));var router=express[_0x3e13('0x5')]();var fs_extra=require(_0x3e13('0x6'));var auth=require(_0x3e13('0x7'));var interaction=require(_0x3e13('0x8'));var config=require(_0x3e13('0x9'));var controller=require('./analyticTreeReport.controller');router[_0x3e13('0xa')]('/',auth[_0x3e13('0xb')](),controller[_0x3e13('0xc')]);router['get'](_0x3e13('0xd'),auth[_0x3e13('0xb')](),controller[_0x3e13('0xe')]);router[_0x3e13('0xf')]('/',auth[_0x3e13('0xb')](),controller['create']);router['put'](_0x3e13('0xd'),auth[_0x3e13('0xb')](),controller[_0x3e13('0x10')]);router[_0x3e13('0x11')](_0x3e13('0xd'),auth[_0x3e13('0xb')](),controller[_0x3e13('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 3f7c888..6157956 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 _0x6e12=['STRING','sequelize','exports'];(function(_0x17aa2f,_0x33bb9e){var _0x47f365=function(_0x2c14f8){while(--_0x2c14f8){_0x17aa2f['push'](_0x17aa2f['shift']());}};_0x47f365(++_0x33bb9e);}(_0x6e12,0x154));var _0x26e1=function(_0x31cfb8,_0x48a724){_0x31cfb8=_0x31cfb8-0x0;var _0x7a14be=_0x6e12[_0x31cfb8];return _0x7a14be;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'name':{'type':Sequelize[_0x26e1('0x2')]},'basename':{'type':Sequelize[_0x26e1('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6631=['exports','STRING','sequelize'];(function(_0x5be4d5,_0x50c2cf){var _0x3c45ee=function(_0x245fdb){while(--_0x245fdb){_0x5be4d5['push'](_0x5be4d5['shift']());}};_0x3c45ee(++_0x50c2cf);}(_0x6631,0x134));var _0x1663=function(_0x3a290c,_0x5b4ef0){_0x3a290c=_0x3a290c-0x0;var _0x50227c=_0x6631[_0x3a290c];return _0x50227c;};'use strict';var Sequelize=require(_0x1663('0x0'));module[_0x1663('0x1')]={'name':{'type':Sequelize[_0x1663('0x2')]},'basename':{'type':Sequelize[_0x1663('0x2')]},'type':{'type':Sequelize[_0x1663('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 968e11f..1e2bf0b 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 _0xf7fd=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','json','reject','save','update','then','destroy','stack','name','index','map','Attachment','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','clone','params','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','findOne','ChatOfflineMessageId','join','root','download','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x5f52ed,_0x3c1bbc){var _0x1482ec=function(_0x488678){while(--_0x488678){_0x5f52ed['push'](_0x5f52ed['shift']());}};_0x1482ec(++_0x3c1bbc);}(_0xf7fd,0x152));var _0xdf7f=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xf7fd[_0x5d80de];return _0x1c7556;};'use strict';var emlformat=require(_0xdf7f('0x0'));var rimraf=require(_0xdf7f('0x1'));var zipdir=require(_0xdf7f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf7f('0x3'));var moment=require(_0xdf7f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf7f('0x5'));var path=require(_0xdf7f('0x6'));var sox=require(_0xdf7f('0x7'));var csv=require(_0xdf7f('0x8'));var ejs=require(_0xdf7f('0x9'));var fs=require('fs');var fs_extra=require(_0xdf7f('0xa'));var _=require(_0xdf7f('0xb'));var squel=require(_0xdf7f('0xc'));var crypto=require(_0xdf7f('0xd'));var jsforce=require(_0xdf7f('0xe'));var deskjs=require(_0xdf7f('0xf'));var toCsv=require(_0xdf7f('0x8'));var querystring=require('querystring');var Papa=require(_0xdf7f('0x10'));var Redis=require(_0xdf7f('0x11'));var authService=require(_0xdf7f('0x12'));var qs=require(_0xdf7f('0x13'));var as=require(_0xdf7f('0x14'));var hardwareService=require(_0xdf7f('0x15'));var logger=require('../../config/logger')(_0xdf7f('0x16'));var utils=require(_0xdf7f('0x17'));var config=require(_0xdf7f('0x18'));var licenseUtil=require(_0xdf7f('0x19'));var db=require(_0xdf7f('0x1a'))['db'];function respondWithStatusCode(_0x1af49d,_0x12fe88){_0x12fe88=_0x12fe88||0xcc;return function(_0x33d4a9){if(_0x33d4a9){return _0x1af49d[_0xdf7f('0x1b')](_0x12fe88);}return _0x1af49d[_0xdf7f('0x1c')](_0x12fe88)[_0xdf7f('0x1d')]();};}function respondWithResult(_0x4fd356,_0x28b609){_0x28b609=_0x28b609||0xc8;return function(_0x4cd549){if(_0x4cd549){return _0x4fd356[_0xdf7f('0x1c')](_0x28b609)['json'](_0x4cd549);}};}function respondWithFilteredResult(_0x2e91f1,_0x43e8f3){return function(_0x10e40f){if(_0x10e40f){var _0x39cd00=typeof _0x43e8f3['offset']===_0xdf7f('0x1e')&&typeof _0x43e8f3[_0xdf7f('0x1f')]==='undefined';var _0x54b57e=_0x10e40f['count'];var _0x334dbe=_0x39cd00?0x0:_0x43e8f3[_0xdf7f('0x20')];var _0x35c316=_0x39cd00?_0x10e40f['count']:_0x43e8f3[_0xdf7f('0x20')]+_0x43e8f3[_0xdf7f('0x1f')];var _0x2472d9;if(_0x35c316>=_0x54b57e){_0x35c316=_0x54b57e;_0x2472d9=0xc8;}else{_0x2472d9=0xce;}_0x2e91f1['status'](_0x2472d9);return _0x2e91f1[_0xdf7f('0x21')]('Content-Range',_0x334dbe+'-'+_0x35c316+'/'+_0x54b57e)[_0xdf7f('0x22')](_0x10e40f);}return null;};}function patchUpdates(_0x2d8f5e){return function(_0xe40150){try{jsonpatch['apply'](_0xe40150,_0x2d8f5e,!![]);}catch(_0x7e9d17){return BPromise[_0xdf7f('0x23')](_0x7e9d17);}return _0xe40150[_0xdf7f('0x24')]();};}function saveUpdates(_0x3686b3,_0x375606){return function(_0x285b06){if(_0x285b06){return _0x285b06[_0xdf7f('0x25')](_0x3686b3)[_0xdf7f('0x26')](function(_0x4a38d4){return _0x4a38d4;});}return null;};}function removeEntity(_0x2f967f,_0x1f2b99){return function(_0xc0d738){if(_0xc0d738){return _0xc0d738[_0xdf7f('0x27')]()['then'](function(){_0x2f967f[_0xdf7f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x376402,_0x194be4){return function(_0x3236e1){if(!_0x3236e1){_0x376402[_0xdf7f('0x1b')](0x194);}return _0x3236e1;};}function handleError(_0x3d4277,_0xef1856){_0xef1856=_0xef1856||0x1f4;return function(_0x3166f6){logger['error'](_0x3166f6[_0xdf7f('0x28')]);if(_0x3166f6[_0xdf7f('0x29')]){delete _0x3166f6[_0xdf7f('0x29')];}_0x3d4277['status'](_0xef1856)['send'](_0x3166f6);};}exports[_0xdf7f('0x2a')]=function(_0xac4c0e,_0x131d70){var _0x224ffa={},_0x2312a5={},_0x3cc9d={'count':0x0,'rows':[]};var _0x1e96a6=_[_0xdf7f('0x2b')](db[_0xdf7f('0x2c')]['rawAttributes'],function(_0x242730){return{'name':_0x242730['fieldName'],'type':_0x242730[_0xdf7f('0x2d')][_0xdf7f('0x2e')]};});_0x2312a5[_0xdf7f('0x2f')]=_['map'](_0x1e96a6,'name');_0x2312a5[_0xdf7f('0x30')]=_[_0xdf7f('0x31')](_0xac4c0e[_0xdf7f('0x30')]);_0x2312a5[_0xdf7f('0x32')]=_[_0xdf7f('0x33')](_0x2312a5[_0xdf7f('0x2f')],_0x2312a5[_0xdf7f('0x30')]);_0x224ffa[_0xdf7f('0x34')]=_[_0xdf7f('0x33')](_0x2312a5[_0xdf7f('0x2f')],qs[_0xdf7f('0x35')](_0xac4c0e['query'][_0xdf7f('0x35')]));_0x224ffa[_0xdf7f('0x34')]=_0x224ffa[_0xdf7f('0x34')][_0xdf7f('0x36')]?_0x224ffa['attributes']:_0x2312a5[_0xdf7f('0x2f')];if(!_0xac4c0e['query']['hasOwnProperty']('nolimit')){_0x224ffa[_0xdf7f('0x1f')]=qs[_0xdf7f('0x1f')](_0xac4c0e[_0xdf7f('0x30')][_0xdf7f('0x1f')]);_0x224ffa['offset']=qs['offset'](_0xac4c0e[_0xdf7f('0x30')][_0xdf7f('0x20')]);}_0x224ffa[_0xdf7f('0x37')]=qs[_0xdf7f('0x38')](_0xac4c0e['query'][_0xdf7f('0x38')]);_0x224ffa[_0xdf7f('0x39')]=qs['filters'](_['pick'](_0xac4c0e[_0xdf7f('0x30')],_0x2312a5[_0xdf7f('0x32')]),_0x1e96a6);if(_0xac4c0e[_0xdf7f('0x30')][_0xdf7f('0x3a')]){_0x224ffa[_0xdf7f('0x39')]=_[_0xdf7f('0x3b')](_0x224ffa[_0xdf7f('0x39')],{'$or':_[_0xdf7f('0x2b')](_0x1e96a6,function(_0x372523){if(_0x372523[_0xdf7f('0x2d')]!==_0xdf7f('0x3c')){var _0x29b982={};_0x29b982[_0x372523[_0xdf7f('0x29')]]={'$like':'%'+_0xac4c0e[_0xdf7f('0x30')]['filter']+'%'};return _0x29b982;}})});}_0x224ffa=_[_0xdf7f('0x3b')]({},_0x224ffa,_0xac4c0e[_0xdf7f('0x3d')]);var _0x2e1102={'where':_0x224ffa[_0xdf7f('0x39')]};return db[_0xdf7f('0x2c')]['count'](_0x2e1102)[_0xdf7f('0x26')](function(_0x2cf2d2){_0x3cc9d['count']=_0x2cf2d2;if(_0xac4c0e[_0xdf7f('0x30')]['includeAll']){_0x224ffa[_0xdf7f('0x3e')]=[{'all':!![]}];}return db[_0xdf7f('0x2c')][_0xdf7f('0x3f')](_0x224ffa);})['then'](function(_0xa8cb8e){_0x3cc9d[_0xdf7f('0x40')]=_0xa8cb8e;return _0x3cc9d;})[_0xdf7f('0x26')](respondWithFilteredResult(_0x131d70,_0x224ffa))[_0xdf7f('0x41')](handleError(_0x131d70,null));};exports[_0xdf7f('0x42')]=function(_0x4ef318,_0x4dcd2e){var _0x41c2f1={'raw':!![],'where':{'id':_0x4ef318['params']['id']}},_0x1675c5={};_0x1675c5[_0xdf7f('0x2f')]=_['keys'](db[_0xdf7f('0x2c')][_0xdf7f('0x43')]);_0x1675c5[_0xdf7f('0x30')]=_[_0xdf7f('0x31')](_0x4ef318['query']);_0x1675c5['filters']=_[_0xdf7f('0x33')](_0x1675c5[_0xdf7f('0x2f')],_0x1675c5[_0xdf7f('0x30')]);_0x41c2f1['attributes']=_[_0xdf7f('0x33')](_0x1675c5[_0xdf7f('0x2f')],qs[_0xdf7f('0x35')](_0x4ef318['query'][_0xdf7f('0x35')]));_0x41c2f1['attributes']=_0x41c2f1[_0xdf7f('0x34')]['length']?_0x41c2f1[_0xdf7f('0x34')]:_0x1675c5[_0xdf7f('0x2f')];if(_0x4ef318[_0xdf7f('0x30')][_0xdf7f('0x44')]){_0x41c2f1[_0xdf7f('0x3e')]=[{'all':!![]}];}_0x41c2f1=_[_0xdf7f('0x3b')]({},_0x41c2f1,_0x4ef318[_0xdf7f('0x3d')]);return db[_0xdf7f('0x2c')]['find'](_0x41c2f1)['then'](handleEntityNotFound(_0x4dcd2e,null))[_0xdf7f('0x26')](respondWithResult(_0x4dcd2e,null))[_0xdf7f('0x41')](handleError(_0x4dcd2e,null));};exports[_0xdf7f('0x45')]=function(_0x504138,_0x45e1fc){var _0x34dff6={'where':{'id':_0x504138[_0xdf7f('0x46')]['id']}},_0x997955={};_0x997955[_0xdf7f('0x2f')]=_[_0xdf7f('0x31')](db[_0xdf7f('0x2c')][_0xdf7f('0x43')]);_0x34dff6[_0xdf7f('0x34')]=_[_0xdf7f('0x33')](_0x997955['model'],qs[_0xdf7f('0x35')](_0x504138[_0xdf7f('0x30')][_0xdf7f('0x35')]));_0x34dff6[_0xdf7f('0x34')]=_0x34dff6[_0xdf7f('0x34')][_0xdf7f('0x36')]?_0x34dff6[_0xdf7f('0x34')]:_0x997955['model'];if(_0x504138[_0xdf7f('0x30')][_0xdf7f('0x44')]){_0x34dff6[_0xdf7f('0x3e')]=[{'all':!![]}];}_0x34dff6=_[_0xdf7f('0x3b')]({},_0x34dff6,_0x504138[_0xdf7f('0x3d')]);return db[_0xdf7f('0x2c')][_0xdf7f('0x47')](_0x34dff6)['then'](handleEntityNotFound(_0x45e1fc,null))[_0xdf7f('0x26')](function(_0x874f03){if(_0x874f03){var _0x23de69=_0x874f03[_0xdf7f('0x48')]({'plain':!![]});_0x23de69=qs[_0xdf7f('0x49')](_0x23de69,['id',_0xdf7f('0x4a'),_0xdf7f('0x4b')]);_0x504138[_0xdf7f('0x4c')]=_['omit'](_0x504138[_0xdf7f('0x4c')],['id',_0xdf7f('0x4a'),'updatedAt']);return db[_0xdf7f('0x2c')][_0xdf7f('0x4d')](_['merge'](_0x23de69,_0x504138[_0xdf7f('0x4c')]),{'include':_0x504138[_0xdf7f('0x30')][_0xdf7f('0x44')]?[{'all':!![]}]:undefined});}})[_0xdf7f('0x26')](respondWithResult(_0x45e1fc,0xc9))[_0xdf7f('0x41')](handleError(_0x45e1fc,null));};exports[_0xdf7f('0x25')]=function(_0x14db2b,_0x2829c0){if(_0x14db2b[_0xdf7f('0x4c')]['id']){delete _0x14db2b[_0xdf7f('0x4c')]['id'];}return db['Attachment'][_0xdf7f('0x47')]({'where':{'id':_0x14db2b[_0xdf7f('0x46')]['id']}})[_0xdf7f('0x26')](handleEntityNotFound(_0x2829c0,null))[_0xdf7f('0x26')](saveUpdates(_0x14db2b[_0xdf7f('0x4c')],null))['then'](respondWithResult(_0x2829c0,null))['catch'](handleError(_0x2829c0,null));};exports[_0xdf7f('0x27')]=function(_0x3e4910,_0xb5bb23){return db[_0xdf7f('0x2c')][_0xdf7f('0x47')]({'where':{'id':_0x3e4910['params']['id']}})[_0xdf7f('0x26')](handleEntityNotFound(_0xb5bb23,null))['then'](removeEntity(_0xb5bb23,null))[_0xdf7f('0x41')](handleError(_0xb5bb23,null));};exports[_0xdf7f('0x4d')]=function(_0x5658cb,_0x47e005,_0x27fdb9){_0x5658cb[_0xdf7f('0x4c')][_0xdf7f('0x29')]=_0x5658cb[_0xdf7f('0x4e')][_0xdf7f('0x4f')];_0x5658cb['body'][_0xdf7f('0x50')]=_0x5658cb['file']['filename'];_0x5658cb[_0xdf7f('0x4c')][_0xdf7f('0x2d')]=_0x5658cb[_0xdf7f('0x4e')][_0xdf7f('0x51')];return db[_0xdf7f('0x2c')][_0xdf7f('0x4d')](_0x5658cb[_0xdf7f('0x4c')])[_0xdf7f('0x26')](respondWithResult(_0x47e005,0xc9))['catch'](handleError(_0x47e005,null));};exports['download']=function(_0x311098,_0x3c5512,_0x15611a){return db['Attachment'][_0xdf7f('0x52')]({'where':{'id':_0x311098[_0xdf7f('0x46')]['id']},'raw':!![]})[_0xdf7f('0x26')](handleEntityNotFound(_0x3c5512,null))['then'](function(_0x538df9){if(_0x538df9){var _0x2d5f51=_0x538df9[_0xdf7f('0x53')]!==null;var _0x588d6c=path[_0xdf7f('0x54')](config[_0xdf7f('0x55')],'server/files/attachments/');if(_0x2d5f51){_0x588d6c=path[_0xdf7f('0x54')](_0x588d6c,'offline-chat/');}var _0x11c41e=path[_0xdf7f('0x54')](_0x588d6c,_0x538df9['basename']);return _0x3c5512[_0xdf7f('0x56')](_0x11c41e);}})[_0xdf7f('0x41')](handleError(_0x3c5512,null));}; \ No newline at end of file +var _0xc49e=['set','apply','reject','then','destroy','end','error','stack','name','send','map','Attachment','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','omit','createdAt','body','updatedAt','create','catch','update','originalname','basename','file','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count'];(function(_0x3d13bb,_0x262a54){var _0x4b5a1b=function(_0x53417e){while(--_0x53417e){_0x3d13bb['push'](_0x3d13bb['shift']());}};_0x4b5a1b(++_0x262a54);}(_0xc49e,0x91));var _0xec49=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc49e[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0xec49('0x0'));var rimraf=require(_0xec49('0x1'));var zipdir=require(_0xec49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec49('0x3'));var moment=require(_0xec49('0x4'));var BPromise=require(_0xec49('0x5'));var Mustache=require(_0xec49('0x6'));var util=require(_0xec49('0x7'));var path=require(_0xec49('0x8'));var sox=require(_0xec49('0x9'));var csv=require(_0xec49('0xa'));var ejs=require(_0xec49('0xb'));var fs=require('fs');var fs_extra=require(_0xec49('0xc'));var _=require('lodash');var squel=require(_0xec49('0xd'));var crypto=require(_0xec49('0xe'));var jsforce=require(_0xec49('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xec49('0x10'));var Papa=require(_0xec49('0x11'));var Redis=require('ioredis');var authService=require(_0xec49('0x12'));var qs=require(_0xec49('0x13'));var as=require(_0xec49('0x14'));var hardwareService=require(_0xec49('0x15'));var logger=require(_0xec49('0x16'))('api');var utils=require(_0xec49('0x17'));var config=require(_0xec49('0x18'));var licenseUtil=require(_0xec49('0x19'));var db=require(_0xec49('0x1a'))['db'];function respondWithStatusCode(_0x557d43,_0x1e4adb){_0x1e4adb=_0x1e4adb||0xcc;return function(_0x4d6477){if(_0x4d6477){return _0x557d43[_0xec49('0x1b')](_0x1e4adb);}return _0x557d43[_0xec49('0x1c')](_0x1e4adb)['end']();};}function respondWithResult(_0xe5d5b3,_0x4e61bc){_0x4e61bc=_0x4e61bc||0xc8;return function(_0x131633){if(_0x131633){return _0xe5d5b3['status'](_0x4e61bc)[_0xec49('0x1d')](_0x131633);}};}function respondWithFilteredResult(_0x89934f,_0x5166ea){return function(_0x589721){if(_0x589721){var _0xec5bc4=typeof _0x5166ea[_0xec49('0x1e')]==='undefined'&&typeof _0x5166ea[_0xec49('0x1f')]==='undefined';var _0x3eb5a6=_0x589721[_0xec49('0x20')];var _0xebd96a=_0xec5bc4?0x0:_0x5166ea[_0xec49('0x1e')];var _0x1f8d0b=_0xec5bc4?_0x589721[_0xec49('0x20')]:_0x5166ea[_0xec49('0x1e')]+_0x5166ea[_0xec49('0x1f')];var _0x47dac3;if(_0x1f8d0b>=_0x3eb5a6){_0x1f8d0b=_0x3eb5a6;_0x47dac3=0xc8;}else{_0x47dac3=0xce;}_0x89934f['status'](_0x47dac3);return _0x89934f[_0xec49('0x21')]('Content-Range',_0xebd96a+'-'+_0x1f8d0b+'/'+_0x3eb5a6)[_0xec49('0x1d')](_0x589721);}return null;};}function patchUpdates(_0x46fa76){return function(_0x48420e){try{jsonpatch[_0xec49('0x22')](_0x48420e,_0x46fa76,!![]);}catch(_0x30ae5a){return BPromise[_0xec49('0x23')](_0x30ae5a);}return _0x48420e['save']();};}function saveUpdates(_0x70a2f1,_0x4cbcd1){return function(_0x56cea8){if(_0x56cea8){return _0x56cea8['update'](_0x70a2f1)[_0xec49('0x24')](function(_0x3f128b){return _0x3f128b;});}return null;};}function removeEntity(_0x235b3f,_0x19f682){return function(_0x59fb2e){if(_0x59fb2e){return _0x59fb2e[_0xec49('0x25')]()['then'](function(){_0x235b3f['status'](0xcc)[_0xec49('0x26')]();});}};}function handleEntityNotFound(_0x1b9f00,_0x2f96b2){return function(_0x4ac8ec){if(!_0x4ac8ec){_0x1b9f00[_0xec49('0x1b')](0x194);}return _0x4ac8ec;};}function handleError(_0x554148,_0x5f4303){_0x5f4303=_0x5f4303||0x1f4;return function(_0x319ce5){logger[_0xec49('0x27')](_0x319ce5[_0xec49('0x28')]);if(_0x319ce5[_0xec49('0x29')]){delete _0x319ce5[_0xec49('0x29')];}_0x554148[_0xec49('0x1c')](_0x5f4303)[_0xec49('0x2a')](_0x319ce5);};}exports['index']=function(_0x294281,_0x5b1023){var _0x3761f2={},_0x2eba19={},_0x400d7e={'count':0x0,'rows':[]};var _0x10a1fe=_[_0xec49('0x2b')](db[_0xec49('0x2c')][_0xec49('0x2d')],function(_0x224595){return{'name':_0x224595['fieldName'],'type':_0x224595[_0xec49('0x2e')][_0xec49('0x2f')]};});_0x2eba19[_0xec49('0x30')]=_[_0xec49('0x2b')](_0x10a1fe,'name');_0x2eba19['query']=_[_0xec49('0x31')](_0x294281[_0xec49('0x32')]);_0x2eba19[_0xec49('0x33')]=_[_0xec49('0x34')](_0x2eba19[_0xec49('0x30')],_0x2eba19['query']);_0x3761f2[_0xec49('0x35')]=_[_0xec49('0x34')](_0x2eba19[_0xec49('0x30')],qs[_0xec49('0x36')](_0x294281[_0xec49('0x32')]['fields']));_0x3761f2[_0xec49('0x35')]=_0x3761f2['attributes'][_0xec49('0x37')]?_0x3761f2['attributes']:_0x2eba19[_0xec49('0x30')];if(!_0x294281[_0xec49('0x32')][_0xec49('0x38')](_0xec49('0x39'))){_0x3761f2[_0xec49('0x1f')]=qs[_0xec49('0x1f')](_0x294281[_0xec49('0x32')]['limit']);_0x3761f2[_0xec49('0x1e')]=qs[_0xec49('0x1e')](_0x294281[_0xec49('0x32')][_0xec49('0x1e')]);}_0x3761f2[_0xec49('0x3a')]=qs['sort'](_0x294281[_0xec49('0x32')][_0xec49('0x3b')]);_0x3761f2['where']=qs[_0xec49('0x33')](_[_0xec49('0x3c')](_0x294281[_0xec49('0x32')],_0x2eba19[_0xec49('0x33')]),_0x10a1fe);if(_0x294281[_0xec49('0x32')][_0xec49('0x3d')]){_0x3761f2[_0xec49('0x3e')]=_[_0xec49('0x3f')](_0x3761f2[_0xec49('0x3e')],{'$or':_[_0xec49('0x2b')](_0x10a1fe,function(_0x4f5209){if(_0x4f5209['type']!==_0xec49('0x40')){var _0x519bd3={};_0x519bd3[_0x4f5209[_0xec49('0x29')]]={'$like':'%'+_0x294281[_0xec49('0x32')][_0xec49('0x3d')]+'%'};return _0x519bd3;}})});}_0x3761f2=_[_0xec49('0x3f')]({},_0x3761f2,_0x294281[_0xec49('0x41')]);var _0x21f47f={'where':_0x3761f2[_0xec49('0x3e')]};return db[_0xec49('0x2c')][_0xec49('0x20')](_0x21f47f)['then'](function(_0x35dea1){_0x400d7e[_0xec49('0x20')]=_0x35dea1;if(_0x294281[_0xec49('0x32')]['includeAll']){_0x3761f2[_0xec49('0x42')]=[{'all':!![]}];}return db[_0xec49('0x2c')][_0xec49('0x43')](_0x3761f2);})[_0xec49('0x24')](function(_0x2e60e2){_0x400d7e['rows']=_0x2e60e2;return _0x400d7e;})[_0xec49('0x24')](respondWithFilteredResult(_0x5b1023,_0x3761f2))['catch'](handleError(_0x5b1023,null));};exports[_0xec49('0x44')]=function(_0x582d97,_0x50ea14){var _0x50a614={'raw':!![],'where':{'id':_0x582d97[_0xec49('0x45')]['id']}},_0x3c6ea6={};_0x3c6ea6[_0xec49('0x30')]=_['keys'](db[_0xec49('0x2c')]['rawAttributes']);_0x3c6ea6[_0xec49('0x32')]=_[_0xec49('0x31')](_0x582d97[_0xec49('0x32')]);_0x3c6ea6[_0xec49('0x33')]=_[_0xec49('0x34')](_0x3c6ea6[_0xec49('0x30')],_0x3c6ea6[_0xec49('0x32')]);_0x50a614[_0xec49('0x35')]=_[_0xec49('0x34')](_0x3c6ea6[_0xec49('0x30')],qs[_0xec49('0x36')](_0x582d97['query']['fields']));_0x50a614[_0xec49('0x35')]=_0x50a614[_0xec49('0x35')][_0xec49('0x37')]?_0x50a614['attributes']:_0x3c6ea6[_0xec49('0x30')];if(_0x582d97[_0xec49('0x32')][_0xec49('0x46')]){_0x50a614[_0xec49('0x42')]=[{'all':!![]}];}_0x50a614=_['merge']({},_0x50a614,_0x582d97['options']);return db['Attachment']['find'](_0x50a614)[_0xec49('0x24')](handleEntityNotFound(_0x50ea14,null))[_0xec49('0x24')](respondWithResult(_0x50ea14,null))['catch'](handleError(_0x50ea14,null));};exports['clone']=function(_0x32a432,_0x71d92f){var _0x340a3b={'where':{'id':_0x32a432['params']['id']}},_0x92ebad={};_0x92ebad[_0xec49('0x30')]=_['keys'](db[_0xec49('0x2c')][_0xec49('0x2d')]);_0x340a3b[_0xec49('0x35')]=_[_0xec49('0x34')](_0x92ebad[_0xec49('0x30')],qs[_0xec49('0x36')](_0x32a432[_0xec49('0x32')][_0xec49('0x36')]));_0x340a3b[_0xec49('0x35')]=_0x340a3b[_0xec49('0x35')]['length']?_0x340a3b[_0xec49('0x35')]:_0x92ebad[_0xec49('0x30')];if(_0x32a432[_0xec49('0x32')][_0xec49('0x46')]){_0x340a3b['include']=[{'all':!![]}];}_0x340a3b=_[_0xec49('0x3f')]({},_0x340a3b,_0x32a432[_0xec49('0x41')]);return db['Attachment'][_0xec49('0x47')](_0x340a3b)[_0xec49('0x24')](handleEntityNotFound(_0x71d92f,null))[_0xec49('0x24')](function(_0x52625c){if(_0x52625c){var _0x1cdc57=_0x52625c['get']({'plain':!![]});_0x1cdc57=qs[_0xec49('0x48')](_0x1cdc57,['id',_0xec49('0x49'),'updatedAt']);_0x32a432['body']=_[_0xec49('0x48')](_0x32a432[_0xec49('0x4a')],['id',_0xec49('0x49'),_0xec49('0x4b')]);return db[_0xec49('0x2c')][_0xec49('0x4c')](_[_0xec49('0x3f')](_0x1cdc57,_0x32a432[_0xec49('0x4a')]),{'include':_0x32a432[_0xec49('0x32')][_0xec49('0x46')]?[{'all':!![]}]:undefined});}})[_0xec49('0x24')](respondWithResult(_0x71d92f,0xc9))[_0xec49('0x4d')](handleError(_0x71d92f,null));};exports[_0xec49('0x4e')]=function(_0x2669dd,_0x7820){if(_0x2669dd[_0xec49('0x4a')]['id']){delete _0x2669dd[_0xec49('0x4a')]['id'];}return db['Attachment'][_0xec49('0x47')]({'where':{'id':_0x2669dd['params']['id']}})['then'](handleEntityNotFound(_0x7820,null))['then'](saveUpdates(_0x2669dd['body'],null))['then'](respondWithResult(_0x7820,null))[_0xec49('0x4d')](handleError(_0x7820,null));};exports[_0xec49('0x25')]=function(_0x4747ba,_0xeff4af){return db[_0xec49('0x2c')]['find']({'where':{'id':_0x4747ba[_0xec49('0x45')]['id']}})[_0xec49('0x24')](handleEntityNotFound(_0xeff4af,null))['then'](removeEntity(_0xeff4af,null))[_0xec49('0x4d')](handleError(_0xeff4af,null));};exports[_0xec49('0x4c')]=function(_0x52009a,_0x1cbdef,_0x3b1c41){_0x52009a['body'][_0xec49('0x29')]=_0x52009a['file'][_0xec49('0x4f')];_0x52009a[_0xec49('0x4a')][_0xec49('0x50')]=_0x52009a[_0xec49('0x51')][_0xec49('0x52')];_0x52009a[_0xec49('0x4a')][_0xec49('0x2e')]=_0x52009a['file'][_0xec49('0x53')];return db[_0xec49('0x2c')][_0xec49('0x4c')](_0x52009a[_0xec49('0x4a')])['then'](respondWithResult(_0x1cbdef,0xc9))[_0xec49('0x4d')](handleError(_0x1cbdef,null));};exports['download']=function(_0x2417a7,_0x306cbc,_0x469566){return db[_0xec49('0x2c')][_0xec49('0x54')]({'where':{'id':_0x2417a7['params']['id']},'raw':!![]})[_0xec49('0x24')](handleEntityNotFound(_0x306cbc,null))['then'](function(_0x7b262a){if(_0x7b262a){var _0x2f7eaf=_0x7b262a[_0xec49('0x55')]!==null;var _0xaede3f=path[_0xec49('0x56')](config[_0xec49('0x57')],_0xec49('0x58'));if(_0x2f7eaf){_0xaede3f=path[_0xec49('0x56')](_0xaede3f,'offline-chat/');}var _0x16bf0f=path[_0xec49('0x56')](_0xaede3f,_0x7b262a[_0xec49('0x50')]);return _0x306cbc['download'](_0x16bf0f);}})[_0xec49('0x4d')](handleError(_0x306cbc,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d22de94..aeefae2 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 _0x3f54=['api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x3f54,0xcf));var _0x43f5=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x3f54[_0x3239f5];return _0x3559c8;};'use strict';var _=require(_0x43f5('0x0'));var util=require(_0x43f5('0x1'));var logger=require(_0x43f5('0x2'))(_0x43f5('0x3'));var moment=require(_0x43f5('0x4'));var BPromise=require(_0x43f5('0x5'));var rp=require(_0x43f5('0x6'));var fs=require('fs');var path=require(_0x43f5('0x7'));var rimraf=require(_0x43f5('0x8'));var config=require('../../config/environment');var attributes=require(_0x43f5('0x9'));module[_0x43f5('0xa')]=function(_0x2aa454,_0x264271){return _0x2aa454[_0x43f5('0xb')](_0x43f5('0xc'),attributes,{'tableName':_0x43f5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd50c=['exports','attachments','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes'];(function(_0x1c852c,_0x1f4588){var _0x5ae3a6=function(_0xcce4aa){while(--_0xcce4aa){_0x1c852c['push'](_0x1c852c['shift']());}};_0x5ae3a6(++_0x1f4588);}(_0xd50c,0x12b));var _0xcd50=function(_0xb974a6,_0x3dfaac){_0xb974a6=_0xb974a6-0x0;var _0x51b1ba=_0xd50c[_0xb974a6];return _0x51b1ba;};'use strict';var _=require('lodash');var util=require(_0xcd50('0x0'));var logger=require(_0xcd50('0x1'))(_0xcd50('0x2'));var moment=require(_0xcd50('0x3'));var BPromise=require(_0xcd50('0x4'));var rp=require(_0xcd50('0x5'));var fs=require('fs');var path=require(_0xcd50('0x6'));var rimraf=require('rimraf');var config=require(_0xcd50('0x7'));var attributes=require(_0xcd50('0x8'));module[_0xcd50('0x9')]=function(_0x1b4164,_0x309768){return _0x1b4164['define']('Attachment',attributes,{'tableName':_0xcd50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 653a098..ee3e633 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 _0xaf1d=['jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Attachment','create','body','raw','CreateAttachment','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x500b7b,_0x4b0c94){var _0x34ae81=function(_0x204724){while(--_0x204724){_0x500b7b['push'](_0x500b7b['shift']());}};_0x34ae81(++_0x4b0c94);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x4136c5,_0x441721){_0x4136c5=_0x4136c5-0x0;var _0x262f10=_0xaf1d[_0x4136c5];return _0x262f10;};'use strict';var _=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var moment=require(_0xdaf1('0x2'));var BPromise=require(_0xdaf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaf1('0x4'));var db=require(_0xdaf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaf1('0x6'))(_0xdaf1('0x7'));var config=require(_0xdaf1('0x8'));var jayson=require(_0xdaf1('0x9'));var client=jayson[_0xdaf1('0xa')][_0xdaf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6c50,_0x54dc7a,_0x5ed9cd){return new BPromise(function(_0xfb18fc,_0x51a7e9){return client['request'](_0x4d6c50,_0x5ed9cd)[_0xdaf1('0xc')](function(_0x3219da){logger[_0xdaf1('0xd')](_0xdaf1('0xe'),_0x54dc7a,'request\x20sent');logger[_0xdaf1('0xf')](_0xdaf1('0x10'),_0x54dc7a,_0xdaf1('0x11'),JSON[_0xdaf1('0x12')](_0x3219da));if(_0x3219da[_0xdaf1('0x13')]){if(_0x3219da['error'][_0xdaf1('0x14')]===0x1f4){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0x51a7e9(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0xfb18fc(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}else{logger['info'](_0xdaf1('0xe'),_0x54dc7a,_0xdaf1('0x11'));_0xfb18fc(_0x3219da['result'][_0xdaf1('0x15')]);}})['catch'](function(_0x39d34b){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x39d34b);_0x51a7e9(_0x39d34b);});});}exports['CreateAttachment']=function(_0x1dd985){var _0x5a9101=this;return new Promise(function(_0x4896c1,_0x921cd7){return db[_0xdaf1('0x16')][_0xdaf1('0x17')](_0x1dd985[_0xdaf1('0x18')],{'raw':_0x1dd985['options']?_0x1dd985['options'][_0xdaf1('0x19')]===undefined?!![]:![]:!![]})[_0xdaf1('0xc')](function(_0x37b377){logger['info'](_0xdaf1('0x1a'),_0x1dd985);logger[_0xdaf1('0xf')](_0xdaf1('0x1a'),_0x1dd985,JSON[_0xdaf1('0x12')](_0x37b377));_0x4896c1(_0x37b377);})[_0xdaf1('0x1b')](function(_0x110e33){logger[_0xdaf1('0x13')](_0xdaf1('0x1a'),_0x110e33[_0xdaf1('0x15')],_0x1dd985);_0x921cd7(_0x5a9101[_0xdaf1('0x13')](0x1f4,_0x110e33['message']));});});}; \ No newline at end of file +var _0x9567=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateAttachment','create','options','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x563a35,_0x11a0ab){var _0xe1d983=function(_0x5d7be7){while(--_0x5d7be7){_0x563a35['push'](_0x563a35['shift']());}};_0xe1d983(++_0x11a0ab);}(_0x9567,0xdc));var _0x7956=function(_0x5aba20,_0x2020ae){_0x5aba20=_0x5aba20-0x0;var _0x5d0e7d=_0x9567[_0x5aba20];return _0x5d0e7d;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('Attachment,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});}exports[_0x7956('0x15')]=function(_0x5e6b90){var _0x5c3afb=this;return new Promise(function(_0x10b29c,_0x811122){return db['Attachment'][_0x7956('0x16')](_0x5e6b90['body'],{'raw':_0x5e6b90[_0x7956('0x17')]?_0x5e6b90[_0x7956('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7956('0xa')](function(_0x2e31cd){logger[_0x7956('0xb')]('CreateAttachment',_0x5e6b90);logger[_0x7956('0xd')]('CreateAttachment',_0x5e6b90,JSON[_0x7956('0x18')](_0x2e31cd));_0x10b29c(_0x2e31cd);})['catch'](function(_0x427500){logger[_0x7956('0x10')](_0x7956('0x15'),_0x427500[_0x7956('0x12')],_0x5e6b90);_0x811122(_0x5c3afb['error'](0x1f4,_0x427500[_0x7956('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6007da9..a8fa909 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0b0e,0x187));var _0xe0b0=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x0b0e[_0x479509];return _0x382da8;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x0b0e[_0x420b24];return _0x4da552;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index fb2ea92..7a00e41 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 _0xf4e6=['salt','disabled','blockedAt','online','admin','user','blocked','add','minutes','clearBlockUser','getLicense','catch','status','send','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','use','ad-login','User','passport','passport-local','moment','activedirectory2','util','../../config/utils','api','activedirectory','undefined','baseDN','url','domain','authenticate','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','Setting','adSsoEnabled','blockDuration','then','findOne','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4e6,0x9d));var _0x6f4e=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0xf4e6[_0x450689];return _0x46ffb0;};'use strict';var passport=require(_0x6f4e('0x0'));var LocalStrategy=require(_0x6f4e('0x1'))['Strategy'];var moment=require(_0x6f4e('0x2'));var ActiveDirectory=require(_0x6f4e('0x3'));var BPromise=require('bluebird');var util=require(_0x6f4e('0x4'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x6f4e('0x5'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6f4e('0x6'));function isActiveDirectoryConfigured(_0x338589){var _0x104d6b=![];if(typeof _0x338589[_0x6f4e('0x7')]!==_0x6f4e('0x8')){_0x104d6b=_0x338589[_0x6f4e('0x7')][_0x6f4e('0x9')]&&_0x338589[_0x6f4e('0x7')][_0x6f4e('0xa')]&&_0x338589[_0x6f4e('0x7')][_0x6f4e('0xb')];}return _0x104d6b;}function adAuthenticate(_0x2eb8e6,_0x48d123,_0x56a7a5){return new BPromise(function(_0x48ccd7,_0x3b547f){try{var _0x2acf25=new ActiveDirectory(_0x2eb8e6);_0x2acf25[_0x6f4e('0xc')](_0x48d123,_0x56a7a5,function(_0x5419bb,_0x5d76d3){if(_0x5419bb){logger['error'](_0x6f4e('0xd'),_0x48d123,util['inspect'](_0x5419bb,{'showHidden':![],'depth':null}));_0x3b547f(_0x6f4e('0xe'));}else if(!_0x5d76d3){logger['error'](_0x6f4e('0xf'),_0x48d123);_0x3b547f(_0x6f4e('0xe'));}else{_0x48ccd7(_0x5d76d3);}});}catch(_0x5de9ff){_0x3b547f(_0x5de9ff);}});}function ActiveDirectoryAuthenticate(_0x9b8466,_0x10ce24,_0x3f16f5,_0x12175c){var _0x2da3f8,_0x17bb36;if(!isActiveDirectoryConfigured(config)){logger[_0x6f4e('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x10ce24);return _0x12175c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x6f4e('0x11')]['findOne']({'where':{'id':0x1},'attributes':[_0x6f4e('0x12'),_0x6f4e('0x13')],'raw':!![]})[_0x6f4e('0x14')](function(_0x365b30){_0x2da3f8=_0x365b30;if(!_0x2da3f8[_0x6f4e('0x12')]){logger[_0x6f4e('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x10ce24);throw new Error(_0x6f4e('0xe'));}return _0x9b8466[_0x6f4e('0x15')]({'attributes':['id',_0x6f4e('0x16'),'password',_0x6f4e('0x17'),'role',_0x6f4e('0x18'),'blocked',_0x6f4e('0x19'),_0x6f4e('0x1a')],'where':{'name':_0x10ce24,'role':{'$or':[_0x6f4e('0x1b'),_0x6f4e('0x1c'),'agent']},'adSsoEnabled':!![]}});})[_0x6f4e('0x14')](function(_0x16d706){if(!_0x16d706||_0x16d706&&_0x16d706[_0x6f4e('0x16')]!==_0x10ce24){throw new Error(_0x6f4e('0xe'));}_0x17bb36=_0x16d706;var _0x6922ab=_0x17bb36[_0x6f4e('0x16')]+'@'+config[_0x6f4e('0x7')]['domain'];return adAuthenticate(config[_0x6f4e('0x7')],_0x6922ab,_0x3f16f5);})[_0x6f4e('0x14')](function(_0x247d09){if(_0x17bb36[_0x6f4e('0x18')]){throw new Error(_0x6f4e('0xe'));}if(_0x2da3f8[_0x6f4e('0x13')]>0x0){if(_0x17bb36[_0x6f4e('0x1d')]){if(moment(_0x17bb36['blockedAt'])[_0x6f4e('0x1e')](_0x2da3f8['blockDuration'],_0x6f4e('0x1f'))>moment()){throw new Error(_0x6f4e('0xe'));}return utils[_0x6f4e('0x20')](_0x17bb36,0x0,![],null)[_0x6f4e('0x14')](function(){return utils['getLicense'](_0x17bb36);})['then'](function(){return _0x12175c(null,_0x17bb36);});}else{return utils['getLicense'](_0x17bb36)['then'](function(){return _0x12175c(null,_0x17bb36);});}}else{return utils[_0x6f4e('0x21')](_0x17bb36)[_0x6f4e('0x14')](function(){return _0x12175c(null,_0x17bb36);});}})[_0x6f4e('0x22')](function(_0x13a91c){return _0x12175c(null,![],_0x13a91c);});}function handleError(_0xc7fcb9,_0x2083b0,_0x1bc9ba){return _0xc7fcb9[_0x6f4e('0x23')](_0x2083b0||0x1f4)[_0x6f4e('0x24')]({'message':_0x1bc9ba?_0x1bc9ba[_0x6f4e('0x25')]||_0x1bc9ba:''});}exports['login']=function(_0x39df90,_0xdf31c7,_0x41b5fc){passport['authenticate']('ad-login',function(_0x439a29,_0x4c41f7,_0x52dbb2){var _0x53ca6c=_0x439a29||_0x52dbb2;if(_0x53ca6c){return handleError(_0xdf31c7,0x191,_0x53ca6c);}if(!_0x4c41f7){return handleError(_0xdf31c7,0x194,{'message':_0x6f4e('0x26')});}else{var _0x2a72c7={'payload':{'id':_0x4c41f7['id'],'role':_0x4c41f7[_0x6f4e('0x27')]},'options':{'expiresIn':0x15180}};return authService[_0x6f4e('0x28')](_0x2a72c7)[_0x6f4e('0x14')](function(_0x2a5acf){_0xdf31c7[_0x6f4e('0x29')]({'id':_0x4c41f7['id'],'token':_0x2a5acf,'statusCall':'','isAlreadyLogged':_0x4c41f7[_0x6f4e('0x1a')]});});}})(_0x39df90,_0xdf31c7,_0x41b5fc);};passport[_0x6f4e('0x2a')](_0x6f4e('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0xc6496b,_0xfd7e66,_0x47ad47){return ActiveDirectoryAuthenticate(db[_0x6f4e('0x2c')],_0xc6496b,_0xfd7e66,_0x47ad47);})); \ No newline at end of file +var _0xfaf7=['domain','blocked','add','getLicense','catch','status','message','ad-login','signToken','json','User','passport-local','Strategy','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','url','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blockedAt','online','admin','user','agent','name'];(function(_0x56dafd,_0x202eef){var _0x5f0bf6=function(_0x259289){while(--_0x259289){_0x56dafd['push'](_0x56dafd['shift']());}};_0x5f0bf6(++_0x202eef);}(_0xfaf7,0x1b9));var _0x7faf=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xfaf7[_0x176329];return _0x31997c;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x7faf('0x0'))[_0x7faf('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x7faf('0x2'));var BPromise=require(_0x7faf('0x3'));var util=require('util');var db=require(_0x7faf('0x4'))['db'];var authService=require(_0x7faf('0x5'));var utils=require(_0x7faf('0x6'));var config=require(_0x7faf('0x7'));var logger=require(_0x7faf('0x8'))(_0x7faf('0x9'));function isActiveDirectoryConfigured(_0x1e0247){var _0x49bcd0=![];if(typeof _0x1e0247[_0x7faf('0xa')]!=='undefined'){_0x49bcd0=_0x1e0247[_0x7faf('0xa')]['baseDN']&&_0x1e0247[_0x7faf('0xa')][_0x7faf('0xb')]&&_0x1e0247[_0x7faf('0xa')]['domain'];}return _0x49bcd0;}function adAuthenticate(_0xef2fb1,_0x3fe926,_0x394457){return new BPromise(function(_0x279dac,_0x203f46){try{var _0x3a1a85=new ActiveDirectory(_0xef2fb1);_0x3a1a85['authenticate'](_0x3fe926,_0x394457,function(_0x1ad518,_0x29042b){if(_0x1ad518){logger[_0x7faf('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x3fe926,util[_0x7faf('0xd')](_0x1ad518,{'showHidden':![],'depth':null}));_0x203f46(_0x7faf('0xe'));}else if(!_0x29042b){logger[_0x7faf('0xc')](_0x7faf('0xf'),_0x3fe926);_0x203f46(_0x7faf('0xe'));}else{_0x279dac(_0x29042b);}});}catch(_0x301afb){_0x203f46(_0x301afb);}});}function ActiveDirectoryAuthenticate(_0x2ccf12,_0x24771f,_0x1697f3,_0x5b00ec){var _0x577582,_0x1d1cc6;if(!isActiveDirectoryConfigured(config)){logger[_0x7faf('0xc')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x24771f);return _0x5b00ec(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x7faf('0x10')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x7faf('0x11')],'raw':!![]})[_0x7faf('0x12')](function(_0x1a4a30){_0x577582=_0x1a4a30;if(!_0x577582[_0x7faf('0x13')]){logger[_0x7faf('0xc')](_0x7faf('0x14'),_0x24771f);throw new Error(_0x7faf('0xe'));}return _0x2ccf12[_0x7faf('0x15')]({'attributes':['id','name',_0x7faf('0x16'),_0x7faf('0x17'),_0x7faf('0x18'),_0x7faf('0x19'),'blocked',_0x7faf('0x1a'),_0x7faf('0x1b')],'where':{'name':_0x24771f,'role':{'$or':[_0x7faf('0x1c'),_0x7faf('0x1d'),_0x7faf('0x1e')]},'adSsoEnabled':!![]}});})[_0x7faf('0x12')](function(_0xd6963e){if(!_0xd6963e||_0xd6963e&&_0xd6963e['name']!==_0x24771f){throw new Error(_0x7faf('0xe'));}_0x1d1cc6=_0xd6963e;var _0x3cbda1=_0x1d1cc6[_0x7faf('0x1f')]+'@'+config['activedirectory'][_0x7faf('0x20')];return adAuthenticate(config['activedirectory'],_0x3cbda1,_0x1697f3);})[_0x7faf('0x12')](function(_0x436ca8){if(_0x1d1cc6['disabled']){throw new Error(_0x7faf('0xe'));}if(_0x577582[_0x7faf('0x11')]>0x0){if(_0x1d1cc6[_0x7faf('0x21')]){if(moment(_0x1d1cc6[_0x7faf('0x1a')])[_0x7faf('0x22')](_0x577582[_0x7faf('0x11')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x1d1cc6,0x0,![],null)['then'](function(){return utils[_0x7faf('0x23')](_0x1d1cc6);})[_0x7faf('0x12')](function(){return _0x5b00ec(null,_0x1d1cc6);});}else{return utils['getLicense'](_0x1d1cc6)[_0x7faf('0x12')](function(){return _0x5b00ec(null,_0x1d1cc6);});}}else{return utils[_0x7faf('0x23')](_0x1d1cc6)[_0x7faf('0x12')](function(){return _0x5b00ec(null,_0x1d1cc6);});}})[_0x7faf('0x24')](function(_0x549339){return _0x5b00ec(null,![],_0x549339);});}function handleError(_0x281f16,_0x575e52,_0xcb14f7){return _0x281f16[_0x7faf('0x25')](_0x575e52||0x1f4)['send']({'message':_0xcb14f7?_0xcb14f7[_0x7faf('0x26')]||_0xcb14f7:''});}exports['login']=function(_0x8c304,_0x5e3f78,_0x4ab9ef){passport['authenticate'](_0x7faf('0x27'),function(_0x60e97b,_0x510c89,_0x2e919d){var _0x5cd850=_0x60e97b||_0x2e919d;if(_0x5cd850){return handleError(_0x5e3f78,0x191,_0x5cd850);}if(!_0x510c89){return handleError(_0x5e3f78,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x5533ee={'payload':{'id':_0x510c89['id'],'role':_0x510c89[_0x7faf('0x18')]},'options':{'expiresIn':0x15180}};return authService[_0x7faf('0x28')](_0x5533ee)[_0x7faf('0x12')](function(_0x371e74){_0x5e3f78[_0x7faf('0x29')]({'id':_0x510c89['id'],'token':_0x371e74,'statusCall':'','isAlreadyLogged':_0x510c89['online']});});}})(_0x8c304,_0x5e3f78,_0x4ab9ef);};passport['use'](_0x7faf('0x27'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x3cb354,_0x18321e,_0x317164){return ActiveDirectoryAuthenticate(db[_0x7faf('0x2a')],_0x3cb354,_0x18321e,_0x317164);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 171c862..bfca20c 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 _0x07d4=['post','login','exports','Router','./authActiveDirectory.controller'];(function(_0x147c0d,_0x41c033){var _0x5dd0f7=function(_0x1b8a6c){while(--_0x1b8a6c){_0x147c0d['push'](_0x147c0d['shift']());}};_0x5dd0f7(++_0x41c033);}(_0x07d4,0x15c));var _0x407d=function(_0xba7840,_0x36fac8){_0xba7840=_0xba7840-0x0;var _0x532b9a=_0x07d4[_0xba7840];return _0x532b9a;};'use strict';var express=require('express');var router=express[_0x407d('0x0')]();var controller=require(_0x407d('0x1'));router[_0x407d('0x2')]('/',controller[_0x407d('0x3')]);module[_0x407d('0x4')]=router; \ No newline at end of file +var _0xcfda=['post','express','./authActiveDirectory.controller'];(function(_0x39d42d,_0x163b2b){var _0x71d11b=function(_0x4d8a7e){while(--_0x4d8a7e){_0x39d42d['push'](_0x39d42d['shift']());}};_0x71d11b(++_0x163b2b);}(_0xcfda,0xb8));var _0xacfd=function(_0x5da04d,_0x4d29ce){_0x5da04d=_0x5da04d-0x0;var _0x25e0eb=_0xcfda[_0x5da04d];return _0x25e0eb;};'use strict';var express=require(_0xacfd('0x0'));var router=express['Router']();var controller=require(_0xacfd('0x1'));router[_0xacfd('0x2')]('/',controller['login']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c878bb4..244779b 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a54,0x106));var _0x47a5=function(_0x1a9617,_0x437009){_0x1a9617=_0x1a9617-0x0;var _0x1ccc52=_0x7a54[_0x1a9617];return _0x1ccc52;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7a54,0x106));var _0x47a5=function(_0x2afb67,_0x341e87){_0x2afb67=_0x2afb67-0x0;var _0x12ae0a=_0x7a54[_0x2afb67];return _0x12ae0a;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9175a49..642f7f0 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 _0x031c=['callback','isMiddleware','login','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x2b6a6d,_0x37a15b){var _0x4a70b9=function(_0x199f3e){while(--_0x199f3e){_0x2b6a6d['push'](_0x2b6a6d['shift']());}};_0x4a70b9(++_0x37a15b);}(_0x031c,0x18b));var _0xc031=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x031c[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0xc031('0x0'));var passport=require(_0xc031('0x1'));var router=express[_0xc031('0x2')]();var controller=require(_0xc031('0x3'));var userController=require(_0xc031('0x4'));var authService=require(_0xc031('0x5'));router[_0xc031('0x6')]('/',controller['login']);router['get'](_0xc031('0x7'),controller[_0xc031('0x8')],authService[_0xc031('0x9')],userController[_0xc031('0xa')],authService[_0xc031('0xb')]);module[_0xc031('0xc')]=router; \ No newline at end of file +var _0xf1d4=['setTokenCookie','exports','express','passport','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1d4,0x70));var _0x4f1d=function(_0x5bd980,_0x6127bf){_0x5bd980=_0x5bd980-0x0;var _0x17721e=_0xf1d4[_0x5bd980];return _0x17721e;};'use strict';var express=require(_0x4f1d('0x0'));var passport=require(_0x4f1d('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x4f1d('0x2'));var authService=require(_0x4f1d('0x3'));router[_0x4f1d('0x4')]('/',controller[_0x4f1d('0x5')]);router[_0x4f1d('0x4')](_0x4f1d('0x6'),controller[_0x4f1d('0x7')],authService[_0x4f1d('0x8')],userController[_0x4f1d('0x5')],authService[_0x4f1d('0x9')]);module[_0x4f1d('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 86fd51a..443570f 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 _0xf49a=['token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','allowedLoginAttempts','add','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset'];(function(_0x57f306,_0xe9b2f5){var _0x46e37a=function(_0x5b2c2b){while(--_0x5b2c2b){_0x57f306['push'](_0x57f306['shift']());}};_0x46e37a(++_0xe9b2f5);}(_0xf49a,0x152));var _0xaf49=function(_0x336f5d,_0x7770c2){_0x336f5d=_0x336f5d-0x0;var _0x1d8289=_0xf49a[_0x336f5d];return _0x1d8289;};'use strict';var util=require('util');var passport=require(_0xaf49('0x0'));var LocalStrategy=require('passport-local')[_0xaf49('0x1')];var jayson=require(_0xaf49('0x2'));var _=require('lodash');var rs=require(_0xaf49('0x3'));var moment=require(_0xaf49('0x4'));var db=require(_0xaf49('0x5'))['db'];var authService=require(_0xaf49('0x6'));var utils=require(_0xaf49('0x7'));var client=jayson[_0xaf49('0x8')][_0xaf49('0x9')]({'port':0x232b});function localAuthenticate(_0x18a390,_0x110513,_0x34770c,_0x33d5ac){var _0x1b17d4,_0x48e898;return db[_0xaf49('0xa')][_0xaf49('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xaf49('0xc')],'raw':!![]})[_0xaf49('0xd')](function(_0x42d5d4){_0x1b17d4=_0x42d5d4;return _0x18a390[_0xaf49('0xb')]({'attributes':['id',_0xaf49('0xe'),_0xaf49('0xf'),'salt','role',_0xaf49('0x10'),_0xaf49('0x11'),_0xaf49('0x12'),_0xaf49('0x13')],'where':{'name':_0x110513,'role':{'$or':[_0xaf49('0x14'),_0xaf49('0x15'),'agent']}}});})[_0xaf49('0xd')](function(_0x43bdaf){if(!_0x43bdaf||_0x43bdaf&&_0x43bdaf[_0xaf49('0xe')]!==_0x110513){throw new Error(_0xaf49('0x16'));}else{_0x48e898=_0x43bdaf;return _0x48e898;}})[_0xaf49('0xd')](function(){_0x48e898[_0xaf49('0x17')](_0x34770c,function(_0x34dca2,_0x30c36a){var _0x360144=_0x48e898[_0xaf49('0x13')]+0x1;if(_0x34dca2){return _0x33d5ac(_0x34dca2);}else if(!_0x30c36a){if(_0x48e898[_0xaf49('0x10')]){return _0x33d5ac(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1b17d4['allowedLoginAttempts']>0x0){if(_0x48e898[_0xaf49('0x11')]){if(_0x1b17d4[_0xaf49('0xc')]>0x0){if(moment(_0x48e898[_0xaf49('0x12')])['add'](_0x1b17d4[_0xaf49('0xc')],_0xaf49('0x18'))>moment()){return _0x33d5ac(null,![],{'message':_0xaf49('0x16')});}else{return utils[_0xaf49('0x19')](_0x48e898,_0x360144,![],null)[_0xaf49('0xd')](function(){return _0x33d5ac(null,![],{'message':_0xaf49('0x16')});});}}else{return _0x33d5ac(null,![],{'message':_0xaf49('0x16')});}}else{if(_0x360144>=_0x1b17d4[_0xaf49('0x1a')]){return utils[_0xaf49('0x19')](_0x48e898,0x0,!![],moment())[_0xaf49('0xd')](function(){return _0x33d5ac(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x48e898,_0x360144,![],null)[_0xaf49('0xd')](function(){return _0x33d5ac(null,![],{'message':_0xaf49('0x16')});});}}}else{return _0x33d5ac(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x48e898[_0xaf49('0x10')]){return _0x33d5ac(null,![],{'message':_0xaf49('0x16')});}else if(_0x1b17d4[_0xaf49('0x1a')]>0x0){if(_0x48e898['blocked']){if(_0x1b17d4[_0xaf49('0xc')]>0x0){if(moment(_0x48e898['blockedAt'])[_0xaf49('0x1b')](_0x1b17d4[_0xaf49('0xc')],_0xaf49('0x18'))>moment()){return _0x33d5ac(null,![],{'message':_0xaf49('0x16')});}else{return utils[_0xaf49('0x19')](_0x48e898,0x0,![],null)[_0xaf49('0xd')](function(){return utils[_0xaf49('0x1c')](_0x48e898);})[_0xaf49('0xd')](function(){return _0x33d5ac(null,_0x48e898);});}}else{return _0x33d5ac(null,![],{'message':_0xaf49('0x16')});}}else{return utils['clearBlockUser'](_0x48e898,0x0,![],null)['then'](function(){return utils[_0xaf49('0x1c')](_0x48e898);})[_0xaf49('0xd')](function(){return _0x33d5ac(null,_0x48e898);})[_0xaf49('0x1d')](function(_0x57b8a5){return _0x33d5ac(null,![],_0x57b8a5);});}}else{if(_0x48e898['blocked']){return _0x33d5ac(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xaf49('0x1c')](_0x48e898)[_0xaf49('0xd')](function(){return _0x33d5ac(null,_0x48e898);});}}}});})['catch'](function(_0x4157fb){return _0x33d5ac(null,![],_0x4157fb);});}function sendServiceMail(_0x47aab3){return db[_0xaf49('0x1e')][_0xaf49('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xaf49('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xaf49('0x21'),'include':[{'model':db[_0xaf49('0x22')],'as':_0xaf49('0x22')}]}]})[_0xaf49('0xd')](function(_0x5aca25){if(!_0x5aca25){throw new Error(_0xaf49('0x23'));}var _0xc68401=_0x5aca25[_0xaf49('0x24')]();var _0x3365af={'account':_0xc68401,'message':_[_0xaf49('0x25')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x5aca25[_0xaf49('0xe')],_0x5aca25['email']||_0x5aca25[_0xaf49('0x21')][_0xaf49('0x15')])},_0x47aab3)};return client[_0xaf49('0x26')]('SendMail',_0x3365af);})[_0xaf49('0xd')](function(_0x1f06ff){if(_0x1f06ff[_0xaf49('0x27')]){throw new Error(util[_0xaf49('0x28')](_0xaf49('0x29'),_0x1f06ff[_0xaf49('0x27')][_0xaf49('0x2a')]||JSON[_0xaf49('0x2b')](_0x1f06ff[_0xaf49('0x27')])));}return!![];});}function handleError(_0x25f5ac,_0x30ed23,_0x12dd01){return _0x25f5ac[_0xaf49('0x2c')](_0x30ed23||0x1f4)[_0xaf49('0x2d')]({'message':_0x12dd01?_0x12dd01[_0xaf49('0x2a')]||_0x12dd01:''});}exports[_0xaf49('0x2e')]=function(_0x5044c9,_0x1f77f6,_0x59e9d7){passport[_0xaf49('0x17')](_0xaf49('0x2f'),function(_0x116fb8,_0x79ee42,_0x3d6525){var _0x59c39d=_0x116fb8||_0x3d6525;if(_0x59c39d){return handleError(_0x1f77f6,0x191,_0x59c39d);}if(!_0x79ee42){return handleError(_0x1f77f6,0x194,{'message':_0xaf49('0x30')});}else{var _0x4f7f67={'payload':{'id':_0x79ee42['id'],'role':_0x79ee42[_0xaf49('0x31')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4f7f67)[_0xaf49('0xd')](function(_0x2391fe){_0x1f77f6[_0xaf49('0x32')]({'id':_0x79ee42['id'],'token':_0x2391fe,'statusCall':'','isAlreadyLogged':_0x79ee42[_0xaf49('0x33')]});});}})(_0x5044c9,_0x1f77f6,_0x59e9d7);};exports[_0xaf49('0x34')]=function(_0x123d6b,_0x43c589){if(!_0x123d6b[_0xaf49('0x35')]['email']){return handleError(_0x43c589,0x1f4,{'message':_0xaf49('0x36')});}var _0x31a188=rs['generate']();_0x123d6b[_0xaf49('0x35')][_0xaf49('0x20')]=_0x123d6b[_0xaf49('0x35')]['email'][_0xaf49('0x37')]()[_0xaf49('0x38')]();var _0x315ab3;return db[_0xaf49('0xa')][_0xaf49('0xb')]({'where':{'id':0x1},'attributes':[_0xaf49('0x1a'),_0xaf49('0xc')],'raw':!![]})[_0xaf49('0xd')](function(_0x4104af){_0x315ab3=_0x4104af;return db[_0xaf49('0x39')]['find']({'where':{'email':_0x123d6b[_0xaf49('0x35')]['email']}});})['then'](function(_0xa787e3){if(!_0xa787e3){throw new Error(_0xaf49('0x3a'));}if(_0xa787e3['disabled']){throw new Error(_0xaf49('0x3b'));}if(_0xa787e3[_0xaf49('0x11')]){if(moment(_0xa787e3[_0xaf49('0x12')])['add'](_0x315ab3[_0xaf49('0xc')],_0xaf49('0x18'))>moment()){throw new Error(_0xaf49('0x3c'));}else{_0xa787e3['blocked']=![];_0xa787e3[_0xaf49('0x12')]=null;}}_0xa787e3[_0xaf49('0x3d')]=_0x31a188;_0xa787e3[_0xaf49('0x3e')]=Date[_0xaf49('0x3f')]()+0x36ee80;return _0xa787e3[_0xaf49('0x40')]();})[_0xaf49('0xd')](function(){return sendServiceMail({'to':_0x123d6b[_0xaf49('0x35')][_0xaf49('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xaf49('0x41')+_0xaf49('0x42')+_0xaf49('0x43')+_0x123d6b[_0xaf49('0x44')]['host']+_0xaf49('0x45')+_0x31a188+'\x0a\x0a'+_0xaf49('0x46')});})[_0xaf49('0xd')](function(){_0x43c589[_0xaf49('0x2c')](0xc8)[_0xaf49('0x2d')]({'message':'Reset\x20Email\x20sent!'});})[_0xaf49('0x1d')](function(_0x4abe19){return handleError(_0x43c589,0x1f4,_0x4abe19);});};exports[_0xaf49('0x47')]=function(_0x12a39a,_0x5f5506){return db[_0xaf49('0x39')][_0xaf49('0x1f')]({'where':{'resetPasswordToken':_0x12a39a['params'][_0xaf49('0x48')],'resetPasswordExpires':{'$gt':Date[_0xaf49('0x3f')]()}}})[_0xaf49('0xd')](function(_0x51ac68){if(!_0x51ac68){throw new Error(_0xaf49('0x49'));}return db[_0xaf49('0xa')][_0xaf49('0xb')]({'attributes':['id',_0xaf49('0x4a'),_0xaf49('0x4b'),_0xaf49('0x4c')]})[_0xaf49('0xd')](function(_0xe77ab8){if(_0xe77ab8[_0xaf49('0x4a')])authService[_0xaf49('0x4d')](_0x12a39a['body'][_0xaf49('0xf')]);if(!_0xe77ab8[_0xaf49('0x4b')]||!_0x51ac68[_0xaf49('0x4e')])return _0x51ac68;authService[_0xaf49('0x4f')](_0x12a39a[_0xaf49('0x35')][_0xaf49('0xf')],_0x51ac68[_0xaf49('0x4e')],_0xe77ab8[_0xaf49('0x4c')]);return _0x51ac68;})['then'](function(){_0x51ac68[_0xaf49('0xf')]=_0x12a39a['body'][_0xaf49('0xf')];_0x51ac68[_0xaf49('0x3d')]=null;_0x51ac68[_0xaf49('0x3e')]=null;return _0x51ac68[_0xaf49('0x40')]();});})[_0xaf49('0xd')](function(){_0x5f5506['status'](0xc8)[_0xaf49('0x2d')]({'message':_0xaf49('0x50')});})[_0xaf49('0x1d')](function(_0x356eb0){return handleError(_0x5f5506,0x1f4,_0x356eb0);});};passport[_0xaf49('0x51')](_0xaf49('0x2f'),new LocalStrategy({'usernameField':_0xaf49('0xe'),'passwordField':_0xaf49('0xf')},function(_0x22954b,_0x2bc6d0,_0x3db632){return localAuthenticate(db['User'],_0x22954b,_0x2bc6d0,_0x3db632);})); \ No newline at end of file +var _0x34a4=['loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','user','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','message','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','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','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt'];(function(_0xf7206f,_0x56e76c){var _0x2bfabf=function(_0x73db28){while(--_0x73db28){_0xf7206f['push'](_0xf7206f['shift']());}};_0x2bfabf(++_0x56e76c);}(_0x34a4,0x1ba));var _0x434a=function(_0x2b4895,_0x20c70a){_0x2b4895=_0x2b4895-0x0;var _0x569215=_0x34a4[_0x2b4895];return _0x569215;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x434a('0x0'))[_0x434a('0x1')];var jayson=require(_0x434a('0x2'));var _=require(_0x434a('0x3'));var rs=require('randomstring');var moment=require(_0x434a('0x4'));var db=require(_0x434a('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x434a('0x6'));var client=jayson[_0x434a('0x7')][_0x434a('0x8')]({'port':0x232b});function localAuthenticate(_0x4534e,_0x29fc6f,_0x505755,_0xd29c36){var _0x16d622,_0x12cace;return db['Setting'][_0x434a('0x9')]({'where':{'id':0x1},'attributes':[_0x434a('0xa'),_0x434a('0xb')],'raw':!![]})[_0x434a('0xc')](function(_0x4ef40d){_0x16d622=_0x4ef40d;return _0x4534e[_0x434a('0x9')]({'attributes':['id',_0x434a('0xd'),_0x434a('0xe'),_0x434a('0xf'),_0x434a('0x10'),_0x434a('0x11'),_0x434a('0x12'),_0x434a('0x13'),_0x434a('0x14')],'where':{'name':_0x29fc6f,'role':{'$or':[_0x434a('0x15'),'user',_0x434a('0x16')]}}});})[_0x434a('0xc')](function(_0x307816){if(!_0x307816||_0x307816&&_0x307816[_0x434a('0xd')]!==_0x29fc6f){throw new Error(_0x434a('0x17'));}else{_0x12cace=_0x307816;return _0x12cace;}})[_0x434a('0xc')](function(){_0x12cace[_0x434a('0x18')](_0x505755,function(_0x5ecc39,_0x283a1e){var _0x301d28=_0x12cace[_0x434a('0x14')]+0x1;if(_0x5ecc39){return _0xd29c36(_0x5ecc39);}else if(!_0x283a1e){if(_0x12cace[_0x434a('0x11')]){return _0xd29c36(null,![],{'message':_0x434a('0x17')});}else if(_0x16d622['allowedLoginAttempts']>0x0){if(_0x12cace[_0x434a('0x12')]){if(_0x16d622[_0x434a('0xb')]>0x0){if(moment(_0x12cace[_0x434a('0x13')])[_0x434a('0x19')](_0x16d622[_0x434a('0xb')],_0x434a('0x1a'))>moment()){return _0xd29c36(null,![],{'message':_0x434a('0x17')});}else{return utils[_0x434a('0x1b')](_0x12cace,_0x301d28,![],null)[_0x434a('0xc')](function(){return _0xd29c36(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xd29c36(null,![],{'message':_0x434a('0x17')});}}else{if(_0x301d28>=_0x16d622[_0x434a('0xa')]){return utils[_0x434a('0x1b')](_0x12cace,0x0,!![],moment())[_0x434a('0xc')](function(){return _0xd29c36(null,![],{'message':_0x434a('0x17')});});}else{return utils[_0x434a('0x1b')](_0x12cace,_0x301d28,![],null)[_0x434a('0xc')](function(){return _0xd29c36(null,![],{'message':_0x434a('0x17')});});}}}else{return _0xd29c36(null,![],{'message':_0x434a('0x17')});}}else{if(_0x12cace[_0x434a('0x11')]){return _0xd29c36(null,![],{'message':_0x434a('0x17')});}else if(_0x16d622['allowedLoginAttempts']>0x0){if(_0x12cace[_0x434a('0x12')]){if(_0x16d622[_0x434a('0xb')]>0x0){if(moment(_0x12cace[_0x434a('0x13')])[_0x434a('0x19')](_0x16d622[_0x434a('0xb')],_0x434a('0x1a'))>moment()){return _0xd29c36(null,![],{'message':_0x434a('0x17')});}else{return utils[_0x434a('0x1b')](_0x12cace,0x0,![],null)[_0x434a('0xc')](function(){return utils[_0x434a('0x1c')](_0x12cace);})[_0x434a('0xc')](function(){return _0xd29c36(null,_0x12cace);});}}else{return _0xd29c36(null,![],{'message':_0x434a('0x17')});}}else{return utils[_0x434a('0x1b')](_0x12cace,0x0,![],null)[_0x434a('0xc')](function(){return utils[_0x434a('0x1c')](_0x12cace);})[_0x434a('0xc')](function(){return _0xd29c36(null,_0x12cace);})[_0x434a('0x1d')](function(_0x338110){return _0xd29c36(null,![],_0x338110);});}}else{if(_0x12cace['blocked']){return _0xd29c36(null,![],{'message':_0x434a('0x17')});}else{return utils[_0x434a('0x1c')](_0x12cace)[_0x434a('0xc')](function(){return _0xd29c36(null,_0x12cace);});}}}});})['catch'](function(_0x47129d){return _0xd29c36(null,![],_0x47129d);});}function sendServiceMail(_0x7db7af){return db[_0x434a('0x1e')][_0x434a('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x434a('0xd'),_0x434a('0x20')],'include':[{'model':db[_0x434a('0x21')],'as':_0x434a('0x22'),'include':[{'model':db[_0x434a('0x23')],'as':'CloudProvider'}]}]})[_0x434a('0xc')](function(_0x258fcc){if(!_0x258fcc){throw new Error(_0x434a('0x24'));}var _0x1d11a9=_0x258fcc['getSmtpOptions']();var _0x4078f5={'account':_0x1d11a9,'message':_[_0x434a('0x25')]({'from':util['format'](_0x434a('0x26'),_0x258fcc[_0x434a('0xd')],_0x258fcc[_0x434a('0x20')]||_0x258fcc[_0x434a('0x22')][_0x434a('0x27')])},_0x7db7af)};return client['request']('SendMail',_0x4078f5);})[_0x434a('0xc')](function(_0x591b8d){if(_0x591b8d[_0x434a('0x28')]){throw new Error(util[_0x434a('0x29')](_0x434a('0x2a'),_0x591b8d[_0x434a('0x28')]['message']||JSON['stringify'](_0x591b8d[_0x434a('0x28')])));}return!![];});}function handleError(_0x25505a,_0x52a0f1,_0x3a10d0){return _0x25505a[_0x434a('0x2b')](_0x52a0f1||0x1f4)['send']({'message':_0x3a10d0?_0x3a10d0[_0x434a('0x2c')]||_0x3a10d0:''});}exports['login']=function(_0x30dd44,_0x7cea51,_0x2288d9){passport[_0x434a('0x18')](_0x434a('0x2d'),function(_0x40933d,_0x2842b8,_0x43df04){var _0x3e35c8=_0x40933d||_0x43df04;if(_0x3e35c8){return handleError(_0x7cea51,0x191,_0x3e35c8);}if(!_0x2842b8){return handleError(_0x7cea51,0x194,{'message':_0x434a('0x2e')});}else{var _0xc1bdcd={'payload':{'id':_0x2842b8['id'],'role':_0x2842b8[_0x434a('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xc1bdcd)[_0x434a('0xc')](function(_0x384e60){_0x7cea51[_0x434a('0x2f')]({'id':_0x2842b8['id'],'token':_0x384e60,'statusCall':'','isAlreadyLogged':_0x2842b8[_0x434a('0x30')]});});}})(_0x30dd44,_0x7cea51,_0x2288d9);};exports['forgot']=function(_0xeb5095,_0xedd160){if(!_0xeb5095[_0x434a('0x31')][_0x434a('0x20')]){return handleError(_0xedd160,0x1f4,{'message':_0x434a('0x32')});}var _0xd911ef=rs[_0x434a('0x33')]();_0xeb5095['body'][_0x434a('0x20')]=_0xeb5095[_0x434a('0x31')][_0x434a('0x20')][_0x434a('0x34')]()[_0x434a('0x35')]();var _0x4c0711;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x434a('0xa'),_0x434a('0xb')],'raw':!![]})[_0x434a('0xc')](function(_0x1dfefc){_0x4c0711=_0x1dfefc;return db[_0x434a('0x36')][_0x434a('0x1f')]({'where':{'email':_0xeb5095[_0x434a('0x31')][_0x434a('0x20')]}});})[_0x434a('0xc')](function(_0x569b7f){if(!_0x569b7f){throw new Error(_0x434a('0x37'));}if(_0x569b7f['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x569b7f[_0x434a('0x12')]){if(moment(_0x569b7f[_0x434a('0x13')])[_0x434a('0x19')](_0x4c0711['blockDuration'],_0x434a('0x1a'))>moment()){throw new Error(_0x434a('0x38'));}else{_0x569b7f[_0x434a('0x12')]=![];_0x569b7f['blockedAt']=null;}}_0x569b7f['resetPasswordToken']=_0xd911ef;_0x569b7f[_0x434a('0x39')]=Date[_0x434a('0x3a')]()+0x36ee80;return _0x569b7f['save']();})['then'](function(){return sendServiceMail({'to':_0xeb5095[_0x434a('0x31')]['email'],'subject':_0x434a('0x3b'),'text':_0x434a('0x3c')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x434a('0x3d')+_0xeb5095[_0x434a('0x3e')][_0x434a('0x3f')]+_0x434a('0x40')+_0xd911ef+'\x0a\x0a'+_0x434a('0x41')});})[_0x434a('0xc')](function(){_0xedd160[_0x434a('0x2b')](0xc8)['send']({'message':_0x434a('0x42')});})[_0x434a('0x1d')](function(_0x5c5c2f){return handleError(_0xedd160,0x1f4,_0x5c5c2f);});};exports[_0x434a('0x43')]=function(_0x5cf7a8,_0x307b9d){return db[_0x434a('0x36')][_0x434a('0x1f')]({'where':{'resetPasswordToken':_0x5cf7a8['params'][_0x434a('0x44')],'resetPasswordExpires':{'$gt':Date[_0x434a('0x3a')]()}}})['then'](function(_0x1d913c){if(!_0x1d913c){throw new Error(_0x434a('0x45'));}return db[_0x434a('0x46')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0x434a('0x47')]})[_0x434a('0xc')](function(_0x359636){if(_0x359636['securePassword'])authService[_0x434a('0x48')](_0x5cf7a8[_0x434a('0x31')][_0x434a('0xe')]);if(!_0x359636['enforcePasswordHistory']||!_0x1d913c[_0x434a('0x49')])return _0x1d913c;authService[_0x434a('0x4a')](_0x5cf7a8[_0x434a('0x31')][_0x434a('0xe')],_0x1d913c[_0x434a('0x49')],_0x359636[_0x434a('0x47')]);return _0x1d913c;})[_0x434a('0xc')](function(){_0x1d913c[_0x434a('0xe')]=_0x5cf7a8[_0x434a('0x31')]['password'];_0x1d913c['resetPasswordToken']=null;_0x1d913c[_0x434a('0x39')]=null;return _0x1d913c[_0x434a('0x4b')]();});})['then'](function(){_0x307b9d['status'](0xc8)['send']({'message':_0x434a('0x4c')});})[_0x434a('0x1d')](function(_0x3f6e1f){return handleError(_0x307b9d,0x1f4,_0x3f6e1f);});};passport['use'](_0x434a('0x2d'),new LocalStrategy({'usernameField':_0x434a('0xd'),'passwordField':_0x434a('0xe')},function(_0x3bb8df,_0x392d0e,_0x20b52c){return localAuthenticate(db['User'],_0x3bb8df,_0x392d0e,_0x20b52c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 43927e0..6e9f168 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 _0xb2bb=['exports','express','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0xf71d79,_0x20bf46){var _0x375292=function(_0x269dbf){while(--_0x269dbf){_0xf71d79['push'](_0xf71d79['shift']());}};_0x375292(++_0x20bf46);}(_0xb2bb,0x169));var _0xbb2b=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0xb2bb[_0x26e727];return _0x563800;};'use strict';var express=require(_0xbb2b('0x0'));var router=express['Router']();var controller=require(_0xbb2b('0x1'));router[_0xbb2b('0x2')]('/',controller[_0xbb2b('0x3')]);router[_0xbb2b('0x2')](_0xbb2b('0x4'),controller[_0xbb2b('0x5')]);router[_0xbb2b('0x2')](_0xbb2b('0x6'),controller[_0xbb2b('0x7')]);module[_0xbb2b('0x8')]=router; \ No newline at end of file +var _0x8a66=['post','/forgot','forgot','/reset/:token','reset','exports','express','Router','login'];(function(_0x3688d5,_0x54cb59){var _0x559ad0=function(_0x8a3b65){while(--_0x8a3b65){_0x3688d5['push'](_0x3688d5['shift']());}};_0x559ad0(++_0x54cb59);}(_0x8a66,0x11d));var _0x68a6=function(_0x2859f2,_0x1e3102){_0x2859f2=_0x2859f2-0x0;var _0x4974cd=_0x8a66[_0x2859f2];return _0x4974cd;};'use strict';var express=require(_0x68a6('0x0'));var router=express[_0x68a6('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x68a6('0x2')]);router[_0x68a6('0x3')](_0x68a6('0x4'),controller[_0x68a6('0x5')]);router[_0x68a6('0x3')](_0x68a6('0x6'),controller[_0x68a6('0x7')]);module[_0x68a6('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index aab8d49..fe39ff0 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 _0xd5aa=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5aa,0x1e3));var _0xad5a=function(_0x510561,_0x201c3f){_0x510561=_0x510561-0x0;var _0xc687fd=_0xd5aa[_0x510561];return _0xc687fd;};'use strict';var Sequelize=require(_0xad5a('0x0'));module[_0xad5a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xad5a('0x2')]},'description':{'type':Sequelize[_0xad5a('0x2')]},'status':{'type':Sequelize[_0xad5a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xad5a('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x76f7=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x5098d1,_0x424276){var _0x50d4b0=function(_0x12e467){while(--_0x12e467){_0x5098d1['push'](_0x5098d1['shift']());}};_0x50d4b0(++_0x424276);}(_0x76f7,0x8a));var _0x776f=function(_0xe613fc,_0x9c62fe){_0xe613fc=_0xe613fc-0x0;var _0x229042=_0x76f7[_0xe613fc];return _0x229042;};'use strict';var Sequelize=require(_0x776f('0x0'));module['exports']={'name':{'type':Sequelize[_0x776f('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x776f('0x1')]},'description':{'type':Sequelize[_0x776f('0x1')]},'status':{'type':Sequelize[_0x776f('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x776f('0x3')],'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 eb6e082..37d97f8 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 _0x1e59=['rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','sort','where','pick','merge','type','options','include','findAll','rows','catch','show','params','find','create','body','update','destroy','addConditions','Condition','ids','omit','getConditions','order','filter','hasOwnProperty','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','Automation'];(function(_0x5cfbeb,_0x53a150){var _0x2449c1=function(_0x5abb2e){while(--_0x5abb2e){_0x5cfbeb['push'](_0x5cfbeb['shift']());}};_0x2449c1(++_0x53a150);}(_0x1e59,0x128));var _0x91e5=function(_0x58d8ad,_0x18423b){_0x58d8ad=_0x58d8ad-0x0;var _0x19d2c2=_0x1e59[_0x58d8ad];return _0x19d2c2;};'use strict';var emlformat=require(_0x91e5('0x0'));var rimraf=require(_0x91e5('0x1'));var zipdir=require(_0x91e5('0x2'));var jsonpatch=require(_0x91e5('0x3'));var rp=require('request-promise');var moment=require(_0x91e5('0x4'));var BPromise=require(_0x91e5('0x5'));var Mustache=require(_0x91e5('0x6'));var util=require(_0x91e5('0x7'));var path=require(_0x91e5('0x8'));var sox=require(_0x91e5('0x9'));var csv=require(_0x91e5('0xa'));var ejs=require(_0x91e5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x91e5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x91e5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91e5('0xe'));var Papa=require(_0x91e5('0xf'));var Redis=require('ioredis');var authService=require(_0x91e5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91e5('0x11'));var logger=require(_0x91e5('0x12'))(_0x91e5('0x13'));var utils=require(_0x91e5('0x14'));var config=require(_0x91e5('0x15'));var licenseUtil=require(_0x91e5('0x16'));var db=require(_0x91e5('0x17'))['db'];function respondWithStatusCode(_0x4d730a,_0x4adf6b){_0x4adf6b=_0x4adf6b||0xcc;return function(_0x6f23ab){if(_0x6f23ab){return _0x4d730a[_0x91e5('0x18')](_0x4adf6b);}return _0x4d730a['status'](_0x4adf6b)[_0x91e5('0x19')]();};}function respondWithResult(_0xd38aac,_0x9c5293){_0x9c5293=_0x9c5293||0xc8;return function(_0x2a1459){if(_0x2a1459){return _0xd38aac[_0x91e5('0x1a')](_0x9c5293)[_0x91e5('0x1b')](_0x2a1459);}};}function respondWithFilteredResult(_0x4c2bbb,_0x53873e){return function(_0x5533ca){if(_0x5533ca){var _0x239fb9=typeof _0x53873e[_0x91e5('0x1c')]===_0x91e5('0x1d')&&typeof _0x53873e['limit']===_0x91e5('0x1d');var _0xd4155f=_0x5533ca[_0x91e5('0x1e')];var _0x5e97f5=_0x239fb9?0x0:_0x53873e['offset'];var _0x242deb=_0x239fb9?_0x5533ca['count']:_0x53873e[_0x91e5('0x1c')]+_0x53873e[_0x91e5('0x1f')];var _0x3bee7c;if(_0x242deb>=_0xd4155f){_0x242deb=_0xd4155f;_0x3bee7c=0xc8;}else{_0x3bee7c=0xce;}_0x4c2bbb[_0x91e5('0x1a')](_0x3bee7c);return _0x4c2bbb['set'](_0x91e5('0x20'),_0x5e97f5+'-'+_0x242deb+'/'+_0xd4155f)[_0x91e5('0x1b')](_0x5533ca);}return null;};}function patchUpdates(_0x270f1c){return function(_0x46cb63){try{jsonpatch[_0x91e5('0x21')](_0x46cb63,_0x270f1c,!![]);}catch(_0x5da8f0){return BPromise[_0x91e5('0x22')](_0x5da8f0);}return _0x46cb63[_0x91e5('0x23')]();};}function saveUpdates(_0x5cd066,_0x2a784b){return function(_0x55c85b){if(_0x55c85b){return _0x55c85b['update'](_0x5cd066)[_0x91e5('0x24')](function(_0x4c3ffe){return _0x4c3ffe;});}return null;};}function removeEntity(_0x73b626,_0x40de6e){return function(_0x38ecf6){if(_0x38ecf6){return _0x38ecf6['destroy']()['then'](function(){_0x73b626[_0x91e5('0x1a')](0xcc)[_0x91e5('0x19')]();});}};}function handleEntityNotFound(_0x435918,_0x13986c){return function(_0x429c47){if(!_0x429c47){_0x435918[_0x91e5('0x18')](0x194);}return _0x429c47;};}function handleError(_0x50fca8,_0x1a943c){_0x1a943c=_0x1a943c||0x1f4;return function(_0x4a3894){logger[_0x91e5('0x25')](_0x4a3894[_0x91e5('0x26')]);if(_0x4a3894[_0x91e5('0x27')]){delete _0x4a3894['name'];}_0x50fca8[_0x91e5('0x1a')](_0x1a943c)[_0x91e5('0x28')](_0x4a3894);};}exports[_0x91e5('0x29')]=function(_0x1a17d7,_0x350b3e){var _0x5d1ed3={},_0x2cabd5={},_0xc1941f={'count':0x0,'rows':[]};var _0x5368b5=_[_0x91e5('0x2a')](db[_0x91e5('0x2b')][_0x91e5('0x2c')],function(_0xdb602a){return{'name':_0xdb602a[_0x91e5('0x2d')],'type':_0xdb602a['type'][_0x91e5('0x2e')]};});_0x2cabd5[_0x91e5('0x2f')]=_['map'](_0x5368b5,_0x91e5('0x27'));_0x2cabd5['query']=_[_0x91e5('0x30')](_0x1a17d7['query']);_0x2cabd5[_0x91e5('0x31')]=_[_0x91e5('0x32')](_0x2cabd5['model'],_0x2cabd5[_0x91e5('0x33')]);_0x5d1ed3['attributes']=_[_0x91e5('0x32')](_0x2cabd5['model'],qs[_0x91e5('0x34')](_0x1a17d7[_0x91e5('0x33')][_0x91e5('0x34')]));_0x5d1ed3[_0x91e5('0x35')]=_0x5d1ed3[_0x91e5('0x35')][_0x91e5('0x36')]?_0x5d1ed3['attributes']:_0x2cabd5['model'];if(!_0x1a17d7[_0x91e5('0x33')]['hasOwnProperty'](_0x91e5('0x37'))){_0x5d1ed3[_0x91e5('0x1f')]=qs[_0x91e5('0x1f')](_0x1a17d7['query'][_0x91e5('0x1f')]);_0x5d1ed3[_0x91e5('0x1c')]=qs[_0x91e5('0x1c')](_0x1a17d7[_0x91e5('0x33')][_0x91e5('0x1c')]);}_0x5d1ed3['order']=qs[_0x91e5('0x38')](_0x1a17d7[_0x91e5('0x33')][_0x91e5('0x38')]);_0x5d1ed3[_0x91e5('0x39')]=qs['filters'](_[_0x91e5('0x3a')](_0x1a17d7[_0x91e5('0x33')],_0x2cabd5[_0x91e5('0x31')]),_0x5368b5);if(_0x1a17d7[_0x91e5('0x33')]['filter']){_0x5d1ed3[_0x91e5('0x39')]=_[_0x91e5('0x3b')](_0x5d1ed3[_0x91e5('0x39')],{'$or':_[_0x91e5('0x2a')](_0x5368b5,function(_0x5e36e7){if(_0x5e36e7[_0x91e5('0x3c')]!=='VIRTUAL'){var _0x10e506={};_0x10e506[_0x5e36e7[_0x91e5('0x27')]]={'$like':'%'+_0x1a17d7['query']['filter']+'%'};return _0x10e506;}})});}_0x5d1ed3=_[_0x91e5('0x3b')]({},_0x5d1ed3,_0x1a17d7[_0x91e5('0x3d')]);var _0x699a48={'where':_0x5d1ed3[_0x91e5('0x39')]};return db[_0x91e5('0x2b')][_0x91e5('0x1e')](_0x699a48)[_0x91e5('0x24')](function(_0x59f871){_0xc1941f[_0x91e5('0x1e')]=_0x59f871;if(_0x1a17d7[_0x91e5('0x33')]['includeAll']){_0x5d1ed3[_0x91e5('0x3e')]=[{'all':!![]}];}return db[_0x91e5('0x2b')][_0x91e5('0x3f')](_0x5d1ed3);})[_0x91e5('0x24')](function(_0x4e1d84){_0xc1941f[_0x91e5('0x40')]=_0x4e1d84;return _0xc1941f;})[_0x91e5('0x24')](respondWithFilteredResult(_0x350b3e,_0x5d1ed3))[_0x91e5('0x41')](handleError(_0x350b3e,null));};exports[_0x91e5('0x42')]=function(_0x5a6111,_0x5e47f7){var _0x23bc49={'raw':![],'where':{'id':_0x5a6111[_0x91e5('0x43')]['id']}},_0x26063d={};_0x26063d[_0x91e5('0x2f')]=_['keys'](db[_0x91e5('0x2b')][_0x91e5('0x2c')]);_0x26063d[_0x91e5('0x33')]=_[_0x91e5('0x30')](_0x5a6111['query']);_0x26063d[_0x91e5('0x31')]=_[_0x91e5('0x32')](_0x26063d[_0x91e5('0x2f')],_0x26063d[_0x91e5('0x33')]);_0x23bc49[_0x91e5('0x35')]=_[_0x91e5('0x32')](_0x26063d[_0x91e5('0x2f')],qs[_0x91e5('0x34')](_0x5a6111[_0x91e5('0x33')][_0x91e5('0x34')]));_0x23bc49[_0x91e5('0x35')]=_0x23bc49[_0x91e5('0x35')][_0x91e5('0x36')]?_0x23bc49[_0x91e5('0x35')]:_0x26063d[_0x91e5('0x2f')];if(_0x5a6111[_0x91e5('0x33')]['includeAll']){_0x23bc49[_0x91e5('0x3e')]=[{'all':!![]}];}_0x23bc49=_['merge']({},_0x23bc49,_0x5a6111[_0x91e5('0x3d')]);return db['Automation'][_0x91e5('0x44')](_0x23bc49)[_0x91e5('0x24')](handleEntityNotFound(_0x5e47f7,null))[_0x91e5('0x24')](respondWithResult(_0x5e47f7,null))[_0x91e5('0x41')](handleError(_0x5e47f7,null));};exports['create']=function(_0x532fff,_0x30d5d2){return db[_0x91e5('0x2b')][_0x91e5('0x45')](_0x532fff[_0x91e5('0x46')],{})[_0x91e5('0x24')](respondWithResult(_0x30d5d2,0xc9))[_0x91e5('0x41')](handleError(_0x30d5d2,null));};exports[_0x91e5('0x47')]=function(_0x4061e1,_0x137bcb){if(_0x4061e1[_0x91e5('0x46')]['id']){delete _0x4061e1[_0x91e5('0x46')]['id'];}return db[_0x91e5('0x2b')][_0x91e5('0x44')]({'where':{'id':_0x4061e1[_0x91e5('0x43')]['id']}})[_0x91e5('0x24')](handleEntityNotFound(_0x137bcb,null))[_0x91e5('0x24')](saveUpdates(_0x4061e1['body'],null))['then'](respondWithResult(_0x137bcb,null))[_0x91e5('0x41')](handleError(_0x137bcb,null));};exports[_0x91e5('0x48')]=function(_0x4dbefc,_0x2b4331){return db[_0x91e5('0x2b')]['find']({'where':{'id':_0x4dbefc[_0x91e5('0x43')]['id']}})[_0x91e5('0x24')](handleEntityNotFound(_0x2b4331,null))[_0x91e5('0x24')](removeEntity(_0x2b4331,null))[_0x91e5('0x41')](handleError(_0x2b4331,null));};exports[_0x91e5('0x49')]=function(_0x5dc284,_0x397fa7,_0x1aef42){return db[_0x91e5('0x4a')][_0x91e5('0x44')]({'where':{'id':_0x5dc284[_0x91e5('0x43')]['id']}})[_0x91e5('0x24')](handleEntityNotFound(_0x397fa7,null))[_0x91e5('0x24')](function(_0xfdb965){if(_0xfdb965){return _0xfdb965[_0x91e5('0x49')](_0x5dc284[_0x91e5('0x46')][_0x91e5('0x4b')],_[_0x91e5('0x4c')](_0x5dc284[_0x91e5('0x46')],[_0x91e5('0x4b'),'id'])||{});}})[_0x91e5('0x24')](respondWithResult(_0x397fa7,null))[_0x91e5('0x41')](handleError(_0x397fa7,null));};exports[_0x91e5('0x4d')]=function(_0x1ddf8d,_0x45520a,_0x61bae){var _0x5d59b2={};var _0x302e49={};var _0x4648b6;var _0x583b4a;return db[_0x91e5('0x2b')]['findOne']({'where':{'id':_0x1ddf8d[_0x91e5('0x43')]['id']}})[_0x91e5('0x24')](handleEntityNotFound(_0x45520a,null))[_0x91e5('0x24')](function(_0x24c1f7){if(_0x24c1f7){_0x4648b6=_0x24c1f7;_0x302e49[_0x91e5('0x2f')]=_[_0x91e5('0x30')](db['Condition'][_0x91e5('0x2c')]);_0x302e49['query']=_[_0x91e5('0x30')](_0x1ddf8d[_0x91e5('0x33')]);_0x302e49[_0x91e5('0x31')]=_[_0x91e5('0x32')](_0x302e49['model'],_0x302e49[_0x91e5('0x33')]);_0x5d59b2[_0x91e5('0x35')]=_[_0x91e5('0x32')](_0x302e49['model'],qs[_0x91e5('0x34')](_0x1ddf8d[_0x91e5('0x33')][_0x91e5('0x34')]));_0x5d59b2[_0x91e5('0x35')]=_0x5d59b2[_0x91e5('0x35')]['length']?_0x5d59b2['attributes']:_0x302e49[_0x91e5('0x2f')];_0x5d59b2[_0x91e5('0x4e')]=qs[_0x91e5('0x38')](_0x1ddf8d[_0x91e5('0x33')][_0x91e5('0x38')]);_0x5d59b2['where']=qs[_0x91e5('0x31')](_['pick'](_0x1ddf8d[_0x91e5('0x33')],_0x302e49[_0x91e5('0x31')]));if(_0x1ddf8d['query'][_0x91e5('0x4f')]){_0x5d59b2[_0x91e5('0x39')]=_[_0x91e5('0x3b')](_0x5d59b2['where'],{'$or':_[_0x91e5('0x2a')](_0x5d59b2['attributes'],function(_0x187648){var _0x342ca8={};_0x342ca8[_0x187648]={'$like':'%'+_0x1ddf8d[_0x91e5('0x33')][_0x91e5('0x4f')]+'%'};return _0x342ca8;})});}_0x5d59b2=_[_0x91e5('0x3b')]({},_0x5d59b2,_0x1ddf8d[_0x91e5('0x3d')]);return _0x4648b6['getConditions'](_0x5d59b2);}})[_0x91e5('0x24')](function(_0x59f76d){if(_0x59f76d){_0x583b4a=_0x59f76d['length'];if(!_0x1ddf8d[_0x91e5('0x33')][_0x91e5('0x50')](_0x91e5('0x37'))){_0x5d59b2[_0x91e5('0x1f')]=qs[_0x91e5('0x1f')](_0x1ddf8d['query'][_0x91e5('0x1f')]);_0x5d59b2[_0x91e5('0x1c')]=qs[_0x91e5('0x1c')](_0x1ddf8d[_0x91e5('0x33')][_0x91e5('0x1c')]);}return _0x4648b6[_0x91e5('0x4d')](_0x5d59b2);}})[_0x91e5('0x24')](function(_0x360099){if(_0x360099){return _0x360099?{'count':_0x583b4a,'rows':_0x360099}:null;}})['then'](respondWithResult(_0x45520a,null))['catch'](handleError(_0x45520a,null));};exports[_0x91e5('0x51')]=function(_0x302a01,_0xb33cea,_0x3a963e){return db[_0x91e5('0x52')][_0x91e5('0x44')]({'where':{'id':_0x302a01[_0x91e5('0x43')]['id']}})['then'](handleEntityNotFound(_0xb33cea,null))[_0x91e5('0x24')](function(_0x3383fb){if(_0x3383fb){return _0x3383fb['addActions'](_0x302a01['body'][_0x91e5('0x4b')],_[_0x91e5('0x4c')](_0x302a01[_0x91e5('0x46')],[_0x91e5('0x4b'),'id'])||{});}})[_0x91e5('0x24')](respondWithResult(_0xb33cea,null))[_0x91e5('0x41')](handleError(_0xb33cea,null));};exports[_0x91e5('0x53')]=function(_0x17c63c,_0x1c525b,_0x17581a){var _0xd77352={};var _0x4d6000={};var _0x43977d;var _0x40fb86;return db[_0x91e5('0x2b')][_0x91e5('0x54')]({'where':{'id':_0x17c63c[_0x91e5('0x43')]['id']}})[_0x91e5('0x24')](handleEntityNotFound(_0x1c525b,null))[_0x91e5('0x24')](function(_0x110439){if(_0x110439){_0x43977d=_0x110439;_0x4d6000[_0x91e5('0x2f')]=_[_0x91e5('0x30')](db[_0x91e5('0x52')][_0x91e5('0x2c')]);_0x4d6000[_0x91e5('0x33')]=_[_0x91e5('0x30')](_0x17c63c[_0x91e5('0x33')]);_0x4d6000[_0x91e5('0x31')]=_[_0x91e5('0x32')](_0x4d6000['model'],_0x4d6000[_0x91e5('0x33')]);_0xd77352[_0x91e5('0x35')]=_[_0x91e5('0x32')](_0x4d6000[_0x91e5('0x2f')],qs[_0x91e5('0x34')](_0x17c63c['query'][_0x91e5('0x34')]));_0xd77352[_0x91e5('0x35')]=_0xd77352[_0x91e5('0x35')]['length']?_0xd77352['attributes']:_0x4d6000[_0x91e5('0x2f')];_0xd77352[_0x91e5('0x4e')]=qs['sort'](_0x17c63c[_0x91e5('0x33')][_0x91e5('0x38')]);_0xd77352[_0x91e5('0x39')]=qs[_0x91e5('0x31')](_[_0x91e5('0x3a')](_0x17c63c['query'],_0x4d6000['filters']));if(_0x17c63c[_0x91e5('0x33')][_0x91e5('0x4f')]){_0xd77352[_0x91e5('0x39')]=_[_0x91e5('0x3b')](_0xd77352[_0x91e5('0x39')],{'$or':_['map'](_0xd77352['attributes'],function(_0x4b94bf){var _0x323b0e={};_0x323b0e[_0x4b94bf]={'$like':'%'+_0x17c63c[_0x91e5('0x33')][_0x91e5('0x4f')]+'%'};return _0x323b0e;})});}_0xd77352=_[_0x91e5('0x3b')]({},_0xd77352,_0x17c63c[_0x91e5('0x3d')]);return _0x43977d['getActions'](_0xd77352);}})[_0x91e5('0x24')](function(_0x5c46cf){if(_0x5c46cf){_0x40fb86=_0x5c46cf['length'];if(!_0x17c63c[_0x91e5('0x33')][_0x91e5('0x50')](_0x91e5('0x37'))){_0xd77352[_0x91e5('0x1f')]=qs['limit'](_0x17c63c[_0x91e5('0x33')][_0x91e5('0x1f')]);_0xd77352[_0x91e5('0x1c')]=qs[_0x91e5('0x1c')](_0x17c63c[_0x91e5('0x33')][_0x91e5('0x1c')]);}return _0x43977d[_0x91e5('0x53')](_0xd77352);}})['then'](function(_0x2f9409){if(_0x2f9409){return _0x2f9409?{'count':_0x40fb86,'rows':_0x2f9409}:null;}})['then'](respondWithResult(_0x1c525b,null))[_0x91e5('0x41')](handleError(_0x1c525b,null));}; \ No newline at end of file +var _0xd7dc=['getConditions','addActions','Action','params','omit','findOne','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','sendStatus','error','stack','name','index','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','Automation','includeAll','findAll','catch','show','rawAttributes','fields','include','create','body','find','addConditions','Condition','ids','order'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xd7dc,0x14f));var _0xcd7d=function(_0x2e689d,_0x4c3b29){_0x2e689d=_0x2e689d-0x0;var _0x540160=_0xd7dc[_0x2e689d];return _0x540160;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcd7d('0x0'));var jsonpatch=require(_0xcd7d('0x1'));var rp=require(_0xcd7d('0x2'));var moment=require(_0xcd7d('0x3'));var BPromise=require(_0xcd7d('0x4'));var Mustache=require('mustache');var util=require(_0xcd7d('0x5'));var path=require(_0xcd7d('0x6'));var sox=require('sox');var csv=require(_0xcd7d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd7d('0x8'));var _=require(_0xcd7d('0x9'));var squel=require(_0xcd7d('0xa'));var crypto=require(_0xcd7d('0xb'));var jsforce=require(_0xcd7d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcd7d('0x7'));var querystring=require(_0xcd7d('0xd'));var Papa=require(_0xcd7d('0xe'));var Redis=require('ioredis');var authService=require(_0xcd7d('0xf'));var qs=require(_0xcd7d('0x10'));var as=require(_0xcd7d('0x11'));var hardwareService=require(_0xcd7d('0x12'));var logger=require('../../config/logger')(_0xcd7d('0x13'));var utils=require(_0xcd7d('0x14'));var config=require(_0xcd7d('0x15'));var licenseUtil=require(_0xcd7d('0x16'));var db=require(_0xcd7d('0x17'))['db'];function respondWithStatusCode(_0x4db490,_0x4348dd){_0x4348dd=_0x4348dd||0xcc;return function(_0x4b077a){if(_0x4b077a){return _0x4db490['sendStatus'](_0x4348dd);}return _0x4db490[_0xcd7d('0x18')](_0x4348dd)[_0xcd7d('0x19')]();};}function respondWithResult(_0x2633df,_0x4f2983){_0x4f2983=_0x4f2983||0xc8;return function(_0x4bb3bf){if(_0x4bb3bf){return _0x2633df[_0xcd7d('0x18')](_0x4f2983)[_0xcd7d('0x1a')](_0x4bb3bf);}};}function respondWithFilteredResult(_0x525a90,_0x466106){return function(_0x558363){if(_0x558363){var _0x4d7de4=typeof _0x466106[_0xcd7d('0x1b')]===_0xcd7d('0x1c')&&typeof _0x466106[_0xcd7d('0x1d')]===_0xcd7d('0x1c');var _0x76c3dd=_0x558363['count'];var _0x1e855a=_0x4d7de4?0x0:_0x466106[_0xcd7d('0x1b')];var _0xb5526b=_0x4d7de4?_0x558363[_0xcd7d('0x1e')]:_0x466106['offset']+_0x466106[_0xcd7d('0x1d')];var _0x2aa704;if(_0xb5526b>=_0x76c3dd){_0xb5526b=_0x76c3dd;_0x2aa704=0xc8;}else{_0x2aa704=0xce;}_0x525a90[_0xcd7d('0x18')](_0x2aa704);return _0x525a90[_0xcd7d('0x1f')]('Content-Range',_0x1e855a+'-'+_0xb5526b+'/'+_0x76c3dd)[_0xcd7d('0x1a')](_0x558363);}return null;};}function patchUpdates(_0xdbda73){return function(_0x416f61){try{jsonpatch['apply'](_0x416f61,_0xdbda73,!![]);}catch(_0x2f3bf3){return BPromise[_0xcd7d('0x20')](_0x2f3bf3);}return _0x416f61['save']();};}function saveUpdates(_0x186996,_0x57e21f){return function(_0x328ed6){if(_0x328ed6){return _0x328ed6[_0xcd7d('0x21')](_0x186996)[_0xcd7d('0x22')](function(_0x23c5ba){return _0x23c5ba;});}return null;};}function removeEntity(_0x3947c4,_0x203862){return function(_0x8ff05d){if(_0x8ff05d){return _0x8ff05d[_0xcd7d('0x23')]()[_0xcd7d('0x22')](function(){_0x3947c4[_0xcd7d('0x18')](0xcc)[_0xcd7d('0x19')]();});}};}function handleEntityNotFound(_0x4856a7,_0x47e922){return function(_0x221294){if(!_0x221294){_0x4856a7[_0xcd7d('0x24')](0x194);}return _0x221294;};}function handleError(_0x46d03d,_0x2d592d){_0x2d592d=_0x2d592d||0x1f4;return function(_0xa11d9c){logger[_0xcd7d('0x25')](_0xa11d9c[_0xcd7d('0x26')]);if(_0xa11d9c[_0xcd7d('0x27')]){delete _0xa11d9c['name'];}_0x46d03d[_0xcd7d('0x18')](_0x2d592d)['send'](_0xa11d9c);};}exports[_0xcd7d('0x28')]=function(_0x247abc,_0x226a77){var _0x209dd2={},_0x26fe52={},_0x22a6f5={'count':0x0,'rows':[]};var _0x4b7ef5=_['map'](db['Automation']['rawAttributes'],function(_0x2a858f){return{'name':_0x2a858f['fieldName'],'type':_0x2a858f['type'][_0xcd7d('0x29')]};});_0x26fe52['model']=_[_0xcd7d('0x2a')](_0x4b7ef5,_0xcd7d('0x27'));_0x26fe52[_0xcd7d('0x2b')]=_[_0xcd7d('0x2c')](_0x247abc[_0xcd7d('0x2b')]);_0x26fe52[_0xcd7d('0x2d')]=_[_0xcd7d('0x2e')](_0x26fe52[_0xcd7d('0x2f')],_0x26fe52[_0xcd7d('0x2b')]);_0x209dd2['attributes']=_['intersection'](_0x26fe52[_0xcd7d('0x2f')],qs['fields'](_0x247abc[_0xcd7d('0x2b')]['fields']));_0x209dd2[_0xcd7d('0x30')]=_0x209dd2[_0xcd7d('0x30')][_0xcd7d('0x31')]?_0x209dd2[_0xcd7d('0x30')]:_0x26fe52['model'];if(!_0x247abc[_0xcd7d('0x2b')][_0xcd7d('0x32')](_0xcd7d('0x33'))){_0x209dd2['limit']=qs[_0xcd7d('0x1d')](_0x247abc['query'][_0xcd7d('0x1d')]);_0x209dd2['offset']=qs[_0xcd7d('0x1b')](_0x247abc[_0xcd7d('0x2b')]['offset']);}_0x209dd2['order']=qs[_0xcd7d('0x34')](_0x247abc['query'][_0xcd7d('0x34')]);_0x209dd2['where']=qs[_0xcd7d('0x2d')](_[_0xcd7d('0x35')](_0x247abc[_0xcd7d('0x2b')],_0x26fe52[_0xcd7d('0x2d')]),_0x4b7ef5);if(_0x247abc[_0xcd7d('0x2b')]['filter']){_0x209dd2[_0xcd7d('0x36')]=_[_0xcd7d('0x37')](_0x209dd2[_0xcd7d('0x36')],{'$or':_[_0xcd7d('0x2a')](_0x4b7ef5,function(_0x41f1f2){if(_0x41f1f2[_0xcd7d('0x38')]!==_0xcd7d('0x39')){var _0x4663d0={};_0x4663d0[_0x41f1f2[_0xcd7d('0x27')]]={'$like':'%'+_0x247abc[_0xcd7d('0x2b')][_0xcd7d('0x3a')]+'%'};return _0x4663d0;}})});}_0x209dd2=_[_0xcd7d('0x37')]({},_0x209dd2,_0x247abc[_0xcd7d('0x3b')]);var _0xd46734={'where':_0x209dd2['where']};return db[_0xcd7d('0x3c')][_0xcd7d('0x1e')](_0xd46734)[_0xcd7d('0x22')](function(_0x6281be){_0x22a6f5[_0xcd7d('0x1e')]=_0x6281be;if(_0x247abc[_0xcd7d('0x2b')][_0xcd7d('0x3d')]){_0x209dd2['include']=[{'all':!![]}];}return db['Automation'][_0xcd7d('0x3e')](_0x209dd2);})['then'](function(_0x1230cf){_0x22a6f5['rows']=_0x1230cf;return _0x22a6f5;})[_0xcd7d('0x22')](respondWithFilteredResult(_0x226a77,_0x209dd2))[_0xcd7d('0x3f')](handleError(_0x226a77,null));};exports[_0xcd7d('0x40')]=function(_0x4a2db5,_0x3ea035){var _0x47cb32={'raw':![],'where':{'id':_0x4a2db5['params']['id']}},_0x478f0c={};_0x478f0c[_0xcd7d('0x2f')]=_[_0xcd7d('0x2c')](db[_0xcd7d('0x3c')][_0xcd7d('0x41')]);_0x478f0c[_0xcd7d('0x2b')]=_[_0xcd7d('0x2c')](_0x4a2db5[_0xcd7d('0x2b')]);_0x478f0c[_0xcd7d('0x2d')]=_['intersection'](_0x478f0c[_0xcd7d('0x2f')],_0x478f0c[_0xcd7d('0x2b')]);_0x47cb32[_0xcd7d('0x30')]=_['intersection'](_0x478f0c[_0xcd7d('0x2f')],qs[_0xcd7d('0x42')](_0x4a2db5[_0xcd7d('0x2b')]['fields']));_0x47cb32[_0xcd7d('0x30')]=_0x47cb32[_0xcd7d('0x30')][_0xcd7d('0x31')]?_0x47cb32[_0xcd7d('0x30')]:_0x478f0c[_0xcd7d('0x2f')];if(_0x4a2db5[_0xcd7d('0x2b')][_0xcd7d('0x3d')]){_0x47cb32[_0xcd7d('0x43')]=[{'all':!![]}];}_0x47cb32=_['merge']({},_0x47cb32,_0x4a2db5[_0xcd7d('0x3b')]);return db['Automation']['find'](_0x47cb32)['then'](handleEntityNotFound(_0x3ea035,null))['then'](respondWithResult(_0x3ea035,null))[_0xcd7d('0x3f')](handleError(_0x3ea035,null));};exports[_0xcd7d('0x44')]=function(_0x2660fb,_0x48dea9){return db['Automation']['create'](_0x2660fb['body'],{})[_0xcd7d('0x22')](respondWithResult(_0x48dea9,0xc9))[_0xcd7d('0x3f')](handleError(_0x48dea9,null));};exports[_0xcd7d('0x21')]=function(_0x32957b,_0x447090){if(_0x32957b[_0xcd7d('0x45')]['id']){delete _0x32957b[_0xcd7d('0x45')]['id'];}return db[_0xcd7d('0x3c')][_0xcd7d('0x46')]({'where':{'id':_0x32957b['params']['id']}})[_0xcd7d('0x22')](handleEntityNotFound(_0x447090,null))[_0xcd7d('0x22')](saveUpdates(_0x32957b[_0xcd7d('0x45')],null))[_0xcd7d('0x22')](respondWithResult(_0x447090,null))[_0xcd7d('0x3f')](handleError(_0x447090,null));};exports[_0xcd7d('0x23')]=function(_0x4d2c02,_0x23d6d3){return db['Automation']['find']({'where':{'id':_0x4d2c02['params']['id']}})[_0xcd7d('0x22')](handleEntityNotFound(_0x23d6d3,null))[_0xcd7d('0x22')](removeEntity(_0x23d6d3,null))[_0xcd7d('0x3f')](handleError(_0x23d6d3,null));};exports[_0xcd7d('0x47')]=function(_0x377d98,_0x46a802,_0x3fde0c){return db[_0xcd7d('0x48')]['find']({'where':{'id':_0x377d98['params']['id']}})[_0xcd7d('0x22')](handleEntityNotFound(_0x46a802,null))[_0xcd7d('0x22')](function(_0x525398){if(_0x525398){return _0x525398[_0xcd7d('0x47')](_0x377d98[_0xcd7d('0x45')][_0xcd7d('0x49')],_['omit'](_0x377d98['body'],[_0xcd7d('0x49'),'id'])||{});}})[_0xcd7d('0x22')](respondWithResult(_0x46a802,null))[_0xcd7d('0x3f')](handleError(_0x46a802,null));};exports['getConditions']=function(_0xdb8bd3,_0x249d40,_0x249de7){var _0x447a16={};var _0x220d5b={};var _0x268a8c;var _0x5013ff;return db[_0xcd7d('0x3c')]['findOne']({'where':{'id':_0xdb8bd3['params']['id']}})[_0xcd7d('0x22')](handleEntityNotFound(_0x249d40,null))[_0xcd7d('0x22')](function(_0x542ec1){if(_0x542ec1){_0x268a8c=_0x542ec1;_0x220d5b[_0xcd7d('0x2f')]=_[_0xcd7d('0x2c')](db[_0xcd7d('0x48')]['rawAttributes']);_0x220d5b[_0xcd7d('0x2b')]=_[_0xcd7d('0x2c')](_0xdb8bd3['query']);_0x220d5b['filters']=_[_0xcd7d('0x2e')](_0x220d5b['model'],_0x220d5b['query']);_0x447a16[_0xcd7d('0x30')]=_[_0xcd7d('0x2e')](_0x220d5b[_0xcd7d('0x2f')],qs['fields'](_0xdb8bd3['query'][_0xcd7d('0x42')]));_0x447a16[_0xcd7d('0x30')]=_0x447a16[_0xcd7d('0x30')][_0xcd7d('0x31')]?_0x447a16['attributes']:_0x220d5b[_0xcd7d('0x2f')];_0x447a16[_0xcd7d('0x4a')]=qs[_0xcd7d('0x34')](_0xdb8bd3['query'][_0xcd7d('0x34')]);_0x447a16[_0xcd7d('0x36')]=qs['filters'](_[_0xcd7d('0x35')](_0xdb8bd3['query'],_0x220d5b[_0xcd7d('0x2d')]));if(_0xdb8bd3[_0xcd7d('0x2b')][_0xcd7d('0x3a')]){_0x447a16[_0xcd7d('0x36')]=_['merge'](_0x447a16[_0xcd7d('0x36')],{'$or':_[_0xcd7d('0x2a')](_0x447a16[_0xcd7d('0x30')],function(_0x183783){var _0x375d42={};_0x375d42[_0x183783]={'$like':'%'+_0xdb8bd3[_0xcd7d('0x2b')]['filter']+'%'};return _0x375d42;})});}_0x447a16=_[_0xcd7d('0x37')]({},_0x447a16,_0xdb8bd3[_0xcd7d('0x3b')]);return _0x268a8c[_0xcd7d('0x4b')](_0x447a16);}})[_0xcd7d('0x22')](function(_0x436411){if(_0x436411){_0x5013ff=_0x436411[_0xcd7d('0x31')];if(!_0xdb8bd3[_0xcd7d('0x2b')][_0xcd7d('0x32')](_0xcd7d('0x33'))){_0x447a16[_0xcd7d('0x1d')]=qs['limit'](_0xdb8bd3['query'][_0xcd7d('0x1d')]);_0x447a16[_0xcd7d('0x1b')]=qs[_0xcd7d('0x1b')](_0xdb8bd3[_0xcd7d('0x2b')][_0xcd7d('0x1b')]);}return _0x268a8c[_0xcd7d('0x4b')](_0x447a16);}})[_0xcd7d('0x22')](function(_0x9449c){if(_0x9449c){return _0x9449c?{'count':_0x5013ff,'rows':_0x9449c}:null;}})['then'](respondWithResult(_0x249d40,null))['catch'](handleError(_0x249d40,null));};exports[_0xcd7d('0x4c')]=function(_0x148500,_0x46abae,_0x1102dc){return db[_0xcd7d('0x4d')][_0xcd7d('0x46')]({'where':{'id':_0x148500[_0xcd7d('0x4e')]['id']}})[_0xcd7d('0x22')](handleEntityNotFound(_0x46abae,null))[_0xcd7d('0x22')](function(_0x4b8e40){if(_0x4b8e40){return _0x4b8e40[_0xcd7d('0x4c')](_0x148500[_0xcd7d('0x45')]['ids'],_[_0xcd7d('0x4f')](_0x148500['body'],[_0xcd7d('0x49'),'id'])||{});}})[_0xcd7d('0x22')](respondWithResult(_0x46abae,null))[_0xcd7d('0x3f')](handleError(_0x46abae,null));};exports['getActions']=function(_0x5cae82,_0x1cd1b4,_0x2e611f){var _0x243084={};var _0x16f38b={};var _0x5cd412;var _0x4560e0;return db[_0xcd7d('0x3c')][_0xcd7d('0x50')]({'where':{'id':_0x5cae82[_0xcd7d('0x4e')]['id']}})[_0xcd7d('0x22')](handleEntityNotFound(_0x1cd1b4,null))['then'](function(_0x169d55){if(_0x169d55){_0x5cd412=_0x169d55;_0x16f38b[_0xcd7d('0x2f')]=_[_0xcd7d('0x2c')](db[_0xcd7d('0x4d')][_0xcd7d('0x41')]);_0x16f38b['query']=_[_0xcd7d('0x2c')](_0x5cae82[_0xcd7d('0x2b')]);_0x16f38b[_0xcd7d('0x2d')]=_['intersection'](_0x16f38b[_0xcd7d('0x2f')],_0x16f38b[_0xcd7d('0x2b')]);_0x243084[_0xcd7d('0x30')]=_[_0xcd7d('0x2e')](_0x16f38b['model'],qs['fields'](_0x5cae82[_0xcd7d('0x2b')][_0xcd7d('0x42')]));_0x243084['attributes']=_0x243084[_0xcd7d('0x30')][_0xcd7d('0x31')]?_0x243084[_0xcd7d('0x30')]:_0x16f38b[_0xcd7d('0x2f')];_0x243084['order']=qs[_0xcd7d('0x34')](_0x5cae82[_0xcd7d('0x2b')][_0xcd7d('0x34')]);_0x243084[_0xcd7d('0x36')]=qs[_0xcd7d('0x2d')](_['pick'](_0x5cae82['query'],_0x16f38b[_0xcd7d('0x2d')]));if(_0x5cae82[_0xcd7d('0x2b')][_0xcd7d('0x3a')]){_0x243084[_0xcd7d('0x36')]=_[_0xcd7d('0x37')](_0x243084[_0xcd7d('0x36')],{'$or':_['map'](_0x243084[_0xcd7d('0x30')],function(_0x35f7c6){var _0x48e68e={};_0x48e68e[_0x35f7c6]={'$like':'%'+_0x5cae82[_0xcd7d('0x2b')][_0xcd7d('0x3a')]+'%'};return _0x48e68e;})});}_0x243084=_[_0xcd7d('0x37')]({},_0x243084,_0x5cae82['options']);return _0x5cd412[_0xcd7d('0x51')](_0x243084);}})[_0xcd7d('0x22')](function(_0x3f2883){if(_0x3f2883){_0x4560e0=_0x3f2883[_0xcd7d('0x31')];if(!_0x5cae82[_0xcd7d('0x2b')][_0xcd7d('0x32')](_0xcd7d('0x33'))){_0x243084['limit']=qs[_0xcd7d('0x1d')](_0x5cae82[_0xcd7d('0x2b')][_0xcd7d('0x1d')]);_0x243084[_0xcd7d('0x1b')]=qs['offset'](_0x5cae82[_0xcd7d('0x2b')][_0xcd7d('0x1b')]);}return _0x5cd412['getActions'](_0x243084);}})[_0xcd7d('0x22')](function(_0x5b3919){if(_0x5b3919){return _0x5b3919?{'count':_0x4560e0,'rows':_0x5b3919}:null;}})[_0xcd7d('0x22')](respondWithResult(_0x1cd1b4,null))[_0xcd7d('0x3f')](handleError(_0x1cd1b4,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a2e46f0..c36cc99 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 _0x6742=['./automation.attributes','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x55e74e,_0x45f6c1){var _0x53a40a=function(_0x18b5b9){while(--_0x18b5b9){_0x55e74e['push'](_0x55e74e['shift']());}};_0x53a40a(++_0x45f6c1);}(_0x6742,0xc9));var _0x2674=function(_0x3d55a7,_0x11908a){_0x3d55a7=_0x3d55a7-0x0;var _0x2f8cac=_0x6742[_0x3d55a7];return _0x2f8cac;};'use strict';var _=require(_0x2674('0x0'));var util=require(_0x2674('0x1'));var logger=require(_0x2674('0x2'))(_0x2674('0x3'));var moment=require('moment');var BPromise=require(_0x2674('0x4'));var rp=require(_0x2674('0x5'));var fs=require('fs');var path=require(_0x2674('0x6'));var rimraf=require(_0x2674('0x7'));var config=require('../../config/environment');var attributes=require(_0x2674('0x8'));module['exports']=function(_0x2b2de7,_0x47837c){return _0x2b2de7['define'](_0x2674('0x9'),attributes,{'tableName':_0x2674('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa815=['api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','tools_automations','lodash','util','../../config/logger'];(function(_0x39ce3b,_0x3ae515){var _0x30c8a3=function(_0x3726d9){while(--_0x3726d9){_0x39ce3b['push'](_0x39ce3b['shift']());}};_0x30c8a3(++_0x3ae515);}(_0xa815,0x195));var _0x5a81=function(_0x4cd00b,_0x483633){_0x4cd00b=_0x4cd00b-0x0;var _0x488623=_0xa815[_0x4cd00b];return _0x488623;};'use strict';var _=require(_0x5a81('0x0'));var util=require(_0x5a81('0x1'));var logger=require(_0x5a81('0x2'))(_0x5a81('0x3'));var moment=require(_0x5a81('0x4'));var BPromise=require(_0x5a81('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a81('0x6'));var rimraf=require(_0x5a81('0x7'));var config=require(_0x5a81('0x8'));var attributes=require(_0x5a81('0x9'));module[_0x5a81('0xa')]=function(_0x430887,_0x11dd08){return _0x430887['define']('Automation',attributes,{'tableName':_0x5a81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 8240711..21e7a4e 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x4ad364,_0x34d600){var _0x1ace8f=function(_0x4f4503){while(--_0x4f4503){_0x4ad364['push'](_0x4ad364['shift']());}};_0x1ace8f(++_0x34d600);}(_0xda2d,0x102));var _0xdda2=function(_0x15d618,_0x210953){_0x15d618=_0x15d618-0x0;var _0x17291c=_0xda2d[_0x15d618];return _0x17291c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Automation,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x4253=['then','info','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Automation,\x20%s,\x20%s','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5631b7,_0x4c3c17){var _0xeb1bcb=function(_0x225797){while(--_0x225797){_0x5631b7['push'](_0x5631b7['shift']());}};_0xeb1bcb(++_0x4c3c17);}(_0x4253,0x14c));var _0x3425=function(_0x379a5d,_0x2162ca){_0x379a5d=_0x379a5d-0x0;var _0x2eb427=_0x4253[_0x379a5d];return _0x2eb427;};'use strict';var _=require(_0x3425('0x0'));var util=require(_0x3425('0x1'));var moment=require('moment');var BPromise=require(_0x3425('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3425('0x3'));var db=require(_0x3425('0x4'))['db'];var utils=require(_0x3425('0x5'));var logger=require(_0x3425('0x6'))(_0x3425('0x7'));var config=require(_0x3425('0x8'));var jayson=require(_0x3425('0x9'));var client=jayson[_0x3425('0xa')][_0x3425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53cc1f,_0x1bb3ca,_0x1994b1){return new BPromise(function(_0x33cbc7,_0x4ce62b){return client[_0x3425('0xc')](_0x53cc1f,_0x1994b1)[_0x3425('0xd')](function(_0x5a2bc6){logger[_0x3425('0xe')]('Automation,\x20%s,\x20%s',_0x1bb3ca,'request\x20sent');logger['debug'](_0x3425('0xf'),_0x1bb3ca,_0x3425('0x10'),JSON[_0x3425('0x11')](_0x5a2bc6));if(_0x5a2bc6['error']){if(_0x5a2bc6[_0x3425('0x12')][_0x3425('0x13')]===0x1f4){logger[_0x3425('0x12')]('Automation,\x20%s,\x20%s',_0x1bb3ca,_0x5a2bc6[_0x3425('0x12')][_0x3425('0x14')]);return _0x4ce62b(_0x5a2bc6[_0x3425('0x12')][_0x3425('0x14')]);}logger[_0x3425('0x12')](_0x3425('0x15'),_0x1bb3ca,_0x5a2bc6[_0x3425('0x12')]['message']);return _0x33cbc7(_0x5a2bc6[_0x3425('0x12')]['message']);}else{logger[_0x3425('0xe')](_0x3425('0x15'),_0x1bb3ca,'request\x20sent');_0x33cbc7(_0x5a2bc6[_0x3425('0x16')][_0x3425('0x14')]);}})['catch'](function(_0x13aabd){logger['error'](_0x3425('0x15'),_0x1bb3ca,_0x13aabd);_0x4ce62b(_0x13aabd);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4722097..8757df4 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 _0xed95=['isAuthenticated','show','/:id/conditions','/:id/actions','getActions','create','post','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','/:id'];(function(_0x3a3ba2,_0x1037c1){var _0x4f63fd=function(_0x4a3ea7){while(--_0x4a3ea7){_0x3a3ba2['push'](_0x3a3ba2['shift']());}};_0x4f63fd(++_0x1037c1);}(_0xed95,0xb9));var _0x5ed9=function(_0x16c9dc,_0x33bdd3){_0x16c9dc=_0x16c9dc-0x0;var _0x4cdac9=_0xed95[_0x16c9dc];return _0x4cdac9;};'use strict';var multer=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var path=require(_0x5ed9('0x2'));var timeout=require(_0x5ed9('0x3'));var express=require(_0x5ed9('0x4'));var router=express[_0x5ed9('0x5')]();var fs_extra=require(_0x5ed9('0x6'));var auth=require(_0x5ed9('0x7'));var interaction=require(_0x5ed9('0x8'));var config=require(_0x5ed9('0x9'));var controller=require(_0x5ed9('0xa'));router[_0x5ed9('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ed9('0xb')](_0x5ed9('0xc'),auth[_0x5ed9('0xd')](),controller[_0x5ed9('0xe')]);router[_0x5ed9('0xb')](_0x5ed9('0xf'),auth['isAuthenticated'](),controller['getConditions']);router[_0x5ed9('0xb')](_0x5ed9('0x10'),auth[_0x5ed9('0xd')](),controller[_0x5ed9('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5ed9('0x12')]);router[_0x5ed9('0x13')](_0x5ed9('0xf'),auth[_0x5ed9('0xd')](),controller['addConditions']);router[_0x5ed9('0x13')](_0x5ed9('0x10'),auth[_0x5ed9('0xd')](),controller['addActions']);router['put'](_0x5ed9('0xc'),auth[_0x5ed9('0xd')](),controller['update']);router[_0x5ed9('0x14')](_0x5ed9('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5ed9('0x15')]=router; \ No newline at end of file +var _0x16dc=['../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','/:id/conditions','/:id/actions','getActions','post','addConditions','addActions','put','update','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_0x16dc,0x1ef));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc16d('0x0'));var path=require(_0xc16d('0x1'));var timeout=require(_0xc16d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc16d('0x3'));var auth=require(_0xc16d('0x4'));var interaction=require(_0xc16d('0x5'));var config=require('../../config/environment');var controller=require(_0xc16d('0x6'));router[_0xc16d('0x7')]('/',auth[_0xc16d('0x8')](),controller[_0xc16d('0x9')]);router[_0xc16d('0x7')](_0xc16d('0xa'),auth[_0xc16d('0x8')](),controller['show']);router[_0xc16d('0x7')](_0xc16d('0xb'),auth[_0xc16d('0x8')](),controller['getConditions']);router[_0xc16d('0x7')](_0xc16d('0xc'),auth[_0xc16d('0x8')](),controller[_0xc16d('0xd')]);router[_0xc16d('0xe')]('/',auth[_0xc16d('0x8')](),controller['create']);router[_0xc16d('0xe')](_0xc16d('0xb'),auth[_0xc16d('0x8')](),controller[_0xc16d('0xf')]);router[_0xc16d('0xe')](_0xc16d('0xc'),auth[_0xc16d('0x8')](),controller[_0xc16d('0x10')]);router[_0xc16d('0x11')]('/:id',auth[_0xc16d('0x8')](),controller[_0xc16d('0x12')]);router['delete'](_0xc16d('0xa'),auth[_0xc16d('0x8')](),controller[_0xc16d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 98023a4..a8836ce 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 _0x0d82=['#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x0d82,0xf1));var _0x20d8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0d82[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x20d8('0x0')],'unique':_0x20d8('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x20d8('0x2')](_0x20d8('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x20d8('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x20d8('0x5')](0x4)[_0x20d8('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x20d8('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x20d8('0x5')](0x3)[_0x20d8('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20d8('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x20d8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20d8('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x20d8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x20d8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20d8('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x20d8('0x5')](0x5)[_0x20d8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20d8('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x20d8('0x5')](0x3)[_0x20d8('0x6')],'defaultValue':0x3,'comment':_0x20d8('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x20d8('0x5')](0x5)[_0x20d8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20d8('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x20d8('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x20d8('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x20d8('0x0')],'defaultValue':_0x20d8('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x20d8('0x2')](_0x20d8('0xf'),_0x20d8('0x10'),_0x20d8('0x11')),'defaultValue':_0x20d8('0xf')},'dialAMDActive':{'type':Sequelize[_0x20d8('0x4')],'defaultValue':0x0,'comment':_0x20d8('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x20d8('0x5')](0x9)[_0x20d8('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x20d8('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x20d8('0x5')](0x9)[_0x20d8('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x20d8('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x20d8('0x5')](0x9)[_0x20d8('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x20d8('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x20d8('0x5')](0x9)[_0x20d8('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x20d8('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x20d8('0x5')](0x9)[_0x20d8('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x20d8('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x20d8('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x20d8('0x5')](0x9)[_0x20d8('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x20d8('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x20d8('0x1a'),_0x20d8('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x20d8('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x20d8('0x5')](0x3)[_0x20d8('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x20d8('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x20d8('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20d8('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x20d8('0x5')](0x5)[_0x20d8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x20d8('0x5')](0x3)[_0x20d8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x20d8('0x5')](0x5)[_0x20d8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20d8('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x20d8('0x5')](0x3)[_0x20d8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x20d8('0x5')](0x5)[_0x20d8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20d8('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x20d8('0x5')](0x3)[_0x20d8('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20d8('0x20')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20d8('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x20d8('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20d8('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x20d8('0x5')](0x5)[_0x20d8('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20d8('0x23')}}; \ No newline at end of file +var _0xa458=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x27f9ff,_0x26b9c){var _0x349f72=function(_0xfe811){while(--_0xfe811){_0x27f9ff['push'](_0x27f9ff['shift']());}};_0x349f72(++_0x26b9c);}(_0xa458,0x114));var _0x8a45=function(_0x114914,_0xac5992){_0x114914=_0x114914-0x0;var _0x2b39b6=_0xa458[_0x114914];return _0x2b39b6;};'use strict';var Sequelize=require(_0x8a45('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a45('0x1')],'unique':_0x8a45('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x8a45('0x3')),'allowNull':![],'defaultValue':_0x8a45('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8a45('0x4')],'defaultValue':0x0,'comment':_0x8a45('0x5')},'limitCalls':{'type':Sequelize[_0x8a45('0x6')](0x4)[_0x8a45('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8a45('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8a45('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8a45('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a45('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a45('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8a45('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a45('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8a45('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8a45('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a45('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8a45('0xd')},'dialTimezone':{'type':Sequelize[_0x8a45('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x8a45('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8a45('0xf'),_0x8a45('0x10'),'onlyIfOpen'),'defaultValue':_0x8a45('0xf')},'dialAMDActive':{'type':Sequelize[_0x8a45('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x8a45('0x6')](0x9)[_0x8a45('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8a45('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x8a45('0x6')](0x9)[_0x8a45('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8a45('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8a45('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8a45('0x6')](0x9)[_0x8a45('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8a45('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8a45('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8a45('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8a45('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8a45('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8a45('0x6')](0x9)[_0x8a45('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8a45('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8a45('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8a45('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8a45('0x6')](0x9)[_0x8a45('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8a45('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8a45('0x19')](_0x8a45('0x1a'),_0x8a45('0x1b')),'defaultValue':_0x8a45('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8a45('0x1c')},'dialCutDigit':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a45('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8a45('0x6')](0x5)[_0x8a45('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a45('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a45('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8a45('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a45('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8a45('0x6')](0x5)[_0x8a45('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8a45('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a45('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8a45('0x6')](0x5)[_0x8a45('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a45('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8a45('0x6')](0x3)[_0x8a45('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8a45('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8a45('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4c00d81..4478478 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 _0x867f=['UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getHoppers','CmHopper','order','pick','CampaignId','findAll','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','rows','CmHopperBlack','CmList','getLists','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ListId','select','field','NOW()','scheduledAt','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','ci.item','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','get','IvrCampaigns','destroy','stack','name','send','index','map','Campaign','rawAttributes','fieldName','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','sort','merge','where','type','filter','options','includeAll','include','catch','show','params','intersection','fields','find','create','user','role','UserProfileSection','autoAssociation'];(function(_0x1f3280,_0xec6845){var _0x50770f=function(_0x3edb5b){while(--_0x3edb5b){_0x1f3280['push'](_0x1f3280['shift']());}};_0x50770f(++_0xec6845);}(_0x867f,0xdc));var _0xf867=function(_0x40c043,_0x1d064e){_0x40c043=_0x40c043-0x0;var _0x5c2c8d=_0x867f[_0x40c043];return _0x5c2c8d;};'use strict';var emlformat=require(_0xf867('0x0'));var rimraf=require(_0xf867('0x1'));var zipdir=require(_0xf867('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf867('0x3'));var moment=require(_0xf867('0x4'));var BPromise=require(_0xf867('0x5'));var Mustache=require('mustache');var util=require(_0xf867('0x6'));var path=require('path');var sox=require(_0xf867('0x7'));var csv=require(_0xf867('0x8'));var ejs=require(_0xf867('0x9'));var fs=require('fs');var fs_extra=require(_0xf867('0xa'));var _=require(_0xf867('0xb'));var squel=require(_0xf867('0xc'));var crypto=require(_0xf867('0xd'));var jsforce=require(_0xf867('0xe'));var deskjs=require(_0xf867('0xf'));var toCsv=require(_0xf867('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf867('0x10'));var authService=require(_0xf867('0x11'));var qs=require(_0xf867('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf867('0x13'))(_0xf867('0x14'));var utils=require('../../config/utils');var config=require(_0xf867('0x15'));var licenseUtil=require(_0xf867('0x16'));var db=require(_0xf867('0x17'))['db'];function respondWithStatusCode(_0x457bd6,_0x4f5297){_0x4f5297=_0x4f5297||0xcc;return function(_0x8059d0){if(_0x8059d0){return _0x457bd6[_0xf867('0x18')](_0x4f5297);}return _0x457bd6[_0xf867('0x19')](_0x4f5297)[_0xf867('0x1a')]();};}function respondWithResult(_0xc29586,_0x3ed550){_0x3ed550=_0x3ed550||0xc8;return function(_0x37b752){if(_0x37b752){return _0xc29586[_0xf867('0x19')](_0x3ed550)[_0xf867('0x1b')](_0x37b752);}};}function respondWithFilteredResult(_0x1e5728,_0x4de424){return function(_0x55fb64){if(_0x55fb64){var _0x554d6a=typeof _0x4de424[_0xf867('0x1c')]===_0xf867('0x1d')&&typeof _0x4de424[_0xf867('0x1e')]===_0xf867('0x1d');var _0x13f08f=_0x55fb64[_0xf867('0x1f')];var _0x2b98cd=_0x554d6a?0x0:_0x4de424['offset'];var _0x2c76c1=_0x554d6a?_0x55fb64[_0xf867('0x1f')]:_0x4de424[_0xf867('0x1c')]+_0x4de424[_0xf867('0x1e')];var _0x348e70;if(_0x2c76c1>=_0x13f08f){_0x2c76c1=_0x13f08f;_0x348e70=0xc8;}else{_0x348e70=0xce;}_0x1e5728['status'](_0x348e70);return _0x1e5728[_0xf867('0x20')]('Content-Range',_0x2b98cd+'-'+_0x2c76c1+'/'+_0x13f08f)[_0xf867('0x1b')](_0x55fb64);}return null;};}function patchUpdates(_0x272be1){return function(_0x15ca62){try{jsonpatch['apply'](_0x15ca62,_0x272be1,!![]);}catch(_0x34ab76){return BPromise[_0xf867('0x21')](_0x34ab76);}return _0x15ca62[_0xf867('0x22')]();};}function saveUpdates(_0x2dcb41,_0x83ba8c){return function(_0x2546fa){if(_0x2546fa){return _0x2546fa[_0xf867('0x23')](_0x2dcb41)[_0xf867('0x24')](function(_0x55d21e){return _0x55d21e;});}return null;};}function removeEntity(_0x281374,_0x13ed06){return function(_0x3a54bc){if(_0x3a54bc){return _0x3a54bc['destroy']()[_0xf867('0x24')](function(){var _0x9d52e4=_0x3a54bc[_0xf867('0x25')]({'plain':!![]});var _0x447f6e=_0xf867('0x26');return db['UserProfileResource'][_0xf867('0x27')]({'where':{'type':_0x447f6e,'resourceId':_0x9d52e4['id']}})[_0xf867('0x24')](function(){return _0x3a54bc;});})[_0xf867('0x24')](function(){_0x281374[_0xf867('0x19')](0xcc)[_0xf867('0x1a')]();});}};}function handleEntityNotFound(_0x4c2d1b,_0x1dec3d){return function(_0xf3f726){if(!_0xf3f726){_0x4c2d1b[_0xf867('0x18')](0x194);}return _0xf3f726;};}function handleError(_0x20594e,_0x2765cf){_0x2765cf=_0x2765cf||0x1f4;return function(_0x17335e){logger['error'](_0x17335e[_0xf867('0x28')]);if(_0x17335e[_0xf867('0x29')]){delete _0x17335e[_0xf867('0x29')];}_0x20594e['status'](_0x2765cf)[_0xf867('0x2a')](_0x17335e);};}exports[_0xf867('0x2b')]=function(_0x298406,_0x386051){var _0x55616d={},_0x3fd846={},_0x178316={'count':0x0,'rows':[]};var _0xaeb33b=_[_0xf867('0x2c')](db[_0xf867('0x2d')][_0xf867('0x2e')],function(_0x3ec1fc){return{'name':_0x3ec1fc[_0xf867('0x2f')],'type':_0x3ec1fc['type'][_0xf867('0x30')]};});_0x3fd846['model']=_['map'](_0xaeb33b,_0xf867('0x29'));_0x3fd846[_0xf867('0x31')]=_[_0xf867('0x32')](_0x298406[_0xf867('0x31')]);_0x3fd846[_0xf867('0x33')]=_['intersection'](_0x3fd846[_0xf867('0x34')],_0x3fd846[_0xf867('0x31')]);_0x55616d['attributes']=_['intersection'](_0x3fd846[_0xf867('0x34')],qs['fields'](_0x298406['query']['fields']));_0x55616d[_0xf867('0x35')]=_0x55616d['attributes'][_0xf867('0x36')]?_0x55616d[_0xf867('0x35')]:_0x3fd846[_0xf867('0x34')];if(!_0x298406[_0xf867('0x31')][_0xf867('0x37')](_0xf867('0x38'))){_0x55616d[_0xf867('0x1e')]=qs['limit'](_0x298406[_0xf867('0x31')]['limit']);_0x55616d[_0xf867('0x1c')]=qs[_0xf867('0x1c')](_0x298406['query'][_0xf867('0x1c')]);}_0x55616d['order']=qs[_0xf867('0x39')](_0x298406[_0xf867('0x31')][_0xf867('0x39')]);_0x55616d['where']=qs[_0xf867('0x33')](_['pick'](_0x298406[_0xf867('0x31')],_0x3fd846[_0xf867('0x33')]),_0xaeb33b);if(_0x298406['query']['filter']){_0x55616d['where']=_[_0xf867('0x3a')](_0x55616d[_0xf867('0x3b')],{'$or':_[_0xf867('0x2c')](_0xaeb33b,function(_0x5efa28){if(_0x5efa28[_0xf867('0x3c')]!=='VIRTUAL'){var _0x56fa25={};_0x56fa25[_0x5efa28[_0xf867('0x29')]]={'$like':'%'+_0x298406[_0xf867('0x31')][_0xf867('0x3d')]+'%'};return _0x56fa25;}})});}_0x55616d=_[_0xf867('0x3a')]({},_0x55616d,_0x298406[_0xf867('0x3e')]);var _0x50d764={'where':_0x55616d['where']};return db['Campaign'][_0xf867('0x1f')](_0x50d764)[_0xf867('0x24')](function(_0x362688){_0x178316[_0xf867('0x1f')]=_0x362688;if(_0x298406[_0xf867('0x31')][_0xf867('0x3f')]){_0x55616d[_0xf867('0x40')]=[{'all':!![]}];}return db[_0xf867('0x2d')]['findAll'](_0x55616d);})[_0xf867('0x24')](function(_0x28995a){_0x178316['rows']=_0x28995a;return _0x178316;})[_0xf867('0x24')](respondWithFilteredResult(_0x386051,_0x55616d))[_0xf867('0x41')](handleError(_0x386051,null));};exports[_0xf867('0x42')]=function(_0x2a8c70,_0x2424ea){var _0x2225dd={'raw':![],'where':{'id':_0x2a8c70[_0xf867('0x43')]['id']}},_0x1587ff={};_0x1587ff[_0xf867('0x34')]=_[_0xf867('0x32')](db[_0xf867('0x2d')][_0xf867('0x2e')]);_0x1587ff[_0xf867('0x31')]=_[_0xf867('0x32')](_0x2a8c70[_0xf867('0x31')]);_0x1587ff['filters']=_[_0xf867('0x44')](_0x1587ff[_0xf867('0x34')],_0x1587ff[_0xf867('0x31')]);_0x2225dd[_0xf867('0x35')]=_[_0xf867('0x44')](_0x1587ff[_0xf867('0x34')],qs[_0xf867('0x45')](_0x2a8c70[_0xf867('0x31')][_0xf867('0x45')]));_0x2225dd[_0xf867('0x35')]=_0x2225dd[_0xf867('0x35')][_0xf867('0x36')]?_0x2225dd[_0xf867('0x35')]:_0x1587ff[_0xf867('0x34')];if(_0x2a8c70[_0xf867('0x31')][_0xf867('0x3f')]){_0x2225dd[_0xf867('0x40')]=[{'all':!![]}];}_0x2225dd=_['merge']({},_0x2225dd,_0x2a8c70[_0xf867('0x3e')]);return db[_0xf867('0x2d')][_0xf867('0x46')](_0x2225dd)[_0xf867('0x24')](handleEntityNotFound(_0x2424ea,null))['then'](respondWithResult(_0x2424ea,null))[_0xf867('0x41')](handleError(_0x2424ea,null));};exports[_0xf867('0x47')]=function(_0x17c6ff,_0x416e46){return db[_0xf867('0x2d')]['create'](_0x17c6ff['body'],{})[_0xf867('0x24')](function(_0x26275e){var _0x1e0810=_0x17c6ff[_0xf867('0x48')][_0xf867('0x25')]({'plain':!![]});if(!_0x1e0810)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e0810[_0xf867('0x49')]===_0xf867('0x48')){var _0x378c4b=_0x26275e['get']({'plain':!![]});var _0x545353=_0xf867('0x26');return db[_0xf867('0x4a')]['find']({'where':{'name':_0x545353,'userProfileId':_0x1e0810['userProfileId']},'raw':!![]})['then'](function(_0x218c42){if(_0x218c42&&_0x218c42[_0xf867('0x4b')]===0x0){return db[_0xf867('0x4c')][_0xf867('0x47')]({'name':_0x378c4b['name'],'resourceId':_0x378c4b['id'],'type':_0x218c42[_0xf867('0x29')],'sectionId':_0x218c42['id']},{})[_0xf867('0x24')](function(){return _0x26275e;});}else{return _0x26275e;}})[_0xf867('0x41')](function(_0x4475db){logger[_0xf867('0x4d')](_0xf867('0x4e'),_0x4475db);throw _0x4475db;});}return _0x26275e;})[_0xf867('0x24')](respondWithResult(_0x416e46,0xc9))[_0xf867('0x41')](handleError(_0x416e46,null));};exports[_0xf867('0x4f')]=function(_0x22645b,_0x310021){var _0x5471f6={'where':{'id':_0x22645b[_0xf867('0x43')]['id']}},_0xb500c1={};_0xb500c1['model']=_[_0xf867('0x32')](db[_0xf867('0x2d')]['rawAttributes']);_0x5471f6[_0xf867('0x35')]=_['intersection'](_0xb500c1['model'],qs['fields'](_0x22645b[_0xf867('0x31')][_0xf867('0x45')]));_0x5471f6[_0xf867('0x35')]=_0x5471f6[_0xf867('0x35')]['length']?_0x5471f6[_0xf867('0x35')]:_0xb500c1[_0xf867('0x34')];if(_0x22645b[_0xf867('0x31')][_0xf867('0x3f')]){_0x5471f6[_0xf867('0x40')]=[{'all':!![]}];}_0x5471f6=_[_0xf867('0x3a')]({},_0x5471f6,_0x22645b[_0xf867('0x3e')]);return db[_0xf867('0x2d')]['find'](_0x5471f6)[_0xf867('0x24')](handleEntityNotFound(_0x310021,null))[_0xf867('0x24')](function(_0x27906c){if(_0x27906c){var _0x5964ea=_0x27906c[_0xf867('0x25')]({'plain':!![]});_0x5964ea=qs[_0xf867('0x50')](_0x5964ea,['id',_0xf867('0x51'),_0xf867('0x52')]);_0x22645b['body']=_['omit'](_0x22645b[_0xf867('0x53')],['id','createdAt','updatedAt']);return db[_0xf867('0x2d')][_0xf867('0x47')](_['merge'](_0x5964ea,_0x22645b[_0xf867('0x53')]),{'include':_0x22645b[_0xf867('0x31')][_0xf867('0x3f')]?[{'all':!![]}]:undefined})[_0xf867('0x24')](function(_0x307cbb){var _0x544170=_0x22645b[_0xf867('0x48')][_0xf867('0x25')]({'plain':!![]});if(!_0x544170)throw new Error(_0xf867('0x54'));if(_0x544170[_0xf867('0x49')]===_0xf867('0x48')){var _0x45a9f6=_0x307cbb['get']({'plain':!![]});var _0xeb9bb3=_0xf867('0x26');return db['UserProfileSection'][_0xf867('0x46')]({'where':{'name':_0xeb9bb3,'userProfileId':_0x544170[_0xf867('0x55')]},'raw':!![]})[_0xf867('0x24')](function(_0x18b928){if(_0x18b928&&_0x18b928[_0xf867('0x4b')]===0x0){return db[_0xf867('0x4c')][_0xf867('0x47')]({'name':_0x45a9f6[_0xf867('0x29')],'resourceId':_0x45a9f6['id'],'type':_0x18b928[_0xf867('0x29')],'sectionId':_0x18b928['id']},{})[_0xf867('0x24')](function(){return _0x307cbb;});}else{return _0x307cbb;}})['catch'](function(_0x32db61){logger[_0xf867('0x4d')](_0xf867('0x4e'),_0x32db61);throw _0x32db61;});}return _0x307cbb;});}})['then'](respondWithResult(_0x310021,0xc9))[_0xf867('0x41')](handleError(_0x310021,null));};exports[_0xf867('0x23')]=function(_0x445ce7,_0x43e0a9){if(_0x445ce7[_0xf867('0x53')]['id']){delete _0x445ce7[_0xf867('0x53')]['id'];}return db[_0xf867('0x2d')][_0xf867('0x46')]({'where':{'id':_0x445ce7[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x43e0a9,null))[_0xf867('0x24')](saveUpdates(_0x445ce7['body'],null))[_0xf867('0x24')](respondWithResult(_0x43e0a9,null))[_0xf867('0x41')](handleError(_0x43e0a9,null));};exports[_0xf867('0x27')]=function(_0x41ee3a,_0x37c936){return db[_0xf867('0x2d')][_0xf867('0x46')]({'where':{'id':_0x41ee3a['params']['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x37c936,null))['then'](removeEntity(_0x37c936,null))[_0xf867('0x41')](handleError(_0x37c936,null));};exports[_0xf867('0x56')]=function(_0x10b42e,_0x3ffb51,_0xdb6a4b){var _0x1f7d98={'raw':!![],'where':{}};var _0x428a49={};var _0x1d0b5a={'count':0x0,'rows':[]};return db[_0xf867('0x2d')]['findOne']({'where':{'id':_0x10b42e[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x3ffb51,null))[_0xf867('0x24')](function(_0x2a5195){if(_0x2a5195){_0x428a49[_0xf867('0x34')]=_[_0xf867('0x32')](db[_0xf867('0x57')]['rawAttributes']);_0x428a49[_0xf867('0x31')]=_[_0xf867('0x32')](_0x10b42e[_0xf867('0x31')]);_0x428a49[_0xf867('0x33')]=_[_0xf867('0x44')](_0x428a49[_0xf867('0x34')],_0x428a49[_0xf867('0x31')]);_0x1f7d98[_0xf867('0x35')]=_[_0xf867('0x44')](_0x428a49[_0xf867('0x34')],qs['fields'](_0x10b42e['query'][_0xf867('0x45')]));_0x1f7d98[_0xf867('0x35')]=_0x1f7d98[_0xf867('0x35')][_0xf867('0x36')]?_0x1f7d98[_0xf867('0x35')]:_0x428a49['model'];if(!_0x10b42e[_0xf867('0x31')][_0xf867('0x37')]('nolimit')){_0x1f7d98[_0xf867('0x1e')]=qs[_0xf867('0x1e')](_0x10b42e[_0xf867('0x31')][_0xf867('0x1e')]);_0x1f7d98[_0xf867('0x1c')]=qs['offset'](_0x10b42e[_0xf867('0x31')][_0xf867('0x1c')]);}_0x1f7d98[_0xf867('0x58')]=qs[_0xf867('0x39')](_0x10b42e['query']['sort']);_0x1f7d98['where']=qs['filters'](_[_0xf867('0x59')](_0x10b42e[_0xf867('0x31')],_0x428a49[_0xf867('0x33')]));_0x1f7d98['where'][_0xf867('0x5a')]=_0x2a5195['id'];if(_0x10b42e[_0xf867('0x31')][_0xf867('0x3d')]){_0x1f7d98[_0xf867('0x3b')]=_['merge'](_0x1f7d98['where'],{'$or':_[_0xf867('0x2c')](_0x1f7d98['attributes'],function(_0x501b33){var _0x2146d7={};_0x2146d7[_0x501b33]={'$like':'%'+_0x10b42e[_0xf867('0x31')][_0xf867('0x3d')]+'%'};return _0x2146d7;})});}_0x1f7d98=_[_0xf867('0x3a')]({},_0x1f7d98,_0x10b42e['options']);return db['CmHopper'][_0xf867('0x1f')]({'where':_0x1f7d98[_0xf867('0x3b')]})[_0xf867('0x24')](function(_0x24a68b){_0x1d0b5a[_0xf867('0x1f')]=_0x24a68b;if(_0x10b42e['query']['includeAll']){_0x1f7d98[_0xf867('0x40')]=[{'all':!![]}];}return db[_0xf867('0x57')][_0xf867('0x5b')](_0x1f7d98);})[_0xf867('0x24')](function(_0x5bc6c0){_0x1d0b5a['rows']=_0x5bc6c0;return _0x1d0b5a;});}})[_0xf867('0x24')](respondWithFilteredResult(_0x3ffb51,_0x1f7d98))[_0xf867('0x41')](handleError(_0x3ffb51,null));};exports['getHopperHistories']=function(_0x32a29c,_0x6dd8fe,_0x4fac50){var _0x220568={'raw':!![],'where':{}};var _0x102ae3={};var _0x45f8cb={'count':0x0,'rows':[]};return db[_0xf867('0x2d')][_0xf867('0x5c')]({'where':{'id':_0x32a29c['params']['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x6dd8fe,null))[_0xf867('0x24')](function(_0xd3c213){if(_0xd3c213){_0x102ae3['model']=_[_0xf867('0x32')](db[_0xf867('0x5d')][_0xf867('0x2e')]);_0x102ae3['query']=_['keys'](_0x32a29c['query']);_0x102ae3[_0xf867('0x33')]=_[_0xf867('0x44')](_0x102ae3[_0xf867('0x34')],_0x102ae3['query']);_0x220568['attributes']=_['intersection'](_0x102ae3['model'],qs[_0xf867('0x45')](_0x32a29c[_0xf867('0x31')]['fields']));_0x220568[_0xf867('0x35')]=_0x220568[_0xf867('0x35')][_0xf867('0x36')]?_0x220568[_0xf867('0x35')]:_0x102ae3['model'];if(!_0x32a29c[_0xf867('0x31')]['hasOwnProperty'](_0xf867('0x38'))){_0x220568['limit']=qs[_0xf867('0x1e')](_0x32a29c[_0xf867('0x31')][_0xf867('0x1e')]);_0x220568[_0xf867('0x1c')]=qs[_0xf867('0x1c')](_0x32a29c['query'][_0xf867('0x1c')]);}_0x220568[_0xf867('0x58')]=qs['sort'](_0x32a29c[_0xf867('0x31')][_0xf867('0x39')]);_0x220568[_0xf867('0x3b')]=qs[_0xf867('0x33')](_['pick'](_0x32a29c[_0xf867('0x31')],_0x102ae3['filters']));_0x220568[_0xf867('0x3b')]['CampaignId']=_0xd3c213['id'];if(_0x32a29c['query'][_0xf867('0x3d')]){_0x220568['where']=_['merge'](_0x220568['where'],{'$or':_[_0xf867('0x2c')](_0x220568[_0xf867('0x35')],function(_0x41f5c6){var _0x495a60={};_0x495a60[_0x41f5c6]={'$like':'%'+_0x32a29c[_0xf867('0x31')]['filter']+'%'};return _0x495a60;})});}_0x220568=_[_0xf867('0x3a')]({},_0x220568,_0x32a29c['options']);return db['CmHopperHistory'][_0xf867('0x1f')]({'where':_0x220568[_0xf867('0x3b')]})[_0xf867('0x24')](function(_0x15b941){_0x45f8cb[_0xf867('0x1f')]=_0x15b941;if(_0x32a29c[_0xf867('0x31')]['includeAll']){_0x220568['include']=[{'all':!![]}];}return db[_0xf867('0x5d')][_0xf867('0x5b')](_0x220568);})[_0xf867('0x24')](function(_0x41bc22){_0x45f8cb['rows']=_0x41bc22;return _0x45f8cb;});}})[_0xf867('0x24')](respondWithFilteredResult(_0x6dd8fe,_0x220568))['catch'](handleError(_0x6dd8fe,null));};exports[_0xf867('0x5e')]=function(_0x47a673,_0x2d541b,_0xefca1a){var _0x37a29e={'raw':!![],'where':{}};var _0x26f767={};var _0x568552={'count':0x0,'rows':[]};return db[_0xf867('0x2d')]['findOne']({'where':{'id':_0x47a673[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x2d541b,null))['then'](function(_0x26d91b){if(_0x26d91b){_0x26f767[_0xf867('0x34')]=_[_0xf867('0x32')](db[_0xf867('0x5f')][_0xf867('0x2e')]);_0x26f767[_0xf867('0x31')]=_[_0xf867('0x32')](_0x47a673[_0xf867('0x31')]);_0x26f767[_0xf867('0x33')]=_[_0xf867('0x44')](_0x26f767['model'],_0x26f767[_0xf867('0x31')]);_0x37a29e[_0xf867('0x35')]=_[_0xf867('0x44')](_0x26f767[_0xf867('0x34')],qs[_0xf867('0x45')](_0x47a673[_0xf867('0x31')][_0xf867('0x45')]));_0x37a29e['attributes']=_0x37a29e[_0xf867('0x35')][_0xf867('0x36')]?_0x37a29e['attributes']:_0x26f767['model'];if(!_0x47a673[_0xf867('0x31')][_0xf867('0x37')]('nolimit')){_0x37a29e['limit']=qs[_0xf867('0x1e')](_0x47a673[_0xf867('0x31')]['limit']);_0x37a29e[_0xf867('0x1c')]=qs[_0xf867('0x1c')](_0x47a673['query'][_0xf867('0x1c')]);}_0x37a29e['order']=qs[_0xf867('0x39')](_0x47a673[_0xf867('0x31')][_0xf867('0x39')]);_0x37a29e['where']=qs[_0xf867('0x33')](_[_0xf867('0x59')](_0x47a673[_0xf867('0x31')],_0x26f767['filters']));_0x37a29e[_0xf867('0x3b')][_0xf867('0x5a')]=_0x26d91b['id'];if(_0x47a673['query'][_0xf867('0x3d')]){_0x37a29e[_0xf867('0x3b')]=_[_0xf867('0x3a')](_0x37a29e[_0xf867('0x3b')],{'$or':_['map'](_0x37a29e['attributes'],function(_0x198fd4){var _0x55bfd6={};_0x55bfd6[_0x198fd4]={'$like':'%'+_0x47a673[_0xf867('0x31')][_0xf867('0x3d')]+'%'};return _0x55bfd6;})});}_0x37a29e=_[_0xf867('0x3a')]({},_0x37a29e,_0x47a673[_0xf867('0x3e')]);return db[_0xf867('0x5f')][_0xf867('0x1f')]({'where':_0x37a29e['where']})[_0xf867('0x24')](function(_0x27f3c1){_0x568552[_0xf867('0x1f')]=_0x27f3c1;if(_0x47a673[_0xf867('0x31')][_0xf867('0x3f')]){_0x37a29e[_0xf867('0x40')]=[{'all':!![]}];}return db[_0xf867('0x5f')][_0xf867('0x5b')](_0x37a29e);})['then'](function(_0x3b3866){_0x568552[_0xf867('0x60')]=_0x3b3866;return _0x568552;});}})[_0xf867('0x24')](respondWithFilteredResult(_0x2d541b,_0x37a29e))[_0xf867('0x41')](handleError(_0x2d541b,null));};exports['getHopperBlacks']=function(_0x31fa81,_0x1b4118,_0x366e60){var _0x353758={'raw':!![],'where':{}};var _0x4dcabe={};var _0x2c0103={'count':0x0,'rows':[]};return db[_0xf867('0x2d')]['findOne']({'where':{'id':_0x31fa81['params']['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x1b4118,null))[_0xf867('0x24')](function(_0x179da5){if(_0x179da5){_0x4dcabe[_0xf867('0x34')]=_[_0xf867('0x32')](db[_0xf867('0x61')][_0xf867('0x2e')]);_0x4dcabe['query']=_['keys'](_0x31fa81[_0xf867('0x31')]);_0x4dcabe[_0xf867('0x33')]=_['intersection'](_0x4dcabe[_0xf867('0x34')],_0x4dcabe[_0xf867('0x31')]);_0x353758[_0xf867('0x35')]=_[_0xf867('0x44')](_0x4dcabe[_0xf867('0x34')],qs['fields'](_0x31fa81[_0xf867('0x31')][_0xf867('0x45')]));_0x353758[_0xf867('0x35')]=_0x353758[_0xf867('0x35')]['length']?_0x353758[_0xf867('0x35')]:_0x4dcabe[_0xf867('0x34')];if(!_0x31fa81[_0xf867('0x31')]['hasOwnProperty'](_0xf867('0x38'))){_0x353758[_0xf867('0x1e')]=qs[_0xf867('0x1e')](_0x31fa81[_0xf867('0x31')][_0xf867('0x1e')]);_0x353758[_0xf867('0x1c')]=qs[_0xf867('0x1c')](_0x31fa81[_0xf867('0x31')][_0xf867('0x1c')]);}_0x353758[_0xf867('0x58')]=qs[_0xf867('0x39')](_0x31fa81[_0xf867('0x31')][_0xf867('0x39')]);_0x353758[_0xf867('0x3b')]=qs[_0xf867('0x33')](_['pick'](_0x31fa81[_0xf867('0x31')],_0x4dcabe['filters']));_0x353758[_0xf867('0x3b')][_0xf867('0x5a')]=_0x179da5['id'];if(_0x31fa81[_0xf867('0x31')]['filter']){_0x353758[_0xf867('0x3b')]=_[_0xf867('0x3a')](_0x353758[_0xf867('0x3b')],{'$or':_['map'](_0x353758['attributes'],function(_0x307134){var _0x31edf3={};_0x31edf3[_0x307134]={'$like':'%'+_0x31fa81[_0xf867('0x31')]['filter']+'%'};return _0x31edf3;})});}_0x353758=_['merge']({},_0x353758,_0x31fa81[_0xf867('0x3e')]);return db['CmHopperBlack'][_0xf867('0x1f')]({'where':_0x353758[_0xf867('0x3b')]})[_0xf867('0x24')](function(_0x55dcf0){_0x2c0103[_0xf867('0x1f')]=_0x55dcf0;if(_0x31fa81[_0xf867('0x31')][_0xf867('0x3f')]){_0x353758[_0xf867('0x40')]=[{'all':!![]}];}return db[_0xf867('0x61')][_0xf867('0x5b')](_0x353758);})[_0xf867('0x24')](function(_0x3e5c41){_0x2c0103[_0xf867('0x60')]=_0x3e5c41;return _0x2c0103;});}})[_0xf867('0x24')](respondWithFilteredResult(_0x1b4118,_0x353758))[_0xf867('0x41')](handleError(_0x1b4118,null));};exports['getLists']=function(_0x12a6b5,_0x4a942d,_0x5bfa26){var _0x2ae0cc={};var _0x6a8334={};var _0x32eb01;var _0x22c7bd;return db['Campaign'][_0xf867('0x5c')]({'where':{'id':_0x12a6b5[_0xf867('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a942d,null))[_0xf867('0x24')](function(_0x90bf2b){if(_0x90bf2b){_0x32eb01=_0x90bf2b;_0x6a8334[_0xf867('0x34')]=_['keys'](db[_0xf867('0x62')][_0xf867('0x2e')]);_0x6a8334['query']=_[_0xf867('0x32')](_0x12a6b5['query']);_0x6a8334[_0xf867('0x33')]=_[_0xf867('0x44')](_0x6a8334['model'],_0x6a8334[_0xf867('0x31')]);_0x2ae0cc[_0xf867('0x35')]=_[_0xf867('0x44')](_0x6a8334[_0xf867('0x34')],qs[_0xf867('0x45')](_0x12a6b5[_0xf867('0x31')][_0xf867('0x45')]));_0x2ae0cc[_0xf867('0x35')]=_0x2ae0cc['attributes']['length']?_0x2ae0cc['attributes']:_0x6a8334[_0xf867('0x34')];_0x2ae0cc[_0xf867('0x58')]=qs[_0xf867('0x39')](_0x12a6b5['query'][_0xf867('0x39')]);_0x2ae0cc[_0xf867('0x3b')]=qs['filters'](_[_0xf867('0x59')](_0x12a6b5['query'],_0x6a8334['filters']));if(_0x12a6b5[_0xf867('0x31')][_0xf867('0x3d')]){_0x2ae0cc[_0xf867('0x3b')]=_[_0xf867('0x3a')](_0x2ae0cc['where'],{'$or':_[_0xf867('0x2c')](_0x2ae0cc[_0xf867('0x35')],function(_0x467f21){var _0x48062e={};_0x48062e[_0x467f21]={'$like':'%'+_0x12a6b5[_0xf867('0x31')]['filter']+'%'};return _0x48062e;})});}_0x2ae0cc=_['merge']({},_0x2ae0cc,_0x12a6b5[_0xf867('0x3e')]);return _0x32eb01[_0xf867('0x63')](_0x2ae0cc);}})['then'](function(_0x3e12e7){if(_0x3e12e7){_0x22c7bd=_0x3e12e7['length'];if(!_0x12a6b5['query'][_0xf867('0x37')](_0xf867('0x38'))){_0x2ae0cc[_0xf867('0x1e')]=qs[_0xf867('0x1e')](_0x12a6b5[_0xf867('0x31')][_0xf867('0x1e')]);_0x2ae0cc[_0xf867('0x1c')]=qs[_0xf867('0x1c')](_0x12a6b5['query'][_0xf867('0x1c')]);}return _0x32eb01[_0xf867('0x63')](_0x2ae0cc);}})[_0xf867('0x24')](function(_0x579c96){if(_0x579c96){return _0x579c96?{'count':_0x22c7bd,'rows':_0x579c96}:null;}})[_0xf867('0x24')](respondWithResult(_0x4a942d,null))[_0xf867('0x41')](handleError(_0x4a942d,null));};exports[_0xf867('0x64')]=function(_0x57c120,_0x322da2,_0x5bb3c7){var _0x4ef571,_0x2d2f4f;var _0x42f48e=[];var _0x45f9cf=moment()[_0xf867('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf867('0x2d')]['find']({'where':{'id':_0x57c120[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x322da2,null))[_0xf867('0x24')](function(_0x360e8c){if(_0x360e8c){_0x2d2f4f=_0x360e8c;return _0x360e8c['addLists'](_0x57c120[_0xf867('0x53')][_0xf867('0x66')],_['omit'](_0x57c120[_0xf867('0x53')],[_0xf867('0x66'),'id'])||{});}return null;})[_0xf867('0x67')](function(_0x1a786){var _0x479791;var _0x51d966;_0x4ef571=_0x1a786||[];var _0x43ec3d=[];if(_0x1a786){for(var _0x5d7d20=0x0;_0x5d7d20<_0x1a786[_0xf867('0x36')];_0x5d7d20+=0x1){var _0x28c3fb=_0x1a786[_0x5d7d20][_0xf867('0x25')]({'plain':!![]});_0x2d2f4f[_0xf867('0x68')]=_0x57c120[_0xf867('0x53')][_0xf867('0x68')]?_0x57c120['body']['dialCheckDuplicateType']:_0x2d2f4f[_0xf867('0x68')];switch(_0x2d2f4f[_0xf867('0x68')]){case _0xf867('0x69'):_0x479791=squel[_0xf867('0x6a')]()[_0xf867('0x6b')](_0xf867('0x6c'))[_0xf867('0x6d')]([_0xf867('0x6e'),'scheduledAt','ContactId',_0xf867('0x6f'),_0xf867('0x5a'),_0xf867('0x51'),_0xf867('0x52')],squel[_0xf867('0x70')]()[_0xf867('0x71')](_0xf867('0x6e'),'phone')[_0xf867('0x71')](_0xf867('0x72'),_0xf867('0x73'))[_0xf867('0x71')]('id',_0xf867('0x74'))[_0xf867('0x71')](_0x28c3fb[_0xf867('0x75')][_0xf867('0x76')](),'ListId')['field'](_0x57c120['params']['id']['toString'](),'CampaignId')[_0xf867('0x71')]('\x27'+_0x45f9cf+'\x27',_0xf867('0x51'))[_0xf867('0x71')]('\x27'+_0x45f9cf+'\x27',_0xf867('0x52'))[_0xf867('0x77')](_0xf867('0x78'))[_0xf867('0x3b')](_0xf867('0x79'))[_0xf867('0x3b')](_0xf867('0x7a'),_0x28c3fb[_0xf867('0x75')]['toString']())[_0xf867('0x3b')](_0xf867('0x7b'))[_0xf867('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf867('0x70')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xf867('0x77')](_0xf867('0x7c'))[_0xf867('0x3b')]('CampaignId\x20=\x20?',_0x57c120[_0xf867('0x43')]['id'][_0xf867('0x76')]()))[_0xf867('0x3b')](_0xf867('0x7d'),squel[_0xf867('0x70')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where']('CampaignId\x20=\x20?',_0x57c120[_0xf867('0x43')]['id'][_0xf867('0x76')]())))[_0xf867('0x76')]();break;case _0xf867('0x7e'):_0x479791=squel[_0xf867('0x6a')]()['into'](_0xf867('0x6c'))[_0xf867('0x6d')](['phone','scheduledAt','ContactId',_0xf867('0x6f'),_0xf867('0x5a'),_0xf867('0x51'),'updatedAt'],squel[_0xf867('0x70')]()[_0xf867('0x71')](_0xf867('0x6e'),_0xf867('0x6e'))[_0xf867('0x71')]('NOW()','scheduledAt')[_0xf867('0x71')]('id','ContactId')[_0xf867('0x71')](_0x28c3fb[_0xf867('0x75')][_0xf867('0x76')](),'ListId')['field'](_0x57c120[_0xf867('0x43')]['id'][_0xf867('0x76')](),'CampaignId')[_0xf867('0x71')]('\x27'+_0x45f9cf+'\x27','createdAt')[_0xf867('0x71')]('\x27'+_0x45f9cf+'\x27',_0xf867('0x52'))[_0xf867('0x77')](_0xf867('0x78'))[_0xf867('0x3b')](_0xf867('0x79'))['where'](_0xf867('0x7a'),_0x28c3fb['CmListId'][_0xf867('0x76')]())[_0xf867('0x3b')](_0xf867('0x7b'))[_0xf867('0x3b')](_0xf867('0x7d'),squel[_0xf867('0x70')]()[_0xf867('0x71')](_0xf867('0x7f'))['from'](_0xf867('0x6c'))['where'](_0xf867('0x80'),_0x57c120[_0xf867('0x43')]['id'][_0xf867('0x76')]())))['toString']();break;default:_0x479791=squel['insert']()[_0xf867('0x6b')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0xf867('0x74'),_0xf867('0x6f'),'CampaignId','createdAt',_0xf867('0x52')],squel[_0xf867('0x70')]()['field']('phone',_0xf867('0x6e'))['field'](_0xf867('0x72'),_0xf867('0x73'))['field']('id',_0xf867('0x74'))[_0xf867('0x71')](_0x28c3fb[_0xf867('0x75')][_0xf867('0x76')](),_0xf867('0x6f'))[_0xf867('0x71')](_0x57c120[_0xf867('0x43')]['id'][_0xf867('0x76')](),_0xf867('0x5a'))[_0xf867('0x71')]('\x27'+_0x45f9cf+'\x27',_0xf867('0x51'))[_0xf867('0x71')]('\x27'+_0x45f9cf+'\x27',_0xf867('0x52'))[_0xf867('0x77')](_0xf867('0x78'))[_0xf867('0x3b')](_0xf867('0x79'))['where']('ListId\x20=\x20?',_0x28c3fb[_0xf867('0x75')][_0xf867('0x76')]())[_0xf867('0x3b')](_0xf867('0x7b')))[_0xf867('0x76')]();}_0x51d966=squel[_0xf867('0x6a')]()['into'](_0xf867('0x81'))[_0xf867('0x6d')]([_0xf867('0x82'),_0xf867('0x73'),'phone','OrderBy',_0xf867('0x51'),_0xf867('0x52')],squel['select']()[_0xf867('0x71')]('h.id','id')[_0xf867('0x71')](_0xf867('0x72'),_0xf867('0x73'))[_0xf867('0x71')](_0xf867('0x83'),_0xf867('0x6e'))['field']('ci.OrderBY',_0xf867('0x84'))['field']('\x27'+_0x45f9cf+'\x27',_0xf867('0x51'))['field']('\x27'+_0x45f9cf+'\x27',_0xf867('0x52'))['from'](_0xf867('0x85'),'ci')[_0xf867('0x86')]('cm_hopper','h',_0xf867('0x87'))[_0xf867('0x3b')](_0xf867('0x88'),_0x28c3fb[_0xf867('0x75')]['toString']())['where'](_0xf867('0x89'),_0x57c120['params']['id']['toString']())['where'](_0xf867('0x8a'),_0x45f9cf))[_0xf867('0x76')]();_0x43ec3d['push'](db[_0xf867('0x8b')][_0xf867('0x31')](_0x479791));_0x42f48e['push'](db[_0xf867('0x8b')]['query'](_0x51d966));}return BPromise[_0xf867('0x8c')](_0x43ec3d);}})[_0xf867('0x24')](function(){return BPromise[_0xf867('0x8c')](_0x42f48e);})[_0xf867('0x24')](function(){return _0x4ef571;})['then'](respondWithResult(_0x322da2,null))[_0xf867('0x41')](handleError(_0x322da2,null));};exports[_0xf867('0x8d')]=function(_0x590638,_0x313acc,_0x39b798){return db[_0xf867('0x2d')]['find']({'where':{'id':_0x590638[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x313acc,null))[_0xf867('0x24')](function(_0x19fa37){if(_0x19fa37){return _0x19fa37[_0xf867('0x8d')](_0x590638[_0xf867('0x31')][_0xf867('0x66')]);}})[_0xf867('0x24')](function(_0x2197f4){if(_0x2197f4){return db[_0xf867('0x57')][_0xf867('0x27')]({'where':{'ListId':_0x590638[_0xf867('0x31')][_0xf867('0x66')],'CampaignId':_0x590638[_0xf867('0x43')]['id']}})['then'](function(){return _0x2197f4;});}})[_0xf867('0x24')](respondWithStatusCode(_0x313acc,null))[_0xf867('0x41')](handleError(_0x313acc,null));};exports[_0xf867('0x8e')]=function(_0x4a3cdf,_0xb7ac82,_0x4e30d8){var _0x5ab84f={};var _0x49e727={};var _0x41e541;var _0x5d95ee;return db[_0xf867('0x2d')][_0xf867('0x5c')]({'where':{'id':_0x4a3cdf[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0xb7ac82,null))[_0xf867('0x24')](function(_0x3c1237){if(_0x3c1237){_0x41e541=_0x3c1237;_0x49e727['model']=_[_0xf867('0x32')](db[_0xf867('0x62')][_0xf867('0x2e')]);_0x49e727[_0xf867('0x31')]=_['keys'](_0x4a3cdf['query']);_0x49e727[_0xf867('0x33')]=_['intersection'](_0x49e727[_0xf867('0x34')],_0x49e727['query']);_0x5ab84f[_0xf867('0x35')]=_[_0xf867('0x44')](_0x49e727['model'],qs[_0xf867('0x45')](_0x4a3cdf[_0xf867('0x31')][_0xf867('0x45')]));_0x5ab84f['attributes']=_0x5ab84f[_0xf867('0x35')][_0xf867('0x36')]?_0x5ab84f[_0xf867('0x35')]:_0x49e727[_0xf867('0x34')];_0x5ab84f[_0xf867('0x58')]=qs['sort'](_0x4a3cdf[_0xf867('0x31')]['sort']);_0x5ab84f['where']=qs[_0xf867('0x33')](_[_0xf867('0x59')](_0x4a3cdf[_0xf867('0x31')],_0x49e727[_0xf867('0x33')]));if(_0x4a3cdf['query'][_0xf867('0x3d')]){_0x5ab84f[_0xf867('0x3b')]=_[_0xf867('0x3a')](_0x5ab84f[_0xf867('0x3b')],{'$or':_[_0xf867('0x2c')](_0x5ab84f[_0xf867('0x35')],function(_0xd8a6fb){var _0x564f7d={};_0x564f7d[_0xd8a6fb]={'$like':'%'+_0x4a3cdf[_0xf867('0x31')][_0xf867('0x3d')]+'%'};return _0x564f7d;})});}_0x5ab84f=_['merge']({},_0x5ab84f,_0x4a3cdf['options']);return _0x41e541['getBlackLists'](_0x5ab84f);}})[_0xf867('0x24')](function(_0x3754fb){if(_0x3754fb){_0x5d95ee=_0x3754fb[_0xf867('0x36')];if(!_0x4a3cdf[_0xf867('0x31')][_0xf867('0x37')]('nolimit')){_0x5ab84f[_0xf867('0x1e')]=qs['limit'](_0x4a3cdf[_0xf867('0x31')][_0xf867('0x1e')]);_0x5ab84f['offset']=qs[_0xf867('0x1c')](_0x4a3cdf[_0xf867('0x31')][_0xf867('0x1c')]);}return _0x41e541[_0xf867('0x8e')](_0x5ab84f);}})['then'](function(_0x267412){if(_0x267412){return _0x267412?{'count':_0x5d95ee,'rows':_0x267412}:null;}})[_0xf867('0x24')](respondWithResult(_0xb7ac82,null))[_0xf867('0x41')](handleError(_0xb7ac82,null));};exports[_0xf867('0x8f')]=function(_0x2bb8c6,_0x27fdef,_0x50db76){var _0x2c8e00,_0x5605e1;var _0x17495d=[];var _0x3006b8=moment()[_0xf867('0x65')](_0xf867('0x90'));return db[_0xf867('0x2d')][_0xf867('0x46')]({'where':{'id':_0x2bb8c6[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x27fdef,null))[_0xf867('0x24')](function(_0x21cf3c){if(_0x21cf3c){_0x5605e1=_0x21cf3c;return _0x21cf3c[_0xf867('0x8f')](_0x2bb8c6[_0xf867('0x53')]['ids'],_[_0xf867('0x50')](_0x2bb8c6[_0xf867('0x53')],[_0xf867('0x66'),'id'])||{});}return null;})[_0xf867('0x67')](function(_0x3f1db2){var _0xad0d19;var _0x7bfd53;_0x2c8e00=_0x3f1db2||[];var _0x439de3=[];if(_0x3f1db2){for(var _0x5d584c=0x0;_0x5d584c<_0x3f1db2[_0xf867('0x36')];_0x5d584c+=0x1){var _0x5cbe0b=_0x3f1db2[_0x5d584c][_0xf867('0x25')]({'plain':!![]});_0xad0d19=squel[_0xf867('0x6a')]()[_0xf867('0x6b')](_0xf867('0x91'))['fromQuery']([_0xf867('0x6e'),_0xf867('0x74'),'ListId','CampaignId',_0xf867('0x51'),_0xf867('0x52')],squel['select']()['field'](_0xf867('0x6e'),'phone')[_0xf867('0x71')]('id','ContactId')[_0xf867('0x71')](_0x5cbe0b['CmListId'][_0xf867('0x76')](),_0xf867('0x6f'))['field'](_0x2bb8c6[_0xf867('0x43')]['id'][_0xf867('0x76')](),_0xf867('0x5a'))['field'](_0xf867('0x72'),_0xf867('0x51'))[_0xf867('0x71')](_0xf867('0x72'),'updatedAt')[_0xf867('0x77')](_0xf867('0x78'))[_0xf867('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0xf867('0x7a'),_0x5cbe0b[_0xf867('0x75')][_0xf867('0x76')]())[_0xf867('0x3b')](_0xf867('0x7b')))[_0xf867('0x76')]();_0x439de3[_0xf867('0x92')](db[_0xf867('0x8b')][_0xf867('0x31')](_0xad0d19));}return BPromise['all'](_0x439de3);}})[_0xf867('0x24')](function(){return _0x2c8e00;})['then'](respondWithResult(_0x27fdef,null))[_0xf867('0x41')](handleError(_0x27fdef,null));};exports[_0xf867('0x93')]=function(_0x37085e,_0x4088a3,_0x2eadd7){return db[_0xf867('0x2d')]['find']({'where':{'id':_0x37085e[_0xf867('0x43')]['id']}})[_0xf867('0x24')](handleEntityNotFound(_0x4088a3,null))['then'](function(_0x527dc7){if(_0x527dc7){return _0x527dc7[_0xf867('0x93')](_0x37085e[_0xf867('0x31')]['ids']);}})['then'](function(_0x180ec1){if(_0x180ec1){return db[_0xf867('0x61')][_0xf867('0x27')]({'where':{'ListId':_0x37085e['query'][_0xf867('0x66')],'CampaignId':_0x37085e[_0xf867('0x43')]['id']}})['then'](function(){return _0x180ec1;});}})[_0xf867('0x24')](respondWithStatusCode(_0x4088a3,null))[_0xf867('0x41')](handleError(_0x4088a3,null));}; \ No newline at end of file +var _0x590a=['into','cm_hopper','fromQuery','ContactId','field','phone','scheduledAt','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','NOW()','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','Campaign','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','role','IvrCampaigns','find','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0x590a,0x159));var _0xa590=function(_0x165799,_0x42abad){_0x165799=_0x165799-0x0;var _0x4e38b3=_0x590a[_0x165799];return _0x4e38b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa590('0x0'));var zipdir=require(_0xa590('0x1'));var jsonpatch=require(_0xa590('0x2'));var rp=require(_0xa590('0x3'));var moment=require(_0xa590('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa590('0x5'));var path=require(_0xa590('0x6'));var sox=require(_0xa590('0x7'));var csv=require('to-csv');var ejs=require(_0xa590('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa590('0x9'));var squel=require(_0xa590('0xa'));var crypto=require(_0xa590('0xb'));var jsforce=require(_0xa590('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa590('0xd'));var Papa=require('papaparse');var Redis=require(_0xa590('0xe'));var authService=require(_0xa590('0xf'));var qs=require(_0xa590('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa590('0x11'));var logger=require(_0xa590('0x12'))(_0xa590('0x13'));var utils=require(_0xa590('0x14'));var config=require(_0xa590('0x15'));var licenseUtil=require(_0xa590('0x16'));var db=require(_0xa590('0x17'))['db'];function respondWithStatusCode(_0x570b51,_0x5bc467){_0x5bc467=_0x5bc467||0xcc;return function(_0x252e2b){if(_0x252e2b){return _0x570b51[_0xa590('0x18')](_0x5bc467);}return _0x570b51[_0xa590('0x19')](_0x5bc467)[_0xa590('0x1a')]();};}function respondWithResult(_0x52656c,_0xdf68af){_0xdf68af=_0xdf68af||0xc8;return function(_0x3c1fee){if(_0x3c1fee){return _0x52656c['status'](_0xdf68af)['json'](_0x3c1fee);}};}function respondWithFilteredResult(_0x2954af,_0x5ec6e2){return function(_0x165b81){if(_0x165b81){var _0x6ca5c8=typeof _0x5ec6e2[_0xa590('0x1b')]===_0xa590('0x1c')&&typeof _0x5ec6e2[_0xa590('0x1d')]===_0xa590('0x1c');var _0xdfc78a=_0x165b81[_0xa590('0x1e')];var _0x4f4075=_0x6ca5c8?0x0:_0x5ec6e2[_0xa590('0x1b')];var _0x203812=_0x6ca5c8?_0x165b81[_0xa590('0x1e')]:_0x5ec6e2[_0xa590('0x1b')]+_0x5ec6e2[_0xa590('0x1d')];var _0x352bf6;if(_0x203812>=_0xdfc78a){_0x203812=_0xdfc78a;_0x352bf6=0xc8;}else{_0x352bf6=0xce;}_0x2954af[_0xa590('0x19')](_0x352bf6);return _0x2954af[_0xa590('0x1f')](_0xa590('0x20'),_0x4f4075+'-'+_0x203812+'/'+_0xdfc78a)[_0xa590('0x21')](_0x165b81);}return null;};}function patchUpdates(_0x12eaec){return function(_0x23381b){try{jsonpatch[_0xa590('0x22')](_0x23381b,_0x12eaec,!![]);}catch(_0x544a16){return BPromise[_0xa590('0x23')](_0x544a16);}return _0x23381b[_0xa590('0x24')]();};}function saveUpdates(_0x47d5f4,_0x489a13){return function(_0x2ccb4e){if(_0x2ccb4e){return _0x2ccb4e[_0xa590('0x25')](_0x47d5f4)[_0xa590('0x26')](function(_0x20dfa3){return _0x20dfa3;});}return null;};}function removeEntity(_0x24d901,_0x4d63e2){return function(_0x1805d8){if(_0x1805d8){return _0x1805d8[_0xa590('0x27')]()[_0xa590('0x26')](function(){var _0x257297=_0x1805d8[_0xa590('0x28')]({'plain':!![]});var _0x457a32='IvrCampaigns';return db[_0xa590('0x29')]['destroy']({'where':{'type':_0x457a32,'resourceId':_0x257297['id']}})[_0xa590('0x26')](function(){return _0x1805d8;});})[_0xa590('0x26')](function(){_0x24d901[_0xa590('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f45b2,_0x218939){return function(_0x8556d0){if(!_0x8556d0){_0x3f45b2[_0xa590('0x18')](0x194);}return _0x8556d0;};}function handleError(_0x51612e,_0x59facf){_0x59facf=_0x59facf||0x1f4;return function(_0x2b2f38){logger[_0xa590('0x2a')](_0x2b2f38[_0xa590('0x2b')]);if(_0x2b2f38[_0xa590('0x2c')]){delete _0x2b2f38[_0xa590('0x2c')];}_0x51612e[_0xa590('0x19')](_0x59facf)[_0xa590('0x2d')](_0x2b2f38);};}exports['index']=function(_0x2fca57,_0x17bafb){var _0x1a0f9a={},_0x265f37={},_0x43fa57={'count':0x0,'rows':[]};var _0x3c5c74=_['map'](db['Campaign']['rawAttributes'],function(_0x2bac4f){return{'name':_0x2bac4f['fieldName'],'type':_0x2bac4f['type'][_0xa590('0x2e')]};});_0x265f37[_0xa590('0x2f')]=_[_0xa590('0x30')](_0x3c5c74,_0xa590('0x2c'));_0x265f37['query']=_[_0xa590('0x31')](_0x2fca57[_0xa590('0x32')]);_0x265f37['filters']=_[_0xa590('0x33')](_0x265f37[_0xa590('0x2f')],_0x265f37[_0xa590('0x32')]);_0x1a0f9a[_0xa590('0x34')]=_[_0xa590('0x33')](_0x265f37['model'],qs[_0xa590('0x35')](_0x2fca57['query'][_0xa590('0x35')]));_0x1a0f9a[_0xa590('0x34')]=_0x1a0f9a[_0xa590('0x34')][_0xa590('0x36')]?_0x1a0f9a['attributes']:_0x265f37[_0xa590('0x2f')];if(!_0x2fca57[_0xa590('0x32')][_0xa590('0x37')](_0xa590('0x38'))){_0x1a0f9a[_0xa590('0x1d')]=qs[_0xa590('0x1d')](_0x2fca57['query'][_0xa590('0x1d')]);_0x1a0f9a[_0xa590('0x1b')]=qs[_0xa590('0x1b')](_0x2fca57[_0xa590('0x32')][_0xa590('0x1b')]);}_0x1a0f9a[_0xa590('0x39')]=qs[_0xa590('0x3a')](_0x2fca57[_0xa590('0x32')][_0xa590('0x3a')]);_0x1a0f9a[_0xa590('0x3b')]=qs[_0xa590('0x3c')](_['pick'](_0x2fca57['query'],_0x265f37['filters']),_0x3c5c74);if(_0x2fca57[_0xa590('0x32')][_0xa590('0x3d')]){_0x1a0f9a[_0xa590('0x3b')]=_[_0xa590('0x3e')](_0x1a0f9a[_0xa590('0x3b')],{'$or':_[_0xa590('0x30')](_0x3c5c74,function(_0x5cb67a){if(_0x5cb67a[_0xa590('0x3f')]!==_0xa590('0x40')){var _0x4ab94d={};_0x4ab94d[_0x5cb67a[_0xa590('0x2c')]]={'$like':'%'+_0x2fca57[_0xa590('0x32')][_0xa590('0x3d')]+'%'};return _0x4ab94d;}})});}_0x1a0f9a=_[_0xa590('0x3e')]({},_0x1a0f9a,_0x2fca57['options']);var _0x147766={'where':_0x1a0f9a['where']};return db[_0xa590('0x41')][_0xa590('0x1e')](_0x147766)[_0xa590('0x26')](function(_0x919b4a){_0x43fa57[_0xa590('0x1e')]=_0x919b4a;if(_0x2fca57[_0xa590('0x32')][_0xa590('0x42')]){_0x1a0f9a[_0xa590('0x43')]=[{'all':!![]}];}return db[_0xa590('0x41')][_0xa590('0x44')](_0x1a0f9a);})[_0xa590('0x26')](function(_0x5408f4){_0x43fa57[_0xa590('0x45')]=_0x5408f4;return _0x43fa57;})[_0xa590('0x26')](respondWithFilteredResult(_0x17bafb,_0x1a0f9a))[_0xa590('0x46')](handleError(_0x17bafb,null));};exports[_0xa590('0x47')]=function(_0x20bc55,_0x4e33c2){var _0x53244d={'raw':![],'where':{'id':_0x20bc55[_0xa590('0x48')]['id']}},_0x555c3f={};_0x555c3f[_0xa590('0x2f')]=_[_0xa590('0x31')](db['Campaign'][_0xa590('0x49')]);_0x555c3f['query']=_[_0xa590('0x31')](_0x20bc55['query']);_0x555c3f[_0xa590('0x3c')]=_['intersection'](_0x555c3f[_0xa590('0x2f')],_0x555c3f['query']);_0x53244d['attributes']=_[_0xa590('0x33')](_0x555c3f[_0xa590('0x2f')],qs[_0xa590('0x35')](_0x20bc55[_0xa590('0x32')][_0xa590('0x35')]));_0x53244d[_0xa590('0x34')]=_0x53244d['attributes']['length']?_0x53244d[_0xa590('0x34')]:_0x555c3f['model'];if(_0x20bc55[_0xa590('0x32')][_0xa590('0x42')]){_0x53244d[_0xa590('0x43')]=[{'all':!![]}];}_0x53244d=_[_0xa590('0x3e')]({},_0x53244d,_0x20bc55[_0xa590('0x4a')]);return db['Campaign']['find'](_0x53244d)[_0xa590('0x26')](handleEntityNotFound(_0x4e33c2,null))[_0xa590('0x26')](respondWithResult(_0x4e33c2,null))[_0xa590('0x46')](handleError(_0x4e33c2,null));};exports['create']=function(_0x4745fe,_0x513486){return db[_0xa590('0x41')][_0xa590('0x4b')](_0x4745fe[_0xa590('0x4c')],{})[_0xa590('0x26')](function(_0x5a43a8){var _0x207cae=_0x4745fe[_0xa590('0x4d')]['get']({'plain':!![]});if(!_0x207cae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x207cae[_0xa590('0x4e')]===_0xa590('0x4d')){var _0x6b25a9=_0x5a43a8[_0xa590('0x28')]({'plain':!![]});var _0x515088=_0xa590('0x4f');return db['UserProfileSection'][_0xa590('0x50')]({'where':{'name':_0x515088,'userProfileId':_0x207cae[_0xa590('0x51')]},'raw':!![]})[_0xa590('0x26')](function(_0x480956){if(_0x480956&&_0x480956[_0xa590('0x52')]===0x0){return db[_0xa590('0x29')][_0xa590('0x4b')]({'name':_0x6b25a9[_0xa590('0x2c')],'resourceId':_0x6b25a9['id'],'type':_0x480956[_0xa590('0x2c')],'sectionId':_0x480956['id']},{})[_0xa590('0x26')](function(){return _0x5a43a8;});}else{return _0x5a43a8;}})[_0xa590('0x46')](function(_0xf3f60e){logger[_0xa590('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf3f60e);throw _0xf3f60e;});}return _0x5a43a8;})[_0xa590('0x26')](respondWithResult(_0x513486,0xc9))[_0xa590('0x46')](handleError(_0x513486,null));};exports[_0xa590('0x53')]=function(_0x4c9d59,_0x539569){var _0x5d708d={'where':{'id':_0x4c9d59[_0xa590('0x48')]['id']}},_0x5b92da={};_0x5b92da[_0xa590('0x2f')]=_[_0xa590('0x31')](db[_0xa590('0x41')]['rawAttributes']);_0x5d708d['attributes']=_[_0xa590('0x33')](_0x5b92da[_0xa590('0x2f')],qs[_0xa590('0x35')](_0x4c9d59['query'][_0xa590('0x35')]));_0x5d708d[_0xa590('0x34')]=_0x5d708d['attributes']['length']?_0x5d708d[_0xa590('0x34')]:_0x5b92da[_0xa590('0x2f')];if(_0x4c9d59[_0xa590('0x32')][_0xa590('0x42')]){_0x5d708d[_0xa590('0x43')]=[{'all':!![]}];}_0x5d708d=_['merge']({},_0x5d708d,_0x4c9d59[_0xa590('0x4a')]);return db[_0xa590('0x41')][_0xa590('0x50')](_0x5d708d)[_0xa590('0x26')](handleEntityNotFound(_0x539569,null))[_0xa590('0x26')](function(_0xdafae6){if(_0xdafae6){var _0x332512=_0xdafae6[_0xa590('0x28')]({'plain':!![]});_0x332512=qs[_0xa590('0x54')](_0x332512,['id','createdAt',_0xa590('0x55')]);_0x4c9d59['body']=_[_0xa590('0x54')](_0x4c9d59['body'],['id',_0xa590('0x56'),_0xa590('0x55')]);return db[_0xa590('0x41')]['create'](_['merge'](_0x332512,_0x4c9d59[_0xa590('0x4c')]),{'include':_0x4c9d59['query'][_0xa590('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x46890a){var _0x49da75=_0x4c9d59[_0xa590('0x4d')]['get']({'plain':!![]});if(!_0x49da75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49da75[_0xa590('0x4e')]===_0xa590('0x4d')){var _0x3b3ba8=_0x46890a[_0xa590('0x28')]({'plain':!![]});var _0x58e6ac=_0xa590('0x4f');return db[_0xa590('0x57')][_0xa590('0x50')]({'where':{'name':_0x58e6ac,'userProfileId':_0x49da75[_0xa590('0x51')]},'raw':!![]})[_0xa590('0x26')](function(_0xcb7399){if(_0xcb7399&&_0xcb7399['autoAssociation']===0x0){return db[_0xa590('0x29')][_0xa590('0x4b')]({'name':_0x3b3ba8['name'],'resourceId':_0x3b3ba8['id'],'type':_0xcb7399[_0xa590('0x2c')],'sectionId':_0xcb7399['id']},{})['then'](function(){return _0x46890a;});}else{return _0x46890a;}})[_0xa590('0x46')](function(_0x3d6baa){logger[_0xa590('0x2a')](_0xa590('0x58'),_0x3d6baa);throw _0x3d6baa;});}return _0x46890a;});}})[_0xa590('0x26')](respondWithResult(_0x539569,0xc9))['catch'](handleError(_0x539569,null));};exports[_0xa590('0x25')]=function(_0x524a3f,_0x35fa22){if(_0x524a3f[_0xa590('0x4c')]['id']){delete _0x524a3f[_0xa590('0x4c')]['id'];}return db[_0xa590('0x41')][_0xa590('0x50')]({'where':{'id':_0x524a3f[_0xa590('0x48')]['id']}})['then'](handleEntityNotFound(_0x35fa22,null))[_0xa590('0x26')](saveUpdates(_0x524a3f['body'],null))[_0xa590('0x26')](respondWithResult(_0x35fa22,null))[_0xa590('0x46')](handleError(_0x35fa22,null));};exports['destroy']=function(_0xeb2113,_0x811a82){return db[_0xa590('0x41')][_0xa590('0x50')]({'where':{'id':_0xeb2113[_0xa590('0x48')]['id']}})['then'](handleEntityNotFound(_0x811a82,null))[_0xa590('0x26')](removeEntity(_0x811a82,null))[_0xa590('0x46')](handleError(_0x811a82,null));};exports[_0xa590('0x59')]=function(_0x3e40ef,_0x1c70f7,_0x4ed0dd){var _0x397d25={'raw':!![],'where':{}};var _0x4afb8a={};var _0x203d3e={'count':0x0,'rows':[]};return db[_0xa590('0x41')][_0xa590('0x5a')]({'where':{'id':_0x3e40ef[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x1c70f7,null))[_0xa590('0x26')](function(_0x4557d0){if(_0x4557d0){_0x4afb8a[_0xa590('0x2f')]=_[_0xa590('0x31')](db[_0xa590('0x5b')][_0xa590('0x49')]);_0x4afb8a[_0xa590('0x32')]=_[_0xa590('0x31')](_0x3e40ef['query']);_0x4afb8a['filters']=_[_0xa590('0x33')](_0x4afb8a[_0xa590('0x2f')],_0x4afb8a['query']);_0x397d25[_0xa590('0x34')]=_[_0xa590('0x33')](_0x4afb8a[_0xa590('0x2f')],qs[_0xa590('0x35')](_0x3e40ef[_0xa590('0x32')]['fields']));_0x397d25[_0xa590('0x34')]=_0x397d25[_0xa590('0x34')]['length']?_0x397d25['attributes']:_0x4afb8a[_0xa590('0x2f')];if(!_0x3e40ef[_0xa590('0x32')]['hasOwnProperty'](_0xa590('0x38'))){_0x397d25['limit']=qs[_0xa590('0x1d')](_0x3e40ef[_0xa590('0x32')]['limit']);_0x397d25[_0xa590('0x1b')]=qs[_0xa590('0x1b')](_0x3e40ef[_0xa590('0x32')][_0xa590('0x1b')]);}_0x397d25['order']=qs['sort'](_0x3e40ef[_0xa590('0x32')][_0xa590('0x3a')]);_0x397d25[_0xa590('0x3b')]=qs['filters'](_['pick'](_0x3e40ef['query'],_0x4afb8a['filters']));_0x397d25['where'][_0xa590('0x5c')]=_0x4557d0['id'];if(_0x3e40ef[_0xa590('0x32')][_0xa590('0x3d')]){_0x397d25[_0xa590('0x3b')]=_[_0xa590('0x3e')](_0x397d25['where'],{'$or':_[_0xa590('0x30')](_0x397d25['attributes'],function(_0x3b9810){var _0x4c5758={};_0x4c5758[_0x3b9810]={'$like':'%'+_0x3e40ef[_0xa590('0x32')][_0xa590('0x3d')]+'%'};return _0x4c5758;})});}_0x397d25=_[_0xa590('0x3e')]({},_0x397d25,_0x3e40ef['options']);return db[_0xa590('0x5b')]['count']({'where':_0x397d25[_0xa590('0x3b')]})[_0xa590('0x26')](function(_0xc24038){_0x203d3e['count']=_0xc24038;if(_0x3e40ef[_0xa590('0x32')][_0xa590('0x42')]){_0x397d25[_0xa590('0x43')]=[{'all':!![]}];}return db[_0xa590('0x5b')]['findAll'](_0x397d25);})[_0xa590('0x26')](function(_0x26a643){_0x203d3e['rows']=_0x26a643;return _0x203d3e;});}})[_0xa590('0x26')](respondWithFilteredResult(_0x1c70f7,_0x397d25))['catch'](handleError(_0x1c70f7,null));};exports[_0xa590('0x5d')]=function(_0x12d4e4,_0x436fc0,_0x30a454){var _0x4d32ad={'raw':!![],'where':{}};var _0x24d5a5={};var _0x8e9d63={'count':0x0,'rows':[]};return db['Campaign'][_0xa590('0x5a')]({'where':{'id':_0x12d4e4[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x436fc0,null))[_0xa590('0x26')](function(_0x49d7ea){if(_0x49d7ea){_0x24d5a5[_0xa590('0x2f')]=_[_0xa590('0x31')](db[_0xa590('0x5e')]['rawAttributes']);_0x24d5a5['query']=_[_0xa590('0x31')](_0x12d4e4[_0xa590('0x32')]);_0x24d5a5[_0xa590('0x3c')]=_[_0xa590('0x33')](_0x24d5a5[_0xa590('0x2f')],_0x24d5a5[_0xa590('0x32')]);_0x4d32ad[_0xa590('0x34')]=_[_0xa590('0x33')](_0x24d5a5[_0xa590('0x2f')],qs[_0xa590('0x35')](_0x12d4e4[_0xa590('0x32')][_0xa590('0x35')]));_0x4d32ad['attributes']=_0x4d32ad['attributes'][_0xa590('0x36')]?_0x4d32ad['attributes']:_0x24d5a5['model'];if(!_0x12d4e4['query']['hasOwnProperty'](_0xa590('0x38'))){_0x4d32ad[_0xa590('0x1d')]=qs['limit'](_0x12d4e4[_0xa590('0x32')][_0xa590('0x1d')]);_0x4d32ad[_0xa590('0x1b')]=qs[_0xa590('0x1b')](_0x12d4e4[_0xa590('0x32')][_0xa590('0x1b')]);}_0x4d32ad['order']=qs[_0xa590('0x3a')](_0x12d4e4[_0xa590('0x32')][_0xa590('0x3a')]);_0x4d32ad['where']=qs[_0xa590('0x3c')](_[_0xa590('0x5f')](_0x12d4e4[_0xa590('0x32')],_0x24d5a5[_0xa590('0x3c')]));_0x4d32ad[_0xa590('0x3b')]['CampaignId']=_0x49d7ea['id'];if(_0x12d4e4['query'][_0xa590('0x3d')]){_0x4d32ad[_0xa590('0x3b')]=_[_0xa590('0x3e')](_0x4d32ad[_0xa590('0x3b')],{'$or':_['map'](_0x4d32ad[_0xa590('0x34')],function(_0x4dd0c4){var _0x315dd0={};_0x315dd0[_0x4dd0c4]={'$like':'%'+_0x12d4e4[_0xa590('0x32')][_0xa590('0x3d')]+'%'};return _0x315dd0;})});}_0x4d32ad=_[_0xa590('0x3e')]({},_0x4d32ad,_0x12d4e4[_0xa590('0x4a')]);return db[_0xa590('0x5e')][_0xa590('0x1e')]({'where':_0x4d32ad[_0xa590('0x3b')]})['then'](function(_0x1b4945){_0x8e9d63[_0xa590('0x1e')]=_0x1b4945;if(_0x12d4e4[_0xa590('0x32')]['includeAll']){_0x4d32ad[_0xa590('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xa590('0x44')](_0x4d32ad);})[_0xa590('0x26')](function(_0x113a90){_0x8e9d63['rows']=_0x113a90;return _0x8e9d63;});}})[_0xa590('0x26')](respondWithFilteredResult(_0x436fc0,_0x4d32ad))[_0xa590('0x46')](handleError(_0x436fc0,null));};exports[_0xa590('0x60')]=function(_0x1b3398,_0x3a74f1,_0x509665){var _0x2681f7={'raw':!![],'where':{}};var _0x2c6bfe={};var _0x171c85={'count':0x0,'rows':[]};return db[_0xa590('0x41')]['findOne']({'where':{'id':_0x1b3398[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x3a74f1,null))['then'](function(_0x37bfb3){if(_0x37bfb3){_0x2c6bfe['model']=_[_0xa590('0x31')](db['CmHopperFinal'][_0xa590('0x49')]);_0x2c6bfe[_0xa590('0x32')]=_[_0xa590('0x31')](_0x1b3398[_0xa590('0x32')]);_0x2c6bfe[_0xa590('0x3c')]=_[_0xa590('0x33')](_0x2c6bfe[_0xa590('0x2f')],_0x2c6bfe['query']);_0x2681f7[_0xa590('0x34')]=_[_0xa590('0x33')](_0x2c6bfe['model'],qs[_0xa590('0x35')](_0x1b3398[_0xa590('0x32')][_0xa590('0x35')]));_0x2681f7[_0xa590('0x34')]=_0x2681f7[_0xa590('0x34')][_0xa590('0x36')]?_0x2681f7[_0xa590('0x34')]:_0x2c6bfe[_0xa590('0x2f')];if(!_0x1b3398['query'][_0xa590('0x37')](_0xa590('0x38'))){_0x2681f7['limit']=qs['limit'](_0x1b3398['query'][_0xa590('0x1d')]);_0x2681f7[_0xa590('0x1b')]=qs[_0xa590('0x1b')](_0x1b3398[_0xa590('0x32')][_0xa590('0x1b')]);}_0x2681f7[_0xa590('0x39')]=qs[_0xa590('0x3a')](_0x1b3398[_0xa590('0x32')]['sort']);_0x2681f7[_0xa590('0x3b')]=qs['filters'](_['pick'](_0x1b3398['query'],_0x2c6bfe[_0xa590('0x3c')]));_0x2681f7[_0xa590('0x3b')][_0xa590('0x5c')]=_0x37bfb3['id'];if(_0x1b3398[_0xa590('0x32')][_0xa590('0x3d')]){_0x2681f7[_0xa590('0x3b')]=_[_0xa590('0x3e')](_0x2681f7['where'],{'$or':_[_0xa590('0x30')](_0x2681f7[_0xa590('0x34')],function(_0x4dc961){var _0x2f87ea={};_0x2f87ea[_0x4dc961]={'$like':'%'+_0x1b3398[_0xa590('0x32')][_0xa590('0x3d')]+'%'};return _0x2f87ea;})});}_0x2681f7=_[_0xa590('0x3e')]({},_0x2681f7,_0x1b3398[_0xa590('0x4a')]);return db[_0xa590('0x61')][_0xa590('0x1e')]({'where':_0x2681f7[_0xa590('0x3b')]})[_0xa590('0x26')](function(_0x28bb2c){_0x171c85[_0xa590('0x1e')]=_0x28bb2c;if(_0x1b3398[_0xa590('0x32')][_0xa590('0x42')]){_0x2681f7[_0xa590('0x43')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2681f7);})[_0xa590('0x26')](function(_0x1642e6){_0x171c85[_0xa590('0x45')]=_0x1642e6;return _0x171c85;});}})[_0xa590('0x26')](respondWithFilteredResult(_0x3a74f1,_0x2681f7))['catch'](handleError(_0x3a74f1,null));};exports[_0xa590('0x62')]=function(_0x5aed65,_0x10af90,_0x57889e){var _0x51cada={'raw':!![],'where':{}};var _0x350c19={};var _0x2714e9={'count':0x0,'rows':[]};return db[_0xa590('0x41')][_0xa590('0x5a')]({'where':{'id':_0x5aed65[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x10af90,null))[_0xa590('0x26')](function(_0x22f2e0){if(_0x22f2e0){_0x350c19[_0xa590('0x2f')]=_[_0xa590('0x31')](db[_0xa590('0x63')][_0xa590('0x49')]);_0x350c19['query']=_['keys'](_0x5aed65[_0xa590('0x32')]);_0x350c19[_0xa590('0x3c')]=_['intersection'](_0x350c19['model'],_0x350c19['query']);_0x51cada[_0xa590('0x34')]=_['intersection'](_0x350c19[_0xa590('0x2f')],qs['fields'](_0x5aed65[_0xa590('0x32')][_0xa590('0x35')]));_0x51cada[_0xa590('0x34')]=_0x51cada['attributes'][_0xa590('0x36')]?_0x51cada['attributes']:_0x350c19[_0xa590('0x2f')];if(!_0x5aed65[_0xa590('0x32')][_0xa590('0x37')](_0xa590('0x38'))){_0x51cada['limit']=qs[_0xa590('0x1d')](_0x5aed65[_0xa590('0x32')][_0xa590('0x1d')]);_0x51cada[_0xa590('0x1b')]=qs[_0xa590('0x1b')](_0x5aed65['query']['offset']);}_0x51cada[_0xa590('0x39')]=qs[_0xa590('0x3a')](_0x5aed65[_0xa590('0x32')][_0xa590('0x3a')]);_0x51cada[_0xa590('0x3b')]=qs[_0xa590('0x3c')](_[_0xa590('0x5f')](_0x5aed65[_0xa590('0x32')],_0x350c19['filters']));_0x51cada['where'][_0xa590('0x5c')]=_0x22f2e0['id'];if(_0x5aed65[_0xa590('0x32')][_0xa590('0x3d')]){_0x51cada[_0xa590('0x3b')]=_[_0xa590('0x3e')](_0x51cada[_0xa590('0x3b')],{'$or':_[_0xa590('0x30')](_0x51cada[_0xa590('0x34')],function(_0x384efa){var _0x3bb159={};_0x3bb159[_0x384efa]={'$like':'%'+_0x5aed65[_0xa590('0x32')][_0xa590('0x3d')]+'%'};return _0x3bb159;})});}_0x51cada=_[_0xa590('0x3e')]({},_0x51cada,_0x5aed65[_0xa590('0x4a')]);return db[_0xa590('0x63')][_0xa590('0x1e')]({'where':_0x51cada['where']})[_0xa590('0x26')](function(_0x56e3c0){_0x2714e9[_0xa590('0x1e')]=_0x56e3c0;if(_0x5aed65['query'][_0xa590('0x42')]){_0x51cada['include']=[{'all':!![]}];}return db[_0xa590('0x63')][_0xa590('0x44')](_0x51cada);})[_0xa590('0x26')](function(_0x2d5ce5){_0x2714e9['rows']=_0x2d5ce5;return _0x2714e9;});}})[_0xa590('0x26')](respondWithFilteredResult(_0x10af90,_0x51cada))[_0xa590('0x46')](handleError(_0x10af90,null));};exports[_0xa590('0x64')]=function(_0x3bf150,_0xdb964d,_0x597b01){var _0x58c4a9={};var _0x336f02={};var _0x5b195c;var _0x213d88;return db[_0xa590('0x41')][_0xa590('0x5a')]({'where':{'id':_0x3bf150[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0xdb964d,null))[_0xa590('0x26')](function(_0x4d627c){if(_0x4d627c){_0x5b195c=_0x4d627c;_0x336f02[_0xa590('0x2f')]=_['keys'](db[_0xa590('0x65')][_0xa590('0x49')]);_0x336f02[_0xa590('0x32')]=_[_0xa590('0x31')](_0x3bf150[_0xa590('0x32')]);_0x336f02[_0xa590('0x3c')]=_[_0xa590('0x33')](_0x336f02[_0xa590('0x2f')],_0x336f02[_0xa590('0x32')]);_0x58c4a9[_0xa590('0x34')]=_[_0xa590('0x33')](_0x336f02[_0xa590('0x2f')],qs[_0xa590('0x35')](_0x3bf150[_0xa590('0x32')]['fields']));_0x58c4a9['attributes']=_0x58c4a9[_0xa590('0x34')]['length']?_0x58c4a9[_0xa590('0x34')]:_0x336f02['model'];_0x58c4a9['order']=qs[_0xa590('0x3a')](_0x3bf150['query']['sort']);_0x58c4a9['where']=qs[_0xa590('0x3c')](_['pick'](_0x3bf150[_0xa590('0x32')],_0x336f02[_0xa590('0x3c')]));if(_0x3bf150[_0xa590('0x32')][_0xa590('0x3d')]){_0x58c4a9[_0xa590('0x3b')]=_[_0xa590('0x3e')](_0x58c4a9[_0xa590('0x3b')],{'$or':_[_0xa590('0x30')](_0x58c4a9[_0xa590('0x34')],function(_0x129470){var _0x12286d={};_0x12286d[_0x129470]={'$like':'%'+_0x3bf150[_0xa590('0x32')][_0xa590('0x3d')]+'%'};return _0x12286d;})});}_0x58c4a9=_[_0xa590('0x3e')]({},_0x58c4a9,_0x3bf150[_0xa590('0x4a')]);return _0x5b195c['getLists'](_0x58c4a9);}})[_0xa590('0x26')](function(_0x14baf8){if(_0x14baf8){_0x213d88=_0x14baf8[_0xa590('0x36')];if(!_0x3bf150[_0xa590('0x32')]['hasOwnProperty'](_0xa590('0x38'))){_0x58c4a9[_0xa590('0x1d')]=qs[_0xa590('0x1d')](_0x3bf150['query']['limit']);_0x58c4a9[_0xa590('0x1b')]=qs['offset'](_0x3bf150[_0xa590('0x32')][_0xa590('0x1b')]);}return _0x5b195c['getLists'](_0x58c4a9);}})[_0xa590('0x26')](function(_0x24584e){if(_0x24584e){return _0x24584e?{'count':_0x213d88,'rows':_0x24584e}:null;}})['then'](respondWithResult(_0xdb964d,null))[_0xa590('0x46')](handleError(_0xdb964d,null));};exports['addLists']=function(_0x291f81,_0x349c26,_0x2b436b){var _0x1fe4cc,_0x3594f4;var _0x114263=[];var _0x12734b=moment()[_0xa590('0x66')](_0xa590('0x67'));return db[_0xa590('0x41')]['find']({'where':{'id':_0x291f81[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x349c26,null))['then'](function(_0x502612){if(_0x502612){_0x3594f4=_0x502612;return _0x502612[_0xa590('0x68')](_0x291f81['body']['ids'],_[_0xa590('0x54')](_0x291f81['body'],['ids','id'])||{});}return null;})['spread'](function(_0x4deb28){var _0x25674a;var _0x4cbc26;_0x1fe4cc=_0x4deb28||[];var _0x442cbf=[];if(_0x4deb28){for(var _0x1c83bc=0x0;_0x1c83bc<_0x4deb28[_0xa590('0x36')];_0x1c83bc+=0x1){var _0x21d625=_0x4deb28[_0x1c83bc][_0xa590('0x28')]({'plain':!![]});_0x3594f4[_0xa590('0x69')]=_0x291f81[_0xa590('0x4c')]['dialCheckDuplicateType']?_0x291f81[_0xa590('0x4c')]['dialCheckDuplicateType']:_0x3594f4[_0xa590('0x69')];switch(_0x3594f4['dialCheckDuplicateType']){case _0xa590('0x6a'):_0x25674a=squel[_0xa590('0x6b')]()[_0xa590('0x6c')](_0xa590('0x6d'))[_0xa590('0x6e')](['phone','scheduledAt',_0xa590('0x6f'),'ListId',_0xa590('0x5c'),_0xa590('0x56'),_0xa590('0x55')],squel['select']()[_0xa590('0x70')](_0xa590('0x71'),_0xa590('0x71'))[_0xa590('0x70')]('NOW()',_0xa590('0x72'))[_0xa590('0x70')]('id','ContactId')['field'](_0x21d625[_0xa590('0x73')][_0xa590('0x74')](),_0xa590('0x75'))[_0xa590('0x70')](_0x291f81[_0xa590('0x48')]['id'][_0xa590('0x74')](),_0xa590('0x5c'))[_0xa590('0x70')]('\x27'+_0x12734b+'\x27',_0xa590('0x56'))[_0xa590('0x70')]('\x27'+_0x12734b+'\x27','updatedAt')[_0xa590('0x76')]('cm_contacts')[_0xa590('0x3b')](_0xa590('0x77'))[_0xa590('0x3b')](_0xa590('0x78'),_0x21d625[_0xa590('0x73')][_0xa590('0x74')]())[_0xa590('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0xa590('0x3b')](_0xa590('0x79'),squel[_0xa590('0x7a')]()[_0xa590('0x70')](_0xa590('0x7b'))[_0xa590('0x76')]('cm_hopper_final')[_0xa590('0x3b')](_0xa590('0x7c'),_0x291f81[_0xa590('0x48')]['id'][_0xa590('0x74')]()))[_0xa590('0x3b')](_0xa590('0x79'),squel[_0xa590('0x7a')]()[_0xa590('0x70')]('COALESCE(phone,\x27\x27)')[_0xa590('0x76')](_0xa590('0x6d'))['where'](_0xa590('0x7c'),_0x291f81[_0xa590('0x48')]['id']['toString']())))['toString']();break;case _0xa590('0x7d'):_0x25674a=squel[_0xa590('0x6b')]()['into'](_0xa590('0x6d'))[_0xa590('0x6e')](['phone',_0xa590('0x72'),_0xa590('0x6f'),_0xa590('0x75'),'CampaignId','createdAt',_0xa590('0x55')],squel[_0xa590('0x7a')]()[_0xa590('0x70')](_0xa590('0x71'),_0xa590('0x71'))['field'](_0xa590('0x7e'),_0xa590('0x72'))[_0xa590('0x70')]('id','ContactId')['field'](_0x21d625['CmListId'][_0xa590('0x74')](),'ListId')[_0xa590('0x70')](_0x291f81[_0xa590('0x48')]['id'][_0xa590('0x74')](),_0xa590('0x5c'))['field']('\x27'+_0x12734b+'\x27','createdAt')[_0xa590('0x70')]('\x27'+_0x12734b+'\x27',_0xa590('0x55'))[_0xa590('0x76')]('cm_contacts')[_0xa590('0x3b')](_0xa590('0x77'))[_0xa590('0x3b')]('ListId\x20=\x20?',_0x21d625[_0xa590('0x73')][_0xa590('0x74')]())[_0xa590('0x3b')](_0xa590('0x7f'))[_0xa590('0x3b')](_0xa590('0x79'),squel['select']()[_0xa590('0x70')](_0xa590('0x80'))['from'](_0xa590('0x6d'))['where'](_0xa590('0x7c'),_0x291f81[_0xa590('0x48')]['id'][_0xa590('0x74')]())))[_0xa590('0x74')]();break;default:_0x25674a=squel[_0xa590('0x6b')]()[_0xa590('0x6c')](_0xa590('0x6d'))['fromQuery']([_0xa590('0x71'),_0xa590('0x72'),_0xa590('0x6f'),_0xa590('0x75'),_0xa590('0x5c'),_0xa590('0x56'),_0xa590('0x55')],squel['select']()[_0xa590('0x70')]('phone','phone')['field'](_0xa590('0x7e'),'scheduledAt')[_0xa590('0x70')]('id',_0xa590('0x6f'))[_0xa590('0x70')](_0x21d625[_0xa590('0x73')][_0xa590('0x74')](),'ListId')[_0xa590('0x70')](_0x291f81[_0xa590('0x48')]['id'][_0xa590('0x74')](),'CampaignId')['field']('\x27'+_0x12734b+'\x27','createdAt')[_0xa590('0x70')]('\x27'+_0x12734b+'\x27',_0xa590('0x55'))[_0xa590('0x76')](_0xa590('0x81'))[_0xa590('0x3b')](_0xa590('0x77'))['where'](_0xa590('0x78'),_0x21d625[_0xa590('0x73')][_0xa590('0x74')]())[_0xa590('0x3b')](_0xa590('0x7f')))[_0xa590('0x74')]();}_0x4cbc26=squel[_0xa590('0x6b')]()[_0xa590('0x6c')](_0xa590('0x82'))['fromQuery']([_0xa590('0x83'),_0xa590('0x72'),_0xa590('0x71'),_0xa590('0x84'),_0xa590('0x56'),_0xa590('0x55')],squel[_0xa590('0x7a')]()['field'](_0xa590('0x85'),'id')['field'](_0xa590('0x7e'),'scheduledAt')['field'](_0xa590('0x86'),_0xa590('0x71'))['field'](_0xa590('0x87'),_0xa590('0x84'))[_0xa590('0x70')]('\x27'+_0x12734b+'\x27','createdAt')[_0xa590('0x70')]('\x27'+_0x12734b+'\x27',_0xa590('0x55'))[_0xa590('0x76')](_0xa590('0x88'),'ci')['join'](_0xa590('0x6d'),'h',_0xa590('0x89'))['where'](_0xa590('0x8a'),_0x21d625[_0xa590('0x73')]['toString']())['where'](_0xa590('0x8b'),_0x291f81['params']['id'][_0xa590('0x74')]())[_0xa590('0x3b')](_0xa590('0x8c'),_0x12734b))[_0xa590('0x74')]();_0x442cbf[_0xa590('0x8d')](db[_0xa590('0x8e')][_0xa590('0x32')](_0x25674a));_0x114263['push'](db[_0xa590('0x8e')][_0xa590('0x32')](_0x4cbc26));}return BPromise['all'](_0x442cbf);}})[_0xa590('0x26')](function(){return BPromise[_0xa590('0x8f')](_0x114263);})[_0xa590('0x26')](function(){return _0x1fe4cc;})[_0xa590('0x26')](respondWithResult(_0x349c26,null))[_0xa590('0x46')](handleError(_0x349c26,null));};exports[_0xa590('0x90')]=function(_0xd5f94e,_0x327f27,_0x4c7518){return db[_0xa590('0x41')]['find']({'where':{'id':_0xd5f94e[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x327f27,null))[_0xa590('0x26')](function(_0x29e173){if(_0x29e173){return _0x29e173['removeLists'](_0xd5f94e[_0xa590('0x32')][_0xa590('0x91')]);}})['then'](function(_0x1d1b3d){if(_0x1d1b3d){return db['CmHopper'][_0xa590('0x27')]({'where':{'ListId':_0xd5f94e[_0xa590('0x32')][_0xa590('0x91')],'CampaignId':_0xd5f94e[_0xa590('0x48')]['id']}})[_0xa590('0x26')](function(){return _0x1d1b3d;});}})[_0xa590('0x26')](respondWithStatusCode(_0x327f27,null))[_0xa590('0x46')](handleError(_0x327f27,null));};exports[_0xa590('0x92')]=function(_0x321d99,_0x48d87a,_0x5e416a){var _0x5d99b0={};var _0x55ca2e={};var _0x3522db;var _0x336b3b;return db[_0xa590('0x41')][_0xa590('0x5a')]({'where':{'id':_0x321d99[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x48d87a,null))[_0xa590('0x26')](function(_0x478a00){if(_0x478a00){_0x3522db=_0x478a00;_0x55ca2e[_0xa590('0x2f')]=_[_0xa590('0x31')](db[_0xa590('0x65')]['rawAttributes']);_0x55ca2e['query']=_['keys'](_0x321d99[_0xa590('0x32')]);_0x55ca2e[_0xa590('0x3c')]=_[_0xa590('0x33')](_0x55ca2e['model'],_0x55ca2e['query']);_0x5d99b0[_0xa590('0x34')]=_[_0xa590('0x33')](_0x55ca2e[_0xa590('0x2f')],qs[_0xa590('0x35')](_0x321d99[_0xa590('0x32')][_0xa590('0x35')]));_0x5d99b0['attributes']=_0x5d99b0[_0xa590('0x34')][_0xa590('0x36')]?_0x5d99b0[_0xa590('0x34')]:_0x55ca2e[_0xa590('0x2f')];_0x5d99b0['order']=qs[_0xa590('0x3a')](_0x321d99['query'][_0xa590('0x3a')]);_0x5d99b0[_0xa590('0x3b')]=qs[_0xa590('0x3c')](_[_0xa590('0x5f')](_0x321d99[_0xa590('0x32')],_0x55ca2e[_0xa590('0x3c')]));if(_0x321d99['query']['filter']){_0x5d99b0[_0xa590('0x3b')]=_['merge'](_0x5d99b0['where'],{'$or':_['map'](_0x5d99b0[_0xa590('0x34')],function(_0xecf21a){var _0x512ef8={};_0x512ef8[_0xecf21a]={'$like':'%'+_0x321d99[_0xa590('0x32')][_0xa590('0x3d')]+'%'};return _0x512ef8;})});}_0x5d99b0=_['merge']({},_0x5d99b0,_0x321d99[_0xa590('0x4a')]);return _0x3522db[_0xa590('0x92')](_0x5d99b0);}})['then'](function(_0x12afce){if(_0x12afce){_0x336b3b=_0x12afce['length'];if(!_0x321d99[_0xa590('0x32')][_0xa590('0x37')](_0xa590('0x38'))){_0x5d99b0['limit']=qs[_0xa590('0x1d')](_0x321d99[_0xa590('0x32')]['limit']);_0x5d99b0['offset']=qs[_0xa590('0x1b')](_0x321d99[_0xa590('0x32')][_0xa590('0x1b')]);}return _0x3522db[_0xa590('0x92')](_0x5d99b0);}})['then'](function(_0x2787d5){if(_0x2787d5){return _0x2787d5?{'count':_0x336b3b,'rows':_0x2787d5}:null;}})['then'](respondWithResult(_0x48d87a,null))[_0xa590('0x46')](handleError(_0x48d87a,null));};exports[_0xa590('0x93')]=function(_0x5809b9,_0x5227d4,_0x75bcd7){var _0x91077b,_0x5d0c5b;var _0xb748d=[];var _0x25c42d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xa590('0x41')][_0xa590('0x50')]({'where':{'id':_0x5809b9[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x5227d4,null))[_0xa590('0x26')](function(_0x31d048){if(_0x31d048){_0x5d0c5b=_0x31d048;return _0x31d048['addBlackLists'](_0x5809b9[_0xa590('0x4c')][_0xa590('0x91')],_['omit'](_0x5809b9[_0xa590('0x4c')],[_0xa590('0x91'),'id'])||{});}return null;})[_0xa590('0x94')](function(_0x15363f){var _0x5811d4;var _0x37e19a;_0x91077b=_0x15363f||[];var _0x1eb4e2=[];if(_0x15363f){for(var _0x1c9150=0x0;_0x1c9150<_0x15363f['length'];_0x1c9150+=0x1){var _0x58d8c7=_0x15363f[_0x1c9150][_0xa590('0x28')]({'plain':!![]});_0x5811d4=squel[_0xa590('0x6b')]()[_0xa590('0x6c')](_0xa590('0x95'))['fromQuery']([_0xa590('0x71'),_0xa590('0x6f'),_0xa590('0x75'),'CampaignId',_0xa590('0x56'),_0xa590('0x55')],squel[_0xa590('0x7a')]()[_0xa590('0x70')]('phone','phone')['field']('id',_0xa590('0x6f'))['field'](_0x58d8c7['CmListId'][_0xa590('0x74')](),_0xa590('0x75'))[_0xa590('0x70')](_0x5809b9[_0xa590('0x48')]['id'][_0xa590('0x74')](),'CampaignId')[_0xa590('0x70')](_0xa590('0x7e'),'createdAt')['field'](_0xa590('0x7e'),_0xa590('0x55'))[_0xa590('0x76')](_0xa590('0x81'))[_0xa590('0x3b')](_0xa590('0x77'))[_0xa590('0x3b')](_0xa590('0x78'),_0x58d8c7[_0xa590('0x73')]['toString']())['where'](_0xa590('0x7f')))['toString']();_0x1eb4e2['push'](db[_0xa590('0x8e')]['query'](_0x5811d4));}return BPromise[_0xa590('0x8f')](_0x1eb4e2);}})['then'](function(){return _0x91077b;})[_0xa590('0x26')](respondWithResult(_0x5227d4,null))[_0xa590('0x46')](handleError(_0x5227d4,null));};exports[_0xa590('0x96')]=function(_0x5a6b38,_0x5ca0fc,_0x295e44){return db[_0xa590('0x41')][_0xa590('0x50')]({'where':{'id':_0x5a6b38[_0xa590('0x48')]['id']}})[_0xa590('0x26')](handleEntityNotFound(_0x5ca0fc,null))['then'](function(_0x5c583c){if(_0x5c583c){return _0x5c583c['removeBlackLists'](_0x5a6b38[_0xa590('0x32')][_0xa590('0x91')]);}})['then'](function(_0x4beaaf){if(_0x4beaaf){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x5a6b38[_0xa590('0x32')][_0xa590('0x91')],'CampaignId':_0x5a6b38['params']['id']}})[_0xa590('0x26')](function(){return _0x4beaaf;});}})['then'](respondWithStatusCode(_0x5ca0fc,null))['catch'](handleError(_0x5ca0fc,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 8d298e5..659e83e 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_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':'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(_0x19b5a0,_0x22be6a){var _0x3535d4=function(_0x15150e){while(--_0x15150e){_0x19b5a0['push'](_0x19b5a0['shift']());}};_0x3535d4(++_0x22be6a);}(_0x7a54,0x106));var _0x47a5=function(_0x52e1f4,_0x49febd){_0x52e1f4=_0x52e1f4-0x0;var _0x4a75e3=_0x7a54[_0x52e1f4];return _0x4a75e3;};'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 d8726ad..1c07494 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 _0x303a=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','findAll','options','where','attributes','map','include','model'];(function(_0x3f6c45,_0x45f2f3){var _0x5f15b8=function(_0x1e8f1a){while(--_0x1e8f1a){_0x3f6c45['push'](_0x3f6c45['shift']());}};_0x5f15b8(++_0x45f2f3);}(_0x303a,0x1a0));var _0xa303=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x303a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f1,_0x69b173,_0x5d95fd){return new BPromise(function(_0x51e1ee,_0x488c85){return client[_0xa303('0xc')](_0x3f61f1,_0x5d95fd)[_0xa303('0xd')](function(_0x5e2e48){logger[_0xa303('0xe')]('Campaign,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));logger['debug'](_0xa303('0x10'),_0x69b173,_0xa303('0xf'),JSON[_0xa303('0x11')](_0x5e2e48));if(_0x5e2e48[_0xa303('0x12')]){if(_0x5e2e48['error'][_0xa303('0x13')]===0x1f4){logger['error'](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x488c85(_0x5e2e48['error'][_0xa303('0x15')]);}logger[_0xa303('0x12')](_0xa303('0x14'),_0x69b173,_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);return _0x51e1ee(_0x5e2e48[_0xa303('0x12')][_0xa303('0x15')]);}else{logger[_0xa303('0xe')]('Campaign,\x20%s,\x20%s',_0x69b173,_0xa303('0xf'));_0x51e1ee(_0x5e2e48[_0xa303('0x16')][_0xa303('0x15')]);}})[_0xa303('0x17')](function(_0x3e2813){logger[_0xa303('0x12')]('Campaign,\x20%s,\x20%s',_0x69b173,_0x3e2813);_0x488c85(_0x3e2813);});});}exports[_0xa303('0x18')]=function(_0x54ca49){var _0x1d2003=this;return new Promise(function(_0x4cf535,_0x4462be){return db['Campaign'][_0xa303('0x19')]({'raw':_0x54ca49[_0xa303('0x1a')]?_0x54ca49[_0xa303('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x54ca49[_0xa303('0x1a')]?_0x54ca49[_0xa303('0x1a')][_0xa303('0x1b')]||null:null,'attributes':_0x54ca49['options']?_0x54ca49[_0xa303('0x1a')][_0xa303('0x1c')]||null:null,'limit':_0x54ca49[_0xa303('0x1a')]?_0x54ca49[_0xa303('0x1a')]['limit']||null:null,'include':_0x54ca49[_0xa303('0x1a')]?_0x54ca49[_0xa303('0x1a')]['include']?_[_0xa303('0x1d')](_0x54ca49[_0xa303('0x1a')][_0xa303('0x1e')],function(_0x122d1e){return{'model':db[_0x122d1e[_0xa303('0x1f')]],'as':_0x122d1e['as'],'attributes':_0x122d1e[_0xa303('0x1c')],'include':_0x122d1e[_0xa303('0x1e')]?_[_0xa303('0x1d')](_0x122d1e[_0xa303('0x1e')],function(_0x57d584){return{'model':db[_0x57d584['model']],'as':_0x57d584['as'],'attributes':_0x57d584['attributes'],'include':_0x57d584['include']?_['map'](_0x57d584[_0xa303('0x1e')],function(_0xc1fd3a){return{'model':db[_0xc1fd3a[_0xa303('0x1f')]],'as':_0xc1fd3a['as'],'attributes':_0xc1fd3a[_0xa303('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa303('0xd')](function(_0x48e79f){logger[_0xa303('0xe')](_0xa303('0x18'),_0x54ca49);logger['debug'](_0xa303('0x18'),_0x54ca49,JSON[_0xa303('0x11')](_0x48e79f));_0x4cf535(_0x48e79f);})[_0xa303('0x17')](function(_0x32dcfb){logger[_0xa303('0x12')](_0xa303('0x18'),_0x32dcfb[_0xa303('0x15')],_0x54ca49);_0x4462be(_0x1d2003[_0xa303('0x12')](0x1f4,_0x32dcfb[_0xa303('0x15')]));});});}; \ No newline at end of file +var _0x6e16=['debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x5a51bf,_0x4dabd1){var _0x2caf3e=function(_0x3f6569){while(--_0x3f6569){_0x5a51bf['push'](_0x5a51bf['shift']());}};_0x2caf3e(++_0x4dabd1);}(_0x6e16,0x1d3));var _0x66e1=function(_0x38f864,_0x20433a){_0x38f864=_0x38f864-0x0;var _0x5ba3d3=_0x6e16[_0x38f864];return _0x5ba3d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66e1('0x0'));var BPromise=require('bluebird');var rs=require(_0x66e1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e1('0x2'))['db'];var utils=require(_0x66e1('0x3'));var logger=require('../../config/logger')(_0x66e1('0x4'));var config=require('../../config/environment');var jayson=require(_0x66e1('0x5'));var client=jayson[_0x66e1('0x6')][_0x66e1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d1175,_0x37dd64,_0x43b549){return new BPromise(function(_0x257ecd,_0x202c0d){return client[_0x66e1('0x8')](_0x5d1175,_0x43b549)[_0x66e1('0x9')](function(_0x2d5c1a){logger[_0x66e1('0xa')](_0x66e1('0xb'),_0x37dd64,_0x66e1('0xc'));logger[_0x66e1('0xd')](_0x66e1('0xe'),_0x37dd64,_0x66e1('0xc'),JSON[_0x66e1('0xf')](_0x2d5c1a));if(_0x2d5c1a['error']){if(_0x2d5c1a['error'][_0x66e1('0x10')]===0x1f4){logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x2d5c1a['error']['message']);return _0x202c0d(_0x2d5c1a[_0x66e1('0x11')]['message']);}logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x2d5c1a['error'][_0x66e1('0x12')]);return _0x257ecd(_0x2d5c1a[_0x66e1('0x11')]['message']);}else{logger[_0x66e1('0xa')](_0x66e1('0xb'),_0x37dd64,_0x66e1('0xc'));_0x257ecd(_0x2d5c1a[_0x66e1('0x13')]['message']);}})[_0x66e1('0x14')](function(_0x3e3d19){logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x3e3d19);_0x202c0d(_0x3e3d19);});});}exports[_0x66e1('0x15')]=function(_0x4f3276){var _0x590552=this;return new Promise(function(_0x2b5585,_0x553fe3){return db[_0x66e1('0x16')][_0x66e1('0x17')]({'raw':_0x4f3276[_0x66e1('0x18')]?_0x4f3276[_0x66e1('0x18')][_0x66e1('0x19')]===undefined?!![]:![]:!![],'where':_0x4f3276['options']?_0x4f3276[_0x66e1('0x18')][_0x66e1('0x1a')]||null:null,'attributes':_0x4f3276[_0x66e1('0x18')]?_0x4f3276[_0x66e1('0x18')][_0x66e1('0x1b')]||null:null,'limit':_0x4f3276[_0x66e1('0x18')]?_0x4f3276[_0x66e1('0x18')][_0x66e1('0x1c')]||null:null,'include':_0x4f3276[_0x66e1('0x18')]?_0x4f3276[_0x66e1('0x18')][_0x66e1('0x1d')]?_[_0x66e1('0x1e')](_0x4f3276[_0x66e1('0x18')][_0x66e1('0x1d')],function(_0x756840){return{'model':db[_0x756840[_0x66e1('0x1f')]],'as':_0x756840['as'],'attributes':_0x756840[_0x66e1('0x1b')],'include':_0x756840['include']?_[_0x66e1('0x1e')](_0x756840['include'],function(_0x203919){return{'model':db[_0x203919[_0x66e1('0x1f')]],'as':_0x203919['as'],'attributes':_0x203919[_0x66e1('0x1b')],'include':_0x203919[_0x66e1('0x1d')]?_[_0x66e1('0x1e')](_0x203919['include'],function(_0x5c416d){return{'model':db[_0x5c416d[_0x66e1('0x1f')]],'as':_0x5c416d['as'],'attributes':_0x5c416d[_0x66e1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4036c5){logger['info']('GetCampaign',_0x4f3276);logger[_0x66e1('0xd')](_0x66e1('0x15'),_0x4f3276,JSON[_0x66e1('0xf')](_0x4036c5));_0x2b5585(_0x4036c5);})[_0x66e1('0x14')](function(_0x218902){logger[_0x66e1('0x11')](_0x66e1('0x15'),_0x218902[_0x66e1('0x12')],_0x4f3276);_0x553fe3(_0x590552[_0x66e1('0x11')](0x1f4,_0x218902[_0x66e1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 4b9ff6d..4714073 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 _0x7217=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','put','update','destroy','delete','removeBlackLists','exports','path'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x7217,0xa9));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7721('0x0'));var timeout=require('connect-timeout');var express=require(_0x7721('0x1'));var router=express[_0x7721('0x2')]();var fs_extra=require(_0x7721('0x3'));var auth=require(_0x7721('0x4'));var interaction=require(_0x7721('0x5'));var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router['get'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')]('/:id/hoppers',auth[_0x7721('0x9')](),controller[_0x7721('0xd')]);router['get'](_0x7721('0xe'),auth[_0x7721('0x9')](),controller[_0x7721('0xf')]);router['get'](_0x7721('0x10'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router['get'](_0x7721('0x12'),auth[_0x7721('0x9')](),controller['getHopperBlacks']);router[_0x7721('0x8')](_0x7721('0x13'),auth['isAuthenticated'](),controller[_0x7721('0x14')]);router[_0x7721('0x8')](_0x7721('0x15'),auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router['post']('/',auth[_0x7721('0x9')](),controller[_0x7721('0x17')]);router[_0x7721('0x18')](_0x7721('0x19'),auth['isAuthenticated'](),controller[_0x7721('0x1a')]);router['post'](_0x7721('0x13'),auth['isAuthenticated'](),controller[_0x7721('0x1b')]);router['post']('/:id/blacklists',auth[_0x7721('0x9')](),controller['addBlackLists']);router[_0x7721('0x1c')]('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router['delete'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x1e')]);router['delete'](_0x7721('0x13'),auth['isAuthenticated'](),controller['removeLists']);router[_0x7721('0x1f')](_0x7721('0x15'),auth['isAuthenticated'](),controller[_0x7721('0x20')]);module[_0x7721('0x21')]=router; \ No newline at end of file +var _0x98c0=['getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','delete','destroy','removeLists','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks'];(function(_0x2a7d4b,_0x476017){var _0x20771c=function(_0x5edf52){while(--_0x5edf52){_0x2a7d4b['push'](_0x2a7d4b['shift']());}};_0x20771c(++_0x476017);}(_0x98c0,0xc2));var _0x098c=function(_0x4b150d,_0x294130){_0x4b150d=_0x4b150d-0x0;var _0x2e5fad=_0x98c0[_0x4b150d];return _0x2e5fad;};'use strict';var multer=require(_0x098c('0x0'));var util=require(_0x098c('0x1'));var path=require(_0x098c('0x2'));var timeout=require('connect-timeout');var express=require(_0x098c('0x3'));var router=express[_0x098c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x098c('0x5'));var interaction=require(_0x098c('0x6'));var config=require(_0x098c('0x7'));var controller=require(_0x098c('0x8'));router[_0x098c('0x9')]('/',auth[_0x098c('0xa')](),controller['index']);router[_0x098c('0x9')]('/:id',auth[_0x098c('0xa')](),controller['show']);router[_0x098c('0x9')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0x098c('0x9')](_0x098c('0xb'),auth[_0x098c('0xa')](),controller[_0x098c('0xc')]);router[_0x098c('0x9')]('/:id/hopper_finals',auth[_0x098c('0xa')](),controller[_0x098c('0xd')]);router[_0x098c('0x9')](_0x098c('0xe'),auth[_0x098c('0xa')](),controller[_0x098c('0xf')]);router[_0x098c('0x9')]('/:id/lists',auth[_0x098c('0xa')](),controller[_0x098c('0x10')]);router[_0x098c('0x9')](_0x098c('0x11'),auth[_0x098c('0xa')](),controller[_0x098c('0x12')]);router[_0x098c('0x13')]('/',auth[_0x098c('0xa')](),controller[_0x098c('0x14')]);router[_0x098c('0x13')](_0x098c('0x15'),auth[_0x098c('0xa')](),controller[_0x098c('0x16')]);router[_0x098c('0x13')](_0x098c('0x17'),auth['isAuthenticated'](),controller[_0x098c('0x18')]);router[_0x098c('0x13')](_0x098c('0x11'),auth['isAuthenticated'](),controller[_0x098c('0x19')]);router[_0x098c('0x1a')]('/:id',auth[_0x098c('0xa')](),controller['update']);router[_0x098c('0x1b')]('/:id',auth[_0x098c('0xa')](),controller[_0x098c('0x1c')]);router[_0x098c('0x1b')](_0x098c('0x17'),auth[_0x098c('0xa')](),controller[_0x098c('0x1d')]);router['delete'](_0x098c('0x11'),auth[_0x098c('0xa')](),controller['removeBlackLists']);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 4a832d8..d712f6f 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 _0xaf2f=['STRING','VIRTUAL','key','sequelize','exports','TEXT','medium'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xaf2f,0x10d));var _0xfaf2=function(_0x31bf86,_0x390fcf){_0x31bf86=_0x31bf86-0x0;var _0x14e978=_0xaf2f[_0x31bf86];return _0x14e978;};'use strict';var Sequelize=require(_0xfaf2('0x0'));module[_0xfaf2('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xfaf2('0x2')],'length':_0xfaf2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfaf2('0x4')]},'name':{'type':Sequelize[_0xfaf2('0x5')],'get':function(){return this['getDataValue'](_0xfaf2('0x6'));}}}; \ No newline at end of file +var _0x79a0=['TEXT','medium','VIRTUAL','getDataValue','exports','STRING'];(function(_0x53f218,_0x27514c){var _0x21890a=function(_0x445133){while(--_0x445133){_0x53f218['push'](_0x53f218['shift']());}};_0x21890a(++_0x27514c);}(_0x79a0,0xa0));var _0x079a=function(_0x234ba6,_0x39a2f6){_0x234ba6=_0x234ba6-0x0;var _0x37b8e1=_0x79a0[_0x234ba6];return _0x37b8e1;};'use strict';var Sequelize=require('sequelize');module[_0x079a('0x0')]={'key':{'type':Sequelize[_0x079a('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x079a('0x2')],'length':_0x079a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x079a('0x1')]},'name':{'type':Sequelize[_0x079a('0x4')],'get':function(){return this[_0x079a('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3b8604e..7995915 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 _0x1a4b=['end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x1a4b,0x1a4));var _0xb1a4=function(_0x4502ff,_0x4ea0a7){_0x4502ff=_0x4502ff-0x0;var _0x443010=_0x1a4b[_0x4502ff];return _0x443010;};'use strict';var emlformat=require(_0xb1a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1a4('0x1'));var jsonpatch=require(_0xb1a4('0x2'));var rp=require(_0xb1a4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb1a4('0x4'));var path=require(_0xb1a4('0x5'));var sox=require('sox');var csv=require(_0xb1a4('0x6'));var ejs=require(_0xb1a4('0x7'));var fs=require('fs');var fs_extra=require(_0xb1a4('0x8'));var _=require(_0xb1a4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb1a4('0xa'));var deskjs=require(_0xb1a4('0xb'));var toCsv=require(_0xb1a4('0x6'));var querystring=require(_0xb1a4('0xc'));var Papa=require(_0xb1a4('0xd'));var Redis=require(_0xb1a4('0xe'));var authService=require(_0xb1a4('0xf'));var qs=require(_0xb1a4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1a4('0x11'));var logger=require(_0xb1a4('0x12'))(_0xb1a4('0x13'));var utils=require(_0xb1a4('0x14'));var config=require(_0xb1a4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1a4('0x16'))['db'];function respondWithStatusCode(_0x144adf,_0x5324ec){_0x5324ec=_0x5324ec||0xcc;return function(_0x4b107e){if(_0x4b107e){return _0x144adf[_0xb1a4('0x17')](_0x5324ec);}return _0x144adf[_0xb1a4('0x18')](_0x5324ec)[_0xb1a4('0x19')]();};}function respondWithResult(_0x5a159e,_0x477306){_0x477306=_0x477306||0xc8;return function(_0xe0ac06){if(_0xe0ac06){return _0x5a159e[_0xb1a4('0x18')](_0x477306)[_0xb1a4('0x1a')](_0xe0ac06);}};}function respondWithFilteredResult(_0x54074d,_0x531924){return function(_0x3bbfc3){if(_0x3bbfc3){var _0xa2253=typeof _0x531924[_0xb1a4('0x1b')]===_0xb1a4('0x1c')&&typeof _0x531924[_0xb1a4('0x1d')]==='undefined';var _0x34bce2=_0x3bbfc3[_0xb1a4('0x1e')];var _0x2db1a9=_0xa2253?0x0:_0x531924[_0xb1a4('0x1b')];var _0x497352=_0xa2253?_0x3bbfc3[_0xb1a4('0x1e')]:_0x531924[_0xb1a4('0x1b')]+_0x531924[_0xb1a4('0x1d')];var _0x2eec00;if(_0x497352>=_0x34bce2){_0x497352=_0x34bce2;_0x2eec00=0xc8;}else{_0x2eec00=0xce;}_0x54074d[_0xb1a4('0x18')](_0x2eec00);return _0x54074d[_0xb1a4('0x1f')]('Content-Range',_0x2db1a9+'-'+_0x497352+'/'+_0x34bce2)[_0xb1a4('0x1a')](_0x3bbfc3);}return null;};}function patchUpdates(_0x2a4e44){return function(_0x210752){try{jsonpatch[_0xb1a4('0x20')](_0x210752,_0x2a4e44,!![]);}catch(_0x11dde6){return BPromise['reject'](_0x11dde6);}return _0x210752[_0xb1a4('0x21')]();};}function saveUpdates(_0x32173d,_0x24284d){return function(_0x2839b4){if(_0x2839b4){return _0x2839b4[_0xb1a4('0x22')](_0x32173d)['then'](function(_0x3acae4){return _0x3acae4;});}return null;};}function removeEntity(_0x45fc4d,_0x5039bc){return function(_0x226add){if(_0x226add){return _0x226add[_0xb1a4('0x23')]()[_0xb1a4('0x24')](function(){var _0x2acfe5=_0x226add[_0xb1a4('0x25')]({'plain':!![]});var _0x5dfd96='CannedAnswers';return db[_0xb1a4('0x26')][_0xb1a4('0x23')]({'where':{'type':_0x5dfd96,'resourceId':_0x2acfe5['id']}})[_0xb1a4('0x24')](function(){return _0x226add;});})[_0xb1a4('0x24')](function(){_0x45fc4d[_0xb1a4('0x18')](0xcc)[_0xb1a4('0x19')]();});}};}function handleEntityNotFound(_0x292ffa,_0x247956){return function(_0xf0745a){if(!_0xf0745a){_0x292ffa[_0xb1a4('0x17')](0x194);}return _0xf0745a;};}function handleError(_0x508d88,_0x3c1e8b){_0x3c1e8b=_0x3c1e8b||0x1f4;return function(_0x244dfc){logger[_0xb1a4('0x27')](_0x244dfc[_0xb1a4('0x28')]);if(_0x244dfc[_0xb1a4('0x29')]){delete _0x244dfc[_0xb1a4('0x29')];}_0x508d88['status'](_0x3c1e8b)[_0xb1a4('0x2a')](_0x244dfc);};}exports[_0xb1a4('0x2b')]=function(_0x3b010c,_0x55722c){var _0x50dc4c={},_0x3d79f2={},_0x48d77d={'count':0x0,'rows':[]};var _0x31e68d=_[_0xb1a4('0x2c')](db[_0xb1a4('0x2d')][_0xb1a4('0x2e')],function(_0x3ab56a){return{'name':_0x3ab56a[_0xb1a4('0x2f')],'type':_0x3ab56a[_0xb1a4('0x30')][_0xb1a4('0x31')]};});_0x3d79f2['model']=_[_0xb1a4('0x2c')](_0x31e68d,_0xb1a4('0x29'));_0x3d79f2[_0xb1a4('0x32')]=_[_0xb1a4('0x33')](_0x3b010c[_0xb1a4('0x32')]);_0x3d79f2[_0xb1a4('0x34')]=_['intersection'](_0x3d79f2[_0xb1a4('0x35')],_0x3d79f2['query']);_0x50dc4c[_0xb1a4('0x36')]=_[_0xb1a4('0x37')](_0x3d79f2['model'],qs[_0xb1a4('0x38')](_0x3b010c[_0xb1a4('0x32')]['fields']));_0x50dc4c['attributes']=_0x50dc4c[_0xb1a4('0x36')][_0xb1a4('0x39')]?_0x50dc4c[_0xb1a4('0x36')]:_0x3d79f2['model'];if(!_0x3b010c['query'][_0xb1a4('0x3a')](_0xb1a4('0x3b'))){_0x50dc4c[_0xb1a4('0x1d')]=qs[_0xb1a4('0x1d')](_0x3b010c[_0xb1a4('0x32')][_0xb1a4('0x1d')]);_0x50dc4c[_0xb1a4('0x1b')]=qs[_0xb1a4('0x1b')](_0x3b010c['query'][_0xb1a4('0x1b')]);}_0x50dc4c[_0xb1a4('0x3c')]=qs[_0xb1a4('0x3d')](_0x3b010c[_0xb1a4('0x32')][_0xb1a4('0x3d')]);_0x50dc4c[_0xb1a4('0x3e')]=qs['filters'](_['pick'](_0x3b010c[_0xb1a4('0x32')],_0x3d79f2[_0xb1a4('0x34')]),_0x31e68d);if(_0x3b010c['query'][_0xb1a4('0x3f')]){_0x50dc4c[_0xb1a4('0x3e')]=_[_0xb1a4('0x40')](_0x50dc4c[_0xb1a4('0x3e')],{'$or':[{'key':{'$like':'%'+_0x3b010c['query']['filter']+'%'}},{'value':{'$like':'%'+_0x3b010c[_0xb1a4('0x32')][_0xb1a4('0x3f')]+'%'}}]});}_0x50dc4c=_[_0xb1a4('0x40')]({},_0x50dc4c,_0x3b010c[_0xb1a4('0x41')]);var _0x24199b={'where':_0x50dc4c['where']};return db[_0xb1a4('0x2d')]['count'](_0x24199b)['then'](function(_0x27c53d){_0x48d77d['count']=_0x27c53d;if(_0x3b010c[_0xb1a4('0x32')][_0xb1a4('0x42')]){_0x50dc4c[_0xb1a4('0x43')]=[{'all':!![]}];}return db[_0xb1a4('0x2d')][_0xb1a4('0x44')](_0x50dc4c);})['then'](function(_0x4c2918){_0x48d77d[_0xb1a4('0x45')]=_0x4c2918;return _0x48d77d;})[_0xb1a4('0x24')](respondWithFilteredResult(_0x55722c,_0x50dc4c))['catch'](handleError(_0x55722c,null));};exports[_0xb1a4('0x46')]=function(_0x21be70,_0x531d56){var _0x21990c={'raw':!![],'where':{'id':_0x21be70[_0xb1a4('0x47')]['id']}},_0x349023={};_0x349023['model']=_[_0xb1a4('0x33')](db[_0xb1a4('0x2d')][_0xb1a4('0x2e')]);_0x349023[_0xb1a4('0x32')]=_['keys'](_0x21be70[_0xb1a4('0x32')]);_0x349023[_0xb1a4('0x34')]=_[_0xb1a4('0x37')](_0x349023[_0xb1a4('0x35')],_0x349023[_0xb1a4('0x32')]);_0x21990c['attributes']=_[_0xb1a4('0x37')](_0x349023['model'],qs['fields'](_0x21be70[_0xb1a4('0x32')][_0xb1a4('0x38')]));_0x21990c[_0xb1a4('0x36')]=_0x21990c[_0xb1a4('0x36')]['length']?_0x21990c[_0xb1a4('0x36')]:_0x349023[_0xb1a4('0x35')];if(_0x21be70[_0xb1a4('0x32')][_0xb1a4('0x42')]){_0x21990c[_0xb1a4('0x43')]=[{'all':!![]}];}_0x21990c=_[_0xb1a4('0x40')]({},_0x21990c,_0x21be70[_0xb1a4('0x41')]);return db[_0xb1a4('0x2d')][_0xb1a4('0x48')](_0x21990c)[_0xb1a4('0x24')](handleEntityNotFound(_0x531d56,null))[_0xb1a4('0x24')](respondWithResult(_0x531d56,null))[_0xb1a4('0x49')](handleError(_0x531d56,null));};exports[_0xb1a4('0x22')]=function(_0x5739c7,_0x440774){if(_0x5739c7['body']['id']){delete _0x5739c7[_0xb1a4('0x4a')]['id'];}return db[_0xb1a4('0x2d')][_0xb1a4('0x48')]({'where':{'id':_0x5739c7['params']['id']}})[_0xb1a4('0x24')](handleEntityNotFound(_0x440774,null))[_0xb1a4('0x24')](saveUpdates(_0x5739c7[_0xb1a4('0x4a')],null))[_0xb1a4('0x24')](respondWithResult(_0x440774,null))[_0xb1a4('0x49')](handleError(_0x440774,null));};exports[_0xb1a4('0x23')]=function(_0x470421,_0x5b0288){return db[_0xb1a4('0x2d')]['find']({'where':{'id':_0x470421['params']['id']}})[_0xb1a4('0x24')](handleEntityNotFound(_0x5b0288,null))[_0xb1a4('0x24')](removeEntity(_0x5b0288,null))[_0xb1a4('0x49')](handleError(_0x5b0288,null));};exports[_0xb1a4('0x4b')]=function(_0x1a8c48,_0x3d5ce9){var _0xac649c={'key':_0x1a8c48['body'][_0xb1a4('0x31')]};if(_0x1a8c48[_0xb1a4('0x4a')][_0xb1a4('0x4c')]){_0xac649c['MailAccountId']=_0x1a8c48[_0xb1a4('0x4a')][_0xb1a4('0x4c')];}else if(_0x1a8c48['body']['SmsAccountId']){_0xac649c[_0xb1a4('0x4d')]=_0x1a8c48[_0xb1a4('0x4a')][_0xb1a4('0x4d')];}else if(_0x1a8c48[_0xb1a4('0x4a')][_0xb1a4('0x4e')]){_0xac649c[_0xb1a4('0x4e')]=_0x1a8c48[_0xb1a4('0x4a')][_0xb1a4('0x4e')];}else if(_0x1a8c48[_0xb1a4('0x4a')][_0xb1a4('0x4f')]){_0xac649c[_0xb1a4('0x4f')]=_0x1a8c48[_0xb1a4('0x4a')][_0xb1a4('0x4f')];}return db[_0xb1a4('0x2d')][_0xb1a4('0x48')]({'where':_0xac649c})[_0xb1a4('0x24')](function(_0xe3f111){if(_0xe3f111){throw new db[(_0xb1a4('0x50'))][(_0xb1a4('0x51'))](_0xb1a4('0x52'));}return db['CannedAnswer'][_0xb1a4('0x4b')](_0x1a8c48[_0xb1a4('0x4a')]);})[_0xb1a4('0x24')](function(_0x3e6e87){var _0x9dedca=_0x1a8c48[_0xb1a4('0x53')][_0xb1a4('0x25')]({'plain':!![]});if(!_0x9dedca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9dedca[_0xb1a4('0x54')]===_0xb1a4('0x53')){var _0x4876fc=_0x3e6e87[_0xb1a4('0x25')]({'plain':!![]});return db['UserProfileSection'][_0xb1a4('0x48')]({'where':{'name':_0xb1a4('0x55'),'userProfileId':_0x9dedca[_0xb1a4('0x56')]},'raw':!![]})[_0xb1a4('0x24')](function(_0x537040){if(_0x537040&&_0x537040[_0xb1a4('0x57')]===0x0){return db[_0xb1a4('0x26')][_0xb1a4('0x4b')]({'name':_0x4876fc[_0xb1a4('0x29')],'resourceId':_0x4876fc['id'],'type':_0x537040['name'],'sectionId':_0x537040['id']},{})[_0xb1a4('0x24')](function(){return _0x3e6e87;});}else{return _0x3e6e87;}})[_0xb1a4('0x49')](function(_0x5092e7){logger['error'](_0xb1a4('0x58'),_0x5092e7);throw _0x5092e7;});}return _0x3e6e87;})[_0xb1a4('0x24')](respondWithResult(_0x3d5ce9,0xc9))['catch'](handleError(_0x3d5ce9,null));}; \ No newline at end of file +var _0x9955=['fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','includeAll','findAll','rows','params','include','options','catch','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0x9955,0x191));var _0x5995=function(_0x1716f6,_0x109f0b){_0x1716f6=_0x1716f6-0x0;var _0xbecb6f=_0x9955[_0x1716f6];return _0xbecb6f;};'use strict';var emlformat=require(_0x5995('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5995('0x1'));var jsonpatch=require(_0x5995('0x2'));var rp=require(_0x5995('0x3'));var moment=require('moment');var BPromise=require(_0x5995('0x4'));var Mustache=require(_0x5995('0x5'));var util=require(_0x5995('0x6'));var path=require(_0x5995('0x7'));var sox=require(_0x5995('0x8'));var csv=require(_0x5995('0x9'));var ejs=require(_0x5995('0xa'));var fs=require('fs');var fs_extra=require(_0x5995('0xb'));var _=require(_0x5995('0xc'));var squel=require(_0x5995('0xd'));var crypto=require(_0x5995('0xe'));var jsforce=require(_0x5995('0xf'));var deskjs=require(_0x5995('0x10'));var toCsv=require(_0x5995('0x9'));var querystring=require('querystring');var Papa=require(_0x5995('0x11'));var Redis=require(_0x5995('0x12'));var authService=require(_0x5995('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5995('0x14'));var hardwareService=require(_0x5995('0x15'));var logger=require('../../config/logger')(_0x5995('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5995('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d1dbe,_0x378b32){_0x378b32=_0x378b32||0xcc;return function(_0x221608){if(_0x221608){return _0x1d1dbe[_0x5995('0x18')](_0x378b32);}return _0x1d1dbe[_0x5995('0x19')](_0x378b32)[_0x5995('0x1a')]();};}function respondWithResult(_0x39fcd6,_0x3e8696){_0x3e8696=_0x3e8696||0xc8;return function(_0x7a64cd){if(_0x7a64cd){return _0x39fcd6['status'](_0x3e8696)[_0x5995('0x1b')](_0x7a64cd);}};}function respondWithFilteredResult(_0x1f353d,_0x5e975e){return function(_0x46320f){if(_0x46320f){var _0x20d58d=typeof _0x5e975e[_0x5995('0x1c')]===_0x5995('0x1d')&&typeof _0x5e975e[_0x5995('0x1e')]===_0x5995('0x1d');var _0x4eaeb4=_0x46320f[_0x5995('0x1f')];var _0x586abd=_0x20d58d?0x0:_0x5e975e[_0x5995('0x1c')];var _0x26115a=_0x20d58d?_0x46320f[_0x5995('0x1f')]:_0x5e975e['offset']+_0x5e975e[_0x5995('0x1e')];var _0x538f99;if(_0x26115a>=_0x4eaeb4){_0x26115a=_0x4eaeb4;_0x538f99=0xc8;}else{_0x538f99=0xce;}_0x1f353d[_0x5995('0x19')](_0x538f99);return _0x1f353d[_0x5995('0x20')]('Content-Range',_0x586abd+'-'+_0x26115a+'/'+_0x4eaeb4)[_0x5995('0x1b')](_0x46320f);}return null;};}function patchUpdates(_0x402185){return function(_0x28f237){try{jsonpatch[_0x5995('0x21')](_0x28f237,_0x402185,!![]);}catch(_0x382265){return BPromise[_0x5995('0x22')](_0x382265);}return _0x28f237[_0x5995('0x23')]();};}function saveUpdates(_0x260bd0,_0x4980ac){return function(_0x4c7cfa){if(_0x4c7cfa){return _0x4c7cfa['update'](_0x260bd0)['then'](function(_0x55d5d5){return _0x55d5d5;});}return null;};}function removeEntity(_0x5bd3e4,_0x13e64f){return function(_0x3ac54a){if(_0x3ac54a){return _0x3ac54a[_0x5995('0x24')]()[_0x5995('0x25')](function(){var _0x28f10f=_0x3ac54a[_0x5995('0x26')]({'plain':!![]});var _0x1eeec5=_0x5995('0x27');return db[_0x5995('0x28')][_0x5995('0x24')]({'where':{'type':_0x1eeec5,'resourceId':_0x28f10f['id']}})[_0x5995('0x25')](function(){return _0x3ac54a;});})[_0x5995('0x25')](function(){_0x5bd3e4[_0x5995('0x19')](0xcc)[_0x5995('0x1a')]();});}};}function handleEntityNotFound(_0x1d2d82,_0x14b59c){return function(_0x14aac9){if(!_0x14aac9){_0x1d2d82['sendStatus'](0x194);}return _0x14aac9;};}function handleError(_0x59845f,_0x535009){_0x535009=_0x535009||0x1f4;return function(_0x587bd9){logger[_0x5995('0x29')](_0x587bd9[_0x5995('0x2a')]);if(_0x587bd9[_0x5995('0x2b')]){delete _0x587bd9[_0x5995('0x2b')];}_0x59845f[_0x5995('0x19')](_0x535009)[_0x5995('0x2c')](_0x587bd9);};}exports[_0x5995('0x2d')]=function(_0x1598ae,_0x27e9fe){var _0xa04cc7={},_0xf49fba={},_0x2d97ff={'count':0x0,'rows':[]};var _0x5ed8ec=_[_0x5995('0x2e')](db[_0x5995('0x2f')][_0x5995('0x30')],function(_0x9c58d9){return{'name':_0x9c58d9[_0x5995('0x31')],'type':_0x9c58d9[_0x5995('0x32')][_0x5995('0x33')]};});_0xf49fba['model']=_[_0x5995('0x2e')](_0x5ed8ec,'name');_0xf49fba['query']=_[_0x5995('0x34')](_0x1598ae[_0x5995('0x35')]);_0xf49fba[_0x5995('0x36')]=_[_0x5995('0x37')](_0xf49fba[_0x5995('0x38')],_0xf49fba[_0x5995('0x35')]);_0xa04cc7['attributes']=_[_0x5995('0x37')](_0xf49fba[_0x5995('0x38')],qs[_0x5995('0x39')](_0x1598ae['query'][_0x5995('0x39')]));_0xa04cc7[_0x5995('0x3a')]=_0xa04cc7[_0x5995('0x3a')][_0x5995('0x3b')]?_0xa04cc7[_0x5995('0x3a')]:_0xf49fba[_0x5995('0x38')];if(!_0x1598ae[_0x5995('0x35')]['hasOwnProperty']('nolimit')){_0xa04cc7[_0x5995('0x1e')]=qs[_0x5995('0x1e')](_0x1598ae[_0x5995('0x35')]['limit']);_0xa04cc7[_0x5995('0x1c')]=qs[_0x5995('0x1c')](_0x1598ae[_0x5995('0x35')]['offset']);}_0xa04cc7[_0x5995('0x3c')]=qs[_0x5995('0x3d')](_0x1598ae[_0x5995('0x35')][_0x5995('0x3d')]);_0xa04cc7[_0x5995('0x3e')]=qs[_0x5995('0x36')](_[_0x5995('0x3f')](_0x1598ae[_0x5995('0x35')],_0xf49fba[_0x5995('0x36')]),_0x5ed8ec);if(_0x1598ae[_0x5995('0x35')][_0x5995('0x40')]){_0xa04cc7[_0x5995('0x3e')]=_[_0x5995('0x41')](_0xa04cc7['where'],{'$or':[{'key':{'$like':'%'+_0x1598ae[_0x5995('0x35')][_0x5995('0x40')]+'%'}},{'value':{'$like':'%'+_0x1598ae['query'][_0x5995('0x40')]+'%'}}]});}_0xa04cc7=_['merge']({},_0xa04cc7,_0x1598ae['options']);var _0x553191={'where':_0xa04cc7[_0x5995('0x3e')]};return db[_0x5995('0x2f')]['count'](_0x553191)[_0x5995('0x25')](function(_0x436e40){_0x2d97ff[_0x5995('0x1f')]=_0x436e40;if(_0x1598ae[_0x5995('0x35')][_0x5995('0x42')]){_0xa04cc7['include']=[{'all':!![]}];}return db[_0x5995('0x2f')][_0x5995('0x43')](_0xa04cc7);})[_0x5995('0x25')](function(_0x2302ca){_0x2d97ff[_0x5995('0x44')]=_0x2302ca;return _0x2d97ff;})[_0x5995('0x25')](respondWithFilteredResult(_0x27e9fe,_0xa04cc7))['catch'](handleError(_0x27e9fe,null));};exports['show']=function(_0x5f0ce7,_0x258bd6){var _0x2d6d3d={'raw':!![],'where':{'id':_0x5f0ce7[_0x5995('0x45')]['id']}},_0x29dfe6={};_0x29dfe6['model']=_[_0x5995('0x34')](db['CannedAnswer']['rawAttributes']);_0x29dfe6[_0x5995('0x35')]=_[_0x5995('0x34')](_0x5f0ce7[_0x5995('0x35')]);_0x29dfe6['filters']=_['intersection'](_0x29dfe6[_0x5995('0x38')],_0x29dfe6[_0x5995('0x35')]);_0x2d6d3d[_0x5995('0x3a')]=_[_0x5995('0x37')](_0x29dfe6[_0x5995('0x38')],qs[_0x5995('0x39')](_0x5f0ce7[_0x5995('0x35')][_0x5995('0x39')]));_0x2d6d3d[_0x5995('0x3a')]=_0x2d6d3d['attributes'][_0x5995('0x3b')]?_0x2d6d3d[_0x5995('0x3a')]:_0x29dfe6[_0x5995('0x38')];if(_0x5f0ce7['query']['includeAll']){_0x2d6d3d[_0x5995('0x46')]=[{'all':!![]}];}_0x2d6d3d=_[_0x5995('0x41')]({},_0x2d6d3d,_0x5f0ce7[_0x5995('0x47')]);return db[_0x5995('0x2f')]['find'](_0x2d6d3d)['then'](handleEntityNotFound(_0x258bd6,null))[_0x5995('0x25')](respondWithResult(_0x258bd6,null))[_0x5995('0x48')](handleError(_0x258bd6,null));};exports[_0x5995('0x49')]=function(_0x2c0dc0,_0x3f6269){if(_0x2c0dc0[_0x5995('0x4a')]['id']){delete _0x2c0dc0[_0x5995('0x4a')]['id'];}return db[_0x5995('0x2f')]['find']({'where':{'id':_0x2c0dc0['params']['id']}})[_0x5995('0x25')](handleEntityNotFound(_0x3f6269,null))[_0x5995('0x25')](saveUpdates(_0x2c0dc0[_0x5995('0x4a')],null))['then'](respondWithResult(_0x3f6269,null))[_0x5995('0x48')](handleError(_0x3f6269,null));};exports[_0x5995('0x24')]=function(_0x111f03,_0x29e815){return db[_0x5995('0x2f')]['find']({'where':{'id':_0x111f03[_0x5995('0x45')]['id']}})['then'](handleEntityNotFound(_0x29e815,null))['then'](removeEntity(_0x29e815,null))['catch'](handleError(_0x29e815,null));};exports[_0x5995('0x4b')]=function(_0xb27080,_0xb54a4b){var _0xd3a183={'key':_0xb27080[_0x5995('0x4a')]['key']};if(_0xb27080['body'][_0x5995('0x4c')]){_0xd3a183['MailAccountId']=_0xb27080['body'][_0x5995('0x4c')];}else if(_0xb27080[_0x5995('0x4a')][_0x5995('0x4d')]){_0xd3a183[_0x5995('0x4d')]=_0xb27080[_0x5995('0x4a')][_0x5995('0x4d')];}else if(_0xb27080['body'][_0x5995('0x4e')]){_0xd3a183[_0x5995('0x4e')]=_0xb27080[_0x5995('0x4a')][_0x5995('0x4e')];}else if(_0xb27080[_0x5995('0x4a')][_0x5995('0x4f')]){_0xd3a183[_0x5995('0x4f')]=_0xb27080[_0x5995('0x4a')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0xd3a183})[_0x5995('0x25')](function(_0x4003d8){if(_0x4003d8){throw new db[(_0x5995('0x50'))][(_0x5995('0x51'))](_0x5995('0x52'));}return db[_0x5995('0x2f')]['create'](_0xb27080[_0x5995('0x4a')]);})[_0x5995('0x25')](function(_0x205b6e){var _0x1f6a16=_0xb27080[_0x5995('0x53')][_0x5995('0x26')]({'plain':!![]});if(!_0x1f6a16)throw new Error(_0x5995('0x54'));if(_0x1f6a16['role']===_0x5995('0x53')){var _0x512db4=_0x205b6e[_0x5995('0x26')]({'plain':!![]});return db[_0x5995('0x55')][_0x5995('0x56')]({'where':{'name':_0x5995('0x27'),'userProfileId':_0x1f6a16[_0x5995('0x57')]},'raw':!![]})[_0x5995('0x25')](function(_0x5392ea){if(_0x5392ea&&_0x5392ea[_0x5995('0x58')]===0x0){return db[_0x5995('0x28')]['create']({'name':_0x512db4[_0x5995('0x2b')],'resourceId':_0x512db4['id'],'type':_0x5392ea[_0x5995('0x2b')],'sectionId':_0x5392ea['id']},{})[_0x5995('0x25')](function(){return _0x205b6e;});}else{return _0x205b6e;}})[_0x5995('0x48')](function(_0x5dca01){logger['error'](_0x5995('0x59'),_0x5dca01);throw _0x5dca01;});}return _0x205b6e;})['then'](respondWithResult(_0xb54a4b,0xc9))[_0x5995('0x48')](handleError(_0xb54a4b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9eab174..ddff1b8 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 _0xccda=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xccda,0x14f));var _0xaccd=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0xccda[_0x1fa759];return _0x2da9f4;};'use strict';var _=require(_0xaccd('0x0'));var util=require('util');var logger=require(_0xaccd('0x1'))(_0xaccd('0x2'));var moment=require(_0xaccd('0x3'));var BPromise=require(_0xaccd('0x4'));var rp=require(_0xaccd('0x5'));var fs=require('fs');var path=require(_0xaccd('0x6'));var rimraf=require('rimraf');var config=require(_0xaccd('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xaccd('0x8')]=function(_0x5d1104,_0x186f5b){return _0x5d1104['define'](_0xaccd('0x9'),attributes,{'tableName':_0xaccd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaccd('0xb')});}; \ No newline at end of file +var _0x8514=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','moment','request-promise','path','./cannedAnswer.attributes'];(function(_0xeacba,_0x2b1d5e){var _0x10eb9e=function(_0xe0e821){while(--_0xe0e821){_0xeacba['push'](_0xeacba['shift']());}};_0x10eb9e(++_0x2b1d5e);}(_0x8514,0x101));var _0x4851=function(_0x2ff68c,_0x2eb768){_0x2ff68c=_0x2ff68c-0x0;var _0x25f663=_0x8514[_0x2ff68c];return _0x25f663;};'use strict';var _=require(_0x4851('0x0'));var util=require(_0x4851('0x1'));var logger=require('../../config/logger')(_0x4851('0x2'));var moment=require(_0x4851('0x3'));var BPromise=require('bluebird');var rp=require(_0x4851('0x4'));var fs=require('fs');var path=require(_0x4851('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4851('0x6'));module[_0x4851('0x7')]=function(_0x241301,_0xfcab82){return _0x241301[_0x4851('0x8')](_0x4851('0x9'),attributes,{'tableName':_0x4851('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4851('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 0b9d453..731a1fa 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(_0x2073c5,_0x55f9de){var _0x576744=function(_0x31e0b8){while(--_0x31e0b8){_0x2073c5['push'](_0x2073c5['shift']());}};_0x576744(++_0x55f9de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x25c974,_0x5efe99){var _0x1cca0b=function(_0x21172f){while(--_0x21172f){_0x25c974['push'](_0x25c974['shift']());}};_0x1cca0b(++_0x5efe99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 b70ac1d..ddc5e6f 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 _0xc247=['put','/:id','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','show','post','create'];(function(_0x11d371,_0x471095){var _0x1f256c=function(_0x33f65f){while(--_0x33f65f){_0x11d371['push'](_0x11d371['shift']());}};_0x1f256c(++_0x471095);}(_0xc247,0xa6));var _0x7c24=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xc247[_0x247fa1];return _0x244f35;};'use strict';var multer=require(_0x7c24('0x0'));var util=require(_0x7c24('0x1'));var path=require(_0x7c24('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c24('0x3'));var router=express[_0x7c24('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7c24('0x5'));var interaction=require(_0x7c24('0x6'));var config=require(_0x7c24('0x7'));var controller=require(_0x7c24('0x8'));router[_0x7c24('0x9')]('/',auth[_0x7c24('0xa')](),controller['index']);router[_0x7c24('0x9')]('/:id',auth[_0x7c24('0xa')](),controller[_0x7c24('0xb')]);router[_0x7c24('0xc')]('/',auth[_0x7c24('0xa')](),controller[_0x7c24('0xd')]);router[_0x7c24('0xe')](_0x7c24('0xf'),auth[_0x7c24('0xa')](),controller['update']);router[_0x7c24('0x10')](_0x7c24('0xf'),auth[_0x7c24('0xa')](),controller['destroy']);module[_0x7c24('0x11')]=router; \ No newline at end of file +var _0x399e=['../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x525798,_0x77a707){var _0x57da9a=function(_0x20837b){while(--_0x20837b){_0x525798['push'](_0x525798['shift']());}};_0x57da9a(++_0x77a707);}(_0x399e,0x185));var _0xe399=function(_0x1da5f4,_0x44bca7){_0x1da5f4=_0x1da5f4-0x0;var _0x58e944=_0x399e[_0x1da5f4];return _0x58e944;};'use strict';var multer=require('multer');var util=require(_0xe399('0x0'));var path=require(_0xe399('0x1'));var timeout=require(_0xe399('0x2'));var express=require('express');var router=express[_0xe399('0x3')]();var fs_extra=require(_0xe399('0x4'));var auth=require(_0xe399('0x5'));var interaction=require(_0xe399('0x6'));var config=require(_0xe399('0x7'));var controller=require(_0xe399('0x8'));router[_0xe399('0x9')]('/',auth[_0xe399('0xa')](),controller[_0xe399('0xb')]);router[_0xe399('0x9')](_0xe399('0xc'),auth[_0xe399('0xa')](),controller[_0xe399('0xd')]);router[_0xe399('0xe')]('/',auth[_0xe399('0xa')](),controller[_0xe399('0xf')]);router['put'](_0xe399('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe399('0x10')]('/:id',auth[_0xe399('0xa')](),controller[_0xe399('0x11')]);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 c347bee..4bff089 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 _0x3df4=['STRING','INTEGER','DATE','1970-01-01\x2000:00:01'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3df4,0x102));var _0x43df=function(_0x465e35,_0x19f5c3){_0x465e35=_0x465e35-0x0;var _0x5eba07=_0x3df4[_0x465e35];return _0x5eba07;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x43df('0x0')],'allowNull':![],'defaultValue':_0x43df('0x1')},'clid':{'type':Sequelize[_0x43df('0x2')]},'src':{'type':Sequelize[_0x43df('0x2')]},'dst':{'type':Sequelize[_0x43df('0x2')]},'dcontext':{'type':Sequelize[_0x43df('0x2')]},'channel':{'type':Sequelize[_0x43df('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x43df('0x2')]},'duration':{'type':Sequelize[_0x43df('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x43df('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x43df('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x43df('0x2')]},'uniqueid':{'type':Sequelize[_0x43df('0x2')]},'linkedid':{'type':Sequelize[_0x43df('0x2')]},'sequence':{'type':Sequelize[_0x43df('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x43df('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc79=['INTEGER','DATE','STRING'];(function(_0x59e1f2,_0x4e1d81){var _0x5ab921=function(_0xf7a64){while(--_0xf7a64){_0x59e1f2['push'](_0x59e1f2['shift']());}};_0x5ab921(++_0x4e1d81);}(_0xfc79,0x1c3));var _0x9fc7=function(_0x288f33,_0x326fef){_0x288f33=_0x288f33-0x0;var _0x462334=_0xfc79[_0x288f33];return _0x462334;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x9fc7('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x9fc7('0x1')]},'dst':{'type':Sequelize[_0x9fc7('0x1')]},'dcontext':{'type':Sequelize[_0x9fc7('0x1')]},'channel':{'type':Sequelize[_0x9fc7('0x1')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x9fc7('0x1')]},'lastdata':{'type':Sequelize[_0x9fc7('0x1')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9fc7('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9fc7('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9fc7('0x1')]},'userfield':{'type':Sequelize[_0x9fc7('0x1')]},'uniqueid':{'type':Sequelize[_0x9fc7('0x1')]},'linkedid':{'type':Sequelize[_0x9fc7('0x1')]},'sequence':{'type':Sequelize[_0x9fc7('0x1')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9fc7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 369bc20..a3af402 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 _0xe0c3=['request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','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','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','Cdr','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x386a7a,_0x55fdf5){var _0x590a8e=function(_0x36f9ea){while(--_0x36f9ea){_0x386a7a['push'](_0x386a7a['shift']());}};_0x590a8e(++_0x55fdf5);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x3e0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e0c('0x1'));var jsonpatch=require(_0x3e0c('0x2'));var rp=require(_0x3e0c('0x3'));var moment=require(_0x3e0c('0x4'));var BPromise=require(_0x3e0c('0x5'));var Mustache=require(_0x3e0c('0x6'));var util=require(_0x3e0c('0x7'));var path=require(_0x3e0c('0x8'));var sox=require(_0x3e0c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e0c('0xa'));var _=require(_0x3e0c('0xb'));var squel=require(_0x3e0c('0xc'));var crypto=require(_0x3e0c('0xd'));var jsforce=require(_0x3e0c('0xe'));var deskjs=require(_0x3e0c('0xf'));var toCsv=require(_0x3e0c('0x10'));var querystring=require(_0x3e0c('0x11'));var Papa=require(_0x3e0c('0x12'));var Redis=require(_0x3e0c('0x13'));var authService=require(_0x3e0c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e0c('0x15'));var logger=require(_0x3e0c('0x16'))(_0x3e0c('0x17'));var utils=require(_0x3e0c('0x18'));var config=require(_0x3e0c('0x19'));var licenseUtil=require(_0x3e0c('0x1a'));var db=require(_0x3e0c('0x1b'))['db'];function respondWithStatusCode(_0x5dc732,_0x38b416){_0x38b416=_0x38b416||0xcc;return function(_0x491432){if(_0x491432){return _0x5dc732[_0x3e0c('0x1c')](_0x38b416);}return _0x5dc732[_0x3e0c('0x1d')](_0x38b416)['end']();};}function respondWithResult(_0x5f2654,_0x6d9c61){_0x6d9c61=_0x6d9c61||0xc8;return function(_0x409b2c){if(_0x409b2c){return _0x5f2654[_0x3e0c('0x1d')](_0x6d9c61)[_0x3e0c('0x1e')](_0x409b2c);}};}function respondWithFilteredResult(_0x15a269,_0x24fcf9){return function(_0x1947c2){if(_0x1947c2){var _0x274d75=typeof _0x24fcf9[_0x3e0c('0x1f')]===_0x3e0c('0x20')&&typeof _0x24fcf9[_0x3e0c('0x21')]==='undefined';var _0x58c498=_0x1947c2[_0x3e0c('0x22')];var _0x216993=_0x274d75?0x0:_0x24fcf9[_0x3e0c('0x1f')];var _0x41b19f=_0x274d75?_0x1947c2[_0x3e0c('0x22')]:_0x24fcf9[_0x3e0c('0x1f')]+_0x24fcf9['limit'];var _0x2e4a4a;if(_0x41b19f>=_0x58c498){_0x41b19f=_0x58c498;_0x2e4a4a=0xc8;}else{_0x2e4a4a=0xce;}_0x15a269[_0x3e0c('0x1d')](_0x2e4a4a);return _0x15a269[_0x3e0c('0x23')]('Content-Range',_0x216993+'-'+_0x41b19f+'/'+_0x58c498)[_0x3e0c('0x1e')](_0x1947c2);}return null;};}function patchUpdates(_0x5e3a93){return function(_0x479265){try{jsonpatch[_0x3e0c('0x24')](_0x479265,_0x5e3a93,!![]);}catch(_0x1f3bad){return BPromise[_0x3e0c('0x25')](_0x1f3bad);}return _0x479265[_0x3e0c('0x26')]();};}function saveUpdates(_0x4f8d38,_0x4cd447){return function(_0x3320c6){if(_0x3320c6){return _0x3320c6['update'](_0x4f8d38)['then'](function(_0x3fd7de){return _0x3fd7de;});}return null;};}function removeEntity(_0x1769b1,_0x44ce68){return function(_0x5bb7aa){if(_0x5bb7aa){return _0x5bb7aa[_0x3e0c('0x27')]()[_0x3e0c('0x28')](function(){_0x1769b1['status'](0xcc)[_0x3e0c('0x29')]();});}};}function handleEntityNotFound(_0x3de58b,_0x308fd5){return function(_0x1db945){if(!_0x1db945){_0x3de58b['sendStatus'](0x194);}return _0x1db945;};}function handleError(_0x412960,_0xc2f3cc){_0xc2f3cc=_0xc2f3cc||0x1f4;return function(_0x2c5fba){logger[_0x3e0c('0x2a')](_0x2c5fba['stack']);if(_0x2c5fba[_0x3e0c('0x2b')]){delete _0x2c5fba['name'];}_0x412960['status'](_0xc2f3cc)[_0x3e0c('0x2c')](_0x2c5fba);};}exports[_0x3e0c('0x2d')]=function(_0x4d3ce2,_0x16fb92){var _0x3f22b1={},_0x21d7a0={},_0x59c22f={'count':0x0,'rows':[]};var _0x44ecad=_[_0x3e0c('0x2e')](db['Cdr'][_0x3e0c('0x2f')],function(_0x2f31ad){return{'name':_0x2f31ad[_0x3e0c('0x30')],'type':_0x2f31ad[_0x3e0c('0x31')]['key']};});_0x21d7a0[_0x3e0c('0x32')]=_[_0x3e0c('0x2e')](_0x44ecad,_0x3e0c('0x2b'));_0x21d7a0['query']=_[_0x3e0c('0x33')](_0x4d3ce2[_0x3e0c('0x34')]);_0x21d7a0[_0x3e0c('0x35')]=_['intersection'](_0x21d7a0[_0x3e0c('0x32')],_0x21d7a0[_0x3e0c('0x34')]);_0x3f22b1[_0x3e0c('0x36')]=_[_0x3e0c('0x37')](_0x21d7a0[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x3f22b1[_0x3e0c('0x36')]=_0x3f22b1[_0x3e0c('0x36')][_0x3e0c('0x39')]?_0x3f22b1[_0x3e0c('0x36')]:_0x21d7a0[_0x3e0c('0x32')];if(!_0x4d3ce2[_0x3e0c('0x34')]['hasOwnProperty'](_0x3e0c('0x3a'))){_0x3f22b1[_0x3e0c('0x21')]=qs[_0x3e0c('0x21')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x21')]);_0x3f22b1[_0x3e0c('0x1f')]=qs[_0x3e0c('0x1f')](_0x4d3ce2[_0x3e0c('0x34')]['offset']);}_0x3f22b1['order']=qs[_0x3e0c('0x3b')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3b')]);_0x3f22b1[_0x3e0c('0x3c')]=qs[_0x3e0c('0x35')](_[_0x3e0c('0x3d')](_0x4d3ce2['query'],_0x21d7a0[_0x3e0c('0x35')]),_0x44ecad);if(_0x4d3ce2[_0x3e0c('0x34')]['filter']){_0x3f22b1['where']=_['merge'](_0x3f22b1[_0x3e0c('0x3c')],{'$or':_[_0x3e0c('0x2e')](_0x44ecad,function(_0x3d6ed7){if(_0x3d6ed7[_0x3e0c('0x31')]!==_0x3e0c('0x3e')){var _0x45ec69={};_0x45ec69[_0x3d6ed7[_0x3e0c('0x2b')]]={'$like':'%'+_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3f')]+'%'};return _0x45ec69;}})});}_0x3f22b1=_[_0x3e0c('0x40')]({},_0x3f22b1,_0x4d3ce2[_0x3e0c('0x41')]);var _0x20135d={'where':_0x3f22b1['where']};return db['Cdr']['count'](_0x20135d)[_0x3e0c('0x28')](function(_0x22fcd8){_0x59c22f['count']=_0x22fcd8;if(_0x4d3ce2['query'][_0x3e0c('0x42')]){_0x3f22b1[_0x3e0c('0x43')]=[{'all':!![]}];}return db[_0x3e0c('0x44')][_0x3e0c('0x45')](_0x3f22b1);})['then'](function(_0x2e562f){_0x59c22f[_0x3e0c('0x46')]=_0x2e562f;return _0x59c22f;})[_0x3e0c('0x28')](respondWithFilteredResult(_0x16fb92,_0x3f22b1))[_0x3e0c('0x47')](handleError(_0x16fb92,null));};exports[_0x3e0c('0x48')]=function(_0x4b5638,_0x1bc4b3){var _0x5f4274={'raw':!![],'where':{'id':_0x4b5638[_0x3e0c('0x49')]['id']}},_0x35111f={};_0x35111f['model']=_['keys'](db[_0x3e0c('0x44')][_0x3e0c('0x2f')]);_0x35111f['query']=_[_0x3e0c('0x33')](_0x4b5638[_0x3e0c('0x34')]);_0x35111f[_0x3e0c('0x35')]=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],_0x35111f[_0x3e0c('0x34')]);_0x5f4274['attributes']=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4b5638[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x5f4274[_0x3e0c('0x36')]=_0x5f4274['attributes'][_0x3e0c('0x39')]?_0x5f4274[_0x3e0c('0x36')]:_0x35111f[_0x3e0c('0x32')];if(_0x4b5638['query'][_0x3e0c('0x42')]){_0x5f4274[_0x3e0c('0x43')]=[{'all':!![]}];}_0x5f4274=_['merge']({},_0x5f4274,_0x4b5638[_0x3e0c('0x41')]);return db[_0x3e0c('0x44')][_0x3e0c('0x4a')](_0x5f4274)['then'](handleEntityNotFound(_0x1bc4b3,null))[_0x3e0c('0x28')](respondWithResult(_0x1bc4b3,null))[_0x3e0c('0x47')](handleError(_0x1bc4b3,null));};exports[_0x3e0c('0x4b')]=function(_0x2c7b8c,_0x109078){return db[_0x3e0c('0x44')][_0x3e0c('0x4b')](_0x2c7b8c[_0x3e0c('0x4c')],{})[_0x3e0c('0x28')](respondWithResult(_0x109078,0xc9))[_0x3e0c('0x47')](handleError(_0x109078,null));};exports[_0x3e0c('0x4d')]=function(_0x4efbf2,_0x20c9df){if(_0x4efbf2['body']['id']){delete _0x4efbf2['body']['id'];}return db[_0x3e0c('0x44')]['find']({'where':{'id':_0x4efbf2[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x20c9df,null))['then'](saveUpdates(_0x4efbf2[_0x3e0c('0x4c')],null))[_0x3e0c('0x28')](respondWithResult(_0x20c9df,null))['catch'](handleError(_0x20c9df,null));};exports[_0x3e0c('0x27')]=function(_0x3e04c9,_0x166203){return db[_0x3e0c('0x44')][_0x3e0c('0x4a')]({'where':{'id':_0x3e04c9[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x166203,null))[_0x3e0c('0x28')](removeEntity(_0x166203,null))[_0x3e0c('0x47')](handleError(_0x166203,null));};exports[_0x3e0c('0x4e')]=function(_0x4d0f77,_0x3743ae){return db[_0x3e0c('0x44')][_0x3e0c('0x4e')]()[_0x3e0c('0x28')](respondWithResult(_0x3743ae,null))[_0x3e0c('0x47')](handleError(_0x3743ae,null));}; \ No newline at end of file +var _0xd8b1=['then','destroy','error','stack','name','index','Cdr','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x187397,_0x5585fc){var _0x47646b=function(_0x4e2b2e){while(--_0x4e2b2e){_0x187397['push'](_0x187397['shift']());}};_0x47646b(++_0x5585fc);}(_0xd8b1,0x105));var _0x1d8b=function(_0x3f6c54,_0xb47d65){_0x3f6c54=_0x3f6c54-0x0;var _0x4feafc=_0xd8b1[_0x3f6c54];return _0x4feafc;};'use strict';var emlformat=require(_0x1d8b('0x0'));var rimraf=require(_0x1d8b('0x1'));var zipdir=require(_0x1d8b('0x2'));var jsonpatch=require(_0x1d8b('0x3'));var rp=require(_0x1d8b('0x4'));var moment=require('moment');var BPromise=require(_0x1d8b('0x5'));var Mustache=require(_0x1d8b('0x6'));var util=require('util');var path=require(_0x1d8b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d8b('0x8'));var _=require('lodash');var squel=require(_0x1d8b('0x9'));var crypto=require(_0x1d8b('0xa'));var jsforce=require(_0x1d8b('0xb'));var deskjs=require(_0x1d8b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d8b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1d8b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d8b('0xf'));var logger=require('../../config/logger')(_0x1d8b('0x10'));var utils=require(_0x1d8b('0x11'));var config=require(_0x1d8b('0x12'));var licenseUtil=require(_0x1d8b('0x13'));var db=require(_0x1d8b('0x14'))['db'];function respondWithStatusCode(_0xfd985b,_0x4f506a){_0x4f506a=_0x4f506a||0xcc;return function(_0xec0671){if(_0xec0671){return _0xfd985b[_0x1d8b('0x15')](_0x4f506a);}return _0xfd985b[_0x1d8b('0x16')](_0x4f506a)[_0x1d8b('0x17')]();};}function respondWithResult(_0x4486a8,_0x3a23d0){_0x3a23d0=_0x3a23d0||0xc8;return function(_0x46bd8c){if(_0x46bd8c){return _0x4486a8[_0x1d8b('0x16')](_0x3a23d0)['json'](_0x46bd8c);}};}function respondWithFilteredResult(_0x50c75f,_0x3d54d3){return function(_0x3f31a4){if(_0x3f31a4){var _0x44ebbe=typeof _0x3d54d3[_0x1d8b('0x18')]===_0x1d8b('0x19')&&typeof _0x3d54d3[_0x1d8b('0x1a')]==='undefined';var _0x5aeef3=_0x3f31a4[_0x1d8b('0x1b')];var _0x100a9b=_0x44ebbe?0x0:_0x3d54d3[_0x1d8b('0x18')];var _0x1b6440=_0x44ebbe?_0x3f31a4[_0x1d8b('0x1b')]:_0x3d54d3['offset']+_0x3d54d3[_0x1d8b('0x1a')];var _0x57c63a;if(_0x1b6440>=_0x5aeef3){_0x1b6440=_0x5aeef3;_0x57c63a=0xc8;}else{_0x57c63a=0xce;}_0x50c75f['status'](_0x57c63a);return _0x50c75f[_0x1d8b('0x1c')](_0x1d8b('0x1d'),_0x100a9b+'-'+_0x1b6440+'/'+_0x5aeef3)[_0x1d8b('0x1e')](_0x3f31a4);}return null;};}function patchUpdates(_0x4f3342){return function(_0x2274c5){try{jsonpatch[_0x1d8b('0x1f')](_0x2274c5,_0x4f3342,!![]);}catch(_0x3cdf3b){return BPromise[_0x1d8b('0x20')](_0x3cdf3b);}return _0x2274c5[_0x1d8b('0x21')]();};}function saveUpdates(_0x130c00,_0x3c2c78){return function(_0x4d5ea8){if(_0x4d5ea8){return _0x4d5ea8[_0x1d8b('0x22')](_0x130c00)[_0x1d8b('0x23')](function(_0x3d8fcb){return _0x3d8fcb;});}return null;};}function removeEntity(_0x308b89,_0x5235b6){return function(_0x5bee29){if(_0x5bee29){return _0x5bee29[_0x1d8b('0x24')]()[_0x1d8b('0x23')](function(){_0x308b89['status'](0xcc)[_0x1d8b('0x17')]();});}};}function handleEntityNotFound(_0x461405,_0x497d02){return function(_0x4df3ab){if(!_0x4df3ab){_0x461405[_0x1d8b('0x15')](0x194);}return _0x4df3ab;};}function handleError(_0x19b9aa,_0x374954){_0x374954=_0x374954||0x1f4;return function(_0xe76d45){logger[_0x1d8b('0x25')](_0xe76d45[_0x1d8b('0x26')]);if(_0xe76d45[_0x1d8b('0x27')]){delete _0xe76d45['name'];}_0x19b9aa[_0x1d8b('0x16')](_0x374954)['send'](_0xe76d45);};}exports[_0x1d8b('0x28')]=function(_0x4ccfa9,_0x37c284){var _0x3f16de={},_0x14928e={},_0x41a54e={'count':0x0,'rows':[]};var _0x569ed4=_['map'](db[_0x1d8b('0x29')][_0x1d8b('0x2a')],function(_0x35efca){return{'name':_0x35efca[_0x1d8b('0x2b')],'type':_0x35efca[_0x1d8b('0x2c')][_0x1d8b('0x2d')]};});_0x14928e['model']=_[_0x1d8b('0x2e')](_0x569ed4,_0x1d8b('0x27'));_0x14928e[_0x1d8b('0x2f')]=_[_0x1d8b('0x30')](_0x4ccfa9[_0x1d8b('0x2f')]);_0x14928e[_0x1d8b('0x31')]=_[_0x1d8b('0x32')](_0x14928e[_0x1d8b('0x33')],_0x14928e[_0x1d8b('0x2f')]);_0x3f16de['attributes']=_[_0x1d8b('0x32')](_0x14928e['model'],qs['fields'](_0x4ccfa9['query'][_0x1d8b('0x34')]));_0x3f16de[_0x1d8b('0x35')]=_0x3f16de[_0x1d8b('0x35')][_0x1d8b('0x36')]?_0x3f16de[_0x1d8b('0x35')]:_0x14928e['model'];if(!_0x4ccfa9[_0x1d8b('0x2f')][_0x1d8b('0x37')](_0x1d8b('0x38'))){_0x3f16de[_0x1d8b('0x1a')]=qs[_0x1d8b('0x1a')](_0x4ccfa9[_0x1d8b('0x2f')][_0x1d8b('0x1a')]);_0x3f16de[_0x1d8b('0x18')]=qs['offset'](_0x4ccfa9[_0x1d8b('0x2f')]['offset']);}_0x3f16de[_0x1d8b('0x39')]=qs['sort'](_0x4ccfa9[_0x1d8b('0x2f')][_0x1d8b('0x3a')]);_0x3f16de[_0x1d8b('0x3b')]=qs['filters'](_[_0x1d8b('0x3c')](_0x4ccfa9[_0x1d8b('0x2f')],_0x14928e[_0x1d8b('0x31')]),_0x569ed4);if(_0x4ccfa9[_0x1d8b('0x2f')]['filter']){_0x3f16de[_0x1d8b('0x3b')]=_[_0x1d8b('0x3d')](_0x3f16de['where'],{'$or':_[_0x1d8b('0x2e')](_0x569ed4,function(_0x48217f){if(_0x48217f['type']!=='VIRTUAL'){var _0x21e9e0={};_0x21e9e0[_0x48217f[_0x1d8b('0x27')]]={'$like':'%'+_0x4ccfa9[_0x1d8b('0x2f')][_0x1d8b('0x3e')]+'%'};return _0x21e9e0;}})});}_0x3f16de=_[_0x1d8b('0x3d')]({},_0x3f16de,_0x4ccfa9[_0x1d8b('0x3f')]);var _0xaee456={'where':_0x3f16de['where']};return db[_0x1d8b('0x29')]['count'](_0xaee456)[_0x1d8b('0x23')](function(_0x5da0e7){_0x41a54e[_0x1d8b('0x1b')]=_0x5da0e7;if(_0x4ccfa9[_0x1d8b('0x2f')][_0x1d8b('0x40')]){_0x3f16de[_0x1d8b('0x41')]=[{'all':!![]}];}return db[_0x1d8b('0x29')][_0x1d8b('0x42')](_0x3f16de);})[_0x1d8b('0x23')](function(_0x47a4e6){_0x41a54e['rows']=_0x47a4e6;return _0x41a54e;})[_0x1d8b('0x23')](respondWithFilteredResult(_0x37c284,_0x3f16de))[_0x1d8b('0x43')](handleError(_0x37c284,null));};exports[_0x1d8b('0x44')]=function(_0x108a51,_0x39cfd3){var _0x4ea452={'raw':!![],'where':{'id':_0x108a51[_0x1d8b('0x45')]['id']}},_0x280775={};_0x280775['model']=_['keys'](db['Cdr'][_0x1d8b('0x2a')]);_0x280775['query']=_[_0x1d8b('0x30')](_0x108a51[_0x1d8b('0x2f')]);_0x280775['filters']=_[_0x1d8b('0x32')](_0x280775[_0x1d8b('0x33')],_0x280775[_0x1d8b('0x2f')]);_0x4ea452[_0x1d8b('0x35')]=_[_0x1d8b('0x32')](_0x280775['model'],qs['fields'](_0x108a51[_0x1d8b('0x2f')][_0x1d8b('0x34')]));_0x4ea452[_0x1d8b('0x35')]=_0x4ea452['attributes'][_0x1d8b('0x36')]?_0x4ea452[_0x1d8b('0x35')]:_0x280775[_0x1d8b('0x33')];if(_0x108a51[_0x1d8b('0x2f')][_0x1d8b('0x40')]){_0x4ea452[_0x1d8b('0x41')]=[{'all':!![]}];}_0x4ea452=_[_0x1d8b('0x3d')]({},_0x4ea452,_0x108a51[_0x1d8b('0x3f')]);return db['Cdr'][_0x1d8b('0x46')](_0x4ea452)[_0x1d8b('0x23')](handleEntityNotFound(_0x39cfd3,null))[_0x1d8b('0x23')](respondWithResult(_0x39cfd3,null))[_0x1d8b('0x43')](handleError(_0x39cfd3,null));};exports[_0x1d8b('0x47')]=function(_0xfaf101,_0x44cc0f){return db[_0x1d8b('0x29')]['create'](_0xfaf101[_0x1d8b('0x48')],{})[_0x1d8b('0x23')](respondWithResult(_0x44cc0f,0xc9))['catch'](handleError(_0x44cc0f,null));};exports['update']=function(_0x33d7cd,_0x51584d){if(_0x33d7cd[_0x1d8b('0x48')]['id']){delete _0x33d7cd[_0x1d8b('0x48')]['id'];}return db[_0x1d8b('0x29')][_0x1d8b('0x46')]({'where':{'id':_0x33d7cd[_0x1d8b('0x45')]['id']}})[_0x1d8b('0x23')](handleEntityNotFound(_0x51584d,null))[_0x1d8b('0x23')](saveUpdates(_0x33d7cd[_0x1d8b('0x48')],null))[_0x1d8b('0x23')](respondWithResult(_0x51584d,null))[_0x1d8b('0x43')](handleError(_0x51584d,null));};exports[_0x1d8b('0x24')]=function(_0x29d30c,_0x28aee5){return db[_0x1d8b('0x29')][_0x1d8b('0x46')]({'where':{'id':_0x29d30c[_0x1d8b('0x45')]['id']}})['then'](handleEntityNotFound(_0x28aee5,null))['then'](removeEntity(_0x28aee5,null))[_0x1d8b('0x43')](handleError(_0x28aee5,null));};exports[_0x1d8b('0x49')]=function(_0x573ba8,_0x2445d3){return db['Cdr']['describe']()['then'](respondWithResult(_0x2445d3,null))[_0x1d8b('0x43')](handleError(_0x2445d3,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9f84fd2..1017bd2 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2518bb,_0x58b72a){var _0x47e82c=function(_0x3d9b5b){while(--_0x3d9b5b){_0x2518bb['push'](_0x2518bb['shift']());}};_0x47e82c(++_0x58b72a);}(_0x7a54,0x106));var _0x47a5=function(_0x9b5c22,_0x3177f8){_0x9b5c22=_0x9b5c22-0x0;var _0x23241f=_0x7a54[_0x9b5c22];return _0x23241f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3f2bb4,_0x4eb949){var _0x4a6bb6=function(_0x460dd9){while(--_0x460dd9){_0x3f2bb4['push'](_0x3f2bb4['shift']());}};_0x4a6bb6(++_0x4eb949);}(_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':'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 cb9348f..0d7297e 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 _0x2aac=['rpc','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2aac,0x93));var _0xc2aa=function(_0x1cb847,_0x555c7b){_0x1cb847=_0x1cb847-0x0;var _0x276318=_0x2aac[_0x1cb847];return _0x276318;};'use strict';var _=require(_0xc2aa('0x0'));var util=require(_0xc2aa('0x1'));var moment=require(_0xc2aa('0x2'));var BPromise=require(_0xc2aa('0x3'));var rs=require(_0xc2aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2aa('0x6'))(_0xc2aa('0x7'));var config=require('../../config/environment');var jayson=require(_0xc2aa('0x8'));var client=jayson[_0xc2aa('0x9')][_0xc2aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44b58d,_0x426cd8,_0x306f02){return new BPromise(function(_0x530def,_0xdea5a8){return client['request'](_0x44b58d,_0x306f02)[_0xc2aa('0xb')](function(_0x3c1c08){logger[_0xc2aa('0xc')](_0xc2aa('0xd'),_0x426cd8,_0xc2aa('0xe'));logger[_0xc2aa('0xf')](_0xc2aa('0x10'),_0x426cd8,_0xc2aa('0xe'),JSON[_0xc2aa('0x11')](_0x3c1c08));if(_0x3c1c08[_0xc2aa('0x12')]){if(_0x3c1c08[_0xc2aa('0x12')][_0xc2aa('0x13')]===0x1f4){logger[_0xc2aa('0x12')](_0xc2aa('0xd'),_0x426cd8,_0x3c1c08[_0xc2aa('0x12')][_0xc2aa('0x14')]);return _0xdea5a8(_0x3c1c08[_0xc2aa('0x12')][_0xc2aa('0x14')]);}logger['error'](_0xc2aa('0xd'),_0x426cd8,_0x3c1c08['error'][_0xc2aa('0x14')]);return _0x530def(_0x3c1c08['error']['message']);}else{logger[_0xc2aa('0xc')](_0xc2aa('0xd'),_0x426cd8,_0xc2aa('0xe'));_0x530def(_0x3c1c08[_0xc2aa('0x15')][_0xc2aa('0x14')]);}})['catch'](function(_0x3da18){logger[_0xc2aa('0x12')](_0xc2aa('0xd'),_0x426cd8,_0x3da18);_0xdea5a8(_0x3da18);});});} \ No newline at end of file +var _0xeb1e=['request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s'];(function(_0x410680,_0x450b2d){var _0x49dc01=function(_0x34cd93){while(--_0x34cd93){_0x410680['push'](_0x410680['shift']());}};_0x49dc01(++_0x450b2d);}(_0xeb1e,0x198));var _0xeeb1=function(_0x4ef16e,_0x447eb6){_0x4ef16e=_0x4ef16e-0x0;var _0x1a4c21=_0xeb1e[_0x4ef16e];return _0x1a4c21;};'use strict';var _=require('lodash');var util=require(_0xeeb1('0x0'));var moment=require('moment');var BPromise=require(_0xeeb1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeb1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeb1('0x3'));var logger=require(_0xeeb1('0x4'))('rpc');var config=require(_0xeeb1('0x5'));var jayson=require(_0xeeb1('0x6'));var client=jayson[_0xeeb1('0x7')][_0xeeb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fb87d,_0x1c7dee,_0x53a564){return new BPromise(function(_0x3b476d,_0x131e7b){return client[_0xeeb1('0x9')](_0x3fb87d,_0x53a564)['then'](function(_0x4ed5f6){logger[_0xeeb1('0xa')](_0xeeb1('0xb'),_0x1c7dee,_0xeeb1('0xc'));logger['debug'](_0xeeb1('0xd'),_0x1c7dee,'request\x20sent',JSON[_0xeeb1('0xe')](_0x4ed5f6));if(_0x4ed5f6[_0xeeb1('0xf')]){if(_0x4ed5f6[_0xeeb1('0xf')][_0xeeb1('0x10')]===0x1f4){logger[_0xeeb1('0xf')](_0xeeb1('0xb'),_0x1c7dee,_0x4ed5f6[_0xeeb1('0xf')][_0xeeb1('0x11')]);return _0x131e7b(_0x4ed5f6['error'][_0xeeb1('0x11')]);}logger['error'](_0xeeb1('0xb'),_0x1c7dee,_0x4ed5f6[_0xeeb1('0xf')][_0xeeb1('0x11')]);return _0x3b476d(_0x4ed5f6[_0xeeb1('0xf')][_0xeeb1('0x11')]);}else{logger[_0xeeb1('0xa')](_0xeeb1('0xb'),_0x1c7dee,_0xeeb1('0xc'));_0x3b476d(_0x4ed5f6[_0xeeb1('0x12')][_0xeeb1('0x11')]);}})[_0xeeb1('0x13')](function(_0x538f07){logger['error'](_0xeeb1('0xb'),_0x1c7dee,_0x538f07);_0x131e7b(_0x538f07);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7a3d06c..98933ed 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x338cc6,_0x1e0d79){var _0x253e0a=function(_0xd88a0e){while(--_0xd88a0e){_0x338cc6['push'](_0x338cc6['shift']());}};_0x253e0a(++_0x1e0d79);}(_0xb10b,0x12a));var _0xbb10=function(_0x423312,_0x25f527){_0x423312=_0x423312-0x0;var _0x33f959=_0xb10b[_0x423312];return _0x33f959;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 89882ea..2b78394 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 _0x8b52=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x234318,_0xf22f31){var _0x1ab719=function(_0x10a0b1){while(--_0x10a0b1){_0x234318['push'](_0x234318['shift']());}};_0x1ab719(++_0xf22f31);}(_0x8b52,0x10e));var _0x28b5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8b52[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x28b5('0x0'));module[_0x28b5('0x1')]={'priority':{'type':Sequelize[_0x28b5('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x28b5('0x3')},'appdata':{'type':Sequelize[_0x28b5('0x4')]()},'description':{'type':Sequelize[_0x28b5('0x5')]},'interval':{'type':Sequelize[_0x28b5('0x5')],'defaultValue':_0x28b5('0x6')}}; \ No newline at end of file +var _0x77a9=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x16bea0,_0x59b8aa){var _0x476103=function(_0x3697cb){while(--_0x3697cb){_0x16bea0['push'](_0x16bea0['shift']());}};_0x476103(++_0x59b8aa);}(_0x77a9,0x1ec));var _0x977a=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0x77a9[_0x35a779];return _0xca723b;};'use strict';var Sequelize=require(_0x977a('0x0'));module[_0x977a('0x1')]={'priority':{'type':Sequelize[_0x977a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x977a('0x3')],'allowNull':![],'defaultValue':_0x977a('0x4')},'appdata':{'type':Sequelize[_0x977a('0x5')]()},'description':{'type':Sequelize[_0x977a('0x3')]},'interval':{'type':Sequelize[_0x977a('0x3')],'defaultValue':_0x977a('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 47854eb..5d748b9 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 _0xee53=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','includeAll','include','merge','options','find','catch','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'];(function(_0x363deb,_0x1648b8){var _0x340aad=function(_0x12b157){while(--_0x12b157){_0x363deb['push'](_0x363deb['shift']());}};_0x340aad(++_0x1648b8);}(_0xee53,0xa8));var _0x3ee5=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0xee53[_0xcfeda9];return _0x4826c7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3ee5('0x0'));var jsonpatch=require(_0x3ee5('0x1'));var rp=require(_0x3ee5('0x2'));var moment=require('moment');var BPromise=require(_0x3ee5('0x3'));var Mustache=require(_0x3ee5('0x4'));var util=require(_0x3ee5('0x5'));var path=require(_0x3ee5('0x6'));var sox=require(_0x3ee5('0x7'));var csv=require(_0x3ee5('0x8'));var ejs=require(_0x3ee5('0x9'));var fs=require('fs');var fs_extra=require(_0x3ee5('0xa'));var _=require(_0x3ee5('0xb'));var squel=require(_0x3ee5('0xc'));var crypto=require(_0x3ee5('0xd'));var jsforce=require(_0x3ee5('0xe'));var deskjs=require(_0x3ee5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3ee5('0x10'));var Papa=require(_0x3ee5('0x11'));var Redis=require(_0x3ee5('0x12'));var authService=require(_0x3ee5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3ee5('0x14'));var hardwareService=require(_0x3ee5('0x15'));var logger=require(_0x3ee5('0x16'))(_0x3ee5('0x17'));var utils=require('../../config/utils');var config=require(_0x3ee5('0x18'));var licenseUtil=require(_0x3ee5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbf85a3,_0x509a41){_0x509a41=_0x509a41||0xcc;return function(_0x10da9f){if(_0x10da9f){return _0xbf85a3['sendStatus'](_0x509a41);}return _0xbf85a3['status'](_0x509a41)[_0x3ee5('0x1a')]();};}function respondWithResult(_0x27816b,_0x244ca2){_0x244ca2=_0x244ca2||0xc8;return function(_0x21c9b6){if(_0x21c9b6){return _0x27816b[_0x3ee5('0x1b')](_0x244ca2)[_0x3ee5('0x1c')](_0x21c9b6);}};}function respondWithFilteredResult(_0x3ee06d,_0x1452b5){return function(_0x4023a9){if(_0x4023a9){var _0x5568f3=typeof _0x1452b5[_0x3ee5('0x1d')]==='undefined'&&typeof _0x1452b5[_0x3ee5('0x1e')]===_0x3ee5('0x1f');var _0x245aa9=_0x4023a9[_0x3ee5('0x20')];var _0x3a7356=_0x5568f3?0x0:_0x1452b5[_0x3ee5('0x1d')];var _0x6a8b6b=_0x5568f3?_0x4023a9['count']:_0x1452b5[_0x3ee5('0x1d')]+_0x1452b5[_0x3ee5('0x1e')];var _0x150187;if(_0x6a8b6b>=_0x245aa9){_0x6a8b6b=_0x245aa9;_0x150187=0xc8;}else{_0x150187=0xce;}_0x3ee06d[_0x3ee5('0x1b')](_0x150187);return _0x3ee06d['set'](_0x3ee5('0x21'),_0x3a7356+'-'+_0x6a8b6b+'/'+_0x245aa9)[_0x3ee5('0x1c')](_0x4023a9);}return null;};}function patchUpdates(_0x203a60){return function(_0xa872c4){try{jsonpatch[_0x3ee5('0x22')](_0xa872c4,_0x203a60,!![]);}catch(_0x5d6c3e){return BPromise[_0x3ee5('0x23')](_0x5d6c3e);}return _0xa872c4[_0x3ee5('0x24')]();};}function saveUpdates(_0x591bde,_0x4a3b83){return function(_0x1b5139){if(_0x1b5139){return _0x1b5139[_0x3ee5('0x25')](_0x591bde)[_0x3ee5('0x26')](function(_0x4f3d8c){return _0x4f3d8c;});}return null;};}function removeEntity(_0x1f5871,_0x4d7114){return function(_0x318c36){if(_0x318c36){return _0x318c36[_0x3ee5('0x27')]()['then'](function(){_0x1f5871[_0x3ee5('0x1b')](0xcc)[_0x3ee5('0x1a')]();});}};}function handleEntityNotFound(_0x31d980,_0x11db5c){return function(_0x388b58){if(!_0x388b58){_0x31d980[_0x3ee5('0x28')](0x194);}return _0x388b58;};}function handleError(_0x2e0794,_0x482593){_0x482593=_0x482593||0x1f4;return function(_0x415f50){logger[_0x3ee5('0x29')](_0x415f50[_0x3ee5('0x2a')]);if(_0x415f50['name']){delete _0x415f50[_0x3ee5('0x2b')];}_0x2e0794['status'](_0x482593)[_0x3ee5('0x2c')](_0x415f50);};}exports[_0x3ee5('0x2d')]=function(_0x2ec4ac,_0x47f620){var _0xb8f45f={'raw':!![],'where':{'id':_0x2ec4ac[_0x3ee5('0x2e')]['id']}},_0x10cd45={};_0x10cd45[_0x3ee5('0x2f')]=_['keys'](db[_0x3ee5('0x30')][_0x3ee5('0x31')]);_0x10cd45[_0x3ee5('0x32')]=_[_0x3ee5('0x33')](_0x2ec4ac[_0x3ee5('0x32')]);_0x10cd45['filters']=_[_0x3ee5('0x34')](_0x10cd45['model'],_0x10cd45['query']);_0xb8f45f[_0x3ee5('0x35')]=_[_0x3ee5('0x34')](_0x10cd45[_0x3ee5('0x2f')],qs['fields'](_0x2ec4ac[_0x3ee5('0x32')][_0x3ee5('0x36')]));_0xb8f45f[_0x3ee5('0x35')]=_0xb8f45f[_0x3ee5('0x35')]['length']?_0xb8f45f[_0x3ee5('0x35')]:_0x10cd45[_0x3ee5('0x2f')];if(_0x2ec4ac[_0x3ee5('0x32')][_0x3ee5('0x37')]){_0xb8f45f[_0x3ee5('0x38')]=[{'all':!![]}];}_0xb8f45f=_[_0x3ee5('0x39')]({},_0xb8f45f,_0x2ec4ac[_0x3ee5('0x3a')]);return db[_0x3ee5('0x30')][_0x3ee5('0x3b')](_0xb8f45f)['then'](handleEntityNotFound(_0x47f620,null))[_0x3ee5('0x26')](respondWithResult(_0x47f620,null))[_0x3ee5('0x3c')](handleError(_0x47f620,null));};exports[_0x3ee5('0x25')]=function(_0x52a0a1,_0x81a590){if(_0x52a0a1[_0x3ee5('0x3d')]['id']){delete _0x52a0a1[_0x3ee5('0x3d')]['id'];}return db[_0x3ee5('0x30')][_0x3ee5('0x3b')]({'where':{'id':_0x52a0a1[_0x3ee5('0x2e')]['id']}})[_0x3ee5('0x26')](handleEntityNotFound(_0x81a590,null))['then'](saveUpdates(_0x52a0a1['body'],null))[_0x3ee5('0x26')](respondWithResult(_0x81a590,null))['catch'](handleError(_0x81a590,null));};exports[_0x3ee5('0x27')]=function(_0x32b1bb,_0x5e2664){return db[_0x3ee5('0x30')][_0x3ee5('0x3b')]({'where':{'id':_0x32b1bb['params']['id']}})[_0x3ee5('0x26')](handleEntityNotFound(_0x5e2664,null))[_0x3ee5('0x26')](removeEntity(_0x5e2664,null))[_0x3ee5('0x3c')](handleError(_0x5e2664,null));}; \ No newline at end of file +var _0x9649=['show','params','model','keys','query','attributes','fields','include','merge','options','find','catch','update','body','ChatApplication','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','error','stack','send'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9649,0x118));var _0x9964=function(_0x5180af,_0x392516){_0x5180af=_0x5180af-0x0;var _0x5411b1=_0x9649[_0x5180af];return _0x5411b1;};'use strict';var emlformat=require(_0x9964('0x0'));var rimraf=require(_0x9964('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9964('0x2'));var rp=require(_0x9964('0x3'));var moment=require(_0x9964('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9964('0x5'));var util=require(_0x9964('0x6'));var path=require(_0x9964('0x7'));var sox=require(_0x9964('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9964('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9964('0xa'));var jsforce=require(_0x9964('0xb'));var deskjs=require(_0x9964('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9964('0xd'));var Papa=require(_0x9964('0xe'));var Redis=require(_0x9964('0xf'));var authService=require(_0x9964('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9964('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9964('0x12'))(_0x9964('0x13'));var utils=require('../../config/utils');var config=require(_0x9964('0x14'));var licenseUtil=require(_0x9964('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd6ff,_0x4ef5c5){_0x4ef5c5=_0x4ef5c5||0xcc;return function(_0x1b8afa){if(_0x1b8afa){return _0x2bd6ff[_0x9964('0x16')](_0x4ef5c5);}return _0x2bd6ff[_0x9964('0x17')](_0x4ef5c5)[_0x9964('0x18')]();};}function respondWithResult(_0x22f5ce,_0x360a02){_0x360a02=_0x360a02||0xc8;return function(_0x44ce20){if(_0x44ce20){return _0x22f5ce['status'](_0x360a02)['json'](_0x44ce20);}};}function respondWithFilteredResult(_0x37f137,_0x2be683){return function(_0x561571){if(_0x561571){var _0x416340=typeof _0x2be683[_0x9964('0x19')]===_0x9964('0x1a')&&typeof _0x2be683[_0x9964('0x1b')]===_0x9964('0x1a');var _0x2c12f8=_0x561571['count'];var _0x2a7a61=_0x416340?0x0:_0x2be683[_0x9964('0x19')];var _0x58f157=_0x416340?_0x561571['count']:_0x2be683['offset']+_0x2be683[_0x9964('0x1b')];var _0xc4c0fe;if(_0x58f157>=_0x2c12f8){_0x58f157=_0x2c12f8;_0xc4c0fe=0xc8;}else{_0xc4c0fe=0xce;}_0x37f137[_0x9964('0x17')](_0xc4c0fe);return _0x37f137[_0x9964('0x1c')]('Content-Range',_0x2a7a61+'-'+_0x58f157+'/'+_0x2c12f8)[_0x9964('0x1d')](_0x561571);}return null;};}function patchUpdates(_0x5f2bbd){return function(_0x470a8d){try{jsonpatch[_0x9964('0x1e')](_0x470a8d,_0x5f2bbd,!![]);}catch(_0x209929){return BPromise[_0x9964('0x1f')](_0x209929);}return _0x470a8d[_0x9964('0x20')]();};}function saveUpdates(_0xea9fc2,_0x4053ad){return function(_0x341c56){if(_0x341c56){return _0x341c56['update'](_0xea9fc2)[_0x9964('0x21')](function(_0x3069d7){return _0x3069d7;});}return null;};}function removeEntity(_0x1629f9,_0x30ccf7){return function(_0x5b2689){if(_0x5b2689){return _0x5b2689[_0x9964('0x22')]()[_0x9964('0x21')](function(){_0x1629f9[_0x9964('0x17')](0xcc)[_0x9964('0x18')]();});}};}function handleEntityNotFound(_0x4be822,_0x5d4a5e){return function(_0x3911e0){if(!_0x3911e0){_0x4be822[_0x9964('0x16')](0x194);}return _0x3911e0;};}function handleError(_0x2dafcc,_0x96bee0){_0x96bee0=_0x96bee0||0x1f4;return function(_0xd48c01){logger[_0x9964('0x23')](_0xd48c01[_0x9964('0x24')]);if(_0xd48c01['name']){delete _0xd48c01['name'];}_0x2dafcc[_0x9964('0x17')](_0x96bee0)[_0x9964('0x25')](_0xd48c01);};}exports[_0x9964('0x26')]=function(_0x16ec83,_0x47d0d4){var _0x201656={'raw':!![],'where':{'id':_0x16ec83[_0x9964('0x27')]['id']}},_0x3a59df={};_0x3a59df[_0x9964('0x28')]=_[_0x9964('0x29')](db['ChatApplication']['rawAttributes']);_0x3a59df[_0x9964('0x2a')]=_[_0x9964('0x29')](_0x16ec83['query']);_0x3a59df['filters']=_['intersection'](_0x3a59df[_0x9964('0x28')],_0x3a59df[_0x9964('0x2a')]);_0x201656[_0x9964('0x2b')]=_['intersection'](_0x3a59df[_0x9964('0x28')],qs[_0x9964('0x2c')](_0x16ec83[_0x9964('0x2a')][_0x9964('0x2c')]));_0x201656[_0x9964('0x2b')]=_0x201656[_0x9964('0x2b')]['length']?_0x201656[_0x9964('0x2b')]:_0x3a59df[_0x9964('0x28')];if(_0x16ec83[_0x9964('0x2a')]['includeAll']){_0x201656[_0x9964('0x2d')]=[{'all':!![]}];}_0x201656=_[_0x9964('0x2e')]({},_0x201656,_0x16ec83[_0x9964('0x2f')]);return db['ChatApplication'][_0x9964('0x30')](_0x201656)[_0x9964('0x21')](handleEntityNotFound(_0x47d0d4,null))[_0x9964('0x21')](respondWithResult(_0x47d0d4,null))[_0x9964('0x31')](handleError(_0x47d0d4,null));};exports[_0x9964('0x32')]=function(_0xa1cf0b,_0x113c6b){if(_0xa1cf0b[_0x9964('0x33')]['id']){delete _0xa1cf0b[_0x9964('0x33')]['id'];}return db[_0x9964('0x34')][_0x9964('0x30')]({'where':{'id':_0xa1cf0b[_0x9964('0x27')]['id']}})[_0x9964('0x21')](handleEntityNotFound(_0x113c6b,null))[_0x9964('0x21')](saveUpdates(_0xa1cf0b[_0x9964('0x33')],null))[_0x9964('0x21')](respondWithResult(_0x113c6b,null))[_0x9964('0x31')](handleError(_0x113c6b,null));};exports[_0x9964('0x22')]=function(_0x539d3d,_0xfe79a3){return db['ChatApplication'][_0x9964('0x30')]({'where':{'id':_0x539d3d[_0x9964('0x27')]['id']}})['then'](handleEntityNotFound(_0xfe79a3,null))[_0x9964('0x21')](removeEntity(_0xfe79a3,null))['catch'](handleError(_0xfe79a3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1365c25..f34cdfa 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 _0x8509=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatApplication.attributes','define','chat_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0x8509,0xa8));var _0x9850=function(_0x3452ce,_0x124927){_0x3452ce=_0x3452ce-0x0;var _0xee20c5=_0x8509[_0x3452ce];return _0xee20c5;};'use strict';var _=require(_0x9850('0x0'));var util=require('util');var logger=require(_0x9850('0x1'))(_0x9850('0x2'));var moment=require(_0x9850('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9850('0x4'));var rimraf=require(_0x9850('0x5'));var config=require(_0x9850('0x6'));var attributes=require(_0x9850('0x7'));module['exports']=function(_0x3f00dd,_0x16af1c){return _0x3f00dd[_0x9850('0x8')]('ChatApplication',attributes,{'tableName':_0x9850('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9850('0xa'),'collate':_0x9850('0xb')});}; \ No newline at end of file +var _0xc7a2=['bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0xc7a2,0x118));var _0x2c7a=function(_0x440464,_0xb7afd8){_0x440464=_0x440464-0x0;var _0x2f4043=_0xc7a2[_0x440464];return _0x2f4043;};'use strict';var _=require(_0x2c7a('0x0'));var util=require(_0x2c7a('0x1'));var logger=require(_0x2c7a('0x2'))(_0x2c7a('0x3'));var moment=require(_0x2c7a('0x4'));var BPromise=require(_0x2c7a('0x5'));var rp=require(_0x2c7a('0x6'));var fs=require('fs');var path=require(_0x2c7a('0x7'));var rimraf=require(_0x2c7a('0x8'));var config=require(_0x2c7a('0x9'));var attributes=require(_0x2c7a('0xa'));module['exports']=function(_0x1f8b14,_0x241569){return _0x1f8b14[_0x2c7a('0xb')](_0x2c7a('0xc'),attributes,{'tableName':_0x2c7a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c7a('0xe'),'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 c29c5e0..08d3aa3 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 _0x77de=['http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1df470,_0x43cff9){var _0x277849=function(_0x164f32){while(--_0x164f32){_0x1df470['push'](_0x1df470['shift']());}};_0x277849(++_0x43cff9);}(_0x77de,0x199));var _0xe77d=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x77de[_0x3f6565];return _0x4abd23;};'use strict';var _=require('lodash');var util=require(_0xe77d('0x0'));var moment=require(_0xe77d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe77d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe77d('0x3'));var logger=require(_0xe77d('0x4'))(_0xe77d('0x5'));var config=require(_0xe77d('0x6'));var jayson=require(_0xe77d('0x7'));var client=jayson[_0xe77d('0x8')][_0xe77d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x489ff7,_0x4332bd,_0x41f8f5){return new BPromise(function(_0x34fa66,_0x309000){return client['request'](_0x489ff7,_0x41f8f5)[_0xe77d('0xa')](function(_0x2f58c8){logger[_0xe77d('0xb')]('ChatApplication,\x20%s,\x20%s',_0x4332bd,_0xe77d('0xc'));logger[_0xe77d('0xd')](_0xe77d('0xe'),_0x4332bd,_0xe77d('0xc'),JSON[_0xe77d('0xf')](_0x2f58c8));if(_0x2f58c8[_0xe77d('0x10')]){if(_0x2f58c8['error'][_0xe77d('0x11')]===0x1f4){logger[_0xe77d('0x10')]('ChatApplication,\x20%s,\x20%s',_0x4332bd,_0x2f58c8[_0xe77d('0x10')][_0xe77d('0x12')]);return _0x309000(_0x2f58c8[_0xe77d('0x10')]['message']);}logger[_0xe77d('0x10')](_0xe77d('0x13'),_0x4332bd,_0x2f58c8[_0xe77d('0x10')][_0xe77d('0x12')]);return _0x34fa66(_0x2f58c8[_0xe77d('0x10')][_0xe77d('0x12')]);}else{logger[_0xe77d('0xb')](_0xe77d('0x13'),_0x4332bd,'request\x20sent');_0x34fa66(_0x2f58c8[_0xe77d('0x14')]['message']);}})[_0xe77d('0x15')](function(_0xbcf959){logger[_0xe77d('0x10')](_0xe77d('0x13'),_0x4332bd,_0xbcf959);_0x309000(_0xbcf959);});});} \ No newline at end of file +var _0x5019=['then','info','request\x20sent','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x5019,0xa4));var _0x9501=function(_0x44c334,_0x2b4b6a){_0x44c334=_0x44c334-0x0;var _0x4edbfd=_0x5019[_0x44c334];return _0x4edbfd;};'use strict';var _=require('lodash');var util=require(_0x9501('0x0'));var moment=require(_0x9501('0x1'));var BPromise=require(_0x9501('0x2'));var rs=require(_0x9501('0x3'));var fs=require('fs');var Redis=require(_0x9501('0x4'));var db=require(_0x9501('0x5'))['db'];var utils=require(_0x9501('0x6'));var logger=require(_0x9501('0x7'))(_0x9501('0x8'));var config=require('../../config/environment');var jayson=require(_0x9501('0x9'));var client=jayson[_0x9501('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d861b,_0x437461,_0x167c48){return new BPromise(function(_0x4ff981,_0x1caf41){return client[_0x9501('0xb')](_0x5d861b,_0x167c48)[_0x9501('0xc')](function(_0x95426){logger[_0x9501('0xd')]('ChatApplication,\x20%s,\x20%s',_0x437461,_0x9501('0xe'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x437461,_0x9501('0xe'),JSON[_0x9501('0xf')](_0x95426));if(_0x95426[_0x9501('0x10')]){if(_0x95426[_0x9501('0x10')][_0x9501('0x11')]===0x1f4){logger[_0x9501('0x10')]('ChatApplication,\x20%s,\x20%s',_0x437461,_0x95426[_0x9501('0x10')][_0x9501('0x12')]);return _0x1caf41(_0x95426[_0x9501('0x10')][_0x9501('0x12')]);}logger['error'](_0x9501('0x13'),_0x437461,_0x95426['error']['message']);return _0x4ff981(_0x95426[_0x9501('0x10')][_0x9501('0x12')]);}else{logger[_0x9501('0xd')](_0x9501('0x13'),_0x437461,'request\x20sent');_0x4ff981(_0x95426[_0x9501('0x14')]['message']);}})[_0x9501('0x15')](function(_0x4741c1){logger[_0x9501('0x10')](_0x9501('0x13'),_0x437461,_0x4741c1);_0x1caf41(_0x4741c1);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ad213df..d1d8847 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 _0x3ce5=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','show','put','isAuthenticated','update','delete','/:id','destroy'];(function(_0x4ddfc9,_0x23f05f){var _0x47da83=function(_0xf31784){while(--_0xf31784){_0x4ddfc9['push'](_0x4ddfc9['shift']());}};_0x47da83(++_0x23f05f);}(_0x3ce5,0x168));var _0x53ce=function(_0x347895,_0x5cb1aa){_0x347895=_0x347895-0x0;var _0x453191=_0x3ce5[_0x347895];return _0x453191;};'use strict';var multer=require(_0x53ce('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x53ce('0x1'));var router=express[_0x53ce('0x2')]();var fs_extra=require(_0x53ce('0x3'));var auth=require(_0x53ce('0x4'));var interaction=require(_0x53ce('0x5'));var config=require('../../config/environment');var controller=require(_0x53ce('0x6'));router[_0x53ce('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x53ce('0x8')]);router[_0x53ce('0x9')]('/:id',auth[_0x53ce('0xa')](),controller[_0x53ce('0xb')]);router[_0x53ce('0xc')](_0x53ce('0xd'),auth['isAuthenticated'](),controller[_0x53ce('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4811=['/:id','isAuthenticated','show','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','get'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x4811,0x1c7));var _0x1481=function(_0x1f7120,_0x53456a){_0x1f7120=_0x1f7120-0x0;var _0x512142=_0x4811[_0x1f7120];return _0x512142;};'use strict';var multer=require(_0x1481('0x0'));var util=require('util');var path=require(_0x1481('0x1'));var timeout=require(_0x1481('0x2'));var express=require(_0x1481('0x3'));var router=express[_0x1481('0x4')]();var fs_extra=require(_0x1481('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1481('0x6'));var config=require('../../config/environment');var controller=require(_0x1481('0x7'));router[_0x1481('0x8')](_0x1481('0x9'),auth[_0x1481('0xa')](),controller[_0x1481('0xb')]);router['put'](_0x1481('0x9'),auth['isAuthenticated'](),controller[_0x1481('0xc')]);router[_0x1481('0xd')](_0x1481('0x9'),auth[_0x1481('0xa')](),controller[_0x1481('0xe')]);module[_0x1481('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 02b6749..6b031eb 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 _0x5a4f=['STRING','BOOLEAN','sequelize'];(function(_0x4ddc33,_0x48a1ce){var _0x52a177=function(_0x3c9995){while(--_0x3c9995){_0x4ddc33['push'](_0x4ddc33['shift']());}};_0x52a177(++_0x48a1ce);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x5a4f[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0xf5a4('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5a4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xf5a4('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x114b=['exports','STRING','BOOLEAN'];(function(_0x2817b1,_0x18b8f1){var _0x5ec249=function(_0x291c52){while(--_0x291c52){_0x2817b1['push'](_0x2817b1['shift']());}};_0x5ec249(++_0x18b8f1);}(_0x114b,0x1e9));var _0xb114=function(_0x316729,_0x249b17){_0x316729=_0x316729-0x0;var _0x11e950=_0x114b[_0x316729];return _0x11e950;};'use strict';var Sequelize=require('sequelize');module[_0xb114('0x0')]={'name':{'type':Sequelize[_0xb114('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb114('0x1')]},'write':{'type':Sequelize[_0xb114('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 f2b1d60..17d5604 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 _0x5b61=['findOne','User','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids'];(function(_0x5a9117,_0x1e3870){var _0x1665b9=function(_0x44c627){while(--_0x44c627){_0x5a9117['push'](_0x5a9117['shift']());}};_0x1665b9(++_0x1e3870);}(_0x5b61,0xd0));var _0x15b6=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x5b61[_0x3f2d02];return _0x54092b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15b6('0x0'));var zipdir=require(_0x15b6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15b6('0x2'));var moment=require(_0x15b6('0x3'));var BPromise=require(_0x15b6('0x4'));var Mustache=require(_0x15b6('0x5'));var util=require(_0x15b6('0x6'));var path=require('path');var sox=require(_0x15b6('0x7'));var csv=require(_0x15b6('0x8'));var ejs=require(_0x15b6('0x9'));var fs=require('fs');var fs_extra=require(_0x15b6('0xa'));var _=require(_0x15b6('0xb'));var squel=require(_0x15b6('0xc'));var crypto=require(_0x15b6('0xd'));var jsforce=require(_0x15b6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x15b6('0xf'));var Papa=require(_0x15b6('0x10'));var Redis=require(_0x15b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x15b6('0x12'));var as=require(_0x15b6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15b6('0x14'));var utils=require(_0x15b6('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x15b6('0x16'))['db'];config[_0x15b6('0x17')]=_[_0x15b6('0x18')](config[_0x15b6('0x17')],{'host':_0x15b6('0x19'),'port':0x18eb});var socket=require(_0x15b6('0x1a'))(new Redis(config[_0x15b6('0x17')]));require(_0x15b6('0x1b'))['register'](socket);function respondWithStatusCode(_0x33a5cb,_0x6648e7){_0x6648e7=_0x6648e7||0xcc;return function(_0x8a44fa){if(_0x8a44fa){return _0x33a5cb[_0x15b6('0x1c')](_0x6648e7);}return _0x33a5cb[_0x15b6('0x1d')](_0x6648e7)[_0x15b6('0x1e')]();};}function respondWithResult(_0x3806e0,_0x399589){_0x399589=_0x399589||0xc8;return function(_0xb3c402){if(_0xb3c402){return _0x3806e0['status'](_0x399589)[_0x15b6('0x1f')](_0xb3c402);}};}function respondWithFilteredResult(_0xbdc0e5,_0xd3f0f1){return function(_0x2dd2d1){if(_0x2dd2d1){var _0x3332fa=typeof _0xd3f0f1[_0x15b6('0x20')]===_0x15b6('0x21')&&typeof _0xd3f0f1[_0x15b6('0x22')]===_0x15b6('0x21');var _0x122a87=_0x2dd2d1['count'];var _0x52db07=_0x3332fa?0x0:_0xd3f0f1[_0x15b6('0x20')];var _0x2a655a=_0x3332fa?_0x2dd2d1[_0x15b6('0x23')]:_0xd3f0f1[_0x15b6('0x20')]+_0xd3f0f1['limit'];var _0x497359;if(_0x2a655a>=_0x122a87){_0x2a655a=_0x122a87;_0x497359=0xc8;}else{_0x497359=0xce;}_0xbdc0e5[_0x15b6('0x1d')](_0x497359);return _0xbdc0e5[_0x15b6('0x24')](_0x15b6('0x25'),_0x52db07+'-'+_0x2a655a+'/'+_0x122a87)[_0x15b6('0x1f')](_0x2dd2d1);}return null;};}function patchUpdates(_0x168539){return function(_0x18e365){try{jsonpatch['apply'](_0x18e365,_0x168539,!![]);}catch(_0x418250){return BPromise[_0x15b6('0x26')](_0x418250);}return _0x18e365[_0x15b6('0x27')]();};}function saveUpdates(_0x16ff15,_0x2d9efa){return function(_0xb97e9d){if(_0xb97e9d){return _0xb97e9d[_0x15b6('0x28')](_0x16ff15)[_0x15b6('0x29')](function(_0x3efe6e){return _0x3efe6e;});}return null;};}function removeEntity(_0x1aba5e,_0x1851ff){return function(_0x4e7ab8){if(_0x4e7ab8){return _0x4e7ab8[_0x15b6('0x2a')]()['then'](function(){_0x1aba5e[_0x15b6('0x1d')](0xcc)[_0x15b6('0x1e')]();});}};}function handleEntityNotFound(_0x4669b8,_0x31e9fc){return function(_0x49b8e2){if(!_0x49b8e2){_0x4669b8[_0x15b6('0x1c')](0x194);}return _0x49b8e2;};}function handleError(_0x52bdd0,_0xa119c2){_0xa119c2=_0xa119c2||0x1f4;return function(_0x5a67e4){logger[_0x15b6('0x2b')](_0x5a67e4[_0x15b6('0x2c')]);if(_0x5a67e4[_0x15b6('0x2d')]){delete _0x5a67e4[_0x15b6('0x2d')];}_0x52bdd0[_0x15b6('0x1d')](_0xa119c2)['send'](_0x5a67e4);};}exports[_0x15b6('0x2e')]=function(_0x1c1817,_0x197871){var _0x192163={},_0x41acb3={},_0x569f85={'count':0x0,'rows':[]};var _0xfea3da=_[_0x15b6('0x2f')](db[_0x15b6('0x30')][_0x15b6('0x31')],function(_0x43283c){return{'name':_0x43283c[_0x15b6('0x32')],'type':_0x43283c[_0x15b6('0x33')][_0x15b6('0x34')]};});_0x41acb3[_0x15b6('0x35')]=_[_0x15b6('0x2f')](_0xfea3da,'name');_0x41acb3[_0x15b6('0x36')]=_['keys'](_0x1c1817[_0x15b6('0x36')]);_0x41acb3[_0x15b6('0x37')]=_[_0x15b6('0x38')](_0x41acb3[_0x15b6('0x35')],_0x41acb3[_0x15b6('0x36')]);_0x192163[_0x15b6('0x39')]=_['intersection'](_0x41acb3[_0x15b6('0x35')],qs[_0x15b6('0x3a')](_0x1c1817[_0x15b6('0x36')][_0x15b6('0x3a')]));_0x192163[_0x15b6('0x39')]=_0x192163[_0x15b6('0x39')][_0x15b6('0x3b')]?_0x192163[_0x15b6('0x39')]:_0x41acb3['model'];if(!_0x1c1817[_0x15b6('0x36')][_0x15b6('0x3c')](_0x15b6('0x3d'))){_0x192163[_0x15b6('0x22')]=qs[_0x15b6('0x22')](_0x1c1817[_0x15b6('0x36')]['limit']);_0x192163[_0x15b6('0x20')]=qs[_0x15b6('0x20')](_0x1c1817[_0x15b6('0x36')][_0x15b6('0x20')]);}_0x192163[_0x15b6('0x3e')]=qs[_0x15b6('0x3f')](_0x1c1817[_0x15b6('0x36')]['sort']);_0x192163[_0x15b6('0x40')]=qs[_0x15b6('0x37')](_[_0x15b6('0x41')](_0x1c1817[_0x15b6('0x36')],_0x41acb3[_0x15b6('0x37')]),_0xfea3da);if(_0x1c1817[_0x15b6('0x36')][_0x15b6('0x42')]){_0x192163[_0x15b6('0x40')]=_['merge'](_0x192163[_0x15b6('0x40')],{'$or':_[_0x15b6('0x2f')](_0xfea3da,function(_0xf51683){if(_0xf51683['type']!==_0x15b6('0x43')){var _0x52edbe={};_0x52edbe[_0xf51683[_0x15b6('0x2d')]]={'$like':'%'+_0x1c1817[_0x15b6('0x36')]['filter']+'%'};return _0x52edbe;}})});}_0x192163=_[_0x15b6('0x44')]({},_0x192163,_0x1c1817[_0x15b6('0x45')]);var _0xff29e={'where':_0x192163[_0x15b6('0x40')]};return db[_0x15b6('0x30')][_0x15b6('0x23')](_0xff29e)[_0x15b6('0x29')](function(_0x2e62ad){_0x569f85['count']=_0x2e62ad;if(_0x1c1817[_0x15b6('0x36')][_0x15b6('0x46')]){_0x192163[_0x15b6('0x47')]=[{'all':!![]}];}return db[_0x15b6('0x30')][_0x15b6('0x48')](_0x192163);})['then'](function(_0x37147a){_0x569f85[_0x15b6('0x49')]=_0x37147a;return _0x569f85;})[_0x15b6('0x29')](respondWithFilteredResult(_0x197871,_0x192163))[_0x15b6('0x4a')](handleError(_0x197871,null));};exports[_0x15b6('0x4b')]=function(_0x433486,_0x279d7e){var _0x502f73={'raw':!![],'where':{'id':_0x433486['params']['id']}},_0x2145ab={};_0x2145ab['model']=_['keys'](db[_0x15b6('0x30')][_0x15b6('0x31')]);_0x2145ab[_0x15b6('0x36')]=_[_0x15b6('0x4c')](_0x433486[_0x15b6('0x36')]);_0x2145ab[_0x15b6('0x37')]=_['intersection'](_0x2145ab[_0x15b6('0x35')],_0x2145ab[_0x15b6('0x36')]);_0x502f73[_0x15b6('0x39')]=_[_0x15b6('0x38')](_0x2145ab[_0x15b6('0x35')],qs[_0x15b6('0x3a')](_0x433486[_0x15b6('0x36')][_0x15b6('0x3a')]));_0x502f73[_0x15b6('0x39')]=_0x502f73[_0x15b6('0x39')][_0x15b6('0x3b')]?_0x502f73[_0x15b6('0x39')]:_0x2145ab[_0x15b6('0x35')];if(_0x433486['query'][_0x15b6('0x46')]){_0x502f73[_0x15b6('0x47')]=[{'all':!![]}];}_0x502f73=_[_0x15b6('0x44')]({},_0x502f73,_0x433486[_0x15b6('0x45')]);return db[_0x15b6('0x30')][_0x15b6('0x4d')](_0x502f73)[_0x15b6('0x29')](handleEntityNotFound(_0x279d7e,null))['then'](respondWithResult(_0x279d7e,null))['catch'](handleError(_0x279d7e,null));};exports[_0x15b6('0x4e')]=function(_0x888e8a,_0x4dde2a){return db[_0x15b6('0x30')][_0x15b6('0x4e')](_0x888e8a[_0x15b6('0x4f')],{})['then'](respondWithResult(_0x4dde2a,0xc9))[_0x15b6('0x4a')](handleError(_0x4dde2a,null));};exports[_0x15b6('0x28')]=function(_0x33b1b3,_0x4e2975){if(_0x33b1b3[_0x15b6('0x4f')]['id']){delete _0x33b1b3[_0x15b6('0x4f')]['id'];}return db[_0x15b6('0x30')][_0x15b6('0x4d')]({'where':{'id':_0x33b1b3[_0x15b6('0x50')]['id']}})[_0x15b6('0x29')](handleEntityNotFound(_0x4e2975,null))[_0x15b6('0x29')](saveUpdates(_0x33b1b3[_0x15b6('0x4f')],null))[_0x15b6('0x29')](respondWithResult(_0x4e2975,null))['catch'](handleError(_0x4e2975,null));};exports[_0x15b6('0x2a')]=function(_0x29291f,_0x1af468){return db[_0x15b6('0x30')][_0x15b6('0x4d')]({'where':{'id':_0x29291f[_0x15b6('0x50')]['id']}})[_0x15b6('0x29')](handleEntityNotFound(_0x1af468,null))['then'](removeEntity(_0x1af468,null))[_0x15b6('0x4a')](handleError(_0x1af468,null));};exports['describe']=function(_0x48789f,_0x18e9b8){return db[_0x15b6('0x30')][_0x15b6('0x51')]()['then'](respondWithResult(_0x18e9b8,null))[_0x15b6('0x4a')](handleError(_0x18e9b8,null));};exports[_0x15b6('0x52')]=function(_0x5ce0b3,_0x2c91a9,_0x4cf622){return db[_0x15b6('0x53')][_0x15b6('0x23')]({'where':{'ChatGroupId':_0x5ce0b3[_0x15b6('0x50')]['id'],'ToId':_0x5ce0b3[_0x15b6('0x54')]['id'],'read':![]}})['then'](function(_0x3de468){return{'id':_[_0x15b6('0x55')](_0x5ce0b3[_0x15b6('0x50')]['id']),'count':_0x3de468};})[_0x15b6('0x29')](respondWithResult(_0x2c91a9,null))[_0x15b6('0x4a')](handleError(_0x2c91a9,null));};exports['addMembers']=function(_0x5e3d5f,_0x411b2a,_0x419e42){return db['ChatGroup'][_0x15b6('0x4d')]({'where':{'id':_0x5e3d5f[_0x15b6('0x50')]['id']}})['then'](handleEntityNotFound(_0x411b2a,null))['then'](function(_0x5b1f5d){if(_0x5b1f5d){return _0x5b1f5d[_0x15b6('0x56')](_0x5e3d5f[_0x15b6('0x4f')]['ids'],_[_0x15b6('0x57')](_0x5e3d5f['body'],[_0x15b6('0x58'),'id'])||{});}})[_0x15b6('0x29')](respondWithResult(_0x411b2a,null))[_0x15b6('0x4a')](handleError(_0x411b2a,null));};exports['getMembers']=function(_0x5170ea,_0x367b51,_0x5daf73){var _0x46edae={};var _0x175dbd={};var _0x5c7afc;var _0xdf2bd8;return db[_0x15b6('0x30')][_0x15b6('0x59')]({'where':{'id':_0x5170ea[_0x15b6('0x50')]['id']}})[_0x15b6('0x29')](handleEntityNotFound(_0x367b51,null))[_0x15b6('0x29')](function(_0xd9b21){if(_0xd9b21){_0x5c7afc=_0xd9b21;_0x175dbd[_0x15b6('0x35')]=_[_0x15b6('0x4c')](db[_0x15b6('0x5a')][_0x15b6('0x31')]);_0x175dbd[_0x15b6('0x36')]=_[_0x15b6('0x4c')](_0x5170ea['query']);_0x175dbd[_0x15b6('0x37')]=_['intersection'](_0x175dbd[_0x15b6('0x35')],_0x175dbd[_0x15b6('0x36')]);_0x46edae['attributes']=_[_0x15b6('0x38')](_0x175dbd[_0x15b6('0x35')],qs[_0x15b6('0x3a')](_0x5170ea[_0x15b6('0x36')]['fields']));_0x46edae['attributes']=_0x46edae[_0x15b6('0x39')][_0x15b6('0x3b')]?_0x46edae[_0x15b6('0x39')]:_0x175dbd[_0x15b6('0x35')];_0x46edae[_0x15b6('0x3e')]=qs[_0x15b6('0x3f')](_0x5170ea['query']['sort']);_0x46edae[_0x15b6('0x40')]=qs[_0x15b6('0x37')](_['pick'](_0x5170ea[_0x15b6('0x36')],_0x175dbd['filters']));if(_0x5170ea['query'][_0x15b6('0x42')]){_0x46edae[_0x15b6('0x40')]=_['merge'](_0x46edae[_0x15b6('0x40')],{'$or':_[_0x15b6('0x2f')](_0x46edae[_0x15b6('0x39')],function(_0x467f33){var _0x2a674e={};_0x2a674e[_0x467f33]={'$like':'%'+_0x5170ea[_0x15b6('0x36')][_0x15b6('0x42')]+'%'};return _0x2a674e;})});}_0x46edae=_['merge']({},_0x46edae,_0x5170ea[_0x15b6('0x45')]);return _0x5c7afc[_0x15b6('0x5b')](_0x46edae);}})[_0x15b6('0x29')](function(_0x566ebb){if(_0x566ebb){_0xdf2bd8=_0x566ebb[_0x15b6('0x3b')];if(!_0x5170ea[_0x15b6('0x36')][_0x15b6('0x3c')](_0x15b6('0x3d'))){_0x46edae[_0x15b6('0x22')]=qs[_0x15b6('0x22')](_0x5170ea[_0x15b6('0x36')][_0x15b6('0x22')]);_0x46edae[_0x15b6('0x20')]=qs[_0x15b6('0x20')](_0x5170ea[_0x15b6('0x36')]['offset']);}return _0x5c7afc[_0x15b6('0x5b')](_0x46edae);}})[_0x15b6('0x29')](function(_0x4fbc5f){if(_0x4fbc5f){return _0x4fbc5f?{'count':_0xdf2bd8,'rows':_0x4fbc5f}:null;}})[_0x15b6('0x29')](respondWithResult(_0x367b51,null))[_0x15b6('0x4a')](handleError(_0x367b51,null));};exports['removeMembers']=function(_0x5a790b,_0x5012c2,_0x69fa21){return db[_0x15b6('0x30')][_0x15b6('0x4d')]({'where':{'id':_0x5a790b['params']['id']}})['then'](handleEntityNotFound(_0x5012c2,null))['then'](function(_0x4ec52){if(_0x4ec52){return _0x4ec52[_0x15b6('0x5c')](_0x5a790b[_0x15b6('0x36')][_0x15b6('0x58')]);}})[_0x15b6('0x29')](respondWithStatusCode(_0x5012c2,null))[_0x15b6('0x4a')](handleError(_0x5012c2,null));};exports[_0x15b6('0x5d')]=function(_0xd120d5,_0x4ea39c,_0xc8afe1){if(_0xd120d5[_0x15b6('0x4f')]['id']){delete _0xd120d5[_0x15b6('0x4f')]['id'];}return db[_0x15b6('0x30')]['find']({'where':{'id':_0xd120d5['params']['id']}})[_0x15b6('0x29')](handleEntityNotFound(_0x4ea39c,null))[_0x15b6('0x29')](function(_0x291610){if(_0x291610){_0xd120d5[_0x15b6('0x4f')][_0x15b6('0x5e')]=_0x291610['id'];return db['ChatInternalMessage'][_0x15b6('0x4e')](_0xd120d5[_0x15b6('0x4f')]);}})[_0x15b6('0x29')](respondWithResult(_0x4ea39c,null))[_0x15b6('0x4a')](handleError(_0x4ea39c,null));};exports[_0x15b6('0x5f')]=function(_0x431473,_0x4ce798,_0x7a0862){var _0x566c05={};var _0x165ee6={};var _0x5d3b62;var _0x1126ea;return db['ChatGroup']['findOne']({'where':{'id':_0x431473[_0x15b6('0x50')]['id']}})['then'](handleEntityNotFound(_0x4ce798,null))[_0x15b6('0x29')](function(_0x408e30){if(_0x408e30){_0x5d3b62=_0x408e30;_0x165ee6[_0x15b6('0x35')]=_['keys'](db[_0x15b6('0x53')][_0x15b6('0x31')]);_0x165ee6[_0x15b6('0x36')]=_['keys'](_0x431473[_0x15b6('0x36')]);_0x165ee6[_0x15b6('0x37')]=_[_0x15b6('0x38')](_0x165ee6['model'],_0x165ee6[_0x15b6('0x36')]);_0x566c05[_0x15b6('0x39')]=_['intersection'](_0x165ee6[_0x15b6('0x35')],qs[_0x15b6('0x3a')](_0x431473[_0x15b6('0x36')][_0x15b6('0x3a')]));_0x566c05[_0x15b6('0x39')]=_0x566c05[_0x15b6('0x39')][_0x15b6('0x3b')]?_0x566c05[_0x15b6('0x39')]:_0x165ee6[_0x15b6('0x35')];_0x566c05[_0x15b6('0x3e')]=qs[_0x15b6('0x3f')](_0x431473[_0x15b6('0x36')][_0x15b6('0x3f')]);_0x566c05[_0x15b6('0x40')]=qs['filters'](_[_0x15b6('0x41')](_0x431473[_0x15b6('0x36')],_0x165ee6[_0x15b6('0x37')]));if(_0x431473[_0x15b6('0x36')][_0x15b6('0x42')]){_0x566c05[_0x15b6('0x40')]=_[_0x15b6('0x44')](_0x566c05['where'],{'$or':_[_0x15b6('0x2f')](_0x566c05[_0x15b6('0x39')],function(_0x529529){var _0x5ddcce={};_0x5ddcce[_0x529529]={'$like':'%'+_0x431473['query'][_0x15b6('0x42')]+'%'};return _0x5ddcce;})});}if(_0x431473[_0x15b6('0x36')]['$gte']){var _0x48d3ba=_0x431473[_0x15b6('0x36')][_0x15b6('0x60')][_0x15b6('0x61')](',');var _0x241afe={};_0x241afe[_0x48d3ba[0x0]]={'$gte':moment(_0x48d3ba[0x1])[_0x15b6('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};_0x566c05['where']=_[_0x15b6('0x44')](_0x566c05[_0x15b6('0x40')],_0x241afe);}_0x566c05=_[_0x15b6('0x44')]({},_0x566c05,_0x431473[_0x15b6('0x45')]);return _0x5d3b62[_0x15b6('0x5f')](_0x566c05);}})[_0x15b6('0x29')](function(_0x4cdc03){if(_0x4cdc03){_0x1126ea=_0x4cdc03[_0x15b6('0x3b')];if(!_0x431473[_0x15b6('0x36')]['hasOwnProperty'](_0x15b6('0x3d'))){_0x566c05['limit']=qs['limit'](_0x431473['query'][_0x15b6('0x22')]);_0x566c05[_0x15b6('0x20')]=qs[_0x15b6('0x20')](_0x431473[_0x15b6('0x36')]['offset']);}return _0x5d3b62[_0x15b6('0x5f')](_0x566c05);}})['then'](function(_0x3aa16f){if(_0x3aa16f){return _0x3aa16f?{'count':_0x1126ea,'rows':_0x3aa16f}:null;}})[_0x15b6('0x29')](respondWithResult(_0x4ce798,null))[_0x15b6('0x4a')](handleError(_0x4ce798,null));}; \ No newline at end of file +var _0xcf65=['../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','options','ChatGroup','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','nolimit','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x14dffb,_0x304228){var _0x5cecc2=function(_0x5e9cc1){while(--_0x5e9cc1){_0x14dffb['push'](_0x14dffb['shift']());}};_0x5cecc2(++_0x304228);}(_0xcf65,0x175));var _0x5cf6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcf65[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x5cf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5cf6('0x1'));var jsonpatch=require(_0x5cf6('0x2'));var rp=require(_0x5cf6('0x3'));var moment=require(_0x5cf6('0x4'));var BPromise=require(_0x5cf6('0x5'));var Mustache=require(_0x5cf6('0x6'));var util=require(_0x5cf6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5cf6('0x8'));var ejs=require(_0x5cf6('0x9'));var fs=require('fs');var fs_extra=require(_0x5cf6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5cf6('0xb'));var jsforce=require(_0x5cf6('0xc'));var deskjs=require(_0x5cf6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5cf6('0xe'));var Redis=require(_0x5cf6('0xf'));var authService=require(_0x5cf6('0x10'));var qs=require(_0x5cf6('0x11'));var as=require(_0x5cf6('0x12'));var hardwareService=require(_0x5cf6('0x13'));var logger=require(_0x5cf6('0x14'))(_0x5cf6('0x15'));var utils=require(_0x5cf6('0x16'));var config=require(_0x5cf6('0x17'));var licenseUtil=require(_0x5cf6('0x18'));var db=require('../../mysqldb')['db'];config[_0x5cf6('0x19')]=_[_0x5cf6('0x1a')](config['redis'],{'host':_0x5cf6('0x1b'),'port':0x18eb});var socket=require(_0x5cf6('0x1c'))(new Redis(config['redis']));require(_0x5cf6('0x1d'))[_0x5cf6('0x1e')](socket);function respondWithStatusCode(_0x505ae8,_0x5dbf7e){_0x5dbf7e=_0x5dbf7e||0xcc;return function(_0x451eb3){if(_0x451eb3){return _0x505ae8['sendStatus'](_0x5dbf7e);}return _0x505ae8[_0x5cf6('0x1f')](_0x5dbf7e)[_0x5cf6('0x20')]();};}function respondWithResult(_0x864cc5,_0x2f9026){_0x2f9026=_0x2f9026||0xc8;return function(_0x2289c7){if(_0x2289c7){return _0x864cc5[_0x5cf6('0x1f')](_0x2f9026)['json'](_0x2289c7);}};}function respondWithFilteredResult(_0x2af6b5,_0x1edc61){return function(_0x1945f5){if(_0x1945f5){var _0x5080d8=typeof _0x1edc61[_0x5cf6('0x21')]===_0x5cf6('0x22')&&typeof _0x1edc61['limit']===_0x5cf6('0x22');var _0x30548e=_0x1945f5['count'];var _0x4c41e9=_0x5080d8?0x0:_0x1edc61[_0x5cf6('0x21')];var _0xacc152=_0x5080d8?_0x1945f5[_0x5cf6('0x23')]:_0x1edc61[_0x5cf6('0x21')]+_0x1edc61['limit'];var _0x45ed69;if(_0xacc152>=_0x30548e){_0xacc152=_0x30548e;_0x45ed69=0xc8;}else{_0x45ed69=0xce;}_0x2af6b5[_0x5cf6('0x1f')](_0x45ed69);return _0x2af6b5['set'](_0x5cf6('0x24'),_0x4c41e9+'-'+_0xacc152+'/'+_0x30548e)[_0x5cf6('0x25')](_0x1945f5);}return null;};}function patchUpdates(_0x157033){return function(_0x2f52d4){try{jsonpatch[_0x5cf6('0x26')](_0x2f52d4,_0x157033,!![]);}catch(_0x5b8c85){return BPromise[_0x5cf6('0x27')](_0x5b8c85);}return _0x2f52d4[_0x5cf6('0x28')]();};}function saveUpdates(_0x226240,_0x1e2ece){return function(_0x4668dc){if(_0x4668dc){return _0x4668dc[_0x5cf6('0x29')](_0x226240)[_0x5cf6('0x2a')](function(_0x5b22bc){return _0x5b22bc;});}return null;};}function removeEntity(_0x28ff24,_0x64ccd){return function(_0x37c3fd){if(_0x37c3fd){return _0x37c3fd[_0x5cf6('0x2b')]()['then'](function(){_0x28ff24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x522d3d,_0xd1d253){return function(_0x38c022){if(!_0x38c022){_0x522d3d[_0x5cf6('0x2c')](0x194);}return _0x38c022;};}function handleError(_0x267bd3,_0x5d6800){_0x5d6800=_0x5d6800||0x1f4;return function(_0x241412){logger[_0x5cf6('0x2d')](_0x241412[_0x5cf6('0x2e')]);if(_0x241412[_0x5cf6('0x2f')]){delete _0x241412[_0x5cf6('0x2f')];}_0x267bd3[_0x5cf6('0x1f')](_0x5d6800)['send'](_0x241412);};}exports['index']=function(_0x29a0c3,_0x53952f){var _0x1d95c6={},_0x25db6b={},_0x4e08b0={'count':0x0,'rows':[]};var _0x3bcc28=_[_0x5cf6('0x30')](db['ChatGroup']['rawAttributes'],function(_0x3b6346){return{'name':_0x3b6346[_0x5cf6('0x31')],'type':_0x3b6346[_0x5cf6('0x32')][_0x5cf6('0x33')]};});_0x25db6b[_0x5cf6('0x34')]=_[_0x5cf6('0x30')](_0x3bcc28,_0x5cf6('0x2f'));_0x25db6b['query']=_[_0x5cf6('0x35')](_0x29a0c3[_0x5cf6('0x36')]);_0x25db6b['filters']=_[_0x5cf6('0x37')](_0x25db6b[_0x5cf6('0x34')],_0x25db6b[_0x5cf6('0x36')]);_0x1d95c6['attributes']=_[_0x5cf6('0x37')](_0x25db6b[_0x5cf6('0x34')],qs[_0x5cf6('0x38')](_0x29a0c3[_0x5cf6('0x36')][_0x5cf6('0x38')]));_0x1d95c6[_0x5cf6('0x39')]=_0x1d95c6[_0x5cf6('0x39')][_0x5cf6('0x3a')]?_0x1d95c6[_0x5cf6('0x39')]:_0x25db6b[_0x5cf6('0x34')];if(!_0x29a0c3['query'][_0x5cf6('0x3b')]('nolimit')){_0x1d95c6[_0x5cf6('0x3c')]=qs[_0x5cf6('0x3c')](_0x29a0c3[_0x5cf6('0x36')][_0x5cf6('0x3c')]);_0x1d95c6[_0x5cf6('0x21')]=qs[_0x5cf6('0x21')](_0x29a0c3[_0x5cf6('0x36')][_0x5cf6('0x21')]);}_0x1d95c6[_0x5cf6('0x3d')]=qs['sort'](_0x29a0c3[_0x5cf6('0x36')][_0x5cf6('0x3e')]);_0x1d95c6['where']=qs[_0x5cf6('0x3f')](_[_0x5cf6('0x40')](_0x29a0c3[_0x5cf6('0x36')],_0x25db6b['filters']),_0x3bcc28);if(_0x29a0c3['query'][_0x5cf6('0x41')]){_0x1d95c6[_0x5cf6('0x42')]=_['merge'](_0x1d95c6['where'],{'$or':_['map'](_0x3bcc28,function(_0x1b0cc0){if(_0x1b0cc0['type']!=='VIRTUAL'){var _0x32e928={};_0x32e928[_0x1b0cc0[_0x5cf6('0x2f')]]={'$like':'%'+_0x29a0c3['query'][_0x5cf6('0x41')]+'%'};return _0x32e928;}})});}_0x1d95c6=_[_0x5cf6('0x43')]({},_0x1d95c6,_0x29a0c3[_0x5cf6('0x44')]);var _0x1391bf={'where':_0x1d95c6['where']};return db[_0x5cf6('0x45')][_0x5cf6('0x23')](_0x1391bf)[_0x5cf6('0x2a')](function(_0x456cb0){_0x4e08b0[_0x5cf6('0x23')]=_0x456cb0;if(_0x29a0c3[_0x5cf6('0x36')]['includeAll']){_0x1d95c6['include']=[{'all':!![]}];}return db[_0x5cf6('0x45')][_0x5cf6('0x46')](_0x1d95c6);})[_0x5cf6('0x2a')](function(_0xfc71bc){_0x4e08b0['rows']=_0xfc71bc;return _0x4e08b0;})[_0x5cf6('0x2a')](respondWithFilteredResult(_0x53952f,_0x1d95c6))[_0x5cf6('0x47')](handleError(_0x53952f,null));};exports[_0x5cf6('0x48')]=function(_0x1fa692,_0x4365b1){var _0x507c98={'raw':!![],'where':{'id':_0x1fa692[_0x5cf6('0x49')]['id']}},_0x382982={};_0x382982[_0x5cf6('0x34')]=_[_0x5cf6('0x35')](db[_0x5cf6('0x45')][_0x5cf6('0x4a')]);_0x382982['query']=_['keys'](_0x1fa692[_0x5cf6('0x36')]);_0x382982['filters']=_[_0x5cf6('0x37')](_0x382982[_0x5cf6('0x34')],_0x382982[_0x5cf6('0x36')]);_0x507c98[_0x5cf6('0x39')]=_[_0x5cf6('0x37')](_0x382982[_0x5cf6('0x34')],qs[_0x5cf6('0x38')](_0x1fa692[_0x5cf6('0x36')][_0x5cf6('0x38')]));_0x507c98[_0x5cf6('0x39')]=_0x507c98[_0x5cf6('0x39')][_0x5cf6('0x3a')]?_0x507c98[_0x5cf6('0x39')]:_0x382982[_0x5cf6('0x34')];if(_0x1fa692['query'][_0x5cf6('0x4b')]){_0x507c98[_0x5cf6('0x4c')]=[{'all':!![]}];}_0x507c98=_['merge']({},_0x507c98,_0x1fa692['options']);return db[_0x5cf6('0x45')][_0x5cf6('0x4d')](_0x507c98)[_0x5cf6('0x2a')](handleEntityNotFound(_0x4365b1,null))[_0x5cf6('0x2a')](respondWithResult(_0x4365b1,null))[_0x5cf6('0x47')](handleError(_0x4365b1,null));};exports['create']=function(_0x4ed4f0,_0x53a54a){return db[_0x5cf6('0x45')][_0x5cf6('0x4e')](_0x4ed4f0['body'],{})[_0x5cf6('0x2a')](respondWithResult(_0x53a54a,0xc9))[_0x5cf6('0x47')](handleError(_0x53a54a,null));};exports[_0x5cf6('0x29')]=function(_0xce5078,_0x2035b1){if(_0xce5078[_0x5cf6('0x4f')]['id']){delete _0xce5078[_0x5cf6('0x4f')]['id'];}return db[_0x5cf6('0x45')][_0x5cf6('0x4d')]({'where':{'id':_0xce5078['params']['id']}})[_0x5cf6('0x2a')](handleEntityNotFound(_0x2035b1,null))['then'](saveUpdates(_0xce5078[_0x5cf6('0x4f')],null))[_0x5cf6('0x2a')](respondWithResult(_0x2035b1,null))[_0x5cf6('0x47')](handleError(_0x2035b1,null));};exports['destroy']=function(_0x7bcc75,_0x74af5){return db['ChatGroup']['find']({'where':{'id':_0x7bcc75[_0x5cf6('0x49')]['id']}})[_0x5cf6('0x2a')](handleEntityNotFound(_0x74af5,null))['then'](removeEntity(_0x74af5,null))[_0x5cf6('0x47')](handleError(_0x74af5,null));};exports['describe']=function(_0x4fea55,_0x5982ef){return db[_0x5cf6('0x45')][_0x5cf6('0x50')]()['then'](respondWithResult(_0x5982ef,null))['catch'](handleError(_0x5982ef,null));};exports[_0x5cf6('0x51')]=function(_0x277d8e,_0x4e3960,_0x11a169){return db[_0x5cf6('0x52')]['count']({'where':{'ChatGroupId':_0x277d8e[_0x5cf6('0x49')]['id'],'ToId':_0x277d8e[_0x5cf6('0x53')]['id'],'read':![]}})[_0x5cf6('0x2a')](function(_0x2b6b0d){return{'id':_[_0x5cf6('0x54')](_0x277d8e[_0x5cf6('0x49')]['id']),'count':_0x2b6b0d};})[_0x5cf6('0x2a')](respondWithResult(_0x4e3960,null))['catch'](handleError(_0x4e3960,null));};exports[_0x5cf6('0x55')]=function(_0x144b16,_0x158afb,_0x1f6972){return db[_0x5cf6('0x45')]['find']({'where':{'id':_0x144b16[_0x5cf6('0x49')]['id']}})[_0x5cf6('0x2a')](handleEntityNotFound(_0x158afb,null))['then'](function(_0x392c79){if(_0x392c79){return _0x392c79['addMembers'](_0x144b16['body'][_0x5cf6('0x56')],_[_0x5cf6('0x57')](_0x144b16[_0x5cf6('0x4f')],['ids','id'])||{});}})[_0x5cf6('0x2a')](respondWithResult(_0x158afb,null))[_0x5cf6('0x47')](handleError(_0x158afb,null));};exports['getMembers']=function(_0x156607,_0x18cbcf,_0x32dc6c){var _0x1088c4={};var _0x755c22={};var _0x20542e;var _0x46144b;return db['ChatGroup'][_0x5cf6('0x58')]({'where':{'id':_0x156607[_0x5cf6('0x49')]['id']}})['then'](handleEntityNotFound(_0x18cbcf,null))[_0x5cf6('0x2a')](function(_0x28b153){if(_0x28b153){_0x20542e=_0x28b153;_0x755c22[_0x5cf6('0x34')]=_[_0x5cf6('0x35')](db[_0x5cf6('0x59')][_0x5cf6('0x4a')]);_0x755c22[_0x5cf6('0x36')]=_['keys'](_0x156607['query']);_0x755c22[_0x5cf6('0x3f')]=_['intersection'](_0x755c22[_0x5cf6('0x34')],_0x755c22[_0x5cf6('0x36')]);_0x1088c4['attributes']=_[_0x5cf6('0x37')](_0x755c22[_0x5cf6('0x34')],qs[_0x5cf6('0x38')](_0x156607[_0x5cf6('0x36')]['fields']));_0x1088c4[_0x5cf6('0x39')]=_0x1088c4[_0x5cf6('0x39')][_0x5cf6('0x3a')]?_0x1088c4[_0x5cf6('0x39')]:_0x755c22[_0x5cf6('0x34')];_0x1088c4[_0x5cf6('0x3d')]=qs[_0x5cf6('0x3e')](_0x156607['query'][_0x5cf6('0x3e')]);_0x1088c4[_0x5cf6('0x42')]=qs[_0x5cf6('0x3f')](_['pick'](_0x156607[_0x5cf6('0x36')],_0x755c22['filters']));if(_0x156607[_0x5cf6('0x36')][_0x5cf6('0x41')]){_0x1088c4[_0x5cf6('0x42')]=_[_0x5cf6('0x43')](_0x1088c4[_0x5cf6('0x42')],{'$or':_[_0x5cf6('0x30')](_0x1088c4['attributes'],function(_0x417840){var _0x357e21={};_0x357e21[_0x417840]={'$like':'%'+_0x156607[_0x5cf6('0x36')]['filter']+'%'};return _0x357e21;})});}_0x1088c4=_[_0x5cf6('0x43')]({},_0x1088c4,_0x156607[_0x5cf6('0x44')]);return _0x20542e[_0x5cf6('0x5a')](_0x1088c4);}})['then'](function(_0x1e511a){if(_0x1e511a){_0x46144b=_0x1e511a['length'];if(!_0x156607[_0x5cf6('0x36')]['hasOwnProperty'](_0x5cf6('0x5b'))){_0x1088c4[_0x5cf6('0x3c')]=qs['limit'](_0x156607[_0x5cf6('0x36')][_0x5cf6('0x3c')]);_0x1088c4[_0x5cf6('0x21')]=qs['offset'](_0x156607[_0x5cf6('0x36')]['offset']);}return _0x20542e[_0x5cf6('0x5a')](_0x1088c4);}})[_0x5cf6('0x2a')](function(_0x12a437){if(_0x12a437){return _0x12a437?{'count':_0x46144b,'rows':_0x12a437}:null;}})['then'](respondWithResult(_0x18cbcf,null))['catch'](handleError(_0x18cbcf,null));};exports[_0x5cf6('0x5c')]=function(_0x2d40f7,_0x492e99,_0x24bc43){return db[_0x5cf6('0x45')][_0x5cf6('0x4d')]({'where':{'id':_0x2d40f7[_0x5cf6('0x49')]['id']}})[_0x5cf6('0x2a')](handleEntityNotFound(_0x492e99,null))[_0x5cf6('0x2a')](function(_0x14c4f8){if(_0x14c4f8){return _0x14c4f8[_0x5cf6('0x5c')](_0x2d40f7[_0x5cf6('0x36')][_0x5cf6('0x56')]);}})[_0x5cf6('0x2a')](respondWithStatusCode(_0x492e99,null))[_0x5cf6('0x47')](handleError(_0x492e99,null));};exports['addMessage']=function(_0x315092,_0x58c6b6,_0x5c5a6a){if(_0x315092['body']['id']){delete _0x315092[_0x5cf6('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x315092[_0x5cf6('0x49')]['id']}})[_0x5cf6('0x2a')](handleEntityNotFound(_0x58c6b6,null))[_0x5cf6('0x2a')](function(_0x1c1565){if(_0x1c1565){_0x315092[_0x5cf6('0x4f')][_0x5cf6('0x5d')]=_0x1c1565['id'];return db[_0x5cf6('0x52')][_0x5cf6('0x4e')](_0x315092[_0x5cf6('0x4f')]);}})[_0x5cf6('0x2a')](respondWithResult(_0x58c6b6,null))[_0x5cf6('0x47')](handleError(_0x58c6b6,null));};exports[_0x5cf6('0x5e')]=function(_0x2b5969,_0xf2ccfc,_0x3364ff){var _0x1885b3={};var _0x57f6f6={};var _0x4c95a1;var _0x3154e5;return db[_0x5cf6('0x45')][_0x5cf6('0x58')]({'where':{'id':_0x2b5969[_0x5cf6('0x49')]['id']}})[_0x5cf6('0x2a')](handleEntityNotFound(_0xf2ccfc,null))['then'](function(_0x184b2d){if(_0x184b2d){_0x4c95a1=_0x184b2d;_0x57f6f6['model']=_['keys'](db['ChatInternalMessage'][_0x5cf6('0x4a')]);_0x57f6f6[_0x5cf6('0x36')]=_[_0x5cf6('0x35')](_0x2b5969[_0x5cf6('0x36')]);_0x57f6f6[_0x5cf6('0x3f')]=_[_0x5cf6('0x37')](_0x57f6f6[_0x5cf6('0x34')],_0x57f6f6[_0x5cf6('0x36')]);_0x1885b3[_0x5cf6('0x39')]=_[_0x5cf6('0x37')](_0x57f6f6[_0x5cf6('0x34')],qs[_0x5cf6('0x38')](_0x2b5969['query'][_0x5cf6('0x38')]));_0x1885b3[_0x5cf6('0x39')]=_0x1885b3['attributes'][_0x5cf6('0x3a')]?_0x1885b3[_0x5cf6('0x39')]:_0x57f6f6[_0x5cf6('0x34')];_0x1885b3['order']=qs[_0x5cf6('0x3e')](_0x2b5969[_0x5cf6('0x36')][_0x5cf6('0x3e')]);_0x1885b3['where']=qs[_0x5cf6('0x3f')](_['pick'](_0x2b5969[_0x5cf6('0x36')],_0x57f6f6[_0x5cf6('0x3f')]));if(_0x2b5969[_0x5cf6('0x36')][_0x5cf6('0x41')]){_0x1885b3[_0x5cf6('0x42')]=_[_0x5cf6('0x43')](_0x1885b3[_0x5cf6('0x42')],{'$or':_[_0x5cf6('0x30')](_0x1885b3[_0x5cf6('0x39')],function(_0x4932df){var _0x1cff7f={};_0x1cff7f[_0x4932df]={'$like':'%'+_0x2b5969[_0x5cf6('0x36')][_0x5cf6('0x41')]+'%'};return _0x1cff7f;})});}if(_0x2b5969[_0x5cf6('0x36')][_0x5cf6('0x5f')]){var _0x4ba186=_0x2b5969[_0x5cf6('0x36')][_0x5cf6('0x5f')][_0x5cf6('0x60')](',');var _0x3f9563={};_0x3f9563[_0x4ba186[0x0]]={'$gte':moment(_0x4ba186[0x1])[_0x5cf6('0x61')](_0x5cf6('0x62'))};_0x1885b3['where']=_[_0x5cf6('0x43')](_0x1885b3[_0x5cf6('0x42')],_0x3f9563);}_0x1885b3=_[_0x5cf6('0x43')]({},_0x1885b3,_0x2b5969['options']);return _0x4c95a1[_0x5cf6('0x5e')](_0x1885b3);}})['then'](function(_0x18481d){if(_0x18481d){_0x3154e5=_0x18481d['length'];if(!_0x2b5969['query'][_0x5cf6('0x3b')](_0x5cf6('0x5b'))){_0x1885b3[_0x5cf6('0x3c')]=qs[_0x5cf6('0x3c')](_0x2b5969[_0x5cf6('0x36')]['limit']);_0x1885b3[_0x5cf6('0x21')]=qs['offset'](_0x2b5969[_0x5cf6('0x36')][_0x5cf6('0x21')]);}return _0x4c95a1[_0x5cf6('0x5e')](_0x1885b3);}})['then'](function(_0x770af9){if(_0x770af9){return _0x770af9?{'count':_0x3154e5,'rows':_0x770af9}:null;}})[_0x5cf6('0x2a')](respondWithResult(_0xf2ccfc,null))[_0x5cf6('0x47')](handleError(_0xf2ccfc,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8617ce7..a8b0697 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 _0x22ca=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x268535,_0x436b5c){var _0xf476c9=function(_0x157ed3){while(--_0x157ed3){_0x268535['push'](_0x268535['shift']());}};_0xf476c9(++_0x436b5c);}(_0x22ca,0x1d9));var _0xa22c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x22ca[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa22c('0x0'));var ChatGroup=require(_0xa22c('0x1'))['db'][_0xa22c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xa22c('0x3')](0x0);var events={'afterCreate':_0xa22c('0x4'),'afterUpdate':_0xa22c('0x5'),'afterDestroy':_0xa22c('0x6')};function emitEvent(_0x915971){return function(_0x3de354,_0xae9f6c,_0x212156){ChatGroupEvents['emit'](_0x915971+':'+_0x3de354['id'],_0x3de354);ChatGroupEvents['emit'](_0x915971,_0x3de354);_0x212156(null);};}for(var e in events){if(events[_0xa22c('0x7')](e)){var event=events[e];ChatGroup[_0xa22c('0x8')](e,emitEvent(event));}}module[_0xa22c('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x5ab9=['setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5ab9,0x117));var _0x95ab=function(_0xcc05ed,_0x44eb83){_0xcc05ed=_0xcc05ed-0x0;var _0x24a2f5=_0x5ab9[_0xcc05ed];return _0x24a2f5;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x95ab('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x95ab('0x1')](0x0);var events={'afterCreate':_0x95ab('0x2'),'afterUpdate':_0x95ab('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc1e36){return function(_0x2e8942,_0x558344,_0x3dd95d){ChatGroupEvents['emit'](_0xc1e36+':'+_0x2e8942['id'],_0x2e8942);ChatGroupEvents[_0x95ab('0x4')](_0xc1e36,_0x2e8942);_0x3dd95d(null);};}for(var e in events){if(events[_0x95ab('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x95ab('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index e5cee2b..db20d20 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 _0x255c=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x30bdff,_0x308063){var _0x1e7ca9=function(_0x1a6e16){while(--_0x1a6e16){_0x30bdff['push'](_0x30bdff['shift']());}};_0x1e7ca9(++_0x308063);}(_0x255c,0x1f1));var _0xc255=function(_0x59217e,_0x414f67){_0x59217e=_0x59217e-0x0;var _0x26e506=_0x255c[_0x59217e];return _0x26e506;};'use strict';var _=require(_0xc255('0x0'));var util=require(_0xc255('0x1'));var logger=require(_0xc255('0x2'))(_0xc255('0x3'));var moment=require(_0xc255('0x4'));var BPromise=require(_0xc255('0x5'));var rp=require(_0xc255('0x6'));var fs=require('fs');var path=require(_0xc255('0x7'));var rimraf=require(_0xc255('0x8'));var config=require(_0xc255('0x9'));var attributes=require(_0xc255('0xa'));module[_0xc255('0xb')]=function(_0x35edeb,_0x30dd21){return _0x35edeb[_0xc255('0xc')]('ChatGroup',attributes,{'tableName':_0xc255('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3121=['define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x2ec674,_0x55e397){var _0x4e3a90=function(_0xb38e8e){while(--_0xb38e8e){_0x2ec674['push'](_0x2ec674['shift']());}};_0x4e3a90(++_0x55e397);}(_0x3121,0x1bd));var _0x1312=function(_0x2bd0b6,_0x4e5e54){_0x2bd0b6=_0x2bd0b6-0x0;var _0x225ad6=_0x3121[_0x2bd0b6];return _0x225ad6;};'use strict';var _=require(_0x1312('0x0'));var util=require(_0x1312('0x1'));var logger=require(_0x1312('0x2'))(_0x1312('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1312('0x4'));var fs=require('fs');var path=require(_0x1312('0x5'));var rimraf=require(_0x1312('0x6'));var config=require(_0x1312('0x7'));var attributes=require(_0x1312('0x8'));module[_0x1312('0x9')]=function(_0xb9de03,_0x722054){return _0xb9de03[_0x1312('0xa')](_0x1312('0xb'),attributes,{'tableName':_0x1312('0xc'),'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 4bf05ae..7e247dc 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 _0x50b9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1758cc,_0x17e3eb){var _0xc9bf64=function(_0x94776a){while(--_0x94776a){_0x1758cc['push'](_0x1758cc['shift']());}};_0xc9bf64(++_0x17e3eb);}(_0x50b9,0x171));var _0x950b=function(_0x444d2f,_0x2927b9){_0x444d2f=_0x444d2f-0x0;var _0x18ae46=_0x50b9[_0x444d2f];return _0x18ae46;};'use strict';var _=require(_0x950b('0x0'));var util=require('util');var moment=require(_0x950b('0x1'));var BPromise=require('bluebird');var rs=require(_0x950b('0x2'));var fs=require('fs');var Redis=require(_0x950b('0x3'));var db=require(_0x950b('0x4'))['db'];var utils=require(_0x950b('0x5'));var logger=require(_0x950b('0x6'))(_0x950b('0x7'));var config=require(_0x950b('0x8'));var jayson=require(_0x950b('0x9'));var client=jayson[_0x950b('0xa')]['http']({'port':0x232a});config[_0x950b('0xb')]=_[_0x950b('0xc')](config[_0x950b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x950b('0xd'))[_0x950b('0xe')](socket);function respondWithRpcPromise(_0x3c7c3d,_0x4259e2,_0x3ffb3d){return new BPromise(function(_0xe21279,_0x240f06){return client['request'](_0x3c7c3d,_0x3ffb3d)[_0x950b('0xf')](function(_0x43b03a){logger['info'](_0x950b('0x10'),_0x4259e2,'request\x20sent');logger['debug'](_0x950b('0x11'),_0x4259e2,_0x950b('0x12'),JSON[_0x950b('0x13')](_0x43b03a));if(_0x43b03a[_0x950b('0x14')]){if(_0x43b03a[_0x950b('0x14')][_0x950b('0x15')]===0x1f4){logger[_0x950b('0x14')](_0x950b('0x10'),_0x4259e2,_0x43b03a[_0x950b('0x14')][_0x950b('0x16')]);return _0x240f06(_0x43b03a[_0x950b('0x14')][_0x950b('0x16')]);}logger[_0x950b('0x14')](_0x950b('0x10'),_0x4259e2,_0x43b03a[_0x950b('0x14')][_0x950b('0x16')]);return _0xe21279(_0x43b03a[_0x950b('0x14')][_0x950b('0x16')]);}else{logger['info'](_0x950b('0x10'),_0x4259e2,'request\x20sent');_0xe21279(_0x43b03a[_0x950b('0x17')][_0x950b('0x16')]);}})[_0x950b('0x18')](function(_0x3d80c6){logger[_0x950b('0x14')](_0x950b('0x10'),_0x4259e2,_0x3d80c6);_0x240f06(_0x3d80c6);});});} \ No newline at end of file +var _0x3f2b=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5c1791,_0x16ffee){var _0x149952=function(_0x459eb5){while(--_0x459eb5){_0x5c1791['push'](_0x5c1791['shift']());}};_0x149952(++_0x16ffee);}(_0x3f2b,0x72));var _0xb3f2=function(_0x353c28,_0x484538){_0x353c28=_0x353c28-0x0;var _0x5950bb=_0x3f2b[_0x353c28];return _0x5950bb;};'use strict';var _=require(_0xb3f2('0x0'));var util=require('util');var moment=require(_0xb3f2('0x1'));var BPromise=require(_0xb3f2('0x2'));var rs=require(_0xb3f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3f2('0x4'))['db'];var utils=require(_0xb3f2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb3f2('0x6'));var jayson=require(_0xb3f2('0x7'));var client=jayson[_0xb3f2('0x8')][_0xb3f2('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb3f2('0xa')],{'host':_0xb3f2('0xb'),'port':0x18eb});var socket=require(_0xb3f2('0xc'))(new Redis(config[_0xb3f2('0xa')]));require(_0xb3f2('0xd'))[_0xb3f2('0xe')](socket);function respondWithRpcPromise(_0x415fd9,_0x314877,_0x94fada){return new BPromise(function(_0xf9b4be,_0x185c58){return client[_0xb3f2('0xf')](_0x415fd9,_0x94fada)[_0xb3f2('0x10')](function(_0xaf3b86){logger[_0xb3f2('0x11')]('ChatGroup,\x20%s,\x20%s',_0x314877,_0xb3f2('0x12'));logger['debug'](_0xb3f2('0x13'),_0x314877,_0xb3f2('0x12'),JSON['stringify'](_0xaf3b86));if(_0xaf3b86[_0xb3f2('0x14')]){if(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x15')]===0x1f4){logger['error'](_0xb3f2('0x16'),_0x314877,_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);return _0x185c58(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);}logger[_0xb3f2('0x14')](_0xb3f2('0x16'),_0x314877,_0xaf3b86['error'][_0xb3f2('0x17')]);return _0xf9b4be(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);}else{logger[_0xb3f2('0x11')](_0xb3f2('0x16'),_0x314877,_0xb3f2('0x12'));_0xf9b4be(_0xaf3b86['result']['message']);}})[_0xb3f2('0x18')](function(_0x3a861a){logger[_0xb3f2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x314877,_0x3a861a);_0x185c58(_0x3a861a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 334c731..e1d2422 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 _0xd355=['update','emit','length','chatGroup:','./chatGroup.events'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd355,0x121));var _0x5d35=function(_0x3c5e44,_0x37483f){_0x3c5e44=_0x3c5e44-0x0;var _0xb34f65=_0xd355[_0x3c5e44];return _0xb34f65;};'use strict';var ChatGroupEvents=require(_0x5d35('0x0'));var events=['save','remove',_0x5d35('0x1')];function createListener(_0x1e9c52,_0x1eb716){return function(_0x401519){_0x1eb716[_0x5d35('0x2')](_0x1e9c52,_0x401519);};}function removeListener(_0x56b319,_0x17dca3){return function(){ChatGroupEvents['removeListener'](_0x56b319,_0x17dca3);};}exports['register']=function(_0x5e6171){for(var _0x112977=0x0,_0x3e0a3f=events[_0x5d35('0x3')];_0x112977<_0x3e0a3f;_0x112977++){var _0x5f4345=events[_0x112977];var _0x31dc38=createListener(_0x5d35('0x4')+_0x5f4345,_0x5e6171);ChatGroupEvents['on'](_0x5f4345,_0x31dc38);}}; \ No newline at end of file +var _0xeed1=['register','chatGroup:','save','remove','update'];(function(_0x29b6a1,_0x3f30e5){var _0x4d2ebf=function(_0x3acfbe){while(--_0x3acfbe){_0x29b6a1['push'](_0x29b6a1['shift']());}};_0x4d2ebf(++_0x3f30e5);}(_0xeed1,0x124));var _0x1eed=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xeed1[_0x3ce2c4];return _0x4047c1;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x1eed('0x0'),_0x1eed('0x1'),_0x1eed('0x2')];function createListener(_0x5bd419,_0x204dd1){return function(_0x4df0d9){_0x204dd1['emit'](_0x5bd419,_0x4df0d9);};}function removeListener(_0x7a29ab,_0x2baa70){return function(){ChatGroupEvents['removeListener'](_0x7a29ab,_0x2baa70);};}exports[_0x1eed('0x3')]=function(_0x53de5d){for(var _0x3d2d7b=0x0,_0x380189=events['length'];_0x3d2d7b<_0x380189;_0x3d2d7b++){var _0x36fb70=events[_0x3d2d7b];var _0x1878ec=createListener(_0x1eed('0x4')+_0x36fb70,_0x53de5d);ChatGroupEvents['on'](_0x36fb70,_0x1878ec);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0b14cbe..e0d216c 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 _0xcce1=['describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x1cf224,_0x5e216b){var _0x3d7fb5=function(_0x3aa5d5){while(--_0x3aa5d5){_0x1cf224['push'](_0x1cf224['shift']());}};_0x3d7fb5(++_0x5e216b);}(_0xcce1,0x18a));var _0x1cce=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0xcce1[_0xacb1e2];return _0x463815;};'use strict';var multer=require('multer');var util=require(_0x1cce('0x0'));var path=require(_0x1cce('0x1'));var timeout=require(_0x1cce('0x2'));var express=require(_0x1cce('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1cce('0x4'));var interaction=require(_0x1cce('0x5'));var config=require(_0x1cce('0x6'));var controller=require('./chatGroup.controller');router[_0x1cce('0x7')]('/',auth[_0x1cce('0x8')](),controller[_0x1cce('0x9')]);router[_0x1cce('0x7')](_0x1cce('0xa'),auth[_0x1cce('0x8')](),controller[_0x1cce('0xb')]);router[_0x1cce('0x7')](_0x1cce('0xc'),auth['isAuthenticated'](),controller[_0x1cce('0xd')]);router[_0x1cce('0x7')](_0x1cce('0xe'),auth['isAuthenticated'](),controller['getUnread']);router[_0x1cce('0x7')](_0x1cce('0xf'),auth[_0x1cce('0x8')](),controller[_0x1cce('0x10')]);router[_0x1cce('0x7')](_0x1cce('0x11'),auth['isAuthenticated'](),controller[_0x1cce('0x12')]);router[_0x1cce('0x13')]('/',auth[_0x1cce('0x8')](),controller[_0x1cce('0x14')]);router[_0x1cce('0x13')](_0x1cce('0xf'),auth[_0x1cce('0x8')](),controller[_0x1cce('0x15')]);router[_0x1cce('0x13')](_0x1cce('0x11'),auth[_0x1cce('0x8')](),controller[_0x1cce('0x16')]);router['put'](_0x1cce('0xc'),auth[_0x1cce('0x8')](),controller['update']);router[_0x1cce('0x17')](_0x1cce('0xc'),auth[_0x1cce('0x8')](),controller[_0x1cce('0x18')]);router['delete'](_0x1cce('0xf'),auth[_0x1cce('0x8')](),controller[_0x1cce('0x19')]);module[_0x1cce('0x1a')]=router; \ No newline at end of file +var _0xf3f5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','getUnread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','destroy','exports','util','path'];(function(_0x150bf0,_0x3b0466){var _0x52698c=function(_0xabc5ce){while(--_0xabc5ce){_0x150bf0['push'](_0x150bf0['shift']());}};_0x52698c(++_0x3b0466);}(_0xf3f5,0x1e4));var _0x5f3f=function(_0x43180e,_0x11d06f){_0x43180e=_0x43180e-0x0;var _0x20d46d=_0xf3f5[_0x43180e];return _0x20d46d;};'use strict';var multer=require('multer');var util=require(_0x5f3f('0x0'));var path=require(_0x5f3f('0x1'));var timeout=require(_0x5f3f('0x2'));var express=require(_0x5f3f('0x3'));var router=express[_0x5f3f('0x4')]();var fs_extra=require(_0x5f3f('0x5'));var auth=require(_0x5f3f('0x6'));var interaction=require(_0x5f3f('0x7'));var config=require(_0x5f3f('0x8'));var controller=require(_0x5f3f('0x9'));router[_0x5f3f('0xa')]('/',auth[_0x5f3f('0xb')](),controller['index']);router[_0x5f3f('0xa')](_0x5f3f('0xc'),auth[_0x5f3f('0xb')](),controller[_0x5f3f('0xd')]);router[_0x5f3f('0xa')](_0x5f3f('0xe'),auth[_0x5f3f('0xb')](),controller[_0x5f3f('0xf')]);router[_0x5f3f('0xa')]('/:id/unread',auth[_0x5f3f('0xb')](),controller[_0x5f3f('0x10')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x5f3f('0xa')](_0x5f3f('0x11'),auth[_0x5f3f('0xb')](),controller[_0x5f3f('0x12')]);router[_0x5f3f('0x13')]('/',auth[_0x5f3f('0xb')](),controller[_0x5f3f('0x14')]);router[_0x5f3f('0x13')](_0x5f3f('0x15'),auth['isAuthenticated'](),controller[_0x5f3f('0x16')]);router[_0x5f3f('0x13')](_0x5f3f('0x11'),auth['isAuthenticated'](),controller[_0x5f3f('0x17')]);router[_0x5f3f('0x18')](_0x5f3f('0xe'),auth[_0x5f3f('0xb')](),controller['update']);router['delete'](_0x5f3f('0xe'),auth[_0x5f3f('0xb')](),controller[_0x5f3f('0x19')]);router['delete'](_0x5f3f('0x15'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x5f3f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1834c50..89e134b 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 _0x48ec=['TEXT','STRING','long','DATE','out','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x3dc37d,_0x368e5b){var _0x1eb30d=function(_0x976bea){while(--_0x976bea){_0x3dc37d['push'](_0x3dc37d['shift']());}};_0x1eb30d(++_0x368e5b);}(_0x48ec,0x13b));var _0xc48e=function(_0x162ab4,_0x578437){_0x162ab4=_0x162ab4-0x0;var _0x410f69=_0x48ec[_0x162ab4];return _0x410f69;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xc48e('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc48e('0x1')]},'ratingType':{'type':Sequelize[_0xc48e('0x2')](_0xc48e('0x3'),_0xc48e('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc48e('0x5')]},'pathTranscript':{'type':Sequelize[_0xc48e('0x5')]},'mailTranscript':{'type':Sequelize[_0xc48e('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc48e('0x6')]},'secondDisposition':{'type':Sequelize[_0xc48e('0x6')]},'thirdDisposition':{'type':Sequelize[_0xc48e('0x6')]},'note':{'type':Sequelize[_0xc48e('0x6')]},'browserName':{'type':Sequelize[_0xc48e('0x6')]},'browserVersion':{'type':Sequelize[_0xc48e('0x6')]},'osName':{'type':Sequelize[_0xc48e('0x6')]},'osVersion':{'type':Sequelize[_0xc48e('0x6')]},'deviceModel':{'type':Sequelize[_0xc48e('0x6')]},'deviceVendor':{'type':Sequelize[_0xc48e('0x6')]},'deviceType':{'type':Sequelize[_0xc48e('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xc48e('0x6')]},'formData':{'type':Sequelize[_0xc48e('0x5')](_0xc48e('0x7'))},'read1stAt':{'type':Sequelize[_0xc48e('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc48e('0x2')]('in',_0xc48e('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc48e('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xc48e('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc48e('0x1')]}}; \ No newline at end of file +var _0x575c=['TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0x575c,0x1c1));var _0xc575=function(_0x2da927,_0x8d8575){_0x2da927=_0x2da927-0x0;var _0x355de9=_0x575c[_0x2da927];return _0x355de9;};'use strict';var Sequelize=require(_0xc575('0x0'));module[_0xc575('0x1')]={'closed':{'type':Sequelize[_0xc575('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc575('0x3')]},'ratingType':{'type':Sequelize[_0xc575('0x4')](_0xc575('0x5'),_0xc575('0x6')),'defaultValue':_0xc575('0x5')},'ratingMessage':{'type':Sequelize[_0xc575('0x7')]},'pathTranscript':{'type':Sequelize[_0xc575('0x7')]},'mailTranscript':{'type':Sequelize[_0xc575('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc575('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc575('0x8')]},'thirdDisposition':{'type':Sequelize[_0xc575('0x8')]},'note':{'type':Sequelize[_0xc575('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xc575('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xc575('0x8')]},'deviceModel':{'type':Sequelize[_0xc575('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xc575('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xc575('0x8')]},'formData':{'type':Sequelize[_0xc575('0x7')](_0xc575('0xa'))},'read1stAt':{'type':Sequelize[_0xc575('0x9')]},'lastMsgAt':{'type':Sequelize[_0xc575('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc575('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc575('0x8')]},'customerPort':{'type':Sequelize[_0xc575('0x8')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 79e2465..5f317be 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 _0x410b=['existsSync','createReadStream','createWriteStream','value','views','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','count','limit','update','destroy','stack','name','render','merge','body','contact','agent','account','map','ChatInteraction','rawAttributes','fieldName','getOptions','findAll','chat','query','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','user','fullname','https://api-vidaoo.xcally.com/api/v1/meetings','email','follow','isNull','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','Messages','CmContact','ContactId','%s%d','customer','Visitor','agentIdentifier','website_alias','agentAlias','System','User','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','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','filters','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','include','rows','getMyMessages','includeAgent','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','attachments','firstName','lastName','read','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','customerIp','customerPort','tail'];(function(_0x4b90bb,_0xa453ec){var _0x11cf6c=function(_0x197730){while(--_0x197730){_0x4b90bb['push'](_0x4b90bb['shift']());}};_0x11cf6c(++_0xa453ec);}(_0x410b,0x1a9));var _0xb410=function(_0x2c9b13,_0x7be185){_0x2c9b13=_0x2c9b13-0x0;var _0x44bcb4=_0x410b[_0x2c9b13];return _0x44bcb4;};'use strict';var rimraf=require(_0xb410('0x0'));var zipdir=require('zip-dir');var rp=require(_0xb410('0x1'));var moment=require(_0xb410('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb410('0x3'));var path=require('path');var ejs=require(_0xb410('0x4'));var fs=require('fs');var _=require(_0xb410('0x5'));var Redis=require(_0xb410('0x6'));var interaction=require(_0xb410('0x7'));var qs=require(_0xb410('0x8'));var pdf=require(_0xb410('0x9'));var logger=require('../../config/logger')(_0xb410('0xa'));var config=require(_0xb410('0xb'));var db=require(_0xb410('0xc'))['db'];config[_0xb410('0xd')]=_[_0xb410('0xe')](config[_0xb410('0xd')],{'host':_0xb410('0xf'),'port':0x18eb});var socket=require(_0xb410('0x10'))(new Redis(config[_0xb410('0xd')]));require('./chatInteraction.socket')[_0xb410('0x11')](socket);var jayson=require(_0xb410('0x12'));var client=jayson[_0xb410('0x13')][_0xb410('0x14')]({'port':0x232b});var client9004=jayson[_0xb410('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1e6d13,_0x16a638,_0x12c57f,_0x238a80){return new BPromise(function(_0x1cf832,_0x212f92){var _0x22fced=_0x238a80||client;return _0x22fced[_0xb410('0x15')](_0x1e6d13,_0x12c57f)[_0xb410('0x16')](function(_0x469d88){logger[_0xb410('0x17')](_0xb410('0x18'),_0x16a638,_0xb410('0x19'));logger[_0xb410('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x16a638,'request\x20sent',JSON[_0xb410('0x1b')](_0x469d88));if(_0x469d88[_0xb410('0x1c')]){if(_0x469d88['error'][_0xb410('0x1d')]===0x1f4){logger[_0xb410('0x1c')](_0xb410('0x18'),_0x16a638,_0x469d88[_0xb410('0x1c')][_0xb410('0x1e')]);return _0x212f92(_0x469d88['error'][_0xb410('0x1e')]);}logger[_0xb410('0x1c')](_0xb410('0x18'),_0x16a638,_0x469d88[_0xb410('0x1c')][_0xb410('0x1e')]);return _0x1cf832(_0x469d88[_0xb410('0x1c')][_0xb410('0x1e')]);}else{logger[_0xb410('0x17')](_0xb410('0x18'),_0x16a638,'request\x20sent');_0x1cf832(_0x469d88[_0xb410('0x1f')][_0xb410('0x1e')]);}})['catch'](function(_0x2e98e2){logger['error'](_0xb410('0x18'),_0x16a638,_0x2e98e2);_0x212f92(_0x2e98e2);});});}function respondWithStatusCode(_0x428bef,_0x3b21e4){_0x3b21e4=_0x3b21e4||0xcc;return function(_0x69b73){if(_0x69b73){return _0x428bef[_0xb410('0x20')](_0x3b21e4);}return _0x428bef['status'](_0x3b21e4)[_0xb410('0x21')]();};}function respondWithResult(_0x3d3778,_0x34f9b1){_0x34f9b1=_0x34f9b1||0xc8;return function(_0xa3fb55){if(_0xa3fb55){return _0x3d3778[_0xb410('0x22')](_0x34f9b1)[_0xb410('0x23')](_0xa3fb55);}};}function respondWithFilteredResult(_0x2a72c1,_0x2f1416){return function(_0x1ff789){if(_0x1ff789){var _0x145842=typeof _0x2f1416[_0xb410('0x24')]===_0xb410('0x25')&&typeof _0x2f1416['limit']===_0xb410('0x25');var _0x4e2321=_0x1ff789[_0xb410('0x26')];var _0x5e7a59=_0x145842?0x0:_0x2f1416[_0xb410('0x24')];var _0x3df003=_0x145842?_0x1ff789[_0xb410('0x26')]:_0x2f1416[_0xb410('0x24')]+_0x2f1416[_0xb410('0x27')];var _0x4b0218;if(_0x3df003>=_0x4e2321){_0x3df003=_0x4e2321;_0x4b0218=0xc8;}else{_0x4b0218=0xce;}_0x2a72c1['status'](_0x4b0218);return _0x2a72c1['set']('Content-Range',_0x5e7a59+'-'+_0x3df003+'/'+_0x4e2321)['json'](_0x1ff789);}return null;};}function saveUpdates(_0x5be7a4){return function(_0x39157a){if(_0x39157a){return _0x39157a[_0xb410('0x28')](_0x5be7a4)[_0xb410('0x16')](function(_0x45d294){return _0x45d294;});}return null;};}function removeEntity(_0x4f0b2d){return function(_0x2d2c99){if(_0x2d2c99){return _0x2d2c99[_0xb410('0x29')]()[_0xb410('0x16')](function(){_0x4f0b2d[_0xb410('0x22')](0xcc)[_0xb410('0x21')]();});}};}function handleEntityNotFound(_0x5380ed){return function(_0x2f42fc){if(!_0x2f42fc){_0x5380ed[_0xb410('0x20')](0x194);}return _0x2f42fc;};}function handleError(_0x5eae26,_0x108a61){_0x108a61=_0x108a61||0x1f4;return function(_0x1bf090){logger[_0xb410('0x1c')](_0x1bf090[_0xb410('0x2a')]);if(_0x1bf090[_0xb410('0x2b')]){delete _0x1bf090[_0xb410('0x2b')];}_0x5eae26[_0xb410('0x22')](_0x108a61)['send'](_0x1bf090);};}function getMustacheRender(_0x12d38d,_0x2ad32){return Mustache[_0xb410('0x2c')](_0x12d38d,_[_0xb410('0x2d')](_0x2ad32[_0xb410('0x2e')],{'contact':_0x2ad32[_0xb410('0x2f')],'message':_0x2ad32[_0xb410('0x1e')],'agent':_0x2ad32[_0xb410('0x30')],'interaction':_0x2ad32['interaction'],'account':_0x2ad32[_0xb410('0x31')]}))||'';}exports['index']=function(_0x25df2b,_0x63e010){var _0x555f0f={};var _0x3dfa4b=_[_0xb410('0x32')](db[_0xb410('0x33')][_0xb410('0x34')],function(_0x1bb3b8){return{'name':_0x1bb3b8[_0xb410('0x35')],'type':_0x1bb3b8['type']['key']};});_0x555f0f=qs[_0xb410('0x36')](_0x3dfa4b,_0x25df2b);return interaction[_0xb410('0x37')](_0xb410('0x38'),_0x25df2b[_0xb410('0x39')],_0x25df2b['user'],_0x555f0f,_0x3dfa4b)['then'](respondWithFilteredResult(_0x63e010,_0x555f0f))[_0xb410('0x3a')](handleError(_0x63e010,null));};exports[_0xb410('0x3b')]=function(_0x4a525b,_0x446865){var _0x104484={'raw':![],'where':{'id':_0x4a525b[_0xb410('0x3c')]['id']}},_0x272df9={};_0x272df9[_0xb410('0x3d')]=_[_0xb410('0x3e')](db['ChatInteraction'][_0xb410('0x34')]);_0x272df9[_0xb410('0x39')]=_[_0xb410('0x3e')](_0x4a525b[_0xb410('0x39')]);_0x272df9['filters']=_[_0xb410('0x3f')](_0x272df9[_0xb410('0x3d')],_0x272df9['query']);_0x104484[_0xb410('0x40')]=_[_0xb410('0x3f')](_0x272df9[_0xb410('0x3d')],qs[_0xb410('0x41')](_0x4a525b[_0xb410('0x39')]['fields']));_0x104484[_0xb410('0x40')]=_0x104484[_0xb410('0x40')][_0xb410('0x42')]?_0x104484['attributes']:_0x272df9[_0xb410('0x3d')];if(_0x4a525b[_0xb410('0x39')][_0xb410('0x43')]){_0x104484['include']=[{'all':!![]}];}_0x104484=_[_0xb410('0x2d')]({},_0x104484,_0x4a525b[_0xb410('0x44')]);return db[_0xb410('0x33')][_0xb410('0x45')](_0x104484)[_0xb410('0x16')](handleEntityNotFound(_0x446865,null))[_0xb410('0x16')](respondWithResult(_0x446865,null))[_0xb410('0x3a')](handleError(_0x446865,null));};exports[_0xb410('0x46')]=function(_0x1f7a76,_0x5ea37c){return db['ChatInteraction'][_0xb410('0x46')](_0x1f7a76[_0xb410('0x2e')],{})[_0xb410('0x16')](respondWithResult(_0x5ea37c,0xc9))[_0xb410('0x3a')](handleError(_0x5ea37c,null));};exports['update']=function(_0x4d5cc0,_0x29f3a2){if(_0x4d5cc0[_0xb410('0x2e')]['id']){delete _0x4d5cc0[_0xb410('0x2e')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4d5cc0[_0xb410('0x3c')]['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x29f3a2,null))[_0xb410('0x16')](saveUpdates(_0x4d5cc0[_0xb410('0x2e')],null))['then'](respondWithResult(_0x29f3a2,null))[_0xb410('0x3a')](handleError(_0x29f3a2,null));};exports['destroy']=function(_0x5ae27d,_0x42ae68){return db[_0xb410('0x33')]['find']({'where':{'id':_0x5ae27d[_0xb410('0x3c')]['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x42ae68,null))[_0xb410('0x16')](removeEntity(_0x42ae68,null))[_0xb410('0x3a')](handleError(_0x42ae68,null));};exports[_0xb410('0x47')]=function(_0x3588c1,_0x50745d){return db[_0xb410('0x33')][_0xb410('0x47')]()[_0xb410('0x16')](respondWithResult(_0x50745d,null))[_0xb410('0x3a')](handleError(_0x50745d,null));};exports[_0xb410('0x48')]=function(_0x54ab2d,_0x469e51){var _0x11d9a1=_0x54ab2d['params']['id'];var _0x368f3b;var _0x19c066;var _0x3304d3;return db[_0xb410('0x33')][_0xb410('0x49')]({'where':{'id':_0x11d9a1}})[_0xb410('0x16')](function(_0x3e5d3a){_0x368f3b=_0x3e5d3a;return db[_0xb410('0x4a')][_0xb410('0x49')]({'where':{'id':_0x3e5d3a[_0xb410('0x4b')]},'attributes':['id',_0xb410('0x4c'),_0xb410('0x4d'),'vidaooTopic',_0xb410('0x4e'),'vidaooMetadata'],'raw':!![]});})[_0xb410('0x16')](function(_0x21c8c6){if(_0x21c8c6&&_0x21c8c6['vidaooApiKey']&&_0x21c8c6[_0xb410('0x4d')]){_0x19c066=_0x21c8c6;var _0x5e4556={'interaction':{'id':_0x11d9a1},'agent':{'id':_0x54ab2d[_0xb410('0x4f')]['id'],'name':_0x54ab2d[_0xb410('0x4f')][_0xb410('0x2b')],'fullname':_0x54ab2d['user'][_0xb410('0x50')],'email':_0x54ab2d[_0xb410('0x4f')]['email']},'contact':_0x54ab2d[_0xb410('0x2e')][_0xb410('0x2f')],'account':_0x54ab2d[_0xb410('0x2e')][_0xb410('0x31')]};var _0xfee042={'rejectUnauthorized':![],'method':'POST','url':_0xb410('0x51'),'headers':{'X-APIKEY':_0x21c8c6[_0xb410('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x54ab2d[_0xb410('0x4f')][_0xb410('0x52')]],'buttons':null,'topic':_0x19c066['vidaooTopic'],'note':_['isNull'](_0x19c066['vidaooNote'])?null:getMustacheRender(_0x19c066[_0xb410('0x4e')],_0x5e4556),'metadata':null},'redirect':_0xb410('0x53'),'json':!![]};try{if(!_[_0xb410('0x54')](_0x19c066[_0xb410('0x55')])){var _0x359fff=getMustacheRender(_0x19c066[_0xb410('0x55')],_0x5e4556);var _0x2af986=JSON[_0xb410('0x56')](_0x359fff);_0xfee042[_0xb410('0x2e')][_0xb410('0x57')]=_0x2af986;}}catch(_0x4af91b){throw new db[(_0xb410('0x58'))][(_0xb410('0x59'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xfee042);}else{throw new db[(_0xb410('0x58'))][(_0xb410('0x59'))](_0xb410('0x5a'));}})[_0xb410('0x16')](function(_0x403f2d){_0x3304d3=_0x403f2d;if(_0x3304d3['id']){var _0x3d4e32={'body':_0x3304d3[_0xb410('0x5b')],'ChatWebsiteId':_0x19c066['id'],'ChatInteractionId':_0x368f3b['id'],'direction':_0xb410('0x5c'),'UserId':_0x54ab2d[_0xb410('0x4f')]['id']};return db[_0xb410('0x5d')]['create'](_0x3d4e32,{});}else{throw new db['Sequelize'][(_0xb410('0x59'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xb410('0x16')](function(){return _0x368f3b[_0xb410('0x5e')]({'vidaooSessionId':_0x3304d3['id']});})[_0xb410('0x16')](respondWithResult(_0x469e51,null))[_0xb410('0x3a')](handleError(_0x469e51,null));};exports['customUpdate']=function(_0x4ea8d4,_0x3c7c00){if(_0x4ea8d4[_0xb410('0x2e')]['id']){delete _0x4ea8d4[_0xb410('0x2e')]['id'];}return db[_0xb410('0x33')][_0xb410('0x45')]({'where':{'id':_0x4ea8d4[_0xb410('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0xb410('0x5f')}]})['then'](handleEntityNotFound(_0x3c7c00,null))['then'](saveUpdates(_0x4ea8d4[_0xb410('0x2e')],null))[_0xb410('0x16')](respondWithResult(_0x3c7c00,null))[_0xb410('0x3a')](handleError(_0x3c7c00,null));};exports[_0xb410('0x60')]=function(_0x4de2ea,_0x5bccc9){if(_0x4de2ea['body']['id']){delete _0x4de2ea[_0xb410('0x2e')]['id'];}return db['ChatInteraction'][_0xb410('0x45')]({'where':{'id':_0x4de2ea[_0xb410('0x3c')]['id']}})['then'](function(_0x5c65b6){if(!_0x5c65b6){logger['error'](_0xb410('0x61'),'abandon',0x194,'entity\x20not\x20found');_0x5bccc9['sendStatus'](0x194);}else{if(_0x5c65b6[_0xb410('0x62')]){throw new db[(_0xb410('0x58'))]['ValidationError'](_0xb410('0x63'));}}return _0x5c65b6;})['then'](function(_0x48a475){if(_0x48a475){return _0x48a475['update']({'closed':_0x4de2ea[_0xb410('0x2e')][_0xb410('0x64')],'disposition':_0x4de2ea[_0xb410('0x2e')][_0xb410('0x65')]})[_0xb410('0x16')](function(_0x1399e8){return _0x1399e8;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xb410('0x60'),_0x4de2ea[_0xb410('0x2e')],client9004);})[_0xb410('0x16')](respondWithResult(_0x5bccc9,null))[_0xb410('0x3a')](handleError(_0x5bccc9,null));};exports['attachmentUpload']=function(_0x308bf2,_0x392b03){_0x308bf2['body'][_0xb410('0x2b')]=_0x308bf2[_0xb410('0x66')][_0xb410('0x67')];_0x308bf2['body'][_0xb410('0x68')]=_0x308bf2[_0xb410('0x66')][_0xb410('0x69')];_0x308bf2[_0xb410('0x2e')][_0xb410('0x6a')]=_0x308bf2['file'][_0xb410('0x6b')];return db[_0xb410('0x6c')][_0xb410('0x46')](_0x308bf2[_0xb410('0x2e')])['then'](respondWithResult(_0x392b03,0xc9))[_0xb410('0x3a')](handleError(_0x392b03,null));};exports[_0xb410('0x6d')]=function(_0x59e4c0,_0x19cc6d){return db[_0xb410('0x33')][_0xb410('0x49')]({'where':{'id':_0x59e4c0['params']['id']},'raw':!![]})[_0xb410('0x16')](handleEntityNotFound(_0x19cc6d,null))[_0xb410('0x16')](function(_0x1819a7){if(_0x1819a7){if(_0x1819a7[_0xb410('0x64')]){return _0x19cc6d[_0xb410('0x22')](0x193)[_0xb410('0x23')]({'status':0x193,'message':_0xb410('0x6e')});}return db['Attachment'][_0xb410('0x49')]({'where':{'id':_0x59e4c0[_0xb410('0x39')][_0xb410('0x6f')]},'raw':!![]})[_0xb410('0x16')](handleEntityNotFound(_0x19cc6d,null));}})[_0xb410('0x16')](function(_0x2780fa){if(_0x2780fa){var _0x51d00f=_0x2780fa[_0xb410('0x70')]!==null;var _0x5802c2=path['join'](config[_0xb410('0x71')],_0xb410('0x72'));if(_0x51d00f){_0x5802c2=path[_0xb410('0x73')](_0x5802c2,_0xb410('0x74'));}var _0x32a8e5=path[_0xb410('0x73')](_0x5802c2,_0x2780fa[_0xb410('0x68')]);return _0x19cc6d[_0xb410('0x75')](_0x32a8e5);}})[_0xb410('0x3a')](handleError(_0x19cc6d,null));};exports[_0xb410('0x76')]=function(_0x3c79e9,_0x331bab){var _0x476a1f=null;var _0x524f11=null;var _0x406512=null;if(_0x3c79e9[_0xb410('0x2e')]['id']){delete _0x3c79e9[_0xb410('0x2e')]['id'];}if(_0x3c79e9[_0xb410('0x2e')][_0xb410('0x77')]){_0x406512=path[_0xb410('0x73')](config[_0xb410('0x71')],_0xb410('0x78'),util[_0xb410('0x79')](_0xb410('0x7a'),Date['now']()));_0x3c79e9[_0xb410('0x2e')]['pathTranscript']=_0x406512;}return db[_0xb410('0x33')]['find']({'where':{'id':_0x3c79e9[_0xb410('0x3c')]['id']},'include':[{'model':db[_0xb410('0x5d')],'as':_0xb410('0x7b'),'include':[{'model':db['User'],'as':'User'}]}]})[_0xb410('0x16')](handleEntityNotFound(_0x331bab,null))[_0xb410('0x16')](saveUpdates(_0x3c79e9['body'],null))[_0xb410('0x16')](function(_0x44b57f){if(_0x44b57f){_0x476a1f=_0x44b57f;return db[_0xb410('0x4a')]['find']({'where':{'id':_0x476a1f[_0xb410('0x4b')]}});}})[_0xb410('0x16')](function(_0xead137){if(_0xead137){_0x524f11=_0xead137;return db[_0xb410('0x7c')][_0xb410('0x45')]({'where':{'id':_0x476a1f[_0xb410('0x7d')]}});}})[_0xb410('0x16')](function(_0xec0ddc){if(_0xec0ddc){if(_0x406512){var _0xdc8094=null;for(var _0x7c53ab=0x1;_0x7c53ab<_0x476a1f[_0xb410('0x7b')][_0xb410('0x42')];++_0x7c53ab){_0xdc8094=_0x476a1f[_0xb410('0x7b')][_0x7c53ab];var _0x1a4fc9=_0xdc8094[_0xb410('0x62')]?util[_0xb410('0x79')](_0xb410('0x7e'),_0x524f11['agentAlias'],_0xdc8094[_0xb410('0x62')]):'System';var _0x2d6abf=_0x3c79e9['body'][_0xb410('0x7f')]||util['format'](_0xb410('0x7e'),_0xb410('0x80'),_0xdc8094[_0xb410('0x7d')]);switch(_0x524f11[_0xb410('0x81')]){case _0xb410('0x82'):_0x1a4fc9=_0xdc8094['UserId']?util[_0xb410('0x79')](_0xb410('0x7e'),_0x524f11[_0xb410('0x83')],_0xdc8094[_0xb410('0x62')]):_0xb410('0x84');break;case'agent_alias':_0x1a4fc9=_0xdc8094['UserId']?_0xdc8094[_0xb410('0x85')][_0xb410('0x86')]||_0xdc8094[_0xb410('0x85')][_0xb410('0x50')]:_0xb410('0x84');break;case _0xb410('0x87'):_0x1a4fc9=_0xdc8094[_0xb410('0x62')]?_0xdc8094['User']['fullname']:_0xb410('0x84');break;default:_0x1a4fc9=_0xdc8094[_0xb410('0x62')]?util[_0xb410('0x79')]('%s%d',_0x524f11[_0xb410('0x83')],_0xdc8094[_0xb410('0x62')]):_0xb410('0x84');}var _0x26950c=util['format'](_0xb410('0x88'),moment(_0xdc8094[_0xb410('0x89')])[_0xb410('0x79')](_0xb410('0x8a')),_0xdc8094[_0xb410('0x8b')]==='in'?_0x2d6abf:_0x1a4fc9,_0xdc8094[_0xb410('0x2e')]);if(!_0xdc8094[_0xb410('0x8c')]){fs['appendFileSync'](_0x406512,_0x26950c);}}return db[_0xb410('0x8d')][_0xb410('0x49')]({'where':{'service':!![]},'include':[{'model':db[_0xb410('0x8e')],'as':_0xb410('0x8f'),'raw':!![],'include':[{'model':db[_0xb410('0x90')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x33b779){if(!_0x33b779||!_0x33b779[_0xb410('0x8f')]||!_0x3c79e9[_0xb410('0x2e')])return _0x476a1f;var _0x57dcff=_0x33b779['getSmtpOptions']();return respondWithRpcPromise(_0xb410('0x91'),_0xb410('0x92'),{'account':_0x57dcff,'message':{'from':util[_0xb410('0x79')](_0xb410('0x93'),_0x33b779['name'],_0x33b779[_0xb410('0x52')]||_0x33b779['Smtp']['user']),'to':_0x3c79e9[_0xb410('0x2e')][_0xb410('0x77')],'subject':_0xb410('0x94'),'text':util[_0xb410('0x79')](_0xb410('0x95'),_0x3c79e9[_0xb410('0x2e')][_0xb410('0x77')]),'attachments':[{'path':_0x406512}]}})['then'](function(){return _0x476a1f;})[_0xb410('0x3a')](function(_0x345173){logger[_0xb410('0x1c')](_0x345173);});})[_0xb410('0x16')](respondWithStatusCode(_0x331bab,0xc8))[_0xb410('0x3a')](handleError(_0x331bab,null));};exports['addMessage']=function(_0x1cd841,_0x3c2a91){return db[_0xb410('0x5d')][_0xb410('0x45')]({'where':{'id':_0x1cd841[_0xb410('0x3c')]['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x3c2a91,null))[_0xb410('0x16')](function(_0x1c57bc){if(_0x1c57bc){return _0x1c57bc[_0xb410('0x96')](_0x1cd841[_0xb410('0x2e')][_0xb410('0x97')],_['omit'](_0x1cd841[_0xb410('0x2e')],[_0xb410('0x97'),'id'])||{});}})[_0xb410('0x16')](respondWithResult(_0x3c2a91,null))[_0xb410('0x3a')](handleError(_0x3c2a91,null));};exports[_0xb410('0x98')]=function(_0x38daf2,_0x31c36f){var _0x4e5bc9={'raw':![],'where':{}};var _0x14b032={};var _0x19900c={'count':0x0,'rows':[]};return db[_0xb410('0x33')][_0xb410('0x49')]({'where':{'id':_0x38daf2[_0xb410('0x3c')]['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x31c36f,null))[_0xb410('0x16')](function(_0x2eeff6){if(_0x2eeff6){_0x14b032[_0xb410('0x3d')]=_[_0xb410('0x3e')](db['ChatMessage'][_0xb410('0x34')]);_0x14b032[_0xb410('0x39')]=_[_0xb410('0x3e')](_0x38daf2[_0xb410('0x39')]);_0x14b032[_0xb410('0x99')]=_['intersection'](_0x14b032[_0xb410('0x3d')],_0x14b032['query']);_0x4e5bc9[_0xb410('0x40')]=_[_0xb410('0x3f')](_0x14b032[_0xb410('0x3d')],qs[_0xb410('0x41')](_0x38daf2[_0xb410('0x39')][_0xb410('0x41')]));_0x4e5bc9['attributes']=_0x4e5bc9[_0xb410('0x40')][_0xb410('0x42')]?_0x4e5bc9[_0xb410('0x40')]:_0x14b032[_0xb410('0x3d')];if(!_0x38daf2[_0xb410('0x39')][_0xb410('0x9a')](_0xb410('0x9b'))){_0x4e5bc9[_0xb410('0x27')]=qs[_0xb410('0x27')](_0x38daf2[_0xb410('0x39')][_0xb410('0x27')]);_0x4e5bc9['offset']=qs[_0xb410('0x24')](_0x38daf2[_0xb410('0x39')][_0xb410('0x24')]);}_0x4e5bc9[_0xb410('0x9c')]=qs[_0xb410('0x9d')](_0x38daf2[_0xb410('0x39')][_0xb410('0x9d')]);_0x4e5bc9[_0xb410('0x9e')]=qs[_0xb410('0x99')](_[_0xb410('0x9f')](_0x38daf2[_0xb410('0x39')],_0x14b032['filters']));_0x4e5bc9[_0xb410('0x9e')][_0xb410('0xa0')]=_0x2eeff6['id'];if(_0x38daf2['query'][_0xb410('0xa1')]){_0x4e5bc9[_0xb410('0x9e')]=_[_0xb410('0x2d')](_0x4e5bc9[_0xb410('0x9e')],{'$or':_[_0xb410('0x32')](_0x4e5bc9[_0xb410('0x40')],function(_0x4e5ffa){var _0x5b2623={};_0x5b2623[_0x4e5ffa]={'$like':'%'+_0x38daf2['query'][_0xb410('0xa1')]+'%'};return _0x5b2623;})});}if(_0x38daf2[_0xb410('0x39')][_0xb410('0xa2')]){var _0x5926f4=_0x38daf2[_0xb410('0x39')]['$gte'][_0xb410('0xa3')](',');var _0x53c7cf={};_0x53c7cf[_0x5926f4[0x0]]={'$gte':moment(_0x5926f4[0x1])[_0xb410('0x79')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4e5bc9[_0xb410('0x9e')]=_['merge'](_0x4e5bc9[_0xb410('0x9e')],_0x53c7cf);}_0x4e5bc9=_[_0xb410('0x2d')]({},_0x4e5bc9,_0x38daf2[_0xb410('0x44')]);return db[_0xb410('0x5d')][_0xb410('0x26')]({'where':_0x4e5bc9[_0xb410('0x9e')]})[_0xb410('0x16')](function(_0x21e9b9){_0x19900c[_0xb410('0x26')]=_0x21e9b9;if(_0x38daf2['query']['includeAll']){_0x4e5bc9[_0xb410('0xa4')]=[{'all':!![]}];}return db[_0xb410('0x5d')][_0xb410('0x37')](_0x4e5bc9);})['then'](function(_0x13a84e){_0x19900c[_0xb410('0xa5')]=_0x13a84e;return _0x19900c;});}})[_0xb410('0x16')](respondWithFilteredResult(_0x31c36f,_0x4e5bc9))['catch'](handleError(_0x31c36f,null));};exports[_0xb410('0xa6')]=function(_0x5c9be7,_0x2184a){var _0x5f5ccf={'where':{}},_0x378a36={},_0x443325={'count':0x0,'rows':[]};return db[_0xb410('0x33')][_0xb410('0x49')]({'where':{'id':_0x5c9be7[_0xb410('0x3c')]['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x2184a,null))['then'](function(_0x14dd37){if(_0x14dd37){_0x378a36['model']=_[_0xb410('0x3e')](db['ChatMessage'][_0xb410('0x34')]);_0x378a36[_0xb410('0x39')]=_[_0xb410('0x3e')](_0x5c9be7['query']);_0x378a36[_0xb410('0x99')]=_[_0xb410('0x3f')](_0x378a36[_0xb410('0x3d')],_0x378a36['query']);_0x5f5ccf[_0xb410('0x40')]=_[_0xb410('0x3f')](_0x378a36['model'],qs['fields'](_0x5c9be7['query']['fields']));_0x5f5ccf['attributes']=_0x5f5ccf[_0xb410('0x40')][_0xb410('0x42')]?_0x5f5ccf[_0xb410('0x40')]:_0x378a36[_0xb410('0x3d')];if(!_0x5c9be7[_0xb410('0x39')][_0xb410('0x9a')](_0xb410('0x9b'))){_0x5f5ccf['limit']=qs['limit'](_0x5c9be7[_0xb410('0x39')][_0xb410('0x27')]);_0x5f5ccf[_0xb410('0x24')]=qs[_0xb410('0x24')](_0x5c9be7[_0xb410('0x39')][_0xb410('0x24')]);}_0x5f5ccf[_0xb410('0x9c')]=qs['sort'](_0x5c9be7[_0xb410('0x39')]['sort']);_0x5f5ccf['where']=qs[_0xb410('0x99')](_[_0xb410('0x9f')](_0x5c9be7[_0xb410('0x39')],_0x378a36['filters']));_0x5f5ccf[_0xb410('0x9e')]['ChatInteractionId']=_0x14dd37['id'];if(_0x5c9be7[_0xb410('0x39')][_0xb410('0xa1')]){_0x5f5ccf[_0xb410('0x9e')]=_[_0xb410('0x2d')](_0x5f5ccf['where'],{'$or':_['map'](_0x5f5ccf[_0xb410('0x40')],function(_0x4ca334){var _0x47047c={};_0x47047c[_0x4ca334]={'$like':'%'+_0x5c9be7[_0xb410('0x39')][_0xb410('0xa1')]+'%'};return _0x47047c;})});}_0x5f5ccf[_0xb410('0x9e')][_0xb410('0x8c')]=![];if(_0x5c9be7[_0xb410('0x39')]['id']){_0x5f5ccf[_0xb410('0x9e')]['id']={'$gt':_0x5c9be7[_0xb410('0x39')]['id']};}_0x5f5ccf=_[_0xb410('0x2d')]({},_0x5f5ccf,_0x5c9be7['options']);return db['ChatMessage'][_0xb410('0x26')]({'where':_0x5f5ccf[_0xb410('0x9e')]})[_0xb410('0x16')](function(_0xa39baa){_0x443325[_0xb410('0x26')]=_0xa39baa;_0x5f5ccf['include']=[];if(_0x5c9be7[_0xb410('0x39')][_0xb410('0xa7')]){_0x5f5ccf[_0xb410('0xa4')][_0xb410('0xa8')]({'model':db[_0xb410('0x85')],'as':_0xb410('0x85'),'attributes':['id',_0xb410('0x50'),_0xb410('0x86')]});}if(_0x5c9be7[_0xb410('0x39')]['includeAll']){_0x5f5ccf['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x5f5ccf);})[_0xb410('0x16')](function(_0x19f8dd){_0x443325[_0xb410('0xa5')]=_0x19f8dd;return _0x443325;});}})[_0xb410('0x16')](respondWithFilteredResult(_0x2184a,_0x5f5ccf))['catch'](handleError(_0x2184a,null));};exports[_0xb410('0xa9')]=function(_0x1fa983,_0x51f23e){return db[_0xb410('0x33')]['find']({'where':{'id':_0x1fa983[_0xb410('0x3c')]['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x51f23e,null))[_0xb410('0x16')](function(_0x569af3){if(_0x569af3){return _0x569af3[_0xb410('0xaa')](_0x1fa983[_0xb410('0x2e')][_0xb410('0x97')],_['omit'](_0x1fa983[_0xb410('0x2e')],['ids','id'])||{})['spread'](function(){return db[_0xb410('0xab')][_0xb410('0x37')]({'attributes':['id',_0xb410('0x2b'),_0xb410('0xac')],'where':{'id':_0x1fa983['body'][_0xb410('0x97')]}});})[_0xb410('0x16')](function(_0x228e2d){socket[_0xb410('0xad')](_0xb410('0xae'),{'id':Number(_0x1fa983['params']['id']),'tags':_0x228e2d||[]});return{'id':Number(_0x1fa983[_0xb410('0x3c')]['id']),'tags':_0x228e2d||[]};});}})['then'](respondWithResult(_0x51f23e,null))[_0xb410('0x3a')](handleError(_0x51f23e,null));};exports[_0xb410('0xaf')]=function(_0x543245,_0x944a64){return db[_0xb410('0x33')][_0xb410('0x45')]({'where':{'id':_0x543245[_0xb410('0x3c')]['id']}})[_0xb410('0x16')](handleEntityNotFound(_0x944a64,null))[_0xb410('0x16')](function(_0x3e10cd){if(_0x3e10cd){return _0x3e10cd['removeTags'](_0x543245['query']['ids']);}})[_0xb410('0x16')](respondWithStatusCode(_0x944a64,null))['catch'](handleError(_0x944a64,null));};exports['download']=function(_0x43b252,_0x2700a9){var _0x1ebe4e=moment()[_0xb410('0xb0')]()[_0xb410('0xb1')]();var _0x2d908e=path['join'](config['root'],_0xb410('0xb2'),_0xb410('0xb3'),'tmp');var _0x37a4b1=path[_0xb410('0x73')](config[_0xb410('0x71')],'server','files',_0xb410('0xb4'));var _0xe0905=path[_0xb410('0x73')](_0x2d908e,_0x1ebe4e);var _0x3d9adc=util[_0xb410('0x79')]('transcript-%d-%s.zip',_0x43b252['params']['id'],_0x1ebe4e);var _0x598354=path[_0xb410('0x73')](_0x2d908e,_0x3d9adc);var _0x4d313e=[];_0x4d313e[_0xb410('0xa8')]({'model':db[_0xb410('0x85')],'as':_0xb410('0x85'),'attributes':['id',_0xb410('0x50')],'raw':!![]});_0x4d313e['push']({'model':db['CmContact'],'as':_0xb410('0x5f'),'attributes':['id',_0xb410('0xb5'),_0xb410('0xb6')],'raw':!![]});if(_0x43b252[_0xb410('0x39')][_0xb410('0xb4')]){_0x4d313e[_0xb410('0xa8')]({'model':db[_0xb410('0x6c')],'as':'Attachment','raw':!![]});}var _0x789ff4=[{'model':db[_0xb410('0x5d')],'as':_0xb410('0x7b'),'attributes':['id',_0xb410('0x2e'),_0xb410('0x89'),_0xb410('0x8b'),'secret',_0xb410('0xb7')],'include':_0x4d313e}];_0x789ff4[_0xb410('0xa8')]({'model':db[_0xb410('0x4a')],'as':_0xb410('0xb8'),'attributes':['id',_0xb410('0x2b')]});_0x789ff4['push']({'model':db[_0xb410('0x85')],'as':_0xb410('0xb9'),'attributes':['id',_0xb410('0x50')]});return db[_0xb410('0x33')][_0xb410('0x45')]({'where':{'id':_0x43b252['params']['id']},'include':_0x789ff4})['then'](handleEntityNotFound(_0x2700a9,null))[_0xb410('0x16')](function(_0x2831c4){if(_0x2831c4){var _0x150d17=_0x2831c4[_0xb410('0xba')]({'plain':!![]});fs[_0xb410('0xbb')](_0xe0905);var _0x3b3d98={'channel':'Chat','account':_0x150d17[_0xb410('0xb8')]['name'],'agent':_0x150d17[_0xb410('0xb9')]?_0x150d17['Owner'][_0xb410('0x50')]:_0xb410('0xbc'),'createdAt':moment(_0x150d17[_0xb410('0x89')])[_0xb410('0x79')](_0xb410('0xbd'))[_0xb410('0xb1')](),'closedAt':_0x150d17[_0xb410('0x64')]?moment(_0x150d17[_0xb410('0xbe')])[_0xb410('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb410('0xb1')]():'','disposition':_0x150d17[_0xb410('0x65')],'chatInfo':{'browser':_0x150d17[_0xb410('0xbf')],'os':_0x150d17[_0xb410('0xc0')],'referer':_0x150d17['referer'],'customerIp':_0x150d17[_0xb410('0xc1')],'customerPort':_0x150d17[_0xb410('0xc2')]?_0x150d17['customerPort']:_0xb410('0xbc')},'messages':_(_0x150d17[_0xb410('0x7b')])[_0xb410('0xc3')]()[_0xb410('0xa1')]({'secret':![]})[_0xb410('0x32')](function(_0x403a30){if(_0x403a30[_0xb410('0x6c')]){var _0x3944d6=path[_0xb410('0x73')](_0x37a4b1,_0x403a30['Attachment'][_0xb410('0x68')]);if(fs[_0xb410('0xc4')](_0x3944d6)){fs[_0xb410('0xc5')](_0x3944d6)['pipe'](fs[_0xb410('0xc6')](path[_0xb410('0x73')](_0xe0905,_0x403a30[_0xb410('0x6c')][_0xb410('0x68')])));}}return{'date':moment(_0x403a30[_0xb410('0x89')])[_0xb410('0x79')](_0xb410('0xbd'))[_0xb410('0xb1')](),'sender':_0x403a30['direction']==='out'?_0x403a30[_0xb410('0x85')]?_0x403a30['User'][_0xb410('0x50')]:'System':_0x403a30[_0xb410('0x5f')][_0xb410('0xb5')]+(_0x403a30['Contact']['lastName']?'\x20'+_0x403a30[_0xb410('0x5f')][_0xb410('0xb6')]:''),'body':_0x403a30[_0xb410('0x6c')]?_0x403a30[_0xb410('0x6c')][_0xb410('0x68')]:_0x403a30[_0xb410('0x2e')],'direction':_0x403a30[_0xb410('0x8b')]===_0xb410('0x5c')?'A':'C','secret':_0x403a30[_0xb410('0x8c')],'read':_0x403a30['read'],'attachment':_0x403a30[_0xb410('0x6c')]};})[_0xb410('0xc7')]()};return ejs['renderFile'](path['join'](config[_0xb410('0x71')],_0xb410('0xb2'),_0xb410('0xc8'),'downloadInteraction.ejs'),{'interaction':_0x3b3d98})[_0xb410('0x16')](function(_0x1553ba){var _0x30d5bf=path['join'](_0xe0905,_0xb410('0xc9')+_0x150d17['id']+'-'+_0x1ebe4e+_0xb410('0xca'));var _0x44b89e={'path':_0x30d5bf,'channel':_0xb410('0xcb'),'interactionId':_0x150d17['id']};return pdf[_0xb410('0xcc')](_0x1553ba,_0x44b89e);})[_0xb410('0x16')](function(){return new Promise(function(_0x59c95f,_0x55b3b0){zipdir(_0xe0905,{'saveTo':_0x598354},function(_0x40f8bc,_0xcfc96d){if(_0x40f8bc)return _0x55b3b0(_0x40f8bc);return _0x59c95f(_0xcfc96d);});})['then'](function(){return new BPromise(function(_0x276c39,_0x4d74c3){rimraf(_0xe0905,function(_0x3523aa){if(_0x3523aa)_0x4d74c3(_0x3523aa);return _0x276c39();});});})[_0xb410('0x16')](function(){return _0x2700a9[_0xb410('0x75')](_0x598354,_0x3d9adc,function(_0x511b48){if(_0x511b48){logger['error'](_0xb410('0xcd'),_0x511b48);}else{fs[_0xb410('0xce')](_0x598354);}});});});}else{return _0x2700a9['sendStatus'](0xc8);}})[_0xb410('0x3a')](handleError(_0x2700a9,null));}; \ No newline at end of file +var _0xe1df=['body','agent','interaction','map','type','key','findAll','chat','query','user','params','model','keys','ChatInteraction','rawAttributes','attributes','intersection','fields','length','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','fullname','email','POST','vidaooApiKey','isNull','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','basename','file','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsiteId','ContactId','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','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','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','filters','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','User','addTags','spread','Tag','chatInteractionTags:save','unix','toString','files','tmp','server','attachments','transcript-%d-%s.zip','push','secret','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','Contact','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','zip-dir','request-promise','bluebird','mustache','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','render','merge'];(function(_0xbf19d7,_0x58b2bf){var _0x376e11=function(_0x5ab888){while(--_0x5ab888){_0xbf19d7['push'](_0xbf19d7['shift']());}};_0x376e11(++_0x58b2bf);}(_0xe1df,0x9a));var _0xfe1d=function(_0x394ed5,_0x28498a){_0x394ed5=_0x394ed5-0x0;var _0x57bd31=_0xe1df[_0x394ed5];return _0x57bd31;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xfe1d('0x0'));var rp=require(_0xfe1d('0x1'));var moment=require('moment');var BPromise=require(_0xfe1d('0x2'));var Mustache=require(_0xfe1d('0x3'));var util=require(_0xfe1d('0x4'));var path=require('path');var ejs=require(_0xfe1d('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xfe1d('0x6'));var interaction=require(_0xfe1d('0x7'));var qs=require(_0xfe1d('0x8'));var pdf=require(_0xfe1d('0x9'));var logger=require('../../config/logger')(_0xfe1d('0xa'));var config=require(_0xfe1d('0xb'));var db=require(_0xfe1d('0xc'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xfe1d('0xd'),'port':0x18eb});var socket=require(_0xfe1d('0xe'))(new Redis(config[_0xfe1d('0xf')]));require(_0xfe1d('0x10'))[_0xfe1d('0x11')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfe1d('0x12')]({'port':0x232b});var client9004=jayson['client'][_0xfe1d('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x6b6e3d,_0x58afdd,_0x3fa3a2,_0xbf083e){return new BPromise(function(_0x8a02a4,_0x4ad6d1){var _0x2ab84f=_0xbf083e||client;return _0x2ab84f[_0xfe1d('0x13')](_0x6b6e3d,_0x3fa3a2)['then'](function(_0x26c8f3){logger[_0xfe1d('0x14')](_0xfe1d('0x15'),_0x58afdd,_0xfe1d('0x16'));logger[_0xfe1d('0x17')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x58afdd,_0xfe1d('0x16'),JSON[_0xfe1d('0x18')](_0x26c8f3));if(_0x26c8f3[_0xfe1d('0x19')]){if(_0x26c8f3[_0xfe1d('0x19')][_0xfe1d('0x1a')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x58afdd,_0x26c8f3[_0xfe1d('0x19')][_0xfe1d('0x1b')]);return _0x4ad6d1(_0x26c8f3[_0xfe1d('0x19')][_0xfe1d('0x1b')]);}logger[_0xfe1d('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x58afdd,_0x26c8f3[_0xfe1d('0x19')]['message']);return _0x8a02a4(_0x26c8f3[_0xfe1d('0x19')][_0xfe1d('0x1b')]);}else{logger[_0xfe1d('0x14')](_0xfe1d('0x15'),_0x58afdd,'request\x20sent');_0x8a02a4(_0x26c8f3[_0xfe1d('0x1c')][_0xfe1d('0x1b')]);}})[_0xfe1d('0x1d')](function(_0x4df905){logger['error'](_0xfe1d('0x15'),_0x58afdd,_0x4df905);_0x4ad6d1(_0x4df905);});});}function respondWithStatusCode(_0x38f405,_0x4fb1ea){_0x4fb1ea=_0x4fb1ea||0xcc;return function(_0x25e228){if(_0x25e228){return _0x38f405[_0xfe1d('0x1e')](_0x4fb1ea);}return _0x38f405[_0xfe1d('0x1f')](_0x4fb1ea)[_0xfe1d('0x20')]();};}function respondWithResult(_0x4068e2,_0x3645c3){_0x3645c3=_0x3645c3||0xc8;return function(_0x57c649){if(_0x57c649){return _0x4068e2[_0xfe1d('0x1f')](_0x3645c3)[_0xfe1d('0x21')](_0x57c649);}};}function respondWithFilteredResult(_0x3c0034,_0x3c0e81){return function(_0x4a1605){if(_0x4a1605){var _0x395ab1=typeof _0x3c0e81[_0xfe1d('0x22')]===_0xfe1d('0x23')&&typeof _0x3c0e81[_0xfe1d('0x24')]===_0xfe1d('0x23');var _0x5c3bf7=_0x4a1605[_0xfe1d('0x25')];var _0x1a963d=_0x395ab1?0x0:_0x3c0e81[_0xfe1d('0x22')];var _0x333960=_0x395ab1?_0x4a1605[_0xfe1d('0x25')]:_0x3c0e81[_0xfe1d('0x22')]+_0x3c0e81[_0xfe1d('0x24')];var _0x296b89;if(_0x333960>=_0x5c3bf7){_0x333960=_0x5c3bf7;_0x296b89=0xc8;}else{_0x296b89=0xce;}_0x3c0034[_0xfe1d('0x1f')](_0x296b89);return _0x3c0034[_0xfe1d('0x26')](_0xfe1d('0x27'),_0x1a963d+'-'+_0x333960+'/'+_0x5c3bf7)[_0xfe1d('0x21')](_0x4a1605);}return null;};}function saveUpdates(_0x297834){return function(_0x595bc5){if(_0x595bc5){return _0x595bc5[_0xfe1d('0x28')](_0x297834)[_0xfe1d('0x29')](function(_0x5965fe){return _0x5965fe;});}return null;};}function removeEntity(_0x46b7e5){return function(_0xed5cbc){if(_0xed5cbc){return _0xed5cbc[_0xfe1d('0x2a')]()[_0xfe1d('0x29')](function(){_0x46b7e5[_0xfe1d('0x1f')](0xcc)[_0xfe1d('0x20')]();});}};}function handleEntityNotFound(_0x1361c4){return function(_0x64bb92){if(!_0x64bb92){_0x1361c4[_0xfe1d('0x1e')](0x194);}return _0x64bb92;};}function handleError(_0x56f803,_0x50476a){_0x50476a=_0x50476a||0x1f4;return function(_0x23d75e){logger['error'](_0x23d75e['stack']);if(_0x23d75e[_0xfe1d('0x2b')]){delete _0x23d75e[_0xfe1d('0x2b')];}_0x56f803[_0xfe1d('0x1f')](_0x50476a)[_0xfe1d('0x2c')](_0x23d75e);};}function getMustacheRender(_0x4d071d,_0x3ca760){return Mustache[_0xfe1d('0x2d')](_0x4d071d,_[_0xfe1d('0x2e')](_0x3ca760[_0xfe1d('0x2f')],{'contact':_0x3ca760['contact'],'message':_0x3ca760['message'],'agent':_0x3ca760[_0xfe1d('0x30')],'interaction':_0x3ca760[_0xfe1d('0x31')],'account':_0x3ca760['account']}))||'';}exports['index']=function(_0xedb9ba,_0x408d3f){var _0x45291f={};var _0x588979=_[_0xfe1d('0x32')](db['ChatInteraction']['rawAttributes'],function(_0x26fc25){return{'name':_0x26fc25['fieldName'],'type':_0x26fc25[_0xfe1d('0x33')][_0xfe1d('0x34')]};});_0x45291f=qs['getOptions'](_0x588979,_0xedb9ba);return interaction[_0xfe1d('0x35')](_0xfe1d('0x36'),_0xedb9ba[_0xfe1d('0x37')],_0xedb9ba[_0xfe1d('0x38')],_0x45291f,_0x588979)[_0xfe1d('0x29')](respondWithFilteredResult(_0x408d3f,_0x45291f))['catch'](handleError(_0x408d3f,null));};exports['show']=function(_0x31fe89,_0x5dfd72){var _0x4209ec={'raw':![],'where':{'id':_0x31fe89[_0xfe1d('0x39')]['id']}},_0x39efaf={};_0x39efaf[_0xfe1d('0x3a')]=_[_0xfe1d('0x3b')](db[_0xfe1d('0x3c')][_0xfe1d('0x3d')]);_0x39efaf[_0xfe1d('0x37')]=_[_0xfe1d('0x3b')](_0x31fe89['query']);_0x39efaf['filters']=_['intersection'](_0x39efaf[_0xfe1d('0x3a')],_0x39efaf[_0xfe1d('0x37')]);_0x4209ec[_0xfe1d('0x3e')]=_[_0xfe1d('0x3f')](_0x39efaf[_0xfe1d('0x3a')],qs[_0xfe1d('0x40')](_0x31fe89[_0xfe1d('0x37')][_0xfe1d('0x40')]));_0x4209ec[_0xfe1d('0x3e')]=_0x4209ec[_0xfe1d('0x3e')][_0xfe1d('0x41')]?_0x4209ec['attributes']:_0x39efaf[_0xfe1d('0x3a')];if(_0x31fe89[_0xfe1d('0x37')]['includeAll']){_0x4209ec[_0xfe1d('0x42')]=[{'all':!![]}];}_0x4209ec=_[_0xfe1d('0x2e')]({},_0x4209ec,_0x31fe89[_0xfe1d('0x43')]);return db[_0xfe1d('0x3c')]['find'](_0x4209ec)[_0xfe1d('0x29')](handleEntityNotFound(_0x5dfd72,null))[_0xfe1d('0x29')](respondWithResult(_0x5dfd72,null))['catch'](handleError(_0x5dfd72,null));};exports['create']=function(_0x579b32,_0xb6fa65){return db[_0xfe1d('0x3c')][_0xfe1d('0x44')](_0x579b32[_0xfe1d('0x2f')],{})['then'](respondWithResult(_0xb6fa65,0xc9))[_0xfe1d('0x1d')](handleError(_0xb6fa65,null));};exports[_0xfe1d('0x28')]=function(_0x247f41,_0x386ac6){if(_0x247f41['body']['id']){delete _0x247f41[_0xfe1d('0x2f')]['id'];}return db[_0xfe1d('0x3c')][_0xfe1d('0x45')]({'where':{'id':_0x247f41[_0xfe1d('0x39')]['id']}})['then'](handleEntityNotFound(_0x386ac6,null))['then'](saveUpdates(_0x247f41[_0xfe1d('0x2f')],null))['then'](respondWithResult(_0x386ac6,null))['catch'](handleError(_0x386ac6,null));};exports[_0xfe1d('0x2a')]=function(_0x2a4426,_0x14baff){return db[_0xfe1d('0x3c')]['find']({'where':{'id':_0x2a4426[_0xfe1d('0x39')]['id']}})['then'](handleEntityNotFound(_0x14baff,null))[_0xfe1d('0x29')](removeEntity(_0x14baff,null))[_0xfe1d('0x1d')](handleError(_0x14baff,null));};exports[_0xfe1d('0x46')]=function(_0x58e457,_0x17ba5b){return db[_0xfe1d('0x3c')][_0xfe1d('0x46')]()['then'](respondWithResult(_0x17ba5b,null))['catch'](handleError(_0x17ba5b,null));};exports[_0xfe1d('0x47')]=function(_0x158366,_0x475768){var _0x50e4ee=_0x158366[_0xfe1d('0x39')]['id'];var _0xb8a6f0;var _0x3e630d;var _0x1620e2;return db[_0xfe1d('0x3c')][_0xfe1d('0x48')]({'where':{'id':_0x50e4ee}})['then'](function(_0x11fada){_0xb8a6f0=_0x11fada;return db[_0xfe1d('0x49')]['findOne']({'where':{'id':_0x11fada['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xfe1d('0x4a'),_0xfe1d('0x4b'),_0xfe1d('0x4c'),'vidaooMetadata'],'raw':!![]});})[_0xfe1d('0x29')](function(_0x33f2b5){if(_0x33f2b5&&_0x33f2b5['vidaooApiKey']&&_0x33f2b5[_0xfe1d('0x4a')]){_0x3e630d=_0x33f2b5;var _0x4ad703={'interaction':{'id':_0x50e4ee},'agent':{'id':_0x158366[_0xfe1d('0x38')]['id'],'name':_0x158366[_0xfe1d('0x38')][_0xfe1d('0x2b')],'fullname':_0x158366[_0xfe1d('0x38')][_0xfe1d('0x4d')],'email':_0x158366[_0xfe1d('0x38')][_0xfe1d('0x4e')]},'contact':_0x158366[_0xfe1d('0x2f')]['contact'],'account':_0x158366[_0xfe1d('0x2f')]['account']};var _0x4dc1ab={'rejectUnauthorized':![],'method':_0xfe1d('0x4f'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x33f2b5[_0xfe1d('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x158366[_0xfe1d('0x38')]['email']],'buttons':null,'topic':_0x3e630d[_0xfe1d('0x4b')],'note':_[_0xfe1d('0x51')](_0x3e630d[_0xfe1d('0x4c')])?null:getMustacheRender(_0x3e630d['vidaooNote'],_0x4ad703),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x3e630d['vidaooMetadata'])){var _0x364b84=getMustacheRender(_0x3e630d['vidaooMetadata'],_0x4ad703);var _0x48a4ab=JSON[_0xfe1d('0x52')](_0x364b84);_0x4dc1ab[_0xfe1d('0x2f')]['metadata']=_0x48a4ab;}}catch(_0x218c54){throw new db[(_0xfe1d('0x53'))][(_0xfe1d('0x54'))](_0xfe1d('0x55'));}return rp(_0x4dc1ab);}else{throw new db[(_0xfe1d('0x53'))][(_0xfe1d('0x54'))](_0xfe1d('0x56'));}})[_0xfe1d('0x29')](function(_0x50ecdd){_0x1620e2=_0x50ecdd;if(_0x1620e2['id']){var _0x2209c4={'body':_0x1620e2[_0xfe1d('0x57')],'ChatWebsiteId':_0x3e630d['id'],'ChatInteractionId':_0xb8a6f0['id'],'direction':_0xfe1d('0x58'),'UserId':_0x158366[_0xfe1d('0x38')]['id']};return db[_0xfe1d('0x59')][_0xfe1d('0x44')](_0x2209c4,{});}else{throw new db['Sequelize'][(_0xfe1d('0x54'))](_0xfe1d('0x5a'));}})[_0xfe1d('0x29')](function(){return _0xb8a6f0[_0xfe1d('0x5b')]({'vidaooSessionId':_0x1620e2['id']});})[_0xfe1d('0x29')](respondWithResult(_0x475768,null))[_0xfe1d('0x1d')](handleError(_0x475768,null));};exports[_0xfe1d('0x5c')]=function(_0x90daec,_0xdade11){if(_0x90daec[_0xfe1d('0x2f')]['id']){delete _0x90daec[_0xfe1d('0x2f')]['id'];}return db[_0xfe1d('0x3c')][_0xfe1d('0x45')]({'where':{'id':_0x90daec['params']['id']},'include':[{'model':db[_0xfe1d('0x5d')],'as':'Contact'}]})['then'](handleEntityNotFound(_0xdade11,null))['then'](saveUpdates(_0x90daec[_0xfe1d('0x2f')],null))[_0xfe1d('0x29')](respondWithResult(_0xdade11,null))[_0xfe1d('0x1d')](handleError(_0xdade11,null));};exports[_0xfe1d('0x5e')]=function(_0x3de5dd,_0x27aa3e){if(_0x3de5dd[_0xfe1d('0x2f')]['id']){delete _0x3de5dd[_0xfe1d('0x2f')]['id'];}return db[_0xfe1d('0x3c')][_0xfe1d('0x45')]({'where':{'id':_0x3de5dd[_0xfe1d('0x39')]['id']}})[_0xfe1d('0x29')](function(_0x21d365){if(!_0x21d365){logger[_0xfe1d('0x19')](_0xfe1d('0x5f'),_0xfe1d('0x5e'),0x194,_0xfe1d('0x60'));_0x27aa3e['sendStatus'](0x194);}else{if(_0x21d365[_0xfe1d('0x61')]){throw new db[(_0xfe1d('0x53'))][(_0xfe1d('0x54'))](_0xfe1d('0x62'));}}return _0x21d365;})[_0xfe1d('0x29')](function(_0x1777ec){if(_0x1777ec){return _0x1777ec[_0xfe1d('0x28')]({'closed':_0x3de5dd[_0xfe1d('0x2f')][_0xfe1d('0x63')],'disposition':_0x3de5dd[_0xfe1d('0x2f')][_0xfe1d('0x64')]})[_0xfe1d('0x29')](function(_0x556000){return _0x556000;});}})['then'](function(){return respondWithRpcPromise(_0xfe1d('0x65'),'abandon',_0x3de5dd[_0xfe1d('0x2f')],client9004);})['then'](respondWithResult(_0x27aa3e,null))[_0xfe1d('0x1d')](handleError(_0x27aa3e,null));};exports[_0xfe1d('0x66')]=function(_0x544bba,_0x5eed92){_0x544bba[_0xfe1d('0x2f')][_0xfe1d('0x2b')]=_0x544bba['file']['originalname'];_0x544bba['body'][_0xfe1d('0x67')]=_0x544bba[_0xfe1d('0x68')][_0xfe1d('0x69')];_0x544bba[_0xfe1d('0x2f')][_0xfe1d('0x33')]=_0x544bba[_0xfe1d('0x68')]['mimetype'];return db[_0xfe1d('0x6a')][_0xfe1d('0x44')](_0x544bba['body'])[_0xfe1d('0x29')](respondWithResult(_0x5eed92,0xc9))[_0xfe1d('0x1d')](handleError(_0x5eed92,null));};exports[_0xfe1d('0x6b')]=function(_0x1b602e,_0x5f99a3){return db['ChatInteraction'][_0xfe1d('0x48')]({'where':{'id':_0x1b602e[_0xfe1d('0x39')]['id']},'raw':!![]})[_0xfe1d('0x29')](handleEntityNotFound(_0x5f99a3,null))['then'](function(_0x2baacc){if(_0x2baacc){if(_0x2baacc['closed']){return _0x5f99a3[_0xfe1d('0x1f')](0x193)['json']({'status':0x193,'message':_0xfe1d('0x6c')});}return db['Attachment'][_0xfe1d('0x48')]({'where':{'id':_0x1b602e[_0xfe1d('0x37')][_0xfe1d('0x6d')]},'raw':!![]})['then'](handleEntityNotFound(_0x5f99a3,null));}})[_0xfe1d('0x29')](function(_0x7afa1e){if(_0x7afa1e){var _0x59a54f=_0x7afa1e[_0xfe1d('0x6e')]!==null;var _0x528e66=path[_0xfe1d('0x6f')](config[_0xfe1d('0x70')],_0xfe1d('0x71'));if(_0x59a54f){_0x528e66=path[_0xfe1d('0x6f')](_0x528e66,_0xfe1d('0x72'));}var _0x45160b=path[_0xfe1d('0x6f')](_0x528e66,_0x7afa1e[_0xfe1d('0x67')]);return _0x5f99a3[_0xfe1d('0x73')](_0x45160b);}})[_0xfe1d('0x1d')](handleError(_0x5f99a3,null));};exports[_0xfe1d('0x74')]=function(_0x1c78ee,_0x504003){var _0x2ca461=null;var _0x5f2e89=null;var _0x5d0f5d=null;if(_0x1c78ee['body']['id']){delete _0x1c78ee[_0xfe1d('0x2f')]['id'];}if(_0x1c78ee[_0xfe1d('0x2f')]['mailTranscript']){_0x5d0f5d=path[_0xfe1d('0x6f')](config[_0xfe1d('0x70')],'server/files/chat/upload/',util[_0xfe1d('0x75')](_0xfe1d('0x76'),Date[_0xfe1d('0x77')]()));_0x1c78ee['body'][_0xfe1d('0x78')]=_0x5d0f5d;}return db[_0xfe1d('0x3c')][_0xfe1d('0x45')]({'where':{'id':_0x1c78ee['params']['id']},'include':[{'model':db[_0xfe1d('0x59')],'as':_0xfe1d('0x79'),'include':[{'model':db['User'],'as':'User'}]}]})[_0xfe1d('0x29')](handleEntityNotFound(_0x504003,null))[_0xfe1d('0x29')](saveUpdates(_0x1c78ee[_0xfe1d('0x2f')],null))['then'](function(_0x3b27bd){if(_0x3b27bd){_0x2ca461=_0x3b27bd;return db[_0xfe1d('0x49')][_0xfe1d('0x45')]({'where':{'id':_0x2ca461[_0xfe1d('0x7a')]}});}})[_0xfe1d('0x29')](function(_0x164e36){if(_0x164e36){_0x5f2e89=_0x164e36;return db[_0xfe1d('0x5d')][_0xfe1d('0x45')]({'where':{'id':_0x2ca461[_0xfe1d('0x7b')]}});}})[_0xfe1d('0x29')](function(_0x4aa599){if(_0x4aa599){if(_0x5d0f5d){var _0x59e562=null;for(var _0x4a7733=0x1;_0x4a7733<_0x2ca461[_0xfe1d('0x79')][_0xfe1d('0x41')];++_0x4a7733){_0x59e562=_0x2ca461[_0xfe1d('0x79')][_0x4a7733];var _0x257269=_0x59e562[_0xfe1d('0x61')]?util[_0xfe1d('0x75')](_0xfe1d('0x7c'),_0x5f2e89[_0xfe1d('0x7d')],_0x59e562[_0xfe1d('0x61')]):_0xfe1d('0x7e');var _0xee97bc=_0x1c78ee[_0xfe1d('0x2f')][_0xfe1d('0x7f')]||util[_0xfe1d('0x75')](_0xfe1d('0x7c'),_0xfe1d('0x80'),_0x59e562['ContactId']);switch(_0x5f2e89['agentIdentifier']){case _0xfe1d('0x81'):_0x257269=_0x59e562[_0xfe1d('0x61')]?util[_0xfe1d('0x75')](_0xfe1d('0x7c'),_0x5f2e89[_0xfe1d('0x7d')],_0x59e562['UserId']):'System';break;case _0xfe1d('0x82'):_0x257269=_0x59e562[_0xfe1d('0x61')]?_0x59e562['User'][_0xfe1d('0x83')]||_0x59e562['User'][_0xfe1d('0x4d')]:_0xfe1d('0x7e');break;case'agent_fullname':_0x257269=_0x59e562[_0xfe1d('0x61')]?_0x59e562['User'][_0xfe1d('0x4d')]:_0xfe1d('0x7e');break;default:_0x257269=_0x59e562[_0xfe1d('0x61')]?util[_0xfe1d('0x75')](_0xfe1d('0x7c'),_0x5f2e89['agentAlias'],_0x59e562['UserId']):'System';}var _0xbe95d0=util[_0xfe1d('0x75')]('[%s]\x20%s:\x20%s\x0a',moment(_0x59e562[_0xfe1d('0x84')])['format'](_0xfe1d('0x85')),_0x59e562['direction']==='in'?_0xee97bc:_0x257269,_0x59e562[_0xfe1d('0x2f')]);if(!_0x59e562['secret']){fs[_0xfe1d('0x86')](_0x5d0f5d,_0xbe95d0);}}return db[_0xfe1d('0x87')][_0xfe1d('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0xfe1d('0x88')],'as':_0xfe1d('0x89'),'raw':!![],'include':[{'model':db[_0xfe1d('0x8a')],'as':_0xfe1d('0x8a'),'raw':!![]}]}]});}}})[_0xfe1d('0x29')](function(_0x4f3c0a){if(!_0x4f3c0a||!_0x4f3c0a['Smtp']||!_0x1c78ee[_0xfe1d('0x2f')])return _0x2ca461;var _0x3d8ce7=_0x4f3c0a[_0xfe1d('0x8b')]();return respondWithRpcPromise(_0xfe1d('0x8c'),_0xfe1d('0x8d'),{'account':_0x3d8ce7,'message':{'from':util[_0xfe1d('0x75')](_0xfe1d('0x8e'),_0x4f3c0a['name'],_0x4f3c0a[_0xfe1d('0x4e')]||_0x4f3c0a[_0xfe1d('0x89')]['user']),'to':_0x1c78ee[_0xfe1d('0x2f')]['mailTranscript'],'subject':_0xfe1d('0x8f'),'text':util[_0xfe1d('0x75')](_0xfe1d('0x90'),_0x1c78ee[_0xfe1d('0x2f')]['mailTranscript']),'attachments':[{'path':_0x5d0f5d}]}})['then'](function(){return _0x2ca461;})[_0xfe1d('0x1d')](function(_0x267952){logger[_0xfe1d('0x19')](_0x267952);});})[_0xfe1d('0x29')](respondWithStatusCode(_0x504003,0xc8))['catch'](handleError(_0x504003,null));};exports[_0xfe1d('0x91')]=function(_0x38875c,_0x2ea4ed){return db['ChatMessage']['find']({'where':{'id':_0x38875c[_0xfe1d('0x39')]['id']}})[_0xfe1d('0x29')](handleEntityNotFound(_0x2ea4ed,null))[_0xfe1d('0x29')](function(_0x242f0d){if(_0x242f0d){return _0x242f0d[_0xfe1d('0x91')](_0x38875c[_0xfe1d('0x2f')][_0xfe1d('0x92')],_[_0xfe1d('0x93')](_0x38875c[_0xfe1d('0x2f')],[_0xfe1d('0x92'),'id'])||{});}})[_0xfe1d('0x29')](respondWithResult(_0x2ea4ed,null))[_0xfe1d('0x1d')](handleError(_0x2ea4ed,null));};exports[_0xfe1d('0x94')]=function(_0x52f195,_0x599aa5){var _0x3531dd={'raw':![],'where':{}};var _0x25db7d={};var _0x54b88a={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x52f195['params']['id']}})['then'](handleEntityNotFound(_0x599aa5,null))[_0xfe1d('0x29')](function(_0x4df417){if(_0x4df417){_0x25db7d[_0xfe1d('0x3a')]=_[_0xfe1d('0x3b')](db[_0xfe1d('0x59')]['rawAttributes']);_0x25db7d['query']=_[_0xfe1d('0x3b')](_0x52f195[_0xfe1d('0x37')]);_0x25db7d['filters']=_['intersection'](_0x25db7d['model'],_0x25db7d[_0xfe1d('0x37')]);_0x3531dd['attributes']=_[_0xfe1d('0x3f')](_0x25db7d[_0xfe1d('0x3a')],qs['fields'](_0x52f195[_0xfe1d('0x37')]['fields']));_0x3531dd[_0xfe1d('0x3e')]=_0x3531dd['attributes'][_0xfe1d('0x41')]?_0x3531dd[_0xfe1d('0x3e')]:_0x25db7d[_0xfe1d('0x3a')];if(!_0x52f195[_0xfe1d('0x37')][_0xfe1d('0x95')](_0xfe1d('0x96'))){_0x3531dd['limit']=qs['limit'](_0x52f195[_0xfe1d('0x37')][_0xfe1d('0x24')]);_0x3531dd['offset']=qs['offset'](_0x52f195[_0xfe1d('0x37')][_0xfe1d('0x22')]);}_0x3531dd[_0xfe1d('0x97')]=qs[_0xfe1d('0x98')](_0x52f195[_0xfe1d('0x37')][_0xfe1d('0x98')]);_0x3531dd[_0xfe1d('0x99')]=qs[_0xfe1d('0x9a')](_[_0xfe1d('0x9b')](_0x52f195[_0xfe1d('0x37')],_0x25db7d[_0xfe1d('0x9a')]));_0x3531dd['where'][_0xfe1d('0x9c')]=_0x4df417['id'];if(_0x52f195[_0xfe1d('0x37')][_0xfe1d('0x9d')]){_0x3531dd[_0xfe1d('0x99')]=_[_0xfe1d('0x2e')](_0x3531dd[_0xfe1d('0x99')],{'$or':_['map'](_0x3531dd[_0xfe1d('0x3e')],function(_0x26661d){var _0x1c563e={};_0x1c563e[_0x26661d]={'$like':'%'+_0x52f195[_0xfe1d('0x37')]['filter']+'%'};return _0x1c563e;})});}if(_0x52f195['query'][_0xfe1d('0x9e')]){var _0x46ba69=_0x52f195[_0xfe1d('0x37')][_0xfe1d('0x9e')][_0xfe1d('0x9f')](',');var _0x2135ee={};_0x2135ee[_0x46ba69[0x0]]={'$gte':moment(_0x46ba69[0x1])[_0xfe1d('0x75')](_0xfe1d('0xa0'))};_0x3531dd[_0xfe1d('0x99')]=_[_0xfe1d('0x2e')](_0x3531dd[_0xfe1d('0x99')],_0x2135ee);}_0x3531dd=_['merge']({},_0x3531dd,_0x52f195['options']);return db['ChatMessage'][_0xfe1d('0x25')]({'where':_0x3531dd['where']})[_0xfe1d('0x29')](function(_0x11281c){_0x54b88a[_0xfe1d('0x25')]=_0x11281c;if(_0x52f195[_0xfe1d('0x37')][_0xfe1d('0xa1')]){_0x3531dd[_0xfe1d('0x42')]=[{'all':!![]}];}return db['ChatMessage'][_0xfe1d('0x35')](_0x3531dd);})[_0xfe1d('0x29')](function(_0x3f3499){_0x54b88a[_0xfe1d('0xa2')]=_0x3f3499;return _0x54b88a;});}})[_0xfe1d('0x29')](respondWithFilteredResult(_0x599aa5,_0x3531dd))[_0xfe1d('0x1d')](handleError(_0x599aa5,null));};exports[_0xfe1d('0xa3')]=function(_0x15fcb4,_0x4991c7){var _0xf31b1e={'where':{}},_0x345819={},_0x491412={'count':0x0,'rows':[]};return db[_0xfe1d('0x3c')][_0xfe1d('0x48')]({'where':{'id':_0x15fcb4[_0xfe1d('0x39')]['id']}})[_0xfe1d('0x29')](handleEntityNotFound(_0x4991c7,null))[_0xfe1d('0x29')](function(_0x20f90e){if(_0x20f90e){_0x345819[_0xfe1d('0x3a')]=_[_0xfe1d('0x3b')](db[_0xfe1d('0x59')][_0xfe1d('0x3d')]);_0x345819['query']=_['keys'](_0x15fcb4[_0xfe1d('0x37')]);_0x345819[_0xfe1d('0x9a')]=_['intersection'](_0x345819[_0xfe1d('0x3a')],_0x345819[_0xfe1d('0x37')]);_0xf31b1e['attributes']=_['intersection'](_0x345819[_0xfe1d('0x3a')],qs[_0xfe1d('0x40')](_0x15fcb4[_0xfe1d('0x37')][_0xfe1d('0x40')]));_0xf31b1e['attributes']=_0xf31b1e[_0xfe1d('0x3e')][_0xfe1d('0x41')]?_0xf31b1e[_0xfe1d('0x3e')]:_0x345819[_0xfe1d('0x3a')];if(!_0x15fcb4['query'][_0xfe1d('0x95')]('nolimit')){_0xf31b1e['limit']=qs['limit'](_0x15fcb4[_0xfe1d('0x37')][_0xfe1d('0x24')]);_0xf31b1e['offset']=qs['offset'](_0x15fcb4[_0xfe1d('0x37')][_0xfe1d('0x22')]);}_0xf31b1e[_0xfe1d('0x97')]=qs[_0xfe1d('0x98')](_0x15fcb4['query'][_0xfe1d('0x98')]);_0xf31b1e[_0xfe1d('0x99')]=qs['filters'](_[_0xfe1d('0x9b')](_0x15fcb4[_0xfe1d('0x37')],_0x345819['filters']));_0xf31b1e[_0xfe1d('0x99')][_0xfe1d('0x9c')]=_0x20f90e['id'];if(_0x15fcb4[_0xfe1d('0x37')][_0xfe1d('0x9d')]){_0xf31b1e[_0xfe1d('0x99')]=_[_0xfe1d('0x2e')](_0xf31b1e['where'],{'$or':_[_0xfe1d('0x32')](_0xf31b1e[_0xfe1d('0x3e')],function(_0x25c7a1){var _0x4c9611={};_0x4c9611[_0x25c7a1]={'$like':'%'+_0x15fcb4[_0xfe1d('0x37')][_0xfe1d('0x9d')]+'%'};return _0x4c9611;})});}_0xf31b1e[_0xfe1d('0x99')]['secret']=![];if(_0x15fcb4[_0xfe1d('0x37')]['id']){_0xf31b1e[_0xfe1d('0x99')]['id']={'$gt':_0x15fcb4[_0xfe1d('0x37')]['id']};}_0xf31b1e=_['merge']({},_0xf31b1e,_0x15fcb4[_0xfe1d('0x43')]);return db[_0xfe1d('0x59')][_0xfe1d('0x25')]({'where':_0xf31b1e[_0xfe1d('0x99')]})[_0xfe1d('0x29')](function(_0x89088d){_0x491412['count']=_0x89088d;_0xf31b1e['include']=[];if(_0x15fcb4[_0xfe1d('0x37')]['includeAgent']){_0xf31b1e[_0xfe1d('0x42')]['push']({'model':db[_0xfe1d('0xa4')],'as':_0xfe1d('0xa4'),'attributes':['id',_0xfe1d('0x4d'),_0xfe1d('0x83')]});}if(_0x15fcb4[_0xfe1d('0x37')][_0xfe1d('0xa1')]){_0xf31b1e[_0xfe1d('0x42')]=[{'all':!![]}];}return db[_0xfe1d('0x59')][_0xfe1d('0x35')](_0xf31b1e);})[_0xfe1d('0x29')](function(_0x2e9951){_0x491412[_0xfe1d('0xa2')]=_0x2e9951;return _0x491412;});}})[_0xfe1d('0x29')](respondWithFilteredResult(_0x4991c7,_0xf31b1e))[_0xfe1d('0x1d')](handleError(_0x4991c7,null));};exports[_0xfe1d('0xa5')]=function(_0x2e8080,_0x51e4e2){return db[_0xfe1d('0x3c')][_0xfe1d('0x45')]({'where':{'id':_0x2e8080[_0xfe1d('0x39')]['id']}})[_0xfe1d('0x29')](handleEntityNotFound(_0x51e4e2,null))[_0xfe1d('0x29')](function(_0x43965c){if(_0x43965c){return _0x43965c['setTags'](_0x2e8080[_0xfe1d('0x2f')]['ids'],_['omit'](_0x2e8080[_0xfe1d('0x2f')],[_0xfe1d('0x92'),'id'])||{})[_0xfe1d('0xa6')](function(){return db[_0xfe1d('0xa7')]['findAll']({'attributes':['id',_0xfe1d('0x2b'),'color'],'where':{'id':_0x2e8080[_0xfe1d('0x2f')][_0xfe1d('0x92')]}});})['then'](function(_0x3ec1b2){socket['emit'](_0xfe1d('0xa8'),{'id':Number(_0x2e8080[_0xfe1d('0x39')]['id']),'tags':_0x3ec1b2||[]});return{'id':Number(_0x2e8080['params']['id']),'tags':_0x3ec1b2||[]};});}})[_0xfe1d('0x29')](respondWithResult(_0x51e4e2,null))['catch'](handleError(_0x51e4e2,null));};exports['removeTags']=function(_0x35aee7,_0x4326c2){return db['ChatInteraction']['find']({'where':{'id':_0x35aee7[_0xfe1d('0x39')]['id']}})['then'](handleEntityNotFound(_0x4326c2,null))[_0xfe1d('0x29')](function(_0x4cf15f){if(_0x4cf15f){return _0x4cf15f['removeTags'](_0x35aee7[_0xfe1d('0x37')][_0xfe1d('0x92')]);}})[_0xfe1d('0x29')](respondWithStatusCode(_0x4326c2,null))[_0xfe1d('0x1d')](handleError(_0x4326c2,null));};exports['download']=function(_0x38be36,_0xd49a8d){var _0x203ba9=moment()[_0xfe1d('0xa9')]()[_0xfe1d('0xaa')]();var _0x14fbec=path['join'](config['root'],'server',_0xfe1d('0xab'),_0xfe1d('0xac'));var _0x1d1b75=path[_0xfe1d('0x6f')](config[_0xfe1d('0x70')],_0xfe1d('0xad'),'files',_0xfe1d('0xae'));var _0x2c3023=path[_0xfe1d('0x6f')](_0x14fbec,_0x203ba9);var _0x12f99b=util[_0xfe1d('0x75')](_0xfe1d('0xaf'),_0x38be36['params']['id'],_0x203ba9);var _0x485432=path[_0xfe1d('0x6f')](_0x14fbec,_0x12f99b);var _0x1015e7=[];_0x1015e7['push']({'model':db[_0xfe1d('0xa4')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1015e7['push']({'model':db[_0xfe1d('0x5d')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x38be36[_0xfe1d('0x37')][_0xfe1d('0xae')]){_0x1015e7[_0xfe1d('0xb0')]({'model':db['Attachment'],'as':_0xfe1d('0x6a'),'raw':!![]});}var _0x1e7759=[{'model':db[_0xfe1d('0x59')],'as':'Messages','attributes':['id',_0xfe1d('0x2f'),'createdAt','direction',_0xfe1d('0xb1'),_0xfe1d('0xb2')],'include':_0x1015e7}];_0x1e7759[_0xfe1d('0xb0')]({'model':db[_0xfe1d('0x49')],'as':_0xfe1d('0xb3'),'attributes':['id','name']});_0x1e7759[_0xfe1d('0xb0')]({'model':db[_0xfe1d('0xa4')],'as':_0xfe1d('0xb4'),'attributes':['id',_0xfe1d('0x4d')]});return db['ChatInteraction'][_0xfe1d('0x45')]({'where':{'id':_0x38be36[_0xfe1d('0x39')]['id']},'include':_0x1e7759})[_0xfe1d('0x29')](handleEntityNotFound(_0xd49a8d,null))[_0xfe1d('0x29')](function(_0x2da2bc){if(_0x2da2bc){var _0x14447f=_0x2da2bc['get']({'plain':!![]});fs[_0xfe1d('0xb5')](_0x2c3023);var _0x5bddfd={'channel':_0xfe1d('0xb6'),'account':_0x14447f[_0xfe1d('0xb3')][_0xfe1d('0x2b')],'agent':_0x14447f[_0xfe1d('0xb4')]?_0x14447f[_0xfe1d('0xb4')][_0xfe1d('0x4d')]:_0xfe1d('0xb7'),'createdAt':moment(_0x14447f['createdAt'])[_0xfe1d('0x75')](_0xfe1d('0xa0'))[_0xfe1d('0xaa')](),'closedAt':_0x14447f['closed']?moment(_0x14447f[_0xfe1d('0xb8')])[_0xfe1d('0x75')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x14447f[_0xfe1d('0x64')],'chatInfo':{'browser':_0x14447f[_0xfe1d('0xb9')],'os':_0x14447f['osName'],'referer':_0x14447f['referer'],'customerIp':_0x14447f[_0xfe1d('0xba')],'customerPort':_0x14447f[_0xfe1d('0xbb')]?_0x14447f[_0xfe1d('0xbb')]:_0xfe1d('0xb7')},'messages':_(_0x14447f[_0xfe1d('0x79')])[_0xfe1d('0xbc')]()[_0xfe1d('0x9d')]({'secret':![]})['map'](function(_0x21a869){if(_0x21a869[_0xfe1d('0x6a')]){var _0x3e6e3f=path[_0xfe1d('0x6f')](_0x1d1b75,_0x21a869[_0xfe1d('0x6a')][_0xfe1d('0x67')]);if(fs['existsSync'](_0x3e6e3f)){fs[_0xfe1d('0xbd')](_0x3e6e3f)[_0xfe1d('0xbe')](fs[_0xfe1d('0xbf')](path[_0xfe1d('0x6f')](_0x2c3023,_0x21a869[_0xfe1d('0x6a')][_0xfe1d('0x67')])));}}return{'date':moment(_0x21a869[_0xfe1d('0x84')])[_0xfe1d('0x75')](_0xfe1d('0xa0'))[_0xfe1d('0xaa')](),'sender':_0x21a869['direction']==='out'?_0x21a869[_0xfe1d('0xa4')]?_0x21a869[_0xfe1d('0xa4')][_0xfe1d('0x4d')]:_0xfe1d('0x7e'):_0x21a869['Contact']['firstName']+(_0x21a869[_0xfe1d('0xc0')][_0xfe1d('0xc1')]?'\x20'+_0x21a869[_0xfe1d('0xc0')][_0xfe1d('0xc1')]:''),'body':_0x21a869[_0xfe1d('0x6a')]?_0x21a869[_0xfe1d('0x6a')]['basename']:_0x21a869[_0xfe1d('0x2f')],'direction':_0x21a869['direction']===_0xfe1d('0x58')?'A':'C','secret':_0x21a869[_0xfe1d('0xb1')],'read':_0x21a869[_0xfe1d('0xb2')],'attachment':_0x21a869[_0xfe1d('0x6a')]};})[_0xfe1d('0xc2')]()};return ejs[_0xfe1d('0xc3')](path['join'](config[_0xfe1d('0x70')],_0xfe1d('0xad'),_0xfe1d('0xc4'),_0xfe1d('0xc5')),{'interaction':_0x5bddfd})[_0xfe1d('0x29')](function(_0x2ddbed){var _0xbcde0=path[_0xfe1d('0x6f')](_0x2c3023,_0xfe1d('0xc6')+_0x14447f['id']+'-'+_0x203ba9+_0xfe1d('0xc7'));var _0x140195={'path':_0xbcde0,'channel':_0xfe1d('0xb6'),'interactionId':_0x14447f['id']};return pdf['createPdfFromHTML'](_0x2ddbed,_0x140195);})['then'](function(){return new Promise(function(_0x2f36f4,_0x45e744){zipdir(_0x2c3023,{'saveTo':_0x485432},function(_0x4a9114,_0x6b0d1){if(_0x4a9114)return _0x45e744(_0x4a9114);return _0x2f36f4(_0x6b0d1);});})[_0xfe1d('0x29')](function(){return new BPromise(function(_0xfd49d6,_0x390446){rimraf(_0x2c3023,function(_0x26d69a){if(_0x26d69a)_0x390446(_0x26d69a);return _0xfd49d6();});});})['then'](function(){return _0xd49a8d['download'](_0x485432,_0x12f99b,function(_0x2b5d37){if(_0x2b5d37){logger['error'](_0xfe1d('0xc8'),_0x2b5d37);}else{fs['unlinkSync'](_0x485432);}});});});}else{return _0xd49a8d[_0xfe1d('0x1e')](0xc8);}})[_0xfe1d('0x1d')](handleError(_0xd49a8d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 822eba7..24173e9 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 _0x5302=['ChatInteraction','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x391932,_0x3c1b9f){var _0x49ca90=function(_0x589776){while(--_0x589776){_0x391932['push'](_0x391932['shift']());}};_0x49ca90(++_0x3c1b9f);}(_0x5302,0xdb));var _0x2530=function(_0x10a6c5,_0x3b8168){_0x10a6c5=_0x10a6c5-0x0;var _0x79e4b8=_0x5302[_0x10a6c5];return _0x79e4b8;};'use strict';var EventEmitter=require(_0x2530('0x0'));var ChatInteraction=require(_0x2530('0x1'))['db'][_0x2530('0x2')];var ChatMessage=require(_0x2530('0x1'))['db'][_0x2530('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2530('0x4')](0x0);var events={'afterCreate':_0x2530('0x5'),'afterUpdate':_0x2530('0x6'),'afterDestroy':'remove'};function emitEvent(_0x538660){return function(_0x251d83,_0x1f8909,_0x25e4fb){_0x251d83[_0x2530('0x7')]({'attributes':['id'],'raw':!![]})[_0x2530('0x8')](function(_0x46df1e){_0x251d83[_0x2530('0x9')]('Users',_0x46df1e[_0x2530('0xa')](function(_0xd0b755){return{'id':_0xd0b755['id']};}));return ChatMessage[_0x2530('0xb')]({'where':{'ChatInteractionId':_0x251d83['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2530('0x8')](function(_0x57dc2e){_0x251d83[_0x2530('0x9')]('unreadMessages',_0x57dc2e['length']);ChatInteractionEvents[_0x2530('0xc')](_0x538660+':'+_0x251d83['id'],_0x251d83);ChatInteractionEvents[_0x2530('0xc')](_0x538660,_0x251d83);_0x25e4fb(null);})[_0x2530('0xd')](_0x25e4fb(null));};}for(var e in events){if(events[_0x2530('0xe')](e)){var event=events[e];ChatInteraction[_0x2530('0xf')](e,emitEvent(event));}}module[_0x2530('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x0950=['setMaxListeners','update','remove','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x131389,_0x2fd67d){var _0x553a27=function(_0x1070ee){while(--_0x1070ee){_0x131389['push'](_0x131389['shift']());}};_0x553a27(++_0x2fd67d);}(_0x0950,0x1e9));var _0x0095=function(_0x36d5d5,_0x1c1590){_0x36d5d5=_0x36d5d5-0x0;var _0x4eaa56=_0x0950[_0x36d5d5];return _0x4eaa56;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x0095('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x0095('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0095('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0095('0x2'),'afterDestroy':_0x0095('0x3')};function emitEvent(_0x53f115){return function(_0x487b1,_0x2a2942,_0x3f926e){_0x487b1['getUsers']({'attributes':['id'],'raw':!![]})[_0x0095('0x4')](function(_0x372786){_0x487b1[_0x0095('0x5')]('Users',_0x372786[_0x0095('0x6')](function(_0x3e6243){return{'id':_0x3e6243['id']};}));return ChatMessage[_0x0095('0x7')]({'where':{'ChatInteractionId':_0x487b1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0095('0x4')](function(_0x25028b){_0x487b1[_0x0095('0x5')](_0x0095('0x8'),_0x25028b['length']);ChatInteractionEvents[_0x0095('0x9')](_0x53f115+':'+_0x487b1['id'],_0x487b1);ChatInteractionEvents['emit'](_0x53f115,_0x487b1);_0x3f926e(null);})[_0x0095('0xa')](_0x3f926e(null));};}for(var e in events){if(events[_0x0095('0xb')](e)){var event=events[e];ChatInteraction[_0x0095('0xc')](e,emitEvent(event));}}module[_0x0095('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5d7e921..71d4bab 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 _0x806c=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','chat_interactions','closed','format','utf8mb4'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x806c,0xa9));var _0xc806=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0x806c[_0x592df4];return _0x3b4fe4;};'use strict';var _=require(_0xc806('0x0'));var util=require(_0xc806('0x1'));var logger=require(_0xc806('0x2'))(_0xc806('0x3'));var moment=require('moment');var BPromise=require(_0xc806('0x4'));var rp=require(_0xc806('0x5'));var fs=require('fs');var path=require(_0xc806('0x6'));var rimraf=require(_0xc806('0x7'));var config=require('../../config/environment');var attributes=require(_0xc806('0x8'));module['exports']=function(_0x1874d9,_0x2173b6){return _0x1874d9['define']('ChatInteraction',attributes,{'tableName':_0xc806('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50fddd,_0x260d5e,_0x2e6ccb){if(_0x50fddd['changed'](_0xc806('0xa'))){_0x50fddd['closedAt']=moment()[_0xc806('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2e6ccb(null,_0x50fddd);}},'charset':_0xc806('0xc'),'collate':_0xc806('0xd')});}; \ No newline at end of file +var _0x2041=['define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','./chatInteraction.attributes','exports'];(function(_0xbb5c26,_0xa31f41){var _0x5008e8=function(_0x2fac80){while(--_0x2fac80){_0xbb5c26['push'](_0xbb5c26['shift']());}};_0x5008e8(++_0xa31f41);}(_0x2041,0xa2));var _0x1204=function(_0xa34df,_0x191aff){_0xa34df=_0xa34df-0x0;var _0x460da1=_0x2041[_0xa34df];return _0x460da1;};'use strict';var _=require(_0x1204('0x0'));var util=require(_0x1204('0x1'));var logger=require('../../config/logger')(_0x1204('0x2'));var moment=require(_0x1204('0x3'));var BPromise=require('bluebird');var rp=require(_0x1204('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1204('0x5'));var config=require('../../config/environment');var attributes=require(_0x1204('0x6'));module[_0x1204('0x7')]=function(_0x5aea2d,_0x53225b){return _0x5aea2d[_0x1204('0x8')](_0x1204('0x9'),attributes,{'tableName':_0x1204('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3aa054,_0x20b9da,_0x1503c6){if(_0x3aa054[_0x1204('0xb')](_0x1204('0xc'))){_0x3aa054[_0x1204('0xd')]=moment()[_0x1204('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1503c6(null,_0x3aa054);}},'charset':_0x1204('0xf'),'collate':_0x1204('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b166f17..475bb7d 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 _0x1b97=['raw','where','limit','catch','find','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options'];(function(_0x58e51e,_0x964a49){var _0x3987f5=function(_0x574f58){while(--_0x574f58){_0x58e51e['push'](_0x58e51e['shift']());}};_0x3987f5(++_0x964a49);}(_0x1b97,0x89));var _0x71b9=function(_0x111dab,_0x33082b){_0x111dab=_0x111dab-0x0;var _0x2f5dc4=_0x1b97[_0x111dab];return _0x2f5dc4;};'use strict';var _=require(_0x71b9('0x0'));var util=require(_0x71b9('0x1'));var moment=require(_0x71b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x71b9('0x3'));var fs=require('fs');var Redis=require(_0x71b9('0x4'));var db=require(_0x71b9('0x5'))['db'];var utils=require(_0x71b9('0x6'));var logger=require(_0x71b9('0x7'))(_0x71b9('0x8'));var config=require(_0x71b9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x71b9('0xa')]['http']({'port':0x232a});config[_0x71b9('0xb')]=_[_0x71b9('0xc')](config[_0x71b9('0xb')],{'host':_0x71b9('0xd'),'port':0x18eb});var socket=require(_0x71b9('0xe'))(new Redis(config[_0x71b9('0xb')]));require(_0x71b9('0xf'))[_0x71b9('0x10')](socket);function respondWithRpcPromise(_0x17f430,_0x1e79b2,_0x5b0e3e){return new BPromise(function(_0xbacb94,_0xbaaf56){return client['request'](_0x17f430,_0x5b0e3e)[_0x71b9('0x11')](function(_0x52ebfb){logger[_0x71b9('0x12')](_0x71b9('0x13'),_0x1e79b2,_0x71b9('0x14'));logger[_0x71b9('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1e79b2,'request\x20sent',JSON['stringify'](_0x52ebfb));if(_0x52ebfb[_0x71b9('0x16')]){if(_0x52ebfb['error'][_0x71b9('0x17')]===0x1f4){logger[_0x71b9('0x16')](_0x71b9('0x13'),_0x1e79b2,_0x52ebfb['error']['message']);return _0xbaaf56(_0x52ebfb[_0x71b9('0x16')][_0x71b9('0x18')]);}logger['error'](_0x71b9('0x13'),_0x1e79b2,_0x52ebfb['error'][_0x71b9('0x18')]);return _0xbacb94(_0x52ebfb[_0x71b9('0x16')][_0x71b9('0x18')]);}else{logger[_0x71b9('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x1e79b2,_0x71b9('0x14'));_0xbacb94(_0x52ebfb[_0x71b9('0x19')]['message']);}})['catch'](function(_0x3a83f5){logger['error'](_0x71b9('0x13'),_0x1e79b2,_0x3a83f5);_0xbaaf56(_0x3a83f5);});});}exports[_0x71b9('0x1a')]=function(_0x5718f7){var _0x149cb=this;return new Promise(function(_0x2a83c4,_0x9b84b4){return db[_0x71b9('0x1b')][_0x71b9('0x1c')](_0x5718f7[_0x71b9('0x1d')],{'raw':_0x5718f7[_0x71b9('0x1e')]?_0x5718f7[_0x71b9('0x1e')][_0x71b9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5718f7['options']?_0x5718f7[_0x71b9('0x1e')][_0x71b9('0x20')]||null:null,'attributes':_0x5718f7[_0x71b9('0x1e')]?_0x5718f7[_0x71b9('0x1e')]['attributes']||null:null,'limit':_0x5718f7[_0x71b9('0x1e')]?_0x5718f7[_0x71b9('0x1e')][_0x71b9('0x21')]||null:null})[_0x71b9('0x11')](function(_0xb20825){logger[_0x71b9('0x12')](_0x71b9('0x1a'),_0x5718f7);logger[_0x71b9('0x15')]('UpdateChatInteraction',_0x5718f7,JSON['stringify'](_0xb20825));_0x2a83c4(_0xb20825);})[_0x71b9('0x22')](function(_0x2a9de9){logger[_0x71b9('0x16')]('UpdateChatInteraction',_0x2a9de9[_0x71b9('0x18')],_0x5718f7);_0x9b84b4(_0x149cb[_0x71b9('0x16')](0x1f4,_0x2a9de9['message']));});});};exports['AddTagsToChatInteraction']=function(_0x458546){return new Promise(function(_0x4dc249,_0x3b8dbc){return db[_0x71b9('0x1b')][_0x71b9('0x23')]({'where':_0x458546[_0x71b9('0x1e')]?_0x458546[_0x71b9('0x1e')]['where']||null:null})[_0x71b9('0x11')](function(_0x1b3eba){if(_0x1b3eba){return _0x1b3eba[_0x71b9('0x24')](_0x458546[_0x71b9('0x1d')][_0x71b9('0x25')],_[_0x71b9('0x26')](_0x458546[_0x71b9('0x1d')],[_0x71b9('0x25'),'id'])||{});}})[_0x71b9('0x27')](function(_0x109053){logger[_0x71b9('0x12')](_0x71b9('0x28'),_0x458546);logger['debug']('AddTags',_0x458546,JSON[_0x71b9('0x29')](_0x109053));_0x4dc249(_0x109053);})['catch'](function(_0x4171cb){logger[_0x71b9('0x16')](_0x71b9('0x28'),_0x4171cb[_0x71b9('0x18')],_0x458546);_0x3b8dbc(_this[_0x71b9('0x16')](0x1f4,_0x4171cb[_0x71b9('0x18')]));});});}; \ No newline at end of file +var _0x520d=['catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','then','find','addTags','ids','AddTags','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x520d,0x135));var _0xd520=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x520d[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd520('0x0'));var fs=require('fs');var Redis=require(_0xd520('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd520('0x2'));var logger=require(_0xd520('0x3'))(_0xd520('0x4'));var config=require(_0xd520('0x5'));var jayson=require(_0xd520('0x6'));var client=jayson[_0xd520('0x7')]['http']({'port':0x232a});config[_0xd520('0x8')]=_['defaults'](config[_0xd520('0x8')],{'host':_0xd520('0x9'),'port':0x18eb});var socket=require(_0xd520('0xa'))(new Redis(config['redis']));require(_0xd520('0xb'))[_0xd520('0xc')](socket);function respondWithRpcPromise(_0x14b7e0,_0x5c85cc,_0x1f70ed){return new BPromise(function(_0xebfb7b,_0xffa62f){return client[_0xd520('0xd')](_0x14b7e0,_0x1f70ed)['then'](function(_0x4ad225){logger[_0xd520('0xe')](_0xd520('0xf'),_0x5c85cc,_0xd520('0x10'));logger[_0xd520('0x11')](_0xd520('0x12'),_0x5c85cc,'request\x20sent',JSON[_0xd520('0x13')](_0x4ad225));if(_0x4ad225[_0xd520('0x14')]){if(_0x4ad225[_0xd520('0x14')][_0xd520('0x15')]===0x1f4){logger[_0xd520('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5c85cc,_0x4ad225[_0xd520('0x14')][_0xd520('0x16')]);return _0xffa62f(_0x4ad225[_0xd520('0x14')]['message']);}logger['error'](_0xd520('0xf'),_0x5c85cc,_0x4ad225['error'][_0xd520('0x16')]);return _0xebfb7b(_0x4ad225[_0xd520('0x14')][_0xd520('0x16')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5c85cc,_0xd520('0x10'));_0xebfb7b(_0x4ad225[_0xd520('0x17')][_0xd520('0x16')]);}})[_0xd520('0x18')](function(_0x513e59){logger[_0xd520('0x14')](_0xd520('0xf'),_0x5c85cc,_0x513e59);_0xffa62f(_0x513e59);});});}exports[_0xd520('0x19')]=function(_0x5d14a7){var _0x2f8e45=this;return new Promise(function(_0x77059e,_0x26dab9){return db[_0xd520('0x1a')]['update'](_0x5d14a7[_0xd520('0x1b')],{'raw':_0x5d14a7['options']?_0x5d14a7[_0xd520('0x1c')][_0xd520('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d14a7[_0xd520('0x1c')]?_0x5d14a7[_0xd520('0x1c')][_0xd520('0x1e')]||null:null,'attributes':_0x5d14a7[_0xd520('0x1c')]?_0x5d14a7['options'][_0xd520('0x1f')]||null:null,'limit':_0x5d14a7[_0xd520('0x1c')]?_0x5d14a7[_0xd520('0x1c')]['limit']||null:null})[_0xd520('0x20')](function(_0x3ef3bf){logger['info']('UpdateChatInteraction',_0x5d14a7);logger['debug'](_0xd520('0x19'),_0x5d14a7,JSON['stringify'](_0x3ef3bf));_0x77059e(_0x3ef3bf);})[_0xd520('0x18')](function(_0x2c49c8){logger[_0xd520('0x14')]('UpdateChatInteraction',_0x2c49c8[_0xd520('0x16')],_0x5d14a7);_0x26dab9(_0x2f8e45[_0xd520('0x14')](0x1f4,_0x2c49c8['message']));});});};exports['AddTagsToChatInteraction']=function(_0x496169){return new Promise(function(_0x177495,_0x59bcf6){return db[_0xd520('0x1a')][_0xd520('0x21')]({'where':_0x496169[_0xd520('0x1c')]?_0x496169[_0xd520('0x1c')]['where']||null:null})[_0xd520('0x20')](function(_0x4ad680){if(_0x4ad680){return _0x4ad680[_0xd520('0x22')](_0x496169[_0xd520('0x1b')][_0xd520('0x23')],_['omit'](_0x496169[_0xd520('0x1b')],[_0xd520('0x23'),'id'])||{});}})['spread'](function(_0x5589e2){logger['info'](_0xd520('0x24'),_0x496169);logger[_0xd520('0x11')](_0xd520('0x24'),_0x496169,JSON[_0xd520('0x13')](_0x5589e2));_0x177495(_0x5589e2);})[_0xd520('0x18')](function(_0x4d21b5){logger[_0xd520('0x14')](_0xd520('0x24'),_0x4d21b5['message'],_0x496169);_0x59bcf6(_this[_0xd520('0x14')](0x1f4,_0x4d21b5[_0xd520('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8764f8c..493ecb8 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 _0xdce1=['save','update','emit','length','chatInteraction:','./chatInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdce1,0x143));var _0x1dce=function(_0x441027,_0x495993){_0x441027=_0x441027-0x0;var _0xd67dbd=_0xdce1[_0x441027];return _0xd67dbd;};'use strict';var ChatInteractionEvents=require(_0x1dce('0x0'));var events=[_0x1dce('0x1'),'remove',_0x1dce('0x2')];function createListener(_0x29cd71,_0x3e13c0){return function(_0x32fb3a){_0x3e13c0[_0x1dce('0x3')](_0x29cd71,_0x32fb3a);};}function removeListener(_0x44b073,_0x10c369){return function(){ChatInteractionEvents['removeListener'](_0x44b073,_0x10c369);};}exports['register']=function(_0x48404b){for(var _0x1172b4=0x0,_0x249fc8=events[_0x1dce('0x4')];_0x1172b4<_0x249fc8;_0x1172b4++){var _0x226cc4=events[_0x1172b4];var _0x3765a7=createListener(_0x1dce('0x5')+_0x226cc4,_0x48404b);ChatInteractionEvents['on'](_0x226cc4,_0x3765a7);}}; \ No newline at end of file +var _0x9309=['remove','update','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x3520a3,_0x585b4e){var _0x266257=function(_0x4d763a){while(--_0x4d763a){_0x3520a3['push'](_0x3520a3['shift']());}};_0x266257(++_0x585b4e);}(_0x9309,0xb8));var _0x9930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9309[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x9930('0x0'));var events=[_0x9930('0x1'),_0x9930('0x2'),_0x9930('0x3')];function createListener(_0x4f8948,_0x4ca480){return function(_0x43b8ba){_0x4ca480['emit'](_0x4f8948,_0x43b8ba);};}function removeListener(_0x1a8611,_0x18a861){return function(){ChatInteractionEvents['removeListener'](_0x1a8611,_0x18a861);};}exports['register']=function(_0x21d276){for(var _0xa0012a=0x0,_0x1a9bd3=events[_0x9930('0x4')];_0xa0012a<_0x1a9bd3;_0xa0012a++){var _0x6eef1=events[_0xa0012a];var _0x4b48e3=createListener(_0x9930('0x5')+_0x6eef1,_0x21d276);ChatInteractionEvents['on'](_0x6eef1,_0x4b48e3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3ae02e5..51c956b 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 _0x90c2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','chat','chatinteraction:addtags','addTags','/:id','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','destroy','/:id/tags','exports','multer','express','Router','fs-extra'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x90c2,0xfb));var _0x290c=function(_0x6f38b5,_0x5bad8d){_0x6f38b5=_0x6f38b5-0x0;var _0x582875=_0x90c2[_0x6f38b5];return _0x582875;};'use strict';var multer=require(_0x290c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x290c('0x1'));var router=express[_0x290c('0x2')]();var fs_extra=require(_0x290c('0x3'));var auth=require(_0x290c('0x4'));var interaction=require(_0x290c('0x5'));var config=require(_0x290c('0x6'));var controller=require(_0x290c('0x7'));router[_0x290c('0x8')]('/',auth[_0x290c('0x9')](),controller['index']);router[_0x290c('0x8')]('/describe',auth[_0x290c('0x9')](),controller['describe']);router[_0x290c('0x8')]('/:id',auth[_0x290c('0xa')](),controller[_0x290c('0xb')]);router[_0x290c('0x8')]('/:id/attachment_download',auth[_0x290c('0xa')](),controller[_0x290c('0xc')]);router[_0x290c('0x8')](_0x290c('0xd'),auth['isAuthenticated'](),controller[_0x290c('0xe')]);router[_0x290c('0x8')](_0x290c('0xf'),auth[_0x290c('0xa')](),controller[_0x290c('0x10')]);router['get'](_0x290c('0x11'),auth[_0x290c('0x9')](),controller[_0x290c('0x12')]);router[_0x290c('0x13')]('/',auth[_0x290c('0x9')](),controller[_0x290c('0x14')]);router[_0x290c('0x13')](_0x290c('0x15'),auth[_0x290c('0x9')](),controller[_0x290c('0x16')]);var upload=multer({'storage':multer[_0x290c('0x17')]({'destination':function(_0x4099c8,_0x47634c,_0x41e1bd){_0x41e1bd(null,path[_0x290c('0x18')](config[_0x290c('0x19')],_0x290c('0x1a')));},'filename':function(_0x586556,_0x20c178,_0x16840c){_0x16840c(null,util['format'](_0x290c('0x1b'),Date[_0x290c('0x1c')](),_0x20c178[_0x290c('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x290c('0x1e'),upload[_0x290c('0x1f')]('file'),controller[_0x290c('0x20')]);router[_0x290c('0x13')](_0x290c('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x290c('0x21')]);router[_0x290c('0x13')]('/:id/tags',auth[_0x290c('0x9')](),interaction['tracked'](_0x290c('0x22'),_0x290c('0x23')),controller[_0x290c('0x24')]);router['put'](_0x290c('0x25'),auth[_0x290c('0x9')](),interaction['tracked'](_0x290c('0x22'),'chatinteraction:update'),controller[_0x290c('0x26')]);router[_0x290c('0x27')]('/:id/custom_update',controller[_0x290c('0x28')]);router[_0x290c('0x27')](_0x290c('0x29'),auth[_0x290c('0xa')](),controller[_0x290c('0x2a')]);router[_0x290c('0x27')](_0x290c('0x2b'),controller[_0x290c('0x2c')]);router[_0x290c('0x2d')](_0x290c('0x25'),auth[_0x290c('0x9')](),interaction[_0x290c('0x2e')](_0x290c('0x22'),_0x290c('0x2f')),controller[_0x290c('0x30')]);router[_0x290c('0x2d')](_0x290c('0x31'),auth[_0x290c('0x9')](),controller['removeTags']);module[_0x290c('0x32')]=router; \ No newline at end of file +var _0x2d69=['root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','chatinteraction:update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','join'];(function(_0x1c8e6f,_0x30444d){var _0x941f8c=function(_0x39fea1){while(--_0x39fea1){_0x1c8e6f['push'](_0x1c8e6f['shift']());}};_0x941f8c(++_0x30444d);}(_0x2d69,0x1c1));var _0x92d6=function(_0x5bcf21,_0x11751e){_0x5bcf21=_0x5bcf21-0x0;var _0x2c1a2b=_0x2d69[_0x5bcf21];return _0x2c1a2b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x92d6('0x0'));var timeout=require(_0x92d6('0x1'));var express=require(_0x92d6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x92d6('0x3'));router[_0x92d6('0x4')]('/',auth[_0x92d6('0x5')](),controller[_0x92d6('0x6')]);router['get']('/describe',auth[_0x92d6('0x5')](),controller[_0x92d6('0x7')]);router[_0x92d6('0x4')](_0x92d6('0x8'),auth[_0x92d6('0x9')](),controller[_0x92d6('0xa')]);router['get']('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x92d6('0x4')](_0x92d6('0xb'),auth[_0x92d6('0x5')](),controller[_0x92d6('0xc')]);router[_0x92d6('0x4')](_0x92d6('0xd'),auth[_0x92d6('0x9')](),controller[_0x92d6('0xe')]);router[_0x92d6('0x4')](_0x92d6('0xf'),auth[_0x92d6('0x5')](),controller[_0x92d6('0x10')]);router[_0x92d6('0x11')]('/',auth[_0x92d6('0x5')](),controller[_0x92d6('0x12')]);router[_0x92d6('0x11')]('/:id/vidaoo',auth[_0x92d6('0x5')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x92d6('0x13')]({'destination':function(_0x49ac36,_0x2e9673,_0x40d472){_0x40d472(null,path[_0x92d6('0x14')](config[_0x92d6('0x15')],_0x92d6('0x16')));},'filename':function(_0x3c7eb8,_0x5b1e0c,_0x79e010){_0x79e010(null,util[_0x92d6('0x17')](_0x92d6('0x18'),Date[_0x92d6('0x19')](),_0x5b1e0c[_0x92d6('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x92d6('0x11')](_0x92d6('0x1b'),upload[_0x92d6('0x1c')](_0x92d6('0x1d')),controller[_0x92d6('0x1e')]);router[_0x92d6('0x11')](_0x92d6('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x92d6('0x1f')]);router[_0x92d6('0x11')](_0x92d6('0x20'),auth[_0x92d6('0x5')](),interaction[_0x92d6('0x21')](_0x92d6('0x22'),_0x92d6('0x23')),controller['addTags']);router['put'](_0x92d6('0x8'),auth[_0x92d6('0x5')](),interaction[_0x92d6('0x21')](_0x92d6('0x22'),_0x92d6('0x24')),controller['update']);router[_0x92d6('0x25')](_0x92d6('0x26'),controller[_0x92d6('0x27')]);router[_0x92d6('0x25')](_0x92d6('0x28'),auth[_0x92d6('0x9')](),controller[_0x92d6('0x29')]);router[_0x92d6('0x25')]('/:id/close',controller['close']);router[_0x92d6('0x2a')](_0x92d6('0x8'),auth[_0x92d6('0x5')](),interaction[_0x92d6('0x21')](_0x92d6('0x22'),_0x92d6('0x2b')),controller[_0x92d6('0x2c')]);router[_0x92d6('0x2a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x92d6('0x2d')]);module[_0x92d6('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 42ef857..29581da 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 _0xe426=['medium','sequelize','exports','TEXT'];(function(_0xdb51f6,_0x37a196){var _0x1516db=function(_0x3a46de){while(--_0x3a46de){_0xdb51f6['push'](_0xdb51f6['shift']());}};_0x1516db(++_0x37a196);}(_0xe426,0x135));var _0x6e42=function(_0x4979e1,_0x4dd5a8){_0x4979e1=_0x4979e1-0x0;var _0x3ccf4b=_0xe426[_0x4979e1];return _0x3ccf4b;};'use strict';var Sequelize=require(_0x6e42('0x0'));module[_0x6e42('0x1')]={'body':{'type':Sequelize[_0x6e42('0x2')](_0x6e42('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8648=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x34de9f,_0x1d42f6){var _0x1f8a99=function(_0xa664f3){while(--_0xa664f3){_0x34de9f['push'](_0x34de9f['shift']());}};_0x1f8a99(++_0x1d42f6);}(_0x8648,0x1a6));var _0x8864=function(_0x370985,_0x2270a3){_0x370985=_0x370985-0x0;var _0x7176a9=_0x8648[_0x370985];return _0x7176a9;};'use strict';var Sequelize=require(_0x8864('0x0'));module[_0x8864('0x1')]={'body':{'type':Sequelize[_0x8864('0x2')](_0x8864('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8864('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8864('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1f77922..a282a46 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 _0xca6a=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','keys','catch','body','find','params','describe','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','isEmpty','resourceId','push','messages','read','-createdAt','all','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4cf09f,_0x9e5e24){var _0x17acad=function(_0x24abc9){while(--_0x24abc9){_0x4cf09f['push'](_0x4cf09f['shift']());}};_0x17acad(++_0x9e5e24);}(_0xca6a,0xbd));var _0xaca6=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xca6a[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xaca6('0x0'));var rimraf=require(_0xaca6('0x1'));var zipdir=require(_0xaca6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaca6('0x3'));var BPromise=require(_0xaca6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaca6('0x5'));var sox=require(_0xaca6('0x6'));var csv=require(_0xaca6('0x7'));var ejs=require(_0xaca6('0x8'));var fs=require('fs');var fs_extra=require(_0xaca6('0x9'));var _=require('lodash');var squel=require(_0xaca6('0xa'));var crypto=require(_0xaca6('0xb'));var jsforce=require(_0xaca6('0xc'));var deskjs=require(_0xaca6('0xd'));var toCsv=require(_0xaca6('0x7'));var querystring=require(_0xaca6('0xe'));var Papa=require(_0xaca6('0xf'));var Redis=require(_0xaca6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xaca6('0x11'));var as=require(_0xaca6('0x12'));var hardwareService=require(_0xaca6('0x13'));var logger=require('../../config/logger')(_0xaca6('0x14'));var utils=require(_0xaca6('0x15'));var config=require(_0xaca6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaca6('0x17'))['db'];config[_0xaca6('0x18')]=_[_0xaca6('0x19')](config[_0xaca6('0x18')],{'host':_0xaca6('0x1a'),'port':0x18eb});var socket=require(_0xaca6('0x1b'))(new Redis(config[_0xaca6('0x18')]));require(_0xaca6('0x1c'))[_0xaca6('0x1d')](socket);function respondWithStatusCode(_0x798d39,_0x4df7ff){_0x4df7ff=_0x4df7ff||0xcc;return function(_0x1b1b5d){if(_0x1b1b5d){return _0x798d39[_0xaca6('0x1e')](_0x4df7ff);}return _0x798d39[_0xaca6('0x1f')](_0x4df7ff)[_0xaca6('0x20')]();};}function respondWithResult(_0x157c47,_0x58d939){_0x58d939=_0x58d939||0xc8;return function(_0xb17187){if(_0xb17187){return _0x157c47[_0xaca6('0x1f')](_0x58d939)[_0xaca6('0x21')](_0xb17187);}};}function respondWithFilteredResult(_0x263c05,_0x5020e4){return function(_0xffc240){if(_0xffc240){var _0x5e75ed=typeof _0x5020e4[_0xaca6('0x22')]==='undefined'&&typeof _0x5020e4['limit']==='undefined';var _0x2f0d4e=_0xffc240[_0xaca6('0x23')];var _0x3ca28f=_0x5e75ed?0x0:_0x5020e4[_0xaca6('0x22')];var _0x21ebae=_0x5e75ed?_0xffc240[_0xaca6('0x23')]:_0x5020e4[_0xaca6('0x22')]+_0x5020e4[_0xaca6('0x24')];var _0x519f8a;if(_0x21ebae>=_0x2f0d4e){_0x21ebae=_0x2f0d4e;_0x519f8a=0xc8;}else{_0x519f8a=0xce;}_0x263c05[_0xaca6('0x1f')](_0x519f8a);return _0x263c05[_0xaca6('0x25')](_0xaca6('0x26'),_0x3ca28f+'-'+_0x21ebae+'/'+_0x2f0d4e)['json'](_0xffc240);}return null;};}function patchUpdates(_0x173d9d){return function(_0x5dfa5d){try{jsonpatch[_0xaca6('0x27')](_0x5dfa5d,_0x173d9d,!![]);}catch(_0x2ea98d){return BPromise[_0xaca6('0x28')](_0x2ea98d);}return _0x5dfa5d['save']();};}function saveUpdates(_0x460175,_0x55c274){return function(_0x580ec3){if(_0x580ec3){return _0x580ec3['update'](_0x460175)[_0xaca6('0x29')](function(_0x5bc4e8){return _0x5bc4e8;});}return null;};}function removeEntity(_0x36a7da,_0x4de800){return function(_0x94ad0d){if(_0x94ad0d){return _0x94ad0d[_0xaca6('0x2a')]()[_0xaca6('0x29')](function(){_0x36a7da[_0xaca6('0x1f')](0xcc)[_0xaca6('0x20')]();});}};}function handleEntityNotFound(_0x1290a0,_0xf80522){return function(_0x23099b){if(!_0x23099b){_0x1290a0[_0xaca6('0x1e')](0x194);}return _0x23099b;};}function handleError(_0x15021c,_0x5e3804){_0x5e3804=_0x5e3804||0x1f4;return function(_0x3401f7){logger[_0xaca6('0x2b')](_0x3401f7[_0xaca6('0x2c')]);if(_0x3401f7[_0xaca6('0x2d')]){delete _0x3401f7[_0xaca6('0x2d')];}_0x15021c[_0xaca6('0x1f')](_0x5e3804)[_0xaca6('0x2e')](_0x3401f7);};}exports[_0xaca6('0x2f')]=function(_0x3b76be,_0x227e71){var _0xf4b60e={},_0x33210d={},_0x597aab={'count':0x0,'rows':[]};var _0x3de8ea=_[_0xaca6('0x30')](db[_0xaca6('0x31')][_0xaca6('0x32')],function(_0x12c24c){return{'name':_0x12c24c[_0xaca6('0x33')],'type':_0x12c24c[_0xaca6('0x34')][_0xaca6('0x35')]};});_0x33210d[_0xaca6('0x36')]=_['map'](_0x3de8ea,'name');_0x33210d['query']=_['keys'](_0x3b76be[_0xaca6('0x37')]);_0x33210d[_0xaca6('0x38')]=_[_0xaca6('0x39')](_0x33210d['model'],_0x33210d['query']);_0xf4b60e['attributes']=_[_0xaca6('0x39')](_0x33210d[_0xaca6('0x36')],qs[_0xaca6('0x3a')](_0x3b76be[_0xaca6('0x37')][_0xaca6('0x3a')]));_0xf4b60e['attributes']=_0xf4b60e[_0xaca6('0x3b')][_0xaca6('0x3c')]?_0xf4b60e[_0xaca6('0x3b')]:_0x33210d['model'];if(!_0x3b76be[_0xaca6('0x37')][_0xaca6('0x3d')]('nolimit')){_0xf4b60e[_0xaca6('0x24')]=qs[_0xaca6('0x24')](_0x3b76be[_0xaca6('0x37')][_0xaca6('0x24')]);_0xf4b60e[_0xaca6('0x22')]=qs['offset'](_0x3b76be[_0xaca6('0x37')]['offset']);}_0xf4b60e['order']=qs[_0xaca6('0x3e')](_0x3b76be['query'][_0xaca6('0x3e')]);_0xf4b60e['where']=qs[_0xaca6('0x38')](_[_0xaca6('0x3f')](_0x3b76be['query'],_0x33210d[_0xaca6('0x38')]),_0x3de8ea);if(_0x3b76be[_0xaca6('0x37')][_0xaca6('0x40')]){_0xf4b60e[_0xaca6('0x41')]=_['merge'](_0xf4b60e['where'],{'$or':_[_0xaca6('0x30')](_0x3de8ea,function(_0x633323){if(_0x633323['type']!==_0xaca6('0x42')){var _0x24fbaf={};_0x24fbaf[_0x633323['name']]={'$like':'%'+_0x3b76be[_0xaca6('0x37')][_0xaca6('0x40')]+'%'};return _0x24fbaf;}})});}_0xf4b60e=_['merge']({},_0xf4b60e,_0x3b76be[_0xaca6('0x43')]);var _0x39eb58={'where':_0xf4b60e[_0xaca6('0x41')]};return db['ChatInternalMessage'][_0xaca6('0x23')](_0x39eb58)['then'](function(_0x184f71){_0x597aab[_0xaca6('0x23')]=_0x184f71;if(_0x3b76be[_0xaca6('0x37')][_0xaca6('0x44')]){_0xf4b60e[_0xaca6('0x45')]=[{'all':!![]}];}return db[_0xaca6('0x31')]['findAll'](_0xf4b60e);})[_0xaca6('0x29')](function(_0x49d944){_0x597aab['rows']=_0x49d944;return _0x597aab;})[_0xaca6('0x29')](respondWithFilteredResult(_0x227e71,_0xf4b60e))['catch'](handleError(_0x227e71,null));};exports['show']=function(_0x47150d,_0x512b7f){var _0x43eec7={'raw':!![],'where':{'id':_0x47150d['params']['id']}},_0x21ea17={};_0x21ea17['model']=_[_0xaca6('0x46')](db[_0xaca6('0x31')][_0xaca6('0x32')]);_0x21ea17[_0xaca6('0x37')]=_[_0xaca6('0x46')](_0x47150d[_0xaca6('0x37')]);_0x21ea17['filters']=_[_0xaca6('0x39')](_0x21ea17[_0xaca6('0x36')],_0x21ea17['query']);_0x43eec7['attributes']=_[_0xaca6('0x39')](_0x21ea17['model'],qs[_0xaca6('0x3a')](_0x47150d[_0xaca6('0x37')]['fields']));_0x43eec7[_0xaca6('0x3b')]=_0x43eec7[_0xaca6('0x3b')][_0xaca6('0x3c')]?_0x43eec7['attributes']:_0x21ea17[_0xaca6('0x36')];if(_0x47150d[_0xaca6('0x37')][_0xaca6('0x44')]){_0x43eec7[_0xaca6('0x45')]=[{'all':!![]}];}_0x43eec7=_['merge']({},_0x43eec7,_0x47150d[_0xaca6('0x43')]);return db[_0xaca6('0x31')]['find'](_0x43eec7)[_0xaca6('0x29')](handleEntityNotFound(_0x512b7f,null))[_0xaca6('0x29')](respondWithResult(_0x512b7f,null))[_0xaca6('0x47')](handleError(_0x512b7f,null));};exports['create']=function(_0x9af9a9,_0x1a7295){return db['ChatInternalMessage']['create'](_0x9af9a9['body'],{})[_0xaca6('0x29')](respondWithResult(_0x1a7295,0xc9))[_0xaca6('0x47')](handleError(_0x1a7295,null));};exports['update']=function(_0x52db15,_0x38e1cd){if(_0x52db15[_0xaca6('0x48')]['id']){delete _0x52db15[_0xaca6('0x48')]['id'];}return db[_0xaca6('0x31')][_0xaca6('0x49')]({'where':{'id':_0x52db15[_0xaca6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38e1cd,null))[_0xaca6('0x29')](saveUpdates(_0x52db15[_0xaca6('0x48')],null))['then'](respondWithResult(_0x38e1cd,null))['catch'](handleError(_0x38e1cd,null));};exports[_0xaca6('0x2a')]=function(_0x2b3ab3,_0x494be1){return db[_0xaca6('0x31')][_0xaca6('0x49')]({'where':{'id':_0x2b3ab3[_0xaca6('0x4a')]['id']}})[_0xaca6('0x29')](handleEntityNotFound(_0x494be1,null))[_0xaca6('0x29')](removeEntity(_0x494be1,null))[_0xaca6('0x47')](handleError(_0x494be1,null));};exports['describe']=function(_0x5d60bd,_0x57a166){return db['ChatInternalMessage'][_0xaca6('0x4b')]()[_0xaca6('0x29')](respondWithResult(_0x57a166,null))[_0xaca6('0x47')](handleError(_0x57a166,null));};function wrapUser(_0x5bf707){return function(_0x1605df){var _0x1763bb=_0x5bf707['get']({'plain':!![]});_0x1763bb['messages']=[];if(_0x1605df){_0x1763bb[_0xaca6('0x4c')]=_0x1605df[_0xaca6('0x4d')];_0x1763bb[_0xaca6('0x4e')]=_0x1605df;}else{_0x1763bb['lastMessageAt']=moment(0x0)[_0xaca6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1763bb['lastMessage']={};}return _0x1763bb;};}exports[_0xaca6('0x50')]=function(_0xb50d23,_0x11740a,_0x2217a6){var _0x266031=[];return db[_0xaca6('0x51')]['findAll']({'where':{'role':[_0xaca6('0x52'),'admin',_0xaca6('0x53')]},'attributes':['id',_0xaca6('0x54'),'name',_0xaca6('0x55'),_0xaca6('0x56'),'internal',_0xaca6('0x57'),_0xaca6('0x58'),_0xaca6('0x59'),_0xaca6('0x5a')],'order':qs[_0xaca6('0x3e')](_0xaca6('0x5b')),'include':[{'model':db[_0xaca6('0x5c')],'as':_0xaca6('0x5d'),'attributes':['id','name',_0xaca6('0x34')],'through':{'attributes':[]}}]})[_0xaca6('0x29')](function(_0x5c3c51){if(_0x5c3c51){var _0x535fec=_0xb50d23['user'][_0xaca6('0x5e')]({'plain':!![]});if(!_0x535fec)throw new Error(_0xaca6('0x5f'));if(_0x535fec[_0xaca6('0x55')]===_0xaca6('0x53')){return db[_0xaca6('0x60')][_0xaca6('0x49')]({'where':{'name':'Agents','userProfileId':_0x535fec['userProfileId']},'raw':!![]})[_0xaca6('0x29')](function(_0xb61ad5){if(_0xb61ad5){if(_0xb61ad5['autoAssociation']===0x0){return db[_0xaca6('0x61')]['findAll']({'where':{'sectionId':_0xb61ad5['id']},'raw':!![]})[_0xaca6('0x29')](function(_0x575504){var _0x581f1a=[];if(_[_0xaca6('0x62')](_0x575504)){_0x581f1a=_[_0xaca6('0x40')](_0x5c3c51,function(_0x280593){if(_0x280593[_0xaca6('0x55')]!=='agent'){return _0x280593;}});return _0x581f1a;}else{for(var _0x3bde22=0x0;_0x3bde22<_0x5c3c51[_0xaca6('0x3c')];_0x3bde22++){var _0x2fdba1=_0x5c3c51[_0x3bde22];if(_0x2fdba1[_0xaca6('0x55')]===_0xaca6('0x52')){var _0x2b384d=_[_0xaca6('0x49')](_0x575504,function(_0x1f8b76){return _0x1f8b76[_0xaca6('0x63')]===_0x2fdba1['id'];});if(_0x2b384d)_0x581f1a['push'](_0x2fdba1);}else{_0x581f1a[_0xaca6('0x64')](_0x2fdba1);}}return _0x581f1a;}});}else{return _0x5c3c51;}}else{var _0xb11057=_[_0xaca6('0x40')](_0x5c3c51,function(_0x41999b){if(_0x41999b[_0xaca6('0x55')]!==_0xaca6('0x52')){return _0x41999b;}});return _0xb11057;}});}else{return _0x5c3c51;}}})[_0xaca6('0x29')](function(_0x241af8){var _0x219991=[];if(_0x241af8){_0x266031=_0x241af8;for(var _0x2ea282=0x0;_0x2ea282<_0x241af8[_0xaca6('0x3c')];_0x2ea282+=0x1){_0x266031[_0x2ea282][_0xaca6('0x65')]=[];_0x219991[_0xaca6('0x64')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0xb50d23['user']['id'],_0x241af8[_0x2ea282]['id']],'ToId':[_0xb50d23['user']['id'],_0x241af8[_0x2ea282]['id']],'ChatGroupId':null},'attributes':['id',_0xaca6('0x4d'),'FromId','ToId',_0xaca6('0x66'),_0xaca6('0x48')],'order':qs[_0xaca6('0x3e')](_0xaca6('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xaca6('0x29')](wrapUser(_0x241af8[_0x2ea282])));}return BPromise[_0xaca6('0x68')](_0x219991);}return[];})['then'](function(_0xa0d463){return{'rows':_0xa0d463,'count':_0xa0d463['length']};})[_0xaca6('0x29')](respondWithResult(_0x11740a,null))[_0xaca6('0x47')](handleError(_0x11740a,null));}; \ No newline at end of file +var _0x6572=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','end','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','rows','catch','show','params','include','merge','find','create','body','destroy','describe','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','user','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','resourceId','push','FromId','ToId','-createdAt','eml-format'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x6572,0x6f));var _0x2657=function(_0x35ef2a,_0x1be3b7){_0x35ef2a=_0x35ef2a-0x0;var _0x311ac2=_0x6572[_0x35ef2a];return _0x311ac2;};'use strict';var emlformat=require(_0x2657('0x0'));var rimraf=require(_0x2657('0x1'));var zipdir=require(_0x2657('0x2'));var jsonpatch=require(_0x2657('0x3'));var rp=require(_0x2657('0x4'));var moment=require(_0x2657('0x5'));var BPromise=require(_0x2657('0x6'));var Mustache=require(_0x2657('0x7'));var util=require('util');var path=require(_0x2657('0x8'));var sox=require(_0x2657('0x9'));var csv=require(_0x2657('0xa'));var ejs=require(_0x2657('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2657('0xc'));var jsforce=require(_0x2657('0xd'));var deskjs=require(_0x2657('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2657('0xf'));var Papa=require(_0x2657('0x10'));var Redis=require('ioredis');var authService=require(_0x2657('0x11'));var qs=require(_0x2657('0x12'));var as=require(_0x2657('0x13'));var hardwareService=require(_0x2657('0x14'));var logger=require(_0x2657('0x15'))(_0x2657('0x16'));var utils=require('../../config/utils');var config=require(_0x2657('0x17'));var licenseUtil=require(_0x2657('0x18'));var db=require(_0x2657('0x19'))['db'];config[_0x2657('0x1a')]=_[_0x2657('0x1b')](config['redis'],{'host':_0x2657('0x1c'),'port':0x18eb});var socket=require(_0x2657('0x1d'))(new Redis(config[_0x2657('0x1a')]));require(_0x2657('0x1e'))[_0x2657('0x1f')](socket);function respondWithStatusCode(_0x3111f3,_0x539712){_0x539712=_0x539712||0xcc;return function(_0x20293b){if(_0x20293b){return _0x3111f3[_0x2657('0x20')](_0x539712);}return _0x3111f3[_0x2657('0x21')](_0x539712)['end']();};}function respondWithResult(_0x395736,_0x2fa42e){_0x2fa42e=_0x2fa42e||0xc8;return function(_0x27723a){if(_0x27723a){return _0x395736[_0x2657('0x21')](_0x2fa42e)[_0x2657('0x22')](_0x27723a);}};}function respondWithFilteredResult(_0x3bae89,_0x4e09c6){return function(_0x2d40a8){if(_0x2d40a8){var _0x17b3f3=typeof _0x4e09c6['offset']===_0x2657('0x23')&&typeof _0x4e09c6[_0x2657('0x24')]===_0x2657('0x23');var _0x27be86=_0x2d40a8[_0x2657('0x25')];var _0x5849d5=_0x17b3f3?0x0:_0x4e09c6[_0x2657('0x26')];var _0x25b5a3=_0x17b3f3?_0x2d40a8[_0x2657('0x25')]:_0x4e09c6['offset']+_0x4e09c6['limit'];var _0x2b90d3;if(_0x25b5a3>=_0x27be86){_0x25b5a3=_0x27be86;_0x2b90d3=0xc8;}else{_0x2b90d3=0xce;}_0x3bae89['status'](_0x2b90d3);return _0x3bae89['set'](_0x2657('0x27'),_0x5849d5+'-'+_0x25b5a3+'/'+_0x27be86)[_0x2657('0x22')](_0x2d40a8);}return null;};}function patchUpdates(_0x417414){return function(_0x3d8262){try{jsonpatch['apply'](_0x3d8262,_0x417414,!![]);}catch(_0x4f0d24){return BPromise[_0x2657('0x28')](_0x4f0d24);}return _0x3d8262[_0x2657('0x29')]();};}function saveUpdates(_0x2d66ce,_0xff33dd){return function(_0x4991b8){if(_0x4991b8){return _0x4991b8[_0x2657('0x2a')](_0x2d66ce)[_0x2657('0x2b')](function(_0x5890af){return _0x5890af;});}return null;};}function removeEntity(_0x5a0e2f,_0x5ae019){return function(_0x374183){if(_0x374183){return _0x374183['destroy']()[_0x2657('0x2b')](function(){_0x5a0e2f[_0x2657('0x21')](0xcc)[_0x2657('0x2c')]();});}};}function handleEntityNotFound(_0x496361,_0x48292e){return function(_0x541b14){if(!_0x541b14){_0x496361[_0x2657('0x20')](0x194);}return _0x541b14;};}function handleError(_0x26a493,_0xe90d42){_0xe90d42=_0xe90d42||0x1f4;return function(_0xabadbb){logger['error'](_0xabadbb[_0x2657('0x2d')]);if(_0xabadbb[_0x2657('0x2e')]){delete _0xabadbb[_0x2657('0x2e')];}_0x26a493[_0x2657('0x21')](_0xe90d42)[_0x2657('0x2f')](_0xabadbb);};}exports[_0x2657('0x30')]=function(_0x12a035,_0x58ef5e){var _0x303a69={},_0x76304={},_0x4ab38d={'count':0x0,'rows':[]};var _0x379906=_['map'](db[_0x2657('0x31')][_0x2657('0x32')],function(_0x3a3cf6){return{'name':_0x3a3cf6[_0x2657('0x33')],'type':_0x3a3cf6[_0x2657('0x34')]['key']};});_0x76304[_0x2657('0x35')]=_[_0x2657('0x36')](_0x379906,_0x2657('0x2e'));_0x76304['query']=_[_0x2657('0x37')](_0x12a035['query']);_0x76304['filters']=_['intersection'](_0x76304[_0x2657('0x35')],_0x76304[_0x2657('0x38')]);_0x303a69[_0x2657('0x39')]=_[_0x2657('0x3a')](_0x76304[_0x2657('0x35')],qs[_0x2657('0x3b')](_0x12a035[_0x2657('0x38')][_0x2657('0x3b')]));_0x303a69[_0x2657('0x39')]=_0x303a69[_0x2657('0x39')]['length']?_0x303a69[_0x2657('0x39')]:_0x76304['model'];if(!_0x12a035[_0x2657('0x38')][_0x2657('0x3c')](_0x2657('0x3d'))){_0x303a69[_0x2657('0x24')]=qs[_0x2657('0x24')](_0x12a035[_0x2657('0x38')][_0x2657('0x24')]);_0x303a69[_0x2657('0x26')]=qs['offset'](_0x12a035[_0x2657('0x38')][_0x2657('0x26')]);}_0x303a69[_0x2657('0x3e')]=qs[_0x2657('0x3f')](_0x12a035[_0x2657('0x38')]['sort']);_0x303a69[_0x2657('0x40')]=qs[_0x2657('0x41')](_[_0x2657('0x42')](_0x12a035[_0x2657('0x38')],_0x76304[_0x2657('0x41')]),_0x379906);if(_0x12a035[_0x2657('0x38')]['filter']){_0x303a69[_0x2657('0x40')]=_['merge'](_0x303a69[_0x2657('0x40')],{'$or':_['map'](_0x379906,function(_0x3d265a){if(_0x3d265a[_0x2657('0x34')]!=='VIRTUAL'){var _0x156359={};_0x156359[_0x3d265a[_0x2657('0x2e')]]={'$like':'%'+_0x12a035[_0x2657('0x38')][_0x2657('0x43')]+'%'};return _0x156359;}})});}_0x303a69=_['merge']({},_0x303a69,_0x12a035[_0x2657('0x44')]);var _0x4a60b2={'where':_0x303a69[_0x2657('0x40')]};return db[_0x2657('0x31')]['count'](_0x4a60b2)[_0x2657('0x2b')](function(_0x4f43aa){_0x4ab38d[_0x2657('0x25')]=_0x4f43aa;if(_0x12a035[_0x2657('0x38')][_0x2657('0x45')]){_0x303a69['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x303a69);})[_0x2657('0x2b')](function(_0x35d967){_0x4ab38d[_0x2657('0x46')]=_0x35d967;return _0x4ab38d;})[_0x2657('0x2b')](respondWithFilteredResult(_0x58ef5e,_0x303a69))[_0x2657('0x47')](handleError(_0x58ef5e,null));};exports[_0x2657('0x48')]=function(_0xabb657,_0x551891){var _0x51b0f4={'raw':!![],'where':{'id':_0xabb657[_0x2657('0x49')]['id']}},_0x500dcf={};_0x500dcf[_0x2657('0x35')]=_[_0x2657('0x37')](db[_0x2657('0x31')]['rawAttributes']);_0x500dcf[_0x2657('0x38')]=_[_0x2657('0x37')](_0xabb657[_0x2657('0x38')]);_0x500dcf[_0x2657('0x41')]=_['intersection'](_0x500dcf[_0x2657('0x35')],_0x500dcf[_0x2657('0x38')]);_0x51b0f4[_0x2657('0x39')]=_[_0x2657('0x3a')](_0x500dcf[_0x2657('0x35')],qs[_0x2657('0x3b')](_0xabb657[_0x2657('0x38')]['fields']));_0x51b0f4[_0x2657('0x39')]=_0x51b0f4[_0x2657('0x39')]['length']?_0x51b0f4[_0x2657('0x39')]:_0x500dcf[_0x2657('0x35')];if(_0xabb657[_0x2657('0x38')]['includeAll']){_0x51b0f4[_0x2657('0x4a')]=[{'all':!![]}];}_0x51b0f4=_[_0x2657('0x4b')]({},_0x51b0f4,_0xabb657[_0x2657('0x44')]);return db[_0x2657('0x31')][_0x2657('0x4c')](_0x51b0f4)[_0x2657('0x2b')](handleEntityNotFound(_0x551891,null))['then'](respondWithResult(_0x551891,null))[_0x2657('0x47')](handleError(_0x551891,null));};exports[_0x2657('0x4d')]=function(_0x4548ac,_0x288b42){return db[_0x2657('0x31')][_0x2657('0x4d')](_0x4548ac[_0x2657('0x4e')],{})['then'](respondWithResult(_0x288b42,0xc9))[_0x2657('0x47')](handleError(_0x288b42,null));};exports['update']=function(_0x412e04,_0x40ec50){if(_0x412e04['body']['id']){delete _0x412e04[_0x2657('0x4e')]['id'];}return db['ChatInternalMessage'][_0x2657('0x4c')]({'where':{'id':_0x412e04[_0x2657('0x49')]['id']}})['then'](handleEntityNotFound(_0x40ec50,null))[_0x2657('0x2b')](saveUpdates(_0x412e04[_0x2657('0x4e')],null))['then'](respondWithResult(_0x40ec50,null))[_0x2657('0x47')](handleError(_0x40ec50,null));};exports[_0x2657('0x4f')]=function(_0xdf57e,_0x41aa64){return db[_0x2657('0x31')][_0x2657('0x4c')]({'where':{'id':_0xdf57e[_0x2657('0x49')]['id']}})[_0x2657('0x2b')](handleEntityNotFound(_0x41aa64,null))[_0x2657('0x2b')](removeEntity(_0x41aa64,null))['catch'](handleError(_0x41aa64,null));};exports[_0x2657('0x50')]=function(_0x10faff,_0x4db85d){return db['ChatInternalMessage'][_0x2657('0x50')]()[_0x2657('0x2b')](respondWithResult(_0x4db85d,null))['catch'](handleError(_0x4db85d,null));};function wrapUser(_0x3ba3b1){return function(_0x121904){var _0x13b339=_0x3ba3b1['get']({'plain':!![]});_0x13b339[_0x2657('0x51')]=[];if(_0x121904){_0x13b339[_0x2657('0x52')]=_0x121904['createdAt'];_0x13b339[_0x2657('0x53')]=_0x121904;}else{_0x13b339[_0x2657('0x52')]=moment(0x0)['format'](_0x2657('0x54'));_0x13b339[_0x2657('0x53')]={};}return _0x13b339;};}exports[_0x2657('0x55')]=function(_0x27e189,_0x500d5f,_0x7652d2){var _0x496591=[];return db[_0x2657('0x56')][_0x2657('0x57')]({'where':{'role':[_0x2657('0x58'),_0x2657('0x59'),_0x2657('0x5a')]},'attributes':['id','fullname',_0x2657('0x2e'),_0x2657('0x5b'),_0x2657('0x5c'),_0x2657('0x5d'),_0x2657('0x5e'),_0x2657('0x5f'),'allowmessenger',_0x2657('0x60')],'order':qs[_0x2657('0x3f')](_0x2657('0x61')),'include':[{'model':db[_0x2657('0x62')],'as':_0x2657('0x63'),'attributes':['id',_0x2657('0x2e'),_0x2657('0x34')],'through':{'attributes':[]}}]})[_0x2657('0x2b')](function(_0x125274){if(_0x125274){var _0x1100e0=_0x27e189[_0x2657('0x5a')][_0x2657('0x64')]({'plain':!![]});if(!_0x1100e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1100e0[_0x2657('0x5b')]==='user'){return db[_0x2657('0x65')][_0x2657('0x4c')]({'where':{'name':'Agents','userProfileId':_0x1100e0[_0x2657('0x66')]},'raw':!![]})['then'](function(_0x2806d4){if(_0x2806d4){if(_0x2806d4[_0x2657('0x67')]===0x0){return db[_0x2657('0x68')]['findAll']({'where':{'sectionId':_0x2806d4['id']},'raw':!![]})[_0x2657('0x2b')](function(_0x44b6eb){var _0x5da0a9=[];if(_[_0x2657('0x69')](_0x44b6eb)){_0x5da0a9=_[_0x2657('0x43')](_0x125274,function(_0x41a7e2){if(_0x41a7e2['role']!==_0x2657('0x58')){return _0x41a7e2;}});return _0x5da0a9;}else{for(var _0x348163=0x0;_0x348163<_0x125274[_0x2657('0x6a')];_0x348163++){var _0x335ddc=_0x125274[_0x348163];if(_0x335ddc[_0x2657('0x5b')]===_0x2657('0x58')){var _0x57c6e4=_[_0x2657('0x4c')](_0x44b6eb,function(_0x8a6250){return _0x8a6250[_0x2657('0x6b')]===_0x335ddc['id'];});if(_0x57c6e4)_0x5da0a9[_0x2657('0x6c')](_0x335ddc);}else{_0x5da0a9[_0x2657('0x6c')](_0x335ddc);}}return _0x5da0a9;}});}else{return _0x125274;}}else{var _0xe769b1=_['filter'](_0x125274,function(_0x44222d){if(_0x44222d[_0x2657('0x5b')]!==_0x2657('0x58')){return _0x44222d;}});return _0xe769b1;}});}else{return _0x125274;}}})[_0x2657('0x2b')](function(_0xb6e3ec){var _0x9ac68f=[];if(_0xb6e3ec){_0x496591=_0xb6e3ec;for(var _0x56eaa0=0x0;_0x56eaa0<_0xb6e3ec[_0x2657('0x6a')];_0x56eaa0+=0x1){_0x496591[_0x56eaa0]['messages']=[];_0x9ac68f[_0x2657('0x6c')](db[_0x2657('0x31')]['find']({'where':{'FromId':[_0x27e189['user']['id'],_0xb6e3ec[_0x56eaa0]['id']],'ToId':[_0x27e189[_0x2657('0x5a')]['id'],_0xb6e3ec[_0x56eaa0]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2657('0x6d'),_0x2657('0x6e'),'read','body'],'order':qs[_0x2657('0x3f')](_0x2657('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2657('0x2b')](wrapUser(_0xb6e3ec[_0x56eaa0])));}return BPromise['all'](_0x9ac68f);}return[];})['then'](function(_0x22c641){return{'rows':_0x22c641,'count':_0x22c641[_0x2657('0x6a')]};})['then'](respondWithResult(_0x500d5f,null))[_0x2657('0x47')](handleError(_0x500d5f,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 28f9eff..007b3de 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 _0x61da=['events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3d1c92,_0x2f03fb){var _0x4de912=function(_0x19fa18){while(--_0x19fa18){_0x3d1c92['push'](_0x3d1c92['shift']());}};_0x4de912(++_0x2f03fb);}(_0x61da,0x10e));var _0xa61d=function(_0x1ba947,_0x33732e){_0x1ba947=_0x1ba947-0x0;var _0x571b04=_0x61da[_0x1ba947];return _0x571b04;};'use strict';var EventEmitter=require(_0xa61d('0x0'));var ChatInternalMessage=require(_0xa61d('0x1'))['db'][_0xa61d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa61d('0x3'),'afterUpdate':_0xa61d('0x4'),'afterDestroy':_0xa61d('0x5')};function emitEvent(_0x5bbb4a){return function(_0x33df29,_0x179d97,_0x4206a2){ChatInternalMessageEvents['emit'](_0x5bbb4a+':'+_0x33df29['id'],_0x33df29);ChatInternalMessageEvents[_0xa61d('0x6')](_0x5bbb4a,_0x33df29);_0x4206a2(null);};}for(var e in events){if(events[_0xa61d('0x7')](e)){var event=events[e];ChatInternalMessage[_0xa61d('0x8')](e,emitEvent(event));}}module[_0xa61d('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe667=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x12f49c,_0x1f4320){var _0x3ccf94=function(_0x163ffb){while(--_0x163ffb){_0x12f49c['push'](_0x12f49c['shift']());}};_0x3ccf94(++_0x1f4320);}(_0xe667,0x17c));var _0x7e66=function(_0x1e3ee6,_0x397a18){_0x1e3ee6=_0x1e3ee6-0x0;var _0x46f31d=_0xe667[_0x1e3ee6];return _0x46f31d;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x7e66('0x0'))['db'][_0x7e66('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x7e66('0x2')](0x0);var events={'afterCreate':_0x7e66('0x3'),'afterUpdate':_0x7e66('0x4'),'afterDestroy':_0x7e66('0x5')};function emitEvent(_0x443c7e){return function(_0x354f57,_0x176db3,_0x2f8f0b){ChatInternalMessageEvents[_0x7e66('0x6')](_0x443c7e+':'+_0x354f57['id'],_0x354f57);ChatInternalMessageEvents[_0x7e66('0x6')](_0x443c7e,_0x354f57);_0x2f8f0b(null);};}for(var e in events){if(events[_0x7e66('0x7')](e)){var event=events[e];ChatInternalMessage[_0x7e66('0x8')](e,emitEvent(event));}}module[_0x7e66('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 709de51..5e6bd65 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 _0x39d8=['utf8mb4','utf8mb4_unicode_ci','util','api','request-promise','path','../../config/environment','exports','ChatInternalMessage'];(function(_0x7cb09b,_0x3cc673){var _0x25bd1e=function(_0x589277){while(--_0x589277){_0x7cb09b['push'](_0x7cb09b['shift']());}};_0x25bd1e(++_0x3cc673);}(_0x39d8,0x6e));var _0x839d=function(_0x325654,_0x4e6fe1){_0x325654=_0x325654-0x0;var _0x994fc7=_0x39d8[_0x325654];return _0x994fc7;};'use strict';var _=require('lodash');var util=require(_0x839d('0x0'));var logger=require('../../config/logger')(_0x839d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x839d('0x2'));var fs=require('fs');var path=require(_0x839d('0x3'));var rimraf=require('rimraf');var config=require(_0x839d('0x4'));var attributes=require('./chatInternalMessage.attributes');module[_0x839d('0x5')]=function(_0x115a91,_0x4b8813){return _0x115a91['define'](_0x839d('0x6'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x839d('0x7'),'collate':_0x839d('0x8')});}; \ No newline at end of file +var _0x1986=['rimraf','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x31fc05,_0x3bc3e2){var _0x534dc2=function(_0x57c99e){while(--_0x57c99e){_0x31fc05['push'](_0x31fc05['shift']());}};_0x534dc2(++_0x3bc3e2);}(_0x1986,0x1b3));var _0x6198=function(_0x5ed36d,_0x5c6f17){_0x5ed36d=_0x5ed36d-0x0;var _0x590d73=_0x1986[_0x5ed36d];return _0x590d73;};'use strict';var _=require(_0x6198('0x0'));var util=require(_0x6198('0x1'));var logger=require(_0x6198('0x2'))('api');var moment=require(_0x6198('0x3'));var BPromise=require(_0x6198('0x4'));var rp=require(_0x6198('0x5'));var fs=require('fs');var path=require(_0x6198('0x6'));var rimraf=require(_0x6198('0x7'));var config=require(_0x6198('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0x6198('0x9')]=function(_0x1f3cd1,_0x68214d){return _0x1f3cd1[_0x6198('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6198('0xb'),'collate':_0x6198('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3e0eca1..546ba70 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 _0x4291=['redis','socket.io-emitter','./chatInternalMessage.socket','register','then','info','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x5f5d76,_0x28a4f5){var _0x1f4604=function(_0xa96bd4){while(--_0xa96bd4){_0x5f5d76['push'](_0x5f5d76['shift']());}};_0x1f4604(++_0x28a4f5);}(_0x4291,0x1b3));var _0x1429=function(_0x1d1d64,_0x237d16){_0x1d1d64=_0x1d1d64-0x0;var _0x6052b4=_0x4291[_0x1d1d64];return _0x6052b4;};'use strict';var _=require(_0x1429('0x0'));var util=require(_0x1429('0x1'));var moment=require('moment');var BPromise=require(_0x1429('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1429('0x3'));var db=require(_0x1429('0x4'))['db'];var utils=require(_0x1429('0x5'));var logger=require(_0x1429('0x6'))(_0x1429('0x7'));var config=require(_0x1429('0x8'));var jayson=require(_0x1429('0x9'));var client=jayson[_0x1429('0xa')][_0x1429('0xb')]({'port':0x232a});config['redis']=_[_0x1429('0xc')](config[_0x1429('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1429('0xe'))(new Redis(config[_0x1429('0xd')]));require(_0x1429('0xf'))[_0x1429('0x10')](socket);function respondWithRpcPromise(_0x577ec2,_0x3c4b77,_0x63a7f){return new BPromise(function(_0x3d8cac,_0x2bc975){return client['request'](_0x577ec2,_0x63a7f)[_0x1429('0x11')](function(_0x4a8608){logger[_0x1429('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3c4b77,_0x1429('0x13'));logger[_0x1429('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3c4b77,'request\x20sent',JSON[_0x1429('0x15')](_0x4a8608));if(_0x4a8608['error']){if(_0x4a8608[_0x1429('0x16')][_0x1429('0x17')]===0x1f4){logger['error'](_0x1429('0x18'),_0x3c4b77,_0x4a8608[_0x1429('0x16')][_0x1429('0x19')]);return _0x2bc975(_0x4a8608[_0x1429('0x16')][_0x1429('0x19')]);}logger[_0x1429('0x16')](_0x1429('0x18'),_0x3c4b77,_0x4a8608[_0x1429('0x16')][_0x1429('0x19')]);return _0x3d8cac(_0x4a8608[_0x1429('0x16')][_0x1429('0x19')]);}else{logger[_0x1429('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3c4b77,'request\x20sent');_0x3d8cac(_0x4a8608[_0x1429('0x1a')]['message']);}})[_0x1429('0x1b')](function(_0x45ab39){logger[_0x1429('0x16')](_0x1429('0x18'),_0x3c4b77,_0x45ab39);_0x2bc975(_0x45ab39);});});} \ No newline at end of file +var _0x004c=['request','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x004c,0x1de));var _0xc004=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x004c[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc004('0x0'));var BPromise=require(_0xc004('0x1'));var rs=require(_0xc004('0x2'));var fs=require('fs');var Redis=require(_0xc004('0x3'));var db=require(_0xc004('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc004('0x5'))(_0xc004('0x6'));var config=require('../../config/environment');var jayson=require(_0xc004('0x7'));var client=jayson[_0xc004('0x8')][_0xc004('0x9')]({'port':0x232a});config[_0xc004('0xa')]=_[_0xc004('0xb')](config[_0xc004('0xa')],{'host':_0xc004('0xc'),'port':0x18eb});var socket=require(_0xc004('0xd'))(new Redis(config[_0xc004('0xa')]));require(_0xc004('0xe'))[_0xc004('0xf')](socket);function respondWithRpcPromise(_0x158e5b,_0x571ed5,_0x33cbbf){return new BPromise(function(_0x36ac4c,_0x8ac9e6){return client[_0xc004('0x10')](_0x158e5b,_0x33cbbf)['then'](function(_0x517dca){logger[_0xc004('0x11')](_0xc004('0x12'),_0x571ed5,'request\x20sent');logger[_0xc004('0x13')](_0xc004('0x14'),_0x571ed5,_0xc004('0x15'),JSON[_0xc004('0x16')](_0x517dca));if(_0x517dca['error']){if(_0x517dca[_0xc004('0x17')][_0xc004('0x18')]===0x1f4){logger[_0xc004('0x17')](_0xc004('0x12'),_0x571ed5,_0x517dca[_0xc004('0x17')][_0xc004('0x19')]);return _0x8ac9e6(_0x517dca[_0xc004('0x17')][_0xc004('0x19')]);}logger['error'](_0xc004('0x12'),_0x571ed5,_0x517dca[_0xc004('0x17')][_0xc004('0x19')]);return _0x36ac4c(_0x517dca[_0xc004('0x17')][_0xc004('0x19')]);}else{logger[_0xc004('0x11')](_0xc004('0x12'),_0x571ed5,_0xc004('0x15'));_0x36ac4c(_0x517dca['result'][_0xc004('0x19')]);}})['catch'](function(_0x48f1fc){logger[_0xc004('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x571ed5,_0x48f1fc);_0x8ac9e6(_0x48f1fc);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 844089a..6a0bd3a 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 _0x3939=['remove','update','emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x22b118,_0xadc129){var _0xf86af4=function(_0x3b8543){while(--_0x3b8543){_0x22b118['push'](_0x22b118['shift']());}};_0xf86af4(++_0xadc129);}(_0x3939,0x180));var _0x9393=function(_0x3075fb,_0x1cb570){_0x3075fb=_0x3075fb-0x0;var _0x23f519=_0x3939[_0x3075fb];return _0x23f519;};'use strict';var ChatInternalMessageEvents=require(_0x9393('0x0'));var events=['save',_0x9393('0x1'),_0x9393('0x2')];function createListener(_0x4f369a,_0x2853b5){return function(_0x440da7){_0x2853b5[_0x9393('0x3')](_0x4f369a,_0x440da7);};}function removeListener(_0x4f3a0e,_0x2a5d5e){return function(){ChatInternalMessageEvents[_0x9393('0x4')](_0x4f3a0e,_0x2a5d5e);};}exports['register']=function(_0x5b5ba1){for(var _0x4bd7dd=0x0,_0x5eebbd=events[_0x9393('0x5')];_0x4bd7dd<_0x5eebbd;_0x4bd7dd++){var _0x17c76b=events[_0x4bd7dd];var _0x107d26=createListener(_0x9393('0x6')+_0x17c76b,_0x5b5ba1);ChatInternalMessageEvents['on'](_0x17c76b,_0x107d26);}}; \ No newline at end of file +var _0x9122=['update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x213f3d,_0x31c31f){var _0x238251=function(_0x222903){while(--_0x222903){_0x213f3d['push'](_0x213f3d['shift']());}};_0x238251(++_0x31c31f);}(_0x9122,0x1e1));var _0x2912=function(_0x58acce,_0x257598){_0x58acce=_0x58acce-0x0;var _0x8ebf7f=_0x9122[_0x58acce];return _0x8ebf7f;};'use strict';var ChatInternalMessageEvents=require(_0x2912('0x0'));var events=['save',_0x2912('0x1'),_0x2912('0x2')];function createListener(_0x20120b,_0x161710){return function(_0x431eab){_0x161710[_0x2912('0x3')](_0x20120b,_0x431eab);};}function removeListener(_0x552808,_0x4fa811){return function(){ChatInternalMessageEvents['removeListener'](_0x552808,_0x4fa811);};}exports[_0x2912('0x4')]=function(_0xef416){for(var _0x4b71a0=0x0,_0x3ec2c7=events[_0x2912('0x5')];_0x4b71a0<_0x3ec2c7;_0x4b71a0++){var _0xb30c28=events[_0x4b71a0];var _0x4ed3fb=createListener(_0x2912('0x6')+_0xb30c28,_0xef416);ChatInternalMessageEvents['on'](_0xb30c28,_0x4ed3fb);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 702c5e4..aad8439 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 _0xd7da=['index','/users','getUsers','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0xd7da,0xa9));var _0xad7d=function(_0x495c47,_0x20e4e1){_0x495c47=_0x495c47-0x0;var _0x204106=_0xd7da[_0x495c47];return _0x204106;};'use strict';var multer=require(_0xad7d('0x0'));var util=require(_0xad7d('0x1'));var path=require(_0xad7d('0x2'));var timeout=require(_0xad7d('0x3'));var express=require(_0xad7d('0x4'));var router=express[_0xad7d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xad7d('0x6'));var config=require(_0xad7d('0x7'));var controller=require(_0xad7d('0x8'));router[_0xad7d('0x9')]('/',auth[_0xad7d('0xa')](),controller[_0xad7d('0xb')]);router['get']('/describe',auth[_0xad7d('0xa')](),controller['describe']);router['get'](_0xad7d('0xc'),auth[_0xad7d('0xa')](),controller[_0xad7d('0xd')]);router[_0xad7d('0x9')](_0xad7d('0xe'),auth['isAuthenticated'](),controller[_0xad7d('0xf')]);router[_0xad7d('0x10')]('/',auth[_0xad7d('0xa')](),controller['create']);router[_0xad7d('0x11')](_0xad7d('0xe'),controller['update']);router['delete'](_0xad7d('0xe'),auth['isAuthenticated'](),controller[_0xad7d('0x12')]);module[_0xad7d('0x13')]=router; \ No newline at end of file +var _0x44b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','describe','getUsers','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x9c7561,_0x46c559){var _0x468980=function(_0x1f771c){while(--_0x1f771c){_0x9c7561['push'](_0x9c7561['shift']());}};_0x468980(++_0x46c559);}(_0x44b3,0x1c7));var _0x344b=function(_0x4975d0,_0x5d4405){_0x4975d0=_0x4975d0-0x0;var _0x3cff51=_0x44b3[_0x4975d0];return _0x3cff51;};'use strict';var multer=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var path=require(_0x344b('0x2'));var timeout=require('connect-timeout');var express=require(_0x344b('0x3'));var router=express[_0x344b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x344b('0x5'));var interaction=require(_0x344b('0x6'));var config=require(_0x344b('0x7'));var controller=require(_0x344b('0x8'));router[_0x344b('0x9')]('/',auth[_0x344b('0xa')](),controller['index']);router['get']('/describe',auth[_0x344b('0xa')](),controller[_0x344b('0xb')]);router['get']('/users',auth['isAuthenticated'](),controller[_0x344b('0xc')]);router[_0x344b('0x9')](_0x344b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x344b('0xe')]('/',auth[_0x344b('0xa')](),controller['create']);router[_0x344b('0xf')](_0x344b('0xd'),controller[_0x344b('0x10')]);router[_0x344b('0x11')](_0x344b('0xd'),auth[_0x344b('0xa')](),controller[_0x344b('0x12')]);module[_0x344b('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b01a46b..cc4f49f 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 _0xa2cb=['exports','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa2cb,0x7d));var _0xba2c=function(_0x5ad579,_0x479dad){_0x5ad579=_0x5ad579-0x0;var _0x33c479=_0xa2cb[_0x5ad579];return _0x33c479;};'use strict';var Sequelize=require(_0xba2c('0x0'));module[_0xba2c('0x1')]={'body':{'type':Sequelize['TEXT'](_0xba2c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xba2c('0x4')]('in',_0xba2c('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7334=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x3d5f64,_0x34b024){var _0x57ca5d=function(_0x126284){while(--_0x126284){_0x3d5f64['push'](_0x3d5f64['shift']());}};_0x57ca5d(++_0x34b024);}(_0x7334,0x184));var _0x4733=function(_0x3fb2ff,_0x32db67){_0x3fb2ff=_0x3fb2ff-0x0;var _0x105904=_0x7334[_0x3fb2ff];return _0x105904;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'body':{'type':Sequelize[_0x4733('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4733('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4733('0x4')),'defaultValue':_0x4733('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4733('0x5')]},'providerName':{'type':Sequelize[_0x4733('0x6')]},'providerResponse':{'type':Sequelize[_0x4733('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9c6b599..28994fe 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 _0x199b=['moment','mustache','util','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','name','send','index','map','rawAttributes','fieldName','type','key','keys','model','query','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','ChatMessage','includeAll','include','findAll','rows','show','intersection','length','options','find','create','body','params','destroy','describe','chat-interactions','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','interaction','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','SIP/%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1bf85e,_0xac3ba5){var _0x5423fa=function(_0x422e38){while(--_0x422e38){_0x1bf85e['push'](_0x1bf85e['shift']());}};_0x5423fa(++_0xac3ba5);}(_0x199b,0x190));var _0xb199=function(_0x3ddb9d,_0x477240){_0x3ddb9d=_0x3ddb9d-0x0;var _0x3147=_0x199b[_0x3ddb9d];return _0x3147;};'use strict';var emlformat=require(_0xb199('0x0'));var rimraf=require(_0xb199('0x1'));var zipdir=require(_0xb199('0x2'));var jsonpatch=require(_0xb199('0x3'));var rp=require(_0xb199('0x4'));var moment=require(_0xb199('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb199('0x6'));var util=require(_0xb199('0x7'));var path=require('path');var sox=require(_0xb199('0x8'));var csv=require('to-csv');var ejs=require(_0xb199('0x9'));var fs=require('fs');var fs_extra=require(_0xb199('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb199('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb199('0xc'));var toCsv=require(_0xb199('0xd'));var querystring=require(_0xb199('0xe'));var Papa=require(_0xb199('0xf'));var Redis=require(_0xb199('0x10'));var authService=require(_0xb199('0x11'));var qs=require(_0xb199('0x12'));var as=require(_0xb199('0x13'));var hardwareService=require(_0xb199('0x14'));var logger=require(_0xb199('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb199('0x16'));var licenseUtil=require(_0xb199('0x17'));var db=require('../../mysqldb')['db'];config[_0xb199('0x18')]=_[_0xb199('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb199('0x1a'))(new Redis(config[_0xb199('0x18')]));require('./chatMessage.socket')[_0xb199('0x1b')](socket);var jayson=require(_0xb199('0x1c'));var client=jayson[_0xb199('0x1d')][_0xb199('0x1e')]({'port':0x232c});var client9002=jayson[_0xb199('0x1d')][_0xb199('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x463116,_0x561b6a,_0x55bd92,_0x492b3a){return new BPromise(function(_0x38788c,_0x359442){var _0x205007=_0x492b3a||client;return _0x205007[_0xb199('0x1f')](_0x463116,_0x55bd92)['then'](function(_0x9962c5){logger[_0xb199('0x20')](_0xb199('0x21'),_0x561b6a,_0xb199('0x22'));logger[_0xb199('0x23')](_0xb199('0x24'),_0x561b6a,'request\x20sent',JSON[_0xb199('0x25')](_0x9962c5));if(_0x9962c5['error']){if(_0x9962c5['error'][_0xb199('0x26')]===0x1f4){logger[_0xb199('0x27')](_0xb199('0x21'),_0x561b6a,_0x9962c5[_0xb199('0x27')]['message']);return _0x359442(_0x9962c5[_0xb199('0x27')][_0xb199('0x28')]);}logger[_0xb199('0x27')](_0xb199('0x21'),_0x561b6a,_0x9962c5['error'][_0xb199('0x28')]);return _0x38788c(_0x9962c5[_0xb199('0x27')]['message']);}else{logger[_0xb199('0x20')](_0xb199('0x21'),_0x561b6a,_0xb199('0x22'));_0x38788c(_0x9962c5[_0xb199('0x29')][_0xb199('0x28')]);}})[_0xb199('0x2a')](function(_0x5d5d9b){logger['error'](_0xb199('0x21'),_0x561b6a,_0x5d5d9b);_0x359442(_0x5d5d9b);});});}function respondWithStatusCode(_0x204f93,_0xdf0601){_0xdf0601=_0xdf0601||0xcc;return function(_0x153ade){if(_0x153ade){return _0x204f93[_0xb199('0x2b')](_0xdf0601);}return _0x204f93[_0xb199('0x2c')](_0xdf0601)[_0xb199('0x2d')]();};}function respondWithResult(_0x503c6f,_0x2ca976){_0x2ca976=_0x2ca976||0xc8;return function(_0x5284ea){if(_0x5284ea){return _0x503c6f[_0xb199('0x2c')](_0x2ca976)[_0xb199('0x2e')](_0x5284ea);}};}function respondWithFilteredResult(_0x395a76,_0x99feb5){return function(_0x4ea50c){if(_0x4ea50c){var _0x4483d1=typeof _0x99feb5[_0xb199('0x2f')]===_0xb199('0x30')&&typeof _0x99feb5[_0xb199('0x31')]===_0xb199('0x30');var _0x4cb3c4=_0x4ea50c['count'];var _0x26ddd8=_0x4483d1?0x0:_0x99feb5[_0xb199('0x2f')];var _0x151b80=_0x4483d1?_0x4ea50c[_0xb199('0x32')]:_0x99feb5[_0xb199('0x2f')]+_0x99feb5[_0xb199('0x31')];var _0x4b6ec6;if(_0x151b80>=_0x4cb3c4){_0x151b80=_0x4cb3c4;_0x4b6ec6=0xc8;}else{_0x4b6ec6=0xce;}_0x395a76[_0xb199('0x2c')](_0x4b6ec6);return _0x395a76[_0xb199('0x33')]('Content-Range',_0x26ddd8+'-'+_0x151b80+'/'+_0x4cb3c4)[_0xb199('0x2e')](_0x4ea50c);}return null;};}function patchUpdates(_0x5c4db1){return function(_0x3d5c9c){try{jsonpatch[_0xb199('0x34')](_0x3d5c9c,_0x5c4db1,!![]);}catch(_0x52fa8f){return BPromise['reject'](_0x52fa8f);}return _0x3d5c9c[_0xb199('0x35')]();};}function saveUpdates(_0xc979e4,_0xa67733){return function(_0x1451d2){if(_0x1451d2){return _0x1451d2[_0xb199('0x36')](_0xc979e4)[_0xb199('0x37')](function(_0x37276e){return _0x37276e;});}return null;};}function removeEntity(_0x5031e7,_0x3dcec0){return function(_0x2eef15){if(_0x2eef15){return _0x2eef15['destroy']()[_0xb199('0x37')](function(){_0x5031e7['status'](0xcc)[_0xb199('0x2d')]();});}};}function handleEntityNotFound(_0x307be6,_0x4be3e9){return function(_0x33d845){if(!_0x33d845){_0x307be6[_0xb199('0x2b')](0x194);}return _0x33d845;};}function handleError(_0x384fba,_0x129b8b){_0x129b8b=_0x129b8b||0x1f4;return function(_0x36d5e9){logger[_0xb199('0x27')](_0x36d5e9['stack']);if(_0x36d5e9[_0xb199('0x38')]){delete _0x36d5e9['name'];}_0x384fba[_0xb199('0x2c')](_0x129b8b)[_0xb199('0x39')](_0x36d5e9);};}exports[_0xb199('0x3a')]=function(_0x456319,_0x349c50){var _0x157e18={},_0x31328f={},_0x4e4edf={'count':0x0,'rows':[]};var _0xc3794a=_[_0xb199('0x3b')](db['ChatMessage'][_0xb199('0x3c')],function(_0x5e6883){return{'name':_0x5e6883[_0xb199('0x3d')],'type':_0x5e6883[_0xb199('0x3e')][_0xb199('0x3f')]};});_0x31328f['model']=_[_0xb199('0x3b')](_0xc3794a,'name');_0x31328f['query']=_[_0xb199('0x40')](_0x456319['query']);_0x31328f['filters']=_['intersection'](_0x31328f[_0xb199('0x41')],_0x31328f[_0xb199('0x42')]);_0x157e18['attributes']=_['intersection'](_0x31328f[_0xb199('0x41')],qs[_0xb199('0x43')](_0x456319[_0xb199('0x42')][_0xb199('0x43')]));_0x157e18[_0xb199('0x44')]=_0x157e18[_0xb199('0x44')]['length']?_0x157e18['attributes']:_0x31328f[_0xb199('0x41')];if(!_0x456319[_0xb199('0x42')]['hasOwnProperty']('nolimit')){_0x157e18[_0xb199('0x31')]=qs[_0xb199('0x31')](_0x456319['query']['limit']);_0x157e18['offset']=qs[_0xb199('0x2f')](_0x456319[_0xb199('0x42')][_0xb199('0x2f')]);}_0x157e18[_0xb199('0x45')]=qs[_0xb199('0x46')](_0x456319['query'][_0xb199('0x46')]);_0x157e18[_0xb199('0x47')]=qs[_0xb199('0x48')](_[_0xb199('0x49')](_0x456319[_0xb199('0x42')],_0x31328f[_0xb199('0x48')]),_0xc3794a);if(_0x456319[_0xb199('0x42')][_0xb199('0x4a')]){_0x157e18['where']=_[_0xb199('0x4b')](_0x157e18[_0xb199('0x47')],{'$or':_['map'](_0xc3794a,function(_0xf1d1a2){if(_0xf1d1a2[_0xb199('0x3e')]!==_0xb199('0x4c')){var _0x581af2={};_0x581af2[_0xf1d1a2[_0xb199('0x38')]]={'$like':'%'+_0x456319['query'][_0xb199('0x4a')]+'%'};return _0x581af2;}})});}_0x157e18=_[_0xb199('0x4b')]({},_0x157e18,_0x456319['options']);var _0x55f68e={'where':_0x157e18['where']};return db[_0xb199('0x4d')][_0xb199('0x32')](_0x55f68e)[_0xb199('0x37')](function(_0x30c7cf){_0x4e4edf[_0xb199('0x32')]=_0x30c7cf;if(_0x456319[_0xb199('0x42')][_0xb199('0x4e')]){_0x157e18[_0xb199('0x4f')]=[{'all':!![]}];}return db[_0xb199('0x4d')][_0xb199('0x50')](_0x157e18);})[_0xb199('0x37')](function(_0x543fb8){_0x4e4edf[_0xb199('0x51')]=_0x543fb8;return _0x4e4edf;})['then'](respondWithFilteredResult(_0x349c50,_0x157e18))['catch'](handleError(_0x349c50,null));};exports[_0xb199('0x52')]=function(_0x3ab3d0,_0xccfb65){var _0x3f42df={'raw':!![],'where':{'id':_0x3ab3d0['params']['id']}},_0x31e608={};_0x31e608['model']=_[_0xb199('0x40')](db[_0xb199('0x4d')]['rawAttributes']);_0x31e608[_0xb199('0x42')]=_[_0xb199('0x40')](_0x3ab3d0[_0xb199('0x42')]);_0x31e608[_0xb199('0x48')]=_[_0xb199('0x53')](_0x31e608['model'],_0x31e608[_0xb199('0x42')]);_0x3f42df[_0xb199('0x44')]=_[_0xb199('0x53')](_0x31e608['model'],qs[_0xb199('0x43')](_0x3ab3d0[_0xb199('0x42')][_0xb199('0x43')]));_0x3f42df[_0xb199('0x44')]=_0x3f42df[_0xb199('0x44')][_0xb199('0x54')]?_0x3f42df[_0xb199('0x44')]:_0x31e608[_0xb199('0x41')];if(_0x3ab3d0['query'][_0xb199('0x4e')]){_0x3f42df[_0xb199('0x4f')]=[{'all':!![]}];}_0x3f42df=_[_0xb199('0x4b')]({},_0x3f42df,_0x3ab3d0[_0xb199('0x55')]);return db['ChatMessage'][_0xb199('0x56')](_0x3f42df)[_0xb199('0x37')](handleEntityNotFound(_0xccfb65,null))[_0xb199('0x37')](respondWithResult(_0xccfb65,null))[_0xb199('0x2a')](handleError(_0xccfb65,null));};exports[_0xb199('0x57')]=function(_0x38295e,_0x14af34){return db[_0xb199('0x4d')][_0xb199('0x57')](_0x38295e[_0xb199('0x58')],{})['then'](respondWithResult(_0x14af34,0xc9))[_0xb199('0x2a')](handleError(_0x14af34,null));};exports[_0xb199('0x36')]=function(_0x2bbc68,_0xb5fdd4){if(_0x2bbc68[_0xb199('0x58')]['id']){delete _0x2bbc68[_0xb199('0x58')]['id'];}return db[_0xb199('0x4d')][_0xb199('0x56')]({'where':{'id':_0x2bbc68[_0xb199('0x59')]['id']}})[_0xb199('0x37')](handleEntityNotFound(_0xb5fdd4,null))['then'](saveUpdates(_0x2bbc68['body'],null))[_0xb199('0x37')](respondWithResult(_0xb5fdd4,null))['catch'](handleError(_0xb5fdd4,null));};exports[_0xb199('0x5a')]=function(_0x158e7b,_0x569c08){return db[_0xb199('0x4d')][_0xb199('0x56')]({'where':{'id':_0x158e7b[_0xb199('0x59')]['id']}})['then'](handleEntityNotFound(_0x569c08,null))[_0xb199('0x37')](removeEntity(_0x569c08,null))['catch'](handleError(_0x569c08,null));};exports[_0xb199('0x5b')]=function(_0x1e5d83,_0x994fd){return db[_0xb199('0x4d')][_0xb199('0x5b')]()[_0xb199('0x37')](respondWithResult(_0x994fd,null))['catch'](handleError(_0x994fd,null));};var interaction_log=require(_0xb199('0x15'))(_0xb199('0x5c'));exports['accept']=function(_0x556473,_0xb4638,_0xc7d32d){var _0x27e3d8={'agent':{},'channel':_0xb199('0x5d')};if(_0x556473[_0xb199('0x58')]['id']){delete _0x556473[_0xb199('0x58')]['id'];}_0x556473[_0xb199('0x58')][_0xb199('0x5e')]=!![];_0x556473[_0xb199('0x58')][_0xb199('0x5f')]=moment()['format'](_0xb199('0x60'));_0x556473[_0xb199('0x58')][_0xb199('0x61')]=_0x556473['body'][_0xb199('0x61')]||_0x556473['user']['id'];_0x27e3d8[_0xb199('0x62')]['id']=_0x556473[_0xb199('0x58')]['UserId'];return db['ChatMessage'][_0xb199('0x56')]({'where':{'id':_0x556473['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb4638,null))['then'](saveUpdates(_0x556473[_0xb199('0x58')],null))[_0xb199('0x37')](function(_0x4a62a8){if(_0x4a62a8){_0x27e3d8[_0xb199('0x28')]=_0x4a62a8[_0xb199('0x63')]({'plain':!![]});return db[_0xb199('0x64')][_0xb199('0x56')]({'where':{'id':_0x4a62a8[_0xb199('0x65')]}});}return null;})[_0xb199('0x37')](handleEntityNotFound(_0xb4638,null))[_0xb199('0x37')](function(_0x3b1716){if(_0x3b1716){return _0x3b1716[_0xb199('0x36')]({'UserId':_0x556473[_0xb199('0x58')][_0xb199('0x61')],'read1stAt':_[_0xb199('0x66')](_0x3b1716[_0xb199('0x67')])?moment()[_0xb199('0x68')](_0xb199('0x60')):undefined});}return null;})[_0xb199('0x37')](function(_0x59df47){if(_0x59df47){_0x27e3d8['interaction']=_0x59df47['get']({'plain':!![]});interaction_log['info'](_0xb199('0x69'),_0x556473[_0xb199('0x6a')]['id'],_0x556473[_0xb199('0x6a')][_0xb199('0x38')],_0x556473[_0xb199('0x6a')][_0xb199('0x6b')],_0x27e3d8['interaction']['id'],_0x556473[_0xb199('0x58')]?JSON['stringify'](_0x556473[_0xb199('0x58')]):_0xb199('0x6c'));return respondWithRpcPromise(_0xb199('0x6d'),_0xb199('0x6e'),_0x27e3d8);}return null;})[_0xb199('0x37')](function(_0x4c64fd){var _0x377670=_0xb199('0x6f')+_0x4c64fd[_0xb199('0x28')]['ContactId'];return db[_0xb199('0x70')][_0xb199('0x42')](_0x377670,{'type':db['Sequelize'][_0xb199('0x71')][_0xb199('0x72')],'raw':!![]})[_0xb199('0x37')](function(_0x3bde9a){return _0x3bde9a;});})[_0xb199('0x37')](function(_0x56cf85){if(_0x56cf85){_0x27e3d8[_0xb199('0x28')]['contact']=_0x56cf85[0x0];if(!_0x556473['body'][_0xb199('0x61')])return;return db[_0xb199('0x73')][_0xb199('0x56')]({'where':{'id':_0x556473[_0xb199('0x58')][_0xb199('0x61')],'role':'agent'},'attributes':['id',_0xb199('0x38'),_0xb199('0x74'),_0xb199('0x75'),'internal'],'raw':!![]});}return null;})[_0xb199('0x37')](function(_0x49cc43){if(!_0x49cc43)return null;_0x27e3d8['message'][_0xb199('0x62')]=_0x49cc43;return _0x27e3d8;})[_0xb199('0x37')](function(_0x2e4eb8){if(_0x2e4eb8){if(_0x556473[_0xb199('0x58')]['manual']){_0x27e3d8[_0xb199('0x28')][_0xb199('0x76')]=util[_0xb199('0x68')]('SIP/%s',_0x556473['user'][_0xb199('0x38')]);_0x27e3d8['message'][_0xb199('0x77')]=_0x27e3d8[_0xb199('0x77')];_0x27e3d8['message'][_0xb199('0x78')]=_0x27e3d8[_0xb199('0x77')];_0x27e3d8[_0xb199('0x28')][_0xb199('0x79')]=_0xb199('0x7a');return respondWithRpcPromise('EventManager',_0xb199('0x7b'),{'event':_0xb199('0x7c'),'message':_[_0xb199('0x4b')](_0x27e3d8['message'],JSON[_0xb199('0x7d')](_0x27e3d8[_0xb199('0x7e')][_0xb199('0x7f')]))},client9002)[_0xb199('0x37')](function(){return _0x27e3d8;});}return _0x27e3d8;}return null;})[_0xb199('0x37')](respondWithResult(_0xb4638,null))['catch'](handleError(_0xb4638,null));};var interaction_log=require(_0xb199('0x15'))(_0xb199('0x5c'));exports[_0xb199('0x80')]=function(_0x3450d2,_0x22880d,_0x4ae00b){var _0x273394={'agent':{},'channel':_0xb199('0x5d')};if(_0x3450d2[_0xb199('0x58')]['id']){delete _0x3450d2[_0xb199('0x58')]['id'];}_0x3450d2[_0xb199('0x58')][_0xb199('0x61')]=_0x3450d2['body'][_0xb199('0x61')]||_0x3450d2[_0xb199('0x6a')]['id'];_0x273394['agent']['id']=_0x3450d2[_0xb199('0x58')]['UserId'];return db['ChatMessage'][_0xb199('0x56')]({'where':{'id':_0x3450d2[_0xb199('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22880d,null))[_0xb199('0x37')](function(_0x3048f7){if(_0x3048f7){_0x273394[_0xb199('0x28')]=_0x3048f7[_0xb199('0x63')]({'plain':!![]});return db[_0xb199('0x64')][_0xb199('0x56')]({'where':{'id':_0x3048f7[_0xb199('0x65')]}});}return null;})[_0xb199('0x37')](handleEntityNotFound(_0x22880d,null))[_0xb199('0x37')](function(_0x5c1f76){if(_0x5c1f76){_0x273394['interaction']=_0x5c1f76[_0xb199('0x63')]({'plain':!![]});interaction_log['info'](_0xb199('0x81'),_0x3450d2[_0xb199('0x6a')]['id'],_0x3450d2[_0xb199('0x6a')][_0xb199('0x38')],_0x3450d2['user'][_0xb199('0x6b')],_0x273394[_0xb199('0x7e')]['id'],_0x3450d2[_0xb199('0x58')]?JSON[_0xb199('0x25')](_0x3450d2[_0xb199('0x58')]):_0xb199('0x6c'));return respondWithRpcPromise(_0xb199('0x82'),_0xb199('0x83'),_0x273394);}return null;})[_0xb199('0x37')](function(_0xf20f0c){var _0x1ed91b=_0xb199('0x6f')+_0xf20f0c['message'][_0xb199('0x84')];return db[_0xb199('0x70')][_0xb199('0x42')](_0x1ed91b,{'type':db[_0xb199('0x85')][_0xb199('0x71')]['SELECT'],'raw':!![]})[_0xb199('0x37')](function(_0x97c90){return _0x97c90;});})['then'](function(_0x2e5a8c){if(_0x2e5a8c){_0x273394[_0xb199('0x28')]['contact']=_0x2e5a8c[0x0];if(!_0x3450d2[_0xb199('0x58')][_0xb199('0x61')])return;return db[_0xb199('0x73')][_0xb199('0x56')]({'where':{'id':_0x3450d2[_0xb199('0x58')][_0xb199('0x61')],'role':_0xb199('0x62')},'attributes':['id',_0xb199('0x38'),_0xb199('0x74'),_0xb199('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x353fdd){if(!_0x353fdd)return null;_0x273394[_0xb199('0x28')][_0xb199('0x62')]=_0x353fdd;return _0x273394;})[_0xb199('0x37')](function(_0x55e56e){if(_0x55e56e){_0x55e56e[_0xb199('0x28')][_0xb199('0x76')]=util['format'](_0xb199('0x86'),_0x3450d2['user'][_0xb199('0x38')]);_0x55e56e['message'][_0xb199('0x77')]=_0x273394[_0xb199('0x77')];_0x55e56e[_0xb199('0x28')][_0xb199('0x78')]=_0x273394[_0xb199('0x77')];_0x55e56e['message'][_0xb199('0x79')]=_0xb199('0x80');respondWithRpcPromise(_0xb199('0x7b'),'EventManager',{'event':'rejectmessage','message':_['merge'](_0x273394[_0xb199('0x28')],JSON[_0xb199('0x7d')](_0x273394['interaction'][_0xb199('0x7f')]))},client9002);return _0x273394;}return null;})[_0xb199('0x37')](respondWithResult(_0x22880d,null))[_0xb199('0x2a')](handleError(_0x22880d,null));}; \ No newline at end of file +var _0x6712=['model','fields','attributes','length','hasOwnProperty','nolimit','pick','where','type','VIRTUAL','filter','merge','options','ChatMessage','include','findAll','rows','show','params','keys','find','create','update','body','destroy','describe','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','read1stAt','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','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','reject','chat','ChatInteractionId','RejectMessage','rejectMessage','interface','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection'];(function(_0x1d547f,_0x243d16){var _0xf71718=function(_0x21c190){while(--_0x21c190){_0x1d547f['push'](_0x1d547f['shift']());}};_0xf71718(++_0x243d16);}(_0x6712,0x159));var _0x2671=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6712[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x2671('0x0'));var rimraf=require(_0x2671('0x1'));var zipdir=require(_0x2671('0x2'));var jsonpatch=require(_0x2671('0x3'));var rp=require(_0x2671('0x4'));var moment=require('moment');var BPromise=require(_0x2671('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2671('0x6'));var sox=require(_0x2671('0x7'));var csv=require(_0x2671('0x8'));var ejs=require(_0x2671('0x9'));var fs=require('fs');var fs_extra=require(_0x2671('0xa'));var _=require(_0x2671('0xb'));var squel=require(_0x2671('0xc'));var crypto=require(_0x2671('0xd'));var jsforce=require(_0x2671('0xe'));var deskjs=require(_0x2671('0xf'));var toCsv=require(_0x2671('0x8'));var querystring=require(_0x2671('0x10'));var Papa=require(_0x2671('0x11'));var Redis=require(_0x2671('0x12'));var authService=require(_0x2671('0x13'));var qs=require(_0x2671('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2671('0x15'));var logger=require(_0x2671('0x16'))(_0x2671('0x17'));var utils=require(_0x2671('0x18'));var config=require(_0x2671('0x19'));var licenseUtil=require(_0x2671('0x1a'));var db=require(_0x2671('0x1b'))['db'];config[_0x2671('0x1c')]=_[_0x2671('0x1d')](config[_0x2671('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x2671('0x1e'))(new Redis(config[_0x2671('0x1c')]));require(_0x2671('0x1f'))[_0x2671('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2671('0x21')][_0x2671('0x22')]({'port':0x232c});var client9002=jayson[_0x2671('0x21')][_0x2671('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x21dc17,_0x4911ef,_0x340ec6,_0x6b86c6){return new BPromise(function(_0x321f28,_0x493d90){var _0x5cebcb=_0x6b86c6||client;return _0x5cebcb[_0x2671('0x23')](_0x21dc17,_0x340ec6)[_0x2671('0x24')](function(_0x423e4a){logger[_0x2671('0x25')]('ChatMessage,\x20%s,\x20%s',_0x4911ef,'request\x20sent');logger[_0x2671('0x26')](_0x2671('0x27'),_0x4911ef,_0x2671('0x28'),JSON[_0x2671('0x29')](_0x423e4a));if(_0x423e4a[_0x2671('0x2a')]){if(_0x423e4a[_0x2671('0x2a')]['code']===0x1f4){logger[_0x2671('0x2a')](_0x2671('0x2b'),_0x4911ef,_0x423e4a[_0x2671('0x2a')][_0x2671('0x2c')]);return _0x493d90(_0x423e4a['error']['message']);}logger[_0x2671('0x2a')](_0x2671('0x2b'),_0x4911ef,_0x423e4a['error']['message']);return _0x321f28(_0x423e4a['error'][_0x2671('0x2c')]);}else{logger[_0x2671('0x25')](_0x2671('0x2b'),_0x4911ef,_0x2671('0x28'));_0x321f28(_0x423e4a[_0x2671('0x2d')][_0x2671('0x2c')]);}})[_0x2671('0x2e')](function(_0x340861){logger[_0x2671('0x2a')](_0x2671('0x2b'),_0x4911ef,_0x340861);_0x493d90(_0x340861);});});}function respondWithStatusCode(_0x596976,_0x5259aa){_0x5259aa=_0x5259aa||0xcc;return function(_0x1ac0b9){if(_0x1ac0b9){return _0x596976[_0x2671('0x2f')](_0x5259aa);}return _0x596976[_0x2671('0x30')](_0x5259aa)[_0x2671('0x31')]();};}function respondWithResult(_0x35de62,_0x36df39){_0x36df39=_0x36df39||0xc8;return function(_0xe67971){if(_0xe67971){return _0x35de62[_0x2671('0x30')](_0x36df39)['json'](_0xe67971);}};}function respondWithFilteredResult(_0x5982ed,_0x541fd){return function(_0x109966){if(_0x109966){var _0x23f052=typeof _0x541fd[_0x2671('0x32')]===_0x2671('0x33')&&typeof _0x541fd[_0x2671('0x34')]===_0x2671('0x33');var _0x9d8b41=_0x109966['count'];var _0x3d8486=_0x23f052?0x0:_0x541fd[_0x2671('0x32')];var _0x20d0e4=_0x23f052?_0x109966[_0x2671('0x35')]:_0x541fd[_0x2671('0x32')]+_0x541fd[_0x2671('0x34')];var _0x1008b5;if(_0x20d0e4>=_0x9d8b41){_0x20d0e4=_0x9d8b41;_0x1008b5=0xc8;}else{_0x1008b5=0xce;}_0x5982ed['status'](_0x1008b5);return _0x5982ed[_0x2671('0x36')](_0x2671('0x37'),_0x3d8486+'-'+_0x20d0e4+'/'+_0x9d8b41)[_0x2671('0x38')](_0x109966);}return null;};}function patchUpdates(_0x27bfee){return function(_0x544e70){try{jsonpatch[_0x2671('0x39')](_0x544e70,_0x27bfee,!![]);}catch(_0x3ca0db){return BPromise['reject'](_0x3ca0db);}return _0x544e70[_0x2671('0x3a')]();};}function saveUpdates(_0x40daf6,_0x1f4f79){return function(_0x59f306){if(_0x59f306){return _0x59f306['update'](_0x40daf6)[_0x2671('0x24')](function(_0x2b4680){return _0x2b4680;});}return null;};}function removeEntity(_0x204344,_0x403aa0){return function(_0x14d5b0){if(_0x14d5b0){return _0x14d5b0['destroy']()[_0x2671('0x24')](function(){_0x204344[_0x2671('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ade5e,_0x220d40){return function(_0xd71c67){if(!_0xd71c67){_0x1ade5e[_0x2671('0x2f')](0x194);}return _0xd71c67;};}function handleError(_0x445d8d,_0xf751be){_0xf751be=_0xf751be||0x1f4;return function(_0x538fe7){logger[_0x2671('0x2a')](_0x538fe7[_0x2671('0x3b')]);if(_0x538fe7[_0x2671('0x3c')]){delete _0x538fe7['name'];}_0x445d8d['status'](_0xf751be)['send'](_0x538fe7);};}exports[_0x2671('0x3d')]=function(_0x1a6b75,_0x3af39f){var _0x20cffb={},_0x99e79f={},_0xcd41f3={'count':0x0,'rows':[]};var _0x13bb16=_[_0x2671('0x3e')](db['ChatMessage'][_0x2671('0x3f')],function(_0x52b115){return{'name':_0x52b115[_0x2671('0x40')],'type':_0x52b115['type'][_0x2671('0x41')]};});_0x99e79f['model']=_['map'](_0x13bb16,_0x2671('0x3c'));_0x99e79f[_0x2671('0x42')]=_['keys'](_0x1a6b75[_0x2671('0x42')]);_0x99e79f[_0x2671('0x43')]=_[_0x2671('0x44')](_0x99e79f[_0x2671('0x45')],_0x99e79f['query']);_0x20cffb['attributes']=_[_0x2671('0x44')](_0x99e79f[_0x2671('0x45')],qs[_0x2671('0x46')](_0x1a6b75[_0x2671('0x42')][_0x2671('0x46')]));_0x20cffb[_0x2671('0x47')]=_0x20cffb['attributes'][_0x2671('0x48')]?_0x20cffb['attributes']:_0x99e79f['model'];if(!_0x1a6b75[_0x2671('0x42')][_0x2671('0x49')](_0x2671('0x4a'))){_0x20cffb[_0x2671('0x34')]=qs['limit'](_0x1a6b75[_0x2671('0x42')]['limit']);_0x20cffb[_0x2671('0x32')]=qs[_0x2671('0x32')](_0x1a6b75['query']['offset']);}_0x20cffb['order']=qs['sort'](_0x1a6b75['query']['sort']);_0x20cffb['where']=qs['filters'](_[_0x2671('0x4b')](_0x1a6b75['query'],_0x99e79f[_0x2671('0x43')]),_0x13bb16);if(_0x1a6b75[_0x2671('0x42')]['filter']){_0x20cffb[_0x2671('0x4c')]=_['merge'](_0x20cffb[_0x2671('0x4c')],{'$or':_[_0x2671('0x3e')](_0x13bb16,function(_0x21f136){if(_0x21f136[_0x2671('0x4d')]!==_0x2671('0x4e')){var _0x285d59={};_0x285d59[_0x21f136[_0x2671('0x3c')]]={'$like':'%'+_0x1a6b75[_0x2671('0x42')][_0x2671('0x4f')]+'%'};return _0x285d59;}})});}_0x20cffb=_[_0x2671('0x50')]({},_0x20cffb,_0x1a6b75[_0x2671('0x51')]);var _0x18f6af={'where':_0x20cffb[_0x2671('0x4c')]};return db[_0x2671('0x52')][_0x2671('0x35')](_0x18f6af)[_0x2671('0x24')](function(_0x16f41e){_0xcd41f3[_0x2671('0x35')]=_0x16f41e;if(_0x1a6b75[_0x2671('0x42')]['includeAll']){_0x20cffb[_0x2671('0x53')]=[{'all':!![]}];}return db[_0x2671('0x52')][_0x2671('0x54')](_0x20cffb);})[_0x2671('0x24')](function(_0x52f8e6){_0xcd41f3[_0x2671('0x55')]=_0x52f8e6;return _0xcd41f3;})['then'](respondWithFilteredResult(_0x3af39f,_0x20cffb))['catch'](handleError(_0x3af39f,null));};exports[_0x2671('0x56')]=function(_0x3f480e,_0x1d35b2){var _0x499d37={'raw':!![],'where':{'id':_0x3f480e[_0x2671('0x57')]['id']}},_0x52553c={};_0x52553c['model']=_[_0x2671('0x58')](db[_0x2671('0x52')]['rawAttributes']);_0x52553c[_0x2671('0x42')]=_[_0x2671('0x58')](_0x3f480e[_0x2671('0x42')]);_0x52553c[_0x2671('0x43')]=_['intersection'](_0x52553c[_0x2671('0x45')],_0x52553c[_0x2671('0x42')]);_0x499d37['attributes']=_[_0x2671('0x44')](_0x52553c[_0x2671('0x45')],qs['fields'](_0x3f480e['query'][_0x2671('0x46')]));_0x499d37[_0x2671('0x47')]=_0x499d37[_0x2671('0x47')]['length']?_0x499d37[_0x2671('0x47')]:_0x52553c[_0x2671('0x45')];if(_0x3f480e['query']['includeAll']){_0x499d37['include']=[{'all':!![]}];}_0x499d37=_[_0x2671('0x50')]({},_0x499d37,_0x3f480e[_0x2671('0x51')]);return db[_0x2671('0x52')][_0x2671('0x59')](_0x499d37)[_0x2671('0x24')](handleEntityNotFound(_0x1d35b2,null))['then'](respondWithResult(_0x1d35b2,null))['catch'](handleError(_0x1d35b2,null));};exports[_0x2671('0x5a')]=function(_0x243c8b,_0x5bb02e){return db[_0x2671('0x52')][_0x2671('0x5a')](_0x243c8b['body'],{})[_0x2671('0x24')](respondWithResult(_0x5bb02e,0xc9))[_0x2671('0x2e')](handleError(_0x5bb02e,null));};exports[_0x2671('0x5b')]=function(_0x23332a,_0x3fe4ae){if(_0x23332a[_0x2671('0x5c')]['id']){delete _0x23332a[_0x2671('0x5c')]['id'];}return db[_0x2671('0x52')][_0x2671('0x59')]({'where':{'id':_0x23332a[_0x2671('0x57')]['id']}})[_0x2671('0x24')](handleEntityNotFound(_0x3fe4ae,null))[_0x2671('0x24')](saveUpdates(_0x23332a['body'],null))[_0x2671('0x24')](respondWithResult(_0x3fe4ae,null))[_0x2671('0x2e')](handleError(_0x3fe4ae,null));};exports[_0x2671('0x5d')]=function(_0x273ea1,_0x1c2443){return db[_0x2671('0x52')]['find']({'where':{'id':_0x273ea1[_0x2671('0x57')]['id']}})[_0x2671('0x24')](handleEntityNotFound(_0x1c2443,null))[_0x2671('0x24')](removeEntity(_0x1c2443,null))['catch'](handleError(_0x1c2443,null));};exports['describe']=function(_0x43de0c,_0x19d0c1){return db['ChatMessage'][_0x2671('0x5e')]()[_0x2671('0x24')](respondWithResult(_0x19d0c1,null))[_0x2671('0x2e')](handleError(_0x19d0c1,null));};var interaction_log=require(_0x2671('0x16'))('chat-interactions');exports[_0x2671('0x5f')]=function(_0x39a38d,_0x257610,_0x1b23d5){var _0x7bc185={'agent':{},'channel':'chat'};if(_0x39a38d['body']['id']){delete _0x39a38d[_0x2671('0x5c')]['id'];}_0x39a38d['body'][_0x2671('0x60')]=!![];_0x39a38d[_0x2671('0x5c')]['readAt']=moment()[_0x2671('0x61')](_0x2671('0x62'));_0x39a38d[_0x2671('0x5c')][_0x2671('0x63')]=_0x39a38d['body'][_0x2671('0x63')]||_0x39a38d[_0x2671('0x64')]['id'];_0x7bc185[_0x2671('0x65')]['id']=_0x39a38d[_0x2671('0x5c')][_0x2671('0x63')];return db[_0x2671('0x52')]['find']({'where':{'id':_0x39a38d[_0x2671('0x57')]['id'],'UserId':null}})[_0x2671('0x24')](handleEntityNotFound(_0x257610,null))[_0x2671('0x24')](saveUpdates(_0x39a38d[_0x2671('0x5c')],null))['then'](function(_0x3ccda9){if(_0x3ccda9){_0x7bc185['message']=_0x3ccda9[_0x2671('0x66')]({'plain':!![]});return db[_0x2671('0x67')]['find']({'where':{'id':_0x3ccda9['ChatInteractionId']}});}return null;})[_0x2671('0x24')](handleEntityNotFound(_0x257610,null))[_0x2671('0x24')](function(_0x34d149){if(_0x34d149){return _0x34d149[_0x2671('0x5b')]({'UserId':_0x39a38d[_0x2671('0x5c')][_0x2671('0x63')],'read1stAt':_['isNil'](_0x34d149[_0x2671('0x68')])?moment()[_0x2671('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2671('0x24')](function(_0x3ce120){if(_0x3ce120){_0x7bc185[_0x2671('0x69')]=_0x3ce120[_0x2671('0x66')]({'plain':!![]});interaction_log[_0x2671('0x25')](_0x2671('0x6a'),_0x39a38d['user']['id'],_0x39a38d[_0x2671('0x64')][_0x2671('0x3c')],_0x39a38d[_0x2671('0x64')][_0x2671('0x6b')],_0x7bc185[_0x2671('0x69')]['id'],_0x39a38d[_0x2671('0x5c')]?JSON[_0x2671('0x29')](_0x39a38d[_0x2671('0x5c')]):_0x2671('0x6c'));return respondWithRpcPromise(_0x2671('0x6d'),_0x2671('0x6e'),_0x7bc185);}return null;})[_0x2671('0x24')](function(_0x5f5a04){var _0x59f367=_0x2671('0x6f')+_0x5f5a04[_0x2671('0x2c')][_0x2671('0x70')];return db[_0x2671('0x71')][_0x2671('0x42')](_0x59f367,{'type':db[_0x2671('0x72')][_0x2671('0x73')][_0x2671('0x74')],'raw':!![]})[_0x2671('0x24')](function(_0x1d4010){return _0x1d4010;});})['then'](function(_0x37a8c7){if(_0x37a8c7){_0x7bc185[_0x2671('0x2c')][_0x2671('0x75')]=_0x37a8c7[0x0];if(!_0x39a38d[_0x2671('0x5c')]['UserId'])return;return db[_0x2671('0x76')]['find']({'where':{'id':_0x39a38d['body'][_0x2671('0x63')],'role':'agent'},'attributes':['id',_0x2671('0x3c'),_0x2671('0x77'),_0x2671('0x78'),_0x2671('0x79')],'raw':!![]});}return null;})[_0x2671('0x24')](function(_0x28193e){if(!_0x28193e)return null;_0x7bc185[_0x2671('0x2c')][_0x2671('0x65')]=_0x28193e;return _0x7bc185;})[_0x2671('0x24')](function(_0x30429a){if(_0x30429a){if(_0x39a38d['body'][_0x2671('0x7a')]){_0x7bc185['message']['interface']=util[_0x2671('0x61')](_0x2671('0x7b'),_0x39a38d[_0x2671('0x64')][_0x2671('0x3c')]);_0x7bc185[_0x2671('0x2c')]['channel']=_0x7bc185[_0x2671('0x7c')];_0x7bc185[_0x2671('0x2c')][_0x2671('0x7d')]=_0x7bc185[_0x2671('0x7c')];_0x7bc185[_0x2671('0x2c')][_0x2671('0x7e')]=_0x2671('0x5f');return respondWithRpcPromise(_0x2671('0x7f'),_0x2671('0x7f'),{'event':_0x2671('0x80'),'message':_['merge'](_0x7bc185[_0x2671('0x2c')],JSON[_0x2671('0x81')](_0x7bc185[_0x2671('0x69')]['formData']))},client9002)[_0x2671('0x24')](function(){return _0x7bc185;});}return _0x7bc185;}return null;})[_0x2671('0x24')](respondWithResult(_0x257610,null))['catch'](handleError(_0x257610,null));};var interaction_log=require(_0x2671('0x16'))('chat-interactions');exports[_0x2671('0x82')]=function(_0x1fd431,_0x1111ab,_0x402524){var _0x4ea0df={'agent':{},'channel':_0x2671('0x83')};if(_0x1fd431[_0x2671('0x5c')]['id']){delete _0x1fd431[_0x2671('0x5c')]['id'];}_0x1fd431['body'][_0x2671('0x63')]=_0x1fd431[_0x2671('0x5c')]['UserId']||_0x1fd431['user']['id'];_0x4ea0df[_0x2671('0x65')]['id']=_0x1fd431[_0x2671('0x5c')][_0x2671('0x63')];return db[_0x2671('0x52')][_0x2671('0x59')]({'where':{'id':_0x1fd431['params']['id'],'UserId':null}})[_0x2671('0x24')](handleEntityNotFound(_0x1111ab,null))['then'](function(_0x4ba68e){if(_0x4ba68e){_0x4ea0df['message']=_0x4ba68e[_0x2671('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x2671('0x59')]({'where':{'id':_0x4ba68e[_0x2671('0x84')]}});}return null;})[_0x2671('0x24')](handleEntityNotFound(_0x1111ab,null))['then'](function(_0x295294){if(_0x295294){_0x4ea0df[_0x2671('0x69')]=_0x295294[_0x2671('0x66')]({'plain':!![]});interaction_log[_0x2671('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fd431[_0x2671('0x64')]['id'],_0x1fd431['user']['name'],_0x1fd431[_0x2671('0x64')][_0x2671('0x6b')],_0x4ea0df[_0x2671('0x69')]['id'],_0x1fd431[_0x2671('0x5c')]?JSON['stringify'](_0x1fd431['body']):'null');return respondWithRpcPromise(_0x2671('0x85'),_0x2671('0x86'),_0x4ea0df);}return null;})[_0x2671('0x24')](function(_0x9cca63){var _0x41c799=_0x2671('0x6f')+_0x9cca63[_0x2671('0x2c')][_0x2671('0x70')];return db[_0x2671('0x71')][_0x2671('0x42')](_0x41c799,{'type':db[_0x2671('0x72')][_0x2671('0x73')][_0x2671('0x74')],'raw':!![]})['then'](function(_0x12db54){return _0x12db54;});})[_0x2671('0x24')](function(_0x317a03){if(_0x317a03){_0x4ea0df[_0x2671('0x2c')]['contact']=_0x317a03[0x0];if(!_0x1fd431[_0x2671('0x5c')][_0x2671('0x63')])return;return db[_0x2671('0x76')]['find']({'where':{'id':_0x1fd431['body'][_0x2671('0x63')],'role':'agent'},'attributes':['id',_0x2671('0x3c'),_0x2671('0x77'),_0x2671('0x78'),'internal'],'raw':!![]});}return null;})[_0x2671('0x24')](function(_0x289014){if(!_0x289014)return null;_0x4ea0df[_0x2671('0x2c')][_0x2671('0x65')]=_0x289014;return _0x4ea0df;})[_0x2671('0x24')](function(_0x13f8dc){if(_0x13f8dc){_0x13f8dc[_0x2671('0x2c')][_0x2671('0x87')]=util[_0x2671('0x61')](_0x2671('0x7b'),_0x1fd431[_0x2671('0x64')][_0x2671('0x3c')]);_0x13f8dc[_0x2671('0x2c')][_0x2671('0x7c')]=_0x4ea0df[_0x2671('0x7c')];_0x13f8dc[_0x2671('0x2c')][_0x2671('0x7d')]=_0x4ea0df[_0x2671('0x7c')];_0x13f8dc[_0x2671('0x2c')][_0x2671('0x7e')]=_0x2671('0x82');respondWithRpcPromise('EventManager',_0x2671('0x7f'),{'event':_0x2671('0x88'),'message':_[_0x2671('0x50')](_0x4ea0df[_0x2671('0x2c')],JSON['parse'](_0x4ea0df[_0x2671('0x69')][_0x2671('0x89')]))},client9002);return _0x4ea0df;}return null;})[_0x2671('0x24')](respondWithResult(_0x1111ab,null))[_0x2671('0x2e')](handleError(_0x1111ab,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index cf05c58..40936a6 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 _0x1871=['setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x4f24f8,_0x481150){var _0x5aa54f=function(_0x3050ef){while(--_0x3050ef){_0x4f24f8['push'](_0x4f24f8['shift']());}};_0x5aa54f(++_0x481150);}(_0x1871,0x181));var _0x1187=function(_0x3dbe53,_0x55e75e){_0x3dbe53=_0x3dbe53-0x0;var _0x205392=_0x1871[_0x3dbe53];return _0x205392;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1187('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x596841){return function(_0x314894,_0x19ce81,_0xd813ba){ChatMessageEvents['emit'](_0x596841+':'+_0x314894['id'],_0x314894);ChatMessageEvents[_0x1187('0x1')](_0x596841,_0x314894);_0xd813ba(null);};}for(var e in events){if(events[_0x1187('0x2')](e)){var event=events[e];ChatMessage[_0x1187('0x3')](e,emitEvent(event));}}module[_0x1187('0x4')]=ChatMessageEvents; \ No newline at end of file +var _0x62cc=['../../mysqldb','ChatMessage','save','update','emit','hasOwnProperty','exports','events'];(function(_0x4af356,_0x298d74){var _0x40566=function(_0x3cd2b2){while(--_0x3cd2b2){_0x4af356['push'](_0x4af356['shift']());}};_0x40566(++_0x298d74);}(_0x62cc,0x67));var _0xc62c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62cc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc62c('0x0'));var ChatMessage=require(_0xc62c('0x1'))['db'][_0xc62c('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc62c('0x3'),'afterUpdate':_0xc62c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b619f){return function(_0x5b4166,_0x1608a6,_0x492e4d){ChatMessageEvents[_0xc62c('0x5')](_0x1b619f+':'+_0x5b4166['id'],_0x5b4166);ChatMessageEvents[_0xc62c('0x5')](_0x1b619f,_0x5b4166);_0x492e4d(null);};}for(var e in events){if(events[_0xc62c('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xc62c('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 7429c5f..e6c7e8c 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 _0x3c70=['fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','findOne','ChatInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage'];(function(_0x11045d,_0x14910b){var _0x38a685=function(_0x286452){while(--_0x286452){_0x11045d['push'](_0x11045d['shift']());}};_0x38a685(++_0x14910b);}(_0x3c70,0x10c));var _0x03c7=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x3c70[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var logger=require(_0x03c7('0x2'))('api');var moment=require(_0x03c7('0x3'));var BPromise=require(_0x03c7('0x4'));var rp=require(_0x03c7('0x5'));var fs=require('fs');var path=require(_0x03c7('0x6'));var rimraf=require(_0x03c7('0x7'));var config=require(_0x03c7('0x8'));var attributes=require('./chatMessage.attributes');module[_0x03c7('0x9')]=function(_0x4f774e,_0x5b6c32){return _0x4f774e[_0x03c7('0xa')](_0x03c7('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x03c7('0xc'),'fields':[_0x03c7('0xd')],'type':_0x03c7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x577669,_0xc030ba,_0x48c3f7){var _0x103052=_0x4f774e[_0x03c7('0xf')];var _0x57c8fb=_0x577669[_0x03c7('0x10')]({'plain':!![]});if(_0x57c8fb[_0x03c7('0x11')][_0x03c7('0x12')]()==='in'||_0x57c8fb[_0x03c7('0x11')][_0x03c7('0x12')]()==='out'&&!_0x57c8fb['secret']&&!_[_0x03c7('0x13')](_0x57c8fb[_0x03c7('0x14')])){_0x103052['ChatInteraction'][_0x03c7('0x15')]({'where':{'id':_0x57c8fb[_0x03c7('0x16')]}})[_0x03c7('0x17')](function(_0x2c57af){if(_0x2c57af){_0x2c57af[_0x03c7('0x18')]({'lastMsgAt':_0x57c8fb['createdAt'],'lastMsgDirection':_0x57c8fb[_0x03c7('0x11')]['toLowerCase']()});}})[_0x03c7('0x19')](function(_0x1ae657){console['error'](_0x1ae657);});}_0x48c3f7();}},'charset':_0x03c7('0x1a'),'collate':_0x03c7('0x1b')});}; \ No newline at end of file +var _0x782b=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch'];(function(_0x49283f,_0x2acdcb){var _0x491beb=function(_0xf0705b){while(--_0xf0705b){_0x49283f['push'](_0x49283f['shift']());}};_0x491beb(++_0x2acdcb);}(_0x782b,0xa3));var _0xb782=function(_0x22011a,_0x1a9609){_0x22011a=_0x22011a-0x0;var _0x2cc3ec=_0x782b[_0x22011a];return _0x2cc3ec;};'use strict';var _=require(_0xb782('0x0'));var util=require(_0xb782('0x1'));var logger=require(_0xb782('0x2'))(_0xb782('0x3'));var moment=require(_0xb782('0x4'));var BPromise=require(_0xb782('0x5'));var rp=require(_0xb782('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb782('0x7'));var config=require(_0xb782('0x8'));var attributes=require(_0xb782('0x9'));module['exports']=function(_0x3491e4,_0x2a6c07){return _0x3491e4[_0xb782('0xa')]('ChatMessage',attributes,{'tableName':_0xb782('0xb'),'paranoid':![],'indexes':[{'name':_0xb782('0xc'),'fields':[_0xb782('0xd')],'type':_0xb782('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a558b,_0x1a0dad,_0x34cf8f){var _0x59a986=_0x3491e4[_0xb782('0xf')];var _0xe98bb3=_0x4a558b[_0xb782('0x10')]({'plain':!![]});if(_0xe98bb3['direction'][_0xb782('0x11')]()==='in'||_0xe98bb3[_0xb782('0x12')][_0xb782('0x11')]()==='out'&&!_0xe98bb3[_0xb782('0x13')]&&!_[_0xb782('0x14')](_0xe98bb3[_0xb782('0x15')])){_0x59a986[_0xb782('0x16')][_0xb782('0x17')]({'where':{'id':_0xe98bb3[_0xb782('0x18')]}})[_0xb782('0x19')](function(_0x1f1bb7){if(_0x1f1bb7){_0x1f1bb7[_0xb782('0x1a')]({'lastMsgAt':_0xe98bb3[_0xb782('0x1b')],'lastMsgDirection':_0xe98bb3[_0xb782('0x12')][_0xb782('0x11')]()});}})[_0xb782('0x1c')](function(_0x32d13b){console[_0xb782('0x1d')](_0x32d13b);});}_0x34cf8f();}},'charset':_0xb782('0x1e'),'collate':_0xb782('0x1f')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 011127d..3f8fa67 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 _0xdf98=['CreateChatMessage','create','body','options','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch'];(function(_0x27b6e9,_0x59896f){var _0x54e0c1=function(_0x3999ef){while(--_0x3999ef){_0x27b6e9['push'](_0x27b6e9['shift']());}};_0x54e0c1(++_0x59896f);}(_0xdf98,0xcf));var _0x8df9=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0xdf98[_0x10b48a];return _0x2c4533;};'use strict';var _=require(_0x8df9('0x0'));var util=require('util');var moment=require(_0x8df9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8df9('0x2'));var db=require(_0x8df9('0x3'))['db'];var utils=require(_0x8df9('0x4'));var logger=require(_0x8df9('0x5'))(_0x8df9('0x6'));var config=require(_0x8df9('0x7'));var jayson=require(_0x8df9('0x8'));var client=jayson[_0x8df9('0x9')][_0x8df9('0xa')]({'port':0x232a});config['redis']=_[_0x8df9('0xb')](config[_0x8df9('0xc')],{'host':_0x8df9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8df9('0xe'))['register'](socket);function respondWithRpcPromise(_0x46553c,_0x3aab11,_0x1ead69){return new BPromise(function(_0xa5abd2,_0x1a97bf){return client[_0x8df9('0xf')](_0x46553c,_0x1ead69)[_0x8df9('0x10')](function(_0x41d4da){logger['info'](_0x8df9('0x11'),_0x3aab11,_0x8df9('0x12'));logger[_0x8df9('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3aab11,_0x8df9('0x12'),JSON[_0x8df9('0x14')](_0x41d4da));if(_0x41d4da[_0x8df9('0x15')]){if(_0x41d4da[_0x8df9('0x15')]['code']===0x1f4){logger['error'](_0x8df9('0x11'),_0x3aab11,_0x41d4da[_0x8df9('0x15')][_0x8df9('0x16')]);return _0x1a97bf(_0x41d4da['error'][_0x8df9('0x16')]);}logger['error'](_0x8df9('0x11'),_0x3aab11,_0x41d4da['error'][_0x8df9('0x16')]);return _0xa5abd2(_0x41d4da[_0x8df9('0x15')][_0x8df9('0x16')]);}else{logger[_0x8df9('0x17')](_0x8df9('0x11'),_0x3aab11,_0x8df9('0x12'));_0xa5abd2(_0x41d4da['result']['message']);}})[_0x8df9('0x18')](function(_0x52030a){logger['error'](_0x8df9('0x11'),_0x3aab11,_0x52030a);_0x1a97bf(_0x52030a);});});}exports[_0x8df9('0x19')]=function(_0x3c4b85){var _0x412015=this;return new Promise(function(_0x10b440,_0xd73eb3){return db['ChatMessage'][_0x8df9('0x1a')](_0x3c4b85[_0x8df9('0x1b')],{'raw':_0x3c4b85[_0x8df9('0x1c')]?_0x3c4b85['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a6748){logger['info'](_0x8df9('0x19'),_0x3c4b85);logger[_0x8df9('0x13')](_0x8df9('0x19'),_0x3c4b85,JSON[_0x8df9('0x14')](_0x4a6748));_0x10b440(_0x4a6748);})[_0x8df9('0x18')](function(_0x1f9edd){logger[_0x8df9('0x15')](_0x8df9('0x19'),_0x1f9edd['message'],_0x3c4b85);_0xd73eb3(_0x412015[_0x8df9('0x15')](0x1f4,_0x1f9edd[_0x8df9('0x16')]));});});}; \ No newline at end of file +var _0x46f2=['localhost','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','create','body','raw','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2fc352,_0xc986b){var _0x49bfca=function(_0x34004c){while(--_0x34004c){_0x2fc352['push'](_0x2fc352['shift']());}};_0x49bfca(++_0xc986b);}(_0x46f2,0x133));var _0x246f=function(_0x3388ba,_0x1fc1ba){_0x3388ba=_0x3388ba-0x0;var _0x4a20bf=_0x46f2[_0x3388ba];return _0x4a20bf;};'use strict';var _=require(_0x246f('0x0'));var util=require(_0x246f('0x1'));var moment=require(_0x246f('0x2'));var BPromise=require(_0x246f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x246f('0x4'));var db=require(_0x246f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x246f('0x6'))(_0x246f('0x7'));var config=require(_0x246f('0x8'));var jayson=require(_0x246f('0x9'));var client=jayson[_0x246f('0xa')][_0x246f('0xb')]({'port':0x232a});config[_0x246f('0xc')]=_['defaults'](config[_0x246f('0xc')],{'host':_0x246f('0xd'),'port':0x18eb});var socket=require(_0x246f('0xe'))(new Redis(config[_0x246f('0xc')]));require('./chatMessage.socket')[_0x246f('0xf')](socket);function respondWithRpcPromise(_0x132223,_0x4a0a64,_0x9c91a1){return new BPromise(function(_0x85a6e,_0x3fe60f){return client[_0x246f('0x10')](_0x132223,_0x9c91a1)[_0x246f('0x11')](function(_0x590e22){logger['info'](_0x246f('0x12'),_0x4a0a64,_0x246f('0x13'));logger['debug'](_0x246f('0x14'),_0x4a0a64,_0x246f('0x13'),JSON['stringify'](_0x590e22));if(_0x590e22[_0x246f('0x15')]){if(_0x590e22[_0x246f('0x15')][_0x246f('0x16')]===0x1f4){logger['error'](_0x246f('0x12'),_0x4a0a64,_0x590e22[_0x246f('0x15')][_0x246f('0x17')]);return _0x3fe60f(_0x590e22['error'][_0x246f('0x17')]);}logger[_0x246f('0x15')](_0x246f('0x12'),_0x4a0a64,_0x590e22[_0x246f('0x15')]['message']);return _0x85a6e(_0x590e22['error']['message']);}else{logger['info'](_0x246f('0x12'),_0x4a0a64,_0x246f('0x13'));_0x85a6e(_0x590e22[_0x246f('0x18')][_0x246f('0x17')]);}})[_0x246f('0x19')](function(_0x5718e3){logger[_0x246f('0x15')](_0x246f('0x12'),_0x4a0a64,_0x5718e3);_0x3fe60f(_0x5718e3);});});}exports[_0x246f('0x1a')]=function(_0x2d55ab){var _0x3d5f8d=this;return new Promise(function(_0x798d82,_0x32c39f){return db['ChatMessage'][_0x246f('0x1b')](_0x2d55ab[_0x246f('0x1c')],{'raw':_0x2d55ab['options']?_0x2d55ab['options'][_0x246f('0x1d')]===undefined?!![]:![]:!![]})[_0x246f('0x11')](function(_0x16e4ff){logger['info'](_0x246f('0x1a'),_0x2d55ab);logger[_0x246f('0x1e')](_0x246f('0x1a'),_0x2d55ab,JSON[_0x246f('0x1f')](_0x16e4ff));_0x798d82(_0x16e4ff);})[_0x246f('0x19')](function(_0x2aace3){logger[_0x246f('0x15')]('CreateChatMessage',_0x2aace3[_0x246f('0x17')],_0x2d55ab);_0x32c39f(_0x3d5f8d['error'](0x1f4,_0x2aace3[_0x246f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index baeaaaa..8053e2a 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 _0x19da=['update','register','length','save'];(function(_0x57a638,_0x42cd01){var _0x51ce6f=function(_0x53fbd8){while(--_0x53fbd8){_0x57a638['push'](_0x57a638['shift']());}};_0x51ce6f(++_0x42cd01);}(_0x19da,0x9f));var _0xa19d=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x19da[_0x27d8bc];return _0x4b04cb;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa19d('0x0'),'remove',_0xa19d('0x1')];function createListener(_0x5ba569,_0x3a48f4){return function(_0x17f1c6){_0x3a48f4['emit'](_0x5ba569,_0x17f1c6);};}function removeListener(_0x179db7,_0x28ec9a){return function(){ChatMessageEvents['removeListener'](_0x179db7,_0x28ec9a);};}exports[_0xa19d('0x2')]=function(_0x330adb){for(var _0x1f6e10=0x0,_0x14dc68=events[_0xa19d('0x3')];_0x1f6e10<_0x14dc68;_0x1f6e10++){var _0x4b4627=events[_0x1f6e10];var _0x197c4e=createListener('chatMessage:'+_0x4b4627,_0x330adb);ChatMessageEvents['on'](_0x4b4627,_0x197c4e);}}; \ No newline at end of file +var _0x972c=['register','length','remove','update','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x972c,0xf2));var _0xc972=function(_0x313672,_0x42f18a){_0x313672=_0x313672-0x0;var _0x5482cc=_0x972c[_0x313672];return _0x5482cc;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xc972('0x0'),_0xc972('0x1')];function createListener(_0x5ebc6c,_0x3c04a5){return function(_0x1a41f9){_0x3c04a5['emit'](_0x5ebc6c,_0x1a41f9);};}function removeListener(_0x511ad4,_0x140e13){return function(){ChatMessageEvents[_0xc972('0x2')](_0x511ad4,_0x140e13);};}exports[_0xc972('0x3')]=function(_0x5dd2c8){for(var _0xd70261=0x0,_0x4cff66=events[_0xc972('0x4')];_0xd70261<_0x4cff66;_0xd70261++){var _0xd8cd25=events[_0xd70261];var _0x304d08=createListener('chatMessage:'+_0xd8cd25,_0x5dd2c8);ChatMessageEvents['on'](_0xd8cd25,_0x304d08);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 44529ea..e41b366 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 _0xcaf6=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','chatmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path'];(function(_0x133137,_0x341be2){var _0xbc4685=function(_0x4cde0b){while(--_0x4cde0b){_0x133137['push'](_0x133137['shift']());}};_0xbc4685(++_0x341be2);}(_0xcaf6,0x9f));var _0x6caf=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0xcaf6[_0x5e2b34];return _0x4859f9;};'use strict';var multer=require(_0x6caf('0x0'));var util=require('util');var path=require(_0x6caf('0x1'));var timeout=require(_0x6caf('0x2'));var express=require('express');var router=express[_0x6caf('0x3')]();var fs_extra=require(_0x6caf('0x4'));var auth=require(_0x6caf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6caf('0x6'));var controller=require('./chatMessage.controller');router[_0x6caf('0x7')]('/',auth[_0x6caf('0x8')](),controller[_0x6caf('0x9')]);router[_0x6caf('0x7')](_0x6caf('0xa'),auth[_0x6caf('0x8')](),controller[_0x6caf('0xb')]);router['get'](_0x6caf('0xc'),auth[_0x6caf('0x8')](),controller[_0x6caf('0xd')]);router['post']('/',auth[_0x6caf('0x8')](),interaction['tracked']('chat',_0x6caf('0xe')),controller[_0x6caf('0xf')]);router[_0x6caf('0x10')](_0x6caf('0xc'),controller['update']);router[_0x6caf('0x10')](_0x6caf('0x11'),auth[_0x6caf('0x8')](),controller['accept']);router[_0x6caf('0x10')](_0x6caf('0x12'),auth[_0x6caf('0x8')](),controller[_0x6caf('0x13')]);router[_0x6caf('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6caf('0x15')]);module[_0x6caf('0x16')]=router; \ No newline at end of file +var _0xd81f=['index','get','describe','show','post','chat','chatmessage:create','create','put','update','accept','/:id/reject','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xd81f,0xfa));var _0xfd81=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xd81f[_0x3b150c];return _0x5cd414;};'use strict';var multer=require(_0xfd81('0x0'));var util=require(_0xfd81('0x1'));var path=require(_0xfd81('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd81('0x3'));var router=express[_0xfd81('0x4')]();var fs_extra=require(_0xfd81('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfd81('0x6'));var config=require(_0xfd81('0x7'));var controller=require(_0xfd81('0x8'));router['get']('/',auth[_0xfd81('0x9')](),controller[_0xfd81('0xa')]);router[_0xfd81('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xfd81('0xc')]);router[_0xfd81('0xb')]('/:id',auth[_0xfd81('0x9')](),controller[_0xfd81('0xd')]);router[_0xfd81('0xe')]('/',auth[_0xfd81('0x9')](),interaction['tracked'](_0xfd81('0xf'),_0xfd81('0x10')),controller[_0xfd81('0x11')]);router[_0xfd81('0x12')]('/:id',controller[_0xfd81('0x13')]);router[_0xfd81('0x12')]('/:id/accept',auth[_0xfd81('0x9')](),controller[_0xfd81('0x14')]);router[_0xfd81('0x12')](_0xfd81('0x15'),auth[_0xfd81('0x9')](),controller['reject']);router[_0xfd81('0x16')](_0xfd81('0x17'),auth[_0xfd81('0x9')](),controller[_0xfd81('0x18')]);module[_0xfd81('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ac2229b..3bc5ce3 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 _0x2032=['medium','exports','TEXT'];(function(_0x84d8eb,_0x54a720){var _0x3817cd=function(_0x36d8ae){while(--_0x36d8ae){_0x84d8eb['push'](_0x84d8eb['shift']());}};_0x3817cd(++_0x54a720);}(_0x2032,0xd9));var _0x2203=function(_0x10609b,_0xe6af53){_0x10609b=_0x10609b-0x0;var _0x2c63cc=_0x2032[_0x10609b];return _0x2c63cc;};'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 +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x48ab22,_0x496551){var _0xf04d6f=function(_0x1404c4){while(--_0x1404c4){_0x48ab22['push'](_0x48ab22['shift']());}};_0xf04d6f(++_0x496551);}(_0x5f2f,0x73));var _0xf5f2=function(_0xe03b17,_0x105292){_0xe03b17=_0xe03b17-0x0;var _0x3f0bc0=_0x5f2f[_0xe03b17];return _0x3f0bc0;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4ad16a9..2d27bb2 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4f43fb,_0x210312){var _0x339708=function(_0x10d82a){while(--_0x10d82a){_0x4f43fb['push'](_0x4f43fb['shift']());}};_0x339708(++_0x210312);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2ce381,_0x59139e){var _0x1f886e=function(_0x184873){while(--_0x184873){_0x2ce381['push'](_0x2ce381['shift']());}};_0x1f886e(++_0x59139e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 822190b..e9c6de7 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 _0x7744=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatOfflineMessage','update'];(function(_0x3d6389,_0x5eb3b0){var _0x33af83=function(_0x250466){while(--_0x250466){_0x3d6389['push'](_0x3d6389['shift']());}};_0x33af83(++_0x5eb3b0);}(_0x7744,0x1a7));var _0x4774=function(_0x3c4702,_0x315207){_0x3c4702=_0x3c4702-0x0;var _0x186a83=_0x7744[_0x3c4702];return _0x186a83;};'use strict';var EventEmitter=require(_0x4774('0x0'));var ChatOfflineMessage=require(_0x4774('0x1'))['db'][_0x4774('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4774('0x3'),'afterDestroy':'remove'};function emitEvent(_0x50a27e){return function(_0x5b6a3b,_0x3c8845,_0x1000cf){ChatOfflineMessageEvents['emit'](_0x50a27e+':'+_0x5b6a3b['id'],_0x5b6a3b);ChatOfflineMessageEvents[_0x4774('0x4')](_0x50a27e,_0x5b6a3b);_0x1000cf(null);};}for(var e in events){if(events[_0x4774('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x4774('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xc5a2=['remove','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','setMaxListeners','save'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xc5a2,0x149));var _0x2c5a=function(_0x279073,_0x227b6c){_0x279073=_0x279073-0x0;var _0x176e41=_0xc5a2[_0x279073];return _0x176e41;};'use strict';var EventEmitter=require(_0x2c5a('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x2c5a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x2c5a('0x2')](0x0);var events={'afterCreate':_0x2c5a('0x3'),'afterUpdate':'update','afterDestroy':_0x2c5a('0x4')};function emitEvent(_0x3053c9){return function(_0x52ae5c,_0x20c194,_0x2d2bd2){ChatOfflineMessageEvents[_0x2c5a('0x5')](_0x3053c9+':'+_0x52ae5c['id'],_0x52ae5c);ChatOfflineMessageEvents[_0x2c5a('0x5')](_0x3053c9,_0x52ae5c);_0x2d2bd2(null);};}for(var e in events){if(events[_0x2c5a('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x2c5a('0x7')](e,emitEvent(event));}}module[_0x2c5a('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6bb09f7..29d701c 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 _0x92ae=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0x32befe,_0x522c06){var _0x3ec8ed=function(_0x2994a9){while(--_0x2994a9){_0x32befe['push'](_0x32befe['shift']());}};_0x3ec8ed(++_0x522c06);}(_0x92ae,0x181));var _0xe92a=function(_0x42bc61,_0x28671e){_0x42bc61=_0x42bc61-0x0;var _0x44bd92=_0x92ae[_0x42bc61];return _0x44bd92;};'use strict';var attributes=require(_0xe92a('0x0'));module['exports']=function(_0xb6a381){return _0xb6a381[_0xe92a('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe92a('0x2')});}; \ No newline at end of file +var _0xdc12=['utf8mb4_unicode_ci','exports','ChatOfflineMessage','utf8mb4'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdc12,0xd5));var _0x2dc1=function(_0x1dc5bf,_0x9e14dd){_0x1dc5bf=_0x1dc5bf-0x0;var _0x3355a5=_0xdc12[_0x1dc5bf];return _0x3355a5;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x2dc1('0x0')]=function(_0x292626){return _0x292626['define'](_0x2dc1('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2dc1('0x2'),'collate':_0x2dc1('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7b88d55..2ce8b53 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 _0xc01b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc01b,0x74));var _0xbc01=function(_0x1c6de2,_0xa53bad){_0x1c6de2=_0x1c6de2-0x0;var _0x2f400c=_0xc01b[_0x1c6de2];return _0x2f400c;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var moment=require(_0xbc01('0x2'));var BPromise=require(_0xbc01('0x3'));var rs=require(_0xbc01('0x4'));var fs=require('fs');var Redis=require(_0xbc01('0x5'));var db=require(_0xbc01('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc01('0x7'))(_0xbc01('0x8'));var config=require(_0xbc01('0x9'));var jayson=require(_0xbc01('0xa'));var client=jayson[_0xbc01('0xb')][_0xbc01('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25b5b8,_0x34fb56,_0x2b0b4f){return new BPromise(function(_0x236dab,_0x43e0e3){return client['request'](_0x25b5b8,_0x2b0b4f)['then'](function(_0x1f7f1f){logger[_0xbc01('0xd')](_0xbc01('0xe'),_0x34fb56,_0xbc01('0xf'));logger[_0xbc01('0x10')](_0xbc01('0x11'),_0x34fb56,_0xbc01('0xf'),JSON['stringify'](_0x1f7f1f));if(_0x1f7f1f[_0xbc01('0x12')]){if(_0x1f7f1f[_0xbc01('0x12')][_0xbc01('0x13')]===0x1f4){logger['error'](_0xbc01('0xe'),_0x34fb56,_0x1f7f1f[_0xbc01('0x12')][_0xbc01('0x14')]);return _0x43e0e3(_0x1f7f1f['error']['message']);}logger['error'](_0xbc01('0xe'),_0x34fb56,_0x1f7f1f[_0xbc01('0x12')][_0xbc01('0x14')]);return _0x236dab(_0x1f7f1f[_0xbc01('0x12')]['message']);}else{logger[_0xbc01('0xd')](_0xbc01('0xe'),_0x34fb56,_0xbc01('0xf'));_0x236dab(_0x1f7f1f[_0xbc01('0x15')][_0xbc01('0x14')]);}})[_0xbc01('0x16')](function(_0xb56a44){logger[_0xbc01('0x12')](_0xbc01('0xe'),_0x34fb56,_0xb56a44);_0x43e0e3(_0xb56a44);});});} \ No newline at end of file +var _0x3d1b=['../../config/utils','../../config/logger','rpc','jayson/promise','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x18496e,_0x4ca16e){var _0x5ec01f=function(_0x527b82){while(--_0x527b82){_0x18496e['push'](_0x18496e['shift']());}};_0x5ec01f(++_0x4ca16e);}(_0x3d1b,0xb7));var _0xb3d1=function(_0x3b2c8e,_0x53910b){_0x3b2c8e=_0x3b2c8e-0x0;var _0x3ebe3d=_0x3d1b[_0x3b2c8e];return _0x3ebe3d;};'use strict';var _=require(_0xb3d1('0x0'));var util=require(_0xb3d1('0x1'));var moment=require(_0xb3d1('0x2'));var BPromise=require(_0xb3d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3d1('0x4'));var db=require(_0xb3d1('0x5'))['db'];var utils=require(_0xb3d1('0x6'));var logger=require(_0xb3d1('0x7'))(_0xb3d1('0x8'));var config=require('../../config/environment');var jayson=require(_0xb3d1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x539388,_0x4bd577,_0x2a26f2){return new BPromise(function(_0x10463c,_0x3f832c){return client[_0xb3d1('0xa')](_0x539388,_0x2a26f2)[_0xb3d1('0xb')](function(_0x459db0){logger['info'](_0xb3d1('0xc'),_0x4bd577,_0xb3d1('0xd'));logger[_0xb3d1('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4bd577,_0xb3d1('0xd'),JSON[_0xb3d1('0xf')](_0x459db0));if(_0x459db0[_0xb3d1('0x10')]){if(_0x459db0['error'][_0xb3d1('0x11')]===0x1f4){logger['error'](_0xb3d1('0xc'),_0x4bd577,_0x459db0[_0xb3d1('0x10')]['message']);return _0x3f832c(_0x459db0[_0xb3d1('0x10')]['message']);}logger['error'](_0xb3d1('0xc'),_0x4bd577,_0x459db0[_0xb3d1('0x10')][_0xb3d1('0x12')]);return _0x10463c(_0x459db0[_0xb3d1('0x10')][_0xb3d1('0x12')]);}else{logger[_0xb3d1('0x13')](_0xb3d1('0xc'),_0x4bd577,_0xb3d1('0xd'));_0x10463c(_0x459db0[_0xb3d1('0x14')][_0xb3d1('0x12')]);}})['catch'](function(_0x2cef56){logger[_0xb3d1('0x10')](_0xb3d1('0xc'),_0x4bd577,_0x2cef56);_0x3f832c(_0x2cef56);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 293045f..cd3a8f5 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 _0xe261=['../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','Router'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe261,0xeb));var _0x1e26=function(_0x4007af,_0x46f7eb){_0x4007af=_0x4007af-0x0;var _0x1c7e19=_0xe261[_0x4007af];return _0x1c7e19;};'use strict';var multer=require(_0x1e26('0x0'));var util=require('util');var path=require(_0x1e26('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e26('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1e26('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e26('0x4'));router[_0x1e26('0x5')]('/',auth[_0x1e26('0x6')](),controller[_0x1e26('0x7')]);router[_0x1e26('0x5')](_0x1e26('0x8'),auth[_0x1e26('0x6')](),controller['describe']);router['get'](_0x1e26('0x9'),auth[_0x1e26('0x6')](),controller['show']);router[_0x1e26('0xa')]('/',auth[_0x1e26('0x6')](),controller[_0x1e26('0xb')]);router[_0x1e26('0xc')](_0x1e26('0x9'),auth[_0x1e26('0x6')](),controller[_0x1e26('0xd')]);router[_0x1e26('0xe')](_0x1e26('0x9'),auth[_0x1e26('0x6')](),controller[_0x1e26('0xf')]);module[_0x1e26('0x10')]=router; \ No newline at end of file +var _0x18f9=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','describe','show','create','/:id','update','delete','exports','multer','util','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x18f9,0xeb));var _0x918f=function(_0x53cfb9,_0x10bfb6){_0x53cfb9=_0x53cfb9-0x0;var _0x5072c7=_0x18f9[_0x53cfb9];return _0x5072c7;};'use strict';var multer=require(_0x918f('0x0'));var util=require(_0x918f('0x1'));var path=require(_0x918f('0x2'));var timeout=require(_0x918f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x918f('0x4'));var auth=require(_0x918f('0x5'));var interaction=require(_0x918f('0x6'));var config=require('../../config/environment');var controller=require(_0x918f('0x7'));router[_0x918f('0x8')]('/',auth[_0x918f('0x9')](),controller['index']);router[_0x918f('0x8')]('/describe',auth[_0x918f('0x9')](),controller[_0x918f('0xa')]);router[_0x918f('0x8')]('/:id',auth[_0x918f('0x9')](),controller[_0x918f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x918f('0xc')]);router['put'](_0x918f('0xd'),auth[_0x918f('0x9')](),controller[_0x918f('0xe')]);router[_0x918f('0xf')]('/:id',auth[_0x918f('0x9')](),controller['destroy']);module[_0x918f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1457cb6..724b6f6 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 _0xe11d=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xe11d,0xc1));var _0xde11=function(_0x531617,_0x15f496){_0x531617=_0x531617-0x0;var _0x1e3858=_0xe11d[_0x531617];return _0x1e3858;};'use strict';var Sequelize=require(_0xde11('0x0'));module[_0xde11('0x1')]={'name':{'type':Sequelize[_0xde11('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xde11('0x3'),_0xde11('0x4')),'defaultValue':_0xde11('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xde11('0x5')]}}; \ No newline at end of file +var _0xf091=['STRING','ENUM','mouseOver','INTEGER','sequelize','exports'];(function(_0x46ee3c,_0x1c08f0){var _0x530a97=function(_0x194bba){while(--_0x194bba){_0x46ee3c['push'](_0x46ee3c['shift']());}};_0x530a97(++_0x1c08f0);}(_0xf091,0x118));var _0x1f09=function(_0x345209,_0x45773e){_0x345209=_0x345209-0x0;var _0x152e00=_0xf091[_0x345209];return _0x152e00;};'use strict';var Sequelize=require(_0x1f09('0x0'));module[_0x1f09('0x1')]={'name':{'type':Sequelize[_0x1f09('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1f09('0x3')](_0x1f09('0x4'),'timeout'),'defaultValue':_0x1f09('0x4')},'selector':{'type':Sequelize[_0x1f09('0x2')]},'timeout':{'type':Sequelize[_0x1f09('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ced1fb2..7348f5a 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 _0x5243=['mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','catch','destroy','eml-format','fast-json-patch','request-promise'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x5243,0x71));var _0x3524=function(_0x571a18,_0x435bf8){_0x571a18=_0x571a18-0x0;var _0x11f7a2=_0x5243[_0x571a18];return _0x11f7a2;};'use strict';var emlformat=require(_0x3524('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3524('0x1'));var rp=require(_0x3524('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3524('0x3'));var util=require(_0x3524('0x4'));var path=require('path');var sox=require(_0x3524('0x5'));var csv=require('to-csv');var ejs=require(_0x3524('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3524('0x7'));var squel=require(_0x3524('0x8'));var crypto=require(_0x3524('0x9'));var jsforce=require(_0x3524('0xa'));var deskjs=require(_0x3524('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3524('0xc'));var Redis=require(_0x3524('0xd'));var authService=require(_0x3524('0xe'));var qs=require(_0x3524('0xf'));var as=require(_0x3524('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3524('0x11'))(_0x3524('0x12'));var utils=require('../../config/utils');var config=require(_0x3524('0x13'));var licenseUtil=require(_0x3524('0x14'));var db=require(_0x3524('0x15'))['db'];function respondWithStatusCode(_0x5d5a60,_0x4f49da){_0x4f49da=_0x4f49da||0xcc;return function(_0x50c11f){if(_0x50c11f){return _0x5d5a60['sendStatus'](_0x4f49da);}return _0x5d5a60[_0x3524('0x16')](_0x4f49da)[_0x3524('0x17')]();};}function respondWithResult(_0x58cd29,_0x3aa2da){_0x3aa2da=_0x3aa2da||0xc8;return function(_0x253d92){if(_0x253d92){return _0x58cd29[_0x3524('0x16')](_0x3aa2da)[_0x3524('0x18')](_0x253d92);}};}function respondWithFilteredResult(_0xe5df67,_0x235cfd){return function(_0x34d9a0){if(_0x34d9a0){var _0x8440a4=typeof _0x235cfd[_0x3524('0x19')]==='undefined'&&typeof _0x235cfd[_0x3524('0x1a')]==='undefined';var _0x2eb681=_0x34d9a0[_0x3524('0x1b')];var _0x44ee2e=_0x8440a4?0x0:_0x235cfd[_0x3524('0x19')];var _0x1ca615=_0x8440a4?_0x34d9a0[_0x3524('0x1b')]:_0x235cfd['offset']+_0x235cfd['limit'];var _0x1acbd1;if(_0x1ca615>=_0x2eb681){_0x1ca615=_0x2eb681;_0x1acbd1=0xc8;}else{_0x1acbd1=0xce;}_0xe5df67['status'](_0x1acbd1);return _0xe5df67[_0x3524('0x1c')](_0x3524('0x1d'),_0x44ee2e+'-'+_0x1ca615+'/'+_0x2eb681)[_0x3524('0x18')](_0x34d9a0);}return null;};}function patchUpdates(_0xd285a3){return function(_0x1d25f8){try{jsonpatch[_0x3524('0x1e')](_0x1d25f8,_0xd285a3,!![]);}catch(_0x4f584a){return BPromise[_0x3524('0x1f')](_0x4f584a);}return _0x1d25f8[_0x3524('0x20')]();};}function saveUpdates(_0x1ab2c5,_0xf1b3b1){return function(_0x2d20c8){if(_0x2d20c8){return _0x2d20c8['update'](_0x1ab2c5)[_0x3524('0x21')](function(_0x52600c){return _0x52600c;});}return null;};}function removeEntity(_0x2eb72f,_0x26c20e){return function(_0x101e9a){if(_0x101e9a){return _0x101e9a['destroy']()[_0x3524('0x21')](function(){_0x2eb72f[_0x3524('0x16')](0xcc)[_0x3524('0x17')]();});}};}function handleEntityNotFound(_0x27bd6a,_0x4dfd49){return function(_0x4256ca){if(!_0x4256ca){_0x27bd6a[_0x3524('0x22')](0x194);}return _0x4256ca;};}function handleError(_0x1765a4,_0x5dc071){_0x5dc071=_0x5dc071||0x1f4;return function(_0x1d351e){logger[_0x3524('0x23')](_0x1d351e['stack']);if(_0x1d351e[_0x3524('0x24')]){delete _0x1d351e[_0x3524('0x24')];}_0x1765a4['status'](_0x5dc071)['send'](_0x1d351e);};}exports[_0x3524('0x25')]=function(_0x3fddc1,_0x225b26){var _0x651f11={'raw':!![],'where':{'id':_0x3fddc1[_0x3524('0x26')]['id']}},_0x5bf38e={};_0x5bf38e['model']=_[_0x3524('0x27')](db[_0x3524('0x28')][_0x3524('0x29')]);_0x5bf38e['query']=_['keys'](_0x3fddc1[_0x3524('0x2a')]);_0x5bf38e[_0x3524('0x2b')]=_['intersection'](_0x5bf38e[_0x3524('0x2c')],_0x5bf38e[_0x3524('0x2a')]);_0x651f11[_0x3524('0x2d')]=_[_0x3524('0x2e')](_0x5bf38e[_0x3524('0x2c')],qs['fields'](_0x3fddc1[_0x3524('0x2a')][_0x3524('0x2f')]));_0x651f11[_0x3524('0x2d')]=_0x651f11['attributes'][_0x3524('0x30')]?_0x651f11[_0x3524('0x2d')]:_0x5bf38e[_0x3524('0x2c')];if(_0x3fddc1[_0x3524('0x2a')][_0x3524('0x31')]){_0x651f11[_0x3524('0x32')]=[{'all':!![]}];}_0x651f11=_[_0x3524('0x33')]({},_0x651f11,_0x3fddc1[_0x3524('0x34')]);return db[_0x3524('0x28')][_0x3524('0x35')](_0x651f11)[_0x3524('0x21')](handleEntityNotFound(_0x225b26,null))['then'](respondWithResult(_0x225b26,null))['catch'](handleError(_0x225b26,null));};exports['create']=function(_0x197f78,_0x48b54b){return db[_0x3524('0x28')][_0x3524('0x36')](_0x197f78[_0x3524('0x37')],{})['then'](respondWithResult(_0x48b54b,0xc9))[_0x3524('0x38')](handleError(_0x48b54b,null));};exports['update']=function(_0x18ee71,_0xcc63d5){if(_0x18ee71[_0x3524('0x37')]['id']){delete _0x18ee71[_0x3524('0x37')]['id'];}return db[_0x3524('0x28')]['find']({'where':{'id':_0x18ee71[_0x3524('0x26')]['id']}})[_0x3524('0x21')](handleEntityNotFound(_0xcc63d5,null))[_0x3524('0x21')](saveUpdates(_0x18ee71[_0x3524('0x37')],null))['then'](respondWithResult(_0xcc63d5,null))[_0x3524('0x38')](handleError(_0xcc63d5,null));};exports[_0x3524('0x39')]=function(_0x449c51,_0x97b711){return db[_0x3524('0x28')]['find']({'where':{'id':_0x449c51['params']['id']}})[_0x3524('0x21')](handleEntityNotFound(_0x97b711,null))[_0x3524('0x21')](removeEntity(_0x97b711,null))[_0x3524('0x38')](handleError(_0x97b711,null));}; \ No newline at end of file +var _0xfd6e=['save','update','then','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','include','merge','find','catch','create','body','destroy','eml-format','zip-dir','request-promise','moment','path','ejs','fs-extra','lodash','squel','crypto','to-csv','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','json','offset','limit','undefined','count','set','Content-Range','apply','reject'];(function(_0x20a13e,_0x358d4b){var _0x136a55=function(_0x5eebeb){while(--_0x5eebeb){_0x20a13e['push'](_0x20a13e['shift']());}};_0x136a55(++_0x358d4b);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xefd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefd6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefd6('0x2'));var moment=require(_0xefd6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xefd6('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefd6('0x5'));var fs=require('fs');var fs_extra=require(_0xefd6('0x6'));var _=require(_0xefd6('0x7'));var squel=require(_0xefd6('0x8'));var crypto=require(_0xefd6('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xefd6('0xa'));var querystring=require(_0xefd6('0xb'));var Papa=require(_0xefd6('0xc'));var Redis=require('ioredis');var authService=require(_0xefd6('0xd'));var qs=require(_0xefd6('0xe'));var as=require(_0xefd6('0xf'));var hardwareService=require(_0xefd6('0x10'));var logger=require('../../config/logger')(_0xefd6('0x11'));var utils=require(_0xefd6('0x12'));var config=require(_0xefd6('0x13'));var licenseUtil=require(_0xefd6('0x14'));var db=require(_0xefd6('0x15'))['db'];function respondWithStatusCode(_0x34ad42,_0x3a8259){_0x3a8259=_0x3a8259||0xcc;return function(_0x1069f3){if(_0x1069f3){return _0x34ad42['sendStatus'](_0x3a8259);}return _0x34ad42[_0xefd6('0x16')](_0x3a8259)[_0xefd6('0x17')]();};}function respondWithResult(_0x45ac7f,_0x1ade7c){_0x1ade7c=_0x1ade7c||0xc8;return function(_0x1a8cc9){if(_0x1a8cc9){return _0x45ac7f['status'](_0x1ade7c)[_0xefd6('0x18')](_0x1a8cc9);}};}function respondWithFilteredResult(_0x4be0f8,_0x23d864){return function(_0x4d72ca){if(_0x4d72ca){var _0x25a39d=typeof _0x23d864[_0xefd6('0x19')]==='undefined'&&typeof _0x23d864[_0xefd6('0x1a')]===_0xefd6('0x1b');var _0x41e998=_0x4d72ca[_0xefd6('0x1c')];var _0xd59458=_0x25a39d?0x0:_0x23d864[_0xefd6('0x19')];var _0x469c17=_0x25a39d?_0x4d72ca[_0xefd6('0x1c')]:_0x23d864[_0xefd6('0x19')]+_0x23d864[_0xefd6('0x1a')];var _0x1aa125;if(_0x469c17>=_0x41e998){_0x469c17=_0x41e998;_0x1aa125=0xc8;}else{_0x1aa125=0xce;}_0x4be0f8['status'](_0x1aa125);return _0x4be0f8[_0xefd6('0x1d')](_0xefd6('0x1e'),_0xd59458+'-'+_0x469c17+'/'+_0x41e998)[_0xefd6('0x18')](_0x4d72ca);}return null;};}function patchUpdates(_0x3a26c5){return function(_0x122009){try{jsonpatch[_0xefd6('0x1f')](_0x122009,_0x3a26c5,!![]);}catch(_0x499c9b){return BPromise[_0xefd6('0x20')](_0x499c9b);}return _0x122009[_0xefd6('0x21')]();};}function saveUpdates(_0x586388,_0x2b0442){return function(_0x36d030){if(_0x36d030){return _0x36d030[_0xefd6('0x22')](_0x586388)['then'](function(_0x587643){return _0x587643;});}return null;};}function removeEntity(_0x1a0a7f,_0x1b1d41){return function(_0xe763eb){if(_0xe763eb){return _0xe763eb['destroy']()[_0xefd6('0x23')](function(){_0x1a0a7f[_0xefd6('0x16')](0xcc)[_0xefd6('0x17')]();});}};}function handleEntityNotFound(_0x5347fd,_0xf0adca){return function(_0x3d91b4){if(!_0x3d91b4){_0x5347fd['sendStatus'](0x194);}return _0x3d91b4;};}function handleError(_0x2be815,_0x2d71df){_0x2d71df=_0x2d71df||0x1f4;return function(_0x43ffbc){logger['error'](_0x43ffbc[_0xefd6('0x24')]);if(_0x43ffbc[_0xefd6('0x25')]){delete _0x43ffbc[_0xefd6('0x25')];}_0x2be815[_0xefd6('0x16')](_0x2d71df)[_0xefd6('0x26')](_0x43ffbc);};}exports[_0xefd6('0x27')]=function(_0x320e4f,_0x1783d7){var _0x5404ad={'raw':!![],'where':{'id':_0x320e4f[_0xefd6('0x28')]['id']}},_0xca6bad={};_0xca6bad[_0xefd6('0x29')]=_[_0xefd6('0x2a')](db[_0xefd6('0x2b')]['rawAttributes']);_0xca6bad[_0xefd6('0x2c')]=_[_0xefd6('0x2a')](_0x320e4f[_0xefd6('0x2c')]);_0xca6bad[_0xefd6('0x2d')]=_[_0xefd6('0x2e')](_0xca6bad[_0xefd6('0x29')],_0xca6bad['query']);_0x5404ad[_0xefd6('0x2f')]=_[_0xefd6('0x2e')](_0xca6bad[_0xefd6('0x29')],qs[_0xefd6('0x30')](_0x320e4f[_0xefd6('0x2c')][_0xefd6('0x30')]));_0x5404ad[_0xefd6('0x2f')]=_0x5404ad['attributes'][_0xefd6('0x31')]?_0x5404ad[_0xefd6('0x2f')]:_0xca6bad[_0xefd6('0x29')];if(_0x320e4f[_0xefd6('0x2c')]['includeAll']){_0x5404ad[_0xefd6('0x32')]=[{'all':!![]}];}_0x5404ad=_[_0xefd6('0x33')]({},_0x5404ad,_0x320e4f['options']);return db[_0xefd6('0x2b')][_0xefd6('0x34')](_0x5404ad)[_0xefd6('0x23')](handleEntityNotFound(_0x1783d7,null))[_0xefd6('0x23')](respondWithResult(_0x1783d7,null))[_0xefd6('0x35')](handleError(_0x1783d7,null));};exports[_0xefd6('0x36')]=function(_0x351ca5,_0x45a79a){return db[_0xefd6('0x2b')]['create'](_0x351ca5[_0xefd6('0x37')],{})[_0xefd6('0x23')](respondWithResult(_0x45a79a,0xc9))[_0xefd6('0x35')](handleError(_0x45a79a,null));};exports[_0xefd6('0x22')]=function(_0xaf2526,_0x2bf865){if(_0xaf2526['body']['id']){delete _0xaf2526[_0xefd6('0x37')]['id'];}return db[_0xefd6('0x2b')][_0xefd6('0x34')]({'where':{'id':_0xaf2526[_0xefd6('0x28')]['id']}})['then'](handleEntityNotFound(_0x2bf865,null))[_0xefd6('0x23')](saveUpdates(_0xaf2526[_0xefd6('0x37')],null))['then'](respondWithResult(_0x2bf865,null))[_0xefd6('0x35')](handleError(_0x2bf865,null));};exports[_0xefd6('0x38')]=function(_0x536ad1,_0x1d7615){return db[_0xefd6('0x2b')][_0xefd6('0x34')]({'where':{'id':_0x536ad1[_0xefd6('0x28')]['id']}})[_0xefd6('0x23')](handleEntityNotFound(_0x1d7615,null))[_0xefd6('0x23')](removeEntity(_0x1d7615,null))['catch'](handleError(_0x1d7615,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index cd935a9..3a2c790 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 _0xf92a=['ChatProactiveAction','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xf92a,0x1c1));var _0xaf92=function(_0x62cc84,_0x353273){_0x62cc84=_0x62cc84-0x0;var _0x518bba=_0xf92a[_0x62cc84];return _0x518bba;};'use strict';var _=require(_0xaf92('0x0'));var util=require('util');var logger=require(_0xaf92('0x1'))('api');var moment=require(_0xaf92('0x2'));var BPromise=require(_0xaf92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaf92('0x4'));var config=require(_0xaf92('0x5'));var attributes=require(_0xaf92('0x6'));module['exports']=function(_0x28027a,_0x4c9955){return _0x28027a['define'](_0xaf92('0x7'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa81=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util','moment','bluebird','request-promise'];(function(_0x55ade5,_0x30452a){var _0x2f0086=function(_0x160e21){while(--_0x160e21){_0x55ade5['push'](_0x55ade5['shift']());}};_0x2f0086(++_0x30452a);}(_0xaa81,0x15b));var _0x1aa8=function(_0x367257,_0xef82e4){_0x367257=_0x367257-0x0;var _0x1dc4f4=_0xaa81[_0x367257];return _0x1dc4f4;};'use strict';var _=require(_0x1aa8('0x0'));var util=require(_0x1aa8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1aa8('0x2'));var BPromise=require(_0x1aa8('0x3'));var rp=require(_0x1aa8('0x4'));var fs=require('fs');var path=require(_0x1aa8('0x5'));var rimraf=require(_0x1aa8('0x6'));var config=require(_0x1aa8('0x7'));var attributes=require(_0x1aa8('0x8'));module['exports']=function(_0x11f432,_0x5106c3){return _0x11f432[_0x1aa8('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x1aa8('0xa'),'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 9b9b723..30ae6ba 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 _0x8265=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x8265,0x12b));var _0x5826=function(_0x251cbf,_0x33f00d){_0x251cbf=_0x251cbf-0x0;var _0x4254ab=_0x8265[_0x251cbf];return _0x4254ab;};'use strict';var _=require('lodash');var util=require(_0x5826('0x0'));var moment=require(_0x5826('0x1'));var BPromise=require('bluebird');var rs=require(_0x5826('0x2'));var fs=require('fs');var Redis=require(_0x5826('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5826('0x4'));var logger=require(_0x5826('0x5'))('rpc');var config=require(_0x5826('0x6'));var jayson=require(_0x5826('0x7'));var client=jayson[_0x5826('0x8')][_0x5826('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a0993,_0x434011,_0x465f69){return new BPromise(function(_0x3b43db,_0x30231a){return client[_0x5826('0xa')](_0x4a0993,_0x465f69)[_0x5826('0xb')](function(_0x5c606c){logger[_0x5826('0xc')](_0x5826('0xd'),_0x434011,_0x5826('0xe'));logger[_0x5826('0xf')](_0x5826('0x10'),_0x434011,_0x5826('0xe'),JSON[_0x5826('0x11')](_0x5c606c));if(_0x5c606c['error']){if(_0x5c606c[_0x5826('0x12')][_0x5826('0x13')]===0x1f4){logger[_0x5826('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x434011,_0x5c606c[_0x5826('0x12')]['message']);return _0x30231a(_0x5c606c[_0x5826('0x12')][_0x5826('0x14')]);}logger[_0x5826('0x12')](_0x5826('0xd'),_0x434011,_0x5c606c[_0x5826('0x12')][_0x5826('0x14')]);return _0x3b43db(_0x5c606c[_0x5826('0x12')][_0x5826('0x14')]);}else{logger[_0x5826('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x434011,_0x5826('0xe'));_0x3b43db(_0x5c606c[_0x5826('0x15')][_0x5826('0x14')]);}})['catch'](function(_0x1c321d){logger[_0x5826('0x12')](_0x5826('0xd'),_0x434011,_0x1c321d);_0x30231a(_0x1c321d);});});} \ No newline at end of file +var _0xb1e1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment'];(function(_0xf63b0d,_0x2815f8){var _0x2fcdc1=function(_0x56ffa0){while(--_0x56ffa0){_0xf63b0d['push'](_0xf63b0d['shift']());}};_0x2fcdc1(++_0x2815f8);}(_0xb1e1,0x1cc));var _0x1b1e=function(_0x58c2cf,_0x41e1c2){_0x58c2cf=_0x58c2cf-0x0;var _0x3a5e0a=_0xb1e1[_0x58c2cf];return _0x3a5e0a;};'use strict';var _=require('lodash');var util=require(_0x1b1e('0x0'));var moment=require(_0x1b1e('0x1'));var BPromise=require(_0x1b1e('0x2'));var rs=require(_0x1b1e('0x3'));var fs=require('fs');var Redis=require(_0x1b1e('0x4'));var db=require(_0x1b1e('0x5'))['db'];var utils=require(_0x1b1e('0x6'));var logger=require(_0x1b1e('0x7'))(_0x1b1e('0x8'));var config=require(_0x1b1e('0x9'));var jayson=require(_0x1b1e('0xa'));var client=jayson[_0x1b1e('0xb')][_0x1b1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51e48b,_0x1a29ca,_0x48aafd){return new BPromise(function(_0x200755,_0x5de5f5){return client['request'](_0x51e48b,_0x48aafd)['then'](function(_0x17bad5){logger[_0x1b1e('0xd')](_0x1b1e('0xe'),_0x1a29ca,_0x1b1e('0xf'));logger['debug'](_0x1b1e('0x10'),_0x1a29ca,_0x1b1e('0xf'),JSON[_0x1b1e('0x11')](_0x17bad5));if(_0x17bad5[_0x1b1e('0x12')]){if(_0x17bad5[_0x1b1e('0x12')]['code']===0x1f4){logger[_0x1b1e('0x12')](_0x1b1e('0xe'),_0x1a29ca,_0x17bad5['error'][_0x1b1e('0x13')]);return _0x5de5f5(_0x17bad5[_0x1b1e('0x12')][_0x1b1e('0x13')]);}logger[_0x1b1e('0x12')](_0x1b1e('0xe'),_0x1a29ca,_0x17bad5['error'][_0x1b1e('0x13')]);return _0x200755(_0x17bad5['error'][_0x1b1e('0x13')]);}else{logger[_0x1b1e('0xd')](_0x1b1e('0xe'),_0x1a29ca,'request\x20sent');_0x200755(_0x17bad5['result'][_0x1b1e('0x13')]);}})[_0x1b1e('0x14')](function(_0xdac32f){logger[_0x1b1e('0x12')](_0x1b1e('0xe'),_0x1a29ca,_0xdac32f);_0x5de5f5(_0xdac32f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b115d6a..0e812ee 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 _0xc4aa=['show','post','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x4033e7,_0x4f66e8){var _0x1cba75=function(_0x5deb4b){while(--_0x5deb4b){_0x4033e7['push'](_0x4033e7['shift']());}};_0x1cba75(++_0x4f66e8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xb')]);router[_0xac4a('0xc')]('/',auth[_0xac4a('0xa')](),controller['create']);router['put'](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xd')]);router['delete'](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbd51=['show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','./chatProactiveAction.controller','get','/:id'];(function(_0x30bbe4,_0x16c2af){var _0x4019a5=function(_0x339e7c){while(--_0x339e7c){_0x30bbe4['push'](_0x30bbe4['shift']());}};_0x4019a5(++_0x16c2af);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xf11bd8,_0x21d625){_0xf11bd8=_0xf11bd8-0x0;var _0x2d2d13=_0xbd51[_0xf11bd8];return _0x2d2d13;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bd5('0x5'));router[_0x1bd5('0x6')](_0x1bd5('0x7'),auth['isAuthenticated'](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xb')]);router[_0x1bd5('0xc')]('/:id',auth[_0x1bd5('0xa')](),controller['update']);router[_0x1bd5('0xd')](_0x1bd5('0x7'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f9c1ea8..121f24e 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 _0x8c23=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0x8c23,0x168));var _0x38c2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8c23[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x38c2('0x0'));module[_0x38c2('0x1')]={'name':{'type':Sequelize[_0x38c2('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x38c2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x38c2('0x4')](_0x38c2('0x5'),'beepall',_0x38c2('0x6'))}}; \ No newline at end of file +var _0x509b=['exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x509b,0x1e0));var _0xb509=function(_0x7cb56,_0x57c855){_0x7cb56=_0x7cb56-0x0;var _0x4e6f9a=_0x509b[_0x7cb56];return _0x4e6f9a;};'use strict';var Sequelize=require('sequelize');module[_0xb509('0x0')]={'name':{'type':Sequelize[_0xb509('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb509('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb509('0x3'),_0xb509('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 09416f2..0742ed1 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 _0xb3eb=['api','../../config/environment','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','UserProfileResource','stack','name','send','index','map','ChatQueue','type','key','where','include','query','findAll','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','merge','options','catch','create','body','user','role','ChatQueues','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','rows','format','SIP','order','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','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','includes','all','union','isEmpty','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs'];(function(_0x5f53d1,_0x31cf6d){var _0x5740c0=function(_0x31ed9b){while(--_0x31ed9b){_0x5f53d1['push'](_0x5f53d1['shift']());}};_0x5740c0(++_0x31cf6d);}(_0xb3eb,0x77));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xbb3e('0x0'));var util=require(_0xbb3e('0x1'));var _=require(_0xbb3e('0x2'));var squel=require(_0xbb3e('0x3'));var Redis=require('ioredis');var qs=require(_0xbb3e('0x4'));var logger=require('../../config/logger')(_0xbb3e('0x5'));var config=require(_0xbb3e('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xbb3e('0x7')],{'host':_0xbb3e('0x8'),'port':0x18eb});var socket=require(_0xbb3e('0x9'))(new Redis(config[_0xbb3e('0x7')]));require(_0xbb3e('0xa'))[_0xbb3e('0xb')](socket);function respondWithStatusCode(_0x5616f8,_0x14a43e){_0x14a43e=_0x14a43e||0xcc;return function(_0x1ec829){if(_0x1ec829){return _0x5616f8[_0xbb3e('0xc')](_0x14a43e);}return _0x5616f8[_0xbb3e('0xd')](_0x14a43e)[_0xbb3e('0xe')]();};}function respondWithResult(_0x4f8098,_0x159898){_0x159898=_0x159898||0xc8;return function(_0x3fc379){if(_0x3fc379){return _0x4f8098[_0xbb3e('0xd')](_0x159898)[_0xbb3e('0xf')](_0x3fc379);}};}function respondWithFilteredResult(_0x44ff37,_0x24f92b){return function(_0x20c7e9){if(_0x20c7e9){var _0xabc862=typeof _0x24f92b[_0xbb3e('0x10')]===_0xbb3e('0x11')&&typeof _0x24f92b[_0xbb3e('0x12')]===_0xbb3e('0x11');var _0x40fbd0=_0x20c7e9[_0xbb3e('0x13')];var _0x49048c=_0xabc862?0x0:_0x24f92b[_0xbb3e('0x10')];var _0x11ef43=_0xabc862?_0x20c7e9[_0xbb3e('0x13')]:_0x24f92b['offset']+_0x24f92b[_0xbb3e('0x12')];var _0x51ba72;if(_0x11ef43>=_0x40fbd0){_0x11ef43=_0x40fbd0;_0x51ba72=0xc8;}else{_0x51ba72=0xce;}_0x44ff37[_0xbb3e('0xd')](_0x51ba72);return _0x44ff37[_0xbb3e('0x14')](_0xbb3e('0x15'),_0x49048c+'-'+_0x11ef43+'/'+_0x40fbd0)['json'](_0x20c7e9);}return null;};}function saveUpdates(_0x1d0983){return function(_0x44e6d4){if(_0x44e6d4){return _0x44e6d4['update'](_0x1d0983)['then'](function(_0x554fea){return _0x554fea;});}return null;};}function removeEntity(_0x43614e){return function(_0x8b3743){if(_0x8b3743){return _0x8b3743[_0xbb3e('0x16')]()[_0xbb3e('0x17')](function(){var _0x39b900=_0x8b3743[_0xbb3e('0x18')]({'plain':!![]});var _0x23abeb='ChatQueues';return db[_0xbb3e('0x19')][_0xbb3e('0x16')]({'where':{'type':_0x23abeb,'resourceId':_0x39b900['id']}})[_0xbb3e('0x17')](function(){return _0x8b3743;});})[_0xbb3e('0x17')](function(){_0x43614e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52784f){return function(_0x547869){if(!_0x547869){_0x52784f[_0xbb3e('0xc')](0x194);}return _0x547869;};}function handleError(_0x15c9ed,_0x27cc82){_0x27cc82=_0x27cc82||0x1f4;return function(_0x2fd6a7){logger['error'](_0x2fd6a7[_0xbb3e('0x1a')]);if(_0x2fd6a7[_0xbb3e('0x1b')]){delete _0x2fd6a7[_0xbb3e('0x1b')];}_0x15c9ed['status'](_0x27cc82)[_0xbb3e('0x1c')](_0x2fd6a7);};}exports[_0xbb3e('0x1d')]=function(_0x199487,_0x1766be){var _0x1f4ae={};var _0x5642a5={'count':0x0,'rows':[]};var _0x1011db=_[_0xbb3e('0x1e')](db[_0xbb3e('0x1f')]['rawAttributes'],function(_0x22566e){return{'name':_0x22566e['fieldName'],'type':_0x22566e[_0xbb3e('0x20')][_0xbb3e('0x21')]};});_0x1f4ae=qs['getOptions'](_0x1011db,_0x199487);var _0x2dc991={'where':_0x1f4ae[_0xbb3e('0x22')]};return db[_0xbb3e('0x1f')]['count'](_0x2dc991)['then'](function(_0x49c0ce){_0x5642a5[_0xbb3e('0x13')]=_0x49c0ce;_0x1f4ae[_0xbb3e('0x23')]=qs[_0xbb3e('0x23')](_0x199487[_0xbb3e('0x24')]);return db[_0xbb3e('0x1f')][_0xbb3e('0x25')](_0x1f4ae);})[_0xbb3e('0x17')](function(_0x285458){_0x5642a5['rows']=_0x285458;return _0x5642a5;})[_0xbb3e('0x17')](respondWithFilteredResult(_0x1766be,_0x1f4ae))['catch'](handleError(_0x1766be,null));};exports[_0xbb3e('0x26')]=function(_0x6d424,_0x2074a9){var _0x412a84={'raw':!![],'where':{'id':_0x6d424['params']['id']}},_0x3e228d={};_0x3e228d[_0xbb3e('0x27')]=_[_0xbb3e('0x28')](db[_0xbb3e('0x1f')][_0xbb3e('0x29')]);_0x3e228d['query']=_['keys'](_0x6d424['query']);_0x3e228d[_0xbb3e('0x2a')]=_[_0xbb3e('0x2b')](_0x3e228d[_0xbb3e('0x27')],_0x3e228d[_0xbb3e('0x24')]);_0x412a84[_0xbb3e('0x2c')]=_[_0xbb3e('0x2b')](_0x3e228d[_0xbb3e('0x27')],qs[_0xbb3e('0x2d')](_0x6d424['query'][_0xbb3e('0x2d')]));_0x412a84[_0xbb3e('0x2c')]=_0x412a84[_0xbb3e('0x2c')][_0xbb3e('0x2e')]?_0x412a84[_0xbb3e('0x2c')]:_0x3e228d[_0xbb3e('0x27')];if(_0x6d424[_0xbb3e('0x24')]['includeAll']){_0x412a84['include']=[{'all':!![]}];}_0x412a84=_[_0xbb3e('0x2f')]({},_0x412a84,_0x6d424[_0xbb3e('0x30')]);return db['ChatQueue']['find'](_0x412a84)[_0xbb3e('0x17')](handleEntityNotFound(_0x2074a9,null))[_0xbb3e('0x17')](respondWithResult(_0x2074a9,null))[_0xbb3e('0x31')](handleError(_0x2074a9,null));};exports['create']=function(_0x57dee0,_0x5d6f1d){return db['ChatQueue'][_0xbb3e('0x32')](_0x57dee0[_0xbb3e('0x33')],{})[_0xbb3e('0x17')](function(_0x4b2dec){var _0x2d9ca3=_0x57dee0[_0xbb3e('0x34')][_0xbb3e('0x18')]({'plain':!![]});if(!_0x2d9ca3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d9ca3[_0xbb3e('0x35')]==='user'){var _0x4f6059=_0x4b2dec[_0xbb3e('0x18')]({'plain':!![]});var _0x1c34d6=_0xbb3e('0x36');return db[_0xbb3e('0x37')][_0xbb3e('0x38')]({'where':{'name':_0x1c34d6,'userProfileId':_0x2d9ca3[_0xbb3e('0x39')]},'raw':!![]})['then'](function(_0x2b9e39){if(_0x2b9e39&&_0x2b9e39[_0xbb3e('0x3a')]===0x0){return db[_0xbb3e('0x19')][_0xbb3e('0x32')]({'name':_0x4f6059[_0xbb3e('0x1b')],'resourceId':_0x4f6059['id'],'type':_0x2b9e39[_0xbb3e('0x1b')],'sectionId':_0x2b9e39['id']},{})[_0xbb3e('0x17')](function(){return _0x4b2dec;});}else{return _0x4b2dec;}})[_0xbb3e('0x31')](function(_0x305b64){logger[_0xbb3e('0x3b')](_0xbb3e('0x3c'),_0x305b64);throw _0x305b64;});}return _0x4b2dec;})[_0xbb3e('0x17')](respondWithResult(_0x5d6f1d,0xc9))[_0xbb3e('0x31')](handleError(_0x5d6f1d,null));};exports[_0xbb3e('0x3d')]=function(_0x16b525,_0x11e5b3){if(_0x16b525[_0xbb3e('0x33')]['id']){delete _0x16b525[_0xbb3e('0x33')]['id'];}return db[_0xbb3e('0x1f')][_0xbb3e('0x38')]({'where':{'id':_0x16b525[_0xbb3e('0x3e')]['id']}})[_0xbb3e('0x17')](handleEntityNotFound(_0x11e5b3,null))[_0xbb3e('0x17')](saveUpdates(_0x16b525['body'],null))[_0xbb3e('0x17')](respondWithResult(_0x11e5b3,null))[_0xbb3e('0x31')](handleError(_0x11e5b3,null));};exports[_0xbb3e('0x16')]=function(_0x4f3fe3,_0x3d42a3){return db['ChatQueue'][_0xbb3e('0x38')]({'where':{'id':_0x4f3fe3[_0xbb3e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3d42a3,null))[_0xbb3e('0x17')](removeEntity(_0x3d42a3,null))[_0xbb3e('0x31')](handleError(_0x3d42a3,null));};exports['describe']=function(_0x1851dc,_0x2db02f){return db[_0xbb3e('0x1f')][_0xbb3e('0x3f')]()[_0xbb3e('0x17')](respondWithResult(_0x2db02f,null))[_0xbb3e('0x31')](handleError(_0x2db02f,null));};exports['getMembers']=function(_0x1870f3,_0x56a1a1){var _0x27b582={'raw':!![],'where':{}},_0x1dd10b={},_0x3c516e;return db[_0xbb3e('0x1f')][_0xbb3e('0x40')]({'where':{'id':_0x1870f3['params']['id']}})[_0xbb3e('0x17')](handleEntityNotFound(_0x56a1a1,null))[_0xbb3e('0x17')](function(_0x488753){if(_0x488753){_0x3c516e=_0x488753[_0xbb3e('0x18')]({'plain':!![]});_0x1dd10b[_0xbb3e('0x27')]=_[_0xbb3e('0x28')](db[_0xbb3e('0x41')][_0xbb3e('0x29')]);_0x1dd10b['query']=_[_0xbb3e('0x28')](_0x1870f3[_0xbb3e('0x24')]);_0x1dd10b[_0xbb3e('0x2a')]=_[_0xbb3e('0x2b')](_0x1dd10b[_0xbb3e('0x27')],_0x1dd10b[_0xbb3e('0x24')]);_0x27b582['attributes']=_['intersection'](_0x1dd10b['model'],qs[_0xbb3e('0x2d')](_0x1870f3['query'][_0xbb3e('0x2d')]));_0x27b582[_0xbb3e('0x2c')]=_0x27b582[_0xbb3e('0x2c')]['length']?_0x27b582[_0xbb3e('0x2c')]:_0x1dd10b[_0xbb3e('0x27')];if(!_0x1870f3[_0xbb3e('0x24')][_0xbb3e('0x42')](_0xbb3e('0x43'))){_0x27b582[_0xbb3e('0x12')]=qs[_0xbb3e('0x12')](_0x1870f3[_0xbb3e('0x24')]['limit']);_0x27b582['offset']=qs[_0xbb3e('0x10')](_0x1870f3[_0xbb3e('0x24')][_0xbb3e('0x10')]);}_0x27b582['order']=qs[_0xbb3e('0x44')](_0x1870f3[_0xbb3e('0x24')]['sort']);_0x27b582[_0xbb3e('0x22')]=qs[_0xbb3e('0x2a')](_[_0xbb3e('0x45')](_0x1870f3['query'],_0x1dd10b['filters']));_0x27b582['where'][_0xbb3e('0x46')]=_0x488753['id'];if(_0x1870f3[_0xbb3e('0x24')]['filter']){_0x27b582['where']=_[_0xbb3e('0x2f')](_0x27b582['where'],{'$or':_['map'](_0x27b582['attributes'],function(_0x2f0106){var _0x8016={};_0x8016[_0x2f0106]={'$like':'%'+_0x1870f3[_0xbb3e('0x24')][_0xbb3e('0x47')]+'%'};return _0x8016;})});}_0x27b582=_[_0xbb3e('0x2f')]({},_0x27b582,_0x1870f3['options']);return db[_0xbb3e('0x41')][_0xbb3e('0x25')](_0x27b582);}})[_0xbb3e('0x17')](function(_0x481f21){if(_0x481f21){return db[_0xbb3e('0x48')][_0xbb3e('0x49')]({'where':{'id':_['map'](_0x481f21,'UserId'),'role':_0xbb3e('0x4a')},'attributes':['id',_0xbb3e('0x1b'),_0xbb3e('0x4b'),_0xbb3e('0x4c'),_0xbb3e('0x4d')]});}})[_0xbb3e('0x17')](function(_0x27a05a){if(_0x27a05a){return{'count':_0x27a05a[_0xbb3e('0x13')],'rows':_['map'](_0x27a05a[_0xbb3e('0x4e')],function(_0x22da12){return{'membername':_0x22da12[_0xbb3e('0x1b')],'UserId':_0x22da12['id'],'queue_name':_0x3c516e['name'],'ChatQueueId':_0x3c516e['id'],'interface':util[_0xbb3e('0x4f')]('%s/%s',_0xbb3e('0x50'),_0x22da12[_0xbb3e('0x1b')]),'penalty':0x0,'paused':_0x22da12[_0xbb3e('0x4b')],'createdAt':_0x22da12[_0xbb3e('0x4d')],'updatedAt':_0x22da12['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbb3e('0x17')](respondWithFilteredResult(_0x56a1a1,_0x27b582))[_0xbb3e('0x31')](handleError(_0x56a1a1,null));};exports['getTeams']=function(_0x58d659,_0x4dc224){var _0x1ace4e={};var _0x5351c0={};var _0x28eec8;var _0x4af3f7;return db[_0xbb3e('0x1f')][_0xbb3e('0x40')]({'where':{'id':_0x58d659[_0xbb3e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4dc224,null))['then'](function(_0x447dbc){if(_0x447dbc){_0x28eec8=_0x447dbc;_0x5351c0[_0xbb3e('0x27')]=_[_0xbb3e('0x28')](db['Team'][_0xbb3e('0x29')]);_0x5351c0[_0xbb3e('0x24')]=_[_0xbb3e('0x28')](_0x58d659['query']);_0x5351c0[_0xbb3e('0x2a')]=_[_0xbb3e('0x2b')](_0x5351c0[_0xbb3e('0x27')],_0x5351c0[_0xbb3e('0x24')]);_0x1ace4e[_0xbb3e('0x2c')]=_[_0xbb3e('0x2b')](_0x5351c0[_0xbb3e('0x27')],qs[_0xbb3e('0x2d')](_0x58d659[_0xbb3e('0x24')][_0xbb3e('0x2d')]));_0x1ace4e[_0xbb3e('0x2c')]=_0x1ace4e[_0xbb3e('0x2c')]['length']?_0x1ace4e[_0xbb3e('0x2c')]:_0x5351c0[_0xbb3e('0x27')];_0x1ace4e[_0xbb3e('0x51')]=qs[_0xbb3e('0x44')](_0x58d659[_0xbb3e('0x24')]['sort']);_0x1ace4e[_0xbb3e('0x22')]=qs[_0xbb3e('0x2a')](_[_0xbb3e('0x45')](_0x58d659[_0xbb3e('0x24')],_0x5351c0[_0xbb3e('0x2a')]));if(_0x58d659[_0xbb3e('0x24')]['filter']){_0x1ace4e[_0xbb3e('0x22')]=_[_0xbb3e('0x2f')](_0x1ace4e[_0xbb3e('0x22')],{'$or':_[_0xbb3e('0x1e')](_0x1ace4e[_0xbb3e('0x2c')],function(_0x22664b){var _0x2257c3={};_0x2257c3[_0x22664b]={'$like':'%'+_0x58d659[_0xbb3e('0x24')]['filter']+'%'};return _0x2257c3;})});}_0x1ace4e=_[_0xbb3e('0x2f')]({},_0x1ace4e,_0x58d659[_0xbb3e('0x30')]);return _0x28eec8[_0xbb3e('0x52')](_0x1ace4e);}})[_0xbb3e('0x17')](function(_0x445025){if(_0x445025){_0x4af3f7=_0x445025[_0xbb3e('0x2e')];if(!_0x58d659[_0xbb3e('0x24')]['hasOwnProperty'](_0xbb3e('0x43'))){_0x1ace4e[_0xbb3e('0x12')]=qs['limit'](_0x58d659[_0xbb3e('0x24')][_0xbb3e('0x12')]);_0x1ace4e[_0xbb3e('0x10')]=qs[_0xbb3e('0x10')](_0x58d659['query'][_0xbb3e('0x10')]);}return _0x28eec8['getTeams'](_0x1ace4e);}})[_0xbb3e('0x17')](function(_0x46a98f){if(_0x46a98f){return _0x46a98f?{'count':_0x4af3f7,'rows':_0x46a98f}:null;}})[_0xbb3e('0x17')](respondWithResult(_0x4dc224,null))[_0xbb3e('0x31')](handleError(_0x4dc224,null));};exports[_0xbb3e('0x53')]=function(_0x5aa1e2,_0x4bd845){var _0x77ef57=_0x5aa1e2[_0xbb3e('0x33')][_0xbb3e('0x54')];return db[_0xbb3e('0x55')]['findAll']({'where':{'id':_0x77ef57},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbb3e('0x56'),'attributes':['id',_0xbb3e('0x1b'),_0xbb3e('0x57'),'voicePause',_0xbb3e('0x58')],'raw':!![]}]})['then'](function(_0x4d582a){if(_0x4d582a){var _0x41459c=_[_0xbb3e('0x59')](_0x4d582a,function(_0x2c7666){var _0x4d117a=_0x2c7666[_0xbb3e('0x18')]({'plain':!![]});return _0x4d117a[_0xbb3e('0x56')];});return db[_0xbb3e('0x1f')][_0xbb3e('0x38')]({'where':{'id':_0x5aa1e2['params']['id']}})[_0xbb3e('0x17')](function(_0x561fad){return db['sequelize'][_0xbb3e('0x5a')](function(_0x51ff9c){return _0x561fad[_0xbb3e('0x53')](_0x77ef57,{'transaction':_0x51ff9c})[_0xbb3e('0x17')](function(){return BPromise[_0xbb3e('0x5b')](_0x41459c,function(_0xc81fc){return db[_0xbb3e('0x41')][_0xbb3e('0x5c')]({'where':{'UserId':_0xc81fc['id'],'ChatQueueId':_0x5aa1e2[_0xbb3e('0x3e')]['id']},'transaction':_0x51ff9c});});})[_0xbb3e('0x17')](function(){_0x41459c[_0xbb3e('0x5d')](function(_0x166e67){socket[_0xbb3e('0x5e')]('userChatQueue:save',{'UserId':_0x166e67['id'],'ChatQueueId':_0x561fad['id']});});});});});}})['then'](respondWithStatusCode(_0x4bd845,null))['catch'](handleError(_0x4bd845,null));};exports[_0xbb3e('0x5f')]=function(_0x408f19,_0x360f90){return db[_0xbb3e('0x55')][_0xbb3e('0x25')]({'where':{'id':_0x408f19[_0xbb3e('0x24')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbb3e('0x17')](handleEntityNotFound(_0x360f90,null))[_0xbb3e('0x17')](function(_0x37b0f1){var _0x7c6b0d=_[_0xbb3e('0x1e')](_0x37b0f1,'id');var _0x18f2c7=[];var _0xb68bff=[];var _0xfe3cb0=squel['select']();_0xfe3cb0[_0xbb3e('0x60')](_0xbb3e('0x61'))[_0xbb3e('0x62')](_0xbb3e('0x63'),'tq')[_0xbb3e('0x64')](_0xbb3e('0x65'),'ut',_0xbb3e('0x66'))['where'](_0xbb3e('0x67'),_0x408f19['params']['id']);for(var _0x452261=0x0;_0x452261<_0x37b0f1[_0xbb3e('0x2e')];_0x452261+=0x1){let _0x3e9720=_0x37b0f1[_0x452261];for(var _0x1cbc25=0x0;_0x1cbc25<_0x3e9720['Agents'][_0xbb3e('0x2e')];_0x1cbc25+=0x1){let _0x355c48=_0x3e9720[_0xbb3e('0x56')][_0x1cbc25];var _0x552c5f=_0xfe3cb0[_0xbb3e('0x68')]();_0x552c5f[_0xbb3e('0x22')](_0xbb3e('0x69'),_0x355c48['id']);_0xb68bff[_0xbb3e('0x6a')](db[_0xbb3e('0x6b')][_0xbb3e('0x24')](_0x552c5f[_0xbb3e('0x6c')](),{'type':db['sequelize'][_0xbb3e('0x6d')][_0xbb3e('0x6e')]})['then'](function(_0x452997){if(_0x452997['length']===0x1){return _0x355c48['id'];}else{var _0x50e605=_[_0xbb3e('0x6f')](_[_0xbb3e('0x1e')](_0x452997,'TeamId'),function(_0x336278){return _[_0xbb3e('0x70')](_0x7c6b0d,_0x336278);});if(_0x50e605){return _0x355c48['id'];}}}));}}return BPromise[_0xbb3e('0x71')](_0xb68bff)[_0xbb3e('0x17')](function(_0x3bd513){_0x18f2c7=_(_0x18f2c7)[_0xbb3e('0x72')](_0x3bd513)['compact']()['value']();return db['ChatQueue'][_0xbb3e('0x38')]({'where':{'id':_0x408f19['params']['id']}})['then'](function(_0xfc94e7){return db[_0xbb3e('0x6b')][_0xbb3e('0x5a')](function(_0x37ab0e){return _0xfc94e7[_0xbb3e('0x5f')](_0x408f19[_0xbb3e('0x24')][_0xbb3e('0x54')],{'transaction':_0x37ab0e})[_0xbb3e('0x17')](function(){if(!_[_0xbb3e('0x73')](_0x18f2c7)){return _0xfc94e7['removeAgents'](_0x18f2c7,{'transaction':_0x37ab0e});}})['then'](function(){_0x18f2c7['forEach'](function(_0x8e28db){socket[_0xbb3e('0x5e')](_0xbb3e('0x74'),{'UserId':_0x8e28db,'ChatQueueId':_0xfc94e7['id']});});});});});});})[_0xbb3e('0x17')](respondWithStatusCode(_0x360f90,null))[_0xbb3e('0x31')](handleError(_0x360f90,null));};exports[_0xbb3e('0x75')]=function(_0x5a61f0,_0x58b6aa){return db[_0xbb3e('0x1f')][_0xbb3e('0x38')]({'where':{'id':_0x5a61f0[_0xbb3e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x58b6aa,null))['then'](function(_0x312547){if(_0x312547){return _0x312547[_0xbb3e('0x75')](_0x5a61f0['body'][_0xbb3e('0x54')],_[_0xbb3e('0x76')](_0x5a61f0['body'],[_0xbb3e('0x54'),'id'])||{})[_0xbb3e('0x77')](function(_0x5a1bb4){for(var _0x127e41=0x0;_0x127e41<_0x5a61f0['body']['ids'][_0xbb3e('0x2e')];_0x127e41+=0x1){socket[_0xbb3e('0x5e')](_0xbb3e('0x78'),{'UserId':Number(_0x5a61f0[_0xbb3e('0x33')][_0xbb3e('0x54')][_0x127e41]),'ChatQueueId':Number(_0x5a61f0[_0xbb3e('0x3e')]['id'])});}return _0x5a1bb4;});}})[_0xbb3e('0x17')](respondWithResult(_0x58b6aa,null))[_0xbb3e('0x31')](handleError(_0x58b6aa,null));};exports[_0xbb3e('0x79')]=function(_0x4be447,_0x49efe7){return db[_0xbb3e('0x1f')][_0xbb3e('0x38')]({'where':{'id':_0x4be447['params']['id']}})[_0xbb3e('0x17')](handleEntityNotFound(_0x49efe7,null))[_0xbb3e('0x17')](function(_0x23bd48){if(_0x23bd48){return _0x23bd48[_0xbb3e('0x79')](_0x4be447['query'][_0xbb3e('0x54')])[_0xbb3e('0x17')](function(){if(_[_0xbb3e('0x7a')](_0x4be447[_0xbb3e('0x24')][_0xbb3e('0x54')])){for(var _0x244981=0x0;_0x244981<_0x4be447['query'][_0xbb3e('0x54')][_0xbb3e('0x2e')];_0x244981+=0x1){socket[_0xbb3e('0x5e')](_0xbb3e('0x74'),{'UserId':Number(_0x4be447[_0xbb3e('0x24')][_0xbb3e('0x54')][_0x244981]),'ChatQueueId':Number(_0x4be447[_0xbb3e('0x3e')]['id'])});}}else{socket[_0xbb3e('0x5e')](_0xbb3e('0x74'),{'UserId':Number(_0x4be447[_0xbb3e('0x24')][_0xbb3e('0x54')]),'ChatQueueId':Number(_0x4be447['params']['id'])});}});}})[_0xbb3e('0x17')](respondWithStatusCode(_0x49efe7,null))[_0xbb3e('0x31')](handleError(_0x49efe7,null));};exports[_0xbb3e('0x7b')]=function(_0x5527f6,_0x351060){var _0x540f75={};var _0xed89fb={};var _0x326d3c;var _0x578258;return db[_0xbb3e('0x1f')][_0xbb3e('0x40')]({'where':{'id':_0x5527f6[_0xbb3e('0x3e')]['id']}})[_0xbb3e('0x17')](handleEntityNotFound(_0x351060,null))['then'](function(_0x1cef9f){if(_0x1cef9f){_0x326d3c=_0x1cef9f;_0xed89fb['model']=_[_0xbb3e('0x28')](db[_0xbb3e('0x48')][_0xbb3e('0x29')]);_0xed89fb[_0xbb3e('0x24')]=_['keys'](_0x5527f6[_0xbb3e('0x24')]);_0xed89fb[_0xbb3e('0x2a')]=_[_0xbb3e('0x2b')](_0xed89fb[_0xbb3e('0x27')],_0xed89fb['query']);_0x540f75[_0xbb3e('0x2c')]=_[_0xbb3e('0x2b')](_0xed89fb[_0xbb3e('0x27')],qs[_0xbb3e('0x2d')](_0x5527f6[_0xbb3e('0x24')][_0xbb3e('0x2d')]));_0x540f75['attributes']=_0x540f75[_0xbb3e('0x2c')][_0xbb3e('0x2e')]?_0x540f75[_0xbb3e('0x2c')]:_0xed89fb[_0xbb3e('0x27')];_0x540f75[_0xbb3e('0x51')]=qs[_0xbb3e('0x44')](_0x5527f6[_0xbb3e('0x24')]['sort']);_0x540f75['where']=qs[_0xbb3e('0x2a')](_[_0xbb3e('0x45')](_0x5527f6[_0xbb3e('0x24')],_0xed89fb[_0xbb3e('0x2a')]));if(_0x5527f6['query'][_0xbb3e('0x47')]){_0x540f75[_0xbb3e('0x22')]=_[_0xbb3e('0x2f')](_0x540f75[_0xbb3e('0x22')],{'$or':_[_0xbb3e('0x1e')](_0x540f75['attributes'],function(_0x179d97){var _0x3680e0={};_0x3680e0[_0x179d97]={'$like':'%'+_0x5527f6['query'][_0xbb3e('0x47')]+'%'};return _0x3680e0;})});}_0x540f75=_['merge']({},_0x540f75,_0x5527f6[_0xbb3e('0x30')]);return _0x326d3c[_0xbb3e('0x7b')](_0x540f75);}})[_0xbb3e('0x17')](function(_0x4a2a3b){if(_0x4a2a3b){_0x578258=_0x4a2a3b[_0xbb3e('0x2e')];if(!_0x5527f6[_0xbb3e('0x24')][_0xbb3e('0x42')](_0xbb3e('0x43'))){_0x540f75[_0xbb3e('0x12')]=qs[_0xbb3e('0x12')](_0x5527f6[_0xbb3e('0x24')][_0xbb3e('0x12')]);_0x540f75[_0xbb3e('0x10')]=qs[_0xbb3e('0x10')](_0x5527f6[_0xbb3e('0x24')][_0xbb3e('0x10')]);}return _0x326d3c['getAgents'](_0x540f75);}})['then'](function(_0x28e016){if(_0x28e016){return _0x28e016?{'count':_0x578258,'rows':_0x28e016}:null;}})[_0xbb3e('0x17')](respondWithResult(_0x351060,null))['catch'](handleError(_0x351060,null));}; \ No newline at end of file +var _0x0915=['json','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','ChatQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','catch','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','map','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','order','addTeams','Agents','voicePause','interface','transaction','each','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','every','TeamId','all','union','compact','value','ids','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','userChatQueue:save','isArray','getAgents','bluebird','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x56a60a,_0xf4c330){var _0x5c4057=function(_0x5ed7f8){while(--_0x5ed7f8){_0x56a60a['push'](_0x56a60a['shift']());}};_0x5c4057(++_0xf4c330);}(_0x0915,0x146));var _0x5091=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x0915[_0x13f980];return _0x27153c;};'use strict';var BPromise=require(_0x5091('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x5091('0x1'))(_0x5091('0x2'));var config=require('../../config/environment');var db=require(_0x5091('0x3'))['db'];config['redis']=_[_0x5091('0x4')](config['redis'],{'host':_0x5091('0x5'),'port':0x18eb});var socket=require(_0x5091('0x6'))(new Redis(config[_0x5091('0x7')]));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x33a17b,_0x358423){_0x358423=_0x358423||0xcc;return function(_0x290461){if(_0x290461){return _0x33a17b[_0x5091('0x8')](_0x358423);}return _0x33a17b[_0x5091('0x9')](_0x358423)[_0x5091('0xa')]();};}function respondWithResult(_0x4d5dcf,_0x420ee1){_0x420ee1=_0x420ee1||0xc8;return function(_0xb9421a){if(_0xb9421a){return _0x4d5dcf['status'](_0x420ee1)['json'](_0xb9421a);}};}function respondWithFilteredResult(_0x4f81db,_0xe4294){return function(_0x483b58){if(_0x483b58){var _0x44bff6=typeof _0xe4294[_0x5091('0xb')]===_0x5091('0xc')&&typeof _0xe4294[_0x5091('0xd')]===_0x5091('0xc');var _0x5f37cb=_0x483b58[_0x5091('0xe')];var _0x361cc8=_0x44bff6?0x0:_0xe4294[_0x5091('0xb')];var _0x3eb605=_0x44bff6?_0x483b58[_0x5091('0xe')]:_0xe4294[_0x5091('0xb')]+_0xe4294['limit'];var _0xaee194;if(_0x3eb605>=_0x5f37cb){_0x3eb605=_0x5f37cb;_0xaee194=0xc8;}else{_0xaee194=0xce;}_0x4f81db['status'](_0xaee194);return _0x4f81db['set'](_0x5091('0xf'),_0x361cc8+'-'+_0x3eb605+'/'+_0x5f37cb)[_0x5091('0x10')](_0x483b58);}return null;};}function saveUpdates(_0xe82e68){return function(_0x133b1e){if(_0x133b1e){return _0x133b1e[_0x5091('0x11')](_0xe82e68)[_0x5091('0x12')](function(_0x1f4ab7){return _0x1f4ab7;});}return null;};}function removeEntity(_0x2d15c6){return function(_0xaf782b){if(_0xaf782b){return _0xaf782b[_0x5091('0x13')]()[_0x5091('0x12')](function(){var _0x3733db=_0xaf782b[_0x5091('0x14')]({'plain':!![]});var _0x3a3a61=_0x5091('0x15');return db[_0x5091('0x16')][_0x5091('0x13')]({'where':{'type':_0x3a3a61,'resourceId':_0x3733db['id']}})[_0x5091('0x12')](function(){return _0xaf782b;});})['then'](function(){_0x2d15c6[_0x5091('0x9')](0xcc)[_0x5091('0xa')]();});}};}function handleEntityNotFound(_0x282945){return function(_0x109845){if(!_0x109845){_0x282945['sendStatus'](0x194);}return _0x109845;};}function handleError(_0x365d92,_0xde33a0){_0xde33a0=_0xde33a0||0x1f4;return function(_0x3efdca){logger[_0x5091('0x17')](_0x3efdca[_0x5091('0x18')]);if(_0x3efdca[_0x5091('0x19')]){delete _0x3efdca[_0x5091('0x19')];}_0x365d92[_0x5091('0x9')](_0xde33a0)[_0x5091('0x1a')](_0x3efdca);};}exports['index']=function(_0x4eb12f,_0x3dba9a){var _0x40de59={};var _0x35c772={'count':0x0,'rows':[]};var _0x498975=_['map'](db[_0x5091('0x1b')][_0x5091('0x1c')],function(_0x34e02d){return{'name':_0x34e02d[_0x5091('0x1d')],'type':_0x34e02d[_0x5091('0x1e')][_0x5091('0x1f')]};});_0x40de59=qs['getOptions'](_0x498975,_0x4eb12f);var _0x175bc3={'where':_0x40de59[_0x5091('0x20')]};return db['ChatQueue'][_0x5091('0xe')](_0x175bc3)[_0x5091('0x12')](function(_0x170347){_0x35c772[_0x5091('0xe')]=_0x170347;_0x40de59[_0x5091('0x21')]=qs[_0x5091('0x21')](_0x4eb12f[_0x5091('0x22')]);return db[_0x5091('0x1b')][_0x5091('0x23')](_0x40de59);})[_0x5091('0x12')](function(_0x567086){_0x35c772['rows']=_0x567086;return _0x35c772;})[_0x5091('0x12')](respondWithFilteredResult(_0x3dba9a,_0x40de59))[_0x5091('0x24')](handleError(_0x3dba9a,null));};exports['show']=function(_0x2d4711,_0x34c821){var _0x339173={'raw':!![],'where':{'id':_0x2d4711['params']['id']}},_0x5da702={};_0x5da702[_0x5091('0x25')]=_['keys'](db[_0x5091('0x1b')]['rawAttributes']);_0x5da702[_0x5091('0x22')]=_[_0x5091('0x26')](_0x2d4711['query']);_0x5da702[_0x5091('0x27')]=_['intersection'](_0x5da702[_0x5091('0x25')],_0x5da702[_0x5091('0x22')]);_0x339173[_0x5091('0x28')]=_[_0x5091('0x29')](_0x5da702[_0x5091('0x25')],qs['fields'](_0x2d4711[_0x5091('0x22')][_0x5091('0x2a')]));_0x339173[_0x5091('0x28')]=_0x339173[_0x5091('0x28')][_0x5091('0x2b')]?_0x339173[_0x5091('0x28')]:_0x5da702['model'];if(_0x2d4711[_0x5091('0x22')][_0x5091('0x2c')]){_0x339173[_0x5091('0x21')]=[{'all':!![]}];}_0x339173=_[_0x5091('0x2d')]({},_0x339173,_0x2d4711[_0x5091('0x2e')]);return db['ChatQueue'][_0x5091('0x2f')](_0x339173)[_0x5091('0x12')](handleEntityNotFound(_0x34c821,null))[_0x5091('0x12')](respondWithResult(_0x34c821,null))['catch'](handleError(_0x34c821,null));};exports[_0x5091('0x30')]=function(_0x1be318,_0x3ab913){return db[_0x5091('0x1b')]['create'](_0x1be318[_0x5091('0x31')],{})['then'](function(_0x27e8e5){var _0x45e75e=_0x1be318[_0x5091('0x32')][_0x5091('0x14')]({'plain':!![]});if(!_0x45e75e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45e75e[_0x5091('0x33')]===_0x5091('0x32')){var _0x1b1bd6=_0x27e8e5['get']({'plain':!![]});var _0x1ad91b=_0x5091('0x15');return db['UserProfileSection'][_0x5091('0x2f')]({'where':{'name':_0x1ad91b,'userProfileId':_0x45e75e[_0x5091('0x34')]},'raw':!![]})[_0x5091('0x12')](function(_0xe3f3){if(_0xe3f3&&_0xe3f3[_0x5091('0x35')]===0x0){return db[_0x5091('0x16')][_0x5091('0x30')]({'name':_0x1b1bd6[_0x5091('0x19')],'resourceId':_0x1b1bd6['id'],'type':_0xe3f3[_0x5091('0x19')],'sectionId':_0xe3f3['id']},{})[_0x5091('0x12')](function(){return _0x27e8e5;});}else{return _0x27e8e5;}})[_0x5091('0x24')](function(_0x1dacef){logger[_0x5091('0x17')](_0x5091('0x36'),_0x1dacef);throw _0x1dacef;});}return _0x27e8e5;})['then'](respondWithResult(_0x3ab913,0xc9))['catch'](handleError(_0x3ab913,null));};exports[_0x5091('0x11')]=function(_0x57ffab,_0xe372e0){if(_0x57ffab[_0x5091('0x31')]['id']){delete _0x57ffab['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x57ffab[_0x5091('0x37')]['id']}})[_0x5091('0x12')](handleEntityNotFound(_0xe372e0,null))[_0x5091('0x12')](saveUpdates(_0x57ffab['body'],null))[_0x5091('0x12')](respondWithResult(_0xe372e0,null))[_0x5091('0x24')](handleError(_0xe372e0,null));};exports[_0x5091('0x13')]=function(_0xb3c966,_0x1b4b67){return db['ChatQueue'][_0x5091('0x2f')]({'where':{'id':_0xb3c966[_0x5091('0x37')]['id']}})[_0x5091('0x12')](handleEntityNotFound(_0x1b4b67,null))[_0x5091('0x12')](removeEntity(_0x1b4b67,null))[_0x5091('0x24')](handleError(_0x1b4b67,null));};exports['describe']=function(_0xcd10c4,_0x2d7651){return db[_0x5091('0x1b')]['describe']()[_0x5091('0x12')](respondWithResult(_0x2d7651,null))[_0x5091('0x24')](handleError(_0x2d7651,null));};exports[_0x5091('0x38')]=function(_0x325120,_0x20c109){var _0x4f6984={'raw':!![],'where':{}},_0x4014b1={},_0x73c426;return db[_0x5091('0x1b')][_0x5091('0x39')]({'where':{'id':_0x325120['params']['id']}})[_0x5091('0x12')](handleEntityNotFound(_0x20c109,null))[_0x5091('0x12')](function(_0x4dd924){if(_0x4dd924){_0x73c426=_0x4dd924[_0x5091('0x14')]({'plain':!![]});_0x4014b1[_0x5091('0x25')]=_[_0x5091('0x26')](db[_0x5091('0x3a')][_0x5091('0x1c')]);_0x4014b1[_0x5091('0x22')]=_[_0x5091('0x26')](_0x325120[_0x5091('0x22')]);_0x4014b1[_0x5091('0x27')]=_[_0x5091('0x29')](_0x4014b1['model'],_0x4014b1['query']);_0x4f6984[_0x5091('0x28')]=_[_0x5091('0x29')](_0x4014b1[_0x5091('0x25')],qs[_0x5091('0x2a')](_0x325120[_0x5091('0x22')][_0x5091('0x2a')]));_0x4f6984[_0x5091('0x28')]=_0x4f6984[_0x5091('0x28')][_0x5091('0x2b')]?_0x4f6984['attributes']:_0x4014b1[_0x5091('0x25')];if(!_0x325120[_0x5091('0x22')][_0x5091('0x3b')](_0x5091('0x3c'))){_0x4f6984[_0x5091('0xd')]=qs['limit'](_0x325120[_0x5091('0x22')]['limit']);_0x4f6984[_0x5091('0xb')]=qs['offset'](_0x325120['query'][_0x5091('0xb')]);}_0x4f6984['order']=qs[_0x5091('0x3d')](_0x325120[_0x5091('0x22')][_0x5091('0x3d')]);_0x4f6984['where']=qs[_0x5091('0x27')](_[_0x5091('0x3e')](_0x325120['query'],_0x4014b1['filters']));_0x4f6984[_0x5091('0x20')][_0x5091('0x3f')]=_0x4dd924['id'];if(_0x325120[_0x5091('0x22')][_0x5091('0x40')]){_0x4f6984[_0x5091('0x20')]=_[_0x5091('0x2d')](_0x4f6984[_0x5091('0x20')],{'$or':_[_0x5091('0x41')](_0x4f6984[_0x5091('0x28')],function(_0x46c111){var _0x1da977={};_0x1da977[_0x46c111]={'$like':'%'+_0x325120['query'][_0x5091('0x40')]+'%'};return _0x1da977;})});}_0x4f6984=_['merge']({},_0x4f6984,_0x325120['options']);return db['UserChatQueue'][_0x5091('0x23')](_0x4f6984);}})[_0x5091('0x12')](function(_0x10541f){if(_0x10541f){return db[_0x5091('0x42')][_0x5091('0x43')]({'where':{'id':_[_0x5091('0x41')](_0x10541f,_0x5091('0x44')),'role':_0x5091('0x45')},'attributes':['id',_0x5091('0x19'),_0x5091('0x46'),_0x5091('0x47'),'createdAt']});}})[_0x5091('0x12')](function(_0x48f35c){if(_0x48f35c){return{'count':_0x48f35c[_0x5091('0xe')],'rows':_[_0x5091('0x41')](_0x48f35c['rows'],function(_0xd97e5b){return{'membername':_0xd97e5b[_0x5091('0x19')],'UserId':_0xd97e5b['id'],'queue_name':_0x73c426[_0x5091('0x19')],'ChatQueueId':_0x73c426['id'],'interface':util[_0x5091('0x48')](_0x5091('0x49'),'SIP',_0xd97e5b[_0x5091('0x19')]),'penalty':0x0,'paused':_0xd97e5b[_0x5091('0x46')],'createdAt':_0xd97e5b[_0x5091('0x4a')],'updatedAt':_0xd97e5b[_0x5091('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5091('0x12')](respondWithFilteredResult(_0x20c109,_0x4f6984))[_0x5091('0x24')](handleError(_0x20c109,null));};exports[_0x5091('0x4b')]=function(_0x30cf2b,_0xdf6841){var _0x179ed7={};var _0x16cbbc={};var _0x54ee0c;var _0x545660;return db[_0x5091('0x1b')][_0x5091('0x39')]({'where':{'id':_0x30cf2b['params']['id']}})[_0x5091('0x12')](handleEntityNotFound(_0xdf6841,null))[_0x5091('0x12')](function(_0x34676e){if(_0x34676e){_0x54ee0c=_0x34676e;_0x16cbbc['model']=_[_0x5091('0x26')](db[_0x5091('0x4c')][_0x5091('0x1c')]);_0x16cbbc[_0x5091('0x22')]=_['keys'](_0x30cf2b[_0x5091('0x22')]);_0x16cbbc[_0x5091('0x27')]=_[_0x5091('0x29')](_0x16cbbc['model'],_0x16cbbc[_0x5091('0x22')]);_0x179ed7[_0x5091('0x28')]=_[_0x5091('0x29')](_0x16cbbc['model'],qs[_0x5091('0x2a')](_0x30cf2b['query']['fields']));_0x179ed7[_0x5091('0x28')]=_0x179ed7['attributes']['length']?_0x179ed7[_0x5091('0x28')]:_0x16cbbc['model'];_0x179ed7[_0x5091('0x4d')]=qs['sort'](_0x30cf2b['query'][_0x5091('0x3d')]);_0x179ed7[_0x5091('0x20')]=qs['filters'](_[_0x5091('0x3e')](_0x30cf2b[_0x5091('0x22')],_0x16cbbc[_0x5091('0x27')]));if(_0x30cf2b[_0x5091('0x22')][_0x5091('0x40')]){_0x179ed7[_0x5091('0x20')]=_[_0x5091('0x2d')](_0x179ed7[_0x5091('0x20')],{'$or':_['map'](_0x179ed7[_0x5091('0x28')],function(_0x3e5d45){var _0x427de5={};_0x427de5[_0x3e5d45]={'$like':'%'+_0x30cf2b[_0x5091('0x22')]['filter']+'%'};return _0x427de5;})});}_0x179ed7=_[_0x5091('0x2d')]({},_0x179ed7,_0x30cf2b['options']);return _0x54ee0c['getTeams'](_0x179ed7);}})[_0x5091('0x12')](function(_0x7a7505){if(_0x7a7505){_0x545660=_0x7a7505['length'];if(!_0x30cf2b['query'][_0x5091('0x3b')](_0x5091('0x3c'))){_0x179ed7['limit']=qs[_0x5091('0xd')](_0x30cf2b[_0x5091('0x22')][_0x5091('0xd')]);_0x179ed7[_0x5091('0xb')]=qs[_0x5091('0xb')](_0x30cf2b[_0x5091('0x22')][_0x5091('0xb')]);}return _0x54ee0c[_0x5091('0x4b')](_0x179ed7);}})[_0x5091('0x12')](function(_0x537b32){if(_0x537b32){return _0x537b32?{'count':_0x545660,'rows':_0x537b32}:null;}})['then'](respondWithResult(_0xdf6841,null))[_0x5091('0x24')](handleError(_0xdf6841,null));};exports[_0x5091('0x4e')]=function(_0x3398ca,_0x4662e4){var _0x8a331=_0x3398ca[_0x5091('0x31')]['ids'];return db[_0x5091('0x4c')][_0x5091('0x23')]({'where':{'id':_0x8a331},'attributes':['id'],'include':[{'model':db[_0x5091('0x42')],'as':_0x5091('0x4f'),'attributes':['id',_0x5091('0x19'),'online',_0x5091('0x50'),_0x5091('0x51')],'raw':!![]}]})[_0x5091('0x12')](function(_0x246db4){if(_0x246db4){var _0x3fbe8b=_['flatMap'](_0x246db4,function(_0x2443e2){var _0x4c627a=_0x2443e2[_0x5091('0x14')]({'plain':!![]});return _0x4c627a[_0x5091('0x4f')];});return db['ChatQueue'][_0x5091('0x2f')]({'where':{'id':_0x3398ca[_0x5091('0x37')]['id']}})[_0x5091('0x12')](function(_0xabb780){return db['sequelize'][_0x5091('0x52')](function(_0xd9d655){return _0xabb780['addTeams'](_0x8a331,{'transaction':_0xd9d655})['then'](function(){return BPromise[_0x5091('0x53')](_0x3fbe8b,function(_0xe8ba1a){return db[_0x5091('0x3a')][_0x5091('0x54')]({'where':{'UserId':_0xe8ba1a['id'],'ChatQueueId':_0x3398ca[_0x5091('0x37')]['id']},'transaction':_0xd9d655});});})[_0x5091('0x12')](function(){_0x3fbe8b[_0x5091('0x55')](function(_0x30f055){socket[_0x5091('0x56')]('userChatQueue:save',{'UserId':_0x30f055['id'],'ChatQueueId':_0xabb780['id']});});});});});}})['then'](respondWithStatusCode(_0x4662e4,null))[_0x5091('0x24')](handleError(_0x4662e4,null));};exports[_0x5091('0x57')]=function(_0x4df7f0,_0x20717c){return db[_0x5091('0x4c')][_0x5091('0x23')]({'where':{'id':_0x4df7f0['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5091('0x42')],'as':_0x5091('0x4f'),'attributes':['id'],'raw':!![]}]})[_0x5091('0x12')](handleEntityNotFound(_0x20717c,null))[_0x5091('0x12')](function(_0x33305e){var _0x45afe1=_[_0x5091('0x41')](_0x33305e,'id');var _0x15be8c=[];var _0x22fe0d=[];var _0x427844=squel['select']();_0x427844[_0x5091('0x58')](_0x5091('0x59'))['from']('team_has_chat_queues','tq')[_0x5091('0x5a')](_0x5091('0x5b'),'ut',_0x5091('0x5c'))['where'](_0x5091('0x5d'),_0x4df7f0[_0x5091('0x37')]['id']);for(var _0x468a0a=0x0;_0x468a0a<_0x33305e[_0x5091('0x2b')];_0x468a0a+=0x1){let _0x4663ee=_0x33305e[_0x468a0a];for(var _0x2bbb3c=0x0;_0x2bbb3c<_0x4663ee[_0x5091('0x4f')]['length'];_0x2bbb3c+=0x1){let _0x3001e5=_0x4663ee[_0x5091('0x4f')][_0x2bbb3c];var _0x280df5=_0x427844[_0x5091('0x5e')]();_0x280df5['where'](_0x5091('0x5f'),_0x3001e5['id']);_0x22fe0d['push'](db[_0x5091('0x60')][_0x5091('0x22')](_0x280df5[_0x5091('0x61')](),{'type':db['sequelize'][_0x5091('0x62')]['SELECT']})[_0x5091('0x12')](function(_0x36106f){if(_0x36106f[_0x5091('0x2b')]===0x1){return _0x3001e5['id'];}else{var _0x1531df=_[_0x5091('0x63')](_['map'](_0x36106f,_0x5091('0x64')),function(_0x3de6d4){return _['includes'](_0x45afe1,_0x3de6d4);});if(_0x1531df){return _0x3001e5['id'];}}}));}}return BPromise[_0x5091('0x65')](_0x22fe0d)['then'](function(_0xac7ffe){_0x15be8c=_(_0x15be8c)[_0x5091('0x66')](_0xac7ffe)[_0x5091('0x67')]()[_0x5091('0x68')]();return db[_0x5091('0x1b')][_0x5091('0x2f')]({'where':{'id':_0x4df7f0[_0x5091('0x37')]['id']}})[_0x5091('0x12')](function(_0x110feb){return db[_0x5091('0x60')]['transaction'](function(_0x17a6df){return _0x110feb[_0x5091('0x57')](_0x4df7f0[_0x5091('0x22')][_0x5091('0x69')],{'transaction':_0x17a6df})[_0x5091('0x12')](function(){if(!_[_0x5091('0x6a')](_0x15be8c)){return _0x110feb[_0x5091('0x6b')](_0x15be8c,{'transaction':_0x17a6df});}})[_0x5091('0x12')](function(){_0x15be8c[_0x5091('0x55')](function(_0x59b2ea){socket[_0x5091('0x56')](_0x5091('0x6c'),{'UserId':_0x59b2ea,'ChatQueueId':_0x110feb['id']});});});});});});})[_0x5091('0x12')](respondWithStatusCode(_0x20717c,null))[_0x5091('0x24')](handleError(_0x20717c,null));};exports['addAgents']=function(_0x39d355,_0x3d9710){return db[_0x5091('0x1b')][_0x5091('0x2f')]({'where':{'id':_0x39d355['params']['id']}})[_0x5091('0x12')](handleEntityNotFound(_0x3d9710,null))[_0x5091('0x12')](function(_0x176339){if(_0x176339){return _0x176339[_0x5091('0x6d')](_0x39d355[_0x5091('0x31')][_0x5091('0x69')],_['omit'](_0x39d355[_0x5091('0x31')],[_0x5091('0x69'),'id'])||{})[_0x5091('0x6e')](function(_0x3cb302){for(var _0xc4aad1=0x0;_0xc4aad1<_0x39d355[_0x5091('0x31')][_0x5091('0x69')][_0x5091('0x2b')];_0xc4aad1+=0x1){socket[_0x5091('0x56')](_0x5091('0x6f'),{'UserId':Number(_0x39d355['body'][_0x5091('0x69')][_0xc4aad1]),'ChatQueueId':Number(_0x39d355[_0x5091('0x37')]['id'])});}return _0x3cb302;});}})[_0x5091('0x12')](respondWithResult(_0x3d9710,null))[_0x5091('0x24')](handleError(_0x3d9710,null));};exports[_0x5091('0x6b')]=function(_0x1d4ccb,_0x2d657c){return db[_0x5091('0x1b')][_0x5091('0x2f')]({'where':{'id':_0x1d4ccb['params']['id']}})[_0x5091('0x12')](handleEntityNotFound(_0x2d657c,null))[_0x5091('0x12')](function(_0x55da73){if(_0x55da73){return _0x55da73[_0x5091('0x6b')](_0x1d4ccb[_0x5091('0x22')][_0x5091('0x69')])['then'](function(){if(_[_0x5091('0x70')](_0x1d4ccb['query'][_0x5091('0x69')])){for(var _0x5b31d7=0x0;_0x5b31d7<_0x1d4ccb[_0x5091('0x22')]['ids'][_0x5091('0x2b')];_0x5b31d7+=0x1){socket[_0x5091('0x56')]('userChatQueue:remove',{'UserId':Number(_0x1d4ccb['query'][_0x5091('0x69')][_0x5b31d7]),'ChatQueueId':Number(_0x1d4ccb[_0x5091('0x37')]['id'])});}}else{socket[_0x5091('0x56')]('userChatQueue:remove',{'UserId':Number(_0x1d4ccb[_0x5091('0x22')][_0x5091('0x69')]),'ChatQueueId':Number(_0x1d4ccb[_0x5091('0x37')]['id'])});}});}})['then'](respondWithStatusCode(_0x2d657c,null))[_0x5091('0x24')](handleError(_0x2d657c,null));};exports['getAgents']=function(_0x59947e,_0x8078cb){var _0x3ca4bb={};var _0x1fb220={};var _0x43e6bb;var _0x27f30b;return db['ChatQueue'][_0x5091('0x39')]({'where':{'id':_0x59947e[_0x5091('0x37')]['id']}})[_0x5091('0x12')](handleEntityNotFound(_0x8078cb,null))[_0x5091('0x12')](function(_0xd67d43){if(_0xd67d43){_0x43e6bb=_0xd67d43;_0x1fb220[_0x5091('0x25')]=_['keys'](db['User'][_0x5091('0x1c')]);_0x1fb220[_0x5091('0x22')]=_[_0x5091('0x26')](_0x59947e[_0x5091('0x22')]);_0x1fb220[_0x5091('0x27')]=_['intersection'](_0x1fb220[_0x5091('0x25')],_0x1fb220[_0x5091('0x22')]);_0x3ca4bb['attributes']=_[_0x5091('0x29')](_0x1fb220[_0x5091('0x25')],qs[_0x5091('0x2a')](_0x59947e['query']['fields']));_0x3ca4bb[_0x5091('0x28')]=_0x3ca4bb[_0x5091('0x28')][_0x5091('0x2b')]?_0x3ca4bb[_0x5091('0x28')]:_0x1fb220[_0x5091('0x25')];_0x3ca4bb[_0x5091('0x4d')]=qs[_0x5091('0x3d')](_0x59947e[_0x5091('0x22')]['sort']);_0x3ca4bb['where']=qs[_0x5091('0x27')](_[_0x5091('0x3e')](_0x59947e[_0x5091('0x22')],_0x1fb220[_0x5091('0x27')]));if(_0x59947e[_0x5091('0x22')][_0x5091('0x40')]){_0x3ca4bb['where']=_[_0x5091('0x2d')](_0x3ca4bb[_0x5091('0x20')],{'$or':_[_0x5091('0x41')](_0x3ca4bb[_0x5091('0x28')],function(_0x3388bf){var _0x2d25dd={};_0x2d25dd[_0x3388bf]={'$like':'%'+_0x59947e['query'][_0x5091('0x40')]+'%'};return _0x2d25dd;})});}_0x3ca4bb=_['merge']({},_0x3ca4bb,_0x59947e['options']);return _0x43e6bb[_0x5091('0x71')](_0x3ca4bb);}})['then'](function(_0x675539){if(_0x675539){_0x27f30b=_0x675539[_0x5091('0x2b')];if(!_0x59947e[_0x5091('0x22')]['hasOwnProperty'](_0x5091('0x3c'))){_0x3ca4bb[_0x5091('0xd')]=qs[_0x5091('0xd')](_0x59947e[_0x5091('0x22')][_0x5091('0xd')]);_0x3ca4bb[_0x5091('0xb')]=qs[_0x5091('0xb')](_0x59947e[_0x5091('0x22')][_0x5091('0xb')]);}return _0x43e6bb[_0x5091('0x71')](_0x3ca4bb);}})[_0x5091('0x12')](function(_0x240c1c){if(_0x240c1c){return _0x240c1c?{'count':_0x27f30b,'rows':_0x240c1c}:null;}})['then'](respondWithResult(_0x8078cb,null))[_0x5091('0x24')](handleError(_0x8078cb,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 6169b8e..3ebfa8f 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 _0xb634=['hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4cd35b,_0x20e58a){var _0x48f6ad=function(_0x2bf494){while(--_0x2bf494){_0x4cd35b['push'](_0x4cd35b['shift']());}};_0x48f6ad(++_0x20e58a);}(_0xb634,0x19c));var _0x4b63=function(_0xd35ca7,_0x577b60){_0xd35ca7=_0xd35ca7-0x0;var _0x2efa2e=_0xb634[_0xd35ca7];return _0x2efa2e;};'use strict';var EventEmitter=require(_0x4b63('0x0'));var ChatQueue=require(_0x4b63('0x1'))['db'][_0x4b63('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4b63('0x3')](0x0);var events={'afterCreate':_0x4b63('0x4'),'afterUpdate':_0x4b63('0x5'),'afterDestroy':'remove'};function emitEvent(_0x54d6d9){return function(_0x595b75,_0x435140,_0x5731a5){ChatQueueEvents['emit'](_0x54d6d9+':'+_0x595b75['id'],_0x595b75);ChatQueueEvents[_0x4b63('0x6')](_0x54d6d9,_0x595b75);_0x5731a5(null);};}for(var e in events){if(events[_0x4b63('0x7')](e)){var event=events[e];ChatQueue[_0x4b63('0x8')](e,emitEvent(event));}}module[_0x4b63('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x3706=['hook','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x54afcf,_0x5e93c6){var _0x301931=function(_0x11712b){while(--_0x11712b){_0x54afcf['push'](_0x54afcf['shift']());}};_0x301931(++_0x5e93c6);}(_0x3706,0x169));var _0x6370=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x3706[_0x43b584];return _0x48f27b;};'use strict';var EventEmitter=require(_0x6370('0x0'));var ChatQueue=require(_0x6370('0x1'))['db'][_0x6370('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6370('0x3')](0x0);var events={'afterCreate':_0x6370('0x4'),'afterUpdate':_0x6370('0x5'),'afterDestroy':_0x6370('0x6')};function emitEvent(_0x47f081){return function(_0x1a579d,_0x3c9b00,_0x5b9fd4){ChatQueueEvents[_0x6370('0x7')](_0x47f081+':'+_0x1a579d['id'],_0x1a579d);ChatQueueEvents[_0x6370('0x7')](_0x47f081,_0x1a579d);_0x5b9fd4(null);};}for(var e in events){if(events[_0x6370('0x8')](e)){var event=events[e];ChatQueue[_0x6370('0x9')](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 e687c63..383e082 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 _0xa9e0=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3e8d97,_0x59fdd6){var _0x3f301c=function(_0x1666fa){while(--_0x1666fa){_0x3e8d97['push'](_0x3e8d97['shift']());}};_0x3f301c(++_0x59fdd6);}(_0xa9e0,0x1ce));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require('../../config/logger')(_0x0a9e('0x2'));var moment=require(_0x0a9e('0x3'));var BPromise=require(_0x0a9e('0x4'));var rp=require(_0x0a9e('0x5'));var fs=require('fs');var path=require(_0x0a9e('0x6'));var rimraf=require(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var attributes=require(_0x0a9e('0x9'));module[_0x0a9e('0xa')]=function(_0x4cbb64,_0x2af44e){return _0x4cbb64['define'](_0x0a9e('0xb'),attributes,{'tableName':_0x0a9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x375c=['../../config/logger','api','moment','bluebird','path','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash'];(function(_0x28d7da,_0x5ebf24){var _0x400905=function(_0x4ab714){while(--_0x4ab714){_0x28d7da['push'](_0x28d7da['shift']());}};_0x400905(++_0x5ebf24);}(_0x375c,0xd0));var _0xc375=function(_0x1ccf92,_0x5dc478){_0x1ccf92=_0x1ccf92-0x0;var _0xb90d84=_0x375c[_0x1ccf92];return _0xb90d84;};'use strict';var _=require(_0xc375('0x0'));var util=require('util');var logger=require(_0xc375('0x1'))(_0xc375('0x2'));var moment=require(_0xc375('0x3'));var BPromise=require(_0xc375('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc375('0x5'));var rimraf=require('rimraf');var config=require(_0xc375('0x6'));var attributes=require(_0xc375('0x7'));module['exports']=function(_0x2e1770,_0x230be6){return _0x2e1770[_0xc375('0x8')](_0xc375('0x9'),attributes,{'tableName':_0xc375('0xa'),'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 428058f..300e6ed 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 _0x85ed=['register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','raw','attributes','limit','include','map','model','info','debug','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x85ed,0x66));var _0xd85e=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x85ed[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xd85e('0x0'));var util=require(_0xd85e('0x1'));var moment=require(_0xd85e('0x2'));var BPromise=require(_0xd85e('0x3'));var rs=require(_0xd85e('0x4'));var fs=require('fs');var Redis=require(_0xd85e('0x5'));var db=require(_0xd85e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd85e('0x7'))(_0xd85e('0x8'));var config=require(_0xd85e('0x9'));var jayson=require(_0xd85e('0xa'));var client=jayson['client'][_0xd85e('0xb')]({'port':0x232a});config[_0xd85e('0xc')]=_['defaults'](config[_0xd85e('0xc')],{'host':_0xd85e('0xd'),'port':0x18eb});var socket=require(_0xd85e('0xe'))(new Redis(config[_0xd85e('0xc')]));require('./chatQueue.socket')[_0xd85e('0xf')](socket);function respondWithRpcPromise(_0x2dbcc8,_0x18013f,_0x16c1e9){return new BPromise(function(_0x4673ac,_0x17a72){return client['request'](_0x2dbcc8,_0x16c1e9)[_0xd85e('0x10')](function(_0x4bab9c){logger['info'](_0xd85e('0x11'),_0x18013f,_0xd85e('0x12'));logger['debug'](_0xd85e('0x13'),_0x18013f,_0xd85e('0x12'),JSON[_0xd85e('0x14')](_0x4bab9c));if(_0x4bab9c['error']){if(_0x4bab9c[_0xd85e('0x15')][_0xd85e('0x16')]===0x1f4){logger[_0xd85e('0x15')](_0xd85e('0x11'),_0x18013f,_0x4bab9c[_0xd85e('0x15')]['message']);return _0x17a72(_0x4bab9c[_0xd85e('0x15')]['message']);}logger[_0xd85e('0x15')](_0xd85e('0x11'),_0x18013f,_0x4bab9c[_0xd85e('0x15')]['message']);return _0x4673ac(_0x4bab9c[_0xd85e('0x15')][_0xd85e('0x17')]);}else{logger['info'](_0xd85e('0x11'),_0x18013f,_0xd85e('0x12'));_0x4673ac(_0x4bab9c[_0xd85e('0x18')]['message']);}})[_0xd85e('0x19')](function(_0x400f86){logger[_0xd85e('0x15')](_0xd85e('0x11'),_0x18013f,_0x400f86);_0x17a72(_0x400f86);});});}exports[_0xd85e('0x1a')]=function(_0x1d2bc2){var _0xfe1318=this;return new Promise(function(_0x2f8334,_0x2e0c94){return db[_0xd85e('0x1b')]['findAll']({'raw':_0x1d2bc2[_0xd85e('0x1c')]?_0x1d2bc2[_0xd85e('0x1c')][_0xd85e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1d2bc2[_0xd85e('0x1c')]?_0x1d2bc2[_0xd85e('0x1c')]['where']||null:null,'attributes':_0x1d2bc2[_0xd85e('0x1c')]?_0x1d2bc2[_0xd85e('0x1c')][_0xd85e('0x1e')]||null:null,'limit':_0x1d2bc2['options']?_0x1d2bc2[_0xd85e('0x1c')][_0xd85e('0x1f')]||null:null,'include':_0x1d2bc2[_0xd85e('0x1c')]?_0x1d2bc2[_0xd85e('0x1c')][_0xd85e('0x20')]?_[_0xd85e('0x21')](_0x1d2bc2['options'][_0xd85e('0x20')],function(_0x91b328){return{'model':db[_0x91b328[_0xd85e('0x22')]],'as':_0x91b328['as'],'attributes':_0x91b328[_0xd85e('0x1e')],'include':_0x91b328[_0xd85e('0x20')]?_[_0xd85e('0x21')](_0x91b328[_0xd85e('0x20')],function(_0x1d659e){return{'model':db[_0x1d659e['model']],'as':_0x1d659e['as'],'attributes':_0x1d659e['attributes'],'include':_0x1d659e[_0xd85e('0x20')]?_[_0xd85e('0x21')](_0x1d659e[_0xd85e('0x20')],function(_0x5dc7ac){return{'model':db[_0x5dc7ac['model']],'as':_0x5dc7ac['as'],'attributes':_0x5dc7ac[_0xd85e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5826d5){logger[_0xd85e('0x23')](_0xd85e('0x1a'),_0x1d2bc2);logger[_0xd85e('0x24')]('GetChatQueue',_0x1d2bc2,JSON['stringify'](_0x5826d5));_0x2f8334(_0x5826d5);})['catch'](function(_0x5c9879){logger['error'](_0xd85e('0x1a'),_0x5c9879[_0xd85e('0x17')],_0x1d2bc2);_0x2e0c94(_0xfe1318[_0xd85e('0x15')](0x1f4,_0x5c9879['message']));});});};exports[_0xd85e('0x25')]=function(_0x2fa2ec){var _0x3c79e5=this;return new Promise(function(_0x232e8b,_0x556458){return db[_0xd85e('0x1b')][_0xd85e('0x26')]({'raw':_0x2fa2ec[_0xd85e('0x1c')]?_0x2fa2ec[_0xd85e('0x1c')][_0xd85e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2fa2ec['options']?_0x2fa2ec[_0xd85e('0x1c')]['where']||null:null,'attributes':_0x2fa2ec['options']?_0x2fa2ec[_0xd85e('0x1c')][_0xd85e('0x1e')]||null:null,'include':_0x2fa2ec[_0xd85e('0x1c')]?_0x2fa2ec['options']['include']?_[_0xd85e('0x21')](_0x2fa2ec['options'][_0xd85e('0x20')],function(_0x4addb4){return{'model':db[_0x4addb4['model']],'as':_0x4addb4['as'],'attributes':_0x4addb4[_0xd85e('0x1e')],'include':_0x4addb4[_0xd85e('0x20')]?_['map'](_0x4addb4[_0xd85e('0x20')],function(_0x442c22){return{'model':db[_0x442c22[_0xd85e('0x22')]],'as':_0x442c22['as'],'attributes':_0x442c22[_0xd85e('0x1e')],'include':_0x442c22[_0xd85e('0x20')]?_[_0xd85e('0x21')](_0x442c22[_0xd85e('0x20')],function(_0x2e2c29){return{'model':db[_0x2e2c29[_0xd85e('0x22')]],'as':_0x2e2c29['as'],'attributes':_0x2e2c29[_0xd85e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd85e('0x10')](function(_0x1e0c95){logger[_0xd85e('0x23')](_0xd85e('0x25'),_0x2fa2ec);logger['debug'](_0xd85e('0x25'),_0x2fa2ec,JSON[_0xd85e('0x14')](_0x1e0c95));_0x232e8b(_0x1e0c95);})[_0xd85e('0x19')](function(_0x3aca92){logger[_0xd85e('0x15')](_0xd85e('0x25'),_0x3aca92[_0xd85e('0x17')],_0x2fa2ec);_0x556458(_0x3c79e5[_0xd85e('0x15')](0x1f4,_0x3aca92[_0xd85e('0x17')]));});});}; \ No newline at end of file +var _0xaecf=['message','ChatQueue,\x20%s,\x20%s','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','attributes','include','map','model','then','ShowChatQueue','find','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatQueue.socket','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x6f5081,_0x1b411f){var _0x2eb09b=function(_0x4cd675){while(--_0x4cd675){_0x6f5081['push'](_0x6f5081['shift']());}};_0x2eb09b(++_0x1b411f);}(_0xaecf,0x149));var _0xfaec=function(_0x2e9936,_0x1f3dbc){_0x2e9936=_0x2e9936-0x0;var _0x10d0db=_0xaecf[_0x2e9936];return _0x10d0db;};'use strict';var _=require(_0xfaec('0x0'));var util=require(_0xfaec('0x1'));var moment=require(_0xfaec('0x2'));var BPromise=require('bluebird');var rs=require(_0xfaec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfaec('0x4'))['db'];var utils=require(_0xfaec('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xfaec('0x6'));var jayson=require(_0xfaec('0x7'));var client=jayson[_0xfaec('0x8')][_0xfaec('0x9')]({'port':0x232a});config['redis']=_[_0xfaec('0xa')](config['redis'],{'host':_0xfaec('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfaec('0xc')]));require(_0xfaec('0xd'))['register'](socket);function respondWithRpcPromise(_0x31de79,_0x5e378e,_0x355119){return new BPromise(function(_0x2adbd1,_0x239ffd){return client[_0xfaec('0xe')](_0x31de79,_0x355119)['then'](function(_0x59b5a2){logger[_0xfaec('0xf')]('ChatQueue,\x20%s,\x20%s',_0x5e378e,_0xfaec('0x10'));logger[_0xfaec('0x11')](_0xfaec('0x12'),_0x5e378e,_0xfaec('0x10'),JSON[_0xfaec('0x13')](_0x59b5a2));if(_0x59b5a2[_0xfaec('0x14')]){if(_0x59b5a2[_0xfaec('0x14')][_0xfaec('0x15')]===0x1f4){logger[_0xfaec('0x14')]('ChatQueue,\x20%s,\x20%s',_0x5e378e,_0x59b5a2[_0xfaec('0x14')]['message']);return _0x239ffd(_0x59b5a2['error'][_0xfaec('0x16')]);}logger[_0xfaec('0x14')](_0xfaec('0x17'),_0x5e378e,_0x59b5a2[_0xfaec('0x14')][_0xfaec('0x16')]);return _0x2adbd1(_0x59b5a2['error']['message']);}else{logger[_0xfaec('0xf')](_0xfaec('0x17'),_0x5e378e,_0xfaec('0x10'));_0x2adbd1(_0x59b5a2[_0xfaec('0x18')][_0xfaec('0x16')]);}})[_0xfaec('0x19')](function(_0x14ad25){logger['error'](_0xfaec('0x17'),_0x5e378e,_0x14ad25);_0x239ffd(_0x14ad25);});});}exports[_0xfaec('0x1a')]=function(_0x112020){var _0x390899=this;return new Promise(function(_0x1f1378,_0x202a06){return db[_0xfaec('0x1b')][_0xfaec('0x1c')]({'raw':_0x112020['options']?_0x112020['options'][_0xfaec('0x1d')]===undefined?!![]:![]:!![],'where':_0x112020['options']?_0x112020[_0xfaec('0x1e')]['where']||null:null,'attributes':_0x112020[_0xfaec('0x1e')]?_0x112020[_0xfaec('0x1e')][_0xfaec('0x1f')]||null:null,'limit':_0x112020[_0xfaec('0x1e')]?_0x112020[_0xfaec('0x1e')]['limit']||null:null,'include':_0x112020['options']?_0x112020[_0xfaec('0x1e')][_0xfaec('0x20')]?_[_0xfaec('0x21')](_0x112020['options'][_0xfaec('0x20')],function(_0x2e0b8e){return{'model':db[_0x2e0b8e[_0xfaec('0x22')]],'as':_0x2e0b8e['as'],'attributes':_0x2e0b8e[_0xfaec('0x1f')],'include':_0x2e0b8e[_0xfaec('0x20')]?_['map'](_0x2e0b8e['include'],function(_0x5c4b70){return{'model':db[_0x5c4b70[_0xfaec('0x22')]],'as':_0x5c4b70['as'],'attributes':_0x5c4b70[_0xfaec('0x1f')],'include':_0x5c4b70[_0xfaec('0x20')]?_[_0xfaec('0x21')](_0x5c4b70[_0xfaec('0x20')],function(_0x980b58){return{'model':db[_0x980b58[_0xfaec('0x22')]],'as':_0x980b58['as'],'attributes':_0x980b58[_0xfaec('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfaec('0x23')](function(_0x176a1b){logger['info']('GetChatQueue',_0x112020);logger['debug']('GetChatQueue',_0x112020,JSON['stringify'](_0x176a1b));_0x1f1378(_0x176a1b);})[_0xfaec('0x19')](function(_0x47cf5f){logger[_0xfaec('0x14')](_0xfaec('0x1a'),_0x47cf5f[_0xfaec('0x16')],_0x112020);_0x202a06(_0x390899['error'](0x1f4,_0x47cf5f[_0xfaec('0x16')]));});});};exports[_0xfaec('0x24')]=function(_0x31b987){var _0x4fa5c4=this;return new Promise(function(_0x53e5fd,_0x15c947){return db[_0xfaec('0x1b')][_0xfaec('0x25')]({'raw':_0x31b987['options']?_0x31b987[_0xfaec('0x1e')][_0xfaec('0x1d')]===undefined?!![]:![]:!![],'where':_0x31b987[_0xfaec('0x1e')]?_0x31b987[_0xfaec('0x1e')][_0xfaec('0x26')]||null:null,'attributes':_0x31b987[_0xfaec('0x1e')]?_0x31b987[_0xfaec('0x1e')][_0xfaec('0x1f')]||null:null,'include':_0x31b987[_0xfaec('0x1e')]?_0x31b987[_0xfaec('0x1e')][_0xfaec('0x20')]?_[_0xfaec('0x21')](_0x31b987[_0xfaec('0x1e')]['include'],function(_0x1b002a){return{'model':db[_0x1b002a[_0xfaec('0x22')]],'as':_0x1b002a['as'],'attributes':_0x1b002a['attributes'],'include':_0x1b002a[_0xfaec('0x20')]?_[_0xfaec('0x21')](_0x1b002a[_0xfaec('0x20')],function(_0x3f01d7){return{'model':db[_0x3f01d7[_0xfaec('0x22')]],'as':_0x3f01d7['as'],'attributes':_0x3f01d7[_0xfaec('0x1f')],'include':_0x3f01d7[_0xfaec('0x20')]?_[_0xfaec('0x21')](_0x3f01d7[_0xfaec('0x20')],function(_0x64dd9c){return{'model':db[_0x64dd9c[_0xfaec('0x22')]],'as':_0x64dd9c['as'],'attributes':_0x64dd9c[_0xfaec('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfaec('0x23')](function(_0x129e83){logger['info'](_0xfaec('0x24'),_0x31b987);logger['debug']('ShowChatQueue',_0x31b987,JSON[_0xfaec('0x13')](_0x129e83));_0x53e5fd(_0x129e83);})[_0xfaec('0x19')](function(_0x33831d){logger[_0xfaec('0x14')]('ShowChatQueue',_0x33831d[_0xfaec('0x16')],_0x31b987);_0x15c947(_0x4fa5c4[_0xfaec('0x14')](0x1f4,_0x33831d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5c317f9..df51233 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 _0xc368=['removeListener','register','length','chatQueue:','save','update','emit'];(function(_0x250d2a,_0x2983be){var _0x5738fa=function(_0x3cbde0){while(--_0x3cbde0){_0x250d2a['push'](_0x250d2a['shift']());}};_0x5738fa(++_0x2983be);}(_0xc368,0x7b));var _0x8c36=function(_0xeec5de,_0x1fe2f6){_0xeec5de=_0xeec5de-0x0;var _0x212e4c=_0xc368[_0xeec5de];return _0x212e4c;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8c36('0x0'),'remove',_0x8c36('0x1')];function createListener(_0x17fa33,_0x20e697){return function(_0x2640c5){_0x20e697[_0x8c36('0x2')](_0x17fa33,_0x2640c5);};}function removeListener(_0x5d3b27,_0x3e9034){return function(){ChatQueueEvents[_0x8c36('0x3')](_0x5d3b27,_0x3e9034);};}exports[_0x8c36('0x4')]=function(_0x1d3660){for(var _0x5ebfc1=0x0,_0x554022=events[_0x8c36('0x5')];_0x5ebfc1<_0x554022;_0x5ebfc1++){var _0x384867=events[_0x5ebfc1];var _0x3e76be=createListener(_0x8c36('0x6')+_0x384867,_0x1d3660);ChatQueueEvents['on'](_0x384867,_0x3e76be);}}; \ No newline at end of file +var _0x6aa7=['update','emit','length','chatQueue:','./chatQueue.events','remove'];(function(_0x1bf75d,_0x1d3920){var _0x5cce12=function(_0x5b5170){while(--_0x5b5170){_0x1bf75d['push'](_0x1bf75d['shift']());}};_0x5cce12(++_0x1d3920);}(_0x6aa7,0x178));var _0x76aa=function(_0x41d44e,_0x5f2c1c){_0x41d44e=_0x41d44e-0x0;var _0x6b3ad5=_0x6aa7[_0x41d44e];return _0x6b3ad5;};'use strict';var ChatQueueEvents=require(_0x76aa('0x0'));var events=['save',_0x76aa('0x1'),_0x76aa('0x2')];function createListener(_0x25c818,_0x2db4fe){return function(_0x4f007e){_0x2db4fe[_0x76aa('0x3')](_0x25c818,_0x4f007e);};}function removeListener(_0xef15ef,_0x1d6e04){return function(){ChatQueueEvents['removeListener'](_0xef15ef,_0x1d6e04);};}exports['register']=function(_0x1aceaa){for(var _0x4d53f6=0x0,_0x32dee5=events[_0x76aa('0x4')];_0x4d53f6<_0x32dee5;_0x4d53f6++){var _0xa9b695=events[_0x4d53f6];var _0x56d6bc=createListener(_0x76aa('0x5')+_0xa9b695,_0x1aceaa);ChatQueueEvents['on'](_0xa9b695,_0x56d6bc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 900dd18..4a5189e 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x5a04d5,_0x232f3b){_0x5a04d5=_0x5a04d5-0x0;var _0x2dd19b=_0x3e74[_0x5a04d5];return _0x2dd19b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x386a4f,_0x4ff427){var _0x3fc522=function(_0x3c94e6){while(--_0x3c94e6){_0x386a4f['push'](_0x386a4f['shift']());}};_0x3fc522(++_0x4ff427);}(_0x7217,0x19e));var _0x7721=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7217[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 16df647..daacdfa 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 _0x2156=['moment','exports','STRING','DATE'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2156,0x19c));var _0x6215=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2156[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0x6215('0x0'));var Sequelize=require('sequelize');module[_0x6215('0x1')]={'uniqueid':{'type':Sequelize[_0x6215('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6215('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6215('0x3')]},'exitAt':{'type':Sequelize[_0x6215('0x3')]},'reason':{'type':Sequelize[_0x6215('0x2')]}}; \ No newline at end of file +var _0x96fc=['moment','sequelize','exports','STRING','DATE'];(function(_0x1fdb68,_0x10f49a){var _0x8624b8=function(_0x62cb13){while(--_0x62cb13){_0x1fdb68['push'](_0x1fdb68['shift']());}};_0x8624b8(++_0x10f49a);}(_0x96fc,0x1cc));var _0xc96f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x96fc[_0x21a9d9];return _0x46adce;};'use strict';var moment=require(_0xc96f('0x0'));var Sequelize=require(_0xc96f('0x1'));module[_0xc96f('0x2')]={'uniqueid':{'type':Sequelize[_0xc96f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc96f('0x3')]},'joinAt':{'type':Sequelize[_0xc96f('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc96f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc96f('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index bd078cc..bd7d587 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 _0xb491=['find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','includeAll','include'];(function(_0x4a33da,_0x5b3284){var _0x2ac3b3=function(_0x35fdb1){while(--_0x35fdb1){_0x4a33da['push'](_0x4a33da['shift']());}};_0x2ac3b3(++_0x5b3284);}(_0xb491,0x18c));var _0x1b49=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xb491[_0xdaab62];return _0x13d767;};'use strict';var emlformat=require(_0x1b49('0x0'));var rimraf=require(_0x1b49('0x1'));var zipdir=require(_0x1b49('0x2'));var jsonpatch=require(_0x1b49('0x3'));var rp=require(_0x1b49('0x4'));var moment=require(_0x1b49('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1b49('0x6'));var util=require(_0x1b49('0x7'));var path=require('path');var sox=require(_0x1b49('0x8'));var csv=require(_0x1b49('0x9'));var ejs=require(_0x1b49('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b49('0xb'));var squel=require('squel');var crypto=require(_0x1b49('0xc'));var jsforce=require(_0x1b49('0xd'));var deskjs=require(_0x1b49('0xe'));var toCsv=require(_0x1b49('0x9'));var querystring=require(_0x1b49('0xf'));var Papa=require(_0x1b49('0x10'));var Redis=require(_0x1b49('0x11'));var authService=require(_0x1b49('0x12'));var qs=require(_0x1b49('0x13'));var as=require(_0x1b49('0x14'));var hardwareService=require(_0x1b49('0x15'));var logger=require(_0x1b49('0x16'))(_0x1b49('0x17'));var utils=require(_0x1b49('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b49('0x19'))['db'];function respondWithStatusCode(_0x1fccba,_0x3f92b6){_0x3f92b6=_0x3f92b6||0xcc;return function(_0x4dbbb6){if(_0x4dbbb6){return _0x1fccba[_0x1b49('0x1a')](_0x3f92b6);}return _0x1fccba['status'](_0x3f92b6)[_0x1b49('0x1b')]();};}function respondWithResult(_0x549141,_0xd70fc2){_0xd70fc2=_0xd70fc2||0xc8;return function(_0x118c8d){if(_0x118c8d){return _0x549141[_0x1b49('0x1c')](_0xd70fc2)[_0x1b49('0x1d')](_0x118c8d);}};}function respondWithFilteredResult(_0x4ad676,_0x2995ab){return function(_0x1816bf){if(_0x1816bf){var _0x13ea8d=typeof _0x2995ab[_0x1b49('0x1e')]===_0x1b49('0x1f')&&typeof _0x2995ab[_0x1b49('0x20')]===_0x1b49('0x1f');var _0x3a5572=_0x1816bf['count'];var _0x363678=_0x13ea8d?0x0:_0x2995ab[_0x1b49('0x1e')];var _0x4b9dcd=_0x13ea8d?_0x1816bf[_0x1b49('0x21')]:_0x2995ab[_0x1b49('0x1e')]+_0x2995ab[_0x1b49('0x20')];var _0x275ec9;if(_0x4b9dcd>=_0x3a5572){_0x4b9dcd=_0x3a5572;_0x275ec9=0xc8;}else{_0x275ec9=0xce;}_0x4ad676[_0x1b49('0x1c')](_0x275ec9);return _0x4ad676[_0x1b49('0x22')](_0x1b49('0x23'),_0x363678+'-'+_0x4b9dcd+'/'+_0x3a5572)[_0x1b49('0x1d')](_0x1816bf);}return null;};}function patchUpdates(_0x2e9a18){return function(_0x3bb911){try{jsonpatch['apply'](_0x3bb911,_0x2e9a18,!![]);}catch(_0x516aab){return BPromise[_0x1b49('0x24')](_0x516aab);}return _0x3bb911[_0x1b49('0x25')]();};}function saveUpdates(_0x24592a,_0x3605d8){return function(_0x510748){if(_0x510748){return _0x510748[_0x1b49('0x26')](_0x24592a)[_0x1b49('0x27')](function(_0x4f3d44){return _0x4f3d44;});}return null;};}function removeEntity(_0x463096,_0x187295){return function(_0x3ee60c){if(_0x3ee60c){return _0x3ee60c['destroy']()[_0x1b49('0x27')](function(){_0x463096[_0x1b49('0x1c')](0xcc)[_0x1b49('0x1b')]();});}};}function handleEntityNotFound(_0x4ab79e,_0x39f5d1){return function(_0x565b2c){if(!_0x565b2c){_0x4ab79e[_0x1b49('0x1a')](0x194);}return _0x565b2c;};}function handleError(_0x4f7c29,_0x3b8d6a){_0x3b8d6a=_0x3b8d6a||0x1f4;return function(_0x469ab0){logger[_0x1b49('0x28')](_0x469ab0['stack']);if(_0x469ab0[_0x1b49('0x29')]){delete _0x469ab0['name'];}_0x4f7c29['status'](_0x3b8d6a)['send'](_0x469ab0);};}exports[_0x1b49('0x2a')]=function(_0x56eb42,_0x209782){var _0x46eda6={},_0x512d61={},_0x29b0a5={'count':0x0,'rows':[]};var _0xf05d35=_[_0x1b49('0x2b')](db[_0x1b49('0x2c')][_0x1b49('0x2d')],function(_0x1d2a5f){return{'name':_0x1d2a5f[_0x1b49('0x2e')],'type':_0x1d2a5f['type'][_0x1b49('0x2f')]};});_0x512d61[_0x1b49('0x30')]=_[_0x1b49('0x2b')](_0xf05d35,'name');_0x512d61['query']=_[_0x1b49('0x31')](_0x56eb42['query']);_0x512d61[_0x1b49('0x32')]=_['intersection'](_0x512d61[_0x1b49('0x30')],_0x512d61[_0x1b49('0x33')]);_0x46eda6[_0x1b49('0x34')]=_[_0x1b49('0x35')](_0x512d61['model'],qs[_0x1b49('0x36')](_0x56eb42[_0x1b49('0x33')][_0x1b49('0x36')]));_0x46eda6[_0x1b49('0x34')]=_0x46eda6[_0x1b49('0x34')][_0x1b49('0x37')]?_0x46eda6[_0x1b49('0x34')]:_0x512d61[_0x1b49('0x30')];if(!_0x56eb42['query'][_0x1b49('0x38')]('nolimit')){_0x46eda6[_0x1b49('0x20')]=qs[_0x1b49('0x20')](_0x56eb42[_0x1b49('0x33')][_0x1b49('0x20')]);_0x46eda6['offset']=qs['offset'](_0x56eb42['query'][_0x1b49('0x1e')]);}_0x46eda6[_0x1b49('0x39')]=qs['sort'](_0x56eb42[_0x1b49('0x33')][_0x1b49('0x3a')]);_0x46eda6[_0x1b49('0x3b')]=qs[_0x1b49('0x32')](_[_0x1b49('0x3c')](_0x56eb42['query'],_0x512d61[_0x1b49('0x32')]),_0xf05d35);if(_0x56eb42['query'][_0x1b49('0x3d')]){_0x46eda6['where']=_[_0x1b49('0x3e')](_0x46eda6['where'],{'$or':_[_0x1b49('0x2b')](_0xf05d35,function(_0x5a5aa9){if(_0x5a5aa9[_0x1b49('0x3f')]!==_0x1b49('0x40')){var _0x3867a1={};_0x3867a1[_0x5a5aa9['name']]={'$like':'%'+_0x56eb42[_0x1b49('0x33')][_0x1b49('0x3d')]+'%'};return _0x3867a1;}})});}_0x46eda6=_[_0x1b49('0x3e')]({},_0x46eda6,_0x56eb42[_0x1b49('0x41')]);var _0x505041={'where':_0x46eda6[_0x1b49('0x3b')]};return db['ChatQueueReport']['count'](_0x505041)[_0x1b49('0x27')](function(_0x5ab569){_0x29b0a5[_0x1b49('0x21')]=_0x5ab569;if(_0x56eb42[_0x1b49('0x33')]['includeAll']){_0x46eda6['include']=[{'all':!![]}];}return db[_0x1b49('0x2c')][_0x1b49('0x42')](_0x46eda6);})[_0x1b49('0x27')](function(_0x4298fe){_0x29b0a5[_0x1b49('0x43')]=_0x4298fe;return _0x29b0a5;})[_0x1b49('0x27')](respondWithFilteredResult(_0x209782,_0x46eda6))[_0x1b49('0x44')](handleError(_0x209782,null));};exports[_0x1b49('0x45')]=function(_0x5ededf,_0x1049c4){var _0x73eff0={'raw':!![],'where':{'id':_0x5ededf['params']['id']}},_0x787e28={};_0x787e28['model']=_[_0x1b49('0x31')](db[_0x1b49('0x2c')][_0x1b49('0x2d')]);_0x787e28[_0x1b49('0x33')]=_['keys'](_0x5ededf[_0x1b49('0x33')]);_0x787e28[_0x1b49('0x32')]=_[_0x1b49('0x35')](_0x787e28['model'],_0x787e28[_0x1b49('0x33')]);_0x73eff0[_0x1b49('0x34')]=_[_0x1b49('0x35')](_0x787e28[_0x1b49('0x30')],qs[_0x1b49('0x36')](_0x5ededf[_0x1b49('0x33')][_0x1b49('0x36')]));_0x73eff0[_0x1b49('0x34')]=_0x73eff0['attributes'][_0x1b49('0x37')]?_0x73eff0[_0x1b49('0x34')]:_0x787e28[_0x1b49('0x30')];if(_0x5ededf[_0x1b49('0x33')][_0x1b49('0x46')]){_0x73eff0[_0x1b49('0x47')]=[{'all':!![]}];}_0x73eff0=_[_0x1b49('0x3e')]({},_0x73eff0,_0x5ededf[_0x1b49('0x41')]);return db[_0x1b49('0x2c')][_0x1b49('0x48')](_0x73eff0)[_0x1b49('0x27')](handleEntityNotFound(_0x1049c4,null))[_0x1b49('0x27')](respondWithResult(_0x1049c4,null))[_0x1b49('0x44')](handleError(_0x1049c4,null));};exports[_0x1b49('0x49')]=function(_0xf8ee67,_0x5d7155){return db['ChatQueueReport']['create'](_0xf8ee67['body'],{})['then'](respondWithResult(_0x5d7155,0xc9))[_0x1b49('0x44')](handleError(_0x5d7155,null));};exports[_0x1b49('0x26')]=function(_0x2a5f46,_0x44fdf0){if(_0x2a5f46[_0x1b49('0x4a')]['id']){delete _0x2a5f46[_0x1b49('0x4a')]['id'];}return db['ChatQueueReport'][_0x1b49('0x48')]({'where':{'id':_0x2a5f46[_0x1b49('0x4b')]['id']}})[_0x1b49('0x27')](handleEntityNotFound(_0x44fdf0,null))[_0x1b49('0x27')](saveUpdates(_0x2a5f46['body'],null))[_0x1b49('0x27')](respondWithResult(_0x44fdf0,null))[_0x1b49('0x44')](handleError(_0x44fdf0,null));};exports[_0x1b49('0x4c')]=function(_0x1791b2,_0xafb22b){return db[_0x1b49('0x2c')]['find']({'where':{'id':_0x1791b2[_0x1b49('0x4b')]['id']}})['then'](handleEntityNotFound(_0xafb22b,null))[_0x1b49('0x27')](removeEntity(_0xafb22b,null))[_0x1b49('0x44')](handleError(_0xafb22b,null));};exports[_0x1b49('0x4d')]=function(_0x1d10eb,_0x5ff0bb){return db['ChatQueueReport'][_0x1b49('0x4d')]()[_0x1b49('0x27')](respondWithResult(_0x5ff0bb,null))[_0x1b49('0x44')](handleError(_0x5ff0bb,null));}; \ No newline at end of file +var _0xe0c1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','then','error','name','send','index','map','ChatQueueReport','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','include','findAll','rows','catch','params','length','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x402915,_0x29e9c2){_0x402915=_0x402915-0x0;var _0x47cc3e=_0xe0c1[_0x402915];return _0x47cc3e;};'use strict';var emlformat=require(_0x1e0c('0x0'));var rimraf=require(_0x1e0c('0x1'));var zipdir=require(_0x1e0c('0x2'));var jsonpatch=require(_0x1e0c('0x3'));var rp=require(_0x1e0c('0x4'));var moment=require(_0x1e0c('0x5'));var BPromise=require(_0x1e0c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e0c('0x7'));var _=require(_0x1e0c('0x8'));var squel=require(_0x1e0c('0x9'));var crypto=require(_0x1e0c('0xa'));var jsforce=require(_0x1e0c('0xb'));var deskjs=require(_0x1e0c('0xc'));var toCsv=require(_0x1e0c('0xd'));var querystring=require(_0x1e0c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1e0c('0xf'));var authService=require(_0x1e0c('0x10'));var qs=require(_0x1e0c('0x11'));var as=require(_0x1e0c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e0c('0x13'))(_0x1e0c('0x14'));var utils=require(_0x1e0c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1e0c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x138605,_0x39305e){_0x39305e=_0x39305e||0xcc;return function(_0x432542){if(_0x432542){return _0x138605[_0x1e0c('0x17')](_0x39305e);}return _0x138605[_0x1e0c('0x18')](_0x39305e)[_0x1e0c('0x19')]();};}function respondWithResult(_0x1aece1,_0x1c2616){_0x1c2616=_0x1c2616||0xc8;return function(_0x1fbc44){if(_0x1fbc44){return _0x1aece1[_0x1e0c('0x18')](_0x1c2616)['json'](_0x1fbc44);}};}function respondWithFilteredResult(_0x3970ae,_0x57ad85){return function(_0x2500d7){if(_0x2500d7){var _0xcf9c3b=typeof _0x57ad85[_0x1e0c('0x1a')]===_0x1e0c('0x1b')&&typeof _0x57ad85[_0x1e0c('0x1c')]===_0x1e0c('0x1b');var _0x35a9cc=_0x2500d7['count'];var _0x4315aa=_0xcf9c3b?0x0:_0x57ad85[_0x1e0c('0x1a')];var _0x122cd2=_0xcf9c3b?_0x2500d7[_0x1e0c('0x1d')]:_0x57ad85['offset']+_0x57ad85['limit'];var _0x596304;if(_0x122cd2>=_0x35a9cc){_0x122cd2=_0x35a9cc;_0x596304=0xc8;}else{_0x596304=0xce;}_0x3970ae[_0x1e0c('0x18')](_0x596304);return _0x3970ae[_0x1e0c('0x1e')](_0x1e0c('0x1f'),_0x4315aa+'-'+_0x122cd2+'/'+_0x35a9cc)[_0x1e0c('0x20')](_0x2500d7);}return null;};}function patchUpdates(_0x3f2a59){return function(_0x3a94f0){try{jsonpatch[_0x1e0c('0x21')](_0x3a94f0,_0x3f2a59,!![]);}catch(_0x3c955c){return BPromise['reject'](_0x3c955c);}return _0x3a94f0['save']();};}function saveUpdates(_0x3885d2,_0x38d8bd){return function(_0x3b1200){if(_0x3b1200){return _0x3b1200[_0x1e0c('0x22')](_0x3885d2)['then'](function(_0x4743e7){return _0x4743e7;});}return null;};}function removeEntity(_0x891c5e,_0x1edf97){return function(_0x1cf772){if(_0x1cf772){return _0x1cf772[_0x1e0c('0x23')]()[_0x1e0c('0x24')](function(){_0x891c5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7c49,_0x3867c6){return function(_0x4296b5){if(!_0x4296b5){_0x1d7c49[_0x1e0c('0x17')](0x194);}return _0x4296b5;};}function handleError(_0x5cec62,_0x3d4323){_0x3d4323=_0x3d4323||0x1f4;return function(_0x104bf4){logger[_0x1e0c('0x25')](_0x104bf4['stack']);if(_0x104bf4[_0x1e0c('0x26')]){delete _0x104bf4[_0x1e0c('0x26')];}_0x5cec62[_0x1e0c('0x18')](_0x3d4323)[_0x1e0c('0x27')](_0x104bf4);};}exports[_0x1e0c('0x28')]=function(_0x4e0cea,_0x6ffd65){var _0x582a18={},_0x1e49a9={},_0x4adfa7={'count':0x0,'rows':[]};var _0x105ca4=_[_0x1e0c('0x29')](db[_0x1e0c('0x2a')][_0x1e0c('0x2b')],function(_0x11cb84){return{'name':_0x11cb84['fieldName'],'type':_0x11cb84[_0x1e0c('0x2c')][_0x1e0c('0x2d')]};});_0x1e49a9['model']=_['map'](_0x105ca4,_0x1e0c('0x26'));_0x1e49a9['query']=_[_0x1e0c('0x2e')](_0x4e0cea[_0x1e0c('0x2f')]);_0x1e49a9[_0x1e0c('0x30')]=_[_0x1e0c('0x31')](_0x1e49a9[_0x1e0c('0x32')],_0x1e49a9[_0x1e0c('0x2f')]);_0x582a18[_0x1e0c('0x33')]=_[_0x1e0c('0x31')](_0x1e49a9[_0x1e0c('0x32')],qs[_0x1e0c('0x34')](_0x4e0cea['query'][_0x1e0c('0x34')]));_0x582a18['attributes']=_0x582a18[_0x1e0c('0x33')]['length']?_0x582a18[_0x1e0c('0x33')]:_0x1e49a9['model'];if(!_0x4e0cea[_0x1e0c('0x2f')][_0x1e0c('0x35')]('nolimit')){_0x582a18['limit']=qs['limit'](_0x4e0cea[_0x1e0c('0x2f')]['limit']);_0x582a18['offset']=qs[_0x1e0c('0x1a')](_0x4e0cea[_0x1e0c('0x2f')][_0x1e0c('0x1a')]);}_0x582a18[_0x1e0c('0x36')]=qs[_0x1e0c('0x37')](_0x4e0cea[_0x1e0c('0x2f')]['sort']);_0x582a18[_0x1e0c('0x38')]=qs[_0x1e0c('0x30')](_[_0x1e0c('0x39')](_0x4e0cea[_0x1e0c('0x2f')],_0x1e49a9[_0x1e0c('0x30')]),_0x105ca4);if(_0x4e0cea[_0x1e0c('0x2f')]['filter']){_0x582a18[_0x1e0c('0x38')]=_[_0x1e0c('0x3a')](_0x582a18[_0x1e0c('0x38')],{'$or':_[_0x1e0c('0x29')](_0x105ca4,function(_0x12bd17){if(_0x12bd17[_0x1e0c('0x2c')]!=='VIRTUAL'){var _0x12b779={};_0x12b779[_0x12bd17[_0x1e0c('0x26')]]={'$like':'%'+_0x4e0cea['query'][_0x1e0c('0x3b')]+'%'};return _0x12b779;}})});}_0x582a18=_[_0x1e0c('0x3a')]({},_0x582a18,_0x4e0cea['options']);var _0x5347d0={'where':_0x582a18[_0x1e0c('0x38')]};return db[_0x1e0c('0x2a')][_0x1e0c('0x1d')](_0x5347d0)[_0x1e0c('0x24')](function(_0x53b77c){_0x4adfa7['count']=_0x53b77c;if(_0x4e0cea[_0x1e0c('0x2f')]['includeAll']){_0x582a18[_0x1e0c('0x3c')]=[{'all':!![]}];}return db[_0x1e0c('0x2a')][_0x1e0c('0x3d')](_0x582a18);})['then'](function(_0x5760b6){_0x4adfa7[_0x1e0c('0x3e')]=_0x5760b6;return _0x4adfa7;})['then'](respondWithFilteredResult(_0x6ffd65,_0x582a18))[_0x1e0c('0x3f')](handleError(_0x6ffd65,null));};exports['show']=function(_0x2f72e1,_0x524c35){var _0x3ab785={'raw':!![],'where':{'id':_0x2f72e1[_0x1e0c('0x40')]['id']}},_0x52c87e={};_0x52c87e[_0x1e0c('0x32')]=_[_0x1e0c('0x2e')](db[_0x1e0c('0x2a')][_0x1e0c('0x2b')]);_0x52c87e[_0x1e0c('0x2f')]=_['keys'](_0x2f72e1['query']);_0x52c87e[_0x1e0c('0x30')]=_[_0x1e0c('0x31')](_0x52c87e[_0x1e0c('0x32')],_0x52c87e[_0x1e0c('0x2f')]);_0x3ab785[_0x1e0c('0x33')]=_[_0x1e0c('0x31')](_0x52c87e['model'],qs[_0x1e0c('0x34')](_0x2f72e1[_0x1e0c('0x2f')]['fields']));_0x3ab785['attributes']=_0x3ab785[_0x1e0c('0x33')][_0x1e0c('0x41')]?_0x3ab785[_0x1e0c('0x33')]:_0x52c87e[_0x1e0c('0x32')];if(_0x2f72e1[_0x1e0c('0x2f')][_0x1e0c('0x42')]){_0x3ab785[_0x1e0c('0x3c')]=[{'all':!![]}];}_0x3ab785=_[_0x1e0c('0x3a')]({},_0x3ab785,_0x2f72e1[_0x1e0c('0x43')]);return db[_0x1e0c('0x2a')][_0x1e0c('0x44')](_0x3ab785)[_0x1e0c('0x24')](handleEntityNotFound(_0x524c35,null))['then'](respondWithResult(_0x524c35,null))[_0x1e0c('0x3f')](handleError(_0x524c35,null));};exports['create']=function(_0x2e5dd5,_0x2d8de9){return db[_0x1e0c('0x2a')][_0x1e0c('0x45')](_0x2e5dd5[_0x1e0c('0x46')],{})[_0x1e0c('0x24')](respondWithResult(_0x2d8de9,0xc9))[_0x1e0c('0x3f')](handleError(_0x2d8de9,null));};exports[_0x1e0c('0x22')]=function(_0x4cc6e7,_0x5d3178){if(_0x4cc6e7[_0x1e0c('0x46')]['id']){delete _0x4cc6e7[_0x1e0c('0x46')]['id'];}return db[_0x1e0c('0x2a')]['find']({'where':{'id':_0x4cc6e7[_0x1e0c('0x40')]['id']}})[_0x1e0c('0x24')](handleEntityNotFound(_0x5d3178,null))[_0x1e0c('0x24')](saveUpdates(_0x4cc6e7['body'],null))['then'](respondWithResult(_0x5d3178,null))[_0x1e0c('0x3f')](handleError(_0x5d3178,null));};exports[_0x1e0c('0x23')]=function(_0x5be24a,_0x36fc9b){return db[_0x1e0c('0x2a')][_0x1e0c('0x44')]({'where':{'id':_0x5be24a['params']['id']}})[_0x1e0c('0x24')](handleEntityNotFound(_0x36fc9b,null))['then'](removeEntity(_0x36fc9b,null))[_0x1e0c('0x3f')](handleError(_0x36fc9b,null));};exports[_0x1e0c('0x47')]=function(_0x252609,_0x26e276){return db[_0x1e0c('0x2a')][_0x1e0c('0x47')]()[_0x1e0c('0x24')](respondWithResult(_0x26e276,null))[_0x1e0c('0x3f')](handleError(_0x26e276,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 41439e6..926da76 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x5c7e5e,_0x5e59f8){var _0x2d40cf=function(_0x25e8f6){while(--_0x25e8f6){_0x5c7e5e['push'](_0x5c7e5e['shift']());}};_0x2d40cf(++_0x5e59f8);}(_0xe706,0xa3));var _0x6e70=function(_0x2050aa,_0x2e48ea){_0x2050aa=_0x2050aa-0x0;var _0x5b03bd=_0xe706[_0x2050aa];return _0x5b03bd;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1c3166,_0x733c99){var _0x15465d=function(_0x1ab928){while(--_0x1ab928){_0x1c3166['push'](_0x1c3166['shift']());}};_0x15465d(++_0x733c99);}(_0x757a,0xde));var _0xa757=function(_0x265b1d,_0x2b39ca){_0x265b1d=_0x265b1d-0x0;var _0x2866cf=_0x757a[_0x265b1d];return _0x2866cf;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e577d20..7e4f92f 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 _0xbdae=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','create','body','options','debug','UpdateChatQueueReport','ChatQueueReport','update','raw','where','limit'];(function(_0xb61d97,_0x4c11ea){var _0x2b20a6=function(_0xd074c4){while(--_0xd074c4){_0xb61d97['push'](_0xb61d97['shift']());}};_0x2b20a6(++_0x4c11ea);}(_0xbdae,0xe0));var _0xebda=function(_0x3b29b7,_0x31831e){_0x3b29b7=_0x3b29b7-0x0;var _0x2b2669=_0xbdae[_0x3b29b7];return _0x2b2669;};'use strict';var _=require('lodash');var util=require(_0xebda('0x0'));var moment=require(_0xebda('0x1'));var BPromise=require(_0xebda('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebda('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xebda('0x4'));var logger=require('../../config/logger')(_0xebda('0x5'));var config=require(_0xebda('0x6'));var jayson=require(_0xebda('0x7'));var client=jayson[_0xebda('0x8')][_0xebda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ca2a,_0xf8e333,_0x379e4e){return new BPromise(function(_0x599e11,_0x434039){return client['request'](_0x40ca2a,_0x379e4e)[_0xebda('0xa')](function(_0x19cd8a){logger[_0xebda('0xb')](_0xebda('0xc'),_0xf8e333,'request\x20sent');logger['debug'](_0xebda('0xd'),_0xf8e333,_0xebda('0xe'),JSON[_0xebda('0xf')](_0x19cd8a));if(_0x19cd8a[_0xebda('0x10')]){if(_0x19cd8a[_0xebda('0x10')][_0xebda('0x11')]===0x1f4){logger[_0xebda('0x10')](_0xebda('0xc'),_0xf8e333,_0x19cd8a[_0xebda('0x10')][_0xebda('0x12')]);return _0x434039(_0x19cd8a[_0xebda('0x10')]['message']);}logger[_0xebda('0x10')](_0xebda('0xc'),_0xf8e333,_0x19cd8a[_0xebda('0x10')][_0xebda('0x12')]);return _0x599e11(_0x19cd8a['error']['message']);}else{logger[_0xebda('0xb')](_0xebda('0xc'),_0xf8e333,'request\x20sent');_0x599e11(_0x19cd8a[_0xebda('0x13')][_0xebda('0x12')]);}})[_0xebda('0x14')](function(_0x509668){logger['error'](_0xebda('0xc'),_0xf8e333,_0x509668);_0x434039(_0x509668);});});}exports[_0xebda('0x15')]=function(_0x4609c8){var _0x2224b1=this;return new Promise(function(_0x742931,_0x5eb47e){return db['ChatQueueReport'][_0xebda('0x16')](_0x4609c8[_0xebda('0x17')],{'raw':_0x4609c8[_0xebda('0x18')]?_0x4609c8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x25ab41){logger[_0xebda('0xb')](_0xebda('0x15'),_0x4609c8);logger[_0xebda('0x19')]('CreateChatQueueReport',_0x4609c8,JSON[_0xebda('0xf')](_0x25ab41));_0x742931(_0x25ab41);})['catch'](function(_0x3590b7){logger['error'](_0xebda('0x15'),_0x3590b7[_0xebda('0x12')],_0x4609c8);_0x5eb47e(_0x2224b1['error'](0x1f4,_0x3590b7[_0xebda('0x12')]));});});};exports[_0xebda('0x1a')]=function(_0x63e693){var _0x317412=this;return new Promise(function(_0x48af4c,_0x1a75a6){return db[_0xebda('0x1b')][_0xebda('0x1c')](_0x63e693[_0xebda('0x17')],{'raw':_0x63e693[_0xebda('0x18')]?_0x63e693[_0xebda('0x18')][_0xebda('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63e693[_0xebda('0x18')]?_0x63e693['options'][_0xebda('0x1e')]||null:null,'attributes':_0x63e693['options']?_0x63e693['options']['attributes']||null:null,'limit':_0x63e693[_0xebda('0x18')]?_0x63e693[_0xebda('0x18')][_0xebda('0x1f')]||null:null})['then'](function(_0x219c70){logger['info'](_0xebda('0x1a'),_0x63e693);logger[_0xebda('0x19')]('UpdateChatQueueReport',_0x63e693,JSON[_0xebda('0xf')](_0x219c70));_0x48af4c(_0x219c70);})['catch'](function(_0x3d87d0){logger[_0xebda('0x10')]('UpdateChatQueueReport',_0x3d87d0[_0xebda('0x12')],_0x63e693);_0x1a75a6(_0x317412[_0xebda('0x10')](0x1f4,_0x3d87d0[_0xebda('0x12')]));});});}; \ No newline at end of file +var _0xb5e1=['CreateChatQueueReport','ChatQueueReport','options','UpdateChatQueueReport','update','body','raw','where','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','info','catch'];(function(_0x593a40,_0x53299b){var _0xdd5b08=function(_0x152dbd){while(--_0x152dbd){_0x593a40['push'](_0x593a40['shift']());}};_0xdd5b08(++_0x53299b);}(_0xb5e1,0x18f));var _0x1b5e=function(_0x2ab251,_0x41f7bb){_0x2ab251=_0x2ab251-0x0;var _0x4461c4=_0xb5e1[_0x2ab251];return _0x4461c4;};'use strict';var _=require(_0x1b5e('0x0'));var util=require(_0x1b5e('0x1'));var moment=require(_0x1b5e('0x2'));var BPromise=require(_0x1b5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b5e('0x4'))['db'];var utils=require(_0x1b5e('0x5'));var logger=require(_0x1b5e('0x6'))(_0x1b5e('0x7'));var config=require(_0x1b5e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b5e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbab908,_0x2b5371,_0x4361c9){return new BPromise(function(_0x3cff32,_0x1553ec){return client[_0x1b5e('0xa')](_0xbab908,_0x4361c9)[_0x1b5e('0xb')](function(_0x194074){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x2b5371,_0x1b5e('0xc'));logger[_0x1b5e('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x2b5371,'request\x20sent',JSON[_0x1b5e('0xe')](_0x194074));if(_0x194074['error']){if(_0x194074[_0x1b5e('0xf')][_0x1b5e('0x10')]===0x1f4){logger[_0x1b5e('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x2b5371,_0x194074[_0x1b5e('0xf')][_0x1b5e('0x11')]);return _0x1553ec(_0x194074['error']['message']);}logger[_0x1b5e('0xf')](_0x1b5e('0x12'),_0x2b5371,_0x194074[_0x1b5e('0xf')]['message']);return _0x3cff32(_0x194074['error'][_0x1b5e('0x11')]);}else{logger[_0x1b5e('0x13')](_0x1b5e('0x12'),_0x2b5371,_0x1b5e('0xc'));_0x3cff32(_0x194074['result']['message']);}})[_0x1b5e('0x14')](function(_0x6f9d64){logger[_0x1b5e('0xf')](_0x1b5e('0x12'),_0x2b5371,_0x6f9d64);_0x1553ec(_0x6f9d64);});});}exports[_0x1b5e('0x15')]=function(_0x58860c){var _0x367e8d=this;return new Promise(function(_0x3cca97,_0x447f72){return db[_0x1b5e('0x16')]['create'](_0x58860c['body'],{'raw':_0x58860c[_0x1b5e('0x17')]?_0x58860c[_0x1b5e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1b5e('0xb')](function(_0x57b4c0){logger['info'](_0x1b5e('0x15'),_0x58860c);logger[_0x1b5e('0xd')]('CreateChatQueueReport',_0x58860c,JSON[_0x1b5e('0xe')](_0x57b4c0));_0x3cca97(_0x57b4c0);})['catch'](function(_0x32c03d){logger[_0x1b5e('0xf')](_0x1b5e('0x15'),_0x32c03d[_0x1b5e('0x11')],_0x58860c);_0x447f72(_0x367e8d[_0x1b5e('0xf')](0x1f4,_0x32c03d['message']));});});};exports[_0x1b5e('0x18')]=function(_0x4e5425){var _0x68b977=this;return new Promise(function(_0x17d8de,_0x1cac17){return db[_0x1b5e('0x16')][_0x1b5e('0x19')](_0x4e5425[_0x1b5e('0x1a')],{'raw':_0x4e5425[_0x1b5e('0x17')]?_0x4e5425[_0x1b5e('0x17')][_0x1b5e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5425[_0x1b5e('0x17')]?_0x4e5425[_0x1b5e('0x17')][_0x1b5e('0x1c')]||null:null,'attributes':_0x4e5425[_0x1b5e('0x17')]?_0x4e5425['options']['attributes']||null:null,'limit':_0x4e5425[_0x1b5e('0x17')]?_0x4e5425[_0x1b5e('0x17')][_0x1b5e('0x1d')]||null:null})['then'](function(_0x5131ff){logger[_0x1b5e('0x13')]('UpdateChatQueueReport',_0x4e5425);logger[_0x1b5e('0xd')](_0x1b5e('0x18'),_0x4e5425,JSON[_0x1b5e('0xe')](_0x5131ff));_0x17d8de(_0x5131ff);})[_0x1b5e('0x14')](function(_0x5ab354){logger['error']('UpdateChatQueueReport',_0x5ab354[_0x1b5e('0x11')],_0x4e5425);_0x1cac17(_0x68b977['error'](0x1f4,_0x5ab354[_0x1b5e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3ff43c5..223bd4b 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 _0x71f5=['/describe','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x183c25,_0x5a304d){var _0x17c20a=function(_0x5524a3){while(--_0x5524a3){_0x183c25['push'](_0x183c25['shift']());}};_0x17c20a(++_0x5a304d);}(_0x71f5,0xe2));var _0x571f=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0x71f5[_0x24c135];return _0x290c66;};'use strict';var multer=require('multer');var util=require(_0x571f('0x0'));var path=require(_0x571f('0x1'));var timeout=require(_0x571f('0x2'));var express=require(_0x571f('0x3'));var router=express[_0x571f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x571f('0x5'));var interaction=require(_0x571f('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x571f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x571f('0x8'),auth[_0x571f('0x9')](),controller['describe']);router[_0x571f('0x7')](_0x571f('0xa'),auth[_0x571f('0x9')](),controller[_0x571f('0xb')]);router[_0x571f('0xc')]('/',auth['isAuthenticated'](),controller[_0x571f('0xd')]);router[_0x571f('0xe')](_0x571f('0xa'),auth[_0x571f('0x9')](),controller[_0x571f('0xf')]);router[_0x571f('0x10')](_0x571f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x571f('0x11')]=router; \ No newline at end of file +var _0xc97f=['express','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xc97f,0x152));var _0xfc97=function(_0x46903d,_0x48163a){_0x46903d=_0x46903d-0x0;var _0x1d08ca=_0xc97f[_0x46903d];return _0x1d08ca;};'use strict';var multer=require(_0xfc97('0x0'));var util=require(_0xfc97('0x1'));var path=require(_0xfc97('0x2'));var timeout=require(_0xfc97('0x3'));var express=require(_0xfc97('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfc97('0x6'));var controller=require(_0xfc97('0x7'));router[_0xfc97('0x8')]('/',auth[_0xfc97('0x9')](),controller[_0xfc97('0xa')]);router['get']('/describe',auth[_0xfc97('0x9')](),controller[_0xfc97('0xb')]);router[_0xfc97('0x8')](_0xfc97('0xc'),auth[_0xfc97('0x9')](),controller[_0xfc97('0xd')]);router[_0xfc97('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfc97('0xf')](_0xfc97('0xc'),auth[_0xfc97('0x9')](),controller['update']);router[_0xfc97('0x10')](_0xfc97('0xc'),auth[_0xfc97('0x9')](),controller[_0xfc97('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index d8fa10b..2ba90f4 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1c217f,_0x25bd13){var _0x40968d=function(_0x18e86c){while(--_0x18e86c){_0x1c217f['push'](_0x1c217f['shift']());}};_0x40968d(++_0x25bd13);}(_0xf4eb,0xec));var _0xbf4e=function(_0x22ca08,_0x1aacee){_0x22ca08=_0x22ca08-0x0;var _0x281571=_0xf4eb[_0x22ca08];return _0x281571;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5a8ffc,_0x28b953){var _0x3f5657=function(_0x1f3d4d){while(--_0x1f3d4d){_0x5a8ffc['push'](_0x5a8ffc['shift']());}};_0x3f5657(++_0x28b953);}(_0x008c,0x188));var _0xc008=function(_0x488b85,_0x10ec23){_0x488b85=_0x488b85-0x0;var _0x59d07d=_0x008c[_0x488b85];return _0x59d07d;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index acfc80d..80f6fc8 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 _0x79c2=['options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','error','name','index','ChatTransferReport','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','type','VIRTUAL'];(function(_0x49ff23,_0xb1eff6){var _0xcf3a9f=function(_0x4e07e4){while(--_0x4e07e4){_0x49ff23['push'](_0x49ff23['shift']());}};_0xcf3a9f(++_0xb1eff6);}(_0x79c2,0x13d));var _0x279c=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x79c2[_0x2ec2bf];return _0x2c279c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x279c('0x0'));var zipdir=require(_0x279c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x279c('0x2'));var moment=require(_0x279c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x279c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x279c('0x5'));var csv=require(_0x279c('0x6'));var ejs=require(_0x279c('0x7'));var fs=require('fs');var fs_extra=require(_0x279c('0x8'));var _=require(_0x279c('0x9'));var squel=require(_0x279c('0xa'));var crypto=require('crypto');var jsforce=require(_0x279c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x279c('0x6'));var querystring=require(_0x279c('0xc'));var Papa=require(_0x279c('0xd'));var Redis=require(_0x279c('0xe'));var authService=require(_0x279c('0xf'));var qs=require(_0x279c('0x10'));var as=require(_0x279c('0x11'));var hardwareService=require(_0x279c('0x12'));var logger=require(_0x279c('0x13'))(_0x279c('0x14'));var utils=require(_0x279c('0x15'));var config=require(_0x279c('0x16'));var licenseUtil=require(_0x279c('0x17'));var db=require(_0x279c('0x18'))['db'];function respondWithStatusCode(_0x5d8b12,_0x202a99){_0x202a99=_0x202a99||0xcc;return function(_0x448af5){if(_0x448af5){return _0x5d8b12[_0x279c('0x19')](_0x202a99);}return _0x5d8b12[_0x279c('0x1a')](_0x202a99)['end']();};}function respondWithResult(_0x2db994,_0x31bfab){_0x31bfab=_0x31bfab||0xc8;return function(_0x4f8f50){if(_0x4f8f50){return _0x2db994[_0x279c('0x1a')](_0x31bfab)[_0x279c('0x1b')](_0x4f8f50);}};}function respondWithFilteredResult(_0x405b53,_0x501019){return function(_0x30c421){if(_0x30c421){var _0x262b0f=typeof _0x501019['offset']===_0x279c('0x1c')&&typeof _0x501019[_0x279c('0x1d')]===_0x279c('0x1c');var _0x2ac57d=_0x30c421['count'];var _0x364036=_0x262b0f?0x0:_0x501019['offset'];var _0x18969f=_0x262b0f?_0x30c421[_0x279c('0x1e')]:_0x501019[_0x279c('0x1f')]+_0x501019[_0x279c('0x1d')];var _0x3ce3cf;if(_0x18969f>=_0x2ac57d){_0x18969f=_0x2ac57d;_0x3ce3cf=0xc8;}else{_0x3ce3cf=0xce;}_0x405b53[_0x279c('0x1a')](_0x3ce3cf);return _0x405b53['set'](_0x279c('0x20'),_0x364036+'-'+_0x18969f+'/'+_0x2ac57d)[_0x279c('0x1b')](_0x30c421);}return null;};}function patchUpdates(_0x3746c3){return function(_0xb15642){try{jsonpatch[_0x279c('0x21')](_0xb15642,_0x3746c3,!![]);}catch(_0x5b122b){return BPromise[_0x279c('0x22')](_0x5b122b);}return _0xb15642[_0x279c('0x23')]();};}function saveUpdates(_0x35a6d2,_0x5114ae){return function(_0x1e0439){if(_0x1e0439){return _0x1e0439[_0x279c('0x24')](_0x35a6d2)[_0x279c('0x25')](function(_0x3b7851){return _0x3b7851;});}return null;};}function removeEntity(_0x489531,_0x44a8a3){return function(_0x44983f){if(_0x44983f){return _0x44983f['destroy']()[_0x279c('0x25')](function(){_0x489531[_0x279c('0x1a')](0xcc)[_0x279c('0x26')]();});}};}function handleEntityNotFound(_0x5dfc61,_0x380d66){return function(_0x29bfa7){if(!_0x29bfa7){_0x5dfc61[_0x279c('0x19')](0x194);}return _0x29bfa7;};}function handleError(_0x5c48e4,_0x4c2d49){_0x4c2d49=_0x4c2d49||0x1f4;return function(_0x3425ef){logger[_0x279c('0x27')](_0x3425ef['stack']);if(_0x3425ef[_0x279c('0x28')]){delete _0x3425ef['name'];}_0x5c48e4[_0x279c('0x1a')](_0x4c2d49)['send'](_0x3425ef);};}exports[_0x279c('0x29')]=function(_0x4566c2,_0x25d53a){var _0x416678={},_0x4102ac={},_0xdb05d4={'count':0x0,'rows':[]};var _0x3db3e3=_['map'](db[_0x279c('0x2a')][_0x279c('0x2b')],function(_0x231059){return{'name':_0x231059[_0x279c('0x2c')],'type':_0x231059['type'][_0x279c('0x2d')]};});_0x4102ac[_0x279c('0x2e')]=_[_0x279c('0x2f')](_0x3db3e3,_0x279c('0x28'));_0x4102ac[_0x279c('0x30')]=_[_0x279c('0x31')](_0x4566c2['query']);_0x4102ac['filters']=_['intersection'](_0x4102ac[_0x279c('0x2e')],_0x4102ac[_0x279c('0x30')]);_0x416678[_0x279c('0x32')]=_[_0x279c('0x33')](_0x4102ac['model'],qs['fields'](_0x4566c2[_0x279c('0x30')]['fields']));_0x416678[_0x279c('0x32')]=_0x416678[_0x279c('0x32')][_0x279c('0x34')]?_0x416678[_0x279c('0x32')]:_0x4102ac[_0x279c('0x2e')];if(!_0x4566c2[_0x279c('0x30')][_0x279c('0x35')](_0x279c('0x36'))){_0x416678[_0x279c('0x1d')]=qs['limit'](_0x4566c2[_0x279c('0x30')][_0x279c('0x1d')]);_0x416678[_0x279c('0x1f')]=qs[_0x279c('0x1f')](_0x4566c2['query']['offset']);}_0x416678[_0x279c('0x37')]=qs['sort'](_0x4566c2['query'][_0x279c('0x38')]);_0x416678['where']=qs[_0x279c('0x39')](_['pick'](_0x4566c2['query'],_0x4102ac['filters']),_0x3db3e3);if(_0x4566c2[_0x279c('0x30')][_0x279c('0x3a')]){_0x416678['where']=_[_0x279c('0x3b')](_0x416678[_0x279c('0x3c')],{'$or':_['map'](_0x3db3e3,function(_0x18126a){if(_0x18126a[_0x279c('0x3d')]!==_0x279c('0x3e')){var _0x5251dc={};_0x5251dc[_0x18126a[_0x279c('0x28')]]={'$like':'%'+_0x4566c2[_0x279c('0x30')][_0x279c('0x3a')]+'%'};return _0x5251dc;}})});}_0x416678=_['merge']({},_0x416678,_0x4566c2[_0x279c('0x3f')]);var _0x786a55={'where':_0x416678[_0x279c('0x3c')]};return db[_0x279c('0x2a')][_0x279c('0x1e')](_0x786a55)[_0x279c('0x25')](function(_0x5b5128){_0xdb05d4[_0x279c('0x1e')]=_0x5b5128;if(_0x4566c2['query'][_0x279c('0x40')]){_0x416678[_0x279c('0x41')]=[{'all':!![]}];}return db[_0x279c('0x2a')][_0x279c('0x42')](_0x416678);})['then'](function(_0x42ea52){_0xdb05d4[_0x279c('0x43')]=_0x42ea52;return _0xdb05d4;})[_0x279c('0x25')](respondWithFilteredResult(_0x25d53a,_0x416678))[_0x279c('0x44')](handleError(_0x25d53a,null));};exports[_0x279c('0x45')]=function(_0x378f25,_0x21c2f4){var _0x228e40={'raw':!![],'where':{'id':_0x378f25[_0x279c('0x46')]['id']}},_0x32c61b={};_0x32c61b['model']=_['keys'](db[_0x279c('0x2a')][_0x279c('0x2b')]);_0x32c61b[_0x279c('0x30')]=_['keys'](_0x378f25[_0x279c('0x30')]);_0x32c61b[_0x279c('0x39')]=_['intersection'](_0x32c61b['model'],_0x32c61b[_0x279c('0x30')]);_0x228e40['attributes']=_[_0x279c('0x33')](_0x32c61b[_0x279c('0x2e')],qs[_0x279c('0x47')](_0x378f25['query']['fields']));_0x228e40[_0x279c('0x32')]=_0x228e40[_0x279c('0x32')][_0x279c('0x34')]?_0x228e40['attributes']:_0x32c61b[_0x279c('0x2e')];if(_0x378f25[_0x279c('0x30')][_0x279c('0x40')]){_0x228e40[_0x279c('0x41')]=[{'all':!![]}];}_0x228e40=_[_0x279c('0x3b')]({},_0x228e40,_0x378f25[_0x279c('0x3f')]);return db[_0x279c('0x2a')][_0x279c('0x48')](_0x228e40)[_0x279c('0x25')](handleEntityNotFound(_0x21c2f4,null))[_0x279c('0x25')](respondWithResult(_0x21c2f4,null))[_0x279c('0x44')](handleError(_0x21c2f4,null));};exports['create']=function(_0x5a819b,_0x101fc7){return db[_0x279c('0x2a')][_0x279c('0x49')](_0x5a819b[_0x279c('0x4a')],{})['then'](respondWithResult(_0x101fc7,0xc9))[_0x279c('0x44')](handleError(_0x101fc7,null));};exports[_0x279c('0x24')]=function(_0x565fe8,_0x198fd7){if(_0x565fe8[_0x279c('0x4a')]['id']){delete _0x565fe8[_0x279c('0x4a')]['id'];}return db[_0x279c('0x2a')][_0x279c('0x48')]({'where':{'id':_0x565fe8[_0x279c('0x46')]['id']}})[_0x279c('0x25')](handleEntityNotFound(_0x198fd7,null))[_0x279c('0x25')](saveUpdates(_0x565fe8[_0x279c('0x4a')],null))[_0x279c('0x25')](respondWithResult(_0x198fd7,null))[_0x279c('0x44')](handleError(_0x198fd7,null));};exports['destroy']=function(_0x22cb5b,_0x112f02){return db[_0x279c('0x2a')][_0x279c('0x48')]({'where':{'id':_0x22cb5b[_0x279c('0x46')]['id']}})[_0x279c('0x25')](handleEntityNotFound(_0x112f02,null))['then'](removeEntity(_0x112f02,null))[_0x279c('0x44')](handleError(_0x112f02,null));};exports[_0x279c('0x4b')]=function(_0x324166,_0x4e94f3){return db['ChatTransferReport']['describe']()[_0x279c('0x25')](respondWithResult(_0x4e94f3,null))[_0x279c('0x44')](handleError(_0x4e94f3,null));}; \ No newline at end of file +var _0x5671=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5671,0x1e9));var _0x1567=function(_0x173fdf,_0x1ba573){_0x173fdf=_0x173fdf-0x0;var _0x147b6d=_0x5671[_0x173fdf];return _0x147b6d;};'use strict';var emlformat=require(_0x1567('0x0'));var rimraf=require(_0x1567('0x1'));var zipdir=require(_0x1567('0x2'));var jsonpatch=require(_0x1567('0x3'));var rp=require(_0x1567('0x4'));var moment=require('moment');var BPromise=require(_0x1567('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1567('0x6'));var sox=require(_0x1567('0x7'));var csv=require(_0x1567('0x8'));var ejs=require(_0x1567('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1567('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1567('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1567('0xc'));var Papa=require(_0x1567('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1567('0xe'));var as=require(_0x1567('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1567('0x10'))(_0x1567('0x11'));var utils=require(_0x1567('0x12'));var config=require(_0x1567('0x13'));var licenseUtil=require(_0x1567('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e307,_0xa6684c){_0xa6684c=_0xa6684c||0xcc;return function(_0x31240b){if(_0x31240b){return _0x23e307[_0x1567('0x15')](_0xa6684c);}return _0x23e307[_0x1567('0x16')](_0xa6684c)[_0x1567('0x17')]();};}function respondWithResult(_0x11bfc5,_0x4ab213){_0x4ab213=_0x4ab213||0xc8;return function(_0x25edca){if(_0x25edca){return _0x11bfc5[_0x1567('0x16')](_0x4ab213)[_0x1567('0x18')](_0x25edca);}};}function respondWithFilteredResult(_0x3aa3bd,_0x487c16){return function(_0x11dd27){if(_0x11dd27){var _0x32d1eb=typeof _0x487c16['offset']==='undefined'&&typeof _0x487c16[_0x1567('0x19')]===_0x1567('0x1a');var _0x32b736=_0x11dd27[_0x1567('0x1b')];var _0x289635=_0x32d1eb?0x0:_0x487c16['offset'];var _0xdc6650=_0x32d1eb?_0x11dd27[_0x1567('0x1b')]:_0x487c16[_0x1567('0x1c')]+_0x487c16['limit'];var _0x1fad4d;if(_0xdc6650>=_0x32b736){_0xdc6650=_0x32b736;_0x1fad4d=0xc8;}else{_0x1fad4d=0xce;}_0x3aa3bd[_0x1567('0x16')](_0x1fad4d);return _0x3aa3bd['set'](_0x1567('0x1d'),_0x289635+'-'+_0xdc6650+'/'+_0x32b736)[_0x1567('0x18')](_0x11dd27);}return null;};}function patchUpdates(_0x5075c1){return function(_0x3afd0f){try{jsonpatch[_0x1567('0x1e')](_0x3afd0f,_0x5075c1,!![]);}catch(_0x237a11){return BPromise[_0x1567('0x1f')](_0x237a11);}return _0x3afd0f['save']();};}function saveUpdates(_0x1f023e,_0x58ba7a){return function(_0x559747){if(_0x559747){return _0x559747[_0x1567('0x20')](_0x1f023e)[_0x1567('0x21')](function(_0x47f31d){return _0x47f31d;});}return null;};}function removeEntity(_0x1d2547,_0x5303a1){return function(_0x5af48b){if(_0x5af48b){return _0x5af48b[_0x1567('0x22')]()['then'](function(){_0x1d2547[_0x1567('0x16')](0xcc)[_0x1567('0x17')]();});}};}function handleEntityNotFound(_0x4f73c4,_0x3fd0e8){return function(_0x33a6a9){if(!_0x33a6a9){_0x4f73c4[_0x1567('0x15')](0x194);}return _0x33a6a9;};}function handleError(_0x361bd3,_0x1d3463){_0x1d3463=_0x1d3463||0x1f4;return function(_0x340ee9){logger[_0x1567('0x23')](_0x340ee9['stack']);if(_0x340ee9['name']){delete _0x340ee9[_0x1567('0x24')];}_0x361bd3[_0x1567('0x16')](_0x1d3463)[_0x1567('0x25')](_0x340ee9);};}exports['index']=function(_0x353890,_0x1d2e8e){var _0x260af2={},_0x172e35={},_0x31447c={'count':0x0,'rows':[]};var _0x4d4edd=_[_0x1567('0x26')](db[_0x1567('0x27')][_0x1567('0x28')],function(_0x22fa07){return{'name':_0x22fa07[_0x1567('0x29')],'type':_0x22fa07[_0x1567('0x2a')][_0x1567('0x2b')]};});_0x172e35[_0x1567('0x2c')]=_['map'](_0x4d4edd,_0x1567('0x24'));_0x172e35[_0x1567('0x2d')]=_[_0x1567('0x2e')](_0x353890['query']);_0x172e35['filters']=_['intersection'](_0x172e35[_0x1567('0x2c')],_0x172e35['query']);_0x260af2[_0x1567('0x2f')]=_['intersection'](_0x172e35[_0x1567('0x2c')],qs[_0x1567('0x30')](_0x353890[_0x1567('0x2d')][_0x1567('0x30')]));_0x260af2[_0x1567('0x2f')]=_0x260af2[_0x1567('0x2f')]['length']?_0x260af2[_0x1567('0x2f')]:_0x172e35[_0x1567('0x2c')];if(!_0x353890[_0x1567('0x2d')][_0x1567('0x31')](_0x1567('0x32'))){_0x260af2[_0x1567('0x19')]=qs[_0x1567('0x19')](_0x353890[_0x1567('0x2d')][_0x1567('0x19')]);_0x260af2[_0x1567('0x1c')]=qs['offset'](_0x353890['query'][_0x1567('0x1c')]);}_0x260af2[_0x1567('0x33')]=qs[_0x1567('0x34')](_0x353890[_0x1567('0x2d')]['sort']);_0x260af2[_0x1567('0x35')]=qs['filters'](_[_0x1567('0x36')](_0x353890[_0x1567('0x2d')],_0x172e35[_0x1567('0x37')]),_0x4d4edd);if(_0x353890[_0x1567('0x2d')][_0x1567('0x38')]){_0x260af2[_0x1567('0x35')]=_[_0x1567('0x39')](_0x260af2[_0x1567('0x35')],{'$or':_[_0x1567('0x26')](_0x4d4edd,function(_0x1321de){if(_0x1321de[_0x1567('0x2a')]!==_0x1567('0x3a')){var _0x4a6bc7={};_0x4a6bc7[_0x1321de[_0x1567('0x24')]]={'$like':'%'+_0x353890['query'][_0x1567('0x38')]+'%'};return _0x4a6bc7;}})});}_0x260af2=_[_0x1567('0x39')]({},_0x260af2,_0x353890[_0x1567('0x3b')]);var _0x2ff3aa={'where':_0x260af2['where']};return db[_0x1567('0x27')][_0x1567('0x1b')](_0x2ff3aa)[_0x1567('0x21')](function(_0x54390f){_0x31447c[_0x1567('0x1b')]=_0x54390f;if(_0x353890[_0x1567('0x2d')][_0x1567('0x3c')]){_0x260af2[_0x1567('0x3d')]=[{'all':!![]}];}return db[_0x1567('0x27')]['findAll'](_0x260af2);})['then'](function(_0x48479d){_0x31447c[_0x1567('0x3e')]=_0x48479d;return _0x31447c;})[_0x1567('0x21')](respondWithFilteredResult(_0x1d2e8e,_0x260af2))[_0x1567('0x3f')](handleError(_0x1d2e8e,null));};exports[_0x1567('0x40')]=function(_0x22f242,_0x3cc408){var _0x3e90b0={'raw':!![],'where':{'id':_0x22f242[_0x1567('0x41')]['id']}},_0x131104={};_0x131104[_0x1567('0x2c')]=_[_0x1567('0x2e')](db['ChatTransferReport'][_0x1567('0x28')]);_0x131104['query']=_[_0x1567('0x2e')](_0x22f242['query']);_0x131104[_0x1567('0x37')]=_[_0x1567('0x42')](_0x131104[_0x1567('0x2c')],_0x131104[_0x1567('0x2d')]);_0x3e90b0['attributes']=_[_0x1567('0x42')](_0x131104['model'],qs['fields'](_0x22f242['query'][_0x1567('0x30')]));_0x3e90b0[_0x1567('0x2f')]=_0x3e90b0[_0x1567('0x2f')][_0x1567('0x43')]?_0x3e90b0['attributes']:_0x131104[_0x1567('0x2c')];if(_0x22f242[_0x1567('0x2d')]['includeAll']){_0x3e90b0[_0x1567('0x3d')]=[{'all':!![]}];}_0x3e90b0=_[_0x1567('0x39')]({},_0x3e90b0,_0x22f242['options']);return db[_0x1567('0x27')]['find'](_0x3e90b0)[_0x1567('0x21')](handleEntityNotFound(_0x3cc408,null))[_0x1567('0x21')](respondWithResult(_0x3cc408,null))[_0x1567('0x3f')](handleError(_0x3cc408,null));};exports[_0x1567('0x44')]=function(_0x1735c9,_0x476ae6){return db['ChatTransferReport'][_0x1567('0x44')](_0x1735c9[_0x1567('0x45')],{})[_0x1567('0x21')](respondWithResult(_0x476ae6,0xc9))[_0x1567('0x3f')](handleError(_0x476ae6,null));};exports['update']=function(_0x3856a9,_0x34fed2){if(_0x3856a9['body']['id']){delete _0x3856a9[_0x1567('0x45')]['id'];}return db['ChatTransferReport'][_0x1567('0x46')]({'where':{'id':_0x3856a9['params']['id']}})['then'](handleEntityNotFound(_0x34fed2,null))[_0x1567('0x21')](saveUpdates(_0x3856a9[_0x1567('0x45')],null))[_0x1567('0x21')](respondWithResult(_0x34fed2,null))[_0x1567('0x3f')](handleError(_0x34fed2,null));};exports['destroy']=function(_0x51469f,_0x3d5363){return db['ChatTransferReport']['find']({'where':{'id':_0x51469f['params']['id']}})[_0x1567('0x21')](handleEntityNotFound(_0x3d5363,null))[_0x1567('0x21')](removeEntity(_0x3d5363,null))[_0x1567('0x3f')](handleError(_0x3d5363,null));};exports[_0x1567('0x47')]=function(_0x15407a,_0x4daa8e){return db['ChatTransferReport'][_0x1567('0x47')]()[_0x1567('0x21')](respondWithResult(_0x4daa8e,null))['catch'](handleError(_0x4daa8e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4c3af37..f3aaa8c 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 _0x700a=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x700a,0xdf));var _0xa700=function(_0x2ad7b0,_0x165429){_0x2ad7b0=_0x2ad7b0-0x0;var _0x272a24=_0x700a[_0x2ad7b0];return _0x272a24;};'use strict';var _=require(_0xa700('0x0'));var util=require(_0xa700('0x1'));var logger=require(_0xa700('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa700('0x3'));var rp=require(_0xa700('0x4'));var fs=require('fs');var path=require(_0xa700('0x5'));var rimraf=require(_0xa700('0x6'));var config=require('../../config/environment');var attributes=require(_0xa700('0x7'));module['exports']=function(_0x20e16e,_0x300c3e){return _0x20e16e['define'](_0xa700('0x8'),attributes,{'tableName':_0xa700('0x9'),'paranoid':![],'indexes':[{'name':_0xa700('0xa'),'fields':[_0xa700('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40f7=['define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0x40f7,0x121));var _0x740f=function(_0x3cb939,_0x24c013){_0x3cb939=_0x3cb939-0x0;var _0x2b511d=_0x40f7[_0x3cb939];return _0x2b511d;};'use strict';var _=require(_0x740f('0x0'));var util=require(_0x740f('0x1'));var logger=require(_0x740f('0x2'))(_0x740f('0x3'));var moment=require(_0x740f('0x4'));var BPromise=require(_0x740f('0x5'));var rp=require(_0x740f('0x6'));var fs=require('fs');var path=require(_0x740f('0x7'));var rimraf=require('rimraf');var config=require(_0x740f('0x8'));var attributes=require(_0x740f('0x9'));module['exports']=function(_0x2ecffb,_0x137627){return _0x2ecffb[_0x740f('0xa')](_0x740f('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x740f('0xc'),'fields':[_0x740f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6e902cb..87671a5 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 _0xaa9d=['then','info','ChatTransferReport,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request'];(function(_0x771915,_0x1df90c){var _0x134e75=function(_0x19d95a){while(--_0x19d95a){_0x771915['push'](_0x771915['shift']());}};_0x134e75(++_0x1df90c);}(_0xaa9d,0x6f));var _0xdaa9=function(_0x36dc7a,_0x2659cb){_0x36dc7a=_0x36dc7a-0x0;var _0x159291=_0xaa9d[_0x36dc7a];return _0x159291;};'use strict';var _=require('lodash');var util=require(_0xdaa9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdaa9('0x1'));var fs=require('fs');var Redis=require(_0xdaa9('0x2'));var db=require(_0xdaa9('0x3'))['db'];var utils=require(_0xdaa9('0x4'));var logger=require(_0xdaa9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdaa9('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x329856,_0xa4a74c,_0x44b90d){return new BPromise(function(_0x5ab2d2,_0x5d1b46){return client[_0xdaa9('0x7')](_0x329856,_0x44b90d)[_0xdaa9('0x8')](function(_0x210495){logger[_0xdaa9('0x9')](_0xdaa9('0xa'),_0xa4a74c,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xa4a74c,'request\x20sent',JSON[_0xdaa9('0xb')](_0x210495));if(_0x210495[_0xdaa9('0xc')]){if(_0x210495[_0xdaa9('0xc')][_0xdaa9('0xd')]===0x1f4){logger['error'](_0xdaa9('0xa'),_0xa4a74c,_0x210495[_0xdaa9('0xc')][_0xdaa9('0xe')]);return _0x5d1b46(_0x210495[_0xdaa9('0xc')][_0xdaa9('0xe')]);}logger[_0xdaa9('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0xa4a74c,_0x210495[_0xdaa9('0xc')][_0xdaa9('0xe')]);return _0x5ab2d2(_0x210495[_0xdaa9('0xc')][_0xdaa9('0xe')]);}else{logger[_0xdaa9('0x9')](_0xdaa9('0xa'),_0xa4a74c,'request\x20sent');_0x5ab2d2(_0x210495[_0xdaa9('0xf')][_0xdaa9('0xe')]);}})[_0xdaa9('0x10')](function(_0xd52ae0){logger[_0xdaa9('0xc')](_0xdaa9('0xa'),_0xa4a74c,_0xd52ae0);_0x5d1b46(_0xd52ae0);});});} \ No newline at end of file +var _0xf507=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s','message'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0xf507,0x7f));var _0x7f50=function(_0x55f8fa,_0x616528){_0x55f8fa=_0x55f8fa-0x0;var _0x20a9a9=_0xf507[_0x55f8fa];return _0x20a9a9;};'use strict';var _=require(_0x7f50('0x0'));var util=require('util');var moment=require(_0x7f50('0x1'));var BPromise=require(_0x7f50('0x2'));var rs=require(_0x7f50('0x3'));var fs=require('fs');var Redis=require(_0x7f50('0x4'));var db=require(_0x7f50('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f50('0x6'));var config=require(_0x7f50('0x7'));var jayson=require(_0x7f50('0x8'));var client=jayson['client'][_0x7f50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x536d40,_0x3cb83a,_0x5e603c){return new BPromise(function(_0x217d5a,_0x24a8e4){return client[_0x7f50('0xa')](_0x536d40,_0x5e603c)[_0x7f50('0xb')](function(_0x576682){logger[_0x7f50('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x3cb83a,_0x7f50('0xd'));logger[_0x7f50('0xe')](_0x7f50('0xf'),_0x3cb83a,'request\x20sent',JSON['stringify'](_0x576682));if(_0x576682['error']){if(_0x576682[_0x7f50('0x10')][_0x7f50('0x11')]===0x1f4){logger[_0x7f50('0x10')](_0x7f50('0x12'),_0x3cb83a,_0x576682[_0x7f50('0x10')][_0x7f50('0x13')]);return _0x24a8e4(_0x576682[_0x7f50('0x10')][_0x7f50('0x13')]);}logger['error'](_0x7f50('0x12'),_0x3cb83a,_0x576682[_0x7f50('0x10')][_0x7f50('0x13')]);return _0x217d5a(_0x576682[_0x7f50('0x10')][_0x7f50('0x13')]);}else{logger[_0x7f50('0xc')](_0x7f50('0x12'),_0x3cb83a,'request\x20sent');_0x217d5a(_0x576682['result']['message']);}})[_0x7f50('0x14')](function(_0xf7e00d){logger[_0x7f50('0x10')](_0x7f50('0x12'),_0x3cb83a,_0xf7e00d);_0x24a8e4(_0xf7e00d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9520261..3f48e3b 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 _0xf059=['get','isAuthenticated','index','/describe','post','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller'];(function(_0x57914c,_0x33fe3a){var _0x56c95d=function(_0x3df7b8){while(--_0x3df7b8){_0x57914c['push'](_0x57914c['shift']());}};_0x56c95d(++_0x33fe3a);}(_0xf059,0x1e5));var _0x9f05=function(_0x1bffa5,_0x5abc96){_0x1bffa5=_0x1bffa5-0x0;var _0x5baffe=_0xf059[_0x1bffa5];return _0x5baffe;};'use strict';var multer=require(_0x9f05('0x0'));var util=require(_0x9f05('0x1'));var path=require(_0x9f05('0x2'));var timeout=require(_0x9f05('0x3'));var express=require('express');var router=express[_0x9f05('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f05('0x6'));var controller=require(_0x9f05('0x7'));router[_0x9f05('0x8')]('/',auth[_0x9f05('0x9')](),controller[_0x9f05('0xa')]);router[_0x9f05('0x8')](_0x9f05('0xb'),auth[_0x9f05('0x9')](),controller['describe']);router[_0x9f05('0x8')]('/:id',auth[_0x9f05('0x9')](),controller['show']);router[_0x9f05('0xc')]('/',auth[_0x9f05('0x9')](),controller['create']);router[_0x9f05('0xd')](_0x9f05('0xe'),auth[_0x9f05('0x9')](),controller['update']);router[_0x9f05('0xf')]('/:id',auth[_0x9f05('0x9')](),controller['destroy']);module[_0x9f05('0x10')]=router; \ No newline at end of file +var _0x2d6d=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','exports'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x2d6d,0x17a));var _0xd2d6=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2d6d[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0xd2d6('0x0'));var util=require('util');var path=require(_0xd2d6('0x1'));var timeout=require(_0xd2d6('0x2'));var express=require('express');var router=express[_0xd2d6('0x3')]();var fs_extra=require(_0xd2d6('0x4'));var auth=require(_0xd2d6('0x5'));var interaction=require(_0xd2d6('0x6'));var config=require(_0xd2d6('0x7'));var controller=require(_0xd2d6('0x8'));router[_0xd2d6('0x9')]('/',auth[_0xd2d6('0xa')](),controller[_0xd2d6('0xb')]);router['get'](_0xd2d6('0xc'),auth[_0xd2d6('0xa')](),controller[_0xd2d6('0xd')]);router[_0xd2d6('0x9')]('/:id',auth[_0xd2d6('0xa')](),controller['show']);router[_0xd2d6('0xe')]('/',auth[_0xd2d6('0xa')](),controller['create']);router[_0xd2d6('0xf')](_0xd2d6('0x10'),auth[_0xd2d6('0xa')](),controller[_0xd2d6('0x11')]);router[_0xd2d6('0x12')](_0xd2d6('0x10'),auth[_0xd2d6('0xa')](),controller[_0xd2d6('0x13')]);module[_0xd2d6('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5ba6438..4472ae2 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 _0x5546=['parse','getDataValue','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','INTEGER','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','input','name','text','onlineForm'];(function(_0x46bd68,_0x4f0678){var _0x2d2c9a=function(_0x3d59b5){while(--_0x3d59b5){_0x46bd68['push'](_0x46bd68['shift']());}};_0x2d2c9a(++_0x4f0678);}(_0x5546,0x16b));var _0x6554=function(_0x5125e0,_0x39b3ba){_0x5125e0=_0x5125e0-0x0;var _0x58ed50=_0x5546[_0x5125e0];return _0x58ed50;};'use strict';var Sequelize=require(_0x6554('0x0'));var rs=require(_0x6554('0x1'));module[_0x6554('0x2')]={'name':{'type':Sequelize[_0x6554('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6554('0x3')],'allowNull':![],'unique':_0x6554('0x4')},'description':{'type':Sequelize[_0x6554('0x3')]},'mapKey':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x6554('0x5')},'key':{'type':Sequelize[_0x6554('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6554('0x6')},'customerAlias':{'type':Sequelize[_0x6554('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6554('0x3')],'allowNull':![],'defaultValue':_0x6554('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6554('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6554('0x3')],'allowNull':![],'defaultValue':_0x6554('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6554('0x3')]},'animation':{'type':Sequelize[_0x6554('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6554('0xa')](_0x6554('0xb'),_0x6554('0xc')),'defaultValue':_0x6554('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6554('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6554('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6554('0xf')},'header_offline':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x10')},'download_transcript':{'type':Sequelize[_0x6554('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6554('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x6554('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x6554('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6554('0x12')},'closingMessageButton':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0xf')},'skipMessageButton':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x14')},'ratingType':{'type':Sequelize['ENUM'](_0x6554('0x15'),_0x6554('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6554('0x17')],'defaultValue':function(){return JSON[_0x6554('0x18')]({'items':[{'type':_0x6554('0x19'),'variable':null,'config':{'placeholder':_0x6554('0x1a'),'type':_0x6554('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6554('0x19'),'props':{'title':_0x6554('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6554('0x1c'))?JSON[_0x6554('0x1d')](this[_0x6554('0x1e')](_0x6554('0x1c'))):{};},'set':function(_0x1ee31f){return this[_0x6554('0x1f')](_0x6554('0x1c'),JSON[_0x6554('0x18')](_0x1ee31f));}},'offlineForm':{'type':Sequelize[_0x6554('0x17')],'defaultValue':function(){return JSON[_0x6554('0x18')]({'items':[{'type':_0x6554('0x19'),'props':{'title':_0x6554('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6554('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0x6554('0x20')},'props':{'title':_0x6554('0x20'),'helpText':_0x6554('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x6554('0x1e')](_0x6554('0x22'))?JSON[_0x6554('0x1d')](this[_0x6554('0x1e')](_0x6554('0x22'))):{};},'set':function(_0x21228e){return this['setDataValue'](_0x6554('0x22'),JSON[_0x6554('0x18')](_0x21228e));}},'token':{'type':Sequelize[_0x6554('0x3')],'defaultValue':function(){return rs[_0x6554('0x23')]();}},'autoclose':{'type':Sequelize[_0x6554('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6554('0x3')]},'forwardOffline':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6554('0x3')]},'waitingTitle':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x24')},'waitingMessage':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x26')},'offlineMessageBody':{'type':Sequelize[_0x6554('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x6554('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6554('0x13')},'sendUnmanaged':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6554('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6554('0x28');}},'notificationSound':{'type':Sequelize[_0x6554('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6554('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6554('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6554('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x6554('0x2a')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x2b')},'messagesAlignment':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x2c')},'defaultTitle':{'type':Sequelize[_0x6554('0x3')]},'customerAvatar':{'type':Sequelize[_0x6554('0x17')]},'showCustomerAvatar':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6554('0x2a')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6554('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6554('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6554('0x2a')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6554('0x3')],'defaultValue':_0x6554('0x2d')},'systemAvatar':{'type':Sequelize[_0x6554('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6554('0x2a')],'comment':_0x6554('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x6554('0x9')],'defaultValue':![],'comment':_0x6554('0x2f'),'set':function(_0x5e1cf8){if(!_0x5e1cf8)this[_0x6554('0x1f')](_0x6554('0x30'),null);this['setDataValue']('mandatoryDisposition',_0x5e1cf8);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x6554('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6554('0x17')]}}; \ No newline at end of file +var _0x39d6=['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:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','System','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','ENUM','thumb','star','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue'];(function(_0x114cc1,_0x3b8c8a){var _0x188a14=function(_0xab7d5b){while(--_0xab7d5b){_0x114cc1['push'](_0x114cc1['shift']());}};_0x188a14(++_0x3b8c8a);}(_0x39d6,0x1be));var _0x639d=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0x39d6[_0x3f0d76];return _0x12c12e;};'use strict';var Sequelize=require(_0x639d('0x0'));var rs=require(_0x639d('0x1'));module[_0x639d('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x639d('0x3')],'allowNull':![],'unique':_0x639d('0x4')},'description':{'type':Sequelize[_0x639d('0x3')]},'mapKey':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x5')},'mapKeyOffline':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x5')},'key':{'type':Sequelize[_0x639d('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x6')},'customerAlias':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x639d('0x3')],'allowNull':![],'defaultValue':_0x639d('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x639d('0x3')],'allowNull':![],'defaultValue':_0x639d('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x639d('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x639d('0x3')],'allowNull':![],'defaultValue':_0x639d('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x639d('0x3')]},'animation':{'type':Sequelize[_0x639d('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x639d('0xa'),_0x639d('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0xc')},'header_offline':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0xd')},'download_transcript':{'type':Sequelize[_0x639d('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x639d('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x639d('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x639d('0x10')]},'closingQuestion':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x639d('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x13')},'noteTitle':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x639d('0x15')},'closingMessage':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x639d('0xc')},'skipMessageButton':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x639d('0x17')]('star',_0x639d('0x18')),'defaultValue':_0x639d('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x639d('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x639d('0x1a')]({'items':[{'type':_0x639d('0x1b'),'variable':null,'config':{'placeholder':_0x639d('0x1c'),'type':_0x639d('0x1d'),'required':!![]},'props':{'title':_0x639d('0x1c'),'helpText':''}},{'type':_0x639d('0x1b'),'props':{'title':_0x639d('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x639d('0x5'),'type':_0x639d('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x639d('0x1e'))?JSON[_0x639d('0x1f')](this[_0x639d('0x20')](_0x639d('0x1e'))):{};},'set':function(_0x2398ad){return this[_0x639d('0x21')]('onlineForm',JSON[_0x639d('0x1a')](_0x2398ad));}},'offlineForm':{'type':Sequelize[_0x639d('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x639d('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x639d('0x5')},'variable':null},{'type':_0x639d('0x22'),'config':{'placeholder':'Comments'},'props':{'title':_0x639d('0x23'),'helpText':_0x639d('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x639d('0x20')](_0x639d('0x25'))?JSON[_0x639d('0x1f')](this['getDataValue'](_0x639d('0x25'))):{};},'set':function(_0x2b5738){return this[_0x639d('0x21')](_0x639d('0x25'),JSON[_0x639d('0x1a')](_0x2b5738));}},'token':{'type':Sequelize[_0x639d('0x3')],'defaultValue':function(){return rs[_0x639d('0x26')]();}},'autoclose':{'type':Sequelize[_0x639d('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x639d('0x3')]},'forwardOffline':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x639d('0x3')]},'waitingTitle':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x27')},'waitingMessage':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x639d('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x639d('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x639d('0x2a')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x639d('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x639d('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x639d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x639d('0x10')],'defaultValue':function(){return _0x639d('0x2b');}},'notificationSound':{'type':Sequelize[_0x639d('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x639d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x639d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x639d('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x639d('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x2d')},'defaultTitle':{'type':Sequelize[_0x639d('0x3')]},'customerAvatar':{'type':Sequelize[_0x639d('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x639d('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x639d('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x639d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x639d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x639d('0x3')],'defaultValue':_0x639d('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x639d('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x451b25){if(!_0x451b25)this[_0x639d('0x21')](_0x639d('0x2f'),null);this[_0x639d('0x21')]('mandatoryDisposition',_0x451b25);}},'vidaooEscalation':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x639d('0x3')]},'vidaooTopic':{'type':Sequelize[_0x639d('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x639d('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x639d('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x639d('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x639d('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2d995f7..dda6efc 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 _0x930d=['message','info','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','name','send','Command','getSnippet','timezone','format','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','map','Interval','Intervals','some','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','unknown','version','device','model','%s\x20%s\x20%s','vendor','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','describe','addDisposition','keys','Disposition','nolimit','order','ChatWebsiteId','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','findAll','removeAnswers','sitepic','file','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','../../config/license/util','custom','join','root','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','Sequelize','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','List','Contacts','DESC','ChatApplication','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','orderBy','priority','asc','Applications','contact','headers','threadId','externalUrl','ChatInteraction','ContactId','interaction','messageId','created','applications','push','close','unmanaged','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','EventManager','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','defaults','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailAccount','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','filename','remove','addInteraction','omit','ids','getInteractions','findOne','Contact','Owner','fullname','internal','Tag','Tags','tag','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','color','textButtonColor','color_button','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','findAndCountAll','stack','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','lodash','querystring','html-to-text','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x930d,0x11a));var _0xd930=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0x930d[_0x5aa373];return _0x590e8e;};'use strict';var Mustache=require(_0xd930('0x0'));var util=require(_0xd930('0x1'));var path=require('path');var ejs=require(_0xd930('0x2'));var fs=require('fs');var fs_extra=require(_0xd930('0x3'));var _=require(_0xd930('0x4'));var querystring=require(_0xd930('0x5'));var htmlToText=require(_0xd930('0x6'));var Redis=require('ioredis');var jayson=require('jayson/promise');var url=require(_0xd930('0x7'));var qs=require(_0xd930('0x8'));var logger=require(_0xd930('0x9'))(_0xd930('0xa'));var config=require(_0xd930('0xb'));var APIOutOfIntervalError=require(_0xd930('0xc'))['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')[_0xd930('0xd')];var APIHandleError=require(_0xd930('0xc'))['handleError'];var db=require('../../mysqldb')['db'];config[_0xd930('0xe')]=_['defaults'](config[_0xd930('0xe')],{'host':_0xd930('0xf'),'port':0x18eb});var socket=require(_0xd930('0x10'))(new Redis(config[_0xd930('0xe')]));require(_0xd930('0x11'))[_0xd930('0x12')](socket);var client=jayson[_0xd930('0x13')][_0xd930('0x14')]({'port':0x232c});var client9002=jayson[_0xd930('0x13')]['http']({'port':0x232a});var client9003=jayson['client'][_0xd930('0x14')]({'port':0x232b});var client9001=jayson[_0xd930('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x507eb0,_0x5052d1,_0x3eb0e7,_0x15bb09){return new Promise(function(_0x50f277,_0x40e706){var _0x231f00=_0x15bb09||client;return _0x231f00[_0xd930('0x15')](_0x507eb0,_0x3eb0e7)[_0xd930('0x16')](function(_0x4c40e4){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5052d1,_0xd930('0x17'));logger['debug'](_0xd930('0x18'),_0x5052d1,'request\x20sent',JSON[_0xd930('0x19')](_0x4c40e4));if(_0x4c40e4[_0xd930('0x1a')]){if(_0x4c40e4[_0xd930('0x1a')][_0xd930('0x1b')]===0x1f4){logger[_0xd930('0x1a')](_0xd930('0x1c'),_0x5052d1,_0x4c40e4[_0xd930('0x1a')][_0xd930('0x1d')]);return _0x40e706(_0x4c40e4['error'][_0xd930('0x1d')]);}logger['error'](_0xd930('0x1c'),_0x5052d1,_0x4c40e4[_0xd930('0x1a')][_0xd930('0x1d')]);return _0x50f277(_0x4c40e4[_0xd930('0x1a')][_0xd930('0x1d')]);}else{logger[_0xd930('0x1e')](_0xd930('0x1c'),_0x5052d1,_0xd930('0x17'));_0x50f277(_0x4c40e4['result'][_0xd930('0x1d')]);}})['catch'](function(_0x49c55b){logger['error'](_0xd930('0x1c'),_0x5052d1,_0x49c55b);_0x40e706(_0x49c55b);});});}function respondWithStatusCode(_0x542a0b,_0x9af07c){_0x9af07c=_0x9af07c||0xcc;return function(_0x5ca8b0){if(_0x5ca8b0){return _0x542a0b[_0xd930('0x1f')](_0x9af07c);}return _0x542a0b[_0xd930('0x20')](_0x9af07c)[_0xd930('0x21')]();};}function respondWithResult(_0x4c7a2d,_0x44c008){_0x44c008=_0x44c008||0xc8;return function(_0x5565d7){if(_0x5565d7){return _0x4c7a2d[_0xd930('0x20')](_0x44c008)[_0xd930('0x22')](_0x5565d7);}};}function respondWithFilteredResult(_0x1c4802,_0x18f771){return function(_0x223545){if(_0x223545){var _0x1469a2=typeof _0x18f771['offset']==='undefined'&&typeof _0x18f771[_0xd930('0x23')]==='undefined';var _0x55c062=_0x223545[_0xd930('0x24')];var _0x14d6b8=_0x1469a2?0x0:_0x18f771[_0xd930('0x25')];var _0x3ad5b5=_0x1469a2?_0x223545[_0xd930('0x24')]:_0x18f771[_0xd930('0x25')]+_0x18f771['limit'];var _0x429aee;if(_0x3ad5b5>=_0x55c062){_0x3ad5b5=_0x55c062;_0x429aee=0xc8;}else{_0x429aee=0xce;}_0x1c4802[_0xd930('0x20')](_0x429aee);return _0x1c4802[_0xd930('0x26')](_0xd930('0x27'),_0x14d6b8+'-'+_0x3ad5b5+'/'+_0x55c062)[_0xd930('0x22')](_0x223545);}return null;};}function saveUpdates(_0x260c61){return function(_0x4b147f){if(_0x4b147f){return _0x4b147f[_0xd930('0x28')](_0x260c61)[_0xd930('0x16')](function(_0x248830){return _0x248830;});}return null;};}function removeEntity(_0x4c4b26){return function(_0x295fdd){if(_0x295fdd){return _0x295fdd[_0xd930('0x29')]()[_0xd930('0x16')](function(){var _0x2937e5=_0x295fdd[_0xd930('0x2a')]({'plain':!![]});var _0x4919c5=_0xd930('0x2b');return db[_0xd930('0x2c')][_0xd930('0x29')]({'where':{'type':_0x4919c5,'resourceId':_0x2937e5['id']}})[_0xd930('0x16')](function(){return _0x295fdd;});})['then'](function(){_0x4c4b26['status'](0xcc)[_0xd930('0x21')]();});}};}function handleEntityNotFound(_0xfd4fe6){return function(_0x3f6c92){if(!_0x3f6c92){_0xfd4fe6['sendStatus'](0x194);}return _0x3f6c92;};}function handleError(_0x58308a,_0x1767df){_0x1767df=_0x1767df||0x1f4;return function(_0x20977c){logger[_0xd930('0x1a')](_0x20977c['stack']);if(_0x20977c['name']){delete _0x20977c[_0xd930('0x2d')];}_0x58308a[_0xd930('0x20')](_0x1767df)[_0xd930('0x2e')](_0x20977c);};}function iftimePromise(_0x14d8f5,_0x272d42){return respondWithRpcPromise(_0xd930('0x2f'),_0xd930('0x30'),{'command':_0x272d42[_0xd930('0x31')]?util[_0xd930('0x32')]('iftime\x20%s,%s',_0x14d8f5[_0xd930('0x33')],_0x272d42[_0xd930('0x31')]):util[_0xd930('0x32')]('iftime\x20%s',_0x14d8f5[_0xd930('0x33')])},client9002)[_0xd930('0x16')](function(_0x727cfb){var _0x36b5cb=_0x727cfb&&_0x727cfb[_0xd930('0x34')](_0xd930('0x35'))>=0x0?!![]:![];logger[_0xd930('0x1e')](_0xd930('0x36'),_0x272d42['id'],_0x14d8f5['id'],_0x14d8f5[_0xd930('0x33')],_0x36b5cb?_0xd930('0x37'):_0xd930('0x38'),_0x272d42[_0xd930('0x31')]?_0x272d42[_0xd930('0x31')]:_0xd930('0x39'));return _0x36b5cb;})['catch'](function(_0x213411){logger[_0xd930('0x1a')](_0xd930('0x36'),_0x272d42['id'],_0x14d8f5['id'],_0x14d8f5[_0xd930('0x33')],util[_0xd930('0x3a')](_0x213411,{'showHidden':![],'depth':null}),_0x272d42[_0xd930('0x31')]?_0x272d42['timezone']:_0xd930('0x39'));return![];});}function checkWebsiteIntervals(_0x2f1b01){var _0x397357=_[_0xd930('0x3b')](_0x2f1b01[_0xd930('0x3c')][_0xd930('0x3d')],function(_0x3bafef){var _0x3b470f=_0x3bafef['get']({'plain':!![]});return iftimePromise(_0x3b470f,_0x2f1b01);});return Promise['all'](_0x397357)[_0xd930('0x16')](function(_0x4f74cc){return _[_0xd930('0x3e')](_0x4f74cc);});}function createInteractionObject(_0x2d3e34,_0x39734a,_0x484f84,_0x79b128){var _0x46169f=require(_0xd930('0x3f'));var _0x2cad14=new _0x46169f();var _0x10b0b6=_0x2cad14[_0xd930('0x40')](_0x484f84['user-agent'])[_0xd930('0x41')]();var _0xeedef7=_0x39734a[_0xd930('0x42')];if(_0x484f84['cf-connecting-ip']){_0xeedef7=_0x484f84[_0xd930('0x43')];}else if(_0x484f84[_0xd930('0x44')]){_0xeedef7=_[_0xd930('0x45')](_0x484f84[_0xd930('0x44')][_0xd930('0x46')](','));}return{'ContactId':_0x79b128['id'],'ChatWebsiteId':_0x2d3e34,'from':(_0x79b128[_0xd930('0x47')]||'')+'\x20'+(_0x79b128[_0xd930('0x48')]||''),'customerIp':_0xeedef7,'customerPort':_0x484f84[_0xd930('0x49')]?_0x484f84[_0xd930('0x49')]:null,'referer':_0x39734a[_0xd930('0x4a')],'browserName':_0x10b0b6[_0xd930('0x4b')][_0xd930('0x2d')]&&_0x10b0b6[_0xd930('0x4b')]['version']?util['format'](_0xd930('0x4c'),_0x10b0b6[_0xd930('0x4b')][_0xd930('0x2d')],_0x10b0b6[_0xd930('0x4b')]['version']):_0xd930('0x4d'),'browserVersion':_0x10b0b6['browser'][_0xd930('0x4e')]||_0xd930('0x4d'),'osName':util[_0xd930('0x32')]('%s\x20%s',_0x10b0b6['os'][_0xd930('0x2d')],_0x10b0b6['os'][_0xd930('0x4e')]),'osVersion':_0x10b0b6['os']['version'],'deviceModel':_0x10b0b6[_0xd930('0x4f')][_0xd930('0x50')]&&_0x10b0b6[_0xd930('0x4f')]['vendor']?util[_0xd930('0x32')](_0xd930('0x51'),_0x10b0b6[_0xd930('0x4f')]['model'],_0x10b0b6[_0xd930('0x4f')][_0xd930('0x52')],_0x10b0b6['device'][_0xd930('0x53')]):null,'deviceVendor':_0x10b0b6[_0xd930('0x4f')][_0xd930('0x52')],'deviceType':_0x10b0b6['device'][_0xd930('0x53')],'formData':JSON['stringify'](_0x39734a)};}exports[_0xd930('0x54')]=function(_0x2870a3,_0x36713c){var _0x517567={'include':[{'model':db[_0xd930('0x55')],'as':_0xd930('0x56')}]},_0x4f091b={},_0x299f13={'count':0x0,'rows':[]};var _0x5f51fb=_[_0xd930('0x3b')](db[_0xd930('0x57')][_0xd930('0x58')],function(_0x2acd9d){return{'name':_0x2acd9d[_0xd930('0x59')],'type':_0x2acd9d[_0xd930('0x53')][_0xd930('0x5a')]};});_0x4f091b['model']=_[_0xd930('0x3b')](_0x5f51fb,_0xd930('0x2d'));_0x4f091b['query']=_['keys'](_0x2870a3[_0xd930('0x5b')]);_0x4f091b[_0xd930('0x5c')]=_[_0xd930('0x5d')](_0x4f091b['model'],_0x4f091b['query']);_0x517567[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x4f091b[_0xd930('0x50')],qs[_0xd930('0x5f')](_0x2870a3['query'][_0xd930('0x5f')]));_0x517567[_0xd930('0x5e')]=_0x517567['attributes'][_0xd930('0x60')]?_0x517567[_0xd930('0x5e')]:_0x4f091b[_0xd930('0x50')];if(!_0x2870a3[_0xd930('0x5b')][_0xd930('0x61')]('nolimit')){_0x517567['limit']=qs['limit'](_0x2870a3[_0xd930('0x5b')][_0xd930('0x23')]);_0x517567['offset']=qs[_0xd930('0x25')](_0x2870a3['query'][_0xd930('0x25')]);}_0x517567['order']=qs[_0xd930('0x62')](_0x2870a3[_0xd930('0x5b')][_0xd930('0x62')]);_0x517567[_0xd930('0x63')]=qs[_0xd930('0x5c')](_['pick'](_0x2870a3['query'],_0x4f091b[_0xd930('0x5c')]),_0x5f51fb);if(_0x2870a3[_0xd930('0x5b')][_0xd930('0x64')]){_0x517567['where']=_[_0xd930('0x65')](_0x517567[_0xd930('0x63')],{'$or':_['map'](_0x5f51fb,function(_0x150b9a){if(_0x150b9a[_0xd930('0x53')]!==_0xd930('0x66')){var _0xba7f08={};_0xba7f08[_0x150b9a['name']]={'$like':'%'+_0x2870a3['query']['filter']+'%'};return _0xba7f08;}})});}_0x517567=_[_0xd930('0x65')]({},_0x517567,_0x2870a3['options']);var _0x3d9330={'where':_0x517567['where']};return db['ChatWebsite'][_0xd930('0x24')](_0x3d9330)[_0xd930('0x16')](function(_0x503294){_0x299f13[_0xd930('0x24')]=_0x503294;if(_0x2870a3[_0xd930('0x5b')][_0xd930('0x67')]){_0x517567[_0xd930('0x68')]=[{'all':!![]}];}return db[_0xd930('0x57')]['findAll'](_0x517567);})[_0xd930('0x16')](function(_0x44d5a4){_0x299f13[_0xd930('0x69')]=_0x44d5a4;return _0x299f13;})[_0xd930('0x16')](respondWithFilteredResult(_0x36713c,_0x517567))[_0xd930('0x6a')](handleError(_0x36713c,null));};exports[_0xd930('0x6b')]=function(_0x14791f,_0x4a496c){var _0x34fdc9={'raw':![],'where':{'id':_0x14791f[_0xd930('0x6c')]['id']},'include':[{'model':db['Pause'],'as':_0xd930('0x56')}]},_0x50f5ba={};_0x50f5ba[_0xd930('0x50')]=_['keys'](db[_0xd930('0x57')][_0xd930('0x58')]);_0x50f5ba[_0xd930('0x5b')]=_['keys'](_0x14791f[_0xd930('0x5b')]);_0x50f5ba['filters']=_[_0xd930('0x5d')](_0x50f5ba[_0xd930('0x50')],_0x50f5ba[_0xd930('0x5b')]);_0x34fdc9[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x50f5ba['model'],qs[_0xd930('0x5f')](_0x14791f['query'][_0xd930('0x5f')]));_0x34fdc9[_0xd930('0x5e')]=_0x34fdc9[_0xd930('0x5e')][_0xd930('0x60')]?_0x34fdc9['attributes']:_0x50f5ba[_0xd930('0x50')];if(_0x14791f[_0xd930('0x5b')]['includeAll']){_0x34fdc9[_0xd930('0x68')]=[{'all':!![]}];}_0x34fdc9=_[_0xd930('0x65')]({},_0x34fdc9,_0x14791f[_0xd930('0x6d')]);return db[_0xd930('0x57')][_0xd930('0x6e')](_0x34fdc9)[_0xd930('0x16')](handleEntityNotFound(_0x4a496c,null))[_0xd930('0x16')](respondWithResult(_0x4a496c,null))[_0xd930('0x6a')](handleError(_0x4a496c,null));};exports[_0xd930('0x6f')]=function(_0x1b126f,_0x1cbca3){return db[_0xd930('0x57')][_0xd930('0x6f')](_0x1b126f['body'],{})[_0xd930('0x16')](function(_0x26d2c2){var _0x12bed3=_0x1b126f[_0xd930('0x70')]['get']({'plain':!![]});if(!_0x12bed3)throw new Error(_0xd930('0x71'));if(_0x12bed3[_0xd930('0x72')]===_0xd930('0x70')){var _0x41e037=_0x26d2c2['get']({'plain':!![]});var _0x4f0fe0='ChatWebsites';return db['UserProfileSection'][_0xd930('0x6e')]({'where':{'name':_0x4f0fe0,'userProfileId':_0x12bed3[_0xd930('0x73')]},'raw':!![]})[_0xd930('0x16')](function(_0x5e3cfd){if(_0x5e3cfd&&_0x5e3cfd[_0xd930('0x74')]===0x0){return db['UserProfileResource'][_0xd930('0x6f')]({'name':_0x41e037['name'],'resourceId':_0x41e037['id'],'type':_0x5e3cfd[_0xd930('0x2d')],'sectionId':_0x5e3cfd['id']},{})[_0xd930('0x16')](function(){return _0x26d2c2;});}else{return _0x26d2c2;}})[_0xd930('0x6a')](function(_0x37feb7){logger[_0xd930('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37feb7);throw _0x37feb7;});}return _0x26d2c2;})[_0xd930('0x16')](respondWithResult(_0x1cbca3,0xc9))[_0xd930('0x6a')](handleError(_0x1cbca3,null));};exports['update']=function(_0x344dc9,_0x5942da){if(_0x344dc9[_0xd930('0x75')]['id']){delete _0x344dc9['body']['id'];}return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x344dc9['params']['id']},'include':[{'model':db[_0xd930('0x55')],'as':_0xd930('0x56')}]})['then'](handleEntityNotFound(_0x5942da,null))[_0xd930('0x16')](saveUpdates(_0x344dc9[_0xd930('0x75')],null))[_0xd930('0x16')](respondWithResult(_0x5942da,null))[_0xd930('0x6a')](handleError(_0x5942da,null));};exports[_0xd930('0x29')]=function(_0x38c0e8,_0x19bca9){return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x38c0e8[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x19bca9,null))['then'](removeEntity(_0x19bca9,null))['catch'](handleError(_0x19bca9,null));};exports['describe']=function(_0x40ec53,_0x3a3e63){return db[_0xd930('0x57')][_0xd930('0x76')]()[_0xd930('0x16')](respondWithResult(_0x3a3e63,null))[_0xd930('0x6a')](handleError(_0x3a3e63,null));};exports[_0xd930('0x77')]=function(_0x3a802c,_0x2cffb8){if(_0x3a802c[_0xd930('0x75')]['id']){delete _0x3a802c[_0xd930('0x75')]['id'];}return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x3a802c['params']['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x2cffb8,null))[_0xd930('0x16')](function(_0x3032a6){if(_0x3032a6){_0x3a802c['body']['ChatWebsiteId']=_0x3032a6['id'];return db['Disposition'][_0xd930('0x6f')](_0x3a802c['body']);}})[_0xd930('0x16')](respondWithResult(_0x2cffb8,null))[_0xd930('0x6a')](handleError(_0x2cffb8,null));};exports['getDispositions']=function(_0x9d681c,_0x821eae){var _0x2b2db1={'raw':![],'where':{}};var _0x550796={};var _0xb6c3cb={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x9d681c[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x821eae,null))['then'](function(_0x143572){if(_0x143572){_0x550796[_0xd930('0x50')]=_[_0xd930('0x78')](db[_0xd930('0x79')][_0xd930('0x58')]);_0x550796[_0xd930('0x5b')]=_[_0xd930('0x78')](_0x9d681c['query']);_0x550796[_0xd930('0x5c')]=_[_0xd930('0x5d')](_0x550796[_0xd930('0x50')],_0x550796[_0xd930('0x5b')]);_0x2b2db1[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x550796[_0xd930('0x50')],qs[_0xd930('0x5f')](_0x9d681c[_0xd930('0x5b')][_0xd930('0x5f')]));_0x2b2db1[_0xd930('0x5e')]=_0x2b2db1[_0xd930('0x5e')][_0xd930('0x60')]?_0x2b2db1['attributes']:_0x550796[_0xd930('0x50')];if(!_0x9d681c[_0xd930('0x5b')][_0xd930('0x61')](_0xd930('0x7a'))){_0x2b2db1[_0xd930('0x23')]=qs[_0xd930('0x23')](_0x9d681c[_0xd930('0x5b')][_0xd930('0x23')]);_0x2b2db1[_0xd930('0x25')]=qs[_0xd930('0x25')](_0x9d681c['query'][_0xd930('0x25')]);}_0x2b2db1[_0xd930('0x7b')]=qs['sort'](_0x9d681c[_0xd930('0x5b')][_0xd930('0x62')]);_0x2b2db1['where']=qs['filters'](_['pick'](_0x9d681c['query'],_0x550796['filters']));_0x2b2db1[_0xd930('0x63')][_0xd930('0x7c')]=_0x143572['id'];if(_0x9d681c[_0xd930('0x5b')]['filter']){_0x2b2db1[_0xd930('0x63')]=_['merge'](_0x2b2db1['where'],{'$or':_['map'](_0x2b2db1[_0xd930('0x5e')],function(_0x5ea0d8){var _0x313a94={};_0x313a94[_0x5ea0d8]={'$like':'%'+_0x9d681c[_0xd930('0x5b')][_0xd930('0x64')]+'%'};return _0x313a94;})});}_0x2b2db1=_[_0xd930('0x65')]({},_0x2b2db1,_0x9d681c['options']);return db[_0xd930('0x79')][_0xd930('0x24')]({'where':_0x2b2db1[_0xd930('0x63')]})[_0xd930('0x16')](function(_0xa6d25a){_0xb6c3cb[_0xd930('0x24')]=_0xa6d25a;if(_0x9d681c['query'][_0xd930('0x67')]){_0x2b2db1[_0xd930('0x68')]=[{'all':!![]}];}return db[_0xd930('0x79')]['findAll'](_0x2b2db1);})['then'](function(_0x54ee4e){_0xb6c3cb[_0xd930('0x69')]=_0x54ee4e;return _0xb6c3cb;});}})[_0xd930('0x16')](respondWithFilteredResult(_0x821eae,_0x2b2db1))['catch'](handleError(_0x821eae,null));};exports[_0xd930('0x7d')]=function(_0x40e3c2,_0x31d9ac){return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x40e3c2[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x31d9ac,null))[_0xd930('0x16')](function(_0x4a1e79){if(_0x4a1e79){return _0x4a1e79[_0xd930('0x7d')](_0x40e3c2[_0xd930('0x5b')]['ids']);}})[_0xd930('0x16')](respondWithStatusCode(_0x31d9ac,null))[_0xd930('0x6a')](handleError(_0x31d9ac,null));};exports[_0xd930('0x7e')]=function(_0x53428b,_0x355aeb){if(_0x53428b[_0xd930('0x75')]['id']){delete _0x53428b['body']['id'];}return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x53428b[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x355aeb,null))[_0xd930('0x16')](function(_0x44a2d0){if(_0x44a2d0){_0x53428b[_0xd930('0x75')][_0xd930('0x7c')]=_0x44a2d0['id'];return db[_0xd930('0x7f')][_0xd930('0x6f')](_0x53428b[_0xd930('0x75')]);}})[_0xd930('0x16')](respondWithResult(_0x355aeb,null))[_0xd930('0x6a')](handleError(_0x355aeb,null));};exports[_0xd930('0x80')]=function(_0x1f5c2b,_0x499015){var _0x1ef6b1={'raw':![],'where':{}};var _0x3778ce={};var _0x24366c={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1f5c2b[_0xd930('0x6c')]['id']}})['then'](handleEntityNotFound(_0x499015,null))[_0xd930('0x16')](function(_0x4ac38d){if(_0x4ac38d){_0x3778ce[_0xd930('0x50')]=_[_0xd930('0x78')](db[_0xd930('0x7f')][_0xd930('0x58')]);_0x3778ce[_0xd930('0x5b')]=_[_0xd930('0x78')](_0x1f5c2b[_0xd930('0x5b')]);_0x3778ce[_0xd930('0x5c')]=_['intersection'](_0x3778ce[_0xd930('0x50')],_0x3778ce[_0xd930('0x5b')]);_0x1ef6b1[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x3778ce[_0xd930('0x50')],qs[_0xd930('0x5f')](_0x1f5c2b['query'][_0xd930('0x5f')]));_0x1ef6b1['attributes']=_0x1ef6b1['attributes'][_0xd930('0x60')]?_0x1ef6b1[_0xd930('0x5e')]:_0x3778ce['model'];if(!_0x1f5c2b[_0xd930('0x5b')][_0xd930('0x61')](_0xd930('0x7a'))){_0x1ef6b1[_0xd930('0x23')]=qs[_0xd930('0x23')](_0x1f5c2b[_0xd930('0x5b')][_0xd930('0x23')]);_0x1ef6b1[_0xd930('0x25')]=qs[_0xd930('0x25')](_0x1f5c2b[_0xd930('0x5b')][_0xd930('0x25')]);}_0x1ef6b1[_0xd930('0x7b')]=qs[_0xd930('0x62')](_0x1f5c2b[_0xd930('0x5b')]['sort']);_0x1ef6b1['where']=qs[_0xd930('0x5c')](_[_0xd930('0x81')](_0x1f5c2b[_0xd930('0x5b')],_0x3778ce[_0xd930('0x5c')]));_0x1ef6b1['where'][_0xd930('0x7c')]=_0x4ac38d['id'];if(_0x1f5c2b[_0xd930('0x5b')][_0xd930('0x64')]){_0x1ef6b1[_0xd930('0x63')]=_[_0xd930('0x65')](_0x1ef6b1[_0xd930('0x63')],{'$or':_[_0xd930('0x3b')](_0x1ef6b1[_0xd930('0x5e')],function(_0xb13e73){var _0x327523={};_0x327523[_0xb13e73]={'$like':'%'+_0x1f5c2b[_0xd930('0x5b')][_0xd930('0x64')]+'%'};return _0x327523;})});}_0x1ef6b1=_[_0xd930('0x65')]({},_0x1ef6b1,_0x1f5c2b[_0xd930('0x6d')]);return db[_0xd930('0x7f')][_0xd930('0x24')]({'where':_0x1ef6b1[_0xd930('0x63')]})[_0xd930('0x16')](function(_0x42b745){_0x24366c[_0xd930('0x24')]=_0x42b745;if(_0x1f5c2b[_0xd930('0x5b')][_0xd930('0x67')]){_0x1ef6b1[_0xd930('0x68')]=[{'all':!![]}];}return db[_0xd930('0x7f')][_0xd930('0x82')](_0x1ef6b1);})[_0xd930('0x16')](function(_0x4db917){_0x24366c[_0xd930('0x69')]=_0x4db917;return _0x24366c;});}})[_0xd930('0x16')](respondWithFilteredResult(_0x499015,_0x1ef6b1))['catch'](handleError(_0x499015,null));};exports['removeAnswers']=function(_0x2d958c,_0x5289c4){return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x2d958c['params']['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x5289c4,null))['then'](function(_0xfa508a){if(_0xfa508a){return _0xfa508a[_0xd930('0x83')](_0x2d958c[_0xd930('0x5b')]['ids']);}})[_0xd930('0x16')](respondWithStatusCode(_0x5289c4,null))[_0xd930('0x6a')](handleError(_0x5289c4,null));};exports['addLogo']=function(_0x3ec65f,_0x31ddd9){_0x3ec65f['body'][_0xd930('0x84')]=_0x3ec65f[_0xd930('0x85')]['filename'];return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x3ec65f[_0xd930('0x6c')]['id']}})['then'](handleEntityNotFound(_0x31ddd9,null))[_0xd930('0x16')](saveUpdates(_0x3ec65f[_0xd930('0x75')],null))[_0xd930('0x16')](respondWithResult(_0x31ddd9,null))[_0xd930('0x6a')](handleError(_0x31ddd9,null));};exports[_0xd930('0x86')]=function(_0x4df05b,_0x359df4){_0x4df05b[_0xd930('0x75')][_0xd930('0x87')]=_0x4df05b[_0xd930('0x85')]['filename'];return db['ChatWebsite'][_0xd930('0x6e')]({'where':{'id':_0x4df05b[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x359df4,null))['then'](saveUpdates(_0x4df05b[_0xd930('0x75')],null))[_0xd930('0x16')](respondWithResult(_0x359df4,null))[_0xd930('0x6a')](handleError(_0x359df4,null));};exports['addCustomerAvatar']=function(_0x50ae99,_0x6cd3f4){_0x50ae99['body'][_0xd930('0x88')]=_0x50ae99[_0xd930('0x85')]['filename'];return db['ChatWebsite'][_0xd930('0x6e')]({'where':{'id':_0x50ae99[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x6cd3f4,null))[_0xd930('0x16')](saveUpdates(_0x50ae99['body'],null))[_0xd930('0x16')](respondWithResult(_0x6cd3f4,null))['catch'](handleError(_0x6cd3f4,null));};exports[_0xd930('0x89')]=function(_0x2c17fa,_0x272ea3){_0x2c17fa[_0xd930('0x75')][_0xd930('0x8a')]=_0x2c17fa[_0xd930('0x85')]['filename'];return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x2c17fa[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x272ea3,null))['then'](saveUpdates(_0x2c17fa['body'],null))[_0xd930('0x16')](respondWithResult(_0x272ea3,null))[_0xd930('0x6a')](handleError(_0x272ea3,null));};exports[_0xd930('0x8b')]=function(_0x509f52,_0x51fd52){var _0x20319a=path['join'](config['root'],_0xd930('0x8c'));var _0xa301a2={'where':{'id':_0x509f52[_0xd930('0x6c')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xd23bd6=![];return require(_0xd930('0x8d'))['getLicense']()[_0xd930('0x16')](function(_0x254b4f){if(_0x254b4f){_0xd23bd6=_0x254b4f[_0xd930('0x8e')];}})[_0xd930('0x16')](function(){return db[_0xd930('0x57')]['find'](_0xa301a2);})[_0xd930('0x16')](handleEntityNotFound(_0x51fd52,null))[_0xd930('0x16')](function(_0x49dff0){if(_0x49dff0){if(!_['isNil'](_0x49dff0['sitepic'])){if(fs['existsSync'](path[_0xd930('0x8f')](config[_0xd930('0x90')],'server/files/images/logos/',_0x49dff0['sitepic']))&&_0xd23bd6){_0x20319a=path['join'](config[_0xd930('0x90')],'server/files/images/logos/',_0x49dff0[_0xd930('0x84')]);}}return _0x51fd52[_0xd930('0x91')](_0x20319a);}})[_0xd930('0x6a')](handleError(_0x51fd52,null));};exports[_0xd930('0x92')]=function(_0x3a6e61,_0xa4f6aa){var _0x1f7387=path['join'](config[_0xd930('0x90')],_0xd930('0x93'));var _0x1ea928={'where':{'id':_0x3a6e61[_0xd930('0x6c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xd930('0x57')][_0xd930('0x6e')](_0x1ea928)['then'](handleEntityNotFound(_0xa4f6aa,null))[_0xd930('0x16')](function(_0x384eec){if(_0x384eec){if(!_[_0xd930('0x94')](_0x384eec[_0xd930('0x87')])){if(fs[_0xd930('0x95')](path[_0xd930('0x8f')](config[_0xd930('0x90')],'server/files/images/avatars/',_0x384eec['agentAvatar']))){_0x1f7387=path[_0xd930('0x8f')](config[_0xd930('0x90')],_0xd930('0x96'),_0x384eec[_0xd930('0x87')]);}}return _0xa4f6aa[_0xd930('0x91')](_0x1f7387);}})['catch'](handleError(_0xa4f6aa,null));};exports[_0xd930('0x97')]=function(_0x3d5b36,_0x2eaa3b){var _0x2fcdf0=path[_0xd930('0x8f')](config[_0xd930('0x90')],_0xd930('0x98'));var _0x111195={'where':{'id':_0x3d5b36[_0xd930('0x6c')]['id']},'attributes':['id',_0xd930('0x88'),_0xd930('0x99')],'raw':!![]};return db[_0xd930('0x57')][_0xd930('0x6e')](_0x111195)['then'](handleEntityNotFound(_0x2eaa3b,null))[_0xd930('0x16')](function(_0x4c5986){if(_0x4c5986){if(!_[_0xd930('0x94')](_0x4c5986[_0xd930('0x88')])){if(fs[_0xd930('0x95')](path[_0xd930('0x8f')](config['root'],_0xd930('0x96'),_0x4c5986[_0xd930('0x88')]))&&_0x4c5986['showCustomerAvatar']){_0x2fcdf0=path[_0xd930('0x8f')](config[_0xd930('0x90')],'server/files/images/avatars/',_0x4c5986[_0xd930('0x88')]);}}return _0x2eaa3b[_0xd930('0x91')](_0x2fcdf0);}})[_0xd930('0x6a')](handleError(_0x2eaa3b,null));};exports[_0xd930('0x9a')]=function(_0x1b7b7b,_0x5351db){var _0x217257=path[_0xd930('0x8f')](config[_0xd930('0x90')],_0xd930('0x9b'));var _0x5d71cd={'where':{'id':_0x1b7b7b[_0xd930('0x6c')]['id']},'attributes':['id',_0xd930('0x8a')],'raw':!![]};return db[_0xd930('0x57')][_0xd930('0x6e')](_0x5d71cd)[_0xd930('0x16')](handleEntityNotFound(_0x5351db,null))[_0xd930('0x16')](function(_0x260437){if(_0x260437){if(!_[_0xd930('0x94')](_0x260437[_0xd930('0x8a')])){if(fs[_0xd930('0x95')](path[_0xd930('0x8f')](config[_0xd930('0x90')],_0xd930('0x96'),_0x260437[_0xd930('0x8a')]))){_0x217257=path[_0xd930('0x8f')](config['root'],_0xd930('0x96'),_0x260437[_0xd930('0x8a')]);}}return _0x5351db[_0xd930('0x91')](_0x217257);}})[_0xd930('0x6a')](handleError(_0x5351db,null));};exports[_0xd930('0x9c')]=function(_0x4b116a,_0x1c1871){var _0x44f28c={'body':_0x4b116a[_0xd930('0x75')],'channel':_0xd930('0x9d')};var _0x51da9e=[];var _0x4fad87=[];var _0x4f388e={};var _0x58d1a4=![];return db[_0xd930('0x9e')][_0xd930('0x76')]()[_0xd930('0x16')](function(_0x24bc54){if(!_0x24bc54){throw new db['Sequelize'][(_0xd930('0x9f'))](_0xd930('0xa0'));}_0x51da9e=_['difference'](_[_0xd930('0x78')](_0x24bc54),['createdAt','updatedAt']);_0x4fad87=_[_0xd930('0xa1')](_[_0xd930('0x78')](_0x24bc54),['createdAt',_0xd930('0xa2'),_0xd930('0xa3'),_0xd930('0xa4')]);if(_0x4b116a['body']['id']){delete _0x4b116a[_0xd930('0x75')]['id'];}if(_[_0xd930('0x94')](_0x4b116a[_0xd930('0x75')][_0xd930('0xa5')])){throw new db['Sequelize'][(_0xd930('0x9f'))]('from\x20is\x20mandatory');}if(_[_0xd930('0x94')](_0x4b116a['body'][_0xd930('0x75')])||_0x4b116a[_0xd930('0x75')]['body']===''){throw new db[(_0xd930('0xa6'))][(_0xd930('0x9f'))](_0xd930('0xa7'));}if(_[_0xd930('0x94')](_0x4b116a[_0xd930('0x75')][_0xd930('0xa8')])){throw new db[(_0xd930('0xa6'))][(_0xd930('0x9f'))](_0xd930('0xa9')+_0x4fad87);}if(!_[_0xd930('0xaa')](_0x4fad87,_0x4b116a[_0xd930('0x75')][_0xd930('0xa8')])){throw new db[(_0xd930('0xa6'))][(_0xd930('0x9f'))](_0xd930('0xab')+_0x4fad87);}_0x4f388e[_0x4b116a[_0xd930('0x75')]['mapKey']]=_0x4b116a[_0xd930('0x75')][_0xd930('0xa5')];})[_0xd930('0x16')](function(){return db[_0xd930('0x57')]['find']({'where':{'id':_0x4b116a['params']['id']},'include':[{'model':db[_0xd930('0xac')],'as':_0xd930('0xad'),'include':[{'model':db[_0xd930('0x9e')],'as':_0xd930('0xae'),'where':_0x4f388e,'limit':0x1,'order':[[_0xd930('0xa2'),_0xd930('0xaf')]]}]},{'model':db[_0xd930('0xb0')],'as':'Applications'},{'model':db[_0xd930('0x3c')],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xd930('0x33')],'raw':!![]}]}]});})[_0xd930('0x16')](function(_0x5aba15){if(!_0x5aba15)throw new APINotFoundError(util[_0xd930('0x32')](_0xd930('0xb1'),_0x4b116a['params']['id']));if(!_0x5aba15[_0xd930('0x3c')]||!_0x5aba15[_0xd930('0x3c')][_0xd930('0x3d')])return[_0x5aba15,!![]];return[_0x5aba15,checkWebsiteIntervals(_0x5aba15)];})[_0xd930('0xb2')](function(_0x181b6d,_0x1c048d){if(!_0x1c048d)throw new APIOutOfIntervalError();if(!_0x181b6d['List'])return;_0x44f28c[_0xd930('0xb3')]=_0x181b6d;_0x44f28c[_0xd930('0xb4')]=_0x181b6d[_0xd930('0xad')];_0x44f28c['applications']=_[_0xd930('0xb5')](_0x181b6d['Applications'],[_0xd930('0xb6')],[_0xd930('0xb7')]);if(_0x44f28c['account'][_0xd930('0xb8')]){delete _0x44f28c['account'][_0xd930('0xb8')];}if(_0x44f28c['account'][_0xd930('0xad')]&&_0x44f28c[_0xd930('0xb3')]['List']['Contacts']['length']){return _0x44f28c['account'][_0xd930('0xad')][_0xd930('0xae')][0x0];}var _0x5e07e6=_['defaults'](_0x4b116a[_0xd930('0x75')],{'firstName':_0x4b116a[_0xd930('0x75')][_0xd930('0xa5')],'ListId':_0x181b6d[_0xd930('0xa4')]});_0x5e07e6[_0x4b116a[_0xd930('0x75')][_0xd930('0xa8')]]=_0x4b116a[_0xd930('0x75')][_0xd930('0xa5')];return db[_0xd930('0x9e')][_0xd930('0x6f')](_0x5e07e6,{'fields':_0x51da9e,'raw':!![]});})['then'](function(_0x4f9d04){_0x44f28c[_0xd930('0xb9')]=_0x4f9d04;var _0x33973c=createInteractionObject(_0x4b116a[_0xd930('0x6c')]['id'],_0x4b116a[_0xd930('0x75')],_0x4b116a[_0xd930('0xba')],_0x4f9d04);var _0x3431ac={'ChatWebsiteId':_0x4b116a[_0xd930('0x6c')]['id'],'closed':![]};if(_0x4b116a[_0xd930('0x75')][_0xd930('0xbb')]){_0x3431ac[_0xd930('0xbb')]=_0x4b116a['body']['threadId'];return db['ChatInteraction'][_0xd930('0x6e')]({'where':_0x3431ac})[_0xd930('0x16')](function(_0x4a640b){if(_0x4a640b){_0x58d1a4=!![];return _0x4a640b;}_0x33973c[_0xd930('0xbb')]=_0x4b116a[_0xd930('0x75')][_0xd930('0xbb')];_0x33973c['externalUrl']=_0x4b116a['body'][_0xd930('0xbc')];return db[_0xd930('0xbd')]['create'](_0x33973c);});}_0x3431ac[_0xd930('0xbe')]=_0x4f9d04['id'];if(_0x4b116a['body'][_0xd930('0xbf')]&&_0x4b116a[_0xd930('0x75')]['interaction']['id']){_0x3431ac['id']=_0x4b116a[_0xd930('0x75')][_0xd930('0xbf')]['id'];return db[_0xd930('0xbd')]['find']({'where':_0x3431ac})[_0xd930('0x16')](function(_0x6df3ab){if(_0x6df3ab){_0x58d1a4=!![];return _0x6df3ab;}return db[_0xd930('0xbd')][_0xd930('0x6f')](_0x33973c);});}return db['ChatInteraction'][_0xd930('0x6f')](_0x33973c);})[_0xd930('0x16')](function(_0x34fdb5){if(!_0x58d1a4)return _0x34fdb5;var _0x426a36={'from':(_0x44f28c[_0xd930('0xb9')][_0xd930('0x47')]||'')+'\x20'+(_0x44f28c[_0xd930('0xb9')][_0xd930('0x48')]||'')};if(_0x4b116a[_0xd930('0x75')][_0xd930('0xbb')]&&_0x4b116a['body'][_0xd930('0xc0')]&&_0x4b116a[_0xd930('0x75')][_0xd930('0xbb')]!=_0x4b116a[_0xd930('0x75')][_0xd930('0xc0')]){_0x426a36[_0xd930('0xbb')]=_0x4b116a[_0xd930('0x75')][_0xd930('0xc0')];}return _0x34fdb5['update'](_0x426a36);})['then'](function(_0x2ae75a){_0x44f28c[_0xd930('0xbf')]=_0x2ae75a[_0xd930('0x2a')]({'plain':!![]});_0x44f28c[_0xd930('0xbf')][_0xd930('0xc1')]=!_0x58d1a4;if(_0x44f28c[_0xd930('0xbf')][_0xd930('0xc1')]){if(_0x44f28c[_0xd930('0xb3')]['autoclose']){_0x44f28c[_0xd930('0xc2')][_0xd930('0xc3')]({'id':0x0,'priority':_0x44f28c[_0xd930('0xc2')][_0xd930('0x60')]+0x1,'app':_0xd930('0xc4'),'appdata':_0xd930('0xc5'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xd930('0x6f')]({'body':_0x4b116a[_0xd930('0x75')][_0xd930('0x75')],'ChatWebsiteId':_0x4b116a[_0xd930('0x6c')]['id'],'ChatInteractionId':_0x2ae75a['id'],'direction':'in','ContactId':_0x44f28c[_0xd930('0xb9')]['id'],'AttachmentId':_0x4b116a[_0xd930('0x75')][_0xd930('0xc6')]});})[_0xd930('0x16')](function(_0x361b34){_0x44f28c[_0xd930('0x1d')]=_0x361b34;if(!_0x44f28c[_0xd930('0xbf')]['UserId']){return;}return db[_0xd930('0xc7')][_0xd930('0x6e')]({'attributes':['id',_0xd930('0x2d')],'where':{'id':_0x44f28c[_0xd930('0xbf')][_0xd930('0xc8')]}});})[_0xd930('0x16')](function(_0x1fddf6){if(_0x1fddf6){_0x44f28c[_0xd930('0xc2')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd930('0xc9'),'appdata':_0x1fddf6[_0xd930('0x2d')]+','+(_0x44f28c['account'][_0xd930('0xca')]||0xa),'interval':'*,*,*,*'});_0x44f28c[_0xd930('0xcb')]=!![];}if(!_0x44f28c[_0xd930('0xbf')][_0xd930('0xcc')]){return;}return db[_0xd930('0xcd')][_0xd930('0x6e')]({'attributes':['id',_0xd930('0x2d')],'where':{'id':_0x44f28c[_0xd930('0xbf')][_0xd930('0xcc')]}});})[_0xd930('0x16')](function(_0x40652e){if(_0x40652e){_0x44f28c[_0xd930('0xc2')][_0xd930('0xce')]({'id':0x0,'priority':0x1,'app':_0xd930('0xcf'),'appdata':_0x40652e[_0xd930('0x2d')]+','+(_0x44f28c[_0xd930('0xb3')][_0xd930('0xd0')]||0x12c),'interval':_0xd930('0xd1')});}return respondWithRpcPromise(_0xd930('0xd2'),_0xd930('0xd3'),_0x44f28c);})['then'](function(_0x27e81c){respondWithRpcPromise(_0xd930('0xd4'),_0xd930('0xd4'),{'event':'notify','message':_0x27e81c},client9002);return _0x27e81c;})[_0xd930('0x16')](respondWithResult(_0x1c1871,null))['catch'](APIHandleError(_0x1c1871));};exports[_0xd930('0xd5')]=function(_0x1456e1,_0xcfa1c6){var _0x13e0e3,_0x12b895,_0x5efafd;var _0x1ca948=[];var _0x555944={};var _0x3c716f=_0x1456e1[_0xd930('0xd6')]||[];var _0x2e3fad=[];var _0x3d03bb;return db['CmContact'][_0xd930('0x76')]()[_0xd930('0x16')](function(_0x4a4b94){if(!_0x4a4b94){throw new db[(_0xd930('0xa6'))][(_0xd930('0x9f'))]('no\x20available\x20attributes');}_0x1ca948=_['difference'](_['keys'](_0x4a4b94),['createdAt',_0xd930('0xa2'),_0xd930('0xa3'),'ListId']);if(_0x1456e1['body']['id']){delete _0x1456e1[_0xd930('0x75')]['id'];}if(_[_0xd930('0x94')](_0x1456e1[_0xd930('0x75')][_0xd930('0xa5')])){throw _0xcfa1c6[_0xd930('0x20')](0x1f4)['send'](new db[(_0xd930('0xa6'))][(_0xd930('0x9f'))](_0xd930('0xd7')));}if(_[_0xd930('0x94')](_0x1456e1[_0xd930('0x75')]['body'])||_0x1456e1[_0xd930('0x75')]['body']===''){throw _0xcfa1c6['status'](0x1f4)[_0xd930('0x2e')](new db[(_0xd930('0xa6'))][(_0xd930('0x9f'))](_0xd930('0xa7')));}if(_[_0xd930('0x94')](_0x1456e1[_0xd930('0x75')][_0xd930('0xd8')])){throw _0xcfa1c6[_0xd930('0x20')](0x1f4)[_0xd930('0x2e')](new db[(_0xd930('0xa6'))]['ValidationError'](_0xd930('0xd9')+_0x1ca948));}if(!_[_0xd930('0xaa')](_0x1ca948,_0x1456e1[_0xd930('0x75')][_0xd930('0xd8')])){throw _0xcfa1c6[_0xd930('0x20')](0x1f4)[_0xd930('0x2e')](new db[(_0xd930('0xa6'))][(_0xd930('0x9f'))](_0xd930('0xda')+_0x1ca948));}_0x555944[_0x1456e1[_0xd930('0x75')]['mapKeyOffline']]=_0x1456e1[_0xd930('0x75')]['from'];})[_0xd930('0x16')](function(){return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x1456e1[_0xd930('0x6c')]['id']},'include':[{'model':db['CmList'],'as':_0xd930('0xad')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xd930('0x16')](handleEntityNotFound(_0xcfa1c6,null))[_0xd930('0x16')](function(_0x27a32f){if(_0x27a32f&&_0x27a32f[_0xd930('0xad')]){_0x12b895=_0x27a32f;var _0x100fef=_[_0xd930('0xdb')](_0x1456e1[_0xd930('0x75')],{'firstName':_0x1456e1[_0xd930('0x75')][_0xd930('0xa5')],'phone':_0x1456e1[_0xd930('0x75')][_0xd930('0xa5')],'ListId':_0x27a32f[_0xd930('0xa4')]});_0x100fef[_0x1456e1[_0xd930('0x75')][_0xd930('0xd8')]]=_0x1456e1[_0xd930('0x75')][_0xd930('0xa5')];return db[_0xd930('0x9e')][_0xd930('0xdc')]({'where':_0x555944,'defaults':_0x100fef});}})[_0xd930('0xb2')](function(_0x41eb1e){if(_0x41eb1e){_0x5efafd=_0x41eb1e;var _0x414190=fs[_0xd930('0xdd')](path[_0xd930('0x8f')](config[_0xd930('0x90')],'server/files/templates/chatOfflineMessage.ejs'),_0xd930('0xde'));var _0x1ddee0=ejs[_0xd930('0xdf')](_0x414190,{'body':_[_0xd930('0xe0')](_0x1456e1[_0xd930('0x75')]['body']),'bodyTitle':_0x12b895[_0xd930('0xe1')]});return db[_0xd930('0xe2')][_0xd930('0x6f')]({'body':_0x1ddee0,'plainBody':htmlToText[_0xd930('0xe3')](_0x1ddee0),'ContactId':_0x41eb1e['id'],'ChatWebsiteId':_0x12b895['id']});}})[_0xd930('0x16')](function(_0x417d1b){_0x3d03bb=_0x417d1b;if(_0x3c716f['length']){var _0x36162f=_0x3c716f[_0xd930('0x3b')](function(_0x2dc599){return{'name':_0x2dc599['originalname'],'basename':_0x2dc599['filename'],'type':_0x2dc599['mimetype'],'ChatOfflineMessageId':_0x417d1b['id']};});_0x2e3fad=_0x36162f[_0xd930('0x3b')](_0x44a3f9=>{var _0x3fa017={'filename':_0x44a3f9['name'],'path':path[_0xd930('0x8f')](config[_0xd930('0x90')],_0xd930('0xe4'),'files',_0xd930('0xe5'),_0xd930('0xe6'),_0x44a3f9[_0xd930('0xe7')])};return _0x3fa017;});if(!_0x12b895[_0xd930('0xe8')]){return db[_0xd930('0xe9')][_0xd930('0xea')](function(_0x23f967){return db[_0xd930('0xeb')][_0xd930('0xec')](_0x36162f,{'transaction':_0x23f967});});}}})[_0xd930('0x16')](function(){if(_0x3d03bb){_0x13e0e3=_0x3d03bb;return db[_0xd930('0xed')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd930('0xee'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd930('0xef'),'raw':!![]}]}]});}})[_0xd930('0x16')](function(_0x402fca){if(_0x402fca&&_0x402fca[_0xd930('0xee')]&&_0x12b895[_0xd930('0xf0')]&&_0x12b895[_0xd930('0xf1')]){var _0x19f777=_0x402fca[_0xd930('0xf2')]();return respondWithRpcPromise(_0xd930('0xf3'),_0xd930('0xf4'),{'account':_0x19f777,'message':{'from':util[_0xd930('0x32')](_0xd930('0xf5'),_0x402fca[_0xd930('0x2d')],_0x402fca[_0xd930('0xf6')]||_0x402fca['Smtp']['user']),'to':_0x12b895[_0xd930('0xf1')],'subject':_0x12b895[_0xd930('0xf7')],'html':_0x13e0e3[_0xd930('0x75')],'attachments':_0x2e3fad}},client9003)[_0xd930('0x16')](function(){return _0x13e0e3;})[_0xd930('0x6a')](function(_0x4427e1){logger[_0xd930('0x1a')](_0x4427e1);});}})[_0xd930('0x16')](function(){if(_0x12b895&&_0x12b895['openNewInteraction']&&_0x12b895[_0xd930('0xf8')]){var _0x2602b9=[];if(_0x3c716f['length']){_0x2602b9=_0x3c716f['map'](function(_0x42dd8d){return{'name':_0x42dd8d[_0xd930('0xf9')],'basename':_0x42dd8d['filename'],'type':_0x42dd8d['mimetype'],'ChatOfflineMessageId':_0x3d03bb['id']};});}var _0x28ddf2;if(!_[_0xd930('0x94')](_0x12b895[_0xd930('0xfa')])){var _0x1350ea=_[_0xd930('0x3b')](_0x1456e1[_0xd930('0x75')],function(_0x57064a){return _0x57064a;});var _0x2a1fb0=_[_0xd930('0xfb')](_0x1350ea)[0x0];var _0x34d1e2=_[_0xd930('0xfc')](_0x2a1fb0,function(_0x41a8a3){return _0x41a8a3;});_0x28ddf2=_0x34d1e2[0x1][_0x12b895[_0xd930('0xfa')]];}var _0x4b38c4={'from':_0x5efafd['email'],'firstName':_0x5efafd['firstName'],'lastName':_0x5efafd[_0xd930('0x48')],'mapKey':_0xd930('0xf6'),'message':{'from':_0x5efafd['email'],'to':_0x12b895[_0xd930('0xed')][_0xd930('0xf6')],'cc':'','subject':_[_0xd930('0x94')](_0x28ddf2)?_0x12b895['offlineMessageSubject']:_0x28ddf2,'messageId':'','sentAt':new Date(),'attach':_0x2602b9[_0xd930('0x60')],'attachments':_0x2602b9,'originChannel':_0xd930('0xfd'),'ChatWebsiteId':_0x12b895['id'],'ChatOfflineMessageId':_0x13e0e3['id'],'originTo':_0x12b895[_0xd930('0xed')]['email']},'body':_0x13e0e3[_0xd930('0x75')]};var _0x556470={'account':{'id':_0x12b895[_0xd930('0xf8')]},'body':_0x4b38c4,'log':_0xd930('0xfe')};return respondWithRpcPromise(_0xd930('0xfe'),_0xd930('0xff'),_0x556470,client9001)[_0xd930('0x16')](function(){return _0x13e0e3;})['catch'](function(_0x4fe3da){logger[_0xd930('0x1a')](_0x4fe3da);});}return;})[_0xd930('0x16')](function(){if(_0x13e0e3){return _0x13e0e3;}})[_0xd930('0x16')](respondWithResult(_0xcfa1c6,null))[_0xd930('0x6a')](function(){for(var _0x4dfea5 of _0x3c716f){var _0x274628=path['join'](config['root'],_0xd930('0xe4'),_0xd930('0xd6'),_0xd930('0xe5'),_0xd930('0xe6'),_0x4dfea5[_0xd930('0x100')]);fs_extra[_0xd930('0x101')](_0x274628)['catch'](function(_0x38623e){logger[_0xd930('0x1a')]('Could\x20not\x20remove\x20attachment\x20file',_0x274628,_0x38623e);});}});};exports[_0xd930('0x102')]=function(_0x4d2342,_0x1c2c12){return db[_0xd930('0xbd')][_0xd930('0x6e')]({'where':{'id':_0x4d2342[_0xd930('0x6c')]['id']}})['then'](handleEntityNotFound(_0x1c2c12,null))[_0xd930('0x16')](function(_0x3b9aef){if(_0x3b9aef){return _0x3b9aef[_0xd930('0x102')](_0x4d2342[_0xd930('0x75')]['ids'],_[_0xd930('0x103')](_0x4d2342[_0xd930('0x75')],[_0xd930('0x104'),'id'])||{});}})[_0xd930('0x16')](respondWithResult(_0x1c2c12,null))[_0xd930('0x6a')](handleError(_0x1c2c12,null));};exports[_0xd930('0x105')]=function(_0xf32e,_0x31c77d){var _0x310d7c={'raw':![],'where':{}};var _0x522530={};var _0x463bc4={'count':0x0,'rows':[]};return db[_0xd930('0x57')][_0xd930('0x106')]({'where':{'id':_0xf32e[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x31c77d,null))[_0xd930('0x16')](function(_0x5a14d){if(_0x5a14d){_0x522530[_0xd930('0x50')]=_[_0xd930('0x78')](db[_0xd930('0xbd')][_0xd930('0x58')]);_0x522530[_0xd930('0x5b')]=_[_0xd930('0x78')](_0xf32e[_0xd930('0x5b')]);_0x522530[_0xd930('0x5c')]=_['intersection'](_0x522530[_0xd930('0x50')],_0x522530[_0xd930('0x5b')]);_0x310d7c[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x522530[_0xd930('0x50')],qs[_0xd930('0x5f')](_0xf32e[_0xd930('0x5b')][_0xd930('0x5f')]));_0x310d7c[_0xd930('0x5e')]=_0x310d7c[_0xd930('0x5e')]['length']?_0x310d7c[_0xd930('0x5e')]:_0x522530[_0xd930('0x50')];if(!_0xf32e[_0xd930('0x5b')]['hasOwnProperty'](_0xd930('0x7a'))){_0x310d7c['limit']=qs[_0xd930('0x23')](_0xf32e['query'][_0xd930('0x23')]);_0x310d7c[_0xd930('0x25')]=qs[_0xd930('0x25')](_0xf32e[_0xd930('0x5b')][_0xd930('0x25')]);}_0x310d7c[_0xd930('0x7b')]=qs[_0xd930('0x62')](_0xf32e[_0xd930('0x5b')][_0xd930('0x62')]);_0x310d7c[_0xd930('0x63')]=qs[_0xd930('0x5c')](_[_0xd930('0x81')](_0xf32e[_0xd930('0x5b')],_0x522530[_0xd930('0x5c')]));_0x310d7c['where'][_0xd930('0x7c')]=_0x5a14d['id'];if(_0xf32e[_0xd930('0x5b')]['filter']){_0x310d7c[_0xd930('0x63')]=_['merge'](_0x310d7c[_0xd930('0x63')],{'$or':_[_0xd930('0x3b')](_0x310d7c[_0xd930('0x5e')],function(_0x265bb8){var _0x2f4d44={};_0x2f4d44[_0x265bb8]={'$like':'%'+_0xf32e[_0xd930('0x5b')][_0xd930('0x64')]+'%'};return _0x2f4d44;})});}_0x310d7c=_['merge']({},_0x310d7c,_0xf32e[_0xd930('0x6d')]);return db['ChatInteraction'][_0xd930('0x24')]({'where':_0x310d7c['where']})[_0xd930('0x16')](function(_0x2947c0){_0x463bc4['count']=_0x2947c0;if(_0xf32e[_0xd930('0x5b')]['includeAll']){_0x310d7c[_0xd930('0x68')]=[{'model':db[_0xd930('0x9e')],'as':_0xd930('0x107'),'required':![]},{'model':db[_0xd930('0xc7')],'as':_0xd930('0x108'),'attributes':[_0xd930('0x2d'),_0xd930('0x109'),_0xd930('0x10a')],'required':![]},{'model':db[_0xd930('0x10b')],'as':_0xd930('0x10c'),'attributes':['id','name','color'],'where':_0xf32e[_0xd930('0x5b')][_0xd930('0x10d')]?{'id':_0xf32e[_0xd930('0x5b')][_0xd930('0x10d')]}:undefined,'required':_0xf32e[_0xd930('0x5b')]['tag']?!![]:![]}];}return db[_0xd930('0xbd')]['findAll'](_0x310d7c);})[_0xd930('0x16')](function(_0x398c94){_0x463bc4['rows']=_0x398c94;return _0x463bc4;});}})[_0xd930('0x16')](respondWithFilteredResult(_0x31c77d,_0x310d7c))['catch'](handleError(_0x31c77d,null));};exports[_0xd930('0x30')]=function(_0xe750e4,_0x4c88b0){var _0x6dfa1b=0x0;var _0x581968=0x0;var _0xedc4db=![];var _0x185847;var _0x254f6c;return db[_0xd930('0x57')]['find']({'where':{'id':_0xe750e4['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xd930('0x3c')],'as':_0xd930('0x3d'),'attributes':['id','interval']}]}]})[_0xd930('0x16')](handleEntityNotFound(_0x4c88b0,null))[_0xd930('0x16')](function(_0x525ba6){if(_0x525ba6){_0x185847=_0x525ba6;return _0x525ba6[_0xd930('0x10e')]({'raw':!![]});}})[_0xd930('0x16')](function(_0x1f661f){if(_0x185847){if(_0x1f661f){_0x254f6c=_0x1f661f;}}return require(_0xd930('0x8d'))[_0xd930('0x10f')]();})[_0xd930('0x16')](function(_0x192a23){if(_0x192a23){_0x581968=_0x192a23[_0xd930('0x110')];_0xedc4db=_0x192a23[_0xd930('0x8e')];}})[_0xd930('0x16')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0xd67fe){_0x6dfa1b=_0xd67fe;if(_0x581968&&_0xd67fe>_0x581968){return db[_0xd930('0x111')][_0xd930('0x106')]({'where':{'id':0x1}})[_0xd930('0x16')](function(_0xc46a37){if(_0xc46a37){_0xc46a37['increment'](_0xd930('0x112'));}});}})[_0xd930('0x16')](function(){if(!_0x185847['Interval']||!_0x185847[_0xd930('0x3c')][_0xd930('0x3d')])return!![];return checkWebsiteIntervals(_0x185847);})['then'](function(_0x2d6527){var _0x58e1fe=fs[_0xd930('0xdd')](path[_0xd930('0x8f')](config[_0xd930('0x90')],_0xd930('0x113')),_0xd930('0xde'));var _0x4cfeee=new url[(_0xd930('0x114'))](_0x185847[_0xd930('0x115')])[_0xd930('0x116')];var _0x107a14=_0xd930('0x117');var _0x189320=![];var _0x5495e8={'chatVersion':_0x107a14,'chatWebsiteAddressOrigin':_0x4cfeee,'remote':_0x185847[_0xd930('0x118')],'query':querystring[_0xd930('0x19')](_[_0xd930('0x65')](_0x185847[_0xd930('0x2a')]({'plain':!![]}),{'customerIp':_0xe750e4[_0xd930('0xba')][_0xd930('0x44')]||_0xe750e4[_0xd930('0xba')][_0xd930('0x119')]||_0xe750e4[_0xd930('0x11a')][_0xd930('0x11b')]||_0xe750e4['ip'],'referer':_0xe750e4[_0xd930('0xba')]['referer'],'openedInteractions':_0x6dfa1b,'maxInteractions':_0x581968,'virtual':_0xedc4db['virtual'],'online':_0x2d6527,'custom':_0xedc4db}))['replace'](/'/g,'\x5c\x27')};_0x4c88b0[_0xd930('0x2e')](ejs[_0xd930('0xdf')](Mustache[_0xd930('0xdf')](_0x58e1fe,_0x5495e8),{'proactiveActions':_0x254f6c,'alignment':_0x185847[_0xd930('0x11c')],'verticalAlignment':_0x185847[_0xd930('0x11d')],'div_color':_0x185847[_0xd930('0x11e')],'labelText':_0x185847['labelText'],'text_color':_0x185847['textColor'],'text_button_color':_0x185847[_0xd930('0x11f')],'button_color':_0x185847[_0xd930('0x120')],'background_color':_0x185847['backgroundColor'],'hideWhenOffline':_0x185847['hideWhenOffline'],'intervalId':_0x185847[_0xd930('0x121')],'isDevelopment':_0x189320,'chatVersion':_0x107a14}));})[_0xd930('0x6a')](handleError(_0x4c88b0,null));};exports[_0xd930('0x122')]=function(_0x2b86ad,_0x1bc214){var _0x59dc78=_0x2b86ad['params']['id'];var _0xabb659=_0x2b86ad['body'];var _0x3868de=0xc8;var _0x2cce13=null;return db[_0xd930('0xe9')]['transaction']({'isolationLevel':db['sequelize'][_0xd930('0x123')][_0xd930('0x124')]['READ_COMMITTED']},function(_0x31c323){return db['ChatWebsite']['findOne']({'where':{'id':_0x59dc78},'transaction':_0x31c323})[_0xd930('0x16')](function(_0x5de709){if(_0x5de709){return db[_0xd930('0xb0')][_0xd930('0x29')]({'where':{'ChatWebsiteId':_0x59dc78},'transaction':_0x31c323})['then'](function(){var _0x3d2a36=_[_0xd930('0x3b')](_0xabb659,function(_0x5d578a){_0x5d578a[_0xd930('0x7c')]=_0x59dc78;return _0x5d578a;});return db[_0xd930('0xb0')]['bulkCreate'](_0x3d2a36,{'transaction':_0x31c323});});}else{_0x3868de=0x194;_0x2cce13=[];}});})['then'](function(){if(_0x3868de!==0x194){return db['ChatApplication'][_0xd930('0x125')]({'where':{'ChatWebsiteId':_0x59dc78},'order':_0xd930('0xb6')})[_0xd930('0x16')](function(_0x5eac9c){_0x2cce13=_0x5eac9c;});}})[_0xd930('0x6a')](function(_0x40828a){_0x3868de=0x1f4;logger[_0xd930('0x1a')](_0x40828a[_0xd930('0x126')]);if(_0x40828a[_0xd930('0x2d')]){delete _0x40828a[_0xd930('0x2d')];}_0x2cce13=_0x40828a;})[_0xd930('0x127')](function(){if(_0x2cce13===null){_0x1bc214[_0xd930('0x1f')](_0x3868de);}else{if(_0x3868de===0x1f4){_0x1bc214[_0xd930('0x20')](_0x3868de)['send'](_0x2cce13);}else{_0x1bc214[_0xd930('0x20')](_0x3868de)['json'](_0x2cce13);}}});};exports[_0xd930('0x128')]=function(_0x473686,_0x50ed71){var _0x3bf448={};var _0x30ea52={};var _0x2a3a74;var _0xfbd782;return db['ChatWebsite']['findOne']({'where':{'id':_0x473686[_0xd930('0x6c')]['id']}})['then'](handleEntityNotFound(_0x50ed71,null))[_0xd930('0x16')](function(_0x2d9ec9){if(_0x2d9ec9){_0x2a3a74=_0x2d9ec9;_0x30ea52[_0xd930('0x50')]=_['keys'](db[_0xd930('0xb0')][_0xd930('0x58')]);_0x30ea52['query']=_[_0xd930('0x78')](_0x473686['query']);_0x30ea52['filters']=_[_0xd930('0x5d')](_0x30ea52[_0xd930('0x50')],_0x30ea52['query']);_0x3bf448['attributes']=_['intersection'](_0x30ea52['model'],qs[_0xd930('0x5f')](_0x473686['query'][_0xd930('0x5f')]));_0x3bf448['attributes']=_0x3bf448[_0xd930('0x5e')][_0xd930('0x60')]?_0x3bf448[_0xd930('0x5e')]:_0x30ea52[_0xd930('0x50')];_0x3bf448['order']=qs[_0xd930('0x62')](_0x473686[_0xd930('0x5b')][_0xd930('0x62')]);_0x3bf448[_0xd930('0x63')]=qs[_0xd930('0x5c')](_['pick'](_0x473686[_0xd930('0x5b')],_0x30ea52[_0xd930('0x5c')]));if(_0x473686[_0xd930('0x5b')]['filter']){_0x3bf448[_0xd930('0x63')]=_[_0xd930('0x65')](_0x3bf448[_0xd930('0x63')],{'$or':_[_0xd930('0x3b')](_0x3bf448[_0xd930('0x5e')],function(_0x2a5b3d){var _0x436422={};_0x436422[_0x2a5b3d]={'$like':'%'+_0x473686[_0xd930('0x5b')][_0xd930('0x64')]+'%'};return _0x436422;})});}_0x3bf448=_[_0xd930('0x65')]({},_0x3bf448,_0x473686['options']);return _0x2a3a74[_0xd930('0x128')](_0x3bf448);}})[_0xd930('0x16')](function(_0x2912fb){if(_0x2912fb){_0xfbd782=_0x2912fb['length'];if(!_0x473686[_0xd930('0x5b')]['hasOwnProperty'](_0xd930('0x7a'))){_0x3bf448[_0xd930('0x23')]=qs['limit'](_0x473686[_0xd930('0x5b')]['limit']);_0x3bf448[_0xd930('0x25')]=qs['offset'](_0x473686[_0xd930('0x5b')][_0xd930('0x25')]);}return _0x2a3a74[_0xd930('0x128')](_0x3bf448);}})[_0xd930('0x16')](function(_0x371e7e){if(_0x371e7e){return _0x371e7e?{'count':_0xfbd782,'rows':_0x371e7e}:null;}})[_0xd930('0x16')](respondWithResult(_0x50ed71,null))[_0xd930('0x6a')](handleError(_0x50ed71,null));};exports['addProactiveActions']=function(_0x4eb7ec,_0xbd24fc){return db[_0xd930('0x129')]['find']({'where':{'id':_0x4eb7ec[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0xbd24fc,null))['then'](function(_0x221294){if(_0x221294){return _0x221294[_0xd930('0x12a')](_0x4eb7ec['body']['ids'],_[_0xd930('0x103')](_0x4eb7ec[_0xd930('0x75')],[_0xd930('0x104'),'id'])||{});}})[_0xd930('0x16')](respondWithResult(_0xbd24fc,null))[_0xd930('0x6a')](handleError(_0xbd24fc,null));};exports[_0xd930('0x10e')]=function(_0x3ce23a,_0x1c435b){var _0x22dbb9={};var _0x2df1af={};var _0x1a84c6;var _0x51a445;return db[_0xd930('0x57')][_0xd930('0x106')]({'where':{'id':_0x3ce23a[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x1c435b,null))[_0xd930('0x16')](function(_0x1c15ba){if(_0x1c15ba){_0x1a84c6=_0x1c15ba;_0x2df1af[_0xd930('0x50')]=_[_0xd930('0x78')](db[_0xd930('0x12b')][_0xd930('0x58')]);_0x2df1af[_0xd930('0x5b')]=_['keys'](_0x3ce23a[_0xd930('0x5b')]);_0x2df1af[_0xd930('0x5c')]=_['intersection'](_0x2df1af[_0xd930('0x50')],_0x2df1af[_0xd930('0x5b')]);_0x22dbb9[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x2df1af[_0xd930('0x50')],qs[_0xd930('0x5f')](_0x3ce23a[_0xd930('0x5b')][_0xd930('0x5f')]));_0x22dbb9[_0xd930('0x5e')]=_0x22dbb9[_0xd930('0x5e')][_0xd930('0x60')]?_0x22dbb9[_0xd930('0x5e')]:_0x2df1af[_0xd930('0x50')];_0x22dbb9[_0xd930('0x7b')]=qs['sort'](_0x3ce23a[_0xd930('0x5b')][_0xd930('0x62')]);_0x22dbb9['where']=qs[_0xd930('0x5c')](_[_0xd930('0x81')](_0x3ce23a[_0xd930('0x5b')],_0x2df1af[_0xd930('0x5c')]));if(_0x3ce23a[_0xd930('0x5b')][_0xd930('0x64')]){_0x22dbb9[_0xd930('0x63')]=_[_0xd930('0x65')](_0x22dbb9[_0xd930('0x63')],{'$or':_[_0xd930('0x3b')](_0x22dbb9[_0xd930('0x5e')],function(_0x51d893){var _0x4fcabb={};_0x4fcabb[_0x51d893]={'$like':'%'+_0x3ce23a['query'][_0xd930('0x64')]+'%'};return _0x4fcabb;})});}_0x22dbb9=_[_0xd930('0x65')]({},_0x22dbb9,_0x3ce23a[_0xd930('0x6d')]);return _0x1a84c6[_0xd930('0x10e')](_0x22dbb9);}})['then'](function(_0x17f4c7){if(_0x17f4c7){_0x51a445=_0x17f4c7[_0xd930('0x60')];if(!_0x3ce23a[_0xd930('0x5b')]['hasOwnProperty'](_0xd930('0x7a'))){_0x22dbb9['limit']=qs[_0xd930('0x23')](_0x3ce23a[_0xd930('0x5b')][_0xd930('0x23')]);_0x22dbb9[_0xd930('0x25')]=qs[_0xd930('0x25')](_0x3ce23a['query']['offset']);}return _0x1a84c6[_0xd930('0x10e')](_0x22dbb9);}})[_0xd930('0x16')](function(_0x1ea387){if(_0x1ea387){return _0x1ea387?{'count':_0x51a445,'rows':_0x1ea387}:null;}})[_0xd930('0x16')](respondWithResult(_0x1c435b,null))[_0xd930('0x6a')](handleError(_0x1c435b,null));};exports['getFields']=function(_0x319be5,_0x2bb0d3){var _0x4bd7e1=_0x319be5['query']['online']==='false'?_0xd930('0x12c'):'onlineForm';return db[_0xd930('0x57')][_0xd930('0x6e')]({'attributes':['id',_0x4bd7e1],'where':{'id':_0x319be5[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x2bb0d3,null))[_0xd930('0x16')](function(_0x3bbad5){if(_0x3bbad5){var _0x39292c=_0x3bbad5[_0x4bd7e1];var _0x133bcb=_0x39292c&&_0x39292c[_0xd930('0x12d')]?_0x39292c[_0xd930('0x12d')]:[];_0x2bb0d3[_0xd930('0x2e')]({'fromKey':_[_0xd930('0x94')](_0x39292c[_0xd930('0x12e')])?undefined:_0x39292c[_0xd930('0x12e')],'count':_0x133bcb[_0xd930('0x60')],'rows':_0x133bcb});}})[_0xd930('0x6a')](handleError(_0x2bb0d3,null));};exports[_0xd930('0x12f')]=function(_0x41c312,_0x3a0cb9){var _0xfd2765={'raw':![],'where':{}};var _0x6988b8={};var _0x469015={'count':0x0,'rows':[]};return db[_0xd930('0x57')][_0xd930('0x106')]({'where':{'id':_0x41c312[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x3a0cb9,null))['then'](function(_0x59c88f){if(_0x59c88f){_0x6988b8['model']=_[_0xd930('0x78')](db[_0xd930('0xe2')][_0xd930('0x58')]);_0x6988b8['query']=_[_0xd930('0x78')](_0x41c312[_0xd930('0x5b')]);_0x6988b8[_0xd930('0x5c')]=_['intersection'](_0x6988b8[_0xd930('0x50')],_0x6988b8[_0xd930('0x5b')]);_0xfd2765[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x6988b8[_0xd930('0x50')],qs[_0xd930('0x5f')](_0x41c312['query']['fields']));_0xfd2765[_0xd930('0x5e')]=_0xfd2765[_0xd930('0x5e')][_0xd930('0x60')]?_0xfd2765[_0xd930('0x5e')]:_0x6988b8['model'];if(!_0x41c312[_0xd930('0x5b')][_0xd930('0x61')](_0xd930('0x7a'))){_0xfd2765['limit']=qs[_0xd930('0x23')](_0x41c312[_0xd930('0x5b')][_0xd930('0x23')]);_0xfd2765[_0xd930('0x25')]=qs[_0xd930('0x25')](_0x41c312['query'][_0xd930('0x25')]);}_0xfd2765[_0xd930('0x7b')]=qs[_0xd930('0x62')](_0x41c312[_0xd930('0x5b')][_0xd930('0x62')]);_0xfd2765[_0xd930('0x63')]=qs[_0xd930('0x5c')](_['pick'](_0x41c312['query'],_0x6988b8['filters']));_0xfd2765[_0xd930('0x63')][_0xd930('0x7c')]=_0x59c88f['id'];if(_0x41c312['query'][_0xd930('0x64')]){_0xfd2765[_0xd930('0x63')]=_[_0xd930('0x65')](_0xfd2765[_0xd930('0x63')],{'$or':_['map'](_0xfd2765[_0xd930('0x5e')],function(_0x3a99ba){var _0x15097c={};_0x15097c[_0x3a99ba]={'$like':'%'+_0x41c312['query']['filter']+'%'};return _0x15097c;})});}_0xfd2765=_['merge']({},_0xfd2765,_0x41c312[_0xd930('0x6d')]);return db[_0xd930('0xe2')][_0xd930('0x24')]({'where':_0xfd2765[_0xd930('0x63')]})['then'](function(_0x4aba6d){_0x469015[_0xd930('0x24')]=_0x4aba6d;if(_0x41c312['query']['includeAll']){_0xfd2765[_0xd930('0x68')]=[{'all':!![]}];}else{_0xfd2765[_0xd930('0x68')]=[{'model':db[_0xd930('0x9e')],'as':_0xd930('0x107'),'required':![]},{'model':db[_0xd930('0xeb')],'as':'Attachments','required':![]}];}return db[_0xd930('0xe2')][_0xd930('0x82')](_0xfd2765);})[_0xd930('0x16')](function(_0x24925b){_0x469015[_0xd930('0x69')]=_0x24925b;return _0x469015;});}})[_0xd930('0x16')](respondWithFilteredResult(_0x3a0cb9,_0xfd2765))['catch'](handleError(_0x3a0cb9,null));};exports['addAgents']=function(_0x3579cf,_0x24a6df){return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x3579cf[_0xd930('0x6c')]['id']}})[_0xd930('0x16')](handleEntityNotFound(_0x24a6df,null))[_0xd930('0x16')](function(_0x317f4a){if(_0x317f4a){return _0x317f4a[_0xd930('0x130')](_0x3579cf[_0xd930('0x75')][_0xd930('0x104')],_['omit'](_0x3579cf[_0xd930('0x75')],[_0xd930('0x104'),'id'])||{})[_0xd930('0xb2')](function(_0x3379cd){for(var _0x40e9c7=0x0;_0x40e9c7<_0x3579cf['body'][_0xd930('0x104')][_0xd930('0x60')];_0x40e9c7+=0x1){socket[_0xd930('0x131')](_0xd930('0x132'),{'UserId':Number(_0x3579cf[_0xd930('0x75')][_0xd930('0x104')][_0x40e9c7]),'ChatWebsiteId':Number(_0x3579cf['params']['id'])});}return _0x3379cd;});}})['then'](respondWithResult(_0x24a6df,null))[_0xd930('0x6a')](handleError(_0x24a6df,null));};exports['removeAgents']=function(_0x1ebe56,_0x3486f3){return db[_0xd930('0x57')][_0xd930('0x6e')]({'where':{'id':_0x1ebe56[_0xd930('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3486f3,null))['then'](function(_0x244c5b){if(_0x244c5b){return _0x244c5b[_0xd930('0x133')](_0x1ebe56[_0xd930('0x5b')][_0xd930('0x104')])['then'](function(){if(_[_0xd930('0x134')](_0x1ebe56[_0xd930('0x5b')][_0xd930('0x104')])){for(var _0x118a52=0x0;_0x118a52<_0x1ebe56[_0xd930('0x5b')]['ids'][_0xd930('0x60')];_0x118a52+=0x1){socket[_0xd930('0x131')](_0xd930('0x135'),{'UserId':Number(_0x1ebe56[_0xd930('0x5b')]['ids'][_0x118a52]),'ChatWebsiteId':Number(_0x1ebe56[_0xd930('0x6c')]['id'])});}}else{socket[_0xd930('0x131')](_0xd930('0x135'),{'UserId':Number(_0x1ebe56['query'][_0xd930('0x104')]),'ChatWebsiteId':Number(_0x1ebe56[_0xd930('0x6c')]['id'])});}});}})[_0xd930('0x16')](respondWithStatusCode(_0x3486f3,null))['catch'](handleError(_0x3486f3,null));};exports['getAgents']=function(_0x21600a,_0x125eca){var _0x55e672={};var _0x217ca2={};var _0x5bdd8c;var _0x213d02;return db['ChatWebsite'][_0xd930('0x106')]({'where':{'id':_0x21600a[_0xd930('0x6c')]['id']}})['then'](handleEntityNotFound(_0x125eca,null))[_0xd930('0x16')](function(_0x42fffc){if(_0x42fffc){_0x5bdd8c=_0x42fffc;_0x217ca2['model']=_[_0xd930('0x78')](db[_0xd930('0xc7')][_0xd930('0x58')]);_0x217ca2[_0xd930('0x5b')]=_[_0xd930('0x78')](_0x21600a['query']);_0x217ca2[_0xd930('0x5c')]=_[_0xd930('0x5d')](_0x217ca2[_0xd930('0x50')],_0x217ca2[_0xd930('0x5b')]);_0x55e672[_0xd930('0x5e')]=_[_0xd930('0x5d')](_0x217ca2[_0xd930('0x50')],qs[_0xd930('0x5f')](_0x21600a['query'][_0xd930('0x5f')]));_0x55e672[_0xd930('0x5e')]=_0x55e672[_0xd930('0x5e')]['length']?_0x55e672[_0xd930('0x5e')]:_0x217ca2[_0xd930('0x50')];_0x55e672[_0xd930('0x7b')]=qs[_0xd930('0x62')](_0x21600a[_0xd930('0x5b')][_0xd930('0x62')]);_0x55e672[_0xd930('0x63')]=qs[_0xd930('0x5c')](_[_0xd930('0x81')](_0x21600a['query'],_0x217ca2[_0xd930('0x5c')]));if(_0x21600a['query']['filter']){_0x55e672[_0xd930('0x63')]=_['merge'](_0x55e672['where'],{'$or':_[_0xd930('0x3b')](_0x55e672[_0xd930('0x5e')],function(_0x1198e0){var _0x3f6160={};_0x3f6160[_0x1198e0]={'$like':'%'+_0x21600a[_0xd930('0x5b')][_0xd930('0x64')]+'%'};return _0x3f6160;})});}_0x55e672=_[_0xd930('0x65')]({},_0x55e672,_0x21600a['options']);return _0x5bdd8c[_0xd930('0x136')](_0x55e672);}})[_0xd930('0x16')](function(_0x37a05f){if(_0x37a05f){_0x213d02=_0x37a05f[_0xd930('0x60')];if(!_0x21600a[_0xd930('0x5b')]['hasOwnProperty']('nolimit')){_0x55e672['limit']=qs[_0xd930('0x23')](_0x21600a[_0xd930('0x5b')][_0xd930('0x23')]);_0x55e672[_0xd930('0x25')]=qs[_0xd930('0x25')](_0x21600a[_0xd930('0x5b')][_0xd930('0x25')]);}return _0x5bdd8c[_0xd930('0x136')](_0x55e672);}})[_0xd930('0x16')](function(_0x59220f){if(_0x59220f){return _0x59220f?{'count':_0x213d02,'rows':_0x59220f}:null;}})[_0xd930('0x16')](respondWithResult(_0x125eca,null))[_0xd930('0x6a')](handleError(_0x125eca,null));}; \ No newline at end of file +var _0xa340=['true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','map','Interval','Intervals','some','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','device','vendor','model','type','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','ChatWebsite','length','create','body','UserProfileSection','find','userProfileId','autoAssociation','destroy','describe','addDisposition','params','ChatWebsiteId','getDispositions','findOne','Disposition','pick','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','chat','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','spread','account','list','applications','orderBy','priority','asc','Applications','Contacts','defaults','contact','headers','threadId','externalUrl','interaction','ChatInteraction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','Start','startRouting','EventManager','notify','offline','files','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOfflineAddress','SendMail','\x22%s\x22\x20<%s>','user','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','server','attachments','remove','addInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','virtual','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','origin','remote','x-real-ip','connection','referer','alignment','labelText','textColor','textButtonColor','IntervalId','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','stack','finally','getApplications','getProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','ejs','fs-extra','lodash','ioredis','url','../../components/parsers/qs','api','../../config/environment','APINotFoundError','../../errors/api','handleError','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','get','ChatWebsites','UserProfileResource','name','send','getSnippet','timezone','iftime\x20%s,%s','interval','format','indexOf'];(function(_0x400788,_0x371262){var _0x40f7d3=function(_0x2e3468){while(--_0x2e3468){_0x400788['push'](_0x400788['shift']());}};_0x40f7d3(++_0x371262);}(_0xa340,0xf1));var _0x0a34=function(_0x50809a,_0x13735f){_0x50809a=_0x50809a-0x0;var _0x2a3e33=_0xa340[_0x50809a];return _0x2a3e33;};'use strict';var Mustache=require('mustache');var util=require(_0x0a34('0x0'));var path=require('path');var ejs=require(_0x0a34('0x1'));var fs=require('fs');var fs_extra=require(_0x0a34('0x2'));var _=require(_0x0a34('0x3'));var querystring=require('querystring');var htmlToText=require('html-to-text');var Redis=require(_0x0a34('0x4'));var jayson=require('jayson/promise');var url=require(_0x0a34('0x5'));var qs=require(_0x0a34('0x6'));var logger=require('../../config/logger')(_0x0a34('0x7'));var config=require(_0x0a34('0x8'));var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')[_0x0a34('0x9')];var APIHandleError=require(_0x0a34('0xa'))[_0x0a34('0xb')];var db=require(_0x0a34('0xc'))['db'];config['redis']=_['defaults'](config[_0x0a34('0xd')],{'host':_0x0a34('0xe'),'port':0x18eb});var socket=require(_0x0a34('0xf'))(new Redis(config[_0x0a34('0xd')]));require(_0x0a34('0x10'))[_0x0a34('0x11')](socket);var client=jayson[_0x0a34('0x12')][_0x0a34('0x13')]({'port':0x232c});var client9002=jayson[_0x0a34('0x12')][_0x0a34('0x13')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x0a34('0x12')][_0x0a34('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x2ab88b,_0x3541cb,_0x480fab,_0x19d24d){return new Promise(function(_0x2fc1ac,_0x28eb8e){var _0x2650fd=_0x19d24d||client;return _0x2650fd[_0x0a34('0x14')](_0x2ab88b,_0x480fab)[_0x0a34('0x15')](function(_0xbedb88){logger[_0x0a34('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x3541cb,_0x0a34('0x17'));logger[_0x0a34('0x18')](_0x0a34('0x19'),_0x3541cb,'request\x20sent',JSON[_0x0a34('0x1a')](_0xbedb88));if(_0xbedb88['error']){if(_0xbedb88[_0x0a34('0x1b')][_0x0a34('0x1c')]===0x1f4){logger[_0x0a34('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x3541cb,_0xbedb88[_0x0a34('0x1b')][_0x0a34('0x1d')]);return _0x28eb8e(_0xbedb88[_0x0a34('0x1b')][_0x0a34('0x1d')]);}logger[_0x0a34('0x1b')](_0x0a34('0x1e'),_0x3541cb,_0xbedb88[_0x0a34('0x1b')][_0x0a34('0x1d')]);return _0x2fc1ac(_0xbedb88[_0x0a34('0x1b')][_0x0a34('0x1d')]);}else{logger[_0x0a34('0x16')](_0x0a34('0x1e'),_0x3541cb,_0x0a34('0x17'));_0x2fc1ac(_0xbedb88[_0x0a34('0x1f')][_0x0a34('0x1d')]);}})['catch'](function(_0x413fc4){logger[_0x0a34('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x3541cb,_0x413fc4);_0x28eb8e(_0x413fc4);});});}function respondWithStatusCode(_0x4dfe22,_0x40fd7e){_0x40fd7e=_0x40fd7e||0xcc;return function(_0x359c62){if(_0x359c62){return _0x4dfe22[_0x0a34('0x20')](_0x40fd7e);}return _0x4dfe22[_0x0a34('0x21')](_0x40fd7e)[_0x0a34('0x22')]();};}function respondWithResult(_0x37a53c,_0x1a0fd1){_0x1a0fd1=_0x1a0fd1||0xc8;return function(_0x5d05af){if(_0x5d05af){return _0x37a53c[_0x0a34('0x21')](_0x1a0fd1)[_0x0a34('0x23')](_0x5d05af);}};}function respondWithFilteredResult(_0x4de86f,_0x37ab59){return function(_0x50900f){if(_0x50900f){var _0x53c898=typeof _0x37ab59[_0x0a34('0x24')]==='undefined'&&typeof _0x37ab59['limit']===_0x0a34('0x25');var _0x5f5bf5=_0x50900f[_0x0a34('0x26')];var _0xffa637=_0x53c898?0x0:_0x37ab59['offset'];var _0x134516=_0x53c898?_0x50900f[_0x0a34('0x26')]:_0x37ab59[_0x0a34('0x24')]+_0x37ab59[_0x0a34('0x27')];var _0x481db8;if(_0x134516>=_0x5f5bf5){_0x134516=_0x5f5bf5;_0x481db8=0xc8;}else{_0x481db8=0xce;}_0x4de86f[_0x0a34('0x21')](_0x481db8);return _0x4de86f[_0x0a34('0x28')](_0x0a34('0x29'),_0xffa637+'-'+_0x134516+'/'+_0x5f5bf5)[_0x0a34('0x23')](_0x50900f);}return null;};}function saveUpdates(_0x2d5946){return function(_0x3a459d){if(_0x3a459d){return _0x3a459d[_0x0a34('0x2a')](_0x2d5946)[_0x0a34('0x15')](function(_0x364ac5){return _0x364ac5;});}return null;};}function removeEntity(_0x586fe0){return function(_0x1f542e){if(_0x1f542e){return _0x1f542e['destroy']()['then'](function(){var _0x520c53=_0x1f542e[_0x0a34('0x2b')]({'plain':!![]});var _0x32ce09=_0x0a34('0x2c');return db[_0x0a34('0x2d')]['destroy']({'where':{'type':_0x32ce09,'resourceId':_0x520c53['id']}})[_0x0a34('0x15')](function(){return _0x1f542e;});})[_0x0a34('0x15')](function(){_0x586fe0[_0x0a34('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8e3c){return function(_0x171f10){if(!_0x171f10){_0x3f8e3c[_0x0a34('0x20')](0x194);}return _0x171f10;};}function handleError(_0x5a5b56,_0x372caa){_0x372caa=_0x372caa||0x1f4;return function(_0x3a264f){logger[_0x0a34('0x1b')](_0x3a264f['stack']);if(_0x3a264f[_0x0a34('0x2e')]){delete _0x3a264f['name'];}_0x5a5b56[_0x0a34('0x21')](_0x372caa)[_0x0a34('0x2f')](_0x3a264f);};}function iftimePromise(_0x5c92b3,_0x16c954){return respondWithRpcPromise('Command',_0x0a34('0x30'),{'command':_0x16c954[_0x0a34('0x31')]?util['format'](_0x0a34('0x32'),_0x5c92b3[_0x0a34('0x33')],_0x16c954[_0x0a34('0x31')]):util[_0x0a34('0x34')]('iftime\x20%s',_0x5c92b3['interval'])},client9002)[_0x0a34('0x15')](function(_0x132d7e){var _0x5215ff=_0x132d7e&&_0x132d7e[_0x0a34('0x35')](_0x0a34('0x36'))>=0x0?!![]:![];logger[_0x0a34('0x16')](_0x0a34('0x37'),_0x16c954['id'],_0x5c92b3['id'],_0x5c92b3[_0x0a34('0x33')],_0x5215ff?'ONLINE':_0x0a34('0x38'),_0x16c954['timezone']?_0x16c954[_0x0a34('0x31')]:_0x0a34('0x39'));return _0x5215ff;})['catch'](function(_0x4196c9){logger[_0x0a34('0x1b')](_0x0a34('0x37'),_0x16c954['id'],_0x5c92b3['id'],_0x5c92b3[_0x0a34('0x33')],util['inspect'](_0x4196c9,{'showHidden':![],'depth':null}),_0x16c954[_0x0a34('0x31')]?_0x16c954['timezone']:_0x0a34('0x39'));return![];});}function checkWebsiteIntervals(_0x1ef0b9){var _0x5e6ea2=_[_0x0a34('0x3a')](_0x1ef0b9[_0x0a34('0x3b')][_0x0a34('0x3c')],function(_0x799483){var _0x453ca9=_0x799483[_0x0a34('0x2b')]({'plain':!![]});return iftimePromise(_0x453ca9,_0x1ef0b9);});return Promise['all'](_0x5e6ea2)[_0x0a34('0x15')](function(_0x5d4c8c){return _[_0x0a34('0x3d')](_0x5d4c8c);});}function createInteractionObject(_0x5db000,_0x4b0282,_0x309cae,_0x1589f1){var _0x3c5ba2=require(_0x0a34('0x3e'));var _0x5c9374=new _0x3c5ba2();var _0x1c7fb2=_0x5c9374[_0x0a34('0x3f')](_0x309cae['user-agent'])[_0x0a34('0x40')]();var _0x38c52e=_0x4b0282[_0x0a34('0x41')];if(_0x309cae[_0x0a34('0x42')]){_0x38c52e=_0x309cae['cf-connecting-ip'];}else if(_0x309cae[_0x0a34('0x43')]){_0x38c52e=_[_0x0a34('0x44')](_0x309cae[_0x0a34('0x43')][_0x0a34('0x45')](','));}return{'ContactId':_0x1589f1['id'],'ChatWebsiteId':_0x5db000,'from':(_0x1589f1[_0x0a34('0x46')]||'')+'\x20'+(_0x1589f1[_0x0a34('0x47')]||''),'customerIp':_0x38c52e,'customerPort':_0x309cae[_0x0a34('0x48')]?_0x309cae[_0x0a34('0x48')]:null,'referer':_0x4b0282['referer'],'browserName':_0x1c7fb2['browser'][_0x0a34('0x2e')]&&_0x1c7fb2[_0x0a34('0x49')][_0x0a34('0x4a')]?util[_0x0a34('0x34')](_0x0a34('0x4b'),_0x1c7fb2[_0x0a34('0x49')]['name'],_0x1c7fb2[_0x0a34('0x49')]['version']):'unknown','browserVersion':_0x1c7fb2[_0x0a34('0x49')][_0x0a34('0x4a')]||_0x0a34('0x4c'),'osName':util[_0x0a34('0x34')]('%s\x20%s',_0x1c7fb2['os'][_0x0a34('0x2e')],_0x1c7fb2['os'][_0x0a34('0x4a')]),'osVersion':_0x1c7fb2['os']['version'],'deviceModel':_0x1c7fb2[_0x0a34('0x4d')]['model']&&_0x1c7fb2[_0x0a34('0x4d')][_0x0a34('0x4e')]?util[_0x0a34('0x34')]('%s\x20%s\x20%s',_0x1c7fb2['device'][_0x0a34('0x4f')],_0x1c7fb2[_0x0a34('0x4d')][_0x0a34('0x4e')],_0x1c7fb2[_0x0a34('0x4d')][_0x0a34('0x50')]):null,'deviceVendor':_0x1c7fb2['device'][_0x0a34('0x4e')],'deviceType':_0x1c7fb2[_0x0a34('0x4d')][_0x0a34('0x50')],'formData':JSON[_0x0a34('0x1a')](_0x4b0282)};}exports['index']=function(_0x5ae405,_0x52f9e9){var _0x3360cb={'include':[{'model':db[_0x0a34('0x51')],'as':_0x0a34('0x52')}]},_0x594e65={},_0x1d2e73={'count':0x0,'rows':[]};var _0x3a9850=_[_0x0a34('0x3a')](db['ChatWebsite'][_0x0a34('0x53')],function(_0x2a5e73){return{'name':_0x2a5e73[_0x0a34('0x54')],'type':_0x2a5e73[_0x0a34('0x50')][_0x0a34('0x55')]};});_0x594e65[_0x0a34('0x4f')]=_['map'](_0x3a9850,_0x0a34('0x2e'));_0x594e65[_0x0a34('0x56')]=_[_0x0a34('0x57')](_0x5ae405[_0x0a34('0x56')]);_0x594e65[_0x0a34('0x58')]=_[_0x0a34('0x59')](_0x594e65['model'],_0x594e65['query']);_0x3360cb[_0x0a34('0x5a')]=_[_0x0a34('0x59')](_0x594e65[_0x0a34('0x4f')],qs[_0x0a34('0x5b')](_0x5ae405['query'][_0x0a34('0x5b')]));_0x3360cb['attributes']=_0x3360cb['attributes']['length']?_0x3360cb['attributes']:_0x594e65[_0x0a34('0x4f')];if(!_0x5ae405[_0x0a34('0x56')][_0x0a34('0x5c')](_0x0a34('0x5d'))){_0x3360cb[_0x0a34('0x27')]=qs[_0x0a34('0x27')](_0x5ae405[_0x0a34('0x56')][_0x0a34('0x27')]);_0x3360cb[_0x0a34('0x24')]=qs[_0x0a34('0x24')](_0x5ae405[_0x0a34('0x56')][_0x0a34('0x24')]);}_0x3360cb[_0x0a34('0x5e')]=qs[_0x0a34('0x5f')](_0x5ae405[_0x0a34('0x56')][_0x0a34('0x5f')]);_0x3360cb[_0x0a34('0x60')]=qs[_0x0a34('0x58')](_['pick'](_0x5ae405[_0x0a34('0x56')],_0x594e65[_0x0a34('0x58')]),_0x3a9850);if(_0x5ae405[_0x0a34('0x56')][_0x0a34('0x61')]){_0x3360cb[_0x0a34('0x60')]=_[_0x0a34('0x62')](_0x3360cb['where'],{'$or':_['map'](_0x3a9850,function(_0x4c5332){if(_0x4c5332[_0x0a34('0x50')]!==_0x0a34('0x63')){var _0xf32c41={};_0xf32c41[_0x4c5332[_0x0a34('0x2e')]]={'$like':'%'+_0x5ae405[_0x0a34('0x56')]['filter']+'%'};return _0xf32c41;}})});}_0x3360cb=_[_0x0a34('0x62')]({},_0x3360cb,_0x5ae405[_0x0a34('0x64')]);var _0x118134={'where':_0x3360cb['where']};return db['ChatWebsite'][_0x0a34('0x26')](_0x118134)['then'](function(_0x581696){_0x1d2e73[_0x0a34('0x26')]=_0x581696;if(_0x5ae405[_0x0a34('0x56')][_0x0a34('0x65')]){_0x3360cb[_0x0a34('0x66')]=[{'all':!![]}];}return db['ChatWebsite'][_0x0a34('0x67')](_0x3360cb);})['then'](function(_0x3ea369){_0x1d2e73[_0x0a34('0x68')]=_0x3ea369;return _0x1d2e73;})['then'](respondWithFilteredResult(_0x52f9e9,_0x3360cb))[_0x0a34('0x69')](handleError(_0x52f9e9,null));};exports[_0x0a34('0x6a')]=function(_0x1a847b,_0x20fc12){var _0x1c42b3={'raw':![],'where':{'id':_0x1a847b['params']['id']},'include':[{'model':db['Pause'],'as':_0x0a34('0x52')}]},_0x1f745c={};_0x1f745c['model']=_[_0x0a34('0x57')](db[_0x0a34('0x6b')][_0x0a34('0x53')]);_0x1f745c[_0x0a34('0x56')]=_['keys'](_0x1a847b[_0x0a34('0x56')]);_0x1f745c['filters']=_[_0x0a34('0x59')](_0x1f745c[_0x0a34('0x4f')],_0x1f745c[_0x0a34('0x56')]);_0x1c42b3[_0x0a34('0x5a')]=_[_0x0a34('0x59')](_0x1f745c['model'],qs[_0x0a34('0x5b')](_0x1a847b['query'][_0x0a34('0x5b')]));_0x1c42b3[_0x0a34('0x5a')]=_0x1c42b3[_0x0a34('0x5a')][_0x0a34('0x6c')]?_0x1c42b3[_0x0a34('0x5a')]:_0x1f745c[_0x0a34('0x4f')];if(_0x1a847b['query']['includeAll']){_0x1c42b3['include']=[{'all':!![]}];}_0x1c42b3=_[_0x0a34('0x62')]({},_0x1c42b3,_0x1a847b[_0x0a34('0x64')]);return db[_0x0a34('0x6b')]['find'](_0x1c42b3)[_0x0a34('0x15')](handleEntityNotFound(_0x20fc12,null))['then'](respondWithResult(_0x20fc12,null))[_0x0a34('0x69')](handleError(_0x20fc12,null));};exports[_0x0a34('0x6d')]=function(_0x2ef28a,_0x2d937a){return db[_0x0a34('0x6b')][_0x0a34('0x6d')](_0x2ef28a[_0x0a34('0x6e')],{})[_0x0a34('0x15')](function(_0x52dd30){var _0x542c76=_0x2ef28a['user']['get']({'plain':!![]});if(!_0x542c76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x542c76['role']==='user'){var _0x1fec7f=_0x52dd30['get']({'plain':!![]});var _0x5b7729='ChatWebsites';return db[_0x0a34('0x6f')][_0x0a34('0x70')]({'where':{'name':_0x5b7729,'userProfileId':_0x542c76[_0x0a34('0x71')]},'raw':!![]})[_0x0a34('0x15')](function(_0x449117){if(_0x449117&&_0x449117[_0x0a34('0x72')]===0x0){return db[_0x0a34('0x2d')][_0x0a34('0x6d')]({'name':_0x1fec7f[_0x0a34('0x2e')],'resourceId':_0x1fec7f['id'],'type':_0x449117[_0x0a34('0x2e')],'sectionId':_0x449117['id']},{})['then'](function(){return _0x52dd30;});}else{return _0x52dd30;}})[_0x0a34('0x69')](function(_0x1f0f09){logger[_0x0a34('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0f09);throw _0x1f0f09;});}return _0x52dd30;})['then'](respondWithResult(_0x2d937a,0xc9))[_0x0a34('0x69')](handleError(_0x2d937a,null));};exports[_0x0a34('0x2a')]=function(_0x9302af,_0x20ca8c){if(_0x9302af[_0x0a34('0x6e')]['id']){delete _0x9302af['body']['id'];}return db['ChatWebsite'][_0x0a34('0x70')]({'where':{'id':_0x9302af['params']['id']},'include':[{'model':db[_0x0a34('0x51')],'as':'mandatoryDispositionPause'}]})[_0x0a34('0x15')](handleEntityNotFound(_0x20ca8c,null))['then'](saveUpdates(_0x9302af[_0x0a34('0x6e')],null))[_0x0a34('0x15')](respondWithResult(_0x20ca8c,null))[_0x0a34('0x69')](handleError(_0x20ca8c,null));};exports[_0x0a34('0x73')]=function(_0x5bfc6f,_0x51ec37){return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x5bfc6f['params']['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x51ec37,null))[_0x0a34('0x15')](removeEntity(_0x51ec37,null))[_0x0a34('0x69')](handleError(_0x51ec37,null));};exports[_0x0a34('0x74')]=function(_0x51fcdd,_0x499057){return db[_0x0a34('0x6b')][_0x0a34('0x74')]()['then'](respondWithResult(_0x499057,null))[_0x0a34('0x69')](handleError(_0x499057,null));};exports[_0x0a34('0x75')]=function(_0x2a1d96,_0x1d3c1a){if(_0x2a1d96['body']['id']){delete _0x2a1d96[_0x0a34('0x6e')]['id'];}return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x2a1d96[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x1d3c1a,null))[_0x0a34('0x15')](function(_0x5bbbc2){if(_0x5bbbc2){_0x2a1d96[_0x0a34('0x6e')][_0x0a34('0x77')]=_0x5bbbc2['id'];return db['Disposition'][_0x0a34('0x6d')](_0x2a1d96[_0x0a34('0x6e')]);}})[_0x0a34('0x15')](respondWithResult(_0x1d3c1a,null))['catch'](handleError(_0x1d3c1a,null));};exports[_0x0a34('0x78')]=function(_0x5ac7e8,_0x2595c7){var _0x4bfd28={'raw':![],'where':{}};var _0x9cd561={};var _0x4b22cf={'count':0x0,'rows':[]};return db[_0x0a34('0x6b')][_0x0a34('0x79')]({'where':{'id':_0x5ac7e8['params']['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x2595c7,null))[_0x0a34('0x15')](function(_0x2647f8){if(_0x2647f8){_0x9cd561[_0x0a34('0x4f')]=_[_0x0a34('0x57')](db[_0x0a34('0x7a')][_0x0a34('0x53')]);_0x9cd561[_0x0a34('0x56')]=_[_0x0a34('0x57')](_0x5ac7e8[_0x0a34('0x56')]);_0x9cd561[_0x0a34('0x58')]=_[_0x0a34('0x59')](_0x9cd561[_0x0a34('0x4f')],_0x9cd561[_0x0a34('0x56')]);_0x4bfd28[_0x0a34('0x5a')]=_['intersection'](_0x9cd561[_0x0a34('0x4f')],qs[_0x0a34('0x5b')](_0x5ac7e8[_0x0a34('0x56')][_0x0a34('0x5b')]));_0x4bfd28['attributes']=_0x4bfd28['attributes'][_0x0a34('0x6c')]?_0x4bfd28[_0x0a34('0x5a')]:_0x9cd561[_0x0a34('0x4f')];if(!_0x5ac7e8[_0x0a34('0x56')][_0x0a34('0x5c')](_0x0a34('0x5d'))){_0x4bfd28[_0x0a34('0x27')]=qs[_0x0a34('0x27')](_0x5ac7e8[_0x0a34('0x56')]['limit']);_0x4bfd28[_0x0a34('0x24')]=qs[_0x0a34('0x24')](_0x5ac7e8[_0x0a34('0x56')]['offset']);}_0x4bfd28['order']=qs['sort'](_0x5ac7e8[_0x0a34('0x56')][_0x0a34('0x5f')]);_0x4bfd28['where']=qs[_0x0a34('0x58')](_[_0x0a34('0x7b')](_0x5ac7e8[_0x0a34('0x56')],_0x9cd561[_0x0a34('0x58')]));_0x4bfd28[_0x0a34('0x60')][_0x0a34('0x77')]=_0x2647f8['id'];if(_0x5ac7e8[_0x0a34('0x56')][_0x0a34('0x61')]){_0x4bfd28[_0x0a34('0x60')]=_[_0x0a34('0x62')](_0x4bfd28[_0x0a34('0x60')],{'$or':_[_0x0a34('0x3a')](_0x4bfd28[_0x0a34('0x5a')],function(_0x32c244){var _0x2c1e78={};_0x2c1e78[_0x32c244]={'$like':'%'+_0x5ac7e8[_0x0a34('0x56')][_0x0a34('0x61')]+'%'};return _0x2c1e78;})});}_0x4bfd28=_['merge']({},_0x4bfd28,_0x5ac7e8[_0x0a34('0x64')]);return db['Disposition']['count']({'where':_0x4bfd28[_0x0a34('0x60')]})[_0x0a34('0x15')](function(_0x590155){_0x4b22cf[_0x0a34('0x26')]=_0x590155;if(_0x5ac7e8['query']['includeAll']){_0x4bfd28[_0x0a34('0x66')]=[{'all':!![]}];}return db[_0x0a34('0x7a')][_0x0a34('0x67')](_0x4bfd28);})[_0x0a34('0x15')](function(_0x10a888){_0x4b22cf['rows']=_0x10a888;return _0x4b22cf;});}})[_0x0a34('0x15')](respondWithFilteredResult(_0x2595c7,_0x4bfd28))['catch'](handleError(_0x2595c7,null));};exports[_0x0a34('0x7c')]=function(_0x308485,_0x2dd6b0){return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x308485[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x2dd6b0,null))[_0x0a34('0x15')](function(_0x2722b4){if(_0x2722b4){return _0x2722b4[_0x0a34('0x7c')](_0x308485[_0x0a34('0x56')]['ids']);}})['then'](respondWithStatusCode(_0x2dd6b0,null))[_0x0a34('0x69')](handleError(_0x2dd6b0,null));};exports[_0x0a34('0x7d')]=function(_0x226994,_0x429128){if(_0x226994[_0x0a34('0x6e')]['id']){delete _0x226994[_0x0a34('0x6e')]['id'];}return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x226994[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x429128,null))[_0x0a34('0x15')](function(_0x141a75){if(_0x141a75){_0x226994[_0x0a34('0x6e')][_0x0a34('0x77')]=_0x141a75['id'];return db[_0x0a34('0x7e')][_0x0a34('0x6d')](_0x226994['body']);}})[_0x0a34('0x15')](respondWithResult(_0x429128,null))[_0x0a34('0x69')](handleError(_0x429128,null));};exports['getAnswers']=function(_0x8e595e,_0x2d2980){var _0x5d9a62={'raw':![],'where':{}};var _0x5008cc={};var _0x338d71={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x8e595e[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x2d2980,null))[_0x0a34('0x15')](function(_0x46cfcc){if(_0x46cfcc){_0x5008cc[_0x0a34('0x4f')]=_[_0x0a34('0x57')](db[_0x0a34('0x7e')][_0x0a34('0x53')]);_0x5008cc[_0x0a34('0x56')]=_['keys'](_0x8e595e[_0x0a34('0x56')]);_0x5008cc['filters']=_['intersection'](_0x5008cc[_0x0a34('0x4f')],_0x5008cc[_0x0a34('0x56')]);_0x5d9a62[_0x0a34('0x5a')]=_['intersection'](_0x5008cc[_0x0a34('0x4f')],qs['fields'](_0x8e595e[_0x0a34('0x56')][_0x0a34('0x5b')]));_0x5d9a62[_0x0a34('0x5a')]=_0x5d9a62['attributes'][_0x0a34('0x6c')]?_0x5d9a62[_0x0a34('0x5a')]:_0x5008cc[_0x0a34('0x4f')];if(!_0x8e595e['query'][_0x0a34('0x5c')](_0x0a34('0x5d'))){_0x5d9a62['limit']=qs[_0x0a34('0x27')](_0x8e595e[_0x0a34('0x56')][_0x0a34('0x27')]);_0x5d9a62['offset']=qs[_0x0a34('0x24')](_0x8e595e[_0x0a34('0x56')]['offset']);}_0x5d9a62['order']=qs[_0x0a34('0x5f')](_0x8e595e[_0x0a34('0x56')][_0x0a34('0x5f')]);_0x5d9a62[_0x0a34('0x60')]=qs[_0x0a34('0x58')](_[_0x0a34('0x7b')](_0x8e595e[_0x0a34('0x56')],_0x5008cc[_0x0a34('0x58')]));_0x5d9a62[_0x0a34('0x60')]['ChatWebsiteId']=_0x46cfcc['id'];if(_0x8e595e[_0x0a34('0x56')]['filter']){_0x5d9a62['where']=_['merge'](_0x5d9a62[_0x0a34('0x60')],{'$or':_[_0x0a34('0x3a')](_0x5d9a62[_0x0a34('0x5a')],function(_0x1657b4){var _0x4b0605={};_0x4b0605[_0x1657b4]={'$like':'%'+_0x8e595e[_0x0a34('0x56')][_0x0a34('0x61')]+'%'};return _0x4b0605;})});}_0x5d9a62=_[_0x0a34('0x62')]({},_0x5d9a62,_0x8e595e[_0x0a34('0x64')]);return db[_0x0a34('0x7e')][_0x0a34('0x26')]({'where':_0x5d9a62[_0x0a34('0x60')]})[_0x0a34('0x15')](function(_0x1a4874){_0x338d71[_0x0a34('0x26')]=_0x1a4874;if(_0x8e595e[_0x0a34('0x56')][_0x0a34('0x65')]){_0x5d9a62[_0x0a34('0x66')]=[{'all':!![]}];}return db[_0x0a34('0x7e')][_0x0a34('0x67')](_0x5d9a62);})['then'](function(_0xe2d7f5){_0x338d71[_0x0a34('0x68')]=_0xe2d7f5;return _0x338d71;});}})[_0x0a34('0x15')](respondWithFilteredResult(_0x2d2980,_0x5d9a62))[_0x0a34('0x69')](handleError(_0x2d2980,null));};exports[_0x0a34('0x7f')]=function(_0x1f3de1,_0x4776ca){return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x1f3de1[_0x0a34('0x76')]['id']}})['then'](handleEntityNotFound(_0x4776ca,null))[_0x0a34('0x15')](function(_0x365498){if(_0x365498){return _0x365498[_0x0a34('0x7f')](_0x1f3de1['query'][_0x0a34('0x80')]);}})['then'](respondWithStatusCode(_0x4776ca,null))['catch'](handleError(_0x4776ca,null));};exports['addLogo']=function(_0x2bc4d5,_0x14c648){_0x2bc4d5[_0x0a34('0x6e')][_0x0a34('0x81')]=_0x2bc4d5['file'][_0x0a34('0x82')];return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x2bc4d5[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x14c648,null))['then'](saveUpdates(_0x2bc4d5['body'],null))[_0x0a34('0x15')](respondWithResult(_0x14c648,null))[_0x0a34('0x69')](handleError(_0x14c648,null));};exports[_0x0a34('0x83')]=function(_0x4fcf47,_0x4672a7){_0x4fcf47[_0x0a34('0x6e')]['agentAvatar']=_0x4fcf47[_0x0a34('0x84')][_0x0a34('0x82')];return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x4fcf47[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x4672a7,null))[_0x0a34('0x15')](saveUpdates(_0x4fcf47[_0x0a34('0x6e')],null))[_0x0a34('0x15')](respondWithResult(_0x4672a7,null))[_0x0a34('0x69')](handleError(_0x4672a7,null));};exports[_0x0a34('0x85')]=function(_0x440331,_0x1881e2){_0x440331[_0x0a34('0x6e')][_0x0a34('0x86')]=_0x440331['file']['filename'];return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x440331[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x1881e2,null))[_0x0a34('0x15')](saveUpdates(_0x440331[_0x0a34('0x6e')],null))[_0x0a34('0x15')](respondWithResult(_0x1881e2,null))['catch'](handleError(_0x1881e2,null));};exports[_0x0a34('0x87')]=function(_0x425749,_0x34eb9d){_0x425749['body'][_0x0a34('0x88')]=_0x425749['file'][_0x0a34('0x82')];return db['ChatWebsite'][_0x0a34('0x70')]({'where':{'id':_0x425749[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x34eb9d,null))[_0x0a34('0x15')](saveUpdates(_0x425749[_0x0a34('0x6e')],null))[_0x0a34('0x15')](respondWithResult(_0x34eb9d,null))[_0x0a34('0x69')](handleError(_0x34eb9d,null));};exports[_0x0a34('0x89')]=function(_0x3856ad,_0x24d1dd){var _0x29348d=path['join'](config[_0x0a34('0x8a')],'server/files/images/logos/default_logo.svg');var _0xefbf0a={'where':{'id':_0x3856ad[_0x0a34('0x76')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x368d91=![];return require(_0x0a34('0x8b'))[_0x0a34('0x8c')]()[_0x0a34('0x15')](function(_0x1305de){if(_0x1305de){_0x368d91=_0x1305de[_0x0a34('0x8d')];}})[_0x0a34('0x15')](function(){return db[_0x0a34('0x6b')][_0x0a34('0x70')](_0xefbf0a);})['then'](handleEntityNotFound(_0x24d1dd,null))[_0x0a34('0x15')](function(_0x4b843f){if(_0x4b843f){if(!_[_0x0a34('0x8e')](_0x4b843f[_0x0a34('0x81')])){if(fs[_0x0a34('0x8f')](path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0x91'),_0x4b843f[_0x0a34('0x81')]))&&_0x368d91){_0x29348d=path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0x91'),_0x4b843f['sitepic']);}}return _0x24d1dd[_0x0a34('0x92')](_0x29348d);}})[_0x0a34('0x69')](handleError(_0x24d1dd,null));};exports['getAvatar']=function(_0x4c7225,_0xfca4d){var _0x12395f=path['join'](config[_0x0a34('0x8a')],_0x0a34('0x93'));var _0x375ded={'where':{'id':_0x4c7225[_0x0a34('0x76')]['id']},'attributes':['id',_0x0a34('0x94')],'raw':!![]};return db['ChatWebsite'][_0x0a34('0x70')](_0x375ded)[_0x0a34('0x15')](handleEntityNotFound(_0xfca4d,null))[_0x0a34('0x15')](function(_0x3bf427){if(_0x3bf427){if(!_['isNil'](_0x3bf427['agentAvatar'])){if(fs[_0x0a34('0x8f')](path[_0x0a34('0x90')](config[_0x0a34('0x8a')],'server/files/images/avatars/',_0x3bf427[_0x0a34('0x94')]))){_0x12395f=path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0x95'),_0x3bf427[_0x0a34('0x94')]);}}return _0xfca4d[_0x0a34('0x92')](_0x12395f);}})[_0x0a34('0x69')](handleError(_0xfca4d,null));};exports[_0x0a34('0x96')]=function(_0x5d7f0b,_0x27ddbf){var _0x100572=path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0x97'));var _0x3ef364={'where':{'id':_0x5d7f0b[_0x0a34('0x76')]['id']},'attributes':['id','customerAvatar',_0x0a34('0x98')],'raw':!![]};return db[_0x0a34('0x6b')][_0x0a34('0x70')](_0x3ef364)[_0x0a34('0x15')](handleEntityNotFound(_0x27ddbf,null))[_0x0a34('0x15')](function(_0x3a0929){if(_0x3a0929){if(!_['isNil'](_0x3a0929[_0x0a34('0x86')])){if(fs[_0x0a34('0x8f')](path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0x95'),_0x3a0929[_0x0a34('0x86')]))&&_0x3a0929[_0x0a34('0x98')]){_0x100572=path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0x95'),_0x3a0929[_0x0a34('0x86')]);}}return _0x27ddbf[_0x0a34('0x92')](_0x100572);}})[_0x0a34('0x69')](handleError(_0x27ddbf,null));};exports[_0x0a34('0x99')]=function(_0x398f40,_0x5940d7){var _0x2044b9=path['join'](config[_0x0a34('0x8a')],_0x0a34('0x9a'));var _0x6d02e8={'where':{'id':_0x398f40[_0x0a34('0x76')]['id']},'attributes':['id',_0x0a34('0x88')],'raw':!![]};return db['ChatWebsite'][_0x0a34('0x70')](_0x6d02e8)['then'](handleEntityNotFound(_0x5940d7,null))[_0x0a34('0x15')](function(_0x321ad1){if(_0x321ad1){if(!_[_0x0a34('0x8e')](_0x321ad1[_0x0a34('0x88')])){if(fs[_0x0a34('0x8f')](path['join'](config[_0x0a34('0x8a')],_0x0a34('0x95'),_0x321ad1['systemAvatar']))){_0x2044b9=path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0x95'),_0x321ad1[_0x0a34('0x88')]);}}return _0x5940d7['download'](_0x2044b9);}})[_0x0a34('0x69')](handleError(_0x5940d7,null));};exports['notify']=function(_0x15c71d,_0x1a47e3){var _0x35a535={'body':_0x15c71d['body'],'channel':_0x0a34('0x9b')};var _0x43b85f=[];var _0x1651b2=[];var _0x238df1={};var _0xe2a6e9=![];return db['CmContact'][_0x0a34('0x74')]()[_0x0a34('0x15')](function(_0x3d2022){if(!_0x3d2022){throw new db[(_0x0a34('0x9c'))]['ValidationError'](_0x0a34('0x9d'));}_0x43b85f=_[_0x0a34('0x9e')](_[_0x0a34('0x57')](_0x3d2022),[_0x0a34('0x9f'),_0x0a34('0xa0')]);_0x1651b2=_[_0x0a34('0x9e')](_['keys'](_0x3d2022),[_0x0a34('0x9f'),_0x0a34('0xa0'),'CompanyId',_0x0a34('0xa1')]);if(_0x15c71d['body']['id']){delete _0x15c71d[_0x0a34('0x6e')]['id'];}if(_['isNil'](_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xa2')])){throw new db[(_0x0a34('0x9c'))][(_0x0a34('0xa3'))](_0x0a34('0xa4'));}if(_[_0x0a34('0x8e')](_0x15c71d[_0x0a34('0x6e')][_0x0a34('0x6e')])||_0x15c71d[_0x0a34('0x6e')]['body']===''){throw new db[(_0x0a34('0x9c'))][(_0x0a34('0xa3'))](_0x0a34('0xa5'));}if(_['isNil'](_0x15c71d['body'][_0x0a34('0xa6')])){throw new db[(_0x0a34('0x9c'))][(_0x0a34('0xa3'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1651b2);}if(!_[_0x0a34('0xa7')](_0x1651b2,_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xa6')])){throw new db['Sequelize'][(_0x0a34('0xa3'))](_0x0a34('0xa8')+_0x1651b2);}_0x238df1[_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xa6')]]=_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xa2')];})['then'](function(){return db[_0x0a34('0x6b')]['find']({'where':{'id':_0x15c71d[_0x0a34('0x76')]['id']},'include':[{'model':db[_0x0a34('0xa9')],'as':_0x0a34('0xaa'),'include':[{'model':db[_0x0a34('0xab')],'as':'Contacts','where':_0x238df1,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db[_0x0a34('0x3b')],'as':_0x0a34('0x3b'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]});})['then'](function(_0x1656c3){if(!_0x1656c3)throw new APINotFoundError(util[_0x0a34('0x34')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x15c71d[_0x0a34('0x76')]['id']));if(!_0x1656c3['Interval']||!_0x1656c3[_0x0a34('0x3b')]['Intervals'])return[_0x1656c3,!![]];return[_0x1656c3,checkWebsiteIntervals(_0x1656c3)];})[_0x0a34('0xac')](function(_0x247a7a,_0x1c0652){if(!_0x1c0652)throw new APIOutOfIntervalError();if(!_0x247a7a[_0x0a34('0xaa')])return;_0x35a535[_0x0a34('0xad')]=_0x247a7a;_0x35a535[_0x0a34('0xae')]=_0x247a7a[_0x0a34('0xaa')];_0x35a535[_0x0a34('0xaf')]=_[_0x0a34('0xb0')](_0x247a7a['Applications'],[_0x0a34('0xb1')],[_0x0a34('0xb2')]);if(_0x35a535[_0x0a34('0xad')][_0x0a34('0xb3')]){delete _0x35a535[_0x0a34('0xad')]['Applications'];}if(_0x35a535[_0x0a34('0xad')][_0x0a34('0xaa')]&&_0x35a535[_0x0a34('0xad')][_0x0a34('0xaa')][_0x0a34('0xb4')][_0x0a34('0x6c')]){return _0x35a535[_0x0a34('0xad')]['List'][_0x0a34('0xb4')][0x0];}var _0x41dc63=_[_0x0a34('0xb5')](_0x15c71d['body'],{'firstName':_0x15c71d['body'][_0x0a34('0xa2')],'ListId':_0x247a7a['ListId']});_0x41dc63[_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xa6')]]=_0x15c71d['body'][_0x0a34('0xa2')];return db[_0x0a34('0xab')][_0x0a34('0x6d')](_0x41dc63,{'fields':_0x43b85f,'raw':!![]});})[_0x0a34('0x15')](function(_0x44621f){_0x35a535[_0x0a34('0xb6')]=_0x44621f;var _0x6f93f=createInteractionObject(_0x15c71d['params']['id'],_0x15c71d[_0x0a34('0x6e')],_0x15c71d[_0x0a34('0xb7')],_0x44621f);var _0x3fb819={'ChatWebsiteId':_0x15c71d[_0x0a34('0x76')]['id'],'closed':![]};if(_0x15c71d[_0x0a34('0x6e')]['threadId']){_0x3fb819[_0x0a34('0xb8')]=_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xb8')];return db['ChatInteraction'][_0x0a34('0x70')]({'where':_0x3fb819})['then'](function(_0x26b6f7){if(_0x26b6f7){_0xe2a6e9=!![];return _0x26b6f7;}_0x6f93f[_0x0a34('0xb8')]=_0x15c71d['body'][_0x0a34('0xb8')];_0x6f93f[_0x0a34('0xb9')]=_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xb9')];return db['ChatInteraction'][_0x0a34('0x6d')](_0x6f93f);});}_0x3fb819['ContactId']=_0x44621f['id'];if(_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xba')]&&_0x15c71d['body'][_0x0a34('0xba')]['id']){_0x3fb819['id']=_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xba')]['id'];return db[_0x0a34('0xbb')][_0x0a34('0x70')]({'where':_0x3fb819})['then'](function(_0x5b857b){if(_0x5b857b){_0xe2a6e9=!![];return _0x5b857b;}return db[_0x0a34('0xbb')][_0x0a34('0x6d')](_0x6f93f);});}return db[_0x0a34('0xbb')][_0x0a34('0x6d')](_0x6f93f);})['then'](function(_0xa114b4){if(!_0xe2a6e9)return _0xa114b4;var _0x114ae1={'from':(_0x35a535['contact']['firstName']||'')+'\x20'+(_0x35a535[_0x0a34('0xb6')][_0x0a34('0x47')]||'')};if(_0x15c71d['body'][_0x0a34('0xb8')]&&_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xbc')]&&_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xb8')]!=_0x15c71d[_0x0a34('0x6e')][_0x0a34('0xbc')]){_0x114ae1[_0x0a34('0xb8')]=_0x15c71d[_0x0a34('0x6e')]['messageId'];}return _0xa114b4[_0x0a34('0x2a')](_0x114ae1);})['then'](function(_0x10f9aa){_0x35a535[_0x0a34('0xba')]=_0x10f9aa[_0x0a34('0x2b')]({'plain':!![]});_0x35a535[_0x0a34('0xba')][_0x0a34('0xbd')]=!_0xe2a6e9;if(_0x35a535[_0x0a34('0xba')][_0x0a34('0xbd')]){if(_0x35a535['account'][_0x0a34('0xbe')]){_0x35a535[_0x0a34('0xaf')][_0x0a34('0xbf')]({'id':0x0,'priority':_0x35a535[_0x0a34('0xaf')][_0x0a34('0x6c')]+0x1,'app':_0x0a34('0xc0'),'appdata':_0x0a34('0xc1'),'interval':_0x0a34('0xc2')});}}return db[_0x0a34('0xc3')]['create']({'body':_0x15c71d[_0x0a34('0x6e')]['body'],'ChatWebsiteId':_0x15c71d[_0x0a34('0x76')]['id'],'ChatInteractionId':_0x10f9aa['id'],'direction':'in','ContactId':_0x35a535[_0x0a34('0xb6')]['id'],'AttachmentId':_0x15c71d['body'][_0x0a34('0xc4')]});})[_0x0a34('0x15')](function(_0x30f512){_0x35a535[_0x0a34('0x1d')]=_0x30f512;if(!_0x35a535[_0x0a34('0xba')][_0x0a34('0xc5')]){return;}return db['User'][_0x0a34('0x70')]({'attributes':['id',_0x0a34('0x2e')],'where':{'id':_0x35a535['interaction'][_0x0a34('0xc5')]}});})[_0x0a34('0x15')](function(_0x425cae){if(_0x425cae){_0x35a535[_0x0a34('0xaf')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x425cae['name']+','+(_0x35a535['account'][_0x0a34('0xc6')]||0xa),'interval':_0x0a34('0xc2')});_0x35a535[_0x0a34('0xc7')]=!![];}if(!_0x35a535['interaction'][_0x0a34('0xc8')]){return;}return db[_0x0a34('0xc9')][_0x0a34('0x70')]({'attributes':['id',_0x0a34('0x2e')],'where':{'id':_0x35a535[_0x0a34('0xba')][_0x0a34('0xc8')]}});})[_0x0a34('0x15')](function(_0x4fdab8){if(_0x4fdab8){_0x35a535['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x0a34('0xca'),'appdata':_0x4fdab8['name']+','+(_0x35a535[_0x0a34('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0a34('0xcb'),_0x0a34('0xcc'),_0x35a535);})[_0x0a34('0x15')](function(_0x1f8284){respondWithRpcPromise(_0x0a34('0xcd'),_0x0a34('0xcd'),{'event':_0x0a34('0xce'),'message':_0x1f8284},client9002);return _0x1f8284;})[_0x0a34('0x15')](respondWithResult(_0x1a47e3,null))[_0x0a34('0x69')](APIHandleError(_0x1a47e3));};exports[_0x0a34('0xcf')]=function(_0x433f11,_0x3554f9){var _0x234892,_0x1b6100,_0x145279;var _0x3faac8=[];var _0x2bd138={};var _0x9477e8=_0x433f11[_0x0a34('0xd0')]||[];var _0x2ec138=[];var _0x40a4fc;return db[_0x0a34('0xab')][_0x0a34('0x74')]()[_0x0a34('0x15')](function(_0x4f6484){if(!_0x4f6484){throw new db[(_0x0a34('0x9c'))][(_0x0a34('0xa3'))]('no\x20available\x20attributes');}_0x3faac8=_[_0x0a34('0x9e')](_[_0x0a34('0x57')](_0x4f6484),[_0x0a34('0x9f'),_0x0a34('0xa0'),'CompanyId',_0x0a34('0xa1')]);if(_0x433f11['body']['id']){delete _0x433f11[_0x0a34('0x6e')]['id'];}if(_[_0x0a34('0x8e')](_0x433f11['body']['from'])){throw _0x3554f9['status'](0x1f4)['send'](new db[(_0x0a34('0x9c'))][(_0x0a34('0xa3'))](_0x0a34('0xa4')));}if(_[_0x0a34('0x8e')](_0x433f11[_0x0a34('0x6e')][_0x0a34('0x6e')])||_0x433f11[_0x0a34('0x6e')][_0x0a34('0x6e')]===''){throw _0x3554f9[_0x0a34('0x21')](0x1f4)['send'](new db['Sequelize'][(_0x0a34('0xa3'))](_0x0a34('0xa5')));}if(_['isNil'](_0x433f11[_0x0a34('0x6e')][_0x0a34('0xd1')])){throw _0x3554f9[_0x0a34('0x21')](0x1f4)[_0x0a34('0x2f')](new db[(_0x0a34('0x9c'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3faac8));}if(!_[_0x0a34('0xa7')](_0x3faac8,_0x433f11['body'][_0x0a34('0xd1')])){throw _0x3554f9[_0x0a34('0x21')](0x1f4)[_0x0a34('0x2f')](new db[(_0x0a34('0x9c'))][(_0x0a34('0xa3'))](_0x0a34('0xd2')+_0x3faac8));}_0x2bd138[_0x433f11[_0x0a34('0x6e')]['mapKeyOffline']]=_0x433f11['body'][_0x0a34('0xa2')];})[_0x0a34('0x15')](function(){return db['ChatWebsite'][_0x0a34('0x70')]({'where':{'id':_0x433f11[_0x0a34('0x76')]['id']},'include':[{'model':db[_0x0a34('0xa9')],'as':_0x0a34('0xaa')},{'model':db[_0x0a34('0xd3')],'as':_0x0a34('0xd3')}]});})[_0x0a34('0x15')](handleEntityNotFound(_0x3554f9,null))[_0x0a34('0x15')](function(_0x146f74){if(_0x146f74&&_0x146f74['List']){_0x1b6100=_0x146f74;var _0x16ff34=_['defaults'](_0x433f11['body'],{'firstName':_0x433f11[_0x0a34('0x6e')][_0x0a34('0xa2')],'phone':_0x433f11[_0x0a34('0x6e')][_0x0a34('0xa2')],'ListId':_0x146f74[_0x0a34('0xa1')]});_0x16ff34[_0x433f11[_0x0a34('0x6e')]['mapKeyOffline']]=_0x433f11[_0x0a34('0x6e')][_0x0a34('0xa2')];return db[_0x0a34('0xab')][_0x0a34('0xd4')]({'where':_0x2bd138,'defaults':_0x16ff34});}})[_0x0a34('0xac')](function(_0x3e2aa){if(_0x3e2aa){_0x145279=_0x3e2aa;var _0x546dde=fs[_0x0a34('0xd5')](path[_0x0a34('0x90')](config[_0x0a34('0x8a')],_0x0a34('0xd6')),_0x0a34('0xd7'));var _0x4f012c=ejs[_0x0a34('0xd8')](_0x546dde,{'body':_[_0x0a34('0xd9')](_0x433f11[_0x0a34('0x6e')][_0x0a34('0x6e')]),'bodyTitle':_0x1b6100['offlineMessageBody']});return db[_0x0a34('0xda')]['create']({'body':_0x4f012c,'plainBody':htmlToText[_0x0a34('0xdb')](_0x4f012c),'ContactId':_0x3e2aa['id'],'ChatWebsiteId':_0x1b6100['id']});}})[_0x0a34('0x15')](function(_0x31f6d6){_0x40a4fc=_0x31f6d6;if(_0x9477e8['length']){var _0x2dea2e=_0x9477e8['map'](function(_0x374ab9){return{'name':_0x374ab9[_0x0a34('0xdc')],'basename':_0x374ab9[_0x0a34('0x82')],'type':_0x374ab9[_0x0a34('0xdd')],'ChatOfflineMessageId':_0x31f6d6['id']};});_0x2ec138=_0x2dea2e[_0x0a34('0x3a')](_0x587a15=>{var _0x1a3068={'filename':_0x587a15[_0x0a34('0x2e')],'path':path[_0x0a34('0x90')](config[_0x0a34('0x8a')],'server','files','attachments',_0x0a34('0xde'),_0x587a15[_0x0a34('0xdf')])};return _0x1a3068;});if(!_0x1b6100[_0x0a34('0xe0')]){return db['sequelize'][_0x0a34('0xe1')](function(_0x19772f){return db[_0x0a34('0xe2')][_0x0a34('0xe3')](_0x2dea2e,{'transaction':_0x19772f});});}}})['then'](function(){if(_0x40a4fc){_0x234892=_0x40a4fc;return db[_0x0a34('0xd3')][_0x0a34('0x79')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x0a34('0xe4'),'raw':!![],'include':[{'model':db[_0x0a34('0xe5')],'as':_0x0a34('0xe5'),'raw':!![]}]}]});}})[_0x0a34('0x15')](function(_0xcb52f6){if(_0xcb52f6&&_0xcb52f6[_0x0a34('0xe4')]&&_0x1b6100['forwardOffline']&&_0x1b6100[_0x0a34('0xe6')]){var _0x5e3005=_0xcb52f6['getSmtpOptions']();return respondWithRpcPromise(_0x0a34('0xe7'),'sendMail',{'account':_0x5e3005,'message':{'from':util[_0x0a34('0x34')](_0x0a34('0xe8'),_0xcb52f6[_0x0a34('0x2e')],_0xcb52f6['email']||_0xcb52f6[_0x0a34('0xe4')][_0x0a34('0xe9')]),'to':_0x1b6100[_0x0a34('0xe6')],'subject':_0x1b6100[_0x0a34('0xea')],'html':_0x234892['body'],'attachments':_0x2ec138}},client9003)['then'](function(){return _0x234892;})['catch'](function(_0xceab73){logger['error'](_0xceab73);});}})[_0x0a34('0x15')](function(){if(_0x1b6100&&_0x1b6100[_0x0a34('0xe0')]&&_0x1b6100[_0x0a34('0xeb')]){var _0xcd03cf=[];if(_0x9477e8[_0x0a34('0x6c')]){_0xcd03cf=_0x9477e8['map'](function(_0x18fdd3){return{'name':_0x18fdd3[_0x0a34('0xdc')],'basename':_0x18fdd3[_0x0a34('0x82')],'type':_0x18fdd3[_0x0a34('0xdd')],'ChatOfflineMessageId':_0x40a4fc['id']};});}var _0x34bcfd;if(!_[_0x0a34('0x8e')](_0x1b6100[_0x0a34('0xec')])){var _0x1a438f=_[_0x0a34('0x3a')](_0x433f11[_0x0a34('0x6e')],function(_0x47f79e){return _0x47f79e;});var _0x14c889=_[_0x0a34('0xed')](_0x1a438f)[0x0];var _0x33f10e=_[_0x0a34('0xee')](_0x14c889,function(_0x4611f1){return _0x4611f1;});_0x34bcfd=_0x33f10e[0x1][_0x1b6100[_0x0a34('0xec')]];}var _0xd95d9b={'from':_0x145279[_0x0a34('0xef')],'firstName':_0x145279['firstName'],'lastName':_0x145279[_0x0a34('0x47')],'mapKey':_0x0a34('0xef'),'message':{'from':_0x145279[_0x0a34('0xef')],'to':_0x1b6100['MailAccount'][_0x0a34('0xef')],'cc':'','subject':_[_0x0a34('0x8e')](_0x34bcfd)?_0x1b6100[_0x0a34('0xea')]:_0x34bcfd,'messageId':'','sentAt':new Date(),'attach':_0xcd03cf['length'],'attachments':_0xcd03cf,'originChannel':_0x0a34('0xf0'),'ChatWebsiteId':_0x1b6100['id'],'ChatOfflineMessageId':_0x234892['id'],'originTo':_0x1b6100[_0x0a34('0xd3')][_0x0a34('0xef')]},'body':_0x234892['body']};var _0x1e99cf={'account':{'id':_0x1b6100[_0x0a34('0xeb')]},'body':_0xd95d9b,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x0a34('0xf1'),'notifyMail',_0x1e99cf,client9001)[_0x0a34('0x15')](function(){return _0x234892;})['catch'](function(_0xf12c8b){logger[_0x0a34('0x1b')](_0xf12c8b);});}return;})[_0x0a34('0x15')](function(){if(_0x234892){return _0x234892;}})[_0x0a34('0x15')](respondWithResult(_0x3554f9,null))[_0x0a34('0x69')](function(){for(var _0x3759bb of _0x9477e8){var _0x527160=path[_0x0a34('0x90')](config['root'],_0x0a34('0xf2'),'files',_0x0a34('0xf3'),_0x0a34('0xde'),_0x3759bb[_0x0a34('0x82')]);fs_extra[_0x0a34('0xf4')](_0x527160)[_0x0a34('0x69')](function(_0x43844b){logger[_0x0a34('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x527160,_0x43844b);});}});};exports[_0x0a34('0xf5')]=function(_0x21ac46,_0x5e27f5){return db['ChatInteraction'][_0x0a34('0x70')]({'where':{'id':_0x21ac46[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x5e27f5,null))[_0x0a34('0x15')](function(_0x4b17ef){if(_0x4b17ef){return _0x4b17ef[_0x0a34('0xf5')](_0x21ac46['body']['ids'],_[_0x0a34('0xf6')](_0x21ac46[_0x0a34('0x6e')],[_0x0a34('0x80'),'id'])||{});}})['then'](respondWithResult(_0x5e27f5,null))[_0x0a34('0x69')](handleError(_0x5e27f5,null));};exports[_0x0a34('0xf7')]=function(_0x1c70fe,_0x59e9f7){var _0x6744c7={'raw':![],'where':{}};var _0x4fc7ac={};var _0x44de6b={'count':0x0,'rows':[]};return db[_0x0a34('0x6b')]['findOne']({'where':{'id':_0x1c70fe[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x59e9f7,null))[_0x0a34('0x15')](function(_0x158f80){if(_0x158f80){_0x4fc7ac['model']=_[_0x0a34('0x57')](db[_0x0a34('0xbb')][_0x0a34('0x53')]);_0x4fc7ac['query']=_['keys'](_0x1c70fe[_0x0a34('0x56')]);_0x4fc7ac[_0x0a34('0x58')]=_[_0x0a34('0x59')](_0x4fc7ac[_0x0a34('0x4f')],_0x4fc7ac[_0x0a34('0x56')]);_0x6744c7['attributes']=_['intersection'](_0x4fc7ac[_0x0a34('0x4f')],qs['fields'](_0x1c70fe['query']['fields']));_0x6744c7['attributes']=_0x6744c7[_0x0a34('0x5a')][_0x0a34('0x6c')]?_0x6744c7[_0x0a34('0x5a')]:_0x4fc7ac[_0x0a34('0x4f')];if(!_0x1c70fe[_0x0a34('0x56')][_0x0a34('0x5c')](_0x0a34('0x5d'))){_0x6744c7[_0x0a34('0x27')]=qs['limit'](_0x1c70fe['query']['limit']);_0x6744c7[_0x0a34('0x24')]=qs[_0x0a34('0x24')](_0x1c70fe['query'][_0x0a34('0x24')]);}_0x6744c7[_0x0a34('0x5e')]=qs['sort'](_0x1c70fe[_0x0a34('0x56')]['sort']);_0x6744c7[_0x0a34('0x60')]=qs[_0x0a34('0x58')](_[_0x0a34('0x7b')](_0x1c70fe[_0x0a34('0x56')],_0x4fc7ac[_0x0a34('0x58')]));_0x6744c7[_0x0a34('0x60')][_0x0a34('0x77')]=_0x158f80['id'];if(_0x1c70fe[_0x0a34('0x56')][_0x0a34('0x61')]){_0x6744c7[_0x0a34('0x60')]=_['merge'](_0x6744c7[_0x0a34('0x60')],{'$or':_['map'](_0x6744c7[_0x0a34('0x5a')],function(_0x26b5c9){var _0x122b10={};_0x122b10[_0x26b5c9]={'$like':'%'+_0x1c70fe[_0x0a34('0x56')][_0x0a34('0x61')]+'%'};return _0x122b10;})});}_0x6744c7=_[_0x0a34('0x62')]({},_0x6744c7,_0x1c70fe[_0x0a34('0x64')]);return db[_0x0a34('0xbb')][_0x0a34('0x26')]({'where':_0x6744c7[_0x0a34('0x60')]})['then'](function(_0x2d3f83){_0x44de6b['count']=_0x2d3f83;if(_0x1c70fe['query'][_0x0a34('0x65')]){_0x6744c7['include']=[{'model':db[_0x0a34('0xab')],'as':_0x0a34('0xf8'),'required':![]},{'model':db[_0x0a34('0xf9')],'as':_0x0a34('0xfa'),'attributes':[_0x0a34('0x2e'),'fullname',_0x0a34('0xfb')],'required':![]},{'model':db[_0x0a34('0xfc')],'as':_0x0a34('0xfd'),'attributes':['id','name',_0x0a34('0xfe')],'where':_0x1c70fe[_0x0a34('0x56')][_0x0a34('0xff')]?{'id':_0x1c70fe[_0x0a34('0x56')][_0x0a34('0xff')]}:undefined,'required':_0x1c70fe[_0x0a34('0x56')][_0x0a34('0xff')]?!![]:![]}];}return db[_0x0a34('0xbb')][_0x0a34('0x67')](_0x6744c7);})[_0x0a34('0x15')](function(_0x49253b){_0x44de6b[_0x0a34('0x68')]=_0x49253b;return _0x44de6b;});}})['then'](respondWithFilteredResult(_0x59e9f7,_0x6744c7))[_0x0a34('0x69')](handleError(_0x59e9f7,null));};exports[_0x0a34('0x30')]=function(_0x4cd404,_0x490d37){var _0x1ebbfc=0x0;var _0x407126=0x0;var _0xd2417a=![];var _0x5ad101;var _0x21652e;return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x4cd404[_0x0a34('0x76')]['id']},'include':[{'model':db[_0x0a34('0x3b')],'as':_0x0a34('0x3b'),'include':[{'model':db[_0x0a34('0x3b')],'as':'Intervals','attributes':['id',_0x0a34('0x33')]}]}]})[_0x0a34('0x15')](handleEntityNotFound(_0x490d37,null))[_0x0a34('0x15')](function(_0x2046b8){if(_0x2046b8){_0x5ad101=_0x2046b8;return _0x2046b8['getProactiveActions']({'raw':!![]});}})[_0x0a34('0x15')](function(_0x3d4720){if(_0x5ad101){if(_0x3d4720){_0x21652e=_0x3d4720;}}return require('../../config/license/util')[_0x0a34('0x8c')]();})[_0x0a34('0x15')](function(_0x4cbe4c){if(_0x4cbe4c){_0x407126=_0x4cbe4c[_0x0a34('0x100')];_0xd2417a=_0x4cbe4c[_0x0a34('0x8d')];}})[_0x0a34('0x15')](function(){return db[_0x0a34('0xbb')][_0x0a34('0x26')]({'where':{'closed':![]}});})[_0x0a34('0x15')](function(_0x46c989){_0x1ebbfc=_0x46c989;if(_0x407126&&_0x46c989>_0x407126){return db['License'][_0x0a34('0x79')]({'where':{'id':0x1}})[_0x0a34('0x15')](function(_0x1d0a3b){if(_0x1d0a3b){_0x1d0a3b[_0x0a34('0x101')](_0x0a34('0x102'));}});}})[_0x0a34('0x15')](function(){if(!_0x5ad101[_0x0a34('0x3b')]||!_0x5ad101['Interval'][_0x0a34('0x3c')])return!![];return checkWebsiteIntervals(_0x5ad101);})[_0x0a34('0x15')](function(_0x2e6cc1){var _0x22da9c=fs[_0x0a34('0xd5')](path['join'](config[_0x0a34('0x8a')],_0x0a34('0x103')),_0x0a34('0xd7'));var _0x21e16b=new url['URL'](_0x5ad101['address'])[_0x0a34('0x104')];var _0x5c77e3='3.5.0';var _0x5af794=![];var _0x41450f={'chatVersion':_0x5c77e3,'chatWebsiteAddressOrigin':_0x21e16b,'remote':_0x5ad101[_0x0a34('0x105')],'query':querystring[_0x0a34('0x1a')](_[_0x0a34('0x62')](_0x5ad101[_0x0a34('0x2b')]({'plain':!![]}),{'customerIp':_0x4cd404[_0x0a34('0xb7')][_0x0a34('0x43')]||_0x4cd404[_0x0a34('0xb7')][_0x0a34('0x106')]||_0x4cd404[_0x0a34('0x107')]['remoteAddress']||_0x4cd404['ip'],'referer':_0x4cd404[_0x0a34('0xb7')][_0x0a34('0x108')],'openedInteractions':_0x1ebbfc,'maxInteractions':_0x407126,'virtual':_0xd2417a['virtual'],'online':_0x2e6cc1,'custom':_0xd2417a}))['replace'](/'/g,'\x5c\x27')};_0x490d37[_0x0a34('0x2f')](ejs[_0x0a34('0xd8')](Mustache[_0x0a34('0xd8')](_0x22da9c,_0x41450f),{'proactiveActions':_0x21652e,'alignment':_0x5ad101[_0x0a34('0x109')],'verticalAlignment':_0x5ad101['verticalAlignment'],'div_color':_0x5ad101['color'],'labelText':_0x5ad101[_0x0a34('0x10a')],'text_color':_0x5ad101[_0x0a34('0x10b')],'text_button_color':_0x5ad101[_0x0a34('0x10c')],'button_color':_0x5ad101['color_button'],'background_color':_0x5ad101['backgroundColor'],'hideWhenOffline':_0x5ad101['hideWhenOffline'],'intervalId':_0x5ad101[_0x0a34('0x10d')],'isDevelopment':_0x5af794,'chatVersion':_0x5c77e3}));})[_0x0a34('0x69')](handleError(_0x490d37,null));};exports[_0x0a34('0x10e')]=function(_0x28aa81,_0x1c8418){var _0x19fc02=_0x28aa81['params']['id'];var _0xa8c4fa=_0x28aa81['body'];var _0x36e196=0xc8;var _0x1e92ca=null;return db[_0x0a34('0x10f')]['transaction']({'isolationLevel':db[_0x0a34('0x10f')]['Transaction'][_0x0a34('0x110')][_0x0a34('0x111')]},function(_0x47654c){return db[_0x0a34('0x6b')][_0x0a34('0x79')]({'where':{'id':_0x19fc02},'transaction':_0x47654c})['then'](function(_0x480a3a){if(_0x480a3a){return db[_0x0a34('0x112')][_0x0a34('0x73')]({'where':{'ChatWebsiteId':_0x19fc02},'transaction':_0x47654c})[_0x0a34('0x15')](function(){var _0x9d9113=_['map'](_0xa8c4fa,function(_0x39ce7c){_0x39ce7c[_0x0a34('0x77')]=_0x19fc02;return _0x39ce7c;});return db[_0x0a34('0x112')][_0x0a34('0xe3')](_0x9d9113,{'transaction':_0x47654c});});}else{_0x36e196=0x194;_0x1e92ca=[];}});})[_0x0a34('0x15')](function(){if(_0x36e196!==0x194){return db[_0x0a34('0x112')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x19fc02},'order':_0x0a34('0xb1')})[_0x0a34('0x15')](function(_0x256ab2){_0x1e92ca=_0x256ab2;});}})[_0x0a34('0x69')](function(_0x514405){_0x36e196=0x1f4;logger[_0x0a34('0x1b')](_0x514405[_0x0a34('0x113')]);if(_0x514405[_0x0a34('0x2e')]){delete _0x514405[_0x0a34('0x2e')];}_0x1e92ca=_0x514405;})[_0x0a34('0x114')](function(){if(_0x1e92ca===null){_0x1c8418[_0x0a34('0x20')](_0x36e196);}else{if(_0x36e196===0x1f4){_0x1c8418['status'](_0x36e196)[_0x0a34('0x2f')](_0x1e92ca);}else{_0x1c8418[_0x0a34('0x21')](_0x36e196)[_0x0a34('0x23')](_0x1e92ca);}}});};exports[_0x0a34('0x115')]=function(_0x48bcdc,_0x427211){var _0x3c596d={};var _0x3d2cad={};var _0x2e136d;var _0x2a354c;return db[_0x0a34('0x6b')][_0x0a34('0x79')]({'where':{'id':_0x48bcdc[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x427211,null))[_0x0a34('0x15')](function(_0x2bb65d){if(_0x2bb65d){_0x2e136d=_0x2bb65d;_0x3d2cad[_0x0a34('0x4f')]=_[_0x0a34('0x57')](db[_0x0a34('0x112')]['rawAttributes']);_0x3d2cad[_0x0a34('0x56')]=_[_0x0a34('0x57')](_0x48bcdc['query']);_0x3d2cad[_0x0a34('0x58')]=_['intersection'](_0x3d2cad['model'],_0x3d2cad['query']);_0x3c596d[_0x0a34('0x5a')]=_[_0x0a34('0x59')](_0x3d2cad[_0x0a34('0x4f')],qs[_0x0a34('0x5b')](_0x48bcdc['query'][_0x0a34('0x5b')]));_0x3c596d[_0x0a34('0x5a')]=_0x3c596d[_0x0a34('0x5a')][_0x0a34('0x6c')]?_0x3c596d[_0x0a34('0x5a')]:_0x3d2cad['model'];_0x3c596d[_0x0a34('0x5e')]=qs[_0x0a34('0x5f')](_0x48bcdc[_0x0a34('0x56')][_0x0a34('0x5f')]);_0x3c596d['where']=qs['filters'](_[_0x0a34('0x7b')](_0x48bcdc[_0x0a34('0x56')],_0x3d2cad[_0x0a34('0x58')]));if(_0x48bcdc[_0x0a34('0x56')]['filter']){_0x3c596d[_0x0a34('0x60')]=_[_0x0a34('0x62')](_0x3c596d[_0x0a34('0x60')],{'$or':_[_0x0a34('0x3a')](_0x3c596d['attributes'],function(_0x358504){var _0x1874d8={};_0x1874d8[_0x358504]={'$like':'%'+_0x48bcdc['query']['filter']+'%'};return _0x1874d8;})});}_0x3c596d=_[_0x0a34('0x62')]({},_0x3c596d,_0x48bcdc[_0x0a34('0x64')]);return _0x2e136d[_0x0a34('0x115')](_0x3c596d);}})['then'](function(_0x862cbd){if(_0x862cbd){_0x2a354c=_0x862cbd[_0x0a34('0x6c')];if(!_0x48bcdc[_0x0a34('0x56')][_0x0a34('0x5c')](_0x0a34('0x5d'))){_0x3c596d[_0x0a34('0x27')]=qs[_0x0a34('0x27')](_0x48bcdc[_0x0a34('0x56')][_0x0a34('0x27')]);_0x3c596d['offset']=qs['offset'](_0x48bcdc[_0x0a34('0x56')][_0x0a34('0x24')]);}return _0x2e136d['getApplications'](_0x3c596d);}})['then'](function(_0x3644b1){if(_0x3644b1){return _0x3644b1?{'count':_0x2a354c,'rows':_0x3644b1}:null;}})[_0x0a34('0x15')](respondWithResult(_0x427211,null))['catch'](handleError(_0x427211,null));};exports['addProactiveActions']=function(_0x3d0409,_0x10dc89){return db['chatProactiveAction'][_0x0a34('0x70')]({'where':{'id':_0x3d0409[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x10dc89,null))[_0x0a34('0x15')](function(_0x13ba62){if(_0x13ba62){return _0x13ba62['addProactiveActions'](_0x3d0409[_0x0a34('0x6e')]['ids'],_[_0x0a34('0xf6')](_0x3d0409['body'],[_0x0a34('0x80'),'id'])||{});}})['then'](respondWithResult(_0x10dc89,null))[_0x0a34('0x69')](handleError(_0x10dc89,null));};exports[_0x0a34('0x116')]=function(_0x8982e0,_0x2115d0){var _0x15fb51={};var _0x3daf42={};var _0x46a8b5;var _0x23a419;return db[_0x0a34('0x6b')][_0x0a34('0x79')]({'where':{'id':_0x8982e0['params']['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x2115d0,null))[_0x0a34('0x15')](function(_0x1eeccc){if(_0x1eeccc){_0x46a8b5=_0x1eeccc;_0x3daf42['model']=_['keys'](db[_0x0a34('0x117')][_0x0a34('0x53')]);_0x3daf42[_0x0a34('0x56')]=_[_0x0a34('0x57')](_0x8982e0[_0x0a34('0x56')]);_0x3daf42[_0x0a34('0x58')]=_['intersection'](_0x3daf42[_0x0a34('0x4f')],_0x3daf42[_0x0a34('0x56')]);_0x15fb51[_0x0a34('0x5a')]=_[_0x0a34('0x59')](_0x3daf42[_0x0a34('0x4f')],qs['fields'](_0x8982e0[_0x0a34('0x56')][_0x0a34('0x5b')]));_0x15fb51[_0x0a34('0x5a')]=_0x15fb51[_0x0a34('0x5a')]['length']?_0x15fb51[_0x0a34('0x5a')]:_0x3daf42[_0x0a34('0x4f')];_0x15fb51[_0x0a34('0x5e')]=qs[_0x0a34('0x5f')](_0x8982e0[_0x0a34('0x56')][_0x0a34('0x5f')]);_0x15fb51[_0x0a34('0x60')]=qs[_0x0a34('0x58')](_[_0x0a34('0x7b')](_0x8982e0[_0x0a34('0x56')],_0x3daf42[_0x0a34('0x58')]));if(_0x8982e0[_0x0a34('0x56')]['filter']){_0x15fb51['where']=_[_0x0a34('0x62')](_0x15fb51[_0x0a34('0x60')],{'$or':_[_0x0a34('0x3a')](_0x15fb51[_0x0a34('0x5a')],function(_0x34e671){var _0x140196={};_0x140196[_0x34e671]={'$like':'%'+_0x8982e0[_0x0a34('0x56')]['filter']+'%'};return _0x140196;})});}_0x15fb51=_[_0x0a34('0x62')]({},_0x15fb51,_0x8982e0[_0x0a34('0x64')]);return _0x46a8b5['getProactiveActions'](_0x15fb51);}})[_0x0a34('0x15')](function(_0x44e062){if(_0x44e062){_0x23a419=_0x44e062[_0x0a34('0x6c')];if(!_0x8982e0['query'][_0x0a34('0x5c')]('nolimit')){_0x15fb51[_0x0a34('0x27')]=qs['limit'](_0x8982e0[_0x0a34('0x56')]['limit']);_0x15fb51['offset']=qs[_0x0a34('0x24')](_0x8982e0[_0x0a34('0x56')][_0x0a34('0x24')]);}return _0x46a8b5[_0x0a34('0x116')](_0x15fb51);}})['then'](function(_0x2ebe2c){if(_0x2ebe2c){return _0x2ebe2c?{'count':_0x23a419,'rows':_0x2ebe2c}:null;}})[_0x0a34('0x15')](respondWithResult(_0x2115d0,null))['catch'](handleError(_0x2115d0,null));};exports[_0x0a34('0x118')]=function(_0x512475,_0x37a751){var _0x4ab61f=_0x512475[_0x0a34('0x56')][_0x0a34('0x119')]===_0x0a34('0x11a')?'offlineForm':_0x0a34('0x11b');return db[_0x0a34('0x6b')]['find']({'attributes':['id',_0x4ab61f],'where':{'id':_0x512475[_0x0a34('0x76')]['id']}})['then'](handleEntityNotFound(_0x37a751,null))[_0x0a34('0x15')](function(_0x3fce43){if(_0x3fce43){var _0x3535e6=_0x3fce43[_0x4ab61f];var _0x140c8d=_0x3535e6&&_0x3535e6[_0x0a34('0x11c')]?_0x3535e6[_0x0a34('0x11c')]:[];_0x37a751[_0x0a34('0x2f')]({'fromKey':_[_0x0a34('0x8e')](_0x3535e6[_0x0a34('0x11d')])?undefined:_0x3535e6[_0x0a34('0x11d')],'count':_0x140c8d[_0x0a34('0x6c')],'rows':_0x140c8d});}})['catch'](handleError(_0x37a751,null));};exports[_0x0a34('0x11e')]=function(_0x49a042,_0x2bbfa5){var _0x11de49={'raw':![],'where':{}};var _0x4c8ae3={};var _0x34f37c={'count':0x0,'rows':[]};return db[_0x0a34('0x6b')][_0x0a34('0x79')]({'where':{'id':_0x49a042[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x2bbfa5,null))['then'](function(_0x2b417b){if(_0x2b417b){_0x4c8ae3['model']=_[_0x0a34('0x57')](db[_0x0a34('0xda')][_0x0a34('0x53')]);_0x4c8ae3[_0x0a34('0x56')]=_[_0x0a34('0x57')](_0x49a042[_0x0a34('0x56')]);_0x4c8ae3['filters']=_[_0x0a34('0x59')](_0x4c8ae3[_0x0a34('0x4f')],_0x4c8ae3[_0x0a34('0x56')]);_0x11de49[_0x0a34('0x5a')]=_[_0x0a34('0x59')](_0x4c8ae3[_0x0a34('0x4f')],qs['fields'](_0x49a042[_0x0a34('0x56')][_0x0a34('0x5b')]));_0x11de49[_0x0a34('0x5a')]=_0x11de49[_0x0a34('0x5a')][_0x0a34('0x6c')]?_0x11de49[_0x0a34('0x5a')]:_0x4c8ae3['model'];if(!_0x49a042['query']['hasOwnProperty']('nolimit')){_0x11de49['limit']=qs[_0x0a34('0x27')](_0x49a042['query'][_0x0a34('0x27')]);_0x11de49['offset']=qs[_0x0a34('0x24')](_0x49a042[_0x0a34('0x56')][_0x0a34('0x24')]);}_0x11de49[_0x0a34('0x5e')]=qs[_0x0a34('0x5f')](_0x49a042[_0x0a34('0x56')][_0x0a34('0x5f')]);_0x11de49['where']=qs['filters'](_[_0x0a34('0x7b')](_0x49a042[_0x0a34('0x56')],_0x4c8ae3[_0x0a34('0x58')]));_0x11de49[_0x0a34('0x60')][_0x0a34('0x77')]=_0x2b417b['id'];if(_0x49a042[_0x0a34('0x56')][_0x0a34('0x61')]){_0x11de49[_0x0a34('0x60')]=_[_0x0a34('0x62')](_0x11de49[_0x0a34('0x60')],{'$or':_[_0x0a34('0x3a')](_0x11de49[_0x0a34('0x5a')],function(_0x86b1a4){var _0x78ffd7={};_0x78ffd7[_0x86b1a4]={'$like':'%'+_0x49a042[_0x0a34('0x56')]['filter']+'%'};return _0x78ffd7;})});}_0x11de49=_['merge']({},_0x11de49,_0x49a042[_0x0a34('0x64')]);return db[_0x0a34('0xda')][_0x0a34('0x26')]({'where':_0x11de49[_0x0a34('0x60')]})['then'](function(_0x27b0da){_0x34f37c['count']=_0x27b0da;if(_0x49a042[_0x0a34('0x56')]['includeAll']){_0x11de49[_0x0a34('0x66')]=[{'all':!![]}];}else{_0x11de49['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x0a34('0xe2')],'as':_0x0a34('0x11f'),'required':![]}];}return db[_0x0a34('0xda')]['findAll'](_0x11de49);})[_0x0a34('0x15')](function(_0x388f21){_0x34f37c[_0x0a34('0x68')]=_0x388f21;return _0x34f37c;});}})[_0x0a34('0x15')](respondWithFilteredResult(_0x2bbfa5,_0x11de49))[_0x0a34('0x69')](handleError(_0x2bbfa5,null));};exports[_0x0a34('0x120')]=function(_0x3cf462,_0x2ec954){return db[_0x0a34('0x6b')]['find']({'where':{'id':_0x3cf462['params']['id']}})['then'](handleEntityNotFound(_0x2ec954,null))[_0x0a34('0x15')](function(_0x44fbfb){if(_0x44fbfb){return _0x44fbfb[_0x0a34('0x120')](_0x3cf462[_0x0a34('0x6e')][_0x0a34('0x80')],_[_0x0a34('0xf6')](_0x3cf462['body'],[_0x0a34('0x80'),'id'])||{})[_0x0a34('0xac')](function(_0x28e5b5){for(var _0x2bfec2=0x0;_0x2bfec2<_0x3cf462[_0x0a34('0x6e')][_0x0a34('0x80')][_0x0a34('0x6c')];_0x2bfec2+=0x1){socket[_0x0a34('0x121')](_0x0a34('0x122'),{'UserId':Number(_0x3cf462[_0x0a34('0x6e')][_0x0a34('0x80')][_0x2bfec2]),'ChatWebsiteId':Number(_0x3cf462['params']['id'])});}return _0x28e5b5;});}})[_0x0a34('0x15')](respondWithResult(_0x2ec954,null))[_0x0a34('0x69')](handleError(_0x2ec954,null));};exports['removeAgents']=function(_0x1deff0,_0x1755c4){return db[_0x0a34('0x6b')][_0x0a34('0x70')]({'where':{'id':_0x1deff0[_0x0a34('0x76')]['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x1755c4,null))[_0x0a34('0x15')](function(_0xb05aa7){if(_0xb05aa7){return _0xb05aa7[_0x0a34('0x123')](_0x1deff0[_0x0a34('0x56')][_0x0a34('0x80')])['then'](function(){if(_[_0x0a34('0x124')](_0x1deff0['query'][_0x0a34('0x80')])){for(var _0x2c5a38=0x0;_0x2c5a38<_0x1deff0[_0x0a34('0x56')]['ids'][_0x0a34('0x6c')];_0x2c5a38+=0x1){socket[_0x0a34('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x1deff0[_0x0a34('0x56')][_0x0a34('0x80')][_0x2c5a38]),'ChatWebsiteId':Number(_0x1deff0[_0x0a34('0x76')]['id'])});}}else{socket['emit'](_0x0a34('0x125'),{'UserId':Number(_0x1deff0['query'][_0x0a34('0x80')]),'ChatWebsiteId':Number(_0x1deff0[_0x0a34('0x76')]['id'])});}});}})[_0x0a34('0x15')](respondWithStatusCode(_0x1755c4,null))['catch'](handleError(_0x1755c4,null));};exports['getAgents']=function(_0x58eefa,_0x42ce53){var _0x25d6c0={};var _0x222b84={};var _0x278ce9;var _0x25ec39;return db[_0x0a34('0x6b')][_0x0a34('0x79')]({'where':{'id':_0x58eefa['params']['id']}})[_0x0a34('0x15')](handleEntityNotFound(_0x42ce53,null))['then'](function(_0x3d6d42){if(_0x3d6d42){_0x278ce9=_0x3d6d42;_0x222b84[_0x0a34('0x4f')]=_[_0x0a34('0x57')](db[_0x0a34('0xf9')][_0x0a34('0x53')]);_0x222b84[_0x0a34('0x56')]=_[_0x0a34('0x57')](_0x58eefa[_0x0a34('0x56')]);_0x222b84[_0x0a34('0x58')]=_[_0x0a34('0x59')](_0x222b84[_0x0a34('0x4f')],_0x222b84['query']);_0x25d6c0[_0x0a34('0x5a')]=_[_0x0a34('0x59')](_0x222b84[_0x0a34('0x4f')],qs[_0x0a34('0x5b')](_0x58eefa[_0x0a34('0x56')][_0x0a34('0x5b')]));_0x25d6c0['attributes']=_0x25d6c0[_0x0a34('0x5a')][_0x0a34('0x6c')]?_0x25d6c0[_0x0a34('0x5a')]:_0x222b84[_0x0a34('0x4f')];_0x25d6c0['order']=qs[_0x0a34('0x5f')](_0x58eefa[_0x0a34('0x56')][_0x0a34('0x5f')]);_0x25d6c0['where']=qs[_0x0a34('0x58')](_[_0x0a34('0x7b')](_0x58eefa[_0x0a34('0x56')],_0x222b84[_0x0a34('0x58')]));if(_0x58eefa['query']['filter']){_0x25d6c0['where']=_[_0x0a34('0x62')](_0x25d6c0[_0x0a34('0x60')],{'$or':_[_0x0a34('0x3a')](_0x25d6c0[_0x0a34('0x5a')],function(_0x1f96fe){var _0x2efaa0={};_0x2efaa0[_0x1f96fe]={'$like':'%'+_0x58eefa[_0x0a34('0x56')][_0x0a34('0x61')]+'%'};return _0x2efaa0;})});}_0x25d6c0=_[_0x0a34('0x62')]({},_0x25d6c0,_0x58eefa[_0x0a34('0x64')]);return _0x278ce9['getAgents'](_0x25d6c0);}})[_0x0a34('0x15')](function(_0x115111){if(_0x115111){_0x25ec39=_0x115111[_0x0a34('0x6c')];if(!_0x58eefa[_0x0a34('0x56')][_0x0a34('0x5c')](_0x0a34('0x5d'))){_0x25d6c0['limit']=qs[_0x0a34('0x27')](_0x58eefa[_0x0a34('0x56')]['limit']);_0x25d6c0[_0x0a34('0x24')]=qs['offset'](_0x58eefa[_0x0a34('0x56')][_0x0a34('0x24')]);}return _0x278ce9[_0x0a34('0x126')](_0x25d6c0);}})[_0x0a34('0x15')](function(_0x39d68e){if(_0x39d68e){return _0x39d68e?{'count':_0x25ec39,'rows':_0x39d68e}:null;}})[_0x0a34('0x15')](respondWithResult(_0x42ce53,null))[_0x0a34('0x69')](handleError(_0x42ce53,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 42fc08b..3bd8232 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 _0x1629=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update'];(function(_0x34298b,_0x3e5e07){var _0x28a747=function(_0x4b7124){while(--_0x4b7124){_0x34298b['push'](_0x34298b['shift']());}};_0x28a747(++_0x3e5e07);}(_0x1629,0x1d8));var _0x9162=function(_0x301198,_0x968057){_0x301198=_0x301198-0x0;var _0x2e05db=_0x1629[_0x301198];return _0x2e05db;};'use strict';var EventEmitter=require(_0x9162('0x0'));var ChatWebsite=require(_0x9162('0x1'))['db'][_0x9162('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9162('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9162('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5380c8){return function(_0x16bc88,_0x2a8dc1,_0x5b82dc){ChatWebsiteEvents['emit'](_0x5380c8+':'+_0x16bc88['id'],_0x16bc88);ChatWebsiteEvents[_0x9162('0x5')](_0x5380c8,_0x16bc88);_0x5b82dc(null);};}for(var e in events){if(events[_0x9162('0x6')](e)){var event=events[e];ChatWebsite[_0x9162('0x7')](e,emitEvent(event));}}module[_0x9162('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf452=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x141384,_0x2f2e2d){var _0x14814a=function(_0x4a050c){while(--_0x4a050c){_0x141384['push'](_0x141384['shift']());}};_0x14814a(++_0x2f2e2d);}(_0xf452,0x13b));var _0x2f45=function(_0x211747,_0x5a161b){_0x211747=_0x211747-0x0;var _0x493fe2=_0xf452[_0x211747];return _0x493fe2;};'use strict';var EventEmitter=require(_0x2f45('0x0'));var ChatWebsite=require(_0x2f45('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2f45('0x2')](0x0);var events={'afterCreate':_0x2f45('0x3'),'afterUpdate':_0x2f45('0x4'),'afterDestroy':_0x2f45('0x5')};function emitEvent(_0x602b00){return function(_0x3f0b30,_0x24c61d,_0xb2de8a){ChatWebsiteEvents[_0x2f45('0x6')](_0x602b00+':'+_0x3f0b30['id'],_0x3f0b30);ChatWebsiteEvents[_0x2f45('0x6')](_0x602b00,_0x3f0b30);_0xb2de8a(null);};}for(var e in events){if(events[_0x2f45('0x7')](e)){var event=events[e];ChatWebsite[_0x2f45('0x8')](e,emitEvent(event));}}module[_0x2f45('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 5d73f8d..5b957df 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 _0x214f=['path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise'];(function(_0xaa91e3,_0x572006){var _0x104bc4=function(_0x5a48bf){while(--_0x5a48bf){_0xaa91e3['push'](_0xaa91e3['shift']());}};_0x104bc4(++_0x572006);}(_0x214f,0xfe));var _0xf214=function(_0x46e474,_0x32cd6c){_0x46e474=_0x46e474-0x0;var _0x5e12c0=_0x214f[_0x46e474];return _0x5e12c0;};'use strict';var _=require(_0xf214('0x0'));var util=require(_0xf214('0x1'));var logger=require('../../config/logger')(_0xf214('0x2'));var moment=require(_0xf214('0x3'));var BPromise=require(_0xf214('0x4'));var rp=require(_0xf214('0x5'));var fs=require('fs');var path=require(_0xf214('0x6'));var rimraf=require(_0xf214('0x7'));var config=require(_0xf214('0x8'));var attributes=require(_0xf214('0x9'));module['exports']=function(_0x4a4402,_0x459e32){return _0x4a4402[_0xf214('0xa')](_0xf214('0xb'),attributes,{'tableName':_0xf214('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83d7=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites'];(function(_0x39504e,_0x3d47b4){var _0x428a7=function(_0x513154){while(--_0x513154){_0x39504e['push'](_0x39504e['shift']());}};_0x428a7(++_0x3d47b4);}(_0x83d7,0x6c));var _0x783d=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x83d7[_0x32f6b9];return _0x267d52;};'use strict';var _=require(_0x783d('0x0'));var util=require('util');var logger=require(_0x783d('0x1'))(_0x783d('0x2'));var moment=require(_0x783d('0x3'));var BPromise=require('bluebird');var rp=require(_0x783d('0x4'));var fs=require('fs');var path=require(_0x783d('0x5'));var rimraf=require(_0x783d('0x6'));var config=require(_0x783d('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x783d('0x8')]=function(_0x450f95,_0x40f885){return _0x450f95[_0x783d('0x9')](_0x783d('0xa'),attributes,{'tableName':_0x783d('0xb'),'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 3e1b768..b70ee12 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 _0x8e13=['info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x1b40ea,_0x32775e){var _0x542f2b=function(_0x530d5b){while(--_0x530d5b){_0x1b40ea['push'](_0x1b40ea['shift']());}};_0x542f2b(++_0x32775e);}(_0x8e13,0x1a1));var _0x38e1=function(_0x2ab5da,_0x19234c){_0x2ab5da=_0x2ab5da-0x0;var _0x5dd32a=_0x8e13[_0x2ab5da];return _0x5dd32a;};'use strict';var _=require(_0x38e1('0x0'));var util=require(_0x38e1('0x1'));var moment=require(_0x38e1('0x2'));var BPromise=require(_0x38e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38e1('0x4'));var db=require(_0x38e1('0x5'))['db'];var utils=require(_0x38e1('0x6'));var logger=require('../../config/logger')(_0x38e1('0x7'));var config=require(_0x38e1('0x8'));var jayson=require(_0x38e1('0x9'));var client=jayson[_0x38e1('0xa')][_0x38e1('0xb')]({'port':0x232a});config[_0x38e1('0xc')]=_['defaults'](config[_0x38e1('0xc')],{'host':_0x38e1('0xd'),'port':0x18eb});var socket=require(_0x38e1('0xe'))(new Redis(config['redis']));require(_0x38e1('0xf'))[_0x38e1('0x10')](socket);function respondWithRpcPromise(_0xafcae1,_0xe6a133,_0x201866){return new BPromise(function(_0x40bccb,_0xd46691){return client['request'](_0xafcae1,_0x201866)[_0x38e1('0x11')](function(_0x3e2df3){logger['info'](_0x38e1('0x12'),_0xe6a133,_0x38e1('0x13'));logger[_0x38e1('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xe6a133,_0x38e1('0x13'),JSON[_0x38e1('0x15')](_0x3e2df3));if(_0x3e2df3['error']){if(_0x3e2df3['error'][_0x38e1('0x16')]===0x1f4){logger[_0x38e1('0x17')](_0x38e1('0x12'),_0xe6a133,_0x3e2df3['error'][_0x38e1('0x18')]);return _0xd46691(_0x3e2df3[_0x38e1('0x17')][_0x38e1('0x18')]);}logger[_0x38e1('0x17')](_0x38e1('0x12'),_0xe6a133,_0x3e2df3['error'][_0x38e1('0x18')]);return _0x40bccb(_0x3e2df3[_0x38e1('0x17')]['message']);}else{logger[_0x38e1('0x19')](_0x38e1('0x12'),_0xe6a133,'request\x20sent');_0x40bccb(_0x3e2df3['result'][_0x38e1('0x18')]);}})['catch'](function(_0xa0d98){logger[_0x38e1('0x17')](_0x38e1('0x12'),_0xe6a133,_0xa0d98);_0xd46691(_0xa0d98);});});} \ No newline at end of file +var _0xbec5=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x437472,_0x31db2d){var _0x217fce=function(_0x593ccd){while(--_0x593ccd){_0x437472['push'](_0x437472['shift']());}};_0x217fce(++_0x31db2d);}(_0xbec5,0x78));var _0x5bec=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0xbec5[_0x4fdc46];return _0x2c178a;};'use strict';var _=require(_0x5bec('0x0'));var util=require('util');var moment=require(_0x5bec('0x1'));var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson[_0x5bec('0xa')][_0x5bec('0xb')]({'port':0x232a});config['redis']=_[_0x5bec('0xc')](config['redis'],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xf')]));require(_0x5bec('0x10'))[_0x5bec('0x11')](socket);function respondWithRpcPromise(_0x423f70,_0x19e0ff,_0xc085fb){return new BPromise(function(_0x52d5cb,_0x1b8b60){return client[_0x5bec('0x12')](_0x423f70,_0xc085fb)[_0x5bec('0x13')](function(_0x571da1){logger['info'](_0x5bec('0x14'),_0x19e0ff,_0x5bec('0x15'));logger[_0x5bec('0x16')](_0x5bec('0x17'),_0x19e0ff,_0x5bec('0x15'),JSON[_0x5bec('0x18')](_0x571da1));if(_0x571da1['error']){if(_0x571da1[_0x5bec('0x19')][_0x5bec('0x1a')]===0x1f4){logger[_0x5bec('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x19e0ff,_0x571da1['error'][_0x5bec('0x1b')]);return _0x1b8b60(_0x571da1[_0x5bec('0x19')][_0x5bec('0x1b')]);}logger[_0x5bec('0x19')](_0x5bec('0x14'),_0x19e0ff,_0x571da1['error'][_0x5bec('0x1b')]);return _0x52d5cb(_0x571da1[_0x5bec('0x19')][_0x5bec('0x1b')]);}else{logger[_0x5bec('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x19e0ff,'request\x20sent');_0x52d5cb(_0x571da1['result'][_0x5bec('0x1b')]);}})[_0x5bec('0x1d')](function(_0x3f7ff7){logger['error'](_0x5bec('0x14'),_0x19e0ff,_0x3f7ff7);_0x1b8b60(_0x3f7ff7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 205f5da..b33b642 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 _0xc57b=['update','emit','removeListener','register','length','save','remove'];(function(_0xeefaa3,_0x3ebbc8){var _0x1e0fa5=function(_0x25cd93){while(--_0x25cd93){_0xeefaa3['push'](_0xeefaa3['shift']());}};_0x1e0fa5(++_0x3ebbc8);}(_0xc57b,0xd0));var _0xbc57=function(_0x413422,_0x40d34a){_0x413422=_0x413422-0x0;var _0x2d8518=_0xc57b[_0x413422];return _0x2d8518;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xbc57('0x0'),_0xbc57('0x1'),_0xbc57('0x2')];function createListener(_0x1e1121,_0x1e48f9){return function(_0x4a7461){_0x1e48f9[_0xbc57('0x3')](_0x1e1121,_0x4a7461);};}function removeListener(_0x158244,_0x23814d){return function(){ChatWebsiteEvents[_0xbc57('0x4')](_0x158244,_0x23814d);};}exports[_0xbc57('0x5')]=function(_0x40bd50){for(var _0x537ba3=0x0,_0x193bb4=events[_0xbc57('0x6')];_0x537ba3<_0x193bb4;_0x537ba3++){var _0xee1808=events[_0x537ba3];var _0x47b249=createListener('chatWebsite:'+_0xee1808,_0x40bd50);ChatWebsiteEvents['on'](_0xee1808,_0x47b249);}}; \ No newline at end of file +var _0x0af4=['save','remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x275e04,_0x1df425){var _0x3f07c3=function(_0x341007){while(--_0x341007){_0x275e04['push'](_0x275e04['shift']());}};_0x3f07c3(++_0x1df425);}(_0x0af4,0xc5));var _0x40af=function(_0xf677bb,_0x103a34){_0xf677bb=_0xf677bb-0x0;var _0x2c6926=_0x0af4[_0xf677bb];return _0x2c6926;};'use strict';var ChatWebsiteEvents=require(_0x40af('0x0'));var events=[_0x40af('0x1'),_0x40af('0x2'),_0x40af('0x3')];function createListener(_0x3409f9,_0x975caf){return function(_0x253234){_0x975caf[_0x40af('0x4')](_0x3409f9,_0x253234);};}function removeListener(_0x326ead,_0x18e386){return function(){ChatWebsiteEvents[_0x40af('0x5')](_0x326ead,_0x18e386);};}exports[_0x40af('0x6')]=function(_0x3cf3dc){for(var _0x15a4ff=0x0,_0x12ab7e=events[_0x40af('0x7')];_0x15a4ff<_0x12ab7e;_0x15a4ff++){var _0xe3def8=events[_0x15a4ff];var _0x54cdbe=createListener(_0x40af('0x8')+_0xe3def8,_0x3cf3dc);ChatWebsiteEvents['on'](_0xe3def8,_0x54cdbe);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 41f35bb..7af780e 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 _0x04a2=['addProactiveActions','addAgents','delete','destroy','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','/describe','/:id','/:id/dispositions','getDispositions','/:id/logo','getLogo','get','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','diskStorage','join','format','%s-%s','now','file','server/files/images/avatars/','originalname','root','addCustomerAvatar','single','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline'];(function(_0x2bbd33,_0x4530a1){var _0x1c60f7=function(_0x241a61){while(--_0x241a61){_0x2bbd33['push'](_0x2bbd33['shift']());}};_0x1c60f7(++_0x4530a1);}(_0x04a2,0x1c6));var _0x204a=function(_0x1baa9e,_0x5d4a34){_0x1baa9e=_0x1baa9e-0x0;var _0x102243=_0x04a2[_0x1baa9e];return _0x102243;};'use strict';var multer=require(_0x204a('0x0'));var util=require('util');var path=require(_0x204a('0x1'));var timeout=require('connect-timeout');var express=require(_0x204a('0x2'));var router=express[_0x204a('0x3')]();var fs_extra=require(_0x204a('0x4'));var auth=require(_0x204a('0x5'));var interaction=require(_0x204a('0x6'));var config=require(_0x204a('0x7'));var controller=require(_0x204a('0x8'));router['get']('/',auth[_0x204a('0x9')](),controller['index']);router['get'](_0x204a('0xa'),auth[_0x204a('0x9')](),controller['describe']);router['get'](_0x204a('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x204a('0xc'),auth[_0x204a('0x9')](),controller[_0x204a('0xd')]);router['get']('/:id/canned_answers',auth[_0x204a('0x9')](),controller['getAnswers']);router['get'](_0x204a('0xe'),controller[_0x204a('0xf')]);router[_0x204a('0x10')]('/:id/avatar',controller['getAvatar']);router[_0x204a('0x10')](_0x204a('0x11'),controller[_0x204a('0x12')]);router[_0x204a('0x10')](_0x204a('0x13'),controller[_0x204a('0x14')]);router['get'](_0x204a('0x15'),auth[_0x204a('0x9')](),controller[_0x204a('0x16')]);router[_0x204a('0x10')](_0x204a('0x17'),controller[_0x204a('0x18')]);router[_0x204a('0x10')](_0x204a('0x19'),auth[_0x204a('0x9')](),controller[_0x204a('0x1a')]);router[_0x204a('0x10')](_0x204a('0x1b'),auth[_0x204a('0x9')](),controller[_0x204a('0x1c')]);router['get']('/:id/fields',controller[_0x204a('0x1d')]);router[_0x204a('0x10')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x204a('0x10')](_0x204a('0x1e'),auth['isAuthenticated'](),controller[_0x204a('0x1f')]);router['post']('/',auth[_0x204a('0x9')](),controller[_0x204a('0x20')]);router[_0x204a('0x21')](_0x204a('0xc'),auth[_0x204a('0x9')](),controller[_0x204a('0x22')]);router[_0x204a('0x21')](_0x204a('0x23'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0x204a('0x24')]({'destination':function(_0xe5ec71,_0x2e2166,_0x580a28){_0x580a28(null,path[_0x204a('0x25')](config['root'],'server/files/images/logos/'));},'filename':function(_0x117b2c,_0x4a651e,_0x303187){_0x303187(null,util[_0x204a('0x26')](_0x204a('0x27'),Date[_0x204a('0x28')](),_0x4a651e['originalname']));}})});router[_0x204a('0x21')](_0x204a('0xe'),upload['single'](_0x204a('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0x204a('0x24')]({'destination':function(_0x4390bc,_0x100675,_0x1929b9){_0x1929b9(null,path[_0x204a('0x25')](config['root'],_0x204a('0x2a')));},'filename':function(_0x4b17fc,_0x49434f,_0x35ce02){_0x35ce02(null,util['format']('%s-%s',Date[_0x204a('0x28')](),_0x49434f[_0x204a('0x2b')]));}})});router['post']('/:id/avatar',upload['single'](_0x204a('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0x204a('0x24')]({'destination':function(_0x3d0b03,_0x395752,_0x130379){_0x130379(null,path[_0x204a('0x25')](config[_0x204a('0x2c')],_0x204a('0x2a')));},'filename':function(_0xcab663,_0xbeaa7d,_0x5d2857){_0x5d2857(null,util[_0x204a('0x26')](_0x204a('0x27'),Date[_0x204a('0x28')](),_0xbeaa7d[_0x204a('0x2b')]));}})});router[_0x204a('0x21')]('/:id/customer_avatar',upload['single'](_0x204a('0x29')),controller[_0x204a('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x259ac7,_0x528f52,_0x4064ee){_0x4064ee(null,path['join'](config['root'],_0x204a('0x2a')));},'filename':function(_0x5805f8,_0x5b54dd,_0x5451a9){_0x5451a9(null,util[_0x204a('0x26')]('%s-%s',Date[_0x204a('0x28')](),_0x5b54dd[_0x204a('0x2b')]));}})});router['post'](_0x204a('0x13'),upload[_0x204a('0x2e')](_0x204a('0x29')),controller[_0x204a('0x2f')]);router[_0x204a('0x21')](_0x204a('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x204a('0x24')]({'destination':function(_0xc885c2,_0x493678,_0x294765){const _0x1b71ba=path['join'](config[_0x204a('0x2c')],_0x204a('0x31'),_0x204a('0x32'),_0x204a('0x33'));fs_extra[_0x204a('0x34')](_0x1b71ba,function(){_0x294765(null,_0x1b71ba);});},'filename':function(_0x33572d,_0x514e9f,_0x3932d1){const _0x25b171=_0x514e9f[_0x204a('0x2b')][_0x204a('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x319d7e=path[_0x204a('0x36')](_0x25b171);const _0x15e0f0=Date[_0x204a('0x28')]()+'-'+_0x25b171[_0x204a('0x35')](_0x319d7e,'')+_0x319d7e;_0x3932d1(null,_0x15e0f0);}})});router['post'](_0x204a('0x37'),offlineUploadMulter[_0x204a('0x38')](),controller[_0x204a('0x39')]);router[_0x204a('0x21')](_0x204a('0x15'),auth[_0x204a('0x9')](),controller['addInteraction']);router[_0x204a('0x21')](_0x204a('0x19'),auth[_0x204a('0x9')](),controller['addApplications']);router[_0x204a('0x21')](_0x204a('0x1b'),auth[_0x204a('0x9')](),controller[_0x204a('0x3a')]);router[_0x204a('0x21')](_0x204a('0x1e'),auth[_0x204a('0x9')](),controller[_0x204a('0x3b')]);router['put'](_0x204a('0xb'),auth[_0x204a('0x9')](),controller['update']);router[_0x204a('0x3c')]('/:id',auth[_0x204a('0x9')](),controller[_0x204a('0x3d')]);router[_0x204a('0x3c')](_0x204a('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x204a('0x3c')]('/:id/canned_answers',auth[_0x204a('0x9')](),controller[_0x204a('0x3e')]);router[_0x204a('0x3c')](_0x204a('0x1e'),auth[_0x204a('0x9')](),controller['removeAgents']);module[_0x204a('0x3f')]=router; \ No newline at end of file +var _0x1cf2=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','format','%s-%s','now','originalname','single','file','addLogo','join','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','any','offline','addInteraction','addAgents','put','/:id','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1cf2,0x164));var _0x21cf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1cf2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x21cf('0x0'));var util=require(_0x21cf('0x1'));var path=require(_0x21cf('0x2'));var timeout=require(_0x21cf('0x3'));var express=require(_0x21cf('0x4'));var router=express[_0x21cf('0x5')]();var fs_extra=require(_0x21cf('0x6'));var auth=require(_0x21cf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x21cf('0x8'));var controller=require(_0x21cf('0x9'));router[_0x21cf('0xa')]('/',auth[_0x21cf('0xb')](),controller[_0x21cf('0xc')]);router[_0x21cf('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x21cf('0xd')]);router[_0x21cf('0xa')]('/:id',auth[_0x21cf('0xb')](),controller[_0x21cf('0xe')]);router[_0x21cf('0xa')](_0x21cf('0xf'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x10')]);router[_0x21cf('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x21cf('0x11')]);router[_0x21cf('0xa')](_0x21cf('0x12'),controller[_0x21cf('0x13')]);router['get'](_0x21cf('0x14'),controller['getAvatar']);router[_0x21cf('0xa')]('/:id/customer_avatar',controller[_0x21cf('0x15')]);router[_0x21cf('0xa')](_0x21cf('0x16'),controller[_0x21cf('0x17')]);router[_0x21cf('0xa')](_0x21cf('0x18'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x19')]);router[_0x21cf('0xa')](_0x21cf('0x1a'),controller[_0x21cf('0x1b')]);router[_0x21cf('0xa')](_0x21cf('0x1c'),auth[_0x21cf('0xb')](),controller['getApplications']);router[_0x21cf('0xa')](_0x21cf('0x1d'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x1e')]);router[_0x21cf('0xa')](_0x21cf('0x1f'),controller[_0x21cf('0x20')]);router[_0x21cf('0xa')]('/:id/offline_messages',auth[_0x21cf('0xb')](),controller[_0x21cf('0x21')]);router[_0x21cf('0xa')](_0x21cf('0x22'),auth['isAuthenticated'](),controller[_0x21cf('0x23')]);router[_0x21cf('0x24')]('/',auth[_0x21cf('0xb')](),controller[_0x21cf('0x25')]);router[_0x21cf('0x24')](_0x21cf('0xf'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x26')]);router[_0x21cf('0x24')](_0x21cf('0x27'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x28')]);var upload=multer({'storage':multer[_0x21cf('0x29')]({'destination':function(_0x1846f4,_0x572d5d,_0x3b0a3f){_0x3b0a3f(null,path['join'](config[_0x21cf('0x2a')],'server/files/images/logos/'));},'filename':function(_0xb7dd68,_0x5db928,_0xe39b56){_0xe39b56(null,util[_0x21cf('0x2b')](_0x21cf('0x2c'),Date[_0x21cf('0x2d')](),_0x5db928[_0x21cf('0x2e')]));}})});router['post']('/:id/logo',upload[_0x21cf('0x2f')](_0x21cf('0x30')),controller[_0x21cf('0x31')]);var upload=multer({'storage':multer[_0x21cf('0x29')]({'destination':function(_0x5724f4,_0xcd73d6,_0x4b2f9c){_0x4b2f9c(null,path[_0x21cf('0x32')](config['root'],'server/files/images/avatars/'));},'filename':function(_0xd1c338,_0x2c0f9b,_0xb9a118){_0xb9a118(null,util[_0x21cf('0x2b')]('%s-%s',Date[_0x21cf('0x2d')](),_0x2c0f9b[_0x21cf('0x2e')]));}})});router[_0x21cf('0x24')](_0x21cf('0x14'),upload[_0x21cf('0x2f')](_0x21cf('0x30')),controller[_0x21cf('0x33')]);var upload=multer({'storage':multer[_0x21cf('0x29')]({'destination':function(_0x532c77,_0x4e840f,_0x17f1cd){_0x17f1cd(null,path[_0x21cf('0x32')](config[_0x21cf('0x2a')],_0x21cf('0x34')));},'filename':function(_0x5cd299,_0xb1283b,_0x352175){_0x352175(null,util[_0x21cf('0x2b')](_0x21cf('0x2c'),Date[_0x21cf('0x2d')](),_0xb1283b[_0x21cf('0x2e')]));}})});router[_0x21cf('0x24')](_0x21cf('0x35'),upload['single']('file'),controller[_0x21cf('0x36')]);var upload=multer({'storage':multer[_0x21cf('0x29')]({'destination':function(_0x7d5d4b,_0x129754,_0x1af69d){_0x1af69d(null,path[_0x21cf('0x32')](config[_0x21cf('0x2a')],_0x21cf('0x34')));},'filename':function(_0x561ea7,_0x9ba7e5,_0xe3c5da){_0xe3c5da(null,util[_0x21cf('0x2b')]('%s-%s',Date[_0x21cf('0x2d')](),_0x9ba7e5[_0x21cf('0x2e')]));}})});router[_0x21cf('0x24')](_0x21cf('0x16'),upload['single'](_0x21cf('0x30')),controller[_0x21cf('0x37')]);router['post']('/:id/notify',controller[_0x21cf('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x21cf('0x29')]({'destination':function(_0x2d33bc,_0x20ae95,_0x4d1dfb){const _0x2a4153=path[_0x21cf('0x32')](config[_0x21cf('0x2a')],_0x21cf('0x39'),_0x21cf('0x3a'),_0x21cf('0x3b'));fs_extra[_0x21cf('0x3c')](_0x2a4153,function(){_0x4d1dfb(null,_0x2a4153);});},'filename':function(_0x41576b,_0x393a4e,_0x352e1a){const _0x5a0db1=_0x393a4e[_0x21cf('0x2e')][_0x21cf('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x254345=path['extname'](_0x5a0db1);const _0xde6a81=Date[_0x21cf('0x2d')]()+'-'+_0x5a0db1[_0x21cf('0x3d')](_0x254345,'')+_0x254345;_0x352e1a(null,_0xde6a81);}})});router[_0x21cf('0x24')]('/:id/offline',offlineUploadMulter[_0x21cf('0x3e')](),controller[_0x21cf('0x3f')]);router[_0x21cf('0x24')](_0x21cf('0x18'),auth['isAuthenticated'](),controller[_0x21cf('0x40')]);router[_0x21cf('0x24')](_0x21cf('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x21cf('0x24')](_0x21cf('0x1d'),auth[_0x21cf('0xb')](),controller['addProactiveActions']);router[_0x21cf('0x24')](_0x21cf('0x22'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x41')]);router[_0x21cf('0x42')](_0x21cf('0x43'),auth[_0x21cf('0xb')](),controller['update']);router[_0x21cf('0x44')](_0x21cf('0x43'),auth['isAuthenticated'](),controller[_0x21cf('0x45')]);router[_0x21cf('0x44')](_0x21cf('0xf'),auth[_0x21cf('0xb')](),controller['removeDispositions']);router[_0x21cf('0x44')](_0x21cf('0x27'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x46')]);router[_0x21cf('0x44')](_0x21cf('0x22'),auth[_0x21cf('0xb')](),controller[_0x21cf('0x47')]);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 5b3c3f0..e5707f2 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 _0x854d=['exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use'];(function(_0x34cbc6,_0x4e718a){var _0x184488=function(_0x5770c5){while(--_0x5770c5){_0x34cbc6['push'](_0x34cbc6['shift']());}};_0x184488(++_0x4e718a);}(_0x854d,0xf8));var _0xd854=function(_0x42d3d7,_0x47d31b){_0x42d3d7=_0x42d3d7-0x0;var _0x1e16ce=_0x854d[_0x42d3d7];return _0x1e16ce;};var beaverLogger=require(_0xd854('0x0'));var express=require(_0xd854('0x1'));var auth=require(_0xd854('0x2'));var config=require(_0xd854('0x3'));var router=express[_0xd854('0x4')]();var isProduction=config['env']===_0xd854('0x5')||![];function clientSideLogs(_0x1c95ef,_0x470650,_0x446ed8){var _0x4a9c17=_0x1c95ef[_0xd854('0x6')][_0xd854('0x7')](_0xd854('0x8'));if(!_0x4a9c17){throw new Error(_0xd854('0x9'));}return beaverLogger[_0xd854('0xa')]({'uri':'/client-logs','logger':_0x4a9c17,'enableCors':!isProduction})(_0x1c95ef,_0x470650,_0x446ed8);}router[_0xd854('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0xd854('0xc')]=router; \ No newline at end of file +var _0x50d2=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x50d2,0x1d6));var _0x250d=function(_0x37a7ce,_0xeb36f9){_0x37a7ce=_0x37a7ce-0x0;var _0x3890c0=_0x50d2[_0x37a7ce];return _0x3890c0;};var beaverLogger=require(_0x250d('0x0'));var express=require(_0x250d('0x1'));var auth=require(_0x250d('0x2'));var config=require(_0x250d('0x3'));var router=express[_0x250d('0x4')]();var isProduction=config[_0x250d('0x5')]===_0x250d('0x6')||![];function clientSideLogs(_0x1c0f22,_0x225ed4,_0x1242e2){var _0x739200=_0x1c0f22[_0x250d('0x7')][_0x250d('0x8')](_0x250d('0x9'));if(!_0x739200){throw new Error(_0x250d('0xa'));}return beaverLogger[_0x250d('0xb')]({'uri':_0x250d('0xc'),'logger':_0x739200,'enableCors':!isProduction})(_0x1c0f22,_0x225ed4,_0x1242e2);}router[_0x250d('0xd')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 2d3033f..e9e4c8d 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 _0xda92=['MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0xda92,0xf6));var _0x2da9=function(_0x2fd7b3,_0x411cb6){_0x2fd7b3=_0x2fd7b3-0x0;var _0x1787bd=_0xda92[_0x2fd7b3];return _0x1787bd;};'use strict';var Sequelize=require(_0x2da9('0x0'));module[_0x2da9('0x1')]={'name':{'type':Sequelize[_0x2da9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2da9('0x3')](_0x2da9('0x4'),_0x2da9('0x5'),_0x2da9('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x2da9('0x3')](_0x2da9('0x7'),_0x2da9('0x8'))},'data1':{'type':Sequelize[_0x2da9('0x2')],'comment':_0x2da9('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0x2da9('0xa')},'data3':{'type':Sequelize[_0x2da9('0x2')],'comment':_0x2da9('0xb')},'data4':{'type':Sequelize[_0x2da9('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x2da9('0xc')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x2da9('0xc')],'comment':_0x2da9('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xa428=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0x133404,_0x3deea2){var _0x1608e8=function(_0x275a9b){while(--_0x275a9b){_0x133404['push'](_0x133404['shift']());}};_0x1608e8(++_0x3deea2);}(_0xa428,0xbd));var _0x8a42=function(_0x55f6fc,_0xaa8760){_0x55f6fc=_0x55f6fc-0x0;var _0x4c0059=_0xa428[_0x55f6fc];return _0x4c0059;};'use strict';var Sequelize=require(_0x8a42('0x0'));module[_0x8a42('0x1')]={'name':{'type':Sequelize[_0x8a42('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8a42('0x3')](_0x8a42('0x4'),_0x8a42('0x5'),_0x8a42('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x8a42('0x3')](_0x8a42('0x7'),_0x8a42('0x8'))},'data1':{'type':Sequelize[_0x8a42('0x2')],'comment':_0x8a42('0x9')},'data2':{'type':Sequelize[_0x8a42('0x2')],'comment':_0x8a42('0xa')},'data3':{'type':Sequelize[_0x8a42('0x2')],'comment':_0x8a42('0xb')},'data4':{'type':Sequelize[_0x8a42('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x8a42('0xc')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x8a42('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x8a42('0xc')],'comment':_0x8a42('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 573f1ae..fdedf88 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 _0x33af=['defaults','localhost','socket.io-emitter','redis','status','end','offset','undefined','limit','set','Content-Range','json','update','then','sendStatus','error','stack','padEnd','slice','CloudProvider','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','name','filter','options','count','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','catch','show','data3','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','find','params','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/parsers/qs','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x33af,0x176));var _0xf33a=function(_0xa650d8,_0x6d01ef){_0xa650d8=_0xa650d8-0x0;var _0x79ce97=_0x33af[_0xa650d8];return _0x79ce97;};'use strict';var _=require(_0xf33a('0x0'));var Redis=require('ioredis');var qs=require(_0xf33a('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xf33a('0x2'));var logger=require(_0xf33a('0x3'))('api');var db=require(_0xf33a('0x4'))['db'];var oauth=require(_0xf33a('0x5'));config['redis']=_[_0xf33a('0x6')](config['redis'],{'host':_0xf33a('0x7'),'port':0x18eb});var socket=require(_0xf33a('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0xf33a('0x9')]);function respondWithStatusCode(_0x4384e7,_0x17f062){_0x17f062=_0x17f062||0xcc;return function(_0x58cda9){if(_0x58cda9){return _0x4384e7['sendStatus'](_0x17f062);}return _0x4384e7[_0xf33a('0xa')](_0x17f062)[_0xf33a('0xb')]();};}function respondWithResult(_0x5a5f6f,_0x4b427e){_0x4b427e=_0x4b427e||0xc8;return function(_0x161257){if(_0x161257){return _0x5a5f6f['status'](_0x4b427e)['json'](_0x161257);}};}function respondWithFilteredResult(_0x4d9b19,_0x3f5517){return function(_0x5e7dd9){if(_0x5e7dd9){var _0x585c90=typeof _0x3f5517[_0xf33a('0xc')]===_0xf33a('0xd')&&typeof _0x3f5517[_0xf33a('0xe')]===_0xf33a('0xd');var _0x1d91ed=_0x5e7dd9['count'];var _0x47b06a=_0x585c90?0x0:_0x3f5517[_0xf33a('0xc')];var _0x26ffe4=_0x585c90?_0x5e7dd9['count']:_0x3f5517[_0xf33a('0xc')]+_0x3f5517[_0xf33a('0xe')];var _0x4b0bed;if(_0x26ffe4>=_0x1d91ed){_0x26ffe4=_0x1d91ed;_0x4b0bed=0xc8;}else{_0x4b0bed=0xce;}_0x4d9b19[_0xf33a('0xa')](_0x4b0bed);return _0x4d9b19[_0xf33a('0xf')](_0xf33a('0x10'),_0x47b06a+'-'+_0x26ffe4+'/'+_0x1d91ed)[_0xf33a('0x11')](_0x5e7dd9);}return null;};}function saveUpdates(_0x1705c3){return function(_0x2c7081){if(_0x2c7081){return _0x2c7081[_0xf33a('0x12')](_0x1705c3)['then'](function(_0x3c428c){return _0x3c428c;});}return null;};}function removeEntity(_0x2e3b53){return function(_0x3aed11){if(_0x3aed11){return _0x3aed11['destroy']()[_0xf33a('0x13')](function(){_0x2e3b53[_0xf33a('0xa')](0xcc)[_0xf33a('0xb')]();});}};}function handleEntityNotFound(_0x3416b2){return function(_0x4fb7cd){if(!_0x4fb7cd){_0x3416b2[_0xf33a('0x14')](0x194);}return _0x4fb7cd;};}function handleError(_0x524709,_0x52dcbd){_0x52dcbd=_0x52dcbd||0x1f4;return function(_0x1b97e2){logger[_0xf33a('0x15')](_0x1b97e2[_0xf33a('0x16')]);if(_0x1b97e2['name']){delete _0x1b97e2['name'];}_0x524709[_0xf33a('0xa')](_0x52dcbd)['send'](_0x1b97e2);};}function maskClientSecret(_0xb68083){return _[_0xf33a('0x17')](_0xb68083[_0xf33a('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0xfbc74c,_0x3030cd){var _0x2541db={},_0x528073={},_0x51c583={'count':0x0,'rows':[]};var _0x1bac6d=_['map'](db[_0xf33a('0x19')][_0xf33a('0x1a')],function(_0x516d58){return{'name':_0x516d58['fieldName'],'type':_0x516d58[_0xf33a('0x1b')][_0xf33a('0x1c')]};});_0x528073[_0xf33a('0x1d')]=_['map'](_0x1bac6d,'name');_0x528073['query']=_[_0xf33a('0x1e')](_0xfbc74c[_0xf33a('0x1f')]);_0x528073['filters']=_[_0xf33a('0x20')](_0x528073[_0xf33a('0x1d')],_0x528073[_0xf33a('0x1f')]);_0x2541db[_0xf33a('0x21')]=_[_0xf33a('0x20')](_0x528073[_0xf33a('0x1d')],qs[_0xf33a('0x22')](_0xfbc74c['query']['fields']));_0x2541db['attributes']=_0x2541db[_0xf33a('0x21')][_0xf33a('0x23')]?_0x2541db[_0xf33a('0x21')]:_0x528073[_0xf33a('0x1d')];if(!_0xfbc74c[_0xf33a('0x1f')][_0xf33a('0x24')](_0xf33a('0x25'))){_0x2541db[_0xf33a('0xe')]=qs[_0xf33a('0xe')](_0xfbc74c['query'][_0xf33a('0xe')]);_0x2541db['offset']=qs[_0xf33a('0xc')](_0xfbc74c[_0xf33a('0x1f')][_0xf33a('0xc')]);}_0x2541db[_0xf33a('0x26')]=qs[_0xf33a('0x27')](_0xfbc74c[_0xf33a('0x1f')][_0xf33a('0x27')]);_0x2541db[_0xf33a('0x28')]=qs['filters'](_['pick'](_0xfbc74c[_0xf33a('0x1f')],_0x528073['filters']),_0x1bac6d);if(_0xfbc74c[_0xf33a('0x1f')]['filter']){_0x2541db[_0xf33a('0x28')]=_[_0xf33a('0x29')](_0x2541db[_0xf33a('0x28')],{'$or':_[_0xf33a('0x2a')](_0x1bac6d,function(_0x1e6281){if(_0x1e6281['type']!==_0xf33a('0x2b')){var _0x334ee6={};_0x334ee6[_0x1e6281[_0xf33a('0x2c')]]={'$like':'%'+_0xfbc74c[_0xf33a('0x1f')][_0xf33a('0x2d')]+'%'};return _0x334ee6;}})});}_0x2541db=_[_0xf33a('0x29')]({},_0x2541db,_0xfbc74c[_0xf33a('0x2e')]);var _0x1bb4c1={'where':_0x2541db[_0xf33a('0x28')]};return db[_0xf33a('0x19')][_0xf33a('0x2f')](_0x1bb4c1)[_0xf33a('0x13')](function(_0x45159d){_0x51c583[_0xf33a('0x2f')]=_0x45159d;if(_0xfbc74c['query'][_0xf33a('0x30')]){_0x2541db[_0xf33a('0x31')]=[{'all':!![]}];}return db[_0xf33a('0x19')][_0xf33a('0x32')](_0x2541db);})[_0xf33a('0x13')](function(_0x3dbd73){_0x51c583[_0xf33a('0x33')]=_[_0xf33a('0x2a')](_0x3dbd73,function(_0x37da2d){if(_0x37da2d[_0xf33a('0x34')]===_0xf33a('0x35')){var _0x5b52be=encryptor[_0xf33a('0x36')](_0x37da2d['data3']);_0x37da2d['data3']=maskClientSecret(_0x5b52be);}return _0x37da2d;});return _0x51c583;})['then'](respondWithFilteredResult(_0x3030cd,_0x2541db))[_0xf33a('0x37')](handleError(_0x3030cd,null));};exports[_0xf33a('0x38')]=function(_0x498ed4,_0x3434a8){var _0x3bfbcd={'raw':!![],'where':{'id':_0x498ed4['params']['id']}},_0x1ee6fb={};_0x1ee6fb['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x1ee6fb[_0xf33a('0x1f')]=_[_0xf33a('0x1e')](_0x498ed4['query']);_0x1ee6fb['filters']=_['intersection'](_0x1ee6fb[_0xf33a('0x1d')],_0x1ee6fb[_0xf33a('0x1f')]);_0x3bfbcd[_0xf33a('0x21')]=_[_0xf33a('0x20')](_0x1ee6fb[_0xf33a('0x1d')],qs[_0xf33a('0x22')](_0x498ed4[_0xf33a('0x1f')][_0xf33a('0x22')]));_0x3bfbcd[_0xf33a('0x21')]=_0x3bfbcd['attributes'][_0xf33a('0x23')]?_0x3bfbcd['attributes']:_0x1ee6fb[_0xf33a('0x1d')];if(_0x498ed4[_0xf33a('0x1f')][_0xf33a('0x30')]){_0x3bfbcd[_0xf33a('0x31')]=[{'all':!![]}];}_0x3bfbcd=_[_0xf33a('0x29')]({},_0x3bfbcd,_0x498ed4[_0xf33a('0x2e')]);return db[_0xf33a('0x19')]['find'](_0x3bfbcd)[_0xf33a('0x13')](handleEntityNotFound(_0x3434a8,null))[_0xf33a('0x13')](function(_0x5183de){if(_0x5183de[_0xf33a('0x34')]==='MicrosoftAzure'){var _0x340819=encryptor[_0xf33a('0x36')](_0x5183de[_0xf33a('0x39')]);_0x5183de[_0xf33a('0x39')]=maskClientSecret(_0x340819);}return _0x5183de;})[_0xf33a('0x13')](respondWithResult(_0x3434a8,null))[_0xf33a('0x37')](handleError(_0x3434a8,null));};exports['create']=function(_0x262263,_0x33ba53){if(!_0x262263[_0xf33a('0x3a')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x262263['body'][_0xf33a('0x34')])throw new Error(_0xf33a('0x3b'));var _0x289b95=db[_0xf33a('0x19')][_0xf33a('0x1a')][_0xf33a('0x34')][_0xf33a('0x3c')];if(!_0x289b95[_0xf33a('0x3d')](_0x262263['body'][_0xf33a('0x34')]))throw new Error(_0xf33a('0x3e')+_0x289b95[_0xf33a('0x3f')](',\x20'));if(_0x262263['body']['service']===_0xf33a('0x35')&&_0x262263[_0xf33a('0x3a')][_0xf33a('0x39')]){_0x262263[_0xf33a('0x3a')][_0xf33a('0x39')]=encryptor[_0xf33a('0x40')](_0x262263[_0xf33a('0x3a')][_0xf33a('0x39')]);}return db['CloudProvider'][_0xf33a('0x41')](_0x262263[_0xf33a('0x3a')],{})['then'](respondWithResult(_0x33ba53,0xc9))[_0xf33a('0x37')](handleError(_0x33ba53,null));};exports['update']=function(_0x1b5146,_0x311914){if(_0x1b5146[_0xf33a('0x3a')]['id']){delete _0x1b5146['body']['id'];}return db[_0xf33a('0x19')][_0xf33a('0x42')]({'where':{'id':_0x1b5146[_0xf33a('0x43')]['id']}})['then'](handleEntityNotFound(_0x311914,null))[_0xf33a('0x13')](function(_0x18157f){if(_0x18157f[_0xf33a('0x34')]===_0xf33a('0x35')&&_0x1b5146[_0xf33a('0x3a')]['data3']){_0x1b5146[_0xf33a('0x3a')][_0xf33a('0x39')]=encryptor[_0xf33a('0x40')](_0x1b5146['body']['data3']);}return _0x18157f;})[_0xf33a('0x13')](saveUpdates(_0x1b5146['body'],null))['then'](respondWithResult(_0x311914,null))[_0xf33a('0x37')](handleError(_0x311914,null));};exports[_0xf33a('0x44')]=function(_0x1c29fb,_0x212a39){return db[_0xf33a('0x19')][_0xf33a('0x42')]({'where':{'id':_0x1c29fb[_0xf33a('0x43')]['id']}})[_0xf33a('0x13')](handleEntityNotFound(_0x212a39,null))[_0xf33a('0x13')](removeEntity(_0x212a39,null))[_0xf33a('0x37')](handleError(_0x212a39,null));};exports[_0xf33a('0x45')]=function(_0x584153,_0x42ba0c){return db['CloudProvider'][_0xf33a('0x46')]({'where':{'id':_0x584153['params']['id']},'raw':!![]})[_0xf33a('0x13')](function(_0x5272b2){if(!_0x5272b2)return _0x42ba0c[_0xf33a('0x14')](0x194);return{'url':oauth[_0xf33a('0x47')](_0x5272b2,_0x584153['user']['id'])};})[_0xf33a('0x13')](respondWithResult(_0x42ba0c,null))['catch'](handleError(_0x42ba0c,null));};exports[_0xf33a('0x48')]=function(_0x5f241b,_0x393b52){var _0x5bde58=_0x5f241b[_0xf33a('0x3a')];var _0x30ae37;var _0x1e248c;if(_0x5bde58[_0xf33a('0x15')])throw _0x5bde58;redis[_0xf33a('0x49')](_0x5bde58['state'])[_0xf33a('0x13')](function(_0x13680c){if(!_0x13680c)throw new Error(_0xf33a('0x4a'));_0x30ae37=JSON[_0xf33a('0x4b')](_0x13680c);var _0x6156c8=Buffer[_0xf33a('0x4c')](_0x5bde58[_0xf33a('0x4d')],_0xf33a('0x4e'))['toString'](_0xf33a('0x4f'));_0x1e248c=JSON[_0xf33a('0x4b')](_0x6156c8);if(!oauth['isValidIdToken'](_0x5bde58[_0xf33a('0x50')],_0x30ae37[_0xf33a('0x51')]))throw new Error(_0xf33a('0x52'));redis['del'](_0x5bde58['state']);return oauth[_0xf33a('0x53')](_0x5bde58[_0xf33a('0x54')],_0x30ae37);})[_0xf33a('0x13')](function(_0x4efafc){_0x30ae37[_0xf33a('0x55')]=_0x4efafc[_0xf33a('0x56')];_0x30ae37[_0xf33a('0x57')]=_0x4efafc[_0xf33a('0x58')];return db[_0xf33a('0x19')][_0xf33a('0x12')]({'data5':_0x30ae37[_0xf33a('0x55')],'data6':_0x30ae37['data6']},{'where':{'id':_0x30ae37['id']}});})[_0xf33a('0x13')](function(){oauth['startRefreshInterval'](_0x30ae37);socket[_0xf33a('0x59')](_0xf33a('0x5a'),{'id':_0x1e248c['id']});return;})[_0xf33a('0x13')](respondWithStatusCode(_0x393b52,null))[_0xf33a('0x37')](function(_0x435ba8){if(_0x1e248c){socket[_0xf33a('0x59')](_0xf33a('0x5b'),{'id':_0x1e248c['id']});}if(!_0x30ae37){logger[_0xf33a('0x15')]('Invalid\x20authentication\x20state\x20parameter',_0x435ba8);return _0x393b52[_0xf33a('0xa')](0x1f4)[_0xf33a('0x5c')](_0x435ba8[_0xf33a('0x5d')]);}logger[_0xf33a('0x15')](_0xf33a('0x5e'),_0x30ae37['id'],JSON['stringify'](_0x435ba8));});}; \ No newline at end of file +var _0xa400=['id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','localhost','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','padEnd','slice','map','CloudProvider','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','MicrosoftAzure','decryptString','data3','catch','params','intersection','options','find','create','body','Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','base64','ascii','parse','isValidIdToken'];(function(_0x2c8d76,_0xd3fb53){var _0x4eaeaa=function(_0x1fda99){while(--_0x1fda99){_0x2c8d76['push'](_0x2c8d76['shift']());}};_0x4eaeaa(++_0xd3fb53);}(_0xa400,0x111));var _0x0a40=function(_0x33d724,_0x58cd57){_0x33d724=_0x33d724-0x0;var _0x4c0267=_0xa400[_0x33d724];return _0x4c0267;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x0a40('0x0'));var logger=require(_0x0a40('0x1'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x0a40('0x2'));config[_0x0a40('0x3')]=_['defaults'](config[_0x0a40('0x3')],{'host':_0x0a40('0x4'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x0a40('0x3')]);function respondWithStatusCode(_0x11cf9a,_0x56831f){_0x56831f=_0x56831f||0xcc;return function(_0x236b42){if(_0x236b42){return _0x11cf9a['sendStatus'](_0x56831f);}return _0x11cf9a[_0x0a40('0x5')](_0x56831f)[_0x0a40('0x6')]();};}function respondWithResult(_0x14740c,_0x2a8c14){_0x2a8c14=_0x2a8c14||0xc8;return function(_0x2ad06c){if(_0x2ad06c){return _0x14740c[_0x0a40('0x5')](_0x2a8c14)[_0x0a40('0x7')](_0x2ad06c);}};}function respondWithFilteredResult(_0x3fdc89,_0x5b7386){return function(_0x1de0ea){if(_0x1de0ea){var _0x4dec4c=typeof _0x5b7386[_0x0a40('0x8')]===_0x0a40('0x9')&&typeof _0x5b7386['limit']===_0x0a40('0x9');var _0x5ef11b=_0x1de0ea[_0x0a40('0xa')];var _0xa24c10=_0x4dec4c?0x0:_0x5b7386['offset'];var _0x4d115d=_0x4dec4c?_0x1de0ea[_0x0a40('0xa')]:_0x5b7386['offset']+_0x5b7386[_0x0a40('0xb')];var _0x370c57;if(_0x4d115d>=_0x5ef11b){_0x4d115d=_0x5ef11b;_0x370c57=0xc8;}else{_0x370c57=0xce;}_0x3fdc89[_0x0a40('0x5')](_0x370c57);return _0x3fdc89[_0x0a40('0xc')](_0x0a40('0xd'),_0xa24c10+'-'+_0x4d115d+'/'+_0x5ef11b)[_0x0a40('0x7')](_0x1de0ea);}return null;};}function saveUpdates(_0x58b7ad){return function(_0x1e14e0){if(_0x1e14e0){return _0x1e14e0[_0x0a40('0xe')](_0x58b7ad)[_0x0a40('0xf')](function(_0x524149){return _0x524149;});}return null;};}function removeEntity(_0x2a32a6){return function(_0x4bb129){if(_0x4bb129){return _0x4bb129[_0x0a40('0x10')]()[_0x0a40('0xf')](function(){_0x2a32a6[_0x0a40('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e0d90){return function(_0xd3c802){if(!_0xd3c802){_0x1e0d90[_0x0a40('0x11')](0x194);}return _0xd3c802;};}function handleError(_0x292a73,_0x5820ac){_0x5820ac=_0x5820ac||0x1f4;return function(_0x3c9be1){logger[_0x0a40('0x12')](_0x3c9be1[_0x0a40('0x13')]);if(_0x3c9be1[_0x0a40('0x14')]){delete _0x3c9be1['name'];}_0x292a73[_0x0a40('0x5')](_0x5820ac)[_0x0a40('0x15')](_0x3c9be1);};}function maskClientSecret(_0x3d605f){return _[_0x0a40('0x16')](_0x3d605f[_0x0a40('0x17')](0x0,0x3),0x14,'*');}exports['index']=function(_0x547bc4,_0x575001){var _0xeebaf={},_0x21b899={},_0x50e682={'count':0x0,'rows':[]};var _0x54dd08=_[_0x0a40('0x18')](db[_0x0a40('0x19')][_0x0a40('0x1a')],function(_0xa8649){return{'name':_0xa8649[_0x0a40('0x1b')],'type':_0xa8649[_0x0a40('0x1c')][_0x0a40('0x1d')]};});_0x21b899[_0x0a40('0x1e')]=_[_0x0a40('0x18')](_0x54dd08,_0x0a40('0x14'));_0x21b899['query']=_[_0x0a40('0x1f')](_0x547bc4[_0x0a40('0x20')]);_0x21b899[_0x0a40('0x21')]=_['intersection'](_0x21b899['model'],_0x21b899[_0x0a40('0x20')]);_0xeebaf[_0x0a40('0x22')]=_['intersection'](_0x21b899['model'],qs['fields'](_0x547bc4[_0x0a40('0x20')][_0x0a40('0x23')]));_0xeebaf['attributes']=_0xeebaf[_0x0a40('0x22')][_0x0a40('0x24')]?_0xeebaf[_0x0a40('0x22')]:_0x21b899[_0x0a40('0x1e')];if(!_0x547bc4[_0x0a40('0x20')][_0x0a40('0x25')]('nolimit')){_0xeebaf['limit']=qs[_0x0a40('0xb')](_0x547bc4['query'][_0x0a40('0xb')]);_0xeebaf['offset']=qs[_0x0a40('0x8')](_0x547bc4[_0x0a40('0x20')]['offset']);}_0xeebaf[_0x0a40('0x26')]=qs[_0x0a40('0x27')](_0x547bc4[_0x0a40('0x20')]['sort']);_0xeebaf[_0x0a40('0x28')]=qs[_0x0a40('0x21')](_['pick'](_0x547bc4[_0x0a40('0x20')],_0x21b899['filters']),_0x54dd08);if(_0x547bc4[_0x0a40('0x20')][_0x0a40('0x29')]){_0xeebaf[_0x0a40('0x28')]=_[_0x0a40('0x2a')](_0xeebaf[_0x0a40('0x28')],{'$or':_[_0x0a40('0x18')](_0x54dd08,function(_0x13fe15){if(_0x13fe15[_0x0a40('0x1c')]!==_0x0a40('0x2b')){var _0x2dde28={};_0x2dde28[_0x13fe15[_0x0a40('0x14')]]={'$like':'%'+_0x547bc4[_0x0a40('0x20')]['filter']+'%'};return _0x2dde28;}})});}_0xeebaf=_[_0x0a40('0x2a')]({},_0xeebaf,_0x547bc4['options']);var _0x23248c={'where':_0xeebaf[_0x0a40('0x28')]};return db[_0x0a40('0x19')][_0x0a40('0xa')](_0x23248c)[_0x0a40('0xf')](function(_0x58409c){_0x50e682[_0x0a40('0xa')]=_0x58409c;if(_0x547bc4[_0x0a40('0x20')][_0x0a40('0x2c')]){_0xeebaf['include']=[{'all':!![]}];}return db[_0x0a40('0x19')][_0x0a40('0x2d')](_0xeebaf);})[_0x0a40('0xf')](function(_0x733afe){_0x50e682['rows']=_[_0x0a40('0x18')](_0x733afe,function(_0x18614b){if(_0x18614b['service']===_0x0a40('0x2e')){var _0x1f24cd=encryptor[_0x0a40('0x2f')](_0x18614b[_0x0a40('0x30')]);_0x18614b['data3']=maskClientSecret(_0x1f24cd);}return _0x18614b;});return _0x50e682;})[_0x0a40('0xf')](respondWithFilteredResult(_0x575001,_0xeebaf))[_0x0a40('0x31')](handleError(_0x575001,null));};exports['show']=function(_0x512fa5,_0x495abd){var _0x3adc1b={'raw':!![],'where':{'id':_0x512fa5[_0x0a40('0x32')]['id']}},_0x3088cb={};_0x3088cb['model']=_['keys'](db[_0x0a40('0x19')][_0x0a40('0x1a')]);_0x3088cb[_0x0a40('0x20')]=_[_0x0a40('0x1f')](_0x512fa5[_0x0a40('0x20')]);_0x3088cb['filters']=_[_0x0a40('0x33')](_0x3088cb[_0x0a40('0x1e')],_0x3088cb[_0x0a40('0x20')]);_0x3adc1b['attributes']=_['intersection'](_0x3088cb[_0x0a40('0x1e')],qs['fields'](_0x512fa5[_0x0a40('0x20')][_0x0a40('0x23')]));_0x3adc1b[_0x0a40('0x22')]=_0x3adc1b[_0x0a40('0x22')][_0x0a40('0x24')]?_0x3adc1b[_0x0a40('0x22')]:_0x3088cb['model'];if(_0x512fa5['query'][_0x0a40('0x2c')]){_0x3adc1b['include']=[{'all':!![]}];}_0x3adc1b=_[_0x0a40('0x2a')]({},_0x3adc1b,_0x512fa5[_0x0a40('0x34')]);return db[_0x0a40('0x19')][_0x0a40('0x35')](_0x3adc1b)[_0x0a40('0xf')](handleEntityNotFound(_0x495abd,null))[_0x0a40('0xf')](function(_0x2bf098){if(_0x2bf098['service']===_0x0a40('0x2e')){var _0x1cabca=encryptor[_0x0a40('0x2f')](_0x2bf098[_0x0a40('0x30')]);_0x2bf098[_0x0a40('0x30')]=maskClientSecret(_0x1cabca);}return _0x2bf098;})[_0x0a40('0xf')](respondWithResult(_0x495abd,null))[_0x0a40('0x31')](handleError(_0x495abd,null));};exports[_0x0a40('0x36')]=function(_0x2bacf7,_0x3d1adb){if(!_0x2bacf7[_0x0a40('0x37')]['name'])throw new Error(_0x0a40('0x38'));if(!_0x2bacf7[_0x0a40('0x37')][_0x0a40('0x39')])throw new Error(_0x0a40('0x3a'));var _0x158a4b=db[_0x0a40('0x19')]['rawAttributes']['service']['values'];if(!_0x158a4b['includes'](_0x2bacf7[_0x0a40('0x37')][_0x0a40('0x39')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x158a4b[_0x0a40('0x3b')](',\x20'));if(_0x2bacf7[_0x0a40('0x37')]['service']===_0x0a40('0x2e')&&_0x2bacf7[_0x0a40('0x37')][_0x0a40('0x30')]){_0x2bacf7[_0x0a40('0x37')][_0x0a40('0x30')]=encryptor[_0x0a40('0x3c')](_0x2bacf7['body']['data3']);}return db[_0x0a40('0x19')][_0x0a40('0x36')](_0x2bacf7[_0x0a40('0x37')],{})['then'](respondWithResult(_0x3d1adb,0xc9))[_0x0a40('0x31')](handleError(_0x3d1adb,null));};exports[_0x0a40('0xe')]=function(_0x1942d6,_0x3632e0){if(_0x1942d6[_0x0a40('0x37')]['id']){delete _0x1942d6[_0x0a40('0x37')]['id'];}return db['CloudProvider'][_0x0a40('0x35')]({'where':{'id':_0x1942d6[_0x0a40('0x32')]['id']}})[_0x0a40('0xf')](handleEntityNotFound(_0x3632e0,null))['then'](function(_0x352517){if(_0x352517[_0x0a40('0x39')]===_0x0a40('0x2e')&&_0x1942d6[_0x0a40('0x37')]['data3']){_0x1942d6[_0x0a40('0x37')][_0x0a40('0x30')]=encryptor[_0x0a40('0x3c')](_0x1942d6[_0x0a40('0x37')]['data3']);}return _0x352517;})[_0x0a40('0xf')](saveUpdates(_0x1942d6[_0x0a40('0x37')],null))[_0x0a40('0xf')](respondWithResult(_0x3632e0,null))[_0x0a40('0x31')](handleError(_0x3632e0,null));};exports[_0x0a40('0x10')]=function(_0xb40991,_0xaf0ec6){return db['CloudProvider'][_0x0a40('0x35')]({'where':{'id':_0xb40991[_0x0a40('0x32')]['id']}})[_0x0a40('0xf')](handleEntityNotFound(_0xaf0ec6,null))['then'](removeEntity(_0xaf0ec6,null))['catch'](handleError(_0xaf0ec6,null));};exports[_0x0a40('0x3d')]=function(_0x51be0e,_0x2bc6a5){return db[_0x0a40('0x19')][_0x0a40('0x3e')]({'where':{'id':_0x51be0e['params']['id']},'raw':!![]})[_0x0a40('0xf')](function(_0x5b9668){if(!_0x5b9668)return _0x2bc6a5[_0x0a40('0x11')](0x194);return{'url':oauth[_0x0a40('0x3f')](_0x5b9668,_0x51be0e[_0x0a40('0x40')]['id'])};})[_0x0a40('0xf')](respondWithResult(_0x2bc6a5,null))[_0x0a40('0x31')](handleError(_0x2bc6a5,null));};exports['oauth2MicrosoftCallback']=function(_0xf7ac2c,_0x4014ce){var _0x18bac7=_0xf7ac2c['body'];var _0x535301;var _0x54dfa5;if(_0x18bac7['error'])throw _0x18bac7;redis[_0x0a40('0x41')](_0x18bac7[_0x0a40('0x42')])[_0x0a40('0xf')](function(_0x52aba9){if(!_0x52aba9)throw new Error('Invalid\x20state\x20parameter');_0x535301=JSON['parse'](_0x52aba9);var _0x43ef08=Buffer['from'](_0x18bac7[_0x0a40('0x42')],_0x0a40('0x43'))['toString'](_0x0a40('0x44'));_0x54dfa5=JSON[_0x0a40('0x45')](_0x43ef08);if(!oauth[_0x0a40('0x46')](_0x18bac7[_0x0a40('0x47')],_0x535301[_0x0a40('0x48')]))throw new Error(_0x0a40('0x49'));redis[_0x0a40('0x4a')](_0x18bac7['state']);return oauth[_0x0a40('0x4b')](_0x18bac7['code'],_0x535301);})['then'](function(_0x1fe91e){_0x535301[_0x0a40('0x4c')]=_0x1fe91e['access_token'];_0x535301[_0x0a40('0x4d')]=_0x1fe91e[_0x0a40('0x4e')];return db[_0x0a40('0x19')][_0x0a40('0xe')]({'data5':_0x535301[_0x0a40('0x4c')],'data6':_0x535301[_0x0a40('0x4d')]},{'where':{'id':_0x535301['id']}});})[_0x0a40('0xf')](function(){oauth[_0x0a40('0x4f')](_0x535301);socket[_0x0a40('0x50')](_0x0a40('0x51'),{'id':_0x54dfa5['id']});return;})[_0x0a40('0xf')](respondWithStatusCode(_0x4014ce,null))[_0x0a40('0x31')](function(_0x144bbb){if(_0x54dfa5){socket[_0x0a40('0x50')](_0x0a40('0x52'),{'id':_0x54dfa5['id']});}if(!_0x535301){logger[_0x0a40('0x12')](_0x0a40('0x53'),_0x144bbb);return _0x4014ce[_0x0a40('0x5')](0x1f4)[_0x0a40('0x15')](_0x144bbb[_0x0a40('0x54')]);}logger[_0x0a40('0x12')](_0x0a40('0x55'),_0x535301['id'],JSON['stringify'](_0x144bbb));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6e1a17c..e23280a 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 _0x4965=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','lodash'];(function(_0x444127,_0x27d1e9){var _0x5855c0=function(_0x143f95){while(--_0x143f95){_0x444127['push'](_0x444127['shift']());}};_0x5855c0(++_0x27d1e9);}(_0x4965,0x167));var _0x5496=function(_0x30a193,_0x158ad6){_0x30a193=_0x30a193-0x0;var _0x5d6ccd=_0x4965[_0x30a193];return _0x5d6ccd;};'use strict';var _=require(_0x5496('0x0'));var util=require('util');var logger=require(_0x5496('0x1'))(_0x5496('0x2'));var moment=require('moment');var BPromise=require(_0x5496('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5496('0x4'));var rimraf=require(_0x5496('0x5'));var config=require(_0x5496('0x6'));var attributes=require(_0x5496('0x7'));module[_0x5496('0x8')]=function(_0x330ccc,_0x2aa082){return _0x330ccc[_0x5496('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2e7=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa2e7,0xe4));var _0x7a2e=function(_0x3c7700,_0x3f132b){_0x3c7700=_0x3c7700-0x0;var _0x1b2eb4=_0xa2e7[_0x3c7700];return _0x1b2eb4;};'use strict';var _=require('lodash');var util=require(_0x7a2e('0x0'));var logger=require(_0x7a2e('0x1'))(_0x7a2e('0x2'));var moment=require(_0x7a2e('0x3'));var BPromise=require(_0x7a2e('0x4'));var rp=require(_0x7a2e('0x5'));var fs=require('fs');var path=require(_0x7a2e('0x6'));var rimraf=require(_0x7a2e('0x7'));var config=require(_0x7a2e('0x8'));var attributes=require(_0x7a2e('0x9'));module[_0x7a2e('0xa')]=function(_0x5d0921,_0x29d5ac){return _0x5d0921['define'](_0x7a2e('0xb'),attributes,{'tableName':_0x7a2e('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 f18413e..06486cd 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 _0x17e3=['https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','code','id_token','from','stringify','base64','toString','hex','client_id','response_type','data4','form_post','scope','state','login','map','value','oauth2/','data1','set','decode','payload','issuer','aud','nonce','isAfter','unix','exp','data3','CloudProvider','findOne','refresh_token','data6','POST','data2','then','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','all','exports','lodash','crypto','moment','ioredis','request-promise','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365'];(function(_0x23064d,_0x5d6c5c){var _0x3c28a=function(_0x28d134){while(--_0x28d134){_0x23064d['push'](_0x23064d['shift']());}};_0x3c28a(++_0x5d6c5c);}(_0x17e3,0x1ae));var _0x317e=function(_0x156897,_0x65c5e2){_0x156897=_0x156897-0x0;var _0xeeeaf7=_0x17e3[_0x156897];return _0xeeeaf7;};'use strict';var _=require(_0x317e('0x0'));var crypto=require(_0x317e('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x317e('0x2'));var Redis=require(_0x317e('0x3'));var rp=require(_0x317e('0x4'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x317e('0x5'));var logger=require(_0x317e('0x6'))('api');var schedule=require(_0x317e('0x7'));var db=require(_0x317e('0x8'))['db'];config[_0x317e('0x9')]=_[_0x317e('0xa')](config['redis'],{'host':_0x317e('0xb'),'port':0x18eb});var redis=new Redis(config[_0x317e('0x9')]);var MICROSOFT_AUTH_URL=_0x317e('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x317e('0xd'),_0x317e('0xe'),'email',_0x317e('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x317e('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x317e('0xd'),_0x317e('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x317e('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x317e('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x28b732){var _0x3ac1e3=_['map'](AZURE_AUTH_SCOPES[_0x28b732[_0x317e('0x13')]]);if(_0x28b732[_0x317e('0x13')]===_0x317e('0x14'))_0x3ac1e3[_0x317e('0x15')](_0x28b732[_0x317e('0x16')]+_0x317e('0x17'));return _0x3ac1e3[_0x317e('0x18')]('\x20');}function getAccessTokenScope(_0x4254ca){if(_0x4254ca[_0x317e('0x13')]===_0x317e('0x19'))return _0x317e('0x1a');if(_0x4254ca[_0x317e('0x13')]===_0x317e('0x14'))return _0x4254ca[_0x317e('0x16')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x2ce479,_0x45a062){var _0x29e93c=MICROSOFT_AUTH_URL[_0x317e('0x1b')](_0x317e('0x1c'),_0x2ce479['data2']);var _0x4b65b4=[_0x317e('0x1d'),_0x317e('0x1e')];var _0x5afda5=Buffer[_0x317e('0x1f')](JSON[_0x317e('0x20')]({'id':_0x45a062}))['toString'](_0x317e('0x21'));var _0x3bef4e=crypto['randomBytes'](0x10)[_0x317e('0x22')](_0x317e('0x23'));var _0x39d24a=getAuthorizationScopes(_0x2ce479);var _0x4057d8=[{'key':_0x317e('0x24'),'value':_0x2ce479['data1']},{'key':_0x317e('0x25'),'value':encodeURIComponent(_0x4b65b4[_0x317e('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x2ce479[_0x317e('0x26')]},{'key':'response_mode','value':_0x317e('0x27')},{'key':_0x317e('0x28'),'value':encodeURIComponent(_0x39d24a)},{'key':_0x317e('0x29'),'value':_0x5afda5},{'key':'nonce','value':_0x3bef4e},{'key':'prompt','value':_0x317e('0x2a')}];var _0x19fd3b=_0x29e93c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x317e('0x2b')](_0x4057d8,function(_0x74d8ba){return _0x74d8ba['key']+'='+_0x74d8ba[_0x317e('0x2c')];})['join']('&');_0x2ce479['oauth2Claims']={'issuer':_0x29e93c['replace'](_0x317e('0x2d'),''),'audience':_0x2ce479[_0x317e('0x2e')],'state':_0x5afda5,'nonce':_0x3bef4e};redis[_0x317e('0x2f')](_0x5afda5,JSON[_0x317e('0x20')](_0x2ce479));return _0x19fd3b;}function isValidIdToken(_0x2a1813,_0x324bc3){try{var _0x2ca3d9=jwt[_0x317e('0x30')](_0x2a1813,{'complete':!![]});var _0x4eed25=_0x2ca3d9[_0x317e('0x31')];if(_0x4eed25['iss']!==_0x324bc3[_0x317e('0x32')])return![];if(_0x4eed25[_0x317e('0x33')]!==_0x324bc3['audience'])return![];if(_0x4eed25[_0x317e('0x34')]!==_0x324bc3[_0x317e('0x34')])return![];if(moment()[_0x317e('0x35')](moment[_0x317e('0x36')](_0x4eed25[_0x317e('0x37')])))return![];return!![];}catch(_0x5778ec){throw _0x5778ec;}}function refreshOauth2MicrosoftAccessToken(_0x3b46ec){return Promise['resolve']()['then'](function(){if(_0x3b46ec[_0x317e('0x38')])return _0x3b46ec;return db[_0x317e('0x39')][_0x317e('0x3a')]({'where':{'id':_0x3b46ec['id']},'raw':!![]});})['then'](function(_0x3c570e){var _0x21fa10={'grant_type':_0x317e('0x3b'),'refresh_token':_0x3c570e[_0x317e('0x3c')],'scope':getAccessTokenScope(_0x3c570e),'redirect_uri':_0x3c570e[_0x317e('0x26')],'client_id':_0x3c570e[_0x317e('0x2e')],'client_secret':encryptor['decryptString'](_0x3c570e[_0x317e('0x38')])};var _0x42f316={'method':_0x317e('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x317e('0x1b')](_0x317e('0x1c'),_0x3c570e[_0x317e('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x21fa10,'json':!![]};return rp(_0x42f316);})[_0x317e('0x3f')](function(_0x3884f9){_0x3b46ec[_0x317e('0x40')]=_0x3884f9[_0x317e('0x41')];_0x3b46ec['data6']=_0x3884f9[_0x317e('0x3b')];return db[_0x317e('0x39')][_0x317e('0x42')]({'data5':_0x3b46ec[_0x317e('0x40')],'data6':_0x3b46ec['data6']},{'where':{'id':_0x3b46ec['id']}});})['then'](function(){return _0x3b46ec;})[_0x317e('0x43')](function(_0x1304bf){logger[_0x317e('0x44')](_0x317e('0x45'),_0x3b46ec['id'],_0x1304bf);});}function getOauth2MicrosoftAccessToken(_0x30804c,_0x2ef596){var _0x2842c6={'grant_type':_0x317e('0x46'),'code':_0x30804c,'scope':getAccessTokenScope(_0x2ef596),'redirect_uri':_0x2ef596['data4'],'client_id':_0x2ef596[_0x317e('0x2e')],'client_secret':encryptor[_0x317e('0x47')](_0x2ef596[_0x317e('0x38')])};var _0x23d48c={'method':_0x317e('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x317e('0x1b')](_0x317e('0x1c'),_0x2ef596['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2842c6,'json':!![]};return rp(_0x23d48c);}function startRefreshInterval(_0x32a1ae){var _0x1c5ce3=schedule[_0x317e('0x48')];if(_0x1c5ce3[_0x32a1ae['id']])clearInterval(_0x1c5ce3[_0x32a1ae['id']]);_0x1c5ce3[_0x32a1ae['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x317e('0x49')](this,{'id':_0x32a1ae['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x1c5ce3;}function startAllRefreshIntervals(){return db[_0x317e('0x39')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x2269ff){var _0x1efa63=_0x2269ff[_0x317e('0x2b')](function(_0x38e87c){return refreshOauth2MicrosoftAccessToken(_0x38e87c)[_0x317e('0x3f')](function(_0x3fdd6d){startRefreshInterval(_0x3fdd6d);});});return Promise[_0x317e('0x4a')](_0x1efa63);})['catch'](function(_0x1c48ec){var _0x295fe7=_0x1c48ec?util['inspect'](_0x1c48ec,{'showHidden':![],'depth':null}):'';logger[_0x317e('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x295fe7);});}module[_0x317e('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x2045=['../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','/authorize','map','type','Dynamics365','push','/.default','Outlook365','data7','data2','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','data4','response_mode','form_post','scope','state','nonce','prompt','join','oauth2Claims','replace','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}','data5','access_token','update','catch','error','authorization_code','bind','intervals','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor'];(function(_0x1822d5,_0x31fa36){var _0x501b16=function(_0x45498b){while(--_0x45498b){_0x1822d5['push'](_0x1822d5['shift']());}};_0x501b16(++_0x31fa36);}(_0x2045,0x188));var _0x5204=function(_0x490da9,_0x31214f){_0x490da9=_0x490da9-0x0;var _0x5b9821=_0x2045[_0x490da9];return _0x5b9821;};'use strict';var _=require(_0x5204('0x0'));var crypto=require(_0x5204('0x1'));var jwt=require(_0x5204('0x2'));var moment=require(_0x5204('0x3'));var Redis=require(_0x5204('0x4'));var rp=require(_0x5204('0x5'));var util=require(_0x5204('0x6'));var encryptor=require(_0x5204('0x7'));var config=require('../../config/environment');var logger=require(_0x5204('0x8'))(_0x5204('0x9'));var schedule=require(_0x5204('0xa'));var db=require(_0x5204('0xb'))['db'];config[_0x5204('0xc')]=_[_0x5204('0xd')](config[_0x5204('0xc')],{'host':_0x5204('0xe'),'port':0x18eb});var redis=new Redis(config[_0x5204('0xc')]);var MICROSOFT_AUTH_URL=_0x5204('0xf');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x5204('0x10'),_0x5204('0x11'),_0x5204('0x12'),_0x5204('0x13'),_0x5204('0x14'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x5204('0x15'),_0x5204('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x5204('0x16');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1b7791){var _0x193acd=_[_0x5204('0x17')](AZURE_AUTH_SCOPES[_0x1b7791[_0x5204('0x18')]]);if(_0x1b7791[_0x5204('0x18')]===_0x5204('0x19'))_0x193acd[_0x5204('0x1a')](_0x1b7791['data7']+_0x5204('0x1b'));return _0x193acd['join']('\x20');}function getAccessTokenScope(_0x39ded0){if(_0x39ded0[_0x5204('0x18')]===_0x5204('0x1c'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x39ded0['type']===_0x5204('0x19'))return _0x39ded0[_0x5204('0x1d')]+_0x5204('0x1b');}function generateMicrosoftAuthorizationUrl(_0x2b94c6,_0x39cf26){var _0x3ccb56=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x2b94c6[_0x5204('0x1e')]);var _0x55da7a=['code','id_token'];var _0x3c4909=Buffer[_0x5204('0x1f')](JSON[_0x5204('0x20')]({'id':_0x39cf26}))[_0x5204('0x21')]('base64');var _0x55e76c=crypto[_0x5204('0x22')](0x10)[_0x5204('0x21')](_0x5204('0x23'));var _0xf627ed=getAuthorizationScopes(_0x2b94c6);var _0x37bf4a=[{'key':_0x5204('0x24'),'value':_0x2b94c6[_0x5204('0x25')]},{'key':_0x5204('0x26'),'value':encodeURIComponent(_0x55da7a['join']('\x20'))},{'key':'redirect_uri','value':_0x2b94c6[_0x5204('0x27')]},{'key':_0x5204('0x28'),'value':_0x5204('0x29')},{'key':_0x5204('0x2a'),'value':encodeURIComponent(_0xf627ed)},{'key':_0x5204('0x2b'),'value':_0x3c4909},{'key':_0x5204('0x2c'),'value':_0x55e76c},{'key':_0x5204('0x2d'),'value':'login'}];var _0x449fc5=_0x3ccb56+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5204('0x17')](_0x37bf4a,function(_0x51fcf8){return _0x51fcf8['key']+'='+_0x51fcf8['value'];})[_0x5204('0x2e')]('&');_0x2b94c6[_0x5204('0x2f')]={'issuer':_0x3ccb56[_0x5204('0x30')](_0x5204('0x31'),''),'audience':_0x2b94c6[_0x5204('0x25')],'state':_0x3c4909,'nonce':_0x55e76c};redis[_0x5204('0x32')](_0x3c4909,JSON[_0x5204('0x20')](_0x2b94c6));return _0x449fc5;}function isValidIdToken(_0x2e711c,_0x6ba4b1){try{var _0x2aad45=jwt[_0x5204('0x33')](_0x2e711c,{'complete':!![]});var _0x21626e=_0x2aad45[_0x5204('0x34')];if(_0x21626e[_0x5204('0x35')]!==_0x6ba4b1[_0x5204('0x36')])return![];if(_0x21626e[_0x5204('0x37')]!==_0x6ba4b1[_0x5204('0x38')])return![];if(_0x21626e[_0x5204('0x2c')]!==_0x6ba4b1['nonce'])return![];if(moment()[_0x5204('0x39')](moment['unix'](_0x21626e['exp'])))return![];return!![];}catch(_0x4da447){throw _0x4da447;}}function refreshOauth2MicrosoftAccessToken(_0x23e22b){return Promise[_0x5204('0x3a')]()[_0x5204('0x3b')](function(){if(_0x23e22b[_0x5204('0x3c')])return _0x23e22b;return db[_0x5204('0x3d')][_0x5204('0x3e')]({'where':{'id':_0x23e22b['id']},'raw':!![]});})[_0x5204('0x3b')](function(_0x39f43d){var _0x387013={'grant_type':_0x5204('0x3f'),'refresh_token':_0x39f43d[_0x5204('0x40')],'scope':getAccessTokenScope(_0x39f43d),'redirect_uri':_0x39f43d[_0x5204('0x27')],'client_id':_0x39f43d[_0x5204('0x25')],'client_secret':encryptor[_0x5204('0x41')](_0x39f43d[_0x5204('0x3c')])};var _0x31663e={'method':_0x5204('0x42'),'uri':MICROSOFT_AUTH_URL[_0x5204('0x30')](_0x5204('0x43'),_0x39f43d[_0x5204('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x387013,'json':!![]};return rp(_0x31663e);})[_0x5204('0x3b')](function(_0xdff6d8){_0x23e22b[_0x5204('0x44')]=_0xdff6d8[_0x5204('0x45')];_0x23e22b[_0x5204('0x40')]=_0xdff6d8[_0x5204('0x3f')];return db['CloudProvider'][_0x5204('0x46')]({'data5':_0x23e22b['data5'],'data6':_0x23e22b[_0x5204('0x40')]},{'where':{'id':_0x23e22b['id']}});})[_0x5204('0x3b')](function(){return _0x23e22b;})[_0x5204('0x47')](function(_0xf8c746){logger[_0x5204('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x23e22b['id'],_0xf8c746);});}function getOauth2MicrosoftAccessToken(_0x58b64d,_0x133f9e){var _0x5c061d={'grant_type':_0x5204('0x49'),'code':_0x58b64d,'scope':getAccessTokenScope(_0x133f9e),'redirect_uri':_0x133f9e[_0x5204('0x27')],'client_id':_0x133f9e[_0x5204('0x25')],'client_secret':encryptor[_0x5204('0x41')](_0x133f9e[_0x5204('0x3c')])};var _0x4fc930={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x5204('0x30')](_0x5204('0x43'),_0x133f9e[_0x5204('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c061d,'json':!![]};return rp(_0x4fc930);}function startRefreshInterval(_0x417c97){var _0x15234b=schedule['intervals'];if(_0x15234b[_0x417c97['id']])clearInterval(_0x15234b[_0x417c97['id']]);_0x15234b[_0x417c97['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5204('0x4a')](this,{'id':_0x417c97['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x5204('0x4b')]=_0x15234b;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x5204('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5204('0x3b')](function(_0x1a7680){var _0x23f2ca=_0x1a7680[_0x5204('0x17')](function(_0x14edd8){return refreshOauth2MicrosoftAccessToken(_0x14edd8)[_0x5204('0x3b')](function(_0x234b44){startRefreshInterval(_0x234b44);});});return Promise[_0x5204('0x4d')](_0x23f2ca);})['catch'](function(_0x3fa5bc){var _0x4088fc=_0x3fa5bc?util['inspect'](_0x3fa5bc,{'showHidden':![],'depth':null}):'';logger[_0x5204('0x48')](_0x5204('0x4e'),_0x4088fc);});}module[_0x5204('0x4f')]={'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 c990929..9adad4a 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 _0x7e27=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3f176e,_0x4e7e5a){var _0x1e420c=function(_0x2f9473){while(--_0x2f9473){_0x3f176e['push'](_0x3f176e['shift']());}};_0x1e420c(++_0x4e7e5a);}(_0x7e27,0xdd));var _0x77e2=function(_0x5a1542,_0x282e20){_0x5a1542=_0x5a1542-0x0;var _0x24e6ed=_0x7e27[_0x5a1542];return _0x24e6ed;};'use strict';var _=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var moment=require('moment');var BPromise=require(_0x77e2('0x2'));var rs=require(_0x77e2('0x3'));var fs=require('fs');var Redis=require(_0x77e2('0x4'));var db=require(_0x77e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77e2('0x6'))(_0x77e2('0x7'));var config=require(_0x77e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77e2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101e56,_0x137a61,_0x502153){return new BPromise(function(_0x3c2b3f,_0x2cdfa3){return client[_0x77e2('0xa')](_0x101e56,_0x502153)[_0x77e2('0xb')](function(_0x3802ce){logger[_0x77e2('0xc')](_0x77e2('0xd'),_0x137a61,'request\x20sent');logger['debug'](_0x77e2('0xe'),_0x137a61,'request\x20sent',JSON[_0x77e2('0xf')](_0x3802ce));if(_0x3802ce[_0x77e2('0x10')]){if(_0x3802ce['error']['code']===0x1f4){logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x3802ce['error'][_0x77e2('0x11')]);return _0x2cdfa3(_0x3802ce['error']['message']);}logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x3802ce[_0x77e2('0x10')][_0x77e2('0x11')]);return _0x3c2b3f(_0x3802ce[_0x77e2('0x10')]['message']);}else{logger[_0x77e2('0xc')](_0x77e2('0xd'),_0x137a61,'request\x20sent');_0x3c2b3f(_0x3802ce[_0x77e2('0x12')][_0x77e2('0x11')]);}})[_0x77e2('0x13')](function(_0x1352c1){logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x1352c1);_0x2cdfa3(_0x1352c1);});});} \ No newline at end of file +var _0xeca8=['../../config/environment','jayson/promise','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeca8,0x1f2));var _0x8eca=function(_0x96ddce,_0x4f887d){_0x96ddce=_0x96ddce-0x0;var _0x378bdc=_0xeca8[_0x96ddce];return _0x378bdc;};'use strict';var _=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var moment=require(_0x8eca('0x2'));var BPromise=require(_0x8eca('0x3'));var rs=require(_0x8eca('0x4'));var fs=require('fs');var Redis=require(_0x8eca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eca('0x6'));var logger=require('../../config/logger')(_0x8eca('0x7'));var config=require(_0x8eca('0x8'));var jayson=require(_0x8eca('0x9'));var client=jayson['client'][_0x8eca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12c679,_0xe6e3f2,_0x39f40a){return new BPromise(function(_0xedaeca,_0x3b901f){return client['request'](_0x12c679,_0x39f40a)[_0x8eca('0xb')](function(_0x19208c){logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));logger[_0x8eca('0xf')](_0x8eca('0x10'),_0xe6e3f2,_0x8eca('0xe'),JSON[_0x8eca('0x11')](_0x19208c));if(_0x19208c[_0x8eca('0x12')]){if(_0x19208c['error'][_0x8eca('0x13')]===0x1f4){logger['error'](_0x8eca('0xd'),_0xe6e3f2,_0x19208c[_0x8eca('0x12')]['message']);return _0x3b901f(_0x19208c[_0x8eca('0x12')]['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xe6e3f2,_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);return _0xedaeca(_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);}else{logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));_0xedaeca(_0x19208c['result'][_0x8eca('0x14')]);}})[_0x8eca('0x15')](function(_0x4b8c67){logger[_0x8eca('0x12')](_0x8eca('0xd'),_0xe6e3f2,_0x4b8c67);_0x3b901f(_0x4b8c67);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4a64f15..fcc86c9 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(_0x4bec89,_0x470c67){var _0x504ae5=function(_0x5a5203){while(--_0x5a5203){_0x4bec89['push'](_0x4bec89['shift']());}};_0x504ae5(++_0x470c67);}(_0xdb28,0x106));var _0x8db2=function(_0x1b1456,_0x26137){_0x1b1456=_0x1b1456-0x0;var _0x1fb632=_0xdb28[_0x1b1456];return _0x1fb632;};'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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x4fda31,_0x127a2a){var _0x49d7ec=function(_0x2e9698){while(--_0x2e9698){_0x4fda31['push'](_0x4fda31['shift']());}};_0x49d7ec(++_0x127a2a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b5a2b8e..19de3e2 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 _0x36c3=['exports','STRING','name'];(function(_0x9b3ccd,_0xa8b134){var _0x41f9f0=function(_0x5016f7){while(--_0x5016f7){_0x9b3ccd['push'](_0x9b3ccd['shift']());}};_0x41f9f0(++_0xa8b134);}(_0x36c3,0x132));var _0x336c=function(_0x699200,_0x39c101){_0x699200=_0x699200-0x0;var _0x266fd1=_0x36c3[_0x699200];return _0x266fd1;};'use strict';var Sequelize=require('sequelize');module[_0x336c('0x0')]={'name':{'type':Sequelize[_0x336c('0x1')],'unique':_0x336c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x336c('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x336c('0x1')]},'phone':{'type':Sequelize[_0x336c('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x336c('0x1')]},'street':{'type':Sequelize[_0x336c('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x336c('0x1')]},'country':{'type':Sequelize[_0x336c('0x1')]},'email':{'type':Sequelize[_0x336c('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x336c('0x1')]},'sStreet':{'type':Sequelize[_0x336c('0x1')]},'sPostalCode':{'type':Sequelize[_0x336c('0x1')]},'sCity':{'type':Sequelize[_0x336c('0x1')]},'sCountry':{'type':Sequelize[_0x336c('0x1')]},'description':{'type':Sequelize[_0x336c('0x1')]}}; \ No newline at end of file +var _0x58bc=['name','sequelize','STRING'];(function(_0x3bfd29,_0x407cd5){var _0x2e1a78=function(_0x420461){while(--_0x420461){_0x3bfd29['push'](_0x3bfd29['shift']());}};_0x2e1a78(++_0x407cd5);}(_0x58bc,0x16f));var _0xc58b=function(_0x51d5b7,_0x4eee2b){_0x51d5b7=_0x51d5b7-0x0;var _0xe5678=_0x58bc[_0x51d5b7];return _0xe5678;};'use strict';var Sequelize=require(_0xc58b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc58b('0x1')],'unique':_0xc58b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc58b('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc58b('0x1')]},'fax':{'type':Sequelize[_0xc58b('0x1')]},'type':{'type':Sequelize[_0xc58b('0x1')]},'street':{'type':Sequelize[_0xc58b('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc58b('0x1')]},'country':{'type':Sequelize[_0xc58b('0x1')]},'email':{'type':Sequelize[_0xc58b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc58b('0x1')]},'sStreet':{'type':Sequelize[_0xc58b('0x1')]},'sPostalCode':{'type':Sequelize[_0xc58b('0x1')]},'sCity':{'type':Sequelize[_0xc58b('0x1')]},'sCountry':{'type':Sequelize[_0xc58b('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 582b328..f0690ed 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 _0xfdb4=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','apply','save','update','then','Companies','UserProfileResource','destroy','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','omit','ids','getContacts','findOne','map','rimraf','moment','path'];(function(_0x343ca9,_0x2e8008){var _0x250bcf=function(_0x53da05){while(--_0x53da05){_0x343ca9['push'](_0x343ca9['shift']());}};_0x250bcf(++_0x2e8008);}(_0xfdb4,0x1a1));var _0x4fdb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xfdb4[_0x33032e];return _0x13316b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fdb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4fdb('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4fdb('0x2'));var sox=require('sox');var csv=require(_0x4fdb('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fdb('0x4'));var _=require(_0x4fdb('0x5'));var squel=require(_0x4fdb('0x6'));var crypto=require(_0x4fdb('0x7'));var jsforce=require(_0x4fdb('0x8'));var deskjs=require(_0x4fdb('0x9'));var toCsv=require(_0x4fdb('0x3'));var querystring=require(_0x4fdb('0xa'));var Papa=require('papaparse');var Redis=require(_0x4fdb('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x4fdb('0xc'));var as=require(_0x4fdb('0xd'));var hardwareService=require(_0x4fdb('0xe'));var logger=require(_0x4fdb('0xf'))(_0x4fdb('0x10'));var utils=require(_0x4fdb('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4fdb('0x12'));var db=require(_0x4fdb('0x13'))['db'];function respondWithStatusCode(_0x5ec523,_0x2dd691){_0x2dd691=_0x2dd691||0xcc;return function(_0x246304){if(_0x246304){return _0x5ec523[_0x4fdb('0x14')](_0x2dd691);}return _0x5ec523['status'](_0x2dd691)[_0x4fdb('0x15')]();};}function respondWithResult(_0x133291,_0x3f74a6){_0x3f74a6=_0x3f74a6||0xc8;return function(_0x2bc474){if(_0x2bc474){return _0x133291[_0x4fdb('0x16')](_0x3f74a6)['json'](_0x2bc474);}};}function respondWithFilteredResult(_0x3bc222,_0x202df4){return function(_0x33d260){if(_0x33d260){var _0x169cd5=typeof _0x202df4['offset']==='undefined'&&typeof _0x202df4['limit']==='undefined';var _0x5228e3=_0x33d260['count'];var _0x441647=_0x169cd5?0x0:_0x202df4['offset'];var _0x222927=_0x169cd5?_0x33d260[_0x4fdb('0x17')]:_0x202df4[_0x4fdb('0x18')]+_0x202df4['limit'];var _0x52c2b1;if(_0x222927>=_0x5228e3){_0x222927=_0x5228e3;_0x52c2b1=0xc8;}else{_0x52c2b1=0xce;}_0x3bc222[_0x4fdb('0x16')](_0x52c2b1);return _0x3bc222['set'](_0x4fdb('0x19'),_0x441647+'-'+_0x222927+'/'+_0x5228e3)[_0x4fdb('0x1a')](_0x33d260);}return null;};}function patchUpdates(_0x3510db){return function(_0x1fda7c){try{jsonpatch[_0x4fdb('0x1b')](_0x1fda7c,_0x3510db,!![]);}catch(_0x4ce44c){return BPromise['reject'](_0x4ce44c);}return _0x1fda7c[_0x4fdb('0x1c')]();};}function saveUpdates(_0xdca75d,_0x438e77){return function(_0x45b652){if(_0x45b652){return _0x45b652[_0x4fdb('0x1d')](_0xdca75d)[_0x4fdb('0x1e')](function(_0xbfa10){return _0xbfa10;});}return null;};}function removeEntity(_0x4235b2,_0x3c01cd){return function(_0x548874){if(_0x548874){return _0x548874['destroy']()['then'](function(){var _0x3aa46f=_0x548874['get']({'plain':!![]});var _0x10a835=_0x4fdb('0x1f');return db[_0x4fdb('0x20')][_0x4fdb('0x21')]({'where':{'type':_0x10a835,'resourceId':_0x3aa46f['id']}})[_0x4fdb('0x1e')](function(){return _0x548874;});})['then'](function(){_0x4235b2[_0x4fdb('0x16')](0xcc)[_0x4fdb('0x15')]();});}};}function handleEntityNotFound(_0x930a8,_0x16a79a){return function(_0x24195d){if(!_0x24195d){_0x930a8[_0x4fdb('0x14')](0x194);}return _0x24195d;};}function handleError(_0x1bbab1,_0x571673){_0x571673=_0x571673||0x1f4;return function(_0x598690){logger[_0x4fdb('0x22')](_0x598690[_0x4fdb('0x23')]);if(_0x598690[_0x4fdb('0x24')]){delete _0x598690[_0x4fdb('0x24')];}_0x1bbab1[_0x4fdb('0x16')](_0x571673)[_0x4fdb('0x25')](_0x598690);};}exports[_0x4fdb('0x26')]=function(_0x22d970,_0x4f03d9){var _0xc43d69={},_0xbca522={},_0x2031f8={'count':0x0,'rows':[]};return db[_0x4fdb('0x27')][_0x4fdb('0x28')]()[_0x4fdb('0x1e')](function(_0x5cfdc1){_0xbca522[_0x4fdb('0x29')]=_[_0x4fdb('0x2a')](_0x5cfdc1);_0xbca522[_0x4fdb('0x2b')]=_['keys'](_0x22d970[_0x4fdb('0x2b')]);_0xbca522[_0x4fdb('0x2c')]=_[_0x4fdb('0x2d')](_0xbca522[_0x4fdb('0x29')],_0xbca522[_0x4fdb('0x2b')]);_0xc43d69[_0x4fdb('0x2e')]=_[_0x4fdb('0x2d')](_0xbca522['model'],qs[_0x4fdb('0x2f')](_0x22d970[_0x4fdb('0x2b')][_0x4fdb('0x2f')]));_0xc43d69['attributes']=_0xc43d69[_0x4fdb('0x2e')][_0x4fdb('0x30')]?_0xc43d69['attributes']:_0xbca522[_0x4fdb('0x29')];if(!_0x22d970[_0x4fdb('0x2b')][_0x4fdb('0x31')](_0x4fdb('0x32'))){_0xc43d69[_0x4fdb('0x33')]=qs[_0x4fdb('0x33')](_0x22d970[_0x4fdb('0x2b')][_0x4fdb('0x33')]);_0xc43d69[_0x4fdb('0x18')]=qs[_0x4fdb('0x18')](_0x22d970[_0x4fdb('0x2b')][_0x4fdb('0x18')]);}_0xc43d69[_0x4fdb('0x34')]=qs[_0x4fdb('0x35')](_0x22d970['query'][_0x4fdb('0x35')]);_0xc43d69[_0x4fdb('0x36')]=qs[_0x4fdb('0x2c')](_[_0x4fdb('0x37')](_0x22d970[_0x4fdb('0x2b')],_0xbca522[_0x4fdb('0x2c')]),_0x5cfdc1);if(_0x22d970['query'][_0x4fdb('0x38')]){_0xc43d69['where']=_[_0x4fdb('0x39')](_0xc43d69[_0x4fdb('0x36')],{'$or':_['map'](_0xc43d69[_0x4fdb('0x2e')],function(_0x3bb6a2){var _0x6e8e9c={};_0x6e8e9c[_0x3bb6a2]={'$like':'%'+_0x22d970[_0x4fdb('0x2b')]['filter']+'%'};return _0x6e8e9c;})});}_0xc43d69=_[_0x4fdb('0x39')]({},_0xc43d69,_0x22d970['options']);var _0x2953ee={'where':_0xc43d69[_0x4fdb('0x36')]};return db[_0x4fdb('0x27')]['count'](_0x2953ee)[_0x4fdb('0x1e')](function(_0x195dce){_0x2031f8[_0x4fdb('0x17')]=_0x195dce;if(_0x22d970[_0x4fdb('0x2b')][_0x4fdb('0x3a')]){_0xc43d69['include']=[{'all':!![]}];}return db[_0x4fdb('0x27')][_0x4fdb('0x3b')](_0xc43d69);})[_0x4fdb('0x1e')](function(_0x4ca432){_0x2031f8[_0x4fdb('0x3c')]=_0x4ca432;return _0x2031f8;})[_0x4fdb('0x1e')](respondWithFilteredResult(_0x4f03d9,_0xc43d69))[_0x4fdb('0x3d')](handleError(_0x4f03d9,null));})['catch'](handleError(_0x4f03d9,null));};exports[_0x4fdb('0x3e')]=function(_0x4de2a1,_0x3ee6b4){var _0x58b1e9={'raw':![],'where':{'id':_0x4de2a1[_0x4fdb('0x3f')]['id']}},_0x528da3={};_0x528da3[_0x4fdb('0x29')]=_[_0x4fdb('0x2a')](db['CmCompany'][_0x4fdb('0x40')]);_0x528da3['query']=_[_0x4fdb('0x2a')](_0x4de2a1[_0x4fdb('0x2b')]);_0x528da3[_0x4fdb('0x2c')]=_['intersection'](_0x528da3[_0x4fdb('0x29')],_0x528da3[_0x4fdb('0x2b')]);_0x58b1e9[_0x4fdb('0x2e')]=_[_0x4fdb('0x2d')](_0x528da3[_0x4fdb('0x29')],qs[_0x4fdb('0x2f')](_0x4de2a1[_0x4fdb('0x2b')]['fields']));_0x58b1e9[_0x4fdb('0x2e')]=_0x58b1e9[_0x4fdb('0x2e')][_0x4fdb('0x30')]?_0x58b1e9['attributes']:_0x528da3[_0x4fdb('0x29')];if(_0x4de2a1[_0x4fdb('0x2b')][_0x4fdb('0x3a')]){_0x58b1e9[_0x4fdb('0x41')]=[{'all':!![]}];}_0x58b1e9=_['merge']({},_0x58b1e9,_0x4de2a1[_0x4fdb('0x42')]);return db[_0x4fdb('0x27')][_0x4fdb('0x43')](_0x58b1e9)[_0x4fdb('0x1e')](handleEntityNotFound(_0x3ee6b4,null))['then'](respondWithResult(_0x3ee6b4,null))[_0x4fdb('0x3d')](handleError(_0x3ee6b4,null));};exports[_0x4fdb('0x44')]=function(_0xfb0d9e,_0x2e15e1){return db[_0x4fdb('0x27')][_0x4fdb('0x44')](_0xfb0d9e[_0x4fdb('0x45')],{})[_0x4fdb('0x1e')](function(_0x29c9ad){var _0x255487=_0xfb0d9e[_0x4fdb('0x46')]['get']({'plain':!![]});if(!_0x255487)throw new Error(_0x4fdb('0x47'));if(_0x255487[_0x4fdb('0x48')]===_0x4fdb('0x46')){var _0x53171b=_0x29c9ad[_0x4fdb('0x49')]({'plain':!![]});var _0x27fcd8=_0x4fdb('0x1f');return db[_0x4fdb('0x4a')][_0x4fdb('0x43')]({'where':{'name':_0x27fcd8,'userProfileId':_0x255487[_0x4fdb('0x4b')]},'raw':!![]})[_0x4fdb('0x1e')](function(_0x28c534){if(_0x28c534&&_0x28c534[_0x4fdb('0x4c')]===0x0){return db[_0x4fdb('0x20')]['create']({'name':_0x53171b[_0x4fdb('0x24')],'resourceId':_0x53171b['id'],'type':_0x28c534[_0x4fdb('0x24')],'sectionId':_0x28c534['id']},{})['then'](function(){return _0x29c9ad;});}else{return _0x29c9ad;}})[_0x4fdb('0x3d')](function(_0x4e4ac0){logger[_0x4fdb('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e4ac0);throw _0x4e4ac0;});}return _0x29c9ad;})[_0x4fdb('0x1e')](respondWithResult(_0x2e15e1,0xc9))[_0x4fdb('0x3d')](handleError(_0x2e15e1,null));};exports[_0x4fdb('0x1d')]=function(_0xe24e8d,_0x133740){if(_0xe24e8d['body']['id']){delete _0xe24e8d[_0x4fdb('0x45')]['id'];}return db['CmCompany'][_0x4fdb('0x43')]({'where':{'id':_0xe24e8d[_0x4fdb('0x3f')]['id']}})[_0x4fdb('0x1e')](handleEntityNotFound(_0x133740,null))[_0x4fdb('0x1e')](saveUpdates(_0xe24e8d[_0x4fdb('0x45')],null))['then'](respondWithResult(_0x133740,null))[_0x4fdb('0x3d')](handleError(_0x133740,null));};exports[_0x4fdb('0x21')]=function(_0x2a65cf,_0xab4606){return db[_0x4fdb('0x27')][_0x4fdb('0x43')]({'where':{'id':_0x2a65cf[_0x4fdb('0x3f')]['id']}})['then'](handleEntityNotFound(_0xab4606,null))['then'](removeEntity(_0xab4606,null))[_0x4fdb('0x3d')](handleError(_0xab4606,null));};exports[_0x4fdb('0x28')]=function(_0x525979,_0x4f56bf){return db[_0x4fdb('0x27')][_0x4fdb('0x28')]()['then'](respondWithResult(_0x4f56bf,null))[_0x4fdb('0x3d')](handleError(_0x4f56bf,null));};exports[_0x4fdb('0x4d')]=function(_0x29cfb0,_0x21b52d,_0x1408fb){return db[_0x4fdb('0x4e')][_0x4fdb('0x43')]({'where':{'id':_0x29cfb0[_0x4fdb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x21b52d,null))['then'](function(_0x4b2ddf){if(_0x4b2ddf){return _0x4b2ddf[_0x4fdb('0x4d')](_0x29cfb0[_0x4fdb('0x45')]['ids'],_[_0x4fdb('0x4f')](_0x29cfb0[_0x4fdb('0x45')],[_0x4fdb('0x50'),'id'])||{});}})['then'](respondWithResult(_0x21b52d,null))[_0x4fdb('0x3d')](handleError(_0x21b52d,null));};exports[_0x4fdb('0x51')]=function(_0x3c551c,_0x1501e2,_0xb3df8c){var _0x20a806={};var _0x29f888={};var _0x5e1bef;var _0x363ee1;return db[_0x4fdb('0x27')][_0x4fdb('0x52')]({'where':{'id':_0x3c551c['params']['id']}})[_0x4fdb('0x1e')](handleEntityNotFound(_0x1501e2,null))[_0x4fdb('0x1e')](function(_0x2c1fb5){if(_0x2c1fb5){_0x5e1bef=_0x2c1fb5;_0x29f888[_0x4fdb('0x29')]=_[_0x4fdb('0x2a')](db['CmContact'][_0x4fdb('0x40')]);_0x29f888[_0x4fdb('0x2b')]=_['keys'](_0x3c551c[_0x4fdb('0x2b')]);_0x29f888['filters']=_[_0x4fdb('0x2d')](_0x29f888['model'],_0x29f888['query']);_0x20a806[_0x4fdb('0x2e')]=_[_0x4fdb('0x2d')](_0x29f888[_0x4fdb('0x29')],qs[_0x4fdb('0x2f')](_0x3c551c[_0x4fdb('0x2b')]['fields']));_0x20a806['attributes']=_0x20a806[_0x4fdb('0x2e')][_0x4fdb('0x30')]?_0x20a806[_0x4fdb('0x2e')]:_0x29f888['model'];_0x20a806[_0x4fdb('0x34')]=qs[_0x4fdb('0x35')](_0x3c551c[_0x4fdb('0x2b')][_0x4fdb('0x35')]);_0x20a806[_0x4fdb('0x36')]=qs[_0x4fdb('0x2c')](_[_0x4fdb('0x37')](_0x3c551c[_0x4fdb('0x2b')],_0x29f888[_0x4fdb('0x2c')]));if(_0x3c551c[_0x4fdb('0x2b')][_0x4fdb('0x38')]){_0x20a806['where']=_[_0x4fdb('0x39')](_0x20a806['where'],{'$or':_[_0x4fdb('0x53')](_0x20a806[_0x4fdb('0x2e')],function(_0x4a212b){var _0x2ecdd3={};_0x2ecdd3[_0x4a212b]={'$like':'%'+_0x3c551c['query'][_0x4fdb('0x38')]+'%'};return _0x2ecdd3;})});}_0x20a806=_[_0x4fdb('0x39')]({},_0x20a806,_0x3c551c['options']);return _0x5e1bef['getContacts'](_0x20a806);}})[_0x4fdb('0x1e')](function(_0x37cbc8){if(_0x37cbc8){_0x363ee1=_0x37cbc8[_0x4fdb('0x30')];if(!_0x3c551c[_0x4fdb('0x2b')][_0x4fdb('0x31')]('nolimit')){_0x20a806[_0x4fdb('0x33')]=qs[_0x4fdb('0x33')](_0x3c551c[_0x4fdb('0x2b')]['limit']);_0x20a806[_0x4fdb('0x18')]=qs[_0x4fdb('0x18')](_0x3c551c[_0x4fdb('0x2b')][_0x4fdb('0x18')]);}return _0x5e1bef[_0x4fdb('0x51')](_0x20a806);}})['then'](function(_0x3f5465){if(_0x3f5465){return _0x3f5465?{'count':_0x363ee1,'rows':_0x3f5465}:null;}})[_0x4fdb('0x1e')](respondWithResult(_0x1501e2,null))[_0x4fdb('0x3d')](handleError(_0x1501e2,null));}; \ No newline at end of file +var _0xb9ac=['addContacts','CmContact','ids','omit','rawAttributes','order','pick','getContacts','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','map','options','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x54ccd7,_0x3bc3ce){var _0x4e667b=function(_0xab8fea){while(--_0xab8fea){_0x54ccd7['push'](_0x54ccd7['shift']());}};_0x4e667b(++_0x3bc3ce);}(_0xb9ac,0x169));var _0xcb9a=function(_0x2af4ab,_0x36e5ee){_0x2af4ab=_0x2af4ab-0x0;var _0x3f0ccc=_0xb9ac[_0x2af4ab];return _0x3f0ccc;};'use strict';var emlformat=require(_0xcb9a('0x0'));var rimraf=require(_0xcb9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb9a('0x2'));var rp=require(_0xcb9a('0x3'));var moment=require(_0xcb9a('0x4'));var BPromise=require(_0xcb9a('0x5'));var Mustache=require(_0xcb9a('0x6'));var util=require('util');var path=require(_0xcb9a('0x7'));var sox=require(_0xcb9a('0x8'));var csv=require(_0xcb9a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb9a('0xa'));var _=require('lodash');var squel=require(_0xcb9a('0xb'));var crypto=require(_0xcb9a('0xc'));var jsforce=require(_0xcb9a('0xd'));var deskjs=require(_0xcb9a('0xe'));var toCsv=require(_0xcb9a('0x9'));var querystring=require('querystring');var Papa=require(_0xcb9a('0xf'));var Redis=require('ioredis');var authService=require(_0xcb9a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb9a('0x11'));var logger=require(_0xcb9a('0x12'))(_0xcb9a('0x13'));var utils=require(_0xcb9a('0x14'));var config=require(_0xcb9a('0x15'));var licenseUtil=require(_0xcb9a('0x16'));var db=require(_0xcb9a('0x17'))['db'];function respondWithStatusCode(_0x99bd90,_0x3bef6e){_0x3bef6e=_0x3bef6e||0xcc;return function(_0x5bc8dd){if(_0x5bc8dd){return _0x99bd90[_0xcb9a('0x18')](_0x3bef6e);}return _0x99bd90[_0xcb9a('0x19')](_0x3bef6e)[_0xcb9a('0x1a')]();};}function respondWithResult(_0x3fc77d,_0x1e89b9){_0x1e89b9=_0x1e89b9||0xc8;return function(_0x4a1260){if(_0x4a1260){return _0x3fc77d['status'](_0x1e89b9)[_0xcb9a('0x1b')](_0x4a1260);}};}function respondWithFilteredResult(_0x4cc2da,_0x973f9){return function(_0x12297d){if(_0x12297d){var _0x5bd63f=typeof _0x973f9[_0xcb9a('0x1c')]==='undefined'&&typeof _0x973f9['limit']===_0xcb9a('0x1d');var _0x18d3d8=_0x12297d[_0xcb9a('0x1e')];var _0x5abd2e=_0x5bd63f?0x0:_0x973f9[_0xcb9a('0x1c')];var _0x4e80ce=_0x5bd63f?_0x12297d[_0xcb9a('0x1e')]:_0x973f9[_0xcb9a('0x1c')]+_0x973f9[_0xcb9a('0x1f')];var _0x2cc1e2;if(_0x4e80ce>=_0x18d3d8){_0x4e80ce=_0x18d3d8;_0x2cc1e2=0xc8;}else{_0x2cc1e2=0xce;}_0x4cc2da['status'](_0x2cc1e2);return _0x4cc2da[_0xcb9a('0x20')](_0xcb9a('0x21'),_0x5abd2e+'-'+_0x4e80ce+'/'+_0x18d3d8)[_0xcb9a('0x1b')](_0x12297d);}return null;};}function patchUpdates(_0xf3b93b){return function(_0x49c758){try{jsonpatch[_0xcb9a('0x22')](_0x49c758,_0xf3b93b,!![]);}catch(_0x416ea8){return BPromise[_0xcb9a('0x23')](_0x416ea8);}return _0x49c758[_0xcb9a('0x24')]();};}function saveUpdates(_0x4d2287,_0x41f48a){return function(_0x308fb6){if(_0x308fb6){return _0x308fb6[_0xcb9a('0x25')](_0x4d2287)['then'](function(_0x1cec70){return _0x1cec70;});}return null;};}function removeEntity(_0x558b7d,_0x3a347a){return function(_0x5ad7e5){if(_0x5ad7e5){return _0x5ad7e5[_0xcb9a('0x26')]()[_0xcb9a('0x27')](function(){var _0x30470d=_0x5ad7e5[_0xcb9a('0x28')]({'plain':!![]});var _0x5b965a='Companies';return db[_0xcb9a('0x29')]['destroy']({'where':{'type':_0x5b965a,'resourceId':_0x30470d['id']}})['then'](function(){return _0x5ad7e5;});})[_0xcb9a('0x27')](function(){_0x558b7d[_0xcb9a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2593e0,_0x21296e){return function(_0x15a300){if(!_0x15a300){_0x2593e0['sendStatus'](0x194);}return _0x15a300;};}function handleError(_0x4e43d4,_0x40e55e){_0x40e55e=_0x40e55e||0x1f4;return function(_0x44650a){logger[_0xcb9a('0x2a')](_0x44650a[_0xcb9a('0x2b')]);if(_0x44650a[_0xcb9a('0x2c')]){delete _0x44650a[_0xcb9a('0x2c')];}_0x4e43d4['status'](_0x40e55e)[_0xcb9a('0x2d')](_0x44650a);};}exports[_0xcb9a('0x2e')]=function(_0x428c0a,_0x1f70ce){var _0x26e0b9={},_0x3b6a0a={},_0x209846={'count':0x0,'rows':[]};return db[_0xcb9a('0x2f')][_0xcb9a('0x30')]()['then'](function(_0xc1ee6b){_0x3b6a0a[_0xcb9a('0x31')]=_[_0xcb9a('0x32')](_0xc1ee6b);_0x3b6a0a[_0xcb9a('0x33')]=_[_0xcb9a('0x32')](_0x428c0a[_0xcb9a('0x33')]);_0x3b6a0a['filters']=_[_0xcb9a('0x34')](_0x3b6a0a[_0xcb9a('0x31')],_0x3b6a0a[_0xcb9a('0x33')]);_0x26e0b9[_0xcb9a('0x35')]=_[_0xcb9a('0x34')](_0x3b6a0a[_0xcb9a('0x31')],qs['fields'](_0x428c0a[_0xcb9a('0x33')][_0xcb9a('0x36')]));_0x26e0b9[_0xcb9a('0x35')]=_0x26e0b9[_0xcb9a('0x35')][_0xcb9a('0x37')]?_0x26e0b9[_0xcb9a('0x35')]:_0x3b6a0a['model'];if(!_0x428c0a[_0xcb9a('0x33')][_0xcb9a('0x38')]('nolimit')){_0x26e0b9[_0xcb9a('0x1f')]=qs[_0xcb9a('0x1f')](_0x428c0a[_0xcb9a('0x33')][_0xcb9a('0x1f')]);_0x26e0b9[_0xcb9a('0x1c')]=qs[_0xcb9a('0x1c')](_0x428c0a[_0xcb9a('0x33')][_0xcb9a('0x1c')]);}_0x26e0b9['order']=qs[_0xcb9a('0x39')](_0x428c0a[_0xcb9a('0x33')][_0xcb9a('0x39')]);_0x26e0b9[_0xcb9a('0x3a')]=qs[_0xcb9a('0x3b')](_['pick'](_0x428c0a[_0xcb9a('0x33')],_0x3b6a0a[_0xcb9a('0x3b')]),_0xc1ee6b);if(_0x428c0a['query'][_0xcb9a('0x3c')]){_0x26e0b9['where']=_[_0xcb9a('0x3d')](_0x26e0b9[_0xcb9a('0x3a')],{'$or':_[_0xcb9a('0x3e')](_0x26e0b9[_0xcb9a('0x35')],function(_0x16178b){var _0x84c564={};_0x84c564[_0x16178b]={'$like':'%'+_0x428c0a['query'][_0xcb9a('0x3c')]+'%'};return _0x84c564;})});}_0x26e0b9=_[_0xcb9a('0x3d')]({},_0x26e0b9,_0x428c0a[_0xcb9a('0x3f')]);var _0x113844={'where':_0x26e0b9['where']};return db['CmCompany'][_0xcb9a('0x1e')](_0x113844)['then'](function(_0x5c0565){_0x209846['count']=_0x5c0565;if(_0x428c0a['query']['includeAll']){_0x26e0b9[_0xcb9a('0x40')]=[{'all':!![]}];}return db['CmCompany'][_0xcb9a('0x41')](_0x26e0b9);})[_0xcb9a('0x27')](function(_0xa1a58f){_0x209846['rows']=_0xa1a58f;return _0x209846;})[_0xcb9a('0x27')](respondWithFilteredResult(_0x1f70ce,_0x26e0b9))[_0xcb9a('0x42')](handleError(_0x1f70ce,null));})[_0xcb9a('0x42')](handleError(_0x1f70ce,null));};exports[_0xcb9a('0x43')]=function(_0x2b213c,_0x157a5a){var _0x145015={'raw':![],'where':{'id':_0x2b213c[_0xcb9a('0x44')]['id']}},_0x3feffd={};_0x3feffd[_0xcb9a('0x31')]=_[_0xcb9a('0x32')](db[_0xcb9a('0x2f')]['rawAttributes']);_0x3feffd[_0xcb9a('0x33')]=_[_0xcb9a('0x32')](_0x2b213c['query']);_0x3feffd[_0xcb9a('0x3b')]=_['intersection'](_0x3feffd[_0xcb9a('0x31')],_0x3feffd[_0xcb9a('0x33')]);_0x145015['attributes']=_[_0xcb9a('0x34')](_0x3feffd[_0xcb9a('0x31')],qs[_0xcb9a('0x36')](_0x2b213c[_0xcb9a('0x33')][_0xcb9a('0x36')]));_0x145015[_0xcb9a('0x35')]=_0x145015['attributes'][_0xcb9a('0x37')]?_0x145015[_0xcb9a('0x35')]:_0x3feffd[_0xcb9a('0x31')];if(_0x2b213c[_0xcb9a('0x33')]['includeAll']){_0x145015[_0xcb9a('0x40')]=[{'all':!![]}];}_0x145015=_[_0xcb9a('0x3d')]({},_0x145015,_0x2b213c['options']);return db[_0xcb9a('0x2f')][_0xcb9a('0x45')](_0x145015)[_0xcb9a('0x27')](handleEntityNotFound(_0x157a5a,null))[_0xcb9a('0x27')](respondWithResult(_0x157a5a,null))['catch'](handleError(_0x157a5a,null));};exports[_0xcb9a('0x46')]=function(_0x40fa93,_0x4c04c4){return db['CmCompany']['create'](_0x40fa93[_0xcb9a('0x47')],{})['then'](function(_0x468180){var _0x36fdce=_0x40fa93[_0xcb9a('0x48')][_0xcb9a('0x28')]({'plain':!![]});if(!_0x36fdce)throw new Error(_0xcb9a('0x49'));if(_0x36fdce[_0xcb9a('0x4a')]===_0xcb9a('0x48')){var _0x4e92a9=_0x468180[_0xcb9a('0x28')]({'plain':!![]});var _0x4f8fd1=_0xcb9a('0x4b');return db[_0xcb9a('0x4c')][_0xcb9a('0x45')]({'where':{'name':_0x4f8fd1,'userProfileId':_0x36fdce[_0xcb9a('0x4d')]},'raw':!![]})[_0xcb9a('0x27')](function(_0x271c75){if(_0x271c75&&_0x271c75['autoAssociation']===0x0){return db[_0xcb9a('0x29')][_0xcb9a('0x46')]({'name':_0x4e92a9[_0xcb9a('0x2c')],'resourceId':_0x4e92a9['id'],'type':_0x271c75['name'],'sectionId':_0x271c75['id']},{})['then'](function(){return _0x468180;});}else{return _0x468180;}})[_0xcb9a('0x42')](function(_0x472ad8){logger[_0xcb9a('0x2a')](_0xcb9a('0x4e'),_0x472ad8);throw _0x472ad8;});}return _0x468180;})['then'](respondWithResult(_0x4c04c4,0xc9))[_0xcb9a('0x42')](handleError(_0x4c04c4,null));};exports[_0xcb9a('0x25')]=function(_0x57d06e,_0x553f2f){if(_0x57d06e['body']['id']){delete _0x57d06e[_0xcb9a('0x47')]['id'];}return db[_0xcb9a('0x2f')][_0xcb9a('0x45')]({'where':{'id':_0x57d06e[_0xcb9a('0x44')]['id']}})['then'](handleEntityNotFound(_0x553f2f,null))[_0xcb9a('0x27')](saveUpdates(_0x57d06e[_0xcb9a('0x47')],null))[_0xcb9a('0x27')](respondWithResult(_0x553f2f,null))[_0xcb9a('0x42')](handleError(_0x553f2f,null));};exports['destroy']=function(_0x3acf2e,_0xafd3b0){return db[_0xcb9a('0x2f')][_0xcb9a('0x45')]({'where':{'id':_0x3acf2e['params']['id']}})['then'](handleEntityNotFound(_0xafd3b0,null))[_0xcb9a('0x27')](removeEntity(_0xafd3b0,null))[_0xcb9a('0x42')](handleError(_0xafd3b0,null));};exports[_0xcb9a('0x30')]=function(_0x17ba71,_0x35b0db){return db[_0xcb9a('0x2f')][_0xcb9a('0x30')]()[_0xcb9a('0x27')](respondWithResult(_0x35b0db,null))[_0xcb9a('0x42')](handleError(_0x35b0db,null));};exports[_0xcb9a('0x4f')]=function(_0x3f44a0,_0x210246,_0x4f0906){return db[_0xcb9a('0x50')][_0xcb9a('0x45')]({'where':{'id':_0x3f44a0[_0xcb9a('0x44')]['id']}})[_0xcb9a('0x27')](handleEntityNotFound(_0x210246,null))[_0xcb9a('0x27')](function(_0x1f79af){if(_0x1f79af){return _0x1f79af[_0xcb9a('0x4f')](_0x3f44a0[_0xcb9a('0x47')][_0xcb9a('0x51')],_[_0xcb9a('0x52')](_0x3f44a0[_0xcb9a('0x47')],['ids','id'])||{});}})[_0xcb9a('0x27')](respondWithResult(_0x210246,null))[_0xcb9a('0x42')](handleError(_0x210246,null));};exports['getContacts']=function(_0x1da4f0,_0x629d1f,_0x47eddc){var _0x3950f1={};var _0xac86b4={};var _0x3d1135;var _0x5ece56;return db[_0xcb9a('0x2f')]['findOne']({'where':{'id':_0x1da4f0[_0xcb9a('0x44')]['id']}})[_0xcb9a('0x27')](handleEntityNotFound(_0x629d1f,null))[_0xcb9a('0x27')](function(_0x49f6ee){if(_0x49f6ee){_0x3d1135=_0x49f6ee;_0xac86b4['model']=_[_0xcb9a('0x32')](db[_0xcb9a('0x50')][_0xcb9a('0x53')]);_0xac86b4[_0xcb9a('0x33')]=_[_0xcb9a('0x32')](_0x1da4f0[_0xcb9a('0x33')]);_0xac86b4[_0xcb9a('0x3b')]=_[_0xcb9a('0x34')](_0xac86b4[_0xcb9a('0x31')],_0xac86b4[_0xcb9a('0x33')]);_0x3950f1[_0xcb9a('0x35')]=_[_0xcb9a('0x34')](_0xac86b4[_0xcb9a('0x31')],qs[_0xcb9a('0x36')](_0x1da4f0[_0xcb9a('0x33')]['fields']));_0x3950f1[_0xcb9a('0x35')]=_0x3950f1[_0xcb9a('0x35')][_0xcb9a('0x37')]?_0x3950f1[_0xcb9a('0x35')]:_0xac86b4[_0xcb9a('0x31')];_0x3950f1[_0xcb9a('0x54')]=qs[_0xcb9a('0x39')](_0x1da4f0[_0xcb9a('0x33')][_0xcb9a('0x39')]);_0x3950f1[_0xcb9a('0x3a')]=qs[_0xcb9a('0x3b')](_[_0xcb9a('0x55')](_0x1da4f0[_0xcb9a('0x33')],_0xac86b4['filters']));if(_0x1da4f0[_0xcb9a('0x33')][_0xcb9a('0x3c')]){_0x3950f1[_0xcb9a('0x3a')]=_[_0xcb9a('0x3d')](_0x3950f1[_0xcb9a('0x3a')],{'$or':_[_0xcb9a('0x3e')](_0x3950f1[_0xcb9a('0x35')],function(_0x2de466){var _0x13c26b={};_0x13c26b[_0x2de466]={'$like':'%'+_0x1da4f0['query']['filter']+'%'};return _0x13c26b;})});}_0x3950f1=_[_0xcb9a('0x3d')]({},_0x3950f1,_0x1da4f0[_0xcb9a('0x3f')]);return _0x3d1135[_0xcb9a('0x56')](_0x3950f1);}})[_0xcb9a('0x27')](function(_0x1e2983){if(_0x1e2983){_0x5ece56=_0x1e2983[_0xcb9a('0x37')];if(!_0x1da4f0['query'][_0xcb9a('0x38')](_0xcb9a('0x57'))){_0x3950f1[_0xcb9a('0x1f')]=qs[_0xcb9a('0x1f')](_0x1da4f0['query']['limit']);_0x3950f1[_0xcb9a('0x1c')]=qs[_0xcb9a('0x1c')](_0x1da4f0['query'][_0xcb9a('0x1c')]);}return _0x3d1135[_0xcb9a('0x56')](_0x3950f1);}})[_0xcb9a('0x27')](function(_0x1fdc62){if(_0x1fdc62){return _0x1fdc62?{'count':_0x5ece56,'rows':_0x1fdc62}:null;}})[_0xcb9a('0x27')](respondWithResult(_0x629d1f,null))[_0xcb9a('0x42')](handleError(_0x629d1f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4a335de..36a14f2 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 _0x2d49=['rimraf','exports','define','CmCompany','cm_companies','lodash','api','moment','bluebird','path'];(function(_0x497a67,_0x59404c){var _0x4bad92=function(_0x126ed3){while(--_0x126ed3){_0x497a67['push'](_0x497a67['shift']());}};_0x4bad92(++_0x59404c);}(_0x2d49,0xa5));var _0x92d4=function(_0x5c0111,_0x5a4901){_0x5c0111=_0x5c0111-0x0;var _0x1401e7=_0x2d49[_0x5c0111];return _0x1401e7;};'use strict';var _=require(_0x92d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x92d4('0x1'));var moment=require(_0x92d4('0x2'));var BPromise=require(_0x92d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92d4('0x4'));var rimraf=require(_0x92d4('0x5'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x92d4('0x6')]=function(_0x7c52d7,_0x248f1d){return _0x7c52d7[_0x92d4('0x7')](_0x92d4('0x8'),attributes,{'tableName':_0x92d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf6f=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdf6f,0x71));var _0xfdf6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdf6f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfdf6('0x0'));var util=require(_0xfdf6('0x1'));var logger=require(_0xfdf6('0x2'))(_0xfdf6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfdf6('0x4'));var fs=require('fs');var path=require(_0xfdf6('0x5'));var rimraf=require(_0xfdf6('0x6'));var config=require(_0xfdf6('0x7'));var attributes=require(_0xfdf6('0x8'));module[_0xfdf6('0x9')]=function(_0x1dc61e,_0x2139c5){return _0x1dc61e[_0xfdf6('0xa')](_0xfdf6('0xb'),attributes,{'tableName':_0xfdf6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 7d8f642..881148b 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 _0x27b2=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3569c9,_0x56078c){var _0x208d86=function(_0x5ea0e3){while(--_0x5ea0e3){_0x3569c9['push'](_0x3569c9['shift']());}};_0x208d86(++_0x56078c);}(_0x27b2,0x109));var _0x227b=function(_0x16de65,_0x5d05e9){_0x16de65=_0x16de65-0x0;var _0x5d15fc=_0x27b2[_0x16de65];return _0x5d15fc;};'use strict';var _=require(_0x227b('0x0'));var util=require(_0x227b('0x1'));var moment=require(_0x227b('0x2'));var BPromise=require(_0x227b('0x3'));var rs=require(_0x227b('0x4'));var fs=require('fs');var Redis=require(_0x227b('0x5'));var db=require(_0x227b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x227b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x227b('0x8')][_0x227b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18faba,_0x339da6,_0x5ecb93){return new BPromise(function(_0x48907c,_0x2b1776){return client[_0x227b('0xa')](_0x18faba,_0x5ecb93)['then'](function(_0x556cc9){logger[_0x227b('0xb')](_0x227b('0xc'),_0x339da6,_0x227b('0xd'));logger[_0x227b('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x339da6,_0x227b('0xd'),JSON[_0x227b('0xf')](_0x556cc9));if(_0x556cc9[_0x227b('0x10')]){if(_0x556cc9[_0x227b('0x10')][_0x227b('0x11')]===0x1f4){logger['error'](_0x227b('0xc'),_0x339da6,_0x556cc9[_0x227b('0x10')]['message']);return _0x2b1776(_0x556cc9['error'][_0x227b('0x12')]);}logger[_0x227b('0x10')]('CmCompany,\x20%s,\x20%s',_0x339da6,_0x556cc9[_0x227b('0x10')]['message']);return _0x48907c(_0x556cc9[_0x227b('0x10')]['message']);}else{logger[_0x227b('0xb')](_0x227b('0xc'),_0x339da6,_0x227b('0xd'));_0x48907c(_0x556cc9[_0x227b('0x13')][_0x227b('0x12')]);}})['catch'](function(_0x180829){logger[_0x227b('0x10')](_0x227b('0xc'),_0x339da6,_0x180829);_0x2b1776(_0x180829);});});} \ No newline at end of file +var _0x6d1f=['then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6d1f,0x192));var _0xf6d1=function(_0x325fff,_0x19c1be){_0x325fff=_0x325fff-0x0;var _0x438b02=_0x6d1f[_0x325fff];return _0x438b02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf6d1('0x0'));var BPromise=require(_0xf6d1('0x1'));var rs=require(_0xf6d1('0x2'));var fs=require('fs');var Redis=require(_0xf6d1('0x3'));var db=require(_0xf6d1('0x4'))['db'];var utils=require(_0xf6d1('0x5'));var logger=require(_0xf6d1('0x6'))(_0xf6d1('0x7'));var config=require(_0xf6d1('0x8'));var jayson=require(_0xf6d1('0x9'));var client=jayson[_0xf6d1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1eca,_0x5314ff,_0x1bddd9){return new BPromise(function(_0x2516d9,_0x3e2546){return client[_0xf6d1('0xb')](_0x5d1eca,_0x1bddd9)[_0xf6d1('0xc')](function(_0x50a7af){logger[_0xf6d1('0xd')](_0xf6d1('0xe'),_0x5314ff,_0xf6d1('0xf'));logger[_0xf6d1('0x10')](_0xf6d1('0x11'),_0x5314ff,_0xf6d1('0xf'),JSON[_0xf6d1('0x12')](_0x50a7af));if(_0x50a7af['error']){if(_0x50a7af[_0xf6d1('0x13')]['code']===0x1f4){logger['error'](_0xf6d1('0xe'),_0x5314ff,_0x50a7af[_0xf6d1('0x13')][_0xf6d1('0x14')]);return _0x3e2546(_0x50a7af[_0xf6d1('0x13')][_0xf6d1('0x14')]);}logger[_0xf6d1('0x13')](_0xf6d1('0xe'),_0x5314ff,_0x50a7af[_0xf6d1('0x13')][_0xf6d1('0x14')]);return _0x2516d9(_0x50a7af[_0xf6d1('0x13')][_0xf6d1('0x14')]);}else{logger[_0xf6d1('0xd')](_0xf6d1('0xe'),_0x5314ff,_0xf6d1('0xf'));_0x2516d9(_0x50a7af[_0xf6d1('0x15')][_0xf6d1('0x14')]);}})[_0xf6d1('0x16')](function(_0x1a7060){logger[_0xf6d1('0x13')](_0xf6d1('0xe'),_0x5314ff,_0x1a7060);_0x3e2546(_0x1a7060);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1d44d73..0853155 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 _0x256e=['getContacts','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts'];(function(_0x229791,_0x12b311){var _0x218bf2=function(_0x43aeed){while(--_0x43aeed){_0x229791['push'](_0x229791['shift']());}};_0x218bf2(++_0x12b311);}(_0x256e,0x105));var _0xe256=function(_0x1c8f60,_0x1d96d6){_0x1c8f60=_0x1c8f60-0x0;var _0x1279c4=_0x256e[_0x1c8f60];return _0x1279c4;};'use strict';var multer=require(_0xe256('0x0'));var util=require(_0xe256('0x1'));var path=require(_0xe256('0x2'));var timeout=require(_0xe256('0x3'));var express=require('express');var router=express[_0xe256('0x4')]();var fs_extra=require(_0xe256('0x5'));var auth=require(_0xe256('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe256('0x7'));router[_0xe256('0x8')]('/',auth[_0xe256('0x9')](),controller[_0xe256('0xa')]);router[_0xe256('0x8')](_0xe256('0xb'),auth[_0xe256('0x9')](),controller[_0xe256('0xc')]);router[_0xe256('0x8')]('/:id',auth[_0xe256('0x9')](),controller[_0xe256('0xd')]);router[_0xe256('0x8')](_0xe256('0xe'),auth[_0xe256('0x9')](),controller[_0xe256('0xf')]);router[_0xe256('0x10')]('/',auth[_0xe256('0x9')](),controller[_0xe256('0x11')]);router[_0xe256('0x10')](_0xe256('0xe'),auth[_0xe256('0x9')](),controller['addContacts']);router[_0xe256('0x12')]('/:id',auth[_0xe256('0x9')](),controller[_0xe256('0x13')]);router['delete'](_0xe256('0x14'),auth[_0xe256('0x9')](),controller[_0xe256('0x15')]);module[_0xe256('0x16')]=router; \ No newline at end of file +var _0x4bcd=['/:id','/:id/contacts','getContacts','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe'];(function(_0x1007b6,_0x4b4607){var _0x37b6ed=function(_0x587f9f){while(--_0x587f9f){_0x1007b6['push'](_0x1007b6['shift']());}};_0x37b6ed(++_0x4b4607);}(_0x4bcd,0x81));var _0xd4bc=function(_0x14f964,_0x193617){_0x14f964=_0x14f964-0x0;var _0x3f53b1=_0x4bcd[_0x14f964];return _0x3f53b1;};'use strict';var multer=require(_0xd4bc('0x0'));var util=require(_0xd4bc('0x1'));var path=require(_0xd4bc('0x2'));var timeout=require(_0xd4bc('0x3'));var express=require(_0xd4bc('0x4'));var router=express[_0xd4bc('0x5')]();var fs_extra=require(_0xd4bc('0x6'));var auth=require(_0xd4bc('0x7'));var interaction=require(_0xd4bc('0x8'));var config=require(_0xd4bc('0x9'));var controller=require(_0xd4bc('0xa'));router['get']('/',auth[_0xd4bc('0xb')](),controller[_0xd4bc('0xc')]);router[_0xd4bc('0xd')](_0xd4bc('0xe'),auth[_0xd4bc('0xb')](),controller['describe']);router['get'](_0xd4bc('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xd4bc('0xd')](_0xd4bc('0x10'),auth[_0xd4bc('0xb')](),controller[_0xd4bc('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4bc('0x12')]);router['post'](_0xd4bc('0x10'),auth['isAuthenticated'](),controller['addContacts']);router[_0xd4bc('0x13')]('/:id',auth[_0xd4bc('0xb')](),controller[_0xd4bc('0x14')]);router[_0xd4bc('0x15')](_0xd4bc('0xf'),auth['isAuthenticated'](),controller[_0xd4bc('0x16')]);module[_0xd4bc('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c2f3d54..fefcf24 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 _0x190a=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x190a,0x83));var _0xa190=function(_0x569e9a,_0x5b612c){_0x569e9a=_0x569e9a-0x0;var _0x4855c3=_0x190a[_0x569e9a];return _0x4855c3;};'use strict';var _=require(_0xa190('0x0'));var Sequelize=require(_0xa190('0x1'));module[_0xa190('0x2')]={'firstName':{'type':Sequelize[_0xa190('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa190('0x3')]},'street':{'type':Sequelize[_0xa190('0x3')]},'postalCode':{'type':Sequelize[_0xa190('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xa190('0x3')]},'description':{'type':Sequelize[_0xa190('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa190('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xa190('0x3')]},'facebook':{'type':Sequelize[_0xa190('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xa190('0x3')]},'viber':{'type':Sequelize[_0xa190('0x3')]},'line':{'type':Sequelize[_0xa190('0x3')]},'wechat':{'type':Sequelize[_0xa190('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xa190('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xa190('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa190('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa190('0x7')],'defaultValue':Sequelize[_0xa190('0x8')]},'dialTimezone':{'type':Sequelize[_0xa190('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x92aa=['DATE','NOW','INTEGER','lodash','sequelize','STRING','UNSIGNED'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x92aa,0xb2));var _0xa92a=function(_0x4cde7c,_0x25b2ca){_0x4cde7c=_0x4cde7c-0x0;var _0x929642=_0x92aa[_0x4cde7c];return _0x929642;};'use strict';var _=require(_0xa92a('0x0'));var Sequelize=require(_0xa92a('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xa92a('0x2')]},'street':{'type':Sequelize[_0xa92a('0x2')]},'postalCode':{'type':Sequelize[_0xa92a('0x2')]},'city':{'type':Sequelize[_0xa92a('0x2')]},'country':{'type':Sequelize[_0xa92a('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xa92a('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa92a('0x2')]},'email':{'type':Sequelize[_0xa92a('0x2')]},'url':{'type':Sequelize[_0xa92a('0x2')]},'facebook':{'type':Sequelize[_0xa92a('0x2')]},'fb_data':{'type':Sequelize[_0xa92a('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xa92a('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xa92a('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xa92a('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa92a('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa92a('0x4')],'defaultValue':Sequelize[_0xa92a('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xa92a('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0f6ec50..b6e0c57 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 _0xf9e7=['nolimit','limit','setTags','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','CmContactHasItem','contact\x20phone\x20exists','PHONE','item','ItemType.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','rows','getHopperHistories','getHopperFinals','pick','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','upload','createReadStream','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','pid','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','whatsapp','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','starttime','endtime','userDisposition','fullname','createdAt','DESC','Website','Account','closed','closedAt','disposition','thirdDisposition','UserId','key','customerIp','customerPort','deviceModel','osName','ratingMessage','referer','externalUrl','startCase','Interaction','findAndCountAll','Owner','flatten','sortBy','value','slice','bluebird','util','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','Content-Range','then','destroy','end','error','stack','name','send','describe','findAll','query','user','catch','CmContact','find','params','tags','length','keys','startsWith','cf_','columnName','analytics','CmCustomField','displayName','alias','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','info','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','all','Tags','color','tag','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','toParam','phone','getTags','findOne','Tag','rawAttributes','filters','intersection','model','attributes','fields','order','sort','filter','merge','options'];(function(_0x87f881,_0x57c4e6){var _0x57db3a=function(_0x20503a){while(--_0x20503a){_0x87f881['push'](_0x87f881['shift']());}};_0x57db3a(++_0x57c4e6);}(_0xf9e7,0x73));var _0x7f9e=function(_0xdeea17,_0x2d08b7){_0xdeea17=_0xdeea17-0x0;var _0x467a89=_0xf9e7[_0xdeea17];return _0x467a89;};'use strict';var moment=require('moment');var BPromise=require(_0x7f9e('0x0'));var util=require(_0x7f9e('0x1'));var path=require(_0x7f9e('0x2'));var fs=require('fs');var _=require(_0x7f9e('0x3'));var squel=require('squel');var Papa=require(_0x7f9e('0x4'));var Redis=require(_0x7f9e('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x7f9e('0x6'));var logger=require(_0x7f9e('0x7'))(_0x7f9e('0x8'));var config=require(_0x7f9e('0x9'));var shared=require(_0x7f9e('0xa'));var db=require(_0x7f9e('0xb'))['db'];config['redis']=_[_0x7f9e('0xc')](config[_0x7f9e('0xd')],{'host':_0x7f9e('0xe'),'port':0x18eb});var socket=require(_0x7f9e('0xf'))(new Redis(config['redis']));require(_0x7f9e('0x10'))[_0x7f9e('0x11')](socket);function respondWithResult(_0x1fee2d,_0xc79cf3){_0xc79cf3=_0xc79cf3||0xc8;return function(_0x23e2c6){if(_0x23e2c6){return _0x1fee2d[_0x7f9e('0x12')](_0xc79cf3)[_0x7f9e('0x13')](_0x23e2c6);}};}function respondWithFilteredResult(_0x5bdd81,_0x1445cb){return function(_0x1d495e){if(_0x1d495e){var _0x38b478=typeof _0x1445cb[_0x7f9e('0x14')]===_0x7f9e('0x15')&&typeof _0x1445cb['limit']===_0x7f9e('0x15');var _0x27f4e7=_0x1d495e[_0x7f9e('0x16')];var _0xbe476b=_0x38b478?0x0:_0x1445cb[_0x7f9e('0x14')];var _0x362d0b=_0x38b478?_0x1d495e[_0x7f9e('0x16')]:_0x1445cb[_0x7f9e('0x14')]+_0x1445cb['limit'];var _0x3da01f;if(_0x362d0b>=_0x27f4e7){_0x362d0b=_0x27f4e7;_0x3da01f=0xc8;}else{_0x3da01f=0xce;}_0x5bdd81['status'](_0x3da01f);return _0x5bdd81['set'](_0x7f9e('0x17'),_0xbe476b+'-'+_0x362d0b+'/'+_0x27f4e7)[_0x7f9e('0x13')](_0x1d495e);}return null;};}function saveUpdates(_0x37c1b5){return function(_0x420fd4){if(_0x420fd4){return _0x420fd4['update'](_0x37c1b5)[_0x7f9e('0x18')](function(_0x370ba4){return _0x370ba4;});}return null;};}function removeEntity(_0x22d200){return function(_0x2a65ec){if(_0x2a65ec){return _0x2a65ec[_0x7f9e('0x19')]()['then'](function(){_0x22d200[_0x7f9e('0x12')](0xcc)[_0x7f9e('0x1a')]();});}};}function handleEntityNotFound(_0xf28332){return function(_0x35e42b){if(!_0x35e42b){_0xf28332['sendStatus'](0x194);}return _0x35e42b;};}function handleError(_0x1d300a,_0x410ae3){_0x410ae3=_0x410ae3||0x1f4;return function(_0x341bfa){logger[_0x7f9e('0x1b')](_0x341bfa[_0x7f9e('0x1c')]);if(_0x341bfa[_0x7f9e('0x1d')]){delete _0x341bfa[_0x7f9e('0x1d')];}_0x1d300a[_0x7f9e('0x12')](_0x410ae3)[_0x7f9e('0x1e')](_0x341bfa);};}exports['index']=function(_0x1a8641,_0x3591a9){var _0x4310c4={};return contacts[_0x7f9e('0x1f')]()[_0x7f9e('0x18')](function(_0x27d6c7){_0x4310c4=qs['getOptions'](_0x27d6c7,_0x1a8641);return contacts[_0x7f9e('0x20')](_0x1a8641[_0x7f9e('0x21')],_0x1a8641[_0x7f9e('0x22')],_0x4310c4,_0x27d6c7);})[_0x7f9e('0x18')](respondWithFilteredResult(_0x3591a9,_0x4310c4))[_0x7f9e('0x23')](handleError(_0x3591a9,null));};exports[_0x7f9e('0x19')]=function(_0x5e9e96,_0x24c160){return db[_0x7f9e('0x24')][_0x7f9e('0x25')]({'where':{'id':_0x5e9e96[_0x7f9e('0x26')]['id']}})['then'](handleEntityNotFound(_0x24c160,null))['then'](removeEntity(_0x24c160,null))[_0x7f9e('0x23')](handleError(_0x24c160,null));};exports[_0x7f9e('0x1f')]=function(_0x2b610a,_0x9bccb1){return db[_0x7f9e('0x24')][_0x7f9e('0x1f')]()['then'](function(_0x19347c){delete _0x19347c[_0x7f9e('0x27')];for(var _0x4d3cb8=0x0;_0x4d3cb80x0){return new Promise(function(_0x128fa3){var _0x341f8e=[];for(var _0x3ad9bc=0x0;_0x3ad9bc<_0x5b0753[_0x7f9e('0x28')];_0x3ad9bc++){_0x341f8e[_0x7f9e('0x61')](insertAdditionalPhones(_0x5b0753[_0x3ad9bc][_0x7f9e('0x62')],_0x5b0753[_0x3ad9bc]['additionalPhones']));}Promise[_0x7f9e('0x63')](_0x341f8e)[_0x7f9e('0x18')](function(){_0x128fa3(0x1);});})['then'](function(){return{'success':_0x1c8439,'failure':_0x940dda,'duplicates':_0x3dd152};});}else{return{'success':_0x1c8439,'failure':_0x940dda,'duplicates':_0x3dd152};}}})[_0x7f9e('0x18')](respondWithResult(_0x382902,0xc9))[_0x7f9e('0x23')](handleError(_0x382902,null));};exports['show']=function(_0x238d5d,_0x3c5e46){var _0x82fe2d;return db['CmContact'][_0x7f9e('0x1f')]()['then'](function(_0x4ec155){return db[_0x7f9e('0x24')]['find']({'where':{'id':_0x238d5d[_0x7f9e('0x26')]['id']},'include':[{'model':db['Tag'],'as':_0x7f9e('0x64'),'attributes':['id','name',_0x7f9e('0x65')],'required':_0x238d5d['query'][_0x7f9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x7f9e('0x67'),'where':{'CmContactId':_0x238d5d[_0x7f9e('0x26')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x7f9e('0x68')}]}],'order':[db[_0x7f9e('0x69')][_0x7f9e('0x6a')](_0x7f9e('0x6b'))],'attributes':_['keys'](_0x4ec155)});})[_0x7f9e('0x18')](function(_0x200e7a){if(!_[_0x7f9e('0x55')](_0x200e7a)){_0x82fe2d=_0x200e7a[_0x7f9e('0x39')]({'plain':!![]});var _0x2a8159={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x200e7a&&_0x200e7a[_0x7f9e('0x5e')]){if(_0x200e7a[_0x7f9e('0x5e')]){_0x2a8159[_0x7f9e('0x5c')][_0x7f9e('0x6c')][_0x7f9e('0x61')]({'ListId':{'$ne':_0x200e7a[_0x7f9e('0x5e')]}});}}return db[_0x7f9e('0x2e')][_0x7f9e('0x20')](_0x2a8159);}})[_0x7f9e('0x18')](function(_0x330de6){if(!_[_0x7f9e('0x55')](_0x330de6)){return _[_0x7f9e('0x6d')](_0x82fe2d,_[_0x7f9e('0x6e')](_0x330de6,function(_0x1c16ae){return util[_0x7f9e('0x6f')](_0x7f9e('0x70'),_0x1c16ae['id']);}));}})['then'](handleEntityNotFound(_0x3c5e46,null))[_0x7f9e('0x18')](respondWithResult(_0x3c5e46,null))['catch'](handleError(_0x3c5e46,null));};exports[_0x7f9e('0x41')]=function(_0x1a0efe,_0x1dde75){var _0x545610;if(_0x1a0efe[_0x7f9e('0x37')]['id']){delete _0x1a0efe[_0x7f9e('0x37')]['id'];}if(!_['isNil'](_0x1a0efe[_0x7f9e('0x37')][_0x7f9e('0x56')])){var _0x16ceb3=_0x1a0efe['body']['dialTimezone'];if(!_[_0x7f9e('0x55')](shared[_0x7f9e('0x57')][_0x16ceb3]))_0x1a0efe[_0x7f9e('0x37')][_0x7f9e('0x58')]=shared['timezones'][_0x16ceb3][_0x7f9e('0x58')];}return db[_0x7f9e('0x24')][_0x7f9e('0x25')]({'where':{'id':_0x1a0efe[_0x7f9e('0x26')]['id']}})[_0x7f9e('0x18')](handleEntityNotFound(_0x1dde75,null))[_0x7f9e('0x18')](saveUpdates(_0x1a0efe[_0x7f9e('0x37')],null))['then'](function(_0xba55ef){_0x545610=_0xba55ef;var _0x55b3a1={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xba55ef&&_0xba55ef[_0x7f9e('0x5e')]){if(_0xba55ef[_0x7f9e('0x5e')]){_0x55b3a1[_0x7f9e('0x5c')][_0x7f9e('0x6c')][_0x7f9e('0x61')]({'ListId':{'$ne':_0xba55ef[_0x7f9e('0x5e')]}});}}return db[_0x7f9e('0x2e')]['findAll'](_0x55b3a1);})['then'](function(_0x570ec6){if(_0x570ec6){return _[_0x7f9e('0x6d')](_[_0x7f9e('0x71')](_0x1a0efe[_0x7f9e('0x37')],function(_0x2506d3,_0x1ced15){return _['startsWith'](_0x1ced15,_0x7f9e('0x2b'));}),_[_0x7f9e('0x6e')](_0x570ec6,function(_0x27b145){return util[_0x7f9e('0x6f')](_0x7f9e('0x70'),_0x27b145['id']);}));}})[_0x7f9e('0x18')](function(_0x4a5f1d){if(_0x4a5f1d&&!_[_0x7f9e('0x72')](_0x4a5f1d)){var _0x2488bb=squel[_0x7f9e('0x41')]()[_0x7f9e('0x73')](_0x7f9e('0x74'))[_0x7f9e('0x75')](_0x4a5f1d)[_0x7f9e('0x5c')]('id\x20=\x20?',_0x1a0efe[_0x7f9e('0x26')]['id'])[_0x7f9e('0x76')]();return db['sequelize'][_0x7f9e('0x21')](_0x2488bb['text'],{'replacements':_0x2488bb[_0x7f9e('0x33')]});}})['then'](function(){if(_0x1a0efe['body'][_0x7f9e('0x77')]&&_0x545610){return db[_0x7f9e('0x3d')][_0x7f9e('0x41')]({'phone':_0x1a0efe[_0x7f9e('0x37')][_0x7f9e('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x545610['id']}});}})[_0x7f9e('0x18')](function(){return _0x545610;})['then'](respondWithResult(_0x1dde75,null))[_0x7f9e('0x23')](handleError(_0x1dde75,null));};exports[_0x7f9e('0x78')]=function(_0x584bff,_0xfbd3e6){var _0x19c4e2={};var _0x1ba4e5={};var _0x5e56cc;var _0x202950;return db['CmContact'][_0x7f9e('0x79')]({'where':{'id':_0x584bff[_0x7f9e('0x26')]['id']}})['then'](handleEntityNotFound(_0xfbd3e6,null))[_0x7f9e('0x18')](function(_0x1a08db){if(_0x1a08db){_0x5e56cc=_0x1a08db;_0x1ba4e5['model']=_[_0x7f9e('0x29')](db[_0x7f9e('0x7a')][_0x7f9e('0x7b')]);_0x1ba4e5[_0x7f9e('0x21')]=_['keys'](_0x584bff[_0x7f9e('0x21')]);_0x1ba4e5[_0x7f9e('0x7c')]=_[_0x7f9e('0x7d')](_0x1ba4e5[_0x7f9e('0x7e')],_0x1ba4e5[_0x7f9e('0x21')]);_0x19c4e2[_0x7f9e('0x7f')]=_[_0x7f9e('0x7d')](_0x1ba4e5['model'],qs[_0x7f9e('0x80')](_0x584bff[_0x7f9e('0x21')]['fields']));_0x19c4e2[_0x7f9e('0x7f')]=_0x19c4e2[_0x7f9e('0x7f')][_0x7f9e('0x28')]?_0x19c4e2['attributes']:_0x1ba4e5[_0x7f9e('0x7e')];_0x19c4e2[_0x7f9e('0x81')]=qs['sort'](_0x584bff[_0x7f9e('0x21')][_0x7f9e('0x82')]);_0x19c4e2[_0x7f9e('0x5c')]=qs['filters'](_['pick'](_0x584bff[_0x7f9e('0x21')],_0x1ba4e5[_0x7f9e('0x7c')]));if(_0x584bff[_0x7f9e('0x21')][_0x7f9e('0x83')]){_0x19c4e2[_0x7f9e('0x5c')]=_[_0x7f9e('0x84')](_0x19c4e2[_0x7f9e('0x5c')],{'$or':_[_0x7f9e('0x6e')](_0x19c4e2[_0x7f9e('0x7f')],function(_0x3c2722){var _0x461679={};_0x461679[_0x3c2722]={'$like':'%'+_0x584bff[_0x7f9e('0x21')][_0x7f9e('0x83')]+'%'};return _0x461679;})});}_0x19c4e2=_['merge']({},_0x19c4e2,_0x584bff[_0x7f9e('0x85')]);return _0x5e56cc[_0x7f9e('0x78')](_0x19c4e2);}})[_0x7f9e('0x18')](function(_0x273b63){if(_0x273b63){_0x202950=_0x273b63[_0x7f9e('0x28')];if(!_0x584bff['query'][_0x7f9e('0x36')](_0x7f9e('0x86'))){_0x19c4e2[_0x7f9e('0x87')]=qs[_0x7f9e('0x87')](_0x584bff[_0x7f9e('0x21')][_0x7f9e('0x87')]);_0x19c4e2[_0x7f9e('0x14')]=qs['offset'](_0x584bff[_0x7f9e('0x21')][_0x7f9e('0x14')]);}return _0x5e56cc[_0x7f9e('0x78')](_0x19c4e2);}})['then'](function(_0x194c90){if(_0x194c90){return _0x194c90?{'count':_0x202950,'rows':_0x194c90}:null;}})['then'](respondWithResult(_0xfbd3e6,null))['catch'](handleError(_0xfbd3e6,null));};exports[_0x7f9e('0x88')]=function(_0x27d989,_0xa9a536){if(_0x27d989['body']['id']){delete _0x27d989[_0x7f9e('0x37')]['id'];}return db[_0x7f9e('0x24')][_0x7f9e('0x79')]({'where':{'id':_0x27d989[_0x7f9e('0x26')]['id']}})[_0x7f9e('0x18')](handleEntityNotFound(_0xa9a536,null))['then'](function(_0x335327){if(_0x335327){return _0x335327['setTags'](_0x27d989[_0x7f9e('0x37')]['ids']||[]);}return null;})[_0x7f9e('0x18')](respondWithResult(_0xa9a536,null))[_0x7f9e('0x23')](handleError(_0xa9a536,null));};exports['setAdditionalPhones']=function(_0x5362b1,_0x378644){var _0x1c37c3=[];_0x1c37c3['push'](addAdditionalPhones(_0x5362b1[_0x7f9e('0x37')]));Promise[_0x7f9e('0x63')](_0x1c37c3)[_0x7f9e('0x18')](function(){_0x1c37c3=[];_0x1c37c3[_0x7f9e('0x61')](deleteCmHopperPhones(_0x5362b1[_0x7f9e('0x37')]['id']));_0x1c37c3[_0x7f9e('0x61')](addCmHopperPhones(_0x5362b1[_0x7f9e('0x37')]['id']));Promise[_0x7f9e('0x63')](_0x1c37c3)[_0x7f9e('0x18')](function(){return[0x1];})[_0x7f9e('0x18')](respondWithResult(_0x378644,null));});};function addAdditionalPhones(_0x37987b){var _0x2767e9;return new Promise(function(_0x16349b){return db['CmContactHasItem'][_0x7f9e('0x19')]({'where':{'CmContactId':_0x37987b['id']}})['then'](function(){db[_0x7f9e('0x89')][_0x7f9e('0x20')]({'raw':!![],'attributes':['id',_0x7f9e('0x8a')]})[_0x7f9e('0x18')](function(_0x1743db){var _0x492a19=[];for(var _0xb1c874=0x0;_0xb1c874<_0x37987b[_0x7f9e('0x8b')][_0x7f9e('0x28')];_0xb1c874++){var _0x5e6ffb=_0x37987b[_0x7f9e('0x8c')]?_['isNil'](_0x37987b[_0x7f9e('0x8c')][_0xb1c874])?'':_0x37987b['item_types'][_0xb1c874]:_0x37987b[_0x7f9e('0x8b')][_0xb1c874][_0x7f9e('0x8d')]?_0x37987b['items'][_0xb1c874]['ItemTypeId']:'';var _0x3f44db=_['isNil'](_0x37987b[_0x7f9e('0x8b')][_0xb1c874][_0x7f9e('0x8e')])?'':_0x37987b[_0x7f9e('0x8b')][_0xb1c874]['description'];var _0x2a5d29=_0x5e6ffb+':'+_0x37987b[_0x7f9e('0x8b')][_0xb1c874][_0x7f9e('0x77')]+'§'+_0x3f44db;if(_[_0x7f9e('0x55')](_0x2767e9))_0x2767e9=_0x2a5d29;else _0x2767e9+=';'+_0x2a5d29;var _0x41ecb4=null;var _0x556216=null;if(_0x37987b['item_types']){if(!_[_0x7f9e('0x55')](_0x37987b[_0x7f9e('0x8c')][_0xb1c874])){_0x556216=_[_0x7f9e('0x25')](_0x1743db,function(_0x473a33){return _0x473a33['id']===_0x37987b[_0x7f9e('0x8c')][_0xb1c874];});if(!_[_0x7f9e('0x55')](_0x556216)){_0x41ecb4=_0x556216[_0x7f9e('0x8a')];}}}else{if(!_[_0x7f9e('0x55')](_0x37987b[_0x7f9e('0x8b')][_0xb1c874])){_0x556216=_['find'](_0x1743db,function(_0xe8607d){return _0xe8607d['id']===_0x37987b[_0x7f9e('0x8b')][_0xb1c874][_0x7f9e('0x8d')];});if(!_[_0x7f9e('0x55')](_0x556216)){_0x41ecb4=_0xb1c874;}}}if(_['isNil'](_0x41ecb4)){_0x41ecb4=0x64;}_0x492a19[_0x7f9e('0x61')](addAdditionalPhone(_0x37987b['id'],_0x37987b[_0x7f9e('0x8b')][_0xb1c874]['phone'],_0x37987b[_0x7f9e('0x8c')]?_['isNil'](_0x37987b[_0x7f9e('0x8c')][_0xb1c874])?null:_0x37987b['item_types'][_0xb1c874]:_0x37987b['items'][_0xb1c874][_0x7f9e('0x8d')]?_0x37987b['items'][_0xb1c874][_0x7f9e('0x8d')]:null,_0x41ecb4,_0x3f44db));}Promise['all'](_0x492a19)[_0x7f9e('0x18')](function(){db[_0x7f9e('0x24')][_0x7f9e('0x41')]({'AdditionalPhones':_0x2767e9},{'where':{'id':_0x37987b['id']}})[_0x7f9e('0x18')](function(){_0x16349b(0x1);});});});});});}function addAdditionalPhone(_0x52796b,_0x11d916,_0x140562,_0x34fa64,_0x5c793e){return db[_0x7f9e('0x8f')]['find']({'where':{'CmContactId':_0x52796b,'item':_0x11d916}})['then'](function(_0x51d94a){if(_0x51d94a)logger['info'](_0x7f9e('0x90'),_0x51d94a);else{db['CmContactHasItem']['create']({'CmContactId':_0x52796b,'item':_0x11d916,'ItemTypeId':_0x140562,'OrderBy':_0x34fa64,'ItemClass':_0x7f9e('0x91'),'description':_0x5c793e});}});}function deleteCmHopperPhones(_0x424340){return new Promise(function(_0xb3aadc){return db[_0x7f9e('0x3d')][_0x7f9e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x424340}})['then'](function(_0xdf73ab){db['CmHopperAdditionalPhone'][_0x7f9e('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0xdf73ab,'id')}}});})[_0x7f9e('0x18')](function(){_0xb3aadc(0x1);});});}function addCmHopperPhones(_0x424f18){return new Promise(function(_0x16ed77){return db[_0x7f9e('0x3d')][_0x7f9e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x424f18}})['then'](function(_0x2af4d2){var _0x49017d=[];_[_0x7f9e('0x6e')](_0x2af4d2,function(_0x323f83){_0x49017d[_0x7f9e('0x61')](createCmHopperPhone(_0x424f18,_0x323f83['id']));});Promise[_0x7f9e('0x63')](_0x49017d)[_0x7f9e('0x18')](function(){_0x16ed77(0x1);});});});}function createCmHopperPhone(_0x101e19,_0x3db6f7){return new Promise(function(_0x16a79d){db['CmContactHasItem'][_0x7f9e('0x20')]({'raw':!![],'attributes':[_0x7f9e('0x92'),'OrderBy'],'where':{'CmContactId':_0x101e19,'ItemClass':_0x7f9e('0x91')},'include':[{'model':db[_0x7f9e('0x89')],'attributes':['OrderBy'],'as':_0x7f9e('0x68')}],'order':[_0x7f9e('0x8a'),db['sequelize'][_0x7f9e('0x6a')]('`ItemType`.OrderBy')]})['then'](function(_0x335db2){var _0x6b10c3=0x1;var _0x152aca=_[_0x7f9e('0x6e')](_0x335db2,function(_0x261c0b){_0x261c0b['CmHopperId']=_0x3db6f7;_0x261c0b[_0x7f9e('0x77')]=_0x261c0b['item'];_0x261c0b['OrderBy']=_0x6b10c3;delete _0x261c0b[_0x7f9e('0x93')];_0x6b10c3=_0x6b10c3+0x1;return _0x261c0b;});return db['CmHopperAdditionalPhone'][_0x7f9e('0x94')](_0x152aca,{});})[_0x7f9e('0x18')](function(){_0x16a79d(0x1);});});}function insertAdditionalPhones(_0x547663,_0xa49b00){return new Promise(function(_0x2b11ae){var _0x313e98=[];for(var _0x2b3468=0x0;_0x2b3468<_0xa49b00[_0x7f9e('0x28')];_0x2b3468++){var _0x218e14=_0xa49b00[_0x2b3468];_0x313e98[_0x7f9e('0x61')](parseContactItemType(_0x218e14));}Promise[_0x7f9e('0x63')](_0x313e98)[_0x7f9e('0x18')](function(){var _0x28da74={'id':_0x547663['id'],'items':_0xa49b00};return addAdditionalPhones(_0x28da74)['then'](function(){return addCmHopperPhones(_0x547663['id']);});})[_0x7f9e('0x18')](function(){_0x2b11ae(_0x547663);});});}function parseContactItemType(_0x75aca4){return new Promise(function(_0x3bfa5a){if(_0x75aca4['hasOwnProperty']('ItemTypeId')){_0x3bfa5a(_0x75aca4);}else{return db[_0x7f9e('0x89')]['find']({'where':{'name':_0x75aca4[_0x7f9e('0x68')]}})[_0x7f9e('0x18')](function(_0x404e9f){if(_[_0x7f9e('0x55')](_0x404e9f))_0x75aca4[_0x7f9e('0x8d')]=null;else _0x75aca4['ItemTypeId']=_0x404e9f['id'];_0x3bfa5a(_0x75aca4);});}});}exports[_0x7f9e('0x95')]=function(_0x5d2310,_0x4aca58){return db[_0x7f9e('0x8f')][_0x7f9e('0x20')]({'raw':!![],'where':{'CmContactId':_0x5d2310[_0x7f9e('0x26')]['id'],'ItemClass':_0x7f9e('0x91')},'include':[{'model':db[_0x7f9e('0x89')],'as':'ItemType'}],'order':[[_0x7f9e('0x8a')],[db['sequelize'][_0x7f9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x7f9e('0x18')](function(_0x166584){return _0x166584;})[_0x7f9e('0x18')](respondWithResult(_0x4aca58,null))['catch'](handleError(_0x4aca58,null));};exports[_0x7f9e('0x96')]=function(_0x3c962c,_0x294ba2){return db[_0x7f9e('0x8f')][_0x7f9e('0x20')]({'raw':!![],'where':{'CmContactId':_0x3c962c[_0x7f9e('0x37')]['fromContactId']}})['then'](function(_0x43d1dd){var _0x172edc=_[_0x7f9e('0x6e')](_0x43d1dd,function(_0xdf9a1d){_0xdf9a1d[_0x7f9e('0x97')]=_0x3c962c[_0x7f9e('0x37')][_0x7f9e('0x98')];return _0xdf9a1d;});return db[_0x7f9e('0x8f')][_0x7f9e('0x94')](_0x172edc,{});})[_0x7f9e('0x18')](function(){return addCmHopperPhones(_0x3c962c['body'][_0x7f9e('0x98')]);})[_0x7f9e('0x18')](function(){return['ok'];})[_0x7f9e('0x18')](respondWithResult(_0x294ba2,null))['catch'](handleError(_0x294ba2,null));};exports[_0x7f9e('0x99')]=function(_0x2d9280,_0x370867){var _0x37f159=[];_0x37f159[_0x7f9e('0x61')](createCmHopperPhone(_0x2d9280[_0x7f9e('0x37')]['id'],_0x2d9280[_0x7f9e('0x37')][_0x7f9e('0x9a')]));Promise['all'](_0x37f159)[_0x7f9e('0x18')](function(){return[0x1];})[_0x7f9e('0x18')](respondWithResult(_0x370867,null));};exports[_0x7f9e('0x9b')]=function(_0x1bb01e,_0x29dee1){var _0x56bb6f={'raw':![],'where':{}};var _0x2c5473={};var _0x162dd9={'count':0x0,'rows':[]};return db[_0x7f9e('0x24')][_0x7f9e('0x79')]({'where':{'id':_0x1bb01e[_0x7f9e('0x26')]['id']}})[_0x7f9e('0x18')](handleEntityNotFound(_0x29dee1,null))[_0x7f9e('0x18')](function(_0x13d8ab){if(_0x13d8ab){_0x2c5473[_0x7f9e('0x7e')]=_[_0x7f9e('0x29')](db['CmHopper'][_0x7f9e('0x7b')]);_0x2c5473[_0x7f9e('0x21')]=_[_0x7f9e('0x29')](_0x1bb01e[_0x7f9e('0x21')]);_0x2c5473[_0x7f9e('0x7c')]=_[_0x7f9e('0x7d')](_0x2c5473['model'],_0x2c5473[_0x7f9e('0x21')]);_0x56bb6f[_0x7f9e('0x7f')]=_['intersection'](_0x2c5473[_0x7f9e('0x7e')],qs[_0x7f9e('0x80')](_0x1bb01e[_0x7f9e('0x21')]['fields']));_0x56bb6f[_0x7f9e('0x7f')]=_0x56bb6f[_0x7f9e('0x7f')]['length']?_0x56bb6f[_0x7f9e('0x7f')]:_0x2c5473['model'];if(!_0x1bb01e[_0x7f9e('0x21')][_0x7f9e('0x36')]('nolimit')){_0x56bb6f[_0x7f9e('0x87')]=qs[_0x7f9e('0x87')](_0x1bb01e[_0x7f9e('0x21')][_0x7f9e('0x87')]);_0x56bb6f[_0x7f9e('0x14')]=qs[_0x7f9e('0x14')](_0x1bb01e[_0x7f9e('0x21')][_0x7f9e('0x14')]);}_0x56bb6f[_0x7f9e('0x81')]=qs[_0x7f9e('0x82')](_0x1bb01e[_0x7f9e('0x21')][_0x7f9e('0x82')]);_0x56bb6f[_0x7f9e('0x5c')]=qs[_0x7f9e('0x7c')](_['pick'](_0x1bb01e[_0x7f9e('0x21')],_0x2c5473[_0x7f9e('0x7c')]));_0x56bb6f[_0x7f9e('0x5c')]['ContactId']=_0x13d8ab['id'];if(_0x1bb01e[_0x7f9e('0x21')][_0x7f9e('0x83')]){_0x56bb6f[_0x7f9e('0x5c')]=_[_0x7f9e('0x84')](_0x56bb6f[_0x7f9e('0x5c')],{'$or':_[_0x7f9e('0x6e')](_0x56bb6f[_0x7f9e('0x7f')],function(_0x3b7e45){var _0x9d0698={};_0x9d0698[_0x3b7e45]={'$like':'%'+_0x1bb01e[_0x7f9e('0x21')]['filter']+'%'};return _0x9d0698;})});}_0x56bb6f=_[_0x7f9e('0x84')]({},_0x56bb6f,_0x1bb01e[_0x7f9e('0x85')]);return db[_0x7f9e('0x3d')][_0x7f9e('0x16')]({'where':_0x56bb6f[_0x7f9e('0x5c')]})['then'](function(_0x1c1654){_0x162dd9[_0x7f9e('0x16')]=_0x1c1654;if(_0x1bb01e[_0x7f9e('0x21')][_0x7f9e('0x9c')]){_0x56bb6f[_0x7f9e('0x9d')]=[{'all':!![]}];}return db[_0x7f9e('0x3d')][_0x7f9e('0x20')](_0x56bb6f);})[_0x7f9e('0x18')](function(_0x313ea3){_0x162dd9[_0x7f9e('0x9e')]=_0x313ea3;return _0x162dd9;});}})[_0x7f9e('0x18')](respondWithFilteredResult(_0x29dee1,_0x56bb6f))['catch'](handleError(_0x29dee1,null));};exports[_0x7f9e('0x9f')]=function(_0x1cf226,_0x44e2cf){var _0x40340c={'raw':!![],'where':{}};var _0x35b17c={};var _0x5c4fa3={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x1cf226[_0x7f9e('0x26')]['id']}})['then'](handleEntityNotFound(_0x44e2cf,null))[_0x7f9e('0x18')](function(_0x2517e5){if(_0x2517e5){_0x35b17c[_0x7f9e('0x7e')]=_[_0x7f9e('0x29')](db[_0x7f9e('0x4b')][_0x7f9e('0x7b')]);_0x35b17c[_0x7f9e('0x21')]=_[_0x7f9e('0x29')](_0x1cf226['query']);_0x35b17c[_0x7f9e('0x7c')]=_[_0x7f9e('0x7d')](_0x35b17c[_0x7f9e('0x7e')],_0x35b17c['query']);_0x40340c[_0x7f9e('0x7f')]=_['intersection'](_0x35b17c['model'],qs[_0x7f9e('0x80')](_0x1cf226['query'][_0x7f9e('0x80')]));_0x40340c['attributes']=_0x40340c['attributes'][_0x7f9e('0x28')]?_0x40340c[_0x7f9e('0x7f')]:_0x35b17c['model'];if(!_0x1cf226['query']['hasOwnProperty'](_0x7f9e('0x86'))){_0x40340c['limit']=qs[_0x7f9e('0x87')](_0x1cf226[_0x7f9e('0x21')]['limit']);_0x40340c[_0x7f9e('0x14')]=qs[_0x7f9e('0x14')](_0x1cf226[_0x7f9e('0x21')][_0x7f9e('0x14')]);}_0x40340c['order']=qs['sort'](_0x1cf226[_0x7f9e('0x21')]['sort']);_0x40340c[_0x7f9e('0x5c')]=qs['filters'](_['pick'](_0x1cf226[_0x7f9e('0x21')],_0x35b17c['filters']));_0x40340c[_0x7f9e('0x5c')]['ContactId']=_0x2517e5['id'];if(_0x1cf226['query'][_0x7f9e('0x83')]){_0x40340c['where']=_[_0x7f9e('0x84')](_0x40340c[_0x7f9e('0x5c')],{'$or':_[_0x7f9e('0x6e')](_0x40340c[_0x7f9e('0x7f')],function(_0x4482e4){var _0x4d140d={};_0x4d140d[_0x4482e4]={'$like':'%'+_0x1cf226[_0x7f9e('0x21')][_0x7f9e('0x83')]+'%'};return _0x4d140d;})});}_0x40340c=_[_0x7f9e('0x84')]({},_0x40340c,_0x1cf226[_0x7f9e('0x85')]);return db[_0x7f9e('0x4b')][_0x7f9e('0x16')]({'where':_0x40340c['where']})[_0x7f9e('0x18')](function(_0x28da79){_0x5c4fa3[_0x7f9e('0x16')]=_0x28da79;if(_0x1cf226[_0x7f9e('0x21')]['includeAll']){_0x40340c[_0x7f9e('0x9d')]=[{'all':!![]}];}return db[_0x7f9e('0x4b')][_0x7f9e('0x20')](_0x40340c);})[_0x7f9e('0x18')](function(_0x444da4){_0x5c4fa3[_0x7f9e('0x9e')]=_0x444da4;return _0x5c4fa3;});}})[_0x7f9e('0x18')](respondWithFilteredResult(_0x44e2cf,_0x40340c))[_0x7f9e('0x23')](handleError(_0x44e2cf,null));};exports[_0x7f9e('0xa0')]=function(_0x2f281d,_0x314762){var _0x58ad0a={'raw':!![],'where':{}};var _0x25dbde={};var _0x7321d8={'count':0x0,'rows':[]};return db[_0x7f9e('0x24')][_0x7f9e('0x79')]({'where':{'id':_0x2f281d['params']['id']}})[_0x7f9e('0x18')](handleEntityNotFound(_0x314762,null))[_0x7f9e('0x18')](function(_0x546dc0){if(_0x546dc0){_0x25dbde['model']=_[_0x7f9e('0x29')](db[_0x7f9e('0x4a')][_0x7f9e('0x7b')]);_0x25dbde[_0x7f9e('0x21')]=_[_0x7f9e('0x29')](_0x2f281d['query']);_0x25dbde[_0x7f9e('0x7c')]=_[_0x7f9e('0x7d')](_0x25dbde[_0x7f9e('0x7e')],_0x25dbde[_0x7f9e('0x21')]);_0x58ad0a[_0x7f9e('0x7f')]=_[_0x7f9e('0x7d')](_0x25dbde[_0x7f9e('0x7e')],qs[_0x7f9e('0x80')](_0x2f281d['query'][_0x7f9e('0x80')]));_0x58ad0a[_0x7f9e('0x7f')]=_0x58ad0a[_0x7f9e('0x7f')][_0x7f9e('0x28')]?_0x58ad0a['attributes']:_0x25dbde[_0x7f9e('0x7e')];if(!_0x2f281d[_0x7f9e('0x21')][_0x7f9e('0x36')](_0x7f9e('0x86'))){_0x58ad0a[_0x7f9e('0x87')]=qs[_0x7f9e('0x87')](_0x2f281d['query']['limit']);_0x58ad0a[_0x7f9e('0x14')]=qs[_0x7f9e('0x14')](_0x2f281d[_0x7f9e('0x21')][_0x7f9e('0x14')]);}_0x58ad0a['order']=qs[_0x7f9e('0x82')](_0x2f281d[_0x7f9e('0x21')][_0x7f9e('0x82')]);_0x58ad0a[_0x7f9e('0x5c')]=qs['filters'](_[_0x7f9e('0xa1')](_0x2f281d[_0x7f9e('0x21')],_0x25dbde['filters']));_0x58ad0a['where'][_0x7f9e('0xa2')]=_0x546dc0['id'];if(_0x2f281d[_0x7f9e('0x21')]['filter']){_0x58ad0a['where']=_[_0x7f9e('0x84')](_0x58ad0a[_0x7f9e('0x5c')],{'$or':_[_0x7f9e('0x6e')](_0x58ad0a['attributes'],function(_0x3dcfbf){var _0x3f6ee3={};_0x3f6ee3[_0x3dcfbf]={'$like':'%'+_0x2f281d[_0x7f9e('0x21')][_0x7f9e('0x83')]+'%'};return _0x3f6ee3;})});}_0x58ad0a=_['merge']({},_0x58ad0a,_0x2f281d['options']);return db[_0x7f9e('0x4a')][_0x7f9e('0x16')]({'where':_0x58ad0a[_0x7f9e('0x5c')]})[_0x7f9e('0x18')](function(_0x55430b){_0x7321d8[_0x7f9e('0x16')]=_0x55430b;if(_0x2f281d[_0x7f9e('0x21')]['includeAll']){_0x58ad0a[_0x7f9e('0x9d')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x58ad0a);})[_0x7f9e('0x18')](function(_0x40ff45){_0x7321d8['rows']=_0x40ff45;return _0x7321d8;});}})['then'](respondWithFilteredResult(_0x314762,_0x58ad0a))[_0x7f9e('0x23')](handleError(_0x314762,null));};exports[_0x7f9e('0xa3')]=function(_0x1715e3,_0x38d8f5){var _0x50878e={'raw':!![],'where':{}};var _0x7eb85b={};var _0x30eae9={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x1715e3['params']['id']}})['then'](handleEntityNotFound(_0x38d8f5,null))['then'](function(_0x218bf8){if(_0x218bf8){_0x7eb85b[_0x7f9e('0x7e')]=_[_0x7f9e('0x29')](db['JscriptySessionReport'][_0x7f9e('0x7b')]);_0x7eb85b[_0x7f9e('0x21')]=_[_0x7f9e('0x29')](_0x1715e3[_0x7f9e('0x21')]);_0x7eb85b[_0x7f9e('0x7c')]=_[_0x7f9e('0x7d')](_0x7eb85b[_0x7f9e('0x7e')],_0x7eb85b[_0x7f9e('0x21')]);_0x50878e[_0x7f9e('0x7f')]=_['intersection'](_0x7eb85b[_0x7f9e('0x7e')],qs[_0x7f9e('0x80')](_0x1715e3[_0x7f9e('0x21')][_0x7f9e('0x80')]));_0x50878e[_0x7f9e('0x7f')]=_0x50878e[_0x7f9e('0x7f')][_0x7f9e('0x28')]?_0x50878e['attributes']:_0x7eb85b[_0x7f9e('0x7e')];if(!_0x1715e3[_0x7f9e('0x21')]['hasOwnProperty'](_0x7f9e('0x86'))){_0x50878e[_0x7f9e('0x87')]=qs[_0x7f9e('0x87')](_0x1715e3[_0x7f9e('0x21')][_0x7f9e('0x87')]);_0x50878e[_0x7f9e('0x14')]=qs[_0x7f9e('0x14')](_0x1715e3['query']['offset']);}_0x50878e['order']=qs['sort'](_0x1715e3[_0x7f9e('0x21')][_0x7f9e('0x82')]);_0x50878e[_0x7f9e('0x5c')]=qs['filters'](_[_0x7f9e('0xa1')](_0x1715e3[_0x7f9e('0x21')],_0x7eb85b[_0x7f9e('0x7c')]));_0x50878e[_0x7f9e('0x5c')]['ContactId']=_0x218bf8['id'];if(_0x1715e3[_0x7f9e('0x21')][_0x7f9e('0x83')]){_0x50878e[_0x7f9e('0x5c')]=_[_0x7f9e('0x84')](_0x50878e[_0x7f9e('0x5c')],{'$or':_[_0x7f9e('0x6e')](_0x50878e[_0x7f9e('0x7f')],function(_0x5c6798){var _0x144366={};_0x144366[_0x5c6798]={'$like':'%'+_0x1715e3['query'][_0x7f9e('0x83')]+'%'};return _0x144366;})});}_0x50878e=_['merge']({},_0x50878e,_0x1715e3['options']);return db['JscriptySessionReport']['count']({'where':_0x50878e[_0x7f9e('0x5c')]})[_0x7f9e('0x18')](function(_0x4d4a43){_0x30eae9[_0x7f9e('0x16')]=_0x4d4a43;if(_0x1715e3[_0x7f9e('0x21')][_0x7f9e('0x9c')]){_0x50878e[_0x7f9e('0x9d')]=[{'all':!![]}];}return db[_0x7f9e('0x51')]['findAll'](_0x50878e);})[_0x7f9e('0x18')](function(_0x1638c9){_0x30eae9[_0x7f9e('0x9e')]=_0x1638c9;return _0x30eae9;});}})[_0x7f9e('0x18')](respondWithFilteredResult(_0x38d8f5,_0x50878e))[_0x7f9e('0x23')](handleError(_0x38d8f5,null));};exports[_0x7f9e('0xa4')]=function(_0x5ba971,_0x5b79e6){try{if(!_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0x5e')]){throw new Error(_0x7f9e('0xa5'));}if(!_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0xa6')]){throw new Error(_0x7f9e('0xa7'));}if(!_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0xa8')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x5ba971[_0x7f9e('0x37')]['socket_timestamp']){throw new Error(_0x7f9e('0xa9'));}var _0x17455a=_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0xa6')]['split'](',');var _0x5d7fd2=_0x5ba971['body'][_0x7f9e('0xa8')][_0x7f9e('0xaa')](',');if(!_0x17455a[_0x7f9e('0x28')]||!_0x5d7fd2[_0x7f9e('0x28')]||_0x17455a[_0x7f9e('0x28')]!==_0x5d7fd2[_0x7f9e('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0x80')]=_[_0x7f9e('0xab')](_0x17455a,_0x5d7fd2);if(!_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0x80')][_0x7f9e('0x77')]){throw new Error(_0x7f9e('0xac'));}if(!_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0x80')][_0x7f9e('0xad')]){throw new Error(_0x7f9e('0xae'));}var _0x2371ec=path[_0x7f9e('0x54')](config[_0x7f9e('0xaf')],'server/files/tmp',_0x5ba971[_0x7f9e('0xb0')][_0x7f9e('0xb1')]);fs[_0x7f9e('0xb2')](_0x2371ec,parseInt('0777',0x8));var _0x16decb=require(_0x7f9e('0xb3'))[_0x7f9e('0xb4')](path['join'](__dirname,_0x7f9e('0xb5')),[_0x2371ec,_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0xa6')],_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0xa8')],_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0x5e')],_0x5ba971[_0x7f9e('0x37')]['CompanyId'],_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0x5b')],_0x5ba971[_0x7f9e('0x37')][_0x7f9e('0xb6')]]);return _0x5b79e6['status'](0xc8)['json']({'message':_0x7f9e('0xb7'),'pid':_0x16decb['pid']});}catch(_0x3d4b60){return _0x5b79e6[_0x7f9e('0x12')](0x1f4)[_0x7f9e('0x1e')](_0x3d4b60);}};exports[_0x7f9e('0xb8')]=function(_0xb774ac,_0x1cf908){var _0x1a8d53=fs[_0x7f9e('0xb9')](_0xb774ac['file'][_0x7f9e('0x2')]);Papa[_0x7f9e('0xba')](_0x1a8d53,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x29a8e0){return _0x1cf908[_0x7f9e('0x12')](0xc8)[_0x7f9e('0x13')]({'file':_0xb774ac[_0x7f9e('0xb0')],'fields':_0x29a8e0[_0x7f9e('0xbb')]['fields']});}});};exports[_0x7f9e('0xbc')]=function(_0x2dd1e2,_0x3f1363){return db[_0x7f9e('0xbd')][_0x7f9e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7f9e('0xbe')}})[_0x7f9e('0x18')](function(_0x9abed9){var _0x242c58=![];if(!_0x2dd1e2[_0x7f9e('0x37')][_0x7f9e('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2dd1e2[_0x7f9e('0x37')][_0x7f9e('0xbf')][_0x7f9e('0x77')]){throw new Error(_0x7f9e('0xac'));}if(!_0x2dd1e2[_0x7f9e('0x37')][_0x7f9e('0xbf')][_0x7f9e('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x2dd1e2[_0x7f9e('0x37')][_0x7f9e('0xb6')]){throw new Error(_0x7f9e('0xa9'));}var _0x2d88d=require(_0x7f9e('0xb3'))[_0x7f9e('0xb4')](path['join'](__dirname,_0x7f9e('0xc0')),[_0x2dd1e2['params']['id'],JSON['stringify'](_0x2dd1e2[_0x7f9e('0x37')]),JSON[_0x7f9e('0xc1')](_0x9abed9)]);_0x2d88d['on'](_0x7f9e('0xc2'),function(){_0x242c58=!![];return _0x3f1363[_0x7f9e('0x12')](0xc8)[_0x7f9e('0x13')]({'message':_0x7f9e('0xc3'),'pid':_0x2d88d['pid']});});_0x2d88d['on'](_0x7f9e('0xc4'),function(_0x4d32a7){if(_0x4d32a7&&!_0x242c58){return _0x3f1363[_0x7f9e('0x12')](0x1f4)[_0x7f9e('0x13')]({'message':_0x7f9e('0xc5'),'pid':_0x2d88d[_0x7f9e('0xc6')]});}});})[_0x7f9e('0x23')](handleError(_0x3f1363,null));};exports[_0x7f9e('0xc7')]=function(_0x548f5c,_0x495a63){return db['User'][_0x7f9e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7f9e('0xbe')}})[_0x7f9e('0x18')](function(_0x40b207){var _0x28975d=![];if(!_0x548f5c[_0x7f9e('0x37')][_0x7f9e('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x548f5c['body'][_0x7f9e('0xbf')][_0x7f9e('0x77')]){throw new Error(_0x7f9e('0xac'));}if(!_0x548f5c[_0x7f9e('0x37')][_0x7f9e('0xbf')][_0x7f9e('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x548f5c['body']['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x271197=require(_0x7f9e('0xb3'))[_0x7f9e('0xb4')](path[_0x7f9e('0x54')](__dirname,_0x7f9e('0xc8')),[_0x548f5c['params']['id'],JSON[_0x7f9e('0xc1')](_0x548f5c['body']),JSON[_0x7f9e('0xc1')](_0x40b207)]);_0x271197['on']('message',function(){_0x28975d=!![];return _0x495a63[_0x7f9e('0x12')](0xc8)[_0x7f9e('0x13')]({'message':_0x7f9e('0xc3'),'pid':_0x271197[_0x7f9e('0xc6')]});});_0x271197['on']('exit',function(_0x5bb5e2){if(_0x5bb5e2&&!_0x28975d){return _0x495a63[_0x7f9e('0x12')](0x1f4)[_0x7f9e('0x13')]({'message':'error\x20child\x20process','pid':_0x271197[_0x7f9e('0xc6')]});}});})[_0x7f9e('0x23')](handleError(_0x495a63,null));};exports[_0x7f9e('0xc9')]=function(_0x1683d7,_0x210c6){var _0x30e95f=[_0x7f9e('0xca'),_0x7f9e('0xcb'),_0x7f9e('0xcc'),_0x7f9e('0xcd'),'fax',_0x7f9e('0xce'),_0x7f9e('0xcf')];var _0x19cce3={'offset':0x0,'order':qs[_0x7f9e('0x82')]('-createdAt')},_0x201ee9={'count':0x0,'rows':[]};Promise[_0x7f9e('0xd0')]()[_0x7f9e('0x18')](function(){if(_0x1683d7[_0x7f9e('0x21')][_0x7f9e('0xd1')]){if(!_[_0x7f9e('0xd2')](_0x30e95f,_0x1683d7[_0x7f9e('0x21')]['channel'][_0x7f9e('0xd3')]())){throw new Error(_0x7f9e('0xd4'));}_0x30e95f=[_0x1683d7[_0x7f9e('0x21')][_0x7f9e('0xd1')][_0x7f9e('0xd3')]()];}if(_0x1683d7[_0x7f9e('0x21')][_0x7f9e('0xd5')]){try{var _0x383f10=JSON[_0x7f9e('0xba')](_0x1683d7['query'][_0x7f9e('0xd5')]);if(!moment(_0x383f10[_0x7f9e('0x38')])['isValid']()){throw new Error(_0x7f9e('0xd6'));}if(!moment(_0x383f10['to'])[_0x7f9e('0xd7')]()){throw new Error(_0x7f9e('0xd8'));}}catch(_0x38e3a7){throw new Error(_0x7f9e('0xd9'));}}if(!_0x1683d7[_0x7f9e('0x21')][_0x7f9e('0x36')](_0x7f9e('0x86'))){_0x19cce3[_0x7f9e('0x87')]=qs[_0x7f9e('0x87')](_0x1683d7[_0x7f9e('0x21')]['limit']||0xa);_0x19cce3[_0x7f9e('0x14')]=qs[_0x7f9e('0x14')](_0x1683d7['query']['offset']);}var _0x19f63d=_0x30e95f[_0x7f9e('0x6e')](function(_0x46964a){if(_0x46964a==='voice'){var _0x4fd473={'attributes':['id',_0x7f9e('0xda'),_0x7f9e('0x32'),_0x7f9e('0xdb'),'destination','callerid',_0x7f9e('0xdc'),_0x7f9e('0xdd'),'duration','note','createdAt',_0x7f9e('0xde'),'userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x1683d7[_0x7f9e('0x26')]['id']},'include':[{'model':db[_0x7f9e('0xbd')],'as':'User','attributes':['id','name',_0x7f9e('0xdf'),_0x7f9e('0x30')]}],'order':[[_0x7f9e('0xe0'),_0x7f9e('0xe1')]]};if(_0x1683d7[_0x7f9e('0x21')][_0x7f9e('0xd5')]){_0x4fd473[_0x7f9e('0x5c')][_0x7f9e('0xe0')]={'$gte':_0x383f10[_0x7f9e('0x38')],'$lte':_0x383f10['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x4fd473)[_0x7f9e('0x18')](function(_0x582621){_0x201ee9[_0x7f9e('0x16')]+=_0x582621['count'];return _['map'](_0x582621[_0x7f9e('0x9e')],function(_0x390fd2){var _0x32fef9=_0x390fd2[_0x7f9e('0x39')]({'plain':!![]});_0x32fef9[_0x7f9e('0xd1')]=_0x46964a;if(_0x32fef9['User']){_0x32fef9['User']={'id':_0x32fef9[_0x7f9e('0xbd')]['id'],'name':_0x32fef9[_0x7f9e('0xbd')]['name'],'fullname':_0x32fef9[_0x7f9e('0xbd')][_0x7f9e('0xdf')],'alias':_0x32fef9['User']['alias']};}return _0x32fef9;});});}else{var _0x472f3f=_['startCase'](_0x46964a)+(_0x46964a===_0x7f9e('0xcb')?_0x7f9e('0xe2'):_0x7f9e('0xe3'));var _0x524f86={'attributes':['id',_0x7f9e('0xe4'),_0x7f9e('0xe5'),_0x7f9e('0xe0'),'note',_0x7f9e('0xe6'),'secondDisposition',_0x7f9e('0xe7'),_0x7f9e('0xe8'),_0x472f3f+'Id'],'where':{'ContactId':_0x1683d7[_0x7f9e('0x26')]['id']},'include':[{'model':db[_0x472f3f],'as':'Account','attributes':['id',_0x7f9e('0x1d'),_0x7f9e('0xe9')]},{'model':db['User'],'as':'Owner','attributes':['id',_0x7f9e('0x1d'),_0x7f9e('0xdf')]},{'model':db[_0x7f9e('0x7a')],'as':_0x7f9e('0x64'),'attributes':['id',_0x7f9e('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0x7f9e('0xe0'),_0x7f9e('0xe1')]]};if(_0x1683d7[_0x7f9e('0x21')][_0x7f9e('0xd5')]){_0x524f86[_0x7f9e('0x5c')][_0x7f9e('0xe0')]={'$gte':_0x383f10[_0x7f9e('0x38')],'$lte':_0x383f10['to']};}switch(_0x46964a){case'chat':_0x524f86[_0x7f9e('0x7f')][_0x7f9e('0x61')]('browserName',_0x7f9e('0xea'),_0x7f9e('0xeb'),_0x7f9e('0xec'),_0x7f9e('0xed'),_0x7f9e('0xee'),'ratingType','ratingValue',_0x7f9e('0xef'));break;case _0x7f9e('0xca'):_0x524f86['attributes']['push']('subject','substatus');break;case'openchannel':_0x524f86[_0x7f9e('0x7f')]['push'](_0x7f9e('0xf0'),'threadId');break;}return db[_[_0x7f9e('0xf1')](_0x46964a)+_0x7f9e('0xf2')][_0x7f9e('0xf3')](_0x524f86)[_0x7f9e('0x18')](function(_0x3c8e18){_0x201ee9[_0x7f9e('0x16')]+=_0x3c8e18['count'];return _[_0x7f9e('0x6e')](_0x3c8e18[_0x7f9e('0x9e')],function(_0x5d293b){var _0x53d4e8=_0x5d293b['get']({'plain':!![]});_0x53d4e8[_0x7f9e('0xd1')]=_0x46964a;if(_0x53d4e8[_0x7f9e('0xf4')]){_0x53d4e8[_0x7f9e('0xf4')]={'id':_0x53d4e8[_0x7f9e('0xf4')]['id'],'name':_0x53d4e8['Owner'][_0x7f9e('0x1d')],'fullname':_0x53d4e8[_0x7f9e('0xf4')][_0x7f9e('0xdf')]};}return _0x53d4e8;});});}});return Promise[_0x7f9e('0x63')](_0x19f63d);})[_0x7f9e('0x18')](function(_0x1da616){return _(_0x1da616)[_0x7f9e('0xf5')]()[_0x7f9e('0xf6')](_0x7f9e('0xe0'))['reverse']()[_0x7f9e('0xf7')]();})[_0x7f9e('0x18')](function(_0x4d62d9){_0x201ee9['rows']=_0x19cce3['limit']?_0x4d62d9[_0x7f9e('0xf8')](_0x19cce3[_0x7f9e('0x14')],_0x19cce3[_0x7f9e('0x14')]+_0x19cce3[_0x7f9e('0x87')]):_0x4d62d9;return _0x201ee9;})[_0x7f9e('0x18')](respondWithFilteredResult(_0x210c6,_0x19cce3))[_0x7f9e('0x23')](handleError(_0x210c6,null));}; \ No newline at end of file +var _0xc398=['OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','create','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','where','findOrCreate','push','contact','all','show','Tag','Tags','tag','ListId','$and','CmCustomField','omit','map','format','cf_%d','pickBy','table','cm_contacts','id\x20=\x20?','sequelize','text','values','CmHopper','phone','getTags','findOne','model','filters','intersection','fields','attributes','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','CmHopperAdditionalPhone','item','PHONE','ItemType','literal','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','fromContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','getJscriptySessions','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','binding','child_process','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','mail','chat','sms','openchannel','whatsapp','voice','resolve','channel','includes','range','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','DESC','findAndCountAll','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','fullname','customerIp','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','externalUrl','threadId','startCase','flatten','sortBy','reverse','value','moment','bluebird','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','status','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','query','user','CmContact','find','params','catch','keys','length','startsWith','columnName','analytics','cf_','displayName','alias','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','join','CmHopperBlack','ChatOfflineMessage','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport'];(function(_0x4d0bd8,_0x1812f2){var _0x53c547=function(_0x23eae4){while(--_0x23eae4){_0x4d0bd8['push'](_0x4d0bd8['shift']());}};_0x53c547(++_0x1812f2);}(_0xc398,0xa3));var _0x8c39=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xc398[_0x1ad926];return _0x1b81dc;};'use strict';var moment=require(_0x8c39('0x0'));var BPromise=require(_0x8c39('0x1'));var util=require('util');var path=require(_0x8c39('0x2'));var fs=require('fs');var _=require(_0x8c39('0x3'));var squel=require('squel');var Papa=require(_0x8c39('0x4'));var Redis=require(_0x8c39('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x8c39('0x6'));var logger=require(_0x8c39('0x7'))('api');var config=require(_0x8c39('0x8'));var shared=require('../../config/environment/shared');var db=require(_0x8c39('0x9'))['db'];config[_0x8c39('0xa')]=_[_0x8c39('0xb')](config['redis'],{'host':_0x8c39('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8c39('0xd'))[_0x8c39('0xe')](socket);function respondWithResult(_0x498a1e,_0x6fbfa3){_0x6fbfa3=_0x6fbfa3||0xc8;return function(_0x2732f5){if(_0x2732f5){return _0x498a1e['status'](_0x6fbfa3)[_0x8c39('0xf')](_0x2732f5);}};}function respondWithFilteredResult(_0xdf563d,_0x11f639){return function(_0x34de4f){if(_0x34de4f){var _0x10c502=typeof _0x11f639['offset']===_0x8c39('0x10')&&typeof _0x11f639[_0x8c39('0x11')]===_0x8c39('0x10');var _0x3d1e13=_0x34de4f[_0x8c39('0x12')];var _0x3dbd03=_0x10c502?0x0:_0x11f639['offset'];var _0x3199ca=_0x10c502?_0x34de4f[_0x8c39('0x12')]:_0x11f639[_0x8c39('0x13')]+_0x11f639[_0x8c39('0x11')];var _0x5af53e;if(_0x3199ca>=_0x3d1e13){_0x3199ca=_0x3d1e13;_0x5af53e=0xc8;}else{_0x5af53e=0xce;}_0xdf563d['status'](_0x5af53e);return _0xdf563d[_0x8c39('0x14')](_0x8c39('0x15'),_0x3dbd03+'-'+_0x3199ca+'/'+_0x3d1e13)['json'](_0x34de4f);}return null;};}function saveUpdates(_0x16d63d){return function(_0x48f04f){if(_0x48f04f){return _0x48f04f[_0x8c39('0x16')](_0x16d63d)[_0x8c39('0x17')](function(_0x4ebbf1){return _0x4ebbf1;});}return null;};}function removeEntity(_0x5453c5){return function(_0x59ce8d){if(_0x59ce8d){return _0x59ce8d[_0x8c39('0x18')]()[_0x8c39('0x17')](function(){_0x5453c5[_0x8c39('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3956c0){return function(_0x132aa3){if(!_0x132aa3){_0x3956c0[_0x8c39('0x1a')](0x194);}return _0x132aa3;};}function handleError(_0xdfcaf5,_0x111fc2){_0x111fc2=_0x111fc2||0x1f4;return function(_0x3138a6){logger[_0x8c39('0x1b')](_0x3138a6[_0x8c39('0x1c')]);if(_0x3138a6[_0x8c39('0x1d')]){delete _0x3138a6['name'];}_0xdfcaf5['status'](_0x111fc2)[_0x8c39('0x1e')](_0x3138a6);};}exports[_0x8c39('0x1f')]=function(_0x1bcbea,_0x458a0a){var _0x4440f5={};return contacts[_0x8c39('0x20')]()[_0x8c39('0x17')](function(_0x336a89){_0x4440f5=qs[_0x8c39('0x21')](_0x336a89,_0x1bcbea);return contacts[_0x8c39('0x22')](_0x1bcbea[_0x8c39('0x23')],_0x1bcbea[_0x8c39('0x24')],_0x4440f5,_0x336a89);})[_0x8c39('0x17')](respondWithFilteredResult(_0x458a0a,_0x4440f5))['catch'](handleError(_0x458a0a,null));};exports['destroy']=function(_0x50a267,_0x335162){return db[_0x8c39('0x25')][_0x8c39('0x26')]({'where':{'id':_0x50a267[_0x8c39('0x27')]['id']}})[_0x8c39('0x17')](handleEntityNotFound(_0x335162,null))[_0x8c39('0x17')](removeEntity(_0x335162,null))[_0x8c39('0x28')](handleError(_0x335162,null));};exports['describe']=function(_0x54e0ea,_0x30c17f){return db['CmContact'][_0x8c39('0x20')]()['then'](function(_0x5aa182){delete _0x5aa182['tags'];for(var _0x4eabc2=0x0;_0x4eabc20x0){return new Promise(function(_0x586a5e){var _0x599270=[];for(var _0x57ce51=0x0;_0x57ce51<_0x2170fe[_0x8c39('0x2a')];_0x57ce51++){_0x599270[_0x8c39('0x5b')](insertAdditionalPhones(_0x2170fe[_0x57ce51][_0x8c39('0x5c')],_0x2170fe[_0x57ce51][_0x8c39('0x55')]));}Promise[_0x8c39('0x5d')](_0x599270)[_0x8c39('0x17')](function(){_0x586a5e(0x1);});})[_0x8c39('0x17')](function(){return{'success':_0x1adcbc,'failure':_0x7c1048,'duplicates':_0xa9a073};});}else{return{'success':_0x1adcbc,'failure':_0x7c1048,'duplicates':_0xa9a073};}}})[_0x8c39('0x17')](respondWithResult(_0x1a169a,0xc9))[_0x8c39('0x28')](handleError(_0x1a169a,null));};exports[_0x8c39('0x5e')]=function(_0xd4bfcd,_0x51825d){var _0x1c16f0;return db[_0x8c39('0x25')]['describe']()[_0x8c39('0x17')](function(_0x141d3a){return db[_0x8c39('0x25')]['find']({'where':{'id':_0xd4bfcd[_0x8c39('0x27')]['id']},'include':[{'model':db[_0x8c39('0x5f')],'as':_0x8c39('0x60'),'attributes':['id',_0x8c39('0x1d'),'color'],'required':_0xd4bfcd[_0x8c39('0x23')][_0x8c39('0x61')]?!![]:![]},{'model':db[_0x8c39('0x45')],'as':'Phones','where':{'CmContactId':_0xd4bfcd[_0x8c39('0x27')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':'ItemType'}]}],'order':[db['sequelize']['literal']('Phones.OrderBy')],'attributes':_[_0x8c39('0x29')](_0x141d3a)});})['then'](function(_0x391d70){if(!_['isNil'](_0x391d70)){_0x1c16f0=_0x391d70['get']({'plain':!![]});var _0xd7e42f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x391d70&&_0x391d70[_0x8c39('0x62')]){if(_0x391d70[_0x8c39('0x62')]){_0xd7e42f[_0x8c39('0x59')][_0x8c39('0x63')]['push']({'ListId':{'$ne':_0x391d70['ListId']}});}}return db[_0x8c39('0x64')][_0x8c39('0x22')](_0xd7e42f);}})[_0x8c39('0x17')](function(_0x560100){if(!_[_0x8c39('0x51')](_0x560100)){return _[_0x8c39('0x65')](_0x1c16f0,_[_0x8c39('0x66')](_0x560100,function(_0x2c54b8){return util[_0x8c39('0x67')](_0x8c39('0x68'),_0x2c54b8['id']);}));}})[_0x8c39('0x17')](handleEntityNotFound(_0x51825d,null))[_0x8c39('0x17')](respondWithResult(_0x51825d,null))[_0x8c39('0x28')](handleError(_0x51825d,null));};exports[_0x8c39('0x16')]=function(_0x5db79b,_0x2c3b23){var _0x2ff5e1;if(_0x5db79b['body']['id']){delete _0x5db79b[_0x8c39('0x36')]['id'];}if(!_[_0x8c39('0x51')](_0x5db79b[_0x8c39('0x36')][_0x8c39('0x52')])){var _0x31f972=_0x5db79b[_0x8c39('0x36')][_0x8c39('0x52')];if(!_[_0x8c39('0x51')](shared[_0x8c39('0x54')][_0x31f972]))_0x5db79b[_0x8c39('0x36')][_0x8c39('0x53')]=shared[_0x8c39('0x54')][_0x31f972]['utcOffset'];}return db[_0x8c39('0x25')][_0x8c39('0x26')]({'where':{'id':_0x5db79b['params']['id']}})['then'](handleEntityNotFound(_0x2c3b23,null))[_0x8c39('0x17')](saveUpdates(_0x5db79b[_0x8c39('0x36')],null))['then'](function(_0x383475){_0x2ff5e1=_0x383475;var _0x17677e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x383475&&_0x383475[_0x8c39('0x62')]){if(_0x383475[_0x8c39('0x62')]){_0x17677e[_0x8c39('0x59')]['$and'][_0x8c39('0x5b')]({'ListId':{'$ne':_0x383475[_0x8c39('0x62')]}});}}return db['CmCustomField'][_0x8c39('0x22')](_0x17677e);})[_0x8c39('0x17')](function(_0x31c4b3){if(_0x31c4b3){return _['omit'](_[_0x8c39('0x69')](_0x5db79b[_0x8c39('0x36')],function(_0x4374c0,_0x576861){return _[_0x8c39('0x2b')](_0x576861,_0x8c39('0x2e'));}),_[_0x8c39('0x66')](_0x31c4b3,function(_0x242ab0){return util[_0x8c39('0x67')]('cf_%d',_0x242ab0['id']);}));}})[_0x8c39('0x17')](function(_0x9e0344){if(_0x9e0344&&!_['isEmpty'](_0x9e0344)){var _0x57e976=squel[_0x8c39('0x16')]()[_0x8c39('0x6a')](_0x8c39('0x6b'))['setFields'](_0x9e0344)[_0x8c39('0x59')](_0x8c39('0x6c'),_0x5db79b[_0x8c39('0x27')]['id'])['toParam']();return db[_0x8c39('0x6d')][_0x8c39('0x23')](_0x57e976[_0x8c39('0x6e')],{'replacements':_0x57e976[_0x8c39('0x6f')]});}})[_0x8c39('0x17')](function(){if(_0x5db79b['body']['phone']&&_0x2ff5e1){return db[_0x8c39('0x70')][_0x8c39('0x16')]({'phone':_0x5db79b['body'][_0x8c39('0x71')],'OrderBy':0x0},{'where':{'ContactId':_0x2ff5e1['id']}});}})[_0x8c39('0x17')](function(){return _0x2ff5e1;})[_0x8c39('0x17')](respondWithResult(_0x2c3b23,null))['catch'](handleError(_0x2c3b23,null));};exports[_0x8c39('0x72')]=function(_0x1b36ca,_0x30c64f){var _0x40ba7d={};var _0x56e036={};var _0x9faf0b;var _0x46bfcb;return db[_0x8c39('0x25')][_0x8c39('0x73')]({'where':{'id':_0x1b36ca[_0x8c39('0x27')]['id']}})['then'](handleEntityNotFound(_0x30c64f,null))[_0x8c39('0x17')](function(_0xe3ed7f){if(_0xe3ed7f){_0x9faf0b=_0xe3ed7f;_0x56e036[_0x8c39('0x74')]=_[_0x8c39('0x29')](db[_0x8c39('0x5f')]['rawAttributes']);_0x56e036['query']=_['keys'](_0x1b36ca[_0x8c39('0x23')]);_0x56e036[_0x8c39('0x75')]=_[_0x8c39('0x76')](_0x56e036[_0x8c39('0x74')],_0x56e036['query']);_0x40ba7d['attributes']=_['intersection'](_0x56e036[_0x8c39('0x74')],qs['fields'](_0x1b36ca[_0x8c39('0x23')][_0x8c39('0x77')]));_0x40ba7d[_0x8c39('0x78')]=_0x40ba7d['attributes'][_0x8c39('0x2a')]?_0x40ba7d['attributes']:_0x56e036['model'];_0x40ba7d[_0x8c39('0x79')]=qs['sort'](_0x1b36ca[_0x8c39('0x23')][_0x8c39('0x7a')]);_0x40ba7d[_0x8c39('0x59')]=qs[_0x8c39('0x75')](_[_0x8c39('0x7b')](_0x1b36ca[_0x8c39('0x23')],_0x56e036[_0x8c39('0x75')]));if(_0x1b36ca[_0x8c39('0x23')][_0x8c39('0x7c')]){_0x40ba7d['where']=_[_0x8c39('0x35')](_0x40ba7d[_0x8c39('0x59')],{'$or':_[_0x8c39('0x66')](_0x40ba7d[_0x8c39('0x78')],function(_0x2d6407){var _0x33f671={};_0x33f671[_0x2d6407]={'$like':'%'+_0x1b36ca['query'][_0x8c39('0x7c')]+'%'};return _0x33f671;})});}_0x40ba7d=_[_0x8c39('0x35')]({},_0x40ba7d,_0x1b36ca[_0x8c39('0x7d')]);return _0x9faf0b['getTags'](_0x40ba7d);}})[_0x8c39('0x17')](function(_0x2e4d59){if(_0x2e4d59){_0x46bfcb=_0x2e4d59[_0x8c39('0x2a')];if(!_0x1b36ca[_0x8c39('0x23')][_0x8c39('0x34')](_0x8c39('0x7e'))){_0x40ba7d[_0x8c39('0x11')]=qs[_0x8c39('0x11')](_0x1b36ca[_0x8c39('0x23')][_0x8c39('0x11')]);_0x40ba7d[_0x8c39('0x13')]=qs[_0x8c39('0x13')](_0x1b36ca['query'][_0x8c39('0x13')]);}return _0x9faf0b['getTags'](_0x40ba7d);}})[_0x8c39('0x17')](function(_0x53840b){if(_0x53840b){return _0x53840b?{'count':_0x46bfcb,'rows':_0x53840b}:null;}})[_0x8c39('0x17')](respondWithResult(_0x30c64f,null))['catch'](handleError(_0x30c64f,null));};exports['setTags']=function(_0x5cd8a1,_0x15e2ec){if(_0x5cd8a1[_0x8c39('0x36')]['id']){delete _0x5cd8a1[_0x8c39('0x36')]['id'];}return db[_0x8c39('0x25')][_0x8c39('0x73')]({'where':{'id':_0x5cd8a1['params']['id']}})[_0x8c39('0x17')](handleEntityNotFound(_0x15e2ec,null))['then'](function(_0x3c580b){if(_0x3c580b){return _0x3c580b[_0x8c39('0x7f')](_0x5cd8a1[_0x8c39('0x36')][_0x8c39('0x80')]||[]);}return null;})[_0x8c39('0x17')](respondWithResult(_0x15e2ec,null))['catch'](handleError(_0x15e2ec,null));};exports[_0x8c39('0x81')]=function(_0x26bf1b,_0x1f9554){var _0x58687b=[];_0x58687b[_0x8c39('0x5b')](addAdditionalPhones(_0x26bf1b[_0x8c39('0x36')]));Promise['all'](_0x58687b)[_0x8c39('0x17')](function(){_0x58687b=[];_0x58687b['push'](deleteCmHopperPhones(_0x26bf1b[_0x8c39('0x36')]['id']));_0x58687b[_0x8c39('0x5b')](addCmHopperPhones(_0x26bf1b[_0x8c39('0x36')]['id']));Promise['all'](_0x58687b)['then'](function(){return[0x1];})['then'](respondWithResult(_0x1f9554,null));});};function addAdditionalPhones(_0x107a8d){var _0x55af65;return new Promise(function(_0x37a230){return db[_0x8c39('0x45')][_0x8c39('0x18')]({'where':{'CmContactId':_0x107a8d['id']}})['then'](function(){db[_0x8c39('0x82')][_0x8c39('0x22')]({'raw':!![],'attributes':['id',_0x8c39('0x83')]})[_0x8c39('0x17')](function(_0x2b5296){var _0x425050=[];for(var _0x5149e1=0x0;_0x5149e1<_0x107a8d[_0x8c39('0x84')][_0x8c39('0x2a')];_0x5149e1++){var _0x546e6a=_0x107a8d[_0x8c39('0x85')]?_[_0x8c39('0x51')](_0x107a8d[_0x8c39('0x85')][_0x5149e1])?'':_0x107a8d[_0x8c39('0x85')][_0x5149e1]:_0x107a8d[_0x8c39('0x84')][_0x5149e1][_0x8c39('0x86')]?_0x107a8d['items'][_0x5149e1][_0x8c39('0x86')]:'';var _0x26c9a4=_[_0x8c39('0x51')](_0x107a8d[_0x8c39('0x84')][_0x5149e1]['description'])?'':_0x107a8d[_0x8c39('0x84')][_0x5149e1]['description'];var _0x3ead9f=_0x546e6a+':'+_0x107a8d[_0x8c39('0x84')][_0x5149e1][_0x8c39('0x71')]+'§'+_0x26c9a4;if(_[_0x8c39('0x51')](_0x55af65))_0x55af65=_0x3ead9f;else _0x55af65+=';'+_0x3ead9f;var _0x4e1a0a=null;var _0x10fe17=null;if(_0x107a8d['item_types']){if(!_[_0x8c39('0x51')](_0x107a8d['item_types'][_0x5149e1])){_0x10fe17=_[_0x8c39('0x26')](_0x2b5296,function(_0x4b1d59){return _0x4b1d59['id']===_0x107a8d[_0x8c39('0x85')][_0x5149e1];});if(!_['isNil'](_0x10fe17)){_0x4e1a0a=_0x10fe17[_0x8c39('0x83')];}}}else{if(!_[_0x8c39('0x51')](_0x107a8d['items'][_0x5149e1])){_0x10fe17=_['find'](_0x2b5296,function(_0x477763){return _0x477763['id']===_0x107a8d['items'][_0x5149e1][_0x8c39('0x86')];});if(!_[_0x8c39('0x51')](_0x10fe17)){_0x4e1a0a=_0x5149e1;}}}if(_[_0x8c39('0x51')](_0x4e1a0a)){_0x4e1a0a=0x64;}_0x425050[_0x8c39('0x5b')](addAdditionalPhone(_0x107a8d['id'],_0x107a8d['items'][_0x5149e1]['phone'],_0x107a8d[_0x8c39('0x85')]?_['isNil'](_0x107a8d[_0x8c39('0x85')][_0x5149e1])?null:_0x107a8d['item_types'][_0x5149e1]:_0x107a8d['items'][_0x5149e1]['ItemTypeId']?_0x107a8d[_0x8c39('0x84')][_0x5149e1][_0x8c39('0x86')]:null,_0x4e1a0a,_0x26c9a4));}Promise[_0x8c39('0x5d')](_0x425050)['then'](function(){db[_0x8c39('0x25')][_0x8c39('0x16')]({'AdditionalPhones':_0x55af65},{'where':{'id':_0x107a8d['id']}})[_0x8c39('0x17')](function(){_0x37a230(0x1);});});});});});}function addAdditionalPhone(_0x3bfd3c,_0x57d21e,_0x215e52,_0x31ab35,_0x32057d){return db[_0x8c39('0x45')][_0x8c39('0x26')]({'where':{'CmContactId':_0x3bfd3c,'item':_0x57d21e}})[_0x8c39('0x17')](function(_0x2b3ea2){if(_0x2b3ea2)logger['info']('contact\x20phone\x20exists',_0x2b3ea2);else{db[_0x8c39('0x45')][_0x8c39('0x50')]({'CmContactId':_0x3bfd3c,'item':_0x57d21e,'ItemTypeId':_0x215e52,'OrderBy':_0x31ab35,'ItemClass':'PHONE','description':_0x32057d});}});}function deleteCmHopperPhones(_0x5fb54e){return new Promise(function(_0x29fe11){return db[_0x8c39('0x70')][_0x8c39('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5fb54e}})[_0x8c39('0x17')](function(_0x1d2b44){db[_0x8c39('0x87')][_0x8c39('0x18')]({'where':{'CmHopperId':{'$in':_[_0x8c39('0x66')](_0x1d2b44,'id')}}});})[_0x8c39('0x17')](function(){_0x29fe11(0x1);});});}function addCmHopperPhones(_0x24476a){return new Promise(function(_0x1b4639){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x24476a}})[_0x8c39('0x17')](function(_0x3093d6){var _0x232759=[];_['map'](_0x3093d6,function(_0x1f94ff){_0x232759[_0x8c39('0x5b')](createCmHopperPhone(_0x24476a,_0x1f94ff['id']));});Promise['all'](_0x232759)[_0x8c39('0x17')](function(){_0x1b4639(0x1);});});});}function createCmHopperPhone(_0x53b456,_0x27fc2b){return new Promise(function(_0x38a38e){db['CmContactHasItem'][_0x8c39('0x22')]({'raw':!![],'attributes':[_0x8c39('0x88'),_0x8c39('0x83')],'where':{'CmContactId':_0x53b456,'ItemClass':_0x8c39('0x89')},'include':[{'model':db[_0x8c39('0x82')],'attributes':[_0x8c39('0x83')],'as':_0x8c39('0x8a')}],'order':[_0x8c39('0x83'),db[_0x8c39('0x6d')][_0x8c39('0x8b')](_0x8c39('0x8c'))]})[_0x8c39('0x17')](function(_0x2db10f){var _0x1496cf=0x1;var _0x2985fb=_['map'](_0x2db10f,function(_0x2f569d){_0x2f569d['CmHopperId']=_0x27fc2b;_0x2f569d[_0x8c39('0x71')]=_0x2f569d[_0x8c39('0x88')];_0x2f569d['OrderBy']=_0x1496cf;delete _0x2f569d[_0x8c39('0x8d')];_0x1496cf=_0x1496cf+0x1;return _0x2f569d;});return db[_0x8c39('0x87')][_0x8c39('0x56')](_0x2985fb,{});})[_0x8c39('0x17')](function(){_0x38a38e(0x1);});});}function insertAdditionalPhones(_0x131851,_0x10b070){return new Promise(function(_0x12fd49){var _0x5d21ab=[];for(var _0x2b8814=0x0;_0x2b8814<_0x10b070[_0x8c39('0x2a')];_0x2b8814++){var _0x31abf3=_0x10b070[_0x2b8814];_0x5d21ab['push'](parseContactItemType(_0x31abf3));}Promise[_0x8c39('0x5d')](_0x5d21ab)['then'](function(){var _0x5c6916={'id':_0x131851['id'],'items':_0x10b070};return addAdditionalPhones(_0x5c6916)[_0x8c39('0x17')](function(){return addCmHopperPhones(_0x131851['id']);});})['then'](function(){_0x12fd49(_0x131851);});});}function parseContactItemType(_0x512dc8){return new Promise(function(_0x411f8a){if(_0x512dc8[_0x8c39('0x34')](_0x8c39('0x86'))){_0x411f8a(_0x512dc8);}else{return db['ContactItemType']['find']({'where':{'name':_0x512dc8[_0x8c39('0x8a')]}})[_0x8c39('0x17')](function(_0xae7560){if(_[_0x8c39('0x51')](_0xae7560))_0x512dc8[_0x8c39('0x86')]=null;else _0x512dc8[_0x8c39('0x86')]=_0xae7560['id'];_0x411f8a(_0x512dc8);});}});}exports[_0x8c39('0x8e')]=function(_0x4d4e3b,_0x151bb4){return db['CmContactHasItem'][_0x8c39('0x22')]({'raw':!![],'where':{'CmContactId':_0x4d4e3b['params']['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x8c39('0x83')],[db[_0x8c39('0x6d')][_0x8c39('0x8b')]('`ItemType`.OrderBy')]]})[_0x8c39('0x17')](function(_0x1131a8){return _0x1131a8;})[_0x8c39('0x17')](respondWithResult(_0x151bb4,null))[_0x8c39('0x28')](handleError(_0x151bb4,null));};exports['duplicateAdditionalPhones']=function(_0x56938e,_0x2a5967){return db[_0x8c39('0x45')][_0x8c39('0x22')]({'raw':!![],'where':{'CmContactId':_0x56938e['body'][_0x8c39('0x8f')]}})[_0x8c39('0x17')](function(_0x1d0d6f){var _0x36e502=_[_0x8c39('0x66')](_0x1d0d6f,function(_0x54bfec){_0x54bfec['CmContactId']=_0x56938e['body']['toContactId'];return _0x54bfec;});return db['CmContactHasItem'][_0x8c39('0x56')](_0x36e502,{});})[_0x8c39('0x17')](function(){return addCmHopperPhones(_0x56938e['body']['toContactId']);})[_0x8c39('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x2a5967,null))[_0x8c39('0x28')](handleError(_0x2a5967,null));};exports[_0x8c39('0x90')]=function(_0x1bb9cf,_0x2f1efe){var _0x4f9ab7=[];_0x4f9ab7['push'](createCmHopperPhone(_0x1bb9cf['body']['id'],_0x1bb9cf['body'][_0x8c39('0x91')]));Promise['all'](_0x4f9ab7)['then'](function(){return[0x1];})[_0x8c39('0x17')](respondWithResult(_0x2f1efe,null));};exports[_0x8c39('0x92')]=function(_0x41b517,_0x50cda1){var _0x1e7b55={'raw':![],'where':{}};var _0x594d0c={};var _0x2b4ba7={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x41b517['params']['id']}})[_0x8c39('0x17')](handleEntityNotFound(_0x50cda1,null))['then'](function(_0x5af9ac){if(_0x5af9ac){_0x594d0c[_0x8c39('0x74')]=_['keys'](db['CmHopper'][_0x8c39('0x93')]);_0x594d0c[_0x8c39('0x23')]=_[_0x8c39('0x29')](_0x41b517[_0x8c39('0x23')]);_0x594d0c[_0x8c39('0x75')]=_[_0x8c39('0x76')](_0x594d0c[_0x8c39('0x74')],_0x594d0c[_0x8c39('0x23')]);_0x1e7b55[_0x8c39('0x78')]=_[_0x8c39('0x76')](_0x594d0c[_0x8c39('0x74')],qs[_0x8c39('0x77')](_0x41b517[_0x8c39('0x23')][_0x8c39('0x77')]));_0x1e7b55[_0x8c39('0x78')]=_0x1e7b55['attributes'][_0x8c39('0x2a')]?_0x1e7b55['attributes']:_0x594d0c['model'];if(!_0x41b517[_0x8c39('0x23')][_0x8c39('0x34')](_0x8c39('0x7e'))){_0x1e7b55[_0x8c39('0x11')]=qs[_0x8c39('0x11')](_0x41b517[_0x8c39('0x23')][_0x8c39('0x11')]);_0x1e7b55[_0x8c39('0x13')]=qs[_0x8c39('0x13')](_0x41b517[_0x8c39('0x23')][_0x8c39('0x13')]);}_0x1e7b55['order']=qs[_0x8c39('0x7a')](_0x41b517[_0x8c39('0x23')]['sort']);_0x1e7b55[_0x8c39('0x59')]=qs[_0x8c39('0x75')](_[_0x8c39('0x7b')](_0x41b517['query'],_0x594d0c[_0x8c39('0x75')]));_0x1e7b55[_0x8c39('0x59')][_0x8c39('0x94')]=_0x5af9ac['id'];if(_0x41b517[_0x8c39('0x23')][_0x8c39('0x7c')]){_0x1e7b55[_0x8c39('0x59')]=_['merge'](_0x1e7b55[_0x8c39('0x59')],{'$or':_[_0x8c39('0x66')](_0x1e7b55[_0x8c39('0x78')],function(_0x556650){var _0x4c2dba={};_0x4c2dba[_0x556650]={'$like':'%'+_0x41b517[_0x8c39('0x23')][_0x8c39('0x7c')]+'%'};return _0x4c2dba;})});}_0x1e7b55=_[_0x8c39('0x35')]({},_0x1e7b55,_0x41b517['options']);return db[_0x8c39('0x70')][_0x8c39('0x12')]({'where':_0x1e7b55[_0x8c39('0x59')]})[_0x8c39('0x17')](function(_0x485df5){_0x2b4ba7[_0x8c39('0x12')]=_0x485df5;if(_0x41b517['query'][_0x8c39('0x95')]){_0x1e7b55[_0x8c39('0x96')]=[{'all':!![]}];}return db[_0x8c39('0x70')][_0x8c39('0x22')](_0x1e7b55);})[_0x8c39('0x17')](function(_0x219ad8){_0x2b4ba7[_0x8c39('0x97')]=_0x219ad8;return _0x2b4ba7;});}})[_0x8c39('0x17')](respondWithFilteredResult(_0x50cda1,_0x1e7b55))[_0x8c39('0x28')](handleError(_0x50cda1,null));};exports[_0x8c39('0x98')]=function(_0x154130,_0x1e286e){var _0x221098={'raw':!![],'where':{}};var _0x555c1d={};var _0x5af7bd={'count':0x0,'rows':[]};return db['CmContact'][_0x8c39('0x73')]({'where':{'id':_0x154130[_0x8c39('0x27')]['id']}})[_0x8c39('0x17')](handleEntityNotFound(_0x1e286e,null))[_0x8c39('0x17')](function(_0x43d9b2){if(_0x43d9b2){_0x555c1d[_0x8c39('0x74')]=_[_0x8c39('0x29')](db['CmHopperHistory'][_0x8c39('0x93')]);_0x555c1d[_0x8c39('0x23')]=_['keys'](_0x154130[_0x8c39('0x23')]);_0x555c1d[_0x8c39('0x75')]=_[_0x8c39('0x76')](_0x555c1d[_0x8c39('0x74')],_0x555c1d[_0x8c39('0x23')]);_0x221098[_0x8c39('0x78')]=_['intersection'](_0x555c1d[_0x8c39('0x74')],qs[_0x8c39('0x77')](_0x154130[_0x8c39('0x23')]['fields']));_0x221098[_0x8c39('0x78')]=_0x221098[_0x8c39('0x78')][_0x8c39('0x2a')]?_0x221098[_0x8c39('0x78')]:_0x555c1d[_0x8c39('0x74')];if(!_0x154130['query'][_0x8c39('0x34')](_0x8c39('0x7e'))){_0x221098[_0x8c39('0x11')]=qs[_0x8c39('0x11')](_0x154130[_0x8c39('0x23')]['limit']);_0x221098[_0x8c39('0x13')]=qs[_0x8c39('0x13')](_0x154130[_0x8c39('0x23')][_0x8c39('0x13')]);}_0x221098[_0x8c39('0x79')]=qs['sort'](_0x154130[_0x8c39('0x23')][_0x8c39('0x7a')]);_0x221098[_0x8c39('0x59')]=qs[_0x8c39('0x75')](_['pick'](_0x154130[_0x8c39('0x23')],_0x555c1d[_0x8c39('0x75')]));_0x221098['where'][_0x8c39('0x94')]=_0x43d9b2['id'];if(_0x154130[_0x8c39('0x23')]['filter']){_0x221098[_0x8c39('0x59')]=_[_0x8c39('0x35')](_0x221098[_0x8c39('0x59')],{'$or':_[_0x8c39('0x66')](_0x221098[_0x8c39('0x78')],function(_0x5d161b){var _0xaf1d63={};_0xaf1d63[_0x5d161b]={'$like':'%'+_0x154130[_0x8c39('0x23')][_0x8c39('0x7c')]+'%'};return _0xaf1d63;})});}_0x221098=_['merge']({},_0x221098,_0x154130[_0x8c39('0x7d')]);return db[_0x8c39('0x47')][_0x8c39('0x12')]({'where':_0x221098[_0x8c39('0x59')]})['then'](function(_0x511615){_0x5af7bd[_0x8c39('0x12')]=_0x511615;if(_0x154130[_0x8c39('0x23')][_0x8c39('0x95')]){_0x221098[_0x8c39('0x96')]=[{'all':!![]}];}return db[_0x8c39('0x47')][_0x8c39('0x22')](_0x221098);})[_0x8c39('0x17')](function(_0x21ffe0){_0x5af7bd[_0x8c39('0x97')]=_0x21ffe0;return _0x5af7bd;});}})[_0x8c39('0x17')](respondWithFilteredResult(_0x1e286e,_0x221098))[_0x8c39('0x28')](handleError(_0x1e286e,null));};exports[_0x8c39('0x99')]=function(_0x2e6511,_0x46efc0){var _0x28a073={'raw':!![],'where':{}};var _0x2e1760={};var _0x1246af={'count':0x0,'rows':[]};return db[_0x8c39('0x25')]['findOne']({'where':{'id':_0x2e6511[_0x8c39('0x27')]['id']}})['then'](handleEntityNotFound(_0x46efc0,null))[_0x8c39('0x17')](function(_0x33e6cc){if(_0x33e6cc){_0x2e1760[_0x8c39('0x74')]=_[_0x8c39('0x29')](db[_0x8c39('0x46')][_0x8c39('0x93')]);_0x2e1760[_0x8c39('0x23')]=_[_0x8c39('0x29')](_0x2e6511[_0x8c39('0x23')]);_0x2e1760[_0x8c39('0x75')]=_['intersection'](_0x2e1760[_0x8c39('0x74')],_0x2e1760[_0x8c39('0x23')]);_0x28a073['attributes']=_[_0x8c39('0x76')](_0x2e1760[_0x8c39('0x74')],qs['fields'](_0x2e6511[_0x8c39('0x23')][_0x8c39('0x77')]));_0x28a073[_0x8c39('0x78')]=_0x28a073[_0x8c39('0x78')][_0x8c39('0x2a')]?_0x28a073[_0x8c39('0x78')]:_0x2e1760['model'];if(!_0x2e6511['query'][_0x8c39('0x34')](_0x8c39('0x7e'))){_0x28a073['limit']=qs[_0x8c39('0x11')](_0x2e6511[_0x8c39('0x23')][_0x8c39('0x11')]);_0x28a073[_0x8c39('0x13')]=qs[_0x8c39('0x13')](_0x2e6511[_0x8c39('0x23')][_0x8c39('0x13')]);}_0x28a073[_0x8c39('0x79')]=qs['sort'](_0x2e6511[_0x8c39('0x23')][_0x8c39('0x7a')]);_0x28a073['where']=qs[_0x8c39('0x75')](_[_0x8c39('0x7b')](_0x2e6511[_0x8c39('0x23')],_0x2e1760[_0x8c39('0x75')]));_0x28a073['where'][_0x8c39('0x94')]=_0x33e6cc['id'];if(_0x2e6511[_0x8c39('0x23')][_0x8c39('0x7c')]){_0x28a073['where']=_['merge'](_0x28a073['where'],{'$or':_[_0x8c39('0x66')](_0x28a073[_0x8c39('0x78')],function(_0x31f4dd){var _0x1dbf1c={};_0x1dbf1c[_0x31f4dd]={'$like':'%'+_0x2e6511[_0x8c39('0x23')][_0x8c39('0x7c')]+'%'};return _0x1dbf1c;})});}_0x28a073=_['merge']({},_0x28a073,_0x2e6511[_0x8c39('0x7d')]);return db[_0x8c39('0x46')][_0x8c39('0x12')]({'where':_0x28a073[_0x8c39('0x59')]})[_0x8c39('0x17')](function(_0x4cfe76){_0x1246af[_0x8c39('0x12')]=_0x4cfe76;if(_0x2e6511[_0x8c39('0x23')][_0x8c39('0x95')]){_0x28a073[_0x8c39('0x96')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x8c39('0x22')](_0x28a073);})[_0x8c39('0x17')](function(_0x2a03ec){_0x1246af[_0x8c39('0x97')]=_0x2a03ec;return _0x1246af;});}})['then'](respondWithFilteredResult(_0x46efc0,_0x28a073))[_0x8c39('0x28')](handleError(_0x46efc0,null));};exports[_0x8c39('0x9a')]=function(_0x348d57,_0x636d7a){var _0x5299={'raw':!![],'where':{}};var _0x24e9f5={};var _0x5a6d6c={'count':0x0,'rows':[]};return db[_0x8c39('0x25')]['findOne']({'where':{'id':_0x348d57[_0x8c39('0x27')]['id']}})[_0x8c39('0x17')](handleEntityNotFound(_0x636d7a,null))[_0x8c39('0x17')](function(_0x3cb798){if(_0x3cb798){_0x24e9f5[_0x8c39('0x74')]=_[_0x8c39('0x29')](db[_0x8c39('0x4e')][_0x8c39('0x93')]);_0x24e9f5['query']=_[_0x8c39('0x29')](_0x348d57['query']);_0x24e9f5[_0x8c39('0x75')]=_['intersection'](_0x24e9f5[_0x8c39('0x74')],_0x24e9f5[_0x8c39('0x23')]);_0x5299[_0x8c39('0x78')]=_[_0x8c39('0x76')](_0x24e9f5[_0x8c39('0x74')],qs['fields'](_0x348d57[_0x8c39('0x23')]['fields']));_0x5299[_0x8c39('0x78')]=_0x5299[_0x8c39('0x78')][_0x8c39('0x2a')]?_0x5299[_0x8c39('0x78')]:_0x24e9f5[_0x8c39('0x74')];if(!_0x348d57['query']['hasOwnProperty'](_0x8c39('0x7e'))){_0x5299[_0x8c39('0x11')]=qs[_0x8c39('0x11')](_0x348d57[_0x8c39('0x23')][_0x8c39('0x11')]);_0x5299[_0x8c39('0x13')]=qs['offset'](_0x348d57['query']['offset']);}_0x5299[_0x8c39('0x79')]=qs[_0x8c39('0x7a')](_0x348d57[_0x8c39('0x23')][_0x8c39('0x7a')]);_0x5299[_0x8c39('0x59')]=qs['filters'](_['pick'](_0x348d57[_0x8c39('0x23')],_0x24e9f5[_0x8c39('0x75')]));_0x5299['where'][_0x8c39('0x94')]=_0x3cb798['id'];if(_0x348d57[_0x8c39('0x23')][_0x8c39('0x7c')]){_0x5299[_0x8c39('0x59')]=_[_0x8c39('0x35')](_0x5299[_0x8c39('0x59')],{'$or':_[_0x8c39('0x66')](_0x5299['attributes'],function(_0x18514f){var _0x399dde={};_0x399dde[_0x18514f]={'$like':'%'+_0x348d57[_0x8c39('0x23')][_0x8c39('0x7c')]+'%'};return _0x399dde;})});}_0x5299=_[_0x8c39('0x35')]({},_0x5299,_0x348d57['options']);return db[_0x8c39('0x4e')][_0x8c39('0x12')]({'where':_0x5299['where']})[_0x8c39('0x17')](function(_0x478c86){_0x5a6d6c[_0x8c39('0x12')]=_0x478c86;if(_0x348d57['query'][_0x8c39('0x95')]){_0x5299[_0x8c39('0x96')]=[{'all':!![]}];}return db[_0x8c39('0x4e')][_0x8c39('0x22')](_0x5299);})['then'](function(_0x125c0f){_0x5a6d6c[_0x8c39('0x97')]=_0x125c0f;return _0x5a6d6c;});}})[_0x8c39('0x17')](respondWithFilteredResult(_0x636d7a,_0x5299))['catch'](handleError(_0x636d7a,null));};exports['uploadCsv']=function(_0x494a5e,_0x756bcf){try{if(!_0x494a5e[_0x8c39('0x36')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x494a5e[_0x8c39('0x36')][_0x8c39('0x9b')]){throw new Error(_0x8c39('0x9c'));}if(!_0x494a5e[_0x8c39('0x36')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x494a5e['body'][_0x8c39('0x9d')]){throw new Error(_0x8c39('0x9e'));}var _0x26f744=_0x494a5e[_0x8c39('0x36')][_0x8c39('0x9b')][_0x8c39('0x9f')](',');var _0x3603d8=_0x494a5e[_0x8c39('0x36')][_0x8c39('0xa0')][_0x8c39('0x9f')](',');if(!_0x26f744[_0x8c39('0x2a')]||!_0x3603d8[_0x8c39('0x2a')]||_0x26f744['length']!==_0x3603d8[_0x8c39('0x2a')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x494a5e[_0x8c39('0x36')][_0x8c39('0x77')]=_['zipObject'](_0x26f744,_0x3603d8);if(!_0x494a5e[_0x8c39('0x36')][_0x8c39('0x77')][_0x8c39('0x71')]){throw new Error(_0x8c39('0xa1'));}if(!_0x494a5e[_0x8c39('0x36')][_0x8c39('0x77')][_0x8c39('0xa2')]){throw new Error(_0x8c39('0xa3'));}var _0xca95b4=path['join'](config[_0x8c39('0xa4')],'server/files/tmp',_0x494a5e[_0x8c39('0xa5')][_0x8c39('0xa6')]);fs['chmodSync'](_0xca95b4,parseInt(_0x8c39('0xa7'),0x8));var _0x5a0861=require('child_process')[_0x8c39('0xa8')](path[_0x8c39('0x3c')](__dirname,_0x8c39('0xa9')),[_0xca95b4,_0x494a5e[_0x8c39('0x36')][_0x8c39('0x9b')],_0x494a5e[_0x8c39('0x36')][_0x8c39('0xa0')],_0x494a5e[_0x8c39('0x36')][_0x8c39('0x62')],_0x494a5e[_0x8c39('0x36')]['CompanyId'],_0x494a5e[_0x8c39('0x36')][_0x8c39('0x58')],_0x494a5e[_0x8c39('0x36')]['socket_timestamp']]);return _0x756bcf[_0x8c39('0x19')](0xc8)[_0x8c39('0xf')]({'message':_0x8c39('0xaa'),'pid':_0x5a0861[_0x8c39('0xab')]});}catch(_0x25be5f){return _0x756bcf[_0x8c39('0x19')](0x1f4)[_0x8c39('0x1e')](_0x25be5f);}};exports[_0x8c39('0xac')]=function(_0x71141e,_0x71db4e){var _0x343b04=fs[_0x8c39('0xad')](_0x71141e[_0x8c39('0xa5')][_0x8c39('0x2')]);Papa[_0x8c39('0xae')](_0x343b04,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x34ac8d){return _0x71db4e[_0x8c39('0x19')](0xc8)[_0x8c39('0xf')]({'file':_0x71141e[_0x8c39('0xa5')],'fields':_0x34ac8d[_0x8c39('0xaf')][_0x8c39('0x77')]});}});};exports[_0x8c39('0xb0')]=function(_0x2a0e15,_0x561c97){return db[_0x8c39('0xb1')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x8c39('0xb2')}})[_0x8c39('0x17')](function(_0x488516){var _0x1d3f71=![];if(!_0x2a0e15[_0x8c39('0x36')][_0x8c39('0x62')]){throw new Error(_0x8c39('0xb3'));}if(!_0x2a0e15[_0x8c39('0x36')][_0x8c39('0xb4')][_0x8c39('0x71')]){throw new Error(_0x8c39('0xa1'));}if(!_0x2a0e15[_0x8c39('0x36')][_0x8c39('0xb4')][_0x8c39('0xa2')]){throw new Error(_0x8c39('0xa3'));}if(!_0x2a0e15['body'][_0x8c39('0x9d')]){throw new Error(_0x8c39('0x9e'));}var _0x5e037d=require(_0x8c39('0xb5'))[_0x8c39('0xa8')](path[_0x8c39('0x3c')](__dirname,'../../components/import/cm/csv2'),[_0x2a0e15[_0x8c39('0x27')]['id'],JSON[_0x8c39('0xb6')](_0x2a0e15[_0x8c39('0x36')]),JSON[_0x8c39('0xb6')](_0x488516)]);_0x5e037d['on'](_0x8c39('0xb7'),function(){_0x1d3f71=!![];return _0x561c97[_0x8c39('0x19')](0xc8)[_0x8c39('0xf')]({'message':_0x8c39('0xb8'),'pid':_0x5e037d[_0x8c39('0xab')]});});_0x5e037d['on'](_0x8c39('0xb9'),function(_0x29c46c){if(_0x29c46c&&!_0x1d3f71){return _0x561c97[_0x8c39('0x19')](0x1f4)[_0x8c39('0xf')]({'message':_0x8c39('0xba'),'pid':_0x5e037d[_0x8c39('0xab')]});}});})[_0x8c39('0x28')](handleError(_0x561c97,null));};exports[_0x8c39('0xbb')]=function(_0x47f07b,_0x3dca11){return db[_0x8c39('0xb1')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x8c39('0xb2')}})[_0x8c39('0x17')](function(_0x571407){var _0x355fd6=![];if(!_0x47f07b[_0x8c39('0x36')][_0x8c39('0x62')]){throw new Error(_0x8c39('0xb3'));}if(!_0x47f07b[_0x8c39('0x36')][_0x8c39('0xb4')][_0x8c39('0x71')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x47f07b['body'][_0x8c39('0xb4')][_0x8c39('0xa2')]){throw new Error(_0x8c39('0xa3'));}if(!_0x47f07b[_0x8c39('0x36')][_0x8c39('0x9d')]){throw new Error(_0x8c39('0x9e'));}var _0x326f3b=require(_0x8c39('0xb5'))[_0x8c39('0xa8')](path[_0x8c39('0x3c')](__dirname,_0x8c39('0xbc')),[_0x47f07b[_0x8c39('0x27')]['id'],JSON[_0x8c39('0xb6')](_0x47f07b[_0x8c39('0x36')]),JSON[_0x8c39('0xb6')](_0x571407)]);_0x326f3b['on'](_0x8c39('0xb7'),function(){_0x355fd6=!![];return _0x3dca11[_0x8c39('0x19')](0xc8)['json']({'message':_0x8c39('0xb8'),'pid':_0x326f3b[_0x8c39('0xab')]});});_0x326f3b['on'](_0x8c39('0xb9'),function(_0x2df0db){if(_0x2df0db&&!_0x355fd6){return _0x3dca11[_0x8c39('0x19')](0x1f4)[_0x8c39('0xf')]({'message':_0x8c39('0xba'),'pid':_0x326f3b[_0x8c39('0xab')]});}});})[_0x8c39('0x28')](handleError(_0x3dca11,null));};exports['getJourney']=function(_0x44878f,_0xe92da9){var _0x541877=[_0x8c39('0xbd'),_0x8c39('0xbe'),_0x8c39('0xbf'),_0x8c39('0xc0'),'fax',_0x8c39('0xc1'),_0x8c39('0xc2')];var _0x219437={'offset':0x0,'order':qs[_0x8c39('0x7a')]('-createdAt')},_0x3a09f0={'count':0x0,'rows':[]};Promise[_0x8c39('0xc3')]()[_0x8c39('0x17')](function(){if(_0x44878f['query'][_0x8c39('0xc4')]){if(!_[_0x8c39('0xc5')](_0x541877,_0x44878f[_0x8c39('0x23')][_0x8c39('0xc4')]['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x541877=[_0x44878f[_0x8c39('0x23')]['channel']['toLowerCase']()];}if(_0x44878f[_0x8c39('0x23')][_0x8c39('0xc6')]){try{var _0x5dbe80=JSON[_0x8c39('0xae')](_0x44878f[_0x8c39('0x23')][_0x8c39('0xc6')]);if(!moment(_0x5dbe80['from'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x5dbe80['to'])['isValid']()){throw new Error(_0x8c39('0xc7'));}}catch(_0x554efc){throw new Error(_0x8c39('0xc8'));}}if(!_0x44878f[_0x8c39('0x23')][_0x8c39('0x34')](_0x8c39('0x7e'))){_0x219437[_0x8c39('0x11')]=qs[_0x8c39('0x11')](_0x44878f[_0x8c39('0x23')][_0x8c39('0x11')]||0xa);_0x219437['offset']=qs[_0x8c39('0x13')](_0x44878f[_0x8c39('0x23')][_0x8c39('0x13')]);}var _0x146b1e=_0x541877[_0x8c39('0x66')](function(_0x42817c){if(_0x42817c===_0x8c39('0xc2')){var _0x178884={'attributes':['id',_0x8c39('0xc9'),_0x8c39('0xca'),_0x8c39('0xcb'),'destination',_0x8c39('0xcc'),'starttime',_0x8c39('0xcd'),_0x8c39('0xce'),_0x8c39('0xcf'),_0x8c39('0xd0'),_0x8c39('0xd1'),_0x8c39('0xd2'),'userThirdDisposition',_0x8c39('0xd3')],'where':{'ContactId':_0x44878f[_0x8c39('0x27')]['id']},'include':[{'model':db['User'],'as':_0x8c39('0xb1'),'attributes':['id',_0x8c39('0x1d'),'fullname','alias']}],'order':[[_0x8c39('0xd0'),_0x8c39('0xd4')]]};if(_0x44878f[_0x8c39('0x23')][_0x8c39('0xc6')]){_0x178884[_0x8c39('0x59')][_0x8c39('0xd0')]={'$gte':_0x5dbe80['from'],'$lte':_0x5dbe80['to']};}return db['VoiceCallReport'][_0x8c39('0xd5')](_0x178884)['then'](function(_0x49ae7b){_0x3a09f0[_0x8c39('0x12')]+=_0x49ae7b[_0x8c39('0x12')];return _[_0x8c39('0x66')](_0x49ae7b[_0x8c39('0x97')],function(_0x56d3a0){var _0x16ea38=_0x56d3a0['get']({'plain':!![]});_0x16ea38[_0x8c39('0xc4')]=_0x42817c;if(_0x16ea38['User']){_0x16ea38[_0x8c39('0xb1')]={'id':_0x16ea38['User']['id'],'name':_0x16ea38[_0x8c39('0xb1')][_0x8c39('0x1d')],'fullname':_0x16ea38['User']['fullname'],'alias':_0x16ea38[_0x8c39('0xb1')][_0x8c39('0x30')]};}return _0x16ea38;});});}else{var _0x24900a=_['startCase'](_0x42817c)+(_0x42817c==='chat'?_0x8c39('0xd6'):_0x8c39('0xd7'));var _0x51189c={'attributes':['id',_0x8c39('0xd8'),_0x8c39('0xd9'),_0x8c39('0xd0'),_0x8c39('0xcf'),_0x8c39('0xda'),_0x8c39('0xdb'),_0x8c39('0xdc'),_0x8c39('0xd3'),_0x24900a+'Id'],'where':{'ContactId':_0x44878f[_0x8c39('0x27')]['id']},'include':[{'model':db[_0x24900a],'as':'Account','attributes':['id',_0x8c39('0x1d'),_0x8c39('0xdd')]},{'model':db[_0x8c39('0xb1')],'as':_0x8c39('0xde'),'attributes':['id',_0x8c39('0x1d'),_0x8c39('0xdf')]},{'model':db[_0x8c39('0x5f')],'as':_0x8c39('0x60'),'attributes':['id',_0x8c39('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0x8c39('0xd0'),_0x8c39('0xd4')]]};if(_0x44878f[_0x8c39('0x23')][_0x8c39('0xc6')]){_0x51189c[_0x8c39('0x59')][_0x8c39('0xd0')]={'$gte':_0x5dbe80['from'],'$lte':_0x5dbe80['to']};}switch(_0x42817c){case _0x8c39('0xbe'):_0x51189c['attributes']['push']('browserName',_0x8c39('0xe0'),'customerPort',_0x8c39('0xe1'),_0x8c39('0xe2'),_0x8c39('0xe3'),_0x8c39('0xe4'),'ratingValue',_0x8c39('0xe5'));break;case _0x8c39('0xbd'):_0x51189c[_0x8c39('0x78')]['push'](_0x8c39('0xe6'),_0x8c39('0xe7'));break;case'openchannel':_0x51189c['attributes']['push'](_0x8c39('0xe8'),_0x8c39('0xe9'));break;}return db[_[_0x8c39('0xea')](_0x42817c)+'Interaction'][_0x8c39('0xd5')](_0x51189c)[_0x8c39('0x17')](function(_0xa1352e){_0x3a09f0['count']+=_0xa1352e[_0x8c39('0x12')];return _[_0x8c39('0x66')](_0xa1352e[_0x8c39('0x97')],function(_0x36ccb2){var _0x455b37=_0x36ccb2[_0x8c39('0x38')]({'plain':!![]});_0x455b37['channel']=_0x42817c;if(_0x455b37[_0x8c39('0xde')]){_0x455b37[_0x8c39('0xde')]={'id':_0x455b37[_0x8c39('0xde')]['id'],'name':_0x455b37['Owner'][_0x8c39('0x1d')],'fullname':_0x455b37[_0x8c39('0xde')][_0x8c39('0xdf')]};}return _0x455b37;});});}});return Promise[_0x8c39('0x5d')](_0x146b1e);})[_0x8c39('0x17')](function(_0x23f40c){return _(_0x23f40c)[_0x8c39('0xeb')]()[_0x8c39('0xec')](_0x8c39('0xd0'))[_0x8c39('0xed')]()[_0x8c39('0xee')]();})['then'](function(_0x18640d){_0x3a09f0[_0x8c39('0x97')]=_0x219437[_0x8c39('0x11')]?_0x18640d['slice'](_0x219437[_0x8c39('0x13')],_0x219437[_0x8c39('0x13')]+_0x219437[_0x8c39('0x11')]):_0x18640d;return _0x3a09f0;})[_0x8c39('0x17')](respondWithFilteredResult(_0xe92da9,_0x219437))['catch'](handleError(_0xe92da9,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 3bfd927..20158a0 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 _0x8bbb=['update','emit','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x4017f3,_0x541a84){var _0x71c599=function(_0x258c9c){while(--_0x258c9c){_0x4017f3['push'](_0x4017f3['shift']());}};_0x71c599(++_0x541a84);}(_0x8bbb,0x18e));var _0xb8bb=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8bbb[_0x5c351c];return _0x26f3b3;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xb8bb('0x0'))['db'][_0xb8bb('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb8bb('0x2')](0x0);var events={'afterCreate':_0xb8bb('0x3'),'afterUpdate':_0xb8bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x34f629){return function(_0x1f43b7,_0x4b706b,_0x33e21){CmContactEvents['emit'](_0x34f629+':'+_0x1f43b7['id'],_0x1f43b7);CmContactEvents[_0xb8bb('0x5')](_0x34f629,_0x1f43b7);_0x33e21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x0b92=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','emit'];(function(_0x17ff83,_0x32f010){var _0x55ef2d=function(_0x504b94){while(--_0x504b94){_0x17ff83['push'](_0x17ff83['shift']());}};_0x55ef2d(++_0x32f010);}(_0x0b92,0xae));var _0x20b9=function(_0x565c22,_0x141520){_0x565c22=_0x565c22-0x0;var _0x5a71a0=_0x0b92[_0x565c22];return _0x5a71a0;};'use strict';var EventEmitter=require(_0x20b9('0x0'));var CmContact=require(_0x20b9('0x1'))['db'][_0x20b9('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x20b9('0x3')](0x0);var events={'afterCreate':_0x20b9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f37fc){return function(_0xf27840,_0x1a64c0,_0x3e6cca){CmContactEvents[_0x20b9('0x5')](_0x4f37fc+':'+_0xf27840['id'],_0xf27840);CmContactEvents[_0x20b9('0x5')](_0x4f37fc,_0xf27840);_0x3e6cca(null);};}for(var e in events){if(events[_0x20b9('0x6')](e)){var event=events[e];CmContact[_0x20b9('0x7')](e,emitEvent(event));}}module[_0x20b9('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 45f7c62..9b199c1 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 _0x9f3b=['ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','firstName','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\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','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','always','onlyIfOpen','BlackLists','message','Lists','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9f3b,0xa0));var _0xb9f3=function(_0x5e745e,_0xde2931){_0x5e745e=_0x5e745e-0x0;var _0x122dab=_0x9f3b[_0x5e745e];return _0x122dab;};'use strict';var _=require(_0xb9f3('0x0'));var util=require(_0xb9f3('0x1'));var logger=require(_0xb9f3('0x2'))(_0xb9f3('0x3'));var moment=require(_0xb9f3('0x4'));var BPromise=require(_0xb9f3('0x5'));var rp=require(_0xb9f3('0x6'));var fs=require('fs');var path=require(_0xb9f3('0x7'));var rimraf=require(_0xb9f3('0x8'));var config=require(_0xb9f3('0x9'));var shared=require(_0xb9f3('0xa'));var attributes=require(_0xb9f3('0xb'));module[_0xb9f3('0xc')]=function(_0x382ca4,_0x4bd81e){return _0x382ca4['define'](_0xb9f3('0xd'),attributes,{'tableName':_0xb9f3('0xe'),'paranoid':!![],'indexes':[{'name':_0xb9f3('0xf'),'fields':[_0xb9f3('0xf')]},{'name':'fti_cm_contacts','fields':[_0xb9f3('0x10'),'lastName',_0xb9f3('0xf'),'mobile',_0xb9f3('0x11'),_0xb9f3('0x12')],'type':_0xb9f3('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xb9f3('0x14'),'hooks':{'afterCreate':function(_0x499015,_0x389022,_0x11bd87){var _0x43245c=_0x382ca4[_0xb9f3('0x15')];var _0x5dc3a5=_0x499015[_0xb9f3('0x16')]({'plain':!![]});function _0x517923(){return function(_0x1f06cf){logger[_0xb9f3('0x17')]('cmContact',_0xb9f3('0x18'),util[_0xb9f3('0x19')](_0x1f06cf,{'showHidden':![],'depth':null}));};}function _0x46b6d1(_0x465f56,_0x6c90f2){var _0x16a65a=_0x6c90f2[_0xb9f3('0x1a')]?_0x6c90f2['scheduledat']:moment()[_0xb9f3('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x9eb64,_0x531fa9){if(_[_0xb9f3('0x1c')](_0x6c90f2[_0xb9f3('0x1d')])){_0x9eb64({'ret':_0x16a65a});}else{_0x43245c[_0xb9f3('0x1e')]['findOne']({'where':{'id':_0x465f56['id']}})[_0xb9f3('0x1f')](function(_0x1fccfe){if(!_[_0xb9f3('0x1c')](_0x1fccfe)){var _0x633d79=_0x1fccfe[_0xb9f3('0x1d')];if(!_[_0xb9f3('0x1c')](_0x633d79)){var _0x212716=shared[_0xb9f3('0x20')];var _0x2462ad=_0x212716[_0x633d79];var _0x437e3e=_0x212716[_0x6c90f2[_0xb9f3('0x1d')]];if(!_[_0xb9f3('0x1c')](_0x2462ad)&&!_[_0xb9f3('0x1c')](_0x437e3e)){var _0x2cda21=_0x2462ad[_0xb9f3('0x21')]-_0x437e3e['utcOffset'];_0x16a65a=_0x6c90f2[_0xb9f3('0x1a')]?_0x6c90f2['scheduledat']:moment();var _0x3f18e3=moment(_0x16a65a)[_0xb9f3('0x22')](_0x2cda21,_0xb9f3('0x23'));_0x9eb64({'ret':_0x3f18e3[_0xb9f3('0x1b')](_0xb9f3('0x24'))});}else _0x9eb64({'ret':_0x16a65a});}else _0x9eb64({'ret':_0x16a65a});}else{_0x9eb64({'ret':_0x16a65a});}});}});return 0xa;}var _0x2cb524=function(_0xf43d43){return new BPromise(function(_0x377ebe,_0x386c15){_0x46b6d1(_0xf43d43,_0x5dc3a5)[_0xb9f3('0x1f')](function(_0x526ac1){_0x5dc3a5[_0xb9f3('0x1a')]=_0x526ac1[_0xb9f3('0x25')];_0x43245c[_0xb9f3('0x26')]['findOne']({'where':{'phone':_0x5dc3a5[_0xb9f3('0xf')],'VoiceQueueId':_0xf43d43['id']}})['then'](function(_0x3032c0){if(!_[_0xb9f3('0x1c')](_0x3032c0)){throw new Error(_0xb9f3('0x27')+_0x5dc3a5['phone']+_0xb9f3('0x28')+_0xf43d43['id']);}return _0x43245c['CmHopper'][_0xb9f3('0x29')]({'phone':_0x5dc3a5[_0xb9f3('0xf')],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'priority':_0x5dc3a5[_0xb9f3('0x2b')]?_0x5dc3a5[_0xb9f3('0x2b')]:0x2,'scheduledat':_0x5dc3a5[_0xb9f3('0x1a')]?_0x5dc3a5[_0xb9f3('0x1a')]:moment()['format'](_0xb9f3('0x24')),'callback':_0x5dc3a5[_0xb9f3('0x2c')]?!![]:![],'callbackuniqueid':_0x5dc3a5[_0xb9f3('0x2c')]?_0x5dc3a5['callbackUniqueid']:undefined,'callbackat':_0x5dc3a5[_0xb9f3('0x2c')]?moment()[_0xb9f3('0x1b')](_0xb9f3('0x24')):undefined,'VoiceQueueId':_0xf43d43['id']});})[_0xb9f3('0x2d')](function(_0x12d3f7){_0x386c15(_0x12d3f7);});});});};var _0x2176c9=function(_0x1294a9){return new BPromise(function(_0x4fee05,_0x477f49){_0x46b6d1(_0x1294a9,_0x5dc3a5)[_0xb9f3('0x1f')](function(_0x2703ec){_0x5dc3a5[_0xb9f3('0x1a')]=_0x2703ec[_0xb9f3('0x25')];_0x43245c[_0xb9f3('0x26')][_0xb9f3('0x2e')]({'where':{'phone':_0x5dc3a5['phone'],'VoiceQueueId':_0x1294a9['id']}})['then'](function(_0x36d89d){if(!_[_0xb9f3('0x1c')](_0x36d89d)){throw new Error(_0xb9f3('0x27')+_0x5dc3a5['phone']+_0xb9f3('0x2f')+_0x1294a9['id']);}return _0x43245c[_0xb9f3('0x30')]['findOne']({'where':{'calleridnum':_0x5dc3a5[_0xb9f3('0xf')],'VoiceQueueId':_0x1294a9['id']}});})[_0xb9f3('0x1f')](function(_0x565746){if(!_[_0xb9f3('0x1c')](_0x565746)){throw new Error(_0xb9f3('0x31')+_0x5dc3a5[_0xb9f3('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x1294a9['id']);}return _0x43245c[_0xb9f3('0x26')]['create']({'phone':_0x5dc3a5[_0xb9f3('0xf')],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'priority':_0x5dc3a5['priority']?_0x5dc3a5[_0xb9f3('0x2b')]:0x2,'scheduledat':_0x5dc3a5[_0xb9f3('0x1a')]?_0x5dc3a5['scheduledat']:moment()[_0xb9f3('0x1b')](_0xb9f3('0x24')),'callback':_0x5dc3a5[_0xb9f3('0x2c')]?!![]:![],'callbackuniqueid':_0x5dc3a5[_0xb9f3('0x2c')]?_0x5dc3a5[_0xb9f3('0x2c')]:undefined,'callbackat':_0x5dc3a5['callbackUniqueid']?moment()['format'](_0xb9f3('0x24')):undefined,'VoiceQueueId':_0x1294a9['id']});})[_0xb9f3('0x2d')](function(_0x469f56){_0x477f49(_0x469f56);});});});};function _0x19330a(){return function(_0x55c0b5){logger[_0xb9f3('0x17')]('cmContact',_0xb9f3('0x18'),util[_0xb9f3('0x19')](_0x55c0b5,{'showHidden':![],'depth':null}));};}function _0x59c96c(_0x2c993,_0x3e30b0){var _0xbdfa08=_0x3e30b0['scheduledat']?_0x3e30b0[_0xb9f3('0x1a')]:moment()['format'](_0xb9f3('0x24'));return new BPromise(function(_0x9d8aec,_0x3db7c4){if(_[_0xb9f3('0x1c')](_0x3e30b0[_0xb9f3('0x1d')])){_0x9d8aec({'ret':_0xbdfa08});}else{_0x43245c[_0xb9f3('0x32')][_0xb9f3('0x2e')]({'where':{'id':_0x2c993['id']}})[_0xb9f3('0x1f')](function(_0x42e418){if(!_[_0xb9f3('0x1c')](_0x42e418)){var _0x3d8bd5=_0x42e418[_0xb9f3('0x1d')];if(!_['isNil'](_0x3d8bd5)){var _0xff1854=shared[_0xb9f3('0x20')];var _0x1ff644=_0xff1854[_0x3d8bd5];var _0x3ba6c5=_0xff1854[_0x3e30b0[_0xb9f3('0x1d')]];if(!_['isNil'](_0x1ff644)&&!_[_0xb9f3('0x1c')](_0x3ba6c5)){var _0x38dbff=_0x1ff644[_0xb9f3('0x21')]-_0x3ba6c5[_0xb9f3('0x21')];_0xbdfa08=_0x3e30b0['scheduledat']?_0x3e30b0[_0xb9f3('0x1a')]:moment();var _0x5eb1c0=moment(_0xbdfa08)[_0xb9f3('0x22')](_0x38dbff,_0xb9f3('0x23'));_0x9d8aec({'ret':_0x5eb1c0['format'](_0xb9f3('0x24'))});}else _0x9d8aec({'ret':_0xbdfa08});}else _0x9d8aec({'ret':_0xbdfa08});}else{_0x9d8aec({'ret':_0xbdfa08});}});}});return 0xa;}var _0x18a32d=function(_0x181cbf){return new BPromise(function(_0x23193c,_0x52f826){_0x59c96c(_0x181cbf,_0x5dc3a5)['then'](function(_0xb04da1){_0x5dc3a5[_0xb9f3('0x1a')]=_0xb04da1[_0xb9f3('0x25')];_0x43245c['CmHopper'][_0xb9f3('0x2e')]({'where':{'phone':_0x5dc3a5[_0xb9f3('0xf')],'CampaignId':_0x181cbf['id']}})[_0xb9f3('0x1f')](function(_0x30853f){if(!_[_0xb9f3('0x1c')](_0x30853f)){throw new Error(_0xb9f3('0x27')+_0x5dc3a5[_0xb9f3('0xf')]+_0xb9f3('0x33')+_0x181cbf['id']);}return _0x43245c['CmHopper'][_0xb9f3('0x29')]({'phone':_0x5dc3a5[_0xb9f3('0xf')],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'priority':_0x5dc3a5['priority']?_0x5dc3a5[_0xb9f3('0x2b')]:0x2,'scheduledat':_0x5dc3a5['scheduledat']?_0x5dc3a5['scheduledat']:moment()[_0xb9f3('0x1b')](_0xb9f3('0x24')),'callback':_0x5dc3a5[_0xb9f3('0x2c')]?!![]:![],'callbackuniqueid':_0x5dc3a5['callbackUniqueid']?_0x5dc3a5[_0xb9f3('0x2c')]:undefined,'callbackat':_0x5dc3a5[_0xb9f3('0x2c')]?moment()[_0xb9f3('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x181cbf['id']});})[_0xb9f3('0x2d')](function(_0x400347){_0x52f826(_0x400347);});});});};var _0x4319b2=function(_0x504f87){return new BPromise(function(_0x4626df,_0x105627){_0x59c96c(_0x504f87,_0x5dc3a5)[_0xb9f3('0x1f')](function(_0x61dd6b){_0x5dc3a5[_0xb9f3('0x1a')]=_0x61dd6b['ret'];_0x43245c[_0xb9f3('0x26')][_0xb9f3('0x2e')]({'where':{'phone':_0x5dc3a5[_0xb9f3('0xf')],'CampaignId':_0x504f87['id']}})['then'](function(_0x3097bc){if(!_[_0xb9f3('0x1c')](_0x3097bc)){throw new Error(_0xb9f3('0x27')+_0x5dc3a5[_0xb9f3('0xf')]+_0xb9f3('0x34')+_0x504f87['id']);}return _0x43245c[_0xb9f3('0x30')][_0xb9f3('0x2e')]({'where':{'calleridnum':_0x5dc3a5['phone'],'CampaignId':_0x504f87['id']}});})[_0xb9f3('0x1f')](function(_0x5a11aa){if(!_[_0xb9f3('0x1c')](_0x5a11aa)){throw new Error(_0xb9f3('0x31')+_0x5dc3a5[_0xb9f3('0xf')]+_0xb9f3('0x35')+_0x504f87['id']);}return _0x43245c['CmHopper'][_0xb9f3('0x29')]({'phone':_0x5dc3a5['phone'],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'priority':_0x5dc3a5[_0xb9f3('0x2b')]?_0x5dc3a5[_0xb9f3('0x2b')]:0x2,'scheduledat':_0x5dc3a5[_0xb9f3('0x1a')]?_0x5dc3a5[_0xb9f3('0x1a')]:moment()[_0xb9f3('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5dc3a5[_0xb9f3('0x2c')]?!![]:![],'callbackuniqueid':_0x5dc3a5[_0xb9f3('0x2c')]?_0x5dc3a5[_0xb9f3('0x2c')]:undefined,'callbackat':_0x5dc3a5[_0xb9f3('0x2c')]?moment()[_0xb9f3('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x504f87['id']});})[_0xb9f3('0x2d')](function(_0x4a6abe){_0x105627(_0x4a6abe);});});});};if(_0x5dc3a5[_0xb9f3('0x2a')]){_0x43245c[_0xb9f3('0x1e')][_0xb9f3('0x36')]({'where':{'type':_0xb9f3('0x37')},'attributes':['id',_0xb9f3('0x38'),_0xb9f3('0x1d')],'include':[{'model':_0x43245c[_0xb9f3('0x39')],'as':'Lists','where':{'id':_0x5dc3a5[_0xb9f3('0x2a')]}}]})['then'](function(_0x1a843){if(_0x1a843){var _0x2d8e16=[];for(var _0x17b153=0x0,_0x1d0ff6;_0x17b153<_0x1a843[_0xb9f3('0x3a')];_0x17b153+=0x1){_0x1d0ff6=_0x1a843[_0x17b153][_0xb9f3('0x16')]({'plain':!![]});switch(_0x1d0ff6['dialCheckDuplicateType']){case _0xb9f3('0x3b'):_0x2176c9(_0x1d0ff6)[_0xb9f3('0x2d')](_0x517923());break;case _0xb9f3('0x3c'):_0x2cb524(_0x1d0ff6)[_0xb9f3('0x2d')](_0x517923());break;default:_0x59c96c(_0x1d0ff6,_0x5dc3a5)[_0xb9f3('0x1f')](function(_0x1a6a57){_0x5dc3a5[_0xb9f3('0x1a')]=_0x1a6a57['ret'];_0x43245c[_0xb9f3('0x26')][_0xb9f3('0x29')]({'phone':_0x5dc3a5[_0xb9f3('0xf')],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'scheduledat':_0x5dc3a5[_0xb9f3('0x1a')]?_0x5dc3a5[_0xb9f3('0x1a')]:moment()[_0xb9f3('0x1b')](_0xb9f3('0x24')),'priority':_0x5dc3a5[_0xb9f3('0x2b')]?_0x5dc3a5[_0xb9f3('0x2b')]:0x2,'callback':_0x5dc3a5[_0xb9f3('0x2c')]?!![]:![],'callbackuniqueid':_0x5dc3a5[_0xb9f3('0x2c')]?_0x5dc3a5[_0xb9f3('0x2c')]:undefined,'callbackat':_0x5dc3a5[_0xb9f3('0x2c')]?moment()['format'](_0xb9f3('0x24')):undefined,'VoiceQueueId':_0x1d0ff6['id']})[_0xb9f3('0x2d')](_0x517923());});}}}})[_0xb9f3('0x1f')](function(){return _0x43245c['VoiceQueue'][_0xb9f3('0x36')]({'where':{'type':_0xb9f3('0x37')},'attributes':['id'],'include':[{'model':_0x43245c[_0xb9f3('0x39')],'as':_0xb9f3('0x3d'),'where':{'id':_0x5dc3a5[_0xb9f3('0x2a')]}}]})[_0xb9f3('0x1f')](function(_0x5623aa){if(_0x5623aa){var _0x234a24=[];for(var _0x3e60bd=0x0,_0x1da43a;_0x3e60bd<_0x5623aa[_0xb9f3('0x3a')];_0x3e60bd+=0x1){_0x1da43a=_0x5623aa[_0x3e60bd][_0xb9f3('0x16')]({'plain':!![]});_0x43245c['CmHopperBlack'][_0xb9f3('0x29')]({'phone':_0x5dc3a5['phone'],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'VoiceQueueId':_0x1da43a['id']})[_0xb9f3('0x2d')](function(_0x55c271){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0x55c271[_0xb9f3('0x3e')]);});}}});})[_0xb9f3('0x1f')](function(){return _0x43245c[_0xb9f3('0x32')][_0xb9f3('0x36')]({'attributes':['id',_0xb9f3('0x38'),_0xb9f3('0x1d')],'include':[{'model':_0x43245c[_0xb9f3('0x39')],'as':_0xb9f3('0x3f'),'where':{'id':_0x5dc3a5[_0xb9f3('0x2a')]}}]})[_0xb9f3('0x1f')](function(_0x243cd3){if(_0x243cd3){var _0x22c49e=[];for(var _0x567019=0x0,_0x3c965f;_0x567019<_0x243cd3[_0xb9f3('0x3a')];_0x567019+=0x1){_0x3c965f=_0x243cd3[_0x567019][_0xb9f3('0x16')]({'plain':!![]});switch(_0x3c965f[_0xb9f3('0x38')]){case _0xb9f3('0x3b'):_0x4319b2(_0x3c965f)[_0xb9f3('0x2d')](_0x19330a());break;case _0xb9f3('0x3c'):_0x18a32d(_0x3c965f)[_0xb9f3('0x2d')](_0x19330a());break;default:_0x43245c['CmHopper']['create']({'phone':_0x5dc3a5[_0xb9f3('0xf')],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'scheduledat':_0x5dc3a5[_0xb9f3('0x1a')]?_0x5dc3a5[_0xb9f3('0x1a')]:moment()[_0xb9f3('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5dc3a5['priority']?_0x5dc3a5[_0xb9f3('0x2b')]:0x2,'callback':_0x5dc3a5[_0xb9f3('0x2c')]?!![]:![],'callbackuniqueid':_0x5dc3a5[_0xb9f3('0x2c')]?_0x5dc3a5[_0xb9f3('0x2c')]:undefined,'callbackat':_0x5dc3a5[_0xb9f3('0x2c')]?moment()[_0xb9f3('0x1b')](_0xb9f3('0x24')):undefined,'CampaignId':_0x3c965f['id']})[_0xb9f3('0x2d')](_0x19330a());}}}});})[_0xb9f3('0x1f')](function(){return _0x43245c[_0xb9f3('0x32')][_0xb9f3('0x36')]({'attributes':['id'],'include':[{'model':_0x43245c['CmList'],'as':'BlackLists','where':{'id':_0x5dc3a5[_0xb9f3('0x2a')]}}]})[_0xb9f3('0x1f')](function(_0x4c7b8c){if(_0x4c7b8c){var _0x26b418=[];for(var _0x5dce9a=0x0,_0x512ae7;_0x5dce9a<_0x4c7b8c['length'];_0x5dce9a+=0x1){_0x512ae7=_0x4c7b8c[_0x5dce9a]['get']({'plain':!![]});_0x43245c['CmHopperBlack'][_0xb9f3('0x29')]({'phone':_0x5dc3a5[_0xb9f3('0xf')],'ContactId':_0x5dc3a5['id'],'ListId':_0x5dc3a5[_0xb9f3('0x2a')],'CampaignId':_0x512ae7['id']})['catch'](function(_0x3741c6){logger[_0xb9f3('0x17')]('cmContact,\x20%s,\x20%s',_0xb9f3('0x18'),_0x3741c6['message']);});}}});})['then'](function(){_0x11bd87();})[_0xb9f3('0x2d')](function(_0x1d910b){logger['error'](_0xb9f3('0x40'),_0xb9f3('0x18'),_0x1d910b[_0xb9f3('0x3e')]);_0x11bd87(_0x1d910b);});}else{_0x11bd87(new Error(_0xb9f3('0x41')));}},'afterDestroy':function(_0x166130,_0x1da203,_0x15c3a8){var _0x477764=_0x382ca4[_0xb9f3('0x15')];var _0x3e475e=_0x166130[_0xb9f3('0x16')]({'plain':!![]});return _0x477764['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x3e475e[_0xb9f3('0x2a')],'ContactId':_0x3e475e['id']}})['then'](function(_0xa921d8){if(!_[_0xb9f3('0x42')](_0xa921d8)){var _0xd68801=[];for(var _0x29d39f=0x0;_0x29d39f<_0xa921d8[_0xb9f3('0x3a')];_0x29d39f+=0x1){var _0x565d62=_0x477764[_0xb9f3('0x26')][_0xb9f3('0x43')]({'where':{'ListId':_0xa921d8[_0x29d39f][_0xb9f3('0x2a')],'ContactId':_0xa921d8[_0x29d39f][_0xb9f3('0x44')],'VoiceQueueId':_0xa921d8[_0x29d39f][_0xb9f3('0x45')],'CampaignId':_0xa921d8[_0x29d39f][_0xb9f3('0x46')]}});_0xd68801[_0xb9f3('0x47')](_0x565d62);}return BPromise[_0xb9f3('0x48')](_0xd68801);}})[_0xb9f3('0x1f')](function(_0x5187cd){logger[_0xb9f3('0x49')](_0xb9f3('0x4a'),util[_0xb9f3('0x19')](_0x5187cd,{'showHidden':![],'depth':null}));_0x15c3a8();})[_0xb9f3('0x2d')](function(_0x5103f4){logger[_0xb9f3('0x17')](_0xb9f3('0x4b'),util[_0xb9f3('0x19')](_0x5103f4,{'showHidden':![],'depth':null}));_0x15c3a8(_0x5103f4);});}}});}; \ No newline at end of file +var _0x8d2d=['request-promise','path','rimraf','./cmContact.attributes','define','CmContact','phone','fti_cm_contacts','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','findOne','then','dialTimezone','utcOffset','add','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\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','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','ListId','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','models','isEmpty','length','destroy','ContactId','CampaignId','push','all','[CmContact][afterDestroy][Error]','lodash','util','moment'];(function(_0x414aa4,_0x690590){var _0x19ba76=function(_0x292701){while(--_0x292701){_0x414aa4['push'](_0x414aa4['shift']());}};_0x19ba76(++_0x690590);}(_0x8d2d,0x15b));var _0xd8d2=function(_0x4788ee,_0xd0f7){_0x4788ee=_0x4788ee-0x0;var _0x155e89=_0x8d2d[_0x4788ee];return _0x155e89;};'use strict';var _=require(_0xd8d2('0x0'));var util=require(_0xd8d2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd8d2('0x2'));var BPromise=require('bluebird');var rp=require(_0xd8d2('0x3'));var fs=require('fs');var path=require(_0xd8d2('0x4'));var rimraf=require(_0xd8d2('0x5'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0xd8d2('0x6'));module['exports']=function(_0x3761ce,_0x3eb46b){return _0x3761ce[_0xd8d2('0x7')](_0xd8d2('0x8'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xd8d2('0x9'),'fields':[_0xd8d2('0x9')]},{'name':_0xd8d2('0xa'),'fields':['firstName',_0xd8d2('0xb'),_0xd8d2('0x9'),_0xd8d2('0xc'),_0xd8d2('0xd'),_0xd8d2('0xe')],'type':_0xd8d2('0xf')}],'timestamps':!![],'charset':_0xd8d2('0x10'),'collate':_0xd8d2('0x11'),'hooks':{'afterCreate':function(_0x51f612,_0x58a9a2,_0x375d32){var _0x1def8f=_0x3761ce['models'];var _0x2cb9de=_0x51f612[_0xd8d2('0x12')]({'plain':!![]});function _0x3185e3(){return function(_0x8d81d6){logger[_0xd8d2('0x13')](_0xd8d2('0x14'),_0xd8d2('0x15'),util[_0xd8d2('0x16')](_0x8d81d6,{'showHidden':![],'depth':null}));};}function _0x352379(_0x31ead0,_0x57ccdc){var _0x1ab3c7=_0x57ccdc[_0xd8d2('0x17')]?_0x57ccdc['scheduledat']:moment()[_0xd8d2('0x18')](_0xd8d2('0x19'));return new BPromise(function(_0x4778ed,_0x213e1d){if(_[_0xd8d2('0x1a')](_0x57ccdc['dialTimezone'])){_0x4778ed({'ret':_0x1ab3c7});}else{_0x1def8f['VoiceQueue'][_0xd8d2('0x1b')]({'where':{'id':_0x31ead0['id']}})[_0xd8d2('0x1c')](function(_0x1136b1){if(!_[_0xd8d2('0x1a')](_0x1136b1)){var _0x188ed7=_0x1136b1[_0xd8d2('0x1d')];if(!_[_0xd8d2('0x1a')](_0x188ed7)){var _0x2021ef=shared['timezones'];var _0x2b7881=_0x2021ef[_0x188ed7];var _0x16b6af=_0x2021ef[_0x57ccdc[_0xd8d2('0x1d')]];if(!_[_0xd8d2('0x1a')](_0x2b7881)&&!_[_0xd8d2('0x1a')](_0x16b6af)){var _0x55de26=_0x2b7881[_0xd8d2('0x1e')]-_0x16b6af[_0xd8d2('0x1e')];_0x1ab3c7=_0x57ccdc[_0xd8d2('0x17')]?_0x57ccdc[_0xd8d2('0x17')]:moment();var _0x4d0ff0=moment(_0x1ab3c7)[_0xd8d2('0x1f')](_0x55de26,_0xd8d2('0x20'));_0x4778ed({'ret':_0x4d0ff0[_0xd8d2('0x18')](_0xd8d2('0x19'))});}else _0x4778ed({'ret':_0x1ab3c7});}else _0x4778ed({'ret':_0x1ab3c7});}else{_0x4778ed({'ret':_0x1ab3c7});}});}});return 0xa;}var _0x23190a=function(_0x4651ea){return new BPromise(function(_0xe77f6e,_0x170124){_0x352379(_0x4651ea,_0x2cb9de)[_0xd8d2('0x1c')](function(_0x363c92){_0x2cb9de[_0xd8d2('0x17')]=_0x363c92[_0xd8d2('0x21')];_0x1def8f['CmHopper']['findOne']({'where':{'phone':_0x2cb9de['phone'],'VoiceQueueId':_0x4651ea['id']}})['then'](function(_0x4e4383){if(!_['isNil'](_0x4e4383)){throw new Error(_0xd8d2('0x22')+_0x2cb9de[_0xd8d2('0x9')]+_0xd8d2('0x23')+_0x4651ea['id']);}return _0x1def8f[_0xd8d2('0x24')][_0xd8d2('0x25')]({'phone':_0x2cb9de[_0xd8d2('0x9')],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de['ListId'],'priority':_0x2cb9de[_0xd8d2('0x26')]?_0x2cb9de['priority']:0x2,'scheduledat':_0x2cb9de[_0xd8d2('0x17')]?_0x2cb9de[_0xd8d2('0x17')]:moment()[_0xd8d2('0x18')](_0xd8d2('0x19')),'callback':_0x2cb9de[_0xd8d2('0x27')]?!![]:![],'callbackuniqueid':_0x2cb9de[_0xd8d2('0x27')]?_0x2cb9de[_0xd8d2('0x27')]:undefined,'callbackat':_0x2cb9de[_0xd8d2('0x27')]?moment()[_0xd8d2('0x18')](_0xd8d2('0x19')):undefined,'VoiceQueueId':_0x4651ea['id']});})[_0xd8d2('0x28')](function(_0x25f454){_0x170124(_0x25f454);});});});};var _0x1dc4fd=function(_0x2b973e){return new BPromise(function(_0x9dc16e,_0x265967){_0x352379(_0x2b973e,_0x2cb9de)[_0xd8d2('0x1c')](function(_0x91cf04){_0x2cb9de[_0xd8d2('0x17')]=_0x91cf04[_0xd8d2('0x21')];_0x1def8f[_0xd8d2('0x24')]['findOne']({'where':{'phone':_0x2cb9de[_0xd8d2('0x9')],'VoiceQueueId':_0x2b973e['id']}})[_0xd8d2('0x1c')](function(_0x77735){if(!_[_0xd8d2('0x1a')](_0x77735)){throw new Error(_0xd8d2('0x22')+_0x2cb9de[_0xd8d2('0x9')]+_0xd8d2('0x29')+_0x2b973e['id']);}return _0x1def8f['CmHopperFinal'][_0xd8d2('0x1b')]({'where':{'calleridnum':_0x2cb9de[_0xd8d2('0x9')],'VoiceQueueId':_0x2b973e['id']}});})['then'](function(_0x150f52){if(!_[_0xd8d2('0x1a')](_0x150f52)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2cb9de[_0xd8d2('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x2b973e['id']);}return _0x1def8f[_0xd8d2('0x24')]['create']({'phone':_0x2cb9de[_0xd8d2('0x9')],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de['ListId'],'priority':_0x2cb9de[_0xd8d2('0x26')]?_0x2cb9de[_0xd8d2('0x26')]:0x2,'scheduledat':_0x2cb9de[_0xd8d2('0x17')]?_0x2cb9de['scheduledat']:moment()[_0xd8d2('0x18')](_0xd8d2('0x19')),'callback':_0x2cb9de[_0xd8d2('0x27')]?!![]:![],'callbackuniqueid':_0x2cb9de[_0xd8d2('0x27')]?_0x2cb9de[_0xd8d2('0x27')]:undefined,'callbackat':_0x2cb9de['callbackUniqueid']?moment()['format'](_0xd8d2('0x19')):undefined,'VoiceQueueId':_0x2b973e['id']});})[_0xd8d2('0x28')](function(_0x21d4a1){_0x265967(_0x21d4a1);});});});};function _0x4c7402(){return function(_0x48f1d7){logger[_0xd8d2('0x13')](_0xd8d2('0x14'),_0xd8d2('0x15'),util['inspect'](_0x48f1d7,{'showHidden':![],'depth':null}));};}function _0x298264(_0x8aab9c,_0x4c9bdb){var _0x222dda=_0x4c9bdb[_0xd8d2('0x17')]?_0x4c9bdb['scheduledat']:moment()[_0xd8d2('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x538a1a,_0x23d0f4){if(_[_0xd8d2('0x1a')](_0x4c9bdb[_0xd8d2('0x1d')])){_0x538a1a({'ret':_0x222dda});}else{_0x1def8f[_0xd8d2('0x2a')]['findOne']({'where':{'id':_0x8aab9c['id']}})[_0xd8d2('0x1c')](function(_0x359d20){if(!_[_0xd8d2('0x1a')](_0x359d20)){var _0x1d4f36=_0x359d20[_0xd8d2('0x1d')];if(!_[_0xd8d2('0x1a')](_0x1d4f36)){var _0x5ec8c6=shared['timezones'];var _0x3ac735=_0x5ec8c6[_0x1d4f36];var _0xf0d8c=_0x5ec8c6[_0x4c9bdb[_0xd8d2('0x1d')]];if(!_[_0xd8d2('0x1a')](_0x3ac735)&&!_[_0xd8d2('0x1a')](_0xf0d8c)){var _0x81bb96=_0x3ac735[_0xd8d2('0x1e')]-_0xf0d8c[_0xd8d2('0x1e')];_0x222dda=_0x4c9bdb['scheduledat']?_0x4c9bdb[_0xd8d2('0x17')]:moment();var _0x32e85a=moment(_0x222dda)[_0xd8d2('0x1f')](_0x81bb96,_0xd8d2('0x20'));_0x538a1a({'ret':_0x32e85a[_0xd8d2('0x18')](_0xd8d2('0x19'))});}else _0x538a1a({'ret':_0x222dda});}else _0x538a1a({'ret':_0x222dda});}else{_0x538a1a({'ret':_0x222dda});}});}});return 0xa;}var _0x287f6e=function(_0x3baee2){return new BPromise(function(_0x25f761,_0x2b518a){_0x298264(_0x3baee2,_0x2cb9de)[_0xd8d2('0x1c')](function(_0x506654){_0x2cb9de[_0xd8d2('0x17')]=_0x506654['ret'];_0x1def8f[_0xd8d2('0x24')]['findOne']({'where':{'phone':_0x2cb9de[_0xd8d2('0x9')],'CampaignId':_0x3baee2['id']}})[_0xd8d2('0x1c')](function(_0x7667fc){if(!_[_0xd8d2('0x1a')](_0x7667fc)){throw new Error(_0xd8d2('0x22')+_0x2cb9de[_0xd8d2('0x9')]+_0xd8d2('0x2b')+_0x3baee2['id']);}return _0x1def8f[_0xd8d2('0x24')][_0xd8d2('0x25')]({'phone':_0x2cb9de[_0xd8d2('0x9')],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de['ListId'],'priority':_0x2cb9de[_0xd8d2('0x26')]?_0x2cb9de[_0xd8d2('0x26')]:0x2,'scheduledat':_0x2cb9de[_0xd8d2('0x17')]?_0x2cb9de[_0xd8d2('0x17')]:moment()['format'](_0xd8d2('0x19')),'callback':_0x2cb9de[_0xd8d2('0x27')]?!![]:![],'callbackuniqueid':_0x2cb9de[_0xd8d2('0x27')]?_0x2cb9de[_0xd8d2('0x27')]:undefined,'callbackat':_0x2cb9de['callbackUniqueid']?moment()['format'](_0xd8d2('0x19')):undefined,'CampaignId':_0x3baee2['id']});})[_0xd8d2('0x28')](function(_0x173f0c){_0x2b518a(_0x173f0c);});});});};var _0x3ae016=function(_0x5e6a28){return new BPromise(function(_0x144e78,_0x4fb40e){_0x298264(_0x5e6a28,_0x2cb9de)[_0xd8d2('0x1c')](function(_0x2a9a0f){_0x2cb9de[_0xd8d2('0x17')]=_0x2a9a0f[_0xd8d2('0x21')];_0x1def8f['CmHopper'][_0xd8d2('0x1b')]({'where':{'phone':_0x2cb9de['phone'],'CampaignId':_0x5e6a28['id']}})['then'](function(_0x82331d){if(!_[_0xd8d2('0x1a')](_0x82331d)){throw new Error(_0xd8d2('0x22')+_0x2cb9de[_0xd8d2('0x9')]+_0xd8d2('0x2c')+_0x5e6a28['id']);}return _0x1def8f['CmHopperFinal'][_0xd8d2('0x1b')]({'where':{'calleridnum':_0x2cb9de[_0xd8d2('0x9')],'CampaignId':_0x5e6a28['id']}});})[_0xd8d2('0x1c')](function(_0x1b47b0){if(!_[_0xd8d2('0x1a')](_0x1b47b0)){throw new Error(_0xd8d2('0x2d')+_0x2cb9de[_0xd8d2('0x9')]+_0xd8d2('0x2e')+_0x5e6a28['id']);}return _0x1def8f[_0xd8d2('0x24')]['create']({'phone':_0x2cb9de[_0xd8d2('0x9')],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de[_0xd8d2('0x2f')],'priority':_0x2cb9de[_0xd8d2('0x26')]?_0x2cb9de[_0xd8d2('0x26')]:0x2,'scheduledat':_0x2cb9de[_0xd8d2('0x17')]?_0x2cb9de[_0xd8d2('0x17')]:moment()[_0xd8d2('0x18')](_0xd8d2('0x19')),'callback':_0x2cb9de[_0xd8d2('0x27')]?!![]:![],'callbackuniqueid':_0x2cb9de[_0xd8d2('0x27')]?_0x2cb9de[_0xd8d2('0x27')]:undefined,'callbackat':_0x2cb9de['callbackUniqueid']?moment()[_0xd8d2('0x18')](_0xd8d2('0x19')):undefined,'CampaignId':_0x5e6a28['id']});})[_0xd8d2('0x28')](function(_0x30775c){_0x4fb40e(_0x30775c);});});});};if(_0x2cb9de[_0xd8d2('0x2f')]){_0x1def8f[_0xd8d2('0x30')][_0xd8d2('0x31')]({'where':{'type':_0xd8d2('0x32')},'attributes':['id',_0xd8d2('0x33'),_0xd8d2('0x1d')],'include':[{'model':_0x1def8f[_0xd8d2('0x34')],'as':_0xd8d2('0x35'),'where':{'id':_0x2cb9de[_0xd8d2('0x2f')]}}]})['then'](function(_0x308db4){if(_0x308db4){var _0x562a7f=[];for(var _0x37bc59=0x0,_0x2e7891;_0x37bc59<_0x308db4['length'];_0x37bc59+=0x1){_0x2e7891=_0x308db4[_0x37bc59][_0xd8d2('0x12')]({'plain':!![]});switch(_0x2e7891[_0xd8d2('0x33')]){case _0xd8d2('0x36'):_0x1dc4fd(_0x2e7891)[_0xd8d2('0x28')](_0x3185e3());break;case _0xd8d2('0x37'):_0x23190a(_0x2e7891)[_0xd8d2('0x28')](_0x3185e3());break;default:_0x298264(_0x2e7891,_0x2cb9de)[_0xd8d2('0x1c')](function(_0xe41caa){_0x2cb9de[_0xd8d2('0x17')]=_0xe41caa[_0xd8d2('0x21')];_0x1def8f['CmHopper'][_0xd8d2('0x25')]({'phone':_0x2cb9de[_0xd8d2('0x9')],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de['ListId'],'scheduledat':_0x2cb9de[_0xd8d2('0x17')]?_0x2cb9de[_0xd8d2('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2cb9de['priority']?_0x2cb9de['priority']:0x2,'callback':_0x2cb9de[_0xd8d2('0x27')]?!![]:![],'callbackuniqueid':_0x2cb9de[_0xd8d2('0x27')]?_0x2cb9de[_0xd8d2('0x27')]:undefined,'callbackat':_0x2cb9de[_0xd8d2('0x27')]?moment()[_0xd8d2('0x18')](_0xd8d2('0x19')):undefined,'VoiceQueueId':_0x2e7891['id']})[_0xd8d2('0x28')](_0x3185e3());});}}}})[_0xd8d2('0x1c')](function(){return _0x1def8f[_0xd8d2('0x30')][_0xd8d2('0x31')]({'where':{'type':_0xd8d2('0x32')},'attributes':['id'],'include':[{'model':_0x1def8f[_0xd8d2('0x34')],'as':_0xd8d2('0x38'),'where':{'id':_0x2cb9de['ListId']}}]})[_0xd8d2('0x1c')](function(_0x2a8dc0){if(_0x2a8dc0){var _0x5824d5=[];for(var _0xe563f5=0x0,_0x4055a2;_0xe563f5<_0x2a8dc0['length'];_0xe563f5+=0x1){_0x4055a2=_0x2a8dc0[_0xe563f5][_0xd8d2('0x12')]({'plain':!![]});_0x1def8f[_0xd8d2('0x39')][_0xd8d2('0x25')]({'phone':_0x2cb9de[_0xd8d2('0x9')],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de['ListId'],'VoiceQueueId':_0x4055a2['id']})[_0xd8d2('0x28')](function(_0x4ccacd){logger[_0xd8d2('0x13')](_0xd8d2('0x3a'),'afterCreate',_0x4ccacd[_0xd8d2('0x3b')]);});}}});})[_0xd8d2('0x1c')](function(){return _0x1def8f['Campaign']['findAll']({'attributes':['id',_0xd8d2('0x33'),_0xd8d2('0x1d')],'include':[{'model':_0x1def8f[_0xd8d2('0x34')],'as':_0xd8d2('0x35'),'where':{'id':_0x2cb9de[_0xd8d2('0x2f')]}}]})[_0xd8d2('0x1c')](function(_0x4a08d7){if(_0x4a08d7){var _0x24ee3b=[];for(var _0x163a94=0x0,_0x36f90a;_0x163a94<_0x4a08d7['length'];_0x163a94+=0x1){_0x36f90a=_0x4a08d7[_0x163a94]['get']({'plain':!![]});switch(_0x36f90a[_0xd8d2('0x33')]){case'always':_0x3ae016(_0x36f90a)[_0xd8d2('0x28')](_0x4c7402());break;case _0xd8d2('0x37'):_0x287f6e(_0x36f90a)[_0xd8d2('0x28')](_0x4c7402());break;default:_0x1def8f[_0xd8d2('0x24')][_0xd8d2('0x25')]({'phone':_0x2cb9de[_0xd8d2('0x9')],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de[_0xd8d2('0x2f')],'scheduledat':_0x2cb9de[_0xd8d2('0x17')]?_0x2cb9de[_0xd8d2('0x17')]:moment()['format'](_0xd8d2('0x19')),'priority':_0x2cb9de[_0xd8d2('0x26')]?_0x2cb9de[_0xd8d2('0x26')]:0x2,'callback':_0x2cb9de['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2cb9de[_0xd8d2('0x27')]?_0x2cb9de[_0xd8d2('0x27')]:undefined,'callbackat':_0x2cb9de['callbackUniqueid']?moment()['format'](_0xd8d2('0x19')):undefined,'CampaignId':_0x36f90a['id']})[_0xd8d2('0x28')](_0x4c7402());}}}});})[_0xd8d2('0x1c')](function(){return _0x1def8f[_0xd8d2('0x2a')][_0xd8d2('0x31')]({'attributes':['id'],'include':[{'model':_0x1def8f[_0xd8d2('0x34')],'as':'BlackLists','where':{'id':_0x2cb9de[_0xd8d2('0x2f')]}}]})['then'](function(_0x40bac1){if(_0x40bac1){var _0xb75019=[];for(var _0x3158f0=0x0,_0x20593e;_0x3158f0<_0x40bac1['length'];_0x3158f0+=0x1){_0x20593e=_0x40bac1[_0x3158f0][_0xd8d2('0x12')]({'plain':!![]});_0x1def8f[_0xd8d2('0x39')][_0xd8d2('0x25')]({'phone':_0x2cb9de['phone'],'ContactId':_0x2cb9de['id'],'ListId':_0x2cb9de[_0xd8d2('0x2f')],'CampaignId':_0x20593e['id']})[_0xd8d2('0x28')](function(_0x361a6b){logger[_0xd8d2('0x13')]('cmContact,\x20%s,\x20%s',_0xd8d2('0x15'),_0x361a6b['message']);});}}});})[_0xd8d2('0x1c')](function(){_0x375d32();})['catch'](function(_0x2c1bbc){logger[_0xd8d2('0x13')](_0xd8d2('0x3a'),_0xd8d2('0x15'),_0x2c1bbc[_0xd8d2('0x3b')]);_0x375d32(_0x2c1bbc);});}else{_0x375d32(new Error(_0xd8d2('0x3c')));}},'afterDestroy':function(_0x3838eb,_0x5b9439,_0x5e3426){var _0x496d3d=_0x3761ce[_0xd8d2('0x3d')];var _0x47518c=_0x3838eb[_0xd8d2('0x12')]({'plain':!![]});return _0x496d3d[_0xd8d2('0x24')][_0xd8d2('0x31')]({'raw':!![],'where':{'ListId':_0x47518c[_0xd8d2('0x2f')],'ContactId':_0x47518c['id']}})['then'](function(_0x193032){if(!_[_0xd8d2('0x3e')](_0x193032)){var _0x26b8a4=[];for(var _0x3f68fe=0x0;_0x3f68fe<_0x193032[_0xd8d2('0x3f')];_0x3f68fe+=0x1){var _0x5b3330=_0x496d3d['CmHopper'][_0xd8d2('0x40')]({'where':{'ListId':_0x193032[_0x3f68fe][_0xd8d2('0x2f')],'ContactId':_0x193032[_0x3f68fe][_0xd8d2('0x41')],'VoiceQueueId':_0x193032[_0x3f68fe]['VoiceQueueId'],'CampaignId':_0x193032[_0x3f68fe][_0xd8d2('0x42')]}});_0x26b8a4[_0xd8d2('0x43')](_0x5b3330);}return BPromise[_0xd8d2('0x44')](_0x26b8a4);}})[_0xd8d2('0x1c')](function(_0x149f7b){logger['info']('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x149f7b,{'showHidden':![],'depth':null}));_0x5e3426();})[_0xd8d2('0x28')](function(_0x1929a8){logger['error'](_0xd8d2('0x45'),util[_0xd8d2('0x16')](_0x1929a8,{'showHidden':![],'depth':null}));_0x5e3426(_0x1929a8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 53e3c58..88c8df0 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0xcaa12f,_0x386dc8){var _0x448857=function(_0x33b9e8){while(--_0x33b9e8){_0xcaa12f['push'](_0xcaa12f['shift']());}};_0x448857(++_0x386dc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 78289b5..a480aa9 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 _0xda65=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x2a0aa1,_0x5144a0){var _0x285749=function(_0x4b46d9){while(--_0x4b46d9){_0x2a0aa1['push'](_0x2a0aa1['shift']());}};_0x285749(++_0x5144a0);}(_0xda65,0x1d0));var _0x5da6=function(_0x99a7b,_0x450b4a){_0x99a7b=_0x99a7b-0x0;var _0x1ce78f=_0xda65[_0x99a7b];return _0x1ce78f;};'use strict';var Sequelize=require(_0x5da6('0x0'));module[_0x5da6('0x1')]={'CmContactId':{'type':Sequelize[_0x5da6('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x5da6('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x5da6('0x3')],'defaultValue':_0x5da6('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x871e=['sequelize','INTEGER','STRING'];(function(_0x57451f,_0x5bb7cb){var _0x56809e=function(_0x5a7341){while(--_0x5a7341){_0x57451f['push'](_0x57451f['shift']());}};_0x56809e(++_0x5bb7cb);}(_0x871e,0x1b0));var _0xe871=function(_0x383620,_0x32c767){_0x383620=_0x383620-0x0;var _0x519d15=_0x871e[_0x383620];return _0x519d15;};'use strict';var Sequelize=require(_0xe871('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xe871('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xe871('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xe871('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe871('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xe871('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xe871('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 748c133..bd5dad8 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 _0x57f7=['status','end','offset','undefined','count','limit','set','Content-Range','json','reject','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus'];(function(_0x3ffe44,_0x3f3e26){var _0x2601f8=function(_0x4332a0){while(--_0x4332a0){_0x3ffe44['push'](_0x3ffe44['shift']());}};_0x2601f8(++_0x3f3e26);}(_0x57f7,0x1b7));var _0x757f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x57f7[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x757f('0x0'));var rimraf=require(_0x757f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x757f('0x2'));var rp=require(_0x757f('0x3'));var moment=require(_0x757f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x757f('0x5'));var sox=require(_0x757f('0x6'));var csv=require('to-csv');var ejs=require(_0x757f('0x7'));var fs=require('fs');var fs_extra=require(_0x757f('0x8'));var _=require(_0x757f('0x9'));var squel=require(_0x757f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x757f('0xb'));var toCsv=require(_0x757f('0xc'));var querystring=require(_0x757f('0xd'));var Papa=require(_0x757f('0xe'));var Redis=require('ioredis');var authService=require(_0x757f('0xf'));var qs=require(_0x757f('0x10'));var as=require(_0x757f('0x11'));var hardwareService=require(_0x757f('0x12'));var logger=require(_0x757f('0x13'))('api');var utils=require(_0x757f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x757f('0x15'))['db'];function respondWithStatusCode(_0x30fd5,_0x296f19){_0x296f19=_0x296f19||0xcc;return function(_0x5bc226){if(_0x5bc226){return _0x30fd5[_0x757f('0x16')](_0x296f19);}return _0x30fd5[_0x757f('0x17')](_0x296f19)[_0x757f('0x18')]();};}function respondWithResult(_0x298506,_0x39068e){_0x39068e=_0x39068e||0xc8;return function(_0x1c03ac){if(_0x1c03ac){return _0x298506[_0x757f('0x17')](_0x39068e)['json'](_0x1c03ac);}};}function respondWithFilteredResult(_0x355b27,_0x20585b){return function(_0x591687){if(_0x591687){var _0x2afff6=typeof _0x20585b[_0x757f('0x19')]===_0x757f('0x1a')&&typeof _0x20585b['limit']===_0x757f('0x1a');var _0x232b2a=_0x591687['count'];var _0x9a782=_0x2afff6?0x0:_0x20585b['offset'];var _0x53a4ae=_0x2afff6?_0x591687[_0x757f('0x1b')]:_0x20585b[_0x757f('0x19')]+_0x20585b[_0x757f('0x1c')];var _0x1acfd8;if(_0x53a4ae>=_0x232b2a){_0x53a4ae=_0x232b2a;_0x1acfd8=0xc8;}else{_0x1acfd8=0xce;}_0x355b27[_0x757f('0x17')](_0x1acfd8);return _0x355b27[_0x757f('0x1d')](_0x757f('0x1e'),_0x9a782+'-'+_0x53a4ae+'/'+_0x232b2a)[_0x757f('0x1f')](_0x591687);}return null;};}function patchUpdates(_0x275ba4){return function(_0x475419){try{jsonpatch['apply'](_0x475419,_0x275ba4,!![]);}catch(_0x562071){return BPromise[_0x757f('0x20')](_0x562071);}return _0x475419['save']();};}function saveUpdates(_0x36af30,_0x2a0a4e){return function(_0x5b6dee){if(_0x5b6dee){return _0x5b6dee['update'](_0x36af30)[_0x757f('0x21')](function(_0x10467e){return _0x10467e;});}return null;};}function removeEntity(_0xbbd9a8,_0x407e04){return function(_0x328034){if(_0x328034){return _0x328034[_0x757f('0x22')]()[_0x757f('0x21')](function(){var _0x4b2924=_0x328034['get']({'plain':!![]});var _0x19c514=_0x757f('0x23');return db[_0x757f('0x24')][_0x757f('0x22')]({'where':{'type':_0x19c514,'resourceId':_0x4b2924['id']}})[_0x757f('0x21')](function(){return _0x328034;});})[_0x757f('0x21')](function(){_0xbbd9a8[_0x757f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aac3a,_0x2af85b){return function(_0x399caf){if(!_0x399caf){_0x2aac3a[_0x757f('0x16')](0x194);}return _0x399caf;};}function handleError(_0x3f11e6,_0x4fc5b0){_0x4fc5b0=_0x4fc5b0||0x1f4;return function(_0x333a1c){logger[_0x757f('0x25')](_0x333a1c[_0x757f('0x26')]);if(_0x333a1c[_0x757f('0x27')]){delete _0x333a1c[_0x757f('0x27')];}_0x3f11e6[_0x757f('0x17')](_0x4fc5b0)['send'](_0x333a1c);};}exports['index']=function(_0x4c7f62,_0x4f11a7){var _0x4fac6c={},_0xc6966c={},_0x4d0cc8={'count':0x0,'rows':[]};var _0x8151e2=_[_0x757f('0x28')](db[_0x757f('0x29')][_0x757f('0x2a')],function(_0x20c5bf){return{'name':_0x20c5bf[_0x757f('0x2b')],'type':_0x20c5bf[_0x757f('0x2c')][_0x757f('0x2d')]};});_0xc6966c[_0x757f('0x2e')]=_[_0x757f('0x28')](_0x8151e2,_0x757f('0x27'));_0xc6966c[_0x757f('0x2f')]=_['keys'](_0x4c7f62[_0x757f('0x2f')]);_0xc6966c['filters']=_['intersection'](_0xc6966c['model'],_0xc6966c[_0x757f('0x2f')]);_0x4fac6c[_0x757f('0x30')]=_['intersection'](_0xc6966c[_0x757f('0x2e')],qs[_0x757f('0x31')](_0x4c7f62[_0x757f('0x2f')][_0x757f('0x31')]));_0x4fac6c[_0x757f('0x30')]=_0x4fac6c[_0x757f('0x30')][_0x757f('0x32')]?_0x4fac6c['attributes']:_0xc6966c[_0x757f('0x2e')];if(!_0x4c7f62[_0x757f('0x2f')]['hasOwnProperty']('nolimit')){_0x4fac6c[_0x757f('0x1c')]=qs[_0x757f('0x1c')](_0x4c7f62['query']['limit']);_0x4fac6c[_0x757f('0x19')]=qs['offset'](_0x4c7f62[_0x757f('0x2f')][_0x757f('0x19')]);}_0x4fac6c[_0x757f('0x33')]=qs[_0x757f('0x34')](_0x4c7f62[_0x757f('0x2f')]['sort']);_0x4fac6c[_0x757f('0x35')]=qs[_0x757f('0x36')](_[_0x757f('0x37')](_0x4c7f62['query'],_0xc6966c[_0x757f('0x36')]),_0x8151e2);if(_0x4c7f62[_0x757f('0x2f')]['filter']){_0x4fac6c['where']=_['merge'](_0x4fac6c[_0x757f('0x35')],{'$or':_[_0x757f('0x28')](_0x8151e2,function(_0x483b98){if(_0x483b98[_0x757f('0x2c')]!=='VIRTUAL'){var _0x286df7={};_0x286df7[_0x483b98['name']]={'$like':'%'+_0x4c7f62[_0x757f('0x2f')][_0x757f('0x38')]+'%'};return _0x286df7;}})});}_0x4fac6c=_[_0x757f('0x39')]({},_0x4fac6c,_0x4c7f62[_0x757f('0x3a')]);var _0x3785f3={'where':_0x4fac6c[_0x757f('0x35')]};return db[_0x757f('0x29')][_0x757f('0x1b')](_0x3785f3)[_0x757f('0x21')](function(_0x2df05e){_0x4d0cc8[_0x757f('0x1b')]=_0x2df05e;if(_0x4c7f62[_0x757f('0x2f')][_0x757f('0x3b')]){_0x4fac6c[_0x757f('0x3c')]=[{'all':!![]}];}return db[_0x757f('0x29')][_0x757f('0x3d')](_0x4fac6c);})[_0x757f('0x21')](function(_0x41c665){_0x4d0cc8[_0x757f('0x3e')]=_0x41c665;return _0x4d0cc8;})[_0x757f('0x21')](respondWithFilteredResult(_0x4f11a7,_0x4fac6c))[_0x757f('0x3f')](handleError(_0x4f11a7,null));};exports['show']=function(_0x4adecc,_0x476d17){var _0x3bd6c4={'raw':!![],'where':{'id':_0x4adecc[_0x757f('0x40')]['id']}},_0x3d084b={};_0x3d084b[_0x757f('0x2e')]=_[_0x757f('0x41')](db['CmContactHasItem'][_0x757f('0x2a')]);_0x3d084b['query']=_[_0x757f('0x41')](_0x4adecc['query']);_0x3d084b[_0x757f('0x36')]=_['intersection'](_0x3d084b[_0x757f('0x2e')],_0x3d084b[_0x757f('0x2f')]);_0x3bd6c4[_0x757f('0x30')]=_[_0x757f('0x42')](_0x3d084b[_0x757f('0x2e')],qs[_0x757f('0x31')](_0x4adecc[_0x757f('0x2f')][_0x757f('0x31')]));_0x3bd6c4[_0x757f('0x30')]=_0x3bd6c4[_0x757f('0x30')][_0x757f('0x32')]?_0x3bd6c4[_0x757f('0x30')]:_0x3d084b[_0x757f('0x2e')];if(_0x4adecc[_0x757f('0x2f')][_0x757f('0x3b')]){_0x3bd6c4[_0x757f('0x3c')]=[{'all':!![]}];}_0x3bd6c4=_[_0x757f('0x39')]({},_0x3bd6c4,_0x4adecc[_0x757f('0x3a')]);return db[_0x757f('0x29')][_0x757f('0x43')](_0x3bd6c4)[_0x757f('0x21')](handleEntityNotFound(_0x476d17,null))[_0x757f('0x21')](respondWithResult(_0x476d17,null))[_0x757f('0x3f')](handleError(_0x476d17,null));};exports[_0x757f('0x44')]=function(_0x3e028f,_0x1ddc88){return db[_0x757f('0x29')][_0x757f('0x44')](_0x3e028f[_0x757f('0x45')],{})[_0x757f('0x21')](function(_0x4e2dca){var _0x13445d=_0x3e028f[_0x757f('0x46')][_0x757f('0x47')]({'plain':!![]});if(!_0x13445d)throw new Error(_0x757f('0x48'));if(_0x13445d[_0x757f('0x49')]===_0x757f('0x46')){var _0x29020c=_0x4e2dca[_0x757f('0x47')]({'plain':!![]});var _0x46bcd5=_0x757f('0x23');return db[_0x757f('0x4a')][_0x757f('0x43')]({'where':{'name':_0x46bcd5,'userProfileId':_0x13445d[_0x757f('0x4b')]},'raw':!![]})[_0x757f('0x21')](function(_0x3b58a7){if(_0x3b58a7&&_0x3b58a7[_0x757f('0x4c')]===0x0){return db[_0x757f('0x24')]['create']({'name':_0x29020c['name'],'resourceId':_0x29020c['id'],'type':_0x3b58a7['name'],'sectionId':_0x3b58a7['id']},{})['then'](function(){return _0x4e2dca;});}else{return _0x4e2dca;}})[_0x757f('0x3f')](function(_0x2bb791){logger[_0x757f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bb791);throw _0x2bb791;});}return _0x4e2dca;})[_0x757f('0x21')](respondWithResult(_0x1ddc88,0xc9))[_0x757f('0x3f')](handleError(_0x1ddc88,null));};exports['update']=function(_0x27e2b5,_0x1fabea){if(_0x27e2b5[_0x757f('0x45')]['id']){delete _0x27e2b5[_0x757f('0x45')]['id'];}return db[_0x757f('0x29')][_0x757f('0x43')]({'where':{'id':_0x27e2b5[_0x757f('0x40')]['id']}})[_0x757f('0x21')](handleEntityNotFound(_0x1fabea,null))[_0x757f('0x21')](saveUpdates(_0x27e2b5[_0x757f('0x45')],null))[_0x757f('0x21')](respondWithResult(_0x1fabea,null))[_0x757f('0x3f')](handleError(_0x1fabea,null));};exports[_0x757f('0x22')]=function(_0x2c2da1,_0x38f9fe){return db[_0x757f('0x29')][_0x757f('0x43')]({'where':{'id':_0x2c2da1[_0x757f('0x40')]['id']}})[_0x757f('0x21')](handleEntityNotFound(_0x38f9fe,null))[_0x757f('0x21')](removeEntity(_0x38f9fe,null))[_0x757f('0x3f')](handleError(_0x38f9fe,null));}; \ No newline at end of file +var _0x5825=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','then','UserProfileResource','error','name','send','index','map','CmContactHasItem','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','keys','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','rimraf','fast-json-patch'];(function(_0x51d48a,_0xf386e5){var _0x4021db=function(_0x4ef228){while(--_0x4ef228){_0x51d48a['push'](_0x51d48a['shift']());}};_0x4021db(++_0xf386e5);}(_0x5825,0x179));var _0x5582=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5825[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x5582('0x0'));var rimraf=require(_0x5582('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5582('0x2'));var rp=require(_0x5582('0x3'));var moment=require('moment');var BPromise=require(_0x5582('0x4'));var Mustache=require(_0x5582('0x5'));var util=require(_0x5582('0x6'));var path=require(_0x5582('0x7'));var sox=require(_0x5582('0x8'));var csv=require(_0x5582('0x9'));var ejs=require(_0x5582('0xa'));var fs=require('fs');var fs_extra=require(_0x5582('0xb'));var _=require('lodash');var squel=require(_0x5582('0xc'));var crypto=require(_0x5582('0xd'));var jsforce=require(_0x5582('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5582('0xf'));var Papa=require('papaparse');var Redis=require(_0x5582('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5582('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5582('0x12'))(_0x5582('0x13'));var utils=require(_0x5582('0x14'));var config=require(_0x5582('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5582('0x16'))['db'];function respondWithStatusCode(_0x18a7bb,_0x3745e2){_0x3745e2=_0x3745e2||0xcc;return function(_0x4123d4){if(_0x4123d4){return _0x18a7bb[_0x5582('0x17')](_0x3745e2);}return _0x18a7bb[_0x5582('0x18')](_0x3745e2)[_0x5582('0x19')]();};}function respondWithResult(_0x593e51,_0x21d851){_0x21d851=_0x21d851||0xc8;return function(_0x35f719){if(_0x35f719){return _0x593e51[_0x5582('0x18')](_0x21d851)[_0x5582('0x1a')](_0x35f719);}};}function respondWithFilteredResult(_0x5c8194,_0x2813e5){return function(_0x541b79){if(_0x541b79){var _0x1ab780=typeof _0x2813e5[_0x5582('0x1b')]===_0x5582('0x1c')&&typeof _0x2813e5['limit']===_0x5582('0x1c');var _0x50f019=_0x541b79[_0x5582('0x1d')];var _0x2bcae0=_0x1ab780?0x0:_0x2813e5[_0x5582('0x1b')];var _0x6763b2=_0x1ab780?_0x541b79[_0x5582('0x1d')]:_0x2813e5[_0x5582('0x1b')]+_0x2813e5[_0x5582('0x1e')];var _0x3cf3c9;if(_0x6763b2>=_0x50f019){_0x6763b2=_0x50f019;_0x3cf3c9=0xc8;}else{_0x3cf3c9=0xce;}_0x5c8194[_0x5582('0x18')](_0x3cf3c9);return _0x5c8194['set']('Content-Range',_0x2bcae0+'-'+_0x6763b2+'/'+_0x50f019)['json'](_0x541b79);}return null;};}function patchUpdates(_0x7b7d7c){return function(_0x50522c){try{jsonpatch[_0x5582('0x1f')](_0x50522c,_0x7b7d7c,!![]);}catch(_0x451c17){return BPromise[_0x5582('0x20')](_0x451c17);}return _0x50522c['save']();};}function saveUpdates(_0x202411,_0x2ad1f8){return function(_0x546c71){if(_0x546c71){return _0x546c71[_0x5582('0x21')](_0x202411)[_0x5582('0x22')](function(_0x343bab){return _0x343bab;});}return null;};}function removeEntity(_0x18bc7c,_0x24e286){return function(_0xb75f74){if(_0xb75f74){return _0xb75f74['destroy']()[_0x5582('0x22')](function(){var _0x33730b=_0xb75f74['get']({'plain':!![]});var _0xa394f='CmContactHasItems';return db[_0x5582('0x23')]['destroy']({'where':{'type':_0xa394f,'resourceId':_0x33730b['id']}})[_0x5582('0x22')](function(){return _0xb75f74;});})[_0x5582('0x22')](function(){_0x18bc7c[_0x5582('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30aa27,_0x5b391d){return function(_0x1a497){if(!_0x1a497){_0x30aa27[_0x5582('0x17')](0x194);}return _0x1a497;};}function handleError(_0x287b94,_0x4fd72f){_0x4fd72f=_0x4fd72f||0x1f4;return function(_0x31c0e8){logger[_0x5582('0x24')](_0x31c0e8['stack']);if(_0x31c0e8[_0x5582('0x25')]){delete _0x31c0e8[_0x5582('0x25')];}_0x287b94[_0x5582('0x18')](_0x4fd72f)[_0x5582('0x26')](_0x31c0e8);};}exports[_0x5582('0x27')]=function(_0x247658,_0x434264){var _0x578cce={},_0x7efb0a={},_0x92d57e={'count':0x0,'rows':[]};var _0x513c75=_[_0x5582('0x28')](db[_0x5582('0x29')][_0x5582('0x2a')],function(_0x18115b){return{'name':_0x18115b['fieldName'],'type':_0x18115b[_0x5582('0x2b')][_0x5582('0x2c')]};});_0x7efb0a[_0x5582('0x2d')]=_[_0x5582('0x28')](_0x513c75,_0x5582('0x25'));_0x7efb0a[_0x5582('0x2e')]=_['keys'](_0x247658['query']);_0x7efb0a[_0x5582('0x2f')]=_[_0x5582('0x30')](_0x7efb0a['model'],_0x7efb0a['query']);_0x578cce[_0x5582('0x31')]=_[_0x5582('0x30')](_0x7efb0a[_0x5582('0x2d')],qs[_0x5582('0x32')](_0x247658[_0x5582('0x2e')][_0x5582('0x32')]));_0x578cce[_0x5582('0x31')]=_0x578cce[_0x5582('0x31')]['length']?_0x578cce[_0x5582('0x31')]:_0x7efb0a[_0x5582('0x2d')];if(!_0x247658[_0x5582('0x2e')]['hasOwnProperty'](_0x5582('0x33'))){_0x578cce[_0x5582('0x1e')]=qs['limit'](_0x247658['query']['limit']);_0x578cce[_0x5582('0x1b')]=qs[_0x5582('0x1b')](_0x247658[_0x5582('0x2e')]['offset']);}_0x578cce[_0x5582('0x34')]=qs[_0x5582('0x35')](_0x247658[_0x5582('0x2e')]['sort']);_0x578cce[_0x5582('0x36')]=qs[_0x5582('0x2f')](_['pick'](_0x247658[_0x5582('0x2e')],_0x7efb0a[_0x5582('0x2f')]),_0x513c75);if(_0x247658['query'][_0x5582('0x37')]){_0x578cce[_0x5582('0x36')]=_[_0x5582('0x38')](_0x578cce['where'],{'$or':_[_0x5582('0x28')](_0x513c75,function(_0x1b9b1b){if(_0x1b9b1b[_0x5582('0x2b')]!==_0x5582('0x39')){var _0x4d876c={};_0x4d876c[_0x1b9b1b['name']]={'$like':'%'+_0x247658['query'][_0x5582('0x37')]+'%'};return _0x4d876c;}})});}_0x578cce=_[_0x5582('0x38')]({},_0x578cce,_0x247658['options']);var _0x597de6={'where':_0x578cce[_0x5582('0x36')]};return db[_0x5582('0x29')][_0x5582('0x1d')](_0x597de6)[_0x5582('0x22')](function(_0x368885){_0x92d57e[_0x5582('0x1d')]=_0x368885;if(_0x247658[_0x5582('0x2e')][_0x5582('0x3a')]){_0x578cce[_0x5582('0x3b')]=[{'all':!![]}];}return db[_0x5582('0x29')]['findAll'](_0x578cce);})[_0x5582('0x22')](function(_0x4aa2bc){_0x92d57e[_0x5582('0x3c')]=_0x4aa2bc;return _0x92d57e;})[_0x5582('0x22')](respondWithFilteredResult(_0x434264,_0x578cce))[_0x5582('0x3d')](handleError(_0x434264,null));};exports['show']=function(_0x109aa2,_0x2fd39e){var _0x28fa1b={'raw':!![],'where':{'id':_0x109aa2['params']['id']}},_0xdf5c9a={};_0xdf5c9a['model']=_[_0x5582('0x3e')](db['CmContactHasItem']['rawAttributes']);_0xdf5c9a['query']=_[_0x5582('0x3e')](_0x109aa2[_0x5582('0x2e')]);_0xdf5c9a[_0x5582('0x2f')]=_['intersection'](_0xdf5c9a['model'],_0xdf5c9a[_0x5582('0x2e')]);_0x28fa1b[_0x5582('0x31')]=_['intersection'](_0xdf5c9a['model'],qs[_0x5582('0x32')](_0x109aa2[_0x5582('0x2e')][_0x5582('0x32')]));_0x28fa1b[_0x5582('0x31')]=_0x28fa1b[_0x5582('0x31')][_0x5582('0x3f')]?_0x28fa1b[_0x5582('0x31')]:_0xdf5c9a[_0x5582('0x2d')];if(_0x109aa2[_0x5582('0x2e')][_0x5582('0x3a')]){_0x28fa1b['include']=[{'all':!![]}];}_0x28fa1b=_['merge']({},_0x28fa1b,_0x109aa2['options']);return db['CmContactHasItem']['find'](_0x28fa1b)[_0x5582('0x22')](handleEntityNotFound(_0x2fd39e,null))[_0x5582('0x22')](respondWithResult(_0x2fd39e,null))[_0x5582('0x3d')](handleError(_0x2fd39e,null));};exports['create']=function(_0x45aa7a,_0x35974f){return db[_0x5582('0x29')][_0x5582('0x40')](_0x45aa7a[_0x5582('0x41')],{})[_0x5582('0x22')](function(_0x95b31e){var _0x244dc8=_0x45aa7a[_0x5582('0x42')][_0x5582('0x43')]({'plain':!![]});if(!_0x244dc8)throw new Error(_0x5582('0x44'));if(_0x244dc8[_0x5582('0x45')]==='user'){var _0x1ae702=_0x95b31e[_0x5582('0x43')]({'plain':!![]});var _0x25c177=_0x5582('0x46');return db[_0x5582('0x47')][_0x5582('0x48')]({'where':{'name':_0x25c177,'userProfileId':_0x244dc8['userProfileId']},'raw':!![]})[_0x5582('0x22')](function(_0x4b80fe){if(_0x4b80fe&&_0x4b80fe['autoAssociation']===0x0){return db[_0x5582('0x23')][_0x5582('0x40')]({'name':_0x1ae702[_0x5582('0x25')],'resourceId':_0x1ae702['id'],'type':_0x4b80fe[_0x5582('0x25')],'sectionId':_0x4b80fe['id']},{})[_0x5582('0x22')](function(){return _0x95b31e;});}else{return _0x95b31e;}})[_0x5582('0x3d')](function(_0x5105da){logger[_0x5582('0x24')](_0x5582('0x49'),_0x5105da);throw _0x5105da;});}return _0x95b31e;})[_0x5582('0x22')](respondWithResult(_0x35974f,0xc9))[_0x5582('0x3d')](handleError(_0x35974f,null));};exports[_0x5582('0x21')]=function(_0x1e6582,_0x3dc20b){if(_0x1e6582[_0x5582('0x41')]['id']){delete _0x1e6582[_0x5582('0x41')]['id'];}return db[_0x5582('0x29')][_0x5582('0x48')]({'where':{'id':_0x1e6582[_0x5582('0x4a')]['id']}})[_0x5582('0x22')](handleEntityNotFound(_0x3dc20b,null))['then'](saveUpdates(_0x1e6582[_0x5582('0x41')],null))[_0x5582('0x22')](respondWithResult(_0x3dc20b,null))[_0x5582('0x3d')](handleError(_0x3dc20b,null));};exports[_0x5582('0x4b')]=function(_0x304086,_0xf64dca){return db[_0x5582('0x29')]['find']({'where':{'id':_0x304086[_0x5582('0x4a')]['id']}})[_0x5582('0x22')](handleEntityNotFound(_0xf64dca,null))[_0x5582('0x22')](removeEntity(_0xf64dca,null))['catch'](handleError(_0xf64dca,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4707541..203de7d 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 _0xc195=['../../config/environment','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1b90e0,_0x128583){var _0x2a26c4=function(_0x2a6e35){while(--_0x2a6e35){_0x1b90e0['push'](_0x1b90e0['shift']());}};_0x2a26c4(++_0x128583);}(_0xc195,0x9d));var _0x5c19=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0xc195[_0x58efa6];return _0x5d643c;};'use strict';var _=require(_0x5c19('0x0'));var util=require(_0x5c19('0x1'));var logger=require(_0x5c19('0x2'))(_0x5c19('0x3'));var moment=require('moment');var BPromise=require(_0x5c19('0x4'));var rp=require(_0x5c19('0x5'));var fs=require('fs');var path=require(_0x5c19('0x6'));var rimraf=require(_0x5c19('0x7'));var config=require(_0x5c19('0x8'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x1b3a1b,_0x2d5893){return _0x1b3a1b['define'](_0x5c19('0x9'),attributes,{'tableName':_0x5c19('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc014=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','CmContactHasItem','cm_contact_has_items'];(function(_0x493a97,_0x50a93e){var _0x51f171=function(_0x26a0bb){while(--_0x26a0bb){_0x493a97['push'](_0x493a97['shift']());}};_0x51f171(++_0x50a93e);}(_0xc014,0x82));var _0x4c01=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xc014[_0x5a2285];return _0x48f6ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c01('0x0'))(_0x4c01('0x1'));var moment=require(_0x4c01('0x2'));var BPromise=require(_0x4c01('0x3'));var rp=require(_0x4c01('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c01('0x5'));var config=require(_0x4c01('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x4c01('0x7')]=function(_0x3da40c,_0x161420){return _0x3da40c['define'](_0x4c01('0x8'),attributes,{'tableName':_0x4c01('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index fc63cc4..78f4ea9 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 _0x66b9=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x66b9,0x17d));var _0x966b=function(_0x27a9c9,_0x31398d){_0x27a9c9=_0x27a9c9-0x0;var _0x533616=_0x66b9[_0x27a9c9];return _0x533616;};'use strict';var _=require(_0x966b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x966b('0x1'));var rs=require(_0x966b('0x2'));var fs=require('fs');var Redis=require(_0x966b('0x3'));var db=require(_0x966b('0x4'))['db'];var utils=require(_0x966b('0x5'));var logger=require(_0x966b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x966b('0x7'));var client=jayson[_0x966b('0x8')][_0x966b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f05d8,_0x37d08c,_0xdfb170){return new BPromise(function(_0x1f96d8,_0x56754b){return client[_0x966b('0xa')](_0x3f05d8,_0xdfb170)[_0x966b('0xb')](function(_0x305fe2){logger[_0x966b('0xc')](_0x966b('0xd'),_0x37d08c,_0x966b('0xe'));logger[_0x966b('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x37d08c,_0x966b('0xe'),JSON[_0x966b('0x10')](_0x305fe2));if(_0x305fe2[_0x966b('0x11')]){if(_0x305fe2[_0x966b('0x11')]['code']===0x1f4){logger['error'](_0x966b('0xd'),_0x37d08c,_0x305fe2[_0x966b('0x11')][_0x966b('0x12')]);return _0x56754b(_0x305fe2[_0x966b('0x11')][_0x966b('0x12')]);}logger['error'](_0x966b('0xd'),_0x37d08c,_0x305fe2['error'][_0x966b('0x12')]);return _0x1f96d8(_0x305fe2[_0x966b('0x11')][_0x966b('0x12')]);}else{logger[_0x966b('0xc')](_0x966b('0xd'),_0x37d08c,'request\x20sent');_0x1f96d8(_0x305fe2['result'][_0x966b('0x12')]);}})[_0x966b('0x13')](function(_0x7d0286){logger[_0x966b('0x11')](_0x966b('0xd'),_0x37d08c,_0x7d0286);_0x56754b(_0x7d0286);});});} \ No newline at end of file +var _0x3cf9=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2a44b2,_0x5657fd){var _0x4b5fda=function(_0x373424){while(--_0x373424){_0x2a44b2['push'](_0x2a44b2['shift']());}};_0x4b5fda(++_0x5657fd);}(_0x3cf9,0xef));var _0x93cf=function(_0x37f5db,_0x25c1ae){_0x37f5db=_0x37f5db-0x0;var _0x18c6f4=_0x3cf9[_0x37f5db];return _0x18c6f4;};'use strict';var _=require(_0x93cf('0x0'));var util=require('util');var moment=require(_0x93cf('0x1'));var BPromise=require(_0x93cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93cf('0x3'));var db=require(_0x93cf('0x4'))['db'];var utils=require(_0x93cf('0x5'));var logger=require(_0x93cf('0x6'))(_0x93cf('0x7'));var config=require(_0x93cf('0x8'));var jayson=require(_0x93cf('0x9'));var client=jayson[_0x93cf('0xa')][_0x93cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19da90,_0x36cd07,_0x5d17df){return new BPromise(function(_0x349e1b,_0x4a12e0){return client[_0x93cf('0xc')](_0x19da90,_0x5d17df)[_0x93cf('0xd')](function(_0x4b2c8f){logger[_0x93cf('0xe')](_0x93cf('0xf'),_0x36cd07,_0x93cf('0x10'));logger[_0x93cf('0x11')](_0x93cf('0x12'),_0x36cd07,_0x93cf('0x10'),JSON['stringify'](_0x4b2c8f));if(_0x4b2c8f[_0x93cf('0x13')]){if(_0x4b2c8f[_0x93cf('0x13')][_0x93cf('0x14')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x36cd07,_0x4b2c8f[_0x93cf('0x13')][_0x93cf('0x15')]);return _0x4a12e0(_0x4b2c8f[_0x93cf('0x13')][_0x93cf('0x15')]);}logger['error'](_0x93cf('0xf'),_0x36cd07,_0x4b2c8f[_0x93cf('0x13')][_0x93cf('0x15')]);return _0x349e1b(_0x4b2c8f['error']['message']);}else{logger[_0x93cf('0xe')](_0x93cf('0xf'),_0x36cd07,'request\x20sent');_0x349e1b(_0x4b2c8f[_0x93cf('0x16')]['message']);}})['catch'](function(_0xa548e3){logger['error'](_0x93cf('0xf'),_0x36cd07,_0xa548e3);_0x4a12e0(_0xa548e3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 49c9175..41a313e 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 _0x6f58=['get','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x412ae3,_0x41f36d){var _0x54c755=function(_0x2cdd4b){while(--_0x2cdd4b){_0x412ae3['push'](_0x412ae3['shift']());}};_0x54c755(++_0x41f36d);}(_0x6f58,0x1ad));var _0x86f5=function(_0x2a8c35,_0x3da2a5){_0x2a8c35=_0x2a8c35-0x0;var _0x36c30e=_0x6f58[_0x2a8c35];return _0x36c30e;};'use strict';var multer=require('multer');var util=require(_0x86f5('0x0'));var path=require(_0x86f5('0x1'));var timeout=require(_0x86f5('0x2'));var express=require(_0x86f5('0x3'));var router=express[_0x86f5('0x4')]();var fs_extra=require(_0x86f5('0x5'));var auth=require(_0x86f5('0x6'));var interaction=require(_0x86f5('0x7'));var config=require(_0x86f5('0x8'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0x86f5('0x9')](),controller[_0x86f5('0xa')]);router[_0x86f5('0xb')](_0x86f5('0xc'),auth[_0x86f5('0x9')](),controller[_0x86f5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x86f5('0xe')]);router[_0x86f5('0xf')](_0x86f5('0xc'),auth['isAuthenticated'](),controller[_0x86f5('0x10')]);router[_0x86f5('0x11')](_0x86f5('0xc'),auth[_0x86f5('0x9')](),controller[_0x86f5('0x12')]);module[_0x86f5('0x13')]=router; \ No newline at end of file +var _0xb475=['isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmContactHasItem.controller'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb475,0x107));var _0x5b47=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xb475[_0x47408e];return _0x1636bc;};'use strict';var multer=require('multer');var util=require(_0x5b47('0x0'));var path=require('path');var timeout=require(_0x5b47('0x1'));var express=require(_0x5b47('0x2'));var router=express[_0x5b47('0x3')]();var fs_extra=require(_0x5b47('0x4'));var auth=require(_0x5b47('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b47('0x6'));router['get']('/',auth[_0x5b47('0x7')](),controller[_0x5b47('0x8')]);router[_0x5b47('0x9')]('/:id',auth[_0x5b47('0x7')](),controller[_0x5b47('0xa')]);router[_0x5b47('0xb')]('/',auth[_0x5b47('0x7')](),controller[_0x5b47('0xc')]);router[_0x5b47('0xd')](_0x5b47('0xe'),auth['isAuthenticated'](),controller[_0x5b47('0xf')]);router[_0x5b47('0x10')](_0x5b47('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b47('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 0b4a95d..e94eb48 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 _0xd705=['alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','values','isArray','stringify','BOOLEAN','voice','sequelize','lodash','exports'];(function(_0x249c67,_0x13df73){var _0x48c9e9=function(_0x53cd5f){while(--_0x53cd5f){_0x249c67['push'](_0x249c67['shift']());}};_0x48c9e9(++_0x13df73);}(_0xd705,0x12d));var _0x5d70=function(_0x18a933,_0x3e963e){_0x18a933=_0x18a933-0x0;var _0x4f133e=_0xd705[_0x18a933];return _0x4f133e;};'use strict';var Sequelize=require(_0x5d70('0x0'));var _=require(_0x5d70('0x1'));module[_0x5d70('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x389b88){return this['getDataValue'](_0x5d70('0x3'));}},'alias':{'type':Sequelize[_0x5d70('0x4')],'allowNull':![],'set':function(_0x14640e){this[_0x5d70('0x5')](_0x5d70('0x3'),_0x14640e?_0x14640e:this[_0x5d70('0x6')](_0x5d70('0x7')));}},'type':{'type':Sequelize[_0x5d70('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x5d70('0x8')](_0x5d70('0x9')),'get':function(){if(this[_0x5d70('0x6')](_0x5d70('0xa'))==='select'){return JSON['parse'](this[_0x5d70('0x6')](_0x5d70('0xb')));}else{return this[_0x5d70('0x6')](_0x5d70('0xb'));}},'set':function(_0x4242b6){if(Array[_0x5d70('0xc')](_0x4242b6)){this['setDataValue'](_0x5d70('0xb'),JSON[_0x5d70('0xd')](_0x4242b6));}else{this[_0x5d70('0x5')](_0x5d70('0xb'),_0x4242b6);}}},'required':{'type':Sequelize[_0x5d70('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5d70('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x5d70('0xf'))}}; \ No newline at end of file +var _0x1157=['type','select','values','BOOLEAN','voice','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','name','long'];(function(_0x320edf,_0x3b5733){var _0x2271a7=function(_0x4d1e13){while(--_0x4d1e13){_0x320edf['push'](_0x320edf['shift']());}};_0x2271a7(++_0x3b5733);}(_0x1157,0x157));var _0x7115=function(_0x2477b6,_0x2d8d66){_0x2477b6=_0x2477b6-0x0;var _0x290e93=_0x1157[_0x2477b6];return _0x290e93;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7115('0x0'));module[_0x7115('0x1')]={'name':{'type':Sequelize[_0x7115('0x2')],'get':function(_0x4dab6c){return this[_0x7115('0x3')]('alias');}},'alias':{'type':Sequelize[_0x7115('0x4')],'allowNull':![],'set':function(_0x38c7e1){this[_0x7115('0x5')]('alias',_0x38c7e1?_0x38c7e1:this[_0x7115('0x3')](_0x7115('0x6')));}},'type':{'type':Sequelize[_0x7115('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x7115('0x7')),'get':function(){if(this[_0x7115('0x3')](_0x7115('0x8'))===_0x7115('0x9')){return JSON['parse'](this['getDataValue'](_0x7115('0xa')));}else{return this[_0x7115('0x3')](_0x7115('0xa'));}},'set':function(_0x1de861){if(Array['isArray'](_0x1de861)){this[_0x7115('0x5')](_0x7115('0xa'),JSON['stringify'](_0x1de861));}else{this[_0x7115('0x5')]('values',_0x1de861);}}},'required':{'type':Sequelize[_0x7115('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7115('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x7115('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1001d40..afe1be5 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 _0x63b6=['moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','CmCustomField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','find','body','create','TEXT','text','Sequelize','number','INTEGER','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch'];(function(_0x527812,_0xf0a536){var _0x7326eb=function(_0x550ae9){while(--_0x550ae9){_0x527812['push'](_0x527812['shift']());}};_0x7326eb(++_0xf0a536);}(_0x63b6,0x19c));var _0x663b=function(_0x3941cf,_0x2423ac){_0x3941cf=_0x3941cf-0x0;var _0xd814f7=_0x63b6[_0x3941cf];return _0xd814f7;};'use strict';var emlformat=require(_0x663b('0x0'));var rimraf=require(_0x663b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x663b('0x2'));var rp=require('request-promise');var moment=require(_0x663b('0x3'));var BPromise=require(_0x663b('0x4'));var Mustache=require('mustache');var util=require(_0x663b('0x5'));var path=require(_0x663b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663b('0x7'));var squel=require(_0x663b('0x8'));var crypto=require(_0x663b('0x9'));var jsforce=require(_0x663b('0xa'));var deskjs=require(_0x663b('0xb'));var toCsv=require(_0x663b('0xc'));var querystring=require(_0x663b('0xd'));var Papa=require(_0x663b('0xe'));var Redis=require(_0x663b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x663b('0x10'));var as=require(_0x663b('0x11'));var hardwareService=require(_0x663b('0x12'));var logger=require('../../config/logger')(_0x663b('0x13'));var utils=require(_0x663b('0x14'));var config=require(_0x663b('0x15'));var licenseUtil=require(_0x663b('0x16'));var db=require(_0x663b('0x17'))['db'];function respondWithStatusCode(_0x586408,_0x2d724c){_0x2d724c=_0x2d724c||0xcc;return function(_0x254217){if(_0x254217){return _0x586408['sendStatus'](_0x2d724c);}return _0x586408[_0x663b('0x18')](_0x2d724c)[_0x663b('0x19')]();};}function respondWithResult(_0x52f933,_0x5b7ee1){_0x5b7ee1=_0x5b7ee1||0xc8;return function(_0x1ec878){if(_0x1ec878){return _0x52f933[_0x663b('0x18')](_0x5b7ee1)['json'](_0x1ec878);}};}function respondWithFilteredResult(_0x376cc9,_0x5df866){return function(_0x41d158){if(_0x41d158){var _0x398b65=typeof _0x5df866[_0x663b('0x1a')]===_0x663b('0x1b')&&typeof _0x5df866[_0x663b('0x1c')]==='undefined';var _0x1edc16=_0x41d158['count'];var _0x590f44=_0x398b65?0x0:_0x5df866[_0x663b('0x1a')];var _0xf4df0d=_0x398b65?_0x41d158[_0x663b('0x1d')]:_0x5df866[_0x663b('0x1a')]+_0x5df866[_0x663b('0x1c')];var _0xb42ca;if(_0xf4df0d>=_0x1edc16){_0xf4df0d=_0x1edc16;_0xb42ca=0xc8;}else{_0xb42ca=0xce;}_0x376cc9['status'](_0xb42ca);return _0x376cc9['set'](_0x663b('0x1e'),_0x590f44+'-'+_0xf4df0d+'/'+_0x1edc16)[_0x663b('0x1f')](_0x41d158);}return null;};}function patchUpdates(_0x22899f){return function(_0x3ac30b){try{jsonpatch[_0x663b('0x20')](_0x3ac30b,_0x22899f,!![]);}catch(_0xe6a6a8){return BPromise[_0x663b('0x21')](_0xe6a6a8);}return _0x3ac30b[_0x663b('0x22')]();};}function saveUpdates(_0x58da2a,_0x17fa54){return function(_0x5ac5e6){if(_0x5ac5e6){return _0x5ac5e6[_0x663b('0x23')](_0x58da2a)[_0x663b('0x24')](function(_0x35b70a){return _0x35b70a;});}return null;};}function removeEntity(_0xf1c31a,_0x2f2f64){return function(_0x5ec300){if(_0x5ec300){return _0x5ec300[_0x663b('0x25')]()['then'](function(){_0xf1c31a[_0x663b('0x18')](0xcc)[_0x663b('0x19')]();});}};}function handleEntityNotFound(_0x145c9f,_0x55cd29){return function(_0x22bbe1){if(!_0x22bbe1){_0x145c9f['sendStatus'](0x194);}return _0x22bbe1;};}function handleError(_0x9e11aa,_0x551415){_0x551415=_0x551415||0x1f4;return function(_0x2b6f52){logger['error'](_0x2b6f52[_0x663b('0x26')]);if(_0x2b6f52[_0x663b('0x27')]){delete _0x2b6f52[_0x663b('0x27')];}_0x9e11aa[_0x663b('0x18')](_0x551415)['send'](_0x2b6f52);};}exports[_0x663b('0x28')]=function(_0x2685c3,_0xb0d65d){var _0x183ebd={},_0x59f871={},_0x22c4fd={'count':0x0,'rows':[]};var _0x1950a3=_[_0x663b('0x29')](db[_0x663b('0x2a')][_0x663b('0x2b')],function(_0x4299a0){return{'name':_0x4299a0['fieldName'],'type':_0x4299a0[_0x663b('0x2c')][_0x663b('0x2d')]};});_0x59f871[_0x663b('0x2e')]=_['differenceBy'](_[_0x663b('0x29')](_0x1950a3,_0x663b('0x27')),[_0x663b('0x27')]);_0x59f871[_0x663b('0x2f')]=_['keys'](_0x2685c3[_0x663b('0x2f')]);_0x59f871[_0x663b('0x30')]=_[_0x663b('0x31')](_0x59f871[_0x663b('0x2e')],_0x59f871[_0x663b('0x2f')]);_0x183ebd[_0x663b('0x32')]=_[_0x663b('0x31')](_0x59f871[_0x663b('0x2e')],qs[_0x663b('0x33')](_0x2685c3[_0x663b('0x2f')]['fields']));_0x183ebd[_0x663b('0x32')]=_0x183ebd[_0x663b('0x32')][_0x663b('0x34')]?_0x183ebd[_0x663b('0x32')]:_0x59f871['model'];if(!_0x2685c3[_0x663b('0x2f')][_0x663b('0x35')](_0x663b('0x36'))){_0x183ebd[_0x663b('0x1c')]=qs[_0x663b('0x1c')](_0x2685c3[_0x663b('0x2f')][_0x663b('0x1c')]);_0x183ebd[_0x663b('0x1a')]=qs[_0x663b('0x1a')](_0x2685c3[_0x663b('0x2f')][_0x663b('0x1a')]);}_0x183ebd[_0x663b('0x37')]=qs[_0x663b('0x38')](_0x2685c3[_0x663b('0x2f')][_0x663b('0x38')]);_0x183ebd[_0x663b('0x39')]=qs[_0x663b('0x30')](_[_0x663b('0x3a')](_0x2685c3[_0x663b('0x2f')],_0x59f871[_0x663b('0x30')]),_0x1950a3);if(_0x2685c3[_0x663b('0x2f')][_0x663b('0x3b')]){_0x183ebd[_0x663b('0x39')]=_['merge'](_0x183ebd[_0x663b('0x39')],{'$or':_[_0x663b('0x29')](_0x1950a3,function(_0x491233){if(_0x491233['type']!=='VIRTUAL'){var _0x2c87f3={};_0x2c87f3[_0x491233['name']]={'$like':'%'+_0x2685c3[_0x663b('0x2f')][_0x663b('0x3b')]+'%'};return _0x2c87f3;}})});}_0x183ebd=_['merge']({},_0x183ebd,_0x2685c3['options']);var _0x45dcdb={'where':_0x183ebd[_0x663b('0x39')]};return db[_0x663b('0x2a')][_0x663b('0x1d')](_0x45dcdb)[_0x663b('0x24')](function(_0x351848){_0x22c4fd[_0x663b('0x1d')]=_0x351848;if(_0x2685c3[_0x663b('0x2f')][_0x663b('0x3c')]){_0x183ebd[_0x663b('0x3d')]=[{'all':!![]}];}return db['CmCustomField'][_0x663b('0x3e')](_0x183ebd);})['then'](function(_0xb002a9){_0x22c4fd[_0x663b('0x3f')]=_0xb002a9;return _0x22c4fd;})['then'](respondWithFilteredResult(_0xb0d65d,_0x183ebd))[_0x663b('0x40')](handleError(_0xb0d65d,null));};exports[_0x663b('0x41')]=function(_0x3d6639,_0x22b7fb){var _0x3f74d2={'raw':!![],'where':{'id':_0x3d6639[_0x663b('0x42')]['id']}},_0x438b5b={};_0x438b5b[_0x663b('0x2e')]=_[_0x663b('0x43')](db[_0x663b('0x2a')][_0x663b('0x2b')]);_0x438b5b[_0x663b('0x2f')]=_[_0x663b('0x43')](_0x3d6639[_0x663b('0x2f')]);_0x438b5b['filters']=_['intersection'](_0x438b5b['model'],_0x438b5b['query']);_0x3f74d2['attributes']=_[_0x663b('0x31')](_0x438b5b[_0x663b('0x2e')],qs[_0x663b('0x33')](_0x3d6639[_0x663b('0x2f')]['fields']));_0x3f74d2[_0x663b('0x32')]=_0x3f74d2[_0x663b('0x32')][_0x663b('0x34')]?_0x3f74d2[_0x663b('0x32')]:_0x438b5b[_0x663b('0x2e')];if(_0x3d6639[_0x663b('0x2f')][_0x663b('0x3c')]){_0x3f74d2[_0x663b('0x3d')]=[{'all':!![]}];}_0x3f74d2=_[_0x663b('0x44')]({},_0x3f74d2,_0x3d6639[_0x663b('0x45')]);return db[_0x663b('0x2a')][_0x663b('0x46')](_0x3f74d2)[_0x663b('0x24')](handleEntityNotFound(_0x22b7fb,null))['then'](respondWithResult(_0x22b7fb,null))[_0x663b('0x40')](handleError(_0x22b7fb,null));};exports[_0x663b('0x23')]=function(_0x1489d7,_0x1af508){if(_0x1489d7['body']['id']){delete _0x1489d7[_0x663b('0x47')]['id'];}return db[_0x663b('0x2a')][_0x663b('0x46')]({'where':{'id':_0x1489d7[_0x663b('0x42')]['id']}})[_0x663b('0x24')](handleEntityNotFound(_0x1af508,null))['then'](saveUpdates(_0x1489d7['body'],null))[_0x663b('0x24')](respondWithResult(_0x1af508,null))[_0x663b('0x40')](handleError(_0x1af508,null));};exports[_0x663b('0x25')]=function(_0x58aff6,_0x2a5832){return db['CmCustomField'][_0x663b('0x46')]({'where':{'id':_0x58aff6['params']['id']}})[_0x663b('0x24')](handleEntityNotFound(_0x2a5832,null))[_0x663b('0x24')](removeEntity(_0x2a5832,null))['catch'](handleError(_0x2a5832,null));};exports[_0x663b('0x48')]=function(_0x1dccea,_0x3c876f){var _0x5f3db2;return db['sequelize']['transaction'](function(_0x314818){return db[_0x663b('0x2a')][_0x663b('0x48')](_0x1dccea['body'],{'transaction':_0x314818})['then'](function(_0x39f91a){_0x5f3db2=_0x39f91a;var _0x5873c9={'type':db['Sequelize'][_0x663b('0x49')],'transaction':_0x314818};switch(_0x1dccea[_0x663b('0x47')]['type']){case _0x663b('0x4a'):_0x5873c9[_0x663b('0x2c')]=db[_0x663b('0x4b')][_0x663b('0x49')];break;case _0x663b('0x4c'):_0x5873c9[_0x663b('0x2c')]=db[_0x663b('0x4b')][_0x663b('0x4d')];break;case'switch':_0x5873c9[_0x663b('0x2c')]=db[_0x663b('0x4b')]['BOOLEAN'];_0x5873c9[_0x663b('0x4e')]=![];break;default:}return db['sequelize'][_0x663b('0x4f')][_0x663b('0x50')]('cm_contacts',util[_0x663b('0x51')](_0x663b('0x52'),_0x5f3db2['id']),_0x5873c9);})['then'](function(){return _0x5f3db2;});})['then'](respondWithResult(_0x3c876f,0xc9))[_0x663b('0x40')](handleError(_0x3c876f,null));}; \ No newline at end of file +var _0xfd16=['offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','body','params','create','sequelize','transaction','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x502105,_0x168997){var _0xfacf5c=function(_0x4baeb4){while(--_0x4baeb4){_0x502105['push'](_0x502105['shift']());}};_0xfacf5c(++_0x168997);}(_0xfd16,0xe8));var _0x6fd1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfd16[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x6fd1('0x0'));var rimraf=require(_0x6fd1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fd1('0x2'));var rp=require(_0x6fd1('0x3'));var moment=require('moment');var BPromise=require(_0x6fd1('0x4'));var Mustache=require(_0x6fd1('0x5'));var util=require(_0x6fd1('0x6'));var path=require(_0x6fd1('0x7'));var sox=require(_0x6fd1('0x8'));var csv=require(_0x6fd1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fd1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6fd1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6fd1('0x9'));var querystring=require('querystring');var Papa=require(_0x6fd1('0xc'));var Redis=require(_0x6fd1('0xd'));var authService=require(_0x6fd1('0xe'));var qs=require(_0x6fd1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fd1('0x10'))(_0x6fd1('0x11'));var utils=require(_0x6fd1('0x12'));var config=require(_0x6fd1('0x13'));var licenseUtil=require(_0x6fd1('0x14'));var db=require(_0x6fd1('0x15'))['db'];function respondWithStatusCode(_0x1ba0d3,_0x386674){_0x386674=_0x386674||0xcc;return function(_0x31051e){if(_0x31051e){return _0x1ba0d3[_0x6fd1('0x16')](_0x386674);}return _0x1ba0d3[_0x6fd1('0x17')](_0x386674)[_0x6fd1('0x18')]();};}function respondWithResult(_0x384b8d,_0x17e72a){_0x17e72a=_0x17e72a||0xc8;return function(_0x4f8990){if(_0x4f8990){return _0x384b8d[_0x6fd1('0x17')](_0x17e72a)[_0x6fd1('0x19')](_0x4f8990);}};}function respondWithFilteredResult(_0x20f76d,_0x278b25){return function(_0x2b93f6){if(_0x2b93f6){var _0x376990=typeof _0x278b25[_0x6fd1('0x1a')]===_0x6fd1('0x1b')&&typeof _0x278b25[_0x6fd1('0x1c')]===_0x6fd1('0x1b');var _0x226c39=_0x2b93f6[_0x6fd1('0x1d')];var _0x5b4f13=_0x376990?0x0:_0x278b25[_0x6fd1('0x1a')];var _0x200969=_0x376990?_0x2b93f6['count']:_0x278b25[_0x6fd1('0x1a')]+_0x278b25['limit'];var _0x54528c;if(_0x200969>=_0x226c39){_0x200969=_0x226c39;_0x54528c=0xc8;}else{_0x54528c=0xce;}_0x20f76d[_0x6fd1('0x17')](_0x54528c);return _0x20f76d[_0x6fd1('0x1e')](_0x6fd1('0x1f'),_0x5b4f13+'-'+_0x200969+'/'+_0x226c39)['json'](_0x2b93f6);}return null;};}function patchUpdates(_0x29736e){return function(_0x26e0e4){try{jsonpatch['apply'](_0x26e0e4,_0x29736e,!![]);}catch(_0x20b79a){return BPromise['reject'](_0x20b79a);}return _0x26e0e4[_0x6fd1('0x20')]();};}function saveUpdates(_0x40742e,_0x5c0d7e){return function(_0x33dfd1){if(_0x33dfd1){return _0x33dfd1[_0x6fd1('0x21')](_0x40742e)[_0x6fd1('0x22')](function(_0x471a8b){return _0x471a8b;});}return null;};}function removeEntity(_0x1beaba,_0x38833b){return function(_0x164774){if(_0x164774){return _0x164774['destroy']()[_0x6fd1('0x22')](function(){_0x1beaba[_0x6fd1('0x17')](0xcc)[_0x6fd1('0x18')]();});}};}function handleEntityNotFound(_0x7d70c8,_0x36a869){return function(_0x1187b6){if(!_0x1187b6){_0x7d70c8[_0x6fd1('0x16')](0x194);}return _0x1187b6;};}function handleError(_0x1b75ae,_0x35a816){_0x35a816=_0x35a816||0x1f4;return function(_0x509f40){logger[_0x6fd1('0x23')](_0x509f40[_0x6fd1('0x24')]);if(_0x509f40[_0x6fd1('0x25')]){delete _0x509f40['name'];}_0x1b75ae[_0x6fd1('0x17')](_0x35a816)[_0x6fd1('0x26')](_0x509f40);};}exports[_0x6fd1('0x27')]=function(_0x123437,_0x1930eb){var _0x352bb9={},_0x235134={},_0x1aeea0={'count':0x0,'rows':[]};var _0x5b0b6d=_[_0x6fd1('0x28')](db[_0x6fd1('0x29')][_0x6fd1('0x2a')],function(_0x7e97bc){return{'name':_0x7e97bc[_0x6fd1('0x2b')],'type':_0x7e97bc[_0x6fd1('0x2c')]['key']};});_0x235134['model']=_[_0x6fd1('0x2d')](_['map'](_0x5b0b6d,_0x6fd1('0x25')),[_0x6fd1('0x25')]);_0x235134[_0x6fd1('0x2e')]=_[_0x6fd1('0x2f')](_0x123437['query']);_0x235134['filters']=_[_0x6fd1('0x30')](_0x235134[_0x6fd1('0x31')],_0x235134[_0x6fd1('0x2e')]);_0x352bb9[_0x6fd1('0x32')]=_[_0x6fd1('0x30')](_0x235134[_0x6fd1('0x31')],qs['fields'](_0x123437[_0x6fd1('0x2e')][_0x6fd1('0x33')]));_0x352bb9[_0x6fd1('0x32')]=_0x352bb9[_0x6fd1('0x32')][_0x6fd1('0x34')]?_0x352bb9[_0x6fd1('0x32')]:_0x235134[_0x6fd1('0x31')];if(!_0x123437[_0x6fd1('0x2e')][_0x6fd1('0x35')](_0x6fd1('0x36'))){_0x352bb9[_0x6fd1('0x1c')]=qs['limit'](_0x123437['query']['limit']);_0x352bb9['offset']=qs[_0x6fd1('0x1a')](_0x123437[_0x6fd1('0x2e')][_0x6fd1('0x1a')]);}_0x352bb9[_0x6fd1('0x37')]=qs[_0x6fd1('0x38')](_0x123437[_0x6fd1('0x2e')][_0x6fd1('0x38')]);_0x352bb9['where']=qs[_0x6fd1('0x39')](_[_0x6fd1('0x3a')](_0x123437[_0x6fd1('0x2e')],_0x235134[_0x6fd1('0x39')]),_0x5b0b6d);if(_0x123437[_0x6fd1('0x2e')]['filter']){_0x352bb9['where']=_[_0x6fd1('0x3b')](_0x352bb9[_0x6fd1('0x3c')],{'$or':_[_0x6fd1('0x28')](_0x5b0b6d,function(_0x2655f1){if(_0x2655f1[_0x6fd1('0x2c')]!==_0x6fd1('0x3d')){var _0x85bb0c={};_0x85bb0c[_0x2655f1[_0x6fd1('0x25')]]={'$like':'%'+_0x123437[_0x6fd1('0x2e')][_0x6fd1('0x3e')]+'%'};return _0x85bb0c;}})});}_0x352bb9=_['merge']({},_0x352bb9,_0x123437[_0x6fd1('0x3f')]);var _0x10dd25={'where':_0x352bb9[_0x6fd1('0x3c')]};return db[_0x6fd1('0x29')][_0x6fd1('0x1d')](_0x10dd25)['then'](function(_0x2c6019){_0x1aeea0[_0x6fd1('0x1d')]=_0x2c6019;if(_0x123437['query'][_0x6fd1('0x40')]){_0x352bb9[_0x6fd1('0x41')]=[{'all':!![]}];}return db[_0x6fd1('0x29')][_0x6fd1('0x42')](_0x352bb9);})[_0x6fd1('0x22')](function(_0x276c11){_0x1aeea0['rows']=_0x276c11;return _0x1aeea0;})['then'](respondWithFilteredResult(_0x1930eb,_0x352bb9))[_0x6fd1('0x43')](handleError(_0x1930eb,null));};exports[_0x6fd1('0x44')]=function(_0x5a1598,_0x2b1cd3){var _0x21aed0={'raw':!![],'where':{'id':_0x5a1598['params']['id']}},_0x354586={};_0x354586[_0x6fd1('0x31')]=_[_0x6fd1('0x2f')](db[_0x6fd1('0x29')][_0x6fd1('0x2a')]);_0x354586[_0x6fd1('0x2e')]=_['keys'](_0x5a1598[_0x6fd1('0x2e')]);_0x354586['filters']=_[_0x6fd1('0x30')](_0x354586[_0x6fd1('0x31')],_0x354586[_0x6fd1('0x2e')]);_0x21aed0[_0x6fd1('0x32')]=_[_0x6fd1('0x30')](_0x354586[_0x6fd1('0x31')],qs[_0x6fd1('0x33')](_0x5a1598[_0x6fd1('0x2e')]['fields']));_0x21aed0['attributes']=_0x21aed0['attributes'][_0x6fd1('0x34')]?_0x21aed0[_0x6fd1('0x32')]:_0x354586['model'];if(_0x5a1598[_0x6fd1('0x2e')][_0x6fd1('0x40')]){_0x21aed0[_0x6fd1('0x41')]=[{'all':!![]}];}_0x21aed0=_[_0x6fd1('0x3b')]({},_0x21aed0,_0x5a1598[_0x6fd1('0x3f')]);return db[_0x6fd1('0x29')][_0x6fd1('0x45')](_0x21aed0)[_0x6fd1('0x22')](handleEntityNotFound(_0x2b1cd3,null))[_0x6fd1('0x22')](respondWithResult(_0x2b1cd3,null))[_0x6fd1('0x43')](handleError(_0x2b1cd3,null));};exports[_0x6fd1('0x21')]=function(_0x448005,_0x4fa114){if(_0x448005[_0x6fd1('0x46')]['id']){delete _0x448005[_0x6fd1('0x46')]['id'];}return db['CmCustomField'][_0x6fd1('0x45')]({'where':{'id':_0x448005[_0x6fd1('0x47')]['id']}})[_0x6fd1('0x22')](handleEntityNotFound(_0x4fa114,null))[_0x6fd1('0x22')](saveUpdates(_0x448005[_0x6fd1('0x46')],null))[_0x6fd1('0x22')](respondWithResult(_0x4fa114,null))[_0x6fd1('0x43')](handleError(_0x4fa114,null));};exports['destroy']=function(_0x51d9ba,_0x3abbc4){return db['CmCustomField']['find']({'where':{'id':_0x51d9ba[_0x6fd1('0x47')]['id']}})[_0x6fd1('0x22')](handleEntityNotFound(_0x3abbc4,null))[_0x6fd1('0x22')](removeEntity(_0x3abbc4,null))[_0x6fd1('0x43')](handleError(_0x3abbc4,null));};exports[_0x6fd1('0x48')]=function(_0x32a423,_0x5ebe12){var _0x119bcc;return db[_0x6fd1('0x49')][_0x6fd1('0x4a')](function(_0x220410){return db[_0x6fd1('0x29')]['create'](_0x32a423[_0x6fd1('0x46')],{'transaction':_0x220410})[_0x6fd1('0x22')](function(_0xb8de1d){_0x119bcc=_0xb8de1d;var _0x30e4e5={'type':db['Sequelize'][_0x6fd1('0x4b')],'transaction':_0x220410};switch(_0x32a423[_0x6fd1('0x46')][_0x6fd1('0x2c')]){case _0x6fd1('0x4c'):_0x30e4e5[_0x6fd1('0x2c')]=db[_0x6fd1('0x4d')][_0x6fd1('0x4b')];break;case'number':_0x30e4e5[_0x6fd1('0x2c')]=db[_0x6fd1('0x4d')][_0x6fd1('0x4e')];break;case _0x6fd1('0x4f'):_0x30e4e5['type']=db[_0x6fd1('0x4d')][_0x6fd1('0x50')];_0x30e4e5[_0x6fd1('0x51')]=![];break;default:}return db[_0x6fd1('0x49')][_0x6fd1('0x52')][_0x6fd1('0x53')](_0x6fd1('0x54'),util[_0x6fd1('0x55')]('cf_%d',_0x119bcc['id']),_0x30e4e5);})[_0x6fd1('0x22')](function(){return _0x119bcc;});})[_0x6fd1('0x22')](respondWithResult(_0x5ebe12,0xc9))[_0x6fd1('0x43')](handleError(_0x5ebe12,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index b814399..ebf7e48 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 _0xdfc9=['api','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xdfc9,0xb2));var _0x9dfc=function(_0x2ef714,_0x49e1c4){_0x2ef714=_0x2ef714-0x0;var _0x252ab0=_0xdfc9[_0x2ef714];return _0x252ab0;};'use strict';var _=require(_0x9dfc('0x0'));var util=require('util');var logger=require(_0x9dfc('0x1'))(_0x9dfc('0x2'));var moment=require(_0x9dfc('0x3'));var BPromise=require('bluebird');var rp=require(_0x9dfc('0x4'));var fs=require('fs');var path=require(_0x9dfc('0x5'));var rimraf=require('rimraf');var config=require(_0x9dfc('0x6'));var attributes=require(_0x9dfc('0x7'));module[_0x9dfc('0x8')]=function(_0x4f2b65,_0x4dcb49){return _0x4f2b65[_0x9dfc('0x9')](_0x9dfc('0xa'),attributes,{'tableName':_0x9dfc('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb667=['path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','bluebird'];(function(_0x8a7911,_0x36068b){var _0x4914ff=function(_0x2433c9){while(--_0x2433c9){_0x8a7911['push'](_0x8a7911['shift']());}};_0x4914ff(++_0x36068b);}(_0xb667,0x11a));var _0x7b66=function(_0x16e3d6,_0x1e61dc){_0x16e3d6=_0x16e3d6-0x0;var _0x5b0514=_0xb667[_0x16e3d6];return _0x5b0514;};'use strict';var _=require('lodash');var util=require(_0x7b66('0x0'));var logger=require(_0x7b66('0x1'))(_0x7b66('0x2'));var moment=require('moment');var BPromise=require(_0x7b66('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b66('0x4'));var rimraf=require(_0x7b66('0x5'));var config=require(_0x7b66('0x6'));var attributes=require(_0x7b66('0x7'));module['exports']=function(_0x367cf1,_0xb04bb4){return _0x367cf1[_0x7b66('0x8')](_0x7b66('0x9'),attributes,{'tableName':_0x7b66('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index a5e6b12..2bd6a6b 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 _0x0708=['then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x28521e,_0x466d88){var _0xd651fd=function(_0x3cf52d){while(--_0x3cf52d){_0x28521e['push'](_0x28521e['shift']());}};_0xd651fd(++_0x466d88);}(_0x0708,0xbd));var _0x8070=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x0708[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x8070('0x0'));var util=require(_0x8070('0x1'));var moment=require(_0x8070('0x2'));var BPromise=require(_0x8070('0x3'));var rs=require(_0x8070('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8070('0x5'))('rpc');var config=require(_0x8070('0x6'));var jayson=require(_0x8070('0x7'));var client=jayson[_0x8070('0x8')][_0x8070('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43cbac,_0x1fda42,_0x153acf){return new BPromise(function(_0x4a37e5,_0x213960){return client[_0x8070('0xa')](_0x43cbac,_0x153acf)[_0x8070('0xb')](function(_0x4665c7){logger['info'](_0x8070('0xc'),_0x1fda42,'request\x20sent');logger[_0x8070('0xd')](_0x8070('0xe'),_0x1fda42,'request\x20sent',JSON[_0x8070('0xf')](_0x4665c7));if(_0x4665c7[_0x8070('0x10')]){if(_0x4665c7['error']['code']===0x1f4){logger[_0x8070('0x10')](_0x8070('0xc'),_0x1fda42,_0x4665c7[_0x8070('0x10')][_0x8070('0x11')]);return _0x213960(_0x4665c7[_0x8070('0x10')][_0x8070('0x11')]);}logger[_0x8070('0x10')]('CmCustomField,\x20%s,\x20%s',_0x1fda42,_0x4665c7[_0x8070('0x10')]['message']);return _0x4a37e5(_0x4665c7['error'][_0x8070('0x11')]);}else{logger['info'](_0x8070('0xc'),_0x1fda42,_0x8070('0x12'));_0x4a37e5(_0x4665c7['result']['message']);}})[_0x8070('0x13')](function(_0x31e6e6){logger['error']('CmCustomField,\x20%s,\x20%s',_0x1fda42,_0x31e6e6);_0x213960(_0x31e6e6);});});} \ No newline at end of file +var _0x8f4c=['CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0xef93cf,_0x5ea4af){var _0x1cbc62=function(_0x281011){while(--_0x281011){_0xef93cf['push'](_0xef93cf['shift']());}};_0x1cbc62(++_0x5ea4af);}(_0x8f4c,0x1c1));var _0xc8f4=function(_0x51bee5,_0x11b9b8){_0x51bee5=_0x51bee5-0x0;var _0x556ae3=_0x8f4c[_0x51bee5];return _0x556ae3;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require(_0xc8f4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8f4('0x7'))('rpc');var config=require(_0xc8f4('0x8'));var jayson=require(_0xc8f4('0x9'));var client=jayson['client'][_0xc8f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2363ef,_0x42e364,_0x561ddb){return new BPromise(function(_0x12677b,_0x178709){return client[_0xc8f4('0xb')](_0x2363ef,_0x561ddb)[_0xc8f4('0xc')](function(_0x28b2a8){logger['info'](_0xc8f4('0xd'),_0x42e364,_0xc8f4('0xe'));logger['debug'](_0xc8f4('0xf'),_0x42e364,'request\x20sent',JSON[_0xc8f4('0x10')](_0x28b2a8));if(_0x28b2a8[_0xc8f4('0x11')]){if(_0x28b2a8[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')]('CmCustomField,\x20%s,\x20%s',_0x42e364,_0x28b2a8['error'][_0xc8f4('0x13')]);return _0x178709(_0x28b2a8[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xd'),_0x42e364,_0x28b2a8[_0xc8f4('0x11')]['message']);return _0x12677b(_0x28b2a8['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xd'),_0x42e364,'request\x20sent');_0x12677b(_0x28b2a8['result'][_0xc8f4('0x13')]);}})[_0xc8f4('0x15')](function(_0x21da59){logger[_0xc8f4('0x11')](_0xc8f4('0xd'),_0x42e364,_0x21da59);_0x178709(_0x21da59);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3f74ac0..9a98b18 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 _0x0389=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','show','post','put','update','delete','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0389,0x175));var _0x9038=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x0389[_0x267d8d];return _0x11a98f;};'use strict';var multer=require(_0x9038('0x0'));var util=require('util');var path=require(_0x9038('0x1'));var timeout=require(_0x9038('0x2'));var express=require(_0x9038('0x3'));var router=express[_0x9038('0x4')]();var fs_extra=require(_0x9038('0x5'));var auth=require(_0x9038('0x6'));var interaction=require(_0x9038('0x7'));var config=require('../../config/environment');var controller=require(_0x9038('0x8'));router[_0x9038('0x9')]('/',auth[_0x9038('0xa')](),controller['index']);router['get']('/:id',auth[_0x9038('0xa')](),controller[_0x9038('0xb')]);router[_0x9038('0xc')]('/',auth[_0x9038('0xa')](),controller['create']);router[_0x9038('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9038('0xe')]);router[_0x9038('0xf')]('/:id',auth[_0x9038('0xa')](),controller['destroy']);module[_0x9038('0x10')]=router; \ No newline at end of file +var _0xa014=['../../config/environment','./cmCustomField.controller','get','/:id','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x46d58f,_0x470382){var _0x988d7b=function(_0x52044e){while(--_0x52044e){_0x46d58f['push'](_0x46d58f['shift']());}};_0x988d7b(++_0x470382);}(_0xa014,0xeb));var _0x4a01=function(_0x37f49e,_0x26c581){_0x37f49e=_0x37f49e-0x0;var _0x335639=_0xa014[_0x37f49e];return _0x335639;};'use strict';var multer=require(_0x4a01('0x0'));var util=require(_0x4a01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a01('0x2')]();var fs_extra=require(_0x4a01('0x3'));var auth=require(_0x4a01('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a01('0x5'));var controller=require(_0x4a01('0x6'));router[_0x4a01('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4a01('0x7')](_0x4a01('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x4a01('0x9')]('/',auth[_0x4a01('0xa')](),controller['create']);router[_0x4a01('0xb')](_0x4a01('0x8'),auth['isAuthenticated'](),controller[_0x4a01('0xc')]);router[_0x4a01('0xd')](_0x4a01('0x8'),auth[_0x4a01('0xa')](),controller[_0x4a01('0xe')]);module[_0x4a01('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a5d8892..255f88c 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 _0xc7b5=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports','STRING','BOOLEAN','DATE','format'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc7b5,0xaf));var _0x5c7b=function(_0x166af0,_0x2c93e9){_0x166af0=_0x166af0-0x0;var _0x205a43=_0xc7b5[_0x166af0];return _0x205a43;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5c7b('0x0')]={'phone':{'type':Sequelize[_0x5c7b('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x5c7b('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5c7b('0x3')],'defaultValue':moment()[_0x5c7b('0x4')](_0x5c7b('0x5'))},'countbusyretry':{'type':Sequelize[_0x5c7b('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5c7b('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5c7b('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x5c7b('0x6')](0x2)[_0x5c7b('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5c7b('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5c7b('0x6')],'unique':_0x5c7b('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x5c7b('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x5c7b('0x6')],'unique':_0x5c7b('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x5c7b('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5c7b('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5c7b('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x5c7b('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5c7b('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x5c7b('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7675=['sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue'];(function(_0x174e6b,_0x124a26){var _0x10ab0e=function(_0x704225){while(--_0x704225){_0x174e6b['push'](_0x174e6b['shift']());}};_0x10ab0e(++_0x124a26);}(_0x7675,0x1c0));var _0x5767=function(_0x14766e,_0x33c486){_0x14766e=_0x14766e-0x0;var _0x289f34=_0x7675[_0x14766e];return _0x289f34;};'use strict';var moment=require('moment');var Sequelize=require(_0x5767('0x0'));module['exports']={'phone':{'type':Sequelize[_0x5767('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x5767('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5767('0x3')],'defaultValue':moment()['format'](_0x5767('0x4'))},'countbusyretry':{'type':Sequelize[_0x5767('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5767('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5767('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5767('0x3')]},'priority':{'type':Sequelize[_0x5767('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5767('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5767('0x5')],'unique':_0x5767('0x6')},'ListId':{'type':Sequelize[_0x5767('0x5')],'unique':_0x5767('0x6')},'UserId':{'type':Sequelize[_0x5767('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x5767('0x5')],'unique':_0x5767('0x6')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5767('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5767('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5767('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5767('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x5767('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5767('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x5767('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 534d15b..ee9d858 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 _0xf8b2=['VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','createdAt','state','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','filter','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Company','dialActive','getPreviewRecall','scheduledat','recallme','Contact','CmCompany','List','Queue','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','update','body','describe','destroy'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x1ab0a1,_0x8daa77){_0x1ab0a1=_0x1ab0a1-0x0;var _0x567836=_0xf8b2[_0x1ab0a1];return _0x567836;};'use strict';var moment=require(_0x2f8b('0x0'));var _=require(_0x2f8b('0x1'));var qs=require(_0x2f8b('0x2'));var logger=require(_0x2f8b('0x3'))(_0x2f8b('0x4'));var shared=require(_0x2f8b('0x5'));var db=require(_0x2f8b('0x6'))['db'];function respondWithResult(_0x2952c2,_0x50dae3){_0x50dae3=_0x50dae3||0xc8;return function(_0x4b33e9){if(_0x4b33e9){return _0x2952c2[_0x2f8b('0x7')](_0x50dae3)[_0x2f8b('0x8')](_0x4b33e9);}};}function respondWithFilteredResult(_0x3c6838,_0x1d133a){return function(_0x3b0511){if(_0x3b0511){var _0x2cc1e9=typeof _0x1d133a[_0x2f8b('0x9')]===_0x2f8b('0xa')&&typeof _0x1d133a[_0x2f8b('0xb')]==='undefined';var _0xdb9718=_0x3b0511[_0x2f8b('0xc')];var _0x120486=_0x2cc1e9?0x0:_0x1d133a['offset'];var _0x225804=_0x2cc1e9?_0x3b0511[_0x2f8b('0xc')]:_0x1d133a[_0x2f8b('0x9')]+_0x1d133a['limit'];var _0x53cec0;if(_0x225804>=_0xdb9718){_0x225804=_0xdb9718;_0x53cec0=0xc8;}else{_0x53cec0=0xce;}_0x3c6838[_0x2f8b('0x7')](_0x53cec0);return _0x3c6838[_0x2f8b('0xd')](_0x2f8b('0xe'),_0x120486+'-'+_0x225804+'/'+_0xdb9718)[_0x2f8b('0x8')](_0x3b0511);}return null;};}function saveUpdates(_0x175111,_0x4cb1e0){return function(_0x16d5a2){if(_0x16d5a2){return _0x16d5a2['update'](_0x175111)[_0x2f8b('0xf')](function(_0x5e9eb1){return _0x5e9eb1;});}return null;};}function handleEntityNotFound(_0x1b6a17,_0x15634){return function(_0xf9cbe0){if(!_0xf9cbe0){_0x1b6a17[_0x2f8b('0x10')](0x194);}return _0xf9cbe0;};}function handleError(_0xd7dbcd,_0x2b6003){_0x2b6003=_0x2b6003||0x1f4;return function(_0x532fe4){logger[_0x2f8b('0x11')](_0x532fe4[_0x2f8b('0x12')]);if(_0x532fe4[_0x2f8b('0x13')]){delete _0x532fe4[_0x2f8b('0x13')];}_0xd7dbcd[_0x2f8b('0x7')](_0x2b6003)[_0x2f8b('0x14')](_0x532fe4);};}exports[_0x2f8b('0x15')]=function(_0x1fe74a,_0x35ec40){var _0x4aaef4={},_0x23dd63={},_0x2a0a49={'count':0x0,'rows':[]};var _0x35f0ca=_['map'](db[_0x2f8b('0x16')]['rawAttributes'],function(_0x1c455f){return{'name':_0x1c455f[_0x2f8b('0x17')],'type':_0x1c455f[_0x2f8b('0x18')][_0x2f8b('0x19')]};});_0x23dd63[_0x2f8b('0x1a')]=_['map'](_0x35f0ca,_0x2f8b('0x13'));_0x23dd63[_0x2f8b('0x1b')]=_[_0x2f8b('0x1c')](_0x1fe74a[_0x2f8b('0x1b')]);_0x23dd63[_0x2f8b('0x1d')]=_[_0x2f8b('0x1e')](_0x23dd63[_0x2f8b('0x1a')],_0x23dd63['query']);_0x23dd63[_0x2f8b('0x1d')]=_[_0x2f8b('0x1f')](_0x23dd63[_0x2f8b('0x1d')],[_0x2f8b('0x20'),_0x2f8b('0x21'),'$gt',_0x2f8b('0x22'),_0x2f8b('0x23'),_0x2f8b('0x24'),_0x2f8b('0x25'),_0x2f8b('0x26'),_0x2f8b('0x27'),_0x2f8b('0x28'),_0x2f8b('0x29'),_0x2f8b('0x2a'),'$notIn',_0x2f8b('0x2b'),'$notLike',_0x2f8b('0x2c'),_0x2f8b('0x2d'),_0x2f8b('0x2b'),_0x2f8b('0x2e'),_0x2f8b('0x2f'),'$contained',_0x2f8b('0x30')]);_0x4aaef4['attributes']=_['intersection'](_0x23dd63[_0x2f8b('0x1a')],qs[_0x2f8b('0x31')](_0x1fe74a['query'][_0x2f8b('0x31')]));_0x4aaef4[_0x2f8b('0x32')]=_0x4aaef4[_0x2f8b('0x32')][_0x2f8b('0x33')]?_0x4aaef4[_0x2f8b('0x32')]:_0x23dd63[_0x2f8b('0x1a')];if(!_0x1fe74a['query'][_0x2f8b('0x34')](_0x2f8b('0x35'))){_0x4aaef4[_0x2f8b('0xb')]=qs[_0x2f8b('0xb')](_0x1fe74a[_0x2f8b('0x1b')][_0x2f8b('0xb')]);_0x4aaef4[_0x2f8b('0x9')]=qs['offset'](_0x1fe74a[_0x2f8b('0x1b')]['offset']);}_0x4aaef4[_0x2f8b('0x36')]=qs[_0x2f8b('0x37')](_0x1fe74a[_0x2f8b('0x1b')][_0x2f8b('0x37')]);_0x4aaef4[_0x2f8b('0x38')]=qs[_0x2f8b('0x1d')](_[_0x2f8b('0x39')](_0x1fe74a[_0x2f8b('0x1b')],_0x23dd63[_0x2f8b('0x1d')]),_0x35f0ca);if(_0x1fe74a['query']['filter']){_0x4aaef4[_0x2f8b('0x38')]=_[_0x2f8b('0x3a')](_0x4aaef4[_0x2f8b('0x38')],{'$or':_[_0x2f8b('0x3b')](_0x35f0ca,function(_0x5c52ad){if(_0x5c52ad[_0x2f8b('0x18')]!==_0x2f8b('0x3c')){var _0x37676c={};_0x37676c[_0x5c52ad[_0x2f8b('0x13')]]={'$like':'%'+_0x1fe74a[_0x2f8b('0x1b')]['filter']+'%'};return _0x37676c;}})});}_0x4aaef4=_['merge']({},_0x4aaef4,_0x1fe74a[_0x2f8b('0x3d')]);var _0x25c805={'where':_0x4aaef4[_0x2f8b('0x38')]};return db[_0x2f8b('0x16')][_0x2f8b('0xc')](_0x25c805)[_0x2f8b('0xf')](function(_0x2c554d){_0x2a0a49['count']=_0x2c554d;if(_0x1fe74a[_0x2f8b('0x1b')][_0x2f8b('0x3e')]){_0x4aaef4['include']=[{'all':!![]}];}return db[_0x2f8b('0x16')][_0x2f8b('0x3f')](_0x4aaef4);})[_0x2f8b('0xf')](function(_0x4fc170){_0x2a0a49[_0x2f8b('0x40')]=_0x4fc170;return _0x2a0a49;})[_0x2f8b('0xf')](respondWithFilteredResult(_0x35ec40,_0x4aaef4))['catch'](handleError(_0x35ec40,null));};exports[_0x2f8b('0x41')]=function(_0x46a49b,_0x5e8a3e){var _0x92b37a={'raw':!![],'where':{'id':_0x46a49b[_0x2f8b('0x42')]['id']}},_0x57576e={};_0x57576e[_0x2f8b('0x1a')]=_['keys'](db[_0x2f8b('0x16')][_0x2f8b('0x43')]);_0x57576e[_0x2f8b('0x1b')]=_['keys'](_0x46a49b[_0x2f8b('0x1b')]);_0x57576e['filters']=_[_0x2f8b('0x1e')](_0x57576e[_0x2f8b('0x1a')],_0x57576e[_0x2f8b('0x1b')]);_0x92b37a[_0x2f8b('0x32')]=_[_0x2f8b('0x1e')](_0x57576e[_0x2f8b('0x1a')],qs[_0x2f8b('0x31')](_0x46a49b[_0x2f8b('0x1b')][_0x2f8b('0x31')]));_0x92b37a[_0x2f8b('0x32')]=_0x92b37a[_0x2f8b('0x32')][_0x2f8b('0x33')]?_0x92b37a[_0x2f8b('0x32')]:_0x57576e[_0x2f8b('0x1a')];if(_0x46a49b[_0x2f8b('0x1b')][_0x2f8b('0x3e')]){_0x92b37a[_0x2f8b('0x44')]=[{'all':!![]}];}_0x92b37a=_[_0x2f8b('0x3a')]({},_0x92b37a,_0x46a49b[_0x2f8b('0x3d')]);return db[_0x2f8b('0x16')][_0x2f8b('0x45')](_0x92b37a)[_0x2f8b('0xf')](handleEntityNotFound(_0x5e8a3e,null))[_0x2f8b('0xf')](respondWithResult(_0x5e8a3e,null))[_0x2f8b('0x46')](handleError(_0x5e8a3e,null));};exports[_0x2f8b('0x47')]=function(_0x564b81,_0x4a8a89){return db['CmHopper'][_0x2f8b('0x47')](_0x564b81['body'],{})[_0x2f8b('0xf')](respondWithResult(_0x4a8a89,0xc9))[_0x2f8b('0x46')](handleError(_0x4a8a89,null));};exports[_0x2f8b('0x48')]=function(_0x5f0a8d,_0x98b96){if(_0x5f0a8d['body']['id']){delete _0x5f0a8d[_0x2f8b('0x49')]['id'];}return db['CmHopper'][_0x2f8b('0x45')]({'where':{'id':_0x5f0a8d[_0x2f8b('0x42')]['id']}})['then'](handleEntityNotFound(_0x98b96,null))[_0x2f8b('0xf')](saveUpdates(_0x5f0a8d[_0x2f8b('0x49')],null))[_0x2f8b('0xf')](respondWithResult(_0x98b96,null))[_0x2f8b('0x46')](handleError(_0x98b96,null));};exports[_0x2f8b('0x4a')]=function(_0x465d59,_0xd9b1d1){return db[_0x2f8b('0x16')][_0x2f8b('0x4a')]()['then'](respondWithResult(_0xd9b1d1,null))[_0x2f8b('0x46')](handleError(_0xd9b1d1,null));};exports[_0x2f8b('0x4b')]=function(_0x2d79f9,_0x1bb257){var _0x14e50e;var _0x487c81=_0x2d79f9[_0x2f8b('0x42')]['id'];return db[_0x2f8b('0x16')][_0x2f8b('0x45')]({'where':{'id':_0x2d79f9['params']['id']}})[_0x2f8b('0xf')](handleEntityNotFound(_0x1bb257,null))['then'](function(_0x26dfb1){if(_0x26dfb1){return _0x26dfb1[_0x2f8b('0x4b')]()[_0x2f8b('0xf')](function(_0x3a25bb){return _0x3a25bb;});}})[_0x2f8b('0xf')](function(_0x5b181f){_0x14e50e=_0x5b181f;if(_0x5b181f){if(_0x5b181f['VoiceQueueId']||_0x5b181f['CampaignId']){return db[_0x5b181f[_0x2f8b('0x4c')]?_0x2f8b('0x4d'):_0x2f8b('0x4e')][_0x2f8b('0x45')]({'where':{'id':_0x5b181f['VoiceQueueId']?_0x5b181f['VoiceQueueId']:_0x5b181f[_0x2f8b('0x4f')]},'attributes':['id',_0x2f8b('0x13')],'raw':!![]});}}})[_0x2f8b('0xf')](function(_0x448382){var _0x4ae427={};if(_0x448382){_[_0x2f8b('0x3a')](_0x4ae427,_[_0x2f8b('0x50')](_0x14e50e['dataValues'],[_0x2f8b('0x51'),'updatedAt','id']));_0x4ae427[_0x2f8b('0x52')]=0x15;_0x4ae427['statedesc']=_0x2f8b('0x53');_0x4ae427[_0x2f8b('0x54')]=_0x448382[_0x2f8b('0x13')];_0x4ae427['membername']=_0x2d79f9[_0x2f8b('0x55')]['name'];_0x4ae427[_0x2f8b('0x56')]=_0x2d79f9['user']['id'];_0x4ae427[_0x2f8b('0x53')]=!![];_0x4ae427[_0x2f8b('0x57')]=moment()[_0x2f8b('0x58')](_0x2f8b('0x59'));_0x4ae427[_0x2f8b('0x5a')]=_0x14e50e[_0x2f8b('0x5b')];_0x4ae427[_0x2f8b('0x5c')]=_0x14e50e[_0x2f8b('0x4c')]?'queue':_0x2f8b('0x5d');return db[_0x2f8b('0x5e')][_0x2f8b('0x45')]({'where':{'id':_0x4ae427[_0x2f8b('0x5f')]},'attributes':[_0x2f8b('0x60'),_0x2f8b('0x61')]})[_0x2f8b('0xf')](function(_0x2de537){if(!_[_0x2f8b('0x62')](_0x1bb257)&&!_[_0x2f8b('0x62')](_0x2de537[_0x2f8b('0x60')])){_0x4ae427[_0x2f8b('0x63')]=_0x2de537['firstName'];if(!_[_0x2f8b('0x62')](_0x2de537['lastName'])){_0x4ae427[_0x2f8b('0x63')]+='\x20'+_0x2de537[_0x2f8b('0x61')];}}})[_0x2f8b('0x64')](function(){return db[_0x2f8b('0x65')][_0x2f8b('0x47')](_0x4ae427);});}})['then'](function(_0x2b0627){return db[_0x2f8b('0x66')][_0x2f8b('0x4b')]({'where':{'CmHopperId':_0x487c81}});})[_0x2f8b('0xf')](function(){return _0x1bb257['status'](0xcc)['end']();})[_0x2f8b('0x46')](handleError(_0x1bb257,null));};exports[_0x2f8b('0x67')]=function(_0x334153,_0x34870f){var _0x5441ea=[];return db[_0x2f8b('0x5e')][_0x2f8b('0x4a')]()['then'](function(_0x4c502d){_0x5441ea=_['keys'](_0x4c502d);return _0x334153[_0x2f8b('0x55')]['getVoiceQueues']({'where':{'type':_0x2f8b('0x68'),'dialActive':!![],'dialMethod':_0x2f8b('0x69')},'attributes':['id',_0x2f8b('0x6a'),_0x2f8b('0x6b')],'raw':!![]});})[_0x2f8b('0xf')](function(_0x1c1563){if(_0x1c1563&&_0x1c1563[_0x2f8b('0x33')]){return db[_0x2f8b('0x6c')]['transaction'](function(_0x49a2ca){var _0x14ff2a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2f8b('0x58')](_0x2f8b('0x59'))},'VoiceQueueId':{'$in':_[_0x2f8b('0x3b')](_0x1c1563,'id')},'$or':[{'UserId':null},{'UserId':_0x334153[_0x2f8b('0x55')]['id']}]};var _0x23ac08={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1c1563)[_0x2f8b('0x6d')]([_0x2f8b('0x6b'),0x0])[_0x2f8b('0x3b')]('id')[_0x2f8b('0x6e')]()},'$or':[{'UserId':null},{'UserId':_0x334153['user']['id']}]};var _0x3dbd17={'$or':[_0x14ff2a,_0x23ac08]};var _0x1e3434=[];if(_0x334153[_0x2f8b('0x49')][_0x2f8b('0x6f')]&&_0x334153[_0x2f8b('0x49')]['direction']===_0x2f8b('0x70')){if(!_[_0x2f8b('0x71')](_0x334153['body'][_0x2f8b('0x72')])){_0x3dbd17['id']={'$in':_0x334153['body']['hopperIds']};}_0x1e3434=[[_0x2f8b('0x73'),_0x2f8b('0x74')],[_0x2f8b('0x75'),_0x1c1563[0x0]['dialOrderByScheduledAt']===_0x2f8b('0x74')?'DESC':_0x2f8b('0x74')],db[_0x2f8b('0x6c')][_0x2f8b('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x2f8b('0x77')]];}else{if(!_['isEmpty'](_0x334153[_0x2f8b('0x49')][_0x2f8b('0x72')])){_0x3dbd17['id']={'$notIn':_0x334153['body'][_0x2f8b('0x72')]};}_0x1e3434=[[_0x2f8b('0x73'),_0x2f8b('0x77')],['scheduledAt',_0x1c1563[0x0][_0x2f8b('0x6a')]],db[_0x2f8b('0x6c')][_0x2f8b('0x76')](_0x2f8b('0x78')),['id','ASC']];}return db[_0x2f8b('0x16')][_0x2f8b('0x79')]({'attributes':['id','scheduledat',_0x2f8b('0x5b'),'recallme'],'where':_0x3dbd17,'order':_0x1e3434,'transaction':_0x49a2ca,'lock':_0x49a2ca[_0x2f8b('0x7a')][_0x2f8b('0x7b')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5441ea,'include':[{'model':db['CmCompany'],'as':_0x2f8b('0x7c'),'attributes':['id',_0x2f8b('0x13')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x2f8b('0x7d')]}]})[_0x2f8b('0xf')](function(_0x7348e8){if(_0x7348e8){return _0x7348e8[_0x2f8b('0x48')]({'UserId':_0x334153[_0x2f8b('0x55')]['id']},{'transaction':_0x49a2ca});}});});}})['then'](handleEntityNotFound(_0x34870f,null))['then'](respondWithResult(_0x34870f,null))[_0x2f8b('0x46')](handleError(_0x34870f,null));};exports[_0x2f8b('0x7e')]=function(_0x34a7b6,_0x585196,_0x5ae32e){var _0x55254b=[];var _0x4358e0=_0x34a7b6[_0x2f8b('0x42')]['id'];var _0x34b0d2=_0x34a7b6['user']['id'];return db[_0x2f8b('0x5e')][_0x2f8b('0x4a')]()[_0x2f8b('0xf')](function(_0x3afad1){_0x55254b=_[_0x2f8b('0x1c')](_0x3afad1);return db[_0x2f8b('0x6c')]['transaction'](function(_0x38b1fe){const _0x31d6cc={'id':_0x4358e0};return db['CmHopper'][_0x2f8b('0x79')]({'attributes':['id',_0x2f8b('0x7f'),_0x2f8b('0x80')],'where':_0x31d6cc,'transaction':_0x38b1fe,'lock':_0x38b1fe[_0x2f8b('0x7a')][_0x2f8b('0x7b')],'include':[{'model':db[_0x2f8b('0x5e')],'as':_0x2f8b('0x81'),'attributes':_0x55254b,'include':[{'model':db[_0x2f8b('0x82')],'as':'Company','attributes':['id',_0x2f8b('0x13')]}]},{'model':db['CmList'],'as':_0x2f8b('0x83'),'attributes':['id',_0x2f8b('0x13')]},{'model':db['VoiceQueue'],'as':_0x2f8b('0x84'),'attributes':['id','name',_0x2f8b('0x7d')]}]})[_0x2f8b('0xf')](function(_0x1ebbc8){if(_0x1ebbc8){return _0x1ebbc8[_0x2f8b('0x48')]({'UserId':_0x34b0d2},{'transaction':_0x38b1fe});}});});})['then'](handleEntityNotFound(_0x585196,null))[_0x2f8b('0xf')](respondWithResult(_0x585196,null))['catch'](handleError(_0x585196,null));};exports['getOpenContacts']=function(_0x7ded8e,_0x3bf354){return _0x7ded8e[_0x2f8b('0x55')][_0x2f8b('0x85')]({'where':{'type':_0x2f8b('0x68'),'dialActive':!![],'dialMethod':_0x2f8b('0x69')},'attributes':['id'],'raw':!![]})[_0x2f8b('0xf')](function(_0x1be1f5){if(_0x1be1f5&&_0x1be1f5['length']){return db[_0x2f8b('0x16')][_0x2f8b('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2f8b('0x58')](_0x2f8b('0x59'))},'VoiceQueueId':{'$in':_[_0x2f8b('0x3b')](_0x1be1f5,'id')},'$or':[{'UserId':null},{'UserId':_0x7ded8e[_0x2f8b('0x55')]['id']}]}});}return 0x0;})[_0x2f8b('0xf')](function(_0x4d0a73){if(!_[_0x2f8b('0x62')](_0x4d0a73)&&_['isNumber'](_0x4d0a73)){return _0x3bf354[_0x2f8b('0x7')](0xc8)[_0x2f8b('0x8')]({'contacts':_0x4d0a73});}else{logger['error'](_0x2f8b('0x86'),_0x2f8b('0x87'),0x194,_0x2f8b('0x88'));_0x3bf354[_0x2f8b('0x10')](0x194);}})[_0x2f8b('0x46')](handleError(_0x3bf354,null));};exports[_0x2f8b('0x89')]=function(_0x53fbfe,_0x1ba4d2){var _0x55dcc1=shared[_0x2f8b('0x8a')];var _0x5da15b=[];_['map'](_0x55dcc1,function(_0x260d55){_0x5da15b[_0x2f8b('0x8b')]({'id':_0x260d55[_0x2f8b('0x13')],'name':_0x260d55[_0x2f8b('0x13')],'utcOffset':_0x260d55[_0x2f8b('0x8c')]});});return _0x1ba4d2[_0x2f8b('0x7')](0xc8)[_0x2f8b('0x8')]({'tz':_0x5da15b});};exports[_0x2f8b('0x8d')]=function(_0x2cf869,_0x2deff8){var _0x405dd9=shared[_0x2f8b('0x8a')];var _0x3ddea8={};if(!_[_0x2f8b('0x62')](_0x405dd9[_0x2cf869[_0x2f8b('0x49')]['id']]))_0x3ddea8=_0x405dd9[_0x2cf869['body']['id']];return _0x2deff8[_0x2f8b('0x7')](0xc8)['json'](_0x3ddea8);}; \ No newline at end of file +var _0x4b1f=['sendStatus','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../config/logger','api','../../config/environment','offset','count','limit','status','set','Content-Range','json','update','then','error','send','index','map','rawAttributes','type','key','name','query','keys','filters','intersection','model','concat','$or','$gte','$lte','$ne','$eq','$between','$in','$like','$notLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmHopper','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','dialActive','transaction','LOCK','CmList','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x4b1f[_0x45783c];return _0x1161da;};'use strict';var moment=require(_0xf4b1('0x0'));var _=require(_0xf4b1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xf4b1('0x2'))(_0xf4b1('0x3'));var shared=require(_0xf4b1('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x19fb44,_0x2b99e2){_0x2b99e2=_0x2b99e2||0xc8;return function(_0x31acb0){if(_0x31acb0){return _0x19fb44['status'](_0x2b99e2)['json'](_0x31acb0);}};}function respondWithFilteredResult(_0x1ab96b,_0x4b676){return function(_0x310db5){if(_0x310db5){var _0x3b9c78=typeof _0x4b676[_0xf4b1('0x5')]==='undefined'&&typeof _0x4b676['limit']==='undefined';var _0x2bf9d8=_0x310db5['count'];var _0xb243d6=_0x3b9c78?0x0:_0x4b676['offset'];var _0x4abaa5=_0x3b9c78?_0x310db5[_0xf4b1('0x6')]:_0x4b676[_0xf4b1('0x5')]+_0x4b676[_0xf4b1('0x7')];var _0x253fa8;if(_0x4abaa5>=_0x2bf9d8){_0x4abaa5=_0x2bf9d8;_0x253fa8=0xc8;}else{_0x253fa8=0xce;}_0x1ab96b[_0xf4b1('0x8')](_0x253fa8);return _0x1ab96b[_0xf4b1('0x9')](_0xf4b1('0xa'),_0xb243d6+'-'+_0x4abaa5+'/'+_0x2bf9d8)[_0xf4b1('0xb')](_0x310db5);}return null;};}function saveUpdates(_0x38afbb,_0xf66b4c){return function(_0x2c4eb9){if(_0x2c4eb9){return _0x2c4eb9[_0xf4b1('0xc')](_0x38afbb)[_0xf4b1('0xd')](function(_0x58bdf0){return _0x58bdf0;});}return null;};}function handleEntityNotFound(_0x591476,_0x3ea6f3){return function(_0x5cbc25){if(!_0x5cbc25){_0x591476['sendStatus'](0x194);}return _0x5cbc25;};}function handleError(_0x476a04,_0x51c39f){_0x51c39f=_0x51c39f||0x1f4;return function(_0x5764b1){logger[_0xf4b1('0xe')](_0x5764b1['stack']);if(_0x5764b1['name']){delete _0x5764b1['name'];}_0x476a04['status'](_0x51c39f)[_0xf4b1('0xf')](_0x5764b1);};}exports[_0xf4b1('0x10')]=function(_0x534fd8,_0x3b378e){var _0x420f9e={},_0x322b38={},_0x465da2={'count':0x0,'rows':[]};var _0x2658e8=_[_0xf4b1('0x11')](db['CmHopper'][_0xf4b1('0x12')],function(_0x2efda6){return{'name':_0x2efda6['fieldName'],'type':_0x2efda6[_0xf4b1('0x13')][_0xf4b1('0x14')]};});_0x322b38['model']=_[_0xf4b1('0x11')](_0x2658e8,_0xf4b1('0x15'));_0x322b38[_0xf4b1('0x16')]=_[_0xf4b1('0x17')](_0x534fd8['query']);_0x322b38[_0xf4b1('0x18')]=_[_0xf4b1('0x19')](_0x322b38[_0xf4b1('0x1a')],_0x322b38[_0xf4b1('0x16')]);_0x322b38['filters']=_[_0xf4b1('0x1b')](_0x322b38[_0xf4b1('0x18')],['$and',_0xf4b1('0x1c'),'$gt',_0xf4b1('0x1d'),'$lt',_0xf4b1('0x1e'),_0xf4b1('0x1f'),_0xf4b1('0x20'),'$not',_0xf4b1('0x21'),'$notBetween',_0xf4b1('0x22'),'$notIn',_0xf4b1('0x23'),_0xf4b1('0x24'),'$iLike',_0xf4b1('0x25'),_0xf4b1('0x23'),'$overlap',_0xf4b1('0x26'),_0xf4b1('0x27'),_0xf4b1('0x28')]);_0x420f9e[_0xf4b1('0x29')]=_[_0xf4b1('0x19')](_0x322b38[_0xf4b1('0x1a')],qs[_0xf4b1('0x2a')](_0x534fd8['query']['fields']));_0x420f9e[_0xf4b1('0x29')]=_0x420f9e[_0xf4b1('0x29')][_0xf4b1('0x2b')]?_0x420f9e[_0xf4b1('0x29')]:_0x322b38[_0xf4b1('0x1a')];if(!_0x534fd8['query'][_0xf4b1('0x2c')](_0xf4b1('0x2d'))){_0x420f9e[_0xf4b1('0x7')]=qs[_0xf4b1('0x7')](_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x7')]);_0x420f9e[_0xf4b1('0x5')]=qs[_0xf4b1('0x5')](_0x534fd8['query'][_0xf4b1('0x5')]);}_0x420f9e['order']=qs['sort'](_0x534fd8['query'][_0xf4b1('0x2e')]);_0x420f9e[_0xf4b1('0x2f')]=qs[_0xf4b1('0x18')](_[_0xf4b1('0x30')](_0x534fd8[_0xf4b1('0x16')],_0x322b38[_0xf4b1('0x18')]),_0x2658e8);if(_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x31')]){_0x420f9e['where']=_[_0xf4b1('0x32')](_0x420f9e['where'],{'$or':_[_0xf4b1('0x11')](_0x2658e8,function(_0x303290){if(_0x303290['type']!==_0xf4b1('0x33')){var _0x6675a={};_0x6675a[_0x303290[_0xf4b1('0x15')]]={'$like':'%'+_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x31')]+'%'};return _0x6675a;}})});}_0x420f9e=_['merge']({},_0x420f9e,_0x534fd8[_0xf4b1('0x34')]);var _0x4f52dd={'where':_0x420f9e[_0xf4b1('0x2f')]};return db['CmHopper'][_0xf4b1('0x6')](_0x4f52dd)[_0xf4b1('0xd')](function(_0xfe587f){_0x465da2['count']=_0xfe587f;if(_0x534fd8[_0xf4b1('0x16')][_0xf4b1('0x35')]){_0x420f9e[_0xf4b1('0x36')]=[{'all':!![]}];}return db[_0xf4b1('0x37')][_0xf4b1('0x38')](_0x420f9e);})[_0xf4b1('0xd')](function(_0xa5e7d1){_0x465da2['rows']=_0xa5e7d1;return _0x465da2;})[_0xf4b1('0xd')](respondWithFilteredResult(_0x3b378e,_0x420f9e))[_0xf4b1('0x39')](handleError(_0x3b378e,null));};exports[_0xf4b1('0x3a')]=function(_0x3553c3,_0x39de7f){var _0x5aab12={'raw':!![],'where':{'id':_0x3553c3[_0xf4b1('0x3b')]['id']}},_0x54df38={};_0x54df38[_0xf4b1('0x1a')]=_['keys'](db['CmHopper'][_0xf4b1('0x12')]);_0x54df38[_0xf4b1('0x16')]=_[_0xf4b1('0x17')](_0x3553c3[_0xf4b1('0x16')]);_0x54df38[_0xf4b1('0x18')]=_[_0xf4b1('0x19')](_0x54df38[_0xf4b1('0x1a')],_0x54df38[_0xf4b1('0x16')]);_0x5aab12['attributes']=_[_0xf4b1('0x19')](_0x54df38['model'],qs['fields'](_0x3553c3['query'][_0xf4b1('0x2a')]));_0x5aab12[_0xf4b1('0x29')]=_0x5aab12[_0xf4b1('0x29')]['length']?_0x5aab12[_0xf4b1('0x29')]:_0x54df38[_0xf4b1('0x1a')];if(_0x3553c3[_0xf4b1('0x16')]['includeAll']){_0x5aab12[_0xf4b1('0x36')]=[{'all':!![]}];}_0x5aab12=_[_0xf4b1('0x32')]({},_0x5aab12,_0x3553c3[_0xf4b1('0x34')]);return db['CmHopper'][_0xf4b1('0x3c')](_0x5aab12)['then'](handleEntityNotFound(_0x39de7f,null))[_0xf4b1('0xd')](respondWithResult(_0x39de7f,null))[_0xf4b1('0x39')](handleError(_0x39de7f,null));};exports[_0xf4b1('0x3d')]=function(_0x54f24a,_0x16c00f){return db[_0xf4b1('0x37')]['create'](_0x54f24a[_0xf4b1('0x3e')],{})[_0xf4b1('0xd')](respondWithResult(_0x16c00f,0xc9))[_0xf4b1('0x39')](handleError(_0x16c00f,null));};exports[_0xf4b1('0xc')]=function(_0x52a080,_0x5a7b0a){if(_0x52a080[_0xf4b1('0x3e')]['id']){delete _0x52a080[_0xf4b1('0x3e')]['id'];}return db['CmHopper'][_0xf4b1('0x3c')]({'where':{'id':_0x52a080['params']['id']}})[_0xf4b1('0xd')](handleEntityNotFound(_0x5a7b0a,null))['then'](saveUpdates(_0x52a080[_0xf4b1('0x3e')],null))[_0xf4b1('0xd')](respondWithResult(_0x5a7b0a,null))['catch'](handleError(_0x5a7b0a,null));};exports[_0xf4b1('0x3f')]=function(_0x104819,_0xd8fa5a){return db[_0xf4b1('0x37')][_0xf4b1('0x3f')]()[_0xf4b1('0xd')](respondWithResult(_0xd8fa5a,null))[_0xf4b1('0x39')](handleError(_0xd8fa5a,null));};exports[_0xf4b1('0x40')]=function(_0x4e6e04,_0x4a9761){var _0xcb26;var _0x247165=_0x4e6e04['params']['id'];return db[_0xf4b1('0x37')][_0xf4b1('0x3c')]({'where':{'id':_0x4e6e04[_0xf4b1('0x3b')]['id']}})[_0xf4b1('0xd')](handleEntityNotFound(_0x4a9761,null))[_0xf4b1('0xd')](function(_0x2e8e2c){if(_0x2e8e2c){return _0x2e8e2c[_0xf4b1('0x40')]()[_0xf4b1('0xd')](function(_0x29c3c1){return _0x29c3c1;});}})[_0xf4b1('0xd')](function(_0x407ecf){_0xcb26=_0x407ecf;if(_0x407ecf){if(_0x407ecf[_0xf4b1('0x41')]||_0x407ecf[_0xf4b1('0x42')]){return db[_0x407ecf[_0xf4b1('0x41')]?_0xf4b1('0x43'):_0xf4b1('0x44')][_0xf4b1('0x3c')]({'where':{'id':_0x407ecf[_0xf4b1('0x41')]?_0x407ecf[_0xf4b1('0x41')]:_0x407ecf[_0xf4b1('0x42')]},'attributes':['id',_0xf4b1('0x15')],'raw':!![]});}}})[_0xf4b1('0xd')](function(_0x38efcd){var _0x478573={};if(_0x38efcd){_[_0xf4b1('0x32')](_0x478573,_[_0xf4b1('0x45')](_0xcb26[_0xf4b1('0x46')],[_0xf4b1('0x47'),'updatedAt','id']));_0x478573[_0xf4b1('0x48')]=0x15;_0x478573['statedesc']='deleted';_0x478573[_0xf4b1('0x49')]=_0x38efcd[_0xf4b1('0x15')];_0x478573['membername']=_0x4e6e04[_0xf4b1('0x4a')][_0xf4b1('0x15')];_0x478573[_0xf4b1('0x4b')]=_0x4e6e04['user']['id'];_0x478573['deleted']=!![];_0x478573[_0xf4b1('0x4c')]=moment()[_0xf4b1('0x4d')](_0xf4b1('0x4e'));_0x478573[_0xf4b1('0x4f')]=_0xcb26[_0xf4b1('0x50')];_0x478573[_0xf4b1('0x51')]=_0xcb26[_0xf4b1('0x41')]?_0xf4b1('0x52'):_0xf4b1('0x53');return db[_0xf4b1('0x54')][_0xf4b1('0x3c')]({'where':{'id':_0x478573[_0xf4b1('0x55')]},'attributes':[_0xf4b1('0x56'),_0xf4b1('0x57')]})['then'](function(_0x193bab){if(!_[_0xf4b1('0x58')](_0x4a9761)&&!_[_0xf4b1('0x58')](_0x193bab[_0xf4b1('0x56')])){_0x478573[_0xf4b1('0x59')]=_0x193bab[_0xf4b1('0x56')];if(!_[_0xf4b1('0x58')](_0x193bab[_0xf4b1('0x57')])){_0x478573[_0xf4b1('0x59')]+='\x20'+_0x193bab['lastName'];}}})[_0xf4b1('0x5a')](function(){return db[_0xf4b1('0x5b')][_0xf4b1('0x3d')](_0x478573);});}})['then'](function(_0x5960cd){return db[_0xf4b1('0x5c')][_0xf4b1('0x40')]({'where':{'CmHopperId':_0x247165}});})['then'](function(){return _0x4a9761[_0xf4b1('0x8')](0xcc)[_0xf4b1('0x5d')]();})[_0xf4b1('0x39')](handleError(_0x4a9761,null));};exports[_0xf4b1('0x5e')]=function(_0xb3ac46,_0x34e231){var _0xf8fbc1=[];return db[_0xf4b1('0x54')][_0xf4b1('0x3f')]()[_0xf4b1('0xd')](function(_0x2bf00c){_0xf8fbc1=_['keys'](_0x2bf00c);return _0xb3ac46[_0xf4b1('0x4a')][_0xf4b1('0x5f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xf4b1('0x60')},'attributes':['id',_0xf4b1('0x61'),_0xf4b1('0x62')],'raw':!![]});})['then'](function(_0x38769a){if(_0x38769a&&_0x38769a[_0xf4b1('0x2b')]){return db['sequelize']['transaction'](function(_0x2ad185){var _0x52c144={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf4b1('0x4e'))},'VoiceQueueId':{'$in':_[_0xf4b1('0x11')](_0x38769a,'id')},'$or':[{'UserId':null},{'UserId':_0xb3ac46['user']['id']}]};var _0x5ae14f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x38769a)[_0xf4b1('0x31')]([_0xf4b1('0x62'),0x0])['map']('id')[_0xf4b1('0x63')]()},'$or':[{'UserId':null},{'UserId':_0xb3ac46[_0xf4b1('0x4a')]['id']}]};var _0x1da752={'$or':[_0x52c144,_0x5ae14f]};var _0x18fef2=[];if(_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x64')]&&_0xb3ac46[_0xf4b1('0x3e')]['direction']===_0xf4b1('0x65')){if(!_[_0xf4b1('0x66')](_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x67')])){_0x1da752['id']={'$in':_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x67')]};}_0x18fef2=[[_0xf4b1('0x68'),'ASC'],['scheduledAt',_0x38769a[0x0][_0xf4b1('0x61')]===_0xf4b1('0x69')?'DESC':_0xf4b1('0x69')],db[_0xf4b1('0x6a')][_0xf4b1('0x6b')](_0xf4b1('0x6c')),['id','DESC']];}else{if(!_[_0xf4b1('0x66')](_0xb3ac46[_0xf4b1('0x3e')][_0xf4b1('0x67')])){_0x1da752['id']={'$notIn':_0xb3ac46['body'][_0xf4b1('0x67')]};}_0x18fef2=[[_0xf4b1('0x68'),_0xf4b1('0x6d')],[_0xf4b1('0x6e'),_0x38769a[0x0][_0xf4b1('0x61')]],db['sequelize'][_0xf4b1('0x6b')](_0xf4b1('0x6f')),['id',_0xf4b1('0x69')]];}return db[_0xf4b1('0x37')][_0xf4b1('0x70')]({'attributes':['id',_0xf4b1('0x71'),'phone',_0xf4b1('0x72')],'where':_0x1da752,'order':_0x18fef2,'transaction':_0x2ad185,'lock':_0x2ad185['LOCK'][_0xf4b1('0x73')],'include':[{'model':db['CmContact'],'as':_0xf4b1('0x74'),'attributes':_0xf8fbc1,'include':[{'model':db[_0xf4b1('0x75')],'as':_0xf4b1('0x76'),'attributes':['id',_0xf4b1('0x15')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db[_0xf4b1('0x43')],'as':'Queue','attributes':['id','name',_0xf4b1('0x77')]}]})[_0xf4b1('0xd')](function(_0x52588f){if(_0x52588f){return _0x52588f[_0xf4b1('0xc')]({'UserId':_0xb3ac46[_0xf4b1('0x4a')]['id']},{'transaction':_0x2ad185});}});});}})['then'](handleEntityNotFound(_0x34e231,null))[_0xf4b1('0xd')](respondWithResult(_0x34e231,null))[_0xf4b1('0x39')](handleError(_0x34e231,null));};exports['getPreviewRecall']=function(_0x218a13,_0x5c71f2,_0x1687d5){var _0x5af286=[];var _0x59ac68=_0x218a13[_0xf4b1('0x3b')]['id'];var _0x19d240=_0x218a13['user']['id'];return db[_0xf4b1('0x54')][_0xf4b1('0x3f')]()[_0xf4b1('0xd')](function(_0x32b9a1){_0x5af286=_[_0xf4b1('0x17')](_0x32b9a1);return db['sequelize'][_0xf4b1('0x78')](function(_0x28ee27){const _0x2658d0={'id':_0x59ac68};return db['CmHopper'][_0xf4b1('0x70')]({'attributes':['id',_0xf4b1('0x71'),_0xf4b1('0x72')],'where':_0x2658d0,'transaction':_0x28ee27,'lock':_0x28ee27[_0xf4b1('0x79')]['UPDATE'],'include':[{'model':db[_0xf4b1('0x54')],'as':_0xf4b1('0x74'),'attributes':_0x5af286,'include':[{'model':db[_0xf4b1('0x75')],'as':_0xf4b1('0x76'),'attributes':['id',_0xf4b1('0x15')]}]},{'model':db[_0xf4b1('0x7a')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xf4b1('0x15'),_0xf4b1('0x77')]}]})['then'](function(_0x1af20e){if(_0x1af20e){return _0x1af20e[_0xf4b1('0xc')]({'UserId':_0x19d240},{'transaction':_0x28ee27});}});});})[_0xf4b1('0xd')](handleEntityNotFound(_0x5c71f2,null))['then'](respondWithResult(_0x5c71f2,null))[_0xf4b1('0x39')](handleError(_0x5c71f2,null));};exports['getOpenContacts']=function(_0x55fe87,_0x591d51){return _0x55fe87[_0xf4b1('0x4a')][_0xf4b1('0x5f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xf4b1('0xd')](function(_0x49302a){if(_0x49302a&&_0x49302a[_0xf4b1('0x2b')]){return db[_0xf4b1('0x37')][_0xf4b1('0x6')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf4b1('0x4d')](_0xf4b1('0x4e'))},'VoiceQueueId':{'$in':_[_0xf4b1('0x11')](_0x49302a,'id')},'$or':[{'UserId':null},{'UserId':_0x55fe87[_0xf4b1('0x4a')]['id']}]}});}return 0x0;})[_0xf4b1('0xd')](function(_0x2c2fc7){if(!_[_0xf4b1('0x58')](_0x2c2fc7)&&_[_0xf4b1('0x7b')](_0x2c2fc7)){return _0x591d51[_0xf4b1('0x8')](0xc8)['json']({'contacts':_0x2c2fc7});}else{logger[_0xf4b1('0xe')](_0xf4b1('0x7c'),_0xf4b1('0x7d'),0x194,_0xf4b1('0x7e'));_0x591d51[_0xf4b1('0x7f')](0x194);}})['catch'](handleError(_0x591d51,null));};exports[_0xf4b1('0x80')]=function(_0xcb1508,_0x704d5a){var _0x2fd77b=shared['timezones'];var _0x55559d=[];_[_0xf4b1('0x11')](_0x2fd77b,function(_0x33174b){_0x55559d[_0xf4b1('0x81')]({'id':_0x33174b[_0xf4b1('0x15')],'name':_0x33174b['name'],'utcOffset':_0x33174b[_0xf4b1('0x82')]});});return _0x704d5a[_0xf4b1('0x8')](0xc8)[_0xf4b1('0xb')]({'tz':_0x55559d});};exports[_0xf4b1('0x83')]=function(_0x48ab80,_0x503f3f){var _0x13d74f=shared[_0xf4b1('0x84')];var _0x313200={};if(!_['isNil'](_0x13d74f[_0x48ab80[_0xf4b1('0x3e')]['id']]))_0x313200=_0x13d74f[_0x48ab80[_0xf4b1('0x3e')]['id']];return _0x503f3f[_0xf4b1('0x8')](0xc8)[_0xf4b1('0xb')](_0x313200);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 51d3108..2b796f8 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 _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x1967,0x173));var _0x7196=function(_0x34b251,_0x1dd70c){_0x34b251=_0x34b251-0x0;var _0x231fed=_0x1967[_0x34b251];return _0x231fed;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['define','CmHopper','cm_hopper','scheduledat','phone','priority','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x580b2f,_0x4332b3){var _0x3d4e1a=function(_0x39544b){while(--_0x39544b){_0x580b2f['push'](_0x580b2f['shift']());}};_0x3d4e1a(++_0x4332b3);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x44e2e5,_0x8a3c43){_0x44e2e5=_0x44e2e5-0x0;var _0x175bc4=_0xdbf5[_0x44e2e5];return _0x175bc4;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5dbf('0xc')]},{'name':'phone','fields':[_0x5dbf('0xd')]},{'name':_0x5dbf('0xe'),'fields':[_0x5dbf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1035593..0a8e4a3 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 _0x7546=['ShowCmHopper','find','then','debug','catch','CreateCmHopper','create','UpdateCmHopper','body','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','keys','name','voicePause','length','UserId','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','Agent','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','info','stringify','error','message'];(function(_0xbb97fd,_0x10a9a9){var _0x2144bf=function(_0x2e779a){while(--_0x2e779a){_0xbb97fd['push'](_0xbb97fd['shift']());}};_0x2144bf(++_0x10a9a9);}(_0x7546,0x1d0));var _0x6754=function(_0x3357e3,_0x316578){_0x3357e3=_0x3357e3-0x0;var _0x4d7698=_0x7546[_0x3357e3];return _0x4d7698;};'use strict';var _=require(_0x6754('0x0'));var util=require(_0x6754('0x1'));var moment=require(_0x6754('0x2'));var BPromise=require(_0x6754('0x3'));var db=require(_0x6754('0x4'))['db'];var logger=require(_0x6754('0x5'))(_0x6754('0x6'));exports[_0x6754('0x7')]=function(_0x21524a){var _0x219c7b=this;return new Promise(function(_0x535a26,_0x5f5546){return db[_0x6754('0x8')][_0x6754('0x9')]({'raw':_0x21524a[_0x6754('0xa')]?_0x21524a[_0x6754('0xa')][_0x6754('0xb')]===undefined?!![]:![]:!![],'where':_0x21524a['options']?_0x21524a[_0x6754('0xa')][_0x6754('0xc')]||null:null,'attributes':_0x21524a[_0x6754('0xa')]?_0x21524a[_0x6754('0xa')]['attributes']||null:null,'limit':_0x21524a[_0x6754('0xa')]?_0x21524a[_0x6754('0xa')][_0x6754('0xd')]||null:null,'include':_0x21524a[_0x6754('0xa')]?_0x21524a[_0x6754('0xa')][_0x6754('0xe')]?_[_0x6754('0xf')](_0x21524a[_0x6754('0xa')][_0x6754('0xe')],function(_0x5863a5){return{'model':db[_0x5863a5['model']],'as':_0x5863a5['as'],'attributes':_0x5863a5['attributes'],'include':_0x5863a5[_0x6754('0xe')]?_[_0x6754('0xf')](_0x5863a5['include'],function(_0x279d77){return{'model':db[_0x279d77[_0x6754('0x10')]],'as':_0x279d77['as'],'attributes':_0x279d77[_0x6754('0x11')],'include':_0x279d77[_0x6754('0xe')]?_[_0x6754('0xf')](_0x279d77[_0x6754('0xe')],function(_0x4b6400){return{'model':db[_0x4b6400['model']],'as':_0x4b6400['as'],'attributes':_0x4b6400['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3946cf){logger[_0x6754('0x12')](_0x6754('0x7'),_0x21524a);logger['debug'](_0x6754('0x7'),_0x21524a,JSON[_0x6754('0x13')](_0x3946cf));_0x535a26(_0x3946cf);})['catch'](function(_0x2b4e96){logger[_0x6754('0x14')]('GetCmHopper',_0x2b4e96[_0x6754('0x15')],_0x21524a);_0x5f5546(_0x219c7b[_0x6754('0x14')](0x1f4,_0x2b4e96[_0x6754('0x15')]));});});};exports[_0x6754('0x16')]=function(_0x56cb82){var _0x3a0468=this;return new Promise(function(_0x21a495,_0x2fb627){return db['CmHopper'][_0x6754('0x17')]({'raw':_0x56cb82[_0x6754('0xa')]?_0x56cb82[_0x6754('0xa')][_0x6754('0xb')]===undefined?!![]:![]:!![],'where':_0x56cb82[_0x6754('0xa')]?_0x56cb82[_0x6754('0xa')][_0x6754('0xc')]||null:null,'attributes':_0x56cb82[_0x6754('0xa')]?_0x56cb82[_0x6754('0xa')]['attributes']||null:null,'include':_0x56cb82[_0x6754('0xa')]?_0x56cb82[_0x6754('0xa')][_0x6754('0xe')]?_[_0x6754('0xf')](_0x56cb82['options'][_0x6754('0xe')],function(_0x262b11){return{'model':db[_0x262b11[_0x6754('0x10')]],'as':_0x262b11['as'],'attributes':_0x262b11[_0x6754('0x11')],'include':_0x262b11['include']?_['map'](_0x262b11[_0x6754('0xe')],function(_0x9248a4){return{'model':db[_0x9248a4[_0x6754('0x10')]],'as':_0x9248a4['as'],'attributes':_0x9248a4[_0x6754('0x11')],'include':_0x9248a4['include']?_[_0x6754('0xf')](_0x9248a4[_0x6754('0xe')],function(_0x15fe4c){return{'model':db[_0x15fe4c['model']],'as':_0x15fe4c['as'],'attributes':_0x15fe4c[_0x6754('0x11')]};}):[]};}):[]};}):[]:[]})[_0x6754('0x18')](function(_0x11ab39){logger[_0x6754('0x12')](_0x6754('0x16'),_0x56cb82);logger[_0x6754('0x19')](_0x6754('0x16'),_0x56cb82,JSON[_0x6754('0x13')](_0x11ab39));_0x21a495(_0x11ab39);})[_0x6754('0x1a')](function(_0x55f1c5){logger['error'](_0x6754('0x16'),_0x55f1c5[_0x6754('0x15')],_0x56cb82);_0x2fb627(_0x3a0468[_0x6754('0x14')](0x1f4,_0x55f1c5['message']));});});};exports[_0x6754('0x1b')]=function(_0x24c8d6){var _0x3faf51=this;return new Promise(function(_0x1326f3,_0x4fee60){return db[_0x6754('0x8')][_0x6754('0x1c')](_0x24c8d6['body'],{'raw':_0x24c8d6[_0x6754('0xa')]?_0x24c8d6[_0x6754('0xa')][_0x6754('0xb')]===undefined?!![]:![]:!![]})[_0x6754('0x18')](function(_0x165700){logger['info'](_0x6754('0x1b'),_0x24c8d6);logger[_0x6754('0x19')](_0x6754('0x1b'),_0x24c8d6,JSON[_0x6754('0x13')](_0x165700));_0x1326f3(_0x165700);})[_0x6754('0x1a')](function(_0x53778a){logger['error'](_0x6754('0x1b'),_0x53778a['message'],_0x24c8d6);_0x4fee60(_0x3faf51[_0x6754('0x14')](0x1f4,_0x53778a[_0x6754('0x15')]));});});};exports[_0x6754('0x1d')]=function(_0x2c355f){var _0x230588=this;return new Promise(function(_0x4c43e8,_0x37a1e7){return db['CmHopper']['update'](_0x2c355f[_0x6754('0x1e')],{'raw':_0x2c355f['options']?_0x2c355f[_0x6754('0xa')][_0x6754('0xb')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c355f[_0x6754('0xa')]?_0x2c355f[_0x6754('0xa')]['where']||null:null,'attributes':_0x2c355f[_0x6754('0xa')]?_0x2c355f[_0x6754('0xa')][_0x6754('0x11')]||null:null,'limit':_0x2c355f['options']?_0x2c355f[_0x6754('0xa')][_0x6754('0xd')]||null:null})[_0x6754('0x18')](function(_0x2f6b46){logger['info']('UpdateCmHopper',_0x2c355f);logger[_0x6754('0x12')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x6754('0x13')](_0x2c355f['options']['where']),_0x2c355f[_0x6754('0x1e')][_0x6754('0x1f')]);logger[_0x6754('0x19')](_0x6754('0x1d'),_0x2c355f,JSON[_0x6754('0x13')](_0x2f6b46));_0x4c43e8(_0x2f6b46);})[_0x6754('0x1a')](function(_0x540c33){logger[_0x6754('0x14')](_0x6754('0x1d'),_0x540c33[_0x6754('0x15')],_0x2c355f);_0x37a1e7(_0x230588['error'](0x1f4,_0x540c33[_0x6754('0x15')]));});});};exports[_0x6754('0x20')]=function(_0x1f8316){var _0x500abe=this;return new Promise(function(_0x38b892,_0x5b6d53){return db[_0x6754('0x8')][_0x6754('0x21')]({'where':_0x1f8316[_0x6754('0xa')]?_0x1f8316[_0x6754('0xa')][_0x6754('0xc')]||null:null})[_0x6754('0x18')](function(_0x3d7e6e){logger[_0x6754('0x12')](_0x6754('0x20'),_0x1f8316);logger[_0x6754('0x19')](_0x6754('0x20'),_0x1f8316,JSON[_0x6754('0x13')](_0x3d7e6e));_0x38b892(_0x3d7e6e);})['catch'](function(_0x56cfae){logger[_0x6754('0x14')](_0x6754('0x20'),_0x56cfae[_0x6754('0x15')],_0x1f8316);_0x5b6d53(_0x500abe['error'](0x1f4,_0x56cfae[_0x6754('0x15')]));});});};exports[_0x6754('0x22')]=function(_0xb34071){var _0x2f8844=this;return new Promise(function(_0x29ff4d,_0x90c29c){return db[_0x6754('0x23')][_0x6754('0x24')]()[_0x6754('0x18')](function(_0x577176){return db[_0x6754('0x25')]['transaction'](function(_0x22e549){return db['CmHopper'][_0x6754('0x9')]({'where':_0xb34071[_0x6754('0xa')]?_0xb34071[_0x6754('0xa')][_0x6754('0xc')]||null:null,'attributes':_0xb34071[_0x6754('0xa')]?_0xb34071[_0x6754('0xa')]['attributes']||null:null,'limit':_0xb34071['options']?_0xb34071[_0x6754('0xa')][_0x6754('0xd')]||null:null,'order':_0xb34071['options']?_0xb34071[_0x6754('0xa')][_0x6754('0x26')]||null:null,'transaction':_0x22e549,'lock':_0x22e549[_0x6754('0x27')][_0x6754('0x28')],'include':[{'model':db[_0x6754('0x23')],'as':'Contact','attributes':_[_0x6754('0x29')](_0x577176)},{'model':db['User'],'as':'Agent','attributes':['id',_0x6754('0x2a'),_0x6754('0x2b')]}]})[_0x6754('0x18')](function(_0x4da4b7){var _0x5abb01=[];var _0x39725f=[];for(var _0xae17bd=0x0;_0xae17bd<_0x4da4b7[_0x6754('0x2c')];_0xae17bd+=0x1){var _0xdb0a6=_0x4da4b7[_0xae17bd][_0x6754('0x2d')];if(_0xdb0a6===null){_0x5abb01['push'](_0x4da4b7[_0xae17bd][_0x6754('0x2e')](_0xb34071[_0x6754('0x1e')],{'transaction':_0x22e549}));}else if(!_0x39725f[_0x6754('0x2f')](_0xdb0a6)){_0x39725f[_0x6754('0x30')](_0xdb0a6);_0x5abb01['push'](_0x4da4b7[_0xae17bd][_0x6754('0x2e')](_0xb34071[_0x6754('0x1e')],{'transaction':_0x22e549}));}}return BPromise[_0x6754('0x31')](_0x5abb01);});})['then'](function(_0x46bf36){logger[_0x6754('0x12')]('GetContactDialer',_0xb34071);if(_0x46bf36['length']>0x0){logger[_0x6754('0x12')](_0x6754('0x32'),_0x46bf36[0x0][_0x6754('0x33')]['id'],_0x46bf36[0x0]['dataValues']['ContactId'],_0x46bf36[0x0]['dataValues'][_0x6754('0x1f')]);}logger[_0x6754('0x19')](_0x6754('0x22'),_0xb34071,JSON[_0x6754('0x13')](_0x46bf36));_0x29ff4d(_0x46bf36);})['catch'](function(_0x3af25b){logger[_0x6754('0x14')]('GetContactDialer',_0x3af25b[_0x6754('0x15')],_0xb34071);_0x90c29c(_0x2f8844[_0x6754('0x14')](0x1f4,_0x3af25b['message']));});});});};exports[_0x6754('0x34')]=function(_0x56f561){var _0x4b13a0=this;return new Promise(function(_0x4fb3ce,_0x39a49f){return db[_0x6754('0x25')][_0x6754('0x35')](function(_0x49ac78){return db[_0x6754('0x36')][_0x6754('0x1c')](_0x56f561[_0x6754('0x1e')],{'raw':_0x56f561[_0x6754('0xa')]?_0x56f561[_0x6754('0xa')][_0x6754('0xb')]===undefined?!![]:![]:!![],'transaction':_0x49ac78})['then'](function(){logger[_0x6754('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x6754('0x13')](_0x56f561[_0x6754('0xa')]['where']),_0x56f561[_0x6754('0xa')]['where'][_0x6754('0x1f')]);return db[_0x6754('0x8')][_0x6754('0x21')]({'where':_0x56f561[_0x6754('0xa')]?_0x56f561[_0x6754('0xa')][_0x6754('0xc')]||null:null,'transaction':_0x49ac78});});})[_0x6754('0x18')](function(_0x5048e7){logger[_0x6754('0x12')](_0x6754('0x34'),_0x56f561);logger[_0x6754('0x19')]('MoveContactManagedDialer',_0x56f561,JSON['stringify'](_0x5048e7));_0x4fb3ce(_0x5048e7);})['catch'](function(_0x19787b){logger[_0x6754('0x14')]('MoveContactManagedDialer',_0x19787b['message'],_0x56f561);_0x39a49f(_0x4b13a0[_0x6754('0x14')](0x1f4,_0x19787b[_0x6754('0x15')]));});});};exports['CountReScheduled']=function(_0xe1b8da){var _0x350187=this;return new Promise(function(_0x403329,_0x1a3ed3){return db[_0x6754('0x8')][_0x6754('0x9')]({'raw':_0xe1b8da[_0x6754('0xa')]?_0xe1b8da[_0x6754('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0xe1b8da[_0x6754('0xa')]?_0xe1b8da[_0x6754('0xa')][_0x6754('0xc')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6754('0x37'),db[_0x6754('0x25')]['fn']('IF',db[_0x6754('0x25')][_0x6754('0x38')](_0x6754('0x39')+util[_0x6754('0x3a')]('\x22%s\x22',moment()[_0x6754('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x6754('0x3b')))),_0x6754('0x3c')]]})[_0x6754('0x18')](function(_0x8e469e){logger[_0x6754('0x12')](_0x6754('0x3d'),_0xe1b8da);logger[_0x6754('0x19')](_0x6754('0x3d'),_0xe1b8da,JSON['stringify'](_0x8e469e));_0x403329(_0x8e469e);})[_0x6754('0x1a')](function(_0x36dfff){logger[_0x6754('0x14')](_0x6754('0x3d'),_0x36dfff[_0x6754('0x15')],_0xe1b8da);_0x1a3ed3(_0x350187[_0x6754('0x14')](0x1f4,_0x36dfff[_0x6754('0x15')]));});});};exports[_0x6754('0x3e')]=function(_0x4030fd){var _0x3809cd=this;return new Promise(function(_0x567874,_0x3596a7){return db[_0x6754('0x23')][_0x6754('0x24')]()['then'](function(){return db['sequelize'][_0x6754('0x35')](function(_0xe8943d){return db[_0x6754('0x8')]['findAll']({'where':_0x4030fd[_0x6754('0xa')]?_0x4030fd['options'][_0x6754('0xc')]||null:null,'attributes':_0x4030fd[_0x6754('0xa')]?_0x4030fd[_0x6754('0xa')][_0x6754('0x11')]||null:null,'limit':0x1,'order':_0x4030fd['options']?_0x4030fd[_0x6754('0xa')][_0x6754('0x26')]||null:null,'group':db['CmHopper'][_0x6754('0x2d')],'transaction':_0xe8943d,'lock':_0xe8943d['LOCK'][_0x6754('0x28')],'include':_0x4030fd[_0x6754('0xa')]?_0x4030fd[_0x6754('0xa')]['include']?_['map'](_0x4030fd[_0x6754('0xa')]['include'],function(_0x286b1f){return{'model':db[_0x286b1f[_0x6754('0x10')]],'as':_0x286b1f['as'],'attributes':_0x286b1f[_0x6754('0x11')],'include':_0x286b1f[_0x6754('0xe')]?_[_0x6754('0xf')](_0x286b1f['include'],function(_0x4baf09){return{'model':db[_0x4baf09['model']],'as':_0x4baf09['as'],'attributes':_0x4baf09[_0x6754('0x11')],'include':_0x4baf09['include']?_['map'](_0x4baf09[_0x6754('0xe')],function(_0x2eafe1){return{'model':db[_0x2eafe1['model']],'as':_0x2eafe1['as'],'attributes':_0x2eafe1[_0x6754('0x11')]};}):[]};}):[]};}):[]:[]})[_0x6754('0x18')](function(_0x2511b3){var _0x4ea8ae=[];for(var _0x23c4d0=0x0;_0x23c4d0<_0x2511b3[_0x6754('0x2c')];_0x23c4d0+=0x1){_0x4ea8ae[_0x6754('0x30')](_0x2511b3[_0x23c4d0][_0x6754('0x2e')](_0x4030fd['body'],{'transaction':_0xe8943d}));}return BPromise[_0x6754('0x31')](_0x4ea8ae);});})['then'](function(_0x26674b){logger[_0x6754('0x12')](_0x6754('0x3e'),_0x4030fd);logger[_0x6754('0x19')](_0x6754('0x3e'),_0x4030fd,JSON[_0x6754('0x13')](_0x26674b));_0x567874(_0x26674b);})[_0x6754('0x1a')](function(_0x420bc4){logger[_0x6754('0x14')](_0x6754('0x3e'),_0x420bc4[_0x6754('0x15')],_0x4030fd);_0x3596a7(_0x3809cd[_0x6754('0x14')](0x1f4,_0x420bc4[_0x6754('0x15')]));});});});};exports[_0x6754('0x3f')]=function(_0x585964){var _0x2c0eae=this;return new Promise(function(_0x340b6e,_0x32ec11){db[_0x6754('0x23')]['describe']()['then'](function(_0x203219){return db[_0x6754('0x8')]['findAll']({'raw':_0x585964[_0x6754('0xa')]?_0x585964[_0x6754('0xa')][_0x6754('0xb')]===undefined?!![]:![]:!![],'where':_0x585964[_0x6754('0xa')]?_0x585964[_0x6754('0xa')][_0x6754('0xc')]||null:null,'attributes':_0x585964['options']?_0x585964['options'][_0x6754('0x11')]||null:null,'limit':_0x585964['options']?_0x585964[_0x6754('0xa')][_0x6754('0xd')]||null:null,'include':_0x585964['options']?_0x585964[_0x6754('0xa')][_0x6754('0xe')]?_[_0x6754('0xf')](_0x585964[_0x6754('0xa')][_0x6754('0xe')],function(_0x49d786){return{'model':db[_0x49d786[_0x6754('0x10')]],'as':_0x49d786['as'],'attributes':_0x49d786['as']===_0x6754('0x40')?_[_0x6754('0x29')](_0x203219):_0x49d786['attributes'],'include':_0x49d786[_0x6754('0xe')]?_[_0x6754('0xf')](_0x49d786['include'],function(_0x3bdd92){return{'model':db[_0x3bdd92[_0x6754('0x10')]],'as':_0x3bdd92['as'],'attributes':_0x3bdd92[_0x6754('0x11')],'include':_0x3bdd92['include']?_[_0x6754('0xf')](_0x3bdd92[_0x6754('0xe')],function(_0x224d2c){return{'model':db[_0x224d2c['model']],'as':_0x224d2c['as'],'attributes':_0x224d2c[_0x6754('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cf595){logger['info'](_0x6754('0x7'),_0x585964);logger[_0x6754('0x19')]('GetCmHopper',_0x585964,JSON[_0x6754('0x13')](_0x5cf595));_0x340b6e(_0x5cf595);})['catch'](function(_0x2eb7f9){logger[_0x6754('0x14')](_0x6754('0x7'),_0x2eb7f9[_0x6754('0x15')],_0x585964);_0x32ec11(_0x2c0eae[_0x6754('0x14')](0x1f4,_0x2eb7f9[_0x6754('0x15')]));});});});};exports[_0x6754('0x41')]=function(_0x3a372e){var _0x562aef=this;return new Promise(function(_0x49eae5,_0x47a921){return db[_0x6754('0x23')][_0x6754('0x42')]({'raw':!![],'where':{'phone':_0x3a372e['options']['where'][_0x6754('0x43')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})['then'](function(_0x15acdf){logger['info']('getContactByPhone',_0x3a372e);logger[_0x6754('0x19')](_0x6754('0x44'),_0x3a372e,JSON['stringify'](_0x15acdf));_0x49eae5(_0x15acdf);})[_0x6754('0x1a')](function(_0x2f4fb4){logger['error'](_0x6754('0x44'),_0x2f4fb4[_0x6754('0x15')],_0x3a372e);_0x47a921(_0x562aef[_0x6754('0x14')](0x1f4,_0x2f4fb4['message']));});});};exports[_0x6754('0x45')]=function(_0x1408a0){var _0x442739=this;return new Promise(function(_0x5b1791,_0x4060ab){return db[_0x6754('0x25')][_0x6754('0x35')](function(_0x2f7928){var _0x4b201d=_0x1408a0[_0x6754('0xa')]&&_0x1408a0[_0x6754('0xa')][_0x6754('0xc')]?_0x1408a0['options'][_0x6754('0xc')]:{};return db[_0x6754('0x8')][_0x6754('0x2e')](_0x1408a0['body'],{'where':_0x4b201d,'transaction':_0x2f7928})[_0x6754('0x18')](function(_0x1c5d4c){logger[_0x6754('0x12')](_0x6754('0x45'),_0x1408a0);logger[_0x6754('0x19')](_0x6754('0x45'),_0x1408a0,JSON[_0x6754('0x13')](_0x1c5d4c));_0x5b1791(_0x1c5d4c);})[_0x6754('0x1a')](function(_0x17cfe8){logger[_0x6754('0x14')](_0x6754('0x45'),_0x17cfe8[_0x6754('0x15')],_0x1408a0);_0x4060ab(_0x442739[_0x6754('0x14')](0x1f4,_0x17cfe8[_0x6754('0x15')]));});});});};exports[_0x6754('0x46')]=function(_0x17c0a0){var _0x2fc9ce=this;var _0x520c2f=_0x17c0a0[_0x6754('0x1e')][_0x6754('0xc')][_0x6754('0x47')];var _0xb3cc2c=_0x17c0a0['body']['where'][_0x6754('0x48')];var _0x5638a4=_0x17c0a0['body'][_0x6754('0xc')][_0x6754('0x49')];return new Promise(function(_0x287fe0,_0x3f48a8){return db[_0x6754('0x8')][_0x6754('0x9')]({'where':{'voiceQueueId':{'$in':_0x520c2f},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x6754('0x25')][_0x6754('0x38')](_0x6754('0x4a')+_0xb3cc2c+_0x6754('0x4b')),'$gt':db[_0x6754('0x25')][_0x6754('0x38')](_0x6754('0x4c'))}},'UserId':{'$in':_0x5638a4}},'include':[{'model':db[_0x6754('0x23')],'as':_0x6754('0x40')},{'model':db[_0x6754('0x4d')],'as':_0x6754('0x4e'),'attributes':['id',_0x6754('0x2a'),'voicePause']},{'model':db[_0x6754('0x4f')],'as':_0x6754('0x50')}]})['then'](function(_0x344565){if(_0x344565[_0x6754('0x2c')]>0x0){return db['sequelize'][_0x6754('0x35')](function(_0x4fed7c){return db[_0x6754('0x8')][_0x6754('0x2e')]({'recallmeNotifiedDate':db['sequelize'][_0x6754('0x38')](_0x6754('0x4c'))},{'where':{'id':{'$in':_[_0x6754('0xf')](_0x344565,'id')}},'transaction':_0x4fed7c})[_0x6754('0x18')](function(){_0x287fe0(_0x344565);})[_0x6754('0x1a')](function(_0x1eb3b0){logger['error'](_0x6754('0x46'),_0x1eb3b0[_0x6754('0x15')],_0x17c0a0);_0x3f48a8(_0x2fc9ce[_0x6754('0x14')](0x1f4,_0x1eb3b0[_0x6754('0x15')]));});})['catch'](function(_0x3c2c2c){logger[_0x6754('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x3c2c2c[_0x6754('0x15')],_0x17c0a0);_0x3f48a8(_0x2fc9ce['error'](0x1f4,_0x3c2c2c[_0x6754('0x15')]));});}else{_0x287fe0(_0x344565);}});});}; \ No newline at end of file +var _0xa82a=['CmList','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','voicePause','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','length','all','GetContactRecallMe','GetCmHopperPreview','keys','phone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()'];(function(_0x6f60dd,_0xd3e265){var _0x4bfca2=function(_0x5c42e9){while(--_0x5c42e9){_0x6f60dd['push'](_0x6f60dd['shift']());}};_0x4bfca2(++_0xd3e265);}(_0xa82a,0xeb));var _0xaa82=function(_0x3b4a9e,_0x1d760b){_0x3b4a9e=_0x3b4a9e-0x0;var _0x4260c8=_0xa82a[_0x3b4a9e];return _0x4260c8;};'use strict';var _=require(_0xaa82('0x0'));var util=require(_0xaa82('0x1'));var moment=require(_0xaa82('0x2'));var BPromise=require(_0xaa82('0x3'));var db=require(_0xaa82('0x4'))['db'];var logger=require(_0xaa82('0x5'))(_0xaa82('0x6'));exports[_0xaa82('0x7')]=function(_0x55445c){var _0x36743d=this;return new Promise(function(_0x383c76,_0x59db0f){return db[_0xaa82('0x8')][_0xaa82('0x9')]({'raw':_0x55445c[_0xaa82('0xa')]?_0x55445c[_0xaa82('0xa')][_0xaa82('0xb')]===undefined?!![]:![]:!![],'where':_0x55445c[_0xaa82('0xa')]?_0x55445c['options'][_0xaa82('0xc')]||null:null,'attributes':_0x55445c['options']?_0x55445c['options'][_0xaa82('0xd')]||null:null,'limit':_0x55445c['options']?_0x55445c['options'][_0xaa82('0xe')]||null:null,'include':_0x55445c[_0xaa82('0xa')]?_0x55445c[_0xaa82('0xa')]['include']?_[_0xaa82('0xf')](_0x55445c[_0xaa82('0xa')][_0xaa82('0x10')],function(_0x58c884){return{'model':db[_0x58c884[_0xaa82('0x11')]],'as':_0x58c884['as'],'attributes':_0x58c884[_0xaa82('0xd')],'include':_0x58c884[_0xaa82('0x10')]?_[_0xaa82('0xf')](_0x58c884[_0xaa82('0x10')],function(_0x267b27){return{'model':db[_0x267b27[_0xaa82('0x11')]],'as':_0x267b27['as'],'attributes':_0x267b27[_0xaa82('0xd')],'include':_0x267b27['include']?_[_0xaa82('0xf')](_0x267b27[_0xaa82('0x10')],function(_0x10838d){return{'model':db[_0x10838d['model']],'as':_0x10838d['as'],'attributes':_0x10838d[_0xaa82('0xd')]};}):[]};}):[]};}):[]:[]})[_0xaa82('0x12')](function(_0x5b89fc){logger[_0xaa82('0x13')](_0xaa82('0x7'),_0x55445c);logger[_0xaa82('0x14')](_0xaa82('0x7'),_0x55445c,JSON[_0xaa82('0x15')](_0x5b89fc));_0x383c76(_0x5b89fc);})[_0xaa82('0x16')](function(_0x3c0bce){logger['error'](_0xaa82('0x7'),_0x3c0bce[_0xaa82('0x17')],_0x55445c);_0x59db0f(_0x36743d[_0xaa82('0x18')](0x1f4,_0x3c0bce[_0xaa82('0x17')]));});});};exports[_0xaa82('0x19')]=function(_0x4478af){var _0x120172=this;return new Promise(function(_0x5bc89a,_0x379fc7){return db[_0xaa82('0x8')][_0xaa82('0x1a')]({'raw':_0x4478af[_0xaa82('0xa')]?_0x4478af['options'][_0xaa82('0xb')]===undefined?!![]:![]:!![],'where':_0x4478af[_0xaa82('0xa')]?_0x4478af[_0xaa82('0xa')]['where']||null:null,'attributes':_0x4478af[_0xaa82('0xa')]?_0x4478af[_0xaa82('0xa')][_0xaa82('0xd')]||null:null,'include':_0x4478af[_0xaa82('0xa')]?_0x4478af['options']['include']?_[_0xaa82('0xf')](_0x4478af[_0xaa82('0xa')][_0xaa82('0x10')],function(_0xd058bf){return{'model':db[_0xd058bf[_0xaa82('0x11')]],'as':_0xd058bf['as'],'attributes':_0xd058bf[_0xaa82('0xd')],'include':_0xd058bf[_0xaa82('0x10')]?_[_0xaa82('0xf')](_0xd058bf[_0xaa82('0x10')],function(_0x2e5650){return{'model':db[_0x2e5650['model']],'as':_0x2e5650['as'],'attributes':_0x2e5650[_0xaa82('0xd')],'include':_0x2e5650[_0xaa82('0x10')]?_[_0xaa82('0xf')](_0x2e5650[_0xaa82('0x10')],function(_0x421ffb){return{'model':db[_0x421ffb[_0xaa82('0x11')]],'as':_0x421ffb['as'],'attributes':_0x421ffb[_0xaa82('0xd')]};}):[]};}):[]};}):[]:[]})[_0xaa82('0x12')](function(_0x4b8152){logger[_0xaa82('0x13')](_0xaa82('0x19'),_0x4478af);logger['debug'](_0xaa82('0x19'),_0x4478af,JSON['stringify'](_0x4b8152));_0x5bc89a(_0x4b8152);})['catch'](function(_0x278180){logger[_0xaa82('0x18')]('ShowCmHopper',_0x278180[_0xaa82('0x17')],_0x4478af);_0x379fc7(_0x120172[_0xaa82('0x18')](0x1f4,_0x278180[_0xaa82('0x17')]));});});};exports[_0xaa82('0x1b')]=function(_0x570195){var _0x1cbe97=this;return new Promise(function(_0x1a0d38,_0x7e29e5){return db['CmHopper'][_0xaa82('0x1c')](_0x570195[_0xaa82('0x1d')],{'raw':_0x570195['options']?_0x570195[_0xaa82('0xa')][_0xaa82('0xb')]===undefined?!![]:![]:!![]})['then'](function(_0x3217e0){logger['info'](_0xaa82('0x1b'),_0x570195);logger[_0xaa82('0x14')](_0xaa82('0x1b'),_0x570195,JSON[_0xaa82('0x15')](_0x3217e0));_0x1a0d38(_0x3217e0);})[_0xaa82('0x16')](function(_0x35e028){logger['error'](_0xaa82('0x1b'),_0x35e028[_0xaa82('0x17')],_0x570195);_0x7e29e5(_0x1cbe97['error'](0x1f4,_0x35e028[_0xaa82('0x17')]));});});};exports[_0xaa82('0x1e')]=function(_0x574ecb){var _0x114ca2=this;return new Promise(function(_0x448979,_0x46a671){return db['CmHopper'][_0xaa82('0x1f')](_0x574ecb['body'],{'raw':_0x574ecb['options']?_0x574ecb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x574ecb['options']?_0x574ecb[_0xaa82('0xa')][_0xaa82('0xc')]||null:null,'attributes':_0x574ecb[_0xaa82('0xa')]?_0x574ecb[_0xaa82('0xa')][_0xaa82('0xd')]||null:null,'limit':_0x574ecb[_0xaa82('0xa')]?_0x574ecb[_0xaa82('0xa')][_0xaa82('0xe')]||null:null})[_0xaa82('0x12')](function(_0x750bc3){logger[_0xaa82('0x13')]('UpdateCmHopper',_0x574ecb);logger['info'](_0xaa82('0x20'),JSON[_0xaa82('0x15')](_0x574ecb[_0xaa82('0xa')]['where']),_0x574ecb['body']['active']);logger[_0xaa82('0x14')](_0xaa82('0x1e'),_0x574ecb,JSON['stringify'](_0x750bc3));_0x448979(_0x750bc3);})['catch'](function(_0x529105){logger[_0xaa82('0x18')](_0xaa82('0x1e'),_0x529105[_0xaa82('0x17')],_0x574ecb);_0x46a671(_0x114ca2[_0xaa82('0x18')](0x1f4,_0x529105[_0xaa82('0x17')]));});});};exports[_0xaa82('0x21')]=function(_0x34ed98){var _0x3d520a=this;return new Promise(function(_0x5633c4,_0x4a1f2d){return db[_0xaa82('0x8')][_0xaa82('0x22')]({'where':_0x34ed98['options']?_0x34ed98['options'][_0xaa82('0xc')]||null:null})[_0xaa82('0x12')](function(_0x547f69){logger[_0xaa82('0x13')](_0xaa82('0x21'),_0x34ed98);logger[_0xaa82('0x14')](_0xaa82('0x21'),_0x34ed98,JSON[_0xaa82('0x15')](_0x547f69));_0x5633c4(_0x547f69);})[_0xaa82('0x16')](function(_0x34bc9d){logger['error'](_0xaa82('0x21'),_0x34bc9d[_0xaa82('0x17')],_0x34ed98);_0x4a1f2d(_0x3d520a[_0xaa82('0x18')](0x1f4,_0x34bc9d[_0xaa82('0x17')]));});});};exports[_0xaa82('0x23')]=function(_0x4578e5){var _0x449331=this;return new Promise(function(_0x1ed4af,_0x398277){return db[_0xaa82('0x24')][_0xaa82('0x25')]()[_0xaa82('0x12')](function(_0xe71fcf){return db[_0xaa82('0x26')][_0xaa82('0x27')](function(_0x397031){return db['CmHopper'][_0xaa82('0x9')]({'where':_0x4578e5['options']?_0x4578e5[_0xaa82('0xa')][_0xaa82('0xc')]||null:null,'attributes':_0x4578e5[_0xaa82('0xa')]?_0x4578e5[_0xaa82('0xa')]['attributes']||null:null,'limit':_0x4578e5[_0xaa82('0xa')]?_0x4578e5[_0xaa82('0xa')]['limit']||null:null,'order':_0x4578e5[_0xaa82('0xa')]?_0x4578e5[_0xaa82('0xa')][_0xaa82('0x28')]||null:null,'transaction':_0x397031,'lock':_0x397031[_0xaa82('0x29')][_0xaa82('0x2a')],'include':[{'model':db['CmContact'],'as':_0xaa82('0x2b'),'attributes':_['keys'](_0xe71fcf)},{'model':db[_0xaa82('0x2c')],'as':_0xaa82('0x2d'),'attributes':['id','name',_0xaa82('0x2e')]}]})[_0xaa82('0x12')](function(_0x174bb4){var _0x543f66=[];var _0x2a3036=[];for(var _0x346cf3=0x0;_0x346cf3<_0x174bb4['length'];_0x346cf3+=0x1){var _0x227126=_0x174bb4[_0x346cf3][_0xaa82('0x2f')];if(_0x227126===null){_0x543f66['push'](_0x174bb4[_0x346cf3]['update'](_0x4578e5['body'],{'transaction':_0x397031}));}else if(!_0x2a3036['includes'](_0x227126)){_0x2a3036[_0xaa82('0x30')](_0x227126);_0x543f66[_0xaa82('0x30')](_0x174bb4[_0x346cf3][_0xaa82('0x1f')](_0x4578e5[_0xaa82('0x1d')],{'transaction':_0x397031}));}}return BPromise['all'](_0x543f66);});})['then'](function(_0x37a297){logger[_0xaa82('0x13')](_0xaa82('0x23'),_0x4578e5);if(_0x37a297['length']>0x0){logger[_0xaa82('0x13')](_0xaa82('0x31'),_0x37a297[0x0][_0xaa82('0x32')]['id'],_0x37a297[0x0][_0xaa82('0x32')][_0xaa82('0x33')],_0x37a297[0x0][_0xaa82('0x32')][_0xaa82('0x34')]);}logger[_0xaa82('0x14')](_0xaa82('0x23'),_0x4578e5,JSON['stringify'](_0x37a297));_0x1ed4af(_0x37a297);})['catch'](function(_0xc9f5db){logger[_0xaa82('0x18')](_0xaa82('0x23'),_0xc9f5db['message'],_0x4578e5);_0x398277(_0x449331[_0xaa82('0x18')](0x1f4,_0xc9f5db[_0xaa82('0x17')]));});});});};exports['MoveContactManagedDialer']=function(_0x227c52){var _0xcbcb05=this;return new Promise(function(_0x12ff4c,_0x3fcc84){return db[_0xaa82('0x26')][_0xaa82('0x27')](function(_0x55dca5){return db[_0xaa82('0x35')][_0xaa82('0x1c')](_0x227c52[_0xaa82('0x1d')],{'raw':_0x227c52['options']?_0x227c52[_0xaa82('0xa')][_0xaa82('0xb')]===undefined?!![]:![]:!![],'transaction':_0x55dca5})[_0xaa82('0x12')](function(){logger[_0xaa82('0x13')](_0xaa82('0x36'),JSON[_0xaa82('0x15')](_0x227c52['options'][_0xaa82('0xc')]),_0x227c52[_0xaa82('0xa')]['where'][_0xaa82('0x34')]);return db['CmHopper'][_0xaa82('0x22')]({'where':_0x227c52['options']?_0x227c52[_0xaa82('0xa')][_0xaa82('0xc')]||null:null,'transaction':_0x55dca5});});})[_0xaa82('0x12')](function(_0x5b10dd){logger[_0xaa82('0x13')](_0xaa82('0x37'),_0x227c52);logger['debug'](_0xaa82('0x37'),_0x227c52,JSON[_0xaa82('0x15')](_0x5b10dd));_0x12ff4c(_0x5b10dd);})[_0xaa82('0x16')](function(_0x851b09){logger[_0xaa82('0x18')](_0xaa82('0x37'),_0x851b09['message'],_0x227c52);_0x3fcc84(_0xcbcb05[_0xaa82('0x18')](0x1f4,_0x851b09[_0xaa82('0x17')]));});});};exports[_0xaa82('0x38')]=function(_0xbe6e67){var _0x3adf8a=this;return new Promise(function(_0x1cd170,_0x33461b){return db[_0xaa82('0x8')]['findAll']({'raw':_0xbe6e67[_0xaa82('0xa')]?_0xbe6e67[_0xaa82('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0xbe6e67['options']?_0xbe6e67['options'][_0xaa82('0xc')]||null:null,'attributes':[[db[_0xaa82('0x26')]['fn'](_0xaa82('0x39'),db[_0xaa82('0x26')]['fn']('IF',db[_0xaa82('0x26')][_0xaa82('0x3a')]('`scheduledat`\x20>=\x20'+util['format'](_0xaa82('0x3b'),moment()['format'](_0xaa82('0x3c')))+_0xaa82('0x3d')))),_0xaa82('0x3e')]]})[_0xaa82('0x12')](function(_0x598357){logger['info'](_0xaa82('0x38'),_0xbe6e67);logger[_0xaa82('0x14')](_0xaa82('0x38'),_0xbe6e67,JSON[_0xaa82('0x15')](_0x598357));_0x1cd170(_0x598357);})[_0xaa82('0x16')](function(_0x1dc763){logger[_0xaa82('0x18')](_0xaa82('0x38'),_0x1dc763[_0xaa82('0x17')],_0xbe6e67);_0x33461b(_0x3adf8a[_0xaa82('0x18')](0x1f4,_0x1dc763[_0xaa82('0x17')]));});});};exports['GetContactRecallMe']=function(_0x244227){var _0x227201=this;return new Promise(function(_0x3e7e9b,_0x265ecd){return db[_0xaa82('0x24')]['describe']()[_0xaa82('0x12')](function(){return db[_0xaa82('0x26')]['transaction'](function(_0x248c00){return db[_0xaa82('0x8')][_0xaa82('0x9')]({'where':_0x244227[_0xaa82('0xa')]?_0x244227[_0xaa82('0xa')][_0xaa82('0xc')]||null:null,'attributes':_0x244227[_0xaa82('0xa')]?_0x244227[_0xaa82('0xa')]['attributes']||null:null,'limit':0x1,'order':_0x244227[_0xaa82('0xa')]?_0x244227[_0xaa82('0xa')][_0xaa82('0x28')]||null:null,'group':db[_0xaa82('0x8')][_0xaa82('0x2f')],'transaction':_0x248c00,'lock':_0x248c00[_0xaa82('0x29')][_0xaa82('0x2a')],'include':_0x244227[_0xaa82('0xa')]?_0x244227[_0xaa82('0xa')][_0xaa82('0x10')]?_['map'](_0x244227['options'][_0xaa82('0x10')],function(_0x15434a){return{'model':db[_0x15434a[_0xaa82('0x11')]],'as':_0x15434a['as'],'attributes':_0x15434a[_0xaa82('0xd')],'include':_0x15434a[_0xaa82('0x10')]?_[_0xaa82('0xf')](_0x15434a[_0xaa82('0x10')],function(_0x1a007f){return{'model':db[_0x1a007f[_0xaa82('0x11')]],'as':_0x1a007f['as'],'attributes':_0x1a007f[_0xaa82('0xd')],'include':_0x1a007f['include']?_['map'](_0x1a007f[_0xaa82('0x10')],function(_0x439120){return{'model':db[_0x439120[_0xaa82('0x11')]],'as':_0x439120['as'],'attributes':_0x439120['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa82('0x12')](function(_0x49fe58){var _0x1bf429=[];for(var _0x511a1c=0x0;_0x511a1c<_0x49fe58[_0xaa82('0x3f')];_0x511a1c+=0x1){_0x1bf429[_0xaa82('0x30')](_0x49fe58[_0x511a1c]['update'](_0x244227[_0xaa82('0x1d')],{'transaction':_0x248c00}));}return BPromise[_0xaa82('0x40')](_0x1bf429);});})[_0xaa82('0x12')](function(_0x1d7899){logger['info'](_0xaa82('0x41'),_0x244227);logger[_0xaa82('0x14')](_0xaa82('0x41'),_0x244227,JSON[_0xaa82('0x15')](_0x1d7899));_0x3e7e9b(_0x1d7899);})[_0xaa82('0x16')](function(_0x166aeb){logger[_0xaa82('0x18')](_0xaa82('0x41'),_0x166aeb[_0xaa82('0x17')],_0x244227);_0x265ecd(_0x227201[_0xaa82('0x18')](0x1f4,_0x166aeb[_0xaa82('0x17')]));});});});};exports[_0xaa82('0x42')]=function(_0x598658){var _0x387ede=this;return new Promise(function(_0xc06a13,_0x1222d5){db[_0xaa82('0x24')][_0xaa82('0x25')]()[_0xaa82('0x12')](function(_0x195892){return db[_0xaa82('0x8')]['findAll']({'raw':_0x598658['options']?_0x598658[_0xaa82('0xa')][_0xaa82('0xb')]===undefined?!![]:![]:!![],'where':_0x598658['options']?_0x598658[_0xaa82('0xa')][_0xaa82('0xc')]||null:null,'attributes':_0x598658[_0xaa82('0xa')]?_0x598658[_0xaa82('0xa')][_0xaa82('0xd')]||null:null,'limit':_0x598658[_0xaa82('0xa')]?_0x598658[_0xaa82('0xa')][_0xaa82('0xe')]||null:null,'include':_0x598658[_0xaa82('0xa')]?_0x598658['options']['include']?_[_0xaa82('0xf')](_0x598658[_0xaa82('0xa')][_0xaa82('0x10')],function(_0x952359){return{'model':db[_0x952359['model']],'as':_0x952359['as'],'attributes':_0x952359['as']===_0xaa82('0x2b')?_[_0xaa82('0x43')](_0x195892):_0x952359[_0xaa82('0xd')],'include':_0x952359['include']?_[_0xaa82('0xf')](_0x952359[_0xaa82('0x10')],function(_0xed6411){return{'model':db[_0xed6411[_0xaa82('0x11')]],'as':_0xed6411['as'],'attributes':_0xed6411[_0xaa82('0xd')],'include':_0xed6411[_0xaa82('0x10')]?_[_0xaa82('0xf')](_0xed6411['include'],function(_0x381f9c){return{'model':db[_0x381f9c[_0xaa82('0x11')]],'as':_0x381f9c['as'],'attributes':_0x381f9c[_0xaa82('0xd')]};}):[]};}):[]};}):[]:[]})[_0xaa82('0x12')](function(_0x5e3deb){logger[_0xaa82('0x13')](_0xaa82('0x7'),_0x598658);logger[_0xaa82('0x14')](_0xaa82('0x7'),_0x598658,JSON['stringify'](_0x5e3deb));_0xc06a13(_0x5e3deb);})[_0xaa82('0x16')](function(_0x1ca341){logger[_0xaa82('0x18')](_0xaa82('0x7'),_0x1ca341[_0xaa82('0x17')],_0x598658);_0x1222d5(_0x387ede['error'](0x1f4,_0x1ca341['message']));});});});};exports['GetContactByPhone']=function(_0x5a0a56){var _0x1ccb50=this;return new Promise(function(_0x678585,_0x589b06){return db[_0xaa82('0x24')]['findOne']({'raw':!![],'where':{'phone':_0x5a0a56[_0xaa82('0xa')]['where'][_0xaa82('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0xaa82('0x45')]]})[_0xaa82('0x12')](function(_0x5a8fba){logger[_0xaa82('0x13')](_0xaa82('0x46'),_0x5a0a56);logger[_0xaa82('0x14')](_0xaa82('0x46'),_0x5a0a56,JSON['stringify'](_0x5a8fba));_0x678585(_0x5a8fba);})[_0xaa82('0x16')](function(_0x7a86ff){logger[_0xaa82('0x18')](_0xaa82('0x46'),_0x7a86ff[_0xaa82('0x17')],_0x5a0a56);_0x589b06(_0x1ccb50['error'](0x1f4,_0x7a86ff[_0xaa82('0x17')]));});});};exports[_0xaa82('0x47')]=function(_0x11548c){var _0x402303=this;return new Promise(function(_0x350028,_0x482c96){return db[_0xaa82('0x26')][_0xaa82('0x27')](function(_0x56863c){var _0x3e842f=_0x11548c[_0xaa82('0xa')]&&_0x11548c[_0xaa82('0xa')][_0xaa82('0xc')]?_0x11548c['options'][_0xaa82('0xc')]:{};return db[_0xaa82('0x8')]['update'](_0x11548c[_0xaa82('0x1d')],{'where':_0x3e842f,'transaction':_0x56863c})[_0xaa82('0x12')](function(_0x1a409d){logger[_0xaa82('0x13')](_0xaa82('0x47'),_0x11548c);logger[_0xaa82('0x14')](_0xaa82('0x47'),_0x11548c,JSON[_0xaa82('0x15')](_0x1a409d));_0x350028(_0x1a409d);})[_0xaa82('0x16')](function(_0x255434){logger[_0xaa82('0x18')](_0xaa82('0x47'),_0x255434['message'],_0x11548c);_0x482c96(_0x402303[_0xaa82('0x18')](0x1f4,_0x255434[_0xaa82('0x17')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xb09c05){var _0x3e4245=this;var _0x259a06=_0xb09c05[_0xaa82('0x1d')][_0xaa82('0xc')][_0xaa82('0x48')];var _0x423aa2=_0xb09c05[_0xaa82('0x1d')][_0xaa82('0xc')][_0xaa82('0x49')];var _0x36fb90=_0xb09c05[_0xaa82('0x1d')][_0xaa82('0xc')][_0xaa82('0x4a')];return new Promise(function(_0x578315,_0x4e47a2){return db[_0xaa82('0x8')]['findAll']({'where':{'voiceQueueId':{'$in':_0x259a06},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xaa82('0x3a')]('NOW()\x20+\x20INTERVAL\x20'+_0x423aa2+_0xaa82('0x4b')),'$gt':db[_0xaa82('0x26')][_0xaa82('0x3a')](_0xaa82('0x4c'))}},'UserId':{'$in':_0x36fb90}},'include':[{'model':db[_0xaa82('0x24')],'as':_0xaa82('0x2b')},{'model':db['User'],'as':_0xaa82('0x2d'),'attributes':['id','name',_0xaa82('0x2e')]},{'model':db[_0xaa82('0x4d')],'as':'List'}]})[_0xaa82('0x12')](function(_0x28973e){if(_0x28973e[_0xaa82('0x3f')]>0x0){return db[_0xaa82('0x26')]['transaction'](function(_0xfb4832){return db[_0xaa82('0x8')]['update']({'recallmeNotifiedDate':db[_0xaa82('0x26')]['literal'](_0xaa82('0x4c'))},{'where':{'id':{'$in':_[_0xaa82('0xf')](_0x28973e,'id')}},'transaction':_0xfb4832})['then'](function(){_0x578315(_0x28973e);})[_0xaa82('0x16')](function(_0x29e0d2){logger[_0xaa82('0x18')]('CmHopperHandlePreviewRecallNotifications',_0x29e0d2[_0xaa82('0x17')],_0xb09c05);_0x4e47a2(_0x3e4245[_0xaa82('0x18')](0x1f4,_0x29e0d2[_0xaa82('0x17')]));});})[_0xaa82('0x16')](function(_0x18737c){logger[_0xaa82('0x18')]('CmHopperHandlePreviewRecallNotifications',_0x18737c[_0xaa82('0x17')],_0xb09c05);_0x4e47a2(_0x3e4245['error'](0x1f4,_0x18737c[_0xaa82('0x17')]));});}else{_0x578315(_0x28973e);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index bb1fd4a..c5ad674 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 _0x7dfe=['/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','../../components/auth/service','./cmHopper.controller','isAuthenticated','get','/describe','describe','/opencontacts','/timezones','getTimezones','/:id','show','post'];(function(_0x5f0108,_0xa83ba6){var _0x59b349=function(_0x12cece){while(--_0x12cece){_0x5f0108['push'](_0x5f0108['shift']());}};_0x59b349(++_0xa83ba6);}(_0x7dfe,0x195));var _0xe7df=function(_0x49f5ae,_0x17d573){_0x49f5ae=_0x49f5ae-0x0;var _0x139c30=_0x7dfe[_0x49f5ae];return _0x139c30;};'use strict';var express=require(_0xe7df('0x0'));var router=express['Router']();var auth=require(_0xe7df('0x1'));var controller=require(_0xe7df('0x2'));router['get']('/',auth[_0xe7df('0x3')](),controller['index']);router[_0xe7df('0x4')](_0xe7df('0x5'),auth[_0xe7df('0x3')](),controller[_0xe7df('0x6')]);router['get'](_0xe7df('0x7'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0xe7df('0x8'),auth[_0xe7df('0x3')](),controller[_0xe7df('0x9')]);router[_0xe7df('0x4')](_0xe7df('0xa'),auth[_0xe7df('0x3')](),controller[_0xe7df('0xb')]);router[_0xe7df('0x4')]('/:id/previewrecall',auth[_0xe7df('0x3')](),controller['getPreviewRecall']);router[_0xe7df('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe7df('0xc')](_0xe7df('0xd'),auth[_0xe7df('0x3')](),controller[_0xe7df('0xe')]);router[_0xe7df('0xc')](_0xe7df('0xf'),auth[_0xe7df('0x3')](),controller[_0xe7df('0x10')]);router[_0xe7df('0x11')](_0xe7df('0xa'),auth['isAuthenticated'](),controller[_0xe7df('0x12')]);router[_0xe7df('0x13')](_0xe7df('0xa'),auth[_0xe7df('0x3')](),controller[_0xe7df('0x14')]);module[_0xe7df('0x15')]=router; \ No newline at end of file +var _0x4ada=['/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','destroy','exports','express','../../components/auth/service','get','isAuthenticated','index','describe'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x4ada,0xf7));var _0xa4ad=function(_0xd1515c,_0x22e184){_0xd1515c=_0xd1515c-0x0;var _0x46fd7b=_0x4ada[_0xd1515c];return _0x46fd7b;};'use strict';var express=require(_0xa4ad('0x0'));var router=express['Router']();var auth=require(_0xa4ad('0x1'));var controller=require('./cmHopper.controller');router[_0xa4ad('0x2')]('/',auth[_0xa4ad('0x3')](),controller[_0xa4ad('0x4')]);router['get']('/describe',auth[_0xa4ad('0x3')](),controller[_0xa4ad('0x5')]);router[_0xa4ad('0x2')](_0xa4ad('0x6'),auth[_0xa4ad('0x3')](),controller[_0xa4ad('0x7')]);router[_0xa4ad('0x2')](_0xa4ad('0x8'),auth[_0xa4ad('0x3')](),controller[_0xa4ad('0x9')]);router['get'](_0xa4ad('0xa'),auth['isAuthenticated'](),controller[_0xa4ad('0xb')]);router['get'](_0xa4ad('0xc'),auth[_0xa4ad('0x3')](),controller[_0xa4ad('0xd')]);router[_0xa4ad('0xe')]('/',auth[_0xa4ad('0x3')](),controller['create']);router['post'](_0xa4ad('0xf'),auth['isAuthenticated'](),controller[_0xa4ad('0x10')]);router[_0xa4ad('0xe')](_0xa4ad('0x11'),auth['isAuthenticated'](),controller[_0xa4ad('0x12')]);router[_0xa4ad('0x13')](_0xa4ad('0xa'),auth['isAuthenticated'](),controller[_0xa4ad('0x14')]);router['delete'](_0xa4ad('0xa'),auth[_0xa4ad('0x3')](),controller[_0xa4ad('0x15')]);module[_0xa4ad('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 5d6dfb8..351a8a9 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 _0x6975=['exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6975,0x1cd));var _0x5697=function(_0x3e23c1,_0xb0c332){_0x3e23c1=_0x3e23c1-0x0;var _0x393fea=_0x6975[_0x3e23c1];return _0x393fea;};'use strict';var moment=require(_0x5697('0x0'));var Sequelize=require('sequelize');module[_0x5697('0x1')]={'CmHopperId':{'type':Sequelize[_0x5697('0x2')]},'phone':{'type':Sequelize[_0x5697('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5697('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5697('0x4')],'defaultValue':moment()['format'](_0x5697('0x5'))},'countbusyretry':{'type':Sequelize[_0x5697('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5697('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5697('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5697('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5697('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5697('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x46e6=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46e6,0xde));var _0x646e=function(_0x32c73c,_0xaa42db){_0x32c73c=_0x32c73c-0x0;var _0x3be534=_0x46e6[_0x32c73c];return _0x3be534;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x646e('0x0')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x646e('0x1')],'defaultValue':moment()[_0x646e('0x2')](_0x646e('0x3'))},'countbusyretry':{'type':Sequelize[_0x646e('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x646e('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x646e('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x646e('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x646e('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x646e('0x0')],'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 db2df75..6ad51a3 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 _0xcfd2=['json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x645b40,_0x378959){var _0x1f6f74=function(_0x290152){while(--_0x290152){_0x645b40['push'](_0x645b40['shift']());}};_0x1f6f74(++_0x378959);}(_0xcfd2,0x8c));var _0x2cfd=function(_0x3dac00,_0x156c5b){_0x3dac00=_0x3dac00-0x0;var _0x16f6a2=_0xcfd2[_0x3dac00];return _0x16f6a2;};'use strict';var emlformat=require(_0x2cfd('0x0'));var rimraf=require(_0x2cfd('0x1'));var zipdir=require(_0x2cfd('0x2'));var jsonpatch=require(_0x2cfd('0x3'));var rp=require(_0x2cfd('0x4'));var moment=require(_0x2cfd('0x5'));var BPromise=require(_0x2cfd('0x6'));var Mustache=require(_0x2cfd('0x7'));var util=require(_0x2cfd('0x8'));var path=require(_0x2cfd('0x9'));var sox=require(_0x2cfd('0xa'));var csv=require(_0x2cfd('0xb'));var ejs=require(_0x2cfd('0xc'));var fs=require('fs');var fs_extra=require(_0x2cfd('0xd'));var _=require(_0x2cfd('0xe'));var squel=require(_0x2cfd('0xf'));var crypto=require(_0x2cfd('0x10'));var jsforce=require(_0x2cfd('0x11'));var deskjs=require(_0x2cfd('0x12'));var toCsv=require(_0x2cfd('0xb'));var querystring=require(_0x2cfd('0x13'));var Papa=require(_0x2cfd('0x14'));var Redis=require(_0x2cfd('0x15'));var authService=require(_0x2cfd('0x16'));var qs=require(_0x2cfd('0x17'));var as=require(_0x2cfd('0x18'));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(_0x2cfd('0x19'));var db=require(_0x2cfd('0x1a'))['db'];function respondWithStatusCode(_0x317433,_0x316ed8){_0x316ed8=_0x316ed8||0xcc;return function(_0x17f25f){if(_0x17f25f){return _0x317433[_0x2cfd('0x1b')](_0x316ed8);}return _0x317433[_0x2cfd('0x1c')](_0x316ed8)[_0x2cfd('0x1d')]();};}function respondWithResult(_0xb419e1,_0x597060){_0x597060=_0x597060||0xc8;return function(_0x2b4ea8){if(_0x2b4ea8){return _0xb419e1[_0x2cfd('0x1c')](_0x597060)[_0x2cfd('0x1e')](_0x2b4ea8);}};}function respondWithFilteredResult(_0xd3d543,_0x3f5003){return function(_0x1f819c){if(_0x1f819c){var _0x541399=typeof _0x3f5003[_0x2cfd('0x1f')]===_0x2cfd('0x20')&&typeof _0x3f5003[_0x2cfd('0x21')]===_0x2cfd('0x20');var _0x126ac3=_0x1f819c[_0x2cfd('0x22')];var _0x48c145=_0x541399?0x0:_0x3f5003[_0x2cfd('0x1f')];var _0x14f8f3=_0x541399?_0x1f819c['count']:_0x3f5003[_0x2cfd('0x1f')]+_0x3f5003[_0x2cfd('0x21')];var _0x4ebc33;if(_0x14f8f3>=_0x126ac3){_0x14f8f3=_0x126ac3;_0x4ebc33=0xc8;}else{_0x4ebc33=0xce;}_0xd3d543[_0x2cfd('0x1c')](_0x4ebc33);return _0xd3d543[_0x2cfd('0x23')]('Content-Range',_0x48c145+'-'+_0x14f8f3+'/'+_0x126ac3)[_0x2cfd('0x1e')](_0x1f819c);}return null;};}function patchUpdates(_0x5ce792){return function(_0x412f03){try{jsonpatch[_0x2cfd('0x24')](_0x412f03,_0x5ce792,!![]);}catch(_0x1ae4d5){return BPromise[_0x2cfd('0x25')](_0x1ae4d5);}return _0x412f03[_0x2cfd('0x26')]();};}function saveUpdates(_0x16581c,_0x68bf3c){return function(_0x3b1a54){if(_0x3b1a54){return _0x3b1a54[_0x2cfd('0x27')](_0x16581c)[_0x2cfd('0x28')](function(_0x34d993){return _0x34d993;});}return null;};}function removeEntity(_0x35adae,_0xc96f9b){return function(_0x43f3a3){if(_0x43f3a3){return _0x43f3a3[_0x2cfd('0x29')]()[_0x2cfd('0x28')](function(){var _0x2ae85f=_0x43f3a3[_0x2cfd('0x2a')]({'plain':!![]});var _0x116a50='CmHopperAdditionalPhones';return db[_0x2cfd('0x2b')][_0x2cfd('0x29')]({'where':{'type':_0x116a50,'resourceId':_0x2ae85f['id']}})[_0x2cfd('0x28')](function(){return _0x43f3a3;});})[_0x2cfd('0x28')](function(){_0x35adae[_0x2cfd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ac99,_0x33972e){return function(_0x314a21){if(!_0x314a21){_0x12ac99[_0x2cfd('0x1b')](0x194);}return _0x314a21;};}function handleError(_0x5ea535,_0x5a2ccf){_0x5a2ccf=_0x5a2ccf||0x1f4;return function(_0x19d29){logger[_0x2cfd('0x2c')](_0x19d29[_0x2cfd('0x2d')]);if(_0x19d29[_0x2cfd('0x2e')]){delete _0x19d29[_0x2cfd('0x2e')];}_0x5ea535[_0x2cfd('0x1c')](_0x5a2ccf)['send'](_0x19d29);};}exports['index']=function(_0x452797,_0x3a7043){var _0x5bc0d1={},_0x547386={},_0x4579f6={'count':0x0,'rows':[]};var _0x25f391=_[_0x2cfd('0x2f')](db[_0x2cfd('0x30')][_0x2cfd('0x31')],function(_0x385816){return{'name':_0x385816[_0x2cfd('0x32')],'type':_0x385816[_0x2cfd('0x33')][_0x2cfd('0x34')]};});_0x547386[_0x2cfd('0x35')]=_[_0x2cfd('0x2f')](_0x25f391,_0x2cfd('0x2e'));_0x547386[_0x2cfd('0x36')]=_[_0x2cfd('0x37')](_0x452797[_0x2cfd('0x36')]);_0x547386[_0x2cfd('0x38')]=_[_0x2cfd('0x39')](_0x547386['model'],_0x547386['query']);_0x5bc0d1['attributes']=_[_0x2cfd('0x39')](_0x547386[_0x2cfd('0x35')],qs[_0x2cfd('0x3a')](_0x452797[_0x2cfd('0x36')][_0x2cfd('0x3a')]));_0x5bc0d1['attributes']=_0x5bc0d1[_0x2cfd('0x3b')]['length']?_0x5bc0d1[_0x2cfd('0x3b')]:_0x547386['model'];if(!_0x452797['query'][_0x2cfd('0x3c')]('nolimit')){_0x5bc0d1['limit']=qs[_0x2cfd('0x21')](_0x452797[_0x2cfd('0x36')][_0x2cfd('0x21')]);_0x5bc0d1['offset']=qs['offset'](_0x452797[_0x2cfd('0x36')][_0x2cfd('0x1f')]);}_0x5bc0d1[_0x2cfd('0x3d')]=qs['sort'](_0x452797[_0x2cfd('0x36')][_0x2cfd('0x3e')]);_0x5bc0d1['where']=qs[_0x2cfd('0x38')](_[_0x2cfd('0x3f')](_0x452797[_0x2cfd('0x36')],_0x547386[_0x2cfd('0x38')]),_0x25f391);if(_0x452797[_0x2cfd('0x36')][_0x2cfd('0x40')]){_0x5bc0d1[_0x2cfd('0x41')]=_[_0x2cfd('0x42')](_0x5bc0d1[_0x2cfd('0x41')],{'$or':_[_0x2cfd('0x2f')](_0x25f391,function(_0x5e1ae1){if(_0x5e1ae1[_0x2cfd('0x33')]!==_0x2cfd('0x43')){var _0x5e801={};_0x5e801[_0x5e1ae1[_0x2cfd('0x2e')]]={'$like':'%'+_0x452797[_0x2cfd('0x36')][_0x2cfd('0x40')]+'%'};return _0x5e801;}})});}_0x5bc0d1=_[_0x2cfd('0x42')]({},_0x5bc0d1,_0x452797[_0x2cfd('0x44')]);var _0x485ea2={'where':_0x5bc0d1['where']};return db[_0x2cfd('0x30')][_0x2cfd('0x22')](_0x485ea2)['then'](function(_0x247ce2){_0x4579f6[_0x2cfd('0x22')]=_0x247ce2;if(_0x452797[_0x2cfd('0x36')][_0x2cfd('0x45')]){_0x5bc0d1[_0x2cfd('0x46')]=[{'all':!![]}];}return db[_0x2cfd('0x30')]['findAll'](_0x5bc0d1);})['then'](function(_0x322888){_0x4579f6[_0x2cfd('0x47')]=_0x322888;return _0x4579f6;})['then'](respondWithFilteredResult(_0x3a7043,_0x5bc0d1))['catch'](handleError(_0x3a7043,null));};exports['show']=function(_0x218d3f,_0x3f1a65){var _0xc33aa9={'raw':!![],'where':{'id':_0x218d3f[_0x2cfd('0x48')]['id']}},_0x862904={};_0x862904[_0x2cfd('0x35')]=_[_0x2cfd('0x37')](db[_0x2cfd('0x30')][_0x2cfd('0x31')]);_0x862904[_0x2cfd('0x36')]=_[_0x2cfd('0x37')](_0x218d3f[_0x2cfd('0x36')]);_0x862904[_0x2cfd('0x38')]=_[_0x2cfd('0x39')](_0x862904[_0x2cfd('0x35')],_0x862904[_0x2cfd('0x36')]);_0xc33aa9[_0x2cfd('0x3b')]=_[_0x2cfd('0x39')](_0x862904[_0x2cfd('0x35')],qs[_0x2cfd('0x3a')](_0x218d3f[_0x2cfd('0x36')]['fields']));_0xc33aa9[_0x2cfd('0x3b')]=_0xc33aa9['attributes'][_0x2cfd('0x49')]?_0xc33aa9[_0x2cfd('0x3b')]:_0x862904[_0x2cfd('0x35')];if(_0x218d3f[_0x2cfd('0x36')][_0x2cfd('0x45')]){_0xc33aa9[_0x2cfd('0x46')]=[{'all':!![]}];}_0xc33aa9=_[_0x2cfd('0x42')]({},_0xc33aa9,_0x218d3f[_0x2cfd('0x44')]);return db[_0x2cfd('0x30')][_0x2cfd('0x4a')](_0xc33aa9)[_0x2cfd('0x28')](handleEntityNotFound(_0x3f1a65,null))[_0x2cfd('0x28')](respondWithResult(_0x3f1a65,null))[_0x2cfd('0x4b')](handleError(_0x3f1a65,null));};exports['create']=function(_0x176510,_0x5f4e75){return db[_0x2cfd('0x30')][_0x2cfd('0x4c')](_0x176510['body'],{})[_0x2cfd('0x28')](function(_0x463014){var _0x8ed7be=_0x176510[_0x2cfd('0x4d')]['get']({'plain':!![]});if(!_0x8ed7be)throw new Error(_0x2cfd('0x4e'));if(_0x8ed7be[_0x2cfd('0x4f')]===_0x2cfd('0x4d')){var _0x338591=_0x463014[_0x2cfd('0x2a')]({'plain':!![]});var _0x5ea66c=_0x2cfd('0x50');return db[_0x2cfd('0x51')][_0x2cfd('0x4a')]({'where':{'name':_0x5ea66c,'userProfileId':_0x8ed7be[_0x2cfd('0x52')]},'raw':!![]})[_0x2cfd('0x28')](function(_0x18d8a2){if(_0x18d8a2&&_0x18d8a2['autoAssociation']===0x0){return db['UserProfileResource'][_0x2cfd('0x4c')]({'name':_0x338591['name'],'resourceId':_0x338591['id'],'type':_0x18d8a2[_0x2cfd('0x2e')],'sectionId':_0x18d8a2['id']},{})[_0x2cfd('0x28')](function(){return _0x463014;});}else{return _0x463014;}})['catch'](function(_0x388c80){logger['error'](_0x2cfd('0x53'),_0x388c80);throw _0x388c80;});}return _0x463014;})['then'](respondWithResult(_0x5f4e75,0xc9))['catch'](handleError(_0x5f4e75,null));};exports[_0x2cfd('0x27')]=function(_0x3065d1,_0x5d3ef0){if(_0x3065d1[_0x2cfd('0x54')]['id']){delete _0x3065d1[_0x2cfd('0x54')]['id'];}return db[_0x2cfd('0x30')][_0x2cfd('0x4a')]({'where':{'id':_0x3065d1[_0x2cfd('0x48')]['id']}})[_0x2cfd('0x28')](handleEntityNotFound(_0x5d3ef0,null))[_0x2cfd('0x28')](saveUpdates(_0x3065d1[_0x2cfd('0x54')],null))[_0x2cfd('0x28')](respondWithResult(_0x5d3ef0,null))[_0x2cfd('0x4b')](handleError(_0x5d3ef0,null));};exports[_0x2cfd('0x29')]=function(_0x279c6f,_0x344899){return db[_0x2cfd('0x30')][_0x2cfd('0x4a')]({'where':{'id':_0x279c6f[_0x2cfd('0x48')]['id']}})[_0x2cfd('0x28')](handleEntityNotFound(_0x344899,null))[_0x2cfd('0x28')](removeEntity(_0x344899,null))['catch'](handleError(_0x344899,null));}; \ No newline at end of file +var _0x9478=['then','get','CmHopperAdditionalPhones','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','options','catch','create','body','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','update'];(function(_0x17e290,_0x208e12){var _0x3ded49=function(_0x19d937){while(--_0x19d937){_0x17e290['push'](_0x17e290['shift']());}};_0x3ded49(++_0x208e12);}(_0x9478,0x16a));var _0x8947=function(_0x306378,_0x206999){_0x306378=_0x306378-0x0;var _0x3ec798=_0x9478[_0x306378];return _0x3ec798;};'use strict';var emlformat=require(_0x8947('0x0'));var rimraf=require(_0x8947('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8947('0x2'));var rp=require(_0x8947('0x3'));var moment=require(_0x8947('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8947('0x5'));var util=require('util');var path=require(_0x8947('0x6'));var sox=require(_0x8947('0x7'));var csv=require(_0x8947('0x8'));var ejs=require(_0x8947('0x9'));var fs=require('fs');var fs_extra=require(_0x8947('0xa'));var _=require(_0x8947('0xb'));var squel=require(_0x8947('0xc'));var crypto=require(_0x8947('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8947('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8947('0xf'));var Redis=require('ioredis');var authService=require(_0x8947('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8947('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8947('0x12'));var config=require(_0x8947('0x13'));var licenseUtil=require(_0x8947('0x14'));var db=require(_0x8947('0x15'))['db'];function respondWithStatusCode(_0x5e3a9b,_0x49cecb){_0x49cecb=_0x49cecb||0xcc;return function(_0x1dcb60){if(_0x1dcb60){return _0x5e3a9b[_0x8947('0x16')](_0x49cecb);}return _0x5e3a9b[_0x8947('0x17')](_0x49cecb)[_0x8947('0x18')]();};}function respondWithResult(_0x219866,_0x885f03){_0x885f03=_0x885f03||0xc8;return function(_0x2298a6){if(_0x2298a6){return _0x219866['status'](_0x885f03)[_0x8947('0x19')](_0x2298a6);}};}function respondWithFilteredResult(_0x52e55b,_0x26acf1){return function(_0x35bca1){if(_0x35bca1){var _0x24d738=typeof _0x26acf1['offset']===_0x8947('0x1a')&&typeof _0x26acf1[_0x8947('0x1b')]===_0x8947('0x1a');var _0x2466f2=_0x35bca1[_0x8947('0x1c')];var _0x270ef7=_0x24d738?0x0:_0x26acf1[_0x8947('0x1d')];var _0xe7e2f5=_0x24d738?_0x35bca1[_0x8947('0x1c')]:_0x26acf1[_0x8947('0x1d')]+_0x26acf1[_0x8947('0x1b')];var _0x3f9263;if(_0xe7e2f5>=_0x2466f2){_0xe7e2f5=_0x2466f2;_0x3f9263=0xc8;}else{_0x3f9263=0xce;}_0x52e55b[_0x8947('0x17')](_0x3f9263);return _0x52e55b['set']('Content-Range',_0x270ef7+'-'+_0xe7e2f5+'/'+_0x2466f2)['json'](_0x35bca1);}return null;};}function patchUpdates(_0x49438b){return function(_0xf158b6){try{jsonpatch[_0x8947('0x1e')](_0xf158b6,_0x49438b,!![]);}catch(_0x1b08a7){return BPromise['reject'](_0x1b08a7);}return _0xf158b6[_0x8947('0x1f')]();};}function saveUpdates(_0x4b90da,_0x673bb9){return function(_0x4c9116){if(_0x4c9116){return _0x4c9116[_0x8947('0x20')](_0x4b90da)[_0x8947('0x21')](function(_0x3fa370){return _0x3fa370;});}return null;};}function removeEntity(_0x5dc124,_0xd77009){return function(_0x5cd1c6){if(_0x5cd1c6){return _0x5cd1c6['destroy']()[_0x8947('0x21')](function(){var _0x4f1bdb=_0x5cd1c6[_0x8947('0x22')]({'plain':!![]});var _0x438e3c=_0x8947('0x23');return db['UserProfileResource'][_0x8947('0x24')]({'where':{'type':_0x438e3c,'resourceId':_0x4f1bdb['id']}})[_0x8947('0x21')](function(){return _0x5cd1c6;});})['then'](function(){_0x5dc124['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f121f,_0x408548){return function(_0x4b84f9){if(!_0x4b84f9){_0x3f121f[_0x8947('0x16')](0x194);}return _0x4b84f9;};}function handleError(_0x344d6e,_0x581649){_0x581649=_0x581649||0x1f4;return function(_0x211c46){logger[_0x8947('0x25')](_0x211c46[_0x8947('0x26')]);if(_0x211c46[_0x8947('0x27')]){delete _0x211c46[_0x8947('0x27')];}_0x344d6e[_0x8947('0x17')](_0x581649)[_0x8947('0x28')](_0x211c46);};}exports[_0x8947('0x29')]=function(_0x5d8236,_0x2159b9){var _0x57b87e={},_0x452e6f={},_0x397ee6={'count':0x0,'rows':[]};var _0x113de5=_[_0x8947('0x2a')](db[_0x8947('0x2b')]['rawAttributes'],function(_0x32ea4e){return{'name':_0x32ea4e[_0x8947('0x2c')],'type':_0x32ea4e[_0x8947('0x2d')][_0x8947('0x2e')]};});_0x452e6f[_0x8947('0x2f')]=_[_0x8947('0x2a')](_0x113de5,_0x8947('0x27'));_0x452e6f[_0x8947('0x30')]=_[_0x8947('0x31')](_0x5d8236[_0x8947('0x30')]);_0x452e6f[_0x8947('0x32')]=_['intersection'](_0x452e6f[_0x8947('0x2f')],_0x452e6f[_0x8947('0x30')]);_0x57b87e[_0x8947('0x33')]=_[_0x8947('0x34')](_0x452e6f[_0x8947('0x2f')],qs[_0x8947('0x35')](_0x5d8236[_0x8947('0x30')][_0x8947('0x35')]));_0x57b87e[_0x8947('0x33')]=_0x57b87e['attributes'][_0x8947('0x36')]?_0x57b87e[_0x8947('0x33')]:_0x452e6f['model'];if(!_0x5d8236[_0x8947('0x30')][_0x8947('0x37')](_0x8947('0x38'))){_0x57b87e[_0x8947('0x1b')]=qs[_0x8947('0x1b')](_0x5d8236[_0x8947('0x30')][_0x8947('0x1b')]);_0x57b87e[_0x8947('0x1d')]=qs[_0x8947('0x1d')](_0x5d8236[_0x8947('0x30')][_0x8947('0x1d')]);}_0x57b87e[_0x8947('0x39')]=qs[_0x8947('0x3a')](_0x5d8236[_0x8947('0x30')][_0x8947('0x3a')]);_0x57b87e[_0x8947('0x3b')]=qs[_0x8947('0x32')](_[_0x8947('0x3c')](_0x5d8236[_0x8947('0x30')],_0x452e6f[_0x8947('0x32')]),_0x113de5);if(_0x5d8236[_0x8947('0x30')][_0x8947('0x3d')]){_0x57b87e[_0x8947('0x3b')]=_[_0x8947('0x3e')](_0x57b87e['where'],{'$or':_['map'](_0x113de5,function(_0x4ef1eb){if(_0x4ef1eb[_0x8947('0x2d')]!==_0x8947('0x3f')){var _0x2c758b={};_0x2c758b[_0x4ef1eb[_0x8947('0x27')]]={'$like':'%'+_0x5d8236['query'][_0x8947('0x3d')]+'%'};return _0x2c758b;}})});}_0x57b87e=_[_0x8947('0x3e')]({},_0x57b87e,_0x5d8236['options']);var _0x31d11b={'where':_0x57b87e['where']};return db['CmHopperAdditionalPhone'][_0x8947('0x1c')](_0x31d11b)[_0x8947('0x21')](function(_0x3bacf5){_0x397ee6['count']=_0x3bacf5;if(_0x5d8236[_0x8947('0x30')][_0x8947('0x40')]){_0x57b87e[_0x8947('0x41')]=[{'all':!![]}];}return db[_0x8947('0x2b')][_0x8947('0x42')](_0x57b87e);})[_0x8947('0x21')](function(_0x143f63){_0x397ee6[_0x8947('0x43')]=_0x143f63;return _0x397ee6;})['then'](respondWithFilteredResult(_0x2159b9,_0x57b87e))['catch'](handleError(_0x2159b9,null));};exports['show']=function(_0x48687d,_0x3b8389){var _0x2bd8c3={'raw':!![],'where':{'id':_0x48687d['params']['id']}},_0x4ec4a0={};_0x4ec4a0[_0x8947('0x2f')]=_[_0x8947('0x31')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x4ec4a0[_0x8947('0x30')]=_['keys'](_0x48687d[_0x8947('0x30')]);_0x4ec4a0[_0x8947('0x32')]=_[_0x8947('0x34')](_0x4ec4a0[_0x8947('0x2f')],_0x4ec4a0[_0x8947('0x30')]);_0x2bd8c3[_0x8947('0x33')]=_[_0x8947('0x34')](_0x4ec4a0[_0x8947('0x2f')],qs['fields'](_0x48687d['query'][_0x8947('0x35')]));_0x2bd8c3['attributes']=_0x2bd8c3['attributes'][_0x8947('0x36')]?_0x2bd8c3[_0x8947('0x33')]:_0x4ec4a0[_0x8947('0x2f')];if(_0x48687d['query'][_0x8947('0x40')]){_0x2bd8c3[_0x8947('0x41')]=[{'all':!![]}];}_0x2bd8c3=_['merge']({},_0x2bd8c3,_0x48687d[_0x8947('0x44')]);return db[_0x8947('0x2b')]['find'](_0x2bd8c3)[_0x8947('0x21')](handleEntityNotFound(_0x3b8389,null))['then'](respondWithResult(_0x3b8389,null))[_0x8947('0x45')](handleError(_0x3b8389,null));};exports[_0x8947('0x46')]=function(_0x274f79,_0x1e252d){return db[_0x8947('0x2b')][_0x8947('0x46')](_0x274f79[_0x8947('0x47')],{})[_0x8947('0x21')](function(_0x4f4959){var _0x33be7d=_0x274f79[_0x8947('0x48')][_0x8947('0x22')]({'plain':!![]});if(!_0x33be7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33be7d['role']===_0x8947('0x48')){var _0x2b0221=_0x4f4959[_0x8947('0x22')]({'plain':!![]});var _0x5bdaf8='CmHopperAdditionalPhones';return db['UserProfileSection'][_0x8947('0x49')]({'where':{'name':_0x5bdaf8,'userProfileId':_0x33be7d[_0x8947('0x4a')]},'raw':!![]})['then'](function(_0x340b15){if(_0x340b15&&_0x340b15[_0x8947('0x4b')]===0x0){return db[_0x8947('0x4c')][_0x8947('0x46')]({'name':_0x2b0221[_0x8947('0x27')],'resourceId':_0x2b0221['id'],'type':_0x340b15[_0x8947('0x27')],'sectionId':_0x340b15['id']},{})[_0x8947('0x21')](function(){return _0x4f4959;});}else{return _0x4f4959;}})[_0x8947('0x45')](function(_0x35f4c6){logger[_0x8947('0x25')](_0x8947('0x4d'),_0x35f4c6);throw _0x35f4c6;});}return _0x4f4959;})[_0x8947('0x21')](respondWithResult(_0x1e252d,0xc9))[_0x8947('0x45')](handleError(_0x1e252d,null));};exports['update']=function(_0x438e07,_0x492c28){if(_0x438e07[_0x8947('0x47')]['id']){delete _0x438e07[_0x8947('0x47')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x438e07[_0x8947('0x4e')]['id']}})[_0x8947('0x21')](handleEntityNotFound(_0x492c28,null))['then'](saveUpdates(_0x438e07[_0x8947('0x47')],null))[_0x8947('0x21')](respondWithResult(_0x492c28,null))[_0x8947('0x45')](handleError(_0x492c28,null));};exports[_0x8947('0x24')]=function(_0x4486c8,_0x242e3a){return db[_0x8947('0x2b')][_0x8947('0x49')]({'where':{'id':_0x4486c8[_0x8947('0x4e')]['id']}})[_0x8947('0x21')](handleEntityNotFound(_0x242e3a,null))['then'](removeEntity(_0x242e3a,null))[_0x8947('0x45')](handleError(_0x242e3a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a7bec79..02ba30c 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 _0xfd45=['./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf4460f,_0x159fd5){var _0x97a034=function(_0x1787c9){while(--_0x1787c9){_0xf4460f['push'](_0xf4460f['shift']());}};_0x97a034(++_0x159fd5);}(_0xfd45,0x156));var _0x5fd4=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xfd45[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x5fd4('0x0'));var util=require(_0x5fd4('0x1'));var logger=require('../../config/logger')(_0x5fd4('0x2'));var moment=require(_0x5fd4('0x3'));var BPromise=require(_0x5fd4('0x4'));var rp=require(_0x5fd4('0x5'));var fs=require('fs');var path=require(_0x5fd4('0x6'));var rimraf=require(_0x5fd4('0x7'));var config=require(_0x5fd4('0x8'));var attributes=require(_0x5fd4('0x9'));module[_0x5fd4('0xa')]=function(_0x10c63a,_0x47efe9){return _0x10c63a[_0x5fd4('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x5fd4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91f6=['bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','api','moment'];(function(_0x38f909,_0x4a628b){var _0x3e292e=function(_0x196e72){while(--_0x196e72){_0x38f909['push'](_0x38f909['shift']());}};_0x3e292e(++_0x4a628b);}(_0x91f6,0x168));var _0x691f=function(_0x427815,_0x5675fc){_0x427815=_0x427815-0x0;var _0x56d7f3=_0x91f6[_0x427815];return _0x56d7f3;};'use strict';var _=require('lodash');var util=require(_0x691f('0x0'));var logger=require(_0x691f('0x1'))(_0x691f('0x2'));var moment=require(_0x691f('0x3'));var BPromise=require(_0x691f('0x4'));var rp=require(_0x691f('0x5'));var fs=require('fs');var path=require(_0x691f('0x6'));var rimraf=require(_0x691f('0x7'));var config=require('../../config/environment');var attributes=require(_0x691f('0x8'));module[_0x691f('0x9')]=function(_0x34049f,_0x451fe8){return _0x34049f[_0x691f('0xa')](_0x691f('0xb'),attributes,{'tableName':_0x691f('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 f791244..607e5c1 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 _0x829e=['minutes','createdAt','updatedAt','phone','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','then','countnoanswerretry','SwapAdditionalPhones','ListId','waitTime','duration','isNil','scheduledat','add'];(function(_0x57f8fe,_0x488472){var _0x5558d8=function(_0x884c5e){while(--_0x884c5e){_0x57f8fe['push'](_0x57f8fe['shift']());}};_0x5558d8(++_0x488472);}(_0x829e,0xaa));var _0xe829=function(_0x9bbab3,_0x535b36){_0x9bbab3=_0x9bbab3-0x0;var _0x36bf59=_0x829e[_0x9bbab3];return _0x36bf59;};'use strict';var _=require(_0xe829('0x0'));var util=require(_0xe829('0x1'));var moment=require(_0xe829('0x2'));var BPromise=require(_0xe829('0x3'));var rs=require(_0xe829('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe829('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe829('0x6'))(_0xe829('0x7'));var config=require(_0xe829('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe829('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x524075,_0x39199a,_0x4cc629){return new BPromise(function(_0x26f7db,_0x2eff47){return client['request'](_0x524075,_0x4cc629)['then'](function(_0x3e2b81){logger['info'](_0xe829('0xa'),_0x39199a,_0xe829('0xb'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x39199a,'request\x20sent',JSON[_0xe829('0xc')](_0x3e2b81));if(_0x3e2b81['error']){if(_0x3e2b81['error'][_0xe829('0xd')]===0x1f4){logger[_0xe829('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x39199a,_0x3e2b81[_0xe829('0xe')][_0xe829('0xf')]);return _0x2eff47(_0x3e2b81[_0xe829('0xe')][_0xe829('0xf')]);}logger['error'](_0xe829('0xa'),_0x39199a,_0x3e2b81[_0xe829('0xe')]['message']);return _0x26f7db(_0x3e2b81[_0xe829('0xe')][_0xe829('0xf')]);}else{logger[_0xe829('0x10')](_0xe829('0xa'),_0x39199a,_0xe829('0xb'));_0x26f7db(_0x3e2b81['result']['message']);}})[_0xe829('0x11')](function(_0xe51e2e){logger[_0xe829('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x39199a,_0xe51e2e);_0x2eff47(_0xe51e2e);});});}exports[_0xe829('0x12')]=function(_0xa130f9){var _0x1c79b6=this;return new Promise(function(_0x117efc,_0x3c5438){return db[_0xe829('0x13')][_0xe829('0x14')]({'raw':!![],'where':{'ContactId':_0xa130f9['body'][_0xe829('0x15')],'ListId':_0xa130f9[_0xe829('0x16')]['ListId'],'VoiceQueueId':_0xa130f9[_0xe829('0x16')][_0xe829('0x17')]===undefined?null:_0xa130f9['body'][_0xe829('0x17')],'CampaignId':_0xa130f9[_0xe829('0x16')][_0xe829('0x18')]===undefined?null:_0xa130f9[_0xe829('0x16')][_0xe829('0x18')]}})['then'](function(_0x1fbd95){if(_0x1fbd95!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1fbd95['id'],'OrderBy':{'$gt':_0x1fbd95[_0xe829('0x19')]}},'order':[[_0xe829('0x19'),'ASC']]})['then'](function(_0x31c527){var _0x504b05=0x0;if(_0x31c527){if(_0x31c527[_0xe829('0x1a')]+_0x31c527[_0xe829('0x1b')]+_0x31c527['countnoanswerretry']+_0x31c527[_0xe829('0x1c')]+_0x31c527[_0xe829('0x1d')]+_0x31c527[_0xe829('0x1e')]+_0x31c527[_0xe829('0x1f')]+_0x31c527[_0xe829('0x20')]<_0xa130f9[_0xe829('0x21')][_0xe829('0x22')])_0x504b05=0x1;_0x117efc({'additional':_0x504b05});}else{return db[_0xe829('0x23')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1fbd95['id']},'order':[['OrderBy',_0xe829('0x24')]]})[_0xe829('0x25')](function(_0x48b0cd){var _0xb41b80=0x0;if(_0x48b0cd){if(_0x48b0cd[_0xe829('0x1a')]+_0x48b0cd[_0xe829('0x1b')]+_0x48b0cd[_0xe829('0x26')]+_0x48b0cd[_0xe829('0x1c')]+_0x48b0cd['countdropretry']+_0x48b0cd[_0xe829('0x1e')]+_0x48b0cd[_0xe829('0x1f')]+_0x48b0cd[_0xe829('0x20')]<_0xa130f9[_0xe829('0x21')][_0xe829('0x22')])_0xb41b80=0x1;_0x117efc({'additional':_0xb41b80});}else{_0x117efc({'additional':0x0});}})[_0xe829('0x11')](function(_0x1cfb35){logger[_0xe829('0xe')]('VerifyAdditionalPhones',_0x1cfb35[_0xe829('0xf')]);_0x3c5438(_0x1c79b6[_0xe829('0xe')](0x1f4,_0x1cfb35[_0xe829('0xf')]));});}})[_0xe829('0x11')](function(_0x3a7b25){logger['error'](_0xe829('0x12'),_0x3a7b25[_0xe829('0xf')]);_0x3c5438(_0x1c79b6[_0xe829('0xe')](0x1f4,_0x3a7b25[_0xe829('0xf')]));});}else _0x117efc({'additional':0x0});});});};exports[_0xe829('0x27')]=function(_0xd5f10){var _0x4d31de=this;return new Promise(function(_0x3edefd,_0x457e8c){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0xd5f10[_0xe829('0x16')][_0xe829('0x15')],'ListId':_0xd5f10['body'][_0xe829('0x28')],'VoiceQueueId':_0xd5f10['body'][_0xe829('0x17')]===undefined?null:_0xd5f10['body'][_0xe829('0x17')],'CampaignId':_0xd5f10[_0xe829('0x16')][_0xe829('0x18')]===undefined?null:_0xd5f10['body'][_0xe829('0x18')]}})[_0xe829('0x25')](function(_0x4b110b){if(_0x4b110b!=null){return db['CmHopperAdditionalPhone'][_0xe829('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4b110b['id'],'OrderBy':{'$gte':_0x4b110b['OrderBy']}},'order':[[_0xe829('0x19'),_0xe829('0x24')]]})['then'](function(_0x1c9949){if(_0x1c9949)return activateAdditionalPhone(_0x4b110b,_0xd5f10[_0xe829('0x16')],_0x1c9949,_0xd5f10['duration'],_0xd5f10[_0xe829('0x29')])[_0xe829('0x25')](function(_0xe81749){_0x3edefd(_0xe81749);});else{return db[_0xe829('0x23')][_0xe829('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4b110b['id']},'order':[[_0xe829('0x19'),_0xe829('0x24')]]})['then'](function(_0x3e4c83){if(_0x3e4c83)return activateAdditionalPhone(_0x4b110b,_0xd5f10['body'],_0x3e4c83,_0xd5f10[_0xe829('0x2a')],_0xd5f10[_0xe829('0x29')])[_0xe829('0x25')](function(_0x586b74){_0x3edefd(_0x586b74);});else{_0x3edefd({'id':_0x4b110b['id'],'phone':''});}})[_0xe829('0x11')](function(_0x355081){logger[_0xe829('0xe')](_0xe829('0x12'),_0x355081[_0xe829('0xf')]);_0x457e8c(_0x4d31de['error'](0x1f4,_0x355081[_0xe829('0xf')]));});}})[_0xe829('0x11')](function(_0xede673){logger[_0xe829('0xe')](_0xe829('0x12'),_0xede673[_0xe829('0xf')]);_0x457e8c(_0x4d31de[_0xe829('0xe')](0x1f4,_0xede673[_0xe829('0xf')]));});}else _0x3edefd(0x1);});});};function activateAdditionalPhone(_0x5abc8d,_0x278e17,_0x535b84,_0x44002f,_0x424acb){return new Promise(function(_0x352354,_0x1f4235){var _0x47a637;if(_[_0xe829('0x2b')](_0x535b84['scheduledat'])){_0x535b84[_0xe829('0x2c')]=moment();}if(moment()>moment(_0x535b84[_0xe829('0x2c')])){_0x47a637=moment()[_0xe829('0x2d')](_0x424acb||0x3,'minutes');}else{if(_0x535b84['OrderBy']==0x0){_0x47a637=moment(_0x535b84[_0xe829('0x2c')]);}else{_0x47a637=moment()[_0xe829('0x2d')](_0x424acb||0x3,_0xe829('0x2e'));}}if(_[_0xe829('0x2b')](_0x47a637)){_0x47a637=moment()['add'](_0x424acb||0x3,_0xe829('0x2e'));}var _0x14f69b={'phone':_0x5abc8d['phone'],'active':0x0,'OrderBy':_[_0xe829('0x2b')](_0x5abc8d['OrderBy'])?0x0:_0x5abc8d[_0xe829('0x19')],'scheduledat':moment()[_0xe829('0x2d')](_0x44002f||0x1,_0xe829('0x2e')),'countbusyretry':_0x278e17[_0xe829('0x1a')],'countcongestionretry':_0x278e17[_0xe829('0x1b')],'countnoanswerretry':_0x278e17['countnoanswerretry'],'countnosuchnumberretry':_0x278e17['countnosuchnumberretry'],'countdropretry':_0x278e17['countdropretry'],'countabandonedretry':_0x278e17[_0xe829('0x1e')],'countmachineretry':_0x278e17[_0xe829('0x1f')],'countagentrejectretry':_0x278e17[_0xe829('0x20')],'createdAt':_0x278e17[_0xe829('0x2f')],'updatedAt':_0x278e17[_0xe829('0x30')]};var _0x35e45d={'CmHopperId':_0x5abc8d['id'],'phone':_0x535b84[_0xe829('0x31')],'active':0x0,'OrderBy':_[_0xe829('0x2b')](_0x535b84[_0xe829('0x19')])?0x0:_0x535b84[_0xe829('0x19')],'scheduledat':_0x47a637,'countbusyretry':_0x535b84['countbusyretry'],'countcongestionretry':_0x535b84[_0xe829('0x1b')],'countnoanswerretry':_0x535b84[_0xe829('0x26')],'countnosuchnumberretry':_0x535b84[_0xe829('0x1c')],'countdropretry':_0x535b84[_0xe829('0x1d')],'countabandonedretry':_0x535b84[_0xe829('0x1e')],'countmachineretry':_0x535b84['countmachineretry'],'countagentrejectretry':_0x535b84[_0xe829('0x20')],'createdAt':_0x535b84[_0xe829('0x2f')],'updatedAt':_0x535b84[_0xe829('0x30')]};return db[_0xe829('0x32')][_0xe829('0x33')](function(_0x317699){return db[_0xe829('0x23')]['update'](_0x14f69b,{'where':{'id':_0x535b84['id']}},{'transaction':_0x317699})[_0xe829('0x25')](function(){return db[_0xe829('0x13')][_0xe829('0x34')](_0x35e45d,{'where':{'id':_0x5abc8d['id']}},{'transaction':_0x317699});});})[_0xe829('0x25')](function(_0x53b976){_0x352354({'id':_0x5abc8d['id'],'phone':_0x535b84[_0xe829('0x31')]});})[_0xe829('0x11')](function(_0x3c208f){logger[_0xe829('0xe')]('activateAdditionalPhone',_0x3c208f[_0xe829('0xf')]);_0x1f4235({'error':_0x3c208f['message']});});});}exports[_0xe829('0x35')]=function(_0x84caab){var _0x4969d6=this;return new Promise(function(_0x14b14c,_0x3dd592){return db[_0xe829('0x13')][_0xe829('0x34')](_0x84caab[_0xe829('0x16')]['field'],{'where':{'id':_0x84caab[_0xe829('0x16')]['id']}})['then'](function(_0x547b75){_0x14b14c(_0x547b75);})[_0xe829('0x11')](function(_0x4cd150){logger[_0xe829('0xe')](_0xe829('0x35'),_0x4cd150[_0xe829('0xf')]);_0x3dd592(_0x4969d6['error'](0x1f4,_0x4cd150[_0xe829('0xf')]));});});}; \ No newline at end of file +var _0xf0de=['CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countmachineretry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','transaction','update','phone','activateAdditionalPhone','field','IncrementPreviewCounters','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','VerifyAdditionalPhones','CmHopper','ContactId','ListId','body','VoiceQueueId','CampaignId'];(function(_0xedc4dd,_0xc33cdc){var _0x21ccb1=function(_0x1a6fbe){while(--_0x1a6fbe){_0xedc4dd['push'](_0xedc4dd['shift']());}};_0x21ccb1(++_0xc33cdc);}(_0xf0de,0x1ee));var _0xef0d=function(_0x2624a8,_0x4d24cf){_0x2624a8=_0x2624a8-0x0;var _0x6c948d=_0xf0de[_0x2624a8];return _0x6c948d;};'use strict';var _=require('lodash');var util=require(_0xef0d('0x0'));var moment=require(_0xef0d('0x1'));var BPromise=require(_0xef0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef0d('0x3'));var db=require(_0xef0d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef0d('0x5'))(_0xef0d('0x6'));var config=require('../../config/environment');var jayson=require(_0xef0d('0x7'));var client=jayson[_0xef0d('0x8')][_0xef0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20d7d8,_0x1d402e,_0x3caa82){return new BPromise(function(_0x559b97,_0x20f2a7){return client['request'](_0x20d7d8,_0x3caa82)[_0xef0d('0xa')](function(_0x49a125){logger['info'](_0xef0d('0xb'),_0x1d402e,_0xef0d('0xc'));logger[_0xef0d('0xd')](_0xef0d('0xe'),_0x1d402e,_0xef0d('0xc'),JSON[_0xef0d('0xf')](_0x49a125));if(_0x49a125['error']){if(_0x49a125['error'][_0xef0d('0x10')]===0x1f4){logger['error'](_0xef0d('0xb'),_0x1d402e,_0x49a125['error'][_0xef0d('0x11')]);return _0x20f2a7(_0x49a125['error'][_0xef0d('0x11')]);}logger['error'](_0xef0d('0xb'),_0x1d402e,_0x49a125[_0xef0d('0x12')]['message']);return _0x559b97(_0x49a125[_0xef0d('0x12')][_0xef0d('0x11')]);}else{logger[_0xef0d('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1d402e,_0xef0d('0xc'));_0x559b97(_0x49a125[_0xef0d('0x14')]['message']);}})['catch'](function(_0x37f38c){logger[_0xef0d('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1d402e,_0x37f38c);_0x20f2a7(_0x37f38c);});});}exports[_0xef0d('0x15')]=function(_0x597622){var _0x67269=this;return new Promise(function(_0x2023de,_0x5defc6){return db[_0xef0d('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x597622['body'][_0xef0d('0x17')],'ListId':_0x597622['body'][_0xef0d('0x18')],'VoiceQueueId':_0x597622[_0xef0d('0x19')][_0xef0d('0x1a')]===undefined?null:_0x597622[_0xef0d('0x19')][_0xef0d('0x1a')],'CampaignId':_0x597622[_0xef0d('0x19')][_0xef0d('0x1b')]===undefined?null:_0x597622[_0xef0d('0x19')][_0xef0d('0x1b')]}})['then'](function(_0x4ee4d2){if(_0x4ee4d2!=null){return db[_0xef0d('0x1c')][_0xef0d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4ee4d2['id'],'OrderBy':{'$gt':_0x4ee4d2[_0xef0d('0x1e')]}},'order':[[_0xef0d('0x1e'),_0xef0d('0x1f')]]})[_0xef0d('0xa')](function(_0x1efbbe){var _0x598add=0x0;if(_0x1efbbe){if(_0x1efbbe[_0xef0d('0x20')]+_0x1efbbe[_0xef0d('0x21')]+_0x1efbbe[_0xef0d('0x22')]+_0x1efbbe[_0xef0d('0x23')]+_0x1efbbe[_0xef0d('0x24')]+_0x1efbbe[_0xef0d('0x25')]+_0x1efbbe['countmachineretry']+_0x1efbbe[_0xef0d('0x26')]<_0x597622[_0xef0d('0x27')][_0xef0d('0x28')])_0x598add=0x1;_0x2023de({'additional':_0x598add});}else{return db[_0xef0d('0x1c')][_0xef0d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4ee4d2['id']},'order':[[_0xef0d('0x1e'),'ASC']]})[_0xef0d('0xa')](function(_0x391288){var _0x57f610=0x0;if(_0x391288){if(_0x391288[_0xef0d('0x20')]+_0x391288['countcongestionretry']+_0x391288[_0xef0d('0x22')]+_0x391288[_0xef0d('0x23')]+_0x391288[_0xef0d('0x24')]+_0x391288[_0xef0d('0x25')]+_0x391288[_0xef0d('0x29')]+_0x391288['countagentrejectretry']<_0x597622['entity']['dialGlobalMaxRetry'])_0x57f610=0x1;_0x2023de({'additional':_0x57f610});}else{_0x2023de({'additional':0x0});}})[_0xef0d('0x2a')](function(_0x3aa8ec){logger['error'](_0xef0d('0x15'),_0x3aa8ec['message']);_0x5defc6(_0x67269[_0xef0d('0x12')](0x1f4,_0x3aa8ec[_0xef0d('0x11')]));});}})['catch'](function(_0x3b623c){logger[_0xef0d('0x12')](_0xef0d('0x15'),_0x3b623c[_0xef0d('0x11')]);_0x5defc6(_0x67269['error'](0x1f4,_0x3b623c[_0xef0d('0x11')]));});}else _0x2023de({'additional':0x0});});});};exports[_0xef0d('0x2b')]=function(_0x324179){var _0x2535b4=this;return new Promise(function(_0x4310c1,_0x7b14d6){return db['CmHopper'][_0xef0d('0x1d')]({'raw':!![],'where':{'ContactId':_0x324179['body'][_0xef0d('0x17')],'ListId':_0x324179['body'][_0xef0d('0x18')],'VoiceQueueId':_0x324179[_0xef0d('0x19')]['VoiceQueueId']===undefined?null:_0x324179['body'][_0xef0d('0x1a')],'CampaignId':_0x324179[_0xef0d('0x19')][_0xef0d('0x1b')]===undefined?null:_0x324179[_0xef0d('0x19')][_0xef0d('0x1b')]}})['then'](function(_0x534ea4){if(_0x534ea4!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x534ea4['id'],'OrderBy':{'$gte':_0x534ea4[_0xef0d('0x1e')]}},'order':[[_0xef0d('0x1e'),_0xef0d('0x1f')]]})[_0xef0d('0xa')](function(_0x2cb00b){if(_0x2cb00b)return activateAdditionalPhone(_0x534ea4,_0x324179[_0xef0d('0x19')],_0x2cb00b,_0x324179[_0xef0d('0x2c')],_0x324179[_0xef0d('0x2d')])['then'](function(_0x25dca8){_0x4310c1(_0x25dca8);});else{return db[_0xef0d('0x1c')][_0xef0d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x534ea4['id']},'order':[['OrderBy',_0xef0d('0x1f')]]})['then'](function(_0x5eb2b2){if(_0x5eb2b2)return activateAdditionalPhone(_0x534ea4,_0x324179[_0xef0d('0x19')],_0x5eb2b2,_0x324179[_0xef0d('0x2c')],_0x324179[_0xef0d('0x2d')])[_0xef0d('0xa')](function(_0x58aedc){_0x4310c1(_0x58aedc);});else{_0x4310c1({'id':_0x534ea4['id'],'phone':''});}})[_0xef0d('0x2a')](function(_0x102068){logger['error'](_0xef0d('0x15'),_0x102068[_0xef0d('0x11')]);_0x7b14d6(_0x2535b4[_0xef0d('0x12')](0x1f4,_0x102068['message']));});}})[_0xef0d('0x2a')](function(_0x5f4af9){logger[_0xef0d('0x12')](_0xef0d('0x15'),_0x5f4af9[_0xef0d('0x11')]);_0x7b14d6(_0x2535b4[_0xef0d('0x12')](0x1f4,_0x5f4af9[_0xef0d('0x11')]));});}else _0x4310c1(0x1);});});};function activateAdditionalPhone(_0x5890d9,_0xcfa420,_0x1b20b9,_0xe8dd67,_0x49bba0){return new Promise(function(_0x5d4ce4,_0x539308){var _0x20f8d4;if(_[_0xef0d('0x2e')](_0x1b20b9[_0xef0d('0x2f')])){_0x1b20b9['scheduledat']=moment();}if(moment()>moment(_0x1b20b9[_0xef0d('0x2f')])){_0x20f8d4=moment()[_0xef0d('0x30')](_0x49bba0||0x3,_0xef0d('0x31'));}else{if(_0x1b20b9[_0xef0d('0x1e')]==0x0){_0x20f8d4=moment(_0x1b20b9[_0xef0d('0x2f')]);}else{_0x20f8d4=moment()['add'](_0x49bba0||0x3,'minutes');}}if(_[_0xef0d('0x2e')](_0x20f8d4)){_0x20f8d4=moment()[_0xef0d('0x30')](_0x49bba0||0x3,_0xef0d('0x31'));}var _0xb24460={'phone':_0x5890d9['phone'],'active':0x0,'OrderBy':_[_0xef0d('0x2e')](_0x5890d9['OrderBy'])?0x0:_0x5890d9[_0xef0d('0x1e')],'scheduledat':moment()[_0xef0d('0x30')](_0xe8dd67||0x1,_0xef0d('0x31')),'countbusyretry':_0xcfa420[_0xef0d('0x20')],'countcongestionretry':_0xcfa420[_0xef0d('0x21')],'countnoanswerretry':_0xcfa420[_0xef0d('0x22')],'countnosuchnumberretry':_0xcfa420['countnosuchnumberretry'],'countdropretry':_0xcfa420[_0xef0d('0x24')],'countabandonedretry':_0xcfa420[_0xef0d('0x25')],'countmachineretry':_0xcfa420[_0xef0d('0x29')],'countagentrejectretry':_0xcfa420[_0xef0d('0x26')],'createdAt':_0xcfa420[_0xef0d('0x32')],'updatedAt':_0xcfa420[_0xef0d('0x33')]};var _0x265a15={'CmHopperId':_0x5890d9['id'],'phone':_0x1b20b9['phone'],'active':0x0,'OrderBy':_[_0xef0d('0x2e')](_0x1b20b9[_0xef0d('0x1e')])?0x0:_0x1b20b9[_0xef0d('0x1e')],'scheduledat':_0x20f8d4,'countbusyretry':_0x1b20b9['countbusyretry'],'countcongestionretry':_0x1b20b9[_0xef0d('0x21')],'countnoanswerretry':_0x1b20b9[_0xef0d('0x22')],'countnosuchnumberretry':_0x1b20b9['countnosuchnumberretry'],'countdropretry':_0x1b20b9[_0xef0d('0x24')],'countabandonedretry':_0x1b20b9[_0xef0d('0x25')],'countmachineretry':_0x1b20b9[_0xef0d('0x29')],'countagentrejectretry':_0x1b20b9[_0xef0d('0x26')],'createdAt':_0x1b20b9[_0xef0d('0x32')],'updatedAt':_0x1b20b9[_0xef0d('0x33')]};return db['sequelize'][_0xef0d('0x34')](function(_0x195f8f){return db[_0xef0d('0x1c')][_0xef0d('0x35')](_0xb24460,{'where':{'id':_0x1b20b9['id']}},{'transaction':_0x195f8f})[_0xef0d('0xa')](function(){return db['CmHopper'][_0xef0d('0x35')](_0x265a15,{'where':{'id':_0x5890d9['id']}},{'transaction':_0x195f8f});});})['then'](function(_0x3354f3){_0x5d4ce4({'id':_0x5890d9['id'],'phone':_0x1b20b9[_0xef0d('0x36')]});})[_0xef0d('0x2a')](function(_0x52513d){logger[_0xef0d('0x12')](_0xef0d('0x37'),_0x52513d['message']);_0x539308({'error':_0x52513d[_0xef0d('0x11')]});});});}exports['IncrementPreviewCounters']=function(_0x57926a){var _0x2af32d=this;return new Promise(function(_0x516f58,_0x355489){return db[_0xef0d('0x16')][_0xef0d('0x35')](_0x57926a['body'][_0xef0d('0x38')],{'where':{'id':_0x57926a[_0xef0d('0x19')]['id']}})[_0xef0d('0xa')](function(_0x2ccc82){_0x516f58(_0x2ccc82);})[_0xef0d('0x2a')](function(_0x51448b){logger[_0xef0d('0x12')](_0xef0d('0x39'),_0x51448b['message']);_0x355489(_0x2af32d[_0xef0d('0x12')](0x1f4,_0x51448b[_0xef0d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index cca55af..9be3c5d 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 _0x7b00=['get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x7b00,0x1ba));var _0x07b0=function(_0x4cecc5,_0x97439c){_0x4cecc5=_0x4cecc5-0x0;var _0x3e7d6a=_0x7b00[_0x4cecc5];return _0x3e7d6a;};'use strict';var multer=require(_0x07b0('0x0'));var util=require(_0x07b0('0x1'));var path=require(_0x07b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x07b0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07b0('0x4'));var interaction=require(_0x07b0('0x5'));var config=require(_0x07b0('0x6'));var controller=require(_0x07b0('0x7'));router[_0x07b0('0x8')]('/',auth[_0x07b0('0x9')](),controller[_0x07b0('0xa')]);router[_0x07b0('0x8')](_0x07b0('0xb'),auth[_0x07b0('0x9')](),controller['show']);router[_0x07b0('0xc')]('/',auth[_0x07b0('0x9')](),controller[_0x07b0('0xd')]);router[_0x07b0('0xe')]('/:id',auth[_0x07b0('0x9')](),controller[_0x07b0('0xf')]);router['delete'](_0x07b0('0xb'),auth[_0x07b0('0x9')](),controller[_0x07b0('0x10')]);module[_0x07b0('0x11')]=router; \ No newline at end of file +var _0x18d9=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer'];(function(_0x8aeae4,_0x17a24b){var _0x4bfe04=function(_0x3a437e){while(--_0x3a437e){_0x8aeae4['push'](_0x8aeae4['shift']());}};_0x4bfe04(++_0x17a24b);}(_0x18d9,0x1b8));var _0x918d=function(_0x169204,_0x276a93){_0x169204=_0x169204-0x0;var _0x4a3627=_0x18d9[_0x169204];return _0x4a3627;};'use strict';var multer=require(_0x918d('0x0'));var util=require('util');var path=require(_0x918d('0x1'));var timeout=require(_0x918d('0x2'));var express=require(_0x918d('0x3'));var router=express[_0x918d('0x4')]();var fs_extra=require(_0x918d('0x5'));var auth=require(_0x918d('0x6'));var interaction=require(_0x918d('0x7'));var config=require(_0x918d('0x8'));var controller=require(_0x918d('0x9'));router[_0x918d('0xa')]('/',auth['isAuthenticated'](),controller[_0x918d('0xb')]);router['get'](_0x918d('0xc'),auth[_0x918d('0xd')](),controller[_0x918d('0xe')]);router[_0x918d('0xf')]('/',auth[_0x918d('0xd')](),controller['create']);router[_0x918d('0x10')]('/:id',auth[_0x918d('0xd')](),controller[_0x918d('0x11')]);router[_0x918d('0x12')](_0x918d('0xc'),auth[_0x918d('0xd')](),controller[_0x918d('0x13')]);module[_0x918d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f1b7c61..557ad39 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 _0x7a8d=['sequelize','exports','INTEGER','contactListQueue','moment'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x7a8d,0x185));var _0xd7a8=function(_0x17f907,_0x3bacfd){_0x17f907=_0x17f907-0x0;var _0x2bd16b=_0x7a8d[_0x17f907];return _0x2bd16b;};'use strict';var moment=require(_0xd7a8('0x0'));var Sequelize=require(_0xd7a8('0x1'));module[_0xd7a8('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd7a8('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd7a8('0x3')],'unique':_0xd7a8('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xd7a8('0x4')}}; \ No newline at end of file +var _0x29af=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x29af,0x134));var _0xf29a=function(_0x49a9e7,_0x4b80c7){_0x49a9e7=_0x49a9e7-0x0;var _0x3ec9b4=_0x29af[_0x49a9e7];return _0x3ec9b4;};'use strict';var moment=require(_0xf29a('0x0'));var Sequelize=require(_0xf29a('0x1'));module[_0xf29a('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf29a('0x3')],'unique':_0xf29a('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xf29a('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xf29a('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8dd18bd..3f8808d 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 _0x7e1a=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','params','find','catch','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7e1a,0x1b7));var _0xa7e1=function(_0x534362,_0x1bf27d){_0x534362=_0x534362-0x0;var _0x146e8d=_0x7e1a[_0x534362];return _0x146e8d;};'use strict';var emlformat=require(_0xa7e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7e1('0x1'));var rp=require(_0xa7e1('0x2'));var moment=require(_0xa7e1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa7e1('0x4'));var ejs=require(_0xa7e1('0x5'));var fs=require('fs');var fs_extra=require(_0xa7e1('0x6'));var _=require(_0xa7e1('0x7'));var squel=require(_0xa7e1('0x8'));var crypto=require(_0xa7e1('0x9'));var jsforce=require(_0xa7e1('0xa'));var deskjs=require(_0xa7e1('0xb'));var toCsv=require(_0xa7e1('0x4'));var querystring=require(_0xa7e1('0xc'));var Papa=require(_0xa7e1('0xd'));var Redis=require(_0xa7e1('0xe'));var authService=require(_0xa7e1('0xf'));var qs=require(_0xa7e1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7e1('0x11'));var logger=require(_0xa7e1('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa7e1('0x13'));var db=require(_0xa7e1('0x14'))['db'];function respondWithStatusCode(_0x563f97,_0x4f6e6b){_0x4f6e6b=_0x4f6e6b||0xcc;return function(_0x51c71f){if(_0x51c71f){return _0x563f97[_0xa7e1('0x15')](_0x4f6e6b);}return _0x563f97[_0xa7e1('0x16')](_0x4f6e6b)['end']();};}function respondWithResult(_0x570e81,_0x37a36e){_0x37a36e=_0x37a36e||0xc8;return function(_0x47ac26){if(_0x47ac26){return _0x570e81['status'](_0x37a36e)[_0xa7e1('0x17')](_0x47ac26);}};}function respondWithFilteredResult(_0x35914f,_0x1d84ab){return function(_0x40ba29){if(_0x40ba29){var _0xc3fbdc=typeof _0x1d84ab[_0xa7e1('0x18')]==='undefined'&&typeof _0x1d84ab['limit']===_0xa7e1('0x19');var _0x4ece1c=_0x40ba29[_0xa7e1('0x1a')];var _0x5952f6=_0xc3fbdc?0x0:_0x1d84ab[_0xa7e1('0x18')];var _0x10e161=_0xc3fbdc?_0x40ba29[_0xa7e1('0x1a')]:_0x1d84ab[_0xa7e1('0x18')]+_0x1d84ab[_0xa7e1('0x1b')];var _0x2eddcb;if(_0x10e161>=_0x4ece1c){_0x10e161=_0x4ece1c;_0x2eddcb=0xc8;}else{_0x2eddcb=0xce;}_0x35914f[_0xa7e1('0x16')](_0x2eddcb);return _0x35914f[_0xa7e1('0x1c')](_0xa7e1('0x1d'),_0x5952f6+'-'+_0x10e161+'/'+_0x4ece1c)[_0xa7e1('0x17')](_0x40ba29);}return null;};}function patchUpdates(_0x4166eb){return function(_0x476b3e){try{jsonpatch['apply'](_0x476b3e,_0x4166eb,!![]);}catch(_0x3c01a6){return BPromise[_0xa7e1('0x1e')](_0x3c01a6);}return _0x476b3e[_0xa7e1('0x1f')]();};}function saveUpdates(_0x95a527,_0x37fef3){return function(_0x2d57f3){if(_0x2d57f3){return _0x2d57f3[_0xa7e1('0x20')](_0x95a527)[_0xa7e1('0x21')](function(_0x60004a){return _0x60004a;});}return null;};}function removeEntity(_0x4d0eec,_0x2ff5ac){return function(_0x3995ad){if(_0x3995ad){return _0x3995ad['destroy']()[_0xa7e1('0x21')](function(){_0x4d0eec['status'](0xcc)[_0xa7e1('0x22')]();});}};}function handleEntityNotFound(_0x206187,_0x34700e){return function(_0x3fa7e7){if(!_0x3fa7e7){_0x206187[_0xa7e1('0x15')](0x194);}return _0x3fa7e7;};}function handleError(_0x978e82,_0x3de117){_0x3de117=_0x3de117||0x1f4;return function(_0x383dcb){logger[_0xa7e1('0x23')](_0x383dcb[_0xa7e1('0x24')]);if(_0x383dcb['name']){delete _0x383dcb[_0xa7e1('0x25')];}_0x978e82[_0xa7e1('0x16')](_0x3de117)[_0xa7e1('0x26')](_0x383dcb);};}exports['index']=function(_0x2cd2cd,_0x20d3e8){var _0x3e5d0e={},_0xaf152f={},_0xe76a28={'count':0x0,'rows':[]};var _0x19c1d3=_[_0xa7e1('0x27')](db['CmHopperBlack'][_0xa7e1('0x28')],function(_0x1f7a06){return{'name':_0x1f7a06[_0xa7e1('0x29')],'type':_0x1f7a06[_0xa7e1('0x2a')]['key']};});_0xaf152f['model']=_['map'](_0x19c1d3,_0xa7e1('0x25'));_0xaf152f[_0xa7e1('0x2b')]=_[_0xa7e1('0x2c')](_0x2cd2cd['query']);_0xaf152f[_0xa7e1('0x2d')]=_[_0xa7e1('0x2e')](_0xaf152f[_0xa7e1('0x2f')],_0xaf152f[_0xa7e1('0x2b')]);_0x3e5d0e['attributes']=_['intersection'](_0xaf152f['model'],qs[_0xa7e1('0x30')](_0x2cd2cd[_0xa7e1('0x2b')][_0xa7e1('0x30')]));_0x3e5d0e[_0xa7e1('0x31')]=_0x3e5d0e['attributes']['length']?_0x3e5d0e[_0xa7e1('0x31')]:_0xaf152f['model'];if(!_0x2cd2cd[_0xa7e1('0x2b')][_0xa7e1('0x32')](_0xa7e1('0x33'))){_0x3e5d0e[_0xa7e1('0x1b')]=qs[_0xa7e1('0x1b')](_0x2cd2cd[_0xa7e1('0x2b')][_0xa7e1('0x1b')]);_0x3e5d0e[_0xa7e1('0x18')]=qs[_0xa7e1('0x18')](_0x2cd2cd[_0xa7e1('0x2b')][_0xa7e1('0x18')]);}_0x3e5d0e['order']=qs[_0xa7e1('0x34')](_0x2cd2cd['query'][_0xa7e1('0x34')]);_0x3e5d0e[_0xa7e1('0x35')]=qs[_0xa7e1('0x2d')](_[_0xa7e1('0x36')](_0x2cd2cd['query'],_0xaf152f[_0xa7e1('0x2d')]),_0x19c1d3);if(_0x2cd2cd[_0xa7e1('0x2b')][_0xa7e1('0x37')]){_0x3e5d0e[_0xa7e1('0x35')]=_[_0xa7e1('0x38')](_0x3e5d0e[_0xa7e1('0x35')],{'$or':_[_0xa7e1('0x27')](_0x19c1d3,function(_0x45e1ed){if(_0x45e1ed['type']!==_0xa7e1('0x39')){var _0x3639c8={};_0x3639c8[_0x45e1ed['name']]={'$like':'%'+_0x2cd2cd[_0xa7e1('0x2b')][_0xa7e1('0x37')]+'%'};return _0x3639c8;}})});}_0x3e5d0e=_[_0xa7e1('0x38')]({},_0x3e5d0e,_0x2cd2cd[_0xa7e1('0x3a')]);var _0x36b898={'where':_0x3e5d0e[_0xa7e1('0x35')]};return db[_0xa7e1('0x3b')]['count'](_0x36b898)[_0xa7e1('0x21')](function(_0x257da6){_0xe76a28['count']=_0x257da6;if(_0x2cd2cd['query'][_0xa7e1('0x3c')]){_0x3e5d0e[_0xa7e1('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa7e1('0x3e')](_0x3e5d0e);})['then'](function(_0x361153){_0xe76a28[_0xa7e1('0x3f')]=_0x361153;return _0xe76a28;})[_0xa7e1('0x21')](respondWithFilteredResult(_0x20d3e8,_0x3e5d0e))['catch'](handleError(_0x20d3e8,null));};exports['show']=function(_0x1f3c07,_0x2666e5){var _0x473831={'raw':!![],'where':{'id':_0x1f3c07[_0xa7e1('0x40')]['id']}},_0x55f0d2={};_0x55f0d2[_0xa7e1('0x2f')]=_['keys'](db[_0xa7e1('0x3b')][_0xa7e1('0x28')]);_0x55f0d2[_0xa7e1('0x2b')]=_[_0xa7e1('0x2c')](_0x1f3c07[_0xa7e1('0x2b')]);_0x55f0d2[_0xa7e1('0x2d')]=_[_0xa7e1('0x2e')](_0x55f0d2[_0xa7e1('0x2f')],_0x55f0d2['query']);_0x473831['attributes']=_[_0xa7e1('0x2e')](_0x55f0d2['model'],qs[_0xa7e1('0x30')](_0x1f3c07[_0xa7e1('0x2b')]['fields']));_0x473831[_0xa7e1('0x31')]=_0x473831['attributes']['length']?_0x473831['attributes']:_0x55f0d2[_0xa7e1('0x2f')];if(_0x1f3c07[_0xa7e1('0x2b')]['includeAll']){_0x473831[_0xa7e1('0x3d')]=[{'all':!![]}];}_0x473831=_[_0xa7e1('0x38')]({},_0x473831,_0x1f3c07[_0xa7e1('0x3a')]);return db[_0xa7e1('0x3b')][_0xa7e1('0x41')](_0x473831)[_0xa7e1('0x21')](handleEntityNotFound(_0x2666e5,null))[_0xa7e1('0x21')](respondWithResult(_0x2666e5,null))[_0xa7e1('0x42')](handleError(_0x2666e5,null));};exports['update']=function(_0x1113a0,_0x4b0cb5){if(_0x1113a0[_0xa7e1('0x43')]['id']){delete _0x1113a0['body']['id'];}return db[_0xa7e1('0x3b')][_0xa7e1('0x41')]({'where':{'id':_0x1113a0[_0xa7e1('0x40')]['id']}})[_0xa7e1('0x21')](handleEntityNotFound(_0x4b0cb5,null))['then'](saveUpdates(_0x1113a0[_0xa7e1('0x43')],null))[_0xa7e1('0x21')](respondWithResult(_0x4b0cb5,null))[_0xa7e1('0x42')](handleError(_0x4b0cb5,null));};exports[_0xa7e1('0x44')]=function(_0x682103,_0x2d1097){return db[_0xa7e1('0x3b')][_0xa7e1('0x41')]({'where':{'id':_0x682103[_0xa7e1('0x40')]['id']}})[_0xa7e1('0x21')](handleEntityNotFound(_0x2d1097,null))['then'](removeEntity(_0x2d1097,null))[_0xa7e1('0x42')](handleError(_0x2d1097,null));};exports[_0xa7e1('0x45')]=function(_0x343160,_0x19c9ab){return db[_0xa7e1('0x3b')]['describe']()[_0xa7e1('0x21')](respondWithResult(_0x19c9ab,null))[_0xa7e1('0x42')](handleError(_0x19c9ab,null));}; \ No newline at end of file +var _0xdf8d=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','name','index','map','CmHopperBlack','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','include','show','params','keys','length','catch','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x50fc10,_0x90b083){var _0x5a885b=function(_0x251562){while(--_0x251562){_0x50fc10['push'](_0x50fc10['shift']());}};_0x5a885b(++_0x90b083);}(_0xdf8d,0x1e0));var _0xddf8=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xdf8d[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0xddf8('0x0'));var rimraf=require(_0xddf8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddf8('0x2'));var rp=require(_0xddf8('0x3'));var moment=require('moment');var BPromise=require(_0xddf8('0x4'));var Mustache=require(_0xddf8('0x5'));var util=require(_0xddf8('0x6'));var path=require(_0xddf8('0x7'));var sox=require('sox');var csv=require(_0xddf8('0x8'));var ejs=require(_0xddf8('0x9'));var fs=require('fs');var fs_extra=require(_0xddf8('0xa'));var _=require(_0xddf8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xddf8('0xc'));var deskjs=require(_0xddf8('0xd'));var toCsv=require(_0xddf8('0x8'));var querystring=require(_0xddf8('0xe'));var Papa=require(_0xddf8('0xf'));var Redis=require(_0xddf8('0x10'));var authService=require(_0xddf8('0x11'));var qs=require(_0xddf8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddf8('0x13'));var logger=require(_0xddf8('0x14'))(_0xddf8('0x15'));var utils=require(_0xddf8('0x16'));var config=require(_0xddf8('0x17'));var licenseUtil=require(_0xddf8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x326bf3,_0x55078a){_0x55078a=_0x55078a||0xcc;return function(_0x517d3c){if(_0x517d3c){return _0x326bf3[_0xddf8('0x19')](_0x55078a);}return _0x326bf3[_0xddf8('0x1a')](_0x55078a)[_0xddf8('0x1b')]();};}function respondWithResult(_0x37c0b5,_0x1a4c75){_0x1a4c75=_0x1a4c75||0xc8;return function(_0x5a535){if(_0x5a535){return _0x37c0b5[_0xddf8('0x1a')](_0x1a4c75)['json'](_0x5a535);}};}function respondWithFilteredResult(_0x49f90e,_0x53007e){return function(_0x17e4cf){if(_0x17e4cf){var _0x5861e8=typeof _0x53007e[_0xddf8('0x1c')]==='undefined'&&typeof _0x53007e[_0xddf8('0x1d')]==='undefined';var _0x487106=_0x17e4cf[_0xddf8('0x1e')];var _0x279574=_0x5861e8?0x0:_0x53007e[_0xddf8('0x1c')];var _0x11af7e=_0x5861e8?_0x17e4cf[_0xddf8('0x1e')]:_0x53007e[_0xddf8('0x1c')]+_0x53007e['limit'];var _0xfec9c9;if(_0x11af7e>=_0x487106){_0x11af7e=_0x487106;_0xfec9c9=0xc8;}else{_0xfec9c9=0xce;}_0x49f90e[_0xddf8('0x1a')](_0xfec9c9);return _0x49f90e[_0xddf8('0x1f')](_0xddf8('0x20'),_0x279574+'-'+_0x11af7e+'/'+_0x487106)[_0xddf8('0x21')](_0x17e4cf);}return null;};}function patchUpdates(_0x20be59){return function(_0x4ce91a){try{jsonpatch[_0xddf8('0x22')](_0x4ce91a,_0x20be59,!![]);}catch(_0x15183c){return BPromise[_0xddf8('0x23')](_0x15183c);}return _0x4ce91a['save']();};}function saveUpdates(_0xe415d4,_0x167264){return function(_0x2adcb4){if(_0x2adcb4){return _0x2adcb4[_0xddf8('0x24')](_0xe415d4)['then'](function(_0x49d560){return _0x49d560;});}return null;};}function removeEntity(_0x175782,_0x79819){return function(_0x1a921a){if(_0x1a921a){return _0x1a921a[_0xddf8('0x25')]()[_0xddf8('0x26')](function(){_0x175782[_0xddf8('0x1a')](0xcc)[_0xddf8('0x1b')]();});}};}function handleEntityNotFound(_0x2f1d2f,_0x528b92){return function(_0x5ac38b){if(!_0x5ac38b){_0x2f1d2f['sendStatus'](0x194);}return _0x5ac38b;};}function handleError(_0x16a497,_0x18eaac){_0x18eaac=_0x18eaac||0x1f4;return function(_0x552782){logger[_0xddf8('0x27')](_0x552782['stack']);if(_0x552782[_0xddf8('0x28')]){delete _0x552782[_0xddf8('0x28')];}_0x16a497[_0xddf8('0x1a')](_0x18eaac)['send'](_0x552782);};}exports[_0xddf8('0x29')]=function(_0x4227f2,_0x40a118){var _0x892aa8={},_0x1a1069={},_0x1f3a78={'count':0x0,'rows':[]};var _0x2f8855=_[_0xddf8('0x2a')](db[_0xddf8('0x2b')][_0xddf8('0x2c')],function(_0x573e25){return{'name':_0x573e25[_0xddf8('0x2d')],'type':_0x573e25['type'][_0xddf8('0x2e')]};});_0x1a1069['model']=_[_0xddf8('0x2a')](_0x2f8855,'name');_0x1a1069['query']=_['keys'](_0x4227f2[_0xddf8('0x2f')]);_0x1a1069[_0xddf8('0x30')]=_[_0xddf8('0x31')](_0x1a1069[_0xddf8('0x32')],_0x1a1069['query']);_0x892aa8[_0xddf8('0x33')]=_[_0xddf8('0x31')](_0x1a1069[_0xddf8('0x32')],qs[_0xddf8('0x34')](_0x4227f2[_0xddf8('0x2f')][_0xddf8('0x34')]));_0x892aa8[_0xddf8('0x33')]=_0x892aa8[_0xddf8('0x33')]['length']?_0x892aa8[_0xddf8('0x33')]:_0x1a1069[_0xddf8('0x32')];if(!_0x4227f2['query'][_0xddf8('0x35')]('nolimit')){_0x892aa8[_0xddf8('0x1d')]=qs[_0xddf8('0x1d')](_0x4227f2[_0xddf8('0x2f')][_0xddf8('0x1d')]);_0x892aa8[_0xddf8('0x1c')]=qs[_0xddf8('0x1c')](_0x4227f2['query'][_0xddf8('0x1c')]);}_0x892aa8[_0xddf8('0x36')]=qs[_0xddf8('0x37')](_0x4227f2['query'][_0xddf8('0x37')]);_0x892aa8[_0xddf8('0x38')]=qs[_0xddf8('0x30')](_['pick'](_0x4227f2[_0xddf8('0x2f')],_0x1a1069[_0xddf8('0x30')]),_0x2f8855);if(_0x4227f2[_0xddf8('0x2f')]['filter']){_0x892aa8[_0xddf8('0x38')]=_[_0xddf8('0x39')](_0x892aa8['where'],{'$or':_[_0xddf8('0x2a')](_0x2f8855,function(_0x21f893){if(_0x21f893[_0xddf8('0x3a')]!==_0xddf8('0x3b')){var _0x11a0d6={};_0x11a0d6[_0x21f893[_0xddf8('0x28')]]={'$like':'%'+_0x4227f2[_0xddf8('0x2f')][_0xddf8('0x3c')]+'%'};return _0x11a0d6;}})});}_0x892aa8=_[_0xddf8('0x39')]({},_0x892aa8,_0x4227f2[_0xddf8('0x3d')]);var _0x1b6f3e={'where':_0x892aa8['where']};return db[_0xddf8('0x2b')][_0xddf8('0x1e')](_0x1b6f3e)[_0xddf8('0x26')](function(_0x37023d){_0x1f3a78[_0xddf8('0x1e')]=_0x37023d;if(_0x4227f2[_0xddf8('0x2f')]['includeAll']){_0x892aa8[_0xddf8('0x3e')]=[{'all':!![]}];}return db[_0xddf8('0x2b')]['findAll'](_0x892aa8);})[_0xddf8('0x26')](function(_0x52b5e2){_0x1f3a78['rows']=_0x52b5e2;return _0x1f3a78;})['then'](respondWithFilteredResult(_0x40a118,_0x892aa8))['catch'](handleError(_0x40a118,null));};exports[_0xddf8('0x3f')]=function(_0x28fb5f,_0x5be907){var _0x47ce37={'raw':!![],'where':{'id':_0x28fb5f[_0xddf8('0x40')]['id']}},_0x10130e={};_0x10130e[_0xddf8('0x32')]=_['keys'](db[_0xddf8('0x2b')][_0xddf8('0x2c')]);_0x10130e[_0xddf8('0x2f')]=_[_0xddf8('0x41')](_0x28fb5f[_0xddf8('0x2f')]);_0x10130e['filters']=_[_0xddf8('0x31')](_0x10130e[_0xddf8('0x32')],_0x10130e['query']);_0x47ce37[_0xddf8('0x33')]=_[_0xddf8('0x31')](_0x10130e[_0xddf8('0x32')],qs[_0xddf8('0x34')](_0x28fb5f[_0xddf8('0x2f')][_0xddf8('0x34')]));_0x47ce37['attributes']=_0x47ce37[_0xddf8('0x33')][_0xddf8('0x42')]?_0x47ce37['attributes']:_0x10130e[_0xddf8('0x32')];if(_0x28fb5f[_0xddf8('0x2f')]['includeAll']){_0x47ce37['include']=[{'all':!![]}];}_0x47ce37=_['merge']({},_0x47ce37,_0x28fb5f[_0xddf8('0x3d')]);return db[_0xddf8('0x2b')]['find'](_0x47ce37)[_0xddf8('0x26')](handleEntityNotFound(_0x5be907,null))[_0xddf8('0x26')](respondWithResult(_0x5be907,null))[_0xddf8('0x43')](handleError(_0x5be907,null));};exports[_0xddf8('0x24')]=function(_0x46f608,_0xb248cd){if(_0x46f608[_0xddf8('0x44')]['id']){delete _0x46f608[_0xddf8('0x44')]['id'];}return db[_0xddf8('0x2b')][_0xddf8('0x45')]({'where':{'id':_0x46f608[_0xddf8('0x40')]['id']}})['then'](handleEntityNotFound(_0xb248cd,null))[_0xddf8('0x26')](saveUpdates(_0x46f608[_0xddf8('0x44')],null))[_0xddf8('0x26')](respondWithResult(_0xb248cd,null))[_0xddf8('0x43')](handleError(_0xb248cd,null));};exports[_0xddf8('0x25')]=function(_0x31f7e2,_0x237abe){return db[_0xddf8('0x2b')][_0xddf8('0x45')]({'where':{'id':_0x31f7e2[_0xddf8('0x40')]['id']}})['then'](handleEntityNotFound(_0x237abe,null))[_0xddf8('0x26')](removeEntity(_0x237abe,null))['catch'](handleError(_0x237abe,null));};exports[_0xddf8('0x46')]=function(_0x1b758d,_0x4273b8){return db['CmHopperBlack'][_0xddf8('0x46')]()['then'](respondWithResult(_0x4273b8,null))[_0xddf8('0x43')](handleError(_0x4273b8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d7f318f..939c02c 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 _0x5496=['CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x336685,_0x387f81){var _0x538446=function(_0x2e0b01){while(--_0x2e0b01){_0x336685['push'](_0x336685['shift']());}};_0x538446(++_0x387f81);}(_0x5496,0xb2));var _0x6549=function(_0xa24956,_0x1a3614){_0xa24956=_0xa24956-0x0;var _0x2a01f2=_0x5496[_0xa24956];return _0x2a01f2;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6549('0x3'));var rimraf=require(_0x6549('0x4'));var config=require(_0x6549('0x5'));var attributes=require(_0x6549('0x6'));module[_0x6549('0x7')]=function(_0x554644,_0x83e453){return _0x554644[_0x6549('0x8')](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b49=['bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','moment'];(function(_0x2d16ba,_0x23b54b){var _0x9d7898=function(_0x2b2955){while(--_0x2b2955){_0x2d16ba['push'](_0x2d16ba['shift']());}};_0x9d7898(++_0x23b54b);}(_0x7b49,0x129));var _0x97b4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7b49[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x97b4('0x0'));var util=require(_0x97b4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x97b4('0x2'));var BPromise=require(_0x97b4('0x3'));var rp=require(_0x97b4('0x4'));var fs=require('fs');var path=require(_0x97b4('0x5'));var rimraf=require('rimraf');var config=require(_0x97b4('0x6'));var attributes=require(_0x97b4('0x7'));module[_0x97b4('0x8')]=function(_0x5a1c39,_0x5117df){return _0x5a1c39[_0x97b4('0x9')](_0x97b4('0xa'),attributes,{'tableName':_0x97b4('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 de18bd0..d91e35f 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 _0x91f2=['catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x199b74,_0x1eb9f9){var _0x362d87=function(_0x5c57ec){while(--_0x5c57ec){_0x199b74['push'](_0x199b74['shift']());}};_0x362d87(++_0x1eb9f9);}(_0x91f2,0x179));var _0x291f=function(_0x306c16,_0x211d9d){_0x306c16=_0x306c16-0x0;var _0x3ac4cd=_0x91f2[_0x306c16];return _0x3ac4cd;};'use strict';var _=require('lodash');var util=require(_0x291f('0x0'));var moment=require(_0x291f('0x1'));var BPromise=require(_0x291f('0x2'));var rs=require(_0x291f('0x3'));var fs=require('fs');var Redis=require(_0x291f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x291f('0x5'));var logger=require(_0x291f('0x6'))(_0x291f('0x7'));var config=require('../../config/environment');var jayson=require(_0x291f('0x8'));var client=jayson[_0x291f('0x9')][_0x291f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa10ad4,_0x221d67,_0x2aa407){return new BPromise(function(_0xc07e52,_0x4f9229){return client['request'](_0xa10ad4,_0x2aa407)[_0x291f('0xb')](function(_0x138821){logger['info'](_0x291f('0xc'),_0x221d67,_0x291f('0xd'));logger['debug'](_0x291f('0xe'),_0x221d67,_0x291f('0xd'),JSON['stringify'](_0x138821));if(_0x138821[_0x291f('0xf')]){if(_0x138821[_0x291f('0xf')][_0x291f('0x10')]===0x1f4){logger['error'](_0x291f('0xc'),_0x221d67,_0x138821[_0x291f('0xf')]['message']);return _0x4f9229(_0x138821[_0x291f('0xf')][_0x291f('0x11')]);}logger[_0x291f('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x221d67,_0x138821[_0x291f('0xf')][_0x291f('0x11')]);return _0xc07e52(_0x138821[_0x291f('0xf')][_0x291f('0x11')]);}else{logger[_0x291f('0x12')](_0x291f('0xc'),_0x221d67,'request\x20sent');_0xc07e52(_0x138821['result']['message']);}})[_0x291f('0x13')](function(_0x2236d1){logger[_0x291f('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x221d67,_0x2236d1);_0x4f9229(_0x2236d1);});});}exports['GetCmHopperBlack']=function(_0x4bf760){var _0x48f65a=this;return new Promise(function(_0x1c310f,_0x386a0d){return db[_0x291f('0x14')][_0x291f('0x15')]({'raw':_0x4bf760['options']?_0x4bf760[_0x291f('0x16')][_0x291f('0x17')]===undefined?!![]:![]:!![],'where':_0x4bf760['options']?_0x4bf760[_0x291f('0x16')][_0x291f('0x18')]||null:null,'attributes':_0x4bf760[_0x291f('0x16')]?_0x4bf760[_0x291f('0x16')][_0x291f('0x19')]||null:null,'limit':_0x4bf760[_0x291f('0x16')]?_0x4bf760[_0x291f('0x16')][_0x291f('0x1a')]||null:null,'include':_0x4bf760['options']?_0x4bf760['options'][_0x291f('0x1b')]?_[_0x291f('0x1c')](_0x4bf760[_0x291f('0x16')][_0x291f('0x1b')],function(_0x4ce00e){return{'model':db[_0x4ce00e['model']],'as':_0x4ce00e['as'],'attributes':_0x4ce00e[_0x291f('0x19')],'include':_0x4ce00e[_0x291f('0x1b')]?_[_0x291f('0x1c')](_0x4ce00e[_0x291f('0x1b')],function(_0x9e4f39){return{'model':db[_0x9e4f39[_0x291f('0x1d')]],'as':_0x9e4f39['as'],'attributes':_0x9e4f39[_0x291f('0x19')],'include':_0x9e4f39['include']?_[_0x291f('0x1c')](_0x9e4f39[_0x291f('0x1b')],function(_0x9a1428){return{'model':db[_0x9a1428[_0x291f('0x1d')]],'as':_0x9a1428['as'],'attributes':_0x9a1428[_0x291f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x291f('0xb')](function(_0x270da7){logger['info'](_0x291f('0x1e'),_0x4bf760);logger['debug'](_0x291f('0x1e'),_0x4bf760,JSON['stringify'](_0x270da7));_0x1c310f(_0x270da7);})['catch'](function(_0x1397f4){logger[_0x291f('0xf')](_0x291f('0x1e'),_0x1397f4[_0x291f('0x11')],_0x4bf760);_0x386a0d(_0x48f65a[_0x291f('0xf')](0x1f4,_0x1397f4[_0x291f('0x11')]));});});};exports[_0x291f('0x1f')]=function(_0x235659){var _0x2ef50b=this;return new Promise(function(_0x31704f,_0x584fc6){return db['CmHopperBlack']['update'](_0x235659['body'],{'raw':_0x235659[_0x291f('0x16')]?_0x235659[_0x291f('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x235659[_0x291f('0x16')]?_0x235659[_0x291f('0x16')][_0x291f('0x18')]||null:null,'attributes':_0x235659[_0x291f('0x16')]?_0x235659[_0x291f('0x16')][_0x291f('0x19')]||null:null,'limit':_0x235659[_0x291f('0x16')]?_0x235659['options'][_0x291f('0x1a')]||null:null})[_0x291f('0xb')](function(_0x3e8399){logger[_0x291f('0x12')](_0x291f('0x1f'),_0x235659);logger['debug'](_0x291f('0x1f'),_0x235659,JSON['stringify'](_0x3e8399));_0x31704f(_0x3e8399);})[_0x291f('0x13')](function(_0x5399c6){logger['error'](_0x291f('0x1f'),_0x5399c6[_0x291f('0x11')],_0x235659);_0x584fc6(_0x2ef50b['error'](0x1f4,_0x5399c6[_0x291f('0x11')]));});});};exports[_0x291f('0x20')]=function(_0x2776f9){var _0x4ce8c1=this;return new Promise(function(_0x1fd2e1,_0x5d8cf8){return db[_0x291f('0x14')][_0x291f('0x21')]({'where':_0x2776f9[_0x291f('0x16')]?_0x2776f9[_0x291f('0x16')]['where']||null:null})[_0x291f('0xb')](function(_0x377479){logger[_0x291f('0x12')]('DestroyCmHopperBlack',_0x2776f9);logger[_0x291f('0x22')]('DestroyCmHopperBlack',_0x2776f9,JSON[_0x291f('0x23')](_0x377479));_0x1fd2e1(_0x377479);})[_0x291f('0x13')](function(_0x459159){logger[_0x291f('0xf')](_0x291f('0x20'),_0x459159[_0x291f('0x11')],_0x2776f9);_0x5d8cf8(_0x4ce8c1['error'](0x1f4,_0x459159[_0x291f('0x11')]));});});}; \ No newline at end of file +var _0x1fce=['where','limit','include','map','model','attributes','then','debug','UpdateCmHopperBlack','update','body','destroy','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1fce,0x134));var _0xe1fc=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x1fce[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xe1fc('0x0'));var util=require('util');var moment=require(_0xe1fc('0x1'));var BPromise=require(_0xe1fc('0x2'));var rs=require(_0xe1fc('0x3'));var fs=require('fs');var Redis=require(_0xe1fc('0x4'));var db=require(_0xe1fc('0x5'))['db'];var utils=require(_0xe1fc('0x6'));var logger=require(_0xe1fc('0x7'))(_0xe1fc('0x8'));var config=require(_0xe1fc('0x9'));var jayson=require(_0xe1fc('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e4661,_0xecf991,_0x2fcd13){return new BPromise(function(_0x3cbf09,_0x5f226){return client[_0xe1fc('0xb')](_0x5e4661,_0x2fcd13)['then'](function(_0x29fcb9){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0xecf991,_0xe1fc('0xc'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xecf991,_0xe1fc('0xc'),JSON[_0xe1fc('0xd')](_0x29fcb9));if(_0x29fcb9[_0xe1fc('0xe')]){if(_0x29fcb9[_0xe1fc('0xe')][_0xe1fc('0xf')]===0x1f4){logger[_0xe1fc('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0xecf991,_0x29fcb9['error'][_0xe1fc('0x10')]);return _0x5f226(_0x29fcb9['error'][_0xe1fc('0x10')]);}logger[_0xe1fc('0xe')](_0xe1fc('0x11'),_0xecf991,_0x29fcb9[_0xe1fc('0xe')]['message']);return _0x3cbf09(_0x29fcb9[_0xe1fc('0xe')]['message']);}else{logger[_0xe1fc('0x12')](_0xe1fc('0x11'),_0xecf991,_0xe1fc('0xc'));_0x3cbf09(_0x29fcb9[_0xe1fc('0x13')][_0xe1fc('0x10')]);}})[_0xe1fc('0x14')](function(_0x5410c4){logger['error'](_0xe1fc('0x11'),_0xecf991,_0x5410c4);_0x5f226(_0x5410c4);});});}exports[_0xe1fc('0x15')]=function(_0x2d33d6){var _0x203a4d=this;return new Promise(function(_0xf63af7,_0x4a7fb9){return db[_0xe1fc('0x16')]['findAll']({'raw':_0x2d33d6[_0xe1fc('0x17')]?_0x2d33d6['options'][_0xe1fc('0x18')]===undefined?!![]:![]:!![],'where':_0x2d33d6['options']?_0x2d33d6[_0xe1fc('0x17')][_0xe1fc('0x19')]||null:null,'attributes':_0x2d33d6[_0xe1fc('0x17')]?_0x2d33d6['options']['attributes']||null:null,'limit':_0x2d33d6['options']?_0x2d33d6['options'][_0xe1fc('0x1a')]||null:null,'include':_0x2d33d6[_0xe1fc('0x17')]?_0x2d33d6[_0xe1fc('0x17')][_0xe1fc('0x1b')]?_[_0xe1fc('0x1c')](_0x2d33d6[_0xe1fc('0x17')][_0xe1fc('0x1b')],function(_0x987619){return{'model':db[_0x987619[_0xe1fc('0x1d')]],'as':_0x987619['as'],'attributes':_0x987619[_0xe1fc('0x1e')],'include':_0x987619[_0xe1fc('0x1b')]?_[_0xe1fc('0x1c')](_0x987619[_0xe1fc('0x1b')],function(_0x15b00a){return{'model':db[_0x15b00a[_0xe1fc('0x1d')]],'as':_0x15b00a['as'],'attributes':_0x15b00a[_0xe1fc('0x1e')],'include':_0x15b00a[_0xe1fc('0x1b')]?_[_0xe1fc('0x1c')](_0x15b00a[_0xe1fc('0x1b')],function(_0x3266e0){return{'model':db[_0x3266e0['model']],'as':_0x3266e0['as'],'attributes':_0x3266e0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1fc('0x1f')](function(_0x269761){logger[_0xe1fc('0x12')](_0xe1fc('0x15'),_0x2d33d6);logger[_0xe1fc('0x20')](_0xe1fc('0x15'),_0x2d33d6,JSON[_0xe1fc('0xd')](_0x269761));_0xf63af7(_0x269761);})[_0xe1fc('0x14')](function(_0x503e46){logger[_0xe1fc('0xe')]('GetCmHopperBlack',_0x503e46[_0xe1fc('0x10')],_0x2d33d6);_0x4a7fb9(_0x203a4d[_0xe1fc('0xe')](0x1f4,_0x503e46[_0xe1fc('0x10')]));});});};exports[_0xe1fc('0x21')]=function(_0x26af1b){var _0x1e50bd=this;return new Promise(function(_0x29a820,_0x43012a){return db[_0xe1fc('0x16')][_0xe1fc('0x22')](_0x26af1b[_0xe1fc('0x23')],{'raw':_0x26af1b['options']?_0x26af1b['options'][_0xe1fc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26af1b[_0xe1fc('0x17')]?_0x26af1b[_0xe1fc('0x17')][_0xe1fc('0x19')]||null:null,'attributes':_0x26af1b['options']?_0x26af1b['options'][_0xe1fc('0x1e')]||null:null,'limit':_0x26af1b['options']?_0x26af1b[_0xe1fc('0x17')]['limit']||null:null})[_0xe1fc('0x1f')](function(_0x3d79d8){logger['info'](_0xe1fc('0x21'),_0x26af1b);logger[_0xe1fc('0x20')](_0xe1fc('0x21'),_0x26af1b,JSON[_0xe1fc('0xd')](_0x3d79d8));_0x29a820(_0x3d79d8);})[_0xe1fc('0x14')](function(_0x5b42ba){logger[_0xe1fc('0xe')](_0xe1fc('0x21'),_0x5b42ba[_0xe1fc('0x10')],_0x26af1b);_0x43012a(_0x1e50bd['error'](0x1f4,_0x5b42ba[_0xe1fc('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x47a2a5){var _0x5d42b8=this;return new Promise(function(_0x5efe10,_0x4d2dd9){return db[_0xe1fc('0x16')][_0xe1fc('0x24')]({'where':_0x47a2a5[_0xe1fc('0x17')]?_0x47a2a5[_0xe1fc('0x17')][_0xe1fc('0x19')]||null:null})[_0xe1fc('0x1f')](function(_0x2cc444){logger[_0xe1fc('0x12')]('DestroyCmHopperBlack',_0x47a2a5);logger[_0xe1fc('0x20')]('DestroyCmHopperBlack',_0x47a2a5,JSON[_0xe1fc('0xd')](_0x2cc444));_0x5efe10(_0x2cc444);})[_0xe1fc('0x14')](function(_0x16801e){logger[_0xe1fc('0xe')]('DestroyCmHopperBlack',_0x16801e[_0xe1fc('0x10')],_0x47a2a5);_0x4d2dd9(_0x5d42b8[_0xe1fc('0xe')](0x1f4,_0x16801e[_0xe1fc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index cdddb39..8cc68c6 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 _0x4137=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/:id',auth[_0x7413('0xe')](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x14')]=router; \ No newline at end of file +var _0x6d38=['exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x52d2ea,_0x3e7174){var _0x53aa71=function(_0x1a47ce){while(--_0x1a47ce){_0x52d2ea['push'](_0x52d2ea['shift']());}};_0x53aa71(++_0x3e7174);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6d38[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['put'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['update']);router['delete'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['destroy']);module[_0x86d3('0xc')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f27a10d..2db5bdb 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 _0x2507=['sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','BOOLEAN'];(function(_0x3b95e2,_0x3d2dfb){var _0x1191c4=function(_0x4a18b3){while(--_0x4a18b3){_0x3b95e2['push'](_0x3b95e2['shift']());}};_0x1191c4(++_0x3d2dfb);}(_0x2507,0xbb));var _0x7250=function(_0x4cdbfa,_0x25a627){_0x4cdbfa=_0x4cdbfa-0x0;var _0x1a25ec=_0x2507[_0x4cdbfa];return _0x1a25ec;};'use strict';var Sequelize=require(_0x7250('0x0'));var moment=require(_0x7250('0x1'));module[_0x7250('0x2')]={'state':{'type':Sequelize[_0x7250('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x7250('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7250('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x7250('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7250('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7250('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7250('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7250('0x4')]},'campaign':{'type':Sequelize[_0x7250('0x4')]},'campaigntype':{'type':Sequelize[_0x7250('0x4')]},'membername':{'type':Sequelize[_0x7250('0x4')]},'reason':{'type':Sequelize[_0x7250('0x4')]},'disposition':{'type':Sequelize[_0x7250('0x4')]},'secondDisposition':{'type':Sequelize[_0x7250('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4e60c0){var _0x505efd=this[_0x7250('0x6')](_0x7250('0x7'));if(_0x505efd&&_0x4e60c0){this[_0x7250('0x8')](_0x7250('0x9'),moment(_0x4e60c0)['diff'](moment(_0x505efd),'seconds'));}}},'amd':{'type':Sequelize[_0x7250('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7250('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7250('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7250('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7250('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x7250('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x7250('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7250('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7250('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9eeb=['DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x3acdda,_0x491b51){var _0x263e0b=function(_0x1ec094){while(--_0x1ec094){_0x3acdda['push'](_0x3acdda['shift']());}};_0x263e0b(++_0x491b51);}(_0x9eeb,0x167));var _0xb9ee=function(_0x57b0fe,_0x27c60c){_0x57b0fe=_0x57b0fe-0x0;var _0x3a6515=_0x9eeb[_0x57b0fe];return _0x3a6515;};'use strict';var Sequelize=require(_0xb9ee('0x0'));var moment=require('moment');module[_0xb9ee('0x1')]={'state':{'type':Sequelize[_0xb9ee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb9ee('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb9ee('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb9ee('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb9ee('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb9ee('0x3')]},'calleridnum':{'type':Sequelize[_0xb9ee('0x3')]},'calleridname':{'type':Sequelize[_0xb9ee('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb9ee('0x4')]},'answertime':{'type':Sequelize[_0xb9ee('0x4')]},'droptime':{'type':Sequelize[_0xb9ee('0x4')]},'endtime':{'type':Sequelize[_0xb9ee('0x4')]},'ringtime':{'type':Sequelize[_0xb9ee('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb9ee('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb9ee('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb9ee('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb9ee('0x3')]},'membername':{'type':Sequelize[_0xb9ee('0x3')]},'reason':{'type':Sequelize[_0xb9ee('0x3')]},'disposition':{'type':Sequelize[_0xb9ee('0x3')]},'secondDisposition':{'type':Sequelize[_0xb9ee('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb9ee('0x3')]},'dispositionat':{'type':Sequelize[_0xb9ee('0x4')],'set':function(_0x553aa8){var _0x308e53=this[_0xb9ee('0x5')]('endtime');if(_0x308e53&&_0x553aa8){this[_0xb9ee('0x6')](_0xb9ee('0x7'),moment(_0x553aa8)[_0xb9ee('0x8')](moment(_0x308e53),_0xb9ee('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb9ee('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb9ee('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb9ee('0x4')]},'callback':{'type':Sequelize[_0xb9ee('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb9ee('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xb9ee('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb9ee('0x4')]},'recallme':{'type':Sequelize[_0xb9ee('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb9ee('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb9ee('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb9ee('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb9ee('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 68c72df..55532d7 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 _0xc1c6=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x49d449,_0x444db7){_0x49d449=_0x49d449-0x0;var _0x43f7c0=_0xc1c6[_0x49d449];return _0x43f7c0;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['CmHopperFinal'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,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(_0x18302c,_0xddae64){var _0x838363=function(_0x558793){while(--_0x558793){_0x18302c['push'](_0x18302c['shift']());}};_0x838363(++_0xddae64);}(_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 32a1c06..74a7757 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 _0x7cd1=['request-promise','path','../../config/environment','exports','define','CmHopperFinal','calleridnum','lodash','util','../../config/logger','moment','bluebird'];(function(_0x564021,_0x53f5e9){var _0x5a097c=function(_0x12f48f){while(--_0x12f48f){_0x564021['push'](_0x564021['shift']());}};_0x5a097c(++_0x53f5e9);}(_0x7cd1,0x127));var _0x17cd=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x7cd1[_0x2bcd1f];return _0x2381ca;};'use strict';var _=require(_0x17cd('0x0'));var util=require(_0x17cd('0x1'));var logger=require(_0x17cd('0x2'))('api');var moment=require(_0x17cd('0x3'));var BPromise=require(_0x17cd('0x4'));var rp=require(_0x17cd('0x5'));var fs=require('fs');var path=require(_0x17cd('0x6'));var rimraf=require('rimraf');var config=require(_0x17cd('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x17cd('0x8')]=function(_0x4ec072,_0x1c447e){return _0x4ec072[_0x17cd('0x9')](_0x17cd('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x17cd('0xb'),'fields':[_0x17cd('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0386=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','path','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x34a32e,_0x26f089){var _0x24ca9b=function(_0x47c1c5){while(--_0x47c1c5){_0x34a32e['push'](_0x34a32e['shift']());}};_0x24ca9b(++_0x26f089);}(_0x0386,0xb8));var _0x6038=function(_0x24801a,_0x304d83){_0x24801a=_0x24801a-0x0;var _0x5ce42b=_0x0386[_0x24801a];return _0x5ce42b;};'use strict';var _=require(_0x6038('0x0'));var util=require(_0x6038('0x1'));var logger=require(_0x6038('0x2'))(_0x6038('0x3'));var moment=require(_0x6038('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6038('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6038('0x6'));module[_0x6038('0x7')]=function(_0x1b3207,_0x29b974){return _0x1b3207[_0x6038('0x8')](_0x6038('0x9'),attributes,{'tableName':_0x6038('0xa'),'paranoid':![],'indexes':[{'name':_0x6038('0xb'),'fields':[_0x6038('0xb')]},{'name':_0x6038('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 eff2a13..364a5f0 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4cfd12,_0x14d6b1){var _0x290815=function(_0x169e06){while(--_0x169e06){_0x4cfd12['push'](_0x4cfd12['shift']());}};_0x290815(++_0x14d6b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x20d434,_0x3fb64f){_0x20d434=_0x20d434-0x0;var _0x1d90f1=_0xb10b[_0x20d434];return _0x1d90f1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5e27af,_0x324798){var _0x3840c1=function(_0x43ea8c){while(--_0x43ea8c){_0x5e27af['push'](_0x5e27af['shift']());}};_0x3840c1(++_0x324798);}(_0xb10b,0x12a));var _0xbb10=function(_0x154f66,_0x116f85){_0x154f66=_0x154f66-0x0;var _0x3f947a=_0xb10b[_0x154f66];return _0x3f947a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 715a298..09d3814 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 _0x1e4e=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','multer'];(function(_0x3b205e,_0x55ee26){var _0x455da9=function(_0x35e4c8){while(--_0x35e4c8){_0x3b205e['push'](_0x3b205e['shift']());}};_0x455da9(++_0x55ee26);}(_0x1e4e,0xaf));var _0xe1e4=function(_0x202743,_0x5bb209){_0x202743=_0x202743-0x0;var _0x5cbb8b=_0x1e4e[_0x202743];return _0x5cbb8b;};'use strict';var multer=require(_0xe1e4('0x0'));var util=require(_0xe1e4('0x1'));var path=require('path');var timeout=require(_0xe1e4('0x2'));var express=require(_0xe1e4('0x3'));var router=express[_0xe1e4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe1e4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe1e4('0x6'));var controller=require(_0xe1e4('0x7'));router[_0xe1e4('0x8')]('/',auth[_0xe1e4('0x9')](),controller['index']);router[_0xe1e4('0x8')]('/describe',auth[_0xe1e4('0x9')](),controller['describe']);router[_0xe1e4('0x8')](_0xe1e4('0xa'),auth[_0xe1e4('0x9')](),controller[_0xe1e4('0xb')]);router[_0xe1e4('0x8')](_0xe1e4('0xc'),auth[_0xe1e4('0x9')](),controller[_0xe1e4('0xd')]);router[_0xe1e4('0x8')](_0xe1e4('0xe'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xe1e4('0xf'),auth[_0xe1e4('0x9')](),controller[_0xe1e4('0x10')]);router[_0xe1e4('0x11')](_0xe1e4('0x12'),auth[_0xe1e4('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xe1e4('0x11')]('/checkContactHopper',auth[_0xe1e4('0x9')](),controller[_0xe1e4('0x13')]);router[_0xe1e4('0x14')](_0xe1e4('0xa'),auth[_0xe1e4('0x9')](),controller[_0xe1e4('0x15')]);module['exports']=router; \ No newline at end of file +var _0x34cd=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','/:id','exports','multer','util'];(function(_0x38bf11,_0x500990){var _0x244595=function(_0xf41783){while(--_0xf41783){_0x38bf11['push'](_0x38bf11['shift']());}};_0x244595(++_0x500990);}(_0x34cd,0x1d2));var _0xd34c=function(_0x1a68f3,_0x36fbd6){_0x1a68f3=_0x1a68f3-0x0;var _0x1ffb16=_0x34cd[_0x1a68f3];return _0x1ffb16;};'use strict';var multer=require(_0xd34c('0x0'));var util=require(_0xd34c('0x1'));var path=require(_0xd34c('0x2'));var timeout=require(_0xd34c('0x3'));var express=require('express');var router=express[_0xd34c('0x4')]();var fs_extra=require(_0xd34c('0x5'));var auth=require(_0xd34c('0x6'));var interaction=require(_0xd34c('0x7'));var config=require(_0xd34c('0x8'));var controller=require(_0xd34c('0x9'));router[_0xd34c('0xa')]('/',auth[_0xd34c('0xb')](),controller[_0xd34c('0xc')]);router[_0xd34c('0xa')]('/describe',auth[_0xd34c('0xb')](),controller['describe']);router['get']('/:id',auth[_0xd34c('0xb')](),controller[_0xd34c('0xd')]);router[_0xd34c('0xa')](_0xd34c('0xe'),auth[_0xd34c('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xd34c('0xa')](_0xd34c('0xf'),auth[_0xd34c('0xb')](),controller[_0xd34c('0x10')]);router['post'](_0xd34c('0x11'),auth[_0xd34c('0xb')](),controller[_0xd34c('0x12')]);router[_0xd34c('0x13')](_0xd34c('0x14'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xd34c('0x13')](_0xd34c('0x15'),auth[_0xd34c('0xb')](),controller[_0xd34c('0x16')]);router[_0xd34c('0x17')](_0xd34c('0x18'),auth['isAuthenticated'](),controller['update']);module[_0xd34c('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 631b2bb..40ee7f6 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 _0xdb8a=['DATE','BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x4b2605,_0x1b5d8a){var _0x143d3e=function(_0x33bfa5){while(--_0x33bfa5){_0x4b2605['push'](_0x4b2605['shift']());}};_0x143d3e(++_0x1b5d8a);}(_0xdb8a,0xfc));var _0xadb8=function(_0x58682e,_0x48176d){_0x58682e=_0x58682e-0x0;var _0x533e59=_0xdb8a[_0x58682e];return _0x533e59;};'use strict';var Sequelize=require(_0xadb8('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xadb8('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xadb8('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xadb8('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xadb8('0x1')]},'starttime':{'type':Sequelize[_0xadb8('0x3')]},'responsetime':{'type':Sequelize[_0xadb8('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xadb8('0x3')]},'endtime':{'type':Sequelize[_0xadb8('0x3')]},'ringtime':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xadb8('0x1')]},'campaign':{'type':Sequelize[_0xadb8('0x1')]},'campaigntype':{'type':Sequelize[_0xadb8('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xadb8('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xadb8('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xadb8('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xadb8('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xadb8('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xadb8('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xadb8('0x1')]}}; \ No newline at end of file +var _0xeefe=['STRING','BOOLEAN','sequelize','INTEGER','DATE'];(function(_0x5aaaf1,_0x18d510){var _0x4f5f48=function(_0x19c156){while(--_0x19c156){_0x5aaaf1['push'](_0x5aaaf1['shift']());}};_0x4f5f48(++_0x18d510);}(_0xeefe,0xf2));var _0xeeef=function(_0x495126,_0x3be484){_0x495126=_0x495126-0x0;var _0x178d55=_0xeefe[_0x495126];return _0x178d55;};'use strict';var Sequelize=require(_0xeeef('0x0'));module['exports']={'state':{'type':Sequelize[_0xeeef('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xeeef('0x2')]},'countbusyretry':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xeeef('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xeeef('0x3')]},'originatecalleridname':{'type':Sequelize[_0xeeef('0x3')]},'calleridnum':{'type':Sequelize[_0xeeef('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xeeef('0x2')]},'responsetime':{'type':Sequelize[_0xeeef('0x2')]},'answertime':{'type':Sequelize[_0xeeef('0x2')]},'droptime':{'type':Sequelize[_0xeeef('0x2')]},'endtime':{'type':Sequelize[_0xeeef('0x2')]},'ringtime':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xeeef('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xeeef('0x3')]},'membername':{'type':Sequelize[_0xeeef('0x3')]},'reason':{'type':Sequelize[_0xeeef('0x3')]},'amd':{'type':Sequelize[_0xeeef('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xeeef('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeeef('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeeef('0x2')]},'recallme':{'type':Sequelize[_0xeeef('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xeeef('0x2')]},'edited':{'type':Sequelize[_0xeeef('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeeef('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xeeef('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index defe23b..433addd 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 _0xcde1=['uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','CmHopperHistory','then','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','update'];(function(_0x17f2b7,_0x32a8b0){var _0x4164f6=function(_0x5608ad){while(--_0x5608ad){_0x17f2b7['push'](_0x17f2b7['shift']());}};_0x4164f6(++_0x32a8b0);}(_0xcde1,0x17d));var _0x1cde=function(_0x2f6353,_0x196d21){_0x2f6353=_0x2f6353-0x0;var _0x405754=_0xcde1[_0x2f6353];return _0x405754;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cde('0x0'));var zipdir=require(_0x1cde('0x1'));var jsonpatch=require(_0x1cde('0x2'));var rp=require(_0x1cde('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1cde('0x4'));var util=require(_0x1cde('0x5'));var path=require(_0x1cde('0x6'));var sox=require(_0x1cde('0x7'));var csv=require('to-csv');var ejs=require(_0x1cde('0x8'));var fs=require('fs');var fs_extra=require(_0x1cde('0x9'));var _=require(_0x1cde('0xa'));var squel=require(_0x1cde('0xb'));var crypto=require(_0x1cde('0xc'));var jsforce=require(_0x1cde('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1cde('0xe'));var querystring=require('querystring');var Papa=require(_0x1cde('0xf'));var Redis=require(_0x1cde('0x10'));var authService=require(_0x1cde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1cde('0x12'));var hardwareService=require(_0x1cde('0x13'));var logger=require(_0x1cde('0x14'))('api');var utils=require(_0x1cde('0x15'));var config=require(_0x1cde('0x16'));var licenseUtil=require(_0x1cde('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24a629,_0x53c40c){_0x53c40c=_0x53c40c||0xcc;return function(_0x18bece){if(_0x18bece){return _0x24a629[_0x1cde('0x18')](_0x53c40c);}return _0x24a629[_0x1cde('0x19')](_0x53c40c)[_0x1cde('0x1a')]();};}function respondWithResult(_0x3cec36,_0x5e5738){_0x5e5738=_0x5e5738||0xc8;return function(_0x30a14f){if(_0x30a14f){return _0x3cec36[_0x1cde('0x19')](_0x5e5738)['json'](_0x30a14f);}};}function respondWithFilteredResult(_0x52584c,_0x2867cf){return function(_0x9ee88a){if(_0x9ee88a){var _0x22aa2c=typeof _0x2867cf[_0x1cde('0x1b')]===_0x1cde('0x1c')&&typeof _0x2867cf[_0x1cde('0x1d')]===_0x1cde('0x1c');var _0x13a8d4=_0x9ee88a['count'];var _0x18bc94=_0x22aa2c?0x0:_0x2867cf[_0x1cde('0x1b')];var _0x39e17b=_0x22aa2c?_0x9ee88a[_0x1cde('0x1e')]:_0x2867cf[_0x1cde('0x1b')]+_0x2867cf[_0x1cde('0x1d')];var _0x2705c5;if(_0x39e17b>=_0x13a8d4){_0x39e17b=_0x13a8d4;_0x2705c5=0xc8;}else{_0x2705c5=0xce;}_0x52584c[_0x1cde('0x19')](_0x2705c5);return _0x52584c[_0x1cde('0x1f')]('Content-Range',_0x18bc94+'-'+_0x39e17b+'/'+_0x13a8d4)['json'](_0x9ee88a);}return null;};}function patchUpdates(_0x758995){return function(_0x5392ee){try{jsonpatch[_0x1cde('0x20')](_0x5392ee,_0x758995,!![]);}catch(_0x421fc5){return BPromise[_0x1cde('0x21')](_0x421fc5);}return _0x5392ee[_0x1cde('0x22')]();};}function saveUpdates(_0x43d3e3,_0x4df1cc){return function(_0xed6e00){if(_0xed6e00){return _0xed6e00['update'](_0x43d3e3)['then'](function(_0x22d6d9){return _0x22d6d9;});}return null;};}function removeEntity(_0x21eed2,_0x5d28b1){return function(_0x55cede){if(_0x55cede){return _0x55cede[_0x1cde('0x23')]()['then'](function(){_0x21eed2[_0x1cde('0x19')](0xcc)[_0x1cde('0x1a')]();});}};}function handleEntityNotFound(_0x185f09,_0x4c6953){return function(_0x1f529f){if(!_0x1f529f){_0x185f09[_0x1cde('0x18')](0x194);}return _0x1f529f;};}function handleError(_0x1b317f,_0x383d8f){_0x383d8f=_0x383d8f||0x1f4;return function(_0x470fbb){logger[_0x1cde('0x24')](_0x470fbb[_0x1cde('0x25')]);if(_0x470fbb[_0x1cde('0x26')]){delete _0x470fbb[_0x1cde('0x26')];}_0x1b317f[_0x1cde('0x19')](_0x383d8f)[_0x1cde('0x27')](_0x470fbb);};}exports[_0x1cde('0x28')]=function(_0xc5ee7b,_0x24ae24){var _0x6c2c41={},_0x44b1c6={},_0x2b317d={'count':0x0,'rows':[]};var _0x4c6129=_[_0x1cde('0x29')](db['CmHopperHistory'][_0x1cde('0x2a')],function(_0x528506){return{'name':_0x528506[_0x1cde('0x2b')],'type':_0x528506['type'][_0x1cde('0x2c')]};});_0x44b1c6['model']=_['map'](_0x4c6129,'name');_0x44b1c6[_0x1cde('0x2d')]=_[_0x1cde('0x2e')](_0xc5ee7b[_0x1cde('0x2d')]);_0x44b1c6[_0x1cde('0x2f')]=_['intersection'](_0x44b1c6['model'],_0x44b1c6[_0x1cde('0x2d')]);_0x6c2c41[_0x1cde('0x30')]=_['intersection'](_0x44b1c6[_0x1cde('0x31')],qs[_0x1cde('0x32')](_0xc5ee7b['query'][_0x1cde('0x32')]));_0x6c2c41[_0x1cde('0x30')]=_0x6c2c41['attributes'][_0x1cde('0x33')]?_0x6c2c41[_0x1cde('0x30')]:_0x44b1c6['model'];if(!_0xc5ee7b[_0x1cde('0x2d')][_0x1cde('0x34')](_0x1cde('0x35'))){_0x6c2c41[_0x1cde('0x1d')]=qs[_0x1cde('0x1d')](_0xc5ee7b['query'][_0x1cde('0x1d')]);_0x6c2c41[_0x1cde('0x1b')]=qs['offset'](_0xc5ee7b[_0x1cde('0x2d')]['offset']);}_0x6c2c41[_0x1cde('0x36')]=qs['sort'](_0xc5ee7b[_0x1cde('0x2d')][_0x1cde('0x37')]);_0x6c2c41[_0x1cde('0x38')]=qs['filters'](_['pick'](_0xc5ee7b['query'],_0x44b1c6[_0x1cde('0x2f')]),_0x4c6129);if(_0xc5ee7b[_0x1cde('0x2d')][_0x1cde('0x39')]){_0x6c2c41[_0x1cde('0x38')]=_[_0x1cde('0x3a')](_0x6c2c41['where'],{'$or':_[_0x1cde('0x29')](_0x4c6129,function(_0x3450ee){if(_0x3450ee[_0x1cde('0x3b')]!==_0x1cde('0x3c')){var _0x439b66={};_0x439b66[_0x3450ee['name']]={'$like':'%'+_0xc5ee7b['query']['filter']+'%'};return _0x439b66;}})});}_0x6c2c41=_['merge']({},_0x6c2c41,_0xc5ee7b[_0x1cde('0x3d')]);var _0x2a1d1e={'where':_0x6c2c41[_0x1cde('0x38')]};return db[_0x1cde('0x3e')][_0x1cde('0x1e')](_0x2a1d1e)[_0x1cde('0x3f')](function(_0x1b1740){_0x2b317d['count']=_0x1b1740;if(_0xc5ee7b['query'][_0x1cde('0x40')]){_0x6c2c41[_0x1cde('0x41')]=[{'all':!![]}];}return db[_0x1cde('0x3e')][_0x1cde('0x42')](_0x6c2c41);})[_0x1cde('0x3f')](function(_0x5398a8){_0x2b317d[_0x1cde('0x43')]=_0x5398a8;return _0x2b317d;})[_0x1cde('0x3f')](respondWithFilteredResult(_0x24ae24,_0x6c2c41))[_0x1cde('0x44')](handleError(_0x24ae24,null));};exports['show']=function(_0x287509,_0x5d76f5){var _0x129a2c={'raw':!![],'where':{'id':_0x287509[_0x1cde('0x45')]['id']}},_0x45f928={};_0x45f928[_0x1cde('0x31')]=_[_0x1cde('0x2e')](db[_0x1cde('0x3e')][_0x1cde('0x2a')]);_0x45f928[_0x1cde('0x2d')]=_['keys'](_0x287509[_0x1cde('0x2d')]);_0x45f928['filters']=_[_0x1cde('0x46')](_0x45f928[_0x1cde('0x31')],_0x45f928[_0x1cde('0x2d')]);_0x129a2c['attributes']=_[_0x1cde('0x46')](_0x45f928['model'],qs[_0x1cde('0x32')](_0x287509['query'][_0x1cde('0x32')]));_0x129a2c['attributes']=_0x129a2c['attributes'][_0x1cde('0x33')]?_0x129a2c['attributes']:_0x45f928[_0x1cde('0x31')];if(_0x287509['query'][_0x1cde('0x40')]){_0x129a2c[_0x1cde('0x41')]=[{'all':!![]}];}_0x129a2c=_[_0x1cde('0x3a')]({},_0x129a2c,_0x287509[_0x1cde('0x3d')]);return db[_0x1cde('0x3e')][_0x1cde('0x47')](_0x129a2c)[_0x1cde('0x3f')](handleEntityNotFound(_0x5d76f5,null))[_0x1cde('0x3f')](respondWithResult(_0x5d76f5,null))[_0x1cde('0x44')](handleError(_0x5d76f5,null));};exports[_0x1cde('0x48')]=function(_0x2509bc,_0xa7e4dd){return db[_0x1cde('0x3e')]['create'](_0x2509bc[_0x1cde('0x49')],{})[_0x1cde('0x3f')](respondWithResult(_0xa7e4dd,0xc9))['catch'](handleError(_0xa7e4dd,null));};exports['describe']=function(_0x6bbc17,_0x377e70){return db[_0x1cde('0x3e')]['describe']()[_0x1cde('0x3f')](respondWithResult(_0x377e70,null))[_0x1cde('0x44')](handleError(_0x377e70,null));};exports[_0x1cde('0x4a')]=function(_0xcd4215,_0x180477){if(_0xcd4215[_0x1cde('0x49')][_0x1cde('0x4b')]){delete _0xcd4215['body'][_0x1cde('0x4b')];}return db[_0x1cde('0x3e')][_0x1cde('0x47')]({'where':{'uniqueid':_0xcd4215['params']['id']}})[_0x1cde('0x3f')](handleEntityNotFound(_0x180477,null))['then'](saveUpdates(_0xcd4215[_0x1cde('0x49')],null))[_0x1cde('0x3f')](respondWithResult(_0x180477,null))['catch'](handleError(_0x180477,null));}; \ No newline at end of file +var _0xe1db=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmHopperHistory','findAll','rows','catch','params','create','body','describe','uniqueid','find','eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0xe1db,0xff));var _0xbe1d=function(_0x24fe22,_0x7e3872){_0x24fe22=_0x24fe22-0x0;var _0x502824=_0xe1db[_0x24fe22];return _0x502824;};'use strict';var emlformat=require(_0xbe1d('0x0'));var rimraf=require(_0xbe1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbe1d('0x3'));var Mustache=require('mustache');var util=require(_0xbe1d('0x4'));var path=require('path');var sox=require(_0xbe1d('0x5'));var csv=require(_0xbe1d('0x6'));var ejs=require(_0xbe1d('0x7'));var fs=require('fs');var fs_extra=require(_0xbe1d('0x8'));var _=require(_0xbe1d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbe1d('0xa'));var deskjs=require(_0xbe1d('0xb'));var toCsv=require(_0xbe1d('0x6'));var querystring=require(_0xbe1d('0xc'));var Papa=require('papaparse');var Redis=require(_0xbe1d('0xd'));var authService=require(_0xbe1d('0xe'));var qs=require(_0xbe1d('0xf'));var as=require(_0xbe1d('0x10'));var hardwareService=require(_0xbe1d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xbe1d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbe1d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x162b6d,_0x51bce3){_0x51bce3=_0x51bce3||0xcc;return function(_0x1ec221){if(_0x1ec221){return _0x162b6d['sendStatus'](_0x51bce3);}return _0x162b6d[_0xbe1d('0x14')](_0x51bce3)[_0xbe1d('0x15')]();};}function respondWithResult(_0x5573e8,_0x1734d3){_0x1734d3=_0x1734d3||0xc8;return function(_0x19da82){if(_0x19da82){return _0x5573e8[_0xbe1d('0x14')](_0x1734d3)[_0xbe1d('0x16')](_0x19da82);}};}function respondWithFilteredResult(_0x24f1e4,_0x159a45){return function(_0x2f20c0){if(_0x2f20c0){var _0x30d5fd=typeof _0x159a45[_0xbe1d('0x17')]===_0xbe1d('0x18')&&typeof _0x159a45[_0xbe1d('0x19')]==='undefined';var _0x48de10=_0x2f20c0['count'];var _0x598f62=_0x30d5fd?0x0:_0x159a45[_0xbe1d('0x17')];var _0x5d0f2d=_0x30d5fd?_0x2f20c0[_0xbe1d('0x1a')]:_0x159a45[_0xbe1d('0x17')]+_0x159a45[_0xbe1d('0x19')];var _0x52b4f2;if(_0x5d0f2d>=_0x48de10){_0x5d0f2d=_0x48de10;_0x52b4f2=0xc8;}else{_0x52b4f2=0xce;}_0x24f1e4['status'](_0x52b4f2);return _0x24f1e4['set'](_0xbe1d('0x1b'),_0x598f62+'-'+_0x5d0f2d+'/'+_0x48de10)[_0xbe1d('0x16')](_0x2f20c0);}return null;};}function patchUpdates(_0x55e165){return function(_0x14b47e){try{jsonpatch[_0xbe1d('0x1c')](_0x14b47e,_0x55e165,!![]);}catch(_0x4bf59f){return BPromise[_0xbe1d('0x1d')](_0x4bf59f);}return _0x14b47e[_0xbe1d('0x1e')]();};}function saveUpdates(_0x219cf6,_0x4704ee){return function(_0x1ce3c4){if(_0x1ce3c4){return _0x1ce3c4[_0xbe1d('0x1f')](_0x219cf6)[_0xbe1d('0x20')](function(_0x386496){return _0x386496;});}return null;};}function removeEntity(_0x2a4c5d,_0x47e11d){return function(_0x1ad6ea){if(_0x1ad6ea){return _0x1ad6ea[_0xbe1d('0x21')]()[_0xbe1d('0x20')](function(){_0x2a4c5d['status'](0xcc)[_0xbe1d('0x15')]();});}};}function handleEntityNotFound(_0x4dca86,_0x3bf73f){return function(_0x159e8d){if(!_0x159e8d){_0x4dca86['sendStatus'](0x194);}return _0x159e8d;};}function handleError(_0x1286e9,_0x328b6d){_0x328b6d=_0x328b6d||0x1f4;return function(_0x152dc7){logger['error'](_0x152dc7[_0xbe1d('0x22')]);if(_0x152dc7['name']){delete _0x152dc7[_0xbe1d('0x23')];}_0x1286e9[_0xbe1d('0x14')](_0x328b6d)[_0xbe1d('0x24')](_0x152dc7);};}exports[_0xbe1d('0x25')]=function(_0xb91588,_0x448a88){var _0x360d86={},_0x1fa176={},_0x5d6d3a={'count':0x0,'rows':[]};var _0xbb474d=_[_0xbe1d('0x26')](db['CmHopperHistory'][_0xbe1d('0x27')],function(_0x9ffab7){return{'name':_0x9ffab7[_0xbe1d('0x28')],'type':_0x9ffab7[_0xbe1d('0x29')][_0xbe1d('0x2a')]};});_0x1fa176[_0xbe1d('0x2b')]=_[_0xbe1d('0x26')](_0xbb474d,'name');_0x1fa176[_0xbe1d('0x2c')]=_[_0xbe1d('0x2d')](_0xb91588[_0xbe1d('0x2c')]);_0x1fa176[_0xbe1d('0x2e')]=_[_0xbe1d('0x2f')](_0x1fa176[_0xbe1d('0x2b')],_0x1fa176[_0xbe1d('0x2c')]);_0x360d86[_0xbe1d('0x30')]=_['intersection'](_0x1fa176[_0xbe1d('0x2b')],qs[_0xbe1d('0x31')](_0xb91588['query'][_0xbe1d('0x31')]));_0x360d86[_0xbe1d('0x30')]=_0x360d86[_0xbe1d('0x30')][_0xbe1d('0x32')]?_0x360d86['attributes']:_0x1fa176[_0xbe1d('0x2b')];if(!_0xb91588['query'][_0xbe1d('0x33')](_0xbe1d('0x34'))){_0x360d86[_0xbe1d('0x19')]=qs[_0xbe1d('0x19')](_0xb91588[_0xbe1d('0x2c')]['limit']);_0x360d86[_0xbe1d('0x17')]=qs['offset'](_0xb91588[_0xbe1d('0x2c')][_0xbe1d('0x17')]);}_0x360d86[_0xbe1d('0x35')]=qs[_0xbe1d('0x36')](_0xb91588[_0xbe1d('0x2c')][_0xbe1d('0x36')]);_0x360d86[_0xbe1d('0x37')]=qs[_0xbe1d('0x2e')](_[_0xbe1d('0x38')](_0xb91588[_0xbe1d('0x2c')],_0x1fa176[_0xbe1d('0x2e')]),_0xbb474d);if(_0xb91588['query'][_0xbe1d('0x39')]){_0x360d86['where']=_[_0xbe1d('0x3a')](_0x360d86[_0xbe1d('0x37')],{'$or':_['map'](_0xbb474d,function(_0x2f3bfa){if(_0x2f3bfa[_0xbe1d('0x29')]!==_0xbe1d('0x3b')){var _0x33a0a3={};_0x33a0a3[_0x2f3bfa[_0xbe1d('0x23')]]={'$like':'%'+_0xb91588[_0xbe1d('0x2c')][_0xbe1d('0x39')]+'%'};return _0x33a0a3;}})});}_0x360d86=_[_0xbe1d('0x3a')]({},_0x360d86,_0xb91588[_0xbe1d('0x3c')]);var _0x5d7734={'where':_0x360d86[_0xbe1d('0x37')]};return db['CmHopperHistory']['count'](_0x5d7734)[_0xbe1d('0x20')](function(_0x51e00b){_0x5d6d3a['count']=_0x51e00b;if(_0xb91588['query'][_0xbe1d('0x3d')]){_0x360d86[_0xbe1d('0x3e')]=[{'all':!![]}];}return db[_0xbe1d('0x3f')][_0xbe1d('0x40')](_0x360d86);})[_0xbe1d('0x20')](function(_0x5b212d){_0x5d6d3a[_0xbe1d('0x41')]=_0x5b212d;return _0x5d6d3a;})[_0xbe1d('0x20')](respondWithFilteredResult(_0x448a88,_0x360d86))[_0xbe1d('0x42')](handleError(_0x448a88,null));};exports['show']=function(_0x5e2bdc,_0x43090c){var _0x41cb73={'raw':!![],'where':{'id':_0x5e2bdc[_0xbe1d('0x43')]['id']}},_0x24f9da={};_0x24f9da[_0xbe1d('0x2b')]=_[_0xbe1d('0x2d')](db[_0xbe1d('0x3f')][_0xbe1d('0x27')]);_0x24f9da[_0xbe1d('0x2c')]=_['keys'](_0x5e2bdc['query']);_0x24f9da[_0xbe1d('0x2e')]=_[_0xbe1d('0x2f')](_0x24f9da['model'],_0x24f9da[_0xbe1d('0x2c')]);_0x41cb73[_0xbe1d('0x30')]=_['intersection'](_0x24f9da[_0xbe1d('0x2b')],qs[_0xbe1d('0x31')](_0x5e2bdc['query']['fields']));_0x41cb73['attributes']=_0x41cb73['attributes']['length']?_0x41cb73[_0xbe1d('0x30')]:_0x24f9da[_0xbe1d('0x2b')];if(_0x5e2bdc[_0xbe1d('0x2c')][_0xbe1d('0x3d')]){_0x41cb73[_0xbe1d('0x3e')]=[{'all':!![]}];}_0x41cb73=_[_0xbe1d('0x3a')]({},_0x41cb73,_0x5e2bdc[_0xbe1d('0x3c')]);return db[_0xbe1d('0x3f')]['find'](_0x41cb73)['then'](handleEntityNotFound(_0x43090c,null))['then'](respondWithResult(_0x43090c,null))[_0xbe1d('0x42')](handleError(_0x43090c,null));};exports[_0xbe1d('0x44')]=function(_0x5037d0,_0x5c86af){return db['CmHopperHistory'][_0xbe1d('0x44')](_0x5037d0[_0xbe1d('0x45')],{})[_0xbe1d('0x20')](respondWithResult(_0x5c86af,0xc9))[_0xbe1d('0x42')](handleError(_0x5c86af,null));};exports[_0xbe1d('0x46')]=function(_0x903eaa,_0x1aad57){return db[_0xbe1d('0x3f')][_0xbe1d('0x46')]()[_0xbe1d('0x20')](respondWithResult(_0x1aad57,null))[_0xbe1d('0x42')](handleError(_0x1aad57,null));};exports[_0xbe1d('0x1f')]=function(_0x3addbd,_0x5677cd){if(_0x3addbd[_0xbe1d('0x45')][_0xbe1d('0x47')]){delete _0x3addbd[_0xbe1d('0x45')][_0xbe1d('0x47')];}return db['CmHopperHistory'][_0xbe1d('0x48')]({'where':{'uniqueid':_0x3addbd[_0xbe1d('0x43')]['id']}})[_0xbe1d('0x20')](handleEntityNotFound(_0x5677cd,null))[_0xbe1d('0x20')](saveUpdates(_0x3addbd[_0xbe1d('0x45')],null))[_0xbe1d('0x20')](respondWithResult(_0x5677cd,null))[_0xbe1d('0x42')](handleError(_0x5677cd,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2b3b45c..8be3465 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 _0xe2fe=['endtime','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory'];(function(_0x303d9f,_0x1eeb62){var _0x37eccf=function(_0x2f4a39){while(--_0x2f4a39){_0x303d9f['push'](_0x303d9f['shift']());}};_0x37eccf(++_0x1eeb62);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['endtime']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x225b=['rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','request-promise'];(function(_0x2d6141,_0x189922){var _0xbc02da=function(_0x1d7ddb){while(--_0x1d7ddb){_0x2d6141['push'](_0x2d6141['shift']());}};_0xbc02da(++_0x189922);}(_0x225b,0xb1));var _0xb225=function(_0x4f5f1b,_0x234e25){_0x4f5f1b=_0x4f5f1b-0x0;var _0xd8a4a7=_0x225b[_0x4f5f1b];return _0xd8a4a7;};'use strict';var _=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var logger=require('../../config/logger')(_0xb225('0x2'));var moment=require(_0xb225('0x3'));var BPromise=require('bluebird');var rp=require(_0xb225('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb225('0x5'));var config=require('../../config/environment');var attributes=require(_0xb225('0x6'));module[_0xb225('0x7')]=function(_0x3f2419,_0x4751e2){return _0x3f2419[_0xb225('0x8')](_0xb225('0x9'),attributes,{'tableName':_0xb225('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xb225('0xb')]},{'name':_0xb225('0xc'),'fields':[_0xb225('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index a87955b..0a9a47f 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 _0x5afe=['AVG','predictiveIntervalAvgHoldtime','GetVoiceQueueHopperHistory','where','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit'];(function(_0x4443c3,_0x3948f8){var _0x247a2f=function(_0x246716){while(--_0x246716){_0x4443c3['push'](_0x4443c3['shift']());}};_0x247a2f(++_0x3948f8);}(_0x5afe,0x1ab));var _0xe5af=function(_0x4583d0,_0x24551f){_0x4583d0=_0x4583d0-0x0;var _0x7b3c5a=_0x5afe[_0x4583d0];return _0x7b3c5a;};'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);});});}exports[_0xe5af('0x17')]=function(_0x273b2e){var _0x576946=this;return new Promise(function(_0x53f1b2,_0x44f7cc){return db[_0xe5af('0x18')][_0xe5af('0x19')](_0x273b2e[_0xe5af('0x1a')],{'raw':_0x273b2e['options']?_0x273b2e[_0xe5af('0x1b')][_0xe5af('0x1c')]===undefined?!![]:![]:!![]})[_0xe5af('0xd')](function(_0x10eb64){logger[_0xe5af('0xe')](_0xe5af('0x17'),_0x273b2e);logger['debug'](_0xe5af('0x17'),_0x273b2e,JSON[_0xe5af('0x1d')](_0x10eb64));_0x53f1b2(_0x10eb64);})['catch'](function(_0x4f6e5f){logger[_0xe5af('0x13')](_0xe5af('0x17'),_0x4f6e5f['message'],_0x273b2e);_0x44f7cc(_0x576946[_0xe5af('0x13')](0x1f4,_0x4f6e5f[_0xe5af('0x15')]));});});};exports[_0xe5af('0x1e')]=function(_0x4f037f){var _0x2f57db=this;return new Promise(function(_0x3daa01,_0x351e51){return db[_0xe5af('0x18')][_0xe5af('0x1f')]({'raw':_0x4f037f[_0xe5af('0x1b')]?_0x4f037f[_0xe5af('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4f037f[_0xe5af('0x1b')]?_0x4f037f[_0xe5af('0x1b')]['where']||null:null,'attributes':[[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db['sequelize'][_0xe5af('0x22')]('id')),_0xe5af('0x23')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xe5af('0x24')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')](_0xe5af('0x26')))),_0xe5af('0x27')],[db[_0xe5af('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe5af('0x20')]['literal'](_0xe5af('0x28')))),_0xe5af('0x29')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x2a'),db[_0xe5af('0x20')]['fn']('IF',db['sequelize'][_0xe5af('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xe5af('0x2b')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x2a'),db[_0xe5af('0x20')]['fn']('IF',db['sequelize'][_0xe5af('0x25')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xe5af('0xd')](function(_0x892d32){logger[_0xe5af('0xe')](_0xe5af('0x1e'),_0x4f037f);logger[_0xe5af('0x11')](_0xe5af('0x1e'),_0x4f037f,JSON[_0xe5af('0x1d')](_0x892d32));_0x3daa01(_0x892d32);})[_0xe5af('0x16')](function(_0x338a5d){logger[_0xe5af('0x13')](_0xe5af('0x1e'),_0x338a5d[_0xe5af('0x15')],_0x4f037f);_0x351e51(_0x2f57db['error'](0x1f4,_0x338a5d['message']));});});};exports[_0xe5af('0x2c')]=function(_0x3a5f30){var _0x501967=this;return new Promise(function(_0x33e927,_0x175337){return db['CmHopperHistory'][_0xe5af('0x1f')]({'raw':_0x3a5f30[_0xe5af('0x1b')]?_0x3a5f30[_0xe5af('0x1b')][_0xe5af('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5f30[_0xe5af('0x1b')]?_0x3a5f30[_0xe5af('0x1b')][_0xe5af('0x2d')]||null:null,'attributes':[['campaign',_0xe5af('0x2e')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')]['literal'](_0xe5af('0x2f')))),_0xe5af('0x30')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')](_0xe5af('0x31')))),'outboundNoAnswerCallsDay'],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')](_0xe5af('0x32')))),'outboundAnswerCallsDay'],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')]('`state`\x20=\x205,\x201,\x20null'))),_0xe5af('0x33')],[db['sequelize']['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db['sequelize']['literal'](_0xe5af('0x34')))),_0xe5af('0x35')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe5af('0x36')))),_0xe5af('0x37')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0xe5af('0x20')]['fn']('COUNT',db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')]['literal'](_0xe5af('0x38')))),_0xe5af('0x39')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xe5af('0x21'),db['sequelize']['fn']('IF',db[_0xe5af('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db['sequelize']['fn']('IF',db[_0xe5af('0x20')]['literal'](_0xe5af('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db['sequelize']['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')](_0xe5af('0x3b')))),_0xe5af('0x3c')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db['sequelize']['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')](_0xe5af('0x3d')))),_0xe5af('0x3e')]],'group':[_0xe5af('0x3f')]})[_0xe5af('0xd')](function(_0x17424c){logger[_0xe5af('0xe')](_0xe5af('0x2c'),_0x3a5f30);logger[_0xe5af('0x11')]('GetVoiceQueueHopperHistory',_0x3a5f30,JSON[_0xe5af('0x1d')](_0x17424c));_0x33e927(_0x17424c);})[_0xe5af('0x16')](function(_0x323e53){logger[_0xe5af('0x13')]('GetVoiceQueueHopperHistory',_0x323e53[_0xe5af('0x15')],_0x3a5f30);_0x175337(_0x501967['error'](0x1f4,_0x323e53[_0xe5af('0x15')]));});});};exports[_0xe5af('0x40')]=function(_0x255ce2){var _0x144f13=this;return new Promise(function(_0x2be30c,_0x46b2a8){return db[_0xe5af('0x18')][_0xe5af('0x1f')]({'raw':_0x255ce2[_0xe5af('0x1b')]?_0x255ce2[_0xe5af('0x1b')][_0xe5af('0x1c')]===undefined?!![]:![]:!![],'where':_0x255ce2[_0xe5af('0x1b')]?_0x255ce2[_0xe5af('0x1b')]['where']||null:null,'attributes':[['campaign',_0xe5af('0x2e')],[db[_0xe5af('0x20')]['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['col']('id')),_0xe5af('0x41')],[db['sequelize']['fn'](_0xe5af('0x21'),db[_0xe5af('0x20')]['fn']('IF',db[_0xe5af('0x20')][_0xe5af('0x25')](_0xe5af('0x32')))),_0xe5af('0x42')]],'group':['campaign']})[_0xe5af('0xd')](function(_0x517e15){logger[_0xe5af('0xe')](_0xe5af('0x40'),_0x255ce2);logger['debug'](_0xe5af('0x40'),_0x255ce2,JSON[_0xe5af('0x1d')](_0x517e15));_0x2be30c(_0x517e15);})['catch'](function(_0x46bb95){logger[_0xe5af('0x13')](_0xe5af('0x40'),_0x46bb95[_0xe5af('0x15')],_0x255ce2);_0x46b2a8(_0x144f13[_0xe5af('0x13')](0x1f4,_0x46bb95[_0xe5af('0x15')]));});});}; \ No newline at end of file +var _0x8aae=['jayson/promise','client','http','info','CmHopperHistory,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','COUNT','sequelize','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','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','stringify','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x3ced91,_0x16ec49){var _0x101213=function(_0x5ed358){while(--_0x5ed358){_0x3ced91['push'](_0x3ced91['shift']());}};_0x101213(++_0x16ec49);}(_0x8aae,0x138));var _0xe8aa=function(_0x2a87aa,_0x10dc7f){_0x2a87aa=_0x2a87aa-0x0;var _0xacdca7=_0x8aae[_0x2a87aa];return _0xacdca7;};'use strict';var _=require(_0xe8aa('0x0'));var util=require(_0xe8aa('0x1'));var moment=require(_0xe8aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8aa('0x3'));var fs=require('fs');var Redis=require(_0xe8aa('0x4'));var db=require(_0xe8aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe8aa('0x6'));var config=require(_0xe8aa('0x7'));var jayson=require(_0xe8aa('0x8'));var client=jayson[_0xe8aa('0x9')][_0xe8aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c9d3a,_0x5cccd6,_0x50ac0f){return new BPromise(function(_0x14ba4b,_0x328ce1){return client['request'](_0x2c9d3a,_0x50ac0f)['then'](function(_0x3c7fd9){logger[_0xe8aa('0xb')](_0xe8aa('0xc'),_0x5cccd6,'request\x20sent');logger[_0xe8aa('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5cccd6,'request\x20sent',JSON['stringify'](_0x3c7fd9));if(_0x3c7fd9[_0xe8aa('0xe')]){if(_0x3c7fd9[_0xe8aa('0xe')][_0xe8aa('0xf')]===0x1f4){logger[_0xe8aa('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x5cccd6,_0x3c7fd9[_0xe8aa('0xe')]['message']);return _0x328ce1(_0x3c7fd9[_0xe8aa('0xe')]['message']);}logger[_0xe8aa('0xe')](_0xe8aa('0xc'),_0x5cccd6,_0x3c7fd9[_0xe8aa('0xe')][_0xe8aa('0x10')]);return _0x14ba4b(_0x3c7fd9['error'][_0xe8aa('0x10')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x5cccd6,_0xe8aa('0x11'));_0x14ba4b(_0x3c7fd9[_0xe8aa('0x12')][_0xe8aa('0x10')]);}})[_0xe8aa('0x13')](function(_0x38f79f){logger[_0xe8aa('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x5cccd6,_0x38f79f);_0x328ce1(_0x38f79f);});});}exports[_0xe8aa('0x14')]=function(_0x1223a1){var _0xd328f=this;return new Promise(function(_0x47f6ba,_0x2f8f53){return db[_0xe8aa('0x15')][_0xe8aa('0x16')](_0x1223a1[_0xe8aa('0x17')],{'raw':_0x1223a1[_0xe8aa('0x18')]?_0x1223a1['options'][_0xe8aa('0x19')]===undefined?!![]:![]:!![]})[_0xe8aa('0x1a')](function(_0x139ba2){logger[_0xe8aa('0xb')](_0xe8aa('0x14'),_0x1223a1);logger[_0xe8aa('0xd')](_0xe8aa('0x14'),_0x1223a1,JSON['stringify'](_0x139ba2));_0x47f6ba(_0x139ba2);})[_0xe8aa('0x13')](function(_0x1f28fe){logger['error']('CreateCmHopperHistory',_0x1f28fe['message'],_0x1223a1);_0x2f8f53(_0xd328f[_0xe8aa('0xe')](0x1f4,_0x1f28fe[_0xe8aa('0x10')]));});});};exports[_0xe8aa('0x1b')]=function(_0x5c5dbd){var _0x443456=this;return new Promise(function(_0x78cd14,_0xb64e51){return db[_0xe8aa('0x15')][_0xe8aa('0x1c')]({'raw':_0x5c5dbd[_0xe8aa('0x18')]?_0x5c5dbd[_0xe8aa('0x18')][_0xe8aa('0x19')]===undefined?!![]:![]:!![],'where':_0x5c5dbd[_0xe8aa('0x18')]?_0x5c5dbd[_0xe8aa('0x18')][_0xe8aa('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')][_0xe8aa('0x20')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xe8aa('0x22')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x23')))),_0xe8aa('0x24')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xe8aa('0x1f')]['fn']('AVG',db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xe8aa('0x25')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x26'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x27')))),_0xe8aa('0x28')]]})[_0xe8aa('0x1a')](function(_0x30e08b){logger[_0xe8aa('0xb')](_0xe8aa('0x1b'),_0x5c5dbd);logger[_0xe8aa('0xd')](_0xe8aa('0x1b'),_0x5c5dbd,JSON['stringify'](_0x30e08b));_0x78cd14(_0x30e08b);})[_0xe8aa('0x13')](function(_0x31e1a7){logger['error'](_0xe8aa('0x1b'),_0x31e1a7[_0xe8aa('0x10')],_0x5c5dbd);_0xb64e51(_0x443456[_0xe8aa('0xe')](0x1f4,_0x31e1a7['message']));});});};exports[_0xe8aa('0x29')]=function(_0x23dbc3){var _0x10a2f7=this;return new Promise(function(_0x38aa38,_0x2d3f3f){return db[_0xe8aa('0x15')][_0xe8aa('0x1c')]({'raw':_0x23dbc3[_0xe8aa('0x18')]?_0x23dbc3['options'][_0xe8aa('0x19')]===undefined?!![]:![]:!![],'where':_0x23dbc3['options']?_0x23dbc3[_0xe8aa('0x18')][_0xe8aa('0x1d')]||null:null,'attributes':[[_0xe8aa('0x2a'),_0xe8aa('0x2b')],[db['sequelize']['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db['sequelize'][_0xe8aa('0x21')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x2c')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xe8aa('0x2d')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0xe8aa('0x2e')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db['sequelize'][_0xe8aa('0x21')](_0xe8aa('0x2f')))),_0xe8aa('0x30')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x31')))),_0xe8aa('0x32')],[db['sequelize']['fn'](_0xe8aa('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xe8aa('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0xe8aa('0x33')],[db['sequelize']['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x34')))),_0xe8aa('0x35')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x36')))),_0xe8aa('0x37')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0xe8aa('0x38')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x39')))),_0xe8aa('0x3a')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db['sequelize']['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x3b')))),_0xe8aa('0x38')],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')](_0xe8aa('0x3c')))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x34bd3d){logger[_0xe8aa('0xb')](_0xe8aa('0x29'),_0x23dbc3);logger[_0xe8aa('0xd')](_0xe8aa('0x29'),_0x23dbc3,JSON[_0xe8aa('0x3d')](_0x34bd3d));_0x38aa38(_0x34bd3d);})[_0xe8aa('0x13')](function(_0x44827b){logger[_0xe8aa('0xe')]('GetVoiceQueueHopperHistory',_0x44827b[_0xe8aa('0x10')],_0x23dbc3);_0x2d3f3f(_0x10a2f7['error'](0x1f4,_0x44827b['message']));});});};exports['GetCampaignHopperHistory']=function(_0x56225e){var _0x303be4=this;return new Promise(function(_0x2808c7,_0x4292ff){return db[_0xe8aa('0x15')][_0xe8aa('0x1c')]({'raw':_0x56225e[_0xe8aa('0x18')]?_0x56225e[_0xe8aa('0x18')][_0xe8aa('0x19')]===undefined?!![]:![]:!![],'where':_0x56225e['options']?_0x56225e[_0xe8aa('0x18')][_0xe8aa('0x1d')]||null:null,'attributes':[['campaign','name'],[db['sequelize']['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')][_0xe8aa('0x20')]('id')),'ivrTotalCallsDays'],[db[_0xe8aa('0x1f')]['fn'](_0xe8aa('0x1e'),db[_0xe8aa('0x1f')]['fn']('IF',db[_0xe8aa('0x1f')][_0xe8aa('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xe8aa('0x3e')]],'group':[_0xe8aa('0x2a')]})[_0xe8aa('0x1a')](function(_0x45c871){logger[_0xe8aa('0xb')](_0xe8aa('0x3f'),_0x56225e);logger[_0xe8aa('0xd')](_0xe8aa('0x3f'),_0x56225e,JSON[_0xe8aa('0x3d')](_0x45c871));_0x2808c7(_0x45c871);})[_0xe8aa('0x13')](function(_0x3952be){logger[_0xe8aa('0xe')](_0xe8aa('0x3f'),_0x3952be['message'],_0x56225e);_0x4292ff(_0x303be4[_0xe8aa('0xe')](0x1f4,_0x3952be[_0xe8aa('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index baef342..e9c09b0 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 _0x4e13=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','show','post','create','put','update','multer','util'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x4e13,0x1ae));var _0x34e1=function(_0x170bba,_0x2be92f){_0x170bba=_0x170bba-0x0;var _0xa7c249=_0x4e13[_0x170bba];return _0xa7c249;};'use strict';var multer=require(_0x34e1('0x0'));var util=require(_0x34e1('0x1'));var path=require('path');var timeout=require(_0x34e1('0x2'));var express=require(_0x34e1('0x3'));var router=express[_0x34e1('0x4')]();var fs_extra=require(_0x34e1('0x5'));var auth=require(_0x34e1('0x6'));var interaction=require(_0x34e1('0x7'));var config=require('../../config/environment');var controller=require(_0x34e1('0x8'));router[_0x34e1('0x9')]('/',auth[_0x34e1('0xa')](),controller[_0x34e1('0xb')]);router[_0x34e1('0x9')](_0x34e1('0xc'),auth[_0x34e1('0xa')](),controller['describe']);router[_0x34e1('0x9')]('/:id',auth[_0x34e1('0xa')](),controller[_0x34e1('0xd')]);router[_0x34e1('0xe')]('/',auth['isAuthenticated'](),controller[_0x34e1('0xf')]);router[_0x34e1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x34e1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2658=['/describe','/:id','show','post','create','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x2658,0x112));var _0x8265=function(_0x500438,_0x3a05ec){_0x500438=_0x500438-0x0;var _0x14155a=_0x2658[_0x500438];return _0x14155a;};'use strict';var multer=require(_0x8265('0x0'));var util=require(_0x8265('0x1'));var path=require(_0x8265('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8265('0x3')]();var fs_extra=require(_0x8265('0x4'));var auth=require(_0x8265('0x5'));var interaction=require(_0x8265('0x6'));var config=require(_0x8265('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x8265('0x8')]('/',auth[_0x8265('0x9')](),controller[_0x8265('0xa')]);router[_0x8265('0x8')](_0x8265('0xb'),auth[_0x8265('0x9')](),controller['describe']);router[_0x8265('0x8')](_0x8265('0xc'),auth['isAuthenticated'](),controller[_0x8265('0xd')]);router[_0x8265('0xe')]('/',auth['isAuthenticated'](),controller[_0x8265('0xf')]);router[_0x8265('0x10')](_0x8265('0xc'),auth[_0x8265('0x9')](),controller[_0x8265('0x11')]);module[_0x8265('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e4cbb9c..ea5beb8 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 _0x984b=['name','STRING'];(function(_0x30c8c7,_0x455188){var _0x55f32d=function(_0x31487f){while(--_0x31487f){_0x30c8c7['push'](_0x30c8c7['shift']());}};_0x55f32d(++_0x455188);}(_0x984b,0xee));var _0xb984=function(_0x56c591,_0x10c39c){_0x56c591=_0x56c591-0x0;var _0x5a9e95=_0x984b[_0x56c591];return _0x5a9e95;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb984('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb984('0x1')]},'dialPrefix':{'type':Sequelize[_0xb984('0x1')]}}; \ No newline at end of file +var _0xa566=['exports','STRING','sequelize'];(function(_0x296b81,_0x35de0d){var _0x2a2b8b=function(_0x2833cd){while(--_0x2833cd){_0x296b81['push'](_0x296b81['shift']());}};_0x2a2b8b(++_0x35de0d);}(_0xa566,0x1c1));var _0x6a56=function(_0x40a895,_0x1a8bc2){_0x40a895=_0x40a895-0x0;var _0x8bff6c=_0xa566[_0x40a895];return _0x8bff6c;};'use strict';var Sequelize=require(_0x6a56('0x0'));module[_0x6a56('0x1')]={'name':{'type':Sequelize[_0x6a56('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a56('0x2')]},'dialPrefix':{'type':Sequelize[_0x6a56('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 950404e..37945f1 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 _0x61fe=['Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','send','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','userProfileId','name','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','ListId','Disposition','getDispositions','findOne','pick','removeDispositions','CmContact','describe','tags','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','ContactItemType','OrderBy','CmCustomField','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','customField_','alias','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','ids','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./cmList.socket','register','status','end','json','offset','undefined','limit','count'];(function(_0x1a78f0,_0x398b53){var _0x3704e5=function(_0x210c13){while(--_0x210c13){_0x1a78f0['push'](_0x1a78f0['shift']());}};_0x3704e5(++_0x398b53);}(_0x61fe,0x7e));var _0xe61f=function(_0x3759de,_0xac7a71){_0x3759de=_0x3759de-0x0;var _0x4f565c=_0x61fe[_0x3759de];return _0x4f565c;};'use strict';var emlformat=require(_0xe61f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe61f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe61f('0x2'));var moment=require(_0xe61f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe61f('0x4'));var util=require('util');var path=require(_0xe61f('0x5'));var sox=require(_0xe61f('0x6'));var csv=require('to-csv');var ejs=require(_0xe61f('0x7'));var fs=require('fs');var fs_extra=require(_0xe61f('0x8'));var _=require(_0xe61f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe61f('0xa'));var deskjs=require(_0xe61f('0xb'));var toCsv=require(_0xe61f('0xc'));var querystring=require(_0xe61f('0xd'));var Papa=require(_0xe61f('0xe'));var Redis=require('ioredis');var authService=require(_0xe61f('0xf'));var qs=require(_0xe61f('0x10'));var as=require(_0xe61f('0x11'));var hardwareService=require(_0xe61f('0x12'));var logger=require(_0xe61f('0x13'))(_0xe61f('0x14'));var utils=require(_0xe61f('0x15'));var config=require(_0xe61f('0x16'));var licenseUtil=require(_0xe61f('0x17'));var db=require(_0xe61f('0x18'))['db'];var csv_results;config['redis']=_[_0xe61f('0x19')](config[_0xe61f('0x1a')],{'host':_0xe61f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe61f('0x1a')]));require(_0xe61f('0x1c'))[_0xe61f('0x1d')](socket);function respondWithStatusCode(_0x3a74ae,_0x2e5a9c){_0x2e5a9c=_0x2e5a9c||0xcc;return function(_0x4cb841){if(_0x4cb841){return _0x3a74ae['sendStatus'](_0x2e5a9c);}return _0x3a74ae[_0xe61f('0x1e')](_0x2e5a9c)[_0xe61f('0x1f')]();};}function respondWithResult(_0x5c5cf2,_0x4e8623){_0x4e8623=_0x4e8623||0xc8;return function(_0x3103f1){if(_0x3103f1){return _0x5c5cf2[_0xe61f('0x1e')](_0x4e8623)[_0xe61f('0x20')](_0x3103f1);}};}function respondWithFilteredResult(_0x9d5bc4,_0x2d3ae4){return function(_0x411505){if(_0x411505){var _0x2e4249=typeof _0x2d3ae4[_0xe61f('0x21')]===_0xe61f('0x22')&&typeof _0x2d3ae4[_0xe61f('0x23')]===_0xe61f('0x22');var _0x5a2f48=_0x411505[_0xe61f('0x24')];var _0xa580a2=_0x2e4249?0x0:_0x2d3ae4[_0xe61f('0x21')];var _0x487076=_0x2e4249?_0x411505[_0xe61f('0x24')]:_0x2d3ae4[_0xe61f('0x21')]+_0x2d3ae4['limit'];var _0x135fa5;if(_0x487076>=_0x5a2f48){_0x487076=_0x5a2f48;_0x135fa5=0xc8;}else{_0x135fa5=0xce;}_0x9d5bc4[_0xe61f('0x1e')](_0x135fa5);return _0x9d5bc4['set'](_0xe61f('0x25'),_0xa580a2+'-'+_0x487076+'/'+_0x5a2f48)[_0xe61f('0x20')](_0x411505);}return null;};}function patchUpdates(_0x1ecb43){return function(_0x4edc65){try{jsonpatch['apply'](_0x4edc65,_0x1ecb43,!![]);}catch(_0x4048cc){return BPromise[_0xe61f('0x26')](_0x4048cc);}return _0x4edc65[_0xe61f('0x27')]();};}function saveUpdates(_0x3ac61e,_0x288cac){return function(_0x1cfda6){if(_0x1cfda6){return _0x1cfda6[_0xe61f('0x28')](_0x3ac61e)[_0xe61f('0x29')](function(_0xdd3a4b){return _0xdd3a4b;});}return null;};}function removeEntity(_0x516793,_0x5a9619){return function(_0x33a19e){if(_0x33a19e){return _0x33a19e[_0xe61f('0x2a')]()[_0xe61f('0x29')](function(){var _0x4b15f9=_0x33a19e[_0xe61f('0x2b')]({'plain':!![]});var _0x224a18='Lists';return db[_0xe61f('0x2c')][_0xe61f('0x2a')]({'where':{'type':_0x224a18,'resourceId':_0x4b15f9['id']}})[_0xe61f('0x29')](function(){return _0x33a19e;});})['then'](function(){_0x516793[_0xe61f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3081,_0x3d9a83){return function(_0x4348ab){if(!_0x4348ab){_0x1b3081[_0xe61f('0x2d')](0x194);}return _0x4348ab;};}function handleError(_0x2ace8e,_0x3edacf){_0x3edacf=_0x3edacf||0x1f4;return function(_0x1f9f80){logger[_0xe61f('0x2e')](_0x1f9f80['stack']);if(_0x1f9f80['name']){delete _0x1f9f80['name'];}_0x2ace8e['status'](_0x3edacf)[_0xe61f('0x2f')](_0x1f9f80);};}exports[_0xe61f('0x30')]=function(_0x498e02,_0x39cb7f){var _0x1638e1={},_0x1c8e4c={},_0x5d119b={'count':0x0,'rows':[]};var _0x11d6e4=_[_0xe61f('0x31')](db[_0xe61f('0x32')][_0xe61f('0x33')],function(_0x18a9ca){return{'name':_0x18a9ca[_0xe61f('0x34')],'type':_0x18a9ca[_0xe61f('0x35')]['key']};});_0x1c8e4c[_0xe61f('0x36')]=_[_0xe61f('0x31')](_0x11d6e4,'name');_0x1c8e4c[_0xe61f('0x37')]=_[_0xe61f('0x38')](_0x498e02[_0xe61f('0x37')]);_0x1c8e4c['filters']=_[_0xe61f('0x39')](_0x1c8e4c[_0xe61f('0x36')],_0x1c8e4c[_0xe61f('0x37')]);_0x1638e1[_0xe61f('0x3a')]=_['intersection'](_0x1c8e4c[_0xe61f('0x36')],qs[_0xe61f('0x3b')](_0x498e02[_0xe61f('0x37')][_0xe61f('0x3b')]));_0x1638e1[_0xe61f('0x3a')]=_0x1638e1[_0xe61f('0x3a')][_0xe61f('0x3c')]?_0x1638e1[_0xe61f('0x3a')]:_0x1c8e4c[_0xe61f('0x36')];if(!_0x498e02['query'][_0xe61f('0x3d')](_0xe61f('0x3e'))){_0x1638e1[_0xe61f('0x23')]=qs['limit'](_0x498e02[_0xe61f('0x37')][_0xe61f('0x23')]);_0x1638e1[_0xe61f('0x21')]=qs['offset'](_0x498e02[_0xe61f('0x37')][_0xe61f('0x21')]);}_0x1638e1[_0xe61f('0x3f')]=qs[_0xe61f('0x40')](_0x498e02[_0xe61f('0x37')]['sort']);_0x1638e1['where']=qs[_0xe61f('0x41')](_['pick'](_0x498e02[_0xe61f('0x37')],_0x1c8e4c[_0xe61f('0x41')]),_0x11d6e4);if(_0x498e02[_0xe61f('0x37')][_0xe61f('0x42')]){_0x1638e1[_0xe61f('0x43')]=_[_0xe61f('0x44')](_0x1638e1[_0xe61f('0x43')],{'$or':_[_0xe61f('0x31')](_0x11d6e4,function(_0x5ccfb4){if(_0x5ccfb4[_0xe61f('0x35')]!==_0xe61f('0x45')){var _0x20a234={};_0x20a234[_0x5ccfb4['name']]={'$like':'%'+_0x498e02[_0xe61f('0x37')]['filter']+'%'};return _0x20a234;}})});}_0x1638e1=_[_0xe61f('0x44')]({},_0x1638e1,_0x498e02[_0xe61f('0x46')]);var _0x29accc={'where':_0x1638e1[_0xe61f('0x43')]};return db[_0xe61f('0x32')][_0xe61f('0x24')](_0x29accc)[_0xe61f('0x29')](function(_0x86fd48){_0x5d119b[_0xe61f('0x24')]=_0x86fd48;if(_0x498e02['query'][_0xe61f('0x47')]){_0x1638e1[_0xe61f('0x48')]=[{'all':!![]}];}return db['CmList'][_0xe61f('0x49')](_0x1638e1);})['then'](function(_0x35f68a){_0x5d119b[_0xe61f('0x4a')]=_0x35f68a;return _0x5d119b;})[_0xe61f('0x29')](respondWithFilteredResult(_0x39cb7f,_0x1638e1))['catch'](handleError(_0x39cb7f,null));};exports['show']=function(_0x5b188b,_0x4f6462){var _0x2e9f2a={'raw':![],'where':{'id':_0x5b188b['params']['id']}},_0x3ee435={};_0x3ee435[_0xe61f('0x36')]=_[_0xe61f('0x38')](db[_0xe61f('0x32')][_0xe61f('0x33')]);_0x3ee435[_0xe61f('0x37')]=_[_0xe61f('0x38')](_0x5b188b[_0xe61f('0x37')]);_0x3ee435['filters']=_[_0xe61f('0x39')](_0x3ee435[_0xe61f('0x36')],_0x3ee435[_0xe61f('0x37')]);_0x2e9f2a['attributes']=_['intersection'](_0x3ee435['model'],qs[_0xe61f('0x3b')](_0x5b188b['query'][_0xe61f('0x3b')]));_0x2e9f2a[_0xe61f('0x3a')]=_0x2e9f2a[_0xe61f('0x3a')][_0xe61f('0x3c')]?_0x2e9f2a[_0xe61f('0x3a')]:_0x3ee435['model'];if(_0x5b188b[_0xe61f('0x37')][_0xe61f('0x47')]){_0x2e9f2a[_0xe61f('0x48')]=[{'all':!![]}];}_0x2e9f2a=_['merge']({},_0x2e9f2a,_0x5b188b[_0xe61f('0x46')]);return db[_0xe61f('0x32')][_0xe61f('0x4b')](_0x2e9f2a)[_0xe61f('0x29')](handleEntityNotFound(_0x4f6462,null))[_0xe61f('0x29')](respondWithResult(_0x4f6462,null))['catch'](handleError(_0x4f6462,null));};exports[_0xe61f('0x4c')]=function(_0x529fe3,_0x446a75){return db[_0xe61f('0x32')][_0xe61f('0x4c')](_0x529fe3[_0xe61f('0x4d')],{})[_0xe61f('0x29')](function(_0x197ae3){var _0x49cef7=_0x529fe3['user'][_0xe61f('0x2b')]({'plain':!![]});if(!_0x49cef7)throw new Error(_0xe61f('0x4e'));if(_0x49cef7['role']==='user'){var _0x1da054=_0x197ae3[_0xe61f('0x2b')]({'plain':!![]});var _0x4dc088=_0xe61f('0x4f');return db[_0xe61f('0x50')]['find']({'where':{'name':_0x4dc088,'userProfileId':_0x49cef7[_0xe61f('0x51')]},'raw':!![]})[_0xe61f('0x29')](function(_0x41c3d2){if(_0x41c3d2&&_0x41c3d2['autoAssociation']===0x0){return db[_0xe61f('0x2c')]['create']({'name':_0x1da054[_0xe61f('0x52')],'resourceId':_0x1da054['id'],'type':_0x41c3d2[_0xe61f('0x52')],'sectionId':_0x41c3d2['id']},{})[_0xe61f('0x29')](function(){return _0x197ae3;});}else{return _0x197ae3;}})[_0xe61f('0x53')](function(_0x3ce89a){logger[_0xe61f('0x2e')](_0xe61f('0x54'),_0x3ce89a);throw _0x3ce89a;});}return _0x197ae3;})['then'](respondWithResult(_0x446a75,0xc9))[_0xe61f('0x53')](handleError(_0x446a75,null));};exports['update']=function(_0x4c3722,_0x4a4a33){if(_0x4c3722['body']['id']){delete _0x4c3722[_0xe61f('0x4d')]['id'];}return db[_0xe61f('0x32')][_0xe61f('0x4b')]({'where':{'id':_0x4c3722['params']['id']}})['then'](handleEntityNotFound(_0x4a4a33,null))[_0xe61f('0x29')](saveUpdates(_0x4c3722[_0xe61f('0x4d')],null))[_0xe61f('0x29')](respondWithResult(_0x4a4a33,null))['catch'](handleError(_0x4a4a33,null));};exports[_0xe61f('0x2a')]=function(_0x509967,_0x38e566){return db[_0xe61f('0x32')][_0xe61f('0x4b')]({'where':{'id':_0x509967[_0xe61f('0x55')]['id']}})['then'](handleEntityNotFound(_0x38e566,null))[_0xe61f('0x29')](removeEntity(_0x38e566,null))[_0xe61f('0x53')](handleError(_0x38e566,null));};exports['describe']=function(_0x39babb,_0x4a53ab){return db[_0xe61f('0x32')]['describe']()[_0xe61f('0x29')](respondWithResult(_0x4a53ab,null))[_0xe61f('0x53')](handleError(_0x4a53ab,null));};exports[_0xe61f('0x56')]=function(_0x377541,_0x27ae7f,_0x436d1c){if(_0x377541[_0xe61f('0x4d')]['id']){delete _0x377541[_0xe61f('0x4d')]['id'];}return db[_0xe61f('0x32')]['find']({'where':{'id':_0x377541[_0xe61f('0x55')]['id']}})[_0xe61f('0x29')](handleEntityNotFound(_0x27ae7f,null))[_0xe61f('0x29')](function(_0x26ed15){if(_0x26ed15){_0x377541[_0xe61f('0x4d')][_0xe61f('0x57')]=_0x26ed15['id'];return db[_0xe61f('0x58')][_0xe61f('0x4c')](_0x377541[_0xe61f('0x4d')]);}})[_0xe61f('0x29')](respondWithResult(_0x27ae7f,null))['catch'](handleError(_0x27ae7f,null));};exports[_0xe61f('0x59')]=function(_0x434b50,_0x2ab832,_0x4620e0){var _0x229b0f={'raw':![],'where':{}};var _0x4c233e={};var _0x209c0f={'count':0x0,'rows':[]};return db[_0xe61f('0x32')][_0xe61f('0x5a')]({'where':{'id':_0x434b50[_0xe61f('0x55')]['id']}})[_0xe61f('0x29')](handleEntityNotFound(_0x2ab832,null))[_0xe61f('0x29')](function(_0x429512){if(_0x429512){_0x4c233e[_0xe61f('0x36')]=_['keys'](db[_0xe61f('0x58')]['rawAttributes']);_0x4c233e[_0xe61f('0x37')]=_['keys'](_0x434b50['query']);_0x4c233e[_0xe61f('0x41')]=_[_0xe61f('0x39')](_0x4c233e[_0xe61f('0x36')],_0x4c233e[_0xe61f('0x37')]);_0x229b0f[_0xe61f('0x3a')]=_['intersection'](_0x4c233e[_0xe61f('0x36')],qs[_0xe61f('0x3b')](_0x434b50[_0xe61f('0x37')][_0xe61f('0x3b')]));_0x229b0f[_0xe61f('0x3a')]=_0x229b0f[_0xe61f('0x3a')][_0xe61f('0x3c')]?_0x229b0f[_0xe61f('0x3a')]:_0x4c233e[_0xe61f('0x36')];if(!_0x434b50[_0xe61f('0x37')][_0xe61f('0x3d')](_0xe61f('0x3e'))){_0x229b0f[_0xe61f('0x23')]=qs[_0xe61f('0x23')](_0x434b50[_0xe61f('0x37')][_0xe61f('0x23')]);_0x229b0f[_0xe61f('0x21')]=qs[_0xe61f('0x21')](_0x434b50[_0xe61f('0x37')][_0xe61f('0x21')]);}_0x229b0f[_0xe61f('0x3f')]=qs[_0xe61f('0x40')](_0x434b50['query'][_0xe61f('0x40')]);_0x229b0f['where']=qs[_0xe61f('0x41')](_[_0xe61f('0x5b')](_0x434b50[_0xe61f('0x37')],_0x4c233e[_0xe61f('0x41')]));_0x229b0f['where']['ListId']=_0x429512['id'];if(_0x434b50[_0xe61f('0x37')][_0xe61f('0x42')]){_0x229b0f['where']=_[_0xe61f('0x44')](_0x229b0f['where'],{'$or':_[_0xe61f('0x31')](_0x229b0f[_0xe61f('0x3a')],function(_0x2e169a){var _0x25f9f9={};_0x25f9f9[_0x2e169a]={'$like':'%'+_0x434b50[_0xe61f('0x37')]['filter']+'%'};return _0x25f9f9;})});}_0x229b0f=_[_0xe61f('0x44')]({},_0x229b0f,_0x434b50[_0xe61f('0x46')]);return db[_0xe61f('0x58')][_0xe61f('0x24')]({'where':_0x229b0f[_0xe61f('0x43')]})['then'](function(_0x40f5f1){_0x209c0f['count']=_0x40f5f1;if(_0x434b50[_0xe61f('0x37')]['includeAll']){_0x229b0f[_0xe61f('0x48')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x229b0f);})[_0xe61f('0x29')](function(_0x5ba929){_0x209c0f['rows']=_0x5ba929;return _0x209c0f;});}})['then'](respondWithFilteredResult(_0x2ab832,_0x229b0f))['catch'](handleError(_0x2ab832,null));};exports[_0xe61f('0x5c')]=function(_0x5d6bce,_0x52dfe2,_0xa88f49){return db[_0xe61f('0x32')][_0xe61f('0x4b')]({'where':{'id':_0x5d6bce[_0xe61f('0x55')]['id']}})[_0xe61f('0x29')](handleEntityNotFound(_0x52dfe2,null))[_0xe61f('0x29')](function(_0x51875c){if(_0x51875c){return _0x51875c[_0xe61f('0x5c')](_0x5d6bce['query']['ids']);}})[_0xe61f('0x29')](respondWithStatusCode(_0x52dfe2,null))[_0xe61f('0x53')](handleError(_0x52dfe2,null));};exports['addContacts']=function(_0x4bc19f,_0x244a7e,_0x36a1f8){return db[_0xe61f('0x32')][_0xe61f('0x4b')]({'where':{'id':_0x4bc19f[_0xe61f('0x55')]['id']}})['then'](handleEntityNotFound(_0x244a7e,null))['then'](function(_0x517cff){if(_0x517cff){var _0x47d5fc=[];var _0x2a9844={'success':[],'errors':[]};return db[_0xe61f('0x5d')][_0xe61f('0x5e')]()[_0xe61f('0x29')](function(_0x23c030){if(_0x4bc19f['body'][_0xe61f('0x5f')]&&_[_0xe61f('0x60')](_0x4bc19f[_0xe61f('0x4d')][_0xe61f('0x5f')])){if(_0x4bc19f['body'][_0xe61f('0x5f')][_0xe61f('0x3c')]){_0x4bc19f[_0xe61f('0x4d')][_0xe61f('0x5f')]=_0x4bc19f[_0xe61f('0x4d')][_0xe61f('0x5f')]['join'](';')+';';}else{_0x4bc19f['body']['tags']=null;}}else{_0x4bc19f[_0xe61f('0x4d')]['tags']=null;}if(_0x4bc19f[_0xe61f('0x4d')]&&_[_0xe61f('0x60')](_0x4bc19f[_0xe61f('0x4d')])){for(var _0x9c75c9=0x0;_0x9c75c9<_0x4bc19f[_0xe61f('0x4d')][_0xe61f('0x3c')];_0x9c75c9+=0x1){_0x4bc19f[_0xe61f('0x4d')][_0x9c75c9][_0xe61f('0x57')]=_0x4bc19f['params']['id'];_0x47d5fc[_0xe61f('0x61')](_0x4bc19f[_0xe61f('0x4d')][_0x9c75c9]);}return BPromise[_0xe61f('0x62')](_0x47d5fc,function(_0x2d4181){return db[_0xe61f('0x5d')][_0xe61f('0x4c')](_[_0xe61f('0x63')](_0x2d4181,['ids','id'])||{},{'fields':_['keys'](_0x23c030),'raw':!![]})[_0xe61f('0x29')](function(_0x5e9799){_0x2a9844[_0xe61f('0x64')][_0xe61f('0x61')](_0x5e9799[_0xe61f('0x65')]);})[_0xe61f('0x53')](function(_0xfb683e){_0x2a9844[_0xe61f('0x66')][_0xe61f('0x61')]({'data':_0x2d4181,'error':_0xfb683e[_0xe61f('0x67')]});});})[_0xe61f('0x29')](function(_0x1e7c05){return _0x2a9844;})[_0xe61f('0x53')](function(_0x19b2cd){return _0x19b2cd;});}else{_0x244a7e[_0xe61f('0x1e')](0x190)[_0xe61f('0x20')]({'message':_0xe61f('0x68')});}});}})[_0xe61f('0x29')](respondWithResult(_0x244a7e,null))['catch'](handleError(_0x244a7e,null));};exports[_0xe61f('0x69')]=function(_0x56a248,_0x5340e7,_0x33e448){var _0x56fd6b;return db['CmList'][_0xe61f('0x4b')]({'where':{'id':_0x56a248[_0xe61f('0x55')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xe61f('0x6a')}]})[_0xe61f('0x29')](handleEntityNotFound(_0x5340e7,null))[_0xe61f('0x29')](function(_0x259b22){if(_0x259b22){_0x56fd6b=_0x259b22;return db[_0xe61f('0x5d')][_0xe61f('0x33')];}})[_0xe61f('0x29')](function(_0x46c3ca){if(_0x46c3ca){var _0x2653de={};var _0x29ea87={};_0x29ea87['model']=_[_0xe61f('0x6b')](_[_0xe61f('0x38')](_0x46c3ca),_[_0xe61f('0x31')](_0x56fd6b['CustomFields'],function(_0x4ae3ce){return util[_0xe61f('0x6c')]('cf_%d',_0x4ae3ce['id']);}));_0x29ea87[_0xe61f('0x37')]=_['keys'](_0x56a248[_0xe61f('0x37')]);_0x29ea87[_0xe61f('0x41')]=_[_0xe61f('0x39')](_0x29ea87['model'],_0x29ea87[_0xe61f('0x37')]);_0x2653de[_0xe61f('0x3a')]=_[_0xe61f('0x39')](_0x29ea87[_0xe61f('0x36')],qs[_0xe61f('0x3b')](_0x56a248[_0xe61f('0x37')]['fields']));_0x2653de[_0xe61f('0x3a')]=_0x2653de['attributes']['length']?_0x2653de[_0xe61f('0x3a')]:_0x29ea87[_0xe61f('0x36')];if(!_0x56a248['query'][_0xe61f('0x3d')]('nolimit')){_0x2653de[_0xe61f('0x23')]=qs[_0xe61f('0x23')](_0x56a248['query'][_0xe61f('0x23')]);_0x2653de['offset']=qs[_0xe61f('0x21')](_0x56a248['query'][_0xe61f('0x21')]);}_0x2653de[_0xe61f('0x3f')]=qs[_0xe61f('0x40')](_0x56a248['query'][_0xe61f('0x40')]);_0x2653de[_0xe61f('0x43')]=qs[_0xe61f('0x41')](_[_0xe61f('0x5b')](_0x56a248[_0xe61f('0x37')],_0x29ea87[_0xe61f('0x41')]));_0x2653de['raw']=!![];if(_0x56a248[_0xe61f('0x37')]['filter']){_0x2653de[_0xe61f('0x43')]=_[_0xe61f('0x44')](_0x2653de[_0xe61f('0x43')],{'$or':_[_0xe61f('0x31')](_0x2653de[_0xe61f('0x3a')],function(_0x13d4e4){var _0x2db212={};_0x2db212[_0x13d4e4]={'$like':'%'+_0x56a248[_0xe61f('0x37')][_0xe61f('0x42')]+'%'};return _0x2db212;})});}_0x2653de=_[_0xe61f('0x44')]({},_0x2653de,_0x56a248[_0xe61f('0x46')]);return _0x56fd6b['getContacts'](_0x2653de);}})[_0xe61f('0x29')](respondWithResult(_0x5340e7,null))[_0xe61f('0x53')](handleError(_0x5340e7,null));};exports['getContactsCsv']=function(_0x4c7b63,_0x4fa004,_0x5a5540){var _0x4f7d5c;var _0x3a6622;var _0x20440c;var _0x108a38=_0x4c7b63[_0xe61f('0x55')]['id'];csv_results=[];return db[_0xe61f('0x6d')][_0xe61f('0x49')]({'attributes':['id',_0xe61f('0x52')],'raw':!![],'order':[_0xe61f('0x6e')]})[_0xe61f('0x29')](function(_0xbe7b0c){_0x4f7d5c=_0xbe7b0c;var _0x19e763=_[_0xe61f('0x38')](db[_0xe61f('0x5d')][_0xe61f('0x33')]);return db[_0xe61f('0x6f')][_0xe61f('0x49')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x38c77a){_0x3a6622=_0x38c77a;var _0x326604=squel[_0xe61f('0x70')]()[_0xe61f('0x3b')](_0x19e763)[_0xe61f('0x71')]('cm_contacts','c')['where'](_0xe61f('0x72'),_0x108a38)['where'](_0xe61f('0x73'))[_0xe61f('0x74')]();for(var _0x3394a7=0x0;_0x3394a7<_0x3a6622[_0xe61f('0x3c')];_0x3394a7++){_0x326604['field']('c.cf_'+_0x3a6622[_0x3394a7]['id'],_0xe61f('0x75')+_0x3a6622[_0x3394a7][_0xe61f('0x76')]);}for(var _0x3394a7=0x0;_0x3394a7<_0x4f7d5c['length'];_0x3394a7++){_0x326604[_0xe61f('0x77')](squel['select']()[_0xe61f('0x77')](_0xe61f('0x78'))['from'](_0xe61f('0x79'))[_0xe61f('0x43')](_0xe61f('0x7a'),_0x4f7d5c[_0x3394a7]['id'])[_0xe61f('0x43')](_0xe61f('0x7b')),_0xe61f('0x7c')+_0x4f7d5c[_0x3394a7][_0xe61f('0x52')]);_0x326604[_0xe61f('0x77')](squel['select']()[_0xe61f('0x77')](_0xe61f('0x7d'))['from']('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x4f7d5c[_0x3394a7]['id'])[_0xe61f('0x43')](_0xe61f('0x7b')),_0xe61f('0x7e')+_0x4f7d5c[_0x3394a7]['name']);}var _0x38ab57=[];_0x38ab57['push'](_0x326604['toString']());BPromise[_0xe61f('0x62')](_0x38ab57,handleQuery)[_0xe61f('0x29')](function(_0x413d61){handleQuery(_0x326604[_0xe61f('0x7f')]());var _0x1cce42=csv_results[0x0];if(!_['isEmpty'](_0x1cce42)){var _0x3b0229=toCsv(_0x1cce42);var _0x2018dc=Date['now']();fs[_0xe61f('0x80')](util[_0xe61f('0x6c')](_0xe61f('0x81'),_0x108a38,_0x2018dc),_0x3b0229);_0x4fa004[_0xe61f('0x82')](_0xe61f('0x83'),_0xe61f('0x84')+util['format'](_0xe61f('0x85'),_0x108a38,_0x2018dc));_0x4fa004['setHeader'](_0xe61f('0x86'),_0xe61f('0x87'));return _0x4fa004[_0xe61f('0x88')](util[_0xe61f('0x6c')](_0xe61f('0x81'),_0x108a38,_0x2018dc));}else{return _0x4fa004[_0xe61f('0x2d')](0xcc);}});});});};exports[_0xe61f('0x89')]=function(_0x97d3ba,_0x2adff8,_0x4c093c){var _0x3c539f;delete _0x97d3ba[_0xe61f('0x4d')]['id'];return db[_0xe61f('0x32')][_0xe61f('0x5a')]({'where':{'id':_0x97d3ba['params']['id']}})['then'](handleEntityNotFound(_0x2adff8,null))[_0xe61f('0x29')](function(_0x19c629){if(_0x19c629){return db[_0xe61f('0x8a')][_0xe61f('0x8b')](function(_0x592f04){return db[_0xe61f('0x6f')]['create'](_0x97d3ba[_0xe61f('0x4d')],{'transaction':_0x592f04})[_0xe61f('0x29')](function(_0xea56e2){_0x3c539f=_0xea56e2;return _0x19c629[_0xe61f('0x8c')](_0xea56e2,{'transaction':_0x592f04});})[_0xe61f('0x29')](function(){var _0x4cd82b={'type':db[_0xe61f('0x8d')][_0xe61f('0x8e')],'transaction':_0x592f04};switch(_0x97d3ba[_0xe61f('0x4d')][_0xe61f('0x35')]){case _0xe61f('0x8f'):_0x4cd82b[_0xe61f('0x35')]=db['Sequelize'][_0xe61f('0x8e')];break;case _0xe61f('0x90'):_0x4cd82b['type']=db[_0xe61f('0x8d')]['INTEGER'];break;case _0xe61f('0x91'):_0x4cd82b[_0xe61f('0x35')]=db[_0xe61f('0x8d')][_0xe61f('0x92')];_0x4cd82b[_0xe61f('0x93')]=![];break;default:}return db[_0xe61f('0x8a')][_0xe61f('0x94')][_0xe61f('0x95')](_0xe61f('0x96'),util[_0xe61f('0x6c')](_0xe61f('0x97'),_0x3c539f['id']),_0x4cd82b);})[_0xe61f('0x29')](function(){return _0x3c539f;});});}})['then'](respondWithResult(_0x2adff8,null))[_0xe61f('0x53')](handleError(_0x2adff8,null));};exports[_0xe61f('0x98')]=function(_0x4b6334,_0x10ba28,_0x40b32d){var _0xd382d6={};var _0xcd3a29={};var _0x45c909;var _0x386ed2;return db[_0xe61f('0x32')][_0xe61f('0x5a')]({'where':{'id':_0x4b6334[_0xe61f('0x55')]['id']}})['then'](handleEntityNotFound(_0x10ba28,null))[_0xe61f('0x29')](function(_0x1da64e){if(_0x1da64e){_0x45c909=_0x1da64e;_0xcd3a29[_0xe61f('0x36')]=_['keys'](db[_0xe61f('0x6f')][_0xe61f('0x33')]);_0xcd3a29['query']=_[_0xe61f('0x38')](_0x4b6334[_0xe61f('0x37')]);_0xcd3a29[_0xe61f('0x41')]=_[_0xe61f('0x39')](_0xcd3a29['model'],_0xcd3a29[_0xe61f('0x37')]);_0xd382d6[_0xe61f('0x3a')]=_['intersection'](_0xcd3a29[_0xe61f('0x36')],qs[_0xe61f('0x3b')](_0x4b6334[_0xe61f('0x37')][_0xe61f('0x3b')]));_0xd382d6[_0xe61f('0x3a')]=_0xd382d6['attributes'][_0xe61f('0x3c')]?_0xd382d6[_0xe61f('0x3a')]:_0xcd3a29[_0xe61f('0x36')];_0xd382d6['order']=qs[_0xe61f('0x40')](_0x4b6334['query'][_0xe61f('0x40')]);_0xd382d6[_0xe61f('0x43')]=qs[_0xe61f('0x41')](_['pick'](_0x4b6334[_0xe61f('0x37')],_0xcd3a29[_0xe61f('0x41')]));_0xd382d6[_0xe61f('0x43')]=_[_0xe61f('0x44')](_0xd382d6[_0xe61f('0x43')],{'$or':[{'ListId':_0x1da64e['id']},{'ListId':null}]});if(_0x4b6334[_0xe61f('0x37')]['filter']){_0xd382d6[_0xe61f('0x43')]=_[_0xe61f('0x44')](_0xd382d6['where'],{'$or':_[_0xe61f('0x31')](_0xd382d6['attributes'],function(_0x42710e){var _0x19e3ca={};_0x19e3ca[_0x42710e]={'$like':'%'+_0x4b6334[_0xe61f('0x37')][_0xe61f('0x42')]+'%'};return _0x19e3ca;})});}_0xd382d6=_['merge']({},_0xd382d6,_0x4b6334['options']);return db[_0xe61f('0x6f')][_0xe61f('0x99')](_0xd382d6);}})[_0xe61f('0x29')](respondWithResult(_0x10ba28,null))[_0xe61f('0x53')](handleError(_0x10ba28,null));};exports['getGlobalCustomFields']=function(_0x11ec64,_0x403031){return db[_0xe61f('0x6f')][_0xe61f('0x99')]({'where':{'ListId':null}})[_0xe61f('0x29')](handleEntityNotFound(_0x403031,null))[_0xe61f('0x29')](function(_0x55c2d4){return _0x55c2d4;})['then'](respondWithResult(_0x403031,null))[_0xe61f('0x53')](handleError(_0x403031,null));};exports[_0xe61f('0x9a')]=function(_0xef12db,_0x3fb92f,_0x5e04e5){return db['CmList'][_0xe61f('0x4b')]({'where':{'id':_0xef12db[_0xe61f('0x55')]['id']}})[_0xe61f('0x29')](handleEntityNotFound(_0x3fb92f,null))[_0xe61f('0x29')](function(_0x17b3d0){if(_0x17b3d0){return _0x17b3d0['addAgents'](_0xef12db[_0xe61f('0x4d')][_0xe61f('0x9b')],_[_0xe61f('0x63')](_0xef12db[_0xe61f('0x4d')],['ids','id'])||{})[_0xe61f('0x9c')](function(_0x4a3976){for(var _0x3de0dd=0x0;_0x3de0dd<_0xef12db['body'][_0xe61f('0x9b')][_0xe61f('0x3c')];_0x3de0dd+=0x1){socket[_0xe61f('0x9d')]('userCmList:save',{'UserId':Number(_0xef12db[_0xe61f('0x4d')][_0xe61f('0x9b')][_0x3de0dd]),'CmListId':Number(_0xef12db[_0xe61f('0x55')]['id'])});}return _0x4a3976;});}})[_0xe61f('0x29')](respondWithResult(_0x3fb92f,null))['catch'](handleError(_0x3fb92f,null));};exports[_0xe61f('0x9e')]=function(_0xd81b7d,_0x23e02f,_0x45ebaa){return db[_0xe61f('0x32')][_0xe61f('0x4b')]({'where':{'id':_0xd81b7d[_0xe61f('0x55')]['id']}})[_0xe61f('0x29')](handleEntityNotFound(_0x23e02f,null))[_0xe61f('0x29')](function(_0xf5335c){if(_0xf5335c){return _0xf5335c[_0xe61f('0x9e')](_0xd81b7d[_0xe61f('0x37')]['ids'])[_0xe61f('0x29')](function(){if(_[_0xe61f('0x60')](_0xd81b7d[_0xe61f('0x37')]['ids'])){for(var _0x2b71b4=0x0;_0x2b71b4<_0xd81b7d['query'][_0xe61f('0x9b')]['length'];_0x2b71b4+=0x1){socket['emit'](_0xe61f('0x9f'),{'UserId':Number(_0xd81b7d[_0xe61f('0x37')][_0xe61f('0x9b')][_0x2b71b4]),'CmListId':Number(_0xd81b7d[_0xe61f('0x55')]['id'])});}}else{socket['emit'](_0xe61f('0x9f'),{'UserId':Number(_0xd81b7d['query'][_0xe61f('0x9b')]),'CmListId':Number(_0xd81b7d['params']['id'])});}});}})[_0xe61f('0x29')](respondWithStatusCode(_0x23e02f,null))[_0xe61f('0x53')](handleError(_0x23e02f,null));};exports[_0xe61f('0xa0')]=function(_0x58c0e0,_0x184e1d,_0x445e70){var _0x36d36a={};var _0x5d438d={};var _0x423d39;var _0xf05876;return db['CmList'][_0xe61f('0x5a')]({'where':{'id':_0x58c0e0[_0xe61f('0x55')]['id']}})[_0xe61f('0x29')](handleEntityNotFound(_0x184e1d,null))['then'](function(_0x2389b1){if(_0x2389b1){_0x423d39=_0x2389b1;_0x5d438d['model']=_[_0xe61f('0x38')](db[_0xe61f('0xa1')]['rawAttributes']);_0x5d438d['query']=_[_0xe61f('0x38')](_0x58c0e0[_0xe61f('0x37')]);_0x5d438d[_0xe61f('0x41')]=_['intersection'](_0x5d438d['model'],_0x5d438d[_0xe61f('0x37')]);_0x36d36a[_0xe61f('0x3a')]=_[_0xe61f('0x39')](_0x5d438d[_0xe61f('0x36')],qs['fields'](_0x58c0e0[_0xe61f('0x37')][_0xe61f('0x3b')]));_0x36d36a[_0xe61f('0x3a')]=_0x36d36a[_0xe61f('0x3a')][_0xe61f('0x3c')]?_0x36d36a[_0xe61f('0x3a')]:_0x5d438d[_0xe61f('0x36')];_0x36d36a[_0xe61f('0x3f')]=qs['sort'](_0x58c0e0[_0xe61f('0x37')][_0xe61f('0x40')]);_0x36d36a[_0xe61f('0x43')]=qs['filters'](_[_0xe61f('0x5b')](_0x58c0e0['query'],_0x5d438d[_0xe61f('0x41')]));if(_0x58c0e0[_0xe61f('0x37')][_0xe61f('0x42')]){_0x36d36a[_0xe61f('0x43')]=_[_0xe61f('0x44')](_0x36d36a['where'],{'$or':_[_0xe61f('0x31')](_0x36d36a[_0xe61f('0x3a')],function(_0x3dcb20){var _0x372442={};_0x372442[_0x3dcb20]={'$like':'%'+_0x58c0e0[_0xe61f('0x37')][_0xe61f('0x42')]+'%'};return _0x372442;})});}_0x36d36a=_[_0xe61f('0x44')]({},_0x36d36a,_0x58c0e0[_0xe61f('0x46')]);return _0x423d39[_0xe61f('0xa0')](_0x36d36a);}})[_0xe61f('0x29')](function(_0x34bf1d){if(_0x34bf1d){_0xf05876=_0x34bf1d[_0xe61f('0x3c')];if(!_0x58c0e0[_0xe61f('0x37')][_0xe61f('0x3d')](_0xe61f('0x3e'))){_0x36d36a['limit']=qs[_0xe61f('0x23')](_0x58c0e0[_0xe61f('0x37')]['limit']);_0x36d36a[_0xe61f('0x21')]=qs[_0xe61f('0x21')](_0x58c0e0[_0xe61f('0x37')][_0xe61f('0x21')]);}return _0x423d39[_0xe61f('0xa0')](_0x36d36a);}})[_0xe61f('0x29')](function(_0x4a2518){if(_0x4a2518){return _0x4a2518?{'count':_0xf05876,'rows':_0x4a2518}:null;}})['then'](respondWithResult(_0x184e1d,null))['catch'](handleError(_0x184e1d,null));};function handleQuery(_0x49e98b){logger[_0xe61f('0xa2')](_0x49e98b);return db[_0xe61f('0x8a')][_0xe61f('0x37')](_0x49e98b)[_0xe61f('0x9c')](function(_0x5a80f7){csv_results[_0xe61f('0x61')](_0x5a80f7);})[_0xe61f('0x53')](function(_0x29d1c9){logger[_0xe61f('0x2e')](_0x29d1c9[_0xe61f('0x67')]);});} \ No newline at end of file +var _0xbeca=['raw','filter','getContactsCsv','OrderBy','findAll','alias','select','c.ListId\x20=\x20?','distinct','c.cf_','field','item','from','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','addCustomField','findOne','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','CmList','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','omit','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','pick'];(function(_0x3a0624,_0x19627f){var _0x4c5059=function(_0x534b44){while(--_0x534b44){_0x3a0624['push'](_0x3a0624['shift']());}};_0x4c5059(++_0x19627f);}(_0xbeca,0xdf));var _0xabec=function(_0x2d2b63,_0x277d0a){_0x2d2b63=_0x2d2b63-0x0;var _0x5d18f8=_0xbeca[_0x2d2b63];return _0x5d18f8;};'use strict';var emlformat=require(_0xabec('0x0'));var rimraf=require(_0xabec('0x1'));var zipdir=require(_0xabec('0x2'));var jsonpatch=require(_0xabec('0x3'));var rp=require(_0xabec('0x4'));var moment=require(_0xabec('0x5'));var BPromise=require(_0xabec('0x6'));var Mustache=require(_0xabec('0x7'));var util=require(_0xabec('0x8'));var path=require(_0xabec('0x9'));var sox=require(_0xabec('0xa'));var csv=require(_0xabec('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabec('0xc'));var squel=require(_0xabec('0xd'));var crypto=require(_0xabec('0xe'));var jsforce=require(_0xabec('0xf'));var deskjs=require(_0xabec('0x10'));var toCsv=require(_0xabec('0xb'));var querystring=require(_0xabec('0x11'));var Papa=require(_0xabec('0x12'));var Redis=require(_0xabec('0x13'));var authService=require(_0xabec('0x14'));var qs=require(_0xabec('0x15'));var as=require(_0xabec('0x16'));var hardwareService=require(_0xabec('0x17'));var logger=require(_0xabec('0x18'))('api');var utils=require(_0xabec('0x19'));var config=require(_0xabec('0x1a'));var licenseUtil=require(_0xabec('0x1b'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0xabec('0x1c')](config[_0xabec('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xabec('0x1e'))(new Redis(config['redis']));require(_0xabec('0x1f'))[_0xabec('0x20')](socket);function respondWithStatusCode(_0x1282e1,_0x221b9e){_0x221b9e=_0x221b9e||0xcc;return function(_0x4464eb){if(_0x4464eb){return _0x1282e1[_0xabec('0x21')](_0x221b9e);}return _0x1282e1['status'](_0x221b9e)[_0xabec('0x22')]();};}function respondWithResult(_0x22c7d8,_0x3a40de){_0x3a40de=_0x3a40de||0xc8;return function(_0x19de60){if(_0x19de60){return _0x22c7d8[_0xabec('0x23')](_0x3a40de)[_0xabec('0x24')](_0x19de60);}};}function respondWithFilteredResult(_0x35818c,_0x22625c){return function(_0x2f2dd3){if(_0x2f2dd3){var _0x520e9f=typeof _0x22625c['offset']===_0xabec('0x25')&&typeof _0x22625c[_0xabec('0x26')]===_0xabec('0x25');var _0x462c77=_0x2f2dd3[_0xabec('0x27')];var _0x37ba08=_0x520e9f?0x0:_0x22625c[_0xabec('0x28')];var _0x3dcd7f=_0x520e9f?_0x2f2dd3[_0xabec('0x27')]:_0x22625c[_0xabec('0x28')]+_0x22625c['limit'];var _0x2e95c8;if(_0x3dcd7f>=_0x462c77){_0x3dcd7f=_0x462c77;_0x2e95c8=0xc8;}else{_0x2e95c8=0xce;}_0x35818c[_0xabec('0x23')](_0x2e95c8);return _0x35818c['set']('Content-Range',_0x37ba08+'-'+_0x3dcd7f+'/'+_0x462c77)['json'](_0x2f2dd3);}return null;};}function patchUpdates(_0x4c23dd){return function(_0x2dfe40){try{jsonpatch[_0xabec('0x29')](_0x2dfe40,_0x4c23dd,!![]);}catch(_0x20c830){return BPromise[_0xabec('0x2a')](_0x20c830);}return _0x2dfe40[_0xabec('0x2b')]();};}function saveUpdates(_0x123f73,_0x557cda){return function(_0x27df94){if(_0x27df94){return _0x27df94[_0xabec('0x2c')](_0x123f73)[_0xabec('0x2d')](function(_0x4009e9){return _0x4009e9;});}return null;};}function removeEntity(_0x5e3af8,_0x550a5a){return function(_0x92c249){if(_0x92c249){return _0x92c249[_0xabec('0x2e')]()['then'](function(){var _0x5d71fe=_0x92c249[_0xabec('0x2f')]({'plain':!![]});var _0x592fc1='Lists';return db['UserProfileResource'][_0xabec('0x2e')]({'where':{'type':_0x592fc1,'resourceId':_0x5d71fe['id']}})[_0xabec('0x2d')](function(){return _0x92c249;});})[_0xabec('0x2d')](function(){_0x5e3af8[_0xabec('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc19a44,_0x399ea3){return function(_0x3241b3){if(!_0x3241b3){_0xc19a44['sendStatus'](0x194);}return _0x3241b3;};}function handleError(_0x5de90f,_0xaae303){_0xaae303=_0xaae303||0x1f4;return function(_0x36bcd0){logger[_0xabec('0x30')](_0x36bcd0[_0xabec('0x31')]);if(_0x36bcd0[_0xabec('0x32')]){delete _0x36bcd0[_0xabec('0x32')];}_0x5de90f[_0xabec('0x23')](_0xaae303)[_0xabec('0x33')](_0x36bcd0);};}exports[_0xabec('0x34')]=function(_0x4d0fb3,_0x54de6e){var _0x478de0={},_0xea395c={},_0x312f1e={'count':0x0,'rows':[]};var _0x3b5f7e=_[_0xabec('0x35')](db[_0xabec('0x36')]['rawAttributes'],function(_0x1be458){return{'name':_0x1be458[_0xabec('0x37')],'type':_0x1be458[_0xabec('0x38')][_0xabec('0x39')]};});_0xea395c[_0xabec('0x3a')]=_[_0xabec('0x35')](_0x3b5f7e,_0xabec('0x32'));_0xea395c[_0xabec('0x3b')]=_['keys'](_0x4d0fb3[_0xabec('0x3b')]);_0xea395c[_0xabec('0x3c')]=_['intersection'](_0xea395c[_0xabec('0x3a')],_0xea395c[_0xabec('0x3b')]);_0x478de0[_0xabec('0x3d')]=_['intersection'](_0xea395c[_0xabec('0x3a')],qs[_0xabec('0x3e')](_0x4d0fb3['query'][_0xabec('0x3e')]));_0x478de0[_0xabec('0x3d')]=_0x478de0['attributes'][_0xabec('0x3f')]?_0x478de0[_0xabec('0x3d')]:_0xea395c[_0xabec('0x3a')];if(!_0x4d0fb3['query'][_0xabec('0x40')](_0xabec('0x41'))){_0x478de0[_0xabec('0x26')]=qs[_0xabec('0x26')](_0x4d0fb3[_0xabec('0x3b')][_0xabec('0x26')]);_0x478de0[_0xabec('0x28')]=qs[_0xabec('0x28')](_0x4d0fb3[_0xabec('0x3b')]['offset']);}_0x478de0[_0xabec('0x42')]=qs[_0xabec('0x43')](_0x4d0fb3[_0xabec('0x3b')]['sort']);_0x478de0[_0xabec('0x44')]=qs[_0xabec('0x3c')](_['pick'](_0x4d0fb3[_0xabec('0x3b')],_0xea395c['filters']),_0x3b5f7e);if(_0x4d0fb3[_0xabec('0x3b')]['filter']){_0x478de0[_0xabec('0x44')]=_['merge'](_0x478de0[_0xabec('0x44')],{'$or':_[_0xabec('0x35')](_0x3b5f7e,function(_0x124b11){if(_0x124b11[_0xabec('0x38')]!==_0xabec('0x45')){var _0x43d2d5={};_0x43d2d5[_0x124b11[_0xabec('0x32')]]={'$like':'%'+_0x4d0fb3[_0xabec('0x3b')]['filter']+'%'};return _0x43d2d5;}})});}_0x478de0=_[_0xabec('0x46')]({},_0x478de0,_0x4d0fb3[_0xabec('0x47')]);var _0x3235be={'where':_0x478de0['where']};return db[_0xabec('0x36')][_0xabec('0x27')](_0x3235be)['then'](function(_0x1e68ae){_0x312f1e[_0xabec('0x27')]=_0x1e68ae;if(_0x4d0fb3[_0xabec('0x3b')][_0xabec('0x48')]){_0x478de0[_0xabec('0x49')]=[{'all':!![]}];}return db[_0xabec('0x36')]['findAll'](_0x478de0);})[_0xabec('0x2d')](function(_0x46365d){_0x312f1e[_0xabec('0x4a')]=_0x46365d;return _0x312f1e;})[_0xabec('0x2d')](respondWithFilteredResult(_0x54de6e,_0x478de0))['catch'](handleError(_0x54de6e,null));};exports[_0xabec('0x4b')]=function(_0x5e49ce,_0x4d06ee){var _0x5530e3={'raw':![],'where':{'id':_0x5e49ce[_0xabec('0x4c')]['id']}},_0x31c95a={};_0x31c95a[_0xabec('0x3a')]=_[_0xabec('0x4d')](db['CmList'][_0xabec('0x4e')]);_0x31c95a[_0xabec('0x3b')]=_[_0xabec('0x4d')](_0x5e49ce[_0xabec('0x3b')]);_0x31c95a[_0xabec('0x3c')]=_[_0xabec('0x4f')](_0x31c95a[_0xabec('0x3a')],_0x31c95a[_0xabec('0x3b')]);_0x5530e3['attributes']=_[_0xabec('0x4f')](_0x31c95a[_0xabec('0x3a')],qs[_0xabec('0x3e')](_0x5e49ce[_0xabec('0x3b')][_0xabec('0x3e')]));_0x5530e3[_0xabec('0x3d')]=_0x5530e3[_0xabec('0x3d')][_0xabec('0x3f')]?_0x5530e3['attributes']:_0x31c95a[_0xabec('0x3a')];if(_0x5e49ce[_0xabec('0x3b')][_0xabec('0x48')]){_0x5530e3[_0xabec('0x49')]=[{'all':!![]}];}_0x5530e3=_[_0xabec('0x46')]({},_0x5530e3,_0x5e49ce[_0xabec('0x47')]);return db[_0xabec('0x36')][_0xabec('0x50')](_0x5530e3)[_0xabec('0x2d')](handleEntityNotFound(_0x4d06ee,null))['then'](respondWithResult(_0x4d06ee,null))['catch'](handleError(_0x4d06ee,null));};exports[_0xabec('0x51')]=function(_0x374a75,_0x1adedf){return db[_0xabec('0x36')]['create'](_0x374a75[_0xabec('0x52')],{})[_0xabec('0x2d')](function(_0x91f8f9){var _0x1a9ddb=_0x374a75[_0xabec('0x53')][_0xabec('0x2f')]({'plain':!![]});if(!_0x1a9ddb)throw new Error(_0xabec('0x54'));if(_0x1a9ddb['role']===_0xabec('0x53')){var _0x141ff6=_0x91f8f9[_0xabec('0x2f')]({'plain':!![]});var _0x7be2b7=_0xabec('0x55');return db['UserProfileSection'][_0xabec('0x50')]({'where':{'name':_0x7be2b7,'userProfileId':_0x1a9ddb[_0xabec('0x56')]},'raw':!![]})['then'](function(_0x242eb7){if(_0x242eb7&&_0x242eb7['autoAssociation']===0x0){return db[_0xabec('0x57')][_0xabec('0x51')]({'name':_0x141ff6[_0xabec('0x32')],'resourceId':_0x141ff6['id'],'type':_0x242eb7[_0xabec('0x32')],'sectionId':_0x242eb7['id']},{})[_0xabec('0x2d')](function(){return _0x91f8f9;});}else{return _0x91f8f9;}})[_0xabec('0x58')](function(_0x58eeab){logger[_0xabec('0x30')](_0xabec('0x59'),_0x58eeab);throw _0x58eeab;});}return _0x91f8f9;})[_0xabec('0x2d')](respondWithResult(_0x1adedf,0xc9))[_0xabec('0x58')](handleError(_0x1adedf,null));};exports[_0xabec('0x2c')]=function(_0x41daf5,_0x36c4d2){if(_0x41daf5['body']['id']){delete _0x41daf5[_0xabec('0x52')]['id'];}return db[_0xabec('0x36')][_0xabec('0x50')]({'where':{'id':_0x41daf5['params']['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x36c4d2,null))[_0xabec('0x2d')](saveUpdates(_0x41daf5[_0xabec('0x52')],null))[_0xabec('0x2d')](respondWithResult(_0x36c4d2,null))['catch'](handleError(_0x36c4d2,null));};exports[_0xabec('0x2e')]=function(_0x32a8ce,_0x3d57b3){return db['CmList'][_0xabec('0x50')]({'where':{'id':_0x32a8ce[_0xabec('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d57b3,null))[_0xabec('0x2d')](removeEntity(_0x3d57b3,null))['catch'](handleError(_0x3d57b3,null));};exports[_0xabec('0x5a')]=function(_0x348c82,_0x4746bf){return db[_0xabec('0x36')][_0xabec('0x5a')]()[_0xabec('0x2d')](respondWithResult(_0x4746bf,null))[_0xabec('0x58')](handleError(_0x4746bf,null));};exports[_0xabec('0x5b')]=function(_0x19197f,_0x3f86a0,_0x53e7f2){if(_0x19197f[_0xabec('0x52')]['id']){delete _0x19197f[_0xabec('0x52')]['id'];}return db[_0xabec('0x36')][_0xabec('0x50')]({'where':{'id':_0x19197f[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x3f86a0,null))[_0xabec('0x2d')](function(_0x4a5dc2){if(_0x4a5dc2){_0x19197f[_0xabec('0x52')][_0xabec('0x5c')]=_0x4a5dc2['id'];return db[_0xabec('0x5d')][_0xabec('0x51')](_0x19197f[_0xabec('0x52')]);}})[_0xabec('0x2d')](respondWithResult(_0x3f86a0,null))[_0xabec('0x58')](handleError(_0x3f86a0,null));};exports[_0xabec('0x5e')]=function(_0x33fdd8,_0x21f219,_0x69a11c){var _0x1ba570={'raw':![],'where':{}};var _0x7c94fb={};var _0x4e8c9b={'count':0x0,'rows':[]};return db[_0xabec('0x36')]['findOne']({'where':{'id':_0x33fdd8[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x21f219,null))[_0xabec('0x2d')](function(_0x2cc265){if(_0x2cc265){_0x7c94fb[_0xabec('0x3a')]=_[_0xabec('0x4d')](db[_0xabec('0x5d')][_0xabec('0x4e')]);_0x7c94fb['query']=_[_0xabec('0x4d')](_0x33fdd8['query']);_0x7c94fb['filters']=_[_0xabec('0x4f')](_0x7c94fb['model'],_0x7c94fb[_0xabec('0x3b')]);_0x1ba570[_0xabec('0x3d')]=_[_0xabec('0x4f')](_0x7c94fb['model'],qs[_0xabec('0x3e')](_0x33fdd8[_0xabec('0x3b')][_0xabec('0x3e')]));_0x1ba570[_0xabec('0x3d')]=_0x1ba570[_0xabec('0x3d')][_0xabec('0x3f')]?_0x1ba570[_0xabec('0x3d')]:_0x7c94fb['model'];if(!_0x33fdd8[_0xabec('0x3b')][_0xabec('0x40')](_0xabec('0x41'))){_0x1ba570['limit']=qs[_0xabec('0x26')](_0x33fdd8[_0xabec('0x3b')]['limit']);_0x1ba570[_0xabec('0x28')]=qs[_0xabec('0x28')](_0x33fdd8['query'][_0xabec('0x28')]);}_0x1ba570['order']=qs['sort'](_0x33fdd8['query'][_0xabec('0x43')]);_0x1ba570['where']=qs[_0xabec('0x3c')](_['pick'](_0x33fdd8[_0xabec('0x3b')],_0x7c94fb['filters']));_0x1ba570[_0xabec('0x44')][_0xabec('0x5c')]=_0x2cc265['id'];if(_0x33fdd8[_0xabec('0x3b')]['filter']){_0x1ba570[_0xabec('0x44')]=_[_0xabec('0x46')](_0x1ba570[_0xabec('0x44')],{'$or':_[_0xabec('0x35')](_0x1ba570[_0xabec('0x3d')],function(_0x1a0497){var _0xe78498={};_0xe78498[_0x1a0497]={'$like':'%'+_0x33fdd8[_0xabec('0x3b')]['filter']+'%'};return _0xe78498;})});}_0x1ba570=_[_0xabec('0x46')]({},_0x1ba570,_0x33fdd8[_0xabec('0x47')]);return db['Disposition']['count']({'where':_0x1ba570['where']})[_0xabec('0x2d')](function(_0x49e62e){_0x4e8c9b['count']=_0x49e62e;if(_0x33fdd8[_0xabec('0x3b')][_0xabec('0x48')]){_0x1ba570[_0xabec('0x49')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1ba570);})[_0xabec('0x2d')](function(_0x53b2a0){_0x4e8c9b[_0xabec('0x4a')]=_0x53b2a0;return _0x4e8c9b;});}})[_0xabec('0x2d')](respondWithFilteredResult(_0x21f219,_0x1ba570))[_0xabec('0x58')](handleError(_0x21f219,null));};exports[_0xabec('0x5f')]=function(_0x1f86dd,_0x5019e4,_0x345c88){return db['CmList']['find']({'where':{'id':_0x1f86dd[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x5019e4,null))[_0xabec('0x2d')](function(_0x3f15fc){if(_0x3f15fc){return _0x3f15fc['removeDispositions'](_0x1f86dd[_0xabec('0x3b')][_0xabec('0x60')]);}})[_0xabec('0x2d')](respondWithStatusCode(_0x5019e4,null))['catch'](handleError(_0x5019e4,null));};exports[_0xabec('0x61')]=function(_0x3ab833,_0x156599,_0x4daa02){return db[_0xabec('0x36')][_0xabec('0x50')]({'where':{'id':_0x3ab833[_0xabec('0x4c')]['id']}})['then'](handleEntityNotFound(_0x156599,null))[_0xabec('0x2d')](function(_0x15da80){if(_0x15da80){var _0x183e62=[];var _0x220365={'success':[],'errors':[]};return db[_0xabec('0x62')]['describe']()['then'](function(_0x36706f){if(_0x3ab833[_0xabec('0x52')][_0xabec('0x63')]&&_[_0xabec('0x64')](_0x3ab833['body'][_0xabec('0x63')])){if(_0x3ab833[_0xabec('0x52')][_0xabec('0x63')][_0xabec('0x3f')]){_0x3ab833[_0xabec('0x52')]['tags']=_0x3ab833[_0xabec('0x52')]['tags']['join'](';')+';';}else{_0x3ab833['body'][_0xabec('0x63')]=null;}}else{_0x3ab833[_0xabec('0x52')]['tags']=null;}if(_0x3ab833[_0xabec('0x52')]&&_[_0xabec('0x64')](_0x3ab833[_0xabec('0x52')])){for(var _0x5ac0bb=0x0;_0x5ac0bb<_0x3ab833['body'][_0xabec('0x3f')];_0x5ac0bb+=0x1){_0x3ab833[_0xabec('0x52')][_0x5ac0bb][_0xabec('0x5c')]=_0x3ab833['params']['id'];_0x183e62[_0xabec('0x65')](_0x3ab833[_0xabec('0x52')][_0x5ac0bb]);}return BPromise['each'](_0x183e62,function(_0x50d1ff){return db['CmContact'][_0xabec('0x51')](_[_0xabec('0x66')](_0x50d1ff,['ids','id'])||{},{'fields':_[_0xabec('0x4d')](_0x36706f),'raw':!![]})[_0xabec('0x2d')](function(_0x1b1e9c){_0x220365['success']['push'](_0x1b1e9c[_0xabec('0x67')]);})[_0xabec('0x58')](function(_0x2c6869){_0x220365['errors'][_0xabec('0x65')]({'data':_0x50d1ff,'error':_0x2c6869[_0xabec('0x68')]});});})[_0xabec('0x2d')](function(_0x3a5ae8){return _0x220365;})[_0xabec('0x58')](function(_0x25820e){return _0x25820e;});}else{_0x156599[_0xabec('0x23')](0x190)[_0xabec('0x24')]({'message':_0xabec('0x69')});}});}})['then'](respondWithResult(_0x156599,null))[_0xabec('0x58')](handleError(_0x156599,null));};exports[_0xabec('0x6a')]=function(_0x19e31d,_0x12f00d,_0x23712c){var _0xb144ce;return db[_0xabec('0x36')][_0xabec('0x50')]({'where':{'id':_0x19e31d[_0xabec('0x4c')]['id']},'include':[{'model':db[_0xabec('0x6b')],'as':_0xabec('0x6c')}]})[_0xabec('0x2d')](handleEntityNotFound(_0x12f00d,null))[_0xabec('0x2d')](function(_0x4a2874){if(_0x4a2874){_0xb144ce=_0x4a2874;return db[_0xabec('0x62')]['rawAttributes'];}})['then'](function(_0x5448a6){if(_0x5448a6){var _0x39c7d2={};var _0x144da5={};_0x144da5[_0xabec('0x3a')]=_[_0xabec('0x6d')](_[_0xabec('0x4d')](_0x5448a6),_[_0xabec('0x35')](_0xb144ce['CustomFields'],function(_0x174bdc){return util[_0xabec('0x6e')](_0xabec('0x6f'),_0x174bdc['id']);}));_0x144da5[_0xabec('0x3b')]=_[_0xabec('0x4d')](_0x19e31d[_0xabec('0x3b')]);_0x144da5[_0xabec('0x3c')]=_['intersection'](_0x144da5[_0xabec('0x3a')],_0x144da5[_0xabec('0x3b')]);_0x39c7d2[_0xabec('0x3d')]=_[_0xabec('0x4f')](_0x144da5[_0xabec('0x3a')],qs[_0xabec('0x3e')](_0x19e31d['query'][_0xabec('0x3e')]));_0x39c7d2[_0xabec('0x3d')]=_0x39c7d2['attributes'][_0xabec('0x3f')]?_0x39c7d2['attributes']:_0x144da5[_0xabec('0x3a')];if(!_0x19e31d[_0xabec('0x3b')][_0xabec('0x40')]('nolimit')){_0x39c7d2['limit']=qs[_0xabec('0x26')](_0x19e31d['query'][_0xabec('0x26')]);_0x39c7d2[_0xabec('0x28')]=qs[_0xabec('0x28')](_0x19e31d[_0xabec('0x3b')]['offset']);}_0x39c7d2[_0xabec('0x42')]=qs[_0xabec('0x43')](_0x19e31d['query'][_0xabec('0x43')]);_0x39c7d2['where']=qs[_0xabec('0x3c')](_[_0xabec('0x70')](_0x19e31d[_0xabec('0x3b')],_0x144da5[_0xabec('0x3c')]));_0x39c7d2[_0xabec('0x71')]=!![];if(_0x19e31d[_0xabec('0x3b')][_0xabec('0x72')]){_0x39c7d2[_0xabec('0x44')]=_['merge'](_0x39c7d2[_0xabec('0x44')],{'$or':_[_0xabec('0x35')](_0x39c7d2[_0xabec('0x3d')],function(_0x11b76f){var _0x386803={};_0x386803[_0x11b76f]={'$like':'%'+_0x19e31d[_0xabec('0x3b')]['filter']+'%'};return _0x386803;})});}_0x39c7d2=_[_0xabec('0x46')]({},_0x39c7d2,_0x19e31d[_0xabec('0x47')]);return _0xb144ce[_0xabec('0x6a')](_0x39c7d2);}})[_0xabec('0x2d')](respondWithResult(_0x12f00d,null))['catch'](handleError(_0x12f00d,null));};exports[_0xabec('0x73')]=function(_0x48f329,_0xd0f6ef,_0x4faa57){var _0x4940e3;var _0x186cbb;var _0x8e4854;var _0x4d4abd=_0x48f329[_0xabec('0x4c')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0xabec('0x32')],'raw':!![],'order':[_0xabec('0x74')]})['then'](function(_0x280f70){_0x4940e3=_0x280f70;var _0x262335=_[_0xabec('0x4d')](db['CmContact'][_0xabec('0x4e')]);return db[_0xabec('0x6b')][_0xabec('0x75')]({'raw':!![],'attributes':['id',_0xabec('0x76')]})['then'](function(_0x1a37ba){_0x186cbb=_0x1a37ba;var _0x2ddd67=squel[_0xabec('0x77')]()['fields'](_0x262335)['from']('cm_contacts','c')['where'](_0xabec('0x78'),_0x4d4abd)[_0xabec('0x44')]('c.deletedAt\x20is\x20null')[_0xabec('0x79')]();for(var _0x1ec851=0x0;_0x1ec851<_0x186cbb[_0xabec('0x3f')];_0x1ec851++){_0x2ddd67['field'](_0xabec('0x7a')+_0x186cbb[_0x1ec851]['id'],'customField_'+_0x186cbb[_0x1ec851][_0xabec('0x76')]);}for(var _0x1ec851=0x0;_0x1ec851<_0x4940e3[_0xabec('0x3f')];_0x1ec851++){_0x2ddd67['field'](squel[_0xabec('0x77')]()[_0xabec('0x7b')](_0xabec('0x7c'))[_0xabec('0x7d')]('cm_contact_has_items')[_0xabec('0x44')](_0xabec('0x7e'),_0x4940e3[_0x1ec851]['id'])[_0xabec('0x44')](_0xabec('0x7f')),_0xabec('0x80')+_0x4940e3[_0x1ec851][_0xabec('0x32')]);_0x2ddd67['field'](squel['select']()[_0xabec('0x7b')](_0xabec('0x81'))[_0xabec('0x7d')](_0xabec('0x82'))[_0xabec('0x44')](_0xabec('0x7e'),_0x4940e3[_0x1ec851]['id'])[_0xabec('0x44')](_0xabec('0x7f')),_0xabec('0x83')+_0x4940e3[_0x1ec851][_0xabec('0x32')]);}var _0x4e11d6=[];_0x4e11d6[_0xabec('0x65')](_0x2ddd67[_0xabec('0x84')]());BPromise['each'](_0x4e11d6,handleQuery)[_0xabec('0x2d')](function(_0x401034){handleQuery(_0x2ddd67[_0xabec('0x84')]());var _0x155cb5=csv_results[0x0];if(!_[_0xabec('0x85')](_0x155cb5)){var _0x4dbced=toCsv(_0x155cb5);var _0x2947b5=Date[_0xabec('0x86')]();fs[_0xabec('0x87')](util[_0xabec('0x6e')]('/tmp/list_%d_%s.csv',_0x4d4abd,_0x2947b5),_0x4dbced);_0xd0f6ef[_0xabec('0x88')](_0xabec('0x89'),_0xabec('0x8a')+util[_0xabec('0x6e')](_0xabec('0x8b'),_0x4d4abd,_0x2947b5));_0xd0f6ef['setHeader']('Content-type','text/csv');return _0xd0f6ef[_0xabec('0x8c')](util[_0xabec('0x6e')]('/tmp/list_%d_%s.csv',_0x4d4abd,_0x2947b5));}else{return _0xd0f6ef[_0xabec('0x21')](0xcc);}});});});};exports[_0xabec('0x8d')]=function(_0x1c962b,_0x3b2603,_0x107287){var _0x847e9e;delete _0x1c962b[_0xabec('0x52')]['id'];return db[_0xabec('0x36')][_0xabec('0x8e')]({'where':{'id':_0x1c962b[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x3b2603,null))[_0xabec('0x2d')](function(_0xefb102){if(_0xefb102){return db['sequelize'][_0xabec('0x8f')](function(_0x5b10ca){return db[_0xabec('0x6b')][_0xabec('0x51')](_0x1c962b[_0xabec('0x52')],{'transaction':_0x5b10ca})[_0xabec('0x2d')](function(_0x1fa0b6){_0x847e9e=_0x1fa0b6;return _0xefb102[_0xabec('0x90')](_0x1fa0b6,{'transaction':_0x5b10ca});})[_0xabec('0x2d')](function(){var _0x2197bd={'type':db[_0xabec('0x91')][_0xabec('0x92')],'transaction':_0x5b10ca};switch(_0x1c962b['body']['type']){case _0xabec('0x93'):_0x2197bd[_0xabec('0x38')]=db['Sequelize'][_0xabec('0x92')];break;case _0xabec('0x94'):_0x2197bd[_0xabec('0x38')]=db[_0xabec('0x91')][_0xabec('0x95')];break;case _0xabec('0x96'):_0x2197bd[_0xabec('0x38')]=db[_0xabec('0x91')][_0xabec('0x97')];_0x2197bd[_0xabec('0x98')]=![];break;default:}return db[_0xabec('0x99')][_0xabec('0x9a')]['addColumn'](_0xabec('0x9b'),util[_0xabec('0x6e')](_0xabec('0x9c'),_0x847e9e['id']),_0x2197bd);})[_0xabec('0x2d')](function(){return _0x847e9e;});});}})[_0xabec('0x2d')](respondWithResult(_0x3b2603,null))[_0xabec('0x58')](handleError(_0x3b2603,null));};exports[_0xabec('0x9d')]=function(_0x360f4e,_0x201f59,_0x55aa4a){var _0xeaf929={};var _0x3ca9ca={};var _0x4057ec;var _0x499eec;return db[_0xabec('0x36')][_0xabec('0x8e')]({'where':{'id':_0x360f4e[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x201f59,null))[_0xabec('0x2d')](function(_0x2c547b){if(_0x2c547b){_0x4057ec=_0x2c547b;_0x3ca9ca[_0xabec('0x3a')]=_[_0xabec('0x4d')](db['CmCustomField'][_0xabec('0x4e')]);_0x3ca9ca['query']=_[_0xabec('0x4d')](_0x360f4e[_0xabec('0x3b')]);_0x3ca9ca[_0xabec('0x3c')]=_[_0xabec('0x4f')](_0x3ca9ca[_0xabec('0x3a')],_0x3ca9ca[_0xabec('0x3b')]);_0xeaf929[_0xabec('0x3d')]=_['intersection'](_0x3ca9ca[_0xabec('0x3a')],qs[_0xabec('0x3e')](_0x360f4e['query'][_0xabec('0x3e')]));_0xeaf929[_0xabec('0x3d')]=_0xeaf929['attributes']['length']?_0xeaf929['attributes']:_0x3ca9ca[_0xabec('0x3a')];_0xeaf929[_0xabec('0x42')]=qs[_0xabec('0x43')](_0x360f4e[_0xabec('0x3b')][_0xabec('0x43')]);_0xeaf929[_0xabec('0x44')]=qs['filters'](_[_0xabec('0x70')](_0x360f4e[_0xabec('0x3b')],_0x3ca9ca['filters']));_0xeaf929['where']=_[_0xabec('0x46')](_0xeaf929[_0xabec('0x44')],{'$or':[{'ListId':_0x2c547b['id']},{'ListId':null}]});if(_0x360f4e['query'][_0xabec('0x72')]){_0xeaf929[_0xabec('0x44')]=_[_0xabec('0x46')](_0xeaf929[_0xabec('0x44')],{'$or':_['map'](_0xeaf929[_0xabec('0x3d')],function(_0x3ea64b){var _0xb22c80={};_0xb22c80[_0x3ea64b]={'$like':'%'+_0x360f4e[_0xabec('0x3b')][_0xabec('0x72')]+'%'};return _0xb22c80;})});}_0xeaf929=_[_0xabec('0x46')]({},_0xeaf929,_0x360f4e['options']);return db[_0xabec('0x6b')]['findAndCountAll'](_0xeaf929);}})[_0xabec('0x2d')](respondWithResult(_0x201f59,null))[_0xabec('0x58')](handleError(_0x201f59,null));};exports['getGlobalCustomFields']=function(_0x5bcd20,_0x3f0e65){return db[_0xabec('0x6b')][_0xabec('0x9e')]({'where':{'ListId':null}})[_0xabec('0x2d')](handleEntityNotFound(_0x3f0e65,null))['then'](function(_0x3e0c63){return _0x3e0c63;})[_0xabec('0x2d')](respondWithResult(_0x3f0e65,null))['catch'](handleError(_0x3f0e65,null));};exports[_0xabec('0x9f')]=function(_0xafa110,_0x2768a9,_0x1d3115){return db['CmList']['find']({'where':{'id':_0xafa110[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x2768a9,null))['then'](function(_0x383836){if(_0x383836){return _0x383836[_0xabec('0x9f')](_0xafa110['body'][_0xabec('0x60')],_[_0xabec('0x66')](_0xafa110[_0xabec('0x52')],[_0xabec('0x60'),'id'])||{})[_0xabec('0xa0')](function(_0x3f3c46){for(var _0x5de61f=0x0;_0x5de61f<_0xafa110[_0xabec('0x52')][_0xabec('0x60')][_0xabec('0x3f')];_0x5de61f+=0x1){socket[_0xabec('0xa1')](_0xabec('0xa2'),{'UserId':Number(_0xafa110['body']['ids'][_0x5de61f]),'CmListId':Number(_0xafa110[_0xabec('0x4c')]['id'])});}return _0x3f3c46;});}})[_0xabec('0x2d')](respondWithResult(_0x2768a9,null))[_0xabec('0x58')](handleError(_0x2768a9,null));};exports[_0xabec('0xa3')]=function(_0x584033,_0x4bcd08,_0x12bc6e){return db['CmList'][_0xabec('0x50')]({'where':{'id':_0x584033[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x4bcd08,null))[_0xabec('0x2d')](function(_0x43e065){if(_0x43e065){return _0x43e065[_0xabec('0xa3')](_0x584033['query'][_0xabec('0x60')])[_0xabec('0x2d')](function(){if(_[_0xabec('0x64')](_0x584033[_0xabec('0x3b')][_0xabec('0x60')])){for(var _0x391764=0x0;_0x391764<_0x584033['query'][_0xabec('0x60')][_0xabec('0x3f')];_0x391764+=0x1){socket[_0xabec('0xa1')](_0xabec('0xa4'),{'UserId':Number(_0x584033[_0xabec('0x3b')]['ids'][_0x391764]),'CmListId':Number(_0x584033[_0xabec('0x4c')]['id'])});}}else{socket[_0xabec('0xa1')](_0xabec('0xa4'),{'UserId':Number(_0x584033[_0xabec('0x3b')][_0xabec('0x60')]),'CmListId':Number(_0x584033['params']['id'])});}});}})[_0xabec('0x2d')](respondWithStatusCode(_0x4bcd08,null))[_0xabec('0x58')](handleError(_0x4bcd08,null));};exports[_0xabec('0xa5')]=function(_0x2a493d,_0x462fc7,_0x2bfb3d){var _0x59b7d5={};var _0x1834c9={};var _0x1ae241;var _0x13047d;return db[_0xabec('0x36')][_0xabec('0x8e')]({'where':{'id':_0x2a493d[_0xabec('0x4c')]['id']}})[_0xabec('0x2d')](handleEntityNotFound(_0x462fc7,null))[_0xabec('0x2d')](function(_0x37627f){if(_0x37627f){_0x1ae241=_0x37627f;_0x1834c9['model']=_['keys'](db[_0xabec('0xa6')]['rawAttributes']);_0x1834c9[_0xabec('0x3b')]=_[_0xabec('0x4d')](_0x2a493d[_0xabec('0x3b')]);_0x1834c9[_0xabec('0x3c')]=_[_0xabec('0x4f')](_0x1834c9[_0xabec('0x3a')],_0x1834c9['query']);_0x59b7d5['attributes']=_[_0xabec('0x4f')](_0x1834c9[_0xabec('0x3a')],qs[_0xabec('0x3e')](_0x2a493d[_0xabec('0x3b')][_0xabec('0x3e')]));_0x59b7d5[_0xabec('0x3d')]=_0x59b7d5[_0xabec('0x3d')][_0xabec('0x3f')]?_0x59b7d5[_0xabec('0x3d')]:_0x1834c9[_0xabec('0x3a')];_0x59b7d5[_0xabec('0x42')]=qs[_0xabec('0x43')](_0x2a493d[_0xabec('0x3b')][_0xabec('0x43')]);_0x59b7d5['where']=qs[_0xabec('0x3c')](_[_0xabec('0x70')](_0x2a493d[_0xabec('0x3b')],_0x1834c9[_0xabec('0x3c')]));if(_0x2a493d[_0xabec('0x3b')][_0xabec('0x72')]){_0x59b7d5[_0xabec('0x44')]=_[_0xabec('0x46')](_0x59b7d5[_0xabec('0x44')],{'$or':_[_0xabec('0x35')](_0x59b7d5['attributes'],function(_0x544335){var _0x361624={};_0x361624[_0x544335]={'$like':'%'+_0x2a493d[_0xabec('0x3b')][_0xabec('0x72')]+'%'};return _0x361624;})});}_0x59b7d5=_[_0xabec('0x46')]({},_0x59b7d5,_0x2a493d[_0xabec('0x47')]);return _0x1ae241['getAgents'](_0x59b7d5);}})[_0xabec('0x2d')](function(_0x3c9b36){if(_0x3c9b36){_0x13047d=_0x3c9b36['length'];if(!_0x2a493d['query']['hasOwnProperty'](_0xabec('0x41'))){_0x59b7d5['limit']=qs[_0xabec('0x26')](_0x2a493d[_0xabec('0x3b')]['limit']);_0x59b7d5[_0xabec('0x28')]=qs[_0xabec('0x28')](_0x2a493d[_0xabec('0x3b')][_0xabec('0x28')]);}return _0x1ae241[_0xabec('0xa5')](_0x59b7d5);}})['then'](function(_0x477cf1){if(_0x477cf1){return _0x477cf1?{'count':_0x13047d,'rows':_0x477cf1}:null;}})[_0xabec('0x2d')](respondWithResult(_0x462fc7,null))['catch'](handleError(_0x462fc7,null));};function handleQuery(_0x49f2fe){logger[_0xabec('0xa7')](_0x49f2fe);return db[_0xabec('0x99')]['query'](_0x49f2fe)[_0xabec('0xa0')](function(_0x836a12){csv_results['push'](_0x836a12);})[_0xabec('0x58')](function(_0x200294){logger[_0xabec('0x30')](_0x200294[_0xabec('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3d39ebb..71409ca 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4b36bd,_0x25a84a){var _0xb4a41f=function(_0x51b264){while(--_0x51b264){_0x4b36bd['push'](_0x4b36bd['shift']());}};_0xb4a41f(++_0x25a84a);}(_0x7217,0x19e));var _0x7721=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7217[_0x4b7b62];return _0x2280df;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a31d6c4..c259f83 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 _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1bed33,_0x338de9){_0x1bed33=_0x1bed33-0x0;var _0x4fd540=_0x6f0d[_0x1bed33];return _0x4fd540;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55839a,_0x3c5819){var _0x24ecdf=function(_0x5369a2){while(--_0x5369a2){_0x55839a['push'](_0x55839a['shift']());}};_0x24ecdf(++_0x3c5819);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0xf3cd[_0x214d54];return _0x44ca46;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./cmList.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'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 e322a68..6c1262d 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 _0x46a2=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','ioredis','../../config/utils'];(function(_0x2c3367,_0x136d33){var _0x54b071=function(_0x43f5eb){while(--_0x43f5eb){_0x2c3367['push'](_0x2c3367['shift']());}};_0x54b071(++_0x136d33);}(_0x46a2,0x11c));var _0x246a=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0x46a2[_0x548d7d];return _0xb1c878;};'use strict';var _=require(_0x246a('0x0'));var util=require(_0x246a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x246a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x246a('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x246a('0x4'));var jayson=require(_0x246a('0x5'));var client=jayson[_0x246a('0x6')][_0x246a('0x7')]({'port':0x232a});config[_0x246a('0x8')]=_[_0x246a('0x9')](config[_0x246a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x246a('0xa'))(new Redis(config[_0x246a('0x8')]));require(_0x246a('0xb'))['register'](socket);function respondWithRpcPromise(_0x358107,_0x5ab29d,_0x5f4476){return new BPromise(function(_0x5a7687,_0x1d10b8){return client[_0x246a('0xc')](_0x358107,_0x5f4476)[_0x246a('0xd')](function(_0x10380d){logger[_0x246a('0xe')](_0x246a('0xf'),_0x5ab29d,_0x246a('0x10'));logger[_0x246a('0x11')](_0x246a('0x12'),_0x5ab29d,_0x246a('0x10'),JSON[_0x246a('0x13')](_0x10380d));if(_0x10380d[_0x246a('0x14')]){if(_0x10380d[_0x246a('0x14')][_0x246a('0x15')]===0x1f4){logger[_0x246a('0x14')](_0x246a('0xf'),_0x5ab29d,_0x10380d[_0x246a('0x14')]['message']);return _0x1d10b8(_0x10380d['error'][_0x246a('0x16')]);}logger[_0x246a('0x14')](_0x246a('0xf'),_0x5ab29d,_0x10380d[_0x246a('0x14')][_0x246a('0x16')]);return _0x5a7687(_0x10380d[_0x246a('0x14')][_0x246a('0x16')]);}else{logger[_0x246a('0xe')](_0x246a('0xf'),_0x5ab29d,_0x246a('0x10'));_0x5a7687(_0x10380d[_0x246a('0x17')]['message']);}})['catch'](function(_0x4f8ee1){logger[_0x246a('0x14')]('CmList,\x20%s,\x20%s',_0x5ab29d,_0x4f8ee1);_0x1d10b8(_0x4f8ee1);});});} \ No newline at end of file +var _0xe835=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmList.socket','register','request\x20sent','debug','error','code','CmList,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe835,0x140));var _0x5e83=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xe835[_0xc69f39];return _0x93be41;};'use strict';var _=require(_0x5e83('0x0'));var util=require(_0x5e83('0x1'));var moment=require(_0x5e83('0x2'));var BPromise=require(_0x5e83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e83('0x4'));var db=require(_0x5e83('0x5'))['db'];var utils=require(_0x5e83('0x6'));var logger=require(_0x5e83('0x7'))(_0x5e83('0x8'));var config=require(_0x5e83('0x9'));var jayson=require(_0x5e83('0xa'));var client=jayson[_0x5e83('0xb')][_0x5e83('0xc')]({'port':0x232a});config[_0x5e83('0xd')]=_['defaults'](config[_0x5e83('0xd')],{'host':_0x5e83('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5e83('0xd')]));require(_0x5e83('0xf'))[_0x5e83('0x10')](socket);function respondWithRpcPromise(_0x13a00c,_0x1aaa75,_0x61455c){return new BPromise(function(_0x5e936c,_0x3eb6b0){return client['request'](_0x13a00c,_0x61455c)['then'](function(_0x45e2bb){logger['info']('CmList,\x20%s,\x20%s',_0x1aaa75,_0x5e83('0x11'));logger[_0x5e83('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x1aaa75,_0x5e83('0x11'),JSON['stringify'](_0x45e2bb));if(_0x45e2bb[_0x5e83('0x13')]){if(_0x45e2bb[_0x5e83('0x13')][_0x5e83('0x14')]===0x1f4){logger[_0x5e83('0x13')](_0x5e83('0x15'),_0x1aaa75,_0x45e2bb[_0x5e83('0x13')]['message']);return _0x3eb6b0(_0x45e2bb[_0x5e83('0x13')][_0x5e83('0x16')]);}logger[_0x5e83('0x13')](_0x5e83('0x15'),_0x1aaa75,_0x45e2bb[_0x5e83('0x13')][_0x5e83('0x16')]);return _0x5e936c(_0x45e2bb[_0x5e83('0x13')][_0x5e83('0x16')]);}else{logger[_0x5e83('0x17')]('CmList,\x20%s,\x20%s',_0x1aaa75,_0x5e83('0x11'));_0x5e936c(_0x45e2bb['result'][_0x5e83('0x16')]);}})[_0x5e83('0x18')](function(_0xb4bf57){logger[_0x5e83('0x13')]('CmList,\x20%s,\x20%s',_0x1aaa75,_0xb4bf57);_0x3eb6b0(_0xb4bf57);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 228a49a..ad9b20e 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 _0x499d=['removeListener','register','length','cmList:','./cmList.events','save','update','emit'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x499d,0xbc));var _0xd499=function(_0x369681,_0x53e003){_0x369681=_0x369681-0x0;var _0x39ce7e=_0x499d[_0x369681];return _0x39ce7e;};'use strict';var CmListEvents=require(_0xd499('0x0'));var events=[_0xd499('0x1'),'remove',_0xd499('0x2')];function createListener(_0x574f31,_0x1f84aa){return function(_0x9d5af4){_0x1f84aa[_0xd499('0x3')](_0x574f31,_0x9d5af4);};}function removeListener(_0x373208,_0xe57d76){return function(){CmListEvents[_0xd499('0x4')](_0x373208,_0xe57d76);};}exports[_0xd499('0x5')]=function(_0x559161){for(var _0x3d7310=0x0,_0x335578=events[_0xd499('0x6')];_0x3d7310<_0x335578;_0x3d7310++){var _0x1a1ab3=events[_0x3d7310];var _0x4d082f=createListener(_0xd499('0x7')+_0x1a1ab3,_0x559161);CmListEvents['on'](_0x1a1ab3,_0x4d082f);}}; \ No newline at end of file +var _0x4963=['save','length'];(function(_0x1ff16e,_0x2cf334){var _0x4f7a22=function(_0x1420a8){while(--_0x1420a8){_0x1ff16e['push'](_0x1ff16e['shift']());}};_0x4f7a22(++_0x2cf334);}(_0x4963,0x1f4));var _0x3496=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4963[_0x321bb2];return _0x9c12ed;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x3496('0x0'),'remove','update'];function createListener(_0x4270ee,_0x232d96){return function(_0x9ba359){_0x232d96['emit'](_0x4270ee,_0x9ba359);};}function removeListener(_0x3f73f9,_0xfd0f29){return function(){CmListEvents['removeListener'](_0x3f73f9,_0xfd0f29);};}exports['register']=function(_0x329d3c){for(var _0x5df3de=0x0,_0x23a7b1=events[_0x3496('0x1')];_0x5df3de<_0x23a7b1;_0x5df3de++){var _0x3422c0=events[_0x5df3de];var _0x4c9b50=createListener('cmList:'+_0x3422c0,_0x329d3c);CmListEvents['on'](_0x3422c0,_0x4c9b50);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 608c765..b7b65e5 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 _0x47c1=['getDispositions','/:id/contacts/csv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addCustomField','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','show','/:id/dispositions'];(function(_0x332e6d,_0x2b6b6d){var _0x1dd3e9=function(_0xe2e088){while(--_0xe2e088){_0x332e6d['push'](_0x332e6d['shift']());}};_0x1dd3e9(++_0x2b6b6d);}(_0x47c1,0x14d));var _0x147c=function(_0x144044,_0x5d940e){_0x144044=_0x144044-0x0;var _0x26d142=_0x47c1[_0x144044];return _0x26d142;};'use strict';var multer=require(_0x147c('0x0'));var util=require('util');var path=require(_0x147c('0x1'));var timeout=require(_0x147c('0x2'));var express=require(_0x147c('0x3'));var router=express[_0x147c('0x4')]();var fs_extra=require(_0x147c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x147c('0x6'));var config=require(_0x147c('0x7'));var controller=require(_0x147c('0x8'));router[_0x147c('0x9')]('/',auth[_0x147c('0xa')](),controller[_0x147c('0xb')]);router[_0x147c('0x9')](_0x147c('0xc'),auth[_0x147c('0xa')](),controller[_0x147c('0xd')]);router[_0x147c('0x9')](_0x147c('0xe'),auth[_0x147c('0xa')](),controller['getGlobalCustomFields']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x147c('0xf')]);router[_0x147c('0x9')](_0x147c('0x10'),auth[_0x147c('0xa')](),controller[_0x147c('0x11')]);router[_0x147c('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router['get'](_0x147c('0x12'),auth[_0x147c('0xa')](),controller['getContactsCsv']);router[_0x147c('0x9')]('/:id/fields',auth[_0x147c('0xa')](),controller[_0x147c('0x13')]);router[_0x147c('0x9')](_0x147c('0x14'),auth[_0x147c('0xa')](),controller[_0x147c('0x15')]);router[_0x147c('0x16')]('/',auth['isAuthenticated'](),controller[_0x147c('0x17')]);router['post'](_0x147c('0x10'),auth[_0x147c('0xa')](),controller[_0x147c('0x18')]);router[_0x147c('0x16')](_0x147c('0x19'),auth[_0x147c('0xa')](),controller['addContacts']);router[_0x147c('0x16')]('/:id/fields',auth[_0x147c('0xa')](),controller[_0x147c('0x1a')]);router[_0x147c('0x16')](_0x147c('0x14'),auth['isAuthenticated'](),controller[_0x147c('0x1b')]);router[_0x147c('0x1c')](_0x147c('0x1d'),auth[_0x147c('0xa')](),controller[_0x147c('0x1e')]);router[_0x147c('0x1f')](_0x147c('0x1d'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x147c('0xa')](),controller[_0x147c('0x20')]);router[_0x147c('0x1f')](_0x147c('0x14'),auth[_0x147c('0xa')](),controller[_0x147c('0x21')]);module[_0x147c('0x22')]=router; \ No newline at end of file +var _0x736a=['update','destroy','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','getCustomFields','/:id/users','getAgents','create','addDisposition','post','/:id/fields','addAgents','put'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x736a,0x96));var _0xa736=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x736a[_0x36884e];return _0x1cc367;};'use strict';var multer=require('multer');var util=require(_0xa736('0x0'));var path=require(_0xa736('0x1'));var timeout=require(_0xa736('0x2'));var express=require(_0xa736('0x3'));var router=express[_0xa736('0x4')]();var fs_extra=require(_0xa736('0x5'));var auth=require(_0xa736('0x6'));var interaction=require(_0xa736('0x7'));var config=require(_0xa736('0x8'));var controller=require(_0xa736('0x9'));router[_0xa736('0xa')]('/',auth[_0xa736('0xb')](),controller[_0xa736('0xc')]);router[_0xa736('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xa736('0xd')]);router[_0xa736('0xa')](_0xa736('0xe'),auth[_0xa736('0xb')](),controller['getGlobalCustomFields']);router[_0xa736('0xa')](_0xa736('0xf'),auth[_0xa736('0xb')](),controller['show']);router[_0xa736('0xa')](_0xa736('0x10'),auth[_0xa736('0xb')](),controller[_0xa736('0x11')]);router[_0xa736('0xa')](_0xa736('0x12'),auth[_0xa736('0xb')](),controller[_0xa736('0x13')]);router[_0xa736('0xa')]('/:id/contacts/csv',auth[_0xa736('0xb')](),controller[_0xa736('0x14')]);router[_0xa736('0xa')]('/:id/fields',auth[_0xa736('0xb')](),controller[_0xa736('0x15')]);router['get'](_0xa736('0x16'),auth[_0xa736('0xb')](),controller[_0xa736('0x17')]);router['post']('/',auth[_0xa736('0xb')](),controller[_0xa736('0x18')]);router['post'](_0xa736('0x10'),auth[_0xa736('0xb')](),controller[_0xa736('0x19')]);router['post'](_0xa736('0x12'),auth[_0xa736('0xb')](),controller['addContacts']);router[_0xa736('0x1a')](_0xa736('0x1b'),auth[_0xa736('0xb')](),controller['addCustomField']);router[_0xa736('0x1a')](_0xa736('0x16'),auth['isAuthenticated'](),controller[_0xa736('0x1c')]);router[_0xa736('0x1d')](_0xa736('0xf'),auth[_0xa736('0xb')](),controller[_0xa736('0x1e')]);router['delete'](_0xa736('0xf'),auth['isAuthenticated'](),controller[_0xa736('0x1f')]);router[_0xa736('0x20')](_0xa736('0x10'),auth[_0xa736('0xb')](),controller[_0xa736('0x21')]);router[_0xa736('0x20')](_0xa736('0x16'),auth[_0xa736('0xb')](),controller[_0xa736('0x22')]);module[_0xa736('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6f365ee..6609a26 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 _0x9880=['exports','VIRTUAL','field','STRING'];(function(_0x5cd7a3,_0x1aa14f){var _0x21235d=function(_0x3152a9){while(--_0x3152a9){_0x5cd7a3['push'](_0x5cd7a3['shift']());}};_0x21235d(++_0x1aa14f);}(_0x9880,0x7c));var _0x0988=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x9880[_0x2bbc07];return _0x6879e4;};'use strict';var Sequelize=require('sequelize');module[_0x0988('0x0')]={'name':{'type':Sequelize[_0x0988('0x1')],'get':function(_0x3210ea){return this['getDataValue'](_0x0988('0x2'));}},'field':{'type':Sequelize[_0x0988('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x0988('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd459=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x42aebd,_0x4b4877){var _0xae4161=function(_0x2027c7){while(--_0x2027c7){_0x42aebd['push'](_0x42aebd['shift']());}};_0xae4161(++_0x4b4877);}(_0xd459,0x14f));var _0x9d45=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd459[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x9d45('0x0'));module[_0x9d45('0x1')]={'name':{'type':Sequelize[_0x9d45('0x2')],'get':function(_0x57d29a){return this[_0x9d45('0x3')](_0x9d45('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x9d45('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x9d45('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 1e603a0..36419a7 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xc2353f,_0x59aa3d){var _0x52c2a2=function(_0x5cef57){while(--_0x5cef57){_0xc2353f['push'](_0xc2353f['shift']());}};_0x52c2a2(++_0x59aa3d);}(_0x7a54,0x106));var _0x47a5=function(_0x9b7c0d,_0x4d3955){_0x9b7c0d=_0x9b7c0d-0x0;var _0x41e5ee=_0x7a54[_0x9b7c0d];return _0x41e5ee;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x527b56,_0x4c9cf8){var _0x4cf96b=function(_0xe006db){while(--_0xe006db){_0x527b56['push'](_0x527b56['shift']());}};_0x4cf96b(++_0x4c9cf8);}(_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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 43afd9e..661776d 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 _0x4d7a=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','Condition','tools_conditions'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4d7a,0x1d9));var _0xa4d7=function(_0x1a7256,_0x4ed379){_0x1a7256=_0x1a7256-0x0;var _0x36e3a2=_0x4d7a[_0x1a7256];return _0x36e3a2;};'use strict';var _=require('lodash');var util=require(_0xa4d7('0x0'));var logger=require(_0xa4d7('0x1'))(_0xa4d7('0x2'));var moment=require(_0xa4d7('0x3'));var BPromise=require(_0xa4d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4d7('0x5'));var rimraf=require(_0xa4d7('0x6'));var config=require(_0xa4d7('0x7'));var attributes=require(_0xa4d7('0x8'));module['exports']=function(_0x3e813b,_0x418da7){return _0x3e813b['define'](_0xa4d7('0x9'),attributes,{'tableName':_0xa4d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c19=['path','../../config/environment','exports','define','Condition','tools_conditions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x33a89d,_0xed52ed){var _0x175025=function(_0x27030f){while(--_0x27030f){_0x33a89d['push'](_0x33a89d['shift']());}};_0x175025(++_0xed52ed);}(_0x7c19,0xa0));var _0x97c1=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7c19[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x97c1('0x0'));var util=require('util');var logger=require(_0x97c1('0x1'))(_0x97c1('0x2'));var moment=require('moment');var BPromise=require(_0x97c1('0x3'));var rp=require(_0x97c1('0x4'));var fs=require('fs');var path=require(_0x97c1('0x5'));var rimraf=require('rimraf');var config=require(_0x97c1('0x6'));var attributes=require('./condition.attributes');module[_0x97c1('0x7')]=function(_0x4443e0,_0x372f87){return _0x4443e0[_0x97c1('0x8')](_0x97c1('0x9'),attributes,{'tableName':_0x97c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 334f423..4341ff0 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 _0x7e94=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x173150,_0x2ca15e){var _0x3a2983=function(_0x2b0035){while(--_0x2b0035){_0x173150['push'](_0x173150['shift']());}};_0x3a2983(++_0x2ca15e);}(_0x7e94,0xca));var _0x47e9=function(_0x3f3c24,_0x3d1dd6){_0x3f3c24=_0x3f3c24-0x0;var _0x3c7cf7=_0x7e94[_0x3f3c24];return _0x3c7cf7;};'use strict';var _=require(_0x47e9('0x0'));var util=require('util');var moment=require(_0x47e9('0x1'));var BPromise=require('bluebird');var rs=require(_0x47e9('0x2'));var fs=require('fs');var Redis=require(_0x47e9('0x3'));var db=require(_0x47e9('0x4'))['db'];var utils=require(_0x47e9('0x5'));var logger=require('../../config/logger')(_0x47e9('0x6'));var config=require(_0x47e9('0x7'));var jayson=require(_0x47e9('0x8'));var client=jayson[_0x47e9('0x9')][_0x47e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd9d1f9,_0x4b6ecd,_0x14c08f){return new BPromise(function(_0x4dff92,_0x5bec1e){return client[_0x47e9('0xb')](_0xd9d1f9,_0x14c08f)[_0x47e9('0xc')](function(_0x15004f){logger[_0x47e9('0xd')](_0x47e9('0xe'),_0x4b6ecd,_0x47e9('0xf'));logger[_0x47e9('0x10')](_0x47e9('0x11'),_0x4b6ecd,_0x47e9('0xf'),JSON[_0x47e9('0x12')](_0x15004f));if(_0x15004f[_0x47e9('0x13')]){if(_0x15004f[_0x47e9('0x13')][_0x47e9('0x14')]===0x1f4){logger[_0x47e9('0x13')](_0x47e9('0xe'),_0x4b6ecd,_0x15004f[_0x47e9('0x13')][_0x47e9('0x15')]);return _0x5bec1e(_0x15004f[_0x47e9('0x13')][_0x47e9('0x15')]);}logger[_0x47e9('0x13')](_0x47e9('0xe'),_0x4b6ecd,_0x15004f[_0x47e9('0x13')][_0x47e9('0x15')]);return _0x4dff92(_0x15004f['error'][_0x47e9('0x15')]);}else{logger[_0x47e9('0xd')](_0x47e9('0xe'),_0x4b6ecd,_0x47e9('0xf'));_0x4dff92(_0x15004f[_0x47e9('0x16')][_0x47e9('0x15')]);}})[_0x47e9('0x17')](function(_0x459fb8){logger['error'](_0x47e9('0xe'),_0x4b6ecd,_0x459fb8);_0x5bec1e(_0x459fb8);});});} \ No newline at end of file +var _0xafc5=['result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s'];(function(_0x419560,_0x16a92c){var _0x52a0a9=function(_0x1cdc67){while(--_0x1cdc67){_0x419560['push'](_0x419560['shift']());}};_0x52a0a9(++_0x16a92c);}(_0xafc5,0xf2));var _0x5afc=function(_0x1da4aa,_0x70e25b){_0x1da4aa=_0x1da4aa-0x0;var _0x405985=_0xafc5[_0x1da4aa];return _0x405985;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5afc('0x0'));var BPromise=require(_0x5afc('0x1'));var rs=require(_0x5afc('0x2'));var fs=require('fs');var Redis=require(_0x5afc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5afc('0x4'));var logger=require(_0x5afc('0x5'))(_0x5afc('0x6'));var config=require(_0x5afc('0x7'));var jayson=require(_0x5afc('0x8'));var client=jayson[_0x5afc('0x9')][_0x5afc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f81e7,_0x2ea36e,_0x1f31fd){return new BPromise(function(_0x5ca573,_0x3fb03f){return client[_0x5afc('0xb')](_0x3f81e7,_0x1f31fd)[_0x5afc('0xc')](function(_0x1a9fac){logger[_0x5afc('0xd')]('Condition,\x20%s,\x20%s',_0x2ea36e,_0x5afc('0xe'));logger[_0x5afc('0xf')](_0x5afc('0x10'),_0x2ea36e,_0x5afc('0xe'),JSON[_0x5afc('0x11')](_0x1a9fac));if(_0x1a9fac[_0x5afc('0x12')]){if(_0x1a9fac[_0x5afc('0x12')][_0x5afc('0x13')]===0x1f4){logger[_0x5afc('0x12')]('Condition,\x20%s,\x20%s',_0x2ea36e,_0x1a9fac[_0x5afc('0x12')]['message']);return _0x3fb03f(_0x1a9fac[_0x5afc('0x12')][_0x5afc('0x14')]);}logger[_0x5afc('0x12')](_0x5afc('0x15'),_0x2ea36e,_0x1a9fac['error'][_0x5afc('0x14')]);return _0x5ca573(_0x1a9fac[_0x5afc('0x12')][_0x5afc('0x14')]);}else{logger[_0x5afc('0xd')](_0x5afc('0x15'),_0x2ea36e,'request\x20sent');_0x5ca573(_0x1a9fac[_0x5afc('0x16')][_0x5afc('0x14')]);}})[_0x5afc('0x17')](function(_0x4e17ea){logger[_0x5afc('0x12')](_0x5afc('0x15'),_0x2ea36e,_0x4e17ea);_0x3fb03f(_0x4e17ea);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1eb59d7..f4eaf63 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 _0x80eb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x13020e,_0x439d7c){var _0x992559=function(_0x509555){while(--_0x509555){_0x13020e['push'](_0x13020e['shift']());}};_0x992559(++_0x439d7c);}(_0x80eb,0x118));var _0xb80e=function(_0x26ae32,_0x2a04ea){_0x26ae32=_0x26ae32-0x0;var _0x56af77=_0x80eb[_0x26ae32];return _0x56af77;};'use strict';var multer=require(_0xb80e('0x0'));var util=require('util');var path=require(_0xb80e('0x1'));var timeout=require(_0xb80e('0x2'));var express=require(_0xb80e('0x3'));var router=express[_0xb80e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb80e('0x5'));var interaction=require(_0xb80e('0x6'));var config=require(_0xb80e('0x7'));var controller=require(_0xb80e('0x8'));router[_0xb80e('0x9')](_0xb80e('0xa'),auth[_0xb80e('0xb')](),controller['update']);router[_0xb80e('0xc')](_0xb80e('0xa'),auth['isAuthenticated'](),controller[_0xb80e('0xd')]);module[_0xb80e('0xe')]=router; \ No newline at end of file +var _0xfc3e=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3763da,_0x58158b){var _0x5d192f=function(_0x329668){while(--_0x329668){_0x3763da['push'](_0x3763da['shift']());}};_0x5d192f(++_0x58158b);}(_0xfc3e,0x17c));var _0xefc3=function(_0x161f32,_0x4933c0){_0x161f32=_0x161f32-0x0;var _0x21a3e4=_0xfc3e[_0x161f32];return _0x21a3e4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xefc3('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xefc3('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xefc3('0x2'));var interaction=require(_0xefc3('0x3'));var config=require(_0xefc3('0x4'));var controller=require(_0xefc3('0x5'));router[_0xefc3('0x6')](_0xefc3('0x7'),auth[_0xefc3('0x8')](),controller['update']);router[_0xefc3('0x9')](_0xefc3('0x7'),auth['isAuthenticated'](),controller[_0xefc3('0xa')]);module[_0xefc3('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index b60c7af..7fdbb15 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 _0xbf18=['name','INTEGER','STRING','sequelize','exports'];(function(_0x56c838,_0x21e57f){var _0x3ee55a=function(_0x422b20){while(--_0x422b20){_0x56c838['push'](_0x56c838['shift']());}};_0x3ee55a(++_0x21e57f);}(_0xbf18,0x18e));var _0x8bf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8bf1('0x0'));module[_0x8bf1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8bf1('0x2')},'OrderBy':{'type':Sequelize[_0x8bf1('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8bf1('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x154e=['exports','STRING','INTEGER','sequelize'];(function(_0x9eeb69,_0x4af906){var _0x4ae56d=function(_0x18ce97){while(--_0x18ce97){_0x9eeb69['push'](_0x9eeb69['shift']());}};_0x4ae56d(++_0x4af906);}(_0x154e,0xd3));var _0xe154=function(_0x597e54,_0x48236a){_0x597e54=_0x597e54-0x0;var _0x4eb946=_0x154e[_0x597e54];return _0x4eb946;};'use strict';var Sequelize=require(_0xe154('0x0'));module[_0xe154('0x1')]={'name':{'type':Sequelize[_0xe154('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xe154('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe154('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 2d859de..dee17dd 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 _0x36ee=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','stack','index','map','ContactItemType','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2face7,_0x3d0858){var _0x1c149a=function(_0x4b810b){while(--_0x4b810b){_0x2face7['push'](_0x2face7['shift']());}};_0x1c149a(++_0x3d0858);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['ContactItemType'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='ContactItemTypes';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['ContactItemType']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](db[_0xe36e('0x54')][_0xe36e('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x7c3766[_0xe36e('0x46')]['id']}}))[_0xe36e('0x26')](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));}; \ No newline at end of file +var _0xfef3=['catch','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','ContactItemTypes','UserProfileResource','then','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x4dae00,_0x15b194){var _0x16bf42=function(_0x5f2a9a){while(--_0x5f2a9a){_0x4dae00['push'](_0x4dae00['shift']());}};_0x16bf42(++_0x15b194);}(_0xfef3,0x118));var _0x3fef=function(_0x221a3d,_0x2b9912){_0x221a3d=_0x221a3d-0x0;var _0x30566f=_0xfef3[_0x221a3d];return _0x30566f;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];function respondWithStatusCode(_0x4c4a47,_0x2c99ff){_0x2c99ff=_0x2c99ff||0xcc;return function(_0x3d2c2d){if(_0x3d2c2d){return _0x4c4a47[_0x3fef('0x19')](_0x2c99ff);}return _0x4c4a47['status'](_0x2c99ff)[_0x3fef('0x1a')]();};}function respondWithResult(_0x4be62f,_0x15b757){_0x15b757=_0x15b757||0xc8;return function(_0x14c053){if(_0x14c053){return _0x4be62f['status'](_0x15b757)[_0x3fef('0x1b')](_0x14c053);}};}function respondWithFilteredResult(_0x177e28,_0x40b479){return function(_0x79b617){if(_0x79b617){var _0x395df0=typeof _0x40b479[_0x3fef('0x1c')]==='undefined'&&typeof _0x40b479[_0x3fef('0x1d')]===_0x3fef('0x1e');var _0x1ec282=_0x79b617[_0x3fef('0x1f')];var _0x1613ad=_0x395df0?0x0:_0x40b479[_0x3fef('0x1c')];var _0x53d993=_0x395df0?_0x79b617[_0x3fef('0x1f')]:_0x40b479[_0x3fef('0x1c')]+_0x40b479['limit'];var _0x2c7f36;if(_0x53d993>=_0x1ec282){_0x53d993=_0x1ec282;_0x2c7f36=0xc8;}else{_0x2c7f36=0xce;}_0x177e28[_0x3fef('0x20')](_0x2c7f36);return _0x177e28[_0x3fef('0x21')](_0x3fef('0x22'),_0x1613ad+'-'+_0x53d993+'/'+_0x1ec282)[_0x3fef('0x1b')](_0x79b617);}return null;};}function patchUpdates(_0x2b5226){return function(_0x451d11){try{jsonpatch[_0x3fef('0x23')](_0x451d11,_0x2b5226,!![]);}catch(_0x124e7c){return BPromise[_0x3fef('0x24')](_0x124e7c);}return _0x451d11[_0x3fef('0x25')]();};}function saveUpdates(_0x3bb110,_0x2eb578){return function(_0x39a8ea){if(_0x39a8ea){return _0x39a8ea[_0x3fef('0x26')](_0x3bb110)['then'](function(_0x5b56de){return _0x5b56de;});}return null;};}function removeEntity(_0x50025f,_0x378b03){return function(_0x3ba38d){if(_0x3ba38d){return _0x3ba38d[_0x3fef('0x27')]()['then'](function(){var _0x4d462c=_0x3ba38d['get']({'plain':!![]});var _0x45464b=_0x3fef('0x28');return db[_0x3fef('0x29')][_0x3fef('0x27')]({'where':{'type':_0x45464b,'resourceId':_0x4d462c['id']}})[_0x3fef('0x2a')](function(){return _0x3ba38d;});})['then'](function(){_0x50025f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x121ff0,_0x3baa52){return function(_0x4ea2ab){if(!_0x4ea2ab){_0x121ff0[_0x3fef('0x19')](0x194);}return _0x4ea2ab;};}function handleError(_0x6d08cd,_0x4e08d8){_0x4e08d8=_0x4e08d8||0x1f4;return function(_0x30a954){logger[_0x3fef('0x2b')](_0x30a954[_0x3fef('0x2c')]);if(_0x30a954[_0x3fef('0x2d')]){delete _0x30a954[_0x3fef('0x2d')];}_0x6d08cd[_0x3fef('0x20')](_0x4e08d8)[_0x3fef('0x2e')](_0x30a954);};}exports['index']=function(_0x34576a,_0xc20ce5){var _0x21aad4={},_0x11bd40={},_0x5dbbc0={'count':0x0,'rows':[]};var _0xcd635d=_['map'](db[_0x3fef('0x2f')][_0x3fef('0x30')],function(_0x16009a){return{'name':_0x16009a[_0x3fef('0x31')],'type':_0x16009a[_0x3fef('0x32')][_0x3fef('0x33')]};});_0x11bd40[_0x3fef('0x34')]=_[_0x3fef('0x35')](_0xcd635d,_0x3fef('0x2d'));_0x11bd40[_0x3fef('0x36')]=_['keys'](_0x34576a['query']);_0x11bd40[_0x3fef('0x37')]=_['intersection'](_0x11bd40[_0x3fef('0x34')],_0x11bd40[_0x3fef('0x36')]);_0x21aad4[_0x3fef('0x38')]=_[_0x3fef('0x39')](_0x11bd40[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x34576a[_0x3fef('0x36')][_0x3fef('0x3a')]));_0x21aad4[_0x3fef('0x38')]=_0x21aad4[_0x3fef('0x38')][_0x3fef('0x3b')]?_0x21aad4[_0x3fef('0x38')]:_0x11bd40[_0x3fef('0x34')];if(!_0x34576a[_0x3fef('0x36')]['hasOwnProperty'](_0x3fef('0x3c'))){_0x21aad4[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x34576a[_0x3fef('0x36')][_0x3fef('0x1d')]);_0x21aad4[_0x3fef('0x1c')]=qs['offset'](_0x34576a['query'][_0x3fef('0x1c')]);}_0x21aad4[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x34576a[_0x3fef('0x36')][_0x3fef('0x3e')]);_0x21aad4[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x40')](_0x34576a[_0x3fef('0x36')],_0x11bd40[_0x3fef('0x37')]),_0xcd635d);if(_0x34576a[_0x3fef('0x36')]['filter']){_0x21aad4[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x21aad4['where'],{'$or':_['map'](_0xcd635d,function(_0x37c4af){if(_0x37c4af[_0x3fef('0x32')]!==_0x3fef('0x42')){var _0x21c531={};_0x21c531[_0x37c4af[_0x3fef('0x2d')]]={'$like':'%'+_0x34576a[_0x3fef('0x36')][_0x3fef('0x43')]+'%'};return _0x21c531;}})});}_0x21aad4=_[_0x3fef('0x41')]({},_0x21aad4,_0x34576a['options']);var _0x107d42={'where':_0x21aad4[_0x3fef('0x3f')]};return db[_0x3fef('0x2f')][_0x3fef('0x1f')](_0x107d42)[_0x3fef('0x2a')](function(_0x2143ec){_0x5dbbc0[_0x3fef('0x1f')]=_0x2143ec;if(_0x34576a[_0x3fef('0x36')][_0x3fef('0x44')]){_0x21aad4[_0x3fef('0x45')]=[{'all':!![]}];}return db[_0x3fef('0x2f')][_0x3fef('0x46')](_0x21aad4);})[_0x3fef('0x2a')](function(_0x15d2c7){_0x5dbbc0[_0x3fef('0x47')]=_0x15d2c7;return _0x5dbbc0;})['then'](respondWithFilteredResult(_0xc20ce5,_0x21aad4))[_0x3fef('0x48')](handleError(_0xc20ce5,null));};exports[_0x3fef('0x49')]=function(_0x421fd1,_0x2120fd){var _0x1879c1={'raw':!![],'where':{'id':_0x421fd1['params']['id']}},_0x33b145={};_0x33b145[_0x3fef('0x34')]=_['keys'](db[_0x3fef('0x2f')][_0x3fef('0x30')]);_0x33b145['query']=_[_0x3fef('0x4a')](_0x421fd1['query']);_0x33b145[_0x3fef('0x37')]=_[_0x3fef('0x39')](_0x33b145[_0x3fef('0x34')],_0x33b145[_0x3fef('0x36')]);_0x1879c1[_0x3fef('0x38')]=_[_0x3fef('0x39')](_0x33b145[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x421fd1[_0x3fef('0x36')][_0x3fef('0x3a')]));_0x1879c1[_0x3fef('0x38')]=_0x1879c1[_0x3fef('0x38')][_0x3fef('0x3b')]?_0x1879c1['attributes']:_0x33b145[_0x3fef('0x34')];if(_0x421fd1[_0x3fef('0x36')]['includeAll']){_0x1879c1[_0x3fef('0x45')]=[{'all':!![]}];}_0x1879c1=_[_0x3fef('0x41')]({},_0x1879c1,_0x421fd1[_0x3fef('0x4b')]);return db['ContactItemType'][_0x3fef('0x4c')](_0x1879c1)[_0x3fef('0x2a')](handleEntityNotFound(_0x2120fd,null))['then'](respondWithResult(_0x2120fd,null))[_0x3fef('0x48')](handleError(_0x2120fd,null));};exports['create']=function(_0x48322c,_0x15fb2c){return db['ContactItemType'][_0x3fef('0x4d')](_0x48322c[_0x3fef('0x4e')],{})['then'](function(_0x4535e8){var _0x2823f4=_0x48322c[_0x3fef('0x4f')]['get']({'plain':!![]});if(!_0x2823f4)throw new Error(_0x3fef('0x50'));if(_0x2823f4[_0x3fef('0x51')]===_0x3fef('0x4f')){var _0x5b1acb=_0x4535e8[_0x3fef('0x52')]({'plain':!![]});var _0x154311=_0x3fef('0x28');return db[_0x3fef('0x53')][_0x3fef('0x4c')]({'where':{'name':_0x154311,'userProfileId':_0x2823f4['userProfileId']},'raw':!![]})[_0x3fef('0x2a')](function(_0xbbf255){if(_0xbbf255&&_0xbbf255[_0x3fef('0x54')]===0x0){return db[_0x3fef('0x29')][_0x3fef('0x4d')]({'name':_0x5b1acb[_0x3fef('0x2d')],'resourceId':_0x5b1acb['id'],'type':_0xbbf255[_0x3fef('0x2d')],'sectionId':_0xbbf255['id']},{})[_0x3fef('0x2a')](function(){return _0x4535e8;});}else{return _0x4535e8;}})[_0x3fef('0x48')](function(_0x4862a5){logger['error'](_0x3fef('0x55'),_0x4862a5);throw _0x4862a5;});}return _0x4535e8;})[_0x3fef('0x2a')](respondWithResult(_0x15fb2c,0xc9))[_0x3fef('0x48')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x26')]=function(_0xd57af2,_0x192f91){if(_0xd57af2[_0x3fef('0x4e')]['id']){delete _0xd57af2[_0x3fef('0x4e')]['id'];}return db[_0x3fef('0x2f')][_0x3fef('0x4c')]({'where':{'id':_0xd57af2[_0x3fef('0x56')]['id']}})[_0x3fef('0x2a')](handleEntityNotFound(_0x192f91,null))['then'](saveUpdates(_0xd57af2[_0x3fef('0x4e')],null))[_0x3fef('0x2a')](respondWithResult(_0x192f91,null))[_0x3fef('0x48')](handleError(_0x192f91,null));};exports[_0x3fef('0x27')]=function(_0x5b0415,_0x114191){return db[_0x3fef('0x2f')][_0x3fef('0x4c')]({'where':{'id':_0x5b0415[_0x3fef('0x56')]['id']}})['then'](handleEntityNotFound(_0x114191,null))[_0x3fef('0x2a')](db[_0x3fef('0x57')][_0x3fef('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5b0415['params']['id']}}))['then'](removeEntity(_0x114191,null))[_0x3fef('0x48')](handleError(_0x114191,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 54097a1..59e2be8 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 _0x838f=['../../config/environment','exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x59d67c,_0x264ead){var _0x39b21d=function(_0x4ce485){while(--_0x4ce485){_0x59d67c['push'](_0x59d67c['shift']());}};_0x39b21d(++_0x264ead);}(_0x838f,0x13a));var _0xf838=function(_0x1fc8d2,_0x48f28f){_0x1fc8d2=_0x1fc8d2-0x0;var _0x359bdf=_0x838f[_0x1fc8d2];return _0x359bdf;};'use strict';var _=require(_0xf838('0x0'));var util=require(_0xf838('0x1'));var logger=require(_0xf838('0x2'))(_0xf838('0x3'));var moment=require('moment');var BPromise=require(_0xf838('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf838('0x5'));var config=require(_0xf838('0x6'));var attributes=require('./contactItemType.attributes');module[_0xf838('0x7')]=function(_0x4d51be,_0x28e92f){return _0x4d51be[_0xf838('0x8')]('ContactItemType',attributes,{'tableName':_0xf838('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb534=['exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes'];(function(_0x35f487,_0x1f1227){var _0x48e63e=function(_0x5a327b){while(--_0x5a327b){_0x35f487['push'](_0x35f487['shift']());}};_0x48e63e(++_0x1f1227);}(_0xb534,0x19a));var _0x4b53=function(_0xda0a5a,_0x512f93){_0xda0a5a=_0xda0a5a-0x0;var _0x326540=_0xb534[_0xda0a5a];return _0x326540;};'use strict';var _=require(_0x4b53('0x0'));var util=require(_0x4b53('0x1'));var logger=require(_0x4b53('0x2'))(_0x4b53('0x3'));var moment=require(_0x4b53('0x4'));var BPromise=require(_0x4b53('0x5'));var rp=require(_0x4b53('0x6'));var fs=require('fs');var path=require(_0x4b53('0x7'));var rimraf=require('rimraf');var config=require(_0x4b53('0x8'));var attributes=require(_0x4b53('0x9'));module[_0x4b53('0xa')]=function(_0xeb09f8,_0x51166b){return _0xeb09f8[_0x4b53('0xb')](_0x4b53('0xc'),attributes,{'tableName':_0x4b53('0xd'),'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 7f6de58..b1818f6 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 _0x64ea=['../../mysqldb','rpc','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3b2c42,_0x7f5a2a){var _0x16a79e=function(_0x140879){while(--_0x140879){_0x3b2c42['push'](_0x3b2c42['shift']());}};_0x16a79e(++_0x7f5a2a);}(_0x64ea,0x127));var _0xa64e=function(_0x2e5a17,_0x558f0e){_0x2e5a17=_0x2e5a17-0x0;var _0x24f53d=_0x64ea[_0x2e5a17];return _0x24f53d;};'use strict';var _=require(_0xa64e('0x0'));var util=require(_0xa64e('0x1'));var moment=require(_0xa64e('0x2'));var BPromise=require(_0xa64e('0x3'));var rs=require(_0xa64e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa64e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa64e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa64e('0x7')][_0xa64e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd64c6f,_0x534916,_0x5cf6d7){return new BPromise(function(_0x149332,_0x33b1ab){return client['request'](_0xd64c6f,_0x5cf6d7)[_0xa64e('0x9')](function(_0xb3c32a){logger[_0xa64e('0xa')](_0xa64e('0xb'),_0x534916,_0xa64e('0xc'));logger[_0xa64e('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x534916,_0xa64e('0xc'),JSON[_0xa64e('0xe')](_0xb3c32a));if(_0xb3c32a['error']){if(_0xb3c32a[_0xa64e('0xf')][_0xa64e('0x10')]===0x1f4){logger[_0xa64e('0xf')](_0xa64e('0xb'),_0x534916,_0xb3c32a[_0xa64e('0xf')][_0xa64e('0x11')]);return _0x33b1ab(_0xb3c32a['error'][_0xa64e('0x11')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x534916,_0xb3c32a['error']['message']);return _0x149332(_0xb3c32a[_0xa64e('0xf')][_0xa64e('0x11')]);}else{logger[_0xa64e('0xa')](_0xa64e('0xb'),_0x534916,_0xa64e('0xc'));_0x149332(_0xb3c32a[_0xa64e('0x12')][_0xa64e('0x11')]);}})[_0xa64e('0x13')](function(_0x578043){logger['error']('ContactItemType,\x20%s,\x20%s',_0x534916,_0x578043);_0x33b1ab(_0x578043);});});} \ No newline at end of file +var _0x12f5=['ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x12f5,0x143));var _0x512f=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x12f5[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x512f('0x0'));var BPromise=require('bluebird');var rs=require(_0x512f('0x1'));var fs=require('fs');var Redis=require(_0x512f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x512f('0x3'));var logger=require(_0x512f('0x4'))('rpc');var config=require(_0x512f('0x5'));var jayson=require(_0x512f('0x6'));var client=jayson[_0x512f('0x7')][_0x512f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1968f0,_0x53fece,_0x2ba2d5){return new BPromise(function(_0x38cf85,_0x37a8f8){return client['request'](_0x1968f0,_0x2ba2d5)[_0x512f('0x9')](function(_0x10d5fd){logger[_0x512f('0xa')]('ContactItemType,\x20%s,\x20%s',_0x53fece,_0x512f('0xb'));logger[_0x512f('0xc')](_0x512f('0xd'),_0x53fece,'request\x20sent',JSON[_0x512f('0xe')](_0x10d5fd));if(_0x10d5fd[_0x512f('0xf')]){if(_0x10d5fd[_0x512f('0xf')][_0x512f('0x10')]===0x1f4){logger[_0x512f('0xf')](_0x512f('0x11'),_0x53fece,_0x10d5fd['error'][_0x512f('0x12')]);return _0x37a8f8(_0x10d5fd['error']['message']);}logger[_0x512f('0xf')](_0x512f('0x11'),_0x53fece,_0x10d5fd['error'][_0x512f('0x12')]);return _0x38cf85(_0x10d5fd[_0x512f('0xf')][_0x512f('0x12')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x53fece,_0x512f('0xb'));_0x38cf85(_0x10d5fd[_0x512f('0x13')][_0x512f('0x12')]);}})[_0x512f('0x14')](function(_0x513ba8){logger[_0x512f('0xf')](_0x512f('0x11'),_0x53fece,_0x513ba8);_0x37a8f8(_0x513ba8);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 14cd683..46c9401 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 _0x6a52=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','update','/:id','exports','multer','path','connect-timeout'];(function(_0x5b9e24,_0x2265f9){var _0x1cbf61=function(_0xa9128d){while(--_0xa9128d){_0x5b9e24['push'](_0x5b9e24['shift']());}};_0x1cbf61(++_0x2265f9);}(_0x6a52,0x195));var _0x26a5=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6a52[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0x26a5('0x0'));var util=require('util');var path=require(_0x26a5('0x1'));var timeout=require(_0x26a5('0x2'));var express=require(_0x26a5('0x3'));var router=express[_0x26a5('0x4')]();var fs_extra=require(_0x26a5('0x5'));var auth=require(_0x26a5('0x6'));var interaction=require(_0x26a5('0x7'));var config=require(_0x26a5('0x8'));var controller=require('./contactItemType.controller');router[_0x26a5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x26a5('0x9')]('/:id',auth[_0x26a5('0xa')](),controller['show']);router[_0x26a5('0xb')]('/',auth[_0x26a5('0xa')](),controller[_0x26a5('0xc')]);router[_0x26a5('0xd')]('/:id',auth[_0x26a5('0xa')](),controller[_0x26a5('0xe')]);router['delete'](_0x26a5('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x26a5('0x10')]=router; \ No newline at end of file +var _0x16a4=['../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service'];(function(_0xddd22a,_0x43df83){var _0x345805=function(_0x48bb43){while(--_0x48bb43){_0xddd22a['push'](_0xddd22a['shift']());}};_0x345805(++_0x43df83);}(_0x16a4,0x162));var _0x416a=function(_0x94e95c,_0x56f54d){_0x94e95c=_0x94e95c-0x0;var _0x368040=_0x16a4[_0x94e95c];return _0x368040;};'use strict';var multer=require(_0x416a('0x0'));var util=require(_0x416a('0x1'));var path=require(_0x416a('0x2'));var timeout=require('connect-timeout');var express=require(_0x416a('0x3'));var router=express['Router']();var fs_extra=require(_0x416a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x416a('0x5'));var config=require(_0x416a('0x6'));var controller=require('./contactItemType.controller');router[_0x416a('0x7')]('/',auth['isAuthenticated'](),controller[_0x416a('0x8')]);router['get'](_0x416a('0x9'),auth[_0x416a('0xa')](),controller['show']);router[_0x416a('0xb')]('/',auth[_0x416a('0xa')](),controller[_0x416a('0xc')]);router[_0x416a('0xd')](_0x416a('0x9'),auth[_0x416a('0xa')](),controller[_0x416a('0xe')]);router[_0x416a('0xf')](_0x416a('0x9'),auth[_0x416a('0xa')](),controller[_0x416a('0x10')]);module[_0x416a('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 4f6ed17..f91d2a0 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(_0x1c61ab,_0x150c91){var _0x5456fe=function(_0x51e561){while(--_0x51e561){_0x1c61ab['push'](_0x1c61ab['shift']());}};_0x5456fe(++_0x150c91);}(_0xb10b,0x12a));var _0xbb10=function(_0x3634d8,_0xbfa70b){_0x3634d8=_0x3634d8-0x0;var _0x2c1369=_0xb10b[_0x3634d8];return _0x2c1369;};'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 _0x2032=['name','exports','STRING'];(function(_0x262036,_0x44d48f){var _0x14f90d=function(_0x414a78){while(--_0x414a78){_0x262036['push'](_0x262036['shift']());}};_0x14f90d(++_0x44d48f);}(_0x2032,0xd9));var _0x2203=function(_0x45dc7b,_0x4d3324){_0x45dc7b=_0x45dc7b-0x0;var _0x244ebf=_0x2032[_0x45dc7b];return _0x244ebf;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ba8c7f6..5e28e56 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 _0xb34f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','clone','length','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','findOne','DashboardItem','pick','getItems','nolimit','rimraf'];(function(_0x503b46,_0x59a047){var _0x3eb1cc=function(_0x1f0b0e){while(--_0x1f0b0e){_0x503b46['push'](_0x503b46['shift']());}};_0x3eb1cc(++_0x59a047);}(_0xb34f,0x18b));var _0xfb34=function(_0x18eb3d,_0x2680c4){_0x18eb3d=_0x18eb3d-0x0;var _0x50a2f4=_0xb34f[_0x18eb3d];return _0x50a2f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb34('0x0'));var zipdir=require(_0xfb34('0x1'));var jsonpatch=require(_0xfb34('0x2'));var rp=require(_0xfb34('0x3'));var moment=require(_0xfb34('0x4'));var BPromise=require(_0xfb34('0x5'));var Mustache=require(_0xfb34('0x6'));var util=require('util');var path=require(_0xfb34('0x7'));var sox=require(_0xfb34('0x8'));var csv=require(_0xfb34('0x9'));var ejs=require(_0xfb34('0xa'));var fs=require('fs');var fs_extra=require(_0xfb34('0xb'));var _=require(_0xfb34('0xc'));var squel=require(_0xfb34('0xd'));var crypto=require(_0xfb34('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfb34('0xf'));var toCsv=require(_0xfb34('0x9'));var querystring=require('querystring');var Papa=require(_0xfb34('0x10'));var Redis=require(_0xfb34('0x11'));var authService=require(_0xfb34('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfb34('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb34('0x14'));var utils=require(_0xfb34('0x15'));var config=require(_0xfb34('0x16'));var licenseUtil=require(_0xfb34('0x17'));var db=require(_0xfb34('0x18'))['db'];config[_0xfb34('0x19')]=_[_0xfb34('0x1a')](config[_0xfb34('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb34('0x1b'))(new Redis(config[_0xfb34('0x19')]));require('./dashboard.socket')[_0xfb34('0x1c')](socket);function respondWithStatusCode(_0x53bb41,_0x1d9cee){_0x1d9cee=_0x1d9cee||0xcc;return function(_0x3a40a9){if(_0x3a40a9){return _0x53bb41[_0xfb34('0x1d')](_0x1d9cee);}return _0x53bb41['status'](_0x1d9cee)[_0xfb34('0x1e')]();};}function respondWithResult(_0x565c87,_0x46253e){_0x46253e=_0x46253e||0xc8;return function(_0x3cd617){if(_0x3cd617){return _0x565c87['status'](_0x46253e)[_0xfb34('0x1f')](_0x3cd617);}};}function respondWithFilteredResult(_0x1803c0,_0x15ba03){return function(_0x1b66a9){if(_0x1b66a9){var _0x1c5f8a=typeof _0x15ba03[_0xfb34('0x20')]===_0xfb34('0x21')&&typeof _0x15ba03[_0xfb34('0x22')]===_0xfb34('0x21');var _0x1d4dd8=_0x1b66a9['count'];var _0x5eb396=_0x1c5f8a?0x0:_0x15ba03[_0xfb34('0x20')];var _0x48840f=_0x1c5f8a?_0x1b66a9[_0xfb34('0x23')]:_0x15ba03['offset']+_0x15ba03[_0xfb34('0x22')];var _0x2cec7b;if(_0x48840f>=_0x1d4dd8){_0x48840f=_0x1d4dd8;_0x2cec7b=0xc8;}else{_0x2cec7b=0xce;}_0x1803c0[_0xfb34('0x24')](_0x2cec7b);return _0x1803c0[_0xfb34('0x25')]('Content-Range',_0x5eb396+'-'+_0x48840f+'/'+_0x1d4dd8)['json'](_0x1b66a9);}return null;};}function patchUpdates(_0x4cce21){return function(_0x1d90f8){try{jsonpatch[_0xfb34('0x26')](_0x1d90f8,_0x4cce21,!![]);}catch(_0x1b07c9){return BPromise[_0xfb34('0x27')](_0x1b07c9);}return _0x1d90f8[_0xfb34('0x28')]();};}function saveUpdates(_0x2cbb05,_0x10b2cd){return function(_0x301971){if(_0x301971){return _0x301971[_0xfb34('0x29')](_0x2cbb05)[_0xfb34('0x2a')](function(_0x521e1a){return _0x521e1a;});}return null;};}function removeEntity(_0x5983de,_0x53846f){return function(_0x248df8){if(_0x248df8){return _0x248df8[_0xfb34('0x2b')]()[_0xfb34('0x2a')](function(){var _0x3a551b=_0x248df8[_0xfb34('0x2c')]({'plain':!![]});var _0xe73145='CustomDashboards';return db[_0xfb34('0x2d')][_0xfb34('0x2b')]({'where':{'type':_0xe73145,'resourceId':_0x3a551b['id']}})[_0xfb34('0x2a')](function(){return _0x248df8;});})[_0xfb34('0x2a')](function(){_0x5983de[_0xfb34('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481445,_0x5421f0){return function(_0x271493){if(!_0x271493){_0x481445['sendStatus'](0x194);}return _0x271493;};}function handleError(_0xfcfff2,_0x2834f0){_0x2834f0=_0x2834f0||0x1f4;return function(_0x1a7684){logger[_0xfb34('0x2e')](_0x1a7684[_0xfb34('0x2f')]);if(_0x1a7684['name']){delete _0x1a7684[_0xfb34('0x30')];}_0xfcfff2[_0xfb34('0x24')](_0x2834f0)[_0xfb34('0x31')](_0x1a7684);};}exports[_0xfb34('0x32')]=function(_0x120596,_0x48bcb7){var _0x468c97={},_0x2508ab={},_0x38c7d2={'count':0x0,'rows':[]};var _0x392b0b=_['map'](db[_0xfb34('0x33')][_0xfb34('0x34')],function(_0x392f5d){return{'name':_0x392f5d[_0xfb34('0x35')],'type':_0x392f5d[_0xfb34('0x36')][_0xfb34('0x37')]};});_0x2508ab['model']=_['map'](_0x392b0b,_0xfb34('0x30'));_0x2508ab[_0xfb34('0x38')]=_[_0xfb34('0x39')](_0x120596[_0xfb34('0x38')]);_0x2508ab[_0xfb34('0x3a')]=_[_0xfb34('0x3b')](_0x2508ab['model'],_0x2508ab[_0xfb34('0x38')]);_0x468c97[_0xfb34('0x3c')]=_[_0xfb34('0x3b')](_0x2508ab['model'],qs[_0xfb34('0x3d')](_0x120596[_0xfb34('0x38')][_0xfb34('0x3d')]));_0x468c97[_0xfb34('0x3c')]=_0x468c97[_0xfb34('0x3c')]['length']?_0x468c97['attributes']:_0x2508ab[_0xfb34('0x3e')];if(!_0x120596[_0xfb34('0x38')][_0xfb34('0x3f')]('nolimit')){_0x468c97[_0xfb34('0x22')]=qs[_0xfb34('0x22')](_0x120596[_0xfb34('0x38')][_0xfb34('0x22')]);_0x468c97[_0xfb34('0x20')]=qs[_0xfb34('0x20')](_0x120596[_0xfb34('0x38')][_0xfb34('0x20')]);}_0x468c97[_0xfb34('0x40')]=qs[_0xfb34('0x41')](_0x120596[_0xfb34('0x38')][_0xfb34('0x41')]);_0x468c97[_0xfb34('0x42')]=qs[_0xfb34('0x3a')](_['pick'](_0x120596[_0xfb34('0x38')],_0x2508ab[_0xfb34('0x3a')]),_0x392b0b);if(_0x120596[_0xfb34('0x38')][_0xfb34('0x43')]){_0x468c97[_0xfb34('0x42')]=_[_0xfb34('0x44')](_0x468c97['where'],{'$or':_[_0xfb34('0x45')](_0x392b0b,function(_0x52489d){if(_0x52489d[_0xfb34('0x36')]!==_0xfb34('0x46')){var _0x3355b7={};_0x3355b7[_0x52489d['name']]={'$like':'%'+_0x120596[_0xfb34('0x38')][_0xfb34('0x43')]+'%'};return _0x3355b7;}})});}_0x468c97=_[_0xfb34('0x44')]({},_0x468c97,_0x120596[_0xfb34('0x47')]);var _0xaa68b3={'where':_0x468c97['where']};return db[_0xfb34('0x33')]['count'](_0xaa68b3)[_0xfb34('0x2a')](function(_0x486476){_0x38c7d2['count']=_0x486476;if(_0x120596[_0xfb34('0x38')][_0xfb34('0x48')]){_0x468c97[_0xfb34('0x49')]=[{'all':!![]}];}return db[_0xfb34('0x33')]['findAll'](_0x468c97);})[_0xfb34('0x2a')](function(_0x26f025){_0x38c7d2[_0xfb34('0x4a')]=_0x26f025;return _0x38c7d2;})[_0xfb34('0x2a')](respondWithFilteredResult(_0x48bcb7,_0x468c97))[_0xfb34('0x4b')](handleError(_0x48bcb7,null));};exports[_0xfb34('0x4c')]=function(_0x58a9fb,_0x3c30a8){var _0x28fee1={'raw':![],'where':{'id':_0x58a9fb[_0xfb34('0x4d')]['id']}},_0x1e9cc0={};_0x1e9cc0[_0xfb34('0x3e')]=_[_0xfb34('0x39')](db[_0xfb34('0x33')]['rawAttributes']);_0x1e9cc0[_0xfb34('0x38')]=_[_0xfb34('0x39')](_0x58a9fb[_0xfb34('0x38')]);_0x1e9cc0[_0xfb34('0x3a')]=_[_0xfb34('0x3b')](_0x1e9cc0[_0xfb34('0x3e')],_0x1e9cc0[_0xfb34('0x38')]);_0x28fee1[_0xfb34('0x3c')]=_[_0xfb34('0x3b')](_0x1e9cc0[_0xfb34('0x3e')],qs['fields'](_0x58a9fb['query']['fields']));_0x28fee1[_0xfb34('0x3c')]=_0x28fee1[_0xfb34('0x3c')]['length']?_0x28fee1['attributes']:_0x1e9cc0[_0xfb34('0x3e')];if(_0x58a9fb['query'][_0xfb34('0x48')]){_0x28fee1[_0xfb34('0x49')]=[{'all':!![]}];}_0x28fee1=_[_0xfb34('0x44')]({},_0x28fee1,_0x58a9fb[_0xfb34('0x47')]);return db[_0xfb34('0x33')]['find'](_0x28fee1)['then'](handleEntityNotFound(_0x3c30a8,null))[_0xfb34('0x2a')](respondWithResult(_0x3c30a8,null))[_0xfb34('0x4b')](handleError(_0x3c30a8,null));};exports['create']=function(_0x4f8c50,_0x2b7387){return db[_0xfb34('0x33')][_0xfb34('0x4e')](_0x4f8c50[_0xfb34('0x4f')],{})[_0xfb34('0x2a')](function(_0x2e3bb5){var _0x3ef8d4=_0x4f8c50[_0xfb34('0x50')]['get']({'plain':!![]});if(!_0x3ef8d4)throw new Error(_0xfb34('0x51'));if(_0x3ef8d4['role']==='user'){var _0x5c6ca3=_0x2e3bb5[_0xfb34('0x2c')]({'plain':!![]});var _0x167935=_0xfb34('0x52');return db[_0xfb34('0x53')][_0xfb34('0x54')]({'where':{'name':_0x167935,'userProfileId':_0x3ef8d4[_0xfb34('0x55')]},'raw':!![]})[_0xfb34('0x2a')](function(_0x1b994a){if(_0x1b994a&&_0x1b994a[_0xfb34('0x56')]===0x0){return db[_0xfb34('0x2d')][_0xfb34('0x4e')]({'name':_0x5c6ca3[_0xfb34('0x30')],'resourceId':_0x5c6ca3['id'],'type':_0x1b994a[_0xfb34('0x30')],'sectionId':_0x1b994a['id']},{})[_0xfb34('0x2a')](function(){return _0x2e3bb5;});}else{return _0x2e3bb5;}})[_0xfb34('0x4b')](function(_0x38e1b4){logger[_0xfb34('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38e1b4);throw _0x38e1b4;});}return _0x2e3bb5;})[_0xfb34('0x2a')](respondWithResult(_0x2b7387,0xc9))[_0xfb34('0x4b')](handleError(_0x2b7387,null));};exports[_0xfb34('0x57')]=function(_0x669dc5,_0x54f6ba){var _0xdc419a={'where':{'id':_0x669dc5[_0xfb34('0x4d')]['id']}},_0x473fd8={};_0x473fd8[_0xfb34('0x3e')]=_['keys'](db[_0xfb34('0x33')][_0xfb34('0x34')]);_0xdc419a[_0xfb34('0x3c')]=_[_0xfb34('0x3b')](_0x473fd8['model'],qs['fields'](_0x669dc5[_0xfb34('0x38')][_0xfb34('0x3d')]));_0xdc419a[_0xfb34('0x3c')]=_0xdc419a[_0xfb34('0x3c')][_0xfb34('0x58')]?_0xdc419a[_0xfb34('0x3c')]:_0x473fd8[_0xfb34('0x3e')];if(_0x669dc5[_0xfb34('0x38')][_0xfb34('0x48')]){_0xdc419a[_0xfb34('0x49')]=[{'all':!![]}];}_0xdc419a=_[_0xfb34('0x44')]({},_0xdc419a,_0x669dc5[_0xfb34('0x47')]);return db[_0xfb34('0x33')][_0xfb34('0x54')](_0xdc419a)[_0xfb34('0x2a')](handleEntityNotFound(_0x54f6ba,null))[_0xfb34('0x2a')](function(_0x86be9d){if(_0x86be9d){var _0x5aa365=_0x86be9d[_0xfb34('0x2c')]({'plain':!![]});_0x5aa365=qs[_0xfb34('0x59')](_0x5aa365,['id',_0xfb34('0x5a'),_0xfb34('0x5b')]);_0x669dc5[_0xfb34('0x4f')]=_['omit'](_0x669dc5['body'],['id',_0xfb34('0x5a'),_0xfb34('0x5b')]);return db[_0xfb34('0x33')][_0xfb34('0x4e')](_[_0xfb34('0x44')](_0x5aa365,_0x669dc5[_0xfb34('0x4f')]),{'include':_0x669dc5[_0xfb34('0x38')][_0xfb34('0x48')]?[{'all':!![]}]:undefined})[_0xfb34('0x2a')](function(_0x457882){var _0x208538=_0x669dc5[_0xfb34('0x50')][_0xfb34('0x2c')]({'plain':!![]});if(!_0x208538)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x208538[_0xfb34('0x5c')]===_0xfb34('0x50')){var _0x50933c=_0x457882['get']({'plain':!![]});var _0x59965a=_0xfb34('0x52');return db[_0xfb34('0x53')][_0xfb34('0x54')]({'where':{'name':_0x59965a,'userProfileId':_0x208538[_0xfb34('0x55')]},'raw':!![]})['then'](function(_0x58c5c6){if(_0x58c5c6&&_0x58c5c6[_0xfb34('0x56')]===0x0){return db[_0xfb34('0x2d')][_0xfb34('0x4e')]({'name':_0x50933c[_0xfb34('0x30')],'resourceId':_0x50933c['id'],'type':_0x58c5c6[_0xfb34('0x30')],'sectionId':_0x58c5c6['id']},{})[_0xfb34('0x2a')](function(){return _0x457882;});}else{return _0x457882;}})[_0xfb34('0x4b')](function(_0x3c3132){logger[_0xfb34('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3132);throw _0x3c3132;});}return _0x457882;});}})['then'](respondWithResult(_0x54f6ba,0xc9))[_0xfb34('0x4b')](handleError(_0x54f6ba,null));};exports[_0xfb34('0x29')]=function(_0x3c2bc9,_0x251124){if(_0x3c2bc9[_0xfb34('0x4f')]['id']){delete _0x3c2bc9[_0xfb34('0x4f')]['id'];}return db[_0xfb34('0x33')]['find']({'where':{'id':_0x3c2bc9[_0xfb34('0x4d')]['id']}})['then'](handleEntityNotFound(_0x251124,null))[_0xfb34('0x2a')](saveUpdates(_0x3c2bc9[_0xfb34('0x4f')],null))[_0xfb34('0x2a')](respondWithResult(_0x251124,null))['catch'](handleError(_0x251124,null));};exports[_0xfb34('0x2b')]=function(_0xa3cad7,_0x2f1f18){return db[_0xfb34('0x33')][_0xfb34('0x54')]({'where':{'id':_0xa3cad7['params']['id']}})[_0xfb34('0x2a')](handleEntityNotFound(_0x2f1f18,null))[_0xfb34('0x2a')](removeEntity(_0x2f1f18,null))[_0xfb34('0x4b')](handleError(_0x2f1f18,null));};function widgetAttributes(_0x358317){try{switch(_0x358317[_0xfb34('0x36')]){case _0xfb34('0x5d'):return[{'name':_0xfb34('0x5e'),'value':_0x358317[_0xfb34('0x5e')]||(_0x358317['attrs']&&_0x358317[_0xfb34('0x5f')][0x0]?_0x358317[_0xfb34('0x5f')][0x0][_0xfb34('0x60')]:undefined)||_0xfb34('0x61')}];case _0xfb34('0x62'):return[{'name':_0xfb34('0x63'),'value':_0x358317['attrPath']||(_0x358317['attrs']&&_0x358317[_0xfb34('0x5f')][0x0]?_0x358317[_0xfb34('0x5f')][0x0][_0xfb34('0x60')]:undefined)||''}];case'clock':return[{'name':_0xfb34('0x64'),'value':_0x358317['attrHourFormat']||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x0]?_0x358317['attrs'][0x0]['value']:undefined)||_0xfb34('0x65')},{'name':_0xfb34('0x66'),'value':_0x358317['attrTimezone']||(_0x358317[_0xfb34('0x5f')]&&_0x358317['attrs'][0x1]?_0x358317[_0xfb34('0x5f')][0x1]['value']:undefined)||_0xfb34('0x67')},{'name':'attrFontSize','value':_0x358317['attrFontSize']||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x2]?_0x358317['attrs'][0x2][_0xfb34('0x60')]:undefined)||0xc}];case _0xfb34('0x68'):return[{'name':_0xfb34('0x69'),'value':_0x358317['attrMetric']||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x0]?_0x358317[_0xfb34('0x5f')][0x0][_0xfb34('0x60')]:undefined)||'total'},{'name':_0xfb34('0x6a'),'value':_0x358317[_0xfb34('0x6a')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x1]?_0x358317[_0xfb34('0x5f')][0x1][_0xfb34('0x60')]:undefined)||[]},{'name':_0xfb34('0x6b'),'value':_0x358317['attrFontSize']||(_0x358317[_0xfb34('0x5f')]&&_0x358317['attrs'][0x2]?_0x358317[_0xfb34('0x5f')][0x2][_0xfb34('0x60')]:undefined)||0x14},{'name':_0xfb34('0x6c'),'value':_0x358317[_0xfb34('0x6c')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x3]?_0x358317['attrs'][0x3][_0xfb34('0x60')]:undefined)||_0xfb34('0x6d')},{'name':_0xfb34('0x6e'),'value':_0x358317[_0xfb34('0x6e')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x4]?_0x358317[_0xfb34('0x5f')][0x4]['value']:undefined)||''},{'name':_0xfb34('0x6f'),'value':_0x358317['attrFaxAccounts']||(_0x358317['attrs']&&_0x358317[_0xfb34('0x5f')][0x5]?_0x358317[_0xfb34('0x5f')][0x5][_0xfb34('0x60')]:undefined)||''},{'name':_0xfb34('0x70'),'value':_0x358317[_0xfb34('0x70')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x6]?_0x358317[_0xfb34('0x5f')][0x6][_0xfb34('0x60')]:undefined)||''},{'name':_0xfb34('0x71'),'value':_0x358317[_0xfb34('0x71')]||(_0x358317['attrs']&&_0x358317['attrs'][0x7]?_0x358317['attrs'][0x7][_0xfb34('0x60')]:undefined)||''},{'name':_0xfb34('0x72'),'value':_0x358317[_0xfb34('0x72')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x8]?_0x358317[_0xfb34('0x5f')][0x8][_0xfb34('0x60')]:undefined)||''},{'name':_0xfb34('0x73'),'value':_0x358317[_0xfb34('0x73')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x9]?_0x358317[_0xfb34('0x5f')][0x9][_0xfb34('0x60')]:undefined)||''}];case _0xfb34('0x74'):case _0xfb34('0x75'):return[{'name':_0xfb34('0x76'),'value':_0x358317[_0xfb34('0x76')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x0]?_0x358317[_0xfb34('0x5f')][0x0][_0xfb34('0x60')]:undefined)||_0xfb34('0x77')},{'name':_0xfb34('0x78'),'value':_0x358317[_0xfb34('0x78')]||(_0x358317['attrs']&&_0x358317[_0xfb34('0x5f')][0x1]?_0x358317[_0xfb34('0x5f')][0x1][_0xfb34('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x358317[_0xfb34('0x79')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317['attrs'][0x2]?_0x358317[_0xfb34('0x5f')][0x2][_0xfb34('0x60')]:undefined)||null},{'name':_0xfb34('0x6a'),'value':_0x358317[_0xfb34('0x6a')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x3]?_0x358317[_0xfb34('0x5f')][0x3][_0xfb34('0x60')]:undefined)||[]},{'name':_0xfb34('0x6c'),'value':_0x358317['attrChannel']||(_0x358317[_0xfb34('0x5f')]&&_0x358317['attrs'][0x4]?_0x358317['attrs'][0x4][_0xfb34('0x60')]:undefined)||_0xfb34('0x6d')},{'name':_0xfb34('0x6e'),'value':_0x358317[_0xfb34('0x6e')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x5]?_0x358317['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x358317[_0xfb34('0x6f')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x6]?_0x358317['attrs'][0x6][_0xfb34('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x358317[_0xfb34('0x70')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x7]?_0x358317[_0xfb34('0x5f')][0x7]['value']:undefined)||''},{'name':_0xfb34('0x71'),'value':_0x358317[_0xfb34('0x71')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x8]?_0x358317[_0xfb34('0x5f')][0x8][_0xfb34('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x358317[_0xfb34('0x72')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317['attrs'][0x9]?_0x358317[_0xfb34('0x5f')][0x9][_0xfb34('0x60')]:undefined)||''},{'name':_0xfb34('0x73'),'value':_0x358317['attrChatWebsites']||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0xa]?_0x358317['attrs'][0xa][_0xfb34('0x60')]:undefined)||''}];case _0xfb34('0x7a'):return[{'name':_0xfb34('0x7b'),'type':_0x358317['reportType']||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x0]?_0x358317['attrs'][0x0]['type']:undefined)||null,'value':_0x358317[_0xfb34('0x7b')]||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x0]?_0x358317['attrs'][0x0][_0xfb34('0x60')]:undefined)||null},{'name':_0xfb34('0x7c'),'value':_0x358317['attrRefresh']||(_0x358317[_0xfb34('0x5f')]&&_0x358317[_0xfb34('0x5f')][0x1]?_0x358317[_0xfb34('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1dd32d){logger[_0xfb34('0x2e')](_0xfb34('0x7d'),JSON['stringify'](_0x1dd32d));return[];}}exports[_0xfb34('0x7e')]=function(_0x2f1d8a,_0x38b6e2,_0x477138){if(_0x2f1d8a[_0xfb34('0x4f')]['id']){delete _0x2f1d8a[_0xfb34('0x4f')]['id'];}return db[_0xfb34('0x33')][_0xfb34('0x54')]({'where':{'id':_0x2f1d8a['params']['id']}})[_0xfb34('0x2a')](handleEntityNotFound(_0x38b6e2,null))[_0xfb34('0x2a')](function(_0x405fee){if(_0x405fee){_0x2f1d8a[_0xfb34('0x4f')]['DashboardId']=_0x405fee['id'];_0x2f1d8a[_0xfb34('0x4f')][_0xfb34('0x5f')]=widgetAttributes(_0x2f1d8a[_0xfb34('0x4f')]);return db['DashboardItem']['create'](_0x2f1d8a[_0xfb34('0x4f')]);}})[_0xfb34('0x2a')](respondWithResult(_0x38b6e2,null))['catch'](handleError(_0x38b6e2,null));};exports['getItems']=function(_0x2518b5,_0x1dd883,_0x1708ca){var _0x5c4cbf={};var _0x1d8f41={};var _0xcd7ce3;var _0x47cbe9;return db[_0xfb34('0x33')][_0xfb34('0x7f')]({'where':{'id':_0x2518b5[_0xfb34('0x4d')]['id']}})[_0xfb34('0x2a')](handleEntityNotFound(_0x1dd883,null))[_0xfb34('0x2a')](function(_0x327c85){if(_0x327c85){_0xcd7ce3=_0x327c85;_0x1d8f41[_0xfb34('0x3e')]=_[_0xfb34('0x39')](db[_0xfb34('0x80')]['rawAttributes']);_0x1d8f41[_0xfb34('0x38')]=_[_0xfb34('0x39')](_0x2518b5[_0xfb34('0x38')]);_0x1d8f41[_0xfb34('0x3a')]=_['intersection'](_0x1d8f41[_0xfb34('0x3e')],_0x1d8f41['query']);_0x5c4cbf[_0xfb34('0x3c')]=_['intersection'](_0x1d8f41['model'],qs[_0xfb34('0x3d')](_0x2518b5[_0xfb34('0x38')]['fields']));_0x5c4cbf[_0xfb34('0x3c')]=_0x5c4cbf[_0xfb34('0x3c')]['length']?_0x5c4cbf[_0xfb34('0x3c')]:_0x1d8f41[_0xfb34('0x3e')];_0x5c4cbf[_0xfb34('0x40')]=qs[_0xfb34('0x41')](_0x2518b5[_0xfb34('0x38')][_0xfb34('0x41')]);_0x5c4cbf[_0xfb34('0x42')]=qs['filters'](_[_0xfb34('0x81')](_0x2518b5[_0xfb34('0x38')],_0x1d8f41[_0xfb34('0x3a')]));if(_0x2518b5[_0xfb34('0x38')][_0xfb34('0x43')]){_0x5c4cbf[_0xfb34('0x42')]=_['merge'](_0x5c4cbf[_0xfb34('0x42')],{'$or':_[_0xfb34('0x45')](_0x5c4cbf[_0xfb34('0x3c')],function(_0x544afe){var _0x23122f={};_0x23122f[_0x544afe]={'$like':'%'+_0x2518b5[_0xfb34('0x38')][_0xfb34('0x43')]+'%'};return _0x23122f;})});}_0x5c4cbf=_[_0xfb34('0x44')]({},_0x5c4cbf,_0x2518b5[_0xfb34('0x47')]);return _0xcd7ce3[_0xfb34('0x82')](_0x5c4cbf);}})[_0xfb34('0x2a')](function(_0x40230f){if(_0x40230f){_0x47cbe9=_0x40230f[_0xfb34('0x58')];if(!_0x2518b5['query']['hasOwnProperty'](_0xfb34('0x83'))){_0x5c4cbf[_0xfb34('0x22')]=qs[_0xfb34('0x22')](_0x2518b5[_0xfb34('0x38')]['limit']);_0x5c4cbf['offset']=qs[_0xfb34('0x20')](_0x2518b5[_0xfb34('0x38')][_0xfb34('0x20')]);}return _0xcd7ce3[_0xfb34('0x82')](_0x5c4cbf);}})[_0xfb34('0x2a')](function(_0x4b2a0b){if(_0x4b2a0b){return _0x4b2a0b?{'count':_0x47cbe9,'rows':_0x4b2a0b}:null;}})[_0xfb34('0x2a')](respondWithResult(_0x1dd883,null))[_0xfb34('0x4b')](handleError(_0x1dd883,null));}; \ No newline at end of file +var _0xd6d0=['attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','merge','filter','options','Dashboard','includeAll','findAll','rows','catch','keys','include','find','create','body','user','UserProfileSection','autoAssociation','params','omit','createdAt','updatedAt','role','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6d0,0x84));var _0x0d6d=function(_0xa6bacf,_0x51b3a){_0xa6bacf=_0xa6bacf-0x0;var _0x21b5af=_0xd6d0[_0xa6bacf];return _0x21b5af;};'use strict';var emlformat=require(_0x0d6d('0x0'));var rimraf=require(_0x0d6d('0x1'));var zipdir=require(_0x0d6d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d6d('0x3'));var moment=require(_0x0d6d('0x4'));var BPromise=require(_0x0d6d('0x5'));var Mustache=require(_0x0d6d('0x6'));var util=require('util');var path=require(_0x0d6d('0x7'));var sox=require(_0x0d6d('0x8'));var csv=require(_0x0d6d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d6d('0xa'));var _=require(_0x0d6d('0xb'));var squel=require('squel');var crypto=require(_0x0d6d('0xc'));var jsforce=require(_0x0d6d('0xd'));var deskjs=require(_0x0d6d('0xe'));var toCsv=require(_0x0d6d('0x9'));var querystring=require(_0x0d6d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d6d('0x10'));var qs=require(_0x0d6d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d6d('0x12'));var logger=require(_0x0d6d('0x13'))(_0x0d6d('0x14'));var utils=require(_0x0d6d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0d6d('0x16'));var db=require(_0x0d6d('0x17'))['db'];config[_0x0d6d('0x18')]=_[_0x0d6d('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0d6d('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')[_0x0d6d('0x1b')](socket);function respondWithStatusCode(_0xde8296,_0x1741e1){_0x1741e1=_0x1741e1||0xcc;return function(_0x2b4af9){if(_0x2b4af9){return _0xde8296[_0x0d6d('0x1c')](_0x1741e1);}return _0xde8296[_0x0d6d('0x1d')](_0x1741e1)[_0x0d6d('0x1e')]();};}function respondWithResult(_0xa0709a,_0x2b1b0c){_0x2b1b0c=_0x2b1b0c||0xc8;return function(_0x3a68c0){if(_0x3a68c0){return _0xa0709a[_0x0d6d('0x1d')](_0x2b1b0c)[_0x0d6d('0x1f')](_0x3a68c0);}};}function respondWithFilteredResult(_0x4f9272,_0x5cff5a){return function(_0x4a85de){if(_0x4a85de){var _0x40cb25=typeof _0x5cff5a['offset']===_0x0d6d('0x20')&&typeof _0x5cff5a['limit']===_0x0d6d('0x20');var _0x3804ff=_0x4a85de['count'];var _0x210075=_0x40cb25?0x0:_0x5cff5a['offset'];var _0x1d1a3f=_0x40cb25?_0x4a85de[_0x0d6d('0x21')]:_0x5cff5a[_0x0d6d('0x22')]+_0x5cff5a['limit'];var _0x5d698b;if(_0x1d1a3f>=_0x3804ff){_0x1d1a3f=_0x3804ff;_0x5d698b=0xc8;}else{_0x5d698b=0xce;}_0x4f9272[_0x0d6d('0x1d')](_0x5d698b);return _0x4f9272[_0x0d6d('0x23')](_0x0d6d('0x24'),_0x210075+'-'+_0x1d1a3f+'/'+_0x3804ff)[_0x0d6d('0x1f')](_0x4a85de);}return null;};}function patchUpdates(_0x46201c){return function(_0xbfb7db){try{jsonpatch[_0x0d6d('0x25')](_0xbfb7db,_0x46201c,!![]);}catch(_0x2506c2){return BPromise['reject'](_0x2506c2);}return _0xbfb7db[_0x0d6d('0x26')]();};}function saveUpdates(_0x4b2c88,_0xf2c167){return function(_0x5b9725){if(_0x5b9725){return _0x5b9725[_0x0d6d('0x27')](_0x4b2c88)[_0x0d6d('0x28')](function(_0xec482a){return _0xec482a;});}return null;};}function removeEntity(_0xa43461,_0x4ca3ad){return function(_0x117e47){if(_0x117e47){return _0x117e47['destroy']()[_0x0d6d('0x28')](function(){var _0x47b3d0=_0x117e47[_0x0d6d('0x29')]({'plain':!![]});var _0x3b7fe0=_0x0d6d('0x2a');return db[_0x0d6d('0x2b')][_0x0d6d('0x2c')]({'where':{'type':_0x3b7fe0,'resourceId':_0x47b3d0['id']}})['then'](function(){return _0x117e47;});})[_0x0d6d('0x28')](function(){_0xa43461[_0x0d6d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14adc1,_0x52e0d2){return function(_0x8c7c72){if(!_0x8c7c72){_0x14adc1[_0x0d6d('0x1c')](0x194);}return _0x8c7c72;};}function handleError(_0x4ed308,_0x15ea54){_0x15ea54=_0x15ea54||0x1f4;return function(_0x58b196){logger[_0x0d6d('0x2d')](_0x58b196['stack']);if(_0x58b196[_0x0d6d('0x2e')]){delete _0x58b196[_0x0d6d('0x2e')];}_0x4ed308[_0x0d6d('0x1d')](_0x15ea54)['send'](_0x58b196);};}exports[_0x0d6d('0x2f')]=function(_0x135d11,_0x5f3d73){var _0x138162={},_0x2395f7={},_0x28b4be={'count':0x0,'rows':[]};var _0x1dfced=_[_0x0d6d('0x30')](db['Dashboard'][_0x0d6d('0x31')],function(_0x4d4d5f){return{'name':_0x4d4d5f[_0x0d6d('0x32')],'type':_0x4d4d5f[_0x0d6d('0x33')][_0x0d6d('0x34')]};});_0x2395f7[_0x0d6d('0x35')]=_[_0x0d6d('0x30')](_0x1dfced,_0x0d6d('0x2e'));_0x2395f7[_0x0d6d('0x36')]=_['keys'](_0x135d11[_0x0d6d('0x36')]);_0x2395f7[_0x0d6d('0x37')]=_[_0x0d6d('0x38')](_0x2395f7[_0x0d6d('0x35')],_0x2395f7['query']);_0x138162[_0x0d6d('0x39')]=_[_0x0d6d('0x38')](_0x2395f7['model'],qs[_0x0d6d('0x3a')](_0x135d11[_0x0d6d('0x36')][_0x0d6d('0x3a')]));_0x138162[_0x0d6d('0x39')]=_0x138162['attributes'][_0x0d6d('0x3b')]?_0x138162[_0x0d6d('0x39')]:_0x2395f7[_0x0d6d('0x35')];if(!_0x135d11['query']['hasOwnProperty'](_0x0d6d('0x3c'))){_0x138162[_0x0d6d('0x3d')]=qs['limit'](_0x135d11[_0x0d6d('0x36')]['limit']);_0x138162[_0x0d6d('0x22')]=qs[_0x0d6d('0x22')](_0x135d11['query']['offset']);}_0x138162['order']=qs[_0x0d6d('0x3e')](_0x135d11[_0x0d6d('0x36')][_0x0d6d('0x3e')]);_0x138162[_0x0d6d('0x3f')]=qs[_0x0d6d('0x37')](_[_0x0d6d('0x40')](_0x135d11[_0x0d6d('0x36')],_0x2395f7[_0x0d6d('0x37')]),_0x1dfced);if(_0x135d11[_0x0d6d('0x36')]['filter']){_0x138162['where']=_[_0x0d6d('0x41')](_0x138162[_0x0d6d('0x3f')],{'$or':_[_0x0d6d('0x30')](_0x1dfced,function(_0x18390b){if(_0x18390b[_0x0d6d('0x33')]!=='VIRTUAL'){var _0xa05716={};_0xa05716[_0x18390b[_0x0d6d('0x2e')]]={'$like':'%'+_0x135d11['query'][_0x0d6d('0x42')]+'%'};return _0xa05716;}})});}_0x138162=_['merge']({},_0x138162,_0x135d11[_0x0d6d('0x43')]);var _0x193629={'where':_0x138162[_0x0d6d('0x3f')]};return db[_0x0d6d('0x44')]['count'](_0x193629)[_0x0d6d('0x28')](function(_0x1ef1f5){_0x28b4be['count']=_0x1ef1f5;if(_0x135d11[_0x0d6d('0x36')][_0x0d6d('0x45')]){_0x138162['include']=[{'all':!![]}];}return db[_0x0d6d('0x44')][_0x0d6d('0x46')](_0x138162);})['then'](function(_0x5d917d){_0x28b4be[_0x0d6d('0x47')]=_0x5d917d;return _0x28b4be;})[_0x0d6d('0x28')](respondWithFilteredResult(_0x5f3d73,_0x138162))[_0x0d6d('0x48')](handleError(_0x5f3d73,null));};exports['show']=function(_0x4d4423,_0x421e6e){var _0x6ee10b={'raw':![],'where':{'id':_0x4d4423['params']['id']}},_0x47778b={};_0x47778b[_0x0d6d('0x35')]=_[_0x0d6d('0x49')](db[_0x0d6d('0x44')]['rawAttributes']);_0x47778b[_0x0d6d('0x36')]=_[_0x0d6d('0x49')](_0x4d4423[_0x0d6d('0x36')]);_0x47778b[_0x0d6d('0x37')]=_[_0x0d6d('0x38')](_0x47778b[_0x0d6d('0x35')],_0x47778b[_0x0d6d('0x36')]);_0x6ee10b['attributes']=_[_0x0d6d('0x38')](_0x47778b[_0x0d6d('0x35')],qs[_0x0d6d('0x3a')](_0x4d4423['query'][_0x0d6d('0x3a')]));_0x6ee10b[_0x0d6d('0x39')]=_0x6ee10b['attributes'][_0x0d6d('0x3b')]?_0x6ee10b[_0x0d6d('0x39')]:_0x47778b[_0x0d6d('0x35')];if(_0x4d4423[_0x0d6d('0x36')][_0x0d6d('0x45')]){_0x6ee10b[_0x0d6d('0x4a')]=[{'all':!![]}];}_0x6ee10b=_['merge']({},_0x6ee10b,_0x4d4423[_0x0d6d('0x43')]);return db[_0x0d6d('0x44')][_0x0d6d('0x4b')](_0x6ee10b)[_0x0d6d('0x28')](handleEntityNotFound(_0x421e6e,null))[_0x0d6d('0x28')](respondWithResult(_0x421e6e,null))[_0x0d6d('0x48')](handleError(_0x421e6e,null));};exports[_0x0d6d('0x4c')]=function(_0xed72e1,_0x2a98d2){return db[_0x0d6d('0x44')]['create'](_0xed72e1[_0x0d6d('0x4d')],{})[_0x0d6d('0x28')](function(_0x486191){var _0x43b496=_0xed72e1[_0x0d6d('0x4e')][_0x0d6d('0x29')]({'plain':!![]});if(!_0x43b496)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43b496['role']===_0x0d6d('0x4e')){var _0x3b528d=_0x486191[_0x0d6d('0x29')]({'plain':!![]});var _0x2b3858=_0x0d6d('0x2a');return db[_0x0d6d('0x4f')][_0x0d6d('0x4b')]({'where':{'name':_0x2b3858,'userProfileId':_0x43b496['userProfileId']},'raw':!![]})[_0x0d6d('0x28')](function(_0x3cc56a){if(_0x3cc56a&&_0x3cc56a[_0x0d6d('0x50')]===0x0){return db[_0x0d6d('0x2b')]['create']({'name':_0x3b528d[_0x0d6d('0x2e')],'resourceId':_0x3b528d['id'],'type':_0x3cc56a[_0x0d6d('0x2e')],'sectionId':_0x3cc56a['id']},{})[_0x0d6d('0x28')](function(){return _0x486191;});}else{return _0x486191;}})[_0x0d6d('0x48')](function(_0xe90f8b){logger[_0x0d6d('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe90f8b);throw _0xe90f8b;});}return _0x486191;})[_0x0d6d('0x28')](respondWithResult(_0x2a98d2,0xc9))[_0x0d6d('0x48')](handleError(_0x2a98d2,null));};exports['clone']=function(_0x5f55a5,_0x1a66e8){var _0x2e1568={'where':{'id':_0x5f55a5[_0x0d6d('0x51')]['id']}},_0x273115={};_0x273115[_0x0d6d('0x35')]=_[_0x0d6d('0x49')](db['Dashboard'][_0x0d6d('0x31')]);_0x2e1568[_0x0d6d('0x39')]=_[_0x0d6d('0x38')](_0x273115['model'],qs[_0x0d6d('0x3a')](_0x5f55a5[_0x0d6d('0x36')][_0x0d6d('0x3a')]));_0x2e1568[_0x0d6d('0x39')]=_0x2e1568[_0x0d6d('0x39')][_0x0d6d('0x3b')]?_0x2e1568[_0x0d6d('0x39')]:_0x273115[_0x0d6d('0x35')];if(_0x5f55a5[_0x0d6d('0x36')][_0x0d6d('0x45')]){_0x2e1568['include']=[{'all':!![]}];}_0x2e1568=_[_0x0d6d('0x41')]({},_0x2e1568,_0x5f55a5[_0x0d6d('0x43')]);return db[_0x0d6d('0x44')][_0x0d6d('0x4b')](_0x2e1568)['then'](handleEntityNotFound(_0x1a66e8,null))[_0x0d6d('0x28')](function(_0x33ca61){if(_0x33ca61){var _0x1d8af4=_0x33ca61['get']({'plain':!![]});_0x1d8af4=qs[_0x0d6d('0x52')](_0x1d8af4,['id',_0x0d6d('0x53'),_0x0d6d('0x54')]);_0x5f55a5['body']=_[_0x0d6d('0x52')](_0x5f55a5[_0x0d6d('0x4d')],['id',_0x0d6d('0x53'),_0x0d6d('0x54')]);return db[_0x0d6d('0x44')][_0x0d6d('0x4c')](_['merge'](_0x1d8af4,_0x5f55a5['body']),{'include':_0x5f55a5[_0x0d6d('0x36')][_0x0d6d('0x45')]?[{'all':!![]}]:undefined})[_0x0d6d('0x28')](function(_0x192041){var _0x26f1c1=_0x5f55a5['user'][_0x0d6d('0x29')]({'plain':!![]});if(!_0x26f1c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26f1c1[_0x0d6d('0x55')]===_0x0d6d('0x4e')){var _0xe81eb2=_0x192041['get']({'plain':!![]});var _0x415f88=_0x0d6d('0x2a');return db[_0x0d6d('0x4f')][_0x0d6d('0x4b')]({'where':{'name':_0x415f88,'userProfileId':_0x26f1c1[_0x0d6d('0x56')]},'raw':!![]})[_0x0d6d('0x28')](function(_0xeb98c5){if(_0xeb98c5&&_0xeb98c5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xe81eb2['name'],'resourceId':_0xe81eb2['id'],'type':_0xeb98c5[_0x0d6d('0x2e')],'sectionId':_0xeb98c5['id']},{})['then'](function(){return _0x192041;});}else{return _0x192041;}})['catch'](function(_0x124771){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x124771);throw _0x124771;});}return _0x192041;});}})[_0x0d6d('0x28')](respondWithResult(_0x1a66e8,0xc9))[_0x0d6d('0x48')](handleError(_0x1a66e8,null));};exports['update']=function(_0xfe99c4,_0x5e1997){if(_0xfe99c4[_0x0d6d('0x4d')]['id']){delete _0xfe99c4[_0x0d6d('0x4d')]['id'];}return db[_0x0d6d('0x44')][_0x0d6d('0x4b')]({'where':{'id':_0xfe99c4[_0x0d6d('0x51')]['id']}})['then'](handleEntityNotFound(_0x5e1997,null))['then'](saveUpdates(_0xfe99c4['body'],null))[_0x0d6d('0x28')](respondWithResult(_0x5e1997,null))['catch'](handleError(_0x5e1997,null));};exports['destroy']=function(_0xdab905,_0x43c572){return db[_0x0d6d('0x44')][_0x0d6d('0x4b')]({'where':{'id':_0xdab905['params']['id']}})[_0x0d6d('0x28')](handleEntityNotFound(_0x43c572,null))[_0x0d6d('0x28')](removeEntity(_0x43c572,null))[_0x0d6d('0x48')](handleError(_0x43c572,null));};function widgetAttributes(_0x3c6482){try{switch(_0x3c6482[_0x0d6d('0x33')]){case _0x0d6d('0x57'):return[{'name':_0x0d6d('0x58'),'value':_0x3c6482['attrUrl']||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x0]?_0x3c6482['attrs'][0x0][_0x0d6d('0x5a')]:undefined)||_0x0d6d('0x5b')}];case _0x0d6d('0x5c'):return[{'name':_0x0d6d('0x5d'),'value':_0x3c6482[_0x0d6d('0x5d')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x0]?_0x3c6482[_0x0d6d('0x59')][0x0][_0x0d6d('0x5a')]:undefined)||''}];case _0x0d6d('0x5e'):return[{'name':'attrHourFormat','value':_0x3c6482[_0x0d6d('0x5f')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x0]?_0x3c6482[_0x0d6d('0x59')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x0d6d('0x60'),'value':_0x3c6482[_0x0d6d('0x60')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482['attrs'][0x1]?_0x3c6482[_0x0d6d('0x59')][0x1]['value']:undefined)||_0x0d6d('0x61')},{'name':_0x0d6d('0x62'),'value':_0x3c6482[_0x0d6d('0x62')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x2]?_0x3c6482[_0x0d6d('0x59')][0x2][_0x0d6d('0x5a')]:undefined)||0xc}];case _0x0d6d('0x63'):return[{'name':_0x0d6d('0x64'),'value':_0x3c6482[_0x0d6d('0x64')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482['attrs'][0x0]?_0x3c6482[_0x0d6d('0x59')][0x0][_0x0d6d('0x5a')]:undefined)||'total'},{'name':_0x0d6d('0x65'),'value':_0x3c6482[_0x0d6d('0x65')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x1]?_0x3c6482[_0x0d6d('0x59')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3c6482[_0x0d6d('0x62')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x2]?_0x3c6482['attrs'][0x2][_0x0d6d('0x5a')]:undefined)||0x14},{'name':_0x0d6d('0x66'),'value':_0x3c6482['attrChannel']||(_0x3c6482['attrs']&&_0x3c6482['attrs'][0x3]?_0x3c6482[_0x0d6d('0x59')][0x3][_0x0d6d('0x5a')]:undefined)||_0x0d6d('0x67')},{'name':_0x0d6d('0x68'),'value':_0x3c6482[_0x0d6d('0x68')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482['attrs'][0x4]?_0x3c6482[_0x0d6d('0x59')][0x4][_0x0d6d('0x5a')]:undefined)||''},{'name':_0x0d6d('0x69'),'value':_0x3c6482[_0x0d6d('0x69')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x5]?_0x3c6482[_0x0d6d('0x59')][0x5][_0x0d6d('0x5a')]:undefined)||''},{'name':_0x0d6d('0x6a'),'value':_0x3c6482['attrSmsAccounts']||(_0x3c6482['attrs']&&_0x3c6482['attrs'][0x6]?_0x3c6482[_0x0d6d('0x59')][0x6][_0x0d6d('0x5a')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c6482[_0x0d6d('0x6b')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x7]?_0x3c6482[_0x0d6d('0x59')][0x7][_0x0d6d('0x5a')]:undefined)||''},{'name':_0x0d6d('0x6c'),'value':_0x3c6482[_0x0d6d('0x6c')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482['attrs'][0x8]?_0x3c6482[_0x0d6d('0x59')][0x8][_0x0d6d('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3c6482[_0x0d6d('0x6d')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x9]?_0x3c6482[_0x0d6d('0x59')][0x9][_0x0d6d('0x5a')]:undefined)||''}];case _0x0d6d('0x6e'):case _0x0d6d('0x6f'):return[{'name':_0x0d6d('0x70'),'value':_0x3c6482['attrSerie1']||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x0]?_0x3c6482['attrs'][0x0][_0x0d6d('0x5a')]:undefined)||'total'},{'name':_0x0d6d('0x71'),'value':_0x3c6482[_0x0d6d('0x71')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x1]?_0x3c6482[_0x0d6d('0x59')][0x1][_0x0d6d('0x5a')]:undefined)||null},{'name':_0x0d6d('0x72'),'value':_0x3c6482[_0x0d6d('0x72')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x2]?_0x3c6482[_0x0d6d('0x59')][0x2][_0x0d6d('0x5a')]:undefined)||null},{'name':_0x0d6d('0x65'),'value':_0x3c6482['attrVoiceQueues']||(_0x3c6482['attrs']&&_0x3c6482[_0x0d6d('0x59')][0x3]?_0x3c6482[_0x0d6d('0x59')][0x3][_0x0d6d('0x5a')]:undefined)||[]},{'name':_0x0d6d('0x66'),'value':_0x3c6482[_0x0d6d('0x66')]||(_0x3c6482['attrs']&&_0x3c6482['attrs'][0x4]?_0x3c6482[_0x0d6d('0x59')][0x4]['value']:undefined)||_0x0d6d('0x67')},{'name':_0x0d6d('0x68'),'value':_0x3c6482[_0x0d6d('0x68')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x5]?_0x3c6482[_0x0d6d('0x59')][0x5][_0x0d6d('0x5a')]:undefined)||''},{'name':_0x0d6d('0x69'),'value':_0x3c6482['attrFaxAccounts']||(_0x3c6482['attrs']&&_0x3c6482['attrs'][0x6]?_0x3c6482[_0x0d6d('0x59')][0x6][_0x0d6d('0x5a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c6482[_0x0d6d('0x6a')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x7]?_0x3c6482[_0x0d6d('0x59')][0x7][_0x0d6d('0x5a')]:undefined)||''},{'name':_0x0d6d('0x6b'),'value':_0x3c6482[_0x0d6d('0x6b')]||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482['attrs'][0x8]?_0x3c6482[_0x0d6d('0x59')][0x8]['value']:undefined)||''},{'name':_0x0d6d('0x6c'),'value':_0x3c6482[_0x0d6d('0x6c')]||(_0x3c6482['attrs']&&_0x3c6482['attrs'][0x9]?_0x3c6482[_0x0d6d('0x59')][0x9][_0x0d6d('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3c6482['attrChatWebsites']||(_0x3c6482['attrs']&&_0x3c6482['attrs'][0xa]?_0x3c6482[_0x0d6d('0x59')][0xa][_0x0d6d('0x5a')]:undefined)||''}];case _0x0d6d('0x73'):return[{'name':_0x0d6d('0x74'),'type':_0x3c6482[_0x0d6d('0x75')]||(_0x3c6482['attrs']&&_0x3c6482[_0x0d6d('0x59')][0x0]?_0x3c6482[_0x0d6d('0x59')][0x0]['type']:undefined)||null,'value':_0x3c6482['attrReport']||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x0]?_0x3c6482[_0x0d6d('0x59')][0x0]['value']:undefined)||null},{'name':_0x0d6d('0x76'),'value':_0x3c6482['attrRefresh']||(_0x3c6482[_0x0d6d('0x59')]&&_0x3c6482[_0x0d6d('0x59')][0x1]?_0x3c6482[_0x0d6d('0x59')][0x1][_0x0d6d('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x562bec){logger[_0x0d6d('0x2d')]('widgetAttributes:\x20%s',JSON[_0x0d6d('0x77')](_0x562bec));return[];}}exports[_0x0d6d('0x78')]=function(_0x58e3f4,_0x3eacd6,_0x318b74){if(_0x58e3f4['body']['id']){delete _0x58e3f4[_0x0d6d('0x4d')]['id'];}return db[_0x0d6d('0x44')][_0x0d6d('0x4b')]({'where':{'id':_0x58e3f4[_0x0d6d('0x51')]['id']}})[_0x0d6d('0x28')](handleEntityNotFound(_0x3eacd6,null))[_0x0d6d('0x28')](function(_0x5cd431){if(_0x5cd431){_0x58e3f4['body'][_0x0d6d('0x79')]=_0x5cd431['id'];_0x58e3f4['body'][_0x0d6d('0x59')]=widgetAttributes(_0x58e3f4[_0x0d6d('0x4d')]);return db[_0x0d6d('0x7a')]['create'](_0x58e3f4[_0x0d6d('0x4d')]);}})[_0x0d6d('0x28')](respondWithResult(_0x3eacd6,null))['catch'](handleError(_0x3eacd6,null));};exports[_0x0d6d('0x7b')]=function(_0x43ab84,_0x48ffe4,_0x1d62f0){var _0x2a84ce={};var _0xac54a0={};var _0x572158;var _0xbea622;return db[_0x0d6d('0x44')]['findOne']({'where':{'id':_0x43ab84[_0x0d6d('0x51')]['id']}})[_0x0d6d('0x28')](handleEntityNotFound(_0x48ffe4,null))[_0x0d6d('0x28')](function(_0x4eaf05){if(_0x4eaf05){_0x572158=_0x4eaf05;_0xac54a0['model']=_[_0x0d6d('0x49')](db['DashboardItem'][_0x0d6d('0x31')]);_0xac54a0[_0x0d6d('0x36')]=_[_0x0d6d('0x49')](_0x43ab84['query']);_0xac54a0[_0x0d6d('0x37')]=_['intersection'](_0xac54a0[_0x0d6d('0x35')],_0xac54a0[_0x0d6d('0x36')]);_0x2a84ce[_0x0d6d('0x39')]=_[_0x0d6d('0x38')](_0xac54a0[_0x0d6d('0x35')],qs['fields'](_0x43ab84[_0x0d6d('0x36')]['fields']));_0x2a84ce[_0x0d6d('0x39')]=_0x2a84ce['attributes']['length']?_0x2a84ce['attributes']:_0xac54a0[_0x0d6d('0x35')];_0x2a84ce['order']=qs[_0x0d6d('0x3e')](_0x43ab84[_0x0d6d('0x36')][_0x0d6d('0x3e')]);_0x2a84ce[_0x0d6d('0x3f')]=qs[_0x0d6d('0x37')](_[_0x0d6d('0x40')](_0x43ab84['query'],_0xac54a0['filters']));if(_0x43ab84[_0x0d6d('0x36')]['filter']){_0x2a84ce[_0x0d6d('0x3f')]=_[_0x0d6d('0x41')](_0x2a84ce[_0x0d6d('0x3f')],{'$or':_[_0x0d6d('0x30')](_0x2a84ce[_0x0d6d('0x39')],function(_0x5b555a){var _0x19bbb9={};_0x19bbb9[_0x5b555a]={'$like':'%'+_0x43ab84[_0x0d6d('0x36')][_0x0d6d('0x42')]+'%'};return _0x19bbb9;})});}_0x2a84ce=_[_0x0d6d('0x41')]({},_0x2a84ce,_0x43ab84['options']);return _0x572158[_0x0d6d('0x7b')](_0x2a84ce);}})[_0x0d6d('0x28')](function(_0x570d62){if(_0x570d62){_0xbea622=_0x570d62['length'];if(!_0x43ab84[_0x0d6d('0x36')][_0x0d6d('0x7c')](_0x0d6d('0x3c'))){_0x2a84ce[_0x0d6d('0x3d')]=qs[_0x0d6d('0x3d')](_0x43ab84['query'][_0x0d6d('0x3d')]);_0x2a84ce['offset']=qs[_0x0d6d('0x22')](_0x43ab84[_0x0d6d('0x36')][_0x0d6d('0x22')]);}return _0x572158['getItems'](_0x2a84ce);}})[_0x0d6d('0x28')](function(_0x5c03fd){if(_0x5c03fd){return _0x5c03fd?{'count':_0xbea622,'rows':_0x5c03fd}:null;}})['then'](respondWithResult(_0x48ffe4,null))[_0x0d6d('0x48')](handleError(_0x48ffe4,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c04d360..a2c47a0 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 _0x778d=['../../mysqldb','Dashboard','save','update','remove','emit','exports'];(function(_0x1acc2d,_0x1cfdac){var _0x1cc820=function(_0x4b7492){while(--_0x4b7492){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0x1cc820(++_0x1cfdac);}(_0x778d,0x70));var _0xd778=function(_0x50a535,_0x46bf43){_0x50a535=_0x50a535-0x0;var _0x454dfd=_0x778d[_0x50a535];return _0x454dfd;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xd778('0x0'))['db'][_0xd778('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd778('0x2'),'afterUpdate':_0xd778('0x3'),'afterDestroy':_0xd778('0x4')};function emitEvent(_0x430061){return function(_0x37c795,_0x1b564c,_0x17b446){DashboardEvents[_0xd778('0x5')](_0x430061+':'+_0x37c795['id'],_0x37c795);DashboardEvents['emit'](_0x430061,_0x37c795);_0x17b446(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xd778('0x6')]=DashboardEvents; \ No newline at end of file +var _0xc962=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0xf8e09d,_0x5dc9ac){var _0x3e12bb=function(_0x55abc7){while(--_0x55abc7){_0xf8e09d['push'](_0xf8e09d['shift']());}};_0x3e12bb(++_0x5dc9ac);}(_0xc962,0x6d));var _0x2c96=function(_0x3ed89f,_0x7ca585){_0x3ed89f=_0x3ed89f-0x0;var _0xea8809=_0xc962[_0x3ed89f];return _0xea8809;};'use strict';var EventEmitter=require(_0x2c96('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c96('0x1'),'afterUpdate':_0x2c96('0x2'),'afterDestroy':_0x2c96('0x3')};function emitEvent(_0x1a1faf){return function(_0x305702,_0x83568f,_0x451d99){DashboardEvents[_0x2c96('0x4')](_0x1a1faf+':'+_0x305702['id'],_0x305702);DashboardEvents['emit'](_0x1a1faf,_0x305702);_0x451d99(null);};}for(var e in events){if(events[_0x2c96('0x5')](e)){var event=events[e];Dashboard[_0x2c96('0x6')](e,emitEvent(event));}}module[_0x2c96('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2a32359..7c94f01 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 _0x143c=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Dashboard','lodash'];(function(_0x482fe7,_0x4b22ce){var _0xcd7f1f=function(_0x480d98){while(--_0x480d98){_0x482fe7['push'](_0x482fe7['shift']());}};_0xcd7f1f(++_0x4b22ce);}(_0x143c,0xe3));var _0xc143=function(_0x7767c3,_0x4825ac){_0x7767c3=_0x7767c3-0x0;var _0x1f22a1=_0x143c[_0x7767c3];return _0x1f22a1;};'use strict';var _=require(_0xc143('0x0'));var util=require(_0xc143('0x1'));var logger=require(_0xc143('0x2'))(_0xc143('0x3'));var moment=require(_0xc143('0x4'));var BPromise=require(_0xc143('0x5'));var rp=require(_0xc143('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc143('0x7'));var config=require(_0xc143('0x8'));var attributes=require('./dashboard.attributes');module[_0xc143('0x9')]=function(_0x3aec1c,_0x1358ec){return _0x3aec1c[_0xc143('0xa')](_0xc143('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf45=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf45,0x168));var _0x5cf4=function(_0x563451,_0x225bca){_0x563451=_0x563451-0x0;var _0x43f99e=_0xcf45[_0x563451];return _0x43f99e;};'use strict';var _=require(_0x5cf4('0x0'));var util=require(_0x5cf4('0x1'));var logger=require(_0x5cf4('0x2'))('api');var moment=require(_0x5cf4('0x3'));var BPromise=require(_0x5cf4('0x4'));var rp=require(_0x5cf4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cf4('0x6'));var config=require(_0x5cf4('0x7'));var attributes=require(_0x5cf4('0x8'));module['exports']=function(_0x196a84,_0x325ac6){return _0x196a84[_0x5cf4('0x9')](_0x5cf4('0xa'),attributes,{'tableName':_0x5cf4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 98a839c..03fbb14 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 _0x060d=['defaults','localhost','./dashboard.socket','register','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','code','Dashboard,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x2f8b0f,_0x532d7c){var _0x34273d=function(_0x4f0816){while(--_0x4f0816){_0x2f8b0f['push'](_0x2f8b0f['shift']());}};_0x34273d(++_0x532d7c);}(_0x060d,0x137));var _0xd060=function(_0x21c8b9,_0x2f23cc){_0x21c8b9=_0x21c8b9-0x0;var _0xcaa03=_0x060d[_0x21c8b9];return _0xcaa03;};'use strict';var _=require(_0xd060('0x0'));var util=require(_0xd060('0x1'));var moment=require(_0xd060('0x2'));var BPromise=require('bluebird');var rs=require(_0xd060('0x3'));var fs=require('fs');var Redis=require(_0xd060('0x4'));var db=require(_0xd060('0x5'))['db'];var utils=require(_0xd060('0x6'));var logger=require(_0xd060('0x7'))(_0xd060('0x8'));var config=require('../../config/environment');var jayson=require(_0xd060('0x9'));var client=jayson[_0xd060('0xa')][_0xd060('0xb')]({'port':0x232a});config[_0xd060('0xc')]=_[_0xd060('0xd')](config[_0xd060('0xc')],{'host':_0xd060('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd060('0xf'))[_0xd060('0x10')](socket);function respondWithRpcPromise(_0x48d17f,_0x1e96bb,_0x1f6177){return new BPromise(function(_0x1ff4d0,_0x262c1c){return client['request'](_0x48d17f,_0x1f6177)['then'](function(_0x27918c){logger[_0xd060('0x11')]('Dashboard,\x20%s,\x20%s',_0x1e96bb,_0xd060('0x12'));logger[_0xd060('0x13')](_0xd060('0x14'),_0x1e96bb,_0xd060('0x12'),JSON['stringify'](_0x27918c));if(_0x27918c['error']){if(_0x27918c['error'][_0xd060('0x15')]===0x1f4){logger['error'](_0xd060('0x16'),_0x1e96bb,_0x27918c['error']['message']);return _0x262c1c(_0x27918c[_0xd060('0x17')][_0xd060('0x18')]);}logger[_0xd060('0x17')](_0xd060('0x16'),_0x1e96bb,_0x27918c[_0xd060('0x17')][_0xd060('0x18')]);return _0x1ff4d0(_0x27918c[_0xd060('0x17')]['message']);}else{logger[_0xd060('0x11')](_0xd060('0x16'),_0x1e96bb,_0xd060('0x12'));_0x1ff4d0(_0x27918c[_0xd060('0x19')]['message']);}})[_0xd060('0x1a')](function(_0x1526ff){logger[_0xd060('0x17')]('Dashboard,\x20%s,\x20%s',_0x1e96bb,_0x1526ff);_0x262c1c(_0x1526ff);});});} \ No newline at end of file +var _0xe436=['rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe436,0x1af));var _0x6e43=function(_0x47adef,_0x1d1ee2){_0x47adef=_0x47adef-0x0;var _0x6da753=_0xe436[_0x47adef];return _0x6da753;};'use strict';var _=require(_0x6e43('0x0'));var util=require(_0x6e43('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e43('0x2'));var fs=require('fs');var Redis=require(_0x6e43('0x3'));var db=require(_0x6e43('0x4'))['db'];var utils=require(_0x6e43('0x5'));var logger=require('../../config/logger')(_0x6e43('0x6'));var config=require(_0x6e43('0x7'));var jayson=require(_0x6e43('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6e43('0x9')]=_[_0x6e43('0xa')](config[_0x6e43('0x9')],{'host':_0x6e43('0xb'),'port':0x18eb});var socket=require(_0x6e43('0xc'))(new Redis(config[_0x6e43('0x9')]));require(_0x6e43('0xd'))['register'](socket);function respondWithRpcPromise(_0x3be4c8,_0x775acd,_0x158642){return new BPromise(function(_0x211d1a,_0x292380){return client['request'](_0x3be4c8,_0x158642)['then'](function(_0x5ddc13){logger[_0x6e43('0xe')](_0x6e43('0xf'),_0x775acd,_0x6e43('0x10'));logger['debug'](_0x6e43('0x11'),_0x775acd,_0x6e43('0x10'),JSON[_0x6e43('0x12')](_0x5ddc13));if(_0x5ddc13[_0x6e43('0x13')]){if(_0x5ddc13[_0x6e43('0x13')]['code']===0x1f4){logger['error'](_0x6e43('0xf'),_0x775acd,_0x5ddc13[_0x6e43('0x13')][_0x6e43('0x14')]);return _0x292380(_0x5ddc13[_0x6e43('0x13')]['message']);}logger[_0x6e43('0x13')](_0x6e43('0xf'),_0x775acd,_0x5ddc13['error'][_0x6e43('0x14')]);return _0x211d1a(_0x5ddc13['error'][_0x6e43('0x14')]);}else{logger['info'](_0x6e43('0xf'),_0x775acd,_0x6e43('0x10'));_0x211d1a(_0x5ddc13[_0x6e43('0x15')][_0x6e43('0x14')]);}})[_0x6e43('0x16')](function(_0x53c63c){logger[_0x6e43('0x13')](_0x6e43('0xf'),_0x775acd,_0x53c63c);_0x292380(_0x53c63c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c2e8b5e..787240a 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 _0x6d6e=['remove','update','emit','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x2f5fb5,_0x3bec82){var _0x5c7957=function(_0x50b759){while(--_0x50b759){_0x2f5fb5['push'](_0x2f5fb5['shift']());}};_0x5c7957(++_0x3bec82);}(_0x6d6e,0x1c0));var _0xe6d6=function(_0x165cbf,_0x306aac){_0x165cbf=_0x165cbf-0x0;var _0x5cdee5=_0x6d6e[_0x165cbf];return _0x5cdee5;};'use strict';var DashboardEvents=require(_0xe6d6('0x0'));var events=[_0xe6d6('0x1'),_0xe6d6('0x2'),_0xe6d6('0x3')];function createListener(_0x23a36f,_0x2863f4){return function(_0x1f6e73){_0x2863f4[_0xe6d6('0x4')](_0x23a36f,_0x1f6e73);};}function removeListener(_0x466664,_0x146f62){return function(){DashboardEvents[_0xe6d6('0x5')](_0x466664,_0x146f62);};}exports[_0xe6d6('0x6')]=function(_0x32de61){for(var _0x259be2=0x0,_0x367249=events[_0xe6d6('0x7')];_0x259be2<_0x367249;_0x259be2++){var _0xad7825=events[_0x259be2];var _0x281e63=createListener(_0xe6d6('0x8')+_0xad7825,_0x32de61);DashboardEvents['on'](_0xad7825,_0x281e63);}}; \ No newline at end of file +var _0x67f9=['./dashboard.events','save','remove','emit','removeListener','register','length','dashboard:'];(function(_0x22d920,_0x492ec9){var _0xdbe55b=function(_0x444c6b){while(--_0x444c6b){_0x22d920['push'](_0x22d920['shift']());}};_0xdbe55b(++_0x492ec9);}(_0x67f9,0x130));var _0x967f=function(_0x41314d,_0x2fb3d5){_0x41314d=_0x41314d-0x0;var _0xde1b95=_0x67f9[_0x41314d];return _0xde1b95;};'use strict';var DashboardEvents=require(_0x967f('0x0'));var events=[_0x967f('0x1'),_0x967f('0x2'),'update'];function createListener(_0x2d4950,_0x52a9e9){return function(_0x34a853){_0x52a9e9[_0x967f('0x3')](_0x2d4950,_0x34a853);};}function removeListener(_0x3cda33,_0x1c7adb){return function(){DashboardEvents[_0x967f('0x4')](_0x3cda33,_0x1c7adb);};}exports[_0x967f('0x5')]=function(_0xbc6c70){for(var _0x1f8aec=0x0,_0x549b45=events[_0x967f('0x6')];_0x1f8aec<_0x549b45;_0x1f8aec++){var _0x238e28=events[_0x1f8aec];var _0x20e58d=createListener(_0x967f('0x7')+_0x238e28,_0xbc6c70);DashboardEvents['on'](_0x238e28,_0x20e58d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d13a3ec..2e57d5f 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 _0x8aa9=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','create','/:id/clone','addItem','put','/:id','update','delete'];(function(_0x1abfac,_0x45ae54){var _0x2f97e6=function(_0xa0fce4){while(--_0xa0fce4){_0x1abfac['push'](_0x1abfac['shift']());}};_0x2f97e6(++_0x45ae54);}(_0x8aa9,0x135));var _0x98aa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8aa9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x98aa('0x0'));var path=require(_0x98aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x98aa('0x2'));var router=express[_0x98aa('0x3')]();var fs_extra=require(_0x98aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x98aa('0x5'));var config=require('../../config/environment');var controller=require(_0x98aa('0x6'));router[_0x98aa('0x7')]('/',auth[_0x98aa('0x8')](),controller[_0x98aa('0x9')]);router[_0x98aa('0x7')]('/:id',auth[_0x98aa('0x8')](),controller[_0x98aa('0xa')]);router[_0x98aa('0x7')](_0x98aa('0xb'),auth[_0x98aa('0x8')](),controller[_0x98aa('0xc')]);router[_0x98aa('0xd')]('/',auth['isAuthenticated'](),controller[_0x98aa('0xe')]);router['post'](_0x98aa('0xf'),auth[_0x98aa('0x8')](),controller['clone']);router[_0x98aa('0xd')](_0x98aa('0xb'),auth[_0x98aa('0x8')](),controller[_0x98aa('0x10')]);router[_0x98aa('0x11')](_0x98aa('0x12'),auth[_0x98aa('0x8')](),controller[_0x98aa('0x13')]);router[_0x98aa('0x14')](_0x98aa('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x98aa('0x15')]=router; \ No newline at end of file +var _0xec64=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','create','/:id/clone','clone','/:id/items','addItem','put','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x1f8116,_0xc5fde2){var _0x26fb76=function(_0x2965cd){while(--_0x2965cd){_0x1f8116['push'](_0x1f8116['shift']());}};_0x26fb76(++_0xc5fde2);}(_0xec64,0x1c3));var _0x4ec6=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xec64[_0x3b4b1d];return _0x488c36;};'use strict';var multer=require('multer');var util=require(_0x4ec6('0x0'));var path=require(_0x4ec6('0x1'));var timeout=require(_0x4ec6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4ec6('0x3'));var auth=require(_0x4ec6('0x4'));var interaction=require(_0x4ec6('0x5'));var config=require(_0x4ec6('0x6'));var controller=require(_0x4ec6('0x7'));router[_0x4ec6('0x8')]('/',auth[_0x4ec6('0x9')](),controller[_0x4ec6('0xa')]);router[_0x4ec6('0x8')](_0x4ec6('0xb'),auth[_0x4ec6('0x9')](),controller[_0x4ec6('0xc')]);router['get']('/:id/items',auth[_0x4ec6('0x9')](),controller[_0x4ec6('0xd')]);router[_0x4ec6('0xe')]('/',auth['isAuthenticated'](),controller[_0x4ec6('0xf')]);router[_0x4ec6('0xe')](_0x4ec6('0x10'),auth[_0x4ec6('0x9')](),controller[_0x4ec6('0x11')]);router[_0x4ec6('0xe')](_0x4ec6('0x12'),auth[_0x4ec6('0x9')](),controller[_0x4ec6('0x13')]);router[_0x4ec6('0x14')](_0x4ec6('0xb'),auth[_0x4ec6('0x9')](),controller[_0x4ec6('0x15')]);router[_0x4ec6('0x16')](_0x4ec6('0xb'),auth[_0x4ec6('0x9')](),controller[_0x4ec6('0x17')]);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 b9753c5..9270b1c 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 _0x7096=['setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7096,0x10c));var _0x6709=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7096[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x6709('0x0'));var _=require('lodash');module[_0x6709('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6709('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6709('0x3')](_0x6709('0x4')),'get':function(){try{return JSON[_0x6709('0x5')](this[_0x6709('0x6')](_0x6709('0x7')));}catch(_0xb8fe6d){return[];}},'set':function(_0x9d630f){try{this[_0x6709('0x8')](_0x6709('0x7'),JSON[_0x6709('0x9')](_0x9d630f));}catch(_0x985814){this[_0x6709('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6709('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6709('0xa')]},'col':{'type':Sequelize[_0x6709('0xa')]},'background':{'type':Sequelize[_0x6709('0x2')],'allowNull':![],'defaultValue':_0x6709('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6709('0x2')]},'titleFontSize':{'type':Sequelize[_0x6709('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4819=['long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT'];(function(_0x3db9f8,_0x4db1ea){var _0x497c2c=function(_0x5ef098){while(--_0x5ef098){_0x3db9f8['push'](_0x3db9f8['shift']());}};_0x497c2c(++_0x4db1ea);}(_0x4819,0xcd));var _0x9481=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x4819[_0x3de873];return _0x380b8c;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9481('0x0'));var _=require(_0x9481('0x1'));module[_0x9481('0x2')]={'title':{'type':Sequelize[_0x9481('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9481('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9481('0x4')](_0x9481('0x5')),'get':function(){try{return JSON[_0x9481('0x6')](this[_0x9481('0x7')](_0x9481('0x8')));}catch(_0x5ac51c){return[];}},'set':function(_0x4d9e3a){try{this['setDataValue']('attrs',JSON[_0x9481('0x9')](_0x4d9e3a));}catch(_0x6c6a08){this[_0x9481('0xa')](_0x9481('0x8'),JSON[_0x9481('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9481('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9481('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9481('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9481('0x3')],'allowNull':![],'defaultValue':_0x9481('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9481('0x3')]},'titleFontSize':{'type':Sequelize[_0x9481('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 775451d..ae8f156 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 _0x41d9=['iframe','attrUrl','attrs','value','attrPath','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','voice','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','fields','length','include','options','find','catch','params','type'];(function(_0x34c037,_0x298727){var _0x44cfa0=function(_0x3ad359){while(--_0x3ad359){_0x34c037['push'](_0x34c037['shift']());}};_0x44cfa0(++_0x298727);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x941d('0x0'));var rimraf=require(_0x941d('0x1'));var zipdir=require(_0x941d('0x2'));var jsonpatch=require(_0x941d('0x3'));var rp=require(_0x941d('0x4'));var moment=require(_0x941d('0x5'));var BPromise=require(_0x941d('0x6'));var Mustache=require('mustache');var util=require(_0x941d('0x7'));var path=require(_0x941d('0x8'));var sox=require('sox');var csv=require(_0x941d('0x9'));var ejs=require(_0x941d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x941d('0xb'));var squel=require('squel');var crypto=require(_0x941d('0xc'));var jsforce=require(_0x941d('0xd'));var deskjs=require(_0x941d('0xe'));var toCsv=require(_0x941d('0x9'));var querystring=require(_0x941d('0xf'));var Papa=require('papaparse');var Redis=require(_0x941d('0x10'));var authService=require(_0x941d('0x11'));var qs=require(_0x941d('0x12'));var as=require(_0x941d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x941d('0x14'))(_0x941d('0x15'));var utils=require(_0x941d('0x16'));var config=require(_0x941d('0x17'));var licenseUtil=require(_0x941d('0x18'));var db=require(_0x941d('0x19'))['db'];config['redis']=_[_0x941d('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x941d('0x1b'))(new Redis(config[_0x941d('0x1c')]));require(_0x941d('0x1d'))[_0x941d('0x1e')](socket);function respondWithStatusCode(_0x20a6ab,_0x161184){_0x161184=_0x161184||0xcc;return function(_0x29487){if(_0x29487){return _0x20a6ab[_0x941d('0x1f')](_0x161184);}return _0x20a6ab[_0x941d('0x20')](_0x161184)[_0x941d('0x21')]();};}function respondWithResult(_0x7df80e,_0x50c8b6){_0x50c8b6=_0x50c8b6||0xc8;return function(_0x1e1140){if(_0x1e1140){return _0x7df80e[_0x941d('0x20')](_0x50c8b6)[_0x941d('0x22')](_0x1e1140);}};}function respondWithFilteredResult(_0x2e5c4f,_0x20845a){return function(_0x3ac25f){if(_0x3ac25f){var _0x3c1e1a=typeof _0x20845a[_0x941d('0x23')]===_0x941d('0x24')&&typeof _0x20845a['limit']===_0x941d('0x24');var _0x57f5e6=_0x3ac25f[_0x941d('0x25')];var _0x331c45=_0x3c1e1a?0x0:_0x20845a['offset'];var _0x3dcbf9=_0x3c1e1a?_0x3ac25f['count']:_0x20845a['offset']+_0x20845a[_0x941d('0x26')];var _0xf6636;if(_0x3dcbf9>=_0x57f5e6){_0x3dcbf9=_0x57f5e6;_0xf6636=0xc8;}else{_0xf6636=0xce;}_0x2e5c4f[_0x941d('0x20')](_0xf6636);return _0x2e5c4f['set'](_0x941d('0x27'),_0x331c45+'-'+_0x3dcbf9+'/'+_0x57f5e6)[_0x941d('0x22')](_0x3ac25f);}return null;};}function patchUpdates(_0xc19c76){return function(_0x4892c4){try{jsonpatch['apply'](_0x4892c4,_0xc19c76,!![]);}catch(_0x520bb2){return BPromise[_0x941d('0x28')](_0x520bb2);}return _0x4892c4[_0x941d('0x29')]();};}function saveUpdates(_0xd72c49,_0x158951){return function(_0x2e568b){if(_0x2e568b){return _0x2e568b['update'](_0xd72c49)[_0x941d('0x2a')](function(_0x43a443){return _0x43a443;});}return null;};}function removeEntity(_0x11c2c9,_0x48baff){return function(_0x1ecde8){if(_0x1ecde8){return _0x1ecde8[_0x941d('0x2b')]()[_0x941d('0x2a')](function(){_0x11c2c9[_0x941d('0x20')](0xcc)[_0x941d('0x21')]();});}};}function handleEntityNotFound(_0x213052,_0x1a3dc2){return function(_0x2f20b3){if(!_0x2f20b3){_0x213052[_0x941d('0x1f')](0x194);}return _0x2f20b3;};}function handleError(_0x145991,_0x2f38c8){_0x2f38c8=_0x2f38c8||0x1f4;return function(_0x1cacc4){logger['error'](_0x1cacc4[_0x941d('0x2c')]);if(_0x1cacc4[_0x941d('0x2d')]){delete _0x1cacc4['name'];}_0x145991[_0x941d('0x20')](_0x2f38c8)[_0x941d('0x2e')](_0x1cacc4);};}exports[_0x941d('0x2f')]=function(_0x367607,_0x46db04){var _0x17e60d={'raw':![],'where':{'id':_0x367607['params']['id']}},_0x406f8b={};_0x406f8b['model']=_[_0x941d('0x30')](db[_0x941d('0x31')][_0x941d('0x32')]);_0x406f8b['query']=_['keys'](_0x367607[_0x941d('0x33')]);_0x406f8b[_0x941d('0x34')]=_[_0x941d('0x35')](_0x406f8b['model'],_0x406f8b[_0x941d('0x33')]);_0x17e60d[_0x941d('0x36')]=_[_0x941d('0x35')](_0x406f8b[_0x941d('0x37')],qs['fields'](_0x367607[_0x941d('0x33')][_0x941d('0x38')]));_0x17e60d[_0x941d('0x36')]=_0x17e60d[_0x941d('0x36')][_0x941d('0x39')]?_0x17e60d[_0x941d('0x36')]:_0x406f8b['model'];if(_0x367607['query']['includeAll']){_0x17e60d[_0x941d('0x3a')]=[{'all':!![]}];}_0x17e60d=_['merge']({},_0x17e60d,_0x367607[_0x941d('0x3b')]);return db[_0x941d('0x31')][_0x941d('0x3c')](_0x17e60d)[_0x941d('0x2a')](handleEntityNotFound(_0x46db04,null))[_0x941d('0x2a')](respondWithResult(_0x46db04,null))[_0x941d('0x3d')](handleError(_0x46db04,null));};exports[_0x941d('0x2b')]=function(_0x32d072,_0x202c89){return db[_0x941d('0x31')]['find']({'where':{'id':_0x32d072[_0x941d('0x3e')]['id']}})[_0x941d('0x2a')](handleEntityNotFound(_0x202c89,null))[_0x941d('0x2a')](removeEntity(_0x202c89,null))[_0x941d('0x3d')](handleError(_0x202c89,null));};function widgetAttributes(_0x3d4f12){try{switch(_0x3d4f12[_0x941d('0x3f')]){case _0x941d('0x40'):return[{'name':_0x941d('0x41'),'value':_0x3d4f12[_0x941d('0x41')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x0]?_0x3d4f12[_0x941d('0x42')][0x0][_0x941d('0x43')]:undefined)||'https://'}];case'custom':return[{'name':_0x941d('0x44'),'value':_0x3d4f12[_0x941d('0x44')]||(_0x3d4f12['attrs']&&_0x3d4f12[_0x941d('0x42')][0x0]?_0x3d4f12['attrs'][0x0][_0x941d('0x43')]:undefined)||''}];case'clock':return[{'name':_0x941d('0x45'),'value':_0x3d4f12['attrHourFormat']||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x0]?_0x3d4f12[_0x941d('0x42')][0x0][_0x941d('0x43')]:undefined)||_0x941d('0x46')},{'name':'attrTimezone','value':_0x3d4f12['attrTimezone']||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x1]?_0x3d4f12[_0x941d('0x42')][0x1][_0x941d('0x43')]:undefined)||_0x941d('0x47')},{'name':_0x941d('0x48'),'value':_0x3d4f12[_0x941d('0x48')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x2]?_0x3d4f12[_0x941d('0x42')][0x2][_0x941d('0x43')]:undefined)||0xc}];case _0x941d('0x49'):return[{'name':_0x941d('0x4a'),'value':_0x3d4f12['attrMetric']||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12['attrs'][0x0]?_0x3d4f12[_0x941d('0x42')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x3d4f12['attrVoiceQueues']||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x1]?_0x3d4f12['attrs'][0x1][_0x941d('0x43')]:undefined)||[]},{'name':_0x941d('0x48'),'value':_0x3d4f12[_0x941d('0x48')]||(_0x3d4f12['attrs']&&_0x3d4f12['attrs'][0x2]?_0x3d4f12[_0x941d('0x42')][0x2][_0x941d('0x43')]:undefined)||0x14},{'name':_0x941d('0x4b'),'value':_0x3d4f12[_0x941d('0x4b')]||(_0x3d4f12['attrs']&&_0x3d4f12[_0x941d('0x42')][0x3]?_0x3d4f12['attrs'][0x3]['value']:undefined)||'voice'},{'name':_0x941d('0x4c'),'value':_0x3d4f12[_0x941d('0x4c')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x4]?_0x3d4f12['attrs'][0x4][_0x941d('0x43')]:undefined)||''},{'name':_0x941d('0x4d'),'value':_0x3d4f12[_0x941d('0x4d')]||(_0x3d4f12['attrs']&&_0x3d4f12['attrs'][0x5]?_0x3d4f12[_0x941d('0x42')][0x5]['value']:undefined)||''},{'name':_0x941d('0x4e'),'value':_0x3d4f12[_0x941d('0x4e')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x6]?_0x3d4f12[_0x941d('0x42')][0x6][_0x941d('0x43')]:undefined)||''},{'name':_0x941d('0x4f'),'value':_0x3d4f12[_0x941d('0x4f')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x7]?_0x3d4f12[_0x941d('0x42')][0x7][_0x941d('0x43')]:undefined)||''},{'name':_0x941d('0x50'),'value':_0x3d4f12[_0x941d('0x50')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x8]?_0x3d4f12[_0x941d('0x42')][0x8]['value']:undefined)||''},{'name':_0x941d('0x51'),'value':_0x3d4f12[_0x941d('0x51')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12['attrs'][0x9]?_0x3d4f12['attrs'][0x9][_0x941d('0x43')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x941d('0x52'),'value':_0x3d4f12[_0x941d('0x52')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x0]?_0x3d4f12[_0x941d('0x42')][0x0]['value']:undefined)||'total'},{'name':_0x941d('0x53'),'value':_0x3d4f12[_0x941d('0x53')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x1]?_0x3d4f12[_0x941d('0x42')][0x1][_0x941d('0x43')]:undefined)||null},{'name':_0x941d('0x54'),'value':_0x3d4f12[_0x941d('0x54')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x2]?_0x3d4f12[_0x941d('0x42')][0x2][_0x941d('0x43')]:undefined)||null},{'name':_0x941d('0x55'),'value':_0x3d4f12['attrVoiceQueues']||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x3]?_0x3d4f12[_0x941d('0x42')][0x3][_0x941d('0x43')]:undefined)||[]},{'name':_0x941d('0x4b'),'value':_0x3d4f12[_0x941d('0x4b')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x4]?_0x3d4f12[_0x941d('0x42')][0x4][_0x941d('0x43')]:undefined)||_0x941d('0x56')},{'name':_0x941d('0x4c'),'value':_0x3d4f12[_0x941d('0x4c')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x5]?_0x3d4f12[_0x941d('0x42')][0x5]['value']:undefined)||''},{'name':_0x941d('0x4d'),'value':_0x3d4f12[_0x941d('0x4d')]||(_0x3d4f12['attrs']&&_0x3d4f12[_0x941d('0x42')][0x6]?_0x3d4f12['attrs'][0x6][_0x941d('0x43')]:undefined)||''},{'name':_0x941d('0x4e'),'value':_0x3d4f12[_0x941d('0x4e')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x7]?_0x3d4f12['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3d4f12['attrOpenchannelAccounts']||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x8]?_0x3d4f12[_0x941d('0x42')][0x8][_0x941d('0x43')]:undefined)||''},{'name':_0x941d('0x50'),'value':_0x3d4f12['attrWhatsappAccounts']||(_0x3d4f12['attrs']&&_0x3d4f12['attrs'][0x9]?_0x3d4f12[_0x941d('0x42')][0x9]['value']:undefined)||''},{'name':_0x941d('0x51'),'value':_0x3d4f12[_0x941d('0x51')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12['attrs'][0xa]?_0x3d4f12[_0x941d('0x42')][0xa][_0x941d('0x43')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3d4f12['reportType']||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x0]?_0x3d4f12[_0x941d('0x42')][0x0][_0x941d('0x3f')]:undefined)||null,'value':_0x3d4f12[_0x941d('0x57')]||(_0x3d4f12[_0x941d('0x42')]&&_0x3d4f12[_0x941d('0x42')][0x0]?_0x3d4f12['attrs'][0x0][_0x941d('0x43')]:undefined)||null},{'name':_0x941d('0x58'),'value':_0x3d4f12[_0x941d('0x58')]||(_0x3d4f12['attrs']&&_0x3d4f12[_0x941d('0x42')][0x1]?_0x3d4f12[_0x941d('0x42')][0x1][_0x941d('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x1908a4){logger[_0x941d('0x59')](_0x941d('0x5a'),JSON[_0x941d('0x5b')](_0x1908a4));return[];}}exports[_0x941d('0x5c')]=function(_0x3edc54,_0x566a8b){if(_0x3edc54['body']){_0x3edc54[_0x941d('0x5d')][_0x941d('0x42')]=widgetAttributes(_0x3edc54[_0x941d('0x5d')]);}return db[_0x941d('0x31')][_0x941d('0x5c')](_0x3edc54[_0x941d('0x5d')],{})['then'](respondWithResult(_0x566a8b,0xc9))[_0x941d('0x3d')](handleError(_0x566a8b,null));};exports[_0x941d('0x5e')]=function(_0x3028d0,_0x3259f5){if(_0x3028d0[_0x941d('0x5d')]['id']){delete _0x3028d0['body']['id'];}_0x3028d0[_0x941d('0x5d')]['attrs']=widgetAttributes(_0x3028d0[_0x941d('0x5d')]);return db[_0x941d('0x31')][_0x941d('0x3c')]({'where':{'id':_0x3028d0[_0x941d('0x3e')]['id']}})[_0x941d('0x2a')](handleEntityNotFound(_0x3259f5,null))[_0x941d('0x2a')](saveUpdates(_0x3028d0[_0x941d('0x5d')],null))[_0x941d('0x2a')](respondWithResult(_0x3259f5,null))[_0x941d('0x3d')](handleError(_0x3259f5,null));}; \ No newline at end of file +var _0xf06c=['total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','./dashboardItem.socket','register','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','DashboardItem','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric'];(function(_0x2c771c,_0x28d6bc){var _0x3b05ac=function(_0x3c189e){while(--_0x3c189e){_0x2c771c['push'](_0x2c771c['shift']());}};_0x3b05ac(++_0x28d6bc);}(_0xf06c,0xc7));var _0xcf06=function(_0xecbf8a,_0x362142){_0xecbf8a=_0xecbf8a-0x0;var _0x1a2207=_0xf06c[_0xecbf8a];return _0x1a2207;};'use strict';var emlformat=require(_0xcf06('0x0'));var rimraf=require(_0xcf06('0x1'));var zipdir=require(_0xcf06('0x2'));var jsonpatch=require(_0xcf06('0x3'));var rp=require(_0xcf06('0x4'));var moment=require('moment');var BPromise=require(_0xcf06('0x5'));var Mustache=require(_0xcf06('0x6'));var util=require(_0xcf06('0x7'));var path=require('path');var sox=require(_0xcf06('0x8'));var csv=require(_0xcf06('0x9'));var ejs=require(_0xcf06('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf06('0xb'));var squel=require('squel');var crypto=require(_0xcf06('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf06('0xd'));var Redis=require(_0xcf06('0xe'));var authService=require(_0xcf06('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf06('0x10'));var logger=require('../../config/logger')(_0xcf06('0x11'));var utils=require('../../config/utils');var config=require(_0xcf06('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf06('0x13'))['db'];config[_0xcf06('0x14')]=_[_0xcf06('0x15')](config[_0xcf06('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf06('0x14')]));require(_0xcf06('0x16'))[_0xcf06('0x17')](socket);function respondWithStatusCode(_0x157689,_0x53a250){_0x53a250=_0x53a250||0xcc;return function(_0xd4f89){if(_0xd4f89){return _0x157689[_0xcf06('0x18')](_0x53a250);}return _0x157689['status'](_0x53a250)['end']();};}function respondWithResult(_0x15a795,_0x4130ce){_0x4130ce=_0x4130ce||0xc8;return function(_0x263298){if(_0x263298){return _0x15a795['status'](_0x4130ce)[_0xcf06('0x19')](_0x263298);}};}function respondWithFilteredResult(_0x18cd3f,_0x323928){return function(_0x569bbf){if(_0x569bbf){var _0x2f6584=typeof _0x323928[_0xcf06('0x1a')]===_0xcf06('0x1b')&&typeof _0x323928[_0xcf06('0x1c')]===_0xcf06('0x1b');var _0x48886d=_0x569bbf[_0xcf06('0x1d')];var _0x1be1e3=_0x2f6584?0x0:_0x323928[_0xcf06('0x1a')];var _0x5db08d=_0x2f6584?_0x569bbf[_0xcf06('0x1d')]:_0x323928[_0xcf06('0x1a')]+_0x323928['limit'];var _0x362fcc;if(_0x5db08d>=_0x48886d){_0x5db08d=_0x48886d;_0x362fcc=0xc8;}else{_0x362fcc=0xce;}_0x18cd3f[_0xcf06('0x1e')](_0x362fcc);return _0x18cd3f['set'](_0xcf06('0x1f'),_0x1be1e3+'-'+_0x5db08d+'/'+_0x48886d)[_0xcf06('0x19')](_0x569bbf);}return null;};}function patchUpdates(_0x139b17){return function(_0x25bee3){try{jsonpatch[_0xcf06('0x20')](_0x25bee3,_0x139b17,!![]);}catch(_0x13fa04){return BPromise[_0xcf06('0x21')](_0x13fa04);}return _0x25bee3[_0xcf06('0x22')]();};}function saveUpdates(_0xb039dd,_0x471a6d){return function(_0x383692){if(_0x383692){return _0x383692[_0xcf06('0x23')](_0xb039dd)['then'](function(_0x58840a){return _0x58840a;});}return null;};}function removeEntity(_0x87440,_0x27beb7){return function(_0x294192){if(_0x294192){return _0x294192[_0xcf06('0x24')]()[_0xcf06('0x25')](function(){_0x87440[_0xcf06('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da27a,_0x2afa20){return function(_0x4c6fcd){if(!_0x4c6fcd){_0x4da27a[_0xcf06('0x18')](0x194);}return _0x4c6fcd;};}function handleError(_0x88ee07,_0x631902){_0x631902=_0x631902||0x1f4;return function(_0x474bfe){logger[_0xcf06('0x26')](_0x474bfe[_0xcf06('0x27')]);if(_0x474bfe[_0xcf06('0x28')]){delete _0x474bfe[_0xcf06('0x28')];}_0x88ee07[_0xcf06('0x1e')](_0x631902)['send'](_0x474bfe);};}exports[_0xcf06('0x29')]=function(_0x48548c,_0x92666b){var _0x3ec4f2={'raw':![],'where':{'id':_0x48548c[_0xcf06('0x2a')]['id']}},_0x42d287={};_0x42d287[_0xcf06('0x2b')]=_[_0xcf06('0x2c')](db['DashboardItem'][_0xcf06('0x2d')]);_0x42d287[_0xcf06('0x2e')]=_[_0xcf06('0x2c')](_0x48548c[_0xcf06('0x2e')]);_0x42d287[_0xcf06('0x2f')]=_[_0xcf06('0x30')](_0x42d287[_0xcf06('0x2b')],_0x42d287[_0xcf06('0x2e')]);_0x3ec4f2[_0xcf06('0x31')]=_[_0xcf06('0x30')](_0x42d287['model'],qs[_0xcf06('0x32')](_0x48548c[_0xcf06('0x2e')][_0xcf06('0x32')]));_0x3ec4f2[_0xcf06('0x31')]=_0x3ec4f2[_0xcf06('0x31')][_0xcf06('0x33')]?_0x3ec4f2[_0xcf06('0x31')]:_0x42d287[_0xcf06('0x2b')];if(_0x48548c[_0xcf06('0x2e')][_0xcf06('0x34')]){_0x3ec4f2[_0xcf06('0x35')]=[{'all':!![]}];}_0x3ec4f2=_['merge']({},_0x3ec4f2,_0x48548c[_0xcf06('0x36')]);return db[_0xcf06('0x37')]['find'](_0x3ec4f2)[_0xcf06('0x25')](handleEntityNotFound(_0x92666b,null))['then'](respondWithResult(_0x92666b,null))[_0xcf06('0x38')](handleError(_0x92666b,null));};exports[_0xcf06('0x24')]=function(_0xbdca56,_0x26a32c){return db['DashboardItem'][_0xcf06('0x39')]({'where':{'id':_0xbdca56[_0xcf06('0x2a')]['id']}})[_0xcf06('0x25')](handleEntityNotFound(_0x26a32c,null))[_0xcf06('0x25')](removeEntity(_0x26a32c,null))[_0xcf06('0x38')](handleError(_0x26a32c,null));};function widgetAttributes(_0x580850){try{switch(_0x580850[_0xcf06('0x3a')]){case _0xcf06('0x3b'):return[{'name':_0xcf06('0x3c'),'value':_0x580850[_0xcf06('0x3c')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x0]?_0x580850[_0xcf06('0x3d')][0x0][_0xcf06('0x3e')]:undefined)||_0xcf06('0x3f')}];case _0xcf06('0x40'):return[{'name':_0xcf06('0x41'),'value':_0x580850[_0xcf06('0x41')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x0]?_0x580850[_0xcf06('0x3d')][0x0][_0xcf06('0x3e')]:undefined)||''}];case _0xcf06('0x42'):return[{'name':'attrHourFormat','value':_0x580850[_0xcf06('0x43')]||(_0x580850['attrs']&&_0x580850[_0xcf06('0x3d')][0x0]?_0x580850[_0xcf06('0x3d')][0x0][_0xcf06('0x3e')]:undefined)||'HH:mm:ss'},{'name':_0xcf06('0x44'),'value':_0x580850[_0xcf06('0x44')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x1]?_0x580850[_0xcf06('0x3d')][0x1]['value']:undefined)||'0.00'},{'name':_0xcf06('0x45'),'value':_0x580850['attrFontSize']||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x2]?_0x580850[_0xcf06('0x3d')][0x2][_0xcf06('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0xcf06('0x46'),'value':_0x580850[_0xcf06('0x46')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850['attrs'][0x0]?_0x580850[_0xcf06('0x3d')][0x0]['value']:undefined)||_0xcf06('0x47')},{'name':'attrVoiceQueues','value':_0x580850[_0xcf06('0x48')]||(_0x580850['attrs']&&_0x580850[_0xcf06('0x3d')][0x1]?_0x580850[_0xcf06('0x3d')][0x1][_0xcf06('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x580850[_0xcf06('0x45')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x2]?_0x580850['attrs'][0x2][_0xcf06('0x3e')]:undefined)||0x14},{'name':'attrChannel','value':_0x580850[_0xcf06('0x49')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x3]?_0x580850[_0xcf06('0x3d')][0x3]['value']:undefined)||_0xcf06('0x4a')},{'name':_0xcf06('0x4b'),'value':_0x580850[_0xcf06('0x4b')]||(_0x580850['attrs']&&_0x580850[_0xcf06('0x3d')][0x4]?_0x580850[_0xcf06('0x3d')][0x4]['value']:undefined)||''},{'name':_0xcf06('0x4c'),'value':_0x580850[_0xcf06('0x4c')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x5]?_0x580850[_0xcf06('0x3d')][0x5]['value']:undefined)||''},{'name':_0xcf06('0x4d'),'value':_0x580850[_0xcf06('0x4d')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x6]?_0x580850[_0xcf06('0x3d')][0x6]['value']:undefined)||''},{'name':_0xcf06('0x4e'),'value':_0x580850['attrOpenchannelAccounts']||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x7]?_0x580850[_0xcf06('0x3d')][0x7][_0xcf06('0x3e')]:undefined)||''},{'name':_0xcf06('0x4f'),'value':_0x580850['attrWhatsappAccounts']||(_0x580850[_0xcf06('0x3d')]&&_0x580850['attrs'][0x8]?_0x580850[_0xcf06('0x3d')][0x8][_0xcf06('0x3e')]:undefined)||''},{'name':_0xcf06('0x50'),'value':_0x580850[_0xcf06('0x50')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x9]?_0x580850['attrs'][0x9][_0xcf06('0x3e')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x580850[_0xcf06('0x51')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x0]?_0x580850['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x580850['attrSerie2']||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x1]?_0x580850[_0xcf06('0x3d')][0x1][_0xcf06('0x3e')]:undefined)||null},{'name':_0xcf06('0x52'),'value':_0x580850['attrSerie3']||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x2]?_0x580850[_0xcf06('0x3d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x580850[_0xcf06('0x48')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x3]?_0x580850[_0xcf06('0x3d')][0x3][_0xcf06('0x3e')]:undefined)||[]},{'name':'attrChannel','value':_0x580850[_0xcf06('0x49')]||(_0x580850['attrs']&&_0x580850[_0xcf06('0x3d')][0x4]?_0x580850[_0xcf06('0x3d')][0x4][_0xcf06('0x3e')]:undefined)||_0xcf06('0x4a')},{'name':_0xcf06('0x4b'),'value':_0x580850[_0xcf06('0x4b')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x5]?_0x580850[_0xcf06('0x3d')][0x5][_0xcf06('0x3e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x580850[_0xcf06('0x4c')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x6]?_0x580850['attrs'][0x6][_0xcf06('0x3e')]:undefined)||''},{'name':_0xcf06('0x4d'),'value':_0x580850['attrSmsAccounts']||(_0x580850[_0xcf06('0x3d')]&&_0x580850['attrs'][0x7]?_0x580850[_0xcf06('0x3d')][0x7][_0xcf06('0x3e')]:undefined)||''},{'name':_0xcf06('0x4e'),'value':_0x580850[_0xcf06('0x4e')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x8]?_0x580850[_0xcf06('0x3d')][0x8][_0xcf06('0x3e')]:undefined)||''},{'name':_0xcf06('0x4f'),'value':_0x580850[_0xcf06('0x4f')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x9]?_0x580850[_0xcf06('0x3d')][0x9]['value']:undefined)||''},{'name':_0xcf06('0x50'),'value':_0x580850[_0xcf06('0x50')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0xa]?_0x580850[_0xcf06('0x3d')][0xa]['value']:undefined)||''}];case _0xcf06('0x53'):return[{'name':_0xcf06('0x54'),'type':_0x580850[_0xcf06('0x55')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850['attrs'][0x0]?_0x580850[_0xcf06('0x3d')][0x0][_0xcf06('0x3a')]:undefined)||null,'value':_0x580850[_0xcf06('0x54')]||(_0x580850[_0xcf06('0x3d')]&&_0x580850[_0xcf06('0x3d')][0x0]?_0x580850[_0xcf06('0x3d')][0x0][_0xcf06('0x3e')]:undefined)||null},{'name':_0xcf06('0x56'),'value':_0x580850['attrRefresh']||(_0x580850[_0xcf06('0x3d')]&&_0x580850['attrs'][0x1]?_0x580850[_0xcf06('0x3d')][0x1][_0xcf06('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x5b7304){logger['error']('widgetAttributes:\x20%s',JSON[_0xcf06('0x57')](_0x5b7304));return[];}}exports[_0xcf06('0x58')]=function(_0x253217,_0x29b70){if(_0x253217[_0xcf06('0x59')]){_0x253217['body'][_0xcf06('0x3d')]=widgetAttributes(_0x253217[_0xcf06('0x59')]);}return db['DashboardItem']['create'](_0x253217['body'],{})[_0xcf06('0x25')](respondWithResult(_0x29b70,0xc9))[_0xcf06('0x38')](handleError(_0x29b70,null));};exports['update']=function(_0x5a1e97,_0x339d10){if(_0x5a1e97['body']['id']){delete _0x5a1e97[_0xcf06('0x59')]['id'];}_0x5a1e97[_0xcf06('0x59')][_0xcf06('0x3d')]=widgetAttributes(_0x5a1e97[_0xcf06('0x59')]);return db[_0xcf06('0x37')]['find']({'where':{'id':_0x5a1e97[_0xcf06('0x2a')]['id']}})['then'](handleEntityNotFound(_0x339d10,null))[_0xcf06('0x25')](saveUpdates(_0x5a1e97[_0xcf06('0x59')],null))[_0xcf06('0x25')](respondWithResult(_0x339d10,null))['catch'](handleError(_0x339d10,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 352c5e8..cc84a08 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 _0xd1df=['DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd1df,0xfc));var _0xfd1d=function(_0x3ec515,_0x256b9d){_0x3ec515=_0x3ec515-0x0;var _0x1e7b96=_0xd1df[_0x3ec515];return _0x1e7b96;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xfd1d('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfd1d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd1d('0x2'),'afterDestroy':_0xfd1d('0x3')};function emitEvent(_0x5c454a){return function(_0xebdbc,_0x3521b3,_0x51f7b6){DashboardItemEvents[_0xfd1d('0x4')](_0x5c454a+':'+_0xebdbc['id'],_0xebdbc);DashboardItemEvents[_0xfd1d('0x4')](_0x5c454a,_0xebdbc);_0x51f7b6(null);};}for(var e in events){if(events[_0xfd1d('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xfd1d('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x4469=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0x4469,0xb6));var _0x9446=function(_0x5b8c1a,_0x20ffbf){_0x5b8c1a=_0x5b8c1a-0x0;var _0x1fd791=_0x4469[_0x5b8c1a];return _0x1fd791;};'use strict';var EventEmitter=require(_0x9446('0x0'));var DashboardItem=require(_0x9446('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9446('0x2')](0x0);var events={'afterCreate':_0x9446('0x3'),'afterUpdate':_0x9446('0x4'),'afterDestroy':_0x9446('0x5')};function emitEvent(_0x26fecf){return function(_0x581227,_0x1547b7,_0x48d4d2){DashboardItemEvents[_0x9446('0x6')](_0x26fecf+':'+_0x581227['id'],_0x581227);DashboardItemEvents[_0x9446('0x6')](_0x26fecf,_0x581227);_0x48d4d2(null);};}for(var e in events){if(events[_0x9446('0x7')](e)){var event=events[e];DashboardItem[_0x9446('0x8')](e,emitEvent(event));}}module[_0x9446('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 1601997..0edc196 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 _0x3936=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items'];(function(_0x5595e2,_0x31d494){var _0x9e562f=function(_0x4fb68d){while(--_0x4fb68d){_0x5595e2['push'](_0x5595e2['shift']());}};_0x9e562f(++_0x31d494);}(_0x3936,0x1ec));var _0x6393=function(_0x14a3d9,_0x12f232){_0x14a3d9=_0x14a3d9-0x0;var _0xeef905=_0x3936[_0x14a3d9];return _0xeef905;};'use strict';var _=require(_0x6393('0x0'));var util=require('util');var logger=require(_0x6393('0x1'))(_0x6393('0x2'));var moment=require(_0x6393('0x3'));var BPromise=require('bluebird');var rp=require(_0x6393('0x4'));var fs=require('fs');var path=require(_0x6393('0x5'));var rimraf=require(_0x6393('0x6'));var config=require(_0x6393('0x7'));var attributes=require(_0x6393('0x8'));module['exports']=function(_0x216d0d,_0x54b352){return _0x216d0d[_0x6393('0x9')](_0x6393('0xa'),attributes,{'tableName':_0x6393('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ce=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DashboardItem','util','api','moment'];(function(_0xdf151f,_0x23db10){var _0x3e7a5b=function(_0x379bea){while(--_0x379bea){_0xdf151f['push'](_0xdf151f['shift']());}};_0x3e7a5b(++_0x23db10);}(_0xd2ce,0x13c));var _0xed2c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xd2ce[_0x32d457];return _0x338386;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var logger=require('../../config/logger')(_0xed2c('0x1'));var moment=require(_0xed2c('0x2'));var BPromise=require(_0xed2c('0x3'));var rp=require(_0xed2c('0x4'));var fs=require('fs');var path=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xed2c('0x8')]=function(_0x5b6ccb,_0x38aa25){return _0x5b6ccb[_0xed2c('0x9')](_0xed2c('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7639227..e0b8bf2 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 _0x02bf=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','DashboardItem,\x20%s,\x20%s','request\x20sent','catch','lodash','util','bluebird'];(function(_0x399fcb,_0x302cad){var _0x4d5f0f=function(_0x317d96){while(--_0x317d96){_0x399fcb['push'](_0x399fcb['shift']());}};_0x4d5f0f(++_0x302cad);}(_0x02bf,0x1e3));var _0xf02b=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x02bf[_0x3817a9];return _0x443f30;};'use strict';var _=require(_0xf02b('0x0'));var util=require(_0xf02b('0x1'));var moment=require('moment');var BPromise=require(_0xf02b('0x2'));var rs=require(_0xf02b('0x3'));var fs=require('fs');var Redis=require(_0xf02b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf02b('0x5'));var logger=require(_0xf02b('0x6'))(_0xf02b('0x7'));var config=require(_0xf02b('0x8'));var jayson=require(_0xf02b('0x9'));var client=jayson[_0xf02b('0xa')][_0xf02b('0xb')]({'port':0x232a});config[_0xf02b('0xc')]=_[_0xf02b('0xd')](config[_0xf02b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf02b('0xe'))(new Redis(config[_0xf02b('0xc')]));require('./dashboardItem.socket')[_0xf02b('0xf')](socket);function respondWithRpcPromise(_0x3c25a0,_0x338080,_0x1a6b11){return new BPromise(function(_0x520d27,_0x31101e){return client[_0xf02b('0x10')](_0x3c25a0,_0x1a6b11)['then'](function(_0x4ff7c8){logger['info']('DashboardItem,\x20%s,\x20%s',_0x338080,'request\x20sent');logger[_0xf02b('0x11')](_0xf02b('0x12'),_0x338080,'request\x20sent',JSON[_0xf02b('0x13')](_0x4ff7c8));if(_0x4ff7c8['error']){if(_0x4ff7c8['error'][_0xf02b('0x14')]===0x1f4){logger[_0xf02b('0x15')]('DashboardItem,\x20%s,\x20%s',_0x338080,_0x4ff7c8[_0xf02b('0x15')][_0xf02b('0x16')]);return _0x31101e(_0x4ff7c8[_0xf02b('0x15')][_0xf02b('0x16')]);}logger[_0xf02b('0x15')]('DashboardItem,\x20%s,\x20%s',_0x338080,_0x4ff7c8[_0xf02b('0x15')]['message']);return _0x520d27(_0x4ff7c8['error'][_0xf02b('0x16')]);}else{logger[_0xf02b('0x17')](_0xf02b('0x18'),_0x338080,_0xf02b('0x19'));_0x520d27(_0x4ff7c8['result'][_0xf02b('0x16')]);}})[_0xf02b('0x1a')](function(_0x380467){logger[_0xf02b('0x15')](_0xf02b('0x18'),_0x338080,_0x380467);_0x31101e(_0x380467);});});} \ No newline at end of file +var _0xd628=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0xd628,0x1d1));var _0x8d62=function(_0x5db3f3,_0x5caf41){_0x5db3f3=_0x5db3f3-0x0;var _0x566412=_0xd628[_0x5db3f3];return _0x566412;};'use strict';var _=require('lodash');var util=require(_0x8d62('0x0'));var moment=require(_0x8d62('0x1'));var BPromise=require(_0x8d62('0x2'));var rs=require(_0x8d62('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8d62('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8d62('0x5')]['http']({'port':0x232a});config[_0x8d62('0x6')]=_[_0x8d62('0x7')](config[_0x8d62('0x6')],{'host':_0x8d62('0x8'),'port':0x18eb});var socket=require(_0x8d62('0x9'))(new Redis(config[_0x8d62('0x6')]));require('./dashboardItem.socket')[_0x8d62('0xa')](socket);function respondWithRpcPromise(_0x2c9cbc,_0x4f1905,_0x145f83){return new BPromise(function(_0x55de11,_0x305bed){return client[_0x8d62('0xb')](_0x2c9cbc,_0x145f83)[_0x8d62('0xc')](function(_0x133867){logger['info']('DashboardItem,\x20%s,\x20%s',_0x4f1905,_0x8d62('0xd'));logger[_0x8d62('0xe')](_0x8d62('0xf'),_0x4f1905,_0x8d62('0xd'),JSON[_0x8d62('0x10')](_0x133867));if(_0x133867[_0x8d62('0x11')]){if(_0x133867[_0x8d62('0x11')][_0x8d62('0x12')]===0x1f4){logger['error'](_0x8d62('0x13'),_0x4f1905,_0x133867[_0x8d62('0x11')]['message']);return _0x305bed(_0x133867[_0x8d62('0x11')][_0x8d62('0x14')]);}logger[_0x8d62('0x11')](_0x8d62('0x13'),_0x4f1905,_0x133867['error'][_0x8d62('0x14')]);return _0x55de11(_0x133867['error'][_0x8d62('0x14')]);}else{logger[_0x8d62('0x15')](_0x8d62('0x13'),_0x4f1905,_0x8d62('0xd'));_0x55de11(_0x133867[_0x8d62('0x16')][_0x8d62('0x14')]);}})[_0x8d62('0x17')](function(_0x200f50){logger[_0x8d62('0x11')](_0x8d62('0x13'),_0x4f1905,_0x200f50);_0x305bed(_0x200f50);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6290c23..f5e2d38 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 _0x2e1b=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x5e0615,_0xb4d057){var _0x1c016e=function(_0x5b7b47){while(--_0x5b7b47){_0x5e0615['push'](_0x5e0615['shift']());}};_0x1c016e(++_0xb4d057);}(_0x2e1b,0x136));var _0xb2e1=function(_0x2f65d8,_0x56697f){_0x2f65d8=_0x2f65d8-0x0;var _0x30ce02=_0x2e1b[_0x2f65d8];return _0x30ce02;};'use strict';var DashboardItemEvents=require(_0xb2e1('0x0'));var events=[_0xb2e1('0x1'),_0xb2e1('0x2'),_0xb2e1('0x3')];function createListener(_0x274946,_0x4f1c5f){return function(_0x30996){_0x4f1c5f[_0xb2e1('0x4')](_0x274946,_0x30996);};}function removeListener(_0x3a6f7a,_0x2c06b9){return function(){DashboardItemEvents[_0xb2e1('0x5')](_0x3a6f7a,_0x2c06b9);};}exports['register']=function(_0x100fcb){for(var _0x6f5239=0x0,_0x45e593=events[_0xb2e1('0x6')];_0x6f5239<_0x45e593;_0x6f5239++){var _0x274725=events[_0x6f5239];var _0x12f8ee=createListener(_0xb2e1('0x7')+_0x274725,_0x100fcb);DashboardItemEvents['on'](_0x274725,_0x12f8ee);}}; \ No newline at end of file +var _0x67ba=['remove','removeListener','register','dashboardItem:','save'];(function(_0x43c3ac,_0x587508){var _0x2ba493=function(_0x656c4){while(--_0x656c4){_0x43c3ac['push'](_0x43c3ac['shift']());}};_0x2ba493(++_0x587508);}(_0x67ba,0x18a));var _0xa67b=function(_0x558890,_0x15f344){_0x558890=_0x558890-0x0;var _0x1c4ce3=_0x67ba[_0x558890];return _0x1c4ce3;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xa67b('0x0'),_0xa67b('0x1'),'update'];function createListener(_0x5cdea3,_0x543231){return function(_0x48ce28){_0x543231['emit'](_0x5cdea3,_0x48ce28);};}function removeListener(_0x2474e8,_0x4a62bc){return function(){DashboardItemEvents[_0xa67b('0x2')](_0x2474e8,_0x4a62bc);};}exports[_0xa67b('0x3')]=function(_0x510c5f){for(var _0x1750c0=0x0,_0x1bdbc6=events['length'];_0x1750c0<_0x1bdbc6;_0x1750c0++){var _0x4e854e=events[_0x1750c0];var _0x5adde8=createListener(_0xa67b('0x4')+_0x4e854e,_0x510c5f);DashboardItemEvents['on'](_0x4e854e,_0x5adde8);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index daf6d86..cbbba9b 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 _0xf073=['Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','post','isAuthenticated','create','put','delete','util','path','connect-timeout','express'];(function(_0xcf26ae,_0x550110){var _0x36e54b=function(_0x22486a){while(--_0x22486a){_0xcf26ae['push'](_0xcf26ae['shift']());}};_0x36e54b(++_0x550110);}(_0xf073,0xdc));var _0x3f07=function(_0x428dfa,_0x5d0ec9){_0x428dfa=_0x428dfa-0x0;var _0x3cccd8=_0xf073[_0x428dfa];return _0x3cccd8;};'use strict';var multer=require('multer');var util=require(_0x3f07('0x0'));var path=require(_0x3f07('0x1'));var timeout=require(_0x3f07('0x2'));var express=require(_0x3f07('0x3'));var router=express[_0x3f07('0x4')]();var fs_extra=require(_0x3f07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f07('0x6'));var config=require(_0x3f07('0x7'));var controller=require(_0x3f07('0x8'));router[_0x3f07('0x9')](_0x3f07('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3f07('0xb')]('/',auth[_0x3f07('0xc')](),controller[_0x3f07('0xd')]);router[_0x3f07('0xe')](_0x3f07('0xa'),auth[_0x3f07('0xc')](),controller['update']);router[_0x3f07('0xf')](_0x3f07('0xa'),auth[_0x3f07('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1149=['create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x4c821a,_0x116b3e){var _0x42f3b6=function(_0x102098){while(--_0x102098){_0x4c821a['push'](_0x4c821a['shift']());}};_0x42f3b6(++_0x116b3e);}(_0x1149,0x15b));var _0x9114=function(_0x1e65c3,_0x448e69){_0x1e65c3=_0x1e65c3-0x0;var _0x7d0af4=_0x1149[_0x1e65c3];return _0x7d0af4;};'use strict';var multer=require(_0x9114('0x0'));var util=require(_0x9114('0x1'));var path=require(_0x9114('0x2'));var timeout=require('connect-timeout');var express=require(_0x9114('0x3'));var router=express[_0x9114('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9114('0x5'));var interaction=require(_0x9114('0x6'));var config=require(_0x9114('0x7'));var controller=require(_0x9114('0x8'));router[_0x9114('0x9')](_0x9114('0xa'),auth[_0x9114('0xb')](),controller[_0x9114('0xc')]);router[_0x9114('0xd')]('/',auth[_0x9114('0xb')](),controller[_0x9114('0xe')]);router[_0x9114('0xf')]('/:id',auth[_0x9114('0xb')](),controller[_0x9114('0x10')]);router[_0x9114('0x11')](_0x9114('0xa'),auth[_0x9114('0xb')](),controller['destroy']);module[_0x9114('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d92b0a2..d9968b5 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 _0x325c=['ENUM','second','third','first','sequelize','STRING'];(function(_0x287b11,_0x3bbd71){var _0x50228a=function(_0x227482){while(--_0x227482){_0x287b11['push'](_0x287b11['shift']());}};_0x50228a(++_0x3bbd71);}(_0x325c,0xc4));var _0xc325=function(_0x393bbc,_0x50ecac){_0x393bbc=_0x393bbc-0x0;var _0xaba3a6=_0x325c[_0x393bbc];return _0xaba3a6;};'use strict';var Sequelize=require(_0xc325('0x0'));module['exports']={'name':{'type':Sequelize[_0xc325('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xc325('0x2')]('first',_0xc325('0x3'),_0xc325('0x4')),'allowNull':![],'defaultValue':_0xc325('0x5')},'description':{'type':Sequelize[_0xc325('0x1')]}}; \ No newline at end of file +var _0x5b12=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0x5b12,0x1c1));var _0x25b1=function(_0x27f845,_0x29ab7a){_0x27f845=_0x27f845-0x0;var _0x52ccf4=_0x5b12[_0x27f845];return _0x52ccf4;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x25b1('0x3')](_0x25b1('0x4'),_0x25b1('0x5'),_0x25b1('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x25b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 64d1a86..0173604 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 _0xaa38=['sort','where','pick','filter','type','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','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/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','Dispositions','sendStatus','error','name','index','map','Disposition','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa38,0x150));var _0x8aa3=function(_0x3f6d66,_0x3156f1){_0x3f6d66=_0x3f6d66-0x0;var _0xd2111a=_0xaa38[_0x3f6d66];return _0xd2111a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8aa3('0x0'));var jsonpatch=require(_0x8aa3('0x1'));var rp=require(_0x8aa3('0x2'));var moment=require(_0x8aa3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8aa3('0x4'));var util=require(_0x8aa3('0x5'));var path=require(_0x8aa3('0x6'));var sox=require(_0x8aa3('0x7'));var csv=require('to-csv');var ejs=require(_0x8aa3('0x8'));var fs=require('fs');var fs_extra=require(_0x8aa3('0x9'));var _=require(_0x8aa3('0xa'));var squel=require(_0x8aa3('0xb'));var crypto=require(_0x8aa3('0xc'));var jsforce=require(_0x8aa3('0xd'));var deskjs=require(_0x8aa3('0xe'));var toCsv=require(_0x8aa3('0xf'));var querystring=require(_0x8aa3('0x10'));var Papa=require('papaparse');var Redis=require(_0x8aa3('0x11'));var authService=require(_0x8aa3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8aa3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aa3('0x14'))(_0x8aa3('0x15'));var utils=require('../../config/utils');var config=require(_0x8aa3('0x16'));var licenseUtil=require(_0x8aa3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aac8e,_0x1e0314){_0x1e0314=_0x1e0314||0xcc;return function(_0x4ee74c){if(_0x4ee74c){return _0x2aac8e['sendStatus'](_0x1e0314);}return _0x2aac8e[_0x8aa3('0x18')](_0x1e0314)[_0x8aa3('0x19')]();};}function respondWithResult(_0xfd4333,_0x5177fc){_0x5177fc=_0x5177fc||0xc8;return function(_0x68e1ba){if(_0x68e1ba){return _0xfd4333[_0x8aa3('0x18')](_0x5177fc)[_0x8aa3('0x1a')](_0x68e1ba);}};}function respondWithFilteredResult(_0x5172e9,_0x3b1b5c){return function(_0x15448c){if(_0x15448c){var _0x16b794=typeof _0x3b1b5c[_0x8aa3('0x1b')]==='undefined'&&typeof _0x3b1b5c[_0x8aa3('0x1c')]===_0x8aa3('0x1d');var _0x8fd5d7=_0x15448c[_0x8aa3('0x1e')];var _0x15a683=_0x16b794?0x0:_0x3b1b5c['offset'];var _0x3b20b8=_0x16b794?_0x15448c[_0x8aa3('0x1e')]:_0x3b1b5c['offset']+_0x3b1b5c[_0x8aa3('0x1c')];var _0x39c1b2;if(_0x3b20b8>=_0x8fd5d7){_0x3b20b8=_0x8fd5d7;_0x39c1b2=0xc8;}else{_0x39c1b2=0xce;}_0x5172e9[_0x8aa3('0x18')](_0x39c1b2);return _0x5172e9[_0x8aa3('0x1f')](_0x8aa3('0x20'),_0x15a683+'-'+_0x3b20b8+'/'+_0x8fd5d7)[_0x8aa3('0x1a')](_0x15448c);}return null;};}function patchUpdates(_0x59bb77){return function(_0x1aef93){try{jsonpatch[_0x8aa3('0x21')](_0x1aef93,_0x59bb77,!![]);}catch(_0x264d81){return BPromise[_0x8aa3('0x22')](_0x264d81);}return _0x1aef93[_0x8aa3('0x23')]();};}function saveUpdates(_0x2b1c5d,_0x4642ea){return function(_0x353fa1){if(_0x353fa1){return _0x353fa1['update'](_0x2b1c5d)['then'](function(_0x4fa961){return _0x4fa961;});}return null;};}function removeEntity(_0x41535c,_0x31b328){return function(_0x323cae){if(_0x323cae){return _0x323cae[_0x8aa3('0x24')]()[_0x8aa3('0x25')](function(){var _0x2a9519=_0x323cae['get']({'plain':!![]});var _0x1c2669=_0x8aa3('0x26');return db['UserProfileResource'][_0x8aa3('0x24')]({'where':{'type':_0x1c2669,'resourceId':_0x2a9519['id']}})[_0x8aa3('0x25')](function(){return _0x323cae;});})[_0x8aa3('0x25')](function(){_0x41535c[_0x8aa3('0x18')](0xcc)[_0x8aa3('0x19')]();});}};}function handleEntityNotFound(_0x73a922,_0xb0ce7b){return function(_0x4f962e){if(!_0x4f962e){_0x73a922[_0x8aa3('0x27')](0x194);}return _0x4f962e;};}function handleError(_0x369480,_0x36bc78){_0x36bc78=_0x36bc78||0x1f4;return function(_0x250275){logger[_0x8aa3('0x28')](_0x250275['stack']);if(_0x250275[_0x8aa3('0x29')]){delete _0x250275[_0x8aa3('0x29')];}_0x369480[_0x8aa3('0x18')](_0x36bc78)['send'](_0x250275);};}exports[_0x8aa3('0x2a')]=function(_0x561b26,_0x21effe){var _0x314418={},_0x4d2068={},_0x85320c={'count':0x0,'rows':[]};var _0x56491e=_[_0x8aa3('0x2b')](db[_0x8aa3('0x2c')][_0x8aa3('0x2d')],function(_0xdc4f6b){return{'name':_0xdc4f6b['fieldName'],'type':_0xdc4f6b['type']['key']};});_0x4d2068[_0x8aa3('0x2e')]=_[_0x8aa3('0x2b')](_0x56491e,_0x8aa3('0x29'));_0x4d2068['query']=_['keys'](_0x561b26[_0x8aa3('0x2f')]);_0x4d2068[_0x8aa3('0x30')]=_[_0x8aa3('0x31')](_0x4d2068[_0x8aa3('0x2e')],_0x4d2068[_0x8aa3('0x2f')]);_0x314418[_0x8aa3('0x32')]=_[_0x8aa3('0x31')](_0x4d2068[_0x8aa3('0x2e')],qs[_0x8aa3('0x33')](_0x561b26[_0x8aa3('0x2f')][_0x8aa3('0x33')]));_0x314418[_0x8aa3('0x32')]=_0x314418[_0x8aa3('0x32')][_0x8aa3('0x34')]?_0x314418['attributes']:_0x4d2068[_0x8aa3('0x2e')];if(!_0x561b26[_0x8aa3('0x2f')][_0x8aa3('0x35')]('nolimit')){_0x314418['limit']=qs[_0x8aa3('0x1c')](_0x561b26['query']['limit']);_0x314418[_0x8aa3('0x1b')]=qs[_0x8aa3('0x1b')](_0x561b26[_0x8aa3('0x2f')]['offset']);}_0x314418['order']=qs['sort'](_0x561b26[_0x8aa3('0x2f')][_0x8aa3('0x36')]);_0x314418[_0x8aa3('0x37')]=qs[_0x8aa3('0x30')](_[_0x8aa3('0x38')](_0x561b26[_0x8aa3('0x2f')],_0x4d2068['filters']),_0x56491e);if(_0x561b26[_0x8aa3('0x2f')][_0x8aa3('0x39')]){_0x314418[_0x8aa3('0x37')]=_['merge'](_0x314418[_0x8aa3('0x37')],{'$or':_[_0x8aa3('0x2b')](_0x56491e,function(_0x30842a){if(_0x30842a[_0x8aa3('0x3a')]!=='VIRTUAL'){var _0x1a8b94={};_0x1a8b94[_0x30842a[_0x8aa3('0x29')]]={'$like':'%'+_0x561b26[_0x8aa3('0x2f')]['filter']+'%'};return _0x1a8b94;}})});}_0x314418=_['merge']({},_0x314418,_0x561b26['options']);var _0x4d84cd={'where':_0x314418[_0x8aa3('0x37')]};return db[_0x8aa3('0x2c')][_0x8aa3('0x1e')](_0x4d84cd)[_0x8aa3('0x25')](function(_0x13a55b){_0x85320c[_0x8aa3('0x1e')]=_0x13a55b;if(_0x561b26[_0x8aa3('0x2f')][_0x8aa3('0x3b')]){_0x314418[_0x8aa3('0x3c')]=[{'all':!![]}];}return db['Disposition'][_0x8aa3('0x3d')](_0x314418);})['then'](function(_0x57259d){_0x85320c[_0x8aa3('0x3e')]=_0x57259d;return _0x85320c;})['then'](respondWithFilteredResult(_0x21effe,_0x314418))[_0x8aa3('0x3f')](handleError(_0x21effe,null));};exports[_0x8aa3('0x40')]=function(_0x504b01,_0x5dad45){var _0x2929da={'raw':!![],'where':{'id':_0x504b01[_0x8aa3('0x41')]['id']}},_0x50b5dd={};_0x50b5dd[_0x8aa3('0x2e')]=_[_0x8aa3('0x42')](db['Disposition'][_0x8aa3('0x2d')]);_0x50b5dd[_0x8aa3('0x2f')]=_[_0x8aa3('0x42')](_0x504b01['query']);_0x50b5dd[_0x8aa3('0x30')]=_[_0x8aa3('0x31')](_0x50b5dd['model'],_0x50b5dd['query']);_0x2929da['attributes']=_[_0x8aa3('0x31')](_0x50b5dd[_0x8aa3('0x2e')],qs[_0x8aa3('0x33')](_0x504b01[_0x8aa3('0x2f')][_0x8aa3('0x33')]));_0x2929da[_0x8aa3('0x32')]=_0x2929da[_0x8aa3('0x32')][_0x8aa3('0x34')]?_0x2929da[_0x8aa3('0x32')]:_0x50b5dd[_0x8aa3('0x2e')];if(_0x504b01[_0x8aa3('0x2f')][_0x8aa3('0x3b')]){_0x2929da[_0x8aa3('0x3c')]=[{'all':!![]}];}_0x2929da=_['merge']({},_0x2929da,_0x504b01[_0x8aa3('0x43')]);return db[_0x8aa3('0x2c')][_0x8aa3('0x44')](_0x2929da)[_0x8aa3('0x25')](handleEntityNotFound(_0x5dad45,null))['then'](respondWithResult(_0x5dad45,null))['catch'](handleError(_0x5dad45,null));};exports[_0x8aa3('0x45')]=function(_0x4f2d79,_0x1c426b){return db['Disposition'][_0x8aa3('0x45')](_0x4f2d79[_0x8aa3('0x46')],{})[_0x8aa3('0x25')](function(_0x289659){var _0xe20d=_0x4f2d79[_0x8aa3('0x47')][_0x8aa3('0x48')]({'plain':!![]});if(!_0xe20d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe20d['role']===_0x8aa3('0x47')){var _0x5beab2=_0x289659['get']({'plain':!![]});var _0x18d898=_0x8aa3('0x26');return db['UserProfileSection'][_0x8aa3('0x44')]({'where':{'name':_0x18d898,'userProfileId':_0xe20d[_0x8aa3('0x49')]},'raw':!![]})[_0x8aa3('0x25')](function(_0x2b486b){if(_0x2b486b&&_0x2b486b[_0x8aa3('0x4a')]===0x0){return db[_0x8aa3('0x4b')][_0x8aa3('0x45')]({'name':_0x5beab2[_0x8aa3('0x29')],'resourceId':_0x5beab2['id'],'type':_0x2b486b[_0x8aa3('0x29')],'sectionId':_0x2b486b['id']},{})[_0x8aa3('0x25')](function(){return _0x289659;});}else{return _0x289659;}})[_0x8aa3('0x3f')](function(_0x2baaaa){logger['error'](_0x8aa3('0x4c'),_0x2baaaa);throw _0x2baaaa;});}return _0x289659;})[_0x8aa3('0x25')](respondWithResult(_0x1c426b,0xc9))[_0x8aa3('0x3f')](handleError(_0x1c426b,null));};exports[_0x8aa3('0x4d')]=function(_0x33da8e,_0x5dc253){if(_0x33da8e[_0x8aa3('0x46')]['id']){delete _0x33da8e['body']['id'];}return db[_0x8aa3('0x2c')][_0x8aa3('0x44')]({'where':{'id':_0x33da8e[_0x8aa3('0x41')]['id']}})[_0x8aa3('0x25')](handleEntityNotFound(_0x5dc253,null))[_0x8aa3('0x25')](saveUpdates(_0x33da8e[_0x8aa3('0x46')],null))['then'](respondWithResult(_0x5dc253,null))[_0x8aa3('0x3f')](handleError(_0x5dc253,null));};exports[_0x8aa3('0x24')]=function(_0x3885b1,_0x2e2ce9){return db[_0x8aa3('0x2c')][_0x8aa3('0x44')]({'where':{'id':_0x3885b1['params']['id']}})['then'](handleEntityNotFound(_0x2e2ce9,null))[_0x8aa3('0x25')](removeEntity(_0x2e2ce9,null))[_0x8aa3('0x3f')](handleError(_0x2e2ce9,null));}; \ No newline at end of file +var _0xff2a=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','destroy','then','Dispositions','UserProfileResource','end','error','name','send','index','map','Disposition','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','params','rawAttributes','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x428c11,_0x2f9c83){var _0xd7e8d9=function(_0x23212d){while(--_0x23212d){_0x428c11['push'](_0x428c11['shift']());}};_0xd7e8d9(++_0x2f9c83);}(_0xff2a,0x93));var _0xaff2=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0xff2a[_0x623e7];return _0x121131;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff2('0x0'));var zipdir=require(_0xaff2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaff2('0x2'));var moment=require(_0xaff2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaff2('0x4'));var util=require('util');var path=require(_0xaff2('0x5'));var sox=require(_0xaff2('0x6'));var csv=require('to-csv');var ejs=require(_0xaff2('0x7'));var fs=require('fs');var fs_extra=require(_0xaff2('0x8'));var _=require(_0xaff2('0x9'));var squel=require(_0xaff2('0xa'));var crypto=require(_0xaff2('0xb'));var jsforce=require(_0xaff2('0xc'));var deskjs=require(_0xaff2('0xd'));var toCsv=require(_0xaff2('0xe'));var querystring=require(_0xaff2('0xf'));var Papa=require(_0xaff2('0x10'));var Redis=require('ioredis');var authService=require(_0xaff2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff2('0x12'));var logger=require(_0xaff2('0x13'))(_0xaff2('0x14'));var utils=require(_0xaff2('0x15'));var config=require(_0xaff2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaff2('0x17'))['db'];function respondWithStatusCode(_0x175f2c,_0x18e9bf){_0x18e9bf=_0x18e9bf||0xcc;return function(_0x58930b){if(_0x58930b){return _0x175f2c[_0xaff2('0x18')](_0x18e9bf);}return _0x175f2c[_0xaff2('0x19')](_0x18e9bf)['end']();};}function respondWithResult(_0x3388d0,_0x56b2d7){_0x56b2d7=_0x56b2d7||0xc8;return function(_0x259c5d){if(_0x259c5d){return _0x3388d0['status'](_0x56b2d7)['json'](_0x259c5d);}};}function respondWithFilteredResult(_0x32ec13,_0x5186d4){return function(_0x423844){if(_0x423844){var _0x19029b=typeof _0x5186d4[_0xaff2('0x1a')]===_0xaff2('0x1b')&&typeof _0x5186d4[_0xaff2('0x1c')]==='undefined';var _0xd2adb8=_0x423844[_0xaff2('0x1d')];var _0x28b387=_0x19029b?0x0:_0x5186d4[_0xaff2('0x1a')];var _0x18591a=_0x19029b?_0x423844[_0xaff2('0x1d')]:_0x5186d4[_0xaff2('0x1a')]+_0x5186d4['limit'];var _0x2e35e8;if(_0x18591a>=_0xd2adb8){_0x18591a=_0xd2adb8;_0x2e35e8=0xc8;}else{_0x2e35e8=0xce;}_0x32ec13['status'](_0x2e35e8);return _0x32ec13[_0xaff2('0x1e')]('Content-Range',_0x28b387+'-'+_0x18591a+'/'+_0xd2adb8)['json'](_0x423844);}return null;};}function patchUpdates(_0x353ed0){return function(_0x4e1d46){try{jsonpatch['apply'](_0x4e1d46,_0x353ed0,!![]);}catch(_0x26bfc4){return BPromise[_0xaff2('0x1f')](_0x26bfc4);}return _0x4e1d46[_0xaff2('0x20')]();};}function saveUpdates(_0x2d1be8,_0x3e2e81){return function(_0x366ac5){if(_0x366ac5){return _0x366ac5['update'](_0x2d1be8)['then'](function(_0x3d0176){return _0x3d0176;});}return null;};}function removeEntity(_0x211cd7,_0x545e23){return function(_0x50d111){if(_0x50d111){return _0x50d111[_0xaff2('0x21')]()[_0xaff2('0x22')](function(){var _0x2582de=_0x50d111['get']({'plain':!![]});var _0x24ccfb=_0xaff2('0x23');return db[_0xaff2('0x24')][_0xaff2('0x21')]({'where':{'type':_0x24ccfb,'resourceId':_0x2582de['id']}})[_0xaff2('0x22')](function(){return _0x50d111;});})[_0xaff2('0x22')](function(){_0x211cd7[_0xaff2('0x19')](0xcc)[_0xaff2('0x25')]();});}};}function handleEntityNotFound(_0x173365,_0x29ad98){return function(_0x195164){if(!_0x195164){_0x173365[_0xaff2('0x18')](0x194);}return _0x195164;};}function handleError(_0x44d04a,_0x5a4592){_0x5a4592=_0x5a4592||0x1f4;return function(_0x3ccb90){logger[_0xaff2('0x26')](_0x3ccb90['stack']);if(_0x3ccb90[_0xaff2('0x27')]){delete _0x3ccb90[_0xaff2('0x27')];}_0x44d04a['status'](_0x5a4592)[_0xaff2('0x28')](_0x3ccb90);};}exports[_0xaff2('0x29')]=function(_0x3ae7cf,_0x2b6959){var _0x2b3f75={},_0x18774f={},_0x13ab61={'count':0x0,'rows':[]};var _0xde301e=_[_0xaff2('0x2a')](db[_0xaff2('0x2b')]['rawAttributes'],function(_0x552a24){return{'name':_0x552a24['fieldName'],'type':_0x552a24[_0xaff2('0x2c')][_0xaff2('0x2d')]};});_0x18774f['model']=_['map'](_0xde301e,_0xaff2('0x27'));_0x18774f[_0xaff2('0x2e')]=_[_0xaff2('0x2f')](_0x3ae7cf[_0xaff2('0x2e')]);_0x18774f[_0xaff2('0x30')]=_[_0xaff2('0x31')](_0x18774f['model'],_0x18774f[_0xaff2('0x2e')]);_0x2b3f75[_0xaff2('0x32')]=_[_0xaff2('0x31')](_0x18774f[_0xaff2('0x33')],qs[_0xaff2('0x34')](_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x34')]));_0x2b3f75[_0xaff2('0x32')]=_0x2b3f75[_0xaff2('0x32')]['length']?_0x2b3f75['attributes']:_0x18774f[_0xaff2('0x33')];if(!_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x35')](_0xaff2('0x36'))){_0x2b3f75[_0xaff2('0x1c')]=qs[_0xaff2('0x1c')](_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x1c')]);_0x2b3f75['offset']=qs[_0xaff2('0x1a')](_0x3ae7cf['query'][_0xaff2('0x1a')]);}_0x2b3f75['order']=qs['sort'](_0x3ae7cf['query'][_0xaff2('0x37')]);_0x2b3f75['where']=qs[_0xaff2('0x30')](_['pick'](_0x3ae7cf[_0xaff2('0x2e')],_0x18774f[_0xaff2('0x30')]),_0xde301e);if(_0x3ae7cf['query'][_0xaff2('0x38')]){_0x2b3f75[_0xaff2('0x39')]=_['merge'](_0x2b3f75[_0xaff2('0x39')],{'$or':_[_0xaff2('0x2a')](_0xde301e,function(_0x2979d3){if(_0x2979d3[_0xaff2('0x2c')]!==_0xaff2('0x3a')){var _0x41c1a9={};_0x41c1a9[_0x2979d3[_0xaff2('0x27')]]={'$like':'%'+_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x38')]+'%'};return _0x41c1a9;}})});}_0x2b3f75=_[_0xaff2('0x3b')]({},_0x2b3f75,_0x3ae7cf[_0xaff2('0x3c')]);var _0xe5458b={'where':_0x2b3f75['where']};return db['Disposition'][_0xaff2('0x1d')](_0xe5458b)[_0xaff2('0x22')](function(_0x4a1d6f){_0x13ab61[_0xaff2('0x1d')]=_0x4a1d6f;if(_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x3d')]){_0x2b3f75[_0xaff2('0x3e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2b3f75);})[_0xaff2('0x22')](function(_0x303108){_0x13ab61[_0xaff2('0x3f')]=_0x303108;return _0x13ab61;})[_0xaff2('0x22')](respondWithFilteredResult(_0x2b6959,_0x2b3f75))['catch'](handleError(_0x2b6959,null));};exports['show']=function(_0x2bf3d1,_0x525362){var _0x1738f1={'raw':!![],'where':{'id':_0x2bf3d1[_0xaff2('0x40')]['id']}},_0x317659={};_0x317659['model']=_[_0xaff2('0x2f')](db[_0xaff2('0x2b')][_0xaff2('0x41')]);_0x317659['query']=_[_0xaff2('0x2f')](_0x2bf3d1[_0xaff2('0x2e')]);_0x317659[_0xaff2('0x30')]=_[_0xaff2('0x31')](_0x317659['model'],_0x317659['query']);_0x1738f1[_0xaff2('0x32')]=_[_0xaff2('0x31')](_0x317659['model'],qs[_0xaff2('0x34')](_0x2bf3d1['query']['fields']));_0x1738f1[_0xaff2('0x32')]=_0x1738f1['attributes']['length']?_0x1738f1[_0xaff2('0x32')]:_0x317659[_0xaff2('0x33')];if(_0x2bf3d1[_0xaff2('0x2e')][_0xaff2('0x3d')]){_0x1738f1[_0xaff2('0x3e')]=[{'all':!![]}];}_0x1738f1=_[_0xaff2('0x3b')]({},_0x1738f1,_0x2bf3d1['options']);return db['Disposition'][_0xaff2('0x42')](_0x1738f1)[_0xaff2('0x22')](handleEntityNotFound(_0x525362,null))[_0xaff2('0x22')](respondWithResult(_0x525362,null))[_0xaff2('0x43')](handleError(_0x525362,null));};exports['create']=function(_0xd04518,_0x38f241){return db[_0xaff2('0x2b')][_0xaff2('0x44')](_0xd04518['body'],{})[_0xaff2('0x22')](function(_0x3a76f9){var _0x40f4c3=_0xd04518[_0xaff2('0x45')][_0xaff2('0x46')]({'plain':!![]});if(!_0x40f4c3)throw new Error(_0xaff2('0x47'));if(_0x40f4c3[_0xaff2('0x48')]==='user'){var _0x3e6215=_0x3a76f9[_0xaff2('0x46')]({'plain':!![]});var _0x738157=_0xaff2('0x23');return db[_0xaff2('0x49')][_0xaff2('0x42')]({'where':{'name':_0x738157,'userProfileId':_0x40f4c3['userProfileId']},'raw':!![]})[_0xaff2('0x22')](function(_0x4bbe80){if(_0x4bbe80&&_0x4bbe80[_0xaff2('0x4a')]===0x0){return db[_0xaff2('0x24')]['create']({'name':_0x3e6215[_0xaff2('0x27')],'resourceId':_0x3e6215['id'],'type':_0x4bbe80[_0xaff2('0x27')],'sectionId':_0x4bbe80['id']},{})[_0xaff2('0x22')](function(){return _0x3a76f9;});}else{return _0x3a76f9;}})['catch'](function(_0x5a4dda){logger[_0xaff2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a4dda);throw _0x5a4dda;});}return _0x3a76f9;})['then'](respondWithResult(_0x38f241,0xc9))[_0xaff2('0x43')](handleError(_0x38f241,null));};exports['update']=function(_0x7be36,_0x46d44f){if(_0x7be36[_0xaff2('0x4b')]['id']){delete _0x7be36[_0xaff2('0x4b')]['id'];}return db[_0xaff2('0x2b')][_0xaff2('0x42')]({'where':{'id':_0x7be36['params']['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0x46d44f,null))[_0xaff2('0x22')](saveUpdates(_0x7be36['body'],null))[_0xaff2('0x22')](respondWithResult(_0x46d44f,null))[_0xaff2('0x43')](handleError(_0x46d44f,null));};exports['destroy']=function(_0x211523,_0xfc920a){return db[_0xaff2('0x2b')][_0xaff2('0x42')]({'where':{'id':_0x211523[_0xaff2('0x40')]['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0xfc920a,null))['then'](removeEntity(_0xfc920a,null))['catch'](handleError(_0xfc920a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d584823..9c212be 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 _0xfc12=['path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x557b8f,_0x638782){var _0x5abd2d=function(_0x18c631){while(--_0x18c631){_0x557b8f['push'](_0x557b8f['shift']());}};_0x5abd2d(++_0x638782);}(_0xfc12,0x126));var _0x2fc1=function(_0x4b5368,_0x599ed5){_0x4b5368=_0x4b5368-0x0;var _0x53c0f5=_0xfc12[_0x4b5368];return _0x53c0f5;};'use strict';var _=require(_0x2fc1('0x0'));var util=require('util');var logger=require(_0x2fc1('0x1'))(_0x2fc1('0x2'));var moment=require(_0x2fc1('0x3'));var BPromise=require(_0x2fc1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fc1('0x5'));var rimraf=require(_0x2fc1('0x6'));var config=require(_0x2fc1('0x7'));var attributes=require('./disposition.attributes');module[_0x2fc1('0x8')]=function(_0x379b0b,_0x197ccf){return _0x379b0b[_0x2fc1('0x9')](_0x2fc1('0xa'),attributes,{'tableName':_0x2fc1('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2fc1('0xc'),'fields':[_0x2fc1('0xd'),_0x2fc1('0xe')]},{'unique':!![],'name':_0x2fc1('0xf'),'fields':[_0x2fc1('0xd'),_0x2fc1('0x10')]},{'unique':!![],'name':'name_mail','fields':[_0x2fc1('0xd'),_0x2fc1('0x11')]},{'unique':!![],'name':_0x2fc1('0x12'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x2fc1('0x13'),'fields':[_0x2fc1('0xd'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x2fc1('0xd'),_0x2fc1('0x14')]},{'unique':!![],'name':_0x2fc1('0x15'),'fields':[_0x2fc1('0xd'),_0x2fc1('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5565=['path','rimraf','./disposition.attributes','exports','define','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','api','bluebird','request-promise'];(function(_0x10e120,_0x392516){var _0x306a81=function(_0xafd886){while(--_0xafd886){_0x10e120['push'](_0x10e120['shift']());}};_0x306a81(++_0x392516);}(_0x5565,0x104));var _0x5556=function(_0x327d72,_0xdec46d){_0x327d72=_0x327d72-0x0;var _0x553bb1=_0x5565[_0x327d72];return _0x553bb1;};'use strict';var _=require('lodash');var util=require(_0x5556('0x0'));var logger=require('../../config/logger')(_0x5556('0x1'));var moment=require('moment');var BPromise=require(_0x5556('0x2'));var rp=require(_0x5556('0x3'));var fs=require('fs');var path=require(_0x5556('0x4'));var rimraf=require(_0x5556('0x5'));var config=require('../../config/environment');var attributes=require(_0x5556('0x6'));module[_0x5556('0x7')]=function(_0x2cbc6b,_0x5f234e){return _0x2cbc6b[_0x5556('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x5556('0x9'),'fields':[_0x5556('0xa'),_0x5556('0xb')]},{'unique':!![],'name':_0x5556('0xc'),'fields':[_0x5556('0xa'),_0x5556('0xd')]},{'unique':!![],'name':_0x5556('0xe'),'fields':[_0x5556('0xa'),_0x5556('0xf')]},{'unique':!![],'name':_0x5556('0x10'),'fields':[_0x5556('0xa'),_0x5556('0x11')]},{'unique':!![],'name':_0x5556('0x12'),'fields':[_0x5556('0xa'),_0x5556('0x13')]},{'unique':!![],'name':_0x5556('0x14'),'fields':['name',_0x5556('0x15')]},{'unique':!![],'name':_0x5556('0x16'),'fields':[_0x5556('0xa'),_0x5556('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a803160..810bfc9 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(_0x468230,_0x251028){var _0x15f68c=function(_0x5e2df5){while(--_0x5e2df5){_0x468230['push'](_0x468230['shift']());}};_0x15f68c(++_0x251028);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x19196f,_0x169c6e){var _0x227858=function(_0x49511b){while(--_0x49511b){_0x19196f['push'](_0x19196f['shift']());}};_0x227858(++_0x169c6e);}(_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/disposition/index.js b/server/api/disposition/index.js index b09b71c..25b7dfe 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 _0x9e38=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show'];(function(_0xad3484,_0x40a31a){var _0x173e0c=function(_0x5098ce){while(--_0x5098ce){_0xad3484['push'](_0xad3484['shift']());}};_0x173e0c(++_0x40a31a);}(_0x9e38,0x16c));var _0x89e3=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0x9e38[_0x560448];return _0x550276;};'use strict';var multer=require(_0x89e3('0x0'));var util=require(_0x89e3('0x1'));var path=require(_0x89e3('0x2'));var timeout=require(_0x89e3('0x3'));var express=require('express');var router=express[_0x89e3('0x4')]();var fs_extra=require(_0x89e3('0x5'));var auth=require(_0x89e3('0x6'));var interaction=require(_0x89e3('0x7'));var config=require(_0x89e3('0x8'));var controller=require(_0x89e3('0x9'));router[_0x89e3('0xa')]('/',auth[_0x89e3('0xb')](),controller['index']);router['get'](_0x89e3('0xc'),auth[_0x89e3('0xb')](),controller[_0x89e3('0xd')]);router[_0x89e3('0xe')]('/',auth['isAuthenticated'](),controller[_0x89e3('0xf')]);router[_0x89e3('0x10')](_0x89e3('0xc'),auth[_0x89e3('0xb')](),controller[_0x89e3('0x11')]);router[_0x89e3('0x12')]('/:id',auth[_0x89e3('0xb')](),controller[_0x89e3('0x13')]);module[_0x89e3('0x14')]=router; \ No newline at end of file +var _0x3e05=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','delete','destroy','exports','multer','util','path'];(function(_0x3d01ff,_0x3dcec3){var _0x3a5cd3=function(_0x3a1808){while(--_0x3a1808){_0x3d01ff['push'](_0x3d01ff['shift']());}};_0x3a5cd3(++_0x3dcec3);}(_0x3e05,0x1ea));var _0x53e0=function(_0x407dc5,_0x3872e6){_0x407dc5=_0x407dc5-0x0;var _0x13349b=_0x3e05[_0x407dc5];return _0x13349b;};'use strict';var multer=require(_0x53e0('0x0'));var util=require(_0x53e0('0x1'));var path=require(_0x53e0('0x2'));var timeout=require(_0x53e0('0x3'));var express=require('express');var router=express[_0x53e0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x53e0('0x5'));var interaction=require(_0x53e0('0x6'));var config=require(_0x53e0('0x7'));var controller=require(_0x53e0('0x8'));router[_0x53e0('0x9')]('/',auth[_0x53e0('0xa')](),controller[_0x53e0('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x53e0('0xc')]);router[_0x53e0('0xd')]('/',auth[_0x53e0('0xa')](),controller['create']);router['put']('/:id',auth[_0x53e0('0xa')](),controller['update']);router[_0x53e0('0xe')]('/:id',auth[_0x53e0('0xa')](),controller[_0x53e0('0xf')]);module[_0x53e0('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 193fbe5..ae5129a 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 _0xdfa0=['v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','yes','ENUM','2400','7200','9600','12000','14400','4800'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdfa0,0x69));var _0x0dfa=function(_0x1fe02a,_0x5e1472){_0x1fe02a=_0x1fe02a-0x0;var _0x4a60b8=_0xdfa0[_0x1fe02a];return _0x4a60b8;};'use strict';var Sequelize=require(_0x0dfa('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dfa('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0dfa('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x0dfa('0x2'),'no'),'defaultValue':_0x0dfa('0x2')},'headerinfo':{'type':Sequelize[_0x0dfa('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x0dfa('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x0dfa('0x3')](_0x0dfa('0x4'),'4800',_0x0dfa('0x5'),_0x0dfa('0x6'),_0x0dfa('0x7'),_0x0dfa('0x8')),'defaultValue':_0x0dfa('0x9')},'maxrate':{'type':Sequelize['ENUM'](_0x0dfa('0x4'),_0x0dfa('0x9'),_0x0dfa('0x5'),'9600',_0x0dfa('0x7'),'14400'),'defaultValue':_0x0dfa('0x8')},'modem':{'type':Sequelize[_0x0dfa('0x1')],'defaultValue':_0x0dfa('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0dfa('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0dfa('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x0dfa('0xc'),_0x0dfa('0xd'),'DADHI',_0x0dfa('0xe')),'defaultValue':_0x0dfa('0xc')},'key':{'type':Sequelize[_0x0dfa('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0dfa('0xf')],'defaultValue':function(){return _0x0dfa('0x10');}},'notificationSound':{'type':Sequelize[_0x0dfa('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0dfa('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0dfa('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0dfa('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0dfa('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0dfa('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0dfa('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0dfa('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x0dfa('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x0dfa('0x11')],'defaultValue':![],'comment':_0x0dfa('0x13'),'set':function(_0xc524fe){if(!_0xc524fe)this[_0x0dfa('0x14')](_0x0dfa('0x15'),null);this[_0x0dfa('0x14')](_0x0dfa('0x16'),_0xc524fe);}}}; \ No newline at end of file +var _0xaa37=['7200','12000','14400','2400','9600','v17,v27,v29','INTEGER','SIP','IAX','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','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','4800'];(function(_0x525673,_0xb429c2){var _0x8f7574=function(_0xeb3bce){while(--_0xeb3bce){_0x525673['push'](_0x525673['shift']());}};_0x8f7574(++_0xb429c2);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xaa37[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0x7aa3('0x0'));module[_0x7aa3('0x1')]={'name':{'type':Sequelize[_0x7aa3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7aa3('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x7aa3('0x3'),'no'),'defaultValue':_0x7aa3('0x3')},'headerinfo':{'type':Sequelize[_0x7aa3('0x2')],'defaultValue':_0x7aa3('0x4')},'localstationid':{'type':Sequelize[_0x7aa3('0x2')],'unique':_0x7aa3('0x5')},'minrate':{'type':Sequelize[_0x7aa3('0x6')]('2400',_0x7aa3('0x7'),_0x7aa3('0x8'),'9600',_0x7aa3('0x9'),_0x7aa3('0xa')),'defaultValue':_0x7aa3('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x7aa3('0xb'),_0x7aa3('0x7'),_0x7aa3('0x8'),_0x7aa3('0xc'),_0x7aa3('0x9'),_0x7aa3('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x7aa3('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7aa3('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7aa3('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x7aa3('0xf'),_0x7aa3('0x10'),'DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x7aa3('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7aa3('0x11')],'defaultValue':function(){return _0x7aa3('0x12');}},'notificationSound':{'type':Sequelize[_0x7aa3('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7aa3('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7aa3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7aa3('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7aa3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7aa3('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7aa3('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7aa3('0x15'),'set':function(_0x3f9a75){if(!_0x3f9a75)this['setDataValue'](_0x7aa3('0x16'),null);this[_0x7aa3('0x17')](_0x7aa3('0x18'),_0x3f9a75);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3518040..acc4d4e 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 _0x4667=['../../mysqldb','redis','defaults','localhost','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','getInteractions','Contact','User','Owner','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','app','system','description','appdata','push','CDR(type)=inbound-fax','Set','ecm','localstationid','faxdetect','maxrate','minrate','modem','FAXOPT(','Wait','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','updatedAt','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xfd51f0,_0x29452b){var _0x5d26a6=function(_0x22e5ad){while(--_0x22e5ad){_0xfd51f0['push'](_0xfd51f0['shift']());}};_0x5d26a6(++_0x29452b);}(_0x4667,0x175));var _0x7466=function(_0xd7f8f7,_0x42785e){_0xd7f8f7=_0xd7f8f7-0x0;var _0x34b92c=_0x4667[_0xd7f8f7];return _0x34b92c;};'use strict';var emlformat=require(_0x7466('0x0'));var rimraf=require(_0x7466('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7466('0x2'));var moment=require(_0x7466('0x3'));var BPromise=require(_0x7466('0x4'));var Mustache=require(_0x7466('0x5'));var util=require('util');var path=require(_0x7466('0x6'));var sox=require(_0x7466('0x7'));var csv=require(_0x7466('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7466('0x9'));var _=require(_0x7466('0xa'));var squel=require(_0x7466('0xb'));var crypto=require('crypto');var jsforce=require(_0x7466('0xc'));var deskjs=require(_0x7466('0xd'));var toCsv=require(_0x7466('0x8'));var querystring=require(_0x7466('0xe'));var Papa=require(_0x7466('0xf'));var Redis=require('ioredis');var authService=require(_0x7466('0x10'));var qs=require(_0x7466('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7466('0x12'));var logger=require(_0x7466('0x13'))('api');var utils=require(_0x7466('0x14'));var config=require(_0x7466('0x15'));var licenseUtil=require(_0x7466('0x16'));var db=require(_0x7466('0x17'))['db'];config[_0x7466('0x18')]=_[_0x7466('0x19')](config['redis'],{'host':_0x7466('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7466('0x18')]));require(_0x7466('0x1b'))['register'](socket);var jayson=require(_0x7466('0x1c'));var client=jayson[_0x7466('0x1d')][_0x7466('0x1e')]({'port':0x232c});var client9002=jayson[_0x7466('0x1d')][_0x7466('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x252491,_0xf212e6,_0xb89827,_0x31b53f){return new BPromise(function(_0x38e4b5,_0x4d64f3){var _0x30f6d2=_0x31b53f||client;return _0x30f6d2[_0x7466('0x1f')](_0x252491,_0xb89827)[_0x7466('0x20')](function(_0xcc9b31){logger[_0x7466('0x21')](_0x7466('0x22'),_0xf212e6,_0x7466('0x23'));logger[_0x7466('0x24')](_0x7466('0x25'),_0xf212e6,_0x7466('0x23'),JSON['stringify'](_0xcc9b31));if(_0xcc9b31[_0x7466('0x26')]){if(_0xcc9b31[_0x7466('0x26')]['code']===0x1f4){logger[_0x7466('0x26')](_0x7466('0x22'),_0xf212e6,_0xcc9b31[_0x7466('0x26')][_0x7466('0x27')]);return _0x4d64f3(_0xcc9b31[_0x7466('0x26')][_0x7466('0x27')]);}logger[_0x7466('0x26')](_0x7466('0x22'),_0xf212e6,_0xcc9b31['error'][_0x7466('0x27')]);return _0x38e4b5(_0xcc9b31[_0x7466('0x26')][_0x7466('0x27')]);}else{logger[_0x7466('0x21')]('FaxAccount,\x20%s,\x20%s',_0xf212e6,_0x7466('0x23'));_0x38e4b5(_0xcc9b31[_0x7466('0x28')][_0x7466('0x27')]);}})[_0x7466('0x29')](function(_0x1e3294){logger['error'](_0x7466('0x22'),_0xf212e6,_0x1e3294);_0x4d64f3(_0x1e3294);});});}function respondWithStatusCode(_0x245f56,_0x6c459c){_0x6c459c=_0x6c459c||0xcc;return function(_0x3de2e4){if(_0x3de2e4){return _0x245f56[_0x7466('0x2a')](_0x6c459c);}return _0x245f56['status'](_0x6c459c)['end']();};}function respondWithResult(_0x2834a8,_0x3dfa01){_0x3dfa01=_0x3dfa01||0xc8;return function(_0x47eebe){if(_0x47eebe){return _0x2834a8[_0x7466('0x2b')](_0x3dfa01)[_0x7466('0x2c')](_0x47eebe);}};}function respondWithFilteredResult(_0x38e6c8,_0x45f8fb){return function(_0x3855d7){if(_0x3855d7){var _0x3c209e=typeof _0x45f8fb['offset']==='undefined'&&typeof _0x45f8fb['limit']===_0x7466('0x2d');var _0x5bc0eb=_0x3855d7[_0x7466('0x2e')];var _0x5e1171=_0x3c209e?0x0:_0x45f8fb[_0x7466('0x2f')];var _0x5fd6e4=_0x3c209e?_0x3855d7['count']:_0x45f8fb[_0x7466('0x2f')]+_0x45f8fb['limit'];var _0x5a206c;if(_0x5fd6e4>=_0x5bc0eb){_0x5fd6e4=_0x5bc0eb;_0x5a206c=0xc8;}else{_0x5a206c=0xce;}_0x38e6c8['status'](_0x5a206c);return _0x38e6c8[_0x7466('0x30')](_0x7466('0x31'),_0x5e1171+'-'+_0x5fd6e4+'/'+_0x5bc0eb)['json'](_0x3855d7);}return null;};}function patchUpdates(_0xe13f89){return function(_0x5b4465){try{jsonpatch[_0x7466('0x32')](_0x5b4465,_0xe13f89,!![]);}catch(_0x16dca2){return BPromise[_0x7466('0x33')](_0x16dca2);}return _0x5b4465[_0x7466('0x34')]();};}function saveUpdates(_0x49db06,_0xcda93d){return function(_0x246866){if(_0x246866){return _0x246866['update'](_0x49db06)[_0x7466('0x20')](function(_0x4bbf06){return _0x4bbf06;});}return null;};}function removeEntity(_0x4bb253,_0xebb2e8){return function(_0x15050e){if(_0x15050e){return _0x15050e[_0x7466('0x35')]()[_0x7466('0x20')](function(){var _0x46147a=_0x15050e[_0x7466('0x36')]({'plain':!![]});var _0x48d5bc=_0x7466('0x37');return db[_0x7466('0x38')]['destroy']({'where':{'type':_0x48d5bc,'resourceId':_0x46147a['id']}})[_0x7466('0x20')](function(){return _0x15050e;});})[_0x7466('0x20')](function(){_0x4bb253['status'](0xcc)[_0x7466('0x39')]();});}};}function handleEntityNotFound(_0x2d8438,_0x30fa66){return function(_0x5ca5ce){if(!_0x5ca5ce){_0x2d8438['sendStatus'](0x194);}return _0x5ca5ce;};}function handleError(_0x274d22,_0x5217df){_0x5217df=_0x5217df||0x1f4;return function(_0x2aedcf){logger[_0x7466('0x26')](_0x2aedcf[_0x7466('0x3a')]);if(_0x2aedcf[_0x7466('0x3b')]){delete _0x2aedcf[_0x7466('0x3b')];}_0x274d22['status'](_0x5217df)[_0x7466('0x3c')](_0x2aedcf);};}exports['index']=function(_0x47db9d,_0x2b6eaf){var _0x4c24d0={'include':[{'model':db[_0x7466('0x3d')],'as':_0x7466('0x3e')}]},_0x438915={},_0x29f4b7={'count':0x0,'rows':[]};var _0x4f163a=_[_0x7466('0x3f')](db[_0x7466('0x40')]['rawAttributes'],function(_0x109483){return{'name':_0x109483[_0x7466('0x41')],'type':_0x109483[_0x7466('0x42')]['key']};});_0x438915[_0x7466('0x43')]=_['map'](_0x4f163a,'name');_0x438915[_0x7466('0x44')]=_[_0x7466('0x45')](_0x47db9d['query']);_0x438915[_0x7466('0x46')]=_[_0x7466('0x47')](_0x438915[_0x7466('0x43')],_0x438915[_0x7466('0x44')]);_0x4c24d0[_0x7466('0x48')]=_[_0x7466('0x47')](_0x438915[_0x7466('0x43')],qs[_0x7466('0x49')](_0x47db9d[_0x7466('0x44')][_0x7466('0x49')]));_0x4c24d0[_0x7466('0x48')]=_0x4c24d0[_0x7466('0x48')][_0x7466('0x4a')]?_0x4c24d0['attributes']:_0x438915['model'];if(!_0x47db9d['query'][_0x7466('0x4b')](_0x7466('0x4c'))){_0x4c24d0[_0x7466('0x4d')]=qs[_0x7466('0x4d')](_0x47db9d[_0x7466('0x44')][_0x7466('0x4d')]);_0x4c24d0['offset']=qs['offset'](_0x47db9d[_0x7466('0x44')]['offset']);}_0x4c24d0[_0x7466('0x4e')]=qs[_0x7466('0x4f')](_0x47db9d[_0x7466('0x44')][_0x7466('0x4f')]);_0x4c24d0[_0x7466('0x50')]=qs[_0x7466('0x46')](_[_0x7466('0x51')](_0x47db9d['query'],_0x438915[_0x7466('0x46')]),_0x4f163a);if(_0x47db9d[_0x7466('0x44')]['filter']){_0x4c24d0[_0x7466('0x50')]=_['merge'](_0x4c24d0[_0x7466('0x50')],{'$or':_[_0x7466('0x3f')](_0x4f163a,function(_0x1a17e7){if(_0x1a17e7[_0x7466('0x42')]!==_0x7466('0x52')){var _0x20b4f7={};_0x20b4f7[_0x1a17e7[_0x7466('0x3b')]]={'$like':'%'+_0x47db9d[_0x7466('0x44')][_0x7466('0x53')]+'%'};return _0x20b4f7;}})});}_0x4c24d0=_[_0x7466('0x54')]({},_0x4c24d0,_0x47db9d[_0x7466('0x55')]);var _0x347dc6={'where':_0x4c24d0[_0x7466('0x50')]};return db[_0x7466('0x40')][_0x7466('0x2e')](_0x347dc6)[_0x7466('0x20')](function(_0x133a8b){_0x29f4b7['count']=_0x133a8b;if(_0x47db9d[_0x7466('0x44')][_0x7466('0x56')]){_0x4c24d0[_0x7466('0x57')]=[{'all':!![]}];}return db[_0x7466('0x40')][_0x7466('0x58')](_0x4c24d0);})[_0x7466('0x20')](function(_0x3f2332){_0x29f4b7[_0x7466('0x59')]=_0x3f2332;return _0x29f4b7;})[_0x7466('0x20')](respondWithFilteredResult(_0x2b6eaf,_0x4c24d0))['catch'](handleError(_0x2b6eaf,null));};exports[_0x7466('0x5a')]=function(_0xe70fd5,_0x547a18){var _0x2b6521={'raw':![],'where':{'id':_0xe70fd5[_0x7466('0x5b')]['id']},'include':[{'model':db[_0x7466('0x3d')],'as':_0x7466('0x3e')}]},_0x3fd8c3={};_0x3fd8c3[_0x7466('0x43')]=_[_0x7466('0x45')](db[_0x7466('0x40')][_0x7466('0x5c')]);_0x3fd8c3[_0x7466('0x44')]=_[_0x7466('0x45')](_0xe70fd5[_0x7466('0x44')]);_0x3fd8c3[_0x7466('0x46')]=_[_0x7466('0x47')](_0x3fd8c3[_0x7466('0x43')],_0x3fd8c3[_0x7466('0x44')]);_0x2b6521['attributes']=_['intersection'](_0x3fd8c3[_0x7466('0x43')],qs[_0x7466('0x49')](_0xe70fd5[_0x7466('0x44')]['fields']));_0x2b6521[_0x7466('0x48')]=_0x2b6521['attributes'][_0x7466('0x4a')]?_0x2b6521['attributes']:_0x3fd8c3['model'];if(_0xe70fd5['query']['includeAll']){_0x2b6521[_0x7466('0x57')]=[{'all':!![]}];}_0x2b6521=_[_0x7466('0x54')]({},_0x2b6521,_0xe70fd5[_0x7466('0x55')]);return db['FaxAccount'][_0x7466('0x5d')](_0x2b6521)['then'](handleEntityNotFound(_0x547a18,null))[_0x7466('0x20')](respondWithResult(_0x547a18,null))['catch'](handleError(_0x547a18,null));};exports['create']=function(_0x5731ae,_0x299fc2){return db[_0x7466('0x40')]['create'](_0x5731ae[_0x7466('0x5e')],{})[_0x7466('0x20')](function(_0x32ab06){var _0x419bc=_0x5731ae[_0x7466('0x5f')][_0x7466('0x36')]({'plain':!![]});if(!_0x419bc)throw new Error(_0x7466('0x60'));if(_0x419bc[_0x7466('0x61')]===_0x7466('0x5f')){var _0x7b705e=_0x32ab06[_0x7466('0x36')]({'plain':!![]});var _0xa4718f=_0x7466('0x37');return db[_0x7466('0x62')]['find']({'where':{'name':_0xa4718f,'userProfileId':_0x419bc[_0x7466('0x63')]},'raw':!![]})['then'](function(_0x16feb){if(_0x16feb&&_0x16feb[_0x7466('0x64')]===0x0){return db['UserProfileResource'][_0x7466('0x65')]({'name':_0x7b705e['name'],'resourceId':_0x7b705e['id'],'type':_0x16feb[_0x7466('0x3b')],'sectionId':_0x16feb['id']},{})[_0x7466('0x20')](function(){return _0x32ab06;});}else{return _0x32ab06;}})[_0x7466('0x29')](function(_0xf39961){logger[_0x7466('0x26')](_0x7466('0x66'),_0xf39961);throw _0xf39961;});}return _0x32ab06;})['then'](respondWithResult(_0x299fc2,0xc9))[_0x7466('0x29')](handleError(_0x299fc2,null));};exports[_0x7466('0x67')]=function(_0x28ce0e,_0x79d58){if(_0x28ce0e[_0x7466('0x5e')]['id']){delete _0x28ce0e[_0x7466('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x28ce0e[_0x7466('0x5b')]['id']},'include':[{'model':db[_0x7466('0x3d')],'as':_0x7466('0x3e')}]})[_0x7466('0x20')](handleEntityNotFound(_0x79d58,null))['then'](saveUpdates(_0x28ce0e[_0x7466('0x5e')],null))[_0x7466('0x20')](respondWithResult(_0x79d58,null))['catch'](handleError(_0x79d58,null));};exports['destroy']=function(_0x905750,_0x158252){return db[_0x7466('0x40')]['find']({'where':{'id':_0x905750['params']['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x158252,null))['then'](removeEntity(_0x158252,null))[_0x7466('0x29')](handleError(_0x158252,null));};exports[_0x7466('0x68')]=function(_0x204966,_0x1eb764){return db['FaxAccount'][_0x7466('0x68')]()[_0x7466('0x20')](respondWithResult(_0x1eb764,null))['catch'](handleError(_0x1eb764,null));};exports['addDisposition']=function(_0x19b301,_0x2f0926,_0x730d5a){if(_0x19b301[_0x7466('0x5e')]['id']){delete _0x19b301[_0x7466('0x5e')]['id'];}return db['FaxAccount'][_0x7466('0x5d')]({'where':{'id':_0x19b301[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x2f0926,null))['then'](function(_0x4ea0d4){if(_0x4ea0d4){_0x19b301[_0x7466('0x5e')][_0x7466('0x69')]=_0x4ea0d4['id'];return db['Disposition'][_0x7466('0x65')](_0x19b301[_0x7466('0x5e')]);}})['then'](respondWithResult(_0x2f0926,null))[_0x7466('0x29')](handleError(_0x2f0926,null));};exports[_0x7466('0x6a')]=function(_0x1ca4aa,_0x2ffde5,_0x23078a){var _0x54b699={'raw':![],'where':{}};var _0x425810={};var _0x37dc63={'count':0x0,'rows':[]};return db[_0x7466('0x40')][_0x7466('0x6b')]({'where':{'id':_0x1ca4aa[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x2ffde5,null))[_0x7466('0x20')](function(_0x462264){if(_0x462264){_0x425810['model']=_[_0x7466('0x45')](db[_0x7466('0x6c')][_0x7466('0x5c')]);_0x425810[_0x7466('0x44')]=_[_0x7466('0x45')](_0x1ca4aa[_0x7466('0x44')]);_0x425810['filters']=_[_0x7466('0x47')](_0x425810['model'],_0x425810['query']);_0x54b699[_0x7466('0x48')]=_[_0x7466('0x47')](_0x425810['model'],qs['fields'](_0x1ca4aa['query'][_0x7466('0x49')]));_0x54b699[_0x7466('0x48')]=_0x54b699[_0x7466('0x48')][_0x7466('0x4a')]?_0x54b699['attributes']:_0x425810[_0x7466('0x43')];if(!_0x1ca4aa[_0x7466('0x44')]['hasOwnProperty'](_0x7466('0x4c'))){_0x54b699[_0x7466('0x4d')]=qs[_0x7466('0x4d')](_0x1ca4aa[_0x7466('0x44')][_0x7466('0x4d')]);_0x54b699['offset']=qs[_0x7466('0x2f')](_0x1ca4aa['query']['offset']);}_0x54b699[_0x7466('0x4e')]=qs['sort'](_0x1ca4aa[_0x7466('0x44')]['sort']);_0x54b699[_0x7466('0x50')]=qs[_0x7466('0x46')](_[_0x7466('0x51')](_0x1ca4aa[_0x7466('0x44')],_0x425810[_0x7466('0x46')]));_0x54b699['where'][_0x7466('0x69')]=_0x462264['id'];if(_0x1ca4aa[_0x7466('0x44')][_0x7466('0x53')]){_0x54b699[_0x7466('0x50')]=_[_0x7466('0x54')](_0x54b699[_0x7466('0x50')],{'$or':_[_0x7466('0x3f')](_0x54b699[_0x7466('0x48')],function(_0x5d0e78){var _0x491f07={};_0x491f07[_0x5d0e78]={'$like':'%'+_0x1ca4aa['query'][_0x7466('0x53')]+'%'};return _0x491f07;})});}_0x54b699=_['merge']({},_0x54b699,_0x1ca4aa['options']);return db[_0x7466('0x6c')]['count']({'where':_0x54b699[_0x7466('0x50')]})[_0x7466('0x20')](function(_0x492c30){_0x37dc63[_0x7466('0x2e')]=_0x492c30;if(_0x1ca4aa[_0x7466('0x44')]['includeAll']){_0x54b699[_0x7466('0x57')]=[{'all':!![]}];}return db[_0x7466('0x6c')][_0x7466('0x58')](_0x54b699);})['then'](function(_0x5cf662){_0x37dc63['rows']=_0x5cf662;return _0x37dc63;});}})[_0x7466('0x20')](respondWithFilteredResult(_0x2ffde5,_0x54b699))[_0x7466('0x29')](handleError(_0x2ffde5,null));};exports['removeDispositions']=function(_0x4339c2,_0x7ae787,_0x513657){return db[_0x7466('0x40')][_0x7466('0x5d')]({'where':{'id':_0x4339c2[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x7ae787,null))[_0x7466('0x20')](function(_0x16dfb2){if(_0x16dfb2){return _0x16dfb2[_0x7466('0x6d')](_0x4339c2[_0x7466('0x44')][_0x7466('0x6e')]);}})['then'](respondWithStatusCode(_0x7ae787,null))[_0x7466('0x29')](handleError(_0x7ae787,null));};exports['addAnswer']=function(_0x39d729,_0x54dca0,_0x2fa54f){if(_0x39d729['body']['id']){delete _0x39d729[_0x7466('0x5e')]['id'];}return db[_0x7466('0x40')][_0x7466('0x5d')]({'where':{'id':_0x39d729['params']['id']}})['then'](handleEntityNotFound(_0x54dca0,null))[_0x7466('0x20')](function(_0x1f7be2){if(_0x1f7be2){_0x39d729[_0x7466('0x5e')]['FaxAccountId']=_0x1f7be2['id'];return db['CannedAnswer'][_0x7466('0x65')](_0x39d729['body']);}})['then'](respondWithResult(_0x54dca0,null))['catch'](handleError(_0x54dca0,null));};exports[_0x7466('0x6f')]=function(_0x1321c8,_0x521e71,_0x4f5a18){var _0xc50fc={'raw':![],'where':{}};var _0x347415={};var _0x4f4caf={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7466('0x6b')]({'where':{'id':_0x1321c8['params']['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x521e71,null))['then'](function(_0x174edc){if(_0x174edc){_0x347415['model']=_[_0x7466('0x45')](db['CannedAnswer']['rawAttributes']);_0x347415['query']=_[_0x7466('0x45')](_0x1321c8[_0x7466('0x44')]);_0x347415[_0x7466('0x46')]=_['intersection'](_0x347415['model'],_0x347415[_0x7466('0x44')]);_0xc50fc[_0x7466('0x48')]=_[_0x7466('0x47')](_0x347415[_0x7466('0x43')],qs[_0x7466('0x49')](_0x1321c8[_0x7466('0x44')][_0x7466('0x49')]));_0xc50fc[_0x7466('0x48')]=_0xc50fc[_0x7466('0x48')][_0x7466('0x4a')]?_0xc50fc[_0x7466('0x48')]:_0x347415['model'];if(!_0x1321c8['query'][_0x7466('0x4b')](_0x7466('0x4c'))){_0xc50fc[_0x7466('0x4d')]=qs[_0x7466('0x4d')](_0x1321c8[_0x7466('0x44')]['limit']);_0xc50fc['offset']=qs[_0x7466('0x2f')](_0x1321c8[_0x7466('0x44')]['offset']);}_0xc50fc[_0x7466('0x4e')]=qs[_0x7466('0x4f')](_0x1321c8[_0x7466('0x44')][_0x7466('0x4f')]);_0xc50fc['where']=qs[_0x7466('0x46')](_[_0x7466('0x51')](_0x1321c8[_0x7466('0x44')],_0x347415[_0x7466('0x46')]));_0xc50fc['where'][_0x7466('0x69')]=_0x174edc['id'];if(_0x1321c8[_0x7466('0x44')][_0x7466('0x53')]){_0xc50fc[_0x7466('0x50')]=_['merge'](_0xc50fc['where'],{'$or':_[_0x7466('0x3f')](_0xc50fc[_0x7466('0x48')],function(_0x30b2cc){var _0x497151={};_0x497151[_0x30b2cc]={'$like':'%'+_0x1321c8['query'][_0x7466('0x53')]+'%'};return _0x497151;})});}_0xc50fc=_[_0x7466('0x54')]({},_0xc50fc,_0x1321c8[_0x7466('0x55')]);return db[_0x7466('0x70')][_0x7466('0x2e')]({'where':_0xc50fc[_0x7466('0x50')]})[_0x7466('0x20')](function(_0x1a56d3){_0x4f4caf[_0x7466('0x2e')]=_0x1a56d3;if(_0x1321c8['query'][_0x7466('0x56')]){_0xc50fc[_0x7466('0x57')]=[{'all':!![]}];}return db[_0x7466('0x70')][_0x7466('0x58')](_0xc50fc);})[_0x7466('0x20')](function(_0xc6e9a5){_0x4f4caf['rows']=_0xc6e9a5;return _0x4f4caf;});}})[_0x7466('0x20')](respondWithFilteredResult(_0x521e71,_0xc50fc))[_0x7466('0x29')](handleError(_0x521e71,null));};exports[_0x7466('0x71')]=function(_0x4b329f,_0x9b9934,_0x24e4d6){return db[_0x7466('0x40')][_0x7466('0x5d')]({'where':{'id':_0x4b329f[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x9b9934,null))['then'](function(_0x52742d){if(_0x52742d){return _0x52742d[_0x7466('0x71')](_0x4b329f[_0x7466('0x44')]['ids']);}})[_0x7466('0x20')](respondWithStatusCode(_0x9b9934,null))[_0x7466('0x29')](handleError(_0x9b9934,null));};exports['addInteraction']=function(_0x204a2c,_0x29d869,_0x4358aa){return db[_0x7466('0x72')][_0x7466('0x5d')]({'where':{'id':_0x204a2c['params']['id']}})['then'](handleEntityNotFound(_0x29d869,null))[_0x7466('0x20')](function(_0x2f9d94){if(_0x2f9d94){return _0x2f9d94[_0x7466('0x73')](_0x204a2c[_0x7466('0x5e')][_0x7466('0x6e')],_['omit'](_0x204a2c['body'],[_0x7466('0x6e'),'id'])||{});}})[_0x7466('0x20')](respondWithResult(_0x29d869,null))[_0x7466('0x29')](handleError(_0x29d869,null));};exports[_0x7466('0x74')]=function(_0x571960,_0x3458ec,_0x30b28d){var _0x393725={'raw':![],'where':{}};var _0x255846={};var _0x5e86e1={'count':0x0,'rows':[]};return db[_0x7466('0x40')][_0x7466('0x6b')]({'where':{'id':_0x571960[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x3458ec,null))[_0x7466('0x20')](function(_0x56a282){if(_0x56a282){_0x255846['model']=_[_0x7466('0x45')](db['FaxInteraction'][_0x7466('0x5c')]);_0x255846[_0x7466('0x44')]=_[_0x7466('0x45')](_0x571960['query']);_0x255846[_0x7466('0x46')]=_[_0x7466('0x47')](_0x255846['model'],_0x255846[_0x7466('0x44')]);_0x393725['attributes']=_['intersection'](_0x255846[_0x7466('0x43')],qs[_0x7466('0x49')](_0x571960['query'][_0x7466('0x49')]));_0x393725[_0x7466('0x48')]=_0x393725['attributes'][_0x7466('0x4a')]?_0x393725[_0x7466('0x48')]:_0x255846[_0x7466('0x43')];if(!_0x571960[_0x7466('0x44')]['hasOwnProperty'](_0x7466('0x4c'))){_0x393725[_0x7466('0x4d')]=qs[_0x7466('0x4d')](_0x571960[_0x7466('0x44')][_0x7466('0x4d')]);_0x393725['offset']=qs['offset'](_0x571960[_0x7466('0x44')][_0x7466('0x2f')]);}_0x393725[_0x7466('0x4e')]=qs[_0x7466('0x4f')](_0x571960[_0x7466('0x44')][_0x7466('0x4f')]);_0x393725['where']=qs['filters'](_[_0x7466('0x51')](_0x571960['query'],_0x255846[_0x7466('0x46')]));_0x393725['where'][_0x7466('0x69')]=_0x56a282['id'];if(_0x571960['query'][_0x7466('0x53')]){_0x393725[_0x7466('0x50')]=_['merge'](_0x393725[_0x7466('0x50')],{'$or':_[_0x7466('0x3f')](_0x393725[_0x7466('0x48')],function(_0x3f7a07){var _0x326b7a={};_0x326b7a[_0x3f7a07]={'$like':'%'+_0x571960[_0x7466('0x44')][_0x7466('0x53')]+'%'};return _0x326b7a;})});}_0x393725=_[_0x7466('0x54')]({},_0x393725,_0x571960[_0x7466('0x55')]);return db[_0x7466('0x72')][_0x7466('0x2e')]({'where':_0x393725[_0x7466('0x50')]})[_0x7466('0x20')](function(_0x3742b9){_0x5e86e1[_0x7466('0x2e')]=_0x3742b9;if(_0x571960['query'][_0x7466('0x56')]){_0x393725['include']=[{'model':db['CmContact'],'as':_0x7466('0x75'),'required':![]},{'model':db[_0x7466('0x76')],'as':_0x7466('0x77'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x7466('0x3b'),_0x7466('0x78')],'where':_0x571960[_0x7466('0x44')][_0x7466('0x79')]?{'id':_0x571960[_0x7466('0x44')][_0x7466('0x79')]}:undefined,'required':_0x571960[_0x7466('0x44')][_0x7466('0x79')]?!![]:![]}];}return db[_0x7466('0x72')][_0x7466('0x58')](_0x393725);})[_0x7466('0x20')](function(_0x42c076){_0x5e86e1[_0x7466('0x59')]=_0x42c076;return _0x5e86e1;});}})[_0x7466('0x20')](respondWithFilteredResult(_0x3458ec,_0x393725))[_0x7466('0x29')](handleError(_0x3458ec,null));};exports[_0x7466('0x7a')]=function(_0x26b202,_0x361afc){var _0x92f075=_0x26b202['params']['id'];var _0x4e89ea=_0x26b202[_0x7466('0x5e')];var _0x4b58b8=0xc8;var _0x4f4b17=null;return db[_0x7466('0x7b')]['transaction']({'isolationLevel':db[_0x7466('0x7b')][_0x7466('0x7c')][_0x7466('0x7d')]['READ_COMMITTED']},function(_0x3752bb){return db[_0x7466('0x40')][_0x7466('0x6b')]({'where':{'id':_0x92f075},'transaction':_0x3752bb})[_0x7466('0x20')](function(_0x222928){if(_0x222928){return db[_0x7466('0x7e')][_0x7466('0x35')]({'where':{'FaxAccountId':_0x92f075},'transaction':_0x3752bb})['then'](function(){var _0x47ca85=_['map'](_0x4e89ea,function(_0x407a49){_0x407a49['FaxAccountId']=_0x92f075;return _0x407a49;});return db[_0x7466('0x7e')][_0x7466('0x7f')](_0x47ca85,{'transaction':_0x3752bb});});}else{_0x4b58b8=0x194;_0x4f4b17=[];}});})[_0x7466('0x20')](function(){if(_0x4b58b8!==0x194){return db['FaxApplication'][_0x7466('0x80')]({'where':{'FaxAccountId':_0x92f075},'order':_0x7466('0x81')})['then'](function(_0x4e2b58){_0x4f4b17=_0x4e2b58;});}})[_0x7466('0x29')](function(_0x322b9e){_0x4b58b8=0x1f4;logger[_0x7466('0x26')](_0x322b9e[_0x7466('0x3a')]);if(_0x322b9e[_0x7466('0x3b')]){delete _0x322b9e['name'];}_0x4f4b17=_0x322b9e;})[_0x7466('0x82')](function(){if(_0x4f4b17===null){_0x361afc['sendStatus'](_0x4b58b8);}else{if(_0x4b58b8===0x1f4){_0x361afc[_0x7466('0x2b')](_0x4b58b8)[_0x7466('0x3c')](_0x4f4b17);}else{_0x361afc[_0x7466('0x2b')](_0x4b58b8)[_0x7466('0x2c')](_0x4f4b17);}}});};exports[_0x7466('0x83')]=function(_0x532109,_0x37eebd,_0x3f8861){var _0xa4a4e6={};var _0x575cda={};var _0x443243;var _0x20dda5;return db[_0x7466('0x40')]['findOne']({'where':{'id':_0x532109[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x37eebd,null))[_0x7466('0x20')](function(_0x411c2d){if(_0x411c2d){_0x443243=_0x411c2d;_0x575cda['model']=_[_0x7466('0x45')](db[_0x7466('0x7e')][_0x7466('0x5c')]);_0x575cda[_0x7466('0x44')]=_[_0x7466('0x45')](_0x532109[_0x7466('0x44')]);_0x575cda[_0x7466('0x46')]=_[_0x7466('0x47')](_0x575cda[_0x7466('0x43')],_0x575cda['query']);_0xa4a4e6['attributes']=_[_0x7466('0x47')](_0x575cda[_0x7466('0x43')],qs[_0x7466('0x49')](_0x532109[_0x7466('0x44')][_0x7466('0x49')]));_0xa4a4e6['attributes']=_0xa4a4e6[_0x7466('0x48')][_0x7466('0x4a')]?_0xa4a4e6['attributes']:_0x575cda['model'];_0xa4a4e6[_0x7466('0x4e')]=qs[_0x7466('0x4f')](_0x532109['query']['sort']);_0xa4a4e6['where']=qs['filters'](_[_0x7466('0x51')](_0x532109['query'],_0x575cda['filters']));if(_0x532109[_0x7466('0x44')]['filter']){_0xa4a4e6[_0x7466('0x50')]=_[_0x7466('0x54')](_0xa4a4e6[_0x7466('0x50')],{'$or':_[_0x7466('0x3f')](_0xa4a4e6['attributes'],function(_0xfd112a){var _0x491201={};_0x491201[_0xfd112a]={'$like':'%'+_0x532109[_0x7466('0x44')][_0x7466('0x53')]+'%'};return _0x491201;})});}_0xa4a4e6=_['merge']({},_0xa4a4e6,_0x532109[_0x7466('0x55')]);return _0x443243[_0x7466('0x83')](_0xa4a4e6);}})[_0x7466('0x20')](function(_0x265fca){if(_0x265fca){_0x20dda5=_0x265fca[_0x7466('0x4a')];if(!_0x532109['query'][_0x7466('0x4b')](_0x7466('0x4c'))){_0xa4a4e6[_0x7466('0x4d')]=qs[_0x7466('0x4d')](_0x532109[_0x7466('0x44')][_0x7466('0x4d')]);_0xa4a4e6[_0x7466('0x2f')]=qs[_0x7466('0x2f')](_0x532109[_0x7466('0x44')][_0x7466('0x2f')]);}return _0x443243[_0x7466('0x83')](_0xa4a4e6);}})[_0x7466('0x20')](function(_0x14b964){if(_0x14b964){return _0x14b964?{'count':_0x20dda5,'rows':_0x14b964}:null;}})['then'](respondWithResult(_0x37eebd,null))[_0x7466('0x29')](handleError(_0x37eebd,null));};function Extension(_0x2b175f,_0x19c6f5,_0x16d314,_0x5709cc){this[_0x7466('0x84')]=_0x7466('0x85');this['exten']=_0x2b175f['localstationid'];this[_0x7466('0x86')]=_0x5709cc;this[_0x7466('0x42')]=_0x7466('0x87');this[_0x7466('0x88')]='Fax\x20Extension';this[_0x7466('0x69')]=_0x2b175f['id'];this[_0x7466('0x81')]=_0x19c6f5;this[_0x7466('0x89')]=_0x16d314;}function createExtensionsReciveFax(_0x3def50){var _0x35cdae=0x1;var _0x1d2c6c=[];_0x1d2c6c[_0x7466('0x8a')](new Extension(_0x3def50,_0x35cdae,'','Answer'));_0x35cdae+=0x1;_0x1d2c6c[_0x7466('0x8a')](new Extension(_0x3def50,_0x35cdae,_0x7466('0x8b'),_0x7466('0x8c')));_0x35cdae+=0x1;for(var _0x16d1ad in _0x3def50){if(_0x3def50[_0x7466('0x4b')](_0x16d1ad)&&(_0x16d1ad===_0x7466('0x8d')||_0x16d1ad===_0x7466('0x8e')||_0x16d1ad==='gateway'||_0x16d1ad===_0x7466('0x8f')||_0x16d1ad==='headerinfo'||_0x16d1ad===_0x7466('0x90')||_0x16d1ad===_0x7466('0x91')||_0x16d1ad===_0x7466('0x92')||_0x16d1ad==='t38timeout')){_0x1d2c6c['push'](new Extension(_0x3def50,_0x35cdae,_0x7466('0x93')+_0x16d1ad+')='+_0x3def50[_0x16d1ad],_0x7466('0x8c')));_0x35cdae+=0x1;}}_0x1d2c6c[_0x7466('0x8a')](new Extension(_0x3def50,_0x35cdae,'6',_0x7466('0x94')));_0x35cdae+=0x1;_0x1d2c6c[_0x7466('0x8a')](new Extension(_0x3def50,_0x35cdae,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x35cdae=0x0;return _0x1d2c6c;}exports[_0x7466('0x95')]=function(_0xb0e80c,_0x1989eb,_0x11289a){var _0x572c08;return db[_0x7466('0x7b')][_0x7466('0x96')](function(_0x1ab0cf){return db[_0x7466('0x40')][_0x7466('0x65')](_0xb0e80c[_0x7466('0x5e')],{'transaction':_0x1ab0cf})[_0x7466('0x20')](function(_0x1be376){_0x572c08=_0x1be376[_0x7466('0x36')]({'plain':!![]});return db[_0x7466('0x97')][_0x7466('0x7f')](createExtensionsReciveFax(_0x572c08),{'transaction':_0x1ab0cf});});})[_0x7466('0x20')](function(){return _0x572c08;})[_0x7466('0x20')](respondWithResult(_0x1989eb,null))['catch'](handleError(_0x1989eb,null));};exports[_0x7466('0x98')]=function(_0x5ef38c,_0x183280,_0x1763c3){var _0x3fbe69;return db[_0x7466('0x7b')]['transaction'](function(_0x5bcf8f){return db[_0x7466('0x40')][_0x7466('0x67')](_0x5ef38c[_0x7466('0x5e')],{'where':{'id':_0x5ef38c[_0x7466('0x5e')]['id']},'transaction':_0x5bcf8f})[_0x7466('0x20')](function(_0x17b31){return db[_0x7466('0x97')][_0x7466('0x35')]({'where':{'FaxAccountId':_0x5ef38c[_0x7466('0x5e')]['id']},'transaction':_0x5bcf8f})['then'](function(_0x13601d){return db[_0x7466('0x97')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x5ef38c[_0x7466('0x5e')],[_0x7466('0x99'),'key',_0x7466('0x9a'),'updatedAt',_0x7466('0x9b'),_0x7466('0x9c')])),{'transaction':_0x5bcf8f});});});})[_0x7466('0x20')](function(){return db['FaxAccount'][_0x7466('0x9d')](_0x5ef38c[_0x7466('0x5e')]['id']);})[_0x7466('0x20')](respondWithResult(_0x183280,null))[_0x7466('0x29')](handleError(_0x183280,null));};exports[_0x7466('0x9e')]=function(_0x1503b1,_0xfacb61,_0x3abd32){var _0x2a940e={'raw':!![],'where':{}};var _0x3465a7={};var _0x4eb445={'count':0x0,'rows':[]};return db[_0x7466('0x40')][_0x7466('0x6b')]({'where':{'id':_0x1503b1['params']['id']}})[_0x7466('0x20')](handleEntityNotFound(_0xfacb61,null))[_0x7466('0x20')](function(_0x4dc3dd){if(_0x4dc3dd){_0x3465a7[_0x7466('0x43')]=_[_0x7466('0x45')](db['FaxMessage'][_0x7466('0x5c')]);_0x3465a7[_0x7466('0x44')]=_[_0x7466('0x45')](_0x1503b1[_0x7466('0x44')]);_0x3465a7[_0x7466('0x46')]=_[_0x7466('0x47')](_0x3465a7[_0x7466('0x43')],_0x3465a7[_0x7466('0x44')]);_0x2a940e['attributes']=_['intersection'](_0x3465a7[_0x7466('0x43')],qs['fields'](_0x1503b1[_0x7466('0x44')]['fields']));_0x2a940e[_0x7466('0x48')]=_0x2a940e[_0x7466('0x48')][_0x7466('0x4a')]?_0x2a940e[_0x7466('0x48')]:_0x3465a7[_0x7466('0x43')];if(!_0x1503b1[_0x7466('0x44')][_0x7466('0x4b')](_0x7466('0x4c'))){_0x2a940e[_0x7466('0x4d')]=qs['limit'](_0x1503b1[_0x7466('0x44')][_0x7466('0x4d')]);_0x2a940e[_0x7466('0x2f')]=qs['offset'](_0x1503b1[_0x7466('0x44')][_0x7466('0x2f')]);}_0x2a940e[_0x7466('0x4e')]=qs[_0x7466('0x4f')](_0x1503b1[_0x7466('0x44')][_0x7466('0x4f')]);_0x2a940e[_0x7466('0x50')]=qs[_0x7466('0x46')](_[_0x7466('0x51')](_0x1503b1[_0x7466('0x44')],_0x3465a7['filters']));_0x2a940e['where'][_0x7466('0x69')]=_0x4dc3dd['id'];if(_0x1503b1[_0x7466('0x44')][_0x7466('0x53')]){_0x2a940e['where']=_['merge'](_0x2a940e[_0x7466('0x50')],{'$or':_[_0x7466('0x3f')](_0x2a940e[_0x7466('0x48')],function(_0xd4c6d7){var _0x12a98c={};_0x12a98c[_0xd4c6d7]={'$like':'%'+_0x1503b1[_0x7466('0x44')][_0x7466('0x53')]+'%'};return _0x12a98c;})});}if(_0x1503b1[_0x7466('0x44')]['$gte']){var _0x580413=_0x1503b1[_0x7466('0x44')][_0x7466('0x9f')][_0x7466('0xa0')](',');var _0x3f4744={};_0x3f4744[_0x580413[0x0]]={'$gte':moment(_0x580413[0x1])[_0x7466('0xa1')](_0x7466('0xa2'))};_0x2a940e[_0x7466('0x50')]=_[_0x7466('0x54')](_0x2a940e['where'],_0x3f4744);}_0x2a940e=_[_0x7466('0x54')]({},_0x2a940e,_0x1503b1['options']);return db['FaxMessage'][_0x7466('0x2e')]({'where':_0x2a940e[_0x7466('0x50')]})['then'](function(_0x12c617){_0x4eb445[_0x7466('0x2e')]=_0x12c617;if(_0x1503b1[_0x7466('0x44')][_0x7466('0x56')]){_0x2a940e[_0x7466('0x57')]=[{'all':!![]}];}return db[_0x7466('0xa3')][_0x7466('0x58')](_0x2a940e);})[_0x7466('0x20')](function(_0x25125f){_0x4eb445[_0x7466('0x59')]=_0x25125f;return _0x4eb445;});}})['then'](respondWithFilteredResult(_0xfacb61,_0x2a940e))[_0x7466('0x29')](handleError(_0xfacb61,null));};exports[_0x7466('0x3c')]=function(_0x582847,_0x2aa4c1,_0x341b90){var _0x278d46,_0x17f7c3={},_0x12f12a;if(_0x582847[_0x7466('0x5e')]['to']){_0x12f12a=_0x582847['body']['to'][0x0];}return db[_0x7466('0x40')][_0x7466('0x5d')]({'where':{'id':_0x582847['params']['id']},'include':[{'model':db[_0x7466('0xa4')],'as':_0x7466('0xa5'),'include':[{'model':db[_0x7466('0xa6')],'as':'Contacts','where':{'fax':_0x12f12a},'limit':0x1,'order':[[_0x7466('0xa7'),'DESC']]}]}]})[_0x7466('0x20')](handleEntityNotFound(_0x2aa4c1,null))[_0x7466('0x20')](function(_0x3351d6){_0x278d46=_0x3351d6;if(_0x582847[_0x7466('0x5e')]['attachments']&&_0x582847[_0x7466('0x5e')]['attachments'][_0x7466('0x4a')]){for(var _0x159b53=0x0;_0x159b53<_0x582847['body'][_0x7466('0xa8')][_0x7466('0x4a')];_0x159b53+=0x1){_0x582847['body'][_0x7466('0xa8')][_0x159b53]={'filename':_0x582847[_0x7466('0x5e')][_0x7466('0xa8')][_0x159b53][_0x7466('0x3b')],'id':_0x582847[_0x7466('0x5e')]['attachments'][_0x159b53]['id'],'path':path[_0x7466('0xa9')](config[_0x7466('0xaa')],_0x7466('0xab'),_0x582847[_0x7466('0x5e')]['attachments'][_0x159b53][_0x7466('0xac')])};}}return respondWithRpcPromise(_0x7466('0xad'),_0x7466('0xad'),{'FaxAccountId':_[_0x7466('0xae')](_0x582847['params']['id'])?undefined:_0x582847[_0x7466('0x5b')]['id'],'path':_[_0x7466('0xae')](_0x582847['body'][_0x7466('0xa8')][0x0][_0x7466('0x6')])?undefined:_0x582847['body'][_0x7466('0xa8')][0x0][_0x7466('0x6')],'fax':_[_0x7466('0xae')](_0x582847[_0x7466('0x5e')]['to'][0x0])?undefined:_0x582847[_0x7466('0x5e')]['to'][0x0]},client9002);})[_0x7466('0x20')](function(){if(_0x278d46){if(_[_0x7466('0xae')](_0x582847[_0x7466('0x5e')]['from'])){_0x582847['body'][_0x7466('0xaf')]=util[_0x7466('0xa1')](_0x7466('0xb0'),_0x278d46['name'],_0x278d46[_0x7466('0xb1')]);}if(_0x278d46['List']){if(_0x278d46[_0x7466('0xa5')][_0x7466('0xb2')][_0x7466('0x4a')]){return _0x278d46[_0x7466('0xa5')][_0x7466('0xb2')][0x0];}else{return db[_0x7466('0xa6')][_0x7466('0x65')](_[_0x7466('0x19')](_0x582847['body'],{'firstName':_0x582847[_0x7466('0x5e')]['to'][0x0],'phone':_0x582847[_0x7466('0x5e')]['to'][0x0],'fax':_0x582847[_0x7466('0x5e')]['to'][0x0],'ListId':_0x278d46[_0x7466('0x9c')]}));}}else{throw new Error(_0x7466('0xb3'));}}else{throw new Error(_0x7466('0xb4'));}})[_0x7466('0x20')](function(_0xa2e2a0){if(_0xa2e2a0){return db[_0x7466('0x72')][_0x7466('0x5d')]({'where':{'ContactId':_0xa2e2a0['id'],'closed':![],'FaxAccountId':_0x278d46['id']}})[_0x7466('0x20')](function(_0x56770d){if(_0x56770d){return[_0x56770d,![]];}return db[_0x7466('0x72')]['create']({'UserId':_0x582847[_0x7466('0x5f')]['id'],'ContactId':_0xa2e2a0['id'],'FaxAccountId':_0x278d46['id'],'fax':_0x582847[_0x7466('0x5e')]['to'][0x0],'firstMsgDirection':_0x7466('0xb5'),'Messages':[_[_0x7466('0x54')](_0x582847[_0x7466('0x5e')],{'read':![],'body':_0x582847[_0x7466('0x5e')][_0x7466('0xa8')][0x0]['filename'],'FaxAccountId':_0x278d46['id'],'UserId':_0x582847[_0x7466('0x5f')]['id'],'ContactId':_0xa2e2a0['id'],'AttachmentId':_0x582847[_0x7466('0x5e')][_0x7466('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x7466('0xa3')],'as':_0x7466('0xb6')}]})['then'](function(_0x74ad8d){return[_0x74ad8d,!![]];});});}else{throw new Error(_0x7466('0xb7'));}})[_0x7466('0xb8')](function(_0x5dd975,_0x208f7d){if(_0x208f7d){return _0x5dd975;}return db[_0x7466('0xa3')][_0x7466('0x65')]({'direction':_0x7466('0xb5'),'read':![],'body':_0x582847[_0x7466('0x5e')]['attachments'][0x0][_0x7466('0xb9')],'FaxAccountId':_0x278d46['id'],'FaxInteractionId':_0x5dd975['id'],'UserId':_0x582847[_0x7466('0x5f')]['id'],'ContactId':_0x5dd975[_0x7466('0xba')],'AttachmentId':_0x582847[_0x7466('0x5e')][_0x7466('0xa8')][0x0]['id']})[_0x7466('0x20')](function(_0x327289){_0x5dd975[_0x7466('0xbb')][_0x7466('0xb6')]=[];_0x5dd975[_0x7466('0xbb')][_0x7466('0xb6')][_0x7466('0x8a')](_0x327289[_0x7466('0xbb')]);return _0x5dd975;});})[_0x7466('0x20')](function(_0x3b6dc3){respondWithRpcPromise(_0x7466('0xbc'),_0x7466('0xbc'),{'FaxAccountId':_[_0x7466('0xae')](_0x582847[_0x7466('0x5b')]['id'])?undefined:_0x582847[_0x7466('0x5b')]['id'],'path':_[_0x7466('0xae')](_0x582847[_0x7466('0x5e')][_0x7466('0xa8')][0x0]['path'])?undefined:_0x582847['body'][_0x7466('0xa8')][0x0][_0x7466('0x6')],'fax':_[_0x7466('0xae')](_0x582847[_0x7466('0x5e')]['to'][0x0])?undefined:_0x582847['body']['to'][0x0],'AttachmentId':_0x582847['body'][_0x7466('0xa8')][0x0]['id']},client9002)['then'](function(_0x4c352b){logger[_0x7466('0x21')](_0x7466('0xbd'),_0x4c352b);})[_0x7466('0x29')](function(_0x3666ea){logger['info'](_0x7466('0xbd'),_0x3666ea);});return _0x3b6dc3;})[_0x7466('0x20')](respondWithResult(_0x2aa4c1,null))[_0x7466('0x29')](handleError(_0x2aa4c1,null));};exports[_0x7466('0xbe')]=function(_0x7c7d58,_0x43d5b6,_0x1978ca){return db['FaxAccount'][_0x7466('0x5d')]({'where':{'id':_0x7c7d58[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x43d5b6,null))[_0x7466('0x20')](function(_0x1e06e2){if(_0x1e06e2){return _0x1e06e2['addAgents'](_0x7c7d58[_0x7466('0x5e')][_0x7466('0x6e')],_[_0x7466('0xbf')](_0x7c7d58['body'],[_0x7466('0x6e'),'id'])||{})[_0x7466('0xb8')](function(_0x32f756){for(var _0xfbd84d=0x0;_0xfbd84d<_0x7c7d58[_0x7466('0x5e')]['ids'][_0x7466('0x4a')];_0xfbd84d+=0x1){socket[_0x7466('0xc0')](_0x7466('0xc1'),{'UserId':Number(_0x7c7d58[_0x7466('0x5e')][_0x7466('0x6e')][_0xfbd84d]),'FaxAccountId':Number(_0x7c7d58[_0x7466('0x5b')]['id'])});}return _0x32f756;});}})['then'](respondWithResult(_0x43d5b6,null))['catch'](handleError(_0x43d5b6,null));};exports[_0x7466('0xc2')]=function(_0x30ec94,_0x413cf8,_0x44564f){return db[_0x7466('0x40')][_0x7466('0x5d')]({'where':{'id':_0x30ec94[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x413cf8,null))['then'](function(_0x27f982){if(_0x27f982){return _0x27f982[_0x7466('0xc2')](_0x30ec94[_0x7466('0x44')]['ids'])[_0x7466('0x20')](function(){if(_[_0x7466('0xc3')](_0x30ec94[_0x7466('0x44')]['ids'])){for(var _0x52b1b8=0x0;_0x52b1b8<_0x30ec94[_0x7466('0x44')][_0x7466('0x6e')][_0x7466('0x4a')];_0x52b1b8+=0x1){socket[_0x7466('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x30ec94[_0x7466('0x44')][_0x7466('0x6e')][_0x52b1b8]),'FaxAccountId':Number(_0x30ec94[_0x7466('0x5b')]['id'])});}}else{socket[_0x7466('0xc0')](_0x7466('0xc4'),{'UserId':Number(_0x30ec94[_0x7466('0x44')][_0x7466('0x6e')]),'FaxAccountId':Number(_0x30ec94['params']['id'])});}});}})[_0x7466('0x20')](respondWithStatusCode(_0x413cf8,null))['catch'](handleError(_0x413cf8,null));};exports['getAgents']=function(_0x457994,_0x48cf27,_0x488f4e){var _0x2fdf64={};var _0x349b16={};var _0x4d7074;var _0x491cf7;return db[_0x7466('0x40')][_0x7466('0x6b')]({'where':{'id':_0x457994[_0x7466('0x5b')]['id']}})[_0x7466('0x20')](handleEntityNotFound(_0x48cf27,null))[_0x7466('0x20')](function(_0x306fb8){if(_0x306fb8){_0x4d7074=_0x306fb8;_0x349b16[_0x7466('0x43')]=_[_0x7466('0x45')](db[_0x7466('0x76')]['rawAttributes']);_0x349b16['query']=_[_0x7466('0x45')](_0x457994[_0x7466('0x44')]);_0x349b16[_0x7466('0x46')]=_[_0x7466('0x47')](_0x349b16[_0x7466('0x43')],_0x349b16[_0x7466('0x44')]);_0x2fdf64[_0x7466('0x48')]=_['intersection'](_0x349b16[_0x7466('0x43')],qs['fields'](_0x457994[_0x7466('0x44')][_0x7466('0x49')]));_0x2fdf64[_0x7466('0x48')]=_0x2fdf64['attributes'][_0x7466('0x4a')]?_0x2fdf64['attributes']:_0x349b16['model'];_0x2fdf64[_0x7466('0x4e')]=qs['sort'](_0x457994[_0x7466('0x44')][_0x7466('0x4f')]);_0x2fdf64['where']=qs[_0x7466('0x46')](_[_0x7466('0x51')](_0x457994[_0x7466('0x44')],_0x349b16[_0x7466('0x46')]));if(_0x457994[_0x7466('0x44')][_0x7466('0x53')]){_0x2fdf64[_0x7466('0x50')]=_[_0x7466('0x54')](_0x2fdf64[_0x7466('0x50')],{'$or':_[_0x7466('0x3f')](_0x2fdf64[_0x7466('0x48')],function(_0x221c28){var _0x50711f={};_0x50711f[_0x221c28]={'$like':'%'+_0x457994[_0x7466('0x44')][_0x7466('0x53')]+'%'};return _0x50711f;})});}_0x2fdf64=_[_0x7466('0x54')]({},_0x2fdf64,_0x457994[_0x7466('0x55')]);return _0x4d7074[_0x7466('0xc5')](_0x2fdf64);}})[_0x7466('0x20')](function(_0x13fa9d){if(_0x13fa9d){_0x491cf7=_0x13fa9d[_0x7466('0x4a')];if(!_0x457994['query'][_0x7466('0x4b')](_0x7466('0x4c'))){_0x2fdf64[_0x7466('0x4d')]=qs[_0x7466('0x4d')](_0x457994['query'][_0x7466('0x4d')]);_0x2fdf64['offset']=qs[_0x7466('0x2f')](_0x457994[_0x7466('0x44')][_0x7466('0x2f')]);}return _0x4d7074[_0x7466('0xc5')](_0x2fdf64);}})['then'](function(_0x651f24){if(_0x651f24){return _0x651f24?{'count':_0x491cf7,'rows':_0x651f24}:null;}})[_0x7466('0x20')](respondWithResult(_0x48cf27,null))[_0x7466('0x29')](handleError(_0x48cf27,null));}; \ No newline at end of file +var _0x66c5=['update','destroy','FaxAccounts','then','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','catch','params','rawAttributes','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','ids','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','stack','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','omit','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','out','Contact\x20not\x20found','spread','filename','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0x66c5,0x94));var _0x566c=function(_0x1968b1,_0x58467d){_0x1968b1=_0x1968b1-0x0;var _0x447458=_0x66c5[_0x1968b1];return _0x447458;};'use strict';var emlformat=require(_0x566c('0x0'));var rimraf=require(_0x566c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x566c('0x2'));var rp=require(_0x566c('0x3'));var moment=require(_0x566c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x566c('0x5'));var path=require(_0x566c('0x6'));var sox=require(_0x566c('0x7'));var csv=require(_0x566c('0x8'));var ejs=require(_0x566c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x566c('0xa'));var squel=require(_0x566c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x566c('0xc'));var toCsv=require(_0x566c('0x8'));var querystring=require(_0x566c('0xd'));var Papa=require(_0x566c('0xe'));var Redis=require(_0x566c('0xf'));var authService=require(_0x566c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x566c('0x11'));var hardwareService=require(_0x566c('0x12'));var logger=require(_0x566c('0x13'))(_0x566c('0x14'));var utils=require(_0x566c('0x15'));var config=require(_0x566c('0x16'));var licenseUtil=require(_0x566c('0x17'));var db=require(_0x566c('0x18'))['db'];config[_0x566c('0x19')]=_[_0x566c('0x1a')](config[_0x566c('0x19')],{'host':_0x566c('0x1b'),'port':0x18eb});var socket=require(_0x566c('0x1c'))(new Redis(config[_0x566c('0x19')]));require(_0x566c('0x1d'))[_0x566c('0x1e')](socket);var jayson=require(_0x566c('0x1f'));var client=jayson[_0x566c('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x566c('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x46ad6c,_0x228058,_0xa007f8,_0x42456d){return new BPromise(function(_0x147040,_0x30e5c1){var _0x2c60a8=_0x42456d||client;return _0x2c60a8[_0x566c('0x22')](_0x46ad6c,_0xa007f8)['then'](function(_0x2bb900){logger[_0x566c('0x23')](_0x566c('0x24'),_0x228058,'request\x20sent');logger[_0x566c('0x25')](_0x566c('0x26'),_0x228058,'request\x20sent',JSON['stringify'](_0x2bb900));if(_0x2bb900['error']){if(_0x2bb900[_0x566c('0x27')][_0x566c('0x28')]===0x1f4){logger[_0x566c('0x27')](_0x566c('0x24'),_0x228058,_0x2bb900['error'][_0x566c('0x29')]);return _0x30e5c1(_0x2bb900['error'][_0x566c('0x29')]);}logger[_0x566c('0x27')](_0x566c('0x24'),_0x228058,_0x2bb900[_0x566c('0x27')]['message']);return _0x147040(_0x2bb900[_0x566c('0x27')][_0x566c('0x29')]);}else{logger['info'](_0x566c('0x24'),_0x228058,_0x566c('0x2a'));_0x147040(_0x2bb900[_0x566c('0x2b')][_0x566c('0x29')]);}})['catch'](function(_0x3363ea){logger[_0x566c('0x27')](_0x566c('0x24'),_0x228058,_0x3363ea);_0x30e5c1(_0x3363ea);});});}function respondWithStatusCode(_0x2b6af7,_0x4790dd){_0x4790dd=_0x4790dd||0xcc;return function(_0x352dcf){if(_0x352dcf){return _0x2b6af7[_0x566c('0x2c')](_0x4790dd);}return _0x2b6af7[_0x566c('0x2d')](_0x4790dd)[_0x566c('0x2e')]();};}function respondWithResult(_0x57f3ff,_0x3e08bf){_0x3e08bf=_0x3e08bf||0xc8;return function(_0x3d5bdc){if(_0x3d5bdc){return _0x57f3ff['status'](_0x3e08bf)[_0x566c('0x2f')](_0x3d5bdc);}};}function respondWithFilteredResult(_0x20c492,_0x4a5396){return function(_0x4f1070){if(_0x4f1070){var _0x5a6727=typeof _0x4a5396['offset']===_0x566c('0x30')&&typeof _0x4a5396[_0x566c('0x31')]===_0x566c('0x30');var _0x4ac220=_0x4f1070[_0x566c('0x32')];var _0x2b970c=_0x5a6727?0x0:_0x4a5396[_0x566c('0x33')];var _0x22b879=_0x5a6727?_0x4f1070[_0x566c('0x32')]:_0x4a5396[_0x566c('0x33')]+_0x4a5396[_0x566c('0x31')];var _0x4dd979;if(_0x22b879>=_0x4ac220){_0x22b879=_0x4ac220;_0x4dd979=0xc8;}else{_0x4dd979=0xce;}_0x20c492[_0x566c('0x2d')](_0x4dd979);return _0x20c492[_0x566c('0x34')](_0x566c('0x35'),_0x2b970c+'-'+_0x22b879+'/'+_0x4ac220)[_0x566c('0x2f')](_0x4f1070);}return null;};}function patchUpdates(_0x2ff345){return function(_0x89521f){try{jsonpatch[_0x566c('0x36')](_0x89521f,_0x2ff345,!![]);}catch(_0x4d6946){return BPromise[_0x566c('0x37')](_0x4d6946);}return _0x89521f['save']();};}function saveUpdates(_0x1c7d08,_0x3bc7d4){return function(_0x9e96e3){if(_0x9e96e3){return _0x9e96e3[_0x566c('0x38')](_0x1c7d08)['then'](function(_0x5c4f54){return _0x5c4f54;});}return null;};}function removeEntity(_0x476fc3,_0x128aae){return function(_0xd455c7){if(_0xd455c7){return _0xd455c7[_0x566c('0x39')]()['then'](function(){var _0x56a77f=_0xd455c7['get']({'plain':!![]});var _0x1c736e=_0x566c('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c736e,'resourceId':_0x56a77f['id']}})[_0x566c('0x3b')](function(){return _0xd455c7;});})[_0x566c('0x3b')](function(){_0x476fc3[_0x566c('0x2d')](0xcc)[_0x566c('0x2e')]();});}};}function handleEntityNotFound(_0x1dfb7a,_0x11be43){return function(_0x512be0){if(!_0x512be0){_0x1dfb7a[_0x566c('0x2c')](0x194);}return _0x512be0;};}function handleError(_0x298481,_0x3f3cfe){_0x3f3cfe=_0x3f3cfe||0x1f4;return function(_0x496fd1){logger[_0x566c('0x27')](_0x496fd1['stack']);if(_0x496fd1[_0x566c('0x3c')]){delete _0x496fd1['name'];}_0x298481['status'](_0x3f3cfe)[_0x566c('0x3d')](_0x496fd1);};}exports[_0x566c('0x3e')]=function(_0x1b12c0,_0x2c6cbd){var _0x2b3190={'include':[{'model':db[_0x566c('0x3f')],'as':_0x566c('0x40')}]},_0x47066a={},_0x552d11={'count':0x0,'rows':[]};var _0x220536=_[_0x566c('0x41')](db[_0x566c('0x42')]['rawAttributes'],function(_0x15963c){return{'name':_0x15963c[_0x566c('0x43')],'type':_0x15963c[_0x566c('0x44')]['key']};});_0x47066a[_0x566c('0x45')]=_[_0x566c('0x41')](_0x220536,_0x566c('0x3c'));_0x47066a[_0x566c('0x46')]=_[_0x566c('0x47')](_0x1b12c0[_0x566c('0x46')]);_0x47066a[_0x566c('0x48')]=_[_0x566c('0x49')](_0x47066a[_0x566c('0x45')],_0x47066a[_0x566c('0x46')]);_0x2b3190[_0x566c('0x4a')]=_['intersection'](_0x47066a[_0x566c('0x45')],qs['fields'](_0x1b12c0['query'][_0x566c('0x4b')]));_0x2b3190[_0x566c('0x4a')]=_0x2b3190[_0x566c('0x4a')][_0x566c('0x4c')]?_0x2b3190[_0x566c('0x4a')]:_0x47066a[_0x566c('0x45')];if(!_0x1b12c0[_0x566c('0x46')][_0x566c('0x4d')](_0x566c('0x4e'))){_0x2b3190[_0x566c('0x31')]=qs[_0x566c('0x31')](_0x1b12c0[_0x566c('0x46')]['limit']);_0x2b3190['offset']=qs[_0x566c('0x33')](_0x1b12c0['query'][_0x566c('0x33')]);}_0x2b3190[_0x566c('0x4f')]=qs[_0x566c('0x50')](_0x1b12c0[_0x566c('0x46')][_0x566c('0x50')]);_0x2b3190[_0x566c('0x51')]=qs['filters'](_[_0x566c('0x52')](_0x1b12c0[_0x566c('0x46')],_0x47066a['filters']),_0x220536);if(_0x1b12c0[_0x566c('0x46')]['filter']){_0x2b3190['where']=_[_0x566c('0x53')](_0x2b3190[_0x566c('0x51')],{'$or':_[_0x566c('0x41')](_0x220536,function(_0x4d009e){if(_0x4d009e['type']!==_0x566c('0x54')){var _0x160a81={};_0x160a81[_0x4d009e[_0x566c('0x3c')]]={'$like':'%'+_0x1b12c0[_0x566c('0x46')][_0x566c('0x55')]+'%'};return _0x160a81;}})});}_0x2b3190=_['merge']({},_0x2b3190,_0x1b12c0['options']);var _0x57bda5={'where':_0x2b3190[_0x566c('0x51')]};return db[_0x566c('0x42')][_0x566c('0x32')](_0x57bda5)[_0x566c('0x3b')](function(_0x4e1c26){_0x552d11[_0x566c('0x32')]=_0x4e1c26;if(_0x1b12c0['query']['includeAll']){_0x2b3190['include']=[{'all':!![]}];}return db[_0x566c('0x42')][_0x566c('0x56')](_0x2b3190);})[_0x566c('0x3b')](function(_0x1cbc45){_0x552d11['rows']=_0x1cbc45;return _0x552d11;})[_0x566c('0x3b')](respondWithFilteredResult(_0x2c6cbd,_0x2b3190))[_0x566c('0x57')](handleError(_0x2c6cbd,null));};exports['show']=function(_0xa4c16d,_0x385cb4){var _0x4f8c6c={'raw':![],'where':{'id':_0xa4c16d[_0x566c('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2e7499={};_0x2e7499[_0x566c('0x45')]=_[_0x566c('0x47')](db[_0x566c('0x42')][_0x566c('0x59')]);_0x2e7499[_0x566c('0x46')]=_[_0x566c('0x47')](_0xa4c16d[_0x566c('0x46')]);_0x2e7499[_0x566c('0x48')]=_['intersection'](_0x2e7499[_0x566c('0x45')],_0x2e7499[_0x566c('0x46')]);_0x4f8c6c[_0x566c('0x4a')]=_[_0x566c('0x49')](_0x2e7499[_0x566c('0x45')],qs[_0x566c('0x4b')](_0xa4c16d[_0x566c('0x46')]['fields']));_0x4f8c6c[_0x566c('0x4a')]=_0x4f8c6c[_0x566c('0x4a')]['length']?_0x4f8c6c[_0x566c('0x4a')]:_0x2e7499['model'];if(_0xa4c16d[_0x566c('0x46')][_0x566c('0x5a')]){_0x4f8c6c[_0x566c('0x5b')]=[{'all':!![]}];}_0x4f8c6c=_[_0x566c('0x53')]({},_0x4f8c6c,_0xa4c16d[_0x566c('0x5c')]);return db['FaxAccount'][_0x566c('0x5d')](_0x4f8c6c)[_0x566c('0x3b')](handleEntityNotFound(_0x385cb4,null))['then'](respondWithResult(_0x385cb4,null))[_0x566c('0x57')](handleError(_0x385cb4,null));};exports[_0x566c('0x5e')]=function(_0x16feba,_0x4e56f2){return db[_0x566c('0x42')][_0x566c('0x5e')](_0x16feba[_0x566c('0x5f')],{})[_0x566c('0x3b')](function(_0x5bf069){var _0x2d7c8f=_0x16feba[_0x566c('0x60')][_0x566c('0x61')]({'plain':!![]});if(!_0x2d7c8f)throw new Error(_0x566c('0x62'));if(_0x2d7c8f[_0x566c('0x63')]===_0x566c('0x60')){var _0xb4484e=_0x5bf069[_0x566c('0x61')]({'plain':!![]});var _0x433fd5=_0x566c('0x3a');return db[_0x566c('0x64')][_0x566c('0x5d')]({'where':{'name':_0x433fd5,'userProfileId':_0x2d7c8f[_0x566c('0x65')]},'raw':!![]})['then'](function(_0x289aa6){if(_0x289aa6&&_0x289aa6[_0x566c('0x66')]===0x0){return db[_0x566c('0x67')][_0x566c('0x5e')]({'name':_0xb4484e[_0x566c('0x3c')],'resourceId':_0xb4484e['id'],'type':_0x289aa6['name'],'sectionId':_0x289aa6['id']},{})[_0x566c('0x3b')](function(){return _0x5bf069;});}else{return _0x5bf069;}})[_0x566c('0x57')](function(_0x4d56be){logger[_0x566c('0x27')](_0x566c('0x68'),_0x4d56be);throw _0x4d56be;});}return _0x5bf069;})[_0x566c('0x3b')](respondWithResult(_0x4e56f2,0xc9))['catch'](handleError(_0x4e56f2,null));};exports[_0x566c('0x38')]=function(_0x466d7d,_0x286575){if(_0x466d7d['body']['id']){delete _0x466d7d[_0x566c('0x5f')]['id'];}return db[_0x566c('0x42')][_0x566c('0x5d')]({'where':{'id':_0x466d7d[_0x566c('0x58')]['id']},'include':[{'model':db[_0x566c('0x3f')],'as':_0x566c('0x40')}]})['then'](handleEntityNotFound(_0x286575,null))[_0x566c('0x3b')](saveUpdates(_0x466d7d[_0x566c('0x5f')],null))[_0x566c('0x3b')](respondWithResult(_0x286575,null))[_0x566c('0x57')](handleError(_0x286575,null));};exports[_0x566c('0x39')]=function(_0x4da670,_0x5dbd96){return db[_0x566c('0x42')][_0x566c('0x5d')]({'where':{'id':_0x4da670[_0x566c('0x58')]['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x5dbd96,null))[_0x566c('0x3b')](removeEntity(_0x5dbd96,null))[_0x566c('0x57')](handleError(_0x5dbd96,null));};exports[_0x566c('0x69')]=function(_0x2dbe59,_0x14f4b4){return db['FaxAccount'][_0x566c('0x69')]()[_0x566c('0x3b')](respondWithResult(_0x14f4b4,null))[_0x566c('0x57')](handleError(_0x14f4b4,null));};exports[_0x566c('0x6a')]=function(_0x149477,_0x3c49d8,_0x3948ee){if(_0x149477[_0x566c('0x5f')]['id']){delete _0x149477['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x149477['params']['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x3c49d8,null))[_0x566c('0x3b')](function(_0x456c50){if(_0x456c50){_0x149477[_0x566c('0x5f')][_0x566c('0x6b')]=_0x456c50['id'];return db['Disposition'][_0x566c('0x5e')](_0x149477['body']);}})[_0x566c('0x3b')](respondWithResult(_0x3c49d8,null))[_0x566c('0x57')](handleError(_0x3c49d8,null));};exports[_0x566c('0x6c')]=function(_0x1fdb52,_0x58b6a3,_0x3e3009){var _0x5bb0f6={'raw':![],'where':{}};var _0x4db7bb={};var _0x157245={'count':0x0,'rows':[]};return db['FaxAccount'][_0x566c('0x6d')]({'where':{'id':_0x1fdb52['params']['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x58b6a3,null))[_0x566c('0x3b')](function(_0x3fe46){if(_0x3fe46){_0x4db7bb[_0x566c('0x45')]=_[_0x566c('0x47')](db['Disposition']['rawAttributes']);_0x4db7bb[_0x566c('0x46')]=_[_0x566c('0x47')](_0x1fdb52[_0x566c('0x46')]);_0x4db7bb['filters']=_[_0x566c('0x49')](_0x4db7bb['model'],_0x4db7bb[_0x566c('0x46')]);_0x5bb0f6['attributes']=_[_0x566c('0x49')](_0x4db7bb[_0x566c('0x45')],qs[_0x566c('0x4b')](_0x1fdb52['query']['fields']));_0x5bb0f6[_0x566c('0x4a')]=_0x5bb0f6[_0x566c('0x4a')][_0x566c('0x4c')]?_0x5bb0f6[_0x566c('0x4a')]:_0x4db7bb[_0x566c('0x45')];if(!_0x1fdb52['query'][_0x566c('0x4d')]('nolimit')){_0x5bb0f6[_0x566c('0x31')]=qs[_0x566c('0x31')](_0x1fdb52['query'][_0x566c('0x31')]);_0x5bb0f6[_0x566c('0x33')]=qs[_0x566c('0x33')](_0x1fdb52['query']['offset']);}_0x5bb0f6[_0x566c('0x4f')]=qs['sort'](_0x1fdb52[_0x566c('0x46')][_0x566c('0x50')]);_0x5bb0f6[_0x566c('0x51')]=qs[_0x566c('0x48')](_['pick'](_0x1fdb52[_0x566c('0x46')],_0x4db7bb[_0x566c('0x48')]));_0x5bb0f6[_0x566c('0x51')]['FaxAccountId']=_0x3fe46['id'];if(_0x1fdb52[_0x566c('0x46')]['filter']){_0x5bb0f6[_0x566c('0x51')]=_[_0x566c('0x53')](_0x5bb0f6[_0x566c('0x51')],{'$or':_[_0x566c('0x41')](_0x5bb0f6[_0x566c('0x4a')],function(_0x4b8a50){var _0x1541de={};_0x1541de[_0x4b8a50]={'$like':'%'+_0x1fdb52[_0x566c('0x46')][_0x566c('0x55')]+'%'};return _0x1541de;})});}_0x5bb0f6=_[_0x566c('0x53')]({},_0x5bb0f6,_0x1fdb52['options']);return db[_0x566c('0x6e')][_0x566c('0x32')]({'where':_0x5bb0f6[_0x566c('0x51')]})[_0x566c('0x3b')](function(_0x2df1cf){_0x157245[_0x566c('0x32')]=_0x2df1cf;if(_0x1fdb52['query'][_0x566c('0x5a')]){_0x5bb0f6[_0x566c('0x5b')]=[{'all':!![]}];}return db[_0x566c('0x6e')]['findAll'](_0x5bb0f6);})['then'](function(_0xce20f){_0x157245[_0x566c('0x6f')]=_0xce20f;return _0x157245;});}})[_0x566c('0x3b')](respondWithFilteredResult(_0x58b6a3,_0x5bb0f6))[_0x566c('0x57')](handleError(_0x58b6a3,null));};exports[_0x566c('0x70')]=function(_0xd6cc03,_0x1f3914,_0xbde0ad){return db['FaxAccount'][_0x566c('0x5d')]({'where':{'id':_0xd6cc03['params']['id']}})['then'](handleEntityNotFound(_0x1f3914,null))[_0x566c('0x3b')](function(_0x1371c5){if(_0x1371c5){return _0x1371c5['removeDispositions'](_0xd6cc03[_0x566c('0x46')]['ids']);}})[_0x566c('0x3b')](respondWithStatusCode(_0x1f3914,null))['catch'](handleError(_0x1f3914,null));};exports[_0x566c('0x71')]=function(_0x13e1ea,_0x5d6cc7,_0x4132d9){if(_0x13e1ea['body']['id']){delete _0x13e1ea['body']['id'];}return db[_0x566c('0x42')][_0x566c('0x5d')]({'where':{'id':_0x13e1ea[_0x566c('0x58')]['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x5d6cc7,null))['then'](function(_0x456d11){if(_0x456d11){_0x13e1ea['body'][_0x566c('0x6b')]=_0x456d11['id'];return db['CannedAnswer'][_0x566c('0x5e')](_0x13e1ea[_0x566c('0x5f')]);}})[_0x566c('0x3b')](respondWithResult(_0x5d6cc7,null))[_0x566c('0x57')](handleError(_0x5d6cc7,null));};exports[_0x566c('0x72')]=function(_0xdcba23,_0x25a70e,_0x1911c1){var _0x18afdf={'raw':![],'where':{}};var _0xb26a72={};var _0x432c20={'count':0x0,'rows':[]};return db[_0x566c('0x42')][_0x566c('0x6d')]({'where':{'id':_0xdcba23[_0x566c('0x58')]['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x25a70e,null))['then'](function(_0x31a758){if(_0x31a758){_0xb26a72[_0x566c('0x45')]=_[_0x566c('0x47')](db[_0x566c('0x73')]['rawAttributes']);_0xb26a72[_0x566c('0x46')]=_[_0x566c('0x47')](_0xdcba23[_0x566c('0x46')]);_0xb26a72[_0x566c('0x48')]=_[_0x566c('0x49')](_0xb26a72[_0x566c('0x45')],_0xb26a72[_0x566c('0x46')]);_0x18afdf[_0x566c('0x4a')]=_[_0x566c('0x49')](_0xb26a72['model'],qs['fields'](_0xdcba23['query'][_0x566c('0x4b')]));_0x18afdf[_0x566c('0x4a')]=_0x18afdf[_0x566c('0x4a')]['length']?_0x18afdf[_0x566c('0x4a')]:_0xb26a72['model'];if(!_0xdcba23[_0x566c('0x46')][_0x566c('0x4d')]('nolimit')){_0x18afdf[_0x566c('0x31')]=qs['limit'](_0xdcba23['query'][_0x566c('0x31')]);_0x18afdf[_0x566c('0x33')]=qs[_0x566c('0x33')](_0xdcba23['query'][_0x566c('0x33')]);}_0x18afdf['order']=qs[_0x566c('0x50')](_0xdcba23[_0x566c('0x46')][_0x566c('0x50')]);_0x18afdf[_0x566c('0x51')]=qs[_0x566c('0x48')](_[_0x566c('0x52')](_0xdcba23[_0x566c('0x46')],_0xb26a72[_0x566c('0x48')]));_0x18afdf[_0x566c('0x51')][_0x566c('0x6b')]=_0x31a758['id'];if(_0xdcba23[_0x566c('0x46')][_0x566c('0x55')]){_0x18afdf[_0x566c('0x51')]=_[_0x566c('0x53')](_0x18afdf[_0x566c('0x51')],{'$or':_[_0x566c('0x41')](_0x18afdf[_0x566c('0x4a')],function(_0x4f061a){var _0x34df4c={};_0x34df4c[_0x4f061a]={'$like':'%'+_0xdcba23['query'][_0x566c('0x55')]+'%'};return _0x34df4c;})});}_0x18afdf=_[_0x566c('0x53')]({},_0x18afdf,_0xdcba23[_0x566c('0x5c')]);return db[_0x566c('0x73')][_0x566c('0x32')]({'where':_0x18afdf[_0x566c('0x51')]})[_0x566c('0x3b')](function(_0x5ba7d9){_0x432c20[_0x566c('0x32')]=_0x5ba7d9;if(_0xdcba23['query'][_0x566c('0x5a')]){_0x18afdf[_0x566c('0x5b')]=[{'all':!![]}];}return db[_0x566c('0x73')][_0x566c('0x56')](_0x18afdf);})['then'](function(_0x19f685){_0x432c20[_0x566c('0x6f')]=_0x19f685;return _0x432c20;});}})[_0x566c('0x3b')](respondWithFilteredResult(_0x25a70e,_0x18afdf))['catch'](handleError(_0x25a70e,null));};exports[_0x566c('0x74')]=function(_0x5694ff,_0x5596c1,_0x43f8aa){return db[_0x566c('0x42')][_0x566c('0x5d')]({'where':{'id':_0x5694ff[_0x566c('0x58')]['id']}})['then'](handleEntityNotFound(_0x5596c1,null))['then'](function(_0x5e6685){if(_0x5e6685){return _0x5e6685[_0x566c('0x74')](_0x5694ff[_0x566c('0x46')]['ids']);}})[_0x566c('0x3b')](respondWithStatusCode(_0x5596c1,null))[_0x566c('0x57')](handleError(_0x5596c1,null));};exports[_0x566c('0x75')]=function(_0x39f18a,_0xdfd648,_0x3d23d9){return db[_0x566c('0x76')][_0x566c('0x5d')]({'where':{'id':_0x39f18a['params']['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0xdfd648,null))[_0x566c('0x3b')](function(_0x4446d2){if(_0x4446d2){return _0x4446d2[_0x566c('0x75')](_0x39f18a[_0x566c('0x5f')]['ids'],_['omit'](_0x39f18a[_0x566c('0x5f')],[_0x566c('0x77'),'id'])||{});}})['then'](respondWithResult(_0xdfd648,null))[_0x566c('0x57')](handleError(_0xdfd648,null));};exports['getInteractions']=function(_0x1b3bc7,_0x2054bc,_0x2091bd){var _0x216ecb={'raw':![],'where':{}};var _0x515ef1={};var _0x295c1b={'count':0x0,'rows':[]};return db[_0x566c('0x42')][_0x566c('0x6d')]({'where':{'id':_0x1b3bc7['params']['id']}})['then'](handleEntityNotFound(_0x2054bc,null))[_0x566c('0x3b')](function(_0x14a44b){if(_0x14a44b){_0x515ef1[_0x566c('0x45')]=_[_0x566c('0x47')](db['FaxInteraction'][_0x566c('0x59')]);_0x515ef1[_0x566c('0x46')]=_[_0x566c('0x47')](_0x1b3bc7[_0x566c('0x46')]);_0x515ef1[_0x566c('0x48')]=_[_0x566c('0x49')](_0x515ef1[_0x566c('0x45')],_0x515ef1[_0x566c('0x46')]);_0x216ecb[_0x566c('0x4a')]=_['intersection'](_0x515ef1[_0x566c('0x45')],qs[_0x566c('0x4b')](_0x1b3bc7[_0x566c('0x46')][_0x566c('0x4b')]));_0x216ecb[_0x566c('0x4a')]=_0x216ecb['attributes'][_0x566c('0x4c')]?_0x216ecb[_0x566c('0x4a')]:_0x515ef1['model'];if(!_0x1b3bc7[_0x566c('0x46')][_0x566c('0x4d')](_0x566c('0x4e'))){_0x216ecb[_0x566c('0x31')]=qs[_0x566c('0x31')](_0x1b3bc7[_0x566c('0x46')][_0x566c('0x31')]);_0x216ecb[_0x566c('0x33')]=qs[_0x566c('0x33')](_0x1b3bc7['query'][_0x566c('0x33')]);}_0x216ecb['order']=qs[_0x566c('0x50')](_0x1b3bc7[_0x566c('0x46')][_0x566c('0x50')]);_0x216ecb[_0x566c('0x51')]=qs[_0x566c('0x48')](_[_0x566c('0x52')](_0x1b3bc7[_0x566c('0x46')],_0x515ef1[_0x566c('0x48')]));_0x216ecb['where'][_0x566c('0x6b')]=_0x14a44b['id'];if(_0x1b3bc7[_0x566c('0x46')][_0x566c('0x55')]){_0x216ecb[_0x566c('0x51')]=_[_0x566c('0x53')](_0x216ecb[_0x566c('0x51')],{'$or':_['map'](_0x216ecb['attributes'],function(_0x1c4274){var _0x4f8eaa={};_0x4f8eaa[_0x1c4274]={'$like':'%'+_0x1b3bc7['query']['filter']+'%'};return _0x4f8eaa;})});}_0x216ecb=_[_0x566c('0x53')]({},_0x216ecb,_0x1b3bc7[_0x566c('0x5c')]);return db[_0x566c('0x76')][_0x566c('0x32')]({'where':_0x216ecb['where']})['then'](function(_0x43b42e){_0x295c1b[_0x566c('0x32')]=_0x43b42e;if(_0x1b3bc7['query'][_0x566c('0x5a')]){_0x216ecb[_0x566c('0x5b')]=[{'model':db[_0x566c('0x78')],'as':_0x566c('0x79'),'required':![]},{'model':db[_0x566c('0x7a')],'as':_0x566c('0x7b'),'attributes':[_0x566c('0x3c'),_0x566c('0x7c'),_0x566c('0x7d')],'required':![]},{'model':db[_0x566c('0x7e')],'as':_0x566c('0x7f'),'attributes':['id',_0x566c('0x3c'),_0x566c('0x80')],'where':_0x1b3bc7[_0x566c('0x46')][_0x566c('0x81')]?{'id':_0x1b3bc7[_0x566c('0x46')]['tag']}:undefined,'required':_0x1b3bc7['query'][_0x566c('0x81')]?!![]:![]}];}return db['FaxInteraction'][_0x566c('0x56')](_0x216ecb);})[_0x566c('0x3b')](function(_0x347b33){_0x295c1b[_0x566c('0x6f')]=_0x347b33;return _0x295c1b;});}})[_0x566c('0x3b')](respondWithFilteredResult(_0x2054bc,_0x216ecb))[_0x566c('0x57')](handleError(_0x2054bc,null));};exports[_0x566c('0x82')]=function(_0x4baf28,_0x36d924){var _0x2d46bf=_0x4baf28['params']['id'];var _0x203ed9=_0x4baf28[_0x566c('0x5f')];var _0x15fd12=0xc8;var _0x289fb0=null;return db[_0x566c('0x83')][_0x566c('0x84')]({'isolationLevel':db['sequelize'][_0x566c('0x85')][_0x566c('0x86')][_0x566c('0x87')]},function(_0x5e3c35){return db[_0x566c('0x42')][_0x566c('0x6d')]({'where':{'id':_0x2d46bf},'transaction':_0x5e3c35})[_0x566c('0x3b')](function(_0x22c87f){if(_0x22c87f){return db[_0x566c('0x88')][_0x566c('0x39')]({'where':{'FaxAccountId':_0x2d46bf},'transaction':_0x5e3c35})[_0x566c('0x3b')](function(){var _0x189978=_[_0x566c('0x41')](_0x203ed9,function(_0x3a2211){_0x3a2211['FaxAccountId']=_0x2d46bf;return _0x3a2211;});return db[_0x566c('0x88')][_0x566c('0x89')](_0x189978,{'transaction':_0x5e3c35});});}else{_0x15fd12=0x194;_0x289fb0=[];}});})[_0x566c('0x3b')](function(){if(_0x15fd12!==0x194){return db[_0x566c('0x88')]['findAndCountAll']({'where':{'FaxAccountId':_0x2d46bf},'order':'priority'})[_0x566c('0x3b')](function(_0xe4082f){_0x289fb0=_0xe4082f;});}})['catch'](function(_0x5974bc){_0x15fd12=0x1f4;logger['error'](_0x5974bc[_0x566c('0x8a')]);if(_0x5974bc['name']){delete _0x5974bc[_0x566c('0x3c')];}_0x289fb0=_0x5974bc;})[_0x566c('0x8b')](function(){if(_0x289fb0===null){_0x36d924['sendStatus'](_0x15fd12);}else{if(_0x15fd12===0x1f4){_0x36d924[_0x566c('0x2d')](_0x15fd12)['send'](_0x289fb0);}else{_0x36d924[_0x566c('0x2d')](_0x15fd12)[_0x566c('0x2f')](_0x289fb0);}}});};exports[_0x566c('0x8c')]=function(_0x1e12ea,_0x4f3fb4,_0x4727d3){var _0x5529be={};var _0x3fae31={};var _0x4037cd;var _0x6f22d3;return db[_0x566c('0x42')][_0x566c('0x6d')]({'where':{'id':_0x1e12ea[_0x566c('0x58')]['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x4f3fb4,null))[_0x566c('0x3b')](function(_0x3bac6c){if(_0x3bac6c){_0x4037cd=_0x3bac6c;_0x3fae31['model']=_[_0x566c('0x47')](db['FaxApplication'][_0x566c('0x59')]);_0x3fae31[_0x566c('0x46')]=_[_0x566c('0x47')](_0x1e12ea[_0x566c('0x46')]);_0x3fae31[_0x566c('0x48')]=_[_0x566c('0x49')](_0x3fae31[_0x566c('0x45')],_0x3fae31['query']);_0x5529be[_0x566c('0x4a')]=_['intersection'](_0x3fae31[_0x566c('0x45')],qs[_0x566c('0x4b')](_0x1e12ea[_0x566c('0x46')]['fields']));_0x5529be[_0x566c('0x4a')]=_0x5529be[_0x566c('0x4a')][_0x566c('0x4c')]?_0x5529be[_0x566c('0x4a')]:_0x3fae31[_0x566c('0x45')];_0x5529be[_0x566c('0x4f')]=qs['sort'](_0x1e12ea['query']['sort']);_0x5529be[_0x566c('0x51')]=qs[_0x566c('0x48')](_[_0x566c('0x52')](_0x1e12ea[_0x566c('0x46')],_0x3fae31['filters']));if(_0x1e12ea[_0x566c('0x46')][_0x566c('0x55')]){_0x5529be[_0x566c('0x51')]=_[_0x566c('0x53')](_0x5529be[_0x566c('0x51')],{'$or':_['map'](_0x5529be['attributes'],function(_0x1aad23){var _0x57afe1={};_0x57afe1[_0x1aad23]={'$like':'%'+_0x1e12ea[_0x566c('0x46')][_0x566c('0x55')]+'%'};return _0x57afe1;})});}_0x5529be=_[_0x566c('0x53')]({},_0x5529be,_0x1e12ea[_0x566c('0x5c')]);return _0x4037cd[_0x566c('0x8c')](_0x5529be);}})[_0x566c('0x3b')](function(_0x4e7ac3){if(_0x4e7ac3){_0x6f22d3=_0x4e7ac3[_0x566c('0x4c')];if(!_0x1e12ea[_0x566c('0x46')][_0x566c('0x4d')](_0x566c('0x4e'))){_0x5529be[_0x566c('0x31')]=qs[_0x566c('0x31')](_0x1e12ea[_0x566c('0x46')][_0x566c('0x31')]);_0x5529be['offset']=qs['offset'](_0x1e12ea[_0x566c('0x46')][_0x566c('0x33')]);}return _0x4037cd['getApplications'](_0x5529be);}})['then'](function(_0xa79aef){if(_0xa79aef){return _0xa79aef?{'count':_0x6f22d3,'rows':_0xa79aef}:null;}})[_0x566c('0x3b')](respondWithResult(_0x4f3fb4,null))['catch'](handleError(_0x4f3fb4,null));};function Extension(_0xaecee,_0x1d1aab,_0x465f66,_0x42a7cf){this['context']=_0x566c('0x8d');this[_0x566c('0x8e')]=_0xaecee[_0x566c('0x8f')];this[_0x566c('0x90')]=_0x42a7cf;this['type']=_0x566c('0x91');this[_0x566c('0x92')]=_0x566c('0x93');this[_0x566c('0x6b')]=_0xaecee['id'];this[_0x566c('0x94')]=_0x1d1aab;this[_0x566c('0x95')]=_0x465f66;}function createExtensionsReciveFax(_0x3611ce){var _0x5e24bd=0x1;var _0x265064=[];_0x265064[_0x566c('0x96')](new Extension(_0x3611ce,_0x5e24bd,'',_0x566c('0x97')));_0x5e24bd+=0x1;_0x265064[_0x566c('0x96')](new Extension(_0x3611ce,_0x5e24bd,'CDR(type)=inbound-fax',_0x566c('0x98')));_0x5e24bd+=0x1;for(var _0x4ad197 in _0x3611ce){if(_0x3611ce[_0x566c('0x4d')](_0x4ad197)&&(_0x4ad197===_0x566c('0x99')||_0x4ad197==='localstationid'||_0x4ad197===_0x566c('0x9a')||_0x4ad197===_0x566c('0x9b')||_0x4ad197==='headerinfo'||_0x4ad197===_0x566c('0x9c')||_0x4ad197===_0x566c('0x9d')||_0x4ad197==='modem'||_0x4ad197==='t38timeout')){_0x265064[_0x566c('0x96')](new Extension(_0x3611ce,_0x5e24bd,_0x566c('0x9e')+_0x4ad197+')='+_0x3611ce[_0x4ad197],'Set'));_0x5e24bd+=0x1;}}_0x265064[_0x566c('0x96')](new Extension(_0x3611ce,_0x5e24bd,'6',_0x566c('0x9f')));_0x5e24bd+=0x1;_0x265064['push'](new Extension(_0x3611ce,_0x5e24bd,'/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',_0x566c('0xa0')));_0x5e24bd=0x0;return _0x265064;}exports['addAccountApplications']=function(_0x5482a9,_0x230afe,_0x3cbc60){var _0x47b312;return db[_0x566c('0x83')][_0x566c('0x84')](function(_0x3ef52f){return db['FaxAccount'][_0x566c('0x5e')](_0x5482a9[_0x566c('0x5f')],{'transaction':_0x3ef52f})[_0x566c('0x3b')](function(_0x2d5a34){_0x47b312=_0x2d5a34[_0x566c('0x61')]({'plain':!![]});return db[_0x566c('0xa1')]['bulkCreate'](createExtensionsReciveFax(_0x47b312),{'transaction':_0x3ef52f});});})[_0x566c('0x3b')](function(){return _0x47b312;})[_0x566c('0x3b')](respondWithResult(_0x230afe,null))['catch'](handleError(_0x230afe,null));};exports[_0x566c('0xa2')]=function(_0x36e386,_0x3550a9,_0x5ac5b1){var _0x539433;return db[_0x566c('0x83')][_0x566c('0x84')](function(_0x2a003a){return db['FaxAccount'][_0x566c('0x38')](_0x36e386[_0x566c('0x5f')],{'where':{'id':_0x36e386['body']['id']},'transaction':_0x2a003a})[_0x566c('0x3b')](function(_0x513b01){return db['VoiceExtension'][_0x566c('0x39')]({'where':{'FaxAccountId':_0x36e386[_0x566c('0x5f')]['id']},'transaction':_0x2a003a})[_0x566c('0x3b')](function(_0x18e73b){return db['VoiceExtension'][_0x566c('0x89')](createExtensionsReciveFax(_[_0x566c('0xa3')](_0x36e386[_0x566c('0x5f')],['tech',_0x566c('0xa4'),_0x566c('0xa5'),_0x566c('0xa6'),_0x566c('0xa7'),_0x566c('0xa8')])),{'transaction':_0x2a003a});});});})[_0x566c('0x3b')](function(){return db[_0x566c('0x42')][_0x566c('0xa9')](_0x36e386[_0x566c('0x5f')]['id']);})['then'](respondWithResult(_0x3550a9,null))[_0x566c('0x57')](handleError(_0x3550a9,null));};exports[_0x566c('0xaa')]=function(_0xaac959,_0x5d8b0d,_0x3ba616){var _0x1eddbe={'raw':!![],'where':{}};var _0x2f5ece={};var _0x18515={'count':0x0,'rows':[]};return db['FaxAccount'][_0x566c('0x6d')]({'where':{'id':_0xaac959['params']['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x5d8b0d,null))[_0x566c('0x3b')](function(_0x38c76f){if(_0x38c76f){_0x2f5ece[_0x566c('0x45')]=_[_0x566c('0x47')](db['FaxMessage']['rawAttributes']);_0x2f5ece['query']=_['keys'](_0xaac959[_0x566c('0x46')]);_0x2f5ece[_0x566c('0x48')]=_[_0x566c('0x49')](_0x2f5ece[_0x566c('0x45')],_0x2f5ece[_0x566c('0x46')]);_0x1eddbe[_0x566c('0x4a')]=_[_0x566c('0x49')](_0x2f5ece[_0x566c('0x45')],qs[_0x566c('0x4b')](_0xaac959['query'][_0x566c('0x4b')]));_0x1eddbe[_0x566c('0x4a')]=_0x1eddbe[_0x566c('0x4a')][_0x566c('0x4c')]?_0x1eddbe[_0x566c('0x4a')]:_0x2f5ece[_0x566c('0x45')];if(!_0xaac959['query']['hasOwnProperty'](_0x566c('0x4e'))){_0x1eddbe['limit']=qs['limit'](_0xaac959[_0x566c('0x46')][_0x566c('0x31')]);_0x1eddbe[_0x566c('0x33')]=qs['offset'](_0xaac959[_0x566c('0x46')][_0x566c('0x33')]);}_0x1eddbe[_0x566c('0x4f')]=qs[_0x566c('0x50')](_0xaac959['query'][_0x566c('0x50')]);_0x1eddbe[_0x566c('0x51')]=qs[_0x566c('0x48')](_[_0x566c('0x52')](_0xaac959[_0x566c('0x46')],_0x2f5ece[_0x566c('0x48')]));_0x1eddbe['where'][_0x566c('0x6b')]=_0x38c76f['id'];if(_0xaac959[_0x566c('0x46')]['filter']){_0x1eddbe[_0x566c('0x51')]=_[_0x566c('0x53')](_0x1eddbe['where'],{'$or':_[_0x566c('0x41')](_0x1eddbe['attributes'],function(_0x196b2c){var _0x110d46={};_0x110d46[_0x196b2c]={'$like':'%'+_0xaac959[_0x566c('0x46')][_0x566c('0x55')]+'%'};return _0x110d46;})});}if(_0xaac959[_0x566c('0x46')][_0x566c('0xab')]){var _0xf638cc=_0xaac959[_0x566c('0x46')][_0x566c('0xab')][_0x566c('0xac')](',');var _0x54f76d={};_0x54f76d[_0xf638cc[0x0]]={'$gte':moment(_0xf638cc[0x1])[_0x566c('0xad')](_0x566c('0xae'))};_0x1eddbe['where']=_[_0x566c('0x53')](_0x1eddbe[_0x566c('0x51')],_0x54f76d);}_0x1eddbe=_['merge']({},_0x1eddbe,_0xaac959[_0x566c('0x5c')]);return db[_0x566c('0xaf')][_0x566c('0x32')]({'where':_0x1eddbe['where']})['then'](function(_0x520f60){_0x18515[_0x566c('0x32')]=_0x520f60;if(_0xaac959[_0x566c('0x46')]['includeAll']){_0x1eddbe['include']=[{'all':!![]}];}return db[_0x566c('0xaf')][_0x566c('0x56')](_0x1eddbe);})[_0x566c('0x3b')](function(_0xd78fe3){_0x18515[_0x566c('0x6f')]=_0xd78fe3;return _0x18515;});}})[_0x566c('0x3b')](respondWithFilteredResult(_0x5d8b0d,_0x1eddbe))[_0x566c('0x57')](handleError(_0x5d8b0d,null));};exports['send']=function(_0x50ac52,_0x224f71,_0x2c51e0){var _0x45401e,_0x19e64f={},_0x99144f;if(_0x50ac52['body']['to']){_0x99144f=_0x50ac52[_0x566c('0x5f')]['to'][0x0];}return db[_0x566c('0x42')]['find']({'where':{'id':_0x50ac52['params']['id']},'include':[{'model':db['CmList'],'as':_0x566c('0xb0'),'include':[{'model':db[_0x566c('0x78')],'as':'Contacts','where':{'fax':_0x99144f},'limit':0x1,'order':[[_0x566c('0xa6'),_0x566c('0xb1')]]}]}]})[_0x566c('0x3b')](handleEntityNotFound(_0x224f71,null))['then'](function(_0x257518){_0x45401e=_0x257518;if(_0x50ac52['body'][_0x566c('0xb2')]&&_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][_0x566c('0x4c')]){for(var _0xf81617=0x0;_0xf81617<_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][_0x566c('0x4c')];_0xf81617+=0x1){_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][_0xf81617]={'filename':_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][_0xf81617][_0x566c('0x3c')],'id':_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][_0xf81617]['id'],'path':path[_0x566c('0xb3')](config['root'],_0x566c('0xb4'),_0x50ac52['body'][_0x566c('0xb2')][_0xf81617][_0x566c('0xb5')])};}}return respondWithRpcPromise('CheckAfterSend',_0x566c('0xb6'),{'FaxAccountId':_['isNil'](_0x50ac52[_0x566c('0x58')]['id'])?undefined:_0x50ac52[_0x566c('0x58')]['id'],'path':_[_0x566c('0xb7')](_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][0x0]['path'])?undefined:_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][0x0][_0x566c('0x6')],'fax':_[_0x566c('0xb7')](_0x50ac52['body']['to'][0x0])?undefined:_0x50ac52['body']['to'][0x0]},client9002);})[_0x566c('0x3b')](function(){if(_0x45401e){if(_['isNil'](_0x50ac52[_0x566c('0x5f')][_0x566c('0xb8')])){_0x50ac52[_0x566c('0x5f')][_0x566c('0xb8')]=util[_0x566c('0xad')](_0x566c('0xb9'),_0x45401e[_0x566c('0x3c')],_0x45401e[_0x566c('0xba')]);}if(_0x45401e[_0x566c('0xb0')]){if(_0x45401e[_0x566c('0xb0')][_0x566c('0xbb')][_0x566c('0x4c')]){return _0x45401e[_0x566c('0xb0')][_0x566c('0xbb')][0x0];}else{return db[_0x566c('0x78')][_0x566c('0x5e')](_[_0x566c('0x1a')](_0x50ac52[_0x566c('0x5f')],{'firstName':_0x50ac52['body']['to'][0x0],'phone':_0x50ac52[_0x566c('0x5f')]['to'][0x0],'fax':_0x50ac52[_0x566c('0x5f')]['to'][0x0],'ListId':_0x45401e['ListId']}));}}else{throw new Error(_0x566c('0xbc'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x566c('0x3b')](function(_0x36abbb){if(_0x36abbb){return db[_0x566c('0x76')]['find']({'where':{'ContactId':_0x36abbb['id'],'closed':![],'FaxAccountId':_0x45401e['id']}})['then'](function(_0x3d576b){if(_0x3d576b){return[_0x3d576b,![]];}return db[_0x566c('0x76')][_0x566c('0x5e')]({'UserId':_0x50ac52[_0x566c('0x60')]['id'],'ContactId':_0x36abbb['id'],'FaxAccountId':_0x45401e['id'],'fax':_0x50ac52[_0x566c('0x5f')]['to'][0x0],'firstMsgDirection':_0x566c('0xbd'),'Messages':[_[_0x566c('0x53')](_0x50ac52[_0x566c('0x5f')],{'read':![],'body':_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][0x0]['filename'],'FaxAccountId':_0x45401e['id'],'UserId':_0x50ac52[_0x566c('0x60')]['id'],'ContactId':_0x36abbb['id'],'AttachmentId':_0x50ac52[_0x566c('0x5f')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x566c('0xaf')],'as':'Messages'}]})[_0x566c('0x3b')](function(_0x1ff2ca){return[_0x1ff2ca,!![]];});});}else{throw new Error(_0x566c('0xbe'));}})[_0x566c('0xbf')](function(_0x4be1ad,_0x49a430){if(_0x49a430){return _0x4be1ad;}return db['FaxMessage'][_0x566c('0x5e')]({'direction':'out','read':![],'body':_0x50ac52[_0x566c('0x5f')]['attachments'][0x0][_0x566c('0xc0')],'FaxAccountId':_0x45401e['id'],'FaxInteractionId':_0x4be1ad['id'],'UserId':_0x50ac52[_0x566c('0x60')]['id'],'ContactId':_0x4be1ad['ContactId'],'AttachmentId':_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][0x0]['id']})[_0x566c('0x3b')](function(_0x5268fd){_0x4be1ad[_0x566c('0xc1')][_0x566c('0xc2')]=[];_0x4be1ad['dataValues'][_0x566c('0xc2')][_0x566c('0x96')](_0x5268fd['dataValues']);return _0x4be1ad;});})['then'](function(_0x2cea44){respondWithRpcPromise(_0x566c('0xc3'),'SendFax',{'FaxAccountId':_[_0x566c('0xb7')](_0x50ac52[_0x566c('0x58')]['id'])?undefined:_0x50ac52[_0x566c('0x58')]['id'],'path':_[_0x566c('0xb7')](_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][0x0]['path'])?undefined:_0x50ac52['body'][_0x566c('0xb2')][0x0]['path'],'fax':_[_0x566c('0xb7')](_0x50ac52[_0x566c('0x5f')]['to'][0x0])?undefined:_0x50ac52[_0x566c('0x5f')]['to'][0x0],'AttachmentId':_0x50ac52[_0x566c('0x5f')][_0x566c('0xb2')][0x0]['id']},client9002)[_0x566c('0x3b')](function(_0x188734){logger[_0x566c('0x23')](_0x566c('0xc4'),_0x188734);})['catch'](function(_0x237de8){logger[_0x566c('0x23')](_0x566c('0xc4'),_0x237de8);});return _0x2cea44;})['then'](respondWithResult(_0x224f71,null))['catch'](handleError(_0x224f71,null));};exports[_0x566c('0xc5')]=function(_0x5a4fa6,_0x804484,_0x59bcb0){return db['FaxAccount']['find']({'where':{'id':_0x5a4fa6['params']['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x804484,null))[_0x566c('0x3b')](function(_0x1d5cc9){if(_0x1d5cc9){return _0x1d5cc9['addAgents'](_0x5a4fa6[_0x566c('0x5f')]['ids'],_[_0x566c('0xa3')](_0x5a4fa6[_0x566c('0x5f')],[_0x566c('0x77'),'id'])||{})[_0x566c('0xbf')](function(_0x5e76e2){for(var _0x299eb6=0x0;_0x299eb6<_0x5a4fa6[_0x566c('0x5f')][_0x566c('0x77')]['length'];_0x299eb6+=0x1){socket[_0x566c('0xc6')](_0x566c('0xc7'),{'UserId':Number(_0x5a4fa6[_0x566c('0x5f')][_0x566c('0x77')][_0x299eb6]),'FaxAccountId':Number(_0x5a4fa6[_0x566c('0x58')]['id'])});}return _0x5e76e2;});}})['then'](respondWithResult(_0x804484,null))[_0x566c('0x57')](handleError(_0x804484,null));};exports[_0x566c('0xc8')]=function(_0x29adc7,_0x2ed1bd,_0x18d5e8){return db[_0x566c('0x42')][_0x566c('0x5d')]({'where':{'id':_0x29adc7[_0x566c('0x58')]['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x2ed1bd,null))['then'](function(_0x3409af){if(_0x3409af){return _0x3409af[_0x566c('0xc8')](_0x29adc7[_0x566c('0x46')][_0x566c('0x77')])[_0x566c('0x3b')](function(){if(_[_0x566c('0xc9')](_0x29adc7[_0x566c('0x46')][_0x566c('0x77')])){for(var _0x4187a5=0x0;_0x4187a5<_0x29adc7[_0x566c('0x46')]['ids']['length'];_0x4187a5+=0x1){socket[_0x566c('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x29adc7[_0x566c('0x46')][_0x566c('0x77')][_0x4187a5]),'FaxAccountId':Number(_0x29adc7[_0x566c('0x58')]['id'])});}}else{socket['emit'](_0x566c('0xca'),{'UserId':Number(_0x29adc7[_0x566c('0x46')][_0x566c('0x77')]),'FaxAccountId':Number(_0x29adc7[_0x566c('0x58')]['id'])});}});}})[_0x566c('0x3b')](respondWithStatusCode(_0x2ed1bd,null))[_0x566c('0x57')](handleError(_0x2ed1bd,null));};exports[_0x566c('0xcb')]=function(_0x528dc2,_0x517dc5,_0x4b84b0){var _0x5652ac={};var _0x1d7958={};var _0x2573c8;var _0x371e7b;return db[_0x566c('0x42')]['findOne']({'where':{'id':_0x528dc2[_0x566c('0x58')]['id']}})[_0x566c('0x3b')](handleEntityNotFound(_0x517dc5,null))[_0x566c('0x3b')](function(_0x4055d9){if(_0x4055d9){_0x2573c8=_0x4055d9;_0x1d7958[_0x566c('0x45')]=_[_0x566c('0x47')](db[_0x566c('0x7a')][_0x566c('0x59')]);_0x1d7958[_0x566c('0x46')]=_[_0x566c('0x47')](_0x528dc2['query']);_0x1d7958['filters']=_[_0x566c('0x49')](_0x1d7958['model'],_0x1d7958[_0x566c('0x46')]);_0x5652ac[_0x566c('0x4a')]=_[_0x566c('0x49')](_0x1d7958[_0x566c('0x45')],qs['fields'](_0x528dc2['query'][_0x566c('0x4b')]));_0x5652ac['attributes']=_0x5652ac[_0x566c('0x4a')]['length']?_0x5652ac[_0x566c('0x4a')]:_0x1d7958[_0x566c('0x45')];_0x5652ac[_0x566c('0x4f')]=qs[_0x566c('0x50')](_0x528dc2['query'][_0x566c('0x50')]);_0x5652ac[_0x566c('0x51')]=qs[_0x566c('0x48')](_[_0x566c('0x52')](_0x528dc2[_0x566c('0x46')],_0x1d7958[_0x566c('0x48')]));if(_0x528dc2[_0x566c('0x46')][_0x566c('0x55')]){_0x5652ac['where']=_['merge'](_0x5652ac['where'],{'$or':_[_0x566c('0x41')](_0x5652ac[_0x566c('0x4a')],function(_0x293fa3){var _0x4f6ef0={};_0x4f6ef0[_0x293fa3]={'$like':'%'+_0x528dc2[_0x566c('0x46')][_0x566c('0x55')]+'%'};return _0x4f6ef0;})});}_0x5652ac=_[_0x566c('0x53')]({},_0x5652ac,_0x528dc2['options']);return _0x2573c8[_0x566c('0xcb')](_0x5652ac);}})[_0x566c('0x3b')](function(_0x56a235){if(_0x56a235){_0x371e7b=_0x56a235['length'];if(!_0x528dc2['query'][_0x566c('0x4d')]('nolimit')){_0x5652ac[_0x566c('0x31')]=qs['limit'](_0x528dc2['query'][_0x566c('0x31')]);_0x5652ac[_0x566c('0x33')]=qs[_0x566c('0x33')](_0x528dc2[_0x566c('0x46')]['offset']);}return _0x2573c8[_0x566c('0xcb')](_0x5652ac);}})[_0x566c('0x3b')](function(_0x10b48b){if(_0x10b48b){return _0x10b48b?{'count':_0x371e7b,'rows':_0x10b48b}:null;}})['then'](respondWithResult(_0x517dc5,null))[_0x566c('0x57')](handleError(_0x517dc5,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6dbd014..3782850 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 _0x2baf=['../../mysqldb','FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x907a49,_0x1ed818){var _0x4d8924=function(_0x233fea){while(--_0x233fea){_0x907a49['push'](_0x907a49['shift']());}};_0x4d8924(++_0x1ed818);}(_0x2baf,0xc8));var _0xf2ba=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x2baf[_0xf5d71c];return _0x5af672;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xf2ba('0x0'))['db'][_0xf2ba('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf2ba('0x2')](0x0);var events={'afterCreate':_0xf2ba('0x3'),'afterUpdate':_0xf2ba('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3616ad){return function(_0x52953b,_0x5d6dae,_0x24b770){FaxAccountEvents[_0xf2ba('0x5')](_0x3616ad+':'+_0x52953b['id'],_0x52953b);FaxAccountEvents[_0xf2ba('0x5')](_0x3616ad,_0x52953b);_0x24b770(null);};}for(var e in events){if(events[_0xf2ba('0x6')](e)){var event=events[e];FaxAccount[_0xf2ba('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xc6e8=['FaxAccount','setMaxListeners','save','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0xc6e8,0x9e));var _0x8c6e=function(_0x2344e2,_0x23dc54){_0x2344e2=_0x2344e2-0x0;var _0x3bc43e=_0xc6e8[_0x2344e2];return _0x3bc43e;};'use strict';var EventEmitter=require(_0x8c6e('0x0'));var FaxAccount=require(_0x8c6e('0x1'))['db'][_0x8c6e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8c6e('0x3')](0x0);var events={'afterCreate':_0x8c6e('0x4'),'afterUpdate':'update','afterDestroy':_0x8c6e('0x5')};function emitEvent(_0x4c5080){return function(_0x4219ab,_0x513d1,_0x21df78){FaxAccountEvents['emit'](_0x4c5080+':'+_0x4219ab['id'],_0x4219ab);FaxAccountEvents['emit'](_0x4c5080,_0x4219ab);_0x21df78(null);};}for(var e in events){if(events[_0x8c6e('0x6')](e)){var event=events[e];FaxAccount[_0x8c6e('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4a0f122..4b27db5 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 _0x775a=['./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2a8d25,_0x354da6){var _0x26b5a0=function(_0x2117aa){while(--_0x2117aa){_0x2a8d25['push'](_0x2a8d25['shift']());}};_0x26b5a0(++_0x354da6);}(_0x775a,0x1b1));var _0xa775=function(_0x45d7d4,_0x554bc2){_0x45d7d4=_0x45d7d4-0x0;var _0x5af431=_0x775a[_0x45d7d4];return _0x5af431;};'use strict';var _=require(_0xa775('0x0'));var util=require(_0xa775('0x1'));var logger=require(_0xa775('0x2'))(_0xa775('0x3'));var moment=require(_0xa775('0x4'));var BPromise=require(_0xa775('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa775('0x6'));var rimraf=require(_0xa775('0x7'));var config=require(_0xa775('0x8'));var attributes=require(_0xa775('0x9'));module[_0xa775('0xa')]=function(_0x37b6a9,_0x235c9a){return _0x37b6a9[_0xa775('0xb')]('FaxAccount',attributes,{'tableName':_0xa775('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d8=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','api','moment','request-promise','rimraf'];(function(_0x5c027f,_0xa40135){var _0x5392f3=function(_0x581c3b){while(--_0x581c3b){_0x5c027f['push'](_0x5c027f['shift']());}};_0x5392f3(++_0xa40135);}(_0x10d8,0x19c));var _0x810d=function(_0x52b683,_0x176dbf){_0x52b683=_0x52b683-0x0;var _0x3eb799=_0x10d8[_0x52b683];return _0x3eb799;};'use strict';var _=require(_0x810d('0x0'));var util=require(_0x810d('0x1'));var logger=require('../../config/logger')(_0x810d('0x2'));var moment=require(_0x810d('0x3'));var BPromise=require('bluebird');var rp=require(_0x810d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x810d('0x5'));var config=require(_0x810d('0x6'));var attributes=require(_0x810d('0x7'));module[_0x810d('0x8')]=function(_0x13bbf2,_0x572ca5){return _0x13bbf2[_0x810d('0x9')](_0x810d('0xa'),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 5c1c397..31c280f 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 _0x196f=['DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','account','length','ListId','create','contact','FaxInteraction','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','name','queue','Start','startRouting','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','keys','updatedAt','CompanyId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','CmList','List','Contacts'];(function(_0x354803,_0x3b56d8){var _0x2e30ba=function(_0x24e9b7){while(--_0x24e9b7){_0x354803['push'](_0x354803['shift']());}};_0x2e30ba(++_0x3b56d8);}(_0x196f,0xdd));var _0xf196=function(_0xb6fc95,_0x3b6ded){_0xb6fc95=_0xb6fc95-0x0;var _0x1368da=_0x196f[_0xb6fc95];return _0x1368da;};'use strict';var _=require(_0xf196('0x0'));var util=require(_0xf196('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf196('0x2'));var fs=require('fs');var Redis=require(_0xf196('0x3'));var db=require(_0xf196('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf196('0x5'))('rpc');var config=require(_0xf196('0x6'));var jayson=require(_0xf196('0x7'));var client=jayson[_0xf196('0x8')]['http']({'port':0x232c});config[_0xf196('0x9')]=_[_0xf196('0xa')](config[_0xf196('0x9')],{'host':_0xf196('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf196('0x9')]));require('./faxAccount.socket')[_0xf196('0xc')](socket);function respondWithRpcPromise(_0x5f51f0,_0x50c64d,_0x30c570){return new BPromise(function(_0x5139a5,_0x17884f){return client[_0xf196('0xd')](_0x5f51f0,_0x30c570)[_0xf196('0xe')](function(_0x4e6e27){logger[_0xf196('0xf')](_0xf196('0x10'),_0x50c64d,_0xf196('0x11'));logger[_0xf196('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x50c64d,'request\x20sent',JSON[_0xf196('0x13')](_0x4e6e27));if(_0x4e6e27[_0xf196('0x14')]){if(_0x4e6e27[_0xf196('0x14')]['code']===0x1f4){logger['error'](_0xf196('0x10'),_0x50c64d,_0x4e6e27[_0xf196('0x14')][_0xf196('0x15')]);return _0x17884f(_0x4e6e27[_0xf196('0x14')][_0xf196('0x15')]);}logger[_0xf196('0x14')](_0xf196('0x10'),_0x50c64d,_0x4e6e27[_0xf196('0x14')][_0xf196('0x15')]);return _0x5139a5(_0x4e6e27[_0xf196('0x14')][_0xf196('0x15')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x50c64d,'request\x20sent');_0x5139a5(_0x4e6e27[_0xf196('0x16')][_0xf196('0x15')]);}})[_0xf196('0x17')](function(_0x4d1678){logger[_0xf196('0x14')]('FaxAccount,\x20%s,\x20%s',_0x50c64d,_0x4d1678);_0x17884f(_0x4d1678);});});}exports[_0xf196('0x18')]=function(_0x25f574){var _0x135350=this;return new Promise(function(_0x49f865,_0x4761cc){return db['FaxAccount'][_0xf196('0x19')]({'raw':_0x25f574[_0xf196('0x1a')]?_0x25f574[_0xf196('0x1a')][_0xf196('0x1b')]===undefined?!![]:![]:!![],'where':_0x25f574[_0xf196('0x1a')]?_0x25f574['options']['where']||null:null,'attributes':_0x25f574[_0xf196('0x1a')]?_0x25f574[_0xf196('0x1a')][_0xf196('0x1c')]||null:null,'limit':_0x25f574['options']?_0x25f574[_0xf196('0x1a')][_0xf196('0x1d')]||null:null,'include':_0x25f574['options']?_0x25f574[_0xf196('0x1a')]['include']?_['map'](_0x25f574[_0xf196('0x1a')][_0xf196('0x1e')],function(_0x476dcf){return{'model':db[_0x476dcf['model']],'as':_0x476dcf['as'],'attributes':_0x476dcf['attributes'],'include':_0x476dcf['include']?_[_0xf196('0x1f')](_0x476dcf['include'],function(_0x2a4999){return{'model':db[_0x2a4999[_0xf196('0x20')]],'as':_0x2a4999['as'],'attributes':_0x2a4999['attributes'],'include':_0x2a4999['include']?_[_0xf196('0x1f')](_0x2a4999['include'],function(_0x4375de){return{'model':db[_0x4375de[_0xf196('0x20')]],'as':_0x4375de['as'],'attributes':_0x4375de[_0xf196('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cf8c1){logger[_0xf196('0xf')](_0xf196('0x18'),_0x25f574);logger[_0xf196('0x12')](_0xf196('0x18'),_0x25f574,JSON[_0xf196('0x13')](_0x3cf8c1));_0x49f865(_0x3cf8c1);})[_0xf196('0x17')](function(_0x2f7d7a){logger[_0xf196('0x14')](_0xf196('0x18'),_0x2f7d7a['message'],_0x25f574);_0x4761cc(_0x135350['error'](0x1f4,_0x2f7d7a[_0xf196('0x15')]));});});};exports[_0xf196('0x21')]=function(_0xc6904a,_0x4d525b,_0xece9c0){var _0x1b2c83=this;return new Promise(function(_0x22e902,_0x52bdca){var _0x292c6c={'body':_0xc6904a['body'],'channel':_0xf196('0x22')};var _0x178382=[];var _0x2187d5=[];var _0x31a343={};return db[_0xf196('0x23')][_0xf196('0x24')]()[_0xf196('0xe')](function(_0x19372e){if(!_0x19372e){throw new db[(_0xf196('0x25'))][(_0xf196('0x26'))](_0xf196('0x27'));}_0x178382=_[_0xf196('0x28')](_['keys'](_0x19372e),[_0xf196('0x29'),'updatedAt']);_0x2187d5=_[_0xf196('0x28')](_[_0xf196('0x2a')](_0x19372e),['createdAt',_0xf196('0x2b'),_0xf196('0x2c'),'ListId']);if(_0xc6904a['body']['id']){delete _0xc6904a[_0xf196('0x2d')]['id'];}if(_[_0xf196('0x2e')](_0xc6904a[_0xf196('0x2d')][_0xf196('0x2f')])){throw new db[(_0xf196('0x25'))][(_0xf196('0x26'))](_0xf196('0x30'));}if(_['isNil'](_0xc6904a['body'][_0xf196('0x2d')])||_0xc6904a[_0xf196('0x2d')][_0xf196('0x2d')]===''){throw new db[(_0xf196('0x25'))][(_0xf196('0x26'))](_0xf196('0x31'));}if(_[_0xf196('0x2e')](_0xc6904a['body'][_0xf196('0x32')])){throw new db[(_0xf196('0x25'))][(_0xf196('0x26'))](_0xf196('0x33')+_0x2187d5);}if(!_[_0xf196('0x34')](_0x2187d5,_0xc6904a['body'][_0xf196('0x32')])){throw new db[(_0xf196('0x25'))][(_0xf196('0x26'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2187d5);}_0x31a343[_0xc6904a['body'][_0xf196('0x32')]]=_0xc6904a[_0xf196('0x2d')][_0xf196('0x2f')];})[_0xf196('0xe')](function(){return db[_0xf196('0x35')][_0xf196('0x36')]({'where':{'id':_0xc6904a['account']['id']},'include':[{'model':db[_0xf196('0x37')],'as':_0xf196('0x38'),'include':[{'model':db[_0xf196('0x23')],'as':_0xf196('0x39'),'where':_0x31a343,'limit':0x1,'order':[[_0xf196('0x2b'),_0xf196('0x3a')]]}]},{'model':db[_0xf196('0x3b')],'as':_0xf196('0x3c')}]});})[_0xf196('0xe')](function(_0x24860c){if(_0x24860c&&_0x24860c['List']){var _0x20b9d1=_0x24860c[_0xf196('0x3d')]({'plain':!![]});_0x292c6c['account']=_0x20b9d1;_0x292c6c[_0xf196('0x3e')]=_0x20b9d1[_0xf196('0x3c')];_0x292c6c[_0xf196('0x3f')]=_0x20b9d1[_0xf196('0x38')];_0x292c6c[_0xf196('0x3e')]=_[_0xf196('0x40')](_0x292c6c[_0xf196('0x3e')],[_0xf196('0x41')],[_0xf196('0x42')]);if(_0x292c6c[_0xf196('0x43')][_0xf196('0x3c')]){delete _0x292c6c[_0xf196('0x43')][_0xf196('0x3c')];}if(_0x292c6c[_0xf196('0x43')][_0xf196('0x38')]&&_0x292c6c[_0xf196('0x43')][_0xf196('0x38')]['Contacts'][_0xf196('0x44')]){return _0x292c6c['account']['List'][_0xf196('0x39')][0x0];}var _0x1f448c=_[_0xf196('0xa')](_0xc6904a[_0xf196('0x2d')],{'firstName':_0xc6904a[_0xf196('0x2d')]['from'],'ListId':_0x20b9d1[_0xf196('0x45')]});_0x1f448c[_0xc6904a[_0xf196('0x2d')][_0xf196('0x32')]]=_0xc6904a[_0xf196('0x2d')]['from'];return db[_0xf196('0x23')][_0xf196('0x46')](_0x1f448c,{'fields':_0x178382,'raw':!![]});}})[_0xf196('0xe')](function(_0x124237){_0x292c6c[_0xf196('0x47')]=_0x124237;if(_0x124237){var _0x24ac7a={'ContactId':_0x124237['id'],'FaxAccountId':_0xc6904a[_0xf196('0x43')]['id'],'fax':_0x124237[_0xf196('0x22')]};return db[_0xf196('0x48')]['find']({'where':{'ContactId':_0x124237['id'],'closed':![],'FaxAccountId':_0xc6904a[_0xf196('0x43')]['id']}})[_0xf196('0xe')](function(_0x1b4b25){if(_0x1b4b25){return[_0x1b4b25,![]];}return db[_0xf196('0x48')][_0xf196('0x46')](_0x24ac7a)[_0xf196('0xe')](function(_0x491660){return[_0x491660,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf196('0x49')](function(_0x21dd74,_0x420223){var _0x436932=_0x21dd74[_0xf196('0x3d')]({'plain':!![]});if(_0x420223){if(_0x292c6c[_0xf196('0x43')][_0xf196('0x4a')]){_0x292c6c[_0xf196('0x3e')][_0xf196('0x4b')]({'id':0x0,'priority':_0x292c6c['applications'][_0xf196('0x44')]+0x1,'app':'close','appdata':_0xf196('0x4c'),'interval':_0xf196('0x4d')});}_0x436932[_0xf196('0x4e')]=!![];}else{_0x436932[_0xf196('0x4e')]=![];}_0x292c6c[_0xf196('0x4f')]=_0x436932;return db[_0xf196('0x50')][_0xf196('0x46')]({'body':_0xc6904a[_0xf196('0x2d')][_0xf196('0x2d')],'FaxAccountId':_0xc6904a[_0xf196('0x43')]['id'],'FaxInteractionId':_0x21dd74['id'],'direction':'in','ContactId':_0x21dd74['ContactId'],'AttachmentId':_0xc6904a['body'][_0xf196('0x51')]});})[_0xf196('0xe')](function(_0x122c93){_0x292c6c[_0xf196('0x15')]=_0x122c93;if(!_0x292c6c[_0xf196('0x4f')][_0xf196('0x52')])return;return db[_0xf196('0x53')]['find']({'attributes':['id','name'],'where':{'id':_0x292c6c[_0xf196('0x4f')][_0xf196('0x52')]}});})[_0xf196('0xe')](function(_0x11435e){if(_0x11435e){_0x292c6c[_0xf196('0x3e')][_0xf196('0x54')]({'id':0x0,'priority':0x0,'app':_0xf196('0x55'),'appdata':_0x11435e['name']+','+(_0x292c6c[_0xf196('0x43')][_0xf196('0x56')]||0xa),'interval':_0xf196('0x4d')});}if(!_0x292c6c[_0xf196('0x4f')][_0xf196('0x57')])return;return db[_0xf196('0x58')][_0xf196('0x36')]({'attributes':['id',_0xf196('0x59')],'where':{'id':_0x292c6c['interaction'][_0xf196('0x57')]}});})[_0xf196('0xe')](function(_0x59f7ac){if(_0x59f7ac){_0x292c6c[_0xf196('0x3e')][_0xf196('0x54')]({'id':0x0,'priority':0x1,'app':_0xf196('0x5a'),'appdata':_0x59f7ac[_0xf196('0x59')]+','+(_0x292c6c['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf196('0x5b'),_0xf196('0x5c'),_0x292c6c);})[_0xf196('0xe')](function(_0x7606cc){_0x22e902(_0x7606cc);})[_0xf196('0x17')](function(_0x24984a){_0x52bdca(_0x1b2c83[_0xf196('0x14')](0x1f4,_0x24984a['message']));});});}; \ No newline at end of file +var _0xc3da=['unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','startRouting','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxAccount','findAll','options','raw','attributes','include','map','model','GetFaxAccount','NotifyFaxAccount','fax','describe','then','Sequelize','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','body','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','CmContact','DESC','FaxApplication','Applications','list','applications','priority','asc','Contacts','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','get','autoclose','push','close'];(function(_0x597bbb,_0xa43025){var _0x3d332e=function(_0x3a7a58){while(--_0x3a7a58){_0x597bbb['push'](_0x597bbb['shift']());}};_0x3d332e(++_0xa43025);}(_0xc3da,0x70));var _0xac3d=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xc3da[_0x31b5a5];return _0x364cc9;};'use strict';var _=require(_0xac3d('0x0'));var util=require(_0xac3d('0x1'));var moment=require('moment');var BPromise=require(_0xac3d('0x2'));var rs=require(_0xac3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac3d('0x4'));var logger=require(_0xac3d('0x5'))(_0xac3d('0x6'));var config=require(_0xac3d('0x7'));var jayson=require(_0xac3d('0x8'));var client=jayson[_0xac3d('0x9')][_0xac3d('0xa')]({'port':0x232c});config[_0xac3d('0xb')]=_[_0xac3d('0xc')](config[_0xac3d('0xb')],{'host':_0xac3d('0xd'),'port':0x18eb});var socket=require(_0xac3d('0xe'))(new Redis(config[_0xac3d('0xb')]));require(_0xac3d('0xf'))[_0xac3d('0x10')](socket);function respondWithRpcPromise(_0x599994,_0x5ebcbd,_0x430fda){return new BPromise(function(_0x44222c,_0x22b44e){return client['request'](_0x599994,_0x430fda)['then'](function(_0x47dc2b){logger['info'](_0xac3d('0x11'),_0x5ebcbd,_0xac3d('0x12'));logger[_0xac3d('0x13')](_0xac3d('0x14'),_0x5ebcbd,_0xac3d('0x12'),JSON[_0xac3d('0x15')](_0x47dc2b));if(_0x47dc2b[_0xac3d('0x16')]){if(_0x47dc2b[_0xac3d('0x16')][_0xac3d('0x17')]===0x1f4){logger['error'](_0xac3d('0x11'),_0x5ebcbd,_0x47dc2b[_0xac3d('0x16')][_0xac3d('0x18')]);return _0x22b44e(_0x47dc2b['error'][_0xac3d('0x18')]);}logger[_0xac3d('0x16')](_0xac3d('0x11'),_0x5ebcbd,_0x47dc2b['error'][_0xac3d('0x18')]);return _0x44222c(_0x47dc2b[_0xac3d('0x16')][_0xac3d('0x18')]);}else{logger[_0xac3d('0x19')](_0xac3d('0x11'),_0x5ebcbd,_0xac3d('0x12'));_0x44222c(_0x47dc2b[_0xac3d('0x1a')][_0xac3d('0x18')]);}})[_0xac3d('0x1b')](function(_0x22e3ae){logger[_0xac3d('0x16')](_0xac3d('0x11'),_0x5ebcbd,_0x22e3ae);_0x22b44e(_0x22e3ae);});});}exports['GetFaxAccount']=function(_0x3bb722){var _0x18b84f=this;return new Promise(function(_0x47e65c,_0x3f7715){return db[_0xac3d('0x1c')][_0xac3d('0x1d')]({'raw':_0x3bb722[_0xac3d('0x1e')]?_0x3bb722[_0xac3d('0x1e')][_0xac3d('0x1f')]===undefined?!![]:![]:!![],'where':_0x3bb722[_0xac3d('0x1e')]?_0x3bb722['options']['where']||null:null,'attributes':_0x3bb722['options']?_0x3bb722[_0xac3d('0x1e')][_0xac3d('0x20')]||null:null,'limit':_0x3bb722[_0xac3d('0x1e')]?_0x3bb722[_0xac3d('0x1e')]['limit']||null:null,'include':_0x3bb722[_0xac3d('0x1e')]?_0x3bb722[_0xac3d('0x1e')][_0xac3d('0x21')]?_[_0xac3d('0x22')](_0x3bb722[_0xac3d('0x1e')][_0xac3d('0x21')],function(_0x42406c){return{'model':db[_0x42406c[_0xac3d('0x23')]],'as':_0x42406c['as'],'attributes':_0x42406c[_0xac3d('0x20')],'include':_0x42406c[_0xac3d('0x21')]?_['map'](_0x42406c[_0xac3d('0x21')],function(_0x234286){return{'model':db[_0x234286['model']],'as':_0x234286['as'],'attributes':_0x234286[_0xac3d('0x20')],'include':_0x234286[_0xac3d('0x21')]?_[_0xac3d('0x22')](_0x234286[_0xac3d('0x21')],function(_0x219076){return{'model':db[_0x219076['model']],'as':_0x219076['as'],'attributes':_0x219076[_0xac3d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f3097){logger[_0xac3d('0x19')](_0xac3d('0x24'),_0x3bb722);logger[_0xac3d('0x13')](_0xac3d('0x24'),_0x3bb722,JSON[_0xac3d('0x15')](_0x3f3097));_0x47e65c(_0x3f3097);})[_0xac3d('0x1b')](function(_0xd9d250){logger[_0xac3d('0x16')](_0xac3d('0x24'),_0xd9d250['message'],_0x3bb722);_0x3f7715(_0x18b84f[_0xac3d('0x16')](0x1f4,_0xd9d250[_0xac3d('0x18')]));});});};exports[_0xac3d('0x25')]=function(_0x4d8df6,_0x18f5c9,_0x157115){var _0xb98b64=this;return new Promise(function(_0x49bfef,_0x2d5736){var _0x13542a={'body':_0x4d8df6['body'],'channel':_0xac3d('0x26')};var _0x3c9caf=[];var _0x3c64a0=[];var _0x3ab886={};return db['CmContact'][_0xac3d('0x27')]()[_0xac3d('0x28')](function(_0x325d23){if(!_0x325d23){throw new db[(_0xac3d('0x29'))]['ValidationError'](_0xac3d('0x2a'));}_0x3c9caf=_['difference'](_[_0xac3d('0x2b')](_0x325d23),[_0xac3d('0x2c'),'updatedAt']);_0x3c64a0=_[_0xac3d('0x2d')](_[_0xac3d('0x2b')](_0x325d23),[_0xac3d('0x2c'),_0xac3d('0x2e'),'CompanyId','ListId']);if(_0x4d8df6['body']['id']){delete _0x4d8df6[_0xac3d('0x2f')]['id'];}if(_['isNil'](_0x4d8df6['body'][_0xac3d('0x30')])){throw new db['Sequelize'][(_0xac3d('0x31'))](_0xac3d('0x32'));}if(_['isNil'](_0x4d8df6[_0xac3d('0x2f')][_0xac3d('0x2f')])||_0x4d8df6[_0xac3d('0x2f')][_0xac3d('0x2f')]===''){throw new db[(_0xac3d('0x29'))][(_0xac3d('0x31'))](_0xac3d('0x33'));}if(_[_0xac3d('0x34')](_0x4d8df6[_0xac3d('0x2f')][_0xac3d('0x35')])){throw new db['Sequelize']['ValidationError'](_0xac3d('0x36')+_0x3c64a0);}if(!_[_0xac3d('0x37')](_0x3c64a0,_0x4d8df6['body'][_0xac3d('0x35')])){throw new db[(_0xac3d('0x29'))][(_0xac3d('0x31'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c64a0);}_0x3ab886[_0x4d8df6['body']['mapKey']]=_0x4d8df6[_0xac3d('0x2f')][_0xac3d('0x30')];})[_0xac3d('0x28')](function(){return db[_0xac3d('0x1c')][_0xac3d('0x38')]({'where':{'id':_0x4d8df6[_0xac3d('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xac3d('0x3a'),'include':[{'model':db[_0xac3d('0x3b')],'as':'Contacts','where':_0x3ab886,'limit':0x1,'order':[['updatedAt',_0xac3d('0x3c')]]}]},{'model':db[_0xac3d('0x3d')],'as':_0xac3d('0x3e')}]});})[_0xac3d('0x28')](function(_0x33b1d8){if(_0x33b1d8&&_0x33b1d8['List']){var _0x55f946=_0x33b1d8['get']({'plain':!![]});_0x13542a[_0xac3d('0x39')]=_0x55f946;_0x13542a['applications']=_0x55f946[_0xac3d('0x3e')];_0x13542a[_0xac3d('0x3f')]=_0x55f946[_0xac3d('0x3a')];_0x13542a[_0xac3d('0x40')]=_['orderBy'](_0x13542a[_0xac3d('0x40')],[_0xac3d('0x41')],[_0xac3d('0x42')]);if(_0x13542a[_0xac3d('0x39')][_0xac3d('0x3e')]){delete _0x13542a[_0xac3d('0x39')][_0xac3d('0x3e')];}if(_0x13542a['account'][_0xac3d('0x3a')]&&_0x13542a[_0xac3d('0x39')]['List'][_0xac3d('0x43')][_0xac3d('0x44')]){return _0x13542a['account'][_0xac3d('0x3a')]['Contacts'][0x0];}var _0x19a1d8=_['defaults'](_0x4d8df6[_0xac3d('0x2f')],{'firstName':_0x4d8df6[_0xac3d('0x2f')]['from'],'ListId':_0x55f946[_0xac3d('0x45')]});_0x19a1d8[_0x4d8df6[_0xac3d('0x2f')]['mapKey']]=_0x4d8df6[_0xac3d('0x2f')]['from'];return db['CmContact'][_0xac3d('0x46')](_0x19a1d8,{'fields':_0x3c9caf,'raw':!![]});}})[_0xac3d('0x28')](function(_0x4d3514){_0x13542a[_0xac3d('0x47')]=_0x4d3514;if(_0x4d3514){var _0x944c22={'ContactId':_0x4d3514['id'],'FaxAccountId':_0x4d8df6[_0xac3d('0x39')]['id'],'fax':_0x4d3514[_0xac3d('0x26')]};return db['FaxInteraction'][_0xac3d('0x38')]({'where':{'ContactId':_0x4d3514['id'],'closed':![],'FaxAccountId':_0x4d8df6[_0xac3d('0x39')]['id']}})['then'](function(_0x4a81dd){if(_0x4a81dd){return[_0x4a81dd,![]];}return db[_0xac3d('0x48')][_0xac3d('0x46')](_0x944c22)[_0xac3d('0x28')](function(_0x3c50b2){return[_0x3c50b2,!![]];});});}else{throw new Error(_0xac3d('0x49'));}})['spread'](function(_0x230fef,_0x3cfea6){var _0x3076f4=_0x230fef[_0xac3d('0x4a')]({'plain':!![]});if(_0x3cfea6){if(_0x13542a[_0xac3d('0x39')][_0xac3d('0x4b')]){_0x13542a[_0xac3d('0x40')][_0xac3d('0x4c')]({'id':0x0,'priority':_0x13542a[_0xac3d('0x40')]['length']+0x1,'app':_0xac3d('0x4d'),'appdata':_0xac3d('0x4e'),'interval':'*,*,*,*'});}_0x3076f4[_0xac3d('0x4f')]=!![];}else{_0x3076f4['created']=![];}_0x13542a[_0xac3d('0x50')]=_0x3076f4;return db[_0xac3d('0x51')]['create']({'body':_0x4d8df6[_0xac3d('0x2f')]['body'],'FaxAccountId':_0x4d8df6['account']['id'],'FaxInteractionId':_0x230fef['id'],'direction':'in','ContactId':_0x230fef[_0xac3d('0x52')],'AttachmentId':_0x4d8df6[_0xac3d('0x2f')][_0xac3d('0x53')]});})[_0xac3d('0x28')](function(_0x18cf77){_0x13542a[_0xac3d('0x18')]=_0x18cf77;if(!_0x13542a[_0xac3d('0x50')][_0xac3d('0x54')])return;return db[_0xac3d('0x55')][_0xac3d('0x38')]({'attributes':['id',_0xac3d('0x56')],'where':{'id':_0x13542a[_0xac3d('0x50')][_0xac3d('0x54')]}});})[_0xac3d('0x28')](function(_0x2ae5d7){if(_0x2ae5d7){_0x13542a[_0xac3d('0x40')][_0xac3d('0x57')]({'id':0x0,'priority':0x0,'app':_0xac3d('0x58'),'appdata':_0x2ae5d7[_0xac3d('0x56')]+','+(_0x13542a['account'][_0xac3d('0x59')]||0xa),'interval':_0xac3d('0x5a')});}if(!_0x13542a[_0xac3d('0x50')][_0xac3d('0x5b')])return;return db['FaxQueue'][_0xac3d('0x38')]({'attributes':['id',_0xac3d('0x56')],'where':{'id':_0x13542a[_0xac3d('0x50')][_0xac3d('0x5b')]}});})[_0xac3d('0x28')](function(_0x2f1265){if(_0x2f1265){_0x13542a[_0xac3d('0x40')][_0xac3d('0x57')]({'id':0x0,'priority':0x1,'app':_0xac3d('0x5c'),'appdata':_0x2f1265[_0xac3d('0x56')]+','+(_0x13542a[_0xac3d('0x39')][_0xac3d('0x5d')]||0x12c),'interval':_0xac3d('0x5a')});}return respondWithRpcPromise('Start',_0xac3d('0x5e'),_0x13542a);})[_0xac3d('0x28')](function(_0x40bc49){_0x49bfef(_0x40bc49);})[_0xac3d('0x1b')](function(_0x290a49){_0x2d5736(_0xb98b64['error'](0x1f4,_0x290a49[_0xac3d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e01fdb5..c0688ab 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 _0x1aec=['remove','update','removeListener','register','faxAccount:','save'];(function(_0x584739,_0x52211f){var _0x4c567c=function(_0x38526d){while(--_0x38526d){_0x584739['push'](_0x584739['shift']());}};_0x4c567c(++_0x52211f);}(_0x1aec,0x1c7));var _0xc1ae=function(_0x5a6f0d,_0x28bfa5){_0x5a6f0d=_0x5a6f0d-0x0;var _0x13d5f0=_0x1aec[_0x5a6f0d];return _0x13d5f0;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xc1ae('0x0'),_0xc1ae('0x1'),_0xc1ae('0x2')];function createListener(_0x1cd18a,_0x1b4caf){return function(_0x5295e5){_0x1b4caf['emit'](_0x1cd18a,_0x5295e5);};}function removeListener(_0x109bf9,_0x5bc040){return function(){FaxAccountEvents[_0xc1ae('0x3')](_0x109bf9,_0x5bc040);};}exports[_0xc1ae('0x4')]=function(_0x43b016){for(var _0x1f024b=0x0,_0x36304a=events['length'];_0x1f024b<_0x36304a;_0x1f024b++){var _0x25d2c4=events[_0x1f024b];var _0x486e83=createListener(_0xc1ae('0x5')+_0x25d2c4,_0x43b016);FaxAccountEvents['on'](_0x25d2c4,_0x486e83);}}; \ No newline at end of file +var _0x8db4=['removeListener','length','./faxAccount.events','save','remove'];(function(_0x2676d7,_0x376226){var _0x49f258=function(_0x57c9fd){while(--_0x57c9fd){_0x2676d7['push'](_0x2676d7['shift']());}};_0x49f258(++_0x376226);}(_0x8db4,0x14c));var _0x48db=function(_0x1bb2c1,_0x226b2b){_0x1bb2c1=_0x1bb2c1-0x0;var _0x2bfa66=_0x8db4[_0x1bb2c1];return _0x2bfa66;};'use strict';var FaxAccountEvents=require(_0x48db('0x0'));var events=[_0x48db('0x1'),_0x48db('0x2'),'update'];function createListener(_0x3602f3,_0x81033f){return function(_0x2545c4){_0x81033f['emit'](_0x3602f3,_0x2545c4);};}function removeListener(_0x530be9,_0x5de578){return function(){FaxAccountEvents[_0x48db('0x3')](_0x530be9,_0x5de578);};}exports['register']=function(_0x27c117){for(var _0x27b83c=0x0,_0x2c0a9d=events[_0x48db('0x4')];_0x27b83c<_0x2c0a9d;_0x27b83c++){var _0xe29a29=events[_0x27b83c];var _0x20c0d6=createListener('faxAccount:'+_0xe29a29,_0x27c117);FaxAccountEvents['on'](_0xe29a29,_0x20c0d6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0169fea..28c30d7 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 _0xdfcc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','put','/:id','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x52af7e,_0x4ff4d4){var _0x505c75=function(_0x2d2775){while(--_0x2d2775){_0x52af7e['push'](_0x52af7e['shift']());}};_0x505c75(++_0x4ff4d4);}(_0xdfcc,0x9c));var _0xcdfc=function(_0xda6ad1,_0x5f09e3){_0xda6ad1=_0xda6ad1-0x0;var _0xedc3a5=_0xdfcc[_0xda6ad1];return _0xedc3a5;};'use strict';var multer=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var path=require('path');var timeout=require(_0xcdfc('0x2'));var express=require(_0xcdfc('0x3'));var router=express[_0xcdfc('0x4')]();var fs_extra=require(_0xcdfc('0x5'));var auth=require(_0xcdfc('0x6'));var interaction=require(_0xcdfc('0x7'));var config=require('../../config/environment');var controller=require(_0xcdfc('0x8'));router[_0xcdfc('0x9')]('/',auth[_0xcdfc('0xa')](),controller[_0xcdfc('0xb')]);router[_0xcdfc('0x9')](_0xcdfc('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xcdfc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xcdfc('0xd')]);router[_0xcdfc('0x9')](_0xcdfc('0xe'),auth['isAuthenticated'](),controller[_0xcdfc('0xf')]);router[_0xcdfc('0x9')](_0xcdfc('0x10'),auth['isAuthenticated'](),controller[_0xcdfc('0x11')]);router[_0xcdfc('0x9')](_0xcdfc('0x12'),auth[_0xcdfc('0xa')](),controller[_0xcdfc('0x13')]);router[_0xcdfc('0x9')](_0xcdfc('0x14'),auth['isAuthenticated'](),controller[_0xcdfc('0x15')]);router['get'](_0xcdfc('0x16'),auth[_0xcdfc('0xa')](),controller[_0xcdfc('0x17')]);router['get'](_0xcdfc('0x18'),auth[_0xcdfc('0xa')](),controller['getAgents']);router[_0xcdfc('0x19')]('/',auth[_0xcdfc('0xa')](),controller[_0xcdfc('0x1a')]);router[_0xcdfc('0x19')](_0xcdfc('0xe'),auth[_0xcdfc('0xa')](),controller[_0xcdfc('0x1b')]);router[_0xcdfc('0x19')](_0xcdfc('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xcdfc('0x12'),auth['isAuthenticated'](),controller[_0xcdfc('0x1c')]);router['post'](_0xcdfc('0x14'),auth['isAuthenticated'](),controller[_0xcdfc('0x1d')]);router['post'](_0xcdfc('0x1e'),auth[_0xcdfc('0xa')](),controller[_0xcdfc('0x1f')]);router[_0xcdfc('0x19')](_0xcdfc('0x20'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0xcdfc('0x19')](_0xcdfc('0x21'),auth[_0xcdfc('0xa')](),controller[_0xcdfc('0x22')]);router[_0xcdfc('0x19')](_0xcdfc('0x18'),auth[_0xcdfc('0xa')](),controller['addAgents']);router[_0xcdfc('0x23')](_0xcdfc('0x24'),auth[_0xcdfc('0xa')](),controller[_0xcdfc('0x25')]);router[_0xcdfc('0x26')](_0xcdfc('0x24'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xcdfc('0xe'),auth[_0xcdfc('0xa')](),controller['removeDispositions']);router[_0xcdfc('0x26')]('/:id/canned_answers',auth[_0xcdfc('0xa')](),controller['removeAnswers']);router[_0xcdfc('0x26')](_0xcdfc('0x18'),auth[_0xcdfc('0xa')](),controller['removeAgents']);module[_0xcdfc('0x27')]=router; \ No newline at end of file +var _0x16ca=['isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16ca,0x155));var _0xa16c=function(_0x70cd0c,_0x385194){_0x70cd0c=_0x70cd0c-0x0;var _0x2effd5=_0x16ca[_0x70cd0c];return _0x2effd5;};'use strict';var multer=require(_0xa16c('0x0'));var util=require(_0xa16c('0x1'));var path=require(_0xa16c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa16c('0x3'));var router=express[_0xa16c('0x4')]();var fs_extra=require(_0xa16c('0x5'));var auth=require(_0xa16c('0x6'));var interaction=require(_0xa16c('0x7'));var config=require(_0xa16c('0x8'));var controller=require(_0xa16c('0x9'));router[_0xa16c('0xa')]('/',auth[_0xa16c('0xb')](),controller[_0xa16c('0xc')]);router[_0xa16c('0xa')](_0xa16c('0xd'),auth['isAuthenticated'](),controller[_0xa16c('0xe')]);router[_0xa16c('0xa')](_0xa16c('0xf'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x10')]);router[_0xa16c('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xa16c('0xa')](_0xa16c('0x11'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x12')]);router[_0xa16c('0xa')](_0xa16c('0x13'),auth['isAuthenticated'](),controller[_0xa16c('0x14')]);router[_0xa16c('0xa')](_0xa16c('0x15'),auth[_0xa16c('0xb')](),controller['getApplications']);router['get'](_0xa16c('0x16'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x17')]);router[_0xa16c('0xa')](_0xa16c('0x18'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x19')]);router[_0xa16c('0x1a')]('/',auth[_0xa16c('0xb')](),controller[_0xa16c('0x1b')]);router[_0xa16c('0x1a')](_0xa16c('0x1c'),auth['isAuthenticated'](),controller[_0xa16c('0x1d')]);router[_0xa16c('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa16c('0x1e')]);router[_0xa16c('0x1a')](_0xa16c('0x13'),auth[_0xa16c('0xb')](),controller['addInteraction']);router[_0xa16c('0x1a')](_0xa16c('0x15'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x1f')]);router[_0xa16c('0x1a')](_0xa16c('0x20'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x21')]);router['post']('/updateaccountapplications',auth[_0xa16c('0xb')](),controller[_0xa16c('0x22')]);router[_0xa16c('0x1a')](_0xa16c('0x23'),auth['isAuthenticated'](),controller[_0xa16c('0x24')]);router[_0xa16c('0x1a')](_0xa16c('0x18'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x25')]);router[_0xa16c('0x26')](_0xa16c('0xf'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x27')]);router[_0xa16c('0x28')](_0xa16c('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0xa16c('0x28')](_0xa16c('0x1c'),auth[_0xa16c('0xb')](),controller[_0xa16c('0x29')]);router[_0xa16c('0x28')]('/:id/canned_answers',auth[_0xa16c('0xb')](),controller[_0xa16c('0x2a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xa16c('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 30b6a40..6cc34e4 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 _0x4176=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x48b1bb,_0x4ca4ef){var _0x3353a4=function(_0x130169){while(--_0x130169){_0x48b1bb['push'](_0x48b1bb['shift']());}};_0x3353a4(++_0x4ca4ef);}(_0x4176,0x1de));var _0x6417=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x4176[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require('sequelize');module[_0x6417('0x0')]={'priority':{'type':Sequelize[_0x6417('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6417('0x2')],'allowNull':![],'defaultValue':_0x6417('0x3')},'appdata':{'type':Sequelize[_0x6417('0x4')]()},'description':{'type':Sequelize[_0x6417('0x2')]},'interval':{'type':Sequelize[_0x6417('0x2')],'defaultValue':_0x6417('0x5')}}; \ No newline at end of file +var _0x8aec=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x41d0e9,_0x30dae1){var _0x421021=function(_0xd0af1b){while(--_0xd0af1b){_0x41d0e9['push'](_0x41d0e9['shift']());}};_0x421021(++_0x30dae1);}(_0x8aec,0xe7));var _0xc8ae=function(_0x342c1b,_0x5e6aab){_0x342c1b=_0x342c1b-0x0;var _0x233f5f=_0x8aec[_0x342c1b];return _0x233f5f;};'use strict';var Sequelize=require(_0xc8ae('0x0'));module[_0xc8ae('0x1')]={'priority':{'type':Sequelize[_0xc8ae('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc8ae('0x3')],'allowNull':![],'defaultValue':_0xc8ae('0x4')},'appdata':{'type':Sequelize[_0xc8ae('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc8ae('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 141cd24..49c3ee2 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 _0xf34f=['options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','count','include','findAll','rows','catch','show','params'];(function(_0x4a38d7,_0x5b2c4e){var _0x1f5ac7=function(_0x289ac5){while(--_0x289ac5){_0x4a38d7['push'](_0x4a38d7['shift']());}};_0x1f5ac7(++_0x5b2c4e);}(_0xf34f,0xee));var _0xff34=function(_0x573f51,_0x381b28){_0x573f51=_0x573f51-0x0;var _0x58f39b=_0xf34f[_0x573f51];return _0x58f39b;};'use strict';var emlformat=require(_0xff34('0x0'));var rimraf=require(_0xff34('0x1'));var zipdir=require(_0xff34('0x2'));var jsonpatch=require(_0xff34('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff34('0x4'));var Mustache=require('mustache');var util=require(_0xff34('0x5'));var path=require(_0xff34('0x6'));var sox=require(_0xff34('0x7'));var csv=require(_0xff34('0x8'));var ejs=require(_0xff34('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff34('0xa'));var squel=require(_0xff34('0xb'));var crypto=require('crypto');var jsforce=require(_0xff34('0xc'));var deskjs=require(_0xff34('0xd'));var toCsv=require(_0xff34('0x8'));var querystring=require(_0xff34('0xe'));var Papa=require(_0xff34('0xf'));var Redis=require(_0xff34('0x10'));var authService=require(_0xff34('0x11'));var qs=require(_0xff34('0x12'));var as=require(_0xff34('0x13'));var hardwareService=require(_0xff34('0x14'));var logger=require(_0xff34('0x15'))(_0xff34('0x16'));var utils=require(_0xff34('0x17'));var config=require(_0xff34('0x18'));var licenseUtil=require(_0xff34('0x19'));var db=require(_0xff34('0x1a'))['db'];function respondWithStatusCode(_0x23c454,_0x447213){_0x447213=_0x447213||0xcc;return function(_0x11ecfc){if(_0x11ecfc){return _0x23c454[_0xff34('0x1b')](_0x447213);}return _0x23c454[_0xff34('0x1c')](_0x447213)[_0xff34('0x1d')]();};}function respondWithResult(_0x380e86,_0x4b124b){_0x4b124b=_0x4b124b||0xc8;return function(_0x8c03d2){if(_0x8c03d2){return _0x380e86['status'](_0x4b124b)[_0xff34('0x1e')](_0x8c03d2);}};}function respondWithFilteredResult(_0x46c4cf,_0x5b30ea){return function(_0x2d3db7){if(_0x2d3db7){var _0x14c9df=typeof _0x5b30ea[_0xff34('0x1f')]===_0xff34('0x20')&&typeof _0x5b30ea[_0xff34('0x21')]===_0xff34('0x20');var _0x4ce05a=_0x2d3db7['count'];var _0x13368b=_0x14c9df?0x0:_0x5b30ea[_0xff34('0x1f')];var _0x52bdc4=_0x14c9df?_0x2d3db7['count']:_0x5b30ea['offset']+_0x5b30ea['limit'];var _0x695624;if(_0x52bdc4>=_0x4ce05a){_0x52bdc4=_0x4ce05a;_0x695624=0xc8;}else{_0x695624=0xce;}_0x46c4cf[_0xff34('0x1c')](_0x695624);return _0x46c4cf[_0xff34('0x22')](_0xff34('0x23'),_0x13368b+'-'+_0x52bdc4+'/'+_0x4ce05a)[_0xff34('0x1e')](_0x2d3db7);}return null;};}function patchUpdates(_0x6525d2){return function(_0xb78f67){try{jsonpatch[_0xff34('0x24')](_0xb78f67,_0x6525d2,!![]);}catch(_0x36f604){return BPromise['reject'](_0x36f604);}return _0xb78f67[_0xff34('0x25')]();};}function saveUpdates(_0x5ac077,_0x3f1ebe){return function(_0x39c965){if(_0x39c965){return _0x39c965[_0xff34('0x26')](_0x5ac077)['then'](function(_0xc3e829){return _0xc3e829;});}return null;};}function removeEntity(_0x1a57c4,_0x2247be){return function(_0x4a57ab){if(_0x4a57ab){return _0x4a57ab[_0xff34('0x27')]()[_0xff34('0x28')](function(){_0x1a57c4['status'](0xcc)[_0xff34('0x1d')]();});}};}function handleEntityNotFound(_0x3ab9d5,_0x48ecba){return function(_0x4768e4){if(!_0x4768e4){_0x3ab9d5[_0xff34('0x1b')](0x194);}return _0x4768e4;};}function handleError(_0x1fad53,_0x4dc00c){_0x4dc00c=_0x4dc00c||0x1f4;return function(_0x4f7fe6){logger[_0xff34('0x29')](_0x4f7fe6[_0xff34('0x2a')]);if(_0x4f7fe6['name']){delete _0x4f7fe6[_0xff34('0x2b')];}_0x1fad53[_0xff34('0x1c')](_0x4dc00c)[_0xff34('0x2c')](_0x4f7fe6);};}exports['index']=function(_0x8bcd44,_0x56ccd9){var _0x583937={},_0x5b06cc={},_0x4b4592={'count':0x0,'rows':[]};var _0x4bfe33=_[_0xff34('0x2d')](db[_0xff34('0x2e')][_0xff34('0x2f')],function(_0x46a808){return{'name':_0x46a808[_0xff34('0x30')],'type':_0x46a808[_0xff34('0x31')][_0xff34('0x32')]};});_0x5b06cc[_0xff34('0x33')]=_['map'](_0x4bfe33,_0xff34('0x2b'));_0x5b06cc[_0xff34('0x34')]=_[_0xff34('0x35')](_0x8bcd44[_0xff34('0x34')]);_0x5b06cc[_0xff34('0x36')]=_['intersection'](_0x5b06cc['model'],_0x5b06cc[_0xff34('0x34')]);_0x583937[_0xff34('0x37')]=_[_0xff34('0x38')](_0x5b06cc[_0xff34('0x33')],qs[_0xff34('0x39')](_0x8bcd44[_0xff34('0x34')][_0xff34('0x39')]));_0x583937[_0xff34('0x37')]=_0x583937[_0xff34('0x37')][_0xff34('0x3a')]?_0x583937[_0xff34('0x37')]:_0x5b06cc['model'];if(!_0x8bcd44['query'][_0xff34('0x3b')](_0xff34('0x3c'))){_0x583937[_0xff34('0x21')]=qs['limit'](_0x8bcd44[_0xff34('0x34')][_0xff34('0x21')]);_0x583937['offset']=qs[_0xff34('0x1f')](_0x8bcd44['query'][_0xff34('0x1f')]);}_0x583937[_0xff34('0x3d')]=qs['sort'](_0x8bcd44[_0xff34('0x34')][_0xff34('0x3e')]);_0x583937[_0xff34('0x3f')]=qs[_0xff34('0x36')](_[_0xff34('0x40')](_0x8bcd44['query'],_0x5b06cc[_0xff34('0x36')]),_0x4bfe33);if(_0x8bcd44[_0xff34('0x34')]['filter']){_0x583937[_0xff34('0x3f')]=_[_0xff34('0x41')](_0x583937[_0xff34('0x3f')],{'$or':_[_0xff34('0x2d')](_0x4bfe33,function(_0x219f01){if(_0x219f01['type']!=='VIRTUAL'){var _0x3e8e71={};_0x3e8e71[_0x219f01[_0xff34('0x2b')]]={'$like':'%'+_0x8bcd44['query'][_0xff34('0x42')]+'%'};return _0x3e8e71;}})});}_0x583937=_[_0xff34('0x41')]({},_0x583937,_0x8bcd44['options']);var _0x31828c={'where':_0x583937[_0xff34('0x3f')]};return db[_0xff34('0x2e')]['count'](_0x31828c)[_0xff34('0x28')](function(_0x5e2ad8){_0x4b4592[_0xff34('0x43')]=_0x5e2ad8;if(_0x8bcd44['query']['includeAll']){_0x583937[_0xff34('0x44')]=[{'all':!![]}];}return db[_0xff34('0x2e')][_0xff34('0x45')](_0x583937);})[_0xff34('0x28')](function(_0x3bf26a){_0x4b4592[_0xff34('0x46')]=_0x3bf26a;return _0x4b4592;})[_0xff34('0x28')](respondWithFilteredResult(_0x56ccd9,_0x583937))[_0xff34('0x47')](handleError(_0x56ccd9,null));};exports[_0xff34('0x48')]=function(_0x2491f2,_0x11b285){var _0x182536={'raw':!![],'where':{'id':_0x2491f2[_0xff34('0x49')]['id']}},_0x36780c={};_0x36780c[_0xff34('0x33')]=_[_0xff34('0x35')](db[_0xff34('0x2e')]['rawAttributes']);_0x36780c[_0xff34('0x34')]=_[_0xff34('0x35')](_0x2491f2[_0xff34('0x34')]);_0x36780c[_0xff34('0x36')]=_[_0xff34('0x38')](_0x36780c[_0xff34('0x33')],_0x36780c[_0xff34('0x34')]);_0x182536[_0xff34('0x37')]=_[_0xff34('0x38')](_0x36780c['model'],qs['fields'](_0x2491f2[_0xff34('0x34')][_0xff34('0x39')]));_0x182536[_0xff34('0x37')]=_0x182536[_0xff34('0x37')][_0xff34('0x3a')]?_0x182536['attributes']:_0x36780c[_0xff34('0x33')];if(_0x2491f2[_0xff34('0x34')]['includeAll']){_0x182536['include']=[{'all':!![]}];}_0x182536=_['merge']({},_0x182536,_0x2491f2[_0xff34('0x4a')]);return db['FaxApplication'][_0xff34('0x4b')](_0x182536)[_0xff34('0x28')](handleEntityNotFound(_0x11b285,null))[_0xff34('0x28')](respondWithResult(_0x11b285,null))['catch'](handleError(_0x11b285,null));};exports[_0xff34('0x4c')]=function(_0x4fd23a,_0x387a2b){return db[_0xff34('0x2e')][_0xff34('0x4c')](_0x4fd23a['body'],{})[_0xff34('0x28')](respondWithResult(_0x387a2b,0xc9))['catch'](handleError(_0x387a2b,null));};exports[_0xff34('0x26')]=function(_0x4b6b96,_0x50fa0a){if(_0x4b6b96['body']['id']){delete _0x4b6b96[_0xff34('0x4d')]['id'];}return db[_0xff34('0x2e')][_0xff34('0x4b')]({'where':{'id':_0x4b6b96[_0xff34('0x49')]['id']}})[_0xff34('0x28')](handleEntityNotFound(_0x50fa0a,null))['then'](saveUpdates(_0x4b6b96['body'],null))[_0xff34('0x28')](respondWithResult(_0x50fa0a,null))[_0xff34('0x47')](handleError(_0x50fa0a,null));};exports[_0xff34('0x27')]=function(_0x3b0479,_0x1186a7){return db[_0xff34('0x2e')][_0xff34('0x4b')]({'where':{'id':_0x3b0479['params']['id']}})[_0xff34('0x28')](handleEntityNotFound(_0x1186a7,null))[_0xff34('0x28')](removeEntity(_0x1186a7,null))[_0xff34('0x47')](handleError(_0x1186a7,null));}; \ No newline at end of file +var _0x5a10=['then','destroy','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5a10,0x148));var _0x05a1=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5a10[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x05a1('0x0'));var rimraf=require(_0x05a1('0x1'));var zipdir=require(_0x05a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05a1('0x3'));var moment=require(_0x05a1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x05a1('0x5'));var util=require('util');var path=require(_0x05a1('0x6'));var sox=require(_0x05a1('0x7'));var csv=require('to-csv');var ejs=require(_0x05a1('0x8'));var fs=require('fs');var fs_extra=require(_0x05a1('0x9'));var _=require(_0x05a1('0xa'));var squel=require(_0x05a1('0xb'));var crypto=require(_0x05a1('0xc'));var jsforce=require(_0x05a1('0xd'));var deskjs=require(_0x05a1('0xe'));var toCsv=require(_0x05a1('0xf'));var querystring=require(_0x05a1('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x05a1('0x11'));var qs=require(_0x05a1('0x12'));var as=require(_0x05a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05a1('0x14'))(_0x05a1('0x15'));var utils=require(_0x05a1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x05a1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x70ca54,_0x4477e9){_0x4477e9=_0x4477e9||0xcc;return function(_0x2b15e8){if(_0x2b15e8){return _0x70ca54[_0x05a1('0x18')](_0x4477e9);}return _0x70ca54[_0x05a1('0x19')](_0x4477e9)[_0x05a1('0x1a')]();};}function respondWithResult(_0x87ad24,_0x4f0878){_0x4f0878=_0x4f0878||0xc8;return function(_0x4e56e6){if(_0x4e56e6){return _0x87ad24[_0x05a1('0x19')](_0x4f0878)[_0x05a1('0x1b')](_0x4e56e6);}};}function respondWithFilteredResult(_0x4b4ca3,_0x504b6d){return function(_0x2d4f7b){if(_0x2d4f7b){var _0x7c83e3=typeof _0x504b6d[_0x05a1('0x1c')]===_0x05a1('0x1d')&&typeof _0x504b6d[_0x05a1('0x1e')]===_0x05a1('0x1d');var _0x52c687=_0x2d4f7b[_0x05a1('0x1f')];var _0x2b3c20=_0x7c83e3?0x0:_0x504b6d['offset'];var _0x2025f7=_0x7c83e3?_0x2d4f7b['count']:_0x504b6d['offset']+_0x504b6d['limit'];var _0x36709a;if(_0x2025f7>=_0x52c687){_0x2025f7=_0x52c687;_0x36709a=0xc8;}else{_0x36709a=0xce;}_0x4b4ca3[_0x05a1('0x19')](_0x36709a);return _0x4b4ca3[_0x05a1('0x20')](_0x05a1('0x21'),_0x2b3c20+'-'+_0x2025f7+'/'+_0x52c687)[_0x05a1('0x1b')](_0x2d4f7b);}return null;};}function patchUpdates(_0x217a28){return function(_0x4fc3c5){try{jsonpatch[_0x05a1('0x22')](_0x4fc3c5,_0x217a28,!![]);}catch(_0x5f480b){return BPromise[_0x05a1('0x23')](_0x5f480b);}return _0x4fc3c5['save']();};}function saveUpdates(_0x557d90,_0x39dcc7){return function(_0x400006){if(_0x400006){return _0x400006[_0x05a1('0x24')](_0x557d90)[_0x05a1('0x25')](function(_0x6ca604){return _0x6ca604;});}return null;};}function removeEntity(_0x4b3ec6,_0x43b41d){return function(_0x33b624){if(_0x33b624){return _0x33b624[_0x05a1('0x26')]()[_0x05a1('0x25')](function(){_0x4b3ec6[_0x05a1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b41b0,_0x5b070f){return function(_0x231cd1){if(!_0x231cd1){_0x6b41b0[_0x05a1('0x18')](0x194);}return _0x231cd1;};}function handleError(_0x5c23d8,_0x1c1d71){_0x1c1d71=_0x1c1d71||0x1f4;return function(_0x1291ff){logger['error'](_0x1291ff['stack']);if(_0x1291ff['name']){delete _0x1291ff['name'];}_0x5c23d8[_0x05a1('0x19')](_0x1c1d71)[_0x05a1('0x27')](_0x1291ff);};}exports[_0x05a1('0x28')]=function(_0x22ef89,_0x1f3a3b){var _0x2e3a61={},_0x48fbae={},_0x482dfc={'count':0x0,'rows':[]};var _0x5040f3=_[_0x05a1('0x29')](db[_0x05a1('0x2a')][_0x05a1('0x2b')],function(_0x1e4102){return{'name':_0x1e4102[_0x05a1('0x2c')],'type':_0x1e4102['type'][_0x05a1('0x2d')]};});_0x48fbae[_0x05a1('0x2e')]=_['map'](_0x5040f3,_0x05a1('0x2f'));_0x48fbae['query']=_['keys'](_0x22ef89[_0x05a1('0x30')]);_0x48fbae[_0x05a1('0x31')]=_[_0x05a1('0x32')](_0x48fbae['model'],_0x48fbae[_0x05a1('0x30')]);_0x2e3a61['attributes']=_[_0x05a1('0x32')](_0x48fbae[_0x05a1('0x2e')],qs[_0x05a1('0x33')](_0x22ef89[_0x05a1('0x30')]['fields']));_0x2e3a61['attributes']=_0x2e3a61[_0x05a1('0x34')][_0x05a1('0x35')]?_0x2e3a61[_0x05a1('0x34')]:_0x48fbae['model'];if(!_0x22ef89[_0x05a1('0x30')][_0x05a1('0x36')](_0x05a1('0x37'))){_0x2e3a61[_0x05a1('0x1e')]=qs['limit'](_0x22ef89[_0x05a1('0x30')][_0x05a1('0x1e')]);_0x2e3a61['offset']=qs[_0x05a1('0x1c')](_0x22ef89[_0x05a1('0x30')][_0x05a1('0x1c')]);}_0x2e3a61['order']=qs[_0x05a1('0x38')](_0x22ef89[_0x05a1('0x30')]['sort']);_0x2e3a61[_0x05a1('0x39')]=qs[_0x05a1('0x31')](_[_0x05a1('0x3a')](_0x22ef89['query'],_0x48fbae[_0x05a1('0x31')]),_0x5040f3);if(_0x22ef89[_0x05a1('0x30')]['filter']){_0x2e3a61[_0x05a1('0x39')]=_['merge'](_0x2e3a61[_0x05a1('0x39')],{'$or':_[_0x05a1('0x29')](_0x5040f3,function(_0x35fd95){if(_0x35fd95[_0x05a1('0x3b')]!==_0x05a1('0x3c')){var _0x22c2c9={};_0x22c2c9[_0x35fd95[_0x05a1('0x2f')]]={'$like':'%'+_0x22ef89[_0x05a1('0x30')][_0x05a1('0x3d')]+'%'};return _0x22c2c9;}})});}_0x2e3a61=_['merge']({},_0x2e3a61,_0x22ef89[_0x05a1('0x3e')]);var _0x165a56={'where':_0x2e3a61[_0x05a1('0x39')]};return db[_0x05a1('0x2a')]['count'](_0x165a56)[_0x05a1('0x25')](function(_0x20e249){_0x482dfc['count']=_0x20e249;if(_0x22ef89[_0x05a1('0x30')][_0x05a1('0x3f')]){_0x2e3a61[_0x05a1('0x40')]=[{'all':!![]}];}return db[_0x05a1('0x2a')][_0x05a1('0x41')](_0x2e3a61);})['then'](function(_0x5453a5){_0x482dfc[_0x05a1('0x42')]=_0x5453a5;return _0x482dfc;})[_0x05a1('0x25')](respondWithFilteredResult(_0x1f3a3b,_0x2e3a61))[_0x05a1('0x43')](handleError(_0x1f3a3b,null));};exports['show']=function(_0x3e4831,_0x386fc2){var _0x3dbec9={'raw':!![],'where':{'id':_0x3e4831[_0x05a1('0x44')]['id']}},_0x4bb26b={};_0x4bb26b[_0x05a1('0x2e')]=_['keys'](db[_0x05a1('0x2a')][_0x05a1('0x2b')]);_0x4bb26b[_0x05a1('0x30')]=_['keys'](_0x3e4831['query']);_0x4bb26b[_0x05a1('0x31')]=_[_0x05a1('0x32')](_0x4bb26b[_0x05a1('0x2e')],_0x4bb26b[_0x05a1('0x30')]);_0x3dbec9['attributes']=_[_0x05a1('0x32')](_0x4bb26b['model'],qs[_0x05a1('0x33')](_0x3e4831[_0x05a1('0x30')]['fields']));_0x3dbec9[_0x05a1('0x34')]=_0x3dbec9[_0x05a1('0x34')]['length']?_0x3dbec9[_0x05a1('0x34')]:_0x4bb26b['model'];if(_0x3e4831['query'][_0x05a1('0x3f')]){_0x3dbec9[_0x05a1('0x40')]=[{'all':!![]}];}_0x3dbec9=_[_0x05a1('0x45')]({},_0x3dbec9,_0x3e4831[_0x05a1('0x3e')]);return db['FaxApplication'][_0x05a1('0x46')](_0x3dbec9)[_0x05a1('0x25')](handleEntityNotFound(_0x386fc2,null))[_0x05a1('0x25')](respondWithResult(_0x386fc2,null))['catch'](handleError(_0x386fc2,null));};exports[_0x05a1('0x47')]=function(_0x545767,_0x1845b0){return db[_0x05a1('0x2a')][_0x05a1('0x47')](_0x545767['body'],{})['then'](respondWithResult(_0x1845b0,0xc9))[_0x05a1('0x43')](handleError(_0x1845b0,null));};exports[_0x05a1('0x24')]=function(_0x22271e,_0x144d63){if(_0x22271e[_0x05a1('0x48')]['id']){delete _0x22271e[_0x05a1('0x48')]['id'];}return db['FaxApplication'][_0x05a1('0x46')]({'where':{'id':_0x22271e[_0x05a1('0x44')]['id']}})[_0x05a1('0x25')](handleEntityNotFound(_0x144d63,null))[_0x05a1('0x25')](saveUpdates(_0x22271e['body'],null))[_0x05a1('0x25')](respondWithResult(_0x144d63,null))[_0x05a1('0x43')](handleError(_0x144d63,null));};exports['destroy']=function(_0x25c4c9,_0x4b64a3){return db['FaxApplication'][_0x05a1('0x46')]({'where':{'id':_0x25c4c9[_0x05a1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b64a3,null))[_0x05a1('0x25')](removeEntity(_0x4b64a3,null))['catch'](handleError(_0x4b64a3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e10091f..57448e3 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 _0x1956=['api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util'];(function(_0x5081a0,_0x401dfb){var _0x202aeb=function(_0x272a5b){while(--_0x272a5b){_0x5081a0['push'](_0x5081a0['shift']());}};_0x202aeb(++_0x401dfb);}(_0x1956,0x1b9));var _0x6195=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x1956[_0x3005d5];return _0x547c7e;};'use strict';var _=require('lodash');var util=require(_0x6195('0x0'));var logger=require('../../config/logger')(_0x6195('0x1'));var moment=require(_0x6195('0x2'));var BPromise=require(_0x6195('0x3'));var rp=require(_0x6195('0x4'));var fs=require('fs');var path=require(_0x6195('0x5'));var rimraf=require('rimraf');var config=require(_0x6195('0x6'));var attributes=require(_0x6195('0x7'));module[_0x6195('0x8')]=function(_0x550bf9,_0x128762){return _0x550bf9[_0x6195('0x9')](_0x6195('0xa'),attributes,{'tableName':_0x6195('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6195('0xc')});}; \ No newline at end of file +var _0x6b6b=['api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','util'];(function(_0x57172c,_0x1df512){var _0x38e8a4=function(_0x1bc9a5){while(--_0x1bc9a5){_0x57172c['push'](_0x57172c['shift']());}};_0x38e8a4(++_0x1df512);}(_0x6b6b,0xaf));var _0xb6b6=function(_0x1edb0f,_0x468294){_0x1edb0f=_0x1edb0f-0x0;var _0x902b55=_0x6b6b[_0x1edb0f];return _0x902b55;};'use strict';var _=require('lodash');var util=require(_0xb6b6('0x0'));var logger=require('../../config/logger')(_0xb6b6('0x1'));var moment=require(_0xb6b6('0x2'));var BPromise=require(_0xb6b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6b6('0x4'));var rimraf=require('rimraf');var config=require(_0xb6b6('0x5'));var attributes=require(_0xb6b6('0x6'));module[_0xb6b6('0x7')]=function(_0x33dc8b,_0x1464cf){return _0x33dc8b[_0xb6b6('0x8')](_0xb6b6('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6b6('0xa'),'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 f30d18f..87f689d 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 _0x5bad=['raw','where','limit','then','debug','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateFaxApplication','FaxApplication','body','options'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0x5bad,0xee));var _0xd5ba=function(_0x1b4f28,_0x30c9a6){_0x1b4f28=_0x1b4f28-0x0;var _0x23e283=_0x5bad[_0x1b4f28];return _0x23e283;};'use strict';var _=require('lodash');var util=require(_0xd5ba('0x0'));var moment=require(_0xd5ba('0x1'));var BPromise=require(_0xd5ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5ba('0x3'));var db=require(_0xd5ba('0x4'))['db'];var utils=require(_0xd5ba('0x5'));var logger=require(_0xd5ba('0x6'))(_0xd5ba('0x7'));var config=require('../../config/environment');var jayson=require(_0xd5ba('0x8'));var client=jayson[_0xd5ba('0x9')][_0xd5ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x516f07,_0x5de843,_0x47db3d){return new BPromise(function(_0x123d79,_0x2dd970){return client[_0xd5ba('0xb')](_0x516f07,_0x47db3d)['then'](function(_0x18abba){logger[_0xd5ba('0xc')](_0xd5ba('0xd'),_0x5de843,_0xd5ba('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5de843,'request\x20sent',JSON[_0xd5ba('0xf')](_0x18abba));if(_0x18abba[_0xd5ba('0x10')]){if(_0x18abba[_0xd5ba('0x10')][_0xd5ba('0x11')]===0x1f4){logger['error'](_0xd5ba('0xd'),_0x5de843,_0x18abba[_0xd5ba('0x10')][_0xd5ba('0x12')]);return _0x2dd970(_0x18abba[_0xd5ba('0x10')][_0xd5ba('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x5de843,_0x18abba['error'][_0xd5ba('0x12')]);return _0x123d79(_0x18abba[_0xd5ba('0x10')][_0xd5ba('0x12')]);}else{logger[_0xd5ba('0xc')](_0xd5ba('0xd'),_0x5de843,_0xd5ba('0xe'));_0x123d79(_0x18abba['result'][_0xd5ba('0x12')]);}})['catch'](function(_0x1d7141){logger[_0xd5ba('0x10')](_0xd5ba('0xd'),_0x5de843,_0x1d7141);_0x2dd970(_0x1d7141);});});}exports[_0xd5ba('0x13')]=function(_0x54e9e9){var _0x5c3400=this;return new Promise(function(_0x360ca1,_0x5d7147){return db[_0xd5ba('0x14')]['update'](_0x54e9e9[_0xd5ba('0x15')],{'raw':_0x54e9e9[_0xd5ba('0x16')]?_0x54e9e9['options'][_0xd5ba('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54e9e9[_0xd5ba('0x16')]?_0x54e9e9[_0xd5ba('0x16')][_0xd5ba('0x18')]||null:null,'attributes':_0x54e9e9[_0xd5ba('0x16')]?_0x54e9e9['options']['attributes']||null:null,'limit':_0x54e9e9[_0xd5ba('0x16')]?_0x54e9e9[_0xd5ba('0x16')][_0xd5ba('0x19')]||null:null})[_0xd5ba('0x1a')](function(_0x1e4ba0){logger['info'](_0xd5ba('0x13'),_0x54e9e9);logger[_0xd5ba('0x1b')]('UpdateFaxApplication',_0x54e9e9,JSON[_0xd5ba('0xf')](_0x1e4ba0));_0x360ca1(_0x1e4ba0);})[_0xd5ba('0x1c')](function(_0x2e5bbf){logger[_0xd5ba('0x10')](_0xd5ba('0x13'),_0x2e5bbf['message'],_0x54e9e9);_0x5d7147(_0x5c3400['error'](0x1f4,_0x2e5bbf['message']));});});}; \ No newline at end of file +var _0xf49a=['../../config/utils','../../config/logger','jayson/promise','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxApplication','update','body','options','raw','where','attributes','limit','then','UpdateFaxApplication','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4ec0bc,_0x47c2a6){var _0x196598=function(_0x3d8a44){while(--_0x3d8a44){_0x4ec0bc['push'](_0x4ec0bc['shift']());}};_0x196598(++_0x47c2a6);}(_0xf49a,0x199));var _0xaf49=function(_0x3a3959,_0x5c8488){_0x3a3959=_0x3a3959-0x0;var _0x3b8f77=_0xf49a[_0x3a3959];return _0x3b8f77;};'use strict';var _=require(_0xaf49('0x0'));var util=require(_0xaf49('0x1'));var moment=require(_0xaf49('0x2'));var BPromise=require(_0xaf49('0x3'));var rs=require(_0xaf49('0x4'));var fs=require('fs');var Redis=require(_0xaf49('0x5'));var db=require(_0xaf49('0x6'))['db'];var utils=require(_0xaf49('0x7'));var logger=require(_0xaf49('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaf49('0x9'));var client=jayson['client'][_0xaf49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1092e0,_0x4e67af,_0x23c327){return new BPromise(function(_0x5c7278,_0x29eede){return client[_0xaf49('0xb')](_0x1092e0,_0x23c327)['then'](function(_0x5112a4){logger[_0xaf49('0xc')](_0xaf49('0xd'),_0x4e67af,_0xaf49('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4e67af,_0xaf49('0xe'),JSON[_0xaf49('0xf')](_0x5112a4));if(_0x5112a4['error']){if(_0x5112a4[_0xaf49('0x10')][_0xaf49('0x11')]===0x1f4){logger[_0xaf49('0x10')](_0xaf49('0xd'),_0x4e67af,_0x5112a4[_0xaf49('0x10')][_0xaf49('0x12')]);return _0x29eede(_0x5112a4[_0xaf49('0x10')][_0xaf49('0x12')]);}logger[_0xaf49('0x10')](_0xaf49('0xd'),_0x4e67af,_0x5112a4[_0xaf49('0x10')][_0xaf49('0x12')]);return _0x5c7278(_0x5112a4['error'][_0xaf49('0x12')]);}else{logger['info'](_0xaf49('0xd'),_0x4e67af,_0xaf49('0xe'));_0x5c7278(_0x5112a4[_0xaf49('0x13')]['message']);}})[_0xaf49('0x14')](function(_0x28a8f5){logger[_0xaf49('0x10')](_0xaf49('0xd'),_0x4e67af,_0x28a8f5);_0x29eede(_0x28a8f5);});});}exports['UpdateFaxApplication']=function(_0x3396ca){var _0x2bad59=this;return new Promise(function(_0x2d3a09,_0xc2fd15){return db[_0xaf49('0x15')][_0xaf49('0x16')](_0x3396ca[_0xaf49('0x17')],{'raw':_0x3396ca[_0xaf49('0x18')]?_0x3396ca[_0xaf49('0x18')][_0xaf49('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3396ca[_0xaf49('0x18')]?_0x3396ca[_0xaf49('0x18')][_0xaf49('0x1a')]||null:null,'attributes':_0x3396ca[_0xaf49('0x18')]?_0x3396ca[_0xaf49('0x18')][_0xaf49('0x1b')]||null:null,'limit':_0x3396ca[_0xaf49('0x18')]?_0x3396ca[_0xaf49('0x18')][_0xaf49('0x1c')]||null:null})[_0xaf49('0x1d')](function(_0x4ea2c0){logger[_0xaf49('0xc')](_0xaf49('0x1e'),_0x3396ca);logger[_0xaf49('0x1f')](_0xaf49('0x1e'),_0x3396ca,JSON[_0xaf49('0xf')](_0x4ea2c0));_0x2d3a09(_0x4ea2c0);})['catch'](function(_0x36992b){logger['error'](_0xaf49('0x1e'),_0x36992b[_0xaf49('0x12')],_0x3396ca);_0xc2fd15(_0x2bad59[_0xaf49('0x10')](0x1f4,_0x36992b[_0xaf49('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e1e6520..8bbf601 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 _0xb10b=['./faxApplication.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa161e7,_0x378b84){var _0x1bb7f7=function(_0x4e44a6){while(--_0x4e44a6){_0xa161e7['push'](_0xa161e7['shift']());}};_0x1bb7f7(++_0x378b84);}(_0xb10b,0x12a));var _0xbb10=function(_0x401531,_0x582a70){_0x401531=_0x401531-0x0;var _0x51b83c=_0xb10b[_0x401531];return _0x51b83c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x3c3941,_0x538156){var _0x4be19c=function(_0x390a51){while(--_0x390a51){_0x3c3941['push'](_0x3c3941['shift']());}};_0x4be19c(++_0x538156);}(_0xb7e7,0x121));var _0x7b7e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb7e7[_0xe66cf2];return _0x2d84e7;};'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/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a4ff46a..3be04ce 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 _0xcaf2=['DATE','STRING','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0xeb996f,_0x5e1c36){var _0xe1d530=function(_0x2f9fa8){while(--_0x2f9fa8){_0xeb996f['push'](_0xeb996f['shift']());}};_0xe1d530(++_0x5e1c36);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2565d5,_0xe6c944){_0x2565d5=_0x2565d5-0x0;var _0x1b546c=_0xcaf2[_0x2565d5];return _0x1b546c;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2caf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2caf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2caf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2caf('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2caf('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2caf('0x4')]('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2caf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2caf('0x6')]}}; \ No newline at end of file +var _0x3a6d=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3a6d[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd3a6('0x2')]},'disposition':{'type':Sequelize[_0xd3a6('0x3')]},'secondDisposition':{'type':Sequelize[_0xd3a6('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd3a6('0x3')]},'note':{'type':Sequelize[_0xd3a6('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xd3a6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd3a6('0x4')]('in',_0xd3a6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd3a6('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd3a6('0x4')]('in',_0xd3a6('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 73b0758..3686774 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 _0xdeb7=['format','YYYY-MM-DD\x20HH:mm:ss','merge','options','include','rows','addTags','ids','spread','Tag','color','emit','removeTags','download','join','root','server','files','tmp','push','Attachment','Messages','basename','existsSync','pipe','createWriteStream','log','err','rimraf','zip-dir','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','update','destroy','error','stack','name','send','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','fax','query','user','then','catch','model','keys','filters','attributes','intersection','fields','length','includeAll','create','body','find','params','describe','addMessage','omit','findOne','FaxMessage','hasOwnProperty','order','sort','where','pick','FaxInteractionId','filter','map','split'];(function(_0x15ca31,_0x513294){var _0x1ffa4c=function(_0x3be2c9){while(--_0x3be2c9){_0x15ca31['push'](_0x15ca31['shift']());}};_0x1ffa4c(++_0x513294);}(_0xdeb7,0x133));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var rimraf=require(_0x7deb('0x0'));var zipdir=require(_0x7deb('0x1'));var moment=require('moment');var BPromise=require(_0x7deb('0x2'));var util=require(_0x7deb('0x3'));var path=require(_0x7deb('0x4'));var fs=require('fs');var _=require(_0x7deb('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x7deb('0x6'));var logger=require(_0x7deb('0x7'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7deb('0x8')],{'host':_0x7deb('0x9'),'port':0x18eb});var socket=require(_0x7deb('0xa'))(new Redis(config[_0x7deb('0x8')]));require(_0x7deb('0xb'))[_0x7deb('0xc')](socket);function respondWithStatusCode(_0x2f0528,_0x46d6f0){_0x46d6f0=_0x46d6f0||0xcc;return function(_0x5a8c56){if(_0x5a8c56){return _0x2f0528[_0x7deb('0xd')](_0x46d6f0);}return _0x2f0528[_0x7deb('0xe')](_0x46d6f0)[_0x7deb('0xf')]();};}function respondWithResult(_0x1e4b32,_0xbe7c8a){_0xbe7c8a=_0xbe7c8a||0xc8;return function(_0x54e6dd){if(_0x54e6dd){return _0x1e4b32['status'](_0xbe7c8a)['json'](_0x54e6dd);}};}function respondWithFilteredResult(_0x5ff940,_0x368a41){return function(_0x157226){if(_0x157226){var _0x3c27f0=typeof _0x368a41[_0x7deb('0x10')]===_0x7deb('0x11')&&typeof _0x368a41['limit']===_0x7deb('0x11');var _0x3e305b=_0x157226[_0x7deb('0x12')];var _0x221e21=_0x3c27f0?0x0:_0x368a41['offset'];var _0x282d16=_0x3c27f0?_0x157226[_0x7deb('0x12')]:_0x368a41['offset']+_0x368a41[_0x7deb('0x13')];var _0x1294c4;if(_0x282d16>=_0x3e305b){_0x282d16=_0x3e305b;_0x1294c4=0xc8;}else{_0x1294c4=0xce;}_0x5ff940['status'](_0x1294c4);return _0x5ff940[_0x7deb('0x14')](_0x7deb('0x15'),_0x221e21+'-'+_0x282d16+'/'+_0x3e305b)['json'](_0x157226);}return null;};}function saveUpdates(_0x35dbf9){return function(_0x515a93){if(_0x515a93){return _0x515a93[_0x7deb('0x16')](_0x35dbf9)['then'](function(_0x137952){return _0x137952;});}return null;};}function removeEntity(_0x389d31){return function(_0x4b09ad){if(_0x4b09ad){return _0x4b09ad[_0x7deb('0x17')]()['then'](function(){_0x389d31[_0x7deb('0xe')](0xcc)[_0x7deb('0xf')]();});}};}function handleEntityNotFound(_0x324730){return function(_0x31b7cd){if(!_0x31b7cd){_0x324730[_0x7deb('0xd')](0x194);}return _0x31b7cd;};}function handleError(_0x1249a0,_0x23bcab){_0x23bcab=_0x23bcab||0x1f4;return function(_0x4aa2e8){logger[_0x7deb('0x18')](_0x4aa2e8[_0x7deb('0x19')]);if(_0x4aa2e8[_0x7deb('0x1a')]){delete _0x4aa2e8[_0x7deb('0x1a')];}_0x1249a0[_0x7deb('0xe')](_0x23bcab)[_0x7deb('0x1b')](_0x4aa2e8);};}exports['index']=function(_0x46133a,_0x246798){var _0x4e0e98={};var _0x2b0994=_['map'](db[_0x7deb('0x1c')][_0x7deb('0x1d')],function(_0x2e0edc){return{'name':_0x2e0edc[_0x7deb('0x1e')],'type':_0x2e0edc[_0x7deb('0x1f')]['key']};});_0x4e0e98=qs[_0x7deb('0x20')](_0x2b0994,_0x46133a);return interaction[_0x7deb('0x21')](_0x7deb('0x22'),_0x46133a[_0x7deb('0x23')],_0x46133a[_0x7deb('0x24')],_0x4e0e98,_0x2b0994)[_0x7deb('0x25')](respondWithFilteredResult(_0x246798,_0x4e0e98))[_0x7deb('0x26')](handleError(_0x246798,null));};exports['show']=function(_0x21b63c,_0x218c59){var _0x3636ae={'raw':![],'where':{'id':_0x21b63c['params']['id']}},_0x5a2d59={};_0x5a2d59[_0x7deb('0x27')]=_[_0x7deb('0x28')](db[_0x7deb('0x1c')][_0x7deb('0x1d')]);_0x5a2d59[_0x7deb('0x23')]=_[_0x7deb('0x28')](_0x21b63c['query']);_0x5a2d59[_0x7deb('0x29')]=_['intersection'](_0x5a2d59['model'],_0x5a2d59[_0x7deb('0x23')]);_0x3636ae[_0x7deb('0x2a')]=_[_0x7deb('0x2b')](_0x5a2d59['model'],qs[_0x7deb('0x2c')](_0x21b63c[_0x7deb('0x23')][_0x7deb('0x2c')]));_0x3636ae['attributes']=_0x3636ae[_0x7deb('0x2a')][_0x7deb('0x2d')]?_0x3636ae['attributes']:_0x5a2d59[_0x7deb('0x27')];if(_0x21b63c[_0x7deb('0x23')][_0x7deb('0x2e')]){_0x3636ae['include']=[{'all':!![]}];}_0x3636ae=_['merge']({},_0x3636ae,_0x21b63c['options']);return db[_0x7deb('0x1c')]['find'](_0x3636ae)['then'](handleEntityNotFound(_0x218c59,null))[_0x7deb('0x25')](respondWithResult(_0x218c59,null))[_0x7deb('0x26')](handleError(_0x218c59,null));};exports[_0x7deb('0x2f')]=function(_0x222c76,_0x31a24a){return db[_0x7deb('0x1c')]['create'](_0x222c76[_0x7deb('0x30')],{})[_0x7deb('0x25')](respondWithResult(_0x31a24a,0xc9))['catch'](handleError(_0x31a24a,null));};exports[_0x7deb('0x16')]=function(_0xc31979,_0x2d5380){if(_0xc31979['body']['id']){delete _0xc31979[_0x7deb('0x30')]['id'];}return db[_0x7deb('0x1c')][_0x7deb('0x31')]({'where':{'id':_0xc31979[_0x7deb('0x32')]['id']}})[_0x7deb('0x25')](handleEntityNotFound(_0x2d5380,null))['then'](saveUpdates(_0xc31979[_0x7deb('0x30')],null))[_0x7deb('0x25')](respondWithResult(_0x2d5380,null))[_0x7deb('0x26')](handleError(_0x2d5380,null));};exports[_0x7deb('0x17')]=function(_0x199074,_0x2e2be6){return db['FaxInteraction']['find']({'where':{'id':_0x199074[_0x7deb('0x32')]['id']}})[_0x7deb('0x25')](handleEntityNotFound(_0x2e2be6,null))[_0x7deb('0x25')](removeEntity(_0x2e2be6,null))[_0x7deb('0x26')](handleError(_0x2e2be6,null));};exports[_0x7deb('0x33')]=function(_0x792efd,_0x1a83b2){return db[_0x7deb('0x1c')][_0x7deb('0x33')]()['then'](respondWithResult(_0x1a83b2,null))[_0x7deb('0x26')](handleError(_0x1a83b2,null));};exports[_0x7deb('0x34')]=function(_0x1b6ef8,_0x545b61){return db['FaxMessage'][_0x7deb('0x31')]({'where':{'id':_0x1b6ef8[_0x7deb('0x32')]['id']}})['then'](handleEntityNotFound(_0x545b61,null))[_0x7deb('0x25')](function(_0x38e5b9){if(_0x38e5b9){return _0x38e5b9[_0x7deb('0x34')](_0x1b6ef8[_0x7deb('0x30')]['ids'],_[_0x7deb('0x35')](_0x1b6ef8[_0x7deb('0x30')],['ids','id'])||{});}})[_0x7deb('0x25')](respondWithResult(_0x545b61,null))[_0x7deb('0x26')](handleError(_0x545b61,null));};exports['getMessages']=function(_0x2f7af1,_0x33d4a9){var _0x4377f1={'raw':![],'where':{}};var _0x159930={};var _0x5d3e48={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x7deb('0x36')]({'where':{'id':_0x2f7af1['params']['id']}})[_0x7deb('0x25')](handleEntityNotFound(_0x33d4a9,null))['then'](function(_0x144d7){if(_0x144d7){_0x159930[_0x7deb('0x27')]=_[_0x7deb('0x28')](db[_0x7deb('0x37')]['rawAttributes']);_0x159930[_0x7deb('0x23')]=_[_0x7deb('0x28')](_0x2f7af1[_0x7deb('0x23')]);_0x159930[_0x7deb('0x29')]=_[_0x7deb('0x2b')](_0x159930[_0x7deb('0x27')],_0x159930['query']);_0x4377f1['attributes']=_[_0x7deb('0x2b')](_0x159930['model'],qs[_0x7deb('0x2c')](_0x2f7af1[_0x7deb('0x23')][_0x7deb('0x2c')]));_0x4377f1[_0x7deb('0x2a')]=_0x4377f1[_0x7deb('0x2a')]['length']?_0x4377f1[_0x7deb('0x2a')]:_0x159930[_0x7deb('0x27')];if(!_0x2f7af1['query'][_0x7deb('0x38')]('nolimit')){_0x4377f1[_0x7deb('0x13')]=qs[_0x7deb('0x13')](_0x2f7af1['query'][_0x7deb('0x13')]);_0x4377f1[_0x7deb('0x10')]=qs[_0x7deb('0x10')](_0x2f7af1['query'][_0x7deb('0x10')]);}_0x4377f1[_0x7deb('0x39')]=qs[_0x7deb('0x3a')](_0x2f7af1['query'][_0x7deb('0x3a')]);_0x4377f1[_0x7deb('0x3b')]=qs[_0x7deb('0x29')](_[_0x7deb('0x3c')](_0x2f7af1[_0x7deb('0x23')],_0x159930['filters']));_0x4377f1[_0x7deb('0x3b')][_0x7deb('0x3d')]=_0x144d7['id'];if(_0x2f7af1[_0x7deb('0x23')][_0x7deb('0x3e')]){_0x4377f1[_0x7deb('0x3b')]=_['merge'](_0x4377f1[_0x7deb('0x3b')],{'$or':_[_0x7deb('0x3f')](_0x4377f1['attributes'],function(_0x906a5f){var _0x1ee9e6={};_0x1ee9e6[_0x906a5f]={'$like':'%'+_0x2f7af1[_0x7deb('0x23')]['filter']+'%'};return _0x1ee9e6;})});}if(_0x2f7af1['query']['$gte']){var _0x59074d=_0x2f7af1['query']['$gte'][_0x7deb('0x40')](',');var _0x2ff741={};_0x2ff741[_0x59074d[0x0]]={'$gte':moment(_0x59074d[0x1])[_0x7deb('0x41')](_0x7deb('0x42'))};_0x4377f1['where']=_[_0x7deb('0x43')](_0x4377f1[_0x7deb('0x3b')],_0x2ff741);}_0x4377f1=_[_0x7deb('0x43')]({},_0x4377f1,_0x2f7af1[_0x7deb('0x44')]);return db[_0x7deb('0x37')][_0x7deb('0x12')]({'where':_0x4377f1[_0x7deb('0x3b')]})['then'](function(_0x584625){_0x5d3e48[_0x7deb('0x12')]=_0x584625;if(_0x2f7af1[_0x7deb('0x23')][_0x7deb('0x2e')]){_0x4377f1[_0x7deb('0x45')]=[{'all':!![]}];}return db['FaxMessage'][_0x7deb('0x21')](_0x4377f1);})[_0x7deb('0x25')](function(_0x29bbc7){_0x5d3e48[_0x7deb('0x46')]=_0x29bbc7;return _0x5d3e48;});}})[_0x7deb('0x25')](respondWithFilteredResult(_0x33d4a9,_0x4377f1))[_0x7deb('0x26')](handleError(_0x33d4a9,null));};exports[_0x7deb('0x47')]=function(_0x15005b,_0x321897){return db['FaxInteraction']['find']({'where':{'id':_0x15005b[_0x7deb('0x32')]['id']}})[_0x7deb('0x25')](handleEntityNotFound(_0x321897,null))[_0x7deb('0x25')](function(_0x14bac0){if(_0x14bac0){return _0x14bac0['setTags'](_0x15005b[_0x7deb('0x30')][_0x7deb('0x48')],_['omit'](_0x15005b[_0x7deb('0x30')],[_0x7deb('0x48'),'id'])||{})[_0x7deb('0x49')](function(){return db[_0x7deb('0x4a')][_0x7deb('0x21')]({'attributes':['id','name',_0x7deb('0x4b')],'where':{'id':_0x15005b[_0x7deb('0x30')]['ids']}});})[_0x7deb('0x25')](function(_0xfd11c1){socket[_0x7deb('0x4c')]('faxInteractionTags:save',{'id':Number(_0x15005b['params']['id']),'tags':_0xfd11c1||[]});return{'id':Number(_0x15005b['params']['id']),'tags':_0xfd11c1||[]};});}})[_0x7deb('0x25')](respondWithResult(_0x321897,null))[_0x7deb('0x26')](handleError(_0x321897,null));};exports[_0x7deb('0x4d')]=function(_0x5bf398,_0x27ad33){return db[_0x7deb('0x1c')][_0x7deb('0x31')]({'where':{'id':_0x5bf398[_0x7deb('0x32')]['id']}})[_0x7deb('0x25')](handleEntityNotFound(_0x27ad33,null))[_0x7deb('0x25')](function(_0x1c6420){if(_0x1c6420){return _0x1c6420[_0x7deb('0x4d')](_0x5bf398['query'][_0x7deb('0x48')]);}})['then'](respondWithStatusCode(_0x27ad33,null))[_0x7deb('0x26')](handleError(_0x27ad33,null));};exports[_0x7deb('0x4e')]=function(_0x300905,_0x8cef74){var _0xf7fe06=moment()['unix']()['toString']();var _0x22a562=path[_0x7deb('0x4f')](config[_0x7deb('0x50')],_0x7deb('0x51'),_0x7deb('0x52'),_0x7deb('0x53'));var _0x4e720d=path[_0x7deb('0x4f')](config['root'],_0x7deb('0x51'),_0x7deb('0x52'),'attachments');var _0x3a00b5=path[_0x7deb('0x4f')](_0x22a562,_0xf7fe06);var _0x11d29d=util[_0x7deb('0x41')]('transcript-%d-%s.zip',_0x300905['params']['id'],_0xf7fe06);var _0x120d08=path['join'](_0x22a562,_0x11d29d);var _0x3b799a=[];_0x3b799a[_0x7deb('0x54')]({'model':db[_0x7deb('0x55')],'as':'Attachment','raw':!![]});var _0x310832=[{'model':db[_0x7deb('0x37')],'as':_0x7deb('0x56'),'attributes':['id',_0x7deb('0x30'),'createdAt'],'include':_0x3b799a}];return db[_0x7deb('0x1c')][_0x7deb('0x31')]({'where':{'id':_0x300905['params']['id']},'include':_0x310832})['then'](handleEntityNotFound(_0x8cef74,null))[_0x7deb('0x25')](function(_0x4bdf20){if(_0x4bdf20&&_0x4bdf20[_0x7deb('0x56')]){var _0x4471c7=_0x4bdf20['get']({'plain':!![]});fs['mkdirSync'](_0x3a00b5);for(var _0x397870=0x0;_0x397870<_0x4471c7['Messages'][_0x7deb('0x2d')];_0x397870++){var _0x39bc2c=_0x4471c7['Messages'][_0x397870][_0x7deb('0x55')];if(_0x39bc2c){var _0x295978=path[_0x7deb('0x4f')](_0x4e720d,_0x39bc2c[_0x7deb('0x57')]);if(fs[_0x7deb('0x58')](_0x295978)){fs['createReadStream'](_0x295978)[_0x7deb('0x59')](fs[_0x7deb('0x5a')](path[_0x7deb('0x4f')](_0x3a00b5,_0x39bc2c[_0x7deb('0x57')])));}}}return BPromise['resolve']()[_0x7deb('0x25')](function(){return new BPromise(function(_0x220538,_0x4624e4){zipdir(_0x3a00b5,{'saveTo':_0x120d08},function(_0x497777,_0x2efe03){if(_0x497777)return _0x4624e4(_0x497777);return _0x220538(_0x2efe03);});})[_0x7deb('0x25')](function(){return new BPromise(function(_0x3d82cd,_0x523b01){rimraf(_0x3a00b5,function(_0x502ce1){if(_0x502ce1)_0x523b01(_0x502ce1);return _0x3d82cd();});});})[_0x7deb('0x25')](function(){return _0x8cef74[_0x7deb('0x4e')](_0x120d08,_0x11d29d,function(_0x397e04){if(_0x397e04){console[_0x7deb('0x5b')](_0x7deb('0x5c'),_0x397e04);}else{fs['unlinkSync'](_0x120d08);}});});});}else{return _0x8cef74[_0x7deb('0xd')](0xc8);}})[_0x7deb('0x26')](handleError(_0x8cef74,null));}; \ No newline at end of file +var _0x1349=['existsSync','createReadStream','createWriteStream','resolve','download','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','localhost','./faxInteraction.socket','register','status','json','offset','count','limit','set','then','destroy','sendStatus','stack','name','send','map','fieldName','type','getOptions','user','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','FaxInteraction','find','catch','create','update','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','rows','addTags','color','emit','faxInteractionTags:save','removeTags','toString','join','server','files','attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1349,0x1ec));var _0x9134=function(_0x3153ba,_0x32503c){_0x3153ba=_0x3153ba-0x0;var _0x833197=_0x1349[_0x3153ba];return _0x833197;};'use strict';var rimraf=require(_0x9134('0x0'));var zipdir=require('zip-dir');var moment=require(_0x9134('0x1'));var BPromise=require(_0x9134('0x2'));var util=require(_0x9134('0x3'));var path=require(_0x9134('0x4'));var fs=require('fs');var _=require(_0x9134('0x5'));var Redis=require(_0x9134('0x6'));var interaction=require(_0x9134('0x7'));var qs=require(_0x9134('0x8'));var logger=require(_0x9134('0x9'))(_0x9134('0xa'));var config=require(_0x9134('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x9134('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9134('0xd'))[_0x9134('0xe')](socket);function respondWithStatusCode(_0x4d3dc7,_0x3ec03e){_0x3ec03e=_0x3ec03e||0xcc;return function(_0x401842){if(_0x401842){return _0x4d3dc7['sendStatus'](_0x3ec03e);}return _0x4d3dc7['status'](_0x3ec03e)['end']();};}function respondWithResult(_0x2abcc3,_0x25511c){_0x25511c=_0x25511c||0xc8;return function(_0x144dc6){if(_0x144dc6){return _0x2abcc3[_0x9134('0xf')](_0x25511c)[_0x9134('0x10')](_0x144dc6);}};}function respondWithFilteredResult(_0x4423da,_0x2bc442){return function(_0x9cfcf5){if(_0x9cfcf5){var _0x14ce05=typeof _0x2bc442[_0x9134('0x11')]==='undefined'&&typeof _0x2bc442['limit']==='undefined';var _0x33cd05=_0x9cfcf5['count'];var _0x3a7340=_0x14ce05?0x0:_0x2bc442[_0x9134('0x11')];var _0x4419b8=_0x14ce05?_0x9cfcf5[_0x9134('0x12')]:_0x2bc442[_0x9134('0x11')]+_0x2bc442[_0x9134('0x13')];var _0x1f61a2;if(_0x4419b8>=_0x33cd05){_0x4419b8=_0x33cd05;_0x1f61a2=0xc8;}else{_0x1f61a2=0xce;}_0x4423da[_0x9134('0xf')](_0x1f61a2);return _0x4423da[_0x9134('0x14')]('Content-Range',_0x3a7340+'-'+_0x4419b8+'/'+_0x33cd05)[_0x9134('0x10')](_0x9cfcf5);}return null;};}function saveUpdates(_0x352b0e){return function(_0x1fcbc3){if(_0x1fcbc3){return _0x1fcbc3['update'](_0x352b0e)[_0x9134('0x15')](function(_0x6bf33e){return _0x6bf33e;});}return null;};}function removeEntity(_0x3da6bb){return function(_0x4371b6){if(_0x4371b6){return _0x4371b6[_0x9134('0x16')]()[_0x9134('0x15')](function(){_0x3da6bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dafe4){return function(_0x7c4cd5){if(!_0x7c4cd5){_0x2dafe4[_0x9134('0x17')](0x194);}return _0x7c4cd5;};}function handleError(_0x46e671,_0x4a704d){_0x4a704d=_0x4a704d||0x1f4;return function(_0x40dbaf){logger['error'](_0x40dbaf[_0x9134('0x18')]);if(_0x40dbaf['name']){delete _0x40dbaf[_0x9134('0x19')];}_0x46e671[_0x9134('0xf')](_0x4a704d)[_0x9134('0x1a')](_0x40dbaf);};}exports['index']=function(_0x2e8e54,_0x112c1f){var _0x13b4ef={};var _0x51f2ec=_[_0x9134('0x1b')](db['FaxInteraction']['rawAttributes'],function(_0xb14bf4){return{'name':_0xb14bf4[_0x9134('0x1c')],'type':_0xb14bf4[_0x9134('0x1d')]['key']};});_0x13b4ef=qs[_0x9134('0x1e')](_0x51f2ec,_0x2e8e54);return interaction['findAll']('fax',_0x2e8e54['query'],_0x2e8e54[_0x9134('0x1f')],_0x13b4ef,_0x51f2ec)[_0x9134('0x15')](respondWithFilteredResult(_0x112c1f,_0x13b4ef))['catch'](handleError(_0x112c1f,null));};exports[_0x9134('0x20')]=function(_0x20d3d9,_0x37f6ca){var _0x12ca39={'raw':![],'where':{'id':_0x20d3d9[_0x9134('0x21')]['id']}},_0xcded65={};_0xcded65[_0x9134('0x22')]=_[_0x9134('0x23')](db['FaxInteraction'][_0x9134('0x24')]);_0xcded65[_0x9134('0x25')]=_[_0x9134('0x23')](_0x20d3d9['query']);_0xcded65[_0x9134('0x26')]=_[_0x9134('0x27')](_0xcded65[_0x9134('0x22')],_0xcded65[_0x9134('0x25')]);_0x12ca39[_0x9134('0x28')]=_['intersection'](_0xcded65[_0x9134('0x22')],qs[_0x9134('0x29')](_0x20d3d9[_0x9134('0x25')][_0x9134('0x29')]));_0x12ca39[_0x9134('0x28')]=_0x12ca39[_0x9134('0x28')][_0x9134('0x2a')]?_0x12ca39[_0x9134('0x28')]:_0xcded65[_0x9134('0x22')];if(_0x20d3d9[_0x9134('0x25')]['includeAll']){_0x12ca39[_0x9134('0x2b')]=[{'all':!![]}];}_0x12ca39=_[_0x9134('0x2c')]({},_0x12ca39,_0x20d3d9['options']);return db[_0x9134('0x2d')][_0x9134('0x2e')](_0x12ca39)[_0x9134('0x15')](handleEntityNotFound(_0x37f6ca,null))[_0x9134('0x15')](respondWithResult(_0x37f6ca,null))[_0x9134('0x2f')](handleError(_0x37f6ca,null));};exports[_0x9134('0x30')]=function(_0x59d51d,_0x28d23b){return db[_0x9134('0x2d')][_0x9134('0x30')](_0x59d51d['body'],{})[_0x9134('0x15')](respondWithResult(_0x28d23b,0xc9))['catch'](handleError(_0x28d23b,null));};exports[_0x9134('0x31')]=function(_0x557980,_0x578a5e){if(_0x557980['body']['id']){delete _0x557980[_0x9134('0x32')]['id'];}return db[_0x9134('0x2d')]['find']({'where':{'id':_0x557980[_0x9134('0x21')]['id']}})[_0x9134('0x15')](handleEntityNotFound(_0x578a5e,null))[_0x9134('0x15')](saveUpdates(_0x557980[_0x9134('0x32')],null))[_0x9134('0x15')](respondWithResult(_0x578a5e,null))[_0x9134('0x2f')](handleError(_0x578a5e,null));};exports['destroy']=function(_0x52a485,_0x4fb096){return db[_0x9134('0x2d')][_0x9134('0x2e')]({'where':{'id':_0x52a485[_0x9134('0x21')]['id']}})[_0x9134('0x15')](handleEntityNotFound(_0x4fb096,null))[_0x9134('0x15')](removeEntity(_0x4fb096,null))[_0x9134('0x2f')](handleError(_0x4fb096,null));};exports['describe']=function(_0x205cef,_0x53d609){return db[_0x9134('0x2d')][_0x9134('0x33')]()[_0x9134('0x15')](respondWithResult(_0x53d609,null))[_0x9134('0x2f')](handleError(_0x53d609,null));};exports[_0x9134('0x34')]=function(_0x2d998f,_0x5a36b9){return db[_0x9134('0x35')]['find']({'where':{'id':_0x2d998f['params']['id']}})[_0x9134('0x15')](handleEntityNotFound(_0x5a36b9,null))[_0x9134('0x15')](function(_0x1dc53e){if(_0x1dc53e){return _0x1dc53e['addMessage'](_0x2d998f[_0x9134('0x32')][_0x9134('0x36')],_[_0x9134('0x37')](_0x2d998f[_0x9134('0x32')],[_0x9134('0x36'),'id'])||{});}})[_0x9134('0x15')](respondWithResult(_0x5a36b9,null))[_0x9134('0x2f')](handleError(_0x5a36b9,null));};exports[_0x9134('0x38')]=function(_0x18f295,_0x541cc9){var _0x55c0f1={'raw':![],'where':{}};var _0x4864b4={};var _0x915171={'count':0x0,'rows':[]};return db[_0x9134('0x2d')][_0x9134('0x39')]({'where':{'id':_0x18f295[_0x9134('0x21')]['id']}})[_0x9134('0x15')](handleEntityNotFound(_0x541cc9,null))[_0x9134('0x15')](function(_0x4a1a5c){if(_0x4a1a5c){_0x4864b4[_0x9134('0x22')]=_[_0x9134('0x23')](db[_0x9134('0x35')][_0x9134('0x24')]);_0x4864b4[_0x9134('0x25')]=_[_0x9134('0x23')](_0x18f295[_0x9134('0x25')]);_0x4864b4[_0x9134('0x26')]=_[_0x9134('0x27')](_0x4864b4[_0x9134('0x22')],_0x4864b4['query']);_0x55c0f1[_0x9134('0x28')]=_[_0x9134('0x27')](_0x4864b4['model'],qs[_0x9134('0x29')](_0x18f295[_0x9134('0x25')][_0x9134('0x29')]));_0x55c0f1[_0x9134('0x28')]=_0x55c0f1[_0x9134('0x28')]['length']?_0x55c0f1[_0x9134('0x28')]:_0x4864b4[_0x9134('0x22')];if(!_0x18f295[_0x9134('0x25')][_0x9134('0x3a')](_0x9134('0x3b'))){_0x55c0f1[_0x9134('0x13')]=qs[_0x9134('0x13')](_0x18f295['query']['limit']);_0x55c0f1[_0x9134('0x11')]=qs['offset'](_0x18f295[_0x9134('0x25')][_0x9134('0x11')]);}_0x55c0f1[_0x9134('0x3c')]=qs[_0x9134('0x3d')](_0x18f295[_0x9134('0x25')][_0x9134('0x3d')]);_0x55c0f1[_0x9134('0x3e')]=qs[_0x9134('0x26')](_[_0x9134('0x3f')](_0x18f295[_0x9134('0x25')],_0x4864b4[_0x9134('0x26')]));_0x55c0f1[_0x9134('0x3e')]['FaxInteractionId']=_0x4a1a5c['id'];if(_0x18f295[_0x9134('0x25')][_0x9134('0x40')]){_0x55c0f1[_0x9134('0x3e')]=_[_0x9134('0x2c')](_0x55c0f1['where'],{'$or':_[_0x9134('0x1b')](_0x55c0f1[_0x9134('0x28')],function(_0x1e8c49){var _0x171650={};_0x171650[_0x1e8c49]={'$like':'%'+_0x18f295[_0x9134('0x25')][_0x9134('0x40')]+'%'};return _0x171650;})});}if(_0x18f295['query'][_0x9134('0x41')]){var _0x5b5042=_0x18f295[_0x9134('0x25')]['$gte'][_0x9134('0x42')](',');var _0x26f4a6={};_0x26f4a6[_0x5b5042[0x0]]={'$gte':moment(_0x5b5042[0x1])[_0x9134('0x43')](_0x9134('0x44'))};_0x55c0f1[_0x9134('0x3e')]=_[_0x9134('0x2c')](_0x55c0f1[_0x9134('0x3e')],_0x26f4a6);}_0x55c0f1=_['merge']({},_0x55c0f1,_0x18f295[_0x9134('0x45')]);return db['FaxMessage'][_0x9134('0x12')]({'where':_0x55c0f1['where']})[_0x9134('0x15')](function(_0x5433cb){_0x915171[_0x9134('0x12')]=_0x5433cb;if(_0x18f295[_0x9134('0x25')][_0x9134('0x46')]){_0x55c0f1['include']=[{'all':!![]}];}return db[_0x9134('0x35')][_0x9134('0x47')](_0x55c0f1);})['then'](function(_0x26586e){_0x915171[_0x9134('0x48')]=_0x26586e;return _0x915171;});}})[_0x9134('0x15')](respondWithFilteredResult(_0x541cc9,_0x55c0f1))[_0x9134('0x2f')](handleError(_0x541cc9,null));};exports[_0x9134('0x49')]=function(_0x7f33d5,_0x1c2c11){return db[_0x9134('0x2d')][_0x9134('0x2e')]({'where':{'id':_0x7f33d5[_0x9134('0x21')]['id']}})['then'](handleEntityNotFound(_0x1c2c11,null))[_0x9134('0x15')](function(_0x31684c){if(_0x31684c){return _0x31684c['setTags'](_0x7f33d5['body'][_0x9134('0x36')],_[_0x9134('0x37')](_0x7f33d5['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x9134('0x47')]({'attributes':['id',_0x9134('0x19'),_0x9134('0x4a')],'where':{'id':_0x7f33d5[_0x9134('0x32')][_0x9134('0x36')]}});})['then'](function(_0x1b8306){socket[_0x9134('0x4b')](_0x9134('0x4c'),{'id':Number(_0x7f33d5[_0x9134('0x21')]['id']),'tags':_0x1b8306||[]});return{'id':Number(_0x7f33d5['params']['id']),'tags':_0x1b8306||[]};});}})[_0x9134('0x15')](respondWithResult(_0x1c2c11,null))['catch'](handleError(_0x1c2c11,null));};exports['removeTags']=function(_0x499dfc,_0x4102cf){return db[_0x9134('0x2d')][_0x9134('0x2e')]({'where':{'id':_0x499dfc[_0x9134('0x21')]['id']}})[_0x9134('0x15')](handleEntityNotFound(_0x4102cf,null))[_0x9134('0x15')](function(_0x34b397){if(_0x34b397){return _0x34b397[_0x9134('0x4d')](_0x499dfc[_0x9134('0x25')][_0x9134('0x36')]);}})[_0x9134('0x15')](respondWithStatusCode(_0x4102cf,null))[_0x9134('0x2f')](handleError(_0x4102cf,null));};exports['download']=function(_0x2a4487,_0x192278){var _0x46b7d0=moment()['unix']()[_0x9134('0x4e')]();var _0x2543d3=path[_0x9134('0x4f')](config['root'],_0x9134('0x50'),_0x9134('0x51'),'tmp');var _0x43e883=path[_0x9134('0x4f')](config['root'],_0x9134('0x50'),_0x9134('0x51'),_0x9134('0x52'));var _0x527ac7=path[_0x9134('0x4f')](_0x2543d3,_0x46b7d0);var _0x8876b=util['format']('transcript-%d-%s.zip',_0x2a4487[_0x9134('0x21')]['id'],_0x46b7d0);var _0x32f0fd=path[_0x9134('0x4f')](_0x2543d3,_0x8876b);var _0x3e87c3=[];_0x3e87c3[_0x9134('0x53')]({'model':db[_0x9134('0x54')],'as':_0x9134('0x54'),'raw':!![]});var _0x5ed128=[{'model':db[_0x9134('0x35')],'as':_0x9134('0x55'),'attributes':['id',_0x9134('0x32'),_0x9134('0x56')],'include':_0x3e87c3}];return db[_0x9134('0x2d')][_0x9134('0x2e')]({'where':{'id':_0x2a4487[_0x9134('0x21')]['id']},'include':_0x5ed128})[_0x9134('0x15')](handleEntityNotFound(_0x192278,null))[_0x9134('0x15')](function(_0x506c2d){if(_0x506c2d&&_0x506c2d['Messages']){var _0xd91e74=_0x506c2d[_0x9134('0x57')]({'plain':!![]});fs[_0x9134('0x58')](_0x527ac7);for(var _0x4a2dd5=0x0;_0x4a2dd5<_0xd91e74['Messages']['length'];_0x4a2dd5++){var _0x4b082c=_0xd91e74[_0x9134('0x55')][_0x4a2dd5][_0x9134('0x54')];if(_0x4b082c){var _0x932db1=path['join'](_0x43e883,_0x4b082c[_0x9134('0x59')]);if(fs[_0x9134('0x5a')](_0x932db1)){fs[_0x9134('0x5b')](_0x932db1)['pipe'](fs[_0x9134('0x5c')](path['join'](_0x527ac7,_0x4b082c[_0x9134('0x59')])));}}}return BPromise[_0x9134('0x5d')]()['then'](function(){return new BPromise(function(_0x44c51a,_0x2ced43){zipdir(_0x527ac7,{'saveTo':_0x32f0fd},function(_0x1a7ee3,_0x58dba0){if(_0x1a7ee3)return _0x2ced43(_0x1a7ee3);return _0x44c51a(_0x58dba0);});})[_0x9134('0x15')](function(){return new BPromise(function(_0x2ea561,_0x5ad839){rimraf(_0x527ac7,function(_0x47885a){if(_0x47885a)_0x5ad839(_0x47885a);return _0x2ea561();});});})['then'](function(){return _0x192278[_0x9134('0x5e')](_0x32f0fd,_0x8876b,function(_0x3c83ca){if(_0x3c83ca){console['log'](_0x9134('0x5f'),_0x3c83ca);}else{fs[_0x9134('0x60')](_0x32f0fd);}});});});}else{return _0x192278[_0x9134('0x17')](0xc8);}})['catch'](handleError(_0x192278,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 8758159..469c945 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 _0x7182=['update','remove','setDataValue','Users','findAll','emit','hasOwnProperty','hook','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0xe3025,_0x686182){var _0x592d0b=function(_0x4d249f){while(--_0x4d249f){_0xe3025['push'](_0xe3025['shift']());}};_0x592d0b(++_0x686182);}(_0x7182,0xe4));var _0x2718=function(_0x20468b,_0x3836a3){_0x20468b=_0x20468b-0x0;var _0x4e3473=_0x7182[_0x20468b];return _0x4e3473;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x2718('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x2718('0x0'))['db'][_0x2718('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2718('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2718('0x3'),'afterDestroy':_0x2718('0x4')};function emitEvent(_0x2e52c7){return function(_0x1923bc,_0x27e459,_0xd7a732){_0x1923bc['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x37ee55){_0x1923bc[_0x2718('0x5')](_0x2718('0x6'),_0x37ee55['map'](function(_0x3657a6){return{'id':_0x3657a6['id']};}));return FaxMessage[_0x2718('0x7')]({'where':{'FaxInteractionId':_0x1923bc['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4f99f6){_0x1923bc[_0x2718('0x5')]('unreadMessages',_0x4f99f6['length']);FaxInteractionEvents[_0x2718('0x8')](_0x2e52c7+':'+_0x1923bc['id'],_0x1923bc);FaxInteractionEvents[_0x2718('0x8')](_0x2e52c7,_0x1923bc);_0xd7a732(null);})['catch'](_0xd7a732(null));};}for(var e in events){if(events[_0x2718('0x9')](e)){var event=events[e];FaxInteraction[_0x2718('0xa')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xcf6f=['emit','hook','exports','events','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','findAll','unreadMessages','length'];(function(_0x267336,_0x21609d){var _0x45a6fe=function(_0x5f4cbb){while(--_0x5f4cbb){_0x267336['push'](_0x267336['shift']());}};_0x45a6fe(++_0x21609d);}(_0xcf6f,0x120));var _0xfcf6=function(_0x272ab8,_0x54087f){_0x272ab8=_0x272ab8-0x0;var _0x3b6230=_0xcf6f[_0x272ab8];return _0x3b6230;};'use strict';var EventEmitter=require(_0xfcf6('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xfcf6('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0xfcf6('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xfcf6('0x3')](0x0);var events={'afterCreate':_0xfcf6('0x4'),'afterUpdate':_0xfcf6('0x5'),'afterDestroy':_0xfcf6('0x6')};function emitEvent(_0x35ee79){return function(_0x4e2c45,_0x301933,_0x1c8c7e){_0x4e2c45[_0xfcf6('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x50f7c3){_0x4e2c45[_0xfcf6('0x8')]('Users',_0x50f7c3['map'](function(_0x5ae583){return{'id':_0x5ae583['id']};}));return FaxMessage[_0xfcf6('0x9')]({'where':{'FaxInteractionId':_0x4e2c45['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xe03edd){_0x4e2c45[_0xfcf6('0x8')](_0xfcf6('0xa'),_0xe03edd[_0xfcf6('0xb')]);FaxInteractionEvents[_0xfcf6('0xc')](_0x35ee79+':'+_0x4e2c45['id'],_0x4e2c45);FaxInteractionEvents[_0xfcf6('0xc')](_0x35ee79,_0x4e2c45);_0x1c8c7e(null);})['catch'](_0x1c8c7e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xfcf6('0xd')](e,emitEvent(event));}}module[_0xfcf6('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 22dfed7..e977f38 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 _0x510c=['bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closedAt','format','lodash','util','../../config/logger','api','moment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x510c,0xcd));var _0xc510=function(_0x3d3593,_0x1f23df){_0x3d3593=_0x3d3593-0x0;var _0x4b4b80=_0x510c[_0x3d3593];return _0x4b4b80;};'use strict';var _=require(_0xc510('0x0'));var util=require(_0xc510('0x1'));var logger=require(_0xc510('0x2'))(_0xc510('0x3'));var moment=require(_0xc510('0x4'));var BPromise=require(_0xc510('0x5'));var rp=require(_0xc510('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc510('0x7'));var config=require(_0xc510('0x8'));var attributes=require(_0xc510('0x9'));module[_0xc510('0xa')]=function(_0x5593ee,_0x234368){return _0x5593ee[_0xc510('0xb')](_0xc510('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa9f149,_0x2f668d,_0x1fe2f2){if(_0xa9f149['changed']('closed')){_0xa9f149[_0xc510('0xd')]=moment()[_0xc510('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fe2f2(null,_0xa9f149);}}});}; \ No newline at end of file +var _0xd0bf=['FaxInteraction','fax_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x50fa54,_0x23de7d){var _0x20c00b=function(_0x38fe1b){while(--_0x38fe1b){_0x50fa54['push'](_0x50fa54['shift']());}};_0x20c00b(++_0x23de7d);}(_0xd0bf,0xd5));var _0xfd0b=function(_0x39ca6c,_0x201dfd){_0x39ca6c=_0x39ca6c-0x0;var _0x54717f=_0xd0bf[_0x39ca6c];return _0x54717f;};'use strict';var _=require(_0xfd0b('0x0'));var util=require(_0xfd0b('0x1'));var logger=require(_0xfd0b('0x2'))(_0xfd0b('0x3'));var moment=require(_0xfd0b('0x4'));var BPromise=require(_0xfd0b('0x5'));var rp=require(_0xfd0b('0x6'));var fs=require('fs');var path=require(_0xfd0b('0x7'));var rimraf=require('rimraf');var config=require(_0xfd0b('0x8'));var attributes=require('./faxInteraction.attributes');module[_0xfd0b('0x9')]=function(_0x4e7c49,_0x596ce4){return _0x4e7c49[_0xfd0b('0xa')](_0xfd0b('0xb'),attributes,{'tableName':_0xfd0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c5ea0,_0x54d28a,_0x5cf53c){if(_0x3c5ea0['changed']('closed')){_0x3c5ea0[_0xfd0b('0xd')]=moment()[_0xfd0b('0xe')](_0xfd0b('0xf'));}_0x5cf53c(null,_0x3c5ea0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3a447b0..5f31b47 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 _0xed40=['debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x43ee4d,_0x15e0c3){var _0x3967bb=function(_0x3debbf){while(--_0x3debbf){_0x43ee4d['push'](_0x43ee4d['shift']());}};_0x3967bb(++_0x15e0c3);}(_0xed40,0xe6));var _0x0ed4=function(_0x128813,_0x289376){_0x128813=_0x128813-0x0;var _0x5e06ac=_0xed40[_0x128813];return _0x5e06ac;};'use strict';var _=require(_0x0ed4('0x0'));var util=require(_0x0ed4('0x1'));var moment=require(_0x0ed4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ed4('0x3'));var db=require(_0x0ed4('0x4'))['db'];var utils=require(_0x0ed4('0x5'));var logger=require(_0x0ed4('0x6'))(_0x0ed4('0x7'));var config=require(_0x0ed4('0x8'));var jayson=require(_0x0ed4('0x9'));var client=jayson[_0x0ed4('0xa')]['http']({'port':0x232a});config['redis']=_[_0x0ed4('0xb')](config[_0x0ed4('0xc')],{'host':_0x0ed4('0xd'),'port':0x18eb});var socket=require(_0x0ed4('0xe'))(new Redis(config[_0x0ed4('0xc')]));require(_0x0ed4('0xf'))[_0x0ed4('0x10')](socket);function respondWithRpcPromise(_0x3aba82,_0x1f2dc5,_0x145484){return new BPromise(function(_0x1910d5,_0x194641){return client[_0x0ed4('0x11')](_0x3aba82,_0x145484)[_0x0ed4('0x12')](function(_0x3f0d22){logger[_0x0ed4('0x13')](_0x0ed4('0x14'),_0x1f2dc5,_0x0ed4('0x15'));logger[_0x0ed4('0x16')](_0x0ed4('0x17'),_0x1f2dc5,_0x0ed4('0x15'),JSON[_0x0ed4('0x18')](_0x3f0d22));if(_0x3f0d22[_0x0ed4('0x19')]){if(_0x3f0d22[_0x0ed4('0x19')]['code']===0x1f4){logger[_0x0ed4('0x19')](_0x0ed4('0x14'),_0x1f2dc5,_0x3f0d22['error'][_0x0ed4('0x1a')]);return _0x194641(_0x3f0d22[_0x0ed4('0x19')]['message']);}logger[_0x0ed4('0x19')](_0x0ed4('0x14'),_0x1f2dc5,_0x3f0d22[_0x0ed4('0x19')]['message']);return _0x1910d5(_0x3f0d22[_0x0ed4('0x19')][_0x0ed4('0x1a')]);}else{logger[_0x0ed4('0x13')](_0x0ed4('0x14'),_0x1f2dc5,_0x0ed4('0x15'));_0x1910d5(_0x3f0d22['result'][_0x0ed4('0x1a')]);}})[_0x0ed4('0x1b')](function(_0x13ca33){logger['error'](_0x0ed4('0x14'),_0x1f2dc5,_0x13ca33);_0x194641(_0x13ca33);});});}exports[_0x0ed4('0x1c')]=function(_0x3e6598){var _0x1543b4=this;return new Promise(function(_0x4d1598,_0x41b860){return db[_0x0ed4('0x1d')]['update'](_0x3e6598[_0x0ed4('0x1e')],{'raw':_0x3e6598[_0x0ed4('0x1f')]?_0x3e6598['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e6598[_0x0ed4('0x1f')]?_0x3e6598[_0x0ed4('0x1f')]['where']||null:null,'attributes':_0x3e6598[_0x0ed4('0x1f')]?_0x3e6598['options'][_0x0ed4('0x20')]||null:null,'limit':_0x3e6598['options']?_0x3e6598['options'][_0x0ed4('0x21')]||null:null})[_0x0ed4('0x12')](function(_0x4b6fd6){logger[_0x0ed4('0x13')](_0x0ed4('0x1c'),_0x3e6598);logger[_0x0ed4('0x16')](_0x0ed4('0x1c'),_0x3e6598,JSON['stringify'](_0x4b6fd6));_0x4d1598(_0x4b6fd6);})[_0x0ed4('0x1b')](function(_0x2e29f3){logger[_0x0ed4('0x19')](_0x0ed4('0x1c'),_0x2e29f3[_0x0ed4('0x1a')],_0x3e6598);_0x41b860(_0x1543b4[_0x0ed4('0x19')](0x1f4,_0x2e29f3['message']));});});};exports[_0x0ed4('0x22')]=function(_0x1e6ba6){return new Promise(function(_0x2a7670,_0x171edc){return db[_0x0ed4('0x1d')][_0x0ed4('0x23')]({'where':_0x1e6ba6[_0x0ed4('0x1f')]?_0x1e6ba6['options'][_0x0ed4('0x24')]||null:null})[_0x0ed4('0x12')](function(_0x479220){if(_0x479220){return _0x479220[_0x0ed4('0x25')](_0x1e6ba6[_0x0ed4('0x1e')][_0x0ed4('0x26')],_[_0x0ed4('0x27')](_0x1e6ba6[_0x0ed4('0x1e')],[_0x0ed4('0x26'),'id'])||{});}})[_0x0ed4('0x28')](function(_0x38751a){logger[_0x0ed4('0x13')]('AddTags',_0x1e6ba6);logger[_0x0ed4('0x16')](_0x0ed4('0x29'),_0x1e6ba6,JSON[_0x0ed4('0x18')](_0x38751a));_0x2a7670(_0x38751a);})[_0x0ed4('0x1b')](function(_0x7d6a6b){logger[_0x0ed4('0x19')]('AddTags',_0x7d6a6b['message'],_0x1e6ba6);_0x171edc(_this['error'](0x1f4,_0x7d6a6b[_0x0ed4('0x1a')]));});});}; \ No newline at end of file +var _0xabe4=['bluebird','randomstring','ioredis','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','then','stringify','catch','find','where','ids','omit','spread','AddTags','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xabe4,0x109));var _0x4abe=function(_0x35e083,_0x2a67b7){_0x35e083=_0x35e083-0x0;var _0x4c1d88=_0xabe4[_0x35e083];return _0x4c1d88;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4abe('0x0'));var BPromise=require(_0x4abe('0x1'));var rs=require(_0x4abe('0x2'));var fs=require('fs');var Redis=require(_0x4abe('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4abe('0x4'));var client=jayson[_0x4abe('0x5')][_0x4abe('0x6')]({'port':0x232a});config[_0x4abe('0x7')]=_['defaults'](config[_0x4abe('0x7')],{'host':_0x4abe('0x8'),'port':0x18eb});var socket=require(_0x4abe('0x9'))(new Redis(config['redis']));require(_0x4abe('0xa'))[_0x4abe('0xb')](socket);function respondWithRpcPromise(_0x2b615d,_0x3f6bfa,_0x25e861){return new BPromise(function(_0x15cca7,_0x2c7327){return client[_0x4abe('0xc')](_0x2b615d,_0x25e861)['then'](function(_0x5d6ab9){logger['info'](_0x4abe('0xd'),_0x3f6bfa,_0x4abe('0xe'));logger[_0x4abe('0xf')](_0x4abe('0x10'),_0x3f6bfa,_0x4abe('0xe'),JSON['stringify'](_0x5d6ab9));if(_0x5d6ab9[_0x4abe('0x11')]){if(_0x5d6ab9[_0x4abe('0x11')]['code']===0x1f4){logger[_0x4abe('0x11')](_0x4abe('0xd'),_0x3f6bfa,_0x5d6ab9[_0x4abe('0x11')]['message']);return _0x2c7327(_0x5d6ab9[_0x4abe('0x11')]['message']);}logger[_0x4abe('0x11')](_0x4abe('0xd'),_0x3f6bfa,_0x5d6ab9[_0x4abe('0x11')][_0x4abe('0x12')]);return _0x15cca7(_0x5d6ab9['error'][_0x4abe('0x12')]);}else{logger[_0x4abe('0x13')](_0x4abe('0xd'),_0x3f6bfa,_0x4abe('0xe'));_0x15cca7(_0x5d6ab9[_0x4abe('0x14')][_0x4abe('0x12')]);}})['catch'](function(_0x5f0352){logger[_0x4abe('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x3f6bfa,_0x5f0352);_0x2c7327(_0x5f0352);});});}exports[_0x4abe('0x15')]=function(_0x3bb9e0){var _0x444c3b=this;return new Promise(function(_0x373f29,_0x4200e8){return db[_0x4abe('0x16')][_0x4abe('0x17')](_0x3bb9e0[_0x4abe('0x18')],{'raw':_0x3bb9e0[_0x4abe('0x19')]?_0x3bb9e0[_0x4abe('0x19')][_0x4abe('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb9e0[_0x4abe('0x19')]?_0x3bb9e0[_0x4abe('0x19')]['where']||null:null,'attributes':_0x3bb9e0[_0x4abe('0x19')]?_0x3bb9e0['options'][_0x4abe('0x1b')]||null:null,'limit':_0x3bb9e0[_0x4abe('0x19')]?_0x3bb9e0[_0x4abe('0x19')][_0x4abe('0x1c')]||null:null})[_0x4abe('0x1d')](function(_0x43a515){logger[_0x4abe('0x13')](_0x4abe('0x15'),_0x3bb9e0);logger[_0x4abe('0xf')](_0x4abe('0x15'),_0x3bb9e0,JSON[_0x4abe('0x1e')](_0x43a515));_0x373f29(_0x43a515);})[_0x4abe('0x1f')](function(_0xa15f28){logger[_0x4abe('0x11')](_0x4abe('0x15'),_0xa15f28[_0x4abe('0x12')],_0x3bb9e0);_0x4200e8(_0x444c3b[_0x4abe('0x11')](0x1f4,_0xa15f28[_0x4abe('0x12')]));});});};exports['AddTagsToFaxInteraction']=function(_0x538036){return new Promise(function(_0x36c52c,_0x281ab6){return db[_0x4abe('0x16')][_0x4abe('0x20')]({'where':_0x538036[_0x4abe('0x19')]?_0x538036['options'][_0x4abe('0x21')]||null:null})[_0x4abe('0x1d')](function(_0x3c0875){if(_0x3c0875){return _0x3c0875['addTags'](_0x538036[_0x4abe('0x18')][_0x4abe('0x22')],_[_0x4abe('0x23')](_0x538036[_0x4abe('0x18')],['ids','id'])||{});}})[_0x4abe('0x24')](function(_0x4ed6e5){logger[_0x4abe('0x13')](_0x4abe('0x25'),_0x538036);logger[_0x4abe('0xf')](_0x4abe('0x25'),_0x538036,JSON[_0x4abe('0x1e')](_0x4ed6e5));_0x36c52c(_0x4ed6e5);})[_0x4abe('0x1f')](function(_0x58cef1){logger[_0x4abe('0x11')](_0x4abe('0x25'),_0x58cef1['message'],_0x538036);_0x281ab6(_this['error'](0x1f4,_0x58cef1[_0x4abe('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 876dae0..57c24c9 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 _0x8bf0=['length','faxInteraction:','remove','update','emit','removeListener','register'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0x8bf0,0x18a));var _0x08bf=function(_0x2a8d6a,_0x2fc1e4){_0x2a8d6a=_0x2a8d6a-0x0;var _0x2c808e=_0x8bf0[_0x2a8d6a];return _0x2c808e;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x08bf('0x0'),_0x08bf('0x1')];function createListener(_0x5a6c08,_0x143af6){return function(_0xc05a1b){_0x143af6[_0x08bf('0x2')](_0x5a6c08,_0xc05a1b);};}function removeListener(_0x1556e2,_0x40c703){return function(){FaxInteractionEvents[_0x08bf('0x3')](_0x1556e2,_0x40c703);};}exports[_0x08bf('0x4')]=function(_0x350af0){for(var _0x3aa315=0x0,_0x38b1c4=events[_0x08bf('0x5')];_0x3aa315<_0x38b1c4;_0x3aa315++){var _0x16bae3=events[_0x3aa315];var _0x204a39=createListener(_0x08bf('0x6')+_0x16bae3,_0x350af0);FaxInteractionEvents['on'](_0x16bae3,_0x204a39);}}; \ No newline at end of file +var _0xc2ad=['faxInteraction:','./faxInteraction.events','remove','update','emit','register','length'];(function(_0xec2ea3,_0x4195ac){var _0x1e5e33=function(_0x1da84b){while(--_0x1da84b){_0xec2ea3['push'](_0xec2ea3['shift']());}};_0x1e5e33(++_0x4195ac);}(_0xc2ad,0xb7));var _0xdc2a=function(_0x5d856a,_0xdaa50f){_0x5d856a=_0x5d856a-0x0;var _0x496d8d=_0xc2ad[_0x5d856a];return _0x496d8d;};'use strict';var FaxInteractionEvents=require(_0xdc2a('0x0'));var events=['save',_0xdc2a('0x1'),_0xdc2a('0x2')];function createListener(_0x1f3c3a,_0x325244){return function(_0x289c69){_0x325244[_0xdc2a('0x3')](_0x1f3c3a,_0x289c69);};}function removeListener(_0x2c4681,_0x56e863){return function(){FaxInteractionEvents['removeListener'](_0x2c4681,_0x56e863);};}exports[_0xdc2a('0x4')]=function(_0x9280e){for(var _0x12651e=0x0,_0x277f75=events[_0xdc2a('0x5')];_0x12651e<_0x277f75;_0x12651e++){var _0x29b4cd=events[_0x12651e];var _0x15ba8d=createListener(_0xdc2a('0x6')+_0x29b4cd,_0x9280e);FaxInteractionEvents['on'](_0x29b4cd,_0x15ba8d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3636d45..a7866b7 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 _0xbafa=['/:id','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete'];(function(_0x91bf8d,_0x2bea0b){var _0x1bf297=function(_0x4a4422){while(--_0x4a4422){_0x91bf8d['push'](_0x91bf8d['shift']());}};_0x1bf297(++_0x2bea0b);}(_0xbafa,0x81));var _0xabaf=function(_0xabb85e,_0x20e21e){_0xabb85e=_0xabb85e-0x0;var _0x4d33b6=_0xbafa[_0xabb85e];return _0x4d33b6;};'use strict';var multer=require(_0xabaf('0x0'));var util=require(_0xabaf('0x1'));var path=require(_0xabaf('0x2'));var timeout=require(_0xabaf('0x3'));var express=require(_0xabaf('0x4'));var router=express[_0xabaf('0x5')]();var fs_extra=require(_0xabaf('0x6'));var auth=require(_0xabaf('0x7'));var interaction=require(_0xabaf('0x8'));var config=require(_0xabaf('0x9'));var controller=require('./faxInteraction.controller');router[_0xabaf('0xa')]('/',auth[_0xabaf('0xb')](),controller[_0xabaf('0xc')]);router[_0xabaf('0xa')]('/describe',auth[_0xabaf('0xb')](),controller[_0xabaf('0xd')]);router[_0xabaf('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xabaf('0xe')]);router[_0xabaf('0xa')](_0xabaf('0xf'),auth[_0xabaf('0xb')](),controller['getMessages']);router[_0xabaf('0xa')]('/:id/download',auth[_0xabaf('0xb')](),controller['download']);router[_0xabaf('0x10')]('/',auth[_0xabaf('0xb')](),controller[_0xabaf('0x11')]);router[_0xabaf('0x10')](_0xabaf('0xf'),auth[_0xabaf('0xb')](),controller['addMessage']);router[_0xabaf('0x10')](_0xabaf('0x12'),auth['isAuthenticated'](),interaction[_0xabaf('0x13')](_0xabaf('0x14'),_0xabaf('0x15')),controller['addTags']);router[_0xabaf('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0xabaf('0x13')](_0xabaf('0x14'),_0xabaf('0x17')),controller[_0xabaf('0x18')]);router[_0xabaf('0x19')](_0xabaf('0x1a'),auth[_0xabaf('0xb')](),interaction['tracked'](_0xabaf('0x14'),_0xabaf('0x1b')),controller[_0xabaf('0x1c')]);router[_0xabaf('0x19')](_0xabaf('0x12'),auth[_0xabaf('0xb')](),controller[_0xabaf('0x1d')]);module[_0xabaf('0x1e')]=router; \ No newline at end of file +var _0x3331=['destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','download','post','create','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy'];(function(_0x11af27,_0xc4e121){var _0x587d8a=function(_0x6e28e2){while(--_0x6e28e2){_0x11af27['push'](_0x11af27['shift']());}};_0x587d8a(++_0xc4e121);}(_0x3331,0xa4));var _0x1333=function(_0x4ca0fb,_0x1d7284){_0x4ca0fb=_0x4ca0fb-0x0;var _0x193fc5=_0x3331[_0x4ca0fb];return _0x193fc5;};'use strict';var multer=require(_0x1333('0x0'));var util=require(_0x1333('0x1'));var path=require(_0x1333('0x2'));var timeout=require(_0x1333('0x3'));var express=require('express');var router=express[_0x1333('0x4')]();var fs_extra=require(_0x1333('0x5'));var auth=require(_0x1333('0x6'));var interaction=require(_0x1333('0x7'));var config=require('../../config/environment');var controller=require(_0x1333('0x8'));router['get']('/',auth[_0x1333('0x9')](),controller[_0x1333('0xa')]);router[_0x1333('0xb')](_0x1333('0xc'),auth[_0x1333('0x9')](),controller[_0x1333('0xd')]);router[_0x1333('0xb')](_0x1333('0xe'),auth[_0x1333('0x9')](),controller[_0x1333('0xf')]);router['get'](_0x1333('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x1333('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x1333('0x11')]);router[_0x1333('0x12')]('/',auth['isAuthenticated'](),controller[_0x1333('0x13')]);router[_0x1333('0x12')](_0x1333('0x10'),auth[_0x1333('0x9')](),controller['addMessage']);router[_0x1333('0x12')]('/:id/tags',auth[_0x1333('0x9')](),interaction[_0x1333('0x14')](_0x1333('0x15'),_0x1333('0x16')),controller[_0x1333('0x17')]);router['put'](_0x1333('0xe'),auth[_0x1333('0x9')](),interaction[_0x1333('0x14')]('fax',_0x1333('0x18')),controller[_0x1333('0x19')]);router[_0x1333('0x1a')](_0x1333('0xe'),auth[_0x1333('0x9')](),interaction[_0x1333('0x14')](_0x1333('0x15'),_0x1333('0x1b')),controller[_0x1333('0x1c')]);router[_0x1333('0x1a')](_0x1333('0x1d'),auth[_0x1333('0x9')](),controller[_0x1333('0x1e')]);module[_0x1333('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 376aa55..a81ca79 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 _0x9bde=['out','TEXT','DATE','exports','medium','ENUM'];(function(_0xca0fda,_0x38ac00){var _0x1d9826=function(_0x22f3bf){while(--_0x22f3bf){_0xca0fda['push'](_0xca0fda['shift']());}};_0x1d9826(++_0x38ac00);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2c8431,_0x176237){_0x2c8431=_0x2c8431-0x0;var _0xcc2fb5=_0x9bde[_0x2c8431];return _0xcc2fb5;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'body':{'type':Sequelize['TEXT'](_0xe9bd('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe9bd('0x2')]('in',_0xe9bd('0x3')),'defaultValue':_0xe9bd('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe9bd('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe9bd('0x5')]}}; \ No newline at end of file +var _0x1ef3=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x3ab14c,_0x4093a1){var _0x423753=function(_0x278031){while(--_0x278031){_0x3ab14c['push'](_0x3ab14c['shift']());}};_0x423753(++_0x4093a1);}(_0x1ef3,0x69));var _0x31ef=function(_0x6763bd,_0x2dea07){_0x6763bd=_0x6763bd-0x0;var _0x12c7ef=_0x1ef3[_0x6763bd];return _0x12c7ef;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'body':{'type':Sequelize['TEXT'](_0x31ef('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x31ef('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x31ef('0x4')]('in','out'),'defaultValue':_0x31ef('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x31ef('0x6')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index be04df7..48e1866 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 _0x59d4=['options','findAll','rows','params','include','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','isNil','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','defaults','redis','localhost','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','map','merge'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x59d4,0x1ed));var _0x459d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x59d4[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x459d('0x0'));var rimraf=require(_0x459d('0x1'));var zipdir=require(_0x459d('0x2'));var jsonpatch=require(_0x459d('0x3'));var rp=require(_0x459d('0x4'));var moment=require(_0x459d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x459d('0x6'));var util=require(_0x459d('0x7'));var path=require(_0x459d('0x8'));var sox=require(_0x459d('0x9'));var csv=require(_0x459d('0xa'));var ejs=require(_0x459d('0xb'));var fs=require('fs');var fs_extra=require(_0x459d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x459d('0xd'));var jsforce=require(_0x459d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x459d('0xa'));var querystring=require(_0x459d('0xf'));var Papa=require(_0x459d('0x10'));var Redis=require(_0x459d('0x11'));var authService=require(_0x459d('0x12'));var qs=require(_0x459d('0x13'));var as=require(_0x459d('0x14'));var hardwareService=require(_0x459d('0x15'));var logger=require(_0x459d('0x16'))(_0x459d('0x17'));var utils=require(_0x459d('0x18'));var config=require(_0x459d('0x19'));var licenseUtil=require(_0x459d('0x1a'));var db=require(_0x459d('0x1b'))['db'];config['redis']=_[_0x459d('0x1c')](config[_0x459d('0x1d')],{'host':_0x459d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x459d('0x1d')]));require(_0x459d('0x1f'))[_0x459d('0x20')](socket);var jayson=require(_0x459d('0x21'));var client=jayson['client'][_0x459d('0x22')]({'port':0x232c});var client9002=jayson[_0x459d('0x23')][_0x459d('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x38bc16,_0x5667c9,_0x5a85f7,_0x2b6849){return new BPromise(function(_0x46e3d3,_0x12e297){var _0x257c7c=_0x2b6849||client;return _0x257c7c[_0x459d('0x24')](_0x38bc16,_0x5a85f7)[_0x459d('0x25')](function(_0x19e9a5){logger[_0x459d('0x26')](_0x459d('0x27'),_0x5667c9,_0x459d('0x28'));logger[_0x459d('0x29')](_0x459d('0x2a'),_0x5667c9,_0x459d('0x28'),JSON[_0x459d('0x2b')](_0x19e9a5));if(_0x19e9a5['error']){if(_0x19e9a5[_0x459d('0x2c')][_0x459d('0x2d')]===0x1f4){logger[_0x459d('0x2c')](_0x459d('0x27'),_0x5667c9,_0x19e9a5[_0x459d('0x2c')][_0x459d('0x2e')]);return _0x12e297(_0x19e9a5['error']['message']);}logger[_0x459d('0x2c')](_0x459d('0x27'),_0x5667c9,_0x19e9a5[_0x459d('0x2c')][_0x459d('0x2e')]);return _0x46e3d3(_0x19e9a5[_0x459d('0x2c')]['message']);}else{logger['info'](_0x459d('0x27'),_0x5667c9,_0x459d('0x28'));_0x46e3d3(_0x19e9a5[_0x459d('0x2f')][_0x459d('0x2e')]);}})[_0x459d('0x30')](function(_0x54a3eb){logger[_0x459d('0x2c')](_0x459d('0x27'),_0x5667c9,_0x54a3eb);_0x12e297(_0x54a3eb);});});}function respondWithStatusCode(_0x22125a,_0x12350e){_0x12350e=_0x12350e||0xcc;return function(_0x42a90a){if(_0x42a90a){return _0x22125a[_0x459d('0x31')](_0x12350e);}return _0x22125a[_0x459d('0x32')](_0x12350e)[_0x459d('0x33')]();};}function respondWithResult(_0x14198d,_0xec11b0){_0xec11b0=_0xec11b0||0xc8;return function(_0x5ad7a9){if(_0x5ad7a9){return _0x14198d[_0x459d('0x32')](_0xec11b0)[_0x459d('0x34')](_0x5ad7a9);}};}function respondWithFilteredResult(_0x775b10,_0x1408c6){return function(_0x175dbc){if(_0x175dbc){var _0xd29d24=typeof _0x1408c6[_0x459d('0x35')]===_0x459d('0x36')&&typeof _0x1408c6[_0x459d('0x37')]===_0x459d('0x36');var _0x5ef49b=_0x175dbc[_0x459d('0x38')];var _0x433253=_0xd29d24?0x0:_0x1408c6[_0x459d('0x35')];var _0x43a37f=_0xd29d24?_0x175dbc[_0x459d('0x38')]:_0x1408c6['offset']+_0x1408c6[_0x459d('0x37')];var _0xefd633;if(_0x43a37f>=_0x5ef49b){_0x43a37f=_0x5ef49b;_0xefd633=0xc8;}else{_0xefd633=0xce;}_0x775b10['status'](_0xefd633);return _0x775b10[_0x459d('0x39')](_0x459d('0x3a'),_0x433253+'-'+_0x43a37f+'/'+_0x5ef49b)['json'](_0x175dbc);}return null;};}function patchUpdates(_0x4e00d5){return function(_0x7b07bc){try{jsonpatch[_0x459d('0x3b')](_0x7b07bc,_0x4e00d5,!![]);}catch(_0x493432){return BPromise[_0x459d('0x3c')](_0x493432);}return _0x7b07bc[_0x459d('0x3d')]();};}function saveUpdates(_0x22a862,_0x372648){return function(_0x32e2cf){if(_0x32e2cf){return _0x32e2cf[_0x459d('0x3e')](_0x22a862)[_0x459d('0x25')](function(_0x52443b){return _0x52443b;});}return null;};}function removeEntity(_0x1bb709,_0x3d2f65){return function(_0x44139b){if(_0x44139b){return _0x44139b[_0x459d('0x3f')]()[_0x459d('0x25')](function(){_0x1bb709[_0x459d('0x32')](0xcc)[_0x459d('0x33')]();});}};}function handleEntityNotFound(_0x26a877,_0xd8a83e){return function(_0x1057c2){if(!_0x1057c2){_0x26a877[_0x459d('0x31')](0x194);}return _0x1057c2;};}function handleError(_0x25c09b,_0x19f7c9){_0x19f7c9=_0x19f7c9||0x1f4;return function(_0x37896d){logger['error'](_0x37896d[_0x459d('0x40')]);if(_0x37896d[_0x459d('0x41')]){delete _0x37896d['name'];}_0x25c09b['status'](_0x19f7c9)[_0x459d('0x42')](_0x37896d);};}exports[_0x459d('0x43')]=function(_0x13b0fd,_0x498d79){var _0x3b40ec={},_0x3e445a={},_0x55b412={'count':0x0,'rows':[]};var _0x2bed7f=_['map'](db[_0x459d('0x44')]['rawAttributes'],function(_0x5d7e21){return{'name':_0x5d7e21['fieldName'],'type':_0x5d7e21[_0x459d('0x45')][_0x459d('0x46')]};});_0x3e445a['model']=_['map'](_0x2bed7f,_0x459d('0x41'));_0x3e445a[_0x459d('0x47')]=_[_0x459d('0x48')](_0x13b0fd['query']);_0x3e445a[_0x459d('0x49')]=_[_0x459d('0x4a')](_0x3e445a[_0x459d('0x4b')],_0x3e445a[_0x459d('0x47')]);_0x3b40ec[_0x459d('0x4c')]=_[_0x459d('0x4a')](_0x3e445a[_0x459d('0x4b')],qs[_0x459d('0x4d')](_0x13b0fd['query'][_0x459d('0x4d')]));_0x3b40ec[_0x459d('0x4c')]=_0x3b40ec[_0x459d('0x4c')][_0x459d('0x4e')]?_0x3b40ec['attributes']:_0x3e445a[_0x459d('0x4b')];if(!_0x13b0fd[_0x459d('0x47')][_0x459d('0x4f')]('nolimit')){_0x3b40ec['limit']=qs[_0x459d('0x37')](_0x13b0fd[_0x459d('0x47')][_0x459d('0x37')]);_0x3b40ec[_0x459d('0x35')]=qs[_0x459d('0x35')](_0x13b0fd[_0x459d('0x47')][_0x459d('0x35')]);}_0x3b40ec[_0x459d('0x50')]=qs[_0x459d('0x51')](_0x13b0fd[_0x459d('0x47')][_0x459d('0x51')]);_0x3b40ec['where']=qs[_0x459d('0x49')](_[_0x459d('0x52')](_0x13b0fd[_0x459d('0x47')],_0x3e445a[_0x459d('0x49')]),_0x2bed7f);if(_0x13b0fd[_0x459d('0x47')][_0x459d('0x53')]){_0x3b40ec[_0x459d('0x54')]=_['merge'](_0x3b40ec[_0x459d('0x54')],{'$or':_[_0x459d('0x55')](_0x2bed7f,function(_0x36dae3){if(_0x36dae3[_0x459d('0x45')]!=='VIRTUAL'){var _0x2ffa1e={};_0x2ffa1e[_0x36dae3[_0x459d('0x41')]]={'$like':'%'+_0x13b0fd[_0x459d('0x47')][_0x459d('0x53')]+'%'};return _0x2ffa1e;}})});}_0x3b40ec=_[_0x459d('0x56')]({},_0x3b40ec,_0x13b0fd[_0x459d('0x57')]);var _0x12efbb={'where':_0x3b40ec['where']};return db['FaxMessage'][_0x459d('0x38')](_0x12efbb)[_0x459d('0x25')](function(_0x2a283e){_0x55b412[_0x459d('0x38')]=_0x2a283e;if(_0x13b0fd[_0x459d('0x47')]['includeAll']){_0x3b40ec['include']=[{'all':!![]}];}return db[_0x459d('0x44')][_0x459d('0x58')](_0x3b40ec);})[_0x459d('0x25')](function(_0x1b667c){_0x55b412[_0x459d('0x59')]=_0x1b667c;return _0x55b412;})[_0x459d('0x25')](respondWithFilteredResult(_0x498d79,_0x3b40ec))[_0x459d('0x30')](handleError(_0x498d79,null));};exports['show']=function(_0x45a317,_0x2fb3fc){var _0x34cdf8={'raw':!![],'where':{'id':_0x45a317[_0x459d('0x5a')]['id']}},_0xf537a4={};_0xf537a4[_0x459d('0x4b')]=_[_0x459d('0x48')](db[_0x459d('0x44')]['rawAttributes']);_0xf537a4['query']=_[_0x459d('0x48')](_0x45a317[_0x459d('0x47')]);_0xf537a4['filters']=_[_0x459d('0x4a')](_0xf537a4['model'],_0xf537a4[_0x459d('0x47')]);_0x34cdf8[_0x459d('0x4c')]=_[_0x459d('0x4a')](_0xf537a4[_0x459d('0x4b')],qs[_0x459d('0x4d')](_0x45a317['query'][_0x459d('0x4d')]));_0x34cdf8[_0x459d('0x4c')]=_0x34cdf8[_0x459d('0x4c')]['length']?_0x34cdf8['attributes']:_0xf537a4[_0x459d('0x4b')];if(_0x45a317[_0x459d('0x47')]['includeAll']){_0x34cdf8[_0x459d('0x5b')]=[{'all':!![]}];}_0x34cdf8=_[_0x459d('0x56')]({},_0x34cdf8,_0x45a317[_0x459d('0x57')]);return db['FaxMessage'][_0x459d('0x5c')](_0x34cdf8)[_0x459d('0x25')](handleEntityNotFound(_0x2fb3fc,null))[_0x459d('0x25')](respondWithResult(_0x2fb3fc,null))[_0x459d('0x30')](handleError(_0x2fb3fc,null));};exports[_0x459d('0x3e')]=function(_0x248eaf,_0xce2e20){if(_0x248eaf[_0x459d('0x5d')]['id']){delete _0x248eaf[_0x459d('0x5d')]['id'];}return db['FaxMessage'][_0x459d('0x5c')]({'where':{'id':_0x248eaf[_0x459d('0x5a')]['id']}})[_0x459d('0x25')](handleEntityNotFound(_0xce2e20,null))[_0x459d('0x25')](saveUpdates(_0x248eaf[_0x459d('0x5d')],null))[_0x459d('0x25')](respondWithResult(_0xce2e20,null))[_0x459d('0x30')](handleError(_0xce2e20,null));};exports[_0x459d('0x3f')]=function(_0x4b4800,_0x3c8efe){return db[_0x459d('0x44')]['find']({'where':{'id':_0x4b4800[_0x459d('0x5a')]['id']}})[_0x459d('0x25')](handleEntityNotFound(_0x3c8efe,null))['then'](removeEntity(_0x3c8efe,null))[_0x459d('0x30')](handleError(_0x3c8efe,null));};exports[_0x459d('0x5e')]=function(_0x3b0c56,_0x18f681){return db['FaxMessage'][_0x459d('0x5e')]()[_0x459d('0x25')](respondWithResult(_0x18f681,null))['catch'](handleError(_0x18f681,null));};var interaction_log=require(_0x459d('0x16'))(_0x459d('0x5f'));exports[_0x459d('0x60')]=function(_0x5262d9,_0x36c20a,_0x1e51a3){var _0x4f8664={'agent':{},'channel':_0x459d('0x61')};if(_0x5262d9[_0x459d('0x5d')]['id']){delete _0x5262d9['body']['id'];}_0x5262d9[_0x459d('0x5d')][_0x459d('0x62')]=!![];_0x5262d9[_0x459d('0x5d')][_0x459d('0x63')]=moment()[_0x459d('0x64')](_0x459d('0x65'));_0x5262d9[_0x459d('0x5d')]['UserId']=_0x5262d9[_0x459d('0x5d')][_0x459d('0x66')]||_0x5262d9[_0x459d('0x67')]['id'];_0x4f8664['agent']['id']=_0x5262d9[_0x459d('0x5d')][_0x459d('0x66')];return db['FaxMessage']['find']({'where':{'id':_0x5262d9[_0x459d('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x36c20a,null))[_0x459d('0x25')](saveUpdates(_0x5262d9[_0x459d('0x5d')],null))[_0x459d('0x25')](function(_0x2b71bd){if(_0x2b71bd){_0x4f8664[_0x459d('0x2e')]=_0x2b71bd['get']({'plain':!![]});return db[_0x459d('0x68')][_0x459d('0x5c')]({'where':{'id':_0x2b71bd['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x36c20a,null))['then'](function(_0x425705){if(_0x425705){return _0x425705[_0x459d('0x3e')]({'UserId':_0x5262d9[_0x459d('0x5d')][_0x459d('0x66')],'read1stAt':_[_0x459d('0x69')](_0x425705['read1stAt'])?moment()['format'](_0x459d('0x65')):undefined});}return null;})[_0x459d('0x25')](function(_0x59a0f8){if(_0x59a0f8){_0x4f8664[_0x459d('0x6a')]=_0x59a0f8[_0x459d('0x6b')]({'plain':!![]});interaction_log[_0x459d('0x26')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5262d9[_0x459d('0x67')]['id'],_0x5262d9['user'][_0x459d('0x41')],_0x5262d9['user'][_0x459d('0x6c')],_0x4f8664['interaction']['id'],_0x5262d9[_0x459d('0x5d')]?JSON['stringify'](_0x5262d9['body']):_0x459d('0x6d'));return respondWithRpcPromise(_0x459d('0x6e'),_0x459d('0x6f'),_0x4f8664);}return null;})[_0x459d('0x25')](function(_0x212931){var _0x1d3937=_0x459d('0x70')+_0x212931[_0x459d('0x2e')]['ContactId'];return db[_0x459d('0x71')][_0x459d('0x47')](_0x1d3937,{'type':db['Sequelize']['QueryTypes'][_0x459d('0x72')],'raw':!![]})[_0x459d('0x25')](function(_0xfc11b0){return _0xfc11b0;});})['then'](function(_0x39be82){if(_0x39be82){_0x4f8664[_0x459d('0x2e')]['contact']=_0x39be82[0x0];if(!_0x5262d9[_0x459d('0x5d')][_0x459d('0x66')])return;return db[_0x459d('0x73')][_0x459d('0x5c')]({'where':{'id':_0x5262d9[_0x459d('0x5d')][_0x459d('0x66')],'role':_0x459d('0x74')},'attributes':['id',_0x459d('0x41'),_0x459d('0x75'),_0x459d('0x76'),_0x459d('0x77')],'raw':!![]});}return null;})[_0x459d('0x25')](function(_0x2c2f90){if(!_0x2c2f90)return null;_0x4f8664['message'][_0x459d('0x74')]=_0x2c2f90;return _0x4f8664;})[_0x459d('0x25')](function(_0x2aa6a9){if(_0x2aa6a9){if(_0x5262d9[_0x459d('0x5d')]['manual']){_0x4f8664[_0x459d('0x2e')][_0x459d('0x78')]=util[_0x459d('0x64')](_0x459d('0x79'),_0x5262d9[_0x459d('0x67')]['name']);_0x4f8664[_0x459d('0x2e')][_0x459d('0x7a')]=_0x4f8664['channel'];_0x4f8664[_0x459d('0x2e')][_0x459d('0x7b')]=_0x4f8664['channel'];_0x4f8664[_0x459d('0x2e')][_0x459d('0x7c')]=_0x459d('0x60');return respondWithRpcPromise(_0x459d('0x7d'),_0x459d('0x7d'),{'event':_0x459d('0x7e'),'message':_0x4f8664[_0x459d('0x2e')]},client9002)[_0x459d('0x25')](function(){return _0x4f8664;});}return _0x4f8664;}return null;})[_0x459d('0x25')](respondWithResult(_0x36c20a,null))[_0x459d('0x30')](handleError(_0x36c20a,null));};var interaction_log=require(_0x459d('0x16'))(_0x459d('0x5f'));exports[_0x459d('0x3c')]=function(_0x294287,_0x2e7196,_0x4aac7d){var _0x240b00={'agent':{},'channel':_0x459d('0x61')};if(_0x294287[_0x459d('0x5d')]['id']){delete _0x294287[_0x459d('0x5d')]['id'];}_0x294287[_0x459d('0x5d')][_0x459d('0x66')]=_0x294287[_0x459d('0x5d')][_0x459d('0x66')]||_0x294287['user']['id'];_0x240b00['agent']['id']=_0x294287[_0x459d('0x5d')][_0x459d('0x66')];return db[_0x459d('0x44')]['find']({'where':{'id':_0x294287[_0x459d('0x5a')]['id'],'UserId':null}})[_0x459d('0x25')](handleEntityNotFound(_0x2e7196,null))[_0x459d('0x25')](function(_0x30d63e){if(_0x30d63e){_0x240b00['message']=_0x30d63e[_0x459d('0x6b')]({'plain':!![]});return db[_0x459d('0x68')][_0x459d('0x5c')]({'where':{'id':_0x30d63e['FaxInteractionId']}});}return null;})[_0x459d('0x25')](handleEntityNotFound(_0x2e7196,null))[_0x459d('0x25')](function(_0x391229){if(_0x391229){_0x240b00[_0x459d('0x6a')]=_0x391229[_0x459d('0x6b')]({'plain':!![]});interaction_log[_0x459d('0x26')](_0x459d('0x7f'),_0x294287[_0x459d('0x67')]['id'],_0x294287[_0x459d('0x67')][_0x459d('0x41')],_0x294287[_0x459d('0x67')][_0x459d('0x6c')],_0x240b00[_0x459d('0x6a')]['id'],_0x294287[_0x459d('0x5d')]?JSON[_0x459d('0x2b')](_0x294287['body']):_0x459d('0x6d'));return respondWithRpcPromise(_0x459d('0x80'),_0x459d('0x81'),_0x240b00);}return null;})[_0x459d('0x25')](function(_0x2da7f9){var _0x29ad02=_0x459d('0x70')+_0x2da7f9[_0x459d('0x2e')][_0x459d('0x82')];return db[_0x459d('0x71')][_0x459d('0x47')](_0x29ad02,{'type':db['Sequelize'][_0x459d('0x83')][_0x459d('0x72')],'raw':!![]})[_0x459d('0x25')](function(_0xa592b9){return _0xa592b9;});})['then'](function(_0x3705b8){if(_0x3705b8){_0x240b00[_0x459d('0x2e')]['contact']=_0x3705b8[0x0];if(!_0x294287[_0x459d('0x5d')][_0x459d('0x66')])return;return db[_0x459d('0x73')][_0x459d('0x5c')]({'where':{'id':_0x294287[_0x459d('0x5d')]['UserId'],'role':_0x459d('0x74')},'attributes':['id',_0x459d('0x41'),_0x459d('0x75'),_0x459d('0x76'),_0x459d('0x77')],'raw':!![]});}return null;})[_0x459d('0x25')](function(_0xf6250d){if(!_0xf6250d)return null;_0x240b00[_0x459d('0x2e')][_0x459d('0x74')]=_0xf6250d;return _0x240b00;})[_0x459d('0x25')](function(_0x2cf509){if(_0x2cf509){_0x2cf509[_0x459d('0x2e')][_0x459d('0x78')]=util['format'](_0x459d('0x79'),_0x294287[_0x459d('0x67')][_0x459d('0x41')]);_0x2cf509[_0x459d('0x2e')][_0x459d('0x7a')]=_0x240b00[_0x459d('0x7a')];_0x2cf509[_0x459d('0x2e')]['motionChannel']=_0x240b00['channel'];_0x2cf509[_0x459d('0x2e')]['event']=_0x459d('0x3c');respondWithRpcPromise('EventManager','EventManager',{'event':_0x459d('0x84'),'message':_0x2cf509[_0x459d('0x2e')]},client9002);return _0x240b00;}return null;})[_0x459d('0x25')](respondWithResult(_0x2e7196,null))[_0x459d('0x30')](handleError(_0x2e7196,null));};exports['create']=function(_0x1f13a2,_0x350e92){var _0x5cd667;return db[_0x459d('0x44')][_0x459d('0x85')](_0x1f13a2[_0x459d('0x5d')],{})[_0x459d('0x25')](function(_0x2d38f7){_0x5cd667=_0x2d38f7;return db[_0x459d('0x86')]['findOne']({'where':{'id':_0x5cd667[_0x459d('0x82')]}});})['then'](function(_0x2b4193){if(_['isNil'](_0x2b4193)){return;}else{_0x5cd667[_0x459d('0x61')]=_0x2b4193[_0x459d('0x61')];return db['Attachment'][_0x459d('0x87')]({'where':{'id':_0x5cd667[_0x459d('0x88')]}});}})['then'](function(_0x50323c){return respondWithRpcPromise(_0x459d('0x89'),_0x459d('0x89'),{'FaxAccountId':_['isNil'](_0x1f13a2[_0x459d('0x5d')])?undefined:_0x1f13a2['body']['FaxAccountId'],'path':_['isNil'](_0x50323c)?undefined:util[_0x459d('0x64')](_0x459d('0x8a'),_0x50323c[_0x459d('0x8b')]),'fax':_['isNil'](_0x5cd667[_0x459d('0x61')])?undefined:_0x5cd667['fax'],'AttachmentId':_0x5cd667[_0x459d('0x88')]},client9002);})[_0x459d('0x25')](respondWithResult(_0x350e92,0xc9))[_0x459d('0x30')](handleError(_0x350e92,null));};exports['download']=function(_0x4f55d0,_0x11efdd){var _0x301d79=path[_0x459d('0x8c')](config[_0x459d('0x8d')],'server',_0x459d('0x8e'),_0x459d('0x8f'));return db[_0x459d('0x44')]['find']({'where':{'id':_0x4f55d0[_0x459d('0x5a')]['id']},'include':[{'model':db[_0x459d('0x90')],'as':_0x459d('0x90')}]})[_0x459d('0x25')](handleEntityNotFound(_0x11efdd,null))[_0x459d('0x25')](function(_0x33945c){if(_0x33945c){return _0x11efdd['download'](path['join'](_0x301d79,_0x33945c[_0x459d('0x90')][_0x459d('0x8b')]));}})[_0x459d('0x30')](handleError(_0x11efdd,null));}; \ No newline at end of file +var _0x6cfe=['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','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','FaxMessage','includeAll','findAll','show','params','body','find','describe','../../config/logger','fax-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','internal','manual','interface','format','SIP/%s','motionChannel','channel','event','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','fullname','email','EventManager','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','files','attachments','eml-format','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse'];(function(_0x440708,_0x1a3343){var _0x3d1784=function(_0x2e907d){while(--_0x2e907d){_0x440708['push'](_0x440708['shift']());}};_0x3d1784(++_0x1a3343);}(_0x6cfe,0x83));var _0xe6cf=function(_0x478e9a,_0x304a98){_0x478e9a=_0x478e9a-0x0;var _0x1ab8b1=_0x6cfe[_0x478e9a];return _0x1ab8b1;};'use strict';var emlformat=require(_0xe6cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6cf('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe6cf('0x2'));var Mustache=require(_0xe6cf('0x3'));var util=require('util');var path=require(_0xe6cf('0x4'));var sox=require(_0xe6cf('0x5'));var csv=require('to-csv');var ejs=require(_0xe6cf('0x6'));var fs=require('fs');var fs_extra=require(_0xe6cf('0x7'));var _=require(_0xe6cf('0x8'));var squel=require(_0xe6cf('0x9'));var crypto=require(_0xe6cf('0xa'));var jsforce=require(_0xe6cf('0xb'));var deskjs=require(_0xe6cf('0xc'));var toCsv=require(_0xe6cf('0xd'));var querystring=require('querystring');var Papa=require(_0xe6cf('0xe'));var Redis=require(_0xe6cf('0xf'));var authService=require(_0xe6cf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe6cf('0x11'));var hardwareService=require(_0xe6cf('0x12'));var logger=require('../../config/logger')(_0xe6cf('0x13'));var utils=require(_0xe6cf('0x14'));var config=require(_0xe6cf('0x15'));var licenseUtil=require(_0xe6cf('0x16'));var db=require(_0xe6cf('0x17'))['db'];config[_0xe6cf('0x18')]=_[_0xe6cf('0x19')](config[_0xe6cf('0x18')],{'host':_0xe6cf('0x1a'),'port':0x18eb});var socket=require(_0xe6cf('0x1b'))(new Redis(config[_0xe6cf('0x18')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xe6cf('0x1c'));var client=jayson[_0xe6cf('0x1d')][_0xe6cf('0x1e')]({'port':0x232c});var client9002=jayson[_0xe6cf('0x1d')][_0xe6cf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x11cfc6,_0x56820e,_0x4daa3b,_0x5da224){return new BPromise(function(_0xc4a353,_0x37b2e2){var _0x2dfda2=_0x5da224||client;return _0x2dfda2[_0xe6cf('0x1f')](_0x11cfc6,_0x4daa3b)['then'](function(_0x51fc2f){logger[_0xe6cf('0x20')](_0xe6cf('0x21'),_0x56820e,'request\x20sent');logger[_0xe6cf('0x22')](_0xe6cf('0x23'),_0x56820e,_0xe6cf('0x24'),JSON[_0xe6cf('0x25')](_0x51fc2f));if(_0x51fc2f[_0xe6cf('0x26')]){if(_0x51fc2f[_0xe6cf('0x26')][_0xe6cf('0x27')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x56820e,_0x51fc2f[_0xe6cf('0x26')]['message']);return _0x37b2e2(_0x51fc2f[_0xe6cf('0x26')][_0xe6cf('0x28')]);}logger['error'](_0xe6cf('0x21'),_0x56820e,_0x51fc2f['error'][_0xe6cf('0x28')]);return _0xc4a353(_0x51fc2f[_0xe6cf('0x26')][_0xe6cf('0x28')]);}else{logger['info'](_0xe6cf('0x21'),_0x56820e,_0xe6cf('0x24'));_0xc4a353(_0x51fc2f[_0xe6cf('0x29')][_0xe6cf('0x28')]);}})[_0xe6cf('0x2a')](function(_0x38b5ef){logger[_0xe6cf('0x26')](_0xe6cf('0x21'),_0x56820e,_0x38b5ef);_0x37b2e2(_0x38b5ef);});});}function respondWithStatusCode(_0x765d27,_0x1adbc6){_0x1adbc6=_0x1adbc6||0xcc;return function(_0xf12d77){if(_0xf12d77){return _0x765d27['sendStatus'](_0x1adbc6);}return _0x765d27[_0xe6cf('0x2b')](_0x1adbc6)[_0xe6cf('0x2c')]();};}function respondWithResult(_0x17ba00,_0x1cd33d){_0x1cd33d=_0x1cd33d||0xc8;return function(_0x44defd){if(_0x44defd){return _0x17ba00[_0xe6cf('0x2b')](_0x1cd33d)[_0xe6cf('0x2d')](_0x44defd);}};}function respondWithFilteredResult(_0x265f0e,_0x3875b0){return function(_0x453fde){if(_0x453fde){var _0x4989fe=typeof _0x3875b0[_0xe6cf('0x2e')]===_0xe6cf('0x2f')&&typeof _0x3875b0[_0xe6cf('0x30')]===_0xe6cf('0x2f');var _0x50b6b6=_0x453fde[_0xe6cf('0x31')];var _0x53163a=_0x4989fe?0x0:_0x3875b0[_0xe6cf('0x2e')];var _0x3b9886=_0x4989fe?_0x453fde[_0xe6cf('0x31')]:_0x3875b0[_0xe6cf('0x2e')]+_0x3875b0[_0xe6cf('0x30')];var _0x183b93;if(_0x3b9886>=_0x50b6b6){_0x3b9886=_0x50b6b6;_0x183b93=0xc8;}else{_0x183b93=0xce;}_0x265f0e[_0xe6cf('0x2b')](_0x183b93);return _0x265f0e[_0xe6cf('0x32')](_0xe6cf('0x33'),_0x53163a+'-'+_0x3b9886+'/'+_0x50b6b6)[_0xe6cf('0x2d')](_0x453fde);}return null;};}function patchUpdates(_0x577ce5){return function(_0x495f43){try{jsonpatch[_0xe6cf('0x34')](_0x495f43,_0x577ce5,!![]);}catch(_0x8260fe){return BPromise[_0xe6cf('0x35')](_0x8260fe);}return _0x495f43[_0xe6cf('0x36')]();};}function saveUpdates(_0x154c14,_0x5222ba){return function(_0x586319){if(_0x586319){return _0x586319[_0xe6cf('0x37')](_0x154c14)['then'](function(_0xdf7f3b){return _0xdf7f3b;});}return null;};}function removeEntity(_0x52502d,_0x5cdcf9){return function(_0x52eea6){if(_0x52eea6){return _0x52eea6[_0xe6cf('0x38')]()[_0xe6cf('0x39')](function(){_0x52502d[_0xe6cf('0x2b')](0xcc)[_0xe6cf('0x2c')]();});}};}function handleEntityNotFound(_0x482b72,_0x11500c){return function(_0x397821){if(!_0x397821){_0x482b72[_0xe6cf('0x3a')](0x194);}return _0x397821;};}function handleError(_0x3081e7,_0xf4aa40){_0xf4aa40=_0xf4aa40||0x1f4;return function(_0x1f3d35){logger[_0xe6cf('0x26')](_0x1f3d35[_0xe6cf('0x3b')]);if(_0x1f3d35['name']){delete _0x1f3d35[_0xe6cf('0x3c')];}_0x3081e7[_0xe6cf('0x2b')](_0xf4aa40)[_0xe6cf('0x3d')](_0x1f3d35);};}exports[_0xe6cf('0x3e')]=function(_0x2acc9b,_0x16f8b3){var _0x2af171={},_0x1b3907={},_0x5de836={'count':0x0,'rows':[]};var _0x423bdd=_['map'](db['FaxMessage'][_0xe6cf('0x3f')],function(_0x585821){return{'name':_0x585821[_0xe6cf('0x40')],'type':_0x585821[_0xe6cf('0x41')][_0xe6cf('0x42')]};});_0x1b3907[_0xe6cf('0x43')]=_[_0xe6cf('0x44')](_0x423bdd,_0xe6cf('0x3c'));_0x1b3907[_0xe6cf('0x45')]=_[_0xe6cf('0x46')](_0x2acc9b[_0xe6cf('0x45')]);_0x1b3907['filters']=_[_0xe6cf('0x47')](_0x1b3907[_0xe6cf('0x43')],_0x1b3907[_0xe6cf('0x45')]);_0x2af171['attributes']=_['intersection'](_0x1b3907[_0xe6cf('0x43')],qs[_0xe6cf('0x48')](_0x2acc9b[_0xe6cf('0x45')][_0xe6cf('0x48')]));_0x2af171[_0xe6cf('0x49')]=_0x2af171[_0xe6cf('0x49')][_0xe6cf('0x4a')]?_0x2af171[_0xe6cf('0x49')]:_0x1b3907[_0xe6cf('0x43')];if(!_0x2acc9b['query'][_0xe6cf('0x4b')](_0xe6cf('0x4c'))){_0x2af171[_0xe6cf('0x30')]=qs['limit'](_0x2acc9b[_0xe6cf('0x45')][_0xe6cf('0x30')]);_0x2af171[_0xe6cf('0x2e')]=qs[_0xe6cf('0x2e')](_0x2acc9b[_0xe6cf('0x45')][_0xe6cf('0x2e')]);}_0x2af171[_0xe6cf('0x4d')]=qs[_0xe6cf('0x4e')](_0x2acc9b['query']['sort']);_0x2af171[_0xe6cf('0x4f')]=qs[_0xe6cf('0x50')](_[_0xe6cf('0x51')](_0x2acc9b[_0xe6cf('0x45')],_0x1b3907[_0xe6cf('0x50')]),_0x423bdd);if(_0x2acc9b[_0xe6cf('0x45')][_0xe6cf('0x52')]){_0x2af171[_0xe6cf('0x4f')]=_[_0xe6cf('0x53')](_0x2af171[_0xe6cf('0x4f')],{'$or':_[_0xe6cf('0x44')](_0x423bdd,function(_0x210908){if(_0x210908[_0xe6cf('0x41')]!=='VIRTUAL'){var _0x5eec14={};_0x5eec14[_0x210908[_0xe6cf('0x3c')]]={'$like':'%'+_0x2acc9b[_0xe6cf('0x45')][_0xe6cf('0x52')]+'%'};return _0x5eec14;}})});}_0x2af171=_[_0xe6cf('0x53')]({},_0x2af171,_0x2acc9b[_0xe6cf('0x54')]);var _0x1ae6a6={'where':_0x2af171['where']};return db[_0xe6cf('0x55')][_0xe6cf('0x31')](_0x1ae6a6)[_0xe6cf('0x39')](function(_0xfab427){_0x5de836[_0xe6cf('0x31')]=_0xfab427;if(_0x2acc9b[_0xe6cf('0x45')][_0xe6cf('0x56')]){_0x2af171['include']=[{'all':!![]}];}return db[_0xe6cf('0x55')][_0xe6cf('0x57')](_0x2af171);})[_0xe6cf('0x39')](function(_0x5ce5db){_0x5de836['rows']=_0x5ce5db;return _0x5de836;})[_0xe6cf('0x39')](respondWithFilteredResult(_0x16f8b3,_0x2af171))['catch'](handleError(_0x16f8b3,null));};exports[_0xe6cf('0x58')]=function(_0x284030,_0x29a43a){var _0x1313a3={'raw':!![],'where':{'id':_0x284030[_0xe6cf('0x59')]['id']}},_0x3703c1={};_0x3703c1['model']=_['keys'](db[_0xe6cf('0x55')][_0xe6cf('0x3f')]);_0x3703c1[_0xe6cf('0x45')]=_[_0xe6cf('0x46')](_0x284030['query']);_0x3703c1[_0xe6cf('0x50')]=_[_0xe6cf('0x47')](_0x3703c1['model'],_0x3703c1[_0xe6cf('0x45')]);_0x1313a3[_0xe6cf('0x49')]=_[_0xe6cf('0x47')](_0x3703c1[_0xe6cf('0x43')],qs[_0xe6cf('0x48')](_0x284030[_0xe6cf('0x45')][_0xe6cf('0x48')]));_0x1313a3[_0xe6cf('0x49')]=_0x1313a3[_0xe6cf('0x49')]['length']?_0x1313a3['attributes']:_0x3703c1['model'];if(_0x284030[_0xe6cf('0x45')][_0xe6cf('0x56')]){_0x1313a3['include']=[{'all':!![]}];}_0x1313a3=_[_0xe6cf('0x53')]({},_0x1313a3,_0x284030['options']);return db['FaxMessage']['find'](_0x1313a3)[_0xe6cf('0x39')](handleEntityNotFound(_0x29a43a,null))[_0xe6cf('0x39')](respondWithResult(_0x29a43a,null))[_0xe6cf('0x2a')](handleError(_0x29a43a,null));};exports[_0xe6cf('0x37')]=function(_0x535e00,_0x56e580){if(_0x535e00['body']['id']){delete _0x535e00[_0xe6cf('0x5a')]['id'];}return db[_0xe6cf('0x55')][_0xe6cf('0x5b')]({'where':{'id':_0x535e00[_0xe6cf('0x59')]['id']}})[_0xe6cf('0x39')](handleEntityNotFound(_0x56e580,null))[_0xe6cf('0x39')](saveUpdates(_0x535e00[_0xe6cf('0x5a')],null))[_0xe6cf('0x39')](respondWithResult(_0x56e580,null))[_0xe6cf('0x2a')](handleError(_0x56e580,null));};exports[_0xe6cf('0x38')]=function(_0x9f5cf8,_0x1fa1b2){return db[_0xe6cf('0x55')][_0xe6cf('0x5b')]({'where':{'id':_0x9f5cf8[_0xe6cf('0x59')]['id']}})[_0xe6cf('0x39')](handleEntityNotFound(_0x1fa1b2,null))['then'](removeEntity(_0x1fa1b2,null))[_0xe6cf('0x2a')](handleError(_0x1fa1b2,null));};exports[_0xe6cf('0x5c')]=function(_0x23be75,_0x5141bc){return db[_0xe6cf('0x55')][_0xe6cf('0x5c')]()[_0xe6cf('0x39')](respondWithResult(_0x5141bc,null))[_0xe6cf('0x2a')](handleError(_0x5141bc,null));};var interaction_log=require(_0xe6cf('0x5d'))(_0xe6cf('0x5e'));exports[_0xe6cf('0x5f')]=function(_0xa52e99,_0x3c9c2a,_0x18befb){var _0x3824b1={'agent':{},'channel':'fax'};if(_0xa52e99[_0xe6cf('0x5a')]['id']){delete _0xa52e99[_0xe6cf('0x5a')]['id'];}_0xa52e99['body'][_0xe6cf('0x60')]=!![];_0xa52e99[_0xe6cf('0x5a')][_0xe6cf('0x61')]=moment()['format'](_0xe6cf('0x62'));_0xa52e99[_0xe6cf('0x5a')][_0xe6cf('0x63')]=_0xa52e99[_0xe6cf('0x5a')][_0xe6cf('0x63')]||_0xa52e99[_0xe6cf('0x64')]['id'];_0x3824b1[_0xe6cf('0x65')]['id']=_0xa52e99[_0xe6cf('0x5a')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0xa52e99[_0xe6cf('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c9c2a,null))[_0xe6cf('0x39')](saveUpdates(_0xa52e99[_0xe6cf('0x5a')],null))['then'](function(_0x273b99){if(_0x273b99){_0x3824b1[_0xe6cf('0x28')]=_0x273b99[_0xe6cf('0x66')]({'plain':!![]});return db[_0xe6cf('0x67')]['find']({'where':{'id':_0x273b99[_0xe6cf('0x68')]}});}return null;})[_0xe6cf('0x39')](handleEntityNotFound(_0x3c9c2a,null))[_0xe6cf('0x39')](function(_0x4c5dba){if(_0x4c5dba){return _0x4c5dba[_0xe6cf('0x37')]({'UserId':_0xa52e99[_0xe6cf('0x5a')]['UserId'],'read1stAt':_[_0xe6cf('0x69')](_0x4c5dba['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe6cf('0x39')](function(_0x15440b){if(_0x15440b){_0x3824b1['interaction']=_0x15440b[_0xe6cf('0x66')]({'plain':!![]});interaction_log[_0xe6cf('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa52e99[_0xe6cf('0x64')]['id'],_0xa52e99[_0xe6cf('0x64')][_0xe6cf('0x3c')],_0xa52e99['user'][_0xe6cf('0x6a')],_0x3824b1[_0xe6cf('0x6b')]['id'],_0xa52e99['body']?JSON[_0xe6cf('0x25')](_0xa52e99[_0xe6cf('0x5a')]):_0xe6cf('0x6c'));return respondWithRpcPromise(_0xe6cf('0x6d'),'acceptMessage',_0x3824b1);}return null;})[_0xe6cf('0x39')](function(_0x11ad2f){var _0x2ecfe6=_0xe6cf('0x6e')+_0x11ad2f['message'][_0xe6cf('0x6f')];return db[_0xe6cf('0x70')][_0xe6cf('0x45')](_0x2ecfe6,{'type':db[_0xe6cf('0x71')][_0xe6cf('0x72')][_0xe6cf('0x73')],'raw':!![]})[_0xe6cf('0x39')](function(_0x5a9866){return _0x5a9866;});})[_0xe6cf('0x39')](function(_0xba87f8){if(_0xba87f8){_0x3824b1[_0xe6cf('0x28')]['contact']=_0xba87f8[0x0];if(!_0xa52e99[_0xe6cf('0x5a')][_0xe6cf('0x63')])return;return db[_0xe6cf('0x74')][_0xe6cf('0x5b')]({'where':{'id':_0xa52e99[_0xe6cf('0x5a')]['UserId'],'role':_0xe6cf('0x65')},'attributes':['id','name','fullname','email',_0xe6cf('0x75')],'raw':!![]});}return null;})[_0xe6cf('0x39')](function(_0x2ee5e8){if(!_0x2ee5e8)return null;_0x3824b1[_0xe6cf('0x28')][_0xe6cf('0x65')]=_0x2ee5e8;return _0x3824b1;})[_0xe6cf('0x39')](function(_0x51ee04){if(_0x51ee04){if(_0xa52e99['body'][_0xe6cf('0x76')]){_0x3824b1[_0xe6cf('0x28')][_0xe6cf('0x77')]=util[_0xe6cf('0x78')](_0xe6cf('0x79'),_0xa52e99[_0xe6cf('0x64')][_0xe6cf('0x3c')]);_0x3824b1[_0xe6cf('0x28')]['channel']=_0x3824b1['channel'];_0x3824b1['message'][_0xe6cf('0x7a')]=_0x3824b1[_0xe6cf('0x7b')];_0x3824b1[_0xe6cf('0x28')][_0xe6cf('0x7c')]=_0xe6cf('0x5f');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xe6cf('0x7d'),'message':_0x3824b1[_0xe6cf('0x28')]},client9002)[_0xe6cf('0x39')](function(){return _0x3824b1;});}return _0x3824b1;}return null;})[_0xe6cf('0x39')](respondWithResult(_0x3c9c2a,null))[_0xe6cf('0x2a')](handleError(_0x3c9c2a,null));};var interaction_log=require('../../config/logger')(_0xe6cf('0x5e'));exports['reject']=function(_0x2c068e,_0x18fa05,_0x4646f2){var _0x39d5d0={'agent':{},'channel':_0xe6cf('0x7e')};if(_0x2c068e[_0xe6cf('0x5a')]['id']){delete _0x2c068e[_0xe6cf('0x5a')]['id'];}_0x2c068e['body']['UserId']=_0x2c068e[_0xe6cf('0x5a')]['UserId']||_0x2c068e[_0xe6cf('0x64')]['id'];_0x39d5d0[_0xe6cf('0x65')]['id']=_0x2c068e[_0xe6cf('0x5a')][_0xe6cf('0x63')];return db['FaxMessage'][_0xe6cf('0x5b')]({'where':{'id':_0x2c068e['params']['id'],'UserId':null}})[_0xe6cf('0x39')](handleEntityNotFound(_0x18fa05,null))[_0xe6cf('0x39')](function(_0x12ce5e){if(_0x12ce5e){_0x39d5d0['message']=_0x12ce5e[_0xe6cf('0x66')]({'plain':!![]});return db['FaxInteraction'][_0xe6cf('0x5b')]({'where':{'id':_0x12ce5e[_0xe6cf('0x68')]}});}return null;})[_0xe6cf('0x39')](handleEntityNotFound(_0x18fa05,null))[_0xe6cf('0x39')](function(_0x4c75e7){if(_0x4c75e7){_0x39d5d0[_0xe6cf('0x6b')]=_0x4c75e7['get']({'plain':!![]});interaction_log[_0xe6cf('0x20')](_0xe6cf('0x7f'),_0x2c068e['user']['id'],_0x2c068e[_0xe6cf('0x64')][_0xe6cf('0x3c')],_0x2c068e[_0xe6cf('0x64')][_0xe6cf('0x6a')],_0x39d5d0[_0xe6cf('0x6b')]['id'],_0x2c068e[_0xe6cf('0x5a')]?JSON[_0xe6cf('0x25')](_0x2c068e[_0xe6cf('0x5a')]):_0xe6cf('0x6c'));return respondWithRpcPromise('RejectMessage',_0xe6cf('0x80'),_0x39d5d0);}return null;})[_0xe6cf('0x39')](function(_0x189724){var _0x22395d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x189724[_0xe6cf('0x28')]['ContactId'];return db['sequelize'][_0xe6cf('0x45')](_0x22395d,{'type':db[_0xe6cf('0x71')][_0xe6cf('0x72')][_0xe6cf('0x73')],'raw':!![]})[_0xe6cf('0x39')](function(_0xc09d3){return _0xc09d3;});})[_0xe6cf('0x39')](function(_0x2ca3de){if(_0x2ca3de){_0x39d5d0[_0xe6cf('0x28')][_0xe6cf('0x81')]=_0x2ca3de[0x0];if(!_0x2c068e[_0xe6cf('0x5a')]['UserId'])return;return db[_0xe6cf('0x74')][_0xe6cf('0x5b')]({'where':{'id':_0x2c068e[_0xe6cf('0x5a')][_0xe6cf('0x63')],'role':_0xe6cf('0x65')},'attributes':['id',_0xe6cf('0x3c'),_0xe6cf('0x82'),_0xe6cf('0x83'),_0xe6cf('0x75')],'raw':!![]});}return null;})[_0xe6cf('0x39')](function(_0x3ab5bc){if(!_0x3ab5bc)return null;_0x39d5d0['message'][_0xe6cf('0x65')]=_0x3ab5bc;return _0x39d5d0;})[_0xe6cf('0x39')](function(_0x2e5cb6){if(_0x2e5cb6){_0x2e5cb6['message'][_0xe6cf('0x77')]=util[_0xe6cf('0x78')](_0xe6cf('0x79'),_0x2c068e[_0xe6cf('0x64')][_0xe6cf('0x3c')]);_0x2e5cb6[_0xe6cf('0x28')][_0xe6cf('0x7b')]=_0x39d5d0[_0xe6cf('0x7b')];_0x2e5cb6[_0xe6cf('0x28')]['motionChannel']=_0x39d5d0[_0xe6cf('0x7b')];_0x2e5cb6['message']['event']=_0xe6cf('0x35');respondWithRpcPromise('EventManager',_0xe6cf('0x84'),{'event':'rejectmessage','message':_0x2e5cb6[_0xe6cf('0x28')]},client9002);return _0x39d5d0;}return null;})[_0xe6cf('0x39')](respondWithResult(_0x18fa05,null))[_0xe6cf('0x2a')](handleError(_0x18fa05,null));};exports[_0xe6cf('0x85')]=function(_0x3b4d7a,_0x3592df){var _0x4c4ee3;return db[_0xe6cf('0x55')]['create'](_0x3b4d7a[_0xe6cf('0x5a')],{})[_0xe6cf('0x39')](function(_0x5c7789){_0x4c4ee3=_0x5c7789;return db[_0xe6cf('0x86')]['findOne']({'where':{'id':_0x4c4ee3[_0xe6cf('0x6f')]}});})['then'](function(_0x3e4e0b){if(_['isNil'](_0x3e4e0b)){return;}else{_0x4c4ee3['fax']=_0x3e4e0b[_0xe6cf('0x7e')];return db[_0xe6cf('0x87')][_0xe6cf('0x88')]({'where':{'id':_0x4c4ee3[_0xe6cf('0x89')]}});}})[_0xe6cf('0x39')](function(_0x483c08){return respondWithRpcPromise('SendFax',_0xe6cf('0x8a'),{'FaxAccountId':_['isNil'](_0x3b4d7a[_0xe6cf('0x5a')])?undefined:_0x3b4d7a[_0xe6cf('0x5a')][_0xe6cf('0x8b')],'path':_[_0xe6cf('0x69')](_0x483c08)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x483c08[_0xe6cf('0x8c')]),'fax':_[_0xe6cf('0x69')](_0x4c4ee3[_0xe6cf('0x7e')])?undefined:_0x4c4ee3['fax'],'AttachmentId':_0x4c4ee3[_0xe6cf('0x89')]},client9002);})['then'](respondWithResult(_0x3592df,0xc9))['catch'](handleError(_0x3592df,null));};exports[_0xe6cf('0x8d')]=function(_0x2f15a7,_0x48d1ac){var _0x4c1faf=path[_0xe6cf('0x8e')](config[_0xe6cf('0x8f')],'server',_0xe6cf('0x90'),_0xe6cf('0x91'));return db['FaxMessage']['find']({'where':{'id':_0x2f15a7[_0xe6cf('0x59')]['id']},'include':[{'model':db[_0xe6cf('0x87')],'as':_0xe6cf('0x87')}]})[_0xe6cf('0x39')](handleEntityNotFound(_0x48d1ac,null))[_0xe6cf('0x39')](function(_0x4bd09){if(_0x4bd09){return _0x48d1ac['download'](path['join'](_0x4c1faf,_0x4bd09[_0xe6cf('0x87')][_0xe6cf('0x8c')]));}})[_0xe6cf('0x2a')](handleError(_0x48d1ac,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a129ad3..fdf6eb5 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 _0xe225=['emit','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','remove'];(function(_0x52581e,_0xe516ae){var _0x3617ae=function(_0x4c4532){while(--_0x4c4532){_0x52581e['push'](_0x52581e['shift']());}};_0x3617ae(++_0xe516ae);}(_0xe225,0x1bd));var _0x5e22=function(_0x1879a4,_0x581a4a){_0x1879a4=_0x1879a4-0x0;var _0x38e837=_0xe225[_0x1879a4];return _0x38e837;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x5e22('0x0'))['db'][_0x5e22('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5e22('0x2')};function emitEvent(_0x5ca6b5){return function(_0x45790b,_0x4e0d42,_0x50df23){FaxMessageEvents['emit'](_0x5ca6b5+':'+_0x45790b['id'],_0x45790b);FaxMessageEvents[_0x5e22('0x3')](_0x5ca6b5,_0x45790b);_0x50df23(null);};}for(var e in events){if(events[_0x5e22('0x4')](e)){var event=events[e];FaxMessage[_0x5e22('0x5')](e,emitEvent(event));}}module[_0x5e22('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x82f8=['FaxMessage','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x363d9e,_0x3cd186){var _0x240474=function(_0x1323fb){while(--_0x1323fb){_0x363d9e['push'](_0x363d9e['shift']());}};_0x240474(++_0x3cd186);}(_0x82f8,0x157));var _0x882f=function(_0x1d43f4,_0x37003a){_0x1d43f4=_0x1d43f4-0x0;var _0x1c6c50=_0x82f8[_0x1d43f4];return _0x1c6c50;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x882f('0x0'))['db'][_0x882f('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x882f('0x2'),'afterUpdate':_0x882f('0x3'),'afterDestroy':_0x882f('0x4')};function emitEvent(_0x3b974b){return function(_0x2fad3e,_0x181655,_0x9e6ad7){FaxMessageEvents[_0x882f('0x5')](_0x3b974b+':'+_0x2fad3e['id'],_0x2fad3e);FaxMessageEvents['emit'](_0x3b974b,_0x2fad3e);_0x9e6ad7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x882f('0x6')](e,emitEvent(event));}}module[_0x882f('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c2aa1b3..e2171b6 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 _0xdf84=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','direction','toLowerCase','out','secret','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x52e82f,_0x4434af){var _0x276f22=function(_0x1d0135){while(--_0x1d0135){_0x52e82f['push'](_0x52e82f['shift']());}};_0x276f22(++_0x4434af);}(_0xdf84,0xc4));var _0x4df8=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0xdf84[_0x5976f8];return _0x179715;};'use strict';var _=require(_0x4df8('0x0'));var util=require(_0x4df8('0x1'));var logger=require(_0x4df8('0x2'))(_0x4df8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4df8('0x4'));var fs=require('fs');var path=require(_0x4df8('0x5'));var rimraf=require('rimraf');var config=require(_0x4df8('0x6'));var attributes=require(_0x4df8('0x7'));module[_0x4df8('0x8')]=function(_0x331486,_0x261ae0){return _0x331486[_0x4df8('0x9')](_0x4df8('0xa'),attributes,{'tableName':_0x4df8('0xb'),'paranoid':![],'indexes':[{'name':_0x4df8('0xc'),'fields':[_0x4df8('0xd')],'type':_0x4df8('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1119a7,_0x11de49,_0x506450){var _0x1e36ee=_0x331486['models'];var _0x212fef=_0x1119a7['get']({'plain':!![]});if(_0x212fef[_0x4df8('0xf')][_0x4df8('0x10')]()==='in'||_0x212fef[_0x4df8('0xf')]['toLowerCase']()===_0x4df8('0x11')&&!_0x212fef[_0x4df8('0x12')]&&!_['isNil'](_0x212fef['UserId'])){_0x1e36ee[_0x4df8('0x13')]['findOne']({'where':{'id':_0x212fef[_0x4df8('0x14')]}})[_0x4df8('0x15')](function(_0x15a0a3){if(_0x15a0a3){_0x15a0a3[_0x4df8('0x16')]({'lastMsgAt':_0x212fef[_0x4df8('0x17')],'lastMsgDirection':_0x212fef[_0x4df8('0xf')][_0x4df8('0x10')]()});}})[_0x4df8('0x18')](function(_0xfacc5){console[_0x4df8('0x19')](_0xfacc5);});}_0x506450();}},'charset':_0x4df8('0x1a'),'collate':_0x4df8('0x1b')});}; \ No newline at end of file +var _0xa899=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x3028e3,_0x2a7cd7){var _0x59a7a8=function(_0x4cfd18){while(--_0x4cfd18){_0x3028e3['push'](_0x3028e3['shift']());}};_0x59a7a8(++_0x2a7cd7);}(_0xa899,0x153));var _0x9a89=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0xa899[_0x4defd6];return _0x4c9276;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var logger=require(_0x9a89('0x2'))('api');var moment=require(_0x9a89('0x3'));var BPromise=require(_0x9a89('0x4'));var rp=require(_0x9a89('0x5'));var fs=require('fs');var path=require(_0x9a89('0x6'));var rimraf=require(_0x9a89('0x7'));var config=require(_0x9a89('0x8'));var attributes=require(_0x9a89('0x9'));module[_0x9a89('0xa')]=function(_0x356c86,_0x39bd2d){return _0x356c86['define'](_0x9a89('0xb'),attributes,{'tableName':_0x9a89('0xc'),'paranoid':![],'indexes':[{'name':_0x9a89('0xd'),'fields':[_0x9a89('0xe')],'type':_0x9a89('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b6cac,_0x20452a,_0x4ce62d){var _0x3e0f0e=_0x356c86[_0x9a89('0x10')];var _0x20ee49=_0x2b6cac[_0x9a89('0x11')]({'plain':!![]});if(_0x20ee49['direction']['toLowerCase']()==='in'||_0x20ee49['direction'][_0x9a89('0x12')]()===_0x9a89('0x13')&&!_0x20ee49[_0x9a89('0x14')]&&!_[_0x9a89('0x15')](_0x20ee49['UserId'])){_0x3e0f0e[_0x9a89('0x16')][_0x9a89('0x17')]({'where':{'id':_0x20ee49[_0x9a89('0x18')]}})[_0x9a89('0x19')](function(_0x5a53ec){if(_0x5a53ec){_0x5a53ec['update']({'lastMsgAt':_0x20ee49[_0x9a89('0x1a')],'lastMsgDirection':_0x20ee49['direction'][_0x9a89('0x12')]()});}})[_0x9a89('0x1b')](function(_0x28516e){console[_0x9a89('0x1c')](_0x28516e);});}_0x4ce62d();}},'charset':_0x9a89('0x1d'),'collate':_0x9a89('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 24c3f74..a8e545a 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 _0x9bde=['body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','limit','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','FaxMessage','create'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9bde,0xe1));var _0xe9bd=function(_0x39764c,_0x25dbce){_0x39764c=_0x39764c-0x0;var _0x14871d=_0x9bde[_0x39764c];return _0x14871d;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});config[_0xe9bd('0xa')]=_[_0xe9bd('0xb')](config[_0xe9bd('0xa')],{'host':_0xe9bd('0xc'),'port':0x18eb});var socket=require(_0xe9bd('0xd'))(new Redis(config[_0xe9bd('0xa')]));require(_0xe9bd('0xe'))[_0xe9bd('0xf')](socket);function respondWithRpcPromise(_0x45c7ba,_0x581602,_0x5f36c8){return new BPromise(function(_0x3c8e95,_0x145521){return client[_0xe9bd('0x10')](_0x45c7ba,_0x5f36c8)['then'](function(_0x12c96e){logger[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));logger['debug'](_0xe9bd('0x14'),_0x581602,'request\x20sent',JSON[_0xe9bd('0x15')](_0x12c96e));if(_0x12c96e[_0xe9bd('0x16')]){if(_0x12c96e[_0xe9bd('0x16')]['code']===0x1f4){logger['error'](_0xe9bd('0x12'),_0x581602,_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);return _0x145521(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}logger[_0xe9bd('0x16')](_0xe9bd('0x12'),_0x581602,_0x12c96e['error'][_0xe9bd('0x17')]);return _0x3c8e95(_0x12c96e[_0xe9bd('0x16')][_0xe9bd('0x17')]);}else{logger['info'](_0xe9bd('0x12'),_0x581602,_0xe9bd('0x13'));_0x3c8e95(_0x12c96e[_0xe9bd('0x18')][_0xe9bd('0x17')]);}})['catch'](function(_0x20ec32){logger['error'](_0xe9bd('0x12'),_0x581602,_0x20ec32);_0x145521(_0x20ec32);});});}exports['CreateFaxMessage']=function(_0x26aa4a){var _0x417113=this;return new Promise(function(_0x134c4e,_0x3dda13){return db[_0xe9bd('0x19')][_0xe9bd('0x1a')](_0x26aa4a[_0xe9bd('0x1b')],{'raw':_0x26aa4a['options']?_0x26aa4a[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x37aec1){logger['info'](_0xe9bd('0x1e'),_0x26aa4a);logger[_0xe9bd('0x1f')](_0xe9bd('0x1e'),_0x26aa4a,JSON[_0xe9bd('0x15')](_0x37aec1));_0x134c4e(_0x37aec1);})['catch'](function(_0x24cf25){logger[_0xe9bd('0x16')](_0xe9bd('0x1e'),_0x24cf25[_0xe9bd('0x17')],_0x26aa4a);_0x3dda13(_0x417113[_0xe9bd('0x16')](0x1f4,_0x24cf25[_0xe9bd('0x17')]));});});};exports[_0xe9bd('0x20')]=function(_0x43ea90){var _0x1ae889=this;return new Promise(function(_0x5987af,_0x3c211a){return db[_0xe9bd('0x19')]['update'](_0x43ea90[_0xe9bd('0x1b')],{'raw':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')]['where']||null:null,'attributes':_0x43ea90['options']?_0x43ea90[_0xe9bd('0x1c')]['attributes']||null:null,'limit':_0x43ea90[_0xe9bd('0x1c')]?_0x43ea90[_0xe9bd('0x1c')][_0xe9bd('0x21')]||null:null})[_0xe9bd('0x22')](function(_0x4057df){logger['info']('UpdateFaxMessage',_0x43ea90);logger[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x43ea90,JSON[_0xe9bd('0x15')](_0x4057df));_0x5987af(_0x4057df);})[_0xe9bd('0x23')](function(_0xe2436){logger[_0xe9bd('0x16')](_0xe9bd('0x20'),_0xe2436[_0xe9bd('0x17')],_0x43ea90);_0x3c211a(_0x1ae889[_0xe9bd('0x16')](0x1f4,_0xe2436['message']));});});}; \ No newline at end of file +var _0x34e8=['request\x20sent','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','update','body','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4dc6c3,_0x3cba97){var _0x58eabe=function(_0x2f7413){while(--_0x2f7413){_0x4dc6c3['push'](_0x4dc6c3['shift']());}};_0x58eabe(++_0x3cba97);}(_0x34e8,0x12c));var _0x834e=function(_0x1c2467,_0x2ea90e){_0x1c2467=_0x1c2467-0x0;var _0x201e2c=_0x34e8[_0x1c2467];return _0x201e2c;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});config['redis']=_[_0x834e('0xc')](config[_0x834e('0xd')],{'host':_0x834e('0xe'),'port':0x18eb});var socket=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xd')]));require(_0x834e('0x10'))[_0x834e('0x11')](socket);function respondWithRpcPromise(_0x1af45a,_0x3bdda9,_0x186b3b){return new BPromise(function(_0x1e41fe,_0x36e124){return client[_0x834e('0x12')](_0x1af45a,_0x186b3b)[_0x834e('0x13')](function(_0x293514){logger[_0x834e('0x14')](_0x834e('0x15'),_0x3bdda9,'request\x20sent');logger[_0x834e('0x16')](_0x834e('0x17'),_0x3bdda9,'request\x20sent',JSON[_0x834e('0x18')](_0x293514));if(_0x293514[_0x834e('0x19')]){if(_0x293514[_0x834e('0x19')][_0x834e('0x1a')]===0x1f4){logger['error'](_0x834e('0x15'),_0x3bdda9,_0x293514[_0x834e('0x19')]['message']);return _0x36e124(_0x293514[_0x834e('0x19')]['message']);}logger[_0x834e('0x19')](_0x834e('0x15'),_0x3bdda9,_0x293514['error'][_0x834e('0x1b')]);return _0x1e41fe(_0x293514[_0x834e('0x19')][_0x834e('0x1b')]);}else{logger['info'](_0x834e('0x15'),_0x3bdda9,_0x834e('0x1c'));_0x1e41fe(_0x293514[_0x834e('0x1d')][_0x834e('0x1b')]);}})[_0x834e('0x1e')](function(_0x254677){logger[_0x834e('0x19')]('FaxMessage,\x20%s,\x20%s',_0x3bdda9,_0x254677);_0x36e124(_0x254677);});});}exports[_0x834e('0x1f')]=function(_0x1fd2c6){var _0x113ff4=this;return new Promise(function(_0x325a99,_0x4ab05d){return db[_0x834e('0x20')][_0x834e('0x21')](_0x1fd2c6['body'],{'raw':_0x1fd2c6[_0x834e('0x22')]?_0x1fd2c6[_0x834e('0x22')][_0x834e('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x4e3f48){logger[_0x834e('0x14')](_0x834e('0x1f'),_0x1fd2c6);logger['debug'](_0x834e('0x1f'),_0x1fd2c6,JSON[_0x834e('0x18')](_0x4e3f48));_0x325a99(_0x4e3f48);})['catch'](function(_0x3bc4f7){logger[_0x834e('0x19')](_0x834e('0x1f'),_0x3bc4f7['message'],_0x1fd2c6);_0x4ab05d(_0x113ff4[_0x834e('0x19')](0x1f4,_0x3bc4f7[_0x834e('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x5bef62){var _0x1e713a=this;return new Promise(function(_0x508a1d,_0x2826ec){return db[_0x834e('0x20')][_0x834e('0x24')](_0x5bef62[_0x834e('0x25')],{'raw':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bef62['options']?_0x5bef62['options']['where']||null:null,'attributes':_0x5bef62[_0x834e('0x22')]?_0x5bef62[_0x834e('0x22')][_0x834e('0x26')]||null:null,'limit':_0x5bef62['options']?_0x5bef62[_0x834e('0x22')][_0x834e('0x27')]||null:null})[_0x834e('0x13')](function(_0x1e026a){logger[_0x834e('0x14')](_0x834e('0x28'),_0x5bef62);logger[_0x834e('0x16')](_0x834e('0x28'),_0x5bef62,JSON[_0x834e('0x18')](_0x1e026a));_0x508a1d(_0x1e026a);})['catch'](function(_0xef9ec2){logger['error'](_0x834e('0x28'),_0xef9ec2[_0x834e('0x1b')],_0x5bef62);_0x2826ec(_0x1e713a[_0x834e('0x19')](0x1f4,_0xef9ec2[_0x834e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 34d4c4b..f8dd8c1 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 _0x1782=['length','faxMessage:','./faxMessage.events','remove','update','emit','removeListener','register'];(function(_0x3321ae,_0x21d41f){var _0x5c5b6e=function(_0x1beb2e){while(--_0x1beb2e){_0x3321ae['push'](_0x3321ae['shift']());}};_0x5c5b6e(++_0x21d41f);}(_0x1782,0xf2));var _0x2178=function(_0x30b251,_0x31e726){_0x30b251=_0x30b251-0x0;var _0x3c6d48=_0x1782[_0x30b251];return _0x3c6d48;};'use strict';var FaxMessageEvents=require(_0x2178('0x0'));var events=['save',_0x2178('0x1'),_0x2178('0x2')];function createListener(_0x58b4bd,_0x58aacd){return function(_0x4df6dc){_0x58aacd[_0x2178('0x3')](_0x58b4bd,_0x4df6dc);};}function removeListener(_0x3888cb,_0x4b378c){return function(){FaxMessageEvents[_0x2178('0x4')](_0x3888cb,_0x4b378c);};}exports[_0x2178('0x5')]=function(_0x3940f3){for(var _0x4f6c6b=0x0,_0x3fc684=events[_0x2178('0x6')];_0x4f6c6b<_0x3fc684;_0x4f6c6b++){var _0x4deea2=events[_0x4f6c6b];var _0x10d8b7=createListener(_0x2178('0x7')+_0x4deea2,_0x3940f3);FaxMessageEvents['on'](_0x4deea2,_0x10d8b7);}}; \ No newline at end of file +var _0xd806=['removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x172d2c,_0x9bb44a){var _0x41c113=function(_0x58a546){while(--_0x58a546){_0x172d2c['push'](_0x172d2c['shift']());}};_0x41c113(++_0x9bb44a);}(_0xd806,0x190));var _0x6d80=function(_0x179ba4,_0x465ced){_0x179ba4=_0x179ba4-0x0;var _0x425bcd=_0xd806[_0x179ba4];return _0x425bcd;};'use strict';var FaxMessageEvents=require(_0x6d80('0x0'));var events=[_0x6d80('0x1'),_0x6d80('0x2'),_0x6d80('0x3')];function createListener(_0x385fc0,_0x190b88){return function(_0x582824){_0x190b88[_0x6d80('0x4')](_0x385fc0,_0x582824);};}function removeListener(_0x1f0a91,_0x4173c5){return function(){FaxMessageEvents[_0x6d80('0x5')](_0x1f0a91,_0x4173c5);};}exports[_0x6d80('0x6')]=function(_0x10e5f1){for(var _0x41744e=0x0,_0x160ad0=events[_0x6d80('0x7')];_0x41744e<_0x160ad0;_0x41744e++){var _0xbd5060=events[_0x41744e];var _0x2bd265=createListener(_0x6d80('0x8')+_0xbd5060,_0x10e5f1);FaxMessageEvents['on'](_0xbd5060,_0x2bd265);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b8090a5..6e0372b 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 _0xbee3=['update','/:id/accept','accept','/:id/reject','reject','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','fax','create','put'];(function(_0x10b31a,_0x379ff4){var _0x222445=function(_0x37d71b){while(--_0x37d71b){_0x10b31a['push'](_0x10b31a['shift']());}};_0x222445(++_0x379ff4);}(_0xbee3,0xd5));var _0x3bee=function(_0x2daad0,_0x173afe){_0x2daad0=_0x2daad0-0x0;var _0x56d367=_0xbee3[_0x2daad0];return _0x56d367;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var controller=require('./faxMessage.controller');router[_0x3bee('0x6')]('/',auth[_0x3bee('0x7')](),controller['index']);router[_0x3bee('0x6')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x6')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller['show']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),interaction['tracked'](_0x3bee('0xe'),'faxmessage:create'),controller[_0x3bee('0xf')]);router[_0x3bee('0x10')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x11')]);router[_0x3bee('0x10')](_0x3bee('0x12'),auth['isAuthenticated'](),controller[_0x3bee('0x13')]);router[_0x3bee('0x10')](_0x3bee('0x14'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x15')]);router['delete']('/:id',auth[_0x3bee('0x7')](),controller['destroy']);module[_0x3bee('0x16')]=router; \ No newline at end of file +var _0xa571=['download','post','tracked','fax','put','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/download'];(function(_0x40034b,_0x1b6e23){var _0x51cd9a=function(_0x194c2a){while(--_0x194c2a){_0x40034b['push'](_0x40034b['shift']());}};_0x51cd9a(++_0x1b6e23);}(_0xa571,0x107));var _0x1a57=function(_0xdd9a5f,_0x3ced93){_0xdd9a5f=_0xdd9a5f-0x0;var _0x3464b7=_0xa571[_0xdd9a5f];return _0x3464b7;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxMessage.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['describe']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')]('/',auth[_0x1a57('0x8')](),interaction[_0x1a57('0xf')](_0x1a57('0x10'),'faxmessage:create'),controller['create']);router[_0x1a57('0x11')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['update']);router[_0x1a57('0x11')](_0x1a57('0x12'),auth['isAuthenticated'](),controller[_0x1a57('0x13')]);router['put'](_0x1a57('0x14'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/:id',auth[_0x1a57('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 87f4e85..eb6f385 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 _0x95c2=['rrmemory','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x4a2b3c,_0xc69f59){var _0x4b081b=function(_0x3dfcb1){while(--_0x3dfcb1){_0x4a2b3c['push'](_0x4a2b3c['shift']());}};_0x4b081b(++_0xc69f59);}(_0x95c2,0x9a));var _0x295c=function(_0x105f46,_0x165f39){_0x105f46=_0x105f46-0x0;var _0x171b15=_0x95c2[_0x105f46];return _0x171b15;};'use strict';var Sequelize=require(_0x295c('0x0'));module[_0x295c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x295c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x295c('0x3')]},'timeout':{'type':Sequelize[_0x295c('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x295c('0x5')](_0x295c('0x6'),'beepall',_0x295c('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x295c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0984=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x0984,0xff));var _0x4098=function(_0x4a88b5,_0x5cd99c){_0x4a88b5=_0x4a88b5-0x0;var _0xc55b9b=_0x0984[_0x4a88b5];return _0xc55b9b;};'use strict';var Sequelize=require(_0x4098('0x0'));module[_0x4098('0x1')]={'name':{'type':Sequelize[_0x4098('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4098('0x2')]},'timeout':{'type':Sequelize[_0x4098('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4098('0x4')](_0x4098('0x5'),'beepall',_0x4098('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4098('0x3')],'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 8a3644b..5025146 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 _0xe2bc=['Team','pick','addTeams','ids','online','interface','Agents','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','where','FaxQueue','include','findAll','rows','catch','show','params','keys','query','filters','intersection','model','attributes','fields','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','merge','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne'];(function(_0x5c790d,_0xa33b81){var _0x4b03cb=function(_0x5e87c0){while(--_0x5e87c0){_0x5c790d['push'](_0x5c790d['shift']());}};_0x4b03cb(++_0xa33b81);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xe2bc[_0x1203f];return _0x365f0a;};'use strict';var BPromise=require(_0xce2b('0x0'));var util=require('util');var _=require(_0xce2b('0x1'));var squel=require('squel');var Redis=require(_0xce2b('0x2'));var qs=require(_0xce2b('0x3'));var logger=require(_0xce2b('0x4'))(_0xce2b('0x5'));var config=require(_0xce2b('0x6'));var db=require('../../mysqldb')['db'];config[_0xce2b('0x7')]=_[_0xce2b('0x8')](config[_0xce2b('0x7')],{'host':_0xce2b('0x9'),'port':0x18eb});var socket=require(_0xce2b('0xa'))(new Redis(config['redis']));require(_0xce2b('0xb'))[_0xce2b('0xc')](socket);function respondWithStatusCode(_0x53c0de,_0x97112a){_0x97112a=_0x97112a||0xcc;return function(_0x7dee3c){if(_0x7dee3c){return _0x53c0de[_0xce2b('0xd')](_0x97112a);}return _0x53c0de[_0xce2b('0xe')](_0x97112a)[_0xce2b('0xf')]();};}function respondWithResult(_0xc6cdb,_0x3eae6d){_0x3eae6d=_0x3eae6d||0xc8;return function(_0xa7941){if(_0xa7941){return _0xc6cdb[_0xce2b('0xe')](_0x3eae6d)[_0xce2b('0x10')](_0xa7941);}};}function respondWithFilteredResult(_0x47a597,_0x46f2a1){return function(_0x5dca7e){if(_0x5dca7e){var _0xf7ae89=typeof _0x46f2a1[_0xce2b('0x11')]===_0xce2b('0x12')&&typeof _0x46f2a1[_0xce2b('0x13')]===_0xce2b('0x12');var _0x422c23=_0x5dca7e[_0xce2b('0x14')];var _0x368499=_0xf7ae89?0x0:_0x46f2a1['offset'];var _0x308391=_0xf7ae89?_0x5dca7e[_0xce2b('0x14')]:_0x46f2a1['offset']+_0x46f2a1['limit'];var _0x48f890;if(_0x308391>=_0x422c23){_0x308391=_0x422c23;_0x48f890=0xc8;}else{_0x48f890=0xce;}_0x47a597[_0xce2b('0xe')](_0x48f890);return _0x47a597[_0xce2b('0x15')](_0xce2b('0x16'),_0x368499+'-'+_0x308391+'/'+_0x422c23)['json'](_0x5dca7e);}return null;};}function saveUpdates(_0x5558c9){return function(_0x216c48){if(_0x216c48){return _0x216c48[_0xce2b('0x17')](_0x5558c9)[_0xce2b('0x18')](function(_0x41b4bf){return _0x41b4bf;});}return null;};}function removeEntity(_0x377aa3){return function(_0x32fd68){if(_0x32fd68){return _0x32fd68[_0xce2b('0x19')]()[_0xce2b('0x18')](function(){var _0x3716f9=_0x32fd68[_0xce2b('0x1a')]({'plain':!![]});var _0x4e92fd=_0xce2b('0x1b');return db[_0xce2b('0x1c')][_0xce2b('0x19')]({'where':{'type':_0x4e92fd,'resourceId':_0x3716f9['id']}})[_0xce2b('0x18')](function(){return _0x32fd68;});})[_0xce2b('0x18')](function(){_0x377aa3[_0xce2b('0xe')](0xcc)[_0xce2b('0xf')]();});}};}function handleEntityNotFound(_0x26f878){return function(_0x4268df){if(!_0x4268df){_0x26f878[_0xce2b('0xd')](0x194);}return _0x4268df;};}function handleError(_0x481ac9,_0x29ef4a){_0x29ef4a=_0x29ef4a||0x1f4;return function(_0x3e80b7){logger[_0xce2b('0x1d')](_0x3e80b7[_0xce2b('0x1e')]);if(_0x3e80b7[_0xce2b('0x1f')]){delete _0x3e80b7[_0xce2b('0x1f')];}_0x481ac9[_0xce2b('0xe')](_0x29ef4a)[_0xce2b('0x20')](_0x3e80b7);};}exports[_0xce2b('0x21')]=function(_0x19d178,_0x14ca70){var _0x56047c={};var _0x49a52c={'count':0x0,'rows':[]};var _0x527b03=_[_0xce2b('0x22')](db['FaxQueue'][_0xce2b('0x23')],function(_0x294af8){return{'name':_0x294af8['fieldName'],'type':_0x294af8[_0xce2b('0x24')][_0xce2b('0x25')]};});_0x56047c=qs['getOptions'](_0x527b03,_0x19d178);var _0x7bebe5={'where':_0x56047c[_0xce2b('0x26')]};return db[_0xce2b('0x27')]['count'](_0x7bebe5)['then'](function(_0x433a89){_0x49a52c[_0xce2b('0x14')]=_0x433a89;_0x56047c[_0xce2b('0x28')]=qs['include'](_0x19d178['query']);return db[_0xce2b('0x27')][_0xce2b('0x29')](_0x56047c);})[_0xce2b('0x18')](function(_0x4f9615){_0x49a52c[_0xce2b('0x2a')]=_0x4f9615;return _0x49a52c;})[_0xce2b('0x18')](respondWithFilteredResult(_0x14ca70,_0x56047c))[_0xce2b('0x2b')](handleError(_0x14ca70,null));};exports[_0xce2b('0x2c')]=function(_0x43771a,_0x476d1a){var _0x45c9ca={'raw':!![],'where':{'id':_0x43771a[_0xce2b('0x2d')]['id']}},_0x5ae887={};_0x5ae887['model']=_[_0xce2b('0x2e')](db[_0xce2b('0x27')][_0xce2b('0x23')]);_0x5ae887[_0xce2b('0x2f')]=_[_0xce2b('0x2e')](_0x43771a['query']);_0x5ae887[_0xce2b('0x30')]=_[_0xce2b('0x31')](_0x5ae887[_0xce2b('0x32')],_0x5ae887[_0xce2b('0x2f')]);_0x45c9ca[_0xce2b('0x33')]=_[_0xce2b('0x31')](_0x5ae887[_0xce2b('0x32')],qs[_0xce2b('0x34')](_0x43771a[_0xce2b('0x2f')][_0xce2b('0x34')]));_0x45c9ca[_0xce2b('0x33')]=_0x45c9ca[_0xce2b('0x33')][_0xce2b('0x35')]?_0x45c9ca[_0xce2b('0x33')]:_0x5ae887[_0xce2b('0x32')];if(_0x43771a[_0xce2b('0x2f')]['includeAll']){_0x45c9ca[_0xce2b('0x28')]=[{'all':!![]}];}_0x45c9ca=_['merge']({},_0x45c9ca,_0x43771a[_0xce2b('0x36')]);return db[_0xce2b('0x27')][_0xce2b('0x37')](_0x45c9ca)[_0xce2b('0x18')](handleEntityNotFound(_0x476d1a,null))[_0xce2b('0x18')](respondWithResult(_0x476d1a,null))[_0xce2b('0x2b')](handleError(_0x476d1a,null));};exports['create']=function(_0x12f1e1,_0xef673b){return db[_0xce2b('0x27')][_0xce2b('0x38')](_0x12f1e1[_0xce2b('0x39')],{})[_0xce2b('0x18')](function(_0x585de8){var _0xa6d26e=_0x12f1e1[_0xce2b('0x3a')][_0xce2b('0x1a')]({'plain':!![]});if(!_0xa6d26e)throw new Error(_0xce2b('0x3b'));if(_0xa6d26e[_0xce2b('0x3c')]===_0xce2b('0x3a')){var _0x5a3593=_0x585de8['get']({'plain':!![]});var _0x354277=_0xce2b('0x1b');return db[_0xce2b('0x3d')][_0xce2b('0x37')]({'where':{'name':_0x354277,'userProfileId':_0xa6d26e[_0xce2b('0x3e')]},'raw':!![]})[_0xce2b('0x18')](function(_0x3fcf5e){if(_0x3fcf5e&&_0x3fcf5e[_0xce2b('0x3f')]===0x0){return db[_0xce2b('0x1c')][_0xce2b('0x38')]({'name':_0x5a3593[_0xce2b('0x1f')],'resourceId':_0x5a3593['id'],'type':_0x3fcf5e[_0xce2b('0x1f')],'sectionId':_0x3fcf5e['id']},{})[_0xce2b('0x18')](function(){return _0x585de8;});}else{return _0x585de8;}})[_0xce2b('0x2b')](function(_0x4ee759){logger['error'](_0xce2b('0x40'),_0x4ee759);throw _0x4ee759;});}return _0x585de8;})[_0xce2b('0x18')](respondWithResult(_0xef673b,0xc9))['catch'](handleError(_0xef673b,null));};exports[_0xce2b('0x17')]=function(_0x4cba66,_0x2aad8a){if(_0x4cba66[_0xce2b('0x39')]['id']){delete _0x4cba66[_0xce2b('0x39')]['id'];}return db['FaxQueue'][_0xce2b('0x37')]({'where':{'id':_0x4cba66[_0xce2b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2aad8a,null))['then'](saveUpdates(_0x4cba66[_0xce2b('0x39')],null))[_0xce2b('0x18')](respondWithResult(_0x2aad8a,null))[_0xce2b('0x2b')](handleError(_0x2aad8a,null));};exports[_0xce2b('0x19')]=function(_0x1218d3,_0x4c7177){return db[_0xce2b('0x27')][_0xce2b('0x37')]({'where':{'id':_0x1218d3[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x4c7177,null))[_0xce2b('0x18')](removeEntity(_0x4c7177,null))['catch'](handleError(_0x4c7177,null));};exports[_0xce2b('0x41')]=function(_0x3207c5,_0xc7a9b4){return db[_0xce2b('0x27')][_0xce2b('0x41')]()[_0xce2b('0x18')](respondWithResult(_0xc7a9b4,null))[_0xce2b('0x2b')](handleError(_0xc7a9b4,null));};exports['getMembers']=function(_0x52909f,_0x565396){var _0x346fd5={'raw':!![],'where':{}},_0xfc823d={},_0x841c2e;return db['FaxQueue']['findOne']({'where':{'id':_0x52909f['params']['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x565396,null))[_0xce2b('0x18')](function(_0x15d45e){if(_0x15d45e){_0x841c2e=_0x15d45e['get']({'plain':!![]});_0xfc823d[_0xce2b('0x32')]=_[_0xce2b('0x2e')](db[_0xce2b('0x42')]['rawAttributes']);_0xfc823d[_0xce2b('0x2f')]=_['keys'](_0x52909f[_0xce2b('0x2f')]);_0xfc823d[_0xce2b('0x30')]=_[_0xce2b('0x31')](_0xfc823d['model'],_0xfc823d[_0xce2b('0x2f')]);_0x346fd5[_0xce2b('0x33')]=_[_0xce2b('0x31')](_0xfc823d[_0xce2b('0x32')],qs['fields'](_0x52909f[_0xce2b('0x2f')][_0xce2b('0x34')]));_0x346fd5[_0xce2b('0x33')]=_0x346fd5[_0xce2b('0x33')][_0xce2b('0x35')]?_0x346fd5['attributes']:_0xfc823d[_0xce2b('0x32')];if(!_0x52909f[_0xce2b('0x2f')][_0xce2b('0x43')](_0xce2b('0x44'))){_0x346fd5[_0xce2b('0x13')]=qs['limit'](_0x52909f[_0xce2b('0x2f')]['limit']);_0x346fd5[_0xce2b('0x11')]=qs[_0xce2b('0x11')](_0x52909f['query']['offset']);}_0x346fd5[_0xce2b('0x45')]=qs[_0xce2b('0x46')](_0x52909f[_0xce2b('0x2f')]['sort']);_0x346fd5[_0xce2b('0x26')]=qs[_0xce2b('0x30')](_['pick'](_0x52909f[_0xce2b('0x2f')],_0xfc823d[_0xce2b('0x30')]));_0x346fd5[_0xce2b('0x26')][_0xce2b('0x47')]=_0x15d45e['id'];if(_0x52909f[_0xce2b('0x2f')][_0xce2b('0x48')]){_0x346fd5['where']=_[_0xce2b('0x49')](_0x346fd5['where'],{'$or':_[_0xce2b('0x22')](_0x346fd5[_0xce2b('0x33')],function(_0x2ce9f5){var _0x105d3f={};_0x105d3f[_0x2ce9f5]={'$like':'%'+_0x52909f['query'][_0xce2b('0x48')]+'%'};return _0x105d3f;})});}_0x346fd5=_[_0xce2b('0x49')]({},_0x346fd5,_0x52909f[_0xce2b('0x36')]);return db[_0xce2b('0x42')]['findAll'](_0x346fd5);}})[_0xce2b('0x18')](function(_0x23b39e){if(_0x23b39e){return db[_0xce2b('0x4a')][_0xce2b('0x4b')]({'where':{'id':_[_0xce2b('0x22')](_0x23b39e,_0xce2b('0x4c')),'role':_0xce2b('0x4d')},'attributes':['id','name',_0xce2b('0x4e'),'updatedAt',_0xce2b('0x4f')]});}})[_0xce2b('0x18')](function(_0x2ae9ae){if(_0x2ae9ae){return{'count':_0x2ae9ae[_0xce2b('0x14')],'rows':_[_0xce2b('0x22')](_0x2ae9ae[_0xce2b('0x2a')],function(_0x3c62b4){return{'membername':_0x3c62b4[_0xce2b('0x1f')],'UserId':_0x3c62b4['id'],'queue_name':_0x841c2e['name'],'FaxQueueId':_0x841c2e['id'],'interface':util[_0xce2b('0x50')](_0xce2b('0x51'),_0xce2b('0x52'),_0x3c62b4[_0xce2b('0x1f')]),'penalty':0x0,'paused':_0x3c62b4[_0xce2b('0x4e')],'createdAt':_0x3c62b4['createdAt'],'updatedAt':_0x3c62b4[_0xce2b('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xce2b('0x18')](respondWithFilteredResult(_0x565396,_0x346fd5))['catch'](handleError(_0x565396,null));};exports[_0xce2b('0x54')]=function(_0x287072,_0xd0ed7a){var _0x275b98={};var _0x23f0f0={};var _0x893f84;var _0x43213e;return db[_0xce2b('0x27')][_0xce2b('0x55')]({'where':{'id':_0x287072[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0xd0ed7a,null))[_0xce2b('0x18')](function(_0x6d8ce0){if(_0x6d8ce0){_0x893f84=_0x6d8ce0;_0x23f0f0[_0xce2b('0x32')]=_['keys'](db[_0xce2b('0x56')][_0xce2b('0x23')]);_0x23f0f0[_0xce2b('0x2f')]=_['keys'](_0x287072[_0xce2b('0x2f')]);_0x23f0f0[_0xce2b('0x30')]=_['intersection'](_0x23f0f0[_0xce2b('0x32')],_0x23f0f0[_0xce2b('0x2f')]);_0x275b98['attributes']=_[_0xce2b('0x31')](_0x23f0f0[_0xce2b('0x32')],qs[_0xce2b('0x34')](_0x287072[_0xce2b('0x2f')][_0xce2b('0x34')]));_0x275b98[_0xce2b('0x33')]=_0x275b98[_0xce2b('0x33')]['length']?_0x275b98[_0xce2b('0x33')]:_0x23f0f0[_0xce2b('0x32')];_0x275b98['order']=qs[_0xce2b('0x46')](_0x287072[_0xce2b('0x2f')][_0xce2b('0x46')]);_0x275b98[_0xce2b('0x26')]=qs['filters'](_[_0xce2b('0x57')](_0x287072[_0xce2b('0x2f')],_0x23f0f0['filters']));if(_0x287072['query']['filter']){_0x275b98['where']=_[_0xce2b('0x49')](_0x275b98[_0xce2b('0x26')],{'$or':_['map'](_0x275b98['attributes'],function(_0x14b437){var _0x1b1f79={};_0x1b1f79[_0x14b437]={'$like':'%'+_0x287072[_0xce2b('0x2f')]['filter']+'%'};return _0x1b1f79;})});}_0x275b98=_[_0xce2b('0x49')]({},_0x275b98,_0x287072[_0xce2b('0x36')]);return _0x893f84['getTeams'](_0x275b98);}})[_0xce2b('0x18')](function(_0xeca50f){if(_0xeca50f){_0x43213e=_0xeca50f[_0xce2b('0x35')];if(!_0x287072[_0xce2b('0x2f')]['hasOwnProperty'](_0xce2b('0x44'))){_0x275b98[_0xce2b('0x13')]=qs['limit'](_0x287072[_0xce2b('0x2f')]['limit']);_0x275b98['offset']=qs[_0xce2b('0x11')](_0x287072[_0xce2b('0x2f')][_0xce2b('0x11')]);}return _0x893f84[_0xce2b('0x54')](_0x275b98);}})['then'](function(_0x5a57c3){if(_0x5a57c3){return _0x5a57c3?{'count':_0x43213e,'rows':_0x5a57c3}:null;}})[_0xce2b('0x18')](respondWithResult(_0xd0ed7a,null))[_0xce2b('0x2b')](handleError(_0xd0ed7a,null));};exports[_0xce2b('0x58')]=function(_0x28338c,_0x6c0669){var _0x293339=_0x28338c['body'][_0xce2b('0x59')];return db[_0xce2b('0x56')][_0xce2b('0x29')]({'where':{'id':_0x293339},'attributes':['id'],'include':[{'model':db[_0xce2b('0x4a')],'as':'Agents','attributes':['id','name',_0xce2b('0x5a'),'voicePause',_0xce2b('0x5b')],'raw':!![]}]})[_0xce2b('0x18')](function(_0x13bc87){if(_0x13bc87){var _0x559aba=_['flatMap'](_0x13bc87,function(_0x1de23b){var _0x44139b=_0x1de23b[_0xce2b('0x1a')]({'plain':!![]});return _0x44139b[_0xce2b('0x5c')];});return db[_0xce2b('0x27')]['find']({'where':{'id':_0x28338c[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](function(_0x2014c5){return db[_0xce2b('0x5d')][_0xce2b('0x5e')](function(_0x7ef707){return _0x2014c5['addTeams'](_0x293339,{'transaction':_0x7ef707})[_0xce2b('0x18')](function(){return BPromise['each'](_0x559aba,function(_0x581897){return db[_0xce2b('0x42')][_0xce2b('0x5f')]({'where':{'UserId':_0x581897['id'],'FaxQueueId':_0x28338c[_0xce2b('0x2d')]['id']},'transaction':_0x7ef707});});})['then'](function(){_0x559aba[_0xce2b('0x60')](function(_0x5f02f8){socket[_0xce2b('0x61')]('userFaxQueue:save',{'UserId':_0x5f02f8['id'],'FaxQueueId':_0x2014c5['id']});});});});});}})['then'](respondWithStatusCode(_0x6c0669,null))['catch'](handleError(_0x6c0669,null));};exports[_0xce2b('0x62')]=function(_0x36986d,_0x49c650){return db['Team']['findAll']({'where':{'id':_0x36986d['query'][_0xce2b('0x59')]},'attributes':['id'],'include':[{'model':db[_0xce2b('0x4a')],'as':_0xce2b('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49c650,null))[_0xce2b('0x18')](function(_0x5ea866){var _0x2c887d=_[_0xce2b('0x22')](_0x5ea866,'id');var _0x433d31=[];var _0x4d902f=[];var _0x3b1ad=squel[_0xce2b('0x63')]();_0x3b1ad[_0xce2b('0x64')](_0xce2b('0x65'))[_0xce2b('0x66')](_0xce2b('0x67'),'tq')[_0xce2b('0x68')](_0xce2b('0x69'),'ut',_0xce2b('0x6a'))[_0xce2b('0x26')](_0xce2b('0x6b'),_0x36986d[_0xce2b('0x2d')]['id']);for(var _0x436cf7=0x0;_0x436cf7<_0x5ea866[_0xce2b('0x35')];_0x436cf7+=0x1){let _0x5a6470=_0x5ea866[_0x436cf7];for(var _0x54de5f=0x0;_0x54de5f<_0x5a6470[_0xce2b('0x5c')][_0xce2b('0x35')];_0x54de5f+=0x1){let _0x4fabe8=_0x5a6470[_0xce2b('0x5c')][_0x54de5f];var _0x568862=_0x3b1ad[_0xce2b('0x6c')]();_0x568862[_0xce2b('0x26')]('ut.UserId\x20=\x20?',_0x4fabe8['id']);_0x4d902f[_0xce2b('0x6d')](db['sequelize'][_0xce2b('0x2f')](_0x568862[_0xce2b('0x6e')](),{'type':db[_0xce2b('0x5d')]['QueryTypes'][_0xce2b('0x6f')]})[_0xce2b('0x18')](function(_0x2d087e){if(_0x2d087e['length']===0x1){return _0x4fabe8['id'];}else{var _0xbc41b8=_[_0xce2b('0x70')](_[_0xce2b('0x22')](_0x2d087e,_0xce2b('0x71')),function(_0x2d32af){return _[_0xce2b('0x72')](_0x2c887d,_0x2d32af);});if(_0xbc41b8){return _0x4fabe8['id'];}}}));}}return BPromise[_0xce2b('0x73')](_0x4d902f)[_0xce2b('0x18')](function(_0x557c84){_0x433d31=_(_0x433d31)[_0xce2b('0x74')](_0x557c84)[_0xce2b('0x75')]()[_0xce2b('0x76')]();return db[_0xce2b('0x27')][_0xce2b('0x37')]({'where':{'id':_0x36986d[_0xce2b('0x2d')]['id']}})['then'](function(_0xc36ed8){return db[_0xce2b('0x5d')][_0xce2b('0x5e')](function(_0x52f9c1){return _0xc36ed8[_0xce2b('0x62')](_0x36986d[_0xce2b('0x2f')]['ids'],{'transaction':_0x52f9c1})[_0xce2b('0x18')](function(){if(!_['isEmpty'](_0x433d31)){return _0xc36ed8[_0xce2b('0x77')](_0x433d31,{'transaction':_0x52f9c1});}})[_0xce2b('0x18')](function(){_0x433d31[_0xce2b('0x60')](function(_0x3fc6d3){socket[_0xce2b('0x61')](_0xce2b('0x78'),{'UserId':_0x3fc6d3,'FaxQueueId':_0xc36ed8['id']});});});});});});})[_0xce2b('0x18')](respondWithStatusCode(_0x49c650,null))[_0xce2b('0x2b')](handleError(_0x49c650,null));};exports[_0xce2b('0x79')]=function(_0x1678df,_0x4c2ffd){return db[_0xce2b('0x27')][_0xce2b('0x37')]({'where':{'id':_0x1678df[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x4c2ffd,null))['then'](function(_0x6a2546){if(_0x6a2546){return _0x6a2546[_0xce2b('0x79')](_0x1678df[_0xce2b('0x39')]['ids'],_[_0xce2b('0x7a')](_0x1678df[_0xce2b('0x39')],['ids','id'])||{})[_0xce2b('0x7b')](function(_0x2a3fa){for(var _0x3ed2c6=0x0;_0x3ed2c6<_0x1678df['body'][_0xce2b('0x59')]['length'];_0x3ed2c6+=0x1){socket[_0xce2b('0x61')](_0xce2b('0x7c'),{'UserId':Number(_0x1678df[_0xce2b('0x39')][_0xce2b('0x59')][_0x3ed2c6]),'FaxQueueId':Number(_0x1678df[_0xce2b('0x2d')]['id'])});}return _0x2a3fa;});}})[_0xce2b('0x18')](respondWithResult(_0x4c2ffd,null))[_0xce2b('0x2b')](handleError(_0x4c2ffd,null));};exports[_0xce2b('0x77')]=function(_0x2d27f6,_0x13fdec){return db['FaxQueue']['find']({'where':{'id':_0x2d27f6['params']['id']}})['then'](handleEntityNotFound(_0x13fdec,null))[_0xce2b('0x18')](function(_0x15d7a1){if(_0x15d7a1){return _0x15d7a1[_0xce2b('0x77')](_0x2d27f6['query'][_0xce2b('0x59')])[_0xce2b('0x18')](function(){if(_[_0xce2b('0x7d')](_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')])){for(var _0x330d7a=0x0;_0x330d7a<_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')][_0xce2b('0x35')];_0x330d7a+=0x1){socket['emit'](_0xce2b('0x78'),{'UserId':Number(_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')][_0x330d7a]),'FaxQueueId':Number(_0x2d27f6[_0xce2b('0x2d')]['id'])});}}else{socket[_0xce2b('0x61')](_0xce2b('0x78'),{'UserId':Number(_0x2d27f6[_0xce2b('0x2f')][_0xce2b('0x59')]),'FaxQueueId':Number(_0x2d27f6[_0xce2b('0x2d')]['id'])});}});}})[_0xce2b('0x18')](respondWithStatusCode(_0x13fdec,null))[_0xce2b('0x2b')](handleError(_0x13fdec,null));};exports[_0xce2b('0x7e')]=function(_0x473c8f,_0x36ec17){var _0x11b765={};var _0x5b2948={};var _0x6f09c9;var _0x56d87b;return db['FaxQueue'][_0xce2b('0x55')]({'where':{'id':_0x473c8f[_0xce2b('0x2d')]['id']}})[_0xce2b('0x18')](handleEntityNotFound(_0x36ec17,null))[_0xce2b('0x18')](function(_0x15819a){if(_0x15819a){_0x6f09c9=_0x15819a;_0x5b2948['model']=_[_0xce2b('0x2e')](db['User'][_0xce2b('0x23')]);_0x5b2948['query']=_['keys'](_0x473c8f['query']);_0x5b2948[_0xce2b('0x30')]=_[_0xce2b('0x31')](_0x5b2948['model'],_0x5b2948[_0xce2b('0x2f')]);_0x11b765['attributes']=_[_0xce2b('0x31')](_0x5b2948['model'],qs[_0xce2b('0x34')](_0x473c8f[_0xce2b('0x2f')]['fields']));_0x11b765[_0xce2b('0x33')]=_0x11b765[_0xce2b('0x33')][_0xce2b('0x35')]?_0x11b765[_0xce2b('0x33')]:_0x5b2948[_0xce2b('0x32')];_0x11b765[_0xce2b('0x45')]=qs['sort'](_0x473c8f['query'][_0xce2b('0x46')]);_0x11b765[_0xce2b('0x26')]=qs[_0xce2b('0x30')](_[_0xce2b('0x57')](_0x473c8f['query'],_0x5b2948[_0xce2b('0x30')]));if(_0x473c8f[_0xce2b('0x2f')][_0xce2b('0x48')]){_0x11b765[_0xce2b('0x26')]=_[_0xce2b('0x49')](_0x11b765[_0xce2b('0x26')],{'$or':_[_0xce2b('0x22')](_0x11b765[_0xce2b('0x33')],function(_0x538230){var _0x5fd11d={};_0x5fd11d[_0x538230]={'$like':'%'+_0x473c8f['query'][_0xce2b('0x48')]+'%'};return _0x5fd11d;})});}_0x11b765=_[_0xce2b('0x49')]({},_0x11b765,_0x473c8f[_0xce2b('0x36')]);return _0x6f09c9[_0xce2b('0x7e')](_0x11b765);}})[_0xce2b('0x18')](function(_0x17905f){if(_0x17905f){_0x56d87b=_0x17905f['length'];if(!_0x473c8f[_0xce2b('0x2f')][_0xce2b('0x43')]('nolimit')){_0x11b765[_0xce2b('0x13')]=qs['limit'](_0x473c8f['query']['limit']);_0x11b765[_0xce2b('0x11')]=qs[_0xce2b('0x11')](_0x473c8f[_0xce2b('0x2f')][_0xce2b('0x11')]);}return _0x6f09c9['getAgents'](_0x11b765);}})[_0xce2b('0x18')](function(_0x15c3b2){if(_0x15c3b2){return _0x15c3b2?{'count':_0x56d87b,'rows':_0x15c3b2}:null;}})['then'](respondWithResult(_0x36ec17,null))[_0xce2b('0x2b')](handleError(_0x36ec17,null));}; \ No newline at end of file +var _0x2a07=['bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','get','UserProfileResource','error','stack','name','map','FaxQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','show','params','model','keys','filters','attributes','intersection','fields','length','merge','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','filter','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','pick','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','userFaxQueue:remove','spread','removeAgents','getAgents'];(function(_0x1a5c54,_0x164fc2){var _0x58c6f3=function(_0x5b0d0f){while(--_0x5b0d0f){_0x1a5c54['push'](_0x1a5c54['shift']());}};_0x58c6f3(++_0x164fc2);}(_0x2a07,0x74));var _0x72a0=function(_0x293866,_0x33ab3e){_0x293866=_0x293866-0x0;var _0x4b33c8=_0x2a07[_0x293866];return _0x4b33c8;};'use strict';var BPromise=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));var squel=require(_0x72a0('0x3'));var Redis=require(_0x72a0('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x72a0('0x5'))(_0x72a0('0x6'));var config=require(_0x72a0('0x7'));var db=require(_0x72a0('0x8'))['db'];config[_0x72a0('0x9')]=_[_0x72a0('0xa')](config[_0x72a0('0x9')],{'host':_0x72a0('0xb'),'port':0x18eb});var socket=require(_0x72a0('0xc'))(new Redis(config[_0x72a0('0x9')]));require(_0x72a0('0xd'))[_0x72a0('0xe')](socket);function respondWithStatusCode(_0x22270e,_0x1d32e9){_0x1d32e9=_0x1d32e9||0xcc;return function(_0x55b3e9){if(_0x55b3e9){return _0x22270e[_0x72a0('0xf')](_0x1d32e9);}return _0x22270e['status'](_0x1d32e9)[_0x72a0('0x10')]();};}function respondWithResult(_0x1109f7,_0x54abf6){_0x54abf6=_0x54abf6||0xc8;return function(_0x46fb8a){if(_0x46fb8a){return _0x1109f7[_0x72a0('0x11')](_0x54abf6)[_0x72a0('0x12')](_0x46fb8a);}};}function respondWithFilteredResult(_0x44d7cf,_0x975c27){return function(_0x516c08){if(_0x516c08){var _0x130797=typeof _0x975c27[_0x72a0('0x13')]===_0x72a0('0x14')&&typeof _0x975c27[_0x72a0('0x15')]===_0x72a0('0x14');var _0x324cbd=_0x516c08[_0x72a0('0x16')];var _0x5e0b5f=_0x130797?0x0:_0x975c27['offset'];var _0xe103dc=_0x130797?_0x516c08[_0x72a0('0x16')]:_0x975c27[_0x72a0('0x13')]+_0x975c27[_0x72a0('0x15')];var _0x23b001;if(_0xe103dc>=_0x324cbd){_0xe103dc=_0x324cbd;_0x23b001=0xc8;}else{_0x23b001=0xce;}_0x44d7cf[_0x72a0('0x11')](_0x23b001);return _0x44d7cf['set'](_0x72a0('0x17'),_0x5e0b5f+'-'+_0xe103dc+'/'+_0x324cbd)[_0x72a0('0x12')](_0x516c08);}return null;};}function saveUpdates(_0x16ac70){return function(_0xb7e22d){if(_0xb7e22d){return _0xb7e22d[_0x72a0('0x18')](_0x16ac70)['then'](function(_0x100d8f){return _0x100d8f;});}return null;};}function removeEntity(_0x42e9ec){return function(_0x131b73){if(_0x131b73){return _0x131b73['destroy']()[_0x72a0('0x19')](function(){var _0x46e9e3=_0x131b73[_0x72a0('0x1a')]({'plain':!![]});var _0x41614d='FaxQueues';return db[_0x72a0('0x1b')]['destroy']({'where':{'type':_0x41614d,'resourceId':_0x46e9e3['id']}})[_0x72a0('0x19')](function(){return _0x131b73;});})[_0x72a0('0x19')](function(){_0x42e9ec[_0x72a0('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35da77){return function(_0x1849d1){if(!_0x1849d1){_0x35da77[_0x72a0('0xf')](0x194);}return _0x1849d1;};}function handleError(_0x3d1965,_0x5d6145){_0x5d6145=_0x5d6145||0x1f4;return function(_0x38a7ba){logger[_0x72a0('0x1c')](_0x38a7ba[_0x72a0('0x1d')]);if(_0x38a7ba[_0x72a0('0x1e')]){delete _0x38a7ba[_0x72a0('0x1e')];}_0x3d1965[_0x72a0('0x11')](_0x5d6145)['send'](_0x38a7ba);};}exports['index']=function(_0x468d66,_0x2d8b68){var _0x123df4={};var _0x1504ed={'count':0x0,'rows':[]};var _0xf5cb49=_[_0x72a0('0x1f')](db[_0x72a0('0x20')][_0x72a0('0x21')],function(_0xee99e2){return{'name':_0xee99e2[_0x72a0('0x22')],'type':_0xee99e2['type'][_0x72a0('0x23')]};});_0x123df4=qs[_0x72a0('0x24')](_0xf5cb49,_0x468d66);var _0xc22d18={'where':_0x123df4[_0x72a0('0x25')]};return db[_0x72a0('0x20')][_0x72a0('0x16')](_0xc22d18)[_0x72a0('0x19')](function(_0x12eda2){_0x1504ed[_0x72a0('0x16')]=_0x12eda2;_0x123df4[_0x72a0('0x26')]=qs['include'](_0x468d66[_0x72a0('0x27')]);return db[_0x72a0('0x20')][_0x72a0('0x28')](_0x123df4);})[_0x72a0('0x19')](function(_0x13c04){_0x1504ed[_0x72a0('0x29')]=_0x13c04;return _0x1504ed;})[_0x72a0('0x19')](respondWithFilteredResult(_0x2d8b68,_0x123df4))['catch'](handleError(_0x2d8b68,null));};exports[_0x72a0('0x2a')]=function(_0x2c884f,_0x316e1d){var _0x197591={'raw':!![],'where':{'id':_0x2c884f[_0x72a0('0x2b')]['id']}},_0x89d598={};_0x89d598[_0x72a0('0x2c')]=_[_0x72a0('0x2d')](db['FaxQueue'][_0x72a0('0x21')]);_0x89d598[_0x72a0('0x27')]=_[_0x72a0('0x2d')](_0x2c884f['query']);_0x89d598[_0x72a0('0x2e')]=_['intersection'](_0x89d598[_0x72a0('0x2c')],_0x89d598[_0x72a0('0x27')]);_0x197591[_0x72a0('0x2f')]=_[_0x72a0('0x30')](_0x89d598[_0x72a0('0x2c')],qs[_0x72a0('0x31')](_0x2c884f[_0x72a0('0x27')][_0x72a0('0x31')]));_0x197591[_0x72a0('0x2f')]=_0x197591[_0x72a0('0x2f')][_0x72a0('0x32')]?_0x197591[_0x72a0('0x2f')]:_0x89d598['model'];if(_0x2c884f[_0x72a0('0x27')]['includeAll']){_0x197591[_0x72a0('0x26')]=[{'all':!![]}];}_0x197591=_[_0x72a0('0x33')]({},_0x197591,_0x2c884f[_0x72a0('0x34')]);return db[_0x72a0('0x20')][_0x72a0('0x35')](_0x197591)[_0x72a0('0x19')](handleEntityNotFound(_0x316e1d,null))[_0x72a0('0x19')](respondWithResult(_0x316e1d,null))[_0x72a0('0x36')](handleError(_0x316e1d,null));};exports[_0x72a0('0x37')]=function(_0x4c1f43,_0x4a973a){return db[_0x72a0('0x20')][_0x72a0('0x37')](_0x4c1f43[_0x72a0('0x38')],{})[_0x72a0('0x19')](function(_0x15c381){var _0x512a06=_0x4c1f43[_0x72a0('0x39')][_0x72a0('0x1a')]({'plain':!![]});if(!_0x512a06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x512a06[_0x72a0('0x3a')]==='user'){var _0x582c84=_0x15c381['get']({'plain':!![]});var _0x17a65e='FaxQueues';return db[_0x72a0('0x3b')][_0x72a0('0x35')]({'where':{'name':_0x17a65e,'userProfileId':_0x512a06[_0x72a0('0x3c')]},'raw':!![]})[_0x72a0('0x19')](function(_0x4bf56e){if(_0x4bf56e&&_0x4bf56e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x582c84[_0x72a0('0x1e')],'resourceId':_0x582c84['id'],'type':_0x4bf56e[_0x72a0('0x1e')],'sectionId':_0x4bf56e['id']},{})['then'](function(){return _0x15c381;});}else{return _0x15c381;}})[_0x72a0('0x36')](function(_0x35d790){logger['error'](_0x72a0('0x3d'),_0x35d790);throw _0x35d790;});}return _0x15c381;})[_0x72a0('0x19')](respondWithResult(_0x4a973a,0xc9))[_0x72a0('0x36')](handleError(_0x4a973a,null));};exports[_0x72a0('0x18')]=function(_0x340153,_0x341451){if(_0x340153['body']['id']){delete _0x340153[_0x72a0('0x38')]['id'];}return db['FaxQueue'][_0x72a0('0x35')]({'where':{'id':_0x340153['params']['id']}})[_0x72a0('0x19')](handleEntityNotFound(_0x341451,null))[_0x72a0('0x19')](saveUpdates(_0x340153['body'],null))[_0x72a0('0x19')](respondWithResult(_0x341451,null))['catch'](handleError(_0x341451,null));};exports[_0x72a0('0x3e')]=function(_0x1c07b9,_0x13254c){return db['FaxQueue'][_0x72a0('0x35')]({'where':{'id':_0x1c07b9[_0x72a0('0x2b')]['id']}})[_0x72a0('0x19')](handleEntityNotFound(_0x13254c,null))['then'](removeEntity(_0x13254c,null))['catch'](handleError(_0x13254c,null));};exports[_0x72a0('0x3f')]=function(_0x590572,_0x28e1a0){return db[_0x72a0('0x20')][_0x72a0('0x3f')]()[_0x72a0('0x19')](respondWithResult(_0x28e1a0,null))[_0x72a0('0x36')](handleError(_0x28e1a0,null));};exports[_0x72a0('0x40')]=function(_0x451558,_0x2f068c){var _0x2efa92={'raw':!![],'where':{}},_0x5029ca={},_0x4fae3d;return db[_0x72a0('0x20')][_0x72a0('0x41')]({'where':{'id':_0x451558[_0x72a0('0x2b')]['id']}})[_0x72a0('0x19')](handleEntityNotFound(_0x2f068c,null))[_0x72a0('0x19')](function(_0x2de809){if(_0x2de809){_0x4fae3d=_0x2de809['get']({'plain':!![]});_0x5029ca['model']=_[_0x72a0('0x2d')](db[_0x72a0('0x42')][_0x72a0('0x21')]);_0x5029ca[_0x72a0('0x27')]=_[_0x72a0('0x2d')](_0x451558[_0x72a0('0x27')]);_0x5029ca[_0x72a0('0x2e')]=_[_0x72a0('0x30')](_0x5029ca[_0x72a0('0x2c')],_0x5029ca[_0x72a0('0x27')]);_0x2efa92['attributes']=_[_0x72a0('0x30')](_0x5029ca[_0x72a0('0x2c')],qs[_0x72a0('0x31')](_0x451558[_0x72a0('0x27')][_0x72a0('0x31')]));_0x2efa92['attributes']=_0x2efa92[_0x72a0('0x2f')]['length']?_0x2efa92['attributes']:_0x5029ca[_0x72a0('0x2c')];if(!_0x451558[_0x72a0('0x27')][_0x72a0('0x43')](_0x72a0('0x44'))){_0x2efa92[_0x72a0('0x15')]=qs['limit'](_0x451558[_0x72a0('0x27')][_0x72a0('0x15')]);_0x2efa92['offset']=qs['offset'](_0x451558[_0x72a0('0x27')][_0x72a0('0x13')]);}_0x2efa92[_0x72a0('0x45')]=qs[_0x72a0('0x46')](_0x451558[_0x72a0('0x27')][_0x72a0('0x46')]);_0x2efa92[_0x72a0('0x25')]=qs[_0x72a0('0x2e')](_['pick'](_0x451558[_0x72a0('0x27')],_0x5029ca['filters']));_0x2efa92['where']['FaxQueueId']=_0x2de809['id'];if(_0x451558[_0x72a0('0x27')][_0x72a0('0x47')]){_0x2efa92['where']=_[_0x72a0('0x33')](_0x2efa92['where'],{'$or':_[_0x72a0('0x1f')](_0x2efa92['attributes'],function(_0x51335e){var _0x4184f5={};_0x4184f5[_0x51335e]={'$like':'%'+_0x451558[_0x72a0('0x27')]['filter']+'%'};return _0x4184f5;})});}_0x2efa92=_[_0x72a0('0x33')]({},_0x2efa92,_0x451558['options']);return db[_0x72a0('0x42')]['findAll'](_0x2efa92);}})['then'](function(_0x312b5e){if(_0x312b5e){return db[_0x72a0('0x48')][_0x72a0('0x49')]({'where':{'id':_['map'](_0x312b5e,'UserId'),'role':_0x72a0('0x4a')},'attributes':['id','name',_0x72a0('0x4b'),_0x72a0('0x4c'),_0x72a0('0x4d')]});}})[_0x72a0('0x19')](function(_0x11a750){if(_0x11a750){return{'count':_0x11a750[_0x72a0('0x16')],'rows':_[_0x72a0('0x1f')](_0x11a750[_0x72a0('0x29')],function(_0x106343){return{'membername':_0x106343[_0x72a0('0x1e')],'UserId':_0x106343['id'],'queue_name':_0x4fae3d[_0x72a0('0x1e')],'FaxQueueId':_0x4fae3d['id'],'interface':util[_0x72a0('0x4e')]('%s/%s',_0x72a0('0x4f'),_0x106343['name']),'penalty':0x0,'paused':_0x106343['faxPause'],'createdAt':_0x106343['createdAt'],'updatedAt':_0x106343['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x72a0('0x19')](respondWithFilteredResult(_0x2f068c,_0x2efa92))[_0x72a0('0x36')](handleError(_0x2f068c,null));};exports[_0x72a0('0x50')]=function(_0x4a2f94,_0x27398d){var _0x484700={};var _0xd6ab19={};var _0x1ef23f;var _0x50fa30;return db[_0x72a0('0x20')][_0x72a0('0x41')]({'where':{'id':_0x4a2f94[_0x72a0('0x2b')]['id']}})[_0x72a0('0x19')](handleEntityNotFound(_0x27398d,null))['then'](function(_0x300aa7){if(_0x300aa7){_0x1ef23f=_0x300aa7;_0xd6ab19['model']=_[_0x72a0('0x2d')](db[_0x72a0('0x51')][_0x72a0('0x21')]);_0xd6ab19['query']=_[_0x72a0('0x2d')](_0x4a2f94[_0x72a0('0x27')]);_0xd6ab19[_0x72a0('0x2e')]=_[_0x72a0('0x30')](_0xd6ab19[_0x72a0('0x2c')],_0xd6ab19['query']);_0x484700['attributes']=_[_0x72a0('0x30')](_0xd6ab19['model'],qs[_0x72a0('0x31')](_0x4a2f94['query'][_0x72a0('0x31')]));_0x484700[_0x72a0('0x2f')]=_0x484700['attributes'][_0x72a0('0x32')]?_0x484700[_0x72a0('0x2f')]:_0xd6ab19[_0x72a0('0x2c')];_0x484700['order']=qs[_0x72a0('0x46')](_0x4a2f94['query'][_0x72a0('0x46')]);_0x484700[_0x72a0('0x25')]=qs['filters'](_[_0x72a0('0x52')](_0x4a2f94['query'],_0xd6ab19['filters']));if(_0x4a2f94['query'][_0x72a0('0x47')]){_0x484700['where']=_[_0x72a0('0x33')](_0x484700['where'],{'$or':_[_0x72a0('0x1f')](_0x484700[_0x72a0('0x2f')],function(_0x143ebf){var _0x5b81d7={};_0x5b81d7[_0x143ebf]={'$like':'%'+_0x4a2f94[_0x72a0('0x27')][_0x72a0('0x47')]+'%'};return _0x5b81d7;})});}_0x484700=_[_0x72a0('0x33')]({},_0x484700,_0x4a2f94[_0x72a0('0x34')]);return _0x1ef23f[_0x72a0('0x50')](_0x484700);}})['then'](function(_0x54e925){if(_0x54e925){_0x50fa30=_0x54e925[_0x72a0('0x32')];if(!_0x4a2f94[_0x72a0('0x27')][_0x72a0('0x43')]('nolimit')){_0x484700[_0x72a0('0x15')]=qs[_0x72a0('0x15')](_0x4a2f94['query'][_0x72a0('0x15')]);_0x484700['offset']=qs[_0x72a0('0x13')](_0x4a2f94[_0x72a0('0x27')][_0x72a0('0x13')]);}return _0x1ef23f[_0x72a0('0x50')](_0x484700);}})[_0x72a0('0x19')](function(_0x1e23e9){if(_0x1e23e9){return _0x1e23e9?{'count':_0x50fa30,'rows':_0x1e23e9}:null;}})[_0x72a0('0x19')](respondWithResult(_0x27398d,null))['catch'](handleError(_0x27398d,null));};exports['addTeams']=function(_0x5676e3,_0x1ab2db){var _0x2e00a2=_0x5676e3[_0x72a0('0x38')][_0x72a0('0x53')];return db[_0x72a0('0x51')][_0x72a0('0x28')]({'where':{'id':_0x2e00a2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x72a0('0x54'),'attributes':['id',_0x72a0('0x1e'),_0x72a0('0x55'),_0x72a0('0x56'),_0x72a0('0x57')],'raw':!![]}]})[_0x72a0('0x19')](function(_0x1040ad){if(_0x1040ad){var _0x5d5dd8=_[_0x72a0('0x58')](_0x1040ad,function(_0x9fc964){var _0x130c90=_0x9fc964[_0x72a0('0x1a')]({'plain':!![]});return _0x130c90[_0x72a0('0x54')];});return db[_0x72a0('0x20')]['find']({'where':{'id':_0x5676e3[_0x72a0('0x2b')]['id']}})['then'](function(_0x35fc2c){return db[_0x72a0('0x59')][_0x72a0('0x5a')](function(_0x3d5edb){return _0x35fc2c[_0x72a0('0x5b')](_0x2e00a2,{'transaction':_0x3d5edb})['then'](function(){return BPromise[_0x72a0('0x5c')](_0x5d5dd8,function(_0x46a306){return db['UserFaxQueue'][_0x72a0('0x5d')]({'where':{'UserId':_0x46a306['id'],'FaxQueueId':_0x5676e3[_0x72a0('0x2b')]['id']},'transaction':_0x3d5edb});});})[_0x72a0('0x19')](function(){_0x5d5dd8[_0x72a0('0x5e')](function(_0x49a0b3){socket[_0x72a0('0x5f')](_0x72a0('0x60'),{'UserId':_0x49a0b3['id'],'FaxQueueId':_0x35fc2c['id']});});});});});}})[_0x72a0('0x19')](respondWithStatusCode(_0x1ab2db,null))[_0x72a0('0x36')](handleError(_0x1ab2db,null));};exports[_0x72a0('0x61')]=function(_0xfef0b1,_0x3c27fb){return db[_0x72a0('0x51')][_0x72a0('0x28')]({'where':{'id':_0xfef0b1[_0x72a0('0x27')][_0x72a0('0x53')]},'attributes':['id'],'include':[{'model':db[_0x72a0('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x72a0('0x19')](handleEntityNotFound(_0x3c27fb,null))[_0x72a0('0x19')](function(_0xe0411e){var _0x3cbbcd=_[_0x72a0('0x1f')](_0xe0411e,'id');var _0x3a0bd6=[];var _0x20281b=[];var _0x21db54=squel['select']();_0x21db54[_0x72a0('0x62')]('tq.TeamId')['from'](_0x72a0('0x63'),'tq')['join']('user_has_teams','ut',_0x72a0('0x64'))['where'](_0x72a0('0x65'),_0xfef0b1[_0x72a0('0x2b')]['id']);for(var _0xb4cdec=0x0;_0xb4cdec<_0xe0411e['length'];_0xb4cdec+=0x1){let _0x344a69=_0xe0411e[_0xb4cdec];for(var _0x179ca2=0x0;_0x179ca2<_0x344a69[_0x72a0('0x54')][_0x72a0('0x32')];_0x179ca2+=0x1){let _0x3d3d1f=_0x344a69['Agents'][_0x179ca2];var _0x3c11aa=_0x21db54[_0x72a0('0x66')]();_0x3c11aa[_0x72a0('0x25')]('ut.UserId\x20=\x20?',_0x3d3d1f['id']);_0x20281b[_0x72a0('0x67')](db[_0x72a0('0x59')][_0x72a0('0x27')](_0x3c11aa['toString'](),{'type':db[_0x72a0('0x59')][_0x72a0('0x68')][_0x72a0('0x69')]})[_0x72a0('0x19')](function(_0x682cca){if(_0x682cca[_0x72a0('0x32')]===0x1){return _0x3d3d1f['id'];}else{var _0xff26b1=_[_0x72a0('0x6a')](_[_0x72a0('0x1f')](_0x682cca,'TeamId'),function(_0x874ada){return _[_0x72a0('0x6b')](_0x3cbbcd,_0x874ada);});if(_0xff26b1){return _0x3d3d1f['id'];}}}));}}return BPromise[_0x72a0('0x6c')](_0x20281b)[_0x72a0('0x19')](function(_0x173cc4){_0x3a0bd6=_(_0x3a0bd6)['union'](_0x173cc4)[_0x72a0('0x6d')]()[_0x72a0('0x6e')]();return db[_0x72a0('0x20')][_0x72a0('0x35')]({'where':{'id':_0xfef0b1['params']['id']}})[_0x72a0('0x19')](function(_0x41f20f){return db[_0x72a0('0x59')]['transaction'](function(_0x5869fa){return _0x41f20f[_0x72a0('0x61')](_0xfef0b1[_0x72a0('0x27')][_0x72a0('0x53')],{'transaction':_0x5869fa})[_0x72a0('0x19')](function(){if(!_[_0x72a0('0x6f')](_0x3a0bd6)){return _0x41f20f['removeAgents'](_0x3a0bd6,{'transaction':_0x5869fa});}})['then'](function(){_0x3a0bd6['forEach'](function(_0x410f6b){socket['emit'](_0x72a0('0x70'),{'UserId':_0x410f6b,'FaxQueueId':_0x41f20f['id']});});});});});});})['then'](respondWithStatusCode(_0x3c27fb,null))['catch'](handleError(_0x3c27fb,null));};exports['addAgents']=function(_0x5035df,_0x33c9dd){return db[_0x72a0('0x20')][_0x72a0('0x35')]({'where':{'id':_0x5035df[_0x72a0('0x2b')]['id']}})['then'](handleEntityNotFound(_0x33c9dd,null))[_0x72a0('0x19')](function(_0x67a029){if(_0x67a029){return _0x67a029['addAgents'](_0x5035df[_0x72a0('0x38')][_0x72a0('0x53')],_['omit'](_0x5035df[_0x72a0('0x38')],[_0x72a0('0x53'),'id'])||{})[_0x72a0('0x71')](function(_0x561ffe){for(var _0x5e1638=0x0;_0x5e1638<_0x5035df['body'][_0x72a0('0x53')][_0x72a0('0x32')];_0x5e1638+=0x1){socket[_0x72a0('0x5f')](_0x72a0('0x60'),{'UserId':Number(_0x5035df[_0x72a0('0x38')][_0x72a0('0x53')][_0x5e1638]),'FaxQueueId':Number(_0x5035df['params']['id'])});}return _0x561ffe;});}})['then'](respondWithResult(_0x33c9dd,null))[_0x72a0('0x36')](handleError(_0x33c9dd,null));};exports[_0x72a0('0x72')]=function(_0x57550f,_0x40f2e2){return db[_0x72a0('0x20')][_0x72a0('0x35')]({'where':{'id':_0x57550f[_0x72a0('0x2b')]['id']}})[_0x72a0('0x19')](handleEntityNotFound(_0x40f2e2,null))[_0x72a0('0x19')](function(_0x7533ea){if(_0x7533ea){return _0x7533ea['removeAgents'](_0x57550f[_0x72a0('0x27')][_0x72a0('0x53')])[_0x72a0('0x19')](function(){if(_['isArray'](_0x57550f[_0x72a0('0x27')][_0x72a0('0x53')])){for(var _0x346e03=0x0;_0x346e03<_0x57550f[_0x72a0('0x27')][_0x72a0('0x53')]['length'];_0x346e03+=0x1){socket[_0x72a0('0x5f')](_0x72a0('0x70'),{'UserId':Number(_0x57550f[_0x72a0('0x27')][_0x72a0('0x53')][_0x346e03]),'FaxQueueId':Number(_0x57550f[_0x72a0('0x2b')]['id'])});}}else{socket[_0x72a0('0x5f')]('userFaxQueue:remove',{'UserId':Number(_0x57550f[_0x72a0('0x27')][_0x72a0('0x53')]),'FaxQueueId':Number(_0x57550f[_0x72a0('0x2b')]['id'])});}});}})[_0x72a0('0x19')](respondWithStatusCode(_0x40f2e2,null))[_0x72a0('0x36')](handleError(_0x40f2e2,null));};exports[_0x72a0('0x73')]=function(_0xc31600,_0x350732){var _0x2c99f9={};var _0x49b0e8={};var _0x2a2eaa;var _0x5cdb8e;return db[_0x72a0('0x20')][_0x72a0('0x41')]({'where':{'id':_0xc31600[_0x72a0('0x2b')]['id']}})[_0x72a0('0x19')](handleEntityNotFound(_0x350732,null))[_0x72a0('0x19')](function(_0x2c23fb){if(_0x2c23fb){_0x2a2eaa=_0x2c23fb;_0x49b0e8['model']=_['keys'](db[_0x72a0('0x48')][_0x72a0('0x21')]);_0x49b0e8[_0x72a0('0x27')]=_[_0x72a0('0x2d')](_0xc31600[_0x72a0('0x27')]);_0x49b0e8[_0x72a0('0x2e')]=_[_0x72a0('0x30')](_0x49b0e8[_0x72a0('0x2c')],_0x49b0e8[_0x72a0('0x27')]);_0x2c99f9[_0x72a0('0x2f')]=_[_0x72a0('0x30')](_0x49b0e8[_0x72a0('0x2c')],qs[_0x72a0('0x31')](_0xc31600[_0x72a0('0x27')][_0x72a0('0x31')]));_0x2c99f9['attributes']=_0x2c99f9[_0x72a0('0x2f')]['length']?_0x2c99f9[_0x72a0('0x2f')]:_0x49b0e8['model'];_0x2c99f9[_0x72a0('0x45')]=qs['sort'](_0xc31600[_0x72a0('0x27')][_0x72a0('0x46')]);_0x2c99f9[_0x72a0('0x25')]=qs[_0x72a0('0x2e')](_[_0x72a0('0x52')](_0xc31600[_0x72a0('0x27')],_0x49b0e8['filters']));if(_0xc31600[_0x72a0('0x27')]['filter']){_0x2c99f9[_0x72a0('0x25')]=_[_0x72a0('0x33')](_0x2c99f9[_0x72a0('0x25')],{'$or':_[_0x72a0('0x1f')](_0x2c99f9[_0x72a0('0x2f')],function(_0x2ded38){var _0x5515cb={};_0x5515cb[_0x2ded38]={'$like':'%'+_0xc31600[_0x72a0('0x27')][_0x72a0('0x47')]+'%'};return _0x5515cb;})});}_0x2c99f9=_[_0x72a0('0x33')]({},_0x2c99f9,_0xc31600[_0x72a0('0x34')]);return _0x2a2eaa[_0x72a0('0x73')](_0x2c99f9);}})[_0x72a0('0x19')](function(_0x438e08){if(_0x438e08){_0x5cdb8e=_0x438e08[_0x72a0('0x32')];if(!_0xc31600[_0x72a0('0x27')]['hasOwnProperty'](_0x72a0('0x44'))){_0x2c99f9[_0x72a0('0x15')]=qs[_0x72a0('0x15')](_0xc31600[_0x72a0('0x27')][_0x72a0('0x15')]);_0x2c99f9[_0x72a0('0x13')]=qs[_0x72a0('0x13')](_0xc31600[_0x72a0('0x27')]['offset']);}return _0x2a2eaa['getAgents'](_0x2c99f9);}})['then'](function(_0x48f253){if(_0x48f253){return _0x48f253?{'count':_0x5cdb8e,'rows':_0x48f253}:null;}})['then'](respondWithResult(_0x350732,null))['catch'](handleError(_0x350732,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a7154d9..b1dd04e 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 _0xac5d=['FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xac5d,0x170));var _0xdac5=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0xac5d[_0x31df6f];return _0x31e353;};'use strict';var EventEmitter=require(_0xdac5('0x0'));var FaxQueue=require(_0xdac5('0x1'))['db'][_0xdac5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdac5('0x3')](0x0);var events={'afterCreate':_0xdac5('0x4'),'afterUpdate':_0xdac5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x24dff0){return function(_0x596c3e,_0x23a77f,_0x2c04c7){FaxQueueEvents[_0xdac5('0x6')](_0x24dff0+':'+_0x596c3e['id'],_0x596c3e);FaxQueueEvents[_0xdac5('0x6')](_0x24dff0,_0x596c3e);_0x2c04c7(null);};}for(var e in events){if(events[_0xdac5('0x7')](e)){var event=events[e];FaxQueue[_0xdac5('0x8')](e,emitEvent(event));}}module[_0xdac5('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x6736=['FaxQueue','setMaxListeners','save','update','emit','exports','events'];(function(_0x1a1086,_0x467b57){var _0x2e3a21=function(_0x164ed7){while(--_0x164ed7){_0x1a1086['push'](_0x1a1086['shift']());}};_0x2e3a21(++_0x467b57);}(_0x6736,0x18e));var _0x6673=function(_0x3c7535,_0x55121b){_0x3c7535=_0x3c7535-0x0;var _0x162607=_0x6736[_0x3c7535];return _0x162607;};'use strict';var EventEmitter=require(_0x6673('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x6673('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6673('0x2')](0x0);var events={'afterCreate':_0x6673('0x3'),'afterUpdate':_0x6673('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43a8d2){return function(_0x570651,_0x21ba8d,_0x314837){FaxQueueEvents[_0x6673('0x5')](_0x43a8d2+':'+_0x570651['id'],_0x570651);FaxQueueEvents[_0x6673('0x5')](_0x43a8d2,_0x570651);_0x314837(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x6673('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 1261633..649d8f0 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 _0x2ff0=['../../config/logger','moment','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util'];(function(_0x1b8b41,_0x45e070){var _0x37e960=function(_0x656ec3){while(--_0x656ec3){_0x1b8b41['push'](_0x1b8b41['shift']());}};_0x37e960(++_0x45e070);}(_0x2ff0,0x1cb));var _0x02ff=function(_0x54a3cd,_0x1db17a){_0x54a3cd=_0x54a3cd-0x0;var _0x39c565=_0x2ff0[_0x54a3cd];return _0x39c565;};'use strict';var _=require('lodash');var util=require(_0x02ff('0x0'));var logger=require(_0x02ff('0x1'))('api');var moment=require(_0x02ff('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x02ff('0x3'));var config=require(_0x02ff('0x4'));var attributes=require(_0x02ff('0x5'));module[_0x02ff('0x6')]=function(_0x2f0fa5,_0x35ef80){return _0x2f0fa5[_0x02ff('0x7')](_0x02ff('0x8'),attributes,{'tableName':_0x02ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb3a=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util'];(function(_0x4fd252,_0x1f7872){var _0x2dda70=function(_0x33fb04){while(--_0x33fb04){_0x4fd252['push'](_0x4fd252['shift']());}};_0x2dda70(++_0x1f7872);}(_0xfb3a,0x136));var _0xafb3=function(_0xc1f69f,_0x4d08bc){_0xc1f69f=_0xc1f69f-0x0;var _0x131eda=_0xfb3a[_0xc1f69f];return _0x131eda;};'use strict';var _=require(_0xafb3('0x0'));var util=require(_0xafb3('0x1'));var logger=require(_0xafb3('0x2'))(_0xafb3('0x3'));var moment=require(_0xafb3('0x4'));var BPromise=require(_0xafb3('0x5'));var rp=require(_0xafb3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafb3('0x7'));var config=require(_0xafb3('0x8'));var attributes=require(_0xafb3('0x9'));module['exports']=function(_0x2e6cb6,_0x2f485a){return _0x2e6cb6[_0xafb3('0xa')](_0xafb3('0xb'),attributes,{'tableName':_0xafb3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 2e03c7d..3d60881 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 _0x9c80=['socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','GetFaxQueue','findAll','options','raw','attributes','limit','include','map','model','catch','FaxQueue','find','where','ShowFaxQueue','lodash','bluebird','../../config/utils','client','http','redis','defaults','localhost'];(function(_0x9e0370,_0x22a333){var _0x292629=function(_0x302f1b){while(--_0x302f1b){_0x9e0370['push'](_0x9e0370['shift']());}};_0x292629(++_0x22a333);}(_0x9c80,0xa7));var _0x09c8=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9c80[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x09c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x09c8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x09c8('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09c8('0x3')][_0x09c8('0x4')]({'port':0x232a});config[_0x09c8('0x5')]=_[_0x09c8('0x6')](config[_0x09c8('0x5')],{'host':_0x09c8('0x7'),'port':0x18eb});var socket=require(_0x09c8('0x8'))(new Redis(config[_0x09c8('0x5')]));require(_0x09c8('0x9'))[_0x09c8('0xa')](socket);function respondWithRpcPromise(_0x469644,_0x20f224,_0x26c521){return new BPromise(function(_0x596a40,_0x6ab556){return client['request'](_0x469644,_0x26c521)[_0x09c8('0xb')](function(_0x207b9b){logger[_0x09c8('0xc')]('FaxQueue,\x20%s,\x20%s',_0x20f224,_0x09c8('0xd'));logger[_0x09c8('0xe')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x20f224,_0x09c8('0xd'),JSON[_0x09c8('0xf')](_0x207b9b));if(_0x207b9b[_0x09c8('0x10')]){if(_0x207b9b[_0x09c8('0x10')][_0x09c8('0x11')]===0x1f4){logger[_0x09c8('0x10')](_0x09c8('0x12'),_0x20f224,_0x207b9b[_0x09c8('0x10')][_0x09c8('0x13')]);return _0x6ab556(_0x207b9b['error']['message']);}logger[_0x09c8('0x10')](_0x09c8('0x12'),_0x20f224,_0x207b9b[_0x09c8('0x10')][_0x09c8('0x13')]);return _0x596a40(_0x207b9b['error'][_0x09c8('0x13')]);}else{logger[_0x09c8('0xc')](_0x09c8('0x12'),_0x20f224,'request\x20sent');_0x596a40(_0x207b9b[_0x09c8('0x14')][_0x09c8('0x13')]);}})['catch'](function(_0x3e1e05){logger[_0x09c8('0x10')](_0x09c8('0x12'),_0x20f224,_0x3e1e05);_0x6ab556(_0x3e1e05);});});}exports[_0x09c8('0x15')]=function(_0x2e6de4){var _0x1b2bf6=this;return new Promise(function(_0x3318a4,_0xc8c59f){return db['FaxQueue'][_0x09c8('0x16')]({'raw':_0x2e6de4['options']?_0x2e6de4[_0x09c8('0x17')][_0x09c8('0x18')]===undefined?!![]:![]:!![],'where':_0x2e6de4[_0x09c8('0x17')]?_0x2e6de4['options']['where']||null:null,'attributes':_0x2e6de4[_0x09c8('0x17')]?_0x2e6de4[_0x09c8('0x17')][_0x09c8('0x19')]||null:null,'limit':_0x2e6de4[_0x09c8('0x17')]?_0x2e6de4[_0x09c8('0x17')][_0x09c8('0x1a')]||null:null,'include':_0x2e6de4[_0x09c8('0x17')]?_0x2e6de4[_0x09c8('0x17')][_0x09c8('0x1b')]?_[_0x09c8('0x1c')](_0x2e6de4[_0x09c8('0x17')][_0x09c8('0x1b')],function(_0x4f4623){return{'model':db[_0x4f4623[_0x09c8('0x1d')]],'as':_0x4f4623['as'],'attributes':_0x4f4623[_0x09c8('0x19')],'include':_0x4f4623[_0x09c8('0x1b')]?_[_0x09c8('0x1c')](_0x4f4623[_0x09c8('0x1b')],function(_0xc69754){return{'model':db[_0xc69754[_0x09c8('0x1d')]],'as':_0xc69754['as'],'attributes':_0xc69754[_0x09c8('0x19')],'include':_0xc69754['include']?_[_0x09c8('0x1c')](_0xc69754[_0x09c8('0x1b')],function(_0x310b3f){return{'model':db[_0x310b3f[_0x09c8('0x1d')]],'as':_0x310b3f['as'],'attributes':_0x310b3f[_0x09c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x09c8('0xb')](function(_0x100115){logger['info'](_0x09c8('0x15'),_0x2e6de4);logger[_0x09c8('0xe')]('GetFaxQueue',_0x2e6de4,JSON[_0x09c8('0xf')](_0x100115));_0x3318a4(_0x100115);})[_0x09c8('0x1e')](function(_0x49083d){logger[_0x09c8('0x10')](_0x09c8('0x15'),_0x49083d[_0x09c8('0x13')],_0x2e6de4);_0xc8c59f(_0x1b2bf6[_0x09c8('0x10')](0x1f4,_0x49083d['message']));});});};exports['ShowFaxQueue']=function(_0x592de7){var _0x1b0477=this;return new Promise(function(_0x64fbff,_0x113dbf){return db[_0x09c8('0x1f')][_0x09c8('0x20')]({'raw':_0x592de7[_0x09c8('0x17')]?_0x592de7[_0x09c8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x592de7[_0x09c8('0x17')]?_0x592de7['options'][_0x09c8('0x21')]||null:null,'attributes':_0x592de7[_0x09c8('0x17')]?_0x592de7[_0x09c8('0x17')][_0x09c8('0x19')]||null:null,'include':_0x592de7[_0x09c8('0x17')]?_0x592de7[_0x09c8('0x17')][_0x09c8('0x1b')]?_[_0x09c8('0x1c')](_0x592de7[_0x09c8('0x17')][_0x09c8('0x1b')],function(_0x560ace){return{'model':db[_0x560ace['model']],'as':_0x560ace['as'],'attributes':_0x560ace[_0x09c8('0x19')],'include':_0x560ace[_0x09c8('0x1b')]?_[_0x09c8('0x1c')](_0x560ace[_0x09c8('0x1b')],function(_0x37e494){return{'model':db[_0x37e494[_0x09c8('0x1d')]],'as':_0x37e494['as'],'attributes':_0x37e494[_0x09c8('0x19')],'include':_0x37e494[_0x09c8('0x1b')]?_[_0x09c8('0x1c')](_0x37e494['include'],function(_0x35b448){return{'model':db[_0x35b448[_0x09c8('0x1d')]],'as':_0x35b448['as'],'attributes':_0x35b448['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x279442){logger[_0x09c8('0xc')](_0x09c8('0x22'),_0x592de7);logger[_0x09c8('0xe')](_0x09c8('0x22'),_0x592de7,JSON[_0x09c8('0xf')](_0x279442));_0x64fbff(_0x279442);})[_0x09c8('0x1e')](function(_0x3275c2){logger['error'](_0x09c8('0x22'),_0x3275c2[_0x09c8('0x13')],_0x592de7);_0x113dbf(_0x1b0477['error'](0x1f4,_0x3275c2['message']));});});}; \ No newline at end of file +var _0x24e9=['findAll','options','raw','where','limit','include','model','attributes','map','GetFaxQueue','debug','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message','catch','FaxQueue'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x24e9,0xb1));var _0x924e=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x24e9[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x924e('0x0'));var util=require(_0x924e('0x1'));var moment=require(_0x924e('0x2'));var BPromise=require(_0x924e('0x3'));var rs=require(_0x924e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x924e('0x5'))['db'];var utils=require(_0x924e('0x6'));var logger=require(_0x924e('0x7'))(_0x924e('0x8'));var config=require(_0x924e('0x9'));var jayson=require(_0x924e('0xa'));var client=jayson[_0x924e('0xb')][_0x924e('0xc')]({'port':0x232a});config[_0x924e('0xd')]=_['defaults'](config['redis'],{'host':_0x924e('0xe'),'port':0x18eb});var socket=require(_0x924e('0xf'))(new Redis(config[_0x924e('0xd')]));require('./faxQueue.socket')[_0x924e('0x10')](socket);function respondWithRpcPromise(_0x2a132b,_0x30e651,_0x2843de){return new BPromise(function(_0x4522b0,_0xca7400){return client[_0x924e('0x11')](_0x2a132b,_0x2843de)['then'](function(_0x542559){logger[_0x924e('0x12')](_0x924e('0x13'),_0x30e651,_0x924e('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x30e651,_0x924e('0x14'),JSON[_0x924e('0x15')](_0x542559));if(_0x542559[_0x924e('0x16')]){if(_0x542559[_0x924e('0x16')][_0x924e('0x17')]===0x1f4){logger[_0x924e('0x16')]('FaxQueue,\x20%s,\x20%s',_0x30e651,_0x542559['error']['message']);return _0xca7400(_0x542559[_0x924e('0x16')]['message']);}logger[_0x924e('0x16')](_0x924e('0x13'),_0x30e651,_0x542559[_0x924e('0x16')]['message']);return _0x4522b0(_0x542559[_0x924e('0x16')]['message']);}else{logger[_0x924e('0x12')](_0x924e('0x13'),_0x30e651,_0x924e('0x14'));_0x4522b0(_0x542559[_0x924e('0x18')][_0x924e('0x19')]);}})[_0x924e('0x1a')](function(_0x4df959){logger['error']('FaxQueue,\x20%s,\x20%s',_0x30e651,_0x4df959);_0xca7400(_0x4df959);});});}exports['GetFaxQueue']=function(_0x1d984e){var _0x188f0a=this;return new Promise(function(_0x15a4d9,_0x451a9d){return db[_0x924e('0x1b')][_0x924e('0x1c')]({'raw':_0x1d984e[_0x924e('0x1d')]?_0x1d984e['options'][_0x924e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d984e[_0x924e('0x1d')]?_0x1d984e[_0x924e('0x1d')][_0x924e('0x1f')]||null:null,'attributes':_0x1d984e[_0x924e('0x1d')]?_0x1d984e[_0x924e('0x1d')]['attributes']||null:null,'limit':_0x1d984e[_0x924e('0x1d')]?_0x1d984e[_0x924e('0x1d')][_0x924e('0x20')]||null:null,'include':_0x1d984e[_0x924e('0x1d')]?_0x1d984e[_0x924e('0x1d')][_0x924e('0x21')]?_['map'](_0x1d984e[_0x924e('0x1d')][_0x924e('0x21')],function(_0x2a7a8f){return{'model':db[_0x2a7a8f[_0x924e('0x22')]],'as':_0x2a7a8f['as'],'attributes':_0x2a7a8f[_0x924e('0x23')],'include':_0x2a7a8f[_0x924e('0x21')]?_[_0x924e('0x24')](_0x2a7a8f[_0x924e('0x21')],function(_0x33b062){return{'model':db[_0x33b062[_0x924e('0x22')]],'as':_0x33b062['as'],'attributes':_0x33b062[_0x924e('0x23')],'include':_0x33b062[_0x924e('0x21')]?_[_0x924e('0x24')](_0x33b062['include'],function(_0x2f58a1){return{'model':db[_0x2f58a1[_0x924e('0x22')]],'as':_0x2f58a1['as'],'attributes':_0x2f58a1[_0x924e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe7b324){logger[_0x924e('0x12')](_0x924e('0x25'),_0x1d984e);logger[_0x924e('0x26')](_0x924e('0x25'),_0x1d984e,JSON[_0x924e('0x15')](_0xe7b324));_0x15a4d9(_0xe7b324);})[_0x924e('0x1a')](function(_0x581a25){logger['error']('GetFaxQueue',_0x581a25[_0x924e('0x19')],_0x1d984e);_0x451a9d(_0x188f0a[_0x924e('0x16')](0x1f4,_0x581a25['message']));});});};exports['ShowFaxQueue']=function(_0x230e18){var _0x2ee6c8=this;return new Promise(function(_0x58cd,_0x466392){return db[_0x924e('0x1b')][_0x924e('0x27')]({'raw':_0x230e18[_0x924e('0x1d')]?_0x230e18[_0x924e('0x1d')][_0x924e('0x1e')]===undefined?!![]:![]:!![],'where':_0x230e18['options']?_0x230e18[_0x924e('0x1d')][_0x924e('0x1f')]||null:null,'attributes':_0x230e18[_0x924e('0x1d')]?_0x230e18[_0x924e('0x1d')][_0x924e('0x23')]||null:null,'include':_0x230e18[_0x924e('0x1d')]?_0x230e18[_0x924e('0x1d')][_0x924e('0x21')]?_['map'](_0x230e18['options'][_0x924e('0x21')],function(_0x46736b){return{'model':db[_0x46736b[_0x924e('0x22')]],'as':_0x46736b['as'],'attributes':_0x46736b[_0x924e('0x23')],'include':_0x46736b[_0x924e('0x21')]?_[_0x924e('0x24')](_0x46736b['include'],function(_0x3125f8){return{'model':db[_0x3125f8['model']],'as':_0x3125f8['as'],'attributes':_0x3125f8[_0x924e('0x23')],'include':_0x3125f8[_0x924e('0x21')]?_[_0x924e('0x24')](_0x3125f8[_0x924e('0x21')],function(_0x38be97){return{'model':db[_0x38be97[_0x924e('0x22')]],'as':_0x38be97['as'],'attributes':_0x38be97[_0x924e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7194b8){logger[_0x924e('0x12')](_0x924e('0x28'),_0x230e18);logger[_0x924e('0x26')](_0x924e('0x28'),_0x230e18,JSON[_0x924e('0x15')](_0x7194b8));_0x58cd(_0x7194b8);})[_0x924e('0x1a')](function(_0x4c31e4){logger[_0x924e('0x16')]('ShowFaxQueue',_0x4c31e4['message'],_0x230e18);_0x466392(_0x2ee6c8[_0x924e('0x16')](0x1f4,_0x4c31e4[_0x924e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4f98d09..7e7a580 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 _0x11a5=['removeListener','register','length','./faxQueue.events','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11a5,0x88));var _0x511a=function(_0x32c04b,_0x187085){_0x32c04b=_0x32c04b-0x0;var _0x2947b1=_0x11a5[_0x32c04b];return _0x2947b1;};'use strict';var FaxQueueEvents=require(_0x511a('0x0'));var events=[_0x511a('0x1'),_0x511a('0x2'),'update'];function createListener(_0x25619e,_0x3fad36){return function(_0x384d2b){_0x3fad36[_0x511a('0x3')](_0x25619e,_0x384d2b);};}function removeListener(_0x29c796,_0x3001f0){return function(){FaxQueueEvents[_0x511a('0x4')](_0x29c796,_0x3001f0);};}exports[_0x511a('0x5')]=function(_0x14dfa8){for(var _0x132f6e=0x0,_0x2248ff=events[_0x511a('0x6')];_0x132f6e<_0x2248ff;_0x132f6e++){var _0x159536=events[_0x132f6e];var _0xcb1e94=createListener('faxQueue:'+_0x159536,_0x14dfa8);FaxQueueEvents['on'](_0x159536,_0xcb1e94);}}; \ No newline at end of file +var _0x8524=['save','remove','update','emit','removeListener','length','./faxQueue.events'];(function(_0x518b4a,_0x601707){var _0x1c9b98=function(_0x11443e){while(--_0x11443e){_0x518b4a['push'](_0x518b4a['shift']());}};_0x1c9b98(++_0x601707);}(_0x8524,0x1d4));var _0x4852=function(_0x15c13e,_0x48f15f){_0x15c13e=_0x15c13e-0x0;var _0x450303=_0x8524[_0x15c13e];return _0x450303;};'use strict';var FaxQueueEvents=require(_0x4852('0x0'));var events=[_0x4852('0x1'),_0x4852('0x2'),_0x4852('0x3')];function createListener(_0x3e11b5,_0xd66a13){return function(_0x71fa1d){_0xd66a13[_0x4852('0x4')](_0x3e11b5,_0x71fa1d);};}function removeListener(_0x21b2bb,_0x32a57a){return function(){FaxQueueEvents[_0x4852('0x5')](_0x21b2bb,_0x32a57a);};}exports['register']=function(_0x45089f){for(var _0x3f70eb=0x0,_0x936949=events[_0x4852('0x6')];_0x3f70eb<_0x936949;_0x3f70eb++){var _0x44cc6b=events[_0x3f70eb];var _0x1e9273=createListener('faxQueue:'+_0x44cc6b,_0x45089f);FaxQueueEvents['on'](_0x44cc6b,_0x1e9273);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index df72d72..e3b0044 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 _0x83d0=['show','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1bc9fb,_0x15e5fa){var _0x134bd4=function(_0x58d8a5){while(--_0x58d8a5){_0x1bc9fb['push'](_0x1bc9fb['shift']());}};_0x134bd4(++_0x15e5fa);}(_0x83d0,0xb7));var _0x083d=function(_0x748fef,_0x2040c7){_0x748fef=_0x748fef-0x0;var _0x2afdad=_0x83d0[_0x748fef];return _0x2afdad;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require(_0x083d('0x4'));var router=express[_0x083d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x083d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x083d('0x7'));router[_0x083d('0x8')]('/',auth[_0x083d('0x9')](),controller[_0x083d('0xa')]);router[_0x083d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x083d('0xb')]);router[_0x083d('0x8')](_0x083d('0xc'),auth['isAuthenticated'](),controller[_0x083d('0xd')]);router[_0x083d('0x8')](_0x083d('0xe'),auth[_0x083d('0x9')](),controller['getMembers']);router[_0x083d('0x8')]('/:id/teams',auth[_0x083d('0x9')](),controller[_0x083d('0xf')]);router['get'](_0x083d('0x10'),auth[_0x083d('0x9')](),controller[_0x083d('0x11')]);router[_0x083d('0x12')]('/',auth[_0x083d('0x9')](),controller['create']);router[_0x083d('0x12')](_0x083d('0x13'),auth['isAuthenticated'](),controller[_0x083d('0x14')]);router['post']('/:id/users',auth[_0x083d('0x9')](),controller[_0x083d('0x15')]);router[_0x083d('0x16')](_0x083d('0xc'),auth[_0x083d('0x9')](),controller['update']);router[_0x083d('0x17')]('/:id',auth[_0x083d('0x9')](),controller[_0x083d('0x18')]);router[_0x083d('0x17')](_0x083d('0x13'),auth[_0x083d('0x9')](),controller[_0x083d('0x19')]);router[_0x083d('0x17')](_0x083d('0x10'),auth[_0x083d('0x9')](),controller[_0x083d('0x1a')]);module[_0x083d('0x1b')]=router; \ No newline at end of file +var _0x5e0e=['get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xf1157d,_0x37c40c){var _0x4051e8=function(_0x3fd476){while(--_0x3fd476){_0xf1157d['push'](_0xf1157d['shift']());}};_0x4051e8(++_0x37c40c);}(_0x5e0e,0x89));var _0xe5e0=function(_0x2e81a2,_0x4477fc){_0x2e81a2=_0x2e81a2-0x0;var _0x27b108=_0x5e0e[_0x2e81a2];return _0x27b108;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var fs_extra=require(_0xe5e0('0x5'));var auth=require(_0xe5e0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe5e0('0x7'));var controller=require('./faxQueue.controller');router[_0xe5e0('0x8')]('/',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xa')]);router[_0xe5e0('0x8')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller['describe']);router[_0xe5e0('0x8')](_0xe5e0('0xc'),auth['isAuthenticated'](),controller[_0xe5e0('0xd')]);router[_0xe5e0('0x8')](_0xe5e0('0xe'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xf')]);router[_0xe5e0('0x8')](_0xe5e0('0x10'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x11')]);router[_0xe5e0('0x8')](_0xe5e0('0x12'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe5e0('0x14')]);router[_0xe5e0('0x15')](_0xe5e0('0x10'),auth[_0xe5e0('0x9')](),controller['addTeams']);router[_0xe5e0('0x15')](_0xe5e0('0x12'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x16')]);router[_0xe5e0('0x17')](_0xe5e0('0xc'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x18')]);router[_0xe5e0('0x19')]('/:id',auth[_0xe5e0('0x9')](),controller['destroy']);router[_0xe5e0('0x19')]('/:id/teams',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x1a')]);router['delete'](_0xe5e0('0x12'),auth['isAuthenticated'](),controller[_0xe5e0('0x1b')]);module[_0xe5e0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index af21a07..c71e215 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 _0x8e9f=['exports','STRING','DATE','moment'];(function(_0x351657,_0x345728){var _0x44a28c=function(_0x5df31e){while(--_0x5df31e){_0x351657['push'](_0x351657['shift']());}};_0x44a28c(++_0x345728);}(_0x8e9f,0x1ef));var _0xf8e9=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x8e9f[_0x9fd887];return _0x1a54ab;};'use strict';var moment=require(_0xf8e9('0x0'));var Sequelize=require('sequelize');module[_0xf8e9('0x1')]={'uniqueid':{'type':Sequelize[_0xf8e9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf8e9('0x2')]},'joinAt':{'type':Sequelize[_0xf8e9('0x3')]},'leaveAt':{'type':Sequelize[_0xf8e9('0x3')]},'acceptAt':{'type':Sequelize[_0xf8e9('0x3')]},'exitAt':{'type':Sequelize[_0xf8e9('0x3')]},'reason':{'type':Sequelize[_0xf8e9('0x2')]}}; \ No newline at end of file +var _0x87c9=['STRING','DATE','moment','sequelize'];(function(_0x484129,_0xf94ec4){var _0x393d3d=function(_0x43b7a4){while(--_0x43b7a4){_0x484129['push'](_0x484129['shift']());}};_0x393d3d(++_0xf94ec4);}(_0x87c9,0x196));var _0x987c=function(_0x4cd916,_0x4084a0){_0x4cd916=_0x4cd916-0x0;var _0x907389=_0x87c9[_0x4cd916];return _0x907389;};'use strict';var moment=require(_0x987c('0x0'));var Sequelize=require(_0x987c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x987c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x987c('0x2')]},'joinAt':{'type':Sequelize[_0x987c('0x3')]},'leaveAt':{'type':Sequelize[_0x987c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c4eac29..01fe8e8 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 _0x4b8a=['set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset'];(function(_0x35181c,_0x82694a){var _0xe14bf9=function(_0x2be9b7){while(--_0x2be9b7){_0x35181c['push'](_0x35181c['shift']());}};_0xe14bf9(++_0x82694a);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4b8a[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4b8('0x1'));var rp=require(_0xa4b8('0x2'));var moment=require(_0xa4b8('0x3'));var BPromise=require(_0xa4b8('0x4'));var Mustache=require(_0xa4b8('0x5'));var util=require(_0xa4b8('0x6'));var path=require(_0xa4b8('0x7'));var sox=require(_0xa4b8('0x8'));var csv=require(_0xa4b8('0x9'));var ejs=require(_0xa4b8('0xa'));var fs=require('fs');var fs_extra=require(_0xa4b8('0xb'));var _=require(_0xa4b8('0xc'));var squel=require(_0xa4b8('0xd'));var crypto=require(_0xa4b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa4b8('0xf'));var toCsv=require(_0xa4b8('0x9'));var querystring=require(_0xa4b8('0x10'));var Papa=require(_0xa4b8('0x11'));var Redis=require(_0xa4b8('0x12'));var authService=require(_0xa4b8('0x13'));var qs=require(_0xa4b8('0x14'));var as=require(_0xa4b8('0x15'));var hardwareService=require(_0xa4b8('0x16'));var logger=require(_0xa4b8('0x17'))(_0xa4b8('0x18'));var utils=require(_0xa4b8('0x19'));var config=require(_0xa4b8('0x1a'));var licenseUtil=require(_0xa4b8('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2d6b,_0x83aa39){_0x83aa39=_0x83aa39||0xcc;return function(_0x488b99){if(_0x488b99){return _0x4c2d6b[_0xa4b8('0x1c')](_0x83aa39);}return _0x4c2d6b[_0xa4b8('0x1d')](_0x83aa39)['end']();};}function respondWithResult(_0x2f3199,_0x157d7f){_0x157d7f=_0x157d7f||0xc8;return function(_0x1c8369){if(_0x1c8369){return _0x2f3199[_0xa4b8('0x1d')](_0x157d7f)[_0xa4b8('0x1e')](_0x1c8369);}};}function respondWithFilteredResult(_0x3bba1b,_0x238cac){return function(_0x443d7f){if(_0x443d7f){var _0x2fd884=typeof _0x238cac['offset']===_0xa4b8('0x1f')&&typeof _0x238cac[_0xa4b8('0x20')]==='undefined';var _0x315df1=_0x443d7f[_0xa4b8('0x21')];var _0x215cdf=_0x2fd884?0x0:_0x238cac[_0xa4b8('0x22')];var _0x20cf62=_0x2fd884?_0x443d7f['count']:_0x238cac['offset']+_0x238cac['limit'];var _0x518134;if(_0x20cf62>=_0x315df1){_0x20cf62=_0x315df1;_0x518134=0xc8;}else{_0x518134=0xce;}_0x3bba1b[_0xa4b8('0x1d')](_0x518134);return _0x3bba1b[_0xa4b8('0x23')](_0xa4b8('0x24'),_0x215cdf+'-'+_0x20cf62+'/'+_0x315df1)[_0xa4b8('0x1e')](_0x443d7f);}return null;};}function patchUpdates(_0x39676c){return function(_0x113812){try{jsonpatch[_0xa4b8('0x25')](_0x113812,_0x39676c,!![]);}catch(_0x10534b){return BPromise[_0xa4b8('0x26')](_0x10534b);}return _0x113812[_0xa4b8('0x27')]();};}function saveUpdates(_0xbdc088,_0x46c994){return function(_0x144e62){if(_0x144e62){return _0x144e62[_0xa4b8('0x28')](_0xbdc088)[_0xa4b8('0x29')](function(_0xeb5ae1){return _0xeb5ae1;});}return null;};}function removeEntity(_0x34f5d2,_0x4b28ae){return function(_0x27530c){if(_0x27530c){return _0x27530c[_0xa4b8('0x2a')]()['then'](function(){_0x34f5d2[_0xa4b8('0x1d')](0xcc)[_0xa4b8('0x2b')]();});}};}function handleEntityNotFound(_0x5b0257,_0x58b94d){return function(_0x4cd363){if(!_0x4cd363){_0x5b0257[_0xa4b8('0x1c')](0x194);}return _0x4cd363;};}function handleError(_0x2adaa0,_0x239b62){_0x239b62=_0x239b62||0x1f4;return function(_0xa11b76){logger['error'](_0xa11b76[_0xa4b8('0x2c')]);if(_0xa11b76[_0xa4b8('0x2d')]){delete _0xa11b76[_0xa4b8('0x2d')];}_0x2adaa0[_0xa4b8('0x1d')](_0x239b62)['send'](_0xa11b76);};}exports[_0xa4b8('0x2e')]=function(_0x4475eb,_0x3d5ed1){var _0x39b754={},_0x33fa28={},_0x3a6652={'count':0x0,'rows':[]};var _0x3d60ff=_[_0xa4b8('0x2f')](db[_0xa4b8('0x30')][_0xa4b8('0x31')],function(_0x41f627){return{'name':_0x41f627[_0xa4b8('0x32')],'type':_0x41f627['type'][_0xa4b8('0x33')]};});_0x33fa28[_0xa4b8('0x34')]=_[_0xa4b8('0x2f')](_0x3d60ff,'name');_0x33fa28[_0xa4b8('0x35')]=_[_0xa4b8('0x36')](_0x4475eb['query']);_0x33fa28['filters']=_['intersection'](_0x33fa28['model'],_0x33fa28[_0xa4b8('0x35')]);_0x39b754['attributes']=_[_0xa4b8('0x37')](_0x33fa28[_0xa4b8('0x34')],qs[_0xa4b8('0x38')](_0x4475eb['query'][_0xa4b8('0x38')]));_0x39b754[_0xa4b8('0x39')]=_0x39b754[_0xa4b8('0x39')][_0xa4b8('0x3a')]?_0x39b754[_0xa4b8('0x39')]:_0x33fa28['model'];if(!_0x4475eb[_0xa4b8('0x35')][_0xa4b8('0x3b')](_0xa4b8('0x3c'))){_0x39b754[_0xa4b8('0x20')]=qs[_0xa4b8('0x20')](_0x4475eb[_0xa4b8('0x35')][_0xa4b8('0x20')]);_0x39b754['offset']=qs[_0xa4b8('0x22')](_0x4475eb[_0xa4b8('0x35')][_0xa4b8('0x22')]);}_0x39b754[_0xa4b8('0x3d')]=qs[_0xa4b8('0x3e')](_0x4475eb['query'][_0xa4b8('0x3e')]);_0x39b754[_0xa4b8('0x3f')]=qs[_0xa4b8('0x40')](_[_0xa4b8('0x41')](_0x4475eb['query'],_0x33fa28['filters']),_0x3d60ff);if(_0x4475eb[_0xa4b8('0x35')][_0xa4b8('0x42')]){_0x39b754[_0xa4b8('0x3f')]=_[_0xa4b8('0x43')](_0x39b754[_0xa4b8('0x3f')],{'$or':_[_0xa4b8('0x2f')](_0x3d60ff,function(_0x22555b){if(_0x22555b[_0xa4b8('0x44')]!==_0xa4b8('0x45')){var _0xed5f77={};_0xed5f77[_0x22555b[_0xa4b8('0x2d')]]={'$like':'%'+_0x4475eb[_0xa4b8('0x35')][_0xa4b8('0x42')]+'%'};return _0xed5f77;}})});}_0x39b754=_[_0xa4b8('0x43')]({},_0x39b754,_0x4475eb['options']);var _0x35d62c={'where':_0x39b754['where']};return db[_0xa4b8('0x30')][_0xa4b8('0x21')](_0x35d62c)['then'](function(_0x5b9529){_0x3a6652[_0xa4b8('0x21')]=_0x5b9529;if(_0x4475eb[_0xa4b8('0x35')][_0xa4b8('0x46')]){_0x39b754[_0xa4b8('0x47')]=[{'all':!![]}];}return db[_0xa4b8('0x30')][_0xa4b8('0x48')](_0x39b754);})['then'](function(_0x9ac740){_0x3a6652[_0xa4b8('0x49')]=_0x9ac740;return _0x3a6652;})[_0xa4b8('0x29')](respondWithFilteredResult(_0x3d5ed1,_0x39b754))['catch'](handleError(_0x3d5ed1,null));};exports[_0xa4b8('0x4a')]=function(_0x2710de,_0xff9fc0){var _0x13a27c={'raw':!![],'where':{'id':_0x2710de[_0xa4b8('0x4b')]['id']}},_0x6c6438={};_0x6c6438[_0xa4b8('0x34')]=_[_0xa4b8('0x36')](db[_0xa4b8('0x30')]['rawAttributes']);_0x6c6438[_0xa4b8('0x35')]=_[_0xa4b8('0x36')](_0x2710de[_0xa4b8('0x35')]);_0x6c6438[_0xa4b8('0x40')]=_[_0xa4b8('0x37')](_0x6c6438[_0xa4b8('0x34')],_0x6c6438[_0xa4b8('0x35')]);_0x13a27c['attributes']=_[_0xa4b8('0x37')](_0x6c6438['model'],qs[_0xa4b8('0x38')](_0x2710de[_0xa4b8('0x35')]['fields']));_0x13a27c[_0xa4b8('0x39')]=_0x13a27c['attributes'][_0xa4b8('0x3a')]?_0x13a27c[_0xa4b8('0x39')]:_0x6c6438[_0xa4b8('0x34')];if(_0x2710de[_0xa4b8('0x35')][_0xa4b8('0x46')]){_0x13a27c[_0xa4b8('0x47')]=[{'all':!![]}];}_0x13a27c=_[_0xa4b8('0x43')]({},_0x13a27c,_0x2710de[_0xa4b8('0x4c')]);return db[_0xa4b8('0x30')]['find'](_0x13a27c)[_0xa4b8('0x29')](handleEntityNotFound(_0xff9fc0,null))['then'](respondWithResult(_0xff9fc0,null))[_0xa4b8('0x4d')](handleError(_0xff9fc0,null));};exports[_0xa4b8('0x4e')]=function(_0x375dd7,_0x551638){return db['FaxQueueReport'][_0xa4b8('0x4e')](_0x375dd7[_0xa4b8('0x4f')],{})['then'](respondWithResult(_0x551638,0xc9))[_0xa4b8('0x4d')](handleError(_0x551638,null));};exports['update']=function(_0x1b8a91,_0x6b9b99){if(_0x1b8a91[_0xa4b8('0x4f')]['id']){delete _0x1b8a91['body']['id'];}return db[_0xa4b8('0x30')][_0xa4b8('0x50')]({'where':{'id':_0x1b8a91[_0xa4b8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6b9b99,null))['then'](saveUpdates(_0x1b8a91[_0xa4b8('0x4f')],null))[_0xa4b8('0x29')](respondWithResult(_0x6b9b99,null))[_0xa4b8('0x4d')](handleError(_0x6b9b99,null));};exports[_0xa4b8('0x2a')]=function(_0x3ca6fb,_0x510175){return db[_0xa4b8('0x30')]['find']({'where':{'id':_0x3ca6fb[_0xa4b8('0x4b')]['id']}})[_0xa4b8('0x29')](handleEntityNotFound(_0x510175,null))[_0xa4b8('0x29')](removeEntity(_0x510175,null))['catch'](handleError(_0x510175,null));};exports[_0xa4b8('0x51')]=function(_0x3cca98,_0x3edebc){return db[_0xa4b8('0x30')][_0xa4b8('0x51')]()[_0xa4b8('0x29')](respondWithResult(_0x3edebc,null))[_0xa4b8('0x4d')](handleError(_0x3edebc,null));}; \ No newline at end of file +var _0x0cfa=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','FaxQueueReport','then','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','destroy','error','stack','name','send','map'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x1a80bb,_0x11d64c){_0x1a80bb=_0x1a80bb-0x0;var _0x103186=_0x0cfa[_0x1a80bb];return _0x103186;};'use strict';var emlformat=require(_0xa0cf('0x0'));var rimraf=require(_0xa0cf('0x1'));var zipdir=require(_0xa0cf('0x2'));var jsonpatch=require(_0xa0cf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa0cf('0x4'));var util=require('util');var path=require(_0xa0cf('0x5'));var sox=require(_0xa0cf('0x6'));var csv=require(_0xa0cf('0x7'));var ejs=require(_0xa0cf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0cf('0x9'));var squel=require('squel');var crypto=require(_0xa0cf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa0cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa0cf('0xc'));var Papa=require(_0xa0cf('0xd'));var Redis=require(_0xa0cf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa0cf('0xf'));var as=require(_0xa0cf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa0cf('0x11'));var utils=require(_0xa0cf('0x12'));var config=require(_0xa0cf('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0cf('0x14'))['db'];function respondWithStatusCode(_0x383429,_0x3de581){_0x3de581=_0x3de581||0xcc;return function(_0x1c9fa2){if(_0x1c9fa2){return _0x383429[_0xa0cf('0x15')](_0x3de581);}return _0x383429[_0xa0cf('0x16')](_0x3de581)[_0xa0cf('0x17')]();};}function respondWithResult(_0x5f52ee,_0x560c9b){_0x560c9b=_0x560c9b||0xc8;return function(_0x213d63){if(_0x213d63){return _0x5f52ee[_0xa0cf('0x16')](_0x560c9b)['json'](_0x213d63);}};}function respondWithFilteredResult(_0x1e8234,_0x1cc9ba){return function(_0x3f55f5){if(_0x3f55f5){var _0x1186e9=typeof _0x1cc9ba[_0xa0cf('0x18')]==='undefined'&&typeof _0x1cc9ba[_0xa0cf('0x19')]===_0xa0cf('0x1a');var _0x5bae31=_0x3f55f5[_0xa0cf('0x1b')];var _0x36c524=_0x1186e9?0x0:_0x1cc9ba['offset'];var _0x112ced=_0x1186e9?_0x3f55f5[_0xa0cf('0x1b')]:_0x1cc9ba[_0xa0cf('0x18')]+_0x1cc9ba[_0xa0cf('0x19')];var _0x191a95;if(_0x112ced>=_0x5bae31){_0x112ced=_0x5bae31;_0x191a95=0xc8;}else{_0x191a95=0xce;}_0x1e8234[_0xa0cf('0x16')](_0x191a95);return _0x1e8234['set'](_0xa0cf('0x1c'),_0x36c524+'-'+_0x112ced+'/'+_0x5bae31)[_0xa0cf('0x1d')](_0x3f55f5);}return null;};}function patchUpdates(_0x3551df){return function(_0x112b57){try{jsonpatch[_0xa0cf('0x1e')](_0x112b57,_0x3551df,!![]);}catch(_0x1e99cf){return BPromise[_0xa0cf('0x1f')](_0x1e99cf);}return _0x112b57[_0xa0cf('0x20')]();};}function saveUpdates(_0x1112f8,_0x2137ea){return function(_0x359116){if(_0x359116){return _0x359116['update'](_0x1112f8)['then'](function(_0x5825a1){return _0x5825a1;});}return null;};}function removeEntity(_0x555973,_0x574085){return function(_0x419baf){if(_0x419baf){return _0x419baf[_0xa0cf('0x21')]()['then'](function(){_0x555973[_0xa0cf('0x16')](0xcc)[_0xa0cf('0x17')]();});}};}function handleEntityNotFound(_0xeb9af,_0x1a9e25){return function(_0x5a39f9){if(!_0x5a39f9){_0xeb9af[_0xa0cf('0x15')](0x194);}return _0x5a39f9;};}function handleError(_0x3f03ff,_0x4da07f){_0x4da07f=_0x4da07f||0x1f4;return function(_0x543c66){logger[_0xa0cf('0x22')](_0x543c66[_0xa0cf('0x23')]);if(_0x543c66[_0xa0cf('0x24')]){delete _0x543c66[_0xa0cf('0x24')];}_0x3f03ff[_0xa0cf('0x16')](_0x4da07f)[_0xa0cf('0x25')](_0x543c66);};}exports['index']=function(_0x57b088,_0x1ef1d4){var _0x58006e={},_0xd627d={},_0x2eed90={'count':0x0,'rows':[]};var _0x458590=_[_0xa0cf('0x26')](db['FaxQueueReport'][_0xa0cf('0x27')],function(_0x285778){return{'name':_0x285778[_0xa0cf('0x28')],'type':_0x285778[_0xa0cf('0x29')][_0xa0cf('0x2a')]};});_0xd627d[_0xa0cf('0x2b')]=_[_0xa0cf('0x26')](_0x458590,'name');_0xd627d[_0xa0cf('0x2c')]=_[_0xa0cf('0x2d')](_0x57b088[_0xa0cf('0x2c')]);_0xd627d[_0xa0cf('0x2e')]=_[_0xa0cf('0x2f')](_0xd627d['model'],_0xd627d[_0xa0cf('0x2c')]);_0x58006e[_0xa0cf('0x30')]=_['intersection'](_0xd627d['model'],qs[_0xa0cf('0x31')](_0x57b088[_0xa0cf('0x2c')][_0xa0cf('0x31')]));_0x58006e[_0xa0cf('0x30')]=_0x58006e[_0xa0cf('0x30')][_0xa0cf('0x32')]?_0x58006e[_0xa0cf('0x30')]:_0xd627d[_0xa0cf('0x2b')];if(!_0x57b088['query'][_0xa0cf('0x33')](_0xa0cf('0x34'))){_0x58006e[_0xa0cf('0x19')]=qs[_0xa0cf('0x19')](_0x57b088[_0xa0cf('0x2c')]['limit']);_0x58006e[_0xa0cf('0x18')]=qs[_0xa0cf('0x18')](_0x57b088[_0xa0cf('0x2c')][_0xa0cf('0x18')]);}_0x58006e['order']=qs[_0xa0cf('0x35')](_0x57b088[_0xa0cf('0x2c')][_0xa0cf('0x35')]);_0x58006e[_0xa0cf('0x36')]=qs[_0xa0cf('0x2e')](_[_0xa0cf('0x37')](_0x57b088[_0xa0cf('0x2c')],_0xd627d[_0xa0cf('0x2e')]),_0x458590);if(_0x57b088['query']['filter']){_0x58006e[_0xa0cf('0x36')]=_[_0xa0cf('0x38')](_0x58006e[_0xa0cf('0x36')],{'$or':_[_0xa0cf('0x26')](_0x458590,function(_0x5b5384){if(_0x5b5384[_0xa0cf('0x29')]!==_0xa0cf('0x39')){var _0x25b2c2={};_0x25b2c2[_0x5b5384['name']]={'$like':'%'+_0x57b088[_0xa0cf('0x2c')][_0xa0cf('0x3a')]+'%'};return _0x25b2c2;}})});}_0x58006e=_['merge']({},_0x58006e,_0x57b088[_0xa0cf('0x3b')]);var _0x3a5bc8={'where':_0x58006e[_0xa0cf('0x36')]};return db[_0xa0cf('0x3c')]['count'](_0x3a5bc8)[_0xa0cf('0x3d')](function(_0x172c54){_0x2eed90[_0xa0cf('0x1b')]=_0x172c54;if(_0x57b088[_0xa0cf('0x2c')][_0xa0cf('0x3e')]){_0x58006e[_0xa0cf('0x3f')]=[{'all':!![]}];}return db[_0xa0cf('0x3c')][_0xa0cf('0x40')](_0x58006e);})[_0xa0cf('0x3d')](function(_0x5cd6dd){_0x2eed90['rows']=_0x5cd6dd;return _0x2eed90;})[_0xa0cf('0x3d')](respondWithFilteredResult(_0x1ef1d4,_0x58006e))[_0xa0cf('0x41')](handleError(_0x1ef1d4,null));};exports[_0xa0cf('0x42')]=function(_0x47e735,_0x3b596c){var _0x4dcac3={'raw':!![],'where':{'id':_0x47e735[_0xa0cf('0x43')]['id']}},_0x10fc94={};_0x10fc94[_0xa0cf('0x2b')]=_[_0xa0cf('0x2d')](db[_0xa0cf('0x3c')][_0xa0cf('0x27')]);_0x10fc94[_0xa0cf('0x2c')]=_[_0xa0cf('0x2d')](_0x47e735[_0xa0cf('0x2c')]);_0x10fc94['filters']=_[_0xa0cf('0x2f')](_0x10fc94['model'],_0x10fc94[_0xa0cf('0x2c')]);_0x4dcac3[_0xa0cf('0x30')]=_[_0xa0cf('0x2f')](_0x10fc94[_0xa0cf('0x2b')],qs['fields'](_0x47e735[_0xa0cf('0x2c')]['fields']));_0x4dcac3['attributes']=_0x4dcac3[_0xa0cf('0x30')]['length']?_0x4dcac3[_0xa0cf('0x30')]:_0x10fc94[_0xa0cf('0x2b')];if(_0x47e735[_0xa0cf('0x2c')][_0xa0cf('0x3e')]){_0x4dcac3[_0xa0cf('0x3f')]=[{'all':!![]}];}_0x4dcac3=_[_0xa0cf('0x38')]({},_0x4dcac3,_0x47e735['options']);return db['FaxQueueReport'][_0xa0cf('0x44')](_0x4dcac3)[_0xa0cf('0x3d')](handleEntityNotFound(_0x3b596c,null))[_0xa0cf('0x3d')](respondWithResult(_0x3b596c,null))[_0xa0cf('0x41')](handleError(_0x3b596c,null));};exports[_0xa0cf('0x45')]=function(_0x13778a,_0x5572a3){return db[_0xa0cf('0x3c')]['create'](_0x13778a[_0xa0cf('0x46')],{})[_0xa0cf('0x3d')](respondWithResult(_0x5572a3,0xc9))[_0xa0cf('0x41')](handleError(_0x5572a3,null));};exports[_0xa0cf('0x47')]=function(_0x22a57f,_0x5c33a2){if(_0x22a57f[_0xa0cf('0x46')]['id']){delete _0x22a57f[_0xa0cf('0x46')]['id'];}return db['FaxQueueReport'][_0xa0cf('0x44')]({'where':{'id':_0x22a57f[_0xa0cf('0x43')]['id']}})[_0xa0cf('0x3d')](handleEntityNotFound(_0x5c33a2,null))[_0xa0cf('0x3d')](saveUpdates(_0x22a57f[_0xa0cf('0x46')],null))[_0xa0cf('0x3d')](respondWithResult(_0x5c33a2,null))[_0xa0cf('0x41')](handleError(_0x5c33a2,null));};exports['destroy']=function(_0x3fcdca,_0x561857){return db[_0xa0cf('0x3c')]['find']({'where':{'id':_0x3fcdca[_0xa0cf('0x43')]['id']}})[_0xa0cf('0x3d')](handleEntityNotFound(_0x561857,null))[_0xa0cf('0x3d')](removeEntity(_0x561857,null))[_0xa0cf('0x41')](handleError(_0x561857,null));};exports[_0xa0cf('0x48')]=function(_0x38e49c,_0x3c4cc6){return db['FaxQueueReport'][_0xa0cf('0x48')]()['then'](respondWithResult(_0x3c4cc6,null))['catch'](handleError(_0x3c4cc6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index efd0f7e..c5af64f 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x541e88,_0x3363b4){var _0x5b2875=function(_0x178044){while(--_0x178044){_0x541e88['push'](_0x541e88['shift']());}};_0x5b2875(++_0x3363b4);}(_0xabce,0x103));var _0xeabc=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xabce[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x596fe7,_0x2796ac){var _0x525ca6=function(_0x12325e){while(--_0x12325e){_0x596fe7['push'](_0x596fe7['shift']());}};_0x525ca6(++_0x2796ac);}(_0x326f,0xd1));var _0xf326=function(_0x11b841,_0x2aca09){_0x11b841=_0x11b841-0x0;var _0x1fd6d4=_0x326f[_0x11b841];return _0x1fd6d4;};'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/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 68a8120..64f16b6 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 _0x19ba=['request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','FaxQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s'];(function(_0x2adb20,_0x471084){var _0x35f93d=function(_0x5f3a09){while(--_0x5f3a09){_0x2adb20['push'](_0x2adb20['shift']());}};_0x35f93d(++_0x471084);}(_0x19ba,0x19f));var _0xa19b=function(_0x3fcfb6,_0x515024){_0x3fcfb6=_0x3fcfb6-0x0;var _0x3b99a7=_0x19ba[_0x3fcfb6];return _0x3b99a7;};'use strict';var _=require(_0xa19b('0x0'));var util=require(_0xa19b('0x1'));var moment=require(_0xa19b('0x2'));var BPromise=require(_0xa19b('0x3'));var rs=require(_0xa19b('0x4'));var fs=require('fs');var Redis=require(_0xa19b('0x5'));var db=require(_0xa19b('0x6'))['db'];var utils=require(_0xa19b('0x7'));var logger=require(_0xa19b('0x8'))(_0xa19b('0x9'));var config=require(_0xa19b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa19b('0xb')][_0xa19b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xda3844,_0x1fe16a,_0x2e14d7){return new BPromise(function(_0x4084c1,_0x2d8b39){return client[_0xa19b('0xd')](_0xda3844,_0x2e14d7)[_0xa19b('0xe')](function(_0x2ccbe9){logger[_0xa19b('0xf')](_0xa19b('0x10'),_0x1fe16a,_0xa19b('0x11'));logger[_0xa19b('0x12')](_0xa19b('0x13'),_0x1fe16a,_0xa19b('0x11'),JSON['stringify'](_0x2ccbe9));if(_0x2ccbe9[_0xa19b('0x14')]){if(_0x2ccbe9[_0xa19b('0x14')][_0xa19b('0x15')]===0x1f4){logger[_0xa19b('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x1fe16a,_0x2ccbe9[_0xa19b('0x14')][_0xa19b('0x16')]);return _0x2d8b39(_0x2ccbe9[_0xa19b('0x14')][_0xa19b('0x16')]);}logger[_0xa19b('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x1fe16a,_0x2ccbe9[_0xa19b('0x14')][_0xa19b('0x16')]);return _0x4084c1(_0x2ccbe9[_0xa19b('0x14')]['message']);}else{logger['info'](_0xa19b('0x10'),_0x1fe16a,'request\x20sent');_0x4084c1(_0x2ccbe9[_0xa19b('0x17')][_0xa19b('0x16')]);}})[_0xa19b('0x18')](function(_0x39cdaa){logger[_0xa19b('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x1fe16a,_0x39cdaa);_0x2d8b39(_0x39cdaa);});});}exports['CreateFaxQueueReport']=function(_0x223a2e){var _0x598520=this;return new Promise(function(_0x114fc7,_0x2ff219){return db['FaxQueueReport'][_0xa19b('0x19')](_0x223a2e[_0xa19b('0x1a')],{'raw':_0x223a2e[_0xa19b('0x1b')]?_0x223a2e[_0xa19b('0x1b')][_0xa19b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3ce21a){logger[_0xa19b('0xf')](_0xa19b('0x1d'),_0x223a2e);logger['debug']('CreateFaxQueueReport',_0x223a2e,JSON[_0xa19b('0x1e')](_0x3ce21a));_0x114fc7(_0x3ce21a);})['catch'](function(_0x17bd1a){logger[_0xa19b('0x14')](_0xa19b('0x1d'),_0x17bd1a[_0xa19b('0x16')],_0x223a2e);_0x2ff219(_0x598520[_0xa19b('0x14')](0x1f4,_0x17bd1a['message']));});});};exports[_0xa19b('0x1f')]=function(_0x14a0f0){var _0x25746e=this;return new Promise(function(_0x4ee6d5,_0x41e10e){return db[_0xa19b('0x20')][_0xa19b('0x21')](_0x14a0f0['body'],{'raw':_0x14a0f0[_0xa19b('0x1b')]?_0x14a0f0[_0xa19b('0x1b')][_0xa19b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a0f0[_0xa19b('0x1b')]?_0x14a0f0[_0xa19b('0x1b')]['where']||null:null,'attributes':_0x14a0f0[_0xa19b('0x1b')]?_0x14a0f0[_0xa19b('0x1b')][_0xa19b('0x22')]||null:null,'limit':_0x14a0f0[_0xa19b('0x1b')]?_0x14a0f0[_0xa19b('0x1b')][_0xa19b('0x23')]||null:null})[_0xa19b('0xe')](function(_0x8ad992){logger[_0xa19b('0xf')]('UpdateFaxQueueReport',_0x14a0f0);logger['debug'](_0xa19b('0x1f'),_0x14a0f0,JSON[_0xa19b('0x1e')](_0x8ad992));_0x4ee6d5(_0x8ad992);})['catch'](function(_0x2d15c8){logger[_0xa19b('0x14')](_0xa19b('0x1f'),_0x2d15c8[_0xa19b('0x16')],_0x14a0f0);_0x41e10e(_0x25746e[_0xa19b('0x14')](0x1f4,_0x2d15c8['message']));});});}; \ No newline at end of file +var _0x3da2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','attributes','limit','lodash'];(function(_0x3a0501,_0x4b74f0){var _0x19a24f=function(_0x1ed8fc){while(--_0x1ed8fc){_0x3a0501['push'](_0x3a0501['shift']());}};_0x19a24f(++_0x4b74f0);}(_0x3da2,0xa4));var _0x23da=function(_0x58f20b,_0x5895a7){_0x58f20b=_0x58f20b-0x0;var _0x338b78=_0x3da2[_0x58f20b];return _0x338b78;};'use strict';var _=require(_0x23da('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23da('0x1'));var rs=require(_0x23da('0x2'));var fs=require('fs');var Redis=require(_0x23da('0x3'));var db=require(_0x23da('0x4'))['db'];var utils=require(_0x23da('0x5'));var logger=require(_0x23da('0x6'))(_0x23da('0x7'));var config=require(_0x23da('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x23da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x97d5a6,_0x56a1d8,_0x269a50){return new BPromise(function(_0x200c2e,_0x2a0837){return client[_0x23da('0xa')](_0x97d5a6,_0x269a50)[_0x23da('0xb')](function(_0x3b8766){logger[_0x23da('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x56a1d8,'request\x20sent');logger[_0x23da('0xd')](_0x23da('0xe'),_0x56a1d8,_0x23da('0xf'),JSON[_0x23da('0x10')](_0x3b8766));if(_0x3b8766[_0x23da('0x11')]){if(_0x3b8766[_0x23da('0x11')][_0x23da('0x12')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x56a1d8,_0x3b8766['error'][_0x23da('0x13')]);return _0x2a0837(_0x3b8766[_0x23da('0x11')]['message']);}logger[_0x23da('0x11')](_0x23da('0x14'),_0x56a1d8,_0x3b8766[_0x23da('0x11')]['message']);return _0x200c2e(_0x3b8766['error'][_0x23da('0x13')]);}else{logger[_0x23da('0xc')](_0x23da('0x14'),_0x56a1d8,'request\x20sent');_0x200c2e(_0x3b8766[_0x23da('0x15')][_0x23da('0x13')]);}})[_0x23da('0x16')](function(_0x27629f){logger[_0x23da('0x11')](_0x23da('0x14'),_0x56a1d8,_0x27629f);_0x2a0837(_0x27629f);});});}exports[_0x23da('0x17')]=function(_0x1c48b3){var _0x4429a8=this;return new Promise(function(_0x73acca,_0x29a0a5){return db[_0x23da('0x18')][_0x23da('0x19')](_0x1c48b3[_0x23da('0x1a')],{'raw':_0x1c48b3[_0x23da('0x1b')]?_0x1c48b3['options'][_0x23da('0x1c')]===undefined?!![]:![]:!![]})[_0x23da('0xb')](function(_0x2c5386){logger[_0x23da('0xc')](_0x23da('0x17'),_0x1c48b3);logger[_0x23da('0xd')]('CreateFaxQueueReport',_0x1c48b3,JSON['stringify'](_0x2c5386));_0x73acca(_0x2c5386);})[_0x23da('0x16')](function(_0x31ca65){logger[_0x23da('0x11')](_0x23da('0x17'),_0x31ca65['message'],_0x1c48b3);_0x29a0a5(_0x4429a8['error'](0x1f4,_0x31ca65[_0x23da('0x13')]));});});};exports[_0x23da('0x1d')]=function(_0x3c02fc){var _0x17d12b=this;return new Promise(function(_0x380096,_0x149242){return db[_0x23da('0x18')][_0x23da('0x1e')](_0x3c02fc[_0x23da('0x1a')],{'raw':_0x3c02fc['options']?_0x3c02fc[_0x23da('0x1b')][_0x23da('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c02fc[_0x23da('0x1b')]?_0x3c02fc[_0x23da('0x1b')]['where']||null:null,'attributes':_0x3c02fc[_0x23da('0x1b')]?_0x3c02fc[_0x23da('0x1b')][_0x23da('0x1f')]||null:null,'limit':_0x3c02fc[_0x23da('0x1b')]?_0x3c02fc[_0x23da('0x1b')][_0x23da('0x20')]||null:null})['then'](function(_0x305f13){logger[_0x23da('0xc')](_0x23da('0x1d'),_0x3c02fc);logger[_0x23da('0xd')](_0x23da('0x1d'),_0x3c02fc,JSON[_0x23da('0x10')](_0x305f13));_0x380096(_0x305f13);})[_0x23da('0x16')](function(_0x29b852){logger[_0x23da('0x11')](_0x23da('0x1d'),_0x29b852[_0x23da('0x13')],_0x3c02fc);_0x149242(_0x17d12b[_0x23da('0x11')](0x1f4,_0x29b852[_0x23da('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5f0674a..0a4c924 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 _0x4905=['/:id','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x2bf037,_0x25220d){var _0x4a762=function(_0x1bbf5e){while(--_0x1bbf5e){_0x2bf037['push'](_0x2bf037['shift']());}};_0x4a762(++_0x25220d);}(_0x4905,0x1da));var _0x5490=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4905[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x5490('0x0'));var util=require(_0x5490('0x1'));var path=require('path');var timeout=require(_0x5490('0x2'));var express=require(_0x5490('0x3'));var router=express[_0x5490('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5490('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5490('0x6'));var controller=require(_0x5490('0x7'));router[_0x5490('0x8')]('/',auth[_0x5490('0x9')](),controller[_0x5490('0xa')]);router['get']('/describe',auth[_0x5490('0x9')](),controller[_0x5490('0xb')]);router['get'](_0x5490('0xc'),auth[_0x5490('0x9')](),controller['show']);router['post']('/',auth[_0x5490('0x9')](),controller[_0x5490('0xd')]);router[_0x5490('0xe')](_0x5490('0xc'),auth[_0x5490('0x9')](),controller[_0x5490('0xf')]);router[_0x5490('0x10')](_0x5490('0xc'),auth[_0x5490('0x9')](),controller[_0x5490('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfa01=['get','isAuthenticated','index','/describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfa01,0xb3));var _0x1fa0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfa01[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x1fa0('0x0'));var util=require(_0x1fa0('0x1'));var path=require(_0x1fa0('0x2'));var timeout=require(_0x1fa0('0x3'));var express=require(_0x1fa0('0x4'));var router=express[_0x1fa0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1fa0('0x6'));var interaction=require(_0x1fa0('0x7'));var config=require(_0x1fa0('0x8'));var controller=require(_0x1fa0('0x9'));router[_0x1fa0('0xa')]('/',auth[_0x1fa0('0xb')](),controller[_0x1fa0('0xc')]);router[_0x1fa0('0xa')](_0x1fa0('0xd'),auth[_0x1fa0('0xb')](),controller['describe']);router[_0x1fa0('0xa')](_0x1fa0('0xe'),auth[_0x1fa0('0xb')](),controller['show']);router['post']('/',auth[_0x1fa0('0xb')](),controller[_0x1fa0('0xf')]);router[_0x1fa0('0x10')]('/:id',auth[_0x1fa0('0xb')](),controller[_0x1fa0('0x11')]);router[_0x1fa0('0x12')](_0x1fa0('0xe'),auth['isAuthenticated'](),controller[_0x1fa0('0x13')]);module[_0x1fa0('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 9c01eb5..cf0db9f 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xbd67fc,_0x5d5708){var _0xd74af6=function(_0x3f39e2){while(--_0x3f39e2){_0xbd67fc['push'](_0xbd67fc['shift']());}};_0xd74af6(++_0x5d5708);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xcb91[_0x470f63];return _0x4f09e2;};'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 +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x55fbed,_0x4eba42){var _0x23ac27=function(_0x46471b){while(--_0x46471b){_0x55fbed['push'](_0x55fbed['shift']());}};_0x23ac27(++_0x4eba42);}(_0xe706,0xa3));var _0x6e70=function(_0x4c587a,_0x3bf54a){_0x4c587a=_0x4c587a-0x0;var _0x3e66fc=_0xe706[_0x4c587a];return _0x3e66fc;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 90a8c81..53075e3 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 _0x90cf=['update','then','destroy','name','send','index','map','FaxTransferReport','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','params','find','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x90cf,0xfe));var _0xf90c=function(_0x4cd60b,_0x218cc6){_0x4cd60b=_0x4cd60b-0x0;var _0x51dd94=_0x90cf[_0x4cd60b];return _0x51dd94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf90c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf90c('0x1'));var rp=require('request-promise');var moment=require(_0xf90c('0x2'));var BPromise=require(_0xf90c('0x3'));var Mustache=require(_0xf90c('0x4'));var util=require(_0xf90c('0x5'));var path=require(_0xf90c('0x6'));var sox=require(_0xf90c('0x7'));var csv=require(_0xf90c('0x8'));var ejs=require(_0xf90c('0x9'));var fs=require('fs');var fs_extra=require(_0xf90c('0xa'));var _=require('lodash');var squel=require(_0xf90c('0xb'));var crypto=require(_0xf90c('0xc'));var jsforce=require(_0xf90c('0xd'));var deskjs=require(_0xf90c('0xe'));var toCsv=require(_0xf90c('0x8'));var querystring=require(_0xf90c('0xf'));var Papa=require(_0xf90c('0x10'));var Redis=require(_0xf90c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf90c('0x12'));var as=require(_0xf90c('0x13'));var hardwareService=require(_0xf90c('0x14'));var logger=require(_0xf90c('0x15'))(_0xf90c('0x16'));var utils=require(_0xf90c('0x17'));var config=require(_0xf90c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf90c('0x19'))['db'];function respondWithStatusCode(_0x91c220,_0x3d5100){_0x3d5100=_0x3d5100||0xcc;return function(_0x4d96b6){if(_0x4d96b6){return _0x91c220[_0xf90c('0x1a')](_0x3d5100);}return _0x91c220['status'](_0x3d5100)[_0xf90c('0x1b')]();};}function respondWithResult(_0x32b915,_0x470df7){_0x470df7=_0x470df7||0xc8;return function(_0x3f7667){if(_0x3f7667){return _0x32b915[_0xf90c('0x1c')](_0x470df7)[_0xf90c('0x1d')](_0x3f7667);}};}function respondWithFilteredResult(_0xdd671b,_0x5afa1a){return function(_0x268401){if(_0x268401){var _0x2bbab7=typeof _0x5afa1a[_0xf90c('0x1e')]===_0xf90c('0x1f')&&typeof _0x5afa1a[_0xf90c('0x20')]===_0xf90c('0x1f');var _0x1a94d4=_0x268401[_0xf90c('0x21')];var _0x4f2925=_0x2bbab7?0x0:_0x5afa1a[_0xf90c('0x1e')];var _0x23ad6e=_0x2bbab7?_0x268401[_0xf90c('0x21')]:_0x5afa1a[_0xf90c('0x1e')]+_0x5afa1a[_0xf90c('0x20')];var _0x396efe;if(_0x23ad6e>=_0x1a94d4){_0x23ad6e=_0x1a94d4;_0x396efe=0xc8;}else{_0x396efe=0xce;}_0xdd671b[_0xf90c('0x1c')](_0x396efe);return _0xdd671b['set'](_0xf90c('0x22'),_0x4f2925+'-'+_0x23ad6e+'/'+_0x1a94d4)[_0xf90c('0x1d')](_0x268401);}return null;};}function patchUpdates(_0x182e66){return function(_0x46571c){try{jsonpatch[_0xf90c('0x23')](_0x46571c,_0x182e66,!![]);}catch(_0x3d0276){return BPromise[_0xf90c('0x24')](_0x3d0276);}return _0x46571c[_0xf90c('0x25')]();};}function saveUpdates(_0x54f134,_0x469c93){return function(_0x262712){if(_0x262712){return _0x262712[_0xf90c('0x26')](_0x54f134)[_0xf90c('0x27')](function(_0x4f8048){return _0x4f8048;});}return null;};}function removeEntity(_0x324cdc,_0x3c941e){return function(_0x196ae5){if(_0x196ae5){return _0x196ae5[_0xf90c('0x28')]()[_0xf90c('0x27')](function(){_0x324cdc[_0xf90c('0x1c')](0xcc)[_0xf90c('0x1b')]();});}};}function handleEntityNotFound(_0x542f6e,_0x11593c){return function(_0x7cab12){if(!_0x7cab12){_0x542f6e[_0xf90c('0x1a')](0x194);}return _0x7cab12;};}function handleError(_0x366c63,_0x49caf4){_0x49caf4=_0x49caf4||0x1f4;return function(_0x540908){logger['error'](_0x540908['stack']);if(_0x540908[_0xf90c('0x29')]){delete _0x540908[_0xf90c('0x29')];}_0x366c63['status'](_0x49caf4)[_0xf90c('0x2a')](_0x540908);};}exports[_0xf90c('0x2b')]=function(_0xaf5576,_0x272b91){var _0x32f440={},_0x486909={},_0x14bae3={'count':0x0,'rows':[]};var _0x425e3d=_[_0xf90c('0x2c')](db[_0xf90c('0x2d')]['rawAttributes'],function(_0x90f2cc){return{'name':_0x90f2cc[_0xf90c('0x2e')],'type':_0x90f2cc['type']['key']};});_0x486909['model']=_[_0xf90c('0x2c')](_0x425e3d,'name');_0x486909[_0xf90c('0x2f')]=_[_0xf90c('0x30')](_0xaf5576[_0xf90c('0x2f')]);_0x486909[_0xf90c('0x31')]=_[_0xf90c('0x32')](_0x486909[_0xf90c('0x33')],_0x486909[_0xf90c('0x2f')]);_0x32f440[_0xf90c('0x34')]=_['intersection'](_0x486909['model'],qs[_0xf90c('0x35')](_0xaf5576[_0xf90c('0x2f')][_0xf90c('0x35')]));_0x32f440['attributes']=_0x32f440['attributes'][_0xf90c('0x36')]?_0x32f440['attributes']:_0x486909[_0xf90c('0x33')];if(!_0xaf5576[_0xf90c('0x2f')][_0xf90c('0x37')]('nolimit')){_0x32f440[_0xf90c('0x20')]=qs[_0xf90c('0x20')](_0xaf5576[_0xf90c('0x2f')][_0xf90c('0x20')]);_0x32f440[_0xf90c('0x1e')]=qs['offset'](_0xaf5576[_0xf90c('0x2f')][_0xf90c('0x1e')]);}_0x32f440['order']=qs[_0xf90c('0x38')](_0xaf5576['query'][_0xf90c('0x38')]);_0x32f440[_0xf90c('0x39')]=qs[_0xf90c('0x31')](_[_0xf90c('0x3a')](_0xaf5576[_0xf90c('0x2f')],_0x486909[_0xf90c('0x31')]),_0x425e3d);if(_0xaf5576[_0xf90c('0x2f')][_0xf90c('0x3b')]){_0x32f440[_0xf90c('0x39')]=_['merge'](_0x32f440[_0xf90c('0x39')],{'$or':_[_0xf90c('0x2c')](_0x425e3d,function(_0x4f2291){if(_0x4f2291['type']!==_0xf90c('0x3c')){var _0x4c2e85={};_0x4c2e85[_0x4f2291[_0xf90c('0x29')]]={'$like':'%'+_0xaf5576[_0xf90c('0x2f')]['filter']+'%'};return _0x4c2e85;}})});}_0x32f440=_['merge']({},_0x32f440,_0xaf5576[_0xf90c('0x3d')]);var _0x399d8e={'where':_0x32f440['where']};return db[_0xf90c('0x2d')]['count'](_0x399d8e)[_0xf90c('0x27')](function(_0x1b5001){_0x14bae3[_0xf90c('0x21')]=_0x1b5001;if(_0xaf5576[_0xf90c('0x2f')][_0xf90c('0x3e')]){_0x32f440[_0xf90c('0x3f')]=[{'all':!![]}];}return db[_0xf90c('0x2d')][_0xf90c('0x40')](_0x32f440);})[_0xf90c('0x27')](function(_0x3b06e0){_0x14bae3[_0xf90c('0x41')]=_0x3b06e0;return _0x14bae3;})[_0xf90c('0x27')](respondWithFilteredResult(_0x272b91,_0x32f440))[_0xf90c('0x42')](handleError(_0x272b91,null));};exports[_0xf90c('0x43')]=function(_0xf0bb62,_0x16baa8){var _0x4893d6={'raw':!![],'where':{'id':_0xf0bb62['params']['id']}},_0x4f604e={};_0x4f604e['model']=_[_0xf90c('0x30')](db[_0xf90c('0x2d')][_0xf90c('0x44')]);_0x4f604e[_0xf90c('0x2f')]=_[_0xf90c('0x30')](_0xf0bb62[_0xf90c('0x2f')]);_0x4f604e[_0xf90c('0x31')]=_['intersection'](_0x4f604e[_0xf90c('0x33')],_0x4f604e[_0xf90c('0x2f')]);_0x4893d6['attributes']=_['intersection'](_0x4f604e['model'],qs[_0xf90c('0x35')](_0xf0bb62[_0xf90c('0x2f')]['fields']));_0x4893d6['attributes']=_0x4893d6[_0xf90c('0x34')][_0xf90c('0x36')]?_0x4893d6[_0xf90c('0x34')]:_0x4f604e[_0xf90c('0x33')];if(_0xf0bb62[_0xf90c('0x2f')]['includeAll']){_0x4893d6[_0xf90c('0x3f')]=[{'all':!![]}];}_0x4893d6=_['merge']({},_0x4893d6,_0xf0bb62[_0xf90c('0x3d')]);return db[_0xf90c('0x2d')]['find'](_0x4893d6)['then'](handleEntityNotFound(_0x16baa8,null))['then'](respondWithResult(_0x16baa8,null))['catch'](handleError(_0x16baa8,null));};exports[_0xf90c('0x45')]=function(_0x3356e7,_0x452f47){return db[_0xf90c('0x2d')][_0xf90c('0x45')](_0x3356e7[_0xf90c('0x46')],{})['then'](respondWithResult(_0x452f47,0xc9))[_0xf90c('0x42')](handleError(_0x452f47,null));};exports[_0xf90c('0x26')]=function(_0x4f5e70,_0x55fa81){if(_0x4f5e70[_0xf90c('0x46')]['id']){delete _0x4f5e70[_0xf90c('0x46')]['id'];}return db[_0xf90c('0x2d')]['find']({'where':{'id':_0x4f5e70[_0xf90c('0x47')]['id']}})[_0xf90c('0x27')](handleEntityNotFound(_0x55fa81,null))[_0xf90c('0x27')](saveUpdates(_0x4f5e70[_0xf90c('0x46')],null))[_0xf90c('0x27')](respondWithResult(_0x55fa81,null))[_0xf90c('0x42')](handleError(_0x55fa81,null));};exports['destroy']=function(_0x10108a,_0x29f9c1){return db[_0xf90c('0x2d')][_0xf90c('0x48')]({'where':{'id':_0x10108a[_0xf90c('0x47')]['id']}})[_0xf90c('0x27')](handleEntityNotFound(_0x29f9c1,null))[_0xf90c('0x27')](removeEntity(_0x29f9c1,null))['catch'](handleError(_0x29f9c1,null));};exports['describe']=function(_0x5eefa9,_0x243d77){return db[_0xf90c('0x2d')]['describe']()['then'](respondWithResult(_0x243d77,null))['catch'](handleError(_0x243d77,null));}; \ No newline at end of file +var _0x71ff=['ejs','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','status','end','json','offset','undefined','limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','count','includeAll','include','rows','show','params','find','catch','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1605b7,_0x13302a){var _0x3c6527=function(_0x3a2240){while(--_0x3a2240){_0x1605b7['push'](_0x1605b7['shift']());}};_0x3c6527(++_0x13302a);}(_0x71ff,0x17d));var _0xf71f=function(_0x521735,_0x251133){_0x521735=_0x521735-0x0;var _0x982dcc=_0x71ff[_0x521735];return _0x982dcc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf71f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf71f('0x1'));var moment=require(_0xf71f('0x2'));var BPromise=require(_0xf71f('0x3'));var Mustache=require(_0xf71f('0x4'));var util=require(_0xf71f('0x5'));var path=require(_0xf71f('0x6'));var sox=require(_0xf71f('0x7'));var csv=require(_0xf71f('0x8'));var ejs=require(_0xf71f('0x9'));var fs=require('fs');var fs_extra=require(_0xf71f('0xa'));var _=require(_0xf71f('0xb'));var squel=require('squel');var crypto=require(_0xf71f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf71f('0xd'));var toCsv=require(_0xf71f('0x8'));var querystring=require(_0xf71f('0xe'));var Papa=require(_0xf71f('0xf'));var Redis=require(_0xf71f('0x10'));var authService=require(_0xf71f('0x11'));var qs=require(_0xf71f('0x12'));var as=require(_0xf71f('0x13'));var hardwareService=require(_0xf71f('0x14'));var logger=require('../../config/logger')(_0xf71f('0x15'));var utils=require('../../config/utils');var config=require(_0xf71f('0x16'));var licenseUtil=require(_0xf71f('0x17'));var db=require(_0xf71f('0x18'))['db'];function respondWithStatusCode(_0x13ef1b,_0x299768){_0x299768=_0x299768||0xcc;return function(_0x193695){if(_0x193695){return _0x13ef1b['sendStatus'](_0x299768);}return _0x13ef1b[_0xf71f('0x19')](_0x299768)[_0xf71f('0x1a')]();};}function respondWithResult(_0x52ffff,_0x10ba3f){_0x10ba3f=_0x10ba3f||0xc8;return function(_0x4c7097){if(_0x4c7097){return _0x52ffff[_0xf71f('0x19')](_0x10ba3f)[_0xf71f('0x1b')](_0x4c7097);}};}function respondWithFilteredResult(_0xeeed77,_0x3196c1){return function(_0x112600){if(_0x112600){var _0x194741=typeof _0x3196c1[_0xf71f('0x1c')]===_0xf71f('0x1d')&&typeof _0x3196c1['limit']===_0xf71f('0x1d');var _0x393ae2=_0x112600['count'];var _0x146163=_0x194741?0x0:_0x3196c1[_0xf71f('0x1c')];var _0x1130d2=_0x194741?_0x112600['count']:_0x3196c1[_0xf71f('0x1c')]+_0x3196c1[_0xf71f('0x1e')];var _0x5e728b;if(_0x1130d2>=_0x393ae2){_0x1130d2=_0x393ae2;_0x5e728b=0xc8;}else{_0x5e728b=0xce;}_0xeeed77['status'](_0x5e728b);return _0xeeed77[_0xf71f('0x1f')]('Content-Range',_0x146163+'-'+_0x1130d2+'/'+_0x393ae2)['json'](_0x112600);}return null;};}function patchUpdates(_0x41fdfc){return function(_0x337274){try{jsonpatch['apply'](_0x337274,_0x41fdfc,!![]);}catch(_0x537316){return BPromise[_0xf71f('0x20')](_0x537316);}return _0x337274[_0xf71f('0x21')]();};}function saveUpdates(_0x507958,_0x45fe96){return function(_0x294777){if(_0x294777){return _0x294777[_0xf71f('0x22')](_0x507958)[_0xf71f('0x23')](function(_0xd3f072){return _0xd3f072;});}return null;};}function removeEntity(_0x16bafa,_0x31db9e){return function(_0x40700b){if(_0x40700b){return _0x40700b[_0xf71f('0x24')]()[_0xf71f('0x23')](function(){_0x16bafa[_0xf71f('0x19')](0xcc)[_0xf71f('0x1a')]();});}};}function handleEntityNotFound(_0x3477df,_0x11b4f3){return function(_0x545751){if(!_0x545751){_0x3477df[_0xf71f('0x25')](0x194);}return _0x545751;};}function handleError(_0x201a56,_0x16bd01){_0x16bd01=_0x16bd01||0x1f4;return function(_0x3eacce){logger[_0xf71f('0x26')](_0x3eacce[_0xf71f('0x27')]);if(_0x3eacce['name']){delete _0x3eacce[_0xf71f('0x28')];}_0x201a56[_0xf71f('0x19')](_0x16bd01)[_0xf71f('0x29')](_0x3eacce);};}exports[_0xf71f('0x2a')]=function(_0x178750,_0x475b46){var _0x1f1007={},_0x39002e={},_0x37fb7f={'count':0x0,'rows':[]};var _0x19df97=_[_0xf71f('0x2b')](db[_0xf71f('0x2c')][_0xf71f('0x2d')],function(_0x17299b){return{'name':_0x17299b[_0xf71f('0x2e')],'type':_0x17299b[_0xf71f('0x2f')][_0xf71f('0x30')]};});_0x39002e['model']=_[_0xf71f('0x2b')](_0x19df97,_0xf71f('0x28'));_0x39002e[_0xf71f('0x31')]=_[_0xf71f('0x32')](_0x178750[_0xf71f('0x31')]);_0x39002e['filters']=_['intersection'](_0x39002e['model'],_0x39002e[_0xf71f('0x31')]);_0x1f1007[_0xf71f('0x33')]=_[_0xf71f('0x34')](_0x39002e['model'],qs[_0xf71f('0x35')](_0x178750[_0xf71f('0x31')]['fields']));_0x1f1007[_0xf71f('0x33')]=_0x1f1007[_0xf71f('0x33')][_0xf71f('0x36')]?_0x1f1007['attributes']:_0x39002e[_0xf71f('0x37')];if(!_0x178750[_0xf71f('0x31')][_0xf71f('0x38')](_0xf71f('0x39'))){_0x1f1007[_0xf71f('0x1e')]=qs[_0xf71f('0x1e')](_0x178750[_0xf71f('0x31')][_0xf71f('0x1e')]);_0x1f1007[_0xf71f('0x1c')]=qs[_0xf71f('0x1c')](_0x178750['query'][_0xf71f('0x1c')]);}_0x1f1007[_0xf71f('0x3a')]=qs[_0xf71f('0x3b')](_0x178750['query'][_0xf71f('0x3b')]);_0x1f1007['where']=qs['filters'](_[_0xf71f('0x3c')](_0x178750[_0xf71f('0x31')],_0x39002e[_0xf71f('0x3d')]),_0x19df97);if(_0x178750['query'][_0xf71f('0x3e')]){_0x1f1007['where']=_[_0xf71f('0x3f')](_0x1f1007['where'],{'$or':_[_0xf71f('0x2b')](_0x19df97,function(_0x5c26cc){if(_0x5c26cc[_0xf71f('0x2f')]!==_0xf71f('0x40')){var _0x3c57e1={};_0x3c57e1[_0x5c26cc[_0xf71f('0x28')]]={'$like':'%'+_0x178750[_0xf71f('0x31')][_0xf71f('0x3e')]+'%'};return _0x3c57e1;}})});}_0x1f1007=_[_0xf71f('0x3f')]({},_0x1f1007,_0x178750[_0xf71f('0x41')]);var _0x170449={'where':_0x1f1007[_0xf71f('0x42')]};return db[_0xf71f('0x2c')][_0xf71f('0x43')](_0x170449)[_0xf71f('0x23')](function(_0x53f094){_0x37fb7f[_0xf71f('0x43')]=_0x53f094;if(_0x178750['query'][_0xf71f('0x44')]){_0x1f1007[_0xf71f('0x45')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x1f1007);})[_0xf71f('0x23')](function(_0x401b45){_0x37fb7f[_0xf71f('0x46')]=_0x401b45;return _0x37fb7f;})[_0xf71f('0x23')](respondWithFilteredResult(_0x475b46,_0x1f1007))['catch'](handleError(_0x475b46,null));};exports[_0xf71f('0x47')]=function(_0x510c17,_0x2a5524){var _0x4143be={'raw':!![],'where':{'id':_0x510c17[_0xf71f('0x48')]['id']}},_0x487b54={};_0x487b54[_0xf71f('0x37')]=_['keys'](db[_0xf71f('0x2c')]['rawAttributes']);_0x487b54[_0xf71f('0x31')]=_[_0xf71f('0x32')](_0x510c17[_0xf71f('0x31')]);_0x487b54[_0xf71f('0x3d')]=_[_0xf71f('0x34')](_0x487b54[_0xf71f('0x37')],_0x487b54[_0xf71f('0x31')]);_0x4143be[_0xf71f('0x33')]=_[_0xf71f('0x34')](_0x487b54[_0xf71f('0x37')],qs[_0xf71f('0x35')](_0x510c17['query'][_0xf71f('0x35')]));_0x4143be['attributes']=_0x4143be[_0xf71f('0x33')][_0xf71f('0x36')]?_0x4143be[_0xf71f('0x33')]:_0x487b54['model'];if(_0x510c17[_0xf71f('0x31')]['includeAll']){_0x4143be[_0xf71f('0x45')]=[{'all':!![]}];}_0x4143be=_[_0xf71f('0x3f')]({},_0x4143be,_0x510c17['options']);return db[_0xf71f('0x2c')][_0xf71f('0x49')](_0x4143be)[_0xf71f('0x23')](handleEntityNotFound(_0x2a5524,null))[_0xf71f('0x23')](respondWithResult(_0x2a5524,null))[_0xf71f('0x4a')](handleError(_0x2a5524,null));};exports[_0xf71f('0x4b')]=function(_0x3b1987,_0x4cbde5){return db[_0xf71f('0x2c')][_0xf71f('0x4b')](_0x3b1987[_0xf71f('0x4c')],{})[_0xf71f('0x23')](respondWithResult(_0x4cbde5,0xc9))[_0xf71f('0x4a')](handleError(_0x4cbde5,null));};exports['update']=function(_0x10a340,_0x349067){if(_0x10a340[_0xf71f('0x4c')]['id']){delete _0x10a340[_0xf71f('0x4c')]['id'];}return db[_0xf71f('0x2c')][_0xf71f('0x49')]({'where':{'id':_0x10a340[_0xf71f('0x48')]['id']}})['then'](handleEntityNotFound(_0x349067,null))[_0xf71f('0x23')](saveUpdates(_0x10a340[_0xf71f('0x4c')],null))[_0xf71f('0x23')](respondWithResult(_0x349067,null))[_0xf71f('0x4a')](handleError(_0x349067,null));};exports[_0xf71f('0x24')]=function(_0x1f4e4d,_0x390379){return db[_0xf71f('0x2c')][_0xf71f('0x49')]({'where':{'id':_0x1f4e4d['params']['id']}})[_0xf71f('0x23')](handleEntityNotFound(_0x390379,null))[_0xf71f('0x23')](removeEntity(_0x390379,null))[_0xf71f('0x4a')](handleError(_0x390379,null));};exports[_0xf71f('0x4d')]=function(_0x5cc0c6,_0x429f0f){return db[_0xf71f('0x2c')]['describe']()['then'](respondWithResult(_0x429f0f,null))[_0xf71f('0x4a')](handleError(_0x429f0f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0fbad5c..27674c1 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 _0x7189=['lodash','util','../../config/logger','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7189,0x14a));var _0x9718=function(_0x3c1a4e,_0x36dabf){_0x3c1a4e=_0x3c1a4e-0x0;var _0x155a91=_0x7189[_0x3c1a4e];return _0x155a91;};'use strict';var _=require(_0x9718('0x0'));var util=require(_0x9718('0x1'));var logger=require(_0x9718('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9718('0x3'));var rimraf=require('rimraf');var config=require(_0x9718('0x4'));var attributes=require(_0x9718('0x5'));module[_0x9718('0x6')]=function(_0x5a7403,_0x38cb7b){return _0x5a7403[_0x9718('0x7')](_0x9718('0x8'),attributes,{'tableName':_0x9718('0x9'),'paranoid':![],'indexes':[{'name':_0x9718('0xa'),'fields':[_0x9718('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5525=['define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','path','./faxTransferReport.attributes','exports'];(function(_0x131cb3,_0x59b323){var _0x1557ca=function(_0x39f772){while(--_0x39f772){_0x131cb3['push'](_0x131cb3['shift']());}};_0x1557ca(++_0x59b323);}(_0x5525,0x87));var _0x5552=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5525[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5552('0x0'));var util=require(_0x5552('0x1'));var logger=require(_0x5552('0x2'))(_0x5552('0x3'));var moment=require(_0x5552('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5552('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5552('0x6'));module[_0x5552('0x7')]=function(_0x5da9b2,_0x28df4f){return _0x5da9b2[_0x5552('0x8')](_0x5552('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x5552('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index a1d2e1a..1294705 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 _0x5bb5=['stringify','error','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x523d9e,_0x352fb4){var _0x59d330=function(_0x47e8c0){while(--_0x47e8c0){_0x523d9e['push'](_0x523d9e['shift']());}};_0x59d330(++_0x352fb4);}(_0x5bb5,0x1cc));var _0x55bb=function(_0x222d81,_0x25a457){_0x222d81=_0x222d81-0x0;var _0x2c1e51=_0x5bb5[_0x222d81];return _0x2c1e51;};'use strict';var _=require(_0x55bb('0x0'));var util=require(_0x55bb('0x1'));var moment=require(_0x55bb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x55bb('0x4'));var logger=require(_0x55bb('0x5'))(_0x55bb('0x6'));var config=require(_0x55bb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47c070,_0x4fd9ba,_0x4db5f0){return new BPromise(function(_0x443aa3,_0x560e1c){return client[_0x55bb('0x9')](_0x47c070,_0x4db5f0)[_0x55bb('0xa')](function(_0x22b402){logger['info'](_0x55bb('0xb'),_0x4fd9ba,_0x55bb('0xc'));logger[_0x55bb('0xd')](_0x55bb('0xe'),_0x4fd9ba,'request\x20sent',JSON[_0x55bb('0xf')](_0x22b402));if(_0x22b402[_0x55bb('0x10')]){if(_0x22b402[_0x55bb('0x10')]['code']===0x1f4){logger['error'](_0x55bb('0xb'),_0x4fd9ba,_0x22b402[_0x55bb('0x10')][_0x55bb('0x11')]);return _0x560e1c(_0x22b402['error']['message']);}logger[_0x55bb('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4fd9ba,_0x22b402[_0x55bb('0x10')]['message']);return _0x443aa3(_0x22b402['error'][_0x55bb('0x11')]);}else{logger['info'](_0x55bb('0xb'),_0x4fd9ba,_0x55bb('0xc'));_0x443aa3(_0x22b402['result']['message']);}})[_0x55bb('0x12')](function(_0x15cf68){logger[_0x55bb('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x4fd9ba,_0x15cf68);_0x560e1c(_0x15cf68);});});} \ No newline at end of file +var _0x638c=['request','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5e2d82,_0x30f308){var _0x3d0bef=function(_0x54a6a6){while(--_0x54a6a6){_0x5e2d82['push'](_0x5e2d82['shift']());}};_0x3d0bef(++_0x30f308);}(_0x638c,0x9b));var _0xc638=function(_0x38bb88,_0x56c8e5){_0x38bb88=_0x38bb88-0x0;var _0x3cbfab=_0x638c[_0x38bb88];return _0x3cbfab;};'use strict';var _=require(_0xc638('0x0'));var util=require(_0xc638('0x1'));var moment=require(_0xc638('0x2'));var BPromise=require(_0xc638('0x3'));var rs=require(_0xc638('0x4'));var fs=require('fs');var Redis=require(_0xc638('0x5'));var db=require(_0xc638('0x6'))['db'];var utils=require(_0xc638('0x7'));var logger=require(_0xc638('0x8'))('rpc');var config=require(_0xc638('0x9'));var jayson=require(_0xc638('0xa'));var client=jayson[_0xc638('0xb')][_0xc638('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3e2d,_0x368d53,_0x4b6adf){return new BPromise(function(_0x2e2c32,_0x3c7694){return client[_0xc638('0xd')](_0x5f3e2d,_0x4b6adf)['then'](function(_0x45a518){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x368d53,'request\x20sent');logger[_0xc638('0xe')](_0xc638('0xf'),_0x368d53,_0xc638('0x10'),JSON['stringify'](_0x45a518));if(_0x45a518['error']){if(_0x45a518[_0xc638('0x11')][_0xc638('0x12')]===0x1f4){logger[_0xc638('0x11')](_0xc638('0x13'),_0x368d53,_0x45a518[_0xc638('0x11')][_0xc638('0x14')]);return _0x3c7694(_0x45a518[_0xc638('0x11')][_0xc638('0x14')]);}logger[_0xc638('0x11')](_0xc638('0x13'),_0x368d53,_0x45a518[_0xc638('0x11')][_0xc638('0x14')]);return _0x2e2c32(_0x45a518[_0xc638('0x11')]['message']);}else{logger[_0xc638('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x368d53,_0xc638('0x10'));_0x2e2c32(_0x45a518[_0xc638('0x16')][_0xc638('0x14')]);}})[_0xc638('0x17')](function(_0x44be02){logger['error'](_0xc638('0x13'),_0x368d53,_0x44be02);_0x3c7694(_0x44be02);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3770d0f..dc84d17 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 _0x2674=['show','post','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2674,0x7e));var _0x4267=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2674[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x4267('0x0'));var util=require(_0x4267('0x1'));var path=require(_0x4267('0x2'));var timeout=require('connect-timeout');var express=require(_0x4267('0x3'));var router=express[_0x4267('0x4')]();var fs_extra=require(_0x4267('0x5'));var auth=require(_0x4267('0x6'));var interaction=require(_0x4267('0x7'));var config=require('../../config/environment');var controller=require(_0x4267('0x8'));router[_0x4267('0x9')]('/',auth[_0x4267('0xa')](),controller[_0x4267('0xb')]);router[_0x4267('0x9')]('/describe',auth[_0x4267('0xa')](),controller[_0x4267('0xc')]);router[_0x4267('0x9')](_0x4267('0xd'),auth[_0x4267('0xa')](),controller[_0x4267('0xe')]);router[_0x4267('0xf')]('/',auth[_0x4267('0xa')](),controller[_0x4267('0x10')]);router[_0x4267('0x11')](_0x4267('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x4267('0x12')]('/:id',auth[_0x4267('0xa')](),controller['destroy']);module[_0x4267('0x13')]=router; \ No newline at end of file +var _0x3e60=['/describe','describe','/:id','show','post','create','put','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x3e60,0xa1));var _0x03e6=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x3e60[_0x34d346];return _0x122d76;};'use strict';var multer=require('multer');var util=require(_0x03e6('0x0'));var path=require(_0x03e6('0x1'));var timeout=require(_0x03e6('0x2'));var express=require('express');var router=express[_0x03e6('0x3')]();var fs_extra=require(_0x03e6('0x4'));var auth=require(_0x03e6('0x5'));var interaction=require(_0x03e6('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x03e6('0x7')]('/',auth[_0x03e6('0x8')](),controller[_0x03e6('0x9')]);router[_0x03e6('0x7')](_0x03e6('0xa'),auth['isAuthenticated'](),controller[_0x03e6('0xb')]);router[_0x03e6('0x7')](_0x03e6('0xc'),auth[_0x03e6('0x8')](),controller[_0x03e6('0xd')]);router[_0x03e6('0xe')]('/',auth[_0x03e6('0x8')](),controller[_0x03e6('0xf')]);router[_0x03e6('0x10')](_0x03e6('0xc'),auth[_0x03e6('0x8')](),controller[_0x03e6('0x11')]);router[_0x03e6('0x12')](_0x03e6('0xc'),auth[_0x03e6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b7a7f9f..8ecda5b 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 _0x54c4=['/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','/:id/configurations','/:id/fields','getFields','post','create','put','update'];(function(_0x283e4d,_0xd4043c){var _0x3ee73a=function(_0x3aaaaa){while(--_0x3aaaaa){_0x283e4d['push'](_0x283e4d['shift']());}};_0x3ee73a(++_0xd4043c);}(_0x54c4,0x112));var _0x454c=function(_0x3199f2,_0x664299){_0x3199f2=_0x3199f2-0x0;var _0x26272c=_0x54c4[_0x3199f2];return _0x26272c;};'use strict';var multer=require(_0x454c('0x0'));var util=require(_0x454c('0x1'));var path=require(_0x454c('0x2'));var timeout=require(_0x454c('0x3'));var express=require(_0x454c('0x4'));var router=express[_0x454c('0x5')]();var fs_extra=require(_0x454c('0x6'));var auth=require(_0x454c('0x7'));var interaction=require(_0x454c('0x8'));var config=require(_0x454c('0x9'));var controller=require(_0x454c('0xa'));router['get']('/',auth[_0x454c('0xb')](),controller['index']);router[_0x454c('0xc')]('/:id',auth[_0x454c('0xb')](),controller['show']);router['get'](_0x454c('0xd'),auth[_0x454c('0xb')](),controller['getConfigurations']);router[_0x454c('0xc')](_0x454c('0xe'),auth[_0x454c('0xb')](),controller[_0x454c('0xf')]);router[_0x454c('0x10')]('/',auth[_0x454c('0xb')](),controller[_0x454c('0x11')]);router[_0x454c('0x10')](_0x454c('0xd'),auth[_0x454c('0xb')](),controller['addConfiguration']);router[_0x454c('0x12')]('/:id',auth[_0x454c('0xb')](),controller[_0x454c('0x13')]);router['delete'](_0x454c('0x14'),auth[_0x454c('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x66ac=['index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x66ac,0x98));var _0xc66a=function(_0x45adc1,_0x54d088){_0x45adc1=_0x45adc1-0x0;var _0x4297fc=_0x66ac[_0x45adc1];return _0x4297fc;};'use strict';var multer=require(_0xc66a('0x0'));var util=require(_0xc66a('0x1'));var path=require(_0xc66a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc66a('0x3'));var auth=require(_0xc66a('0x4'));var interaction=require(_0xc66a('0x5'));var config=require(_0xc66a('0x6'));var controller=require(_0xc66a('0x7'));router['get']('/',auth[_0xc66a('0x8')](),controller[_0xc66a('0x9')]);router[_0xc66a('0xa')](_0xc66a('0xb'),auth[_0xc66a('0x8')](),controller[_0xc66a('0xc')]);router[_0xc66a('0xa')](_0xc66a('0xd'),auth[_0xc66a('0x8')](),controller[_0xc66a('0xe')]);router[_0xc66a('0xa')](_0xc66a('0xf'),auth[_0xc66a('0x8')](),controller[_0xc66a('0x10')]);router[_0xc66a('0x11')]('/',auth[_0xc66a('0x8')](),controller[_0xc66a('0x12')]);router[_0xc66a('0x11')](_0xc66a('0xd'),auth[_0xc66a('0x8')](),controller['addConfiguration']);router[_0xc66a('0x13')](_0xc66a('0xb'),auth[_0xc66a('0x8')](),controller['update']);router[_0xc66a('0x14')](_0xc66a('0xb'),auth[_0xc66a('0x8')](),controller[_0xc66a('0x15')]);module[_0xc66a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ee76d40..7753eb7 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 _0xe52b=['basic','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x1293dd,_0xf28d6d){var _0x12faa8=function(_0x38635d){while(--_0x38635d){_0x1293dd['push'](_0x1293dd['shift']());}};_0x12faa8(++_0xf28d6d);}(_0xe52b,0x98));var _0xbe52=function(_0x6330a4,_0x31ce3f){_0x6330a4=_0x6330a4-0x0;var _0x3a9b65=_0xe52b[_0x6330a4];return _0x3a9b65;};'use strict';var Sequelize=require(_0xbe52('0x0'));module[_0xbe52('0x1')]={'name':{'type':Sequelize[_0xbe52('0x2')]},'description':{'type':Sequelize[_0xbe52('0x2')]},'username':{'type':Sequelize[_0xbe52('0x2')]},'remoteUri':{'type':Sequelize[_0xbe52('0x2')]},'authType':{'type':Sequelize[_0xbe52('0x3')]('basic'),'defaultValue':_0xbe52('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xbe52('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbe52('0x3')]('integrationTab','newTab'),'defaultValue':_0xbe52('0x5')}}; \ No newline at end of file +var _0x9afd=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x165ca9,_0x36e359){var _0x25f49a=function(_0x3da5e5){while(--_0x3da5e5){_0x165ca9['push'](_0x165ca9['shift']());}};_0x25f49a(++_0x36e359);}(_0x9afd,0x16e));var _0xd9af=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x9afd[_0x289e64];return _0x30246c;};'use strict';var Sequelize=require('sequelize');module[_0xd9af('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd9af('0x1')]},'remoteUri':{'type':Sequelize[_0xd9af('0x1')]},'authType':{'type':Sequelize[_0xd9af('0x2')](_0xd9af('0x3')),'defaultValue':_0xd9af('0x3')},'password':{'type':Sequelize[_0xd9af('0x1')]},'consumerKey':{'type':Sequelize[_0xd9af('0x1')]},'consumerSecret':{'type':Sequelize[_0xd9af('0x1')]},'token':{'type':Sequelize[_0xd9af('0x1')]},'tokenSecret':{'type':Sequelize[_0xd9af('0x1')]},'serverUrl':{'type':Sequelize[_0xd9af('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd9af('0x2')](_0xd9af('0x4'),_0xd9af('0x5')),'defaultValue':_0xd9af('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index fb6e212..b847a07 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 _0x6497=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','DeskAccount','then','includeAll','findAll','rows','catch','length','find','create','body','getConfigurations','findOne','params','DeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','format','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x2e353f,_0x15d70a){var _0x4b0700=function(_0x2140ee){while(--_0x2140ee){_0x2e353f['push'](_0x2e353f['shift']());}};_0x4b0700(++_0x15d70a);}(_0x6497,0x1a5));var _0x7649=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x6497[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0x7649('0x0'));var rimraf=require(_0x7649('0x1'));var zipdir=require(_0x7649('0x2'));var jsonpatch=require(_0x7649('0x3'));var rp=require('request-promise');var moment=require(_0x7649('0x4'));var BPromise=require(_0x7649('0x5'));var Mustache=require(_0x7649('0x6'));var util=require(_0x7649('0x7'));var path=require('path');var sox=require(_0x7649('0x8'));var csv=require(_0x7649('0x9'));var ejs=require(_0x7649('0xa'));var fs=require('fs');var fs_extra=require(_0x7649('0xb'));var _=require(_0x7649('0xc'));var squel=require('squel');var crypto=require(_0x7649('0xd'));var jsforce=require(_0x7649('0xe'));var deskjs=require(_0x7649('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7649('0x10'));var Papa=require(_0x7649('0x11'));var Redis=require('ioredis');var authService=require(_0x7649('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7649('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7649('0x14'))(_0x7649('0x15'));var utils=require(_0x7649('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7649('0x17'))['db'];var integrations=require(_0x7649('0x18'));function respondWithStatusCode(_0x5d4bfd,_0x8d66a){_0x8d66a=_0x8d66a||0xcc;return function(_0x377527){if(_0x377527){return _0x5d4bfd[_0x7649('0x19')](_0x8d66a);}return _0x5d4bfd[_0x7649('0x1a')](_0x8d66a)[_0x7649('0x1b')]();};}function respondWithResult(_0x5efd70,_0xb7ec8d){_0xb7ec8d=_0xb7ec8d||0xc8;return function(_0x2391e8){if(_0x2391e8){return _0x5efd70[_0x7649('0x1a')](_0xb7ec8d)[_0x7649('0x1c')](_0x2391e8);}};}function respondWithFilteredResult(_0x17831a,_0x19f1eb){return function(_0x1b49f6){if(_0x1b49f6){var _0x5a39c1=typeof _0x19f1eb[_0x7649('0x1d')]==='undefined'&&typeof _0x19f1eb['limit']==='undefined';var _0x3d095f=_0x1b49f6[_0x7649('0x1e')];var _0x24a6d7=_0x5a39c1?0x0:_0x19f1eb[_0x7649('0x1d')];var _0x5a8a4b=_0x5a39c1?_0x1b49f6[_0x7649('0x1e')]:_0x19f1eb[_0x7649('0x1d')]+_0x19f1eb[_0x7649('0x1f')];var _0x19abea;if(_0x5a8a4b>=_0x3d095f){_0x5a8a4b=_0x3d095f;_0x19abea=0xc8;}else{_0x19abea=0xce;}_0x17831a[_0x7649('0x1a')](_0x19abea);return _0x17831a['set'](_0x7649('0x20'),_0x24a6d7+'-'+_0x5a8a4b+'/'+_0x3d095f)[_0x7649('0x1c')](_0x1b49f6);}return null;};}function patchUpdates(_0x2f0677){return function(_0x337ed1){try{jsonpatch[_0x7649('0x21')](_0x337ed1,_0x2f0677,!![]);}catch(_0x1b6a82){return BPromise[_0x7649('0x22')](_0x1b6a82);}return _0x337ed1[_0x7649('0x23')]();};}function saveUpdates(_0x3694e7,_0x26c67e){return function(_0x5203e5){if(_0x5203e5){return _0x5203e5[_0x7649('0x24')](_0x3694e7)['then'](function(_0x583c74){return _0x583c74;});}return null;};}function removeEntity(_0xa6dcae,_0x1ccd52){return function(_0x5d6c23){if(_0x5d6c23){return _0x5d6c23['destroy']()['then'](function(){_0xa6dcae[_0x7649('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b6be,_0x50a272){return function(_0x26c01d){if(!_0x26c01d){_0x46b6be[_0x7649('0x19')](0x194);}return _0x26c01d;};}function handleError(_0x547f46,_0x12e0a2){_0x12e0a2=_0x12e0a2||0x1f4;return function(_0x1a939f){logger[_0x7649('0x25')](_0x1a939f[_0x7649('0x26')]);if(_0x1a939f['name']){delete _0x1a939f[_0x7649('0x27')];}_0x547f46[_0x7649('0x1a')](_0x12e0a2)[_0x7649('0x28')](_0x1a939f);};}exports[_0x7649('0x29')]=function(_0x552576,_0xe75033){var _0xe8fa92={},_0x4ecee3={},_0x569ece={'count':0x0,'rows':[]};var _0x5dce27=_[_0x7649('0x2a')](db['DeskAccount'][_0x7649('0x2b')],function(_0x109565){return{'name':_0x109565['fieldName'],'type':_0x109565[_0x7649('0x2c')][_0x7649('0x2d')]};});_0x4ecee3['model']=_[_0x7649('0x2a')](_0x5dce27,_0x7649('0x27'));_0x4ecee3['query']=_[_0x7649('0x2e')](_0x552576[_0x7649('0x2f')]);_0x4ecee3[_0x7649('0x30')]=_[_0x7649('0x31')](_0x4ecee3[_0x7649('0x32')],_0x4ecee3[_0x7649('0x2f')]);_0xe8fa92[_0x7649('0x33')]=_[_0x7649('0x31')](_0x4ecee3['model'],qs[_0x7649('0x34')](_0x552576[_0x7649('0x2f')][_0x7649('0x34')]));_0xe8fa92[_0x7649('0x33')]=_0xe8fa92[_0x7649('0x33')]['length']?_0xe8fa92['attributes']:_0x4ecee3[_0x7649('0x32')];if(!_0x552576[_0x7649('0x2f')][_0x7649('0x35')](_0x7649('0x36'))){_0xe8fa92['limit']=qs[_0x7649('0x1f')](_0x552576[_0x7649('0x2f')][_0x7649('0x1f')]);_0xe8fa92[_0x7649('0x1d')]=qs[_0x7649('0x1d')](_0x552576[_0x7649('0x2f')][_0x7649('0x1d')]);}_0xe8fa92[_0x7649('0x37')]=qs[_0x7649('0x38')](_0x552576[_0x7649('0x2f')][_0x7649('0x38')]);_0xe8fa92[_0x7649('0x39')]=qs[_0x7649('0x30')](_['pick'](_0x552576['query'],_0x4ecee3[_0x7649('0x30')]),_0x5dce27);if(_0x552576[_0x7649('0x2f')][_0x7649('0x3a')]){_0xe8fa92['where']=_[_0x7649('0x3b')](_0xe8fa92[_0x7649('0x39')],{'$or':_[_0x7649('0x2a')](_0x5dce27,function(_0x4e75b9){if(_0x4e75b9[_0x7649('0x2c')]!=='VIRTUAL'){var _0x1fae6e={};_0x1fae6e[_0x4e75b9[_0x7649('0x27')]]={'$like':'%'+_0x552576[_0x7649('0x2f')][_0x7649('0x3a')]+'%'};return _0x1fae6e;}})});}_0xe8fa92=_[_0x7649('0x3b')]({},_0xe8fa92,_0x552576[_0x7649('0x3c')]);var _0x2dac6a={'where':_0xe8fa92[_0x7649('0x39')]};return db[_0x7649('0x3d')][_0x7649('0x1e')](_0x2dac6a)[_0x7649('0x3e')](function(_0x365afb){_0x569ece[_0x7649('0x1e')]=_0x365afb;if(_0x552576[_0x7649('0x2f')][_0x7649('0x3f')]){_0xe8fa92['include']=[{'all':!![]}];}return db[_0x7649('0x3d')][_0x7649('0x40')](_0xe8fa92);})[_0x7649('0x3e')](function(_0x2387d3){_0x569ece[_0x7649('0x41')]=_0x2387d3;return _0x569ece;})[_0x7649('0x3e')](respondWithFilteredResult(_0xe75033,_0xe8fa92))[_0x7649('0x42')](handleError(_0xe75033,null));};exports['show']=function(_0x1266c5,_0x2b0b21){var _0x30ad54={'raw':![],'where':{'id':_0x1266c5['params']['id']}},_0x273a46={};_0x273a46[_0x7649('0x32')]=_[_0x7649('0x2e')](db['DeskAccount'][_0x7649('0x2b')]);_0x273a46[_0x7649('0x2f')]=_[_0x7649('0x2e')](_0x1266c5[_0x7649('0x2f')]);_0x273a46['filters']=_[_0x7649('0x31')](_0x273a46[_0x7649('0x32')],_0x273a46[_0x7649('0x2f')]);_0x30ad54[_0x7649('0x33')]=_[_0x7649('0x31')](_0x273a46[_0x7649('0x32')],qs[_0x7649('0x34')](_0x1266c5[_0x7649('0x2f')][_0x7649('0x34')]));_0x30ad54[_0x7649('0x33')]=_0x30ad54[_0x7649('0x33')][_0x7649('0x43')]?_0x30ad54[_0x7649('0x33')]:_0x273a46[_0x7649('0x32')];if(_0x1266c5[_0x7649('0x2f')][_0x7649('0x3f')]){_0x30ad54['include']=[{'all':!![]}];}_0x30ad54=_[_0x7649('0x3b')]({},_0x30ad54,_0x1266c5['options']);return db[_0x7649('0x3d')][_0x7649('0x44')](_0x30ad54)[_0x7649('0x3e')](handleEntityNotFound(_0x2b0b21,null))['then'](respondWithResult(_0x2b0b21,null))[_0x7649('0x42')](handleError(_0x2b0b21,null));};exports[_0x7649('0x45')]=function(_0x3b5f1b,_0x1fa18e){return db['DeskAccount']['create'](_0x3b5f1b[_0x7649('0x46')],{})['then'](respondWithResult(_0x1fa18e,0xc9))[_0x7649('0x42')](handleError(_0x1fa18e,null));};exports['update']=function(_0x4d97a2,_0x535a5d){if(_0x4d97a2['body']['id']){delete _0x4d97a2[_0x7649('0x46')]['id'];}return db[_0x7649('0x3d')]['find']({'where':{'id':_0x4d97a2['params']['id']}})['then'](handleEntityNotFound(_0x535a5d,null))[_0x7649('0x3e')](saveUpdates(_0x4d97a2[_0x7649('0x46')],null))['then'](respondWithResult(_0x535a5d,null))[_0x7649('0x42')](handleError(_0x535a5d,null));};exports['destroy']=function(_0x21170e,_0xf9b5a3){return db[_0x7649('0x3d')][_0x7649('0x44')]({'where':{'id':_0x21170e['params']['id']}})[_0x7649('0x3e')](handleEntityNotFound(_0xf9b5a3,null))[_0x7649('0x3e')](removeEntity(_0xf9b5a3,null))['catch'](handleError(_0xf9b5a3,null));};exports[_0x7649('0x47')]=function(_0x2c1e0a,_0x49fa05,_0x16e822){var _0x180186={};var _0x5c58f5={};var _0xb34b72;var _0xd80834;return db[_0x7649('0x3d')][_0x7649('0x48')]({'where':{'id':_0x2c1e0a[_0x7649('0x49')]['id']}})[_0x7649('0x3e')](handleEntityNotFound(_0x49fa05,null))[_0x7649('0x3e')](function(_0x254cc2){if(_0x254cc2){_0xb34b72=_0x254cc2;_0x5c58f5[_0x7649('0x32')]=_[_0x7649('0x2e')](db[_0x7649('0x4a')][_0x7649('0x2b')]);_0x5c58f5[_0x7649('0x2f')]=_[_0x7649('0x2e')](_0x2c1e0a[_0x7649('0x2f')]);_0x5c58f5[_0x7649('0x30')]=_[_0x7649('0x31')](_0x5c58f5['model'],_0x5c58f5[_0x7649('0x2f')]);_0x180186[_0x7649('0x33')]=_[_0x7649('0x31')](_0x5c58f5[_0x7649('0x32')],qs[_0x7649('0x34')](_0x2c1e0a[_0x7649('0x2f')][_0x7649('0x34')]));_0x180186['attributes']=_0x180186['attributes']['length']?_0x180186['attributes']:_0x5c58f5[_0x7649('0x32')];_0x180186[_0x7649('0x37')]=qs['sort'](_0x2c1e0a['query'][_0x7649('0x38')]);_0x180186['where']=qs['filters'](_['pick'](_0x2c1e0a[_0x7649('0x2f')],_0x5c58f5['filters']));if(_0x2c1e0a['query'][_0x7649('0x3a')]){_0x180186['where']=_[_0x7649('0x3b')](_0x180186['where'],{'$or':_['map'](_0x180186[_0x7649('0x33')],function(_0xe66eef){var _0xcb539a={};_0xcb539a[_0xe66eef]={'$like':'%'+_0x2c1e0a['query']['filter']+'%'};return _0xcb539a;})});}_0x180186=_[_0x7649('0x3b')]({},_0x180186,_0x2c1e0a[_0x7649('0x3c')]);return _0xb34b72[_0x7649('0x47')](_0x180186);}})[_0x7649('0x3e')](function(_0x42b9de){if(_0x42b9de){_0xd80834=_0x42b9de[_0x7649('0x43')];if(!_0x2c1e0a[_0x7649('0x2f')][_0x7649('0x35')](_0x7649('0x36'))){_0x180186[_0x7649('0x1f')]=qs[_0x7649('0x1f')](_0x2c1e0a[_0x7649('0x2f')][_0x7649('0x1f')]);_0x180186[_0x7649('0x1d')]=qs['offset'](_0x2c1e0a[_0x7649('0x2f')][_0x7649('0x1d')]);}return _0xb34b72[_0x7649('0x47')](_0x180186);}})[_0x7649('0x3e')](function(_0xbe5f7f){if(_0xbe5f7f){return _0xbe5f7f?{'count':_0xd80834,'rows':_0xbe5f7f}:null;}})[_0x7649('0x3e')](respondWithResult(_0x49fa05,null))[_0x7649('0x42')](handleError(_0x49fa05,null));};exports['addConfiguration']=function(_0x4d0621,_0x39a2e8,_0x50d38c){if(_0x4d0621[_0x7649('0x46')]['id']){delete _0x4d0621['body']['id'];}return db[_0x7649('0x3d')]['findOne']({'where':{'id':_0x4d0621[_0x7649('0x49')]['id']}})['then'](handleEntityNotFound(_0x39a2e8,null))[_0x7649('0x3e')](function(_0x1950e4){if(_0x1950e4){_0x4d0621[_0x7649('0x46')][_0x7649('0x4b')]=_0x1950e4['id'];_0x4d0621[_0x7649('0x46')][_0x7649('0x4c')]=integrations[_0x7649('0x4d')](_0x4d0621[_0x7649('0x46')]['channel'],_0x4d0621[_0x7649('0x46')][_0x7649('0x2c')]);_0x4d0621['body'][_0x7649('0x4e')]=integrations[_0x7649('0x4f')](_0x4d0621[_0x7649('0x46')][_0x7649('0x50')],_0x4d0621[_0x7649('0x46')][_0x7649('0x2c')]);return db[_0x7649('0x4a')][_0x7649('0x45')](_0x4d0621['body'],{'include':[{'model':db[_0x7649('0x51')],'as':_0x7649('0x4c')},{'model':db[_0x7649('0x51')],'as':_0x7649('0x4e')}]});}return null;})['then'](respondWithResult(_0x39a2e8,null))[_0x7649('0x42')](handleError(_0x39a2e8,null));};exports[_0x7649('0x52')]=function(_0x1b95ed,_0x135fe0,_0x5efd05){var _0x2d4410=[{'name':_0x7649('0x53'),'label':_0x7649('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x974e93='';return db['DeskAccount'][_0x7649('0x48')]({'where':{'id':_0x1b95ed[_0x7649('0x49')]['id']},'attributes':['id',_0x7649('0x54'),_0x7649('0x55'),_0x7649('0x56'),_0x7649('0x57'),_0x7649('0x58'),_0x7649('0x59'),_0x7649('0x5a'),_0x7649('0x5b')]})[_0x7649('0x3e')](handleEntityNotFound(_0x135fe0,null))['then'](function(_0x3c2111){if(_0x3c2111){_0x974e93=_0x3c2111[_0x7649('0x54')];var _0x48c4d0=_0x974e93[_0x7649('0x5c')](-0x1);if(_0x48c4d0==='/'){_0x974e93=_0x974e93[_0x7649('0x5d')](0x0,_0x974e93[_0x7649('0x5e')](_0x48c4d0));}var _0x563565={'method':'GET','uri':util[_0x7649('0x5f')]('%s/custom_fields',_0x974e93),'headers':{'Content-Type':_0x7649('0x60'),'Accept':_0x7649('0x60')},'json':!![]};if(_0x3c2111[_0x7649('0x55')]===_0x7649('0x61')){_0x563565['headers'][_0x7649('0x62')]=util[_0x7649('0x5f')](_0x7649('0x63'),new Buffer(util['format'](_0x7649('0x64'),_0x3c2111[_0x7649('0x56')],_0x3c2111['password']))[_0x7649('0x65')](_0x7649('0x66')));}return rp(_0x563565)[_0x7649('0x3e')](function(_0x125f5f){return _0x2d4410[_0x7649('0x67')](_[_0x7649('0x2a')](_0x125f5f[_0x7649('0x68')][_0x7649('0x69')],function(_0x5e2163){return{'id':_0x5e2163[_0x7649('0x27')],'name':_0x5e2163[_0x7649('0x27')],'type':_0x5e2163[_0x7649('0x2c')],'active':_0x5e2163[_0x7649('0x6a')],'label':_0x5e2163['label'],'custom':!![]};}));});}})[_0x7649('0x3e')](function(_0x4d5d7a){return{'count':_0x4d5d7a[_0x7649('0x43')],'rows':_0x4d5d7a};})[_0x7649('0x3e')](respondWithResult(_0x135fe0,null))[_0x7649('0x42')](function(_0x4f6b24){var _0x51d67a=_0x1b95ed[_0x7649('0x2f')][_0x7649('0x6b')]?0x1f4:_0x4f6b24[_0x7649('0x6c')]||0x1f4;logger[_0x7649('0x25')](_0x7649('0x6d'),_0x7649('0x52'),_0x51d67a,JSON['stringify'](_0x4f6b24));delete _0x4f6b24[_0x7649('0x27')];if(_0x51d67a===0x191){_0x51d67a=0x190;}_0x135fe0[_0x7649('0x1a')](_0x51d67a)[_0x7649('0x28')](_0x1b95ed[_0x7649('0x2f')][_0x7649('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x4f6b24[_0x7649('0x6c')]}:_0x4f6b24);});}; \ No newline at end of file +var _0xc1c9=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','model','name','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','DeskAccount','includeAll','rows','catch','show','params','include','find','create','body','update','getConfigurations','findOne','DeskConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','type','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xc1c9,0x136));var _0x9c1c=function(_0x4855fa,_0x490cf3){_0x4855fa=_0x4855fa-0x0;var _0x4b7a91=_0xc1c9[_0x4855fa];return _0x4b7a91;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c1c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c1c('0x1'));var moment=require(_0x9c1c('0x2'));var BPromise=require(_0x9c1c('0x3'));var Mustache=require('mustache');var util=require(_0x9c1c('0x4'));var path=require(_0x9c1c('0x5'));var sox=require('sox');var csv=require(_0x9c1c('0x6'));var ejs=require(_0x9c1c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c1c('0x8'));var squel=require(_0x9c1c('0x9'));var crypto=require(_0x9c1c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9c1c('0xb'));var toCsv=require(_0x9c1c('0x6'));var querystring=require(_0x9c1c('0xc'));var Papa=require(_0x9c1c('0xd'));var Redis=require(_0x9c1c('0xe'));var authService=require(_0x9c1c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9c1c('0x10'));var hardwareService=require(_0x9c1c('0x11'));var logger=require('../../config/logger')(_0x9c1c('0x12'));var utils=require(_0x9c1c('0x13'));var config=require(_0x9c1c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c1c('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x44b573,_0x93598){_0x93598=_0x93598||0xcc;return function(_0x2ef4b5){if(_0x2ef4b5){return _0x44b573[_0x9c1c('0x16')](_0x93598);}return _0x44b573[_0x9c1c('0x17')](_0x93598)['end']();};}function respondWithResult(_0x46e6a3,_0x2135b4){_0x2135b4=_0x2135b4||0xc8;return function(_0x48461e){if(_0x48461e){return _0x46e6a3[_0x9c1c('0x17')](_0x2135b4)[_0x9c1c('0x18')](_0x48461e);}};}function respondWithFilteredResult(_0x3578f8,_0x3643e6){return function(_0x3ce6da){if(_0x3ce6da){var _0x29e9b0=typeof _0x3643e6['offset']===_0x9c1c('0x19')&&typeof _0x3643e6[_0x9c1c('0x1a')]===_0x9c1c('0x19');var _0x5c9952=_0x3ce6da[_0x9c1c('0x1b')];var _0x43afe0=_0x29e9b0?0x0:_0x3643e6[_0x9c1c('0x1c')];var _0x3a8e7c=_0x29e9b0?_0x3ce6da[_0x9c1c('0x1b')]:_0x3643e6[_0x9c1c('0x1c')]+_0x3643e6[_0x9c1c('0x1a')];var _0x43097b;if(_0x3a8e7c>=_0x5c9952){_0x3a8e7c=_0x5c9952;_0x43097b=0xc8;}else{_0x43097b=0xce;}_0x3578f8[_0x9c1c('0x17')](_0x43097b);return _0x3578f8['set'](_0x9c1c('0x1d'),_0x43afe0+'-'+_0x3a8e7c+'/'+_0x5c9952)[_0x9c1c('0x18')](_0x3ce6da);}return null;};}function patchUpdates(_0x168207){return function(_0x410843){try{jsonpatch[_0x9c1c('0x1e')](_0x410843,_0x168207,!![]);}catch(_0x58e5da){return BPromise[_0x9c1c('0x1f')](_0x58e5da);}return _0x410843[_0x9c1c('0x20')]();};}function saveUpdates(_0x104d02,_0x3ee146){return function(_0x6af988){if(_0x6af988){return _0x6af988['update'](_0x104d02)[_0x9c1c('0x21')](function(_0x45579c){return _0x45579c;});}return null;};}function removeEntity(_0x2a10cb,_0x366384){return function(_0x53cdd1){if(_0x53cdd1){return _0x53cdd1[_0x9c1c('0x22')]()['then'](function(){_0x2a10cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4b6e,_0x14a21c){return function(_0x4021ad){if(!_0x4021ad){_0x4e4b6e['sendStatus'](0x194);}return _0x4021ad;};}function handleError(_0x42f5e8,_0x2ba4ac){_0x2ba4ac=_0x2ba4ac||0x1f4;return function(_0xc637ad){logger[_0x9c1c('0x23')](_0xc637ad[_0x9c1c('0x24')]);if(_0xc637ad['name']){delete _0xc637ad['name'];}_0x42f5e8['status'](_0x2ba4ac)[_0x9c1c('0x25')](_0xc637ad);};}exports[_0x9c1c('0x26')]=function(_0x27b47a,_0x2bbb80){var _0xcbd47a={},_0x3f2bdb={},_0x947458={'count':0x0,'rows':[]};var _0x129e33=_[_0x9c1c('0x27')](db['DeskAccount'][_0x9c1c('0x28')],function(_0x2e203e){return{'name':_0x2e203e[_0x9c1c('0x29')],'type':_0x2e203e['type']['key']};});_0x3f2bdb[_0x9c1c('0x2a')]=_[_0x9c1c('0x27')](_0x129e33,_0x9c1c('0x2b'));_0x3f2bdb[_0x9c1c('0x2c')]=_[_0x9c1c('0x2d')](_0x27b47a[_0x9c1c('0x2c')]);_0x3f2bdb['filters']=_[_0x9c1c('0x2e')](_0x3f2bdb[_0x9c1c('0x2a')],_0x3f2bdb[_0x9c1c('0x2c')]);_0xcbd47a['attributes']=_[_0x9c1c('0x2e')](_0x3f2bdb[_0x9c1c('0x2a')],qs[_0x9c1c('0x2f')](_0x27b47a[_0x9c1c('0x2c')][_0x9c1c('0x2f')]));_0xcbd47a[_0x9c1c('0x30')]=_0xcbd47a[_0x9c1c('0x30')][_0x9c1c('0x31')]?_0xcbd47a[_0x9c1c('0x30')]:_0x3f2bdb[_0x9c1c('0x2a')];if(!_0x27b47a[_0x9c1c('0x2c')]['hasOwnProperty'](_0x9c1c('0x32'))){_0xcbd47a[_0x9c1c('0x1a')]=qs[_0x9c1c('0x1a')](_0x27b47a[_0x9c1c('0x2c')][_0x9c1c('0x1a')]);_0xcbd47a[_0x9c1c('0x1c')]=qs[_0x9c1c('0x1c')](_0x27b47a['query'][_0x9c1c('0x1c')]);}_0xcbd47a[_0x9c1c('0x33')]=qs[_0x9c1c('0x34')](_0x27b47a[_0x9c1c('0x2c')][_0x9c1c('0x34')]);_0xcbd47a[_0x9c1c('0x35')]=qs[_0x9c1c('0x36')](_['pick'](_0x27b47a[_0x9c1c('0x2c')],_0x3f2bdb[_0x9c1c('0x36')]),_0x129e33);if(_0x27b47a[_0x9c1c('0x2c')][_0x9c1c('0x37')]){_0xcbd47a[_0x9c1c('0x35')]=_[_0x9c1c('0x38')](_0xcbd47a['where'],{'$or':_[_0x9c1c('0x27')](_0x129e33,function(_0x40ce06){if(_0x40ce06['type']!=='VIRTUAL'){var _0x4d3cfe={};_0x4d3cfe[_0x40ce06['name']]={'$like':'%'+_0x27b47a[_0x9c1c('0x2c')]['filter']+'%'};return _0x4d3cfe;}})});}_0xcbd47a=_[_0x9c1c('0x38')]({},_0xcbd47a,_0x27b47a[_0x9c1c('0x39')]);var _0x449168={'where':_0xcbd47a['where']};return db[_0x9c1c('0x3a')][_0x9c1c('0x1b')](_0x449168)[_0x9c1c('0x21')](function(_0x53b00f){_0x947458[_0x9c1c('0x1b')]=_0x53b00f;if(_0x27b47a[_0x9c1c('0x2c')][_0x9c1c('0x3b')]){_0xcbd47a['include']=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0xcbd47a);})[_0x9c1c('0x21')](function(_0x49b08f){_0x947458[_0x9c1c('0x3c')]=_0x49b08f;return _0x947458;})[_0x9c1c('0x21')](respondWithFilteredResult(_0x2bbb80,_0xcbd47a))[_0x9c1c('0x3d')](handleError(_0x2bbb80,null));};exports[_0x9c1c('0x3e')]=function(_0x2cd5df,_0x40c3b6){var _0x25d0d9={'raw':![],'where':{'id':_0x2cd5df[_0x9c1c('0x3f')]['id']}},_0x58e88c={};_0x58e88c['model']=_[_0x9c1c('0x2d')](db[_0x9c1c('0x3a')][_0x9c1c('0x28')]);_0x58e88c[_0x9c1c('0x2c')]=_[_0x9c1c('0x2d')](_0x2cd5df[_0x9c1c('0x2c')]);_0x58e88c[_0x9c1c('0x36')]=_['intersection'](_0x58e88c['model'],_0x58e88c['query']);_0x25d0d9['attributes']=_[_0x9c1c('0x2e')](_0x58e88c['model'],qs[_0x9c1c('0x2f')](_0x2cd5df['query'][_0x9c1c('0x2f')]));_0x25d0d9['attributes']=_0x25d0d9[_0x9c1c('0x30')][_0x9c1c('0x31')]?_0x25d0d9[_0x9c1c('0x30')]:_0x58e88c[_0x9c1c('0x2a')];if(_0x2cd5df[_0x9c1c('0x2c')]['includeAll']){_0x25d0d9[_0x9c1c('0x40')]=[{'all':!![]}];}_0x25d0d9=_[_0x9c1c('0x38')]({},_0x25d0d9,_0x2cd5df['options']);return db[_0x9c1c('0x3a')][_0x9c1c('0x41')](_0x25d0d9)['then'](handleEntityNotFound(_0x40c3b6,null))[_0x9c1c('0x21')](respondWithResult(_0x40c3b6,null))[_0x9c1c('0x3d')](handleError(_0x40c3b6,null));};exports[_0x9c1c('0x42')]=function(_0x2769ed,_0x5a7635){return db[_0x9c1c('0x3a')][_0x9c1c('0x42')](_0x2769ed[_0x9c1c('0x43')],{})[_0x9c1c('0x21')](respondWithResult(_0x5a7635,0xc9))[_0x9c1c('0x3d')](handleError(_0x5a7635,null));};exports[_0x9c1c('0x44')]=function(_0x1b8adf,_0x1d5f99){if(_0x1b8adf[_0x9c1c('0x43')]['id']){delete _0x1b8adf[_0x9c1c('0x43')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x1b8adf[_0x9c1c('0x3f')]['id']}})[_0x9c1c('0x21')](handleEntityNotFound(_0x1d5f99,null))[_0x9c1c('0x21')](saveUpdates(_0x1b8adf[_0x9c1c('0x43')],null))['then'](respondWithResult(_0x1d5f99,null))['catch'](handleError(_0x1d5f99,null));};exports['destroy']=function(_0x13c247,_0x24ee6f){return db[_0x9c1c('0x3a')][_0x9c1c('0x41')]({'where':{'id':_0x13c247[_0x9c1c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x24ee6f,null))[_0x9c1c('0x21')](removeEntity(_0x24ee6f,null))[_0x9c1c('0x3d')](handleError(_0x24ee6f,null));};exports[_0x9c1c('0x45')]=function(_0x85fa1e,_0x14969e,_0x22056d){var _0x497201={};var _0x320e7e={};var _0xd59ca3;var _0x15cda1;return db['DeskAccount'][_0x9c1c('0x46')]({'where':{'id':_0x85fa1e[_0x9c1c('0x3f')]['id']}})[_0x9c1c('0x21')](handleEntityNotFound(_0x14969e,null))[_0x9c1c('0x21')](function(_0x342f46){if(_0x342f46){_0xd59ca3=_0x342f46;_0x320e7e[_0x9c1c('0x2a')]=_[_0x9c1c('0x2d')](db[_0x9c1c('0x47')][_0x9c1c('0x28')]);_0x320e7e[_0x9c1c('0x2c')]=_[_0x9c1c('0x2d')](_0x85fa1e[_0x9c1c('0x2c')]);_0x320e7e[_0x9c1c('0x36')]=_[_0x9c1c('0x2e')](_0x320e7e['model'],_0x320e7e[_0x9c1c('0x2c')]);_0x497201['attributes']=_[_0x9c1c('0x2e')](_0x320e7e[_0x9c1c('0x2a')],qs['fields'](_0x85fa1e[_0x9c1c('0x2c')][_0x9c1c('0x2f')]));_0x497201[_0x9c1c('0x30')]=_0x497201['attributes'][_0x9c1c('0x31')]?_0x497201[_0x9c1c('0x30')]:_0x320e7e[_0x9c1c('0x2a')];_0x497201['order']=qs[_0x9c1c('0x34')](_0x85fa1e['query'][_0x9c1c('0x34')]);_0x497201[_0x9c1c('0x35')]=qs[_0x9c1c('0x36')](_[_0x9c1c('0x48')](_0x85fa1e['query'],_0x320e7e['filters']));if(_0x85fa1e[_0x9c1c('0x2c')]['filter']){_0x497201[_0x9c1c('0x35')]=_[_0x9c1c('0x38')](_0x497201[_0x9c1c('0x35')],{'$or':_[_0x9c1c('0x27')](_0x497201[_0x9c1c('0x30')],function(_0x5d6846){var _0x48d4e0={};_0x48d4e0[_0x5d6846]={'$like':'%'+_0x85fa1e[_0x9c1c('0x2c')][_0x9c1c('0x37')]+'%'};return _0x48d4e0;})});}_0x497201=_[_0x9c1c('0x38')]({},_0x497201,_0x85fa1e[_0x9c1c('0x39')]);return _0xd59ca3[_0x9c1c('0x45')](_0x497201);}})['then'](function(_0x35c220){if(_0x35c220){_0x15cda1=_0x35c220[_0x9c1c('0x31')];if(!_0x85fa1e['query'][_0x9c1c('0x49')](_0x9c1c('0x32'))){_0x497201['limit']=qs[_0x9c1c('0x1a')](_0x85fa1e[_0x9c1c('0x2c')][_0x9c1c('0x1a')]);_0x497201['offset']=qs[_0x9c1c('0x1c')](_0x85fa1e[_0x9c1c('0x2c')]['offset']);}return _0xd59ca3[_0x9c1c('0x45')](_0x497201);}})['then'](function(_0x490cb6){if(_0x490cb6){return _0x490cb6?{'count':_0x15cda1,'rows':_0x490cb6}:null;}})[_0x9c1c('0x21')](respondWithResult(_0x14969e,null))['catch'](handleError(_0x14969e,null));};exports[_0x9c1c('0x4a')]=function(_0x2d6ad1,_0x19729a,_0x492e41){if(_0x2d6ad1[_0x9c1c('0x43')]['id']){delete _0x2d6ad1[_0x9c1c('0x43')]['id'];}return db[_0x9c1c('0x3a')][_0x9c1c('0x46')]({'where':{'id':_0x2d6ad1[_0x9c1c('0x3f')]['id']}})[_0x9c1c('0x21')](handleEntityNotFound(_0x19729a,null))[_0x9c1c('0x21')](function(_0x533c5b){if(_0x533c5b){_0x2d6ad1[_0x9c1c('0x43')]['AccountId']=_0x533c5b['id'];_0x2d6ad1['body'][_0x9c1c('0x4b')]=integrations[_0x9c1c('0x4c')](_0x2d6ad1[_0x9c1c('0x43')][_0x9c1c('0x4d')],_0x2d6ad1[_0x9c1c('0x43')]['type']);_0x2d6ad1[_0x9c1c('0x43')][_0x9c1c('0x4e')]=integrations[_0x9c1c('0x4f')](_0x2d6ad1[_0x9c1c('0x43')]['channel'],_0x2d6ad1[_0x9c1c('0x43')]['type']);return db[_0x9c1c('0x47')][_0x9c1c('0x42')](_0x2d6ad1[_0x9c1c('0x43')],{'include':[{'model':db['DeskField'],'as':_0x9c1c('0x4b')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x19729a,null))[_0x9c1c('0x3d')](handleError(_0x19729a,null));};exports['getFields']=function(_0x5210f6,_0x5b48f6,_0x2ed426){var _0x4cef4e=[{'name':_0x9c1c('0x50'),'label':_0x9c1c('0x50'),'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 _0x4a2d81='';return db['DeskAccount']['findOne']({'where':{'id':_0x5210f6[_0x9c1c('0x3f')]['id']},'attributes':['id',_0x9c1c('0x51'),_0x9c1c('0x52'),_0x9c1c('0x53'),_0x9c1c('0x54'),_0x9c1c('0x55'),_0x9c1c('0x56'),'token','tokenSecret']})[_0x9c1c('0x21')](handleEntityNotFound(_0x5b48f6,null))['then'](function(_0x5127e0){if(_0x5127e0){_0x4a2d81=_0x5127e0['remoteUri'];var _0xfe18ec=_0x4a2d81[_0x9c1c('0x57')](-0x1);if(_0xfe18ec==='/'){_0x4a2d81=_0x4a2d81[_0x9c1c('0x58')](0x0,_0x4a2d81[_0x9c1c('0x59')](_0xfe18ec));}var _0x17d038={'method':_0x9c1c('0x5a'),'uri':util[_0x9c1c('0x5b')]('%s/custom_fields',_0x4a2d81),'headers':{'Content-Type':_0x9c1c('0x5c'),'Accept':_0x9c1c('0x5c')},'json':!![]};if(_0x5127e0[_0x9c1c('0x52')]===_0x9c1c('0x5d')){_0x17d038['headers']['Authorization']=util['format'](_0x9c1c('0x5e'),new Buffer(util[_0x9c1c('0x5b')](_0x9c1c('0x5f'),_0x5127e0[_0x9c1c('0x53')],_0x5127e0[_0x9c1c('0x54')]))['toString'](_0x9c1c('0x60')));}return rp(_0x17d038)['then'](function(_0xcd59a5){return _0x4cef4e[_0x9c1c('0x61')](_[_0x9c1c('0x27')](_0xcd59a5[_0x9c1c('0x62')][_0x9c1c('0x63')],function(_0x5ec03c){return{'id':_0x5ec03c[_0x9c1c('0x2b')],'name':_0x5ec03c['name'],'type':_0x5ec03c[_0x9c1c('0x64')],'active':_0x5ec03c[_0x9c1c('0x65')],'label':_0x5ec03c['label'],'custom':!![]};}));});}})[_0x9c1c('0x21')](function(_0x4f6726){return{'count':_0x4f6726[_0x9c1c('0x31')],'rows':_0x4f6726};})[_0x9c1c('0x21')](respondWithResult(_0x5b48f6,null))[_0x9c1c('0x3d')](function(_0x5590b2){var _0x28d902=_0x5210f6[_0x9c1c('0x2c')][_0x9c1c('0x66')]?0x1f4:_0x5590b2[_0x9c1c('0x67')]||0x1f4;logger['error'](_0x9c1c('0x68'),_0x9c1c('0x69'),_0x28d902,JSON['stringify'](_0x5590b2));delete _0x5590b2['name'];if(_0x28d902===0x191){_0x28d902=0x190;}_0x5b48f6[_0x9c1c('0x17')](_0x28d902)[_0x9c1c('0x25')](_0x5210f6[_0x9c1c('0x2c')][_0x9c1c('0x66')]?{'message':_0x9c1c('0x6a'),'statusCode':_0x5590b2[_0x9c1c('0x67')]}:_0x5590b2);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e27431d..2708656 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 _0xef3f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','lodash','util'];(function(_0x3b4b9d,_0x5bc79d){var _0x2f2804=function(_0x2e10fb){while(--_0x2e10fb){_0x3b4b9d['push'](_0x3b4b9d['shift']());}};_0x2f2804(++_0x5bc79d);}(_0xef3f,0x11c));var _0xfef3=function(_0x17cfca,_0x3b2bc2){_0x17cfca=_0x17cfca-0x0;var _0x206070=_0xef3f[_0x17cfca];return _0x206070;};'use strict';var _=require(_0xfef3('0x0'));var util=require(_0xfef3('0x1'));var logger=require(_0xfef3('0x2'))(_0xfef3('0x3'));var moment=require(_0xfef3('0x4'));var BPromise=require(_0xfef3('0x5'));var rp=require(_0xfef3('0x6'));var fs=require('fs');var path=require(_0xfef3('0x7'));var rimraf=require(_0xfef3('0x8'));var config=require('../../config/environment');var attributes=require(_0xfef3('0x9'));var integrations=require(_0xfef3('0xa'));module['exports']=function(_0x4b940b,_0x12772d){return _0x4b940b[_0xfef3('0xb')](_0xfef3('0xc'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc2e=['lodash','util','../../config/logger','api','moment','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0xcc2e,0x168));var _0xecc2=function(_0x213d86,_0x23a150){_0x213d86=_0x213d86-0x0;var _0xf5b317=_0xcc2e[_0x213d86];return _0xf5b317;};'use strict';var _=require(_0xecc2('0x0'));var util=require(_0xecc2('0x1'));var logger=require(_0xecc2('0x2'))(_0xecc2('0x3'));var moment=require(_0xecc2('0x4'));var BPromise=require('bluebird');var rp=require(_0xecc2('0x5'));var fs=require('fs');var path=require(_0xecc2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xecc2('0x7'));var integrations=require(_0xecc2('0x8'));module[_0xecc2('0x9')]=function(_0x4d0b58,_0x23b4c3){return _0x4d0b58[_0xecc2('0xa')](_0xecc2('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b5ae400..8577dae 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 _0x0f63=['DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','DeskAccount','findAll','options','raw','attributes','limit','map','include','model','GetDeskAccount','stringify','catch','where','ShowDeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x4fb5e7,_0x5061fb){var _0x6e6328=function(_0x451480){while(--_0x451480){_0x4fb5e7['push'](_0x4fb5e7['shift']());}};_0x6e6328(++_0x5061fb);}(_0x0f63,0x180));var _0x30f6=function(_0x12ae43,_0x1fe764){_0x12ae43=_0x12ae43-0x0;var _0x4fbfc5=_0x0f63[_0x12ae43];return _0x4fbfc5;};'use strict';var _=require(_0x30f6('0x0'));var util=require(_0x30f6('0x1'));var moment=require(_0x30f6('0x2'));var BPromise=require(_0x30f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30f6('0x4'));var db=require(_0x30f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x30f6('0x6'))('rpc');var config=require(_0x30f6('0x7'));var jayson=require(_0x30f6('0x8'));var client=jayson['client'][_0x30f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc87083,_0x4cd86e,_0x6848b4){return new BPromise(function(_0x1c7b76,_0x3f32be){return client['request'](_0xc87083,_0x6848b4)[_0x30f6('0xa')](function(_0x28b005){logger[_0x30f6('0xb')](_0x30f6('0xc'),_0x4cd86e,_0x30f6('0xd'));logger[_0x30f6('0xe')](_0x30f6('0xf'),_0x4cd86e,_0x30f6('0xd'),JSON['stringify'](_0x28b005));if(_0x28b005[_0x30f6('0x10')]){if(_0x28b005[_0x30f6('0x10')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4cd86e,_0x28b005['error']['message']);return _0x3f32be(_0x28b005[_0x30f6('0x10')][_0x30f6('0x11')]);}logger[_0x30f6('0x10')]('DeskAccount,\x20%s,\x20%s',_0x4cd86e,_0x28b005['error'][_0x30f6('0x11')]);return _0x1c7b76(_0x28b005[_0x30f6('0x10')][_0x30f6('0x11')]);}else{logger[_0x30f6('0xb')]('DeskAccount,\x20%s,\x20%s',_0x4cd86e,_0x30f6('0xd'));_0x1c7b76(_0x28b005[_0x30f6('0x12')]['message']);}})['catch'](function(_0x458b61){logger[_0x30f6('0x10')](_0x30f6('0xc'),_0x4cd86e,_0x458b61);_0x3f32be(_0x458b61);});});}exports['GetDeskAccount']=function(_0x643a25){var _0x49ae98=this;return new Promise(function(_0x146528,_0xb8a881){return db[_0x30f6('0x13')][_0x30f6('0x14')]({'raw':_0x643a25[_0x30f6('0x15')]?_0x643a25['options'][_0x30f6('0x16')]===undefined?!![]:![]:!![],'where':_0x643a25[_0x30f6('0x15')]?_0x643a25['options']['where']||null:null,'attributes':_0x643a25['options']?_0x643a25[_0x30f6('0x15')][_0x30f6('0x17')]||null:null,'limit':_0x643a25[_0x30f6('0x15')]?_0x643a25['options'][_0x30f6('0x18')]||null:null,'include':_0x643a25[_0x30f6('0x15')]?_0x643a25[_0x30f6('0x15')]['include']?_[_0x30f6('0x19')](_0x643a25[_0x30f6('0x15')][_0x30f6('0x1a')],function(_0x585e6c){return{'model':db[_0x585e6c[_0x30f6('0x1b')]],'as':_0x585e6c['as'],'attributes':_0x585e6c[_0x30f6('0x17')],'include':_0x585e6c[_0x30f6('0x1a')]?_['map'](_0x585e6c[_0x30f6('0x1a')],function(_0x3bad2c){return{'model':db[_0x3bad2c[_0x30f6('0x1b')]],'as':_0x3bad2c['as'],'attributes':_0x3bad2c[_0x30f6('0x17')],'include':_0x3bad2c[_0x30f6('0x1a')]?_[_0x30f6('0x19')](_0x3bad2c[_0x30f6('0x1a')],function(_0x2e0382){return{'model':db[_0x2e0382[_0x30f6('0x1b')]],'as':_0x2e0382['as'],'attributes':_0x2e0382[_0x30f6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x30f6('0xa')](function(_0x31c6fc){logger[_0x30f6('0xb')](_0x30f6('0x1c'),_0x643a25);logger['debug'](_0x30f6('0x1c'),_0x643a25,JSON[_0x30f6('0x1d')](_0x31c6fc));_0x146528(_0x31c6fc);})[_0x30f6('0x1e')](function(_0x24db8c){logger[_0x30f6('0x10')](_0x30f6('0x1c'),_0x24db8c['message'],_0x643a25);_0xb8a881(_0x49ae98[_0x30f6('0x10')](0x1f4,_0x24db8c[_0x30f6('0x11')]));});});};exports['ShowDeskAccount']=function(_0x2ec165){var _0x4513c4=this;return new Promise(function(_0x353703,_0x5e1afa){return db[_0x30f6('0x13')]['find']({'raw':_0x2ec165['options']?_0x2ec165[_0x30f6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2ec165[_0x30f6('0x15')]?_0x2ec165[_0x30f6('0x15')][_0x30f6('0x1f')]||null:null,'attributes':_0x2ec165[_0x30f6('0x15')]?_0x2ec165[_0x30f6('0x15')]['attributes']||null:null,'include':_0x2ec165[_0x30f6('0x15')]?_0x2ec165[_0x30f6('0x15')][_0x30f6('0x1a')]?_[_0x30f6('0x19')](_0x2ec165[_0x30f6('0x15')][_0x30f6('0x1a')],function(_0x2f1436){return{'model':db[_0x2f1436[_0x30f6('0x1b')]],'as':_0x2f1436['as'],'attributes':_0x2f1436['attributes'],'include':_0x2f1436[_0x30f6('0x1a')]?_[_0x30f6('0x19')](_0x2f1436['include'],function(_0x40c617){return{'model':db[_0x40c617['model']],'as':_0x40c617['as'],'attributes':_0x40c617[_0x30f6('0x17')],'include':_0x40c617['include']?_[_0x30f6('0x19')](_0x40c617['include'],function(_0x342a38){return{'model':db[_0x342a38['model']],'as':_0x342a38['as'],'attributes':_0x342a38[_0x30f6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x30f6('0xa')](function(_0x3ec251){logger[_0x30f6('0xb')](_0x30f6('0x20'),_0x2ec165);logger['debug'](_0x30f6('0x20'),_0x2ec165,JSON[_0x30f6('0x1d')](_0x3ec251));_0x353703(_0x3ec251);})['catch'](function(_0xb8d8e8){logger[_0x30f6('0x10')](_0x30f6('0x20'),_0xb8d8e8[_0x30f6('0x11')],_0x2ec165);_0x5e1afa(_0x4513c4[_0x30f6('0x10')](0x1f4,_0xb8d8e8[_0x30f6('0x11')]));});});}; \ No newline at end of file +var _0xc32f=['ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x17ff44,_0x2dc387){var _0x1bc529=function(_0x1e92c9){while(--_0x1e92c9){_0x17ff44['push'](_0x17ff44['shift']());}};_0x1bc529(++_0x2dc387);}(_0xc32f,0x18d));var _0xfc32=function(_0x22c45f,_0x44247d){_0x22c45f=_0x22c45f-0x0;var _0x136da0=_0xc32f[_0x22c45f];return _0x136da0;};'use strict';var _=require('lodash');var util=require(_0xfc32('0x0'));var moment=require(_0xfc32('0x1'));var BPromise=require(_0xfc32('0x2'));var rs=require(_0xfc32('0x3'));var fs=require('fs');var Redis=require(_0xfc32('0x4'));var db=require(_0xfc32('0x5'))['db'];var utils=require(_0xfc32('0x6'));var logger=require(_0xfc32('0x7'))('rpc');var config=require(_0xfc32('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfc32('0x9')][_0xfc32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x336e8f,_0x515ed1,_0x20db91){return new BPromise(function(_0x40313b,_0x632d71){return client['request'](_0x336e8f,_0x20db91)[_0xfc32('0xb')](function(_0x84a178){logger[_0xfc32('0xc')](_0xfc32('0xd'),_0x515ed1,_0xfc32('0xe'));logger[_0xfc32('0xf')](_0xfc32('0x10'),_0x515ed1,_0xfc32('0xe'),JSON[_0xfc32('0x11')](_0x84a178));if(_0x84a178[_0xfc32('0x12')]){if(_0x84a178[_0xfc32('0x12')]['code']===0x1f4){logger[_0xfc32('0x12')](_0xfc32('0xd'),_0x515ed1,_0x84a178['error'][_0xfc32('0x13')]);return _0x632d71(_0x84a178[_0xfc32('0x12')]['message']);}logger[_0xfc32('0x12')](_0xfc32('0xd'),_0x515ed1,_0x84a178[_0xfc32('0x12')][_0xfc32('0x13')]);return _0x40313b(_0x84a178['error'][_0xfc32('0x13')]);}else{logger[_0xfc32('0xc')](_0xfc32('0xd'),_0x515ed1,_0xfc32('0xe'));_0x40313b(_0x84a178['result']['message']);}})[_0xfc32('0x14')](function(_0x4cd65b){logger[_0xfc32('0x12')](_0xfc32('0xd'),_0x515ed1,_0x4cd65b);_0x632d71(_0x4cd65b);});});}exports[_0xfc32('0x15')]=function(_0x589224){var _0x18d943=this;return new Promise(function(_0x3d63c0,_0x1a6838){return db[_0xfc32('0x16')][_0xfc32('0x17')]({'raw':_0x589224['options']?_0x589224[_0xfc32('0x18')][_0xfc32('0x19')]===undefined?!![]:![]:!![],'where':_0x589224['options']?_0x589224[_0xfc32('0x18')][_0xfc32('0x1a')]||null:null,'attributes':_0x589224[_0xfc32('0x18')]?_0x589224[_0xfc32('0x18')][_0xfc32('0x1b')]||null:null,'limit':_0x589224[_0xfc32('0x18')]?_0x589224[_0xfc32('0x18')][_0xfc32('0x1c')]||null:null,'include':_0x589224[_0xfc32('0x18')]?_0x589224['options']['include']?_[_0xfc32('0x1d')](_0x589224[_0xfc32('0x18')][_0xfc32('0x1e')],function(_0x43ec2e){return{'model':db[_0x43ec2e[_0xfc32('0x1f')]],'as':_0x43ec2e['as'],'attributes':_0x43ec2e[_0xfc32('0x1b')],'include':_0x43ec2e[_0xfc32('0x1e')]?_[_0xfc32('0x1d')](_0x43ec2e[_0xfc32('0x1e')],function(_0x4bb237){return{'model':db[_0x4bb237['model']],'as':_0x4bb237['as'],'attributes':_0x4bb237[_0xfc32('0x1b')],'include':_0x4bb237[_0xfc32('0x1e')]?_[_0xfc32('0x1d')](_0x4bb237[_0xfc32('0x1e')],function(_0x418441){return{'model':db[_0x418441['model']],'as':_0x418441['as'],'attributes':_0x418441[_0xfc32('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfc32('0xb')](function(_0x1af27a){logger[_0xfc32('0xc')](_0xfc32('0x15'),_0x589224);logger[_0xfc32('0xf')](_0xfc32('0x15'),_0x589224,JSON['stringify'](_0x1af27a));_0x3d63c0(_0x1af27a);})['catch'](function(_0x4ca050){logger[_0xfc32('0x12')](_0xfc32('0x15'),_0x4ca050[_0xfc32('0x13')],_0x589224);_0x1a6838(_0x18d943[_0xfc32('0x12')](0x1f4,_0x4ca050[_0xfc32('0x13')]));});});};exports['ShowDeskAccount']=function(_0x20afd6){var _0x3ed3f7=this;return new Promise(function(_0x13ca3f,_0x16012a){return db[_0xfc32('0x16')]['find']({'raw':_0x20afd6[_0xfc32('0x18')]?_0x20afd6[_0xfc32('0x18')][_0xfc32('0x19')]===undefined?!![]:![]:!![],'where':_0x20afd6['options']?_0x20afd6[_0xfc32('0x18')][_0xfc32('0x1a')]||null:null,'attributes':_0x20afd6['options']?_0x20afd6[_0xfc32('0x18')]['attributes']||null:null,'include':_0x20afd6['options']?_0x20afd6[_0xfc32('0x18')][_0xfc32('0x1e')]?_[_0xfc32('0x1d')](_0x20afd6[_0xfc32('0x18')][_0xfc32('0x1e')],function(_0x506f5a){return{'model':db[_0x506f5a['model']],'as':_0x506f5a['as'],'attributes':_0x506f5a[_0xfc32('0x1b')],'include':_0x506f5a[_0xfc32('0x1e')]?_[_0xfc32('0x1d')](_0x506f5a[_0xfc32('0x1e')],function(_0x4a1acd){return{'model':db[_0x4a1acd[_0xfc32('0x1f')]],'as':_0x4a1acd['as'],'attributes':_0x4a1acd[_0xfc32('0x1b')],'include':_0x4a1acd[_0xfc32('0x1e')]?_[_0xfc32('0x1d')](_0x4a1acd[_0xfc32('0x1e')],function(_0x39f73e){return{'model':db[_0x39f73e[_0xfc32('0x1f')]],'as':_0x39f73e['as'],'attributes':_0x39f73e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc32('0xb')](function(_0x2d8aa8){logger[_0xfc32('0xc')]('ShowDeskAccount',_0x20afd6);logger[_0xfc32('0xf')](_0xfc32('0x20'),_0x20afd6,JSON['stringify'](_0x2d8aa8));_0x13ca3f(_0x2d8aa8);})[_0xfc32('0x14')](function(_0x1048a2){logger[_0xfc32('0x12')](_0xfc32('0x20'),_0x1048a2['message'],_0x20afd6);_0x16012a(_0x3ed3f7[_0xfc32('0x12')](0x1f4,_0x1048a2[_0xfc32('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f346aa6..95370ec 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x396e83,_0x2d51e2){var _0x4a42cc=function(_0x415496){while(--_0x415496){_0x396e83['push'](_0x396e83['shift']());}};_0x4a42cc(++_0x2d51e2);}(_0x55ca,0x126));var _0xa55c=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x55ca[_0x154192];return _0x3c2792;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x456f10,_0x4347c0){var _0x42a099=function(_0x24b84f){while(--_0x24b84f){_0x456f10['push'](_0x456f10['shift']());}};_0x42a099(++_0x4347c0);}(_0x008c,0x188));var _0xc008=function(_0x23a766,_0x2eab2c){_0x23a766=_0x23a766-0x0;var _0x439cd4=_0x008c[_0x23a766];return _0x439cd4;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ee0a7a2..d31385f 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 _0xbdee=['sequelize','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbdee,0x140));var _0xebde=function(_0x99f21d,_0x2a3065){_0x99f21d=_0x99f21d-0x0;var _0x4edce8=_0xbdee[_0x99f21d];return _0x4edce8;};'use strict';var Sequelize=require(_0xebde('0x0'));module['exports']={'name':{'type':Sequelize[_0xebde('0x1')]},'description':{'type':Sequelize[_0xebde('0x1')]}}; \ No newline at end of file +var _0x9c78=['STRING','sequelize'];(function(_0x260d03,_0x1fd42c){var _0x12ea8e=function(_0x1ca216){while(--_0x1ca216){_0x260d03['push'](_0x260d03['shift']());}};_0x12ea8e(++_0x1fd42c);}(_0x9c78,0x1ef));var _0x89c7=function(_0x20a46f,_0x45758e){_0x20a46f=_0x20a46f-0x0;var _0x2c6625=_0x9c78[_0x20a46f];return _0x2c6625;};'use strict';var Sequelize=require(_0x89c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x89c7('0x1')]},'description':{'type':Sequelize[_0x89c7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3ce29a7..2f03d66 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 _0xfdc2=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','type','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','update','catch','findOne','DeskField','pick','getFields','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3cf9d1,_0x402ba4){var _0x4b0abf=function(_0x28276f){while(--_0x28276f){_0x3cf9d1['push'](_0x3cf9d1['shift']());}};_0x4b0abf(++_0x402ba4);}(_0xfdc2,0xe4));var _0x2fdc=function(_0x23d609,_0x17372c){_0x23d609=_0x23d609-0x0;var _0x5ed283=_0xfdc2[_0x23d609];return _0x5ed283;};'use strict';var emlformat=require(_0x2fdc('0x0'));var rimraf=require(_0x2fdc('0x1'));var zipdir=require(_0x2fdc('0x2'));var jsonpatch=require(_0x2fdc('0x3'));var rp=require(_0x2fdc('0x4'));var moment=require(_0x2fdc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2fdc('0x6'));var util=require(_0x2fdc('0x7'));var path=require('path');var sox=require(_0x2fdc('0x8'));var csv=require(_0x2fdc('0x9'));var ejs=require(_0x2fdc('0xa'));var fs=require('fs');var fs_extra=require(_0x2fdc('0xb'));var _=require(_0x2fdc('0xc'));var squel=require(_0x2fdc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2fdc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2fdc('0xf'));var Papa=require(_0x2fdc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2fdc('0x11'));var as=require(_0x2fdc('0x12'));var hardwareService=require(_0x2fdc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2fdc('0x14'));var config=require(_0x2fdc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fdc('0x16'))['db'];function respondWithStatusCode(_0x3f55f5,_0x461673){_0x461673=_0x461673||0xcc;return function(_0xc6733d){if(_0xc6733d){return _0x3f55f5[_0x2fdc('0x17')](_0x461673);}return _0x3f55f5[_0x2fdc('0x18')](_0x461673)[_0x2fdc('0x19')]();};}function respondWithResult(_0x4ad2dc,_0x17ef68){_0x17ef68=_0x17ef68||0xc8;return function(_0x57c68a){if(_0x57c68a){return _0x4ad2dc[_0x2fdc('0x18')](_0x17ef68)[_0x2fdc('0x1a')](_0x57c68a);}};}function respondWithFilteredResult(_0x3fc52c,_0x2ffd56){return function(_0x1d7ed3){if(_0x1d7ed3){var _0x299ca2=typeof _0x2ffd56['offset']===_0x2fdc('0x1b')&&typeof _0x2ffd56[_0x2fdc('0x1c')]===_0x2fdc('0x1b');var _0x4eceba=_0x1d7ed3[_0x2fdc('0x1d')];var _0x3ddceb=_0x299ca2?0x0:_0x2ffd56[_0x2fdc('0x1e')];var _0x57cb20=_0x299ca2?_0x1d7ed3[_0x2fdc('0x1d')]:_0x2ffd56[_0x2fdc('0x1e')]+_0x2ffd56[_0x2fdc('0x1c')];var _0xcf5429;if(_0x57cb20>=_0x4eceba){_0x57cb20=_0x4eceba;_0xcf5429=0xc8;}else{_0xcf5429=0xce;}_0x3fc52c[_0x2fdc('0x18')](_0xcf5429);return _0x3fc52c[_0x2fdc('0x1f')](_0x2fdc('0x20'),_0x3ddceb+'-'+_0x57cb20+'/'+_0x4eceba)[_0x2fdc('0x1a')](_0x1d7ed3);}return null;};}function patchUpdates(_0x1b008f){return function(_0x2d57a7){try{jsonpatch[_0x2fdc('0x21')](_0x2d57a7,_0x1b008f,!![]);}catch(_0x1caab6){return BPromise[_0x2fdc('0x22')](_0x1caab6);}return _0x2d57a7['save']();};}function saveUpdates(_0x57b40f,_0x30f7bf){return function(_0x585de0){if(_0x585de0){return _0x585de0['update'](_0x57b40f)[_0x2fdc('0x23')](function(_0xc982de){return _0xc982de;});}return null;};}function removeEntity(_0x578bc1,_0x4c8afd){return function(_0x3c3a80){if(_0x3c3a80){return _0x3c3a80[_0x2fdc('0x24')]()[_0x2fdc('0x23')](function(){_0x578bc1[_0x2fdc('0x18')](0xcc)[_0x2fdc('0x19')]();});}};}function handleEntityNotFound(_0x448f7d,_0x49069d){return function(_0x386480){if(!_0x386480){_0x448f7d[_0x2fdc('0x17')](0x194);}return _0x386480;};}function handleError(_0x2c41e3,_0x22d67c){_0x22d67c=_0x22d67c||0x1f4;return function(_0x7000d9){logger[_0x2fdc('0x25')](_0x7000d9[_0x2fdc('0x26')]);if(_0x7000d9['name']){delete _0x7000d9[_0x2fdc('0x27')];}_0x2c41e3[_0x2fdc('0x18')](_0x22d67c)[_0x2fdc('0x28')](_0x7000d9);};}exports[_0x2fdc('0x29')]=function(_0x4dd3fb,_0xcf9de9){var _0x1f08e1={},_0x3a5c3e={},_0xa079bd={'count':0x0,'rows':[]};var _0x34b0ad=_[_0x2fdc('0x2a')](db[_0x2fdc('0x2b')][_0x2fdc('0x2c')],function(_0x5b201f){return{'name':_0x5b201f['fieldName'],'type':_0x5b201f['type'][_0x2fdc('0x2d')]};});_0x3a5c3e['model']=_[_0x2fdc('0x2a')](_0x34b0ad,_0x2fdc('0x27'));_0x3a5c3e[_0x2fdc('0x2e')]=_[_0x2fdc('0x2f')](_0x4dd3fb[_0x2fdc('0x2e')]);_0x3a5c3e['filters']=_[_0x2fdc('0x30')](_0x3a5c3e[_0x2fdc('0x31')],_0x3a5c3e[_0x2fdc('0x2e')]);_0x1f08e1[_0x2fdc('0x32')]=_[_0x2fdc('0x30')](_0x3a5c3e[_0x2fdc('0x31')],qs[_0x2fdc('0x33')](_0x4dd3fb[_0x2fdc('0x2e')][_0x2fdc('0x33')]));_0x1f08e1['attributes']=_0x1f08e1['attributes'][_0x2fdc('0x34')]?_0x1f08e1[_0x2fdc('0x32')]:_0x3a5c3e[_0x2fdc('0x31')];if(!_0x4dd3fb['query'][_0x2fdc('0x35')]('nolimit')){_0x1f08e1[_0x2fdc('0x1c')]=qs[_0x2fdc('0x1c')](_0x4dd3fb['query']['limit']);_0x1f08e1[_0x2fdc('0x1e')]=qs['offset'](_0x4dd3fb['query'][_0x2fdc('0x1e')]);}_0x1f08e1[_0x2fdc('0x36')]=qs['sort'](_0x4dd3fb[_0x2fdc('0x2e')][_0x2fdc('0x37')]);_0x1f08e1[_0x2fdc('0x38')]=qs[_0x2fdc('0x39')](_['pick'](_0x4dd3fb[_0x2fdc('0x2e')],_0x3a5c3e[_0x2fdc('0x39')]),_0x34b0ad);if(_0x4dd3fb[_0x2fdc('0x2e')][_0x2fdc('0x3a')]){_0x1f08e1[_0x2fdc('0x38')]=_['merge'](_0x1f08e1[_0x2fdc('0x38')],{'$or':_[_0x2fdc('0x2a')](_0x34b0ad,function(_0x4ff0e6){if(_0x4ff0e6[_0x2fdc('0x3b')]!=='VIRTUAL'){var _0x3b1336={};_0x3b1336[_0x4ff0e6[_0x2fdc('0x27')]]={'$like':'%'+_0x4dd3fb[_0x2fdc('0x2e')][_0x2fdc('0x3a')]+'%'};return _0x3b1336;}})});}_0x1f08e1=_[_0x2fdc('0x3c')]({},_0x1f08e1,_0x4dd3fb[_0x2fdc('0x3d')]);var _0x48c5f7={'where':_0x1f08e1[_0x2fdc('0x38')]};return db[_0x2fdc('0x2b')][_0x2fdc('0x1d')](_0x48c5f7)[_0x2fdc('0x23')](function(_0x435550){_0xa079bd[_0x2fdc('0x1d')]=_0x435550;if(_0x4dd3fb[_0x2fdc('0x2e')][_0x2fdc('0x3e')]){_0x1f08e1['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x2fdc('0x3f')](_0x1f08e1);})[_0x2fdc('0x23')](function(_0x2bd20a){_0xa079bd[_0x2fdc('0x40')]=_0x2bd20a;return _0xa079bd;})[_0x2fdc('0x23')](respondWithFilteredResult(_0xcf9de9,_0x1f08e1))['catch'](handleError(_0xcf9de9,null));};exports[_0x2fdc('0x41')]=function(_0x352948,_0x53c960){var _0x1a47e4={'raw':![],'where':{'id':_0x352948[_0x2fdc('0x42')]['id']}},_0x301200={};_0x301200['model']=_['keys'](db[_0x2fdc('0x2b')][_0x2fdc('0x2c')]);_0x301200[_0x2fdc('0x2e')]=_[_0x2fdc('0x2f')](_0x352948[_0x2fdc('0x2e')]);_0x301200[_0x2fdc('0x39')]=_[_0x2fdc('0x30')](_0x301200['model'],_0x301200[_0x2fdc('0x2e')]);_0x1a47e4[_0x2fdc('0x32')]=_[_0x2fdc('0x30')](_0x301200[_0x2fdc('0x31')],qs[_0x2fdc('0x33')](_0x352948['query'][_0x2fdc('0x33')]));_0x1a47e4[_0x2fdc('0x32')]=_0x1a47e4[_0x2fdc('0x32')][_0x2fdc('0x34')]?_0x1a47e4[_0x2fdc('0x32')]:_0x301200[_0x2fdc('0x31')];if(_0x352948[_0x2fdc('0x2e')][_0x2fdc('0x3e')]){_0x1a47e4[_0x2fdc('0x43')]=[{'all':!![]}];}_0x1a47e4=_[_0x2fdc('0x3c')]({},_0x1a47e4,_0x352948[_0x2fdc('0x3d')]);return db['DeskConfiguration'][_0x2fdc('0x44')](_0x1a47e4)['then'](handleEntityNotFound(_0x53c960,null))[_0x2fdc('0x23')](respondWithResult(_0x53c960,null))['catch'](handleError(_0x53c960,null));};exports[_0x2fdc('0x45')]=function(_0x123b4b,_0x40e9e3){return db[_0x2fdc('0x2b')][_0x2fdc('0x45')](_0x123b4b[_0x2fdc('0x46')],{})[_0x2fdc('0x23')](respondWithResult(_0x40e9e3,0xc9))['catch'](handleError(_0x40e9e3,null));};exports[_0x2fdc('0x47')]=function(_0xd27919,_0x2d62a3){if(_0xd27919['body']['id']){delete _0xd27919[_0x2fdc('0x46')]['id'];}return db[_0x2fdc('0x2b')]['find']({'where':{'id':_0xd27919[_0x2fdc('0x42')]['id']}})[_0x2fdc('0x23')](handleEntityNotFound(_0x2d62a3,null))['then'](saveUpdates(_0xd27919['body'],null))[_0x2fdc('0x23')](respondWithResult(_0x2d62a3,null))[_0x2fdc('0x48')](handleError(_0x2d62a3,null));};exports[_0x2fdc('0x24')]=function(_0x1fdc3a,_0x66fc78){return db[_0x2fdc('0x2b')][_0x2fdc('0x44')]({'where':{'id':_0x1fdc3a[_0x2fdc('0x42')]['id']}})[_0x2fdc('0x23')](handleEntityNotFound(_0x66fc78,null))[_0x2fdc('0x23')](removeEntity(_0x66fc78,null))[_0x2fdc('0x48')](handleError(_0x66fc78,null));};exports['getFields']=function(_0x3420b8,_0x4a0372,_0x2b8afd){var _0x40be2b={};var _0x415034={};var _0x4c6edc;var _0x4ab4c1;return db[_0x2fdc('0x2b')][_0x2fdc('0x49')]({'where':{'id':_0x3420b8['params']['id']}})[_0x2fdc('0x23')](handleEntityNotFound(_0x4a0372,null))[_0x2fdc('0x23')](function(_0x1c77b0){if(_0x1c77b0){_0x4c6edc=_0x1c77b0;_0x415034[_0x2fdc('0x31')]=_[_0x2fdc('0x2f')](db[_0x2fdc('0x4a')]['rawAttributes']);_0x415034['query']=_[_0x2fdc('0x2f')](_0x3420b8[_0x2fdc('0x2e')]);_0x415034[_0x2fdc('0x39')]=_[_0x2fdc('0x30')](_0x415034['model'],_0x415034[_0x2fdc('0x2e')]);_0x40be2b['attributes']=_[_0x2fdc('0x30')](_0x415034[_0x2fdc('0x31')],qs[_0x2fdc('0x33')](_0x3420b8[_0x2fdc('0x2e')]['fields']));_0x40be2b['attributes']=_0x40be2b['attributes'][_0x2fdc('0x34')]?_0x40be2b[_0x2fdc('0x32')]:_0x415034[_0x2fdc('0x31')];_0x40be2b[_0x2fdc('0x36')]=qs['sort'](_0x3420b8[_0x2fdc('0x2e')][_0x2fdc('0x37')]);_0x40be2b[_0x2fdc('0x38')]=qs[_0x2fdc('0x39')](_[_0x2fdc('0x4b')](_0x3420b8[_0x2fdc('0x2e')],_0x415034['filters']));if(_0x3420b8['query'][_0x2fdc('0x3a')]){_0x40be2b[_0x2fdc('0x38')]=_[_0x2fdc('0x3c')](_0x40be2b[_0x2fdc('0x38')],{'$or':_[_0x2fdc('0x2a')](_0x40be2b[_0x2fdc('0x32')],function(_0x5db933){var _0x293f45={};_0x293f45[_0x5db933]={'$like':'%'+_0x3420b8[_0x2fdc('0x2e')][_0x2fdc('0x3a')]+'%'};return _0x293f45;})});}_0x40be2b=_[_0x2fdc('0x3c')]({},_0x40be2b,_0x3420b8[_0x2fdc('0x3d')]);return _0x4c6edc[_0x2fdc('0x4c')](_0x40be2b);}})[_0x2fdc('0x23')](function(_0x4fd369){if(_0x4fd369){_0x4ab4c1=_0x4fd369['length'];if(!_0x3420b8[_0x2fdc('0x2e')][_0x2fdc('0x35')]('nolimit')){_0x40be2b[_0x2fdc('0x1c')]=qs[_0x2fdc('0x1c')](_0x3420b8[_0x2fdc('0x2e')][_0x2fdc('0x1c')]);_0x40be2b['offset']=qs[_0x2fdc('0x1e')](_0x3420b8[_0x2fdc('0x2e')][_0x2fdc('0x1e')]);}return _0x4c6edc['getFields'](_0x40be2b);}})[_0x2fdc('0x23')](function(_0xed869d){if(_0xed869d){return _0xed869d?{'count':_0x4ab4c1,'rows':_0xed869d}:null;}})[_0x2fdc('0x23')](respondWithResult(_0x4a0372,null))[_0x2fdc('0x48')](handleError(_0x4a0372,null));};exports[_0x2fdc('0x4d')]=function(_0x4a1036,_0x3447df,_0xce7072){var _0x39e23c={};var _0x19761f={};var _0x5027fa;var _0x5d4562;return db['DeskConfiguration'][_0x2fdc('0x49')]({'where':{'id':_0x4a1036[_0x2fdc('0x42')]['id']}})[_0x2fdc('0x23')](handleEntityNotFound(_0x3447df,null))['then'](function(_0x37e0a0){if(_0x37e0a0){_0x5027fa=_0x37e0a0;_0x19761f[_0x2fdc('0x31')]=_['keys'](db[_0x2fdc('0x4a')]['rawAttributes']);_0x19761f[_0x2fdc('0x2e')]=_['keys'](_0x4a1036[_0x2fdc('0x2e')]);_0x19761f[_0x2fdc('0x39')]=_['intersection'](_0x19761f['model'],_0x19761f[_0x2fdc('0x2e')]);_0x39e23c[_0x2fdc('0x32')]=_['intersection'](_0x19761f[_0x2fdc('0x31')],qs['fields'](_0x4a1036[_0x2fdc('0x2e')][_0x2fdc('0x33')]));_0x39e23c['attributes']=_0x39e23c[_0x2fdc('0x32')][_0x2fdc('0x34')]?_0x39e23c[_0x2fdc('0x32')]:_0x19761f[_0x2fdc('0x31')];_0x39e23c[_0x2fdc('0x36')]=qs['sort'](_0x4a1036[_0x2fdc('0x2e')]['sort']);_0x39e23c[_0x2fdc('0x38')]=qs[_0x2fdc('0x39')](_[_0x2fdc('0x4b')](_0x4a1036['query'],_0x19761f[_0x2fdc('0x39')]));if(_0x4a1036[_0x2fdc('0x2e')]['filter']){_0x39e23c[_0x2fdc('0x38')]=_[_0x2fdc('0x3c')](_0x39e23c['where'],{'$or':_['map'](_0x39e23c[_0x2fdc('0x32')],function(_0x433ad1){var _0x57fc99={};_0x57fc99[_0x433ad1]={'$like':'%'+_0x4a1036[_0x2fdc('0x2e')]['filter']+'%'};return _0x57fc99;})});}_0x39e23c=_[_0x2fdc('0x3c')]({},_0x39e23c,_0x4a1036[_0x2fdc('0x3d')]);return _0x5027fa[_0x2fdc('0x4d')](_0x39e23c);}})[_0x2fdc('0x23')](function(_0x31c47d){if(_0x31c47d){_0x5d4562=_0x31c47d['length'];if(!_0x4a1036[_0x2fdc('0x2e')][_0x2fdc('0x35')](_0x2fdc('0x4e'))){_0x39e23c[_0x2fdc('0x1c')]=qs[_0x2fdc('0x1c')](_0x4a1036['query'][_0x2fdc('0x1c')]);_0x39e23c['offset']=qs[_0x2fdc('0x1e')](_0x4a1036[_0x2fdc('0x2e')]['offset']);}return _0x5027fa[_0x2fdc('0x4d')](_0x39e23c);}})['then'](function(_0x1c5f97){if(_0x1c5f97){return _0x1c5f97?{'count':_0x5d4562,'rows':_0x1c5f97}:null;}})[_0x2fdc('0x23')](respondWithResult(_0x3447df,null))[_0x2fdc('0x48')](handleError(_0x3447df,null));};exports['getDescriptions']=function(_0x394200,_0x4507f1,_0x1fb7fc){var _0x188031={};var _0x45143e={};var _0x13c2e5;var _0x808035;return db[_0x2fdc('0x2b')][_0x2fdc('0x49')]({'where':{'id':_0x394200[_0x2fdc('0x42')]['id']}})['then'](handleEntityNotFound(_0x4507f1,null))[_0x2fdc('0x23')](function(_0x2f4021){if(_0x2f4021){_0x13c2e5=_0x2f4021;_0x45143e[_0x2fdc('0x31')]=_['keys'](db[_0x2fdc('0x4a')][_0x2fdc('0x2c')]);_0x45143e[_0x2fdc('0x2e')]=_[_0x2fdc('0x2f')](_0x394200[_0x2fdc('0x2e')]);_0x45143e[_0x2fdc('0x39')]=_[_0x2fdc('0x30')](_0x45143e[_0x2fdc('0x31')],_0x45143e[_0x2fdc('0x2e')]);_0x188031[_0x2fdc('0x32')]=_[_0x2fdc('0x30')](_0x45143e['model'],qs[_0x2fdc('0x33')](_0x394200['query'][_0x2fdc('0x33')]));_0x188031['attributes']=_0x188031[_0x2fdc('0x32')]['length']?_0x188031[_0x2fdc('0x32')]:_0x45143e[_0x2fdc('0x31')];_0x188031[_0x2fdc('0x36')]=qs['sort'](_0x394200[_0x2fdc('0x2e')][_0x2fdc('0x37')]);_0x188031[_0x2fdc('0x38')]=qs['filters'](_[_0x2fdc('0x4b')](_0x394200[_0x2fdc('0x2e')],_0x45143e[_0x2fdc('0x39')]));if(_0x394200[_0x2fdc('0x2e')][_0x2fdc('0x3a')]){_0x188031['where']=_[_0x2fdc('0x3c')](_0x188031[_0x2fdc('0x38')],{'$or':_[_0x2fdc('0x2a')](_0x188031['attributes'],function(_0xb590b0){var _0x352b73={};_0x352b73[_0xb590b0]={'$like':'%'+_0x394200[_0x2fdc('0x2e')][_0x2fdc('0x3a')]+'%'};return _0x352b73;})});}_0x188031=_[_0x2fdc('0x3c')]({},_0x188031,_0x394200[_0x2fdc('0x3d')]);return _0x13c2e5[_0x2fdc('0x4f')](_0x188031);}})['then'](function(_0x48b744){if(_0x48b744){_0x808035=_0x48b744['length'];if(!_0x394200[_0x2fdc('0x2e')][_0x2fdc('0x35')](_0x2fdc('0x4e'))){_0x188031['limit']=qs[_0x2fdc('0x1c')](_0x394200[_0x2fdc('0x2e')]['limit']);_0x188031[_0x2fdc('0x1e')]=qs[_0x2fdc('0x1e')](_0x394200[_0x2fdc('0x2e')][_0x2fdc('0x1e')]);}return _0x13c2e5[_0x2fdc('0x4f')](_0x188031);}})[_0x2fdc('0x23')](function(_0x94093c){if(_0x94093c){return _0x94093c?{'count':_0x808035,'rows':_0x94093c}:null;}})[_0x2fdc('0x23')](respondWithResult(_0x4507f1,null))['catch'](handleError(_0x4507f1,null));};exports[_0x2fdc('0x50')]=function(_0x2a8eea,_0x264857,_0x5b6b27){var _0x4bdbd5={};var _0x37e33b={};var _0x1309df;var _0x4f78f0;return db[_0x2fdc('0x2b')][_0x2fdc('0x49')]({'where':{'id':_0x2a8eea[_0x2fdc('0x42')]['id']}})[_0x2fdc('0x23')](handleEntityNotFound(_0x264857,null))['then'](function(_0x3779f0){if(_0x3779f0){_0x1309df=_0x3779f0;_0x37e33b[_0x2fdc('0x31')]=_[_0x2fdc('0x2f')](db[_0x2fdc('0x51')][_0x2fdc('0x2c')]);_0x37e33b[_0x2fdc('0x2e')]=_[_0x2fdc('0x2f')](_0x2a8eea['query']);_0x37e33b[_0x2fdc('0x39')]=_[_0x2fdc('0x30')](_0x37e33b['model'],_0x37e33b['query']);_0x4bdbd5[_0x2fdc('0x32')]=_['intersection'](_0x37e33b['model'],qs['fields'](_0x2a8eea['query'][_0x2fdc('0x33')]));_0x4bdbd5['attributes']=_0x4bdbd5[_0x2fdc('0x32')][_0x2fdc('0x34')]?_0x4bdbd5[_0x2fdc('0x32')]:_0x37e33b[_0x2fdc('0x31')];_0x4bdbd5[_0x2fdc('0x36')]=qs[_0x2fdc('0x37')](_0x2a8eea[_0x2fdc('0x2e')][_0x2fdc('0x37')]);_0x4bdbd5[_0x2fdc('0x38')]=qs[_0x2fdc('0x39')](_[_0x2fdc('0x4b')](_0x2a8eea[_0x2fdc('0x2e')],_0x37e33b[_0x2fdc('0x39')]));if(_0x2a8eea['query'][_0x2fdc('0x3a')]){_0x4bdbd5[_0x2fdc('0x38')]=_[_0x2fdc('0x3c')](_0x4bdbd5[_0x2fdc('0x38')],{'$or':_[_0x2fdc('0x2a')](_0x4bdbd5[_0x2fdc('0x32')],function(_0x401388){var _0x5c86d0={};_0x5c86d0[_0x401388]={'$like':'%'+_0x2a8eea[_0x2fdc('0x2e')][_0x2fdc('0x3a')]+'%'};return _0x5c86d0;})});}_0x4bdbd5=_[_0x2fdc('0x3c')]({},_0x4bdbd5,_0x2a8eea[_0x2fdc('0x3d')]);return _0x1309df[_0x2fdc('0x50')](_0x4bdbd5);}})[_0x2fdc('0x23')](function(_0x31ce0f){if(_0x31ce0f){_0x4f78f0=_0x31ce0f[_0x2fdc('0x34')];if(!_0x2a8eea[_0x2fdc('0x2e')]['hasOwnProperty'](_0x2fdc('0x4e'))){_0x4bdbd5[_0x2fdc('0x1c')]=qs[_0x2fdc('0x1c')](_0x2a8eea[_0x2fdc('0x2e')][_0x2fdc('0x1c')]);_0x4bdbd5[_0x2fdc('0x1e')]=qs['offset'](_0x2a8eea[_0x2fdc('0x2e')][_0x2fdc('0x1e')]);}return _0x1309df[_0x2fdc('0x50')](_0x4bdbd5);}})[_0x2fdc('0x23')](function(_0x2d6426){if(_0x2d6426){return _0x2d6426?{'count':_0x4f78f0,'rows':_0x2d6426}:null;}})['then'](respondWithResult(_0x264857,null))[_0x2fdc('0x48')](handleError(_0x264857,null));};exports[_0x2fdc('0x52')]=function(_0x351943,_0x4a0af5,_0xe1fad1){if(_0x351943[_0x2fdc('0x46')]['id']){delete _0x351943[_0x2fdc('0x46')]['id'];}return db[_0x2fdc('0x2b')][_0x2fdc('0x49')]({'where':{'id':_0x351943[_0x2fdc('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a0af5,null))[_0x2fdc('0x23')](function(_0x52b913){if(_0x52b913){return _0x52b913['setTags'](_0x351943[_0x2fdc('0x46')][_0x2fdc('0x53')]||[]);}return null;})[_0x2fdc('0x23')](respondWithResult(_0x4a0af5,null))[_0x2fdc('0x48')](handleError(_0x4a0af5,null));}; \ No newline at end of file +var _0xd365=['getDescriptions','getTags','setTags','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','then','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','keys','fields','length','find','catch','create','body','update','getFields','findOne','pick','getSubjects'];(function(_0x3ae1d6,_0x530d84){var _0x3126eb=function(_0x35f1cf){while(--_0x35f1cf){_0x3ae1d6['push'](_0x3ae1d6['shift']());}};_0x3126eb(++_0x530d84);}(_0xd365,0x189));var _0x5d36=function(_0x423889,_0x908a5){_0x423889=_0x423889-0x0;var _0x187d0a=_0xd365[_0x423889];return _0x187d0a;};'use strict';var emlformat=require(_0x5d36('0x0'));var rimraf=require(_0x5d36('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d36('0x2'));var moment=require(_0x5d36('0x3'));var BPromise=require(_0x5d36('0x4'));var Mustache=require(_0x5d36('0x5'));var util=require(_0x5d36('0x6'));var path=require(_0x5d36('0x7'));var sox=require(_0x5d36('0x8'));var csv=require(_0x5d36('0x9'));var ejs=require(_0x5d36('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d36('0xb'));var squel=require(_0x5d36('0xc'));var crypto=require(_0x5d36('0xd'));var jsforce=require(_0x5d36('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5d36('0x9'));var querystring=require(_0x5d36('0xf'));var Papa=require('papaparse');var Redis=require(_0x5d36('0x10'));var authService=require(_0x5d36('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5d36('0x12'));var hardwareService=require(_0x5d36('0x13'));var logger=require('../../config/logger')(_0x5d36('0x14'));var utils=require(_0x5d36('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5d36('0x16'));var db=require(_0x5d36('0x17'))['db'];function respondWithStatusCode(_0x13f8a,_0x422ff4){_0x422ff4=_0x422ff4||0xcc;return function(_0x2c3d11){if(_0x2c3d11){return _0x13f8a[_0x5d36('0x18')](_0x422ff4);}return _0x13f8a[_0x5d36('0x19')](_0x422ff4)[_0x5d36('0x1a')]();};}function respondWithResult(_0x272145,_0x335c52){_0x335c52=_0x335c52||0xc8;return function(_0x289244){if(_0x289244){return _0x272145[_0x5d36('0x19')](_0x335c52)[_0x5d36('0x1b')](_0x289244);}};}function respondWithFilteredResult(_0x7f7bed,_0x550992){return function(_0x5377b0){if(_0x5377b0){var _0x3bbec1=typeof _0x550992[_0x5d36('0x1c')]==='undefined'&&typeof _0x550992[_0x5d36('0x1d')]===_0x5d36('0x1e');var _0x41e9b3=_0x5377b0[_0x5d36('0x1f')];var _0x4163a4=_0x3bbec1?0x0:_0x550992[_0x5d36('0x1c')];var _0x30fe49=_0x3bbec1?_0x5377b0[_0x5d36('0x1f')]:_0x550992[_0x5d36('0x1c')]+_0x550992[_0x5d36('0x1d')];var _0x5050ea;if(_0x30fe49>=_0x41e9b3){_0x30fe49=_0x41e9b3;_0x5050ea=0xc8;}else{_0x5050ea=0xce;}_0x7f7bed['status'](_0x5050ea);return _0x7f7bed['set']('Content-Range',_0x4163a4+'-'+_0x30fe49+'/'+_0x41e9b3)[_0x5d36('0x1b')](_0x5377b0);}return null;};}function patchUpdates(_0x366036){return function(_0x3cedbd){try{jsonpatch[_0x5d36('0x20')](_0x3cedbd,_0x366036,!![]);}catch(_0x48a2fe){return BPromise[_0x5d36('0x21')](_0x48a2fe);}return _0x3cedbd['save']();};}function saveUpdates(_0x23c16d,_0x32012b){return function(_0x4be3e0){if(_0x4be3e0){return _0x4be3e0['update'](_0x23c16d)[_0x5d36('0x22')](function(_0x353cc4){return _0x353cc4;});}return null;};}function removeEntity(_0xa8713a,_0x1f89de){return function(_0xf6cf11){if(_0xf6cf11){return _0xf6cf11['destroy']()[_0x5d36('0x22')](function(){_0xa8713a[_0x5d36('0x19')](0xcc)[_0x5d36('0x1a')]();});}};}function handleEntityNotFound(_0x4f6379,_0x5d291d){return function(_0x1e8426){if(!_0x1e8426){_0x4f6379[_0x5d36('0x18')](0x194);}return _0x1e8426;};}function handleError(_0xd3f7fa,_0x1d54a1){_0x1d54a1=_0x1d54a1||0x1f4;return function(_0x3a581c){logger[_0x5d36('0x23')](_0x3a581c[_0x5d36('0x24')]);if(_0x3a581c[_0x5d36('0x25')]){delete _0x3a581c[_0x5d36('0x25')];}_0xd3f7fa['status'](_0x1d54a1)[_0x5d36('0x26')](_0x3a581c);};}exports['index']=function(_0xf4755a,_0x478296){var _0x4b7582={},_0x37740c={},_0x864b90={'count':0x0,'rows':[]};var _0x49c1db=_[_0x5d36('0x27')](db[_0x5d36('0x28')][_0x5d36('0x29')],function(_0x49ebb0){return{'name':_0x49ebb0[_0x5d36('0x2a')],'type':_0x49ebb0[_0x5d36('0x2b')][_0x5d36('0x2c')]};});_0x37740c[_0x5d36('0x2d')]=_[_0x5d36('0x27')](_0x49c1db,_0x5d36('0x25'));_0x37740c[_0x5d36('0x2e')]=_['keys'](_0xf4755a[_0x5d36('0x2e')]);_0x37740c['filters']=_['intersection'](_0x37740c[_0x5d36('0x2d')],_0x37740c['query']);_0x4b7582[_0x5d36('0x2f')]=_[_0x5d36('0x30')](_0x37740c[_0x5d36('0x2d')],qs['fields'](_0xf4755a[_0x5d36('0x2e')]['fields']));_0x4b7582[_0x5d36('0x2f')]=_0x4b7582[_0x5d36('0x2f')]['length']?_0x4b7582[_0x5d36('0x2f')]:_0x37740c['model'];if(!_0xf4755a[_0x5d36('0x2e')][_0x5d36('0x31')](_0x5d36('0x32'))){_0x4b7582[_0x5d36('0x1d')]=qs['limit'](_0xf4755a['query'][_0x5d36('0x1d')]);_0x4b7582['offset']=qs['offset'](_0xf4755a[_0x5d36('0x2e')][_0x5d36('0x1c')]);}_0x4b7582[_0x5d36('0x33')]=qs[_0x5d36('0x34')](_0xf4755a[_0x5d36('0x2e')][_0x5d36('0x34')]);_0x4b7582['where']=qs[_0x5d36('0x35')](_['pick'](_0xf4755a['query'],_0x37740c[_0x5d36('0x35')]),_0x49c1db);if(_0xf4755a[_0x5d36('0x2e')][_0x5d36('0x36')]){_0x4b7582[_0x5d36('0x37')]=_['merge'](_0x4b7582[_0x5d36('0x37')],{'$or':_['map'](_0x49c1db,function(_0x8e9ac4){if(_0x8e9ac4[_0x5d36('0x2b')]!==_0x5d36('0x38')){var _0xf021fe={};_0xf021fe[_0x8e9ac4[_0x5d36('0x25')]]={'$like':'%'+_0xf4755a[_0x5d36('0x2e')][_0x5d36('0x36')]+'%'};return _0xf021fe;}})});}_0x4b7582=_[_0x5d36('0x39')]({},_0x4b7582,_0xf4755a[_0x5d36('0x3a')]);var _0x283e14={'where':_0x4b7582['where']};return db['DeskConfiguration'][_0x5d36('0x1f')](_0x283e14)[_0x5d36('0x22')](function(_0xf7d358){_0x864b90['count']=_0xf7d358;if(_0xf4755a[_0x5d36('0x2e')][_0x5d36('0x3b')]){_0x4b7582[_0x5d36('0x3c')]=[{'all':!![]}];}return db[_0x5d36('0x28')]['findAll'](_0x4b7582);})[_0x5d36('0x22')](function(_0x1cae0f){_0x864b90['rows']=_0x1cae0f;return _0x864b90;})['then'](respondWithFilteredResult(_0x478296,_0x4b7582))['catch'](handleError(_0x478296,null));};exports[_0x5d36('0x3d')]=function(_0x4c9866,_0x10fa6d){var _0x559441={'raw':![],'where':{'id':_0x4c9866[_0x5d36('0x3e')]['id']}},_0x2f77fc={};_0x2f77fc[_0x5d36('0x2d')]=_[_0x5d36('0x3f')](db[_0x5d36('0x28')][_0x5d36('0x29')]);_0x2f77fc[_0x5d36('0x2e')]=_[_0x5d36('0x3f')](_0x4c9866[_0x5d36('0x2e')]);_0x2f77fc[_0x5d36('0x35')]=_['intersection'](_0x2f77fc[_0x5d36('0x2d')],_0x2f77fc[_0x5d36('0x2e')]);_0x559441[_0x5d36('0x2f')]=_[_0x5d36('0x30')](_0x2f77fc[_0x5d36('0x2d')],qs[_0x5d36('0x40')](_0x4c9866[_0x5d36('0x2e')]['fields']));_0x559441[_0x5d36('0x2f')]=_0x559441[_0x5d36('0x2f')][_0x5d36('0x41')]?_0x559441[_0x5d36('0x2f')]:_0x2f77fc[_0x5d36('0x2d')];if(_0x4c9866[_0x5d36('0x2e')][_0x5d36('0x3b')]){_0x559441[_0x5d36('0x3c')]=[{'all':!![]}];}_0x559441=_['merge']({},_0x559441,_0x4c9866['options']);return db[_0x5d36('0x28')][_0x5d36('0x42')](_0x559441)[_0x5d36('0x22')](handleEntityNotFound(_0x10fa6d,null))[_0x5d36('0x22')](respondWithResult(_0x10fa6d,null))[_0x5d36('0x43')](handleError(_0x10fa6d,null));};exports['create']=function(_0x3fedd6,_0x575344){return db[_0x5d36('0x28')][_0x5d36('0x44')](_0x3fedd6[_0x5d36('0x45')],{})[_0x5d36('0x22')](respondWithResult(_0x575344,0xc9))[_0x5d36('0x43')](handleError(_0x575344,null));};exports[_0x5d36('0x46')]=function(_0x30a303,_0x4bcd77){if(_0x30a303[_0x5d36('0x45')]['id']){delete _0x30a303[_0x5d36('0x45')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x30a303[_0x5d36('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4bcd77,null))['then'](saveUpdates(_0x30a303[_0x5d36('0x45')],null))[_0x5d36('0x22')](respondWithResult(_0x4bcd77,null))[_0x5d36('0x43')](handleError(_0x4bcd77,null));};exports['destroy']=function(_0x4ebfff,_0x4eaa4b){return db[_0x5d36('0x28')][_0x5d36('0x42')]({'where':{'id':_0x4ebfff[_0x5d36('0x3e')]['id']}})[_0x5d36('0x22')](handleEntityNotFound(_0x4eaa4b,null))['then'](removeEntity(_0x4eaa4b,null))[_0x5d36('0x43')](handleError(_0x4eaa4b,null));};exports[_0x5d36('0x47')]=function(_0x19391c,_0x510e85,_0x5b24ee){var _0x7720b5={};var _0x4993a5={};var _0x59492c;var _0x402fd3;return db['DeskConfiguration'][_0x5d36('0x48')]({'where':{'id':_0x19391c['params']['id']}})[_0x5d36('0x22')](handleEntityNotFound(_0x510e85,null))[_0x5d36('0x22')](function(_0x18d0fe){if(_0x18d0fe){_0x59492c=_0x18d0fe;_0x4993a5[_0x5d36('0x2d')]=_[_0x5d36('0x3f')](db['DeskField'][_0x5d36('0x29')]);_0x4993a5[_0x5d36('0x2e')]=_[_0x5d36('0x3f')](_0x19391c[_0x5d36('0x2e')]);_0x4993a5[_0x5d36('0x35')]=_['intersection'](_0x4993a5[_0x5d36('0x2d')],_0x4993a5[_0x5d36('0x2e')]);_0x7720b5['attributes']=_['intersection'](_0x4993a5[_0x5d36('0x2d')],qs[_0x5d36('0x40')](_0x19391c[_0x5d36('0x2e')][_0x5d36('0x40')]));_0x7720b5[_0x5d36('0x2f')]=_0x7720b5['attributes'][_0x5d36('0x41')]?_0x7720b5[_0x5d36('0x2f')]:_0x4993a5['model'];_0x7720b5['order']=qs[_0x5d36('0x34')](_0x19391c[_0x5d36('0x2e')][_0x5d36('0x34')]);_0x7720b5[_0x5d36('0x37')]=qs[_0x5d36('0x35')](_[_0x5d36('0x49')](_0x19391c['query'],_0x4993a5[_0x5d36('0x35')]));if(_0x19391c['query'][_0x5d36('0x36')]){_0x7720b5['where']=_[_0x5d36('0x39')](_0x7720b5['where'],{'$or':_[_0x5d36('0x27')](_0x7720b5['attributes'],function(_0x1daff1){var _0x21d6dd={};_0x21d6dd[_0x1daff1]={'$like':'%'+_0x19391c[_0x5d36('0x2e')][_0x5d36('0x36')]+'%'};return _0x21d6dd;})});}_0x7720b5=_[_0x5d36('0x39')]({},_0x7720b5,_0x19391c[_0x5d36('0x3a')]);return _0x59492c[_0x5d36('0x47')](_0x7720b5);}})['then'](function(_0x4dfbd6){if(_0x4dfbd6){_0x402fd3=_0x4dfbd6[_0x5d36('0x41')];if(!_0x19391c[_0x5d36('0x2e')]['hasOwnProperty']('nolimit')){_0x7720b5['limit']=qs[_0x5d36('0x1d')](_0x19391c[_0x5d36('0x2e')][_0x5d36('0x1d')]);_0x7720b5[_0x5d36('0x1c')]=qs['offset'](_0x19391c['query'][_0x5d36('0x1c')]);}return _0x59492c[_0x5d36('0x47')](_0x7720b5);}})[_0x5d36('0x22')](function(_0x4a3ef7){if(_0x4a3ef7){return _0x4a3ef7?{'count':_0x402fd3,'rows':_0x4a3ef7}:null;}})[_0x5d36('0x22')](respondWithResult(_0x510e85,null))[_0x5d36('0x43')](handleError(_0x510e85,null));};exports[_0x5d36('0x4a')]=function(_0x54efa9,_0x399876,_0x4e5b94){var _0x2bbced={};var _0x320e87={};var _0x572c0c;var _0x18ff75;return db['DeskConfiguration'][_0x5d36('0x48')]({'where':{'id':_0x54efa9[_0x5d36('0x3e')]['id']}})['then'](handleEntityNotFound(_0x399876,null))[_0x5d36('0x22')](function(_0x5702a9){if(_0x5702a9){_0x572c0c=_0x5702a9;_0x320e87[_0x5d36('0x2d')]=_['keys'](db['DeskField'][_0x5d36('0x29')]);_0x320e87[_0x5d36('0x2e')]=_[_0x5d36('0x3f')](_0x54efa9[_0x5d36('0x2e')]);_0x320e87['filters']=_['intersection'](_0x320e87[_0x5d36('0x2d')],_0x320e87[_0x5d36('0x2e')]);_0x2bbced[_0x5d36('0x2f')]=_['intersection'](_0x320e87['model'],qs[_0x5d36('0x40')](_0x54efa9['query'][_0x5d36('0x40')]));_0x2bbced[_0x5d36('0x2f')]=_0x2bbced[_0x5d36('0x2f')][_0x5d36('0x41')]?_0x2bbced[_0x5d36('0x2f')]:_0x320e87[_0x5d36('0x2d')];_0x2bbced[_0x5d36('0x33')]=qs[_0x5d36('0x34')](_0x54efa9[_0x5d36('0x2e')][_0x5d36('0x34')]);_0x2bbced[_0x5d36('0x37')]=qs['filters'](_[_0x5d36('0x49')](_0x54efa9[_0x5d36('0x2e')],_0x320e87[_0x5d36('0x35')]));if(_0x54efa9[_0x5d36('0x2e')][_0x5d36('0x36')]){_0x2bbced[_0x5d36('0x37')]=_[_0x5d36('0x39')](_0x2bbced[_0x5d36('0x37')],{'$or':_[_0x5d36('0x27')](_0x2bbced[_0x5d36('0x2f')],function(_0x28b2a2){var _0x4c369a={};_0x4c369a[_0x28b2a2]={'$like':'%'+_0x54efa9[_0x5d36('0x2e')][_0x5d36('0x36')]+'%'};return _0x4c369a;})});}_0x2bbced=_[_0x5d36('0x39')]({},_0x2bbced,_0x54efa9[_0x5d36('0x3a')]);return _0x572c0c['getSubjects'](_0x2bbced);}})['then'](function(_0x155475){if(_0x155475){_0x18ff75=_0x155475['length'];if(!_0x54efa9[_0x5d36('0x2e')][_0x5d36('0x31')](_0x5d36('0x32'))){_0x2bbced[_0x5d36('0x1d')]=qs['limit'](_0x54efa9[_0x5d36('0x2e')][_0x5d36('0x1d')]);_0x2bbced[_0x5d36('0x1c')]=qs['offset'](_0x54efa9[_0x5d36('0x2e')][_0x5d36('0x1c')]);}return _0x572c0c[_0x5d36('0x4a')](_0x2bbced);}})[_0x5d36('0x22')](function(_0x3dc7ce){if(_0x3dc7ce){return _0x3dc7ce?{'count':_0x18ff75,'rows':_0x3dc7ce}:null;}})[_0x5d36('0x22')](respondWithResult(_0x399876,null))['catch'](handleError(_0x399876,null));};exports[_0x5d36('0x4b')]=function(_0x58f60a,_0xe6e6a1,_0x37f6ca){var _0x3d7b32={};var _0x44f0eb={};var _0x1482c9;var _0x6b2017;return db['DeskConfiguration'][_0x5d36('0x48')]({'where':{'id':_0x58f60a[_0x5d36('0x3e')]['id']}})[_0x5d36('0x22')](handleEntityNotFound(_0xe6e6a1,null))[_0x5d36('0x22')](function(_0x33ea5c){if(_0x33ea5c){_0x1482c9=_0x33ea5c;_0x44f0eb[_0x5d36('0x2d')]=_[_0x5d36('0x3f')](db['DeskField'][_0x5d36('0x29')]);_0x44f0eb['query']=_[_0x5d36('0x3f')](_0x58f60a['query']);_0x44f0eb[_0x5d36('0x35')]=_[_0x5d36('0x30')](_0x44f0eb['model'],_0x44f0eb[_0x5d36('0x2e')]);_0x3d7b32[_0x5d36('0x2f')]=_[_0x5d36('0x30')](_0x44f0eb[_0x5d36('0x2d')],qs['fields'](_0x58f60a['query'][_0x5d36('0x40')]));_0x3d7b32[_0x5d36('0x2f')]=_0x3d7b32['attributes'][_0x5d36('0x41')]?_0x3d7b32[_0x5d36('0x2f')]:_0x44f0eb['model'];_0x3d7b32[_0x5d36('0x33')]=qs['sort'](_0x58f60a[_0x5d36('0x2e')][_0x5d36('0x34')]);_0x3d7b32[_0x5d36('0x37')]=qs[_0x5d36('0x35')](_[_0x5d36('0x49')](_0x58f60a[_0x5d36('0x2e')],_0x44f0eb[_0x5d36('0x35')]));if(_0x58f60a[_0x5d36('0x2e')][_0x5d36('0x36')]){_0x3d7b32[_0x5d36('0x37')]=_[_0x5d36('0x39')](_0x3d7b32['where'],{'$or':_[_0x5d36('0x27')](_0x3d7b32[_0x5d36('0x2f')],function(_0x558a0a){var _0x3d20f2={};_0x3d20f2[_0x558a0a]={'$like':'%'+_0x58f60a[_0x5d36('0x2e')][_0x5d36('0x36')]+'%'};return _0x3d20f2;})});}_0x3d7b32=_['merge']({},_0x3d7b32,_0x58f60a[_0x5d36('0x3a')]);return _0x1482c9[_0x5d36('0x4b')](_0x3d7b32);}})[_0x5d36('0x22')](function(_0x5e7a0a){if(_0x5e7a0a){_0x6b2017=_0x5e7a0a[_0x5d36('0x41')];if(!_0x58f60a[_0x5d36('0x2e')]['hasOwnProperty']('nolimit')){_0x3d7b32[_0x5d36('0x1d')]=qs[_0x5d36('0x1d')](_0x58f60a[_0x5d36('0x2e')]['limit']);_0x3d7b32[_0x5d36('0x1c')]=qs[_0x5d36('0x1c')](_0x58f60a[_0x5d36('0x2e')][_0x5d36('0x1c')]);}return _0x1482c9[_0x5d36('0x4b')](_0x3d7b32);}})[_0x5d36('0x22')](function(_0x15ca4c){if(_0x15ca4c){return _0x15ca4c?{'count':_0x6b2017,'rows':_0x15ca4c}:null;}})[_0x5d36('0x22')](respondWithResult(_0xe6e6a1,null))[_0x5d36('0x43')](handleError(_0xe6e6a1,null));};exports[_0x5d36('0x4c')]=function(_0x32b4fc,_0x13a2aa,_0x450c2d){var _0x2eecbc={};var _0x5ec30e={};var _0x1071b6;var _0x4d451a;return db['DeskConfiguration']['findOne']({'where':{'id':_0x32b4fc[_0x5d36('0x3e')]['id']}})[_0x5d36('0x22')](handleEntityNotFound(_0x13a2aa,null))[_0x5d36('0x22')](function(_0x27faea){if(_0x27faea){_0x1071b6=_0x27faea;_0x5ec30e['model']=_[_0x5d36('0x3f')](db['Tag'][_0x5d36('0x29')]);_0x5ec30e[_0x5d36('0x2e')]=_[_0x5d36('0x3f')](_0x32b4fc[_0x5d36('0x2e')]);_0x5ec30e[_0x5d36('0x35')]=_[_0x5d36('0x30')](_0x5ec30e[_0x5d36('0x2d')],_0x5ec30e['query']);_0x2eecbc['attributes']=_['intersection'](_0x5ec30e[_0x5d36('0x2d')],qs[_0x5d36('0x40')](_0x32b4fc['query'][_0x5d36('0x40')]));_0x2eecbc[_0x5d36('0x2f')]=_0x2eecbc['attributes'][_0x5d36('0x41')]?_0x2eecbc[_0x5d36('0x2f')]:_0x5ec30e[_0x5d36('0x2d')];_0x2eecbc[_0x5d36('0x33')]=qs['sort'](_0x32b4fc['query']['sort']);_0x2eecbc['where']=qs[_0x5d36('0x35')](_[_0x5d36('0x49')](_0x32b4fc[_0x5d36('0x2e')],_0x5ec30e[_0x5d36('0x35')]));if(_0x32b4fc[_0x5d36('0x2e')]['filter']){_0x2eecbc[_0x5d36('0x37')]=_[_0x5d36('0x39')](_0x2eecbc['where'],{'$or':_[_0x5d36('0x27')](_0x2eecbc[_0x5d36('0x2f')],function(_0x3578bc){var _0x4660dc={};_0x4660dc[_0x3578bc]={'$like':'%'+_0x32b4fc[_0x5d36('0x2e')][_0x5d36('0x36')]+'%'};return _0x4660dc;})});}_0x2eecbc=_[_0x5d36('0x39')]({},_0x2eecbc,_0x32b4fc[_0x5d36('0x3a')]);return _0x1071b6[_0x5d36('0x4c')](_0x2eecbc);}})['then'](function(_0x3d40f1){if(_0x3d40f1){_0x4d451a=_0x3d40f1[_0x5d36('0x41')];if(!_0x32b4fc[_0x5d36('0x2e')][_0x5d36('0x31')](_0x5d36('0x32'))){_0x2eecbc[_0x5d36('0x1d')]=qs[_0x5d36('0x1d')](_0x32b4fc[_0x5d36('0x2e')][_0x5d36('0x1d')]);_0x2eecbc[_0x5d36('0x1c')]=qs['offset'](_0x32b4fc[_0x5d36('0x2e')][_0x5d36('0x1c')]);}return _0x1071b6['getTags'](_0x2eecbc);}})[_0x5d36('0x22')](function(_0x5c250c){if(_0x5c250c){return _0x5c250c?{'count':_0x4d451a,'rows':_0x5c250c}:null;}})[_0x5d36('0x22')](respondWithResult(_0x13a2aa,null))['catch'](handleError(_0x13a2aa,null));};exports[_0x5d36('0x4d')]=function(_0x3faf95,_0x53e634,_0x538aba){if(_0x3faf95[_0x5d36('0x45')]['id']){delete _0x3faf95[_0x5d36('0x45')]['id'];}return db[_0x5d36('0x28')][_0x5d36('0x48')]({'where':{'id':_0x3faf95[_0x5d36('0x3e')]['id']}})[_0x5d36('0x22')](handleEntityNotFound(_0x53e634,null))[_0x5d36('0x22')](function(_0x1b9d89){if(_0x1b9d89){return _0x1b9d89[_0x5d36('0x4d')](_0x3faf95[_0x5d36('0x45')]['ids']||[]);}return null;})[_0x5d36('0x22')](respondWithResult(_0x53e634,null))[_0x5d36('0x43')](handleError(_0x53e634,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 26e675b..4fef575 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 _0x966e=['path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','bluebird'];(function(_0x1df552,_0x981a2){var _0x16cf31=function(_0x742fc5){while(--_0x742fc5){_0x1df552['push'](_0x1df552['shift']());}};_0x16cf31(++_0x981a2);}(_0x966e,0xc2));var _0xe966=function(_0xa711b,_0x81a280){_0xa711b=_0xa711b-0x0;var _0x1f061d=_0x966e[_0xa711b];return _0x1f061d;};'use strict';var _=require('lodash');var util=require(_0xe966('0x0'));var logger=require(_0xe966('0x1'))(_0xe966('0x2'));var moment=require('moment');var BPromise=require(_0xe966('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe966('0x4'));var rimraf=require(_0xe966('0x5'));var config=require('../../config/environment');var attributes=require(_0xe966('0x6'));module[_0xe966('0x7')]=function(_0x19127b,_0x1f0097){return _0x19127b[_0xe966('0x8')](_0xe966('0x9'),attributes,{'tableName':_0xe966('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdafb=['path','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c2320,_0x5aa6f1){var _0x402670=function(_0x1393dc){while(--_0x1393dc){_0x4c2320['push'](_0x4c2320['shift']());}};_0x402670(++_0x5aa6f1);}(_0xdafb,0x1a9));var _0xbdaf=function(_0x50ca75,_0x565f1f){_0x50ca75=_0x50ca75-0x0;var _0xc6640c=_0xdafb[_0x50ca75];return _0xc6640c;};'use strict';var _=require(_0xbdaf('0x0'));var util=require(_0xbdaf('0x1'));var logger=require(_0xbdaf('0x2'))(_0xbdaf('0x3'));var moment=require(_0xbdaf('0x4'));var BPromise=require(_0xbdaf('0x5'));var rp=require(_0xbdaf('0x6'));var fs=require('fs');var path=require(_0xbdaf('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0xbdaf('0x8')]=function(_0x3d1367,_0x52ecad){return _0x3d1367[_0xbdaf('0x9')](_0xbdaf('0xa'),attributes,{'tableName':_0xbdaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 6a1fc09..b50d511 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 _0x7ebf=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','lodash'];(function(_0x4b0066,_0x4177fb){var _0x4c7283=function(_0x5e6097){while(--_0x5e6097){_0x4b0066['push'](_0x4b0066['shift']());}};_0x4c7283(++_0x4177fb);}(_0x7ebf,0x153));var _0xf7eb=function(_0x32cae3,_0x3075fe){_0x32cae3=_0x32cae3-0x0;var _0x25526b=_0x7ebf[_0x32cae3];return _0x25526b;};'use strict';var _=require(_0xf7eb('0x0'));var util=require(_0xf7eb('0x1'));var moment=require('moment');var BPromise=require(_0xf7eb('0x2'));var rs=require(_0xf7eb('0x3'));var fs=require('fs');var Redis=require(_0xf7eb('0x4'));var db=require(_0xf7eb('0x5'))['db'];var utils=require(_0xf7eb('0x6'));var logger=require(_0xf7eb('0x7'))(_0xf7eb('0x8'));var config=require(_0xf7eb('0x9'));var jayson=require(_0xf7eb('0xa'));var client=jayson['client'][_0xf7eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf6433f,_0xc78635,_0x405abb){return new BPromise(function(_0x17b748,_0x436605){return client[_0xf7eb('0xc')](_0xf6433f,_0x405abb)[_0xf7eb('0xd')](function(_0x4a87a6){logger[_0xf7eb('0xe')](_0xf7eb('0xf'),_0xc78635,'request\x20sent');logger['debug'](_0xf7eb('0x10'),_0xc78635,'request\x20sent',JSON['stringify'](_0x4a87a6));if(_0x4a87a6[_0xf7eb('0x11')]){if(_0x4a87a6[_0xf7eb('0x11')]['code']===0x1f4){logger[_0xf7eb('0x11')](_0xf7eb('0xf'),_0xc78635,_0x4a87a6['error'][_0xf7eb('0x12')]);return _0x436605(_0x4a87a6['error']['message']);}logger[_0xf7eb('0x11')](_0xf7eb('0xf'),_0xc78635,_0x4a87a6['error'][_0xf7eb('0x12')]);return _0x17b748(_0x4a87a6['error']['message']);}else{logger[_0xf7eb('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xc78635,_0xf7eb('0x13'));_0x17b748(_0x4a87a6['result'][_0xf7eb('0x12')]);}})['catch'](function(_0x43ac61){logger['error'](_0xf7eb('0xf'),_0xc78635,_0x43ac61);_0x436605(_0x43ac61);});});} \ No newline at end of file +var _0xf643=['client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b4d08,_0x2dd246){var _0x15cd66=function(_0x5b9915){while(--_0x5b9915){_0x4b4d08['push'](_0x4b4d08['shift']());}};_0x15cd66(++_0x2dd246);}(_0xf643,0x122));var _0x3f64=function(_0x485c12,_0x63ee16){_0x485c12=_0x485c12-0x0;var _0x5c87ad=_0xf643[_0x485c12];return _0x5c87ad;};'use strict';var _=require(_0x3f64('0x0'));var util=require(_0x3f64('0x1'));var moment=require(_0x3f64('0x2'));var BPromise=require(_0x3f64('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f64('0x4'));var db=require(_0x3f64('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f64('0x6'))(_0x3f64('0x7'));var config=require(_0x3f64('0x8'));var jayson=require(_0x3f64('0x9'));var client=jayson[_0x3f64('0xa')][_0x3f64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dfeeb,_0x269d28,_0x40b245){return new BPromise(function(_0x2a7c90,_0x219dcb){return client[_0x3f64('0xc')](_0x2dfeeb,_0x40b245)[_0x3f64('0xd')](function(_0x268ef2){logger[_0x3f64('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x269d28,_0x3f64('0xf'));logger[_0x3f64('0x10')](_0x3f64('0x11'),_0x269d28,'request\x20sent',JSON[_0x3f64('0x12')](_0x268ef2));if(_0x268ef2[_0x3f64('0x13')]){if(_0x268ef2[_0x3f64('0x13')][_0x3f64('0x14')]===0x1f4){logger[_0x3f64('0x13')](_0x3f64('0x15'),_0x269d28,_0x268ef2[_0x3f64('0x13')][_0x3f64('0x16')]);return _0x219dcb(_0x268ef2[_0x3f64('0x13')][_0x3f64('0x16')]);}logger[_0x3f64('0x13')](_0x3f64('0x15'),_0x269d28,_0x268ef2['error'][_0x3f64('0x16')]);return _0x2a7c90(_0x268ef2[_0x3f64('0x13')][_0x3f64('0x16')]);}else{logger[_0x3f64('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x269d28,_0x3f64('0xf'));_0x2a7c90(_0x268ef2[_0x3f64('0x17')][_0x3f64('0x16')]);}})[_0x3f64('0x18')](function(_0x391c64){logger[_0x3f64('0x13')](_0x3f64('0x15'),_0x269d28,_0x391c64);_0x219dcb(_0x391c64);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 14b767e..2efd7f9 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 _0x2d6d=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy'];(function(_0x46b364,_0x825d71){var _0x4594d9=function(_0x187d24){while(--_0x187d24){_0x46b364['push'](_0x46b364['shift']());}};_0x4594d9(++_0x825d71);}(_0x2d6d,0x66));var _0xd2d6=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x2d6d[_0x3932eb];return _0x5316e5;};'use strict';var multer=require(_0xd2d6('0x0'));var util=require(_0xd2d6('0x1'));var path=require(_0xd2d6('0x2'));var timeout=require(_0xd2d6('0x3'));var express=require(_0xd2d6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd2d6('0x5'));var interaction=require(_0xd2d6('0x6'));var config=require(_0xd2d6('0x7'));var controller=require(_0xd2d6('0x8'));router[_0xd2d6('0x9')]('/',auth[_0xd2d6('0xa')](),controller[_0xd2d6('0xb')]);router[_0xd2d6('0x9')](_0xd2d6('0xc'),auth['isAuthenticated'](),controller[_0xd2d6('0xd')]);router['post']('/',auth[_0xd2d6('0xa')](),controller['create']);router['put'](_0xd2d6('0xc'),auth[_0xd2d6('0xa')](),controller[_0xd2d6('0xe')]);router[_0xd2d6('0xf')](_0xd2d6('0xc'),auth[_0xd2d6('0xa')](),controller[_0xd2d6('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9613=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','index','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x34a087,_0x4bd68e){var _0x5c15d7=function(_0x152823){while(--_0x152823){_0x34a087['push'](_0x34a087['shift']());}};_0x5c15d7(++_0x4bd68e);}(_0x9613,0x1c9));var _0x3961=function(_0x1ac9df,_0x4c9de2){_0x1ac9df=_0x1ac9df-0x0;var _0x288fb5=_0x9613[_0x1ac9df];return _0x288fb5;};'use strict';var multer=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var path=require(_0x3961('0x2'));var timeout=require(_0x3961('0x3'));var express=require('express');var router=express[_0x3961('0x4')]();var fs_extra=require(_0x3961('0x5'));var auth=require(_0x3961('0x6'));var interaction=require(_0x3961('0x7'));var config=require('../../config/environment');var controller=require(_0x3961('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3961('0x9')]);router[_0x3961('0xa')](_0x3961('0xb'),auth['isAuthenticated'](),controller[_0x3961('0xc')]);router['post']('/',auth[_0x3961('0xd')](),controller[_0x3961('0xe')]);router[_0x3961('0xf')](_0x3961('0xb'),auth['isAuthenticated'](),controller[_0x3961('0x10')]);router[_0x3961('0x11')]('/:id',auth[_0x3961('0xd')](),controller[_0x3961('0x12')]);module[_0x3961('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ea52449..5815ce3 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 _0x7436=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0xd25ea1,_0x3e971d){var _0x578265=function(_0x41515b){while(--_0x41515b){_0xd25ea1['push'](_0xd25ea1['shift']());}};_0x578265(++_0x3e971d);}(_0x7436,0x124));var _0x6743=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x7436[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require('sequelize');module[_0x6743('0x0')]={'type':{'type':Sequelize[_0x6743('0x1')](_0x6743('0x2'),_0x6743('0x3'),_0x6743('0x4'),_0x6743('0x5'),'picklist'),'defaultValue':_0x6743('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6743('0x1')]('string','variable',_0x6743('0x4'))},'keyContent':{'type':Sequelize[_0x6743('0x6')]},'idField':{'type':Sequelize[_0x6743('0x6')]},'nameField':{'type':Sequelize[_0x6743('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d73=['sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x2d1599,_0x19ba98){var _0x41156a=function(_0x4ae445){while(--_0x4ae445){_0x2d1599['push'](_0x2d1599['shift']());}};_0x41156a(++_0x19ba98);}(_0x5d73,0x110));var _0x35d7=function(_0x39e33f,_0x387613){_0x39e33f=_0x39e33f-0x0;var _0x179e27=_0x5d73[_0x39e33f];return _0x179e27;};'use strict';var Sequelize=require(_0x35d7('0x0'));module[_0x35d7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x35d7('0x2'),_0x35d7('0x3'),_0x35d7('0x4'),'keyValue',_0x35d7('0x5')),'defaultValue':_0x35d7('0x2')},'content':{'type':Sequelize[_0x35d7('0x6')]},'key':{'type':Sequelize[_0x35d7('0x6')]},'keyType':{'type':Sequelize[_0x35d7('0x7')]('string',_0x35d7('0x3'),_0x35d7('0x4'))},'keyContent':{'type':Sequelize[_0x35d7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x35d7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35d7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 709bae5..f9979b2 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 _0xeedb=['ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeedb,0x159));var _0xbeed=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xeedb[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xbeed('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbeed('0x1'));var jsonpatch=require(_0xbeed('0x2'));var rp=require(_0xbeed('0x3'));var moment=require(_0xbeed('0x4'));var BPromise=require(_0xbeed('0x5'));var Mustache=require(_0xbeed('0x6'));var util=require('util');var path=require(_0xbeed('0x7'));var sox=require(_0xbeed('0x8'));var csv=require(_0xbeed('0x9'));var ejs=require(_0xbeed('0xa'));var fs=require('fs');var fs_extra=require(_0xbeed('0xb'));var _=require('lodash');var squel=require(_0xbeed('0xc'));var crypto=require(_0xbeed('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbeed('0x9'));var querystring=require(_0xbeed('0xe'));var Papa=require(_0xbeed('0xf'));var Redis=require('ioredis');var authService=require(_0xbeed('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbeed('0x11'));var hardwareService=require(_0xbeed('0x12'));var logger=require(_0xbeed('0x13'))('api');var utils=require(_0xbeed('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34d612,_0x1ab954){_0x1ab954=_0x1ab954||0xcc;return function(_0x46a4c0){if(_0x46a4c0){return _0x34d612[_0xbeed('0x15')](_0x1ab954);}return _0x34d612[_0xbeed('0x16')](_0x1ab954)[_0xbeed('0x17')]();};}function respondWithResult(_0x2672eb,_0x151d76){_0x151d76=_0x151d76||0xc8;return function(_0x365817){if(_0x365817){return _0x2672eb[_0xbeed('0x16')](_0x151d76)[_0xbeed('0x18')](_0x365817);}};}function respondWithFilteredResult(_0xe760f3,_0x47be01){return function(_0x4a1649){if(_0x4a1649){var _0x258de0=typeof _0x47be01[_0xbeed('0x19')]==='undefined'&&typeof _0x47be01[_0xbeed('0x1a')]===_0xbeed('0x1b');var _0x16c684=_0x4a1649[_0xbeed('0x1c')];var _0x503dd8=_0x258de0?0x0:_0x47be01['offset'];var _0x4007ac=_0x258de0?_0x4a1649[_0xbeed('0x1c')]:_0x47be01['offset']+_0x47be01[_0xbeed('0x1a')];var _0x2d4123;if(_0x4007ac>=_0x16c684){_0x4007ac=_0x16c684;_0x2d4123=0xc8;}else{_0x2d4123=0xce;}_0xe760f3[_0xbeed('0x16')](_0x2d4123);return _0xe760f3['set'](_0xbeed('0x1d'),_0x503dd8+'-'+_0x4007ac+'/'+_0x16c684)[_0xbeed('0x18')](_0x4a1649);}return null;};}function patchUpdates(_0x2ccd9a){return function(_0x10a52c){try{jsonpatch[_0xbeed('0x1e')](_0x10a52c,_0x2ccd9a,!![]);}catch(_0x4fb196){return BPromise[_0xbeed('0x1f')](_0x4fb196);}return _0x10a52c[_0xbeed('0x20')]();};}function saveUpdates(_0x2d7f7e,_0x554424){return function(_0x4f0ffb){if(_0x4f0ffb){return _0x4f0ffb[_0xbeed('0x21')](_0x2d7f7e)[_0xbeed('0x22')](function(_0x20c299){return _0x20c299;});}return null;};}function removeEntity(_0x3154f8,_0x5d2129){return function(_0x2e1806){if(_0x2e1806){return _0x2e1806[_0xbeed('0x23')]()['then'](function(){_0x3154f8[_0xbeed('0x16')](0xcc)[_0xbeed('0x17')]();});}};}function handleEntityNotFound(_0x1fb547,_0x299e08){return function(_0x33ffe9){if(!_0x33ffe9){_0x1fb547[_0xbeed('0x15')](0x194);}return _0x33ffe9;};}function handleError(_0x11a2b1,_0x208ed8){_0x208ed8=_0x208ed8||0x1f4;return function(_0x3739d2){logger[_0xbeed('0x24')](_0x3739d2[_0xbeed('0x25')]);if(_0x3739d2[_0xbeed('0x26')]){delete _0x3739d2[_0xbeed('0x26')];}_0x11a2b1[_0xbeed('0x16')](_0x208ed8)[_0xbeed('0x27')](_0x3739d2);};}exports[_0xbeed('0x28')]=function(_0x13257f,_0x47f30d){var _0x571826={},_0x1da436={},_0x20f5e8={'count':0x0,'rows':[]};var _0x292863=_[_0xbeed('0x29')](db[_0xbeed('0x2a')][_0xbeed('0x2b')],function(_0x416420){return{'name':_0x416420['fieldName'],'type':_0x416420[_0xbeed('0x2c')][_0xbeed('0x2d')]};});_0x1da436[_0xbeed('0x2e')]=_[_0xbeed('0x29')](_0x292863,'name');_0x1da436[_0xbeed('0x2f')]=_[_0xbeed('0x30')](_0x13257f[_0xbeed('0x2f')]);_0x1da436[_0xbeed('0x31')]=_[_0xbeed('0x32')](_0x1da436[_0xbeed('0x2e')],_0x1da436['query']);_0x571826['attributes']=_['intersection'](_0x1da436[_0xbeed('0x2e')],qs[_0xbeed('0x33')](_0x13257f[_0xbeed('0x2f')]['fields']));_0x571826[_0xbeed('0x34')]=_0x571826[_0xbeed('0x34')][_0xbeed('0x35')]?_0x571826[_0xbeed('0x34')]:_0x1da436[_0xbeed('0x2e')];if(!_0x13257f['query']['hasOwnProperty'](_0xbeed('0x36'))){_0x571826[_0xbeed('0x1a')]=qs[_0xbeed('0x1a')](_0x13257f['query'][_0xbeed('0x1a')]);_0x571826[_0xbeed('0x19')]=qs[_0xbeed('0x19')](_0x13257f['query'][_0xbeed('0x19')]);}_0x571826[_0xbeed('0x37')]=qs[_0xbeed('0x38')](_0x13257f[_0xbeed('0x2f')][_0xbeed('0x38')]);_0x571826[_0xbeed('0x39')]=qs[_0xbeed('0x31')](_['pick'](_0x13257f['query'],_0x1da436[_0xbeed('0x31')]),_0x292863);if(_0x13257f['query']['filter']){_0x571826['where']=_[_0xbeed('0x3a')](_0x571826[_0xbeed('0x39')],{'$or':_[_0xbeed('0x29')](_0x292863,function(_0xfd4d5a){if(_0xfd4d5a[_0xbeed('0x2c')]!==_0xbeed('0x3b')){var _0xd8e0fc={};_0xd8e0fc[_0xfd4d5a[_0xbeed('0x26')]]={'$like':'%'+_0x13257f[_0xbeed('0x2f')][_0xbeed('0x3c')]+'%'};return _0xd8e0fc;}})});}_0x571826=_[_0xbeed('0x3a')]({},_0x571826,_0x13257f[_0xbeed('0x3d')]);var _0x54f5d9={'where':_0x571826['where']};return db[_0xbeed('0x2a')][_0xbeed('0x1c')](_0x54f5d9)['then'](function(_0x39514f){_0x20f5e8[_0xbeed('0x1c')]=_0x39514f;if(_0x13257f[_0xbeed('0x2f')]['includeAll']){_0x571826[_0xbeed('0x3e')]=[{'all':!![]}];}return db[_0xbeed('0x2a')][_0xbeed('0x3f')](_0x571826);})[_0xbeed('0x22')](function(_0x35e865){_0x20f5e8['rows']=_0x35e865;return _0x20f5e8;})['then'](respondWithFilteredResult(_0x47f30d,_0x571826))[_0xbeed('0x40')](handleError(_0x47f30d,null));};exports[_0xbeed('0x41')]=function(_0x50c57d,_0x4ae9bb){var _0x4f76b8={'raw':!![],'where':{'id':_0x50c57d['params']['id']}},_0x3d86e2={};_0x3d86e2['model']=_[_0xbeed('0x30')](db[_0xbeed('0x2a')][_0xbeed('0x2b')]);_0x3d86e2[_0xbeed('0x2f')]=_['keys'](_0x50c57d[_0xbeed('0x2f')]);_0x3d86e2['filters']=_[_0xbeed('0x32')](_0x3d86e2[_0xbeed('0x2e')],_0x3d86e2[_0xbeed('0x2f')]);_0x4f76b8[_0xbeed('0x34')]=_['intersection'](_0x3d86e2['model'],qs[_0xbeed('0x33')](_0x50c57d[_0xbeed('0x2f')]['fields']));_0x4f76b8['attributes']=_0x4f76b8[_0xbeed('0x34')][_0xbeed('0x35')]?_0x4f76b8['attributes']:_0x3d86e2[_0xbeed('0x2e')];if(_0x50c57d[_0xbeed('0x2f')][_0xbeed('0x42')]){_0x4f76b8[_0xbeed('0x3e')]=[{'all':!![]}];}_0x4f76b8=_[_0xbeed('0x3a')]({},_0x4f76b8,_0x50c57d[_0xbeed('0x3d')]);return db[_0xbeed('0x2a')][_0xbeed('0x43')](_0x4f76b8)['then'](handleEntityNotFound(_0x4ae9bb,null))[_0xbeed('0x22')](respondWithResult(_0x4ae9bb,null))['catch'](handleError(_0x4ae9bb,null));};exports[_0xbeed('0x44')]=function(_0x35f240,_0x86b3c8){return db['DeskField'][_0xbeed('0x44')](_0x35f240[_0xbeed('0x45')],{})[_0xbeed('0x22')](respondWithResult(_0x86b3c8,0xc9))['catch'](handleError(_0x86b3c8,null));};exports[_0xbeed('0x21')]=function(_0x20ab96,_0x2f750f){if(_0x20ab96[_0xbeed('0x45')]['id']){delete _0x20ab96[_0xbeed('0x45')]['id'];}return db[_0xbeed('0x2a')]['find']({'where':{'id':_0x20ab96[_0xbeed('0x46')]['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x2f750f,null))['then'](saveUpdates(_0x20ab96[_0xbeed('0x45')],null))['then'](respondWithResult(_0x2f750f,null))[_0xbeed('0x40')](handleError(_0x2f750f,null));};exports[_0xbeed('0x23')]=function(_0x1bffeb,_0x5541c5){return db['DeskField']['find']({'where':{'id':_0x1bffeb[_0xbeed('0x46')]['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x5541c5,null))[_0xbeed('0x22')](removeEntity(_0x5541c5,null))['catch'](handleError(_0x5541c5,null));}; \ No newline at end of file +var _0x047e=['papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','attributes','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x047e,0x121));var _0xe047=function(_0x4d899f,_0x183cc8){_0x4d899f=_0x4d899f-0x0;var _0x2dc49b=_0x047e[_0x4d899f];return _0x2dc49b;};'use strict';var emlformat=require(_0xe047('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe047('0x1'));var jsonpatch=require(_0xe047('0x2'));var rp=require(_0xe047('0x3'));var moment=require(_0xe047('0x4'));var BPromise=require(_0xe047('0x5'));var Mustache=require('mustache');var util=require(_0xe047('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe047('0x7'));var fs=require('fs');var fs_extra=require(_0xe047('0x8'));var _=require('lodash');var squel=require(_0xe047('0x9'));var crypto=require(_0xe047('0xa'));var jsforce=require(_0xe047('0xb'));var deskjs=require(_0xe047('0xc'));var toCsv=require(_0xe047('0xd'));var querystring=require(_0xe047('0xe'));var Papa=require(_0xe047('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe047('0x10'));var hardwareService=require(_0xe047('0x11'));var logger=require(_0xe047('0x12'))(_0xe047('0x13'));var utils=require(_0xe047('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe047('0x15'));var db=require(_0xe047('0x16'))['db'];function respondWithStatusCode(_0x312490,_0x361af7){_0x361af7=_0x361af7||0xcc;return function(_0x547a82){if(_0x547a82){return _0x312490[_0xe047('0x17')](_0x361af7);}return _0x312490['status'](_0x361af7)[_0xe047('0x18')]();};}function respondWithResult(_0x181def,_0x6efff9){_0x6efff9=_0x6efff9||0xc8;return function(_0x1f0389){if(_0x1f0389){return _0x181def['status'](_0x6efff9)[_0xe047('0x19')](_0x1f0389);}};}function respondWithFilteredResult(_0x36e7ef,_0x6e1c7c){return function(_0x198dfe){if(_0x198dfe){var _0x519a87=typeof _0x6e1c7c[_0xe047('0x1a')]===_0xe047('0x1b')&&typeof _0x6e1c7c[_0xe047('0x1c')]==='undefined';var _0x47da67=_0x198dfe['count'];var _0x34e968=_0x519a87?0x0:_0x6e1c7c['offset'];var _0x467dcb=_0x519a87?_0x198dfe['count']:_0x6e1c7c[_0xe047('0x1a')]+_0x6e1c7c[_0xe047('0x1c')];var _0x5b3f49;if(_0x467dcb>=_0x47da67){_0x467dcb=_0x47da67;_0x5b3f49=0xc8;}else{_0x5b3f49=0xce;}_0x36e7ef[_0xe047('0x1d')](_0x5b3f49);return _0x36e7ef[_0xe047('0x1e')](_0xe047('0x1f'),_0x34e968+'-'+_0x467dcb+'/'+_0x47da67)[_0xe047('0x19')](_0x198dfe);}return null;};}function patchUpdates(_0x1d3b20){return function(_0x21cd7f){try{jsonpatch[_0xe047('0x20')](_0x21cd7f,_0x1d3b20,!![]);}catch(_0x14a339){return BPromise[_0xe047('0x21')](_0x14a339);}return _0x21cd7f[_0xe047('0x22')]();};}function saveUpdates(_0x5a15c8,_0x4c564a){return function(_0x3461fa){if(_0x3461fa){return _0x3461fa[_0xe047('0x23')](_0x5a15c8)[_0xe047('0x24')](function(_0x5294f5){return _0x5294f5;});}return null;};}function removeEntity(_0x5c35ee,_0x249480){return function(_0x3014c4){if(_0x3014c4){return _0x3014c4[_0xe047('0x25')]()[_0xe047('0x24')](function(){_0x5c35ee[_0xe047('0x1d')](0xcc)[_0xe047('0x18')]();});}};}function handleEntityNotFound(_0x3c0919,_0x5eed16){return function(_0x57f73e){if(!_0x57f73e){_0x3c0919[_0xe047('0x17')](0x194);}return _0x57f73e;};}function handleError(_0x3f4aa4,_0x490ca0){_0x490ca0=_0x490ca0||0x1f4;return function(_0x506d3e){logger[_0xe047('0x26')](_0x506d3e[_0xe047('0x27')]);if(_0x506d3e[_0xe047('0x28')]){delete _0x506d3e['name'];}_0x3f4aa4[_0xe047('0x1d')](_0x490ca0)[_0xe047('0x29')](_0x506d3e);};}exports[_0xe047('0x2a')]=function(_0x5c2c36,_0x4d057d){var _0x5e71d5={},_0x3a21d5={},_0x3cdfc9={'count':0x0,'rows':[]};var _0x8a804=_[_0xe047('0x2b')](db[_0xe047('0x2c')][_0xe047('0x2d')],function(_0x382eb1){return{'name':_0x382eb1[_0xe047('0x2e')],'type':_0x382eb1[_0xe047('0x2f')][_0xe047('0x30')]};});_0x3a21d5['model']=_[_0xe047('0x2b')](_0x8a804,_0xe047('0x28'));_0x3a21d5['query']=_[_0xe047('0x31')](_0x5c2c36[_0xe047('0x32')]);_0x3a21d5['filters']=_[_0xe047('0x33')](_0x3a21d5['model'],_0x3a21d5[_0xe047('0x32')]);_0x5e71d5['attributes']=_['intersection'](_0x3a21d5[_0xe047('0x34')],qs[_0xe047('0x35')](_0x5c2c36[_0xe047('0x32')][_0xe047('0x35')]));_0x5e71d5['attributes']=_0x5e71d5['attributes'][_0xe047('0x36')]?_0x5e71d5['attributes']:_0x3a21d5['model'];if(!_0x5c2c36['query'][_0xe047('0x37')]('nolimit')){_0x5e71d5[_0xe047('0x1c')]=qs['limit'](_0x5c2c36[_0xe047('0x32')][_0xe047('0x1c')]);_0x5e71d5[_0xe047('0x1a')]=qs[_0xe047('0x1a')](_0x5c2c36[_0xe047('0x32')][_0xe047('0x1a')]);}_0x5e71d5[_0xe047('0x38')]=qs[_0xe047('0x39')](_0x5c2c36['query']['sort']);_0x5e71d5[_0xe047('0x3a')]=qs[_0xe047('0x3b')](_[_0xe047('0x3c')](_0x5c2c36['query'],_0x3a21d5[_0xe047('0x3b')]),_0x8a804);if(_0x5c2c36[_0xe047('0x32')][_0xe047('0x3d')]){_0x5e71d5[_0xe047('0x3a')]=_[_0xe047('0x3e')](_0x5e71d5['where'],{'$or':_[_0xe047('0x2b')](_0x8a804,function(_0x5a6c8d){if(_0x5a6c8d[_0xe047('0x2f')]!=='VIRTUAL'){var _0x51ea84={};_0x51ea84[_0x5a6c8d[_0xe047('0x28')]]={'$like':'%'+_0x5c2c36['query']['filter']+'%'};return _0x51ea84;}})});}_0x5e71d5=_['merge']({},_0x5e71d5,_0x5c2c36[_0xe047('0x3f')]);var _0x38e7ff={'where':_0x5e71d5['where']};return db[_0xe047('0x2c')][_0xe047('0x40')](_0x38e7ff)[_0xe047('0x24')](function(_0x4044f4){_0x3cdfc9[_0xe047('0x40')]=_0x4044f4;if(_0x5c2c36[_0xe047('0x32')][_0xe047('0x41')]){_0x5e71d5[_0xe047('0x42')]=[{'all':!![]}];}return db[_0xe047('0x2c')][_0xe047('0x43')](_0x5e71d5);})[_0xe047('0x24')](function(_0x1e4e47){_0x3cdfc9[_0xe047('0x44')]=_0x1e4e47;return _0x3cdfc9;})[_0xe047('0x24')](respondWithFilteredResult(_0x4d057d,_0x5e71d5))[_0xe047('0x45')](handleError(_0x4d057d,null));};exports[_0xe047('0x46')]=function(_0x5cb9f3,_0x19ad4b){var _0x4f1d58={'raw':!![],'where':{'id':_0x5cb9f3[_0xe047('0x47')]['id']}},_0xbe9eca={};_0xbe9eca[_0xe047('0x34')]=_[_0xe047('0x31')](db['DeskField'][_0xe047('0x2d')]);_0xbe9eca['query']=_[_0xe047('0x31')](_0x5cb9f3[_0xe047('0x32')]);_0xbe9eca[_0xe047('0x3b')]=_[_0xe047('0x33')](_0xbe9eca[_0xe047('0x34')],_0xbe9eca[_0xe047('0x32')]);_0x4f1d58[_0xe047('0x48')]=_[_0xe047('0x33')](_0xbe9eca[_0xe047('0x34')],qs[_0xe047('0x35')](_0x5cb9f3[_0xe047('0x32')]['fields']));_0x4f1d58[_0xe047('0x48')]=_0x4f1d58[_0xe047('0x48')]['length']?_0x4f1d58['attributes']:_0xbe9eca[_0xe047('0x34')];if(_0x5cb9f3['query'][_0xe047('0x41')]){_0x4f1d58[_0xe047('0x42')]=[{'all':!![]}];}_0x4f1d58=_[_0xe047('0x3e')]({},_0x4f1d58,_0x5cb9f3[_0xe047('0x3f')]);return db['DeskField']['find'](_0x4f1d58)[_0xe047('0x24')](handleEntityNotFound(_0x19ad4b,null))['then'](respondWithResult(_0x19ad4b,null))[_0xe047('0x45')](handleError(_0x19ad4b,null));};exports[_0xe047('0x49')]=function(_0x2448fb,_0x2721d1){return db['DeskField'][_0xe047('0x49')](_0x2448fb[_0xe047('0x4a')],{})['then'](respondWithResult(_0x2721d1,0xc9))[_0xe047('0x45')](handleError(_0x2721d1,null));};exports['update']=function(_0xe898ed,_0x93dca4){if(_0xe898ed[_0xe047('0x4a')]['id']){delete _0xe898ed['body']['id'];}return db['DeskField'][_0xe047('0x4b')]({'where':{'id':_0xe898ed[_0xe047('0x47')]['id']}})['then'](handleEntityNotFound(_0x93dca4,null))[_0xe047('0x24')](saveUpdates(_0xe898ed[_0xe047('0x4a')],null))[_0xe047('0x24')](respondWithResult(_0x93dca4,null))['catch'](handleError(_0x93dca4,null));};exports[_0xe047('0x25')]=function(_0x11b18a,_0x50c278){return db['DeskField']['find']({'where':{'id':_0x11b18a[_0xe047('0x47')]['id']}})[_0xe047('0x24')](handleEntityNotFound(_0x50c278,null))[_0xe047('0x24')](removeEntity(_0x50c278,null))[_0xe047('0x45')](handleError(_0x50c278,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 9e23287..3a64bf7 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 _0x588b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','idField','FieldId'];(function(_0x36e607,_0x3d8c6c){var _0xb4e260=function(_0x5e96e6){while(--_0x5e96e6){_0x36e607['push'](_0x36e607['shift']());}};_0xb4e260(++_0x3d8c6c);}(_0x588b,0x10a));var _0xb588=function(_0x558796,_0x52a187){_0x558796=_0x558796-0x0;var _0x52dcee=_0x588b[_0x558796];return _0x52dcee;};'use strict';var _=require(_0xb588('0x0'));var util=require('util');var logger=require(_0xb588('0x1'))(_0xb588('0x2'));var moment=require(_0xb588('0x3'));var BPromise=require(_0xb588('0x4'));var rp=require(_0xb588('0x5'));var fs=require('fs');var path=require(_0xb588('0x6'));var rimraf=require(_0xb588('0x7'));var config=require(_0xb588('0x8'));var attributes=require(_0xb588('0x9'));module['exports']=function(_0x390310,_0x4d1876){return _0x390310[_0xb588('0xa')](_0xb588('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xb588('0xc'),_0xb588('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cb1=['../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x9cb1,0x84));var _0x19cb=function(_0x2dd7da,_0x2b725a){_0x2dd7da=_0x2dd7da-0x0;var _0x1ad519=_0x9cb1[_0x2dd7da];return _0x1ad519;};'use strict';var _=require(_0x19cb('0x0'));var util=require(_0x19cb('0x1'));var logger=require(_0x19cb('0x2'))(_0x19cb('0x3'));var moment=require(_0x19cb('0x4'));var BPromise=require('bluebird');var rp=require(_0x19cb('0x5'));var fs=require('fs');var path=require(_0x19cb('0x6'));var rimraf=require(_0x19cb('0x7'));var config=require(_0x19cb('0x8'));var attributes=require(_0x19cb('0x9'));module['exports']=function(_0x2a32d4,_0x43fdad){return _0x2a32d4['define'](_0x19cb('0xa'),attributes,{'tableName':_0x19cb('0xb'),'paranoid':![],'indexes':[{'name':_0x19cb('0xc'),'fields':[_0x19cb('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index c2e99a9..c9dbbb4 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 _0xa7a1=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','ioredis','../../mysqldb'];(function(_0x466c5f,_0x12b2ac){var _0x3267b7=function(_0x384590){while(--_0x384590){_0x466c5f['push'](_0x466c5f['shift']());}};_0x3267b7(++_0x12b2ac);}(_0xa7a1,0x122));var _0x1a7a=function(_0x3d1672,_0x25ffe4){_0x3d1672=_0x3d1672-0x0;var _0x1f014e=_0xa7a1[_0x3d1672];return _0x1f014e;};'use strict';var _=require(_0x1a7a('0x0'));var util=require(_0x1a7a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a7a('0x2'));var db=require(_0x1a7a('0x3'))['db'];var utils=require(_0x1a7a('0x4'));var logger=require('../../config/logger')(_0x1a7a('0x5'));var config=require(_0x1a7a('0x6'));var jayson=require(_0x1a7a('0x7'));var client=jayson[_0x1a7a('0x8')][_0x1a7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593341,_0x17caed,_0x55b4ee){return new BPromise(function(_0x2f940f,_0x732f44){return client[_0x1a7a('0xa')](_0x593341,_0x55b4ee)[_0x1a7a('0xb')](function(_0x3ed760){logger[_0x1a7a('0xc')](_0x1a7a('0xd'),_0x17caed,_0x1a7a('0xe'));logger[_0x1a7a('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x17caed,_0x1a7a('0xe'),JSON[_0x1a7a('0x10')](_0x3ed760));if(_0x3ed760[_0x1a7a('0x11')]){if(_0x3ed760[_0x1a7a('0x11')][_0x1a7a('0x12')]===0x1f4){logger[_0x1a7a('0x11')](_0x1a7a('0xd'),_0x17caed,_0x3ed760['error']['message']);return _0x732f44(_0x3ed760[_0x1a7a('0x11')][_0x1a7a('0x13')]);}logger[_0x1a7a('0x11')](_0x1a7a('0xd'),_0x17caed,_0x3ed760['error'][_0x1a7a('0x13')]);return _0x2f940f(_0x3ed760[_0x1a7a('0x11')][_0x1a7a('0x13')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x17caed,_0x1a7a('0xe'));_0x2f940f(_0x3ed760['result'][_0x1a7a('0x13')]);}})[_0x1a7a('0x14')](function(_0x1c6514){logger[_0x1a7a('0x11')](_0x1a7a('0xd'),_0x17caed,_0x1c6514);_0x732f44(_0x1c6514);});});} \ No newline at end of file +var _0x91d9=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x627786,_0x39f303){var _0x31d60b=function(_0x4af079){while(--_0x4af079){_0x627786['push'](_0x627786['shift']());}};_0x31d60b(++_0x39f303);}(_0x91d9,0x140));var _0x991d=function(_0x8fb248,_0x27e49f){_0x8fb248=_0x8fb248-0x0;var _0x37eb40=_0x91d9[_0x8fb248];return _0x37eb40;};'use strict';var _=require(_0x991d('0x0'));var util=require(_0x991d('0x1'));var moment=require(_0x991d('0x2'));var BPromise=require(_0x991d('0x3'));var rs=require(_0x991d('0x4'));var fs=require('fs');var Redis=require(_0x991d('0x5'));var db=require(_0x991d('0x6'))['db'];var utils=require(_0x991d('0x7'));var logger=require(_0x991d('0x8'))(_0x991d('0x9'));var config=require('../../config/environment');var jayson=require(_0x991d('0xa'));var client=jayson['client'][_0x991d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x420e0d,_0x377d21,_0x53563c){return new BPromise(function(_0x512172,_0x7b6faf){return client[_0x991d('0xc')](_0x420e0d,_0x53563c)[_0x991d('0xd')](function(_0x2500a4){logger[_0x991d('0xe')]('DeskField,\x20%s,\x20%s',_0x377d21,_0x991d('0xf'));logger[_0x991d('0x10')](_0x991d('0x11'),_0x377d21,_0x991d('0xf'),JSON[_0x991d('0x12')](_0x2500a4));if(_0x2500a4[_0x991d('0x13')]){if(_0x2500a4['error']['code']===0x1f4){logger[_0x991d('0x13')]('DeskField,\x20%s,\x20%s',_0x377d21,_0x2500a4[_0x991d('0x13')]['message']);return _0x7b6faf(_0x2500a4[_0x991d('0x13')][_0x991d('0x14')]);}logger['error'](_0x991d('0x15'),_0x377d21,_0x2500a4['error']['message']);return _0x512172(_0x2500a4[_0x991d('0x13')]['message']);}else{logger[_0x991d('0xe')](_0x991d('0x15'),_0x377d21,_0x991d('0xf'));_0x512172(_0x2500a4[_0x991d('0x16')][_0x991d('0x14')]);}})[_0x991d('0x17')](function(_0x4a4ce0){logger[_0x991d('0x13')]('DeskField,\x20%s,\x20%s',_0x377d21,_0x4a4ce0);_0x7b6faf(_0x4a4ce0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 689873f..2f3d797 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 _0x0642=['/:id','show','getConfigurations','/:id/fields','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0642,0x136));var _0x2064=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x0642[_0x555b2f];return _0x81c0a6;};'use strict';var multer=require(_0x2064('0x0'));var util=require('util');var path=require(_0x2064('0x1'));var timeout=require(_0x2064('0x2'));var express=require(_0x2064('0x3'));var router=express[_0x2064('0x4')]();var fs_extra=require(_0x2064('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2064('0x6'));var config=require(_0x2064('0x7'));var controller=require(_0x2064('0x8'));router['get']('/',auth[_0x2064('0x9')](),controller[_0x2064('0xa')]);router[_0x2064('0xb')](_0x2064('0xc'),auth[_0x2064('0x9')](),controller[_0x2064('0xd')]);router[_0x2064('0xb')]('/:id/configurations',auth[_0x2064('0x9')](),controller[_0x2064('0xe')]);router[_0x2064('0xb')](_0x2064('0xf'),auth[_0x2064('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x2064('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x2064('0x11')]);router[_0x2064('0x12')](_0x2064('0xc'),auth['isAuthenticated'](),controller[_0x2064('0x13')]);router[_0x2064('0x14')](_0x2064('0xc'),auth[_0x2064('0x9')](),controller[_0x2064('0x15')]);module[_0x2064('0x16')]=router; \ No newline at end of file +var _0x3540=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','create','post'];(function(_0x2151bf,_0x36921b){var _0x573ed3=function(_0x570fa1){while(--_0x570fa1){_0x2151bf['push'](_0x2151bf['shift']());}};_0x573ed3(++_0x36921b);}(_0x3540,0x11c));var _0x0354=function(_0x569744,_0x30c532){_0x569744=_0x569744-0x0;var _0x57e918=_0x3540[_0x569744];return _0x57e918;};'use strict';var multer=require(_0x0354('0x0'));var util=require('util');var path=require(_0x0354('0x1'));var timeout=require(_0x0354('0x2'));var express=require(_0x0354('0x3'));var router=express[_0x0354('0x4')]();var fs_extra=require(_0x0354('0x5'));var auth=require(_0x0354('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0x0354('0x7')]('/',auth['isAuthenticated'](),controller[_0x0354('0x8')]);router[_0x0354('0x7')](_0x0354('0x9'),auth[_0x0354('0xa')](),controller[_0x0354('0xb')]);router[_0x0354('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x0354('0xc'),auth['isAuthenticated'](),controller[_0x0354('0xd')]);router['post']('/',auth[_0x0354('0xa')](),controller[_0x0354('0xe')]);router[_0x0354('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0354('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0354('0x11')]);router[_0x0354('0x12')]('/:id',auth[_0x0354('0xa')](),controller[_0x0354('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a8ae2b3..948a521 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 _0xec46=['sequelize','exports','STRING','BOOLEAN'];(function(_0xc2ecb,_0xb10c7e){var _0x476d8e=function(_0x3600f9){while(--_0x3600f9){_0xc2ecb['push'](_0xc2ecb['shift']());}};_0x476d8e(++_0xb10c7e);}(_0xec46,0x19c));var _0x6ec4=function(_0x28e854,_0x283f50){_0x28e854=_0x28e854-0x0;var _0x158a4b=_0xec46[_0x28e854];return _0x158a4b;};'use strict';var Sequelize=require(_0x6ec4('0x0'));module[_0x6ec4('0x1')]={'name':{'type':Sequelize[_0x6ec4('0x2')]},'username':{'type':Sequelize[_0x6ec4('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x6ec4('0x2')]},'clientId':{'type':Sequelize[_0x6ec4('0x2')]},'clientSecret':{'type':Sequelize[_0x6ec4('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6ec4('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6ec4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd8fb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x528655,_0x507bc0){var _0x4b9b5a=function(_0x257614){while(--_0x257614){_0x528655['push'](_0x528655['shift']());}};_0x4b9b5a(++_0x507bc0);}(_0xd8fb,0x99));var _0xbd8f=function(_0xdae5cd,_0x46f942){_0xdae5cd=_0xdae5cd-0x0;var _0x48cc99=_0xd8fb[_0xdae5cd];return _0x48cc99;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')]},'username':{'type':Sequelize[_0xbd8f('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd8f('0x2')]},'clientSecret':{'type':Sequelize[_0xbd8f('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'modernAuthentication':{'type':Sequelize[_0xbd8f('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 b90fbe5..374422d 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 _0x99dc=['fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','Dynamics365Account','findAll','rows','catch','show','params','include','find','create','body','findOne','Dynamics365Configuration','order','getConfigurations','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','getFields','ticketType','incident','PhoneCall','title','ownerid','subject','regardingobjectid','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','data5','data7','CloudProvider','https://login.microsoftonline.com/','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','MetadataId','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all','statusCode','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes'];(function(_0x367385,_0x1f9e55){var _0x3c0351=function(_0x397a28){while(--_0x397a28){_0x367385['push'](_0x367385['shift']());}};_0x3c0351(++_0x1f9e55);}(_0x99dc,0xa2));var _0xc99d=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x99dc[_0xcfc44];return _0x307a25;};'use strict';var rp=require(_0xc99d('0x0'));var util=require(_0xc99d('0x1'));var _=require(_0xc99d('0x2'));var qs=require(_0xc99d('0x3'));var logger=require(_0xc99d('0x4'))(_0xc99d('0x5'));var db=require(_0xc99d('0x6'))['db'];var integrations=require(_0xc99d('0x7'));function respondWithResult(_0x4913cf,_0x287aac){_0x287aac=_0x287aac||0xc8;return function(_0x1a1f48){if(_0x1a1f48){return _0x4913cf[_0xc99d('0x8')](_0x287aac)[_0xc99d('0x9')](_0x1a1f48);}};}function respondWithFilteredResult(_0x2734ce,_0x4f508f){return function(_0x4c4728){if(_0x4c4728){var _0x4c594b=typeof _0x4f508f[_0xc99d('0xa')]==='undefined'&&typeof _0x4f508f[_0xc99d('0xb')]===_0xc99d('0xc');var _0x267512=_0x4c4728[_0xc99d('0xd')];var _0x3cc80b=_0x4c594b?0x0:_0x4f508f[_0xc99d('0xa')];var _0x5633b8=_0x4c594b?_0x4c4728['count']:_0x4f508f[_0xc99d('0xa')]+_0x4f508f[_0xc99d('0xb')];var _0x1f5494;if(_0x5633b8>=_0x267512){_0x5633b8=_0x267512;_0x1f5494=0xc8;}else{_0x1f5494=0xce;}_0x2734ce[_0xc99d('0x8')](_0x1f5494);return _0x2734ce[_0xc99d('0xe')](_0xc99d('0xf'),_0x3cc80b+'-'+_0x5633b8+'/'+_0x267512)[_0xc99d('0x9')](_0x4c4728);}return null;};}function saveUpdates(_0x43a912){return function(_0x3d1d0a){if(_0x3d1d0a){return _0x3d1d0a[_0xc99d('0x10')](_0x43a912)[_0xc99d('0x11')](function(_0x5c45af){return _0x5c45af;});}return null;};}function removeEntity(_0x1f29e0){return function(_0x2a8dfe){if(_0x2a8dfe){return _0x2a8dfe[_0xc99d('0x12')]()['then'](function(){_0x1f29e0[_0xc99d('0x8')](0xcc)[_0xc99d('0x13')]();});}};}function handleEntityNotFound(_0x57143b){return function(_0x32bd1e){if(!_0x32bd1e){_0x57143b[_0xc99d('0x14')](0x194);}return _0x32bd1e;};}function handleError(_0x4f90d1,_0x24bda0){_0x24bda0=_0x24bda0||0x1f4;return function(_0xc90fb3){logger[_0xc99d('0x15')](_0xc90fb3[_0xc99d('0x16')]);if(_0xc90fb3[_0xc99d('0x17')]){delete _0xc90fb3[_0xc99d('0x17')];}_0x4f90d1[_0xc99d('0x8')](_0x24bda0)[_0xc99d('0x18')](_0xc90fb3);};}exports[_0xc99d('0x19')]=function(_0x56d3e8,_0x57a797){var _0x4cf7f5={},_0x100a35={},_0x56ecd7={'count':0x0,'rows':[]};var _0x56b36b=_['map'](db['Dynamics365Account'][_0xc99d('0x1a')],function(_0x7dfcbf){return{'name':_0x7dfcbf[_0xc99d('0x1b')],'type':_0x7dfcbf[_0xc99d('0x1c')]['key']};});_0x100a35[_0xc99d('0x1d')]=_[_0xc99d('0x1e')](_0x56b36b,_0xc99d('0x17'));_0x100a35[_0xc99d('0x1f')]=_[_0xc99d('0x20')](_0x56d3e8[_0xc99d('0x1f')]);_0x100a35[_0xc99d('0x21')]=_['intersection'](_0x100a35[_0xc99d('0x1d')],_0x100a35['query']);_0x4cf7f5[_0xc99d('0x22')]=_[_0xc99d('0x23')](_0x100a35['model'],qs[_0xc99d('0x24')](_0x56d3e8[_0xc99d('0x1f')][_0xc99d('0x24')]));_0x4cf7f5[_0xc99d('0x22')]=_0x4cf7f5[_0xc99d('0x22')][_0xc99d('0x25')]?_0x4cf7f5[_0xc99d('0x22')]:_0x100a35['model'];if(!_0x56d3e8[_0xc99d('0x1f')][_0xc99d('0x26')](_0xc99d('0x27'))){_0x4cf7f5['limit']=qs[_0xc99d('0xb')](_0x56d3e8[_0xc99d('0x1f')][_0xc99d('0xb')]);_0x4cf7f5[_0xc99d('0xa')]=qs[_0xc99d('0xa')](_0x56d3e8[_0xc99d('0x1f')]['offset']);}_0x4cf7f5['order']=qs[_0xc99d('0x28')](_0x56d3e8[_0xc99d('0x1f')]['sort']);_0x4cf7f5['where']=qs[_0xc99d('0x21')](_[_0xc99d('0x29')](_0x56d3e8[_0xc99d('0x1f')],_0x100a35[_0xc99d('0x21')]),_0x56b36b);if(_0x56d3e8[_0xc99d('0x1f')][_0xc99d('0x2a')]){_0x4cf7f5['where']=_[_0xc99d('0x2b')](_0x4cf7f5[_0xc99d('0x2c')],{'$or':_[_0xc99d('0x1e')](_0x56b36b,function(_0x35b1b2){if(_0x35b1b2['type']!=='VIRTUAL'){var _0x15b4ec={};_0x15b4ec[_0x35b1b2[_0xc99d('0x17')]]={'$like':'%'+_0x56d3e8[_0xc99d('0x1f')]['filter']+'%'};return _0x15b4ec;}})});}_0x4cf7f5=_[_0xc99d('0x2b')]({},_0x4cf7f5,_0x56d3e8[_0xc99d('0x2d')]);var _0x2df996={'where':_0x4cf7f5[_0xc99d('0x2c')]};return db['Dynamics365Account'][_0xc99d('0xd')](_0x2df996)['then'](function(_0x1f1059){_0x56ecd7['count']=_0x1f1059;if(_0x56d3e8['query'][_0xc99d('0x2e')]){_0x4cf7f5['include']=[{'all':!![]}];}return db[_0xc99d('0x2f')][_0xc99d('0x30')](_0x4cf7f5);})[_0xc99d('0x11')](function(_0x530c4b){_0x56ecd7[_0xc99d('0x31')]=_0x530c4b;return _0x56ecd7;})['then'](respondWithFilteredResult(_0x57a797,_0x4cf7f5))[_0xc99d('0x32')](handleError(_0x57a797,null));};exports[_0xc99d('0x33')]=function(_0x12ba9a,_0x475053){var _0x47f22c={'raw':![],'where':{'id':_0x12ba9a[_0xc99d('0x34')]['id']}},_0x2a649f={};_0x2a649f['model']=_[_0xc99d('0x20')](db[_0xc99d('0x2f')][_0xc99d('0x1a')]);_0x2a649f[_0xc99d('0x1f')]=_[_0xc99d('0x20')](_0x12ba9a[_0xc99d('0x1f')]);_0x2a649f['filters']=_[_0xc99d('0x23')](_0x2a649f['model'],_0x2a649f[_0xc99d('0x1f')]);_0x47f22c[_0xc99d('0x22')]=_[_0xc99d('0x23')](_0x2a649f[_0xc99d('0x1d')],qs[_0xc99d('0x24')](_0x12ba9a[_0xc99d('0x1f')]['fields']));_0x47f22c[_0xc99d('0x22')]=_0x47f22c[_0xc99d('0x22')][_0xc99d('0x25')]?_0x47f22c[_0xc99d('0x22')]:_0x2a649f[_0xc99d('0x1d')];if(_0x12ba9a['query'][_0xc99d('0x2e')]){_0x47f22c[_0xc99d('0x35')]=[{'all':!![]}];}_0x47f22c=_['merge']({},_0x47f22c,_0x12ba9a[_0xc99d('0x2d')]);return db[_0xc99d('0x2f')][_0xc99d('0x36')](_0x47f22c)[_0xc99d('0x11')](handleEntityNotFound(_0x475053,null))[_0xc99d('0x11')](respondWithResult(_0x475053,null))[_0xc99d('0x32')](handleError(_0x475053,null));};exports[_0xc99d('0x37')]=function(_0x12b7af,_0x525106){return db[_0xc99d('0x2f')][_0xc99d('0x37')](_0x12b7af[_0xc99d('0x38')],{})['then'](respondWithResult(_0x525106,0xc9))[_0xc99d('0x32')](handleError(_0x525106,null));};exports['update']=function(_0x58bb85,_0x55c381){if(_0x58bb85[_0xc99d('0x38')]['id']){delete _0x58bb85[_0xc99d('0x38')]['id'];}return db[_0xc99d('0x2f')]['find']({'where':{'id':_0x58bb85[_0xc99d('0x34')]['id']}})[_0xc99d('0x11')](handleEntityNotFound(_0x55c381,null))[_0xc99d('0x11')](saveUpdates(_0x58bb85[_0xc99d('0x38')],null))['then'](respondWithResult(_0x55c381,null))[_0xc99d('0x32')](handleError(_0x55c381,null));};exports[_0xc99d('0x12')]=function(_0x5a3f58,_0x11a3c2){return db['Dynamics365Account']['find']({'where':{'id':_0x5a3f58[_0xc99d('0x34')]['id']}})[_0xc99d('0x11')](handleEntityNotFound(_0x11a3c2,null))['then'](removeEntity(_0x11a3c2,null))[_0xc99d('0x32')](handleError(_0x11a3c2,null));};exports['getConfigurations']=function(_0x3bc7dd,_0x4920d1){var _0x3ab1bf={};var _0x9967e2={};var _0x3d4152;var _0x954f85;return db['Dynamics365Account'][_0xc99d('0x39')]({'where':{'id':_0x3bc7dd['params']['id']}})['then'](handleEntityNotFound(_0x4920d1,null))[_0xc99d('0x11')](function(_0x42ae6c){if(_0x42ae6c){_0x3d4152=_0x42ae6c;_0x9967e2[_0xc99d('0x1d')]=_[_0xc99d('0x20')](db[_0xc99d('0x3a')][_0xc99d('0x1a')]);_0x9967e2['query']=_[_0xc99d('0x20')](_0x3bc7dd[_0xc99d('0x1f')]);_0x9967e2['filters']=_[_0xc99d('0x23')](_0x9967e2[_0xc99d('0x1d')],_0x9967e2[_0xc99d('0x1f')]);_0x3ab1bf[_0xc99d('0x22')]=_[_0xc99d('0x23')](_0x9967e2[_0xc99d('0x1d')],qs[_0xc99d('0x24')](_0x3bc7dd['query'][_0xc99d('0x24')]));_0x3ab1bf[_0xc99d('0x22')]=_0x3ab1bf['attributes']['length']?_0x3ab1bf['attributes']:_0x9967e2[_0xc99d('0x1d')];_0x3ab1bf[_0xc99d('0x3b')]=qs[_0xc99d('0x28')](_0x3bc7dd[_0xc99d('0x1f')][_0xc99d('0x28')]);_0x3ab1bf[_0xc99d('0x2c')]=qs[_0xc99d('0x21')](_['pick'](_0x3bc7dd['query'],_0x9967e2[_0xc99d('0x21')]));if(_0x3bc7dd[_0xc99d('0x1f')][_0xc99d('0x2a')]){_0x3ab1bf[_0xc99d('0x2c')]=_[_0xc99d('0x2b')](_0x3ab1bf[_0xc99d('0x2c')],{'$or':_[_0xc99d('0x1e')](_0x3ab1bf[_0xc99d('0x22')],function(_0x34780a){var _0x365e34={};_0x365e34[_0x34780a]={'$like':'%'+_0x3bc7dd[_0xc99d('0x1f')][_0xc99d('0x2a')]+'%'};return _0x365e34;})});}_0x3ab1bf=_[_0xc99d('0x2b')]({},_0x3ab1bf,_0x3bc7dd['options']);return _0x3d4152[_0xc99d('0x3c')](_0x3ab1bf);}})[_0xc99d('0x11')](function(_0x380b17){if(_0x380b17){_0x954f85=_0x380b17['length'];if(!_0x3bc7dd[_0xc99d('0x1f')][_0xc99d('0x26')](_0xc99d('0x27'))){_0x3ab1bf[_0xc99d('0xb')]=qs[_0xc99d('0xb')](_0x3bc7dd['query']['limit']);_0x3ab1bf['offset']=qs[_0xc99d('0xa')](_0x3bc7dd[_0xc99d('0x1f')]['offset']);}return _0x3d4152['getConfigurations'](_0x3ab1bf);}})[_0xc99d('0x11')](function(_0x2a5f90){if(_0x2a5f90){return _0x2a5f90?{'count':_0x954f85,'rows':_0x2a5f90}:null;}})[_0xc99d('0x11')](respondWithResult(_0x4920d1,null))['catch'](handleError(_0x4920d1,null));};exports['addConfiguration']=function(_0x103a20,_0x4fd059){if(_0x103a20[_0xc99d('0x38')]['id']){delete _0x103a20[_0xc99d('0x38')]['id'];}return db[_0xc99d('0x2f')][_0xc99d('0x39')]({'where':{'id':_0x103a20[_0xc99d('0x34')]['id']}})['then'](handleEntityNotFound(_0x4fd059,null))[_0xc99d('0x11')](function(_0x36e338){if(_0x36e338){_0x103a20[_0xc99d('0x38')]['AccountId']=_0x36e338['id'];_0x103a20[_0xc99d('0x38')][_0xc99d('0x3d')]=integrations['getSubjects'](_0x103a20['body'][_0xc99d('0x3e')],_0x103a20['body'][_0xc99d('0x1c')]);_0x103a20[_0xc99d('0x38')][_0xc99d('0x3f')]=integrations[_0xc99d('0x40')](_0x103a20[_0xc99d('0x38')]['channel'],_0x103a20[_0xc99d('0x38')][_0xc99d('0x1c')]);return db[_0xc99d('0x3a')]['create'](_0x103a20[_0xc99d('0x38')],{'include':[{'model':db[_0xc99d('0x41')],'as':_0xc99d('0x3d')},{'model':db[_0xc99d('0x41')],'as':'Descriptions'}]});}return null;})[_0xc99d('0x11')](respondWithResult(_0x4fd059,null))[_0xc99d('0x32')](handleError(_0x4fd059,null));};function sanitizeRemoteUri(_0x564790){var _0x1a73b0=_0x564790[_0xc99d('0x42')](-0x1);if(_0x1a73b0==='/')return _0x564790[_0xc99d('0x43')](0x0,_0x564790[_0xc99d('0x44')](_0x1a73b0));return _0x564790;}function getWebApiUrl(_0x39b064){return util['format']('%s/api/data/v9.0/',_0x39b064);}exports[_0xc99d('0x45')]=function(_0x4c042d,_0xb0118c){var _0x3b2f51=_0x4c042d[_0xc99d('0x1f')][_0xc99d('0x46')];var _0x3881d7=_0x3b2f51===_0xc99d('0x47')?'Incident':_0xc99d('0x48');var _0x5bd075='';var _0x5a77ef='';var _0xb13edf='';var _0x4d4737='';var _0x4d9014='';var _0x9ee58b='';var _0x232507='';var _0x17e0cf='';var _0x39473e=[_0xc99d('0x49'),'description','customerid',_0xc99d('0x4a'),'caseorigincode',_0xc99d('0x4b'),'phonenumber',_0xc99d('0x4c'),'directioncode','phonecall_activity_parties'];var _0x31847e=['accountidname',_0xc99d('0x4d'),_0xc99d('0x4e'),_0xc99d('0x4f'),'contactidname',_0xc99d('0x50'),_0xc99d('0x51'),_0xc99d('0x52'),_0xc99d('0x53'),_0xc99d('0x54'),_0xc99d('0x55'),_0xc99d('0x56'),_0xc99d('0x57'),_0xc99d('0x58'),_0xc99d('0x59'),_0xc99d('0x5a'),_0xc99d('0x5b'),_0xc99d('0x5c'),_0xc99d('0x5d'),'entitlementidname','entityimage_timestamp',_0xc99d('0x5e'),_0xc99d('0x5f'),_0xc99d('0x60'),_0xc99d('0x61'),_0xc99d('0x62'),_0xc99d('0x63'),_0xc99d('0x64'),_0xc99d('0x65'),_0xc99d('0x66'),_0xc99d('0x67'),_0xc99d('0x68'),_0xc99d('0x69'),_0xc99d('0x6a'),_0xc99d('0x6b'),_0xc99d('0x6c'),_0xc99d('0x6d'),_0xc99d('0x6e'),_0xc99d('0x6f'),_0xc99d('0x70'),'numberofchildincidents',_0xc99d('0x71'),_0xc99d('0x72'),_0xc99d('0x73'),_0xc99d('0x74'),_0xc99d('0x75'),_0xc99d('0x76'),'primarycontactidname',_0xc99d('0x77'),'prioritycodename',_0xc99d('0x78'),_0xc99d('0x79'),_0xc99d('0x7a'),'resolvebykpiidname',_0xc99d('0x7b'),_0xc99d('0x7c'),'responsiblecontactidyominame',_0xc99d('0x7d'),'slainvokedidname',_0xc99d('0x7e'),_0xc99d('0x7f'),_0xc99d('0x80'),_0xc99d('0x81'),_0xc99d('0x82'),_0xc99d('0x83'),_0xc99d('0x84'),'transactioncurrencyidname',_0xc99d('0x85'),_0xc99d('0x86'),_0xc99d('0x87')];var _0x464a09=_0x39473e[_0xc99d('0x88')](_0x31847e);return db[_0xc99d('0x2f')][_0xc99d('0x39')]({'where':{'id':_0x4c042d[_0xc99d('0x34')]['id']},'attributes':['id',_0xc99d('0x89'),'password',_0xc99d('0x8a'),_0xc99d('0x8b'),_0xc99d('0x8c'),_0xc99d('0x8d'),_0xc99d('0x8e')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0xc99d('0x8f'),_0xc99d('0x90')]}]})[_0xc99d('0x11')](handleEntityNotFound(_0xb0118c,null))[_0xc99d('0x11')](function(_0x3e969d){if(_0x3e969d){if(_0x3e969d[_0xc99d('0x8e')]){_0x3e969d['access_token']=_0x3e969d[_0xc99d('0x91')][_0xc99d('0x8f')];_0x17e0cf=sanitizeRemoteUri(_0x3e969d[_0xc99d('0x91')][_0xc99d('0x90')]);_0x232507=getWebApiUrl(_0x17e0cf);return _0x3e969d;}_0x17e0cf=sanitizeRemoteUri(_0x3e969d[_0xc99d('0x8a')]);_0x232507=getWebApiUrl(_0x17e0cf);var _0x1f875a={'method':'POST','uri':_0xc99d('0x92')+_0x3e969d[_0xc99d('0x8b')]+'/oauth2/token','form':{'client_id':_0x3e969d['clientId'],'resource':_0x17e0cf,'username':_0x3e969d['username'],'password':_0x3e969d[_0xc99d('0x93')],'grant_type':_0xc99d('0x93'),'client_secret':_0x3e969d['clientSecret']},'json':!![]};return rp(_0x1f875a);}})['then'](function(_0x49ed29){_0x9ee58b=_0x49ed29['access_token'];var _0xe3ee7f={'method':'GET','uri':encodeURI(_0x232507+_0xc99d('0x94')+_0x3881d7+'\x27'),'headers':{'Authorization':_0xc99d('0x95')+_0x9ee58b,'If-None-Match':null,'OData-Version':_0xc99d('0x96')},'json':!![]};return rp(_0xe3ee7f);})[_0xc99d('0x11')](function(_0x1c6bde){var _0x317192=_0x1c6bde[_0xc99d('0x97')][0x0];var _0x5a42ab=_0x317192['MetadataId'];var _0x24d0fa={'method':_0xc99d('0x98'),'uri':_0x232507+'EntityDefinitions('+_0x5a42ab+_0xc99d('0x99'),'headers':{'Authorization':_0xc99d('0x95')+_0x9ee58b,'If-None-Match':null,'OData-Version':_0xc99d('0x96')},'json':!![]};return rp(_0x24d0fa);})[_0xc99d('0x11')](function(_0x568ffb){_0x5bd075=_0x568ffb;_0x5a77ef=_0x5bd075[_0xc99d('0x9a')];_0x5a77ef=_[_0xc99d('0x9b')](_0x5a77ef,function(_0x16a56c){return!_0x464a09[_0xc99d('0x9c')](_0x16a56c[_0xc99d('0x9d')]);});var _0x214ed6=[];var _0x4e7878=[];_0x5a77ef[_0xc99d('0x9e')](function(_0x283557){if(_0x283557[_0xc99d('0x9f')]){var _0xb4ca6=_0x283557[_0xc99d('0x9f')][_0xc99d('0x43')](_0x283557[_0xc99d('0x9f')][_0xc99d('0x44')]('.')+0x1);if(_0xb4ca6==='PicklistAttributeMetadata'){_0x214ed6[_0xc99d('0xa0')](getSelectList(_0x232507,_0x3b2f51,_0x4e7878,_0x5bd075['MetadataId'],_0x283557[_0xc99d('0xa1')],_0x9ee58b));}}});return Promise['all'](_0x214ed6);})[_0xc99d('0x11')](function(_0x56434d){_0xb13edf=_0x56434d[0x0];var _0x44dbe7=[];var _0x47f0a6=[];_0x5a77ef[_0xc99d('0x9e')](function(_0x43ec2d){if(!_[_0xc99d('0xa2')](_0x43ec2d[_0xc99d('0x9f')])){var _0x40ac3f=_0x43ec2d['@odata.type'][_0xc99d('0x43')](_0x43ec2d[_0xc99d('0x9f')]['lastIndexOf']('.')+0x1);if(_0x40ac3f===_0xc99d('0xa3')){_0x44dbe7[_0xc99d('0xa0')](getBooleanList(_0x232507,_0x3b2f51,_0x47f0a6,_0x5bd075['MetadataId'],_0x43ec2d[_0xc99d('0xa1')],_0x9ee58b));}}});return Promise['all'](_0x44dbe7);})[_0xc99d('0x11')](function(_0x481f73){_0x4d4737=_0x481f73[0x0];var _0x2015a2=[];var _0x583cb0=[];_0x5a77ef[_0xc99d('0x9e')](function(_0xf3c74f){if(_0xf3c74f[_0xc99d('0x9f')]){var _0x4ecdb4=_0xf3c74f['@odata.type']['substring'](_0xf3c74f[_0xc99d('0x9f')][_0xc99d('0x44')]('.')+0x1);if(_0x4ecdb4==='StringAttributeMetadata'||_0x4ecdb4===_0xc99d('0xa4')||_0x4ecdb4==='BigIntAttributeMetadata'||_0x4ecdb4===_0xc99d('0xa5')||_0x4ecdb4===_0xc99d('0xa6')||_0x4ecdb4===_0xc99d('0xa7')||_0x4ecdb4===_0xc99d('0xa8')||_0x4ecdb4==='EntityNameAttributeMetadata'||_0x4ecdb4===_0xc99d('0xa9')||_0x4ecdb4===_0xc99d('0xaa')){_0x2015a2[_0xc99d('0xa0')](getInputList(_0x232507,_0x3b2f51,_0x4ecdb4,_0x583cb0,_0x5bd075[_0xc99d('0xa1')],_0xf3c74f[_0xc99d('0xa1')],_0x9ee58b));}}});return Promise[_0xc99d('0xab')](_0x2015a2);})[_0xc99d('0x11')](function(_0x373dd2){_0x4d9014=_0x373dd2[0x0];var _0x3f224f=_0xb13edf[_0xc99d('0x88')](_0x4d4737)[_0xc99d('0x88')](_0x4d9014);var _0x29d4bd={'count':_0x3f224f['length'],'rows':_0x3f224f};return _0x29d4bd;})['then'](respondWithResult(_0xb0118c,null))[_0xc99d('0x32')](function(_0x108e99){var _0x3c125f=_0x4c042d[_0xc99d('0x1f')]['test']?0x1f4:_0x108e99[_0xc99d('0xac')]||0x1f4;logger[_0xc99d('0x15')](_0x108e99[_0xc99d('0x16')]);delete _0x108e99[_0xc99d('0x17')];if(_0x3c125f===0x191){_0x3c125f=0x190;}_0xb0118c[_0xc99d('0x8')](_0x3c125f)['send'](_0x4c042d[_0xc99d('0x1f')][_0xc99d('0xad')]?{'message':_0xc99d('0xae'),'statusCode':_0x108e99['statusCode']}:_0x108e99);});};function getSelectList(_0x808972,_0x52bb20,_0x2af796,_0x47a7a7,_0x85b5,_0x23b99a){var _0x5ddf97={'method':_0xc99d('0x98'),'uri':_0x808972+'EntityDefinitions('+_0x47a7a7+')/Attributes('+_0x85b5+_0xc99d('0xaf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xc99d('0x95')+_0x23b99a,'If-None-Match':null,'OData-Version':_0xc99d('0x96')},'json':!![]};return rp(_0x5ddf97)[_0xc99d('0x11')](function(_0xd66e04){var _0x52fc92=[];var _0x6a028a=_0xd66e04[_0xc99d('0xb0')][_0xc99d('0xb1')];_0x6a028a[_0xc99d('0x9e')](function(_0x18f1f2){_0x52fc92['push']({'name':_0x18f1f2[_0xc99d('0xb2')]['UserLocalizedLabel'][_0xc99d('0xb2')],'value':String(_0x18f1f2[_0xc99d('0xb3')])});});var _0x4e8e9d={'id':_0x52bb20+'_'+_0xd66e04[_0xc99d('0x9d')],'name':_0xd66e04[_0xc99d('0xb4')][_0xc99d('0xb5')][_0xc99d('0xb2')],'custom':![],'options':_0x52fc92};_0x2af796[_0xc99d('0xa0')](_0x4e8e9d);return _0x2af796;});}function getBooleanList(_0x4e8786,_0x3933a6,_0x4c9e9b,_0x271b76,_0x1f9690,_0x216757){var _0x47ca09={'method':_0xc99d('0x98'),'uri':_0x4e8786+_0xc99d('0xb6')+_0x271b76+_0xc99d('0xb7')+_0x1f9690+_0xc99d('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0x216757,'If-None-Match':null,'OData-Version':_0xc99d('0x96')},'json':!![]};return rp(_0x47ca09)['then'](function(_0xef8c4d){var _0x5b5247=[];_0x5b5247['push']({'name':_0xef8c4d[_0xc99d('0xb0')][_0xc99d('0xb9')][_0xc99d('0xb2')][_0xc99d('0xb5')][_0xc99d('0xb2')],'value':_0xc99d('0xba')},{'name':_0xef8c4d['OptionSet']['FalseOption'][_0xc99d('0xb2')]['UserLocalizedLabel'][_0xc99d('0xb2')],'value':_0xc99d('0xbb')});var _0xcb9ded={'id':_0x3933a6+'_'+_0xef8c4d['LogicalName'],'name':_0xef8c4d['DisplayName'][_0xc99d('0xb5')]['Label'],'custom':![],'options':_0x5b5247};_0x4c9e9b[_0xc99d('0xa0')](_0xcb9ded);return _0x4c9e9b;});}function getInputList(_0x521728,_0x5a1c5a,_0x486985,_0x548158,_0x3ff5d2,_0x3b63d1,_0x5c1274){var _0xf28ef={'method':_0xc99d('0x98'),'uri':_0x521728+'EntityDefinitions('+_0x3ff5d2+_0xc99d('0xb7')+_0x3b63d1+')/Microsoft.Dynamics.CRM.'+_0x486985+_0xc99d('0xbc'),'headers':{'Authorization':_0xc99d('0x95')+_0x5c1274,'If-None-Match':null,'OData-Version':_0xc99d('0x96')},'json':!![]};return rp(_0xf28ef)['then'](function(_0x2962be){var _0x402c87={'id':_0x5a1c5a+'_'+_0x2962be[_0xc99d('0x9d')],'name':_0x2962be['DisplayName'][_0xc99d('0xb5')]?_0x2962be[_0xc99d('0xb4')][_0xc99d('0xb5')][_0xc99d('0xb2')]:_0x2962be[_0xc99d('0x9d')],'custom':![],'options':[]};_0x548158[_0xc99d('0xa0')](_0x402c87);return _0x548158;});} \ No newline at end of file +var _0xa5e6=['accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','resolveby','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','all','isNil','lastIndexOf','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','DisplayName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','map','Dynamics365Account','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','rawAttributes','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','format','%s/api/data/v9.0/','getFields','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname'];(function(_0x2a4fe2,_0x3ec53a){var _0x225c4a=function(_0x1eccfa){while(--_0x1eccfa){_0x2a4fe2['push'](_0x2a4fe2['shift']());}};_0x225c4a(++_0x3ec53a);}(_0xa5e6,0x111));var _0x6a5e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa5e6[_0x126558];return _0x1f6d14;};'use strict';var rp=require('request-promise');var util=require(_0x6a5e('0x0'));var _=require(_0x6a5e('0x1'));var qs=require(_0x6a5e('0x2'));var logger=require(_0x6a5e('0x3'))(_0x6a5e('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6a5e('0x5'));function respondWithResult(_0x27856c,_0x5db1c1){_0x5db1c1=_0x5db1c1||0xc8;return function(_0x2b258d){if(_0x2b258d){return _0x27856c['status'](_0x5db1c1)[_0x6a5e('0x6')](_0x2b258d);}};}function respondWithFilteredResult(_0x5be5af,_0x935b46){return function(_0x5791bf){if(_0x5791bf){var _0x1c0a78=typeof _0x935b46[_0x6a5e('0x7')]===_0x6a5e('0x8')&&typeof _0x935b46[_0x6a5e('0x9')]===_0x6a5e('0x8');var _0x81579f=_0x5791bf[_0x6a5e('0xa')];var _0x1aca1e=_0x1c0a78?0x0:_0x935b46['offset'];var _0x2a8342=_0x1c0a78?_0x5791bf[_0x6a5e('0xa')]:_0x935b46['offset']+_0x935b46[_0x6a5e('0x9')];var _0x33838a;if(_0x2a8342>=_0x81579f){_0x2a8342=_0x81579f;_0x33838a=0xc8;}else{_0x33838a=0xce;}_0x5be5af[_0x6a5e('0xb')](_0x33838a);return _0x5be5af[_0x6a5e('0xc')](_0x6a5e('0xd'),_0x1aca1e+'-'+_0x2a8342+'/'+_0x81579f)[_0x6a5e('0x6')](_0x5791bf);}return null;};}function saveUpdates(_0x51af10){return function(_0x251b66){if(_0x251b66){return _0x251b66[_0x6a5e('0xe')](_0x51af10)[_0x6a5e('0xf')](function(_0x5cb1d8){return _0x5cb1d8;});}return null;};}function removeEntity(_0x58718f){return function(_0x1baf14){if(_0x1baf14){return _0x1baf14[_0x6a5e('0x10')]()[_0x6a5e('0xf')](function(){_0x58718f[_0x6a5e('0xb')](0xcc)[_0x6a5e('0x11')]();});}};}function handleEntityNotFound(_0x546ba9){return function(_0x12e874){if(!_0x12e874){_0x546ba9[_0x6a5e('0x12')](0x194);}return _0x12e874;};}function handleError(_0x1ce584,_0x48ede2){_0x48ede2=_0x48ede2||0x1f4;return function(_0x3535e1){logger[_0x6a5e('0x13')](_0x3535e1[_0x6a5e('0x14')]);if(_0x3535e1[_0x6a5e('0x15')]){delete _0x3535e1[_0x6a5e('0x15')];}_0x1ce584[_0x6a5e('0xb')](_0x48ede2)[_0x6a5e('0x16')](_0x3535e1);};}exports['index']=function(_0x5952bd,_0x1ad73b){var _0x51e341={},_0x41ed21={},_0x1f170d={'count':0x0,'rows':[]};var _0x3d0b00=_[_0x6a5e('0x17')](db[_0x6a5e('0x18')]['rawAttributes'],function(_0x46a32d){return{'name':_0x46a32d[_0x6a5e('0x19')],'type':_0x46a32d[_0x6a5e('0x1a')][_0x6a5e('0x1b')]};});_0x41ed21['model']=_[_0x6a5e('0x17')](_0x3d0b00,_0x6a5e('0x15'));_0x41ed21[_0x6a5e('0x1c')]=_[_0x6a5e('0x1d')](_0x5952bd[_0x6a5e('0x1c')]);_0x41ed21[_0x6a5e('0x1e')]=_[_0x6a5e('0x1f')](_0x41ed21['model'],_0x41ed21['query']);_0x51e341[_0x6a5e('0x20')]=_[_0x6a5e('0x1f')](_0x41ed21[_0x6a5e('0x21')],qs[_0x6a5e('0x22')](_0x5952bd['query']['fields']));_0x51e341[_0x6a5e('0x20')]=_0x51e341[_0x6a5e('0x20')][_0x6a5e('0x23')]?_0x51e341[_0x6a5e('0x20')]:_0x41ed21[_0x6a5e('0x21')];if(!_0x5952bd[_0x6a5e('0x1c')][_0x6a5e('0x24')](_0x6a5e('0x25'))){_0x51e341['limit']=qs[_0x6a5e('0x9')](_0x5952bd[_0x6a5e('0x1c')][_0x6a5e('0x9')]);_0x51e341[_0x6a5e('0x7')]=qs[_0x6a5e('0x7')](_0x5952bd[_0x6a5e('0x1c')][_0x6a5e('0x7')]);}_0x51e341['order']=qs[_0x6a5e('0x26')](_0x5952bd[_0x6a5e('0x1c')][_0x6a5e('0x26')]);_0x51e341[_0x6a5e('0x27')]=qs[_0x6a5e('0x1e')](_['pick'](_0x5952bd['query'],_0x41ed21[_0x6a5e('0x1e')]),_0x3d0b00);if(_0x5952bd[_0x6a5e('0x1c')]['filter']){_0x51e341['where']=_[_0x6a5e('0x28')](_0x51e341[_0x6a5e('0x27')],{'$or':_[_0x6a5e('0x17')](_0x3d0b00,function(_0x5873f1){if(_0x5873f1[_0x6a5e('0x1a')]!=='VIRTUAL'){var _0x47fc84={};_0x47fc84[_0x5873f1[_0x6a5e('0x15')]]={'$like':'%'+_0x5952bd[_0x6a5e('0x1c')][_0x6a5e('0x29')]+'%'};return _0x47fc84;}})});}_0x51e341=_[_0x6a5e('0x28')]({},_0x51e341,_0x5952bd[_0x6a5e('0x2a')]);var _0x339655={'where':_0x51e341[_0x6a5e('0x27')]};return db[_0x6a5e('0x18')][_0x6a5e('0xa')](_0x339655)['then'](function(_0x1f1d96){_0x1f170d[_0x6a5e('0xa')]=_0x1f1d96;if(_0x5952bd[_0x6a5e('0x1c')][_0x6a5e('0x2b')]){_0x51e341['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x6a5e('0x2c')](_0x51e341);})[_0x6a5e('0xf')](function(_0x3d8a09){_0x1f170d[_0x6a5e('0x2d')]=_0x3d8a09;return _0x1f170d;})[_0x6a5e('0xf')](respondWithFilteredResult(_0x1ad73b,_0x51e341))['catch'](handleError(_0x1ad73b,null));};exports[_0x6a5e('0x2e')]=function(_0x533e4b,_0x4f2553){var _0xfd5aa7={'raw':![],'where':{'id':_0x533e4b[_0x6a5e('0x2f')]['id']}},_0x1f2895={};_0x1f2895['model']=_[_0x6a5e('0x1d')](db[_0x6a5e('0x18')]['rawAttributes']);_0x1f2895[_0x6a5e('0x1c')]=_['keys'](_0x533e4b[_0x6a5e('0x1c')]);_0x1f2895[_0x6a5e('0x1e')]=_['intersection'](_0x1f2895[_0x6a5e('0x21')],_0x1f2895['query']);_0xfd5aa7[_0x6a5e('0x20')]=_[_0x6a5e('0x1f')](_0x1f2895[_0x6a5e('0x21')],qs[_0x6a5e('0x22')](_0x533e4b[_0x6a5e('0x1c')][_0x6a5e('0x22')]));_0xfd5aa7['attributes']=_0xfd5aa7['attributes'][_0x6a5e('0x23')]?_0xfd5aa7[_0x6a5e('0x20')]:_0x1f2895[_0x6a5e('0x21')];if(_0x533e4b[_0x6a5e('0x1c')][_0x6a5e('0x2b')]){_0xfd5aa7['include']=[{'all':!![]}];}_0xfd5aa7=_['merge']({},_0xfd5aa7,_0x533e4b[_0x6a5e('0x2a')]);return db[_0x6a5e('0x18')][_0x6a5e('0x30')](_0xfd5aa7)[_0x6a5e('0xf')](handleEntityNotFound(_0x4f2553,null))[_0x6a5e('0xf')](respondWithResult(_0x4f2553,null))[_0x6a5e('0x31')](handleError(_0x4f2553,null));};exports[_0x6a5e('0x32')]=function(_0x1c2246,_0x542ab1){return db[_0x6a5e('0x18')]['create'](_0x1c2246['body'],{})[_0x6a5e('0xf')](respondWithResult(_0x542ab1,0xc9))[_0x6a5e('0x31')](handleError(_0x542ab1,null));};exports['update']=function(_0x284ede,_0x6050d4){if(_0x284ede[_0x6a5e('0x33')]['id']){delete _0x284ede['body']['id'];}return db[_0x6a5e('0x18')][_0x6a5e('0x30')]({'where':{'id':_0x284ede[_0x6a5e('0x2f')]['id']}})[_0x6a5e('0xf')](handleEntityNotFound(_0x6050d4,null))[_0x6a5e('0xf')](saveUpdates(_0x284ede[_0x6a5e('0x33')],null))[_0x6a5e('0xf')](respondWithResult(_0x6050d4,null))[_0x6a5e('0x31')](handleError(_0x6050d4,null));};exports[_0x6a5e('0x10')]=function(_0x37e70e,_0x52246a){return db['Dynamics365Account'][_0x6a5e('0x30')]({'where':{'id':_0x37e70e[_0x6a5e('0x2f')]['id']}})[_0x6a5e('0xf')](handleEntityNotFound(_0x52246a,null))[_0x6a5e('0xf')](removeEntity(_0x52246a,null))[_0x6a5e('0x31')](handleError(_0x52246a,null));};exports[_0x6a5e('0x34')]=function(_0x1c2d48,_0x363ccb){var _0x10aa16={};var _0x1fe279={};var _0x4e2d1;var _0x3fd794;return db[_0x6a5e('0x18')][_0x6a5e('0x35')]({'where':{'id':_0x1c2d48['params']['id']}})[_0x6a5e('0xf')](handleEntityNotFound(_0x363ccb,null))['then'](function(_0x424fce){if(_0x424fce){_0x4e2d1=_0x424fce;_0x1fe279['model']=_['keys'](db['Dynamics365Configuration'][_0x6a5e('0x36')]);_0x1fe279[_0x6a5e('0x1c')]=_[_0x6a5e('0x1d')](_0x1c2d48['query']);_0x1fe279[_0x6a5e('0x1e')]=_[_0x6a5e('0x1f')](_0x1fe279[_0x6a5e('0x21')],_0x1fe279['query']);_0x10aa16['attributes']=_['intersection'](_0x1fe279[_0x6a5e('0x21')],qs[_0x6a5e('0x22')](_0x1c2d48[_0x6a5e('0x1c')][_0x6a5e('0x22')]));_0x10aa16['attributes']=_0x10aa16['attributes'][_0x6a5e('0x23')]?_0x10aa16[_0x6a5e('0x20')]:_0x1fe279[_0x6a5e('0x21')];_0x10aa16['order']=qs['sort'](_0x1c2d48[_0x6a5e('0x1c')][_0x6a5e('0x26')]);_0x10aa16[_0x6a5e('0x27')]=qs[_0x6a5e('0x1e')](_[_0x6a5e('0x37')](_0x1c2d48[_0x6a5e('0x1c')],_0x1fe279['filters']));if(_0x1c2d48[_0x6a5e('0x1c')][_0x6a5e('0x29')]){_0x10aa16[_0x6a5e('0x27')]=_['merge'](_0x10aa16[_0x6a5e('0x27')],{'$or':_[_0x6a5e('0x17')](_0x10aa16[_0x6a5e('0x20')],function(_0x162eed){var _0x159e6c={};_0x159e6c[_0x162eed]={'$like':'%'+_0x1c2d48[_0x6a5e('0x1c')]['filter']+'%'};return _0x159e6c;})});}_0x10aa16=_['merge']({},_0x10aa16,_0x1c2d48[_0x6a5e('0x2a')]);return _0x4e2d1['getConfigurations'](_0x10aa16);}})[_0x6a5e('0xf')](function(_0xb78b3f){if(_0xb78b3f){_0x3fd794=_0xb78b3f[_0x6a5e('0x23')];if(!_0x1c2d48[_0x6a5e('0x1c')][_0x6a5e('0x24')](_0x6a5e('0x25'))){_0x10aa16['limit']=qs[_0x6a5e('0x9')](_0x1c2d48[_0x6a5e('0x1c')][_0x6a5e('0x9')]);_0x10aa16[_0x6a5e('0x7')]=qs[_0x6a5e('0x7')](_0x1c2d48['query'][_0x6a5e('0x7')]);}return _0x4e2d1[_0x6a5e('0x34')](_0x10aa16);}})[_0x6a5e('0xf')](function(_0x4b1f84){if(_0x4b1f84){return _0x4b1f84?{'count':_0x3fd794,'rows':_0x4b1f84}:null;}})[_0x6a5e('0xf')](respondWithResult(_0x363ccb,null))[_0x6a5e('0x31')](handleError(_0x363ccb,null));};exports[_0x6a5e('0x38')]=function(_0x3c1c6d,_0x3a7ec2){if(_0x3c1c6d[_0x6a5e('0x33')]['id']){delete _0x3c1c6d[_0x6a5e('0x33')]['id'];}return db['Dynamics365Account'][_0x6a5e('0x35')]({'where':{'id':_0x3c1c6d['params']['id']}})[_0x6a5e('0xf')](handleEntityNotFound(_0x3a7ec2,null))[_0x6a5e('0xf')](function(_0x2ecafb){if(_0x2ecafb){_0x3c1c6d['body'][_0x6a5e('0x39')]=_0x2ecafb['id'];_0x3c1c6d[_0x6a5e('0x33')][_0x6a5e('0x3a')]=integrations[_0x6a5e('0x3b')](_0x3c1c6d[_0x6a5e('0x33')][_0x6a5e('0x3c')],_0x3c1c6d[_0x6a5e('0x33')]['type']);_0x3c1c6d[_0x6a5e('0x33')][_0x6a5e('0x3d')]=integrations[_0x6a5e('0x3e')](_0x3c1c6d[_0x6a5e('0x33')][_0x6a5e('0x3c')],_0x3c1c6d[_0x6a5e('0x33')][_0x6a5e('0x1a')]);return db['Dynamics365Configuration'][_0x6a5e('0x32')](_0x3c1c6d['body'],{'include':[{'model':db[_0x6a5e('0x3f')],'as':_0x6a5e('0x3a')},{'model':db[_0x6a5e('0x3f')],'as':_0x6a5e('0x3d')}]});}return null;})[_0x6a5e('0xf')](respondWithResult(_0x3a7ec2,null))[_0x6a5e('0x31')](handleError(_0x3a7ec2,null));};function sanitizeRemoteUri(_0x3eda6d){var _0x532a89=_0x3eda6d['slice'](-0x1);if(_0x532a89==='/')return _0x3eda6d['substring'](0x0,_0x3eda6d['lastIndexOf'](_0x532a89));return _0x3eda6d;}function getWebApiUrl(_0x1c1b9b){return util[_0x6a5e('0x40')](_0x6a5e('0x41'),_0x1c1b9b);}exports[_0x6a5e('0x42')]=function(_0x3c089c,_0x495a0f){var _0xba5596=_0x3c089c[_0x6a5e('0x1c')]['ticketType'];var _0x11edc8=_0xba5596===_0x6a5e('0x43')?_0x6a5e('0x44'):'PhoneCall';var _0x1b21f6='';var _0x86a48f='';var _0x359d0e='';var _0x2d0c2f='';var _0x175d75='';var _0x23f66e='';var _0x2a9817='';var _0x279f61='';var _0x1c6b9c=[_0x6a5e('0x45'),_0x6a5e('0x46'),_0x6a5e('0x47'),_0x6a5e('0x48'),_0x6a5e('0x49'),_0x6a5e('0x4a'),'phonenumber',_0x6a5e('0x4b'),_0x6a5e('0x4c'),_0x6a5e('0x4d')];var _0x4052eb=[_0x6a5e('0x4e'),_0x6a5e('0x4f'),_0x6a5e('0x50'),_0x6a5e('0x51'),_0x6a5e('0x52'),'contactidyominame',_0x6a5e('0x53'),_0x6a5e('0x54'),_0x6a5e('0x55'),_0x6a5e('0x56'),'createdbyname','createdbyyominame',_0x6a5e('0x57'),_0x6a5e('0x58'),'createdonbehalfbyyominame',_0x6a5e('0x59'),_0x6a5e('0x5a'),_0x6a5e('0x5b'),'emailaddress',_0x6a5e('0x5c'),_0x6a5e('0x5d'),_0x6a5e('0x5e'),_0x6a5e('0x5f'),_0x6a5e('0x60'),_0x6a5e('0x61'),_0x6a5e('0x62'),_0x6a5e('0x63'),_0x6a5e('0x64'),'kbarticleidname',_0x6a5e('0x65'),'masteridname','modifiedbyexternalpartyname',_0x6a5e('0x66'),_0x6a5e('0x67'),'modifiedbyyominame','modifiedon',_0x6a5e('0x68'),_0x6a5e('0x69'),_0x6a5e('0x6a'),_0x6a5e('0x6b'),'numberofchildincidents','onholdtime',_0x6a5e('0x6c'),_0x6a5e('0x6d'),_0x6a5e('0x6e'),_0x6a5e('0x6f'),_0x6a5e('0x70'),'primarycontactidname',_0x6a5e('0x71'),_0x6a5e('0x72'),'productidname','productserialnumber',_0x6a5e('0x73'),'resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x6a5e('0x74'),_0x6a5e('0x75'),_0x6a5e('0x76'),_0x6a5e('0x77'),'subjectidname',_0x6a5e('0x78'),_0x6a5e('0x79'),_0x6a5e('0x7a'),'traversedpath',_0x6a5e('0x7b'),_0x6a5e('0x7c')];var _0x29f94a=_0x1c6b9c[_0x6a5e('0x7d')](_0x4052eb);return db['Dynamics365Account'][_0x6a5e('0x35')]({'where':{'id':_0x3c089c['params']['id']},'attributes':['id','username',_0x6a5e('0x7e'),'remoteUri',_0x6a5e('0x7f'),_0x6a5e('0x80'),_0x6a5e('0x81'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0x6a5e('0x82'),'attributes':['id',_0x6a5e('0x83'),_0x6a5e('0x84')]}]})['then'](handleEntityNotFound(_0x495a0f,null))['then'](function(_0x29ac1a){if(_0x29ac1a){if(_0x29ac1a[_0x6a5e('0x85')]){_0x29ac1a['access_token']=_0x29ac1a[_0x6a5e('0x82')]['data5'];_0x279f61=sanitizeRemoteUri(_0x29ac1a['CloudProvider'][_0x6a5e('0x84')]);_0x2a9817=getWebApiUrl(_0x279f61);return _0x29ac1a;}_0x279f61=sanitizeRemoteUri(_0x29ac1a['remoteUri']);_0x2a9817=getWebApiUrl(_0x279f61);var _0x55b3da={'method':_0x6a5e('0x86'),'uri':_0x6a5e('0x87')+_0x29ac1a[_0x6a5e('0x7f')]+_0x6a5e('0x88'),'form':{'client_id':_0x29ac1a[_0x6a5e('0x80')],'resource':_0x279f61,'username':_0x29ac1a['username'],'password':_0x29ac1a[_0x6a5e('0x7e')],'grant_type':_0x6a5e('0x7e'),'client_secret':_0x29ac1a[_0x6a5e('0x81')]},'json':!![]};return rp(_0x55b3da);}})[_0x6a5e('0xf')](function(_0x2dffc8){_0x23f66e=_0x2dffc8[_0x6a5e('0x89')];var _0x1853a0={'method':_0x6a5e('0x8a'),'uri':encodeURI(_0x2a9817+_0x6a5e('0x8b')+_0x11edc8+'\x27'),'headers':{'Authorization':_0x6a5e('0x8c')+_0x23f66e,'If-None-Match':null,'OData-Version':_0x6a5e('0x8d')},'json':!![]};return rp(_0x1853a0);})['then'](function(_0x17b8ab){var _0x159207=_0x17b8ab['value'][0x0];var _0x46cac1=_0x159207[_0x6a5e('0x8e')];var _0xbca6b={'method':_0x6a5e('0x8a'),'uri':_0x2a9817+_0x6a5e('0x8f')+_0x46cac1+_0x6a5e('0x90'),'headers':{'Authorization':_0x6a5e('0x8c')+_0x23f66e,'If-None-Match':null,'OData-Version':_0x6a5e('0x8d')},'json':!![]};return rp(_0xbca6b);})[_0x6a5e('0xf')](function(_0x614fc7){_0x1b21f6=_0x614fc7;_0x86a48f=_0x1b21f6[_0x6a5e('0x91')];_0x86a48f=_[_0x6a5e('0x92')](_0x86a48f,function(_0x4d93e8){return!_0x29f94a['includes'](_0x4d93e8[_0x6a5e('0x93')]);});var _0x2923d7=[];var _0x2d3867=[];_0x86a48f[_0x6a5e('0x94')](function(_0x1db1d8){if(_0x1db1d8[_0x6a5e('0x95')]){var _0x29a71a=_0x1db1d8[_0x6a5e('0x95')][_0x6a5e('0x96')](_0x1db1d8['@odata.type']['lastIndexOf']('.')+0x1);if(_0x29a71a===_0x6a5e('0x97')){_0x2923d7['push'](getSelectList(_0x2a9817,_0xba5596,_0x2d3867,_0x1b21f6[_0x6a5e('0x8e')],_0x1db1d8[_0x6a5e('0x8e')],_0x23f66e));}}});return Promise[_0x6a5e('0x98')](_0x2923d7);})['then'](function(_0x3389c4){_0x359d0e=_0x3389c4[0x0];var _0x34aaae=[];var _0x54cdfd=[];_0x86a48f['forEach'](function(_0x3af07d){if(!_[_0x6a5e('0x99')](_0x3af07d[_0x6a5e('0x95')])){var _0x56edf2=_0x3af07d['@odata.type'][_0x6a5e('0x96')](_0x3af07d[_0x6a5e('0x95')][_0x6a5e('0x9a')]('.')+0x1);if(_0x56edf2===_0x6a5e('0x9b')){_0x34aaae[_0x6a5e('0x9c')](getBooleanList(_0x2a9817,_0xba5596,_0x54cdfd,_0x1b21f6[_0x6a5e('0x8e')],_0x3af07d[_0x6a5e('0x8e')],_0x23f66e));}}});return Promise[_0x6a5e('0x98')](_0x34aaae);})[_0x6a5e('0xf')](function(_0x3fcbe4){_0x2d0c2f=_0x3fcbe4[0x0];var _0x5d5181=[];var _0x50221c=[];_0x86a48f['forEach'](function(_0x2f620a){if(_0x2f620a[_0x6a5e('0x95')]){var _0x4bd98b=_0x2f620a[_0x6a5e('0x95')][_0x6a5e('0x96')](_0x2f620a[_0x6a5e('0x95')]['lastIndexOf']('.')+0x1);if(_0x4bd98b===_0x6a5e('0x9d')||_0x4bd98b===_0x6a5e('0x9e')||_0x4bd98b===_0x6a5e('0x9f')||_0x4bd98b==='IntegerAttributeMetadata'||_0x4bd98b===_0x6a5e('0xa0')||_0x4bd98b===_0x6a5e('0xa1')||_0x4bd98b===_0x6a5e('0xa2')||_0x4bd98b==='EntityNameAttributeMetadata'||_0x4bd98b===_0x6a5e('0xa3')||_0x4bd98b===_0x6a5e('0xa4')){_0x5d5181[_0x6a5e('0x9c')](getInputList(_0x2a9817,_0xba5596,_0x4bd98b,_0x50221c,_0x1b21f6['MetadataId'],_0x2f620a['MetadataId'],_0x23f66e));}}});return Promise[_0x6a5e('0x98')](_0x5d5181);})['then'](function(_0x3064c8){_0x175d75=_0x3064c8[0x0];var _0x4f8eeb=_0x359d0e[_0x6a5e('0x7d')](_0x2d0c2f)[_0x6a5e('0x7d')](_0x175d75);var _0x3534cd={'count':_0x4f8eeb[_0x6a5e('0x23')],'rows':_0x4f8eeb};return _0x3534cd;})[_0x6a5e('0xf')](respondWithResult(_0x495a0f,null))['catch'](function(_0x2956da){var _0x429673=_0x3c089c[_0x6a5e('0x1c')][_0x6a5e('0xa5')]?0x1f4:_0x2956da['statusCode']||0x1f4;logger['error'](_0x2956da['stack']);delete _0x2956da[_0x6a5e('0x15')];if(_0x429673===0x191){_0x429673=0x190;}_0x495a0f[_0x6a5e('0xb')](_0x429673)[_0x6a5e('0x16')](_0x3c089c[_0x6a5e('0x1c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2956da[_0x6a5e('0xa6')]}:_0x2956da);});};function getSelectList(_0x3c5b7e,_0x3bfe8b,_0x48d492,_0x34d5af,_0x55af37,_0xaee734){var _0x28e657={'method':'GET','uri':_0x3c5b7e+_0x6a5e('0x8f')+_0x34d5af+')/Attributes('+_0x55af37+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x6a5e('0xa7'),'headers':{'Authorization':_0x6a5e('0x8c')+_0xaee734,'If-None-Match':null,'OData-Version':_0x6a5e('0x8d')},'json':!![]};return rp(_0x28e657)[_0x6a5e('0xf')](function(_0x2c84da){var _0x37c806=[];var _0x16be87=_0x2c84da['OptionSet']['Options'];_0x16be87[_0x6a5e('0x94')](function(_0xb60b1d){_0x37c806['push']({'name':_0xb60b1d[_0x6a5e('0xa8')][_0x6a5e('0xa9')][_0x6a5e('0xa8')],'value':String(_0xb60b1d['Value'])});});var _0x1cd39e={'id':_0x3bfe8b+'_'+_0x2c84da[_0x6a5e('0x93')],'name':_0x2c84da['DisplayName']['UserLocalizedLabel'][_0x6a5e('0xa8')],'custom':![],'options':_0x37c806};_0x48d492[_0x6a5e('0x9c')](_0x1cd39e);return _0x48d492;});}function getBooleanList(_0x110ca7,_0x5980e7,_0x4d2cb2,_0x2a138f,_0x27ec81,_0x3ed99d){var _0xd101c5={'method':'GET','uri':_0x110ca7+_0x6a5e('0x8f')+_0x2a138f+_0x6a5e('0xaa')+_0x27ec81+_0x6a5e('0xab'),'headers':{'Authorization':_0x6a5e('0x8c')+_0x3ed99d,'If-None-Match':null,'OData-Version':_0x6a5e('0x8d')},'json':!![]};return rp(_0xd101c5)['then'](function(_0x472dec){var _0x12f862=[];_0x12f862[_0x6a5e('0x9c')]({'name':_0x472dec['OptionSet'][_0x6a5e('0xac')][_0x6a5e('0xa8')][_0x6a5e('0xa9')][_0x6a5e('0xa8')],'value':_0x6a5e('0xad')},{'name':_0x472dec['OptionSet']['FalseOption'][_0x6a5e('0xa8')][_0x6a5e('0xa9')][_0x6a5e('0xa8')],'value':_0x6a5e('0xae')});var _0x185477={'id':_0x5980e7+'_'+_0x472dec['LogicalName'],'name':_0x472dec['DisplayName']['UserLocalizedLabel'][_0x6a5e('0xa8')],'custom':![],'options':_0x12f862};_0x4d2cb2[_0x6a5e('0x9c')](_0x185477);return _0x4d2cb2;});}function getInputList(_0x55e477,_0x280b26,_0x504eda,_0x48d48b,_0x8eaa87,_0xd66e3f,_0x243769){var _0x59e121={'method':_0x6a5e('0x8a'),'uri':_0x55e477+'EntityDefinitions('+_0x8eaa87+_0x6a5e('0xaa')+_0xd66e3f+')/Microsoft.Dynamics.CRM.'+_0x504eda+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x6a5e('0x8c')+_0x243769,'If-None-Match':null,'OData-Version':_0x6a5e('0x8d')},'json':!![]};return rp(_0x59e121)[_0x6a5e('0xf')](function(_0x3b83b7){var _0x4177cc={'id':_0x280b26+'_'+_0x3b83b7[_0x6a5e('0x93')],'name':_0x3b83b7[_0x6a5e('0xaf')][_0x6a5e('0xa9')]?_0x3b83b7[_0x6a5e('0xaf')]['UserLocalizedLabel'][_0x6a5e('0xa8')]:_0x3b83b7[_0x6a5e('0x93')],'custom':![],'options':[]};_0x48d48b[_0x6a5e('0x9c')](_0x4177cc);return _0x48d48b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 097c6e6..8ad9b0c 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x208997,_0x584bca){var _0xab7861=function(_0x112dce){while(--_0x112dce){_0x208997['push'](_0x208997['shift']());}};_0xab7861(++_0x584bca);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb7e7[_0x2aec52];return _0x3b8835;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x17045e,_0x4b16a7){var _0x39d01c=function(_0x5405e3){while(--_0x5405e3){_0x17045e['push'](_0x17045e['shift']());}};_0x39d01c(++_0x4b16a7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index e9c3c26..93a6010 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 _0xeccb=['error','code','message','catch','GetDynamics365Account','Dynamics365Account','options','raw','attributes','limit','map','include','model','stringify','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x396539,_0x44d8b3){var _0x35540f=function(_0x4bc016){while(--_0x4bc016){_0x396539['push'](_0x396539['shift']());}};_0x35540f(++_0x44d8b3);}(_0xeccb,0x76));var _0xbecc=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xeccb[_0x1abb09];return _0xea1c07;};'use strict';var _=require('lodash');var util=require(_0xbecc('0x0'));var moment=require(_0xbecc('0x1'));var BPromise=require(_0xbecc('0x2'));var rs=require(_0xbecc('0x3'));var fs=require('fs');var Redis=require(_0xbecc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbecc('0x5'));var logger=require(_0xbecc('0x6'))(_0xbecc('0x7'));var config=require(_0xbecc('0x8'));var jayson=require(_0xbecc('0x9'));var client=jayson[_0xbecc('0xa')][_0xbecc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38085b,_0x16e4b3,_0x3f0a23){return new BPromise(function(_0x14b958,_0x16d590){return client[_0xbecc('0xc')](_0x38085b,_0x3f0a23)[_0xbecc('0xd')](function(_0x51e360){logger[_0xbecc('0xe')](_0xbecc('0xf'),_0x16e4b3,_0xbecc('0x10'));logger[_0xbecc('0x11')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x16e4b3,_0xbecc('0x10'),JSON['stringify'](_0x51e360));if(_0x51e360[_0xbecc('0x12')]){if(_0x51e360[_0xbecc('0x12')][_0xbecc('0x13')]===0x1f4){logger[_0xbecc('0x12')](_0xbecc('0xf'),_0x16e4b3,_0x51e360[_0xbecc('0x12')][_0xbecc('0x14')]);return _0x16d590(_0x51e360['error']['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x16e4b3,_0x51e360[_0xbecc('0x12')][_0xbecc('0x14')]);return _0x14b958(_0x51e360[_0xbecc('0x12')][_0xbecc('0x14')]);}else{logger[_0xbecc('0xe')](_0xbecc('0xf'),_0x16e4b3,_0xbecc('0x10'));_0x14b958(_0x51e360['result']['message']);}})[_0xbecc('0x15')](function(_0x26616d){logger[_0xbecc('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x16e4b3,_0x26616d);_0x16d590(_0x26616d);});});}exports[_0xbecc('0x16')]=function(_0x34ccea){var _0x8f2170=this;return new Promise(function(_0x47e3a0,_0x15ccdf){return db[_0xbecc('0x17')]['findAll']({'raw':_0x34ccea['options']?_0x34ccea[_0xbecc('0x18')][_0xbecc('0x19')]===undefined?!![]:![]:!![],'where':_0x34ccea['options']?_0x34ccea['options']['where']||null:null,'attributes':_0x34ccea[_0xbecc('0x18')]?_0x34ccea[_0xbecc('0x18')][_0xbecc('0x1a')]||null:null,'limit':_0x34ccea[_0xbecc('0x18')]?_0x34ccea['options'][_0xbecc('0x1b')]||null:null,'include':_0x34ccea['options']?_0x34ccea[_0xbecc('0x18')]['include']?_[_0xbecc('0x1c')](_0x34ccea['options'][_0xbecc('0x1d')],function(_0x1e9729){return{'model':db[_0x1e9729[_0xbecc('0x1e')]],'as':_0x1e9729['as'],'attributes':_0x1e9729['attributes'],'include':_0x1e9729['include']?_[_0xbecc('0x1c')](_0x1e9729[_0xbecc('0x1d')],function(_0x1853df){return{'model':db[_0x1853df[_0xbecc('0x1e')]],'as':_0x1853df['as'],'attributes':_0x1853df[_0xbecc('0x1a')],'include':_0x1853df[_0xbecc('0x1d')]?_[_0xbecc('0x1c')](_0x1853df[_0xbecc('0x1d')],function(_0x5bdc9a){return{'model':db[_0x5bdc9a[_0xbecc('0x1e')]],'as':_0x5bdc9a['as'],'attributes':_0x5bdc9a[_0xbecc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30340d){logger[_0xbecc('0xe')](_0xbecc('0x16'),_0x34ccea);logger[_0xbecc('0x11')](_0xbecc('0x16'),_0x34ccea,JSON[_0xbecc('0x1f')](_0x30340d));_0x47e3a0(_0x30340d);})['catch'](function(_0x1a40aa){logger['error'](_0xbecc('0x16'),_0x1a40aa[_0xbecc('0x14')],_0x34ccea);_0x15ccdf(_0x8f2170[_0xbecc('0x12')](0x1f4,_0x1a40aa[_0xbecc('0x14')]));});});};exports[_0xbecc('0x20')]=function(_0x5320e8){var _0x38643f=this;return new Promise(function(_0x28e592,_0x43a924){return db[_0xbecc('0x17')][_0xbecc('0x21')]({'raw':_0x5320e8[_0xbecc('0x18')]?_0x5320e8['options'][_0xbecc('0x19')]===undefined?!![]:![]:!![],'where':_0x5320e8[_0xbecc('0x18')]?_0x5320e8[_0xbecc('0x18')]['where']||null:null,'attributes':_0x5320e8['options']?_0x5320e8[_0xbecc('0x18')]['attributes']||null:null,'include':_0x5320e8[_0xbecc('0x18')]?_0x5320e8[_0xbecc('0x18')]['include']?_[_0xbecc('0x1c')](_0x5320e8['options']['include'],function(_0x5942a8){return{'model':db[_0x5942a8['model']],'as':_0x5942a8['as'],'attributes':_0x5942a8[_0xbecc('0x1a')],'include':_0x5942a8[_0xbecc('0x1d')]?_[_0xbecc('0x1c')](_0x5942a8['include'],function(_0x38c878){return{'model':db[_0x38c878[_0xbecc('0x1e')]],'as':_0x38c878['as'],'attributes':_0x38c878[_0xbecc('0x1a')],'include':_0x38c878[_0xbecc('0x1d')]?_['map'](_0x38c878['include'],function(_0x16ef57){return{'model':db[_0x16ef57[_0xbecc('0x1e')]],'as':_0x16ef57['as'],'attributes':_0x16ef57['attributes']};}):[]};}):[]};}):[]:[]})[_0xbecc('0xd')](function(_0xd7247e){logger[_0xbecc('0xe')]('ShowDynamics365Account',_0x5320e8);logger['debug'](_0xbecc('0x20'),_0x5320e8,JSON[_0xbecc('0x1f')](_0xd7247e));_0x28e592(_0xd7247e);})[_0xbecc('0x15')](function(_0x37e23f){logger[_0xbecc('0x12')](_0xbecc('0x20'),_0x37e23f[_0xbecc('0x14')],_0x5320e8);_0x43a924(_0x38643f[_0xbecc('0x12')](0x1f4,_0x37e23f[_0xbecc('0x14')]));});});}; \ No newline at end of file +var _0xcffe=['jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','then','stringify','catch','ShowDynamics365Account','where','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x24ab02,_0x182381){var _0xca3a22=function(_0x203c9b){while(--_0x203c9b){_0x24ab02['push'](_0x24ab02['shift']());}};_0xca3a22(++_0x182381);}(_0xcffe,0x1e8));var _0xecff=function(_0x1f5873,_0x1497be){_0x1f5873=_0x1f5873-0x0;var _0x2a75d9=_0xcffe[_0x1f5873];return _0x2a75d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xecff('0x0'));var BPromise=require('bluebird');var rs=require(_0xecff('0x1'));var fs=require('fs');var Redis=require(_0xecff('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xecff('0x3'));var logger=require(_0xecff('0x4'))(_0xecff('0x5'));var config=require(_0xecff('0x6'));var jayson=require(_0xecff('0x7'));var client=jayson[_0xecff('0x8')][_0xecff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20b253,_0xd90a2f,_0x4da84f){return new BPromise(function(_0x4cb958,_0x2750ea){return client[_0xecff('0xa')](_0x20b253,_0x4da84f)['then'](function(_0x26abf2){logger[_0xecff('0xb')](_0xecff('0xc'),_0xd90a2f,_0xecff('0xd'));logger[_0xecff('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xd90a2f,_0xecff('0xd'),JSON['stringify'](_0x26abf2));if(_0x26abf2['error']){if(_0x26abf2[_0xecff('0xf')]['code']===0x1f4){logger[_0xecff('0xf')](_0xecff('0xc'),_0xd90a2f,_0x26abf2[_0xecff('0xf')][_0xecff('0x10')]);return _0x2750ea(_0x26abf2[_0xecff('0xf')][_0xecff('0x10')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0xd90a2f,_0x26abf2[_0xecff('0xf')]['message']);return _0x4cb958(_0x26abf2[_0xecff('0xf')][_0xecff('0x10')]);}else{logger[_0xecff('0xb')](_0xecff('0xc'),_0xd90a2f,_0xecff('0xd'));_0x4cb958(_0x26abf2[_0xecff('0x11')][_0xecff('0x10')]);}})['catch'](function(_0x41629f){logger['error'](_0xecff('0xc'),_0xd90a2f,_0x41629f);_0x2750ea(_0x41629f);});});}exports[_0xecff('0x12')]=function(_0x288fdc){var _0x4efdec=this;return new Promise(function(_0xc1957a,_0x522035){return db[_0xecff('0x13')][_0xecff('0x14')]({'raw':_0x288fdc[_0xecff('0x15')]?_0x288fdc[_0xecff('0x15')][_0xecff('0x16')]===undefined?!![]:![]:!![],'where':_0x288fdc[_0xecff('0x15')]?_0x288fdc[_0xecff('0x15')]['where']||null:null,'attributes':_0x288fdc[_0xecff('0x15')]?_0x288fdc[_0xecff('0x15')][_0xecff('0x17')]||null:null,'limit':_0x288fdc[_0xecff('0x15')]?_0x288fdc[_0xecff('0x15')][_0xecff('0x18')]||null:null,'include':_0x288fdc[_0xecff('0x15')]?_0x288fdc[_0xecff('0x15')][_0xecff('0x19')]?_[_0xecff('0x1a')](_0x288fdc[_0xecff('0x15')]['include'],function(_0x5e073a){return{'model':db[_0x5e073a[_0xecff('0x1b')]],'as':_0x5e073a['as'],'attributes':_0x5e073a['attributes'],'include':_0x5e073a[_0xecff('0x19')]?_[_0xecff('0x1a')](_0x5e073a[_0xecff('0x19')],function(_0x3678a9){return{'model':db[_0x3678a9[_0xecff('0x1b')]],'as':_0x3678a9['as'],'attributes':_0x3678a9[_0xecff('0x17')],'include':_0x3678a9[_0xecff('0x19')]?_[_0xecff('0x1a')](_0x3678a9[_0xecff('0x19')],function(_0x492cc7){return{'model':db[_0x492cc7['model']],'as':_0x492cc7['as'],'attributes':_0x492cc7[_0xecff('0x17')]};}):[]};}):[]};}):[]:[]})[_0xecff('0x1c')](function(_0x5408bd){logger[_0xecff('0xb')](_0xecff('0x12'),_0x288fdc);logger[_0xecff('0xe')](_0xecff('0x12'),_0x288fdc,JSON[_0xecff('0x1d')](_0x5408bd));_0xc1957a(_0x5408bd);})[_0xecff('0x1e')](function(_0x369a55){logger['error'](_0xecff('0x12'),_0x369a55[_0xecff('0x10')],_0x288fdc);_0x522035(_0x4efdec[_0xecff('0xf')](0x1f4,_0x369a55[_0xecff('0x10')]));});});};exports[_0xecff('0x1f')]=function(_0x15d18d){var _0x1fd296=this;return new Promise(function(_0x5a53b4,_0x2789c1){return db['Dynamics365Account']['find']({'raw':_0x15d18d['options']?_0x15d18d[_0xecff('0x15')][_0xecff('0x16')]===undefined?!![]:![]:!![],'where':_0x15d18d[_0xecff('0x15')]?_0x15d18d[_0xecff('0x15')][_0xecff('0x20')]||null:null,'attributes':_0x15d18d[_0xecff('0x15')]?_0x15d18d[_0xecff('0x15')]['attributes']||null:null,'include':_0x15d18d[_0xecff('0x15')]?_0x15d18d[_0xecff('0x15')][_0xecff('0x19')]?_['map'](_0x15d18d[_0xecff('0x15')][_0xecff('0x19')],function(_0x28fe69){return{'model':db[_0x28fe69['model']],'as':_0x28fe69['as'],'attributes':_0x28fe69[_0xecff('0x17')],'include':_0x28fe69[_0xecff('0x19')]?_['map'](_0x28fe69[_0xecff('0x19')],function(_0x449388){return{'model':db[_0x449388[_0xecff('0x1b')]],'as':_0x449388['as'],'attributes':_0x449388[_0xecff('0x17')],'include':_0x449388['include']?_[_0xecff('0x1a')](_0x449388[_0xecff('0x19')],function(_0xc7297a){return{'model':db[_0xc7297a['model']],'as':_0xc7297a['as'],'attributes':_0xc7297a[_0xecff('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56c51e){logger[_0xecff('0xb')](_0xecff('0x1f'),_0x15d18d);logger[_0xecff('0xe')]('ShowDynamics365Account',_0x15d18d,JSON[_0xecff('0x1d')](_0x56c51e));_0x5a53b4(_0x56c51e);})['catch'](function(_0xed2155){logger['error'](_0xecff('0x1f'),_0xed2155['message'],_0x15d18d);_0x2789c1(_0x1fd296['error'](0x1f4,_0xed2155[_0xecff('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index fb671ec..460433d 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 _0xc4d8=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id'];(function(_0x547a20,_0xf54950){var _0x40cefd=function(_0x4058a4){while(--_0x4058a4){_0x547a20['push'](_0x547a20['shift']());}};_0x40cefd(++_0xf54950);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xc4d8[_0x334841];return _0x5beb4b;};'use strict';var multer=require(_0x8c4d('0x0'));var util=require('util');var path=require(_0x8c4d('0x1'));var timeout=require(_0x8c4d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8c4d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c4d('0x4'));var controller=require(_0x8c4d('0x5'));router[_0x8c4d('0x6')]('/',auth[_0x8c4d('0x7')](),controller[_0x8c4d('0x8')]);router[_0x8c4d('0x6')](_0x8c4d('0x9'),auth[_0x8c4d('0x7')](),controller[_0x8c4d('0xa')]);router['get'](_0x8c4d('0xb'),auth[_0x8c4d('0x7')](),controller[_0x8c4d('0xc')]);router[_0x8c4d('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8c4d('0xd')]);router[_0x8c4d('0x6')](_0x8c4d('0xe'),auth[_0x8c4d('0x7')](),controller[_0x8c4d('0xf')]);router[_0x8c4d('0x10')]('/',auth[_0x8c4d('0x7')](),controller[_0x8c4d('0x11')]);router['put'](_0x8c4d('0x9'),auth[_0x8c4d('0x7')](),controller[_0x8c4d('0x12')]);router[_0x8c4d('0x13')](_0x8c4d('0x9'),auth[_0x8c4d('0x7')](),controller[_0x8c4d('0x14')]);module[_0x8c4d('0x15')]=router; \ No newline at end of file +var _0xd53c=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','exports'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0xd53c,0xe6));var _0xcd53=function(_0x3e22c2,_0x13ae0b){_0x3e22c2=_0x3e22c2-0x0;var _0x425a22=_0xd53c[_0x3e22c2];return _0x425a22;};'use strict';var multer=require(_0xcd53('0x0'));var util=require(_0xcd53('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd53('0x2'));var router=express[_0xcd53('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcd53('0x4'));var interaction=require(_0xcd53('0x5'));var config=require(_0xcd53('0x6'));var controller=require(_0xcd53('0x7'));router[_0xcd53('0x8')]('/',auth[_0xcd53('0x9')](),controller[_0xcd53('0xa')]);router[_0xcd53('0x8')](_0xcd53('0xb'),auth[_0xcd53('0x9')](),controller[_0xcd53('0xc')]);router['get'](_0xcd53('0xd'),auth['isAuthenticated'](),controller[_0xcd53('0xe')]);router[_0xcd53('0x8')](_0xcd53('0xf'),auth[_0xcd53('0x9')](),controller[_0xcd53('0x10')]);router[_0xcd53('0x8')](_0xcd53('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xcd53('0x12')]('/',auth[_0xcd53('0x9')](),controller['create']);router[_0xcd53('0x13')](_0xcd53('0xb'),auth[_0xcd53('0x9')](),controller[_0xcd53('0x14')]);router[_0xcd53('0x15')](_0xcd53('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xcd53('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 4ed0236..407fbd3 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 _0xbe8a=['nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','contact'];(function(_0x1eda18,_0x2ec45d){var _0x4f6b41=function(_0x5f3cbe){while(--_0x5f3cbe){_0x1eda18['push'](_0x1eda18['shift']());}};_0x4f6b41(++_0x2ec45d);}(_0xbe8a,0x72));var _0xabe8=function(_0x3a9815,_0x47eb16){_0x3a9815=_0x3a9815-0x0;var _0x188653=_0xbe8a[_0x3a9815];return _0x188653;};'use strict';var Sequelize=require(_0xabe8('0x0'));module[_0xabe8('0x1')]={'name':{'type':Sequelize[_0xabe8('0x2')]},'description':{'type':Sequelize[_0xabe8('0x2')]},'ticketType':{'type':Sequelize[_0xabe8('0x3')](_0xabe8('0x4'),'phonecall'),'defaultValue':_0xabe8('0x4')},'moduleCreate':{'type':Sequelize[_0xabe8('0x3')](_0xabe8('0x5'),_0xabe8('0x6')),'defaultValue':_0xabe8('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xabe8('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xabe8('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0662=['STRING','incident','phonecall','ENUM','nothing','contact','BOOLEAN','exports'];(function(_0x118a75,_0x187840){var _0x2f9070=function(_0x292fee){while(--_0x292fee){_0x118a75['push'](_0x118a75['shift']());}};_0x2f9070(++_0x187840);}(_0x0662,0xdf));var _0x2066=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x0662[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require('sequelize');module[_0x2066('0x0')]={'name':{'type':Sequelize[_0x2066('0x1')]},'description':{'type':Sequelize[_0x2066('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x2066('0x2'),_0x2066('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x2066('0x4')]('contact',_0x2066('0x5')),'defaultValue':_0x2066('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2066('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 9a7bc83..d0a0836 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 _0x96df=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','find','destroy','findOne','keys','Dynamics365Field','getFields','getSubjects','getDescriptions','eml-format'];(function(_0x1fe956,_0x20b1c1){var _0x29cd43=function(_0x1fda2d){while(--_0x1fda2d){_0x1fe956['push'](_0x1fe956['shift']());}};_0x29cd43(++_0x20b1c1);}(_0x96df,0x147));var _0xf96d=function(_0x58e253,_0x30a9c3){_0x58e253=_0x58e253-0x0;var _0x2ffe75=_0x96df[_0x58e253];return _0x2ffe75;};'use strict';var emlformat=require(_0xf96d('0x0'));var rimraf=require(_0xf96d('0x1'));var zipdir=require(_0xf96d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf96d('0x3'));var moment=require(_0xf96d('0x4'));var BPromise=require(_0xf96d('0x5'));var Mustache=require(_0xf96d('0x6'));var util=require(_0xf96d('0x7'));var path=require(_0xf96d('0x8'));var sox=require(_0xf96d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf96d('0xa'));var squel=require(_0xf96d('0xb'));var crypto=require(_0xf96d('0xc'));var jsforce=require(_0xf96d('0xd'));var deskjs=require(_0xf96d('0xe'));var toCsv=require(_0xf96d('0xf'));var querystring=require(_0xf96d('0x10'));var Papa=require(_0xf96d('0x11'));var Redis=require(_0xf96d('0x12'));var authService=require(_0xf96d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf96d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf96d('0x15'))(_0xf96d('0x16'));var utils=require(_0xf96d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf96d('0x18'));var db=require(_0xf96d('0x19'))['db'];function respondWithStatusCode(_0x52ecde,_0x4bdead){_0x4bdead=_0x4bdead||0xcc;return function(_0x4365f8){if(_0x4365f8){return _0x52ecde[_0xf96d('0x1a')](_0x4bdead);}return _0x52ecde['status'](_0x4bdead)['end']();};}function respondWithResult(_0x167a54,_0x3f02e8){_0x3f02e8=_0x3f02e8||0xc8;return function(_0x234363){if(_0x234363){return _0x167a54[_0xf96d('0x1b')](_0x3f02e8)[_0xf96d('0x1c')](_0x234363);}};}function respondWithFilteredResult(_0x188a2d,_0x35d67e){return function(_0x30237b){if(_0x30237b){var _0x2148dd=typeof _0x35d67e[_0xf96d('0x1d')]===_0xf96d('0x1e')&&typeof _0x35d67e[_0xf96d('0x1f')]===_0xf96d('0x1e');var _0x156337=_0x30237b[_0xf96d('0x20')];var _0x3993ca=_0x2148dd?0x0:_0x35d67e[_0xf96d('0x1d')];var _0xd9639c=_0x2148dd?_0x30237b[_0xf96d('0x20')]:_0x35d67e[_0xf96d('0x1d')]+_0x35d67e[_0xf96d('0x1f')];var _0x179ece;if(_0xd9639c>=_0x156337){_0xd9639c=_0x156337;_0x179ece=0xc8;}else{_0x179ece=0xce;}_0x188a2d[_0xf96d('0x1b')](_0x179ece);return _0x188a2d[_0xf96d('0x21')]('Content-Range',_0x3993ca+'-'+_0xd9639c+'/'+_0x156337)['json'](_0x30237b);}return null;};}function patchUpdates(_0x3d3e3f){return function(_0x382d5c){try{jsonpatch[_0xf96d('0x22')](_0x382d5c,_0x3d3e3f,!![]);}catch(_0x4e1f97){return BPromise[_0xf96d('0x23')](_0x4e1f97);}return _0x382d5c[_0xf96d('0x24')]();};}function saveUpdates(_0x4312e1,_0x377300){return function(_0x44574d){if(_0x44574d){return _0x44574d[_0xf96d('0x25')](_0x4312e1)['then'](function(_0x1b2010){return _0x1b2010;});}return null;};}function removeEntity(_0x3cd8fa,_0x4c8df0){return function(_0x15f17b){if(_0x15f17b){return _0x15f17b['destroy']()[_0xf96d('0x26')](function(){_0x3cd8fa[_0xf96d('0x1b')](0xcc)[_0xf96d('0x27')]();});}};}function handleEntityNotFound(_0x4b873a,_0xab08fb){return function(_0x1cb292){if(!_0x1cb292){_0x4b873a[_0xf96d('0x1a')](0x194);}return _0x1cb292;};}function handleError(_0x272075,_0x5bb0ee){_0x5bb0ee=_0x5bb0ee||0x1f4;return function(_0x404082){logger[_0xf96d('0x28')](_0x404082[_0xf96d('0x29')]);if(_0x404082[_0xf96d('0x2a')]){delete _0x404082[_0xf96d('0x2a')];}_0x272075[_0xf96d('0x1b')](_0x5bb0ee)[_0xf96d('0x2b')](_0x404082);};}exports[_0xf96d('0x2c')]=function(_0x5a391,_0x140eec){var _0x104909={},_0x55d5aa={},_0x2fa48f={'count':0x0,'rows':[]};var _0x49d574=_[_0xf96d('0x2d')](db[_0xf96d('0x2e')][_0xf96d('0x2f')],function(_0x58046e){return{'name':_0x58046e['fieldName'],'type':_0x58046e['type']['key']};});_0x55d5aa[_0xf96d('0x30')]=_[_0xf96d('0x2d')](_0x49d574,_0xf96d('0x2a'));_0x55d5aa[_0xf96d('0x31')]=_['keys'](_0x5a391['query']);_0x55d5aa[_0xf96d('0x32')]=_['intersection'](_0x55d5aa['model'],_0x55d5aa[_0xf96d('0x31')]);_0x104909[_0xf96d('0x33')]=_[_0xf96d('0x34')](_0x55d5aa['model'],qs[_0xf96d('0x35')](_0x5a391[_0xf96d('0x31')][_0xf96d('0x35')]));_0x104909[_0xf96d('0x33')]=_0x104909['attributes'][_0xf96d('0x36')]?_0x104909[_0xf96d('0x33')]:_0x55d5aa[_0xf96d('0x30')];if(!_0x5a391['query'][_0xf96d('0x37')](_0xf96d('0x38'))){_0x104909['limit']=qs['limit'](_0x5a391[_0xf96d('0x31')]['limit']);_0x104909[_0xf96d('0x1d')]=qs[_0xf96d('0x1d')](_0x5a391['query'][_0xf96d('0x1d')]);}_0x104909[_0xf96d('0x39')]=qs[_0xf96d('0x3a')](_0x5a391[_0xf96d('0x31')][_0xf96d('0x3a')]);_0x104909[_0xf96d('0x3b')]=qs[_0xf96d('0x32')](_[_0xf96d('0x3c')](_0x5a391['query'],_0x55d5aa[_0xf96d('0x32')]),_0x49d574);if(_0x5a391[_0xf96d('0x31')][_0xf96d('0x3d')]){_0x104909[_0xf96d('0x3b')]=_[_0xf96d('0x3e')](_0x104909[_0xf96d('0x3b')],{'$or':_[_0xf96d('0x2d')](_0x49d574,function(_0x32dfe7){if(_0x32dfe7[_0xf96d('0x3f')]!==_0xf96d('0x40')){var _0x1fe8a4={};_0x1fe8a4[_0x32dfe7[_0xf96d('0x2a')]]={'$like':'%'+_0x5a391[_0xf96d('0x31')][_0xf96d('0x3d')]+'%'};return _0x1fe8a4;}})});}_0x104909=_[_0xf96d('0x3e')]({},_0x104909,_0x5a391[_0xf96d('0x41')]);var _0x182043={'where':_0x104909[_0xf96d('0x3b')]};return db['Dynamics365Configuration']['count'](_0x182043)[_0xf96d('0x26')](function(_0x149953){_0x2fa48f[_0xf96d('0x20')]=_0x149953;if(_0x5a391['query'][_0xf96d('0x42')]){_0x104909['include']=[{'all':!![]}];}return db[_0xf96d('0x2e')][_0xf96d('0x43')](_0x104909);})[_0xf96d('0x26')](function(_0x2f07a7){_0x2fa48f[_0xf96d('0x44')]=_0x2f07a7;return _0x2fa48f;})[_0xf96d('0x26')](respondWithFilteredResult(_0x140eec,_0x104909))[_0xf96d('0x45')](handleError(_0x140eec,null));};exports['show']=function(_0x4f24c3,_0x2bc937){var _0x140e80={'raw':![],'where':{'id':_0x4f24c3[_0xf96d('0x46')]['id']}},_0xab510c={};_0xab510c[_0xf96d('0x30')]=_['keys'](db[_0xf96d('0x2e')][_0xf96d('0x2f')]);_0xab510c['query']=_['keys'](_0x4f24c3[_0xf96d('0x31')]);_0xab510c[_0xf96d('0x32')]=_[_0xf96d('0x34')](_0xab510c[_0xf96d('0x30')],_0xab510c[_0xf96d('0x31')]);_0x140e80[_0xf96d('0x33')]=_[_0xf96d('0x34')](_0xab510c[_0xf96d('0x30')],qs['fields'](_0x4f24c3[_0xf96d('0x31')]['fields']));_0x140e80[_0xf96d('0x33')]=_0x140e80['attributes'][_0xf96d('0x36')]?_0x140e80['attributes']:_0xab510c[_0xf96d('0x30')];if(_0x4f24c3['query'][_0xf96d('0x42')]){_0x140e80[_0xf96d('0x47')]=[{'all':!![]}];}_0x140e80=_['merge']({},_0x140e80,_0x4f24c3[_0xf96d('0x41')]);return db['Dynamics365Configuration']['find'](_0x140e80)[_0xf96d('0x26')](handleEntityNotFound(_0x2bc937,null))[_0xf96d('0x26')](respondWithResult(_0x2bc937,null))[_0xf96d('0x45')](handleError(_0x2bc937,null));};exports[_0xf96d('0x48')]=function(_0x47e4b6,_0x4072e1){return db['Dynamics365Configuration'][_0xf96d('0x48')](_0x47e4b6[_0xf96d('0x49')],{})[_0xf96d('0x26')](respondWithResult(_0x4072e1,0xc9))[_0xf96d('0x45')](handleError(_0x4072e1,null));};exports[_0xf96d('0x25')]=function(_0x20858b,_0xce9a18){if(_0x20858b[_0xf96d('0x49')]['id']){delete _0x20858b[_0xf96d('0x49')]['id'];}return db[_0xf96d('0x2e')][_0xf96d('0x4a')]({'where':{'id':_0x20858b[_0xf96d('0x46')]['id']}})[_0xf96d('0x26')](handleEntityNotFound(_0xce9a18,null))['then'](saveUpdates(_0x20858b[_0xf96d('0x49')],null))[_0xf96d('0x26')](respondWithResult(_0xce9a18,null))[_0xf96d('0x45')](handleError(_0xce9a18,null));};exports[_0xf96d('0x4b')]=function(_0x33e042,_0x332505){return db[_0xf96d('0x2e')][_0xf96d('0x4a')]({'where':{'id':_0x33e042[_0xf96d('0x46')]['id']}})[_0xf96d('0x26')](handleEntityNotFound(_0x332505,null))['then'](removeEntity(_0x332505,null))[_0xf96d('0x45')](handleError(_0x332505,null));};exports['getFields']=function(_0x1c1cc4,_0x36d820,_0x3ad7da){var _0x30c745={};var _0x4dc3ed={};var _0x5e12ed;var _0x29a8fc;return db[_0xf96d('0x2e')][_0xf96d('0x4c')]({'where':{'id':_0x1c1cc4[_0xf96d('0x46')]['id']}})[_0xf96d('0x26')](handleEntityNotFound(_0x36d820,null))['then'](function(_0x2015d9){if(_0x2015d9){_0x5e12ed=_0x2015d9;_0x4dc3ed[_0xf96d('0x30')]=_[_0xf96d('0x4d')](db[_0xf96d('0x4e')]['rawAttributes']);_0x4dc3ed[_0xf96d('0x31')]=_[_0xf96d('0x4d')](_0x1c1cc4[_0xf96d('0x31')]);_0x4dc3ed[_0xf96d('0x32')]=_['intersection'](_0x4dc3ed['model'],_0x4dc3ed[_0xf96d('0x31')]);_0x30c745[_0xf96d('0x33')]=_[_0xf96d('0x34')](_0x4dc3ed['model'],qs[_0xf96d('0x35')](_0x1c1cc4[_0xf96d('0x31')]['fields']));_0x30c745[_0xf96d('0x33')]=_0x30c745[_0xf96d('0x33')][_0xf96d('0x36')]?_0x30c745['attributes']:_0x4dc3ed['model'];_0x30c745[_0xf96d('0x39')]=qs[_0xf96d('0x3a')](_0x1c1cc4['query'][_0xf96d('0x3a')]);_0x30c745[_0xf96d('0x3b')]=qs[_0xf96d('0x32')](_[_0xf96d('0x3c')](_0x1c1cc4[_0xf96d('0x31')],_0x4dc3ed[_0xf96d('0x32')]));if(_0x1c1cc4[_0xf96d('0x31')][_0xf96d('0x3d')]){_0x30c745[_0xf96d('0x3b')]=_['merge'](_0x30c745[_0xf96d('0x3b')],{'$or':_[_0xf96d('0x2d')](_0x30c745[_0xf96d('0x33')],function(_0x1866d2){var _0x4465e4={};_0x4465e4[_0x1866d2]={'$like':'%'+_0x1c1cc4[_0xf96d('0x31')][_0xf96d('0x3d')]+'%'};return _0x4465e4;})});}_0x30c745=_[_0xf96d('0x3e')]({},_0x30c745,_0x1c1cc4[_0xf96d('0x41')]);return _0x5e12ed[_0xf96d('0x4f')](_0x30c745);}})[_0xf96d('0x26')](function(_0x78ad85){if(_0x78ad85){_0x29a8fc=_0x78ad85[_0xf96d('0x36')];if(!_0x1c1cc4[_0xf96d('0x31')]['hasOwnProperty'](_0xf96d('0x38'))){_0x30c745[_0xf96d('0x1f')]=qs[_0xf96d('0x1f')](_0x1c1cc4[_0xf96d('0x31')][_0xf96d('0x1f')]);_0x30c745[_0xf96d('0x1d')]=qs[_0xf96d('0x1d')](_0x1c1cc4[_0xf96d('0x31')][_0xf96d('0x1d')]);}return _0x5e12ed['getFields'](_0x30c745);}})[_0xf96d('0x26')](function(_0x282016){if(_0x282016){return _0x282016?{'count':_0x29a8fc,'rows':_0x282016}:null;}})[_0xf96d('0x26')](respondWithResult(_0x36d820,null))['catch'](handleError(_0x36d820,null));};exports[_0xf96d('0x50')]=function(_0x171fbd,_0x3fe4a9,_0x5b7484){var _0x5504e9={};var _0xb32baf={};var _0x348dc5;var _0x30a21d;return db[_0xf96d('0x2e')]['findOne']({'where':{'id':_0x171fbd[_0xf96d('0x46')]['id']}})[_0xf96d('0x26')](handleEntityNotFound(_0x3fe4a9,null))[_0xf96d('0x26')](function(_0x122418){if(_0x122418){_0x348dc5=_0x122418;_0xb32baf[_0xf96d('0x30')]=_[_0xf96d('0x4d')](db[_0xf96d('0x4e')][_0xf96d('0x2f')]);_0xb32baf[_0xf96d('0x31')]=_[_0xf96d('0x4d')](_0x171fbd[_0xf96d('0x31')]);_0xb32baf[_0xf96d('0x32')]=_[_0xf96d('0x34')](_0xb32baf[_0xf96d('0x30')],_0xb32baf[_0xf96d('0x31')]);_0x5504e9[_0xf96d('0x33')]=_[_0xf96d('0x34')](_0xb32baf[_0xf96d('0x30')],qs['fields'](_0x171fbd[_0xf96d('0x31')][_0xf96d('0x35')]));_0x5504e9[_0xf96d('0x33')]=_0x5504e9['attributes'][_0xf96d('0x36')]?_0x5504e9['attributes']:_0xb32baf[_0xf96d('0x30')];_0x5504e9[_0xf96d('0x39')]=qs[_0xf96d('0x3a')](_0x171fbd['query'][_0xf96d('0x3a')]);_0x5504e9[_0xf96d('0x3b')]=qs[_0xf96d('0x32')](_[_0xf96d('0x3c')](_0x171fbd['query'],_0xb32baf[_0xf96d('0x32')]));if(_0x171fbd['query'][_0xf96d('0x3d')]){_0x5504e9[_0xf96d('0x3b')]=_[_0xf96d('0x3e')](_0x5504e9[_0xf96d('0x3b')],{'$or':_[_0xf96d('0x2d')](_0x5504e9[_0xf96d('0x33')],function(_0x4ac386){var _0x582c62={};_0x582c62[_0x4ac386]={'$like':'%'+_0x171fbd[_0xf96d('0x31')][_0xf96d('0x3d')]+'%'};return _0x582c62;})});}_0x5504e9=_[_0xf96d('0x3e')]({},_0x5504e9,_0x171fbd['options']);return _0x348dc5[_0xf96d('0x50')](_0x5504e9);}})[_0xf96d('0x26')](function(_0x33b6fd){if(_0x33b6fd){_0x30a21d=_0x33b6fd['length'];if(!_0x171fbd['query'][_0xf96d('0x37')]('nolimit')){_0x5504e9['limit']=qs['limit'](_0x171fbd[_0xf96d('0x31')][_0xf96d('0x1f')]);_0x5504e9[_0xf96d('0x1d')]=qs[_0xf96d('0x1d')](_0x171fbd['query'][_0xf96d('0x1d')]);}return _0x348dc5['getSubjects'](_0x5504e9);}})[_0xf96d('0x26')](function(_0x4f14a0){if(_0x4f14a0){return _0x4f14a0?{'count':_0x30a21d,'rows':_0x4f14a0}:null;}})[_0xf96d('0x26')](respondWithResult(_0x3fe4a9,null))[_0xf96d('0x45')](handleError(_0x3fe4a9,null));};exports[_0xf96d('0x51')]=function(_0x399a30,_0x14aa98,_0xdb317b){var _0x1c2a73={};var _0x3a5655={};var _0x56d506;var _0x3560af;return db[_0xf96d('0x2e')][_0xf96d('0x4c')]({'where':{'id':_0x399a30['params']['id']}})[_0xf96d('0x26')](handleEntityNotFound(_0x14aa98,null))[_0xf96d('0x26')](function(_0x22e56a){if(_0x22e56a){_0x56d506=_0x22e56a;_0x3a5655[_0xf96d('0x30')]=_[_0xf96d('0x4d')](db['Dynamics365Field'][_0xf96d('0x2f')]);_0x3a5655['query']=_[_0xf96d('0x4d')](_0x399a30[_0xf96d('0x31')]);_0x3a5655[_0xf96d('0x32')]=_[_0xf96d('0x34')](_0x3a5655[_0xf96d('0x30')],_0x3a5655[_0xf96d('0x31')]);_0x1c2a73[_0xf96d('0x33')]=_[_0xf96d('0x34')](_0x3a5655[_0xf96d('0x30')],qs[_0xf96d('0x35')](_0x399a30[_0xf96d('0x31')]['fields']));_0x1c2a73[_0xf96d('0x33')]=_0x1c2a73[_0xf96d('0x33')]['length']?_0x1c2a73[_0xf96d('0x33')]:_0x3a5655[_0xf96d('0x30')];_0x1c2a73[_0xf96d('0x39')]=qs[_0xf96d('0x3a')](_0x399a30['query'][_0xf96d('0x3a')]);_0x1c2a73[_0xf96d('0x3b')]=qs['filters'](_[_0xf96d('0x3c')](_0x399a30['query'],_0x3a5655[_0xf96d('0x32')]));if(_0x399a30[_0xf96d('0x31')][_0xf96d('0x3d')]){_0x1c2a73[_0xf96d('0x3b')]=_[_0xf96d('0x3e')](_0x1c2a73[_0xf96d('0x3b')],{'$or':_[_0xf96d('0x2d')](_0x1c2a73[_0xf96d('0x33')],function(_0xd0114){var _0x3ed2e3={};_0x3ed2e3[_0xd0114]={'$like':'%'+_0x399a30['query']['filter']+'%'};return _0x3ed2e3;})});}_0x1c2a73=_[_0xf96d('0x3e')]({},_0x1c2a73,_0x399a30[_0xf96d('0x41')]);return _0x56d506[_0xf96d('0x51')](_0x1c2a73);}})['then'](function(_0x5be5da){if(_0x5be5da){_0x3560af=_0x5be5da[_0xf96d('0x36')];if(!_0x399a30['query']['hasOwnProperty'](_0xf96d('0x38'))){_0x1c2a73[_0xf96d('0x1f')]=qs['limit'](_0x399a30['query'][_0xf96d('0x1f')]);_0x1c2a73[_0xf96d('0x1d')]=qs[_0xf96d('0x1d')](_0x399a30[_0xf96d('0x31')][_0xf96d('0x1d')]);}return _0x56d506[_0xf96d('0x51')](_0x1c2a73);}})['then'](function(_0x18a8c1){if(_0x18a8c1){return _0x18a8c1?{'count':_0x3560af,'rows':_0x18a8c1}:null;}})[_0xf96d('0x26')](respondWithResult(_0x14aa98,null))[_0xf96d('0x45')](handleError(_0x14aa98,null));}; \ No newline at end of file +var _0xfd60=['update','then','destroy','stack','name','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','show','find','create','body','catch','findOne','params','Dynamics365Field','order','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x4b2494,_0x494d41){var _0x2c1436=function(_0x3eaf82){while(--_0x3eaf82){_0x4b2494['push'](_0x4b2494['shift']());}};_0x2c1436(++_0x494d41);}(_0xfd60,0x1ba));var _0x0fd6=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0xfd60[_0x11b58d];return _0xc2811b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fd6('0x0'));var zipdir=require(_0x0fd6('0x1'));var jsonpatch=require(_0x0fd6('0x2'));var rp=require(_0x0fd6('0x3'));var moment=require('moment');var BPromise=require(_0x0fd6('0x4'));var Mustache=require('mustache');var util=require(_0x0fd6('0x5'));var path=require(_0x0fd6('0x6'));var sox=require(_0x0fd6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0fd6('0x8'));var _=require(_0x0fd6('0x9'));var squel=require(_0x0fd6('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0fd6('0xb'));var querystring=require(_0x0fd6('0xc'));var Papa=require(_0x0fd6('0xd'));var Redis=require(_0x0fd6('0xe'));var authService=require(_0x0fd6('0xf'));var qs=require(_0x0fd6('0x10'));var as=require(_0x0fd6('0x11'));var hardwareService=require(_0x0fd6('0x12'));var logger=require(_0x0fd6('0x13'))(_0x0fd6('0x14'));var utils=require(_0x0fd6('0x15'));var config=require(_0x0fd6('0x16'));var licenseUtil=require(_0x0fd6('0x17'));var db=require(_0x0fd6('0x18'))['db'];function respondWithStatusCode(_0xc51a9b,_0x1cff5e){_0x1cff5e=_0x1cff5e||0xcc;return function(_0x1c58e8){if(_0x1c58e8){return _0xc51a9b[_0x0fd6('0x19')](_0x1cff5e);}return _0xc51a9b[_0x0fd6('0x1a')](_0x1cff5e)[_0x0fd6('0x1b')]();};}function respondWithResult(_0x1a2de2,_0x52ea52){_0x52ea52=_0x52ea52||0xc8;return function(_0x447302){if(_0x447302){return _0x1a2de2[_0x0fd6('0x1a')](_0x52ea52)[_0x0fd6('0x1c')](_0x447302);}};}function respondWithFilteredResult(_0x2f89b1,_0x2ba294){return function(_0x54a9e8){if(_0x54a9e8){var _0x733f9a=typeof _0x2ba294[_0x0fd6('0x1d')]===_0x0fd6('0x1e')&&typeof _0x2ba294[_0x0fd6('0x1f')]===_0x0fd6('0x1e');var _0x3e0fc3=_0x54a9e8[_0x0fd6('0x20')];var _0x36b28c=_0x733f9a?0x0:_0x2ba294[_0x0fd6('0x1d')];var _0x300e34=_0x733f9a?_0x54a9e8[_0x0fd6('0x20')]:_0x2ba294[_0x0fd6('0x1d')]+_0x2ba294[_0x0fd6('0x1f')];var _0x272b85;if(_0x300e34>=_0x3e0fc3){_0x300e34=_0x3e0fc3;_0x272b85=0xc8;}else{_0x272b85=0xce;}_0x2f89b1[_0x0fd6('0x1a')](_0x272b85);return _0x2f89b1[_0x0fd6('0x21')](_0x0fd6('0x22'),_0x36b28c+'-'+_0x300e34+'/'+_0x3e0fc3)[_0x0fd6('0x1c')](_0x54a9e8);}return null;};}function patchUpdates(_0x16e775){return function(_0x57ed60){try{jsonpatch[_0x0fd6('0x23')](_0x57ed60,_0x16e775,!![]);}catch(_0x28567b){return BPromise[_0x0fd6('0x24')](_0x28567b);}return _0x57ed60[_0x0fd6('0x25')]();};}function saveUpdates(_0x473e69,_0x33ecd8){return function(_0x37cc69){if(_0x37cc69){return _0x37cc69[_0x0fd6('0x26')](_0x473e69)[_0x0fd6('0x27')](function(_0x22eefc){return _0x22eefc;});}return null;};}function removeEntity(_0x3376c2,_0x3ee4bc){return function(_0x4bb91a){if(_0x4bb91a){return _0x4bb91a[_0x0fd6('0x28')]()[_0x0fd6('0x27')](function(){_0x3376c2[_0x0fd6('0x1a')](0xcc)[_0x0fd6('0x1b')]();});}};}function handleEntityNotFound(_0x327910,_0x18657f){return function(_0x49017d){if(!_0x49017d){_0x327910[_0x0fd6('0x19')](0x194);}return _0x49017d;};}function handleError(_0x31095f,_0x457624){_0x457624=_0x457624||0x1f4;return function(_0x13dd9d){logger['error'](_0x13dd9d[_0x0fd6('0x29')]);if(_0x13dd9d['name']){delete _0x13dd9d[_0x0fd6('0x2a')];}_0x31095f[_0x0fd6('0x1a')](_0x457624)['send'](_0x13dd9d);};}exports['index']=function(_0x3a040e,_0x5104a5){var _0x54b4bf={},_0x47acd0={},_0x115f08={'count':0x0,'rows':[]};var _0x381e71=_['map'](db['Dynamics365Configuration'][_0x0fd6('0x2b')],function(_0x3acb64){return{'name':_0x3acb64['fieldName'],'type':_0x3acb64[_0x0fd6('0x2c')][_0x0fd6('0x2d')]};});_0x47acd0[_0x0fd6('0x2e')]=_[_0x0fd6('0x2f')](_0x381e71,_0x0fd6('0x2a'));_0x47acd0[_0x0fd6('0x30')]=_[_0x0fd6('0x31')](_0x3a040e['query']);_0x47acd0['filters']=_[_0x0fd6('0x32')](_0x47acd0[_0x0fd6('0x2e')],_0x47acd0[_0x0fd6('0x30')]);_0x54b4bf[_0x0fd6('0x33')]=_['intersection'](_0x47acd0[_0x0fd6('0x2e')],qs[_0x0fd6('0x34')](_0x3a040e['query'][_0x0fd6('0x34')]));_0x54b4bf[_0x0fd6('0x33')]=_0x54b4bf['attributes'][_0x0fd6('0x35')]?_0x54b4bf[_0x0fd6('0x33')]:_0x47acd0['model'];if(!_0x3a040e['query'][_0x0fd6('0x36')](_0x0fd6('0x37'))){_0x54b4bf['limit']=qs[_0x0fd6('0x1f')](_0x3a040e[_0x0fd6('0x30')][_0x0fd6('0x1f')]);_0x54b4bf[_0x0fd6('0x1d')]=qs[_0x0fd6('0x1d')](_0x3a040e[_0x0fd6('0x30')][_0x0fd6('0x1d')]);}_0x54b4bf['order']=qs['sort'](_0x3a040e[_0x0fd6('0x30')][_0x0fd6('0x38')]);_0x54b4bf[_0x0fd6('0x39')]=qs[_0x0fd6('0x3a')](_[_0x0fd6('0x3b')](_0x3a040e[_0x0fd6('0x30')],_0x47acd0['filters']),_0x381e71);if(_0x3a040e[_0x0fd6('0x30')][_0x0fd6('0x3c')]){_0x54b4bf[_0x0fd6('0x39')]=_[_0x0fd6('0x3d')](_0x54b4bf[_0x0fd6('0x39')],{'$or':_['map'](_0x381e71,function(_0x347f62){if(_0x347f62[_0x0fd6('0x2c')]!=='VIRTUAL'){var _0x519d32={};_0x519d32[_0x347f62['name']]={'$like':'%'+_0x3a040e[_0x0fd6('0x30')]['filter']+'%'};return _0x519d32;}})});}_0x54b4bf=_[_0x0fd6('0x3d')]({},_0x54b4bf,_0x3a040e[_0x0fd6('0x3e')]);var _0x3e21ce={'where':_0x54b4bf[_0x0fd6('0x39')]};return db[_0x0fd6('0x3f')][_0x0fd6('0x20')](_0x3e21ce)[_0x0fd6('0x27')](function(_0x16cbd8){_0x115f08['count']=_0x16cbd8;if(_0x3a040e[_0x0fd6('0x30')][_0x0fd6('0x40')]){_0x54b4bf[_0x0fd6('0x41')]=[{'all':!![]}];}return db[_0x0fd6('0x3f')][_0x0fd6('0x42')](_0x54b4bf);})[_0x0fd6('0x27')](function(_0x4a38d1){_0x115f08[_0x0fd6('0x43')]=_0x4a38d1;return _0x115f08;})[_0x0fd6('0x27')](respondWithFilteredResult(_0x5104a5,_0x54b4bf))['catch'](handleError(_0x5104a5,null));};exports[_0x0fd6('0x44')]=function(_0x32f450,_0x4f2af5){var _0x8c0a8={'raw':![],'where':{'id':_0x32f450['params']['id']}},_0xb09042={};_0xb09042[_0x0fd6('0x2e')]=_[_0x0fd6('0x31')](db['Dynamics365Configuration'][_0x0fd6('0x2b')]);_0xb09042[_0x0fd6('0x30')]=_['keys'](_0x32f450['query']);_0xb09042['filters']=_[_0x0fd6('0x32')](_0xb09042[_0x0fd6('0x2e')],_0xb09042['query']);_0x8c0a8['attributes']=_[_0x0fd6('0x32')](_0xb09042['model'],qs[_0x0fd6('0x34')](_0x32f450[_0x0fd6('0x30')][_0x0fd6('0x34')]));_0x8c0a8['attributes']=_0x8c0a8['attributes']['length']?_0x8c0a8[_0x0fd6('0x33')]:_0xb09042['model'];if(_0x32f450['query']['includeAll']){_0x8c0a8[_0x0fd6('0x41')]=[{'all':!![]}];}_0x8c0a8=_[_0x0fd6('0x3d')]({},_0x8c0a8,_0x32f450[_0x0fd6('0x3e')]);return db[_0x0fd6('0x3f')][_0x0fd6('0x45')](_0x8c0a8)[_0x0fd6('0x27')](handleEntityNotFound(_0x4f2af5,null))[_0x0fd6('0x27')](respondWithResult(_0x4f2af5,null))['catch'](handleError(_0x4f2af5,null));};exports[_0x0fd6('0x46')]=function(_0x218397,_0x1b5717){return db[_0x0fd6('0x3f')][_0x0fd6('0x46')](_0x218397[_0x0fd6('0x47')],{})[_0x0fd6('0x27')](respondWithResult(_0x1b5717,0xc9))[_0x0fd6('0x48')](handleError(_0x1b5717,null));};exports[_0x0fd6('0x26')]=function(_0x552a41,_0x5b9fe2){if(_0x552a41[_0x0fd6('0x47')]['id']){delete _0x552a41[_0x0fd6('0x47')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x552a41['params']['id']}})[_0x0fd6('0x27')](handleEntityNotFound(_0x5b9fe2,null))[_0x0fd6('0x27')](saveUpdates(_0x552a41['body'],null))[_0x0fd6('0x27')](respondWithResult(_0x5b9fe2,null))[_0x0fd6('0x48')](handleError(_0x5b9fe2,null));};exports['destroy']=function(_0x36f03,_0x28b3c2){return db['Dynamics365Configuration'][_0x0fd6('0x45')]({'where':{'id':_0x36f03['params']['id']}})[_0x0fd6('0x27')](handleEntityNotFound(_0x28b3c2,null))[_0x0fd6('0x27')](removeEntity(_0x28b3c2,null))['catch'](handleError(_0x28b3c2,null));};exports['getFields']=function(_0x4e11e5,_0x14a84d,_0x5926bb){var _0x55cfbf={};var _0x233c9a={};var _0x18de21;var _0x26a595;return db[_0x0fd6('0x3f')][_0x0fd6('0x49')]({'where':{'id':_0x4e11e5[_0x0fd6('0x4a')]['id']}})[_0x0fd6('0x27')](handleEntityNotFound(_0x14a84d,null))[_0x0fd6('0x27')](function(_0x4e098e){if(_0x4e098e){_0x18de21=_0x4e098e;_0x233c9a[_0x0fd6('0x2e')]=_[_0x0fd6('0x31')](db[_0x0fd6('0x4b')][_0x0fd6('0x2b')]);_0x233c9a[_0x0fd6('0x30')]=_['keys'](_0x4e11e5['query']);_0x233c9a[_0x0fd6('0x3a')]=_['intersection'](_0x233c9a[_0x0fd6('0x2e')],_0x233c9a[_0x0fd6('0x30')]);_0x55cfbf[_0x0fd6('0x33')]=_['intersection'](_0x233c9a['model'],qs[_0x0fd6('0x34')](_0x4e11e5[_0x0fd6('0x30')][_0x0fd6('0x34')]));_0x55cfbf[_0x0fd6('0x33')]=_0x55cfbf['attributes'][_0x0fd6('0x35')]?_0x55cfbf[_0x0fd6('0x33')]:_0x233c9a[_0x0fd6('0x2e')];_0x55cfbf[_0x0fd6('0x4c')]=qs[_0x0fd6('0x38')](_0x4e11e5[_0x0fd6('0x30')]['sort']);_0x55cfbf['where']=qs[_0x0fd6('0x3a')](_[_0x0fd6('0x3b')](_0x4e11e5[_0x0fd6('0x30')],_0x233c9a[_0x0fd6('0x3a')]));if(_0x4e11e5['query'][_0x0fd6('0x3c')]){_0x55cfbf['where']=_[_0x0fd6('0x3d')](_0x55cfbf['where'],{'$or':_[_0x0fd6('0x2f')](_0x55cfbf[_0x0fd6('0x33')],function(_0x413cb4){var _0x26e4db={};_0x26e4db[_0x413cb4]={'$like':'%'+_0x4e11e5[_0x0fd6('0x30')]['filter']+'%'};return _0x26e4db;})});}_0x55cfbf=_[_0x0fd6('0x3d')]({},_0x55cfbf,_0x4e11e5[_0x0fd6('0x3e')]);return _0x18de21[_0x0fd6('0x4d')](_0x55cfbf);}})[_0x0fd6('0x27')](function(_0x251789){if(_0x251789){_0x26a595=_0x251789[_0x0fd6('0x35')];if(!_0x4e11e5[_0x0fd6('0x30')][_0x0fd6('0x36')]('nolimit')){_0x55cfbf[_0x0fd6('0x1f')]=qs[_0x0fd6('0x1f')](_0x4e11e5[_0x0fd6('0x30')][_0x0fd6('0x1f')]);_0x55cfbf[_0x0fd6('0x1d')]=qs[_0x0fd6('0x1d')](_0x4e11e5['query'][_0x0fd6('0x1d')]);}return _0x18de21['getFields'](_0x55cfbf);}})[_0x0fd6('0x27')](function(_0x2e2f59){if(_0x2e2f59){return _0x2e2f59?{'count':_0x26a595,'rows':_0x2e2f59}:null;}})[_0x0fd6('0x27')](respondWithResult(_0x14a84d,null))['catch'](handleError(_0x14a84d,null));};exports['getSubjects']=function(_0x15ac15,_0x3452ed,_0x19528f){var _0x4cd299={};var _0x5a43b2={};var _0x46577e;var _0x5c9477;return db[_0x0fd6('0x3f')][_0x0fd6('0x49')]({'where':{'id':_0x15ac15['params']['id']}})[_0x0fd6('0x27')](handleEntityNotFound(_0x3452ed,null))[_0x0fd6('0x27')](function(_0x376aa1){if(_0x376aa1){_0x46577e=_0x376aa1;_0x5a43b2[_0x0fd6('0x2e')]=_[_0x0fd6('0x31')](db[_0x0fd6('0x4b')][_0x0fd6('0x2b')]);_0x5a43b2[_0x0fd6('0x30')]=_[_0x0fd6('0x31')](_0x15ac15[_0x0fd6('0x30')]);_0x5a43b2[_0x0fd6('0x3a')]=_[_0x0fd6('0x32')](_0x5a43b2[_0x0fd6('0x2e')],_0x5a43b2[_0x0fd6('0x30')]);_0x4cd299[_0x0fd6('0x33')]=_[_0x0fd6('0x32')](_0x5a43b2[_0x0fd6('0x2e')],qs[_0x0fd6('0x34')](_0x15ac15[_0x0fd6('0x30')][_0x0fd6('0x34')]));_0x4cd299[_0x0fd6('0x33')]=_0x4cd299[_0x0fd6('0x33')][_0x0fd6('0x35')]?_0x4cd299[_0x0fd6('0x33')]:_0x5a43b2['model'];_0x4cd299['order']=qs['sort'](_0x15ac15[_0x0fd6('0x30')]['sort']);_0x4cd299['where']=qs[_0x0fd6('0x3a')](_[_0x0fd6('0x3b')](_0x15ac15[_0x0fd6('0x30')],_0x5a43b2[_0x0fd6('0x3a')]));if(_0x15ac15[_0x0fd6('0x30')][_0x0fd6('0x3c')]){_0x4cd299[_0x0fd6('0x39')]=_[_0x0fd6('0x3d')](_0x4cd299[_0x0fd6('0x39')],{'$or':_['map'](_0x4cd299[_0x0fd6('0x33')],function(_0x5b1345){var _0x54dc4f={};_0x54dc4f[_0x5b1345]={'$like':'%'+_0x15ac15[_0x0fd6('0x30')][_0x0fd6('0x3c')]+'%'};return _0x54dc4f;})});}_0x4cd299=_[_0x0fd6('0x3d')]({},_0x4cd299,_0x15ac15[_0x0fd6('0x3e')]);return _0x46577e[_0x0fd6('0x4e')](_0x4cd299);}})[_0x0fd6('0x27')](function(_0x662bee){if(_0x662bee){_0x5c9477=_0x662bee[_0x0fd6('0x35')];if(!_0x15ac15['query'][_0x0fd6('0x36')](_0x0fd6('0x37'))){_0x4cd299['limit']=qs[_0x0fd6('0x1f')](_0x15ac15['query'][_0x0fd6('0x1f')]);_0x4cd299[_0x0fd6('0x1d')]=qs[_0x0fd6('0x1d')](_0x15ac15[_0x0fd6('0x30')][_0x0fd6('0x1d')]);}return _0x46577e[_0x0fd6('0x4e')](_0x4cd299);}})[_0x0fd6('0x27')](function(_0x35f389){if(_0x35f389){return _0x35f389?{'count':_0x5c9477,'rows':_0x35f389}:null;}})[_0x0fd6('0x27')](respondWithResult(_0x3452ed,null))[_0x0fd6('0x48')](handleError(_0x3452ed,null));};exports[_0x0fd6('0x4f')]=function(_0x3386b6,_0x3b02f3,_0x3cac4b){var _0x37408c={};var _0x3b75e0={};var _0x201e7b;var _0x55726f;return db[_0x0fd6('0x3f')][_0x0fd6('0x49')]({'where':{'id':_0x3386b6['params']['id']}})['then'](handleEntityNotFound(_0x3b02f3,null))[_0x0fd6('0x27')](function(_0xe181e2){if(_0xe181e2){_0x201e7b=_0xe181e2;_0x3b75e0[_0x0fd6('0x2e')]=_[_0x0fd6('0x31')](db[_0x0fd6('0x4b')][_0x0fd6('0x2b')]);_0x3b75e0[_0x0fd6('0x30')]=_[_0x0fd6('0x31')](_0x3386b6[_0x0fd6('0x30')]);_0x3b75e0[_0x0fd6('0x3a')]=_[_0x0fd6('0x32')](_0x3b75e0[_0x0fd6('0x2e')],_0x3b75e0[_0x0fd6('0x30')]);_0x37408c[_0x0fd6('0x33')]=_['intersection'](_0x3b75e0[_0x0fd6('0x2e')],qs[_0x0fd6('0x34')](_0x3386b6[_0x0fd6('0x30')][_0x0fd6('0x34')]));_0x37408c['attributes']=_0x37408c[_0x0fd6('0x33')][_0x0fd6('0x35')]?_0x37408c['attributes']:_0x3b75e0[_0x0fd6('0x2e')];_0x37408c['order']=qs[_0x0fd6('0x38')](_0x3386b6[_0x0fd6('0x30')]['sort']);_0x37408c[_0x0fd6('0x39')]=qs['filters'](_[_0x0fd6('0x3b')](_0x3386b6[_0x0fd6('0x30')],_0x3b75e0['filters']));if(_0x3386b6['query'][_0x0fd6('0x3c')]){_0x37408c[_0x0fd6('0x39')]=_['merge'](_0x37408c[_0x0fd6('0x39')],{'$or':_['map'](_0x37408c[_0x0fd6('0x33')],function(_0x5eb519){var _0x3e06e1={};_0x3e06e1[_0x5eb519]={'$like':'%'+_0x3386b6[_0x0fd6('0x30')][_0x0fd6('0x3c')]+'%'};return _0x3e06e1;})});}_0x37408c=_['merge']({},_0x37408c,_0x3386b6[_0x0fd6('0x3e')]);return _0x201e7b['getDescriptions'](_0x37408c);}})[_0x0fd6('0x27')](function(_0x52064c){if(_0x52064c){_0x55726f=_0x52064c[_0x0fd6('0x35')];if(!_0x3386b6[_0x0fd6('0x30')][_0x0fd6('0x36')]('nolimit')){_0x37408c[_0x0fd6('0x1f')]=qs[_0x0fd6('0x1f')](_0x3386b6[_0x0fd6('0x30')][_0x0fd6('0x1f')]);_0x37408c[_0x0fd6('0x1d')]=qs[_0x0fd6('0x1d')](_0x3386b6[_0x0fd6('0x30')][_0x0fd6('0x1d')]);}return _0x201e7b['getDescriptions'](_0x37408c);}})[_0x0fd6('0x27')](function(_0x44bf67){if(_0x44bf67){return _0x44bf67?{'count':_0x55726f,'rows':_0x44bf67}:null;}})[_0x0fd6('0x27')](respondWithResult(_0x3b02f3,null))['catch'](handleError(_0x3b02f3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 580407c..9809ff5 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d2405,_0x29a7d8){var _0x339052=function(_0x168770){while(--_0x168770){_0x5d2405['push'](_0x5d2405['shift']());}};_0x339052(++_0x29a7d8);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0xb4e6[_0x3dfeb9];return _0x412314;};'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 +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x4a2b3c,_0xc69f59){var _0x4b081b=function(_0x3dfcb1){while(--_0x3dfcb1){_0x4a2b3c['push'](_0x4a2b3c['shift']());}};_0x4b081b(++_0xc69f59);}(_0x008c,0x188));var _0xc008=function(_0x3df946,_0x272382){_0x3df946=_0x3df946-0x0;var _0x11123a=_0x008c[_0x3df946];return _0x11123a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 0f43ed1..a0d4e09 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 _0x1439=['debug','request\x20sent','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0x1439,0x85));var _0x9143=function(_0x5da13b,_0x55ca88){_0x5da13b=_0x5da13b-0x0;var _0x86d995=_0x1439[_0x5da13b];return _0x86d995;};'use strict';var _=require(_0x9143('0x0'));var util=require(_0x9143('0x1'));var moment=require(_0x9143('0x2'));var BPromise=require(_0x9143('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9143('0x4'));var db=require(_0x9143('0x5'))['db'];var utils=require(_0x9143('0x6'));var logger=require(_0x9143('0x7'))(_0x9143('0x8'));var config=require(_0x9143('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9143('0xa')][_0x9143('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b68d8,_0x543140,_0x2c4f38){return new BPromise(function(_0x2b9232,_0x88e16e){return client[_0x9143('0xc')](_0x1b68d8,_0x2c4f38)['then'](function(_0x258cc3){logger[_0x9143('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x543140,'request\x20sent');logger[_0x9143('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x543140,_0x9143('0xf'),JSON[_0x9143('0x10')](_0x258cc3));if(_0x258cc3[_0x9143('0x11')]){if(_0x258cc3[_0x9143('0x11')]['code']===0x1f4){logger[_0x9143('0x11')](_0x9143('0x12'),_0x543140,_0x258cc3[_0x9143('0x11')][_0x9143('0x13')]);return _0x88e16e(_0x258cc3[_0x9143('0x11')][_0x9143('0x13')]);}logger[_0x9143('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x543140,_0x258cc3[_0x9143('0x11')][_0x9143('0x13')]);return _0x2b9232(_0x258cc3['error'][_0x9143('0x13')]);}else{logger[_0x9143('0xd')](_0x9143('0x12'),_0x543140,_0x9143('0xf'));_0x2b9232(_0x258cc3[_0x9143('0x14')]['message']);}})['catch'](function(_0x1a6d31){logger[_0x9143('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x543140,_0x1a6d31);_0x88e16e(_0x1a6d31);});});} \ No newline at end of file +var _0x8805=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8805,0x8e));var _0x5880=function(_0x5338fe,_0x5e71d1){_0x5338fe=_0x5338fe-0x0;var _0xf0a1be=_0x8805[_0x5338fe];return _0xf0a1be;};'use strict';var _=require('lodash');var util=require(_0x5880('0x0'));var moment=require(_0x5880('0x1'));var BPromise=require('bluebird');var rs=require(_0x5880('0x2'));var fs=require('fs');var Redis=require(_0x5880('0x3'));var db=require(_0x5880('0x4'))['db'];var utils=require(_0x5880('0x5'));var logger=require(_0x5880('0x6'))(_0x5880('0x7'));var config=require(_0x5880('0x8'));var jayson=require(_0x5880('0x9'));var client=jayson['client'][_0x5880('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34d276,_0x50eef0,_0x5c66ed){return new BPromise(function(_0x19fef1,_0xa501c){return client[_0x5880('0xb')](_0x34d276,_0x5c66ed)[_0x5880('0xc')](function(_0x19b7f6){logger[_0x5880('0xd')](_0x5880('0xe'),_0x50eef0,_0x5880('0xf'));logger['debug'](_0x5880('0x10'),_0x50eef0,_0x5880('0xf'),JSON[_0x5880('0x11')](_0x19b7f6));if(_0x19b7f6['error']){if(_0x19b7f6[_0x5880('0x12')][_0x5880('0x13')]===0x1f4){logger[_0x5880('0x12')](_0x5880('0xe'),_0x50eef0,_0x19b7f6['error'][_0x5880('0x14')]);return _0xa501c(_0x19b7f6['error'][_0x5880('0x14')]);}logger[_0x5880('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x50eef0,_0x19b7f6[_0x5880('0x12')][_0x5880('0x14')]);return _0x19fef1(_0x19b7f6[_0x5880('0x12')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x50eef0,_0x5880('0xf'));_0x19fef1(_0x19b7f6[_0x5880('0x15')][_0x5880('0x14')]);}})['catch'](function(_0x287218){logger[_0x5880('0x12')](_0x5880('0xe'),_0x50eef0,_0x287218);_0xa501c(_0x287218);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index afc9145..28962b7 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 _0x58b9=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x342d13,_0x42bffb){var _0x35562f=function(_0x1de6f4){while(--_0x1de6f4){_0x342d13['push'](_0x342d13['shift']());}};_0x35562f(++_0x42bffb);}(_0x58b9,0xeb));var _0x958b=function(_0x3dcdf2,_0x18d8e6){_0x3dcdf2=_0x3dcdf2-0x0;var _0x1afb51=_0x58b9[_0x3dcdf2];return _0x1afb51;};'use strict';var multer=require(_0x958b('0x0'));var util=require(_0x958b('0x1'));var path=require('path');var timeout=require(_0x958b('0x2'));var express=require(_0x958b('0x3'));var router=express[_0x958b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x958b('0x5'));var interaction=require(_0x958b('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x958b('0x7')]('/',auth[_0x958b('0x8')](),controller[_0x958b('0x9')]);router[_0x958b('0x7')](_0x958b('0xa'),auth[_0x958b('0x8')](),controller[_0x958b('0xb')]);router[_0x958b('0xc')]('/',auth[_0x958b('0x8')](),controller[_0x958b('0xd')]);router[_0x958b('0xe')](_0x958b('0xa'),auth['isAuthenticated'](),controller[_0x958b('0xf')]);router[_0x958b('0x10')](_0x958b('0xa'),auth['isAuthenticated'](),controller[_0x958b('0x11')]);module[_0x958b('0x12')]=router; \ No newline at end of file +var _0xbeb2=['index','get','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','isAuthenticated'];(function(_0xab0227,_0x27b26f){var _0x19f8a3=function(_0x4661d9){while(--_0x4661d9){_0xab0227['push'](_0xab0227['shift']());}};_0x19f8a3(++_0x27b26f);}(_0xbeb2,0x139));var _0x2beb=function(_0x3bd3bc,_0x55127a){_0x3bd3bc=_0x3bd3bc-0x0;var _0x17ccad=_0xbeb2[_0x3bd3bc];return _0x17ccad;};'use strict';var multer=require(_0x2beb('0x0'));var util=require(_0x2beb('0x1'));var path=require(_0x2beb('0x2'));var timeout=require(_0x2beb('0x3'));var express=require(_0x2beb('0x4'));var router=express['Router']();var fs_extra=require(_0x2beb('0x5'));var auth=require(_0x2beb('0x6'));var interaction=require(_0x2beb('0x7'));var config=require('../../config/environment');var controller=require(_0x2beb('0x8'));router['get']('/',auth[_0x2beb('0x9')](),controller[_0x2beb('0xa')]);router[_0x2beb('0xb')](_0x2beb('0xc'),auth[_0x2beb('0x9')](),controller['show']);router[_0x2beb('0xd')]('/',auth[_0x2beb('0x9')](),controller[_0x2beb('0xe')]);router[_0x2beb('0xf')](_0x2beb('0xc'),auth[_0x2beb('0x9')](),controller[_0x2beb('0x10')]);router['delete'](_0x2beb('0xc'),auth[_0x2beb('0x9')](),controller[_0x2beb('0x11')]);module[_0x2beb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index c6105fe..109f1dc 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 _0xee85=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x54169f,_0x234960){var _0x45f08b=function(_0x2a2886){while(--_0x2a2886){_0x54169f['push'](_0x54169f['shift']());}};_0x45f08b(++_0x234960);}(_0xee85,0xaa));var _0x5ee8=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0xee85[_0x3a0863];return _0x85c557;};'use strict';var Sequelize=require(_0x5ee8('0x0'));module[_0x5ee8('0x1')]={'type':{'type':Sequelize[_0x5ee8('0x2')](_0x5ee8('0x3'),_0x5ee8('0x4'),_0x5ee8('0x5'),_0x5ee8('0x6'),'picklist'),'defaultValue':_0x5ee8('0x3')},'content':{'type':Sequelize[_0x5ee8('0x7')]},'key':{'type':Sequelize[_0x5ee8('0x7')]},'keyType':{'type':Sequelize[_0x5ee8('0x2')]('string',_0x5ee8('0x4'),_0x5ee8('0x5'))},'keyContent':{'type':Sequelize[_0x5ee8('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5ee8('0x7')]},'customField':{'type':Sequelize[_0x5ee8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ee8('0x7')]}}; \ No newline at end of file +var _0xe709=['customVariable','keyValue','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x164eb1,_0x198a7d){var _0x73311=function(_0xde4d4a){while(--_0xde4d4a){_0x164eb1['push'](_0x164eb1['shift']());}};_0x73311(++_0x198a7d);}(_0xe709,0x115));var _0x9e70=function(_0x77c0cc,_0x19ae55){_0x77c0cc=_0x77c0cc-0x0;var _0x441038=_0xe709[_0x77c0cc];return _0x441038;};'use strict';var Sequelize=require('sequelize');module[_0x9e70('0x0')]={'type':{'type':Sequelize[_0x9e70('0x1')]('string',_0x9e70('0x2'),_0x9e70('0x3'),_0x9e70('0x4'),'picklist'),'defaultValue':_0x9e70('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9e70('0x1')](_0x9e70('0x5'),_0x9e70('0x2'),_0x9e70('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9e70('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9e70('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e70('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 204309c..3a21739 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 _0x84bc=['save','update','then','destroy','sendStatus','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','length','merge','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x84bc,0x198));var _0xc84b=function(_0x2c8839,_0x18166d){_0x2c8839=_0x2c8839-0x0;var _0x10eef5=_0x84bc[_0x2c8839];return _0x10eef5;};'use strict';var emlformat=require(_0xc84b('0x0'));var rimraf=require(_0xc84b('0x1'));var zipdir=require(_0xc84b('0x2'));var jsonpatch=require(_0xc84b('0x3'));var rp=require('request-promise');var moment=require(_0xc84b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc84b('0x5'));var util=require(_0xc84b('0x6'));var path=require(_0xc84b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc84b('0x8'));var fs=require('fs');var fs_extra=require(_0xc84b('0x9'));var _=require(_0xc84b('0xa'));var squel=require(_0xc84b('0xb'));var crypto=require('crypto');var jsforce=require(_0xc84b('0xc'));var deskjs=require(_0xc84b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc84b('0xe'));var Papa=require(_0xc84b('0xf'));var Redis=require(_0xc84b('0x10'));var authService=require(_0xc84b('0x11'));var qs=require(_0xc84b('0x12'));var as=require(_0xc84b('0x13'));var hardwareService=require(_0xc84b('0x14'));var logger=require('../../config/logger')(_0xc84b('0x15'));var utils=require(_0xc84b('0x16'));var config=require(_0xc84b('0x17'));var licenseUtil=require(_0xc84b('0x18'));var db=require(_0xc84b('0x19'))['db'];function respondWithStatusCode(_0xb0fe16,_0x4b9303){_0x4b9303=_0x4b9303||0xcc;return function(_0x262982){if(_0x262982){return _0xb0fe16['sendStatus'](_0x4b9303);}return _0xb0fe16['status'](_0x4b9303)[_0xc84b('0x1a')]();};}function respondWithResult(_0x2b5e60,_0x42ee6d){_0x42ee6d=_0x42ee6d||0xc8;return function(_0x87cfc0){if(_0x87cfc0){return _0x2b5e60[_0xc84b('0x1b')](_0x42ee6d)[_0xc84b('0x1c')](_0x87cfc0);}};}function respondWithFilteredResult(_0x5a6ef0,_0x26745d){return function(_0x3dca97){if(_0x3dca97){var _0x1035da=typeof _0x26745d[_0xc84b('0x1d')]===_0xc84b('0x1e')&&typeof _0x26745d[_0xc84b('0x1f')]==='undefined';var _0x50c4fd=_0x3dca97[_0xc84b('0x20')];var _0x351961=_0x1035da?0x0:_0x26745d[_0xc84b('0x1d')];var _0x33921f=_0x1035da?_0x3dca97[_0xc84b('0x20')]:_0x26745d[_0xc84b('0x1d')]+_0x26745d[_0xc84b('0x1f')];var _0x32bd29;if(_0x33921f>=_0x50c4fd){_0x33921f=_0x50c4fd;_0x32bd29=0xc8;}else{_0x32bd29=0xce;}_0x5a6ef0[_0xc84b('0x1b')](_0x32bd29);return _0x5a6ef0[_0xc84b('0x21')](_0xc84b('0x22'),_0x351961+'-'+_0x33921f+'/'+_0x50c4fd)[_0xc84b('0x1c')](_0x3dca97);}return null;};}function patchUpdates(_0x2b557e){return function(_0x15a861){try{jsonpatch[_0xc84b('0x23')](_0x15a861,_0x2b557e,!![]);}catch(_0x440ec2){return BPromise['reject'](_0x440ec2);}return _0x15a861[_0xc84b('0x24')]();};}function saveUpdates(_0x2409a5,_0x1ae269){return function(_0x6a15cd){if(_0x6a15cd){return _0x6a15cd[_0xc84b('0x25')](_0x2409a5)[_0xc84b('0x26')](function(_0x226848){return _0x226848;});}return null;};}function removeEntity(_0x439c88,_0x16ca33){return function(_0x111f56){if(_0x111f56){return _0x111f56[_0xc84b('0x27')]()[_0xc84b('0x26')](function(){_0x439c88[_0xc84b('0x1b')](0xcc)[_0xc84b('0x1a')]();});}};}function handleEntityNotFound(_0x1325a4,_0x36a420){return function(_0x1e5d07){if(!_0x1e5d07){_0x1325a4[_0xc84b('0x28')](0x194);}return _0x1e5d07;};}function handleError(_0x9aa458,_0x3c782a){_0x3c782a=_0x3c782a||0x1f4;return function(_0xe8a7f4){logger['error'](_0xe8a7f4[_0xc84b('0x29')]);if(_0xe8a7f4[_0xc84b('0x2a')]){delete _0xe8a7f4[_0xc84b('0x2a')];}_0x9aa458[_0xc84b('0x1b')](_0x3c782a)[_0xc84b('0x2b')](_0xe8a7f4);};}exports['index']=function(_0x57cc3f,_0x54944c){var _0x3529bd={},_0x22ea79={},_0x26d8b6={'count':0x0,'rows':[]};var _0x4b3c57=_[_0xc84b('0x2c')](db[_0xc84b('0x2d')][_0xc84b('0x2e')],function(_0xf33c9d){return{'name':_0xf33c9d[_0xc84b('0x2f')],'type':_0xf33c9d['type'][_0xc84b('0x30')]};});_0x22ea79[_0xc84b('0x31')]=_[_0xc84b('0x2c')](_0x4b3c57,_0xc84b('0x2a'));_0x22ea79[_0xc84b('0x32')]=_[_0xc84b('0x33')](_0x57cc3f[_0xc84b('0x32')]);_0x22ea79['filters']=_[_0xc84b('0x34')](_0x22ea79['model'],_0x22ea79[_0xc84b('0x32')]);_0x3529bd[_0xc84b('0x35')]=_['intersection'](_0x22ea79['model'],qs[_0xc84b('0x36')](_0x57cc3f['query']['fields']));_0x3529bd[_0xc84b('0x35')]=_0x3529bd['attributes']['length']?_0x3529bd[_0xc84b('0x35')]:_0x22ea79[_0xc84b('0x31')];if(!_0x57cc3f[_0xc84b('0x32')][_0xc84b('0x37')](_0xc84b('0x38'))){_0x3529bd['limit']=qs[_0xc84b('0x1f')](_0x57cc3f[_0xc84b('0x32')][_0xc84b('0x1f')]);_0x3529bd[_0xc84b('0x1d')]=qs[_0xc84b('0x1d')](_0x57cc3f[_0xc84b('0x32')][_0xc84b('0x1d')]);}_0x3529bd['order']=qs[_0xc84b('0x39')](_0x57cc3f[_0xc84b('0x32')]['sort']);_0x3529bd['where']=qs['filters'](_['pick'](_0x57cc3f['query'],_0x22ea79[_0xc84b('0x3a')]),_0x4b3c57);if(_0x57cc3f[_0xc84b('0x32')]['filter']){_0x3529bd['where']=_['merge'](_0x3529bd['where'],{'$or':_[_0xc84b('0x2c')](_0x4b3c57,function(_0x3eaaf5){if(_0x3eaaf5[_0xc84b('0x3b')]!==_0xc84b('0x3c')){var _0x45a382={};_0x45a382[_0x3eaaf5[_0xc84b('0x2a')]]={'$like':'%'+_0x57cc3f['query'][_0xc84b('0x3d')]+'%'};return _0x45a382;}})});}_0x3529bd=_['merge']({},_0x3529bd,_0x57cc3f[_0xc84b('0x3e')]);var _0x4e853d={'where':_0x3529bd['where']};return db[_0xc84b('0x2d')]['count'](_0x4e853d)[_0xc84b('0x26')](function(_0x1eee59){_0x26d8b6[_0xc84b('0x20')]=_0x1eee59;if(_0x57cc3f[_0xc84b('0x32')][_0xc84b('0x3f')]){_0x3529bd['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xc84b('0x40')](_0x3529bd);})[_0xc84b('0x26')](function(_0x1fd04c){_0x26d8b6[_0xc84b('0x41')]=_0x1fd04c;return _0x26d8b6;})['then'](respondWithFilteredResult(_0x54944c,_0x3529bd))[_0xc84b('0x42')](handleError(_0x54944c,null));};exports[_0xc84b('0x43')]=function(_0x353a2a,_0x19a747){var _0x82df0={'raw':!![],'where':{'id':_0x353a2a['params']['id']}},_0x28c7bc={};_0x28c7bc[_0xc84b('0x31')]=_[_0xc84b('0x33')](db['Dynamics365Field'][_0xc84b('0x2e')]);_0x28c7bc['query']=_['keys'](_0x353a2a[_0xc84b('0x32')]);_0x28c7bc['filters']=_[_0xc84b('0x34')](_0x28c7bc[_0xc84b('0x31')],_0x28c7bc['query']);_0x82df0[_0xc84b('0x35')]=_[_0xc84b('0x34')](_0x28c7bc['model'],qs[_0xc84b('0x36')](_0x353a2a['query'][_0xc84b('0x36')]));_0x82df0['attributes']=_0x82df0[_0xc84b('0x35')][_0xc84b('0x44')]?_0x82df0[_0xc84b('0x35')]:_0x28c7bc[_0xc84b('0x31')];if(_0x353a2a[_0xc84b('0x32')][_0xc84b('0x3f')]){_0x82df0['include']=[{'all':!![]}];}_0x82df0=_[_0xc84b('0x45')]({},_0x82df0,_0x353a2a[_0xc84b('0x3e')]);return db['Dynamics365Field']['find'](_0x82df0)[_0xc84b('0x26')](handleEntityNotFound(_0x19a747,null))['then'](respondWithResult(_0x19a747,null))['catch'](handleError(_0x19a747,null));};exports[_0xc84b('0x46')]=function(_0xe379b2,_0x579e59){return db[_0xc84b('0x2d')][_0xc84b('0x46')](_0xe379b2[_0xc84b('0x47')],{})[_0xc84b('0x26')](respondWithResult(_0x579e59,0xc9))['catch'](handleError(_0x579e59,null));};exports[_0xc84b('0x25')]=function(_0x58881b,_0x48c180){if(_0x58881b[_0xc84b('0x47')]['id']){delete _0x58881b[_0xc84b('0x47')]['id'];}return db[_0xc84b('0x2d')][_0xc84b('0x48')]({'where':{'id':_0x58881b[_0xc84b('0x49')]['id']}})[_0xc84b('0x26')](handleEntityNotFound(_0x48c180,null))[_0xc84b('0x26')](saveUpdates(_0x58881b[_0xc84b('0x47')],null))[_0xc84b('0x26')](respondWithResult(_0x48c180,null))[_0xc84b('0x42')](handleError(_0x48c180,null));};exports['destroy']=function(_0x5f33a7,_0x14a0f9){return db[_0xc84b('0x2d')][_0xc84b('0x48')]({'where':{'id':_0x5f33a7['params']['id']}})['then'](handleEntityNotFound(_0x14a0f9,null))[_0xc84b('0x26')](removeEntity(_0x14a0f9,null))[_0xc84b('0x42')](handleError(_0x14a0f9,null));}; \ No newline at end of file +var _0xc8ed=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0xc017c5,_0x4c11e8){var _0x196085=function(_0x4ccec9){while(--_0x4ccec9){_0xc017c5['push'](_0xc017c5['shift']());}};_0x196085(++_0x4c11e8);}(_0xc8ed,0x1ca));var _0xdc8e=function(_0x580d65,_0x405730){_0x580d65=_0x580d65-0x0;var _0xfc9e99=_0xc8ed[_0x580d65];return _0xfc9e99;};'use strict';var emlformat=require(_0xdc8e('0x0'));var rimraf=require(_0xdc8e('0x1'));var zipdir=require(_0xdc8e('0x2'));var jsonpatch=require(_0xdc8e('0x3'));var rp=require(_0xdc8e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdc8e('0x5'));var util=require(_0xdc8e('0x6'));var path=require(_0xdc8e('0x7'));var sox=require(_0xdc8e('0x8'));var csv=require(_0xdc8e('0x9'));var ejs=require(_0xdc8e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc8e('0xb'));var squel=require(_0xdc8e('0xc'));var crypto=require('crypto');var jsforce=require(_0xdc8e('0xd'));var deskjs=require(_0xdc8e('0xe'));var toCsv=require(_0xdc8e('0x9'));var querystring=require(_0xdc8e('0xf'));var Papa=require(_0xdc8e('0x10'));var Redis=require(_0xdc8e('0x11'));var authService=require(_0xdc8e('0x12'));var qs=require(_0xdc8e('0x13'));var as=require(_0xdc8e('0x14'));var hardwareService=require(_0xdc8e('0x15'));var logger=require(_0xdc8e('0x16'))(_0xdc8e('0x17'));var utils=require(_0xdc8e('0x18'));var config=require(_0xdc8e('0x19'));var licenseUtil=require(_0xdc8e('0x1a'));var db=require(_0xdc8e('0x1b'))['db'];function respondWithStatusCode(_0x3e4a69,_0x39313b){_0x39313b=_0x39313b||0xcc;return function(_0x5a2588){if(_0x5a2588){return _0x3e4a69[_0xdc8e('0x1c')](_0x39313b);}return _0x3e4a69['status'](_0x39313b)['end']();};}function respondWithResult(_0x15b82f,_0xc25b58){_0xc25b58=_0xc25b58||0xc8;return function(_0x4b9fb4){if(_0x4b9fb4){return _0x15b82f[_0xdc8e('0x1d')](_0xc25b58)[_0xdc8e('0x1e')](_0x4b9fb4);}};}function respondWithFilteredResult(_0x5832f2,_0x57338b){return function(_0x40afff){if(_0x40afff){var _0x61e0f=typeof _0x57338b[_0xdc8e('0x1f')]===_0xdc8e('0x20')&&typeof _0x57338b[_0xdc8e('0x21')]===_0xdc8e('0x20');var _0x425255=_0x40afff[_0xdc8e('0x22')];var _0x4473c9=_0x61e0f?0x0:_0x57338b[_0xdc8e('0x1f')];var _0x1c431b=_0x61e0f?_0x40afff['count']:_0x57338b['offset']+_0x57338b[_0xdc8e('0x21')];var _0x18a950;if(_0x1c431b>=_0x425255){_0x1c431b=_0x425255;_0x18a950=0xc8;}else{_0x18a950=0xce;}_0x5832f2[_0xdc8e('0x1d')](_0x18a950);return _0x5832f2[_0xdc8e('0x23')](_0xdc8e('0x24'),_0x4473c9+'-'+_0x1c431b+'/'+_0x425255)['json'](_0x40afff);}return null;};}function patchUpdates(_0x1b9d9a){return function(_0x34ecdd){try{jsonpatch[_0xdc8e('0x25')](_0x34ecdd,_0x1b9d9a,!![]);}catch(_0x32dd83){return BPromise[_0xdc8e('0x26')](_0x32dd83);}return _0x34ecdd[_0xdc8e('0x27')]();};}function saveUpdates(_0xbac371,_0x3fdd43){return function(_0x31b417){if(_0x31b417){return _0x31b417['update'](_0xbac371)[_0xdc8e('0x28')](function(_0x392e63){return _0x392e63;});}return null;};}function removeEntity(_0xbd5519,_0x194df7){return function(_0x1916cc){if(_0x1916cc){return _0x1916cc[_0xdc8e('0x29')]()[_0xdc8e('0x28')](function(){_0xbd5519[_0xdc8e('0x1d')](0xcc)[_0xdc8e('0x2a')]();});}};}function handleEntityNotFound(_0x2b4bf4,_0x47589b){return function(_0x1151db){if(!_0x1151db){_0x2b4bf4[_0xdc8e('0x1c')](0x194);}return _0x1151db;};}function handleError(_0x260ac9,_0x55e5e4){_0x55e5e4=_0x55e5e4||0x1f4;return function(_0x116a82){logger[_0xdc8e('0x2b')](_0x116a82[_0xdc8e('0x2c')]);if(_0x116a82[_0xdc8e('0x2d')]){delete _0x116a82['name'];}_0x260ac9[_0xdc8e('0x1d')](_0x55e5e4)[_0xdc8e('0x2e')](_0x116a82);};}exports['index']=function(_0x39f8e9,_0x39b5e4){var _0x101c0b={},_0x4de7b0={},_0xd4f7e5={'count':0x0,'rows':[]};var _0xf7a11b=_[_0xdc8e('0x2f')](db[_0xdc8e('0x30')][_0xdc8e('0x31')],function(_0x2e4e05){return{'name':_0x2e4e05[_0xdc8e('0x32')],'type':_0x2e4e05[_0xdc8e('0x33')]['key']};});_0x4de7b0[_0xdc8e('0x34')]=_[_0xdc8e('0x2f')](_0xf7a11b,_0xdc8e('0x2d'));_0x4de7b0[_0xdc8e('0x35')]=_[_0xdc8e('0x36')](_0x39f8e9[_0xdc8e('0x35')]);_0x4de7b0[_0xdc8e('0x37')]=_[_0xdc8e('0x38')](_0x4de7b0[_0xdc8e('0x34')],_0x4de7b0[_0xdc8e('0x35')]);_0x101c0b[_0xdc8e('0x39')]=_[_0xdc8e('0x38')](_0x4de7b0[_0xdc8e('0x34')],qs['fields'](_0x39f8e9[_0xdc8e('0x35')][_0xdc8e('0x3a')]));_0x101c0b[_0xdc8e('0x39')]=_0x101c0b[_0xdc8e('0x39')][_0xdc8e('0x3b')]?_0x101c0b[_0xdc8e('0x39')]:_0x4de7b0[_0xdc8e('0x34')];if(!_0x39f8e9['query'][_0xdc8e('0x3c')]('nolimit')){_0x101c0b[_0xdc8e('0x21')]=qs[_0xdc8e('0x21')](_0x39f8e9[_0xdc8e('0x35')][_0xdc8e('0x21')]);_0x101c0b[_0xdc8e('0x1f')]=qs[_0xdc8e('0x1f')](_0x39f8e9['query']['offset']);}_0x101c0b['order']=qs[_0xdc8e('0x3d')](_0x39f8e9[_0xdc8e('0x35')][_0xdc8e('0x3d')]);_0x101c0b[_0xdc8e('0x3e')]=qs[_0xdc8e('0x37')](_[_0xdc8e('0x3f')](_0x39f8e9[_0xdc8e('0x35')],_0x4de7b0[_0xdc8e('0x37')]),_0xf7a11b);if(_0x39f8e9['query'][_0xdc8e('0x40')]){_0x101c0b[_0xdc8e('0x3e')]=_['merge'](_0x101c0b[_0xdc8e('0x3e')],{'$or':_[_0xdc8e('0x2f')](_0xf7a11b,function(_0x22166a){if(_0x22166a[_0xdc8e('0x33')]!==_0xdc8e('0x41')){var _0x1b4d5a={};_0x1b4d5a[_0x22166a[_0xdc8e('0x2d')]]={'$like':'%'+_0x39f8e9[_0xdc8e('0x35')]['filter']+'%'};return _0x1b4d5a;}})});}_0x101c0b=_['merge']({},_0x101c0b,_0x39f8e9[_0xdc8e('0x42')]);var _0x24df84={'where':_0x101c0b[_0xdc8e('0x3e')]};return db[_0xdc8e('0x30')][_0xdc8e('0x22')](_0x24df84)['then'](function(_0x59181b){_0xd4f7e5['count']=_0x59181b;if(_0x39f8e9['query'][_0xdc8e('0x43')]){_0x101c0b['include']=[{'all':!![]}];}return db[_0xdc8e('0x30')][_0xdc8e('0x44')](_0x101c0b);})['then'](function(_0x59c1fb){_0xd4f7e5[_0xdc8e('0x45')]=_0x59c1fb;return _0xd4f7e5;})['then'](respondWithFilteredResult(_0x39b5e4,_0x101c0b))['catch'](handleError(_0x39b5e4,null));};exports[_0xdc8e('0x46')]=function(_0x327fe3,_0x15962b){var _0x3e5efe={'raw':!![],'where':{'id':_0x327fe3[_0xdc8e('0x47')]['id']}},_0x3a5beb={};_0x3a5beb[_0xdc8e('0x34')]=_[_0xdc8e('0x36')](db[_0xdc8e('0x30')][_0xdc8e('0x31')]);_0x3a5beb['query']=_[_0xdc8e('0x36')](_0x327fe3[_0xdc8e('0x35')]);_0x3a5beb[_0xdc8e('0x37')]=_[_0xdc8e('0x38')](_0x3a5beb[_0xdc8e('0x34')],_0x3a5beb[_0xdc8e('0x35')]);_0x3e5efe[_0xdc8e('0x39')]=_[_0xdc8e('0x38')](_0x3a5beb[_0xdc8e('0x34')],qs[_0xdc8e('0x3a')](_0x327fe3['query']['fields']));_0x3e5efe[_0xdc8e('0x39')]=_0x3e5efe[_0xdc8e('0x39')]['length']?_0x3e5efe[_0xdc8e('0x39')]:_0x3a5beb[_0xdc8e('0x34')];if(_0x327fe3[_0xdc8e('0x35')][_0xdc8e('0x43')]){_0x3e5efe[_0xdc8e('0x48')]=[{'all':!![]}];}_0x3e5efe=_[_0xdc8e('0x49')]({},_0x3e5efe,_0x327fe3['options']);return db['Dynamics365Field'][_0xdc8e('0x4a')](_0x3e5efe)[_0xdc8e('0x28')](handleEntityNotFound(_0x15962b,null))['then'](respondWithResult(_0x15962b,null))['catch'](handleError(_0x15962b,null));};exports[_0xdc8e('0x4b')]=function(_0x5414fe,_0x52604b){return db[_0xdc8e('0x30')][_0xdc8e('0x4b')](_0x5414fe[_0xdc8e('0x4c')],{})[_0xdc8e('0x28')](respondWithResult(_0x52604b,0xc9))[_0xdc8e('0x4d')](handleError(_0x52604b,null));};exports[_0xdc8e('0x4e')]=function(_0x358686,_0x196468){if(_0x358686[_0xdc8e('0x4c')]['id']){delete _0x358686[_0xdc8e('0x4c')]['id'];}return db['Dynamics365Field'][_0xdc8e('0x4a')]({'where':{'id':_0x358686[_0xdc8e('0x47')]['id']}})[_0xdc8e('0x28')](handleEntityNotFound(_0x196468,null))[_0xdc8e('0x28')](saveUpdates(_0x358686['body'],null))[_0xdc8e('0x28')](respondWithResult(_0x196468,null))[_0xdc8e('0x4d')](handleError(_0x196468,null));};exports[_0xdc8e('0x29')]=function(_0xc6b59f,_0x4b6b31){return db[_0xdc8e('0x30')][_0xdc8e('0x4a')]({'where':{'id':_0xc6b59f['params']['id']}})[_0xdc8e('0x28')](handleEntityNotFound(_0x4b6b31,null))[_0xdc8e('0x28')](removeEntity(_0x4b6b31,null))[_0xdc8e('0x4d')](handleError(_0x4b6b31,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 575f095..c05ed1b 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 _0x2dba=['util','../../config/logger','api','request-promise','path','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x55a63e,_0x3b0bf7){var _0x26b1b9=function(_0x378f70){while(--_0x378f70){_0x55a63e['push'](_0x55a63e['shift']());}};_0x26b1b9(++_0x3b0bf7);}(_0x2dba,0x197));var _0xa2db=function(_0x38481f,_0x1bbb56){_0x38481f=_0x38481f-0x0;var _0x18741a=_0x2dba[_0x38481f];return _0x18741a;};'use strict';var _=require(_0xa2db('0x0'));var util=require(_0xa2db('0x1'));var logger=require(_0xa2db('0x2'))(_0xa2db('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa2db('0x4'));var fs=require('fs');var path=require(_0xa2db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xa2db('0x6')]=function(_0x31c004,_0xc213d4){return _0x31c004[_0xa2db('0x7')]('Dynamics365Field',attributes,{'tableName':_0xa2db('0x8'),'paranoid':![],'indexes':[{'name':_0xa2db('0x9'),'fields':[_0xa2db('0xa'),_0xa2db('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb5c=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xdb5c,0x1b6));var _0xcdb5=function(_0x5efa5c,_0x98a078){_0x5efa5c=_0x5efa5c-0x0;var _0x25e8b6=_0xdb5c[_0x5efa5c];return _0x25e8b6;};'use strict';var _=require(_0xcdb5('0x0'));var util=require(_0xcdb5('0x1'));var logger=require(_0xcdb5('0x2'))('api');var moment=require(_0xcdb5('0x3'));var BPromise=require(_0xcdb5('0x4'));var rp=require(_0xcdb5('0x5'));var fs=require('fs');var path=require(_0xcdb5('0x6'));var rimraf=require(_0xcdb5('0x7'));var config=require(_0xcdb5('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0xcdb5('0x9')]=function(_0x6543ef,_0x4bd6dc){return _0x6543ef[_0xcdb5('0xa')](_0xcdb5('0xb'),attributes,{'tableName':_0xcdb5('0xc'),'paranoid':![],'indexes':[{'name':_0xcdb5('0xd'),'fields':[_0xcdb5('0xe'),_0xcdb5('0xf')],'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 a2fd091..d732ac8 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 _0xabff=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x396cf7,_0x6ec029){var _0x4d9620=function(_0x2ec473){while(--_0x2ec473){_0x396cf7['push'](_0x396cf7['shift']());}};_0x4d9620(++_0x6ec029);}(_0xabff,0x1f4));var _0xfabf=function(_0x2d1f6e,_0x13fdc7){_0x2d1f6e=_0x2d1f6e-0x0;var _0x421074=_0xabff[_0x2d1f6e];return _0x421074;};'use strict';var _=require(_0xfabf('0x0'));var util=require(_0xfabf('0x1'));var moment=require('moment');var BPromise=require(_0xfabf('0x2'));var rs=require(_0xfabf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfabf('0x4'))['db'];var utils=require(_0xfabf('0x5'));var logger=require(_0xfabf('0x6'))(_0xfabf('0x7'));var config=require('../../config/environment');var jayson=require(_0xfabf('0x8'));var client=jayson[_0xfabf('0x9')][_0xfabf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31c40c,_0x5582f4,_0x5222a5){return new BPromise(function(_0x7df4cc,_0x7fc3b1){return client[_0xfabf('0xb')](_0x31c40c,_0x5222a5)[_0xfabf('0xc')](function(_0x5abf59){logger['info'](_0xfabf('0xd'),_0x5582f4,_0xfabf('0xe'));logger[_0xfabf('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5582f4,_0xfabf('0xe'),JSON['stringify'](_0x5abf59));if(_0x5abf59[_0xfabf('0x10')]){if(_0x5abf59['error'][_0xfabf('0x11')]===0x1f4){logger[_0xfabf('0x10')](_0xfabf('0xd'),_0x5582f4,_0x5abf59[_0xfabf('0x10')][_0xfabf('0x12')]);return _0x7fc3b1(_0x5abf59[_0xfabf('0x10')][_0xfabf('0x12')]);}logger[_0xfabf('0x10')](_0xfabf('0xd'),_0x5582f4,_0x5abf59['error'][_0xfabf('0x12')]);return _0x7df4cc(_0x5abf59[_0xfabf('0x10')][_0xfabf('0x12')]);}else{logger['info'](_0xfabf('0xd'),_0x5582f4,_0xfabf('0xe'));_0x7df4cc(_0x5abf59[_0xfabf('0x13')][_0xfabf('0x12')]);}})['catch'](function(_0x5c9ca2){logger['error'](_0xfabf('0xd'),_0x5582f4,_0x5c9ca2);_0x7fc3b1(_0x5c9ca2);});});} \ No newline at end of file +var _0x24b8=['util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash'];(function(_0x3889ae,_0x4770c3){var _0x6533dd=function(_0x4275f7){while(--_0x4275f7){_0x3889ae['push'](_0x3889ae['shift']());}};_0x6533dd(++_0x4770c3);}(_0x24b8,0xed));var _0x824b=function(_0x2c4a46,_0x38bea3){_0x2c4a46=_0x2c4a46-0x0;var _0x4ddfd8=_0x24b8[_0x2c4a46];return _0x4ddfd8;};'use strict';var _=require(_0x824b('0x0'));var util=require(_0x824b('0x1'));var moment=require(_0x824b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x824b('0x3'))(_0x824b('0x4'));var config=require(_0x824b('0x5'));var jayson=require(_0x824b('0x6'));var client=jayson['client'][_0x824b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8d4002,_0x34fd0e,_0x4ee5f5){return new BPromise(function(_0x162b0d,_0x48c857){return client[_0x824b('0x8')](_0x8d4002,_0x4ee5f5)[_0x824b('0x9')](function(_0x1e7639){logger[_0x824b('0xa')](_0x824b('0xb'),_0x34fd0e,_0x824b('0xc'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x34fd0e,_0x824b('0xc'),JSON[_0x824b('0xd')](_0x1e7639));if(_0x1e7639[_0x824b('0xe')]){if(_0x1e7639[_0x824b('0xe')]['code']===0x1f4){logger['error'](_0x824b('0xb'),_0x34fd0e,_0x1e7639[_0x824b('0xe')][_0x824b('0xf')]);return _0x48c857(_0x1e7639['error'][_0x824b('0xf')]);}logger['error'](_0x824b('0xb'),_0x34fd0e,_0x1e7639[_0x824b('0xe')][_0x824b('0xf')]);return _0x162b0d(_0x1e7639[_0x824b('0xe')][_0x824b('0xf')]);}else{logger['info'](_0x824b('0xb'),_0x34fd0e,_0x824b('0xc'));_0x162b0d(_0x1e7639['result'][_0x824b('0xf')]);}})[_0x824b('0x10')](function(_0x30f7ef){logger[_0x824b('0xe')](_0x824b('0xb'),_0x34fd0e,_0x30f7ef);_0x48c857(_0x30f7ef);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fe84b0d..ddfa2d5 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 _0xa913=['put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x34d30a,_0x2b561a){var _0xdafbeb=function(_0x1c7a8f){while(--_0x1c7a8f){_0x34d30a['push'](_0x34d30a['shift']());}};_0xdafbeb(++_0x2b561a);}(_0xa913,0x169));var _0x3a91=function(_0x545ba0,_0x5585ec){_0x545ba0=_0x545ba0-0x0;var _0x476124=_0xa913[_0x545ba0];return _0x476124;};'use strict';var multer=require(_0x3a91('0x0'));var util=require(_0x3a91('0x1'));var path=require(_0x3a91('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a91('0x3'));var router=express[_0x3a91('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3a91('0x5'));var config=require(_0x3a91('0x6'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x3a91('0x7')](),controller[_0x3a91('0x8')]);router[_0x3a91('0x9')](_0x3a91('0xa'),auth[_0x3a91('0x7')](),controller['show']);router[_0x3a91('0x9')](_0x3a91('0xb'),auth['isAuthenticated'](),controller[_0x3a91('0xc')]);router[_0x3a91('0x9')](_0x3a91('0xd'),auth[_0x3a91('0x7')](),controller[_0x3a91('0xe')]);router[_0x3a91('0xf')]('/',auth[_0x3a91('0x7')](),controller[_0x3a91('0x10')]);router['post'](_0x3a91('0xb'),auth[_0x3a91('0x7')](),controller['addConfiguration']);router[_0x3a91('0x11')](_0x3a91('0xa'),auth[_0x3a91('0x7')](),controller[_0x3a91('0x12')]);router[_0x3a91('0x13')](_0x3a91('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3a91('0x14')]=router; \ No newline at end of file +var _0x7e4c=['util','path','express','Router','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7e4c,0xdc));var _0xc7e4=function(_0x1edf2a,_0x55c423){_0x1edf2a=_0x1edf2a-0x0;var _0x5698f0=_0x7e4c[_0x1edf2a];return _0x5698f0;};'use strict';var multer=require('multer');var util=require(_0xc7e4('0x0'));var path=require(_0xc7e4('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7e4('0x2'));var router=express[_0xc7e4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc7e4('0x4'));var controller=require(_0xc7e4('0x5'));router[_0xc7e4('0x6')]('/',auth[_0xc7e4('0x7')](),controller[_0xc7e4('0x8')]);router[_0xc7e4('0x6')](_0xc7e4('0x9'),auth[_0xc7e4('0x7')](),controller[_0xc7e4('0xa')]);router[_0xc7e4('0x6')](_0xc7e4('0xb'),auth[_0xc7e4('0x7')](),controller['getConfigurations']);router[_0xc7e4('0x6')](_0xc7e4('0xc'),auth['isAuthenticated'](),controller[_0xc7e4('0xd')]);router['post']('/',auth[_0xc7e4('0x7')](),controller[_0xc7e4('0xe')]);router[_0xc7e4('0xf')]('/:id/configurations',auth[_0xc7e4('0x7')](),controller[_0xc7e4('0x10')]);router[_0xc7e4('0x11')](_0xc7e4('0x9'),auth[_0xc7e4('0x7')](),controller[_0xc7e4('0x12')]);router[_0xc7e4('0x13')](_0xc7e4('0x9'),auth[_0xc7e4('0x7')](),controller[_0xc7e4('0x14')]);module[_0xc7e4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2c3a849..2273890 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 _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x32b6,0x1d1));var _0x632b=function(_0x1da561,_0x2b94e3){_0x1da561=_0x1da561-0x0;var _0xec466=_0x32b6[_0x1da561];return _0xec466;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2542=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x2542,0x169));var _0x2254=function(_0x9fcb9d,_0x299aad){_0x9fcb9d=_0x9fcb9d-0x0;var _0x8ea66=_0x2542[_0x9fcb9d];return _0x8ea66;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')]},'description':{'type':Sequelize[_0x2254('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2254('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2254('0x2')],'unique':_0x2254('0x4')},'serverUrl':{'type':Sequelize[_0x2254('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 e637c15..4a41b6a 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 _0x4d6e=['stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','index','map','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','options','FreshdeskAccount','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','destroy','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','channel','getDescriptions','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','agent','priority','group','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x4d6e,0x77));var _0xe4d6=function(_0x4be18a,_0x326e6d){_0x4be18a=_0x4be18a-0x0;var _0x5042d4=_0x4d6e[_0x4be18a];return _0x5042d4;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a80eb,_0x3f7441){_0x3f7441=_0x3f7441||0xcc;return function(_0x53eac7){if(_0x53eac7){return _0x1a80eb[_0xe4d6('0x1b')](_0x3f7441);}return _0x1a80eb[_0xe4d6('0x1c')](_0x3f7441)['end']();};}function respondWithResult(_0xdc7f40,_0x780caa){_0x780caa=_0x780caa||0xc8;return function(_0x178f59){if(_0x178f59){return _0xdc7f40[_0xe4d6('0x1c')](_0x780caa)['json'](_0x178f59);}};}function respondWithFilteredResult(_0x2e04a9,_0x28e001){return function(_0x3dbe31){if(_0x3dbe31){var _0x1ca3fb=typeof _0x28e001['offset']===_0xe4d6('0x1d')&&typeof _0x28e001['limit']==='undefined';var _0x24e9cb=_0x3dbe31[_0xe4d6('0x1e')];var _0x68b15f=_0x1ca3fb?0x0:_0x28e001[_0xe4d6('0x1f')];var _0xe99d00=_0x1ca3fb?_0x3dbe31['count']:_0x28e001[_0xe4d6('0x1f')]+_0x28e001[_0xe4d6('0x20')];var _0xab15c8;if(_0xe99d00>=_0x24e9cb){_0xe99d00=_0x24e9cb;_0xab15c8=0xc8;}else{_0xab15c8=0xce;}_0x2e04a9[_0xe4d6('0x1c')](_0xab15c8);return _0x2e04a9[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x68b15f+'-'+_0xe99d00+'/'+_0x24e9cb)[_0xe4d6('0x23')](_0x3dbe31);}return null;};}function patchUpdates(_0x27e824){return function(_0x52d88d){try{jsonpatch[_0xe4d6('0x24')](_0x52d88d,_0x27e824,!![]);}catch(_0x48a404){return BPromise[_0xe4d6('0x25')](_0x48a404);}return _0x52d88d[_0xe4d6('0x26')]();};}function saveUpdates(_0x31f569,_0x162b57){return function(_0x185b9e){if(_0x185b9e){return _0x185b9e[_0xe4d6('0x27')](_0x31f569)[_0xe4d6('0x28')](function(_0x202f67){return _0x202f67;});}return null;};}function removeEntity(_0x59233f,_0x404fe1){return function(_0x12b159){if(_0x12b159){return _0x12b159['destroy']()[_0xe4d6('0x28')](function(){_0x59233f[_0xe4d6('0x1c')](0xcc)[_0xe4d6('0x29')]();});}};}function handleEntityNotFound(_0x3e8f41,_0x13aeec){return function(_0x2f467f){if(!_0x2f467f){_0x3e8f41[_0xe4d6('0x1b')](0x194);}return _0x2f467f;};}function handleError(_0xb4fe6a,_0x53110a){_0x53110a=_0x53110a||0x1f4;return function(_0x16d492){logger[_0xe4d6('0x2a')](_0x16d492['stack']);if(_0x16d492['name']){delete _0x16d492['name'];}_0xb4fe6a[_0xe4d6('0x1c')](_0x53110a)['send'](_0x16d492);};}exports[_0xe4d6('0x2b')]=function(_0x4b83fa,_0x4f0485){var _0x39f7d5={},_0x4e45f0={},_0x54ae70={'count':0x0,'rows':[]};var _0x112cbd=_[_0xe4d6('0x2c')](db['FreshdeskAccount']['rawAttributes'],function(_0x3fd34f){return{'name':_0x3fd34f[_0xe4d6('0x2d')],'type':_0x3fd34f['type'][_0xe4d6('0x2e')]};});_0x4e45f0[_0xe4d6('0x2f')]=_[_0xe4d6('0x2c')](_0x112cbd,_0xe4d6('0x30'));_0x4e45f0[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x4b83fa['query']);_0x4e45f0['filters']=_[_0xe4d6('0x33')](_0x4e45f0[_0xe4d6('0x2f')],_0x4e45f0['query']);_0x39f7d5[_0xe4d6('0x34')]=_['intersection'](_0x4e45f0[_0xe4d6('0x2f')],qs['fields'](_0x4b83fa['query'][_0xe4d6('0x35')]));_0x39f7d5['attributes']=_0x39f7d5['attributes'][_0xe4d6('0x36')]?_0x39f7d5[_0xe4d6('0x34')]:_0x4e45f0[_0xe4d6('0x2f')];if(!_0x4b83fa[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x39f7d5[_0xe4d6('0x20')]=qs[_0xe4d6('0x20')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x39f7d5[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x1f')]);}_0x39f7d5[_0xe4d6('0x38')]=qs['sort'](_0x4b83fa[_0xe4d6('0x31')]['sort']);_0x39f7d5[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_[_0xe4d6('0x3b')](_0x4b83fa[_0xe4d6('0x31')],_0x4e45f0['filters']),_0x112cbd);if(_0x4b83fa['query'][_0xe4d6('0x3c')]){_0x39f7d5[_0xe4d6('0x39')]=_[_0xe4d6('0x3d')](_0x39f7d5[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x112cbd,function(_0x20c286){if(_0x20c286[_0xe4d6('0x3e')]!=='VIRTUAL'){var _0x252dfd={};_0x252dfd[_0x20c286[_0xe4d6('0x30')]]={'$like':'%'+_0x4b83fa['query']['filter']+'%'};return _0x252dfd;}})});}_0x39f7d5=_[_0xe4d6('0x3d')]({},_0x39f7d5,_0x4b83fa[_0xe4d6('0x3f')]);var _0x4950cf={'where':_0x39f7d5[_0xe4d6('0x39')]};return db[_0xe4d6('0x40')][_0xe4d6('0x1e')](_0x4950cf)[_0xe4d6('0x28')](function(_0x48207b){_0x54ae70[_0xe4d6('0x1e')]=_0x48207b;if(_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x39f7d5[_0xe4d6('0x42')]=[{'all':!![]}];}return db[_0xe4d6('0x40')][_0xe4d6('0x43')](_0x39f7d5);})['then'](function(_0x5002dc){_0x54ae70['rows']=_0x5002dc;return _0x54ae70;})[_0xe4d6('0x28')](respondWithFilteredResult(_0x4f0485,_0x39f7d5))[_0xe4d6('0x44')](handleError(_0x4f0485,null));};exports[_0xe4d6('0x45')]=function(_0x314ad6,_0x4bc768){var _0x3d2516={'raw':![],'where':{'id':_0x314ad6['params']['id']}},_0x526593={};_0x526593[_0xe4d6('0x2f')]=_[_0xe4d6('0x32')](db[_0xe4d6('0x40')][_0xe4d6('0x46')]);_0x526593[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x314ad6['query']);_0x526593[_0xe4d6('0x3a')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],_0x526593[_0xe4d6('0x31')]);_0x3d2516[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x314ad6['query'][_0xe4d6('0x35')]));_0x3d2516[_0xe4d6('0x34')]=_0x3d2516[_0xe4d6('0x34')]['length']?_0x3d2516['attributes']:_0x526593[_0xe4d6('0x2f')];if(_0x314ad6[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x3d2516[_0xe4d6('0x42')]=[{'all':!![]}];}_0x3d2516=_[_0xe4d6('0x3d')]({},_0x3d2516,_0x314ad6[_0xe4d6('0x3f')]);return db[_0xe4d6('0x40')][_0xe4d6('0x47')](_0x3d2516)[_0xe4d6('0x28')](handleEntityNotFound(_0x4bc768,null))[_0xe4d6('0x28')](respondWithResult(_0x4bc768,null))[_0xe4d6('0x44')](handleError(_0x4bc768,null));};exports[_0xe4d6('0x48')]=function(_0xe6fb2c,_0x194307){return db[_0xe4d6('0x40')][_0xe4d6('0x48')](_0xe6fb2c['body'],{})[_0xe4d6('0x28')](respondWithResult(_0x194307,0xc9))[_0xe4d6('0x44')](handleError(_0x194307,null));};exports['update']=function(_0x2bea52,_0x538e25){if(_0x2bea52[_0xe4d6('0x49')]['id']){delete _0x2bea52[_0xe4d6('0x49')]['id'];}return db['FreshdeskAccount'][_0xe4d6('0x47')]({'where':{'id':_0x2bea52['params']['id']}})['then'](handleEntityNotFound(_0x538e25,null))[_0xe4d6('0x28')](saveUpdates(_0x2bea52[_0xe4d6('0x49')],null))['then'](respondWithResult(_0x538e25,null))[_0xe4d6('0x44')](handleError(_0x538e25,null));};exports[_0xe4d6('0x4a')]=function(_0x24ed6b,_0x278c96){return db[_0xe4d6('0x40')]['find']({'where':{'id':_0x24ed6b[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x278c96,null))['then'](removeEntity(_0x278c96,null))['catch'](handleError(_0x278c96,null));};exports[_0xe4d6('0x4c')]=function(_0x12ecaf,_0x30612c,_0x478827){var _0x14f615={};var _0xc55241={};var _0x1da5e9;var _0x427575;return db[_0xe4d6('0x40')]['findOne']({'where':{'id':_0x12ecaf[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x30612c,null))[_0xe4d6('0x28')](function(_0x1b22c2){if(_0x1b22c2){_0x1da5e9=_0x1b22c2;_0xc55241[_0xe4d6('0x2f')]=_['keys'](db[_0xe4d6('0x4d')][_0xe4d6('0x46')]);_0xc55241[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x12ecaf[_0xe4d6('0x31')]);_0xc55241[_0xe4d6('0x3a')]=_['intersection'](_0xc55241[_0xe4d6('0x2f')],_0xc55241[_0xe4d6('0x31')]);_0x14f615[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0xc55241[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x35')]));_0x14f615[_0xe4d6('0x34')]=_0x14f615[_0xe4d6('0x34')][_0xe4d6('0x36')]?_0x14f615['attributes']:_0xc55241[_0xe4d6('0x2f')];_0x14f615[_0xe4d6('0x38')]=qs[_0xe4d6('0x4e')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x4e')]);_0x14f615[_0xe4d6('0x39')]=qs['filters'](_['pick'](_0x12ecaf[_0xe4d6('0x31')],_0xc55241[_0xe4d6('0x3a')]));if(_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]){_0x14f615['where']=_['merge'](_0x14f615[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x14f615[_0xe4d6('0x34')],function(_0x2b6451){var _0x4b8047={};_0x4b8047[_0x2b6451]={'$like':'%'+_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]+'%'};return _0x4b8047;})});}_0x14f615=_['merge']({},_0x14f615,_0x12ecaf[_0xe4d6('0x3f')]);return _0x1da5e9['getConfigurations'](_0x14f615);}})[_0xe4d6('0x28')](function(_0x3b155b){if(_0x3b155b){_0x427575=_0x3b155b['length'];if(!_0x12ecaf[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x14f615[_0xe4d6('0x20')]=qs['limit'](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x14f615[_0xe4d6('0x1f')]=qs['offset'](_0x12ecaf['query']['offset']);}return _0x1da5e9[_0xe4d6('0x4c')](_0x14f615);}})[_0xe4d6('0x28')](function(_0x2ae27f){if(_0x2ae27f){return _0x2ae27f?{'count':_0x427575,'rows':_0x2ae27f}:null;}})[_0xe4d6('0x28')](respondWithResult(_0x30612c,null))[_0xe4d6('0x44')](handleError(_0x30612c,null));};exports[_0xe4d6('0x4f')]=function(_0x520608,_0x2d780d,_0x17d129){if(_0x520608[_0xe4d6('0x49')]['id']){delete _0x520608[_0xe4d6('0x49')]['id'];}return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0x520608[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x2d780d,null))[_0xe4d6('0x28')](function(_0x4fde5e){if(_0x4fde5e){_0x520608['body'][_0xe4d6('0x51')]=_0x4fde5e['id'];_0x520608[_0xe4d6('0x49')]['Subjects']=integrations['getSubjects'](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);_0x520608[_0xe4d6('0x49')]['Descriptions']=integrations[_0xe4d6('0x53')](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);return db[_0xe4d6('0x4d')]['create'](_0x520608[_0xe4d6('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe4d6('0x54')},{'model':db[_0xe4d6('0x55')],'as':_0xe4d6('0x56')}]});}return null;})[_0xe4d6('0x28')](respondWithResult(_0x2d780d,null))['catch'](handleError(_0x2d780d,null));};exports[_0xe4d6('0x57')]=function(_0xea686f,_0x3da67a,_0x309421){var _0x5e10ca='';return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0xea686f[_0xe4d6('0x4b')]['id']},'attributes':['id',_0xe4d6('0x58'),_0xe4d6('0x59')]})[_0xe4d6('0x28')](handleEntityNotFound(_0x3da67a,null))[_0xe4d6('0x28')](function(_0xc91476){if(_0xc91476){_0x5e10ca=_0xc91476[_0xe4d6('0x58')];var _0xeaa39=_0x5e10ca[_0xe4d6('0x5a')](-0x1);if(_0xeaa39==='/'){_0x5e10ca=_0x5e10ca[_0xe4d6('0x5b')](0x0,_0x5e10ca[_0xe4d6('0x5c')](_0xeaa39));}return rp({'method':_0xe4d6('0x5d'),'uri':util[_0xe4d6('0x5e')](_0xe4d6('0x5f'),_0x5e10ca,_0xe4d6('0x60')),'headers':{'Authorization':util[_0xe4d6('0x5e')]('Basic\x20%s',new Buffer(util[_0xe4d6('0x5e')](_0xe4d6('0x61'),_0xc91476[_0xe4d6('0x59')]))[_0xe4d6('0x62')]('base64'))},'json':!![]});}})[_0xe4d6('0x28')](function(_0x36a77f){if(_0x36a77f){var _0x256541=['requester','subject',_0xe4d6('0x63'),'description',_0xe4d6('0x1c'),_0xe4d6('0x64'),_0xe4d6('0x65'),'source',_0xe4d6('0x66'),_0xe4d6('0x65'),_0xe4d6('0x67')];_[_0xe4d6('0x68')](_0x36a77f,function(_0x2b2bdc){return _0x256541[_0xe4d6('0x69')](_0x2b2bdc[_0xe4d6('0x30')])||!_0x2b2bdc[_0xe4d6('0x6a')]&&_0x2b2bdc[_0xe4d6('0x3e')]!==_0xe4d6('0x6b')&&_0x2b2bdc[_0xe4d6('0x3e')]!=='custom_dropdown';});return{'count':_0x36a77f[_0xe4d6('0x36')],'rows':_['map'](_0x36a77f,function(_0x1ea6b7){return{'id':_0x1ea6b7['name'],'name':_0x1ea6b7[_0xe4d6('0x6c')],'custom':!_0x1ea6b7[_0xe4d6('0x6a')],'options':_0x1ea6b7[_0xe4d6('0x6d')]?_[_0xe4d6('0x2c')](_0x1ea6b7[_0xe4d6('0x6d')],function(_0x258f2d){return{'name':_[_0xe4d6('0x6e')](_0x258f2d),'value':_0x258f2d};}):[]};})};}})[_0xe4d6('0x28')](respondWithResult(_0x3da67a,null))[_0xe4d6('0x44')](function(_0x55e95c){var _0x87d700=_0xea686f[_0xe4d6('0x31')]['test']?0x1f4:_0x55e95c[_0xe4d6('0x6f')]||0x1f4;logger[_0xe4d6('0x2a')](_0xe4d6('0x70'),'getFields',_0x87d700,JSON[_0xe4d6('0x71')](_0x55e95c));delete _0x55e95c['name'];if(_0x87d700===0x191){_0x87d700=0x190;}_0x3da67a[_0xe4d6('0x1c')](_0x87d700)[_0xe4d6('0x72')](_0xea686f[_0xe4d6('0x31')][_0xe4d6('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x55e95c[_0xe4d6('0x6f')]}:_0x55e95c);});}; \ No newline at end of file +var _0x9bb4=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','update','destroy','error','stack','name','send','index','map','FreshdeskAccount','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','pick','nolimit','addConfiguration','AccountId','getSubjects','getDescriptions','channel','FreshdeskField','Subjects','getFields','apiKey','remoteUri','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','subject','priority','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x29c62f,_0x276bf1){var _0x511b7a=function(_0x5dc5c9){while(--_0x5dc5c9){_0x29c62f['push'](_0x29c62f['shift']());}};_0x511b7a(++_0x276bf1);}(_0x9bb4,0xd5));var _0x49bb=function(_0xc807fd,_0x5dc7de){_0xc807fd=_0xc807fd-0x0;var _0x51b07d=_0x9bb4[_0xc807fd];return _0x51b07d;};'use strict';var emlformat=require(_0x49bb('0x0'));var rimraf=require(_0x49bb('0x1'));var zipdir=require(_0x49bb('0x2'));var jsonpatch=require(_0x49bb('0x3'));var rp=require(_0x49bb('0x4'));var moment=require(_0x49bb('0x5'));var BPromise=require(_0x49bb('0x6'));var Mustache=require(_0x49bb('0x7'));var util=require(_0x49bb('0x8'));var path=require('path');var sox=require(_0x49bb('0x9'));var csv=require(_0x49bb('0xa'));var ejs=require(_0x49bb('0xb'));var fs=require('fs');var fs_extra=require(_0x49bb('0xc'));var _=require('lodash');var squel=require(_0x49bb('0xd'));var crypto=require(_0x49bb('0xe'));var jsforce=require(_0x49bb('0xf'));var deskjs=require(_0x49bb('0x10'));var toCsv=require(_0x49bb('0xa'));var querystring=require('querystring');var Papa=require(_0x49bb('0x11'));var Redis=require('ioredis');var authService=require(_0x49bb('0x12'));var qs=require(_0x49bb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49bb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x49bb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x49bb('0x16'));var db=require(_0x49bb('0x17'))['db'];var integrations=require(_0x49bb('0x18'));function respondWithStatusCode(_0x3b85fc,_0x1ff6d1){_0x1ff6d1=_0x1ff6d1||0xcc;return function(_0x174058){if(_0x174058){return _0x3b85fc[_0x49bb('0x19')](_0x1ff6d1);}return _0x3b85fc[_0x49bb('0x1a')](_0x1ff6d1)[_0x49bb('0x1b')]();};}function respondWithResult(_0x59472f,_0x13c850){_0x13c850=_0x13c850||0xc8;return function(_0x4ba792){if(_0x4ba792){return _0x59472f[_0x49bb('0x1a')](_0x13c850)[_0x49bb('0x1c')](_0x4ba792);}};}function respondWithFilteredResult(_0x1f0210,_0x230f20){return function(_0x145d52){if(_0x145d52){var _0x34ad8a=typeof _0x230f20[_0x49bb('0x1d')]===_0x49bb('0x1e')&&typeof _0x230f20['limit']===_0x49bb('0x1e');var _0x32a124=_0x145d52['count'];var _0x2cb8de=_0x34ad8a?0x0:_0x230f20[_0x49bb('0x1d')];var _0x554fbb=_0x34ad8a?_0x145d52[_0x49bb('0x1f')]:_0x230f20[_0x49bb('0x1d')]+_0x230f20['limit'];var _0x1a9894;if(_0x554fbb>=_0x32a124){_0x554fbb=_0x32a124;_0x1a9894=0xc8;}else{_0x1a9894=0xce;}_0x1f0210[_0x49bb('0x1a')](_0x1a9894);return _0x1f0210['set'](_0x49bb('0x20'),_0x2cb8de+'-'+_0x554fbb+'/'+_0x32a124)['json'](_0x145d52);}return null;};}function patchUpdates(_0x1728e9){return function(_0x5cdd62){try{jsonpatch['apply'](_0x5cdd62,_0x1728e9,!![]);}catch(_0x217564){return BPromise['reject'](_0x217564);}return _0x5cdd62['save']();};}function saveUpdates(_0x16b8fa,_0x1ade8b){return function(_0x1a76b6){if(_0x1a76b6){return _0x1a76b6[_0x49bb('0x21')](_0x16b8fa)['then'](function(_0x490c3e){return _0x490c3e;});}return null;};}function removeEntity(_0x5cacdb,_0x4eae24){return function(_0x5f5625){if(_0x5f5625){return _0x5f5625[_0x49bb('0x22')]()['then'](function(){_0x5cacdb['status'](0xcc)[_0x49bb('0x1b')]();});}};}function handleEntityNotFound(_0x42fd72,_0x341bd9){return function(_0x53b9f2){if(!_0x53b9f2){_0x42fd72[_0x49bb('0x19')](0x194);}return _0x53b9f2;};}function handleError(_0x59225e,_0x323be7){_0x323be7=_0x323be7||0x1f4;return function(_0x447540){logger[_0x49bb('0x23')](_0x447540[_0x49bb('0x24')]);if(_0x447540['name']){delete _0x447540[_0x49bb('0x25')];}_0x59225e[_0x49bb('0x1a')](_0x323be7)[_0x49bb('0x26')](_0x447540);};}exports[_0x49bb('0x27')]=function(_0x51cc97,_0x1f0c73){var _0x3207e9={},_0x3ab8a8={},_0x3a6ed8={'count':0x0,'rows':[]};var _0x5383a3=_[_0x49bb('0x28')](db[_0x49bb('0x29')]['rawAttributes'],function(_0x38108d){return{'name':_0x38108d['fieldName'],'type':_0x38108d[_0x49bb('0x2a')][_0x49bb('0x2b')]};});_0x3ab8a8['model']=_[_0x49bb('0x28')](_0x5383a3,_0x49bb('0x25'));_0x3ab8a8['query']=_[_0x49bb('0x2c')](_0x51cc97[_0x49bb('0x2d')]);_0x3ab8a8[_0x49bb('0x2e')]=_[_0x49bb('0x2f')](_0x3ab8a8[_0x49bb('0x30')],_0x3ab8a8[_0x49bb('0x2d')]);_0x3207e9[_0x49bb('0x31')]=_[_0x49bb('0x2f')](_0x3ab8a8['model'],qs[_0x49bb('0x32')](_0x51cc97[_0x49bb('0x2d')][_0x49bb('0x32')]));_0x3207e9[_0x49bb('0x31')]=_0x3207e9['attributes'][_0x49bb('0x33')]?_0x3207e9['attributes']:_0x3ab8a8[_0x49bb('0x30')];if(!_0x51cc97['query'][_0x49bb('0x34')]('nolimit')){_0x3207e9[_0x49bb('0x35')]=qs[_0x49bb('0x35')](_0x51cc97['query']['limit']);_0x3207e9['offset']=qs['offset'](_0x51cc97['query'][_0x49bb('0x1d')]);}_0x3207e9[_0x49bb('0x36')]=qs[_0x49bb('0x37')](_0x51cc97[_0x49bb('0x2d')][_0x49bb('0x37')]);_0x3207e9[_0x49bb('0x38')]=qs[_0x49bb('0x2e')](_['pick'](_0x51cc97['query'],_0x3ab8a8[_0x49bb('0x2e')]),_0x5383a3);if(_0x51cc97[_0x49bb('0x2d')]['filter']){_0x3207e9[_0x49bb('0x38')]=_[_0x49bb('0x39')](_0x3207e9['where'],{'$or':_['map'](_0x5383a3,function(_0x36227f){if(_0x36227f['type']!==_0x49bb('0x3a')){var _0x3071ae={};_0x3071ae[_0x36227f[_0x49bb('0x25')]]={'$like':'%'+_0x51cc97[_0x49bb('0x2d')][_0x49bb('0x3b')]+'%'};return _0x3071ae;}})});}_0x3207e9=_[_0x49bb('0x39')]({},_0x3207e9,_0x51cc97[_0x49bb('0x3c')]);var _0x6d7077={'where':_0x3207e9[_0x49bb('0x38')]};return db[_0x49bb('0x29')][_0x49bb('0x1f')](_0x6d7077)[_0x49bb('0x3d')](function(_0x171d5d){_0x3a6ed8[_0x49bb('0x1f')]=_0x171d5d;if(_0x51cc97[_0x49bb('0x2d')][_0x49bb('0x3e')]){_0x3207e9[_0x49bb('0x3f')]=[{'all':!![]}];}return db[_0x49bb('0x29')][_0x49bb('0x40')](_0x3207e9);})[_0x49bb('0x3d')](function(_0x2781f1){_0x3a6ed8[_0x49bb('0x41')]=_0x2781f1;return _0x3a6ed8;})[_0x49bb('0x3d')](respondWithFilteredResult(_0x1f0c73,_0x3207e9))['catch'](handleError(_0x1f0c73,null));};exports[_0x49bb('0x42')]=function(_0x48db08,_0x1cd6cc){var _0x1eac94={'raw':![],'where':{'id':_0x48db08[_0x49bb('0x43')]['id']}},_0x310d2f={};_0x310d2f[_0x49bb('0x30')]=_['keys'](db[_0x49bb('0x29')][_0x49bb('0x44')]);_0x310d2f[_0x49bb('0x2d')]=_[_0x49bb('0x2c')](_0x48db08[_0x49bb('0x2d')]);_0x310d2f['filters']=_[_0x49bb('0x2f')](_0x310d2f[_0x49bb('0x30')],_0x310d2f[_0x49bb('0x2d')]);_0x1eac94[_0x49bb('0x31')]=_['intersection'](_0x310d2f['model'],qs[_0x49bb('0x32')](_0x48db08[_0x49bb('0x2d')][_0x49bb('0x32')]));_0x1eac94[_0x49bb('0x31')]=_0x1eac94[_0x49bb('0x31')][_0x49bb('0x33')]?_0x1eac94['attributes']:_0x310d2f[_0x49bb('0x30')];if(_0x48db08['query'][_0x49bb('0x3e')]){_0x1eac94[_0x49bb('0x3f')]=[{'all':!![]}];}_0x1eac94=_['merge']({},_0x1eac94,_0x48db08['options']);return db['FreshdeskAccount']['find'](_0x1eac94)[_0x49bb('0x3d')](handleEntityNotFound(_0x1cd6cc,null))[_0x49bb('0x3d')](respondWithResult(_0x1cd6cc,null))[_0x49bb('0x45')](handleError(_0x1cd6cc,null));};exports[_0x49bb('0x46')]=function(_0x4bda54,_0x5d077a){return db[_0x49bb('0x29')][_0x49bb('0x46')](_0x4bda54[_0x49bb('0x47')],{})[_0x49bb('0x3d')](respondWithResult(_0x5d077a,0xc9))['catch'](handleError(_0x5d077a,null));};exports[_0x49bb('0x21')]=function(_0x382bc4,_0x56ee98){if(_0x382bc4[_0x49bb('0x47')]['id']){delete _0x382bc4[_0x49bb('0x47')]['id'];}return db[_0x49bb('0x29')][_0x49bb('0x48')]({'where':{'id':_0x382bc4[_0x49bb('0x43')]['id']}})['then'](handleEntityNotFound(_0x56ee98,null))[_0x49bb('0x3d')](saveUpdates(_0x382bc4[_0x49bb('0x47')],null))[_0x49bb('0x3d')](respondWithResult(_0x56ee98,null))['catch'](handleError(_0x56ee98,null));};exports[_0x49bb('0x22')]=function(_0x359dfd,_0x144a77){return db[_0x49bb('0x29')][_0x49bb('0x48')]({'where':{'id':_0x359dfd['params']['id']}})[_0x49bb('0x3d')](handleEntityNotFound(_0x144a77,null))[_0x49bb('0x3d')](removeEntity(_0x144a77,null))[_0x49bb('0x45')](handleError(_0x144a77,null));};exports[_0x49bb('0x49')]=function(_0x412f3b,_0xfe69c8,_0x113ba6){var _0x28570b={};var _0xf7c5fa={};var _0x3c86ea;var _0x2ead0f;return db['FreshdeskAccount'][_0x49bb('0x4a')]({'where':{'id':_0x412f3b[_0x49bb('0x43')]['id']}})[_0x49bb('0x3d')](handleEntityNotFound(_0xfe69c8,null))[_0x49bb('0x3d')](function(_0x10327c){if(_0x10327c){_0x3c86ea=_0x10327c;_0xf7c5fa[_0x49bb('0x30')]=_[_0x49bb('0x2c')](db[_0x49bb('0x4b')][_0x49bb('0x44')]);_0xf7c5fa[_0x49bb('0x2d')]=_[_0x49bb('0x2c')](_0x412f3b[_0x49bb('0x2d')]);_0xf7c5fa[_0x49bb('0x2e')]=_[_0x49bb('0x2f')](_0xf7c5fa[_0x49bb('0x30')],_0xf7c5fa[_0x49bb('0x2d')]);_0x28570b[_0x49bb('0x31')]=_[_0x49bb('0x2f')](_0xf7c5fa[_0x49bb('0x30')],qs[_0x49bb('0x32')](_0x412f3b[_0x49bb('0x2d')][_0x49bb('0x32')]));_0x28570b[_0x49bb('0x31')]=_0x28570b['attributes'][_0x49bb('0x33')]?_0x28570b[_0x49bb('0x31')]:_0xf7c5fa[_0x49bb('0x30')];_0x28570b[_0x49bb('0x36')]=qs[_0x49bb('0x37')](_0x412f3b[_0x49bb('0x2d')][_0x49bb('0x37')]);_0x28570b[_0x49bb('0x38')]=qs[_0x49bb('0x2e')](_[_0x49bb('0x4c')](_0x412f3b['query'],_0xf7c5fa['filters']));if(_0x412f3b['query'][_0x49bb('0x3b')]){_0x28570b['where']=_[_0x49bb('0x39')](_0x28570b[_0x49bb('0x38')],{'$or':_[_0x49bb('0x28')](_0x28570b[_0x49bb('0x31')],function(_0x29e73f){var _0xf1af39={};_0xf1af39[_0x29e73f]={'$like':'%'+_0x412f3b[_0x49bb('0x2d')][_0x49bb('0x3b')]+'%'};return _0xf1af39;})});}_0x28570b=_['merge']({},_0x28570b,_0x412f3b[_0x49bb('0x3c')]);return _0x3c86ea[_0x49bb('0x49')](_0x28570b);}})[_0x49bb('0x3d')](function(_0x435761){if(_0x435761){_0x2ead0f=_0x435761[_0x49bb('0x33')];if(!_0x412f3b[_0x49bb('0x2d')][_0x49bb('0x34')](_0x49bb('0x4d'))){_0x28570b['limit']=qs[_0x49bb('0x35')](_0x412f3b[_0x49bb('0x2d')][_0x49bb('0x35')]);_0x28570b[_0x49bb('0x1d')]=qs['offset'](_0x412f3b[_0x49bb('0x2d')][_0x49bb('0x1d')]);}return _0x3c86ea['getConfigurations'](_0x28570b);}})[_0x49bb('0x3d')](function(_0x36ff04){if(_0x36ff04){return _0x36ff04?{'count':_0x2ead0f,'rows':_0x36ff04}:null;}})[_0x49bb('0x3d')](respondWithResult(_0xfe69c8,null))[_0x49bb('0x45')](handleError(_0xfe69c8,null));};exports[_0x49bb('0x4e')]=function(_0x5988f7,_0x2f03ec,_0x3c3bd8){if(_0x5988f7[_0x49bb('0x47')]['id']){delete _0x5988f7[_0x49bb('0x47')]['id'];}return db[_0x49bb('0x29')][_0x49bb('0x4a')]({'where':{'id':_0x5988f7['params']['id']}})[_0x49bb('0x3d')](handleEntityNotFound(_0x2f03ec,null))[_0x49bb('0x3d')](function(_0x56b2e7){if(_0x56b2e7){_0x5988f7['body'][_0x49bb('0x4f')]=_0x56b2e7['id'];_0x5988f7[_0x49bb('0x47')]['Subjects']=integrations[_0x49bb('0x50')](_0x5988f7[_0x49bb('0x47')]['channel'],_0x5988f7[_0x49bb('0x47')][_0x49bb('0x2a')]);_0x5988f7[_0x49bb('0x47')]['Descriptions']=integrations[_0x49bb('0x51')](_0x5988f7['body'][_0x49bb('0x52')],_0x5988f7[_0x49bb('0x47')][_0x49bb('0x2a')]);return db[_0x49bb('0x4b')][_0x49bb('0x46')](_0x5988f7[_0x49bb('0x47')],{'include':[{'model':db[_0x49bb('0x53')],'as':_0x49bb('0x54')},{'model':db[_0x49bb('0x53')],'as':'Descriptions'}]});}return null;})[_0x49bb('0x3d')](respondWithResult(_0x2f03ec,null))[_0x49bb('0x45')](handleError(_0x2f03ec,null));};exports[_0x49bb('0x55')]=function(_0x193259,_0x5c565f,_0x3165f5){var _0x139561='';return db['FreshdeskAccount'][_0x49bb('0x4a')]({'where':{'id':_0x193259[_0x49bb('0x43')]['id']},'attributes':['id','remoteUri',_0x49bb('0x56')]})[_0x49bb('0x3d')](handleEntityNotFound(_0x5c565f,null))[_0x49bb('0x3d')](function(_0x1fe623){if(_0x1fe623){_0x139561=_0x1fe623[_0x49bb('0x57')];var _0x1223dd=_0x139561[_0x49bb('0x58')](-0x1);if(_0x1223dd==='/'){_0x139561=_0x139561[_0x49bb('0x59')](0x0,_0x139561['lastIndexOf'](_0x1223dd));}return rp({'method':_0x49bb('0x5a'),'uri':util[_0x49bb('0x5b')](_0x49bb('0x5c'),_0x139561,_0x49bb('0x5d')),'headers':{'Authorization':util[_0x49bb('0x5b')](_0x49bb('0x5e'),new Buffer(util[_0x49bb('0x5b')]('%s:X',_0x1fe623[_0x49bb('0x56')]))[_0x49bb('0x5f')](_0x49bb('0x60')))},'json':!![]});}})[_0x49bb('0x3d')](function(_0x512057){if(_0x512057){var _0x131f6a=['requester',_0x49bb('0x61'),'agent','description','status',_0x49bb('0x62'),_0x49bb('0x63'),'source','ticket_type',_0x49bb('0x63'),_0x49bb('0x64')];_[_0x49bb('0x65')](_0x512057,function(_0x238f77){return _0x131f6a[_0x49bb('0x66')](_0x238f77[_0x49bb('0x25')])||!_0x238f77[_0x49bb('0x67')]&&_0x238f77[_0x49bb('0x2a')]!==_0x49bb('0x68')&&_0x238f77[_0x49bb('0x2a')]!==_0x49bb('0x69');});return{'count':_0x512057['length'],'rows':_[_0x49bb('0x28')](_0x512057,function(_0x18dc1f){return{'id':_0x18dc1f[_0x49bb('0x25')],'name':_0x18dc1f[_0x49bb('0x6a')],'custom':!_0x18dc1f[_0x49bb('0x67')],'options':_0x18dc1f[_0x49bb('0x6b')]?_[_0x49bb('0x28')](_0x18dc1f['choices'],function(_0x1fa290){return{'name':_[_0x49bb('0x6c')](_0x1fa290),'value':_0x1fa290};}):[]};})};}})['then'](respondWithResult(_0x5c565f,null))[_0x49bb('0x45')](function(_0x3e0c10){var _0x4a03f8=_0x193259[_0x49bb('0x2d')][_0x49bb('0x6d')]?0x1f4:_0x3e0c10[_0x49bb('0x6e')]||0x1f4;logger[_0x49bb('0x23')](_0x49bb('0x6f'),_0x49bb('0x55'),_0x4a03f8,JSON['stringify'](_0x3e0c10));delete _0x3e0c10['name'];if(_0x4a03f8===0x191){_0x4a03f8=0x190;}_0x5c565f[_0x49bb('0x1a')](_0x4a03f8)[_0x49bb('0x26')](_0x193259[_0x49bb('0x2d')][_0x49bb('0x6d')]?{'message':_0x49bb('0x70'),'statusCode':_0x3e0c10[_0x49bb('0x6e')]}:_0x3e0c10);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index fdb2484..e8baa2c 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 _0x3461=['rimraf','./intFreshdeskAccount.attributes','define','FreshdeskAccount','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x7ab6b6,_0x4f7b85){var _0x53569e=function(_0x40616a){while(--_0x40616a){_0x7ab6b6['push'](_0x7ab6b6['shift']());}};_0x53569e(++_0x4f7b85);}(_0x3461,0x1dd));var _0x1346=function(_0x87a9e9,_0x48c5f3){_0x87a9e9=_0x87a9e9-0x0;var _0x34aafa=_0x3461[_0x87a9e9];return _0x34aafa;};'use strict';var _=require(_0x1346('0x0'));var util=require(_0x1346('0x1'));var logger=require('../../config/logger')(_0x1346('0x2'));var moment=require(_0x1346('0x3'));var BPromise=require(_0x1346('0x4'));var rp=require(_0x1346('0x5'));var fs=require('fs');var path=require(_0x1346('0x6'));var rimraf=require(_0x1346('0x7'));var config=require('../../config/environment');var attributes=require(_0x1346('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1e0f3e,_0x2c9503){return _0x1e0f3e[_0x1346('0x9')](_0x1346('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x856a=['FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x53dc4b,_0x586d71){var _0x116bbe=function(_0x41ce45){while(--_0x41ce45){_0x53dc4b['push'](_0x53dc4b['shift']());}};_0x116bbe(++_0x586d71);}(_0x856a,0x182));var _0xa856=function(_0x5c178f,_0x58bccd){_0x5c178f=_0x5c178f-0x0;var _0x867b42=_0x856a[_0x5c178f];return _0x867b42;};'use strict';var _=require(_0xa856('0x0'));var util=require(_0xa856('0x1'));var logger=require(_0xa856('0x2'))(_0xa856('0x3'));var moment=require(_0xa856('0x4'));var BPromise=require(_0xa856('0x5'));var rp=require(_0xa856('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa856('0x7'));var integrations=require(_0xa856('0x8'));module[_0xa856('0x9')]=function(_0x23faf8,_0x3e807){return _0x23faf8['define'](_0xa856('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 785b2f7..94a9236 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 _0xa472=['../../config/environment','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','options','raw','where','attributes','limit','include','map','model','FreshdeskAccount','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa472,0xed));var _0x2a47=function(_0x514d5b,_0x309ef4){_0x514d5b=_0x514d5b-0x0;var _0xede224=_0xa472[_0x514d5b];return _0xede224;};'use strict';var _=require(_0x2a47('0x0'));var util=require(_0x2a47('0x1'));var moment=require(_0x2a47('0x2'));var BPromise=require(_0x2a47('0x3'));var rs=require(_0x2a47('0x4'));var fs=require('fs');var Redis=require(_0x2a47('0x5'));var db=require(_0x2a47('0x6'))['db'];var utils=require(_0x2a47('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2a47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a47('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb5a8,_0x1c3bcd,_0x54ced2){return new BPromise(function(_0x4c498f,_0x2d6ade){return client[_0x2a47('0xa')](_0x5bb5a8,_0x54ced2)[_0x2a47('0xb')](function(_0x132181){logger['info'](_0x2a47('0xc'),_0x1c3bcd,_0x2a47('0xd'));logger[_0x2a47('0xe')](_0x2a47('0xf'),_0x1c3bcd,_0x2a47('0xd'),JSON[_0x2a47('0x10')](_0x132181));if(_0x132181[_0x2a47('0x11')]){if(_0x132181[_0x2a47('0x11')][_0x2a47('0x12')]===0x1f4){logger['error'](_0x2a47('0xc'),_0x1c3bcd,_0x132181[_0x2a47('0x11')][_0x2a47('0x13')]);return _0x2d6ade(_0x132181['error']['message']);}logger[_0x2a47('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x1c3bcd,_0x132181[_0x2a47('0x11')][_0x2a47('0x13')]);return _0x4c498f(_0x132181[_0x2a47('0x11')][_0x2a47('0x13')]);}else{logger[_0x2a47('0x14')](_0x2a47('0xc'),_0x1c3bcd,_0x2a47('0xd'));_0x4c498f(_0x132181[_0x2a47('0x15')][_0x2a47('0x13')]);}})[_0x2a47('0x16')](function(_0x4f21e9){logger['error'](_0x2a47('0xc'),_0x1c3bcd,_0x4f21e9);_0x2d6ade(_0x4f21e9);});});}exports[_0x2a47('0x17')]=function(_0x130271){var _0x4d9d5b=this;return new Promise(function(_0x58eaa6,_0x555f1f){return db['FreshdeskAccount']['findAll']({'raw':_0x130271[_0x2a47('0x18')]?_0x130271[_0x2a47('0x18')][_0x2a47('0x19')]===undefined?!![]:![]:!![],'where':_0x130271['options']?_0x130271[_0x2a47('0x18')][_0x2a47('0x1a')]||null:null,'attributes':_0x130271[_0x2a47('0x18')]?_0x130271['options'][_0x2a47('0x1b')]||null:null,'limit':_0x130271[_0x2a47('0x18')]?_0x130271[_0x2a47('0x18')][_0x2a47('0x1c')]||null:null,'include':_0x130271[_0x2a47('0x18')]?_0x130271['options'][_0x2a47('0x1d')]?_[_0x2a47('0x1e')](_0x130271[_0x2a47('0x18')][_0x2a47('0x1d')],function(_0x308155){return{'model':db[_0x308155[_0x2a47('0x1f')]],'as':_0x308155['as'],'attributes':_0x308155[_0x2a47('0x1b')],'include':_0x308155['include']?_[_0x2a47('0x1e')](_0x308155[_0x2a47('0x1d')],function(_0x42132e){return{'model':db[_0x42132e[_0x2a47('0x1f')]],'as':_0x42132e['as'],'attributes':_0x42132e[_0x2a47('0x1b')],'include':_0x42132e[_0x2a47('0x1d')]?_[_0x2a47('0x1e')](_0x42132e[_0x2a47('0x1d')],function(_0x210d82){return{'model':db[_0x210d82[_0x2a47('0x1f')]],'as':_0x210d82['as'],'attributes':_0x210d82['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a47('0xb')](function(_0x12d96e){logger['info'](_0x2a47('0x17'),_0x130271);logger[_0x2a47('0xe')](_0x2a47('0x17'),_0x130271,JSON[_0x2a47('0x10')](_0x12d96e));_0x58eaa6(_0x12d96e);})['catch'](function(_0x3363d7){logger['error'](_0x2a47('0x17'),_0x3363d7['message'],_0x130271);_0x555f1f(_0x4d9d5b[_0x2a47('0x11')](0x1f4,_0x3363d7[_0x2a47('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x14b082){var _0x2f9b36=this;return new Promise(function(_0x8012b7,_0x5978a6){return db[_0x2a47('0x20')][_0x2a47('0x21')]({'raw':_0x14b082['options']?_0x14b082[_0x2a47('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x14b082[_0x2a47('0x18')]?_0x14b082[_0x2a47('0x18')][_0x2a47('0x1a')]||null:null,'attributes':_0x14b082[_0x2a47('0x18')]?_0x14b082['options'][_0x2a47('0x1b')]||null:null,'include':_0x14b082[_0x2a47('0x18')]?_0x14b082['options'][_0x2a47('0x1d')]?_['map'](_0x14b082[_0x2a47('0x18')][_0x2a47('0x1d')],function(_0x13fb48){return{'model':db[_0x13fb48[_0x2a47('0x1f')]],'as':_0x13fb48['as'],'attributes':_0x13fb48[_0x2a47('0x1b')],'include':_0x13fb48[_0x2a47('0x1d')]?_[_0x2a47('0x1e')](_0x13fb48[_0x2a47('0x1d')],function(_0x285082){return{'model':db[_0x285082['model']],'as':_0x285082['as'],'attributes':_0x285082[_0x2a47('0x1b')],'include':_0x285082[_0x2a47('0x1d')]?_[_0x2a47('0x1e')](_0x285082['include'],function(_0x583dfd){return{'model':db[_0x583dfd[_0x2a47('0x1f')]],'as':_0x583dfd['as'],'attributes':_0x583dfd[_0x2a47('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2a47('0xb')](function(_0x591cc8){logger[_0x2a47('0x14')](_0x2a47('0x22'),_0x14b082);logger[_0x2a47('0xe')](_0x2a47('0x22'),_0x14b082,JSON['stringify'](_0x591cc8));_0x8012b7(_0x591cc8);})[_0x2a47('0x16')](function(_0x8c1f29){logger[_0x2a47('0x11')]('ShowFreshdeskAccount',_0x8c1f29['message'],_0x14b082);_0x5978a6(_0x2f9b36['error'](0x1f4,_0x8c1f29['message']));});});}; \ No newline at end of file +var _0xcc37=['jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','attributes','limit','include','map','model','debug','ShowFreshdeskAccount','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ce13b,_0x4572a6){var _0x1ed842=function(_0x598703){while(--_0x598703){_0x1ce13b['push'](_0x1ce13b['shift']());}};_0x1ed842(++_0x4572a6);}(_0xcc37,0xa7));var _0x7cc3=function(_0x4b5c4d,_0x1f893b){_0x4b5c4d=_0x4b5c4d-0x0;var _0x4f70bd=_0xcc37[_0x4b5c4d];return _0x4f70bd;};'use strict';var _=require('lodash');var util=require(_0x7cc3('0x0'));var moment=require(_0x7cc3('0x1'));var BPromise=require('bluebird');var rs=require(_0x7cc3('0x2'));var fs=require('fs');var Redis=require(_0x7cc3('0x3'));var db=require(_0x7cc3('0x4'))['db'];var utils=require(_0x7cc3('0x5'));var logger=require(_0x7cc3('0x6'))(_0x7cc3('0x7'));var config=require('../../config/environment');var jayson=require(_0x7cc3('0x8'));var client=jayson[_0x7cc3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x165409,_0x11f216,_0xfe02b){return new BPromise(function(_0x2d6ab0,_0x2361fd){return client[_0x7cc3('0xa')](_0x165409,_0xfe02b)[_0x7cc3('0xb')](function(_0x69ede2){logger[_0x7cc3('0xc')](_0x7cc3('0xd'),_0x11f216,'request\x20sent');logger['debug'](_0x7cc3('0xe'),_0x11f216,_0x7cc3('0xf'),JSON[_0x7cc3('0x10')](_0x69ede2));if(_0x69ede2['error']){if(_0x69ede2['error'][_0x7cc3('0x11')]===0x1f4){logger[_0x7cc3('0x12')](_0x7cc3('0xd'),_0x11f216,_0x69ede2['error'][_0x7cc3('0x13')]);return _0x2361fd(_0x69ede2[_0x7cc3('0x12')][_0x7cc3('0x13')]);}logger[_0x7cc3('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x11f216,_0x69ede2[_0x7cc3('0x12')][_0x7cc3('0x13')]);return _0x2d6ab0(_0x69ede2[_0x7cc3('0x12')][_0x7cc3('0x13')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x11f216,_0x7cc3('0xf'));_0x2d6ab0(_0x69ede2[_0x7cc3('0x14')][_0x7cc3('0x13')]);}})[_0x7cc3('0x15')](function(_0x25726c){logger[_0x7cc3('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x11f216,_0x25726c);_0x2361fd(_0x25726c);});});}exports[_0x7cc3('0x16')]=function(_0xf0bc1f){var _0x4a6285=this;return new Promise(function(_0x34f1ac,_0x17acc4){return db[_0x7cc3('0x17')]['findAll']({'raw':_0xf0bc1f[_0x7cc3('0x18')]?_0xf0bc1f[_0x7cc3('0x18')][_0x7cc3('0x19')]===undefined?!![]:![]:!![],'where':_0xf0bc1f[_0x7cc3('0x18')]?_0xf0bc1f[_0x7cc3('0x18')]['where']||null:null,'attributes':_0xf0bc1f['options']?_0xf0bc1f[_0x7cc3('0x18')][_0x7cc3('0x1a')]||null:null,'limit':_0xf0bc1f[_0x7cc3('0x18')]?_0xf0bc1f['options'][_0x7cc3('0x1b')]||null:null,'include':_0xf0bc1f[_0x7cc3('0x18')]?_0xf0bc1f[_0x7cc3('0x18')][_0x7cc3('0x1c')]?_[_0x7cc3('0x1d')](_0xf0bc1f[_0x7cc3('0x18')]['include'],function(_0x5a4709){return{'model':db[_0x5a4709['model']],'as':_0x5a4709['as'],'attributes':_0x5a4709[_0x7cc3('0x1a')],'include':_0x5a4709[_0x7cc3('0x1c')]?_[_0x7cc3('0x1d')](_0x5a4709[_0x7cc3('0x1c')],function(_0x2eb152){return{'model':db[_0x2eb152[_0x7cc3('0x1e')]],'as':_0x2eb152['as'],'attributes':_0x2eb152[_0x7cc3('0x1a')],'include':_0x2eb152['include']?_['map'](_0x2eb152['include'],function(_0x3627ea){return{'model':db[_0x3627ea[_0x7cc3('0x1e')]],'as':_0x3627ea['as'],'attributes':_0x3627ea[_0x7cc3('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a4455){logger['info'](_0x7cc3('0x16'),_0xf0bc1f);logger[_0x7cc3('0x1f')]('GetFreshdeskAccount',_0xf0bc1f,JSON[_0x7cc3('0x10')](_0x4a4455));_0x34f1ac(_0x4a4455);})[_0x7cc3('0x15')](function(_0x286460){logger[_0x7cc3('0x12')](_0x7cc3('0x16'),_0x286460[_0x7cc3('0x13')],_0xf0bc1f);_0x17acc4(_0x4a6285['error'](0x1f4,_0x286460[_0x7cc3('0x13')]));});});};exports[_0x7cc3('0x20')]=function(_0x592da9){var _0x177105=this;return new Promise(function(_0x260715,_0x216f1d){return db[_0x7cc3('0x17')][_0x7cc3('0x21')]({'raw':_0x592da9[_0x7cc3('0x18')]?_0x592da9[_0x7cc3('0x18')][_0x7cc3('0x19')]===undefined?!![]:![]:!![],'where':_0x592da9[_0x7cc3('0x18')]?_0x592da9['options'][_0x7cc3('0x22')]||null:null,'attributes':_0x592da9[_0x7cc3('0x18')]?_0x592da9['options'][_0x7cc3('0x1a')]||null:null,'include':_0x592da9[_0x7cc3('0x18')]?_0x592da9['options']['include']?_[_0x7cc3('0x1d')](_0x592da9[_0x7cc3('0x18')][_0x7cc3('0x1c')],function(_0x90f365){return{'model':db[_0x90f365[_0x7cc3('0x1e')]],'as':_0x90f365['as'],'attributes':_0x90f365['attributes'],'include':_0x90f365[_0x7cc3('0x1c')]?_[_0x7cc3('0x1d')](_0x90f365['include'],function(_0x572527){return{'model':db[_0x572527['model']],'as':_0x572527['as'],'attributes':_0x572527[_0x7cc3('0x1a')],'include':_0x572527[_0x7cc3('0x1c')]?_[_0x7cc3('0x1d')](_0x572527[_0x7cc3('0x1c')],function(_0xdb9327){return{'model':db[_0xdb9327[_0x7cc3('0x1e')]],'as':_0xdb9327['as'],'attributes':_0xdb9327[_0x7cc3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7cc3('0xb')](function(_0x5f011e){logger[_0x7cc3('0xc')](_0x7cc3('0x20'),_0x592da9);logger['debug'](_0x7cc3('0x20'),_0x592da9,JSON['stringify'](_0x5f011e));_0x260715(_0x5f011e);})[_0x7cc3('0x15')](function(_0x1b52c3){logger[_0x7cc3('0x12')](_0x7cc3('0x20'),_0x1b52c3[_0x7cc3('0x13')],_0x592da9);_0x216f1d(_0x177105['error'](0x1f4,_0x1b52c3[_0x7cc3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ed0c3b1..c2c8f0c 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 _0x12d8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','delete','/:id'];(function(_0x20fc2a,_0x20977f){var _0x2dab75=function(_0x180c32){while(--_0x180c32){_0x20fc2a['push'](_0x20fc2a['shift']());}};_0x2dab75(++_0x20977f);}(_0x12d8,0x10e));var _0x812d=function(_0x1fac65,_0x2d51ac){_0x1fac65=_0x1fac65-0x0;var _0x4e0859=_0x12d8[_0x1fac65];return _0x4e0859;};'use strict';var multer=require(_0x812d('0x0'));var util=require(_0x812d('0x1'));var path=require(_0x812d('0x2'));var timeout=require(_0x812d('0x3'));var express=require(_0x812d('0x4'));var router=express[_0x812d('0x5')]();var fs_extra=require(_0x812d('0x6'));var auth=require(_0x812d('0x7'));var interaction=require(_0x812d('0x8'));var config=require(_0x812d('0x9'));var controller=require(_0x812d('0xa'));router[_0x812d('0xb')]('/',auth[_0x812d('0xc')](),controller[_0x812d('0xd')]);router[_0x812d('0xb')]('/:id',auth[_0x812d('0xc')](),controller[_0x812d('0xe')]);router[_0x812d('0xb')]('/:id/fields',auth[_0x812d('0xc')](),controller[_0x812d('0xf')]);router['get'](_0x812d('0x10'),auth[_0x812d('0xc')](),controller[_0x812d('0x11')]);router[_0x812d('0xb')](_0x812d('0x12'),auth[_0x812d('0xc')](),controller[_0x812d('0x13')]);router[_0x812d('0xb')]('/:id/tags',auth[_0x812d('0xc')](),controller[_0x812d('0x14')]);router[_0x812d('0x15')]('/',auth[_0x812d('0xc')](),controller[_0x812d('0x16')]);router[_0x812d('0x15')](_0x812d('0x17'),auth[_0x812d('0xc')](),controller[_0x812d('0x18')]);router['put']('/:id',auth[_0x812d('0xc')](),controller['update']);router[_0x812d('0x19')](_0x812d('0x1a'),auth[_0x812d('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9993=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x9993,0x194));var _0x3999=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x9993[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x3999('0x0'));var util=require(_0x3999('0x1'));var path=require(_0x3999('0x2'));var timeout=require(_0x3999('0x3'));var express=require(_0x3999('0x4'));var router=express[_0x3999('0x5')]();var fs_extra=require(_0x3999('0x6'));var auth=require(_0x3999('0x7'));var interaction=require(_0x3999('0x8'));var config=require(_0x3999('0x9'));var controller=require(_0x3999('0xa'));router[_0x3999('0xb')]('/',auth[_0x3999('0xc')](),controller['index']);router['get'](_0x3999('0xd'),auth[_0x3999('0xc')](),controller['show']);router[_0x3999('0xb')]('/:id/fields',auth[_0x3999('0xc')](),controller[_0x3999('0xe')]);router[_0x3999('0xb')](_0x3999('0xf'),auth[_0x3999('0xc')](),controller['getSubjects']);router['get'](_0x3999('0x10'),auth[_0x3999('0xc')](),controller[_0x3999('0x11')]);router[_0x3999('0xb')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3999('0x12')]);router[_0x3999('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3999('0x13')](_0x3999('0x14'),auth[_0x3999('0xc')](),controller['setTags']);router[_0x3999('0x15')](_0x3999('0xd'),auth['isAuthenticated'](),controller[_0x3999('0x16')]);router['delete'](_0x3999('0xd'),auth[_0x3999('0xc')](),controller[_0x3999('0x17')]);module[_0x3999('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3bfebcc..a9269c4 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 _0x03e9=['sequelize','exports','STRING'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x03e9,0x1d7));var _0x903e=function(_0x147ec8,_0x164405){_0x147ec8=_0x147ec8-0x0;var _0x22b38f=_0x03e9[_0x147ec8];return _0x22b38f;};'use strict';var Sequelize=require(_0x903e('0x0'));module[_0x903e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x903e('0x2')]}}; \ No newline at end of file +var _0x21ed=['exports','STRING','sequelize'];(function(_0x317429,_0x484a2a){var _0xc81a76=function(_0x43779f){while(--_0x43779f){_0x317429['push'](_0x317429['shift']());}};_0xc81a76(++_0x484a2a);}(_0x21ed,0xa7));var _0xd21e=function(_0x3a7b89,_0x3e3412){_0x3a7b89=_0x3a7b89-0x0;var _0x23329b=_0x21ed[_0x3a7b89];return _0x23329b;};'use strict';var Sequelize=require(_0xd21e('0x0'));module[_0xd21e('0x1')]={'name':{'type':Sequelize[_0xd21e('0x2')]},'description':{'type':Sequelize[_0xd21e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 6c2b00c..a874020 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 _0x56d9=['sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','update','find','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5916bc,_0x4c427e){var _0x125441=function(_0x2c10a8){while(--_0x2c10a8){_0x5916bc['push'](_0x5916bc['shift']());}};_0x125441(++_0x4c427e);}(_0x56d9,0x16a));var _0x956d=function(_0x229cfd,_0x3d7b4c){_0x229cfd=_0x229cfd-0x0;var _0x5621a3=_0x56d9[_0x229cfd];return _0x5621a3;};'use strict';var emlformat=require(_0x956d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x956d('0x1'));var jsonpatch=require(_0x956d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x956d('0x3'));var util=require(_0x956d('0x4'));var path=require('path');var sox=require(_0x956d('0x5'));var csv=require(_0x956d('0x6'));var ejs=require(_0x956d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x956d('0x8'));var crypto=require(_0x956d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x956d('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x956d('0xb'));var Redis=require(_0x956d('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x956d('0xd'));var hardwareService=require(_0x956d('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x956d('0xf'));var config=require(_0x956d('0x10'));var licenseUtil=require(_0x956d('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275e6a,_0x30eece){_0x30eece=_0x30eece||0xcc;return function(_0x5774f5){if(_0x5774f5){return _0x275e6a[_0x956d('0x12')](_0x30eece);}return _0x275e6a[_0x956d('0x13')](_0x30eece)['end']();};}function respondWithResult(_0x30677d,_0x2e7cb9){_0x2e7cb9=_0x2e7cb9||0xc8;return function(_0xdeb4e7){if(_0xdeb4e7){return _0x30677d['status'](_0x2e7cb9)[_0x956d('0x14')](_0xdeb4e7);}};}function respondWithFilteredResult(_0x54593f,_0x5c0bab){return function(_0x48fc34){if(_0x48fc34){var _0x500171=typeof _0x5c0bab[_0x956d('0x15')]==='undefined'&&typeof _0x5c0bab[_0x956d('0x16')]===_0x956d('0x17');var _0x321a61=_0x48fc34[_0x956d('0x18')];var _0x5c92ca=_0x500171?0x0:_0x5c0bab[_0x956d('0x15')];var _0x23506d=_0x500171?_0x48fc34[_0x956d('0x18')]:_0x5c0bab[_0x956d('0x15')]+_0x5c0bab[_0x956d('0x16')];var _0x3aaac7;if(_0x23506d>=_0x321a61){_0x23506d=_0x321a61;_0x3aaac7=0xc8;}else{_0x3aaac7=0xce;}_0x54593f[_0x956d('0x13')](_0x3aaac7);return _0x54593f['set'](_0x956d('0x19'),_0x5c92ca+'-'+_0x23506d+'/'+_0x321a61)[_0x956d('0x14')](_0x48fc34);}return null;};}function patchUpdates(_0x2ff156){return function(_0x1c2b50){try{jsonpatch[_0x956d('0x1a')](_0x1c2b50,_0x2ff156,!![]);}catch(_0x16a540){return BPromise[_0x956d('0x1b')](_0x16a540);}return _0x1c2b50[_0x956d('0x1c')]();};}function saveUpdates(_0x4d46f3,_0xdcf58b){return function(_0x5bacff){if(_0x5bacff){return _0x5bacff['update'](_0x4d46f3)[_0x956d('0x1d')](function(_0x3d7634){return _0x3d7634;});}return null;};}function removeEntity(_0x506efb,_0x505a95){return function(_0x426f0f){if(_0x426f0f){return _0x426f0f[_0x956d('0x1e')]()[_0x956d('0x1d')](function(){_0x506efb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd19d7,_0x3ccc2e){return function(_0x1ea0cb){if(!_0x1ea0cb){_0xcd19d7[_0x956d('0x12')](0x194);}return _0x1ea0cb;};}function handleError(_0x4560af,_0x41d07a){_0x41d07a=_0x41d07a||0x1f4;return function(_0x55b7fd){logger['error'](_0x55b7fd[_0x956d('0x1f')]);if(_0x55b7fd[_0x956d('0x20')]){delete _0x55b7fd['name'];}_0x4560af[_0x956d('0x13')](_0x41d07a)[_0x956d('0x21')](_0x55b7fd);};}exports[_0x956d('0x22')]=function(_0x12a375,_0x40da24){var _0x130fc4={},_0x4d166a={},_0x68ea4a={'count':0x0,'rows':[]};var _0x1c4de4=_[_0x956d('0x23')](db[_0x956d('0x24')]['rawAttributes'],function(_0x20fb38){return{'name':_0x20fb38['fieldName'],'type':_0x20fb38['type'][_0x956d('0x25')]};});_0x4d166a['model']=_['map'](_0x1c4de4,_0x956d('0x20'));_0x4d166a[_0x956d('0x26')]=_[_0x956d('0x27')](_0x12a375[_0x956d('0x26')]);_0x4d166a[_0x956d('0x28')]=_[_0x956d('0x29')](_0x4d166a[_0x956d('0x2a')],_0x4d166a[_0x956d('0x26')]);_0x130fc4[_0x956d('0x2b')]=_[_0x956d('0x29')](_0x4d166a[_0x956d('0x2a')],qs[_0x956d('0x2c')](_0x12a375['query']['fields']));_0x130fc4['attributes']=_0x130fc4[_0x956d('0x2b')]['length']?_0x130fc4[_0x956d('0x2b')]:_0x4d166a['model'];if(!_0x12a375['query'][_0x956d('0x2d')]('nolimit')){_0x130fc4[_0x956d('0x16')]=qs['limit'](_0x12a375[_0x956d('0x26')]['limit']);_0x130fc4[_0x956d('0x15')]=qs[_0x956d('0x15')](_0x12a375[_0x956d('0x26')]['offset']);}_0x130fc4[_0x956d('0x2e')]=qs[_0x956d('0x2f')](_0x12a375[_0x956d('0x26')][_0x956d('0x2f')]);_0x130fc4[_0x956d('0x30')]=qs[_0x956d('0x28')](_[_0x956d('0x31')](_0x12a375['query'],_0x4d166a[_0x956d('0x28')]),_0x1c4de4);if(_0x12a375['query']['filter']){_0x130fc4['where']=_[_0x956d('0x32')](_0x130fc4['where'],{'$or':_[_0x956d('0x23')](_0x1c4de4,function(_0x54484e){if(_0x54484e[_0x956d('0x33')]!=='VIRTUAL'){var _0x54fcd7={};_0x54fcd7[_0x54484e[_0x956d('0x20')]]={'$like':'%'+_0x12a375[_0x956d('0x26')][_0x956d('0x34')]+'%'};return _0x54fcd7;}})});}_0x130fc4=_[_0x956d('0x32')]({},_0x130fc4,_0x12a375[_0x956d('0x35')]);var _0x38821b={'where':_0x130fc4[_0x956d('0x30')]};return db[_0x956d('0x24')][_0x956d('0x18')](_0x38821b)['then'](function(_0x313a00){_0x68ea4a[_0x956d('0x18')]=_0x313a00;if(_0x12a375[_0x956d('0x26')]['includeAll']){_0x130fc4[_0x956d('0x36')]=[{'all':!![]}];}return db[_0x956d('0x24')][_0x956d('0x37')](_0x130fc4);})[_0x956d('0x1d')](function(_0x47deec){_0x68ea4a[_0x956d('0x38')]=_0x47deec;return _0x68ea4a;})[_0x956d('0x1d')](respondWithFilteredResult(_0x40da24,_0x130fc4))[_0x956d('0x39')](handleError(_0x40da24,null));};exports[_0x956d('0x3a')]=function(_0x1d7913,_0x2fa855){var _0x3225c4={'raw':![],'where':{'id':_0x1d7913[_0x956d('0x3b')]['id']}},_0x418ac4={};_0x418ac4[_0x956d('0x2a')]=_[_0x956d('0x27')](db[_0x956d('0x24')][_0x956d('0x3c')]);_0x418ac4[_0x956d('0x26')]=_[_0x956d('0x27')](_0x1d7913[_0x956d('0x26')]);_0x418ac4[_0x956d('0x28')]=_['intersection'](_0x418ac4['model'],_0x418ac4[_0x956d('0x26')]);_0x3225c4[_0x956d('0x2b')]=_[_0x956d('0x29')](_0x418ac4['model'],qs[_0x956d('0x2c')](_0x1d7913[_0x956d('0x26')][_0x956d('0x2c')]));_0x3225c4[_0x956d('0x2b')]=_0x3225c4[_0x956d('0x2b')][_0x956d('0x3d')]?_0x3225c4[_0x956d('0x2b')]:_0x418ac4[_0x956d('0x2a')];if(_0x1d7913['query']['includeAll']){_0x3225c4[_0x956d('0x36')]=[{'all':!![]}];}_0x3225c4=_[_0x956d('0x32')]({},_0x3225c4,_0x1d7913[_0x956d('0x35')]);return db[_0x956d('0x24')]['find'](_0x3225c4)['then'](handleEntityNotFound(_0x2fa855,null))[_0x956d('0x1d')](respondWithResult(_0x2fa855,null))['catch'](handleError(_0x2fa855,null));};exports['create']=function(_0x502238,_0x14b810){return db['FreshdeskConfiguration'][_0x956d('0x3e')](_0x502238[_0x956d('0x3f')],{})[_0x956d('0x1d')](respondWithResult(_0x14b810,0xc9))[_0x956d('0x39')](handleError(_0x14b810,null));};exports[_0x956d('0x40')]=function(_0x442db8,_0x143eea){if(_0x442db8['body']['id']){delete _0x442db8[_0x956d('0x3f')]['id'];}return db[_0x956d('0x24')][_0x956d('0x41')]({'where':{'id':_0x442db8[_0x956d('0x3b')]['id']}})[_0x956d('0x1d')](handleEntityNotFound(_0x143eea,null))[_0x956d('0x1d')](saveUpdates(_0x442db8[_0x956d('0x3f')],null))[_0x956d('0x1d')](respondWithResult(_0x143eea,null))[_0x956d('0x39')](handleError(_0x143eea,null));};exports[_0x956d('0x1e')]=function(_0x127cc1,_0x537d1e){return db[_0x956d('0x24')][_0x956d('0x41')]({'where':{'id':_0x127cc1[_0x956d('0x3b')]['id']}})['then'](handleEntityNotFound(_0x537d1e,null))[_0x956d('0x1d')](removeEntity(_0x537d1e,null))[_0x956d('0x39')](handleError(_0x537d1e,null));};exports[_0x956d('0x42')]=function(_0x2f68ef,_0x336104,_0x4ba122){var _0xae6138={};var _0x206b02={};var _0x53ecd6;var _0x5eea37;return db['FreshdeskConfiguration'][_0x956d('0x43')]({'where':{'id':_0x2f68ef['params']['id']}})[_0x956d('0x1d')](handleEntityNotFound(_0x336104,null))[_0x956d('0x1d')](function(_0x5950bd){if(_0x5950bd){_0x53ecd6=_0x5950bd;_0x206b02[_0x956d('0x2a')]=_[_0x956d('0x27')](db[_0x956d('0x44')][_0x956d('0x3c')]);_0x206b02[_0x956d('0x26')]=_[_0x956d('0x27')](_0x2f68ef[_0x956d('0x26')]);_0x206b02[_0x956d('0x28')]=_[_0x956d('0x29')](_0x206b02['model'],_0x206b02['query']);_0xae6138[_0x956d('0x2b')]=_[_0x956d('0x29')](_0x206b02[_0x956d('0x2a')],qs['fields'](_0x2f68ef[_0x956d('0x26')][_0x956d('0x2c')]));_0xae6138[_0x956d('0x2b')]=_0xae6138[_0x956d('0x2b')][_0x956d('0x3d')]?_0xae6138[_0x956d('0x2b')]:_0x206b02[_0x956d('0x2a')];_0xae6138[_0x956d('0x2e')]=qs[_0x956d('0x2f')](_0x2f68ef[_0x956d('0x26')][_0x956d('0x2f')]);_0xae6138[_0x956d('0x30')]=qs['filters'](_[_0x956d('0x31')](_0x2f68ef[_0x956d('0x26')],_0x206b02[_0x956d('0x28')]));if(_0x2f68ef[_0x956d('0x26')][_0x956d('0x34')]){_0xae6138[_0x956d('0x30')]=_[_0x956d('0x32')](_0xae6138['where'],{'$or':_[_0x956d('0x23')](_0xae6138[_0x956d('0x2b')],function(_0x1a9229){var _0x32360e={};_0x32360e[_0x1a9229]={'$like':'%'+_0x2f68ef[_0x956d('0x26')][_0x956d('0x34')]+'%'};return _0x32360e;})});}_0xae6138=_[_0x956d('0x32')]({},_0xae6138,_0x2f68ef['options']);return _0x53ecd6[_0x956d('0x42')](_0xae6138);}})[_0x956d('0x1d')](function(_0x4880d3){if(_0x4880d3){_0x5eea37=_0x4880d3[_0x956d('0x3d')];if(!_0x2f68ef['query'][_0x956d('0x2d')](_0x956d('0x45'))){_0xae6138[_0x956d('0x16')]=qs[_0x956d('0x16')](_0x2f68ef[_0x956d('0x26')][_0x956d('0x16')]);_0xae6138[_0x956d('0x15')]=qs['offset'](_0x2f68ef[_0x956d('0x26')][_0x956d('0x15')]);}return _0x53ecd6[_0x956d('0x42')](_0xae6138);}})['then'](function(_0x2fe99d){if(_0x2fe99d){return _0x2fe99d?{'count':_0x5eea37,'rows':_0x2fe99d}:null;}})[_0x956d('0x1d')](respondWithResult(_0x336104,null))[_0x956d('0x39')](handleError(_0x336104,null));};exports[_0x956d('0x46')]=function(_0x331de4,_0x38d031,_0x2713ea){var _0x8d9235={};var _0x34f6fc={};var _0x5c54d6;var _0x58d3c4;return db['FreshdeskConfiguration'][_0x956d('0x43')]({'where':{'id':_0x331de4[_0x956d('0x3b')]['id']}})['then'](handleEntityNotFound(_0x38d031,null))['then'](function(_0x2d3400){if(_0x2d3400){_0x5c54d6=_0x2d3400;_0x34f6fc[_0x956d('0x2a')]=_[_0x956d('0x27')](db[_0x956d('0x44')][_0x956d('0x3c')]);_0x34f6fc['query']=_['keys'](_0x331de4['query']);_0x34f6fc[_0x956d('0x28')]=_[_0x956d('0x29')](_0x34f6fc[_0x956d('0x2a')],_0x34f6fc[_0x956d('0x26')]);_0x8d9235[_0x956d('0x2b')]=_[_0x956d('0x29')](_0x34f6fc[_0x956d('0x2a')],qs[_0x956d('0x2c')](_0x331de4['query']['fields']));_0x8d9235[_0x956d('0x2b')]=_0x8d9235['attributes'][_0x956d('0x3d')]?_0x8d9235[_0x956d('0x2b')]:_0x34f6fc[_0x956d('0x2a')];_0x8d9235[_0x956d('0x2e')]=qs[_0x956d('0x2f')](_0x331de4[_0x956d('0x26')]['sort']);_0x8d9235[_0x956d('0x30')]=qs[_0x956d('0x28')](_[_0x956d('0x31')](_0x331de4['query'],_0x34f6fc[_0x956d('0x28')]));if(_0x331de4[_0x956d('0x26')][_0x956d('0x34')]){_0x8d9235[_0x956d('0x30')]=_[_0x956d('0x32')](_0x8d9235[_0x956d('0x30')],{'$or':_['map'](_0x8d9235[_0x956d('0x2b')],function(_0x54721d){var _0x595aeb={};_0x595aeb[_0x54721d]={'$like':'%'+_0x331de4['query'][_0x956d('0x34')]+'%'};return _0x595aeb;})});}_0x8d9235=_[_0x956d('0x32')]({},_0x8d9235,_0x331de4[_0x956d('0x35')]);return _0x5c54d6[_0x956d('0x46')](_0x8d9235);}})[_0x956d('0x1d')](function(_0x5dfdda){if(_0x5dfdda){_0x58d3c4=_0x5dfdda[_0x956d('0x3d')];if(!_0x331de4[_0x956d('0x26')][_0x956d('0x2d')](_0x956d('0x45'))){_0x8d9235[_0x956d('0x16')]=qs['limit'](_0x331de4['query'][_0x956d('0x16')]);_0x8d9235[_0x956d('0x15')]=qs[_0x956d('0x15')](_0x331de4[_0x956d('0x26')]['offset']);}return _0x5c54d6[_0x956d('0x46')](_0x8d9235);}})['then'](function(_0x4b6f71){if(_0x4b6f71){return _0x4b6f71?{'count':_0x58d3c4,'rows':_0x4b6f71}:null;}})[_0x956d('0x1d')](respondWithResult(_0x38d031,null))[_0x956d('0x39')](handleError(_0x38d031,null));};exports[_0x956d('0x47')]=function(_0x3eb112,_0x3d3163,_0x41d5d5){var _0x5bb674={};var _0x2dcae0={};var _0xb68e6b;var _0x20a627;return db['FreshdeskConfiguration'][_0x956d('0x43')]({'where':{'id':_0x3eb112[_0x956d('0x3b')]['id']}})[_0x956d('0x1d')](handleEntityNotFound(_0x3d3163,null))[_0x956d('0x1d')](function(_0x4a0d4c){if(_0x4a0d4c){_0xb68e6b=_0x4a0d4c;_0x2dcae0[_0x956d('0x2a')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x2dcae0[_0x956d('0x26')]=_[_0x956d('0x27')](_0x3eb112['query']);_0x2dcae0['filters']=_[_0x956d('0x29')](_0x2dcae0[_0x956d('0x2a')],_0x2dcae0[_0x956d('0x26')]);_0x5bb674[_0x956d('0x2b')]=_[_0x956d('0x29')](_0x2dcae0[_0x956d('0x2a')],qs['fields'](_0x3eb112['query']['fields']));_0x5bb674[_0x956d('0x2b')]=_0x5bb674[_0x956d('0x2b')][_0x956d('0x3d')]?_0x5bb674[_0x956d('0x2b')]:_0x2dcae0[_0x956d('0x2a')];_0x5bb674[_0x956d('0x2e')]=qs[_0x956d('0x2f')](_0x3eb112[_0x956d('0x26')]['sort']);_0x5bb674['where']=qs[_0x956d('0x28')](_['pick'](_0x3eb112[_0x956d('0x26')],_0x2dcae0[_0x956d('0x28')]));if(_0x3eb112[_0x956d('0x26')][_0x956d('0x34')]){_0x5bb674[_0x956d('0x30')]=_[_0x956d('0x32')](_0x5bb674['where'],{'$or':_[_0x956d('0x23')](_0x5bb674[_0x956d('0x2b')],function(_0x256f51){var _0xc8e30={};_0xc8e30[_0x256f51]={'$like':'%'+_0x3eb112[_0x956d('0x26')][_0x956d('0x34')]+'%'};return _0xc8e30;})});}_0x5bb674=_[_0x956d('0x32')]({},_0x5bb674,_0x3eb112['options']);return _0xb68e6b[_0x956d('0x47')](_0x5bb674);}})[_0x956d('0x1d')](function(_0x587d94){if(_0x587d94){_0x20a627=_0x587d94[_0x956d('0x3d')];if(!_0x3eb112[_0x956d('0x26')][_0x956d('0x2d')](_0x956d('0x45'))){_0x5bb674[_0x956d('0x16')]=qs[_0x956d('0x16')](_0x3eb112[_0x956d('0x26')][_0x956d('0x16')]);_0x5bb674[_0x956d('0x15')]=qs['offset'](_0x3eb112[_0x956d('0x26')][_0x956d('0x15')]);}return _0xb68e6b[_0x956d('0x47')](_0x5bb674);}})[_0x956d('0x1d')](function(_0x427494){if(_0x427494){return _0x427494?{'count':_0x20a627,'rows':_0x427494}:null;}})[_0x956d('0x1d')](respondWithResult(_0x3d3163,null))[_0x956d('0x39')](handleError(_0x3d3163,null));};exports[_0x956d('0x48')]=function(_0x50c618,_0x44aa45,_0x5521c1){var _0x3c4b9c={};var _0x3adf32={};var _0x39f9b6;var _0x2f651d;return db[_0x956d('0x24')][_0x956d('0x43')]({'where':{'id':_0x50c618['params']['id']}})[_0x956d('0x1d')](handleEntityNotFound(_0x44aa45,null))['then'](function(_0xc63ca1){if(_0xc63ca1){_0x39f9b6=_0xc63ca1;_0x3adf32[_0x956d('0x2a')]=_[_0x956d('0x27')](db[_0x956d('0x49')][_0x956d('0x3c')]);_0x3adf32[_0x956d('0x26')]=_[_0x956d('0x27')](_0x50c618[_0x956d('0x26')]);_0x3adf32[_0x956d('0x28')]=_[_0x956d('0x29')](_0x3adf32['model'],_0x3adf32[_0x956d('0x26')]);_0x3c4b9c[_0x956d('0x2b')]=_[_0x956d('0x29')](_0x3adf32[_0x956d('0x2a')],qs[_0x956d('0x2c')](_0x50c618[_0x956d('0x26')][_0x956d('0x2c')]));_0x3c4b9c[_0x956d('0x2b')]=_0x3c4b9c[_0x956d('0x2b')]['length']?_0x3c4b9c[_0x956d('0x2b')]:_0x3adf32[_0x956d('0x2a')];_0x3c4b9c['order']=qs[_0x956d('0x2f')](_0x50c618[_0x956d('0x26')][_0x956d('0x2f')]);_0x3c4b9c['where']=qs['filters'](_[_0x956d('0x31')](_0x50c618[_0x956d('0x26')],_0x3adf32[_0x956d('0x28')]));if(_0x50c618['query']['filter']){_0x3c4b9c[_0x956d('0x30')]=_[_0x956d('0x32')](_0x3c4b9c['where'],{'$or':_[_0x956d('0x23')](_0x3c4b9c[_0x956d('0x2b')],function(_0x4532c2){var _0x5d1aaa={};_0x5d1aaa[_0x4532c2]={'$like':'%'+_0x50c618[_0x956d('0x26')]['filter']+'%'};return _0x5d1aaa;})});}_0x3c4b9c=_[_0x956d('0x32')]({},_0x3c4b9c,_0x50c618[_0x956d('0x35')]);return _0x39f9b6[_0x956d('0x48')](_0x3c4b9c);}})[_0x956d('0x1d')](function(_0x2cb143){if(_0x2cb143){_0x2f651d=_0x2cb143[_0x956d('0x3d')];if(!_0x50c618['query'][_0x956d('0x2d')](_0x956d('0x45'))){_0x3c4b9c[_0x956d('0x16')]=qs[_0x956d('0x16')](_0x50c618['query']['limit']);_0x3c4b9c[_0x956d('0x15')]=qs[_0x956d('0x15')](_0x50c618[_0x956d('0x26')][_0x956d('0x15')]);}return _0x39f9b6[_0x956d('0x48')](_0x3c4b9c);}})[_0x956d('0x1d')](function(_0x4c49a8){if(_0x4c49a8){return _0x4c49a8?{'count':_0x2f651d,'rows':_0x4c49a8}:null;}})[_0x956d('0x1d')](respondWithResult(_0x44aa45,null))[_0x956d('0x39')](handleError(_0x44aa45,null));};exports[_0x956d('0x4a')]=function(_0x1add3c,_0x5dd4ad,_0x414973){if(_0x1add3c[_0x956d('0x3f')]['id']){delete _0x1add3c[_0x956d('0x3f')]['id'];}return db['FreshdeskConfiguration'][_0x956d('0x43')]({'where':{'id':_0x1add3c[_0x956d('0x3b')]['id']}})[_0x956d('0x1d')](handleEntityNotFound(_0x5dd4ad,null))[_0x956d('0x1d')](function(_0x356e12){if(_0x356e12){return _0x356e12[_0x956d('0x4a')](_0x1add3c['body'][_0x956d('0x4b')]||[]);}return null;})['then'](respondWithResult(_0x5dd4ad,null))[_0x956d('0x39')](handleError(_0x5dd4ad,null));}; \ No newline at end of file +var _0x59a2=['status','end','json','offset','limit','undefined','count','Content-Range','save','update','then','error','stack','name','index','FreshdeskConfiguration','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1d3909,_0x1c40cc){var _0x4797fd=function(_0x46b4e2){while(--_0x46b4e2){_0x1d3909['push'](_0x1d3909['shift']());}};_0x4797fd(++_0x1c40cc);}(_0x59a2,0x1cd));var _0x259a=function(_0x514710,_0x3da234){_0x514710=_0x514710-0x0;var _0x5080b6=_0x59a2[_0x514710];return _0x5080b6;};'use strict';var emlformat=require(_0x259a('0x0'));var rimraf=require(_0x259a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x259a('0x2'));var rp=require(_0x259a('0x3'));var moment=require(_0x259a('0x4'));var BPromise=require(_0x259a('0x5'));var Mustache=require(_0x259a('0x6'));var util=require(_0x259a('0x7'));var path=require('path');var sox=require(_0x259a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x259a('0x9'));var _=require('lodash');var squel=require(_0x259a('0xa'));var crypto=require(_0x259a('0xb'));var jsforce=require(_0x259a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x259a('0xd'));var querystring=require(_0x259a('0xe'));var Papa=require(_0x259a('0xf'));var Redis=require(_0x259a('0x10'));var authService=require(_0x259a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x259a('0x12'));var hardwareService=require(_0x259a('0x13'));var logger=require(_0x259a('0x14'))('api');var utils=require(_0x259a('0x15'));var config=require(_0x259a('0x16'));var licenseUtil=require(_0x259a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ffcc,_0x3ecf55){_0x3ecf55=_0x3ecf55||0xcc;return function(_0x50b658){if(_0x50b658){return _0x42ffcc[_0x259a('0x18')](_0x3ecf55);}return _0x42ffcc[_0x259a('0x19')](_0x3ecf55)[_0x259a('0x1a')]();};}function respondWithResult(_0x4cc188,_0x429138){_0x429138=_0x429138||0xc8;return function(_0x225f42){if(_0x225f42){return _0x4cc188[_0x259a('0x19')](_0x429138)[_0x259a('0x1b')](_0x225f42);}};}function respondWithFilteredResult(_0x33c534,_0x174fc4){return function(_0x27335b){if(_0x27335b){var _0x272d2c=typeof _0x174fc4[_0x259a('0x1c')]==='undefined'&&typeof _0x174fc4[_0x259a('0x1d')]===_0x259a('0x1e');var _0x54cf00=_0x27335b[_0x259a('0x1f')];var _0x4e9c74=_0x272d2c?0x0:_0x174fc4[_0x259a('0x1c')];var _0x167b13=_0x272d2c?_0x27335b[_0x259a('0x1f')]:_0x174fc4[_0x259a('0x1c')]+_0x174fc4['limit'];var _0xcfa436;if(_0x167b13>=_0x54cf00){_0x167b13=_0x54cf00;_0xcfa436=0xc8;}else{_0xcfa436=0xce;}_0x33c534['status'](_0xcfa436);return _0x33c534['set'](_0x259a('0x20'),_0x4e9c74+'-'+_0x167b13+'/'+_0x54cf00)[_0x259a('0x1b')](_0x27335b);}return null;};}function patchUpdates(_0x123d9f){return function(_0x2ed100){try{jsonpatch['apply'](_0x2ed100,_0x123d9f,!![]);}catch(_0x591e29){return BPromise['reject'](_0x591e29);}return _0x2ed100[_0x259a('0x21')]();};}function saveUpdates(_0x5488ba,_0x524da0){return function(_0x2779a7){if(_0x2779a7){return _0x2779a7[_0x259a('0x22')](_0x5488ba)['then'](function(_0x4caef2){return _0x4caef2;});}return null;};}function removeEntity(_0x5a4915,_0x23a7fb){return function(_0x231355){if(_0x231355){return _0x231355['destroy']()[_0x259a('0x23')](function(){_0x5a4915['status'](0xcc)[_0x259a('0x1a')]();});}};}function handleEntityNotFound(_0x1d2d24,_0xd08170){return function(_0xe70c65){if(!_0xe70c65){_0x1d2d24['sendStatus'](0x194);}return _0xe70c65;};}function handleError(_0x501e22,_0x4a67b0){_0x4a67b0=_0x4a67b0||0x1f4;return function(_0x57a2f1){logger[_0x259a('0x24')](_0x57a2f1[_0x259a('0x25')]);if(_0x57a2f1['name']){delete _0x57a2f1[_0x259a('0x26')];}_0x501e22[_0x259a('0x19')](_0x4a67b0)['send'](_0x57a2f1);};}exports[_0x259a('0x27')]=function(_0x158a8d,_0x4bfacd){var _0x47e562={},_0x2c7537={},_0x2160c4={'count':0x0,'rows':[]};var _0x406b5b=_['map'](db[_0x259a('0x28')]['rawAttributes'],function(_0x4db1b0){return{'name':_0x4db1b0[_0x259a('0x29')],'type':_0x4db1b0[_0x259a('0x2a')][_0x259a('0x2b')]};});_0x2c7537[_0x259a('0x2c')]=_[_0x259a('0x2d')](_0x406b5b,'name');_0x2c7537[_0x259a('0x2e')]=_[_0x259a('0x2f')](_0x158a8d['query']);_0x2c7537[_0x259a('0x30')]=_['intersection'](_0x2c7537[_0x259a('0x2c')],_0x2c7537[_0x259a('0x2e')]);_0x47e562[_0x259a('0x31')]=_[_0x259a('0x32')](_0x2c7537[_0x259a('0x2c')],qs[_0x259a('0x33')](_0x158a8d[_0x259a('0x2e')][_0x259a('0x33')]));_0x47e562['attributes']=_0x47e562[_0x259a('0x31')][_0x259a('0x34')]?_0x47e562['attributes']:_0x2c7537[_0x259a('0x2c')];if(!_0x158a8d[_0x259a('0x2e')][_0x259a('0x35')](_0x259a('0x36'))){_0x47e562[_0x259a('0x1d')]=qs[_0x259a('0x1d')](_0x158a8d[_0x259a('0x2e')][_0x259a('0x1d')]);_0x47e562[_0x259a('0x1c')]=qs['offset'](_0x158a8d[_0x259a('0x2e')]['offset']);}_0x47e562[_0x259a('0x37')]=qs['sort'](_0x158a8d[_0x259a('0x2e')][_0x259a('0x38')]);_0x47e562[_0x259a('0x39')]=qs[_0x259a('0x30')](_[_0x259a('0x3a')](_0x158a8d['query'],_0x2c7537[_0x259a('0x30')]),_0x406b5b);if(_0x158a8d[_0x259a('0x2e')][_0x259a('0x3b')]){_0x47e562[_0x259a('0x39')]=_[_0x259a('0x3c')](_0x47e562[_0x259a('0x39')],{'$or':_[_0x259a('0x2d')](_0x406b5b,function(_0x5464da){if(_0x5464da[_0x259a('0x2a')]!=='VIRTUAL'){var _0x5210fb={};_0x5210fb[_0x5464da[_0x259a('0x26')]]={'$like':'%'+_0x158a8d[_0x259a('0x2e')][_0x259a('0x3b')]+'%'};return _0x5210fb;}})});}_0x47e562=_[_0x259a('0x3c')]({},_0x47e562,_0x158a8d[_0x259a('0x3d')]);var _0x1561a2={'where':_0x47e562[_0x259a('0x39')]};return db[_0x259a('0x28')]['count'](_0x1561a2)[_0x259a('0x23')](function(_0x265e02){_0x2160c4[_0x259a('0x1f')]=_0x265e02;if(_0x158a8d[_0x259a('0x2e')]['includeAll']){_0x47e562['include']=[{'all':!![]}];}return db[_0x259a('0x28')]['findAll'](_0x47e562);})['then'](function(_0x46889f){_0x2160c4[_0x259a('0x3e')]=_0x46889f;return _0x2160c4;})[_0x259a('0x23')](respondWithFilteredResult(_0x4bfacd,_0x47e562))[_0x259a('0x3f')](handleError(_0x4bfacd,null));};exports[_0x259a('0x40')]=function(_0x2206dd,_0x5d94df){var _0x1ccbf1={'raw':![],'where':{'id':_0x2206dd[_0x259a('0x41')]['id']}},_0x4641b4={};_0x4641b4[_0x259a('0x2c')]=_[_0x259a('0x2f')](db['FreshdeskConfiguration'][_0x259a('0x42')]);_0x4641b4[_0x259a('0x2e')]=_[_0x259a('0x2f')](_0x2206dd[_0x259a('0x2e')]);_0x4641b4[_0x259a('0x30')]=_[_0x259a('0x32')](_0x4641b4[_0x259a('0x2c')],_0x4641b4[_0x259a('0x2e')]);_0x1ccbf1[_0x259a('0x31')]=_[_0x259a('0x32')](_0x4641b4['model'],qs[_0x259a('0x33')](_0x2206dd[_0x259a('0x2e')][_0x259a('0x33')]));_0x1ccbf1[_0x259a('0x31')]=_0x1ccbf1[_0x259a('0x31')]['length']?_0x1ccbf1[_0x259a('0x31')]:_0x4641b4[_0x259a('0x2c')];if(_0x2206dd[_0x259a('0x2e')]['includeAll']){_0x1ccbf1[_0x259a('0x43')]=[{'all':!![]}];}_0x1ccbf1=_[_0x259a('0x3c')]({},_0x1ccbf1,_0x2206dd['options']);return db[_0x259a('0x28')][_0x259a('0x44')](_0x1ccbf1)[_0x259a('0x23')](handleEntityNotFound(_0x5d94df,null))['then'](respondWithResult(_0x5d94df,null))['catch'](handleError(_0x5d94df,null));};exports['create']=function(_0x1160cd,_0x2e9b84){return db[_0x259a('0x28')][_0x259a('0x45')](_0x1160cd['body'],{})['then'](respondWithResult(_0x2e9b84,0xc9))[_0x259a('0x3f')](handleError(_0x2e9b84,null));};exports[_0x259a('0x22')]=function(_0x1e3a1d,_0x7c4038){if(_0x1e3a1d[_0x259a('0x46')]['id']){delete _0x1e3a1d['body']['id'];}return db['FreshdeskConfiguration'][_0x259a('0x44')]({'where':{'id':_0x1e3a1d[_0x259a('0x41')]['id']}})[_0x259a('0x23')](handleEntityNotFound(_0x7c4038,null))[_0x259a('0x23')](saveUpdates(_0x1e3a1d['body'],null))['then'](respondWithResult(_0x7c4038,null))[_0x259a('0x3f')](handleError(_0x7c4038,null));};exports[_0x259a('0x47')]=function(_0x46aaec,_0x5548db){return db[_0x259a('0x28')][_0x259a('0x44')]({'where':{'id':_0x46aaec[_0x259a('0x41')]['id']}})[_0x259a('0x23')](handleEntityNotFound(_0x5548db,null))['then'](removeEntity(_0x5548db,null))[_0x259a('0x3f')](handleError(_0x5548db,null));};exports[_0x259a('0x48')]=function(_0x55323a,_0x39a75b,_0x95c380){var _0x30834c={};var _0x1ba36b={};var _0x122265;var _0x42a9e9;return db['FreshdeskConfiguration'][_0x259a('0x49')]({'where':{'id':_0x55323a['params']['id']}})[_0x259a('0x23')](handleEntityNotFound(_0x39a75b,null))[_0x259a('0x23')](function(_0x309c85){if(_0x309c85){_0x122265=_0x309c85;_0x1ba36b['model']=_[_0x259a('0x2f')](db[_0x259a('0x4a')][_0x259a('0x42')]);_0x1ba36b[_0x259a('0x2e')]=_[_0x259a('0x2f')](_0x55323a[_0x259a('0x2e')]);_0x1ba36b[_0x259a('0x30')]=_[_0x259a('0x32')](_0x1ba36b[_0x259a('0x2c')],_0x1ba36b[_0x259a('0x2e')]);_0x30834c[_0x259a('0x31')]=_[_0x259a('0x32')](_0x1ba36b[_0x259a('0x2c')],qs['fields'](_0x55323a[_0x259a('0x2e')]['fields']));_0x30834c[_0x259a('0x31')]=_0x30834c[_0x259a('0x31')][_0x259a('0x34')]?_0x30834c[_0x259a('0x31')]:_0x1ba36b[_0x259a('0x2c')];_0x30834c[_0x259a('0x37')]=qs[_0x259a('0x38')](_0x55323a[_0x259a('0x2e')][_0x259a('0x38')]);_0x30834c[_0x259a('0x39')]=qs[_0x259a('0x30')](_[_0x259a('0x3a')](_0x55323a['query'],_0x1ba36b[_0x259a('0x30')]));if(_0x55323a[_0x259a('0x2e')][_0x259a('0x3b')]){_0x30834c[_0x259a('0x39')]=_[_0x259a('0x3c')](_0x30834c['where'],{'$or':_[_0x259a('0x2d')](_0x30834c[_0x259a('0x31')],function(_0xcd11d0){var _0x44f671={};_0x44f671[_0xcd11d0]={'$like':'%'+_0x55323a[_0x259a('0x2e')]['filter']+'%'};return _0x44f671;})});}_0x30834c=_[_0x259a('0x3c')]({},_0x30834c,_0x55323a[_0x259a('0x3d')]);return _0x122265[_0x259a('0x48')](_0x30834c);}})[_0x259a('0x23')](function(_0x773adf){if(_0x773adf){_0x42a9e9=_0x773adf[_0x259a('0x34')];if(!_0x55323a[_0x259a('0x2e')][_0x259a('0x35')](_0x259a('0x36'))){_0x30834c[_0x259a('0x1d')]=qs[_0x259a('0x1d')](_0x55323a[_0x259a('0x2e')]['limit']);_0x30834c['offset']=qs['offset'](_0x55323a['query']['offset']);}return _0x122265[_0x259a('0x48')](_0x30834c);}})['then'](function(_0x3aa0c4){if(_0x3aa0c4){return _0x3aa0c4?{'count':_0x42a9e9,'rows':_0x3aa0c4}:null;}})['then'](respondWithResult(_0x39a75b,null))[_0x259a('0x3f')](handleError(_0x39a75b,null));};exports[_0x259a('0x4b')]=function(_0x1723f7,_0x6ac78a,_0x557f1d){var _0x3596d6={};var _0x22e6a5={};var _0x4bd945;var _0x69684c;return db[_0x259a('0x28')][_0x259a('0x49')]({'where':{'id':_0x1723f7[_0x259a('0x41')]['id']}})[_0x259a('0x23')](handleEntityNotFound(_0x6ac78a,null))[_0x259a('0x23')](function(_0xf3087e){if(_0xf3087e){_0x4bd945=_0xf3087e;_0x22e6a5['model']=_[_0x259a('0x2f')](db['FreshdeskField'][_0x259a('0x42')]);_0x22e6a5[_0x259a('0x2e')]=_[_0x259a('0x2f')](_0x1723f7[_0x259a('0x2e')]);_0x22e6a5[_0x259a('0x30')]=_[_0x259a('0x32')](_0x22e6a5[_0x259a('0x2c')],_0x22e6a5[_0x259a('0x2e')]);_0x3596d6[_0x259a('0x31')]=_[_0x259a('0x32')](_0x22e6a5[_0x259a('0x2c')],qs['fields'](_0x1723f7[_0x259a('0x2e')][_0x259a('0x33')]));_0x3596d6[_0x259a('0x31')]=_0x3596d6[_0x259a('0x31')][_0x259a('0x34')]?_0x3596d6[_0x259a('0x31')]:_0x22e6a5[_0x259a('0x2c')];_0x3596d6[_0x259a('0x37')]=qs[_0x259a('0x38')](_0x1723f7[_0x259a('0x2e')][_0x259a('0x38')]);_0x3596d6[_0x259a('0x39')]=qs[_0x259a('0x30')](_[_0x259a('0x3a')](_0x1723f7['query'],_0x22e6a5['filters']));if(_0x1723f7[_0x259a('0x2e')]['filter']){_0x3596d6[_0x259a('0x39')]=_[_0x259a('0x3c')](_0x3596d6['where'],{'$or':_[_0x259a('0x2d')](_0x3596d6[_0x259a('0x31')],function(_0x392ec4){var _0x15d1e3={};_0x15d1e3[_0x392ec4]={'$like':'%'+_0x1723f7[_0x259a('0x2e')][_0x259a('0x3b')]+'%'};return _0x15d1e3;})});}_0x3596d6=_[_0x259a('0x3c')]({},_0x3596d6,_0x1723f7['options']);return _0x4bd945[_0x259a('0x4b')](_0x3596d6);}})['then'](function(_0x1ca6b5){if(_0x1ca6b5){_0x69684c=_0x1ca6b5[_0x259a('0x34')];if(!_0x1723f7[_0x259a('0x2e')]['hasOwnProperty'](_0x259a('0x36'))){_0x3596d6[_0x259a('0x1d')]=qs['limit'](_0x1723f7[_0x259a('0x2e')][_0x259a('0x1d')]);_0x3596d6[_0x259a('0x1c')]=qs['offset'](_0x1723f7[_0x259a('0x2e')][_0x259a('0x1c')]);}return _0x4bd945['getSubjects'](_0x3596d6);}})[_0x259a('0x23')](function(_0x3c855d){if(_0x3c855d){return _0x3c855d?{'count':_0x69684c,'rows':_0x3c855d}:null;}})[_0x259a('0x23')](respondWithResult(_0x6ac78a,null))[_0x259a('0x3f')](handleError(_0x6ac78a,null));};exports[_0x259a('0x4c')]=function(_0x2cb0b7,_0x195fe3,_0x200308){var _0x28ebf2={};var _0x2ce463={};var _0x6b0bf6;var _0x34054b;return db[_0x259a('0x28')][_0x259a('0x49')]({'where':{'id':_0x2cb0b7[_0x259a('0x41')]['id']}})[_0x259a('0x23')](handleEntityNotFound(_0x195fe3,null))[_0x259a('0x23')](function(_0x42420d){if(_0x42420d){_0x6b0bf6=_0x42420d;_0x2ce463[_0x259a('0x2c')]=_[_0x259a('0x2f')](db[_0x259a('0x4a')][_0x259a('0x42')]);_0x2ce463[_0x259a('0x2e')]=_[_0x259a('0x2f')](_0x2cb0b7[_0x259a('0x2e')]);_0x2ce463['filters']=_[_0x259a('0x32')](_0x2ce463[_0x259a('0x2c')],_0x2ce463[_0x259a('0x2e')]);_0x28ebf2['attributes']=_[_0x259a('0x32')](_0x2ce463['model'],qs['fields'](_0x2cb0b7['query'][_0x259a('0x33')]));_0x28ebf2[_0x259a('0x31')]=_0x28ebf2[_0x259a('0x31')][_0x259a('0x34')]?_0x28ebf2[_0x259a('0x31')]:_0x2ce463[_0x259a('0x2c')];_0x28ebf2['order']=qs[_0x259a('0x38')](_0x2cb0b7[_0x259a('0x2e')][_0x259a('0x38')]);_0x28ebf2['where']=qs[_0x259a('0x30')](_[_0x259a('0x3a')](_0x2cb0b7[_0x259a('0x2e')],_0x2ce463[_0x259a('0x30')]));if(_0x2cb0b7[_0x259a('0x2e')]['filter']){_0x28ebf2[_0x259a('0x39')]=_['merge'](_0x28ebf2[_0x259a('0x39')],{'$or':_[_0x259a('0x2d')](_0x28ebf2[_0x259a('0x31')],function(_0x559a52){var _0x53d8e6={};_0x53d8e6[_0x559a52]={'$like':'%'+_0x2cb0b7[_0x259a('0x2e')][_0x259a('0x3b')]+'%'};return _0x53d8e6;})});}_0x28ebf2=_[_0x259a('0x3c')]({},_0x28ebf2,_0x2cb0b7[_0x259a('0x3d')]);return _0x6b0bf6[_0x259a('0x4c')](_0x28ebf2);}})[_0x259a('0x23')](function(_0x173375){if(_0x173375){_0x34054b=_0x173375[_0x259a('0x34')];if(!_0x2cb0b7['query'][_0x259a('0x35')](_0x259a('0x36'))){_0x28ebf2['limit']=qs[_0x259a('0x1d')](_0x2cb0b7[_0x259a('0x2e')][_0x259a('0x1d')]);_0x28ebf2[_0x259a('0x1c')]=qs[_0x259a('0x1c')](_0x2cb0b7[_0x259a('0x2e')][_0x259a('0x1c')]);}return _0x6b0bf6[_0x259a('0x4c')](_0x28ebf2);}})[_0x259a('0x23')](function(_0xa1fc92){if(_0xa1fc92){return _0xa1fc92?{'count':_0x34054b,'rows':_0xa1fc92}:null;}})[_0x259a('0x23')](respondWithResult(_0x195fe3,null))[_0x259a('0x3f')](handleError(_0x195fe3,null));};exports[_0x259a('0x4d')]=function(_0x4e8b10,_0xf6b313,_0x2d0d84){var _0x57ffb0={};var _0x56ca20={};var _0x34c2d9;var _0x2bb08b;return db[_0x259a('0x28')][_0x259a('0x49')]({'where':{'id':_0x4e8b10['params']['id']}})[_0x259a('0x23')](handleEntityNotFound(_0xf6b313,null))[_0x259a('0x23')](function(_0xf82ed4){if(_0xf82ed4){_0x34c2d9=_0xf82ed4;_0x56ca20[_0x259a('0x2c')]=_[_0x259a('0x2f')](db[_0x259a('0x4e')][_0x259a('0x42')]);_0x56ca20[_0x259a('0x2e')]=_['keys'](_0x4e8b10['query']);_0x56ca20[_0x259a('0x30')]=_[_0x259a('0x32')](_0x56ca20[_0x259a('0x2c')],_0x56ca20[_0x259a('0x2e')]);_0x57ffb0[_0x259a('0x31')]=_['intersection'](_0x56ca20[_0x259a('0x2c')],qs['fields'](_0x4e8b10[_0x259a('0x2e')]['fields']));_0x57ffb0['attributes']=_0x57ffb0[_0x259a('0x31')][_0x259a('0x34')]?_0x57ffb0[_0x259a('0x31')]:_0x56ca20[_0x259a('0x2c')];_0x57ffb0[_0x259a('0x37')]=qs[_0x259a('0x38')](_0x4e8b10[_0x259a('0x2e')]['sort']);_0x57ffb0[_0x259a('0x39')]=qs[_0x259a('0x30')](_[_0x259a('0x3a')](_0x4e8b10[_0x259a('0x2e')],_0x56ca20[_0x259a('0x30')]));if(_0x4e8b10[_0x259a('0x2e')][_0x259a('0x3b')]){_0x57ffb0['where']=_[_0x259a('0x3c')](_0x57ffb0['where'],{'$or':_[_0x259a('0x2d')](_0x57ffb0[_0x259a('0x31')],function(_0x5981d4){var _0x1bb45f={};_0x1bb45f[_0x5981d4]={'$like':'%'+_0x4e8b10[_0x259a('0x2e')][_0x259a('0x3b')]+'%'};return _0x1bb45f;})});}_0x57ffb0=_['merge']({},_0x57ffb0,_0x4e8b10[_0x259a('0x3d')]);return _0x34c2d9[_0x259a('0x4d')](_0x57ffb0);}})[_0x259a('0x23')](function(_0x371892){if(_0x371892){_0x2bb08b=_0x371892[_0x259a('0x34')];if(!_0x4e8b10['query']['hasOwnProperty'](_0x259a('0x36'))){_0x57ffb0[_0x259a('0x1d')]=qs['limit'](_0x4e8b10['query']['limit']);_0x57ffb0[_0x259a('0x1c')]=qs[_0x259a('0x1c')](_0x4e8b10['query'][_0x259a('0x1c')]);}return _0x34c2d9[_0x259a('0x4d')](_0x57ffb0);}})[_0x259a('0x23')](function(_0x20d1ab){if(_0x20d1ab){return _0x20d1ab?{'count':_0x2bb08b,'rows':_0x20d1ab}:null;}})[_0x259a('0x23')](respondWithResult(_0xf6b313,null))[_0x259a('0x3f')](handleError(_0xf6b313,null));};exports['setTags']=function(_0x55b472,_0xb59c5,_0x55513b){if(_0x55b472[_0x259a('0x46')]['id']){delete _0x55b472[_0x259a('0x46')]['id'];}return db[_0x259a('0x28')]['findOne']({'where':{'id':_0x55b472[_0x259a('0x41')]['id']}})['then'](handleEntityNotFound(_0xb59c5,null))[_0x259a('0x23')](function(_0x1d89a1){if(_0x1d89a1){return _0x1d89a1[_0x259a('0x4f')](_0x55b472[_0x259a('0x46')][_0x259a('0x50')]||[]);}return null;})[_0x259a('0x23')](respondWithResult(_0xb59c5,null))[_0x259a('0x3f')](handleError(_0xb59c5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5d3b48c..1401613 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 _0xe0ef=['bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','moment'];(function(_0x4da5ea,_0x404f05){var _0xfc0b2e=function(_0x1a4500){while(--_0x1a4500){_0x4da5ea['push'](_0x4da5ea['shift']());}};_0xfc0b2e(++_0x404f05);}(_0xe0ef,0x159));var _0xfe0e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe0ef[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xfe0e('0x0'));var util=require(_0xfe0e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfe0e('0x2'));var BPromise=require(_0xfe0e('0x3'));var rp=require(_0xfe0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe0e('0x5'));var config=require(_0xfe0e('0x6'));var attributes=require(_0xfe0e('0x7'));module[_0xfe0e('0x8')]=function(_0x5e15ab,_0x2ccafa){return _0x5e15ab[_0xfe0e('0x9')](_0xfe0e('0xa'),attributes,{'tableName':_0xfe0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2097=['../../config/logger','bluebird','rimraf','exports','define','int_freshdesk_configurations','util'];(function(_0x38b2e6,_0x2a291c){var _0x59eea3=function(_0x2f8e64){while(--_0x2f8e64){_0x38b2e6['push'](_0x38b2e6['shift']());}};_0x59eea3(++_0x2a291c);}(_0x2097,0xb5));var _0x7209=function(_0x462ffa,_0x4d500d){_0x462ffa=_0x462ffa-0x0;var _0x535823=_0x2097[_0x462ffa];return _0x535823;};'use strict';var _=require('lodash');var util=require(_0x7209('0x0'));var logger=require(_0x7209('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7209('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7209('0x3'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x7209('0x4')]=function(_0x4c3495,_0x501386){return _0x4c3495[_0x7209('0x5')]('FreshdeskConfiguration',attributes,{'tableName':_0x7209('0x6'),'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 64615e0..d947199 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 _0xb4f1=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x3ba9cc,_0x32c51f){var _0x2818ee=function(_0x487569){while(--_0x487569){_0x3ba9cc['push'](_0x3ba9cc['shift']());}};_0x2818ee(++_0x32c51f);}(_0xb4f1,0x6e));var _0x1b4f=function(_0xb5dc2d,_0x1946e1){_0xb5dc2d=_0xb5dc2d-0x0;var _0x3e45d4=_0xb4f1[_0xb5dc2d];return _0x3e45d4;};'use strict';var _=require(_0x1b4f('0x0'));var util=require(_0x1b4f('0x1'));var moment=require('moment');var BPromise=require(_0x1b4f('0x2'));var rs=require(_0x1b4f('0x3'));var fs=require('fs');var Redis=require(_0x1b4f('0x4'));var db=require(_0x1b4f('0x5'))['db'];var utils=require(_0x1b4f('0x6'));var logger=require(_0x1b4f('0x7'))(_0x1b4f('0x8'));var config=require(_0x1b4f('0x9'));var jayson=require(_0x1b4f('0xa'));var client=jayson[_0x1b4f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303723,_0x213e0f,_0x431867){return new BPromise(function(_0x1f84bd,_0x136e22){return client[_0x1b4f('0xc')](_0x303723,_0x431867)[_0x1b4f('0xd')](function(_0x961035){logger[_0x1b4f('0xe')](_0x1b4f('0xf'),_0x213e0f,_0x1b4f('0x10'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x213e0f,_0x1b4f('0x10'),JSON[_0x1b4f('0x11')](_0x961035));if(_0x961035[_0x1b4f('0x12')]){if(_0x961035['error']['code']===0x1f4){logger['error'](_0x1b4f('0xf'),_0x213e0f,_0x961035['error']['message']);return _0x136e22(_0x961035[_0x1b4f('0x12')]['message']);}logger[_0x1b4f('0x12')](_0x1b4f('0xf'),_0x213e0f,_0x961035[_0x1b4f('0x12')][_0x1b4f('0x13')]);return _0x1f84bd(_0x961035[_0x1b4f('0x12')][_0x1b4f('0x13')]);}else{logger['info'](_0x1b4f('0xf'),_0x213e0f,_0x1b4f('0x10'));_0x1f84bd(_0x961035[_0x1b4f('0x14')]['message']);}})[_0x1b4f('0x15')](function(_0x35879d){logger[_0x1b4f('0x12')](_0x1b4f('0xf'),_0x213e0f,_0x35879d);_0x136e22(_0x35879d);});});} \ No newline at end of file +var _0x2a42=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x2a2aab,_0x431c73){var _0x2b45ee=function(_0x4d82a6){while(--_0x4d82a6){_0x2a2aab['push'](_0x2a2aab['shift']());}};_0x2b45ee(++_0x431c73);}(_0x2a42,0x1a0));var _0x22a4=function(_0x1d19da,_0x53059a){_0x1d19da=_0x1d19da-0x0;var _0x369ea0=_0x2a42[_0x1d19da];return _0x369ea0;};'use strict';var _=require(_0x22a4('0x0'));var util=require('util');var moment=require(_0x22a4('0x1'));var BPromise=require('bluebird');var rs=require(_0x22a4('0x2'));var fs=require('fs');var Redis=require(_0x22a4('0x3'));var db=require(_0x22a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22a4('0x5'))('rpc');var config=require(_0x22a4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x22a4('0x7')][_0x22a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e1d56,_0x3f4921,_0x1212fd){return new BPromise(function(_0x3b1e6c,_0x2b88b4){return client['request'](_0x3e1d56,_0x1212fd)[_0x22a4('0x9')](function(_0x890169){logger[_0x22a4('0xa')](_0x22a4('0xb'),_0x3f4921,_0x22a4('0xc'));logger[_0x22a4('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f4921,'request\x20sent',JSON['stringify'](_0x890169));if(_0x890169[_0x22a4('0xe')]){if(_0x890169[_0x22a4('0xe')]['code']===0x1f4){logger[_0x22a4('0xe')](_0x22a4('0xb'),_0x3f4921,_0x890169['error'][_0x22a4('0xf')]);return _0x2b88b4(_0x890169[_0x22a4('0xe')][_0x22a4('0xf')]);}logger[_0x22a4('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f4921,_0x890169[_0x22a4('0xe')][_0x22a4('0xf')]);return _0x3b1e6c(_0x890169[_0x22a4('0xe')]['message']);}else{logger[_0x22a4('0xa')](_0x22a4('0xb'),_0x3f4921,'request\x20sent');_0x3b1e6c(_0x890169[_0x22a4('0x10')][_0x22a4('0xf')]);}})['catch'](function(_0x46f734){logger['error'](_0x22a4('0xb'),_0x3f4921,_0x46f734);_0x2b88b4(_0x46f734);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b4e4606..0998539 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 _0xb24d=['../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xb24d,0xb9));var _0xdb24=function(_0x5c956d,_0xd0199a){_0x5c956d=_0x5c956d-0x0;var _0x3b5d0b=_0xb24d[_0x5c956d];return _0x3b5d0b;};'use strict';var multer=require(_0xdb24('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdb24('0x1'));var express=require(_0xdb24('0x2'));var router=express[_0xdb24('0x3')]();var fs_extra=require(_0xdb24('0x4'));var auth=require(_0xdb24('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb24('0x6'));var controller=require(_0xdb24('0x7'));router['get']('/',auth[_0xdb24('0x8')](),controller[_0xdb24('0x9')]);router[_0xdb24('0xa')]('/:id',auth[_0xdb24('0x8')](),controller[_0xdb24('0xb')]);router[_0xdb24('0xc')]('/',auth[_0xdb24('0x8')](),controller[_0xdb24('0xd')]);router[_0xdb24('0xe')](_0xdb24('0xf'),auth[_0xdb24('0x8')](),controller[_0xdb24('0x10')]);router[_0xdb24('0x11')]('/:id',auth[_0xdb24('0x8')](),controller[_0xdb24('0x12')]);module['exports']=router; \ No newline at end of file +var _0x68ea=['destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x170da5,_0x5df1cd){var _0x3515fd=function(_0x372c07){while(--_0x372c07){_0x170da5['push'](_0x170da5['shift']());}};_0x3515fd(++_0x5df1cd);}(_0x68ea,0x1c4));var _0xa68e=function(_0x307593,_0x26165d){_0x307593=_0x307593-0x0;var _0x41edd3=_0x68ea[_0x307593];return _0x41edd3;};'use strict';var multer=require('multer');var util=require(_0xa68e('0x0'));var path=require(_0xa68e('0x1'));var timeout=require('connect-timeout');var express=require(_0xa68e('0x2'));var router=express[_0xa68e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa68e('0x4'));var config=require(_0xa68e('0x5'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xa68e('0x6')](),controller[_0xa68e('0x7')]);router[_0xa68e('0x8')](_0xa68e('0x9'),auth[_0xa68e('0x6')](),controller[_0xa68e('0xa')]);router[_0xa68e('0xb')]('/',auth['isAuthenticated'](),controller[_0xa68e('0xc')]);router[_0xa68e('0xd')](_0xa68e('0x9'),auth['isAuthenticated'](),controller[_0xa68e('0xe')]);router[_0xa68e('0xf')]('/:id',auth[_0xa68e('0x6')](),controller[_0xa68e('0x10')]);module[_0xa68e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 10a0853..0e337d3 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 _0x9246=['sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN'];(function(_0x5cc4d0,_0x2ac74e){var _0x5cbab6=function(_0x405dc1){while(--_0x405dc1){_0x5cc4d0['push'](_0x5cc4d0['shift']());}};_0x5cbab6(++_0x2ac74e);}(_0x9246,0x6e));var _0x6924=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9246[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x6924('0x0'));module[_0x6924('0x1')]={'type':{'type':Sequelize[_0x6924('0x2')](_0x6924('0x3'),'variable','customVariable',_0x6924('0x4'),_0x6924('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6924('0x6')]},'keyType':{'type':Sequelize[_0x6924('0x2')](_0x6924('0x3'),_0x6924('0x7'),_0x6924('0x8'))},'keyContent':{'type':Sequelize[_0x6924('0x6')]},'idField':{'type':Sequelize[_0x6924('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6924('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6924('0x6')]}}; \ No newline at end of file +var _0x9e44=['picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x2c6786,_0xb76050){var _0x359015=function(_0x5139d){while(--_0x5139d){_0x2c6786['push'](_0x2c6786['shift']());}};_0x359015(++_0xb76050);}(_0x9e44,0x1ec));var _0x49e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e44[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49e4('0x0'));module['exports']={'type':{'type':Sequelize[_0x49e4('0x1')](_0x49e4('0x2'),_0x49e4('0x3'),_0x49e4('0x4'),'keyValue',_0x49e4('0x5')),'defaultValue':_0x49e4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x49e4('0x1')](_0x49e4('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x49e4('0x6')]},'idField':{'type':Sequelize[_0x49e4('0x6')]},'nameField':{'type':Sequelize[_0x49e4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49e4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 428660b..3a07cd6 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 _0x1b32=['lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','findAll','rows','show','params','fields','length','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x262417,_0x9b9f85){var _0x4404f7=function(_0x13354f){while(--_0x13354f){_0x262417['push'](_0x262417['shift']());}};_0x4404f7(++_0x9b9f85);}(_0x1b32,0x85));var _0x21b3=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x1b32[_0x26f702];return _0x11417d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b3('0x0'));var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var BPromise=require(_0x21b3('0x5'));var Mustache=require(_0x21b3('0x6'));var util=require(_0x21b3('0x7'));var path=require(_0x21b3('0x8'));var sox=require(_0x21b3('0x9'));var csv=require(_0x21b3('0xa'));var ejs=require(_0x21b3('0xb'));var fs=require('fs');var fs_extra=require(_0x21b3('0xc'));var _=require(_0x21b3('0xd'));var squel=require(_0x21b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21b3('0x10'));var Redis=require(_0x21b3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21b3('0x12'));var hardwareService=require(_0x21b3('0x13'));var logger=require(_0x21b3('0x14'))('api');var utils=require(_0x21b3('0x15'));var config=require(_0x21b3('0x16'));var licenseUtil=require(_0x21b3('0x17'));var db=require(_0x21b3('0x18'))['db'];function respondWithStatusCode(_0x40cc5a,_0x2c7abb){_0x2c7abb=_0x2c7abb||0xcc;return function(_0x3bff49){if(_0x3bff49){return _0x40cc5a[_0x21b3('0x19')](_0x2c7abb);}return _0x40cc5a[_0x21b3('0x1a')](_0x2c7abb)['end']();};}function respondWithResult(_0xa537ad,_0x810f46){_0x810f46=_0x810f46||0xc8;return function(_0x43bede){if(_0x43bede){return _0xa537ad['status'](_0x810f46)[_0x21b3('0x1b')](_0x43bede);}};}function respondWithFilteredResult(_0x4c931d,_0x3f7b4a){return function(_0x579a37){if(_0x579a37){var _0x15662a=typeof _0x3f7b4a[_0x21b3('0x1c')]===_0x21b3('0x1d')&&typeof _0x3f7b4a[_0x21b3('0x1e')]==='undefined';var _0x3f7e7a=_0x579a37['count'];var _0x408c17=_0x15662a?0x0:_0x3f7b4a[_0x21b3('0x1c')];var _0xaf1eba=_0x15662a?_0x579a37[_0x21b3('0x1f')]:_0x3f7b4a['offset']+_0x3f7b4a[_0x21b3('0x1e')];var _0x1e31bb;if(_0xaf1eba>=_0x3f7e7a){_0xaf1eba=_0x3f7e7a;_0x1e31bb=0xc8;}else{_0x1e31bb=0xce;}_0x4c931d[_0x21b3('0x1a')](_0x1e31bb);return _0x4c931d['set'](_0x21b3('0x20'),_0x408c17+'-'+_0xaf1eba+'/'+_0x3f7e7a)[_0x21b3('0x1b')](_0x579a37);}return null;};}function patchUpdates(_0x2f996d){return function(_0x3fe141){try{jsonpatch[_0x21b3('0x21')](_0x3fe141,_0x2f996d,!![]);}catch(_0x1be234){return BPromise[_0x21b3('0x22')](_0x1be234);}return _0x3fe141['save']();};}function saveUpdates(_0xbb78f3,_0x54695b){return function(_0x139672){if(_0x139672){return _0x139672[_0x21b3('0x23')](_0xbb78f3)[_0x21b3('0x24')](function(_0x4fcb87){return _0x4fcb87;});}return null;};}function removeEntity(_0x19ba2c,_0x5bda6e){return function(_0x3ee234){if(_0x3ee234){return _0x3ee234[_0x21b3('0x25')]()[_0x21b3('0x24')](function(){_0x19ba2c[_0x21b3('0x1a')](0xcc)[_0x21b3('0x26')]();});}};}function handleEntityNotFound(_0x2e3221,_0x58822d){return function(_0x5b752c){if(!_0x5b752c){_0x2e3221['sendStatus'](0x194);}return _0x5b752c;};}function handleError(_0x3ca89d,_0x2e3758){_0x2e3758=_0x2e3758||0x1f4;return function(_0x3c1a3b){logger[_0x21b3('0x27')](_0x3c1a3b[_0x21b3('0x28')]);if(_0x3c1a3b['name']){delete _0x3c1a3b[_0x21b3('0x29')];}_0x3ca89d['status'](_0x2e3758)[_0x21b3('0x2a')](_0x3c1a3b);};}exports['index']=function(_0x469e42,_0xf48fc7){var _0x81ee7e={},_0x4f6432={},_0x291e52={'count':0x0,'rows':[]};var _0x300977=_[_0x21b3('0x2b')](db[_0x21b3('0x2c')][_0x21b3('0x2d')],function(_0x210c49){return{'name':_0x210c49[_0x21b3('0x2e')],'type':_0x210c49['type']['key']};});_0x4f6432[_0x21b3('0x2f')]=_[_0x21b3('0x2b')](_0x300977,'name');_0x4f6432[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x469e42[_0x21b3('0x30')]);_0x4f6432[_0x21b3('0x32')]=_[_0x21b3('0x33')](_0x4f6432[_0x21b3('0x2f')],_0x4f6432[_0x21b3('0x30')]);_0x81ee7e[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x4f6432['model'],qs['fields'](_0x469e42[_0x21b3('0x30')]['fields']));_0x81ee7e[_0x21b3('0x34')]=_0x81ee7e[_0x21b3('0x34')]['length']?_0x81ee7e[_0x21b3('0x34')]:_0x4f6432[_0x21b3('0x2f')];if(!_0x469e42[_0x21b3('0x30')][_0x21b3('0x35')]('nolimit')){_0x81ee7e[_0x21b3('0x1e')]=qs[_0x21b3('0x1e')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x1e')]);_0x81ee7e['offset']=qs[_0x21b3('0x1c')](_0x469e42['query'][_0x21b3('0x1c')]);}_0x81ee7e[_0x21b3('0x36')]=qs[_0x21b3('0x37')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x37')]);_0x81ee7e[_0x21b3('0x38')]=qs[_0x21b3('0x32')](_['pick'](_0x469e42['query'],_0x4f6432[_0x21b3('0x32')]),_0x300977);if(_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]){_0x81ee7e[_0x21b3('0x38')]=_['merge'](_0x81ee7e[_0x21b3('0x38')],{'$or':_[_0x21b3('0x2b')](_0x300977,function(_0x128564){if(_0x128564[_0x21b3('0x3a')]!==_0x21b3('0x3b')){var _0xb028ca={};_0xb028ca[_0x128564[_0x21b3('0x29')]]={'$like':'%'+_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]+'%'};return _0xb028ca;}})});}_0x81ee7e=_[_0x21b3('0x3c')]({},_0x81ee7e,_0x469e42[_0x21b3('0x3d')]);var _0x4facfc={'where':_0x81ee7e[_0x21b3('0x38')]};return db[_0x21b3('0x2c')]['count'](_0x4facfc)[_0x21b3('0x24')](function(_0x5f2623){_0x291e52[_0x21b3('0x1f')]=_0x5f2623;if(_0x469e42[_0x21b3('0x30')]['includeAll']){_0x81ee7e['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x21b3('0x3e')](_0x81ee7e);})[_0x21b3('0x24')](function(_0x3e6501){_0x291e52[_0x21b3('0x3f')]=_0x3e6501;return _0x291e52;})['then'](respondWithFilteredResult(_0xf48fc7,_0x81ee7e))['catch'](handleError(_0xf48fc7,null));};exports[_0x21b3('0x40')]=function(_0x492eaf,_0x1c97e7){var _0x28adbc={'raw':!![],'where':{'id':_0x492eaf[_0x21b3('0x41')]['id']}},_0x306bf2={};_0x306bf2[_0x21b3('0x2f')]=_['keys'](db[_0x21b3('0x2c')][_0x21b3('0x2d')]);_0x306bf2[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x492eaf[_0x21b3('0x30')]);_0x306bf2[_0x21b3('0x32')]=_['intersection'](_0x306bf2['model'],_0x306bf2[_0x21b3('0x30')]);_0x28adbc[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x306bf2['model'],qs[_0x21b3('0x42')](_0x492eaf[_0x21b3('0x30')][_0x21b3('0x42')]));_0x28adbc[_0x21b3('0x34')]=_0x28adbc[_0x21b3('0x34')][_0x21b3('0x43')]?_0x28adbc['attributes']:_0x306bf2[_0x21b3('0x2f')];if(_0x492eaf[_0x21b3('0x30')][_0x21b3('0x44')]){_0x28adbc['include']=[{'all':!![]}];}_0x28adbc=_['merge']({},_0x28adbc,_0x492eaf['options']);return db[_0x21b3('0x2c')][_0x21b3('0x45')](_0x28adbc)[_0x21b3('0x24')](handleEntityNotFound(_0x1c97e7,null))[_0x21b3('0x24')](respondWithResult(_0x1c97e7,null))[_0x21b3('0x46')](handleError(_0x1c97e7,null));};exports[_0x21b3('0x47')]=function(_0xc51c1d,_0x30d48b){return db[_0x21b3('0x2c')]['create'](_0xc51c1d['body'],{})['then'](respondWithResult(_0x30d48b,0xc9))[_0x21b3('0x46')](handleError(_0x30d48b,null));};exports[_0x21b3('0x23')]=function(_0x4046cd,_0x2e4add){if(_0x4046cd[_0x21b3('0x48')]['id']){delete _0x4046cd[_0x21b3('0x48')]['id'];}return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x4046cd[_0x21b3('0x41')]['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0x2e4add,null))['then'](saveUpdates(_0x4046cd[_0x21b3('0x48')],null))[_0x21b3('0x24')](respondWithResult(_0x2e4add,null))[_0x21b3('0x46')](handleError(_0x2e4add,null));};exports[_0x21b3('0x25')]=function(_0x34509e,_0x2c7019){return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x34509e[_0x21b3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c7019,null))[_0x21b3('0x24')](removeEntity(_0x2c7019,null))[_0x21b3('0x46')](handleError(_0x2c7019,null));}; \ No newline at end of file +var _0xc368=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshdeskField','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x20e365,_0x37c26d){var _0x41e185=function(_0x5c1bdf){while(--_0x5c1bdf){_0x20e365['push'](_0x20e365['shift']());}};_0x41e185(++_0x37c26d);}(_0xc368,0x7b));var _0x8c36=function(_0x51552d,_0x173adc){_0x51552d=_0x51552d-0x0;var _0x5ed210=_0xc368[_0x51552d];return _0x5ed210;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c36('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c36('0x1'));var rp=require(_0x8c36('0x2'));var moment=require(_0x8c36('0x3'));var BPromise=require(_0x8c36('0x4'));var Mustache=require(_0x8c36('0x5'));var util=require('util');var path=require(_0x8c36('0x6'));var sox=require(_0x8c36('0x7'));var csv=require(_0x8c36('0x8'));var ejs=require(_0x8c36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x8'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var licenseUtil=require(_0x8c36('0x15'));var db=require(_0x8c36('0x16'))['db'];function respondWithStatusCode(_0xa09884,_0x23eb71){_0x23eb71=_0x23eb71||0xcc;return function(_0x205d5c){if(_0x205d5c){return _0xa09884[_0x8c36('0x17')](_0x23eb71);}return _0xa09884[_0x8c36('0x18')](_0x23eb71)[_0x8c36('0x19')]();};}function respondWithResult(_0x3c824b,_0x220f18){_0x220f18=_0x220f18||0xc8;return function(_0x5dfcd5){if(_0x5dfcd5){return _0x3c824b[_0x8c36('0x18')](_0x220f18)['json'](_0x5dfcd5);}};}function respondWithFilteredResult(_0xea7509,_0x3f83aa){return function(_0x29e791){if(_0x29e791){var _0x1fc68e=typeof _0x3f83aa[_0x8c36('0x1a')]===_0x8c36('0x1b')&&typeof _0x3f83aa[_0x8c36('0x1c')]===_0x8c36('0x1b');var _0x30229e=_0x29e791['count'];var _0x2be9b0=_0x1fc68e?0x0:_0x3f83aa[_0x8c36('0x1a')];var _0x47832a=_0x1fc68e?_0x29e791[_0x8c36('0x1d')]:_0x3f83aa[_0x8c36('0x1a')]+_0x3f83aa['limit'];var _0x15100f;if(_0x47832a>=_0x30229e){_0x47832a=_0x30229e;_0x15100f=0xc8;}else{_0x15100f=0xce;}_0xea7509[_0x8c36('0x18')](_0x15100f);return _0xea7509[_0x8c36('0x1e')](_0x8c36('0x1f'),_0x2be9b0+'-'+_0x47832a+'/'+_0x30229e)[_0x8c36('0x20')](_0x29e791);}return null;};}function patchUpdates(_0x2b07ad){return function(_0xfb9763){try{jsonpatch[_0x8c36('0x21')](_0xfb9763,_0x2b07ad,!![]);}catch(_0x153735){return BPromise[_0x8c36('0x22')](_0x153735);}return _0xfb9763[_0x8c36('0x23')]();};}function saveUpdates(_0x14ee6b,_0x46645d){return function(_0x51fd6c){if(_0x51fd6c){return _0x51fd6c['update'](_0x14ee6b)['then'](function(_0x55b844){return _0x55b844;});}return null;};}function removeEntity(_0x2269f5,_0x7effb8){return function(_0x2088aa){if(_0x2088aa){return _0x2088aa[_0x8c36('0x24')]()[_0x8c36('0x25')](function(){_0x2269f5[_0x8c36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d39ca,_0x49f6f9){return function(_0x40b66f){if(!_0x40b66f){_0x1d39ca['sendStatus'](0x194);}return _0x40b66f;};}function handleError(_0x10613e,_0x1afee4){_0x1afee4=_0x1afee4||0x1f4;return function(_0x271ec4){logger[_0x8c36('0x26')](_0x271ec4['stack']);if(_0x271ec4['name']){delete _0x271ec4[_0x8c36('0x27')];}_0x10613e[_0x8c36('0x18')](_0x1afee4)['send'](_0x271ec4);};}exports['index']=function(_0x418663,_0x2b5a8c){var _0x502fa3={},_0x1280a1={},_0xb29f20={'count':0x0,'rows':[]};var _0x3ca98e=_['map'](db['FreshdeskField'][_0x8c36('0x28')],function(_0x1531fc){return{'name':_0x1531fc[_0x8c36('0x29')],'type':_0x1531fc[_0x8c36('0x2a')][_0x8c36('0x2b')]};});_0x1280a1[_0x8c36('0x2c')]=_[_0x8c36('0x2d')](_0x3ca98e,_0x8c36('0x27'));_0x1280a1[_0x8c36('0x2e')]=_[_0x8c36('0x2f')](_0x418663[_0x8c36('0x2e')]);_0x1280a1[_0x8c36('0x30')]=_[_0x8c36('0x31')](_0x1280a1[_0x8c36('0x2c')],_0x1280a1[_0x8c36('0x2e')]);_0x502fa3[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x1280a1['model'],qs['fields'](_0x418663['query'][_0x8c36('0x33')]));_0x502fa3[_0x8c36('0x32')]=_0x502fa3[_0x8c36('0x32')][_0x8c36('0x34')]?_0x502fa3[_0x8c36('0x32')]:_0x1280a1[_0x8c36('0x2c')];if(!_0x418663[_0x8c36('0x2e')]['hasOwnProperty'](_0x8c36('0x35'))){_0x502fa3['limit']=qs[_0x8c36('0x1c')](_0x418663['query'][_0x8c36('0x1c')]);_0x502fa3[_0x8c36('0x1a')]=qs[_0x8c36('0x1a')](_0x418663['query'][_0x8c36('0x1a')]);}_0x502fa3[_0x8c36('0x36')]=qs[_0x8c36('0x37')](_0x418663[_0x8c36('0x2e')][_0x8c36('0x37')]);_0x502fa3[_0x8c36('0x38')]=qs[_0x8c36('0x30')](_[_0x8c36('0x39')](_0x418663[_0x8c36('0x2e')],_0x1280a1[_0x8c36('0x30')]),_0x3ca98e);if(_0x418663[_0x8c36('0x2e')][_0x8c36('0x3a')]){_0x502fa3[_0x8c36('0x38')]=_[_0x8c36('0x3b')](_0x502fa3[_0x8c36('0x38')],{'$or':_[_0x8c36('0x2d')](_0x3ca98e,function(_0x292b5f){if(_0x292b5f['type']!==_0x8c36('0x3c')){var _0x5ee15b={};_0x5ee15b[_0x292b5f[_0x8c36('0x27')]]={'$like':'%'+_0x418663[_0x8c36('0x2e')][_0x8c36('0x3a')]+'%'};return _0x5ee15b;}})});}_0x502fa3=_[_0x8c36('0x3b')]({},_0x502fa3,_0x418663['options']);var _0x5a50d6={'where':_0x502fa3[_0x8c36('0x38')]};return db[_0x8c36('0x3d')][_0x8c36('0x1d')](_0x5a50d6)['then'](function(_0x4f6f06){_0xb29f20[_0x8c36('0x1d')]=_0x4f6f06;if(_0x418663['query']['includeAll']){_0x502fa3[_0x8c36('0x3e')]=[{'all':!![]}];}return db[_0x8c36('0x3d')][_0x8c36('0x3f')](_0x502fa3);})[_0x8c36('0x25')](function(_0x2a0272){_0xb29f20[_0x8c36('0x40')]=_0x2a0272;return _0xb29f20;})[_0x8c36('0x25')](respondWithFilteredResult(_0x2b5a8c,_0x502fa3))[_0x8c36('0x41')](handleError(_0x2b5a8c,null));};exports[_0x8c36('0x42')]=function(_0xb65040,_0x508ed9){var _0x3543b0={'raw':!![],'where':{'id':_0xb65040[_0x8c36('0x43')]['id']}},_0x24505c={};_0x24505c[_0x8c36('0x2c')]=_[_0x8c36('0x2f')](db['FreshdeskField'][_0x8c36('0x28')]);_0x24505c[_0x8c36('0x2e')]=_[_0x8c36('0x2f')](_0xb65040[_0x8c36('0x2e')]);_0x24505c[_0x8c36('0x30')]=_[_0x8c36('0x31')](_0x24505c['model'],_0x24505c[_0x8c36('0x2e')]);_0x3543b0[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x24505c[_0x8c36('0x2c')],qs[_0x8c36('0x33')](_0xb65040[_0x8c36('0x2e')][_0x8c36('0x33')]));_0x3543b0['attributes']=_0x3543b0[_0x8c36('0x32')][_0x8c36('0x34')]?_0x3543b0[_0x8c36('0x32')]:_0x24505c[_0x8c36('0x2c')];if(_0xb65040[_0x8c36('0x2e')][_0x8c36('0x44')]){_0x3543b0[_0x8c36('0x3e')]=[{'all':!![]}];}_0x3543b0=_[_0x8c36('0x3b')]({},_0x3543b0,_0xb65040[_0x8c36('0x45')]);return db[_0x8c36('0x3d')][_0x8c36('0x46')](_0x3543b0)[_0x8c36('0x25')](handleEntityNotFound(_0x508ed9,null))['then'](respondWithResult(_0x508ed9,null))['catch'](handleError(_0x508ed9,null));};exports[_0x8c36('0x47')]=function(_0x476b51,_0xd46608){return db[_0x8c36('0x3d')]['create'](_0x476b51[_0x8c36('0x48')],{})[_0x8c36('0x25')](respondWithResult(_0xd46608,0xc9))['catch'](handleError(_0xd46608,null));};exports['update']=function(_0x4edf8e,_0xb4ebae){if(_0x4edf8e[_0x8c36('0x48')]['id']){delete _0x4edf8e[_0x8c36('0x48')]['id'];}return db[_0x8c36('0x3d')][_0x8c36('0x46')]({'where':{'id':_0x4edf8e[_0x8c36('0x43')]['id']}})['then'](handleEntityNotFound(_0xb4ebae,null))[_0x8c36('0x25')](saveUpdates(_0x4edf8e[_0x8c36('0x48')],null))[_0x8c36('0x25')](respondWithResult(_0xb4ebae,null))[_0x8c36('0x41')](handleError(_0xb4ebae,null));};exports['destroy']=function(_0x5e668d,_0x599116){return db[_0x8c36('0x3d')][_0x8c36('0x46')]({'where':{'id':_0x5e668d[_0x8c36('0x43')]['id']}})[_0x8c36('0x25')](handleEntityNotFound(_0x599116,null))[_0x8c36('0x25')](removeEntity(_0x599116,null))[_0x8c36('0x41')](handleError(_0x599116,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f1a2350..c7fdf54 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 _0xaffa=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5a9905,_0x3b990b){var _0x4316c1=function(_0x44292f){while(--_0x44292f){_0x5a9905['push'](_0x5a9905['shift']());}};_0x4316c1(++_0x3b990b);}(_0xaffa,0x11d));var _0xaaff=function(_0xae3c81,_0x57445b){_0xae3c81=_0xae3c81-0x0;var _0x13fb8b=_0xaffa[_0xae3c81];return _0x13fb8b;};'use strict';var _=require(_0xaaff('0x0'));var util=require(_0xaaff('0x1'));var logger=require(_0xaaff('0x2'))(_0xaaff('0x3'));var moment=require(_0xaaff('0x4'));var BPromise=require(_0xaaff('0x5'));var rp=require(_0xaaff('0x6'));var fs=require('fs');var path=require(_0xaaff('0x7'));var rimraf=require(_0xaaff('0x8'));var config=require(_0xaaff('0x9'));var attributes=require(_0xaaff('0xa'));module[_0xaaff('0xb')]=function(_0x3e8936,_0xe2f5dc){return _0x3e8936[_0xaaff('0xc')](_0xaaff('0xd'),attributes,{'tableName':_0xaaff('0xe'),'paranoid':![],'indexes':[{'name':_0xaaff('0xf'),'fields':[_0xaaff('0x10'),_0xaaff('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb613=['freshdesk_unique_index','idField','FieldId','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0x4fa7f5,_0x281d76){var _0x538d9f=function(_0x4fc8d3){while(--_0x4fc8d3){_0x4fa7f5['push'](_0x4fa7f5['shift']());}};_0x538d9f(++_0x281d76);}(_0xb613,0x9d));var _0x3b61=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xb613[_0x3dc68d];return _0xdf7f94;};'use strict';var _=require(_0x3b61('0x0'));var util=require(_0x3b61('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3b61('0x2'));var BPromise=require(_0x3b61('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b61('0x4'));var rimraf=require(_0x3b61('0x5'));var config=require(_0x3b61('0x6'));var attributes=require(_0x3b61('0x7'));module[_0x3b61('0x8')]=function(_0x160daa,_0x167261){return _0x160daa['define'](_0x3b61('0x9'),attributes,{'tableName':_0x3b61('0xa'),'paranoid':![],'indexes':[{'name':_0x3b61('0xb'),'fields':[_0x3b61('0xc'),_0x3b61('0xd')],'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 1545160..b6577e5 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 _0x1f5f=['result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5eeb5a,_0xfb394){var _0x4d62a3=function(_0x51362f){while(--_0x51362f){_0x5eeb5a['push'](_0x5eeb5a['shift']());}};_0x4d62a3(++_0xfb394);}(_0x1f5f,0xbf));var _0xf1f5=function(_0x497ddf,_0x5e3044){_0x497ddf=_0x497ddf-0x0;var _0x4a946d=_0x1f5f[_0x497ddf];return _0x4a946d;};'use strict';var _=require(_0xf1f5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf1f5('0x1'));var rs=require(_0xf1f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1f5('0x3'))['db'];var utils=require(_0xf1f5('0x4'));var logger=require(_0xf1f5('0x5'))(_0xf1f5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf1f5('0x7')][_0xf1f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57195d,_0x3e449a,_0x4b6065){return new BPromise(function(_0x2e661b,_0x300262){return client[_0xf1f5('0x9')](_0x57195d,_0x4b6065)[_0xf1f5('0xa')](function(_0xe935ee){logger[_0xf1f5('0xb')](_0xf1f5('0xc'),_0x3e449a,_0xf1f5('0xd'));logger[_0xf1f5('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3e449a,_0xf1f5('0xd'),JSON[_0xf1f5('0xf')](_0xe935ee));if(_0xe935ee[_0xf1f5('0x10')]){if(_0xe935ee[_0xf1f5('0x10')][_0xf1f5('0x11')]===0x1f4){logger[_0xf1f5('0x10')](_0xf1f5('0xc'),_0x3e449a,_0xe935ee[_0xf1f5('0x10')][_0xf1f5('0x12')]);return _0x300262(_0xe935ee[_0xf1f5('0x10')][_0xf1f5('0x12')]);}logger[_0xf1f5('0x10')](_0xf1f5('0xc'),_0x3e449a,_0xe935ee[_0xf1f5('0x10')][_0xf1f5('0x12')]);return _0x2e661b(_0xe935ee[_0xf1f5('0x10')][_0xf1f5('0x12')]);}else{logger[_0xf1f5('0xb')](_0xf1f5('0xc'),_0x3e449a,_0xf1f5('0xd'));_0x2e661b(_0xe935ee[_0xf1f5('0x13')][_0xf1f5('0x12')]);}})[_0xf1f5('0x14')](function(_0x3caf85){logger[_0xf1f5('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x3e449a,_0x3caf85);_0x300262(_0x3caf85);});});} \ No newline at end of file +var _0xfbdb=['../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','FreshdeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb'];(function(_0x9b6d2c,_0x5c2cd2){var _0x1be859=function(_0x332f0d){while(--_0x332f0d){_0x9b6d2c['push'](_0x9b6d2c['shift']());}};_0x1be859(++_0x5c2cd2);}(_0xfbdb,0x1c4));var _0xbfbd=function(_0x3137f0,_0x509d52){_0x3137f0=_0x3137f0-0x0;var _0x4c12c4=_0xfbdb[_0x3137f0];return _0x4c12c4;};'use strict';var _=require('lodash');var util=require(_0xbfbd('0x0'));var moment=require(_0xbfbd('0x1'));var BPromise=require(_0xbfbd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfbd('0x3'))['db'];var utils=require(_0xbfbd('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbd('0x5'));var client=jayson[_0xbfbd('0x6')][_0xbfbd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa2e5e,_0x594cac,_0x29c349){return new BPromise(function(_0x5415aa,_0x11488e){return client[_0xbfbd('0x8')](_0xa2e5e,_0x29c349)[_0xbfbd('0x9')](function(_0x59190b){logger[_0xbfbd('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x594cac,_0xbfbd('0xb'));logger[_0xbfbd('0xc')](_0xbfbd('0xd'),_0x594cac,_0xbfbd('0xb'),JSON['stringify'](_0x59190b));if(_0x59190b[_0xbfbd('0xe')]){if(_0x59190b[_0xbfbd('0xe')]['code']===0x1f4){logger[_0xbfbd('0xe')](_0xbfbd('0xf'),_0x594cac,_0x59190b[_0xbfbd('0xe')]['message']);return _0x11488e(_0x59190b[_0xbfbd('0xe')][_0xbfbd('0x10')]);}logger['error'](_0xbfbd('0xf'),_0x594cac,_0x59190b[_0xbfbd('0xe')][_0xbfbd('0x10')]);return _0x5415aa(_0x59190b['error'][_0xbfbd('0x10')]);}else{logger[_0xbfbd('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x594cac,'request\x20sent');_0x5415aa(_0x59190b[_0xbfbd('0x11')][_0xbfbd('0x10')]);}})[_0xbfbd('0x12')](function(_0x58b40e){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x594cac,_0x58b40e);_0x11488e(_0x58b40e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 8ff73b0..e45d080 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 _0x282b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x282b,0xec));var _0xb282=function(_0x4fe32e,_0x43fff3){_0x4fe32e=_0x4fe32e-0x0;var _0x3ca7d1=_0x282b[_0x4fe32e];return _0x3ca7d1;};'use strict';var multer=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var timeout=require(_0xb282('0x3'));var express=require(_0xb282('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb282('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb282('0x6'));var controller=require(_0xb282('0x7'));router[_0xb282('0x8')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xa')]);router[_0xb282('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb282('0xb')]);router[_0xb282('0x8')]('/:id/configurations',auth[_0xb282('0x9')](),controller[_0xb282('0xc')]);router[_0xb282('0x8')](_0xb282('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb282('0xe')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xf')]);router[_0xb282('0xe')](_0xb282('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb282('0x11')](_0xb282('0x12'),auth[_0xb282('0x9')](),controller[_0xb282('0x13')]);router[_0xb282('0x14')]('/:id',auth[_0xb282('0x9')](),controller['destroy']);module[_0xb282('0x15')]=router; \ No newline at end of file +var _0x0565=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','delete','/:id','exports'];(function(_0x22956d,_0x3efe6d){var _0xa160cb=function(_0x2564d4){while(--_0x2564d4){_0x22956d['push'](_0x22956d['shift']());}};_0xa160cb(++_0x3efe6d);}(_0x0565,0xf2));var _0x5056=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x0565[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var path=require(_0x5056('0x2'));var timeout=require(_0x5056('0x3'));var express=require(_0x5056('0x4'));var router=express[_0x5056('0x5')]();var fs_extra=require(_0x5056('0x6'));var auth=require(_0x5056('0x7'));var interaction=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var controller=require('./intFreshsalesAccount.controller');router[_0x5056('0xa')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0xc')]);router[_0x5056('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5056('0xd')]);router[_0x5056('0xa')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller[_0x5056('0xf')]);router[_0x5056('0xa')](_0x5056('0x10'),auth[_0x5056('0xb')](),controller['getFields']);router[_0x5056('0x11')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0x12')]);router['post']('/:id/configurations',auth[_0x5056('0xb')](),controller['addConfiguration']);router['put']('/:id',auth[_0x5056('0xb')](),controller['update']);router[_0x5056('0x13')](_0x5056('0x14'),auth[_0x5056('0xb')](),controller['destroy']);module[_0x5056('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9143370..0ad8d29 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 _0x9582=['exports','STRING','username','remoteUri','sequelize'];(function(_0x2dd5dc,_0x76108b){var _0xb04871=function(_0x1408fb){while(--_0x1408fb){_0x2dd5dc['push'](_0x2dd5dc['shift']());}};_0xb04871(++_0x76108b);}(_0x9582,0x95));var _0x2958=function(_0xfc3150,_0x3ebe63){_0xfc3150=_0xfc3150-0x0;var _0x504907=_0x9582[_0xfc3150];return _0x504907;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'name':{'type':Sequelize[_0x2958('0x2')]},'description':{'type':Sequelize[_0x2958('0x2')]},'username':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x4')},'serverUrl':{'type':Sequelize[_0x2958('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf2e3=['STRING','username','remoteUri','sequelize'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xf2e3[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'apiKey':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index bba8129..cc680ba 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 _0x3b51=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','findOne','length','getConfigurations','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','Subjects','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3dfa9e,_0x2a51a4){var _0xac48c3=function(_0x1e32f3){while(--_0x1e32f3){_0x3dfa9e['push'](_0x3dfa9e['shift']());}};_0xac48c3(++_0x2a51a4);}(_0x3b51,0x193));var _0x13b5=function(_0x56033d,_0x210f70){_0x56033d=_0x56033d-0x0;var _0x36c8fd=_0x3b51[_0x56033d];return _0x36c8fd;};'use strict';var emlformat=require(_0x13b5('0x0'));var rimraf=require(_0x13b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13b5('0x2'));var rp=require('request-promise');var moment=require(_0x13b5('0x3'));var BPromise=require(_0x13b5('0x4'));var Mustache=require(_0x13b5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x13b5('0x6'));var csv=require('to-csv');var ejs=require(_0x13b5('0x7'));var fs=require('fs');var fs_extra=require(_0x13b5('0x8'));var _=require(_0x13b5('0x9'));var squel=require(_0x13b5('0xa'));var crypto=require(_0x13b5('0xb'));var jsforce=require(_0x13b5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x13b5('0xd'));var querystring=require('querystring');var Papa=require(_0x13b5('0xe'));var Redis=require('ioredis');var authService=require(_0x13b5('0xf'));var qs=require(_0x13b5('0x10'));var as=require(_0x13b5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x13b5('0x12'))(_0x13b5('0x13'));var utils=require(_0x13b5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x13b5('0x15'));var db=require(_0x13b5('0x16'))['db'];var integrations=require(_0x13b5('0x17'));function respondWithStatusCode(_0x5ad760,_0x91629e){_0x91629e=_0x91629e||0xcc;return function(_0x2d0569){if(_0x2d0569){return _0x5ad760[_0x13b5('0x18')](_0x91629e);}return _0x5ad760[_0x13b5('0x19')](_0x91629e)[_0x13b5('0x1a')]();};}function respondWithResult(_0x27323f,_0x6286fd){_0x6286fd=_0x6286fd||0xc8;return function(_0x314058){if(_0x314058){return _0x27323f[_0x13b5('0x19')](_0x6286fd)[_0x13b5('0x1b')](_0x314058);}};}function respondWithFilteredResult(_0xaa77b5,_0x415a35){return function(_0x359fab){if(_0x359fab){var _0x2ce572=typeof _0x415a35[_0x13b5('0x1c')]===_0x13b5('0x1d')&&typeof _0x415a35[_0x13b5('0x1e')]==='undefined';var _0x3f6b13=_0x359fab[_0x13b5('0x1f')];var _0x1ad864=_0x2ce572?0x0:_0x415a35[_0x13b5('0x1c')];var _0x15cf4b=_0x2ce572?_0x359fab['count']:_0x415a35[_0x13b5('0x1c')]+_0x415a35[_0x13b5('0x1e')];var _0x40a6df;if(_0x15cf4b>=_0x3f6b13){_0x15cf4b=_0x3f6b13;_0x40a6df=0xc8;}else{_0x40a6df=0xce;}_0xaa77b5[_0x13b5('0x19')](_0x40a6df);return _0xaa77b5[_0x13b5('0x20')](_0x13b5('0x21'),_0x1ad864+'-'+_0x15cf4b+'/'+_0x3f6b13)[_0x13b5('0x1b')](_0x359fab);}return null;};}function patchUpdates(_0xb140f3){return function(_0x4cfb99){try{jsonpatch[_0x13b5('0x22')](_0x4cfb99,_0xb140f3,!![]);}catch(_0xe20830){return BPromise[_0x13b5('0x23')](_0xe20830);}return _0x4cfb99[_0x13b5('0x24')]();};}function saveUpdates(_0x820a65,_0x3e4e76){return function(_0x5d541e){if(_0x5d541e){return _0x5d541e[_0x13b5('0x25')](_0x820a65)[_0x13b5('0x26')](function(_0x2414bb){return _0x2414bb;});}return null;};}function removeEntity(_0x1ca842,_0x179cf2){return function(_0x47523b){if(_0x47523b){return _0x47523b['destroy']()[_0x13b5('0x26')](function(){_0x1ca842[_0x13b5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x60dfbc,_0x3c77c7){return function(_0x5bbafb){if(!_0x5bbafb){_0x60dfbc[_0x13b5('0x18')](0x194);}return _0x5bbafb;};}function handleError(_0x41ab25,_0x843364){_0x843364=_0x843364||0x1f4;return function(_0x2859c7){logger[_0x13b5('0x27')](_0x2859c7['stack']);if(_0x2859c7[_0x13b5('0x28')]){delete _0x2859c7[_0x13b5('0x28')];}_0x41ab25['status'](_0x843364)[_0x13b5('0x29')](_0x2859c7);};}exports['index']=function(_0x292fe0,_0x9d11e6){var _0x7bca57={},_0x350066={},_0x39567e={'count':0x0,'rows':[]};var _0x2b845e=_[_0x13b5('0x2a')](db[_0x13b5('0x2b')][_0x13b5('0x2c')],function(_0x36dfa9){return{'name':_0x36dfa9[_0x13b5('0x2d')],'type':_0x36dfa9[_0x13b5('0x2e')][_0x13b5('0x2f')]};});_0x350066[_0x13b5('0x30')]=_['map'](_0x2b845e,_0x13b5('0x28'));_0x350066[_0x13b5('0x31')]=_['keys'](_0x292fe0[_0x13b5('0x31')]);_0x350066[_0x13b5('0x32')]=_[_0x13b5('0x33')](_0x350066[_0x13b5('0x30')],_0x350066['query']);_0x7bca57['attributes']=_[_0x13b5('0x33')](_0x350066[_0x13b5('0x30')],qs[_0x13b5('0x34')](_0x292fe0[_0x13b5('0x31')][_0x13b5('0x34')]));_0x7bca57[_0x13b5('0x35')]=_0x7bca57[_0x13b5('0x35')]['length']?_0x7bca57[_0x13b5('0x35')]:_0x350066[_0x13b5('0x30')];if(!_0x292fe0['query'][_0x13b5('0x36')](_0x13b5('0x37'))){_0x7bca57[_0x13b5('0x1e')]=qs[_0x13b5('0x1e')](_0x292fe0['query'][_0x13b5('0x1e')]);_0x7bca57[_0x13b5('0x1c')]=qs['offset'](_0x292fe0[_0x13b5('0x31')]['offset']);}_0x7bca57[_0x13b5('0x38')]=qs[_0x13b5('0x39')](_0x292fe0[_0x13b5('0x31')]['sort']);_0x7bca57['where']=qs[_0x13b5('0x32')](_[_0x13b5('0x3a')](_0x292fe0['query'],_0x350066['filters']),_0x2b845e);if(_0x292fe0['query'][_0x13b5('0x3b')]){_0x7bca57[_0x13b5('0x3c')]=_[_0x13b5('0x3d')](_0x7bca57['where'],{'$or':_[_0x13b5('0x2a')](_0x2b845e,function(_0x5874fb){if(_0x5874fb[_0x13b5('0x2e')]!==_0x13b5('0x3e')){var _0x30bc22={};_0x30bc22[_0x5874fb[_0x13b5('0x28')]]={'$like':'%'+_0x292fe0['query'][_0x13b5('0x3b')]+'%'};return _0x30bc22;}})});}_0x7bca57=_[_0x13b5('0x3d')]({},_0x7bca57,_0x292fe0[_0x13b5('0x3f')]);var _0x132714={'where':_0x7bca57[_0x13b5('0x3c')]};return db['FreshsalesAccount'][_0x13b5('0x1f')](_0x132714)['then'](function(_0x119b46){_0x39567e[_0x13b5('0x1f')]=_0x119b46;if(_0x292fe0[_0x13b5('0x31')][_0x13b5('0x40')]){_0x7bca57[_0x13b5('0x41')]=[{'all':!![]}];}return db[_0x13b5('0x2b')][_0x13b5('0x42')](_0x7bca57);})[_0x13b5('0x26')](function(_0x3cfbe3){_0x39567e[_0x13b5('0x43')]=_0x3cfbe3;return _0x39567e;})[_0x13b5('0x26')](respondWithFilteredResult(_0x9d11e6,_0x7bca57))[_0x13b5('0x44')](handleError(_0x9d11e6,null));};exports[_0x13b5('0x45')]=function(_0x5b1932,_0x4fed11){var _0xf41323={'raw':![],'where':{'id':_0x5b1932[_0x13b5('0x46')]['id']}},_0x48ef8c={};_0x48ef8c[_0x13b5('0x30')]=_[_0x13b5('0x47')](db[_0x13b5('0x2b')][_0x13b5('0x2c')]);_0x48ef8c['query']=_[_0x13b5('0x47')](_0x5b1932[_0x13b5('0x31')]);_0x48ef8c[_0x13b5('0x32')]=_['intersection'](_0x48ef8c[_0x13b5('0x30')],_0x48ef8c[_0x13b5('0x31')]);_0xf41323[_0x13b5('0x35')]=_[_0x13b5('0x33')](_0x48ef8c[_0x13b5('0x30')],qs[_0x13b5('0x34')](_0x5b1932[_0x13b5('0x31')][_0x13b5('0x34')]));_0xf41323['attributes']=_0xf41323['attributes']['length']?_0xf41323[_0x13b5('0x35')]:_0x48ef8c[_0x13b5('0x30')];if(_0x5b1932['query'][_0x13b5('0x40')]){_0xf41323[_0x13b5('0x41')]=[{'all':!![]}];}_0xf41323=_[_0x13b5('0x3d')]({},_0xf41323,_0x5b1932[_0x13b5('0x3f')]);return db[_0x13b5('0x2b')][_0x13b5('0x48')](_0xf41323)['then'](handleEntityNotFound(_0x4fed11,null))[_0x13b5('0x26')](respondWithResult(_0x4fed11,null))[_0x13b5('0x44')](handleError(_0x4fed11,null));};exports['create']=function(_0x26b421,_0x26bf1e){return db['FreshsalesAccount'][_0x13b5('0x49')](_0x26b421[_0x13b5('0x4a')],{})[_0x13b5('0x26')](respondWithResult(_0x26bf1e,0xc9))['catch'](handleError(_0x26bf1e,null));};exports[_0x13b5('0x25')]=function(_0x41fa97,_0x4c71df){if(_0x41fa97[_0x13b5('0x4a')]['id']){delete _0x41fa97[_0x13b5('0x4a')]['id'];}return db['FreshsalesAccount'][_0x13b5('0x48')]({'where':{'id':_0x41fa97[_0x13b5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c71df,null))[_0x13b5('0x26')](saveUpdates(_0x41fa97[_0x13b5('0x4a')],null))[_0x13b5('0x26')](respondWithResult(_0x4c71df,null))[_0x13b5('0x44')](handleError(_0x4c71df,null));};exports[_0x13b5('0x4b')]=function(_0x1e196d,_0x33e7d0){return db[_0x13b5('0x2b')][_0x13b5('0x48')]({'where':{'id':_0x1e196d[_0x13b5('0x46')]['id']}})[_0x13b5('0x26')](handleEntityNotFound(_0x33e7d0,null))[_0x13b5('0x26')](removeEntity(_0x33e7d0,null))[_0x13b5('0x44')](handleError(_0x33e7d0,null));};exports['getConfigurations']=function(_0x5bcbe5,_0x14ce35,_0xc9e126){var _0x53f68d={};var _0x593ee6={};var _0x5bdcc7;var _0x1d5888;return db[_0x13b5('0x2b')][_0x13b5('0x4c')]({'where':{'id':_0x5bcbe5[_0x13b5('0x46')]['id']}})[_0x13b5('0x26')](handleEntityNotFound(_0x14ce35,null))[_0x13b5('0x26')](function(_0x4b76ce){if(_0x4b76ce){_0x5bdcc7=_0x4b76ce;_0x593ee6['model']=_[_0x13b5('0x47')](db['FreshsalesConfiguration'][_0x13b5('0x2c')]);_0x593ee6[_0x13b5('0x31')]=_[_0x13b5('0x47')](_0x5bcbe5[_0x13b5('0x31')]);_0x593ee6[_0x13b5('0x32')]=_[_0x13b5('0x33')](_0x593ee6[_0x13b5('0x30')],_0x593ee6['query']);_0x53f68d[_0x13b5('0x35')]=_[_0x13b5('0x33')](_0x593ee6[_0x13b5('0x30')],qs[_0x13b5('0x34')](_0x5bcbe5[_0x13b5('0x31')][_0x13b5('0x34')]));_0x53f68d['attributes']=_0x53f68d[_0x13b5('0x35')][_0x13b5('0x4d')]?_0x53f68d[_0x13b5('0x35')]:_0x593ee6[_0x13b5('0x30')];_0x53f68d[_0x13b5('0x38')]=qs[_0x13b5('0x39')](_0x5bcbe5[_0x13b5('0x31')][_0x13b5('0x39')]);_0x53f68d[_0x13b5('0x3c')]=qs[_0x13b5('0x32')](_[_0x13b5('0x3a')](_0x5bcbe5[_0x13b5('0x31')],_0x593ee6[_0x13b5('0x32')]));if(_0x5bcbe5[_0x13b5('0x31')]['filter']){_0x53f68d[_0x13b5('0x3c')]=_['merge'](_0x53f68d['where'],{'$or':_[_0x13b5('0x2a')](_0x53f68d[_0x13b5('0x35')],function(_0x240a70){var _0x19dbbf={};_0x19dbbf[_0x240a70]={'$like':'%'+_0x5bcbe5[_0x13b5('0x31')]['filter']+'%'};return _0x19dbbf;})});}_0x53f68d=_[_0x13b5('0x3d')]({},_0x53f68d,_0x5bcbe5[_0x13b5('0x3f')]);return _0x5bdcc7[_0x13b5('0x4e')](_0x53f68d);}})['then'](function(_0x583627){if(_0x583627){_0x1d5888=_0x583627[_0x13b5('0x4d')];if(!_0x5bcbe5[_0x13b5('0x31')][_0x13b5('0x36')]('nolimit')){_0x53f68d[_0x13b5('0x1e')]=qs[_0x13b5('0x1e')](_0x5bcbe5[_0x13b5('0x31')]['limit']);_0x53f68d[_0x13b5('0x1c')]=qs[_0x13b5('0x1c')](_0x5bcbe5[_0x13b5('0x31')][_0x13b5('0x1c')]);}return _0x5bdcc7[_0x13b5('0x4e')](_0x53f68d);}})['then'](function(_0x147cac){if(_0x147cac){return _0x147cac?{'count':_0x1d5888,'rows':_0x147cac}:null;}})[_0x13b5('0x26')](respondWithResult(_0x14ce35,null))[_0x13b5('0x44')](handleError(_0x14ce35,null));};exports[_0x13b5('0x4f')]=function(_0x5cc607,_0x3c7db8,_0x164e3c){if(_0x5cc607[_0x13b5('0x4a')]['id']){delete _0x5cc607[_0x13b5('0x4a')]['id'];}return db[_0x13b5('0x2b')][_0x13b5('0x4c')]({'where':{'id':_0x5cc607['params']['id']}})[_0x13b5('0x26')](handleEntityNotFound(_0x3c7db8,null))[_0x13b5('0x26')](function(_0x4f01bf){if(_0x4f01bf){_0x5cc607[_0x13b5('0x4a')]['AccountId']=_0x4f01bf['id'];_0x5cc607['body']['Subjects']=integrations[_0x13b5('0x50')](_0x5cc607[_0x13b5('0x4a')]['channel'],_0x5cc607['body'][_0x13b5('0x2e')]);_0x5cc607[_0x13b5('0x4a')][_0x13b5('0x51')]=integrations[_0x13b5('0x52')](_0x5cc607[_0x13b5('0x4a')][_0x13b5('0x53')],_0x5cc607[_0x13b5('0x4a')][_0x13b5('0x2e')]);return db[_0x13b5('0x54')][_0x13b5('0x49')](_0x5cc607[_0x13b5('0x4a')],{'include':[{'model':db[_0x13b5('0x55')],'as':_0x13b5('0x56')},{'model':db['FreshsalesField'],'as':_0x13b5('0x51')}]});}return null;})[_0x13b5('0x26')](respondWithResult(_0x3c7db8,null))['catch'](handleError(_0x3c7db8,null));};exports['getFields']=function(_0x3a306d,_0x30be03,_0x5f865b){var _0x32c8f1='';var _0x39cc5c='';return db[_0x13b5('0x2b')]['findOne']({'where':{'id':_0x3a306d[_0x13b5('0x46')]['id']},'attributes':['id',_0x13b5('0x57'),_0x13b5('0x58'),_0x13b5('0x59')]})[_0x13b5('0x26')](handleEntityNotFound(_0x30be03,null))[_0x13b5('0x26')](function(_0x3e4258){if(_0x3e4258){_0x39cc5c=_0x3e4258['username'];_0x32c8f1=_0x3e4258[_0x13b5('0x58')];var _0x3c0114=_0x3e4258[_0x13b5('0x58')][_0x13b5('0x5a')](-0x1);if(_0x3c0114==='/'){_0x32c8f1=_0x32c8f1['substring'](0x0,_0x32c8f1[_0x13b5('0x5b')](_0x3c0114));}return rp({'method':_0x13b5('0x5c'),'uri':util[_0x13b5('0x5d')]('%s%s',_0x32c8f1,_0x13b5('0x5e')),'headers':{'Authorization':_0x13b5('0x5f')+_0x3e4258['apiKey']},'json':!![]});}})[_0x13b5('0x26')](function(_0x7a95f6){if(_0x7a95f6){var _0x4c9863=_0x7a95f6[_0x13b5('0x60')];var _0x4cd931=![];var _0x47cafb=null;for(_0x47cafb=0x0;_0x47cafb<_0x4c9863[_0x13b5('0x4d')];_0x47cafb++){if(_0x4c9863[_0x47cafb][_0x13b5('0x61')]===_0x39cc5c){_0x4cd931=!![];}}if(_0x4cd931){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x13b5('0x62')});}}})[_0x13b5('0x26')](respondWithResult(_0x30be03,null))['catch'](function(_0x307260){var _0x561b13=_0x3a306d[_0x13b5('0x31')][_0x13b5('0x63')]?0x1f4:_0x307260[_0x13b5('0x64')]||0x1f4;logger[_0x13b5('0x27')](_0x13b5('0x65'),_0x13b5('0x66'),_0x561b13,JSON[_0x13b5('0x67')](_0x307260));delete _0x307260['name'];if(_0x561b13===0x191){_0x561b13=0x190;}_0x30be03[_0x13b5('0x19')](_0x561b13)[_0x13b5('0x29')](_0x3a306d[_0x13b5('0x31')][_0x13b5('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x307260[_0x13b5('0x64')]}:_0x307260);});}; \ No newline at end of file +var _0xeb13=['Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','stringify','test','Wrong\x20credentials','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','then','destroy','error','stack','name','send','index','FreshsalesAccount','rawAttributes','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','findOne','FreshsalesConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0xeb13,0x128));var _0x3eb1=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xeb13[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3eb1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3eb1('0x1'));var moment=require(_0x3eb1('0x2'));var BPromise=require(_0x3eb1('0x3'));var Mustache=require(_0x3eb1('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3eb1('0x5'));var ejs=require(_0x3eb1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3eb1('0x7'));var squel=require(_0x3eb1('0x8'));var crypto=require(_0x3eb1('0x9'));var jsforce=require(_0x3eb1('0xa'));var deskjs=require(_0x3eb1('0xb'));var toCsv=require(_0x3eb1('0x5'));var querystring=require('querystring');var Papa=require(_0x3eb1('0xc'));var Redis=require(_0x3eb1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3eb1('0xe'));var as=require(_0x3eb1('0xf'));var hardwareService=require(_0x3eb1('0x10'));var logger=require('../../config/logger')(_0x3eb1('0x11'));var utils=require(_0x3eb1('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3eb1('0x13'));function respondWithStatusCode(_0x59b65b,_0x2dc794){_0x2dc794=_0x2dc794||0xcc;return function(_0x362b37){if(_0x362b37){return _0x59b65b[_0x3eb1('0x14')](_0x2dc794);}return _0x59b65b[_0x3eb1('0x15')](_0x2dc794)[_0x3eb1('0x16')]();};}function respondWithResult(_0x1d0879,_0x3fd974){_0x3fd974=_0x3fd974||0xc8;return function(_0x75f147){if(_0x75f147){return _0x1d0879['status'](_0x3fd974)['json'](_0x75f147);}};}function respondWithFilteredResult(_0x2f4798,_0x5da39f){return function(_0x44494b){if(_0x44494b){var _0x15f282=typeof _0x5da39f[_0x3eb1('0x17')]===_0x3eb1('0x18')&&typeof _0x5da39f[_0x3eb1('0x19')]===_0x3eb1('0x18');var _0x398781=_0x44494b['count'];var _0x27e821=_0x15f282?0x0:_0x5da39f[_0x3eb1('0x17')];var _0x9bf4af=_0x15f282?_0x44494b[_0x3eb1('0x1a')]:_0x5da39f[_0x3eb1('0x17')]+_0x5da39f[_0x3eb1('0x19')];var _0x5f079f;if(_0x9bf4af>=_0x398781){_0x9bf4af=_0x398781;_0x5f079f=0xc8;}else{_0x5f079f=0xce;}_0x2f4798[_0x3eb1('0x15')](_0x5f079f);return _0x2f4798[_0x3eb1('0x1b')]('Content-Range',_0x27e821+'-'+_0x9bf4af+'/'+_0x398781)[_0x3eb1('0x1c')](_0x44494b);}return null;};}function patchUpdates(_0xbb861d){return function(_0x4a65cd){try{jsonpatch['apply'](_0x4a65cd,_0xbb861d,!![]);}catch(_0x402d01){return BPromise[_0x3eb1('0x1d')](_0x402d01);}return _0x4a65cd['save']();};}function saveUpdates(_0x59933b,_0x508f39){return function(_0x55f2a2){if(_0x55f2a2){return _0x55f2a2['update'](_0x59933b)[_0x3eb1('0x1e')](function(_0x305966){return _0x305966;});}return null;};}function removeEntity(_0x34f728,_0x55ca47){return function(_0x1be1e4){if(_0x1be1e4){return _0x1be1e4[_0x3eb1('0x1f')]()[_0x3eb1('0x1e')](function(){_0x34f728['status'](0xcc)[_0x3eb1('0x16')]();});}};}function handleEntityNotFound(_0x5b7792,_0x350bb2){return function(_0xa3d717){if(!_0xa3d717){_0x5b7792[_0x3eb1('0x14')](0x194);}return _0xa3d717;};}function handleError(_0x391b40,_0x49559c){_0x49559c=_0x49559c||0x1f4;return function(_0x490ba3){logger[_0x3eb1('0x20')](_0x490ba3[_0x3eb1('0x21')]);if(_0x490ba3[_0x3eb1('0x22')]){delete _0x490ba3[_0x3eb1('0x22')];}_0x391b40[_0x3eb1('0x15')](_0x49559c)[_0x3eb1('0x23')](_0x490ba3);};}exports[_0x3eb1('0x24')]=function(_0x4fdcc5,_0x56133d){var _0x1a13e8={},_0x2f0fc8={},_0x4e0948={'count':0x0,'rows':[]};var _0x1fc480=_['map'](db[_0x3eb1('0x25')][_0x3eb1('0x26')],function(_0x220160){return{'name':_0x220160['fieldName'],'type':_0x220160[_0x3eb1('0x27')]['key']};});_0x2f0fc8[_0x3eb1('0x28')]=_[_0x3eb1('0x29')](_0x1fc480,'name');_0x2f0fc8['query']=_[_0x3eb1('0x2a')](_0x4fdcc5[_0x3eb1('0x2b')]);_0x2f0fc8['filters']=_[_0x3eb1('0x2c')](_0x2f0fc8[_0x3eb1('0x28')],_0x2f0fc8[_0x3eb1('0x2b')]);_0x1a13e8[_0x3eb1('0x2d')]=_[_0x3eb1('0x2c')](_0x2f0fc8[_0x3eb1('0x28')],qs[_0x3eb1('0x2e')](_0x4fdcc5[_0x3eb1('0x2b')][_0x3eb1('0x2e')]));_0x1a13e8[_0x3eb1('0x2d')]=_0x1a13e8[_0x3eb1('0x2d')][_0x3eb1('0x2f')]?_0x1a13e8[_0x3eb1('0x2d')]:_0x2f0fc8[_0x3eb1('0x28')];if(!_0x4fdcc5['query'][_0x3eb1('0x30')](_0x3eb1('0x31'))){_0x1a13e8[_0x3eb1('0x19')]=qs[_0x3eb1('0x19')](_0x4fdcc5[_0x3eb1('0x2b')]['limit']);_0x1a13e8[_0x3eb1('0x17')]=qs[_0x3eb1('0x17')](_0x4fdcc5[_0x3eb1('0x2b')]['offset']);}_0x1a13e8[_0x3eb1('0x32')]=qs[_0x3eb1('0x33')](_0x4fdcc5[_0x3eb1('0x2b')]['sort']);_0x1a13e8[_0x3eb1('0x34')]=qs[_0x3eb1('0x35')](_['pick'](_0x4fdcc5['query'],_0x2f0fc8['filters']),_0x1fc480);if(_0x4fdcc5[_0x3eb1('0x2b')][_0x3eb1('0x36')]){_0x1a13e8[_0x3eb1('0x34')]=_[_0x3eb1('0x37')](_0x1a13e8[_0x3eb1('0x34')],{'$or':_[_0x3eb1('0x29')](_0x1fc480,function(_0x34023a){if(_0x34023a[_0x3eb1('0x27')]!==_0x3eb1('0x38')){var _0x128ebd={};_0x128ebd[_0x34023a[_0x3eb1('0x22')]]={'$like':'%'+_0x4fdcc5[_0x3eb1('0x2b')][_0x3eb1('0x36')]+'%'};return _0x128ebd;}})});}_0x1a13e8=_[_0x3eb1('0x37')]({},_0x1a13e8,_0x4fdcc5[_0x3eb1('0x39')]);var _0x25f384={'where':_0x1a13e8[_0x3eb1('0x34')]};return db[_0x3eb1('0x25')]['count'](_0x25f384)[_0x3eb1('0x1e')](function(_0x2f9a9f){_0x4e0948[_0x3eb1('0x1a')]=_0x2f9a9f;if(_0x4fdcc5[_0x3eb1('0x2b')][_0x3eb1('0x3a')]){_0x1a13e8['include']=[{'all':!![]}];}return db[_0x3eb1('0x25')][_0x3eb1('0x3b')](_0x1a13e8);})[_0x3eb1('0x1e')](function(_0x5e0b02){_0x4e0948[_0x3eb1('0x3c')]=_0x5e0b02;return _0x4e0948;})[_0x3eb1('0x1e')](respondWithFilteredResult(_0x56133d,_0x1a13e8))['catch'](handleError(_0x56133d,null));};exports[_0x3eb1('0x3d')]=function(_0x2306ee,_0x44f982){var _0x3054ae={'raw':![],'where':{'id':_0x2306ee[_0x3eb1('0x3e')]['id']}},_0xdbed4d={};_0xdbed4d[_0x3eb1('0x28')]=_[_0x3eb1('0x2a')](db[_0x3eb1('0x25')]['rawAttributes']);_0xdbed4d[_0x3eb1('0x2b')]=_[_0x3eb1('0x2a')](_0x2306ee[_0x3eb1('0x2b')]);_0xdbed4d[_0x3eb1('0x35')]=_[_0x3eb1('0x2c')](_0xdbed4d[_0x3eb1('0x28')],_0xdbed4d[_0x3eb1('0x2b')]);_0x3054ae['attributes']=_[_0x3eb1('0x2c')](_0xdbed4d[_0x3eb1('0x28')],qs[_0x3eb1('0x2e')](_0x2306ee[_0x3eb1('0x2b')][_0x3eb1('0x2e')]));_0x3054ae['attributes']=_0x3054ae['attributes'][_0x3eb1('0x2f')]?_0x3054ae[_0x3eb1('0x2d')]:_0xdbed4d[_0x3eb1('0x28')];if(_0x2306ee[_0x3eb1('0x2b')][_0x3eb1('0x3a')]){_0x3054ae[_0x3eb1('0x3f')]=[{'all':!![]}];}_0x3054ae=_[_0x3eb1('0x37')]({},_0x3054ae,_0x2306ee[_0x3eb1('0x39')]);return db[_0x3eb1('0x25')][_0x3eb1('0x40')](_0x3054ae)[_0x3eb1('0x1e')](handleEntityNotFound(_0x44f982,null))[_0x3eb1('0x1e')](respondWithResult(_0x44f982,null))[_0x3eb1('0x41')](handleError(_0x44f982,null));};exports[_0x3eb1('0x42')]=function(_0xce5186,_0x237ab0){return db[_0x3eb1('0x25')][_0x3eb1('0x42')](_0xce5186[_0x3eb1('0x43')],{})['then'](respondWithResult(_0x237ab0,0xc9))['catch'](handleError(_0x237ab0,null));};exports['update']=function(_0x4d6786,_0x356906){if(_0x4d6786[_0x3eb1('0x43')]['id']){delete _0x4d6786[_0x3eb1('0x43')]['id'];}return db['FreshsalesAccount'][_0x3eb1('0x40')]({'where':{'id':_0x4d6786[_0x3eb1('0x3e')]['id']}})[_0x3eb1('0x1e')](handleEntityNotFound(_0x356906,null))['then'](saveUpdates(_0x4d6786['body'],null))[_0x3eb1('0x1e')](respondWithResult(_0x356906,null))[_0x3eb1('0x41')](handleError(_0x356906,null));};exports[_0x3eb1('0x1f')]=function(_0x320d70,_0x4c6f26){return db[_0x3eb1('0x25')]['find']({'where':{'id':_0x320d70['params']['id']}})[_0x3eb1('0x1e')](handleEntityNotFound(_0x4c6f26,null))[_0x3eb1('0x1e')](removeEntity(_0x4c6f26,null))[_0x3eb1('0x41')](handleError(_0x4c6f26,null));};exports['getConfigurations']=function(_0x1e8d73,_0x4f84ae,_0x52f5f7){var _0x1264f1={};var _0x5c64fa={};var _0x4bb0ae;var _0x44b1b1;return db[_0x3eb1('0x25')][_0x3eb1('0x44')]({'where':{'id':_0x1e8d73[_0x3eb1('0x3e')]['id']}})[_0x3eb1('0x1e')](handleEntityNotFound(_0x4f84ae,null))[_0x3eb1('0x1e')](function(_0xd554c2){if(_0xd554c2){_0x4bb0ae=_0xd554c2;_0x5c64fa['model']=_['keys'](db[_0x3eb1('0x45')][_0x3eb1('0x26')]);_0x5c64fa[_0x3eb1('0x2b')]=_['keys'](_0x1e8d73['query']);_0x5c64fa['filters']=_[_0x3eb1('0x2c')](_0x5c64fa[_0x3eb1('0x28')],_0x5c64fa[_0x3eb1('0x2b')]);_0x1264f1[_0x3eb1('0x2d')]=_[_0x3eb1('0x2c')](_0x5c64fa['model'],qs[_0x3eb1('0x2e')](_0x1e8d73[_0x3eb1('0x2b')][_0x3eb1('0x2e')]));_0x1264f1['attributes']=_0x1264f1[_0x3eb1('0x2d')][_0x3eb1('0x2f')]?_0x1264f1[_0x3eb1('0x2d')]:_0x5c64fa[_0x3eb1('0x28')];_0x1264f1[_0x3eb1('0x32')]=qs['sort'](_0x1e8d73[_0x3eb1('0x2b')][_0x3eb1('0x33')]);_0x1264f1['where']=qs[_0x3eb1('0x35')](_[_0x3eb1('0x46')](_0x1e8d73[_0x3eb1('0x2b')],_0x5c64fa[_0x3eb1('0x35')]));if(_0x1e8d73['query'][_0x3eb1('0x36')]){_0x1264f1['where']=_['merge'](_0x1264f1['where'],{'$or':_[_0x3eb1('0x29')](_0x1264f1['attributes'],function(_0x2c781f){var _0x229297={};_0x229297[_0x2c781f]={'$like':'%'+_0x1e8d73[_0x3eb1('0x2b')]['filter']+'%'};return _0x229297;})});}_0x1264f1=_[_0x3eb1('0x37')]({},_0x1264f1,_0x1e8d73['options']);return _0x4bb0ae[_0x3eb1('0x47')](_0x1264f1);}})[_0x3eb1('0x1e')](function(_0x6f334){if(_0x6f334){_0x44b1b1=_0x6f334[_0x3eb1('0x2f')];if(!_0x1e8d73[_0x3eb1('0x2b')][_0x3eb1('0x30')](_0x3eb1('0x31'))){_0x1264f1[_0x3eb1('0x19')]=qs[_0x3eb1('0x19')](_0x1e8d73[_0x3eb1('0x2b')][_0x3eb1('0x19')]);_0x1264f1[_0x3eb1('0x17')]=qs[_0x3eb1('0x17')](_0x1e8d73[_0x3eb1('0x2b')][_0x3eb1('0x17')]);}return _0x4bb0ae[_0x3eb1('0x47')](_0x1264f1);}})[_0x3eb1('0x1e')](function(_0x39481e){if(_0x39481e){return _0x39481e?{'count':_0x44b1b1,'rows':_0x39481e}:null;}})[_0x3eb1('0x1e')](respondWithResult(_0x4f84ae,null))['catch'](handleError(_0x4f84ae,null));};exports[_0x3eb1('0x48')]=function(_0x3cbbed,_0x2f7fea,_0x2e55a2){if(_0x3cbbed[_0x3eb1('0x43')]['id']){delete _0x3cbbed[_0x3eb1('0x43')]['id'];}return db['FreshsalesAccount'][_0x3eb1('0x44')]({'where':{'id':_0x3cbbed['params']['id']}})[_0x3eb1('0x1e')](handleEntityNotFound(_0x2f7fea,null))[_0x3eb1('0x1e')](function(_0x2fa0b5){if(_0x2fa0b5){_0x3cbbed[_0x3eb1('0x43')][_0x3eb1('0x49')]=_0x2fa0b5['id'];_0x3cbbed[_0x3eb1('0x43')][_0x3eb1('0x4a')]=integrations['getSubjects'](_0x3cbbed['body'][_0x3eb1('0x4b')],_0x3cbbed[_0x3eb1('0x43')][_0x3eb1('0x27')]);_0x3cbbed[_0x3eb1('0x43')][_0x3eb1('0x4c')]=integrations['getDescriptions'](_0x3cbbed['body'][_0x3eb1('0x4b')],_0x3cbbed[_0x3eb1('0x43')]['type']);return db['FreshsalesConfiguration'][_0x3eb1('0x42')](_0x3cbbed[_0x3eb1('0x43')],{'include':[{'model':db[_0x3eb1('0x4d')],'as':_0x3eb1('0x4a')},{'model':db[_0x3eb1('0x4d')],'as':_0x3eb1('0x4c')}]});}return null;})[_0x3eb1('0x1e')](respondWithResult(_0x2f7fea,null))[_0x3eb1('0x41')](handleError(_0x2f7fea,null));};exports[_0x3eb1('0x4e')]=function(_0x35dbdf,_0x512d1e,_0x2b2de7){var _0x1225da='';var _0x4bdb06='';return db[_0x3eb1('0x25')][_0x3eb1('0x44')]({'where':{'id':_0x35dbdf[_0x3eb1('0x3e')]['id']},'attributes':['id',_0x3eb1('0x4f'),_0x3eb1('0x50'),_0x3eb1('0x51')]})[_0x3eb1('0x1e')](handleEntityNotFound(_0x512d1e,null))['then'](function(_0x2abf43){if(_0x2abf43){_0x4bdb06=_0x2abf43[_0x3eb1('0x4f')];_0x1225da=_0x2abf43[_0x3eb1('0x50')];var _0x3fb8e6=_0x2abf43[_0x3eb1('0x50')][_0x3eb1('0x52')](-0x1);if(_0x3fb8e6==='/'){_0x1225da=_0x1225da[_0x3eb1('0x53')](0x0,_0x1225da[_0x3eb1('0x54')](_0x3fb8e6));}return rp({'method':_0x3eb1('0x55'),'uri':util[_0x3eb1('0x56')](_0x3eb1('0x57'),_0x1225da,'/api/selector/owners'),'headers':{'Authorization':_0x3eb1('0x58')+_0x2abf43[_0x3eb1('0x51')]},'json':!![]});}})[_0x3eb1('0x1e')](function(_0x5ab3bd){if(_0x5ab3bd){var _0x59f442=_0x5ab3bd[_0x3eb1('0x59')];var _0x533e48=![];var _0x4a0771=null;for(_0x4a0771=0x0;_0x4a0771<_0x59f442[_0x3eb1('0x2f')];_0x4a0771++){if(_0x59f442[_0x4a0771][_0x3eb1('0x5a')]===_0x4bdb06){_0x533e48=!![];}}if(_0x533e48){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3eb1('0x5b')});}}})['then'](respondWithResult(_0x512d1e,null))[_0x3eb1('0x41')](function(_0x5490f1){var _0x19cb72=_0x35dbdf[_0x3eb1('0x2b')]['test']?0x1f4:_0x5490f1[_0x3eb1('0x5c')]||0x1f4;logger[_0x3eb1('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x19cb72,JSON[_0x3eb1('0x5d')](_0x5490f1));delete _0x5490f1[_0x3eb1('0x22')];if(_0x19cb72===0x191){_0x19cb72=0x190;}_0x512d1e[_0x3eb1('0x15')](_0x19cb72)[_0x3eb1('0x23')](_0x35dbdf[_0x3eb1('0x2b')][_0x3eb1('0x5e')]?{'message':_0x3eb1('0x5f'),'statusCode':_0x5490f1[_0x3eb1('0x5c')]}:_0x5490f1);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f210fa3..cf83fe5 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 _0x3a6d=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util'];(function(_0x47cd84,_0x3056b9){var _0x800299=function(_0x7a34ba){while(--_0x7a34ba){_0x47cd84['push'](_0x47cd84['shift']());}};_0x800299(++_0x3056b9);}(_0x3a6d,0x143));var _0xd3a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3a6d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));var integrations=require(_0xd3a6('0x9'));module[_0xd3a6('0xa')]=function(_0x25b042,_0x282cb1){return _0x25b042['define'](_0xd3a6('0xb'),attributes,{'tableName':_0xd3a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47c5=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1a8e59,_0x57d8d4){var _0x53e7b0=function(_0xe7bb94){while(--_0xe7bb94){_0x1a8e59['push'](_0x1a8e59['shift']());}};_0x53e7b0(++_0x57d8d4);}(_0x47c5,0x165));var _0x547c=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0x47c5[_0x30a457];return _0x2ae5cd;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));var integrations=require(_0x547c('0x9'));module['exports']=function(_0x2e5b57,_0x439f25){return _0x2e5b57[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 558315d..b76edc2 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 _0x47c5=['include','model','attributes','map','GetFreshsalesAccount','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw'];(function(_0x410a1b,_0x21190b){var _0x221d07=function(_0x2ea1ce){while(--_0x2ea1ce){_0x410a1b['push'](_0x410a1b['shift']());}};_0x221d07(++_0x21190b);}(_0x47c5,0x165));var _0x547c=function(_0x3f1937,_0x37d49c){_0x3f1937=_0x3f1937-0x0;var _0x46733e=_0x47c5[_0x3f1937];return _0x46733e;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['GetFreshsalesAccount']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')]({'raw':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options'][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options']['where']||null:null,'attributes':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['attributes']||null:null,'limit':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['limit']||null:null,'include':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')]?_['map'](_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')],function(_0x470694){return{'model':db[_0x470694[_0x547c('0x1d')]],'as':_0x470694['as'],'attributes':_0x470694[_0x547c('0x1e')],'include':_0x470694[_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x470694[_0x547c('0x1c')],function(_0x507895){return{'model':db[_0x507895[_0x547c('0x1d')]],'as':_0x507895['as'],'attributes':_0x507895['attributes'],'include':_0x507895['include']?_['map'](_0x507895['include'],function(_0x2c725d){return{'model':db[_0x2c725d['model']],'as':_0x2c725d['as'],'attributes':_0x2c725d[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea493){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x3ea493));_0xeb059e(_0x3ea493);})[_0x547c('0x17')](function(_0x569924){logger['error'](_0x547c('0x20'),_0x569924['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x569924[_0x547c('0x15')]));});});};exports[_0x547c('0x21')]=function(_0x1695be){var _0x4652e7=this;return new Promise(function(_0x51e6e7,_0x342c10){return db['FreshsalesAccount']['find']({'raw':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x22')]||null:null,'attributes':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1e')]||null:null,'include':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x1695be[_0x547c('0x1a')]['include'],function(_0x3afc28){return{'model':db[_0x3afc28['model']],'as':_0x3afc28['as'],'attributes':_0x3afc28['attributes'],'include':_0x3afc28['include']?_[_0x547c('0x1f')](_0x3afc28[_0x547c('0x1c')],function(_0x31c7d3){return{'model':db[_0x31c7d3[_0x547c('0x1d')]],'as':_0x31c7d3['as'],'attributes':_0x31c7d3[_0x547c('0x1e')],'include':_0x31c7d3[_0x547c('0x1c')]?_['map'](_0x31c7d3['include'],function(_0x5ea2c7){return{'model':db[_0x5ea2c7[_0x547c('0x1d')]],'as':_0x5ea2c7['as'],'attributes':_0x5ea2c7[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x547c('0xc')](function(_0x44687e){logger[_0x547c('0xd')](_0x547c('0x21'),_0x1695be);logger['debug'](_0x547c('0x21'),_0x1695be,JSON['stringify'](_0x44687e));_0x51e6e7(_0x44687e);})[_0x547c('0x17')](function(_0x18fcc5){logger['error'](_0x547c('0x21'),_0x18fcc5['message'],_0x1695be);_0x342c10(_0x4652e7['error'](0x1f4,_0x18fcc5[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0x0adf=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshsalesAccount','find','raw','ShowFreshsalesAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x557701,_0x180f95){var _0x4c6d09=function(_0x241b67){while(--_0x241b67){_0x557701['push'](_0x557701['shift']());}};_0x4c6d09(++_0x180f95);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x155a4f,_0x2a93cc){_0x155a4f=_0x155a4f-0x0;var _0x2ea908=_0x0adf[_0x155a4f];return _0x2ea908;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['GetFreshsalesAccount']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')]({'raw':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1b')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'limit':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970['options'][_0xf0ad('0x1d')]||null:null,'include':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')],function(_0x276322){return{'model':db[_0x276322[_0xf0ad('0x20')]],'as':_0x276322['as'],'attributes':_0x276322[_0xf0ad('0x1c')],'include':_0x276322[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x276322[_0xf0ad('0x1e')],function(_0x456f81){return{'model':db[_0x456f81[_0xf0ad('0x20')]],'as':_0x456f81['as'],'attributes':_0x456f81['attributes'],'include':_0x456f81[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x456f81[_0xf0ad('0x1e')],function(_0x7377d7){return{'model':db[_0x7377d7[_0xf0ad('0x20')]],'as':_0x7377d7['as'],'attributes':_0x7377d7[_0xf0ad('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cbe00){logger[_0xf0ad('0xd')](_0xf0ad('0x21'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x21'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x2cbe00));_0x46fb20(_0x2cbe00);})[_0xf0ad('0x17')](function(_0x1bee71){logger[_0xf0ad('0x13')](_0xf0ad('0x21'),_0x1bee71[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8['error'](0x1f4,_0x1bee71[_0xf0ad('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x83f211){var _0x57a1f3=this;return new Promise(function(_0x25ed0b,_0x320174){return db[_0xf0ad('0x18')][_0xf0ad('0x22')]({'raw':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x23')]===undefined?!![]:![]:!![],'where':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options']['where']||null:null,'attributes':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'include':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options'][_0xf0ad('0x1e')]?_['map'](_0x83f211[_0xf0ad('0x1a')]['include'],function(_0x4136b9){return{'model':db[_0x4136b9['model']],'as':_0x4136b9['as'],'attributes':_0x4136b9[_0xf0ad('0x1c')],'include':_0x4136b9[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4136b9[_0xf0ad('0x1e')],function(_0x42f87f){return{'model':db[_0x42f87f[_0xf0ad('0x20')]],'as':_0x42f87f['as'],'attributes':_0x42f87f[_0xf0ad('0x1c')],'include':_0x42f87f[_0xf0ad('0x1e')]?_['map'](_0x42f87f[_0xf0ad('0x1e')],function(_0x54b59d){return{'model':db[_0x54b59d[_0xf0ad('0x20')]],'as':_0x54b59d['as'],'attributes':_0x54b59d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0ad('0xc')](function(_0x25246b){logger[_0xf0ad('0xd')](_0xf0ad('0x24'),_0x83f211);logger[_0xf0ad('0xf')]('ShowFreshsalesAccount',_0x83f211,JSON[_0xf0ad('0x11')](_0x25246b));_0x25ed0b(_0x25246b);})[_0xf0ad('0x17')](function(_0x1d57d1){logger[_0xf0ad('0x13')](_0xf0ad('0x24'),_0x1d57d1[_0xf0ad('0x15')],_0x83f211);_0x320174(_0x57a1f3[_0xf0ad('0x13')](0x1f4,_0x1d57d1['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index ca8964e..7365b80 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 _0x0c57=['isAuthenticated','get','/:id','show','/:id/subjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x0c57,0xc2));var _0x70c5=function(_0x2882b4,_0x1c025d){_0x2882b4=_0x2882b4-0x0;var _0x4654da=_0x0c57[_0x2882b4];return _0x4654da;};'use strict';var multer=require(_0x70c5('0x0'));var util=require(_0x70c5('0x1'));var path=require('path');var timeout=require(_0x70c5('0x2'));var express=require(_0x70c5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x70c5('0x4'));var interaction=require(_0x70c5('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x70c5('0x6')](),controller['index']);router[_0x70c5('0x7')](_0x70c5('0x8'),auth[_0x70c5('0x6')](),controller[_0x70c5('0x9')]);router['get'](_0x70c5('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x70c5('0xb'),auth[_0x70c5('0x6')](),controller['getDescriptions']);router[_0x70c5('0x7')](_0x70c5('0xc'),auth[_0x70c5('0x6')](),controller[_0x70c5('0xd')]);router[_0x70c5('0xe')]('/',auth[_0x70c5('0x6')](),controller[_0x70c5('0xf')]);router[_0x70c5('0x10')](_0x70c5('0x8'),auth['isAuthenticated'](),controller[_0x70c5('0x11')]);router['delete'](_0x70c5('0x8'),auth['isAuthenticated'](),controller[_0x70c5('0x12')]);module[_0x70c5('0x13')]=router; \ No newline at end of file +var _0x7623=['../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7623,0xea));var _0x3762=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x7623[_0x270a54];return _0x4d07d0;};'use strict';var multer=require(_0x3762('0x0'));var util=require(_0x3762('0x1'));var path=require(_0x3762('0x2'));var timeout=require(_0x3762('0x3'));var express=require(_0x3762('0x4'));var router=express[_0x3762('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3762('0x6'));var interaction=require(_0x3762('0x7'));var config=require('../../config/environment');var controller=require(_0x3762('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3762('0x9')]);router[_0x3762('0xa')](_0x3762('0xb'),auth[_0x3762('0xc')](),controller[_0x3762('0xd')]);router[_0x3762('0xa')](_0x3762('0xe'),auth[_0x3762('0xc')](),controller[_0x3762('0xf')]);router[_0x3762('0xa')]('/:id/descriptions',auth[_0x3762('0xc')](),controller['getDescriptions']);router['get']('/:id/fields',auth[_0x3762('0xc')](),controller[_0x3762('0x10')]);router[_0x3762('0x11')]('/',auth[_0x3762('0xc')](),controller[_0x3762('0x12')]);router[_0x3762('0x13')](_0x3762('0xb'),auth[_0x3762('0xc')](),controller[_0x3762('0x14')]);router[_0x3762('0x15')](_0x3762('0xb'),auth[_0x3762('0xc')](),controller[_0x3762('0x16')]);module[_0x3762('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index f252057..c187201 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 _0x8722=['sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8722,0x1dc));var _0x2872=function(_0x24ec3a,_0xdb9c02){_0x24ec3a=_0x24ec3a-0x0;var _0x37f3f6=_0x8722[_0x24ec3a];return _0x37f3f6;};'use strict';var Sequelize=require(_0x2872('0x0'));module[_0x2872('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5e69=['STRING','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e69,0x8b));var _0x95e6=function(_0x40632e,_0x1f7f8f){_0x40632e=_0x40632e-0x0;var _0x3708c4=_0x5e69[_0x40632e];return _0x3708c4;};'use strict';var Sequelize=require('sequelize');module[_0x95e6('0x0')]={'name':{'type':Sequelize[_0x95e6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 2cf5706..a5ae0bc 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 _0xab1d=['../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','FreshsalesConfiguration','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','rows','catch','show','params','include','create','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','rawAttributes','options','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','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'];(function(_0x35866c,_0x45e9d3){var _0x29627f=function(_0x17219b){while(--_0x17219b){_0x35866c['push'](_0x35866c['shift']());}};_0x29627f(++_0x45e9d3);}(_0xab1d,0x130));var _0xdab1=function(_0xdda7b8,_0x56ab44){_0xdda7b8=_0xdda7b8-0x0;var _0x3a8c68=_0xab1d[_0xdda7b8];return _0x3a8c68;};'use strict';var emlformat=require(_0xdab1('0x0'));var rimraf=require(_0xdab1('0x1'));var zipdir=require(_0xdab1('0x2'));var jsonpatch=require(_0xdab1('0x3'));var rp=require('request-promise');var moment=require(_0xdab1('0x4'));var BPromise=require(_0xdab1('0x5'));var Mustache=require('mustache');var util=require(_0xdab1('0x6'));var path=require('path');var sox=require(_0xdab1('0x7'));var csv=require(_0xdab1('0x8'));var ejs=require(_0xdab1('0x9'));var fs=require('fs');var fs_extra=require(_0xdab1('0xa'));var _=require(_0xdab1('0xb'));var squel=require(_0xdab1('0xc'));var crypto=require(_0xdab1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdab1('0xe'));var toCsv=require(_0xdab1('0x8'));var querystring=require('querystring');var Papa=require(_0xdab1('0xf'));var Redis=require('ioredis');var authService=require(_0xdab1('0x10'));var qs=require(_0xdab1('0x11'));var as=require(_0xdab1('0x12'));var hardwareService=require(_0xdab1('0x13'));var logger=require(_0xdab1('0x14'))('api');var utils=require(_0xdab1('0x15'));var config=require(_0xdab1('0x16'));var licenseUtil=require(_0xdab1('0x17'));var db=require(_0xdab1('0x18'))['db'];function respondWithStatusCode(_0x4131aa,_0x3d344c){_0x3d344c=_0x3d344c||0xcc;return function(_0x3f8315){if(_0x3f8315){return _0x4131aa[_0xdab1('0x19')](_0x3d344c);}return _0x4131aa[_0xdab1('0x1a')](_0x3d344c)[_0xdab1('0x1b')]();};}function respondWithResult(_0x30d9ff,_0x524dca){_0x524dca=_0x524dca||0xc8;return function(_0x1807c5){if(_0x1807c5){return _0x30d9ff[_0xdab1('0x1a')](_0x524dca)[_0xdab1('0x1c')](_0x1807c5);}};}function respondWithFilteredResult(_0x20d936,_0x26bfc0){return function(_0x3c4bb4){if(_0x3c4bb4){var _0x3eee82=typeof _0x26bfc0['offset']===_0xdab1('0x1d')&&typeof _0x26bfc0['limit']===_0xdab1('0x1d');var _0x2bffb0=_0x3c4bb4[_0xdab1('0x1e')];var _0x1af49d=_0x3eee82?0x0:_0x26bfc0[_0xdab1('0x1f')];var _0x416543=_0x3eee82?_0x3c4bb4['count']:_0x26bfc0['offset']+_0x26bfc0[_0xdab1('0x20')];var _0xe234e0;if(_0x416543>=_0x2bffb0){_0x416543=_0x2bffb0;_0xe234e0=0xc8;}else{_0xe234e0=0xce;}_0x20d936['status'](_0xe234e0);return _0x20d936[_0xdab1('0x21')](_0xdab1('0x22'),_0x1af49d+'-'+_0x416543+'/'+_0x2bffb0)[_0xdab1('0x1c')](_0x3c4bb4);}return null;};}function patchUpdates(_0x2b1926){return function(_0x2a8173){try{jsonpatch[_0xdab1('0x23')](_0x2a8173,_0x2b1926,!![]);}catch(_0x19b174){return BPromise[_0xdab1('0x24')](_0x19b174);}return _0x2a8173['save']();};}function saveUpdates(_0x3b7b1f,_0x58b731){return function(_0x48dd4d){if(_0x48dd4d){return _0x48dd4d[_0xdab1('0x25')](_0x3b7b1f)['then'](function(_0x23fe9e){return _0x23fe9e;});}return null;};}function removeEntity(_0x138b73,_0x221956){return function(_0x39e404){if(_0x39e404){return _0x39e404[_0xdab1('0x26')]()[_0xdab1('0x27')](function(){_0x138b73[_0xdab1('0x1a')](0xcc)[_0xdab1('0x1b')]();});}};}function handleEntityNotFound(_0x1d2904,_0xac31fd){return function(_0x149850){if(!_0x149850){_0x1d2904['sendStatus'](0x194);}return _0x149850;};}function handleError(_0x537587,_0x5648e2){_0x5648e2=_0x5648e2||0x1f4;return function(_0x415ed2){logger[_0xdab1('0x28')](_0x415ed2[_0xdab1('0x29')]);if(_0x415ed2[_0xdab1('0x2a')]){delete _0x415ed2[_0xdab1('0x2a')];}_0x537587[_0xdab1('0x1a')](_0x5648e2)[_0xdab1('0x2b')](_0x415ed2);};}exports[_0xdab1('0x2c')]=function(_0x125fb7,_0x28f8dd){var _0x21ab6a={},_0x9e093e={},_0x234d3b={'count':0x0,'rows':[]};var _0x2f9d27=_['map'](db[_0xdab1('0x2d')]['rawAttributes'],function(_0x14ed9d){return{'name':_0x14ed9d[_0xdab1('0x2e')],'type':_0x14ed9d['type'][_0xdab1('0x2f')]};});_0x9e093e[_0xdab1('0x30')]=_[_0xdab1('0x31')](_0x2f9d27,_0xdab1('0x2a'));_0x9e093e[_0xdab1('0x32')]=_[_0xdab1('0x33')](_0x125fb7[_0xdab1('0x32')]);_0x9e093e[_0xdab1('0x34')]=_[_0xdab1('0x35')](_0x9e093e[_0xdab1('0x30')],_0x9e093e[_0xdab1('0x32')]);_0x21ab6a[_0xdab1('0x36')]=_[_0xdab1('0x35')](_0x9e093e[_0xdab1('0x30')],qs[_0xdab1('0x37')](_0x125fb7[_0xdab1('0x32')][_0xdab1('0x37')]));_0x21ab6a['attributes']=_0x21ab6a[_0xdab1('0x36')][_0xdab1('0x38')]?_0x21ab6a[_0xdab1('0x36')]:_0x9e093e[_0xdab1('0x30')];if(!_0x125fb7[_0xdab1('0x32')][_0xdab1('0x39')](_0xdab1('0x3a'))){_0x21ab6a['limit']=qs[_0xdab1('0x20')](_0x125fb7[_0xdab1('0x32')][_0xdab1('0x20')]);_0x21ab6a[_0xdab1('0x1f')]=qs[_0xdab1('0x1f')](_0x125fb7[_0xdab1('0x32')]['offset']);}_0x21ab6a[_0xdab1('0x3b')]=qs[_0xdab1('0x3c')](_0x125fb7[_0xdab1('0x32')][_0xdab1('0x3c')]);_0x21ab6a[_0xdab1('0x3d')]=qs[_0xdab1('0x34')](_[_0xdab1('0x3e')](_0x125fb7[_0xdab1('0x32')],_0x9e093e[_0xdab1('0x34')]),_0x2f9d27);if(_0x125fb7['query'][_0xdab1('0x3f')]){_0x21ab6a[_0xdab1('0x3d')]=_[_0xdab1('0x40')](_0x21ab6a['where'],{'$or':_[_0xdab1('0x31')](_0x2f9d27,function(_0x4a9605){if(_0x4a9605[_0xdab1('0x41')]!=='VIRTUAL'){var _0x2682bf={};_0x2682bf[_0x4a9605['name']]={'$like':'%'+_0x125fb7[_0xdab1('0x32')]['filter']+'%'};return _0x2682bf;}})});}_0x21ab6a=_[_0xdab1('0x40')]({},_0x21ab6a,_0x125fb7['options']);var _0x2ac3f5={'where':_0x21ab6a['where']};return db['FreshsalesConfiguration']['count'](_0x2ac3f5)[_0xdab1('0x27')](function(_0x109c71){_0x234d3b[_0xdab1('0x1e')]=_0x109c71;if(_0x125fb7[_0xdab1('0x32')][_0xdab1('0x42')]){_0x21ab6a['include']=[{'all':!![]}];}return db[_0xdab1('0x2d')]['findAll'](_0x21ab6a);})['then'](function(_0x56b46a){_0x234d3b[_0xdab1('0x43')]=_0x56b46a;return _0x234d3b;})[_0xdab1('0x27')](respondWithFilteredResult(_0x28f8dd,_0x21ab6a))[_0xdab1('0x44')](handleError(_0x28f8dd,null));};exports[_0xdab1('0x45')]=function(_0x41ad70,_0x337453){var _0x178266={'raw':![],'where':{'id':_0x41ad70[_0xdab1('0x46')]['id']}},_0x14c826={};_0x14c826[_0xdab1('0x30')]=_[_0xdab1('0x33')](db[_0xdab1('0x2d')]['rawAttributes']);_0x14c826[_0xdab1('0x32')]=_[_0xdab1('0x33')](_0x41ad70['query']);_0x14c826[_0xdab1('0x34')]=_[_0xdab1('0x35')](_0x14c826[_0xdab1('0x30')],_0x14c826[_0xdab1('0x32')]);_0x178266[_0xdab1('0x36')]=_['intersection'](_0x14c826['model'],qs[_0xdab1('0x37')](_0x41ad70[_0xdab1('0x32')][_0xdab1('0x37')]));_0x178266[_0xdab1('0x36')]=_0x178266[_0xdab1('0x36')]['length']?_0x178266['attributes']:_0x14c826[_0xdab1('0x30')];if(_0x41ad70[_0xdab1('0x32')][_0xdab1('0x42')]){_0x178266[_0xdab1('0x47')]=[{'all':!![]}];}_0x178266=_['merge']({},_0x178266,_0x41ad70['options']);return db[_0xdab1('0x2d')]['find'](_0x178266)['then'](handleEntityNotFound(_0x337453,null))[_0xdab1('0x27')](respondWithResult(_0x337453,null))[_0xdab1('0x44')](handleError(_0x337453,null));};exports[_0xdab1('0x48')]=function(_0x3973d5,_0x9b4aec){return db[_0xdab1('0x2d')][_0xdab1('0x48')](_0x3973d5[_0xdab1('0x49')],{})[_0xdab1('0x27')](respondWithResult(_0x9b4aec,0xc9))[_0xdab1('0x44')](handleError(_0x9b4aec,null));};exports[_0xdab1('0x25')]=function(_0x344c0f,_0x3459dd){if(_0x344c0f[_0xdab1('0x49')]['id']){delete _0x344c0f[_0xdab1('0x49')]['id'];}return db[_0xdab1('0x2d')][_0xdab1('0x4a')]({'where':{'id':_0x344c0f[_0xdab1('0x46')]['id']}})['then'](handleEntityNotFound(_0x3459dd,null))['then'](saveUpdates(_0x344c0f[_0xdab1('0x49')],null))[_0xdab1('0x27')](respondWithResult(_0x3459dd,null))[_0xdab1('0x44')](handleError(_0x3459dd,null));};exports[_0xdab1('0x26')]=function(_0x15b125,_0x47723e){return db['FreshsalesConfiguration'][_0xdab1('0x4a')]({'where':{'id':_0x15b125['params']['id']}})[_0xdab1('0x27')](handleEntityNotFound(_0x47723e,null))[_0xdab1('0x27')](removeEntity(_0x47723e,null))['catch'](handleError(_0x47723e,null));};exports[_0xdab1('0x4b')]=function(_0x16d4bf,_0x446163,_0x229c88){var _0x3fc49c={};var _0x74f6f={};var _0x5612e8;var _0x173c02;return db[_0xdab1('0x2d')][_0xdab1('0x4c')]({'where':{'id':_0x16d4bf['params']['id']}})['then'](handleEntityNotFound(_0x446163,null))[_0xdab1('0x27')](function(_0x2bb867){if(_0x2bb867){_0x5612e8=_0x2bb867;_0x74f6f[_0xdab1('0x30')]=_[_0xdab1('0x33')](db[_0xdab1('0x4d')]['rawAttributes']);_0x74f6f['query']=_[_0xdab1('0x33')](_0x16d4bf[_0xdab1('0x32')]);_0x74f6f['filters']=_[_0xdab1('0x35')](_0x74f6f[_0xdab1('0x30')],_0x74f6f[_0xdab1('0x32')]);_0x3fc49c[_0xdab1('0x36')]=_[_0xdab1('0x35')](_0x74f6f[_0xdab1('0x30')],qs[_0xdab1('0x37')](_0x16d4bf[_0xdab1('0x32')][_0xdab1('0x37')]));_0x3fc49c[_0xdab1('0x36')]=_0x3fc49c[_0xdab1('0x36')][_0xdab1('0x38')]?_0x3fc49c['attributes']:_0x74f6f[_0xdab1('0x30')];_0x3fc49c[_0xdab1('0x3b')]=qs['sort'](_0x16d4bf[_0xdab1('0x32')][_0xdab1('0x3c')]);_0x3fc49c[_0xdab1('0x3d')]=qs[_0xdab1('0x34')](_[_0xdab1('0x3e')](_0x16d4bf[_0xdab1('0x32')],_0x74f6f[_0xdab1('0x34')]));if(_0x16d4bf[_0xdab1('0x32')][_0xdab1('0x3f')]){_0x3fc49c['where']=_[_0xdab1('0x40')](_0x3fc49c['where'],{'$or':_['map'](_0x3fc49c[_0xdab1('0x36')],function(_0xb91e29){var _0x749b2c={};_0x749b2c[_0xb91e29]={'$like':'%'+_0x16d4bf[_0xdab1('0x32')][_0xdab1('0x3f')]+'%'};return _0x749b2c;})});}_0x3fc49c=_[_0xdab1('0x40')]({},_0x3fc49c,_0x16d4bf['options']);return _0x5612e8['getSubjects'](_0x3fc49c);}})['then'](function(_0x1ea8c0){if(_0x1ea8c0){_0x173c02=_0x1ea8c0[_0xdab1('0x38')];if(!_0x16d4bf[_0xdab1('0x32')][_0xdab1('0x39')]('nolimit')){_0x3fc49c[_0xdab1('0x20')]=qs['limit'](_0x16d4bf[_0xdab1('0x32')][_0xdab1('0x20')]);_0x3fc49c[_0xdab1('0x1f')]=qs[_0xdab1('0x1f')](_0x16d4bf[_0xdab1('0x32')][_0xdab1('0x1f')]);}return _0x5612e8[_0xdab1('0x4b')](_0x3fc49c);}})[_0xdab1('0x27')](function(_0x2a75eb){if(_0x2a75eb){return _0x2a75eb?{'count':_0x173c02,'rows':_0x2a75eb}:null;}})[_0xdab1('0x27')](respondWithResult(_0x446163,null))[_0xdab1('0x44')](handleError(_0x446163,null));};exports[_0xdab1('0x4e')]=function(_0x41384f,_0x22acea,_0x37b248){var _0x12824f={};var _0x7e229d={};var _0x26a208;var _0x572dd9;return db[_0xdab1('0x2d')][_0xdab1('0x4c')]({'where':{'id':_0x41384f['params']['id']}})[_0xdab1('0x27')](handleEntityNotFound(_0x22acea,null))[_0xdab1('0x27')](function(_0x35daf9){if(_0x35daf9){_0x26a208=_0x35daf9;_0x7e229d[_0xdab1('0x30')]=_[_0xdab1('0x33')](db[_0xdab1('0x4d')][_0xdab1('0x4f')]);_0x7e229d['query']=_['keys'](_0x41384f['query']);_0x7e229d[_0xdab1('0x34')]=_[_0xdab1('0x35')](_0x7e229d[_0xdab1('0x30')],_0x7e229d[_0xdab1('0x32')]);_0x12824f[_0xdab1('0x36')]=_[_0xdab1('0x35')](_0x7e229d['model'],qs[_0xdab1('0x37')](_0x41384f[_0xdab1('0x32')]['fields']));_0x12824f[_0xdab1('0x36')]=_0x12824f[_0xdab1('0x36')][_0xdab1('0x38')]?_0x12824f[_0xdab1('0x36')]:_0x7e229d[_0xdab1('0x30')];_0x12824f[_0xdab1('0x3b')]=qs[_0xdab1('0x3c')](_0x41384f['query']['sort']);_0x12824f[_0xdab1('0x3d')]=qs[_0xdab1('0x34')](_['pick'](_0x41384f[_0xdab1('0x32')],_0x7e229d[_0xdab1('0x34')]));if(_0x41384f[_0xdab1('0x32')]['filter']){_0x12824f['where']=_[_0xdab1('0x40')](_0x12824f['where'],{'$or':_[_0xdab1('0x31')](_0x12824f[_0xdab1('0x36')],function(_0x11d653){var _0x1ac0b6={};_0x1ac0b6[_0x11d653]={'$like':'%'+_0x41384f[_0xdab1('0x32')][_0xdab1('0x3f')]+'%'};return _0x1ac0b6;})});}_0x12824f=_[_0xdab1('0x40')]({},_0x12824f,_0x41384f[_0xdab1('0x50')]);return _0x26a208[_0xdab1('0x4e')](_0x12824f);}})[_0xdab1('0x27')](function(_0x5ba71b){if(_0x5ba71b){_0x572dd9=_0x5ba71b[_0xdab1('0x38')];if(!_0x41384f[_0xdab1('0x32')][_0xdab1('0x39')](_0xdab1('0x3a'))){_0x12824f['limit']=qs[_0xdab1('0x20')](_0x41384f[_0xdab1('0x32')][_0xdab1('0x20')]);_0x12824f['offset']=qs['offset'](_0x41384f['query'][_0xdab1('0x1f')]);}return _0x26a208[_0xdab1('0x4e')](_0x12824f);}})[_0xdab1('0x27')](function(_0x2270d9){if(_0x2270d9){return _0x2270d9?{'count':_0x572dd9,'rows':_0x2270d9}:null;}})['then'](respondWithResult(_0x22acea,null))['catch'](handleError(_0x22acea,null));};exports[_0xdab1('0x51')]=function(_0x58a56d,_0x529fc8,_0x464ace){var _0x1de39e={};var _0x417693={};var _0x4529ff;var _0x30d859;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x58a56d[_0xdab1('0x46')]['id']}})[_0xdab1('0x27')](handleEntityNotFound(_0x529fc8,null))['then'](function(_0x217b40){if(_0x217b40){_0x4529ff=_0x217b40;_0x417693[_0xdab1('0x30')]=_[_0xdab1('0x33')](db['FreshsalesField'][_0xdab1('0x4f')]);_0x417693[_0xdab1('0x32')]=_['keys'](_0x58a56d[_0xdab1('0x32')]);_0x417693['filters']=_[_0xdab1('0x35')](_0x417693[_0xdab1('0x30')],_0x417693[_0xdab1('0x32')]);_0x1de39e[_0xdab1('0x36')]=_[_0xdab1('0x35')](_0x417693[_0xdab1('0x30')],qs[_0xdab1('0x37')](_0x58a56d[_0xdab1('0x32')]['fields']));_0x1de39e[_0xdab1('0x36')]=_0x1de39e[_0xdab1('0x36')][_0xdab1('0x38')]?_0x1de39e[_0xdab1('0x36')]:_0x417693[_0xdab1('0x30')];_0x1de39e[_0xdab1('0x3b')]=qs[_0xdab1('0x3c')](_0x58a56d[_0xdab1('0x32')][_0xdab1('0x3c')]);_0x1de39e[_0xdab1('0x3d')]=qs['filters'](_[_0xdab1('0x3e')](_0x58a56d[_0xdab1('0x32')],_0x417693['filters']));if(_0x58a56d[_0xdab1('0x32')]['filter']){_0x1de39e[_0xdab1('0x3d')]=_[_0xdab1('0x40')](_0x1de39e[_0xdab1('0x3d')],{'$or':_[_0xdab1('0x31')](_0x1de39e[_0xdab1('0x36')],function(_0x5dea96){var _0x2eedeb={};_0x2eedeb[_0x5dea96]={'$like':'%'+_0x58a56d[_0xdab1('0x32')][_0xdab1('0x3f')]+'%'};return _0x2eedeb;})});}_0x1de39e=_[_0xdab1('0x40')]({},_0x1de39e,_0x58a56d[_0xdab1('0x50')]);return _0x4529ff['getFields'](_0x1de39e);}})['then'](function(_0x48a521){if(_0x48a521){_0x30d859=_0x48a521['length'];if(!_0x58a56d[_0xdab1('0x32')][_0xdab1('0x39')](_0xdab1('0x3a'))){_0x1de39e[_0xdab1('0x20')]=qs['limit'](_0x58a56d['query'][_0xdab1('0x20')]);_0x1de39e[_0xdab1('0x1f')]=qs[_0xdab1('0x1f')](_0x58a56d['query'][_0xdab1('0x1f')]);}return _0x4529ff[_0xdab1('0x51')](_0x1de39e);}})['then'](function(_0x4ac3ad){if(_0x4ac3ad){return _0x4ac3ad?{'count':_0x30d859,'rows':_0x4ac3ad}:null;}})[_0xdab1('0x27')](respondWithResult(_0x529fc8,null))[_0xdab1('0x44')](handleError(_0x529fc8,null));}; \ No newline at end of file +var _0xac74=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','merge','find','create','body','update','getSubjects','FreshsalesField','order','findOne','getDescriptions','getFields','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x5b7dfb,_0x37e92a){var _0x255045=function(_0x323108){while(--_0x323108){_0x5b7dfb['push'](_0x5b7dfb['shift']());}};_0x255045(++_0x37e92a);}(_0xac74,0x133));var _0x4ac7=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xac74[_0x456bd2];return _0x2218c1;};'use strict';var emlformat=require(_0x4ac7('0x0'));var rimraf=require(_0x4ac7('0x1'));var zipdir=require(_0x4ac7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ac7('0x3'));var moment=require(_0x4ac7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ac7('0x5'));var path=require(_0x4ac7('0x6'));var sox=require(_0x4ac7('0x7'));var csv=require(_0x4ac7('0x8'));var ejs=require(_0x4ac7('0x9'));var fs=require('fs');var fs_extra=require(_0x4ac7('0xa'));var _=require('lodash');var squel=require(_0x4ac7('0xb'));var crypto=require(_0x4ac7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4ac7('0xd'));var toCsv=require(_0x4ac7('0x8'));var querystring=require(_0x4ac7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ac7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4ac7('0x10'));var hardwareService=require(_0x4ac7('0x11'));var logger=require(_0x4ac7('0x12'))(_0x4ac7('0x13'));var utils=require('../../config/utils');var config=require(_0x4ac7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ac7('0x15'))['db'];function respondWithStatusCode(_0x5537a0,_0x37c381){_0x37c381=_0x37c381||0xcc;return function(_0x1b0b9a){if(_0x1b0b9a){return _0x5537a0[_0x4ac7('0x16')](_0x37c381);}return _0x5537a0['status'](_0x37c381)[_0x4ac7('0x17')]();};}function respondWithResult(_0x4b7d87,_0x54232a){_0x54232a=_0x54232a||0xc8;return function(_0x356a1e){if(_0x356a1e){return _0x4b7d87['status'](_0x54232a)[_0x4ac7('0x18')](_0x356a1e);}};}function respondWithFilteredResult(_0x546e9a,_0x444ed9){return function(_0x35c5b1){if(_0x35c5b1){var _0x236ca9=typeof _0x444ed9[_0x4ac7('0x19')]===_0x4ac7('0x1a')&&typeof _0x444ed9[_0x4ac7('0x1b')]===_0x4ac7('0x1a');var _0x27f542=_0x35c5b1['count'];var _0x47fb3e=_0x236ca9?0x0:_0x444ed9[_0x4ac7('0x19')];var _0x28641d=_0x236ca9?_0x35c5b1[_0x4ac7('0x1c')]:_0x444ed9[_0x4ac7('0x19')]+_0x444ed9[_0x4ac7('0x1b')];var _0x531879;if(_0x28641d>=_0x27f542){_0x28641d=_0x27f542;_0x531879=0xc8;}else{_0x531879=0xce;}_0x546e9a[_0x4ac7('0x1d')](_0x531879);return _0x546e9a['set']('Content-Range',_0x47fb3e+'-'+_0x28641d+'/'+_0x27f542)[_0x4ac7('0x18')](_0x35c5b1);}return null;};}function patchUpdates(_0x4fe1e7){return function(_0x153fac){try{jsonpatch[_0x4ac7('0x1e')](_0x153fac,_0x4fe1e7,!![]);}catch(_0x2270a8){return BPromise[_0x4ac7('0x1f')](_0x2270a8);}return _0x153fac[_0x4ac7('0x20')]();};}function saveUpdates(_0xaeee78,_0x385ed0){return function(_0x4b4683){if(_0x4b4683){return _0x4b4683['update'](_0xaeee78)[_0x4ac7('0x21')](function(_0x1e4933){return _0x1e4933;});}return null;};}function removeEntity(_0x324411,_0x5d444e){return function(_0x18d17f){if(_0x18d17f){return _0x18d17f[_0x4ac7('0x22')]()['then'](function(){_0x324411['status'](0xcc)[_0x4ac7('0x17')]();});}};}function handleEntityNotFound(_0x54b0d9,_0x2d96f9){return function(_0x4cab53){if(!_0x4cab53){_0x54b0d9[_0x4ac7('0x16')](0x194);}return _0x4cab53;};}function handleError(_0x2fc8b6,_0x364751){_0x364751=_0x364751||0x1f4;return function(_0x4ce7b3){logger['error'](_0x4ce7b3[_0x4ac7('0x23')]);if(_0x4ce7b3[_0x4ac7('0x24')]){delete _0x4ce7b3[_0x4ac7('0x24')];}_0x2fc8b6[_0x4ac7('0x1d')](_0x364751)[_0x4ac7('0x25')](_0x4ce7b3);};}exports[_0x4ac7('0x26')]=function(_0x2d78ec,_0x4387ce){var _0x15a68d={},_0x3be666={},_0x4a24e8={'count':0x0,'rows':[]};var _0xcc0e33=_[_0x4ac7('0x27')](db[_0x4ac7('0x28')]['rawAttributes'],function(_0x1c81f7){return{'name':_0x1c81f7[_0x4ac7('0x29')],'type':_0x1c81f7[_0x4ac7('0x2a')][_0x4ac7('0x2b')]};});_0x3be666[_0x4ac7('0x2c')]=_['map'](_0xcc0e33,_0x4ac7('0x24'));_0x3be666['query']=_[_0x4ac7('0x2d')](_0x2d78ec[_0x4ac7('0x2e')]);_0x3be666['filters']=_[_0x4ac7('0x2f')](_0x3be666[_0x4ac7('0x2c')],_0x3be666[_0x4ac7('0x2e')]);_0x15a68d[_0x4ac7('0x30')]=_[_0x4ac7('0x2f')](_0x3be666['model'],qs[_0x4ac7('0x31')](_0x2d78ec['query'][_0x4ac7('0x31')]));_0x15a68d[_0x4ac7('0x30')]=_0x15a68d[_0x4ac7('0x30')]['length']?_0x15a68d['attributes']:_0x3be666['model'];if(!_0x2d78ec[_0x4ac7('0x2e')][_0x4ac7('0x32')](_0x4ac7('0x33'))){_0x15a68d[_0x4ac7('0x1b')]=qs['limit'](_0x2d78ec['query']['limit']);_0x15a68d['offset']=qs[_0x4ac7('0x19')](_0x2d78ec[_0x4ac7('0x2e')][_0x4ac7('0x19')]);}_0x15a68d['order']=qs['sort'](_0x2d78ec['query'][_0x4ac7('0x34')]);_0x15a68d['where']=qs[_0x4ac7('0x35')](_[_0x4ac7('0x36')](_0x2d78ec['query'],_0x3be666[_0x4ac7('0x35')]),_0xcc0e33);if(_0x2d78ec['query'][_0x4ac7('0x37')]){_0x15a68d[_0x4ac7('0x38')]=_['merge'](_0x15a68d[_0x4ac7('0x38')],{'$or':_[_0x4ac7('0x27')](_0xcc0e33,function(_0x2fac95){if(_0x2fac95[_0x4ac7('0x2a')]!==_0x4ac7('0x39')){var _0x2f4f47={};_0x2f4f47[_0x2fac95['name']]={'$like':'%'+_0x2d78ec[_0x4ac7('0x2e')]['filter']+'%'};return _0x2f4f47;}})});}_0x15a68d=_['merge']({},_0x15a68d,_0x2d78ec[_0x4ac7('0x3a')]);var _0x4b1882={'where':_0x15a68d['where']};return db[_0x4ac7('0x28')]['count'](_0x4b1882)[_0x4ac7('0x21')](function(_0x1ace87){_0x4a24e8['count']=_0x1ace87;if(_0x2d78ec[_0x4ac7('0x2e')]['includeAll']){_0x15a68d['include']=[{'all':!![]}];}return db[_0x4ac7('0x28')][_0x4ac7('0x3b')](_0x15a68d);})['then'](function(_0x3852b1){_0x4a24e8[_0x4ac7('0x3c')]=_0x3852b1;return _0x4a24e8;})[_0x4ac7('0x21')](respondWithFilteredResult(_0x4387ce,_0x15a68d))[_0x4ac7('0x3d')](handleError(_0x4387ce,null));};exports[_0x4ac7('0x3e')]=function(_0x4fb825,_0x6bdecd){var _0x198403={'raw':![],'where':{'id':_0x4fb825[_0x4ac7('0x3f')]['id']}},_0x4ad79c={};_0x4ad79c[_0x4ac7('0x2c')]=_['keys'](db[_0x4ac7('0x28')][_0x4ac7('0x40')]);_0x4ad79c[_0x4ac7('0x2e')]=_[_0x4ac7('0x2d')](_0x4fb825[_0x4ac7('0x2e')]);_0x4ad79c['filters']=_[_0x4ac7('0x2f')](_0x4ad79c[_0x4ac7('0x2c')],_0x4ad79c[_0x4ac7('0x2e')]);_0x198403[_0x4ac7('0x30')]=_['intersection'](_0x4ad79c[_0x4ac7('0x2c')],qs[_0x4ac7('0x31')](_0x4fb825['query']['fields']));_0x198403[_0x4ac7('0x30')]=_0x198403[_0x4ac7('0x30')][_0x4ac7('0x41')]?_0x198403[_0x4ac7('0x30')]:_0x4ad79c[_0x4ac7('0x2c')];if(_0x4fb825[_0x4ac7('0x2e')][_0x4ac7('0x42')]){_0x198403['include']=[{'all':!![]}];}_0x198403=_[_0x4ac7('0x43')]({},_0x198403,_0x4fb825[_0x4ac7('0x3a')]);return db['FreshsalesConfiguration'][_0x4ac7('0x44')](_0x198403)[_0x4ac7('0x21')](handleEntityNotFound(_0x6bdecd,null))[_0x4ac7('0x21')](respondWithResult(_0x6bdecd,null))[_0x4ac7('0x3d')](handleError(_0x6bdecd,null));};exports['create']=function(_0x38bc74,_0x16ea37){return db[_0x4ac7('0x28')][_0x4ac7('0x45')](_0x38bc74[_0x4ac7('0x46')],{})[_0x4ac7('0x21')](respondWithResult(_0x16ea37,0xc9))[_0x4ac7('0x3d')](handleError(_0x16ea37,null));};exports[_0x4ac7('0x47')]=function(_0x22b744,_0x1dcd2d){if(_0x22b744['body']['id']){delete _0x22b744[_0x4ac7('0x46')]['id'];}return db[_0x4ac7('0x28')][_0x4ac7('0x44')]({'where':{'id':_0x22b744[_0x4ac7('0x3f')]['id']}})[_0x4ac7('0x21')](handleEntityNotFound(_0x1dcd2d,null))[_0x4ac7('0x21')](saveUpdates(_0x22b744[_0x4ac7('0x46')],null))[_0x4ac7('0x21')](respondWithResult(_0x1dcd2d,null))[_0x4ac7('0x3d')](handleError(_0x1dcd2d,null));};exports['destroy']=function(_0x2afbf2,_0x30d69e){return db[_0x4ac7('0x28')][_0x4ac7('0x44')]({'where':{'id':_0x2afbf2[_0x4ac7('0x3f')]['id']}})[_0x4ac7('0x21')](handleEntityNotFound(_0x30d69e,null))['then'](removeEntity(_0x30d69e,null))['catch'](handleError(_0x30d69e,null));};exports[_0x4ac7('0x48')]=function(_0x461c25,_0x4e4c69,_0x246186){var _0x26b8e9={};var _0x50ed89={};var _0x18a97e;var _0x23e251;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x461c25[_0x4ac7('0x3f')]['id']}})[_0x4ac7('0x21')](handleEntityNotFound(_0x4e4c69,null))['then'](function(_0x143f99){if(_0x143f99){_0x18a97e=_0x143f99;_0x50ed89[_0x4ac7('0x2c')]=_['keys'](db[_0x4ac7('0x49')]['rawAttributes']);_0x50ed89['query']=_[_0x4ac7('0x2d')](_0x461c25[_0x4ac7('0x2e')]);_0x50ed89[_0x4ac7('0x35')]=_[_0x4ac7('0x2f')](_0x50ed89[_0x4ac7('0x2c')],_0x50ed89[_0x4ac7('0x2e')]);_0x26b8e9[_0x4ac7('0x30')]=_[_0x4ac7('0x2f')](_0x50ed89[_0x4ac7('0x2c')],qs[_0x4ac7('0x31')](_0x461c25['query'][_0x4ac7('0x31')]));_0x26b8e9[_0x4ac7('0x30')]=_0x26b8e9[_0x4ac7('0x30')][_0x4ac7('0x41')]?_0x26b8e9[_0x4ac7('0x30')]:_0x50ed89[_0x4ac7('0x2c')];_0x26b8e9[_0x4ac7('0x4a')]=qs[_0x4ac7('0x34')](_0x461c25[_0x4ac7('0x2e')][_0x4ac7('0x34')]);_0x26b8e9['where']=qs[_0x4ac7('0x35')](_[_0x4ac7('0x36')](_0x461c25[_0x4ac7('0x2e')],_0x50ed89[_0x4ac7('0x35')]));if(_0x461c25[_0x4ac7('0x2e')][_0x4ac7('0x37')]){_0x26b8e9[_0x4ac7('0x38')]=_['merge'](_0x26b8e9[_0x4ac7('0x38')],{'$or':_['map'](_0x26b8e9[_0x4ac7('0x30')],function(_0x31b825){var _0x27476e={};_0x27476e[_0x31b825]={'$like':'%'+_0x461c25['query']['filter']+'%'};return _0x27476e;})});}_0x26b8e9=_[_0x4ac7('0x43')]({},_0x26b8e9,_0x461c25[_0x4ac7('0x3a')]);return _0x18a97e[_0x4ac7('0x48')](_0x26b8e9);}})[_0x4ac7('0x21')](function(_0x1a4472){if(_0x1a4472){_0x23e251=_0x1a4472[_0x4ac7('0x41')];if(!_0x461c25['query'][_0x4ac7('0x32')]('nolimit')){_0x26b8e9['limit']=qs[_0x4ac7('0x1b')](_0x461c25[_0x4ac7('0x2e')][_0x4ac7('0x1b')]);_0x26b8e9[_0x4ac7('0x19')]=qs[_0x4ac7('0x19')](_0x461c25[_0x4ac7('0x2e')][_0x4ac7('0x19')]);}return _0x18a97e[_0x4ac7('0x48')](_0x26b8e9);}})['then'](function(_0x139312){if(_0x139312){return _0x139312?{'count':_0x23e251,'rows':_0x139312}:null;}})[_0x4ac7('0x21')](respondWithResult(_0x4e4c69,null))[_0x4ac7('0x3d')](handleError(_0x4e4c69,null));};exports['getDescriptions']=function(_0x2f7012,_0x38fd3c,_0x49adc5){var _0x131436={};var _0x1907a7={};var _0x9b1852;var _0x391666;return db[_0x4ac7('0x28')][_0x4ac7('0x4b')]({'where':{'id':_0x2f7012['params']['id']}})[_0x4ac7('0x21')](handleEntityNotFound(_0x38fd3c,null))[_0x4ac7('0x21')](function(_0x1b7d1e){if(_0x1b7d1e){_0x9b1852=_0x1b7d1e;_0x1907a7['model']=_[_0x4ac7('0x2d')](db[_0x4ac7('0x49')][_0x4ac7('0x40')]);_0x1907a7['query']=_[_0x4ac7('0x2d')](_0x2f7012[_0x4ac7('0x2e')]);_0x1907a7[_0x4ac7('0x35')]=_['intersection'](_0x1907a7[_0x4ac7('0x2c')],_0x1907a7[_0x4ac7('0x2e')]);_0x131436['attributes']=_[_0x4ac7('0x2f')](_0x1907a7[_0x4ac7('0x2c')],qs[_0x4ac7('0x31')](_0x2f7012[_0x4ac7('0x2e')][_0x4ac7('0x31')]));_0x131436[_0x4ac7('0x30')]=_0x131436[_0x4ac7('0x30')][_0x4ac7('0x41')]?_0x131436[_0x4ac7('0x30')]:_0x1907a7[_0x4ac7('0x2c')];_0x131436['order']=qs[_0x4ac7('0x34')](_0x2f7012[_0x4ac7('0x2e')]['sort']);_0x131436['where']=qs[_0x4ac7('0x35')](_[_0x4ac7('0x36')](_0x2f7012[_0x4ac7('0x2e')],_0x1907a7['filters']));if(_0x2f7012['query']['filter']){_0x131436[_0x4ac7('0x38')]=_[_0x4ac7('0x43')](_0x131436[_0x4ac7('0x38')],{'$or':_[_0x4ac7('0x27')](_0x131436[_0x4ac7('0x30')],function(_0x1072c8){var _0x1a2f76={};_0x1a2f76[_0x1072c8]={'$like':'%'+_0x2f7012[_0x4ac7('0x2e')][_0x4ac7('0x37')]+'%'};return _0x1a2f76;})});}_0x131436=_['merge']({},_0x131436,_0x2f7012[_0x4ac7('0x3a')]);return _0x9b1852[_0x4ac7('0x4c')](_0x131436);}})[_0x4ac7('0x21')](function(_0x54e600){if(_0x54e600){_0x391666=_0x54e600[_0x4ac7('0x41')];if(!_0x2f7012[_0x4ac7('0x2e')][_0x4ac7('0x32')](_0x4ac7('0x33'))){_0x131436[_0x4ac7('0x1b')]=qs['limit'](_0x2f7012[_0x4ac7('0x2e')][_0x4ac7('0x1b')]);_0x131436[_0x4ac7('0x19')]=qs[_0x4ac7('0x19')](_0x2f7012[_0x4ac7('0x2e')]['offset']);}return _0x9b1852[_0x4ac7('0x4c')](_0x131436);}})[_0x4ac7('0x21')](function(_0x176486){if(_0x176486){return _0x176486?{'count':_0x391666,'rows':_0x176486}:null;}})['then'](respondWithResult(_0x38fd3c,null))[_0x4ac7('0x3d')](handleError(_0x38fd3c,null));};exports[_0x4ac7('0x4d')]=function(_0x213dca,_0x28b2c6,_0x4c8ae4){var _0x1ea03f={};var _0x1bce0c={};var _0x61231b;var _0x427a35;return db[_0x4ac7('0x28')]['findOne']({'where':{'id':_0x213dca[_0x4ac7('0x3f')]['id']}})[_0x4ac7('0x21')](handleEntityNotFound(_0x28b2c6,null))[_0x4ac7('0x21')](function(_0x474012){if(_0x474012){_0x61231b=_0x474012;_0x1bce0c['model']=_['keys'](db[_0x4ac7('0x49')][_0x4ac7('0x40')]);_0x1bce0c[_0x4ac7('0x2e')]=_[_0x4ac7('0x2d')](_0x213dca[_0x4ac7('0x2e')]);_0x1bce0c[_0x4ac7('0x35')]=_['intersection'](_0x1bce0c[_0x4ac7('0x2c')],_0x1bce0c['query']);_0x1ea03f['attributes']=_['intersection'](_0x1bce0c['model'],qs[_0x4ac7('0x31')](_0x213dca[_0x4ac7('0x2e')][_0x4ac7('0x31')]));_0x1ea03f[_0x4ac7('0x30')]=_0x1ea03f[_0x4ac7('0x30')][_0x4ac7('0x41')]?_0x1ea03f['attributes']:_0x1bce0c[_0x4ac7('0x2c')];_0x1ea03f['order']=qs[_0x4ac7('0x34')](_0x213dca[_0x4ac7('0x2e')][_0x4ac7('0x34')]);_0x1ea03f[_0x4ac7('0x38')]=qs[_0x4ac7('0x35')](_[_0x4ac7('0x36')](_0x213dca[_0x4ac7('0x2e')],_0x1bce0c[_0x4ac7('0x35')]));if(_0x213dca[_0x4ac7('0x2e')][_0x4ac7('0x37')]){_0x1ea03f[_0x4ac7('0x38')]=_[_0x4ac7('0x43')](_0x1ea03f[_0x4ac7('0x38')],{'$or':_[_0x4ac7('0x27')](_0x1ea03f[_0x4ac7('0x30')],function(_0x3fc0da){var _0x4a8781={};_0x4a8781[_0x3fc0da]={'$like':'%'+_0x213dca[_0x4ac7('0x2e')]['filter']+'%'};return _0x4a8781;})});}_0x1ea03f=_[_0x4ac7('0x43')]({},_0x1ea03f,_0x213dca['options']);return _0x61231b['getFields'](_0x1ea03f);}})[_0x4ac7('0x21')](function(_0x33af80){if(_0x33af80){_0x427a35=_0x33af80[_0x4ac7('0x41')];if(!_0x213dca['query'][_0x4ac7('0x32')](_0x4ac7('0x33'))){_0x1ea03f[_0x4ac7('0x1b')]=qs[_0x4ac7('0x1b')](_0x213dca[_0x4ac7('0x2e')][_0x4ac7('0x1b')]);_0x1ea03f['offset']=qs['offset'](_0x213dca[_0x4ac7('0x2e')]['offset']);}return _0x61231b[_0x4ac7('0x4d')](_0x1ea03f);}})[_0x4ac7('0x21')](function(_0x141157){if(_0x141157){return _0x141157?{'count':_0x427a35,'rows':_0x141157}:null;}})[_0x4ac7('0x21')](respondWithResult(_0x28b2c6,null))[_0x4ac7('0x3d')](handleError(_0x28b2c6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index de5f7e9..cae47a1 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 _0xd21e=['api','bluebird','path','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','../../config/logger'];(function(_0x434836,_0x514b33){var _0x432852=function(_0x1bad19){while(--_0x1bad19){_0x434836['push'](_0x434836['shift']());}};_0x432852(++_0x514b33);}(_0xd21e,0xdf));var _0xed21=function(_0x6ae66b,_0x3ba914){_0x6ae66b=_0x6ae66b-0x0;var _0x465cef=_0xd21e[_0x6ae66b];return _0x465cef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xed21('0x0'))(_0xed21('0x1'));var moment=require('moment');var BPromise=require(_0xed21('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed21('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed21('0x4'));module[_0xed21('0x5')]=function(_0x414609,_0x59366d){return _0x414609[_0xed21('0x6')]('FreshsalesConfiguration',attributes,{'tableName':_0xed21('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf598=['rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3570c3,_0x55d20f){var _0xbbdae0=function(_0xf996fa){while(--_0xf996fa){_0x3570c3['push'](_0x3570c3['shift']());}};_0xbbdae0(++_0x55d20f);}(_0xf598,0xf7));var _0x8f59=function(_0x957a8f,_0x1f02ce){_0x957a8f=_0x957a8f-0x0;var _0x92bdd=_0xf598[_0x957a8f];return _0x92bdd;};'use strict';var _=require(_0x8f59('0x0'));var util=require('util');var logger=require(_0x8f59('0x1'))('api');var moment=require(_0x8f59('0x2'));var BPromise=require(_0x8f59('0x3'));var rp=require(_0x8f59('0x4'));var fs=require('fs');var path=require(_0x8f59('0x5'));var rimraf=require(_0x8f59('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f59('0x7'));module[_0x8f59('0x8')]=function(_0x3868b2,_0xffd4db){return _0x3868b2[_0x8f59('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x8f59('0xa'),'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 ea3333a..77a5001 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 _0x9c39=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x557c35,_0x33a6ce){var _0x53dbae=function(_0x294463){while(--_0x294463){_0x557c35['push'](_0x557c35['shift']());}};_0x53dbae(++_0x33a6ce);}(_0x9c39,0xfb));var _0x99c3=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x9c39[_0x2077c2];return _0x312f9f;};'use strict';var _=require('lodash');var util=require(_0x99c3('0x0'));var moment=require(_0x99c3('0x1'));var BPromise=require(_0x99c3('0x2'));var rs=require(_0x99c3('0x3'));var fs=require('fs');var Redis=require(_0x99c3('0x4'));var db=require(_0x99c3('0x5'))['db'];var utils=require(_0x99c3('0x6'));var logger=require(_0x99c3('0x7'))(_0x99c3('0x8'));var config=require('../../config/environment');var jayson=require(_0x99c3('0x9'));var client=jayson[_0x99c3('0xa')][_0x99c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x549050,_0x32ae03,_0x594881){return new BPromise(function(_0x26fd9e,_0x1207e3){return client['request'](_0x549050,_0x594881)['then'](function(_0x30b29e){logger[_0x99c3('0xc')](_0x99c3('0xd'),_0x32ae03,_0x99c3('0xe'));logger[_0x99c3('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x32ae03,_0x99c3('0xe'),JSON[_0x99c3('0x10')](_0x30b29e));if(_0x30b29e[_0x99c3('0x11')]){if(_0x30b29e[_0x99c3('0x11')][_0x99c3('0x12')]===0x1f4){logger[_0x99c3('0x11')](_0x99c3('0xd'),_0x32ae03,_0x30b29e[_0x99c3('0x11')][_0x99c3('0x13')]);return _0x1207e3(_0x30b29e['error'][_0x99c3('0x13')]);}logger[_0x99c3('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x32ae03,_0x30b29e[_0x99c3('0x11')][_0x99c3('0x13')]);return _0x26fd9e(_0x30b29e['error'][_0x99c3('0x13')]);}else{logger[_0x99c3('0xc')](_0x99c3('0xd'),_0x32ae03,_0x99c3('0xe'));_0x26fd9e(_0x30b29e[_0x99c3('0x14')][_0x99c3('0x13')]);}})[_0x99c3('0x15')](function(_0x9be7be){logger[_0x99c3('0x11')](_0x99c3('0xd'),_0x32ae03,_0x9be7be);_0x1207e3(_0x9be7be);});});} \ No newline at end of file +var _0x5b16=['http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils','rpc'];(function(_0xd038d6,_0x50e08b){var _0x23129a=function(_0x4c3233){while(--_0x4c3233){_0xd038d6['push'](_0xd038d6['shift']());}};_0x23129a(++_0x50e08b);}(_0x5b16,0x9d));var _0x65b1=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x5b16[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x65b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x65b1('0x1'));var rs=require(_0x65b1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x65b1('0x3'));var logger=require('../../config/logger')(_0x65b1('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x65b1('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x4b3fad,_0x452b2b,_0x16364c){return new BPromise(function(_0x470d60,_0x599cea){return client[_0x65b1('0x6')](_0x4b3fad,_0x16364c)['then'](function(_0x50c5a6){logger[_0x65b1('0x7')](_0x65b1('0x8'),_0x452b2b,'request\x20sent');logger[_0x65b1('0x9')](_0x65b1('0xa'),_0x452b2b,_0x65b1('0xb'),JSON[_0x65b1('0xc')](_0x50c5a6));if(_0x50c5a6[_0x65b1('0xd')]){if(_0x50c5a6[_0x65b1('0xd')][_0x65b1('0xe')]===0x1f4){logger['error'](_0x65b1('0x8'),_0x452b2b,_0x50c5a6[_0x65b1('0xd')][_0x65b1('0xf')]);return _0x599cea(_0x50c5a6[_0x65b1('0xd')]['message']);}logger[_0x65b1('0xd')](_0x65b1('0x8'),_0x452b2b,_0x50c5a6[_0x65b1('0xd')][_0x65b1('0xf')]);return _0x470d60(_0x50c5a6['error'][_0x65b1('0xf')]);}else{logger[_0x65b1('0x7')](_0x65b1('0x8'),_0x452b2b,_0x65b1('0xb'));_0x470d60(_0x50c5a6[_0x65b1('0x10')][_0x65b1('0xf')]);}})[_0x65b1('0x11')](function(_0x1b7746){logger['error'](_0x65b1('0x8'),_0x452b2b,_0x1b7746);_0x599cea(_0x1b7746);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0280dfb..19c7b75 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 _0x720c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','path'];(function(_0x4e0e60,_0x56f29f){var _0x2b4c6c=function(_0x37f287){while(--_0x37f287){_0x4e0e60['push'](_0x4e0e60['shift']());}};_0x2b4c6c(++_0x56f29f);}(_0x720c,0x154));var _0xc720=function(_0x24cc35,_0x21b4e6){_0x24cc35=_0x24cc35-0x0;var _0x440e29=_0x720c[_0x24cc35];return _0x440e29;};'use strict';var multer=require(_0xc720('0x0'));var util=require('util');var path=require(_0xc720('0x1'));var timeout=require(_0xc720('0x2'));var express=require(_0xc720('0x3'));var router=express[_0xc720('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc720('0x5'));var interaction=require(_0xc720('0x6'));var config=require(_0xc720('0x7'));var controller=require(_0xc720('0x8'));router[_0xc720('0x9')]('/',auth[_0xc720('0xa')](),controller[_0xc720('0xb')]);router['get'](_0xc720('0xc'),auth[_0xc720('0xa')](),controller[_0xc720('0xd')]);router[_0xc720('0xe')]('/',auth[_0xc720('0xa')](),controller['create']);router['put'](_0xc720('0xc'),auth['isAuthenticated'](),controller[_0xc720('0xf')]);router[_0xc720('0x10')]('/:id',auth[_0xc720('0xa')](),controller[_0xc720('0x11')]);module[_0xc720('0x12')]=router; \ No newline at end of file +var _0x0ef0=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','/:id','update'];(function(_0x728d93,_0x1105e9){var _0x3a4448=function(_0x27a66d){while(--_0x27a66d){_0x728d93['push'](_0x728d93['shift']());}};_0x3a4448(++_0x1105e9);}(_0x0ef0,0x80));var _0x00ef=function(_0x13cf5e,_0x216f0b){_0x13cf5e=_0x13cf5e-0x0;var _0xb26f15=_0x0ef0[_0x13cf5e];return _0xb26f15;};'use strict';var multer=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var path=require('path');var timeout=require(_0x00ef('0x2'));var express=require(_0x00ef('0x3'));var router=express[_0x00ef('0x4')]();var fs_extra=require(_0x00ef('0x5'));var auth=require(_0x00ef('0x6'));var interaction=require(_0x00ef('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x00ef('0x8')]('/',auth[_0x00ef('0x9')](),controller[_0x00ef('0xa')]);router[_0x00ef('0x8')]('/:id',auth[_0x00ef('0x9')](),controller[_0x00ef('0xb')]);router[_0x00ef('0xc')]('/',auth[_0x00ef('0x9')](),controller[_0x00ef('0xd')]);router['put'](_0x00ef('0xe'),auth[_0x00ef('0x9')](),controller[_0x00ef('0xf')]);router['delete'](_0x00ef('0xe'),auth['isAuthenticated'](),controller[_0x00ef('0x10')]);module[_0x00ef('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 ec596b9..7fc50b8 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 _0x8813=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0xfa5825,_0x2ba3ee){var _0x4726d1=function(_0x6f65af){while(--_0x6f65af){_0xfa5825['push'](_0xfa5825['shift']());}};_0x4726d1(++_0x2ba3ee);}(_0x8813,0x1db));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3881('0x0'));module[_0x3881('0x1')]={'type':{'type':Sequelize[_0x3881('0x2')](_0x3881('0x3'),_0x3881('0x4'),_0x3881('0x5'),_0x3881('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3881('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3881('0x3'),_0x3881('0x4'),_0x3881('0x5'))},'keyContent':{'type':Sequelize[_0x3881('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3881('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3881('0x7')]}}; \ No newline at end of file +var _0x0a2b=['STRING','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x5a2da5,_0x12e6c3){var _0x477530=function(_0x4a64f5){while(--_0x4a64f5){_0x5a2da5['push'](_0x5a2da5['shift']());}};_0x477530(++_0x12e6c3);}(_0x0a2b,0xd3));var _0xb0a2=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x0a2b[_0x3902c1];return _0x1266cc;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb0a2('0x0')]('string',_0xb0a2('0x1'),_0xb0a2('0x2'),_0xb0a2('0x3'),_0xb0a2('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb0a2('0x5')]},'key':{'type':Sequelize[_0xb0a2('0x5')]},'keyType':{'type':Sequelize[_0xb0a2('0x0')]('string',_0xb0a2('0x1'),_0xb0a2('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb0a2('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0a2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 05983b2..52b58d4 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 _0x76a4=['api','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','catch','show','params','includeAll','find','create','body','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/parsers/qs','../../config/logger'];(function(_0x574a4c,_0x943417){var _0x668f77=function(_0x3df54c){while(--_0x3df54c){_0x574a4c['push'](_0x574a4c['shift']());}};_0x668f77(++_0x943417);}(_0x76a4,0x19b));var _0x476a=function(_0x553317,_0x5ced0c){_0x553317=_0x553317-0x0;var _0x352441=_0x76a4[_0x553317];return _0x352441;};'use strict';var emlformat=require(_0x476a('0x0'));var rimraf=require(_0x476a('0x1'));var zipdir=require(_0x476a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x476a('0x3'));var moment=require(_0x476a('0x4'));var BPromise=require(_0x476a('0x5'));var Mustache=require(_0x476a('0x6'));var util=require('util');var path=require(_0x476a('0x7'));var sox=require(_0x476a('0x8'));var csv=require(_0x476a('0x9'));var ejs=require(_0x476a('0xa'));var fs=require('fs');var fs_extra=require(_0x476a('0xb'));var _=require(_0x476a('0xc'));var squel=require(_0x476a('0xd'));var crypto=require(_0x476a('0xe'));var jsforce=require(_0x476a('0xf'));var deskjs=require(_0x476a('0x10'));var toCsv=require(_0x476a('0x9'));var querystring=require(_0x476a('0x11'));var Papa=require(_0x476a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x476a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x476a('0x14'))(_0x476a('0x15'));var utils=require('../../config/utils');var config=require(_0x476a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3a9b,_0x4d5922){_0x4d5922=_0x4d5922||0xcc;return function(_0x248648){if(_0x248648){return _0x5b3a9b[_0x476a('0x17')](_0x4d5922);}return _0x5b3a9b[_0x476a('0x18')](_0x4d5922)[_0x476a('0x19')]();};}function respondWithResult(_0x222696,_0x3eef9c){_0x3eef9c=_0x3eef9c||0xc8;return function(_0x2e96fe){if(_0x2e96fe){return _0x222696[_0x476a('0x18')](_0x3eef9c)['json'](_0x2e96fe);}};}function respondWithFilteredResult(_0x4cc3cd,_0x1a19eb){return function(_0x8b6d82){if(_0x8b6d82){var _0x554728=typeof _0x1a19eb[_0x476a('0x1a')]===_0x476a('0x1b')&&typeof _0x1a19eb[_0x476a('0x1c')]===_0x476a('0x1b');var _0x44991c=_0x8b6d82[_0x476a('0x1d')];var _0x33d0aa=_0x554728?0x0:_0x1a19eb[_0x476a('0x1a')];var _0x46f91d=_0x554728?_0x8b6d82[_0x476a('0x1d')]:_0x1a19eb[_0x476a('0x1a')]+_0x1a19eb[_0x476a('0x1c')];var _0xe90680;if(_0x46f91d>=_0x44991c){_0x46f91d=_0x44991c;_0xe90680=0xc8;}else{_0xe90680=0xce;}_0x4cc3cd['status'](_0xe90680);return _0x4cc3cd['set'](_0x476a('0x1e'),_0x33d0aa+'-'+_0x46f91d+'/'+_0x44991c)[_0x476a('0x1f')](_0x8b6d82);}return null;};}function patchUpdates(_0x1b6373){return function(_0xc9aec){try{jsonpatch[_0x476a('0x20')](_0xc9aec,_0x1b6373,!![]);}catch(_0x9106ad){return BPromise[_0x476a('0x21')](_0x9106ad);}return _0xc9aec['save']();};}function saveUpdates(_0x55ca2d,_0x47c511){return function(_0x37ace5){if(_0x37ace5){return _0x37ace5[_0x476a('0x22')](_0x55ca2d)[_0x476a('0x23')](function(_0x4154d8){return _0x4154d8;});}return null;};}function removeEntity(_0x3176d8,_0x50df07){return function(_0x3f0336){if(_0x3f0336){return _0x3f0336[_0x476a('0x24')]()[_0x476a('0x23')](function(){_0x3176d8[_0x476a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x298f9d,_0x50cdd3){return function(_0x29731c){if(!_0x29731c){_0x298f9d[_0x476a('0x17')](0x194);}return _0x29731c;};}function handleError(_0x494925,_0x3f5dd9){_0x3f5dd9=_0x3f5dd9||0x1f4;return function(_0x5e195b){logger[_0x476a('0x25')](_0x5e195b[_0x476a('0x26')]);if(_0x5e195b[_0x476a('0x27')]){delete _0x5e195b[_0x476a('0x27')];}_0x494925[_0x476a('0x18')](_0x3f5dd9)['send'](_0x5e195b);};}exports['index']=function(_0x5092b6,_0x5d8598){var _0x537e87={},_0x2c4d8c={},_0x419a9a={'count':0x0,'rows':[]};var _0x5dac5f=_[_0x476a('0x28')](db[_0x476a('0x29')][_0x476a('0x2a')],function(_0x4782eb){return{'name':_0x4782eb[_0x476a('0x2b')],'type':_0x4782eb['type'][_0x476a('0x2c')]};});_0x2c4d8c[_0x476a('0x2d')]=_[_0x476a('0x28')](_0x5dac5f,_0x476a('0x27'));_0x2c4d8c[_0x476a('0x2e')]=_[_0x476a('0x2f')](_0x5092b6[_0x476a('0x2e')]);_0x2c4d8c[_0x476a('0x30')]=_[_0x476a('0x31')](_0x2c4d8c[_0x476a('0x2d')],_0x2c4d8c[_0x476a('0x2e')]);_0x537e87['attributes']=_[_0x476a('0x31')](_0x2c4d8c[_0x476a('0x2d')],qs[_0x476a('0x32')](_0x5092b6[_0x476a('0x2e')]['fields']));_0x537e87[_0x476a('0x33')]=_0x537e87[_0x476a('0x33')][_0x476a('0x34')]?_0x537e87[_0x476a('0x33')]:_0x2c4d8c[_0x476a('0x2d')];if(!_0x5092b6['query'][_0x476a('0x35')](_0x476a('0x36'))){_0x537e87[_0x476a('0x1c')]=qs[_0x476a('0x1c')](_0x5092b6[_0x476a('0x2e')][_0x476a('0x1c')]);_0x537e87[_0x476a('0x1a')]=qs[_0x476a('0x1a')](_0x5092b6[_0x476a('0x2e')][_0x476a('0x1a')]);}_0x537e87[_0x476a('0x37')]=qs[_0x476a('0x38')](_0x5092b6[_0x476a('0x2e')]['sort']);_0x537e87[_0x476a('0x39')]=qs[_0x476a('0x30')](_[_0x476a('0x3a')](_0x5092b6[_0x476a('0x2e')],_0x2c4d8c[_0x476a('0x30')]),_0x5dac5f);if(_0x5092b6[_0x476a('0x2e')][_0x476a('0x3b')]){_0x537e87[_0x476a('0x39')]=_[_0x476a('0x3c')](_0x537e87[_0x476a('0x39')],{'$or':_[_0x476a('0x28')](_0x5dac5f,function(_0x391750){if(_0x391750[_0x476a('0x3d')]!=='VIRTUAL'){var _0x458330={};_0x458330[_0x391750[_0x476a('0x27')]]={'$like':'%'+_0x5092b6[_0x476a('0x2e')][_0x476a('0x3b')]+'%'};return _0x458330;}})});}_0x537e87=_[_0x476a('0x3c')]({},_0x537e87,_0x5092b6[_0x476a('0x3e')]);var _0x15191c={'where':_0x537e87[_0x476a('0x39')]};return db['FreshsalesField'][_0x476a('0x1d')](_0x15191c)[_0x476a('0x23')](function(_0xd0a9c8){_0x419a9a[_0x476a('0x1d')]=_0xd0a9c8;if(_0x5092b6['query']['includeAll']){_0x537e87[_0x476a('0x3f')]=[{'all':!![]}];}return db[_0x476a('0x29')][_0x476a('0x40')](_0x537e87);})[_0x476a('0x23')](function(_0x40b085){_0x419a9a['rows']=_0x40b085;return _0x419a9a;})['then'](respondWithFilteredResult(_0x5d8598,_0x537e87))[_0x476a('0x41')](handleError(_0x5d8598,null));};exports[_0x476a('0x42')]=function(_0x2f9120,_0x102201){var _0x587100={'raw':!![],'where':{'id':_0x2f9120[_0x476a('0x43')]['id']}},_0x2f6d32={};_0x2f6d32[_0x476a('0x2d')]=_[_0x476a('0x2f')](db['FreshsalesField']['rawAttributes']);_0x2f6d32[_0x476a('0x2e')]=_[_0x476a('0x2f')](_0x2f9120[_0x476a('0x2e')]);_0x2f6d32[_0x476a('0x30')]=_['intersection'](_0x2f6d32[_0x476a('0x2d')],_0x2f6d32['query']);_0x587100[_0x476a('0x33')]=_[_0x476a('0x31')](_0x2f6d32['model'],qs[_0x476a('0x32')](_0x2f9120['query']['fields']));_0x587100[_0x476a('0x33')]=_0x587100[_0x476a('0x33')]['length']?_0x587100[_0x476a('0x33')]:_0x2f6d32[_0x476a('0x2d')];if(_0x2f9120[_0x476a('0x2e')][_0x476a('0x44')]){_0x587100[_0x476a('0x3f')]=[{'all':!![]}];}_0x587100=_[_0x476a('0x3c')]({},_0x587100,_0x2f9120[_0x476a('0x3e')]);return db[_0x476a('0x29')][_0x476a('0x45')](_0x587100)[_0x476a('0x23')](handleEntityNotFound(_0x102201,null))['then'](respondWithResult(_0x102201,null))[_0x476a('0x41')](handleError(_0x102201,null));};exports[_0x476a('0x46')]=function(_0x7ee93a,_0x5e2986){return db[_0x476a('0x29')]['create'](_0x7ee93a[_0x476a('0x47')],{})[_0x476a('0x23')](respondWithResult(_0x5e2986,0xc9))[_0x476a('0x41')](handleError(_0x5e2986,null));};exports[_0x476a('0x22')]=function(_0x2b0bcc,_0x1ad5c6){if(_0x2b0bcc[_0x476a('0x47')]['id']){delete _0x2b0bcc[_0x476a('0x47')]['id'];}return db['FreshsalesField'][_0x476a('0x45')]({'where':{'id':_0x2b0bcc[_0x476a('0x43')]['id']}})[_0x476a('0x23')](handleEntityNotFound(_0x1ad5c6,null))[_0x476a('0x23')](saveUpdates(_0x2b0bcc[_0x476a('0x47')],null))[_0x476a('0x23')](respondWithResult(_0x1ad5c6,null))[_0x476a('0x41')](handleError(_0x1ad5c6,null));};exports[_0x476a('0x24')]=function(_0x56a467,_0x423b05){return db['FreshsalesField']['find']({'where':{'id':_0x56a467[_0x476a('0x43')]['id']}})['then'](handleEntityNotFound(_0x423b05,null))[_0x476a('0x23')](removeEntity(_0x423b05,null))[_0x476a('0x41')](handleError(_0x423b05,null));}; \ No newline at end of file +var _0x034b=['request-promise','moment','bluebird','mustache','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesField','includeAll','findAll','rows','catch','show','params','rawAttributes','options','create','body','destroy','find','zip-dir'];(function(_0x52fd88,_0x44c121){var _0x2913e1=function(_0x45bcc8){while(--_0x45bcc8){_0x52fd88['push'](_0x52fd88['shift']());}};_0x2913e1(++_0x44c121);}(_0x034b,0xdd));var _0xb034=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x034b[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb034('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb034('0x1'));var moment=require(_0xb034('0x2'));var BPromise=require(_0xb034('0x3'));var Mustache=require(_0xb034('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb034('0x5'));var csv=require(_0xb034('0x6'));var ejs=require(_0xb034('0x7'));var fs=require('fs');var fs_extra=require(_0xb034('0x8'));var _=require(_0xb034('0x9'));var squel=require(_0xb034('0xa'));var crypto=require(_0xb034('0xb'));var jsforce=require(_0xb034('0xc'));var deskjs=require(_0xb034('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb034('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb034('0xf'));var qs=require(_0xb034('0x10'));var as=require(_0xb034('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb034('0x12'))(_0xb034('0x13'));var utils=require(_0xb034('0x14'));var config=require(_0xb034('0x15'));var licenseUtil=require(_0xb034('0x16'));var db=require(_0xb034('0x17'))['db'];function respondWithStatusCode(_0xef3ef2,_0x53e4f9){_0x53e4f9=_0x53e4f9||0xcc;return function(_0x273ae0){if(_0x273ae0){return _0xef3ef2[_0xb034('0x18')](_0x53e4f9);}return _0xef3ef2['status'](_0x53e4f9)['end']();};}function respondWithResult(_0x29ef55,_0x3a7b16){_0x3a7b16=_0x3a7b16||0xc8;return function(_0x263194){if(_0x263194){return _0x29ef55[_0xb034('0x19')](_0x3a7b16)[_0xb034('0x1a')](_0x263194);}};}function respondWithFilteredResult(_0x3bec7d,_0x3187f9){return function(_0x4c7bd5){if(_0x4c7bd5){var _0x34c175=typeof _0x3187f9[_0xb034('0x1b')]===_0xb034('0x1c')&&typeof _0x3187f9[_0xb034('0x1d')]===_0xb034('0x1c');var _0x46df76=_0x4c7bd5[_0xb034('0x1e')];var _0x5ea897=_0x34c175?0x0:_0x3187f9['offset'];var _0x2dac0d=_0x34c175?_0x4c7bd5[_0xb034('0x1e')]:_0x3187f9[_0xb034('0x1b')]+_0x3187f9[_0xb034('0x1d')];var _0x250f21;if(_0x2dac0d>=_0x46df76){_0x2dac0d=_0x46df76;_0x250f21=0xc8;}else{_0x250f21=0xce;}_0x3bec7d['status'](_0x250f21);return _0x3bec7d[_0xb034('0x1f')](_0xb034('0x20'),_0x5ea897+'-'+_0x2dac0d+'/'+_0x46df76)['json'](_0x4c7bd5);}return null;};}function patchUpdates(_0x5d2893){return function(_0x488ac7){try{jsonpatch[_0xb034('0x21')](_0x488ac7,_0x5d2893,!![]);}catch(_0xc15da){return BPromise[_0xb034('0x22')](_0xc15da);}return _0x488ac7['save']();};}function saveUpdates(_0x54a6fa,_0x4e2846){return function(_0xbd1e7a){if(_0xbd1e7a){return _0xbd1e7a[_0xb034('0x23')](_0x54a6fa)[_0xb034('0x24')](function(_0x10cb8f){return _0x10cb8f;});}return null;};}function removeEntity(_0x55bd32,_0xe56007){return function(_0x37a62d){if(_0x37a62d){return _0x37a62d['destroy']()[_0xb034('0x24')](function(){_0x55bd32[_0xb034('0x19')](0xcc)[_0xb034('0x25')]();});}};}function handleEntityNotFound(_0x12ae06,_0x50c833){return function(_0x4ed53f){if(!_0x4ed53f){_0x12ae06['sendStatus'](0x194);}return _0x4ed53f;};}function handleError(_0x2c7d03,_0x1df980){_0x1df980=_0x1df980||0x1f4;return function(_0x3c1b02){logger[_0xb034('0x26')](_0x3c1b02[_0xb034('0x27')]);if(_0x3c1b02['name']){delete _0x3c1b02[_0xb034('0x28')];}_0x2c7d03[_0xb034('0x19')](_0x1df980)['send'](_0x3c1b02);};}exports['index']=function(_0x30aabe,_0x4a56e3){var _0x5350a0={},_0x169499={},_0x132622={'count':0x0,'rows':[]};var _0x24d325=_[_0xb034('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x507527){return{'name':_0x507527[_0xb034('0x2a')],'type':_0x507527[_0xb034('0x2b')]['key']};});_0x169499['model']=_['map'](_0x24d325,_0xb034('0x28'));_0x169499[_0xb034('0x2c')]=_[_0xb034('0x2d')](_0x30aabe['query']);_0x169499[_0xb034('0x2e')]=_[_0xb034('0x2f')](_0x169499[_0xb034('0x30')],_0x169499[_0xb034('0x2c')]);_0x5350a0[_0xb034('0x31')]=_[_0xb034('0x2f')](_0x169499['model'],qs['fields'](_0x30aabe[_0xb034('0x2c')][_0xb034('0x32')]));_0x5350a0[_0xb034('0x31')]=_0x5350a0['attributes'][_0xb034('0x33')]?_0x5350a0['attributes']:_0x169499[_0xb034('0x30')];if(!_0x30aabe[_0xb034('0x2c')][_0xb034('0x34')](_0xb034('0x35'))){_0x5350a0[_0xb034('0x1d')]=qs[_0xb034('0x1d')](_0x30aabe[_0xb034('0x2c')]['limit']);_0x5350a0[_0xb034('0x1b')]=qs[_0xb034('0x1b')](_0x30aabe['query']['offset']);}_0x5350a0[_0xb034('0x36')]=qs[_0xb034('0x37')](_0x30aabe[_0xb034('0x2c')][_0xb034('0x37')]);_0x5350a0[_0xb034('0x38')]=qs['filters'](_[_0xb034('0x39')](_0x30aabe['query'],_0x169499['filters']),_0x24d325);if(_0x30aabe[_0xb034('0x2c')][_0xb034('0x3a')]){_0x5350a0['where']=_[_0xb034('0x3b')](_0x5350a0[_0xb034('0x38')],{'$or':_[_0xb034('0x29')](_0x24d325,function(_0x41f69a){if(_0x41f69a[_0xb034('0x2b')]!==_0xb034('0x3c')){var _0x498605={};_0x498605[_0x41f69a['name']]={'$like':'%'+_0x30aabe[_0xb034('0x2c')][_0xb034('0x3a')]+'%'};return _0x498605;}})});}_0x5350a0=_['merge']({},_0x5350a0,_0x30aabe['options']);var _0x5f3542={'where':_0x5350a0[_0xb034('0x38')]};return db[_0xb034('0x3d')][_0xb034('0x1e')](_0x5f3542)[_0xb034('0x24')](function(_0x39fd5d){_0x132622[_0xb034('0x1e')]=_0x39fd5d;if(_0x30aabe['query'][_0xb034('0x3e')]){_0x5350a0['include']=[{'all':!![]}];}return db[_0xb034('0x3d')][_0xb034('0x3f')](_0x5350a0);})['then'](function(_0x4c5a9c){_0x132622[_0xb034('0x40')]=_0x4c5a9c;return _0x132622;})['then'](respondWithFilteredResult(_0x4a56e3,_0x5350a0))[_0xb034('0x41')](handleError(_0x4a56e3,null));};exports[_0xb034('0x42')]=function(_0x73576,_0x370c83){var _0x59b464={'raw':!![],'where':{'id':_0x73576[_0xb034('0x43')]['id']}},_0xbd4d={};_0xbd4d[_0xb034('0x30')]=_[_0xb034('0x2d')](db[_0xb034('0x3d')][_0xb034('0x44')]);_0xbd4d['query']=_[_0xb034('0x2d')](_0x73576[_0xb034('0x2c')]);_0xbd4d['filters']=_['intersection'](_0xbd4d['model'],_0xbd4d[_0xb034('0x2c')]);_0x59b464[_0xb034('0x31')]=_[_0xb034('0x2f')](_0xbd4d['model'],qs['fields'](_0x73576[_0xb034('0x2c')][_0xb034('0x32')]));_0x59b464[_0xb034('0x31')]=_0x59b464[_0xb034('0x31')][_0xb034('0x33')]?_0x59b464[_0xb034('0x31')]:_0xbd4d[_0xb034('0x30')];if(_0x73576[_0xb034('0x2c')][_0xb034('0x3e')]){_0x59b464['include']=[{'all':!![]}];}_0x59b464=_['merge']({},_0x59b464,_0x73576[_0xb034('0x45')]);return db['FreshsalesField']['find'](_0x59b464)[_0xb034('0x24')](handleEntityNotFound(_0x370c83,null))['then'](respondWithResult(_0x370c83,null))[_0xb034('0x41')](handleError(_0x370c83,null));};exports[_0xb034('0x46')]=function(_0x4e9343,_0x39fdf7){return db[_0xb034('0x3d')][_0xb034('0x46')](_0x4e9343[_0xb034('0x47')],{})[_0xb034('0x24')](respondWithResult(_0x39fdf7,0xc9))[_0xb034('0x41')](handleError(_0x39fdf7,null));};exports[_0xb034('0x23')]=function(_0x242b3d,_0x177f7d){if(_0x242b3d[_0xb034('0x47')]['id']){delete _0x242b3d[_0xb034('0x47')]['id'];}return db[_0xb034('0x3d')]['find']({'where':{'id':_0x242b3d[_0xb034('0x43')]['id']}})[_0xb034('0x24')](handleEntityNotFound(_0x177f7d,null))[_0xb034('0x24')](saveUpdates(_0x242b3d[_0xb034('0x47')],null))['then'](respondWithResult(_0x177f7d,null))[_0xb034('0x41')](handleError(_0x177f7d,null));};exports[_0xb034('0x48')]=function(_0xf1f70f,_0x3ac7f1){return db['FreshsalesField'][_0xb034('0x49')]({'where':{'id':_0xf1f70f[_0xb034('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ac7f1,null))[_0xb034('0x24')](removeEntity(_0x3ac7f1,null))['catch'](handleError(_0x3ac7f1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f84a66e..6cc7fc5 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 _0x7fea=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x7fea,0x149));var _0xa7fe=function(_0x457aaa,_0x399373){_0x457aaa=_0x457aaa-0x0;var _0x49282c=_0x7fea[_0x457aaa];return _0x49282c;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa7fe('0x1'));var BPromise=require(_0xa7fe('0x2'));var rp=require(_0xa7fe('0x3'));var fs=require('fs');var path=require(_0xa7fe('0x4'));var rimraf=require(_0xa7fe('0x5'));var config=require(_0xa7fe('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xa7fe('0x7')]=function(_0x2bcfad,_0x1fbc99){return _0x2bcfad[_0xa7fe('0x8')](_0xa7fe('0x9'),attributes,{'tableName':_0xa7fe('0xa'),'paranoid':![],'indexes':[{'name':_0xa7fe('0xb'),'fields':[_0xa7fe('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdc2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x441f61,_0x4a103e){_0x441f61=_0x441f61-0x0;var _0x33098f=_0xcdc2[_0x441f61];return _0x33098f;};'use strict';var _=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var logger=require(_0x2cdc('0x2'))(_0x2cdc('0x3'));var moment=require(_0x2cdc('0x4'));var BPromise=require(_0x2cdc('0x5'));var rp=require(_0x2cdc('0x6'));var fs=require('fs');var path=require(_0x2cdc('0x7'));var rimraf=require(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var attributes=require(_0x2cdc('0xa'));module[_0x2cdc('0xb')]=function(_0x487c5e,_0x581345){return _0x487c5e[_0x2cdc('0xc')]('FreshsalesField',attributes,{'tableName':_0x2cdc('0xd'),'paranoid':![],'indexes':[{'name':_0x2cdc('0xe'),'fields':[_0x2cdc('0xf'),'FieldId'],'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 0de5874..83b941d 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 _0x7a54=['info','FreshsalesField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x2d8183,_0x470a8e){_0x2d8183=_0x2d8183-0x0;var _0x29fdf8=_0x7a54[_0x2d8183];return _0x29fdf8;};'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')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x40686b,_0x8341bb){var _0x56307d=function(_0x5dcd8a){while(--_0x5dcd8a){_0x40686b['push'](_0x40686b['shift']());}};_0x56307d(++_0x8341bb);}(_0x2a07,0x74));var _0x72a0=function(_0x549996,_0xd04634){_0x549996=_0x549996-0x0;var _0x4de5d1=_0x2a07[_0x549996];return _0x4de5d1;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4b3af25..c7dc33d 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(_0x20f751,_0x3e58b5){var _0x5e694c=function(_0x46556e){while(--_0x46556e){_0x20f751['push'](_0x20f751['shift']());}};_0x5e694c(++_0x3e58b5);}(_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/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(_0xe3f984,_0x256548){var _0x2d831e=function(_0x5c0deb){while(--_0x5c0deb){_0xe3f984['push'](_0xe3f984['shift']());}};_0x2d831e(++_0x256548);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 c7c5633..e19abe9 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 _0x63a6=['exports','STRING','username','newTab','integrationTab'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63a6,0x1c7));var _0x663a=function(_0x399d76,_0xdc4493){_0x399d76=_0x399d76-0x0;var _0x3b19a1=_0x63a6[_0x399d76];return _0x3b19a1;};'use strict';var Sequelize=require('sequelize');module[_0x663a('0x0')]={'name':{'type':Sequelize[_0x663a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x663a('0x1')],'unique':_0x663a('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x663a('0x1')]},'clientId':{'type':Sequelize[_0x663a('0x1')]},'clientSecret':{'type':Sequelize[_0x663a('0x1')]},'securityToken':{'type':Sequelize[_0x663a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x663a('0x3')),'defaultValue':_0x663a('0x4')}}; \ No newline at end of file +var _0xf846=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xf846,0x85));var _0x6f84=function(_0x56b093,_0x8b5220){_0x56b093=_0x56b093-0x0;var _0x3a20a8=_0xf846[_0x56b093];return _0x3a20a8;};'use strict';var Sequelize=require(_0x6f84('0x0'));module[_0x6f84('0x1')]={'name':{'type':Sequelize[_0x6f84('0x2')]},'description':{'type':Sequelize[_0x6f84('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6f84('0x3')},'remoteUri':{'type':Sequelize[_0x6f84('0x2')]},'password':{'type':Sequelize[_0x6f84('0x2')]},'clientId':{'type':Sequelize[_0x6f84('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x6f84('0x2')]},'serverUrl':{'type':Sequelize[_0x6f84('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6f84('0x4')](_0x6f84('0x5'),_0x6f84('0x6')),'defaultValue':_0x6f84('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5de0059..80bb305 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 _0x4327=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','SalesforceAccount','rows','catch','params','keys','rawAttributes','include','find','create','body','findOne','SalesforceConfiguration','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','boolean','textarea','remove','includes','label','picklistValues','value','True','true','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x9a2ea3,_0x5ed1f6){var _0x39f7d0=function(_0x3fa94c){while(--_0x3fa94c){_0x9a2ea3['push'](_0x9a2ea3['shift']());}};_0x39f7d0(++_0x5ed1f6);}(_0x4327,0x164));var _0x7432=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0x4327[_0x57cc22];return _0x6f7bdc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7432('0x0'));var zipdir=require(_0x7432('0x1'));var jsonpatch=require(_0x7432('0x2'));var rp=require(_0x7432('0x3'));var moment=require(_0x7432('0x4'));var BPromise=require(_0x7432('0x5'));var Mustache=require(_0x7432('0x6'));var util=require(_0x7432('0x7'));var path=require(_0x7432('0x8'));var sox=require(_0x7432('0x9'));var csv=require(_0x7432('0xa'));var ejs=require(_0x7432('0xb'));var fs=require('fs');var fs_extra=require(_0x7432('0xc'));var _=require('lodash');var squel=require(_0x7432('0xd'));var crypto=require(_0x7432('0xe'));var jsforce=require(_0x7432('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7432('0xa'));var querystring=require(_0x7432('0x10'));var Papa=require('papaparse');var Redis=require(_0x7432('0x11'));var authService=require(_0x7432('0x12'));var qs=require(_0x7432('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7432('0x14'));var utils=require('../../config/utils');var config=require(_0x7432('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7432('0x16'))['db'];var integrations=require(_0x7432('0x17'));function respondWithStatusCode(_0x26d7f7,_0x1b0f0e){_0x1b0f0e=_0x1b0f0e||0xcc;return function(_0x1d5db5){if(_0x1d5db5){return _0x26d7f7['sendStatus'](_0x1b0f0e);}return _0x26d7f7[_0x7432('0x18')](_0x1b0f0e)[_0x7432('0x19')]();};}function respondWithResult(_0x109799,_0x52b1f0){_0x52b1f0=_0x52b1f0||0xc8;return function(_0x4bfe3a){if(_0x4bfe3a){return _0x109799[_0x7432('0x18')](_0x52b1f0)[_0x7432('0x1a')](_0x4bfe3a);}};}function respondWithFilteredResult(_0x392470,_0x2b0c2a){return function(_0x51062e){if(_0x51062e){var _0x5b0e0d=typeof _0x2b0c2a[_0x7432('0x1b')]===_0x7432('0x1c')&&typeof _0x2b0c2a[_0x7432('0x1d')]==='undefined';var _0x33e928=_0x51062e['count'];var _0x3d1d9b=_0x5b0e0d?0x0:_0x2b0c2a['offset'];var _0x1e33dd=_0x5b0e0d?_0x51062e[_0x7432('0x1e')]:_0x2b0c2a['offset']+_0x2b0c2a['limit'];var _0x430b88;if(_0x1e33dd>=_0x33e928){_0x1e33dd=_0x33e928;_0x430b88=0xc8;}else{_0x430b88=0xce;}_0x392470[_0x7432('0x18')](_0x430b88);return _0x392470[_0x7432('0x1f')](_0x7432('0x20'),_0x3d1d9b+'-'+_0x1e33dd+'/'+_0x33e928)[_0x7432('0x1a')](_0x51062e);}return null;};}function patchUpdates(_0x9d272b){return function(_0x538db0){try{jsonpatch['apply'](_0x538db0,_0x9d272b,!![]);}catch(_0x245e84){return BPromise['reject'](_0x245e84);}return _0x538db0[_0x7432('0x21')]();};}function saveUpdates(_0x473072,_0x31553a){return function(_0x4075e5){if(_0x4075e5){return _0x4075e5[_0x7432('0x22')](_0x473072)[_0x7432('0x23')](function(_0x187d3c){return _0x187d3c;});}return null;};}function removeEntity(_0x33b786,_0x333019){return function(_0x11d5e3){if(_0x11d5e3){return _0x11d5e3[_0x7432('0x24')]()['then'](function(){_0x33b786[_0x7432('0x18')](0xcc)[_0x7432('0x19')]();});}};}function handleEntityNotFound(_0x51a5b6,_0x62755b){return function(_0x24fca7){if(!_0x24fca7){_0x51a5b6[_0x7432('0x25')](0x194);}return _0x24fca7;};}function handleError(_0x1f4fdd,_0x4d13d2){_0x4d13d2=_0x4d13d2||0x1f4;return function(_0x3cfcdf){logger[_0x7432('0x26')](_0x3cfcdf[_0x7432('0x27')]);if(_0x3cfcdf[_0x7432('0x28')]){delete _0x3cfcdf[_0x7432('0x28')];}_0x1f4fdd['status'](_0x4d13d2)[_0x7432('0x29')](_0x3cfcdf);};}exports[_0x7432('0x2a')]=function(_0x587cc6,_0x439148){var _0x503ee0={},_0x26b207={},_0x2260da={'count':0x0,'rows':[]};var _0x4cd3d1=_[_0x7432('0x2b')](db['SalesforceAccount']['rawAttributes'],function(_0x3e4207){return{'name':_0x3e4207[_0x7432('0x2c')],'type':_0x3e4207['type'][_0x7432('0x2d')]};});_0x26b207['model']=_[_0x7432('0x2b')](_0x4cd3d1,_0x7432('0x28'));_0x26b207[_0x7432('0x2e')]=_['keys'](_0x587cc6['query']);_0x26b207['filters']=_[_0x7432('0x2f')](_0x26b207[_0x7432('0x30')],_0x26b207[_0x7432('0x2e')]);_0x503ee0[_0x7432('0x31')]=_[_0x7432('0x2f')](_0x26b207[_0x7432('0x30')],qs[_0x7432('0x32')](_0x587cc6['query'][_0x7432('0x32')]));_0x503ee0[_0x7432('0x31')]=_0x503ee0[_0x7432('0x31')][_0x7432('0x33')]?_0x503ee0[_0x7432('0x31')]:_0x26b207[_0x7432('0x30')];if(!_0x587cc6[_0x7432('0x2e')]['hasOwnProperty'](_0x7432('0x34'))){_0x503ee0[_0x7432('0x1d')]=qs['limit'](_0x587cc6[_0x7432('0x2e')][_0x7432('0x1d')]);_0x503ee0[_0x7432('0x1b')]=qs['offset'](_0x587cc6['query'][_0x7432('0x1b')]);}_0x503ee0[_0x7432('0x35')]=qs['sort'](_0x587cc6[_0x7432('0x2e')][_0x7432('0x36')]);_0x503ee0[_0x7432('0x37')]=qs['filters'](_[_0x7432('0x38')](_0x587cc6['query'],_0x26b207[_0x7432('0x39')]),_0x4cd3d1);if(_0x587cc6['query']['filter']){_0x503ee0[_0x7432('0x37')]=_[_0x7432('0x3a')](_0x503ee0[_0x7432('0x37')],{'$or':_['map'](_0x4cd3d1,function(_0x3fde21){if(_0x3fde21[_0x7432('0x3b')]!==_0x7432('0x3c')){var _0x2bf9a4={};_0x2bf9a4[_0x3fde21[_0x7432('0x28')]]={'$like':'%'+_0x587cc6[_0x7432('0x2e')][_0x7432('0x3d')]+'%'};return _0x2bf9a4;}})});}_0x503ee0=_[_0x7432('0x3a')]({},_0x503ee0,_0x587cc6[_0x7432('0x3e')]);var _0x5ebeb9={'where':_0x503ee0[_0x7432('0x37')]};return db[_0x7432('0x3f')][_0x7432('0x1e')](_0x5ebeb9)[_0x7432('0x23')](function(_0x4f5651){_0x2260da['count']=_0x4f5651;if(_0x587cc6['query']['includeAll']){_0x503ee0['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x503ee0);})['then'](function(_0x253478){_0x2260da[_0x7432('0x40')]=_0x253478;return _0x2260da;})[_0x7432('0x23')](respondWithFilteredResult(_0x439148,_0x503ee0))[_0x7432('0x41')](handleError(_0x439148,null));};exports['show']=function(_0x1e8b46,_0x3cc984){var _0x35c811={'raw':![],'where':{'id':_0x1e8b46[_0x7432('0x42')]['id']}},_0x4325c3={};_0x4325c3[_0x7432('0x30')]=_[_0x7432('0x43')](db[_0x7432('0x3f')][_0x7432('0x44')]);_0x4325c3[_0x7432('0x2e')]=_[_0x7432('0x43')](_0x1e8b46[_0x7432('0x2e')]);_0x4325c3[_0x7432('0x39')]=_[_0x7432('0x2f')](_0x4325c3[_0x7432('0x30')],_0x4325c3[_0x7432('0x2e')]);_0x35c811['attributes']=_['intersection'](_0x4325c3['model'],qs[_0x7432('0x32')](_0x1e8b46[_0x7432('0x2e')][_0x7432('0x32')]));_0x35c811[_0x7432('0x31')]=_0x35c811['attributes']['length']?_0x35c811['attributes']:_0x4325c3['model'];if(_0x1e8b46[_0x7432('0x2e')]['includeAll']){_0x35c811[_0x7432('0x45')]=[{'all':!![]}];}_0x35c811=_[_0x7432('0x3a')]({},_0x35c811,_0x1e8b46[_0x7432('0x3e')]);return db[_0x7432('0x3f')][_0x7432('0x46')](_0x35c811)[_0x7432('0x23')](handleEntityNotFound(_0x3cc984,null))[_0x7432('0x23')](respondWithResult(_0x3cc984,null))['catch'](handleError(_0x3cc984,null));};exports[_0x7432('0x47')]=function(_0x37a453,_0x552174){return db[_0x7432('0x3f')][_0x7432('0x47')](_0x37a453[_0x7432('0x48')],{})[_0x7432('0x23')](respondWithResult(_0x552174,0xc9))[_0x7432('0x41')](handleError(_0x552174,null));};exports[_0x7432('0x22')]=function(_0x2cb57e,_0x326ec7){if(_0x2cb57e[_0x7432('0x48')]['id']){delete _0x2cb57e['body']['id'];}return db['SalesforceAccount'][_0x7432('0x46')]({'where':{'id':_0x2cb57e[_0x7432('0x42')]['id']}})[_0x7432('0x23')](handleEntityNotFound(_0x326ec7,null))['then'](saveUpdates(_0x2cb57e[_0x7432('0x48')],null))[_0x7432('0x23')](respondWithResult(_0x326ec7,null))[_0x7432('0x41')](handleError(_0x326ec7,null));};exports[_0x7432('0x24')]=function(_0x8da303,_0x5a002e){return db['SalesforceAccount'][_0x7432('0x46')]({'where':{'id':_0x8da303['params']['id']}})[_0x7432('0x23')](handleEntityNotFound(_0x5a002e,null))['then'](removeEntity(_0x5a002e,null))[_0x7432('0x41')](handleError(_0x5a002e,null));};exports['getConfigurations']=function(_0x12d950,_0x589a04,_0x333671){var _0x3f7819={};var _0x472ee6={};var _0x5a71db;var _0x457c61;return db['SalesforceAccount'][_0x7432('0x49')]({'where':{'id':_0x12d950['params']['id']}})[_0x7432('0x23')](handleEntityNotFound(_0x589a04,null))['then'](function(_0xbe4351){if(_0xbe4351){_0x5a71db=_0xbe4351;_0x472ee6['model']=_[_0x7432('0x43')](db[_0x7432('0x4a')]['rawAttributes']);_0x472ee6[_0x7432('0x2e')]=_[_0x7432('0x43')](_0x12d950[_0x7432('0x2e')]);_0x472ee6[_0x7432('0x39')]=_[_0x7432('0x2f')](_0x472ee6[_0x7432('0x30')],_0x472ee6[_0x7432('0x2e')]);_0x3f7819[_0x7432('0x31')]=_[_0x7432('0x2f')](_0x472ee6[_0x7432('0x30')],qs[_0x7432('0x32')](_0x12d950['query'][_0x7432('0x32')]));_0x3f7819[_0x7432('0x31')]=_0x3f7819[_0x7432('0x31')][_0x7432('0x33')]?_0x3f7819[_0x7432('0x31')]:_0x472ee6[_0x7432('0x30')];_0x3f7819[_0x7432('0x35')]=qs[_0x7432('0x36')](_0x12d950[_0x7432('0x2e')][_0x7432('0x36')]);_0x3f7819[_0x7432('0x37')]=qs[_0x7432('0x39')](_[_0x7432('0x38')](_0x12d950[_0x7432('0x2e')],_0x472ee6[_0x7432('0x39')]));if(_0x12d950[_0x7432('0x2e')][_0x7432('0x3d')]){_0x3f7819[_0x7432('0x37')]=_[_0x7432('0x3a')](_0x3f7819[_0x7432('0x37')],{'$or':_['map'](_0x3f7819[_0x7432('0x31')],function(_0x5a2640){var _0x1f204d={};_0x1f204d[_0x5a2640]={'$like':'%'+_0x12d950[_0x7432('0x2e')][_0x7432('0x3d')]+'%'};return _0x1f204d;})});}_0x3f7819=_[_0x7432('0x3a')]({},_0x3f7819,_0x12d950['options']);return _0x5a71db[_0x7432('0x4b')](_0x3f7819);}})[_0x7432('0x23')](function(_0x4a1156){if(_0x4a1156){_0x457c61=_0x4a1156[_0x7432('0x33')];if(!_0x12d950[_0x7432('0x2e')][_0x7432('0x4c')]('nolimit')){_0x3f7819[_0x7432('0x1d')]=qs[_0x7432('0x1d')](_0x12d950[_0x7432('0x2e')]['limit']);_0x3f7819[_0x7432('0x1b')]=qs[_0x7432('0x1b')](_0x12d950[_0x7432('0x2e')][_0x7432('0x1b')]);}return _0x5a71db['getConfigurations'](_0x3f7819);}})[_0x7432('0x23')](function(_0x2109ab){if(_0x2109ab){return _0x2109ab?{'count':_0x457c61,'rows':_0x2109ab}:null;}})[_0x7432('0x23')](respondWithResult(_0x589a04,null))[_0x7432('0x41')](handleError(_0x589a04,null));};exports['addConfiguration']=function(_0x1e8eb7,_0x2d78cd,_0x56d3e2){if(_0x1e8eb7[_0x7432('0x48')]['id']){delete _0x1e8eb7[_0x7432('0x48')]['id'];}return db[_0x7432('0x3f')][_0x7432('0x49')]({'where':{'id':_0x1e8eb7[_0x7432('0x42')]['id']}})[_0x7432('0x23')](handleEntityNotFound(_0x2d78cd,null))['then'](function(_0x3f09fd){if(_0x3f09fd){_0x1e8eb7['body'][_0x7432('0x4d')]=_0x3f09fd['id'];_0x1e8eb7['body'][_0x7432('0x4e')]=integrations[_0x7432('0x4f')](_0x1e8eb7[_0x7432('0x48')][_0x7432('0x50')],_0x1e8eb7[_0x7432('0x48')][_0x7432('0x3b')]);_0x1e8eb7['body'][_0x7432('0x51')]=integrations['getDescriptions'](_0x1e8eb7[_0x7432('0x48')][_0x7432('0x50')],_0x1e8eb7[_0x7432('0x48')][_0x7432('0x3b')]);return db[_0x7432('0x4a')][_0x7432('0x47')](_0x1e8eb7['body'],{'include':[{'model':db[_0x7432('0x52')],'as':_0x7432('0x4e')},{'model':db['SalesforceField'],'as':_0x7432('0x51')}]});}return null;})['then'](respondWithResult(_0x2d78cd,null))[_0x7432('0x41')](handleError(_0x2d78cd,null));};exports[_0x7432('0x53')]=function(_0x50ad6d,_0x735610,_0x37ad31){var _0x14ea67;var _0x211404='';var _0xa050a6=_0x7432('0x54');return db['SalesforceAccount'][_0x7432('0x49')]({'where':{'id':_0x50ad6d[_0x7432('0x42')]['id']},'attributes':['id','remoteUri',_0x7432('0x55'),_0x7432('0x56'),_0x7432('0x57'),'password',_0x7432('0x58')]})[_0x7432('0x23')](handleEntityNotFound(_0x735610,null))['then'](function(_0x7501b7){if(_0x7501b7){_0x211404=_0x7501b7[_0x7432('0x59')];var _0x4f8c56=_0x211404['slice'](-0x1);if(_0x4f8c56==='/'){_0x211404=_0x211404[_0x7432('0x5a')](0x0,_0x211404[_0x7432('0x5b')](_0x4f8c56));}_0x14ea67=new jsforce[(_0x7432('0x5c'))]({'oauth2':{'loginUrl':_0x211404,'clientId':_0x7501b7[_0x7432('0x55')],'clientSecret':_0x7501b7[_0x7432('0x56')]}});return _0x14ea67[_0x7432('0x5d')](_0x7501b7[_0x7432('0x57')],_0x7501b7['password'][_0x7432('0x5e')](_0x7501b7[_0x7432('0x58')]));}})[_0x7432('0x23')](function(_0xb2f49){if(_0xb2f49){if(!_[_0x7432('0x5f')](_0x50ad6d[_0x7432('0x2e')][_0x7432('0x60')])){_0xa050a6=_0x50ad6d[_0x7432('0x2e')][_0x7432('0x60')];}return _0x14ea67[_0x7432('0x61')](_0xa050a6)[_0x7432('0x62')]();}})[_0x7432('0x23')](function(_0x46819d){var _0x1a8cc6=[_0x7432('0x63'),_0x7432('0x64'),_0x7432('0x65'),_0x7432('0x66'),'Subject',_0x7432('0x67')];var _0x5489ab=[_0x7432('0x68'),_0x7432('0x69'),'picklist',_0x7432('0x6a'),'email',_0x7432('0x6b'),'phone'];if(_0x46819d){_[_0x7432('0x6c')](_0x46819d[_0x7432('0x32')],function(_0x14f128){return _0x1a8cc6[_0x7432('0x6d')](_0x14f128[_0x7432('0x28')])||!_0x5489ab[_0x7432('0x6d')](_0x14f128['type']);});return{'count':_0x46819d[_0x7432('0x32')]['length'],'rows':_[_0x7432('0x2b')](_0x46819d[_0x7432('0x32')],function(_0x4467c3){return{'id':_0x4467c3[_0x7432('0x28')],'name':_0x4467c3[_0x7432('0x6e')],'custom':_0x4467c3['custom'],'options':_0x4467c3[_0x7432('0x6f')][_0x7432('0x33')]>0x0?_[_0x7432('0x2b')](_0x4467c3[_0x7432('0x6f')],function(_0x5d6759){return{'name':_0x5d6759[_0x7432('0x6e')],'value':_0x5d6759[_0x7432('0x70')]};}):_0x4467c3[_0x7432('0x3b')]==_0x7432('0x6a')?[{'name':_0x7432('0x71'),'value':_0x7432('0x72')},{'name':'False','value':_0x7432('0x73')}]:[]};})};}})[_0x7432('0x23')](respondWithResult(_0x735610,null))[_0x7432('0x41')](function(_0x51f73a){var _0xd95837=_0x50ad6d[_0x7432('0x2e')][_0x7432('0x74')]?0x1f4:_0x51f73a['statusCode']||0x1f4;logger[_0x7432('0x26')](_0x7432('0x75'),'getFields',_0xd95837,JSON['stringify'](_0x51f73a));delete _0x51f73a[_0x7432('0x28')];if(_0xd95837===0x191){_0xd95837=0x190;}_0x735610['status'](_0xd95837)[_0x7432('0x29')](_0x50ad6d[_0x7432('0x2e')][_0x7432('0x74')]?{'message':_0x7432('0x76'),'statusCode':_0x51f73a[_0x7432('0x77')]}:_0x51f73a);});}; \ No newline at end of file +var _0xa155=['lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','params','include','find','create','body','catch','getConfigurations','findOne','SalesforceConfiguration','order','nolimit','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','boolean','textarea','phone','label','custom','picklistValues','value','True','true','False','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra'];(function(_0x22bf38,_0x5427d8){var _0x514522=function(_0x48199b){while(--_0x48199b){_0x22bf38['push'](_0x22bf38['shift']());}};_0x514522(++_0x5427d8);}(_0xa155,0xe5));var _0x5a15=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa155[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x5a15('0x0'));var rimraf=require(_0x5a15('0x1'));var zipdir=require(_0x5a15('0x2'));var jsonpatch=require(_0x5a15('0x3'));var rp=require(_0x5a15('0x4'));var moment=require(_0x5a15('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5a15('0x6'));var util=require(_0x5a15('0x7'));var path=require('path');var sox=require(_0x5a15('0x8'));var csv=require(_0x5a15('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a15('0xa'));var _=require(_0x5a15('0xb'));var squel=require(_0x5a15('0xc'));var crypto=require(_0x5a15('0xd'));var jsforce=require(_0x5a15('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5a15('0x9'));var querystring=require('querystring');var Papa=require(_0x5a15('0xf'));var Redis=require('ioredis');var authService=require(_0x5a15('0x10'));var qs=require(_0x5a15('0x11'));var as=require(_0x5a15('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a15('0x13'))(_0x5a15('0x14'));var utils=require(_0x5a15('0x15'));var config=require(_0x5a15('0x16'));var licenseUtil=require(_0x5a15('0x17'));var db=require(_0x5a15('0x18'))['db'];var integrations=require(_0x5a15('0x19'));function respondWithStatusCode(_0x1f8b55,_0x3efa82){_0x3efa82=_0x3efa82||0xcc;return function(_0x5e7e31){if(_0x5e7e31){return _0x1f8b55[_0x5a15('0x1a')](_0x3efa82);}return _0x1f8b55['status'](_0x3efa82)[_0x5a15('0x1b')]();};}function respondWithResult(_0x49e085,_0x35cafc){_0x35cafc=_0x35cafc||0xc8;return function(_0x209f16){if(_0x209f16){return _0x49e085[_0x5a15('0x1c')](_0x35cafc)['json'](_0x209f16);}};}function respondWithFilteredResult(_0x4ef2d4,_0x353ffb){return function(_0x51472b){if(_0x51472b){var _0x22eb6a=typeof _0x353ffb['offset']==='undefined'&&typeof _0x353ffb[_0x5a15('0x1d')]===_0x5a15('0x1e');var _0x26f55c=_0x51472b[_0x5a15('0x1f')];var _0x339deb=_0x22eb6a?0x0:_0x353ffb['offset'];var _0x40cbd7=_0x22eb6a?_0x51472b[_0x5a15('0x1f')]:_0x353ffb[_0x5a15('0x20')]+_0x353ffb[_0x5a15('0x1d')];var _0x429a4c;if(_0x40cbd7>=_0x26f55c){_0x40cbd7=_0x26f55c;_0x429a4c=0xc8;}else{_0x429a4c=0xce;}_0x4ef2d4[_0x5a15('0x1c')](_0x429a4c);return _0x4ef2d4[_0x5a15('0x21')](_0x5a15('0x22'),_0x339deb+'-'+_0x40cbd7+'/'+_0x26f55c)[_0x5a15('0x23')](_0x51472b);}return null;};}function patchUpdates(_0x333b67){return function(_0x4074a5){try{jsonpatch['apply'](_0x4074a5,_0x333b67,!![]);}catch(_0xfc9fbf){return BPromise[_0x5a15('0x24')](_0xfc9fbf);}return _0x4074a5[_0x5a15('0x25')]();};}function saveUpdates(_0x48080a,_0xd12f52){return function(_0x31ba9b){if(_0x31ba9b){return _0x31ba9b[_0x5a15('0x26')](_0x48080a)[_0x5a15('0x27')](function(_0x6c537d){return _0x6c537d;});}return null;};}function removeEntity(_0x1dbccf,_0x29fc9a){return function(_0x4a7757){if(_0x4a7757){return _0x4a7757['destroy']()['then'](function(){_0x1dbccf[_0x5a15('0x1c')](0xcc)[_0x5a15('0x1b')]();});}};}function handleEntityNotFound(_0x1d3c75,_0x47564a){return function(_0x1f94c1){if(!_0x1f94c1){_0x1d3c75[_0x5a15('0x1a')](0x194);}return _0x1f94c1;};}function handleError(_0x4ebcab,_0x301595){_0x301595=_0x301595||0x1f4;return function(_0x177fdd){logger['error'](_0x177fdd[_0x5a15('0x28')]);if(_0x177fdd[_0x5a15('0x29')]){delete _0x177fdd[_0x5a15('0x29')];}_0x4ebcab[_0x5a15('0x1c')](_0x301595)[_0x5a15('0x2a')](_0x177fdd);};}exports[_0x5a15('0x2b')]=function(_0x16a687,_0xbb7385){var _0x50c541={},_0x4a7e0a={},_0xeff37b={'count':0x0,'rows':[]};var _0x382336=_[_0x5a15('0x2c')](db[_0x5a15('0x2d')][_0x5a15('0x2e')],function(_0x5656bd){return{'name':_0x5656bd[_0x5a15('0x2f')],'type':_0x5656bd[_0x5a15('0x30')]['key']};});_0x4a7e0a[_0x5a15('0x31')]=_[_0x5a15('0x2c')](_0x382336,_0x5a15('0x29'));_0x4a7e0a[_0x5a15('0x32')]=_[_0x5a15('0x33')](_0x16a687[_0x5a15('0x32')]);_0x4a7e0a[_0x5a15('0x34')]=_['intersection'](_0x4a7e0a[_0x5a15('0x31')],_0x4a7e0a['query']);_0x50c541[_0x5a15('0x35')]=_[_0x5a15('0x36')](_0x4a7e0a['model'],qs[_0x5a15('0x37')](_0x16a687[_0x5a15('0x32')][_0x5a15('0x37')]));_0x50c541[_0x5a15('0x35')]=_0x50c541[_0x5a15('0x35')][_0x5a15('0x38')]?_0x50c541['attributes']:_0x4a7e0a['model'];if(!_0x16a687['query'][_0x5a15('0x39')]('nolimit')){_0x50c541[_0x5a15('0x1d')]=qs[_0x5a15('0x1d')](_0x16a687['query'][_0x5a15('0x1d')]);_0x50c541[_0x5a15('0x20')]=qs[_0x5a15('0x20')](_0x16a687['query'][_0x5a15('0x20')]);}_0x50c541['order']=qs[_0x5a15('0x3a')](_0x16a687[_0x5a15('0x32')][_0x5a15('0x3a')]);_0x50c541[_0x5a15('0x3b')]=qs['filters'](_[_0x5a15('0x3c')](_0x16a687[_0x5a15('0x32')],_0x4a7e0a['filters']),_0x382336);if(_0x16a687[_0x5a15('0x32')][_0x5a15('0x3d')]){_0x50c541[_0x5a15('0x3b')]=_[_0x5a15('0x3e')](_0x50c541[_0x5a15('0x3b')],{'$or':_['map'](_0x382336,function(_0x216ea1){if(_0x216ea1[_0x5a15('0x30')]!=='VIRTUAL'){var _0x3fea80={};_0x3fea80[_0x216ea1['name']]={'$like':'%'+_0x16a687[_0x5a15('0x32')][_0x5a15('0x3d')]+'%'};return _0x3fea80;}})});}_0x50c541=_[_0x5a15('0x3e')]({},_0x50c541,_0x16a687[_0x5a15('0x3f')]);var _0x56940e={'where':_0x50c541['where']};return db['SalesforceAccount'][_0x5a15('0x1f')](_0x56940e)[_0x5a15('0x27')](function(_0x2a3b56){_0xeff37b['count']=_0x2a3b56;if(_0x16a687[_0x5a15('0x32')][_0x5a15('0x40')]){_0x50c541['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x50c541);})[_0x5a15('0x27')](function(_0x474cbb){_0xeff37b['rows']=_0x474cbb;return _0xeff37b;})[_0x5a15('0x27')](respondWithFilteredResult(_0xbb7385,_0x50c541))['catch'](handleError(_0xbb7385,null));};exports['show']=function(_0xc68eb,_0x424f33){var _0x41121a={'raw':![],'where':{'id':_0xc68eb[_0x5a15('0x41')]['id']}},_0x52f172={};_0x52f172[_0x5a15('0x31')]=_[_0x5a15('0x33')](db[_0x5a15('0x2d')][_0x5a15('0x2e')]);_0x52f172[_0x5a15('0x32')]=_[_0x5a15('0x33')](_0xc68eb['query']);_0x52f172[_0x5a15('0x34')]=_[_0x5a15('0x36')](_0x52f172[_0x5a15('0x31')],_0x52f172[_0x5a15('0x32')]);_0x41121a['attributes']=_[_0x5a15('0x36')](_0x52f172['model'],qs[_0x5a15('0x37')](_0xc68eb[_0x5a15('0x32')][_0x5a15('0x37')]));_0x41121a['attributes']=_0x41121a[_0x5a15('0x35')][_0x5a15('0x38')]?_0x41121a[_0x5a15('0x35')]:_0x52f172[_0x5a15('0x31')];if(_0xc68eb['query']['includeAll']){_0x41121a[_0x5a15('0x42')]=[{'all':!![]}];}_0x41121a=_[_0x5a15('0x3e')]({},_0x41121a,_0xc68eb[_0x5a15('0x3f')]);return db[_0x5a15('0x2d')][_0x5a15('0x43')](_0x41121a)[_0x5a15('0x27')](handleEntityNotFound(_0x424f33,null))[_0x5a15('0x27')](respondWithResult(_0x424f33,null))['catch'](handleError(_0x424f33,null));};exports['create']=function(_0x3d8910,_0x421f2a){return db[_0x5a15('0x2d')][_0x5a15('0x44')](_0x3d8910[_0x5a15('0x45')],{})[_0x5a15('0x27')](respondWithResult(_0x421f2a,0xc9))[_0x5a15('0x46')](handleError(_0x421f2a,null));};exports[_0x5a15('0x26')]=function(_0x1ec411,_0x30872d){if(_0x1ec411['body']['id']){delete _0x1ec411[_0x5a15('0x45')]['id'];}return db['SalesforceAccount'][_0x5a15('0x43')]({'where':{'id':_0x1ec411[_0x5a15('0x41')]['id']}})[_0x5a15('0x27')](handleEntityNotFound(_0x30872d,null))[_0x5a15('0x27')](saveUpdates(_0x1ec411['body'],null))['then'](respondWithResult(_0x30872d,null))[_0x5a15('0x46')](handleError(_0x30872d,null));};exports['destroy']=function(_0x2407ce,_0xb66945){return db[_0x5a15('0x2d')][_0x5a15('0x43')]({'where':{'id':_0x2407ce[_0x5a15('0x41')]['id']}})[_0x5a15('0x27')](handleEntityNotFound(_0xb66945,null))[_0x5a15('0x27')](removeEntity(_0xb66945,null))[_0x5a15('0x46')](handleError(_0xb66945,null));};exports[_0x5a15('0x47')]=function(_0x20b5f2,_0x100312,_0x1b2a67){var _0x2042f0={};var _0x4b885a={};var _0x4413da;var _0x4829e4;return db[_0x5a15('0x2d')][_0x5a15('0x48')]({'where':{'id':_0x20b5f2[_0x5a15('0x41')]['id']}})[_0x5a15('0x27')](handleEntityNotFound(_0x100312,null))[_0x5a15('0x27')](function(_0x480453){if(_0x480453){_0x4413da=_0x480453;_0x4b885a[_0x5a15('0x31')]=_['keys'](db[_0x5a15('0x49')]['rawAttributes']);_0x4b885a[_0x5a15('0x32')]=_[_0x5a15('0x33')](_0x20b5f2[_0x5a15('0x32')]);_0x4b885a[_0x5a15('0x34')]=_[_0x5a15('0x36')](_0x4b885a[_0x5a15('0x31')],_0x4b885a[_0x5a15('0x32')]);_0x2042f0[_0x5a15('0x35')]=_[_0x5a15('0x36')](_0x4b885a['model'],qs[_0x5a15('0x37')](_0x20b5f2['query'][_0x5a15('0x37')]));_0x2042f0[_0x5a15('0x35')]=_0x2042f0[_0x5a15('0x35')][_0x5a15('0x38')]?_0x2042f0[_0x5a15('0x35')]:_0x4b885a[_0x5a15('0x31')];_0x2042f0[_0x5a15('0x4a')]=qs['sort'](_0x20b5f2[_0x5a15('0x32')][_0x5a15('0x3a')]);_0x2042f0[_0x5a15('0x3b')]=qs[_0x5a15('0x34')](_[_0x5a15('0x3c')](_0x20b5f2['query'],_0x4b885a[_0x5a15('0x34')]));if(_0x20b5f2[_0x5a15('0x32')][_0x5a15('0x3d')]){_0x2042f0[_0x5a15('0x3b')]=_[_0x5a15('0x3e')](_0x2042f0[_0x5a15('0x3b')],{'$or':_['map'](_0x2042f0[_0x5a15('0x35')],function(_0x115ee3){var _0x7da99={};_0x7da99[_0x115ee3]={'$like':'%'+_0x20b5f2[_0x5a15('0x32')][_0x5a15('0x3d')]+'%'};return _0x7da99;})});}_0x2042f0=_['merge']({},_0x2042f0,_0x20b5f2[_0x5a15('0x3f')]);return _0x4413da['getConfigurations'](_0x2042f0);}})[_0x5a15('0x27')](function(_0xb1ff5b){if(_0xb1ff5b){_0x4829e4=_0xb1ff5b[_0x5a15('0x38')];if(!_0x20b5f2[_0x5a15('0x32')]['hasOwnProperty'](_0x5a15('0x4b'))){_0x2042f0[_0x5a15('0x1d')]=qs[_0x5a15('0x1d')](_0x20b5f2[_0x5a15('0x32')][_0x5a15('0x1d')]);_0x2042f0[_0x5a15('0x20')]=qs[_0x5a15('0x20')](_0x20b5f2[_0x5a15('0x32')]['offset']);}return _0x4413da['getConfigurations'](_0x2042f0);}})[_0x5a15('0x27')](function(_0x2609cf){if(_0x2609cf){return _0x2609cf?{'count':_0x4829e4,'rows':_0x2609cf}:null;}})['then'](respondWithResult(_0x100312,null))['catch'](handleError(_0x100312,null));};exports['addConfiguration']=function(_0x179c4a,_0x2a0c3a,_0x1cc235){if(_0x179c4a[_0x5a15('0x45')]['id']){delete _0x179c4a['body']['id'];}return db[_0x5a15('0x2d')]['findOne']({'where':{'id':_0x179c4a[_0x5a15('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0c3a,null))[_0x5a15('0x27')](function(_0x12731e){if(_0x12731e){_0x179c4a[_0x5a15('0x45')][_0x5a15('0x4c')]=_0x12731e['id'];_0x179c4a['body'][_0x5a15('0x4d')]=integrations[_0x5a15('0x4e')](_0x179c4a[_0x5a15('0x45')][_0x5a15('0x4f')],_0x179c4a['body'][_0x5a15('0x30')]);_0x179c4a['body']['Descriptions']=integrations[_0x5a15('0x50')](_0x179c4a['body']['channel'],_0x179c4a['body'][_0x5a15('0x30')]);return db[_0x5a15('0x49')][_0x5a15('0x44')](_0x179c4a[_0x5a15('0x45')],{'include':[{'model':db[_0x5a15('0x51')],'as':'Subjects'},{'model':db[_0x5a15('0x51')],'as':_0x5a15('0x52')}]});}return null;})[_0x5a15('0x27')](respondWithResult(_0x2a0c3a,null))['catch'](handleError(_0x2a0c3a,null));};exports[_0x5a15('0x53')]=function(_0x3d6e66,_0x2472c0,_0x598ba4){var _0x305d48;var _0x3c8d15='';var _0x5a56b0=_0x5a15('0x54');return db[_0x5a15('0x2d')][_0x5a15('0x48')]({'where':{'id':_0x3d6e66[_0x5a15('0x41')]['id']},'attributes':['id','remoteUri',_0x5a15('0x55'),_0x5a15('0x56'),_0x5a15('0x57'),'password',_0x5a15('0x58')]})[_0x5a15('0x27')](handleEntityNotFound(_0x2472c0,null))[_0x5a15('0x27')](function(_0x1b7014){if(_0x1b7014){_0x3c8d15=_0x1b7014[_0x5a15('0x59')];var _0x3c2267=_0x3c8d15['slice'](-0x1);if(_0x3c2267==='/'){_0x3c8d15=_0x3c8d15[_0x5a15('0x5a')](0x0,_0x3c8d15[_0x5a15('0x5b')](_0x3c2267));}_0x305d48=new jsforce[(_0x5a15('0x5c'))]({'oauth2':{'loginUrl':_0x3c8d15,'clientId':_0x1b7014[_0x5a15('0x55')],'clientSecret':_0x1b7014['clientSecret']}});return _0x305d48['login'](_0x1b7014[_0x5a15('0x57')],_0x1b7014[_0x5a15('0x5d')][_0x5a15('0x5e')](_0x1b7014['securityToken']));}})[_0x5a15('0x27')](function(_0x1d158b){if(_0x1d158b){if(!_[_0x5a15('0x5f')](_0x3d6e66[_0x5a15('0x32')][_0x5a15('0x60')])){_0x5a56b0=_0x3d6e66[_0x5a15('0x32')][_0x5a15('0x60')];}return _0x305d48['sobject'](_0x5a56b0)[_0x5a15('0x61')]();}})[_0x5a15('0x27')](function(_0x1150ae){var _0x32722e=[_0x5a15('0x62'),_0x5a15('0x63'),_0x5a15('0x64'),'IsRecurrence',_0x5a15('0x65'),_0x5a15('0x66')];var _0x162ac8=['string',_0x5a15('0x67'),'picklist',_0x5a15('0x68'),'email',_0x5a15('0x69'),_0x5a15('0x6a')];if(_0x1150ae){_['remove'](_0x1150ae[_0x5a15('0x37')],function(_0x407854){return _0x32722e['includes'](_0x407854[_0x5a15('0x29')])||!_0x162ac8['includes'](_0x407854[_0x5a15('0x30')]);});return{'count':_0x1150ae[_0x5a15('0x37')][_0x5a15('0x38')],'rows':_[_0x5a15('0x2c')](_0x1150ae[_0x5a15('0x37')],function(_0x17f235){return{'id':_0x17f235[_0x5a15('0x29')],'name':_0x17f235[_0x5a15('0x6b')],'custom':_0x17f235[_0x5a15('0x6c')],'options':_0x17f235[_0x5a15('0x6d')][_0x5a15('0x38')]>0x0?_[_0x5a15('0x2c')](_0x17f235[_0x5a15('0x6d')],function(_0x3803a8){return{'name':_0x3803a8[_0x5a15('0x6b')],'value':_0x3803a8[_0x5a15('0x6e')]};}):_0x17f235[_0x5a15('0x30')]=='boolean'?[{'name':_0x5a15('0x6f'),'value':_0x5a15('0x70')},{'name':_0x5a15('0x71'),'value':'false'}]:[]};})};}})[_0x5a15('0x27')](respondWithResult(_0x2472c0,null))[_0x5a15('0x46')](function(_0x318066){var _0x3d7e80=_0x3d6e66[_0x5a15('0x32')][_0x5a15('0x72')]?0x1f4:_0x318066[_0x5a15('0x73')]||0x1f4;logger[_0x5a15('0x74')](_0x5a15('0x75'),_0x5a15('0x53'),_0x3d7e80,JSON[_0x5a15('0x76')](_0x318066));delete _0x318066[_0x5a15('0x29')];if(_0x3d7e80===0x191){_0x3d7e80=0x190;}_0x2472c0['status'](_0x3d7e80)[_0x5a15('0x2a')](_0x3d6e66[_0x5a15('0x32')][_0x5a15('0x72')]?{'message':_0x5a15('0x77'),'statusCode':_0x318066[_0x5a15('0x73')]}:_0x318066);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5f66db8..8fed7da 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 _0x0d00=['exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x5d133f,_0x3c2ac9){var _0x15b16a=function(_0x2d8896){while(--_0x2d8896){_0x5d133f['push'](_0x5d133f['shift']());}};_0x15b16a(++_0x3c2ac9);}(_0x0d00,0x189));var _0x00d0=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x0d00[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var logger=require(_0x00d0('0x2'))(_0x00d0('0x3'));var moment=require(_0x00d0('0x4'));var BPromise=require(_0x00d0('0x5'));var rp=require(_0x00d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00d0('0x7'));var config=require(_0x00d0('0x8'));var attributes=require(_0x00d0('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x00d0('0xa')]=function(_0x5fe624,_0x16d47d){return _0x5fe624['define'](_0x00d0('0xb'),attributes,{'tableName':_0x00d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6250=['define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2336d6,_0xc77af7){var _0x10399c=function(_0x199eab){while(--_0x199eab){_0x2336d6['push'](_0x2336d6['shift']());}};_0x10399c(++_0xc77af7);}(_0x6250,0x91));var _0x0625=function(_0xd40666,_0x35b1d2){_0xd40666=_0xd40666-0x0;var _0x1bee4a=_0x6250[_0xd40666];return _0x1bee4a;};'use strict';var _=require(_0x0625('0x0'));var util=require(_0x0625('0x1'));var logger=require(_0x0625('0x2'))(_0x0625('0x3'));var moment=require(_0x0625('0x4'));var BPromise=require(_0x0625('0x5'));var rp=require(_0x0625('0x6'));var fs=require('fs');var path=require(_0x0625('0x7'));var rimraf=require('rimraf');var config=require(_0x0625('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0625('0x9'));module[_0x0625('0xa')]=function(_0x67269a,_0x48bea1){return _0x67269a[_0x0625('0xb')](_0x0625('0xc'),attributes,{'tableName':'int_salesforce_accounts','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 e2a711e..f6909b9 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 _0x4fe2=['result','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','map','include','model','catch','ShowSalesforceAccount','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x297630,_0x20d4f8){var _0x57a9ee=function(_0x474bc4){while(--_0x474bc4){_0x297630['push'](_0x297630['shift']());}};_0x57a9ee(++_0x20d4f8);}(_0x4fe2,0x8e));var _0x24fe=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4fe2[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x24fe('0x0'));var util=require('util');var moment=require(_0x24fe('0x1'));var BPromise=require(_0x24fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fe('0x3'));var db=require(_0x24fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24fe('0x5'))('rpc');var config=require(_0x24fe('0x6'));var jayson=require(_0x24fe('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2074,_0x1dd35f,_0x393a70){return new BPromise(function(_0x1a7b06,_0x403cee){return client[_0x24fe('0x8')](_0x4e2074,_0x393a70)[_0x24fe('0x9')](function(_0x2e4cc5){logger[_0x24fe('0xa')](_0x24fe('0xb'),_0x1dd35f,_0x24fe('0xc'));logger[_0x24fe('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1dd35f,_0x24fe('0xc'),JSON[_0x24fe('0xe')](_0x2e4cc5));if(_0x2e4cc5['error']){if(_0x2e4cc5[_0x24fe('0xf')][_0x24fe('0x10')]===0x1f4){logger[_0x24fe('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x1dd35f,_0x2e4cc5[_0x24fe('0xf')]['message']);return _0x403cee(_0x2e4cc5['error']['message']);}logger[_0x24fe('0xf')](_0x24fe('0xb'),_0x1dd35f,_0x2e4cc5['error'][_0x24fe('0x11')]);return _0x1a7b06(_0x2e4cc5[_0x24fe('0xf')][_0x24fe('0x11')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1dd35f,_0x24fe('0xc'));_0x1a7b06(_0x2e4cc5[_0x24fe('0x12')]['message']);}})['catch'](function(_0x217259){logger[_0x24fe('0xf')](_0x24fe('0xb'),_0x1dd35f,_0x217259);_0x403cee(_0x217259);});});}exports[_0x24fe('0x13')]=function(_0x22029e){var _0x21dcd7=this;return new Promise(function(_0x1980dc,_0x5a0df5){return db[_0x24fe('0x14')]['findAll']({'raw':_0x22029e['options']?_0x22029e[_0x24fe('0x15')][_0x24fe('0x16')]===undefined?!![]:![]:!![],'where':_0x22029e[_0x24fe('0x15')]?_0x22029e[_0x24fe('0x15')]['where']||null:null,'attributes':_0x22029e[_0x24fe('0x15')]?_0x22029e[_0x24fe('0x15')][_0x24fe('0x17')]||null:null,'limit':_0x22029e[_0x24fe('0x15')]?_0x22029e[_0x24fe('0x15')][_0x24fe('0x18')]||null:null,'include':_0x22029e['options']?_0x22029e[_0x24fe('0x15')]['include']?_[_0x24fe('0x19')](_0x22029e['options'][_0x24fe('0x1a')],function(_0x222f26){return{'model':db[_0x222f26['model']],'as':_0x222f26['as'],'attributes':_0x222f26['attributes'],'include':_0x222f26[_0x24fe('0x1a')]?_['map'](_0x222f26[_0x24fe('0x1a')],function(_0x30b49a){return{'model':db[_0x30b49a[_0x24fe('0x1b')]],'as':_0x30b49a['as'],'attributes':_0x30b49a['attributes'],'include':_0x30b49a[_0x24fe('0x1a')]?_['map'](_0x30b49a[_0x24fe('0x1a')],function(_0x4301aa){return{'model':db[_0x4301aa[_0x24fe('0x1b')]],'as':_0x4301aa['as'],'attributes':_0x4301aa['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fe('0x9')](function(_0x1c8847){logger[_0x24fe('0xa')]('GetSalesforceAccount',_0x22029e);logger['debug']('GetSalesforceAccount',_0x22029e,JSON[_0x24fe('0xe')](_0x1c8847));_0x1980dc(_0x1c8847);})[_0x24fe('0x1c')](function(_0x3ea22a){logger[_0x24fe('0xf')](_0x24fe('0x13'),_0x3ea22a['message'],_0x22029e);_0x5a0df5(_0x21dcd7[_0x24fe('0xf')](0x1f4,_0x3ea22a[_0x24fe('0x11')]));});});};exports[_0x24fe('0x1d')]=function(_0x11782b){var _0x2299ed=this;return new Promise(function(_0x508044,_0xd07b6f){return db[_0x24fe('0x14')][_0x24fe('0x1e')]({'raw':_0x11782b['options']?_0x11782b[_0x24fe('0x15')][_0x24fe('0x16')]===undefined?!![]:![]:!![],'where':_0x11782b[_0x24fe('0x15')]?_0x11782b[_0x24fe('0x15')][_0x24fe('0x1f')]||null:null,'attributes':_0x11782b[_0x24fe('0x15')]?_0x11782b[_0x24fe('0x15')][_0x24fe('0x17')]||null:null,'include':_0x11782b[_0x24fe('0x15')]?_0x11782b[_0x24fe('0x15')][_0x24fe('0x1a')]?_['map'](_0x11782b[_0x24fe('0x15')][_0x24fe('0x1a')],function(_0x34aa4b){return{'model':db[_0x34aa4b[_0x24fe('0x1b')]],'as':_0x34aa4b['as'],'attributes':_0x34aa4b[_0x24fe('0x17')],'include':_0x34aa4b[_0x24fe('0x1a')]?_[_0x24fe('0x19')](_0x34aa4b[_0x24fe('0x1a')],function(_0x5f4480){return{'model':db[_0x5f4480[_0x24fe('0x1b')]],'as':_0x5f4480['as'],'attributes':_0x5f4480[_0x24fe('0x17')],'include':_0x5f4480[_0x24fe('0x1a')]?_[_0x24fe('0x19')](_0x5f4480[_0x24fe('0x1a')],function(_0x4694cd){return{'model':db[_0x4694cd[_0x24fe('0x1b')]],'as':_0x4694cd['as'],'attributes':_0x4694cd[_0x24fe('0x17')]};}):[]};}):[]};}):[]:[]})[_0x24fe('0x9')](function(_0x42d491){logger[_0x24fe('0xa')]('ShowSalesforceAccount',_0x11782b);logger[_0x24fe('0xd')](_0x24fe('0x1d'),_0x11782b,JSON['stringify'](_0x42d491));_0x508044(_0x42d491);})[_0x24fe('0x1c')](function(_0x62e817){logger[_0x24fe('0xf')](_0x24fe('0x1d'),_0x62e817[_0x24fe('0x11')],_0x11782b);_0xd07b6f(_0x2299ed[_0x24fe('0xf')](0x1f4,_0x62e817[_0x24fe('0x11')]));});});}; \ No newline at end of file +var _0xfa94=['rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','then','ShowSalesforceAccount','find','where','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5981de,_0x5d0670){var _0x517fa5=function(_0x11948c){while(--_0x11948c){_0x5981de['push'](_0x5981de['shift']());}};_0x517fa5(++_0x5d0670);}(_0xfa94,0xef));var _0x4fa9=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0xfa94[_0x49cb71];return _0x3a50fd;};'use strict';var _=require(_0x4fa9('0x0'));var util=require('util');var moment=require(_0x4fa9('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fa9('0x2'));var fs=require('fs');var Redis=require(_0x4fa9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4fa9('0x4'));var logger=require(_0x4fa9('0x5'))(_0x4fa9('0x6'));var config=require(_0x4fa9('0x7'));var jayson=require(_0x4fa9('0x8'));var client=jayson[_0x4fa9('0x9')][_0x4fa9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56faa9,_0xd4dcad,_0x2fb0b3){return new BPromise(function(_0x48fe52,_0x500b64){return client[_0x4fa9('0xb')](_0x56faa9,_0x2fb0b3)['then'](function(_0x2049ea){logger[_0x4fa9('0xc')](_0x4fa9('0xd'),_0xd4dcad,'request\x20sent');logger[_0x4fa9('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xd4dcad,_0x4fa9('0xf'),JSON[_0x4fa9('0x10')](_0x2049ea));if(_0x2049ea['error']){if(_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x12')]===0x1f4){logger[_0x4fa9('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0xd4dcad,_0x2049ea[_0x4fa9('0x11')]['message']);return _0x500b64(_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x13')]);}logger['error'](_0x4fa9('0xd'),_0xd4dcad,_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x13')]);return _0x48fe52(_0x2049ea[_0x4fa9('0x11')][_0x4fa9('0x13')]);}else{logger[_0x4fa9('0xc')](_0x4fa9('0xd'),_0xd4dcad,_0x4fa9('0xf'));_0x48fe52(_0x2049ea[_0x4fa9('0x14')]['message']);}})[_0x4fa9('0x15')](function(_0x1a1117){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xd4dcad,_0x1a1117);_0x500b64(_0x1a1117);});});}exports[_0x4fa9('0x16')]=function(_0x4f58bd){var _0x2fe920=this;return new Promise(function(_0x416e08,_0x50a0d9){return db[_0x4fa9('0x17')]['findAll']({'raw':_0x4f58bd[_0x4fa9('0x18')]?_0x4f58bd[_0x4fa9('0x18')][_0x4fa9('0x19')]===undefined?!![]:![]:!![],'where':_0x4f58bd[_0x4fa9('0x18')]?_0x4f58bd[_0x4fa9('0x18')]['where']||null:null,'attributes':_0x4f58bd[_0x4fa9('0x18')]?_0x4f58bd[_0x4fa9('0x18')][_0x4fa9('0x1a')]||null:null,'limit':_0x4f58bd['options']?_0x4f58bd[_0x4fa9('0x18')][_0x4fa9('0x1b')]||null:null,'include':_0x4f58bd[_0x4fa9('0x18')]?_0x4f58bd[_0x4fa9('0x18')][_0x4fa9('0x1c')]?_[_0x4fa9('0x1d')](_0x4f58bd[_0x4fa9('0x18')][_0x4fa9('0x1c')],function(_0x185806){return{'model':db[_0x185806[_0x4fa9('0x1e')]],'as':_0x185806['as'],'attributes':_0x185806[_0x4fa9('0x1a')],'include':_0x185806[_0x4fa9('0x1c')]?_[_0x4fa9('0x1d')](_0x185806[_0x4fa9('0x1c')],function(_0x1d00c9){return{'model':db[_0x1d00c9[_0x4fa9('0x1e')]],'as':_0x1d00c9['as'],'attributes':_0x1d00c9[_0x4fa9('0x1a')],'include':_0x1d00c9[_0x4fa9('0x1c')]?_[_0x4fa9('0x1d')](_0x1d00c9[_0x4fa9('0x1c')],function(_0x498a6f){return{'model':db[_0x498a6f[_0x4fa9('0x1e')]],'as':_0x498a6f['as'],'attributes':_0x498a6f[_0x4fa9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4fa9('0x1f')](function(_0xdeffbf){logger[_0x4fa9('0xc')](_0x4fa9('0x16'),_0x4f58bd);logger[_0x4fa9('0xe')]('GetSalesforceAccount',_0x4f58bd,JSON[_0x4fa9('0x10')](_0xdeffbf));_0x416e08(_0xdeffbf);})[_0x4fa9('0x15')](function(_0x13cf76){logger[_0x4fa9('0x11')](_0x4fa9('0x16'),_0x13cf76[_0x4fa9('0x13')],_0x4f58bd);_0x50a0d9(_0x2fe920[_0x4fa9('0x11')](0x1f4,_0x13cf76[_0x4fa9('0x13')]));});});};exports[_0x4fa9('0x20')]=function(_0x472173){var _0x1efb9d=this;return new Promise(function(_0x8aae26,_0x3b4b88){return db[_0x4fa9('0x17')][_0x4fa9('0x21')]({'raw':_0x472173[_0x4fa9('0x18')]?_0x472173[_0x4fa9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x472173[_0x4fa9('0x18')]?_0x472173[_0x4fa9('0x18')][_0x4fa9('0x22')]||null:null,'attributes':_0x472173[_0x4fa9('0x18')]?_0x472173[_0x4fa9('0x18')][_0x4fa9('0x1a')]||null:null,'include':_0x472173['options']?_0x472173[_0x4fa9('0x18')][_0x4fa9('0x1c')]?_[_0x4fa9('0x1d')](_0x472173['options'][_0x4fa9('0x1c')],function(_0x4c14fd){return{'model':db[_0x4c14fd['model']],'as':_0x4c14fd['as'],'attributes':_0x4c14fd[_0x4fa9('0x1a')],'include':_0x4c14fd['include']?_[_0x4fa9('0x1d')](_0x4c14fd[_0x4fa9('0x1c')],function(_0x2e9e10){return{'model':db[_0x2e9e10[_0x4fa9('0x1e')]],'as':_0x2e9e10['as'],'attributes':_0x2e9e10['attributes'],'include':_0x2e9e10[_0x4fa9('0x1c')]?_[_0x4fa9('0x1d')](_0x2e9e10[_0x4fa9('0x1c')],function(_0x4c070e){return{'model':db[_0x4c070e[_0x4fa9('0x1e')]],'as':_0x4c070e['as'],'attributes':_0x4c070e[_0x4fa9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4fa9('0x1f')](function(_0x35393e){logger[_0x4fa9('0xc')](_0x4fa9('0x20'),_0x472173);logger[_0x4fa9('0xe')](_0x4fa9('0x20'),_0x472173,JSON[_0x4fa9('0x10')](_0x35393e));_0x8aae26(_0x35393e);})[_0x4fa9('0x15')](function(_0x2781d5){logger[_0x4fa9('0x11')]('ShowSalesforceAccount',_0x2781d5[_0x4fa9('0x13')],_0x472173);_0x3b4b88(_0x1efb9d['error'](0x1f4,_0x2781d5['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index cff5851..0005512 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34750b,_0x34aae5){_0x34750b=_0x34750b-0x0;var _0x244258=_0x0b0e[_0x34750b];return _0x244258;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2032,0xd9));var _0x2203=function(_0xa4409,_0x341e71){_0xa4409=_0xa4409-0x0;var _0x19ff69=_0x2032[_0xa4409];return _0x19ff69;};'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/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 09d6585..8381033 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 _0xe74c=['sequelize','exports','STRING','Task','Case','ENUM','lead','account_contact_lead','contact_lead','contact','account'];(function(_0xb58bc2,_0x3fff5f){var _0x3902d6=function(_0x3e3855){while(--_0x3e3855){_0xb58bc2['push'](_0xb58bc2['shift']());}};_0x3902d6(++_0x3fff5f);}(_0xe74c,0xf2));var _0xce74=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xe74c[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0xce74('0x0'));module[_0xce74('0x1')]={'name':{'type':Sequelize[_0xce74('0x2')]},'description':{'type':Sequelize[_0xce74('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xce74('0x3'),_0xce74('0x4')),'defaultValue':_0xce74('0x3')},'moduleSearch':{'type':Sequelize[_0xce74('0x5')]('contact_lead','contact',_0xce74('0x6'),_0xce74('0x7'),'account'),'defaultValue':_0xce74('0x8')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xce74('0x9'),_0xce74('0x6'),_0xce74('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xce74('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xce74('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xce74('0x2')]}}; \ No newline at end of file +var _0x89b5=['contact_lead','contact','lead','account_contact_lead','account','exports','STRING','ENUM','Case','Task'];(function(_0x14fd67,_0x3c30ab){var _0x4fad42=function(_0x837d61){while(--_0x837d61){_0x14fd67['push'](_0x14fd67['shift']());}};_0x4fad42(++_0x3c30ab);}(_0x89b5,0x16d));var _0x589b=function(_0x44bad3,_0x3f390f){_0x44bad3=_0x44bad3-0x0;var _0x2a85b4=_0x89b5[_0x44bad3];return _0x2a85b4;};'use strict';var Sequelize=require('sequelize');module[_0x589b('0x0')]={'name':{'type':Sequelize[_0x589b('0x1')]},'description':{'type':Sequelize[_0x589b('0x1')]},'ticketType':{'type':Sequelize[_0x589b('0x2')]('Task',_0x589b('0x3')),'defaultValue':_0x589b('0x4')},'moduleSearch':{'type':Sequelize[_0x589b('0x2')](_0x589b('0x5'),_0x589b('0x6'),_0x589b('0x7'),_0x589b('0x8'),_0x589b('0x9')),'defaultValue':_0x589b('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x589b('0x6'),'lead',_0x589b('0x9')),'defaultValue':_0x589b('0x7')},'leadId':{'type':Sequelize[_0x589b('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x589b('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x589b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index fd2c2b8..82bf57e 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 _0xeb54=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SalesforceField','filter','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x31b2b6,_0x3a8c37){var _0x2c7544=function(_0x1a6458){while(--_0x1a6458){_0x31b2b6['push'](_0x31b2b6['shift']());}};_0x2c7544(++_0x3a8c37);}(_0xeb54,0x13f));var _0x4eb5=function(_0x32c723,_0x930b1e){_0x32c723=_0x32c723-0x0;var _0x5beda1=_0xeb54[_0x32c723];return _0x5beda1;};'use strict';var emlformat=require(_0x4eb5('0x0'));var rimraf=require(_0x4eb5('0x1'));var zipdir=require(_0x4eb5('0x2'));var jsonpatch=require(_0x4eb5('0x3'));var rp=require(_0x4eb5('0x4'));var moment=require(_0x4eb5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4eb5('0x6'));var util=require(_0x4eb5('0x7'));var path=require(_0x4eb5('0x8'));var sox=require(_0x4eb5('0x9'));var csv=require(_0x4eb5('0xa'));var ejs=require(_0x4eb5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb5('0xc'));var squel=require(_0x4eb5('0xd'));var crypto=require(_0x4eb5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4eb5('0xf'));var toCsv=require(_0x4eb5('0xa'));var querystring=require(_0x4eb5('0x10'));var Papa=require(_0x4eb5('0x11'));var Redis=require(_0x4eb5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4eb5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4eb5('0x14'))(_0x4eb5('0x15'));var utils=require(_0x4eb5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4eb5('0x17'));var db=require(_0x4eb5('0x18'))['db'];function respondWithStatusCode(_0x3541fc,_0x16e9f3){_0x16e9f3=_0x16e9f3||0xcc;return function(_0x35fe21){if(_0x35fe21){return _0x3541fc[_0x4eb5('0x19')](_0x16e9f3);}return _0x3541fc[_0x4eb5('0x1a')](_0x16e9f3)[_0x4eb5('0x1b')]();};}function respondWithResult(_0x233615,_0x50b595){_0x50b595=_0x50b595||0xc8;return function(_0x27ae91){if(_0x27ae91){return _0x233615[_0x4eb5('0x1a')](_0x50b595)[_0x4eb5('0x1c')](_0x27ae91);}};}function respondWithFilteredResult(_0x158e45,_0x2e8ff1){return function(_0x7da034){if(_0x7da034){var _0x33983d=typeof _0x2e8ff1[_0x4eb5('0x1d')]===_0x4eb5('0x1e')&&typeof _0x2e8ff1[_0x4eb5('0x1f')]===_0x4eb5('0x1e');var _0x5687aa=_0x7da034[_0x4eb5('0x20')];var _0x39a3d4=_0x33983d?0x0:_0x2e8ff1[_0x4eb5('0x1d')];var _0x20b6ef=_0x33983d?_0x7da034[_0x4eb5('0x20')]:_0x2e8ff1[_0x4eb5('0x1d')]+_0x2e8ff1[_0x4eb5('0x1f')];var _0x505d30;if(_0x20b6ef>=_0x5687aa){_0x20b6ef=_0x5687aa;_0x505d30=0xc8;}else{_0x505d30=0xce;}_0x158e45['status'](_0x505d30);return _0x158e45['set'](_0x4eb5('0x21'),_0x39a3d4+'-'+_0x20b6ef+'/'+_0x5687aa)['json'](_0x7da034);}return null;};}function patchUpdates(_0xe165e5){return function(_0x23e3d7){try{jsonpatch[_0x4eb5('0x22')](_0x23e3d7,_0xe165e5,!![]);}catch(_0x5bee1e){return BPromise[_0x4eb5('0x23')](_0x5bee1e);}return _0x23e3d7['save']();};}function saveUpdates(_0x20a0e0,_0x104282){return function(_0x57accf){if(_0x57accf){return _0x57accf[_0x4eb5('0x24')](_0x20a0e0)[_0x4eb5('0x25')](function(_0x5712bf){return _0x5712bf;});}return null;};}function removeEntity(_0x3c64e2,_0x19ab26){return function(_0x166e5a){if(_0x166e5a){return _0x166e5a[_0x4eb5('0x26')]()[_0x4eb5('0x25')](function(){_0x3c64e2[_0x4eb5('0x1a')](0xcc)[_0x4eb5('0x1b')]();});}};}function handleEntityNotFound(_0x694114,_0x13782d){return function(_0x1dbf30){if(!_0x1dbf30){_0x694114['sendStatus'](0x194);}return _0x1dbf30;};}function handleError(_0x202c53,_0x428b8f){_0x428b8f=_0x428b8f||0x1f4;return function(_0x4de80d){logger[_0x4eb5('0x27')](_0x4de80d[_0x4eb5('0x28')]);if(_0x4de80d['name']){delete _0x4de80d[_0x4eb5('0x29')];}_0x202c53['status'](_0x428b8f)[_0x4eb5('0x2a')](_0x4de80d);};}exports[_0x4eb5('0x2b')]=function(_0x3d6d4e,_0x4ce919){var _0x5f9d74={},_0x3b821e={},_0x4e9007={'count':0x0,'rows':[]};var _0x42be35=_[_0x4eb5('0x2c')](db['SalesforceConfiguration'][_0x4eb5('0x2d')],function(_0x48bd07){return{'name':_0x48bd07[_0x4eb5('0x2e')],'type':_0x48bd07[_0x4eb5('0x2f')][_0x4eb5('0x30')]};});_0x3b821e[_0x4eb5('0x31')]=_[_0x4eb5('0x2c')](_0x42be35,'name');_0x3b821e[_0x4eb5('0x32')]=_[_0x4eb5('0x33')](_0x3d6d4e[_0x4eb5('0x32')]);_0x3b821e[_0x4eb5('0x34')]=_[_0x4eb5('0x35')](_0x3b821e[_0x4eb5('0x31')],_0x3b821e[_0x4eb5('0x32')]);_0x5f9d74[_0x4eb5('0x36')]=_['intersection'](_0x3b821e[_0x4eb5('0x31')],qs[_0x4eb5('0x37')](_0x3d6d4e['query']['fields']));_0x5f9d74['attributes']=_0x5f9d74[_0x4eb5('0x36')][_0x4eb5('0x38')]?_0x5f9d74[_0x4eb5('0x36')]:_0x3b821e[_0x4eb5('0x31')];if(!_0x3d6d4e[_0x4eb5('0x32')]['hasOwnProperty'](_0x4eb5('0x39'))){_0x5f9d74['limit']=qs[_0x4eb5('0x1f')](_0x3d6d4e[_0x4eb5('0x32')][_0x4eb5('0x1f')]);_0x5f9d74['offset']=qs[_0x4eb5('0x1d')](_0x3d6d4e[_0x4eb5('0x32')]['offset']);}_0x5f9d74[_0x4eb5('0x3a')]=qs[_0x4eb5('0x3b')](_0x3d6d4e['query'][_0x4eb5('0x3b')]);_0x5f9d74[_0x4eb5('0x3c')]=qs[_0x4eb5('0x34')](_[_0x4eb5('0x3d')](_0x3d6d4e[_0x4eb5('0x32')],_0x3b821e[_0x4eb5('0x34')]),_0x42be35);if(_0x3d6d4e[_0x4eb5('0x32')]['filter']){_0x5f9d74[_0x4eb5('0x3c')]=_[_0x4eb5('0x3e')](_0x5f9d74[_0x4eb5('0x3c')],{'$or':_[_0x4eb5('0x2c')](_0x42be35,function(_0x47392a){if(_0x47392a[_0x4eb5('0x2f')]!==_0x4eb5('0x3f')){var _0x77bab5={};_0x77bab5[_0x47392a[_0x4eb5('0x29')]]={'$like':'%'+_0x3d6d4e[_0x4eb5('0x32')]['filter']+'%'};return _0x77bab5;}})});}_0x5f9d74=_[_0x4eb5('0x3e')]({},_0x5f9d74,_0x3d6d4e[_0x4eb5('0x40')]);var _0xc1f650={'where':_0x5f9d74[_0x4eb5('0x3c')]};return db[_0x4eb5('0x41')][_0x4eb5('0x20')](_0xc1f650)[_0x4eb5('0x25')](function(_0x185d6f){_0x4e9007[_0x4eb5('0x20')]=_0x185d6f;if(_0x3d6d4e[_0x4eb5('0x32')][_0x4eb5('0x42')]){_0x5f9d74[_0x4eb5('0x43')]=[{'all':!![]}];}return db[_0x4eb5('0x41')][_0x4eb5('0x44')](_0x5f9d74);})[_0x4eb5('0x25')](function(_0x51ba85){_0x4e9007[_0x4eb5('0x45')]=_0x51ba85;return _0x4e9007;})[_0x4eb5('0x25')](respondWithFilteredResult(_0x4ce919,_0x5f9d74))[_0x4eb5('0x46')](handleError(_0x4ce919,null));};exports[_0x4eb5('0x47')]=function(_0x322d61,_0x5aad45){var _0x4a9224={'raw':![],'where':{'id':_0x322d61[_0x4eb5('0x48')]['id']}},_0x491c11={};_0x491c11[_0x4eb5('0x31')]=_['keys'](db[_0x4eb5('0x41')]['rawAttributes']);_0x491c11[_0x4eb5('0x32')]=_[_0x4eb5('0x33')](_0x322d61[_0x4eb5('0x32')]);_0x491c11[_0x4eb5('0x34')]=_[_0x4eb5('0x35')](_0x491c11[_0x4eb5('0x31')],_0x491c11['query']);_0x4a9224[_0x4eb5('0x36')]=_[_0x4eb5('0x35')](_0x491c11[_0x4eb5('0x31')],qs[_0x4eb5('0x37')](_0x322d61['query'][_0x4eb5('0x37')]));_0x4a9224['attributes']=_0x4a9224['attributes'][_0x4eb5('0x38')]?_0x4a9224[_0x4eb5('0x36')]:_0x491c11[_0x4eb5('0x31')];if(_0x322d61[_0x4eb5('0x32')][_0x4eb5('0x42')]){_0x4a9224[_0x4eb5('0x43')]=[{'all':!![]}];}_0x4a9224=_[_0x4eb5('0x3e')]({},_0x4a9224,_0x322d61[_0x4eb5('0x40')]);return db[_0x4eb5('0x41')][_0x4eb5('0x49')](_0x4a9224)['then'](handleEntityNotFound(_0x5aad45,null))[_0x4eb5('0x25')](respondWithResult(_0x5aad45,null))[_0x4eb5('0x46')](handleError(_0x5aad45,null));};exports[_0x4eb5('0x4a')]=function(_0x49947e,_0x4a9181){return db['SalesforceConfiguration'][_0x4eb5('0x4a')](_0x49947e[_0x4eb5('0x4b')],{})[_0x4eb5('0x25')](respondWithResult(_0x4a9181,0xc9))[_0x4eb5('0x46')](handleError(_0x4a9181,null));};exports['update']=function(_0xcde1d5,_0x8a2eac){if(_0xcde1d5[_0x4eb5('0x4b')]['id']){delete _0xcde1d5[_0x4eb5('0x4b')]['id'];}return db[_0x4eb5('0x41')][_0x4eb5('0x49')]({'where':{'id':_0xcde1d5[_0x4eb5('0x48')]['id']}})['then'](handleEntityNotFound(_0x8a2eac,null))[_0x4eb5('0x25')](saveUpdates(_0xcde1d5[_0x4eb5('0x4b')],null))['then'](respondWithResult(_0x8a2eac,null))[_0x4eb5('0x46')](handleError(_0x8a2eac,null));};exports[_0x4eb5('0x26')]=function(_0x2f4d8d,_0x2ac5ef){return db[_0x4eb5('0x41')][_0x4eb5('0x49')]({'where':{'id':_0x2f4d8d['params']['id']}})[_0x4eb5('0x25')](handleEntityNotFound(_0x2ac5ef,null))['then'](removeEntity(_0x2ac5ef,null))['catch'](handleError(_0x2ac5ef,null));};exports[_0x4eb5('0x4c')]=function(_0x4e47ee,_0x270a73,_0x51ea7a){var _0x25e38a={};var _0x3c1162={};var _0x392141;var _0x224255;return db['SalesforceConfiguration'][_0x4eb5('0x4d')]({'where':{'id':_0x4e47ee[_0x4eb5('0x48')]['id']}})[_0x4eb5('0x25')](handleEntityNotFound(_0x270a73,null))[_0x4eb5('0x25')](function(_0x1eb296){if(_0x1eb296){_0x392141=_0x1eb296;_0x3c1162['model']=_[_0x4eb5('0x33')](db['SalesforceField']['rawAttributes']);_0x3c1162['query']=_['keys'](_0x4e47ee[_0x4eb5('0x32')]);_0x3c1162[_0x4eb5('0x34')]=_[_0x4eb5('0x35')](_0x3c1162[_0x4eb5('0x31')],_0x3c1162[_0x4eb5('0x32')]);_0x25e38a['attributes']=_[_0x4eb5('0x35')](_0x3c1162[_0x4eb5('0x31')],qs[_0x4eb5('0x37')](_0x4e47ee['query'][_0x4eb5('0x37')]));_0x25e38a[_0x4eb5('0x36')]=_0x25e38a[_0x4eb5('0x36')]['length']?_0x25e38a[_0x4eb5('0x36')]:_0x3c1162[_0x4eb5('0x31')];_0x25e38a[_0x4eb5('0x3a')]=qs[_0x4eb5('0x3b')](_0x4e47ee[_0x4eb5('0x32')]['sort']);_0x25e38a['where']=qs[_0x4eb5('0x34')](_[_0x4eb5('0x3d')](_0x4e47ee[_0x4eb5('0x32')],_0x3c1162[_0x4eb5('0x34')]));if(_0x4e47ee[_0x4eb5('0x32')]['filter']){_0x25e38a['where']=_[_0x4eb5('0x3e')](_0x25e38a[_0x4eb5('0x3c')],{'$or':_[_0x4eb5('0x2c')](_0x25e38a[_0x4eb5('0x36')],function(_0x5a7297){var _0x2a616c={};_0x2a616c[_0x5a7297]={'$like':'%'+_0x4e47ee[_0x4eb5('0x32')]['filter']+'%'};return _0x2a616c;})});}_0x25e38a=_[_0x4eb5('0x3e')]({},_0x25e38a,_0x4e47ee['options']);return _0x392141[_0x4eb5('0x4c')](_0x25e38a);}})[_0x4eb5('0x25')](function(_0x124e88){if(_0x124e88){_0x224255=_0x124e88[_0x4eb5('0x38')];if(!_0x4e47ee['query']['hasOwnProperty'](_0x4eb5('0x39'))){_0x25e38a[_0x4eb5('0x1f')]=qs[_0x4eb5('0x1f')](_0x4e47ee[_0x4eb5('0x32')]['limit']);_0x25e38a[_0x4eb5('0x1d')]=qs[_0x4eb5('0x1d')](_0x4e47ee[_0x4eb5('0x32')][_0x4eb5('0x1d')]);}return _0x392141[_0x4eb5('0x4c')](_0x25e38a);}})['then'](function(_0x21dcd7){if(_0x21dcd7){return _0x21dcd7?{'count':_0x224255,'rows':_0x21dcd7}:null;}})[_0x4eb5('0x25')](respondWithResult(_0x270a73,null))[_0x4eb5('0x46')](handleError(_0x270a73,null));};exports['getSubjects']=function(_0x4f1c1a,_0x387215,_0x2c8e6c){var _0x15efad={};var _0x2d9bf0={};var _0x5811fb;var _0x38e1d0;return db[_0x4eb5('0x41')][_0x4eb5('0x4d')]({'where':{'id':_0x4f1c1a['params']['id']}})[_0x4eb5('0x25')](handleEntityNotFound(_0x387215,null))['then'](function(_0x3d918c){if(_0x3d918c){_0x5811fb=_0x3d918c;_0x2d9bf0[_0x4eb5('0x31')]=_[_0x4eb5('0x33')](db[_0x4eb5('0x4e')]['rawAttributes']);_0x2d9bf0[_0x4eb5('0x32')]=_[_0x4eb5('0x33')](_0x4f1c1a[_0x4eb5('0x32')]);_0x2d9bf0[_0x4eb5('0x34')]=_[_0x4eb5('0x35')](_0x2d9bf0[_0x4eb5('0x31')],_0x2d9bf0[_0x4eb5('0x32')]);_0x15efad[_0x4eb5('0x36')]=_[_0x4eb5('0x35')](_0x2d9bf0[_0x4eb5('0x31')],qs[_0x4eb5('0x37')](_0x4f1c1a[_0x4eb5('0x32')]['fields']));_0x15efad[_0x4eb5('0x36')]=_0x15efad[_0x4eb5('0x36')][_0x4eb5('0x38')]?_0x15efad[_0x4eb5('0x36')]:_0x2d9bf0[_0x4eb5('0x31')];_0x15efad[_0x4eb5('0x3a')]=qs[_0x4eb5('0x3b')](_0x4f1c1a[_0x4eb5('0x32')][_0x4eb5('0x3b')]);_0x15efad[_0x4eb5('0x3c')]=qs[_0x4eb5('0x34')](_[_0x4eb5('0x3d')](_0x4f1c1a[_0x4eb5('0x32')],_0x2d9bf0['filters']));if(_0x4f1c1a[_0x4eb5('0x32')][_0x4eb5('0x4f')]){_0x15efad[_0x4eb5('0x3c')]=_[_0x4eb5('0x3e')](_0x15efad['where'],{'$or':_[_0x4eb5('0x2c')](_0x15efad['attributes'],function(_0x52ec62){var _0x411570={};_0x411570[_0x52ec62]={'$like':'%'+_0x4f1c1a[_0x4eb5('0x32')][_0x4eb5('0x4f')]+'%'};return _0x411570;})});}_0x15efad=_[_0x4eb5('0x3e')]({},_0x15efad,_0x4f1c1a[_0x4eb5('0x40')]);return _0x5811fb[_0x4eb5('0x50')](_0x15efad);}})['then'](function(_0x12f1b2){if(_0x12f1b2){_0x38e1d0=_0x12f1b2['length'];if(!_0x4f1c1a[_0x4eb5('0x32')][_0x4eb5('0x51')](_0x4eb5('0x39'))){_0x15efad['limit']=qs[_0x4eb5('0x1f')](_0x4f1c1a['query']['limit']);_0x15efad[_0x4eb5('0x1d')]=qs[_0x4eb5('0x1d')](_0x4f1c1a[_0x4eb5('0x32')][_0x4eb5('0x1d')]);}return _0x5811fb['getSubjects'](_0x15efad);}})[_0x4eb5('0x25')](function(_0x213571){if(_0x213571){return _0x213571?{'count':_0x38e1d0,'rows':_0x213571}:null;}})[_0x4eb5('0x25')](respondWithResult(_0x387215,null))['catch'](handleError(_0x387215,null));};exports[_0x4eb5('0x52')]=function(_0x1f3d78,_0x5827fa,_0x13b883){var _0x3e4d38={};var _0x196feb={};var _0x54161f;var _0x2e67d3;return db[_0x4eb5('0x41')]['findOne']({'where':{'id':_0x1f3d78['params']['id']}})[_0x4eb5('0x25')](handleEntityNotFound(_0x5827fa,null))[_0x4eb5('0x25')](function(_0x5ee836){if(_0x5ee836){_0x54161f=_0x5ee836;_0x196feb['model']=_[_0x4eb5('0x33')](db[_0x4eb5('0x4e')][_0x4eb5('0x2d')]);_0x196feb[_0x4eb5('0x32')]=_[_0x4eb5('0x33')](_0x1f3d78[_0x4eb5('0x32')]);_0x196feb[_0x4eb5('0x34')]=_[_0x4eb5('0x35')](_0x196feb[_0x4eb5('0x31')],_0x196feb[_0x4eb5('0x32')]);_0x3e4d38[_0x4eb5('0x36')]=_['intersection'](_0x196feb[_0x4eb5('0x31')],qs[_0x4eb5('0x37')](_0x1f3d78['query']['fields']));_0x3e4d38[_0x4eb5('0x36')]=_0x3e4d38[_0x4eb5('0x36')][_0x4eb5('0x38')]?_0x3e4d38['attributes']:_0x196feb['model'];_0x3e4d38[_0x4eb5('0x3a')]=qs['sort'](_0x1f3d78[_0x4eb5('0x32')]['sort']);_0x3e4d38['where']=qs['filters'](_[_0x4eb5('0x3d')](_0x1f3d78[_0x4eb5('0x32')],_0x196feb['filters']));if(_0x1f3d78[_0x4eb5('0x32')][_0x4eb5('0x4f')]){_0x3e4d38[_0x4eb5('0x3c')]=_[_0x4eb5('0x3e')](_0x3e4d38[_0x4eb5('0x3c')],{'$or':_[_0x4eb5('0x2c')](_0x3e4d38[_0x4eb5('0x36')],function(_0x2e064a){var _0x47f78e={};_0x47f78e[_0x2e064a]={'$like':'%'+_0x1f3d78[_0x4eb5('0x32')]['filter']+'%'};return _0x47f78e;})});}_0x3e4d38=_[_0x4eb5('0x3e')]({},_0x3e4d38,_0x1f3d78['options']);return _0x54161f[_0x4eb5('0x52')](_0x3e4d38);}})[_0x4eb5('0x25')](function(_0x46a4d4){if(_0x46a4d4){_0x2e67d3=_0x46a4d4[_0x4eb5('0x38')];if(!_0x1f3d78[_0x4eb5('0x32')][_0x4eb5('0x51')]('nolimit')){_0x3e4d38['limit']=qs['limit'](_0x1f3d78[_0x4eb5('0x32')][_0x4eb5('0x1f')]);_0x3e4d38[_0x4eb5('0x1d')]=qs[_0x4eb5('0x1d')](_0x1f3d78['query'][_0x4eb5('0x1d')]);}return _0x54161f['getDescriptions'](_0x3e4d38);}})[_0x4eb5('0x25')](function(_0x201ece){if(_0x201ece){return _0x201ece?{'count':_0x2e67d3,'rows':_0x201ece}:null;}})[_0x4eb5('0x25')](respondWithResult(_0x5827fa,null))[_0x4eb5('0x46')](handleError(_0x5827fa,null));}; \ No newline at end of file +var _0xfd7f=['filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','update','getFields','findOne','SalesforceField','options','order','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xfd7f,0xba));var _0xffd7=function(_0x2fbe5f,_0x4c5c13){_0x2fbe5f=_0x2fbe5f-0x0;var _0x21db60=_0xfd7f[_0x2fbe5f];return _0x21db60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffd7('0x0'));var zipdir=require(_0xffd7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xffd7('0x2'));var util=require(_0xffd7('0x3'));var path=require(_0xffd7('0x4'));var sox=require(_0xffd7('0x5'));var csv=require(_0xffd7('0x6'));var ejs=require(_0xffd7('0x7'));var fs=require('fs');var fs_extra=require(_0xffd7('0x8'));var _=require(_0xffd7('0x9'));var squel=require(_0xffd7('0xa'));var crypto=require(_0xffd7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xffd7('0xc'));var toCsv=require(_0xffd7('0x6'));var querystring=require(_0xffd7('0xd'));var Papa=require('papaparse');var Redis=require(_0xffd7('0xe'));var authService=require(_0xffd7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xffd7('0x10'));var hardwareService=require(_0xffd7('0x11'));var logger=require(_0xffd7('0x12'))(_0xffd7('0x13'));var utils=require(_0xffd7('0x14'));var config=require(_0xffd7('0x15'));var licenseUtil=require(_0xffd7('0x16'));var db=require(_0xffd7('0x17'))['db'];function respondWithStatusCode(_0x5890bb,_0x3f4100){_0x3f4100=_0x3f4100||0xcc;return function(_0x52ca93){if(_0x52ca93){return _0x5890bb[_0xffd7('0x18')](_0x3f4100);}return _0x5890bb['status'](_0x3f4100)[_0xffd7('0x19')]();};}function respondWithResult(_0x3049d2,_0x23d560){_0x23d560=_0x23d560||0xc8;return function(_0x4ffaf5){if(_0x4ffaf5){return _0x3049d2[_0xffd7('0x1a')](_0x23d560)['json'](_0x4ffaf5);}};}function respondWithFilteredResult(_0x130f2b,_0x481b8e){return function(_0x10b128){if(_0x10b128){var _0x14be3b=typeof _0x481b8e['offset']===_0xffd7('0x1b')&&typeof _0x481b8e[_0xffd7('0x1c')]==='undefined';var _0x45328f=_0x10b128[_0xffd7('0x1d')];var _0x20e344=_0x14be3b?0x0:_0x481b8e[_0xffd7('0x1e')];var _0x233dcb=_0x14be3b?_0x10b128['count']:_0x481b8e[_0xffd7('0x1e')]+_0x481b8e[_0xffd7('0x1c')];var _0x5a0f33;if(_0x233dcb>=_0x45328f){_0x233dcb=_0x45328f;_0x5a0f33=0xc8;}else{_0x5a0f33=0xce;}_0x130f2b[_0xffd7('0x1a')](_0x5a0f33);return _0x130f2b[_0xffd7('0x1f')](_0xffd7('0x20'),_0x20e344+'-'+_0x233dcb+'/'+_0x45328f)['json'](_0x10b128);}return null;};}function patchUpdates(_0x48caee){return function(_0x4e7406){try{jsonpatch[_0xffd7('0x21')](_0x4e7406,_0x48caee,!![]);}catch(_0x32eaad){return BPromise['reject'](_0x32eaad);}return _0x4e7406[_0xffd7('0x22')]();};}function saveUpdates(_0x414c56,_0x3c1b39){return function(_0x4cf736){if(_0x4cf736){return _0x4cf736['update'](_0x414c56)['then'](function(_0x2dc36c){return _0x2dc36c;});}return null;};}function removeEntity(_0x29622a,_0x2187e7){return function(_0xf0fa3f){if(_0xf0fa3f){return _0xf0fa3f[_0xffd7('0x23')]()[_0xffd7('0x24')](function(){_0x29622a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4f6c,_0x288acb){return function(_0x3b6538){if(!_0x3b6538){_0x5c4f6c[_0xffd7('0x18')](0x194);}return _0x3b6538;};}function handleError(_0x531542,_0x357369){_0x357369=_0x357369||0x1f4;return function(_0x4902ef){logger[_0xffd7('0x25')](_0x4902ef[_0xffd7('0x26')]);if(_0x4902ef[_0xffd7('0x27')]){delete _0x4902ef[_0xffd7('0x27')];}_0x531542[_0xffd7('0x1a')](_0x357369)['send'](_0x4902ef);};}exports[_0xffd7('0x28')]=function(_0x15e3e2,_0x1b556b){var _0x548b9={},_0x8f68d3={},_0x285968={'count':0x0,'rows':[]};var _0x4cfec1=_[_0xffd7('0x29')](db[_0xffd7('0x2a')][_0xffd7('0x2b')],function(_0xe8553d){return{'name':_0xe8553d['fieldName'],'type':_0xe8553d['type'][_0xffd7('0x2c')]};});_0x8f68d3[_0xffd7('0x2d')]=_[_0xffd7('0x29')](_0x4cfec1,_0xffd7('0x27'));_0x8f68d3[_0xffd7('0x2e')]=_[_0xffd7('0x2f')](_0x15e3e2[_0xffd7('0x2e')]);_0x8f68d3['filters']=_[_0xffd7('0x30')](_0x8f68d3['model'],_0x8f68d3[_0xffd7('0x2e')]);_0x548b9[_0xffd7('0x31')]=_[_0xffd7('0x30')](_0x8f68d3[_0xffd7('0x2d')],qs[_0xffd7('0x32')](_0x15e3e2[_0xffd7('0x2e')][_0xffd7('0x32')]));_0x548b9['attributes']=_0x548b9[_0xffd7('0x31')]['length']?_0x548b9[_0xffd7('0x31')]:_0x8f68d3[_0xffd7('0x2d')];if(!_0x15e3e2[_0xffd7('0x2e')]['hasOwnProperty'](_0xffd7('0x33'))){_0x548b9[_0xffd7('0x1c')]=qs[_0xffd7('0x1c')](_0x15e3e2['query'][_0xffd7('0x1c')]);_0x548b9[_0xffd7('0x1e')]=qs[_0xffd7('0x1e')](_0x15e3e2[_0xffd7('0x2e')][_0xffd7('0x1e')]);}_0x548b9['order']=qs[_0xffd7('0x34')](_0x15e3e2['query']['sort']);_0x548b9[_0xffd7('0x35')]=qs[_0xffd7('0x36')](_[_0xffd7('0x37')](_0x15e3e2[_0xffd7('0x2e')],_0x8f68d3[_0xffd7('0x36')]),_0x4cfec1);if(_0x15e3e2[_0xffd7('0x2e')][_0xffd7('0x38')]){_0x548b9[_0xffd7('0x35')]=_[_0xffd7('0x39')](_0x548b9[_0xffd7('0x35')],{'$or':_[_0xffd7('0x29')](_0x4cfec1,function(_0x2301cb){if(_0x2301cb[_0xffd7('0x3a')]!==_0xffd7('0x3b')){var _0x130c25={};_0x130c25[_0x2301cb[_0xffd7('0x27')]]={'$like':'%'+_0x15e3e2[_0xffd7('0x2e')][_0xffd7('0x38')]+'%'};return _0x130c25;}})});}_0x548b9=_[_0xffd7('0x39')]({},_0x548b9,_0x15e3e2['options']);var _0x26eba4={'where':_0x548b9[_0xffd7('0x35')]};return db[_0xffd7('0x2a')]['count'](_0x26eba4)['then'](function(_0x586a7e){_0x285968[_0xffd7('0x1d')]=_0x586a7e;if(_0x15e3e2[_0xffd7('0x2e')][_0xffd7('0x3c')]){_0x548b9[_0xffd7('0x3d')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xffd7('0x3e')](_0x548b9);})[_0xffd7('0x24')](function(_0x539e16){_0x285968[_0xffd7('0x3f')]=_0x539e16;return _0x285968;})[_0xffd7('0x24')](respondWithFilteredResult(_0x1b556b,_0x548b9))['catch'](handleError(_0x1b556b,null));};exports[_0xffd7('0x40')]=function(_0x5b1a2d,_0x2319f0){var _0x4cfc26={'raw':![],'where':{'id':_0x5b1a2d[_0xffd7('0x41')]['id']}},_0x27df0c={};_0x27df0c['model']=_[_0xffd7('0x2f')](db[_0xffd7('0x2a')]['rawAttributes']);_0x27df0c['query']=_[_0xffd7('0x2f')](_0x5b1a2d[_0xffd7('0x2e')]);_0x27df0c['filters']=_[_0xffd7('0x30')](_0x27df0c['model'],_0x27df0c[_0xffd7('0x2e')]);_0x4cfc26['attributes']=_[_0xffd7('0x30')](_0x27df0c['model'],qs['fields'](_0x5b1a2d[_0xffd7('0x2e')][_0xffd7('0x32')]));_0x4cfc26[_0xffd7('0x31')]=_0x4cfc26[_0xffd7('0x31')][_0xffd7('0x42')]?_0x4cfc26[_0xffd7('0x31')]:_0x27df0c[_0xffd7('0x2d')];if(_0x5b1a2d[_0xffd7('0x2e')][_0xffd7('0x3c')]){_0x4cfc26[_0xffd7('0x3d')]=[{'all':!![]}];}_0x4cfc26=_['merge']({},_0x4cfc26,_0x5b1a2d['options']);return db[_0xffd7('0x2a')][_0xffd7('0x43')](_0x4cfc26)[_0xffd7('0x24')](handleEntityNotFound(_0x2319f0,null))[_0xffd7('0x24')](respondWithResult(_0x2319f0,null))[_0xffd7('0x44')](handleError(_0x2319f0,null));};exports[_0xffd7('0x45')]=function(_0xa0607c,_0xa155a6){return db[_0xffd7('0x2a')]['create'](_0xa0607c[_0xffd7('0x46')],{})[_0xffd7('0x24')](respondWithResult(_0xa155a6,0xc9))[_0xffd7('0x44')](handleError(_0xa155a6,null));};exports[_0xffd7('0x47')]=function(_0x14cad8,_0x13e6ce){if(_0x14cad8[_0xffd7('0x46')]['id']){delete _0x14cad8[_0xffd7('0x46')]['id'];}return db['SalesforceConfiguration'][_0xffd7('0x43')]({'where':{'id':_0x14cad8[_0xffd7('0x41')]['id']}})[_0xffd7('0x24')](handleEntityNotFound(_0x13e6ce,null))[_0xffd7('0x24')](saveUpdates(_0x14cad8[_0xffd7('0x46')],null))[_0xffd7('0x24')](respondWithResult(_0x13e6ce,null))[_0xffd7('0x44')](handleError(_0x13e6ce,null));};exports['destroy']=function(_0x229600,_0x50e0e5){return db[_0xffd7('0x2a')]['find']({'where':{'id':_0x229600[_0xffd7('0x41')]['id']}})[_0xffd7('0x24')](handleEntityNotFound(_0x50e0e5,null))[_0xffd7('0x24')](removeEntity(_0x50e0e5,null))[_0xffd7('0x44')](handleError(_0x50e0e5,null));};exports[_0xffd7('0x48')]=function(_0x2e000c,_0x3cbb52,_0x49fe2a){var _0x4c6ac2={};var _0xdb6cf3={};var _0x481835;var _0x1c20dc;return db[_0xffd7('0x2a')][_0xffd7('0x49')]({'where':{'id':_0x2e000c['params']['id']}})[_0xffd7('0x24')](handleEntityNotFound(_0x3cbb52,null))[_0xffd7('0x24')](function(_0x34e773){if(_0x34e773){_0x481835=_0x34e773;_0xdb6cf3[_0xffd7('0x2d')]=_[_0xffd7('0x2f')](db[_0xffd7('0x4a')]['rawAttributes']);_0xdb6cf3['query']=_[_0xffd7('0x2f')](_0x2e000c[_0xffd7('0x2e')]);_0xdb6cf3[_0xffd7('0x36')]=_[_0xffd7('0x30')](_0xdb6cf3[_0xffd7('0x2d')],_0xdb6cf3['query']);_0x4c6ac2[_0xffd7('0x31')]=_['intersection'](_0xdb6cf3[_0xffd7('0x2d')],qs['fields'](_0x2e000c['query'][_0xffd7('0x32')]));_0x4c6ac2[_0xffd7('0x31')]=_0x4c6ac2[_0xffd7('0x31')]['length']?_0x4c6ac2[_0xffd7('0x31')]:_0xdb6cf3[_0xffd7('0x2d')];_0x4c6ac2['order']=qs['sort'](_0x2e000c[_0xffd7('0x2e')][_0xffd7('0x34')]);_0x4c6ac2['where']=qs[_0xffd7('0x36')](_[_0xffd7('0x37')](_0x2e000c[_0xffd7('0x2e')],_0xdb6cf3[_0xffd7('0x36')]));if(_0x2e000c['query']['filter']){_0x4c6ac2[_0xffd7('0x35')]=_[_0xffd7('0x39')](_0x4c6ac2[_0xffd7('0x35')],{'$or':_[_0xffd7('0x29')](_0x4c6ac2[_0xffd7('0x31')],function(_0x1a10a5){var _0x5789d9={};_0x5789d9[_0x1a10a5]={'$like':'%'+_0x2e000c[_0xffd7('0x2e')]['filter']+'%'};return _0x5789d9;})});}_0x4c6ac2=_[_0xffd7('0x39')]({},_0x4c6ac2,_0x2e000c[_0xffd7('0x4b')]);return _0x481835[_0xffd7('0x48')](_0x4c6ac2);}})[_0xffd7('0x24')](function(_0x3f90d8){if(_0x3f90d8){_0x1c20dc=_0x3f90d8[_0xffd7('0x42')];if(!_0x2e000c[_0xffd7('0x2e')]['hasOwnProperty'](_0xffd7('0x33'))){_0x4c6ac2['limit']=qs[_0xffd7('0x1c')](_0x2e000c['query']['limit']);_0x4c6ac2[_0xffd7('0x1e')]=qs[_0xffd7('0x1e')](_0x2e000c['query'][_0xffd7('0x1e')]);}return _0x481835['getFields'](_0x4c6ac2);}})[_0xffd7('0x24')](function(_0x5e7cd1){if(_0x5e7cd1){return _0x5e7cd1?{'count':_0x1c20dc,'rows':_0x5e7cd1}:null;}})[_0xffd7('0x24')](respondWithResult(_0x3cbb52,null))[_0xffd7('0x44')](handleError(_0x3cbb52,null));};exports['getSubjects']=function(_0x1a7582,_0x163c2c,_0x3363bf){var _0x5cad61={};var _0x20fc1e={};var _0x263a2c;var _0x409860;return db[_0xffd7('0x2a')][_0xffd7('0x49')]({'where':{'id':_0x1a7582[_0xffd7('0x41')]['id']}})[_0xffd7('0x24')](handleEntityNotFound(_0x163c2c,null))[_0xffd7('0x24')](function(_0x37afe0){if(_0x37afe0){_0x263a2c=_0x37afe0;_0x20fc1e[_0xffd7('0x2d')]=_['keys'](db['SalesforceField'][_0xffd7('0x2b')]);_0x20fc1e[_0xffd7('0x2e')]=_[_0xffd7('0x2f')](_0x1a7582[_0xffd7('0x2e')]);_0x20fc1e['filters']=_['intersection'](_0x20fc1e[_0xffd7('0x2d')],_0x20fc1e[_0xffd7('0x2e')]);_0x5cad61[_0xffd7('0x31')]=_[_0xffd7('0x30')](_0x20fc1e[_0xffd7('0x2d')],qs[_0xffd7('0x32')](_0x1a7582[_0xffd7('0x2e')][_0xffd7('0x32')]));_0x5cad61['attributes']=_0x5cad61[_0xffd7('0x31')][_0xffd7('0x42')]?_0x5cad61['attributes']:_0x20fc1e['model'];_0x5cad61[_0xffd7('0x4c')]=qs[_0xffd7('0x34')](_0x1a7582['query'][_0xffd7('0x34')]);_0x5cad61[_0xffd7('0x35')]=qs[_0xffd7('0x36')](_[_0xffd7('0x37')](_0x1a7582[_0xffd7('0x2e')],_0x20fc1e[_0xffd7('0x36')]));if(_0x1a7582['query'][_0xffd7('0x38')]){_0x5cad61['where']=_[_0xffd7('0x39')](_0x5cad61[_0xffd7('0x35')],{'$or':_[_0xffd7('0x29')](_0x5cad61[_0xffd7('0x31')],function(_0x5d4e65){var _0x1d049e={};_0x1d049e[_0x5d4e65]={'$like':'%'+_0x1a7582[_0xffd7('0x2e')][_0xffd7('0x38')]+'%'};return _0x1d049e;})});}_0x5cad61=_[_0xffd7('0x39')]({},_0x5cad61,_0x1a7582[_0xffd7('0x4b')]);return _0x263a2c['getSubjects'](_0x5cad61);}})[_0xffd7('0x24')](function(_0x5ff20b){if(_0x5ff20b){_0x409860=_0x5ff20b[_0xffd7('0x42')];if(!_0x1a7582['query'][_0xffd7('0x4d')](_0xffd7('0x33'))){_0x5cad61[_0xffd7('0x1c')]=qs[_0xffd7('0x1c')](_0x1a7582[_0xffd7('0x2e')][_0xffd7('0x1c')]);_0x5cad61['offset']=qs[_0xffd7('0x1e')](_0x1a7582['query'][_0xffd7('0x1e')]);}return _0x263a2c[_0xffd7('0x4e')](_0x5cad61);}})['then'](function(_0x17155){if(_0x17155){return _0x17155?{'count':_0x409860,'rows':_0x17155}:null;}})[_0xffd7('0x24')](respondWithResult(_0x163c2c,null))['catch'](handleError(_0x163c2c,null));};exports[_0xffd7('0x4f')]=function(_0x4efd3a,_0xaabf59,_0x5832f0){var _0x2212d6={};var _0x4afb7e={};var _0x13cbea;var _0x40bdac;return db[_0xffd7('0x2a')][_0xffd7('0x49')]({'where':{'id':_0x4efd3a[_0xffd7('0x41')]['id']}})[_0xffd7('0x24')](handleEntityNotFound(_0xaabf59,null))['then'](function(_0x18c91d){if(_0x18c91d){_0x13cbea=_0x18c91d;_0x4afb7e['model']=_['keys'](db['SalesforceField'][_0xffd7('0x2b')]);_0x4afb7e[_0xffd7('0x2e')]=_['keys'](_0x4efd3a[_0xffd7('0x2e')]);_0x4afb7e[_0xffd7('0x36')]=_[_0xffd7('0x30')](_0x4afb7e[_0xffd7('0x2d')],_0x4afb7e[_0xffd7('0x2e')]);_0x2212d6[_0xffd7('0x31')]=_[_0xffd7('0x30')](_0x4afb7e[_0xffd7('0x2d')],qs[_0xffd7('0x32')](_0x4efd3a[_0xffd7('0x2e')][_0xffd7('0x32')]));_0x2212d6['attributes']=_0x2212d6['attributes'][_0xffd7('0x42')]?_0x2212d6[_0xffd7('0x31')]:_0x4afb7e[_0xffd7('0x2d')];_0x2212d6['order']=qs['sort'](_0x4efd3a['query'][_0xffd7('0x34')]);_0x2212d6[_0xffd7('0x35')]=qs[_0xffd7('0x36')](_['pick'](_0x4efd3a[_0xffd7('0x2e')],_0x4afb7e[_0xffd7('0x36')]));if(_0x4efd3a[_0xffd7('0x2e')]['filter']){_0x2212d6[_0xffd7('0x35')]=_['merge'](_0x2212d6[_0xffd7('0x35')],{'$or':_[_0xffd7('0x29')](_0x2212d6['attributes'],function(_0x5e16c2){var _0x32e584={};_0x32e584[_0x5e16c2]={'$like':'%'+_0x4efd3a[_0xffd7('0x2e')][_0xffd7('0x38')]+'%'};return _0x32e584;})});}_0x2212d6=_[_0xffd7('0x39')]({},_0x2212d6,_0x4efd3a['options']);return _0x13cbea[_0xffd7('0x4f')](_0x2212d6);}})['then'](function(_0x474629){if(_0x474629){_0x40bdac=_0x474629[_0xffd7('0x42')];if(!_0x4efd3a['query'][_0xffd7('0x4d')]('nolimit')){_0x2212d6[_0xffd7('0x1c')]=qs['limit'](_0x4efd3a[_0xffd7('0x2e')][_0xffd7('0x1c')]);_0x2212d6[_0xffd7('0x1e')]=qs['offset'](_0x4efd3a['query'][_0xffd7('0x1e')]);}return _0x13cbea[_0xffd7('0x4f')](_0x2212d6);}})['then'](function(_0x23c2af){if(_0x23c2af){return _0x23c2af?{'count':_0x40bdac,'rows':_0x23c2af}:null;}})[_0xffd7('0x24')](respondWithResult(_0xaabf59,null))[_0xffd7('0x44')](handleError(_0xaabf59,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fa3c409..a77497f 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 _0xe5a2=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','SalesforceConfiguration','int_salesforce_configurations','util'];(function(_0x51f787,_0x4dcb64){var _0x4f776b=function(_0x2826b0){while(--_0x2826b0){_0x51f787['push'](_0x51f787['shift']());}};_0x4f776b(++_0x4dcb64);}(_0xe5a2,0xdb));var _0x2e5a=function(_0x1c0632,_0x5d6132){_0x1c0632=_0x1c0632-0x0;var _0x499494=_0xe5a2[_0x1c0632];return _0x499494;};'use strict';var _=require('lodash');var util=require(_0x2e5a('0x0'));var logger=require(_0x2e5a('0x1'))(_0x2e5a('0x2'));var moment=require(_0x2e5a('0x3'));var BPromise=require(_0x2e5a('0x4'));var rp=require(_0x2e5a('0x5'));var fs=require('fs');var path=require(_0x2e5a('0x6'));var rimraf=require('rimraf');var config=require(_0x2e5a('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x28341b,_0x29b7ba){return _0x28341b[_0x2e5a('0x8')](_0x2e5a('0x9'),attributes,{'tableName':_0x2e5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1705=['./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x2915b2,_0x218315){var _0x3da221=function(_0x1f0630){while(--_0x1f0630){_0x2915b2['push'](_0x2915b2['shift']());}};_0x3da221(++_0x218315);}(_0x1705,0x7d));var _0x5170=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x1705[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0x5170('0x0'));var util=require(_0x5170('0x1'));var logger=require(_0x5170('0x2'))('api');var moment=require(_0x5170('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5170('0x4'));var rimraf=require(_0x5170('0x5'));var config=require(_0x5170('0x6'));var attributes=require(_0x5170('0x7'));module[_0x5170('0x8')]=function(_0x3ab09b,_0x12c4eb){return _0x3ab09b['define'](_0x5170('0x9'),attributes,{'tableName':_0x5170('0xa'),'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 2c95592..e551211 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 _0x1670=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x1670,0x141));var _0x0167=function(_0x8988c8,_0x230c91){_0x8988c8=_0x8988c8-0x0;var _0x1a8d37=_0x1670[_0x8988c8];return _0x1a8d37;};'use strict';var _=require(_0x0167('0x0'));var util=require('util');var moment=require(_0x0167('0x1'));var BPromise=require(_0x0167('0x2'));var rs=require(_0x0167('0x3'));var fs=require('fs');var Redis=require(_0x0167('0x4'));var db=require(_0x0167('0x5'))['db'];var utils=require(_0x0167('0x6'));var logger=require('../../config/logger')(_0x0167('0x7'));var config=require(_0x0167('0x8'));var jayson=require(_0x0167('0x9'));var client=jayson[_0x0167('0xa')][_0x0167('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x559d18,_0x59bbea,_0x18cc2b){return new BPromise(function(_0x263e16,_0xe76b9d){return client[_0x0167('0xc')](_0x559d18,_0x18cc2b)[_0x0167('0xd')](function(_0x309ad2){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x59bbea,_0x0167('0xe'));logger[_0x0167('0xf')](_0x0167('0x10'),_0x59bbea,'request\x20sent',JSON[_0x0167('0x11')](_0x309ad2));if(_0x309ad2[_0x0167('0x12')]){if(_0x309ad2[_0x0167('0x12')][_0x0167('0x13')]===0x1f4){logger[_0x0167('0x12')](_0x0167('0x14'),_0x59bbea,_0x309ad2[_0x0167('0x12')][_0x0167('0x15')]);return _0xe76b9d(_0x309ad2[_0x0167('0x12')][_0x0167('0x15')]);}logger[_0x0167('0x12')](_0x0167('0x14'),_0x59bbea,_0x309ad2[_0x0167('0x12')][_0x0167('0x15')]);return _0x263e16(_0x309ad2[_0x0167('0x12')]['message']);}else{logger['info'](_0x0167('0x14'),_0x59bbea,_0x0167('0xe'));_0x263e16(_0x309ad2[_0x0167('0x16')][_0x0167('0x15')]);}})[_0x0167('0x17')](function(_0xf4b18b){logger['error'](_0x0167('0x14'),_0x59bbea,_0xf4b18b);_0xe76b9d(_0xf4b18b);});});} \ No newline at end of file +var _0xf219=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x3b72c5,_0x3f40dc){var _0xdcbf43=function(_0x1a9c0e){while(--_0x1a9c0e){_0x3b72c5['push'](_0x3b72c5['shift']());}};_0xdcbf43(++_0x3f40dc);}(_0xf219,0xcc));var _0x9f21=function(_0x17c10a,_0xc9ee44){_0x17c10a=_0x17c10a-0x0;var _0x149440=_0xf219[_0x17c10a];return _0x149440;};'use strict';var _=require('lodash');var util=require(_0x9f21('0x0'));var moment=require(_0x9f21('0x1'));var BPromise=require(_0x9f21('0x2'));var rs=require(_0x9f21('0x3'));var fs=require('fs');var Redis=require(_0x9f21('0x4'));var db=require(_0x9f21('0x5'))['db'];var utils=require(_0x9f21('0x6'));var logger=require(_0x9f21('0x7'))('rpc');var config=require(_0x9f21('0x8'));var jayson=require(_0x9f21('0x9'));var client=jayson[_0x9f21('0xa')][_0x9f21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1184e0,_0xf5eff8,_0x5ddf03){return new BPromise(function(_0x35da5a,_0x419146){return client['request'](_0x1184e0,_0x5ddf03)['then'](function(_0x294478){logger[_0x9f21('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf5eff8,_0x9f21('0xd'));logger[_0x9f21('0xe')](_0x9f21('0xf'),_0xf5eff8,_0x9f21('0xd'),JSON[_0x9f21('0x10')](_0x294478));if(_0x294478[_0x9f21('0x11')]){if(_0x294478[_0x9f21('0x11')][_0x9f21('0x12')]===0x1f4){logger[_0x9f21('0x11')](_0x9f21('0x13'),_0xf5eff8,_0x294478['error'][_0x9f21('0x14')]);return _0x419146(_0x294478[_0x9f21('0x11')][_0x9f21('0x14')]);}logger[_0x9f21('0x11')](_0x9f21('0x13'),_0xf5eff8,_0x294478[_0x9f21('0x11')][_0x9f21('0x14')]);return _0x35da5a(_0x294478['error']['message']);}else{logger[_0x9f21('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf5eff8,_0x9f21('0xd'));_0x35da5a(_0x294478[_0x9f21('0x15')][_0x9f21('0x14')]);}})[_0x9f21('0x16')](function(_0x2b7357){logger[_0x9f21('0x11')](_0x9f21('0x13'),_0xf5eff8,_0x2b7357);_0x419146(_0x2b7357);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 1a10c57..5fd47f8 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 _0x0b9e=['./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x36336e,_0x38611c){var _0x1e4966=function(_0x120a5b){while(--_0x120a5b){_0x36336e['push'](_0x36336e['shift']());}};_0x1e4966(++_0x38611c);}(_0x0b9e,0x19b));var _0xe0b9=function(_0x159a7a,_0x4ac6a2){_0x159a7a=_0x159a7a-0x0;var _0x119ae0=_0x0b9e[_0x159a7a];return _0x119ae0;};'use strict';var multer=require(_0xe0b9('0x0'));var util=require('util');var path=require(_0xe0b9('0x1'));var timeout=require(_0xe0b9('0x2'));var express=require('express');var router=express[_0xe0b9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe0b9('0x4'));var interaction=require(_0xe0b9('0x5'));var config=require(_0xe0b9('0x6'));var controller=require(_0xe0b9('0x7'));router[_0xe0b9('0x8')]('/',auth[_0xe0b9('0x9')](),controller[_0xe0b9('0xa')]);router[_0xe0b9('0x8')](_0xe0b9('0xb'),auth[_0xe0b9('0x9')](),controller['show']);router[_0xe0b9('0xc')]('/',auth['isAuthenticated'](),controller[_0xe0b9('0xd')]);router[_0xe0b9('0xe')](_0xe0b9('0xb'),auth[_0xe0b9('0x9')](),controller[_0xe0b9('0xf')]);router[_0xe0b9('0x10')]('/:id',auth[_0xe0b9('0x9')](),controller[_0xe0b9('0x11')]);module[_0xe0b9('0x12')]=router; \ No newline at end of file +var _0x4d3a=['connect-timeout','express','Router','../../components/interaction/service','./intSalesforceField.controller','isAuthenticated','index','get','/:id','post','create','put','update','destroy','exports','multer','path'];(function(_0x16480b,_0x390f4e){var _0x5b7375=function(_0xfd00bb){while(--_0xfd00bb){_0x16480b['push'](_0x16480b['shift']());}};_0x5b7375(++_0x390f4e);}(_0x4d3a,0x174));var _0xa4d3=function(_0x156a77,_0x522c13){_0x156a77=_0x156a77-0x0;var _0x32398a=_0x4d3a[_0x156a77];return _0x32398a;};'use strict';var multer=require(_0xa4d3('0x0'));var util=require('util');var path=require(_0xa4d3('0x1'));var timeout=require(_0xa4d3('0x2'));var express=require(_0xa4d3('0x3'));var router=express[_0xa4d3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa4d3('0x5'));var config=require('../../config/environment');var controller=require(_0xa4d3('0x6'));router['get']('/',auth[_0xa4d3('0x7')](),controller[_0xa4d3('0x8')]);router[_0xa4d3('0x9')](_0xa4d3('0xa'),auth[_0xa4d3('0x7')](),controller['show']);router[_0xa4d3('0xb')]('/',auth[_0xa4d3('0x7')](),controller[_0xa4d3('0xc')]);router[_0xa4d3('0xd')](_0xa4d3('0xa'),auth[_0xa4d3('0x7')](),controller[_0xa4d3('0xe')]);router['delete']('/:id',auth[_0xa4d3('0x7')](),controller[_0xa4d3('0xf')]);module[_0xa4d3('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 c365fe8..fcd61af 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 _0x7cbc=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x19f8d4,_0x24186e){var _0x4f498a=function(_0xbbfe92){while(--_0xbbfe92){_0x19f8d4['push'](_0x19f8d4['shift']());}};_0x4f498a(++_0x24186e);}(_0x7cbc,0x8c));var _0xc7cb=function(_0x5b54bc,_0x571711){_0x5b54bc=_0x5b54bc-0x0;var _0xe09973=_0x7cbc[_0x5b54bc];return _0xe09973;};'use strict';var Sequelize=require(_0xc7cb('0x0'));module[_0xc7cb('0x1')]={'type':{'type':Sequelize[_0xc7cb('0x2')](_0xc7cb('0x3'),_0xc7cb('0x4'),_0xc7cb('0x5'),_0xc7cb('0x6'),_0xc7cb('0x7')),'defaultValue':_0xc7cb('0x3')},'content':{'type':Sequelize[_0xc7cb('0x8')]},'key':{'type':Sequelize[_0xc7cb('0x8')]},'keyType':{'type':Sequelize[_0xc7cb('0x2')](_0xc7cb('0x3'),_0xc7cb('0x4'),_0xc7cb('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc7cb('0x8')]},'variableName':{'type':Sequelize[_0xc7cb('0x8')]}}; \ No newline at end of file +var _0x7caf=['exports','ENUM','string','variable','customVariable','picklist','STRING','sequelize'];(function(_0xa81170,_0x45213b){var _0x384694=function(_0x184750){while(--_0x184750){_0xa81170['push'](_0xa81170['shift']());}};_0x384694(++_0x45213b);}(_0x7caf,0x19f));var _0xf7ca=function(_0x52b754,_0x12c404){_0x52b754=_0x52b754-0x0;var _0x58205d=_0x7caf[_0x52b754];return _0x58205d;};'use strict';var Sequelize=require(_0xf7ca('0x0'));module[_0xf7ca('0x1')]={'type':{'type':Sequelize[_0xf7ca('0x2')](_0xf7ca('0x3'),_0xf7ca('0x4'),_0xf7ca('0x5'),'keyValue',_0xf7ca('0x6')),'defaultValue':_0xf7ca('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf7ca('0x2')](_0xf7ca('0x3'),_0xf7ca('0x4'),_0xf7ca('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf7ca('0x7')]},'variableName':{'type':Sequelize[_0xf7ca('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8f51e83..6bb3f20 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 _0x9308=['sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','index','SalesforceField','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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'];(function(_0x56b04e,_0x471ebc){var _0x4149b9=function(_0x591220){while(--_0x591220){_0x56b04e['push'](_0x56b04e['shift']());}};_0x4149b9(++_0x471ebc);}(_0x9308,0x1b4));var _0x8930=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9308[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x8930('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8930('0x1'));var jsonpatch=require(_0x8930('0x2'));var rp=require(_0x8930('0x3'));var moment=require(_0x8930('0x4'));var BPromise=require(_0x8930('0x5'));var Mustache=require(_0x8930('0x6'));var util=require(_0x8930('0x7'));var path=require(_0x8930('0x8'));var sox=require(_0x8930('0x9'));var csv=require(_0x8930('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8930('0xb'));var crypto=require(_0x8930('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8930('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8930('0xe'));var Redis=require(_0x8930('0xf'));var authService=require(_0x8930('0x10'));var qs=require(_0x8930('0x11'));var as=require(_0x8930('0x12'));var hardwareService=require(_0x8930('0x13'));var logger=require(_0x8930('0x14'))(_0x8930('0x15'));var utils=require(_0x8930('0x16'));var config=require(_0x8930('0x17'));var licenseUtil=require(_0x8930('0x18'));var db=require(_0x8930('0x19'))['db'];function respondWithStatusCode(_0x1bc3e0,_0x2c6baf){_0x2c6baf=_0x2c6baf||0xcc;return function(_0x3b8256){if(_0x3b8256){return _0x1bc3e0[_0x8930('0x1a')](_0x2c6baf);}return _0x1bc3e0[_0x8930('0x1b')](_0x2c6baf)['end']();};}function respondWithResult(_0x5e2d58,_0x1657fe){_0x1657fe=_0x1657fe||0xc8;return function(_0x531fc1){if(_0x531fc1){return _0x5e2d58[_0x8930('0x1b')](_0x1657fe)['json'](_0x531fc1);}};}function respondWithFilteredResult(_0x335924,_0x303fd3){return function(_0x5bbbdf){if(_0x5bbbdf){var _0x10dbcd=typeof _0x303fd3['offset']===_0x8930('0x1c')&&typeof _0x303fd3['limit']===_0x8930('0x1c');var _0x20056c=_0x5bbbdf[_0x8930('0x1d')];var _0x902a4e=_0x10dbcd?0x0:_0x303fd3[_0x8930('0x1e')];var _0x2d14ef=_0x10dbcd?_0x5bbbdf['count']:_0x303fd3[_0x8930('0x1e')]+_0x303fd3[_0x8930('0x1f')];var _0x544bd7;if(_0x2d14ef>=_0x20056c){_0x2d14ef=_0x20056c;_0x544bd7=0xc8;}else{_0x544bd7=0xce;}_0x335924['status'](_0x544bd7);return _0x335924[_0x8930('0x20')](_0x8930('0x21'),_0x902a4e+'-'+_0x2d14ef+'/'+_0x20056c)[_0x8930('0x22')](_0x5bbbdf);}return null;};}function patchUpdates(_0x1173b0){return function(_0x376e1f){try{jsonpatch[_0x8930('0x23')](_0x376e1f,_0x1173b0,!![]);}catch(_0x38e8c1){return BPromise[_0x8930('0x24')](_0x38e8c1);}return _0x376e1f[_0x8930('0x25')]();};}function saveUpdates(_0x2e900a,_0x1e465e){return function(_0x1ca0fb){if(_0x1ca0fb){return _0x1ca0fb[_0x8930('0x26')](_0x2e900a)[_0x8930('0x27')](function(_0x48df6e){return _0x48df6e;});}return null;};}function removeEntity(_0x450625,_0x10a283){return function(_0x71314d){if(_0x71314d){return _0x71314d['destroy']()[_0x8930('0x27')](function(){_0x450625[_0x8930('0x1b')](0xcc)[_0x8930('0x28')]();});}};}function handleEntityNotFound(_0x12d4dd,_0x297d56){return function(_0x150b0e){if(!_0x150b0e){_0x12d4dd[_0x8930('0x1a')](0x194);}return _0x150b0e;};}function handleError(_0x1537ca,_0x5bb322){_0x5bb322=_0x5bb322||0x1f4;return function(_0x1ed7b9){logger[_0x8930('0x29')](_0x1ed7b9['stack']);if(_0x1ed7b9[_0x8930('0x2a')]){delete _0x1ed7b9[_0x8930('0x2a')];}_0x1537ca[_0x8930('0x1b')](_0x5bb322)[_0x8930('0x2b')](_0x1ed7b9);};}exports[_0x8930('0x2c')]=function(_0x52554a,_0x19ffbc){var _0x4f8aa4={},_0x53948b={},_0x82fb49={'count':0x0,'rows':[]};var _0x3929e2=_['map'](db[_0x8930('0x2d')]['rawAttributes'],function(_0x8508ee){return{'name':_0x8508ee['fieldName'],'type':_0x8508ee[_0x8930('0x2e')][_0x8930('0x2f')]};});_0x53948b[_0x8930('0x30')]=_[_0x8930('0x31')](_0x3929e2,'name');_0x53948b['query']=_[_0x8930('0x32')](_0x52554a[_0x8930('0x33')]);_0x53948b[_0x8930('0x34')]=_[_0x8930('0x35')](_0x53948b[_0x8930('0x30')],_0x53948b[_0x8930('0x33')]);_0x4f8aa4['attributes']=_['intersection'](_0x53948b[_0x8930('0x30')],qs['fields'](_0x52554a[_0x8930('0x33')][_0x8930('0x36')]));_0x4f8aa4[_0x8930('0x37')]=_0x4f8aa4[_0x8930('0x37')][_0x8930('0x38')]?_0x4f8aa4[_0x8930('0x37')]:_0x53948b[_0x8930('0x30')];if(!_0x52554a[_0x8930('0x33')][_0x8930('0x39')](_0x8930('0x3a'))){_0x4f8aa4[_0x8930('0x1f')]=qs['limit'](_0x52554a[_0x8930('0x33')][_0x8930('0x1f')]);_0x4f8aa4[_0x8930('0x1e')]=qs[_0x8930('0x1e')](_0x52554a[_0x8930('0x33')][_0x8930('0x1e')]);}_0x4f8aa4[_0x8930('0x3b')]=qs[_0x8930('0x3c')](_0x52554a['query']['sort']);_0x4f8aa4['where']=qs[_0x8930('0x34')](_[_0x8930('0x3d')](_0x52554a[_0x8930('0x33')],_0x53948b[_0x8930('0x34')]),_0x3929e2);if(_0x52554a['query'][_0x8930('0x3e')]){_0x4f8aa4[_0x8930('0x3f')]=_[_0x8930('0x40')](_0x4f8aa4['where'],{'$or':_['map'](_0x3929e2,function(_0x45f1ff){if(_0x45f1ff[_0x8930('0x2e')]!==_0x8930('0x41')){var _0x157473={};_0x157473[_0x45f1ff[_0x8930('0x2a')]]={'$like':'%'+_0x52554a[_0x8930('0x33')][_0x8930('0x3e')]+'%'};return _0x157473;}})});}_0x4f8aa4=_[_0x8930('0x40')]({},_0x4f8aa4,_0x52554a['options']);var _0x122fbb={'where':_0x4f8aa4[_0x8930('0x3f')]};return db[_0x8930('0x2d')]['count'](_0x122fbb)['then'](function(_0x437464){_0x82fb49[_0x8930('0x1d')]=_0x437464;if(_0x52554a[_0x8930('0x33')]['includeAll']){_0x4f8aa4[_0x8930('0x42')]=[{'all':!![]}];}return db[_0x8930('0x2d')][_0x8930('0x43')](_0x4f8aa4);})['then'](function(_0x28078b){_0x82fb49[_0x8930('0x44')]=_0x28078b;return _0x82fb49;})['then'](respondWithFilteredResult(_0x19ffbc,_0x4f8aa4))[_0x8930('0x45')](handleError(_0x19ffbc,null));};exports[_0x8930('0x46')]=function(_0x237288,_0x2b484b){var _0x317da2={'raw':!![],'where':{'id':_0x237288[_0x8930('0x47')]['id']}},_0x1b5625={};_0x1b5625['model']=_[_0x8930('0x32')](db[_0x8930('0x2d')][_0x8930('0x48')]);_0x1b5625[_0x8930('0x33')]=_[_0x8930('0x32')](_0x237288['query']);_0x1b5625['filters']=_['intersection'](_0x1b5625[_0x8930('0x30')],_0x1b5625[_0x8930('0x33')]);_0x317da2[_0x8930('0x37')]=_[_0x8930('0x35')](_0x1b5625['model'],qs[_0x8930('0x36')](_0x237288['query'][_0x8930('0x36')]));_0x317da2[_0x8930('0x37')]=_0x317da2[_0x8930('0x37')][_0x8930('0x38')]?_0x317da2['attributes']:_0x1b5625[_0x8930('0x30')];if(_0x237288['query'][_0x8930('0x49')]){_0x317da2[_0x8930('0x42')]=[{'all':!![]}];}_0x317da2=_[_0x8930('0x40')]({},_0x317da2,_0x237288['options']);return db['SalesforceField'][_0x8930('0x4a')](_0x317da2)[_0x8930('0x27')](handleEntityNotFound(_0x2b484b,null))[_0x8930('0x27')](respondWithResult(_0x2b484b,null))['catch'](handleError(_0x2b484b,null));};exports[_0x8930('0x4b')]=function(_0x34bc94,_0x2690d4){return db[_0x8930('0x2d')][_0x8930('0x4b')](_0x34bc94[_0x8930('0x4c')],{})[_0x8930('0x27')](respondWithResult(_0x2690d4,0xc9))[_0x8930('0x45')](handleError(_0x2690d4,null));};exports[_0x8930('0x26')]=function(_0x5d87ea,_0x51ec9f){if(_0x5d87ea['body']['id']){delete _0x5d87ea[_0x8930('0x4c')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x5d87ea[_0x8930('0x47')]['id']}})[_0x8930('0x27')](handleEntityNotFound(_0x51ec9f,null))['then'](saveUpdates(_0x5d87ea[_0x8930('0x4c')],null))[_0x8930('0x27')](respondWithResult(_0x51ec9f,null))[_0x8930('0x45')](handleError(_0x51ec9f,null));};exports['destroy']=function(_0xb1249b,_0x6510a3){return db[_0x8930('0x2d')][_0x8930('0x4a')]({'where':{'id':_0xb1249b['params']['id']}})[_0x8930('0x27')](handleEntityNotFound(_0x6510a3,null))[_0x8930('0x27')](removeEntity(_0x6510a3,null))[_0x8930('0x45')](handleError(_0x6510a3,null));}; \ No newline at end of file +var _0x75fb=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SalesforceField','include','findAll','catch','show','length','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1b0a74,_0x184704){var _0x40e03d=function(_0x459b5d){while(--_0x459b5d){_0x1b0a74['push'](_0x1b0a74['shift']());}};_0x40e03d(++_0x184704);}(_0x75fb,0x152));var _0xb75f=function(_0x52fd93,_0x29e32d){_0x52fd93=_0x52fd93-0x0;var _0x2e9da9=_0x75fb[_0x52fd93];return _0x2e9da9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb75f('0x0'));var zipdir=require(_0xb75f('0x1'));var jsonpatch=require(_0xb75f('0x2'));var rp=require(_0xb75f('0x3'));var moment=require('moment');var BPromise=require(_0xb75f('0x4'));var Mustache=require(_0xb75f('0x5'));var util=require('util');var path=require(_0xb75f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb75f('0x7'));var fs=require('fs');var fs_extra=require(_0xb75f('0x8'));var _=require('lodash');var squel=require(_0xb75f('0x9'));var crypto=require(_0xb75f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb75f('0xb'));var toCsv=require(_0xb75f('0xc'));var querystring=require(_0xb75f('0xd'));var Papa=require(_0xb75f('0xe'));var Redis=require(_0xb75f('0xf'));var authService=require(_0xb75f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb75f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb75f('0x12'))(_0xb75f('0x13'));var utils=require('../../config/utils');var config=require(_0xb75f('0x14'));var licenseUtil=require(_0xb75f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d43b,_0x311180){_0x311180=_0x311180||0xcc;return function(_0x198d72){if(_0x198d72){return _0x42d43b['sendStatus'](_0x311180);}return _0x42d43b[_0xb75f('0x16')](_0x311180)[_0xb75f('0x17')]();};}function respondWithResult(_0x521e79,_0x492ecd){_0x492ecd=_0x492ecd||0xc8;return function(_0x85e912){if(_0x85e912){return _0x521e79['status'](_0x492ecd)[_0xb75f('0x18')](_0x85e912);}};}function respondWithFilteredResult(_0x4a54ba,_0x4c9a3c){return function(_0x2f8946){if(_0x2f8946){var _0x35d569=typeof _0x4c9a3c[_0xb75f('0x19')]==='undefined'&&typeof _0x4c9a3c[_0xb75f('0x1a')]===_0xb75f('0x1b');var _0x224cdd=_0x2f8946[_0xb75f('0x1c')];var _0x1101b3=_0x35d569?0x0:_0x4c9a3c[_0xb75f('0x19')];var _0x4a8f12=_0x35d569?_0x2f8946[_0xb75f('0x1c')]:_0x4c9a3c['offset']+_0x4c9a3c['limit'];var _0x4db982;if(_0x4a8f12>=_0x224cdd){_0x4a8f12=_0x224cdd;_0x4db982=0xc8;}else{_0x4db982=0xce;}_0x4a54ba[_0xb75f('0x16')](_0x4db982);return _0x4a54ba['set']('Content-Range',_0x1101b3+'-'+_0x4a8f12+'/'+_0x224cdd)[_0xb75f('0x18')](_0x2f8946);}return null;};}function patchUpdates(_0x2ba686){return function(_0x40db18){try{jsonpatch['apply'](_0x40db18,_0x2ba686,!![]);}catch(_0x3789ab){return BPromise[_0xb75f('0x1d')](_0x3789ab);}return _0x40db18[_0xb75f('0x1e')]();};}function saveUpdates(_0x1f746d,_0x4b4481){return function(_0x34259f){if(_0x34259f){return _0x34259f[_0xb75f('0x1f')](_0x1f746d)[_0xb75f('0x20')](function(_0x539fc4){return _0x539fc4;});}return null;};}function removeEntity(_0xaf2fdf,_0x3d73d7){return function(_0x443760){if(_0x443760){return _0x443760['destroy']()[_0xb75f('0x20')](function(){_0xaf2fdf[_0xb75f('0x16')](0xcc)[_0xb75f('0x17')]();});}};}function handleEntityNotFound(_0x40c118,_0x496ef6){return function(_0xf63a50){if(!_0xf63a50){_0x40c118[_0xb75f('0x21')](0x194);}return _0xf63a50;};}function handleError(_0x319087,_0x6cb9c2){_0x6cb9c2=_0x6cb9c2||0x1f4;return function(_0x13e5db){logger[_0xb75f('0x22')](_0x13e5db[_0xb75f('0x23')]);if(_0x13e5db['name']){delete _0x13e5db[_0xb75f('0x24')];}_0x319087['status'](_0x6cb9c2)[_0xb75f('0x25')](_0x13e5db);};}exports[_0xb75f('0x26')]=function(_0x3c78c3,_0x40e9df){var _0x54ee83={},_0x2b7e3b={},_0x1a230c={'count':0x0,'rows':[]};var _0x28661e=_[_0xb75f('0x27')](db['SalesforceField'][_0xb75f('0x28')],function(_0x48ec65){return{'name':_0x48ec65[_0xb75f('0x29')],'type':_0x48ec65['type'][_0xb75f('0x2a')]};});_0x2b7e3b[_0xb75f('0x2b')]=_[_0xb75f('0x27')](_0x28661e,_0xb75f('0x24'));_0x2b7e3b[_0xb75f('0x2c')]=_[_0xb75f('0x2d')](_0x3c78c3[_0xb75f('0x2c')]);_0x2b7e3b[_0xb75f('0x2e')]=_[_0xb75f('0x2f')](_0x2b7e3b[_0xb75f('0x2b')],_0x2b7e3b[_0xb75f('0x2c')]);_0x54ee83[_0xb75f('0x30')]=_[_0xb75f('0x2f')](_0x2b7e3b[_0xb75f('0x2b')],qs[_0xb75f('0x31')](_0x3c78c3['query'][_0xb75f('0x31')]));_0x54ee83[_0xb75f('0x30')]=_0x54ee83[_0xb75f('0x30')]['length']?_0x54ee83[_0xb75f('0x30')]:_0x2b7e3b[_0xb75f('0x2b')];if(!_0x3c78c3[_0xb75f('0x2c')][_0xb75f('0x32')]('nolimit')){_0x54ee83['limit']=qs[_0xb75f('0x1a')](_0x3c78c3[_0xb75f('0x2c')][_0xb75f('0x1a')]);_0x54ee83[_0xb75f('0x19')]=qs[_0xb75f('0x19')](_0x3c78c3[_0xb75f('0x2c')][_0xb75f('0x19')]);}_0x54ee83[_0xb75f('0x33')]=qs[_0xb75f('0x34')](_0x3c78c3['query'][_0xb75f('0x34')]);_0x54ee83['where']=qs[_0xb75f('0x2e')](_[_0xb75f('0x35')](_0x3c78c3['query'],_0x2b7e3b['filters']),_0x28661e);if(_0x3c78c3[_0xb75f('0x2c')][_0xb75f('0x36')]){_0x54ee83[_0xb75f('0x37')]=_[_0xb75f('0x38')](_0x54ee83[_0xb75f('0x37')],{'$or':_[_0xb75f('0x27')](_0x28661e,function(_0x2726d8){if(_0x2726d8[_0xb75f('0x39')]!==_0xb75f('0x3a')){var _0x11d10e={};_0x11d10e[_0x2726d8[_0xb75f('0x24')]]={'$like':'%'+_0x3c78c3[_0xb75f('0x2c')]['filter']+'%'};return _0x11d10e;}})});}_0x54ee83=_[_0xb75f('0x38')]({},_0x54ee83,_0x3c78c3[_0xb75f('0x3b')]);var _0x2c2852={'where':_0x54ee83['where']};return db[_0xb75f('0x3c')]['count'](_0x2c2852)['then'](function(_0x1dc83f){_0x1a230c['count']=_0x1dc83f;if(_0x3c78c3[_0xb75f('0x2c')]['includeAll']){_0x54ee83[_0xb75f('0x3d')]=[{'all':!![]}];}return db[_0xb75f('0x3c')][_0xb75f('0x3e')](_0x54ee83);})['then'](function(_0x1441e0){_0x1a230c['rows']=_0x1441e0;return _0x1a230c;})[_0xb75f('0x20')](respondWithFilteredResult(_0x40e9df,_0x54ee83))[_0xb75f('0x3f')](handleError(_0x40e9df,null));};exports[_0xb75f('0x40')]=function(_0x4590c5,_0x1271c0){var _0x461fe5={'raw':!![],'where':{'id':_0x4590c5['params']['id']}},_0x5074cb={};_0x5074cb[_0xb75f('0x2b')]=_[_0xb75f('0x2d')](db['SalesforceField'][_0xb75f('0x28')]);_0x5074cb['query']=_[_0xb75f('0x2d')](_0x4590c5[_0xb75f('0x2c')]);_0x5074cb['filters']=_[_0xb75f('0x2f')](_0x5074cb['model'],_0x5074cb[_0xb75f('0x2c')]);_0x461fe5[_0xb75f('0x30')]=_[_0xb75f('0x2f')](_0x5074cb[_0xb75f('0x2b')],qs[_0xb75f('0x31')](_0x4590c5[_0xb75f('0x2c')][_0xb75f('0x31')]));_0x461fe5[_0xb75f('0x30')]=_0x461fe5[_0xb75f('0x30')][_0xb75f('0x41')]?_0x461fe5[_0xb75f('0x30')]:_0x5074cb[_0xb75f('0x2b')];if(_0x4590c5[_0xb75f('0x2c')][_0xb75f('0x42')]){_0x461fe5['include']=[{'all':!![]}];}_0x461fe5=_[_0xb75f('0x38')]({},_0x461fe5,_0x4590c5[_0xb75f('0x3b')]);return db[_0xb75f('0x3c')][_0xb75f('0x43')](_0x461fe5)[_0xb75f('0x20')](handleEntityNotFound(_0x1271c0,null))[_0xb75f('0x20')](respondWithResult(_0x1271c0,null))[_0xb75f('0x3f')](handleError(_0x1271c0,null));};exports[_0xb75f('0x44')]=function(_0x321939,_0x34adaa){return db[_0xb75f('0x3c')][_0xb75f('0x44')](_0x321939[_0xb75f('0x45')],{})[_0xb75f('0x20')](respondWithResult(_0x34adaa,0xc9))['catch'](handleError(_0x34adaa,null));};exports['update']=function(_0x52a52d,_0x147bb4){if(_0x52a52d[_0xb75f('0x45')]['id']){delete _0x52a52d[_0xb75f('0x45')]['id'];}return db[_0xb75f('0x3c')][_0xb75f('0x43')]({'where':{'id':_0x52a52d[_0xb75f('0x46')]['id']}})[_0xb75f('0x20')](handleEntityNotFound(_0x147bb4,null))['then'](saveUpdates(_0x52a52d['body'],null))[_0xb75f('0x20')](respondWithResult(_0x147bb4,null))[_0xb75f('0x3f')](handleError(_0x147bb4,null));};exports['destroy']=function(_0x5a7f1c,_0x1bc2e6){return db[_0xb75f('0x3c')]['find']({'where':{'id':_0x5a7f1c[_0xb75f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bc2e6,null))[_0xb75f('0x20')](removeEntity(_0x1bc2e6,null))['catch'](handleError(_0x1bc2e6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9c2e1ea..7e00988 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 _0xaa8f=['SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','request-promise','rimraf','./intSalesforceField.attributes','exports'];(function(_0x4a9148,_0x4a699e){var _0x27057a=function(_0xbbaad3){while(--_0xbbaad3){_0x4a9148['push'](_0x4a9148['shift']());}};_0x27057a(++_0x4a699e);}(_0xaa8f,0x16c));var _0xfaa8=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0xaa8f[_0x3bab09];return _0x164376;};'use strict';var _=require(_0xfaa8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfaa8('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfaa8('0x2'));var config=require('../../config/environment');var attributes=require(_0xfaa8('0x3'));module[_0xfaa8('0x4')]=function(_0x5a7ed0,_0x31905f){return _0x5a7ed0['define'](_0xfaa8('0x5'),attributes,{'tableName':_0xfaa8('0x6'),'paranoid':![],'indexes':[{'name':_0xfaa8('0x7'),'fields':[_0xfaa8('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf78=['define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x1e65ba,_0x445d78){var _0x3d331b=function(_0xfcc642){while(--_0xfcc642){_0x1e65ba['push'](_0x1e65ba['shift']());}};_0x3d331b(++_0x445d78);}(_0xaf78,0x1c5));var _0x8af7=function(_0x5a671a,_0x1d5a6e){_0x5a671a=_0x5a671a-0x0;var _0x5f06a8=_0xaf78[_0x5a671a];return _0x5f06a8;};'use strict';var _=require(_0x8af7('0x0'));var util=require(_0x8af7('0x1'));var logger=require(_0x8af7('0x2'))('api');var moment=require(_0x8af7('0x3'));var BPromise=require(_0x8af7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8af7('0x5'));var rimraf=require(_0x8af7('0x6'));var config=require(_0x8af7('0x7'));var attributes=require(_0x8af7('0x8'));module['exports']=function(_0x19b89d,_0x299c2e){return _0x19b89d[_0x8af7('0x9')](_0x8af7('0xa'),attributes,{'tableName':_0x8af7('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x8af7('0xc'),_0x8af7('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 cf52269..0520509 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 _0x068d=['../../config/logger','rpc','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x401dc2,_0x2409c5){var _0x90a3f8=function(_0x2d855a){while(--_0x2d855a){_0x401dc2['push'](_0x401dc2['shift']());}};_0x90a3f8(++_0x2409c5);}(_0x068d,0xf7));var _0xd068=function(_0x489fa2,_0x4f6b04){_0x489fa2=_0x489fa2-0x0;var _0x5abdf0=_0x068d[_0x489fa2];return _0x5abdf0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd068('0x0'));var BPromise=require(_0xd068('0x1'));var rs=require(_0xd068('0x2'));var fs=require('fs');var Redis=require(_0xd068('0x3'));var db=require(_0xd068('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd068('0x5'))(_0xd068('0x6'));var config=require('../../config/environment');var jayson=require(_0xd068('0x7'));var client=jayson[_0xd068('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a47d0,_0x9f684a,_0x162276){return new BPromise(function(_0x3cc777,_0x4826da){return client[_0xd068('0x9')](_0x5a47d0,_0x162276)[_0xd068('0xa')](function(_0xb5b918){logger['info'](_0xd068('0xb'),_0x9f684a,_0xd068('0xc'));logger[_0xd068('0xd')](_0xd068('0xe'),_0x9f684a,'request\x20sent',JSON[_0xd068('0xf')](_0xb5b918));if(_0xb5b918[_0xd068('0x10')]){if(_0xb5b918['error'][_0xd068('0x11')]===0x1f4){logger[_0xd068('0x10')]('SalesforceField,\x20%s,\x20%s',_0x9f684a,_0xb5b918[_0xd068('0x10')][_0xd068('0x12')]);return _0x4826da(_0xb5b918[_0xd068('0x10')][_0xd068('0x12')]);}logger[_0xd068('0x10')](_0xd068('0xb'),_0x9f684a,_0xb5b918[_0xd068('0x10')][_0xd068('0x12')]);return _0x3cc777(_0xb5b918[_0xd068('0x10')]['message']);}else{logger[_0xd068('0x13')](_0xd068('0xb'),_0x9f684a,_0xd068('0xc'));_0x3cc777(_0xb5b918[_0xd068('0x14')][_0xd068('0x12')]);}})['catch'](function(_0x478220){logger[_0xd068('0x10')](_0xd068('0xb'),_0x9f684a,_0x478220);_0x4826da(_0x478220);});});} \ No newline at end of file +var _0x9d5e=['../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40faba,_0x29e9ab){var _0x5e0fe2=function(_0x4d5093){while(--_0x4d5093){_0x40faba['push'](_0x40faba['shift']());}};_0x5e0fe2(++_0x29e9ab);}(_0x9d5e,0x174));var _0xe9d5=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x9d5e[_0x2b8077];return _0x308091;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe9d5('0x0'));var rs=require(_0xe9d5('0x1'));var fs=require('fs');var Redis=require(_0xe9d5('0x2'));var db=require(_0xe9d5('0x3'))['db'];var utils=require(_0xe9d5('0x4'));var logger=require(_0xe9d5('0x5'))('rpc');var config=require(_0xe9d5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe9d5('0x7')][_0xe9d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4050e0,_0x404a14,_0x4fb1d3){return new BPromise(function(_0x12f00d,_0x588c97){return client[_0xe9d5('0x9')](_0x4050e0,_0x4fb1d3)[_0xe9d5('0xa')](function(_0x3e9946){logger['info'](_0xe9d5('0xb'),_0x404a14,'request\x20sent');logger[_0xe9d5('0xc')](_0xe9d5('0xd'),_0x404a14,_0xe9d5('0xe'),JSON['stringify'](_0x3e9946));if(_0x3e9946['error']){if(_0x3e9946['error'][_0xe9d5('0xf')]===0x1f4){logger['error'](_0xe9d5('0xb'),_0x404a14,_0x3e9946['error'][_0xe9d5('0x10')]);return _0x588c97(_0x3e9946[_0xe9d5('0x11')][_0xe9d5('0x10')]);}logger['error'](_0xe9d5('0xb'),_0x404a14,_0x3e9946[_0xe9d5('0x11')][_0xe9d5('0x10')]);return _0x12f00d(_0x3e9946[_0xe9d5('0x11')][_0xe9d5('0x10')]);}else{logger[_0xe9d5('0x12')](_0xe9d5('0xb'),_0x404a14,_0xe9d5('0xe'));_0x12f00d(_0x3e9946[_0xe9d5('0x13')][_0xe9d5('0x10')]);}})[_0xe9d5('0x14')](function(_0x2f246c){logger[_0xe9d5('0x11')]('SalesforceField,\x20%s,\x20%s',_0x404a14,_0x2f246c);_0x588c97(_0x2f246c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3556ddb..e5fd9c3 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 _0xf6f6=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xf6f6,0x15e));var _0x6f6f=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0xf6f6[_0x52a857];return _0x4e2aae;};'use strict';var multer=require(_0x6f6f('0x0'));var util=require('util');var path=require(_0x6f6f('0x1'));var timeout=require(_0x6f6f('0x2'));var express=require(_0x6f6f('0x3'));var router=express[_0x6f6f('0x4')]();var fs_extra=require(_0x6f6f('0x5'));var auth=require(_0x6f6f('0x6'));var interaction=require(_0x6f6f('0x7'));var config=require('../../config/environment');var controller=require(_0x6f6f('0x8'));router[_0x6f6f('0x9')]('/',auth[_0x6f6f('0xa')](),controller[_0x6f6f('0xb')]);router[_0x6f6f('0x9')](_0x6f6f('0xc'),auth[_0x6f6f('0xa')](),controller['show']);router[_0x6f6f('0x9')](_0x6f6f('0xd'),auth['isAuthenticated'](),controller[_0x6f6f('0xe')]);router[_0x6f6f('0x9')](_0x6f6f('0xf'),auth[_0x6f6f('0xa')](),controller[_0x6f6f('0x10')]);router[_0x6f6f('0x11')]('/',auth[_0x6f6f('0xa')](),controller[_0x6f6f('0x12')]);router['post'](_0x6f6f('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x6f6f('0x13')](_0x6f6f('0xc'),auth['isAuthenticated'](),controller[_0x6f6f('0x14')]);router[_0x6f6f('0x15')]('/:id',auth[_0x6f6f('0xa')](),controller['destroy']);module[_0x6f6f('0x16')]=router; \ No newline at end of file +var _0xbd5c=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','addConfiguration','multer'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xbd5c,0x19d));var _0xcbd5=function(_0x1819fe,_0x400990){_0x1819fe=_0x1819fe-0x0;var _0x57ce5b=_0xbd5c[_0x1819fe];return _0x57ce5b;};'use strict';var multer=require(_0xcbd5('0x0'));var util=require(_0xcbd5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd5('0x2'));var router=express[_0xcbd5('0x3')]();var fs_extra=require(_0xcbd5('0x4'));var auth=require(_0xcbd5('0x5'));var interaction=require(_0xcbd5('0x6'));var config=require(_0xcbd5('0x7'));var controller=require(_0xcbd5('0x8'));router[_0xcbd5('0x9')]('/',auth[_0xcbd5('0xa')](),controller[_0xcbd5('0xb')]);router['get'](_0xcbd5('0xc'),auth[_0xcbd5('0xa')](),controller[_0xcbd5('0xd')]);router[_0xcbd5('0x9')](_0xcbd5('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xcbd5('0x9')]('/:id/fields',auth[_0xcbd5('0xa')](),controller[_0xcbd5('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcbd5('0x10')]('/:id/configurations',auth[_0xcbd5('0xa')](),controller[_0xcbd5('0x11')]);router['put'](_0xcbd5('0xc'),auth[_0xcbd5('0xa')](),controller['update']);router['delete']('/:id',auth[_0xcbd5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index cd6eb92..b9bc56b 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 _0x00e9=['STRING','username','remoteUri','sequelize'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x00e9,0x193));var _0x900e=function(_0x2bad9b,_0xc85c82){_0x2bad9b=_0x2bad9b-0x0;var _0x217bdf=_0x00e9[_0x2bad9b];return _0x217bdf;};'use strict';var Sequelize=require(_0x900e('0x0'));module['exports']={'name':{'type':Sequelize[_0x900e('0x1')]},'description':{'type':Sequelize[_0x900e('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x900e('0x2')},'password':{'type':Sequelize[_0x900e('0x1')]},'email':{'type':Sequelize[_0x900e('0x1')]},'remoteUri':{'type':Sequelize[_0x900e('0x1')],'unique':_0x900e('0x3')},'serverUrl':{'type':Sequelize[_0x900e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7be2=['remoteUri','sequelize','STRING','username'];(function(_0x908fdd,_0x2e851f){var _0x4abe75=function(_0x281dc0){while(--_0x281dc0){_0x908fdd['push'](_0x908fdd['shift']());}};_0x4abe75(++_0x2e851f);}(_0x7be2,0xd5));var _0x27be=function(_0x21d0df,_0x370d7e){_0x21d0df=_0x21d0df-0x0;var _0x13ffdc=_0x7be2[_0x21d0df];return _0x13ffdc;};'use strict';var Sequelize=require(_0x27be('0x0'));module['exports']={'name':{'type':Sequelize[_0x27be('0x1')]},'description':{'type':Sequelize[_0x27be('0x1')]},'username':{'type':Sequelize[_0x27be('0x1')],'unique':_0x27be('0x2')},'password':{'type':Sequelize[_0x27be('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x27be('0x1')],'unique':_0x27be('0x3')},'serverUrl':{'type':Sequelize[_0x27be('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a6926a2..708aee7 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 _0x8a02=['caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','company','severity','comments','sla_due','approval','due_date','reopen_count','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','forEach','internalType','label','push','all','TCL:\x20_object','remove','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','send','test','Wrong\x20credentials','statusCode','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','pick','where','merge','map','VIRTUAL','filter','options','ServicenowAccount','findAll','rows','catch','params','includeAll','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','ServicenowField','getFields','made_sla','subcategory','close_code','parent'];(function(_0x480fef,_0x4d4eb9){var _0x2f635a=function(_0x26988d){while(--_0x26988d){_0x480fef['push'](_0x480fef['shift']());}};_0x2f635a(++_0x4d4eb9);}(_0x8a02,0x116));var _0x28a0=function(_0x410efd,_0x57da1f){_0x410efd=_0x410efd-0x0;var _0x5e6387=_0x8a02[_0x410efd];return _0x5e6387;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x28a0('0x0'));var jsonpatch=require(_0x28a0('0x1'));var rp=require(_0x28a0('0x2'));var moment=require(_0x28a0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x28a0('0x4'));var util=require(_0x28a0('0x5'));var path=require(_0x28a0('0x6'));var sox=require(_0x28a0('0x7'));var csv=require('to-csv');var ejs=require(_0x28a0('0x8'));var fs=require('fs');var fs_extra=require(_0x28a0('0x9'));var _=require(_0x28a0('0xa'));var squel=require(_0x28a0('0xb'));var crypto=require(_0x28a0('0xc'));var jsforce=require(_0x28a0('0xd'));var deskjs=require(_0x28a0('0xe'));var toCsv=require(_0x28a0('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x28a0('0x10'));var qs=require(_0x28a0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28a0('0x12'));var logger=require(_0x28a0('0x13'))(_0x28a0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x28a0('0x15'));var db=require(_0x28a0('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e734b,_0x1a06d1){_0x1a06d1=_0x1a06d1||0xcc;return function(_0x20bf0e){if(_0x20bf0e){return _0x3e734b[_0x28a0('0x17')](_0x1a06d1);}return _0x3e734b[_0x28a0('0x18')](_0x1a06d1)[_0x28a0('0x19')]();};}function respondWithResult(_0x1285bf,_0x5aa23b){_0x5aa23b=_0x5aa23b||0xc8;return function(_0x33be){if(_0x33be){return _0x1285bf['status'](_0x5aa23b)[_0x28a0('0x1a')](_0x33be);}};}function respondWithFilteredResult(_0x1669b2,_0x451365){return function(_0x2b3294){if(_0x2b3294){var _0x4314ea=typeof _0x451365[_0x28a0('0x1b')]==='undefined'&&typeof _0x451365[_0x28a0('0x1c')]==='undefined';var _0xe92ba4=_0x2b3294[_0x28a0('0x1d')];var _0xaf2cbd=_0x4314ea?0x0:_0x451365[_0x28a0('0x1b')];var _0x4d5e50=_0x4314ea?_0x2b3294[_0x28a0('0x1d')]:_0x451365['offset']+_0x451365['limit'];var _0x244620;if(_0x4d5e50>=_0xe92ba4){_0x4d5e50=_0xe92ba4;_0x244620=0xc8;}else{_0x244620=0xce;}_0x1669b2[_0x28a0('0x18')](_0x244620);return _0x1669b2[_0x28a0('0x1e')](_0x28a0('0x1f'),_0xaf2cbd+'-'+_0x4d5e50+'/'+_0xe92ba4)['json'](_0x2b3294);}return null;};}function patchUpdates(_0x5025a3){return function(_0x5e8b98){try{jsonpatch['apply'](_0x5e8b98,_0x5025a3,!![]);}catch(_0x12200f){return BPromise[_0x28a0('0x20')](_0x12200f);}return _0x5e8b98['save']();};}function saveUpdates(_0x1e3247,_0x101430){return function(_0x354c7d){if(_0x354c7d){return _0x354c7d['update'](_0x1e3247)[_0x28a0('0x21')](function(_0x5c9d13){return _0x5c9d13;});}return null;};}function removeEntity(_0x3d6740,_0x31bdc7){return function(_0x19891e){if(_0x19891e){return _0x19891e[_0x28a0('0x22')]()[_0x28a0('0x21')](function(){_0x3d6740[_0x28a0('0x18')](0xcc)[_0x28a0('0x19')]();});}};}function handleEntityNotFound(_0x1251e9,_0x42322f){return function(_0x29a18b){if(!_0x29a18b){_0x1251e9[_0x28a0('0x17')](0x194);}return _0x29a18b;};}function handleError(_0x3f489e,_0x2eb7f9){_0x2eb7f9=_0x2eb7f9||0x1f4;return function(_0x17cad7){logger[_0x28a0('0x23')](_0x17cad7[_0x28a0('0x24')]);if(_0x17cad7[_0x28a0('0x25')]){delete _0x17cad7[_0x28a0('0x25')];}_0x3f489e[_0x28a0('0x18')](_0x2eb7f9)['send'](_0x17cad7);};}exports['index']=function(_0x3167ea,_0x52e1e9){var _0xf60c1d={},_0x5c848d={},_0x25b9dd={'count':0x0,'rows':[]};var _0xc225ed=_['map'](db['ServicenowAccount'][_0x28a0('0x26')],function(_0x2b6db0){return{'name':_0x2b6db0[_0x28a0('0x27')],'type':_0x2b6db0['type'][_0x28a0('0x28')]};});_0x5c848d[_0x28a0('0x29')]=_['map'](_0xc225ed,_0x28a0('0x25'));_0x5c848d['query']=_[_0x28a0('0x2a')](_0x3167ea[_0x28a0('0x2b')]);_0x5c848d[_0x28a0('0x2c')]=_[_0x28a0('0x2d')](_0x5c848d[_0x28a0('0x29')],_0x5c848d[_0x28a0('0x2b')]);_0xf60c1d[_0x28a0('0x2e')]=_['intersection'](_0x5c848d[_0x28a0('0x29')],qs['fields'](_0x3167ea['query'][_0x28a0('0x2f')]));_0xf60c1d['attributes']=_0xf60c1d[_0x28a0('0x2e')][_0x28a0('0x30')]?_0xf60c1d['attributes']:_0x5c848d[_0x28a0('0x29')];if(!_0x3167ea[_0x28a0('0x2b')]['hasOwnProperty']('nolimit')){_0xf60c1d[_0x28a0('0x1c')]=qs[_0x28a0('0x1c')](_0x3167ea['query'][_0x28a0('0x1c')]);_0xf60c1d[_0x28a0('0x1b')]=qs[_0x28a0('0x1b')](_0x3167ea[_0x28a0('0x2b')]['offset']);}_0xf60c1d['order']=qs[_0x28a0('0x31')](_0x3167ea[_0x28a0('0x2b')][_0x28a0('0x31')]);_0xf60c1d['where']=qs[_0x28a0('0x2c')](_[_0x28a0('0x32')](_0x3167ea[_0x28a0('0x2b')],_0x5c848d[_0x28a0('0x2c')]),_0xc225ed);if(_0x3167ea[_0x28a0('0x2b')]['filter']){_0xf60c1d[_0x28a0('0x33')]=_[_0x28a0('0x34')](_0xf60c1d[_0x28a0('0x33')],{'$or':_[_0x28a0('0x35')](_0xc225ed,function(_0x53a85e){if(_0x53a85e['type']!==_0x28a0('0x36')){var _0x4bfff8={};_0x4bfff8[_0x53a85e[_0x28a0('0x25')]]={'$like':'%'+_0x3167ea['query'][_0x28a0('0x37')]+'%'};return _0x4bfff8;}})});}_0xf60c1d=_[_0x28a0('0x34')]({},_0xf60c1d,_0x3167ea[_0x28a0('0x38')]);var _0x89a9a={'where':_0xf60c1d[_0x28a0('0x33')]};return db[_0x28a0('0x39')][_0x28a0('0x1d')](_0x89a9a)[_0x28a0('0x21')](function(_0x48ac91){_0x25b9dd[_0x28a0('0x1d')]=_0x48ac91;if(_0x3167ea['query']['includeAll']){_0xf60c1d['include']=[{'all':!![]}];}return db[_0x28a0('0x39')][_0x28a0('0x3a')](_0xf60c1d);})[_0x28a0('0x21')](function(_0xf758aa){_0x25b9dd[_0x28a0('0x3b')]=_0xf758aa;return _0x25b9dd;})[_0x28a0('0x21')](respondWithFilteredResult(_0x52e1e9,_0xf60c1d))[_0x28a0('0x3c')](handleError(_0x52e1e9,null));};exports['show']=function(_0xf8823,_0x4a3d59){var _0x48096d={'raw':![],'where':{'id':_0xf8823[_0x28a0('0x3d')]['id']}},_0x3aab92={};_0x3aab92['model']=_[_0x28a0('0x2a')](db[_0x28a0('0x39')]['rawAttributes']);_0x3aab92[_0x28a0('0x2b')]=_[_0x28a0('0x2a')](_0xf8823[_0x28a0('0x2b')]);_0x3aab92['filters']=_[_0x28a0('0x2d')](_0x3aab92[_0x28a0('0x29')],_0x3aab92[_0x28a0('0x2b')]);_0x48096d[_0x28a0('0x2e')]=_[_0x28a0('0x2d')](_0x3aab92['model'],qs[_0x28a0('0x2f')](_0xf8823[_0x28a0('0x2b')][_0x28a0('0x2f')]));_0x48096d['attributes']=_0x48096d[_0x28a0('0x2e')][_0x28a0('0x30')]?_0x48096d[_0x28a0('0x2e')]:_0x3aab92[_0x28a0('0x29')];if(_0xf8823[_0x28a0('0x2b')][_0x28a0('0x3e')]){_0x48096d[_0x28a0('0x3f')]=[{'all':!![]}];}_0x48096d=_[_0x28a0('0x34')]({},_0x48096d,_0xf8823[_0x28a0('0x38')]);return db[_0x28a0('0x39')][_0x28a0('0x40')](_0x48096d)[_0x28a0('0x21')](handleEntityNotFound(_0x4a3d59,null))[_0x28a0('0x21')](respondWithResult(_0x4a3d59,null))[_0x28a0('0x3c')](handleError(_0x4a3d59,null));};exports[_0x28a0('0x41')]=function(_0x2e82e3,_0x448816){return db['ServicenowAccount'][_0x28a0('0x41')](_0x2e82e3[_0x28a0('0x42')],{})[_0x28a0('0x21')](respondWithResult(_0x448816,0xc9))[_0x28a0('0x3c')](handleError(_0x448816,null));};exports['update']=function(_0x2d7ede,_0x593231){if(_0x2d7ede[_0x28a0('0x42')]['id']){delete _0x2d7ede[_0x28a0('0x42')]['id'];}return db[_0x28a0('0x39')]['find']({'where':{'id':_0x2d7ede[_0x28a0('0x3d')]['id']}})[_0x28a0('0x21')](handleEntityNotFound(_0x593231,null))[_0x28a0('0x21')](saveUpdates(_0x2d7ede[_0x28a0('0x42')],null))['then'](respondWithResult(_0x593231,null))[_0x28a0('0x3c')](handleError(_0x593231,null));};exports[_0x28a0('0x22')]=function(_0x4a2828,_0x495cbe){return db['ServicenowAccount']['find']({'where':{'id':_0x4a2828[_0x28a0('0x3d')]['id']}})[_0x28a0('0x21')](handleEntityNotFound(_0x495cbe,null))[_0x28a0('0x21')](removeEntity(_0x495cbe,null))[_0x28a0('0x3c')](handleError(_0x495cbe,null));};exports[_0x28a0('0x43')]=function(_0x216b4d,_0x254aef,_0x10afbc){var _0x297cb1={};var _0x4b71db={};var _0x2385c5;var _0xf6e131;return db[_0x28a0('0x39')][_0x28a0('0x44')]({'where':{'id':_0x216b4d[_0x28a0('0x3d')]['id']}})[_0x28a0('0x21')](handleEntityNotFound(_0x254aef,null))[_0x28a0('0x21')](function(_0x4006b8){if(_0x4006b8){_0x2385c5=_0x4006b8;_0x4b71db[_0x28a0('0x29')]=_[_0x28a0('0x2a')](db[_0x28a0('0x45')][_0x28a0('0x26')]);_0x4b71db['query']=_[_0x28a0('0x2a')](_0x216b4d[_0x28a0('0x2b')]);_0x4b71db['filters']=_['intersection'](_0x4b71db[_0x28a0('0x29')],_0x4b71db[_0x28a0('0x2b')]);_0x297cb1[_0x28a0('0x2e')]=_[_0x28a0('0x2d')](_0x4b71db[_0x28a0('0x29')],qs[_0x28a0('0x2f')](_0x216b4d[_0x28a0('0x2b')]['fields']));_0x297cb1['attributes']=_0x297cb1[_0x28a0('0x2e')][_0x28a0('0x30')]?_0x297cb1[_0x28a0('0x2e')]:_0x4b71db['model'];_0x297cb1[_0x28a0('0x46')]=qs[_0x28a0('0x31')](_0x216b4d['query']['sort']);_0x297cb1[_0x28a0('0x33')]=qs['filters'](_[_0x28a0('0x32')](_0x216b4d[_0x28a0('0x2b')],_0x4b71db[_0x28a0('0x2c')]));if(_0x216b4d[_0x28a0('0x2b')][_0x28a0('0x37')]){_0x297cb1[_0x28a0('0x33')]=_[_0x28a0('0x34')](_0x297cb1['where'],{'$or':_[_0x28a0('0x35')](_0x297cb1[_0x28a0('0x2e')],function(_0x5420e3){var _0x7133d3={};_0x7133d3[_0x5420e3]={'$like':'%'+_0x216b4d['query'][_0x28a0('0x37')]+'%'};return _0x7133d3;})});}_0x297cb1=_[_0x28a0('0x34')]({},_0x297cb1,_0x216b4d[_0x28a0('0x38')]);return _0x2385c5[_0x28a0('0x43')](_0x297cb1);}})[_0x28a0('0x21')](function(_0x2031a6){if(_0x2031a6){_0xf6e131=_0x2031a6['length'];if(!_0x216b4d[_0x28a0('0x2b')][_0x28a0('0x47')](_0x28a0('0x48'))){_0x297cb1[_0x28a0('0x1c')]=qs[_0x28a0('0x1c')](_0x216b4d[_0x28a0('0x2b')][_0x28a0('0x1c')]);_0x297cb1['offset']=qs['offset'](_0x216b4d[_0x28a0('0x2b')][_0x28a0('0x1b')]);}return _0x2385c5[_0x28a0('0x43')](_0x297cb1);}})[_0x28a0('0x21')](function(_0x1d4a79){if(_0x1d4a79){return _0x1d4a79?{'count':_0xf6e131,'rows':_0x1d4a79}:null;}})['then'](respondWithResult(_0x254aef,null))[_0x28a0('0x3c')](handleError(_0x254aef,null));};exports[_0x28a0('0x49')]=function(_0x394671,_0x204eba,_0x40e791){if(_0x394671[_0x28a0('0x42')]['id']){delete _0x394671[_0x28a0('0x42')]['id'];}return db[_0x28a0('0x39')][_0x28a0('0x44')]({'where':{'id':_0x394671[_0x28a0('0x3d')]['id']}})['then'](handleEntityNotFound(_0x204eba,null))[_0x28a0('0x21')](function(_0x101e10){if(_0x101e10){_0x394671['body'][_0x28a0('0x4a')]=_0x101e10['id'];_0x394671[_0x28a0('0x42')][_0x28a0('0x4b')]=integrations[_0x28a0('0x4c')](_0x394671[_0x28a0('0x42')][_0x28a0('0x4d')],_0x394671[_0x28a0('0x42')][_0x28a0('0x4e')]);_0x394671[_0x28a0('0x42')][_0x28a0('0x4f')]=integrations['getDescriptions'](_0x394671[_0x28a0('0x42')][_0x28a0('0x4d')],_0x394671['body'][_0x28a0('0x4e')]);return db[_0x28a0('0x45')][_0x28a0('0x41')](_0x394671[_0x28a0('0x42')],{'include':[{'model':db[_0x28a0('0x50')],'as':_0x28a0('0x4b')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x28a0('0x21')](respondWithResult(_0x204eba,null))[_0x28a0('0x3c')](handleError(_0x204eba,null));};exports[_0x28a0('0x51')]=function(_0x3cbaad,_0x1cf413,_0x49df20){var _0x48c968=[_0x28a0('0x52'),'hold_reason','knowledge',_0x28a0('0x53'),_0x28a0('0x54'),'notify','incident_state','severity','category'];var _0x50d3c1=[_0x28a0('0x55'),_0x28a0('0x52'),_0x28a0('0x56'),_0x28a0('0x57'),_0x28a0('0x58'),_0x28a0('0x59'),_0x28a0('0x5a'),_0x28a0('0x5b'),_0x28a0('0x5c'),'number',_0x28a0('0x5d'),_0x28a0('0x5e'),'opened_by',_0x28a0('0x5f'),_0x28a0('0x60'),'sys_domain','state',_0x28a0('0x61'),_0x28a0('0x62'),_0x28a0('0x46'),_0x28a0('0x63'),_0x28a0('0x64'),_0x28a0('0x65'),_0x28a0('0x66'),'impact',_0x28a0('0x67'),_0x28a0('0x68'),_0x28a0('0x69'),_0x28a0('0x6a'),_0x28a0('0x6b'),_0x28a0('0x6c'),'time_worked',_0x28a0('0x6d'),_0x28a0('0x6e'),_0x28a0('0x6f'),_0x28a0('0x70'),_0x28a0('0x71'),'reopened_time',_0x28a0('0x72'),_0x28a0('0x73'),_0x28a0('0x74'),'subcategory',_0x28a0('0x75'),_0x28a0('0x76'),_0x28a0('0x54'),'correlation_display',_0x28a0('0x77'),_0x28a0('0x78'),'assignment_group',_0x28a0('0x79'),_0x28a0('0x7a'),_0x28a0('0x7b'),_0x28a0('0x7c'),_0x28a0('0x7d'),_0x28a0('0x7e'),_0x28a0('0x7f'),'closed_by',_0x28a0('0x80'),_0x28a0('0x81'),'sys_id',_0x28a0('0x82'),_0x28a0('0x83'),_0x28a0('0x84'),_0x28a0('0x85'),_0x28a0('0x86'),_0x28a0('0x87'),'reassignment_count','activity_due','assigned_to',_0x28a0('0x88'),_0x28a0('0x89'),_0x28a0('0x8a'),_0x28a0('0x8b'),'comments_and_work_notes',_0x28a0('0x8c'),'sys_mod_count',_0x28a0('0x8d'),'sys_tags',_0x28a0('0x8e'),_0x28a0('0x8f'),_0x28a0('0x90'),_0x28a0('0x91'),_0x28a0('0x92')];var _0x4debad='';var _0x1f5e16='';var _0xab913f=[];var _0x2a22c7='';var _0x1e1d7b='';var _0x26c6e0=[];var _0x3dcf8d='';var _0x263625='';var _0x1f5ee6={};var _0x2543ec='';return db['ServicenowAccount'][_0x28a0('0x44')]({'where':{'id':_0x3cbaad[_0x28a0('0x3d')]['id']},'attributes':['id',_0x28a0('0x93'),_0x28a0('0x94'),_0x28a0('0x95'),_0x28a0('0x96'),'serverUrl']})['then'](handleEntityNotFound(_0x1cf413,null))[_0x28a0('0x21')](function(_0x168d62){if(_0x168d62){_0x2543ec=_0x168d62[_0x28a0('0x96')];var _0x3068ff=_0x2543ec[_0x28a0('0x97')](-0x1);if(_0x3068ff==='/'){_0x2543ec=_0x2543ec[_0x28a0('0x98')](0x0,_0x2543ec[_0x28a0('0x99')](_0x3068ff));}_0x263625=util[_0x28a0('0x9a')](_0x28a0('0x9b'),_0x2543ec);_0x3dcf8d=util[_0x28a0('0x9a')](_0x28a0('0x9c'),_0x2543ec);_0x1f5ee6={'user':_0x168d62[_0x28a0('0x93')],'pass':_0x168d62[_0x28a0('0x94')]};var _0x3f2b6a={'method':_0x28a0('0x9d'),'uri':_0x263625+_0x28a0('0x9e'),'auth':_0x1f5ee6,'json':!![]};return rp(_0x3f2b6a);}})[_0x28a0('0x21')](function(_0x3aaf0c){if(_0x3aaf0c[_0x28a0('0x9f')]['length']>0x0){_0x4debad=_0x3aaf0c[_0x28a0('0x9f')];}console[_0x28a0('0xa0')]('incident\x20table\x20objects',_0x4debad);_0x26c6e0=[];_0x1f5e16=Object[_0x28a0('0xa1')]([],_0x4debad);_['remove'](_0x1f5e16,function(_0x5b54d3){return!_0x48c968['includes'](_0x5b54d3[_0x28a0('0x25')]);});_0x1f5e16[_0x28a0('0xa2')](function(_0x4d5169){var _0x1ac08d=createFieldObject(_0x3dcf8d,_0x1f5ee6,_0x4d5169[_0x28a0('0xa3')],_0x4d5169[_0x28a0('0x25')],_0x4d5169[_0x28a0('0xa4')],![]);_0x26c6e0[_0x28a0('0xa5')](_0x1ac08d);});return Promise[_0x28a0('0xa6')](_0x26c6e0);})['then'](function(_0x43e323){_0xab913f=_0x43e323;_0x2a22c7=Object[_0x28a0('0xa1')]([],_0x4debad);console[_0x28a0('0xa0')](_0x28a0('0xa7'),_0x4debad);_[_0x28a0('0xa8')](_0x2a22c7,function(_0x37368b){return _0x50d3c1[_0x28a0('0xa9')](_0x37368b[_0x28a0('0x25')]);});console[_0x28a0('0xa0')](_0x28a0('0xaa'),_0x2a22c7);_0x26c6e0=[];_0x2a22c7[_0x28a0('0xa2')](function(_0x501232){var _0x16c3ce=createFieldObject(_0x3dcf8d,_0x1f5ee6,_0x501232[_0x28a0('0xa3')],_0x501232[_0x28a0('0x25')],_0x501232[_0x28a0('0xa4')],!![]);_0x26c6e0['push'](_0x16c3ce);});return Promise[_0x28a0('0xa6')](_0x26c6e0);})[_0x28a0('0x21')](function(_0x201752){_0x1e1d7b=_0x201752;var _0x330ca3=_0xab913f[_0x28a0('0xab')](_0x1e1d7b);return{'count':_0x330ca3[_0x28a0('0x30')],'rows':_0x330ca3};})[_0x28a0('0x21')](respondWithResult(_0x1cf413,null))[_0x28a0('0x3c')](function(_0x2edba1){console[_0x28a0('0xa0')](_0x28a0('0xac')+_0x2edba1);var _0x20363c=_0x3cbaad['query']['test']?0x1f4:_0x2edba1['statusCode']||0x1f4;logger[_0x28a0('0x23')](_0x2edba1[_0x28a0('0x24')]);delete _0x2edba1['name'];if(_0x20363c===0x191){_0x20363c=0x190;}_0x1cf413[_0x28a0('0x18')](_0x20363c)[_0x28a0('0xad')](_0x3cbaad[_0x28a0('0x2b')][_0x28a0('0xae')]?{'message':_0x28a0('0xaf'),'statusCode':_0x2edba1[_0x28a0('0xb0')]}:_0x2edba1);});};function createFieldObject(_0x378fc0,_0x349480,_0x2c71c8,_0x595ffe,_0x528935,_0x205dcc){return new Promise(function(_0x537ab1,_0x5a9878){var _0x98cbe6={'id':_0x595ffe,'name':_0x528935,'custom':_0x205dcc};if(_0x2c71c8===_0x28a0('0xb1')){_0x98cbe6[_0x28a0('0x38')]=[{'name':_0x28a0('0xb2'),'value':_0x28a0('0xb3')},{'name':'False','value':'false'}];_0x537ab1(_0x98cbe6);}else{var _0x25fb12={'method':_0x28a0('0x9d'),'uri':_0x378fc0+_0x28a0('0xb4')+_0x595ffe,'auth':_0x349480,'json':!![]};return rp(_0x25fb12)['then'](function(_0x4f737b){var _0x4bf853=[];if(_0x4f737b['result'][_0x28a0('0x30')]>0x0){_0x4f737b[_0x28a0('0x9f')][_0x28a0('0xa2')](function(_0x1bcec5){if(_0x1bcec5[_0x28a0('0xb5')]==='false'){var _0x2bbd30={'name':_0x1bcec5[_0x28a0('0xa4')],'value':_0x1bcec5['value']};_0x4bf853[_0x28a0('0xa5')](_0x2bbd30);}});}_0x98cbe6['options']=_0x4bf853;if(_0x98cbe6[_0x28a0('0x38')][_0x28a0('0x30')]>0x0){_0x537ab1(_0x98cbe6);}else{if(_0x205dcc==![]){_0x537ab1();}else{_0x537ab1(_0x98cbe6);}}});}});} \ No newline at end of file +var _0x86a0=['name','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','show','params','options','find','create','body','catch','getConfigurations','ServicenowConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','impact','work_notes_list','business_service','priority','rfc','expected_start','opened_at','work_end','resolved_at','caller_id','approval_set','short_description','close_code','correlation_display','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','serverUrl','slice','substring','format','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','statusCode','send','test','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','json','limit','undefined','count','offset','status','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x86a0,0x132));var _0x086a=function(_0x3ed8c4,_0x269987){_0x3ed8c4=_0x3ed8c4-0x0;var _0x4ece33=_0x86a0[_0x3ed8c4];return _0x4ece33;};'use strict';var emlformat=require(_0x086a('0x0'));var rimraf=require(_0x086a('0x1'));var zipdir=require(_0x086a('0x2'));var jsonpatch=require(_0x086a('0x3'));var rp=require(_0x086a('0x4'));var moment=require(_0x086a('0x5'));var BPromise=require(_0x086a('0x6'));var Mustache=require(_0x086a('0x7'));var util=require(_0x086a('0x8'));var path=require('path');var sox=require(_0x086a('0x9'));var csv=require(_0x086a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x086a('0xb'));var _=require(_0x086a('0xc'));var squel=require(_0x086a('0xd'));var crypto=require(_0x086a('0xe'));var jsforce=require(_0x086a('0xf'));var deskjs=require(_0x086a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x086a('0x11'));var Redis=require(_0x086a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x086a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x086a('0x14'))(_0x086a('0x15'));var utils=require(_0x086a('0x16'));var config=require(_0x086a('0x17'));var licenseUtil=require(_0x086a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x086a('0x19'));function respondWithStatusCode(_0x47dc99,_0x26b638){_0x26b638=_0x26b638||0xcc;return function(_0xced7f2){if(_0xced7f2){return _0x47dc99[_0x086a('0x1a')](_0x26b638);}return _0x47dc99['status'](_0x26b638)['end']();};}function respondWithResult(_0x2e2450,_0x578bb1){_0x578bb1=_0x578bb1||0xc8;return function(_0x131493){if(_0x131493){return _0x2e2450['status'](_0x578bb1)[_0x086a('0x1b')](_0x131493);}};}function respondWithFilteredResult(_0x222968,_0x102551){return function(_0x20ec07){if(_0x20ec07){var _0x2fa23d=typeof _0x102551['offset']==='undefined'&&typeof _0x102551[_0x086a('0x1c')]===_0x086a('0x1d');var _0x39c7a2=_0x20ec07[_0x086a('0x1e')];var _0x101465=_0x2fa23d?0x0:_0x102551[_0x086a('0x1f')];var _0x1cda74=_0x2fa23d?_0x20ec07[_0x086a('0x1e')]:_0x102551[_0x086a('0x1f')]+_0x102551[_0x086a('0x1c')];var _0x3aa281;if(_0x1cda74>=_0x39c7a2){_0x1cda74=_0x39c7a2;_0x3aa281=0xc8;}else{_0x3aa281=0xce;}_0x222968[_0x086a('0x20')](_0x3aa281);return _0x222968[_0x086a('0x21')](_0x086a('0x22'),_0x101465+'-'+_0x1cda74+'/'+_0x39c7a2)[_0x086a('0x1b')](_0x20ec07);}return null;};}function patchUpdates(_0x10b4d2){return function(_0xb605af){try{jsonpatch[_0x086a('0x23')](_0xb605af,_0x10b4d2,!![]);}catch(_0x519334){return BPromise['reject'](_0x519334);}return _0xb605af[_0x086a('0x24')]();};}function saveUpdates(_0x20386a,_0x4d5fe1){return function(_0x1ad608){if(_0x1ad608){return _0x1ad608[_0x086a('0x25')](_0x20386a)[_0x086a('0x26')](function(_0x1eabbd){return _0x1eabbd;});}return null;};}function removeEntity(_0x210739,_0x3a6048){return function(_0x15fc09){if(_0x15fc09){return _0x15fc09[_0x086a('0x27')]()[_0x086a('0x26')](function(){_0x210739[_0x086a('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563a2d,_0x3d14d2){return function(_0x3ca0b8){if(!_0x3ca0b8){_0x563a2d[_0x086a('0x1a')](0x194);}return _0x3ca0b8;};}function handleError(_0x31f157,_0x1148e9){_0x1148e9=_0x1148e9||0x1f4;return function(_0x448591){logger[_0x086a('0x28')](_0x448591[_0x086a('0x29')]);if(_0x448591[_0x086a('0x2a')]){delete _0x448591[_0x086a('0x2a')];}_0x31f157[_0x086a('0x20')](_0x1148e9)['send'](_0x448591);};}exports[_0x086a('0x2b')]=function(_0x5c1fef,_0x406aee){var _0x1fe0bd={},_0xdddd84={},_0x5b1f04={'count':0x0,'rows':[]};var _0x38468b=_['map'](db[_0x086a('0x2c')][_0x086a('0x2d')],function(_0x53122b){return{'name':_0x53122b[_0x086a('0x2e')],'type':_0x53122b[_0x086a('0x2f')][_0x086a('0x30')]};});_0xdddd84[_0x086a('0x31')]=_[_0x086a('0x32')](_0x38468b,_0x086a('0x2a'));_0xdddd84[_0x086a('0x33')]=_[_0x086a('0x34')](_0x5c1fef[_0x086a('0x33')]);_0xdddd84[_0x086a('0x35')]=_[_0x086a('0x36')](_0xdddd84[_0x086a('0x31')],_0xdddd84[_0x086a('0x33')]);_0x1fe0bd['attributes']=_[_0x086a('0x36')](_0xdddd84[_0x086a('0x31')],qs[_0x086a('0x37')](_0x5c1fef[_0x086a('0x33')][_0x086a('0x37')]));_0x1fe0bd[_0x086a('0x38')]=_0x1fe0bd[_0x086a('0x38')][_0x086a('0x39')]?_0x1fe0bd[_0x086a('0x38')]:_0xdddd84[_0x086a('0x31')];if(!_0x5c1fef[_0x086a('0x33')][_0x086a('0x3a')](_0x086a('0x3b'))){_0x1fe0bd[_0x086a('0x1c')]=qs[_0x086a('0x1c')](_0x5c1fef[_0x086a('0x33')][_0x086a('0x1c')]);_0x1fe0bd[_0x086a('0x1f')]=qs[_0x086a('0x1f')](_0x5c1fef[_0x086a('0x33')][_0x086a('0x1f')]);}_0x1fe0bd[_0x086a('0x3c')]=qs['sort'](_0x5c1fef[_0x086a('0x33')][_0x086a('0x3d')]);_0x1fe0bd[_0x086a('0x3e')]=qs[_0x086a('0x35')](_[_0x086a('0x3f')](_0x5c1fef['query'],_0xdddd84[_0x086a('0x35')]),_0x38468b);if(_0x5c1fef[_0x086a('0x33')][_0x086a('0x40')]){_0x1fe0bd[_0x086a('0x3e')]=_[_0x086a('0x41')](_0x1fe0bd[_0x086a('0x3e')],{'$or':_['map'](_0x38468b,function(_0x391c7c){if(_0x391c7c[_0x086a('0x2f')]!=='VIRTUAL'){var _0x5e3fbe={};_0x5e3fbe[_0x391c7c[_0x086a('0x2a')]]={'$like':'%'+_0x5c1fef[_0x086a('0x33')][_0x086a('0x40')]+'%'};return _0x5e3fbe;}})});}_0x1fe0bd=_[_0x086a('0x41')]({},_0x1fe0bd,_0x5c1fef['options']);var _0x29101e={'where':_0x1fe0bd[_0x086a('0x3e')]};return db[_0x086a('0x2c')][_0x086a('0x1e')](_0x29101e)[_0x086a('0x26')](function(_0x31642b){_0x5b1f04[_0x086a('0x1e')]=_0x31642b;if(_0x5c1fef['query']['includeAll']){_0x1fe0bd[_0x086a('0x42')]=[{'all':!![]}];}return db[_0x086a('0x2c')][_0x086a('0x43')](_0x1fe0bd);})[_0x086a('0x26')](function(_0x55d617){_0x5b1f04['rows']=_0x55d617;return _0x5b1f04;})[_0x086a('0x26')](respondWithFilteredResult(_0x406aee,_0x1fe0bd))['catch'](handleError(_0x406aee,null));};exports[_0x086a('0x44')]=function(_0x2ff8d6,_0x5b6d25){var _0x13aade={'raw':![],'where':{'id':_0x2ff8d6[_0x086a('0x45')]['id']}},_0x51095b={};_0x51095b['model']=_[_0x086a('0x34')](db['ServicenowAccount']['rawAttributes']);_0x51095b[_0x086a('0x33')]=_[_0x086a('0x34')](_0x2ff8d6[_0x086a('0x33')]);_0x51095b[_0x086a('0x35')]=_[_0x086a('0x36')](_0x51095b[_0x086a('0x31')],_0x51095b[_0x086a('0x33')]);_0x13aade['attributes']=_[_0x086a('0x36')](_0x51095b[_0x086a('0x31')],qs['fields'](_0x2ff8d6[_0x086a('0x33')][_0x086a('0x37')]));_0x13aade[_0x086a('0x38')]=_0x13aade[_0x086a('0x38')][_0x086a('0x39')]?_0x13aade[_0x086a('0x38')]:_0x51095b[_0x086a('0x31')];if(_0x2ff8d6[_0x086a('0x33')]['includeAll']){_0x13aade[_0x086a('0x42')]=[{'all':!![]}];}_0x13aade=_[_0x086a('0x41')]({},_0x13aade,_0x2ff8d6[_0x086a('0x46')]);return db['ServicenowAccount'][_0x086a('0x47')](_0x13aade)[_0x086a('0x26')](handleEntityNotFound(_0x5b6d25,null))['then'](respondWithResult(_0x5b6d25,null))['catch'](handleError(_0x5b6d25,null));};exports[_0x086a('0x48')]=function(_0x5d394d,_0x451188){return db[_0x086a('0x2c')]['create'](_0x5d394d[_0x086a('0x49')],{})[_0x086a('0x26')](respondWithResult(_0x451188,0xc9))[_0x086a('0x4a')](handleError(_0x451188,null));};exports['update']=function(_0x51bf9a,_0x488992){if(_0x51bf9a[_0x086a('0x49')]['id']){delete _0x51bf9a['body']['id'];}return db[_0x086a('0x2c')][_0x086a('0x47')]({'where':{'id':_0x51bf9a['params']['id']}})[_0x086a('0x26')](handleEntityNotFound(_0x488992,null))['then'](saveUpdates(_0x51bf9a[_0x086a('0x49')],null))[_0x086a('0x26')](respondWithResult(_0x488992,null))[_0x086a('0x4a')](handleError(_0x488992,null));};exports['destroy']=function(_0x437429,_0x111887){return db[_0x086a('0x2c')]['find']({'where':{'id':_0x437429[_0x086a('0x45')]['id']}})[_0x086a('0x26')](handleEntityNotFound(_0x111887,null))[_0x086a('0x26')](removeEntity(_0x111887,null))['catch'](handleError(_0x111887,null));};exports[_0x086a('0x4b')]=function(_0xc09db2,_0x52a2a1,_0x5e4940){var _0x127c8c={};var _0x21e238={};var _0x5e1dc3;var _0x227f60;return db[_0x086a('0x2c')]['findOne']({'where':{'id':_0xc09db2[_0x086a('0x45')]['id']}})[_0x086a('0x26')](handleEntityNotFound(_0x52a2a1,null))['then'](function(_0x2d951d){if(_0x2d951d){_0x5e1dc3=_0x2d951d;_0x21e238[_0x086a('0x31')]=_[_0x086a('0x34')](db[_0x086a('0x4c')][_0x086a('0x2d')]);_0x21e238[_0x086a('0x33')]=_[_0x086a('0x34')](_0xc09db2[_0x086a('0x33')]);_0x21e238['filters']=_['intersection'](_0x21e238[_0x086a('0x31')],_0x21e238[_0x086a('0x33')]);_0x127c8c[_0x086a('0x38')]=_[_0x086a('0x36')](_0x21e238['model'],qs[_0x086a('0x37')](_0xc09db2[_0x086a('0x33')][_0x086a('0x37')]));_0x127c8c[_0x086a('0x38')]=_0x127c8c['attributes'][_0x086a('0x39')]?_0x127c8c[_0x086a('0x38')]:_0x21e238['model'];_0x127c8c[_0x086a('0x3c')]=qs['sort'](_0xc09db2[_0x086a('0x33')][_0x086a('0x3d')]);_0x127c8c[_0x086a('0x3e')]=qs[_0x086a('0x35')](_['pick'](_0xc09db2['query'],_0x21e238[_0x086a('0x35')]));if(_0xc09db2['query']['filter']){_0x127c8c[_0x086a('0x3e')]=_['merge'](_0x127c8c[_0x086a('0x3e')],{'$or':_[_0x086a('0x32')](_0x127c8c[_0x086a('0x38')],function(_0x188756){var _0x45121c={};_0x45121c[_0x188756]={'$like':'%'+_0xc09db2[_0x086a('0x33')][_0x086a('0x40')]+'%'};return _0x45121c;})});}_0x127c8c=_[_0x086a('0x41')]({},_0x127c8c,_0xc09db2['options']);return _0x5e1dc3[_0x086a('0x4b')](_0x127c8c);}})[_0x086a('0x26')](function(_0x1d0964){if(_0x1d0964){_0x227f60=_0x1d0964['length'];if(!_0xc09db2['query'][_0x086a('0x3a')]('nolimit')){_0x127c8c[_0x086a('0x1c')]=qs[_0x086a('0x1c')](_0xc09db2['query'][_0x086a('0x1c')]);_0x127c8c[_0x086a('0x1f')]=qs[_0x086a('0x1f')](_0xc09db2['query'][_0x086a('0x1f')]);}return _0x5e1dc3[_0x086a('0x4b')](_0x127c8c);}})['then'](function(_0x140af9){if(_0x140af9){return _0x140af9?{'count':_0x227f60,'rows':_0x140af9}:null;}})[_0x086a('0x26')](respondWithResult(_0x52a2a1,null))[_0x086a('0x4a')](handleError(_0x52a2a1,null));};exports['addConfiguration']=function(_0x2b13c0,_0x157158,_0x175bc8){if(_0x2b13c0['body']['id']){delete _0x2b13c0[_0x086a('0x49')]['id'];}return db[_0x086a('0x2c')][_0x086a('0x4d')]({'where':{'id':_0x2b13c0[_0x086a('0x45')]['id']}})[_0x086a('0x26')](handleEntityNotFound(_0x157158,null))[_0x086a('0x26')](function(_0x82203f){if(_0x82203f){_0x2b13c0[_0x086a('0x49')]['AccountId']=_0x82203f['id'];_0x2b13c0[_0x086a('0x49')][_0x086a('0x4e')]=integrations[_0x086a('0x4f')](_0x2b13c0[_0x086a('0x49')][_0x086a('0x50')],_0x2b13c0['body'][_0x086a('0x2f')]);_0x2b13c0[_0x086a('0x49')][_0x086a('0x51')]=integrations['getDescriptions'](_0x2b13c0[_0x086a('0x49')][_0x086a('0x50')],_0x2b13c0['body']['type']);return db[_0x086a('0x4c')][_0x086a('0x48')](_0x2b13c0[_0x086a('0x49')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x086a('0x52')],'as':_0x086a('0x51')}]});}return null;})[_0x086a('0x26')](respondWithResult(_0x157158,null))[_0x086a('0x4a')](handleError(_0x157158,null));};exports['getFields']=function(_0x7dda1c,_0x1425fc,_0x32b415){var _0x8a7697=[_0x086a('0x53'),_0x086a('0x54'),_0x086a('0x55'),_0x086a('0x56'),'close_code',_0x086a('0x57'),_0x086a('0x58'),'severity','category'];var _0x4b74df=[_0x086a('0x59'),_0x086a('0x53'),_0x086a('0x5a'),_0x086a('0x5b'),_0x086a('0x5c'),_0x086a('0x5d'),_0x086a('0x5e'),'hold_reason',_0x086a('0x5f'),'number',_0x086a('0x60'),_0x086a('0x61'),_0x086a('0x62'),_0x086a('0x63'),_0x086a('0x64'),_0x086a('0x65'),'state',_0x086a('0x66'),_0x086a('0x55'),'order',_0x086a('0x67'),_0x086a('0x68'),'cmdb_ci','delivery_plan',_0x086a('0x69'),'active',_0x086a('0x6a'),_0x086a('0x6b'),_0x086a('0x6c'),'sys_domain_path',_0x086a('0x6d'),'time_worked',_0x086a('0x6e'),_0x086a('0x6f'),'business_duration','group_list',_0x086a('0x70'),'reopened_time',_0x086a('0x71'),_0x086a('0x72'),_0x086a('0x73'),'subcategory','work_notes',_0x086a('0x74'),_0x086a('0x75'),_0x086a('0x76'),'delivery_task','work_start','assignment_group',_0x086a('0x77'),_0x086a('0x78'),_0x086a('0x79'),_0x086a('0x7a'),'notify','sys_class_name',_0x086a('0x7b'),_0x086a('0x7c'),_0x086a('0x7d'),_0x086a('0x7e'),_0x086a('0x7f'),'contact_type',_0x086a('0x80'),'incident_state',_0x086a('0x81'),_0x086a('0x82'),_0x086a('0x83'),_0x086a('0x84'),_0x086a('0x85'),'assigned_to',_0x086a('0x86'),_0x086a('0x87'),_0x086a('0x88'),_0x086a('0x89'),_0x086a('0x8a'),_0x086a('0x8b'),_0x086a('0x8c'),_0x086a('0x8d'),_0x086a('0x8e'),_0x086a('0x8f'),_0x086a('0x90'),'correlation_id','location','category'];var _0x1fc9d5='';var _0x30d3d5='';var _0x343ec2=[];var _0x47d6bb='';var _0x38511e='';var _0x313c7b=[];var _0x5f614e='';var _0x2933ef='';var _0x2742d9={};var _0x41d6b7='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x7dda1c['params']['id']},'attributes':['id','username','password','email','remoteUri',_0x086a('0x91')]})['then'](handleEntityNotFound(_0x1425fc,null))[_0x086a('0x26')](function(_0xa542ef){if(_0xa542ef){_0x41d6b7=_0xa542ef['remoteUri'];var _0x785002=_0x41d6b7[_0x086a('0x92')](-0x1);if(_0x785002==='/'){_0x41d6b7=_0x41d6b7[_0x086a('0x93')](0x0,_0x41d6b7['lastIndexOf'](_0x785002));}_0x2933ef=util[_0x086a('0x94')]('%s/api/now/doc/table/schema/',_0x41d6b7);_0x5f614e=util[_0x086a('0x94')]('%s/api/now/table/',_0x41d6b7);_0x2742d9={'user':_0xa542ef['username'],'pass':_0xa542ef['password']};var _0x5b0048={'method':_0x086a('0x95'),'uri':_0x2933ef+'incident?sysparm_display_value=all','auth':_0x2742d9,'json':!![]};return rp(_0x5b0048);}})[_0x086a('0x26')](function(_0x17306d){if(_0x17306d[_0x086a('0x96')]['length']>0x0){_0x1fc9d5=_0x17306d[_0x086a('0x96')];}console[_0x086a('0x97')](_0x086a('0x98'),_0x1fc9d5);_0x313c7b=[];_0x30d3d5=Object[_0x086a('0x99')]([],_0x1fc9d5);_[_0x086a('0x9a')](_0x30d3d5,function(_0x31136c){return!_0x8a7697[_0x086a('0x9b')](_0x31136c[_0x086a('0x2a')]);});_0x30d3d5[_0x086a('0x9c')](function(_0x31d76f){var _0x50d233=createFieldObject(_0x5f614e,_0x2742d9,_0x31d76f['internalType'],_0x31d76f[_0x086a('0x2a')],_0x31d76f[_0x086a('0x9d')],![]);_0x313c7b[_0x086a('0x9e')](_0x50d233);});return Promise[_0x086a('0x9f')](_0x313c7b);})['then'](function(_0x34b012){_0x343ec2=_0x34b012;_0x47d6bb=Object[_0x086a('0x99')]([],_0x1fc9d5);console['log']('TCL:\x20_object',_0x1fc9d5);_[_0x086a('0x9a')](_0x47d6bb,function(_0x17a6dd){return _0x4b74df[_0x086a('0x9b')](_0x17a6dd[_0x086a('0x2a')]);});console[_0x086a('0x97')](_0x086a('0xa0'),_0x47d6bb);_0x313c7b=[];_0x47d6bb['forEach'](function(_0x1bc5c0){var _0x47404d=createFieldObject(_0x5f614e,_0x2742d9,_0x1bc5c0[_0x086a('0xa1')],_0x1bc5c0['name'],_0x1bc5c0[_0x086a('0x9d')],!![]);_0x313c7b[_0x086a('0x9e')](_0x47404d);});return Promise[_0x086a('0x9f')](_0x313c7b);})[_0x086a('0x26')](function(_0x2a2bd0){_0x38511e=_0x2a2bd0;var _0x3f25ee=_0x343ec2['concat'](_0x38511e);return{'count':_0x3f25ee['length'],'rows':_0x3f25ee};})[_0x086a('0x26')](respondWithResult(_0x1425fc,null))[_0x086a('0x4a')](function(_0x3e9283){console['log'](_0x086a('0xa2')+_0x3e9283);var _0x4d5a9f=_0x7dda1c[_0x086a('0x33')]['test']?0x1f4:_0x3e9283[_0x086a('0xa3')]||0x1f4;logger['error'](_0x3e9283[_0x086a('0x29')]);delete _0x3e9283[_0x086a('0x2a')];if(_0x4d5a9f===0x191){_0x4d5a9f=0x190;}_0x1425fc[_0x086a('0x20')](_0x4d5a9f)[_0x086a('0xa4')](_0x7dda1c[_0x086a('0x33')][_0x086a('0xa5')]?{'message':_0x086a('0xa6'),'statusCode':_0x3e9283[_0x086a('0xa3')]}:_0x3e9283);});};function createFieldObject(_0x2af535,_0x13115d,_0x2483c8,_0x124c1d,_0x5cb822,_0x2e997e){return new Promise(function(_0xd88b05,_0x10e4ac){var _0x442644={'id':_0x124c1d,'name':_0x5cb822,'custom':_0x2e997e};if(_0x2483c8===_0x086a('0xa7')){_0x442644['options']=[{'name':'True','value':_0x086a('0xa8')},{'name':_0x086a('0xa9'),'value':_0x086a('0xaa')}];_0xd88b05(_0x442644);}else{var _0x201606={'method':_0x086a('0x95'),'uri':_0x2af535+_0x086a('0xab')+_0x124c1d,'auth':_0x13115d,'json':!![]};return rp(_0x201606)['then'](function(_0x4926d7){var _0x16a486=[];if(_0x4926d7['result'][_0x086a('0x39')]>0x0){_0x4926d7['result'][_0x086a('0x9c')](function(_0x11aa60){if(_0x11aa60[_0x086a('0xac')]===_0x086a('0xaa')){var _0xf7cfa2={'name':_0x11aa60[_0x086a('0x9d')],'value':_0x11aa60[_0x086a('0xad')]};_0x16a486[_0x086a('0x9e')](_0xf7cfa2);}});}_0x442644[_0x086a('0x46')]=_0x16a486;if(_0x442644[_0x086a('0x46')][_0x086a('0x39')]>0x0){_0xd88b05(_0x442644);}else{if(_0x2e997e==![]){_0xd88b05();}else{_0xd88b05(_0x442644);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index a2f2611..5404d3d 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 _0xeda8=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x200696,_0x29fbff){var _0x974349=function(_0x2a2a83){while(--_0x2a2a83){_0x200696['push'](_0x200696['shift']());}};_0x974349(++_0x29fbff);}(_0xeda8,0x104));var _0x8eda=function(_0x4d75f0,_0x5afe95){_0x4d75f0=_0x4d75f0-0x0;var _0x2e5757=_0xeda8[_0x4d75f0];return _0x2e5757;};'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 +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x4be792,_0x5ae43f){var _0x2f00a5=function(_0x27f890){while(--_0x27f890){_0x4be792['push'](_0x4be792['shift']());}};_0x2f00a5(++_0x5ae43f);}(_0x687b,0x14a));var _0xb687=function(_0x95ad05,_0x3cadb6){_0x95ad05=_0x95ad05-0x0;var _0x2d79f4=_0x687b[_0x95ad05];return _0x2d79f4;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'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 c42172b..834d3cc 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 _0x077d=['../../config/environment','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','then','stringify','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x23a233,_0x22ed7b){var _0x13f7e7=function(_0x29104c){while(--_0x29104c){_0x23a233['push'](_0x23a233['shift']());}};_0x13f7e7(++_0x22ed7b);}(_0x077d,0x133));var _0xd077=function(_0xc5704,_0x2be3c9){_0xc5704=_0xc5704-0x0;var _0x14292f=_0x077d[_0xc5704];return _0x14292f;};'use strict';var _=require(_0xd077('0x0'));var util=require(_0xd077('0x1'));var moment=require(_0xd077('0x2'));var BPromise=require(_0xd077('0x3'));var rs=require(_0xd077('0x4'));var fs=require('fs');var Redis=require(_0xd077('0x5'));var db=require(_0xd077('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd077('0x7'))('rpc');var config=require(_0xd077('0x8'));var jayson=require(_0xd077('0x9'));var client=jayson[_0xd077('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52011a,_0x8dadcc,_0x40c8ff){return new BPromise(function(_0x2f7cf7,_0x55b19f){return client[_0xd077('0xb')](_0x52011a,_0x40c8ff)['then'](function(_0x49cfbf){logger[_0xd077('0xc')](_0xd077('0xd'),_0x8dadcc,_0xd077('0xe'));logger[_0xd077('0xf')](_0xd077('0x10'),_0x8dadcc,_0xd077('0xe'),JSON['stringify'](_0x49cfbf));if(_0x49cfbf['error']){if(_0x49cfbf[_0xd077('0x11')]['code']===0x1f4){logger[_0xd077('0x11')](_0xd077('0xd'),_0x8dadcc,_0x49cfbf[_0xd077('0x11')][_0xd077('0x12')]);return _0x55b19f(_0x49cfbf[_0xd077('0x11')][_0xd077('0x12')]);}logger[_0xd077('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x8dadcc,_0x49cfbf[_0xd077('0x11')][_0xd077('0x12')]);return _0x2f7cf7(_0x49cfbf[_0xd077('0x11')][_0xd077('0x12')]);}else{logger[_0xd077('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x8dadcc,_0xd077('0xe'));_0x2f7cf7(_0x49cfbf[_0xd077('0x13')][_0xd077('0x12')]);}})[_0xd077('0x14')](function(_0x426047){logger[_0xd077('0x11')](_0xd077('0xd'),_0x8dadcc,_0x426047);_0x55b19f(_0x426047);});});}exports[_0xd077('0x15')]=function(_0xef684f){var _0x344c48=this;return new Promise(function(_0x44f13e,_0x461fa6){return db[_0xd077('0x16')]['findAll']({'raw':_0xef684f[_0xd077('0x17')]?_0xef684f['options'][_0xd077('0x18')]===undefined?!![]:![]:!![],'where':_0xef684f['options']?_0xef684f[_0xd077('0x17')][_0xd077('0x19')]||null:null,'attributes':_0xef684f[_0xd077('0x17')]?_0xef684f[_0xd077('0x17')][_0xd077('0x1a')]||null:null,'limit':_0xef684f['options']?_0xef684f[_0xd077('0x17')][_0xd077('0x1b')]||null:null,'include':_0xef684f[_0xd077('0x17')]?_0xef684f[_0xd077('0x17')][_0xd077('0x1c')]?_[_0xd077('0x1d')](_0xef684f[_0xd077('0x17')][_0xd077('0x1c')],function(_0x37b6de){return{'model':db[_0x37b6de[_0xd077('0x1e')]],'as':_0x37b6de['as'],'attributes':_0x37b6de[_0xd077('0x1a')],'include':_0x37b6de[_0xd077('0x1c')]?_[_0xd077('0x1d')](_0x37b6de[_0xd077('0x1c')],function(_0x4c973b){return{'model':db[_0x4c973b['model']],'as':_0x4c973b['as'],'attributes':_0x4c973b['attributes'],'include':_0x4c973b[_0xd077('0x1c')]?_['map'](_0x4c973b[_0xd077('0x1c')],function(_0x2c0f91){return{'model':db[_0x2c0f91[_0xd077('0x1e')]],'as':_0x2c0f91['as'],'attributes':_0x2c0f91[_0xd077('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd077('0x1f')](function(_0x465af9){logger[_0xd077('0xc')](_0xd077('0x15'),_0xef684f);logger[_0xd077('0xf')](_0xd077('0x15'),_0xef684f,JSON[_0xd077('0x20')](_0x465af9));_0x44f13e(_0x465af9);})[_0xd077('0x14')](function(_0xed1377){logger[_0xd077('0x11')](_0xd077('0x15'),_0xed1377[_0xd077('0x12')],_0xef684f);_0x461fa6(_0x344c48[_0xd077('0x11')](0x1f4,_0xed1377[_0xd077('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x158986){var _0x4a9e00=this;return new Promise(function(_0x5a4ffc,_0x2d79fc){return db[_0xd077('0x16')][_0xd077('0x21')]({'raw':_0x158986[_0xd077('0x17')]?_0x158986[_0xd077('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x158986[_0xd077('0x17')]?_0x158986[_0xd077('0x17')][_0xd077('0x19')]||null:null,'attributes':_0x158986[_0xd077('0x17')]?_0x158986['options']['attributes']||null:null,'include':_0x158986[_0xd077('0x17')]?_0x158986['options'][_0xd077('0x1c')]?_[_0xd077('0x1d')](_0x158986['options'][_0xd077('0x1c')],function(_0x993087){return{'model':db[_0x993087['model']],'as':_0x993087['as'],'attributes':_0x993087['attributes'],'include':_0x993087[_0xd077('0x1c')]?_[_0xd077('0x1d')](_0x993087[_0xd077('0x1c')],function(_0x390ecf){return{'model':db[_0x390ecf[_0xd077('0x1e')]],'as':_0x390ecf['as'],'attributes':_0x390ecf['attributes'],'include':_0x390ecf['include']?_[_0xd077('0x1d')](_0x390ecf[_0xd077('0x1c')],function(_0x17179c){return{'model':db[_0x17179c[_0xd077('0x1e')]],'as':_0x17179c['as'],'attributes':_0x17179c[_0xd077('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd077('0x1f')](function(_0x463fad){logger[_0xd077('0xc')](_0xd077('0x22'),_0x158986);logger[_0xd077('0xf')](_0xd077('0x22'),_0x158986,JSON[_0xd077('0x20')](_0x463fad));_0x5a4ffc(_0x463fad);})[_0xd077('0x14')](function(_0x37818d){logger['error']('ShowServicenowAccount',_0x37818d[_0xd077('0x12')],_0x158986);_0x2d79fc(_0x4a9e00['error'](0x1f4,_0x37818d[_0xd077('0x12')]));});});}; \ No newline at end of file +var _0x21af=['ShowServicenowAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ServicenowAccount','findAll','raw','options','attributes','limit','include','map','model','GetServicenowAccount'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x21af,0xbc));var _0xf21a=function(_0x51a8e0,_0x3747f9){_0x51a8e0=_0x51a8e0-0x0;var _0x1cdc95=_0x21af[_0x51a8e0];return _0x1cdc95;};'use strict';var _=require(_0xf21a('0x0'));var util=require(_0xf21a('0x1'));var moment=require(_0xf21a('0x2'));var BPromise=require(_0xf21a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf21a('0x4'));var db=require(_0xf21a('0x5'))['db'];var utils=require(_0xf21a('0x6'));var logger=require('../../config/logger')(_0xf21a('0x7'));var config=require(_0xf21a('0x8'));var jayson=require(_0xf21a('0x9'));var client=jayson['client'][_0xf21a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b88fe,_0x17d347,_0x351c88){return new BPromise(function(_0x49ab11,_0x1bafc9){return client[_0xf21a('0xb')](_0x3b88fe,_0x351c88)[_0xf21a('0xc')](function(_0x2d2cbf){logger[_0xf21a('0xd')](_0xf21a('0xe'),_0x17d347,'request\x20sent');logger[_0xf21a('0xf')](_0xf21a('0x10'),_0x17d347,_0xf21a('0x11'),JSON[_0xf21a('0x12')](_0x2d2cbf));if(_0x2d2cbf[_0xf21a('0x13')]){if(_0x2d2cbf[_0xf21a('0x13')][_0xf21a('0x14')]===0x1f4){logger[_0xf21a('0x13')](_0xf21a('0xe'),_0x17d347,_0x2d2cbf[_0xf21a('0x13')]['message']);return _0x1bafc9(_0x2d2cbf['error']['message']);}logger[_0xf21a('0x13')](_0xf21a('0xe'),_0x17d347,_0x2d2cbf[_0xf21a('0x13')]['message']);return _0x49ab11(_0x2d2cbf['error'][_0xf21a('0x15')]);}else{logger['info'](_0xf21a('0xe'),_0x17d347,_0xf21a('0x11'));_0x49ab11(_0x2d2cbf[_0xf21a('0x16')][_0xf21a('0x15')]);}})[_0xf21a('0x17')](function(_0x2157f2){logger[_0xf21a('0x13')](_0xf21a('0xe'),_0x17d347,_0x2157f2);_0x1bafc9(_0x2157f2);});});}exports['GetServicenowAccount']=function(_0x5646de){var _0x17b71d=this;return new Promise(function(_0x54735b,_0x3bcccb){return db[_0xf21a('0x18')][_0xf21a('0x19')]({'raw':_0x5646de['options']?_0x5646de['options'][_0xf21a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5646de[_0xf21a('0x1b')]?_0x5646de['options']['where']||null:null,'attributes':_0x5646de[_0xf21a('0x1b')]?_0x5646de[_0xf21a('0x1b')][_0xf21a('0x1c')]||null:null,'limit':_0x5646de[_0xf21a('0x1b')]?_0x5646de[_0xf21a('0x1b')][_0xf21a('0x1d')]||null:null,'include':_0x5646de[_0xf21a('0x1b')]?_0x5646de[_0xf21a('0x1b')][_0xf21a('0x1e')]?_[_0xf21a('0x1f')](_0x5646de[_0xf21a('0x1b')][_0xf21a('0x1e')],function(_0x551b95){return{'model':db[_0x551b95['model']],'as':_0x551b95['as'],'attributes':_0x551b95['attributes'],'include':_0x551b95['include']?_[_0xf21a('0x1f')](_0x551b95['include'],function(_0x46e25f){return{'model':db[_0x46e25f[_0xf21a('0x20')]],'as':_0x46e25f['as'],'attributes':_0x46e25f['attributes'],'include':_0x46e25f[_0xf21a('0x1e')]?_['map'](_0x46e25f[_0xf21a('0x1e')],function(_0x238953){return{'model':db[_0x238953[_0xf21a('0x20')]],'as':_0x238953['as'],'attributes':_0x238953[_0xf21a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf21a('0xc')](function(_0x403b0b){logger[_0xf21a('0xd')](_0xf21a('0x21'),_0x5646de);logger['debug'](_0xf21a('0x21'),_0x5646de,JSON[_0xf21a('0x12')](_0x403b0b));_0x54735b(_0x403b0b);})[_0xf21a('0x17')](function(_0x4904f3){logger[_0xf21a('0x13')](_0xf21a('0x21'),_0x4904f3[_0xf21a('0x15')],_0x5646de);_0x3bcccb(_0x17b71d[_0xf21a('0x13')](0x1f4,_0x4904f3['message']));});});};exports[_0xf21a('0x22')]=function(_0x248c0){var _0x5ebda4=this;return new Promise(function(_0xca894e,_0x2766d0){return db['ServicenowAccount'][_0xf21a('0x23')]({'raw':_0x248c0[_0xf21a('0x1b')]?_0x248c0[_0xf21a('0x1b')][_0xf21a('0x1a')]===undefined?!![]:![]:!![],'where':_0x248c0[_0xf21a('0x1b')]?_0x248c0['options'][_0xf21a('0x24')]||null:null,'attributes':_0x248c0['options']?_0x248c0[_0xf21a('0x1b')]['attributes']||null:null,'include':_0x248c0[_0xf21a('0x1b')]?_0x248c0[_0xf21a('0x1b')][_0xf21a('0x1e')]?_['map'](_0x248c0[_0xf21a('0x1b')]['include'],function(_0x2ba0ee){return{'model':db[_0x2ba0ee[_0xf21a('0x20')]],'as':_0x2ba0ee['as'],'attributes':_0x2ba0ee[_0xf21a('0x1c')],'include':_0x2ba0ee[_0xf21a('0x1e')]?_[_0xf21a('0x1f')](_0x2ba0ee[_0xf21a('0x1e')],function(_0x56aec5){return{'model':db[_0x56aec5[_0xf21a('0x20')]],'as':_0x56aec5['as'],'attributes':_0x56aec5[_0xf21a('0x1c')],'include':_0x56aec5['include']?_[_0xf21a('0x1f')](_0x56aec5[_0xf21a('0x1e')],function(_0x536699){return{'model':db[_0x536699[_0xf21a('0x20')]],'as':_0x536699['as'],'attributes':_0x536699['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c9765){logger[_0xf21a('0xd')](_0xf21a('0x22'),_0x248c0);logger[_0xf21a('0xf')]('ShowServicenowAccount',_0x248c0,JSON[_0xf21a('0x12')](_0x1c9765));_0xca894e(_0x1c9765);})[_0xf21a('0x17')](function(_0xf3af49){logger[_0xf21a('0x13')](_0xf21a('0x22'),_0xf3af49[_0xf21a('0x15')],_0x248c0);_0x2766d0(_0x5ebda4['error'](0x1f4,_0xf3af49['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 8e54f2f..5fb7be1 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 _0x2694=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','multer','util'];(function(_0x4a325a,_0x2c154c){var _0x2597a1=function(_0x437af3){while(--_0x437af3){_0x4a325a['push'](_0x4a325a['shift']());}};_0x2597a1(++_0x2c154c);}(_0x2694,0x11c));var _0x4269=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2694[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x4269('0x0'));var util=require(_0x4269('0x1'));var path=require('path');var timeout=require(_0x4269('0x2'));var express=require(_0x4269('0x3'));var router=express[_0x4269('0x4')]();var fs_extra=require(_0x4269('0x5'));var auth=require(_0x4269('0x6'));var interaction=require(_0x4269('0x7'));var config=require(_0x4269('0x8'));var controller=require(_0x4269('0x9'));router[_0x4269('0xa')]('/',auth[_0x4269('0xb')](),controller[_0x4269('0xc')]);router[_0x4269('0xa')]('/:id',auth[_0x4269('0xb')](),controller['show']);router[_0x4269('0xa')](_0x4269('0xd'),auth['isAuthenticated'](),controller[_0x4269('0xe')]);router[_0x4269('0xa')](_0x4269('0xf'),auth[_0x4269('0xb')](),controller[_0x4269('0x10')]);router[_0x4269('0xa')](_0x4269('0x11'),auth['isAuthenticated'](),controller[_0x4269('0x12')]);router[_0x4269('0x13')]('/',auth[_0x4269('0xb')](),controller[_0x4269('0x14')]);router[_0x4269('0x15')]('/:id',auth[_0x4269('0xb')](),controller[_0x4269('0x16')]);router[_0x4269('0x17')](_0x4269('0x18'),auth[_0x4269('0xb')](),controller[_0x4269('0x19')]);module['exports']=router; \ No newline at end of file +var _0x4ea4=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer'];(function(_0x18f25e,_0x33a0fa){var _0x1868bf=function(_0x30a1a5){while(--_0x30a1a5){_0x18f25e['push'](_0x18f25e['shift']());}};_0x1868bf(++_0x33a0fa);}(_0x4ea4,0xe0));var _0x44ea=function(_0x357633,_0x254610){_0x357633=_0x357633-0x0;var _0x261faf=_0x4ea4[_0x357633];return _0x261faf;};'use strict';var multer=require(_0x44ea('0x0'));var util=require('util');var path=require(_0x44ea('0x1'));var timeout=require(_0x44ea('0x2'));var express=require(_0x44ea('0x3'));var router=express[_0x44ea('0x4')]();var fs_extra=require(_0x44ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44ea('0x6'));var config=require(_0x44ea('0x7'));var controller=require(_0x44ea('0x8'));router[_0x44ea('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x44ea('0xa'),auth[_0x44ea('0xb')](),controller[_0x44ea('0xc')]);router[_0x44ea('0x9')]('/:id/fields',auth[_0x44ea('0xb')](),controller[_0x44ea('0xd')]);router[_0x44ea('0x9')](_0x44ea('0xe'),auth[_0x44ea('0xb')](),controller[_0x44ea('0xf')]);router[_0x44ea('0x9')](_0x44ea('0x10'),auth[_0x44ea('0xb')](),controller[_0x44ea('0x11')]);router[_0x44ea('0x12')]('/',auth[_0x44ea('0xb')](),controller[_0x44ea('0x13')]);router[_0x44ea('0x14')](_0x44ea('0xa'),auth[_0x44ea('0xb')](),controller[_0x44ea('0x15')]);router[_0x44ea('0x16')]('/:id',auth[_0x44ea('0xb')](),controller[_0x44ea('0x17')]);module[_0x44ea('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 389f7e9..3e77537 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 _0x26a5=['sequelize','exports'];(function(_0x38661e,_0x3b8e03){var _0x446ac0=function(_0x2d2ba9){while(--_0x2d2ba9){_0x38661e['push'](_0x38661e['shift']());}};_0x446ac0(++_0x3b8e03);}(_0x26a5,0x1da));var _0x526a=function(_0x8957d,_0x1a2301){_0x8957d=_0x8957d-0x0;var _0x33f12f=_0x26a5[_0x8957d];return _0x33f12f;};'use strict';var Sequelize=require(_0x526a('0x0'));module[_0x526a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x990e=['STRING','sequelize'];(function(_0x217d50,_0x332ea4){var _0x38690d=function(_0x55ce52){while(--_0x55ce52){_0x217d50['push'](_0x217d50['shift']());}};_0x38690d(++_0x332ea4);}(_0x990e,0x14b));var _0xe990=function(_0x41f519,_0x7f47d7){_0x41f519=_0x41f519-0x0;var _0xf5fcff=_0x990e[_0x41f519];return _0xf5fcff;};'use strict';var Sequelize=require(_0xe990('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe990('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1827975..a7680ed 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 _0xfdd8=['squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','include','ServicenowConfiguration','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','eml-format','request-promise','moment','bluebird','util','to-csv','ejs','lodash'];(function(_0x51f0dd,_0x13e184){var _0x43df8c=function(_0x1299ac){while(--_0x1299ac){_0x51f0dd['push'](_0x51f0dd['shift']());}};_0x43df8c(++_0x13e184);}(_0xfdd8,0xd0));var _0x8fdd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfdd8[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x8fdd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8fdd('0x1'));var moment=require(_0x8fdd('0x2'));var BPromise=require(_0x8fdd('0x3'));var Mustache=require('mustache');var util=require(_0x8fdd('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8fdd('0x5'));var ejs=require(_0x8fdd('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fdd('0x7'));var squel=require(_0x8fdd('0x8'));var crypto=require(_0x8fdd('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8fdd('0xa'));var toCsv=require(_0x8fdd('0x5'));var querystring=require('querystring');var Papa=require(_0x8fdd('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8fdd('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fdd('0xd'))('api');var utils=require(_0x8fdd('0xe'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8fdd('0xf'))['db'];function respondWithStatusCode(_0x12f20d,_0x10d89b){_0x10d89b=_0x10d89b||0xcc;return function(_0x2400fb){if(_0x2400fb){return _0x12f20d['sendStatus'](_0x10d89b);}return _0x12f20d[_0x8fdd('0x10')](_0x10d89b)[_0x8fdd('0x11')]();};}function respondWithResult(_0x18157e,_0x1f3da3){_0x1f3da3=_0x1f3da3||0xc8;return function(_0x57b19d){if(_0x57b19d){return _0x18157e[_0x8fdd('0x10')](_0x1f3da3)[_0x8fdd('0x12')](_0x57b19d);}};}function respondWithFilteredResult(_0x24c7e1,_0x109dec){return function(_0x26d563){if(_0x26d563){var _0x556bc0=typeof _0x109dec[_0x8fdd('0x13')]===_0x8fdd('0x14')&&typeof _0x109dec[_0x8fdd('0x15')]===_0x8fdd('0x14');var _0x2b83ea=_0x26d563[_0x8fdd('0x16')];var _0x5bd576=_0x556bc0?0x0:_0x109dec[_0x8fdd('0x13')];var _0x11500f=_0x556bc0?_0x26d563['count']:_0x109dec[_0x8fdd('0x13')]+_0x109dec['limit'];var _0x52086f;if(_0x11500f>=_0x2b83ea){_0x11500f=_0x2b83ea;_0x52086f=0xc8;}else{_0x52086f=0xce;}_0x24c7e1['status'](_0x52086f);return _0x24c7e1[_0x8fdd('0x17')](_0x8fdd('0x18'),_0x5bd576+'-'+_0x11500f+'/'+_0x2b83ea)[_0x8fdd('0x12')](_0x26d563);}return null;};}function patchUpdates(_0x2619d3){return function(_0x1a0e70){try{jsonpatch[_0x8fdd('0x19')](_0x1a0e70,_0x2619d3,!![]);}catch(_0x374689){return BPromise[_0x8fdd('0x1a')](_0x374689);}return _0x1a0e70[_0x8fdd('0x1b')]();};}function saveUpdates(_0x544b88,_0x2b27fa){return function(_0x26fde6){if(_0x26fde6){return _0x26fde6[_0x8fdd('0x1c')](_0x544b88)[_0x8fdd('0x1d')](function(_0x41d36d){return _0x41d36d;});}return null;};}function removeEntity(_0x26f1db,_0x142e1f){return function(_0x25f078){if(_0x25f078){return _0x25f078['destroy']()[_0x8fdd('0x1d')](function(){_0x26f1db[_0x8fdd('0x10')](0xcc)[_0x8fdd('0x11')]();});}};}function handleEntityNotFound(_0xef9e6e,_0x3ceb99){return function(_0x9e5e58){if(!_0x9e5e58){_0xef9e6e[_0x8fdd('0x1e')](0x194);}return _0x9e5e58;};}function handleError(_0x3c49d0,_0x4d64f9){_0x4d64f9=_0x4d64f9||0x1f4;return function(_0x26888d){logger[_0x8fdd('0x1f')](_0x26888d['stack']);if(_0x26888d[_0x8fdd('0x20')]){delete _0x26888d[_0x8fdd('0x20')];}_0x3c49d0[_0x8fdd('0x10')](_0x4d64f9)[_0x8fdd('0x21')](_0x26888d);};}exports[_0x8fdd('0x22')]=function(_0x24a020,_0x39e12f){var _0x416d1f={},_0x7dd6fe={},_0x4ad434={'count':0x0,'rows':[]};var _0xf004f3=_[_0x8fdd('0x23')](db['ServicenowConfiguration']['rawAttributes'],function(_0x6cd2a8){return{'name':_0x6cd2a8[_0x8fdd('0x24')],'type':_0x6cd2a8[_0x8fdd('0x25')][_0x8fdd('0x26')]};});_0x7dd6fe[_0x8fdd('0x27')]=_[_0x8fdd('0x23')](_0xf004f3,_0x8fdd('0x20'));_0x7dd6fe['query']=_[_0x8fdd('0x28')](_0x24a020[_0x8fdd('0x29')]);_0x7dd6fe[_0x8fdd('0x2a')]=_[_0x8fdd('0x2b')](_0x7dd6fe['model'],_0x7dd6fe[_0x8fdd('0x29')]);_0x416d1f['attributes']=_[_0x8fdd('0x2b')](_0x7dd6fe[_0x8fdd('0x27')],qs['fields'](_0x24a020[_0x8fdd('0x29')]['fields']));_0x416d1f[_0x8fdd('0x2c')]=_0x416d1f[_0x8fdd('0x2c')][_0x8fdd('0x2d')]?_0x416d1f[_0x8fdd('0x2c')]:_0x7dd6fe[_0x8fdd('0x27')];if(!_0x24a020[_0x8fdd('0x29')]['hasOwnProperty'](_0x8fdd('0x2e'))){_0x416d1f[_0x8fdd('0x15')]=qs[_0x8fdd('0x15')](_0x24a020[_0x8fdd('0x29')]['limit']);_0x416d1f[_0x8fdd('0x13')]=qs[_0x8fdd('0x13')](_0x24a020[_0x8fdd('0x29')][_0x8fdd('0x13')]);}_0x416d1f[_0x8fdd('0x2f')]=qs['sort'](_0x24a020[_0x8fdd('0x29')][_0x8fdd('0x30')]);_0x416d1f[_0x8fdd('0x31')]=qs[_0x8fdd('0x2a')](_[_0x8fdd('0x32')](_0x24a020[_0x8fdd('0x29')],_0x7dd6fe[_0x8fdd('0x2a')]),_0xf004f3);if(_0x24a020[_0x8fdd('0x29')][_0x8fdd('0x33')]){_0x416d1f[_0x8fdd('0x31')]=_[_0x8fdd('0x34')](_0x416d1f[_0x8fdd('0x31')],{'$or':_[_0x8fdd('0x23')](_0xf004f3,function(_0xc62efe){if(_0xc62efe[_0x8fdd('0x25')]!=='VIRTUAL'){var _0x40320b={};_0x40320b[_0xc62efe[_0x8fdd('0x20')]]={'$like':'%'+_0x24a020[_0x8fdd('0x29')][_0x8fdd('0x33')]+'%'};return _0x40320b;}})});}_0x416d1f=_[_0x8fdd('0x34')]({},_0x416d1f,_0x24a020[_0x8fdd('0x35')]);var _0x5055ef={'where':_0x416d1f[_0x8fdd('0x31')]};return db['ServicenowConfiguration'][_0x8fdd('0x16')](_0x5055ef)[_0x8fdd('0x1d')](function(_0x5b620d){_0x4ad434[_0x8fdd('0x16')]=_0x5b620d;if(_0x24a020[_0x8fdd('0x29')]['includeAll']){_0x416d1f[_0x8fdd('0x36')]=[{'all':!![]}];}return db[_0x8fdd('0x37')]['findAll'](_0x416d1f);})[_0x8fdd('0x1d')](function(_0x3e80a6){_0x4ad434[_0x8fdd('0x38')]=_0x3e80a6;return _0x4ad434;})[_0x8fdd('0x1d')](respondWithFilteredResult(_0x39e12f,_0x416d1f))[_0x8fdd('0x39')](handleError(_0x39e12f,null));};exports[_0x8fdd('0x3a')]=function(_0x9eebfc,_0x41cb16){var _0x51edf4={'raw':![],'where':{'id':_0x9eebfc[_0x8fdd('0x3b')]['id']}},_0x1791f0={};_0x1791f0[_0x8fdd('0x27')]=_[_0x8fdd('0x28')](db[_0x8fdd('0x37')][_0x8fdd('0x3c')]);_0x1791f0[_0x8fdd('0x29')]=_[_0x8fdd('0x28')](_0x9eebfc[_0x8fdd('0x29')]);_0x1791f0[_0x8fdd('0x2a')]=_[_0x8fdd('0x2b')](_0x1791f0[_0x8fdd('0x27')],_0x1791f0[_0x8fdd('0x29')]);_0x51edf4[_0x8fdd('0x2c')]=_['intersection'](_0x1791f0[_0x8fdd('0x27')],qs[_0x8fdd('0x3d')](_0x9eebfc[_0x8fdd('0x29')][_0x8fdd('0x3d')]));_0x51edf4['attributes']=_0x51edf4[_0x8fdd('0x2c')][_0x8fdd('0x2d')]?_0x51edf4[_0x8fdd('0x2c')]:_0x1791f0[_0x8fdd('0x27')];if(_0x9eebfc[_0x8fdd('0x29')][_0x8fdd('0x3e')]){_0x51edf4[_0x8fdd('0x36')]=[{'all':!![]}];}_0x51edf4=_[_0x8fdd('0x34')]({},_0x51edf4,_0x9eebfc[_0x8fdd('0x35')]);return db['ServicenowConfiguration'][_0x8fdd('0x3f')](_0x51edf4)['then'](handleEntityNotFound(_0x41cb16,null))[_0x8fdd('0x1d')](respondWithResult(_0x41cb16,null))[_0x8fdd('0x39')](handleError(_0x41cb16,null));};exports[_0x8fdd('0x40')]=function(_0x33ed4a,_0x4f5c17){return db[_0x8fdd('0x37')][_0x8fdd('0x40')](_0x33ed4a[_0x8fdd('0x41')],{})[_0x8fdd('0x1d')](respondWithResult(_0x4f5c17,0xc9))['catch'](handleError(_0x4f5c17,null));};exports[_0x8fdd('0x1c')]=function(_0x40f1aa,_0x1af6b2){if(_0x40f1aa[_0x8fdd('0x41')]['id']){delete _0x40f1aa['body']['id'];}return db[_0x8fdd('0x37')][_0x8fdd('0x3f')]({'where':{'id':_0x40f1aa['params']['id']}})[_0x8fdd('0x1d')](handleEntityNotFound(_0x1af6b2,null))['then'](saveUpdates(_0x40f1aa['body'],null))['then'](respondWithResult(_0x1af6b2,null))['catch'](handleError(_0x1af6b2,null));};exports['destroy']=function(_0x2f2692,_0xacb135){return db[_0x8fdd('0x37')][_0x8fdd('0x3f')]({'where':{'id':_0x2f2692[_0x8fdd('0x3b')]['id']}})[_0x8fdd('0x1d')](handleEntityNotFound(_0xacb135,null))[_0x8fdd('0x1d')](removeEntity(_0xacb135,null))[_0x8fdd('0x39')](handleError(_0xacb135,null));};exports[_0x8fdd('0x42')]=function(_0x34ccd3,_0x54abc0,_0x493a9c){var _0x120193={};var _0x31d006={};var _0x2a1a1c;var _0x3e0da9;return db[_0x8fdd('0x37')][_0x8fdd('0x43')]({'where':{'id':_0x34ccd3[_0x8fdd('0x3b')]['id']}})['then'](handleEntityNotFound(_0x54abc0,null))[_0x8fdd('0x1d')](function(_0x5e50ee){if(_0x5e50ee){_0x2a1a1c=_0x5e50ee;_0x31d006[_0x8fdd('0x27')]=_[_0x8fdd('0x28')](db[_0x8fdd('0x44')][_0x8fdd('0x3c')]);_0x31d006[_0x8fdd('0x29')]=_[_0x8fdd('0x28')](_0x34ccd3[_0x8fdd('0x29')]);_0x31d006['filters']=_['intersection'](_0x31d006[_0x8fdd('0x27')],_0x31d006[_0x8fdd('0x29')]);_0x120193[_0x8fdd('0x2c')]=_[_0x8fdd('0x2b')](_0x31d006[_0x8fdd('0x27')],qs[_0x8fdd('0x3d')](_0x34ccd3['query'][_0x8fdd('0x3d')]));_0x120193[_0x8fdd('0x2c')]=_0x120193[_0x8fdd('0x2c')][_0x8fdd('0x2d')]?_0x120193[_0x8fdd('0x2c')]:_0x31d006[_0x8fdd('0x27')];_0x120193[_0x8fdd('0x2f')]=qs[_0x8fdd('0x30')](_0x34ccd3[_0x8fdd('0x29')]['sort']);_0x120193['where']=qs[_0x8fdd('0x2a')](_[_0x8fdd('0x32')](_0x34ccd3[_0x8fdd('0x29')],_0x31d006[_0x8fdd('0x2a')]));if(_0x34ccd3['query'][_0x8fdd('0x33')]){_0x120193[_0x8fdd('0x31')]=_[_0x8fdd('0x34')](_0x120193['where'],{'$or':_[_0x8fdd('0x23')](_0x120193[_0x8fdd('0x2c')],function(_0x23fce5){var _0x5a7b3d={};_0x5a7b3d[_0x23fce5]={'$like':'%'+_0x34ccd3[_0x8fdd('0x29')][_0x8fdd('0x33')]+'%'};return _0x5a7b3d;})});}_0x120193=_[_0x8fdd('0x34')]({},_0x120193,_0x34ccd3[_0x8fdd('0x35')]);return _0x2a1a1c[_0x8fdd('0x42')](_0x120193);}})['then'](function(_0x322428){if(_0x322428){_0x3e0da9=_0x322428[_0x8fdd('0x2d')];if(!_0x34ccd3[_0x8fdd('0x29')][_0x8fdd('0x45')](_0x8fdd('0x2e'))){_0x120193['limit']=qs[_0x8fdd('0x15')](_0x34ccd3[_0x8fdd('0x29')][_0x8fdd('0x15')]);_0x120193[_0x8fdd('0x13')]=qs['offset'](_0x34ccd3[_0x8fdd('0x29')][_0x8fdd('0x13')]);}return _0x2a1a1c[_0x8fdd('0x42')](_0x120193);}})[_0x8fdd('0x1d')](function(_0x3ae317){if(_0x3ae317){return _0x3ae317?{'count':_0x3e0da9,'rows':_0x3ae317}:null;}})[_0x8fdd('0x1d')](respondWithResult(_0x54abc0,null))[_0x8fdd('0x39')](handleError(_0x54abc0,null));};exports[_0x8fdd('0x46')]=function(_0x4bd8ec,_0x26d879,_0x20c0a5){var _0x5a11e6={};var _0x2c9851={};var _0x496d3e;var _0x3b66e4;return db[_0x8fdd('0x37')][_0x8fdd('0x43')]({'where':{'id':_0x4bd8ec['params']['id']}})[_0x8fdd('0x1d')](handleEntityNotFound(_0x26d879,null))['then'](function(_0x1dad38){if(_0x1dad38){_0x496d3e=_0x1dad38;_0x2c9851['model']=_[_0x8fdd('0x28')](db['ServicenowField'][_0x8fdd('0x3c')]);_0x2c9851[_0x8fdd('0x29')]=_['keys'](_0x4bd8ec[_0x8fdd('0x29')]);_0x2c9851[_0x8fdd('0x2a')]=_[_0x8fdd('0x2b')](_0x2c9851['model'],_0x2c9851[_0x8fdd('0x29')]);_0x5a11e6['attributes']=_[_0x8fdd('0x2b')](_0x2c9851['model'],qs['fields'](_0x4bd8ec[_0x8fdd('0x29')][_0x8fdd('0x3d')]));_0x5a11e6[_0x8fdd('0x2c')]=_0x5a11e6['attributes'][_0x8fdd('0x2d')]?_0x5a11e6[_0x8fdd('0x2c')]:_0x2c9851[_0x8fdd('0x27')];_0x5a11e6[_0x8fdd('0x2f')]=qs[_0x8fdd('0x30')](_0x4bd8ec[_0x8fdd('0x29')][_0x8fdd('0x30')]);_0x5a11e6[_0x8fdd('0x31')]=qs[_0x8fdd('0x2a')](_[_0x8fdd('0x32')](_0x4bd8ec[_0x8fdd('0x29')],_0x2c9851[_0x8fdd('0x2a')]));if(_0x4bd8ec['query']['filter']){_0x5a11e6[_0x8fdd('0x31')]=_['merge'](_0x5a11e6[_0x8fdd('0x31')],{'$or':_[_0x8fdd('0x23')](_0x5a11e6[_0x8fdd('0x2c')],function(_0x8106){var _0x2ee4c9={};_0x2ee4c9[_0x8106]={'$like':'%'+_0x4bd8ec[_0x8fdd('0x29')]['filter']+'%'};return _0x2ee4c9;})});}_0x5a11e6=_[_0x8fdd('0x34')]({},_0x5a11e6,_0x4bd8ec['options']);return _0x496d3e[_0x8fdd('0x46')](_0x5a11e6);}})['then'](function(_0x202dc3){if(_0x202dc3){_0x3b66e4=_0x202dc3[_0x8fdd('0x2d')];if(!_0x4bd8ec[_0x8fdd('0x29')][_0x8fdd('0x45')](_0x8fdd('0x2e'))){_0x5a11e6[_0x8fdd('0x15')]=qs[_0x8fdd('0x15')](_0x4bd8ec[_0x8fdd('0x29')][_0x8fdd('0x15')]);_0x5a11e6['offset']=qs[_0x8fdd('0x13')](_0x4bd8ec['query'][_0x8fdd('0x13')]);}return _0x496d3e[_0x8fdd('0x46')](_0x5a11e6);}})[_0x8fdd('0x1d')](function(_0x52b2df){if(_0x52b2df){return _0x52b2df?{'count':_0x3b66e4,'rows':_0x52b2df}:null;}})[_0x8fdd('0x1d')](respondWithResult(_0x26d879,null))[_0x8fdd('0x39')](handleError(_0x26d879,null));};exports['getDescriptions']=function(_0x2c2064,_0x1168f7,_0x8f7f57){var _0x833184={};var _0x53ad82={};var _0x443d74;var _0x26638c;return db[_0x8fdd('0x37')][_0x8fdd('0x43')]({'where':{'id':_0x2c2064[_0x8fdd('0x3b')]['id']}})[_0x8fdd('0x1d')](handleEntityNotFound(_0x1168f7,null))[_0x8fdd('0x1d')](function(_0x304cf3){if(_0x304cf3){_0x443d74=_0x304cf3;_0x53ad82['model']=_[_0x8fdd('0x28')](db[_0x8fdd('0x44')][_0x8fdd('0x3c')]);_0x53ad82[_0x8fdd('0x29')]=_['keys'](_0x2c2064[_0x8fdd('0x29')]);_0x53ad82[_0x8fdd('0x2a')]=_[_0x8fdd('0x2b')](_0x53ad82[_0x8fdd('0x27')],_0x53ad82['query']);_0x833184['attributes']=_[_0x8fdd('0x2b')](_0x53ad82[_0x8fdd('0x27')],qs[_0x8fdd('0x3d')](_0x2c2064[_0x8fdd('0x29')]['fields']));_0x833184[_0x8fdd('0x2c')]=_0x833184['attributes']['length']?_0x833184[_0x8fdd('0x2c')]:_0x53ad82[_0x8fdd('0x27')];_0x833184[_0x8fdd('0x2f')]=qs['sort'](_0x2c2064[_0x8fdd('0x29')][_0x8fdd('0x30')]);_0x833184[_0x8fdd('0x31')]=qs['filters'](_[_0x8fdd('0x32')](_0x2c2064['query'],_0x53ad82['filters']));if(_0x2c2064[_0x8fdd('0x29')][_0x8fdd('0x33')]){_0x833184[_0x8fdd('0x31')]=_['merge'](_0x833184[_0x8fdd('0x31')],{'$or':_['map'](_0x833184[_0x8fdd('0x2c')],function(_0x2b3cc5){var _0x4de83b={};_0x4de83b[_0x2b3cc5]={'$like':'%'+_0x2c2064['query'][_0x8fdd('0x33')]+'%'};return _0x4de83b;})});}_0x833184=_[_0x8fdd('0x34')]({},_0x833184,_0x2c2064['options']);return _0x443d74[_0x8fdd('0x47')](_0x833184);}})[_0x8fdd('0x1d')](function(_0x42f6dc){if(_0x42f6dc){_0x26638c=_0x42f6dc['length'];if(!_0x2c2064[_0x8fdd('0x29')][_0x8fdd('0x45')](_0x8fdd('0x2e'))){_0x833184[_0x8fdd('0x15')]=qs[_0x8fdd('0x15')](_0x2c2064[_0x8fdd('0x29')]['limit']);_0x833184[_0x8fdd('0x13')]=qs['offset'](_0x2c2064[_0x8fdd('0x29')][_0x8fdd('0x13')]);}return _0x443d74[_0x8fdd('0x47')](_0x833184);}})[_0x8fdd('0x1d')](function(_0x13c80c){if(_0x13c80c){return _0x13c80c?{'count':_0x26638c,'rows':_0x13c80c}:null;}})[_0x8fdd('0x1d')](respondWithResult(_0x1168f7,null))['catch'](handleError(_0x1168f7,null));}; \ No newline at end of file +var _0x7e0a=['undefined','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','ServicenowConfiguration','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','getFields','ServicenowField','getSubjects','findOne','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x524f5a,_0x25dc3){var _0x30c088=function(_0x3b6641){while(--_0x3b6641){_0x524f5a['push'](_0x524f5a['shift']());}};_0x30c088(++_0x25dc3);}(_0x7e0a,0x118));var _0xa7e0=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7e0a[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0xa7e0('0x0'));var rimraf=require(_0xa7e0('0x1'));var zipdir=require(_0xa7e0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa7e0('0x4'));var path=require('path');var sox=require(_0xa7e0('0x5'));var csv=require(_0xa7e0('0x6'));var ejs=require(_0xa7e0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7e0('0x8'));var squel=require(_0xa7e0('0x9'));var crypto=require(_0xa7e0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa7e0('0xb'));var toCsv=require(_0xa7e0('0x6'));var querystring=require('querystring');var Papa=require(_0xa7e0('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa7e0('0xd'));var as=require(_0xa7e0('0xe'));var hardwareService=require(_0xa7e0('0xf'));var logger=require(_0xa7e0('0x10'))('api');var utils=require(_0xa7e0('0x11'));var config=require(_0xa7e0('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7e0('0x13'))['db'];function respondWithStatusCode(_0x284f96,_0x37a85f){_0x37a85f=_0x37a85f||0xcc;return function(_0x41caf5){if(_0x41caf5){return _0x284f96[_0xa7e0('0x14')](_0x37a85f);}return _0x284f96[_0xa7e0('0x15')](_0x37a85f)[_0xa7e0('0x16')]();};}function respondWithResult(_0x3ca95b,_0xfe877d){_0xfe877d=_0xfe877d||0xc8;return function(_0x3eb30f){if(_0x3eb30f){return _0x3ca95b[_0xa7e0('0x15')](_0xfe877d)[_0xa7e0('0x17')](_0x3eb30f);}};}function respondWithFilteredResult(_0x2439cd,_0x41aa30){return function(_0xbb9eb7){if(_0xbb9eb7){var _0xafa38=typeof _0x41aa30['offset']===_0xa7e0('0x18')&&typeof _0x41aa30['limit']==='undefined';var _0x2d30b7=_0xbb9eb7['count'];var _0x277ea1=_0xafa38?0x0:_0x41aa30[_0xa7e0('0x19')];var _0x36cc4a=_0xafa38?_0xbb9eb7['count']:_0x41aa30['offset']+_0x41aa30[_0xa7e0('0x1a')];var _0x2f3ded;if(_0x36cc4a>=_0x2d30b7){_0x36cc4a=_0x2d30b7;_0x2f3ded=0xc8;}else{_0x2f3ded=0xce;}_0x2439cd[_0xa7e0('0x15')](_0x2f3ded);return _0x2439cd[_0xa7e0('0x1b')](_0xa7e0('0x1c'),_0x277ea1+'-'+_0x36cc4a+'/'+_0x2d30b7)['json'](_0xbb9eb7);}return null;};}function patchUpdates(_0x1a311b){return function(_0x479c39){try{jsonpatch[_0xa7e0('0x1d')](_0x479c39,_0x1a311b,!![]);}catch(_0x3838e7){return BPromise[_0xa7e0('0x1e')](_0x3838e7);}return _0x479c39['save']();};}function saveUpdates(_0x213aa4,_0x28c0d0){return function(_0x315ec5){if(_0x315ec5){return _0x315ec5[_0xa7e0('0x1f')](_0x213aa4)[_0xa7e0('0x20')](function(_0x3b46cc){return _0x3b46cc;});}return null;};}function removeEntity(_0x2298f0,_0x5b81bb){return function(_0x3b0495){if(_0x3b0495){return _0x3b0495[_0xa7e0('0x21')]()['then'](function(){_0x2298f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e5f64,_0x25b78e){return function(_0x360339){if(!_0x360339){_0x1e5f64[_0xa7e0('0x14')](0x194);}return _0x360339;};}function handleError(_0x1174f5,_0xa31c6e){_0xa31c6e=_0xa31c6e||0x1f4;return function(_0x17e358){logger[_0xa7e0('0x22')](_0x17e358[_0xa7e0('0x23')]);if(_0x17e358[_0xa7e0('0x24')]){delete _0x17e358['name'];}_0x1174f5[_0xa7e0('0x15')](_0xa31c6e)[_0xa7e0('0x25')](_0x17e358);};}exports[_0xa7e0('0x26')]=function(_0x5c3552,_0x289e41){var _0x1c1d73={},_0x494935={},_0x28897a={'count':0x0,'rows':[]};var _0x2a2915=_[_0xa7e0('0x27')](db['ServicenowConfiguration']['rawAttributes'],function(_0x41bd37){return{'name':_0x41bd37[_0xa7e0('0x28')],'type':_0x41bd37['type']['key']};});_0x494935[_0xa7e0('0x29')]=_['map'](_0x2a2915,_0xa7e0('0x24'));_0x494935[_0xa7e0('0x2a')]=_[_0xa7e0('0x2b')](_0x5c3552[_0xa7e0('0x2a')]);_0x494935[_0xa7e0('0x2c')]=_[_0xa7e0('0x2d')](_0x494935[_0xa7e0('0x29')],_0x494935['query']);_0x1c1d73[_0xa7e0('0x2e')]=_['intersection'](_0x494935[_0xa7e0('0x29')],qs[_0xa7e0('0x2f')](_0x5c3552['query'][_0xa7e0('0x2f')]));_0x1c1d73[_0xa7e0('0x2e')]=_0x1c1d73[_0xa7e0('0x2e')]['length']?_0x1c1d73[_0xa7e0('0x2e')]:_0x494935[_0xa7e0('0x29')];if(!_0x5c3552[_0xa7e0('0x2a')]['hasOwnProperty'](_0xa7e0('0x30'))){_0x1c1d73[_0xa7e0('0x1a')]=qs[_0xa7e0('0x1a')](_0x5c3552[_0xa7e0('0x2a')]['limit']);_0x1c1d73[_0xa7e0('0x19')]=qs[_0xa7e0('0x19')](_0x5c3552['query'][_0xa7e0('0x19')]);}_0x1c1d73[_0xa7e0('0x31')]=qs[_0xa7e0('0x32')](_0x5c3552[_0xa7e0('0x2a')][_0xa7e0('0x32')]);_0x1c1d73[_0xa7e0('0x33')]=qs[_0xa7e0('0x2c')](_[_0xa7e0('0x34')](_0x5c3552[_0xa7e0('0x2a')],_0x494935['filters']),_0x2a2915);if(_0x5c3552[_0xa7e0('0x2a')][_0xa7e0('0x35')]){_0x1c1d73['where']=_[_0xa7e0('0x36')](_0x1c1d73['where'],{'$or':_['map'](_0x2a2915,function(_0x15034e){if(_0x15034e['type']!=='VIRTUAL'){var _0x46e294={};_0x46e294[_0x15034e[_0xa7e0('0x24')]]={'$like':'%'+_0x5c3552['query'][_0xa7e0('0x35')]+'%'};return _0x46e294;}})});}_0x1c1d73=_['merge']({},_0x1c1d73,_0x5c3552[_0xa7e0('0x37')]);var _0x4435e9={'where':_0x1c1d73[_0xa7e0('0x33')]};return db['ServicenowConfiguration'][_0xa7e0('0x38')](_0x4435e9)[_0xa7e0('0x20')](function(_0x22b47f){_0x28897a['count']=_0x22b47f;if(_0x5c3552[_0xa7e0('0x2a')][_0xa7e0('0x39')]){_0x1c1d73[_0xa7e0('0x3a')]=[{'all':!![]}];}return db[_0xa7e0('0x3b')][_0xa7e0('0x3c')](_0x1c1d73);})['then'](function(_0x4d8e74){_0x28897a[_0xa7e0('0x3d')]=_0x4d8e74;return _0x28897a;})[_0xa7e0('0x20')](respondWithFilteredResult(_0x289e41,_0x1c1d73))[_0xa7e0('0x3e')](handleError(_0x289e41,null));};exports[_0xa7e0('0x3f')]=function(_0xfed6ca,_0x11163b){var _0x249d0a={'raw':![],'where':{'id':_0xfed6ca[_0xa7e0('0x40')]['id']}},_0x5dadf1={};_0x5dadf1[_0xa7e0('0x29')]=_['keys'](db['ServicenowConfiguration'][_0xa7e0('0x41')]);_0x5dadf1[_0xa7e0('0x2a')]=_['keys'](_0xfed6ca[_0xa7e0('0x2a')]);_0x5dadf1['filters']=_['intersection'](_0x5dadf1['model'],_0x5dadf1[_0xa7e0('0x2a')]);_0x249d0a[_0xa7e0('0x2e')]=_[_0xa7e0('0x2d')](_0x5dadf1['model'],qs['fields'](_0xfed6ca[_0xa7e0('0x2a')][_0xa7e0('0x2f')]));_0x249d0a[_0xa7e0('0x2e')]=_0x249d0a[_0xa7e0('0x2e')][_0xa7e0('0x42')]?_0x249d0a[_0xa7e0('0x2e')]:_0x5dadf1[_0xa7e0('0x29')];if(_0xfed6ca['query'][_0xa7e0('0x39')]){_0x249d0a['include']=[{'all':!![]}];}_0x249d0a=_[_0xa7e0('0x36')]({},_0x249d0a,_0xfed6ca['options']);return db[_0xa7e0('0x3b')][_0xa7e0('0x43')](_0x249d0a)[_0xa7e0('0x20')](handleEntityNotFound(_0x11163b,null))[_0xa7e0('0x20')](respondWithResult(_0x11163b,null))[_0xa7e0('0x3e')](handleError(_0x11163b,null));};exports[_0xa7e0('0x44')]=function(_0x71855,_0x31b3e1){return db['ServicenowConfiguration'][_0xa7e0('0x44')](_0x71855[_0xa7e0('0x45')],{})[_0xa7e0('0x20')](respondWithResult(_0x31b3e1,0xc9))[_0xa7e0('0x3e')](handleError(_0x31b3e1,null));};exports['update']=function(_0x3ba01f,_0x13f57b){if(_0x3ba01f['body']['id']){delete _0x3ba01f[_0xa7e0('0x45')]['id'];}return db[_0xa7e0('0x3b')][_0xa7e0('0x43')]({'where':{'id':_0x3ba01f[_0xa7e0('0x40')]['id']}})[_0xa7e0('0x20')](handleEntityNotFound(_0x13f57b,null))[_0xa7e0('0x20')](saveUpdates(_0x3ba01f[_0xa7e0('0x45')],null))['then'](respondWithResult(_0x13f57b,null))[_0xa7e0('0x3e')](handleError(_0x13f57b,null));};exports[_0xa7e0('0x21')]=function(_0x28db0d,_0x2d852d){return db[_0xa7e0('0x3b')][_0xa7e0('0x43')]({'where':{'id':_0x28db0d[_0xa7e0('0x40')]['id']}})['then'](handleEntityNotFound(_0x2d852d,null))[_0xa7e0('0x20')](removeEntity(_0x2d852d,null))[_0xa7e0('0x3e')](handleError(_0x2d852d,null));};exports[_0xa7e0('0x46')]=function(_0x322b25,_0x43953a,_0x2f11d4){var _0x2fafa5={};var _0x25cc68={};var _0x380d65;var _0x37e4ba;return db[_0xa7e0('0x3b')]['findOne']({'where':{'id':_0x322b25[_0xa7e0('0x40')]['id']}})[_0xa7e0('0x20')](handleEntityNotFound(_0x43953a,null))['then'](function(_0xa531bf){if(_0xa531bf){_0x380d65=_0xa531bf;_0x25cc68[_0xa7e0('0x29')]=_[_0xa7e0('0x2b')](db[_0xa7e0('0x47')][_0xa7e0('0x41')]);_0x25cc68[_0xa7e0('0x2a')]=_[_0xa7e0('0x2b')](_0x322b25['query']);_0x25cc68[_0xa7e0('0x2c')]=_[_0xa7e0('0x2d')](_0x25cc68['model'],_0x25cc68['query']);_0x2fafa5['attributes']=_['intersection'](_0x25cc68[_0xa7e0('0x29')],qs[_0xa7e0('0x2f')](_0x322b25[_0xa7e0('0x2a')][_0xa7e0('0x2f')]));_0x2fafa5[_0xa7e0('0x2e')]=_0x2fafa5[_0xa7e0('0x2e')]['length']?_0x2fafa5['attributes']:_0x25cc68[_0xa7e0('0x29')];_0x2fafa5[_0xa7e0('0x31')]=qs['sort'](_0x322b25[_0xa7e0('0x2a')][_0xa7e0('0x32')]);_0x2fafa5[_0xa7e0('0x33')]=qs['filters'](_[_0xa7e0('0x34')](_0x322b25['query'],_0x25cc68[_0xa7e0('0x2c')]));if(_0x322b25['query']['filter']){_0x2fafa5['where']=_[_0xa7e0('0x36')](_0x2fafa5[_0xa7e0('0x33')],{'$or':_[_0xa7e0('0x27')](_0x2fafa5[_0xa7e0('0x2e')],function(_0x202b8f){var _0x1d999b={};_0x1d999b[_0x202b8f]={'$like':'%'+_0x322b25[_0xa7e0('0x2a')][_0xa7e0('0x35')]+'%'};return _0x1d999b;})});}_0x2fafa5=_[_0xa7e0('0x36')]({},_0x2fafa5,_0x322b25[_0xa7e0('0x37')]);return _0x380d65[_0xa7e0('0x46')](_0x2fafa5);}})[_0xa7e0('0x20')](function(_0x267195){if(_0x267195){_0x37e4ba=_0x267195[_0xa7e0('0x42')];if(!_0x322b25[_0xa7e0('0x2a')]['hasOwnProperty'](_0xa7e0('0x30'))){_0x2fafa5[_0xa7e0('0x1a')]=qs[_0xa7e0('0x1a')](_0x322b25['query'][_0xa7e0('0x1a')]);_0x2fafa5['offset']=qs[_0xa7e0('0x19')](_0x322b25[_0xa7e0('0x2a')]['offset']);}return _0x380d65[_0xa7e0('0x46')](_0x2fafa5);}})[_0xa7e0('0x20')](function(_0x433c8d){if(_0x433c8d){return _0x433c8d?{'count':_0x37e4ba,'rows':_0x433c8d}:null;}})['then'](respondWithResult(_0x43953a,null))['catch'](handleError(_0x43953a,null));};exports[_0xa7e0('0x48')]=function(_0x2229b3,_0x33d8d8,_0x446dbe){var _0x5d3081={};var _0xaad36e={};var _0x3cd48e;var _0x3899e3;return db['ServicenowConfiguration'][_0xa7e0('0x49')]({'where':{'id':_0x2229b3[_0xa7e0('0x40')]['id']}})[_0xa7e0('0x20')](handleEntityNotFound(_0x33d8d8,null))[_0xa7e0('0x20')](function(_0x5d65a1){if(_0x5d65a1){_0x3cd48e=_0x5d65a1;_0xaad36e[_0xa7e0('0x29')]=_[_0xa7e0('0x2b')](db['ServicenowField'][_0xa7e0('0x41')]);_0xaad36e[_0xa7e0('0x2a')]=_[_0xa7e0('0x2b')](_0x2229b3['query']);_0xaad36e[_0xa7e0('0x2c')]=_['intersection'](_0xaad36e[_0xa7e0('0x29')],_0xaad36e[_0xa7e0('0x2a')]);_0x5d3081['attributes']=_['intersection'](_0xaad36e['model'],qs[_0xa7e0('0x2f')](_0x2229b3[_0xa7e0('0x2a')]['fields']));_0x5d3081['attributes']=_0x5d3081[_0xa7e0('0x2e')][_0xa7e0('0x42')]?_0x5d3081[_0xa7e0('0x2e')]:_0xaad36e[_0xa7e0('0x29')];_0x5d3081[_0xa7e0('0x31')]=qs['sort'](_0x2229b3[_0xa7e0('0x2a')][_0xa7e0('0x32')]);_0x5d3081[_0xa7e0('0x33')]=qs[_0xa7e0('0x2c')](_[_0xa7e0('0x34')](_0x2229b3['query'],_0xaad36e[_0xa7e0('0x2c')]));if(_0x2229b3[_0xa7e0('0x2a')][_0xa7e0('0x35')]){_0x5d3081[_0xa7e0('0x33')]=_[_0xa7e0('0x36')](_0x5d3081[_0xa7e0('0x33')],{'$or':_[_0xa7e0('0x27')](_0x5d3081['attributes'],function(_0x2150e6){var _0x444556={};_0x444556[_0x2150e6]={'$like':'%'+_0x2229b3[_0xa7e0('0x2a')]['filter']+'%'};return _0x444556;})});}_0x5d3081=_[_0xa7e0('0x36')]({},_0x5d3081,_0x2229b3['options']);return _0x3cd48e['getSubjects'](_0x5d3081);}})[_0xa7e0('0x20')](function(_0x31ac95){if(_0x31ac95){_0x3899e3=_0x31ac95[_0xa7e0('0x42')];if(!_0x2229b3[_0xa7e0('0x2a')][_0xa7e0('0x4a')](_0xa7e0('0x30'))){_0x5d3081[_0xa7e0('0x1a')]=qs[_0xa7e0('0x1a')](_0x2229b3[_0xa7e0('0x2a')]['limit']);_0x5d3081[_0xa7e0('0x19')]=qs[_0xa7e0('0x19')](_0x2229b3[_0xa7e0('0x2a')]['offset']);}return _0x3cd48e[_0xa7e0('0x48')](_0x5d3081);}})[_0xa7e0('0x20')](function(_0x5a9e42){if(_0x5a9e42){return _0x5a9e42?{'count':_0x3899e3,'rows':_0x5a9e42}:null;}})[_0xa7e0('0x20')](respondWithResult(_0x33d8d8,null))[_0xa7e0('0x3e')](handleError(_0x33d8d8,null));};exports['getDescriptions']=function(_0x2ac12c,_0xb719c2,_0x2f9f28){var _0x217fc7={};var _0x1d54ef={};var _0x4902ca;var _0x3659f1;return db['ServicenowConfiguration'][_0xa7e0('0x49')]({'where':{'id':_0x2ac12c[_0xa7e0('0x40')]['id']}})[_0xa7e0('0x20')](handleEntityNotFound(_0xb719c2,null))['then'](function(_0x2e0458){if(_0x2e0458){_0x4902ca=_0x2e0458;_0x1d54ef[_0xa7e0('0x29')]=_['keys'](db[_0xa7e0('0x47')]['rawAttributes']);_0x1d54ef[_0xa7e0('0x2a')]=_[_0xa7e0('0x2b')](_0x2ac12c[_0xa7e0('0x2a')]);_0x1d54ef[_0xa7e0('0x2c')]=_[_0xa7e0('0x2d')](_0x1d54ef['model'],_0x1d54ef['query']);_0x217fc7['attributes']=_[_0xa7e0('0x2d')](_0x1d54ef[_0xa7e0('0x29')],qs[_0xa7e0('0x2f')](_0x2ac12c[_0xa7e0('0x2a')][_0xa7e0('0x2f')]));_0x217fc7[_0xa7e0('0x2e')]=_0x217fc7[_0xa7e0('0x2e')]['length']?_0x217fc7['attributes']:_0x1d54ef['model'];_0x217fc7['order']=qs[_0xa7e0('0x32')](_0x2ac12c[_0xa7e0('0x2a')]['sort']);_0x217fc7['where']=qs[_0xa7e0('0x2c')](_[_0xa7e0('0x34')](_0x2ac12c[_0xa7e0('0x2a')],_0x1d54ef[_0xa7e0('0x2c')]));if(_0x2ac12c[_0xa7e0('0x2a')]['filter']){_0x217fc7[_0xa7e0('0x33')]=_[_0xa7e0('0x36')](_0x217fc7[_0xa7e0('0x33')],{'$or':_[_0xa7e0('0x27')](_0x217fc7[_0xa7e0('0x2e')],function(_0x170d47){var _0x40b65b={};_0x40b65b[_0x170d47]={'$like':'%'+_0x2ac12c[_0xa7e0('0x2a')]['filter']+'%'};return _0x40b65b;})});}_0x217fc7=_[_0xa7e0('0x36')]({},_0x217fc7,_0x2ac12c[_0xa7e0('0x37')]);return _0x4902ca[_0xa7e0('0x4b')](_0x217fc7);}})[_0xa7e0('0x20')](function(_0x1fd3b4){if(_0x1fd3b4){_0x3659f1=_0x1fd3b4[_0xa7e0('0x42')];if(!_0x2ac12c[_0xa7e0('0x2a')][_0xa7e0('0x4a')](_0xa7e0('0x30'))){_0x217fc7[_0xa7e0('0x1a')]=qs[_0xa7e0('0x1a')](_0x2ac12c[_0xa7e0('0x2a')][_0xa7e0('0x1a')]);_0x217fc7['offset']=qs[_0xa7e0('0x19')](_0x2ac12c['query'][_0xa7e0('0x19')]);}return _0x4902ca[_0xa7e0('0x4b')](_0x217fc7);}})[_0xa7e0('0x20')](function(_0x5239fc){if(_0x5239fc){return _0x5239fc?{'count':_0x3659f1,'rows':_0x5239fc}:null;}})[_0xa7e0('0x20')](respondWithResult(_0xb719c2,null))['catch'](handleError(_0xb719c2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index da2bcff..eb2b0b1 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 _0x1eba=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x274c5c,_0x41441a){var _0x1182ba=function(_0x52b8d2){while(--_0x52b8d2){_0x274c5c['push'](_0x274c5c['shift']());}};_0x1182ba(++_0x41441a);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x1eba[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b63=['ServicenowConfiguration','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x39724d,_0x28cbf2){var _0x14d275=function(_0x54756f){while(--_0x54756f){_0x39724d['push'](_0x39724d['shift']());}};_0x14d275(++_0x28cbf2);}(_0x0b63,0xe7));var _0x30b6=function(_0x2f7982,_0x268c90){_0x2f7982=_0x2f7982-0x0;var _0x20f546=_0x0b63[_0x2f7982];return _0x20f546;};'use strict';var _=require(_0x30b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30b6('0x1'));var moment=require(_0x30b6('0x2'));var BPromise=require(_0x30b6('0x3'));var rp=require(_0x30b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));var attributes=require(_0x30b6('0x7'));module[_0x30b6('0x8')]=function(_0x2670c6,_0x2fddeb){return _0x2670c6['define'](_0x30b6('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 9f9b8dc..6258dde 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 _0xec90=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x882647,_0x44e538){var _0x28232c=function(_0x3dbf82){while(--_0x3dbf82){_0x882647['push'](_0x882647['shift']());}};_0x28232c(++_0x44e538);}(_0xec90,0x19c));var _0x0ec9=function(_0x3a9083,_0x3c9f8d){_0x3a9083=_0x3a9083-0x0;var _0x160306=_0xec90[_0x3a9083];return _0x160306;};'use strict';var _=require(_0x0ec9('0x0'));var util=require(_0x0ec9('0x1'));var moment=require('moment');var BPromise=require(_0x0ec9('0x2'));var rs=require(_0x0ec9('0x3'));var fs=require('fs');var Redis=require(_0x0ec9('0x4'));var db=require(_0x0ec9('0x5'))['db'];var utils=require(_0x0ec9('0x6'));var logger=require(_0x0ec9('0x7'))(_0x0ec9('0x8'));var config=require(_0x0ec9('0x9'));var jayson=require(_0x0ec9('0xa'));var client=jayson[_0x0ec9('0xb')][_0x0ec9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x292af3,_0x47fb48,_0x2354ad){return new BPromise(function(_0x39bcce,_0x3ad405){return client[_0x0ec9('0xd')](_0x292af3,_0x2354ad)[_0x0ec9('0xe')](function(_0x13e11f){logger[_0x0ec9('0xf')](_0x0ec9('0x10'),_0x47fb48,_0x0ec9('0x11'));logger[_0x0ec9('0x12')](_0x0ec9('0x13'),_0x47fb48,'request\x20sent',JSON[_0x0ec9('0x14')](_0x13e11f));if(_0x13e11f[_0x0ec9('0x15')]){if(_0x13e11f['error'][_0x0ec9('0x16')]===0x1f4){logger[_0x0ec9('0x15')](_0x0ec9('0x10'),_0x47fb48,_0x13e11f['error']['message']);return _0x3ad405(_0x13e11f[_0x0ec9('0x15')][_0x0ec9('0x17')]);}logger[_0x0ec9('0x15')](_0x0ec9('0x10'),_0x47fb48,_0x13e11f['error'][_0x0ec9('0x17')]);return _0x39bcce(_0x13e11f['error'][_0x0ec9('0x17')]);}else{logger['info'](_0x0ec9('0x10'),_0x47fb48,_0x0ec9('0x11'));_0x39bcce(_0x13e11f[_0x0ec9('0x18')]['message']);}})[_0x0ec9('0x19')](function(_0x44133e){logger[_0x0ec9('0x15')](_0x0ec9('0x10'),_0x47fb48,_0x44133e);_0x3ad405(_0x44133e);});});} \ No newline at end of file +var _0x65d2=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x604165,_0x17c84c){var _0x4b7592=function(_0x5f3518){while(--_0x5f3518){_0x604165['push'](_0x604165['shift']());}};_0x4b7592(++_0x17c84c);}(_0x65d2,0x1f3));var _0x265d=function(_0x3daa1c,_0x3ce7df){_0x3daa1c=_0x3daa1c-0x0;var _0x2c81e6=_0x65d2[_0x3daa1c];return _0x2c81e6;};'use strict';var _=require(_0x265d('0x0'));var util=require(_0x265d('0x1'));var moment=require(_0x265d('0x2'));var BPromise=require(_0x265d('0x3'));var rs=require(_0x265d('0x4'));var fs=require('fs');var Redis=require(_0x265d('0x5'));var db=require(_0x265d('0x6'))['db'];var utils=require(_0x265d('0x7'));var logger=require(_0x265d('0x8'))(_0x265d('0x9'));var config=require(_0x265d('0xa'));var jayson=require(_0x265d('0xb'));var client=jayson[_0x265d('0xc')][_0x265d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2599ef,_0x5cdbf7,_0x5f2c02){return new BPromise(function(_0xb62d4e,_0x1f4da4){return client[_0x265d('0xe')](_0x2599ef,_0x5f2c02)['then'](function(_0x43650d){logger[_0x265d('0xf')](_0x265d('0x10'),_0x5cdbf7,_0x265d('0x11'));logger[_0x265d('0x12')](_0x265d('0x13'),_0x5cdbf7,_0x265d('0x11'),JSON[_0x265d('0x14')](_0x43650d));if(_0x43650d[_0x265d('0x15')]){if(_0x43650d[_0x265d('0x15')][_0x265d('0x16')]===0x1f4){logger[_0x265d('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5cdbf7,_0x43650d['error'][_0x265d('0x17')]);return _0x1f4da4(_0x43650d[_0x265d('0x15')][_0x265d('0x17')]);}logger['error'](_0x265d('0x10'),_0x5cdbf7,_0x43650d[_0x265d('0x15')][_0x265d('0x17')]);return _0xb62d4e(_0x43650d[_0x265d('0x15')][_0x265d('0x17')]);}else{logger[_0x265d('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5cdbf7,'request\x20sent');_0xb62d4e(_0x43650d[_0x265d('0x18')][_0x265d('0x17')]);}})[_0x265d('0x19')](function(_0x4f1216){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5cdbf7,_0x4f1216);_0x1f4da4(_0x4f1216);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 0906b5e..e48f652 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 _0xd9ab=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x465845,_0x15007c){var _0x314825=function(_0x4f24b8){while(--_0x4f24b8){_0x465845['push'](_0x465845['shift']());}};_0x314825(++_0x15007c);}(_0xd9ab,0x193));var _0xbd9a=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd9ab[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0xbd9a('0x0'));var util=require('util');var path=require(_0xbd9a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd9a('0x2'));var auth=require(_0xbd9a('0x3'));var interaction=require(_0xbd9a('0x4'));var config=require(_0xbd9a('0x5'));var controller=require('./intServicenowField.controller');router[_0xbd9a('0x6')]('/',auth[_0xbd9a('0x7')](),controller[_0xbd9a('0x8')]);router[_0xbd9a('0x6')](_0xbd9a('0x9'),auth[_0xbd9a('0x7')](),controller[_0xbd9a('0xa')]);router[_0xbd9a('0xb')]('/',auth['isAuthenticated'](),controller[_0xbd9a('0xc')]);router[_0xbd9a('0xd')](_0xbd9a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xbd9a('0xe')](_0xbd9a('0x9'),auth[_0xbd9a('0x7')](),controller[_0xbd9a('0xf')]);module[_0xbd9a('0x10')]=router; \ No newline at end of file +var _0x725f=['../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x725f,0x67));var _0xf725=function(_0x4faf52,_0x16bd42){_0x4faf52=_0x4faf52-0x0;var _0x4dd99c=_0x725f[_0x4faf52];return _0x4dd99c;};'use strict';var multer=require(_0xf725('0x0'));var util=require(_0xf725('0x1'));var path=require(_0xf725('0x2'));var timeout=require(_0xf725('0x3'));var express=require(_0xf725('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf725('0x5'));var interaction=require(_0xf725('0x6'));var config=require('../../config/environment');var controller=require(_0xf725('0x7'));router[_0xf725('0x8')]('/',auth['isAuthenticated'](),controller[_0xf725('0x9')]);router[_0xf725('0x8')](_0xf725('0xa'),auth['isAuthenticated'](),controller[_0xf725('0xb')]);router['post']('/',auth[_0xf725('0xc')](),controller[_0xf725('0xd')]);router[_0xf725('0xe')](_0xf725('0xa'),auth[_0xf725('0xc')](),controller[_0xf725('0xf')]);router[_0xf725('0x10')](_0xf725('0xa'),auth[_0xf725('0xc')](),controller[_0xf725('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f54bc09..ea67057 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 _0xa433=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x54d5d6,_0x5880ff){var _0x178314=function(_0x253112){while(--_0x253112){_0x54d5d6['push'](_0x54d5d6['shift']());}};_0x178314(++_0x5880ff);}(_0xa433,0x99));var _0x3a43=function(_0x147345,_0x2500ab){_0x147345=_0x147345-0x0;var _0x262a39=_0xa433[_0x147345];return _0x262a39;};'use strict';var Sequelize=require(_0x3a43('0x0'));module[_0x3a43('0x1')]={'type':{'type':Sequelize[_0x3a43('0x2')]('string',_0x3a43('0x3'),_0x3a43('0x4'),_0x3a43('0x5'),'picklist'),'defaultValue':_0x3a43('0x6')},'content':{'type':Sequelize[_0x3a43('0x7')]},'key':{'type':Sequelize[_0x3a43('0x7')]},'keyType':{'type':Sequelize[_0x3a43('0x2')](_0x3a43('0x6'),_0x3a43('0x3'),_0x3a43('0x4'))},'keyContent':{'type':Sequelize[_0x3a43('0x7')]},'idField':{'type':Sequelize[_0x3a43('0x7')]},'nameField':{'type':Sequelize[_0x3a43('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3a43('0x7')]}}; \ No newline at end of file +var _0x247f=['variable','BOOLEAN','sequelize','ENUM','string','customVariable','picklist','STRING'];(function(_0xb36843,_0x57c1f4){var _0x227b83=function(_0x3bce6f){while(--_0x3bce6f){_0xb36843['push'](_0xb36843['shift']());}};_0x227b83(++_0x57c1f4);}(_0x247f,0x18a));var _0xf247=function(_0x52e2f2,_0x13a170){_0x52e2f2=_0x52e2f2-0x0;var _0xa0b956=_0x247f[_0x52e2f2];return _0xa0b956;};'use strict';var Sequelize=require(_0xf247('0x0'));module['exports']={'type':{'type':Sequelize[_0xf247('0x1')](_0xf247('0x2'),'variable',_0xf247('0x3'),'keyValue',_0xf247('0x4')),'defaultValue':_0xf247('0x2')},'content':{'type':Sequelize[_0xf247('0x5')]},'key':{'type':Sequelize[_0xf247('0x5')]},'keyType':{'type':Sequelize[_0xf247('0x1')](_0xf247('0x2'),_0xf247('0x6'),_0xf247('0x3'))},'keyContent':{'type':Sequelize[_0xf247('0x5')]},'idField':{'type':Sequelize[_0xf247('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf247('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf247('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 173c970..ac61f92 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 _0x1e34=['update','then','error','stack','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','name','options','include','findAll','rows','show','length','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x1e34,0x160));var _0x41e3=function(_0xd8b670,_0xf364dd){_0xd8b670=_0xd8b670-0x0;var _0x5dfc8f=_0x1e34[_0xd8b670];return _0x5dfc8f;};'use strict';var emlformat=require(_0x41e3('0x0'));var rimraf=require(_0x41e3('0x1'));var zipdir=require(_0x41e3('0x2'));var jsonpatch=require(_0x41e3('0x3'));var rp=require(_0x41e3('0x4'));var moment=require(_0x41e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x41e3('0x6'));var util=require(_0x41e3('0x7'));var path=require('path');var sox=require(_0x41e3('0x8'));var csv=require(_0x41e3('0x9'));var ejs=require(_0x41e3('0xa'));var fs=require('fs');var fs_extra=require(_0x41e3('0xb'));var _=require(_0x41e3('0xc'));var squel=require('squel');var crypto=require(_0x41e3('0xd'));var jsforce=require(_0x41e3('0xe'));var deskjs=require(_0x41e3('0xf'));var toCsv=require(_0x41e3('0x9'));var querystring=require('querystring');var Papa=require(_0x41e3('0x10'));var Redis=require(_0x41e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x41e3('0x12'));var as=require(_0x41e3('0x13'));var hardwareService=require(_0x41e3('0x14'));var logger=require('../../config/logger')(_0x41e3('0x15'));var utils=require(_0x41e3('0x16'));var config=require(_0x41e3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x41e3('0x18'))['db'];function respondWithStatusCode(_0x2cb629,_0xca74fe){_0xca74fe=_0xca74fe||0xcc;return function(_0x199849){if(_0x199849){return _0x2cb629[_0x41e3('0x19')](_0xca74fe);}return _0x2cb629[_0x41e3('0x1a')](_0xca74fe)[_0x41e3('0x1b')]();};}function respondWithResult(_0x3a3739,_0x16a226){_0x16a226=_0x16a226||0xc8;return function(_0x5299d6){if(_0x5299d6){return _0x3a3739[_0x41e3('0x1a')](_0x16a226)[_0x41e3('0x1c')](_0x5299d6);}};}function respondWithFilteredResult(_0x7e9360,_0x1f3df8){return function(_0x31909f){if(_0x31909f){var _0x10e4ea=typeof _0x1f3df8[_0x41e3('0x1d')]===_0x41e3('0x1e')&&typeof _0x1f3df8[_0x41e3('0x1f')]===_0x41e3('0x1e');var _0x59bf03=_0x31909f[_0x41e3('0x20')];var _0xbbbd36=_0x10e4ea?0x0:_0x1f3df8['offset'];var _0xd7f1b7=_0x10e4ea?_0x31909f['count']:_0x1f3df8[_0x41e3('0x1d')]+_0x1f3df8[_0x41e3('0x1f')];var _0x332ab0;if(_0xd7f1b7>=_0x59bf03){_0xd7f1b7=_0x59bf03;_0x332ab0=0xc8;}else{_0x332ab0=0xce;}_0x7e9360[_0x41e3('0x1a')](_0x332ab0);return _0x7e9360[_0x41e3('0x21')](_0x41e3('0x22'),_0xbbbd36+'-'+_0xd7f1b7+'/'+_0x59bf03)[_0x41e3('0x1c')](_0x31909f);}return null;};}function patchUpdates(_0x283acd){return function(_0x562ab7){try{jsonpatch[_0x41e3('0x23')](_0x562ab7,_0x283acd,!![]);}catch(_0x211367){return BPromise[_0x41e3('0x24')](_0x211367);}return _0x562ab7[_0x41e3('0x25')]();};}function saveUpdates(_0x437809,_0x1f6809){return function(_0x2f61e4){if(_0x2f61e4){return _0x2f61e4[_0x41e3('0x26')](_0x437809)[_0x41e3('0x27')](function(_0x50a7db){return _0x50a7db;});}return null;};}function removeEntity(_0x805efc,_0x316de2){return function(_0x5d7ccb){if(_0x5d7ccb){return _0x5d7ccb['destroy']()[_0x41e3('0x27')](function(){_0x805efc[_0x41e3('0x1a')](0xcc)[_0x41e3('0x1b')]();});}};}function handleEntityNotFound(_0x8c3caa,_0x96c4af){return function(_0x3b3ed1){if(!_0x3b3ed1){_0x8c3caa[_0x41e3('0x19')](0x194);}return _0x3b3ed1;};}function handleError(_0x21a6fe,_0x4af6b2){_0x4af6b2=_0x4af6b2||0x1f4;return function(_0x5ce69b){logger[_0x41e3('0x28')](_0x5ce69b[_0x41e3('0x29')]);if(_0x5ce69b['name']){delete _0x5ce69b['name'];}_0x21a6fe[_0x41e3('0x1a')](_0x4af6b2)[_0x41e3('0x2a')](_0x5ce69b);};}exports[_0x41e3('0x2b')]=function(_0xf8b8b0,_0x1b87d7){var _0x48e7e7={},_0xea7189={},_0x499e55={'count':0x0,'rows':[]};var _0x16431b=_[_0x41e3('0x2c')](db[_0x41e3('0x2d')][_0x41e3('0x2e')],function(_0x177c11){return{'name':_0x177c11[_0x41e3('0x2f')],'type':_0x177c11[_0x41e3('0x30')][_0x41e3('0x31')]};});_0xea7189[_0x41e3('0x32')]=_[_0x41e3('0x2c')](_0x16431b,'name');_0xea7189[_0x41e3('0x33')]=_[_0x41e3('0x34')](_0xf8b8b0[_0x41e3('0x33')]);_0xea7189['filters']=_['intersection'](_0xea7189['model'],_0xea7189[_0x41e3('0x33')]);_0x48e7e7[_0x41e3('0x35')]=_[_0x41e3('0x36')](_0xea7189['model'],qs[_0x41e3('0x37')](_0xf8b8b0[_0x41e3('0x33')][_0x41e3('0x37')]));_0x48e7e7[_0x41e3('0x35')]=_0x48e7e7[_0x41e3('0x35')]['length']?_0x48e7e7['attributes']:_0xea7189[_0x41e3('0x32')];if(!_0xf8b8b0[_0x41e3('0x33')][_0x41e3('0x38')]('nolimit')){_0x48e7e7[_0x41e3('0x1f')]=qs[_0x41e3('0x1f')](_0xf8b8b0[_0x41e3('0x33')]['limit']);_0x48e7e7[_0x41e3('0x1d')]=qs[_0x41e3('0x1d')](_0xf8b8b0[_0x41e3('0x33')][_0x41e3('0x1d')]);}_0x48e7e7[_0x41e3('0x39')]=qs[_0x41e3('0x3a')](_0xf8b8b0[_0x41e3('0x33')]['sort']);_0x48e7e7[_0x41e3('0x3b')]=qs[_0x41e3('0x3c')](_['pick'](_0xf8b8b0[_0x41e3('0x33')],_0xea7189['filters']),_0x16431b);if(_0xf8b8b0[_0x41e3('0x33')][_0x41e3('0x3d')]){_0x48e7e7[_0x41e3('0x3b')]=_[_0x41e3('0x3e')](_0x48e7e7[_0x41e3('0x3b')],{'$or':_['map'](_0x16431b,function(_0x592490){if(_0x592490['type']!==_0x41e3('0x3f')){var _0xc08e12={};_0xc08e12[_0x592490[_0x41e3('0x40')]]={'$like':'%'+_0xf8b8b0['query'][_0x41e3('0x3d')]+'%'};return _0xc08e12;}})});}_0x48e7e7=_[_0x41e3('0x3e')]({},_0x48e7e7,_0xf8b8b0[_0x41e3('0x41')]);var _0x5823ba={'where':_0x48e7e7[_0x41e3('0x3b')]};return db[_0x41e3('0x2d')]['count'](_0x5823ba)['then'](function(_0x257d17){_0x499e55['count']=_0x257d17;if(_0xf8b8b0['query']['includeAll']){_0x48e7e7[_0x41e3('0x42')]=[{'all':!![]}];}return db[_0x41e3('0x2d')][_0x41e3('0x43')](_0x48e7e7);})['then'](function(_0x6d2e06){_0x499e55[_0x41e3('0x44')]=_0x6d2e06;return _0x499e55;})['then'](respondWithFilteredResult(_0x1b87d7,_0x48e7e7))['catch'](handleError(_0x1b87d7,null));};exports[_0x41e3('0x45')]=function(_0x279f23,_0x2ad00c){var _0x2841fe={'raw':!![],'where':{'id':_0x279f23['params']['id']}},_0x2e5496={};_0x2e5496['model']=_[_0x41e3('0x34')](db[_0x41e3('0x2d')][_0x41e3('0x2e')]);_0x2e5496[_0x41e3('0x33')]=_[_0x41e3('0x34')](_0x279f23['query']);_0x2e5496[_0x41e3('0x3c')]=_[_0x41e3('0x36')](_0x2e5496[_0x41e3('0x32')],_0x2e5496[_0x41e3('0x33')]);_0x2841fe[_0x41e3('0x35')]=_[_0x41e3('0x36')](_0x2e5496['model'],qs[_0x41e3('0x37')](_0x279f23['query'][_0x41e3('0x37')]));_0x2841fe['attributes']=_0x2841fe[_0x41e3('0x35')][_0x41e3('0x46')]?_0x2841fe['attributes']:_0x2e5496[_0x41e3('0x32')];if(_0x279f23[_0x41e3('0x33')][_0x41e3('0x47')]){_0x2841fe[_0x41e3('0x42')]=[{'all':!![]}];}_0x2841fe=_['merge']({},_0x2841fe,_0x279f23[_0x41e3('0x41')]);return db[_0x41e3('0x2d')][_0x41e3('0x48')](_0x2841fe)[_0x41e3('0x27')](handleEntityNotFound(_0x2ad00c,null))[_0x41e3('0x27')](respondWithResult(_0x2ad00c,null))[_0x41e3('0x49')](handleError(_0x2ad00c,null));};exports[_0x41e3('0x4a')]=function(_0xfab754,_0x427ee4){return db[_0x41e3('0x2d')][_0x41e3('0x4a')](_0xfab754[_0x41e3('0x4b')],{})[_0x41e3('0x27')](respondWithResult(_0x427ee4,0xc9))[_0x41e3('0x49')](handleError(_0x427ee4,null));};exports[_0x41e3('0x26')]=function(_0x1c1792,_0x2f90c4){if(_0x1c1792[_0x41e3('0x4b')]['id']){delete _0x1c1792[_0x41e3('0x4b')]['id'];}return db[_0x41e3('0x2d')][_0x41e3('0x48')]({'where':{'id':_0x1c1792[_0x41e3('0x4c')]['id']}})[_0x41e3('0x27')](handleEntityNotFound(_0x2f90c4,null))[_0x41e3('0x27')](saveUpdates(_0x1c1792[_0x41e3('0x4b')],null))['then'](respondWithResult(_0x2f90c4,null))['catch'](handleError(_0x2f90c4,null));};exports[_0x41e3('0x4d')]=function(_0x475bd1,_0x27d1d4){return db[_0x41e3('0x2d')]['find']({'where':{'id':_0x475bd1[_0x41e3('0x4c')]['id']}})[_0x41e3('0x27')](handleEntityNotFound(_0x27d1d4,null))[_0x41e3('0x27')](removeEntity(_0x27d1d4,null))[_0x41e3('0x49')](handleError(_0x27d1d4,null));}; \ No newline at end of file +var _0x6de0=['save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','options','ServicenowField','includeAll','include','rows','catch','show','params','merge','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x480af9,_0xf44097){var _0xd9617d=function(_0x374a1f){while(--_0x374a1f){_0x480af9['push'](_0x480af9['shift']());}};_0xd9617d(++_0xf44097);}(_0x6de0,0xc4));var _0x06de=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x6de0[_0x2e4e19];return _0x9ba20b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06de('0x0'));var zipdir=require(_0x06de('0x1'));var jsonpatch=require(_0x06de('0x2'));var rp=require(_0x06de('0x3'));var moment=require('moment');var BPromise=require(_0x06de('0x4'));var Mustache=require(_0x06de('0x5'));var util=require('util');var path=require(_0x06de('0x6'));var sox=require(_0x06de('0x7'));var csv=require(_0x06de('0x8'));var ejs=require(_0x06de('0x9'));var fs=require('fs');var fs_extra=require(_0x06de('0xa'));var _=require(_0x06de('0xb'));var squel=require(_0x06de('0xc'));var crypto=require(_0x06de('0xd'));var jsforce=require(_0x06de('0xe'));var deskjs=require(_0x06de('0xf'));var toCsv=require('to-csv');var querystring=require(_0x06de('0x10'));var Papa=require(_0x06de('0x11'));var Redis=require('ioredis');var authService=require(_0x06de('0x12'));var qs=require(_0x06de('0x13'));var as=require(_0x06de('0x14'));var hardwareService=require(_0x06de('0x15'));var logger=require(_0x06de('0x16'))(_0x06de('0x17'));var utils=require(_0x06de('0x18'));var config=require(_0x06de('0x19'));var licenseUtil=require(_0x06de('0x1a'));var db=require(_0x06de('0x1b'))['db'];function respondWithStatusCode(_0x57b1f9,_0x4e57e1){_0x4e57e1=_0x4e57e1||0xcc;return function(_0x43f4cc){if(_0x43f4cc){return _0x57b1f9[_0x06de('0x1c')](_0x4e57e1);}return _0x57b1f9[_0x06de('0x1d')](_0x4e57e1)['end']();};}function respondWithResult(_0x8472ba,_0x3b83e8){_0x3b83e8=_0x3b83e8||0xc8;return function(_0x1e1dac){if(_0x1e1dac){return _0x8472ba[_0x06de('0x1d')](_0x3b83e8)[_0x06de('0x1e')](_0x1e1dac);}};}function respondWithFilteredResult(_0x5ddfa5,_0x691dc9){return function(_0x302f1b){if(_0x302f1b){var _0x1937c2=typeof _0x691dc9[_0x06de('0x1f')]===_0x06de('0x20')&&typeof _0x691dc9[_0x06de('0x21')]===_0x06de('0x20');var _0xa96968=_0x302f1b[_0x06de('0x22')];var _0x4a059d=_0x1937c2?0x0:_0x691dc9['offset'];var _0x224210=_0x1937c2?_0x302f1b['count']:_0x691dc9[_0x06de('0x1f')]+_0x691dc9[_0x06de('0x21')];var _0x3b456f;if(_0x224210>=_0xa96968){_0x224210=_0xa96968;_0x3b456f=0xc8;}else{_0x3b456f=0xce;}_0x5ddfa5[_0x06de('0x1d')](_0x3b456f);return _0x5ddfa5[_0x06de('0x23')]('Content-Range',_0x4a059d+'-'+_0x224210+'/'+_0xa96968)[_0x06de('0x1e')](_0x302f1b);}return null;};}function patchUpdates(_0x1e0e70){return function(_0x55745d){try{jsonpatch[_0x06de('0x24')](_0x55745d,_0x1e0e70,!![]);}catch(_0x525d46){return BPromise[_0x06de('0x25')](_0x525d46);}return _0x55745d[_0x06de('0x26')]();};}function saveUpdates(_0x5ca662,_0x5ad5f1){return function(_0x12fef8){if(_0x12fef8){return _0x12fef8[_0x06de('0x27')](_0x5ca662)['then'](function(_0x2b65c3){return _0x2b65c3;});}return null;};}function removeEntity(_0x3eed2b,_0x1dfc84){return function(_0x4582c2){if(_0x4582c2){return _0x4582c2[_0x06de('0x28')]()[_0x06de('0x29')](function(){_0x3eed2b[_0x06de('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2f31,_0x24bd94){return function(_0x169bb7){if(!_0x169bb7){_0x4b2f31['sendStatus'](0x194);}return _0x169bb7;};}function handleError(_0x2b6f2b,_0x31f359){_0x31f359=_0x31f359||0x1f4;return function(_0xd189a5){logger[_0x06de('0x2a')](_0xd189a5[_0x06de('0x2b')]);if(_0xd189a5[_0x06de('0x2c')]){delete _0xd189a5[_0x06de('0x2c')];}_0x2b6f2b[_0x06de('0x1d')](_0x31f359)[_0x06de('0x2d')](_0xd189a5);};}exports[_0x06de('0x2e')]=function(_0x11d0db,_0x30571d){var _0x199411={},_0x3f3cc2={},_0x2bf97e={'count':0x0,'rows':[]};var _0x1461cb=_[_0x06de('0x2f')](db['ServicenowField'][_0x06de('0x30')],function(_0x21da08){return{'name':_0x21da08[_0x06de('0x31')],'type':_0x21da08['type'][_0x06de('0x32')]};});_0x3f3cc2['model']=_[_0x06de('0x2f')](_0x1461cb,_0x06de('0x2c'));_0x3f3cc2[_0x06de('0x33')]=_[_0x06de('0x34')](_0x11d0db[_0x06de('0x33')]);_0x3f3cc2[_0x06de('0x35')]=_[_0x06de('0x36')](_0x3f3cc2['model'],_0x3f3cc2[_0x06de('0x33')]);_0x199411[_0x06de('0x37')]=_[_0x06de('0x36')](_0x3f3cc2[_0x06de('0x38')],qs[_0x06de('0x39')](_0x11d0db[_0x06de('0x33')][_0x06de('0x39')]));_0x199411[_0x06de('0x37')]=_0x199411[_0x06de('0x37')][_0x06de('0x3a')]?_0x199411[_0x06de('0x37')]:_0x3f3cc2[_0x06de('0x38')];if(!_0x11d0db[_0x06de('0x33')][_0x06de('0x3b')](_0x06de('0x3c'))){_0x199411[_0x06de('0x21')]=qs[_0x06de('0x21')](_0x11d0db[_0x06de('0x33')][_0x06de('0x21')]);_0x199411[_0x06de('0x1f')]=qs[_0x06de('0x1f')](_0x11d0db[_0x06de('0x33')][_0x06de('0x1f')]);}_0x199411['order']=qs['sort'](_0x11d0db['query'][_0x06de('0x3d')]);_0x199411['where']=qs[_0x06de('0x35')](_[_0x06de('0x3e')](_0x11d0db[_0x06de('0x33')],_0x3f3cc2[_0x06de('0x35')]),_0x1461cb);if(_0x11d0db[_0x06de('0x33')]['filter']){_0x199411['where']=_['merge'](_0x199411[_0x06de('0x3f')],{'$or':_[_0x06de('0x2f')](_0x1461cb,function(_0xb5a71){if(_0xb5a71['type']!==_0x06de('0x40')){var _0x104d08={};_0x104d08[_0xb5a71[_0x06de('0x2c')]]={'$like':'%'+_0x11d0db[_0x06de('0x33')][_0x06de('0x41')]+'%'};return _0x104d08;}})});}_0x199411=_['merge']({},_0x199411,_0x11d0db[_0x06de('0x42')]);var _0x3e0f90={'where':_0x199411[_0x06de('0x3f')]};return db[_0x06de('0x43')]['count'](_0x3e0f90)[_0x06de('0x29')](function(_0x527a8a){_0x2bf97e[_0x06de('0x22')]=_0x527a8a;if(_0x11d0db['query'][_0x06de('0x44')]){_0x199411[_0x06de('0x45')]=[{'all':!![]}];}return db[_0x06de('0x43')]['findAll'](_0x199411);})[_0x06de('0x29')](function(_0x3ecbfa){_0x2bf97e[_0x06de('0x46')]=_0x3ecbfa;return _0x2bf97e;})[_0x06de('0x29')](respondWithFilteredResult(_0x30571d,_0x199411))[_0x06de('0x47')](handleError(_0x30571d,null));};exports[_0x06de('0x48')]=function(_0x49226b,_0x5192ad){var _0x4f09ae={'raw':!![],'where':{'id':_0x49226b[_0x06de('0x49')]['id']}},_0x182feb={};_0x182feb[_0x06de('0x38')]=_[_0x06de('0x34')](db[_0x06de('0x43')][_0x06de('0x30')]);_0x182feb[_0x06de('0x33')]=_[_0x06de('0x34')](_0x49226b[_0x06de('0x33')]);_0x182feb[_0x06de('0x35')]=_['intersection'](_0x182feb['model'],_0x182feb[_0x06de('0x33')]);_0x4f09ae['attributes']=_[_0x06de('0x36')](_0x182feb[_0x06de('0x38')],qs['fields'](_0x49226b[_0x06de('0x33')][_0x06de('0x39')]));_0x4f09ae[_0x06de('0x37')]=_0x4f09ae['attributes']['length']?_0x4f09ae[_0x06de('0x37')]:_0x182feb[_0x06de('0x38')];if(_0x49226b[_0x06de('0x33')][_0x06de('0x44')]){_0x4f09ae[_0x06de('0x45')]=[{'all':!![]}];}_0x4f09ae=_[_0x06de('0x4a')]({},_0x4f09ae,_0x49226b[_0x06de('0x42')]);return db[_0x06de('0x43')][_0x06de('0x4b')](_0x4f09ae)[_0x06de('0x29')](handleEntityNotFound(_0x5192ad,null))['then'](respondWithResult(_0x5192ad,null))[_0x06de('0x47')](handleError(_0x5192ad,null));};exports[_0x06de('0x4c')]=function(_0x287063,_0x5309e4){return db[_0x06de('0x43')][_0x06de('0x4c')](_0x287063[_0x06de('0x4d')],{})[_0x06de('0x29')](respondWithResult(_0x5309e4,0xc9))[_0x06de('0x47')](handleError(_0x5309e4,null));};exports[_0x06de('0x27')]=function(_0x10d9fe,_0x49bbeb){if(_0x10d9fe[_0x06de('0x4d')]['id']){delete _0x10d9fe['body']['id'];}return db['ServicenowField'][_0x06de('0x4b')]({'where':{'id':_0x10d9fe[_0x06de('0x49')]['id']}})[_0x06de('0x29')](handleEntityNotFound(_0x49bbeb,null))[_0x06de('0x29')](saveUpdates(_0x10d9fe[_0x06de('0x4d')],null))['then'](respondWithResult(_0x49bbeb,null))[_0x06de('0x47')](handleError(_0x49bbeb,null));};exports[_0x06de('0x28')]=function(_0x5186dd,_0x1896b){return db[_0x06de('0x43')][_0x06de('0x4b')]({'where':{'id':_0x5186dd[_0x06de('0x49')]['id']}})[_0x06de('0x29')](handleEntityNotFound(_0x1896b,null))[_0x06de('0x29')](removeEntity(_0x1896b,null))[_0x06de('0x47')](handleError(_0x1896b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 16d7225..fd38093 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 _0xb7ce=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0xb7ce,0x1f4));var _0xeb7c=function(_0x46100c,_0x1064a3){_0x46100c=_0x46100c-0x0;var _0x5efe80=_0xb7ce[_0x46100c];return _0x5efe80;};'use strict';var _=require(_0xeb7c('0x0'));var util=require(_0xeb7c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeb7c('0x2'));var BPromise=require(_0xeb7c('0x3'));var rp=require(_0xeb7c('0x4'));var fs=require('fs');var path=require(_0xeb7c('0x5'));var rimraf=require(_0xeb7c('0x6'));var config=require(_0xeb7c('0x7'));var attributes=require('./intServicenowField.attributes');module[_0xeb7c('0x8')]=function(_0x204a7b,_0x9fe6fd){return _0x204a7b[_0xeb7c('0x9')](_0xeb7c('0xa'),attributes,{'tableName':_0xeb7c('0xb'),'paranoid':![],'indexes':[{'name':_0xeb7c('0xc'),'fields':[_0xeb7c('0xd'),_0xeb7c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5161=['ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','moment','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x31402b,_0x27ce33){var _0x32c66c=function(_0x506ee5){while(--_0x506ee5){_0x31402b['push'](_0x31402b['shift']());}};_0x32c66c(++_0x27ce33);}(_0x5161,0x163));var _0x1516=function(_0x55bb1e,_0x1379bc){_0x55bb1e=_0x55bb1e-0x0;var _0x33a5f8=_0x5161[_0x55bb1e];return _0x33a5f8;};'use strict';var _=require('lodash');var util=require(_0x1516('0x0'));var logger=require(_0x1516('0x1'))('api');var moment=require(_0x1516('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1516('0x3'));var rimraf=require(_0x1516('0x4'));var config=require(_0x1516('0x5'));var attributes=require(_0x1516('0x6'));module[_0x1516('0x7')]=function(_0x987f08,_0x41aab9){return _0x987f08[_0x1516('0x8')](_0x1516('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x1516('0xa'),'fields':[_0x1516('0xb'),_0x1516('0xc')],'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 fa7278b..93ec423 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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x1f27a9,_0x5ca993){_0x1f27a9=_0x1f27a9-0x0;var _0x39de3f=_0xac4a[_0x1f27a9];return _0x39de3f;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x3b0cf8,_0x843217){var _0x3fda3a=function(_0x23951b){while(--_0x23951b){_0x3b0cf8['push'](_0x3b0cf8['shift']());}};_0x3fda3a(++_0x843217);}(_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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7fe6654..de866b3 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x508780,_0x348fe6){var _0x42e096=function(_0x130daa){while(--_0x130daa){_0x508780['push'](_0x508780['shift']());}};_0x42e096(++_0x348fe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4a3098,_0x1caf53){var _0x51444c=function(_0x1e63b0){while(--_0x1e63b0){_0x4a3098['push'](_0x4a3098['shift']());}};_0x51444c(++_0x1caf53);}(_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/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 41eb163..06bfc66 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(_0x4b76ed,_0x15bac8){var _0x13759e=function(_0x4292e3){while(--_0x4292e3){_0x4b76ed['push'](_0x4b76ed['shift']());}};_0x13759e(++_0x15bac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x104d21,_0x1d1794){var _0x3d9ed6=function(_0x7b9e5a){while(--_0x7b9e5a){_0x104d21['push'](_0x104d21['shift']());}};_0x3d9ed6(++_0x1d1794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 dcf9899..573a1b0 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 _0x4e4d=['sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','SugarcrmAccount','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','catch','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','username','password','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','module_fields','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x535a5b,_0x52fe21){var _0x1b0f2a=function(_0x13b496){while(--_0x13b496){_0x535a5b['push'](_0x535a5b['shift']());}};_0x1b0f2a(++_0x52fe21);}(_0x4e4d,0xd7));var _0xd4e4=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x4e4d[_0x34325b];return _0x3da348;};'use strict';var emlformat=require(_0xd4e4('0x0'));var rimraf=require(_0xd4e4('0x1'));var zipdir=require(_0xd4e4('0x2'));var jsonpatch=require(_0xd4e4('0x3'));var rp=require(_0xd4e4('0x4'));var moment=require(_0xd4e4('0x5'));var BPromise=require(_0xd4e4('0x6'));var Mustache=require(_0xd4e4('0x7'));var util=require(_0xd4e4('0x8'));var path=require(_0xd4e4('0x9'));var sox=require(_0xd4e4('0xa'));var csv=require('to-csv');var ejs=require(_0xd4e4('0xb'));var fs=require('fs');var fs_extra=require(_0xd4e4('0xc'));var _=require('lodash');var squel=require(_0xd4e4('0xd'));var crypto=require(_0xd4e4('0xe'));var jsforce=require(_0xd4e4('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4e4('0x10'));var Papa=require(_0xd4e4('0x11'));var Redis=require(_0xd4e4('0x12'));var authService=require(_0xd4e4('0x13'));var qs=require(_0xd4e4('0x14'));var as=require(_0xd4e4('0x15'));var hardwareService=require(_0xd4e4('0x16'));var logger=require(_0xd4e4('0x17'))(_0xd4e4('0x18'));var utils=require(_0xd4e4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd4e4('0x1a'));var db=require(_0xd4e4('0x1b'))['db'];var integrations=require(_0xd4e4('0x1c'));function respondWithStatusCode(_0x3961b7,_0x4de538){_0x4de538=_0x4de538||0xcc;return function(_0x5eac91){if(_0x5eac91){return _0x3961b7[_0xd4e4('0x1d')](_0x4de538);}return _0x3961b7[_0xd4e4('0x1e')](_0x4de538)['end']();};}function respondWithResult(_0x504038,_0x5761c2){_0x5761c2=_0x5761c2||0xc8;return function(_0x362ddb){if(_0x362ddb){return _0x504038[_0xd4e4('0x1e')](_0x5761c2)[_0xd4e4('0x1f')](_0x362ddb);}};}function respondWithFilteredResult(_0x1efac0,_0x232b38){return function(_0x2af259){if(_0x2af259){var _0x1b15e9=typeof _0x232b38[_0xd4e4('0x20')]==='undefined'&&typeof _0x232b38[_0xd4e4('0x21')]==='undefined';var _0x11bb2e=_0x2af259['count'];var _0x45ff82=_0x1b15e9?0x0:_0x232b38[_0xd4e4('0x20')];var _0x1da896=_0x1b15e9?_0x2af259[_0xd4e4('0x22')]:_0x232b38[_0xd4e4('0x20')]+_0x232b38['limit'];var _0x1f2836;if(_0x1da896>=_0x11bb2e){_0x1da896=_0x11bb2e;_0x1f2836=0xc8;}else{_0x1f2836=0xce;}_0x1efac0[_0xd4e4('0x1e')](_0x1f2836);return _0x1efac0[_0xd4e4('0x23')](_0xd4e4('0x24'),_0x45ff82+'-'+_0x1da896+'/'+_0x11bb2e)[_0xd4e4('0x1f')](_0x2af259);}return null;};}function patchUpdates(_0x591be6){return function(_0x47260a){try{jsonpatch[_0xd4e4('0x25')](_0x47260a,_0x591be6,!![]);}catch(_0x2ed986){return BPromise[_0xd4e4('0x26')](_0x2ed986);}return _0x47260a['save']();};}function saveUpdates(_0x4cc0ff,_0xd3560d){return function(_0xf12a0e){if(_0xf12a0e){return _0xf12a0e[_0xd4e4('0x27')](_0x4cc0ff)['then'](function(_0x245879){return _0x245879;});}return null;};}function removeEntity(_0x2ecaf9,_0x51672d){return function(_0x2a931b){if(_0x2a931b){return _0x2a931b[_0xd4e4('0x28')]()[_0xd4e4('0x29')](function(){_0x2ecaf9[_0xd4e4('0x1e')](0xcc)[_0xd4e4('0x2a')]();});}};}function handleEntityNotFound(_0x47914a,_0x2a1ab0){return function(_0x120062){if(!_0x120062){_0x47914a[_0xd4e4('0x1d')](0x194);}return _0x120062;};}function handleError(_0x155444,_0x31cca7){_0x31cca7=_0x31cca7||0x1f4;return function(_0x53b04f){logger[_0xd4e4('0x2b')](_0x53b04f['stack']);if(_0x53b04f[_0xd4e4('0x2c')]){delete _0x53b04f[_0xd4e4('0x2c')];}_0x155444[_0xd4e4('0x1e')](_0x31cca7)[_0xd4e4('0x2d')](_0x53b04f);};}exports[_0xd4e4('0x2e')]=function(_0x1bf9e5,_0xc59ca7){var _0x318f0b={},_0x147f9a={},_0x54e45d={'count':0x0,'rows':[]};var _0x2b8ca6=_['map'](db[_0xd4e4('0x2f')]['rawAttributes'],function(_0x317813){return{'name':_0x317813[_0xd4e4('0x30')],'type':_0x317813[_0xd4e4('0x31')][_0xd4e4('0x32')]};});_0x147f9a[_0xd4e4('0x33')]=_[_0xd4e4('0x34')](_0x2b8ca6,_0xd4e4('0x2c'));_0x147f9a['query']=_['keys'](_0x1bf9e5[_0xd4e4('0x35')]);_0x147f9a[_0xd4e4('0x36')]=_['intersection'](_0x147f9a[_0xd4e4('0x33')],_0x147f9a[_0xd4e4('0x35')]);_0x318f0b[_0xd4e4('0x37')]=_['intersection'](_0x147f9a[_0xd4e4('0x33')],qs[_0xd4e4('0x38')](_0x1bf9e5['query'][_0xd4e4('0x38')]));_0x318f0b[_0xd4e4('0x37')]=_0x318f0b['attributes'][_0xd4e4('0x39')]?_0x318f0b[_0xd4e4('0x37')]:_0x147f9a['model'];if(!_0x1bf9e5[_0xd4e4('0x35')][_0xd4e4('0x3a')](_0xd4e4('0x3b'))){_0x318f0b[_0xd4e4('0x21')]=qs['limit'](_0x1bf9e5[_0xd4e4('0x35')][_0xd4e4('0x21')]);_0x318f0b[_0xd4e4('0x20')]=qs[_0xd4e4('0x20')](_0x1bf9e5[_0xd4e4('0x35')][_0xd4e4('0x20')]);}_0x318f0b[_0xd4e4('0x3c')]=qs[_0xd4e4('0x3d')](_0x1bf9e5[_0xd4e4('0x35')][_0xd4e4('0x3d')]);_0x318f0b['where']=qs[_0xd4e4('0x36')](_[_0xd4e4('0x3e')](_0x1bf9e5[_0xd4e4('0x35')],_0x147f9a[_0xd4e4('0x36')]),_0x2b8ca6);if(_0x1bf9e5[_0xd4e4('0x35')][_0xd4e4('0x3f')]){_0x318f0b[_0xd4e4('0x40')]=_[_0xd4e4('0x41')](_0x318f0b[_0xd4e4('0x40')],{'$or':_[_0xd4e4('0x34')](_0x2b8ca6,function(_0x574c4f){if(_0x574c4f[_0xd4e4('0x31')]!=='VIRTUAL'){var _0x287260={};_0x287260[_0x574c4f[_0xd4e4('0x2c')]]={'$like':'%'+_0x1bf9e5[_0xd4e4('0x35')][_0xd4e4('0x3f')]+'%'};return _0x287260;}})});}_0x318f0b=_[_0xd4e4('0x41')]({},_0x318f0b,_0x1bf9e5[_0xd4e4('0x42')]);var _0x28f39d={'where':_0x318f0b['where']};return db[_0xd4e4('0x2f')][_0xd4e4('0x22')](_0x28f39d)[_0xd4e4('0x29')](function(_0x4dafb2){_0x54e45d[_0xd4e4('0x22')]=_0x4dafb2;if(_0x1bf9e5[_0xd4e4('0x35')][_0xd4e4('0x43')]){_0x318f0b[_0xd4e4('0x44')]=[{'all':!![]}];}return db[_0xd4e4('0x2f')][_0xd4e4('0x45')](_0x318f0b);})[_0xd4e4('0x29')](function(_0x5e0ca9){_0x54e45d[_0xd4e4('0x46')]=_0x5e0ca9;return _0x54e45d;})['then'](respondWithFilteredResult(_0xc59ca7,_0x318f0b))['catch'](handleError(_0xc59ca7,null));};exports[_0xd4e4('0x47')]=function(_0x430813,_0x3ca37b){var _0x25dbf5={'raw':![],'where':{'id':_0x430813[_0xd4e4('0x48')]['id']}},_0x406c30={};_0x406c30[_0xd4e4('0x33')]=_[_0xd4e4('0x49')](db['SugarcrmAccount']['rawAttributes']);_0x406c30[_0xd4e4('0x35')]=_[_0xd4e4('0x49')](_0x430813[_0xd4e4('0x35')]);_0x406c30['filters']=_['intersection'](_0x406c30[_0xd4e4('0x33')],_0x406c30[_0xd4e4('0x35')]);_0x25dbf5[_0xd4e4('0x37')]=_[_0xd4e4('0x4a')](_0x406c30[_0xd4e4('0x33')],qs[_0xd4e4('0x38')](_0x430813['query'][_0xd4e4('0x38')]));_0x25dbf5[_0xd4e4('0x37')]=_0x25dbf5[_0xd4e4('0x37')][_0xd4e4('0x39')]?_0x25dbf5[_0xd4e4('0x37')]:_0x406c30[_0xd4e4('0x33')];if(_0x430813[_0xd4e4('0x35')][_0xd4e4('0x43')]){_0x25dbf5['include']=[{'all':!![]}];}_0x25dbf5=_['merge']({},_0x25dbf5,_0x430813['options']);return db[_0xd4e4('0x2f')]['find'](_0x25dbf5)[_0xd4e4('0x29')](handleEntityNotFound(_0x3ca37b,null))[_0xd4e4('0x29')](respondWithResult(_0x3ca37b,null))[_0xd4e4('0x4b')](handleError(_0x3ca37b,null));};exports[_0xd4e4('0x4c')]=function(_0x48abb0,_0x4f12ef){return db['SugarcrmAccount']['create'](_0x48abb0[_0xd4e4('0x4d')],{})[_0xd4e4('0x29')](respondWithResult(_0x4f12ef,0xc9))[_0xd4e4('0x4b')](handleError(_0x4f12ef,null));};exports[_0xd4e4('0x27')]=function(_0x37440a,_0x3f08da){if(_0x37440a['body']['id']){delete _0x37440a[_0xd4e4('0x4d')]['id'];}return db[_0xd4e4('0x2f')][_0xd4e4('0x4e')]({'where':{'id':_0x37440a['params']['id']}})[_0xd4e4('0x29')](handleEntityNotFound(_0x3f08da,null))[_0xd4e4('0x29')](saveUpdates(_0x37440a[_0xd4e4('0x4d')],null))[_0xd4e4('0x29')](respondWithResult(_0x3f08da,null))[_0xd4e4('0x4b')](handleError(_0x3f08da,null));};exports[_0xd4e4('0x28')]=function(_0x56eb5f,_0x4314ed){return db['SugarcrmAccount'][_0xd4e4('0x4e')]({'where':{'id':_0x56eb5f[_0xd4e4('0x48')]['id']}})[_0xd4e4('0x29')](handleEntityNotFound(_0x4314ed,null))[_0xd4e4('0x29')](removeEntity(_0x4314ed,null))[_0xd4e4('0x4b')](handleError(_0x4314ed,null));};exports[_0xd4e4('0x4f')]=function(_0xe7f48b,_0x992ad2,_0xbe037c){var _0x484118={};var _0x328099={};var _0x1c3f27;var _0x547a37;return db[_0xd4e4('0x2f')][_0xd4e4('0x50')]({'where':{'id':_0xe7f48b[_0xd4e4('0x48')]['id']}})[_0xd4e4('0x29')](handleEntityNotFound(_0x992ad2,null))[_0xd4e4('0x29')](function(_0xf7bc37){if(_0xf7bc37){_0x1c3f27=_0xf7bc37;_0x328099[_0xd4e4('0x33')]=_[_0xd4e4('0x49')](db[_0xd4e4('0x51')]['rawAttributes']);_0x328099[_0xd4e4('0x35')]=_[_0xd4e4('0x49')](_0xe7f48b['query']);_0x328099['filters']=_['intersection'](_0x328099[_0xd4e4('0x33')],_0x328099['query']);_0x484118['attributes']=_[_0xd4e4('0x4a')](_0x328099[_0xd4e4('0x33')],qs[_0xd4e4('0x38')](_0xe7f48b['query'][_0xd4e4('0x38')]));_0x484118[_0xd4e4('0x37')]=_0x484118[_0xd4e4('0x37')]['length']?_0x484118[_0xd4e4('0x37')]:_0x328099[_0xd4e4('0x33')];_0x484118[_0xd4e4('0x3c')]=qs[_0xd4e4('0x3d')](_0xe7f48b[_0xd4e4('0x35')][_0xd4e4('0x3d')]);_0x484118[_0xd4e4('0x40')]=qs[_0xd4e4('0x36')](_['pick'](_0xe7f48b['query'],_0x328099[_0xd4e4('0x36')]));if(_0xe7f48b[_0xd4e4('0x35')][_0xd4e4('0x3f')]){_0x484118[_0xd4e4('0x40')]=_[_0xd4e4('0x41')](_0x484118[_0xd4e4('0x40')],{'$or':_[_0xd4e4('0x34')](_0x484118[_0xd4e4('0x37')],function(_0x41855d){var _0x2130b3={};_0x2130b3[_0x41855d]={'$like':'%'+_0xe7f48b[_0xd4e4('0x35')][_0xd4e4('0x3f')]+'%'};return _0x2130b3;})});}_0x484118=_[_0xd4e4('0x41')]({},_0x484118,_0xe7f48b[_0xd4e4('0x42')]);return _0x1c3f27[_0xd4e4('0x4f')](_0x484118);}})[_0xd4e4('0x29')](function(_0x5ed5ae){if(_0x5ed5ae){_0x547a37=_0x5ed5ae['length'];if(!_0xe7f48b['query'][_0xd4e4('0x3a')](_0xd4e4('0x3b'))){_0x484118['limit']=qs['limit'](_0xe7f48b['query']['limit']);_0x484118[_0xd4e4('0x20')]=qs[_0xd4e4('0x20')](_0xe7f48b[_0xd4e4('0x35')][_0xd4e4('0x20')]);}return _0x1c3f27[_0xd4e4('0x4f')](_0x484118);}})[_0xd4e4('0x29')](function(_0x31b9ce){if(_0x31b9ce){return _0x31b9ce?{'count':_0x547a37,'rows':_0x31b9ce}:null;}})[_0xd4e4('0x29')](respondWithResult(_0x992ad2,null))[_0xd4e4('0x4b')](handleError(_0x992ad2,null));};exports[_0xd4e4('0x52')]=function(_0x28fb6f,_0x461ad4,_0x301353){if(_0x28fb6f[_0xd4e4('0x4d')]['id']){delete _0x28fb6f[_0xd4e4('0x4d')]['id'];}return db[_0xd4e4('0x2f')][_0xd4e4('0x50')]({'where':{'id':_0x28fb6f[_0xd4e4('0x48')]['id']}})[_0xd4e4('0x29')](handleEntityNotFound(_0x461ad4,null))[_0xd4e4('0x29')](function(_0x435f04){if(_0x435f04){_0x28fb6f[_0xd4e4('0x4d')][_0xd4e4('0x53')]=_0x435f04['id'];_0x28fb6f[_0xd4e4('0x4d')][_0xd4e4('0x54')]=integrations[_0xd4e4('0x55')](_0x28fb6f[_0xd4e4('0x4d')][_0xd4e4('0x56')],_0x28fb6f['body'][_0xd4e4('0x31')]);_0x28fb6f[_0xd4e4('0x4d')][_0xd4e4('0x57')]=integrations['getDescriptions'](_0x28fb6f['body'][_0xd4e4('0x56')],_0x28fb6f['body'][_0xd4e4('0x31')]);return db[_0xd4e4('0x51')][_0xd4e4('0x4c')](_0x28fb6f[_0xd4e4('0x4d')],{'include':[{'model':db[_0xd4e4('0x58')],'as':_0xd4e4('0x54')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xd4e4('0x29')](respondWithResult(_0x461ad4,null))['catch'](handleError(_0x461ad4,null));};exports[_0xd4e4('0x59')]=function(_0x49fd0d,_0x311729,_0x1ad2b8){var _0x3c0d91='';var _0x59f8be=['id',_0xd4e4('0x2c'),_0xd4e4('0x5a'),_0xd4e4('0x5b'),_0xd4e4('0x5c'),'date_start',_0xd4e4('0x5d'),_0xd4e4('0x5e'),'parent_id',_0xd4e4('0x5f'),_0xd4e4('0x60'),'direction'];return db[_0xd4e4('0x2f')][_0xd4e4('0x50')]({'where':{'id':_0x49fd0d[_0xd4e4('0x48')]['id']},'attributes':['id',_0xd4e4('0x61'),_0xd4e4('0x62'),_0xd4e4('0x63')]})[_0xd4e4('0x29')](handleEntityNotFound(_0x311729,null))['then'](function(_0x9b130f){if(_0x9b130f){_0x3c0d91=_0x9b130f[_0xd4e4('0x63')];var _0x402ad3=_0x3c0d91[_0xd4e4('0x64')](-0x1);if(_0x402ad3==='/'){_0x3c0d91=_0x3c0d91[_0xd4e4('0x65')](0x0,_0x3c0d91['lastIndexOf'](_0x402ad3));}return rp({'method':_0xd4e4('0x66'),'uri':util['format'](_0xd4e4('0x67'),_0x3c0d91,_0xd4e4('0x68')),'json':!![],'form':{'method':_0xd4e4('0x69'),'input_type':_0xd4e4('0x6a'),'response_type':_0xd4e4('0x6a'),'rest_data':JSON[_0xd4e4('0x6b')]({'user_auth':{'user_name':_0x9b130f[_0xd4e4('0x61')],'password':_0x9b130f[_0xd4e4('0x62')],'encryption':'PLAIN'},'application':_0xd4e4('0x6c')})}});}})[_0xd4e4('0x29')](function(_0x1d0988){if(_0x1d0988&&_0x1d0988[_0xd4e4('0x2c')]!==_0xd4e4('0x6d')&&_0x1d0988[_0xd4e4('0x2c')]!==_0xd4e4('0x6e')){return rp({'method':_0xd4e4('0x66'),'uri':util[_0xd4e4('0x6f')](_0xd4e4('0x67'),_0x3c0d91,_0xd4e4('0x68')),'json':!![],'form':{'method':_0xd4e4('0x70'),'input_type':_0xd4e4('0x6a'),'response_type':'JSON','rest_data':JSON[_0xd4e4('0x6b')]({'session':_0x1d0988['id'],'module_name':'Calls'})}})[_0xd4e4('0x29')](function(_0x3da1aa){if(_0x3da1aa){var _0xf6165f=_['values'](_0x3da1aa[_0xd4e4('0x71')]);_[_0xd4e4('0x72')](_0xf6165f,function(_0x4f6a50){return _0x59f8be[_0xd4e4('0x73')](_0x4f6a50['name']);});return{'count':_0xf6165f[_0xd4e4('0x39')],'rows':_[_0xd4e4('0x34')](_0xf6165f,function(_0xece06){return{'id':_0xece06[_0xd4e4('0x2c')],'name':_0xece06['label'],'custom':_[_0xd4e4('0x74')](_0xece06[_0xd4e4('0x2c')],'_c')?!![]:![],'options':_0xece06[_0xd4e4('0x42')]?_[_0xd4e4('0x34')](_['values'](_0xece06[_0xd4e4('0x42')]),function(_0x54e207){return{'name':_0x54e207[_0xd4e4('0x75')],'value':_0x54e207[_0xd4e4('0x2c')]};}):[]};})};}})[_0xd4e4('0x29')](respondWithResult(_0x311729,null))[_0xd4e4('0x4b')](function(_0x497c41){var _0x2c5ae2=_0x49fd0d['query'][_0xd4e4('0x76')]?0x1f4:_0x497c41[_0xd4e4('0x77')]||0x1f4;logger[_0xd4e4('0x2b')](_0xd4e4('0x78'),_0xd4e4('0x59'),_0x2c5ae2,JSON['stringify'](_0x497c41));delete _0x497c41[_0xd4e4('0x2c')];if(_0x2c5ae2===0x191){_0x2c5ae2=0x190;}_0x311729[_0xd4e4('0x1e')](_0x2c5ae2)[_0xd4e4('0x2d')](_0x49fd0d[_0xd4e4('0x35')][_0xd4e4('0x76')]?{'message':_0xd4e4('0x79'),'statusCode':_0x497c41[_0xd4e4('0x77')]}:_0x497c41);});}else{var _0xf5248e=0x1f4;_0x311729[_0xd4e4('0x1e')](_0xf5248e)['send']({'message':_0xd4e4('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x782e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','name','send','index','map','SugarcrmAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','POST','/service/v4_1/rest.php','module_fields','remove','includes','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x4ed865,_0x12406a){var _0x55ce1d=function(_0x505f0f){while(--_0x505f0f){_0x4ed865['push'](_0x4ed865['shift']());}};_0x55ce1d(++_0x12406a);}(_0x782e,0x14f));var _0xe782=function(_0x52cdf5,_0x151fe3){_0x52cdf5=_0x52cdf5-0x0;var _0x444459=_0x782e[_0x52cdf5];return _0x444459;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe782('0x0'));var zipdir=require(_0xe782('0x1'));var jsonpatch=require(_0xe782('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe782('0x3'));var Mustache=require(_0xe782('0x4'));var util=require('util');var path=require(_0xe782('0x5'));var sox=require('sox');var csv=require(_0xe782('0x6'));var ejs=require(_0xe782('0x7'));var fs=require('fs');var fs_extra=require(_0xe782('0x8'));var _=require(_0xe782('0x9'));var squel=require('squel');var crypto=require(_0xe782('0xa'));var jsforce=require(_0xe782('0xb'));var deskjs=require(_0xe782('0xc'));var toCsv=require(_0xe782('0x6'));var querystring=require('querystring');var Papa=require(_0xe782('0xd'));var Redis=require(_0xe782('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe782('0xf'));var as=require(_0xe782('0x10'));var hardwareService=require(_0xe782('0x11'));var logger=require(_0xe782('0x12'))('api');var utils=require(_0xe782('0x13'));var config=require(_0xe782('0x14'));var licenseUtil=require(_0xe782('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x10d8ad,_0x1d454b){_0x1d454b=_0x1d454b||0xcc;return function(_0x5e5170){if(_0x5e5170){return _0x10d8ad['sendStatus'](_0x1d454b);}return _0x10d8ad[_0xe782('0x16')](_0x1d454b)[_0xe782('0x17')]();};}function respondWithResult(_0x3aa2e2,_0x4cd049){_0x4cd049=_0x4cd049||0xc8;return function(_0x2dff0c){if(_0x2dff0c){return _0x3aa2e2[_0xe782('0x16')](_0x4cd049)[_0xe782('0x18')](_0x2dff0c);}};}function respondWithFilteredResult(_0x23e09e,_0x2dfd77){return function(_0x3b252f){if(_0x3b252f){var _0x1bd082=typeof _0x2dfd77[_0xe782('0x19')]===_0xe782('0x1a')&&typeof _0x2dfd77[_0xe782('0x1b')]===_0xe782('0x1a');var _0x5c02ce=_0x3b252f[_0xe782('0x1c')];var _0x47eac1=_0x1bd082?0x0:_0x2dfd77[_0xe782('0x19')];var _0x4875ab=_0x1bd082?_0x3b252f[_0xe782('0x1c')]:_0x2dfd77[_0xe782('0x19')]+_0x2dfd77[_0xe782('0x1b')];var _0x2c8a12;if(_0x4875ab>=_0x5c02ce){_0x4875ab=_0x5c02ce;_0x2c8a12=0xc8;}else{_0x2c8a12=0xce;}_0x23e09e[_0xe782('0x16')](_0x2c8a12);return _0x23e09e[_0xe782('0x1d')](_0xe782('0x1e'),_0x47eac1+'-'+_0x4875ab+'/'+_0x5c02ce)['json'](_0x3b252f);}return null;};}function patchUpdates(_0x1bc782){return function(_0x3de9d2){try{jsonpatch['apply'](_0x3de9d2,_0x1bc782,!![]);}catch(_0x1d117f){return BPromise[_0xe782('0x1f')](_0x1d117f);}return _0x3de9d2[_0xe782('0x20')]();};}function saveUpdates(_0x42b795,_0xf65672){return function(_0x1ec92b){if(_0x1ec92b){return _0x1ec92b['update'](_0x42b795)['then'](function(_0x36a3b2){return _0x36a3b2;});}return null;};}function removeEntity(_0x5a6a0f,_0x436d48){return function(_0x3d02ff){if(_0x3d02ff){return _0x3d02ff[_0xe782('0x21')]()[_0xe782('0x22')](function(){_0x5a6a0f['status'](0xcc)[_0xe782('0x17')]();});}};}function handleEntityNotFound(_0x332987,_0x590d80){return function(_0x1b02d6){if(!_0x1b02d6){_0x332987[_0xe782('0x23')](0x194);}return _0x1b02d6;};}function handleError(_0x18ee4f,_0x37bb9d){_0x37bb9d=_0x37bb9d||0x1f4;return function(_0x70e4f9){logger[_0xe782('0x24')](_0x70e4f9['stack']);if(_0x70e4f9['name']){delete _0x70e4f9[_0xe782('0x25')];}_0x18ee4f[_0xe782('0x16')](_0x37bb9d)[_0xe782('0x26')](_0x70e4f9);};}exports[_0xe782('0x27')]=function(_0x4186d5,_0x568a65){var _0x466192={},_0x237f35={},_0x3b6392={'count':0x0,'rows':[]};var _0x264fab=_[_0xe782('0x28')](db[_0xe782('0x29')]['rawAttributes'],function(_0x12a43d){return{'name':_0x12a43d[_0xe782('0x2a')],'type':_0x12a43d[_0xe782('0x2b')][_0xe782('0x2c')]};});_0x237f35['model']=_['map'](_0x264fab,'name');_0x237f35[_0xe782('0x2d')]=_[_0xe782('0x2e')](_0x4186d5[_0xe782('0x2d')]);_0x237f35[_0xe782('0x2f')]=_[_0xe782('0x30')](_0x237f35[_0xe782('0x31')],_0x237f35[_0xe782('0x2d')]);_0x466192[_0xe782('0x32')]=_['intersection'](_0x237f35[_0xe782('0x31')],qs['fields'](_0x4186d5['query'][_0xe782('0x33')]));_0x466192[_0xe782('0x32')]=_0x466192[_0xe782('0x32')]['length']?_0x466192[_0xe782('0x32')]:_0x237f35[_0xe782('0x31')];if(!_0x4186d5[_0xe782('0x2d')]['hasOwnProperty'](_0xe782('0x34'))){_0x466192['limit']=qs[_0xe782('0x1b')](_0x4186d5[_0xe782('0x2d')][_0xe782('0x1b')]);_0x466192[_0xe782('0x19')]=qs['offset'](_0x4186d5[_0xe782('0x2d')][_0xe782('0x19')]);}_0x466192[_0xe782('0x35')]=qs['sort'](_0x4186d5[_0xe782('0x2d')][_0xe782('0x36')]);_0x466192[_0xe782('0x37')]=qs[_0xe782('0x2f')](_[_0xe782('0x38')](_0x4186d5[_0xe782('0x2d')],_0x237f35['filters']),_0x264fab);if(_0x4186d5['query'][_0xe782('0x39')]){_0x466192['where']=_[_0xe782('0x3a')](_0x466192['where'],{'$or':_[_0xe782('0x28')](_0x264fab,function(_0x41b6c3){if(_0x41b6c3[_0xe782('0x2b')]!==_0xe782('0x3b')){var _0x2a2c1a={};_0x2a2c1a[_0x41b6c3[_0xe782('0x25')]]={'$like':'%'+_0x4186d5[_0xe782('0x2d')][_0xe782('0x39')]+'%'};return _0x2a2c1a;}})});}_0x466192=_['merge']({},_0x466192,_0x4186d5['options']);var _0x11d7db={'where':_0x466192[_0xe782('0x37')]};return db[_0xe782('0x29')]['count'](_0x11d7db)[_0xe782('0x22')](function(_0x6649ca){_0x3b6392[_0xe782('0x1c')]=_0x6649ca;if(_0x4186d5['query'][_0xe782('0x3c')]){_0x466192[_0xe782('0x3d')]=[{'all':!![]}];}return db[_0xe782('0x29')][_0xe782('0x3e')](_0x466192);})[_0xe782('0x22')](function(_0x3247e8){_0x3b6392[_0xe782('0x3f')]=_0x3247e8;return _0x3b6392;})[_0xe782('0x22')](respondWithFilteredResult(_0x568a65,_0x466192))[_0xe782('0x40')](handleError(_0x568a65,null));};exports[_0xe782('0x41')]=function(_0x460c04,_0x1a96cc){var _0x2db02c={'raw':![],'where':{'id':_0x460c04[_0xe782('0x42')]['id']}},_0x173495={};_0x173495['model']=_[_0xe782('0x2e')](db[_0xe782('0x29')][_0xe782('0x43')]);_0x173495[_0xe782('0x2d')]=_[_0xe782('0x2e')](_0x460c04['query']);_0x173495['filters']=_['intersection'](_0x173495[_0xe782('0x31')],_0x173495[_0xe782('0x2d')]);_0x2db02c['attributes']=_[_0xe782('0x30')](_0x173495[_0xe782('0x31')],qs[_0xe782('0x33')](_0x460c04[_0xe782('0x2d')][_0xe782('0x33')]));_0x2db02c[_0xe782('0x32')]=_0x2db02c[_0xe782('0x32')][_0xe782('0x44')]?_0x2db02c[_0xe782('0x32')]:_0x173495[_0xe782('0x31')];if(_0x460c04['query']['includeAll']){_0x2db02c['include']=[{'all':!![]}];}_0x2db02c=_[_0xe782('0x3a')]({},_0x2db02c,_0x460c04[_0xe782('0x45')]);return db[_0xe782('0x29')][_0xe782('0x46')](_0x2db02c)[_0xe782('0x22')](handleEntityNotFound(_0x1a96cc,null))[_0xe782('0x22')](respondWithResult(_0x1a96cc,null))[_0xe782('0x40')](handleError(_0x1a96cc,null));};exports[_0xe782('0x47')]=function(_0x1be5e8,_0x1c7cde){return db[_0xe782('0x29')][_0xe782('0x47')](_0x1be5e8[_0xe782('0x48')],{})[_0xe782('0x22')](respondWithResult(_0x1c7cde,0xc9))['catch'](handleError(_0x1c7cde,null));};exports[_0xe782('0x49')]=function(_0x1631e6,_0x49ac53){if(_0x1631e6[_0xe782('0x48')]['id']){delete _0x1631e6[_0xe782('0x48')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x1631e6[_0xe782('0x42')]['id']}})[_0xe782('0x22')](handleEntityNotFound(_0x49ac53,null))[_0xe782('0x22')](saveUpdates(_0x1631e6[_0xe782('0x48')],null))['then'](respondWithResult(_0x49ac53,null))['catch'](handleError(_0x49ac53,null));};exports['destroy']=function(_0x4a1425,_0x64793f){return db[_0xe782('0x29')][_0xe782('0x46')]({'where':{'id':_0x4a1425[_0xe782('0x42')]['id']}})[_0xe782('0x22')](handleEntityNotFound(_0x64793f,null))[_0xe782('0x22')](removeEntity(_0x64793f,null))[_0xe782('0x40')](handleError(_0x64793f,null));};exports[_0xe782('0x4a')]=function(_0x57180f,_0x55b42e,_0x31f4a9){var _0x4847d9={};var _0x280fe8={};var _0x572404;var _0x36061d;return db[_0xe782('0x29')][_0xe782('0x4b')]({'where':{'id':_0x57180f[_0xe782('0x42')]['id']}})[_0xe782('0x22')](handleEntityNotFound(_0x55b42e,null))[_0xe782('0x22')](function(_0x7f8413){if(_0x7f8413){_0x572404=_0x7f8413;_0x280fe8[_0xe782('0x31')]=_[_0xe782('0x2e')](db[_0xe782('0x4c')][_0xe782('0x43')]);_0x280fe8[_0xe782('0x2d')]=_[_0xe782('0x2e')](_0x57180f[_0xe782('0x2d')]);_0x280fe8['filters']=_[_0xe782('0x30')](_0x280fe8[_0xe782('0x31')],_0x280fe8[_0xe782('0x2d')]);_0x4847d9[_0xe782('0x32')]=_[_0xe782('0x30')](_0x280fe8[_0xe782('0x31')],qs[_0xe782('0x33')](_0x57180f[_0xe782('0x2d')]['fields']));_0x4847d9[_0xe782('0x32')]=_0x4847d9[_0xe782('0x32')][_0xe782('0x44')]?_0x4847d9[_0xe782('0x32')]:_0x280fe8[_0xe782('0x31')];_0x4847d9[_0xe782('0x35')]=qs[_0xe782('0x36')](_0x57180f[_0xe782('0x2d')][_0xe782('0x36')]);_0x4847d9[_0xe782('0x37')]=qs[_0xe782('0x2f')](_[_0xe782('0x38')](_0x57180f[_0xe782('0x2d')],_0x280fe8['filters']));if(_0x57180f[_0xe782('0x2d')][_0xe782('0x39')]){_0x4847d9[_0xe782('0x37')]=_['merge'](_0x4847d9[_0xe782('0x37')],{'$or':_[_0xe782('0x28')](_0x4847d9[_0xe782('0x32')],function(_0x598449){var _0xc18945={};_0xc18945[_0x598449]={'$like':'%'+_0x57180f['query']['filter']+'%'};return _0xc18945;})});}_0x4847d9=_[_0xe782('0x3a')]({},_0x4847d9,_0x57180f[_0xe782('0x45')]);return _0x572404[_0xe782('0x4a')](_0x4847d9);}})[_0xe782('0x22')](function(_0x5b45b6){if(_0x5b45b6){_0x36061d=_0x5b45b6[_0xe782('0x44')];if(!_0x57180f[_0xe782('0x2d')][_0xe782('0x4d')](_0xe782('0x34'))){_0x4847d9['limit']=qs[_0xe782('0x1b')](_0x57180f['query'][_0xe782('0x1b')]);_0x4847d9[_0xe782('0x19')]=qs[_0xe782('0x19')](_0x57180f[_0xe782('0x2d')][_0xe782('0x19')]);}return _0x572404[_0xe782('0x4a')](_0x4847d9);}})[_0xe782('0x22')](function(_0x338d47){if(_0x338d47){return _0x338d47?{'count':_0x36061d,'rows':_0x338d47}:null;}})['then'](respondWithResult(_0x55b42e,null))[_0xe782('0x40')](handleError(_0x55b42e,null));};exports[_0xe782('0x4e')]=function(_0x56a477,_0x54f731,_0x213394){if(_0x56a477['body']['id']){delete _0x56a477[_0xe782('0x48')]['id'];}return db[_0xe782('0x29')][_0xe782('0x4b')]({'where':{'id':_0x56a477[_0xe782('0x42')]['id']}})[_0xe782('0x22')](handleEntityNotFound(_0x54f731,null))[_0xe782('0x22')](function(_0x5d0197){if(_0x5d0197){_0x56a477['body'][_0xe782('0x4f')]=_0x5d0197['id'];_0x56a477[_0xe782('0x48')][_0xe782('0x50')]=integrations[_0xe782('0x51')](_0x56a477['body'][_0xe782('0x52')],_0x56a477[_0xe782('0x48')][_0xe782('0x2b')]);_0x56a477['body'][_0xe782('0x53')]=integrations['getDescriptions'](_0x56a477[_0xe782('0x48')][_0xe782('0x52')],_0x56a477[_0xe782('0x48')][_0xe782('0x2b')]);return db[_0xe782('0x4c')][_0xe782('0x47')](_0x56a477[_0xe782('0x48')],{'include':[{'model':db[_0xe782('0x54')],'as':_0xe782('0x50')},{'model':db['SugarcrmField'],'as':_0xe782('0x53')}]});}return null;})[_0xe782('0x22')](respondWithResult(_0x54f731,null))[_0xe782('0x40')](handleError(_0x54f731,null));};exports[_0xe782('0x55')]=function(_0x956b7c,_0x39ee3c,_0xb2f46d){var _0x290a00='';var _0x5afb76=['id',_0xe782('0x25'),_0xe782('0x56'),_0xe782('0x57'),_0xe782('0x58'),'date_start','duration_hours',_0xe782('0x59'),_0xe782('0x5a'),_0xe782('0x5b'),_0xe782('0x5c'),_0xe782('0x5d')];return db[_0xe782('0x29')][_0xe782('0x4b')]({'where':{'id':_0x956b7c[_0xe782('0x42')]['id']},'attributes':['id',_0xe782('0x5e'),_0xe782('0x5f'),_0xe782('0x60')]})[_0xe782('0x22')](handleEntityNotFound(_0x39ee3c,null))['then'](function(_0x135792){if(_0x135792){_0x290a00=_0x135792[_0xe782('0x60')];var _0x68a4a2=_0x290a00[_0xe782('0x61')](-0x1);if(_0x68a4a2==='/'){_0x290a00=_0x290a00['substring'](0x0,_0x290a00[_0xe782('0x62')](_0x68a4a2));}return rp({'method':'POST','uri':util[_0xe782('0x63')](_0xe782('0x64'),_0x290a00,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xe782('0x65'),'input_type':_0xe782('0x66'),'response_type':_0xe782('0x66'),'rest_data':JSON[_0xe782('0x67')]({'user_auth':{'user_name':_0x135792['username'],'password':_0x135792[_0xe782('0x5f')],'encryption':_0xe782('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xe782('0x22')](function(_0x3ae3ce){if(_0x3ae3ce&&_0x3ae3ce[_0xe782('0x25')]!==_0xe782('0x69')&&_0x3ae3ce['name']!=='Password\x20Expired'){return rp({'method':_0xe782('0x6a'),'uri':util['format'](_0xe782('0x64'),_0x290a00,_0xe782('0x6b')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xe782('0x66'),'response_type':'JSON','rest_data':JSON[_0xe782('0x67')]({'session':_0x3ae3ce['id'],'module_name':'Calls'})}})[_0xe782('0x22')](function(_0x48616c){if(_0x48616c){var _0x3d8d25=_['values'](_0x48616c[_0xe782('0x6c')]);_[_0xe782('0x6d')](_0x3d8d25,function(_0x477263){return _0x5afb76[_0xe782('0x6e')](_0x477263[_0xe782('0x25')]);});return{'count':_0x3d8d25[_0xe782('0x44')],'rows':_[_0xe782('0x28')](_0x3d8d25,function(_0x5be19a){return{'id':_0x5be19a['name'],'name':_0x5be19a[_0xe782('0x6f')],'custom':_[_0xe782('0x70')](_0x5be19a['name'],'_c')?!![]:![],'options':_0x5be19a[_0xe782('0x45')]?_[_0xe782('0x28')](_['values'](_0x5be19a['options']),function(_0x554a98){return{'name':_0x554a98['value'],'value':_0x554a98[_0xe782('0x25')]};}):[]};})};}})[_0xe782('0x22')](respondWithResult(_0x39ee3c,null))['catch'](function(_0x3e8441){var _0x1c5f7a=_0x956b7c[_0xe782('0x2d')]['test']?0x1f4:_0x3e8441[_0xe782('0x71')]||0x1f4;logger[_0xe782('0x24')](_0xe782('0x72'),_0xe782('0x55'),_0x1c5f7a,JSON[_0xe782('0x67')](_0x3e8441));delete _0x3e8441[_0xe782('0x25')];if(_0x1c5f7a===0x191){_0x1c5f7a=0x190;}_0x39ee3c[_0xe782('0x16')](_0x1c5f7a)['send'](_0x956b7c['query'][_0xe782('0x73')]?{'message':_0xe782('0x74'),'statusCode':_0x3e8441[_0xe782('0x71')]}:_0x3e8441);});}else{var _0x162799=0x1f4;_0x39ee3c['status'](_0x162799)[_0xe782('0x26')]({'message':_0xe782('0x74'),'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 476509b..1bb1653 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 _0x7bb9=['util','../../config/logger','api','moment','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0xfed1ef,_0x91f333){var _0x42dd16=function(_0x2b312e){while(--_0x2b312e){_0xfed1ef['push'](_0xfed1ef['shift']());}};_0x42dd16(++_0x91f333);}(_0x7bb9,0x1eb));var _0x97bb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7bb9[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x97bb('0x0'));var util=require(_0x97bb('0x1'));var logger=require(_0x97bb('0x2'))(_0x97bb('0x3'));var moment=require(_0x97bb('0x4'));var BPromise=require('bluebird');var rp=require(_0x97bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97bb('0x6'));var integrations=require(_0x97bb('0x7'));module[_0x97bb('0x8')]=function(_0x134549,_0x26ef69){return _0x134549[_0x97bb('0x9')](_0x97bb('0xa'),attributes,{'tableName':_0x97bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaa6=['path','rimraf','../../config/environment','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x526713,_0x2d99c7){var _0x883e74=function(_0x477c82){while(--_0x477c82){_0x526713['push'](_0x526713['shift']());}};_0x883e74(++_0x2d99c7);}(_0xfaa6,0xbd));var _0x6faa=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xfaa6[_0x207811];return _0x170d56;};'use strict';var _=require(_0x6faa('0x0'));var util=require(_0x6faa('0x1'));var logger=require(_0x6faa('0x2'))(_0x6faa('0x3'));var moment=require(_0x6faa('0x4'));var BPromise=require(_0x6faa('0x5'));var rp=require(_0x6faa('0x6'));var fs=require('fs');var path=require(_0x6faa('0x7'));var rimraf=require(_0x6faa('0x8'));var config=require(_0x6faa('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x6faa('0xa')]=function(_0x4e6b8b,_0x229c57){return _0x4e6b8b[_0x6faa('0xb')](_0x6faa('0xc'),attributes,{'tableName':_0x6faa('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 e403f4b..6632afc 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 _0xa000=['client','request','then','request\x20sent','debug','stringify','error','message','SugarcrmAccount,\x20%s,\x20%s','catch','GetSugarcrmAccount','options','raw','attributes','limit','include','map','model','info','ShowSugarcrmAccount','find','where','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa000,0x1c9));var _0x0a00=function(_0x562024,_0x3d57f2){_0x562024=_0x562024-0x0;var _0x6a7094=_0xa000[_0x562024];return _0x6a7094;};'use strict';var _=require('lodash');var util=require(_0x0a00('0x0'));var moment=require('moment');var BPromise=require(_0x0a00('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a00('0x2'))['db'];var utils=require(_0x0a00('0x3'));var logger=require(_0x0a00('0x4'))('rpc');var config=require(_0x0a00('0x5'));var jayson=require(_0x0a00('0x6'));var client=jayson[_0x0a00('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57e098,_0x1ff43d,_0x21b662){return new BPromise(function(_0x4b0359,_0x506b3e){return client[_0x0a00('0x8')](_0x57e098,_0x21b662)[_0x0a00('0x9')](function(_0x14594a){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x1ff43d,_0x0a00('0xa'));logger[_0x0a00('0xb')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1ff43d,_0x0a00('0xa'),JSON[_0x0a00('0xc')](_0x14594a));if(_0x14594a['error']){if(_0x14594a[_0x0a00('0xd')]['code']===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1ff43d,_0x14594a[_0x0a00('0xd')][_0x0a00('0xe')]);return _0x506b3e(_0x14594a[_0x0a00('0xd')][_0x0a00('0xe')]);}logger[_0x0a00('0xd')](_0x0a00('0xf'),_0x1ff43d,_0x14594a[_0x0a00('0xd')][_0x0a00('0xe')]);return _0x4b0359(_0x14594a[_0x0a00('0xd')][_0x0a00('0xe')]);}else{logger['info'](_0x0a00('0xf'),_0x1ff43d,_0x0a00('0xa'));_0x4b0359(_0x14594a['result'][_0x0a00('0xe')]);}})[_0x0a00('0x10')](function(_0x5022ab){logger[_0x0a00('0xd')](_0x0a00('0xf'),_0x1ff43d,_0x5022ab);_0x506b3e(_0x5022ab);});});}exports[_0x0a00('0x11')]=function(_0x315d8b){var _0x2c6570=this;return new Promise(function(_0x162d04,_0x16a4a8){return db['SugarcrmAccount']['findAll']({'raw':_0x315d8b[_0x0a00('0x12')]?_0x315d8b[_0x0a00('0x12')][_0x0a00('0x13')]===undefined?!![]:![]:!![],'where':_0x315d8b[_0x0a00('0x12')]?_0x315d8b['options']['where']||null:null,'attributes':_0x315d8b[_0x0a00('0x12')]?_0x315d8b[_0x0a00('0x12')][_0x0a00('0x14')]||null:null,'limit':_0x315d8b['options']?_0x315d8b[_0x0a00('0x12')][_0x0a00('0x15')]||null:null,'include':_0x315d8b[_0x0a00('0x12')]?_0x315d8b[_0x0a00('0x12')][_0x0a00('0x16')]?_[_0x0a00('0x17')](_0x315d8b[_0x0a00('0x12')][_0x0a00('0x16')],function(_0x47e0a5){return{'model':db[_0x47e0a5['model']],'as':_0x47e0a5['as'],'attributes':_0x47e0a5[_0x0a00('0x14')],'include':_0x47e0a5[_0x0a00('0x16')]?_[_0x0a00('0x17')](_0x47e0a5[_0x0a00('0x16')],function(_0xb9846a){return{'model':db[_0xb9846a[_0x0a00('0x18')]],'as':_0xb9846a['as'],'attributes':_0xb9846a[_0x0a00('0x14')],'include':_0xb9846a[_0x0a00('0x16')]?_[_0x0a00('0x17')](_0xb9846a[_0x0a00('0x16')],function(_0x19b3ec){return{'model':db[_0x19b3ec['model']],'as':_0x19b3ec['as'],'attributes':_0x19b3ec[_0x0a00('0x14')]};}):[]};}):[]};}):[]:[]})[_0x0a00('0x9')](function(_0x3314f1){logger[_0x0a00('0x19')](_0x0a00('0x11'),_0x315d8b);logger['debug'](_0x0a00('0x11'),_0x315d8b,JSON[_0x0a00('0xc')](_0x3314f1));_0x162d04(_0x3314f1);})['catch'](function(_0x27904b){logger[_0x0a00('0xd')](_0x0a00('0x11'),_0x27904b[_0x0a00('0xe')],_0x315d8b);_0x16a4a8(_0x2c6570[_0x0a00('0xd')](0x1f4,_0x27904b[_0x0a00('0xe')]));});});};exports[_0x0a00('0x1a')]=function(_0x3ddd0c){var _0x906b22=this;return new Promise(function(_0x41e1cb,_0x1285dc){return db['SugarcrmAccount'][_0x0a00('0x1b')]({'raw':_0x3ddd0c[_0x0a00('0x12')]?_0x3ddd0c[_0x0a00('0x12')][_0x0a00('0x13')]===undefined?!![]:![]:!![],'where':_0x3ddd0c[_0x0a00('0x12')]?_0x3ddd0c[_0x0a00('0x12')][_0x0a00('0x1c')]||null:null,'attributes':_0x3ddd0c[_0x0a00('0x12')]?_0x3ddd0c[_0x0a00('0x12')][_0x0a00('0x14')]||null:null,'include':_0x3ddd0c[_0x0a00('0x12')]?_0x3ddd0c[_0x0a00('0x12')][_0x0a00('0x16')]?_['map'](_0x3ddd0c[_0x0a00('0x12')][_0x0a00('0x16')],function(_0x17c1a2){return{'model':db[_0x17c1a2[_0x0a00('0x18')]],'as':_0x17c1a2['as'],'attributes':_0x17c1a2['attributes'],'include':_0x17c1a2[_0x0a00('0x16')]?_[_0x0a00('0x17')](_0x17c1a2[_0x0a00('0x16')],function(_0x41b7ee){return{'model':db[_0x41b7ee[_0x0a00('0x18')]],'as':_0x41b7ee['as'],'attributes':_0x41b7ee[_0x0a00('0x14')],'include':_0x41b7ee[_0x0a00('0x16')]?_[_0x0a00('0x17')](_0x41b7ee[_0x0a00('0x16')],function(_0x3b5f71){return{'model':db[_0x3b5f71[_0x0a00('0x18')]],'as':_0x3b5f71['as'],'attributes':_0x3b5f71[_0x0a00('0x14')]};}):[]};}):[]};}):[]:[]})[_0x0a00('0x9')](function(_0x313819){logger['info']('ShowSugarcrmAccount',_0x3ddd0c);logger['debug'](_0x0a00('0x1a'),_0x3ddd0c,JSON[_0x0a00('0xc')](_0x313819));_0x41e1cb(_0x313819);})[_0x0a00('0x10')](function(_0x4f6714){logger[_0x0a00('0xd')]('ShowSugarcrmAccount',_0x4f6714[_0x0a00('0xe')],_0x3ddd0c);_0x1285dc(_0x906b22['error'](0x1f4,_0x4f6714[_0x0a00('0xe')]));});});}; \ No newline at end of file +var _0x2353=['findAll','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','where','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch'];(function(_0x4e671c,_0x49b3a2){var _0x588a14=function(_0x4b5c44){while(--_0x4b5c44){_0x4e671c['push'](_0x4e671c['shift']());}};_0x588a14(++_0x49b3a2);}(_0x2353,0xc0));var _0x3235=function(_0x21ca8e,_0x4a15b6){_0x21ca8e=_0x21ca8e-0x0;var _0x1efe53=_0x2353[_0x21ca8e];return _0x1efe53;};'use strict';var _=require(_0x3235('0x0'));var util=require(_0x3235('0x1'));var moment=require(_0x3235('0x2'));var BPromise=require(_0x3235('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3235('0x4'))['db'];var utils=require(_0x3235('0x5'));var logger=require(_0x3235('0x6'))(_0x3235('0x7'));var config=require(_0x3235('0x8'));var jayson=require(_0x3235('0x9'));var client=jayson[_0x3235('0xa')][_0x3235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x528f55,_0x2f1125,_0x111e03){return new BPromise(function(_0x5bd121,_0x212793){return client[_0x3235('0xc')](_0x528f55,_0x111e03)[_0x3235('0xd')](function(_0x1f1b61){logger[_0x3235('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x2f1125,_0x3235('0xf'));logger[_0x3235('0x10')](_0x3235('0x11'),_0x2f1125,_0x3235('0xf'),JSON['stringify'](_0x1f1b61));if(_0x1f1b61[_0x3235('0x12')]){if(_0x1f1b61[_0x3235('0x12')][_0x3235('0x13')]===0x1f4){logger[_0x3235('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x2f1125,_0x1f1b61['error'][_0x3235('0x14')]);return _0x212793(_0x1f1b61[_0x3235('0x12')]['message']);}logger[_0x3235('0x12')](_0x3235('0x15'),_0x2f1125,_0x1f1b61['error'][_0x3235('0x14')]);return _0x5bd121(_0x1f1b61[_0x3235('0x12')][_0x3235('0x14')]);}else{logger['info'](_0x3235('0x15'),_0x2f1125,'request\x20sent');_0x5bd121(_0x1f1b61[_0x3235('0x16')][_0x3235('0x14')]);}})[_0x3235('0x17')](function(_0x358660){logger[_0x3235('0x12')](_0x3235('0x15'),_0x2f1125,_0x358660);_0x212793(_0x358660);});});}exports['GetSugarcrmAccount']=function(_0x2b8280){var _0x2a5863=this;return new Promise(function(_0x179562,_0x4a024){return db['SugarcrmAccount'][_0x3235('0x18')]({'raw':_0x2b8280[_0x3235('0x19')]?_0x2b8280[_0x3235('0x19')][_0x3235('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b8280[_0x3235('0x19')]?_0x2b8280[_0x3235('0x19')]['where']||null:null,'attributes':_0x2b8280[_0x3235('0x19')]?_0x2b8280[_0x3235('0x19')][_0x3235('0x1b')]||null:null,'limit':_0x2b8280[_0x3235('0x19')]?_0x2b8280['options'][_0x3235('0x1c')]||null:null,'include':_0x2b8280[_0x3235('0x19')]?_0x2b8280[_0x3235('0x19')][_0x3235('0x1d')]?_[_0x3235('0x1e')](_0x2b8280[_0x3235('0x19')][_0x3235('0x1d')],function(_0x13b7c7){return{'model':db[_0x13b7c7['model']],'as':_0x13b7c7['as'],'attributes':_0x13b7c7[_0x3235('0x1b')],'include':_0x13b7c7['include']?_[_0x3235('0x1e')](_0x13b7c7[_0x3235('0x1d')],function(_0x40c103){return{'model':db[_0x40c103[_0x3235('0x1f')]],'as':_0x40c103['as'],'attributes':_0x40c103[_0x3235('0x1b')],'include':_0x40c103['include']?_[_0x3235('0x1e')](_0x40c103[_0x3235('0x1d')],function(_0x1ec94d){return{'model':db[_0x1ec94d[_0x3235('0x1f')]],'as':_0x1ec94d['as'],'attributes':_0x1ec94d[_0x3235('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3235('0xd')](function(_0x4f264c){logger[_0x3235('0xe')](_0x3235('0x20'),_0x2b8280);logger[_0x3235('0x10')](_0x3235('0x20'),_0x2b8280,JSON['stringify'](_0x4f264c));_0x179562(_0x4f264c);})[_0x3235('0x17')](function(_0x2cb6b5){logger[_0x3235('0x12')]('GetSugarcrmAccount',_0x2cb6b5[_0x3235('0x14')],_0x2b8280);_0x4a024(_0x2a5863['error'](0x1f4,_0x2cb6b5[_0x3235('0x14')]));});});};exports[_0x3235('0x21')]=function(_0x3c8775){var _0x57f335=this;return new Promise(function(_0x254e79,_0xa40cf3){return db['SugarcrmAccount']['find']({'raw':_0x3c8775[_0x3235('0x19')]?_0x3c8775[_0x3235('0x19')][_0x3235('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c8775['options']?_0x3c8775[_0x3235('0x19')][_0x3235('0x22')]||null:null,'attributes':_0x3c8775[_0x3235('0x19')]?_0x3c8775[_0x3235('0x19')][_0x3235('0x1b')]||null:null,'include':_0x3c8775[_0x3235('0x19')]?_0x3c8775[_0x3235('0x19')]['include']?_[_0x3235('0x1e')](_0x3c8775[_0x3235('0x19')][_0x3235('0x1d')],function(_0x36ba56){return{'model':db[_0x36ba56[_0x3235('0x1f')]],'as':_0x36ba56['as'],'attributes':_0x36ba56[_0x3235('0x1b')],'include':_0x36ba56[_0x3235('0x1d')]?_[_0x3235('0x1e')](_0x36ba56[_0x3235('0x1d')],function(_0x5ca1da){return{'model':db[_0x5ca1da['model']],'as':_0x5ca1da['as'],'attributes':_0x5ca1da['attributes'],'include':_0x5ca1da[_0x3235('0x1d')]?_[_0x3235('0x1e')](_0x5ca1da[_0x3235('0x1d')],function(_0xb163a1){return{'model':db[_0xb163a1[_0x3235('0x1f')]],'as':_0xb163a1['as'],'attributes':_0xb163a1[_0x3235('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3235('0xd')](function(_0xb3f9b6){logger['info'](_0x3235('0x21'),_0x3c8775);logger[_0x3235('0x10')]('ShowSugarcrmAccount',_0x3c8775,JSON[_0x3235('0x23')](_0xb3f9b6));_0x254e79(_0xb3f9b6);})[_0x3235('0x17')](function(_0x6f7d72){logger[_0x3235('0x12')](_0x3235('0x21'),_0x6f7d72[_0x3235('0x14')],_0x3c8775);_0xa40cf3(_0x57f335['error'](0x1f4,_0x6f7d72[_0x3235('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5a83f82..167267a 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 _0xd21a=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xd21a,0x19c));var _0xad21=function(_0x1cf5f2,_0x1cde30){_0x1cf5f2=_0x1cf5f2-0x0;var _0x270de2=_0xd21a[_0x1cf5f2];return _0x270de2;};'use strict';var multer=require('multer');var util=require(_0xad21('0x0'));var path=require(_0xad21('0x1'));var timeout=require(_0xad21('0x2'));var express=require(_0xad21('0x3'));var router=express[_0xad21('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xad21('0x5'));var config=require(_0xad21('0x6'));var controller=require(_0xad21('0x7'));router[_0xad21('0x8')]('/',auth[_0xad21('0x9')](),controller[_0xad21('0xa')]);router[_0xad21('0x8')](_0xad21('0xb'),auth[_0xad21('0x9')](),controller['show']);router[_0xad21('0x8')](_0xad21('0xc'),auth[_0xad21('0x9')](),controller['getFields']);router[_0xad21('0x8')]('/:id/subjects',auth[_0xad21('0x9')](),controller[_0xad21('0xd')]);router[_0xad21('0x8')](_0xad21('0xe'),auth[_0xad21('0x9')](),controller[_0xad21('0xf')]);router[_0xad21('0x10')]('/',auth[_0xad21('0x9')](),controller[_0xad21('0x11')]);router[_0xad21('0x12')](_0xad21('0xb'),auth[_0xad21('0x9')](),controller[_0xad21('0x13')]);router[_0xad21('0x14')](_0xad21('0xb'),auth[_0xad21('0x9')](),controller['destroy']);module[_0xad21('0x15')]=router; \ No newline at end of file +var _0x3ae8=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34361b,_0x9642d4){var _0x1de9c5=function(_0x41bc3f){while(--_0x41bc3f){_0x34361b['push'](_0x34361b['shift']());}};_0x1de9c5(++_0x9642d4);}(_0x3ae8,0x185));var _0x83ae=function(_0x3a807f,_0x185e3d){_0x3a807f=_0x3a807f-0x0;var _0x2f26db=_0x3ae8[_0x3a807f];return _0x2f26db;};'use strict';var multer=require(_0x83ae('0x0'));var util=require(_0x83ae('0x1'));var path=require(_0x83ae('0x2'));var timeout=require(_0x83ae('0x3'));var express=require(_0x83ae('0x4'));var router=express[_0x83ae('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x83ae('0x6'));var interaction=require(_0x83ae('0x7'));var config=require(_0x83ae('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x83ae('0x9')]('/',auth[_0x83ae('0xa')](),controller[_0x83ae('0xb')]);router[_0x83ae('0x9')](_0x83ae('0xc'),auth[_0x83ae('0xa')](),controller[_0x83ae('0xd')]);router[_0x83ae('0x9')](_0x83ae('0xe'),auth[_0x83ae('0xa')](),controller[_0x83ae('0xf')]);router[_0x83ae('0x9')](_0x83ae('0x10'),auth[_0x83ae('0xa')](),controller[_0x83ae('0x11')]);router[_0x83ae('0x9')](_0x83ae('0x12'),auth[_0x83ae('0xa')](),controller[_0x83ae('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x83ae('0x14')]('/:id',auth[_0x83ae('0xa')](),controller['update']);router[_0x83ae('0x15')]('/:id',auth[_0x83ae('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4090bc6..8d4ffeb 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 _0x06a8=['sequelize','exports','STRING'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x06a8,0x12c));var _0x806a=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x06a8[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0x806a('0x0'));module[_0x806a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x806a('0x2')]}}; \ No newline at end of file +var _0xed10=['STRING','exports'];(function(_0x498424,_0x2ef285){var _0x1edb0f=function(_0x14411b){while(--_0x14411b){_0x498424['push'](_0x498424['shift']());}};_0x1edb0f(++_0x2ef285);}(_0xed10,0xf7));var _0x0ed1=function(_0x5dc927,_0x49f4a1){_0x5dc927=_0x5dc927-0x0;var _0x416440=_0xed10[_0x5dc927];return _0x416440;};'use strict';var Sequelize=require('sequelize');module[_0x0ed1('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0ed1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b06eceb..3ed6e6c 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 _0x5016=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','find','catch','create','body','getFields','SugarcrmField','options','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4fef22,_0x42ee84){var _0xaeafc7=function(_0x319450){while(--_0x319450){_0x4fef22['push'](_0x4fef22['shift']());}};_0xaeafc7(++_0x42ee84);}(_0x5016,0x16e));var _0x6501=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x5016[_0x14e9f0];return _0xa63f7e;};'use strict';var emlformat=require(_0x6501('0x0'));var rimraf=require(_0x6501('0x1'));var zipdir=require(_0x6501('0x2'));var jsonpatch=require(_0x6501('0x3'));var rp=require(_0x6501('0x4'));var moment=require(_0x6501('0x5'));var BPromise=require(_0x6501('0x6'));var Mustache=require('mustache');var util=require(_0x6501('0x7'));var path=require(_0x6501('0x8'));var sox=require(_0x6501('0x9'));var csv=require(_0x6501('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6501('0xb'));var _=require(_0x6501('0xc'));var squel=require(_0x6501('0xd'));var crypto=require(_0x6501('0xe'));var jsforce=require(_0x6501('0xf'));var deskjs=require(_0x6501('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6501('0x11'));var Papa=require(_0x6501('0x12'));var Redis=require(_0x6501('0x13'));var authService=require(_0x6501('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6501('0x15'));var hardwareService=require(_0x6501('0x16'));var logger=require(_0x6501('0x17'))(_0x6501('0x18'));var utils=require(_0x6501('0x19'));var config=require(_0x6501('0x1a'));var licenseUtil=require(_0x6501('0x1b'));var db=require(_0x6501('0x1c'))['db'];function respondWithStatusCode(_0x5ed212,_0x182ff2){_0x182ff2=_0x182ff2||0xcc;return function(_0x171688){if(_0x171688){return _0x5ed212[_0x6501('0x1d')](_0x182ff2);}return _0x5ed212[_0x6501('0x1e')](_0x182ff2)[_0x6501('0x1f')]();};}function respondWithResult(_0x186b71,_0x593ffe){_0x593ffe=_0x593ffe||0xc8;return function(_0x3a58a8){if(_0x3a58a8){return _0x186b71['status'](_0x593ffe)[_0x6501('0x20')](_0x3a58a8);}};}function respondWithFilteredResult(_0x145d44,_0x33b3d0){return function(_0x2bc40a){if(_0x2bc40a){var _0x7cf1f3=typeof _0x33b3d0['offset']===_0x6501('0x21')&&typeof _0x33b3d0[_0x6501('0x22')]===_0x6501('0x21');var _0x28ce4d=_0x2bc40a[_0x6501('0x23')];var _0x5d6801=_0x7cf1f3?0x0:_0x33b3d0[_0x6501('0x24')];var _0xa1f3c=_0x7cf1f3?_0x2bc40a['count']:_0x33b3d0[_0x6501('0x24')]+_0x33b3d0[_0x6501('0x22')];var _0x512a26;if(_0xa1f3c>=_0x28ce4d){_0xa1f3c=_0x28ce4d;_0x512a26=0xc8;}else{_0x512a26=0xce;}_0x145d44[_0x6501('0x1e')](_0x512a26);return _0x145d44[_0x6501('0x25')]('Content-Range',_0x5d6801+'-'+_0xa1f3c+'/'+_0x28ce4d)[_0x6501('0x20')](_0x2bc40a);}return null;};}function patchUpdates(_0x5de9a4){return function(_0x50ad07){try{jsonpatch[_0x6501('0x26')](_0x50ad07,_0x5de9a4,!![]);}catch(_0x23663f){return BPromise[_0x6501('0x27')](_0x23663f);}return _0x50ad07[_0x6501('0x28')]();};}function saveUpdates(_0x1fb8dc,_0x19fcaa){return function(_0x4322be){if(_0x4322be){return _0x4322be[_0x6501('0x29')](_0x1fb8dc)[_0x6501('0x2a')](function(_0x3d0e47){return _0x3d0e47;});}return null;};}function removeEntity(_0x204b49,_0x4baa78){return function(_0x5d20b9){if(_0x5d20b9){return _0x5d20b9[_0x6501('0x2b')]()['then'](function(){_0x204b49['status'](0xcc)[_0x6501('0x1f')]();});}};}function handleEntityNotFound(_0x38beb1,_0x56ae11){return function(_0x17471a){if(!_0x17471a){_0x38beb1[_0x6501('0x1d')](0x194);}return _0x17471a;};}function handleError(_0x3b79c8,_0x50f5aa){_0x50f5aa=_0x50f5aa||0x1f4;return function(_0x2c47e7){logger[_0x6501('0x2c')](_0x2c47e7[_0x6501('0x2d')]);if(_0x2c47e7[_0x6501('0x2e')]){delete _0x2c47e7[_0x6501('0x2e')];}_0x3b79c8[_0x6501('0x1e')](_0x50f5aa)[_0x6501('0x2f')](_0x2c47e7);};}exports[_0x6501('0x30')]=function(_0x540a1b,_0x29cc9d){var _0x59a54b={},_0x495bfa={},_0x56c64c={'count':0x0,'rows':[]};var _0x52571e=_[_0x6501('0x31')](db[_0x6501('0x32')][_0x6501('0x33')],function(_0x550209){return{'name':_0x550209[_0x6501('0x34')],'type':_0x550209[_0x6501('0x35')][_0x6501('0x36')]};});_0x495bfa[_0x6501('0x37')]=_[_0x6501('0x31')](_0x52571e,'name');_0x495bfa[_0x6501('0x38')]=_[_0x6501('0x39')](_0x540a1b['query']);_0x495bfa[_0x6501('0x3a')]=_[_0x6501('0x3b')](_0x495bfa[_0x6501('0x37')],_0x495bfa[_0x6501('0x38')]);_0x59a54b[_0x6501('0x3c')]=_['intersection'](_0x495bfa['model'],qs[_0x6501('0x3d')](_0x540a1b[_0x6501('0x38')]['fields']));_0x59a54b[_0x6501('0x3c')]=_0x59a54b[_0x6501('0x3c')][_0x6501('0x3e')]?_0x59a54b[_0x6501('0x3c')]:_0x495bfa[_0x6501('0x37')];if(!_0x540a1b[_0x6501('0x38')][_0x6501('0x3f')](_0x6501('0x40'))){_0x59a54b[_0x6501('0x22')]=qs[_0x6501('0x22')](_0x540a1b[_0x6501('0x38')]['limit']);_0x59a54b[_0x6501('0x24')]=qs['offset'](_0x540a1b[_0x6501('0x38')][_0x6501('0x24')]);}_0x59a54b[_0x6501('0x41')]=qs[_0x6501('0x42')](_0x540a1b[_0x6501('0x38')][_0x6501('0x42')]);_0x59a54b[_0x6501('0x43')]=qs['filters'](_[_0x6501('0x44')](_0x540a1b[_0x6501('0x38')],_0x495bfa[_0x6501('0x3a')]),_0x52571e);if(_0x540a1b[_0x6501('0x38')][_0x6501('0x45')]){_0x59a54b[_0x6501('0x43')]=_[_0x6501('0x46')](_0x59a54b[_0x6501('0x43')],{'$or':_[_0x6501('0x31')](_0x52571e,function(_0x944628){if(_0x944628['type']!==_0x6501('0x47')){var _0x4ac530={};_0x4ac530[_0x944628[_0x6501('0x2e')]]={'$like':'%'+_0x540a1b[_0x6501('0x38')][_0x6501('0x45')]+'%'};return _0x4ac530;}})});}_0x59a54b=_[_0x6501('0x46')]({},_0x59a54b,_0x540a1b['options']);var _0x162bd9={'where':_0x59a54b[_0x6501('0x43')]};return db[_0x6501('0x32')][_0x6501('0x23')](_0x162bd9)['then'](function(_0x40ea77){_0x56c64c[_0x6501('0x23')]=_0x40ea77;if(_0x540a1b[_0x6501('0x38')]['includeAll']){_0x59a54b[_0x6501('0x48')]=[{'all':!![]}];}return db[_0x6501('0x32')][_0x6501('0x49')](_0x59a54b);})[_0x6501('0x2a')](function(_0xeeec76){_0x56c64c['rows']=_0xeeec76;return _0x56c64c;})[_0x6501('0x2a')](respondWithFilteredResult(_0x29cc9d,_0x59a54b))['catch'](handleError(_0x29cc9d,null));};exports[_0x6501('0x4a')]=function(_0x35a037,_0x33ed37){var _0xf8c8d0={'raw':![],'where':{'id':_0x35a037[_0x6501('0x4b')]['id']}},_0x26e214={};_0x26e214[_0x6501('0x37')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x26e214[_0x6501('0x38')]=_[_0x6501('0x39')](_0x35a037[_0x6501('0x38')]);_0x26e214[_0x6501('0x3a')]=_[_0x6501('0x3b')](_0x26e214['model'],_0x26e214[_0x6501('0x38')]);_0xf8c8d0['attributes']=_[_0x6501('0x3b')](_0x26e214[_0x6501('0x37')],qs[_0x6501('0x3d')](_0x35a037[_0x6501('0x38')]['fields']));_0xf8c8d0[_0x6501('0x3c')]=_0xf8c8d0['attributes'][_0x6501('0x3e')]?_0xf8c8d0[_0x6501('0x3c')]:_0x26e214[_0x6501('0x37')];if(_0x35a037[_0x6501('0x38')]['includeAll']){_0xf8c8d0[_0x6501('0x48')]=[{'all':!![]}];}_0xf8c8d0=_['merge']({},_0xf8c8d0,_0x35a037['options']);return db[_0x6501('0x32')][_0x6501('0x4c')](_0xf8c8d0)['then'](handleEntityNotFound(_0x33ed37,null))['then'](respondWithResult(_0x33ed37,null))[_0x6501('0x4d')](handleError(_0x33ed37,null));};exports['create']=function(_0x610100,_0x4b39d0){return db['SugarcrmConfiguration'][_0x6501('0x4e')](_0x610100[_0x6501('0x4f')],{})[_0x6501('0x2a')](respondWithResult(_0x4b39d0,0xc9))['catch'](handleError(_0x4b39d0,null));};exports[_0x6501('0x29')]=function(_0x47baab,_0x19234d){if(_0x47baab[_0x6501('0x4f')]['id']){delete _0x47baab[_0x6501('0x4f')]['id'];}return db[_0x6501('0x32')][_0x6501('0x4c')]({'where':{'id':_0x47baab[_0x6501('0x4b')]['id']}})[_0x6501('0x2a')](handleEntityNotFound(_0x19234d,null))['then'](saveUpdates(_0x47baab[_0x6501('0x4f')],null))[_0x6501('0x2a')](respondWithResult(_0x19234d,null))[_0x6501('0x4d')](handleError(_0x19234d,null));};exports['destroy']=function(_0x3bbd9d,_0x55d1ea){return db[_0x6501('0x32')][_0x6501('0x4c')]({'where':{'id':_0x3bbd9d[_0x6501('0x4b')]['id']}})[_0x6501('0x2a')](handleEntityNotFound(_0x55d1ea,null))[_0x6501('0x2a')](removeEntity(_0x55d1ea,null))[_0x6501('0x4d')](handleError(_0x55d1ea,null));};exports[_0x6501('0x50')]=function(_0x2d9147,_0x4e2677,_0x193400){var _0x3a03c8={};var _0x5c4499={};var _0x86a945;var _0xd9a43b;return db[_0x6501('0x32')]['findOne']({'where':{'id':_0x2d9147[_0x6501('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e2677,null))[_0x6501('0x2a')](function(_0xf0e50d){if(_0xf0e50d){_0x86a945=_0xf0e50d;_0x5c4499[_0x6501('0x37')]=_[_0x6501('0x39')](db[_0x6501('0x51')][_0x6501('0x33')]);_0x5c4499[_0x6501('0x38')]=_[_0x6501('0x39')](_0x2d9147[_0x6501('0x38')]);_0x5c4499['filters']=_['intersection'](_0x5c4499['model'],_0x5c4499[_0x6501('0x38')]);_0x3a03c8[_0x6501('0x3c')]=_[_0x6501('0x3b')](_0x5c4499[_0x6501('0x37')],qs[_0x6501('0x3d')](_0x2d9147[_0x6501('0x38')][_0x6501('0x3d')]));_0x3a03c8[_0x6501('0x3c')]=_0x3a03c8[_0x6501('0x3c')][_0x6501('0x3e')]?_0x3a03c8['attributes']:_0x5c4499['model'];_0x3a03c8['order']=qs[_0x6501('0x42')](_0x2d9147['query'][_0x6501('0x42')]);_0x3a03c8[_0x6501('0x43')]=qs[_0x6501('0x3a')](_[_0x6501('0x44')](_0x2d9147['query'],_0x5c4499[_0x6501('0x3a')]));if(_0x2d9147[_0x6501('0x38')][_0x6501('0x45')]){_0x3a03c8[_0x6501('0x43')]=_[_0x6501('0x46')](_0x3a03c8[_0x6501('0x43')],{'$or':_[_0x6501('0x31')](_0x3a03c8[_0x6501('0x3c')],function(_0x114584){var _0x1e1480={};_0x1e1480[_0x114584]={'$like':'%'+_0x2d9147[_0x6501('0x38')]['filter']+'%'};return _0x1e1480;})});}_0x3a03c8=_[_0x6501('0x46')]({},_0x3a03c8,_0x2d9147[_0x6501('0x52')]);return _0x86a945[_0x6501('0x50')](_0x3a03c8);}})[_0x6501('0x2a')](function(_0x3aae76){if(_0x3aae76){_0xd9a43b=_0x3aae76[_0x6501('0x3e')];if(!_0x2d9147[_0x6501('0x38')]['hasOwnProperty']('nolimit')){_0x3a03c8[_0x6501('0x22')]=qs['limit'](_0x2d9147['query'][_0x6501('0x22')]);_0x3a03c8[_0x6501('0x24')]=qs['offset'](_0x2d9147['query'][_0x6501('0x24')]);}return _0x86a945['getFields'](_0x3a03c8);}})[_0x6501('0x2a')](function(_0x449e01){if(_0x449e01){return _0x449e01?{'count':_0xd9a43b,'rows':_0x449e01}:null;}})[_0x6501('0x2a')](respondWithResult(_0x4e2677,null))['catch'](handleError(_0x4e2677,null));};exports[_0x6501('0x53')]=function(_0x5a1a93,_0x2bf3a3,_0x58be01){var _0x72f7fd={};var _0x31aa15={};var _0x3a16e2;var _0x46eb5e;return db[_0x6501('0x32')][_0x6501('0x54')]({'where':{'id':_0x5a1a93['params']['id']}})[_0x6501('0x2a')](handleEntityNotFound(_0x2bf3a3,null))[_0x6501('0x2a')](function(_0x553962){if(_0x553962){_0x3a16e2=_0x553962;_0x31aa15['model']=_[_0x6501('0x39')](db[_0x6501('0x51')][_0x6501('0x33')]);_0x31aa15['query']=_[_0x6501('0x39')](_0x5a1a93['query']);_0x31aa15[_0x6501('0x3a')]=_[_0x6501('0x3b')](_0x31aa15[_0x6501('0x37')],_0x31aa15[_0x6501('0x38')]);_0x72f7fd['attributes']=_[_0x6501('0x3b')](_0x31aa15[_0x6501('0x37')],qs['fields'](_0x5a1a93[_0x6501('0x38')][_0x6501('0x3d')]));_0x72f7fd[_0x6501('0x3c')]=_0x72f7fd[_0x6501('0x3c')]['length']?_0x72f7fd[_0x6501('0x3c')]:_0x31aa15['model'];_0x72f7fd[_0x6501('0x41')]=qs[_0x6501('0x42')](_0x5a1a93[_0x6501('0x38')][_0x6501('0x42')]);_0x72f7fd[_0x6501('0x43')]=qs[_0x6501('0x3a')](_[_0x6501('0x44')](_0x5a1a93[_0x6501('0x38')],_0x31aa15[_0x6501('0x3a')]));if(_0x5a1a93[_0x6501('0x38')][_0x6501('0x45')]){_0x72f7fd[_0x6501('0x43')]=_[_0x6501('0x46')](_0x72f7fd[_0x6501('0x43')],{'$or':_[_0x6501('0x31')](_0x72f7fd[_0x6501('0x3c')],function(_0x281af2){var _0x290976={};_0x290976[_0x281af2]={'$like':'%'+_0x5a1a93[_0x6501('0x38')]['filter']+'%'};return _0x290976;})});}_0x72f7fd=_[_0x6501('0x46')]({},_0x72f7fd,_0x5a1a93[_0x6501('0x52')]);return _0x3a16e2[_0x6501('0x53')](_0x72f7fd);}})[_0x6501('0x2a')](function(_0x2c2058){if(_0x2c2058){_0x46eb5e=_0x2c2058['length'];if(!_0x5a1a93['query'][_0x6501('0x3f')](_0x6501('0x40'))){_0x72f7fd['limit']=qs[_0x6501('0x22')](_0x5a1a93[_0x6501('0x38')][_0x6501('0x22')]);_0x72f7fd['offset']=qs['offset'](_0x5a1a93[_0x6501('0x38')][_0x6501('0x24')]);}return _0x3a16e2[_0x6501('0x53')](_0x72f7fd);}})[_0x6501('0x2a')](function(_0x18f8fa){if(_0x18f8fa){return _0x18f8fa?{'count':_0x46eb5e,'rows':_0x18f8fa}:null;}})[_0x6501('0x2a')](respondWithResult(_0x2bf3a3,null))[_0x6501('0x4d')](handleError(_0x2bf3a3,null));};exports[_0x6501('0x55')]=function(_0x125883,_0x1df1e1,_0x1265be){var _0x415066={};var _0x33cccd={};var _0x48609f;var _0x9b6bdb;return db[_0x6501('0x32')][_0x6501('0x54')]({'where':{'id':_0x125883[_0x6501('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1df1e1,null))[_0x6501('0x2a')](function(_0x515d4b){if(_0x515d4b){_0x48609f=_0x515d4b;_0x33cccd[_0x6501('0x37')]=_['keys'](db[_0x6501('0x51')][_0x6501('0x33')]);_0x33cccd[_0x6501('0x38')]=_['keys'](_0x125883[_0x6501('0x38')]);_0x33cccd['filters']=_[_0x6501('0x3b')](_0x33cccd[_0x6501('0x37')],_0x33cccd['query']);_0x415066[_0x6501('0x3c')]=_[_0x6501('0x3b')](_0x33cccd[_0x6501('0x37')],qs[_0x6501('0x3d')](_0x125883['query'][_0x6501('0x3d')]));_0x415066['attributes']=_0x415066['attributes'][_0x6501('0x3e')]?_0x415066[_0x6501('0x3c')]:_0x33cccd['model'];_0x415066[_0x6501('0x41')]=qs[_0x6501('0x42')](_0x125883[_0x6501('0x38')]['sort']);_0x415066['where']=qs[_0x6501('0x3a')](_[_0x6501('0x44')](_0x125883['query'],_0x33cccd['filters']));if(_0x125883[_0x6501('0x38')][_0x6501('0x45')]){_0x415066['where']=_['merge'](_0x415066['where'],{'$or':_[_0x6501('0x31')](_0x415066[_0x6501('0x3c')],function(_0x171756){var _0x1ecbe7={};_0x1ecbe7[_0x171756]={'$like':'%'+_0x125883[_0x6501('0x38')][_0x6501('0x45')]+'%'};return _0x1ecbe7;})});}_0x415066=_['merge']({},_0x415066,_0x125883['options']);return _0x48609f['getDescriptions'](_0x415066);}})[_0x6501('0x2a')](function(_0x8e2df2){if(_0x8e2df2){_0x9b6bdb=_0x8e2df2[_0x6501('0x3e')];if(!_0x125883[_0x6501('0x38')]['hasOwnProperty'](_0x6501('0x40'))){_0x415066['limit']=qs['limit'](_0x125883[_0x6501('0x38')][_0x6501('0x22')]);_0x415066[_0x6501('0x24')]=qs['offset'](_0x125883[_0x6501('0x38')][_0x6501('0x24')]);}return _0x48609f[_0x6501('0x55')](_0x415066);}})[_0x6501('0x2a')](function(_0x1f20aa){if(_0x1f20aa){return _0x1f20aa?{'count':_0x9b6bdb,'rows':_0x1f20aa}:null;}})[_0x6501('0x2a')](respondWithResult(_0x1df1e1,null))[_0x6501('0x4d')](handleError(_0x1df1e1,null));}; \ No newline at end of file +var _0x51f8=['error','stack','name','send','map','SugarcrmConfiguration','fieldName','key','model','filters','intersection','attributes','fields','hasOwnProperty','query','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','keys','length','include','find','create','body','update','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','nolimit','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x51f8,0xd3));var _0x851f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x51f8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x851f('0x0'));var zipdir=require(_0x851f('0x1'));var jsonpatch=require(_0x851f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x851f('0x3'));var Mustache=require(_0x851f('0x4'));var util=require(_0x851f('0x5'));var path=require(_0x851f('0x6'));var sox=require(_0x851f('0x7'));var csv=require(_0x851f('0x8'));var ejs=require(_0x851f('0x9'));var fs=require('fs');var fs_extra=require(_0x851f('0xa'));var _=require(_0x851f('0xb'));var squel=require(_0x851f('0xc'));var crypto=require(_0x851f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x851f('0xe'));var toCsv=require(_0x851f('0x8'));var querystring=require(_0x851f('0xf'));var Papa=require('papaparse');var Redis=require(_0x851f('0x10'));var authService=require(_0x851f('0x11'));var qs=require(_0x851f('0x12'));var as=require(_0x851f('0x13'));var hardwareService=require(_0x851f('0x14'));var logger=require(_0x851f('0x15'))(_0x851f('0x16'));var utils=require(_0x851f('0x17'));var config=require(_0x851f('0x18'));var licenseUtil=require(_0x851f('0x19'));var db=require(_0x851f('0x1a'))['db'];function respondWithStatusCode(_0x4c2de4,_0x559455){_0x559455=_0x559455||0xcc;return function(_0x29cb2a){if(_0x29cb2a){return _0x4c2de4[_0x851f('0x1b')](_0x559455);}return _0x4c2de4['status'](_0x559455)[_0x851f('0x1c')]();};}function respondWithResult(_0x16a62c,_0x2683d7){_0x2683d7=_0x2683d7||0xc8;return function(_0x23aebf){if(_0x23aebf){return _0x16a62c[_0x851f('0x1d')](_0x2683d7)[_0x851f('0x1e')](_0x23aebf);}};}function respondWithFilteredResult(_0x415e26,_0x13ac00){return function(_0x414374){if(_0x414374){var _0x2b31a5=typeof _0x13ac00[_0x851f('0x1f')]===_0x851f('0x20')&&typeof _0x13ac00['limit']==='undefined';var _0x90b8f2=_0x414374[_0x851f('0x21')];var _0x44884d=_0x2b31a5?0x0:_0x13ac00['offset'];var _0x5b9d27=_0x2b31a5?_0x414374[_0x851f('0x21')]:_0x13ac00['offset']+_0x13ac00[_0x851f('0x22')];var _0x242e93;if(_0x5b9d27>=_0x90b8f2){_0x5b9d27=_0x90b8f2;_0x242e93=0xc8;}else{_0x242e93=0xce;}_0x415e26[_0x851f('0x1d')](_0x242e93);return _0x415e26[_0x851f('0x23')](_0x851f('0x24'),_0x44884d+'-'+_0x5b9d27+'/'+_0x90b8f2)[_0x851f('0x1e')](_0x414374);}return null;};}function patchUpdates(_0x3423af){return function(_0xa96d4){try{jsonpatch['apply'](_0xa96d4,_0x3423af,!![]);}catch(_0x28f11d){return BPromise[_0x851f('0x25')](_0x28f11d);}return _0xa96d4[_0x851f('0x26')]();};}function saveUpdates(_0x5b30c7,_0x35d982){return function(_0x39dad6){if(_0x39dad6){return _0x39dad6['update'](_0x5b30c7)[_0x851f('0x27')](function(_0x27f74c){return _0x27f74c;});}return null;};}function removeEntity(_0x557b81,_0x38d1d4){return function(_0x3c96d8){if(_0x3c96d8){return _0x3c96d8[_0x851f('0x28')]()[_0x851f('0x27')](function(){_0x557b81[_0x851f('0x1d')](0xcc)[_0x851f('0x1c')]();});}};}function handleEntityNotFound(_0x5f2761,_0x24c2ca){return function(_0x1202fc){if(!_0x1202fc){_0x5f2761[_0x851f('0x1b')](0x194);}return _0x1202fc;};}function handleError(_0x1ac1ad,_0x5b73d2){_0x5b73d2=_0x5b73d2||0x1f4;return function(_0x1daf3a){logger[_0x851f('0x29')](_0x1daf3a[_0x851f('0x2a')]);if(_0x1daf3a[_0x851f('0x2b')]){delete _0x1daf3a[_0x851f('0x2b')];}_0x1ac1ad['status'](_0x5b73d2)[_0x851f('0x2c')](_0x1daf3a);};}exports['index']=function(_0x1e756b,_0x9f0080){var _0x5c59c2={},_0x40e98a={},_0x31cee0={'count':0x0,'rows':[]};var _0x3a215c=_[_0x851f('0x2d')](db[_0x851f('0x2e')]['rawAttributes'],function(_0x22806b){return{'name':_0x22806b[_0x851f('0x2f')],'type':_0x22806b['type'][_0x851f('0x30')]};});_0x40e98a[_0x851f('0x31')]=_[_0x851f('0x2d')](_0x3a215c,'name');_0x40e98a['query']=_['keys'](_0x1e756b['query']);_0x40e98a[_0x851f('0x32')]=_[_0x851f('0x33')](_0x40e98a[_0x851f('0x31')],_0x40e98a['query']);_0x5c59c2[_0x851f('0x34')]=_[_0x851f('0x33')](_0x40e98a[_0x851f('0x31')],qs['fields'](_0x1e756b['query'][_0x851f('0x35')]));_0x5c59c2[_0x851f('0x34')]=_0x5c59c2['attributes']['length']?_0x5c59c2[_0x851f('0x34')]:_0x40e98a[_0x851f('0x31')];if(!_0x1e756b['query'][_0x851f('0x36')]('nolimit')){_0x5c59c2[_0x851f('0x22')]=qs[_0x851f('0x22')](_0x1e756b[_0x851f('0x37')][_0x851f('0x22')]);_0x5c59c2['offset']=qs[_0x851f('0x1f')](_0x1e756b[_0x851f('0x37')][_0x851f('0x1f')]);}_0x5c59c2[_0x851f('0x38')]=qs[_0x851f('0x39')](_0x1e756b[_0x851f('0x37')][_0x851f('0x39')]);_0x5c59c2[_0x851f('0x3a')]=qs['filters'](_[_0x851f('0x3b')](_0x1e756b[_0x851f('0x37')],_0x40e98a[_0x851f('0x32')]),_0x3a215c);if(_0x1e756b[_0x851f('0x37')][_0x851f('0x3c')]){_0x5c59c2[_0x851f('0x3a')]=_['merge'](_0x5c59c2[_0x851f('0x3a')],{'$or':_[_0x851f('0x2d')](_0x3a215c,function(_0xf00f5d){if(_0xf00f5d[_0x851f('0x3d')]!==_0x851f('0x3e')){var _0x571f3c={};_0x571f3c[_0xf00f5d['name']]={'$like':'%'+_0x1e756b[_0x851f('0x37')][_0x851f('0x3c')]+'%'};return _0x571f3c;}})});}_0x5c59c2=_[_0x851f('0x3f')]({},_0x5c59c2,_0x1e756b[_0x851f('0x40')]);var _0x235833={'where':_0x5c59c2[_0x851f('0x3a')]};return db[_0x851f('0x2e')][_0x851f('0x21')](_0x235833)[_0x851f('0x27')](function(_0x57f545){_0x31cee0[_0x851f('0x21')]=_0x57f545;if(_0x1e756b[_0x851f('0x37')][_0x851f('0x41')]){_0x5c59c2['include']=[{'all':!![]}];}return db[_0x851f('0x2e')][_0x851f('0x42')](_0x5c59c2);})[_0x851f('0x27')](function(_0x4799da){_0x31cee0['rows']=_0x4799da;return _0x31cee0;})['then'](respondWithFilteredResult(_0x9f0080,_0x5c59c2))[_0x851f('0x43')](handleError(_0x9f0080,null));};exports[_0x851f('0x44')]=function(_0x2b3d9c,_0x1b079e){var _0x33ea6f={'raw':![],'where':{'id':_0x2b3d9c[_0x851f('0x45')]['id']}},_0x405308={};_0x405308[_0x851f('0x31')]=_['keys'](db[_0x851f('0x2e')][_0x851f('0x46')]);_0x405308['query']=_[_0x851f('0x47')](_0x2b3d9c[_0x851f('0x37')]);_0x405308[_0x851f('0x32')]=_[_0x851f('0x33')](_0x405308[_0x851f('0x31')],_0x405308['query']);_0x33ea6f['attributes']=_[_0x851f('0x33')](_0x405308[_0x851f('0x31')],qs[_0x851f('0x35')](_0x2b3d9c['query'][_0x851f('0x35')]));_0x33ea6f['attributes']=_0x33ea6f['attributes'][_0x851f('0x48')]?_0x33ea6f[_0x851f('0x34')]:_0x405308['model'];if(_0x2b3d9c[_0x851f('0x37')]['includeAll']){_0x33ea6f[_0x851f('0x49')]=[{'all':!![]}];}_0x33ea6f=_[_0x851f('0x3f')]({},_0x33ea6f,_0x2b3d9c[_0x851f('0x40')]);return db[_0x851f('0x2e')][_0x851f('0x4a')](_0x33ea6f)[_0x851f('0x27')](handleEntityNotFound(_0x1b079e,null))[_0x851f('0x27')](respondWithResult(_0x1b079e,null))[_0x851f('0x43')](handleError(_0x1b079e,null));};exports[_0x851f('0x4b')]=function(_0x132cab,_0x4c8643){return db[_0x851f('0x2e')][_0x851f('0x4b')](_0x132cab[_0x851f('0x4c')],{})[_0x851f('0x27')](respondWithResult(_0x4c8643,0xc9))['catch'](handleError(_0x4c8643,null));};exports[_0x851f('0x4d')]=function(_0x176d33,_0x495188){if(_0x176d33[_0x851f('0x4c')]['id']){delete _0x176d33[_0x851f('0x4c')]['id'];}return db[_0x851f('0x2e')]['find']({'where':{'id':_0x176d33[_0x851f('0x45')]['id']}})[_0x851f('0x27')](handleEntityNotFound(_0x495188,null))[_0x851f('0x27')](saveUpdates(_0x176d33['body'],null))[_0x851f('0x27')](respondWithResult(_0x495188,null))[_0x851f('0x43')](handleError(_0x495188,null));};exports[_0x851f('0x28')]=function(_0x344fc8,_0x44fe06){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x344fc8[_0x851f('0x45')]['id']}})['then'](handleEntityNotFound(_0x44fe06,null))['then'](removeEntity(_0x44fe06,null))[_0x851f('0x43')](handleError(_0x44fe06,null));};exports[_0x851f('0x4e')]=function(_0x58005b,_0x5d40cd,_0x1071ca){var _0x17a3bc={};var _0x5d67f4={};var _0x11ae27;var _0x3c1dc0;return db[_0x851f('0x2e')]['findOne']({'where':{'id':_0x58005b[_0x851f('0x45')]['id']}})[_0x851f('0x27')](handleEntityNotFound(_0x5d40cd,null))[_0x851f('0x27')](function(_0x47f988){if(_0x47f988){_0x11ae27=_0x47f988;_0x5d67f4[_0x851f('0x31')]=_[_0x851f('0x47')](db[_0x851f('0x4f')][_0x851f('0x46')]);_0x5d67f4[_0x851f('0x37')]=_[_0x851f('0x47')](_0x58005b['query']);_0x5d67f4[_0x851f('0x32')]=_[_0x851f('0x33')](_0x5d67f4[_0x851f('0x31')],_0x5d67f4['query']);_0x17a3bc[_0x851f('0x34')]=_[_0x851f('0x33')](_0x5d67f4[_0x851f('0x31')],qs[_0x851f('0x35')](_0x58005b['query'][_0x851f('0x35')]));_0x17a3bc[_0x851f('0x34')]=_0x17a3bc[_0x851f('0x34')][_0x851f('0x48')]?_0x17a3bc[_0x851f('0x34')]:_0x5d67f4['model'];_0x17a3bc['order']=qs[_0x851f('0x39')](_0x58005b[_0x851f('0x37')][_0x851f('0x39')]);_0x17a3bc[_0x851f('0x3a')]=qs[_0x851f('0x32')](_['pick'](_0x58005b[_0x851f('0x37')],_0x5d67f4['filters']));if(_0x58005b[_0x851f('0x37')]['filter']){_0x17a3bc[_0x851f('0x3a')]=_['merge'](_0x17a3bc[_0x851f('0x3a')],{'$or':_[_0x851f('0x2d')](_0x17a3bc['attributes'],function(_0x10c372){var _0x9243a={};_0x9243a[_0x10c372]={'$like':'%'+_0x58005b[_0x851f('0x37')]['filter']+'%'};return _0x9243a;})});}_0x17a3bc=_[_0x851f('0x3f')]({},_0x17a3bc,_0x58005b[_0x851f('0x40')]);return _0x11ae27[_0x851f('0x4e')](_0x17a3bc);}})[_0x851f('0x27')](function(_0x260943){if(_0x260943){_0x3c1dc0=_0x260943[_0x851f('0x48')];if(!_0x58005b['query'][_0x851f('0x36')]('nolimit')){_0x17a3bc[_0x851f('0x22')]=qs['limit'](_0x58005b[_0x851f('0x37')][_0x851f('0x22')]);_0x17a3bc[_0x851f('0x1f')]=qs['offset'](_0x58005b[_0x851f('0x37')][_0x851f('0x1f')]);}return _0x11ae27[_0x851f('0x4e')](_0x17a3bc);}})[_0x851f('0x27')](function(_0x312215){if(_0x312215){return _0x312215?{'count':_0x3c1dc0,'rows':_0x312215}:null;}})[_0x851f('0x27')](respondWithResult(_0x5d40cd,null))[_0x851f('0x43')](handleError(_0x5d40cd,null));};exports[_0x851f('0x50')]=function(_0xcc2a8f,_0x2e5abb,_0x1db90f){var _0x367f83={};var _0x313e7b={};var _0x4bb229;var _0x37c7eb;return db[_0x851f('0x2e')][_0x851f('0x51')]({'where':{'id':_0xcc2a8f[_0x851f('0x45')]['id']}})[_0x851f('0x27')](handleEntityNotFound(_0x2e5abb,null))[_0x851f('0x27')](function(_0x3f3a7b){if(_0x3f3a7b){_0x4bb229=_0x3f3a7b;_0x313e7b[_0x851f('0x31')]=_[_0x851f('0x47')](db['SugarcrmField'][_0x851f('0x46')]);_0x313e7b[_0x851f('0x37')]=_[_0x851f('0x47')](_0xcc2a8f['query']);_0x313e7b['filters']=_[_0x851f('0x33')](_0x313e7b['model'],_0x313e7b[_0x851f('0x37')]);_0x367f83['attributes']=_[_0x851f('0x33')](_0x313e7b[_0x851f('0x31')],qs[_0x851f('0x35')](_0xcc2a8f[_0x851f('0x37')][_0x851f('0x35')]));_0x367f83[_0x851f('0x34')]=_0x367f83[_0x851f('0x34')][_0x851f('0x48')]?_0x367f83['attributes']:_0x313e7b['model'];_0x367f83['order']=qs[_0x851f('0x39')](_0xcc2a8f[_0x851f('0x37')][_0x851f('0x39')]);_0x367f83['where']=qs[_0x851f('0x32')](_['pick'](_0xcc2a8f[_0x851f('0x37')],_0x313e7b['filters']));if(_0xcc2a8f[_0x851f('0x37')][_0x851f('0x3c')]){_0x367f83[_0x851f('0x3a')]=_[_0x851f('0x3f')](_0x367f83[_0x851f('0x3a')],{'$or':_[_0x851f('0x2d')](_0x367f83[_0x851f('0x34')],function(_0x5cf9f1){var _0x110f67={};_0x110f67[_0x5cf9f1]={'$like':'%'+_0xcc2a8f[_0x851f('0x37')][_0x851f('0x3c')]+'%'};return _0x110f67;})});}_0x367f83=_[_0x851f('0x3f')]({},_0x367f83,_0xcc2a8f[_0x851f('0x40')]);return _0x4bb229['getSubjects'](_0x367f83);}})[_0x851f('0x27')](function(_0x420724){if(_0x420724){_0x37c7eb=_0x420724['length'];if(!_0xcc2a8f['query'][_0x851f('0x36')]('nolimit')){_0x367f83[_0x851f('0x22')]=qs[_0x851f('0x22')](_0xcc2a8f['query'][_0x851f('0x22')]);_0x367f83['offset']=qs[_0x851f('0x1f')](_0xcc2a8f[_0x851f('0x37')][_0x851f('0x1f')]);}return _0x4bb229[_0x851f('0x50')](_0x367f83);}})[_0x851f('0x27')](function(_0x377e10){if(_0x377e10){return _0x377e10?{'count':_0x37c7eb,'rows':_0x377e10}:null;}})[_0x851f('0x27')](respondWithResult(_0x2e5abb,null))[_0x851f('0x43')](handleError(_0x2e5abb,null));};exports[_0x851f('0x52')]=function(_0x1f31e5,_0xa2a1b1,_0x4f0a04){var _0x51139e={};var _0x254d98={};var _0x5988db;var _0x363421;return db[_0x851f('0x2e')][_0x851f('0x51')]({'where':{'id':_0x1f31e5[_0x851f('0x45')]['id']}})[_0x851f('0x27')](handleEntityNotFound(_0xa2a1b1,null))['then'](function(_0x2e868e){if(_0x2e868e){_0x5988db=_0x2e868e;_0x254d98['model']=_[_0x851f('0x47')](db[_0x851f('0x4f')][_0x851f('0x46')]);_0x254d98[_0x851f('0x37')]=_['keys'](_0x1f31e5[_0x851f('0x37')]);_0x254d98[_0x851f('0x32')]=_['intersection'](_0x254d98['model'],_0x254d98['query']);_0x51139e['attributes']=_[_0x851f('0x33')](_0x254d98['model'],qs[_0x851f('0x35')](_0x1f31e5[_0x851f('0x37')][_0x851f('0x35')]));_0x51139e[_0x851f('0x34')]=_0x51139e[_0x851f('0x34')]['length']?_0x51139e[_0x851f('0x34')]:_0x254d98['model'];_0x51139e[_0x851f('0x38')]=qs[_0x851f('0x39')](_0x1f31e5[_0x851f('0x37')][_0x851f('0x39')]);_0x51139e[_0x851f('0x3a')]=qs['filters'](_[_0x851f('0x3b')](_0x1f31e5[_0x851f('0x37')],_0x254d98[_0x851f('0x32')]));if(_0x1f31e5[_0x851f('0x37')][_0x851f('0x3c')]){_0x51139e[_0x851f('0x3a')]=_['merge'](_0x51139e[_0x851f('0x3a')],{'$or':_[_0x851f('0x2d')](_0x51139e['attributes'],function(_0x585e70){var _0x4671a0={};_0x4671a0[_0x585e70]={'$like':'%'+_0x1f31e5[_0x851f('0x37')][_0x851f('0x3c')]+'%'};return _0x4671a0;})});}_0x51139e=_[_0x851f('0x3f')]({},_0x51139e,_0x1f31e5[_0x851f('0x40')]);return _0x5988db[_0x851f('0x52')](_0x51139e);}})['then'](function(_0x47cbe1){if(_0x47cbe1){_0x363421=_0x47cbe1[_0x851f('0x48')];if(!_0x1f31e5[_0x851f('0x37')][_0x851f('0x36')](_0x851f('0x53'))){_0x51139e['limit']=qs[_0x851f('0x22')](_0x1f31e5[_0x851f('0x37')]['limit']);_0x51139e[_0x851f('0x1f')]=qs['offset'](_0x1f31e5[_0x851f('0x37')][_0x851f('0x1f')]);}return _0x5988db[_0x851f('0x52')](_0x51139e);}})['then'](function(_0x195105){if(_0x195105){return _0x195105?{'count':_0x363421,'rows':_0x195105}:null;}})['then'](respondWithResult(_0xa2a1b1,null))[_0x851f('0x43')](handleError(_0xa2a1b1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7451b66..505d0d4 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 _0xbeeb=['path','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','bluebird'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0xbeeb,0x1c8));var _0xbbee=function(_0x240744,_0x5e0c7e){_0x240744=_0x240744-0x0;var _0x1a0e81=_0xbeeb[_0x240744];return _0x1a0e81;};'use strict';var _=require('lodash');var util=require(_0xbbee('0x0'));var logger=require(_0xbbee('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbbee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbee('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbee('0x4'));module[_0xbbee('0x5')]=function(_0x337e42,_0x2d9a87){return _0x337e42[_0xbbee('0x6')](_0xbbee('0x7'),attributes,{'tableName':_0xbbee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5dc=['../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x30d4c3,_0x35136d){var _0x7c7dad=function(_0x326fb0){while(--_0x326fb0){_0x30d4c3['push'](_0x30d4c3['shift']());}};_0x7c7dad(++_0x35136d);}(_0xb5dc,0x18a));var _0xcb5d=function(_0x302b10,_0x3439f7){_0x302b10=_0x302b10-0x0;var _0x1506cc=_0xb5dc[_0x302b10];return _0x1506cc;};'use strict';var _=require('lodash');var util=require(_0xcb5d('0x0'));var logger=require(_0xcb5d('0x1'))(_0xcb5d('0x2'));var moment=require(_0xcb5d('0x3'));var BPromise=require('bluebird');var rp=require(_0xcb5d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb5d('0x5'));var config=require(_0xcb5d('0x6'));var attributes=require(_0xcb5d('0x7'));module['exports']=function(_0xcf096,_0x4abd9d){return _0xcf096[_0xcb5d('0x8')](_0xcb5d('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','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 71aa7ed..586287b 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 _0x5179=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0x5179,0xdc));var _0x9517=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x5179[_0x44c768];return _0x55daf5;};'use strict';var _=require(_0x9517('0x0'));var util=require('util');var moment=require(_0x9517('0x1'));var BPromise=require(_0x9517('0x2'));var rs=require(_0x9517('0x3'));var fs=require('fs');var Redis=require(_0x9517('0x4'));var db=require(_0x9517('0x5'))['db'];var utils=require(_0x9517('0x6'));var logger=require(_0x9517('0x7'))(_0x9517('0x8'));var config=require(_0x9517('0x9'));var jayson=require(_0x9517('0xa'));var client=jayson[_0x9517('0xb')][_0x9517('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x148935,_0x1c2cea,_0x283973){return new BPromise(function(_0x4a5588,_0x592db2){return client[_0x9517('0xd')](_0x148935,_0x283973)[_0x9517('0xe')](function(_0x51ff24){logger[_0x9517('0xf')](_0x9517('0x10'),_0x1c2cea,_0x9517('0x11'));logger[_0x9517('0x12')](_0x9517('0x13'),_0x1c2cea,_0x9517('0x11'),JSON[_0x9517('0x14')](_0x51ff24));if(_0x51ff24[_0x9517('0x15')]){if(_0x51ff24['error'][_0x9517('0x16')]===0x1f4){logger[_0x9517('0x15')](_0x9517('0x10'),_0x1c2cea,_0x51ff24[_0x9517('0x15')][_0x9517('0x17')]);return _0x592db2(_0x51ff24[_0x9517('0x15')]['message']);}logger[_0x9517('0x15')](_0x9517('0x10'),_0x1c2cea,_0x51ff24[_0x9517('0x15')]['message']);return _0x4a5588(_0x51ff24[_0x9517('0x15')][_0x9517('0x17')]);}else{logger[_0x9517('0xf')](_0x9517('0x10'),_0x1c2cea,_0x9517('0x11'));_0x4a5588(_0x51ff24[_0x9517('0x18')][_0x9517('0x17')]);}})['catch'](function(_0x28c683){logger[_0x9517('0x15')](_0x9517('0x10'),_0x1c2cea,_0x28c683);_0x592db2(_0x28c683);});});} \ No newline at end of file +var _0x70ed=['info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x56d3f7,_0x2dcec8){var _0x288519=function(_0x43a3bd){while(--_0x43a3bd){_0x56d3f7['push'](_0x56d3f7['shift']());}};_0x288519(++_0x2dcec8);}(_0x70ed,0xa0));var _0xd70e=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x70ed[_0x2a238a];return _0xeef802;};'use strict';var _=require('lodash');var util=require(_0xd70e('0x0'));var moment=require(_0xd70e('0x1'));var BPromise=require('bluebird');var rs=require(_0xd70e('0x2'));var fs=require('fs');var Redis=require(_0xd70e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd70e('0x4'))(_0xd70e('0x5'));var config=require('../../config/environment');var jayson=require(_0xd70e('0x6'));var client=jayson[_0xd70e('0x7')][_0xd70e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2789a9,_0x28ef08,_0x2e7260){return new BPromise(function(_0x2d6d59,_0x5e6403){return client[_0xd70e('0x9')](_0x2789a9,_0x2e7260)[_0xd70e('0xa')](function(_0x350c19){logger[_0xd70e('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28ef08,_0xd70e('0xc'));logger[_0xd70e('0xd')](_0xd70e('0xe'),_0x28ef08,_0xd70e('0xc'),JSON['stringify'](_0x350c19));if(_0x350c19[_0xd70e('0xf')]){if(_0x350c19[_0xd70e('0xf')]['code']===0x1f4){logger[_0xd70e('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28ef08,_0x350c19['error']['message']);return _0x5e6403(_0x350c19['error']['message']);}logger[_0xd70e('0xf')](_0xd70e('0x10'),_0x28ef08,_0x350c19[_0xd70e('0xf')][_0xd70e('0x11')]);return _0x2d6d59(_0x350c19[_0xd70e('0xf')]['message']);}else{logger[_0xd70e('0xb')](_0xd70e('0x10'),_0x28ef08,_0xd70e('0xc'));_0x2d6d59(_0x350c19[_0xd70e('0x12')][_0xd70e('0x11')]);}})['catch'](function(_0x1ce9d9){logger['error'](_0xd70e('0x10'),_0x28ef08,_0x1ce9d9);_0x5e6403(_0x1ce9d9);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 47e1d92..cfb4297 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 _0x76b6=['create','put','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','post'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x76b6,0x17a));var _0x676b=function(_0x550941,_0x1747f0){_0x550941=_0x550941-0x0;var _0x24ead8=_0x76b6[_0x550941];return _0x24ead8;};'use strict';var multer=require(_0x676b('0x0'));var util=require(_0x676b('0x1'));var path=require('path');var timeout=require(_0x676b('0x2'));var express=require(_0x676b('0x3'));var router=express[_0x676b('0x4')]();var fs_extra=require(_0x676b('0x5'));var auth=require(_0x676b('0x6'));var interaction=require(_0x676b('0x7'));var config=require(_0x676b('0x8'));var controller=require(_0x676b('0x9'));router[_0x676b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x676b('0xa')]('/:id',auth[_0x676b('0xb')](),controller['show']);router[_0x676b('0xc')]('/',auth['isAuthenticated'](),controller[_0x676b('0xd')]);router[_0x676b('0xe')](_0x676b('0xf'),auth[_0x676b('0xb')](),controller['update']);router['delete'](_0x676b('0xf'),auth[_0x676b('0xb')](),controller['destroy']);module[_0x676b('0x10')]=router; \ No newline at end of file +var _0x89c2=['index','show','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x1383af,_0x29d2c3){var _0xbc03df=function(_0x2cf5cf){while(--_0x2cf5cf){_0x1383af['push'](_0x1383af['shift']());}};_0xbc03df(++_0x29d2c3);}(_0x89c2,0x1e4));var _0x289c=function(_0x339998,_0x11b727){_0x339998=_0x339998-0x0;var _0x1074b5=_0x89c2[_0x339998];return _0x1074b5;};'use strict';var multer=require(_0x289c('0x0'));var util=require('util');var path=require(_0x289c('0x1'));var timeout=require('connect-timeout');var express=require(_0x289c('0x2'));var router=express[_0x289c('0x3')]();var fs_extra=require(_0x289c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x289c('0x5'));var config=require('../../config/environment');var controller=require(_0x289c('0x6'));router[_0x289c('0x7')]('/',auth[_0x289c('0x8')](),controller[_0x289c('0x9')]);router['get']('/:id',auth[_0x289c('0x8')](),controller[_0x289c('0xa')]);router['post']('/',auth[_0x289c('0x8')](),controller['create']);router[_0x289c('0xb')](_0x289c('0xc'),auth[_0x289c('0x8')](),controller[_0x289c('0xd')]);router[_0x289c('0xe')](_0x289c('0xc'),auth[_0x289c('0x8')](),controller[_0x289c('0xf')]);module[_0x289c('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 1f38b5d..15f53c2 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 _0x2599=['keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable'];(function(_0x4507a3,_0x257908){var _0x59956c=function(_0x13f9da){while(--_0x13f9da){_0x4507a3['push'](_0x4507a3['shift']());}};_0x59956c(++_0x257908);}(_0x2599,0x1ac));var _0x9259=function(_0x288a40,_0x33ee7c){_0x288a40=_0x288a40-0x0;var _0x3f04f5=_0x2599[_0x288a40];return _0x3f04f5;};'use strict';var Sequelize=require(_0x9259('0x0'));module['exports']={'type':{'type':Sequelize[_0x9259('0x1')](_0x9259('0x2'),'variable',_0x9259('0x3'),_0x9259('0x4'),_0x9259('0x5')),'defaultValue':_0x9259('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9259('0x6')]},'keyType':{'type':Sequelize[_0x9259('0x1')]('string',_0x9259('0x7'),_0x9259('0x3'))},'keyContent':{'type':Sequelize[_0x9259('0x6')]},'idField':{'type':Sequelize[_0x9259('0x6')]},'nameField':{'type':Sequelize[_0x9259('0x6')]},'customField':{'type':Sequelize[_0x9259('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c92=['picklist','string','STRING','exports','variable','customVariable','keyValue'];(function(_0x52b029,_0x3dee85){var _0x41d375=function(_0x4ee5eb){while(--_0x4ee5eb){_0x52b029['push'](_0x52b029['shift']());}};_0x41d375(++_0x3dee85);}(_0x0c92,0x1d8));var _0x20c9=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x0c92[_0x49a57c];return _0x4e0316;};'use strict';var Sequelize=require('sequelize');module[_0x20c9('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x20c9('0x1'),_0x20c9('0x2'),_0x20c9('0x3'),_0x20c9('0x4')),'defaultValue':_0x20c9('0x5')},'content':{'type':Sequelize[_0x20c9('0x6')]},'key':{'type':Sequelize[_0x20c9('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x20c9('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x20c9('0x6')]},'idField':{'type':Sequelize[_0x20c9('0x6')]},'nameField':{'type':Sequelize[_0x20c9('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20c9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a9edb0c..2c5ef22 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 _0xb382=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','SugarcrmField','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','params','keys','find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0xb382,0x8c));var _0x2b38=function(_0x25047d,_0x5dd432){_0x25047d=_0x25047d-0x0;var _0x276f49=_0xb382[_0x25047d];return _0x276f49;};'use strict';var emlformat=require(_0x2b38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b38('0x1'));var jsonpatch=require(_0x2b38('0x2'));var rp=require(_0x2b38('0x3'));var moment=require(_0x2b38('0x4'));var BPromise=require(_0x2b38('0x5'));var Mustache=require(_0x2b38('0x6'));var util=require('util');var path=require(_0x2b38('0x7'));var sox=require(_0x2b38('0x8'));var csv=require(_0x2b38('0x9'));var ejs=require(_0x2b38('0xa'));var fs=require('fs');var fs_extra=require(_0x2b38('0xb'));var _=require(_0x2b38('0xc'));var squel=require('squel');var crypto=require(_0x2b38('0xd'));var jsforce=require(_0x2b38('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2b38('0x9'));var querystring=require('querystring');var Papa=require(_0x2b38('0xf'));var Redis=require(_0x2b38('0x10'));var authService=require(_0x2b38('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b38('0x12'));var logger=require(_0x2b38('0x13'))(_0x2b38('0x14'));var utils=require('../../config/utils');var config=require(_0x2b38('0x15'));var licenseUtil=require(_0x2b38('0x16'));var db=require(_0x2b38('0x17'))['db'];function respondWithStatusCode(_0xa2f2c1,_0x3b6a16){_0x3b6a16=_0x3b6a16||0xcc;return function(_0x275814){if(_0x275814){return _0xa2f2c1[_0x2b38('0x18')](_0x3b6a16);}return _0xa2f2c1['status'](_0x3b6a16)[_0x2b38('0x19')]();};}function respondWithResult(_0x2887ef,_0x243e2f){_0x243e2f=_0x243e2f||0xc8;return function(_0x3da4c3){if(_0x3da4c3){return _0x2887ef[_0x2b38('0x1a')](_0x243e2f)[_0x2b38('0x1b')](_0x3da4c3);}};}function respondWithFilteredResult(_0x342581,_0x370388){return function(_0x538b4f){if(_0x538b4f){var _0x414232=typeof _0x370388[_0x2b38('0x1c')]===_0x2b38('0x1d')&&typeof _0x370388[_0x2b38('0x1e')]===_0x2b38('0x1d');var _0x30560c=_0x538b4f[_0x2b38('0x1f')];var _0xbca841=_0x414232?0x0:_0x370388['offset'];var _0x3721ff=_0x414232?_0x538b4f[_0x2b38('0x1f')]:_0x370388['offset']+_0x370388['limit'];var _0x493dd2;if(_0x3721ff>=_0x30560c){_0x3721ff=_0x30560c;_0x493dd2=0xc8;}else{_0x493dd2=0xce;}_0x342581[_0x2b38('0x1a')](_0x493dd2);return _0x342581[_0x2b38('0x20')](_0x2b38('0x21'),_0xbca841+'-'+_0x3721ff+'/'+_0x30560c)[_0x2b38('0x1b')](_0x538b4f);}return null;};}function patchUpdates(_0xb04c64){return function(_0x409827){try{jsonpatch[_0x2b38('0x22')](_0x409827,_0xb04c64,!![]);}catch(_0x210c3c){return BPromise[_0x2b38('0x23')](_0x210c3c);}return _0x409827[_0x2b38('0x24')]();};}function saveUpdates(_0x5c3a1b,_0x334434){return function(_0x3018fa){if(_0x3018fa){return _0x3018fa['update'](_0x5c3a1b)[_0x2b38('0x25')](function(_0x13c8f4){return _0x13c8f4;});}return null;};}function removeEntity(_0x3831c8,_0x4335a8){return function(_0x20646f){if(_0x20646f){return _0x20646f[_0x2b38('0x26')]()[_0x2b38('0x25')](function(){_0x3831c8['status'](0xcc)[_0x2b38('0x19')]();});}};}function handleEntityNotFound(_0x3452a6,_0x4160ae){return function(_0x2363a1){if(!_0x2363a1){_0x3452a6[_0x2b38('0x18')](0x194);}return _0x2363a1;};}function handleError(_0x30dcbe,_0x5af7f2){_0x5af7f2=_0x5af7f2||0x1f4;return function(_0x444ca4){logger['error'](_0x444ca4[_0x2b38('0x27')]);if(_0x444ca4[_0x2b38('0x28')]){delete _0x444ca4['name'];}_0x30dcbe['status'](_0x5af7f2)[_0x2b38('0x29')](_0x444ca4);};}exports['index']=function(_0x41405d,_0x491f9a){var _0x5e6a31={},_0x5cd87a={},_0x12f523={'count':0x0,'rows':[]};var _0xb7afeb=_['map'](db[_0x2b38('0x2a')][_0x2b38('0x2b')],function(_0x4e7454){return{'name':_0x4e7454[_0x2b38('0x2c')],'type':_0x4e7454[_0x2b38('0x2d')][_0x2b38('0x2e')]};});_0x5cd87a['model']=_[_0x2b38('0x2f')](_0xb7afeb,'name');_0x5cd87a[_0x2b38('0x30')]=_['keys'](_0x41405d[_0x2b38('0x30')]);_0x5cd87a['filters']=_[_0x2b38('0x31')](_0x5cd87a[_0x2b38('0x32')],_0x5cd87a[_0x2b38('0x30')]);_0x5e6a31[_0x2b38('0x33')]=_[_0x2b38('0x31')](_0x5cd87a[_0x2b38('0x32')],qs[_0x2b38('0x34')](_0x41405d[_0x2b38('0x30')][_0x2b38('0x34')]));_0x5e6a31['attributes']=_0x5e6a31[_0x2b38('0x33')][_0x2b38('0x35')]?_0x5e6a31[_0x2b38('0x33')]:_0x5cd87a[_0x2b38('0x32')];if(!_0x41405d[_0x2b38('0x30')][_0x2b38('0x36')](_0x2b38('0x37'))){_0x5e6a31[_0x2b38('0x1e')]=qs[_0x2b38('0x1e')](_0x41405d[_0x2b38('0x30')][_0x2b38('0x1e')]);_0x5e6a31['offset']=qs['offset'](_0x41405d[_0x2b38('0x30')][_0x2b38('0x1c')]);}_0x5e6a31[_0x2b38('0x38')]=qs[_0x2b38('0x39')](_0x41405d[_0x2b38('0x30')]['sort']);_0x5e6a31[_0x2b38('0x3a')]=qs[_0x2b38('0x3b')](_[_0x2b38('0x3c')](_0x41405d[_0x2b38('0x30')],_0x5cd87a[_0x2b38('0x3b')]),_0xb7afeb);if(_0x41405d['query']['filter']){_0x5e6a31[_0x2b38('0x3a')]=_[_0x2b38('0x3d')](_0x5e6a31['where'],{'$or':_[_0x2b38('0x2f')](_0xb7afeb,function(_0xc207cb){if(_0xc207cb[_0x2b38('0x2d')]!=='VIRTUAL'){var _0x56c16a={};_0x56c16a[_0xc207cb['name']]={'$like':'%'+_0x41405d['query'][_0x2b38('0x3e')]+'%'};return _0x56c16a;}})});}_0x5e6a31=_[_0x2b38('0x3d')]({},_0x5e6a31,_0x41405d[_0x2b38('0x3f')]);var _0x329091={'where':_0x5e6a31[_0x2b38('0x3a')]};return db[_0x2b38('0x2a')][_0x2b38('0x1f')](_0x329091)['then'](function(_0x515920){_0x12f523[_0x2b38('0x1f')]=_0x515920;if(_0x41405d[_0x2b38('0x30')][_0x2b38('0x40')]){_0x5e6a31[_0x2b38('0x41')]=[{'all':!![]}];}return db[_0x2b38('0x2a')][_0x2b38('0x42')](_0x5e6a31);})[_0x2b38('0x25')](function(_0x14d1fe){_0x12f523['rows']=_0x14d1fe;return _0x12f523;})['then'](respondWithFilteredResult(_0x491f9a,_0x5e6a31))[_0x2b38('0x43')](handleError(_0x491f9a,null));};exports['show']=function(_0xf19870,_0x55a8d9){var _0x4f8f3={'raw':!![],'where':{'id':_0xf19870[_0x2b38('0x44')]['id']}},_0x461564={};_0x461564['model']=_[_0x2b38('0x45')](db[_0x2b38('0x2a')][_0x2b38('0x2b')]);_0x461564[_0x2b38('0x30')]=_['keys'](_0xf19870[_0x2b38('0x30')]);_0x461564[_0x2b38('0x3b')]=_[_0x2b38('0x31')](_0x461564[_0x2b38('0x32')],_0x461564[_0x2b38('0x30')]);_0x4f8f3[_0x2b38('0x33')]=_[_0x2b38('0x31')](_0x461564[_0x2b38('0x32')],qs[_0x2b38('0x34')](_0xf19870[_0x2b38('0x30')][_0x2b38('0x34')]));_0x4f8f3[_0x2b38('0x33')]=_0x4f8f3[_0x2b38('0x33')][_0x2b38('0x35')]?_0x4f8f3[_0x2b38('0x33')]:_0x461564[_0x2b38('0x32')];if(_0xf19870[_0x2b38('0x30')][_0x2b38('0x40')]){_0x4f8f3[_0x2b38('0x41')]=[{'all':!![]}];}_0x4f8f3=_[_0x2b38('0x3d')]({},_0x4f8f3,_0xf19870[_0x2b38('0x3f')]);return db[_0x2b38('0x2a')][_0x2b38('0x46')](_0x4f8f3)[_0x2b38('0x25')](handleEntityNotFound(_0x55a8d9,null))[_0x2b38('0x25')](respondWithResult(_0x55a8d9,null))[_0x2b38('0x43')](handleError(_0x55a8d9,null));};exports['create']=function(_0x4cdb09,_0x36c829){return db[_0x2b38('0x2a')][_0x2b38('0x47')](_0x4cdb09['body'],{})['then'](respondWithResult(_0x36c829,0xc9))[_0x2b38('0x43')](handleError(_0x36c829,null));};exports[_0x2b38('0x48')]=function(_0x2f5013,_0x3261db){if(_0x2f5013[_0x2b38('0x49')]['id']){delete _0x2f5013[_0x2b38('0x49')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x2f5013[_0x2b38('0x44')]['id']}})['then'](handleEntityNotFound(_0x3261db,null))[_0x2b38('0x25')](saveUpdates(_0x2f5013['body'],null))[_0x2b38('0x25')](respondWithResult(_0x3261db,null))[_0x2b38('0x43')](handleError(_0x3261db,null));};exports[_0x2b38('0x26')]=function(_0x5dabe2,_0x5cc4f5){return db['SugarcrmField'][_0x2b38('0x46')]({'where':{'id':_0x5dabe2['params']['id']}})['then'](handleEntityNotFound(_0x5cc4f5,null))[_0x2b38('0x25')](removeEntity(_0x5cc4f5,null))[_0x2b38('0x43')](handleError(_0x5cc4f5,null));}; \ No newline at end of file +var _0x84d0=['params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','SugarcrmField','includeAll','include','catch'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x84d0,0x9c));var _0x084d=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x84d0[_0x58dc25];return _0x21b0a7;};'use strict';var emlformat=require(_0x084d('0x0'));var rimraf=require(_0x084d('0x1'));var zipdir=require(_0x084d('0x2'));var jsonpatch=require(_0x084d('0x3'));var rp=require(_0x084d('0x4'));var moment=require(_0x084d('0x5'));var BPromise=require(_0x084d('0x6'));var Mustache=require(_0x084d('0x7'));var util=require(_0x084d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x084d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x084d('0xa'));var _=require(_0x084d('0xb'));var squel=require(_0x084d('0xc'));var crypto=require(_0x084d('0xd'));var jsforce=require(_0x084d('0xe'));var deskjs=require(_0x084d('0xf'));var toCsv=require(_0x084d('0x9'));var querystring=require(_0x084d('0x10'));var Papa=require(_0x084d('0x11'));var Redis=require('ioredis');var authService=require(_0x084d('0x12'));var qs=require(_0x084d('0x13'));var as=require(_0x084d('0x14'));var hardwareService=require(_0x084d('0x15'));var logger=require(_0x084d('0x16'))(_0x084d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x084d('0x18'));var db=require(_0x084d('0x19'))['db'];function respondWithStatusCode(_0x517c51,_0x444903){_0x444903=_0x444903||0xcc;return function(_0x1945da){if(_0x1945da){return _0x517c51['sendStatus'](_0x444903);}return _0x517c51['status'](_0x444903)[_0x084d('0x1a')]();};}function respondWithResult(_0x5a2a57,_0x5ad738){_0x5ad738=_0x5ad738||0xc8;return function(_0xcfa748){if(_0xcfa748){return _0x5a2a57[_0x084d('0x1b')](_0x5ad738)[_0x084d('0x1c')](_0xcfa748);}};}function respondWithFilteredResult(_0xe4c116,_0x31db1f){return function(_0x55742c){if(_0x55742c){var _0x4eeab0=typeof _0x31db1f['offset']===_0x084d('0x1d')&&typeof _0x31db1f['limit']===_0x084d('0x1d');var _0x8e1c9=_0x55742c['count'];var _0x58e2da=_0x4eeab0?0x0:_0x31db1f[_0x084d('0x1e')];var _0x227820=_0x4eeab0?_0x55742c[_0x084d('0x1f')]:_0x31db1f[_0x084d('0x1e')]+_0x31db1f[_0x084d('0x20')];var _0x4c2a89;if(_0x227820>=_0x8e1c9){_0x227820=_0x8e1c9;_0x4c2a89=0xc8;}else{_0x4c2a89=0xce;}_0xe4c116['status'](_0x4c2a89);return _0xe4c116['set'](_0x084d('0x21'),_0x58e2da+'-'+_0x227820+'/'+_0x8e1c9)[_0x084d('0x1c')](_0x55742c);}return null;};}function patchUpdates(_0x1e2f1d){return function(_0x1a6710){try{jsonpatch[_0x084d('0x22')](_0x1a6710,_0x1e2f1d,!![]);}catch(_0x3ba1a8){return BPromise[_0x084d('0x23')](_0x3ba1a8);}return _0x1a6710[_0x084d('0x24')]();};}function saveUpdates(_0x253bba,_0x458d4f){return function(_0x58857d){if(_0x58857d){return _0x58857d[_0x084d('0x25')](_0x253bba)['then'](function(_0x1def31){return _0x1def31;});}return null;};}function removeEntity(_0x2492f1,_0x2ca33b){return function(_0x3e1d67){if(_0x3e1d67){return _0x3e1d67['destroy']()[_0x084d('0x26')](function(){_0x2492f1[_0x084d('0x1b')](0xcc)[_0x084d('0x1a')]();});}};}function handleEntityNotFound(_0x1251f7,_0x171eba){return function(_0xe721eb){if(!_0xe721eb){_0x1251f7['sendStatus'](0x194);}return _0xe721eb;};}function handleError(_0x150632,_0x39e410){_0x39e410=_0x39e410||0x1f4;return function(_0x557643){logger[_0x084d('0x27')](_0x557643[_0x084d('0x28')]);if(_0x557643['name']){delete _0x557643[_0x084d('0x29')];}_0x150632[_0x084d('0x1b')](_0x39e410)[_0x084d('0x2a')](_0x557643);};}exports['index']=function(_0x15a002,_0x2e6ca4){var _0x8fe034={},_0x4f73aa={},_0x4bb0be={'count':0x0,'rows':[]};var _0x4877a6=_['map'](db['SugarcrmField'][_0x084d('0x2b')],function(_0x32285b){return{'name':_0x32285b[_0x084d('0x2c')],'type':_0x32285b[_0x084d('0x2d')][_0x084d('0x2e')]};});_0x4f73aa[_0x084d('0x2f')]=_[_0x084d('0x30')](_0x4877a6,'name');_0x4f73aa[_0x084d('0x31')]=_[_0x084d('0x32')](_0x15a002[_0x084d('0x31')]);_0x4f73aa['filters']=_[_0x084d('0x33')](_0x4f73aa[_0x084d('0x2f')],_0x4f73aa[_0x084d('0x31')]);_0x8fe034[_0x084d('0x34')]=_['intersection'](_0x4f73aa[_0x084d('0x2f')],qs['fields'](_0x15a002[_0x084d('0x31')][_0x084d('0x35')]));_0x8fe034[_0x084d('0x34')]=_0x8fe034[_0x084d('0x34')]['length']?_0x8fe034[_0x084d('0x34')]:_0x4f73aa[_0x084d('0x2f')];if(!_0x15a002['query'][_0x084d('0x36')](_0x084d('0x37'))){_0x8fe034['limit']=qs[_0x084d('0x20')](_0x15a002[_0x084d('0x31')][_0x084d('0x20')]);_0x8fe034[_0x084d('0x1e')]=qs[_0x084d('0x1e')](_0x15a002[_0x084d('0x31')]['offset']);}_0x8fe034[_0x084d('0x38')]=qs[_0x084d('0x39')](_0x15a002[_0x084d('0x31')]['sort']);_0x8fe034['where']=qs[_0x084d('0x3a')](_[_0x084d('0x3b')](_0x15a002[_0x084d('0x31')],_0x4f73aa[_0x084d('0x3a')]),_0x4877a6);if(_0x15a002['query'][_0x084d('0x3c')]){_0x8fe034[_0x084d('0x3d')]=_[_0x084d('0x3e')](_0x8fe034['where'],{'$or':_['map'](_0x4877a6,function(_0x449f18){if(_0x449f18[_0x084d('0x2d')]!==_0x084d('0x3f')){var _0x34c6b7={};_0x34c6b7[_0x449f18['name']]={'$like':'%'+_0x15a002[_0x084d('0x31')][_0x084d('0x3c')]+'%'};return _0x34c6b7;}})});}_0x8fe034=_[_0x084d('0x3e')]({},_0x8fe034,_0x15a002[_0x084d('0x40')]);var _0x5b79dd={'where':_0x8fe034[_0x084d('0x3d')]};return db[_0x084d('0x41')][_0x084d('0x1f')](_0x5b79dd)[_0x084d('0x26')](function(_0xe3a2b){_0x4bb0be[_0x084d('0x1f')]=_0xe3a2b;if(_0x15a002['query'][_0x084d('0x42')]){_0x8fe034[_0x084d('0x43')]=[{'all':!![]}];}return db[_0x084d('0x41')]['findAll'](_0x8fe034);})[_0x084d('0x26')](function(_0x2c0cda){_0x4bb0be['rows']=_0x2c0cda;return _0x4bb0be;})['then'](respondWithFilteredResult(_0x2e6ca4,_0x8fe034))[_0x084d('0x44')](handleError(_0x2e6ca4,null));};exports['show']=function(_0x4bb537,_0x477c11){var _0x347952={'raw':!![],'where':{'id':_0x4bb537[_0x084d('0x45')]['id']}},_0x3549a5={};_0x3549a5[_0x084d('0x2f')]=_[_0x084d('0x32')](db['SugarcrmField']['rawAttributes']);_0x3549a5[_0x084d('0x31')]=_[_0x084d('0x32')](_0x4bb537[_0x084d('0x31')]);_0x3549a5['filters']=_['intersection'](_0x3549a5[_0x084d('0x2f')],_0x3549a5['query']);_0x347952[_0x084d('0x34')]=_[_0x084d('0x33')](_0x3549a5[_0x084d('0x2f')],qs[_0x084d('0x35')](_0x4bb537[_0x084d('0x31')][_0x084d('0x35')]));_0x347952['attributes']=_0x347952['attributes'][_0x084d('0x46')]?_0x347952['attributes']:_0x3549a5[_0x084d('0x2f')];if(_0x4bb537[_0x084d('0x31')][_0x084d('0x42')]){_0x347952[_0x084d('0x43')]=[{'all':!![]}];}_0x347952=_[_0x084d('0x3e')]({},_0x347952,_0x4bb537[_0x084d('0x40')]);return db[_0x084d('0x41')][_0x084d('0x47')](_0x347952)['then'](handleEntityNotFound(_0x477c11,null))[_0x084d('0x26')](respondWithResult(_0x477c11,null))[_0x084d('0x44')](handleError(_0x477c11,null));};exports[_0x084d('0x48')]=function(_0x3bea6d,_0x4684fc){return db[_0x084d('0x41')][_0x084d('0x48')](_0x3bea6d[_0x084d('0x49')],{})['then'](respondWithResult(_0x4684fc,0xc9))[_0x084d('0x44')](handleError(_0x4684fc,null));};exports[_0x084d('0x25')]=function(_0xe597c8,_0x1d6501){if(_0xe597c8[_0x084d('0x49')]['id']){delete _0xe597c8[_0x084d('0x49')]['id'];}return db[_0x084d('0x41')][_0x084d('0x47')]({'where':{'id':_0xe597c8['params']['id']}})[_0x084d('0x26')](handleEntityNotFound(_0x1d6501,null))[_0x084d('0x26')](saveUpdates(_0xe597c8[_0x084d('0x49')],null))[_0x084d('0x26')](respondWithResult(_0x1d6501,null))[_0x084d('0x44')](handleError(_0x1d6501,null));};exports[_0x084d('0x4a')]=function(_0x2d15a9,_0x1c5a5c){return db[_0x084d('0x41')][_0x084d('0x47')]({'where':{'id':_0x2d15a9['params']['id']}})[_0x084d('0x26')](handleEntityNotFound(_0x1c5a5c,null))[_0x084d('0x26')](removeEntity(_0x1c5a5c,null))[_0x084d('0x44')](handleError(_0x1c5a5c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 286a652..fc0674c 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 _0x5527=['FieldId','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x23b0cb,_0x495031){var _0x111c85=function(_0x44a426){while(--_0x44a426){_0x23b0cb['push'](_0x23b0cb['shift']());}};_0x111c85(++_0x495031);}(_0x5527,0x105));var _0x7552=function(_0x487c10,_0xe434ee){_0x487c10=_0x487c10-0x0;var _0x4ddb94=_0x5527[_0x487c10];return _0x4ddb94;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7552('0x0'));var rp=require(_0x7552('0x1'));var fs=require('fs');var path=require(_0x7552('0x2'));var rimraf=require(_0x7552('0x3'));var config=require('../../config/environment');var attributes=require(_0x7552('0x4'));module[_0x7552('0x5')]=function(_0x267a9d,_0x527056){return _0x267a9d[_0x7552('0x6')](_0x7552('0x7'),attributes,{'tableName':_0x7552('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x7552('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf69=['request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','FieldId','lodash','util','../../config/logger','moment'];(function(_0x24f22d,_0x1f6649){var _0x321679=function(_0x2eb38d){while(--_0x2eb38d){_0x24f22d['push'](_0x24f22d['shift']());}};_0x321679(++_0x1f6649);}(_0xaf69,0x80));var _0x9af6=function(_0x5f545c,_0x51a8d8){_0x5f545c=_0x5f545c-0x0;var _0x38d492=_0xaf69[_0x5f545c];return _0x38d492;};'use strict';var _=require(_0x9af6('0x0'));var util=require(_0x9af6('0x1'));var logger=require(_0x9af6('0x2'))('api');var moment=require(_0x9af6('0x3'));var BPromise=require('bluebird');var rp=require(_0x9af6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9af6('0x5'));var config=require(_0x9af6('0x6'));var attributes=require(_0x9af6('0x7'));module[_0x9af6('0x8')]=function(_0x3311cd,_0x3468d6){return _0x3311cd[_0x9af6('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x9af6('0xa')],'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 9f983d4..67184f4 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 _0xeb33=['http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x518b1d,_0x51a8c9){var _0x2a9f15=function(_0x1d18b0){while(--_0x1d18b0){_0x518b1d['push'](_0x518b1d['shift']());}};_0x2a9f15(++_0x51a8c9);}(_0xeb33,0x114));var _0x3eb3=function(_0xc0ab08,_0x3923db){_0xc0ab08=_0xc0ab08-0x0;var _0x296505=_0xeb33[_0xc0ab08];return _0x296505;};'use strict';var _=require(_0x3eb3('0x0'));var util=require(_0x3eb3('0x1'));var moment=require('moment');var BPromise=require(_0x3eb3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3eb3('0x3'));var db=require(_0x3eb3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3eb3('0x5'))(_0x3eb3('0x6'));var config=require(_0x3eb3('0x7'));var jayson=require(_0x3eb3('0x8'));var client=jayson[_0x3eb3('0x9')][_0x3eb3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35590f,_0x5ef3b3,_0x3dd783){return new BPromise(function(_0x42065c,_0x15cfd5){return client[_0x3eb3('0xb')](_0x35590f,_0x3dd783)[_0x3eb3('0xc')](function(_0x5320f3){logger['info'](_0x3eb3('0xd'),_0x5ef3b3,_0x3eb3('0xe'));logger[_0x3eb3('0xf')](_0x3eb3('0x10'),_0x5ef3b3,'request\x20sent',JSON[_0x3eb3('0x11')](_0x5320f3));if(_0x5320f3[_0x3eb3('0x12')]){if(_0x5320f3['error']['code']===0x1f4){logger[_0x3eb3('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x5ef3b3,_0x5320f3[_0x3eb3('0x12')][_0x3eb3('0x13')]);return _0x15cfd5(_0x5320f3[_0x3eb3('0x12')][_0x3eb3('0x13')]);}logger[_0x3eb3('0x12')](_0x3eb3('0xd'),_0x5ef3b3,_0x5320f3[_0x3eb3('0x12')][_0x3eb3('0x13')]);return _0x42065c(_0x5320f3[_0x3eb3('0x12')][_0x3eb3('0x13')]);}else{logger[_0x3eb3('0x14')](_0x3eb3('0xd'),_0x5ef3b3,'request\x20sent');_0x42065c(_0x5320f3[_0x3eb3('0x15')][_0x3eb3('0x13')]);}})['catch'](function(_0x25f9d2){logger[_0x3eb3('0x12')](_0x3eb3('0xd'),_0x5ef3b3,_0x25f9d2);_0x15cfd5(_0x25f9d2);});});} \ No newline at end of file +var _0x5ded=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','../../mysqldb'];(function(_0x45d633,_0x2ebf6d){var _0x4b463b=function(_0xfb551e){while(--_0xfb551e){_0x45d633['push'](_0x45d633['shift']());}};_0x4b463b(++_0x2ebf6d);}(_0x5ded,0x1f1));var _0xd5de=function(_0x4a719a,_0x5be93c){_0x4a719a=_0x4a719a-0x0;var _0x411314=_0x5ded[_0x4a719a];return _0x411314;};'use strict';var _=require('lodash');var util=require(_0xd5de('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd5de('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5de('0x2'))['db'];var utils=require(_0xd5de('0x3'));var logger=require(_0xd5de('0x4'))(_0xd5de('0x5'));var config=require(_0xd5de('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1710a6,_0x278625,_0x13eaa0){return new BPromise(function(_0x3fd614,_0x5d02ea){return client[_0xd5de('0x7')](_0x1710a6,_0x13eaa0)[_0xd5de('0x8')](function(_0x47d5c1){logger[_0xd5de('0x9')](_0xd5de('0xa'),_0x278625,_0xd5de('0xb'));logger[_0xd5de('0xc')](_0xd5de('0xd'),_0x278625,_0xd5de('0xb'),JSON[_0xd5de('0xe')](_0x47d5c1));if(_0x47d5c1[_0xd5de('0xf')]){if(_0x47d5c1[_0xd5de('0xf')][_0xd5de('0x10')]===0x1f4){logger[_0xd5de('0xf')](_0xd5de('0xa'),_0x278625,_0x47d5c1[_0xd5de('0xf')][_0xd5de('0x11')]);return _0x5d02ea(_0x47d5c1['error'][_0xd5de('0x11')]);}logger[_0xd5de('0xf')](_0xd5de('0xa'),_0x278625,_0x47d5c1[_0xd5de('0xf')][_0xd5de('0x11')]);return _0x3fd614(_0x47d5c1[_0xd5de('0xf')]['message']);}else{logger['info'](_0xd5de('0xa'),_0x278625,_0xd5de('0xb'));_0x3fd614(_0x47d5c1[_0xd5de('0x12')][_0xd5de('0x11')]);}})[_0xd5de('0x13')](function(_0x4aaa0c){logger[_0xd5de('0xf')](_0xd5de('0xa'),_0x278625,_0x4aaa0c);_0x5d02ea(_0x4aaa0c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0577782..81d9bc6 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 _0x62ec=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations','/:id'];(function(_0x572d69,_0x3f97ba){var _0x2ed2a9=function(_0x5a1417){while(--_0x5a1417){_0x572d69['push'](_0x572d69['shift']());}};_0x2ed2a9(++_0x3f97ba);}(_0x62ec,0xca));var _0xc62e=function(_0x5d0901,_0x110cc2){_0x5d0901=_0x5d0901-0x0;var _0xf961f0=_0x62ec[_0x5d0901];return _0xf961f0;};'use strict';var multer=require('multer');var util=require(_0xc62e('0x0'));var path=require('path');var timeout=require(_0xc62e('0x1'));var express=require(_0xc62e('0x2'));var router=express[_0xc62e('0x3')]();var fs_extra=require(_0xc62e('0x4'));var auth=require(_0xc62e('0x5'));var interaction=require(_0xc62e('0x6'));var config=require(_0xc62e('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xc62e('0x8')]('/',auth[_0xc62e('0x9')](),controller[_0xc62e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc62e('0xb')]);router[_0xc62e('0x8')]('/:id/configurations',auth[_0xc62e('0x9')](),controller[_0xc62e('0xc')]);router['get']('/:id/fields',auth[_0xc62e('0x9')](),controller[_0xc62e('0xd')]);router[_0xc62e('0xe')]('/',auth['isAuthenticated'](),controller[_0xc62e('0xf')]);router[_0xc62e('0xe')](_0xc62e('0x10'),auth[_0xc62e('0x9')](),controller['addConfiguration']);router['put'](_0xc62e('0x11'),auth[_0xc62e('0x9')](),controller[_0xc62e('0x12')]);router[_0xc62e('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xc62e('0x14')]);module[_0xc62e('0x15')]=router; \ No newline at end of file +var _0xf041=['post','addConfiguration','put','update','delete','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x2f5943,_0xba490b){var _0x465b7b=function(_0x4d234d){while(--_0x4d234d){_0x2f5943['push'](_0x2f5943['shift']());}};_0x465b7b(++_0xba490b);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f04('0x0'));var timeout=require(_0x1f04('0x1'));var express=require(_0x1f04('0x2'));var router=express[_0x1f04('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f04('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f04('0x5'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x1f04('0x6')](),controller['index']);router[_0x1f04('0x7')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x9')]);router['get'](_0x1f04('0xa'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xb')]);router[_0x1f04('0x7')](_0x1f04('0xc'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xd')]);router[_0x1f04('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f04('0xe')](_0x1f04('0xa'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xf')]);router[_0x1f04('0x10')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x11')]);router[_0x1f04('0x12')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index efccf2d..0e080d0 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 _0x9199=['exports','STRING','HelpDesk','sequelize'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9199,0x1b7));var _0x9919=function(_0x423b10,_0x36cad4){_0x423b10=_0x423b10-0x0;var _0x1338d9=_0x9199[_0x423b10];return _0x1338d9;};'use strict';var Sequelize=require(_0x9919('0x0'));module[_0x9919('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9919('0x2')]},'username':{'type':Sequelize[_0x9919('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9919('0x2')],'allowNull':![],'defaultValue':_0x9919('0x3')},'remoteUri':{'type':Sequelize[_0x9919('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9919('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9919('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5115=['STRING','HelpDesk','sequelize','exports'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x5115,0x19a));var _0x5511=function(_0x43f15b,_0x5de642){_0x43f15b=_0x43f15b-0x0;var _0x70a7ea=_0x5115[_0x43f15b];return _0x70a7ea;};'use strict';var Sequelize=require(_0x5511('0x0'));module[_0x5511('0x1')]={'name':{'type':Sequelize[_0x5511('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5511('0x2')]},'username':{'type':Sequelize[_0x5511('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5511('0x2')],'allowNull':![],'defaultValue':_0x5511('0x3')},'remoteUri':{'type':Sequelize[_0x5511('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5511('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5511('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1afbf58..d93f2a4 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 _0x291d=['includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','vTiger\x20error:\x20','test','statusCode','error','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','VtigerAccount','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','find','body','getConfigurations','findOne','VtigerConfiguration','rawAttributes','order','hasOwnProperty','Subjects','getSubjects','channel','getDescriptions','create','VtigerField','Descriptions','md5','moduleName','remoteUri','serverUrl','accessKey','username','slice','format','%s/webservice.php','GET','success','login','result','token','describe','sessionName','reference','owner','remove'];(function(_0xa95459,_0x3880ac){var _0x1db4f0=function(_0x228568){while(--_0x228568){_0xa95459['push'](_0xa95459['shift']());}};_0x1db4f0(++_0x3880ac);}(_0x291d,0x83));var _0xd291=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x291d[_0x31cb5f];return _0x586042;};'use strict';var emlformat=require(_0xd291('0x0'));var rimraf=require(_0xd291('0x1'));var zipdir=require(_0xd291('0x2'));var jsonpatch=require(_0xd291('0x3'));var rp=require('request-promise');var moment=require(_0xd291('0x4'));var BPromise=require(_0xd291('0x5'));var Mustache=require(_0xd291('0x6'));var util=require(_0xd291('0x7'));var path=require(_0xd291('0x8'));var sox=require(_0xd291('0x9'));var csv=require(_0xd291('0xa'));var ejs=require(_0xd291('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd291('0xc'));var squel=require(_0xd291('0xd'));var crypto=require('crypto');var jsforce=require(_0xd291('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd291('0xf'));var Papa=require('papaparse');var Redis=require(_0xd291('0x10'));var authService=require(_0xd291('0x11'));var qs=require(_0xd291('0x12'));var as=require(_0xd291('0x13'));var hardwareService=require(_0xd291('0x14'));var logger=require(_0xd291('0x15'))(_0xd291('0x16'));var utils=require(_0xd291('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3f9bbc,_0x526e23){_0x526e23=_0x526e23||0xcc;return function(_0xa659bd){if(_0xa659bd){return _0x3f9bbc[_0xd291('0x18')](_0x526e23);}return _0x3f9bbc[_0xd291('0x19')](_0x526e23)['end']();};}function respondWithResult(_0x164442,_0x3f668e){_0x3f668e=_0x3f668e||0xc8;return function(_0x44a328){if(_0x44a328){return _0x164442[_0xd291('0x19')](_0x3f668e)[_0xd291('0x1a')](_0x44a328);}};}function respondWithFilteredResult(_0x45e7fe,_0x59b6bf){return function(_0xfdf83f){if(_0xfdf83f){var _0x30bde1=typeof _0x59b6bf[_0xd291('0x1b')]===_0xd291('0x1c')&&typeof _0x59b6bf[_0xd291('0x1d')]===_0xd291('0x1c');var _0x1ddeb3=_0xfdf83f['count'];var _0x2d2994=_0x30bde1?0x0:_0x59b6bf[_0xd291('0x1b')];var _0x49ba42=_0x30bde1?_0xfdf83f[_0xd291('0x1e')]:_0x59b6bf[_0xd291('0x1b')]+_0x59b6bf['limit'];var _0x23e4e6;if(_0x49ba42>=_0x1ddeb3){_0x49ba42=_0x1ddeb3;_0x23e4e6=0xc8;}else{_0x23e4e6=0xce;}_0x45e7fe[_0xd291('0x19')](_0x23e4e6);return _0x45e7fe['set'](_0xd291('0x1f'),_0x2d2994+'-'+_0x49ba42+'/'+_0x1ddeb3)[_0xd291('0x1a')](_0xfdf83f);}return null;};}function patchUpdates(_0x2dfa07){return function(_0x31a18e){try{jsonpatch[_0xd291('0x20')](_0x31a18e,_0x2dfa07,!![]);}catch(_0x381627){return BPromise[_0xd291('0x21')](_0x381627);}return _0x31a18e[_0xd291('0x22')]();};}function saveUpdates(_0x30418b,_0x100f02){return function(_0x164a12){if(_0x164a12){return _0x164a12[_0xd291('0x23')](_0x30418b)[_0xd291('0x24')](function(_0x1645eb){return _0x1645eb;});}return null;};}function removeEntity(_0x40f9b6,_0xdfe3b5){return function(_0x4a863e){if(_0x4a863e){return _0x4a863e[_0xd291('0x25')]()['then'](function(){_0x40f9b6[_0xd291('0x19')](0xcc)[_0xd291('0x26')]();});}};}function handleEntityNotFound(_0x2b24f4,_0x1846c1){return function(_0x5152af){if(!_0x5152af){_0x2b24f4[_0xd291('0x18')](0x194);}return _0x5152af;};}function handleError(_0x88d196,_0x19330b){_0x19330b=_0x19330b||0x1f4;return function(_0x4a20a7){logger['error'](_0x4a20a7[_0xd291('0x27')]);if(_0x4a20a7[_0xd291('0x28')]){delete _0x4a20a7[_0xd291('0x28')];}_0x88d196['status'](_0x19330b)[_0xd291('0x29')](_0x4a20a7);};}exports['index']=function(_0x4999c6,_0x4d3c97){var _0x437efd={},_0x1515d5={},_0x500128={'count':0x0,'rows':[]};var _0x247768=_['map'](db[_0xd291('0x2a')]['rawAttributes'],function(_0x477e6b){return{'name':_0x477e6b[_0xd291('0x2b')],'type':_0x477e6b[_0xd291('0x2c')][_0xd291('0x2d')]};});_0x1515d5[_0xd291('0x2e')]=_[_0xd291('0x2f')](_0x247768,_0xd291('0x28'));_0x1515d5[_0xd291('0x30')]=_[_0xd291('0x31')](_0x4999c6[_0xd291('0x30')]);_0x1515d5['filters']=_[_0xd291('0x32')](_0x1515d5[_0xd291('0x2e')],_0x1515d5[_0xd291('0x30')]);_0x437efd[_0xd291('0x33')]=_[_0xd291('0x32')](_0x1515d5['model'],qs['fields'](_0x4999c6[_0xd291('0x30')][_0xd291('0x34')]));_0x437efd[_0xd291('0x33')]=_0x437efd[_0xd291('0x33')][_0xd291('0x35')]?_0x437efd[_0xd291('0x33')]:_0x1515d5[_0xd291('0x2e')];if(!_0x4999c6['query']['hasOwnProperty']('nolimit')){_0x437efd[_0xd291('0x1d')]=qs[_0xd291('0x1d')](_0x4999c6['query']['limit']);_0x437efd[_0xd291('0x1b')]=qs[_0xd291('0x1b')](_0x4999c6['query'][_0xd291('0x1b')]);}_0x437efd['order']=qs[_0xd291('0x36')](_0x4999c6[_0xd291('0x30')]['sort']);_0x437efd[_0xd291('0x37')]=qs[_0xd291('0x38')](_[_0xd291('0x39')](_0x4999c6[_0xd291('0x30')],_0x1515d5[_0xd291('0x38')]),_0x247768);if(_0x4999c6['query']['filter']){_0x437efd[_0xd291('0x37')]=_[_0xd291('0x3a')](_0x437efd[_0xd291('0x37')],{'$or':_['map'](_0x247768,function(_0xe26961){if(_0xe26961[_0xd291('0x2c')]!=='VIRTUAL'){var _0x331809={};_0x331809[_0xe26961[_0xd291('0x28')]]={'$like':'%'+_0x4999c6['query'][_0xd291('0x3b')]+'%'};return _0x331809;}})});}_0x437efd=_[_0xd291('0x3a')]({},_0x437efd,_0x4999c6[_0xd291('0x3c')]);var _0x322742={'where':_0x437efd[_0xd291('0x37')]};return db['VtigerAccount']['count'](_0x322742)[_0xd291('0x24')](function(_0x3f7f71){_0x500128[_0xd291('0x1e')]=_0x3f7f71;if(_0x4999c6['query'][_0xd291('0x3d')]){_0x437efd[_0xd291('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0xd291('0x3f')](_0x437efd);})[_0xd291('0x24')](function(_0xe55803){_0x500128['rows']=_0xe55803;return _0x500128;})['then'](respondWithFilteredResult(_0x4d3c97,_0x437efd))[_0xd291('0x40')](handleError(_0x4d3c97,null));};exports[_0xd291('0x41')]=function(_0x40029f,_0x257c65){var _0x4432e8={'raw':![],'where':{'id':_0x40029f[_0xd291('0x42')]['id']}},_0x3a42e5={};_0x3a42e5[_0xd291('0x2e')]=_[_0xd291('0x31')](db[_0xd291('0x2a')]['rawAttributes']);_0x3a42e5['query']=_[_0xd291('0x31')](_0x40029f[_0xd291('0x30')]);_0x3a42e5[_0xd291('0x38')]=_['intersection'](_0x3a42e5[_0xd291('0x2e')],_0x3a42e5['query']);_0x4432e8[_0xd291('0x33')]=_[_0xd291('0x32')](_0x3a42e5[_0xd291('0x2e')],qs[_0xd291('0x34')](_0x40029f[_0xd291('0x30')]['fields']));_0x4432e8[_0xd291('0x33')]=_0x4432e8[_0xd291('0x33')][_0xd291('0x35')]?_0x4432e8['attributes']:_0x3a42e5[_0xd291('0x2e')];if(_0x40029f[_0xd291('0x30')][_0xd291('0x3d')]){_0x4432e8['include']=[{'all':!![]}];}_0x4432e8=_[_0xd291('0x3a')]({},_0x4432e8,_0x40029f['options']);return db['VtigerAccount'][_0xd291('0x43')](_0x4432e8)[_0xd291('0x24')](handleEntityNotFound(_0x257c65,null))[_0xd291('0x24')](respondWithResult(_0x257c65,null))[_0xd291('0x40')](handleError(_0x257c65,null));};exports['create']=function(_0x2a00f7,_0x5a142a){return db['VtigerAccount']['create'](_0x2a00f7[_0xd291('0x44')],{})['then'](respondWithResult(_0x5a142a,0xc9))[_0xd291('0x40')](handleError(_0x5a142a,null));};exports['update']=function(_0x1204dd,_0x20bfb3){if(_0x1204dd[_0xd291('0x44')]['id']){delete _0x1204dd[_0xd291('0x44')]['id'];}return db[_0xd291('0x2a')][_0xd291('0x43')]({'where':{'id':_0x1204dd['params']['id']}})['then'](handleEntityNotFound(_0x20bfb3,null))['then'](saveUpdates(_0x1204dd[_0xd291('0x44')],null))[_0xd291('0x24')](respondWithResult(_0x20bfb3,null))['catch'](handleError(_0x20bfb3,null));};exports['destroy']=function(_0x2bf099,_0x2156f5){return db['VtigerAccount'][_0xd291('0x43')]({'where':{'id':_0x2bf099[_0xd291('0x42')]['id']}})['then'](handleEntityNotFound(_0x2156f5,null))['then'](removeEntity(_0x2156f5,null))[_0xd291('0x40')](handleError(_0x2156f5,null));};exports[_0xd291('0x45')]=function(_0x28dae3,_0x4b6eeb,_0x154752){var _0x27e6f9={};var _0x43a2bd={};var _0xf78de1;var _0x5e81b5;return db['VtigerAccount'][_0xd291('0x46')]({'where':{'id':_0x28dae3[_0xd291('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b6eeb,null))['then'](function(_0x435ea1){if(_0x435ea1){_0xf78de1=_0x435ea1;_0x43a2bd['model']=_[_0xd291('0x31')](db[_0xd291('0x47')][_0xd291('0x48')]);_0x43a2bd[_0xd291('0x30')]=_['keys'](_0x28dae3[_0xd291('0x30')]);_0x43a2bd[_0xd291('0x38')]=_[_0xd291('0x32')](_0x43a2bd['model'],_0x43a2bd['query']);_0x27e6f9['attributes']=_[_0xd291('0x32')](_0x43a2bd['model'],qs[_0xd291('0x34')](_0x28dae3['query']['fields']));_0x27e6f9['attributes']=_0x27e6f9[_0xd291('0x33')]['length']?_0x27e6f9['attributes']:_0x43a2bd[_0xd291('0x2e')];_0x27e6f9[_0xd291('0x49')]=qs['sort'](_0x28dae3[_0xd291('0x30')]['sort']);_0x27e6f9[_0xd291('0x37')]=qs['filters'](_[_0xd291('0x39')](_0x28dae3[_0xd291('0x30')],_0x43a2bd['filters']));if(_0x28dae3[_0xd291('0x30')][_0xd291('0x3b')]){_0x27e6f9[_0xd291('0x37')]=_['merge'](_0x27e6f9[_0xd291('0x37')],{'$or':_[_0xd291('0x2f')](_0x27e6f9[_0xd291('0x33')],function(_0x6b81ff){var _0x1300dc={};_0x1300dc[_0x6b81ff]={'$like':'%'+_0x28dae3[_0xd291('0x30')]['filter']+'%'};return _0x1300dc;})});}_0x27e6f9=_[_0xd291('0x3a')]({},_0x27e6f9,_0x28dae3['options']);return _0xf78de1[_0xd291('0x45')](_0x27e6f9);}})[_0xd291('0x24')](function(_0x2d06c8){if(_0x2d06c8){_0x5e81b5=_0x2d06c8['length'];if(!_0x28dae3[_0xd291('0x30')][_0xd291('0x4a')]('nolimit')){_0x27e6f9[_0xd291('0x1d')]=qs[_0xd291('0x1d')](_0x28dae3[_0xd291('0x30')]['limit']);_0x27e6f9[_0xd291('0x1b')]=qs[_0xd291('0x1b')](_0x28dae3[_0xd291('0x30')][_0xd291('0x1b')]);}return _0xf78de1[_0xd291('0x45')](_0x27e6f9);}})[_0xd291('0x24')](function(_0x30f66e){if(_0x30f66e){return _0x30f66e?{'count':_0x5e81b5,'rows':_0x30f66e}:null;}})['then'](respondWithResult(_0x4b6eeb,null))[_0xd291('0x40')](handleError(_0x4b6eeb,null));};exports['addConfiguration']=function(_0xd2a936,_0x464d4c,_0xa2efb6){if(_0xd2a936[_0xd291('0x44')]['id']){delete _0xd2a936[_0xd291('0x44')]['id'];}return db[_0xd291('0x2a')]['findOne']({'where':{'id':_0xd2a936[_0xd291('0x42')]['id']}})[_0xd291('0x24')](handleEntityNotFound(_0x464d4c,null))[_0xd291('0x24')](function(_0xe01667){if(_0xe01667){_0xd2a936[_0xd291('0x44')]['AccountId']=_0xe01667['id'];_0xd2a936[_0xd291('0x44')][_0xd291('0x4b')]=integrations[_0xd291('0x4c')](_0xd2a936[_0xd291('0x44')][_0xd291('0x4d')],_0xd2a936[_0xd291('0x44')][_0xd291('0x2c')]);_0xd2a936[_0xd291('0x44')]['Descriptions']=integrations[_0xd291('0x4e')](_0xd2a936['body']['channel'],_0xd2a936[_0xd291('0x44')][_0xd291('0x2c')]);return db[_0xd291('0x47')][_0xd291('0x4f')](_0xd2a936[_0xd291('0x44')],{'include':[{'model':db[_0xd291('0x50')],'as':_0xd291('0x4b')},{'model':db[_0xd291('0x50')],'as':_0xd291('0x51')}]});}return null;})[_0xd291('0x24')](respondWithResult(_0x464d4c,null))[_0xd291('0x40')](handleError(_0x464d4c,null));};var md5=require(_0xd291('0x52'));exports['getFields']=function(_0x2c9c2a,_0x43d22b,_0x4df893){var _0x53c4b0=null;var _0x128ed1=null;var _0x3208dc=null;var _0x4f9f4d=null;var _0x4b018b='';return db[_0xd291('0x2a')][_0xd291('0x46')]({'where':{'id':_0x2c9c2a['params']['id']},'attributes':['id',_0xd291('0x28'),'username','description',_0xd291('0x53'),_0xd291('0x54'),_0xd291('0x55'),_0xd291('0x56')]})[_0xd291('0x24')](handleEntityNotFound(_0x43d22b,null))[_0xd291('0x24')](function(_0x180c93){if(_0x180c93){_0x53c4b0=_0x180c93[_0xd291('0x57')];_0x128ed1=_0x180c93['accessKey'];_0x3208dc=_0x180c93[_0xd291('0x53')];_0x4b018b=_0x180c93[_0xd291('0x54')];var _0x443027=_0x4b018b[_0xd291('0x58')](-0x1);if(_0x443027==='/'){_0x4b018b=_0x4b018b['substring'](0x0,_0x4b018b['lastIndexOf'](_0x443027));}_0x4f9f4d=util[_0xd291('0x59')](_0xd291('0x5a'),_0x4b018b);var _0x2e1937={'method':_0xd291('0x5b'),'uri':_0x4f9f4d,'qs':{'operation':'getchallenge','username':_0x180c93[_0xd291('0x57')]},'json':!![]};return rp(_0x2e1937);}})[_0xd291('0x24')](function(_0x5361dd){if(_0x5361dd[_0xd291('0x5c')]){var _0x485782={'method':'POST','uri':_0x4f9f4d,'form':{'operation':_0xd291('0x5d'),'username':_0x53c4b0,'accessKey':md5(_0x5361dd[_0xd291('0x5e')][_0xd291('0x5f')]+_0x128ed1)},'json':!![]};return rp(_0x485782);}})['then'](function(_0x1e3f79){if(_0x1e3f79['success']){var _0x40e19c={'method':_0xd291('0x5b'),'uri':_0x4f9f4d,'qs':{'operation':_0xd291('0x60'),'username':_0x53c4b0,'sessionName':_0x1e3f79[_0xd291('0x5e')][_0xd291('0x61')],'elementType':_0x3208dc},'json':!![]};return rp(_0x40e19c);}})['then'](function(_0x413055){if(_0x413055[_0xd291('0x5c')]){var _0x19da28=['autogenerated',_0xd291('0x62'),_0xd291('0x63')];_[_0xd291('0x64')](_0x413055[_0xd291('0x5e')][_0xd291('0x34')],function(_0x54b0ac){return _0x19da28[_0xd291('0x65')](_0x54b0ac[_0xd291('0x2c')][_0xd291('0x28')]);});_[_0xd291('0x64')](_0x413055[_0xd291('0x5e')][_0xd291('0x34')],function(_0x595bfe){return _0x595bfe[_0xd291('0x66')]===_0xd291('0x67');});return{'count':_0x413055[_0xd291('0x5e')][_0xd291('0x34')][_0xd291('0x35')],'rows':_[_0xd291('0x2f')](_0x413055[_0xd291('0x5e')][_0xd291('0x34')],function(_0x8fd6ea){return{'id':_0x8fd6ea[_0xd291('0x28')],'name':_0x8fd6ea['label'],'custom':_[_0xd291('0x68')](_0x8fd6ea[_0xd291('0x28')],_0xd291('0x69'))?!![]:![],'options':_0x8fd6ea['type']['name']===_0xd291('0x6a')&&_0x8fd6ea[_0xd291('0x2c')][_0xd291('0x6b')][_0xd291('0x35')]>0x0?_[_0xd291('0x2f')](_0x8fd6ea[_0xd291('0x2c')]['picklistValues'],function(_0x343cd3){return{'name':_0x343cd3[_0xd291('0x6c')],'value':_0x343cd3[_0xd291('0x6d')]};}):[]};})};}})['then'](respondWithResult(_0x43d22b,null))[_0xd291('0x40')](function(_0x34077){console['log'](_0xd291('0x6e')+_0x34077);var _0x48f1ae=_0x2c9c2a['query'][_0xd291('0x6f')]?0x1f4:_0x34077[_0xd291('0x70')]||0x1f4;logger[_0xd291('0x71')]('getFields,\x20%s,\x20%s,\x20%s',_0xd291('0x72'),_0x48f1ae,JSON['stringify'](_0x34077));delete _0x34077[_0xd291('0x28')];if(_0x48f1ae===0x191){_0x48f1ae=0x190;}_0x43d22b['status'](_0x48f1ae)['send'](_0x2c9c2a[_0xd291('0x30')][_0xd291('0x6f')]?{'message':_0xd291('0x73'),'statusCode':_0x34077[_0xd291('0x70')]}:_0x34077);});}; \ No newline at end of file +var _0xc9ac=['ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','VtigerAccount','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','create','body','findOne','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','owner','remove','includes','editable','startsWith','cf_','picklist','picklistValues','label','log','vTiger\x20error:\x20','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv'];(function(_0x183d48,_0x1af157){var _0x3374f6=function(_0xdb5b25){while(--_0xdb5b25){_0x183d48['push'](_0x183d48['shift']());}};_0x3374f6(++_0x1af157);}(_0xc9ac,0xe7));var _0xcc9a=function(_0x58f363,_0x135c64){_0x58f363=_0x58f363-0x0;var _0xcb2c83=_0xc9ac[_0x58f363];return _0xcb2c83;};'use strict';var emlformat=require(_0xcc9a('0x0'));var rimraf=require(_0xcc9a('0x1'));var zipdir=require(_0xcc9a('0x2'));var jsonpatch=require(_0xcc9a('0x3'));var rp=require(_0xcc9a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc9a('0x5'));var util=require(_0xcc9a('0x6'));var path=require('path');var sox=require(_0xcc9a('0x7'));var csv=require(_0xcc9a('0x8'));var ejs=require(_0xcc9a('0x9'));var fs=require('fs');var fs_extra=require(_0xcc9a('0xa'));var _=require(_0xcc9a('0xb'));var squel=require(_0xcc9a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc9a('0xd'));var toCsv=require(_0xcc9a('0x8'));var querystring=require(_0xcc9a('0xe'));var Papa=require(_0xcc9a('0xf'));var Redis=require(_0xcc9a('0x10'));var authService=require(_0xcc9a('0x11'));var qs=require(_0xcc9a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc9a('0x13'));var logger=require(_0xcc9a('0x14'))(_0xcc9a('0x15'));var utils=require(_0xcc9a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc9a('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x252fce,_0x567e14){_0x567e14=_0x567e14||0xcc;return function(_0x5a8ac9){if(_0x5a8ac9){return _0x252fce[_0xcc9a('0x18')](_0x567e14);}return _0x252fce['status'](_0x567e14)[_0xcc9a('0x19')]();};}function respondWithResult(_0x20919a,_0x4cb40a){_0x4cb40a=_0x4cb40a||0xc8;return function(_0x3f1238){if(_0x3f1238){return _0x20919a[_0xcc9a('0x1a')](_0x4cb40a)[_0xcc9a('0x1b')](_0x3f1238);}};}function respondWithFilteredResult(_0x222984,_0x3d09a5){return function(_0x3b5ef5){if(_0x3b5ef5){var _0x1d41c4=typeof _0x3d09a5[_0xcc9a('0x1c')]===_0xcc9a('0x1d')&&typeof _0x3d09a5[_0xcc9a('0x1e')]===_0xcc9a('0x1d');var _0x152385=_0x3b5ef5['count'];var _0x280d4b=_0x1d41c4?0x0:_0x3d09a5[_0xcc9a('0x1c')];var _0x479049=_0x1d41c4?_0x3b5ef5['count']:_0x3d09a5[_0xcc9a('0x1c')]+_0x3d09a5[_0xcc9a('0x1e')];var _0xd5f2b6;if(_0x479049>=_0x152385){_0x479049=_0x152385;_0xd5f2b6=0xc8;}else{_0xd5f2b6=0xce;}_0x222984['status'](_0xd5f2b6);return _0x222984[_0xcc9a('0x1f')](_0xcc9a('0x20'),_0x280d4b+'-'+_0x479049+'/'+_0x152385)['json'](_0x3b5ef5);}return null;};}function patchUpdates(_0x38c2d7){return function(_0x49a7d5){try{jsonpatch[_0xcc9a('0x21')](_0x49a7d5,_0x38c2d7,!![]);}catch(_0x13f838){return BPromise[_0xcc9a('0x22')](_0x13f838);}return _0x49a7d5[_0xcc9a('0x23')]();};}function saveUpdates(_0x513ddd,_0x2f11a3){return function(_0x1f1c84){if(_0x1f1c84){return _0x1f1c84[_0xcc9a('0x24')](_0x513ddd)[_0xcc9a('0x25')](function(_0x368dd8){return _0x368dd8;});}return null;};}function removeEntity(_0x5e6a29,_0x4e34a9){return function(_0x23a2e3){if(_0x23a2e3){return _0x23a2e3[_0xcc9a('0x26')]()['then'](function(){_0x5e6a29[_0xcc9a('0x1a')](0xcc)[_0xcc9a('0x19')]();});}};}function handleEntityNotFound(_0x12bd51,_0x2e5c03){return function(_0x389661){if(!_0x389661){_0x12bd51[_0xcc9a('0x18')](0x194);}return _0x389661;};}function handleError(_0xbc8d15,_0x364b27){_0x364b27=_0x364b27||0x1f4;return function(_0x19dd43){logger['error'](_0x19dd43['stack']);if(_0x19dd43[_0xcc9a('0x27')]){delete _0x19dd43[_0xcc9a('0x27')];}_0xbc8d15[_0xcc9a('0x1a')](_0x364b27)[_0xcc9a('0x28')](_0x19dd43);};}exports[_0xcc9a('0x29')]=function(_0x3326c9,_0x1f3c3d){var _0x199b71={},_0x137483={},_0x3b606d={'count':0x0,'rows':[]};var _0x59211f=_[_0xcc9a('0x2a')](db[_0xcc9a('0x2b')][_0xcc9a('0x2c')],function(_0x277ee4){return{'name':_0x277ee4['fieldName'],'type':_0x277ee4[_0xcc9a('0x2d')][_0xcc9a('0x2e')]};});_0x137483['model']=_[_0xcc9a('0x2a')](_0x59211f,_0xcc9a('0x27'));_0x137483[_0xcc9a('0x2f')]=_[_0xcc9a('0x30')](_0x3326c9[_0xcc9a('0x2f')]);_0x137483['filters']=_[_0xcc9a('0x31')](_0x137483[_0xcc9a('0x32')],_0x137483[_0xcc9a('0x2f')]);_0x199b71[_0xcc9a('0x33')]=_[_0xcc9a('0x31')](_0x137483[_0xcc9a('0x32')],qs[_0xcc9a('0x34')](_0x3326c9[_0xcc9a('0x2f')][_0xcc9a('0x34')]));_0x199b71[_0xcc9a('0x33')]=_0x199b71[_0xcc9a('0x33')][_0xcc9a('0x35')]?_0x199b71[_0xcc9a('0x33')]:_0x137483[_0xcc9a('0x32')];if(!_0x3326c9[_0xcc9a('0x2f')]['hasOwnProperty'](_0xcc9a('0x36'))){_0x199b71[_0xcc9a('0x1e')]=qs[_0xcc9a('0x1e')](_0x3326c9[_0xcc9a('0x2f')]['limit']);_0x199b71[_0xcc9a('0x1c')]=qs[_0xcc9a('0x1c')](_0x3326c9[_0xcc9a('0x2f')]['offset']);}_0x199b71['order']=qs[_0xcc9a('0x37')](_0x3326c9['query'][_0xcc9a('0x37')]);_0x199b71['where']=qs[_0xcc9a('0x38')](_[_0xcc9a('0x39')](_0x3326c9[_0xcc9a('0x2f')],_0x137483[_0xcc9a('0x38')]),_0x59211f);if(_0x3326c9['query'][_0xcc9a('0x3a')]){_0x199b71[_0xcc9a('0x3b')]=_[_0xcc9a('0x3c')](_0x199b71[_0xcc9a('0x3b')],{'$or':_[_0xcc9a('0x2a')](_0x59211f,function(_0x50e5e0){if(_0x50e5e0[_0xcc9a('0x2d')]!==_0xcc9a('0x3d')){var _0x4d7573={};_0x4d7573[_0x50e5e0[_0xcc9a('0x27')]]={'$like':'%'+_0x3326c9['query']['filter']+'%'};return _0x4d7573;}})});}_0x199b71=_[_0xcc9a('0x3c')]({},_0x199b71,_0x3326c9[_0xcc9a('0x3e')]);var _0xd40903={'where':_0x199b71[_0xcc9a('0x3b')]};return db[_0xcc9a('0x2b')][_0xcc9a('0x3f')](_0xd40903)[_0xcc9a('0x25')](function(_0x57c935){_0x3b606d[_0xcc9a('0x3f')]=_0x57c935;if(_0x3326c9['query'][_0xcc9a('0x40')]){_0x199b71[_0xcc9a('0x41')]=[{'all':!![]}];}return db[_0xcc9a('0x2b')]['findAll'](_0x199b71);})['then'](function(_0x17b6eb){_0x3b606d[_0xcc9a('0x42')]=_0x17b6eb;return _0x3b606d;})[_0xcc9a('0x25')](respondWithFilteredResult(_0x1f3c3d,_0x199b71))[_0xcc9a('0x43')](handleError(_0x1f3c3d,null));};exports[_0xcc9a('0x44')]=function(_0x4b6d57,_0x2b1bed){var _0x3ffb51={'raw':![],'where':{'id':_0x4b6d57[_0xcc9a('0x45')]['id']}},_0x4f0d0e={};_0x4f0d0e['model']=_[_0xcc9a('0x30')](db[_0xcc9a('0x2b')][_0xcc9a('0x2c')]);_0x4f0d0e[_0xcc9a('0x2f')]=_[_0xcc9a('0x30')](_0x4b6d57[_0xcc9a('0x2f')]);_0x4f0d0e['filters']=_[_0xcc9a('0x31')](_0x4f0d0e[_0xcc9a('0x32')],_0x4f0d0e[_0xcc9a('0x2f')]);_0x3ffb51[_0xcc9a('0x33')]=_[_0xcc9a('0x31')](_0x4f0d0e['model'],qs[_0xcc9a('0x34')](_0x4b6d57['query'][_0xcc9a('0x34')]));_0x3ffb51[_0xcc9a('0x33')]=_0x3ffb51[_0xcc9a('0x33')]['length']?_0x3ffb51[_0xcc9a('0x33')]:_0x4f0d0e[_0xcc9a('0x32')];if(_0x4b6d57[_0xcc9a('0x2f')][_0xcc9a('0x40')]){_0x3ffb51[_0xcc9a('0x41')]=[{'all':!![]}];}_0x3ffb51=_[_0xcc9a('0x3c')]({},_0x3ffb51,_0x4b6d57['options']);return db['VtigerAccount'][_0xcc9a('0x46')](_0x3ffb51)[_0xcc9a('0x25')](handleEntityNotFound(_0x2b1bed,null))[_0xcc9a('0x25')](respondWithResult(_0x2b1bed,null))[_0xcc9a('0x43')](handleError(_0x2b1bed,null));};exports[_0xcc9a('0x47')]=function(_0x10e2af,_0x493d71){return db[_0xcc9a('0x2b')]['create'](_0x10e2af[_0xcc9a('0x48')],{})['then'](respondWithResult(_0x493d71,0xc9))['catch'](handleError(_0x493d71,null));};exports[_0xcc9a('0x24')]=function(_0x198e89,_0x39819b){if(_0x198e89[_0xcc9a('0x48')]['id']){delete _0x198e89[_0xcc9a('0x48')]['id'];}return db[_0xcc9a('0x2b')][_0xcc9a('0x46')]({'where':{'id':_0x198e89[_0xcc9a('0x45')]['id']}})[_0xcc9a('0x25')](handleEntityNotFound(_0x39819b,null))['then'](saveUpdates(_0x198e89[_0xcc9a('0x48')],null))['then'](respondWithResult(_0x39819b,null))[_0xcc9a('0x43')](handleError(_0x39819b,null));};exports[_0xcc9a('0x26')]=function(_0x5c510f,_0x3de64b){return db[_0xcc9a('0x2b')]['find']({'where':{'id':_0x5c510f[_0xcc9a('0x45')]['id']}})[_0xcc9a('0x25')](handleEntityNotFound(_0x3de64b,null))[_0xcc9a('0x25')](removeEntity(_0x3de64b,null))[_0xcc9a('0x43')](handleError(_0x3de64b,null));};exports['getConfigurations']=function(_0xeb6255,_0x26a2bf,_0x1e4a0f){var _0x143199={};var _0x3d5d6e={};var _0x5a8438;var _0x3458bb;return db[_0xcc9a('0x2b')][_0xcc9a('0x49')]({'where':{'id':_0xeb6255[_0xcc9a('0x45')]['id']}})[_0xcc9a('0x25')](handleEntityNotFound(_0x26a2bf,null))['then'](function(_0x274039){if(_0x274039){_0x5a8438=_0x274039;_0x3d5d6e[_0xcc9a('0x32')]=_[_0xcc9a('0x30')](db['VtigerConfiguration'][_0xcc9a('0x2c')]);_0x3d5d6e[_0xcc9a('0x2f')]=_['keys'](_0xeb6255['query']);_0x3d5d6e[_0xcc9a('0x38')]=_[_0xcc9a('0x31')](_0x3d5d6e['model'],_0x3d5d6e[_0xcc9a('0x2f')]);_0x143199[_0xcc9a('0x33')]=_[_0xcc9a('0x31')](_0x3d5d6e[_0xcc9a('0x32')],qs[_0xcc9a('0x34')](_0xeb6255['query'][_0xcc9a('0x34')]));_0x143199[_0xcc9a('0x33')]=_0x143199[_0xcc9a('0x33')][_0xcc9a('0x35')]?_0x143199[_0xcc9a('0x33')]:_0x3d5d6e[_0xcc9a('0x32')];_0x143199['order']=qs[_0xcc9a('0x37')](_0xeb6255[_0xcc9a('0x2f')][_0xcc9a('0x37')]);_0x143199[_0xcc9a('0x3b')]=qs[_0xcc9a('0x38')](_[_0xcc9a('0x39')](_0xeb6255[_0xcc9a('0x2f')],_0x3d5d6e[_0xcc9a('0x38')]));if(_0xeb6255[_0xcc9a('0x2f')]['filter']){_0x143199[_0xcc9a('0x3b')]=_['merge'](_0x143199[_0xcc9a('0x3b')],{'$or':_['map'](_0x143199[_0xcc9a('0x33')],function(_0x5bb6cd){var _0x13a275={};_0x13a275[_0x5bb6cd]={'$like':'%'+_0xeb6255[_0xcc9a('0x2f')][_0xcc9a('0x3a')]+'%'};return _0x13a275;})});}_0x143199=_[_0xcc9a('0x3c')]({},_0x143199,_0xeb6255['options']);return _0x5a8438[_0xcc9a('0x4a')](_0x143199);}})[_0xcc9a('0x25')](function(_0x4f5e86){if(_0x4f5e86){_0x3458bb=_0x4f5e86[_0xcc9a('0x35')];if(!_0xeb6255[_0xcc9a('0x2f')][_0xcc9a('0x4b')]('nolimit')){_0x143199['limit']=qs['limit'](_0xeb6255[_0xcc9a('0x2f')][_0xcc9a('0x1e')]);_0x143199[_0xcc9a('0x1c')]=qs[_0xcc9a('0x1c')](_0xeb6255['query'][_0xcc9a('0x1c')]);}return _0x5a8438[_0xcc9a('0x4a')](_0x143199);}})[_0xcc9a('0x25')](function(_0x5b4f56){if(_0x5b4f56){return _0x5b4f56?{'count':_0x3458bb,'rows':_0x5b4f56}:null;}})[_0xcc9a('0x25')](respondWithResult(_0x26a2bf,null))[_0xcc9a('0x43')](handleError(_0x26a2bf,null));};exports['addConfiguration']=function(_0x3dee38,_0x3d3fd6,_0x6cc37b){if(_0x3dee38[_0xcc9a('0x48')]['id']){delete _0x3dee38[_0xcc9a('0x48')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x3dee38[_0xcc9a('0x45')]['id']}})[_0xcc9a('0x25')](handleEntityNotFound(_0x3d3fd6,null))[_0xcc9a('0x25')](function(_0x4596c6){if(_0x4596c6){_0x3dee38[_0xcc9a('0x48')][_0xcc9a('0x4c')]=_0x4596c6['id'];_0x3dee38[_0xcc9a('0x48')][_0xcc9a('0x4d')]=integrations[_0xcc9a('0x4e')](_0x3dee38[_0xcc9a('0x48')][_0xcc9a('0x4f')],_0x3dee38[_0xcc9a('0x48')][_0xcc9a('0x2d')]);_0x3dee38['body'][_0xcc9a('0x50')]=integrations[_0xcc9a('0x51')](_0x3dee38[_0xcc9a('0x48')]['channel'],_0x3dee38['body'][_0xcc9a('0x2d')]);return db[_0xcc9a('0x52')]['create'](_0x3dee38[_0xcc9a('0x48')],{'include':[{'model':db[_0xcc9a('0x53')],'as':_0xcc9a('0x4d')},{'model':db[_0xcc9a('0x53')],'as':_0xcc9a('0x50')}]});}return null;})[_0xcc9a('0x25')](respondWithResult(_0x3d3fd6,null))[_0xcc9a('0x43')](handleError(_0x3d3fd6,null));};var md5=require(_0xcc9a('0x54'));exports['getFields']=function(_0xa8d4aa,_0x4b848e,_0x55b3f6){var _0x54c571=null;var _0x4feb69=null;var _0x3f4a48=null;var _0x166906=null;var _0x4d0efa='';return db[_0xcc9a('0x2b')]['findOne']({'where':{'id':_0xa8d4aa[_0xcc9a('0x45')]['id']},'attributes':['id',_0xcc9a('0x27'),_0xcc9a('0x55'),_0xcc9a('0x56'),_0xcc9a('0x57'),_0xcc9a('0x58'),_0xcc9a('0x59'),_0xcc9a('0x5a')]})[_0xcc9a('0x25')](handleEntityNotFound(_0x4b848e,null))[_0xcc9a('0x25')](function(_0x444cb1){if(_0x444cb1){_0x54c571=_0x444cb1[_0xcc9a('0x55')];_0x4feb69=_0x444cb1[_0xcc9a('0x5a')];_0x3f4a48=_0x444cb1[_0xcc9a('0x57')];_0x4d0efa=_0x444cb1[_0xcc9a('0x58')];var _0x4d4d4d=_0x4d0efa[_0xcc9a('0x5b')](-0x1);if(_0x4d4d4d==='/'){_0x4d0efa=_0x4d0efa[_0xcc9a('0x5c')](0x0,_0x4d0efa[_0xcc9a('0x5d')](_0x4d4d4d));}_0x166906=util['format'](_0xcc9a('0x5e'),_0x4d0efa);var _0x5e1c25={'method':_0xcc9a('0x5f'),'uri':_0x166906,'qs':{'operation':_0xcc9a('0x60'),'username':_0x444cb1[_0xcc9a('0x55')]},'json':!![]};return rp(_0x5e1c25);}})[_0xcc9a('0x25')](function(_0x369ec2){if(_0x369ec2[_0xcc9a('0x61')]){var _0xedd020={'method':_0xcc9a('0x62'),'uri':_0x166906,'form':{'operation':'login','username':_0x54c571,'accessKey':md5(_0x369ec2[_0xcc9a('0x63')][_0xcc9a('0x64')]+_0x4feb69)},'json':!![]};return rp(_0xedd020);}})[_0xcc9a('0x25')](function(_0x5e12ab){if(_0x5e12ab['success']){var _0x19a7a4={'method':_0xcc9a('0x5f'),'uri':_0x166906,'qs':{'operation':_0xcc9a('0x65'),'username':_0x54c571,'sessionName':_0x5e12ab[_0xcc9a('0x63')][_0xcc9a('0x66')],'elementType':_0x3f4a48},'json':!![]};return rp(_0x19a7a4);}})[_0xcc9a('0x25')](function(_0xe25874){if(_0xe25874['success']){var _0x4a6cb0=[_0xcc9a('0x67'),'reference',_0xcc9a('0x68')];_[_0xcc9a('0x69')](_0xe25874[_0xcc9a('0x63')]['fields'],function(_0x151785){return _0x4a6cb0[_0xcc9a('0x6a')](_0x151785[_0xcc9a('0x2d')]['name']);});_[_0xcc9a('0x69')](_0xe25874['result'][_0xcc9a('0x34')],function(_0x11be0c){return _0x11be0c[_0xcc9a('0x6b')]==='false';});return{'count':_0xe25874[_0xcc9a('0x63')][_0xcc9a('0x34')][_0xcc9a('0x35')],'rows':_[_0xcc9a('0x2a')](_0xe25874['result']['fields'],function(_0x125569){return{'id':_0x125569[_0xcc9a('0x27')],'name':_0x125569['label'],'custom':_[_0xcc9a('0x6c')](_0x125569[_0xcc9a('0x27')],_0xcc9a('0x6d'))?!![]:![],'options':_0x125569[_0xcc9a('0x2d')][_0xcc9a('0x27')]===_0xcc9a('0x6e')&&_0x125569[_0xcc9a('0x2d')][_0xcc9a('0x6f')][_0xcc9a('0x35')]>0x0?_['map'](_0x125569[_0xcc9a('0x2d')][_0xcc9a('0x6f')],function(_0x1acdb0){return{'name':_0x1acdb0[_0xcc9a('0x70')],'value':_0x1acdb0['value']};}):[]};})};}})['then'](respondWithResult(_0x4b848e,null))[_0xcc9a('0x43')](function(_0x5a78e1){console[_0xcc9a('0x71')](_0xcc9a('0x72')+_0x5a78e1);var _0x3c33ed=_0xa8d4aa[_0xcc9a('0x2f')][_0xcc9a('0x73')]?0x1f4:_0x5a78e1[_0xcc9a('0x74')]||0x1f4;logger[_0xcc9a('0x75')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3c33ed,JSON[_0xcc9a('0x76')](_0x5a78e1));delete _0x5a78e1[_0xcc9a('0x27')];if(_0x3c33ed===0x191){_0x3c33ed=0x190;}_0x4b848e['status'](_0x3c33ed)['send'](_0xa8d4aa['query'][_0xcc9a('0x73')]?{'message':_0xcc9a('0x77'),'statusCode':_0x5a78e1[_0xcc9a('0x74')]}:_0x5a78e1);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ce00927..b96c679 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 _0xd1c9=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e6081,_0x51251b){var _0x2aa856=function(_0x5cf12d){while(--_0x5cf12d){_0x3e6081['push'](_0x3e6081['shift']());}};_0x2aa856(++_0x51251b);}(_0xd1c9,0x104));var _0x9d1c=function(_0x183e5e,_0x5d178e){_0x183e5e=_0x183e5e-0x0;var _0x25d3a4=_0xd1c9[_0x183e5e];return _0x25d3a4;};'use strict';var _=require(_0x9d1c('0x0'));var util=require(_0x9d1c('0x1'));var logger=require(_0x9d1c('0x2'))(_0x9d1c('0x3'));var moment=require(_0x9d1c('0x4'));var BPromise=require(_0x9d1c('0x5'));var rp=require(_0x9d1c('0x6'));var fs=require('fs');var path=require(_0x9d1c('0x7'));var rimraf=require(_0x9d1c('0x8'));var config=require(_0x9d1c('0x9'));var attributes=require(_0x9d1c('0xa'));var integrations=require(_0x9d1c('0xb'));module['exports']=function(_0x3f1193,_0x38b495){return _0x3f1193[_0x9d1c('0xc')]('VtigerAccount',attributes,{'tableName':_0x9d1c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x342e=['rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash','api','moment','bluebird','request-promise','path'];(function(_0x478de7,_0x124a61){var _0x55f18f=function(_0x5db56f){while(--_0x5db56f){_0x478de7['push'](_0x478de7['shift']());}};_0x55f18f(++_0x124a61);}(_0x342e,0xa3));var _0xe342=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0x342e[_0x439d59];return _0x3670c7;};'use strict';var _=require(_0xe342('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe342('0x1'));var moment=require(_0xe342('0x2'));var BPromise=require(_0xe342('0x3'));var rp=require(_0xe342('0x4'));var fs=require('fs');var path=require(_0xe342('0x5'));var rimraf=require(_0xe342('0x6'));var config=require(_0xe342('0x7'));var attributes=require(_0xe342('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe342('0x9')]=function(_0x312f6a,_0x572439){return _0x312f6a[_0xe342('0xa')](_0xe342('0xb'),attributes,{'tableName':_0xe342('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 208c8e6..495d638 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 _0x065e=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','find','ShowVtigerAccount','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0xaac9a4,_0x43ff18){var _0x1d58af=function(_0x2a1759){while(--_0x2a1759){_0xaac9a4['push'](_0xaac9a4['shift']());}};_0x1d58af(++_0x43ff18);}(_0x065e,0x1a7));var _0xe065=function(_0x59ae56,_0x583d62){_0x59ae56=_0x59ae56-0x0;var _0x2bdf0a=_0x065e[_0x59ae56];return _0x2bdf0a;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')]({'raw':_0x1d2f7a['options']?_0x1d2f7a[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')]['where']||null:null,'attributes':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]||null:null,'limit':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x18')]||null:null,'include':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1d2f7a[_0xe065('0x16')]['include'],function(_0x7208af){return{'model':db[_0x7208af[_0xe065('0x1b')]],'as':_0x7208af['as'],'attributes':_0x7208af[_0xe065('0x17')],'include':_0x7208af[_0xe065('0x19')]?_['map'](_0x7208af['include'],function(_0x164965){return{'model':db[_0x164965['model']],'as':_0x164965['as'],'attributes':_0x164965[_0xe065('0x17')],'include':_0x164965[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x164965[_0xe065('0x19')],function(_0x418731){return{'model':db[_0x418731[_0xe065('0x1b')]],'as':_0x418731['as'],'attributes':_0x418731[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x52cd9c){logger['info'](_0xe065('0x13'),_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x52cd9c));_0x14c97c(_0x52cd9c);})['catch'](function(_0x23f573){logger['error']('GetVtigerAccount',_0x23f573[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x23f573[_0xe065('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x883747){var _0x59b915=this;return new Promise(function(_0x12679d,_0x46db7e){return db[_0xe065('0x14')][_0xe065('0x1c')]({'raw':_0x883747['options']?_0x883747[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x883747[_0xe065('0x16')]?_0x883747[_0xe065('0x16')]['where']||null:null,'attributes':_0x883747[_0xe065('0x16')]?_0x883747['options'][_0xe065('0x17')]||null:null,'include':_0x883747['options']?_0x883747[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x883747[_0xe065('0x16')]['include'],function(_0x1fe1dc){return{'model':db[_0x1fe1dc[_0xe065('0x1b')]],'as':_0x1fe1dc['as'],'attributes':_0x1fe1dc[_0xe065('0x17')],'include':_0x1fe1dc[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1fe1dc[_0xe065('0x19')],function(_0x4b822a){return{'model':db[_0x4b822a[_0xe065('0x1b')]],'as':_0x4b822a['as'],'attributes':_0x4b822a[_0xe065('0x17')],'include':_0x4b822a['include']?_[_0xe065('0x1a')](_0x4b822a[_0xe065('0x19')],function(_0x5afc23){return{'model':db[_0x5afc23[_0xe065('0x1b')]],'as':_0x5afc23['as'],'attributes':_0x5afc23[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x35135f){logger['info'](_0xe065('0x1d'),_0x883747);logger['debug'](_0xe065('0x1d'),_0x883747,JSON[_0xe065('0xe')](_0x35135f));_0x12679d(_0x35135f);})[_0xe065('0x1e')](function(_0xcceb12){logger[_0xe065('0xf')](_0xe065('0x1d'),_0xcceb12['message'],_0x883747);_0x46db7e(_0x59b915[_0xe065('0xf')](0x1f4,_0xcceb12[_0xe065('0x11')]));});});}; \ No newline at end of file +var _0x5ec6=['util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','ShowVtigerAccount','find','lodash'];(function(_0x3b00d0,_0x28a3eb){var _0x299d8f=function(_0x1e5a6c){while(--_0x1e5a6c){_0x3b00d0['push'](_0x3b00d0['shift']());}};_0x299d8f(++_0x28a3eb);}(_0x5ec6,0x7f));var _0x65ec=function(_0x2dfe4b,_0x1ed38b){_0x2dfe4b=_0x2dfe4b-0x0;var _0x566fe=_0x5ec6[_0x2dfe4b];return _0x566fe;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('VtigerAccount,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')]({'raw':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x19')]||null:null,'attributes':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'limit':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')]['limit']||null:null,'include':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0x47288d){return{'model':db[_0x47288d['model']],'as':_0x47288d['as'],'attributes':_0x47288d[_0x65ec('0x1a')],'include':_0x47288d[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x47288d[_0x65ec('0x1b')],function(_0x288e66){return{'model':db[_0x288e66[_0x65ec('0x1d')]],'as':_0x288e66['as'],'attributes':_0x288e66[_0x65ec('0x1a')],'include':_0x288e66[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x288e66['include'],function(_0x10baef){return{'model':db[_0x10baef[_0x65ec('0x1d')]],'as':_0x10baef['as'],'attributes':_0x10baef[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x4de451){logger[_0x65ec('0x12')]('GetVtigerAccount',_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x4de451));_0x29ebc4(_0x4de451);})[_0x65ec('0x13')](function(_0x14431d){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x14431d[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x14431d[_0x65ec('0x11')]));});});};exports[_0x65ec('0x1e')]=function(_0x4b435c){var _0x50d81f=this;return new Promise(function(_0x1d2e24,_0x5084af){return db[_0x65ec('0x15')][_0x65ec('0x1f')]({'raw':_0x4b435c['options']?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')]['where']||null:null,'attributes':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'include':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0xff3f3c){return{'model':db[_0xff3f3c['model']],'as':_0xff3f3c['as'],'attributes':_0xff3f3c[_0x65ec('0x1a')],'include':_0xff3f3c[_0x65ec('0x1b')]?_['map'](_0xff3f3c[_0x65ec('0x1b')],function(_0x24a242){return{'model':db[_0x24a242[_0x65ec('0x1d')]],'as':_0x24a242['as'],'attributes':_0x24a242[_0x65ec('0x1a')],'include':_0x24a242[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x24a242[_0x65ec('0x1b')],function(_0x5afcfc){return{'model':db[_0x5afcfc[_0x65ec('0x1d')]],'as':_0x5afcfc['as'],'attributes':_0x5afcfc[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x185447){logger['info'](_0x65ec('0x1e'),_0x4b435c);logger[_0x65ec('0xc')](_0x65ec('0x1e'),_0x4b435c,JSON[_0x65ec('0xe')](_0x185447));_0x1d2e24(_0x185447);})['catch'](function(_0x59a1c2){logger[_0x65ec('0xf')]('ShowVtigerAccount',_0x59a1c2[_0x65ec('0x11')],_0x4b435c);_0x5084af(_0x50d81f[_0x65ec('0xf')](0x1f4,_0x59a1c2['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 9a3d73b..b721a66 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 _0xdefb=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x40c057,_0x50978f){var _0x3db0fe=function(_0x4ea8f0){while(--_0x4ea8f0){_0x40c057['push'](_0x40c057['shift']());}};_0x3db0fe(++_0x50978f);}(_0xdefb,0x154));var _0xbdef=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xdefb[_0x445c98];return _0x2fe913;};'use strict';var multer=require(_0xbdef('0x0'));var util=require(_0xbdef('0x1'));var path=require('path');var timeout=require(_0xbdef('0x2'));var express=require(_0xbdef('0x3'));var router=express[_0xbdef('0x4')]();var fs_extra=require(_0xbdef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbdef('0x6'));var config=require(_0xbdef('0x7'));var controller=require(_0xbdef('0x8'));router[_0xbdef('0x9')]('/',auth[_0xbdef('0xa')](),controller[_0xbdef('0xb')]);router['get'](_0xbdef('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbdef('0x9')]('/:id/fields',auth[_0xbdef('0xa')](),controller[_0xbdef('0xd')]);router[_0xbdef('0x9')](_0xbdef('0xe'),auth[_0xbdef('0xa')](),controller['getSubjects']);router[_0xbdef('0x9')](_0xbdef('0xf'),auth[_0xbdef('0xa')](),controller[_0xbdef('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xbdef('0xa')](),controller[_0xbdef('0x11')]);router[_0xbdef('0x12')](_0xbdef('0xc'),auth['isAuthenticated'](),controller[_0xbdef('0x13')]);module[_0xbdef('0x14')]=router; \ No newline at end of file +var _0xad2b=['/:id/fields','getFields','/:id/subjects','isAuthenticated','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','index','/:id'];(function(_0x497b55,_0x36351f){var _0x1342b0=function(_0x5a0c27){while(--_0x5a0c27){_0x497b55['push'](_0x497b55['shift']());}};_0x1342b0(++_0x36351f);}(_0xad2b,0x12e));var _0xbad2=function(_0x5259e2,_0x48ae43){_0x5259e2=_0x5259e2-0x0;var _0x13376e=_0xad2b[_0x5259e2];return _0x13376e;};'use strict';var multer=require(_0xbad2('0x0'));var util=require(_0xbad2('0x1'));var path=require(_0xbad2('0x2'));var timeout=require(_0xbad2('0x3'));var express=require(_0xbad2('0x4'));var router=express[_0xbad2('0x5')]();var fs_extra=require(_0xbad2('0x6'));var auth=require(_0xbad2('0x7'));var interaction=require(_0xbad2('0x8'));var config=require('../../config/environment');var controller=require(_0xbad2('0x9'));router[_0xbad2('0xa')]('/',auth['isAuthenticated'](),controller[_0xbad2('0xb')]);router['get'](_0xbad2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbad2('0xa')](_0xbad2('0xd'),auth['isAuthenticated'](),controller[_0xbad2('0xe')]);router[_0xbad2('0xa')](_0xbad2('0xf'),auth[_0xbad2('0x10')](),controller['getSubjects']);router[_0xbad2('0xa')]('/:id/descriptions',auth[_0xbad2('0x10')](),controller['getDescriptions']);router[_0xbad2('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbad2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbad2('0x12')](_0xbad2('0xc'),auth[_0xbad2('0x10')](),controller[_0xbad2('0x13')]);module[_0xbad2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 68c55b9..5d0f98a 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 _0x0eb8=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0eb8,0x1f3));var _0x80eb=function(_0x26456b,_0x29bcc3){_0x26456b=_0x26456b-0x0;var _0x2d4b1c=_0x0eb8[_0x26456b];return _0x2d4b1c;};'use strict';var Sequelize=require(_0x80eb('0x0'));module['exports']={'name':{'type':Sequelize[_0x80eb('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x33b9=['sequelize','exports','STRING'];(function(_0x57d7f4,_0x45665d){var _0x2d49da=function(_0x9198a9){while(--_0x9198a9){_0x57d7f4['push'](_0x57d7f4['shift']());}};_0x2d49da(++_0x45665d);}(_0x33b9,0x189));var _0x933b=function(_0x484b90,_0x2b8c37){_0x484b90=_0x484b90-0x0;var _0x3f2b1f=_0x33b9[_0x484b90];return _0x3f2b1f;};'use strict';var Sequelize=require(_0x933b('0x0'));module[_0x933b('0x1')]={'name':{'type':Sequelize[_0x933b('0x2')]},'description':{'type':Sequelize[_0x933b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 28e0865..d3c52e9 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 _0x4e14=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VtigerConfiguration','includeAll','findAll','rows','show','filters','length','include','find','catch','create','body','update','params','VtigerField','pick','options','getFields','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','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','status','end','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4e14,0x10c));var _0x44e1=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x4e14[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0x44e1('0x0'));var rimraf=require(_0x44e1('0x1'));var zipdir=require(_0x44e1('0x2'));var jsonpatch=require(_0x44e1('0x3'));var rp=require(_0x44e1('0x4'));var moment=require(_0x44e1('0x5'));var BPromise=require(_0x44e1('0x6'));var Mustache=require(_0x44e1('0x7'));var util=require('util');var path=require(_0x44e1('0x8'));var sox=require(_0x44e1('0x9'));var csv=require(_0x44e1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44e1('0xb'));var squel=require(_0x44e1('0xc'));var crypto=require(_0x44e1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44e1('0xe'));var toCsv=require(_0x44e1('0xa'));var querystring=require(_0x44e1('0xf'));var Papa=require(_0x44e1('0x10'));var Redis=require(_0x44e1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x44e1('0x12'));var as=require(_0x44e1('0x13'));var hardwareService=require(_0x44e1('0x14'));var logger=require(_0x44e1('0x15'))(_0x44e1('0x16'));var utils=require(_0x44e1('0x17'));var config=require(_0x44e1('0x18'));var licenseUtil=require(_0x44e1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c5b7,_0x259174){_0x259174=_0x259174||0xcc;return function(_0x609c3c){if(_0x609c3c){return _0x50c5b7['sendStatus'](_0x259174);}return _0x50c5b7[_0x44e1('0x1a')](_0x259174)[_0x44e1('0x1b')]();};}function respondWithResult(_0x3cf25c,_0xf03491){_0xf03491=_0xf03491||0xc8;return function(_0x51e3b7){if(_0x51e3b7){return _0x3cf25c[_0x44e1('0x1a')](_0xf03491)[_0x44e1('0x1c')](_0x51e3b7);}};}function respondWithFilteredResult(_0x2720ec,_0x44093f){return function(_0x589cd4){if(_0x589cd4){var _0x51a1cb=typeof _0x44093f[_0x44e1('0x1d')]==='undefined'&&typeof _0x44093f[_0x44e1('0x1e')]==='undefined';var _0x5c0cbd=_0x589cd4[_0x44e1('0x1f')];var _0x1b2d09=_0x51a1cb?0x0:_0x44093f[_0x44e1('0x1d')];var _0x217c6c=_0x51a1cb?_0x589cd4['count']:_0x44093f[_0x44e1('0x1d')]+_0x44093f[_0x44e1('0x1e')];var _0x5f3372;if(_0x217c6c>=_0x5c0cbd){_0x217c6c=_0x5c0cbd;_0x5f3372=0xc8;}else{_0x5f3372=0xce;}_0x2720ec[_0x44e1('0x1a')](_0x5f3372);return _0x2720ec[_0x44e1('0x20')](_0x44e1('0x21'),_0x1b2d09+'-'+_0x217c6c+'/'+_0x5c0cbd)['json'](_0x589cd4);}return null;};}function patchUpdates(_0xbe43f3){return function(_0x22af7e){try{jsonpatch[_0x44e1('0x22')](_0x22af7e,_0xbe43f3,!![]);}catch(_0x3199d5){return BPromise['reject'](_0x3199d5);}return _0x22af7e[_0x44e1('0x23')]();};}function saveUpdates(_0x24580a,_0x2d541a){return function(_0x44fe24){if(_0x44fe24){return _0x44fe24['update'](_0x24580a)[_0x44e1('0x24')](function(_0x3fa429){return _0x3fa429;});}return null;};}function removeEntity(_0xad98fa,_0x652818){return function(_0x1d8d7e){if(_0x1d8d7e){return _0x1d8d7e[_0x44e1('0x25')]()[_0x44e1('0x24')](function(){_0xad98fa['status'](0xcc)[_0x44e1('0x1b')]();});}};}function handleEntityNotFound(_0x346c29,_0x1403bf){return function(_0x4f3413){if(!_0x4f3413){_0x346c29['sendStatus'](0x194);}return _0x4f3413;};}function handleError(_0x358874,_0x5186b7){_0x5186b7=_0x5186b7||0x1f4;return function(_0x576f0e){logger[_0x44e1('0x26')](_0x576f0e[_0x44e1('0x27')]);if(_0x576f0e[_0x44e1('0x28')]){delete _0x576f0e[_0x44e1('0x28')];}_0x358874['status'](_0x5186b7)[_0x44e1('0x29')](_0x576f0e);};}exports['index']=function(_0x54d798,_0x4dcaf3){var _0x5b8705={},_0x4ca80d={},_0xab6546={'count':0x0,'rows':[]};var _0x38afc2=_['map'](db['VtigerConfiguration'][_0x44e1('0x2a')],function(_0x2bc8e1){return{'name':_0x2bc8e1[_0x44e1('0x2b')],'type':_0x2bc8e1[_0x44e1('0x2c')]['key']};});_0x4ca80d[_0x44e1('0x2d')]=_[_0x44e1('0x2e')](_0x38afc2,_0x44e1('0x28'));_0x4ca80d[_0x44e1('0x2f')]=_[_0x44e1('0x30')](_0x54d798[_0x44e1('0x2f')]);_0x4ca80d['filters']=_[_0x44e1('0x31')](_0x4ca80d['model'],_0x4ca80d[_0x44e1('0x2f')]);_0x5b8705[_0x44e1('0x32')]=_['intersection'](_0x4ca80d[_0x44e1('0x2d')],qs[_0x44e1('0x33')](_0x54d798[_0x44e1('0x2f')][_0x44e1('0x33')]));_0x5b8705['attributes']=_0x5b8705[_0x44e1('0x32')]['length']?_0x5b8705[_0x44e1('0x32')]:_0x4ca80d[_0x44e1('0x2d')];if(!_0x54d798['query'][_0x44e1('0x34')](_0x44e1('0x35'))){_0x5b8705[_0x44e1('0x1e')]=qs[_0x44e1('0x1e')](_0x54d798['query'][_0x44e1('0x1e')]);_0x5b8705[_0x44e1('0x1d')]=qs[_0x44e1('0x1d')](_0x54d798[_0x44e1('0x2f')][_0x44e1('0x1d')]);}_0x5b8705[_0x44e1('0x36')]=qs['sort'](_0x54d798[_0x44e1('0x2f')][_0x44e1('0x37')]);_0x5b8705[_0x44e1('0x38')]=qs['filters'](_['pick'](_0x54d798[_0x44e1('0x2f')],_0x4ca80d['filters']),_0x38afc2);if(_0x54d798['query'][_0x44e1('0x39')]){_0x5b8705[_0x44e1('0x38')]=_[_0x44e1('0x3a')](_0x5b8705[_0x44e1('0x38')],{'$or':_[_0x44e1('0x2e')](_0x38afc2,function(_0x5746b1){if(_0x5746b1[_0x44e1('0x2c')]!=='VIRTUAL'){var _0x5d2a5d={};_0x5d2a5d[_0x5746b1[_0x44e1('0x28')]]={'$like':'%'+_0x54d798[_0x44e1('0x2f')][_0x44e1('0x39')]+'%'};return _0x5d2a5d;}})});}_0x5b8705=_[_0x44e1('0x3a')]({},_0x5b8705,_0x54d798['options']);var _0x3695d6={'where':_0x5b8705[_0x44e1('0x38')]};return db[_0x44e1('0x3b')][_0x44e1('0x1f')](_0x3695d6)['then'](function(_0x5ef8a2){_0xab6546[_0x44e1('0x1f')]=_0x5ef8a2;if(_0x54d798[_0x44e1('0x2f')][_0x44e1('0x3c')]){_0x5b8705['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x44e1('0x3d')](_0x5b8705);})[_0x44e1('0x24')](function(_0x27bd8b){_0xab6546[_0x44e1('0x3e')]=_0x27bd8b;return _0xab6546;})['then'](respondWithFilteredResult(_0x4dcaf3,_0x5b8705))['catch'](handleError(_0x4dcaf3,null));};exports[_0x44e1('0x3f')]=function(_0x3cd3c0,_0x38a5e8){var _0x53b2ad={'raw':![],'where':{'id':_0x3cd3c0['params']['id']}},_0x367e69={};_0x367e69[_0x44e1('0x2d')]=_[_0x44e1('0x30')](db[_0x44e1('0x3b')][_0x44e1('0x2a')]);_0x367e69[_0x44e1('0x2f')]=_[_0x44e1('0x30')](_0x3cd3c0['query']);_0x367e69[_0x44e1('0x40')]=_['intersection'](_0x367e69[_0x44e1('0x2d')],_0x367e69[_0x44e1('0x2f')]);_0x53b2ad[_0x44e1('0x32')]=_[_0x44e1('0x31')](_0x367e69[_0x44e1('0x2d')],qs[_0x44e1('0x33')](_0x3cd3c0['query'][_0x44e1('0x33')]));_0x53b2ad[_0x44e1('0x32')]=_0x53b2ad['attributes'][_0x44e1('0x41')]?_0x53b2ad[_0x44e1('0x32')]:_0x367e69[_0x44e1('0x2d')];if(_0x3cd3c0[_0x44e1('0x2f')][_0x44e1('0x3c')]){_0x53b2ad[_0x44e1('0x42')]=[{'all':!![]}];}_0x53b2ad=_[_0x44e1('0x3a')]({},_0x53b2ad,_0x3cd3c0['options']);return db['VtigerConfiguration'][_0x44e1('0x43')](_0x53b2ad)[_0x44e1('0x24')](handleEntityNotFound(_0x38a5e8,null))['then'](respondWithResult(_0x38a5e8,null))[_0x44e1('0x44')](handleError(_0x38a5e8,null));};exports[_0x44e1('0x45')]=function(_0x203980,_0x1f773c){return db[_0x44e1('0x3b')][_0x44e1('0x45')](_0x203980[_0x44e1('0x46')],{})['then'](respondWithResult(_0x1f773c,0xc9))[_0x44e1('0x44')](handleError(_0x1f773c,null));};exports[_0x44e1('0x47')]=function(_0x7c3100,_0x50225b){if(_0x7c3100[_0x44e1('0x46')]['id']){delete _0x7c3100['body']['id'];}return db['VtigerConfiguration'][_0x44e1('0x43')]({'where':{'id':_0x7c3100[_0x44e1('0x48')]['id']}})[_0x44e1('0x24')](handleEntityNotFound(_0x50225b,null))[_0x44e1('0x24')](saveUpdates(_0x7c3100[_0x44e1('0x46')],null))[_0x44e1('0x24')](respondWithResult(_0x50225b,null))['catch'](handleError(_0x50225b,null));};exports['destroy']=function(_0x5d4546,_0x514889){return db[_0x44e1('0x3b')][_0x44e1('0x43')]({'where':{'id':_0x5d4546[_0x44e1('0x48')]['id']}})[_0x44e1('0x24')](handleEntityNotFound(_0x514889,null))[_0x44e1('0x24')](removeEntity(_0x514889,null))[_0x44e1('0x44')](handleError(_0x514889,null));};exports['getFields']=function(_0x5ebe50,_0x2d411a,_0xc78e22){var _0x3c44c7={};var _0x2c6897={};var _0x778577;var _0x62dbc9;return db[_0x44e1('0x3b')]['findOne']({'where':{'id':_0x5ebe50[_0x44e1('0x48')]['id']}})[_0x44e1('0x24')](handleEntityNotFound(_0x2d411a,null))[_0x44e1('0x24')](function(_0x263bad){if(_0x263bad){_0x778577=_0x263bad;_0x2c6897[_0x44e1('0x2d')]=_[_0x44e1('0x30')](db[_0x44e1('0x49')][_0x44e1('0x2a')]);_0x2c6897['query']=_['keys'](_0x5ebe50[_0x44e1('0x2f')]);_0x2c6897[_0x44e1('0x40')]=_[_0x44e1('0x31')](_0x2c6897['model'],_0x2c6897[_0x44e1('0x2f')]);_0x3c44c7[_0x44e1('0x32')]=_[_0x44e1('0x31')](_0x2c6897['model'],qs['fields'](_0x5ebe50[_0x44e1('0x2f')][_0x44e1('0x33')]));_0x3c44c7[_0x44e1('0x32')]=_0x3c44c7[_0x44e1('0x32')][_0x44e1('0x41')]?_0x3c44c7[_0x44e1('0x32')]:_0x2c6897[_0x44e1('0x2d')];_0x3c44c7['order']=qs[_0x44e1('0x37')](_0x5ebe50[_0x44e1('0x2f')]['sort']);_0x3c44c7[_0x44e1('0x38')]=qs[_0x44e1('0x40')](_[_0x44e1('0x4a')](_0x5ebe50[_0x44e1('0x2f')],_0x2c6897[_0x44e1('0x40')]));if(_0x5ebe50[_0x44e1('0x2f')][_0x44e1('0x39')]){_0x3c44c7[_0x44e1('0x38')]=_[_0x44e1('0x3a')](_0x3c44c7[_0x44e1('0x38')],{'$or':_[_0x44e1('0x2e')](_0x3c44c7[_0x44e1('0x32')],function(_0x12eb9a){var _0x26ef57={};_0x26ef57[_0x12eb9a]={'$like':'%'+_0x5ebe50['query']['filter']+'%'};return _0x26ef57;})});}_0x3c44c7=_[_0x44e1('0x3a')]({},_0x3c44c7,_0x5ebe50[_0x44e1('0x4b')]);return _0x778577[_0x44e1('0x4c')](_0x3c44c7);}})[_0x44e1('0x24')](function(_0x4d3205){if(_0x4d3205){_0x62dbc9=_0x4d3205[_0x44e1('0x41')];if(!_0x5ebe50['query'][_0x44e1('0x34')](_0x44e1('0x35'))){_0x3c44c7[_0x44e1('0x1e')]=qs[_0x44e1('0x1e')](_0x5ebe50[_0x44e1('0x2f')][_0x44e1('0x1e')]);_0x3c44c7[_0x44e1('0x1d')]=qs[_0x44e1('0x1d')](_0x5ebe50[_0x44e1('0x2f')][_0x44e1('0x1d')]);}return _0x778577[_0x44e1('0x4c')](_0x3c44c7);}})['then'](function(_0x1f45e0){if(_0x1f45e0){return _0x1f45e0?{'count':_0x62dbc9,'rows':_0x1f45e0}:null;}})['then'](respondWithResult(_0x2d411a,null))[_0x44e1('0x44')](handleError(_0x2d411a,null));};exports['getSubjects']=function(_0x401dfd,_0x3687e4,_0x4b71bb){var _0x22b2b2={};var _0x1dc2d4={};var _0x1754df;var _0x49c4d9;return db[_0x44e1('0x3b')][_0x44e1('0x4d')]({'where':{'id':_0x401dfd[_0x44e1('0x48')]['id']}})[_0x44e1('0x24')](handleEntityNotFound(_0x3687e4,null))[_0x44e1('0x24')](function(_0xbf4614){if(_0xbf4614){_0x1754df=_0xbf4614;_0x1dc2d4[_0x44e1('0x2d')]=_[_0x44e1('0x30')](db[_0x44e1('0x49')][_0x44e1('0x2a')]);_0x1dc2d4['query']=_[_0x44e1('0x30')](_0x401dfd[_0x44e1('0x2f')]);_0x1dc2d4[_0x44e1('0x40')]=_[_0x44e1('0x31')](_0x1dc2d4[_0x44e1('0x2d')],_0x1dc2d4[_0x44e1('0x2f')]);_0x22b2b2[_0x44e1('0x32')]=_[_0x44e1('0x31')](_0x1dc2d4[_0x44e1('0x2d')],qs[_0x44e1('0x33')](_0x401dfd[_0x44e1('0x2f')][_0x44e1('0x33')]));_0x22b2b2[_0x44e1('0x32')]=_0x22b2b2[_0x44e1('0x32')][_0x44e1('0x41')]?_0x22b2b2[_0x44e1('0x32')]:_0x1dc2d4['model'];_0x22b2b2[_0x44e1('0x36')]=qs[_0x44e1('0x37')](_0x401dfd['query']['sort']);_0x22b2b2[_0x44e1('0x38')]=qs[_0x44e1('0x40')](_[_0x44e1('0x4a')](_0x401dfd['query'],_0x1dc2d4[_0x44e1('0x40')]));if(_0x401dfd[_0x44e1('0x2f')][_0x44e1('0x39')]){_0x22b2b2['where']=_[_0x44e1('0x3a')](_0x22b2b2[_0x44e1('0x38')],{'$or':_[_0x44e1('0x2e')](_0x22b2b2[_0x44e1('0x32')],function(_0xb89fd0){var _0x391c12={};_0x391c12[_0xb89fd0]={'$like':'%'+_0x401dfd[_0x44e1('0x2f')][_0x44e1('0x39')]+'%'};return _0x391c12;})});}_0x22b2b2=_['merge']({},_0x22b2b2,_0x401dfd[_0x44e1('0x4b')]);return _0x1754df[_0x44e1('0x4e')](_0x22b2b2);}})[_0x44e1('0x24')](function(_0x337b88){if(_0x337b88){_0x49c4d9=_0x337b88[_0x44e1('0x41')];if(!_0x401dfd[_0x44e1('0x2f')][_0x44e1('0x34')](_0x44e1('0x35'))){_0x22b2b2[_0x44e1('0x1e')]=qs[_0x44e1('0x1e')](_0x401dfd['query'][_0x44e1('0x1e')]);_0x22b2b2[_0x44e1('0x1d')]=qs['offset'](_0x401dfd['query'][_0x44e1('0x1d')]);}return _0x1754df['getSubjects'](_0x22b2b2);}})['then'](function(_0xd8d178){if(_0xd8d178){return _0xd8d178?{'count':_0x49c4d9,'rows':_0xd8d178}:null;}})[_0x44e1('0x24')](respondWithResult(_0x3687e4,null))['catch'](handleError(_0x3687e4,null));};exports[_0x44e1('0x4f')]=function(_0x44b950,_0x5c7a2e,_0x58c44b){var _0xb9b020={};var _0x25cd34={};var _0x1583db;var _0x5256c7;return db[_0x44e1('0x3b')]['findOne']({'where':{'id':_0x44b950[_0x44e1('0x48')]['id']}})[_0x44e1('0x24')](handleEntityNotFound(_0x5c7a2e,null))[_0x44e1('0x24')](function(_0x3fba8e){if(_0x3fba8e){_0x1583db=_0x3fba8e;_0x25cd34[_0x44e1('0x2d')]=_[_0x44e1('0x30')](db[_0x44e1('0x49')][_0x44e1('0x2a')]);_0x25cd34[_0x44e1('0x2f')]=_[_0x44e1('0x30')](_0x44b950[_0x44e1('0x2f')]);_0x25cd34['filters']=_[_0x44e1('0x31')](_0x25cd34[_0x44e1('0x2d')],_0x25cd34[_0x44e1('0x2f')]);_0xb9b020[_0x44e1('0x32')]=_['intersection'](_0x25cd34['model'],qs['fields'](_0x44b950[_0x44e1('0x2f')][_0x44e1('0x33')]));_0xb9b020[_0x44e1('0x32')]=_0xb9b020[_0x44e1('0x32')][_0x44e1('0x41')]?_0xb9b020[_0x44e1('0x32')]:_0x25cd34[_0x44e1('0x2d')];_0xb9b020[_0x44e1('0x36')]=qs['sort'](_0x44b950[_0x44e1('0x2f')][_0x44e1('0x37')]);_0xb9b020['where']=qs[_0x44e1('0x40')](_[_0x44e1('0x4a')](_0x44b950[_0x44e1('0x2f')],_0x25cd34[_0x44e1('0x40')]));if(_0x44b950[_0x44e1('0x2f')]['filter']){_0xb9b020[_0x44e1('0x38')]=_[_0x44e1('0x3a')](_0xb9b020[_0x44e1('0x38')],{'$or':_[_0x44e1('0x2e')](_0xb9b020[_0x44e1('0x32')],function(_0x22cdd9){var _0x1f88fd={};_0x1f88fd[_0x22cdd9]={'$like':'%'+_0x44b950['query'][_0x44e1('0x39')]+'%'};return _0x1f88fd;})});}_0xb9b020=_[_0x44e1('0x3a')]({},_0xb9b020,_0x44b950['options']);return _0x1583db['getDescriptions'](_0xb9b020);}})['then'](function(_0x3d471b){if(_0x3d471b){_0x5256c7=_0x3d471b[_0x44e1('0x41')];if(!_0x44b950[_0x44e1('0x2f')][_0x44e1('0x34')](_0x44e1('0x35'))){_0xb9b020['limit']=qs[_0x44e1('0x1e')](_0x44b950['query'][_0x44e1('0x1e')]);_0xb9b020[_0x44e1('0x1d')]=qs[_0x44e1('0x1d')](_0x44b950[_0x44e1('0x2f')][_0x44e1('0x1d')]);}return _0x1583db[_0x44e1('0x4f')](_0xb9b020);}})[_0x44e1('0x24')](function(_0x1a4695){if(_0x1a4695){return _0x1a4695?{'count':_0x5256c7,'rows':_0x1a4695}:null;}})[_0x44e1('0x24')](respondWithResult(_0x5c7a2e,null))[_0x44e1('0x44')](handleError(_0x5c7a2e,null));}; \ No newline at end of file +var _0x8482=['rows','show','length','includeAll','include','find','create','body','catch','params','findOne','VtigerField','pick','getFields','getSubjects','order','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','options','findAll'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8482,0x14e));var _0x2848=function(_0x442303,_0x4e860a){_0x442303=_0x442303-0x0;var _0x5e12d8=_0x8482[_0x442303];return _0x5e12d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2848('0x0'));var zipdir=require(_0x2848('0x1'));var jsonpatch=require(_0x2848('0x2'));var rp=require(_0x2848('0x3'));var moment=require(_0x2848('0x4'));var BPromise=require(_0x2848('0x5'));var Mustache=require(_0x2848('0x6'));var util=require(_0x2848('0x7'));var path=require(_0x2848('0x8'));var sox=require(_0x2848('0x9'));var csv=require('to-csv');var ejs=require(_0x2848('0xa'));var fs=require('fs');var fs_extra=require(_0x2848('0xb'));var _=require('lodash');var squel=require(_0x2848('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2848('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2848('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2848('0xf'));var as=require(_0x2848('0x10'));var hardwareService=require(_0x2848('0x11'));var logger=require(_0x2848('0x12'))(_0x2848('0x13'));var utils=require(_0x2848('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2848('0x15'))['db'];function respondWithStatusCode(_0x465380,_0xf0658d){_0xf0658d=_0xf0658d||0xcc;return function(_0x566a0b){if(_0x566a0b){return _0x465380[_0x2848('0x16')](_0xf0658d);}return _0x465380[_0x2848('0x17')](_0xf0658d)[_0x2848('0x18')]();};}function respondWithResult(_0x5e64c7,_0xbddd26){_0xbddd26=_0xbddd26||0xc8;return function(_0x501a0e){if(_0x501a0e){return _0x5e64c7[_0x2848('0x17')](_0xbddd26)['json'](_0x501a0e);}};}function respondWithFilteredResult(_0x1002d2,_0xeba65b){return function(_0x6600c5){if(_0x6600c5){var _0x59f39a=typeof _0xeba65b['offset']==='undefined'&&typeof _0xeba65b['limit']===_0x2848('0x19');var _0x1acd41=_0x6600c5[_0x2848('0x1a')];var _0x46755c=_0x59f39a?0x0:_0xeba65b[_0x2848('0x1b')];var _0x3b4eeb=_0x59f39a?_0x6600c5[_0x2848('0x1a')]:_0xeba65b[_0x2848('0x1b')]+_0xeba65b[_0x2848('0x1c')];var _0x193ffa;if(_0x3b4eeb>=_0x1acd41){_0x3b4eeb=_0x1acd41;_0x193ffa=0xc8;}else{_0x193ffa=0xce;}_0x1002d2[_0x2848('0x17')](_0x193ffa);return _0x1002d2['set'](_0x2848('0x1d'),_0x46755c+'-'+_0x3b4eeb+'/'+_0x1acd41)[_0x2848('0x1e')](_0x6600c5);}return null;};}function patchUpdates(_0x1a1f79){return function(_0x5748ae){try{jsonpatch[_0x2848('0x1f')](_0x5748ae,_0x1a1f79,!![]);}catch(_0x1f67a7){return BPromise[_0x2848('0x20')](_0x1f67a7);}return _0x5748ae[_0x2848('0x21')]();};}function saveUpdates(_0x3b99a2,_0x555279){return function(_0x3dd7db){if(_0x3dd7db){return _0x3dd7db[_0x2848('0x22')](_0x3b99a2)[_0x2848('0x23')](function(_0x436709){return _0x436709;});}return null;};}function removeEntity(_0xea4128,_0x40f510){return function(_0x5f38e2){if(_0x5f38e2){return _0x5f38e2[_0x2848('0x24')]()['then'](function(){_0xea4128[_0x2848('0x17')](0xcc)[_0x2848('0x18')]();});}};}function handleEntityNotFound(_0x2d936a,_0x4517d3){return function(_0x51c924){if(!_0x51c924){_0x2d936a[_0x2848('0x16')](0x194);}return _0x51c924;};}function handleError(_0xecd4f4,_0xdba069){_0xdba069=_0xdba069||0x1f4;return function(_0x2dc32e){logger[_0x2848('0x25')](_0x2dc32e[_0x2848('0x26')]);if(_0x2dc32e[_0x2848('0x27')]){delete _0x2dc32e['name'];}_0xecd4f4['status'](_0xdba069)['send'](_0x2dc32e);};}exports[_0x2848('0x28')]=function(_0x18df37,_0x3b9c0d){var _0x3f915b={},_0x189701={},_0x528825={'count':0x0,'rows':[]};var _0x4c9685=_['map'](db[_0x2848('0x29')][_0x2848('0x2a')],function(_0x1ff601){return{'name':_0x1ff601[_0x2848('0x2b')],'type':_0x1ff601[_0x2848('0x2c')][_0x2848('0x2d')]};});_0x189701[_0x2848('0x2e')]=_[_0x2848('0x2f')](_0x4c9685,_0x2848('0x27'));_0x189701[_0x2848('0x30')]=_[_0x2848('0x31')](_0x18df37['query']);_0x189701[_0x2848('0x32')]=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],_0x189701[_0x2848('0x30')]);_0x3f915b['attributes']=_[_0x2848('0x33')](_0x189701[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x18df37[_0x2848('0x30')]['fields']));_0x3f915b['attributes']=_0x3f915b['attributes']['length']?_0x3f915b[_0x2848('0x35')]:_0x189701[_0x2848('0x2e')];if(!_0x18df37['query']['hasOwnProperty'](_0x2848('0x36'))){_0x3f915b[_0x2848('0x1c')]=qs[_0x2848('0x1c')](_0x18df37[_0x2848('0x30')][_0x2848('0x1c')]);_0x3f915b['offset']=qs[_0x2848('0x1b')](_0x18df37[_0x2848('0x30')][_0x2848('0x1b')]);}_0x3f915b['order']=qs[_0x2848('0x37')](_0x18df37[_0x2848('0x30')][_0x2848('0x37')]);_0x3f915b[_0x2848('0x38')]=qs[_0x2848('0x32')](_['pick'](_0x18df37['query'],_0x189701[_0x2848('0x32')]),_0x4c9685);if(_0x18df37[_0x2848('0x30')][_0x2848('0x39')]){_0x3f915b[_0x2848('0x38')]=_[_0x2848('0x3a')](_0x3f915b[_0x2848('0x38')],{'$or':_['map'](_0x4c9685,function(_0x489ed8){if(_0x489ed8['type']!=='VIRTUAL'){var _0x5c3d4e={};_0x5c3d4e[_0x489ed8[_0x2848('0x27')]]={'$like':'%'+_0x18df37['query'][_0x2848('0x39')]+'%'};return _0x5c3d4e;}})});}_0x3f915b=_['merge']({},_0x3f915b,_0x18df37[_0x2848('0x3b')]);var _0x24af01={'where':_0x3f915b[_0x2848('0x38')]};return db['VtigerConfiguration'][_0x2848('0x1a')](_0x24af01)[_0x2848('0x23')](function(_0x368ef1){_0x528825[_0x2848('0x1a')]=_0x368ef1;if(_0x18df37[_0x2848('0x30')]['includeAll']){_0x3f915b['include']=[{'all':!![]}];}return db[_0x2848('0x29')][_0x2848('0x3c')](_0x3f915b);})[_0x2848('0x23')](function(_0xfe7e37){_0x528825[_0x2848('0x3d')]=_0xfe7e37;return _0x528825;})[_0x2848('0x23')](respondWithFilteredResult(_0x3b9c0d,_0x3f915b))['catch'](handleError(_0x3b9c0d,null));};exports[_0x2848('0x3e')]=function(_0x5ef41f,_0x3208f2){var _0x56d0fa={'raw':![],'where':{'id':_0x5ef41f['params']['id']}},_0x32f51a={};_0x32f51a['model']=_['keys'](db['VtigerConfiguration'][_0x2848('0x2a')]);_0x32f51a[_0x2848('0x30')]=_[_0x2848('0x31')](_0x5ef41f[_0x2848('0x30')]);_0x32f51a[_0x2848('0x32')]=_[_0x2848('0x33')](_0x32f51a[_0x2848('0x2e')],_0x32f51a[_0x2848('0x30')]);_0x56d0fa[_0x2848('0x35')]=_['intersection'](_0x32f51a[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x5ef41f[_0x2848('0x30')]['fields']));_0x56d0fa[_0x2848('0x35')]=_0x56d0fa[_0x2848('0x35')][_0x2848('0x3f')]?_0x56d0fa[_0x2848('0x35')]:_0x32f51a[_0x2848('0x2e')];if(_0x5ef41f['query'][_0x2848('0x40')]){_0x56d0fa[_0x2848('0x41')]=[{'all':!![]}];}_0x56d0fa=_[_0x2848('0x3a')]({},_0x56d0fa,_0x5ef41f[_0x2848('0x3b')]);return db['VtigerConfiguration'][_0x2848('0x42')](_0x56d0fa)[_0x2848('0x23')](handleEntityNotFound(_0x3208f2,null))[_0x2848('0x23')](respondWithResult(_0x3208f2,null))['catch'](handleError(_0x3208f2,null));};exports[_0x2848('0x43')]=function(_0xf6c69,_0x53420b){return db['VtigerConfiguration'][_0x2848('0x43')](_0xf6c69[_0x2848('0x44')],{})[_0x2848('0x23')](respondWithResult(_0x53420b,0xc9))[_0x2848('0x45')](handleError(_0x53420b,null));};exports[_0x2848('0x22')]=function(_0x4e4b1e,_0x35ed61){if(_0x4e4b1e[_0x2848('0x44')]['id']){delete _0x4e4b1e[_0x2848('0x44')]['id'];}return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0x4e4b1e[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x35ed61,null))[_0x2848('0x23')](saveUpdates(_0x4e4b1e[_0x2848('0x44')],null))[_0x2848('0x23')](respondWithResult(_0x35ed61,null))[_0x2848('0x45')](handleError(_0x35ed61,null));};exports[_0x2848('0x24')]=function(_0xe8e50,_0x1a8946){return db[_0x2848('0x29')][_0x2848('0x42')]({'where':{'id':_0xe8e50[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x1a8946,null))[_0x2848('0x23')](removeEntity(_0x1a8946,null))[_0x2848('0x45')](handleError(_0x1a8946,null));};exports['getFields']=function(_0x2814a2,_0x3b996e,_0x5c3d5a){var _0x4021c6={};var _0x40968d={};var _0x5bb656;var _0x3a8f91;return db['VtigerConfiguration'][_0x2848('0x47')]({'where':{'id':_0x2814a2[_0x2848('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b996e,null))[_0x2848('0x23')](function(_0x463a51){if(_0x463a51){_0x5bb656=_0x463a51;_0x40968d[_0x2848('0x2e')]=_[_0x2848('0x31')](db[_0x2848('0x48')][_0x2848('0x2a')]);_0x40968d[_0x2848('0x30')]=_[_0x2848('0x31')](_0x2814a2['query']);_0x40968d['filters']=_['intersection'](_0x40968d['model'],_0x40968d[_0x2848('0x30')]);_0x4021c6[_0x2848('0x35')]=_[_0x2848('0x33')](_0x40968d[_0x2848('0x2e')],qs[_0x2848('0x34')](_0x2814a2['query'][_0x2848('0x34')]));_0x4021c6[_0x2848('0x35')]=_0x4021c6[_0x2848('0x35')][_0x2848('0x3f')]?_0x4021c6[_0x2848('0x35')]:_0x40968d[_0x2848('0x2e')];_0x4021c6['order']=qs['sort'](_0x2814a2[_0x2848('0x30')]['sort']);_0x4021c6[_0x2848('0x38')]=qs[_0x2848('0x32')](_[_0x2848('0x49')](_0x2814a2[_0x2848('0x30')],_0x40968d[_0x2848('0x32')]));if(_0x2814a2[_0x2848('0x30')][_0x2848('0x39')]){_0x4021c6['where']=_['merge'](_0x4021c6['where'],{'$or':_[_0x2848('0x2f')](_0x4021c6['attributes'],function(_0x3e5ccb){var _0x35793c={};_0x35793c[_0x3e5ccb]={'$like':'%'+_0x2814a2[_0x2848('0x30')][_0x2848('0x39')]+'%'};return _0x35793c;})});}_0x4021c6=_['merge']({},_0x4021c6,_0x2814a2['options']);return _0x5bb656[_0x2848('0x4a')](_0x4021c6);}})[_0x2848('0x23')](function(_0x28831c){if(_0x28831c){_0x3a8f91=_0x28831c[_0x2848('0x3f')];if(!_0x2814a2[_0x2848('0x30')]['hasOwnProperty'](_0x2848('0x36'))){_0x4021c6[_0x2848('0x1c')]=qs[_0x2848('0x1c')](_0x2814a2[_0x2848('0x30')][_0x2848('0x1c')]);_0x4021c6['offset']=qs[_0x2848('0x1b')](_0x2814a2['query']['offset']);}return _0x5bb656[_0x2848('0x4a')](_0x4021c6);}})['then'](function(_0xad516a){if(_0xad516a){return _0xad516a?{'count':_0x3a8f91,'rows':_0xad516a}:null;}})[_0x2848('0x23')](respondWithResult(_0x3b996e,null))[_0x2848('0x45')](handleError(_0x3b996e,null));};exports[_0x2848('0x4b')]=function(_0x355afc,_0x3b196c,_0x216c94){var _0x162e68={};var _0x3d2b75={};var _0x3cc2fa;var _0xb0515e;return db[_0x2848('0x29')]['findOne']({'where':{'id':_0x355afc[_0x2848('0x46')]['id']}})[_0x2848('0x23')](handleEntityNotFound(_0x3b196c,null))[_0x2848('0x23')](function(_0x1cf306){if(_0x1cf306){_0x3cc2fa=_0x1cf306;_0x3d2b75['model']=_[_0x2848('0x31')](db[_0x2848('0x48')]['rawAttributes']);_0x3d2b75[_0x2848('0x30')]=_[_0x2848('0x31')](_0x355afc[_0x2848('0x30')]);_0x3d2b75[_0x2848('0x32')]=_[_0x2848('0x33')](_0x3d2b75['model'],_0x3d2b75['query']);_0x162e68[_0x2848('0x35')]=_[_0x2848('0x33')](_0x3d2b75['model'],qs[_0x2848('0x34')](_0x355afc[_0x2848('0x30')]['fields']));_0x162e68[_0x2848('0x35')]=_0x162e68['attributes'][_0x2848('0x3f')]?_0x162e68[_0x2848('0x35')]:_0x3d2b75[_0x2848('0x2e')];_0x162e68[_0x2848('0x4c')]=qs[_0x2848('0x37')](_0x355afc[_0x2848('0x30')][_0x2848('0x37')]);_0x162e68[_0x2848('0x38')]=qs[_0x2848('0x32')](_[_0x2848('0x49')](_0x355afc[_0x2848('0x30')],_0x3d2b75[_0x2848('0x32')]));if(_0x355afc[_0x2848('0x30')]['filter']){_0x162e68[_0x2848('0x38')]=_[_0x2848('0x3a')](_0x162e68['where'],{'$or':_['map'](_0x162e68[_0x2848('0x35')],function(_0x44d94e){var _0x515a4b={};_0x515a4b[_0x44d94e]={'$like':'%'+_0x355afc[_0x2848('0x30')][_0x2848('0x39')]+'%'};return _0x515a4b;})});}_0x162e68=_[_0x2848('0x3a')]({},_0x162e68,_0x355afc[_0x2848('0x3b')]);return _0x3cc2fa['getSubjects'](_0x162e68);}})[_0x2848('0x23')](function(_0x5431ae){if(_0x5431ae){_0xb0515e=_0x5431ae[_0x2848('0x3f')];if(!_0x355afc[_0x2848('0x30')][_0x2848('0x4d')](_0x2848('0x36'))){_0x162e68[_0x2848('0x1c')]=qs['limit'](_0x355afc[_0x2848('0x30')][_0x2848('0x1c')]);_0x162e68['offset']=qs[_0x2848('0x1b')](_0x355afc['query'][_0x2848('0x1b')]);}return _0x3cc2fa[_0x2848('0x4b')](_0x162e68);}})[_0x2848('0x23')](function(_0x3afebe){if(_0x3afebe){return _0x3afebe?{'count':_0xb0515e,'rows':_0x3afebe}:null;}})[_0x2848('0x23')](respondWithResult(_0x3b196c,null))['catch'](handleError(_0x3b196c,null));};exports['getDescriptions']=function(_0xf993f0,_0x388b62,_0x1a3eb5){var _0x268792={};var _0x398f3d={};var _0x37ed4a;var _0x3cb153;return db[_0x2848('0x29')][_0x2848('0x47')]({'where':{'id':_0xf993f0[_0x2848('0x46')]['id']}})['then'](handleEntityNotFound(_0x388b62,null))[_0x2848('0x23')](function(_0x5c279b){if(_0x5c279b){_0x37ed4a=_0x5c279b;_0x398f3d['model']=_[_0x2848('0x31')](db[_0x2848('0x48')][_0x2848('0x2a')]);_0x398f3d['query']=_[_0x2848('0x31')](_0xf993f0[_0x2848('0x30')]);_0x398f3d['filters']=_[_0x2848('0x33')](_0x398f3d[_0x2848('0x2e')],_0x398f3d[_0x2848('0x30')]);_0x268792[_0x2848('0x35')]=_[_0x2848('0x33')](_0x398f3d[_0x2848('0x2e')],qs[_0x2848('0x34')](_0xf993f0[_0x2848('0x30')][_0x2848('0x34')]));_0x268792[_0x2848('0x35')]=_0x268792[_0x2848('0x35')]['length']?_0x268792[_0x2848('0x35')]:_0x398f3d[_0x2848('0x2e')];_0x268792[_0x2848('0x4c')]=qs['sort'](_0xf993f0[_0x2848('0x30')]['sort']);_0x268792[_0x2848('0x38')]=qs[_0x2848('0x32')](_[_0x2848('0x49')](_0xf993f0['query'],_0x398f3d[_0x2848('0x32')]));if(_0xf993f0[_0x2848('0x30')][_0x2848('0x39')]){_0x268792[_0x2848('0x38')]=_[_0x2848('0x3a')](_0x268792[_0x2848('0x38')],{'$or':_[_0x2848('0x2f')](_0x268792[_0x2848('0x35')],function(_0x3a2a47){var _0x490156={};_0x490156[_0x3a2a47]={'$like':'%'+_0xf993f0['query'][_0x2848('0x39')]+'%'};return _0x490156;})});}_0x268792=_[_0x2848('0x3a')]({},_0x268792,_0xf993f0[_0x2848('0x3b')]);return _0x37ed4a[_0x2848('0x4e')](_0x268792);}})[_0x2848('0x23')](function(_0x2259aa){if(_0x2259aa){_0x3cb153=_0x2259aa['length'];if(!_0xf993f0[_0x2848('0x30')][_0x2848('0x4d')](_0x2848('0x36'))){_0x268792['limit']=qs[_0x2848('0x1c')](_0xf993f0[_0x2848('0x30')][_0x2848('0x1c')]);_0x268792[_0x2848('0x1b')]=qs['offset'](_0xf993f0['query']['offset']);}return _0x37ed4a['getDescriptions'](_0x268792);}})[_0x2848('0x23')](function(_0x2cfa4b){if(_0x2cfa4b){return _0x2cfa4b?{'count':_0x3cb153,'rows':_0x2cfa4b}:null;}})[_0x2848('0x23')](respondWithResult(_0x388b62,null))[_0x2848('0x45')](handleError(_0x388b62,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index aea28d3..8b903d5 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 _0xc9df=['request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','bluebird'];(function(_0x227db3,_0x5f2a42){var _0x300391=function(_0x19f086){while(--_0x19f086){_0x227db3['push'](_0x227db3['shift']());}};_0x300391(++_0x5f2a42);}(_0xc9df,0x12f));var _0xfc9d=function(_0x40f87d,_0x5b309f){_0x40f87d=_0x40f87d-0x0;var _0x546439=_0xc9df[_0x40f87d];return _0x546439;};'use strict';var _=require('lodash');var util=require(_0xfc9d('0x0'));var logger=require(_0xfc9d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfc9d('0x2'));var rp=require(_0xfc9d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc9d('0x4'));var config=require(_0xfc9d('0x5'));var attributes=require(_0xfc9d('0x6'));module['exports']=function(_0x407bf8,_0x5d6b64){return _0x407bf8['define'](_0xfc9d('0x7'),attributes,{'tableName':_0xfc9d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c97=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7c97,0x1c4));var _0x77c9=function(_0x1e2ccf,_0x367b8b){_0x1e2ccf=_0x1e2ccf-0x0;var _0x1c4080=_0x7c97[_0x1e2ccf];return _0x1c4080;};'use strict';var _=require(_0x77c9('0x0'));var util=require(_0x77c9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x77c9('0x2'));var BPromise=require(_0x77c9('0x3'));var rp=require(_0x77c9('0x4'));var fs=require('fs');var path=require(_0x77c9('0x5'));var rimraf=require(_0x77c9('0x6'));var config=require(_0x77c9('0x7'));var attributes=require(_0x77c9('0x8'));module[_0x77c9('0x9')]=function(_0x2ac7aa,_0x52550b){return _0x2ac7aa[_0x77c9('0xa')](_0x77c9('0xb'),attributes,{'tableName':_0x77c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index c9da549..288f8c0 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 _0x57e3=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','util'];(function(_0x1494cf,_0x62b7b){var _0x4795ad=function(_0x20463a){while(--_0x20463a){_0x1494cf['push'](_0x1494cf['shift']());}};_0x4795ad(++_0x62b7b);}(_0x57e3,0x142));var _0x357e=function(_0x505586,_0x319e89){_0x505586=_0x505586-0x0;var _0x5d8906=_0x57e3[_0x505586];return _0x5d8906;};'use strict';var _=require(_0x357e('0x0'));var util=require(_0x357e('0x1'));var moment=require(_0x357e('0x2'));var BPromise=require(_0x357e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x357e('0x4'));var db=require(_0x357e('0x5'))['db'];var utils=require(_0x357e('0x6'));var logger=require(_0x357e('0x7'))(_0x357e('0x8'));var config=require(_0x357e('0x9'));var jayson=require(_0x357e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb6f45b,_0x33d43d,_0x5e8721){return new BPromise(function(_0x4dd935,_0x4c0e38){return client['request'](_0xb6f45b,_0x5e8721)['then'](function(_0x288cc1){logger[_0x357e('0xb')](_0x357e('0xc'),_0x33d43d,_0x357e('0xd'));logger[_0x357e('0xe')](_0x357e('0xf'),_0x33d43d,_0x357e('0xd'),JSON['stringify'](_0x288cc1));if(_0x288cc1['error']){if(_0x288cc1[_0x357e('0x10')]['code']===0x1f4){logger[_0x357e('0x10')](_0x357e('0xc'),_0x33d43d,_0x288cc1[_0x357e('0x10')]['message']);return _0x4c0e38(_0x288cc1[_0x357e('0x10')][_0x357e('0x11')]);}logger[_0x357e('0x10')](_0x357e('0xc'),_0x33d43d,_0x288cc1[_0x357e('0x10')][_0x357e('0x11')]);return _0x4dd935(_0x288cc1[_0x357e('0x10')][_0x357e('0x11')]);}else{logger[_0x357e('0xb')](_0x357e('0xc'),_0x33d43d,_0x357e('0xd'));_0x4dd935(_0x288cc1['result'][_0x357e('0x11')]);}})['catch'](function(_0x1906e2){logger[_0x357e('0x10')](_0x357e('0xc'),_0x33d43d,_0x1906e2);_0x4c0e38(_0x1906e2);});});} \ No newline at end of file +var _0x5c95=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c95,0x80));var _0x55c9=function(_0x1ac1e1,_0x36a4c1){_0x1ac1e1=_0x1ac1e1-0x0;var _0x35bb79=_0x5c95[_0x1ac1e1];return _0x35bb79;};'use strict';var _=require(_0x55c9('0x0'));var util=require(_0x55c9('0x1'));var moment=require(_0x55c9('0x2'));var BPromise=require(_0x55c9('0x3'));var rs=require(_0x55c9('0x4'));var fs=require('fs');var Redis=require(_0x55c9('0x5'));var db=require(_0x55c9('0x6'))['db'];var utils=require(_0x55c9('0x7'));var logger=require(_0x55c9('0x8'))('rpc');var config=require(_0x55c9('0x9'));var jayson=require(_0x55c9('0xa'));var client=jayson[_0x55c9('0xb')][_0x55c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fd46d,_0x19931e,_0x1577b6){return new BPromise(function(_0x16c0aa,_0x430935){return client[_0x55c9('0xd')](_0x3fd46d,_0x1577b6)[_0x55c9('0xe')](function(_0x402cc4){logger[_0x55c9('0xf')](_0x55c9('0x10'),_0x19931e,_0x55c9('0x11'));logger[_0x55c9('0x12')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x19931e,_0x55c9('0x11'),JSON['stringify'](_0x402cc4));if(_0x402cc4[_0x55c9('0x13')]){if(_0x402cc4[_0x55c9('0x13')]['code']===0x1f4){logger[_0x55c9('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x19931e,_0x402cc4['error'][_0x55c9('0x14')]);return _0x430935(_0x402cc4['error'][_0x55c9('0x14')]);}logger[_0x55c9('0x13')](_0x55c9('0x10'),_0x19931e,_0x402cc4[_0x55c9('0x13')][_0x55c9('0x14')]);return _0x16c0aa(_0x402cc4['error'][_0x55c9('0x14')]);}else{logger['info'](_0x55c9('0x10'),_0x19931e,'request\x20sent');_0x16c0aa(_0x402cc4[_0x55c9('0x15')][_0x55c9('0x14')]);}})['catch'](function(_0xea0f2){logger[_0x55c9('0x13')](_0x55c9('0x10'),_0x19931e,_0xea0f2);_0x430935(_0xea0f2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 928878d..7e8c100 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 _0xd5ac=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x208ddb,_0x407021){var _0x32219e=function(_0x3efb9a){while(--_0x3efb9a){_0x208ddb['push'](_0x208ddb['shift']());}};_0x32219e(++_0x407021);}(_0xd5ac,0xff));var _0xcd5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5ac[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcd5a('0x0'));var util=require('util');var path=require(_0xcd5a('0x1'));var timeout=require(_0xcd5a('0x2'));var express=require(_0xcd5a('0x3'));var router=express[_0xcd5a('0x4')]();var fs_extra=require(_0xcd5a('0x5'));var auth=require(_0xcd5a('0x6'));var interaction=require(_0xcd5a('0x7'));var config=require(_0xcd5a('0x8'));var controller=require(_0xcd5a('0x9'));router[_0xcd5a('0xa')]('/',auth[_0xcd5a('0xb')](),controller[_0xcd5a('0xc')]);router[_0xcd5a('0xa')](_0xcd5a('0xd'),auth[_0xcd5a('0xb')](),controller['show']);router[_0xcd5a('0xe')]('/',auth[_0xcd5a('0xb')](),controller[_0xcd5a('0xf')]);router[_0xcd5a('0x10')](_0xcd5a('0xd'),auth[_0xcd5a('0xb')](),controller[_0xcd5a('0x11')]);router[_0xcd5a('0x12')]('/:id',auth[_0xcd5a('0xb')](),controller[_0xcd5a('0x13')]);module[_0xcd5a('0x14')]=router; \ No newline at end of file +var _0xf06e=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x593618,_0x3ac358){var _0x1a0db4=function(_0x4cd545){while(--_0x4cd545){_0x593618['push'](_0x593618['shift']());}};_0x1a0db4(++_0x3ac358);}(_0xf06e,0x83));var _0xef06=function(_0x119070,_0x59ee80){_0x119070=_0x119070-0x0;var _0x30cdd4=_0xf06e[_0x119070];return _0x30cdd4;};'use strict';var multer=require(_0xef06('0x0'));var util=require(_0xef06('0x1'));var path=require(_0xef06('0x2'));var timeout=require(_0xef06('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xef06('0x4'));var auth=require(_0xef06('0x5'));var interaction=require(_0xef06('0x6'));var config=require(_0xef06('0x7'));var controller=require('./intVtigerField.controller');router[_0xef06('0x8')]('/',auth[_0xef06('0x9')](),controller[_0xef06('0xa')]);router[_0xef06('0x8')](_0xef06('0xb'),auth[_0xef06('0x9')](),controller['show']);router[_0xef06('0xc')]('/',auth[_0xef06('0x9')](),controller[_0xef06('0xd')]);router[_0xef06('0xe')]('/:id',auth[_0xef06('0x9')](),controller[_0xef06('0xf')]);router[_0xef06('0x10')](_0xef06('0xb'),auth[_0xef06('0x9')](),controller[_0xef06('0x11')]);module[_0xef06('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 7cae6a9..7f64fa7 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 _0x5e36=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x7c7662,_0x3f0ef6){var _0x99250c=function(_0x68f47a){while(--_0x68f47a){_0x7c7662['push'](_0x7c7662['shift']());}};_0x99250c(++_0x3f0ef6);}(_0x5e36,0xa7));var _0x65e3=function(_0x393ad7,_0x206207){_0x393ad7=_0x393ad7-0x0;var _0x43a952=_0x5e36[_0x393ad7];return _0x43a952;};'use strict';var Sequelize=require(_0x65e3('0x0'));module[_0x65e3('0x1')]={'type':{'type':Sequelize[_0x65e3('0x2')](_0x65e3('0x3'),_0x65e3('0x4'),_0x65e3('0x5'),_0x65e3('0x6'),_0x65e3('0x7')),'defaultValue':_0x65e3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x65e3('0x2')](_0x65e3('0x3'),'variable',_0x65e3('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x65e3('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x65e3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x65e3('0x8')]}}; \ No newline at end of file +var _0x5bd7=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x2130c6,_0xa44b95){var _0x180f0d=function(_0x2d1bc4){while(--_0x2d1bc4){_0x2130c6['push'](_0x2130c6['shift']());}};_0x180f0d(++_0xa44b95);}(_0x5bd7,0x1ba));var _0x75bd=function(_0x10fc8b,_0xb7fca){_0x10fc8b=_0x10fc8b-0x0;var _0x4b8c84=_0x5bd7[_0x10fc8b];return _0x4b8c84;};'use strict';var Sequelize=require(_0x75bd('0x0'));module[_0x75bd('0x1')]={'type':{'type':Sequelize[_0x75bd('0x2')](_0x75bd('0x3'),_0x75bd('0x4'),'customVariable',_0x75bd('0x5'),_0x75bd('0x6')),'defaultValue':_0x75bd('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x75bd('0x7')]},'keyType':{'type':Sequelize[_0x75bd('0x2')](_0x75bd('0x3'),_0x75bd('0x4'),_0x75bd('0x8'))},'keyContent':{'type':Sequelize[_0x75bd('0x7')]},'idField':{'type':Sequelize[_0x75bd('0x7')]},'nameField':{'type':Sequelize[_0x75bd('0x7')]},'customField':{'type':Sequelize[_0x75bd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x75bd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 0dc8a0a..648f7a5 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 _0xe6d7=['key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','merge','type','VIRTUAL','options','where','includeAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','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','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','VtigerField','rawAttributes','fieldName'];(function(_0x4f3f5f,_0x38631c){var _0x4d8b23=function(_0x3bd259){while(--_0x3bd259){_0x4f3f5f['push'](_0x4f3f5f['shift']());}};_0x4d8b23(++_0x38631c);}(_0xe6d7,0x143));var _0x7e6d=function(_0x3716c6,_0x1f3462){_0x3716c6=_0x3716c6-0x0;var _0x13306d=_0xe6d7[_0x3716c6];return _0x13306d;};'use strict';var emlformat=require(_0x7e6d('0x0'));var rimraf=require(_0x7e6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e6d('0x2'));var rp=require(_0x7e6d('0x3'));var moment=require(_0x7e6d('0x4'));var BPromise=require(_0x7e6d('0x5'));var Mustache=require('mustache');var util=require(_0x7e6d('0x6'));var path=require(_0x7e6d('0x7'));var sox=require(_0x7e6d('0x8'));var csv=require(_0x7e6d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e6d('0xa'));var squel=require(_0x7e6d('0xb'));var crypto=require(_0x7e6d('0xc'));var jsforce=require(_0x7e6d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e6d('0x9'));var querystring=require('querystring');var Papa=require(_0x7e6d('0xe'));var Redis=require(_0x7e6d('0xf'));var authService=require(_0x7e6d('0x10'));var qs=require(_0x7e6d('0x11'));var as=require(_0x7e6d('0x12'));var hardwareService=require(_0x7e6d('0x13'));var logger=require(_0x7e6d('0x14'))('api');var utils=require(_0x7e6d('0x15'));var config=require(_0x7e6d('0x16'));var licenseUtil=require(_0x7e6d('0x17'));var db=require(_0x7e6d('0x18'))['db'];function respondWithStatusCode(_0x27ee12,_0x47bf07){_0x47bf07=_0x47bf07||0xcc;return function(_0x3082b4){if(_0x3082b4){return _0x27ee12[_0x7e6d('0x19')](_0x47bf07);}return _0x27ee12['status'](_0x47bf07)[_0x7e6d('0x1a')]();};}function respondWithResult(_0x133369,_0x326982){_0x326982=_0x326982||0xc8;return function(_0xb143e7){if(_0xb143e7){return _0x133369[_0x7e6d('0x1b')](_0x326982)['json'](_0xb143e7);}};}function respondWithFilteredResult(_0x365401,_0x18c011){return function(_0x2833a6){if(_0x2833a6){var _0x2ff032=typeof _0x18c011[_0x7e6d('0x1c')]===_0x7e6d('0x1d')&&typeof _0x18c011[_0x7e6d('0x1e')]===_0x7e6d('0x1d');var _0x64fc3=_0x2833a6[_0x7e6d('0x1f')];var _0x33b914=_0x2ff032?0x0:_0x18c011[_0x7e6d('0x1c')];var _0x54af30=_0x2ff032?_0x2833a6[_0x7e6d('0x1f')]:_0x18c011['offset']+_0x18c011['limit'];var _0x4433b1;if(_0x54af30>=_0x64fc3){_0x54af30=_0x64fc3;_0x4433b1=0xc8;}else{_0x4433b1=0xce;}_0x365401['status'](_0x4433b1);return _0x365401[_0x7e6d('0x20')](_0x7e6d('0x21'),_0x33b914+'-'+_0x54af30+'/'+_0x64fc3)['json'](_0x2833a6);}return null;};}function patchUpdates(_0x421762){return function(_0x40648a){try{jsonpatch[_0x7e6d('0x22')](_0x40648a,_0x421762,!![]);}catch(_0x2fa639){return BPromise[_0x7e6d('0x23')](_0x2fa639);}return _0x40648a['save']();};}function saveUpdates(_0x4aeac6,_0x57e856){return function(_0x1c275f){if(_0x1c275f){return _0x1c275f[_0x7e6d('0x24')](_0x4aeac6)[_0x7e6d('0x25')](function(_0x49089e){return _0x49089e;});}return null;};}function removeEntity(_0x211bbf,_0x49975a){return function(_0x60e9ad){if(_0x60e9ad){return _0x60e9ad[_0x7e6d('0x26')]()[_0x7e6d('0x25')](function(){_0x211bbf['status'](0xcc)[_0x7e6d('0x1a')]();});}};}function handleEntityNotFound(_0x5194ff,_0xfca59a){return function(_0x68ae95){if(!_0x68ae95){_0x5194ff[_0x7e6d('0x19')](0x194);}return _0x68ae95;};}function handleError(_0x3e2caa,_0x12af7e){_0x12af7e=_0x12af7e||0x1f4;return function(_0x220628){logger[_0x7e6d('0x27')](_0x220628[_0x7e6d('0x28')]);if(_0x220628[_0x7e6d('0x29')]){delete _0x220628['name'];}_0x3e2caa[_0x7e6d('0x1b')](_0x12af7e)['send'](_0x220628);};}exports[_0x7e6d('0x2a')]=function(_0x423b22,_0x385453){var _0x5d0efd={},_0x235d8f={},_0x5d28a4={'count':0x0,'rows':[]};var _0x2001fc=_[_0x7e6d('0x2b')](db[_0x7e6d('0x2c')][_0x7e6d('0x2d')],function(_0xfa92bb){return{'name':_0xfa92bb[_0x7e6d('0x2e')],'type':_0xfa92bb['type'][_0x7e6d('0x2f')]};});_0x235d8f['model']=_[_0x7e6d('0x2b')](_0x2001fc,_0x7e6d('0x29'));_0x235d8f[_0x7e6d('0x30')]=_[_0x7e6d('0x31')](_0x423b22[_0x7e6d('0x30')]);_0x235d8f[_0x7e6d('0x32')]=_[_0x7e6d('0x33')](_0x235d8f['model'],_0x235d8f[_0x7e6d('0x30')]);_0x5d0efd[_0x7e6d('0x34')]=_[_0x7e6d('0x33')](_0x235d8f[_0x7e6d('0x35')],qs[_0x7e6d('0x36')](_0x423b22['query'][_0x7e6d('0x36')]));_0x5d0efd[_0x7e6d('0x34')]=_0x5d0efd[_0x7e6d('0x34')]['length']?_0x5d0efd[_0x7e6d('0x34')]:_0x235d8f['model'];if(!_0x423b22[_0x7e6d('0x30')][_0x7e6d('0x37')](_0x7e6d('0x38'))){_0x5d0efd[_0x7e6d('0x1e')]=qs['limit'](_0x423b22[_0x7e6d('0x30')][_0x7e6d('0x1e')]);_0x5d0efd[_0x7e6d('0x1c')]=qs[_0x7e6d('0x1c')](_0x423b22[_0x7e6d('0x30')][_0x7e6d('0x1c')]);}_0x5d0efd[_0x7e6d('0x39')]=qs[_0x7e6d('0x3a')](_0x423b22[_0x7e6d('0x30')][_0x7e6d('0x3a')]);_0x5d0efd['where']=qs[_0x7e6d('0x32')](_[_0x7e6d('0x3b')](_0x423b22['query'],_0x235d8f[_0x7e6d('0x32')]),_0x2001fc);if(_0x423b22['query']['filter']){_0x5d0efd['where']=_[_0x7e6d('0x3c')](_0x5d0efd['where'],{'$or':_[_0x7e6d('0x2b')](_0x2001fc,function(_0x1dc1a0){if(_0x1dc1a0[_0x7e6d('0x3d')]!==_0x7e6d('0x3e')){var _0x17ce97={};_0x17ce97[_0x1dc1a0[_0x7e6d('0x29')]]={'$like':'%'+_0x423b22['query']['filter']+'%'};return _0x17ce97;}})});}_0x5d0efd=_[_0x7e6d('0x3c')]({},_0x5d0efd,_0x423b22[_0x7e6d('0x3f')]);var _0x3626b5={'where':_0x5d0efd[_0x7e6d('0x40')]};return db['VtigerField'][_0x7e6d('0x1f')](_0x3626b5)[_0x7e6d('0x25')](function(_0x58a5c7){_0x5d28a4[_0x7e6d('0x1f')]=_0x58a5c7;if(_0x423b22[_0x7e6d('0x30')][_0x7e6d('0x41')]){_0x5d0efd['include']=[{'all':!![]}];}return db[_0x7e6d('0x2c')]['findAll'](_0x5d0efd);})[_0x7e6d('0x25')](function(_0xc16d5b){_0x5d28a4[_0x7e6d('0x42')]=_0xc16d5b;return _0x5d28a4;})['then'](respondWithFilteredResult(_0x385453,_0x5d0efd))[_0x7e6d('0x43')](handleError(_0x385453,null));};exports[_0x7e6d('0x44')]=function(_0x1ae058,_0x347bbc){var _0x3e5d58={'raw':!![],'where':{'id':_0x1ae058[_0x7e6d('0x45')]['id']}},_0x1b3b12={};_0x1b3b12['model']=_[_0x7e6d('0x31')](db[_0x7e6d('0x2c')]['rawAttributes']);_0x1b3b12['query']=_[_0x7e6d('0x31')](_0x1ae058['query']);_0x1b3b12[_0x7e6d('0x32')]=_[_0x7e6d('0x33')](_0x1b3b12[_0x7e6d('0x35')],_0x1b3b12['query']);_0x3e5d58[_0x7e6d('0x34')]=_['intersection'](_0x1b3b12[_0x7e6d('0x35')],qs[_0x7e6d('0x36')](_0x1ae058['query'][_0x7e6d('0x36')]));_0x3e5d58['attributes']=_0x3e5d58['attributes']['length']?_0x3e5d58[_0x7e6d('0x34')]:_0x1b3b12[_0x7e6d('0x35')];if(_0x1ae058[_0x7e6d('0x30')][_0x7e6d('0x41')]){_0x3e5d58[_0x7e6d('0x46')]=[{'all':!![]}];}_0x3e5d58=_[_0x7e6d('0x3c')]({},_0x3e5d58,_0x1ae058[_0x7e6d('0x3f')]);return db[_0x7e6d('0x2c')][_0x7e6d('0x47')](_0x3e5d58)[_0x7e6d('0x25')](handleEntityNotFound(_0x347bbc,null))[_0x7e6d('0x25')](respondWithResult(_0x347bbc,null))[_0x7e6d('0x43')](handleError(_0x347bbc,null));};exports[_0x7e6d('0x48')]=function(_0x302409,_0x3e162e){return db[_0x7e6d('0x2c')]['create'](_0x302409['body'],{})[_0x7e6d('0x25')](respondWithResult(_0x3e162e,0xc9))[_0x7e6d('0x43')](handleError(_0x3e162e,null));};exports[_0x7e6d('0x24')]=function(_0x3734f0,_0x2a5d66){if(_0x3734f0[_0x7e6d('0x49')]['id']){delete _0x3734f0[_0x7e6d('0x49')]['id'];}return db[_0x7e6d('0x2c')][_0x7e6d('0x47')]({'where':{'id':_0x3734f0[_0x7e6d('0x45')]['id']}})[_0x7e6d('0x25')](handleEntityNotFound(_0x2a5d66,null))['then'](saveUpdates(_0x3734f0['body'],null))['then'](respondWithResult(_0x2a5d66,null))[_0x7e6d('0x43')](handleError(_0x2a5d66,null));};exports[_0x7e6d('0x26')]=function(_0x2c7209,_0x409d8d){return db['VtigerField'][_0x7e6d('0x47')]({'where':{'id':_0x2c7209[_0x7e6d('0x45')]['id']}})[_0x7e6d('0x25')](handleEntityNotFound(_0x409d8d,null))[_0x7e6d('0x25')](removeEntity(_0x409d8d,null))['catch'](handleError(_0x409d8d,null));}; \ No newline at end of file +var _0xf03f=['options','find','create','body','eml-format','rimraf','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','status','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','filter','include','findAll','rows','catch','show','params','includeAll'];(function(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_0xf03f,0x1cc));var _0xff03=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xf03f[_0x154983];return _0x3d1243;};'use strict';var emlformat=require(_0xff03('0x0'));var rimraf=require(_0xff03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xff03('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xff03('0x3'));var util=require(_0xff03('0x4'));var path=require(_0xff03('0x5'));var sox=require(_0xff03('0x6'));var csv=require('to-csv');var ejs=require(_0xff03('0x7'));var fs=require('fs');var fs_extra=require(_0xff03('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xff03('0x9'));var jsforce=require(_0xff03('0xa'));var deskjs=require(_0xff03('0xb'));var toCsv=require(_0xff03('0xc'));var querystring=require(_0xff03('0xd'));var Papa=require(_0xff03('0xe'));var Redis=require('ioredis');var authService=require(_0xff03('0xf'));var qs=require(_0xff03('0x10'));var as=require(_0xff03('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff03('0x12'))(_0xff03('0x13'));var utils=require(_0xff03('0x14'));var config=require(_0xff03('0x15'));var licenseUtil=require(_0xff03('0x16'));var db=require(_0xff03('0x17'))['db'];function respondWithStatusCode(_0x1c8c57,_0x424ba9){_0x424ba9=_0x424ba9||0xcc;return function(_0xdf5ef2){if(_0xdf5ef2){return _0x1c8c57[_0xff03('0x18')](_0x424ba9);}return _0x1c8c57['status'](_0x424ba9)[_0xff03('0x19')]();};}function respondWithResult(_0x16c605,_0x8a88d0){_0x8a88d0=_0x8a88d0||0xc8;return function(_0x647169){if(_0x647169){return _0x16c605['status'](_0x8a88d0)[_0xff03('0x1a')](_0x647169);}};}function respondWithFilteredResult(_0x250991,_0x2df995){return function(_0x11397d){if(_0x11397d){var _0x52eb5b=typeof _0x2df995['offset']===_0xff03('0x1b')&&typeof _0x2df995['limit']===_0xff03('0x1b');var _0x978e8=_0x11397d[_0xff03('0x1c')];var _0x352c4f=_0x52eb5b?0x0:_0x2df995[_0xff03('0x1d')];var _0x42f874=_0x52eb5b?_0x11397d[_0xff03('0x1c')]:_0x2df995[_0xff03('0x1d')]+_0x2df995['limit'];var _0x5349b1;if(_0x42f874>=_0x978e8){_0x42f874=_0x978e8;_0x5349b1=0xc8;}else{_0x5349b1=0xce;}_0x250991[_0xff03('0x1e')](_0x5349b1);return _0x250991[_0xff03('0x1f')](_0xff03('0x20'),_0x352c4f+'-'+_0x42f874+'/'+_0x978e8)[_0xff03('0x1a')](_0x11397d);}return null;};}function patchUpdates(_0x23a1ea){return function(_0x331238){try{jsonpatch[_0xff03('0x21')](_0x331238,_0x23a1ea,!![]);}catch(_0x4eebab){return BPromise['reject'](_0x4eebab);}return _0x331238[_0xff03('0x22')]();};}function saveUpdates(_0x313dcd,_0xb98036){return function(_0x3cd1ea){if(_0x3cd1ea){return _0x3cd1ea[_0xff03('0x23')](_0x313dcd)[_0xff03('0x24')](function(_0x2458b4){return _0x2458b4;});}return null;};}function removeEntity(_0x56503d,_0x3b4465){return function(_0x5de4ce){if(_0x5de4ce){return _0x5de4ce[_0xff03('0x25')]()[_0xff03('0x24')](function(){_0x56503d['status'](0xcc)[_0xff03('0x19')]();});}};}function handleEntityNotFound(_0x7d7060,_0x54f4e2){return function(_0x43a96e){if(!_0x43a96e){_0x7d7060[_0xff03('0x18')](0x194);}return _0x43a96e;};}function handleError(_0x19c8ac,_0x1e29f9){_0x1e29f9=_0x1e29f9||0x1f4;return function(_0x58cfa0){logger[_0xff03('0x26')](_0x58cfa0['stack']);if(_0x58cfa0[_0xff03('0x27')]){delete _0x58cfa0[_0xff03('0x27')];}_0x19c8ac[_0xff03('0x1e')](_0x1e29f9)[_0xff03('0x28')](_0x58cfa0);};}exports[_0xff03('0x29')]=function(_0x13b560,_0x356f50){var _0x489dd2={},_0x227e7c={},_0x2a22e5={'count':0x0,'rows':[]};var _0x315cbb=_[_0xff03('0x2a')](db[_0xff03('0x2b')][_0xff03('0x2c')],function(_0xa00adf){return{'name':_0xa00adf[_0xff03('0x2d')],'type':_0xa00adf[_0xff03('0x2e')][_0xff03('0x2f')]};});_0x227e7c['model']=_['map'](_0x315cbb,_0xff03('0x27'));_0x227e7c['query']=_[_0xff03('0x30')](_0x13b560['query']);_0x227e7c['filters']=_[_0xff03('0x31')](_0x227e7c[_0xff03('0x32')],_0x227e7c[_0xff03('0x33')]);_0x489dd2['attributes']=_['intersection'](_0x227e7c[_0xff03('0x32')],qs[_0xff03('0x34')](_0x13b560['query'][_0xff03('0x34')]));_0x489dd2[_0xff03('0x35')]=_0x489dd2['attributes'][_0xff03('0x36')]?_0x489dd2[_0xff03('0x35')]:_0x227e7c[_0xff03('0x32')];if(!_0x13b560['query'][_0xff03('0x37')](_0xff03('0x38'))){_0x489dd2[_0xff03('0x39')]=qs[_0xff03('0x39')](_0x13b560[_0xff03('0x33')][_0xff03('0x39')]);_0x489dd2[_0xff03('0x1d')]=qs[_0xff03('0x1d')](_0x13b560[_0xff03('0x33')]['offset']);}_0x489dd2[_0xff03('0x3a')]=qs[_0xff03('0x3b')](_0x13b560[_0xff03('0x33')]['sort']);_0x489dd2[_0xff03('0x3c')]=qs[_0xff03('0x3d')](_[_0xff03('0x3e')](_0x13b560[_0xff03('0x33')],_0x227e7c[_0xff03('0x3d')]),_0x315cbb);if(_0x13b560['query']['filter']){_0x489dd2[_0xff03('0x3c')]=_[_0xff03('0x3f')](_0x489dd2[_0xff03('0x3c')],{'$or':_[_0xff03('0x2a')](_0x315cbb,function(_0x2691a3){if(_0x2691a3[_0xff03('0x2e')]!=='VIRTUAL'){var _0x387187={};_0x387187[_0x2691a3['name']]={'$like':'%'+_0x13b560[_0xff03('0x33')][_0xff03('0x40')]+'%'};return _0x387187;}})});}_0x489dd2=_[_0xff03('0x3f')]({},_0x489dd2,_0x13b560['options']);var _0x5eabdb={'where':_0x489dd2[_0xff03('0x3c')]};return db[_0xff03('0x2b')]['count'](_0x5eabdb)['then'](function(_0x1399f9){_0x2a22e5[_0xff03('0x1c')]=_0x1399f9;if(_0x13b560[_0xff03('0x33')]['includeAll']){_0x489dd2[_0xff03('0x41')]=[{'all':!![]}];}return db[_0xff03('0x2b')][_0xff03('0x42')](_0x489dd2);})['then'](function(_0x48b38a){_0x2a22e5[_0xff03('0x43')]=_0x48b38a;return _0x2a22e5;})['then'](respondWithFilteredResult(_0x356f50,_0x489dd2))[_0xff03('0x44')](handleError(_0x356f50,null));};exports[_0xff03('0x45')]=function(_0x3f39fe,_0x58e5be){var _0x416f76={'raw':!![],'where':{'id':_0x3f39fe[_0xff03('0x46')]['id']}},_0x148fcd={};_0x148fcd[_0xff03('0x32')]=_[_0xff03('0x30')](db['VtigerField']['rawAttributes']);_0x148fcd['query']=_[_0xff03('0x30')](_0x3f39fe['query']);_0x148fcd[_0xff03('0x3d')]=_[_0xff03('0x31')](_0x148fcd[_0xff03('0x32')],_0x148fcd['query']);_0x416f76[_0xff03('0x35')]=_[_0xff03('0x31')](_0x148fcd[_0xff03('0x32')],qs[_0xff03('0x34')](_0x3f39fe[_0xff03('0x33')][_0xff03('0x34')]));_0x416f76['attributes']=_0x416f76['attributes']['length']?_0x416f76[_0xff03('0x35')]:_0x148fcd[_0xff03('0x32')];if(_0x3f39fe[_0xff03('0x33')][_0xff03('0x47')]){_0x416f76['include']=[{'all':!![]}];}_0x416f76=_[_0xff03('0x3f')]({},_0x416f76,_0x3f39fe[_0xff03('0x48')]);return db[_0xff03('0x2b')][_0xff03('0x49')](_0x416f76)[_0xff03('0x24')](handleEntityNotFound(_0x58e5be,null))[_0xff03('0x24')](respondWithResult(_0x58e5be,null))[_0xff03('0x44')](handleError(_0x58e5be,null));};exports[_0xff03('0x4a')]=function(_0x24ccd,_0x2e85e5){return db['VtigerField']['create'](_0x24ccd[_0xff03('0x4b')],{})['then'](respondWithResult(_0x2e85e5,0xc9))[_0xff03('0x44')](handleError(_0x2e85e5,null));};exports['update']=function(_0x76ef45,_0x451e32){if(_0x76ef45['body']['id']){delete _0x76ef45[_0xff03('0x4b')]['id'];}return db[_0xff03('0x2b')][_0xff03('0x49')]({'where':{'id':_0x76ef45['params']['id']}})[_0xff03('0x24')](handleEntityNotFound(_0x451e32,null))[_0xff03('0x24')](saveUpdates(_0x76ef45[_0xff03('0x4b')],null))[_0xff03('0x24')](respondWithResult(_0x451e32,null))[_0xff03('0x44')](handleError(_0x451e32,null));};exports[_0xff03('0x25')]=function(_0x193915,_0x3f6c56){return db[_0xff03('0x2b')][_0xff03('0x49')]({'where':{'id':_0x193915[_0xff03('0x46')]['id']}})[_0xff03('0x24')](handleEntityNotFound(_0x3f6c56,null))[_0xff03('0x24')](removeEntity(_0x3f6c56,null))[_0xff03('0x44')](handleError(_0x3f6c56,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9d387a4..f8bbc3b 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 _0xb5a1=['VtigerField','vtiger_unique_index','api','moment','bluebird','rimraf','./intVtigerField.attributes','exports','define'];(function(_0x490dbd,_0x5e4c05){var _0x23a4b9=function(_0x371127){while(--_0x371127){_0x490dbd['push'](_0x490dbd['shift']());}};_0x23a4b9(++_0x5e4c05);}(_0xb5a1,0x1cd));var _0x1b5a=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0xb5a1[_0x59342a];return _0x17abc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1b5a('0x0'));var moment=require(_0x1b5a('0x1'));var BPromise=require(_0x1b5a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b5a('0x3'));var config=require('../../config/environment');var attributes=require(_0x1b5a('0x4'));module[_0x1b5a('0x5')]=function(_0x361377,_0x2bd16e){return _0x361377[_0x1b5a('0x6')](_0x1b5a('0x7'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x1b5a('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf759=['path','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x48d893,_0x1d2cb6){var _0x298d77=function(_0x513b2f){while(--_0x513b2f){_0x48d893['push'](_0x48d893['shift']());}};_0x298d77(++_0x1d2cb6);}(_0xf759,0x1b5));var _0x9f75=function(_0x58a251,_0x30d151){_0x58a251=_0x58a251-0x0;var _0x4768a2=_0xf759[_0x58a251];return _0x4768a2;};'use strict';var _=require(_0x9f75('0x0'));var util=require(_0x9f75('0x1'));var logger=require(_0x9f75('0x2'))(_0x9f75('0x3'));var moment=require('moment');var BPromise=require(_0x9f75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f75('0x5'));var rimraf=require(_0x9f75('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x9f75('0x7')]=function(_0x4473b4,_0x579018){return _0x4473b4[_0x9f75('0x8')](_0x9f75('0x9'),attributes,{'tableName':_0x9f75('0xa'),'paranoid':![],'indexes':[{'name':_0x9f75('0xb'),'fields':['idField',_0x9f75('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 7084e31..ddb0dbe 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 _0x9a3e=['then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4f1ee6,_0x3a0ac1){var _0x331ef3=function(_0x2ca0dd){while(--_0x2ca0dd){_0x4f1ee6['push'](_0x4f1ee6['shift']());}};_0x331ef3(++_0x3a0ac1);}(_0x9a3e,0x74));var _0xe9a3=function(_0xd23d0,_0x3999af){_0xd23d0=_0xd23d0-0x0;var _0x4999e9=_0x9a3e[_0xd23d0];return _0x4999e9;};'use strict';var _=require(_0xe9a3('0x0'));var util=require(_0xe9a3('0x1'));var moment=require(_0xe9a3('0x2'));var BPromise=require(_0xe9a3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9a3('0x5'));var config=require(_0xe9a3('0x6'));var jayson=require(_0xe9a3('0x7'));var client=jayson[_0xe9a3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb3d0,_0x3696c6,_0xbca1c5){return new BPromise(function(_0x590efa,_0x54ada5){return client[_0xe9a3('0x9')](_0x5bb3d0,_0xbca1c5)[_0xe9a3('0xa')](function(_0x2aab59){logger['info'](_0xe9a3('0xb'),_0x3696c6,_0xe9a3('0xc'));logger[_0xe9a3('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3696c6,_0xe9a3('0xc'),JSON[_0xe9a3('0xe')](_0x2aab59));if(_0x2aab59[_0xe9a3('0xf')]){if(_0x2aab59[_0xe9a3('0xf')][_0xe9a3('0x10')]===0x1f4){logger['error'](_0xe9a3('0xb'),_0x3696c6,_0x2aab59['error'][_0xe9a3('0x11')]);return _0x54ada5(_0x2aab59[_0xe9a3('0xf')][_0xe9a3('0x11')]);}logger['error'](_0xe9a3('0xb'),_0x3696c6,_0x2aab59[_0xe9a3('0xf')][_0xe9a3('0x11')]);return _0x590efa(_0x2aab59[_0xe9a3('0xf')]['message']);}else{logger[_0xe9a3('0x12')]('VtigerField,\x20%s,\x20%s',_0x3696c6,'request\x20sent');_0x590efa(_0x2aab59[_0xe9a3('0x13')][_0xe9a3('0x11')]);}})[_0xe9a3('0x14')](function(_0x7731ef){logger[_0xe9a3('0xf')](_0xe9a3('0xb'),_0x3696c6,_0x7731ef);_0x54ada5(_0x7731ef);});});} \ No newline at end of file +var _0x4aca=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3762ee,_0x3387c6){var _0x1cff6f=function(_0x53a92b){while(--_0x53a92b){_0x3762ee['push'](_0x3762ee['shift']());}};_0x1cff6f(++_0x3387c6);}(_0x4aca,0x1dd));var _0xa4ac=function(_0x111321,_0xd79f47){_0x111321=_0x111321-0x0;var _0x3e4967=_0x4aca[_0x111321];return _0x3e4967;};'use strict';var _=require('lodash');var util=require(_0xa4ac('0x0'));var moment=require('moment');var BPromise=require(_0xa4ac('0x1'));var rs=require(_0xa4ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4ac('0x3'))['db'];var utils=require(_0xa4ac('0x4'));var logger=require(_0xa4ac('0x5'))('rpc');var config=require(_0xa4ac('0x6'));var jayson=require(_0xa4ac('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26ca6f,_0xb8ed61,_0x1b5380){return new BPromise(function(_0x3797b0,_0x40f045){return client['request'](_0x26ca6f,_0x1b5380)[_0xa4ac('0x8')](function(_0x22e01d){logger[_0xa4ac('0x9')](_0xa4ac('0xa'),_0xb8ed61,_0xa4ac('0xb'));logger[_0xa4ac('0xc')]('VtigerField,\x20%s,\x20%s,\x20%s',_0xb8ed61,_0xa4ac('0xb'),JSON[_0xa4ac('0xd')](_0x22e01d));if(_0x22e01d[_0xa4ac('0xe')]){if(_0x22e01d['error'][_0xa4ac('0xf')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0xb8ed61,_0x22e01d[_0xa4ac('0xe')][_0xa4ac('0x10')]);return _0x40f045(_0x22e01d['error'][_0xa4ac('0x10')]);}logger['error'](_0xa4ac('0xa'),_0xb8ed61,_0x22e01d[_0xa4ac('0xe')][_0xa4ac('0x10')]);return _0x3797b0(_0x22e01d['error'][_0xa4ac('0x10')]);}else{logger['info'](_0xa4ac('0xa'),_0xb8ed61,_0xa4ac('0xb'));_0x3797b0(_0x22e01d[_0xa4ac('0x11')]['message']);}})[_0xa4ac('0x12')](function(_0x410906){logger[_0xa4ac('0xe')](_0xa4ac('0xa'),_0xb8ed61,_0x410906);_0x40f045(_0x410906);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 165c5c2..f12cb72 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 _0x49bd=['/:id/fields','post','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations'];(function(_0x3e21fe,_0x335bb5){var _0x2b977b=function(_0x11ee69){while(--_0x11ee69){_0x3e21fe['push'](_0x3e21fe['shift']());}};_0x2b977b(++_0x335bb5);}(_0x49bd,0x104));var _0xd49b=function(_0x274ecf,_0xc38609){_0x274ecf=_0x274ecf-0x0;var _0x301d07=_0x49bd[_0x274ecf];return _0x301d07;};'use strict';var multer=require(_0xd49b('0x0'));var util=require(_0xd49b('0x1'));var path=require(_0xd49b('0x2'));var timeout=require(_0xd49b('0x3'));var express=require(_0xd49b('0x4'));var router=express[_0xd49b('0x5')]();var fs_extra=require(_0xd49b('0x6'));var auth=require(_0xd49b('0x7'));var interaction=require(_0xd49b('0x8'));var config=require(_0xd49b('0x9'));var controller=require(_0xd49b('0xa'));router[_0xd49b('0xb')]('/',auth[_0xd49b('0xc')](),controller['index']);router[_0xd49b('0xb')](_0xd49b('0xd'),auth[_0xd49b('0xc')](),controller['show']);router[_0xd49b('0xb')](_0xd49b('0xe'),auth[_0xd49b('0xc')](),controller[_0xd49b('0xf')]);router['get'](_0xd49b('0x10'),auth[_0xd49b('0xc')](),controller['getFields']);router[_0xd49b('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd49b('0x11')](_0xd49b('0xe'),auth[_0xd49b('0xc')](),controller[_0xd49b('0x12')]);router['put']('/:id',auth[_0xd49b('0xc')](),controller[_0xd49b('0x13')]);router[_0xd49b('0x14')](_0xd49b('0xd'),auth[_0xd49b('0xc')](),controller[_0xd49b('0x15')]);module[_0xd49b('0x16')]=router; \ No newline at end of file +var _0x48dd=['getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x48dd,0xc9));var _0xd48d=function(_0x19808a,_0x31823c){_0x19808a=_0x19808a-0x0;var _0x715bb4=_0x48dd[_0x19808a];return _0x715bb4;};'use strict';var multer=require(_0xd48d('0x0'));var util=require(_0xd48d('0x1'));var path=require(_0xd48d('0x2'));var timeout=require(_0xd48d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd48d('0x4'));var interaction=require(_0xd48d('0x5'));var config=require(_0xd48d('0x6'));var controller=require(_0xd48d('0x7'));router[_0xd48d('0x8')]('/',auth[_0xd48d('0x9')](),controller[_0xd48d('0xa')]);router[_0xd48d('0x8')](_0xd48d('0xb'),auth['isAuthenticated'](),controller[_0xd48d('0xc')]);router[_0xd48d('0x8')](_0xd48d('0xd'),auth[_0xd48d('0x9')](),controller[_0xd48d('0xe')]);router['get']('/:id/fields',auth[_0xd48d('0x9')](),controller[_0xd48d('0xf')]);router['post']('/',auth[_0xd48d('0x9')](),controller[_0xd48d('0x10')]);router[_0xd48d('0x11')](_0xd48d('0xd'),auth[_0xd48d('0x9')](),controller[_0xd48d('0x12')]);router[_0xd48d('0x13')](_0xd48d('0xb'),auth[_0xd48d('0x9')](),controller[_0xd48d('0x14')]);router[_0xd48d('0x15')](_0xd48d('0xb'),auth[_0xd48d('0x9')](),controller[_0xd48d('0x16')]);module[_0xd48d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9134ef2..fbaff1e 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 _0x82d8=['password','token','integrationTab','sequelize','STRING','username','ENUM'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x82d8,0xff));var _0x882d=function(_0x2351ae,_0x558b4d){_0x2351ae=_0x2351ae-0x0;var _0x585e55=_0x82d8[_0x2351ae];return _0x585e55;};'use strict';var Sequelize=require(_0x882d('0x0'));module['exports']={'name':{'type':Sequelize[_0x882d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x882d('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x882d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x882d('0x3')](_0x882d('0x4'),_0x882d('0x5')),'defaultValue':_0x882d('0x4')},'serverUrl':{'type':Sequelize[_0x882d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x882d('0x3')](_0x882d('0x6'),'newTab'),'defaultValue':_0x882d('0x6')}}; \ No newline at end of file +var _0x1893=['newTab','STRING','username','ENUM','password','token','integrationTab'];(function(_0xcb93ea,_0x6b7451){var _0x49af97=function(_0x54dc96){while(--_0x54dc96){_0xcb93ea['push'](_0xcb93ea['shift']());}};_0x49af97(++_0x6b7451);}(_0x1893,0xa2));var _0x3189=function(_0x1e9604,_0x5de613){_0x1e9604=_0x1e9604-0x0;var _0x522053=_0x1893[_0x1e9604];return _0x522053;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'password':{'type':Sequelize[_0x3189('0x0')]},'token':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x3189('0x2')](_0x3189('0x3'),_0x3189('0x4')),'defaultValue':_0x3189('0x3')},'serverUrl':{'type':Sequelize[_0x3189('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x3189('0x2')](_0x3189('0x5'),_0x3189('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 26ec622..37e45b2 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 _0xcb91=['ZendeskAccount','rawAttributes','fieldName','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','findAll','rows','show','includeAll','include','find','create','body','params','catch','destroy','getConfigurations','keys','ZendeskConfiguration','addConfiguration','AccountId','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','findOne','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','subject','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','send','index'];(function(_0x4e8414,_0x1580b2){var _0x33e32c=function(_0x102e04){while(--_0x102e04){_0x4e8414['push'](_0x4e8414['shift']());}};_0x33e32c(++_0x1580b2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xcb91[_0x544099];return _0x20ab09;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5e3c19,_0x59dec3){_0x59dec3=_0x59dec3||0xcc;return function(_0x358866){if(_0x358866){return _0x5e3c19[_0x1cb9('0x16')](_0x59dec3);}return _0x5e3c19[_0x1cb9('0x17')](_0x59dec3)[_0x1cb9('0x18')]();};}function respondWithResult(_0x56884d,_0x397727){_0x397727=_0x397727||0xc8;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x17')](_0x397727)[_0x1cb9('0x19')](_0x6ef389);}};}function respondWithFilteredResult(_0x3e2d11,_0x5806d8){return function(_0x5572cb){if(_0x5572cb){var _0xd446a3=typeof _0x5806d8[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x5806d8[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0xf22920=_0x5572cb[_0x1cb9('0x1d')];var _0x4e1340=_0xd446a3?0x0:_0x5806d8['offset'];var _0x1b2fa6=_0xd446a3?_0x5572cb[_0x1cb9('0x1d')]:_0x5806d8[_0x1cb9('0x1a')]+_0x5806d8[_0x1cb9('0x1c')];var _0x280a84;if(_0x1b2fa6>=_0xf22920){_0x1b2fa6=_0xf22920;_0x280a84=0xc8;}else{_0x280a84=0xce;}_0x3e2d11[_0x1cb9('0x17')](_0x280a84);return _0x3e2d11[_0x1cb9('0x1e')]('Content-Range',_0x4e1340+'-'+_0x1b2fa6+'/'+_0xf22920)['json'](_0x5572cb);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x1f')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x20')](_0x2e3854)[_0x1cb9('0x21')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x21')](function(){_0x59ebea[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x44d3c4,_0x43a100){return function(_0x53f9fa){if(!_0x53f9fa){_0x44d3c4[_0x1cb9('0x16')](0x194);}return _0x53f9fa;};}function handleError(_0x9df250,_0x4c8d76){_0x4c8d76=_0x4c8d76||0x1f4;return function(_0xd6891c){logger[_0x1cb9('0x22')](_0xd6891c[_0x1cb9('0x23')]);if(_0xd6891c[_0x1cb9('0x24')]){delete _0xd6891c[_0x1cb9('0x24')];}_0x9df250[_0x1cb9('0x17')](_0x4c8d76)[_0x1cb9('0x25')](_0xd6891c);};}exports[_0x1cb9('0x26')]=function(_0x41e5c2,_0x9de64b){var _0x48888d={},_0x405a2f={},_0x536635={'count':0x0,'rows':[]};var _0x110282=_['map'](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x3cd7f5){return{'name':_0x3cd7f5[_0x1cb9('0x29')],'type':_0x3cd7f5['type'][_0x1cb9('0x2a')]};});_0x405a2f['model']=_[_0x1cb9('0x2b')](_0x110282,_0x1cb9('0x24'));_0x405a2f[_0x1cb9('0x2c')]=_['keys'](_0x41e5c2[_0x1cb9('0x2c')]);_0x405a2f['filters']=_[_0x1cb9('0x2d')](_0x405a2f['model'],_0x405a2f[_0x1cb9('0x2c')]);_0x48888d[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x405a2f[_0x1cb9('0x2f')],qs['fields'](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x30')]));_0x48888d[_0x1cb9('0x2e')]=_0x48888d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x48888d[_0x1cb9('0x2e')]:_0x405a2f[_0x1cb9('0x2f')];if(!_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x48888d[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x41e5c2[_0x1cb9('0x2c')]['limit']);_0x48888d['offset']=qs[_0x1cb9('0x1a')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x1a')]);}_0x48888d[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x48888d[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x41e5c2[_0x1cb9('0x2c')],_0x405a2f[_0x1cb9('0x38')]),_0x110282);if(_0x41e5c2['query'][_0x1cb9('0x39')]){_0x48888d['where']=_[_0x1cb9('0x3a')](_0x48888d['where'],{'$or':_[_0x1cb9('0x2b')](_0x110282,function(_0x13d4fd){if(_0x13d4fd[_0x1cb9('0x3b')]!==_0x1cb9('0x3c')){var _0x34ada2={};_0x34ada2[_0x13d4fd[_0x1cb9('0x24')]]={'$like':'%'+_0x41e5c2[_0x1cb9('0x2c')]['filter']+'%'};return _0x34ada2;}})});}_0x48888d=_['merge']({},_0x48888d,_0x41e5c2[_0x1cb9('0x3d')]);var _0x1d2723={'where':_0x48888d[_0x1cb9('0x36')]};return db[_0x1cb9('0x27')][_0x1cb9('0x1d')](_0x1d2723)[_0x1cb9('0x21')](function(_0x32130b){_0x536635['count']=_0x32130b;if(_0x41e5c2[_0x1cb9('0x2c')]['includeAll']){_0x48888d['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x1cb9('0x3e')](_0x48888d);})[_0x1cb9('0x21')](function(_0x1bf51c){_0x536635[_0x1cb9('0x3f')]=_0x1bf51c;return _0x536635;})[_0x1cb9('0x21')](respondWithFilteredResult(_0x9de64b,_0x48888d))['catch'](handleError(_0x9de64b,null));};exports[_0x1cb9('0x40')]=function(_0x523866,_0x91121){var _0x71db9d={'raw':![],'where':{'id':_0x523866['params']['id']}},_0x38d973={};_0x38d973[_0x1cb9('0x2f')]=_['keys'](db[_0x1cb9('0x27')][_0x1cb9('0x28')]);_0x38d973['query']=_['keys'](_0x523866[_0x1cb9('0x2c')]);_0x38d973[_0x1cb9('0x38')]=_[_0x1cb9('0x2d')](_0x38d973[_0x1cb9('0x2f')],_0x38d973[_0x1cb9('0x2c')]);_0x71db9d['attributes']=_[_0x1cb9('0x2d')](_0x38d973['model'],qs['fields'](_0x523866['query'][_0x1cb9('0x30')]));_0x71db9d[_0x1cb9('0x2e')]=_0x71db9d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x71db9d[_0x1cb9('0x2e')]:_0x38d973[_0x1cb9('0x2f')];if(_0x523866[_0x1cb9('0x2c')][_0x1cb9('0x41')]){_0x71db9d[_0x1cb9('0x42')]=[{'all':!![]}];}_0x71db9d=_[_0x1cb9('0x3a')]({},_0x71db9d,_0x523866[_0x1cb9('0x3d')]);return db['ZendeskAccount'][_0x1cb9('0x43')](_0x71db9d)[_0x1cb9('0x21')](handleEntityNotFound(_0x91121,null))[_0x1cb9('0x21')](respondWithResult(_0x91121,null))['catch'](handleError(_0x91121,null));};exports[_0x1cb9('0x44')]=function(_0x57251,_0x3c6044){return db[_0x1cb9('0x27')][_0x1cb9('0x44')](_0x57251['body'],{})[_0x1cb9('0x21')](respondWithResult(_0x3c6044,0xc9))['catch'](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x4ac483,_0x1cf2ee){if(_0x4ac483[_0x1cb9('0x45')]['id']){delete _0x4ac483[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x4ac483[_0x1cb9('0x46')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x1cf2ee,null))[_0x1cb9('0x21')](saveUpdates(_0x4ac483[_0x1cb9('0x45')],null))[_0x1cb9('0x21')](respondWithResult(_0x1cf2ee,null))[_0x1cb9('0x47')](handleError(_0x1cf2ee,null));};exports[_0x1cb9('0x48')]=function(_0x3b6a92,_0xbb500e){return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x3b6a92['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0xbb500e,null))[_0x1cb9('0x21')](removeEntity(_0xbb500e,null))[_0x1cb9('0x47')](handleError(_0xbb500e,null));};exports[_0x1cb9('0x49')]=function(_0x20b253,_0x2d076b,_0x367dd7){var _0x1c4ff6={};var _0x36c53a={};var _0x166ca2;var _0x4a4b87;return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x20b253[_0x1cb9('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d076b,null))[_0x1cb9('0x21')](function(_0x53c002){if(_0x53c002){_0x166ca2=_0x53c002;_0x36c53a['model']=_[_0x1cb9('0x4a')](db[_0x1cb9('0x4b')][_0x1cb9('0x28')]);_0x36c53a['query']=_[_0x1cb9('0x4a')](_0x20b253[_0x1cb9('0x2c')]);_0x36c53a['filters']=_['intersection'](_0x36c53a[_0x1cb9('0x2f')],_0x36c53a[_0x1cb9('0x2c')]);_0x1c4ff6[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x36c53a[_0x1cb9('0x2f')],qs[_0x1cb9('0x30')](_0x20b253[_0x1cb9('0x2c')]['fields']));_0x1c4ff6[_0x1cb9('0x2e')]=_0x1c4ff6[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x1c4ff6['attributes']:_0x36c53a[_0x1cb9('0x2f')];_0x1c4ff6[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x1c4ff6[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x20b253[_0x1cb9('0x2c')],_0x36c53a[_0x1cb9('0x38')]));if(_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]){_0x1c4ff6[_0x1cb9('0x36')]=_[_0x1cb9('0x3a')](_0x1c4ff6[_0x1cb9('0x36')],{'$or':_[_0x1cb9('0x2b')](_0x1c4ff6[_0x1cb9('0x2e')],function(_0x370c97){var _0x55fb51={};_0x55fb51[_0x370c97]={'$like':'%'+_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]+'%'};return _0x55fb51;})});}_0x1c4ff6=_[_0x1cb9('0x3a')]({},_0x1c4ff6,_0x20b253[_0x1cb9('0x3d')]);return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x319358){if(_0x319358){_0x4a4b87=_0x319358[_0x1cb9('0x31')];if(!_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x1c4ff6[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x20b253[_0x1cb9('0x2c')]['limit']);_0x1c4ff6['offset']=qs[_0x1cb9('0x1a')](_0x20b253['query']['offset']);}return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x5d349b){if(_0x5d349b){return _0x5d349b?{'count':_0x4a4b87,'rows':_0x5d349b}:null;}})[_0x1cb9('0x21')](respondWithResult(_0x2d076b,null))[_0x1cb9('0x47')](handleError(_0x2d076b,null));};exports[_0x1cb9('0x4c')]=function(_0x43bafc,_0x23d435,_0xccbee3){if(_0x43bafc['body']['id']){delete _0x43bafc[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x43bafc['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x23d435,null))[_0x1cb9('0x21')](function(_0x2e818f){if(_0x2e818f){_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4d')]=_0x2e818f['id'];_0x43bafc['body']['Subjects']=integrations['getSubjects'](_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4e')],_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x3b')]);_0x43bafc[_0x1cb9('0x45')]['Descriptions']=integrations[_0x1cb9('0x4f')](_0x43bafc[_0x1cb9('0x45')]['channel'],_0x43bafc['body'][_0x1cb9('0x3b')]);return db['ZendeskConfiguration'][_0x1cb9('0x44')](_0x43bafc[_0x1cb9('0x45')],{'include':[{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x51')},{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x52')}]});}return null;})['then'](respondWithResult(_0x23d435,null))[_0x1cb9('0x47')](handleError(_0x23d435,null));};exports[_0x1cb9('0x53')]=function(_0x330fc1,_0x17c361,_0x5b5f0d){var _0x520d98='';return db[_0x1cb9('0x27')][_0x1cb9('0x54')]({'where':{'id':_0x330fc1[_0x1cb9('0x46')]['id']},'attributes':['id',_0x1cb9('0x55'),_0x1cb9('0x56'),_0x1cb9('0x57'),'authType',_0x1cb9('0x58')]})['then'](handleEntityNotFound(_0x17c361,null))[_0x1cb9('0x21')](function(_0x26dae9){if(_0x26dae9){_0x520d98=_0x26dae9['remoteUri'];var _0xf5b006=_0x520d98[_0x1cb9('0x59')](-0x1);if(_0xf5b006==='/'){_0x520d98=_0x520d98[_0x1cb9('0x5a')](0x0,_0x520d98['lastIndexOf'](_0xf5b006));}var _0x1b4878={'method':_0x1cb9('0x5b'),'uri':util[_0x1cb9('0x5c')](_0x1cb9('0x5d'),_0x520d98,_0x1cb9('0x5e')),'json':!![]};switch(_0x26dae9[_0x1cb9('0x5f')]){case'password':_0x1b4878[_0x1cb9('0x60')]={'Authorization':util[_0x1cb9('0x5c')](_0x1cb9('0x61'),new Buffer(util[_0x1cb9('0x5c')](_0x1cb9('0x62'),_0x26dae9[_0x1cb9('0x55')],_0x26dae9[_0x1cb9('0x56')]))[_0x1cb9('0x63')]('base64'))};break;case _0x1cb9('0x57'):_0x1b4878[_0x1cb9('0x60')]={'Authorization':util['format'](_0x1cb9('0x61'),new Buffer(util['format'](_0x1cb9('0x64'),_0x26dae9['username'],_0x26dae9['token']))[_0x1cb9('0x63')](_0x1cb9('0x65')))};break;default:throw new db['Sequelize'][(_0x1cb9('0x66'))]('Unknown\x20authentication\x20type');}return rp(_0x1b4878);}})[_0x1cb9('0x21')](function(_0x7ecb4e){if(_0x7ecb4e){var _0x399986=[_0x1cb9('0x67'),'description',_0x1cb9('0x68'),_0x1cb9('0x69')];_[_0x1cb9('0x6a')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x4f8d74){return _0x399986[_0x1cb9('0x6b')](_0x4f8d74['type']);});return{'count':_0x7ecb4e[_0x1cb9('0x5e')][_0x1cb9('0x31')],'rows':_[_0x1cb9('0x2b')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x102f2c){return{'id':_0x102f2c['id'],'name':_0x102f2c[_0x1cb9('0x6c')]>0x7?_0x102f2c['title']:_0x102f2c[_0x1cb9('0x3b')],'custom':_0x102f2c[_0x1cb9('0x6c')]>0x7?!![]:![],'options':_0x102f2c['system_field_options']?_0x102f2c[_0x1cb9('0x6d')]:_0x102f2c[_0x1cb9('0x6e')]?_0x102f2c[_0x1cb9('0x6e')]:[]};})};}})[_0x1cb9('0x21')](respondWithResult(_0x17c361,null))[_0x1cb9('0x47')](function(_0x209dc7){var _0x423aae=_0x330fc1['query'][_0x1cb9('0x6f')]?0x1f4:_0x209dc7['statusCode']||0x1f4;logger[_0x1cb9('0x22')](_0x1cb9('0x70'),'getFields',_0x423aae,JSON[_0x1cb9('0x71')](_0x209dc7));delete _0x209dc7[_0x1cb9('0x24')];if(_0x423aae===0x191){_0x423aae=0x190;}_0x17c361[_0x1cb9('0x17')](_0x423aae)[_0x1cb9('0x25')](_0x330fc1['query'][_0x1cb9('0x6f')]?{'message':_0x1cb9('0x72'),'statusCode':_0x209dc7[_0x1cb9('0x73')]}:_0x209dc7);});}; \ No newline at end of file +var _0x065e=['filter','merge','where','VIRTUAL','name','options','include','findAll','rows','catch','show','keys','intersection','includeAll','find','create','body','params','findOne','ZendeskConfiguration','rawAttributes','getConfigurations','nolimit','addConfiguration','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','statusCode','stringify','test','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','ZendeskAccount','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x362ce7,_0x602407){var _0x1856fa=function(_0x335082){while(--_0x335082){_0x362ce7['push'](_0x362ce7['shift']());}};_0x1856fa(++_0x602407);}(_0x065e,0x1a7));var _0xe065=function(_0x92308,_0x2c5965){_0x92308=_0x92308-0x0;var _0x3e6f92=_0x065e[_0x92308];return _0x3e6f92;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];var integrations=require(_0xe065('0x16'));function respondWithStatusCode(_0xf5ab44,_0x5bd30f){_0x5bd30f=_0x5bd30f||0xcc;return function(_0x3aa3be){if(_0x3aa3be){return _0xf5ab44[_0xe065('0x17')](_0x5bd30f);}return _0xf5ab44[_0xe065('0x18')](_0x5bd30f)[_0xe065('0x19')]();};}function respondWithResult(_0x29297b,_0x541985){_0x541985=_0x541985||0xc8;return function(_0x3d3557){if(_0x3d3557){return _0x29297b[_0xe065('0x18')](_0x541985)[_0xe065('0x1a')](_0x3d3557);}};}function respondWithFilteredResult(_0xc5ef4f,_0x434e07){return function(_0x352206){if(_0x352206){var _0x2e5feb=typeof _0x434e07['offset']===_0xe065('0x1b')&&typeof _0x434e07[_0xe065('0x1c')]==='undefined';var _0x2bfec0=_0x352206[_0xe065('0x1d')];var _0x397f05=_0x2e5feb?0x0:_0x434e07[_0xe065('0x1e')];var _0x1e7177=_0x2e5feb?_0x352206[_0xe065('0x1d')]:_0x434e07[_0xe065('0x1e')]+_0x434e07['limit'];var _0x45479e;if(_0x1e7177>=_0x2bfec0){_0x1e7177=_0x2bfec0;_0x45479e=0xc8;}else{_0x45479e=0xce;}_0xc5ef4f['status'](_0x45479e);return _0xc5ef4f[_0xe065('0x1f')](_0xe065('0x20'),_0x397f05+'-'+_0x1e7177+'/'+_0x2bfec0)['json'](_0x352206);}return null;};}function patchUpdates(_0x1c6567){return function(_0x587d47){try{jsonpatch[_0xe065('0x21')](_0x587d47,_0x1c6567,!![]);}catch(_0x5fe80){return BPromise[_0xe065('0x22')](_0x5fe80);}return _0x587d47[_0xe065('0x23')]();};}function saveUpdates(_0x3ecd13,_0x105cb2){return function(_0x22a0cb){if(_0x22a0cb){return _0x22a0cb[_0xe065('0x24')](_0x3ecd13)[_0xe065('0x25')](function(_0x5081a3){return _0x5081a3;});}return null;};}function removeEntity(_0x7208af,_0x43b712){return function(_0x44ec95){if(_0x44ec95){return _0x44ec95[_0xe065('0x26')]()['then'](function(){_0x7208af['status'](0xcc)[_0xe065('0x19')]();});}};}function handleEntityNotFound(_0x530dc0,_0x14e6b6){return function(_0x27e669){if(!_0x27e669){_0x530dc0[_0xe065('0x17')](0x194);}return _0x27e669;};}function handleError(_0x15b598,_0x418731){_0x418731=_0x418731||0x1f4;return function(_0x3ec154){logger[_0xe065('0x27')](_0x3ec154[_0xe065('0x28')]);if(_0x3ec154['name']){delete _0x3ec154['name'];}_0x15b598[_0xe065('0x18')](_0x418731)[_0xe065('0x29')](_0x3ec154);};}exports[_0xe065('0x2a')]=function(_0x441e96,_0x5b1220){var _0x23f573={},_0x55ecaa={},_0x522420={'count':0x0,'rows':[]};var _0x182743=_[_0xe065('0x2b')](db[_0xe065('0x2c')]['rawAttributes'],function(_0x883747){return{'name':_0x883747['fieldName'],'type':_0x883747[_0xe065('0x2d')][_0xe065('0x2e')]};});_0x55ecaa[_0xe065('0x2f')]=_[_0xe065('0x2b')](_0x182743,'name');_0x55ecaa[_0xe065('0x30')]=_['keys'](_0x441e96[_0xe065('0x30')]);_0x55ecaa[_0xe065('0x31')]=_['intersection'](_0x55ecaa[_0xe065('0x2f')],_0x55ecaa['query']);_0x23f573[_0xe065('0x32')]=_['intersection'](_0x55ecaa[_0xe065('0x2f')],qs[_0xe065('0x33')](_0x441e96[_0xe065('0x30')][_0xe065('0x33')]));_0x23f573['attributes']=_0x23f573[_0xe065('0x32')][_0xe065('0x34')]?_0x23f573[_0xe065('0x32')]:_0x55ecaa[_0xe065('0x2f')];if(!_0x441e96[_0xe065('0x30')][_0xe065('0x35')]('nolimit')){_0x23f573[_0xe065('0x1c')]=qs[_0xe065('0x1c')](_0x441e96['query'][_0xe065('0x1c')]);_0x23f573[_0xe065('0x1e')]=qs[_0xe065('0x1e')](_0x441e96[_0xe065('0x30')][_0xe065('0x1e')]);}_0x23f573[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x441e96['query'][_0xe065('0x37')]);_0x23f573['where']=qs[_0xe065('0x31')](_[_0xe065('0x38')](_0x441e96[_0xe065('0x30')],_0x55ecaa[_0xe065('0x31')]),_0x182743);if(_0x441e96[_0xe065('0x30')][_0xe065('0x39')]){_0x23f573['where']=_[_0xe065('0x3a')](_0x23f573[_0xe065('0x3b')],{'$or':_[_0xe065('0x2b')](_0x182743,function(_0x4c6a77){if(_0x4c6a77[_0xe065('0x2d')]!==_0xe065('0x3c')){var _0x1b273d={};_0x1b273d[_0x4c6a77[_0xe065('0x3d')]]={'$like':'%'+_0x441e96[_0xe065('0x30')]['filter']+'%'};return _0x1b273d;}})});}_0x23f573=_[_0xe065('0x3a')]({},_0x23f573,_0x441e96[_0xe065('0x3e')]);var _0x5d4f19={'where':_0x23f573[_0xe065('0x3b')]};return db['ZendeskAccount'][_0xe065('0x1d')](_0x5d4f19)[_0xe065('0x25')](function(_0x4a3152){_0x522420[_0xe065('0x1d')]=_0x4a3152;if(_0x441e96[_0xe065('0x30')]['includeAll']){_0x23f573[_0xe065('0x3f')]=[{'all':!![]}];}return db[_0xe065('0x2c')][_0xe065('0x40')](_0x23f573);})[_0xe065('0x25')](function(_0x3a617c){_0x522420[_0xe065('0x41')]=_0x3a617c;return _0x522420;})[_0xe065('0x25')](respondWithFilteredResult(_0x5b1220,_0x23f573))[_0xe065('0x42')](handleError(_0x5b1220,null));};exports[_0xe065('0x43')]=function(_0x445738,_0x326493){var _0x4364c3={'raw':![],'where':{'id':_0x445738['params']['id']}},_0x137627={};_0x137627['model']=_[_0xe065('0x44')](db[_0xe065('0x2c')]['rawAttributes']);_0x137627[_0xe065('0x30')]=_[_0xe065('0x44')](_0x445738[_0xe065('0x30')]);_0x137627[_0xe065('0x31')]=_[_0xe065('0x45')](_0x137627[_0xe065('0x2f')],_0x137627[_0xe065('0x30')]);_0x4364c3[_0xe065('0x32')]=_[_0xe065('0x45')](_0x137627['model'],qs[_0xe065('0x33')](_0x445738[_0xe065('0x30')][_0xe065('0x33')]));_0x4364c3['attributes']=_0x4364c3[_0xe065('0x32')][_0xe065('0x34')]?_0x4364c3[_0xe065('0x32')]:_0x137627[_0xe065('0x2f')];if(_0x445738['query'][_0xe065('0x46')]){_0x4364c3[_0xe065('0x3f')]=[{'all':!![]}];}_0x4364c3=_[_0xe065('0x3a')]({},_0x4364c3,_0x445738[_0xe065('0x3e')]);return db[_0xe065('0x2c')][_0xe065('0x47')](_0x4364c3)[_0xe065('0x25')](handleEntityNotFound(_0x326493,null))['then'](respondWithResult(_0x326493,null))[_0xe065('0x42')](handleError(_0x326493,null));};exports[_0xe065('0x48')]=function(_0x335744,_0xe9f589){return db[_0xe065('0x2c')][_0xe065('0x48')](_0x335744[_0xe065('0x49')],{})['then'](respondWithResult(_0xe9f589,0xc9))[_0xe065('0x42')](handleError(_0xe9f589,null));};exports['update']=function(_0x45fe1f,_0x2d2e63){if(_0x45fe1f[_0xe065('0x49')]['id']){delete _0x45fe1f['body']['id'];}return db[_0xe065('0x2c')][_0xe065('0x47')]({'where':{'id':_0x45fe1f[_0xe065('0x4a')]['id']}})[_0xe065('0x25')](handleEntityNotFound(_0x2d2e63,null))[_0xe065('0x25')](saveUpdates(_0x45fe1f[_0xe065('0x49')],null))[_0xe065('0x25')](respondWithResult(_0x2d2e63,null))[_0xe065('0x42')](handleError(_0x2d2e63,null));};exports[_0xe065('0x26')]=function(_0x2ca55a,_0x3f91a2){return db[_0xe065('0x2c')][_0xe065('0x47')]({'where':{'id':_0x2ca55a['params']['id']}})['then'](handleEntityNotFound(_0x3f91a2,null))['then'](removeEntity(_0x3f91a2,null))[_0xe065('0x42')](handleError(_0x3f91a2,null));};exports['getConfigurations']=function(_0x105bf7,_0x2c5e42,_0x5a7a98){var _0x480aec={};var _0x45a60e={};var _0x20272a;var _0x5cce78;return db[_0xe065('0x2c')][_0xe065('0x4b')]({'where':{'id':_0x105bf7[_0xe065('0x4a')]['id']}})[_0xe065('0x25')](handleEntityNotFound(_0x2c5e42,null))[_0xe065('0x25')](function(_0x1ea568){if(_0x1ea568){_0x20272a=_0x1ea568;_0x45a60e[_0xe065('0x2f')]=_[_0xe065('0x44')](db[_0xe065('0x4c')][_0xe065('0x4d')]);_0x45a60e['query']=_[_0xe065('0x44')](_0x105bf7[_0xe065('0x30')]);_0x45a60e[_0xe065('0x31')]=_[_0xe065('0x45')](_0x45a60e['model'],_0x45a60e[_0xe065('0x30')]);_0x480aec[_0xe065('0x32')]=_[_0xe065('0x45')](_0x45a60e[_0xe065('0x2f')],qs['fields'](_0x105bf7[_0xe065('0x30')][_0xe065('0x33')]));_0x480aec[_0xe065('0x32')]=_0x480aec['attributes'][_0xe065('0x34')]?_0x480aec[_0xe065('0x32')]:_0x45a60e[_0xe065('0x2f')];_0x480aec[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x105bf7[_0xe065('0x30')][_0xe065('0x37')]);_0x480aec[_0xe065('0x3b')]=qs[_0xe065('0x31')](_['pick'](_0x105bf7[_0xe065('0x30')],_0x45a60e['filters']));if(_0x105bf7[_0xe065('0x30')][_0xe065('0x39')]){_0x480aec[_0xe065('0x3b')]=_['merge'](_0x480aec['where'],{'$or':_['map'](_0x480aec[_0xe065('0x32')],function(_0x380664){var _0x82a39f={};_0x82a39f[_0x380664]={'$like':'%'+_0x105bf7[_0xe065('0x30')][_0xe065('0x39')]+'%'};return _0x82a39f;})});}_0x480aec=_[_0xe065('0x3a')]({},_0x480aec,_0x105bf7[_0xe065('0x3e')]);return _0x20272a[_0xe065('0x4e')](_0x480aec);}})[_0xe065('0x25')](function(_0x3169fa){if(_0x3169fa){_0x5cce78=_0x3169fa[_0xe065('0x34')];if(!_0x105bf7['query']['hasOwnProperty'](_0xe065('0x4f'))){_0x480aec[_0xe065('0x1c')]=qs['limit'](_0x105bf7[_0xe065('0x30')]['limit']);_0x480aec['offset']=qs[_0xe065('0x1e')](_0x105bf7[_0xe065('0x30')][_0xe065('0x1e')]);}return _0x20272a[_0xe065('0x4e')](_0x480aec);}})[_0xe065('0x25')](function(_0x817baf){if(_0x817baf){return _0x817baf?{'count':_0x5cce78,'rows':_0x817baf}:null;}})[_0xe065('0x25')](respondWithResult(_0x2c5e42,null))['catch'](handleError(_0x2c5e42,null));};exports[_0xe065('0x50')]=function(_0x265c5e,_0xaef095,_0xb3591e){if(_0x265c5e[_0xe065('0x49')]['id']){delete _0x265c5e['body']['id'];}return db[_0xe065('0x2c')][_0xe065('0x4b')]({'where':{'id':_0x265c5e[_0xe065('0x4a')]['id']}})[_0xe065('0x25')](handleEntityNotFound(_0xaef095,null))[_0xe065('0x25')](function(_0xfce2e){if(_0xfce2e){_0x265c5e['body']['AccountId']=_0xfce2e['id'];_0x265c5e['body']['Subjects']=integrations['getSubjects'](_0x265c5e[_0xe065('0x49')][_0xe065('0x51')],_0x265c5e[_0xe065('0x49')][_0xe065('0x2d')]);_0x265c5e[_0xe065('0x49')][_0xe065('0x52')]=integrations[_0xe065('0x53')](_0x265c5e[_0xe065('0x49')]['channel'],_0x265c5e['body'][_0xe065('0x2d')]);return db[_0xe065('0x4c')][_0xe065('0x48')](_0x265c5e['body'],{'include':[{'model':db[_0xe065('0x54')],'as':_0xe065('0x55')},{'model':db[_0xe065('0x54')],'as':_0xe065('0x52')}]});}return null;})[_0xe065('0x25')](respondWithResult(_0xaef095,null))[_0xe065('0x42')](handleError(_0xaef095,null));};exports[_0xe065('0x56')]=function(_0x199ca3,_0x27863d,_0xecef2){var _0x213feb='';return db[_0xe065('0x2c')][_0xe065('0x4b')]({'where':{'id':_0x199ca3[_0xe065('0x4a')]['id']},'attributes':['id',_0xe065('0x57'),_0xe065('0x58'),_0xe065('0x59'),_0xe065('0x5a'),'remoteUri']})[_0xe065('0x25')](handleEntityNotFound(_0x27863d,null))[_0xe065('0x25')](function(_0x233a43){if(_0x233a43){_0x213feb=_0x233a43[_0xe065('0x5b')];var _0x36b88d=_0x213feb[_0xe065('0x5c')](-0x1);if(_0x36b88d==='/'){_0x213feb=_0x213feb[_0xe065('0x5d')](0x0,_0x213feb[_0xe065('0x5e')](_0x36b88d));}var _0x3364c7={'method':_0xe065('0x5f'),'uri':util[_0xe065('0x60')](_0xe065('0x61'),_0x213feb,_0xe065('0x62')),'json':!![]};switch(_0x233a43[_0xe065('0x5a')]){case _0xe065('0x58'):_0x3364c7[_0xe065('0x63')]={'Authorization':util[_0xe065('0x60')]('Basic\x20%s',new Buffer(util[_0xe065('0x60')](_0xe065('0x64'),_0x233a43[_0xe065('0x57')],_0x233a43[_0xe065('0x58')]))[_0xe065('0x65')](_0xe065('0x66')))};break;case _0xe065('0x59'):_0x3364c7[_0xe065('0x63')]={'Authorization':util[_0xe065('0x60')](_0xe065('0x67'),new Buffer(util['format']('%s/token:%s',_0x233a43[_0xe065('0x57')],_0x233a43['token']))[_0xe065('0x65')]('base64'))};break;default:throw new db[(_0xe065('0x68'))][(_0xe065('0x69'))](_0xe065('0x6a'));}return rp(_0x3364c7);}})[_0xe065('0x25')](function(_0x42cb90){if(_0x42cb90){var _0x3318d4=[_0xe065('0x6b'),_0xe065('0x6c'),_0xe065('0x6d'),'assignee'];_[_0xe065('0x6e')](_0x42cb90[_0xe065('0x62')],function(_0x134d0a){return _0x3318d4[_0xe065('0x6f')](_0x134d0a['type']);});return{'count':_0x42cb90[_0xe065('0x62')][_0xe065('0x34')],'rows':_[_0xe065('0x2b')](_0x42cb90['ticket_fields'],function(_0x200d25){return{'id':_0x200d25['id'],'name':_0x200d25[_0xe065('0x70')]>0x7?_0x200d25[_0xe065('0x71')]:_0x200d25['type'],'custom':_0x200d25[_0xe065('0x70')]>0x7?!![]:![],'options':_0x200d25[_0xe065('0x72')]?_0x200d25['system_field_options']:_0x200d25['custom_field_options']?_0x200d25[_0xe065('0x73')]:[]};})};}})[_0xe065('0x25')](respondWithResult(_0x27863d,null))[_0xe065('0x42')](function(_0x3f3878){var _0x260588=_0x199ca3['query']['test']?0x1f4:_0x3f3878[_0xe065('0x74')]||0x1f4;logger[_0xe065('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xe065('0x56'),_0x260588,JSON[_0xe065('0x75')](_0x3f3878));delete _0x3f3878[_0xe065('0x3d')];if(_0x260588===0x191){_0x260588=0x190;}_0x27863d[_0xe065('0x18')](_0x260588)[_0xe065('0x29')](_0x199ca3[_0xe065('0x30')][_0xe065('0x76')]?{'message':_0xe065('0x77'),'statusCode':_0x3f3878[_0xe065('0x74')]}:_0x3f3878);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d8985ed..5a48940 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 _0x545d=['request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x545d,0x170));var _0xd545=function(_0x2d3de3,_0x1d82e8){_0x2d3de3=_0x2d3de3-0x0;var _0x307abe=_0x545d[_0x2d3de3];return _0x307abe;};'use strict';var _=require(_0xd545('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd545('0x1'));var BPromise=require('bluebird');var rp=require(_0xd545('0x2'));var fs=require('fs');var path=require(_0xd545('0x3'));var rimraf=require(_0xd545('0x4'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xd545('0x5'));module[_0xd545('0x6')]=function(_0x33c3e3,_0xf3dfa8){return _0x33c3e3[_0xd545('0x7')](_0xd545('0x8'),attributes,{'tableName':_0xd545('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x639c=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x52b4a2,_0x1acc91){var _0x3fd925=function(_0x1e10ac){while(--_0x1e10ac){_0x52b4a2['push'](_0x52b4a2['shift']());}};_0x3fd925(++_0x1acc91);}(_0x639c,0xc8));var _0xc639=function(_0x44fb02,_0x16bdbc){_0x44fb02=_0x44fb02-0x0;var _0x4d3aaa=_0x639c[_0x44fb02];return _0x4d3aaa;};'use strict';var _=require(_0xc639('0x0'));var util=require(_0xc639('0x1'));var logger=require(_0xc639('0x2'))(_0xc639('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc639('0x4'));var fs=require('fs');var path=require(_0xc639('0x5'));var rimraf=require(_0xc639('0x6'));var config=require(_0xc639('0x7'));var attributes=require(_0xc639('0x8'));var integrations=require(_0xc639('0x9'));module[_0xc639('0xa')]=function(_0x305ffc,_0x4e11e6){return _0x305ffc[_0xc639('0xb')]('ZendeskAccount',attributes,{'tableName':_0xc639('0xc'),'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 36b4ce9..4d93fc9 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 _0x221a=['findAll','options','raw','where','attributes','map','model','include','ShowZendeskAccount','find','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x221a,0x1ba));var _0xa221=function(_0x3f938e,_0x4b1e51){_0x3f938e=_0x3f938e-0x0;var _0x280e4f=_0x221a[_0x3f938e];return _0x280e4f;};'use strict';var _=require('lodash');var util=require(_0xa221('0x0'));var moment=require(_0xa221('0x1'));var BPromise=require('bluebird');var rs=require(_0xa221('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa221('0x3'))['db'];var utils=require(_0xa221('0x4'));var logger=require(_0xa221('0x5'))(_0xa221('0x6'));var config=require(_0xa221('0x7'));var jayson=require(_0xa221('0x8'));var client=jayson[_0xa221('0x9')][_0xa221('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f09b,_0x4f6048,_0x5a0b0a){return new BPromise(function(_0x1aa634,_0x56cf1c){return client[_0xa221('0xb')](_0x51f09b,_0x5a0b0a)[_0xa221('0xc')](function(_0x513b9b){logger[_0xa221('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x4f6048,'request\x20sent');logger[_0xa221('0xe')](_0xa221('0xf'),_0x4f6048,_0xa221('0x10'),JSON[_0xa221('0x11')](_0x513b9b));if(_0x513b9b[_0xa221('0x12')]){if(_0x513b9b[_0xa221('0x12')][_0xa221('0x13')]===0x1f4){logger[_0xa221('0x12')](_0xa221('0x14'),_0x4f6048,_0x513b9b[_0xa221('0x12')][_0xa221('0x15')]);return _0x56cf1c(_0x513b9b[_0xa221('0x12')]['message']);}logger[_0xa221('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4f6048,_0x513b9b[_0xa221('0x12')]['message']);return _0x1aa634(_0x513b9b[_0xa221('0x12')][_0xa221('0x15')]);}else{logger[_0xa221('0xd')](_0xa221('0x14'),_0x4f6048,_0xa221('0x10'));_0x1aa634(_0x513b9b[_0xa221('0x16')][_0xa221('0x15')]);}})[_0xa221('0x17')](function(_0x1309d3){logger[_0xa221('0x12')](_0xa221('0x14'),_0x4f6048,_0x1309d3);_0x56cf1c(_0x1309d3);});});}exports[_0xa221('0x18')]=function(_0x32b139){var _0x5b5ac4=this;return new Promise(function(_0x33e6c6,_0x10363b){return db[_0xa221('0x19')][_0xa221('0x1a')]({'raw':_0x32b139[_0xa221('0x1b')]?_0x32b139['options'][_0xa221('0x1c')]===undefined?!![]:![]:!![],'where':_0x32b139[_0xa221('0x1b')]?_0x32b139[_0xa221('0x1b')][_0xa221('0x1d')]||null:null,'attributes':_0x32b139['options']?_0x32b139[_0xa221('0x1b')][_0xa221('0x1e')]||null:null,'limit':_0x32b139[_0xa221('0x1b')]?_0x32b139['options']['limit']||null:null,'include':_0x32b139[_0xa221('0x1b')]?_0x32b139[_0xa221('0x1b')]['include']?_[_0xa221('0x1f')](_0x32b139[_0xa221('0x1b')]['include'],function(_0x10c111){return{'model':db[_0x10c111[_0xa221('0x20')]],'as':_0x10c111['as'],'attributes':_0x10c111['attributes'],'include':_0x10c111['include']?_[_0xa221('0x1f')](_0x10c111[_0xa221('0x21')],function(_0x3347a8){return{'model':db[_0x3347a8['model']],'as':_0x3347a8['as'],'attributes':_0x3347a8['attributes'],'include':_0x3347a8[_0xa221('0x21')]?_[_0xa221('0x1f')](_0x3347a8[_0xa221('0x21')],function(_0x2f4859){return{'model':db[_0x2f4859['model']],'as':_0x2f4859['as'],'attributes':_0x2f4859[_0xa221('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4086eb){logger[_0xa221('0xd')](_0xa221('0x18'),_0x32b139);logger['debug']('GetZendeskAccount',_0x32b139,JSON[_0xa221('0x11')](_0x4086eb));_0x33e6c6(_0x4086eb);})[_0xa221('0x17')](function(_0x73c7e5){logger['error'](_0xa221('0x18'),_0x73c7e5['message'],_0x32b139);_0x10363b(_0x5b5ac4[_0xa221('0x12')](0x1f4,_0x73c7e5[_0xa221('0x15')]));});});};exports[_0xa221('0x22')]=function(_0x2ff839){var _0xe2579c=this;return new Promise(function(_0x5d1cfc,_0x648fa2){return db[_0xa221('0x19')][_0xa221('0x23')]({'raw':_0x2ff839[_0xa221('0x1b')]?_0x2ff839[_0xa221('0x1b')][_0xa221('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ff839[_0xa221('0x1b')]?_0x2ff839[_0xa221('0x1b')][_0xa221('0x1d')]||null:null,'attributes':_0x2ff839[_0xa221('0x1b')]?_0x2ff839[_0xa221('0x1b')][_0xa221('0x1e')]||null:null,'include':_0x2ff839[_0xa221('0x1b')]?_0x2ff839[_0xa221('0x1b')][_0xa221('0x21')]?_[_0xa221('0x1f')](_0x2ff839[_0xa221('0x1b')][_0xa221('0x21')],function(_0x2356ce){return{'model':db[_0x2356ce[_0xa221('0x20')]],'as':_0x2356ce['as'],'attributes':_0x2356ce['attributes'],'include':_0x2356ce[_0xa221('0x21')]?_['map'](_0x2356ce[_0xa221('0x21')],function(_0x582869){return{'model':db[_0x582869['model']],'as':_0x582869['as'],'attributes':_0x582869[_0xa221('0x1e')],'include':_0x582869[_0xa221('0x21')]?_[_0xa221('0x1f')](_0x582869[_0xa221('0x21')],function(_0x302e3b){return{'model':db[_0x302e3b[_0xa221('0x20')]],'as':_0x302e3b['as'],'attributes':_0x302e3b['attributes']};}):[]};}):[]};}):[]:[]})[_0xa221('0xc')](function(_0x4f9742){logger[_0xa221('0xd')](_0xa221('0x22'),_0x2ff839);logger[_0xa221('0xe')](_0xa221('0x22'),_0x2ff839,JSON['stringify'](_0x4f9742));_0x5d1cfc(_0x4f9742);})['catch'](function(_0x1a9e24){logger[_0xa221('0x12')]('ShowZendeskAccount',_0x1a9e24[_0xa221('0x15')],_0x2ff839);_0x648fa2(_0xe2579c['error'](0x1f4,_0x1a9e24['message']));});});}; \ No newline at end of file +var _0xec37=['raw','where','attributes','include','map','model','then','debug','stringify','catch','ShowZendeskAccount','find','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskAccount,\x20%s,\x20%s','GetZendeskAccount','ZendeskAccount','options'];(function(_0x1f23ed,_0x2c86a8){var _0x157de5=function(_0x3be7a8){while(--_0x3be7a8){_0x1f23ed['push'](_0x1f23ed['shift']());}};_0x157de5(++_0x2c86a8);}(_0xec37,0xd2));var _0x7ec3=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0xec37[_0x3d78d7];return _0x4b6784;};'use strict';var _=require(_0x7ec3('0x0'));var util=require(_0x7ec3('0x1'));var moment=require('moment');var BPromise=require(_0x7ec3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ec3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ec3('0x4'));var logger=require(_0x7ec3('0x5'))(_0x7ec3('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ec3('0x7'));var client=jayson[_0x7ec3('0x8')][_0x7ec3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5de69b,_0x6e81d6,_0x5664db){return new BPromise(function(_0x2f4029,_0x204c08){return client[_0x7ec3('0xa')](_0x5de69b,_0x5664db)['then'](function(_0x185f42){logger[_0x7ec3('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x6e81d6,_0x7ec3('0xc'));logger['debug'](_0x7ec3('0xd'),_0x6e81d6,_0x7ec3('0xc'),JSON['stringify'](_0x185f42));if(_0x185f42[_0x7ec3('0xe')]){if(_0x185f42[_0x7ec3('0xe')][_0x7ec3('0xf')]===0x1f4){logger[_0x7ec3('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x6e81d6,_0x185f42['error'][_0x7ec3('0x10')]);return _0x204c08(_0x185f42['error']['message']);}logger['error'](_0x7ec3('0x11'),_0x6e81d6,_0x185f42['error'][_0x7ec3('0x10')]);return _0x2f4029(_0x185f42['error'][_0x7ec3('0x10')]);}else{logger[_0x7ec3('0xb')](_0x7ec3('0x11'),_0x6e81d6,_0x7ec3('0xc'));_0x2f4029(_0x185f42['result'][_0x7ec3('0x10')]);}})['catch'](function(_0x3720ac){logger['error'](_0x7ec3('0x11'),_0x6e81d6,_0x3720ac);_0x204c08(_0x3720ac);});});}exports[_0x7ec3('0x12')]=function(_0xd65208){var _0x3dbcc3=this;return new Promise(function(_0x1bc10b,_0x5c8db9){return db[_0x7ec3('0x13')]['findAll']({'raw':_0xd65208['options']?_0xd65208[_0x7ec3('0x14')][_0x7ec3('0x15')]===undefined?!![]:![]:!![],'where':_0xd65208['options']?_0xd65208[_0x7ec3('0x14')][_0x7ec3('0x16')]||null:null,'attributes':_0xd65208[_0x7ec3('0x14')]?_0xd65208[_0x7ec3('0x14')][_0x7ec3('0x17')]||null:null,'limit':_0xd65208[_0x7ec3('0x14')]?_0xd65208['options']['limit']||null:null,'include':_0xd65208[_0x7ec3('0x14')]?_0xd65208[_0x7ec3('0x14')][_0x7ec3('0x18')]?_[_0x7ec3('0x19')](_0xd65208[_0x7ec3('0x14')][_0x7ec3('0x18')],function(_0x50d2b2){return{'model':db[_0x50d2b2[_0x7ec3('0x1a')]],'as':_0x50d2b2['as'],'attributes':_0x50d2b2['attributes'],'include':_0x50d2b2[_0x7ec3('0x18')]?_[_0x7ec3('0x19')](_0x50d2b2['include'],function(_0x2ba8c5){return{'model':db[_0x2ba8c5[_0x7ec3('0x1a')]],'as':_0x2ba8c5['as'],'attributes':_0x2ba8c5[_0x7ec3('0x17')],'include':_0x2ba8c5[_0x7ec3('0x18')]?_[_0x7ec3('0x19')](_0x2ba8c5[_0x7ec3('0x18')],function(_0x1e8c3c){return{'model':db[_0x1e8c3c[_0x7ec3('0x1a')]],'as':_0x1e8c3c['as'],'attributes':_0x1e8c3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ec3('0x1b')](function(_0x5615b3){logger[_0x7ec3('0xb')](_0x7ec3('0x12'),_0xd65208);logger[_0x7ec3('0x1c')](_0x7ec3('0x12'),_0xd65208,JSON[_0x7ec3('0x1d')](_0x5615b3));_0x1bc10b(_0x5615b3);})[_0x7ec3('0x1e')](function(_0x346f4c){logger[_0x7ec3('0xe')](_0x7ec3('0x12'),_0x346f4c[_0x7ec3('0x10')],_0xd65208);_0x5c8db9(_0x3dbcc3[_0x7ec3('0xe')](0x1f4,_0x346f4c[_0x7ec3('0x10')]));});});};exports[_0x7ec3('0x1f')]=function(_0x2d1fc4){var _0x5a65b8=this;return new Promise(function(_0x50d3d0,_0x2249c8){return db[_0x7ec3('0x13')][_0x7ec3('0x20')]({'raw':_0x2d1fc4[_0x7ec3('0x14')]?_0x2d1fc4[_0x7ec3('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2d1fc4['options']?_0x2d1fc4[_0x7ec3('0x14')][_0x7ec3('0x16')]||null:null,'attributes':_0x2d1fc4[_0x7ec3('0x14')]?_0x2d1fc4[_0x7ec3('0x14')][_0x7ec3('0x17')]||null:null,'include':_0x2d1fc4['options']?_0x2d1fc4['options']['include']?_[_0x7ec3('0x19')](_0x2d1fc4[_0x7ec3('0x14')][_0x7ec3('0x18')],function(_0x20bbf0){return{'model':db[_0x20bbf0[_0x7ec3('0x1a')]],'as':_0x20bbf0['as'],'attributes':_0x20bbf0['attributes'],'include':_0x20bbf0['include']?_[_0x7ec3('0x19')](_0x20bbf0[_0x7ec3('0x18')],function(_0x2c01b1){return{'model':db[_0x2c01b1['model']],'as':_0x2c01b1['as'],'attributes':_0x2c01b1[_0x7ec3('0x17')],'include':_0x2c01b1['include']?_['map'](_0x2c01b1[_0x7ec3('0x18')],function(_0x1e15ee){return{'model':db[_0x1e15ee['model']],'as':_0x1e15ee['as'],'attributes':_0x1e15ee['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19facf){logger[_0x7ec3('0xb')](_0x7ec3('0x1f'),_0x2d1fc4);logger[_0x7ec3('0x1c')](_0x7ec3('0x1f'),_0x2d1fc4,JSON['stringify'](_0x19facf));_0x50d3d0(_0x19facf);})[_0x7ec3('0x1e')](function(_0x57c41){logger[_0x7ec3('0xe')](_0x7ec3('0x1f'),_0x57c41[_0x7ec3('0x10')],_0x2d1fc4);_0x2249c8(_0x5a65b8['error'](0x1f4,_0x57c41[_0x7ec3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f7a08f8..4840d05 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 _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file +var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x4022dd,_0x211e73){var _0x38939b=function(_0x42acb1){while(--_0x42acb1){_0x4022dd['push'](_0x4022dd['shift']());}};_0x38939b(++_0x211e73);}(_0x4fc2,0x111));var _0x24fc=function(_0x300860,_0x509371){_0x300860=_0x300860-0x0;var _0x2094ad=_0x4fc2[_0x300860];return _0x2094ad;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('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 7f610f0..48518ac 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 _0x12f3=['STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x12f3,0x7a));var _0x312f=function(_0x339aa1,_0x2a6089){_0x339aa1=_0x339aa1-0x0;var _0x1679b9=_0x12f3[_0x339aa1];return _0x1679b9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x312f('0x0')]}}; \ No newline at end of file +var _0x4aa4=['STRING','sequelize','exports'];(function(_0x1ae4b7,_0x33adca){var _0x50e065=function(_0x13ea6b){while(--_0x13ea6b){_0x1ae4b7['push'](_0x1ae4b7['shift']());}};_0x50e065(++_0x33adca);}(_0x4aa4,0x19f));var _0x44aa=function(_0x18c4c2,_0x401aa4){_0x18c4c2=_0x18c4c2-0x0;var _0x37ea52=_0x4aa4[_0x18c4c2];return _0x37ea52;};'use strict';var Sequelize=require(_0x44aa('0x0'));module[_0x44aa('0x1')]={'name':{'type':Sequelize[_0x44aa('0x2')]},'description':{'type':Sequelize[_0x44aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 8ec0c25..8f09ba4 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 _0xfb61=['VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getFields','findOne','ZendeskField','pick','nolimit','limit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ZendeskConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge'];(function(_0x2c29a0,_0x149dbf){var _0x1bbc01=function(_0x41e13e){while(--_0x41e13e){_0x2c29a0['push'](_0x2c29a0['shift']());}};_0x1bbc01(++_0x149dbf);}(_0xfb61,0x174));var _0x1fb6=function(_0x438434,_0x36f21f){_0x438434=_0x438434-0x0;var _0x3b97c9=_0xfb61[_0x438434];return _0x3b97c9;};'use strict';var emlformat=require(_0x1fb6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb6('0x2'));var moment=require(_0x1fb6('0x3'));var BPromise=require(_0x1fb6('0x4'));var Mustache=require(_0x1fb6('0x5'));var util=require(_0x1fb6('0x6'));var path=require(_0x1fb6('0x7'));var sox=require(_0x1fb6('0x8'));var csv=require(_0x1fb6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fb6('0xa'));var _=require(_0x1fb6('0xb'));var squel=require(_0x1fb6('0xc'));var crypto=require(_0x1fb6('0xd'));var jsforce=require(_0x1fb6('0xe'));var deskjs=require(_0x1fb6('0xf'));var toCsv=require(_0x1fb6('0x9'));var querystring=require(_0x1fb6('0x10'));var Papa=require(_0x1fb6('0x11'));var Redis=require(_0x1fb6('0x12'));var authService=require(_0x1fb6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1fb6('0x14'));var hardwareService=require(_0x1fb6('0x15'));var logger=require(_0x1fb6('0x16'))('api');var utils=require(_0x1fb6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1fb6('0x18'));var db=require(_0x1fb6('0x19'))['db'];function respondWithStatusCode(_0x1f4cd7,_0x4693c1){_0x4693c1=_0x4693c1||0xcc;return function(_0xd1e663){if(_0xd1e663){return _0x1f4cd7[_0x1fb6('0x1a')](_0x4693c1);}return _0x1f4cd7[_0x1fb6('0x1b')](_0x4693c1)[_0x1fb6('0x1c')]();};}function respondWithResult(_0x48d42d,_0x5b159d){_0x5b159d=_0x5b159d||0xc8;return function(_0x154bb0){if(_0x154bb0){return _0x48d42d['status'](_0x5b159d)[_0x1fb6('0x1d')](_0x154bb0);}};}function respondWithFilteredResult(_0xf452bd,_0x2ad46c){return function(_0x6a58e0){if(_0x6a58e0){var _0x17b603=typeof _0x2ad46c[_0x1fb6('0x1e')]===_0x1fb6('0x1f')&&typeof _0x2ad46c['limit']===_0x1fb6('0x1f');var _0x2c48e1=_0x6a58e0[_0x1fb6('0x20')];var _0x207fa8=_0x17b603?0x0:_0x2ad46c[_0x1fb6('0x1e')];var _0x2462ad=_0x17b603?_0x6a58e0[_0x1fb6('0x20')]:_0x2ad46c['offset']+_0x2ad46c['limit'];var _0x5d65d8;if(_0x2462ad>=_0x2c48e1){_0x2462ad=_0x2c48e1;_0x5d65d8=0xc8;}else{_0x5d65d8=0xce;}_0xf452bd[_0x1fb6('0x1b')](_0x5d65d8);return _0xf452bd[_0x1fb6('0x21')](_0x1fb6('0x22'),_0x207fa8+'-'+_0x2462ad+'/'+_0x2c48e1)[_0x1fb6('0x1d')](_0x6a58e0);}return null;};}function patchUpdates(_0x2a09e1){return function(_0x23959c){try{jsonpatch[_0x1fb6('0x23')](_0x23959c,_0x2a09e1,!![]);}catch(_0xec836a){return BPromise[_0x1fb6('0x24')](_0xec836a);}return _0x23959c[_0x1fb6('0x25')]();};}function saveUpdates(_0x763f9e,_0x653614){return function(_0x4cd59c){if(_0x4cd59c){return _0x4cd59c[_0x1fb6('0x26')](_0x763f9e)[_0x1fb6('0x27')](function(_0x2399aa){return _0x2399aa;});}return null;};}function removeEntity(_0x58e2c8,_0x21b372){return function(_0x13f88c){if(_0x13f88c){return _0x13f88c[_0x1fb6('0x28')]()[_0x1fb6('0x27')](function(){_0x58e2c8[_0x1fb6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x243351,_0x20dddc){return function(_0x44d131){if(!_0x44d131){_0x243351[_0x1fb6('0x1a')](0x194);}return _0x44d131;};}function handleError(_0x3d9100,_0x4f0bce){_0x4f0bce=_0x4f0bce||0x1f4;return function(_0x1310ac){logger[_0x1fb6('0x29')](_0x1310ac['stack']);if(_0x1310ac[_0x1fb6('0x2a')]){delete _0x1310ac[_0x1fb6('0x2a')];}_0x3d9100[_0x1fb6('0x1b')](_0x4f0bce)[_0x1fb6('0x2b')](_0x1310ac);};}exports['index']=function(_0x51efab,_0x1f9c0c){var _0x8d3ec={},_0x547885={},_0x532788={'count':0x0,'rows':[]};var _0x218330=_[_0x1fb6('0x2c')](db[_0x1fb6('0x2d')]['rawAttributes'],function(_0x19d10f){return{'name':_0x19d10f[_0x1fb6('0x2e')],'type':_0x19d10f[_0x1fb6('0x2f')][_0x1fb6('0x30')]};});_0x547885[_0x1fb6('0x31')]=_['map'](_0x218330,_0x1fb6('0x2a'));_0x547885['query']=_[_0x1fb6('0x32')](_0x51efab[_0x1fb6('0x33')]);_0x547885[_0x1fb6('0x34')]=_[_0x1fb6('0x35')](_0x547885[_0x1fb6('0x31')],_0x547885[_0x1fb6('0x33')]);_0x8d3ec[_0x1fb6('0x36')]=_[_0x1fb6('0x35')](_0x547885[_0x1fb6('0x31')],qs[_0x1fb6('0x37')](_0x51efab['query'][_0x1fb6('0x37')]));_0x8d3ec['attributes']=_0x8d3ec[_0x1fb6('0x36')][_0x1fb6('0x38')]?_0x8d3ec['attributes']:_0x547885[_0x1fb6('0x31')];if(!_0x51efab['query'][_0x1fb6('0x39')]('nolimit')){_0x8d3ec['limit']=qs['limit'](_0x51efab[_0x1fb6('0x33')]['limit']);_0x8d3ec[_0x1fb6('0x1e')]=qs[_0x1fb6('0x1e')](_0x51efab['query'][_0x1fb6('0x1e')]);}_0x8d3ec[_0x1fb6('0x3a')]=qs['sort'](_0x51efab['query'][_0x1fb6('0x3b')]);_0x8d3ec[_0x1fb6('0x3c')]=qs[_0x1fb6('0x34')](_['pick'](_0x51efab['query'],_0x547885[_0x1fb6('0x34')]),_0x218330);if(_0x51efab['query'][_0x1fb6('0x3d')]){_0x8d3ec[_0x1fb6('0x3c')]=_[_0x1fb6('0x3e')](_0x8d3ec[_0x1fb6('0x3c')],{'$or':_[_0x1fb6('0x2c')](_0x218330,function(_0x19d9a5){if(_0x19d9a5[_0x1fb6('0x2f')]!==_0x1fb6('0x3f')){var _0x25c954={};_0x25c954[_0x19d9a5[_0x1fb6('0x2a')]]={'$like':'%'+_0x51efab[_0x1fb6('0x33')][_0x1fb6('0x3d')]+'%'};return _0x25c954;}})});}_0x8d3ec=_[_0x1fb6('0x3e')]({},_0x8d3ec,_0x51efab[_0x1fb6('0x40')]);var _0x3eee05={'where':_0x8d3ec['where']};return db[_0x1fb6('0x2d')]['count'](_0x3eee05)['then'](function(_0x263ca0){_0x532788[_0x1fb6('0x20')]=_0x263ca0;if(_0x51efab[_0x1fb6('0x33')][_0x1fb6('0x41')]){_0x8d3ec[_0x1fb6('0x42')]=[{'all':!![]}];}return db[_0x1fb6('0x2d')][_0x1fb6('0x43')](_0x8d3ec);})[_0x1fb6('0x27')](function(_0x495bfc){_0x532788[_0x1fb6('0x44')]=_0x495bfc;return _0x532788;})[_0x1fb6('0x27')](respondWithFilteredResult(_0x1f9c0c,_0x8d3ec))[_0x1fb6('0x45')](handleError(_0x1f9c0c,null));};exports['show']=function(_0x5c87eb,_0x1ac353){var _0x4d44b4={'raw':![],'where':{'id':_0x5c87eb[_0x1fb6('0x46')]['id']}},_0x40cad6={};_0x40cad6[_0x1fb6('0x31')]=_[_0x1fb6('0x32')](db[_0x1fb6('0x2d')][_0x1fb6('0x47')]);_0x40cad6['query']=_[_0x1fb6('0x32')](_0x5c87eb[_0x1fb6('0x33')]);_0x40cad6[_0x1fb6('0x34')]=_['intersection'](_0x40cad6['model'],_0x40cad6[_0x1fb6('0x33')]);_0x4d44b4[_0x1fb6('0x36')]=_['intersection'](_0x40cad6['model'],qs[_0x1fb6('0x37')](_0x5c87eb[_0x1fb6('0x33')][_0x1fb6('0x37')]));_0x4d44b4[_0x1fb6('0x36')]=_0x4d44b4['attributes'][_0x1fb6('0x38')]?_0x4d44b4[_0x1fb6('0x36')]:_0x40cad6['model'];if(_0x5c87eb[_0x1fb6('0x33')][_0x1fb6('0x41')]){_0x4d44b4[_0x1fb6('0x42')]=[{'all':!![]}];}_0x4d44b4=_[_0x1fb6('0x3e')]({},_0x4d44b4,_0x5c87eb[_0x1fb6('0x40')]);return db['ZendeskConfiguration'][_0x1fb6('0x48')](_0x4d44b4)[_0x1fb6('0x27')](handleEntityNotFound(_0x1ac353,null))[_0x1fb6('0x27')](respondWithResult(_0x1ac353,null))['catch'](handleError(_0x1ac353,null));};exports[_0x1fb6('0x49')]=function(_0x49f6b3,_0x13a3a4){return db[_0x1fb6('0x2d')][_0x1fb6('0x49')](_0x49f6b3[_0x1fb6('0x4a')],{})['then'](respondWithResult(_0x13a3a4,0xc9))[_0x1fb6('0x45')](handleError(_0x13a3a4,null));};exports[_0x1fb6('0x26')]=function(_0x4f68e0,_0x1d835b){if(_0x4f68e0[_0x1fb6('0x4a')]['id']){delete _0x4f68e0[_0x1fb6('0x4a')]['id'];}return db[_0x1fb6('0x2d')][_0x1fb6('0x48')]({'where':{'id':_0x4f68e0[_0x1fb6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d835b,null))[_0x1fb6('0x27')](saveUpdates(_0x4f68e0['body'],null))[_0x1fb6('0x27')](respondWithResult(_0x1d835b,null))['catch'](handleError(_0x1d835b,null));};exports[_0x1fb6('0x28')]=function(_0x2843cb,_0x527f4d){return db[_0x1fb6('0x2d')][_0x1fb6('0x48')]({'where':{'id':_0x2843cb[_0x1fb6('0x46')]['id']}})[_0x1fb6('0x27')](handleEntityNotFound(_0x527f4d,null))[_0x1fb6('0x27')](removeEntity(_0x527f4d,null))[_0x1fb6('0x45')](handleError(_0x527f4d,null));};exports[_0x1fb6('0x4b')]=function(_0x239f4d,_0x2d8b6f,_0x356a97){var _0x5ac994={};var _0x4d0dad={};var _0x34a2fa;var _0x291548;return db[_0x1fb6('0x2d')][_0x1fb6('0x4c')]({'where':{'id':_0x239f4d[_0x1fb6('0x46')]['id']}})[_0x1fb6('0x27')](handleEntityNotFound(_0x2d8b6f,null))['then'](function(_0x3f8a52){if(_0x3f8a52){_0x34a2fa=_0x3f8a52;_0x4d0dad[_0x1fb6('0x31')]=_['keys'](db[_0x1fb6('0x4d')][_0x1fb6('0x47')]);_0x4d0dad[_0x1fb6('0x33')]=_[_0x1fb6('0x32')](_0x239f4d[_0x1fb6('0x33')]);_0x4d0dad[_0x1fb6('0x34')]=_[_0x1fb6('0x35')](_0x4d0dad[_0x1fb6('0x31')],_0x4d0dad[_0x1fb6('0x33')]);_0x5ac994[_0x1fb6('0x36')]=_[_0x1fb6('0x35')](_0x4d0dad[_0x1fb6('0x31')],qs[_0x1fb6('0x37')](_0x239f4d[_0x1fb6('0x33')][_0x1fb6('0x37')]));_0x5ac994[_0x1fb6('0x36')]=_0x5ac994[_0x1fb6('0x36')][_0x1fb6('0x38')]?_0x5ac994[_0x1fb6('0x36')]:_0x4d0dad[_0x1fb6('0x31')];_0x5ac994['order']=qs[_0x1fb6('0x3b')](_0x239f4d[_0x1fb6('0x33')]['sort']);_0x5ac994[_0x1fb6('0x3c')]=qs[_0x1fb6('0x34')](_[_0x1fb6('0x4e')](_0x239f4d[_0x1fb6('0x33')],_0x4d0dad[_0x1fb6('0x34')]));if(_0x239f4d['query'][_0x1fb6('0x3d')]){_0x5ac994[_0x1fb6('0x3c')]=_['merge'](_0x5ac994[_0x1fb6('0x3c')],{'$or':_[_0x1fb6('0x2c')](_0x5ac994[_0x1fb6('0x36')],function(_0x4c72b1){var _0x159dfc={};_0x159dfc[_0x4c72b1]={'$like':'%'+_0x239f4d['query'][_0x1fb6('0x3d')]+'%'};return _0x159dfc;})});}_0x5ac994=_[_0x1fb6('0x3e')]({},_0x5ac994,_0x239f4d[_0x1fb6('0x40')]);return _0x34a2fa[_0x1fb6('0x4b')](_0x5ac994);}})['then'](function(_0x3cab62){if(_0x3cab62){_0x291548=_0x3cab62[_0x1fb6('0x38')];if(!_0x239f4d[_0x1fb6('0x33')]['hasOwnProperty'](_0x1fb6('0x4f'))){_0x5ac994[_0x1fb6('0x50')]=qs[_0x1fb6('0x50')](_0x239f4d[_0x1fb6('0x33')]['limit']);_0x5ac994[_0x1fb6('0x1e')]=qs[_0x1fb6('0x1e')](_0x239f4d[_0x1fb6('0x33')][_0x1fb6('0x1e')]);}return _0x34a2fa[_0x1fb6('0x4b')](_0x5ac994);}})[_0x1fb6('0x27')](function(_0x58c760){if(_0x58c760){return _0x58c760?{'count':_0x291548,'rows':_0x58c760}:null;}})[_0x1fb6('0x27')](respondWithResult(_0x2d8b6f,null))[_0x1fb6('0x45')](handleError(_0x2d8b6f,null));};exports[_0x1fb6('0x51')]=function(_0x191b2d,_0x5469e4,_0x3adaae){var _0x423caf={};var _0x3c6ea5={};var _0xb9c00d;var _0x2f74c6;return db[_0x1fb6('0x2d')]['findOne']({'where':{'id':_0x191b2d[_0x1fb6('0x46')]['id']}})[_0x1fb6('0x27')](handleEntityNotFound(_0x5469e4,null))[_0x1fb6('0x27')](function(_0x42cc2c){if(_0x42cc2c){_0xb9c00d=_0x42cc2c;_0x3c6ea5[_0x1fb6('0x31')]=_[_0x1fb6('0x32')](db[_0x1fb6('0x4d')][_0x1fb6('0x47')]);_0x3c6ea5[_0x1fb6('0x33')]=_['keys'](_0x191b2d[_0x1fb6('0x33')]);_0x3c6ea5[_0x1fb6('0x34')]=_['intersection'](_0x3c6ea5['model'],_0x3c6ea5[_0x1fb6('0x33')]);_0x423caf[_0x1fb6('0x36')]=_['intersection'](_0x3c6ea5[_0x1fb6('0x31')],qs[_0x1fb6('0x37')](_0x191b2d['query'][_0x1fb6('0x37')]));_0x423caf[_0x1fb6('0x36')]=_0x423caf[_0x1fb6('0x36')][_0x1fb6('0x38')]?_0x423caf[_0x1fb6('0x36')]:_0x3c6ea5['model'];_0x423caf[_0x1fb6('0x3a')]=qs[_0x1fb6('0x3b')](_0x191b2d[_0x1fb6('0x33')][_0x1fb6('0x3b')]);_0x423caf['where']=qs[_0x1fb6('0x34')](_[_0x1fb6('0x4e')](_0x191b2d[_0x1fb6('0x33')],_0x3c6ea5['filters']));if(_0x191b2d['query'][_0x1fb6('0x3d')]){_0x423caf[_0x1fb6('0x3c')]=_[_0x1fb6('0x3e')](_0x423caf['where'],{'$or':_['map'](_0x423caf['attributes'],function(_0x2dc6b1){var _0x3697d1={};_0x3697d1[_0x2dc6b1]={'$like':'%'+_0x191b2d[_0x1fb6('0x33')]['filter']+'%'};return _0x3697d1;})});}_0x423caf=_['merge']({},_0x423caf,_0x191b2d[_0x1fb6('0x40')]);return _0xb9c00d['getSubjects'](_0x423caf);}})[_0x1fb6('0x27')](function(_0x36c8ea){if(_0x36c8ea){_0x2f74c6=_0x36c8ea[_0x1fb6('0x38')];if(!_0x191b2d['query']['hasOwnProperty']('nolimit')){_0x423caf[_0x1fb6('0x50')]=qs[_0x1fb6('0x50')](_0x191b2d['query']['limit']);_0x423caf[_0x1fb6('0x1e')]=qs[_0x1fb6('0x1e')](_0x191b2d['query'][_0x1fb6('0x1e')]);}return _0xb9c00d['getSubjects'](_0x423caf);}})[_0x1fb6('0x27')](function(_0x3861cc){if(_0x3861cc){return _0x3861cc?{'count':_0x2f74c6,'rows':_0x3861cc}:null;}})['then'](respondWithResult(_0x5469e4,null))[_0x1fb6('0x45')](handleError(_0x5469e4,null));};exports[_0x1fb6('0x52')]=function(_0x5dc39a,_0x1fd7c8,_0x5d41cc){var _0x30fef9={};var _0x213f18={};var _0x53981f;var _0xca4b39;return db[_0x1fb6('0x2d')][_0x1fb6('0x4c')]({'where':{'id':_0x5dc39a[_0x1fb6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fd7c8,null))[_0x1fb6('0x27')](function(_0x14b797){if(_0x14b797){_0x53981f=_0x14b797;_0x213f18['model']=_[_0x1fb6('0x32')](db[_0x1fb6('0x4d')][_0x1fb6('0x47')]);_0x213f18[_0x1fb6('0x33')]=_[_0x1fb6('0x32')](_0x5dc39a['query']);_0x213f18[_0x1fb6('0x34')]=_[_0x1fb6('0x35')](_0x213f18[_0x1fb6('0x31')],_0x213f18[_0x1fb6('0x33')]);_0x30fef9[_0x1fb6('0x36')]=_[_0x1fb6('0x35')](_0x213f18[_0x1fb6('0x31')],qs[_0x1fb6('0x37')](_0x5dc39a[_0x1fb6('0x33')][_0x1fb6('0x37')]));_0x30fef9[_0x1fb6('0x36')]=_0x30fef9[_0x1fb6('0x36')][_0x1fb6('0x38')]?_0x30fef9[_0x1fb6('0x36')]:_0x213f18['model'];_0x30fef9[_0x1fb6('0x3a')]=qs['sort'](_0x5dc39a[_0x1fb6('0x33')][_0x1fb6('0x3b')]);_0x30fef9[_0x1fb6('0x3c')]=qs[_0x1fb6('0x34')](_[_0x1fb6('0x4e')](_0x5dc39a[_0x1fb6('0x33')],_0x213f18['filters']));if(_0x5dc39a[_0x1fb6('0x33')][_0x1fb6('0x3d')]){_0x30fef9[_0x1fb6('0x3c')]=_['merge'](_0x30fef9['where'],{'$or':_['map'](_0x30fef9[_0x1fb6('0x36')],function(_0x5f3ee5){var _0x2d718d={};_0x2d718d[_0x5f3ee5]={'$like':'%'+_0x5dc39a['query'][_0x1fb6('0x3d')]+'%'};return _0x2d718d;})});}_0x30fef9=_['merge']({},_0x30fef9,_0x5dc39a[_0x1fb6('0x40')]);return _0x53981f[_0x1fb6('0x52')](_0x30fef9);}})['then'](function(_0x3dbb07){if(_0x3dbb07){_0xca4b39=_0x3dbb07['length'];if(!_0x5dc39a[_0x1fb6('0x33')]['hasOwnProperty'](_0x1fb6('0x4f'))){_0x30fef9[_0x1fb6('0x50')]=qs['limit'](_0x5dc39a[_0x1fb6('0x33')][_0x1fb6('0x50')]);_0x30fef9['offset']=qs[_0x1fb6('0x1e')](_0x5dc39a[_0x1fb6('0x33')][_0x1fb6('0x1e')]);}return _0x53981f[_0x1fb6('0x52')](_0x30fef9);}})[_0x1fb6('0x27')](function(_0x2490a1){if(_0x2490a1){return _0x2490a1?{'count':_0xca4b39,'rows':_0x2490a1}:null;}})[_0x1fb6('0x27')](respondWithResult(_0x1fd7c8,null))['catch'](handleError(_0x1fd7c8,null));};exports['getTags']=function(_0xe9d218,_0x8ec36f,_0x3d4cf6){var _0x436a07={};var _0x4ad9a4={};var _0x3594d3;var _0x161ea;return db[_0x1fb6('0x2d')][_0x1fb6('0x4c')]({'where':{'id':_0xe9d218[_0x1fb6('0x46')]['id']}})[_0x1fb6('0x27')](handleEntityNotFound(_0x8ec36f,null))[_0x1fb6('0x27')](function(_0x53ab41){if(_0x53ab41){_0x3594d3=_0x53ab41;_0x4ad9a4[_0x1fb6('0x31')]=_[_0x1fb6('0x32')](db[_0x1fb6('0x53')][_0x1fb6('0x47')]);_0x4ad9a4[_0x1fb6('0x33')]=_[_0x1fb6('0x32')](_0xe9d218['query']);_0x4ad9a4[_0x1fb6('0x34')]=_[_0x1fb6('0x35')](_0x4ad9a4[_0x1fb6('0x31')],_0x4ad9a4['query']);_0x436a07[_0x1fb6('0x36')]=_['intersection'](_0x4ad9a4[_0x1fb6('0x31')],qs[_0x1fb6('0x37')](_0xe9d218[_0x1fb6('0x33')][_0x1fb6('0x37')]));_0x436a07[_0x1fb6('0x36')]=_0x436a07[_0x1fb6('0x36')][_0x1fb6('0x38')]?_0x436a07['attributes']:_0x4ad9a4[_0x1fb6('0x31')];_0x436a07[_0x1fb6('0x3a')]=qs[_0x1fb6('0x3b')](_0xe9d218[_0x1fb6('0x33')][_0x1fb6('0x3b')]);_0x436a07[_0x1fb6('0x3c')]=qs[_0x1fb6('0x34')](_[_0x1fb6('0x4e')](_0xe9d218['query'],_0x4ad9a4[_0x1fb6('0x34')]));if(_0xe9d218[_0x1fb6('0x33')][_0x1fb6('0x3d')]){_0x436a07[_0x1fb6('0x3c')]=_[_0x1fb6('0x3e')](_0x436a07['where'],{'$or':_['map'](_0x436a07[_0x1fb6('0x36')],function(_0x51634c){var _0x418702={};_0x418702[_0x51634c]={'$like':'%'+_0xe9d218[_0x1fb6('0x33')][_0x1fb6('0x3d')]+'%'};return _0x418702;})});}_0x436a07=_['merge']({},_0x436a07,_0xe9d218['options']);return _0x3594d3[_0x1fb6('0x54')](_0x436a07);}})[_0x1fb6('0x27')](function(_0x48aa9e){if(_0x48aa9e){_0x161ea=_0x48aa9e[_0x1fb6('0x38')];if(!_0xe9d218[_0x1fb6('0x33')][_0x1fb6('0x39')](_0x1fb6('0x4f'))){_0x436a07[_0x1fb6('0x50')]=qs['limit'](_0xe9d218[_0x1fb6('0x33')][_0x1fb6('0x50')]);_0x436a07[_0x1fb6('0x1e')]=qs['offset'](_0xe9d218[_0x1fb6('0x33')][_0x1fb6('0x1e')]);}return _0x3594d3['getTags'](_0x436a07);}})['then'](function(_0x12d9b0){if(_0x12d9b0){return _0x12d9b0?{'count':_0x161ea,'rows':_0x12d9b0}:null;}})[_0x1fb6('0x27')](respondWithResult(_0x8ec36f,null))['catch'](handleError(_0x8ec36f,null));};exports[_0x1fb6('0x55')]=function(_0x96ef05,_0x22c93f,_0x3ecb4e){if(_0x96ef05['body']['id']){delete _0x96ef05[_0x1fb6('0x4a')]['id'];}return db[_0x1fb6('0x2d')]['findOne']({'where':{'id':_0x96ef05['params']['id']}})[_0x1fb6('0x27')](handleEntityNotFound(_0x22c93f,null))[_0x1fb6('0x27')](function(_0x2a2515){if(_0x2a2515){return _0x2a2515['setTags'](_0x96ef05[_0x1fb6('0x4a')][_0x1fb6('0x56')]||[]);}return null;})[_0x1fb6('0x27')](respondWithResult(_0x22c93f,null))['catch'](handleError(_0x22c93f,null));}; \ No newline at end of file +var _0x11a1=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','filters','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','fields','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x11a1,0x1f4));var _0x111a=function(_0x23ee57,_0x15e898){_0x23ee57=_0x23ee57-0x0;var _0x2eae97=_0x11a1[_0x23ee57];return _0x2eae97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x111a('0x0'));var zipdir=require(_0x111a('0x1'));var jsonpatch=require(_0x111a('0x2'));var rp=require('request-promise');var moment=require(_0x111a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x111a('0x4'));var path=require(_0x111a('0x5'));var sox=require(_0x111a('0x6'));var csv=require(_0x111a('0x7'));var ejs=require(_0x111a('0x8'));var fs=require('fs');var fs_extra=require(_0x111a('0x9'));var _=require(_0x111a('0xa'));var squel=require(_0x111a('0xb'));var crypto=require(_0x111a('0xc'));var jsforce=require(_0x111a('0xd'));var deskjs=require(_0x111a('0xe'));var toCsv=require(_0x111a('0x7'));var querystring=require(_0x111a('0xf'));var Papa=require(_0x111a('0x10'));var Redis=require('ioredis');var authService=require(_0x111a('0x11'));var qs=require(_0x111a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x111a('0x13'))('api');var utils=require(_0x111a('0x14'));var config=require(_0x111a('0x15'));var licenseUtil=require(_0x111a('0x16'));var db=require(_0x111a('0x17'))['db'];function respondWithStatusCode(_0x26e0eb,_0x2a1eca){_0x2a1eca=_0x2a1eca||0xcc;return function(_0x2c3764){if(_0x2c3764){return _0x26e0eb['sendStatus'](_0x2a1eca);}return _0x26e0eb[_0x111a('0x18')](_0x2a1eca)['end']();};}function respondWithResult(_0x589cb4,_0x351289){_0x351289=_0x351289||0xc8;return function(_0x21447e){if(_0x21447e){return _0x589cb4['status'](_0x351289)[_0x111a('0x19')](_0x21447e);}};}function respondWithFilteredResult(_0x5136db,_0x49e1e8){return function(_0x1774cf){if(_0x1774cf){var _0x287940=typeof _0x49e1e8[_0x111a('0x1a')]==='undefined'&&typeof _0x49e1e8[_0x111a('0x1b')]===_0x111a('0x1c');var _0x2b97be=_0x1774cf[_0x111a('0x1d')];var _0x559850=_0x287940?0x0:_0x49e1e8[_0x111a('0x1a')];var _0x52ef60=_0x287940?_0x1774cf[_0x111a('0x1d')]:_0x49e1e8['offset']+_0x49e1e8[_0x111a('0x1b')];var _0x4854c8;if(_0x52ef60>=_0x2b97be){_0x52ef60=_0x2b97be;_0x4854c8=0xc8;}else{_0x4854c8=0xce;}_0x5136db[_0x111a('0x18')](_0x4854c8);return _0x5136db['set'](_0x111a('0x1e'),_0x559850+'-'+_0x52ef60+'/'+_0x2b97be)[_0x111a('0x19')](_0x1774cf);}return null;};}function patchUpdates(_0x2286fd){return function(_0x52a933){try{jsonpatch[_0x111a('0x1f')](_0x52a933,_0x2286fd,!![]);}catch(_0x41526d){return BPromise[_0x111a('0x20')](_0x41526d);}return _0x52a933[_0x111a('0x21')]();};}function saveUpdates(_0x230dac,_0x971fc3){return function(_0x2fef9a){if(_0x2fef9a){return _0x2fef9a[_0x111a('0x22')](_0x230dac)[_0x111a('0x23')](function(_0xd65712){return _0xd65712;});}return null;};}function removeEntity(_0x237b07,_0x172836){return function(_0x3facd3){if(_0x3facd3){return _0x3facd3[_0x111a('0x24')]()[_0x111a('0x23')](function(){_0x237b07[_0x111a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7873,_0x158ae0){return function(_0x2f7499){if(!_0x2f7499){_0x4a7873[_0x111a('0x25')](0x194);}return _0x2f7499;};}function handleError(_0x17f425,_0x39b495){_0x39b495=_0x39b495||0x1f4;return function(_0x35c080){logger[_0x111a('0x26')](_0x35c080[_0x111a('0x27')]);if(_0x35c080[_0x111a('0x28')]){delete _0x35c080[_0x111a('0x28')];}_0x17f425[_0x111a('0x18')](_0x39b495)[_0x111a('0x29')](_0x35c080);};}exports[_0x111a('0x2a')]=function(_0x20cdb7,_0x394c95){var _0x1930fd={},_0x5e5fb4={},_0x39c571={'count':0x0,'rows':[]};var _0x2147c4=_['map'](db[_0x111a('0x2b')]['rawAttributes'],function(_0x2447af){return{'name':_0x2447af[_0x111a('0x2c')],'type':_0x2447af[_0x111a('0x2d')][_0x111a('0x2e')]};});_0x5e5fb4[_0x111a('0x2f')]=_[_0x111a('0x30')](_0x2147c4,_0x111a('0x28'));_0x5e5fb4['query']=_['keys'](_0x20cdb7['query']);_0x5e5fb4[_0x111a('0x31')]=_['intersection'](_0x5e5fb4[_0x111a('0x2f')],_0x5e5fb4[_0x111a('0x32')]);_0x1930fd[_0x111a('0x33')]=_['intersection'](_0x5e5fb4[_0x111a('0x2f')],qs['fields'](_0x20cdb7[_0x111a('0x32')]['fields']));_0x1930fd[_0x111a('0x33')]=_0x1930fd[_0x111a('0x33')][_0x111a('0x34')]?_0x1930fd[_0x111a('0x33')]:_0x5e5fb4[_0x111a('0x2f')];if(!_0x20cdb7[_0x111a('0x32')][_0x111a('0x35')](_0x111a('0x36'))){_0x1930fd[_0x111a('0x1b')]=qs[_0x111a('0x1b')](_0x20cdb7['query'][_0x111a('0x1b')]);_0x1930fd[_0x111a('0x1a')]=qs[_0x111a('0x1a')](_0x20cdb7[_0x111a('0x32')][_0x111a('0x1a')]);}_0x1930fd[_0x111a('0x37')]=qs[_0x111a('0x38')](_0x20cdb7[_0x111a('0x32')][_0x111a('0x38')]);_0x1930fd['where']=qs[_0x111a('0x31')](_[_0x111a('0x39')](_0x20cdb7['query'],_0x5e5fb4[_0x111a('0x31')]),_0x2147c4);if(_0x20cdb7[_0x111a('0x32')][_0x111a('0x3a')]){_0x1930fd[_0x111a('0x3b')]=_['merge'](_0x1930fd[_0x111a('0x3b')],{'$or':_[_0x111a('0x30')](_0x2147c4,function(_0x3d14f8){if(_0x3d14f8[_0x111a('0x2d')]!==_0x111a('0x3c')){var _0x15b27c={};_0x15b27c[_0x3d14f8['name']]={'$like':'%'+_0x20cdb7['query'][_0x111a('0x3a')]+'%'};return _0x15b27c;}})});}_0x1930fd=_[_0x111a('0x3d')]({},_0x1930fd,_0x20cdb7[_0x111a('0x3e')]);var _0x39baa4={'where':_0x1930fd[_0x111a('0x3b')]};return db['ZendeskConfiguration'][_0x111a('0x1d')](_0x39baa4)[_0x111a('0x23')](function(_0x2e97a2){_0x39c571['count']=_0x2e97a2;if(_0x20cdb7[_0x111a('0x32')]['includeAll']){_0x1930fd[_0x111a('0x3f')]=[{'all':!![]}];}return db[_0x111a('0x2b')][_0x111a('0x40')](_0x1930fd);})['then'](function(_0x407382){_0x39c571[_0x111a('0x41')]=_0x407382;return _0x39c571;})['then'](respondWithFilteredResult(_0x394c95,_0x1930fd))[_0x111a('0x42')](handleError(_0x394c95,null));};exports[_0x111a('0x43')]=function(_0x2b4989,_0x36c14e){var _0x278507={'raw':![],'where':{'id':_0x2b4989[_0x111a('0x44')]['id']}},_0x23b5f6={};_0x23b5f6[_0x111a('0x2f')]=_[_0x111a('0x45')](db[_0x111a('0x2b')][_0x111a('0x46')]);_0x23b5f6[_0x111a('0x32')]=_[_0x111a('0x45')](_0x2b4989[_0x111a('0x32')]);_0x23b5f6['filters']=_['intersection'](_0x23b5f6[_0x111a('0x2f')],_0x23b5f6[_0x111a('0x32')]);_0x278507[_0x111a('0x33')]=_[_0x111a('0x47')](_0x23b5f6[_0x111a('0x2f')],qs['fields'](_0x2b4989[_0x111a('0x32')][_0x111a('0x48')]));_0x278507[_0x111a('0x33')]=_0x278507['attributes'][_0x111a('0x34')]?_0x278507['attributes']:_0x23b5f6[_0x111a('0x2f')];if(_0x2b4989['query']['includeAll']){_0x278507[_0x111a('0x3f')]=[{'all':!![]}];}_0x278507=_[_0x111a('0x3d')]({},_0x278507,_0x2b4989[_0x111a('0x3e')]);return db[_0x111a('0x2b')][_0x111a('0x49')](_0x278507)[_0x111a('0x23')](handleEntityNotFound(_0x36c14e,null))['then'](respondWithResult(_0x36c14e,null))[_0x111a('0x42')](handleError(_0x36c14e,null));};exports[_0x111a('0x4a')]=function(_0x1bb0eb,_0xad1757){return db[_0x111a('0x2b')][_0x111a('0x4a')](_0x1bb0eb[_0x111a('0x4b')],{})[_0x111a('0x23')](respondWithResult(_0xad1757,0xc9))['catch'](handleError(_0xad1757,null));};exports[_0x111a('0x22')]=function(_0x3246ee,_0x230b7){if(_0x3246ee['body']['id']){delete _0x3246ee[_0x111a('0x4b')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x3246ee[_0x111a('0x44')]['id']}})[_0x111a('0x23')](handleEntityNotFound(_0x230b7,null))[_0x111a('0x23')](saveUpdates(_0x3246ee[_0x111a('0x4b')],null))[_0x111a('0x23')](respondWithResult(_0x230b7,null))[_0x111a('0x42')](handleError(_0x230b7,null));};exports[_0x111a('0x24')]=function(_0x261629,_0x4c3845){return db['ZendeskConfiguration'][_0x111a('0x49')]({'where':{'id':_0x261629[_0x111a('0x44')]['id']}})[_0x111a('0x23')](handleEntityNotFound(_0x4c3845,null))[_0x111a('0x23')](removeEntity(_0x4c3845,null))['catch'](handleError(_0x4c3845,null));};exports[_0x111a('0x4c')]=function(_0x35a5cb,_0x17f5d4,_0x4d1429){var _0x37e3f3={};var _0x3b5cd0={};var _0x3b705e;var _0x6dd593;return db[_0x111a('0x2b')][_0x111a('0x4d')]({'where':{'id':_0x35a5cb[_0x111a('0x44')]['id']}})[_0x111a('0x23')](handleEntityNotFound(_0x17f5d4,null))[_0x111a('0x23')](function(_0x4390a9){if(_0x4390a9){_0x3b705e=_0x4390a9;_0x3b5cd0['model']=_['keys'](db[_0x111a('0x4e')][_0x111a('0x46')]);_0x3b5cd0['query']=_[_0x111a('0x45')](_0x35a5cb[_0x111a('0x32')]);_0x3b5cd0['filters']=_[_0x111a('0x47')](_0x3b5cd0[_0x111a('0x2f')],_0x3b5cd0[_0x111a('0x32')]);_0x37e3f3['attributes']=_['intersection'](_0x3b5cd0[_0x111a('0x2f')],qs[_0x111a('0x48')](_0x35a5cb[_0x111a('0x32')][_0x111a('0x48')]));_0x37e3f3[_0x111a('0x33')]=_0x37e3f3['attributes'][_0x111a('0x34')]?_0x37e3f3['attributes']:_0x3b5cd0['model'];_0x37e3f3['order']=qs['sort'](_0x35a5cb[_0x111a('0x32')][_0x111a('0x38')]);_0x37e3f3[_0x111a('0x3b')]=qs[_0x111a('0x31')](_['pick'](_0x35a5cb[_0x111a('0x32')],_0x3b5cd0[_0x111a('0x31')]));if(_0x35a5cb[_0x111a('0x32')][_0x111a('0x3a')]){_0x37e3f3[_0x111a('0x3b')]=_[_0x111a('0x3d')](_0x37e3f3[_0x111a('0x3b')],{'$or':_[_0x111a('0x30')](_0x37e3f3[_0x111a('0x33')],function(_0x39aa1b){var _0x5270ff={};_0x5270ff[_0x39aa1b]={'$like':'%'+_0x35a5cb[_0x111a('0x32')][_0x111a('0x3a')]+'%'};return _0x5270ff;})});}_0x37e3f3=_['merge']({},_0x37e3f3,_0x35a5cb[_0x111a('0x3e')]);return _0x3b705e[_0x111a('0x4c')](_0x37e3f3);}})['then'](function(_0x3c46b9){if(_0x3c46b9){_0x6dd593=_0x3c46b9[_0x111a('0x34')];if(!_0x35a5cb['query'][_0x111a('0x35')](_0x111a('0x36'))){_0x37e3f3[_0x111a('0x1b')]=qs[_0x111a('0x1b')](_0x35a5cb[_0x111a('0x32')][_0x111a('0x1b')]);_0x37e3f3['offset']=qs[_0x111a('0x1a')](_0x35a5cb[_0x111a('0x32')]['offset']);}return _0x3b705e['getFields'](_0x37e3f3);}})[_0x111a('0x23')](function(_0x3608de){if(_0x3608de){return _0x3608de?{'count':_0x6dd593,'rows':_0x3608de}:null;}})[_0x111a('0x23')](respondWithResult(_0x17f5d4,null))[_0x111a('0x42')](handleError(_0x17f5d4,null));};exports[_0x111a('0x4f')]=function(_0x597f17,_0x5d7576,_0x4505c4){var _0xac6a05={};var _0x264236={};var _0x9ff32e;var _0x5c090d;return db[_0x111a('0x2b')]['findOne']({'where':{'id':_0x597f17['params']['id']}})[_0x111a('0x23')](handleEntityNotFound(_0x5d7576,null))[_0x111a('0x23')](function(_0x14c20f){if(_0x14c20f){_0x9ff32e=_0x14c20f;_0x264236[_0x111a('0x2f')]=_[_0x111a('0x45')](db[_0x111a('0x4e')][_0x111a('0x46')]);_0x264236[_0x111a('0x32')]=_['keys'](_0x597f17[_0x111a('0x32')]);_0x264236[_0x111a('0x31')]=_[_0x111a('0x47')](_0x264236[_0x111a('0x2f')],_0x264236['query']);_0xac6a05[_0x111a('0x33')]=_[_0x111a('0x47')](_0x264236[_0x111a('0x2f')],qs['fields'](_0x597f17[_0x111a('0x32')][_0x111a('0x48')]));_0xac6a05['attributes']=_0xac6a05[_0x111a('0x33')][_0x111a('0x34')]?_0xac6a05[_0x111a('0x33')]:_0x264236[_0x111a('0x2f')];_0xac6a05[_0x111a('0x37')]=qs[_0x111a('0x38')](_0x597f17['query'][_0x111a('0x38')]);_0xac6a05['where']=qs['filters'](_[_0x111a('0x39')](_0x597f17[_0x111a('0x32')],_0x264236[_0x111a('0x31')]));if(_0x597f17['query'][_0x111a('0x3a')]){_0xac6a05[_0x111a('0x3b')]=_[_0x111a('0x3d')](_0xac6a05[_0x111a('0x3b')],{'$or':_[_0x111a('0x30')](_0xac6a05[_0x111a('0x33')],function(_0x2efc74){var _0x216eae={};_0x216eae[_0x2efc74]={'$like':'%'+_0x597f17[_0x111a('0x32')][_0x111a('0x3a')]+'%'};return _0x216eae;})});}_0xac6a05=_['merge']({},_0xac6a05,_0x597f17['options']);return _0x9ff32e[_0x111a('0x4f')](_0xac6a05);}})['then'](function(_0x475828){if(_0x475828){_0x5c090d=_0x475828[_0x111a('0x34')];if(!_0x597f17[_0x111a('0x32')][_0x111a('0x35')]('nolimit')){_0xac6a05[_0x111a('0x1b')]=qs[_0x111a('0x1b')](_0x597f17[_0x111a('0x32')]['limit']);_0xac6a05[_0x111a('0x1a')]=qs[_0x111a('0x1a')](_0x597f17[_0x111a('0x32')][_0x111a('0x1a')]);}return _0x9ff32e[_0x111a('0x4f')](_0xac6a05);}})['then'](function(_0x19c5d3){if(_0x19c5d3){return _0x19c5d3?{'count':_0x5c090d,'rows':_0x19c5d3}:null;}})[_0x111a('0x23')](respondWithResult(_0x5d7576,null))[_0x111a('0x42')](handleError(_0x5d7576,null));};exports['getDescriptions']=function(_0x274452,_0x81daf6,_0x1e1ad9){var _0x8c8756={};var _0x3ec517={};var _0x4eb76a;var _0x55fbcd;return db[_0x111a('0x2b')][_0x111a('0x4d')]({'where':{'id':_0x274452['params']['id']}})[_0x111a('0x23')](handleEntityNotFound(_0x81daf6,null))['then'](function(_0x240510){if(_0x240510){_0x4eb76a=_0x240510;_0x3ec517[_0x111a('0x2f')]=_[_0x111a('0x45')](db['ZendeskField'][_0x111a('0x46')]);_0x3ec517[_0x111a('0x32')]=_[_0x111a('0x45')](_0x274452[_0x111a('0x32')]);_0x3ec517[_0x111a('0x31')]=_[_0x111a('0x47')](_0x3ec517[_0x111a('0x2f')],_0x3ec517[_0x111a('0x32')]);_0x8c8756['attributes']=_[_0x111a('0x47')](_0x3ec517['model'],qs[_0x111a('0x48')](_0x274452['query'][_0x111a('0x48')]));_0x8c8756[_0x111a('0x33')]=_0x8c8756[_0x111a('0x33')][_0x111a('0x34')]?_0x8c8756['attributes']:_0x3ec517['model'];_0x8c8756[_0x111a('0x37')]=qs[_0x111a('0x38')](_0x274452['query'][_0x111a('0x38')]);_0x8c8756['where']=qs[_0x111a('0x31')](_[_0x111a('0x39')](_0x274452[_0x111a('0x32')],_0x3ec517['filters']));if(_0x274452[_0x111a('0x32')]['filter']){_0x8c8756['where']=_['merge'](_0x8c8756[_0x111a('0x3b')],{'$or':_[_0x111a('0x30')](_0x8c8756[_0x111a('0x33')],function(_0x201129){var _0x411224={};_0x411224[_0x201129]={'$like':'%'+_0x274452[_0x111a('0x32')][_0x111a('0x3a')]+'%'};return _0x411224;})});}_0x8c8756=_[_0x111a('0x3d')]({},_0x8c8756,_0x274452['options']);return _0x4eb76a[_0x111a('0x50')](_0x8c8756);}})[_0x111a('0x23')](function(_0x30c05c){if(_0x30c05c){_0x55fbcd=_0x30c05c[_0x111a('0x34')];if(!_0x274452['query']['hasOwnProperty'](_0x111a('0x36'))){_0x8c8756[_0x111a('0x1b')]=qs[_0x111a('0x1b')](_0x274452['query'][_0x111a('0x1b')]);_0x8c8756[_0x111a('0x1a')]=qs[_0x111a('0x1a')](_0x274452['query'][_0x111a('0x1a')]);}return _0x4eb76a[_0x111a('0x50')](_0x8c8756);}})['then'](function(_0x2f7974){if(_0x2f7974){return _0x2f7974?{'count':_0x55fbcd,'rows':_0x2f7974}:null;}})['then'](respondWithResult(_0x81daf6,null))[_0x111a('0x42')](handleError(_0x81daf6,null));};exports['getTags']=function(_0x4210b7,_0x3bf166,_0x528359){var _0x4d6c74={};var _0x13e04a={};var _0x4ed3f6;var _0x5ef597;return db[_0x111a('0x2b')][_0x111a('0x4d')]({'where':{'id':_0x4210b7[_0x111a('0x44')]['id']}})[_0x111a('0x23')](handleEntityNotFound(_0x3bf166,null))[_0x111a('0x23')](function(_0x3b50b8){if(_0x3b50b8){_0x4ed3f6=_0x3b50b8;_0x13e04a[_0x111a('0x2f')]=_[_0x111a('0x45')](db[_0x111a('0x51')][_0x111a('0x46')]);_0x13e04a[_0x111a('0x32')]=_[_0x111a('0x45')](_0x4210b7[_0x111a('0x32')]);_0x13e04a['filters']=_['intersection'](_0x13e04a[_0x111a('0x2f')],_0x13e04a[_0x111a('0x32')]);_0x4d6c74[_0x111a('0x33')]=_[_0x111a('0x47')](_0x13e04a[_0x111a('0x2f')],qs[_0x111a('0x48')](_0x4210b7[_0x111a('0x32')][_0x111a('0x48')]));_0x4d6c74[_0x111a('0x33')]=_0x4d6c74[_0x111a('0x33')][_0x111a('0x34')]?_0x4d6c74['attributes']:_0x13e04a[_0x111a('0x2f')];_0x4d6c74['order']=qs[_0x111a('0x38')](_0x4210b7[_0x111a('0x32')]['sort']);_0x4d6c74[_0x111a('0x3b')]=qs['filters'](_[_0x111a('0x39')](_0x4210b7[_0x111a('0x32')],_0x13e04a[_0x111a('0x31')]));if(_0x4210b7[_0x111a('0x32')][_0x111a('0x3a')]){_0x4d6c74[_0x111a('0x3b')]=_['merge'](_0x4d6c74[_0x111a('0x3b')],{'$or':_[_0x111a('0x30')](_0x4d6c74[_0x111a('0x33')],function(_0xb3b5ae){var _0x199103={};_0x199103[_0xb3b5ae]={'$like':'%'+_0x4210b7['query'][_0x111a('0x3a')]+'%'};return _0x199103;})});}_0x4d6c74=_[_0x111a('0x3d')]({},_0x4d6c74,_0x4210b7['options']);return _0x4ed3f6['getTags'](_0x4d6c74);}})[_0x111a('0x23')](function(_0x33397f){if(_0x33397f){_0x5ef597=_0x33397f[_0x111a('0x34')];if(!_0x4210b7['query'][_0x111a('0x35')]('nolimit')){_0x4d6c74[_0x111a('0x1b')]=qs['limit'](_0x4210b7[_0x111a('0x32')][_0x111a('0x1b')]);_0x4d6c74[_0x111a('0x1a')]=qs['offset'](_0x4210b7[_0x111a('0x32')][_0x111a('0x1a')]);}return _0x4ed3f6['getTags'](_0x4d6c74);}})[_0x111a('0x23')](function(_0x3a379c){if(_0x3a379c){return _0x3a379c?{'count':_0x5ef597,'rows':_0x3a379c}:null;}})[_0x111a('0x23')](respondWithResult(_0x3bf166,null))[_0x111a('0x42')](handleError(_0x3bf166,null));};exports[_0x111a('0x52')]=function(_0x3b7558,_0x498665,_0x56494b){if(_0x3b7558[_0x111a('0x4b')]['id']){delete _0x3b7558[_0x111a('0x4b')]['id'];}return db['ZendeskConfiguration'][_0x111a('0x4d')]({'where':{'id':_0x3b7558['params']['id']}})['then'](handleEntityNotFound(_0x498665,null))[_0x111a('0x23')](function(_0x257473){if(_0x257473){return _0x257473[_0x111a('0x52')](_0x3b7558[_0x111a('0x4b')][_0x111a('0x53')]||[]);}return null;})[_0x111a('0x23')](respondWithResult(_0x498665,null))[_0x111a('0x42')](handleError(_0x498665,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index fe9236c..fb3638c 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 _0xfef3=['./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4a24aa,_0x56a72e){var _0x2de2a4=function(_0xc8bf76){while(--_0xc8bf76){_0x4a24aa['push'](_0x4a24aa['shift']());}};_0x2de2a4(++_0x56a72e);}(_0xfef3,0x118));var _0x3fef=function(_0x24bf11,_0x320ad8){_0x24bf11=_0x24bf11-0x0;var _0x20f05b=_0xfef3[_0x24bf11];return _0x20f05b;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var logger=require(_0x3fef('0x1'))('api');var moment=require(_0x3fef('0x2'));var BPromise=require(_0x3fef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fef('0x4'));var rimraf=require(_0x3fef('0x5'));var config=require('../../config/environment');var attributes=require(_0x3fef('0x6'));module[_0x3fef('0x7')]=function(_0x5dd9fb,_0x319a2a){return _0x5dd9fb[_0x3fef('0x8')](_0x3fef('0x9'),attributes,{'tableName':_0x3fef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69d3=['../../config/logger','moment','bluebird','rimraf','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x69d3,0xda));var _0x369d=function(_0x25ae88,_0x1602ff){_0x25ae88=_0x25ae88-0x0;var _0x4ff875=_0x69d3[_0x25ae88];return _0x4ff875;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var logger=require(_0x369d('0x2'))('api');var moment=require(_0x369d('0x3'));var BPromise=require(_0x369d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x369d('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x369d('0x6')]=function(_0x2f2a53,_0x18c9f1){return _0x2f2a53[_0x369d('0x7')](_0x369d('0x8'),attributes,{'tableName':_0x369d('0x9'),'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 aa3b74d..24af05d 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 _0xbe6c=['jayson/promise','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x190d74,_0xf2736e){var _0x56e95c=function(_0x367aa9){while(--_0x367aa9){_0x190d74['push'](_0x190d74['shift']());}};_0x56e95c(++_0xf2736e);}(_0xbe6c,0x1f1));var _0xcbe6=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xbe6c[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var util=require(_0xcbe6('0x0'));var moment=require(_0xcbe6('0x1'));var BPromise=require(_0xcbe6('0x2'));var rs=require(_0xcbe6('0x3'));var fs=require('fs');var Redis=require(_0xcbe6('0x4'));var db=require(_0xcbe6('0x5'))['db'];var utils=require(_0xcbe6('0x6'));var logger=require(_0xcbe6('0x7'))('rpc');var config=require(_0xcbe6('0x8'));var jayson=require(_0xcbe6('0x9'));var client=jayson[_0xcbe6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x401fbd,_0x5a48c3,_0x3f4531){return new BPromise(function(_0x54783c,_0x249b77){return client[_0xcbe6('0xb')](_0x401fbd,_0x3f4531)[_0xcbe6('0xc')](function(_0x212228){logger['info'](_0xcbe6('0xd'),_0x5a48c3,_0xcbe6('0xe'));logger['debug'](_0xcbe6('0xf'),_0x5a48c3,_0xcbe6('0xe'),JSON[_0xcbe6('0x10')](_0x212228));if(_0x212228['error']){if(_0x212228[_0xcbe6('0x11')][_0xcbe6('0x12')]===0x1f4){logger[_0xcbe6('0x11')](_0xcbe6('0xd'),_0x5a48c3,_0x212228['error'][_0xcbe6('0x13')]);return _0x249b77(_0x212228[_0xcbe6('0x11')][_0xcbe6('0x13')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5a48c3,_0x212228['error'][_0xcbe6('0x13')]);return _0x54783c(_0x212228[_0xcbe6('0x11')][_0xcbe6('0x13')]);}else{logger[_0xcbe6('0x14')](_0xcbe6('0xd'),_0x5a48c3,_0xcbe6('0xe'));_0x54783c(_0x212228[_0xcbe6('0x15')][_0xcbe6('0x13')]);}})[_0xcbe6('0x16')](function(_0x166484){logger['error'](_0xcbe6('0xd'),_0x5a48c3,_0x166484);_0x249b77(_0x166484);});});} \ No newline at end of file +var _0x7622=['code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c4bca,_0x5167b6){var _0x2269e8=function(_0x3811c5){while(--_0x3811c5){_0x1c4bca['push'](_0x1c4bca['shift']());}};_0x2269e8(++_0x5167b6);}(_0x7622,0x1c7));var _0x2762=function(_0x4720a6,_0x1c70e5){_0x4720a6=_0x4720a6-0x0;var _0x2cd60c=_0x7622[_0x4720a6];return _0x2cd60c;};'use strict';var _=require(_0x2762('0x0'));var util=require(_0x2762('0x1'));var moment=require(_0x2762('0x2'));var BPromise=require(_0x2762('0x3'));var rs=require(_0x2762('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2762('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2762('0x6'))(_0x2762('0x7'));var config=require(_0x2762('0x8'));var jayson=require(_0x2762('0x9'));var client=jayson[_0x2762('0xa')][_0x2762('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bdf52,_0x43ff2d,_0xc86223){return new BPromise(function(_0x5d2825,_0x243803){return client[_0x2762('0xc')](_0x3bdf52,_0xc86223)[_0x2762('0xd')](function(_0x54e30c){logger[_0x2762('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x43ff2d,_0x2762('0xf'));logger[_0x2762('0x10')](_0x2762('0x11'),_0x43ff2d,'request\x20sent',JSON[_0x2762('0x12')](_0x54e30c));if(_0x54e30c[_0x2762('0x13')]){if(_0x54e30c[_0x2762('0x13')][_0x2762('0x14')]===0x1f4){logger[_0x2762('0x13')](_0x2762('0x15'),_0x43ff2d,_0x54e30c['error']['message']);return _0x243803(_0x54e30c[_0x2762('0x13')][_0x2762('0x16')]);}logger['error'](_0x2762('0x15'),_0x43ff2d,_0x54e30c[_0x2762('0x13')][_0x2762('0x16')]);return _0x5d2825(_0x54e30c[_0x2762('0x13')][_0x2762('0x16')]);}else{logger[_0x2762('0xe')](_0x2762('0x15'),_0x43ff2d,_0x2762('0xf'));_0x5d2825(_0x54e30c[_0x2762('0x17')][_0x2762('0x16')]);}})[_0x2762('0x18')](function(_0x4a9fc8){logger[_0x2762('0x13')](_0x2762('0x15'),_0x43ff2d,_0x4a9fc8);_0x243803(_0x4a9fc8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1ab2125..9584587 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 _0x0c45=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','update','destroy'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0c45,0x99));var _0x50c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c45[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x50c4('0x0'));var util=require(_0x50c4('0x1'));var path=require(_0x50c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x50c4('0x3'));var router=express[_0x50c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x50c4('0x5'));var interaction=require(_0x50c4('0x6'));var config=require(_0x50c4('0x7'));var controller=require(_0x50c4('0x8'));router[_0x50c4('0x9')]('/',auth[_0x50c4('0xa')](),controller['index']);router['get'](_0x50c4('0xb'),auth[_0x50c4('0xa')](),controller[_0x50c4('0xc')]);router[_0x50c4('0xd')]('/',auth[_0x50c4('0xa')](),controller[_0x50c4('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x50c4('0xf')]);router['delete'](_0x50c4('0xb'),auth[_0x50c4('0xa')](),controller[_0x50c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x30e2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0xae1e70,_0x4dbdea){var _0x46f5c9=function(_0x14cb0f){while(--_0x14cb0f){_0xae1e70['push'](_0xae1e70['shift']());}};_0x46f5c9(++_0x4dbdea);}(_0x30e2,0x1e2));var _0x230e=function(_0x5da496,_0x5329d5){_0x5da496=_0x5da496-0x0;var _0x5918ba=_0x30e2[_0x5da496];return _0x5918ba;};'use strict';var multer=require('multer');var util=require(_0x230e('0x0'));var path=require(_0x230e('0x1'));var timeout=require(_0x230e('0x2'));var express=require(_0x230e('0x3'));var router=express[_0x230e('0x4')]();var fs_extra=require(_0x230e('0x5'));var auth=require(_0x230e('0x6'));var interaction=require(_0x230e('0x7'));var config=require('../../config/environment');var controller=require(_0x230e('0x8'));router[_0x230e('0x9')]('/',auth['isAuthenticated'](),controller[_0x230e('0xa')]);router['get']('/:id',auth[_0x230e('0xb')](),controller[_0x230e('0xc')]);router[_0x230e('0xd')]('/',auth['isAuthenticated'](),controller[_0x230e('0xe')]);router[_0x230e('0xf')](_0x230e('0x10'),auth[_0x230e('0xb')](),controller[_0x230e('0x11')]);router[_0x230e('0x12')](_0x230e('0x10'),auth[_0x230e('0xb')](),controller[_0x230e('0x13')]);module[_0x230e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2f93427..854957e 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 _0x9c58=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x4f69a9,_0x3126bb){var _0x5f2869=function(_0xbb4084){while(--_0xbb4084){_0x4f69a9['push'](_0x4f69a9['shift']());}};_0x5f2869(++_0x3126bb);}(_0x9c58,0x1ba));var _0x89c5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9c58[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x89c5('0x0'));module['exports']={'type':{'type':Sequelize[_0x89c5('0x1')]('string',_0x89c5('0x2'),_0x89c5('0x3'),_0x89c5('0x4'),_0x89c5('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x89c5('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x89c5('0x1')](_0x89c5('0x7'),_0x89c5('0x2'),_0x89c5('0x3'))},'keyContent':{'type':Sequelize[_0x89c5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x89c5('0x6')]},'customField':{'type':Sequelize[_0x89c5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x033c=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x13e727,_0x29cf63){var _0x356318=function(_0x3a9d41){while(--_0x3a9d41){_0x13e727['push'](_0x13e727['shift']());}};_0x356318(++_0x29cf63);}(_0x033c,0x7c));var _0xc033=function(_0x125776,_0xd67c9a){_0x125776=_0x125776-0x0;var _0x4cf955=_0x033c[_0x125776];return _0x4cf955;};'use strict';var Sequelize=require(_0xc033('0x0'));module['exports']={'type':{'type':Sequelize[_0xc033('0x1')](_0xc033('0x2'),_0xc033('0x3'),_0xc033('0x4'),_0xc033('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc033('0x6')]},'keyType':{'type':Sequelize[_0xc033('0x1')](_0xc033('0x2'),'variable',_0xc033('0x4'))},'keyContent':{'type':Sequelize[_0xc033('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc033('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc033('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0e5b95d..20ac003 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 _0x0a88=['sendStatus','error','name','send','index','map','ZendeskField','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x0a88,0xac));var _0x80a8=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x0a88[_0x4fdcc0];return _0xc0ce94;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x80a8('0x0'));var jsonpatch=require(_0x80a8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x80a8('0x2'));var Mustache=require(_0x80a8('0x3'));var util=require(_0x80a8('0x4'));var path=require(_0x80a8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x80a8('0x6'));var fs=require('fs');var fs_extra=require(_0x80a8('0x7'));var _=require(_0x80a8('0x8'));var squel=require(_0x80a8('0x9'));var crypto=require(_0x80a8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80a8('0xb'));var authService=require(_0x80a8('0xc'));var qs=require(_0x80a8('0xd'));var as=require(_0x80a8('0xe'));var hardwareService=require(_0x80a8('0xf'));var logger=require(_0x80a8('0x10'))(_0x80a8('0x11'));var utils=require('../../config/utils');var config=require(_0x80a8('0x12'));var licenseUtil=require(_0x80a8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ad570,_0x3b0744){_0x3b0744=_0x3b0744||0xcc;return function(_0x17955d){if(_0x17955d){return _0x5ad570['sendStatus'](_0x3b0744);}return _0x5ad570[_0x80a8('0x14')](_0x3b0744)[_0x80a8('0x15')]();};}function respondWithResult(_0x5d6b42,_0x245c39){_0x245c39=_0x245c39||0xc8;return function(_0x23e82a){if(_0x23e82a){return _0x5d6b42['status'](_0x245c39)[_0x80a8('0x16')](_0x23e82a);}};}function respondWithFilteredResult(_0x1dc57f,_0x5a8d45){return function(_0x577395){if(_0x577395){var _0x57191a=typeof _0x5a8d45[_0x80a8('0x17')]===_0x80a8('0x18')&&typeof _0x5a8d45[_0x80a8('0x19')]===_0x80a8('0x18');var _0x3d1c32=_0x577395[_0x80a8('0x1a')];var _0x252686=_0x57191a?0x0:_0x5a8d45[_0x80a8('0x17')];var _0x37c668=_0x57191a?_0x577395[_0x80a8('0x1a')]:_0x5a8d45[_0x80a8('0x17')]+_0x5a8d45[_0x80a8('0x19')];var _0x438025;if(_0x37c668>=_0x3d1c32){_0x37c668=_0x3d1c32;_0x438025=0xc8;}else{_0x438025=0xce;}_0x1dc57f[_0x80a8('0x14')](_0x438025);return _0x1dc57f['set'](_0x80a8('0x1b'),_0x252686+'-'+_0x37c668+'/'+_0x3d1c32)['json'](_0x577395);}return null;};}function patchUpdates(_0x570708){return function(_0x3eb719){try{jsonpatch['apply'](_0x3eb719,_0x570708,!![]);}catch(_0x39770a){return BPromise[_0x80a8('0x1c')](_0x39770a);}return _0x3eb719[_0x80a8('0x1d')]();};}function saveUpdates(_0x5b35e4,_0x57d372){return function(_0x5a8a9e){if(_0x5a8a9e){return _0x5a8a9e[_0x80a8('0x1e')](_0x5b35e4)[_0x80a8('0x1f')](function(_0x5cd335){return _0x5cd335;});}return null;};}function removeEntity(_0x4b6898,_0x19c4be){return function(_0x3ee334){if(_0x3ee334){return _0x3ee334['destroy']()[_0x80a8('0x1f')](function(){_0x4b6898[_0x80a8('0x14')](0xcc)[_0x80a8('0x15')]();});}};}function handleEntityNotFound(_0xf1c7fb,_0x4d8000){return function(_0xc0a8bb){if(!_0xc0a8bb){_0xf1c7fb[_0x80a8('0x20')](0x194);}return _0xc0a8bb;};}function handleError(_0x556300,_0x18a15b){_0x18a15b=_0x18a15b||0x1f4;return function(_0x1610d8){logger[_0x80a8('0x21')](_0x1610d8['stack']);if(_0x1610d8[_0x80a8('0x22')]){delete _0x1610d8[_0x80a8('0x22')];}_0x556300['status'](_0x18a15b)[_0x80a8('0x23')](_0x1610d8);};}exports[_0x80a8('0x24')]=function(_0x44948e,_0x43da1b){var _0x4323cd={},_0x523ef6={},_0x552c6f={'count':0x0,'rows':[]};var _0x448bec=_[_0x80a8('0x25')](db[_0x80a8('0x26')]['rawAttributes'],function(_0x2054a2){return{'name':_0x2054a2['fieldName'],'type':_0x2054a2['type'][_0x80a8('0x27')]};});_0x523ef6[_0x80a8('0x28')]=_[_0x80a8('0x25')](_0x448bec,'name');_0x523ef6[_0x80a8('0x29')]=_[_0x80a8('0x2a')](_0x44948e[_0x80a8('0x29')]);_0x523ef6[_0x80a8('0x2b')]=_[_0x80a8('0x2c')](_0x523ef6['model'],_0x523ef6[_0x80a8('0x29')]);_0x4323cd['attributes']=_[_0x80a8('0x2c')](_0x523ef6[_0x80a8('0x28')],qs[_0x80a8('0x2d')](_0x44948e[_0x80a8('0x29')][_0x80a8('0x2d')]));_0x4323cd['attributes']=_0x4323cd['attributes']['length']?_0x4323cd[_0x80a8('0x2e')]:_0x523ef6[_0x80a8('0x28')];if(!_0x44948e[_0x80a8('0x29')][_0x80a8('0x2f')](_0x80a8('0x30'))){_0x4323cd[_0x80a8('0x19')]=qs['limit'](_0x44948e['query'][_0x80a8('0x19')]);_0x4323cd[_0x80a8('0x17')]=qs[_0x80a8('0x17')](_0x44948e[_0x80a8('0x29')][_0x80a8('0x17')]);}_0x4323cd['order']=qs[_0x80a8('0x31')](_0x44948e[_0x80a8('0x29')][_0x80a8('0x31')]);_0x4323cd['where']=qs[_0x80a8('0x2b')](_[_0x80a8('0x32')](_0x44948e[_0x80a8('0x29')],_0x523ef6[_0x80a8('0x2b')]),_0x448bec);if(_0x44948e['query'][_0x80a8('0x33')]){_0x4323cd['where']=_[_0x80a8('0x34')](_0x4323cd[_0x80a8('0x35')],{'$or':_[_0x80a8('0x25')](_0x448bec,function(_0x9f7cf8){if(_0x9f7cf8['type']!==_0x80a8('0x36')){var _0xdac2={};_0xdac2[_0x9f7cf8[_0x80a8('0x22')]]={'$like':'%'+_0x44948e[_0x80a8('0x29')][_0x80a8('0x33')]+'%'};return _0xdac2;}})});}_0x4323cd=_['merge']({},_0x4323cd,_0x44948e[_0x80a8('0x37')]);var _0x39301f={'where':_0x4323cd['where']};return db[_0x80a8('0x26')][_0x80a8('0x1a')](_0x39301f)['then'](function(_0x12a7d0){_0x552c6f[_0x80a8('0x1a')]=_0x12a7d0;if(_0x44948e[_0x80a8('0x29')][_0x80a8('0x38')]){_0x4323cd[_0x80a8('0x39')]=[{'all':!![]}];}return db['ZendeskField'][_0x80a8('0x3a')](_0x4323cd);})[_0x80a8('0x1f')](function(_0x3d2087){_0x552c6f[_0x80a8('0x3b')]=_0x3d2087;return _0x552c6f;})[_0x80a8('0x1f')](respondWithFilteredResult(_0x43da1b,_0x4323cd))[_0x80a8('0x3c')](handleError(_0x43da1b,null));};exports[_0x80a8('0x3d')]=function(_0x93e7de,_0x4587cf){var _0x47a0fb={'raw':!![],'where':{'id':_0x93e7de[_0x80a8('0x3e')]['id']}},_0x16a30c={};_0x16a30c[_0x80a8('0x28')]=_[_0x80a8('0x2a')](db[_0x80a8('0x26')][_0x80a8('0x3f')]);_0x16a30c['query']=_[_0x80a8('0x2a')](_0x93e7de['query']);_0x16a30c['filters']=_[_0x80a8('0x2c')](_0x16a30c['model'],_0x16a30c[_0x80a8('0x29')]);_0x47a0fb[_0x80a8('0x2e')]=_[_0x80a8('0x2c')](_0x16a30c['model'],qs[_0x80a8('0x2d')](_0x93e7de['query'][_0x80a8('0x2d')]));_0x47a0fb['attributes']=_0x47a0fb[_0x80a8('0x2e')][_0x80a8('0x40')]?_0x47a0fb[_0x80a8('0x2e')]:_0x16a30c[_0x80a8('0x28')];if(_0x93e7de[_0x80a8('0x29')][_0x80a8('0x38')]){_0x47a0fb['include']=[{'all':!![]}];}_0x47a0fb=_[_0x80a8('0x34')]({},_0x47a0fb,_0x93e7de[_0x80a8('0x37')]);return db[_0x80a8('0x26')][_0x80a8('0x41')](_0x47a0fb)['then'](handleEntityNotFound(_0x4587cf,null))[_0x80a8('0x1f')](respondWithResult(_0x4587cf,null))[_0x80a8('0x3c')](handleError(_0x4587cf,null));};exports[_0x80a8('0x42')]=function(_0x229a30,_0x270b48){return db[_0x80a8('0x26')]['create'](_0x229a30['body'],{})[_0x80a8('0x1f')](respondWithResult(_0x270b48,0xc9))[_0x80a8('0x3c')](handleError(_0x270b48,null));};exports[_0x80a8('0x1e')]=function(_0x2c4ac7,_0x397410){if(_0x2c4ac7['body']['id']){delete _0x2c4ac7[_0x80a8('0x43')]['id'];}return db[_0x80a8('0x26')][_0x80a8('0x41')]({'where':{'id':_0x2c4ac7[_0x80a8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x397410,null))[_0x80a8('0x1f')](saveUpdates(_0x2c4ac7[_0x80a8('0x43')],null))[_0x80a8('0x1f')](respondWithResult(_0x397410,null))[_0x80a8('0x3c')](handleError(_0x397410,null));};exports['destroy']=function(_0x5106a5,_0x79a26e){return db['ZendeskField'][_0x80a8('0x41')]({'where':{'id':_0x5106a5[_0x80a8('0x3e')]['id']}})[_0x80a8('0x1f')](handleEntityNotFound(_0x79a26e,null))[_0x80a8('0x1f')](removeEntity(_0x79a26e,null))[_0x80a8('0x3c')](handleError(_0x79a26e,null));}; \ No newline at end of file +var _0x28f3=['VIRTUAL','filter','where','catch','show','params','includeAll','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','merge','type'];(function(_0x4c6f36,_0xd671f9){var _0x325abf=function(_0x49a9e4){while(--_0x49a9e4){_0x4c6f36['push'](_0x4c6f36['shift']());}};_0x325abf(++_0xd671f9);}(_0x28f3,0x9d));var _0x328f=function(_0x44ef27,_0x1603a9){_0x44ef27=_0x44ef27-0x0;var _0x151c3e=_0x28f3[_0x44ef27];return _0x151c3e;};'use strict';var emlformat=require(_0x328f('0x0'));var rimraf=require(_0x328f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x328f('0x2'));var rp=require(_0x328f('0x3'));var moment=require(_0x328f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x328f('0x5'));var sox=require(_0x328f('0x6'));var csv=require('to-csv');var ejs=require(_0x328f('0x7'));var fs=require('fs');var fs_extra=require(_0x328f('0x8'));var _=require(_0x328f('0x9'));var squel=require(_0x328f('0xa'));var crypto=require('crypto');var jsforce=require(_0x328f('0xb'));var deskjs=require(_0x328f('0xc'));var toCsv=require(_0x328f('0xd'));var querystring=require(_0x328f('0xe'));var Papa=require('papaparse');var Redis=require(_0x328f('0xf'));var authService=require(_0x328f('0x10'));var qs=require(_0x328f('0x11'));var as=require(_0x328f('0x12'));var hardwareService=require(_0x328f('0x13'));var logger=require('../../config/logger')(_0x328f('0x14'));var utils=require(_0x328f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x328f('0x16'));var db=require(_0x328f('0x17'))['db'];function respondWithStatusCode(_0x48ae4d,_0x3106c4){_0x3106c4=_0x3106c4||0xcc;return function(_0x48b7ff){if(_0x48b7ff){return _0x48ae4d[_0x328f('0x18')](_0x3106c4);}return _0x48ae4d[_0x328f('0x19')](_0x3106c4)[_0x328f('0x1a')]();};}function respondWithResult(_0x20762b,_0x409bc0){_0x409bc0=_0x409bc0||0xc8;return function(_0x477880){if(_0x477880){return _0x20762b[_0x328f('0x19')](_0x409bc0)[_0x328f('0x1b')](_0x477880);}};}function respondWithFilteredResult(_0x18e29d,_0x2eb66a){return function(_0x39efce){if(_0x39efce){var _0x226e74=typeof _0x2eb66a[_0x328f('0x1c')]===_0x328f('0x1d')&&typeof _0x2eb66a[_0x328f('0x1e')]==='undefined';var _0x3dfff3=_0x39efce[_0x328f('0x1f')];var _0x46feb6=_0x226e74?0x0:_0x2eb66a[_0x328f('0x1c')];var _0xe5bdd0=_0x226e74?_0x39efce['count']:_0x2eb66a[_0x328f('0x1c')]+_0x2eb66a[_0x328f('0x1e')];var _0x12e8d7;if(_0xe5bdd0>=_0x3dfff3){_0xe5bdd0=_0x3dfff3;_0x12e8d7=0xc8;}else{_0x12e8d7=0xce;}_0x18e29d[_0x328f('0x19')](_0x12e8d7);return _0x18e29d[_0x328f('0x20')]('Content-Range',_0x46feb6+'-'+_0xe5bdd0+'/'+_0x3dfff3)[_0x328f('0x1b')](_0x39efce);}return null;};}function patchUpdates(_0x28c0df){return function(_0x50ce63){try{jsonpatch[_0x328f('0x21')](_0x50ce63,_0x28c0df,!![]);}catch(_0x4523d5){return BPromise[_0x328f('0x22')](_0x4523d5);}return _0x50ce63[_0x328f('0x23')]();};}function saveUpdates(_0x11a18f,_0x37f8a5){return function(_0x4382dc){if(_0x4382dc){return _0x4382dc[_0x328f('0x24')](_0x11a18f)[_0x328f('0x25')](function(_0x1680e0){return _0x1680e0;});}return null;};}function removeEntity(_0x13e6cf,_0x450b52){return function(_0x5daf33){if(_0x5daf33){return _0x5daf33[_0x328f('0x26')]()['then'](function(){_0x13e6cf[_0x328f('0x19')](0xcc)[_0x328f('0x1a')]();});}};}function handleEntityNotFound(_0x39f46f,_0x4709da){return function(_0xf3bcdb){if(!_0xf3bcdb){_0x39f46f[_0x328f('0x18')](0x194);}return _0xf3bcdb;};}function handleError(_0x14c0c0,_0x255409){_0x255409=_0x255409||0x1f4;return function(_0x1e7895){logger[_0x328f('0x27')](_0x1e7895[_0x328f('0x28')]);if(_0x1e7895[_0x328f('0x29')]){delete _0x1e7895[_0x328f('0x29')];}_0x14c0c0['status'](_0x255409)[_0x328f('0x2a')](_0x1e7895);};}exports['index']=function(_0x59f13e,_0x3a4135){var _0x7b49c5={},_0x5dd6f6={},_0x34ae85={'count':0x0,'rows':[]};var _0x1e815c=_[_0x328f('0x2b')](db[_0x328f('0x2c')][_0x328f('0x2d')],function(_0x2a536c){return{'name':_0x2a536c[_0x328f('0x2e')],'type':_0x2a536c['type'][_0x328f('0x2f')]};});_0x5dd6f6[_0x328f('0x30')]=_['map'](_0x1e815c,_0x328f('0x29'));_0x5dd6f6[_0x328f('0x31')]=_[_0x328f('0x32')](_0x59f13e[_0x328f('0x31')]);_0x5dd6f6[_0x328f('0x33')]=_['intersection'](_0x5dd6f6[_0x328f('0x30')],_0x5dd6f6[_0x328f('0x31')]);_0x7b49c5[_0x328f('0x34')]=_[_0x328f('0x35')](_0x5dd6f6[_0x328f('0x30')],qs['fields'](_0x59f13e[_0x328f('0x31')][_0x328f('0x36')]));_0x7b49c5[_0x328f('0x34')]=_0x7b49c5['attributes'][_0x328f('0x37')]?_0x7b49c5[_0x328f('0x34')]:_0x5dd6f6['model'];if(!_0x59f13e[_0x328f('0x31')][_0x328f('0x38')](_0x328f('0x39'))){_0x7b49c5[_0x328f('0x1e')]=qs[_0x328f('0x1e')](_0x59f13e['query']['limit']);_0x7b49c5['offset']=qs[_0x328f('0x1c')](_0x59f13e[_0x328f('0x31')][_0x328f('0x1c')]);}_0x7b49c5['order']=qs['sort'](_0x59f13e[_0x328f('0x31')][_0x328f('0x3a')]);_0x7b49c5['where']=qs[_0x328f('0x33')](_[_0x328f('0x3b')](_0x59f13e['query'],_0x5dd6f6[_0x328f('0x33')]),_0x1e815c);if(_0x59f13e[_0x328f('0x31')]['filter']){_0x7b49c5['where']=_[_0x328f('0x3c')](_0x7b49c5['where'],{'$or':_[_0x328f('0x2b')](_0x1e815c,function(_0x1ebab5){if(_0x1ebab5[_0x328f('0x3d')]!==_0x328f('0x3e')){var _0x1128d2={};_0x1128d2[_0x1ebab5[_0x328f('0x29')]]={'$like':'%'+_0x59f13e['query'][_0x328f('0x3f')]+'%'};return _0x1128d2;}})});}_0x7b49c5=_[_0x328f('0x3c')]({},_0x7b49c5,_0x59f13e['options']);var _0x3f616c={'where':_0x7b49c5[_0x328f('0x40')]};return db[_0x328f('0x2c')][_0x328f('0x1f')](_0x3f616c)[_0x328f('0x25')](function(_0x22f3d3){_0x34ae85[_0x328f('0x1f')]=_0x22f3d3;if(_0x59f13e[_0x328f('0x31')]['includeAll']){_0x7b49c5['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x7b49c5);})[_0x328f('0x25')](function(_0x3fcbf5){_0x34ae85['rows']=_0x3fcbf5;return _0x34ae85;})[_0x328f('0x25')](respondWithFilteredResult(_0x3a4135,_0x7b49c5))[_0x328f('0x41')](handleError(_0x3a4135,null));};exports[_0x328f('0x42')]=function(_0x3bf657,_0x5a70fc){var _0x31a7db={'raw':!![],'where':{'id':_0x3bf657[_0x328f('0x43')]['id']}},_0x1bb07f={};_0x1bb07f[_0x328f('0x30')]=_[_0x328f('0x32')](db['ZendeskField'][_0x328f('0x2d')]);_0x1bb07f['query']=_[_0x328f('0x32')](_0x3bf657['query']);_0x1bb07f[_0x328f('0x33')]=_[_0x328f('0x35')](_0x1bb07f['model'],_0x1bb07f['query']);_0x31a7db[_0x328f('0x34')]=_[_0x328f('0x35')](_0x1bb07f[_0x328f('0x30')],qs[_0x328f('0x36')](_0x3bf657['query'][_0x328f('0x36')]));_0x31a7db['attributes']=_0x31a7db[_0x328f('0x34')][_0x328f('0x37')]?_0x31a7db[_0x328f('0x34')]:_0x1bb07f['model'];if(_0x3bf657[_0x328f('0x31')][_0x328f('0x44')]){_0x31a7db[_0x328f('0x45')]=[{'all':!![]}];}_0x31a7db=_[_0x328f('0x3c')]({},_0x31a7db,_0x3bf657['options']);return db[_0x328f('0x2c')]['find'](_0x31a7db)[_0x328f('0x25')](handleEntityNotFound(_0x5a70fc,null))[_0x328f('0x25')](respondWithResult(_0x5a70fc,null))[_0x328f('0x41')](handleError(_0x5a70fc,null));};exports['create']=function(_0x409048,_0x2cc711){return db[_0x328f('0x2c')][_0x328f('0x46')](_0x409048[_0x328f('0x47')],{})[_0x328f('0x25')](respondWithResult(_0x2cc711,0xc9))['catch'](handleError(_0x2cc711,null));};exports[_0x328f('0x24')]=function(_0x2e40f7,_0x4d2b07){if(_0x2e40f7[_0x328f('0x47')]['id']){delete _0x2e40f7[_0x328f('0x47')]['id'];}return db[_0x328f('0x2c')][_0x328f('0x48')]({'where':{'id':_0x2e40f7[_0x328f('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d2b07,null))['then'](saveUpdates(_0x2e40f7[_0x328f('0x47')],null))[_0x328f('0x25')](respondWithResult(_0x4d2b07,null))[_0x328f('0x41')](handleError(_0x4d2b07,null));};exports[_0x328f('0x26')]=function(_0x3bc576,_0x31741e){return db['ZendeskField'][_0x328f('0x48')]({'where':{'id':_0x3bc576[_0x328f('0x43')]['id']}})[_0x328f('0x25')](handleEntityNotFound(_0x31741e,null))[_0x328f('0x25')](removeEntity(_0x31741e,null))[_0x328f('0x41')](handleError(_0x31741e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 016ddde..11e95ff 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 _0xaa0a=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x1d1eaf,_0x31b7bc){var _0xb0dc37=function(_0x2db2d4){while(--_0x2db2d4){_0x1d1eaf['push'](_0x1d1eaf['shift']());}};_0xb0dc37(++_0x31b7bc);}(_0xaa0a,0x75));var _0xaaa0=function(_0x4af9bd,_0x2f559c){_0x4af9bd=_0x4af9bd-0x0;var _0x3686cb=_0xaa0a[_0x4af9bd];return _0x3686cb;};'use strict';var _=require(_0xaaa0('0x0'));var util=require(_0xaaa0('0x1'));var logger=require(_0xaaa0('0x2'))(_0xaaa0('0x3'));var moment=require(_0xaaa0('0x4'));var BPromise=require(_0xaaa0('0x5'));var rp=require(_0xaaa0('0x6'));var fs=require('fs');var path=require(_0xaaa0('0x7'));var rimraf=require(_0xaaa0('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0xaaa0('0x9')]=function(_0x112e90,_0x20f0b6){return _0x112e90[_0xaaa0('0xa')](_0xaaa0('0xb'),attributes,{'tableName':_0xaaa0('0xc'),'paranoid':![],'indexes':[{'name':_0xaaa0('0xd'),'fields':[_0xaaa0('0xe'),_0xaaa0('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d5e=['exports','define','int_zendesk_fields','idField','FieldId','util','../../config/logger','moment','path','rimraf','./intZendeskField.attributes'];(function(_0x402f53,_0x25f9e6){var _0x2d4acc=function(_0x3a224e){while(--_0x3a224e){_0x402f53['push'](_0x402f53['shift']());}};_0x2d4acc(++_0x25f9e6);}(_0x6d5e,0x9f));var _0xe6d5=function(_0x54fdbb,_0x272db5){_0x54fdbb=_0x54fdbb-0x0;var _0x3e0d7b=_0x6d5e[_0x54fdbb];return _0x3e0d7b;};'use strict';var _=require('lodash');var util=require(_0xe6d5('0x0'));var logger=require(_0xe6d5('0x1'))('api');var moment=require(_0xe6d5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6d5('0x3'));var rimraf=require(_0xe6d5('0x4'));var config=require('../../config/environment');var attributes=require(_0xe6d5('0x5'));module[_0xe6d5('0x6')]=function(_0x3d2889,_0x35dd14){return _0x3d2889[_0xe6d5('0x7')]('ZendeskField',attributes,{'tableName':_0xe6d5('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xe6d5('0x9'),_0xe6d5('0xa')],'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 bf49c50..55307c0 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 _0x8a15=['message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4d03d6,_0x438a06){var _0x22752e=function(_0x1b2894){while(--_0x1b2894){_0x4d03d6['push'](_0x4d03d6['shift']());}};_0x22752e(++_0x438a06);}(_0x8a15,0x192));var _0x58a1=function(_0x280bef,_0x5e1bd3){_0x280bef=_0x280bef-0x0;var _0x56dc85=_0x8a15[_0x280bef];return _0x56dc85;};'use strict';var _=require(_0x58a1('0x0'));var util=require(_0x58a1('0x1'));var moment=require('moment');var BPromise=require(_0x58a1('0x2'));var rs=require(_0x58a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58a1('0x4'))['db'];var utils=require(_0x58a1('0x5'));var logger=require(_0x58a1('0x6'))(_0x58a1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x58a1('0x8')][_0x58a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x86b1f1,_0x39e28a,_0xa88105){return new BPromise(function(_0x28cb8f,_0x34e3c6){return client[_0x58a1('0xa')](_0x86b1f1,_0xa88105)['then'](function(_0x434493){logger[_0x58a1('0xb')](_0x58a1('0xc'),_0x39e28a,_0x58a1('0xd'));logger[_0x58a1('0xe')](_0x58a1('0xf'),_0x39e28a,_0x58a1('0xd'),JSON['stringify'](_0x434493));if(_0x434493[_0x58a1('0x10')]){if(_0x434493[_0x58a1('0x10')][_0x58a1('0x11')]===0x1f4){logger['error'](_0x58a1('0xc'),_0x39e28a,_0x434493['error'][_0x58a1('0x12')]);return _0x34e3c6(_0x434493[_0x58a1('0x10')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x39e28a,_0x434493[_0x58a1('0x10')]['message']);return _0x28cb8f(_0x434493[_0x58a1('0x10')][_0x58a1('0x12')]);}else{logger['info'](_0x58a1('0xc'),_0x39e28a,_0x58a1('0xd'));_0x28cb8f(_0x434493['result'][_0x58a1('0x12')]);}})[_0x58a1('0x13')](function(_0x838f9e){logger[_0x58a1('0x10')](_0x58a1('0xc'),_0x39e28a,_0x838f9e);_0x34e3c6(_0x838f9e);});});} \ No newline at end of file +var _0xd770=['../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','rpc'];(function(_0x1b449b,_0x545e82){var _0x1951c8=function(_0x3fe189){while(--_0x3fe189){_0x1b449b['push'](_0x1b449b['shift']());}};_0x1951c8(++_0x545e82);}(_0xd770,0xeb));var _0x0d77=function(_0x34db21,_0x2aef7b){_0x34db21=_0x34db21-0x0;var _0x26bd70=_0xd770[_0x34db21];return _0x26bd70;};'use strict';var _=require(_0x0d77('0x0'));var util=require(_0x0d77('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d77('0x2'));var fs=require('fs');var Redis=require(_0x0d77('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d77('0x4'));var config=require(_0x0d77('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0d77('0x6')][_0x0d77('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7985f4,_0x44fa3e,_0x362911){return new BPromise(function(_0x2728fd,_0x15ad37){return client[_0x0d77('0x8')](_0x7985f4,_0x362911)[_0x0d77('0x9')](function(_0x30f755){logger[_0x0d77('0xa')](_0x0d77('0xb'),_0x44fa3e,_0x0d77('0xc'));logger[_0x0d77('0xd')](_0x0d77('0xe'),_0x44fa3e,'request\x20sent',JSON['stringify'](_0x30f755));if(_0x30f755[_0x0d77('0xf')]){if(_0x30f755['error'][_0x0d77('0x10')]===0x1f4){logger[_0x0d77('0xf')](_0x0d77('0xb'),_0x44fa3e,_0x30f755[_0x0d77('0xf')][_0x0d77('0x11')]);return _0x15ad37(_0x30f755[_0x0d77('0xf')][_0x0d77('0x11')]);}logger[_0x0d77('0xf')](_0x0d77('0xb'),_0x44fa3e,_0x30f755['error'][_0x0d77('0x11')]);return _0x2728fd(_0x30f755[_0x0d77('0xf')][_0x0d77('0x11')]);}else{logger[_0x0d77('0xa')]('ZendeskField,\x20%s,\x20%s',_0x44fa3e,_0x0d77('0xc'));_0x2728fd(_0x30f755[_0x0d77('0x12')][_0x0d77('0x11')]);}})[_0x0d77('0x13')](function(_0x5e9e2d){logger[_0x0d77('0xf')](_0x0d77('0xb'),_0x44fa3e,_0x5e9e2d);_0x15ad37(_0x5e9e2d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index cbf8f32..f34d432 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 _0x7551=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','create','post','/:id/configurations','multer','util','path','fs-extra'];(function(_0x356fc0,_0x147f5f){var _0x21e6f7=function(_0x1f4786){while(--_0x1f4786){_0x356fc0['push'](_0x356fc0['shift']());}};_0x21e6f7(++_0x147f5f);}(_0x7551,0x176));var _0x1755=function(_0x23b87c,_0x3132ac){_0x23b87c=_0x23b87c-0x0;var _0x3d15d6=_0x7551[_0x23b87c];return _0x3d15d6;};'use strict';var multer=require(_0x1755('0x0'));var util=require(_0x1755('0x1'));var path=require(_0x1755('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1755('0x3'));var auth=require(_0x1755('0x4'));var interaction=require(_0x1755('0x5'));var config=require(_0x1755('0x6'));var controller=require(_0x1755('0x7'));router[_0x1755('0x8')]('/',auth[_0x1755('0x9')](),controller[_0x1755('0xa')]);router[_0x1755('0x8')](_0x1755('0xb'),auth['isAuthenticated'](),controller[_0x1755('0xc')]);router[_0x1755('0x8')]('/:id/configurations',auth[_0x1755('0x9')](),controller[_0x1755('0xd')]);router['get'](_0x1755('0xe'),auth[_0x1755('0x9')](),controller['getFields']);router['post']('/',auth[_0x1755('0x9')](),controller[_0x1755('0xf')]);router[_0x1755('0x10')](_0x1755('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x1755('0xb'),auth[_0x1755('0x9')](),controller['update']);router['delete']('/:id',auth[_0x1755('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe154=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path'];(function(_0x45cd67,_0xcc66ef){var _0x1287b6=function(_0x9d76e7){while(--_0x9d76e7){_0x45cd67['push'](_0x45cd67['shift']());}};_0x1287b6(++_0xcc66ef);}(_0xe154,0xb5));var _0x4e15=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xe154[_0x44606e];return _0xe68388;};'use strict';var multer=require(_0x4e15('0x0'));var util=require(_0x4e15('0x1'));var path=require(_0x4e15('0x2'));var timeout=require(_0x4e15('0x3'));var express=require(_0x4e15('0x4'));var router=express[_0x4e15('0x5')]();var fs_extra=require(_0x4e15('0x6'));var auth=require(_0x4e15('0x7'));var interaction=require(_0x4e15('0x8'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x4e15('0x9')]('/',auth[_0x4e15('0xa')](),controller[_0x4e15('0xb')]);router['get'](_0x4e15('0xc'),auth[_0x4e15('0xa')](),controller['show']);router['get'](_0x4e15('0xd'),auth['isAuthenticated'](),controller[_0x4e15('0xe')]);router[_0x4e15('0x9')](_0x4e15('0xf'),auth[_0x4e15('0xa')](),controller['getFields']);router[_0x4e15('0x10')]('/',auth[_0x4e15('0xa')](),controller[_0x4e15('0x11')]);router['post'](_0x4e15('0xd'),auth[_0x4e15('0xa')](),controller[_0x4e15('0x12')]);router[_0x4e15('0x13')](_0x4e15('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4e15('0x14')]('/:id',auth[_0x4e15('0xa')](),controller[_0x4e15('0x15')]);module[_0x4e15('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c444800..ae390fd 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 _0x9a19=['sequelize','exports','STRING'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x9a19,0x114));var _0x99a1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a19[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'name':{'type':Sequelize[_0x99a1('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x99a1('0x2')]},'zone':{'type':Sequelize[_0x99a1('0x2')]},'clientId':{'type':Sequelize[_0x99a1('0x2')]},'clientSecret':{'type':Sequelize[_0x99a1('0x2')]},'serverUrl':{'type':Sequelize[_0x99a1('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x99a1('0x2')]},'refreshToken':{'type':Sequelize[_0x99a1('0x2')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0xb19bc6,_0x2dd9b5){var _0x2e3f77=function(_0x51ef45){while(--_0x51ef45){_0xb19bc6['push'](_0xb19bc6['shift']());}};_0x2e3f77(++_0x2dd9b5);}(_0x34e8,0x12c));var _0x834e=function(_0xb07f69,_0x4ee565){_0xb07f69=_0xb07f69-0x0;var _0x161a70=_0x34e8[_0xb07f69];return _0x161a70;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 242bd33..93ffc06 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 _0x99b1=['https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','api_name','system_mandatory','push','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','params','keys','includeAll','create','body','find','findOne','ZohoConfiguration','order','getConfigurations','AccountId','getSubjects','getDescriptions','channel','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x3fb938,_0x16c2b5){var _0x5535aa=function(_0x360d90){while(--_0x360d90){_0x3fb938['push'](_0x3fb938['shift']());}};_0x5535aa(++_0x16c2b5);}(_0x99b1,0xa2));var _0x199b=function(_0x25dc8,_0x5da9f6){_0x25dc8=_0x25dc8-0x0;var _0x4b0b65=_0x99b1[_0x25dc8];return _0x4b0b65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x199b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x199b('0x1'));var rp=require(_0x199b('0x2'));var moment=require('moment');var BPromise=require(_0x199b('0x3'));var Mustache=require(_0x199b('0x4'));var util=require(_0x199b('0x5'));var path=require(_0x199b('0x6'));var sox=require(_0x199b('0x7'));var csv=require('to-csv');var ejs=require(_0x199b('0x8'));var fs=require('fs');var fs_extra=require(_0x199b('0x9'));var _=require(_0x199b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x199b('0xb'));var deskjs=require(_0x199b('0xc'));var toCsv=require(_0x199b('0xd'));var querystring=require('querystring');var Papa=require(_0x199b('0xe'));var Redis=require(_0x199b('0xf'));var authService=require(_0x199b('0x10'));var qs=require(_0x199b('0x11'));var as=require(_0x199b('0x12'));var hardwareService=require(_0x199b('0x13'));var logger=require(_0x199b('0x14'))(_0x199b('0x15'));var utils=require(_0x199b('0x16'));var config=require(_0x199b('0x17'));var licenseUtil=require(_0x199b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x199b('0x19'));function respondWithStatusCode(_0x5ec8aa,_0x396998){_0x396998=_0x396998||0xcc;return function(_0x1fb7e4){if(_0x1fb7e4){return _0x5ec8aa[_0x199b('0x1a')](_0x396998);}return _0x5ec8aa[_0x199b('0x1b')](_0x396998)['end']();};}function respondWithResult(_0x22de83,_0x41f664){_0x41f664=_0x41f664||0xc8;return function(_0x3d9351){if(_0x3d9351){return _0x22de83['status'](_0x41f664)[_0x199b('0x1c')](_0x3d9351);}};}function respondWithFilteredResult(_0x5fe039,_0x5a4420){return function(_0x56cc45){if(_0x56cc45){var _0x49dce9=typeof _0x5a4420[_0x199b('0x1d')]===_0x199b('0x1e')&&typeof _0x5a4420['limit']==='undefined';var _0x399f6c=_0x56cc45[_0x199b('0x1f')];var _0x51ddd6=_0x49dce9?0x0:_0x5a4420[_0x199b('0x1d')];var _0x3f65e9=_0x49dce9?_0x56cc45['count']:_0x5a4420[_0x199b('0x1d')]+_0x5a4420[_0x199b('0x20')];var _0x10cc42;if(_0x3f65e9>=_0x399f6c){_0x3f65e9=_0x399f6c;_0x10cc42=0xc8;}else{_0x10cc42=0xce;}_0x5fe039[_0x199b('0x1b')](_0x10cc42);return _0x5fe039[_0x199b('0x21')]('Content-Range',_0x51ddd6+'-'+_0x3f65e9+'/'+_0x399f6c)[_0x199b('0x1c')](_0x56cc45);}return null;};}function patchUpdates(_0x276a6e){return function(_0x13ee9d){try{jsonpatch[_0x199b('0x22')](_0x13ee9d,_0x276a6e,!![]);}catch(_0x56bf96){return BPromise[_0x199b('0x23')](_0x56bf96);}return _0x13ee9d['save']();};}function saveUpdates(_0x32a940,_0x723b29){return function(_0xa28f85){if(_0xa28f85){return _0xa28f85[_0x199b('0x24')](_0x32a940)[_0x199b('0x25')](function(_0x5d6243){return _0x5d6243;});}return null;};}function removeEntity(_0x5f74e4,_0x27bc5c){return function(_0x4e8da8){if(_0x4e8da8){return _0x4e8da8[_0x199b('0x26')]()[_0x199b('0x25')](function(){_0x5f74e4[_0x199b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a7b3,_0xc9747c){return function(_0x5a3726){if(!_0x5a3726){_0x41a7b3[_0x199b('0x1a')](0x194);}return _0x5a3726;};}function handleError(_0x51b245,_0x2d4ee2){_0x2d4ee2=_0x2d4ee2||0x1f4;return function(_0x2ef672){logger[_0x199b('0x27')](_0x2ef672['stack']);if(_0x2ef672[_0x199b('0x28')]){delete _0x2ef672[_0x199b('0x28')];}_0x51b245[_0x199b('0x1b')](_0x2d4ee2)['send'](_0x2ef672);};}exports[_0x199b('0x29')]=function(_0x12cc24,_0x809bb){var _0x38f3d6={},_0x413a48={},_0x4a11a8={'count':0x0,'rows':[]};var _0x5b568d=_[_0x199b('0x2a')](db[_0x199b('0x2b')][_0x199b('0x2c')],function(_0x3bc3dc){return{'name':_0x3bc3dc[_0x199b('0x2d')],'type':_0x3bc3dc[_0x199b('0x2e')][_0x199b('0x2f')]};});_0x413a48[_0x199b('0x30')]=_['map'](_0x5b568d,'name');_0x413a48['query']=_['keys'](_0x12cc24['query']);_0x413a48[_0x199b('0x31')]=_['intersection'](_0x413a48['model'],_0x413a48[_0x199b('0x32')]);_0x38f3d6[_0x199b('0x33')]=_[_0x199b('0x34')](_0x413a48[_0x199b('0x30')],qs[_0x199b('0x35')](_0x12cc24[_0x199b('0x32')][_0x199b('0x35')]));_0x38f3d6[_0x199b('0x33')]=_0x38f3d6[_0x199b('0x33')][_0x199b('0x36')]?_0x38f3d6[_0x199b('0x33')]:_0x413a48[_0x199b('0x30')];if(!_0x12cc24[_0x199b('0x32')][_0x199b('0x37')](_0x199b('0x38'))){_0x38f3d6[_0x199b('0x20')]=qs[_0x199b('0x20')](_0x12cc24['query']['limit']);_0x38f3d6[_0x199b('0x1d')]=qs['offset'](_0x12cc24[_0x199b('0x32')][_0x199b('0x1d')]);}_0x38f3d6['order']=qs[_0x199b('0x39')](_0x12cc24[_0x199b('0x32')][_0x199b('0x39')]);_0x38f3d6[_0x199b('0x3a')]=qs[_0x199b('0x31')](_['pick'](_0x12cc24['query'],_0x413a48[_0x199b('0x31')]),_0x5b568d);if(_0x12cc24['query'][_0x199b('0x3b')]){_0x38f3d6[_0x199b('0x3a')]=_[_0x199b('0x3c')](_0x38f3d6[_0x199b('0x3a')],{'$or':_[_0x199b('0x2a')](_0x5b568d,function(_0x272bdd){if(_0x272bdd[_0x199b('0x2e')]!==_0x199b('0x3d')){var _0x436e4f={};_0x436e4f[_0x272bdd[_0x199b('0x28')]]={'$like':'%'+_0x12cc24[_0x199b('0x32')][_0x199b('0x3b')]+'%'};return _0x436e4f;}})});}_0x38f3d6=_[_0x199b('0x3c')]({},_0x38f3d6,_0x12cc24[_0x199b('0x3e')]);var _0x303114={'where':_0x38f3d6[_0x199b('0x3a')]};return db[_0x199b('0x2b')][_0x199b('0x1f')](_0x303114)[_0x199b('0x25')](function(_0x342c06){_0x4a11a8[_0x199b('0x1f')]=_0x342c06;if(_0x12cc24[_0x199b('0x32')]['includeAll']){_0x38f3d6[_0x199b('0x3f')]=[{'all':!![]}];}return db[_0x199b('0x2b')]['findAll'](_0x38f3d6);})[_0x199b('0x25')](function(_0x21278c){_0x4a11a8[_0x199b('0x40')]=_0x21278c;return _0x4a11a8;})[_0x199b('0x25')](respondWithFilteredResult(_0x809bb,_0x38f3d6))[_0x199b('0x41')](handleError(_0x809bb,null));};exports['show']=function(_0x1ccc53,_0x4ca1b4){var _0xf9c38a={'raw':![],'where':{'id':_0x1ccc53[_0x199b('0x42')]['id']}},_0x37a3ac={};_0x37a3ac[_0x199b('0x30')]=_[_0x199b('0x43')](db[_0x199b('0x2b')][_0x199b('0x2c')]);_0x37a3ac['query']=_[_0x199b('0x43')](_0x1ccc53['query']);_0x37a3ac[_0x199b('0x31')]=_[_0x199b('0x34')](_0x37a3ac[_0x199b('0x30')],_0x37a3ac[_0x199b('0x32')]);_0xf9c38a[_0x199b('0x33')]=_[_0x199b('0x34')](_0x37a3ac[_0x199b('0x30')],qs[_0x199b('0x35')](_0x1ccc53['query'][_0x199b('0x35')]));_0xf9c38a[_0x199b('0x33')]=_0xf9c38a[_0x199b('0x33')]['length']?_0xf9c38a[_0x199b('0x33')]:_0x37a3ac[_0x199b('0x30')];if(_0x1ccc53['query'][_0x199b('0x44')]){_0xf9c38a['include']=[{'all':!![]}];}_0xf9c38a=_['merge']({},_0xf9c38a,_0x1ccc53[_0x199b('0x3e')]);return db[_0x199b('0x2b')]['find'](_0xf9c38a)['then'](handleEntityNotFound(_0x4ca1b4,null))[_0x199b('0x25')](respondWithResult(_0x4ca1b4,null))[_0x199b('0x41')](handleError(_0x4ca1b4,null));};exports[_0x199b('0x45')]=function(_0x3ab511,_0x48276e){return db[_0x199b('0x2b')][_0x199b('0x45')](_0x3ab511[_0x199b('0x46')],{})[_0x199b('0x25')](respondWithResult(_0x48276e,0xc9))[_0x199b('0x41')](handleError(_0x48276e,null));};exports[_0x199b('0x24')]=function(_0x18cce2,_0x46d470){if(_0x18cce2['body']['id']){delete _0x18cce2[_0x199b('0x46')]['id'];}return db[_0x199b('0x2b')][_0x199b('0x47')]({'where':{'id':_0x18cce2[_0x199b('0x42')]['id']}})['then'](handleEntityNotFound(_0x46d470,null))[_0x199b('0x25')](saveUpdates(_0x18cce2[_0x199b('0x46')],null))[_0x199b('0x25')](respondWithResult(_0x46d470,null))[_0x199b('0x41')](handleError(_0x46d470,null));};exports[_0x199b('0x26')]=function(_0x2010a7,_0x285d53){return db[_0x199b('0x2b')][_0x199b('0x47')]({'where':{'id':_0x2010a7[_0x199b('0x42')]['id']}})[_0x199b('0x25')](handleEntityNotFound(_0x285d53,null))[_0x199b('0x25')](removeEntity(_0x285d53,null))[_0x199b('0x41')](handleError(_0x285d53,null));};exports['getConfigurations']=function(_0x252fee,_0x3a0bb3,_0x27ab43){var _0x756ccb={};var _0x4b2771={};var _0x25579b;var _0x3e9c00;return db[_0x199b('0x2b')][_0x199b('0x48')]({'where':{'id':_0x252fee[_0x199b('0x42')]['id']}})[_0x199b('0x25')](handleEntityNotFound(_0x3a0bb3,null))[_0x199b('0x25')](function(_0x4c79ef){if(_0x4c79ef){_0x25579b=_0x4c79ef;_0x4b2771[_0x199b('0x30')]=_[_0x199b('0x43')](db[_0x199b('0x49')]['rawAttributes']);_0x4b2771[_0x199b('0x32')]=_[_0x199b('0x43')](_0x252fee[_0x199b('0x32')]);_0x4b2771[_0x199b('0x31')]=_[_0x199b('0x34')](_0x4b2771[_0x199b('0x30')],_0x4b2771[_0x199b('0x32')]);_0x756ccb[_0x199b('0x33')]=_[_0x199b('0x34')](_0x4b2771['model'],qs[_0x199b('0x35')](_0x252fee['query']['fields']));_0x756ccb[_0x199b('0x33')]=_0x756ccb[_0x199b('0x33')][_0x199b('0x36')]?_0x756ccb[_0x199b('0x33')]:_0x4b2771[_0x199b('0x30')];_0x756ccb[_0x199b('0x4a')]=qs[_0x199b('0x39')](_0x252fee[_0x199b('0x32')]['sort']);_0x756ccb[_0x199b('0x3a')]=qs['filters'](_['pick'](_0x252fee[_0x199b('0x32')],_0x4b2771[_0x199b('0x31')]));if(_0x252fee[_0x199b('0x32')][_0x199b('0x3b')]){_0x756ccb['where']=_[_0x199b('0x3c')](_0x756ccb[_0x199b('0x3a')],{'$or':_[_0x199b('0x2a')](_0x756ccb[_0x199b('0x33')],function(_0x11b0b9){var _0x87f570={};_0x87f570[_0x11b0b9]={'$like':'%'+_0x252fee['query'][_0x199b('0x3b')]+'%'};return _0x87f570;})});}_0x756ccb=_[_0x199b('0x3c')]({},_0x756ccb,_0x252fee[_0x199b('0x3e')]);return _0x25579b[_0x199b('0x4b')](_0x756ccb);}})[_0x199b('0x25')](function(_0x4fd49b){if(_0x4fd49b){_0x3e9c00=_0x4fd49b['length'];if(!_0x252fee[_0x199b('0x32')]['hasOwnProperty'](_0x199b('0x38'))){_0x756ccb[_0x199b('0x20')]=qs['limit'](_0x252fee[_0x199b('0x32')][_0x199b('0x20')]);_0x756ccb[_0x199b('0x1d')]=qs[_0x199b('0x1d')](_0x252fee[_0x199b('0x32')][_0x199b('0x1d')]);}return _0x25579b[_0x199b('0x4b')](_0x756ccb);}})[_0x199b('0x25')](function(_0x27a803){if(_0x27a803){return _0x27a803?{'count':_0x3e9c00,'rows':_0x27a803}:null;}})['then'](respondWithResult(_0x3a0bb3,null))[_0x199b('0x41')](handleError(_0x3a0bb3,null));};exports['addConfiguration']=function(_0x4c9d29,_0x4935e4,_0x48e1b5){if(_0x4c9d29[_0x199b('0x46')]['id']){delete _0x4c9d29[_0x199b('0x46')]['id'];}return db['ZohoAccount'][_0x199b('0x48')]({'where':{'id':_0x4c9d29[_0x199b('0x42')]['id']}})[_0x199b('0x25')](handleEntityNotFound(_0x4935e4,null))[_0x199b('0x25')](function(_0x557258){if(_0x557258){_0x4c9d29[_0x199b('0x46')][_0x199b('0x4c')]=_0x557258['id'];_0x4c9d29[_0x199b('0x46')]['Subjects']=integrations[_0x199b('0x4d')](_0x4c9d29[_0x199b('0x46')]['channel'],_0x4c9d29[_0x199b('0x46')][_0x199b('0x2e')]);_0x4c9d29[_0x199b('0x46')]['Descriptions']=integrations[_0x199b('0x4e')](_0x4c9d29[_0x199b('0x46')][_0x199b('0x4f')],_0x4c9d29[_0x199b('0x46')][_0x199b('0x2e')]);return db[_0x199b('0x49')][_0x199b('0x45')](_0x4c9d29[_0x199b('0x46')],{'include':[{'model':db[_0x199b('0x50')],'as':_0x199b('0x51')},{'model':db[_0x199b('0x50')],'as':'Descriptions'}]});}return null;})[_0x199b('0x25')](respondWithResult(_0x4935e4,null))[_0x199b('0x41')](handleError(_0x4935e4,null));};function getAccessToken(_0x356d83){return new Promise(function(_0x86988d,_0x5a0874){var _0x390704;switch(_0x356d83[_0x199b('0x52')]){case'US':_0x390704=_0x199b('0x53');break;case'AU':_0x390704=_0x199b('0x54');break;case'EU':_0x390704='https://accounts.zoho.eu';break;case'IN':_0x390704=_0x199b('0x55');break;case'CN':_0x390704='https://accounts.zoho.com.cn';break;default:_0x390704=_0x199b('0x56');break;}var _0xfd9a56={'method':_0x199b('0x57'),'uri':_0x390704+_0x199b('0x58'),'qs':{'refresh_token':_0x356d83[_0x199b('0x59')],'client_id':_0x356d83[_0x199b('0x5a')],'client_secret':_0x356d83[_0x199b('0x5b')],'grant_type':_0x199b('0x5c')},'json':!![]};return rp(_0xfd9a56)[_0x199b('0x25')](function(_0x488ee4){if(_0x488ee4[_0x199b('0x5d')]){_0x86988d(_0x488ee4[_0x199b('0x5d')]);}else{_0x5a0874('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x199b('0x41')](function(_0x476110){_0x5a0874(_0x476110);});});}exports[_0x199b('0x5e')]=function(_0x4dd048,_0x3cec06,_0x1f9a3d){var _0x1287bc,_0xb9fdde,_0x51f7d7,_0x976a6d,_0x591cec;return db[_0x199b('0x2b')][_0x199b('0x48')]({'where':{'id':_0x4dd048[_0x199b('0x42')]['id']},'attributes':['id',_0x199b('0x5f'),_0x199b('0x52'),'clientId',_0x199b('0x5b'),'serverUrl','code',_0x199b('0x59')]})['then'](handleEntityNotFound(_0x3cec06,null))['then'](function(_0x355669){_0x591cec=_0x355669;_0x1287bc=_0x591cec[_0x199b('0x5f')];_0xb9fdde=_0x1287bc===_0x199b('0x60')?'eu':_0x199b('0x61');_0x51f7d7=_0x591cec[_0x199b('0x62')];var _0x1e09ed=_0x51f7d7[_0x199b('0x63')](-0x1);if(_0x1e09ed==='/'||_0x1e09ed==='\x5c'||_0x1e09ed===':'){_0x51f7d7=_0x51f7d7[_0x199b('0x64')](0x0,_0x51f7d7[_0x199b('0x65')](_0x1e09ed));}if(!_0x591cec['refreshToken']){throw new Error(_0x199b('0x66'));}return getAccessToken(_0x591cec);})[_0x199b('0x25')](function(_0x460e17){if(_0x460e17){return rp({'method':'GET','uri':util[_0x199b('0x67')](_0x199b('0x68'),_0xb9fdde),'qs':{'module':'Calls'},'headers':{'Authorization':_0x199b('0x69')+_0x460e17},'json':!![]});}})[_0x199b('0x25')](function(_0x3d9e76){if(_0x3d9e76){if(_0x3d9e76[_0x199b('0x6a')]&&_0x3d9e76[_0x199b('0x6a')][_0x199b('0x27')]){throw new Error(_0x3d9e76[_0x199b('0x6a')][_0x199b('0x27')][_0x199b('0x6b')]);}var _0x448aa0=[];var _0x452480=[];var _0x1a838f=['Owner',_0x199b('0x6c'),_0x199b('0x6d'),_0x199b('0x6e'),_0x199b('0x6f'),'Call_Result',_0x199b('0x70'),_0x199b('0x71')];_0x452480=_['remove'](_0x3d9e76[_0x199b('0x35')],function(_0x1161d5){return _0x1a838f['includes'](_0x1161d5[_0x199b('0x72')]);});for(var _0x3d1193=0x0;_0x3d1193<_0x452480[_0x199b('0x36')];_0x3d1193++){if(_0x452480[_0x3d1193][_0x199b('0x73')]===![]){_0x448aa0[_0x199b('0x74')]({'id':_0x452480[_0x3d1193]['id'],'name':_0x452480[_0x3d1193]['display_label'],'custom':_0x452480[_0x3d1193]['custom_field'],'options':_0x452480[_0x3d1193]['data_type']===_0x199b('0x75')&&_0x452480[_0x3d1193][_0x199b('0x76')][_0x199b('0x36')]>-0x1?_[_0x199b('0x2a')](_0x452480[_0x3d1193][_0x199b('0x76')],function(_0x1a0751){return{'name':_0x1a0751,'value':_0x1a0751};}):[]});}}return{'count':_0x448aa0[_0x199b('0x36')],'rows':_0x448aa0};}else{return{'count':0x0,'rows':[]};}})[_0x199b('0x25')](respondWithResult(_0x3cec06,null))[_0x199b('0x41')](function(_0x167086){var _0x17deef=_0x4dd048[_0x199b('0x32')][_0x199b('0x77')]?0x1f4:_0x167086[_0x199b('0x78')]||0x1f4;logger[_0x199b('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x199b('0x5e'),_0x17deef,JSON[_0x199b('0x79')](_0x167086));delete _0x167086[_0x199b('0x28')];if(_0x17deef===0x191){_0x17deef=0x190;}_0x3cec06['status'](_0x17deef)[_0x199b('0x7a')](_0x4dd048[_0x199b('0x32')][_0x199b('0x77')]?{'message':_0x199b('0x7b'),'statusCode':_0x167086[_0x199b('0x78')]}:_0x167086);});}; \ No newline at end of file +var _0x526d=['intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','getConfigurations','findOne','rawAttributes','order','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','zoho.eu','com','serverUrl','slice','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','push','display_label','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','ZohoAccount','fieldName','type','model','map','query','keys','filters','attributes'];(function(_0x5ad60a,_0x5262c5){var _0x266de2=function(_0x467006){while(--_0x467006){_0x5ad60a['push'](_0x5ad60a['shift']());}};_0x266de2(++_0x5262c5);}(_0x526d,0x149));var _0xd526=function(_0x1cea66,_0x44d3d3){_0x1cea66=_0x1cea66-0x0;var _0x26e83e=_0x526d[_0x1cea66];return _0x26e83e;};'use strict';var emlformat=require(_0xd526('0x0'));var rimraf=require(_0xd526('0x1'));var zipdir=require(_0xd526('0x2'));var jsonpatch=require(_0xd526('0x3'));var rp=require(_0xd526('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd526('0x5'));var util=require(_0xd526('0x6'));var path=require(_0xd526('0x7'));var sox=require(_0xd526('0x8'));var csv=require(_0xd526('0x9'));var ejs=require(_0xd526('0xa'));var fs=require('fs');var fs_extra=require(_0xd526('0xb'));var _=require('lodash');var squel=require(_0xd526('0xc'));var crypto=require(_0xd526('0xd'));var jsforce=require(_0xd526('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd526('0x9'));var querystring=require(_0xd526('0xf'));var Papa=require('papaparse');var Redis=require(_0xd526('0x10'));var authService=require(_0xd526('0x11'));var qs=require(_0xd526('0x12'));var as=require(_0xd526('0x13'));var hardwareService=require(_0xd526('0x14'));var logger=require(_0xd526('0x15'))(_0xd526('0x16'));var utils=require(_0xd526('0x17'));var config=require(_0xd526('0x18'));var licenseUtil=require(_0xd526('0x19'));var db=require(_0xd526('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x135a1f,_0x23a08e){_0x23a08e=_0x23a08e||0xcc;return function(_0x4ff689){if(_0x4ff689){return _0x135a1f[_0xd526('0x1b')](_0x23a08e);}return _0x135a1f[_0xd526('0x1c')](_0x23a08e)['end']();};}function respondWithResult(_0x365fc0,_0xb7716f){_0xb7716f=_0xb7716f||0xc8;return function(_0x5bdcc9){if(_0x5bdcc9){return _0x365fc0[_0xd526('0x1c')](_0xb7716f)[_0xd526('0x1d')](_0x5bdcc9);}};}function respondWithFilteredResult(_0x1eacd7,_0x1ce0ba){return function(_0x4ee00e){if(_0x4ee00e){var _0xc7de9d=typeof _0x1ce0ba[_0xd526('0x1e')]===_0xd526('0x1f')&&typeof _0x1ce0ba[_0xd526('0x20')]===_0xd526('0x1f');var _0x268177=_0x4ee00e['count'];var _0x5bc6b5=_0xc7de9d?0x0:_0x1ce0ba['offset'];var _0x30bf52=_0xc7de9d?_0x4ee00e[_0xd526('0x21')]:_0x1ce0ba['offset']+_0x1ce0ba[_0xd526('0x20')];var _0x271ae3;if(_0x30bf52>=_0x268177){_0x30bf52=_0x268177;_0x271ae3=0xc8;}else{_0x271ae3=0xce;}_0x1eacd7[_0xd526('0x1c')](_0x271ae3);return _0x1eacd7[_0xd526('0x22')](_0xd526('0x23'),_0x5bc6b5+'-'+_0x30bf52+'/'+_0x268177)[_0xd526('0x1d')](_0x4ee00e);}return null;};}function patchUpdates(_0x4e04ec){return function(_0x4b2be7){try{jsonpatch[_0xd526('0x24')](_0x4b2be7,_0x4e04ec,!![]);}catch(_0x1e908e){return BPromise['reject'](_0x1e908e);}return _0x4b2be7[_0xd526('0x25')]();};}function saveUpdates(_0x49c49a,_0x52b4f9){return function(_0x249aec){if(_0x249aec){return _0x249aec[_0xd526('0x26')](_0x49c49a)[_0xd526('0x27')](function(_0x44dd47){return _0x44dd47;});}return null;};}function removeEntity(_0x354ee1,_0x265ada){return function(_0x70ea35){if(_0x70ea35){return _0x70ea35[_0xd526('0x28')]()['then'](function(){_0x354ee1['status'](0xcc)[_0xd526('0x29')]();});}};}function handleEntityNotFound(_0x50667e,_0x2cbdcb){return function(_0x37f92b){if(!_0x37f92b){_0x50667e[_0xd526('0x1b')](0x194);}return _0x37f92b;};}function handleError(_0x5d32e7,_0x2fc28a){_0x2fc28a=_0x2fc28a||0x1f4;return function(_0x5e14d9){logger[_0xd526('0x2a')](_0x5e14d9[_0xd526('0x2b')]);if(_0x5e14d9[_0xd526('0x2c')]){delete _0x5e14d9['name'];}_0x5d32e7[_0xd526('0x1c')](_0x2fc28a)[_0xd526('0x2d')](_0x5e14d9);};}exports['index']=function(_0x37b185,_0x25bac3){var _0x1e18c7={},_0x21aa36={},_0x118ec9={'count':0x0,'rows':[]};var _0x20de70=_['map'](db[_0xd526('0x2e')]['rawAttributes'],function(_0x23c627){return{'name':_0x23c627[_0xd526('0x2f')],'type':_0x23c627[_0xd526('0x30')]['key']};});_0x21aa36[_0xd526('0x31')]=_[_0xd526('0x32')](_0x20de70,_0xd526('0x2c'));_0x21aa36[_0xd526('0x33')]=_[_0xd526('0x34')](_0x37b185['query']);_0x21aa36[_0xd526('0x35')]=_['intersection'](_0x21aa36[_0xd526('0x31')],_0x21aa36[_0xd526('0x33')]);_0x1e18c7[_0xd526('0x36')]=_[_0xd526('0x37')](_0x21aa36[_0xd526('0x31')],qs[_0xd526('0x38')](_0x37b185[_0xd526('0x33')][_0xd526('0x38')]));_0x1e18c7[_0xd526('0x36')]=_0x1e18c7[_0xd526('0x36')][_0xd526('0x39')]?_0x1e18c7['attributes']:_0x21aa36[_0xd526('0x31')];if(!_0x37b185[_0xd526('0x33')]['hasOwnProperty'](_0xd526('0x3a'))){_0x1e18c7[_0xd526('0x20')]=qs['limit'](_0x37b185[_0xd526('0x33')][_0xd526('0x20')]);_0x1e18c7[_0xd526('0x1e')]=qs['offset'](_0x37b185[_0xd526('0x33')][_0xd526('0x1e')]);}_0x1e18c7['order']=qs[_0xd526('0x3b')](_0x37b185['query']['sort']);_0x1e18c7[_0xd526('0x3c')]=qs['filters'](_[_0xd526('0x3d')](_0x37b185[_0xd526('0x33')],_0x21aa36[_0xd526('0x35')]),_0x20de70);if(_0x37b185[_0xd526('0x33')][_0xd526('0x3e')]){_0x1e18c7['where']=_[_0xd526('0x3f')](_0x1e18c7[_0xd526('0x3c')],{'$or':_[_0xd526('0x32')](_0x20de70,function(_0x547f44){if(_0x547f44['type']!==_0xd526('0x40')){var _0x24955a={};_0x24955a[_0x547f44[_0xd526('0x2c')]]={'$like':'%'+_0x37b185['query'][_0xd526('0x3e')]+'%'};return _0x24955a;}})});}_0x1e18c7=_[_0xd526('0x3f')]({},_0x1e18c7,_0x37b185['options']);var _0x2ee942={'where':_0x1e18c7[_0xd526('0x3c')]};return db['ZohoAccount'][_0xd526('0x21')](_0x2ee942)[_0xd526('0x27')](function(_0x2c4d16){_0x118ec9[_0xd526('0x21')]=_0x2c4d16;if(_0x37b185['query'][_0xd526('0x41')]){_0x1e18c7[_0xd526('0x42')]=[{'all':!![]}];}return db[_0xd526('0x2e')][_0xd526('0x43')](_0x1e18c7);})['then'](function(_0x9c2d4c){_0x118ec9[_0xd526('0x44')]=_0x9c2d4c;return _0x118ec9;})['then'](respondWithFilteredResult(_0x25bac3,_0x1e18c7))['catch'](handleError(_0x25bac3,null));};exports[_0xd526('0x45')]=function(_0x1d3124,_0x41f5b0){var _0x34b6cd={'raw':![],'where':{'id':_0x1d3124[_0xd526('0x46')]['id']}},_0x41fb02={};_0x41fb02['model']=_[_0xd526('0x34')](db[_0xd526('0x2e')]['rawAttributes']);_0x41fb02[_0xd526('0x33')]=_[_0xd526('0x34')](_0x1d3124[_0xd526('0x33')]);_0x41fb02[_0xd526('0x35')]=_[_0xd526('0x37')](_0x41fb02[_0xd526('0x31')],_0x41fb02[_0xd526('0x33')]);_0x34b6cd['attributes']=_[_0xd526('0x37')](_0x41fb02['model'],qs[_0xd526('0x38')](_0x1d3124[_0xd526('0x33')][_0xd526('0x38')]));_0x34b6cd[_0xd526('0x36')]=_0x34b6cd['attributes'][_0xd526('0x39')]?_0x34b6cd[_0xd526('0x36')]:_0x41fb02[_0xd526('0x31')];if(_0x1d3124[_0xd526('0x33')]['includeAll']){_0x34b6cd[_0xd526('0x42')]=[{'all':!![]}];}_0x34b6cd=_['merge']({},_0x34b6cd,_0x1d3124[_0xd526('0x47')]);return db['ZohoAccount']['find'](_0x34b6cd)[_0xd526('0x27')](handleEntityNotFound(_0x41f5b0,null))[_0xd526('0x27')](respondWithResult(_0x41f5b0,null))[_0xd526('0x48')](handleError(_0x41f5b0,null));};exports[_0xd526('0x49')]=function(_0x1e5079,_0x1e1ec4){return db[_0xd526('0x2e')][_0xd526('0x49')](_0x1e5079[_0xd526('0x4a')],{})[_0xd526('0x27')](respondWithResult(_0x1e1ec4,0xc9))[_0xd526('0x48')](handleError(_0x1e1ec4,null));};exports[_0xd526('0x26')]=function(_0x514985,_0x4b10fa){if(_0x514985['body']['id']){delete _0x514985['body']['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x514985[_0xd526('0x46')]['id']}})[_0xd526('0x27')](handleEntityNotFound(_0x4b10fa,null))[_0xd526('0x27')](saveUpdates(_0x514985['body'],null))[_0xd526('0x27')](respondWithResult(_0x4b10fa,null))[_0xd526('0x48')](handleError(_0x4b10fa,null));};exports['destroy']=function(_0x968d7,_0x4e6ccb){return db[_0xd526('0x2e')][_0xd526('0x4b')]({'where':{'id':_0x968d7[_0xd526('0x46')]['id']}})[_0xd526('0x27')](handleEntityNotFound(_0x4e6ccb,null))[_0xd526('0x27')](removeEntity(_0x4e6ccb,null))[_0xd526('0x48')](handleError(_0x4e6ccb,null));};exports[_0xd526('0x4c')]=function(_0x587908,_0x223cdb,_0x41345c){var _0x3d7e50={};var _0x535677={};var _0x458890;var _0x534217;return db['ZohoAccount'][_0xd526('0x4d')]({'where':{'id':_0x587908[_0xd526('0x46')]['id']}})[_0xd526('0x27')](handleEntityNotFound(_0x223cdb,null))[_0xd526('0x27')](function(_0x442103){if(_0x442103){_0x458890=_0x442103;_0x535677['model']=_[_0xd526('0x34')](db['ZohoConfiguration'][_0xd526('0x4e')]);_0x535677[_0xd526('0x33')]=_['keys'](_0x587908['query']);_0x535677[_0xd526('0x35')]=_[_0xd526('0x37')](_0x535677[_0xd526('0x31')],_0x535677[_0xd526('0x33')]);_0x3d7e50['attributes']=_[_0xd526('0x37')](_0x535677[_0xd526('0x31')],qs[_0xd526('0x38')](_0x587908[_0xd526('0x33')][_0xd526('0x38')]));_0x3d7e50[_0xd526('0x36')]=_0x3d7e50[_0xd526('0x36')][_0xd526('0x39')]?_0x3d7e50[_0xd526('0x36')]:_0x535677[_0xd526('0x31')];_0x3d7e50[_0xd526('0x4f')]=qs[_0xd526('0x3b')](_0x587908[_0xd526('0x33')][_0xd526('0x3b')]);_0x3d7e50[_0xd526('0x3c')]=qs[_0xd526('0x35')](_[_0xd526('0x3d')](_0x587908[_0xd526('0x33')],_0x535677[_0xd526('0x35')]));if(_0x587908['query']['filter']){_0x3d7e50[_0xd526('0x3c')]=_['merge'](_0x3d7e50['where'],{'$or':_[_0xd526('0x32')](_0x3d7e50[_0xd526('0x36')],function(_0x195c99){var _0x42b9e4={};_0x42b9e4[_0x195c99]={'$like':'%'+_0x587908[_0xd526('0x33')][_0xd526('0x3e')]+'%'};return _0x42b9e4;})});}_0x3d7e50=_[_0xd526('0x3f')]({},_0x3d7e50,_0x587908['options']);return _0x458890[_0xd526('0x4c')](_0x3d7e50);}})[_0xd526('0x27')](function(_0x527a22){if(_0x527a22){_0x534217=_0x527a22[_0xd526('0x39')];if(!_0x587908['query']['hasOwnProperty'](_0xd526('0x3a'))){_0x3d7e50['limit']=qs['limit'](_0x587908['query'][_0xd526('0x20')]);_0x3d7e50[_0xd526('0x1e')]=qs[_0xd526('0x1e')](_0x587908['query'][_0xd526('0x1e')]);}return _0x458890[_0xd526('0x4c')](_0x3d7e50);}})[_0xd526('0x27')](function(_0x19437a){if(_0x19437a){return _0x19437a?{'count':_0x534217,'rows':_0x19437a}:null;}})[_0xd526('0x27')](respondWithResult(_0x223cdb,null))[_0xd526('0x48')](handleError(_0x223cdb,null));};exports[_0xd526('0x50')]=function(_0x2e9cb6,_0x4ce469,_0x63e4f0){if(_0x2e9cb6[_0xd526('0x4a')]['id']){delete _0x2e9cb6[_0xd526('0x4a')]['id'];}return db[_0xd526('0x2e')][_0xd526('0x4d')]({'where':{'id':_0x2e9cb6[_0xd526('0x46')]['id']}})[_0xd526('0x27')](handleEntityNotFound(_0x4ce469,null))[_0xd526('0x27')](function(_0x21d038){if(_0x21d038){_0x2e9cb6[_0xd526('0x4a')]['AccountId']=_0x21d038['id'];_0x2e9cb6['body'][_0xd526('0x51')]=integrations[_0xd526('0x52')](_0x2e9cb6['body']['channel'],_0x2e9cb6['body'][_0xd526('0x30')]);_0x2e9cb6[_0xd526('0x4a')][_0xd526('0x53')]=integrations[_0xd526('0x54')](_0x2e9cb6['body'][_0xd526('0x55')],_0x2e9cb6[_0xd526('0x4a')][_0xd526('0x30')]);return db[_0xd526('0x56')][_0xd526('0x49')](_0x2e9cb6[_0xd526('0x4a')],{'include':[{'model':db[_0xd526('0x57')],'as':_0xd526('0x51')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xd526('0x27')](respondWithResult(_0x4ce469,null))[_0xd526('0x48')](handleError(_0x4ce469,null));};function getAccessToken(_0x156ac3){return new Promise(function(_0x52bcad,_0x68a924){var _0x354c24;switch(_0x156ac3[_0xd526('0x58')]){case'US':_0x354c24=_0xd526('0x59');break;case'AU':_0x354c24=_0xd526('0x5a');break;case'EU':_0x354c24=_0xd526('0x5b');break;case'IN':_0x354c24=_0xd526('0x5c');break;case'CN':_0x354c24=_0xd526('0x5d');break;default:_0x354c24=_0xd526('0x5b');break;}var _0x1158d9={'method':_0xd526('0x5e'),'uri':_0x354c24+_0xd526('0x5f'),'qs':{'refresh_token':_0x156ac3['refreshToken'],'client_id':_0x156ac3['clientId'],'client_secret':_0x156ac3[_0xd526('0x60')],'grant_type':_0xd526('0x61')},'json':!![]};return rp(_0x1158d9)[_0xd526('0x27')](function(_0xd6ff55){if(_0xd6ff55[_0xd526('0x62')]){_0x52bcad(_0xd6ff55['access_token']);}else{_0x68a924(_0xd526('0x63'));}})[_0xd526('0x48')](function(_0x235fb0){_0x68a924(_0x235fb0);});});}exports['getFields']=function(_0x35d0f3,_0x2a722e,_0x776a71){var _0x43eb76,_0xe7cb4b,_0x55e655,_0x1e99d3,_0x383d48;return db[_0xd526('0x2e')]['findOne']({'where':{'id':_0x35d0f3[_0xd526('0x46')]['id']},'attributes':['id',_0xd526('0x64'),'zone',_0xd526('0x65'),_0xd526('0x60'),'serverUrl','code','refreshToken']})[_0xd526('0x27')](handleEntityNotFound(_0x2a722e,null))[_0xd526('0x27')](function(_0xe7a3f7){_0x383d48=_0xe7a3f7;_0x43eb76=_0x383d48[_0xd526('0x64')];_0xe7cb4b=_0x43eb76===_0xd526('0x66')?'eu':_0xd526('0x67');_0x55e655=_0x383d48[_0xd526('0x68')];var _0x191dab=_0x55e655[_0xd526('0x69')](-0x1);if(_0x191dab==='/'||_0x191dab==='\x5c'||_0x191dab===':'){_0x55e655=_0x55e655['substring'](0x0,_0x55e655['lastIndexOf'](_0x191dab));}if(!_0x383d48['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x383d48);})[_0xd526('0x27')](function(_0x316127){if(_0x316127){return rp({'method':_0xd526('0x6a'),'uri':util[_0xd526('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xe7cb4b),'qs':{'module':_0xd526('0x6c')},'headers':{'Authorization':_0xd526('0x6d')+_0x316127},'json':!![]});}})['then'](function(_0x1e30b3){if(_0x1e30b3){if(_0x1e30b3[_0xd526('0x6e')]&&_0x1e30b3[_0xd526('0x6e')][_0xd526('0x2a')]){throw new Error(_0x1e30b3[_0xd526('0x6e')][_0xd526('0x2a')]['message']);}var _0x588263=[];var _0x17c354=[];var _0x4f7dba=[_0xd526('0x6f'),_0xd526('0x70'),_0xd526('0x71'),_0xd526('0x72'),_0xd526('0x73'),_0xd526('0x74'),_0xd526('0x75'),_0xd526('0x76')];_0x17c354=_[_0xd526('0x77')](_0x1e30b3[_0xd526('0x38')],function(_0x94492){return _0x4f7dba['includes'](_0x94492['api_name']);});for(var _0x5cd82f=0x0;_0x5cd82f<_0x17c354[_0xd526('0x39')];_0x5cd82f++){if(_0x17c354[_0x5cd82f]['system_mandatory']===![]){_0x588263[_0xd526('0x78')]({'id':_0x17c354[_0x5cd82f]['id'],'name':_0x17c354[_0x5cd82f][_0xd526('0x79')],'custom':_0x17c354[_0x5cd82f][_0xd526('0x7a')],'options':_0x17c354[_0x5cd82f]['data_type']===_0xd526('0x7b')&&_0x17c354[_0x5cd82f][_0xd526('0x7c')][_0xd526('0x39')]>-0x1?_['map'](_0x17c354[_0x5cd82f][_0xd526('0x7c')],function(_0xe364cf){return{'name':_0xe364cf,'value':_0xe364cf};}):[]});}}return{'count':_0x588263[_0xd526('0x39')],'rows':_0x588263};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2a722e,null))['catch'](function(_0x290d3c){var _0xa983a3=_0x35d0f3[_0xd526('0x33')]['test']?0x1f4:_0x290d3c[_0xd526('0x7d')]||0x1f4;logger[_0xd526('0x2a')](_0xd526('0x7e'),'getFields',_0xa983a3,JSON['stringify'](_0x290d3c));delete _0x290d3c[_0xd526('0x2c')];if(_0xa983a3===0x191){_0xa983a3=0x190;}_0x2a722e[_0xd526('0x1c')](_0xa983a3)[_0xd526('0x2d')](_0x35d0f3['query']['test']?{'message':_0xd526('0x7f'),'statusCode':_0x290d3c['statusCode']}:_0x290d3c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 5f1c813..5c0604f 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 _0x469b=['https://accounts.zoho.com.au','https://accounts.zoho.com.cn','then','refresh_token','refreshToken','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','parse','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','host','slice'];(function(_0x321fe2,_0x43c348){var _0x39b9f5=function(_0x19f15b){while(--_0x19f15b){_0x321fe2['push'](_0x321fe2['shift']());}};_0x39b9f5(++_0x43c348);}(_0x469b,0x189));var _0xb469=function(_0x6b888e,_0x420fed){_0x6b888e=_0x6b888e-0x0;var _0x17d0f6=_0x469b[_0x6b888e];return _0x17d0f6;};'use strict';var _=require('lodash');var util=require(_0xb469('0x0'));var logger=require(_0xb469('0x1'))(_0xb469('0x2'));var moment=require(_0xb469('0x3'));var BPromise=require(_0xb469('0x4'));var rp=require(_0xb469('0x5'));var fs=require('fs');var path=require(_0xb469('0x6'));var rimraf=require(_0xb469('0x7'));var config=require(_0xb469('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xb469('0x9')]=function(_0x20db1c,_0xd3b242){return _0x20db1c[_0xb469('0xa')](_0xb469('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x372469,_0x18e7a1,_0x4f23c2){if(_0x372469[_0xb469('0xc')](_0xb469('0xd'))||_0x372469[_0xb469('0xc')](_0xb469('0xe'))||_0x372469[_0xb469('0xc')](_0xb469('0xf'))||_0x372469['changed']('clientSecret')||_0x372469[_0xb469('0xc')](_0xb469('0x10'))||_0x372469['changed']('host')){var _0x475126,_0x64e826;_0x475126=_0x372469[_0xb469('0xe')];var _0x45a2cf=_0x475126['slice'](-0x1);if(_0x45a2cf==='/'||_0x45a2cf==='\x5c'||_0x45a2cf===':'){_0x475126=_0x475126[_0xb469('0x11')](0x0,_0x475126[_0xb469('0x12')](_0x45a2cf));}switch(_0x372469[_0xb469('0xd')]){case'US':_0x64e826=_0xb469('0x13');break;case'AU':_0x64e826='https://accounts.zoho.com.au';break;case'IN':_0x64e826=_0xb469('0x14');break;case'CN':_0x64e826='https://accounts.zoho.com.cn';break;default:_0x64e826=_0xb469('0x15');break;}var _0x4584e9={'method':_0xb469('0x16'),'uri':_0x64e826+_0xb469('0x17'),'form':{'grant_type':_0xb469('0x18'),'client_id':_0x372469[_0xb469('0xf')],'client_secret':_0x372469[_0xb469('0x19')],'redirect_uri':_0x372469[_0xb469('0xe')],'code':_0x372469[_0xb469('0x10')]},'headers':{'Content-Type':_0xb469('0x1a')}};return rp(_0x4584e9)['then'](function(_0x87b6e0){var _0x541835=JSON[_0xb469('0x1b')](_0x87b6e0);if(_0x541835['refresh_token']){_0x372469['refreshToken']=_0x541835['refresh_token'];logger[_0xb469('0x1c')](util[_0xb469('0x1d')](_0xb469('0x1e'),_0x372469['name'],_0x372469['id']));}else{logger[_0xb469('0x1f')](util[_0xb469('0x1d')](_0xb469('0x20'),_0x372469[_0xb469('0x21')],_0x372469['id']),util[_0xb469('0x22')](_0x541835,{'showHidden':![],'depth':null}));}return _0x4f23c2(null,_0x18e7a1);})['catch'](function(_0x2bbbc2){logger[_0xb469('0x1f')](util['format'](_0xb469('0x20'),_0x372469[_0xb469('0x21')],_0x372469['id']),util[_0xb469('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4f23c2(_0x2bbbc2);});}else{return _0x4f23c2(null,_0x18e7a1);}},'beforeUpdate':function(_0x2aee10,_0x3e493d,_0x5ec958){if(_0x2aee10[_0xb469('0xc')](_0xb469('0xd'))||_0x2aee10[_0xb469('0xc')](_0xb469('0xe'))||_0x2aee10['changed'](_0xb469('0xf'))||_0x2aee10[_0xb469('0xc')](_0xb469('0x19'))||_0x2aee10['changed']('code')||_0x2aee10[_0xb469('0xc')](_0xb469('0x23'))){var _0xeee5d9,_0x58d3e8;_0xeee5d9=_0x2aee10[_0xb469('0xe')];var _0x57aac1=_0xeee5d9[_0xb469('0x24')](-0x1);if(_0x57aac1==='/'||_0x57aac1==='\x5c'||_0x57aac1===':'){_0xeee5d9=_0xeee5d9[_0xb469('0x11')](0x0,_0xeee5d9[_0xb469('0x12')](_0x57aac1));}switch(_0x2aee10[_0xb469('0xd')]){case'US':_0x58d3e8=_0xb469('0x13');break;case'AU':_0x58d3e8=_0xb469('0x25');break;case'IN':_0x58d3e8='https://accounts.zoho.in';break;case'CN':_0x58d3e8=_0xb469('0x26');break;default:_0x58d3e8='https://accounts.zoho.eu';break;}var _0x453dcb={'method':_0xb469('0x16'),'uri':_0x58d3e8+_0xb469('0x17'),'form':{'grant_type':_0xb469('0x18'),'client_id':_0x2aee10[_0xb469('0xf')],'client_secret':_0x2aee10[_0xb469('0x19')],'redirect_uri':_0x2aee10['serverUrl'],'code':_0x2aee10[_0xb469('0x10')]},'headers':{'Content-Type':_0xb469('0x1a')}};return rp(_0x453dcb)[_0xb469('0x27')](function(_0x4f614e){var _0x2dab6c=JSON[_0xb469('0x1b')](_0x4f614e);if(_0x2dab6c[_0xb469('0x28')]){_0x2aee10[_0xb469('0x29')]=_0x2dab6c[_0xb469('0x28')];logger[_0xb469('0x1c')](util['format'](_0xb469('0x1e'),_0x2aee10[_0xb469('0x21')],_0x2aee10['id']));}else{logger[_0xb469('0x1f')](util[_0xb469('0x1d')](_0xb469('0x20'),_0x2aee10[_0xb469('0x21')],_0x2aee10['id']),util[_0xb469('0x22')](_0x2dab6c,{'showHidden':![],'depth':null}));}return _0x5ec958(null,_0x3e493d);})[_0xb469('0x2a')](function(_0x34e59b){logger[_0xb469('0x1f')](util[_0xb469('0x1d')](_0xb469('0x20'),_0x2aee10[_0xb469('0x21')],_0x2aee10['id']),util[_0xb469('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x5ec958(_0x34e59b);});}else{return _0x5ec958(null,_0x3e493d);}}}});}; \ No newline at end of file +var _0x92b6=['inspect','error','substring','https://accounts.zoho.com.au','https://accounts.zoho.eu','parse','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','zone','changed','clientId','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','serverUrl','code','application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x7e5f07,_0x35c640){var _0x432e0f=function(_0x5d09b3){while(--_0x5d09b3){_0x7e5f07['push'](_0x7e5f07['shift']());}};_0x432e0f(++_0x35c640);}(_0x92b6,0x1da));var _0x692b=function(_0xb06cee,_0x577c14){_0xb06cee=_0xb06cee-0x0;var _0x197cd2=_0x92b6[_0xb06cee];return _0x197cd2;};'use strict';var _=require(_0x692b('0x0'));var util=require(_0x692b('0x1'));var logger=require(_0x692b('0x2'))(_0x692b('0x3'));var moment=require(_0x692b('0x4'));var BPromise=require(_0x692b('0x5'));var rp=require(_0x692b('0x6'));var fs=require('fs');var path=require(_0x692b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x692b('0x8'));module[_0x692b('0x9')]=function(_0x317739,_0x3079e4){return _0x317739['define']('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b87c7,_0xb9969c,_0x520588){if(_0x5b87c7['changed'](_0x692b('0xa'))||_0x5b87c7['changed']('serverUrl')||_0x5b87c7[_0x692b('0xb')](_0x692b('0xc'))||_0x5b87c7[_0x692b('0xb')](_0x692b('0xd'))||_0x5b87c7[_0x692b('0xb')]('code')||_0x5b87c7[_0x692b('0xb')](_0x692b('0xe'))){var _0x28f642,_0x5f3c22;_0x28f642=_0x5b87c7['serverUrl'];var _0x281163=_0x28f642[_0x692b('0xf')](-0x1);if(_0x281163==='/'||_0x281163==='\x5c'||_0x281163===':'){_0x28f642=_0x28f642['substring'](0x0,_0x28f642[_0x692b('0x10')](_0x281163));}switch(_0x5b87c7[_0x692b('0xa')]){case'US':_0x5f3c22=_0x692b('0x11');break;case'AU':_0x5f3c22='https://accounts.zoho.com.au';break;case'IN':_0x5f3c22=_0x692b('0x12');break;case'CN':_0x5f3c22=_0x692b('0x13');break;default:_0x5f3c22='https://accounts.zoho.eu';break;}var _0x4c6b3e={'method':_0x692b('0x14'),'uri':_0x5f3c22+_0x692b('0x15'),'form':{'grant_type':_0x692b('0x16'),'client_id':_0x5b87c7[_0x692b('0xc')],'client_secret':_0x5b87c7['clientSecret'],'redirect_uri':_0x5b87c7[_0x692b('0x17')],'code':_0x5b87c7[_0x692b('0x18')]},'headers':{'Content-Type':_0x692b('0x19')}};return rp(_0x4c6b3e)[_0x692b('0x1a')](function(_0x2931f4){var _0x26f384=JSON['parse'](_0x2931f4);if(_0x26f384[_0x692b('0x1b')]){_0x5b87c7['refreshToken']=_0x26f384[_0x692b('0x1b')];logger[_0x692b('0x1c')](util[_0x692b('0x1d')](_0x692b('0x1e'),_0x5b87c7[_0x692b('0x1f')],_0x5b87c7['id']));}else{logger['error'](util['format'](_0x692b('0x20'),_0x5b87c7[_0x692b('0x1f')],_0x5b87c7['id']),util[_0x692b('0x21')](_0x26f384,{'showHidden':![],'depth':null}));}return _0x520588(null,_0xb9969c);})['catch'](function(_0xaf4b7e){logger[_0x692b('0x22')](util['format'](_0x692b('0x20'),_0x5b87c7[_0x692b('0x1f')],_0x5b87c7['id']),util[_0x692b('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x520588(_0xaf4b7e);});}else{return _0x520588(null,_0xb9969c);}},'beforeUpdate':function(_0x2864c6,_0x1a7d7c,_0x4309e7){if(_0x2864c6['changed'](_0x692b('0xa'))||_0x2864c6[_0x692b('0xb')](_0x692b('0x17'))||_0x2864c6[_0x692b('0xb')](_0x692b('0xc'))||_0x2864c6[_0x692b('0xb')]('clientSecret')||_0x2864c6[_0x692b('0xb')](_0x692b('0x18'))||_0x2864c6[_0x692b('0xb')]('host')){var _0x1732e6,_0x241319;_0x1732e6=_0x2864c6[_0x692b('0x17')];var _0x34cc4e=_0x1732e6[_0x692b('0xf')](-0x1);if(_0x34cc4e==='/'||_0x34cc4e==='\x5c'||_0x34cc4e===':'){_0x1732e6=_0x1732e6[_0x692b('0x23')](0x0,_0x1732e6[_0x692b('0x10')](_0x34cc4e));}switch(_0x2864c6[_0x692b('0xa')]){case'US':_0x241319=_0x692b('0x11');break;case'AU':_0x241319=_0x692b('0x24');break;case'IN':_0x241319='https://accounts.zoho.in';break;case'CN':_0x241319=_0x692b('0x13');break;default:_0x241319=_0x692b('0x25');break;}var _0x5b2abe={'method':_0x692b('0x14'),'uri':_0x241319+'/oauth/v2/token','form':{'grant_type':_0x692b('0x16'),'client_id':_0x2864c6[_0x692b('0xc')],'client_secret':_0x2864c6[_0x692b('0xd')],'redirect_uri':_0x2864c6[_0x692b('0x17')],'code':_0x2864c6[_0x692b('0x18')]},'headers':{'Content-Type':_0x692b('0x19')}};return rp(_0x5b2abe)[_0x692b('0x1a')](function(_0xb6ff87){var _0x4936a4=JSON[_0x692b('0x26')](_0xb6ff87);if(_0x4936a4[_0x692b('0x1b')]){_0x2864c6['refreshToken']=_0x4936a4[_0x692b('0x1b')];logger[_0x692b('0x1c')](util[_0x692b('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2864c6[_0x692b('0x1f')],_0x2864c6['id']));}else{logger[_0x692b('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2864c6[_0x692b('0x1f')],_0x2864c6['id']),util['inspect'](_0x4936a4,{'showHidden':![],'depth':null}));}return _0x4309e7(null,_0x1a7d7c);})['catch'](function(_0x4ffb31){logger[_0x692b('0x22')](util['format'](_0x692b('0x20'),_0x2864c6[_0x692b('0x1f')],_0x2864c6['id']),util[_0x692b('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x4309e7(_0x4ffb31);});}else{return _0x4309e7(null,_0x1a7d7c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2b8451b..a04c649 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 _0xdf4d=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','options','raw','where','limit','include','map','model','attributes','debug','ShowZohoAccount','find','util'];(function(_0x19af9f,_0x203baa){var _0x16e000=function(_0x484b81){while(--_0x484b81){_0x19af9f['push'](_0x19af9f['shift']());}};_0x16e000(++_0x203baa);}(_0xdf4d,0xcb));var _0xddf4=function(_0x414fc1,_0x1c6fcb){_0x414fc1=_0x414fc1-0x0;var _0x57eae2=_0xdf4d[_0x414fc1];return _0x57eae2;};'use strict';var _=require('lodash');var util=require(_0xddf4('0x0'));var moment=require(_0xddf4('0x1'));var BPromise=require('bluebird');var rs=require(_0xddf4('0x2'));var fs=require('fs');var Redis=require(_0xddf4('0x3'));var db=require(_0xddf4('0x4'))['db'];var utils=require(_0xddf4('0x5'));var logger=require(_0xddf4('0x6'))(_0xddf4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddf4('0x8')][_0xddf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x444629,_0x20ab63,_0x2d2ccd){return new BPromise(function(_0x76de3b,_0x3ab323){return client[_0xddf4('0xa')](_0x444629,_0x2d2ccd)[_0xddf4('0xb')](function(_0x1e76fd){logger[_0xddf4('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x20ab63,_0xddf4('0xd'));logger['debug'](_0xddf4('0xe'),_0x20ab63,_0xddf4('0xd'),JSON[_0xddf4('0xf')](_0x1e76fd));if(_0x1e76fd[_0xddf4('0x10')]){if(_0x1e76fd['error'][_0xddf4('0x11')]===0x1f4){logger[_0xddf4('0x10')](_0xddf4('0x12'),_0x20ab63,_0x1e76fd[_0xddf4('0x10')]['message']);return _0x3ab323(_0x1e76fd['error'][_0xddf4('0x13')]);}logger['error'](_0xddf4('0x12'),_0x20ab63,_0x1e76fd[_0xddf4('0x10')][_0xddf4('0x13')]);return _0x76de3b(_0x1e76fd[_0xddf4('0x10')][_0xddf4('0x13')]);}else{logger['info'](_0xddf4('0x12'),_0x20ab63,'request\x20sent');_0x76de3b(_0x1e76fd[_0xddf4('0x14')][_0xddf4('0x13')]);}})[_0xddf4('0x15')](function(_0x31be4b){logger[_0xddf4('0x10')](_0xddf4('0x12'),_0x20ab63,_0x31be4b);_0x3ab323(_0x31be4b);});});}exports[_0xddf4('0x16')]=function(_0x4d76b1){var _0x49e4d3=this;return new Promise(function(_0x136036,_0x1aa57a){return db['ZohoAccount']['findAll']({'raw':_0x4d76b1['options']?_0x4d76b1[_0xddf4('0x17')][_0xddf4('0x18')]===undefined?!![]:![]:!![],'where':_0x4d76b1[_0xddf4('0x17')]?_0x4d76b1[_0xddf4('0x17')][_0xddf4('0x19')]||null:null,'attributes':_0x4d76b1['options']?_0x4d76b1[_0xddf4('0x17')]['attributes']||null:null,'limit':_0x4d76b1[_0xddf4('0x17')]?_0x4d76b1[_0xddf4('0x17')][_0xddf4('0x1a')]||null:null,'include':_0x4d76b1['options']?_0x4d76b1[_0xddf4('0x17')][_0xddf4('0x1b')]?_[_0xddf4('0x1c')](_0x4d76b1['options'][_0xddf4('0x1b')],function(_0x2a195d){return{'model':db[_0x2a195d[_0xddf4('0x1d')]],'as':_0x2a195d['as'],'attributes':_0x2a195d[_0xddf4('0x1e')],'include':_0x2a195d[_0xddf4('0x1b')]?_[_0xddf4('0x1c')](_0x2a195d[_0xddf4('0x1b')],function(_0x898311){return{'model':db[_0x898311[_0xddf4('0x1d')]],'as':_0x898311['as'],'attributes':_0x898311[_0xddf4('0x1e')],'include':_0x898311[_0xddf4('0x1b')]?_['map'](_0x898311[_0xddf4('0x1b')],function(_0x4eff51){return{'model':db[_0x4eff51[_0xddf4('0x1d')]],'as':_0x4eff51['as'],'attributes':_0x4eff51[_0xddf4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xddf4('0xb')](function(_0x67dbb1){logger[_0xddf4('0xc')](_0xddf4('0x16'),_0x4d76b1);logger[_0xddf4('0x1f')](_0xddf4('0x16'),_0x4d76b1,JSON[_0xddf4('0xf')](_0x67dbb1));_0x136036(_0x67dbb1);})[_0xddf4('0x15')](function(_0x9143e0){logger['error']('GetZohoAccount',_0x9143e0['message'],_0x4d76b1);_0x1aa57a(_0x49e4d3[_0xddf4('0x10')](0x1f4,_0x9143e0['message']));});});};exports[_0xddf4('0x20')]=function(_0x10311d){var _0x3e2680=this;return new Promise(function(_0x1be3e7,_0x48de86){return db['ZohoAccount'][_0xddf4('0x21')]({'raw':_0x10311d[_0xddf4('0x17')]?_0x10311d[_0xddf4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x10311d[_0xddf4('0x17')]?_0x10311d[_0xddf4('0x17')][_0xddf4('0x19')]||null:null,'attributes':_0x10311d['options']?_0x10311d[_0xddf4('0x17')][_0xddf4('0x1e')]||null:null,'include':_0x10311d['options']?_0x10311d['options'][_0xddf4('0x1b')]?_['map'](_0x10311d[_0xddf4('0x17')][_0xddf4('0x1b')],function(_0x5921f2){return{'model':db[_0x5921f2['model']],'as':_0x5921f2['as'],'attributes':_0x5921f2[_0xddf4('0x1e')],'include':_0x5921f2['include']?_[_0xddf4('0x1c')](_0x5921f2[_0xddf4('0x1b')],function(_0x32ce74){return{'model':db[_0x32ce74[_0xddf4('0x1d')]],'as':_0x32ce74['as'],'attributes':_0x32ce74[_0xddf4('0x1e')],'include':_0x32ce74[_0xddf4('0x1b')]?_[_0xddf4('0x1c')](_0x32ce74[_0xddf4('0x1b')],function(_0x3a545d){return{'model':db[_0x3a545d[_0xddf4('0x1d')]],'as':_0x3a545d['as'],'attributes':_0x3a545d['attributes']};}):[]};}):[]};}):[]:[]})[_0xddf4('0xb')](function(_0x384f05){logger[_0xddf4('0xc')](_0xddf4('0x20'),_0x10311d);logger[_0xddf4('0x1f')](_0xddf4('0x20'),_0x10311d,JSON[_0xddf4('0xf')](_0x384f05));_0x1be3e7(_0x384f05);})[_0xddf4('0x15')](function(_0xb6981e){logger[_0xddf4('0x10')](_0xddf4('0x20'),_0xb6981e[_0xddf4('0x13')],_0x10311d);_0x48de86(_0x3e2680[_0xddf4('0x10')](0x1f4,_0xb6981e['message']));});});}; \ No newline at end of file +var _0xb470=['limit','include','map','model','then','GetZohoAccount','ShowZohoAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','ZohoAccount','options','raw','attributes'];(function(_0x27b2a0,_0x1dc688){var _0x36d47f=function(_0xb0a42a){while(--_0xb0a42a){_0x27b2a0['push'](_0x27b2a0['shift']());}};_0x36d47f(++_0x1dc688);}(_0xb470,0x75));var _0x0b47=function(_0x1c9d5d,_0x11e218){_0x1c9d5d=_0x1c9d5d-0x0;var _0x387047=_0xb470[_0x1c9d5d];return _0x387047;};'use strict';var _=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var moment=require(_0x0b47('0x2'));var BPromise=require(_0x0b47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b47('0x4'));var db=require(_0x0b47('0x5'))['db'];var utils=require(_0x0b47('0x6'));var logger=require('../../config/logger')(_0x0b47('0x7'));var config=require(_0x0b47('0x8'));var jayson=require(_0x0b47('0x9'));var client=jayson[_0x0b47('0xa')][_0x0b47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d960,_0x201ab2,_0x37eb18){return new BPromise(function(_0x4bfebf,_0x56543c){return client['request'](_0x23d960,_0x37eb18)['then'](function(_0x38523d){logger[_0x0b47('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x201ab2,_0x0b47('0xd'));logger[_0x0b47('0xe')](_0x0b47('0xf'),_0x201ab2,_0x0b47('0xd'),JSON[_0x0b47('0x10')](_0x38523d));if(_0x38523d[_0x0b47('0x11')]){if(_0x38523d[_0x0b47('0x11')][_0x0b47('0x12')]===0x1f4){logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error']['message']);return _0x56543c(_0x38523d[_0x0b47('0x11')]['message']);}logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error'][_0x0b47('0x14')]);return _0x4bfebf(_0x38523d[_0x0b47('0x11')][_0x0b47('0x14')]);}else{logger[_0x0b47('0xc')](_0x0b47('0x13'),_0x201ab2,_0x0b47('0xd'));_0x4bfebf(_0x38523d[_0x0b47('0x15')][_0x0b47('0x14')]);}})[_0x0b47('0x16')](function(_0x1da847){logger['error'](_0x0b47('0x13'),_0x201ab2,_0x1da847);_0x56543c(_0x1da847);});});}exports['GetZohoAccount']=function(_0x11f305){var _0x1620fc=this;return new Promise(function(_0x2b1024,_0x478caa){return db[_0x0b47('0x17')]['findAll']({'raw':_0x11f305['options']?_0x11f305[_0x0b47('0x18')][_0x0b47('0x19')]===undefined?!![]:![]:!![],'where':_0x11f305['options']?_0x11f305[_0x0b47('0x18')]['where']||null:null,'attributes':_0x11f305[_0x0b47('0x18')]?_0x11f305[_0x0b47('0x18')][_0x0b47('0x1a')]||null:null,'limit':_0x11f305[_0x0b47('0x18')]?_0x11f305[_0x0b47('0x18')][_0x0b47('0x1b')]||null:null,'include':_0x11f305[_0x0b47('0x18')]?_0x11f305[_0x0b47('0x18')][_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0x11f305[_0x0b47('0x18')]['include'],function(_0xc87cd){return{'model':db[_0xc87cd[_0x0b47('0x1e')]],'as':_0xc87cd['as'],'attributes':_0xc87cd['attributes'],'include':_0xc87cd[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0xc87cd[_0x0b47('0x1c')],function(_0xd9c35c){return{'model':db[_0xd9c35c['model']],'as':_0xd9c35c['as'],'attributes':_0xd9c35c['attributes'],'include':_0xd9c35c[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0xd9c35c['include'],function(_0x138a03){return{'model':db[_0x138a03[_0x0b47('0x1e')]],'as':_0x138a03['as'],'attributes':_0x138a03[_0x0b47('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b47('0x1f')](function(_0x15db7d){logger[_0x0b47('0xc')](_0x0b47('0x20'),_0x11f305);logger[_0x0b47('0xe')](_0x0b47('0x20'),_0x11f305,JSON[_0x0b47('0x10')](_0x15db7d));_0x2b1024(_0x15db7d);})[_0x0b47('0x16')](function(_0x5e90f1){logger['error'](_0x0b47('0x20'),_0x5e90f1['message'],_0x11f305);_0x478caa(_0x1620fc[_0x0b47('0x11')](0x1f4,_0x5e90f1[_0x0b47('0x14')]));});});};exports[_0x0b47('0x21')]=function(_0xccf571){var _0x1014cd=this;return new Promise(function(_0x510caf,_0x453ac1){return db[_0x0b47('0x17')][_0x0b47('0x22')]({'raw':_0xccf571['options']?_0xccf571[_0x0b47('0x18')][_0x0b47('0x19')]===undefined?!![]:![]:!![],'where':_0xccf571[_0x0b47('0x18')]?_0xccf571[_0x0b47('0x18')][_0x0b47('0x23')]||null:null,'attributes':_0xccf571[_0x0b47('0x18')]?_0xccf571['options']['attributes']||null:null,'include':_0xccf571[_0x0b47('0x18')]?_0xccf571[_0x0b47('0x18')][_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0xccf571[_0x0b47('0x18')][_0x0b47('0x1c')],function(_0x42fa6c){return{'model':db[_0x42fa6c[_0x0b47('0x1e')]],'as':_0x42fa6c['as'],'attributes':_0x42fa6c[_0x0b47('0x1a')],'include':_0x42fa6c[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0x42fa6c['include'],function(_0x50fd74){return{'model':db[_0x50fd74[_0x0b47('0x1e')]],'as':_0x50fd74['as'],'attributes':_0x50fd74['attributes'],'include':_0x50fd74[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0x50fd74[_0x0b47('0x1c')],function(_0xa7724f){return{'model':db[_0xa7724f[_0x0b47('0x1e')]],'as':_0xa7724f['as'],'attributes':_0xa7724f[_0x0b47('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4948d5){logger['info'](_0x0b47('0x21'),_0xccf571);logger[_0x0b47('0xe')](_0x0b47('0x21'),_0xccf571,JSON[_0x0b47('0x10')](_0x4948d5));_0x510caf(_0x4948d5);})[_0x0b47('0x16')](function(_0x22227f){logger['error'](_0x0b47('0x21'),_0x22227f[_0x0b47('0x14')],_0xccf571);_0x453ac1(_0x1014cd[_0x0b47('0x11')](0x1f4,_0x22227f[_0x0b47('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 17d39c7..63c1f31 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 _0xa001=['getFields','/:id/subjects','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','isAuthenticated','show'];(function(_0x58f83c,_0x563967){var _0x5d2f70=function(_0x22d679){while(--_0x22d679){_0x58f83c['push'](_0x58f83c['shift']());}};_0x5d2f70(++_0x563967);}(_0xa001,0x93));var _0x1a00=function(_0x2c5aab,_0x1395a2){_0x2c5aab=_0x2c5aab-0x0;var _0x5278a1=_0xa001[_0x2c5aab];return _0x5278a1;};'use strict';var multer=require(_0x1a00('0x0'));var util=require(_0x1a00('0x1'));var path=require(_0x1a00('0x2'));var timeout=require(_0x1a00('0x3'));var express=require(_0x1a00('0x4'));var router=express[_0x1a00('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1a00('0x6'));var config=require(_0x1a00('0x7'));var controller=require(_0x1a00('0x8'));router[_0x1a00('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1a00('0x9')](_0x1a00('0xa'),auth[_0x1a00('0xb')](),controller[_0x1a00('0xc')]);router[_0x1a00('0x9')]('/:id/fields',auth[_0x1a00('0xb')](),controller[_0x1a00('0xd')]);router['get'](_0x1a00('0xe'),auth[_0x1a00('0xb')](),controller['getSubjects']);router[_0x1a00('0x9')]('/:id/descriptions',auth[_0x1a00('0xb')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x1a00('0xf')]);router[_0x1a00('0x10')](_0x1a00('0xa'),auth[_0x1a00('0xb')](),controller[_0x1a00('0x11')]);router[_0x1a00('0x12')](_0x1a00('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a00('0x13')]=router; \ No newline at end of file +var _0xa18b=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x1378f4,_0x3d8d5f){var _0x2783d9=function(_0x5bd395){while(--_0x5bd395){_0x1378f4['push'](_0x1378f4['shift']());}};_0x2783d9(++_0x3d8d5f);}(_0xa18b,0xff));var _0xba18=function(_0x81fe53,_0x5b8f05){_0x81fe53=_0x81fe53-0x0;var _0x56f7a7=_0xa18b[_0x81fe53];return _0x56f7a7;};'use strict';var multer=require(_0xba18('0x0'));var util=require('util');var path=require(_0xba18('0x1'));var timeout=require('connect-timeout');var express=require(_0xba18('0x2'));var router=express[_0xba18('0x3')]();var fs_extra=require(_0xba18('0x4'));var auth=require(_0xba18('0x5'));var interaction=require(_0xba18('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xba18('0x7')]('/',auth[_0xba18('0x8')](),controller[_0xba18('0x9')]);router['get']('/:id',auth[_0xba18('0x8')](),controller[_0xba18('0xa')]);router[_0xba18('0x7')]('/:id/fields',auth[_0xba18('0x8')](),controller['getFields']);router['get'](_0xba18('0xb'),auth[_0xba18('0x8')](),controller['getSubjects']);router[_0xba18('0x7')](_0xba18('0xc'),auth[_0xba18('0x8')](),controller[_0xba18('0xd')]);router[_0xba18('0xe')]('/',auth[_0xba18('0x8')](),controller[_0xba18('0xf')]);router[_0xba18('0x10')]('/:id',auth[_0xba18('0x8')](),controller[_0xba18('0x11')]);router[_0xba18('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xba18('0x13')]);module[_0xba18('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 77aad0f..25730ef 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 _0x8610=['STRING','lead','contact','ENUM','sequelize','exports'];(function(_0x2607ba,_0x5cbc38){var _0x2da1d6=function(_0x38da72){while(--_0x38da72){_0x2607ba['push'](_0x2607ba['shift']());}};_0x2da1d6(++_0x5cbc38);}(_0x8610,0x154));var _0x0861=function(_0x200b86,_0xc7fb75){_0x200b86=_0x200b86-0x0;var _0x4a9547=_0x8610[_0x200b86];return _0x4a9547;};'use strict';var Sequelize=require(_0x0861('0x0'));module[_0x0861('0x1')]={'name':{'type':Sequelize[_0x0861('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x0861('0x3'),_0x0861('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x0861('0x5')]('contact_lead',_0x0861('0x4'),_0x0861('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x0861('0x2')]}}; \ No newline at end of file +var _0x260f=['ENUM','lead','contact','nothing','contact_lead','STRING'];(function(_0x7dda3a,_0x488006){var _0x39a93e=function(_0x2840cd){while(--_0x2840cd){_0x7dda3a['push'](_0x7dda3a['shift']());}};_0x39a93e(++_0x488006);}(_0x260f,0xdd));var _0xf260=function(_0x321231,_0x2fdc78){_0x321231=_0x321231-0x0;var _0x313c26=_0x260f[_0x321231];return _0x313c26;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf260('0x0')]},'moduleCreate':{'type':Sequelize[_0xf260('0x1')](_0xf260('0x2'),_0xf260('0x3'),_0xf260('0x4')),'defaultValue':_0xf260('0x2')},'moduleSearch':{'type':Sequelize[_0xf260('0x1')]('contact_lead',_0xf260('0x3'),'lead'),'defaultValue':_0xf260('0x5')},'description':{'type':Sequelize[_0xf260('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 001d81f..5bf7616 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 _0xb34e=['length','hasOwnProperty','nolimit','sort','filter','merge','where','count','includeAll','include','findAll','rows','params','options','find','create','body','catch','findOne','ZohoField','order','getFields','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields'];(function(_0x202bbf,_0x48a7ba){var _0x562eed=function(_0x243422){while(--_0x243422){_0x202bbf['push'](_0x202bbf['shift']());}};_0x562eed(++_0x48a7ba);}(_0xb34e,0x1c2));var _0xeb34=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xb34e[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xeb34('0x0'));var rimraf=require(_0xeb34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb34('0x2'));var rp=require(_0xeb34('0x3'));var moment=require(_0xeb34('0x4'));var BPromise=require(_0xeb34('0x5'));var Mustache=require(_0xeb34('0x6'));var util=require(_0xeb34('0x7'));var path=require(_0xeb34('0x8'));var sox=require(_0xeb34('0x9'));var csv=require('to-csv');var ejs=require(_0xeb34('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb34('0xb'));var squel=require(_0xeb34('0xc'));var crypto=require(_0xeb34('0xd'));var jsforce=require(_0xeb34('0xe'));var deskjs=require(_0xeb34('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb34('0x10'));var Papa=require(_0xeb34('0x11'));var Redis=require(_0xeb34('0x12'));var authService=require(_0xeb34('0x13'));var qs=require(_0xeb34('0x14'));var as=require(_0xeb34('0x15'));var hardwareService=require(_0xeb34('0x16'));var logger=require(_0xeb34('0x17'))(_0xeb34('0x18'));var utils=require(_0xeb34('0x19'));var config=require(_0xeb34('0x1a'));var licenseUtil=require(_0xeb34('0x1b'));var db=require(_0xeb34('0x1c'))['db'];function respondWithStatusCode(_0x24c5d6,_0x26587c){_0x26587c=_0x26587c||0xcc;return function(_0x3275d7){if(_0x3275d7){return _0x24c5d6['sendStatus'](_0x26587c);}return _0x24c5d6['status'](_0x26587c)['end']();};}function respondWithResult(_0x358fb0,_0x1aafbd){_0x1aafbd=_0x1aafbd||0xc8;return function(_0x2521ee){if(_0x2521ee){return _0x358fb0[_0xeb34('0x1d')](_0x1aafbd)[_0xeb34('0x1e')](_0x2521ee);}};}function respondWithFilteredResult(_0x443d05,_0x3e24b6){return function(_0x4c7344){if(_0x4c7344){var _0x1bdd93=typeof _0x3e24b6[_0xeb34('0x1f')]===_0xeb34('0x20')&&typeof _0x3e24b6[_0xeb34('0x21')]==='undefined';var _0x4441f4=_0x4c7344['count'];var _0x12140a=_0x1bdd93?0x0:_0x3e24b6['offset'];var _0x2737ad=_0x1bdd93?_0x4c7344['count']:_0x3e24b6[_0xeb34('0x1f')]+_0x3e24b6[_0xeb34('0x21')];var _0x1a2854;if(_0x2737ad>=_0x4441f4){_0x2737ad=_0x4441f4;_0x1a2854=0xc8;}else{_0x1a2854=0xce;}_0x443d05[_0xeb34('0x1d')](_0x1a2854);return _0x443d05[_0xeb34('0x22')]('Content-Range',_0x12140a+'-'+_0x2737ad+'/'+_0x4441f4)['json'](_0x4c7344);}return null;};}function patchUpdates(_0x149afc){return function(_0x20753){try{jsonpatch[_0xeb34('0x23')](_0x20753,_0x149afc,!![]);}catch(_0x293f59){return BPromise[_0xeb34('0x24')](_0x293f59);}return _0x20753[_0xeb34('0x25')]();};}function saveUpdates(_0xc45f2e,_0x3bcfce){return function(_0x3cb74d){if(_0x3cb74d){return _0x3cb74d[_0xeb34('0x26')](_0xc45f2e)[_0xeb34('0x27')](function(_0x50cc44){return _0x50cc44;});}return null;};}function removeEntity(_0x28644d,_0x182ae3){return function(_0x3a3270){if(_0x3a3270){return _0x3a3270[_0xeb34('0x28')]()[_0xeb34('0x27')](function(){_0x28644d[_0xeb34('0x1d')](0xcc)[_0xeb34('0x29')]();});}};}function handleEntityNotFound(_0x5bf95c,_0x4b3b97){return function(_0x352c1c){if(!_0x352c1c){_0x5bf95c[_0xeb34('0x2a')](0x194);}return _0x352c1c;};}function handleError(_0x210d0c,_0x46083e){_0x46083e=_0x46083e||0x1f4;return function(_0x1e5b14){logger[_0xeb34('0x2b')](_0x1e5b14[_0xeb34('0x2c')]);if(_0x1e5b14[_0xeb34('0x2d')]){delete _0x1e5b14[_0xeb34('0x2d')];}_0x210d0c['status'](_0x46083e)[_0xeb34('0x2e')](_0x1e5b14);};}exports[_0xeb34('0x2f')]=function(_0x379347,_0xf37ba){var _0x2c2cdd={},_0x17104b={},_0x5ef0f5={'count':0x0,'rows':[]};var _0x386122=_[_0xeb34('0x30')](db[_0xeb34('0x31')][_0xeb34('0x32')],function(_0x3b31b1){return{'name':_0x3b31b1[_0xeb34('0x33')],'type':_0x3b31b1[_0xeb34('0x34')]['key']};});_0x17104b['model']=_[_0xeb34('0x30')](_0x386122,_0xeb34('0x2d'));_0x17104b['query']=_[_0xeb34('0x35')](_0x379347[_0xeb34('0x36')]);_0x17104b[_0xeb34('0x37')]=_[_0xeb34('0x38')](_0x17104b[_0xeb34('0x39')],_0x17104b[_0xeb34('0x36')]);_0x2c2cdd[_0xeb34('0x3a')]=_[_0xeb34('0x38')](_0x17104b[_0xeb34('0x39')],qs[_0xeb34('0x3b')](_0x379347[_0xeb34('0x36')][_0xeb34('0x3b')]));_0x2c2cdd[_0xeb34('0x3a')]=_0x2c2cdd['attributes'][_0xeb34('0x3c')]?_0x2c2cdd['attributes']:_0x17104b[_0xeb34('0x39')];if(!_0x379347[_0xeb34('0x36')][_0xeb34('0x3d')](_0xeb34('0x3e'))){_0x2c2cdd['limit']=qs[_0xeb34('0x21')](_0x379347[_0xeb34('0x36')][_0xeb34('0x21')]);_0x2c2cdd[_0xeb34('0x1f')]=qs[_0xeb34('0x1f')](_0x379347[_0xeb34('0x36')][_0xeb34('0x1f')]);}_0x2c2cdd['order']=qs[_0xeb34('0x3f')](_0x379347[_0xeb34('0x36')][_0xeb34('0x3f')]);_0x2c2cdd['where']=qs[_0xeb34('0x37')](_['pick'](_0x379347[_0xeb34('0x36')],_0x17104b[_0xeb34('0x37')]),_0x386122);if(_0x379347[_0xeb34('0x36')][_0xeb34('0x40')]){_0x2c2cdd['where']=_[_0xeb34('0x41')](_0x2c2cdd[_0xeb34('0x42')],{'$or':_['map'](_0x386122,function(_0x1a88c0){if(_0x1a88c0[_0xeb34('0x34')]!=='VIRTUAL'){var _0xdb2b95={};_0xdb2b95[_0x1a88c0['name']]={'$like':'%'+_0x379347[_0xeb34('0x36')][_0xeb34('0x40')]+'%'};return _0xdb2b95;}})});}_0x2c2cdd=_['merge']({},_0x2c2cdd,_0x379347['options']);var _0x3513ad={'where':_0x2c2cdd['where']};return db['ZohoConfiguration'][_0xeb34('0x43')](_0x3513ad)[_0xeb34('0x27')](function(_0x117c0d){_0x5ef0f5[_0xeb34('0x43')]=_0x117c0d;if(_0x379347[_0xeb34('0x36')][_0xeb34('0x44')]){_0x2c2cdd[_0xeb34('0x45')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xeb34('0x46')](_0x2c2cdd);})[_0xeb34('0x27')](function(_0x4e93d9){_0x5ef0f5[_0xeb34('0x47')]=_0x4e93d9;return _0x5ef0f5;})[_0xeb34('0x27')](respondWithFilteredResult(_0xf37ba,_0x2c2cdd))['catch'](handleError(_0xf37ba,null));};exports['show']=function(_0x5f3335,_0x4cf882){var _0x562ab5={'raw':![],'where':{'id':_0x5f3335[_0xeb34('0x48')]['id']}},_0x43ba64={};_0x43ba64[_0xeb34('0x39')]=_[_0xeb34('0x35')](db['ZohoConfiguration'][_0xeb34('0x32')]);_0x43ba64[_0xeb34('0x36')]=_['keys'](_0x5f3335['query']);_0x43ba64[_0xeb34('0x37')]=_[_0xeb34('0x38')](_0x43ba64[_0xeb34('0x39')],_0x43ba64[_0xeb34('0x36')]);_0x562ab5[_0xeb34('0x3a')]=_[_0xeb34('0x38')](_0x43ba64[_0xeb34('0x39')],qs[_0xeb34('0x3b')](_0x5f3335[_0xeb34('0x36')][_0xeb34('0x3b')]));_0x562ab5[_0xeb34('0x3a')]=_0x562ab5['attributes'][_0xeb34('0x3c')]?_0x562ab5['attributes']:_0x43ba64[_0xeb34('0x39')];if(_0x5f3335['query'][_0xeb34('0x44')]){_0x562ab5[_0xeb34('0x45')]=[{'all':!![]}];}_0x562ab5=_[_0xeb34('0x41')]({},_0x562ab5,_0x5f3335[_0xeb34('0x49')]);return db[_0xeb34('0x31')][_0xeb34('0x4a')](_0x562ab5)[_0xeb34('0x27')](handleEntityNotFound(_0x4cf882,null))[_0xeb34('0x27')](respondWithResult(_0x4cf882,null))['catch'](handleError(_0x4cf882,null));};exports[_0xeb34('0x4b')]=function(_0x15f10b,_0x50e6c2){return db[_0xeb34('0x31')][_0xeb34('0x4b')](_0x15f10b[_0xeb34('0x4c')],{})['then'](respondWithResult(_0x50e6c2,0xc9))[_0xeb34('0x4d')](handleError(_0x50e6c2,null));};exports[_0xeb34('0x26')]=function(_0x1037a8,_0x326e1c){if(_0x1037a8[_0xeb34('0x4c')]['id']){delete _0x1037a8[_0xeb34('0x4c')]['id'];}return db[_0xeb34('0x31')][_0xeb34('0x4a')]({'where':{'id':_0x1037a8[_0xeb34('0x48')]['id']}})[_0xeb34('0x27')](handleEntityNotFound(_0x326e1c,null))['then'](saveUpdates(_0x1037a8[_0xeb34('0x4c')],null))[_0xeb34('0x27')](respondWithResult(_0x326e1c,null))[_0xeb34('0x4d')](handleError(_0x326e1c,null));};exports[_0xeb34('0x28')]=function(_0x5a04b0,_0x829039){return db[_0xeb34('0x31')][_0xeb34('0x4a')]({'where':{'id':_0x5a04b0[_0xeb34('0x48')]['id']}})['then'](handleEntityNotFound(_0x829039,null))[_0xeb34('0x27')](removeEntity(_0x829039,null))[_0xeb34('0x4d')](handleError(_0x829039,null));};exports['getFields']=function(_0x47d859,_0x42535e,_0x318cf8){var _0x43f2ff={};var _0x433ebc={};var _0x22f497;var _0x18a7fa;return db['ZohoConfiguration'][_0xeb34('0x4e')]({'where':{'id':_0x47d859['params']['id']}})[_0xeb34('0x27')](handleEntityNotFound(_0x42535e,null))['then'](function(_0x351b06){if(_0x351b06){_0x22f497=_0x351b06;_0x433ebc[_0xeb34('0x39')]=_[_0xeb34('0x35')](db[_0xeb34('0x4f')]['rawAttributes']);_0x433ebc[_0xeb34('0x36')]=_['keys'](_0x47d859[_0xeb34('0x36')]);_0x433ebc[_0xeb34('0x37')]=_['intersection'](_0x433ebc[_0xeb34('0x39')],_0x433ebc['query']);_0x43f2ff[_0xeb34('0x3a')]=_[_0xeb34('0x38')](_0x433ebc[_0xeb34('0x39')],qs[_0xeb34('0x3b')](_0x47d859[_0xeb34('0x36')][_0xeb34('0x3b')]));_0x43f2ff['attributes']=_0x43f2ff[_0xeb34('0x3a')][_0xeb34('0x3c')]?_0x43f2ff[_0xeb34('0x3a')]:_0x433ebc[_0xeb34('0x39')];_0x43f2ff[_0xeb34('0x50')]=qs[_0xeb34('0x3f')](_0x47d859[_0xeb34('0x36')][_0xeb34('0x3f')]);_0x43f2ff[_0xeb34('0x42')]=qs['filters'](_['pick'](_0x47d859['query'],_0x433ebc['filters']));if(_0x47d859[_0xeb34('0x36')][_0xeb34('0x40')]){_0x43f2ff[_0xeb34('0x42')]=_[_0xeb34('0x41')](_0x43f2ff[_0xeb34('0x42')],{'$or':_[_0xeb34('0x30')](_0x43f2ff[_0xeb34('0x3a')],function(_0x527e36){var _0x532680={};_0x532680[_0x527e36]={'$like':'%'+_0x47d859[_0xeb34('0x36')][_0xeb34('0x40')]+'%'};return _0x532680;})});}_0x43f2ff=_[_0xeb34('0x41')]({},_0x43f2ff,_0x47d859[_0xeb34('0x49')]);return _0x22f497[_0xeb34('0x51')](_0x43f2ff);}})[_0xeb34('0x27')](function(_0x804407){if(_0x804407){_0x18a7fa=_0x804407[_0xeb34('0x3c')];if(!_0x47d859[_0xeb34('0x36')][_0xeb34('0x3d')](_0xeb34('0x3e'))){_0x43f2ff['limit']=qs[_0xeb34('0x21')](_0x47d859['query'][_0xeb34('0x21')]);_0x43f2ff[_0xeb34('0x1f')]=qs['offset'](_0x47d859[_0xeb34('0x36')][_0xeb34('0x1f')]);}return _0x22f497[_0xeb34('0x51')](_0x43f2ff);}})['then'](function(_0x562c19){if(_0x562c19){return _0x562c19?{'count':_0x18a7fa,'rows':_0x562c19}:null;}})[_0xeb34('0x27')](respondWithResult(_0x42535e,null))[_0xeb34('0x4d')](handleError(_0x42535e,null));};exports[_0xeb34('0x52')]=function(_0x176e8f,_0x55fffb,_0x1f0725){var _0x596912={};var _0x5f32eb={};var _0x9b35fc;var _0x39ec30;return db['ZohoConfiguration'][_0xeb34('0x4e')]({'where':{'id':_0x176e8f[_0xeb34('0x48')]['id']}})[_0xeb34('0x27')](handleEntityNotFound(_0x55fffb,null))[_0xeb34('0x27')](function(_0x18a034){if(_0x18a034){_0x9b35fc=_0x18a034;_0x5f32eb[_0xeb34('0x39')]=_[_0xeb34('0x35')](db[_0xeb34('0x4f')][_0xeb34('0x32')]);_0x5f32eb['query']=_['keys'](_0x176e8f[_0xeb34('0x36')]);_0x5f32eb[_0xeb34('0x37')]=_['intersection'](_0x5f32eb['model'],_0x5f32eb['query']);_0x596912[_0xeb34('0x3a')]=_[_0xeb34('0x38')](_0x5f32eb['model'],qs['fields'](_0x176e8f[_0xeb34('0x36')][_0xeb34('0x3b')]));_0x596912[_0xeb34('0x3a')]=_0x596912['attributes'][_0xeb34('0x3c')]?_0x596912[_0xeb34('0x3a')]:_0x5f32eb[_0xeb34('0x39')];_0x596912[_0xeb34('0x50')]=qs[_0xeb34('0x3f')](_0x176e8f['query'][_0xeb34('0x3f')]);_0x596912[_0xeb34('0x42')]=qs[_0xeb34('0x37')](_[_0xeb34('0x53')](_0x176e8f['query'],_0x5f32eb[_0xeb34('0x37')]));if(_0x176e8f[_0xeb34('0x36')][_0xeb34('0x40')]){_0x596912[_0xeb34('0x42')]=_[_0xeb34('0x41')](_0x596912[_0xeb34('0x42')],{'$or':_[_0xeb34('0x30')](_0x596912[_0xeb34('0x3a')],function(_0x116453){var _0x2e389c={};_0x2e389c[_0x116453]={'$like':'%'+_0x176e8f[_0xeb34('0x36')][_0xeb34('0x40')]+'%'};return _0x2e389c;})});}_0x596912=_[_0xeb34('0x41')]({},_0x596912,_0x176e8f['options']);return _0x9b35fc[_0xeb34('0x52')](_0x596912);}})[_0xeb34('0x27')](function(_0xa2aa7a){if(_0xa2aa7a){_0x39ec30=_0xa2aa7a['length'];if(!_0x176e8f[_0xeb34('0x36')][_0xeb34('0x3d')]('nolimit')){_0x596912['limit']=qs['limit'](_0x176e8f[_0xeb34('0x36')][_0xeb34('0x21')]);_0x596912['offset']=qs[_0xeb34('0x1f')](_0x176e8f[_0xeb34('0x36')]['offset']);}return _0x9b35fc[_0xeb34('0x52')](_0x596912);}})[_0xeb34('0x27')](function(_0x59cfae){if(_0x59cfae){return _0x59cfae?{'count':_0x39ec30,'rows':_0x59cfae}:null;}})[_0xeb34('0x27')](respondWithResult(_0x55fffb,null))['catch'](handleError(_0x55fffb,null));};exports[_0xeb34('0x54')]=function(_0x230ff1,_0x5de14b,_0x334c83){var _0x4e832b={};var _0x122ec0={};var _0x3dbead;var _0x2e9352;return db[_0xeb34('0x31')][_0xeb34('0x4e')]({'where':{'id':_0x230ff1['params']['id']}})[_0xeb34('0x27')](handleEntityNotFound(_0x5de14b,null))[_0xeb34('0x27')](function(_0x11d106){if(_0x11d106){_0x3dbead=_0x11d106;_0x122ec0[_0xeb34('0x39')]=_[_0xeb34('0x35')](db[_0xeb34('0x4f')][_0xeb34('0x32')]);_0x122ec0[_0xeb34('0x36')]=_[_0xeb34('0x35')](_0x230ff1[_0xeb34('0x36')]);_0x122ec0[_0xeb34('0x37')]=_['intersection'](_0x122ec0['model'],_0x122ec0[_0xeb34('0x36')]);_0x4e832b['attributes']=_[_0xeb34('0x38')](_0x122ec0[_0xeb34('0x39')],qs[_0xeb34('0x3b')](_0x230ff1[_0xeb34('0x36')][_0xeb34('0x3b')]));_0x4e832b[_0xeb34('0x3a')]=_0x4e832b['attributes']['length']?_0x4e832b[_0xeb34('0x3a')]:_0x122ec0[_0xeb34('0x39')];_0x4e832b[_0xeb34('0x50')]=qs[_0xeb34('0x3f')](_0x230ff1[_0xeb34('0x36')][_0xeb34('0x3f')]);_0x4e832b[_0xeb34('0x42')]=qs['filters'](_[_0xeb34('0x53')](_0x230ff1[_0xeb34('0x36')],_0x122ec0[_0xeb34('0x37')]));if(_0x230ff1[_0xeb34('0x36')][_0xeb34('0x40')]){_0x4e832b[_0xeb34('0x42')]=_[_0xeb34('0x41')](_0x4e832b[_0xeb34('0x42')],{'$or':_[_0xeb34('0x30')](_0x4e832b[_0xeb34('0x3a')],function(_0x8b349){var _0x4b0c25={};_0x4b0c25[_0x8b349]={'$like':'%'+_0x230ff1[_0xeb34('0x36')]['filter']+'%'};return _0x4b0c25;})});}_0x4e832b=_[_0xeb34('0x41')]({},_0x4e832b,_0x230ff1['options']);return _0x3dbead[_0xeb34('0x54')](_0x4e832b);}})['then'](function(_0x3ae4bd){if(_0x3ae4bd){_0x2e9352=_0x3ae4bd[_0xeb34('0x3c')];if(!_0x230ff1['query'][_0xeb34('0x3d')](_0xeb34('0x3e'))){_0x4e832b[_0xeb34('0x21')]=qs[_0xeb34('0x21')](_0x230ff1['query'][_0xeb34('0x21')]);_0x4e832b[_0xeb34('0x1f')]=qs['offset'](_0x230ff1['query'][_0xeb34('0x1f')]);}return _0x3dbead['getDescriptions'](_0x4e832b);}})[_0xeb34('0x27')](function(_0x32e108){if(_0x32e108){return _0x32e108?{'count':_0x2e9352,'rows':_0x32e108}:null;}})[_0xeb34('0x27')](respondWithResult(_0x5de14b,null))[_0xeb34('0x4d')](handleError(_0x5de14b,null));}; \ No newline at end of file +var _0x32ef=['../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZohoConfiguration','fieldName','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','pick','type','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','sort','filter','getFields','hasOwnProperty','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x2fc360,_0x395e2f){var _0x278925=function(_0x39f144){while(--_0x39f144){_0x2fc360['push'](_0x2fc360['shift']());}};_0x278925(++_0x395e2f);}(_0x32ef,0x123));var _0xf32e=function(_0x554a78,_0x26286d){_0x554a78=_0x554a78-0x0;var _0x3a1465=_0x32ef[_0x554a78];return _0x3a1465;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf32e('0x0'));var zipdir=require(_0xf32e('0x1'));var jsonpatch=require(_0xf32e('0x2'));var rp=require(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var BPromise=require(_0xf32e('0x5'));var Mustache=require('mustache');var util=require(_0xf32e('0x6'));var path=require(_0xf32e('0x7'));var sox=require(_0xf32e('0x8'));var csv=require(_0xf32e('0x9'));var ejs=require(_0xf32e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf32e('0xb'));var jsforce=require(_0xf32e('0xc'));var deskjs=require(_0xf32e('0xd'));var toCsv=require(_0xf32e('0x9'));var querystring=require(_0xf32e('0xe'));var Papa=require(_0xf32e('0xf'));var Redis=require(_0xf32e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf32e('0x11'));var as=require(_0xf32e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf32e('0x13'));var utils=require(_0xf32e('0x14'));var config=require(_0xf32e('0x15'));var licenseUtil=require(_0xf32e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x75fde4,_0x57a555){_0x57a555=_0x57a555||0xcc;return function(_0xb31b2d){if(_0xb31b2d){return _0x75fde4[_0xf32e('0x17')](_0x57a555);}return _0x75fde4['status'](_0x57a555)[_0xf32e('0x18')]();};}function respondWithResult(_0x1e7379,_0x3d0353){_0x3d0353=_0x3d0353||0xc8;return function(_0x50ff47){if(_0x50ff47){return _0x1e7379['status'](_0x3d0353)[_0xf32e('0x19')](_0x50ff47);}};}function respondWithFilteredResult(_0xeb0e59,_0xb540a0){return function(_0x444907){if(_0x444907){var _0x5ed1fa=typeof _0xb540a0[_0xf32e('0x1a')]===_0xf32e('0x1b')&&typeof _0xb540a0[_0xf32e('0x1c')]===_0xf32e('0x1b');var _0x205f60=_0x444907['count'];var _0x3aece1=_0x5ed1fa?0x0:_0xb540a0[_0xf32e('0x1a')];var _0x4f3f6d=_0x5ed1fa?_0x444907[_0xf32e('0x1d')]:_0xb540a0['offset']+_0xb540a0[_0xf32e('0x1c')];var _0x3032ca;if(_0x4f3f6d>=_0x205f60){_0x4f3f6d=_0x205f60;_0x3032ca=0xc8;}else{_0x3032ca=0xce;}_0xeb0e59[_0xf32e('0x1e')](_0x3032ca);return _0xeb0e59[_0xf32e('0x1f')](_0xf32e('0x20'),_0x3aece1+'-'+_0x4f3f6d+'/'+_0x205f60)['json'](_0x444907);}return null;};}function patchUpdates(_0xdf540e){return function(_0x370ecf){try{jsonpatch[_0xf32e('0x21')](_0x370ecf,_0xdf540e,!![]);}catch(_0xbb56cf){return BPromise[_0xf32e('0x22')](_0xbb56cf);}return _0x370ecf[_0xf32e('0x23')]();};}function saveUpdates(_0x53d2e8,_0xa3982){return function(_0x1b05fe){if(_0x1b05fe){return _0x1b05fe[_0xf32e('0x24')](_0x53d2e8)['then'](function(_0x3c3bfa){return _0x3c3bfa;});}return null;};}function removeEntity(_0x2c31af,_0x4ce233){return function(_0x3db0dd){if(_0x3db0dd){return _0x3db0dd[_0xf32e('0x25')]()[_0xf32e('0x26')](function(){_0x2c31af['status'](0xcc)[_0xf32e('0x18')]();});}};}function handleEntityNotFound(_0x13f7e2,_0x3f361e){return function(_0x1ac745){if(!_0x1ac745){_0x13f7e2[_0xf32e('0x17')](0x194);}return _0x1ac745;};}function handleError(_0xcc74c9,_0x2836c4){_0x2836c4=_0x2836c4||0x1f4;return function(_0x5abc9a){logger[_0xf32e('0x27')](_0x5abc9a[_0xf32e('0x28')]);if(_0x5abc9a[_0xf32e('0x29')]){delete _0x5abc9a[_0xf32e('0x29')];}_0xcc74c9[_0xf32e('0x1e')](_0x2836c4)[_0xf32e('0x2a')](_0x5abc9a);};}exports['index']=function(_0x2423cb,_0x558cb4){var _0x3cf5cc={},_0x561bb5={},_0x3278c6={'count':0x0,'rows':[]};var _0x5ef5f9=_[_0xf32e('0x2b')](db[_0xf32e('0x2c')]['rawAttributes'],function(_0x1954e4){return{'name':_0x1954e4[_0xf32e('0x2d')],'type':_0x1954e4['type']['key']};});_0x561bb5['model']=_[_0xf32e('0x2b')](_0x5ef5f9,_0xf32e('0x29'));_0x561bb5[_0xf32e('0x2e')]=_[_0xf32e('0x2f')](_0x2423cb['query']);_0x561bb5[_0xf32e('0x30')]=_[_0xf32e('0x31')](_0x561bb5[_0xf32e('0x32')],_0x561bb5[_0xf32e('0x2e')]);_0x3cf5cc['attributes']=_[_0xf32e('0x31')](_0x561bb5['model'],qs['fields'](_0x2423cb[_0xf32e('0x2e')][_0xf32e('0x33')]));_0x3cf5cc['attributes']=_0x3cf5cc[_0xf32e('0x34')][_0xf32e('0x35')]?_0x3cf5cc[_0xf32e('0x34')]:_0x561bb5[_0xf32e('0x32')];if(!_0x2423cb[_0xf32e('0x2e')]['hasOwnProperty'](_0xf32e('0x36'))){_0x3cf5cc['limit']=qs['limit'](_0x2423cb[_0xf32e('0x2e')]['limit']);_0x3cf5cc[_0xf32e('0x1a')]=qs[_0xf32e('0x1a')](_0x2423cb[_0xf32e('0x2e')]['offset']);}_0x3cf5cc[_0xf32e('0x37')]=qs['sort'](_0x2423cb[_0xf32e('0x2e')]['sort']);_0x3cf5cc[_0xf32e('0x38')]=qs[_0xf32e('0x30')](_[_0xf32e('0x39')](_0x2423cb[_0xf32e('0x2e')],_0x561bb5[_0xf32e('0x30')]),_0x5ef5f9);if(_0x2423cb['query']['filter']){_0x3cf5cc[_0xf32e('0x38')]=_['merge'](_0x3cf5cc['where'],{'$or':_[_0xf32e('0x2b')](_0x5ef5f9,function(_0x5575b6){if(_0x5575b6[_0xf32e('0x3a')]!=='VIRTUAL'){var _0x464aea={};_0x464aea[_0x5575b6['name']]={'$like':'%'+_0x2423cb[_0xf32e('0x2e')]['filter']+'%'};return _0x464aea;}})});}_0x3cf5cc=_[_0xf32e('0x3b')]({},_0x3cf5cc,_0x2423cb[_0xf32e('0x3c')]);var _0x4fe18e={'where':_0x3cf5cc['where']};return db[_0xf32e('0x2c')][_0xf32e('0x1d')](_0x4fe18e)[_0xf32e('0x26')](function(_0x30a732){_0x3278c6[_0xf32e('0x1d')]=_0x30a732;if(_0x2423cb['query'][_0xf32e('0x3d')]){_0x3cf5cc[_0xf32e('0x3e')]=[{'all':!![]}];}return db[_0xf32e('0x2c')][_0xf32e('0x3f')](_0x3cf5cc);})[_0xf32e('0x26')](function(_0x1eb97e){_0x3278c6['rows']=_0x1eb97e;return _0x3278c6;})[_0xf32e('0x26')](respondWithFilteredResult(_0x558cb4,_0x3cf5cc))[_0xf32e('0x40')](handleError(_0x558cb4,null));};exports[_0xf32e('0x41')]=function(_0x1a64f2,_0x321679){var _0x100d05={'raw':![],'where':{'id':_0x1a64f2[_0xf32e('0x42')]['id']}},_0x49bd4d={};_0x49bd4d[_0xf32e('0x32')]=_[_0xf32e('0x2f')](db[_0xf32e('0x2c')][_0xf32e('0x43')]);_0x49bd4d[_0xf32e('0x2e')]=_['keys'](_0x1a64f2['query']);_0x49bd4d['filters']=_[_0xf32e('0x31')](_0x49bd4d[_0xf32e('0x32')],_0x49bd4d[_0xf32e('0x2e')]);_0x100d05[_0xf32e('0x34')]=_[_0xf32e('0x31')](_0x49bd4d[_0xf32e('0x32')],qs[_0xf32e('0x33')](_0x1a64f2['query']['fields']));_0x100d05[_0xf32e('0x34')]=_0x100d05['attributes'][_0xf32e('0x35')]?_0x100d05[_0xf32e('0x34')]:_0x49bd4d['model'];if(_0x1a64f2[_0xf32e('0x2e')][_0xf32e('0x3d')]){_0x100d05[_0xf32e('0x3e')]=[{'all':!![]}];}_0x100d05=_['merge']({},_0x100d05,_0x1a64f2['options']);return db[_0xf32e('0x2c')][_0xf32e('0x44')](_0x100d05)[_0xf32e('0x26')](handleEntityNotFound(_0x321679,null))[_0xf32e('0x26')](respondWithResult(_0x321679,null))[_0xf32e('0x40')](handleError(_0x321679,null));};exports[_0xf32e('0x45')]=function(_0x29ccb7,_0x16d64a){return db[_0xf32e('0x2c')][_0xf32e('0x45')](_0x29ccb7['body'],{})[_0xf32e('0x26')](respondWithResult(_0x16d64a,0xc9))[_0xf32e('0x40')](handleError(_0x16d64a,null));};exports[_0xf32e('0x24')]=function(_0x3fb482,_0x31aeed){if(_0x3fb482[_0xf32e('0x46')]['id']){delete _0x3fb482['body']['id'];}return db[_0xf32e('0x2c')]['find']({'where':{'id':_0x3fb482[_0xf32e('0x42')]['id']}})[_0xf32e('0x26')](handleEntityNotFound(_0x31aeed,null))['then'](saveUpdates(_0x3fb482[_0xf32e('0x46')],null))[_0xf32e('0x26')](respondWithResult(_0x31aeed,null))[_0xf32e('0x40')](handleError(_0x31aeed,null));};exports[_0xf32e('0x25')]=function(_0x5317a8,_0x449940){return db['ZohoConfiguration']['find']({'where':{'id':_0x5317a8[_0xf32e('0x42')]['id']}})[_0xf32e('0x26')](handleEntityNotFound(_0x449940,null))[_0xf32e('0x26')](removeEntity(_0x449940,null))[_0xf32e('0x40')](handleError(_0x449940,null));};exports['getFields']=function(_0xf1e1b5,_0x2b4697,_0x1980d5){var _0x5be9e4={};var _0x128717={};var _0x10881d;var _0x3a5902;return db[_0xf32e('0x2c')]['findOne']({'where':{'id':_0xf1e1b5['params']['id']}})[_0xf32e('0x26')](handleEntityNotFound(_0x2b4697,null))[_0xf32e('0x26')](function(_0xeaecfa){if(_0xeaecfa){_0x10881d=_0xeaecfa;_0x128717[_0xf32e('0x32')]=_[_0xf32e('0x2f')](db['ZohoField']['rawAttributes']);_0x128717[_0xf32e('0x2e')]=_[_0xf32e('0x2f')](_0xf1e1b5['query']);_0x128717[_0xf32e('0x30')]=_[_0xf32e('0x31')](_0x128717[_0xf32e('0x32')],_0x128717[_0xf32e('0x2e')]);_0x5be9e4[_0xf32e('0x34')]=_[_0xf32e('0x31')](_0x128717[_0xf32e('0x32')],qs[_0xf32e('0x33')](_0xf1e1b5[_0xf32e('0x2e')]['fields']));_0x5be9e4['attributes']=_0x5be9e4[_0xf32e('0x34')][_0xf32e('0x35')]?_0x5be9e4[_0xf32e('0x34')]:_0x128717['model'];_0x5be9e4[_0xf32e('0x37')]=qs[_0xf32e('0x47')](_0xf1e1b5[_0xf32e('0x2e')][_0xf32e('0x47')]);_0x5be9e4[_0xf32e('0x38')]=qs[_0xf32e('0x30')](_[_0xf32e('0x39')](_0xf1e1b5[_0xf32e('0x2e')],_0x128717['filters']));if(_0xf1e1b5['query'][_0xf32e('0x48')]){_0x5be9e4['where']=_[_0xf32e('0x3b')](_0x5be9e4[_0xf32e('0x38')],{'$or':_['map'](_0x5be9e4[_0xf32e('0x34')],function(_0x434106){var _0x4f52e4={};_0x4f52e4[_0x434106]={'$like':'%'+_0xf1e1b5[_0xf32e('0x2e')][_0xf32e('0x48')]+'%'};return _0x4f52e4;})});}_0x5be9e4=_['merge']({},_0x5be9e4,_0xf1e1b5[_0xf32e('0x3c')]);return _0x10881d[_0xf32e('0x49')](_0x5be9e4);}})['then'](function(_0x311546){if(_0x311546){_0x3a5902=_0x311546[_0xf32e('0x35')];if(!_0xf1e1b5[_0xf32e('0x2e')][_0xf32e('0x4a')](_0xf32e('0x36'))){_0x5be9e4[_0xf32e('0x1c')]=qs['limit'](_0xf1e1b5[_0xf32e('0x2e')]['limit']);_0x5be9e4[_0xf32e('0x1a')]=qs[_0xf32e('0x1a')](_0xf1e1b5[_0xf32e('0x2e')][_0xf32e('0x1a')]);}return _0x10881d[_0xf32e('0x49')](_0x5be9e4);}})[_0xf32e('0x26')](function(_0x3d02fb){if(_0x3d02fb){return _0x3d02fb?{'count':_0x3a5902,'rows':_0x3d02fb}:null;}})[_0xf32e('0x26')](respondWithResult(_0x2b4697,null))[_0xf32e('0x40')](handleError(_0x2b4697,null));};exports[_0xf32e('0x4b')]=function(_0x253714,_0x176a7c,_0x50c531){var _0x4ce509={};var _0x43b6f8={};var _0x2a27ef;var _0x48305d;return db[_0xf32e('0x2c')]['findOne']({'where':{'id':_0x253714[_0xf32e('0x42')]['id']}})[_0xf32e('0x26')](handleEntityNotFound(_0x176a7c,null))['then'](function(_0x43d4e5){if(_0x43d4e5){_0x2a27ef=_0x43d4e5;_0x43b6f8['model']=_[_0xf32e('0x2f')](db[_0xf32e('0x4c')][_0xf32e('0x43')]);_0x43b6f8[_0xf32e('0x2e')]=_[_0xf32e('0x2f')](_0x253714[_0xf32e('0x2e')]);_0x43b6f8[_0xf32e('0x30')]=_[_0xf32e('0x31')](_0x43b6f8[_0xf32e('0x32')],_0x43b6f8[_0xf32e('0x2e')]);_0x4ce509[_0xf32e('0x34')]=_[_0xf32e('0x31')](_0x43b6f8[_0xf32e('0x32')],qs['fields'](_0x253714[_0xf32e('0x2e')]['fields']));_0x4ce509['attributes']=_0x4ce509['attributes'][_0xf32e('0x35')]?_0x4ce509['attributes']:_0x43b6f8['model'];_0x4ce509['order']=qs['sort'](_0x253714[_0xf32e('0x2e')][_0xf32e('0x47')]);_0x4ce509['where']=qs[_0xf32e('0x30')](_[_0xf32e('0x39')](_0x253714[_0xf32e('0x2e')],_0x43b6f8['filters']));if(_0x253714[_0xf32e('0x2e')][_0xf32e('0x48')]){_0x4ce509[_0xf32e('0x38')]=_[_0xf32e('0x3b')](_0x4ce509[_0xf32e('0x38')],{'$or':_[_0xf32e('0x2b')](_0x4ce509[_0xf32e('0x34')],function(_0x20e985){var _0x31fb45={};_0x31fb45[_0x20e985]={'$like':'%'+_0x253714[_0xf32e('0x2e')][_0xf32e('0x48')]+'%'};return _0x31fb45;})});}_0x4ce509=_[_0xf32e('0x3b')]({},_0x4ce509,_0x253714[_0xf32e('0x3c')]);return _0x2a27ef[_0xf32e('0x4b')](_0x4ce509);}})['then'](function(_0x5f24ee){if(_0x5f24ee){_0x48305d=_0x5f24ee[_0xf32e('0x35')];if(!_0x253714['query'][_0xf32e('0x4a')](_0xf32e('0x36'))){_0x4ce509[_0xf32e('0x1c')]=qs[_0xf32e('0x1c')](_0x253714[_0xf32e('0x2e')][_0xf32e('0x1c')]);_0x4ce509[_0xf32e('0x1a')]=qs[_0xf32e('0x1a')](_0x253714[_0xf32e('0x2e')]['offset']);}return _0x2a27ef[_0xf32e('0x4b')](_0x4ce509);}})[_0xf32e('0x26')](function(_0x52fa44){if(_0x52fa44){return _0x52fa44?{'count':_0x48305d,'rows':_0x52fa44}:null;}})['then'](respondWithResult(_0x176a7c,null))[_0xf32e('0x40')](handleError(_0x176a7c,null));};exports[_0xf32e('0x4d')]=function(_0xd086a0,_0x5e6f31,_0x4822e1){var _0x186b0b={};var _0x1c2760={};var _0x2cd65b;var _0x43faa2;return db[_0xf32e('0x2c')]['findOne']({'where':{'id':_0xd086a0['params']['id']}})[_0xf32e('0x26')](handleEntityNotFound(_0x5e6f31,null))[_0xf32e('0x26')](function(_0x2a5323){if(_0x2a5323){_0x2cd65b=_0x2a5323;_0x1c2760[_0xf32e('0x32')]=_['keys'](db[_0xf32e('0x4c')][_0xf32e('0x43')]);_0x1c2760['query']=_[_0xf32e('0x2f')](_0xd086a0['query']);_0x1c2760[_0xf32e('0x30')]=_[_0xf32e('0x31')](_0x1c2760[_0xf32e('0x32')],_0x1c2760[_0xf32e('0x2e')]);_0x186b0b[_0xf32e('0x34')]=_[_0xf32e('0x31')](_0x1c2760[_0xf32e('0x32')],qs[_0xf32e('0x33')](_0xd086a0[_0xf32e('0x2e')][_0xf32e('0x33')]));_0x186b0b[_0xf32e('0x34')]=_0x186b0b[_0xf32e('0x34')][_0xf32e('0x35')]?_0x186b0b['attributes']:_0x1c2760[_0xf32e('0x32')];_0x186b0b['order']=qs[_0xf32e('0x47')](_0xd086a0[_0xf32e('0x2e')][_0xf32e('0x47')]);_0x186b0b['where']=qs[_0xf32e('0x30')](_[_0xf32e('0x39')](_0xd086a0[_0xf32e('0x2e')],_0x1c2760[_0xf32e('0x30')]));if(_0xd086a0[_0xf32e('0x2e')][_0xf32e('0x48')]){_0x186b0b[_0xf32e('0x38')]=_[_0xf32e('0x3b')](_0x186b0b['where'],{'$or':_['map'](_0x186b0b[_0xf32e('0x34')],function(_0x456ca8){var _0xe43809={};_0xe43809[_0x456ca8]={'$like':'%'+_0xd086a0['query'][_0xf32e('0x48')]+'%'};return _0xe43809;})});}_0x186b0b=_['merge']({},_0x186b0b,_0xd086a0[_0xf32e('0x3c')]);return _0x2cd65b[_0xf32e('0x4d')](_0x186b0b);}})[_0xf32e('0x26')](function(_0x9b551b){if(_0x9b551b){_0x43faa2=_0x9b551b['length'];if(!_0xd086a0[_0xf32e('0x2e')][_0xf32e('0x4a')](_0xf32e('0x36'))){_0x186b0b[_0xf32e('0x1c')]=qs[_0xf32e('0x1c')](_0xd086a0['query']['limit']);_0x186b0b[_0xf32e('0x1a')]=qs['offset'](_0xd086a0[_0xf32e('0x2e')][_0xf32e('0x1a')]);}return _0x2cd65b[_0xf32e('0x4d')](_0x186b0b);}})[_0xf32e('0x26')](function(_0x17333){if(_0x17333){return _0x17333?{'count':_0x43faa2,'rows':_0x17333}:null;}})[_0xf32e('0x26')](respondWithResult(_0x5e6f31,null))['catch'](handleError(_0x5e6f31,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 296e62b..487fa00 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 _0x33cb=['./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5d1c0a,_0x39b381){var _0x6ba1b=function(_0x2fcf00){while(--_0x2fcf00){_0x5d1c0a['push'](_0x5d1c0a['shift']());}};_0x6ba1b(++_0x39b381);}(_0x33cb,0xe0));var _0xb33c=function(_0x3101be,_0x372774){_0x3101be=_0x3101be-0x0;var _0xb76dec=_0x33cb[_0x3101be];return _0xb76dec;};'use strict';var _=require('lodash');var util=require(_0xb33c('0x0'));var logger=require(_0xb33c('0x1'))('api');var moment=require(_0xb33c('0x2'));var BPromise=require(_0xb33c('0x3'));var rp=require(_0xb33c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb33c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb33c('0x6'));module[_0xb33c('0x7')]=function(_0x27cf4c,_0x46ad58){return _0x27cf4c['define'](_0xb33c('0x8'),attributes,{'tableName':_0xb33c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7267=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api','bluebird','path'];(function(_0x558308,_0x5bd50e){var _0x329acc=function(_0x3661ca){while(--_0x3661ca){_0x558308['push'](_0x558308['shift']());}};_0x329acc(++_0x5bd50e);}(_0x7267,0x7f));var _0x7726=function(_0x34c27b,_0x27d429){_0x34c27b=_0x34c27b-0x0;var _0x56ef9d=_0x7267[_0x34c27b];return _0x56ef9d;};'use strict';var _=require(_0x7726('0x0'));var util=require(_0x7726('0x1'));var logger=require('../../config/logger')(_0x7726('0x2'));var moment=require('moment');var BPromise=require(_0x7726('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7726('0x4'));var rimraf=require(_0x7726('0x5'));var config=require(_0x7726('0x6'));var attributes=require(_0x7726('0x7'));module[_0x7726('0x8')]=function(_0x308416,_0x2d523d){return _0x308416[_0x7726('0x9')](_0x7726('0xa'),attributes,{'tableName':_0x7726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 839d855..3363c71 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 _0x6a9f=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x12cbc7,_0x4044c7){var _0x1594e7=function(_0x1ae416){while(--_0x1ae416){_0x12cbc7['push'](_0x12cbc7['shift']());}};_0x1594e7(++_0x4044c7);}(_0x6a9f,0x68));var _0xf6a9=function(_0x5668ef,_0xe2756){_0x5668ef=_0x5668ef-0x0;var _0x440958=_0x6a9f[_0x5668ef];return _0x440958;};'use strict';var _=require(_0xf6a9('0x0'));var util=require(_0xf6a9('0x1'));var moment=require(_0xf6a9('0x2'));var BPromise=require(_0xf6a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6a9('0x4'));var db=require(_0xf6a9('0x5'))['db'];var utils=require(_0xf6a9('0x6'));var logger=require(_0xf6a9('0x7'))('rpc');var config=require(_0xf6a9('0x8'));var jayson=require(_0xf6a9('0x9'));var client=jayson[_0xf6a9('0xa')][_0xf6a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40dea5,_0x2e2cd8,_0x25a5ab){return new BPromise(function(_0x18fffc,_0x58f2a6){return client[_0xf6a9('0xc')](_0x40dea5,_0x25a5ab)[_0xf6a9('0xd')](function(_0x23a404){logger[_0xf6a9('0xe')](_0xf6a9('0xf'),_0x2e2cd8,_0xf6a9('0x10'));logger[_0xf6a9('0x11')](_0xf6a9('0x12'),_0x2e2cd8,_0xf6a9('0x10'),JSON['stringify'](_0x23a404));if(_0x23a404[_0xf6a9('0x13')]){if(_0x23a404[_0xf6a9('0x13')][_0xf6a9('0x14')]===0x1f4){logger['error'](_0xf6a9('0xf'),_0x2e2cd8,_0x23a404['error']['message']);return _0x58f2a6(_0x23a404[_0xf6a9('0x13')][_0xf6a9('0x15')]);}logger[_0xf6a9('0x13')](_0xf6a9('0xf'),_0x2e2cd8,_0x23a404[_0xf6a9('0x13')]['message']);return _0x18fffc(_0x23a404[_0xf6a9('0x13')][_0xf6a9('0x15')]);}else{logger['info'](_0xf6a9('0xf'),_0x2e2cd8,_0xf6a9('0x10'));_0x18fffc(_0x23a404['result']['message']);}})['catch'](function(_0x1f1ce1){logger[_0xf6a9('0x13')](_0xf6a9('0xf'),_0x2e2cd8,_0x1f1ce1);_0x58f2a6(_0x1f1ce1);});});} \ No newline at end of file +var _0xfef9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x109db8,_0xf0e481){var _0x3448f7=function(_0x50938d){while(--_0x50938d){_0x109db8['push'](_0x109db8['shift']());}};_0x3448f7(++_0xf0e481);}(_0xfef9,0x17b));var _0x9fef=function(_0x18b2a3,_0x2a639b){_0x18b2a3=_0x18b2a3-0x0;var _0x50659f=_0xfef9[_0x18b2a3];return _0x50659f;};'use strict';var _=require(_0x9fef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9fef('0x1'));var rs=require(_0x9fef('0x2'));var fs=require('fs');var Redis=require(_0x9fef('0x3'));var db=require(_0x9fef('0x4'))['db'];var utils=require(_0x9fef('0x5'));var logger=require(_0x9fef('0x6'))('rpc');var config=require(_0x9fef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9fef('0x8')][_0x9fef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48f759,_0x1e41d3,_0x32bbac){return new BPromise(function(_0x1896a6,_0x4051b4){return client['request'](_0x48f759,_0x32bbac)[_0x9fef('0xa')](function(_0x10342e){logger[_0x9fef('0xb')](_0x9fef('0xc'),_0x1e41d3,_0x9fef('0xd'));logger[_0x9fef('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1e41d3,_0x9fef('0xd'),JSON[_0x9fef('0xf')](_0x10342e));if(_0x10342e[_0x9fef('0x10')]){if(_0x10342e[_0x9fef('0x10')][_0x9fef('0x11')]===0x1f4){logger['error'](_0x9fef('0xc'),_0x1e41d3,_0x10342e[_0x9fef('0x10')][_0x9fef('0x12')]);return _0x4051b4(_0x10342e[_0x9fef('0x10')][_0x9fef('0x12')]);}logger[_0x9fef('0x10')](_0x9fef('0xc'),_0x1e41d3,_0x10342e[_0x9fef('0x10')][_0x9fef('0x12')]);return _0x1896a6(_0x10342e['error'][_0x9fef('0x12')]);}else{logger[_0x9fef('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x1e41d3,_0x9fef('0xd'));_0x1896a6(_0x10342e[_0x9fef('0x13')]['message']);}})['catch'](function(_0x24c166){logger[_0x9fef('0x10')](_0x9fef('0xc'),_0x1e41d3,_0x24c166);_0x4051b4(_0x24c166);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index ac338ff..6aa53d4 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 _0x3bce=['/:id','show','post','create','update','isAuthenticated','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x5f046c,_0x53eb88){var _0x568032=function(_0x5aec71){while(--_0x5aec71){_0x5f046c['push'](_0x5f046c['shift']());}};_0x568032(++_0x53eb88);}(_0x3bce,0xe7));var _0xe3bc=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3bce[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xe3bc('0x0'));var util=require('util');var path=require(_0xe3bc('0x1'));var timeout=require(_0xe3bc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe3bc('0x3'));var auth=require(_0xe3bc('0x4'));var interaction=require(_0xe3bc('0x5'));var config=require(_0xe3bc('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe3bc('0x7')]);router[_0xe3bc('0x8')](_0xe3bc('0x9'),auth['isAuthenticated'](),controller[_0xe3bc('0xa')]);router[_0xe3bc('0xb')]('/',auth['isAuthenticated'](),controller[_0xe3bc('0xc')]);router['put'](_0xe3bc('0x9'),auth['isAuthenticated'](),controller[_0xe3bc('0xd')]);router['delete']('/:id',auth[_0xe3bc('0xe')](),controller[_0xe3bc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5d51=['path','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','multer','util'];(function(_0x3ce937,_0x568d7d){var _0x41d2fa=function(_0x19a409){while(--_0x19a409){_0x3ce937['push'](_0x3ce937['shift']());}};_0x41d2fa(++_0x568d7d);}(_0x5d51,0x17e));var _0x15d5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5d51[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x15d5('0x0'));var util=require(_0x15d5('0x1'));var path=require(_0x15d5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x15d5('0x3'));var auth=require(_0x15d5('0x4'));var interaction=require(_0x15d5('0x5'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x15d5('0x6')]('/',auth[_0x15d5('0x7')](),controller[_0x15d5('0x8')]);router[_0x15d5('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x15d5('0x9')]);router[_0x15d5('0xa')]('/',auth[_0x15d5('0x7')](),controller['create']);router[_0x15d5('0xb')](_0x15d5('0xc'),auth[_0x15d5('0x7')](),controller['update']);router[_0x15d5('0xd')](_0x15d5('0xc'),auth[_0x15d5('0x7')](),controller[_0x15d5('0xe')]);module[_0x15d5('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 66e12c7..4313534 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 _0x5998=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x509b65,_0x5e5c89){var _0x4af21d=function(_0x5ba08b){while(--_0x5ba08b){_0x509b65['push'](_0x509b65['shift']());}};_0x4af21d(++_0x5e5c89);}(_0x5998,0x1b9));var _0x8599=function(_0x3ccb44,_0x49574f){_0x3ccb44=_0x3ccb44-0x0;var _0x35e22f=_0x5998[_0x3ccb44];return _0x35e22f;};'use strict';var Sequelize=require(_0x8599('0x0'));module[_0x8599('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8599('0x2'),_0x8599('0x3'),_0x8599('0x4'),_0x8599('0x5'),_0x8599('0x6')),'defaultValue':_0x8599('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8599('0x7')]},'keyType':{'type':Sequelize[_0x8599('0x8')](_0x8599('0x2'),'variable',_0x8599('0x4'))},'keyContent':{'type':Sequelize[_0x8599('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8599('0x7')]},'customField':{'type':Sequelize[_0x8599('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8599('0x7')]}}; \ No newline at end of file +var _0x4781=['sequelize','exports','ENUM','variable','customVariable','picklist','string','STRING'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x4781,0x188));var _0x1478=function(_0x11ed21,_0x5e9ea5){_0x11ed21=_0x11ed21-0x0;var _0x499a1c=_0x4781[_0x11ed21];return _0x499a1c;};'use strict';var Sequelize=require(_0x1478('0x0'));module[_0x1478('0x1')]={'type':{'type':Sequelize[_0x1478('0x2')]('string',_0x1478('0x3'),_0x1478('0x4'),'keyValue',_0x1478('0x5')),'defaultValue':_0x1478('0x6')},'content':{'type':Sequelize[_0x1478('0x7')]},'key':{'type':Sequelize[_0x1478('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1478('0x7')]},'idField':{'type':Sequelize[_0x1478('0x7')]},'nameField':{'type':Sequelize[_0x1478('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1478('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4f872f6..659820c 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 _0x8398=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','params','ZohoField','find','create','body','eml-format','rimraf'];(function(_0x472e59,_0x4dcf0d){var _0x5f8503=function(_0x240385){while(--_0x240385){_0x472e59['push'](_0x472e59['shift']());}};_0x5f8503(++_0x4dcf0d);}(_0x8398,0x170));var _0x8839=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x8398[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0x8839('0x0'));var rimraf=require(_0x8839('0x1'));var zipdir=require(_0x8839('0x2'));var jsonpatch=require(_0x8839('0x3'));var rp=require(_0x8839('0x4'));var moment=require('moment');var BPromise=require(_0x8839('0x5'));var Mustache=require(_0x8839('0x6'));var util=require(_0x8839('0x7'));var path=require(_0x8839('0x8'));var sox=require(_0x8839('0x9'));var csv=require(_0x8839('0xa'));var ejs=require(_0x8839('0xb'));var fs=require('fs');var fs_extra=require(_0x8839('0xc'));var _=require('lodash');var squel=require(_0x8839('0xd'));var crypto=require(_0x8839('0xe'));var jsforce=require(_0x8839('0xf'));var deskjs=require(_0x8839('0x10'));var toCsv=require(_0x8839('0xa'));var querystring=require(_0x8839('0x11'));var Papa=require('papaparse');var Redis=require(_0x8839('0x12'));var authService=require(_0x8839('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8839('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8839('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8839('0x16'));var licenseUtil=require(_0x8839('0x17'));var db=require(_0x8839('0x18'))['db'];function respondWithStatusCode(_0x5691aa,_0x369ce4){_0x369ce4=_0x369ce4||0xcc;return function(_0x51bc22){if(_0x51bc22){return _0x5691aa['sendStatus'](_0x369ce4);}return _0x5691aa[_0x8839('0x19')](_0x369ce4)[_0x8839('0x1a')]();};}function respondWithResult(_0x44be23,_0x20cc9d){_0x20cc9d=_0x20cc9d||0xc8;return function(_0x2b76e7){if(_0x2b76e7){return _0x44be23['status'](_0x20cc9d)[_0x8839('0x1b')](_0x2b76e7);}};}function respondWithFilteredResult(_0x2b2594,_0x121e78){return function(_0x50d373){if(_0x50d373){var _0x61bf92=typeof _0x121e78['offset']===_0x8839('0x1c')&&typeof _0x121e78['limit']===_0x8839('0x1c');var _0x1121e2=_0x50d373[_0x8839('0x1d')];var _0x33efd3=_0x61bf92?0x0:_0x121e78[_0x8839('0x1e')];var _0x3a5be9=_0x61bf92?_0x50d373[_0x8839('0x1d')]:_0x121e78['offset']+_0x121e78[_0x8839('0x1f')];var _0x3c7d6e;if(_0x3a5be9>=_0x1121e2){_0x3a5be9=_0x1121e2;_0x3c7d6e=0xc8;}else{_0x3c7d6e=0xce;}_0x2b2594[_0x8839('0x19')](_0x3c7d6e);return _0x2b2594[_0x8839('0x20')](_0x8839('0x21'),_0x33efd3+'-'+_0x3a5be9+'/'+_0x1121e2)[_0x8839('0x1b')](_0x50d373);}return null;};}function patchUpdates(_0x4a0db6){return function(_0x334656){try{jsonpatch[_0x8839('0x22')](_0x334656,_0x4a0db6,!![]);}catch(_0x3c3907){return BPromise[_0x8839('0x23')](_0x3c3907);}return _0x334656[_0x8839('0x24')]();};}function saveUpdates(_0x36c058,_0x3f8341){return function(_0x261356){if(_0x261356){return _0x261356[_0x8839('0x25')](_0x36c058)['then'](function(_0x44713c){return _0x44713c;});}return null;};}function removeEntity(_0x1a4633,_0x239e4a){return function(_0x19d1b2){if(_0x19d1b2){return _0x19d1b2[_0x8839('0x26')]()[_0x8839('0x27')](function(){_0x1a4633['status'](0xcc)[_0x8839('0x1a')]();});}};}function handleEntityNotFound(_0x245da3,_0x37741c){return function(_0x164291){if(!_0x164291){_0x245da3[_0x8839('0x28')](0x194);}return _0x164291;};}function handleError(_0x43a597,_0x1d3fad){_0x1d3fad=_0x1d3fad||0x1f4;return function(_0x504f67){logger[_0x8839('0x29')](_0x504f67[_0x8839('0x2a')]);if(_0x504f67[_0x8839('0x2b')]){delete _0x504f67[_0x8839('0x2b')];}_0x43a597[_0x8839('0x19')](_0x1d3fad)[_0x8839('0x2c')](_0x504f67);};}exports['index']=function(_0x181230,_0x37aa64){var _0xd78a5a={},_0x5a520b={},_0x53f855={'count':0x0,'rows':[]};var _0x1be1da=_['map'](db['ZohoField'][_0x8839('0x2d')],function(_0x292da6){return{'name':_0x292da6['fieldName'],'type':_0x292da6['type'][_0x8839('0x2e')]};});_0x5a520b[_0x8839('0x2f')]=_[_0x8839('0x30')](_0x1be1da,'name');_0x5a520b[_0x8839('0x31')]=_[_0x8839('0x32')](_0x181230[_0x8839('0x31')]);_0x5a520b[_0x8839('0x33')]=_['intersection'](_0x5a520b['model'],_0x5a520b[_0x8839('0x31')]);_0xd78a5a[_0x8839('0x34')]=_[_0x8839('0x35')](_0x5a520b[_0x8839('0x2f')],qs[_0x8839('0x36')](_0x181230['query'][_0x8839('0x36')]));_0xd78a5a[_0x8839('0x34')]=_0xd78a5a[_0x8839('0x34')][_0x8839('0x37')]?_0xd78a5a[_0x8839('0x34')]:_0x5a520b[_0x8839('0x2f')];if(!_0x181230['query'][_0x8839('0x38')]('nolimit')){_0xd78a5a['limit']=qs[_0x8839('0x1f')](_0x181230['query'][_0x8839('0x1f')]);_0xd78a5a[_0x8839('0x1e')]=qs['offset'](_0x181230[_0x8839('0x31')][_0x8839('0x1e')]);}_0xd78a5a['order']=qs[_0x8839('0x39')](_0x181230[_0x8839('0x31')][_0x8839('0x39')]);_0xd78a5a['where']=qs[_0x8839('0x33')](_[_0x8839('0x3a')](_0x181230[_0x8839('0x31')],_0x5a520b[_0x8839('0x33')]),_0x1be1da);if(_0x181230[_0x8839('0x31')][_0x8839('0x3b')]){_0xd78a5a['where']=_[_0x8839('0x3c')](_0xd78a5a[_0x8839('0x3d')],{'$or':_[_0x8839('0x30')](_0x1be1da,function(_0x3853df){if(_0x3853df[_0x8839('0x3e')]!==_0x8839('0x3f')){var _0x1fa516={};_0x1fa516[_0x3853df['name']]={'$like':'%'+_0x181230[_0x8839('0x31')][_0x8839('0x3b')]+'%'};return _0x1fa516;}})});}_0xd78a5a=_['merge']({},_0xd78a5a,_0x181230[_0x8839('0x40')]);var _0x3380fa={'where':_0xd78a5a[_0x8839('0x3d')]};return db['ZohoField'][_0x8839('0x1d')](_0x3380fa)[_0x8839('0x27')](function(_0x48e3be){_0x53f855[_0x8839('0x1d')]=_0x48e3be;if(_0x181230[_0x8839('0x31')][_0x8839('0x41')]){_0xd78a5a[_0x8839('0x42')]=[{'all':!![]}];}return db['ZohoField'][_0x8839('0x43')](_0xd78a5a);})['then'](function(_0x575682){_0x53f855['rows']=_0x575682;return _0x53f855;})['then'](respondWithFilteredResult(_0x37aa64,_0xd78a5a))[_0x8839('0x44')](handleError(_0x37aa64,null));};exports['show']=function(_0x382546,_0x188126){var _0x22df3d={'raw':!![],'where':{'id':_0x382546[_0x8839('0x45')]['id']}},_0xb6be1b={};_0xb6be1b[_0x8839('0x2f')]=_[_0x8839('0x32')](db['ZohoField'][_0x8839('0x2d')]);_0xb6be1b['query']=_[_0x8839('0x32')](_0x382546['query']);_0xb6be1b[_0x8839('0x33')]=_['intersection'](_0xb6be1b[_0x8839('0x2f')],_0xb6be1b[_0x8839('0x31')]);_0x22df3d['attributes']=_[_0x8839('0x35')](_0xb6be1b['model'],qs[_0x8839('0x36')](_0x382546[_0x8839('0x31')][_0x8839('0x36')]));_0x22df3d[_0x8839('0x34')]=_0x22df3d[_0x8839('0x34')][_0x8839('0x37')]?_0x22df3d[_0x8839('0x34')]:_0xb6be1b[_0x8839('0x2f')];if(_0x382546[_0x8839('0x31')][_0x8839('0x41')]){_0x22df3d['include']=[{'all':!![]}];}_0x22df3d=_[_0x8839('0x3c')]({},_0x22df3d,_0x382546[_0x8839('0x40')]);return db[_0x8839('0x46')][_0x8839('0x47')](_0x22df3d)['then'](handleEntityNotFound(_0x188126,null))['then'](respondWithResult(_0x188126,null))[_0x8839('0x44')](handleError(_0x188126,null));};exports[_0x8839('0x48')]=function(_0x5ca0ec,_0x54287f){return db[_0x8839('0x46')][_0x8839('0x48')](_0x5ca0ec[_0x8839('0x49')],{})[_0x8839('0x27')](respondWithResult(_0x54287f,0xc9))[_0x8839('0x44')](handleError(_0x54287f,null));};exports[_0x8839('0x25')]=function(_0x53eea6,_0x3aced2){if(_0x53eea6[_0x8839('0x49')]['id']){delete _0x53eea6['body']['id'];}return db[_0x8839('0x46')][_0x8839('0x47')]({'where':{'id':_0x53eea6[_0x8839('0x45')]['id']}})[_0x8839('0x27')](handleEntityNotFound(_0x3aced2,null))[_0x8839('0x27')](saveUpdates(_0x53eea6['body'],null))[_0x8839('0x27')](respondWithResult(_0x3aced2,null))[_0x8839('0x44')](handleError(_0x3aced2,null));};exports[_0x8839('0x26')]=function(_0xc81607,_0x23e0bd){return db[_0x8839('0x46')][_0x8839('0x47')]({'where':{'id':_0xc81607[_0x8839('0x45')]['id']}})[_0x8839('0x27')](handleEntityNotFound(_0x23e0bd,null))[_0x8839('0x27')](removeEntity(_0x23e0bd,null))[_0x8839('0x44')](handleError(_0x23e0bd,null));}; \ No newline at end of file +var _0x398a=['findAll','rows','catch','find','create','body','destroy','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll'];(function(_0x18b8b0,_0x162392){var _0x34fb6d=function(_0x4dd491){while(--_0x4dd491){_0x18b8b0['push'](_0x18b8b0['shift']());}};_0x34fb6d(++_0x162392);}(_0x398a,0xe0));var _0xa398=function(_0x1e869d,_0x2f64bc){_0x1e869d=_0x1e869d-0x0;var _0x5b9ffe=_0x398a[_0x1e869d];return _0x5b9ffe;};'use strict';var emlformat=require(_0xa398('0x0'));var rimraf=require(_0xa398('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa398('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa398('0x3'));var Mustache=require(_0xa398('0x4'));var util=require(_0xa398('0x5'));var path=require(_0xa398('0x6'));var sox=require(_0xa398('0x7'));var csv=require('to-csv');var ejs=require(_0xa398('0x8'));var fs=require('fs');var fs_extra=require(_0xa398('0x9'));var _=require(_0xa398('0xa'));var squel=require(_0xa398('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa398('0xc'));var toCsv=require(_0xa398('0xd'));var querystring=require(_0xa398('0xe'));var Papa=require(_0xa398('0xf'));var Redis=require(_0xa398('0x10'));var authService=require(_0xa398('0x11'));var qs=require(_0xa398('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa398('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa398('0x14'));var licenseUtil=require(_0xa398('0x15'));var db=require(_0xa398('0x16'))['db'];function respondWithStatusCode(_0x58141c,_0x3dca2a){_0x3dca2a=_0x3dca2a||0xcc;return function(_0x43b87a){if(_0x43b87a){return _0x58141c['sendStatus'](_0x3dca2a);}return _0x58141c[_0xa398('0x17')](_0x3dca2a)[_0xa398('0x18')]();};}function respondWithResult(_0x50a055,_0x31edaf){_0x31edaf=_0x31edaf||0xc8;return function(_0xa9b1b9){if(_0xa9b1b9){return _0x50a055[_0xa398('0x17')](_0x31edaf)[_0xa398('0x19')](_0xa9b1b9);}};}function respondWithFilteredResult(_0x26e400,_0x2d4f48){return function(_0x45ad8f){if(_0x45ad8f){var _0x3823a4=typeof _0x2d4f48[_0xa398('0x1a')]===_0xa398('0x1b')&&typeof _0x2d4f48[_0xa398('0x1c')]==='undefined';var _0x3ec948=_0x45ad8f[_0xa398('0x1d')];var _0x1d0030=_0x3823a4?0x0:_0x2d4f48[_0xa398('0x1a')];var _0x1bcd80=_0x3823a4?_0x45ad8f['count']:_0x2d4f48[_0xa398('0x1a')]+_0x2d4f48[_0xa398('0x1c')];var _0x2d3f4a;if(_0x1bcd80>=_0x3ec948){_0x1bcd80=_0x3ec948;_0x2d3f4a=0xc8;}else{_0x2d3f4a=0xce;}_0x26e400['status'](_0x2d3f4a);return _0x26e400[_0xa398('0x1e')](_0xa398('0x1f'),_0x1d0030+'-'+_0x1bcd80+'/'+_0x3ec948)[_0xa398('0x19')](_0x45ad8f);}return null;};}function patchUpdates(_0x1a7330){return function(_0x34a651){try{jsonpatch['apply'](_0x34a651,_0x1a7330,!![]);}catch(_0x2925b6){return BPromise[_0xa398('0x20')](_0x2925b6);}return _0x34a651['save']();};}function saveUpdates(_0x58722d,_0x4a264a){return function(_0x26055c){if(_0x26055c){return _0x26055c[_0xa398('0x21')](_0x58722d)[_0xa398('0x22')](function(_0x117db9){return _0x117db9;});}return null;};}function removeEntity(_0x371b5b,_0x60ef9c){return function(_0x46ea32){if(_0x46ea32){return _0x46ea32['destroy']()[_0xa398('0x22')](function(){_0x371b5b[_0xa398('0x17')](0xcc)[_0xa398('0x18')]();});}};}function handleEntityNotFound(_0x1ac09d,_0x2ade1b){return function(_0x29175b){if(!_0x29175b){_0x1ac09d[_0xa398('0x23')](0x194);}return _0x29175b;};}function handleError(_0x3c402f,_0x49d2e7){_0x49d2e7=_0x49d2e7||0x1f4;return function(_0x124d17){logger[_0xa398('0x24')](_0x124d17[_0xa398('0x25')]);if(_0x124d17[_0xa398('0x26')]){delete _0x124d17[_0xa398('0x26')];}_0x3c402f[_0xa398('0x17')](_0x49d2e7)[_0xa398('0x27')](_0x124d17);};}exports[_0xa398('0x28')]=function(_0x513e9e,_0x32e247){var _0x3b73a3={},_0x4897fd={},_0x2b6e00={'count':0x0,'rows':[]};var _0x3bae3f=_['map'](db[_0xa398('0x29')][_0xa398('0x2a')],function(_0x5553fe){return{'name':_0x5553fe[_0xa398('0x2b')],'type':_0x5553fe[_0xa398('0x2c')][_0xa398('0x2d')]};});_0x4897fd[_0xa398('0x2e')]=_[_0xa398('0x2f')](_0x3bae3f,_0xa398('0x26'));_0x4897fd['query']=_[_0xa398('0x30')](_0x513e9e[_0xa398('0x31')]);_0x4897fd[_0xa398('0x32')]=_[_0xa398('0x33')](_0x4897fd[_0xa398('0x2e')],_0x4897fd[_0xa398('0x31')]);_0x3b73a3[_0xa398('0x34')]=_[_0xa398('0x33')](_0x4897fd[_0xa398('0x2e')],qs[_0xa398('0x35')](_0x513e9e[_0xa398('0x31')]['fields']));_0x3b73a3[_0xa398('0x34')]=_0x3b73a3[_0xa398('0x34')][_0xa398('0x36')]?_0x3b73a3[_0xa398('0x34')]:_0x4897fd['model'];if(!_0x513e9e[_0xa398('0x31')][_0xa398('0x37')](_0xa398('0x38'))){_0x3b73a3[_0xa398('0x1c')]=qs[_0xa398('0x1c')](_0x513e9e['query']['limit']);_0x3b73a3[_0xa398('0x1a')]=qs['offset'](_0x513e9e[_0xa398('0x31')][_0xa398('0x1a')]);}_0x3b73a3['order']=qs[_0xa398('0x39')](_0x513e9e[_0xa398('0x31')][_0xa398('0x39')]);_0x3b73a3[_0xa398('0x3a')]=qs[_0xa398('0x32')](_[_0xa398('0x3b')](_0x513e9e[_0xa398('0x31')],_0x4897fd['filters']),_0x3bae3f);if(_0x513e9e[_0xa398('0x31')][_0xa398('0x3c')]){_0x3b73a3[_0xa398('0x3a')]=_[_0xa398('0x3d')](_0x3b73a3[_0xa398('0x3a')],{'$or':_[_0xa398('0x2f')](_0x3bae3f,function(_0x45a94a){if(_0x45a94a[_0xa398('0x2c')]!=='VIRTUAL'){var _0xdf3812={};_0xdf3812[_0x45a94a[_0xa398('0x26')]]={'$like':'%'+_0x513e9e[_0xa398('0x31')][_0xa398('0x3c')]+'%'};return _0xdf3812;}})});}_0x3b73a3=_[_0xa398('0x3d')]({},_0x3b73a3,_0x513e9e[_0xa398('0x3e')]);var _0xe8052={'where':_0x3b73a3[_0xa398('0x3a')]};return db[_0xa398('0x29')][_0xa398('0x1d')](_0xe8052)[_0xa398('0x22')](function(_0x5aa6f2){_0x2b6e00[_0xa398('0x1d')]=_0x5aa6f2;if(_0x513e9e[_0xa398('0x31')][_0xa398('0x3f')]){_0x3b73a3['include']=[{'all':!![]}];}return db[_0xa398('0x29')][_0xa398('0x40')](_0x3b73a3);})[_0xa398('0x22')](function(_0x463de6){_0x2b6e00[_0xa398('0x41')]=_0x463de6;return _0x2b6e00;})[_0xa398('0x22')](respondWithFilteredResult(_0x32e247,_0x3b73a3))[_0xa398('0x42')](handleError(_0x32e247,null));};exports['show']=function(_0x835d48,_0x5a8c33){var _0x511b72={'raw':!![],'where':{'id':_0x835d48['params']['id']}},_0x5f0913={};_0x5f0913[_0xa398('0x2e')]=_[_0xa398('0x30')](db[_0xa398('0x29')][_0xa398('0x2a')]);_0x5f0913[_0xa398('0x31')]=_[_0xa398('0x30')](_0x835d48[_0xa398('0x31')]);_0x5f0913['filters']=_[_0xa398('0x33')](_0x5f0913[_0xa398('0x2e')],_0x5f0913['query']);_0x511b72[_0xa398('0x34')]=_[_0xa398('0x33')](_0x5f0913[_0xa398('0x2e')],qs['fields'](_0x835d48[_0xa398('0x31')][_0xa398('0x35')]));_0x511b72['attributes']=_0x511b72[_0xa398('0x34')][_0xa398('0x36')]?_0x511b72[_0xa398('0x34')]:_0x5f0913[_0xa398('0x2e')];if(_0x835d48['query'][_0xa398('0x3f')]){_0x511b72['include']=[{'all':!![]}];}_0x511b72=_['merge']({},_0x511b72,_0x835d48[_0xa398('0x3e')]);return db[_0xa398('0x29')][_0xa398('0x43')](_0x511b72)[_0xa398('0x22')](handleEntityNotFound(_0x5a8c33,null))[_0xa398('0x22')](respondWithResult(_0x5a8c33,null))[_0xa398('0x42')](handleError(_0x5a8c33,null));};exports[_0xa398('0x44')]=function(_0x5549dc,_0x3ad5d4){return db[_0xa398('0x29')][_0xa398('0x44')](_0x5549dc['body'],{})[_0xa398('0x22')](respondWithResult(_0x3ad5d4,0xc9))[_0xa398('0x42')](handleError(_0x3ad5d4,null));};exports['update']=function(_0x199b90,_0x544be9){if(_0x199b90['body']['id']){delete _0x199b90[_0xa398('0x45')]['id'];}return db[_0xa398('0x29')][_0xa398('0x43')]({'where':{'id':_0x199b90['params']['id']}})[_0xa398('0x22')](handleEntityNotFound(_0x544be9,null))[_0xa398('0x22')](saveUpdates(_0x199b90['body'],null))[_0xa398('0x22')](respondWithResult(_0x544be9,null))[_0xa398('0x42')](handleError(_0x544be9,null));};exports[_0xa398('0x46')]=function(_0x4111be,_0xfafd3d){return db[_0xa398('0x29')]['find']({'where':{'id':_0x4111be[_0xa398('0x47')]['id']}})[_0xa398('0x22')](handleEntityNotFound(_0xfafd3d,null))[_0xa398('0x22')](removeEntity(_0xfafd3d,null))[_0xa398('0x42')](handleError(_0xfafd3d,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1f3b44c..0ece4a4 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 _0x32f4=['int_zoho_fields','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x41afa3,_0x579cb6){var _0x447004=function(_0x598d96){while(--_0x598d96){_0x41afa3['push'](_0x41afa3['shift']());}};_0x447004(++_0x579cb6);}(_0x32f4,0x154));var _0x432f=function(_0x3d09b0,_0x466d6a){_0x3d09b0=_0x3d09b0-0x0;var _0x95e533=_0x32f4[_0x3d09b0];return _0x95e533;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x432f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId'];(function(_0x328a92,_0x412fdf){var _0x230e79=function(_0x25fc90){while(--_0x25fc90){_0x328a92['push'](_0x328a92['shift']());}};_0x230e79(++_0x412fdf);}(_0x5fab,0x177));var _0xb5fa=function(_0x4a2689,_0x314a16){_0x4a2689=_0x4a2689-0x0;var _0x463450=_0x5fab[_0x4a2689];return _0x463450;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['idField',_0xb5fa('0xe')],'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 57b371c..30b5c3b 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 _0x82bf=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x458d31,_0x450fbd){var _0xbd7f62=function(_0x59a7c7){while(--_0x59a7c7){_0x458d31['push'](_0x458d31['shift']());}};_0xbd7f62(++_0x450fbd);}(_0x82bf,0x16d));var _0xf82b=function(_0x48666f,_0x25348a){_0x48666f=_0x48666f-0x0;var _0xcfad48=_0x82bf[_0x48666f];return _0xcfad48;};'use strict';var _=require(_0xf82b('0x0'));var util=require(_0xf82b('0x1'));var moment=require('moment');var BPromise=require(_0xf82b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf82b('0x3'));var db=require(_0xf82b('0x4'))['db'];var utils=require(_0xf82b('0x5'));var logger=require(_0xf82b('0x6'))(_0xf82b('0x7'));var config=require(_0xf82b('0x8'));var jayson=require(_0xf82b('0x9'));var client=jayson[_0xf82b('0xa')][_0xf82b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f38b7,_0x5c9c54,_0x366be2){return new BPromise(function(_0x3c1db3,_0x2b7b64){return client['request'](_0x2f38b7,_0x366be2)[_0xf82b('0xc')](function(_0x259cf0){logger[_0xf82b('0xd')](_0xf82b('0xe'),_0x5c9c54,_0xf82b('0xf'));logger[_0xf82b('0x10')](_0xf82b('0x11'),_0x5c9c54,_0xf82b('0xf'),JSON['stringify'](_0x259cf0));if(_0x259cf0[_0xf82b('0x12')]){if(_0x259cf0[_0xf82b('0x12')]['code']===0x1f4){logger[_0xf82b('0x12')](_0xf82b('0xe'),_0x5c9c54,_0x259cf0[_0xf82b('0x12')][_0xf82b('0x13')]);return _0x2b7b64(_0x259cf0[_0xf82b('0x12')]['message']);}logger[_0xf82b('0x12')]('ZohoField,\x20%s,\x20%s',_0x5c9c54,_0x259cf0[_0xf82b('0x12')][_0xf82b('0x13')]);return _0x3c1db3(_0x259cf0['error'][_0xf82b('0x13')]);}else{logger[_0xf82b('0xd')](_0xf82b('0xe'),_0x5c9c54,_0xf82b('0xf'));_0x3c1db3(_0x259cf0[_0xf82b('0x14')][_0xf82b('0x13')]);}})['catch'](function(_0xd5369){logger['error'](_0xf82b('0xe'),_0x5c9c54,_0xd5369);_0x2b7b64(_0xd5369);});});} \ No newline at end of file +var _0x13e7=['then','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x288275,_0x4d5aff){var _0x17f50a=function(_0x250e98){while(--_0x250e98){_0x288275['push'](_0x288275['shift']());}};_0x17f50a(++_0x4d5aff);}(_0x13e7,0xb2));var _0x713e=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x13e7[_0x151334];return _0x3d03da;};'use strict';var _=require('lodash');var util=require(_0x713e('0x0'));var moment=require(_0x713e('0x1'));var BPromise=require(_0x713e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x713e('0x4'))(_0x713e('0x5'));var config=require(_0x713e('0x6'));var jayson=require(_0x713e('0x7'));var client=jayson[_0x713e('0x8')][_0x713e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25776e,_0x31543d,_0x34d9a4){return new BPromise(function(_0x29753c,_0x279280){return client[_0x713e('0xa')](_0x25776e,_0x34d9a4)[_0x713e('0xb')](function(_0x4fcd06){logger[_0x713e('0xc')]('ZohoField,\x20%s,\x20%s',_0x31543d,_0x713e('0xd'));logger['debug'](_0x713e('0xe'),_0x31543d,_0x713e('0xd'),JSON['stringify'](_0x4fcd06));if(_0x4fcd06[_0x713e('0xf')]){if(_0x4fcd06[_0x713e('0xf')][_0x713e('0x10')]===0x1f4){logger[_0x713e('0xf')](_0x713e('0x11'),_0x31543d,_0x4fcd06[_0x713e('0xf')][_0x713e('0x12')]);return _0x279280(_0x4fcd06[_0x713e('0xf')][_0x713e('0x12')]);}logger['error'](_0x713e('0x11'),_0x31543d,_0x4fcd06[_0x713e('0xf')][_0x713e('0x12')]);return _0x29753c(_0x4fcd06[_0x713e('0xf')][_0x713e('0x12')]);}else{logger[_0x713e('0xc')](_0x713e('0x11'),_0x31543d,_0x713e('0xd'));_0x29753c(_0x4fcd06[_0x713e('0x13')][_0x713e('0x12')]);}})[_0x713e('0x14')](function(_0xab6949){logger[_0x713e('0xf')](_0x713e('0x11'),_0x31543d,_0xab6949);_0x279280(_0xab6949);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 71c5798..0d37a67 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1316cb,_0x18a932){var _0x254bb9=function(_0x3cae5a){while(--_0x3cae5a){_0x1316cb['push'](_0x1316cb['shift']());}};_0x254bb9(++_0x18a932);}(_0x70e0,0x17b));var _0x070e=function(_0x1f85b,_0x34d69a){_0x1f85b=_0x1f85b-0x0;var _0x2ea239=_0x70e0[_0x1f85b];return _0x2ea239;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x54420f,_0x1efffc){var _0x3043d9=function(_0x553149){while(--_0x553149){_0x54420f['push'](_0x54420f['shift']());}};_0x3043d9(++_0x1efffc);}(_0xe706,0xa3));var _0x6e70=function(_0x2c1101,_0x1909d9){_0x2c1101=_0x2c1101-0x0;var _0x56f52f=_0xe706[_0x2c1101];return _0x56f52f;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 93e6113..fe3a450 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 _0x5bc0=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x25ae7f,_0x13ffb5){var _0x48d689=function(_0x20ae0b){while(--_0x20ae0b){_0x25ae7f['push'](_0x25ae7f['shift']());}};_0x48d689(++_0x13ffb5);}(_0x5bc0,0xcc));var _0x05bc=function(_0x21ad99,_0x7683fd){_0x21ad99=_0x21ad99-0x0;var _0x45f8f0=_0x5bc0[_0x21ad99];return _0x45f8f0;};'use strict';var Sequelize=require(_0x05bc('0x0'));module[_0x05bc('0x1')]={'name':{'type':Sequelize[_0x05bc('0x2')],'allowNull':![],'unique':_0x05bc('0x3')},'version':{'type':Sequelize[_0x05bc('0x2')],'allowNull':![],'unique':_0x05bc('0x3')},'main':{'type':Sequelize[_0x05bc('0x2')],'defaultValue':_0x05bc('0x4')},'filename':{'type':Sequelize[_0x05bc('0x2')]},'path':{'type':Sequelize[_0x05bc('0x2')]},'type':{'type':Sequelize[_0x05bc('0x2')]},'size':{'type':Sequelize[_0x05bc('0x5')]},'active':{'type':Sequelize[_0x05bc('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x05bc('0x2')]},'logo':{'type':Sequelize[_0x05bc('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x05bc('0x7')},'description':{'type':Sequelize[_0x05bc('0x2')]},'title':{'type':Sequelize[_0x05bc('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x05bc('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x62ac=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x62ac,0xc8));var _0xc62a=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0x62ac[_0x580971];return _0x16d873;};'use strict';var Sequelize=require(_0xc62a('0x0'));module[_0xc62a('0x1')]={'name':{'type':Sequelize[_0xc62a('0x2')],'allowNull':![],'unique':_0xc62a('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc62a('0x3')},'main':{'type':Sequelize[_0xc62a('0x2')],'defaultValue':_0xc62a('0x4')},'filename':{'type':Sequelize[_0xc62a('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc62a('0x2')]},'size':{'type':Sequelize[_0xc62a('0x5')]},'active':{'type':Sequelize[_0xc62a('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xc62a('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xc62a('0x2')],'unique':_0xc62a('0x7')},'description':{'type':Sequelize[_0xc62a('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xc62a('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 5b93266..a760dce 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 _0x781d=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','Integration','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x335ea3,_0x257201){var _0x420b04=function(_0x100904){while(--_0x100904){_0x335ea3['push'](_0x335ea3['shift']());}};_0x420b04(++_0x257201);}(_0x781d,0x14a));var _0xd781=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x781d[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));}; \ No newline at end of file +var _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x3fabde,_0x481fda){var _0x367c63=function(_0x58918b){while(--_0x58918b){_0x3fabde['push'](_0x3fabde['shift']());}};_0x367c63(++_0x481fda);}(_0xacf4,0xe7));var _0x4acf=function(_0x42f6d1,_0x52c740){_0x42f6d1=_0x42f6d1-0x0;var _0x50ae08=_0xacf4[_0x42f6d1];return _0x50ae08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['Integration'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['Integration']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7a44a5e..f40e00d 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 _0x387c=['api','moment','request-promise','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x387c,0xed));var _0xc387=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x387c[_0x5cc3d4];return _0x17ca31;};'use strict';var _=require(_0xc387('0x0'));var util=require(_0xc387('0x1'));var logger=require(_0xc387('0x2'))(_0xc387('0x3'));var moment=require(_0xc387('0x4'));var BPromise=require('bluebird');var rp=require(_0xc387('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc387('0x6'));var config=require(_0xc387('0x7'));var attributes=require('./integration.attributes');module[_0xc387('0x8')]=function(_0x559ed9,_0x4fe980){return _0x559ed9[_0xc387('0x9')](_0xc387('0xa'),attributes,{'tableName':_0xc387('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5746=['request-promise','path','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x5746,0x1c2));var _0x6574=function(_0x4580f2,_0x55a373){_0x4580f2=_0x4580f2-0x0;var _0x50c667=_0x5746[_0x4580f2];return _0x50c667;};'use strict';var _=require(_0x6574('0x0'));var util=require(_0x6574('0x1'));var logger=require(_0x6574('0x2'))(_0x6574('0x3'));var moment=require('moment');var BPromise=require(_0x6574('0x4'));var rp=require(_0x6574('0x5'));var fs=require('fs');var path=require(_0x6574('0x6'));var rimraf=require(_0x6574('0x7'));var config=require(_0x6574('0x8'));var attributes=require('./integration.attributes');module[_0x6574('0x9')]=function(_0x489739,_0x1b634f){return _0x489739[_0x6574('0xa')](_0x6574('0xb'),attributes,{'tableName':_0x6574('0xc'),'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 bb4fe8d..1f6aaae 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(_0x5da1ba,_0x46e295){var _0x26a794=function(_0x24dc62){while(--_0x24dc62){_0x5da1ba['push'](_0x5da1ba['shift']());}};_0x26a794(++_0x46e295);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x36284b,_0x2b7436){var _0x23c34a=function(_0x14f579){while(--_0x14f579){_0x36284b['push'](_0x36284b['shift']());}};_0x23c34a(++_0x2b7436);}(_0x524e,0x15e));var _0xe524=function(_0x29bb4e,_0x182e7d){_0x29bb4e=_0x29bb4e-0x0;var _0x9f2fa6=_0x524e[_0x29bb4e];return _0x9f2fa6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1b7ed5f..988a313 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 _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x1c23dc,_0x34be95){var _0x468015=function(_0x1da47d){while(--_0x1da47d){_0x1c23dc['push'](_0x1c23dc['shift']());}};_0x468015(++_0x34be95);}(_0x2542,0x169));var _0x2254=function(_0x2edbd7,_0xa8be8a){_0x2edbd7=_0x2edbd7-0x0;var _0x2a6100=_0x2542[_0x2edbd7];return _0x2a6100;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file +var _0x0b0e=['get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x350771,_0x165b2a){var _0x351d97=function(_0x475d11){while(--_0x475d11){_0x350771['push'](_0x350771['shift']());}};_0x351d97(++_0x165b2a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x0b0e[_0x4fe19c];return _0x952ac7;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0xe')]('/',auth[_0xe0b0('0xa')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);module[_0xe0b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index d3119f0..4e97dc1 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 _0x11ab=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','STRING','INTEGER','DATE'];(function(_0x29184b,_0xb55b72){var _0x2fefd9=function(_0x598549){while(--_0x598549){_0x29184b['push'](_0x29184b['shift']());}};_0x2fefd9(++_0xb55b72);}(_0x11ab,0x88));var _0xb11a=function(_0x58e6cb,_0x4502b9){_0x58e6cb=_0x58e6cb-0x0;var _0x4db458=_0x11ab[_0x58e6cb];return _0x4db458;};'use strict';var Sequelize=require(_0xb11a('0x0'));module['exports']={'integration':{'type':Sequelize[_0xb11a('0x1')]},'eventChannel':{'type':Sequelize[_0xb11a('0x1')]},'exitStatus':{'type':Sequelize[_0xb11a('0x1')]},'ticketId':{'type':Sequelize[_0xb11a('0x1')]},'integrationId':{'type':Sequelize[_0xb11a('0x2')]},'contacts':{'type':Sequelize[_0xb11a('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb11a('0x1')]},'queue':{'type':Sequelize[_0xb11a('0x1')]},'interface':{'type':Sequelize[_0xb11a('0x1')]},'membername':{'type':Sequelize[_0xb11a('0x1')]},'agentcalledAt':{'type':Sequelize[_0xb11a('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb11a('0x3')]},'holdtime':{'type':Sequelize[_0xb11a('0x2')]},'agentcomplete':{'type':Sequelize[_0xb11a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb11a('0x3')]},'talktime':{'type':Sequelize[_0xb11a('0x2')]},'agentacw':{'type':Sequelize[_0xb11a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb11a('0x2')]},'reason':{'type':Sequelize[_0xb11a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xb11a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xb11a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb11a('0x2')]},'channelstatedesc':{'type':Sequelize[_0xb11a('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb11a('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb11a('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb11a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb11a('0x1')]},'destchannelstate':{'type':Sequelize[_0xb11a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xb11a('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xb11a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb11a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb11a('0x1')]},'destlanguage':{'type':Sequelize[_0xb11a('0x1')]},'destaccountcode':{'type':Sequelize[_0xb11a('0x1')]},'destcontext':{'type':Sequelize[_0xb11a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xb11a('0x1')]},'inReplyTo':{'type':Sequelize[_0xb11a('0x1')]},'subject':{'type':Sequelize[_0xb11a('0x1')]},'from':{'type':Sequelize[_0xb11a('0x1')]},'to':{'type':Sequelize[_0xb11a('0x1')]},'cc':{'type':Sequelize[_0xb11a('0x1')]},'attachment':{'type':Sequelize[_0xb11a('0x5')]},'html':{'type':Sequelize[_0xb11a('0x5')]},'text':{'type':Sequelize[_0xb11a('0x5')]},'status':{'type':Sequelize[_0xb11a('0x6')](_0xb11a('0x7'),_0xb11a('0x8'),_0xb11a('0x9'),'FAILED')},'url':{'type':Sequelize[_0xb11a('0x1')]},'app':{'type':Sequelize[_0xb11a('0x1')]},'appdata':{'type':Sequelize[_0xb11a('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc477=['RECEIVED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xc477,0xc9));var _0x7c47=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xc477[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require('sequelize');module[_0x7c47('0x0')]={'integration':{'type':Sequelize[_0x7c47('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7c47('0x1')]},'ticketId':{'type':Sequelize[_0x7c47('0x1')]},'integrationId':{'type':Sequelize[_0x7c47('0x2')]},'contacts':{'type':Sequelize[_0x7c47('0x1')]},'uniqueid':{'type':Sequelize[_0x7c47('0x1')]},'calleridnum':{'type':Sequelize[_0x7c47('0x1')]},'calleridname':{'type':Sequelize[_0x7c47('0x1')]},'queue':{'type':Sequelize[_0x7c47('0x1')]},'interface':{'type':Sequelize[_0x7c47('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7c47('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7c47('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7c47('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7c47('0x3')]},'talktime':{'type':Sequelize[_0x7c47('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7c47('0x2')]},'reason':{'type':Sequelize[_0x7c47('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7c47('0x3')]},'agentdump':{'type':Sequelize[_0x7c47('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7c47('0x3')]},'lastevent':{'type':Sequelize[_0x7c47('0x1')]},'channel':{'type':Sequelize[_0x7c47('0x1')]},'channelstate':{'type':Sequelize[_0x7c47('0x2')]},'channelstatedesc':{'type':Sequelize[_0x7c47('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7c47('0x1')]},'connectedlinename':{'type':Sequelize[_0x7c47('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7c47('0x1')]},'exten':{'type':Sequelize[_0x7c47('0x1')]},'priority':{'type':Sequelize[_0x7c47('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7c47('0x1')]},'destcalleridname':{'type':Sequelize[_0x7c47('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7c47('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7c47('0x1')]},'destlanguage':{'type':Sequelize[_0x7c47('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7c47('0x1')]},'destexten':{'type':Sequelize[_0x7c47('0x1')]},'destpriority':{'type':Sequelize[_0x7c47('0x1')]},'destuniqueid':{'type':Sequelize[_0x7c47('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7c47('0x1')]},'subject':{'type':Sequelize[_0x7c47('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7c47('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x7c47('0x5')]},'text':{'type':Sequelize[_0x7c47('0x5')]},'status':{'type':Sequelize['ENUM'](_0x7c47('0x6'),'SENDING',_0x7c47('0x7'),'FAILED')},'url':{'type':Sequelize[_0x7c47('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'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 4bbad90..4ef998f 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 _0xff86=['pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','reject','update','then','destroy','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x5b26b3,_0x1ff991){var _0x3267d4=function(_0x59d942){while(--_0x59d942){_0x5b26b3['push'](_0x5b26b3['shift']());}};_0x3267d4(++_0x1ff991);}(_0xff86,0x1eb));var _0x6ff8=function(_0xebbd91,_0x3b8cc2){_0xebbd91=_0xebbd91-0x0;var _0x32310a=_0xff86[_0xebbd91];return _0x32310a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ff8('0x0'));var zipdir=require(_0x6ff8('0x1'));var jsonpatch=require(_0x6ff8('0x2'));var rp=require(_0x6ff8('0x3'));var moment=require(_0x6ff8('0x4'));var BPromise=require(_0x6ff8('0x5'));var Mustache=require('mustache');var util=require(_0x6ff8('0x6'));var path=require(_0x6ff8('0x7'));var sox=require(_0x6ff8('0x8'));var csv=require(_0x6ff8('0x9'));var ejs=require(_0x6ff8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ff8('0xb'));var squel=require(_0x6ff8('0xc'));var crypto=require('crypto');var jsforce=require(_0x6ff8('0xd'));var deskjs=require(_0x6ff8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6ff8('0xf'));var Redis=require('ioredis');var authService=require(_0x6ff8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6ff8('0x11'));var hardwareService=require(_0x6ff8('0x12'));var logger=require(_0x6ff8('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6ff8('0x14'));var db=require(_0x6ff8('0x15'))['db'];function respondWithStatusCode(_0x18db2b,_0x407621){_0x407621=_0x407621||0xcc;return function(_0x4b1369){if(_0x4b1369){return _0x18db2b[_0x6ff8('0x16')](_0x407621);}return _0x18db2b[_0x6ff8('0x17')](_0x407621)[_0x6ff8('0x18')]();};}function respondWithResult(_0x621b06,_0x42bf25){_0x42bf25=_0x42bf25||0xc8;return function(_0x598cfe){if(_0x598cfe){return _0x621b06['status'](_0x42bf25)[_0x6ff8('0x19')](_0x598cfe);}};}function respondWithFilteredResult(_0x1c48c5,_0x397bfb){return function(_0x3af994){if(_0x3af994){var _0x454d70=typeof _0x397bfb[_0x6ff8('0x1a')]==='undefined'&&typeof _0x397bfb['limit']==='undefined';var _0x8e565f=_0x3af994[_0x6ff8('0x1b')];var _0x2b9886=_0x454d70?0x0:_0x397bfb[_0x6ff8('0x1a')];var _0x2b8a47=_0x454d70?_0x3af994[_0x6ff8('0x1b')]:_0x397bfb[_0x6ff8('0x1a')]+_0x397bfb[_0x6ff8('0x1c')];var _0x5ccb9b;if(_0x2b8a47>=_0x8e565f){_0x2b8a47=_0x8e565f;_0x5ccb9b=0xc8;}else{_0x5ccb9b=0xce;}_0x1c48c5[_0x6ff8('0x17')](_0x5ccb9b);return _0x1c48c5['set']('Content-Range',_0x2b9886+'-'+_0x2b8a47+'/'+_0x8e565f)[_0x6ff8('0x19')](_0x3af994);}return null;};}function patchUpdates(_0x4ab9c3){return function(_0x47032d){try{jsonpatch['apply'](_0x47032d,_0x4ab9c3,!![]);}catch(_0x3f9de0){return BPromise[_0x6ff8('0x1d')](_0x3f9de0);}return _0x47032d['save']();};}function saveUpdates(_0x491adb,_0x54d513){return function(_0x1e914b){if(_0x1e914b){return _0x1e914b[_0x6ff8('0x1e')](_0x491adb)[_0x6ff8('0x1f')](function(_0xa22ad2){return _0xa22ad2;});}return null;};}function removeEntity(_0x420b3a,_0x3fd5cd){return function(_0x503c93){if(_0x503c93){return _0x503c93[_0x6ff8('0x20')]()[_0x6ff8('0x1f')](function(){_0x420b3a[_0x6ff8('0x17')](0xcc)[_0x6ff8('0x18')]();});}};}function handleEntityNotFound(_0x42df1c,_0x3b707e){return function(_0x16c412){if(!_0x16c412){_0x42df1c[_0x6ff8('0x16')](0x194);}return _0x16c412;};}function handleError(_0x433121,_0x1e7a1b){_0x1e7a1b=_0x1e7a1b||0x1f4;return function(_0xa90827){logger['error'](_0xa90827[_0x6ff8('0x21')]);if(_0xa90827['name']){delete _0xa90827[_0x6ff8('0x22')];}_0x433121[_0x6ff8('0x17')](_0x1e7a1b)[_0x6ff8('0x23')](_0xa90827);};}exports[_0x6ff8('0x24')]=function(_0x2a7ae2,_0x1a2c76){var _0x2074f5={},_0x1d65f6={},_0x4f860b={'count':0x0,'rows':[]};var _0x1f88ca=_[_0x6ff8('0x25')](db[_0x6ff8('0x26')][_0x6ff8('0x27')],function(_0x4b2338){return{'name':_0x4b2338[_0x6ff8('0x28')],'type':_0x4b2338['type'][_0x6ff8('0x29')]};});_0x1d65f6[_0x6ff8('0x2a')]=_[_0x6ff8('0x25')](_0x1f88ca,_0x6ff8('0x22'));_0x1d65f6[_0x6ff8('0x2b')]=_[_0x6ff8('0x2c')](_0x2a7ae2[_0x6ff8('0x2b')]);_0x1d65f6['filters']=_[_0x6ff8('0x2d')](_0x1d65f6['model'],_0x1d65f6['query']);_0x2074f5[_0x6ff8('0x2e')]=_[_0x6ff8('0x2d')](_0x1d65f6[_0x6ff8('0x2a')],qs[_0x6ff8('0x2f')](_0x2a7ae2['query'][_0x6ff8('0x2f')]));_0x2074f5[_0x6ff8('0x2e')]=_0x2074f5[_0x6ff8('0x2e')][_0x6ff8('0x30')]?_0x2074f5['attributes']:_0x1d65f6[_0x6ff8('0x2a')];if(!_0x2a7ae2['query'][_0x6ff8('0x31')]('nolimit')){_0x2074f5['limit']=qs['limit'](_0x2a7ae2[_0x6ff8('0x2b')][_0x6ff8('0x1c')]);_0x2074f5[_0x6ff8('0x1a')]=qs[_0x6ff8('0x1a')](_0x2a7ae2['query'][_0x6ff8('0x1a')]);}_0x2074f5['order']=qs[_0x6ff8('0x32')](_0x2a7ae2[_0x6ff8('0x2b')]['sort']);_0x2074f5[_0x6ff8('0x33')]=qs[_0x6ff8('0x34')](_[_0x6ff8('0x35')](_0x2a7ae2['query'],_0x1d65f6['filters']),_0x1f88ca);if(_0x2a7ae2['query'][_0x6ff8('0x36')]){_0x2074f5[_0x6ff8('0x33')]=_[_0x6ff8('0x37')](_0x2074f5['where'],{'$or':_['map'](_0x1f88ca,function(_0x5798d6){if(_0x5798d6[_0x6ff8('0x38')]!=='VIRTUAL'){var _0x4ac78b={};_0x4ac78b[_0x5798d6['name']]={'$like':'%'+_0x2a7ae2[_0x6ff8('0x2b')][_0x6ff8('0x36')]+'%'};return _0x4ac78b;}})});}_0x2074f5=_['merge']({},_0x2074f5,_0x2a7ae2[_0x6ff8('0x39')]);var _0x5bfd45={'where':_0x2074f5['where']};return db['IntegrationReport']['count'](_0x5bfd45)['then'](function(_0x2c0ae0){_0x4f860b['count']=_0x2c0ae0;if(_0x2a7ae2[_0x6ff8('0x2b')][_0x6ff8('0x3a')]){_0x2074f5[_0x6ff8('0x3b')]=[{'all':!![]}];}return db[_0x6ff8('0x26')][_0x6ff8('0x3c')](_0x2074f5);})[_0x6ff8('0x1f')](function(_0x39506c){_0x4f860b['rows']=_0x39506c;return _0x4f860b;})['then'](respondWithFilteredResult(_0x1a2c76,_0x2074f5))[_0x6ff8('0x3d')](handleError(_0x1a2c76,null));};exports[_0x6ff8('0x3e')]=function(_0x44ddf5,_0x485880){var _0x1e5c8d={'raw':![],'where':{'id':_0x44ddf5[_0x6ff8('0x3f')]['id']}},_0x45be26={};_0x45be26['model']=_['keys'](db[_0x6ff8('0x26')][_0x6ff8('0x27')]);_0x45be26['query']=_[_0x6ff8('0x2c')](_0x44ddf5[_0x6ff8('0x2b')]);_0x45be26[_0x6ff8('0x34')]=_[_0x6ff8('0x2d')](_0x45be26[_0x6ff8('0x2a')],_0x45be26[_0x6ff8('0x2b')]);_0x1e5c8d['attributes']=_[_0x6ff8('0x2d')](_0x45be26[_0x6ff8('0x2a')],qs[_0x6ff8('0x2f')](_0x44ddf5[_0x6ff8('0x2b')][_0x6ff8('0x2f')]));_0x1e5c8d[_0x6ff8('0x2e')]=_0x1e5c8d[_0x6ff8('0x2e')][_0x6ff8('0x30')]?_0x1e5c8d[_0x6ff8('0x2e')]:_0x45be26[_0x6ff8('0x2a')];if(_0x44ddf5[_0x6ff8('0x2b')][_0x6ff8('0x3a')]){_0x1e5c8d[_0x6ff8('0x3b')]=[{'all':!![]}];}_0x1e5c8d=_[_0x6ff8('0x37')]({},_0x1e5c8d,_0x44ddf5[_0x6ff8('0x39')]);return db[_0x6ff8('0x26')][_0x6ff8('0x40')](_0x1e5c8d)[_0x6ff8('0x1f')](handleEntityNotFound(_0x485880,null))[_0x6ff8('0x1f')](respondWithResult(_0x485880,null))['catch'](handleError(_0x485880,null));};exports[_0x6ff8('0x41')]=function(_0x2dc1a8,_0x1812bd){return db[_0x6ff8('0x26')][_0x6ff8('0x41')](_0x2dc1a8['body'],{})[_0x6ff8('0x1f')](respondWithResult(_0x1812bd,0xc9))['catch'](handleError(_0x1812bd,null));};exports[_0x6ff8('0x1e')]=function(_0x441c21,_0xaf5bbf){if(_0x441c21[_0x6ff8('0x42')]['id']){delete _0x441c21[_0x6ff8('0x42')]['id'];}return db[_0x6ff8('0x26')][_0x6ff8('0x40')]({'where':{'id':_0x441c21[_0x6ff8('0x3f')]['id']}})[_0x6ff8('0x1f')](handleEntityNotFound(_0xaf5bbf,null))[_0x6ff8('0x1f')](saveUpdates(_0x441c21[_0x6ff8('0x42')],null))[_0x6ff8('0x1f')](respondWithResult(_0xaf5bbf,null))[_0x6ff8('0x3d')](handleError(_0xaf5bbf,null));};exports[_0x6ff8('0x20')]=function(_0x21eb26,_0x2f66b9){return db[_0x6ff8('0x26')][_0x6ff8('0x40')]({'where':{'id':_0x21eb26['params']['id']}})[_0x6ff8('0x1f')](handleEntityNotFound(_0x2f66b9,null))['then'](removeEntity(_0x2f66b9,null))['catch'](handleError(_0x2f66b9,null));};exports[_0x6ff8('0x43')]=function(_0x1112ee,_0x1eea8b){return db[_0x6ff8('0x26')][_0x6ff8('0x43')]()[_0x6ff8('0x1f')](respondWithResult(_0x1eea8b,null))[_0x6ff8('0x3d')](handleError(_0x1eea8b,null));}; \ No newline at end of file +var _0xd0bd=['rows','catch','show','params','fields','IntegrationReport','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll'];(function(_0x4ebed5,_0x593300){var _0x3cf127=function(_0x233711){while(--_0x233711){_0x4ebed5['push'](_0x4ebed5['shift']());}};_0x3cf127(++_0x593300);}(_0xd0bd,0x195));var _0xdd0b=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xd0bd[_0x36dfbd];return _0x4ecad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd0b('0x0'));var zipdir=require(_0xdd0b('0x1'));var jsonpatch=require(_0xdd0b('0x2'));var rp=require('request-promise');var moment=require(_0xdd0b('0x3'));var BPromise=require(_0xdd0b('0x4'));var Mustache=require(_0xdd0b('0x5'));var util=require('util');var path=require(_0xdd0b('0x6'));var sox=require(_0xdd0b('0x7'));var csv=require(_0xdd0b('0x8'));var ejs=require(_0xdd0b('0x9'));var fs=require('fs');var fs_extra=require(_0xdd0b('0xa'));var _=require(_0xdd0b('0xb'));var squel=require(_0xdd0b('0xc'));var crypto=require(_0xdd0b('0xd'));var jsforce=require(_0xdd0b('0xe'));var deskjs=require(_0xdd0b('0xf'));var toCsv=require(_0xdd0b('0x8'));var querystring=require(_0xdd0b('0x10'));var Papa=require(_0xdd0b('0x11'));var Redis=require('ioredis');var authService=require(_0xdd0b('0x12'));var qs=require(_0xdd0b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd0b('0x14'));var logger=require(_0xdd0b('0x15'))('api');var utils=require(_0xdd0b('0x16'));var config=require(_0xdd0b('0x17'));var licenseUtil=require(_0xdd0b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d8d0e,_0x4779e0){_0x4779e0=_0x4779e0||0xcc;return function(_0x732f2d){if(_0x732f2d){return _0x2d8d0e[_0xdd0b('0x19')](_0x4779e0);}return _0x2d8d0e[_0xdd0b('0x1a')](_0x4779e0)[_0xdd0b('0x1b')]();};}function respondWithResult(_0x42aabf,_0xad8f93){_0xad8f93=_0xad8f93||0xc8;return function(_0x46e3c6){if(_0x46e3c6){return _0x42aabf[_0xdd0b('0x1a')](_0xad8f93)[_0xdd0b('0x1c')](_0x46e3c6);}};}function respondWithFilteredResult(_0x88a2e0,_0x4ebc3a){return function(_0x503cd8){if(_0x503cd8){var _0x3af74f=typeof _0x4ebc3a[_0xdd0b('0x1d')]===_0xdd0b('0x1e')&&typeof _0x4ebc3a[_0xdd0b('0x1f')]===_0xdd0b('0x1e');var _0xe0c4c9=_0x503cd8['count'];var _0x5473b3=_0x3af74f?0x0:_0x4ebc3a[_0xdd0b('0x1d')];var _0xef8912=_0x3af74f?_0x503cd8[_0xdd0b('0x20')]:_0x4ebc3a[_0xdd0b('0x1d')]+_0x4ebc3a['limit'];var _0x51b137;if(_0xef8912>=_0xe0c4c9){_0xef8912=_0xe0c4c9;_0x51b137=0xc8;}else{_0x51b137=0xce;}_0x88a2e0[_0xdd0b('0x1a')](_0x51b137);return _0x88a2e0['set'](_0xdd0b('0x21'),_0x5473b3+'-'+_0xef8912+'/'+_0xe0c4c9)[_0xdd0b('0x1c')](_0x503cd8);}return null;};}function patchUpdates(_0x341b0b){return function(_0x2439bf){try{jsonpatch[_0xdd0b('0x22')](_0x2439bf,_0x341b0b,!![]);}catch(_0x276252){return BPromise[_0xdd0b('0x23')](_0x276252);}return _0x2439bf[_0xdd0b('0x24')]();};}function saveUpdates(_0x2a01ad,_0x40234d){return function(_0x159ad2){if(_0x159ad2){return _0x159ad2[_0xdd0b('0x25')](_0x2a01ad)['then'](function(_0x269f8c){return _0x269f8c;});}return null;};}function removeEntity(_0x17ecd5,_0xc7b612){return function(_0x2aabb7){if(_0x2aabb7){return _0x2aabb7[_0xdd0b('0x26')]()['then'](function(){_0x17ecd5[_0xdd0b('0x1a')](0xcc)[_0xdd0b('0x1b')]();});}};}function handleEntityNotFound(_0x479837,_0x481aa5){return function(_0x317572){if(!_0x317572){_0x479837[_0xdd0b('0x19')](0x194);}return _0x317572;};}function handleError(_0x580f91,_0x168acb){_0x168acb=_0x168acb||0x1f4;return function(_0x23237e){logger[_0xdd0b('0x27')](_0x23237e[_0xdd0b('0x28')]);if(_0x23237e[_0xdd0b('0x29')]){delete _0x23237e['name'];}_0x580f91['status'](_0x168acb)[_0xdd0b('0x2a')](_0x23237e);};}exports[_0xdd0b('0x2b')]=function(_0x27f7ef,_0x2d63ce){var _0x3b19ea={},_0xcccac5={},_0x40c71a={'count':0x0,'rows':[]};var _0x9f0366=_['map'](db['IntegrationReport'][_0xdd0b('0x2c')],function(_0x118a91){return{'name':_0x118a91[_0xdd0b('0x2d')],'type':_0x118a91[_0xdd0b('0x2e')][_0xdd0b('0x2f')]};});_0xcccac5[_0xdd0b('0x30')]=_[_0xdd0b('0x31')](_0x9f0366,_0xdd0b('0x29'));_0xcccac5['query']=_[_0xdd0b('0x32')](_0x27f7ef[_0xdd0b('0x33')]);_0xcccac5['filters']=_['intersection'](_0xcccac5[_0xdd0b('0x30')],_0xcccac5[_0xdd0b('0x33')]);_0x3b19ea[_0xdd0b('0x34')]=_[_0xdd0b('0x35')](_0xcccac5[_0xdd0b('0x30')],qs['fields'](_0x27f7ef[_0xdd0b('0x33')]['fields']));_0x3b19ea[_0xdd0b('0x34')]=_0x3b19ea['attributes'][_0xdd0b('0x36')]?_0x3b19ea[_0xdd0b('0x34')]:_0xcccac5['model'];if(!_0x27f7ef[_0xdd0b('0x33')][_0xdd0b('0x37')]('nolimit')){_0x3b19ea[_0xdd0b('0x1f')]=qs[_0xdd0b('0x1f')](_0x27f7ef[_0xdd0b('0x33')][_0xdd0b('0x1f')]);_0x3b19ea['offset']=qs['offset'](_0x27f7ef[_0xdd0b('0x33')][_0xdd0b('0x1d')]);}_0x3b19ea[_0xdd0b('0x38')]=qs[_0xdd0b('0x39')](_0x27f7ef[_0xdd0b('0x33')][_0xdd0b('0x39')]);_0x3b19ea[_0xdd0b('0x3a')]=qs[_0xdd0b('0x3b')](_[_0xdd0b('0x3c')](_0x27f7ef[_0xdd0b('0x33')],_0xcccac5[_0xdd0b('0x3b')]),_0x9f0366);if(_0x27f7ef['query'][_0xdd0b('0x3d')]){_0x3b19ea[_0xdd0b('0x3a')]=_[_0xdd0b('0x3e')](_0x3b19ea[_0xdd0b('0x3a')],{'$or':_[_0xdd0b('0x31')](_0x9f0366,function(_0x3220fa){if(_0x3220fa['type']!==_0xdd0b('0x3f')){var _0x3073fb={};_0x3073fb[_0x3220fa[_0xdd0b('0x29')]]={'$like':'%'+_0x27f7ef['query']['filter']+'%'};return _0x3073fb;}})});}_0x3b19ea=_[_0xdd0b('0x3e')]({},_0x3b19ea,_0x27f7ef[_0xdd0b('0x40')]);var _0x2655d4={'where':_0x3b19ea[_0xdd0b('0x3a')]};return db['IntegrationReport'][_0xdd0b('0x20')](_0x2655d4)[_0xdd0b('0x41')](function(_0x45965f){_0x40c71a[_0xdd0b('0x20')]=_0x45965f;if(_0x27f7ef['query'][_0xdd0b('0x42')]){_0x3b19ea[_0xdd0b('0x43')]=[{'all':!![]}];}return db['IntegrationReport'][_0xdd0b('0x44')](_0x3b19ea);})[_0xdd0b('0x41')](function(_0x3855d7){_0x40c71a[_0xdd0b('0x45')]=_0x3855d7;return _0x40c71a;})[_0xdd0b('0x41')](respondWithFilteredResult(_0x2d63ce,_0x3b19ea))[_0xdd0b('0x46')](handleError(_0x2d63ce,null));};exports[_0xdd0b('0x47')]=function(_0x417689,_0x1429e4){var _0x35f9f5={'raw':![],'where':{'id':_0x417689[_0xdd0b('0x48')]['id']}},_0x543e9b={};_0x543e9b[_0xdd0b('0x30')]=_[_0xdd0b('0x32')](db['IntegrationReport'][_0xdd0b('0x2c')]);_0x543e9b[_0xdd0b('0x33')]=_['keys'](_0x417689[_0xdd0b('0x33')]);_0x543e9b['filters']=_['intersection'](_0x543e9b[_0xdd0b('0x30')],_0x543e9b['query']);_0x35f9f5[_0xdd0b('0x34')]=_[_0xdd0b('0x35')](_0x543e9b[_0xdd0b('0x30')],qs[_0xdd0b('0x49')](_0x417689[_0xdd0b('0x33')][_0xdd0b('0x49')]));_0x35f9f5[_0xdd0b('0x34')]=_0x35f9f5[_0xdd0b('0x34')]['length']?_0x35f9f5[_0xdd0b('0x34')]:_0x543e9b['model'];if(_0x417689['query']['includeAll']){_0x35f9f5[_0xdd0b('0x43')]=[{'all':!![]}];}_0x35f9f5=_[_0xdd0b('0x3e')]({},_0x35f9f5,_0x417689['options']);return db[_0xdd0b('0x4a')]['find'](_0x35f9f5)[_0xdd0b('0x41')](handleEntityNotFound(_0x1429e4,null))[_0xdd0b('0x41')](respondWithResult(_0x1429e4,null))[_0xdd0b('0x46')](handleError(_0x1429e4,null));};exports[_0xdd0b('0x4b')]=function(_0x59cd6c,_0x25cfe2){return db[_0xdd0b('0x4a')][_0xdd0b('0x4b')](_0x59cd6c[_0xdd0b('0x4c')],{})[_0xdd0b('0x41')](respondWithResult(_0x25cfe2,0xc9))[_0xdd0b('0x46')](handleError(_0x25cfe2,null));};exports['update']=function(_0x30002e,_0x23f09f){if(_0x30002e['body']['id']){delete _0x30002e['body']['id'];}return db[_0xdd0b('0x4a')][_0xdd0b('0x4d')]({'where':{'id':_0x30002e[_0xdd0b('0x48')]['id']}})[_0xdd0b('0x41')](handleEntityNotFound(_0x23f09f,null))[_0xdd0b('0x41')](saveUpdates(_0x30002e[_0xdd0b('0x4c')],null))['then'](respondWithResult(_0x23f09f,null))[_0xdd0b('0x46')](handleError(_0x23f09f,null));};exports[_0xdd0b('0x26')]=function(_0x387073,_0x2aa64f){return db[_0xdd0b('0x4a')]['find']({'where':{'id':_0x387073['params']['id']}})['then'](handleEntityNotFound(_0x2aa64f,null))[_0xdd0b('0x41')](removeEntity(_0x2aa64f,null))[_0xdd0b('0x46')](handleError(_0x2aa64f,null));};exports[_0xdd0b('0x4e')]=function(_0x516022,_0x5c4146){return db['IntegrationReport']['describe']()[_0xdd0b('0x41')](respondWithResult(_0x5c4146,null))['catch'](handleError(_0x5c4146,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 582ff25..79efda3 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 _0xbc83=['rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','util','../../config/logger','bluebird','request-promise','path'];(function(_0x59bbbd,_0x25ebf8){var _0x11b418=function(_0x2103e5){while(--_0x2103e5){_0x59bbbd['push'](_0x59bbbd['shift']());}};_0x11b418(++_0x25ebf8);}(_0xbc83,0x70));var _0x3bc8=function(_0x25a016,_0x421b8){_0x25a016=_0x25a016-0x0;var _0x18ede0=_0xbc83[_0x25a016];return _0x18ede0;};'use strict';var _=require('lodash');var util=require(_0x3bc8('0x0'));var logger=require(_0x3bc8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3bc8('0x2'));var rp=require(_0x3bc8('0x3'));var fs=require('fs');var path=require(_0x3bc8('0x4'));var rimraf=require(_0x3bc8('0x5'));var config=require(_0x3bc8('0x6'));var attributes=require(_0x3bc8('0x7'));module['exports']=function(_0x41a53b,_0x543e5b){return _0x41a53b['define'](_0x3bc8('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb54d=['../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','api','moment'];(function(_0x63e096,_0x1de8a){var _0x1b5dd3=function(_0x40a282){while(--_0x40a282){_0x63e096['push'](_0x63e096['shift']());}};_0x1b5dd3(++_0x1de8a);}(_0xb54d,0x186));var _0xdb54=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0xb54d[_0x4ca6a4];return _0x120555;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdb54('0x0'));var moment=require(_0xdb54('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb54('0x2'));var attributes=require(_0xdb54('0x3'));module[_0xdb54('0x4')]=function(_0x5dc6d9,_0x4a16f9){return _0x5dc6d9[_0xdb54('0x5')](_0xdb54('0x6'),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 726ed2b..00ed67a 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 _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x1967,0x173));var _0x7196=function(_0x4b58cb,_0x4976f6){_0x4b58cb=_0x4b58cb-0x0;var _0x135412=_0x1967[_0x4b58cb];return _0x135412;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4975,0x86));var _0x5497=function(_0x2c2a5f,_0x3c6973){_0x2c2a5f=_0x2c2a5f-0x0;var _0x207663=_0x4975[_0x2c2a5f];return _0x207663;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4de2d05..2f3e3f8 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 _0x2444=['post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index','/:id','get','/:id/sub_intervals','getIntervals','create'];(function(_0x3a376b,_0x584522){var _0x215a05=function(_0x39213f){while(--_0x39213f){_0x3a376b['push'](_0x3a376b['shift']());}};_0x215a05(++_0x584522);}(_0x2444,0x170));var _0x4244=function(_0x4a6def,_0x49ae36){_0x4a6def=_0x4a6def-0x0;var _0x5d60a4=_0x2444[_0x4a6def];return _0x5d60a4;};'use strict';var multer=require(_0x4244('0x0'));var util=require(_0x4244('0x1'));var path=require(_0x4244('0x2'));var timeout=require(_0x4244('0x3'));var express=require(_0x4244('0x4'));var router=express[_0x4244('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4244('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4244('0x7'));var controller=require(_0x4244('0x8'));router['get']('/',auth[_0x4244('0x9')](),controller[_0x4244('0xa')]);router['get'](_0x4244('0xb'),auth[_0x4244('0x9')](),controller['show']);router[_0x4244('0xc')](_0x4244('0xd'),auth[_0x4244('0x9')](),controller[_0x4244('0xe')]);router['post']('/',auth[_0x4244('0x9')](),controller[_0x4244('0xf')]);router[_0x4244('0x10')](_0x4244('0xd'),auth['isAuthenticated'](),controller['addInterval']);router[_0x4244('0x10')](_0x4244('0x11'),auth[_0x4244('0x9')](),controller[_0x4244('0x12')]);router[_0x4244('0x13')](_0x4244('0xb'),auth['isAuthenticated'](),controller[_0x4244('0x14')]);router[_0x4244('0x15')](_0x4244('0xb'),auth[_0x4244('0x9')](),controller[_0x4244('0x16')]);module[_0x4244('0x17')]=router; \ No newline at end of file +var _0xfd2e=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','index','isAuthenticated','get','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports'];(function(_0x3054d0,_0x28459e){var _0xf7eb3d=function(_0x3665f5){while(--_0x3665f5){_0x3054d0['push'](_0x3054d0['shift']());}};_0xf7eb3d(++_0x28459e);}(_0xfd2e,0x6e));var _0xefd2=function(_0x8b9289,_0x49ad72){_0x8b9289=_0x8b9289-0x0;var _0x501d4a=_0xfd2e[_0x8b9289];return _0x501d4a;};'use strict';var multer=require(_0xefd2('0x0'));var util=require('util');var path=require(_0xefd2('0x1'));var timeout=require('connect-timeout');var express=require(_0xefd2('0x2'));var router=express['Router']();var fs_extra=require(_0xefd2('0x3'));var auth=require(_0xefd2('0x4'));var interaction=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var controller=require(_0xefd2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xefd2('0x8')]);router['get']('/:id',auth[_0xefd2('0x9')](),controller['show']);router[_0xefd2('0xa')](_0xefd2('0xb'),auth[_0xefd2('0x9')](),controller[_0xefd2('0xc')]);router[_0xefd2('0xd')]('/',auth[_0xefd2('0x9')](),controller[_0xefd2('0xe')]);router['post'](_0xefd2('0xb'),auth[_0xefd2('0x9')](),controller[_0xefd2('0xf')]);router[_0xefd2('0xd')](_0xefd2('0x10'),auth[_0xefd2('0x9')](),controller[_0xefd2('0x11')]);router[_0xefd2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xefd2('0x13')]);router['delete']('/:id',auth[_0xefd2('0x9')](),controller[_0xefd2('0x14')]);module[_0xefd2('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f1f245e..7aa7fce 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 _0xe9c4=['sequelize','exports','STRING'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xe9c4,0xe7));var _0x4e9c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe9c4[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x4e9c('0x0'));module[_0x4e9c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4e9c('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xd0e7=['STRING','sequelize','exports'];(function(_0x5ec1c5,_0x4f40b4){var _0x4692dd=function(_0x1cd1f3){while(--_0x1cd1f3){_0x5ec1c5['push'](_0x5ec1c5['shift']());}};_0x4692dd(++_0x4f40b4);}(_0xd0e7,0x112));var _0x7d0e=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xd0e7[_0x31eb67];return _0x2a8cb8;};'use strict';var Sequelize=require(_0x7d0e('0x0'));module[_0x7d0e('0x1')]={'name':{'type':Sequelize[_0x7d0e('0x2')]},'description':{'type':Sequelize[_0x7d0e('0x2')]},'interval':{'type':Sequelize[_0x7d0e('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 9e68a49..6a0f702 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 _0xb5ea=['filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','save','update','then','destroy','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb5ea,0x1f0));var _0xab5e=function(_0x4dc618,_0x1ede6f){_0x4dc618=_0x4dc618-0x0;var _0xd5e46d=_0xb5ea[_0x4dc618];return _0xd5e46d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab5e('0x0'));var rp=require(_0xab5e('0x1'));var moment=require(_0xab5e('0x2'));var BPromise=require(_0xab5e('0x3'));var Mustache=require(_0xab5e('0x4'));var util=require(_0xab5e('0x5'));var path=require(_0xab5e('0x6'));var sox=require(_0xab5e('0x7'));var csv=require(_0xab5e('0x8'));var ejs=require(_0xab5e('0x9'));var fs=require('fs');var fs_extra=require(_0xab5e('0xa'));var _=require(_0xab5e('0xb'));var squel=require(_0xab5e('0xc'));var crypto=require(_0xab5e('0xd'));var jsforce=require(_0xab5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xab5e('0x8'));var querystring=require(_0xab5e('0xf'));var Papa=require(_0xab5e('0x10'));var Redis=require(_0xab5e('0x11'));var authService=require(_0xab5e('0x12'));var qs=require(_0xab5e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab5e('0x14'));var logger=require(_0xab5e('0x15'))('api');var utils=require(_0xab5e('0x16'));var config=require(_0xab5e('0x17'));var licenseUtil=require(_0xab5e('0x18'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x43cd3b,_0x279c94){_0x279c94=_0x279c94||0xcc;return function(_0x341904){if(_0x341904){return _0x43cd3b[_0xab5e('0x19')](_0x279c94);}return _0x43cd3b[_0xab5e('0x1a')](_0x279c94)[_0xab5e('0x1b')]();};}function respondWithResult(_0x400474,_0x7476e7){_0x7476e7=_0x7476e7||0xc8;return function(_0x177adf){if(_0x177adf){return _0x400474['status'](_0x7476e7)[_0xab5e('0x1c')](_0x177adf);}};}function respondWithFilteredResult(_0x23c23b,_0x17b186){return function(_0x23f80b){if(_0x23f80b){var _0x4e0d98=typeof _0x17b186[_0xab5e('0x1d')]===_0xab5e('0x1e')&&typeof _0x17b186[_0xab5e('0x1f')]===_0xab5e('0x1e');var _0x57348a=_0x23f80b[_0xab5e('0x20')];var _0x4745f1=_0x4e0d98?0x0:_0x17b186[_0xab5e('0x1d')];var _0x378c30=_0x4e0d98?_0x23f80b[_0xab5e('0x20')]:_0x17b186[_0xab5e('0x1d')]+_0x17b186[_0xab5e('0x1f')];var _0x1d7247;if(_0x378c30>=_0x57348a){_0x378c30=_0x57348a;_0x1d7247=0xc8;}else{_0x1d7247=0xce;}_0x23c23b[_0xab5e('0x1a')](_0x1d7247);return _0x23c23b['set']('Content-Range',_0x4745f1+'-'+_0x378c30+'/'+_0x57348a)[_0xab5e('0x1c')](_0x23f80b);}return null;};}function patchUpdates(_0x4a2db9){return function(_0x4e3b87){try{jsonpatch['apply'](_0x4e3b87,_0x4a2db9,!![]);}catch(_0x30b685){return BPromise['reject'](_0x30b685);}return _0x4e3b87[_0xab5e('0x21')]();};}function saveUpdates(_0x3b357b,_0x4c058d){return function(_0x152167){if(_0x152167){return _0x152167[_0xab5e('0x22')](_0x3b357b)[_0xab5e('0x23')](function(_0x3bad6b){return _0x3bad6b;});}return null;};}function removeEntity(_0x29e70b,_0x3b7d09){return function(_0x368d16){if(_0x368d16){return _0x368d16[_0xab5e('0x24')]()[_0xab5e('0x23')](function(){var _0x2de670=_0x368d16['get']({'plain':!![]});var _0x4ab81f=_0xab5e('0x25');return db[_0xab5e('0x26')]['destroy']({'where':{'type':_0x4ab81f,'resourceId':_0x2de670['id']}})['then'](function(){return _0x368d16;});})[_0xab5e('0x23')](function(){_0x29e70b[_0xab5e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ef6cb,_0x3cb2e9){return function(_0x29b747){if(!_0x29b747){_0x1ef6cb[_0xab5e('0x19')](0x194);}return _0x29b747;};}function handleError(_0x3f1b64,_0x4f8d14){_0x4f8d14=_0x4f8d14||0x1f4;return function(_0x3cd83a){logger[_0xab5e('0x27')](_0x3cd83a[_0xab5e('0x28')]);if(_0x3cd83a[_0xab5e('0x29')]){delete _0x3cd83a[_0xab5e('0x29')];}_0x3f1b64[_0xab5e('0x1a')](_0x4f8d14)[_0xab5e('0x2a')](_0x3cd83a);};}exports[_0xab5e('0x2b')]=function(_0x3679bc,_0x468fe6){var _0x4b6197={},_0x46bf58={},_0x24649f={'count':0x0,'rows':[]};var _0x560177=_[_0xab5e('0x2c')](db[_0xab5e('0x2d')]['rawAttributes'],function(_0x345c4f){return{'name':_0x345c4f[_0xab5e('0x2e')],'type':_0x345c4f[_0xab5e('0x2f')]['key']};});_0x46bf58[_0xab5e('0x30')]=_[_0xab5e('0x2c')](_0x560177,_0xab5e('0x29'));_0x46bf58['query']=_[_0xab5e('0x31')](_0x3679bc[_0xab5e('0x32')]);_0x46bf58[_0xab5e('0x33')]=_[_0xab5e('0x34')](_0x46bf58[_0xab5e('0x30')],_0x46bf58[_0xab5e('0x32')]);_0x4b6197[_0xab5e('0x35')]=_[_0xab5e('0x34')](_0x46bf58[_0xab5e('0x30')],qs[_0xab5e('0x36')](_0x3679bc[_0xab5e('0x32')][_0xab5e('0x36')]));_0x4b6197[_0xab5e('0x35')]=_0x4b6197[_0xab5e('0x35')][_0xab5e('0x37')]?_0x4b6197['attributes']:_0x46bf58[_0xab5e('0x30')];if(!_0x3679bc['query'][_0xab5e('0x38')](_0xab5e('0x39'))){_0x4b6197[_0xab5e('0x1f')]=qs[_0xab5e('0x1f')](_0x3679bc[_0xab5e('0x32')][_0xab5e('0x1f')]);_0x4b6197[_0xab5e('0x1d')]=qs[_0xab5e('0x1d')](_0x3679bc[_0xab5e('0x32')]['offset']);}_0x4b6197[_0xab5e('0x3a')]=qs[_0xab5e('0x3b')](_0x3679bc[_0xab5e('0x32')][_0xab5e('0x3b')]);_0x4b6197[_0xab5e('0x3c')]=qs[_0xab5e('0x33')](_[_0xab5e('0x3d')](_0x3679bc[_0xab5e('0x32')],_0x46bf58[_0xab5e('0x33')]),_0x560177);if(_0x3679bc['query'][_0xab5e('0x3e')]){_0x4b6197[_0xab5e('0x3c')]=_[_0xab5e('0x3f')](_0x4b6197['where'],{'$or':_[_0xab5e('0x2c')](_0x560177,function(_0x3ed6b8){if(_0x3ed6b8[_0xab5e('0x2f')]!==_0xab5e('0x40')){var _0x5bb152={};_0x5bb152[_0x3ed6b8['name']]={'$like':'%'+_0x3679bc['query'][_0xab5e('0x3e')]+'%'};return _0x5bb152;}})});}_0x4b6197=_[_0xab5e('0x3f')]({},_0x4b6197,_0x3679bc[_0xab5e('0x41')]);var _0x467abb={'where':_0x4b6197['where']};return db[_0xab5e('0x2d')][_0xab5e('0x20')](_0x467abb)[_0xab5e('0x23')](function(_0x5b3447){_0x24649f[_0xab5e('0x20')]=_0x5b3447;if(_0x3679bc[_0xab5e('0x32')]['includeAll']){_0x4b6197[_0xab5e('0x42')]=[{'all':!![]}];}return db['Interval'][_0xab5e('0x43')](_0x4b6197);})[_0xab5e('0x23')](function(_0x389d6e){_0x24649f[_0xab5e('0x44')]=_0x389d6e;return _0x24649f;})[_0xab5e('0x23')](respondWithFilteredResult(_0x468fe6,_0x4b6197))[_0xab5e('0x45')](handleError(_0x468fe6,null));};exports[_0xab5e('0x46')]=function(_0x210772,_0x1e7f14){var _0x34af35={'raw':!![],'where':{'id':_0x210772[_0xab5e('0x47')]['id']}},_0xb6a6fd={};_0xb6a6fd[_0xab5e('0x30')]=_[_0xab5e('0x31')](db[_0xab5e('0x2d')][_0xab5e('0x48')]);_0xb6a6fd[_0xab5e('0x32')]=_[_0xab5e('0x31')](_0x210772[_0xab5e('0x32')]);_0xb6a6fd[_0xab5e('0x33')]=_['intersection'](_0xb6a6fd[_0xab5e('0x30')],_0xb6a6fd[_0xab5e('0x32')]);_0x34af35[_0xab5e('0x35')]=_[_0xab5e('0x34')](_0xb6a6fd['model'],qs[_0xab5e('0x36')](_0x210772[_0xab5e('0x32')]['fields']));_0x34af35['attributes']=_0x34af35[_0xab5e('0x35')][_0xab5e('0x37')]?_0x34af35[_0xab5e('0x35')]:_0xb6a6fd[_0xab5e('0x30')];if(_0x210772['query'][_0xab5e('0x49')]){_0x34af35[_0xab5e('0x42')]=[{'all':!![]}];}_0x34af35=_[_0xab5e('0x3f')]({},_0x34af35,_0x210772[_0xab5e('0x41')]);return db['Interval'][_0xab5e('0x4a')](_0x34af35)[_0xab5e('0x23')](handleEntityNotFound(_0x1e7f14,null))['then'](respondWithResult(_0x1e7f14,null))[_0xab5e('0x45')](handleError(_0x1e7f14,null));};exports[_0xab5e('0x4b')]=function(_0x4e44d0,_0x27bbd5){return db[_0xab5e('0x2d')][_0xab5e('0x4b')](_0x4e44d0[_0xab5e('0x4c')],{})['then'](function(_0x2bf70b){var _0x21d88b=_0x4e44d0[_0xab5e('0x4d')][_0xab5e('0x4e')]({'plain':!![]});if(!_0x21d88b)throw new Error(_0xab5e('0x4f'));if(_0x21d88b[_0xab5e('0x50')]==='user'){var _0x5bf3db=_0x2bf70b['get']({'plain':!![]});var _0x3ecc55=_0xab5e('0x25');return db[_0xab5e('0x51')][_0xab5e('0x4a')]({'where':{'name':_0x3ecc55,'userProfileId':_0x21d88b[_0xab5e('0x52')]},'raw':!![]})[_0xab5e('0x23')](function(_0x13d23a){if(_0x13d23a&&_0x13d23a[_0xab5e('0x53')]===0x0){return db['UserProfileResource'][_0xab5e('0x4b')]({'name':_0x5bf3db[_0xab5e('0x29')],'resourceId':_0x5bf3db['id'],'type':_0x13d23a[_0xab5e('0x29')],'sectionId':_0x13d23a['id']},{})[_0xab5e('0x23')](function(){return _0x2bf70b;});}else{return _0x2bf70b;}})[_0xab5e('0x45')](function(_0x301caa){logger[_0xab5e('0x27')](_0xab5e('0x54'),_0x301caa);throw _0x301caa;});}return _0x2bf70b;})['then'](respondWithResult(_0x27bbd5,0xc9))[_0xab5e('0x45')](handleError(_0x27bbd5,null));};exports[_0xab5e('0x22')]=function(_0x27f465,_0x207e57){if(_0x27f465[_0xab5e('0x4c')]['id']){delete _0x27f465[_0xab5e('0x4c')]['id'];}return db[_0xab5e('0x2d')][_0xab5e('0x4a')]({'where':{'id':_0x27f465[_0xab5e('0x47')]['id']}})['then'](handleEntityNotFound(_0x207e57,null))[_0xab5e('0x23')](saveUpdates(_0x27f465['body'],null))['then'](respondWithResult(_0x207e57,null))[_0xab5e('0x45')](handleError(_0x207e57,null));};exports[_0xab5e('0x24')]=function(_0x517559,_0x37b2ad){return db[_0xab5e('0x2d')][_0xab5e('0x4a')]({'where':{'id':_0x517559[_0xab5e('0x47')]['id']}})[_0xab5e('0x23')](handleEntityNotFound(_0x37b2ad,null))[_0xab5e('0x23')](removeEntity(_0x37b2ad,null))['catch'](handleError(_0x37b2ad,null));};exports[_0xab5e('0x55')]=function(_0x25d2a8,_0xc9ab6f,_0x2f8ad4){if(_0x25d2a8[_0xab5e('0x4c')]['id']){delete _0x25d2a8[_0xab5e('0x4c')]['id'];}return db[_0xab5e('0x2d')]['find']({'where':{'id':_0x25d2a8[_0xab5e('0x47')]['id']}})[_0xab5e('0x23')](handleEntityNotFound(_0xc9ab6f,null))[_0xab5e('0x23')](function(_0xe4138b){if(_0xe4138b){_0x25d2a8['body'][_0xab5e('0x56')]=_0xe4138b['id'];return db[_0xab5e('0x2d')][_0xab5e('0x4b')](_0x25d2a8[_0xab5e('0x4c')]);}})[_0xab5e('0x23')](respondWithResult(_0xc9ab6f,null))[_0xab5e('0x45')](handleError(_0xc9ab6f,null));};exports['getIntervals']=function(_0x1bc4ec,_0x1d7630,_0x15a2a9){var _0x48d394={};var _0x37be97={};var _0x5b8fc0;var _0x1d48b3;return db['Interval'][_0xab5e('0x57')]({'where':{'id':_0x1bc4ec['params']['id']}})[_0xab5e('0x23')](handleEntityNotFound(_0x1d7630,null))[_0xab5e('0x23')](function(_0x4988e3){if(_0x4988e3){_0x5b8fc0=_0x4988e3;_0x37be97[_0xab5e('0x30')]=_[_0xab5e('0x31')](db[_0xab5e('0x2d')][_0xab5e('0x48')]);_0x37be97[_0xab5e('0x32')]=_[_0xab5e('0x31')](_0x1bc4ec[_0xab5e('0x32')]);_0x37be97[_0xab5e('0x33')]=_[_0xab5e('0x34')](_0x37be97[_0xab5e('0x30')],_0x37be97[_0xab5e('0x32')]);_0x48d394['attributes']=_['intersection'](_0x37be97[_0xab5e('0x30')],qs[_0xab5e('0x36')](_0x1bc4ec[_0xab5e('0x32')][_0xab5e('0x36')]));_0x48d394[_0xab5e('0x35')]=_0x48d394[_0xab5e('0x35')][_0xab5e('0x37')]?_0x48d394['attributes']:_0x37be97[_0xab5e('0x30')];_0x48d394[_0xab5e('0x3a')]=qs[_0xab5e('0x3b')](_0x1bc4ec['query']['sort']);_0x48d394[_0xab5e('0x3c')]=qs[_0xab5e('0x33')](_['pick'](_0x1bc4ec[_0xab5e('0x32')],_0x37be97[_0xab5e('0x33')]));if(_0x1bc4ec['query'][_0xab5e('0x3e')]){_0x48d394[_0xab5e('0x3c')]=_[_0xab5e('0x3f')](_0x48d394[_0xab5e('0x3c')],{'$or':_[_0xab5e('0x2c')](_0x48d394[_0xab5e('0x35')],function(_0x18d805){var _0x4bc282={};_0x4bc282[_0x18d805]={'$like':'%'+_0x1bc4ec[_0xab5e('0x32')][_0xab5e('0x3e')]+'%'};return _0x4bc282;})});}_0x48d394=_['merge']({},_0x48d394,_0x1bc4ec[_0xab5e('0x41')]);return _0x5b8fc0['getIntervals'](_0x48d394);}})[_0xab5e('0x23')](function(_0x441606){if(_0x441606){_0x1d48b3=_0x441606[_0xab5e('0x37')];if(!_0x1bc4ec[_0xab5e('0x32')][_0xab5e('0x38')](_0xab5e('0x39'))){_0x48d394[_0xab5e('0x1f')]=qs[_0xab5e('0x1f')](_0x1bc4ec[_0xab5e('0x32')][_0xab5e('0x1f')]);_0x48d394[_0xab5e('0x1d')]=qs['offset'](_0x1bc4ec[_0xab5e('0x32')][_0xab5e('0x1d')]);}return _0x5b8fc0[_0xab5e('0x58')](_0x48d394);}})['then'](function(_0x50f240){if(_0x50f240){return _0x50f240?{'count':_0x1d48b3,'rows':_0x50f240}:null;}})[_0xab5e('0x23')](respondWithResult(_0x1d7630,null))[_0xab5e('0x45')](handleError(_0x1d7630,null));};exports[_0xab5e('0x59')]=function(_0x2b9d6c,_0x286f52,_0x2de3ad){return db[_0xab5e('0x2d')]['findOne']({'where':{'id':_0x2b9d6c[_0xab5e('0x47')]['id']}})['then'](handleEntityNotFound(_0x286f52,null))[_0xab5e('0x23')](function(_0x14d95f){if(_0x14d95f){return db[_0xab5e('0x5a')][_0xab5e('0x5b')](function(_0x3e3499){return db[_0xab5e('0x2d')][_0xab5e('0x24')]({'where':{'IntervalId':_0x2b9d6c['params']['id']},'transaction':_0x3e3499})[_0xab5e('0x23')](function(_0x5633b5){var _0x53910f=_[_0xab5e('0x2c')](_0x2b9d6c[_0xab5e('0x4c')],function(_0x2414a8){delete _0x2414a8['id'];_0x2414a8['IntervalId']=_0x2b9d6c[_0xab5e('0x47')]['id'];return _0x2414a8;});return db['Interval'][_0xab5e('0x5c')](_0x53910f,{'transaction':_0x3e3499});});})['then'](function(){return db[_0xab5e('0x2d')]['findAll']({'where':{'IntervalId':_0x2b9d6c['params']['id']}});});}})[_0xab5e('0x23')](respondWithResult(_0x286f52,null))[_0xab5e('0x45')](handleError(_0x286f52,null));}; \ No newline at end of file +var _0xd1e3=['params','includeAll','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addInterval','IntervalId','getIntervals','sort','options','addIntervals','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','get','Intervals','sendStatus','error','stack','name','send','index','Interval','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','include','findAll','catch','show'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd1e3,0xbd));var _0x3d1e=function(_0x19c6a6,_0x36701d){_0x19c6a6=_0x19c6a6-0x0;var _0x29014=_0xd1e3[_0x19c6a6];return _0x29014;};'use strict';var emlformat=require(_0x3d1e('0x0'));var rimraf=require(_0x3d1e('0x1'));var zipdir=require(_0x3d1e('0x2'));var jsonpatch=require(_0x3d1e('0x3'));var rp=require(_0x3d1e('0x4'));var moment=require('moment');var BPromise=require(_0x3d1e('0x5'));var Mustache=require(_0x3d1e('0x6'));var util=require(_0x3d1e('0x7'));var path=require(_0x3d1e('0x8'));var sox=require(_0x3d1e('0x9'));var csv=require(_0x3d1e('0xa'));var ejs=require(_0x3d1e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d1e('0xc'));var jsforce=require(_0x3d1e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d1e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3d1e('0xe'));var authService=require(_0x3d1e('0xf'));var qs=require(_0x3d1e('0x10'));var as=require(_0x3d1e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d1e('0x12'));var utils=require(_0x3d1e('0x13'));var config=require(_0x3d1e('0x14'));var licenseUtil=require(_0x3d1e('0x15'));var db=require(_0x3d1e('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x15c18b,_0x282332){_0x282332=_0x282332||0xcc;return function(_0x412f20){if(_0x412f20){return _0x15c18b['sendStatus'](_0x282332);}return _0x15c18b[_0x3d1e('0x17')](_0x282332)['end']();};}function respondWithResult(_0x16a47c,_0x3ba6d5){_0x3ba6d5=_0x3ba6d5||0xc8;return function(_0x45c0ff){if(_0x45c0ff){return _0x16a47c['status'](_0x3ba6d5)[_0x3d1e('0x18')](_0x45c0ff);}};}function respondWithFilteredResult(_0x4ea531,_0x3b9919){return function(_0x58d34d){if(_0x58d34d){var _0x5d6996=typeof _0x3b9919['offset']===_0x3d1e('0x19')&&typeof _0x3b9919[_0x3d1e('0x1a')]===_0x3d1e('0x19');var _0x318c73=_0x58d34d[_0x3d1e('0x1b')];var _0x5a0f4f=_0x5d6996?0x0:_0x3b9919[_0x3d1e('0x1c')];var _0x4de073=_0x5d6996?_0x58d34d['count']:_0x3b9919[_0x3d1e('0x1c')]+_0x3b9919['limit'];var _0x4ade40;if(_0x4de073>=_0x318c73){_0x4de073=_0x318c73;_0x4ade40=0xc8;}else{_0x4ade40=0xce;}_0x4ea531[_0x3d1e('0x17')](_0x4ade40);return _0x4ea531[_0x3d1e('0x1d')](_0x3d1e('0x1e'),_0x5a0f4f+'-'+_0x4de073+'/'+_0x318c73)['json'](_0x58d34d);}return null;};}function patchUpdates(_0x503bb6){return function(_0x78ac02){try{jsonpatch['apply'](_0x78ac02,_0x503bb6,!![]);}catch(_0x5ce6c6){return BPromise['reject'](_0x5ce6c6);}return _0x78ac02[_0x3d1e('0x1f')]();};}function saveUpdates(_0x5f135a,_0x489eac){return function(_0x4fca8d){if(_0x4fca8d){return _0x4fca8d[_0x3d1e('0x20')](_0x5f135a)[_0x3d1e('0x21')](function(_0x47ced5){return _0x47ced5;});}return null;};}function removeEntity(_0x472293,_0x4bab8d){return function(_0x476bc6){if(_0x476bc6){return _0x476bc6['destroy']()[_0x3d1e('0x21')](function(){var _0x13eb8b=_0x476bc6[_0x3d1e('0x22')]({'plain':!![]});var _0x5f4316=_0x3d1e('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x5f4316,'resourceId':_0x13eb8b['id']}})[_0x3d1e('0x21')](function(){return _0x476bc6;});})[_0x3d1e('0x21')](function(){_0x472293[_0x3d1e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8f9009,_0x2df334){return function(_0x3516c8){if(!_0x3516c8){_0x8f9009[_0x3d1e('0x24')](0x194);}return _0x3516c8;};}function handleError(_0x57d9f2,_0x2c8369){_0x2c8369=_0x2c8369||0x1f4;return function(_0x328aeb){logger[_0x3d1e('0x25')](_0x328aeb[_0x3d1e('0x26')]);if(_0x328aeb[_0x3d1e('0x27')]){delete _0x328aeb[_0x3d1e('0x27')];}_0x57d9f2['status'](_0x2c8369)[_0x3d1e('0x28')](_0x328aeb);};}exports[_0x3d1e('0x29')]=function(_0x1058dc,_0x199859){var _0x59d61e={},_0x1dfa71={},_0x30c0f9={'count':0x0,'rows':[]};var _0x1b6f8d=_['map'](db[_0x3d1e('0x2a')][_0x3d1e('0x2b')],function(_0x483ec9){return{'name':_0x483ec9[_0x3d1e('0x2c')],'type':_0x483ec9[_0x3d1e('0x2d')][_0x3d1e('0x2e')]};});_0x1dfa71[_0x3d1e('0x2f')]=_[_0x3d1e('0x30')](_0x1b6f8d,_0x3d1e('0x27'));_0x1dfa71[_0x3d1e('0x31')]=_[_0x3d1e('0x32')](_0x1058dc[_0x3d1e('0x31')]);_0x1dfa71[_0x3d1e('0x33')]=_[_0x3d1e('0x34')](_0x1dfa71[_0x3d1e('0x2f')],_0x1dfa71[_0x3d1e('0x31')]);_0x59d61e[_0x3d1e('0x35')]=_[_0x3d1e('0x34')](_0x1dfa71[_0x3d1e('0x2f')],qs[_0x3d1e('0x36')](_0x1058dc[_0x3d1e('0x31')][_0x3d1e('0x36')]));_0x59d61e['attributes']=_0x59d61e[_0x3d1e('0x35')][_0x3d1e('0x37')]?_0x59d61e[_0x3d1e('0x35')]:_0x1dfa71[_0x3d1e('0x2f')];if(!_0x1058dc[_0x3d1e('0x31')][_0x3d1e('0x38')](_0x3d1e('0x39'))){_0x59d61e[_0x3d1e('0x1a')]=qs['limit'](_0x1058dc[_0x3d1e('0x31')]['limit']);_0x59d61e['offset']=qs['offset'](_0x1058dc['query']['offset']);}_0x59d61e[_0x3d1e('0x3a')]=qs['sort'](_0x1058dc[_0x3d1e('0x31')]['sort']);_0x59d61e[_0x3d1e('0x3b')]=qs[_0x3d1e('0x33')](_['pick'](_0x1058dc[_0x3d1e('0x31')],_0x1dfa71[_0x3d1e('0x33')]),_0x1b6f8d);if(_0x1058dc[_0x3d1e('0x31')][_0x3d1e('0x3c')]){_0x59d61e[_0x3d1e('0x3b')]=_[_0x3d1e('0x3d')](_0x59d61e[_0x3d1e('0x3b')],{'$or':_[_0x3d1e('0x30')](_0x1b6f8d,function(_0x27f37c){if(_0x27f37c[_0x3d1e('0x2d')]!=='VIRTUAL'){var _0xcbbcd5={};_0xcbbcd5[_0x27f37c[_0x3d1e('0x27')]]={'$like':'%'+_0x1058dc['query']['filter']+'%'};return _0xcbbcd5;}})});}_0x59d61e=_['merge']({},_0x59d61e,_0x1058dc['options']);var _0x2f8f16={'where':_0x59d61e[_0x3d1e('0x3b')]};return db['Interval']['count'](_0x2f8f16)['then'](function(_0x28cbcf){_0x30c0f9[_0x3d1e('0x1b')]=_0x28cbcf;if(_0x1058dc['query']['includeAll']){_0x59d61e[_0x3d1e('0x3e')]=[{'all':!![]}];}return db['Interval'][_0x3d1e('0x3f')](_0x59d61e);})[_0x3d1e('0x21')](function(_0x2d58a8){_0x30c0f9['rows']=_0x2d58a8;return _0x30c0f9;})[_0x3d1e('0x21')](respondWithFilteredResult(_0x199859,_0x59d61e))[_0x3d1e('0x40')](handleError(_0x199859,null));};exports[_0x3d1e('0x41')]=function(_0x523763,_0x35bfb2){var _0x3801e5={'raw':!![],'where':{'id':_0x523763[_0x3d1e('0x42')]['id']}},_0x581402={};_0x581402[_0x3d1e('0x2f')]=_['keys'](db['Interval']['rawAttributes']);_0x581402[_0x3d1e('0x31')]=_['keys'](_0x523763[_0x3d1e('0x31')]);_0x581402[_0x3d1e('0x33')]=_[_0x3d1e('0x34')](_0x581402['model'],_0x581402[_0x3d1e('0x31')]);_0x3801e5[_0x3d1e('0x35')]=_[_0x3d1e('0x34')](_0x581402[_0x3d1e('0x2f')],qs[_0x3d1e('0x36')](_0x523763[_0x3d1e('0x31')][_0x3d1e('0x36')]));_0x3801e5['attributes']=_0x3801e5['attributes'][_0x3d1e('0x37')]?_0x3801e5[_0x3d1e('0x35')]:_0x581402[_0x3d1e('0x2f')];if(_0x523763['query'][_0x3d1e('0x43')]){_0x3801e5[_0x3d1e('0x3e')]=[{'all':!![]}];}_0x3801e5=_[_0x3d1e('0x3d')]({},_0x3801e5,_0x523763['options']);return db['Interval']['find'](_0x3801e5)[_0x3d1e('0x21')](handleEntityNotFound(_0x35bfb2,null))['then'](respondWithResult(_0x35bfb2,null))[_0x3d1e('0x40')](handleError(_0x35bfb2,null));};exports[_0x3d1e('0x44')]=function(_0x56cc7f,_0x47927d){return db[_0x3d1e('0x2a')][_0x3d1e('0x44')](_0x56cc7f['body'],{})[_0x3d1e('0x21')](function(_0x27b4e0){var _0x1c6e42=_0x56cc7f[_0x3d1e('0x45')][_0x3d1e('0x22')]({'plain':!![]});if(!_0x1c6e42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6e42[_0x3d1e('0x46')]===_0x3d1e('0x45')){var _0x4f6251=_0x27b4e0['get']({'plain':!![]});var _0x20d124=_0x3d1e('0x23');return db[_0x3d1e('0x47')][_0x3d1e('0x48')]({'where':{'name':_0x20d124,'userProfileId':_0x1c6e42[_0x3d1e('0x49')]},'raw':!![]})['then'](function(_0x1057c1){if(_0x1057c1&&_0x1057c1[_0x3d1e('0x4a')]===0x0){return db[_0x3d1e('0x4b')][_0x3d1e('0x44')]({'name':_0x4f6251[_0x3d1e('0x27')],'resourceId':_0x4f6251['id'],'type':_0x1057c1[_0x3d1e('0x27')],'sectionId':_0x1057c1['id']},{})[_0x3d1e('0x21')](function(){return _0x27b4e0;});}else{return _0x27b4e0;}})[_0x3d1e('0x40')](function(_0x1a3d36){logger[_0x3d1e('0x25')](_0x3d1e('0x4c'),_0x1a3d36);throw _0x1a3d36;});}return _0x27b4e0;})['then'](respondWithResult(_0x47927d,0xc9))[_0x3d1e('0x40')](handleError(_0x47927d,null));};exports[_0x3d1e('0x20')]=function(_0x1f1bc0,_0x32da9c){if(_0x1f1bc0[_0x3d1e('0x4d')]['id']){delete _0x1f1bc0[_0x3d1e('0x4d')]['id'];}return db[_0x3d1e('0x2a')][_0x3d1e('0x48')]({'where':{'id':_0x1f1bc0['params']['id']}})[_0x3d1e('0x21')](handleEntityNotFound(_0x32da9c,null))[_0x3d1e('0x21')](saveUpdates(_0x1f1bc0[_0x3d1e('0x4d')],null))[_0x3d1e('0x21')](respondWithResult(_0x32da9c,null))[_0x3d1e('0x40')](handleError(_0x32da9c,null));};exports[_0x3d1e('0x4e')]=function(_0x295042,_0x52ab71){return db[_0x3d1e('0x2a')][_0x3d1e('0x48')]({'where':{'id':_0x295042[_0x3d1e('0x42')]['id']}})[_0x3d1e('0x21')](handleEntityNotFound(_0x52ab71,null))['then'](removeEntity(_0x52ab71,null))[_0x3d1e('0x40')](handleError(_0x52ab71,null));};exports[_0x3d1e('0x4f')]=function(_0x16b67f,_0x5ce76a,_0x1c8a73){if(_0x16b67f[_0x3d1e('0x4d')]['id']){delete _0x16b67f[_0x3d1e('0x4d')]['id'];}return db[_0x3d1e('0x2a')][_0x3d1e('0x48')]({'where':{'id':_0x16b67f[_0x3d1e('0x42')]['id']}})[_0x3d1e('0x21')](handleEntityNotFound(_0x5ce76a,null))[_0x3d1e('0x21')](function(_0x54ccbc){if(_0x54ccbc){_0x16b67f['body'][_0x3d1e('0x50')]=_0x54ccbc['id'];return db[_0x3d1e('0x2a')][_0x3d1e('0x44')](_0x16b67f[_0x3d1e('0x4d')]);}})['then'](respondWithResult(_0x5ce76a,null))['catch'](handleError(_0x5ce76a,null));};exports[_0x3d1e('0x51')]=function(_0xce30c2,_0x15145f,_0x45ff34){var _0x374fcf={};var _0x2a3104={};var _0x38c4be;var _0x3c5a16;return db[_0x3d1e('0x2a')]['findOne']({'where':{'id':_0xce30c2['params']['id']}})[_0x3d1e('0x21')](handleEntityNotFound(_0x15145f,null))[_0x3d1e('0x21')](function(_0x7da478){if(_0x7da478){_0x38c4be=_0x7da478;_0x2a3104[_0x3d1e('0x2f')]=_[_0x3d1e('0x32')](db[_0x3d1e('0x2a')][_0x3d1e('0x2b')]);_0x2a3104[_0x3d1e('0x31')]=_[_0x3d1e('0x32')](_0xce30c2['query']);_0x2a3104[_0x3d1e('0x33')]=_[_0x3d1e('0x34')](_0x2a3104[_0x3d1e('0x2f')],_0x2a3104[_0x3d1e('0x31')]);_0x374fcf['attributes']=_['intersection'](_0x2a3104['model'],qs[_0x3d1e('0x36')](_0xce30c2[_0x3d1e('0x31')]['fields']));_0x374fcf[_0x3d1e('0x35')]=_0x374fcf[_0x3d1e('0x35')][_0x3d1e('0x37')]?_0x374fcf[_0x3d1e('0x35')]:_0x2a3104['model'];_0x374fcf[_0x3d1e('0x3a')]=qs[_0x3d1e('0x52')](_0xce30c2['query']['sort']);_0x374fcf['where']=qs[_0x3d1e('0x33')](_['pick'](_0xce30c2[_0x3d1e('0x31')],_0x2a3104['filters']));if(_0xce30c2['query'][_0x3d1e('0x3c')]){_0x374fcf[_0x3d1e('0x3b')]=_[_0x3d1e('0x3d')](_0x374fcf[_0x3d1e('0x3b')],{'$or':_[_0x3d1e('0x30')](_0x374fcf[_0x3d1e('0x35')],function(_0xa0f58f){var _0x30764a={};_0x30764a[_0xa0f58f]={'$like':'%'+_0xce30c2[_0x3d1e('0x31')][_0x3d1e('0x3c')]+'%'};return _0x30764a;})});}_0x374fcf=_[_0x3d1e('0x3d')]({},_0x374fcf,_0xce30c2[_0x3d1e('0x53')]);return _0x38c4be[_0x3d1e('0x51')](_0x374fcf);}})['then'](function(_0x38e2d7){if(_0x38e2d7){_0x3c5a16=_0x38e2d7[_0x3d1e('0x37')];if(!_0xce30c2[_0x3d1e('0x31')][_0x3d1e('0x38')]('nolimit')){_0x374fcf[_0x3d1e('0x1a')]=qs[_0x3d1e('0x1a')](_0xce30c2[_0x3d1e('0x31')][_0x3d1e('0x1a')]);_0x374fcf[_0x3d1e('0x1c')]=qs[_0x3d1e('0x1c')](_0xce30c2['query'][_0x3d1e('0x1c')]);}return _0x38c4be[_0x3d1e('0x51')](_0x374fcf);}})[_0x3d1e('0x21')](function(_0x574580){if(_0x574580){return _0x574580?{'count':_0x3c5a16,'rows':_0x574580}:null;}})[_0x3d1e('0x21')](respondWithResult(_0x15145f,null))[_0x3d1e('0x40')](handleError(_0x15145f,null));};exports[_0x3d1e('0x54')]=function(_0x33b987,_0x1b421b,_0x2d8f4a){return db[_0x3d1e('0x2a')]['findOne']({'where':{'id':_0x33b987[_0x3d1e('0x42')]['id']}})[_0x3d1e('0x21')](handleEntityNotFound(_0x1b421b,null))[_0x3d1e('0x21')](function(_0x407314){if(_0x407314){return db['sequelize']['transaction'](function(_0x5845a5){return db[_0x3d1e('0x2a')][_0x3d1e('0x4e')]({'where':{'IntervalId':_0x33b987[_0x3d1e('0x42')]['id']},'transaction':_0x5845a5})[_0x3d1e('0x21')](function(_0x4695e0){var _0x4f2ce7=_[_0x3d1e('0x30')](_0x33b987[_0x3d1e('0x4d')],function(_0x5e8484){delete _0x5e8484['id'];_0x5e8484[_0x3d1e('0x50')]=_0x33b987[_0x3d1e('0x42')]['id'];return _0x5e8484;});return db['Interval']['bulkCreate'](_0x4f2ce7,{'transaction':_0x5845a5});});})[_0x3d1e('0x21')](function(){return db[_0x3d1e('0x2a')][_0x3d1e('0x3f')]({'where':{'IntervalId':_0x33b987['params']['id']}});});}})[_0x3d1e('0x21')](respondWithResult(_0x1b421b,null))['catch'](handleError(_0x1b421b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2a7621c..29c168c 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 _0x9e0c=['../../utils/iftime','iftime','tools_intervals','rewrite','interval','getIntervals','then','all','map','ifTime','reduce'];(function(_0x3067d0,_0x53b245){var _0x5807a2=function(_0x347f3a){while(--_0x347f3a){_0x3067d0['push'](_0x3067d0['shift']());}};_0x5807a2(++_0x53b245);}(_0x9e0c,0x1ef));var _0xc9e0=function(_0x8279b4,_0x4cec19){_0x8279b4=_0x8279b4-0x0;var _0x5b5e40=_0x9e0c[_0x8279b4];return _0x5b5e40;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xc9e0('0x0'))[_0xc9e0('0x1')];module['exports']=function(_0x3d2f78){return _0x3d2f78['define']('Interval',attributes,{'tableName':_0xc9e0('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2be0aa){extensions[_0xc9e0('0x3')](_0x3d2f78,_0x2be0aa);},'afterBulkCreate':function(_0x26c35b,_0x392650,_0x336496){_0x336496();extensions[_0xc9e0('0x3')](_0x3d2f78,_0x26c35b[0x0]);},'afterUpdate':function(_0x4b936e){extensions[_0xc9e0('0x3')](_0x3d2f78,_0x4b936e);},'afterDestroy':function(_0x3bc025){extensions[_0xc9e0('0x3')](_0x3d2f78,_0x3bc025);}},'instanceMethods':{'ifTime':function(_0x4c3f9f=undefined,_0x4884a8=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0xc9e0('0x4')],_0x4c3f9f,_0x4884a8);}else{return this[_0xc9e0('0x5')]()[_0xc9e0('0x6')](function(_0x15410d){return Promise[_0xc9e0('0x7')](_0x15410d[_0xc9e0('0x8')](function(_0x468b26){return _0x468b26[_0xc9e0('0x9')](_0x4c3f9f,_0x4884a8);}));})[_0xc9e0('0x6')](function(_0x1be345){return _0x1be345[_0xc9e0('0xa')](function(_0x4e2039,_0x253e53){return _0x4e2039||_0x253e53;},![]);});}}}});}; \ No newline at end of file +var _0xcf1c=['rewrite','interval','all','map','then','./interval.attributes','../../utils/iftime','iftime','exports','define','Interval','tools_intervals'];(function(_0x1e6d2d,_0x49ddbf){var _0x310487=function(_0x140857){while(--_0x140857){_0x1e6d2d['push'](_0x1e6d2d['shift']());}};_0x310487(++_0x49ddbf);}(_0xcf1c,0x1c1));var _0xccf1=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0xcf1c[_0x30faee];return _0x3a90ab;};'use strict';var attributes=require(_0xccf1('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xccf1('0x1'))[_0xccf1('0x2')];module[_0xccf1('0x3')]=function(_0x3a0361){return _0x3a0361[_0xccf1('0x4')](_0xccf1('0x5'),attributes,{'tableName':_0xccf1('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x124a28){extensions[_0xccf1('0x7')](_0x3a0361,_0x124a28);},'afterBulkCreate':function(_0x1d967d,_0x3f7238,_0x24efaa){_0x24efaa();extensions[_0xccf1('0x7')](_0x3a0361,_0x1d967d[0x0]);},'afterUpdate':function(_0x3535df){extensions[_0xccf1('0x7')](_0x3a0361,_0x3535df);},'afterDestroy':function(_0x3e09cc){extensions[_0xccf1('0x7')](_0x3a0361,_0x3e09cc);}},'instanceMethods':{'ifTime':function(_0x534652=undefined,_0x1b0cb9=new Date()){if(typeof this[_0xccf1('0x8')]==='string'){return iftime(this['interval'],_0x534652,_0x1b0cb9);}else{return this['getIntervals']()['then'](function(_0x583c97){return Promise[_0xccf1('0x9')](_0x583c97[_0xccf1('0xa')](function(_0x5a0f2f){return _0x5a0f2f['ifTime'](_0x534652,_0x1b0cb9);}));})[_0xccf1('0xb')](function(_0x2c72cb){return _0x2c72cb['reduce'](function(_0x4b78c9,_0x1d2a72){return _0x4b78c9||_0x1d2a72;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 04c951f..89c519e 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 _0xf16f=['findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','isArray','intervals','string','timezone','length','Iftime','silly','resolve','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','limit','map','model','attributes','include','info','debug','stringify','catch','error','message','ShowInterval','find','then','ifTime','format','join'];(function(_0x13b6e4,_0x5375eb){var _0x41e1f7=function(_0x3c3ad7){while(--_0x3c3ad7){_0x13b6e4['push'](_0x13b6e4['shift']());}};_0x41e1f7(++_0x5375eb);}(_0xf16f,0xb5));var _0xff16=function(_0x171c3e,_0x4873ea){_0x171c3e=_0x171c3e-0x0;var _0xa79a83=_0xf16f[_0x171c3e];return _0xa79a83;};'use strict';var _=require(_0xff16('0x0'));var util=require('util');var db=require(_0xff16('0x1'))['db'];var iftime=require(_0xff16('0x2'))[_0xff16('0x3')];var logger=require(_0xff16('0x4'))(_0xff16('0x5'));exports[_0xff16('0x6')]=function(_0x5c9d24){var _0x342e40=this;return new Promise(function(_0x3bedca,_0x52546b){return db[_0xff16('0x7')][_0xff16('0x8')]({'raw':_0x5c9d24[_0xff16('0x9')]?_0x5c9d24['options'][_0xff16('0xa')]===undefined?!![]:![]:!![],'where':_0x5c9d24[_0xff16('0x9')]?_0x5c9d24[_0xff16('0x9')][_0xff16('0xb')]||null:null,'attributes':_0x5c9d24[_0xff16('0x9')]?_0x5c9d24[_0xff16('0x9')]['attributes']||null:null,'limit':_0x5c9d24[_0xff16('0x9')]?_0x5c9d24[_0xff16('0x9')][_0xff16('0xc')]||null:null,'include':_0x5c9d24[_0xff16('0x9')]?_0x5c9d24[_0xff16('0x9')]['include']?_[_0xff16('0xd')](_0x5c9d24[_0xff16('0x9')]['include'],function(_0x46c3a9){return{'model':db[_0x46c3a9[_0xff16('0xe')]],'as':_0x46c3a9['as'],'attributes':_0x46c3a9[_0xff16('0xf')],'include':_0x46c3a9[_0xff16('0x10')]?_[_0xff16('0xd')](_0x46c3a9[_0xff16('0x10')],function(_0x21328b){return{'model':db[_0x21328b[_0xff16('0xe')]],'as':_0x21328b['as'],'attributes':_0x21328b[_0xff16('0xf')],'include':_0x21328b['include']?_[_0xff16('0xd')](_0x21328b['include'],function(_0x468426){return{'model':db[_0x468426[_0xff16('0xe')]],'as':_0x468426['as'],'attributes':_0x468426[_0xff16('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x255d55){logger[_0xff16('0x11')](_0xff16('0x6'),_0x5c9d24);logger[_0xff16('0x12')](_0xff16('0x6'),_0x5c9d24,JSON[_0xff16('0x13')](_0x255d55));_0x3bedca(_0x255d55);})[_0xff16('0x14')](function(_0x3bc705){logger[_0xff16('0x15')](_0xff16('0x6'),_0x3bc705[_0xff16('0x16')],_0x5c9d24);_0x52546b(_0x342e40[_0xff16('0x15')](0x1f4,_0x3bc705[_0xff16('0x16')]));});});};exports[_0xff16('0x17')]=function(_0x326cbc){var _0x1252ed=this;return new Promise(function(_0x15b455,_0x5dc0c5){return db[_0xff16('0x7')][_0xff16('0x18')]({'raw':_0x326cbc[_0xff16('0x9')]?_0x326cbc[_0xff16('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x326cbc[_0xff16('0x9')]?_0x326cbc['options']['where']||null:null,'attributes':_0x326cbc['options']?_0x326cbc['options'][_0xff16('0xf')]||null:null,'include':_0x326cbc[_0xff16('0x9')]?_0x326cbc['options'][_0xff16('0x10')]?_['map'](_0x326cbc[_0xff16('0x9')][_0xff16('0x10')],function(_0xba1f7b){return{'model':db[_0xba1f7b[_0xff16('0xe')]],'as':_0xba1f7b['as'],'attributes':_0xba1f7b[_0xff16('0xf')],'include':_0xba1f7b['include']?_[_0xff16('0xd')](_0xba1f7b[_0xff16('0x10')],function(_0x197a35){return{'model':db[_0x197a35[_0xff16('0xe')]],'as':_0x197a35['as'],'attributes':_0x197a35[_0xff16('0xf')],'include':_0x197a35['include']?_['map'](_0x197a35[_0xff16('0x10')],function(_0x146ded){return{'model':db[_0x146ded[_0xff16('0xe')]],'as':_0x146ded['as'],'attributes':_0x146ded['attributes']};}):[]};}):[]};}):[]:[]})[_0xff16('0x19')](function(_0x55aa0e){logger[_0xff16('0x11')](_0xff16('0x17'),_0x326cbc);logger['debug'](_0xff16('0x17'),_0x326cbc,JSON[_0xff16('0x13')](_0x55aa0e));_0x15b455(_0x55aa0e);})[_0xff16('0x14')](function(_0x34d76a){logger[_0xff16('0x15')](_0xff16('0x17'),_0x34d76a['message'],_0x326cbc);_0x5dc0c5(_0x1252ed['error'](0x1f4,_0x34d76a[_0xff16('0x16')]));});});};function checkArrayOfIntervals(_0x7cde5f,_0x283349){var _0x3aca62=[];return db[_0xff16('0x7')][_0xff16('0x8')]({'where':{'id':_0x7cde5f}})[_0xff16('0x19')](function(_0x409abb){_0x3aca62=_0x409abb;return Promise['all'](_0x3aca62['map'](function(_0x8d07b2){return _0x8d07b2[_0xff16('0x1a')](_0x283349);}));})[_0xff16('0x19')](function(_0x1dcbac){var _0x3e7011=_0x1dcbac['reduce'](function(_0x31dd99,_0x3db350){return _0x31dd99||_0x3db350;},![]);logger[_0xff16('0x11')](util[_0xff16('0x1b')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x3aca62[_0xff16('0xd')](function(_0x44b76e){return _0x44b76e['name'];})[_0xff16('0x1c')](',\x20'),_0x3aca62[_0xff16('0xd')](function(_0x4b0575){return _0x4b0575['id'];})[_0xff16('0x1c')](',\x20')));return _0x3e7011;});}function checkSingleInterval(_0x469793,_0x17d544){return db['Interval'][_0xff16('0x1d')](_0x469793)[_0xff16('0x19')](function(_0xf0f6a5){if(_0xf0f6a5){logger[_0xff16('0x11')](util[_0xff16('0x1b')](_0xff16('0x1e'),_0xf0f6a5[_0xff16('0x1f')],_0xf0f6a5['id']));return _0xf0f6a5[_0xff16('0x1a')](_0x17d544);}});}exports[_0xff16('0x20')]=function(_0xca7de){var _0x10b85d=_0xca7de['intervalIds'];var _0x608c1=Array[_0xff16('0x21')](_0xca7de[_0xff16('0x22')])?_0xca7de[_0xff16('0x22')]:typeof _0xca7de['intervals']===_0xff16('0x23')?[_0xca7de[_0xff16('0x22')]]:[];var _0x21c7b4=_0xca7de[_0xff16('0x24')]||undefined;var _0x5c692f=![];if(_0x608c1[_0xff16('0x25')]){logger[_0xff16('0x11')](util[_0xff16('0x1b')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x608c1[_0xff16('0x1c')](';\x20')));}if(_0x21c7b4){logger[_0xff16('0x11')](util[_0xff16('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x21c7b4));}logger[_0xff16('0x12')](_0xff16('0x26'),_0x5c692f);logger[_0xff16('0x27')](_0xff16('0x20'),_0xca7de);return Promise[_0xff16('0x28')]()[_0xff16('0x19')](function(){if(Array[_0xff16('0x21')](_0x10b85d)){return checkArrayOfIntervals(_0x10b85d,_0x21c7b4);}else if(_0x10b85d){return checkSingleInterval(_0x10b85d,_0x21c7b4);}})[_0xff16('0x19')](function(_0x2cb438){var _0x1e59d8=_0x608c1[_0xff16('0x29')](function(_0x49efb7,_0x49010c){return _0x49efb7||iftime(_0x49010c,_0x21c7b4);},![]);_0x5c692f=_0x2cb438||_0x1e59d8;return _0x5c692f;})[_0xff16('0x14')](function(_0x579da5){logger[_0xff16('0x15')](_0xff16('0x20'),_0xca7de,_0x579da5);throw this[_0xff16('0x15')](0x1f4,_0x579da5[_0xff16('0x16')]);});}; \ No newline at end of file +var _0x5aab=['silly','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','attributes','map','include','model','then','info','debug','stringify','catch','error','message','ShowInterval','where','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5aab,0xb1));var _0xb5aa=function(_0x32a0e1,_0x40b319){_0x32a0e1=_0x32a0e1-0x0;var _0x2a5afd=_0x5aab[_0x32a0e1];return _0x2a5afd;};'use strict';var _=require(_0xb5aa('0x0'));var util=require(_0xb5aa('0x1'));var db=require(_0xb5aa('0x2'))['db'];var iftime=require(_0xb5aa('0x3'))[_0xb5aa('0x4')];var logger=require(_0xb5aa('0x5'))(_0xb5aa('0x6'));exports[_0xb5aa('0x7')]=function(_0x3ebbde){var _0x1f60c2=this;return new Promise(function(_0x1e07c8,_0x26e626){return db[_0xb5aa('0x8')][_0xb5aa('0x9')]({'raw':_0x3ebbde[_0xb5aa('0xa')]?_0x3ebbde[_0xb5aa('0xa')][_0xb5aa('0xb')]===undefined?!![]:![]:!![],'where':_0x3ebbde[_0xb5aa('0xa')]?_0x3ebbde[_0xb5aa('0xa')]['where']||null:null,'attributes':_0x3ebbde[_0xb5aa('0xa')]?_0x3ebbde[_0xb5aa('0xa')][_0xb5aa('0xc')]||null:null,'limit':_0x3ebbde[_0xb5aa('0xa')]?_0x3ebbde[_0xb5aa('0xa')]['limit']||null:null,'include':_0x3ebbde[_0xb5aa('0xa')]?_0x3ebbde[_0xb5aa('0xa')]['include']?_[_0xb5aa('0xd')](_0x3ebbde['options'][_0xb5aa('0xe')],function(_0x144d88){return{'model':db[_0x144d88['model']],'as':_0x144d88['as'],'attributes':_0x144d88['attributes'],'include':_0x144d88['include']?_[_0xb5aa('0xd')](_0x144d88['include'],function(_0x37fcc3){return{'model':db[_0x37fcc3[_0xb5aa('0xf')]],'as':_0x37fcc3['as'],'attributes':_0x37fcc3['attributes'],'include':_0x37fcc3[_0xb5aa('0xe')]?_[_0xb5aa('0xd')](_0x37fcc3['include'],function(_0x5f23d1){return{'model':db[_0x5f23d1['model']],'as':_0x5f23d1['as'],'attributes':_0x5f23d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5aa('0x10')](function(_0x2f7036){logger[_0xb5aa('0x11')]('GetInterval',_0x3ebbde);logger[_0xb5aa('0x12')](_0xb5aa('0x7'),_0x3ebbde,JSON[_0xb5aa('0x13')](_0x2f7036));_0x1e07c8(_0x2f7036);})[_0xb5aa('0x14')](function(_0x163042){logger[_0xb5aa('0x15')](_0xb5aa('0x7'),_0x163042['message'],_0x3ebbde);_0x26e626(_0x1f60c2['error'](0x1f4,_0x163042[_0xb5aa('0x16')]));});});};exports[_0xb5aa('0x17')]=function(_0x31f964){var _0x150551=this;return new Promise(function(_0x24a6d3,_0x4f30fc){return db['Interval']['find']({'raw':_0x31f964['options']?_0x31f964['options'][_0xb5aa('0xb')]===undefined?!![]:![]:!![],'where':_0x31f964[_0xb5aa('0xa')]?_0x31f964[_0xb5aa('0xa')][_0xb5aa('0x18')]||null:null,'attributes':_0x31f964[_0xb5aa('0xa')]?_0x31f964[_0xb5aa('0xa')]['attributes']||null:null,'include':_0x31f964[_0xb5aa('0xa')]?_0x31f964[_0xb5aa('0xa')][_0xb5aa('0xe')]?_[_0xb5aa('0xd')](_0x31f964[_0xb5aa('0xa')][_0xb5aa('0xe')],function(_0x413ae2){return{'model':db[_0x413ae2[_0xb5aa('0xf')]],'as':_0x413ae2['as'],'attributes':_0x413ae2[_0xb5aa('0xc')],'include':_0x413ae2[_0xb5aa('0xe')]?_['map'](_0x413ae2[_0xb5aa('0xe')],function(_0x5bc7b4){return{'model':db[_0x5bc7b4[_0xb5aa('0xf')]],'as':_0x5bc7b4['as'],'attributes':_0x5bc7b4[_0xb5aa('0xc')],'include':_0x5bc7b4[_0xb5aa('0xe')]?_[_0xb5aa('0xd')](_0x5bc7b4[_0xb5aa('0xe')],function(_0x3c8366){return{'model':db[_0x3c8366[_0xb5aa('0xf')]],'as':_0x3c8366['as'],'attributes':_0x3c8366[_0xb5aa('0xc')]};}):[]};}):[]};}):[]:[]})[_0xb5aa('0x10')](function(_0x3e67cf){logger[_0xb5aa('0x11')](_0xb5aa('0x17'),_0x31f964);logger[_0xb5aa('0x12')](_0xb5aa('0x17'),_0x31f964,JSON[_0xb5aa('0x13')](_0x3e67cf));_0x24a6d3(_0x3e67cf);})[_0xb5aa('0x14')](function(_0x3e384e){logger[_0xb5aa('0x15')](_0xb5aa('0x17'),_0x3e384e['message'],_0x31f964);_0x4f30fc(_0x150551[_0xb5aa('0x15')](0x1f4,_0x3e384e[_0xb5aa('0x16')]));});});};function checkArrayOfIntervals(_0x4ff8fe,_0x3286bb){var _0x23629f=[];return db['Interval'][_0xb5aa('0x9')]({'where':{'id':_0x4ff8fe}})[_0xb5aa('0x10')](function(_0x2edef8){_0x23629f=_0x2edef8;return Promise[_0xb5aa('0x19')](_0x23629f['map'](function(_0x1fec55){return _0x1fec55[_0xb5aa('0x1a')](_0x3286bb);}));})['then'](function(_0x48cc0f){var _0x4bb588=_0x48cc0f[_0xb5aa('0x1b')](function(_0x3b7555,_0x3f0c13){return _0x3b7555||_0x3f0c13;},![]);logger[_0xb5aa('0x11')](util['format'](_0xb5aa('0x1c'),_0x23629f['map'](function(_0x57b49b){return _0x57b49b[_0xb5aa('0x1d')];})[_0xb5aa('0x1e')](',\x20'),_0x23629f[_0xb5aa('0xd')](function(_0x229ee7){return _0x229ee7['id'];})[_0xb5aa('0x1e')](',\x20')));return _0x4bb588;});}function checkSingleInterval(_0xa4fbe2,_0x3d42fd){return db[_0xb5aa('0x8')][_0xb5aa('0x1f')](_0xa4fbe2)[_0xb5aa('0x10')](function(_0x12ada9){if(_0x12ada9){logger['info'](util[_0xb5aa('0x20')](_0xb5aa('0x21'),_0x12ada9[_0xb5aa('0x1d')],_0x12ada9['id']));return _0x12ada9['ifTime'](_0x3d42fd);}});}exports[_0xb5aa('0x22')]=function(_0xbe5c47){var _0x2fbf9f=_0xbe5c47[_0xb5aa('0x23')];var _0x288371=Array[_0xb5aa('0x24')](_0xbe5c47[_0xb5aa('0x25')])?_0xbe5c47[_0xb5aa('0x25')]:typeof _0xbe5c47['intervals']===_0xb5aa('0x26')?[_0xbe5c47['intervals']]:[];var _0x2e2c4e=_0xbe5c47[_0xb5aa('0x27')]||undefined;var _0x270504=![];if(_0x288371[_0xb5aa('0x28')]){logger[_0xb5aa('0x11')](util[_0xb5aa('0x20')](_0xb5aa('0x29'),_0x288371[_0xb5aa('0x1e')](';\x20')));}if(_0x2e2c4e){logger['info'](util[_0xb5aa('0x20')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x2e2c4e));}logger[_0xb5aa('0x12')](_0xb5aa('0x2a'),_0x270504);logger[_0xb5aa('0x2b')](_0xb5aa('0x22'),_0xbe5c47);return Promise['resolve']()[_0xb5aa('0x10')](function(){if(Array[_0xb5aa('0x24')](_0x2fbf9f)){return checkArrayOfIntervals(_0x2fbf9f,_0x2e2c4e);}else if(_0x2fbf9f){return checkSingleInterval(_0x2fbf9f,_0x2e2c4e);}})['then'](function(_0xf22823){var _0x10964b=_0x288371[_0xb5aa('0x1b')](function(_0x61a7b7,_0x217de9){return _0x61a7b7||iftime(_0x217de9,_0x2e2c4e);},![]);_0x270504=_0xf22823||_0x10964b;return _0x270504;})[_0xb5aa('0x14')](function(_0x3ba2e6){logger[_0xb5aa('0x15')](_0xb5aa('0x22'),_0xbe5c47,_0x3ba2e6);throw this[_0xb5aa('0x15')](0x1f4,_0x3ba2e6[_0xb5aa('0x16')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 75361f7..ffa5b19 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x1702ad,_0x5c50c2){var _0x364c0c=function(_0x5ad029){while(--_0x5ad029){_0x1702ad['push'](_0x1702ad['shift']());}};_0x364c0c(++_0x5c50c2);}(_0x2ef3,0xba));var _0x32ef=function(_0x211586,_0x92d677){_0x211586=_0x211586-0x0;var _0x2f0541=_0x2ef3[_0x211586];return _0x2f0541;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 51edcc6..c3cf3d5 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 _0xed27=['newToken','fields','name','customfield_11504','reason','track.xcallymotion.com','POST','application/json','stringify','setEncoding','utf8','data','end','status','statusCode','json','parse','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','Bug','customfield_11500','email','customfield_11501','oldToken','customfield_11502'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0xed27,0xa3));var _0x7ed2=function(_0x172b52,_0x250c5e){_0x172b52=_0x172b52-0x0;var _0x584f83=_0xed27[_0x172b52];return _0x584f83;};'use strict';var BPromise=require(_0x7ed2('0x0'));var https=require(_0x7ed2('0x1'));var logger=require(_0x7ed2('0x2'))(_0x7ed2('0x3'));var USERNAME='support';var PASSWORD=_0x7ed2('0x4');function openIssue(_0x136fa2,_0x43a86f){var _0x5f5053={'fields':{'project':{'key':_0x136fa2[_0x7ed2('0x5')]||_0x7ed2('0x6')},'summary':(_0x136fa2[_0x7ed2('0x7')]||_0x7ed2('0x8'))+_0x7ed2('0x9')+_0x136fa2['ip'],'description':_0x136fa2[_0x7ed2('0xa')]||JSON['stringify'](_0x136fa2),'issuetype':{'name':_0x136fa2['issuetype']||_0x7ed2('0xb')}}};_0x5f5053['fields'][_0x7ed2('0xc')]=_0x136fa2[_0x7ed2('0xd')];_0x5f5053['fields'][_0x7ed2('0xe')]=_0x136fa2[_0x7ed2('0xf')];_0x5f5053['fields'][_0x7ed2('0x10')]=_0x136fa2[_0x7ed2('0x11')];_0x5f5053[_0x7ed2('0x12')]['customfield_11503']=_0x136fa2[_0x7ed2('0x13')];_0x5f5053[_0x7ed2('0x12')][_0x7ed2('0x14')]=_0x136fa2[_0x7ed2('0x15')];_0x5f5053['fields']['customfield_10102']=_0x136fa2['ip'];var _0x326a1e={'host':_0x7ed2('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7ed2('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x7ed2('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x472f86=JSON[_0x7ed2('0x19')](_0x5f5053);var _0x225cd9=https['request'](_0x326a1e,function(_0x49efdc){_0x49efdc[_0x7ed2('0x1a')](_0x7ed2('0x1b'));var _0x2dc98f='';_0x49efdc['on'](_0x7ed2('0x1c'),function(_0x497496){_0x2dc98f+=_0x497496;});_0x49efdc['on'](_0x7ed2('0x1d'),function(){if(_0x43a86f){return _0x43a86f[_0x7ed2('0x1e')](_0x49efdc[_0x7ed2('0x1f')])[_0x7ed2('0x20')](JSON[_0x7ed2('0x21')](_0x2dc98f));}});});_0x225cd9['on'](_0x7ed2('0x22'),function(_0xc53b03){if(_0x43a86f){return _0x43a86f[_0x7ed2('0x1e')](0x1f4)[_0x7ed2('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x7ed2('0x23')}]});}});_0x225cd9[_0x7ed2('0x24')](_0x472f86);_0x225cd9[_0x7ed2('0x1d')]();}exports[_0x7ed2('0x25')]=openIssue;exports[_0x7ed2('0x26')]=function(_0xc6aae1,_0xca2e0e){_0xc6aae1[_0x7ed2('0x27')]['ip']=_0xc6aae1[_0x7ed2('0x28')][_0x7ed2('0x29')]||_0xc6aae1[_0x7ed2('0x2a')][_0x7ed2('0x2b')]||_0xc6aae1[_0x7ed2('0x2c')][_0x7ed2('0x2b')]||_0xc6aae1['connection']['socket']['remoteAddress'];return openIssue(_0xc6aae1[_0x7ed2('0x27')],_0xca2e0e);}; \ No newline at end of file +var _0xdd4c=['https','../../config/logger','support','key','summary','Report','\x20from\x20','description','stringify','issuetype','customfield_11500','email','fields','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','application/json','toString','base64','setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','body','headers','connection','socket','remoteAddress','bluebird'];(function(_0x21fbb1,_0x120f56){var _0x2f7b69=function(_0x37f84c){while(--_0x37f84c){_0x21fbb1['push'](_0x21fbb1['shift']());}};_0x2f7b69(++_0x120f56);}(_0xdd4c,0x179));var _0xcdd4=function(_0x4d6652,_0x181dc0){_0x4d6652=_0x4d6652-0x0;var _0x2f773c=_0xdd4c[_0x4d6652];return _0x2f773c;};'use strict';var BPromise=require(_0xcdd4('0x0'));var https=require(_0xcdd4('0x1'));var logger=require(_0xcdd4('0x2'))('api');var USERNAME=_0xcdd4('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x43b85a,_0x2a8516){var _0xaf9625={'fields':{'project':{'key':_0x43b85a[_0xcdd4('0x4')]||'MOTGUI'},'summary':(_0x43b85a[_0xcdd4('0x5')]||_0xcdd4('0x6'))+_0xcdd4('0x7')+_0x43b85a['ip'],'description':_0x43b85a[_0xcdd4('0x8')]||JSON[_0xcdd4('0x9')](_0x43b85a),'issuetype':{'name':_0x43b85a[_0xcdd4('0xa')]||'Bug'}}};_0xaf9625['fields'][_0xcdd4('0xb')]=_0x43b85a[_0xcdd4('0xc')];_0xaf9625[_0xcdd4('0xd')]['customfield_11501']=_0x43b85a[_0xcdd4('0xe')];_0xaf9625[_0xcdd4('0xd')][_0xcdd4('0xf')]=_0x43b85a[_0xcdd4('0x10')];_0xaf9625[_0xcdd4('0xd')][_0xcdd4('0x11')]=_0x43b85a[_0xcdd4('0x12')];_0xaf9625[_0xcdd4('0xd')]['customfield_11504']=_0x43b85a[_0xcdd4('0x13')];_0xaf9625[_0xcdd4('0xd')][_0xcdd4('0x14')]=_0x43b85a['ip'];var _0x37ee80={'host':_0xcdd4('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xcdd4('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xcdd4('0x17')](_0xcdd4('0x18'))}};var _0x1b17b8=JSON['stringify'](_0xaf9625);var _0x4b84b7=https['request'](_0x37ee80,function(_0xefb85e){_0xefb85e[_0xcdd4('0x19')](_0xcdd4('0x1a'));var _0x93c220='';_0xefb85e['on'](_0xcdd4('0x1b'),function(_0x4da5e3){_0x93c220+=_0x4da5e3;});_0xefb85e['on']('end',function(){if(_0x2a8516){return _0x2a8516[_0xcdd4('0x1c')](_0xefb85e[_0xcdd4('0x1d')])[_0xcdd4('0x1e')](JSON[_0xcdd4('0x1f')](_0x93c220));}});});_0x4b84b7['on'](_0xcdd4('0x20'),function(_0x1f1f5d){if(_0x2a8516){return _0x2a8516[_0xcdd4('0x1c')](0x1f4)[_0xcdd4('0x1e')]({'errors':[{'message':_0xcdd4('0x21'),'type':_0xcdd4('0x22')}]});}});_0x4b84b7['write'](_0x1b17b8);_0x4b84b7[_0xcdd4('0x23')]();}exports[_0xcdd4('0x24')]=openIssue;exports['send']=function(_0x12bacb,_0x55dfdf){_0x12bacb[_0xcdd4('0x25')]['ip']=_0x12bacb[_0xcdd4('0x26')]['x-forwarded-for']||_0x12bacb[_0xcdd4('0x27')]['remoteAddress']||_0x12bacb[_0xcdd4('0x28')][_0xcdd4('0x29')]||_0x12bacb[_0xcdd4('0x27')][_0xcdd4('0x28')][_0xcdd4('0x29')];return openIssue(_0x12bacb[_0xcdd4('0x25')],_0x55dfdf);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2f8ab60..0b03385 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 _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x3970d9,_0x43e60d){var _0x42ff83=function(_0x4505cf){while(--_0x4505cf){_0x3970d9['push'](_0x3970d9['shift']());}};_0x42ff83(++_0x43e60d);}(_0x4ea3,0x70));var _0x34ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4ea3[_0x6c993a];return _0x27f547;};'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('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file +var _0xbdb7=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get','describe','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x17d07b,_0x211c4d){var _0x388885=function(_0x23458f){while(--_0x23458f){_0x17d07b['push'](_0x17d07b['shift']());}};_0x388885(++_0x211c4d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x58cc40,_0x183602){_0x58cc40=_0x58cc40-0x0;var _0x19f72b=_0xbdb7[_0x58cc40];return _0x19f72b;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')]('/',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')](_0x7bdb('0x12'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);module[_0x7bdb('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index fd9662f..bc50860 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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x2ff69e,_0x116544){_0x2ff69e=_0x2ff69e-0x0;var _0x307943=_0x7a54[_0x2ff69e];return _0x307943;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x360709,_0x27b534){_0x360709=_0x360709-0x0;var _0x382604=_0x7a54[_0x360709];return _0x382604;};'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 d091e34..b7130d5 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 _0x363e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3f8d18,_0x2123d0){var _0x1e54e9=function(_0x1aa06f){while(--_0x1aa06f){_0x3f8d18['push'](_0x3f8d18['shift']());}};_0x1e54e9(++_0x2123d0);}(_0x363e,0x179));var _0xe363=function(_0xe16a08,_0x4ce698){_0xe16a08=_0xe16a08-0x0;var _0x3ba330=_0x363e[_0xe16a08];return _0x3ba330;};'use strict';var emlformat=require(_0xe363('0x0'));var rimraf=require(_0xe363('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe363('0x2'));var rp=require(_0xe363('0x3'));var moment=require(_0xe363('0x4'));var BPromise=require(_0xe363('0x5'));var Mustache=require(_0xe363('0x6'));var util=require(_0xe363('0x7'));var path=require(_0xe363('0x8'));var sox=require(_0xe363('0x9'));var csv=require(_0xe363('0xa'));var ejs=require(_0xe363('0xb'));var fs=require('fs');var fs_extra=require(_0xe363('0xc'));var _=require('lodash');var squel=require(_0xe363('0xd'));var crypto=require(_0xe363('0xe'));var jsforce=require(_0xe363('0xf'));var deskjs=require(_0xe363('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe363('0x11'));var Papa=require(_0xe363('0x12'));var Redis=require(_0xe363('0x13'));var authService=require(_0xe363('0x14'));var qs=require(_0xe363('0x15'));var as=require(_0xe363('0x16'));var hardwareService=require(_0xe363('0x17'));var logger=require('../../config/logger')(_0xe363('0x18'));var utils=require(_0xe363('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe363('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e1fb0,_0x8b6974){_0x8b6974=_0x8b6974||0xcc;return function(_0x21cb92){if(_0x21cb92){return _0x4e1fb0[_0xe363('0x1b')](_0x8b6974);}return _0x4e1fb0[_0xe363('0x1c')](_0x8b6974)[_0xe363('0x1d')]();};}function respondWithResult(_0x563fbf,_0x17ff61){_0x17ff61=_0x17ff61||0xc8;return function(_0x22b227){if(_0x22b227){return _0x563fbf['status'](_0x17ff61)[_0xe363('0x1e')](_0x22b227);}};}function respondWithFilteredResult(_0x2ad0e9,_0x52e6c6){return function(_0x3c74f9){if(_0x3c74f9){var _0x73ef9a=typeof _0x52e6c6['offset']===_0xe363('0x1f')&&typeof _0x52e6c6[_0xe363('0x20')]==='undefined';var _0xecbe2c=_0x3c74f9[_0xe363('0x21')];var _0x2f2c20=_0x73ef9a?0x0:_0x52e6c6['offset'];var _0x287104=_0x73ef9a?_0x3c74f9[_0xe363('0x21')]:_0x52e6c6['offset']+_0x52e6c6[_0xe363('0x20')];var _0x110e59;if(_0x287104>=_0xecbe2c){_0x287104=_0xecbe2c;_0x110e59=0xc8;}else{_0x110e59=0xce;}_0x2ad0e9[_0xe363('0x1c')](_0x110e59);return _0x2ad0e9[_0xe363('0x22')](_0xe363('0x23'),_0x2f2c20+'-'+_0x287104+'/'+_0xecbe2c)[_0xe363('0x1e')](_0x3c74f9);}return null;};}function patchUpdates(_0x4ee855){return function(_0x3bed39){try{jsonpatch[_0xe363('0x24')](_0x3bed39,_0x4ee855,!![]);}catch(_0x14ff95){return BPromise[_0xe363('0x25')](_0x14ff95);}return _0x3bed39[_0xe363('0x26')]();};}function saveUpdates(_0x42928e,_0x24199a){return function(_0xaff56f){if(_0xaff56f){return _0xaff56f[_0xe363('0x27')](_0x42928e)[_0xe363('0x28')](function(_0x1de673){return _0x1de673;});}return null;};}function removeEntity(_0x441b94,_0x11556d){return function(_0x388223){if(_0x388223){return _0x388223[_0xe363('0x29')]()[_0xe363('0x28')](function(){_0x441b94[_0xe363('0x1c')](0xcc)[_0xe363('0x1d')]();});}};}function handleEntityNotFound(_0x19c7b4,_0x3e24ad){return function(_0x312d75){if(!_0x312d75){_0x19c7b4[_0xe363('0x1b')](0x194);}return _0x312d75;};}function handleError(_0x5b2b3d,_0xbdfae9){_0xbdfae9=_0xbdfae9||0x1f4;return function(_0x12358b){logger[_0xe363('0x2a')](_0x12358b[_0xe363('0x2b')]);if(_0x12358b[_0xe363('0x2c')]){delete _0x12358b['name'];}_0x5b2b3d[_0xe363('0x1c')](_0xbdfae9)[_0xe363('0x2d')](_0x12358b);};}exports['index']=function(_0x3cc130,_0x5a790c){var _0x3ed3e1={},_0x45d664={},_0x4c739d={'count':0x0,'rows':[]};var _0x357b6f=_[_0xe363('0x2e')](db[_0xe363('0x2f')]['rawAttributes'],function(_0x40671e){return{'name':_0x40671e[_0xe363('0x30')],'type':_0x40671e[_0xe363('0x31')][_0xe363('0x32')]};});_0x45d664['model']=_[_0xe363('0x2e')](_0x357b6f,_0xe363('0x2c'));_0x45d664[_0xe363('0x33')]=_[_0xe363('0x34')](_0x3cc130[_0xe363('0x33')]);_0x45d664[_0xe363('0x35')]=_[_0xe363('0x36')](_0x45d664[_0xe363('0x37')],_0x45d664[_0xe363('0x33')]);_0x3ed3e1[_0xe363('0x38')]=_['intersection'](_0x45d664['model'],qs[_0xe363('0x39')](_0x3cc130[_0xe363('0x33')]['fields']));_0x3ed3e1[_0xe363('0x38')]=_0x3ed3e1[_0xe363('0x38')]['length']?_0x3ed3e1[_0xe363('0x38')]:_0x45d664[_0xe363('0x37')];if(!_0x3cc130[_0xe363('0x33')][_0xe363('0x3a')]('nolimit')){_0x3ed3e1['limit']=qs[_0xe363('0x20')](_0x3cc130['query']['limit']);_0x3ed3e1[_0xe363('0x3b')]=qs[_0xe363('0x3b')](_0x3cc130[_0xe363('0x33')][_0xe363('0x3b')]);}_0x3ed3e1[_0xe363('0x3c')]=qs[_0xe363('0x3d')](_0x3cc130[_0xe363('0x33')][_0xe363('0x3d')]);_0x3ed3e1[_0xe363('0x3e')]=qs[_0xe363('0x35')](_[_0xe363('0x3f')](_0x3cc130[_0xe363('0x33')],_0x45d664['filters']),_0x357b6f);if(_0x3cc130['query'][_0xe363('0x40')]){_0x3ed3e1[_0xe363('0x3e')]=_[_0xe363('0x41')](_0x3ed3e1['where'],{'$or':_['map'](_0x357b6f,function(_0x815550){if(_0x815550[_0xe363('0x31')]!==_0xe363('0x42')){var _0x199c78={};_0x199c78[_0x815550['name']]={'$like':'%'+_0x3cc130[_0xe363('0x33')]['filter']+'%'};return _0x199c78;}})});}_0x3ed3e1=_[_0xe363('0x41')]({},_0x3ed3e1,_0x3cc130[_0xe363('0x43')]);var _0xbca95f={'where':_0x3ed3e1[_0xe363('0x3e')]};return db[_0xe363('0x2f')][_0xe363('0x21')](_0xbca95f)[_0xe363('0x28')](function(_0x44f03c){_0x4c739d[_0xe363('0x21')]=_0x44f03c;if(_0x3cc130['query']['includeAll']){_0x3ed3e1[_0xe363('0x44')]=[{'all':!![]}];}return db[_0xe363('0x2f')][_0xe363('0x45')](_0x3ed3e1);})[_0xe363('0x28')](function(_0x2fc2f0){_0x4c739d[_0xe363('0x46')]=_0x2fc2f0;return _0x4c739d;})[_0xe363('0x28')](respondWithFilteredResult(_0x5a790c,_0x3ed3e1))[_0xe363('0x47')](handleError(_0x5a790c,null));};exports[_0xe363('0x48')]=function(_0x4b8238,_0x3da5ba){var _0x58b837={'raw':!![],'where':{'id':_0x4b8238['params']['id']}},_0x41a87c={};_0x41a87c[_0xe363('0x37')]=_[_0xe363('0x34')](db['JscriptyAnswerReport'][_0xe363('0x49')]);_0x41a87c[_0xe363('0x33')]=_[_0xe363('0x34')](_0x4b8238[_0xe363('0x33')]);_0x41a87c[_0xe363('0x35')]=_[_0xe363('0x36')](_0x41a87c['model'],_0x41a87c[_0xe363('0x33')]);_0x58b837[_0xe363('0x38')]=_[_0xe363('0x36')](_0x41a87c[_0xe363('0x37')],qs[_0xe363('0x39')](_0x4b8238['query'][_0xe363('0x39')]));_0x58b837[_0xe363('0x38')]=_0x58b837[_0xe363('0x38')][_0xe363('0x4a')]?_0x58b837[_0xe363('0x38')]:_0x41a87c[_0xe363('0x37')];if(_0x4b8238[_0xe363('0x33')]['includeAll']){_0x58b837['include']=[{'all':!![]}];}_0x58b837=_[_0xe363('0x41')]({},_0x58b837,_0x4b8238[_0xe363('0x43')]);return db[_0xe363('0x2f')]['find'](_0x58b837)[_0xe363('0x28')](handleEntityNotFound(_0x3da5ba,null))[_0xe363('0x28')](respondWithResult(_0x3da5ba,null))['catch'](handleError(_0x3da5ba,null));};exports['create']=function(_0x2a7b42,_0x34e08b){return db[_0xe363('0x2f')][_0xe363('0x4b')](_0x2a7b42['body'],{})[_0xe363('0x28')](respondWithResult(_0x34e08b,0xc9))[_0xe363('0x47')](handleError(_0x34e08b,null));};exports['update']=function(_0x4fbdbb,_0x306afd){if(_0x4fbdbb[_0xe363('0x4c')]['id']){delete _0x4fbdbb['body']['id'];}return db[_0xe363('0x2f')]['find']({'where':{'id':_0x4fbdbb[_0xe363('0x4d')]['id']}})[_0xe363('0x28')](handleEntityNotFound(_0x306afd,null))['then'](saveUpdates(_0x4fbdbb[_0xe363('0x4c')],null))[_0xe363('0x28')](respondWithResult(_0x306afd,null))['catch'](handleError(_0x306afd,null));};exports[_0xe363('0x29')]=function(_0x43ee23,_0x55f0e6){return db[_0xe363('0x2f')]['find']({'where':{'id':_0x43ee23[_0xe363('0x4d')]['id']}})[_0xe363('0x28')](handleEntityNotFound(_0x55f0e6,null))[_0xe363('0x28')](removeEntity(_0x55f0e6,null))[_0xe363('0x47')](handleError(_0x55f0e6,null));};exports['describe']=function(_0x2ff064,_0x225a43){return db[_0xe363('0x2f')]['describe']()[_0xe363('0x28')](respondWithResult(_0x225a43,null))[_0xe363('0x47')](handleError(_0x225a43,null));}; \ No newline at end of file +var _0x7f94=['JscriptyAnswerReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','filter','merge','options','include','findAll','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x3be7e2,_0x5ba523){var _0x17e36b=function(_0x370f7b){while(--_0x370f7b){_0x3be7e2['push'](_0x3be7e2['shift']());}};_0x17e36b(++_0x5ba523);}(_0x7f94,0x65));var _0x47f9=function(_0x118c05,_0x193682){_0x118c05=_0x118c05-0x0;var _0xa8ff41=_0x7f94[_0x118c05];return _0xa8ff41;};'use strict';var emlformat=require(_0x47f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47f9('0x1'));var jsonpatch=require(_0x47f9('0x2'));var rp=require(_0x47f9('0x3'));var moment=require(_0x47f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47f9('0x5'));var util=require(_0x47f9('0x6'));var path=require(_0x47f9('0x7'));var sox=require(_0x47f9('0x8'));var csv=require(_0x47f9('0x9'));var ejs=require(_0x47f9('0xa'));var fs=require('fs');var fs_extra=require(_0x47f9('0xb'));var _=require('lodash');var squel=require(_0x47f9('0xc'));var crypto=require(_0x47f9('0xd'));var jsforce=require(_0x47f9('0xe'));var deskjs=require(_0x47f9('0xf'));var toCsv=require(_0x47f9('0x9'));var querystring=require(_0x47f9('0x10'));var Papa=require(_0x47f9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47f9('0x12'));var logger=require(_0x47f9('0x13'))(_0x47f9('0x14'));var utils=require(_0x47f9('0x15'));var config=require(_0x47f9('0x16'));var licenseUtil=require(_0x47f9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a8bac,_0x1002f7){_0x1002f7=_0x1002f7||0xcc;return function(_0x49c33c){if(_0x49c33c){return _0x5a8bac['sendStatus'](_0x1002f7);}return _0x5a8bac['status'](_0x1002f7)[_0x47f9('0x18')]();};}function respondWithResult(_0x43e4db,_0x4d44dd){_0x4d44dd=_0x4d44dd||0xc8;return function(_0x166860){if(_0x166860){return _0x43e4db[_0x47f9('0x19')](_0x4d44dd)[_0x47f9('0x1a')](_0x166860);}};}function respondWithFilteredResult(_0x2a6444,_0x48cc81){return function(_0x3320d1){if(_0x3320d1){var _0x3703e1=typeof _0x48cc81[_0x47f9('0x1b')]===_0x47f9('0x1c')&&typeof _0x48cc81[_0x47f9('0x1d')]==='undefined';var _0x56775f=_0x3320d1['count'];var _0xd80474=_0x3703e1?0x0:_0x48cc81[_0x47f9('0x1b')];var _0x32bb57=_0x3703e1?_0x3320d1[_0x47f9('0x1e')]:_0x48cc81[_0x47f9('0x1b')]+_0x48cc81[_0x47f9('0x1d')];var _0x29700e;if(_0x32bb57>=_0x56775f){_0x32bb57=_0x56775f;_0x29700e=0xc8;}else{_0x29700e=0xce;}_0x2a6444[_0x47f9('0x19')](_0x29700e);return _0x2a6444[_0x47f9('0x1f')](_0x47f9('0x20'),_0xd80474+'-'+_0x32bb57+'/'+_0x56775f)[_0x47f9('0x1a')](_0x3320d1);}return null;};}function patchUpdates(_0x328d14){return function(_0x397dd5){try{jsonpatch['apply'](_0x397dd5,_0x328d14,!![]);}catch(_0x4d35bf){return BPromise[_0x47f9('0x21')](_0x4d35bf);}return _0x397dd5['save']();};}function saveUpdates(_0x2e2b69,_0x29b7f8){return function(_0x2ecf99){if(_0x2ecf99){return _0x2ecf99[_0x47f9('0x22')](_0x2e2b69)[_0x47f9('0x23')](function(_0x11ef91){return _0x11ef91;});}return null;};}function removeEntity(_0x6a49d,_0x3c4778){return function(_0x4fd2b1){if(_0x4fd2b1){return _0x4fd2b1[_0x47f9('0x24')]()[_0x47f9('0x23')](function(){_0x6a49d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bd84,_0x4c16e0){return function(_0x76077d){if(!_0x76077d){_0x26bd84['sendStatus'](0x194);}return _0x76077d;};}function handleError(_0x26174a,_0x1a8c4b){_0x1a8c4b=_0x1a8c4b||0x1f4;return function(_0x5dbdda){logger[_0x47f9('0x25')](_0x5dbdda[_0x47f9('0x26')]);if(_0x5dbdda[_0x47f9('0x27')]){delete _0x5dbdda[_0x47f9('0x27')];}_0x26174a[_0x47f9('0x19')](_0x1a8c4b)[_0x47f9('0x28')](_0x5dbdda);};}exports[_0x47f9('0x29')]=function(_0x52927a,_0x53e951){var _0x4c37d2={},_0x481ccb={},_0x1a5b58={'count':0x0,'rows':[]};var _0x5818a6=_[_0x47f9('0x2a')](db[_0x47f9('0x2b')][_0x47f9('0x2c')],function(_0xaf0fea){return{'name':_0xaf0fea[_0x47f9('0x2d')],'type':_0xaf0fea[_0x47f9('0x2e')]['key']};});_0x481ccb['model']=_[_0x47f9('0x2a')](_0x5818a6,_0x47f9('0x27'));_0x481ccb['query']=_[_0x47f9('0x2f')](_0x52927a[_0x47f9('0x30')]);_0x481ccb[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],_0x481ccb[_0x47f9('0x30')]);_0x4c37d2[_0x47f9('0x34')]=_[_0x47f9('0x32')](_0x481ccb[_0x47f9('0x33')],qs[_0x47f9('0x35')](_0x52927a[_0x47f9('0x30')][_0x47f9('0x35')]));_0x4c37d2[_0x47f9('0x34')]=_0x4c37d2['attributes'][_0x47f9('0x36')]?_0x4c37d2[_0x47f9('0x34')]:_0x481ccb['model'];if(!_0x52927a[_0x47f9('0x30')][_0x47f9('0x37')]('nolimit')){_0x4c37d2[_0x47f9('0x1d')]=qs['limit'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1d')]);_0x4c37d2[_0x47f9('0x1b')]=qs['offset'](_0x52927a[_0x47f9('0x30')][_0x47f9('0x1b')]);}_0x4c37d2[_0x47f9('0x38')]=qs[_0x47f9('0x39')](_0x52927a[_0x47f9('0x30')]['sort']);_0x4c37d2['where']=qs['filters'](_[_0x47f9('0x3a')](_0x52927a[_0x47f9('0x30')],_0x481ccb[_0x47f9('0x31')]),_0x5818a6);if(_0x52927a['query']['filter']){_0x4c37d2[_0x47f9('0x3b')]=_['merge'](_0x4c37d2[_0x47f9('0x3b')],{'$or':_['map'](_0x5818a6,function(_0x563492){if(_0x563492[_0x47f9('0x2e')]!=='VIRTUAL'){var _0xfe4480={};_0xfe4480[_0x563492[_0x47f9('0x27')]]={'$like':'%'+_0x52927a[_0x47f9('0x30')][_0x47f9('0x3c')]+'%'};return _0xfe4480;}})});}_0x4c37d2=_[_0x47f9('0x3d')]({},_0x4c37d2,_0x52927a[_0x47f9('0x3e')]);var _0x27ca33={'where':_0x4c37d2['where']};return db['JscriptyAnswerReport'][_0x47f9('0x1e')](_0x27ca33)[_0x47f9('0x23')](function(_0x118db1){_0x1a5b58[_0x47f9('0x1e')]=_0x118db1;if(_0x52927a[_0x47f9('0x30')]['includeAll']){_0x4c37d2[_0x47f9('0x3f')]=[{'all':!![]}];}return db[_0x47f9('0x2b')][_0x47f9('0x40')](_0x4c37d2);})[_0x47f9('0x23')](function(_0x3128bc){_0x1a5b58[_0x47f9('0x41')]=_0x3128bc;return _0x1a5b58;})[_0x47f9('0x23')](respondWithFilteredResult(_0x53e951,_0x4c37d2))[_0x47f9('0x42')](handleError(_0x53e951,null));};exports['show']=function(_0x311975,_0xc61254){var _0x55443d={'raw':!![],'where':{'id':_0x311975['params']['id']}},_0x587a7f={};_0x587a7f[_0x47f9('0x33')]=_[_0x47f9('0x2f')](db[_0x47f9('0x2b')][_0x47f9('0x2c')]);_0x587a7f[_0x47f9('0x30')]=_[_0x47f9('0x2f')](_0x311975[_0x47f9('0x30')]);_0x587a7f[_0x47f9('0x31')]=_[_0x47f9('0x32')](_0x587a7f[_0x47f9('0x33')],_0x587a7f['query']);_0x55443d['attributes']=_['intersection'](_0x587a7f[_0x47f9('0x33')],qs['fields'](_0x311975[_0x47f9('0x30')][_0x47f9('0x35')]));_0x55443d['attributes']=_0x55443d[_0x47f9('0x34')][_0x47f9('0x36')]?_0x55443d['attributes']:_0x587a7f[_0x47f9('0x33')];if(_0x311975[_0x47f9('0x30')]['includeAll']){_0x55443d[_0x47f9('0x3f')]=[{'all':!![]}];}_0x55443d=_[_0x47f9('0x3d')]({},_0x55443d,_0x311975[_0x47f9('0x3e')]);return db[_0x47f9('0x2b')][_0x47f9('0x43')](_0x55443d)[_0x47f9('0x23')](handleEntityNotFound(_0xc61254,null))[_0x47f9('0x23')](respondWithResult(_0xc61254,null))[_0x47f9('0x42')](handleError(_0xc61254,null));};exports[_0x47f9('0x44')]=function(_0x411695,_0x38d61d){return db[_0x47f9('0x2b')][_0x47f9('0x44')](_0x411695[_0x47f9('0x45')],{})[_0x47f9('0x23')](respondWithResult(_0x38d61d,0xc9))['catch'](handleError(_0x38d61d,null));};exports[_0x47f9('0x22')]=function(_0x1c6e21,_0x58fc09){if(_0x1c6e21[_0x47f9('0x45')]['id']){delete _0x1c6e21[_0x47f9('0x45')]['id'];}return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x1c6e21['params']['id']}})[_0x47f9('0x23')](handleEntityNotFound(_0x58fc09,null))['then'](saveUpdates(_0x1c6e21[_0x47f9('0x45')],null))['then'](respondWithResult(_0x58fc09,null))['catch'](handleError(_0x58fc09,null));};exports[_0x47f9('0x24')]=function(_0x2bd2c7,_0x1b1029){return db[_0x47f9('0x2b')]['find']({'where':{'id':_0x2bd2c7[_0x47f9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b1029,null))['then'](removeEntity(_0x1b1029,null))[_0x47f9('0x42')](handleError(_0x1b1029,null));};exports[_0x47f9('0x47')]=function(_0x43eb5b,_0x3d796c){return db[_0x47f9('0x2b')][_0x47f9('0x47')]()['then'](respondWithResult(_0x3d796c,null))[_0x47f9('0x42')](handleError(_0x3d796c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e73bc64..51cb17b 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 _0x5ff9=['api','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0x5ff9,0x1ac));var _0x95ff=function(_0x556ae0,_0x1053c4){_0x556ae0=_0x556ae0-0x0;var _0x536e2c=_0x5ff9[_0x556ae0];return _0x536e2c;};'use strict';var _=require(_0x95ff('0x0'));var util=require('util');var logger=require(_0x95ff('0x1'))(_0x95ff('0x2'));var moment=require('moment');var BPromise=require(_0x95ff('0x3'));var rp=require(_0x95ff('0x4'));var fs=require('fs');var path=require(_0x95ff('0x5'));var rimraf=require('rimraf');var config=require(_0x95ff('0x6'));var attributes=require(_0x95ff('0x7'));module['exports']=function(_0x3ae963,_0x2226c5){return _0x3ae963['define'](_0x95ff('0x8'),attributes,{'tableName':_0x95ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2b5=['request-promise','path','../../config/environment','define','JscriptyAnswerReport','lodash','api','moment','bluebird'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0xd2b5,0x113));var _0x5d2b=function(_0x1efef6,_0x5d2e29){_0x1efef6=_0x1efef6-0x0;var _0x259b2c=_0xd2b5[_0x1efef6];return _0x259b2c;};'use strict';var _=require(_0x5d2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5d2b('0x1'));var moment=require(_0x5d2b('0x2'));var BPromise=require(_0x5d2b('0x3'));var rp=require(_0x5d2b('0x4'));var fs=require('fs');var path=require(_0x5d2b('0x5'));var rimraf=require('rimraf');var config=require(_0x5d2b('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x4a8f32,_0x435148){return _0x4a8f32[_0x5d2b('0x7')](_0x5d2b('0x8'),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 7be5009..e1ffb7b 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 _0x6461=['error','code','message','result','lodash','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x27ddc9,_0x4c2636){var _0x1c791e=function(_0x35d29f){while(--_0x35d29f){_0x27ddc9['push'](_0x27ddc9['shift']());}};_0x1c791e(++_0x4c2636);}(_0x6461,0x190));var _0x1646=function(_0x55ffa5,_0x332fee){_0x55ffa5=_0x55ffa5-0x0;var _0x9acde5=_0x6461[_0x55ffa5];return _0x9acde5;};'use strict';var _=require(_0x1646('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1646('0x1'));var fs=require('fs');var Redis=require(_0x1646('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1646('0x3'))(_0x1646('0x4'));var config=require(_0x1646('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1646('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34e911,_0x4692ce,_0xdeddba){return new BPromise(function(_0x58e156,_0x4b1015){return client[_0x1646('0x7')](_0x34e911,_0xdeddba)[_0x1646('0x8')](function(_0x545310){logger[_0x1646('0x9')](_0x1646('0xa'),_0x4692ce,_0x1646('0xb'));logger[_0x1646('0xc')](_0x1646('0xd'),_0x4692ce,_0x1646('0xb'),JSON['stringify'](_0x545310));if(_0x545310[_0x1646('0xe')]){if(_0x545310[_0x1646('0xe')][_0x1646('0xf')]===0x1f4){logger['error'](_0x1646('0xa'),_0x4692ce,_0x545310[_0x1646('0xe')]['message']);return _0x4b1015(_0x545310[_0x1646('0xe')][_0x1646('0x10')]);}logger[_0x1646('0xe')](_0x1646('0xa'),_0x4692ce,_0x545310[_0x1646('0xe')][_0x1646('0x10')]);return _0x58e156(_0x545310['error'][_0x1646('0x10')]);}else{logger[_0x1646('0x9')](_0x1646('0xa'),_0x4692ce,_0x1646('0xb'));_0x58e156(_0x545310[_0x1646('0x11')][_0x1646('0x10')]);}})['catch'](function(_0x2fee76){logger[_0x1646('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4692ce,_0x2fee76);_0x4b1015(_0x2fee76);});});} \ No newline at end of file +var _0x1e41=['request','then','info','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x159e75,_0x49d120){var _0x310c52=function(_0x20eedd){while(--_0x20eedd){_0x159e75['push'](_0x159e75['shift']());}};_0x310c52(++_0x49d120);}(_0x1e41,0x88));var _0x11e4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1e41[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x11e4('0x0'));var moment=require('moment');var BPromise=require(_0x11e4('0x1'));var rs=require(_0x11e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11e4('0x3'));var logger=require('../../config/logger')(_0x11e4('0x4'));var config=require(_0x11e4('0x5'));var jayson=require(_0x11e4('0x6'));var client=jayson[_0x11e4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9fe614,_0x42157c,_0x22494c){return new BPromise(function(_0x465f53,_0x2697dd){return client[_0x11e4('0x8')](_0x9fe614,_0x22494c)[_0x11e4('0x9')](function(_0x45261f){logger[_0x11e4('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x42157c,_0x11e4('0xb'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x42157c,_0x11e4('0xb'),JSON[_0x11e4('0xc')](_0x45261f));if(_0x45261f[_0x11e4('0xd')]){if(_0x45261f[_0x11e4('0xd')][_0x11e4('0xe')]===0x1f4){logger['error'](_0x11e4('0xf'),_0x42157c,_0x45261f[_0x11e4('0xd')]['message']);return _0x2697dd(_0x45261f['error']['message']);}logger[_0x11e4('0xd')](_0x11e4('0xf'),_0x42157c,_0x45261f[_0x11e4('0xd')][_0x11e4('0x10')]);return _0x465f53(_0x45261f[_0x11e4('0xd')]['message']);}else{logger[_0x11e4('0xa')](_0x11e4('0xf'),_0x42157c,_0x11e4('0xb'));_0x465f53(_0x45261f['result'][_0x11e4('0x10')]);}})[_0x11e4('0x11')](function(_0x319030){logger['error'](_0x11e4('0xf'),_0x42157c,_0x319030);_0x2697dd(_0x319030);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 2185d26..87a4936 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 _0xefb5=['get','isAuthenticated','show','getSessions','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47f3e5,_0x418302){var _0x21ca71=function(_0x124f7f){while(--_0x124f7f){_0x47f3e5['push'](_0x47f3e5['shift']());}};_0x21ca71(++_0x418302);}(_0xefb5,0x1ba));var _0x5efb=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xefb5[_0x540133];return _0x26b6e9;};'use strict';var multer=require(_0x5efb('0x0'));var util=require(_0x5efb('0x1'));var path=require('path');var timeout=require(_0x5efb('0x2'));var express=require('express');var router=express[_0x5efb('0x3')]();var fs_extra=require(_0x5efb('0x4'));var auth=require(_0x5efb('0x5'));var interaction=require(_0x5efb('0x6'));var config=require(_0x5efb('0x7'));var controller=require('./jscriptyProject.controller');router[_0x5efb('0x8')]('/',auth[_0x5efb('0x9')](),controller['index']);router[_0x5efb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5efb('0xa')]);router['get']('/:id/sessions',auth['isAuthenticated'](),controller[_0x5efb('0xb')]);router[_0x5efb('0x8')]('/:id/answers',auth['isAuthenticated'](),controller[_0x5efb('0xc')]);router[_0x5efb('0x8')](_0x5efb('0xd'),auth[_0x5efb('0x9')](),timeout(_0x5efb('0xe')),controller[_0x5efb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5efb('0x10')](_0x5efb('0x11'),auth[_0x5efb('0x9')](),controller[_0x5efb('0x12')]);router[_0x5efb('0x13')](_0x5efb('0x14'),auth['isAuthenticated'](),controller[_0x5efb('0x15')]);router[_0x5efb('0x16')](_0x5efb('0x14'),auth[_0x5efb('0x9')](),controller[_0x5efb('0x17')]);module[_0x5efb('0x18')]=router; \ No newline at end of file +var _0x383a=['post','create','/:id/clone','clone','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/answers','getAnswers','/:id/summary','30s','getSummary'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x383a,0x17e));var _0xa383=function(_0x5813eb,_0x157c17){_0x5813eb=_0x5813eb-0x0;var _0x314c58=_0x383a[_0x5813eb];return _0x314c58;};'use strict';var multer=require(_0xa383('0x0'));var util=require(_0xa383('0x1'));var path=require(_0xa383('0x2'));var timeout=require(_0xa383('0x3'));var express=require(_0xa383('0x4'));var router=express[_0xa383('0x5')]();var fs_extra=require(_0xa383('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa383('0x7'));var controller=require('./jscriptyProject.controller');router[_0xa383('0x8')]('/',auth[_0xa383('0x9')](),controller[_0xa383('0xa')]);router['get'](_0xa383('0xb'),auth[_0xa383('0x9')](),controller[_0xa383('0xc')]);router[_0xa383('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller['getSessions']);router['get'](_0xa383('0xd'),auth[_0xa383('0x9')](),controller[_0xa383('0xe')]);router[_0xa383('0x8')](_0xa383('0xf'),auth[_0xa383('0x9')](),timeout(_0xa383('0x10')),controller[_0xa383('0x11')]);router[_0xa383('0x12')]('/',auth['isAuthenticated'](),controller[_0xa383('0x13')]);router[_0xa383('0x12')](_0xa383('0x14'),auth[_0xa383('0x9')](),controller[_0xa383('0x15')]);router['put'](_0xa383('0xb'),auth[_0xa383('0x9')](),controller['update']);router[_0xa383('0x16')]('/:id',auth[_0xa383('0x9')](),controller[_0xa383('0x17')]);module[_0xa383('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c90be0e..67cc793 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 _0x262d=['isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','util','exports','STRING','name','TEXT','long'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0x262d,0x180));var _0xd262=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x262d[_0x521929];return _0x632436;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0xd262('0x0'));module[_0xd262('0x1')]={'name':{'type':Sequelize[_0xd262('0x2')],'unique':_0xd262('0x3')},'description':{'type':Sequelize[_0xd262('0x2')]},'formData':{'type':Sequelize[_0xd262('0x4')](_0xd262('0x5')),'set':function(_0xf0d26f){if(_[_0xd262('0x6')](_0xf0d26f)){this[_0xd262('0x7')](_0xd262('0x8'),JSON[_0xd262('0x9')](_0xf0d26f));}else if(_[_0xd262('0xa')](_0xf0d26f)){this[_0xd262('0x7')](_0xd262('0x8'),_0xf0d26f);}else{this['setDataValue'](_0xd262('0x8'),util[_0xd262('0xb')](_0xd262('0xc'),this[_0xd262('0xd')](_0xd262('0x3'))||'',this['getDataValue'](_0xd262('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4195=['stringify','isString','setDataValue','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name','STRING','TEXT','long','isObjectLike','formData'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4195,0xa0));var _0x5419=function(_0x2584bc,_0x35d9f5){_0x2584bc=_0x2584bc-0x0;var _0x405f2c=_0x4195[_0x2584bc];return _0x405f2c;};'use strict';var Sequelize=require(_0x5419('0x0'));var _=require(_0x5419('0x1'));var util=require(_0x5419('0x2'));module[_0x5419('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x5419('0x4')},'description':{'type':Sequelize[_0x5419('0x5')]},'formData':{'type':Sequelize[_0x5419('0x6')](_0x5419('0x7')),'set':function(_0x325db1){if(_[_0x5419('0x8')](_0x325db1)){this['setDataValue'](_0x5419('0x9'),JSON[_0x5419('0xa')](_0x325db1));}else if(_[_0x5419('0xb')](_0x325db1)){this[_0x5419('0xc')](_0x5419('0x9'),_0x325db1);}else{this[_0x5419('0xc')](_0x5419('0x9'),util[_0x5419('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x5419('0xe')]('name')||'',this[_0x5419('0xe')](_0x5419('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5419('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5419('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index cd164cf..41b2831 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 _0x49f5=['json','offset','undefined','limit','set','reject','Projects','UserProfileResource','destroy','then','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','include','findAll','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','update','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','nolimit','ProjectId','rows','number','fromCharCode','apply','toString','indexOf','replace','getSummary','parse','JscriptyQuestionReport','-createdAt','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','download','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x493d36,_0x1eb2f4){var _0x1230a1=function(_0x105da4){while(--_0x105da4){_0x493d36['push'](_0x493d36['shift']());}};_0x1230a1(++_0x1eb2f4);}(_0x49f5,0xd0));var _0x549f=function(_0x233309,_0x5b1d5a){_0x233309=_0x233309-0x0;var _0x441b18=_0x49f5[_0x233309];return _0x441b18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x549f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x549f('0x1'));var rp=require('request-promise');var moment=require(_0x549f('0x2'));var BPromise=require(_0x549f('0x3'));var Mustache=require(_0x549f('0x4'));var util=require(_0x549f('0x5'));var path=require(_0x549f('0x6'));var sox=require(_0x549f('0x7'));var csv=require('to-csv');var ejs=require(_0x549f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x549f('0x9'));var squel=require(_0x549f('0xa'));var crypto=require(_0x549f('0xb'));var jsforce=require(_0x549f('0xc'));var deskjs=require(_0x549f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x549f('0xe'));var Papa=require(_0x549f('0xf'));var Redis=require(_0x549f('0x10'));var authService=require(_0x549f('0x11'));var qs=require(_0x549f('0x12'));var as=require(_0x549f('0x13'));var hardwareService=require(_0x549f('0x14'));var logger=require(_0x549f('0x15'))(_0x549f('0x16'));var utils=require(_0x549f('0x17'));var config=require(_0x549f('0x18'));var licenseUtil=require(_0x549f('0x19'));var db=require(_0x549f('0x1a'))['db'];function respondWithStatusCode(_0x3cfe6f,_0x430320){_0x430320=_0x430320||0xcc;return function(_0x4f3f30){if(_0x4f3f30){return _0x3cfe6f[_0x549f('0x1b')](_0x430320);}return _0x3cfe6f[_0x549f('0x1c')](_0x430320)[_0x549f('0x1d')]();};}function respondWithResult(_0xac2a75,_0x4a8cbd){_0x4a8cbd=_0x4a8cbd||0xc8;return function(_0x580b39){if(_0x580b39){return _0xac2a75[_0x549f('0x1c')](_0x4a8cbd)[_0x549f('0x1e')](_0x580b39);}};}function respondWithFilteredResult(_0x3a9a85,_0x87b802){return function(_0x228b64){if(_0x228b64){var _0x291a5e=typeof _0x87b802[_0x549f('0x1f')]===_0x549f('0x20')&&typeof _0x87b802[_0x549f('0x21')]===_0x549f('0x20');var _0x2fb05c=_0x228b64['count'];var _0xf6d1f5=_0x291a5e?0x0:_0x87b802[_0x549f('0x1f')];var _0xba167f=_0x291a5e?_0x228b64['count']:_0x87b802[_0x549f('0x1f')]+_0x87b802['limit'];var _0x5ae46b;if(_0xba167f>=_0x2fb05c){_0xba167f=_0x2fb05c;_0x5ae46b=0xc8;}else{_0x5ae46b=0xce;}_0x3a9a85[_0x549f('0x1c')](_0x5ae46b);return _0x3a9a85[_0x549f('0x22')]('Content-Range',_0xf6d1f5+'-'+_0xba167f+'/'+_0x2fb05c)[_0x549f('0x1e')](_0x228b64);}return null;};}function patchUpdates(_0x39353b){return function(_0x5f56d3){try{jsonpatch['apply'](_0x5f56d3,_0x39353b,!![]);}catch(_0x50915b){return BPromise[_0x549f('0x23')](_0x50915b);}return _0x5f56d3['save']();};}function saveUpdates(_0x38e17a,_0x44701c){return function(_0x100e24){if(_0x100e24){return _0x100e24['update'](_0x38e17a)['then'](function(_0xef7f58){return _0xef7f58;});}return null;};}function removeEntity(_0x45b2a1,_0x5c08e0){return function(_0xa50b3f){if(_0xa50b3f){return _0xa50b3f['destroy']()['then'](function(){var _0x2f4bf9=_0xa50b3f['get']({'plain':!![]});var _0x6a8592=_0x549f('0x24');return db[_0x549f('0x25')][_0x549f('0x26')]({'where':{'type':_0x6a8592,'resourceId':_0x2f4bf9['id']}})[_0x549f('0x27')](function(){return _0xa50b3f;});})[_0x549f('0x27')](function(){_0x45b2a1[_0x549f('0x1c')](0xcc)[_0x549f('0x1d')]();});}};}function handleEntityNotFound(_0x4f8ae9,_0x212b2a){return function(_0x2f6ddc){if(!_0x2f6ddc){_0x4f8ae9['sendStatus'](0x194);}return _0x2f6ddc;};}function handleError(_0x148d73,_0x5833ce){_0x5833ce=_0x5833ce||0x1f4;return function(_0x4a4240){logger[_0x549f('0x28')](_0x4a4240[_0x549f('0x29')]);if(_0x4a4240[_0x549f('0x2a')]){delete _0x4a4240[_0x549f('0x2a')];}_0x148d73[_0x549f('0x1c')](_0x5833ce)[_0x549f('0x2b')](_0x4a4240);};}exports[_0x549f('0x2c')]=function(_0xee9db6,_0x32576d){var _0x5ef543={},_0x5cf18e={},_0x31b090={'count':0x0,'rows':[]};var _0x3cf8f3=_[_0x549f('0x2d')](db[_0x549f('0x2e')][_0x549f('0x2f')],function(_0x3f1dd4){return{'name':_0x3f1dd4['fieldName'],'type':_0x3f1dd4[_0x549f('0x30')][_0x549f('0x31')]};});_0x5cf18e['model']=_[_0x549f('0x2d')](_0x3cf8f3,'name');_0x5cf18e[_0x549f('0x32')]=_[_0x549f('0x33')](_0xee9db6[_0x549f('0x32')]);_0x5cf18e[_0x549f('0x34')]=_[_0x549f('0x35')](_0x5cf18e[_0x549f('0x36')],_0x5cf18e[_0x549f('0x32')]);_0x5ef543[_0x549f('0x37')]=_[_0x549f('0x35')](_0x5cf18e[_0x549f('0x36')],qs[_0x549f('0x38')](_0xee9db6['query'][_0x549f('0x38')]));_0x5ef543['attributes']=_0x5ef543[_0x549f('0x37')][_0x549f('0x39')]?_0x5ef543['attributes']:_0x5cf18e[_0x549f('0x36')];if(!_0xee9db6['query'][_0x549f('0x3a')]('nolimit')){_0x5ef543[_0x549f('0x21')]=qs[_0x549f('0x21')](_0xee9db6[_0x549f('0x32')]['limit']);_0x5ef543[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0xee9db6[_0x549f('0x32')][_0x549f('0x1f')]);}_0x5ef543[_0x549f('0x3b')]=qs[_0x549f('0x3c')](_0xee9db6[_0x549f('0x32')]['sort']);_0x5ef543[_0x549f('0x3d')]=qs[_0x549f('0x34')](_[_0x549f('0x3e')](_0xee9db6[_0x549f('0x32')],_0x5cf18e['filters']),_0x3cf8f3);if(_0xee9db6[_0x549f('0x32')][_0x549f('0x3f')]){_0x5ef543[_0x549f('0x3d')]=_[_0x549f('0x40')](_0x5ef543['where'],{'$or':_[_0x549f('0x2d')](_0x3cf8f3,function(_0x2ceab7){if(_0x2ceab7['type']!=='VIRTUAL'){var _0xd79808={};_0xd79808[_0x2ceab7[_0x549f('0x2a')]]={'$like':'%'+_0xee9db6[_0x549f('0x32')]['filter']+'%'};return _0xd79808;}})});}_0x5ef543=_[_0x549f('0x40')]({},_0x5ef543,_0xee9db6[_0x549f('0x41')]);var _0x12fe1d={'where':_0x5ef543[_0x549f('0x3d')]};return db[_0x549f('0x2e')][_0x549f('0x42')](_0x12fe1d)['then'](function(_0x1d0a04){_0x31b090['count']=_0x1d0a04;if(_0xee9db6[_0x549f('0x32')]['includeAll']){_0x5ef543[_0x549f('0x43')]=[{'all':!![]}];}return db[_0x549f('0x2e')][_0x549f('0x44')](_0x5ef543);})['then'](function(_0x1be97f){_0x31b090['rows']=_0x1be97f;return _0x31b090;})['then'](respondWithFilteredResult(_0x32576d,_0x5ef543))[_0x549f('0x45')](handleError(_0x32576d,null));};exports['show']=function(_0x55d164,_0xaee39c){var _0x5a8968={'raw':![],'where':{'id':_0x55d164[_0x549f('0x46')]['id']}},_0x5d2640={};_0x5d2640[_0x549f('0x36')]=_['keys'](db[_0x549f('0x2e')]['rawAttributes']);_0x5d2640[_0x549f('0x32')]=_['keys'](_0x55d164[_0x549f('0x32')]);_0x5d2640['filters']=_[_0x549f('0x35')](_0x5d2640['model'],_0x5d2640[_0x549f('0x32')]);_0x5a8968[_0x549f('0x37')]=_['intersection'](_0x5d2640[_0x549f('0x36')],qs[_0x549f('0x38')](_0x55d164[_0x549f('0x32')][_0x549f('0x38')]));_0x5a8968['attributes']=_0x5a8968[_0x549f('0x37')][_0x549f('0x39')]?_0x5a8968[_0x549f('0x37')]:_0x5d2640['model'];if(_0x55d164['query'][_0x549f('0x47')]){_0x5a8968[_0x549f('0x43')]=[{'all':!![]}];}_0x5a8968=_[_0x549f('0x40')]({},_0x5a8968,_0x55d164[_0x549f('0x41')]);return db['JscriptyProject']['find'](_0x5a8968)['then'](handleEntityNotFound(_0xaee39c,null))[_0x549f('0x27')](respondWithResult(_0xaee39c,null))[_0x549f('0x45')](handleError(_0xaee39c,null));};exports[_0x549f('0x48')]=function(_0x3068f1,_0x49a08f){return db['JscriptyProject'][_0x549f('0x48')](_0x3068f1[_0x549f('0x49')],{})[_0x549f('0x27')](function(_0x221961){var _0x99d3fa=_0x3068f1[_0x549f('0x4a')]['get']({'plain':!![]});if(!_0x99d3fa)throw new Error(_0x549f('0x4b'));if(_0x99d3fa[_0x549f('0x4c')]===_0x549f('0x4a')){var _0x4d30d9=_0x221961[_0x549f('0x4d')]({'plain':!![]});var _0x46b54f='Projects';return db[_0x549f('0x4e')][_0x549f('0x4f')]({'where':{'name':_0x46b54f,'userProfileId':_0x99d3fa[_0x549f('0x50')]},'raw':!![]})[_0x549f('0x27')](function(_0x3b652e){if(_0x3b652e&&_0x3b652e[_0x549f('0x51')]===0x0){return db[_0x549f('0x25')]['create']({'name':_0x4d30d9[_0x549f('0x2a')],'resourceId':_0x4d30d9['id'],'type':_0x3b652e[_0x549f('0x2a')],'sectionId':_0x3b652e['id']},{})['then'](function(){return _0x221961;});}else{return _0x221961;}})[_0x549f('0x45')](function(_0x385b64){logger[_0x549f('0x28')](_0x549f('0x52'),_0x385b64);throw _0x385b64;});}return _0x221961;})[_0x549f('0x27')](respondWithResult(_0x49a08f,0xc9))[_0x549f('0x45')](handleError(_0x49a08f,null));};exports['clone']=function(_0x420c47,_0x1ace44){var _0x5cb14b={'where':{'id':_0x420c47[_0x549f('0x46')]['id']}},_0x2c58b9={};_0x2c58b9[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x2e')][_0x549f('0x2f')]);_0x5cb14b[_0x549f('0x37')]=_[_0x549f('0x35')](_0x2c58b9[_0x549f('0x36')],qs[_0x549f('0x38')](_0x420c47['query']['fields']));_0x5cb14b[_0x549f('0x37')]=_0x5cb14b[_0x549f('0x37')][_0x549f('0x39')]?_0x5cb14b[_0x549f('0x37')]:_0x2c58b9[_0x549f('0x36')];if(_0x420c47[_0x549f('0x32')]['includeAll']){_0x5cb14b[_0x549f('0x43')]=[{'all':!![]}];}_0x5cb14b=_[_0x549f('0x40')]({},_0x5cb14b,_0x420c47['options']);return db[_0x549f('0x2e')][_0x549f('0x4f')](_0x5cb14b)[_0x549f('0x27')](handleEntityNotFound(_0x1ace44,null))[_0x549f('0x27')](function(_0x478129){if(_0x478129){var _0x3e5bad=_0x478129['get']({'plain':!![]});_0x3e5bad=qs[_0x549f('0x53')](_0x3e5bad,['id',_0x549f('0x54'),_0x549f('0x55')]);_0x420c47[_0x549f('0x49')]=_['omit'](_0x420c47[_0x549f('0x49')],['id',_0x549f('0x54'),_0x549f('0x55')]);return db[_0x549f('0x2e')][_0x549f('0x48')](_[_0x549f('0x40')](_0x3e5bad,_0x420c47[_0x549f('0x49')]),{'include':_0x420c47[_0x549f('0x32')][_0x549f('0x47')]?[{'all':!![]}]:undefined})[_0x549f('0x27')](function(_0x976aa4){var _0xa1f621=_0x420c47[_0x549f('0x4a')][_0x549f('0x4d')]({'plain':!![]});if(!_0xa1f621)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa1f621[_0x549f('0x4c')]===_0x549f('0x4a')){var _0x15d3f2=_0x976aa4[_0x549f('0x4d')]({'plain':!![]});var _0x5611a6=_0x549f('0x24');return db['UserProfileSection'][_0x549f('0x4f')]({'where':{'name':_0x5611a6,'userProfileId':_0xa1f621[_0x549f('0x50')]},'raw':!![]})[_0x549f('0x27')](function(_0x443a5e){if(_0x443a5e&&_0x443a5e[_0x549f('0x51')]===0x0){return db[_0x549f('0x25')][_0x549f('0x48')]({'name':_0x15d3f2['name'],'resourceId':_0x15d3f2['id'],'type':_0x443a5e['name'],'sectionId':_0x443a5e['id']},{})['then'](function(){return _0x976aa4;});}else{return _0x976aa4;}})[_0x549f('0x45')](function(_0x3ead2a){logger[_0x549f('0x28')](_0x549f('0x52'),_0x3ead2a);throw _0x3ead2a;});}return _0x976aa4;});}})['then'](respondWithResult(_0x1ace44,0xc9))[_0x549f('0x45')](handleError(_0x1ace44,null));};exports[_0x549f('0x56')]=function(_0xfb0c8f,_0x3c8ccb){if(_0xfb0c8f[_0x549f('0x49')]['id']){delete _0xfb0c8f[_0x549f('0x49')]['id'];}return db['JscriptyProject'][_0x549f('0x4f')]({'where':{'id':_0xfb0c8f['params']['id']}})['then'](handleEntityNotFound(_0x3c8ccb,null))[_0x549f('0x27')](saveUpdates(_0xfb0c8f['body'],null))[_0x549f('0x27')](respondWithResult(_0x3c8ccb,null))[_0x549f('0x45')](handleError(_0x3c8ccb,null));};exports[_0x549f('0x26')]=function(_0x3f08e6,_0x18c346){return db[_0x549f('0x2e')][_0x549f('0x4f')]({'where':{'id':_0x3f08e6[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0x18c346,null))['then'](removeEntity(_0x18c346,null))[_0x549f('0x45')](handleError(_0x18c346,null));};exports[_0x549f('0x57')]=function(_0x1d464e,_0xb06e3,_0x20f707){var _0x37f3b5={'raw':!![],'where':{}};var _0x436f24={};var _0x531bd0={'count':0x0,'rows':[]};return db[_0x549f('0x2e')][_0x549f('0x58')]({'where':{'id':_0x1d464e[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0xb06e3,null))[_0x549f('0x27')](function(_0x316243){if(_0x316243){_0x436f24[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x59')][_0x549f('0x2f')]);_0x436f24[_0x549f('0x32')]=_['keys'](_0x1d464e['query']);_0x436f24['filters']=_[_0x549f('0x35')](_0x436f24[_0x549f('0x36')],_0x436f24[_0x549f('0x32')]);_0x37f3b5[_0x549f('0x37')]=_[_0x549f('0x35')](_0x436f24['model'],qs[_0x549f('0x38')](_0x1d464e[_0x549f('0x32')]['fields']));_0x37f3b5[_0x549f('0x37')]=_0x37f3b5['attributes'][_0x549f('0x39')]?_0x37f3b5[_0x549f('0x37')]:_0x436f24[_0x549f('0x36')];if(!_0x1d464e[_0x549f('0x32')][_0x549f('0x3a')]('nolimit')){_0x37f3b5[_0x549f('0x21')]=qs[_0x549f('0x21')](_0x1d464e[_0x549f('0x32')][_0x549f('0x21')]);_0x37f3b5[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0x1d464e['query'][_0x549f('0x1f')]);}_0x37f3b5[_0x549f('0x3b')]=qs[_0x549f('0x3c')](_0x1d464e[_0x549f('0x32')][_0x549f('0x3c')]);_0x37f3b5[_0x549f('0x3d')]=qs[_0x549f('0x34')](_['pick'](_0x1d464e[_0x549f('0x32')],_0x436f24[_0x549f('0x34')]));_0x37f3b5[_0x549f('0x3d')]['ProjectId']=_0x316243['id'];if(_0x1d464e['query'][_0x549f('0x3f')]){_0x37f3b5[_0x549f('0x3d')]=_['merge'](_0x37f3b5['where'],{'$or':_[_0x549f('0x2d')](_0x37f3b5[_0x549f('0x37')],function(_0x147f04){var _0x28a4cd={};_0x28a4cd[_0x147f04]={'$like':'%'+_0x1d464e[_0x549f('0x32')]['filter']+'%'};return _0x28a4cd;})});}_0x37f3b5=_[_0x549f('0x40')]({},_0x37f3b5,_0x1d464e[_0x549f('0x41')]);return db[_0x549f('0x59')][_0x549f('0x42')]({'where':_0x37f3b5[_0x549f('0x3d')]})[_0x549f('0x27')](function(_0x452662){_0x531bd0[_0x549f('0x42')]=_0x452662;if(_0x1d464e[_0x549f('0x32')][_0x549f('0x47')]){_0x37f3b5['include']=[{'all':!![]}];}return db[_0x549f('0x59')]['findAll'](_0x37f3b5);})[_0x549f('0x27')](function(_0x5a558e){_0x531bd0['rows']=_0x5a558e;return _0x531bd0;});}})[_0x549f('0x27')](respondWithFilteredResult(_0xb06e3,_0x37f3b5))[_0x549f('0x45')](handleError(_0xb06e3,null));};exports['getAnswers']=function(_0x10a14c,_0x5ac10c,_0x2691c6){var _0xd50313={'raw':!![],'where':{}};var _0x4280f9={};var _0x2525e0={'count':0x0,'rows':[]};return db[_0x549f('0x2e')]['findOne']({'where':{'id':_0x10a14c[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0x5ac10c,null))[_0x549f('0x27')](function(_0x197954){if(_0x197954){_0x4280f9[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x5a')][_0x549f('0x2f')]);_0x4280f9[_0x549f('0x32')]=_[_0x549f('0x33')](_0x10a14c['query']);_0x4280f9[_0x549f('0x34')]=_[_0x549f('0x35')](_0x4280f9[_0x549f('0x36')],_0x4280f9[_0x549f('0x32')]);_0xd50313[_0x549f('0x37')]=_[_0x549f('0x35')](_0x4280f9[_0x549f('0x36')],qs[_0x549f('0x38')](_0x10a14c[_0x549f('0x32')][_0x549f('0x38')]));_0xd50313['attributes']=_0xd50313['attributes'][_0x549f('0x39')]?_0xd50313[_0x549f('0x37')]:_0x4280f9[_0x549f('0x36')];if(!_0x10a14c[_0x549f('0x32')][_0x549f('0x3a')](_0x549f('0x5b'))){_0xd50313[_0x549f('0x21')]=qs[_0x549f('0x21')](_0x10a14c[_0x549f('0x32')][_0x549f('0x21')]);_0xd50313[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0x10a14c[_0x549f('0x32')][_0x549f('0x1f')]);}_0xd50313['order']=qs[_0x549f('0x3c')](_0x10a14c[_0x549f('0x32')][_0x549f('0x3c')]);_0xd50313[_0x549f('0x3d')]=qs[_0x549f('0x34')](_[_0x549f('0x3e')](_0x10a14c[_0x549f('0x32')],_0x4280f9[_0x549f('0x34')]));_0xd50313[_0x549f('0x3d')][_0x549f('0x5c')]=_0x197954['id'];if(_0x10a14c[_0x549f('0x32')][_0x549f('0x3f')]){_0xd50313['where']=_['merge'](_0xd50313[_0x549f('0x3d')],{'$or':_[_0x549f('0x2d')](_0xd50313[_0x549f('0x37')],function(_0x3891c0){var _0x4d744d={};_0x4d744d[_0x3891c0]={'$like':'%'+_0x10a14c[_0x549f('0x32')]['filter']+'%'};return _0x4d744d;})});}_0xd50313=_[_0x549f('0x40')]({},_0xd50313,_0x10a14c['options']);return db['JscriptyAnswerReport'][_0x549f('0x42')]({'where':_0xd50313['where']})[_0x549f('0x27')](function(_0x4359d4){_0x2525e0['count']=_0x4359d4;if(_0x10a14c[_0x549f('0x32')][_0x549f('0x47')]){_0xd50313[_0x549f('0x43')]=[{'all':!![]}];}return db[_0x549f('0x5a')][_0x549f('0x44')](_0xd50313);})[_0x549f('0x27')](function(_0x4e6c2e){_0x2525e0[_0x549f('0x5d')]=_0x4e6c2e;return _0x2525e0;});}})[_0x549f('0x27')](respondWithFilteredResult(_0x5ac10c,_0xd50313))['catch'](handleError(_0x5ac10c,null));};function char(_0x21aba7){return _0x549f('0x5e')===typeof _0x21aba7?String[_0x549f('0x5f')][_0x549f('0x60')](null,arguments):_0x21aba7;}function needsEncapsulation(_0x3d66aa){return!!_0x3d66aa&&(_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0xd))>=0x0||_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0xa))>=0x0||_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0x2c))>=0x0||_0x3d66aa[_0x549f('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x433eb4){var _0x4ca368=char(0x22),_0x1277fa='\x5c'+char(0x22),_0x481ae2=_0x433eb4[_0x549f('0x61')]()[_0x549f('0x63')](new RegExp(_0x4ca368,'g'),_0x1277fa);return _0x4ca368+_0x481ae2+_0x4ca368;}exports[_0x549f('0x64')]=function(_0x487015,_0x335a42,_0x26300f){var _0x233bef,_0x517e1f;var _0x37a13d={'where':{'ProjectId':_0x487015[_0x549f('0x46')]['id']}};if(_0x487015[_0x549f('0x32')]['startTime']){_0x37a13d['where']['starttime']=JSON[_0x549f('0x65')](_0x487015[_0x549f('0x32')]['startTime']);}return db[_0x549f('0x59')]['findAll'](_0x37a13d)[_0x549f('0x27')](handleEntityNotFound(_0x335a42,null))['then'](function(_0x10f72f){if(_0x10f72f){_0x233bef=_0x10f72f;return db[_0x549f('0x66')][_0x549f('0x44')]({'where':{'SessionId':{'$in':_[_0x549f('0x2d')](_0x233bef,'id')},'ProjectId':_0x487015[_0x549f('0x46')]['id']},'order':_0x549f('0x67')});}})['then'](handleEntityNotFound(_0x335a42,null))[_0x549f('0x27')](function(_0x3f4683){if(_0x3f4683){_0x517e1f=_0x3f4683;var _0x391216={};for(var _0x401609=0x0,_0x9d9789=_0x517e1f[_0x549f('0x39')];_0x401609<_0x9d9789;_0x401609++){if(!_0x391216['hasOwnProperty'](_0x517e1f[_0x401609]['questionId'])){_0x391216[_0x517e1f[_0x401609]['questionId']]=needsEncapsulation(_0x517e1f[_0x401609][_0x549f('0x68')])?encapsulate(_0x517e1f[_0x401609]['question']):_0x517e1f[_0x401609][_0x549f('0x68')];}}var _0x3d29c4=[],_0x57532b={};for(var _0x414a84=0x0,_0x1a3702=_0x233bef[_0x549f('0x39')];_0x414a84<_0x1a3702;_0x414a84++){_0x57532b={'ProjectId':_0x487015[_0x549f('0x46')]['id'],'SessionId':_0x233bef[_0x414a84]['id'],'StartTime':moment(_0x233bef[_0x414a84][_0x549f('0x69')])[_0x549f('0x6a')](_0x549f('0x6b'))};for(var _0x8f12b0=0x0,_0x1b10cc=_0x517e1f[_0x549f('0x39')];_0x8f12b0<_0x1b10cc;_0x8f12b0++){if(_0x517e1f[_0x8f12b0][_0x549f('0x6c')]==_0x233bef[_0x414a84]['id']&&_0x391216['hasOwnProperty'](_0x517e1f[_0x8f12b0][_0x549f('0x6d')])){_0x57532b[_0x391216[_0x517e1f[_0x8f12b0][_0x549f('0x6d')]]]=_0x517e1f[_0x8f12b0][_0x549f('0x6e')];}}for(var _0x47aa9a in _0x391216){if(!_0x57532b[_0x549f('0x3a')](_0x391216[_0x47aa9a])){_0x57532b[_0x391216[_0x47aa9a]]=null;}}_0x3d29c4[_0x549f('0x6f')](_0x57532b);}return _0x3d29c4;}})['then'](function(_0x5b37ad){if(!_[_0x549f('0x70')](_0x5b37ad)){var _0x899339=toCsv(_0x5b37ad);var _0x3f8e21=Date[_0x549f('0x71')]();fs['writeFileSync'](util[_0x549f('0x6a')](_0x549f('0x72'),_0x487015[_0x549f('0x46')]['id'],_0x3f8e21),_0x899339);_0x335a42[_0x549f('0x73')](_0x549f('0x74'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x487015[_0x549f('0x46')]['id'],_0x3f8e21));_0x335a42[_0x549f('0x73')]('Content-type',_0x549f('0x75'));return _0x335a42[_0x549f('0x76')](util['format'](_0x549f('0x72'),_0x487015[_0x549f('0x46')]['id'],_0x3f8e21));}else{return _0x335a42[_0x549f('0x1b')](0xcc);}})[_0x549f('0x45')](handleError(_0x335a42,null));}; \ No newline at end of file +var _0x63ad=['questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','rimraf','zip-dir','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','Projects','stack','name','send','rawAttributes','type','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','JscriptyProject','include','rows','catch','show','keys','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','clone','params','omit','createdAt','updatedAt','body','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','pick','ProjectId','findAll','JscriptyAnswerReport','number','indexOf','toString','replace','getSummary','startTime','starttime','parse','-createdAt'];(function(_0x5c0979,_0x287854){var _0x309972=function(_0x17defd){while(--_0x17defd){_0x5c0979['push'](_0x5c0979['shift']());}};_0x309972(++_0x287854);}(_0x63ad,0x7d));var _0xd63a=function(_0xf91724,_0x32907e){_0xf91724=_0xf91724-0x0;var _0x5e7f79=_0x63ad[_0xf91724];return _0x5e7f79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd63a('0x0'));var zipdir=require(_0xd63a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd63a('0x2'));var util=require(_0xd63a('0x3'));var path=require('path');var sox=require(_0xd63a('0x4'));var csv=require(_0xd63a('0x5'));var ejs=require(_0xd63a('0x6'));var fs=require('fs');var fs_extra=require(_0xd63a('0x7'));var _=require(_0xd63a('0x8'));var squel=require(_0xd63a('0x9'));var crypto=require('crypto');var jsforce=require(_0xd63a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd63a('0x5'));var querystring=require('querystring');var Papa=require(_0xd63a('0xb'));var Redis=require(_0xd63a('0xc'));var authService=require(_0xd63a('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd63a('0xe'))('api');var utils=require(_0xd63a('0xf'));var config=require(_0xd63a('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xd63a('0x11'))['db'];function respondWithStatusCode(_0x24bc2b,_0x2d58fe){_0x2d58fe=_0x2d58fe||0xcc;return function(_0x4741f5){if(_0x4741f5){return _0x24bc2b[_0xd63a('0x12')](_0x2d58fe);}return _0x24bc2b[_0xd63a('0x13')](_0x2d58fe)[_0xd63a('0x14')]();};}function respondWithResult(_0x507082,_0x1b3551){_0x1b3551=_0x1b3551||0xc8;return function(_0x24bd46){if(_0x24bd46){return _0x507082[_0xd63a('0x13')](_0x1b3551)[_0xd63a('0x15')](_0x24bd46);}};}function respondWithFilteredResult(_0x1284cf,_0x2c4ff8){return function(_0x2d9b2b){if(_0x2d9b2b){var _0x59423d=typeof _0x2c4ff8[_0xd63a('0x16')]==='undefined'&&typeof _0x2c4ff8[_0xd63a('0x17')]===_0xd63a('0x18');var _0x3cb525=_0x2d9b2b[_0xd63a('0x19')];var _0x68c0e5=_0x59423d?0x0:_0x2c4ff8[_0xd63a('0x16')];var _0x23bdc8=_0x59423d?_0x2d9b2b[_0xd63a('0x19')]:_0x2c4ff8['offset']+_0x2c4ff8[_0xd63a('0x17')];var _0x5c2f07;if(_0x23bdc8>=_0x3cb525){_0x23bdc8=_0x3cb525;_0x5c2f07=0xc8;}else{_0x5c2f07=0xce;}_0x1284cf[_0xd63a('0x13')](_0x5c2f07);return _0x1284cf[_0xd63a('0x1a')]('Content-Range',_0x68c0e5+'-'+_0x23bdc8+'/'+_0x3cb525)['json'](_0x2d9b2b);}return null;};}function patchUpdates(_0x39c30f){return function(_0x30d7c1){try{jsonpatch[_0xd63a('0x1b')](_0x30d7c1,_0x39c30f,!![]);}catch(_0x2a4759){return BPromise['reject'](_0x2a4759);}return _0x30d7c1[_0xd63a('0x1c')]();};}function saveUpdates(_0x36dd33,_0x194bac){return function(_0x1faf54){if(_0x1faf54){return _0x1faf54['update'](_0x36dd33)[_0xd63a('0x1d')](function(_0x5059c8){return _0x5059c8;});}return null;};}function removeEntity(_0x1c19c2,_0x36269c){return function(_0x5e3148){if(_0x5e3148){return _0x5e3148[_0xd63a('0x1e')]()[_0xd63a('0x1d')](function(){var _0x1924c6=_0x5e3148['get']({'plain':!![]});var _0x50ea2d=_0xd63a('0x1f');return db['UserProfileResource']['destroy']({'where':{'type':_0x50ea2d,'resourceId':_0x1924c6['id']}})[_0xd63a('0x1d')](function(){return _0x5e3148;});})[_0xd63a('0x1d')](function(){_0x1c19c2[_0xd63a('0x13')](0xcc)[_0xd63a('0x14')]();});}};}function handleEntityNotFound(_0x20fb37,_0x14ada0){return function(_0x48814a){if(!_0x48814a){_0x20fb37[_0xd63a('0x12')](0x194);}return _0x48814a;};}function handleError(_0x4d2cf4,_0x533370){_0x533370=_0x533370||0x1f4;return function(_0x49c815){logger['error'](_0x49c815[_0xd63a('0x20')]);if(_0x49c815[_0xd63a('0x21')]){delete _0x49c815[_0xd63a('0x21')];}_0x4d2cf4[_0xd63a('0x13')](_0x533370)[_0xd63a('0x22')](_0x49c815);};}exports['index']=function(_0x246f46,_0x12ddb5){var _0x2735af={},_0x403911={},_0x19c16d={'count':0x0,'rows':[]};var _0x2f95db=_['map'](db['JscriptyProject'][_0xd63a('0x23')],function(_0x379d21){return{'name':_0x379d21['fieldName'],'type':_0x379d21[_0xd63a('0x24')]['key']};});_0x403911['model']=_['map'](_0x2f95db,'name');_0x403911[_0xd63a('0x25')]=_['keys'](_0x246f46[_0xd63a('0x25')]);_0x403911[_0xd63a('0x26')]=_['intersection'](_0x403911[_0xd63a('0x27')],_0x403911[_0xd63a('0x25')]);_0x2735af['attributes']=_[_0xd63a('0x28')](_0x403911[_0xd63a('0x27')],qs['fields'](_0x246f46[_0xd63a('0x25')][_0xd63a('0x29')]));_0x2735af[_0xd63a('0x2a')]=_0x2735af['attributes'][_0xd63a('0x2b')]?_0x2735af[_0xd63a('0x2a')]:_0x403911[_0xd63a('0x27')];if(!_0x246f46[_0xd63a('0x25')][_0xd63a('0x2c')](_0xd63a('0x2d'))){_0x2735af[_0xd63a('0x17')]=qs[_0xd63a('0x17')](_0x246f46[_0xd63a('0x25')]['limit']);_0x2735af[_0xd63a('0x16')]=qs[_0xd63a('0x16')](_0x246f46['query'][_0xd63a('0x16')]);}_0x2735af[_0xd63a('0x2e')]=qs[_0xd63a('0x2f')](_0x246f46[_0xd63a('0x25')][_0xd63a('0x2f')]);_0x2735af[_0xd63a('0x30')]=qs[_0xd63a('0x26')](_['pick'](_0x246f46['query'],_0x403911[_0xd63a('0x26')]),_0x2f95db);if(_0x246f46[_0xd63a('0x25')]['filter']){_0x2735af[_0xd63a('0x30')]=_[_0xd63a('0x31')](_0x2735af['where'],{'$or':_[_0xd63a('0x32')](_0x2f95db,function(_0x2f6963){if(_0x2f6963['type']!==_0xd63a('0x33')){var _0x1d2391={};_0x1d2391[_0x2f6963[_0xd63a('0x21')]]={'$like':'%'+_0x246f46[_0xd63a('0x25')][_0xd63a('0x34')]+'%'};return _0x1d2391;}})});}_0x2735af=_[_0xd63a('0x31')]({},_0x2735af,_0x246f46[_0xd63a('0x35')]);var _0x3337eb={'where':_0x2735af[_0xd63a('0x30')]};return db[_0xd63a('0x36')][_0xd63a('0x19')](_0x3337eb)[_0xd63a('0x1d')](function(_0x2d2112){_0x19c16d[_0xd63a('0x19')]=_0x2d2112;if(_0x246f46[_0xd63a('0x25')]['includeAll']){_0x2735af[_0xd63a('0x37')]=[{'all':!![]}];}return db[_0xd63a('0x36')]['findAll'](_0x2735af);})[_0xd63a('0x1d')](function(_0x33a0e2){_0x19c16d[_0xd63a('0x38')]=_0x33a0e2;return _0x19c16d;})[_0xd63a('0x1d')](respondWithFilteredResult(_0x12ddb5,_0x2735af))[_0xd63a('0x39')](handleError(_0x12ddb5,null));};exports[_0xd63a('0x3a')]=function(_0x35bf14,_0x4b041d){var _0x500d98={'raw':![],'where':{'id':_0x35bf14['params']['id']}},_0x47bbb0={};_0x47bbb0[_0xd63a('0x27')]=_[_0xd63a('0x3b')](db[_0xd63a('0x36')]['rawAttributes']);_0x47bbb0[_0xd63a('0x25')]=_[_0xd63a('0x3b')](_0x35bf14[_0xd63a('0x25')]);_0x47bbb0[_0xd63a('0x26')]=_[_0xd63a('0x28')](_0x47bbb0[_0xd63a('0x27')],_0x47bbb0['query']);_0x500d98[_0xd63a('0x2a')]=_[_0xd63a('0x28')](_0x47bbb0[_0xd63a('0x27')],qs[_0xd63a('0x29')](_0x35bf14['query'][_0xd63a('0x29')]));_0x500d98[_0xd63a('0x2a')]=_0x500d98[_0xd63a('0x2a')][_0xd63a('0x2b')]?_0x500d98[_0xd63a('0x2a')]:_0x47bbb0[_0xd63a('0x27')];if(_0x35bf14['query'][_0xd63a('0x3c')]){_0x500d98['include']=[{'all':!![]}];}_0x500d98=_['merge']({},_0x500d98,_0x35bf14[_0xd63a('0x35')]);return db['JscriptyProject'][_0xd63a('0x3d')](_0x500d98)[_0xd63a('0x1d')](handleEntityNotFound(_0x4b041d,null))[_0xd63a('0x1d')](respondWithResult(_0x4b041d,null))['catch'](handleError(_0x4b041d,null));};exports[_0xd63a('0x3e')]=function(_0x78d162,_0x4f4ff7){return db[_0xd63a('0x36')]['create'](_0x78d162['body'],{})[_0xd63a('0x1d')](function(_0x41dadc){var _0x14a759=_0x78d162['user'][_0xd63a('0x3f')]({'plain':!![]});if(!_0x14a759)throw new Error(_0xd63a('0x40'));if(_0x14a759[_0xd63a('0x41')]===_0xd63a('0x42')){var _0x11fa4d=_0x41dadc[_0xd63a('0x3f')]({'plain':!![]});var _0x306950='Projects';return db[_0xd63a('0x43')][_0xd63a('0x3d')]({'where':{'name':_0x306950,'userProfileId':_0x14a759[_0xd63a('0x44')]},'raw':!![]})['then'](function(_0x3856ee){if(_0x3856ee&&_0x3856ee['autoAssociation']===0x0){return db[_0xd63a('0x45')][_0xd63a('0x3e')]({'name':_0x11fa4d[_0xd63a('0x21')],'resourceId':_0x11fa4d['id'],'type':_0x3856ee[_0xd63a('0x21')],'sectionId':_0x3856ee['id']},{})[_0xd63a('0x1d')](function(){return _0x41dadc;});}else{return _0x41dadc;}})['catch'](function(_0x1266bf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1266bf);throw _0x1266bf;});}return _0x41dadc;})[_0xd63a('0x1d')](respondWithResult(_0x4f4ff7,0xc9))[_0xd63a('0x39')](handleError(_0x4f4ff7,null));};exports[_0xd63a('0x46')]=function(_0x12a8e4,_0x59eb35){var _0x4da7db={'where':{'id':_0x12a8e4[_0xd63a('0x47')]['id']}},_0x13f777={};_0x13f777[_0xd63a('0x27')]=_[_0xd63a('0x3b')](db[_0xd63a('0x36')][_0xd63a('0x23')]);_0x4da7db[_0xd63a('0x2a')]=_[_0xd63a('0x28')](_0x13f777['model'],qs[_0xd63a('0x29')](_0x12a8e4[_0xd63a('0x25')][_0xd63a('0x29')]));_0x4da7db[_0xd63a('0x2a')]=_0x4da7db['attributes']['length']?_0x4da7db[_0xd63a('0x2a')]:_0x13f777[_0xd63a('0x27')];if(_0x12a8e4[_0xd63a('0x25')][_0xd63a('0x3c')]){_0x4da7db[_0xd63a('0x37')]=[{'all':!![]}];}_0x4da7db=_[_0xd63a('0x31')]({},_0x4da7db,_0x12a8e4['options']);return db['JscriptyProject'][_0xd63a('0x3d')](_0x4da7db)[_0xd63a('0x1d')](handleEntityNotFound(_0x59eb35,null))[_0xd63a('0x1d')](function(_0x591d4f){if(_0x591d4f){var _0x5e90e6=_0x591d4f[_0xd63a('0x3f')]({'plain':!![]});_0x5e90e6=qs[_0xd63a('0x48')](_0x5e90e6,['id',_0xd63a('0x49'),_0xd63a('0x4a')]);_0x12a8e4[_0xd63a('0x4b')]=_[_0xd63a('0x48')](_0x12a8e4[_0xd63a('0x4b')],['id',_0xd63a('0x49'),'updatedAt']);return db[_0xd63a('0x36')][_0xd63a('0x3e')](_[_0xd63a('0x31')](_0x5e90e6,_0x12a8e4['body']),{'include':_0x12a8e4[_0xd63a('0x25')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x242d19){var _0x2a3979=_0x12a8e4[_0xd63a('0x42')]['get']({'plain':!![]});if(!_0x2a3979)throw new Error(_0xd63a('0x40'));if(_0x2a3979[_0xd63a('0x41')]===_0xd63a('0x42')){var _0x3aa156=_0x242d19['get']({'plain':!![]});var _0x486c8e='Projects';return db[_0xd63a('0x43')]['find']({'where':{'name':_0x486c8e,'userProfileId':_0x2a3979[_0xd63a('0x44')]},'raw':!![]})[_0xd63a('0x1d')](function(_0x55206f){if(_0x55206f&&_0x55206f[_0xd63a('0x4c')]===0x0){return db[_0xd63a('0x45')][_0xd63a('0x3e')]({'name':_0x3aa156[_0xd63a('0x21')],'resourceId':_0x3aa156['id'],'type':_0x55206f[_0xd63a('0x21')],'sectionId':_0x55206f['id']},{})['then'](function(){return _0x242d19;});}else{return _0x242d19;}})[_0xd63a('0x39')](function(_0x56d3a2){logger[_0xd63a('0x4d')](_0xd63a('0x4e'),_0x56d3a2);throw _0x56d3a2;});}return _0x242d19;});}})[_0xd63a('0x1d')](respondWithResult(_0x59eb35,0xc9))[_0xd63a('0x39')](handleError(_0x59eb35,null));};exports['update']=function(_0x4b402d,_0x17bffd){if(_0x4b402d[_0xd63a('0x4b')]['id']){delete _0x4b402d['body']['id'];}return db['JscriptyProject'][_0xd63a('0x3d')]({'where':{'id':_0x4b402d['params']['id']}})[_0xd63a('0x1d')](handleEntityNotFound(_0x17bffd,null))[_0xd63a('0x1d')](saveUpdates(_0x4b402d[_0xd63a('0x4b')],null))[_0xd63a('0x1d')](respondWithResult(_0x17bffd,null))['catch'](handleError(_0x17bffd,null));};exports[_0xd63a('0x1e')]=function(_0xda51ea,_0xb1b220){return db[_0xd63a('0x36')][_0xd63a('0x3d')]({'where':{'id':_0xda51ea[_0xd63a('0x47')]['id']}})[_0xd63a('0x1d')](handleEntityNotFound(_0xb1b220,null))[_0xd63a('0x1d')](removeEntity(_0xb1b220,null))['catch'](handleError(_0xb1b220,null));};exports[_0xd63a('0x4f')]=function(_0x11dd0a,_0x589d96,_0x9879bc){var _0x54b47a={'raw':!![],'where':{}};var _0x287a80={};var _0x427e34={'count':0x0,'rows':[]};return db[_0xd63a('0x36')][_0xd63a('0x50')]({'where':{'id':_0x11dd0a[_0xd63a('0x47')]['id']}})[_0xd63a('0x1d')](handleEntityNotFound(_0x589d96,null))[_0xd63a('0x1d')](function(_0x26849b){if(_0x26849b){_0x287a80[_0xd63a('0x27')]=_[_0xd63a('0x3b')](db[_0xd63a('0x51')]['rawAttributes']);_0x287a80[_0xd63a('0x25')]=_[_0xd63a('0x3b')](_0x11dd0a['query']);_0x287a80[_0xd63a('0x26')]=_[_0xd63a('0x28')](_0x287a80[_0xd63a('0x27')],_0x287a80[_0xd63a('0x25')]);_0x54b47a[_0xd63a('0x2a')]=_['intersection'](_0x287a80['model'],qs['fields'](_0x11dd0a[_0xd63a('0x25')][_0xd63a('0x29')]));_0x54b47a['attributes']=_0x54b47a['attributes'][_0xd63a('0x2b')]?_0x54b47a[_0xd63a('0x2a')]:_0x287a80[_0xd63a('0x27')];if(!_0x11dd0a[_0xd63a('0x25')][_0xd63a('0x2c')](_0xd63a('0x2d'))){_0x54b47a[_0xd63a('0x17')]=qs['limit'](_0x11dd0a[_0xd63a('0x25')][_0xd63a('0x17')]);_0x54b47a['offset']=qs[_0xd63a('0x16')](_0x11dd0a[_0xd63a('0x25')][_0xd63a('0x16')]);}_0x54b47a[_0xd63a('0x2e')]=qs[_0xd63a('0x2f')](_0x11dd0a[_0xd63a('0x25')][_0xd63a('0x2f')]);_0x54b47a['where']=qs[_0xd63a('0x26')](_[_0xd63a('0x52')](_0x11dd0a[_0xd63a('0x25')],_0x287a80['filters']));_0x54b47a[_0xd63a('0x30')][_0xd63a('0x53')]=_0x26849b['id'];if(_0x11dd0a[_0xd63a('0x25')][_0xd63a('0x34')]){_0x54b47a[_0xd63a('0x30')]=_['merge'](_0x54b47a['where'],{'$or':_[_0xd63a('0x32')](_0x54b47a[_0xd63a('0x2a')],function(_0x58dfa9){var _0x3e5b24={};_0x3e5b24[_0x58dfa9]={'$like':'%'+_0x11dd0a['query'][_0xd63a('0x34')]+'%'};return _0x3e5b24;})});}_0x54b47a=_[_0xd63a('0x31')]({},_0x54b47a,_0x11dd0a['options']);return db['JscriptySessionReport']['count']({'where':_0x54b47a['where']})[_0xd63a('0x1d')](function(_0x4e2b9e){_0x427e34[_0xd63a('0x19')]=_0x4e2b9e;if(_0x11dd0a['query'][_0xd63a('0x3c')]){_0x54b47a[_0xd63a('0x37')]=[{'all':!![]}];}return db[_0xd63a('0x51')][_0xd63a('0x54')](_0x54b47a);})[_0xd63a('0x1d')](function(_0x36d3f1){_0x427e34['rows']=_0x36d3f1;return _0x427e34;});}})['then'](respondWithFilteredResult(_0x589d96,_0x54b47a))['catch'](handleError(_0x589d96,null));};exports['getAnswers']=function(_0x2d4331,_0x47d1b5,_0x21b99d){var _0x3e29dc={'raw':!![],'where':{}};var _0x454a79={};var _0x1273a8={'count':0x0,'rows':[]};return db[_0xd63a('0x36')][_0xd63a('0x50')]({'where':{'id':_0x2d4331['params']['id']}})[_0xd63a('0x1d')](handleEntityNotFound(_0x47d1b5,null))[_0xd63a('0x1d')](function(_0x27de05){if(_0x27de05){_0x454a79[_0xd63a('0x27')]=_[_0xd63a('0x3b')](db['JscriptyAnswerReport'][_0xd63a('0x23')]);_0x454a79[_0xd63a('0x25')]=_[_0xd63a('0x3b')](_0x2d4331[_0xd63a('0x25')]);_0x454a79[_0xd63a('0x26')]=_[_0xd63a('0x28')](_0x454a79[_0xd63a('0x27')],_0x454a79['query']);_0x3e29dc[_0xd63a('0x2a')]=_[_0xd63a('0x28')](_0x454a79['model'],qs[_0xd63a('0x29')](_0x2d4331['query']['fields']));_0x3e29dc[_0xd63a('0x2a')]=_0x3e29dc[_0xd63a('0x2a')][_0xd63a('0x2b')]?_0x3e29dc[_0xd63a('0x2a')]:_0x454a79[_0xd63a('0x27')];if(!_0x2d4331[_0xd63a('0x25')][_0xd63a('0x2c')](_0xd63a('0x2d'))){_0x3e29dc[_0xd63a('0x17')]=qs[_0xd63a('0x17')](_0x2d4331[_0xd63a('0x25')]['limit']);_0x3e29dc[_0xd63a('0x16')]=qs[_0xd63a('0x16')](_0x2d4331[_0xd63a('0x25')][_0xd63a('0x16')]);}_0x3e29dc[_0xd63a('0x2e')]=qs[_0xd63a('0x2f')](_0x2d4331[_0xd63a('0x25')][_0xd63a('0x2f')]);_0x3e29dc['where']=qs['filters'](_[_0xd63a('0x52')](_0x2d4331[_0xd63a('0x25')],_0x454a79['filters']));_0x3e29dc['where'][_0xd63a('0x53')]=_0x27de05['id'];if(_0x2d4331[_0xd63a('0x25')][_0xd63a('0x34')]){_0x3e29dc['where']=_[_0xd63a('0x31')](_0x3e29dc[_0xd63a('0x30')],{'$or':_['map'](_0x3e29dc[_0xd63a('0x2a')],function(_0x180ac7){var _0x11f03e={};_0x11f03e[_0x180ac7]={'$like':'%'+_0x2d4331[_0xd63a('0x25')][_0xd63a('0x34')]+'%'};return _0x11f03e;})});}_0x3e29dc=_['merge']({},_0x3e29dc,_0x2d4331[_0xd63a('0x35')]);return db[_0xd63a('0x55')][_0xd63a('0x19')]({'where':_0x3e29dc[_0xd63a('0x30')]})[_0xd63a('0x1d')](function(_0x3be5ae){_0x1273a8[_0xd63a('0x19')]=_0x3be5ae;if(_0x2d4331['query'][_0xd63a('0x3c')]){_0x3e29dc[_0xd63a('0x37')]=[{'all':!![]}];}return db[_0xd63a('0x55')][_0xd63a('0x54')](_0x3e29dc);})[_0xd63a('0x1d')](function(_0x452810){_0x1273a8[_0xd63a('0x38')]=_0x452810;return _0x1273a8;});}})[_0xd63a('0x1d')](respondWithFilteredResult(_0x47d1b5,_0x3e29dc))[_0xd63a('0x39')](handleError(_0x47d1b5,null));};function char(_0x32b367){return _0xd63a('0x56')===typeof _0x32b367?String['fromCharCode'][_0xd63a('0x1b')](null,arguments):_0x32b367;}function needsEncapsulation(_0x5dbd33){return!!_0x5dbd33&&(_0x5dbd33['toString']()[_0xd63a('0x57')](char(0xd))>=0x0||_0x5dbd33[_0xd63a('0x58')]()['indexOf'](char(0xa))>=0x0||_0x5dbd33[_0xd63a('0x58')]()[_0xd63a('0x57')](char(0x2c))>=0x0||_0x5dbd33[_0xd63a('0x58')]()[_0xd63a('0x57')](char(0x22))>=0x0);}function encapsulate(_0x5b2fa1){var _0xeb8f72=char(0x22),_0x37d85d='\x5c'+char(0x22),_0x583d63=_0x5b2fa1[_0xd63a('0x58')]()[_0xd63a('0x59')](new RegExp(_0xeb8f72,'g'),_0x37d85d);return _0xeb8f72+_0x583d63+_0xeb8f72;}exports[_0xd63a('0x5a')]=function(_0x3b24d5,_0x4368e8,_0x3a6b4b){var _0x196802,_0x181a1c;var _0x182080={'where':{'ProjectId':_0x3b24d5[_0xd63a('0x47')]['id']}};if(_0x3b24d5[_0xd63a('0x25')][_0xd63a('0x5b')]){_0x182080[_0xd63a('0x30')][_0xd63a('0x5c')]=JSON[_0xd63a('0x5d')](_0x3b24d5[_0xd63a('0x25')]['startTime']);}return db[_0xd63a('0x51')]['findAll'](_0x182080)[_0xd63a('0x1d')](handleEntityNotFound(_0x4368e8,null))['then'](function(_0x19cafa){if(_0x19cafa){_0x196802=_0x19cafa;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xd63a('0x32')](_0x196802,'id')},'ProjectId':_0x3b24d5[_0xd63a('0x47')]['id']},'order':_0xd63a('0x5e')});}})['then'](handleEntityNotFound(_0x4368e8,null))[_0xd63a('0x1d')](function(_0x550998){if(_0x550998){_0x181a1c=_0x550998;var _0x2ecf40={};for(var _0x3da1dc=0x0,_0x427dfb=_0x181a1c[_0xd63a('0x2b')];_0x3da1dc<_0x427dfb;_0x3da1dc++){if(!_0x2ecf40[_0xd63a('0x2c')](_0x181a1c[_0x3da1dc][_0xd63a('0x5f')])){_0x2ecf40[_0x181a1c[_0x3da1dc][_0xd63a('0x5f')]]=needsEncapsulation(_0x181a1c[_0x3da1dc][_0xd63a('0x60')])?encapsulate(_0x181a1c[_0x3da1dc][_0xd63a('0x60')]):_0x181a1c[_0x3da1dc]['question'];}}var _0x4ba6a0=[],_0xf5a513={};for(var _0x1fcf78=0x0,_0x57dcfe=_0x196802[_0xd63a('0x2b')];_0x1fcf78<_0x57dcfe;_0x1fcf78++){_0xf5a513={'ProjectId':_0x3b24d5[_0xd63a('0x47')]['id'],'SessionId':_0x196802[_0x1fcf78]['id'],'StartTime':moment(_0x196802[_0x1fcf78][_0xd63a('0x5c')])[_0xd63a('0x61')](_0xd63a('0x62'))};for(var _0x13c218=0x0,_0x46351d=_0x181a1c['length'];_0x13c218<_0x46351d;_0x13c218++){if(_0x181a1c[_0x13c218][_0xd63a('0x63')]==_0x196802[_0x1fcf78]['id']&&_0x2ecf40[_0xd63a('0x2c')](_0x181a1c[_0x13c218]['questionId'])){_0xf5a513[_0x2ecf40[_0x181a1c[_0x13c218][_0xd63a('0x5f')]]]=_0x181a1c[_0x13c218][_0xd63a('0x64')];}}for(var _0x2ccf3a in _0x2ecf40){if(!_0xf5a513[_0xd63a('0x2c')](_0x2ecf40[_0x2ccf3a])){_0xf5a513[_0x2ecf40[_0x2ccf3a]]=null;}}_0x4ba6a0[_0xd63a('0x65')](_0xf5a513);}return _0x4ba6a0;}})[_0xd63a('0x1d')](function(_0xe0e688){if(!_[_0xd63a('0x66')](_0xe0e688)){var _0x1ab657=toCsv(_0xe0e688);var _0x1b4ad7=Date[_0xd63a('0x67')]();fs[_0xd63a('0x68')](util['format'](_0xd63a('0x69'),_0x3b24d5[_0xd63a('0x47')]['id'],_0x1b4ad7),_0x1ab657);_0x4368e8[_0xd63a('0x6a')]('Content-disposition',_0xd63a('0x6b')+util[_0xd63a('0x61')]('Jscripty_Project_%d_Summary_%s.csv',_0x3b24d5[_0xd63a('0x47')]['id'],_0x1b4ad7));_0x4368e8[_0xd63a('0x6a')](_0xd63a('0x6c'),_0xd63a('0x6d'));return _0x4368e8['download'](util['format'](_0xd63a('0x69'),_0x3b24d5[_0xd63a('0x47')]['id'],_0x1b4ad7));}else{return _0x4368e8[_0xd63a('0x12')](0xcc);}})['catch'](handleError(_0x4368e8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3863a76..0eedf82 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 _0x0d6a=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x253b8e,_0x4b0902){var _0x48d347=function(_0xf20081){while(--_0xf20081){_0x253b8e['push'](_0x253b8e['shift']());}};_0x48d347(++_0x4b0902);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0d6a[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var logger=require('../../config/logger')(_0xa0d6('0x2'));var moment=require(_0xa0d6('0x3'));var BPromise=require(_0xa0d6('0x4'));var rp=require(_0xa0d6('0x5'));var fs=require('fs');var path=require(_0xa0d6('0x6'));var rimraf=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var attributes=require(_0xa0d6('0x9'));module[_0xa0d6('0xa')]=function(_0x179a70,_0x4857ce){return _0x179a70[_0xa0d6('0xb')](_0xa0d6('0xc'),attributes,{'tableName':_0xa0d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f7a=['bluebird','../../config/environment','./jscriptyProject.attributes','lodash','util','../../config/logger','api'];(function(_0x4d5c36,_0x2250da){var _0x5e74bd=function(_0x276403){while(--_0x276403){_0x4d5c36['push'](_0x4d5c36['shift']());}};_0x5e74bd(++_0x2250da);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9f7a[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var logger=require(_0xa9f7('0x2'))(_0xa9f7('0x3'));var moment=require('moment');var BPromise=require(_0xa9f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9f7('0x5'));var attributes=require(_0xa9f7('0x6'));module['exports']=function(_0x499ff6,_0xc1334d){return _0x499ff6['define']('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 91d553c..ec225ee 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f0212,_0x202553){var _0xde7d4c=function(_0x444e3f){while(--_0x444e3f){_0x3f0212['push'](_0x3f0212['shift']());}};_0xde7d4c(++_0x202553);}(_0xe706,0xa3));var _0x6e70=function(_0x22c393,_0x1f2389){_0x22c393=_0x22c393-0x0;var _0x161580=_0xe706[_0x22c393];return _0x161580;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xa7cf9f,_0x2a2016){var _0x11e3fe=function(_0x950fd8){while(--_0x950fd8){_0xa7cf9f['push'](_0xa7cf9f['shift']());}};_0x11e3fe(++_0x2a2016);}(_0x9bde,0xe1));var _0xe9bd=function(_0x505c32,_0x47321d){_0x505c32=_0x505c32-0x0;var _0x5565a9=_0x9bde[_0x505c32];return _0x5565a9;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2a9b50d..6afaabd 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 _0x0fa8=['/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x242859,_0x3c518e){var _0x277455=function(_0x130a5f){while(--_0x130a5f){_0x242859['push'](_0x242859['shift']());}};_0x277455(++_0x3c518e);}(_0x0fa8,0xf2));var _0x80fa=function(_0xef8e69,_0xbc78ff){_0xef8e69=_0xef8e69-0x0;var _0x463ee6=_0x0fa8[_0xef8e69];return _0x463ee6;};'use strict';var multer=require(_0x80fa('0x0'));var util=require(_0x80fa('0x1'));var path=require('path');var timeout=require(_0x80fa('0x2'));var express=require(_0x80fa('0x3'));var router=express[_0x80fa('0x4')]();var fs_extra=require(_0x80fa('0x5'));var auth=require(_0x80fa('0x6'));var interaction=require(_0x80fa('0x7'));var config=require(_0x80fa('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x80fa('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x80fa('0x9')](_0x80fa('0xa'),auth[_0x80fa('0xb')](),controller[_0x80fa('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x80fa('0xd')]);router[_0x80fa('0xe')]('/',auth['isAuthenticated'](),controller[_0x80fa('0xf')]);router[_0x80fa('0x10')](_0x80fa('0x11'),auth[_0x80fa('0xb')](),controller[_0x80fa('0x12')]);router[_0x80fa('0x13')](_0x80fa('0x11'),auth[_0x80fa('0xb')](),controller[_0x80fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1b4c=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','get','/:id','show','create','put','delete','exports'];(function(_0x169318,_0x3b4dfa){var _0x5d07b6=function(_0x1376a8){while(--_0x1376a8){_0x169318['push'](_0x169318['shift']());}};_0x5d07b6(++_0x3b4dfa);}(_0x1b4c,0x98));var _0xc1b4=function(_0x33d4dd,_0xab8529){_0x33d4dd=_0x33d4dd-0x0;var _0x44d328=_0x1b4c[_0x33d4dd];return _0x44d328;};'use strict';var multer=require(_0xc1b4('0x0'));var util=require(_0xc1b4('0x1'));var path=require(_0xc1b4('0x2'));var timeout=require(_0xc1b4('0x3'));var express=require(_0xc1b4('0x4'));var router=express[_0xc1b4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc1b4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc1b4('0x7'));var controller=require(_0xc1b4('0x8'));router['get']('/',auth[_0xc1b4('0x9')](),controller[_0xc1b4('0xa')]);router['get'](_0xc1b4('0xb'),auth[_0xc1b4('0x9')](),controller['describe']);router[_0xc1b4('0xc')](_0xc1b4('0xd'),auth[_0xc1b4('0x9')](),controller[_0xc1b4('0xe')]);router['post']('/',auth[_0xc1b4('0x9')](),controller[_0xc1b4('0xf')]);router[_0xc1b4('0x10')](_0xc1b4('0xd'),auth[_0xc1b4('0x9')](),controller['update']);router[_0xc1b4('0x11')]('/:id',auth[_0xc1b4('0x9')](),controller['destroy']);module[_0xc1b4('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 88976a0..fd59d5f 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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x237652,_0x2b6fdc){_0x237652=_0x237652-0x0;var _0x5bd062=_0x7a54[_0x237652];return _0x5bd062;};'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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x39e997,_0x909fdc){_0x39e997=_0x39e997-0x0;var _0x3dd92c=_0x7a54[_0x39e997];return _0x3dd92c;};'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 5abdf3b..62201c5 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 _0x5868=['sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','map','VIRTUAL','where','JscriptyQuestionReport','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x208f9d,_0x3c5881){var _0x200fb3=function(_0x4ae500){while(--_0x4ae500){_0x208f9d['push'](_0x208f9d['shift']());}};_0x200fb3(++_0x3c5881);}(_0x5868,0x1bc));var _0x8586=function(_0x1ed010,_0x734e0b){_0x1ed010=_0x1ed010-0x0;var _0x6e22bf=_0x5868[_0x1ed010];return _0x6e22bf;};'use strict';var emlformat=require(_0x8586('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8586('0x1'));var jsonpatch=require(_0x8586('0x2'));var rp=require(_0x8586('0x3'));var moment=require(_0x8586('0x4'));var BPromise=require(_0x8586('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8586('0x6'));var csv=require(_0x8586('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8586('0x8'));var _=require('lodash');var squel=require(_0x8586('0x9'));var crypto=require('crypto');var jsforce=require(_0x8586('0xa'));var deskjs=require(_0x8586('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8586('0xc'));var Papa=require(_0x8586('0xd'));var Redis=require(_0x8586('0xe'));var authService=require(_0x8586('0xf'));var qs=require(_0x8586('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8586('0x11'));var logger=require(_0x8586('0x12'))(_0x8586('0x13'));var utils=require(_0x8586('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41da88,_0x1da958){_0x1da958=_0x1da958||0xcc;return function(_0x4fad7b){if(_0x4fad7b){return _0x41da88[_0x8586('0x15')](_0x1da958);}return _0x41da88[_0x8586('0x16')](_0x1da958)[_0x8586('0x17')]();};}function respondWithResult(_0xb3d34b,_0x7a97f6){_0x7a97f6=_0x7a97f6||0xc8;return function(_0x309bc8){if(_0x309bc8){return _0xb3d34b[_0x8586('0x16')](_0x7a97f6)[_0x8586('0x18')](_0x309bc8);}};}function respondWithFilteredResult(_0x91dcb7,_0x760493){return function(_0x28b5bb){if(_0x28b5bb){var _0x7091ee=typeof _0x760493[_0x8586('0x19')]===_0x8586('0x1a')&&typeof _0x760493[_0x8586('0x1b')]===_0x8586('0x1a');var _0x161cee=_0x28b5bb[_0x8586('0x1c')];var _0xf4444a=_0x7091ee?0x0:_0x760493[_0x8586('0x19')];var _0x56a74c=_0x7091ee?_0x28b5bb[_0x8586('0x1c')]:_0x760493[_0x8586('0x19')]+_0x760493[_0x8586('0x1b')];var _0x1b2520;if(_0x56a74c>=_0x161cee){_0x56a74c=_0x161cee;_0x1b2520=0xc8;}else{_0x1b2520=0xce;}_0x91dcb7['status'](_0x1b2520);return _0x91dcb7[_0x8586('0x1d')](_0x8586('0x1e'),_0xf4444a+'-'+_0x56a74c+'/'+_0x161cee)[_0x8586('0x18')](_0x28b5bb);}return null;};}function patchUpdates(_0x1d293d){return function(_0x2ef612){try{jsonpatch[_0x8586('0x1f')](_0x2ef612,_0x1d293d,!![]);}catch(_0x341607){return BPromise[_0x8586('0x20')](_0x341607);}return _0x2ef612[_0x8586('0x21')]();};}function saveUpdates(_0x58eb27,_0x35d3f6){return function(_0x498a04){if(_0x498a04){return _0x498a04['update'](_0x58eb27)[_0x8586('0x22')](function(_0x35f57c){return _0x35f57c;});}return null;};}function removeEntity(_0x541cfc,_0x1dea19){return function(_0x17de0e){if(_0x17de0e){return _0x17de0e[_0x8586('0x23')]()[_0x8586('0x22')](function(){_0x541cfc[_0x8586('0x16')](0xcc)[_0x8586('0x17')]();});}};}function handleEntityNotFound(_0x30ca17,_0x36cefe){return function(_0x7228fc){if(!_0x7228fc){_0x30ca17[_0x8586('0x15')](0x194);}return _0x7228fc;};}function handleError(_0x41ee35,_0x49e397){_0x49e397=_0x49e397||0x1f4;return function(_0x3a8ab7){logger[_0x8586('0x24')](_0x3a8ab7[_0x8586('0x25')]);if(_0x3a8ab7['name']){delete _0x3a8ab7['name'];}_0x41ee35['status'](_0x49e397)[_0x8586('0x26')](_0x3a8ab7);};}exports[_0x8586('0x27')]=function(_0x14a0d3,_0x56de80){var _0x4ee12c={},_0x34992d={},_0x3aa17c={'count':0x0,'rows':[]};var _0x382633=_['map'](db['JscriptyQuestionReport'][_0x8586('0x28')],function(_0x136606){return{'name':_0x136606[_0x8586('0x29')],'type':_0x136606[_0x8586('0x2a')]['key']};});_0x34992d[_0x8586('0x2b')]=_['map'](_0x382633,_0x8586('0x2c'));_0x34992d[_0x8586('0x2d')]=_[_0x8586('0x2e')](_0x14a0d3[_0x8586('0x2d')]);_0x34992d[_0x8586('0x2f')]=_[_0x8586('0x30')](_0x34992d[_0x8586('0x2b')],_0x34992d['query']);_0x4ee12c['attributes']=_[_0x8586('0x30')](_0x34992d['model'],qs[_0x8586('0x31')](_0x14a0d3[_0x8586('0x2d')][_0x8586('0x31')]));_0x4ee12c[_0x8586('0x32')]=_0x4ee12c[_0x8586('0x32')][_0x8586('0x33')]?_0x4ee12c[_0x8586('0x32')]:_0x34992d['model'];if(!_0x14a0d3[_0x8586('0x2d')]['hasOwnProperty'](_0x8586('0x34'))){_0x4ee12c[_0x8586('0x1b')]=qs[_0x8586('0x1b')](_0x14a0d3[_0x8586('0x2d')][_0x8586('0x1b')]);_0x4ee12c['offset']=qs[_0x8586('0x19')](_0x14a0d3[_0x8586('0x2d')]['offset']);}_0x4ee12c[_0x8586('0x35')]=qs[_0x8586('0x36')](_0x14a0d3[_0x8586('0x2d')][_0x8586('0x36')]);_0x4ee12c['where']=qs[_0x8586('0x2f')](_[_0x8586('0x37')](_0x14a0d3[_0x8586('0x2d')],_0x34992d[_0x8586('0x2f')]),_0x382633);if(_0x14a0d3[_0x8586('0x2d')][_0x8586('0x38')]){_0x4ee12c['where']=_[_0x8586('0x39')](_0x4ee12c['where'],{'$or':_[_0x8586('0x3a')](_0x382633,function(_0x26f0b1){if(_0x26f0b1[_0x8586('0x2a')]!==_0x8586('0x3b')){var _0x253fd0={};_0x253fd0[_0x26f0b1['name']]={'$like':'%'+_0x14a0d3[_0x8586('0x2d')][_0x8586('0x38')]+'%'};return _0x253fd0;}})});}_0x4ee12c=_[_0x8586('0x39')]({},_0x4ee12c,_0x14a0d3['options']);var _0x3f852d={'where':_0x4ee12c[_0x8586('0x3c')]};return db[_0x8586('0x3d')][_0x8586('0x1c')](_0x3f852d)[_0x8586('0x22')](function(_0x225f1f){_0x3aa17c['count']=_0x225f1f;if(_0x14a0d3['query']['includeAll']){_0x4ee12c[_0x8586('0x3e')]=[{'all':!![]}];}return db[_0x8586('0x3d')][_0x8586('0x3f')](_0x4ee12c);})[_0x8586('0x22')](function(_0x3b32da){_0x3aa17c[_0x8586('0x40')]=_0x3b32da;return _0x3aa17c;})[_0x8586('0x22')](respondWithFilteredResult(_0x56de80,_0x4ee12c))[_0x8586('0x41')](handleError(_0x56de80,null));};exports[_0x8586('0x42')]=function(_0x243c22,_0x5882c7){var _0x2ab052={'raw':!![],'where':{'id':_0x243c22[_0x8586('0x43')]['id']}},_0x42d73e={};_0x42d73e['model']=_[_0x8586('0x2e')](db['JscriptyQuestionReport'][_0x8586('0x28')]);_0x42d73e[_0x8586('0x2d')]=_[_0x8586('0x2e')](_0x243c22[_0x8586('0x2d')]);_0x42d73e[_0x8586('0x2f')]=_['intersection'](_0x42d73e[_0x8586('0x2b')],_0x42d73e['query']);_0x2ab052['attributes']=_[_0x8586('0x30')](_0x42d73e['model'],qs[_0x8586('0x31')](_0x243c22[_0x8586('0x2d')]['fields']));_0x2ab052['attributes']=_0x2ab052[_0x8586('0x32')][_0x8586('0x33')]?_0x2ab052[_0x8586('0x32')]:_0x42d73e[_0x8586('0x2b')];if(_0x243c22[_0x8586('0x2d')][_0x8586('0x44')]){_0x2ab052[_0x8586('0x3e')]=[{'all':!![]}];}_0x2ab052=_[_0x8586('0x39')]({},_0x2ab052,_0x243c22[_0x8586('0x45')]);return db[_0x8586('0x3d')][_0x8586('0x46')](_0x2ab052)[_0x8586('0x22')](handleEntityNotFound(_0x5882c7,null))[_0x8586('0x22')](respondWithResult(_0x5882c7,null))[_0x8586('0x41')](handleError(_0x5882c7,null));};exports[_0x8586('0x47')]=function(_0x1976f1,_0x3c3d0f){return db[_0x8586('0x3d')][_0x8586('0x47')](_0x1976f1[_0x8586('0x48')],{})[_0x8586('0x22')](respondWithResult(_0x3c3d0f,0xc9))[_0x8586('0x41')](handleError(_0x3c3d0f,null));};exports[_0x8586('0x49')]=function(_0x4a8b32,_0x1cd0d3){if(_0x4a8b32[_0x8586('0x48')]['id']){delete _0x4a8b32[_0x8586('0x48')]['id'];}return db[_0x8586('0x3d')]['find']({'where':{'id':_0x4a8b32['params']['id']}})[_0x8586('0x22')](handleEntityNotFound(_0x1cd0d3,null))['then'](saveUpdates(_0x4a8b32[_0x8586('0x48')],null))['then'](respondWithResult(_0x1cd0d3,null))[_0x8586('0x41')](handleError(_0x1cd0d3,null));};exports[_0x8586('0x23')]=function(_0x1c7560,_0x4a8c57){return db[_0x8586('0x3d')][_0x8586('0x46')]({'where':{'id':_0x1c7560[_0x8586('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a8c57,null))[_0x8586('0x22')](removeEntity(_0x4a8c57,null))[_0x8586('0x41')](handleError(_0x4a8c57,null));};exports[_0x8586('0x4a')]=function(_0x3c1605,_0x5f5932){return db['JscriptyQuestionReport'][_0x8586('0x4a')]()['then'](respondWithResult(_0x5f5932,null))[_0x8586('0x41')](handleError(_0x5f5932,null));}; \ No newline at end of file +var _0x7c52=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x55417f,_0x4a4216){var _0x394f37=function(_0x2f2d11){while(--_0x2f2d11){_0x55417f['push'](_0x55417f['shift']());}};_0x394f37(++_0x4a4216);}(_0x7c52,0x128));var _0x27c5=function(_0x2f0199,_0x101388){_0x2f0199=_0x2f0199-0x0;var _0x5d25b7=_0x7c52[_0x2f0199];return _0x5d25b7;};'use strict';var emlformat=require(_0x27c5('0x0'));var rimraf=require(_0x27c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27c5('0x2'));var rp=require(_0x27c5('0x3'));var moment=require(_0x27c5('0x4'));var BPromise=require(_0x27c5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x27c5('0x6'));var csv=require(_0x27c5('0x7'));var ejs=require(_0x27c5('0x8'));var fs=require('fs');var fs_extra=require(_0x27c5('0x9'));var _=require(_0x27c5('0xa'));var squel=require(_0x27c5('0xb'));var crypto=require(_0x27c5('0xc'));var jsforce=require(_0x27c5('0xd'));var deskjs=require(_0x27c5('0xe'));var toCsv=require(_0x27c5('0x7'));var querystring=require(_0x27c5('0xf'));var Papa=require(_0x27c5('0x10'));var Redis=require(_0x27c5('0x11'));var authService=require(_0x27c5('0x12'));var qs=require(_0x27c5('0x13'));var as=require(_0x27c5('0x14'));var hardwareService=require(_0x27c5('0x15'));var logger=require('../../config/logger')(_0x27c5('0x16'));var utils=require(_0x27c5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x27c5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10538c,_0x26e9e1){_0x26e9e1=_0x26e9e1||0xcc;return function(_0x9df3a5){if(_0x9df3a5){return _0x10538c[_0x27c5('0x19')](_0x26e9e1);}return _0x10538c['status'](_0x26e9e1)[_0x27c5('0x1a')]();};}function respondWithResult(_0x5c28cf,_0x41c89d){_0x41c89d=_0x41c89d||0xc8;return function(_0xe9a2b9){if(_0xe9a2b9){return _0x5c28cf[_0x27c5('0x1b')](_0x41c89d)[_0x27c5('0x1c')](_0xe9a2b9);}};}function respondWithFilteredResult(_0x1cd6b7,_0x352e8f){return function(_0x7beb26){if(_0x7beb26){var _0x169aeb=typeof _0x352e8f[_0x27c5('0x1d')]===_0x27c5('0x1e')&&typeof _0x352e8f['limit']==='undefined';var _0xc7a6cc=_0x7beb26['count'];var _0x3d6b94=_0x169aeb?0x0:_0x352e8f[_0x27c5('0x1d')];var _0x4ea7df=_0x169aeb?_0x7beb26[_0x27c5('0x1f')]:_0x352e8f['offset']+_0x352e8f['limit'];var _0xb2accd;if(_0x4ea7df>=_0xc7a6cc){_0x4ea7df=_0xc7a6cc;_0xb2accd=0xc8;}else{_0xb2accd=0xce;}_0x1cd6b7['status'](_0xb2accd);return _0x1cd6b7[_0x27c5('0x20')](_0x27c5('0x21'),_0x3d6b94+'-'+_0x4ea7df+'/'+_0xc7a6cc)[_0x27c5('0x1c')](_0x7beb26);}return null;};}function patchUpdates(_0x33f852){return function(_0x42907e){try{jsonpatch[_0x27c5('0x22')](_0x42907e,_0x33f852,!![]);}catch(_0x4a5baf){return BPromise[_0x27c5('0x23')](_0x4a5baf);}return _0x42907e[_0x27c5('0x24')]();};}function saveUpdates(_0x14aa3c,_0x2e9d5b){return function(_0x291895){if(_0x291895){return _0x291895[_0x27c5('0x25')](_0x14aa3c)[_0x27c5('0x26')](function(_0x5dfc36){return _0x5dfc36;});}return null;};}function removeEntity(_0x4682d9,_0x5af93e){return function(_0x39b120){if(_0x39b120){return _0x39b120[_0x27c5('0x27')]()[_0x27c5('0x26')](function(){_0x4682d9[_0x27c5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f854,_0x5406aa){return function(_0x3c93bf){if(!_0x3c93bf){_0x43f854[_0x27c5('0x19')](0x194);}return _0x3c93bf;};}function handleError(_0x440ef0,_0x34f9b2){_0x34f9b2=_0x34f9b2||0x1f4;return function(_0x1d070c){logger[_0x27c5('0x28')](_0x1d070c[_0x27c5('0x29')]);if(_0x1d070c[_0x27c5('0x2a')]){delete _0x1d070c['name'];}_0x440ef0['status'](_0x34f9b2)['send'](_0x1d070c);};}exports['index']=function(_0x4b5ee1,_0x2fdf47){var _0x3a151c={},_0x16a294={},_0x506028={'count':0x0,'rows':[]};var _0x10e6b5=_[_0x27c5('0x2b')](db[_0x27c5('0x2c')][_0x27c5('0x2d')],function(_0x4bd140){return{'name':_0x4bd140[_0x27c5('0x2e')],'type':_0x4bd140[_0x27c5('0x2f')][_0x27c5('0x30')]};});_0x16a294[_0x27c5('0x31')]=_[_0x27c5('0x2b')](_0x10e6b5,_0x27c5('0x2a'));_0x16a294[_0x27c5('0x32')]=_[_0x27c5('0x33')](_0x4b5ee1['query']);_0x16a294[_0x27c5('0x34')]=_[_0x27c5('0x35')](_0x16a294['model'],_0x16a294['query']);_0x3a151c[_0x27c5('0x36')]=_[_0x27c5('0x35')](_0x16a294[_0x27c5('0x31')],qs[_0x27c5('0x37')](_0x4b5ee1['query']['fields']));_0x3a151c['attributes']=_0x3a151c['attributes']['length']?_0x3a151c[_0x27c5('0x36')]:_0x16a294[_0x27c5('0x31')];if(!_0x4b5ee1['query'][_0x27c5('0x38')](_0x27c5('0x39'))){_0x3a151c[_0x27c5('0x3a')]=qs['limit'](_0x4b5ee1[_0x27c5('0x32')][_0x27c5('0x3a')]);_0x3a151c[_0x27c5('0x1d')]=qs[_0x27c5('0x1d')](_0x4b5ee1[_0x27c5('0x32')][_0x27c5('0x1d')]);}_0x3a151c['order']=qs[_0x27c5('0x3b')](_0x4b5ee1[_0x27c5('0x32')]['sort']);_0x3a151c[_0x27c5('0x3c')]=qs[_0x27c5('0x34')](_[_0x27c5('0x3d')](_0x4b5ee1['query'],_0x16a294[_0x27c5('0x34')]),_0x10e6b5);if(_0x4b5ee1[_0x27c5('0x32')][_0x27c5('0x3e')]){_0x3a151c[_0x27c5('0x3c')]=_[_0x27c5('0x3f')](_0x3a151c['where'],{'$or':_[_0x27c5('0x2b')](_0x10e6b5,function(_0x591847){if(_0x591847[_0x27c5('0x2f')]!==_0x27c5('0x40')){var _0x20242d={};_0x20242d[_0x591847['name']]={'$like':'%'+_0x4b5ee1['query'][_0x27c5('0x3e')]+'%'};return _0x20242d;}})});}_0x3a151c=_[_0x27c5('0x3f')]({},_0x3a151c,_0x4b5ee1[_0x27c5('0x41')]);var _0x4bfbaa={'where':_0x3a151c[_0x27c5('0x3c')]};return db[_0x27c5('0x2c')][_0x27c5('0x1f')](_0x4bfbaa)[_0x27c5('0x26')](function(_0x4f957b){_0x506028[_0x27c5('0x1f')]=_0x4f957b;if(_0x4b5ee1[_0x27c5('0x32')][_0x27c5('0x42')]){_0x3a151c['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x27c5('0x43')](_0x3a151c);})[_0x27c5('0x26')](function(_0x532757){_0x506028['rows']=_0x532757;return _0x506028;})[_0x27c5('0x26')](respondWithFilteredResult(_0x2fdf47,_0x3a151c))[_0x27c5('0x44')](handleError(_0x2fdf47,null));};exports[_0x27c5('0x45')]=function(_0x4455a0,_0x4171a3){var _0xa008a={'raw':!![],'where':{'id':_0x4455a0[_0x27c5('0x46')]['id']}},_0x5cd2e5={};_0x5cd2e5[_0x27c5('0x31')]=_[_0x27c5('0x33')](db['JscriptyQuestionReport'][_0x27c5('0x2d')]);_0x5cd2e5['query']=_[_0x27c5('0x33')](_0x4455a0['query']);_0x5cd2e5['filters']=_[_0x27c5('0x35')](_0x5cd2e5['model'],_0x5cd2e5[_0x27c5('0x32')]);_0xa008a[_0x27c5('0x36')]=_[_0x27c5('0x35')](_0x5cd2e5[_0x27c5('0x31')],qs[_0x27c5('0x37')](_0x4455a0[_0x27c5('0x32')][_0x27c5('0x37')]));_0xa008a[_0x27c5('0x36')]=_0xa008a['attributes'][_0x27c5('0x47')]?_0xa008a[_0x27c5('0x36')]:_0x5cd2e5[_0x27c5('0x31')];if(_0x4455a0['query'][_0x27c5('0x42')]){_0xa008a[_0x27c5('0x48')]=[{'all':!![]}];}_0xa008a=_[_0x27c5('0x3f')]({},_0xa008a,_0x4455a0['options']);return db['JscriptyQuestionReport'][_0x27c5('0x49')](_0xa008a)['then'](handleEntityNotFound(_0x4171a3,null))['then'](respondWithResult(_0x4171a3,null))['catch'](handleError(_0x4171a3,null));};exports[_0x27c5('0x4a')]=function(_0x586b19,_0x5248b4){return db[_0x27c5('0x2c')][_0x27c5('0x4a')](_0x586b19['body'],{})[_0x27c5('0x26')](respondWithResult(_0x5248b4,0xc9))[_0x27c5('0x44')](handleError(_0x5248b4,null));};exports['update']=function(_0x21b019,_0x108c68){if(_0x21b019[_0x27c5('0x4b')]['id']){delete _0x21b019[_0x27c5('0x4b')]['id'];}return db['JscriptyQuestionReport'][_0x27c5('0x49')]({'where':{'id':_0x21b019[_0x27c5('0x46')]['id']}})[_0x27c5('0x26')](handleEntityNotFound(_0x108c68,null))['then'](saveUpdates(_0x21b019[_0x27c5('0x4b')],null))['then'](respondWithResult(_0x108c68,null))[_0x27c5('0x44')](handleError(_0x108c68,null));};exports['destroy']=function(_0x1df91e,_0x5f3d66){return db['JscriptyQuestionReport'][_0x27c5('0x49')]({'where':{'id':_0x1df91e[_0x27c5('0x46')]['id']}})[_0x27c5('0x26')](handleEntityNotFound(_0x5f3d66,null))[_0x27c5('0x26')](removeEntity(_0x5f3d66,null))['catch'](handleError(_0x5f3d66,null));};exports[_0x27c5('0x4c')]=function(_0x57d685,_0x1aff36){return db['JscriptyQuestionReport'][_0x27c5('0x4c')]()['then'](respondWithResult(_0x1aff36,null))[_0x27c5('0x44')](handleError(_0x1aff36,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 46c8319..fc9f4dc 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 _0x9c8f=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x47c054,_0x267fb5){var _0x407ea7=function(_0x1a97e0){while(--_0x1a97e0){_0x47c054['push'](_0x47c054['shift']());}};_0x407ea7(++_0x267fb5);}(_0x9c8f,0x13a));var _0xf9c8=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x9c8f[_0x4164f2];return _0x2575c7;};'use strict';var _=require(_0xf9c8('0x0'));var util=require(_0xf9c8('0x1'));var logger=require('../../config/logger')(_0xf9c8('0x2'));var moment=require(_0xf9c8('0x3'));var BPromise=require(_0xf9c8('0x4'));var rp=require(_0xf9c8('0x5'));var fs=require('fs');var path=require(_0xf9c8('0x6'));var rimraf=require(_0xf9c8('0x7'));var config=require('../../config/environment');var attributes=require(_0xf9c8('0x8'));module[_0xf9c8('0x9')]=function(_0x507341,_0xfcf8af){return _0x507341[_0xf9c8('0xa')](_0xf9c8('0xb'),attributes,{'tableName':_0xf9c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d6e=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x290692,_0x225e2c){var _0x46911d=function(_0x140154){while(--_0x140154){_0x290692['push'](_0x290692['shift']());}};_0x46911d(++_0x225e2c);}(_0x4d6e,0x12e));var _0xe4d6=function(_0x6b4e41,_0x3ed208){_0x6b4e41=_0x6b4e41-0x0;var _0x346877=_0x4d6e[_0x6b4e41];return _0x346877;};'use strict';var _=require(_0xe4d6('0x0'));var util=require(_0xe4d6('0x1'));var logger=require(_0xe4d6('0x2'))('api');var moment=require(_0xe4d6('0x3'));var BPromise=require(_0xe4d6('0x4'));var rp=require(_0xe4d6('0x5'));var fs=require('fs');var path=require(_0xe4d6('0x6'));var rimraf=require(_0xe4d6('0x7'));var config=require(_0xe4d6('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xe4d6('0x9')]=function(_0x520507,_0x547e69){return _0x520507['define'](_0xe4d6('0xa'),attributes,{'tableName':_0xe4d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index a8b354c..3e1c675 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 _0xd73d=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd73d,0x1be));var _0xdd73=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0xd73d[_0x21eb3c];return _0x4bd2aa;};'use strict';var _=require(_0xdd73('0x0'));var util=require(_0xdd73('0x1'));var moment=require(_0xdd73('0x2'));var BPromise=require(_0xdd73('0x3'));var rs=require(_0xdd73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd73('0x5'))['db'];var utils=require(_0xdd73('0x6'));var logger=require(_0xdd73('0x7'))(_0xdd73('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd73('0x9'));var client=jayson[_0xdd73('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a4bd9,_0x4e4816,_0x1a4b94){return new BPromise(function(_0x42950a,_0x2d84ba){return client[_0xdd73('0xb')](_0x2a4bd9,_0x1a4b94)[_0xdd73('0xc')](function(_0x4d96e1){logger[_0xdd73('0xd')](_0xdd73('0xe'),_0x4e4816,_0xdd73('0xf'));logger['debug'](_0xdd73('0x10'),_0x4e4816,'request\x20sent',JSON[_0xdd73('0x11')](_0x4d96e1));if(_0x4d96e1[_0xdd73('0x12')]){if(_0x4d96e1[_0xdd73('0x12')][_0xdd73('0x13')]===0x1f4){logger[_0xdd73('0x12')](_0xdd73('0xe'),_0x4e4816,_0x4d96e1[_0xdd73('0x12')][_0xdd73('0x14')]);return _0x2d84ba(_0x4d96e1[_0xdd73('0x12')][_0xdd73('0x14')]);}logger[_0xdd73('0x12')](_0xdd73('0xe'),_0x4e4816,_0x4d96e1[_0xdd73('0x12')][_0xdd73('0x14')]);return _0x42950a(_0x4d96e1[_0xdd73('0x12')][_0xdd73('0x14')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4e4816,_0xdd73('0xf'));_0x42950a(_0x4d96e1[_0xdd73('0x15')]['message']);}})[_0xdd73('0x16')](function(_0x23ff6f){logger['error'](_0xdd73('0xe'),_0x4e4816,_0x23ff6f);_0x2d84ba(_0x23ff6f);});});} \ No newline at end of file +var _0x85ad=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x53276d,_0x38d5a7){var _0x5a7868=function(_0xa86ef2){while(--_0xa86ef2){_0x53276d['push'](_0x53276d['shift']());}};_0x5a7868(++_0x38d5a7);}(_0x85ad,0x6e));var _0xd85a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x85ad[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xd85a('0x0'));var moment=require(_0xd85a('0x1'));var BPromise=require('bluebird');var rs=require(_0xd85a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd85a('0x3'))['db'];var utils=require(_0xd85a('0x4'));var logger=require(_0xd85a('0x5'))(_0xd85a('0x6'));var config=require('../../config/environment');var jayson=require(_0xd85a('0x7'));var client=jayson[_0xd85a('0x8')][_0xd85a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4506b9,_0x1c9ae6,_0x50b0c4){return new BPromise(function(_0x3056b0,_0x12c7f4){return client['request'](_0x4506b9,_0x50b0c4)[_0xd85a('0xa')](function(_0x2e6ad0){logger[_0xd85a('0xb')](_0xd85a('0xc'),_0x1c9ae6,_0xd85a('0xd'));logger['debug'](_0xd85a('0xe'),_0x1c9ae6,_0xd85a('0xd'),JSON[_0xd85a('0xf')](_0x2e6ad0));if(_0x2e6ad0[_0xd85a('0x10')]){if(_0x2e6ad0[_0xd85a('0x10')][_0xd85a('0x11')]===0x1f4){logger[_0xd85a('0x10')](_0xd85a('0xc'),_0x1c9ae6,_0x2e6ad0[_0xd85a('0x10')][_0xd85a('0x12')]);return _0x12c7f4(_0x2e6ad0['error']['message']);}logger[_0xd85a('0x10')](_0xd85a('0xc'),_0x1c9ae6,_0x2e6ad0[_0xd85a('0x10')]['message']);return _0x3056b0(_0x2e6ad0[_0xd85a('0x10')]['message']);}else{logger['info'](_0xd85a('0xc'),_0x1c9ae6,_0xd85a('0xd'));_0x3056b0(_0x2e6ad0['result'][_0xd85a('0x12')]);}})[_0xd85a('0x13')](function(_0x464cbc){logger[_0xd85a('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1c9ae6,_0x464cbc);_0x12c7f4(_0x464cbc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 336f5f8..a470812 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 _0x5ea6=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','/:id','show','getQuestions','create','delete','destroy'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5ea6,0x1e1));var _0x65ea=function(_0x7074d5,_0x427953){_0x7074d5=_0x7074d5-0x0;var _0xced075=_0x5ea6[_0x7074d5];return _0xced075;};'use strict';var multer=require(_0x65ea('0x0'));var util=require(_0x65ea('0x1'));var path=require(_0x65ea('0x2'));var timeout=require(_0x65ea('0x3'));var express=require('express');var router=express[_0x65ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x65ea('0x5'));var interaction=require(_0x65ea('0x6'));var config=require(_0x65ea('0x7'));var controller=require(_0x65ea('0x8'));router[_0x65ea('0x9')]('/',auth['isAuthenticated'](),controller[_0x65ea('0xa')]);router[_0x65ea('0x9')]('/describe',auth[_0x65ea('0xb')](),controller[_0x65ea('0xc')]);router['get'](_0x65ea('0xd'),auth[_0x65ea('0xb')](),controller[_0x65ea('0xe')]);router[_0x65ea('0x9')]('/:id/questions',auth[_0x65ea('0xb')](),controller[_0x65ea('0xf')]);router['post']('/',auth[_0x65ea('0xb')](),controller[_0x65ea('0x10')]);router['put'](_0x65ea('0xd'),auth[_0x65ea('0xb')](),controller['update']);router[_0x65ea('0x11')]('/:id',auth[_0x65ea('0xb')](),controller[_0x65ea('0x12')]);module[_0x65ea('0x13')]=router; \ No newline at end of file +var _0x1aa0=['describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe'];(function(_0x2419df,_0x762da){var _0x289d46=function(_0x4123ad){while(--_0x4123ad){_0x2419df['push'](_0x2419df['shift']());}};_0x289d46(++_0x762da);}(_0x1aa0,0x1b4));var _0x01aa=function(_0x16e0f5,_0x4ec0f3){_0x16e0f5=_0x16e0f5-0x0;var _0x4839d5=_0x1aa0[_0x16e0f5];return _0x4839d5;};'use strict';var multer=require(_0x01aa('0x0'));var util=require(_0x01aa('0x1'));var path=require(_0x01aa('0x2'));var timeout=require('connect-timeout');var express=require(_0x01aa('0x3'));var router=express[_0x01aa('0x4')]();var fs_extra=require(_0x01aa('0x5'));var auth=require(_0x01aa('0x6'));var interaction=require(_0x01aa('0x7'));var config=require(_0x01aa('0x8'));var controller=require(_0x01aa('0x9'));router['get']('/',auth[_0x01aa('0xa')](),controller[_0x01aa('0xb')]);router[_0x01aa('0xc')](_0x01aa('0xd'),auth[_0x01aa('0xa')](),controller[_0x01aa('0xe')]);router['get'](_0x01aa('0xf'),auth[_0x01aa('0xa')](),controller[_0x01aa('0x10')]);router['get'](_0x01aa('0x11'),auth['isAuthenticated'](),controller[_0x01aa('0x12')]);router[_0x01aa('0x13')]('/',auth[_0x01aa('0xa')](),controller[_0x01aa('0x14')]);router[_0x01aa('0x15')](_0x01aa('0xf'),auth['isAuthenticated'](),controller[_0x01aa('0x16')]);router[_0x01aa('0x17')](_0x01aa('0xf'),auth[_0x01aa('0xa')](),controller[_0x01aa('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 113473e..225e079 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 _0x3994=['setDataValue','format','STRING','moment','sequelize','exports','DATE','starttime'];(function(_0x41aff5,_0x37d5c6){var _0x5a6f3e=function(_0x5f3cf4){while(--_0x5f3cf4){_0x41aff5['push'](_0x41aff5['shift']());}};_0x5a6f3e(++_0x37d5c6);}(_0x3994,0x123));var _0x4399=function(_0x1fdfdd,_0x18f4c4){_0x1fdfdd=_0x1fdfdd-0x0;var _0x58a037=_0x3994[_0x1fdfdd];return _0x58a037;};'use strict';var moment=require(_0x4399('0x0'));var Sequelize=require(_0x4399('0x1'));module[_0x4399('0x2')]={'starttime':{'type':Sequelize[_0x4399('0x3')],'set':function(_0x53718a){this['setDataValue'](_0x4399('0x4'),_0x53718a);this[_0x4399('0x5')]('endtime',moment()[_0x4399('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x4399('0x3')]},'membername':{'type':Sequelize[_0x4399('0x7')]},'projectname':{'type':Sequelize[_0x4399('0x7')]},'queue':{'type':Sequelize[_0x4399('0x7')]},'uniqueid':{'type':Sequelize[_0x4399('0x7')]},'calleridname':{'type':Sequelize[_0x4399('0x7')]},'calleridnum':{'type':Sequelize[_0x4399('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf952=['STRING','BOOLEAN','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf952,0x173));var _0x2f95=function(_0x39e62f,_0x482b6c){_0x39e62f=_0x39e62f-0x0;var _0x1f267d=_0xf952[_0x39e62f];return _0x1f267d;};'use strict';var moment=require('moment');var Sequelize=require(_0x2f95('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x2f95('0x1')],'set':function(_0x53793a){this[_0x2f95('0x2')](_0x2f95('0x3'),_0x53793a);this[_0x2f95('0x2')](_0x2f95('0x4'),moment()[_0x2f95('0x5')](_0x2f95('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x2f95('0x7')]},'projectname':{'type':Sequelize[_0x2f95('0x7')]},'queue':{'type':Sequelize[_0x2f95('0x7')]},'uniqueid':{'type':Sequelize[_0x2f95('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2f95('0x7')]},'completed':{'type':Sequelize[_0x2f95('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 324f928..785648a 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 _0xb079=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','JscriptySessionReport','intersection','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x155881,_0x4f09ed){var _0x4e03a3=function(_0x592051){while(--_0x592051){_0x155881['push'](_0x155881['shift']());}};_0x4e03a3(++_0x4f09ed);}(_0xb079,0x8b));var _0x9b07=function(_0x44bd79,_0xcdf2c1){_0x44bd79=_0x44bd79-0x0;var _0x398f6c=_0xb079[_0x44bd79];return _0x398f6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b07('0x1'));var rp=require(_0x9b07('0x2'));var moment=require(_0x9b07('0x3'));var BPromise=require(_0x9b07('0x4'));var Mustache=require(_0x9b07('0x5'));var util=require(_0x9b07('0x6'));var path=require(_0x9b07('0x7'));var sox=require('sox');var csv=require(_0x9b07('0x8'));var ejs=require(_0x9b07('0x9'));var fs=require('fs');var fs_extra=require(_0x9b07('0xa'));var _=require(_0x9b07('0xb'));var squel=require(_0x9b07('0xc'));var crypto=require(_0x9b07('0xd'));var jsforce=require(_0x9b07('0xe'));var deskjs=require(_0x9b07('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9b07('0x10'));var Papa=require(_0x9b07('0x11'));var Redis=require(_0x9b07('0x12'));var authService=require(_0x9b07('0x13'));var qs=require(_0x9b07('0x14'));var as=require(_0x9b07('0x15'));var hardwareService=require(_0x9b07('0x16'));var logger=require(_0x9b07('0x17'))(_0x9b07('0x18'));var utils=require(_0x9b07('0x19'));var config=require(_0x9b07('0x1a'));var licenseUtil=require(_0x9b07('0x1b'));var db=require(_0x9b07('0x1c'))['db'];function respondWithStatusCode(_0x2f7d3c,_0x298369){_0x298369=_0x298369||0xcc;return function(_0x507927){if(_0x507927){return _0x2f7d3c[_0x9b07('0x1d')](_0x298369);}return _0x2f7d3c[_0x9b07('0x1e')](_0x298369)[_0x9b07('0x1f')]();};}function respondWithResult(_0x19b13a,_0x2358eb){_0x2358eb=_0x2358eb||0xc8;return function(_0x2d6aff){if(_0x2d6aff){return _0x19b13a[_0x9b07('0x1e')](_0x2358eb)['json'](_0x2d6aff);}};}function respondWithFilteredResult(_0x1c299e,_0x47b389){return function(_0x5b3b8a){if(_0x5b3b8a){var _0x1c5f9c=typeof _0x47b389[_0x9b07('0x20')]===_0x9b07('0x21')&&typeof _0x47b389[_0x9b07('0x22')]===_0x9b07('0x21');var _0x2d698e=_0x5b3b8a[_0x9b07('0x23')];var _0x28046c=_0x1c5f9c?0x0:_0x47b389['offset'];var _0x225c39=_0x1c5f9c?_0x5b3b8a[_0x9b07('0x23')]:_0x47b389[_0x9b07('0x20')]+_0x47b389['limit'];var _0x27b2c4;if(_0x225c39>=_0x2d698e){_0x225c39=_0x2d698e;_0x27b2c4=0xc8;}else{_0x27b2c4=0xce;}_0x1c299e[_0x9b07('0x1e')](_0x27b2c4);return _0x1c299e['set'](_0x9b07('0x24'),_0x28046c+'-'+_0x225c39+'/'+_0x2d698e)['json'](_0x5b3b8a);}return null;};}function patchUpdates(_0x2c3d1c){return function(_0x4dac8c){try{jsonpatch[_0x9b07('0x25')](_0x4dac8c,_0x2c3d1c,!![]);}catch(_0x26491b){return BPromise[_0x9b07('0x26')](_0x26491b);}return _0x4dac8c[_0x9b07('0x27')]();};}function saveUpdates(_0x5308fc,_0x1b61a6){return function(_0x494b5c){if(_0x494b5c){return _0x494b5c[_0x9b07('0x28')](_0x5308fc)[_0x9b07('0x29')](function(_0x5ef664){return _0x5ef664;});}return null;};}function removeEntity(_0x44ad92,_0x4f4c95){return function(_0x724f6a){if(_0x724f6a){return _0x724f6a['destroy']()[_0x9b07('0x29')](function(){_0x44ad92[_0x9b07('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46e8e6,_0x188c0d){return function(_0x4a37fe){if(!_0x4a37fe){_0x46e8e6[_0x9b07('0x1d')](0x194);}return _0x4a37fe;};}function handleError(_0x11f134,_0x2a7e0a){_0x2a7e0a=_0x2a7e0a||0x1f4;return function(_0x3182b3){logger[_0x9b07('0x2a')](_0x3182b3[_0x9b07('0x2b')]);if(_0x3182b3['name']){delete _0x3182b3[_0x9b07('0x2c')];}_0x11f134[_0x9b07('0x1e')](_0x2a7e0a)[_0x9b07('0x2d')](_0x3182b3);};}exports[_0x9b07('0x2e')]=function(_0x55d1c0,_0x3bef02){var _0x183262={},_0xea187={},_0x3bf885={'count':0x0,'rows':[]};var _0x1129c5=_[_0x9b07('0x2f')](db['JscriptySessionReport']['rawAttributes'],function(_0x259f3f){return{'name':_0x259f3f[_0x9b07('0x30')],'type':_0x259f3f[_0x9b07('0x31')][_0x9b07('0x32')]};});_0xea187['model']=_[_0x9b07('0x2f')](_0x1129c5,_0x9b07('0x2c'));_0xea187['query']=_[_0x9b07('0x33')](_0x55d1c0[_0x9b07('0x34')]);_0xea187[_0x9b07('0x35')]=_['intersection'](_0xea187[_0x9b07('0x36')],_0xea187[_0x9b07('0x34')]);_0x183262[_0x9b07('0x37')]=_['intersection'](_0xea187[_0x9b07('0x36')],qs[_0x9b07('0x38')](_0x55d1c0[_0x9b07('0x34')][_0x9b07('0x38')]));_0x183262[_0x9b07('0x37')]=_0x183262['attributes'][_0x9b07('0x39')]?_0x183262[_0x9b07('0x37')]:_0xea187[_0x9b07('0x36')];if(!_0x55d1c0['query'][_0x9b07('0x3a')](_0x9b07('0x3b'))){_0x183262[_0x9b07('0x22')]=qs[_0x9b07('0x22')](_0x55d1c0[_0x9b07('0x34')][_0x9b07('0x22')]);_0x183262[_0x9b07('0x20')]=qs[_0x9b07('0x20')](_0x55d1c0[_0x9b07('0x34')][_0x9b07('0x20')]);}_0x183262[_0x9b07('0x3c')]=qs[_0x9b07('0x3d')](_0x55d1c0[_0x9b07('0x34')][_0x9b07('0x3d')]);_0x183262[_0x9b07('0x3e')]=qs[_0x9b07('0x35')](_['pick'](_0x55d1c0[_0x9b07('0x34')],_0xea187[_0x9b07('0x35')]),_0x1129c5);if(_0x55d1c0['query'][_0x9b07('0x3f')]){_0x183262[_0x9b07('0x3e')]=_[_0x9b07('0x40')](_0x183262['where'],{'$or':_[_0x9b07('0x2f')](_0x1129c5,function(_0x33fe31){if(_0x33fe31[_0x9b07('0x31')]!==_0x9b07('0x41')){var _0x41cb8b={};_0x41cb8b[_0x33fe31[_0x9b07('0x2c')]]={'$like':'%'+_0x55d1c0['query']['filter']+'%'};return _0x41cb8b;}})});}_0x183262=_['merge']({},_0x183262,_0x55d1c0[_0x9b07('0x42')]);var _0x334af8={'where':_0x183262[_0x9b07('0x3e')]};return db['JscriptySessionReport']['count'](_0x334af8)[_0x9b07('0x29')](function(_0x2bbf7a){_0x3bf885[_0x9b07('0x23')]=_0x2bbf7a;if(_0x55d1c0[_0x9b07('0x34')][_0x9b07('0x43')]){_0x183262[_0x9b07('0x44')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9b07('0x45')](_0x183262);})['then'](function(_0x55ce87){_0x3bf885[_0x9b07('0x46')]=_0x55ce87;return _0x3bf885;})[_0x9b07('0x29')](respondWithFilteredResult(_0x3bef02,_0x183262))[_0x9b07('0x47')](handleError(_0x3bef02,null));};exports['show']=function(_0x415cbc,_0x346be2){var _0xac2b3e={'raw':!![],'where':{'id':_0x415cbc[_0x9b07('0x48')]['id']}},_0x16a909={};_0x16a909['model']=_[_0x9b07('0x33')](db[_0x9b07('0x49')]['rawAttributes']);_0x16a909[_0x9b07('0x34')]=_[_0x9b07('0x33')](_0x415cbc[_0x9b07('0x34')]);_0x16a909[_0x9b07('0x35')]=_[_0x9b07('0x4a')](_0x16a909['model'],_0x16a909[_0x9b07('0x34')]);_0xac2b3e[_0x9b07('0x37')]=_[_0x9b07('0x4a')](_0x16a909[_0x9b07('0x36')],qs['fields'](_0x415cbc[_0x9b07('0x34')][_0x9b07('0x38')]));_0xac2b3e[_0x9b07('0x37')]=_0xac2b3e[_0x9b07('0x37')][_0x9b07('0x39')]?_0xac2b3e['attributes']:_0x16a909['model'];if(_0x415cbc['query'][_0x9b07('0x43')]){_0xac2b3e[_0x9b07('0x44')]=[{'all':!![]}];}_0xac2b3e=_[_0x9b07('0x40')]({},_0xac2b3e,_0x415cbc[_0x9b07('0x42')]);return db[_0x9b07('0x49')][_0x9b07('0x4b')](_0xac2b3e)[_0x9b07('0x29')](handleEntityNotFound(_0x346be2,null))[_0x9b07('0x29')](respondWithResult(_0x346be2,null))[_0x9b07('0x47')](handleError(_0x346be2,null));};exports[_0x9b07('0x4c')]=function(_0x5a2af9,_0x14d18b){return db[_0x9b07('0x49')][_0x9b07('0x4c')](_0x5a2af9[_0x9b07('0x4d')],{})[_0x9b07('0x29')](respondWithResult(_0x14d18b,0xc9))[_0x9b07('0x47')](handleError(_0x14d18b,null));};exports[_0x9b07('0x28')]=function(_0x6866ce,_0x20e6f7){if(_0x6866ce[_0x9b07('0x4d')]['id']){delete _0x6866ce['body']['id'];}return db['JscriptySessionReport'][_0x9b07('0x4b')]({'where':{'id':_0x6866ce[_0x9b07('0x48')]['id']}})['then'](handleEntityNotFound(_0x20e6f7,null))['then'](saveUpdates(_0x6866ce[_0x9b07('0x4d')],null))[_0x9b07('0x29')](respondWithResult(_0x20e6f7,null))['catch'](handleError(_0x20e6f7,null));};exports['destroy']=function(_0x301db3,_0x1253fa){return db[_0x9b07('0x49')][_0x9b07('0x4b')]({'where':{'id':_0x301db3['params']['id']}})[_0x9b07('0x29')](handleEntityNotFound(_0x1253fa,null))['then'](removeEntity(_0x1253fa,null))['catch'](handleError(_0x1253fa,null));};exports[_0x9b07('0x4e')]=function(_0x3299e2,_0x15788c){return db['JscriptySessionReport']['describe']()[_0x9b07('0x29')](respondWithResult(_0x15788c,null))[_0x9b07('0x47')](handleError(_0x15788c,null));};exports[_0x9b07('0x4f')]=function(_0x6df0c2,_0x25e522,_0xd383d1){var _0x4ddeb0={'raw':!![],'where':{}};var _0x2f9585={};var _0x350c5f={'count':0x0,'rows':[]};return db[_0x9b07('0x49')][_0x9b07('0x50')]({'where':{'id':_0x6df0c2[_0x9b07('0x48')]['id']}})['then'](handleEntityNotFound(_0x25e522,null))['then'](function(_0x24397){if(_0x24397){_0x2f9585['model']=_[_0x9b07('0x33')](db[_0x9b07('0x51')][_0x9b07('0x52')]);_0x2f9585['query']=_[_0x9b07('0x33')](_0x6df0c2[_0x9b07('0x34')]);_0x2f9585[_0x9b07('0x35')]=_[_0x9b07('0x4a')](_0x2f9585['model'],_0x2f9585[_0x9b07('0x34')]);_0x4ddeb0['attributes']=_[_0x9b07('0x4a')](_0x2f9585[_0x9b07('0x36')],qs[_0x9b07('0x38')](_0x6df0c2[_0x9b07('0x34')]['fields']));_0x4ddeb0[_0x9b07('0x37')]=_0x4ddeb0[_0x9b07('0x37')]['length']?_0x4ddeb0[_0x9b07('0x37')]:_0x2f9585[_0x9b07('0x36')];if(!_0x6df0c2[_0x9b07('0x34')][_0x9b07('0x3a')](_0x9b07('0x3b'))){_0x4ddeb0['limit']=qs[_0x9b07('0x22')](_0x6df0c2['query'][_0x9b07('0x22')]);_0x4ddeb0[_0x9b07('0x20')]=qs[_0x9b07('0x20')](_0x6df0c2[_0x9b07('0x34')][_0x9b07('0x20')]);}_0x4ddeb0[_0x9b07('0x3c')]=qs[_0x9b07('0x3d')](_0x6df0c2[_0x9b07('0x34')][_0x9b07('0x3d')]);_0x4ddeb0[_0x9b07('0x3e')]=qs[_0x9b07('0x35')](_['pick'](_0x6df0c2['query'],_0x2f9585[_0x9b07('0x35')]));_0x4ddeb0[_0x9b07('0x3e')]['SessionId']=_0x24397['id'];if(_0x6df0c2[_0x9b07('0x34')][_0x9b07('0x3f')]){_0x4ddeb0['where']=_['merge'](_0x4ddeb0[_0x9b07('0x3e')],{'$or':_[_0x9b07('0x2f')](_0x4ddeb0[_0x9b07('0x37')],function(_0x1fd692){var _0x3b070b={};_0x3b070b[_0x1fd692]={'$like':'%'+_0x6df0c2[_0x9b07('0x34')][_0x9b07('0x3f')]+'%'};return _0x3b070b;})});}_0x4ddeb0=_[_0x9b07('0x40')]({},_0x4ddeb0,_0x6df0c2[_0x9b07('0x42')]);return db[_0x9b07('0x51')][_0x9b07('0x23')]({'where':_0x4ddeb0[_0x9b07('0x3e')]})[_0x9b07('0x29')](function(_0x5f19ea){_0x350c5f[_0x9b07('0x23')]=_0x5f19ea;if(_0x6df0c2[_0x9b07('0x34')][_0x9b07('0x43')]){_0x4ddeb0[_0x9b07('0x44')]=[{'all':!![]}];}return db[_0x9b07('0x51')]['findAll'](_0x4ddeb0);})[_0x9b07('0x29')](function(_0x47ad25){_0x350c5f[_0x9b07('0x46')]=_0x47ad25;return _0x350c5f;});}})[_0x9b07('0x29')](respondWithFilteredResult(_0x25e522,_0x4ddeb0))[_0x9b07('0x47')](handleError(_0x25e522,null));}; \ No newline at end of file +var _0xe575=['show','params','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','pick','findAll','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','sendStatus','error','name','index','map','JscriptySessionReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows'];(function(_0xaa6529,_0x52f7db){var _0x39b304=function(_0x366394){while(--_0x366394){_0xaa6529['push'](_0xaa6529['shift']());}};_0x39b304(++_0x52f7db);}(_0xe575,0x1c9));var _0x5e57=function(_0x5339d8,_0x2eca87){_0x5339d8=_0x5339d8-0x0;var _0x21d752=_0xe575[_0x5339d8];return _0x21d752;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e57('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e57('0x1'));var rp=require(_0x5e57('0x2'));var moment=require('moment');var BPromise=require(_0x5e57('0x3'));var Mustache=require(_0x5e57('0x4'));var util=require(_0x5e57('0x5'));var path=require('path');var sox=require(_0x5e57('0x6'));var csv=require(_0x5e57('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e57('0x8'));var _=require(_0x5e57('0x9'));var squel=require(_0x5e57('0xa'));var crypto=require(_0x5e57('0xb'));var jsforce=require(_0x5e57('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5e57('0x7'));var querystring=require(_0x5e57('0xd'));var Papa=require('papaparse');var Redis=require(_0x5e57('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5e57('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e57('0x10'));var utils=require(_0x5e57('0x11'));var config=require(_0x5e57('0x12'));var licenseUtil=require(_0x5e57('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b3574,_0x450eff){_0x450eff=_0x450eff||0xcc;return function(_0x2d2ca1){if(_0x2d2ca1){return _0x4b3574['sendStatus'](_0x450eff);}return _0x4b3574[_0x5e57('0x14')](_0x450eff)['end']();};}function respondWithResult(_0x157180,_0x58f013){_0x58f013=_0x58f013||0xc8;return function(_0x46a499){if(_0x46a499){return _0x157180[_0x5e57('0x14')](_0x58f013)[_0x5e57('0x15')](_0x46a499);}};}function respondWithFilteredResult(_0x3c62d4,_0x56a7bf){return function(_0x4f0592){if(_0x4f0592){var _0x20374d=typeof _0x56a7bf['offset']===_0x5e57('0x16')&&typeof _0x56a7bf[_0x5e57('0x17')]===_0x5e57('0x16');var _0x3f101f=_0x4f0592[_0x5e57('0x18')];var _0x5c4066=_0x20374d?0x0:_0x56a7bf[_0x5e57('0x19')];var _0x340dfd=_0x20374d?_0x4f0592[_0x5e57('0x18')]:_0x56a7bf[_0x5e57('0x19')]+_0x56a7bf[_0x5e57('0x17')];var _0x3c7bd0;if(_0x340dfd>=_0x3f101f){_0x340dfd=_0x3f101f;_0x3c7bd0=0xc8;}else{_0x3c7bd0=0xce;}_0x3c62d4[_0x5e57('0x14')](_0x3c7bd0);return _0x3c62d4[_0x5e57('0x1a')](_0x5e57('0x1b'),_0x5c4066+'-'+_0x340dfd+'/'+_0x3f101f)[_0x5e57('0x15')](_0x4f0592);}return null;};}function patchUpdates(_0x398a0e){return function(_0x1e47ea){try{jsonpatch[_0x5e57('0x1c')](_0x1e47ea,_0x398a0e,!![]);}catch(_0x48b39c){return BPromise['reject'](_0x48b39c);}return _0x1e47ea['save']();};}function saveUpdates(_0x4fe26c,_0x1d383e){return function(_0x347987){if(_0x347987){return _0x347987[_0x5e57('0x1d')](_0x4fe26c)[_0x5e57('0x1e')](function(_0x3474c1){return _0x3474c1;});}return null;};}function removeEntity(_0x225797,_0x463146){return function(_0x4a8142){if(_0x4a8142){return _0x4a8142[_0x5e57('0x1f')]()[_0x5e57('0x1e')](function(){_0x225797['status'](0xcc)[_0x5e57('0x20')]();});}};}function handleEntityNotFound(_0x43de0f,_0x3abb87){return function(_0x47f451){if(!_0x47f451){_0x43de0f[_0x5e57('0x21')](0x194);}return _0x47f451;};}function handleError(_0x9aa36f,_0x27b02d){_0x27b02d=_0x27b02d||0x1f4;return function(_0x1a59f0){logger[_0x5e57('0x22')](_0x1a59f0['stack']);if(_0x1a59f0[_0x5e57('0x23')]){delete _0x1a59f0[_0x5e57('0x23')];}_0x9aa36f[_0x5e57('0x14')](_0x27b02d)['send'](_0x1a59f0);};}exports[_0x5e57('0x24')]=function(_0x7d1938,_0x3cbb80){var _0x4f1617={},_0x308dd3={},_0x4a9040={'count':0x0,'rows':[]};var _0x58b959=_[_0x5e57('0x25')](db[_0x5e57('0x26')]['rawAttributes'],function(_0x1ffa88){return{'name':_0x1ffa88[_0x5e57('0x27')],'type':_0x1ffa88[_0x5e57('0x28')][_0x5e57('0x29')]};});_0x308dd3['model']=_[_0x5e57('0x25')](_0x58b959,_0x5e57('0x23'));_0x308dd3[_0x5e57('0x2a')]=_[_0x5e57('0x2b')](_0x7d1938[_0x5e57('0x2a')]);_0x308dd3[_0x5e57('0x2c')]=_[_0x5e57('0x2d')](_0x308dd3[_0x5e57('0x2e')],_0x308dd3[_0x5e57('0x2a')]);_0x4f1617['attributes']=_[_0x5e57('0x2d')](_0x308dd3[_0x5e57('0x2e')],qs[_0x5e57('0x2f')](_0x7d1938[_0x5e57('0x2a')]['fields']));_0x4f1617['attributes']=_0x4f1617[_0x5e57('0x30')][_0x5e57('0x31')]?_0x4f1617['attributes']:_0x308dd3[_0x5e57('0x2e')];if(!_0x7d1938['query'][_0x5e57('0x32')](_0x5e57('0x33'))){_0x4f1617[_0x5e57('0x17')]=qs[_0x5e57('0x17')](_0x7d1938[_0x5e57('0x2a')][_0x5e57('0x17')]);_0x4f1617['offset']=qs[_0x5e57('0x19')](_0x7d1938[_0x5e57('0x2a')][_0x5e57('0x19')]);}_0x4f1617[_0x5e57('0x34')]=qs[_0x5e57('0x35')](_0x7d1938[_0x5e57('0x2a')][_0x5e57('0x35')]);_0x4f1617[_0x5e57('0x36')]=qs['filters'](_['pick'](_0x7d1938[_0x5e57('0x2a')],_0x308dd3[_0x5e57('0x2c')]),_0x58b959);if(_0x7d1938[_0x5e57('0x2a')][_0x5e57('0x37')]){_0x4f1617[_0x5e57('0x36')]=_[_0x5e57('0x38')](_0x4f1617[_0x5e57('0x36')],{'$or':_[_0x5e57('0x25')](_0x58b959,function(_0x5690d3){if(_0x5690d3[_0x5e57('0x28')]!=='VIRTUAL'){var _0x2d7055={};_0x2d7055[_0x5690d3['name']]={'$like':'%'+_0x7d1938['query'][_0x5e57('0x37')]+'%'};return _0x2d7055;}})});}_0x4f1617=_[_0x5e57('0x38')]({},_0x4f1617,_0x7d1938[_0x5e57('0x39')]);var _0x4ffc0c={'where':_0x4f1617['where']};return db[_0x5e57('0x26')][_0x5e57('0x18')](_0x4ffc0c)[_0x5e57('0x1e')](function(_0x462bab){_0x4a9040[_0x5e57('0x18')]=_0x462bab;if(_0x7d1938['query'][_0x5e57('0x3a')]){_0x4f1617[_0x5e57('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4f1617);})[_0x5e57('0x1e')](function(_0x129cb6){_0x4a9040[_0x5e57('0x3c')]=_0x129cb6;return _0x4a9040;})[_0x5e57('0x1e')](respondWithFilteredResult(_0x3cbb80,_0x4f1617))['catch'](handleError(_0x3cbb80,null));};exports[_0x5e57('0x3d')]=function(_0x452f02,_0x1aacdb){var _0x156e30={'raw':!![],'where':{'id':_0x452f02[_0x5e57('0x3e')]['id']}},_0x2a2ac0={};_0x2a2ac0[_0x5e57('0x2e')]=_[_0x5e57('0x2b')](db[_0x5e57('0x26')]['rawAttributes']);_0x2a2ac0['query']=_[_0x5e57('0x2b')](_0x452f02[_0x5e57('0x2a')]);_0x2a2ac0['filters']=_['intersection'](_0x2a2ac0['model'],_0x2a2ac0[_0x5e57('0x2a')]);_0x156e30[_0x5e57('0x30')]=_['intersection'](_0x2a2ac0['model'],qs[_0x5e57('0x2f')](_0x452f02[_0x5e57('0x2a')]['fields']));_0x156e30['attributes']=_0x156e30[_0x5e57('0x30')][_0x5e57('0x31')]?_0x156e30[_0x5e57('0x30')]:_0x2a2ac0[_0x5e57('0x2e')];if(_0x452f02[_0x5e57('0x2a')][_0x5e57('0x3a')]){_0x156e30[_0x5e57('0x3b')]=[{'all':!![]}];}_0x156e30=_['merge']({},_0x156e30,_0x452f02[_0x5e57('0x39')]);return db[_0x5e57('0x26')][_0x5e57('0x3f')](_0x156e30)[_0x5e57('0x1e')](handleEntityNotFound(_0x1aacdb,null))['then'](respondWithResult(_0x1aacdb,null))[_0x5e57('0x40')](handleError(_0x1aacdb,null));};exports[_0x5e57('0x41')]=function(_0x214425,_0x38de22){return db[_0x5e57('0x26')][_0x5e57('0x41')](_0x214425[_0x5e57('0x42')],{})[_0x5e57('0x1e')](respondWithResult(_0x38de22,0xc9))[_0x5e57('0x40')](handleError(_0x38de22,null));};exports[_0x5e57('0x1d')]=function(_0x1e33a4,_0x252c74){if(_0x1e33a4[_0x5e57('0x42')]['id']){delete _0x1e33a4[_0x5e57('0x42')]['id'];}return db[_0x5e57('0x26')][_0x5e57('0x3f')]({'where':{'id':_0x1e33a4[_0x5e57('0x3e')]['id']}})[_0x5e57('0x1e')](handleEntityNotFound(_0x252c74,null))['then'](saveUpdates(_0x1e33a4[_0x5e57('0x42')],null))[_0x5e57('0x1e')](respondWithResult(_0x252c74,null))[_0x5e57('0x40')](handleError(_0x252c74,null));};exports['destroy']=function(_0x28f806,_0x361ee7){return db[_0x5e57('0x26')][_0x5e57('0x3f')]({'where':{'id':_0x28f806[_0x5e57('0x3e')]['id']}})[_0x5e57('0x1e')](handleEntityNotFound(_0x361ee7,null))[_0x5e57('0x1e')](removeEntity(_0x361ee7,null))[_0x5e57('0x40')](handleError(_0x361ee7,null));};exports[_0x5e57('0x43')]=function(_0x2f0c96,_0x1cd8e2){return db[_0x5e57('0x26')][_0x5e57('0x43')]()[_0x5e57('0x1e')](respondWithResult(_0x1cd8e2,null))[_0x5e57('0x40')](handleError(_0x1cd8e2,null));};exports[_0x5e57('0x44')]=function(_0x2f64bd,_0x457b9d,_0x370789){var _0x1da464={'raw':!![],'where':{}};var _0x565619={};var _0x4381c2={'count':0x0,'rows':[]};return db[_0x5e57('0x26')][_0x5e57('0x45')]({'where':{'id':_0x2f64bd[_0x5e57('0x3e')]['id']}})[_0x5e57('0x1e')](handleEntityNotFound(_0x457b9d,null))['then'](function(_0x1a4fa7){if(_0x1a4fa7){_0x565619[_0x5e57('0x2e')]=_[_0x5e57('0x2b')](db[_0x5e57('0x46')][_0x5e57('0x47')]);_0x565619[_0x5e57('0x2a')]=_['keys'](_0x2f64bd['query']);_0x565619['filters']=_[_0x5e57('0x2d')](_0x565619[_0x5e57('0x2e')],_0x565619['query']);_0x1da464[_0x5e57('0x30')]=_[_0x5e57('0x2d')](_0x565619[_0x5e57('0x2e')],qs[_0x5e57('0x2f')](_0x2f64bd[_0x5e57('0x2a')][_0x5e57('0x2f')]));_0x1da464[_0x5e57('0x30')]=_0x1da464[_0x5e57('0x30')][_0x5e57('0x31')]?_0x1da464[_0x5e57('0x30')]:_0x565619[_0x5e57('0x2e')];if(!_0x2f64bd[_0x5e57('0x2a')][_0x5e57('0x32')](_0x5e57('0x33'))){_0x1da464[_0x5e57('0x17')]=qs[_0x5e57('0x17')](_0x2f64bd[_0x5e57('0x2a')][_0x5e57('0x17')]);_0x1da464[_0x5e57('0x19')]=qs[_0x5e57('0x19')](_0x2f64bd['query'][_0x5e57('0x19')]);}_0x1da464[_0x5e57('0x34')]=qs[_0x5e57('0x35')](_0x2f64bd[_0x5e57('0x2a')][_0x5e57('0x35')]);_0x1da464[_0x5e57('0x36')]=qs[_0x5e57('0x2c')](_[_0x5e57('0x48')](_0x2f64bd['query'],_0x565619[_0x5e57('0x2c')]));_0x1da464[_0x5e57('0x36')]['SessionId']=_0x1a4fa7['id'];if(_0x2f64bd[_0x5e57('0x2a')]['filter']){_0x1da464[_0x5e57('0x36')]=_[_0x5e57('0x38')](_0x1da464[_0x5e57('0x36')],{'$or':_[_0x5e57('0x25')](_0x1da464[_0x5e57('0x30')],function(_0x44451f){var _0x244c2c={};_0x244c2c[_0x44451f]={'$like':'%'+_0x2f64bd[_0x5e57('0x2a')][_0x5e57('0x37')]+'%'};return _0x244c2c;})});}_0x1da464=_[_0x5e57('0x38')]({},_0x1da464,_0x2f64bd['options']);return db[_0x5e57('0x46')]['count']({'where':_0x1da464[_0x5e57('0x36')]})[_0x5e57('0x1e')](function(_0x163fad){_0x4381c2[_0x5e57('0x18')]=_0x163fad;if(_0x2f64bd[_0x5e57('0x2a')]['includeAll']){_0x1da464[_0x5e57('0x3b')]=[{'all':!![]}];}return db[_0x5e57('0x46')][_0x5e57('0x49')](_0x1da464);})['then'](function(_0x57c0b3){_0x4381c2[_0x5e57('0x3c')]=_0x57c0b3;return _0x4381c2;});}})[_0x5e57('0x1e')](respondWithFilteredResult(_0x457b9d,_0x1da464))[_0x5e57('0x40')](handleError(_0x457b9d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 182ba29..20aeef5 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 _0x44e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x5c6acd,_0x475638){var _0x20bb67=function(_0x409112){while(--_0x409112){_0x5c6acd['push'](_0x5c6acd['shift']());}};_0x20bb67(++_0x475638);}(_0x44e8,0xd7));var _0x844e=function(_0x4bb358,_0x39d48d){_0x4bb358=_0x4bb358-0x0;var _0xe11255=_0x44e8[_0x4bb358];return _0xe11255;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x15c1ad,_0x1d759d){var _0x1d2975=function(_0x5ecb36){while(--_0x5ecb36){_0x15c1ad['push'](_0x15c1ad['shift']());}};_0x1d2975(++_0x1d759d);}(_0x6050,0x196));var _0x0605=function(_0x12c713,_0x3b3bef){_0x12c713=_0x12c713-0x0;var _0x45576c=_0x6050[_0x12c713];return _0x45576c;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('JscriptySessionReport',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 051184d..dab5d52 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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4e6043,_0x27c023){var _0x3ab453=function(_0x5ec5b2){while(--_0x5ec5b2){_0x4e6043['push'](_0x4e6043['shift']());}};_0x3ab453(++_0x27c023);}(_0x5496,0x175));var _0x6549=function(_0x3476af,_0x56e922){_0x3476af=_0x3476af-0x0;var _0x4fc5ec=_0x5496[_0x3476af];return _0x4fc5ec;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file +var _0x77e6=['client','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xffe1ca,_0x53be38){var _0x39d595=function(_0x30df3c){while(--_0x30df3c){_0xffe1ca['push'](_0xffe1ca['shift']());}};_0x39d595(++_0x53be38);}(_0x77e6,0x1a6));var _0x677e=function(_0x1449c8,_0x4ca5a8){_0x1449c8=_0x1449c8-0x0;var _0x1fa666=_0x77e6[_0x1449c8];return _0x1fa666;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index cc7ceb1..c4893d0 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 _0xcb0e=['index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0xcb0e,0xd8));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xecb0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xecb0('0x1'));var express=require(_0xecb0('0x2'));var router=express['Router']();var fs_extra=require(_0xecb0('0x3'));var auth=require(_0xecb0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xecb0('0x5'));var controller=require(_0xecb0('0x6'));router[_0xecb0('0x7')]('/',controller[_0xecb0('0x8')]);router[_0xecb0('0x9')](_0xecb0('0xa'),auth['isAuthenticated'](),controller[_0xecb0('0xb')]);router[_0xecb0('0x7')](_0xecb0('0xc'),auth[_0xecb0('0xd')](),controller[_0xecb0('0xe')]);module[_0xecb0('0xf')]=router; \ No newline at end of file +var _0xd378=['Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','put','isAuthenticated','update','downloadLogFile','exports','path','express'];(function(_0xe37486,_0x42697c){var _0x3dd29d=function(_0x484e26){while(--_0x484e26){_0xe37486['push'](_0xe37486['shift']());}};_0x3dd29d(++_0x42697c);}(_0xd378,0x129));var _0x8d37=function(_0x2154c3,_0x573153){_0x2154c3=_0x2154c3-0x0;var _0x394f4d=_0xd378[_0x2154c3];return _0x394f4d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8d37('0x0'));var timeout=require('connect-timeout');var express=require(_0x8d37('0x1'));var router=express[_0x8d37('0x2')]();var fs_extra=require(_0x8d37('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8d37('0x4'));var config=require(_0x8d37('0x5'));var controller=require(_0x8d37('0x6'));router[_0x8d37('0x7')]('/',controller['index']);router[_0x8d37('0x8')]('/:id',auth[_0x8d37('0x9')](),controller[_0x8d37('0xa')]);router[_0x8d37('0x7')]('/download_log_file',auth['isAuthenticated'](),controller[_0x8d37('0xb')]);module[_0x8d37('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e92f310..13e6929 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 _0x3ebe=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x4e1264,_0x44f47e){var _0x10094b=function(_0x48f8a6){while(--_0x48f8a6){_0x4e1264['push'](_0x4e1264['shift']());}};_0x10094b(++_0x44f47e);}(_0x3ebe,0x1be));var _0xe3eb=function(_0x15b6e7,_0x40e4ea){_0x15b6e7=_0x15b6e7-0x0;var _0x2ec1b4=_0x3ebe[_0x15b6e7];return _0x2ec1b4;};'use strict';var Sequelize=require(_0xe3eb('0x0'));module[_0xe3eb('0x1')]={'license':{'type':Sequelize[_0xe3eb('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe3eb('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xe3eb('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0916=['INTEGER','sequelize','STRING'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x0916,0x1bd));var _0x6091=function(_0x34faa6,_0x53955b){_0x34faa6=_0x34faa6-0x0;var _0x4fcb23=_0x0916[_0x34faa6];return _0x4fcb23;};'use strict';var Sequelize=require(_0x6091('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x6091('0x1')]},'data2':{'type':Sequelize[_0x6091('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x6091('0x2')],'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 bdf3c7b..111faa1 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 _0x1125=['destroy','then','error','stack','name','send','index','model','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','checkLicense','key','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x6caddf,_0x559579){var _0x24d602=function(_0x334c25){while(--_0x334c25){_0x6caddf['push'](_0x6caddf['shift']());}};_0x24d602(++_0x559579);}(_0x1125,0x1ce));var _0x5112=function(_0x85edeb,_0x1e63cd){_0x85edeb=_0x85edeb-0x0;var _0x19973b=_0x1125[_0x85edeb];return _0x19973b;};'use strict';var emlformat=require(_0x5112('0x0'));var rimraf=require(_0x5112('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5112('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5112('0x3'));var util=require(_0x5112('0x4'));var path=require(_0x5112('0x5'));var sox=require('sox');var csv=require(_0x5112('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5112('0x7'));var _=require(_0x5112('0x8'));var squel=require('squel');var crypto=require(_0x5112('0x9'));var jsforce=require(_0x5112('0xa'));var deskjs=require(_0x5112('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5112('0xc'));var Papa=require(_0x5112('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5112('0xe'));var as=require(_0x5112('0xf'));var hardwareService=require(_0x5112('0x10'));var logger=require(_0x5112('0x11'))(_0x5112('0x12'));var utils=require(_0x5112('0x13'));var config=require(_0x5112('0x14'));var licenseUtil=require(_0x5112('0x15'));var db=require(_0x5112('0x16'))['db'];function respondWithStatusCode(_0x35bdf9,_0x2cfc3e){_0x2cfc3e=_0x2cfc3e||0xcc;return function(_0x21e2f0){if(_0x21e2f0){return _0x35bdf9[_0x5112('0x17')](_0x2cfc3e);}return _0x35bdf9['status'](_0x2cfc3e)[_0x5112('0x18')]();};}function respondWithResult(_0x3f4c82,_0x12a943){_0x12a943=_0x12a943||0xc8;return function(_0x525124){if(_0x525124){return _0x3f4c82[_0x5112('0x19')](_0x12a943)[_0x5112('0x1a')](_0x525124);}};}function respondWithFilteredResult(_0x4e0a75,_0x5d5d21){return function(_0x16c78d){if(_0x16c78d){var _0x22e0d3=typeof _0x5d5d21['offset']===_0x5112('0x1b')&&typeof _0x5d5d21[_0x5112('0x1c')]===_0x5112('0x1b');var _0x1f4e07=_0x16c78d[_0x5112('0x1d')];var _0x312071=_0x22e0d3?0x0:_0x5d5d21[_0x5112('0x1e')];var _0x475664=_0x22e0d3?_0x16c78d[_0x5112('0x1d')]:_0x5d5d21['offset']+_0x5d5d21['limit'];var _0x2383e7;if(_0x475664>=_0x1f4e07){_0x475664=_0x1f4e07;_0x2383e7=0xc8;}else{_0x2383e7=0xce;}_0x4e0a75[_0x5112('0x19')](_0x2383e7);return _0x4e0a75[_0x5112('0x1f')](_0x5112('0x20'),_0x312071+'-'+_0x475664+'/'+_0x1f4e07)[_0x5112('0x1a')](_0x16c78d);}return null;};}function patchUpdates(_0x326b71){return function(_0x41b6da){try{jsonpatch[_0x5112('0x21')](_0x41b6da,_0x326b71,!![]);}catch(_0x20db7b){return BPromise[_0x5112('0x22')](_0x20db7b);}return _0x41b6da['save']();};}function saveUpdates(_0x1fb630,_0x3a7f0b){return function(_0x24548c){if(_0x24548c){return _0x24548c['update'](_0x1fb630)['then'](function(_0x5a211d){return _0x5a211d;});}return null;};}function removeEntity(_0x3e7da7,_0x3b79c4){return function(_0x5e7c43){if(_0x5e7c43){return _0x5e7c43[_0x5112('0x23')]()[_0x5112('0x24')](function(){_0x3e7da7[_0x5112('0x19')](0xcc)[_0x5112('0x18')]();});}};}function handleEntityNotFound(_0x5a983f,_0x1dad88){return function(_0x5c0ba3){if(!_0x5c0ba3){_0x5a983f['sendStatus'](0x194);}return _0x5c0ba3;};}function handleError(_0x4db34e,_0x46a65f){_0x46a65f=_0x46a65f||0x1f4;return function(_0x564890){logger[_0x5112('0x25')](_0x564890[_0x5112('0x26')]);if(_0x564890[_0x5112('0x27')]){delete _0x564890[_0x5112('0x27')];}_0x4db34e[_0x5112('0x19')](_0x46a65f)[_0x5112('0x28')](_0x564890);};}var utilLicense=require('../../config/license/util');exports[_0x5112('0x29')]=function(_0xbf858e,_0x5dbe87){var _0x3eea10={'raw':!![],'where':{'id':0x1}},_0x41b6b5={};_0x41b6b5[_0x5112('0x2a')]=_['keys'](db[_0x5112('0x2b')][_0x5112('0x2c')]);_0x41b6b5[_0x5112('0x2d')]=_['keys'](_0xbf858e[_0x5112('0x2d')]);_0x41b6b5[_0x5112('0x2e')]=_[_0x5112('0x2f')](_0x41b6b5[_0x5112('0x2a')],_0x41b6b5[_0x5112('0x2d')]);_0x3eea10[_0x5112('0x30')]=_['intersection'](_0x41b6b5[_0x5112('0x2a')],qs[_0x5112('0x31')](_0xbf858e[_0x5112('0x2d')][_0x5112('0x31')]));_0x3eea10[_0x5112('0x30')]=_0x3eea10[_0x5112('0x30')][_0x5112('0x32')]?_0x3eea10[_0x5112('0x30')]:_0x41b6b5[_0x5112('0x2a')];_0x3eea10=_[_0x5112('0x33')]({},_0x3eea10,_0xbf858e[_0x5112('0x34')]);return utilLicense[_0x5112('0x35')](_0x3eea10)[_0x5112('0x24')](respondWithResult(_0x5dbe87,null))[_0x5112('0x36')](handleError(_0x5dbe87,null));};exports[_0x5112('0x37')]=function(_0x39ce2b,_0x1a3896){if(_0x39ce2b[_0x5112('0x38')]['id']){delete _0x39ce2b['body']['id'];}return db[_0x5112('0x2b')][_0x5112('0x39')]({'where':{'id':_0x39ce2b['params']['id']}})['then'](handleEntityNotFound(_0x1a3896,null))[_0x5112('0x24')](function(_0x257206){var _0x53a919=_0x257206['get']({'plain':!![]});return utilLicense[_0x5112('0x3a')](_0x53a919,_0x39ce2b[_0x5112('0x38')][_0x5112('0x3b')]);})[_0x5112('0x24')](function(_0x12dc2d){if(!_0x12dc2d['demo']){return saveUpdates(_0x39ce2b[_0x5112('0x38')],null);}return _0x12dc2d;})['then'](respondWithResult(_0x1a3896,null))[_0x5112('0x36')](handleError(_0x1a3896,null));};exports['downloadLogFile']=function(_0x28a0bc,_0x1ddd5a){var _0x4b16b0=_0x5112('0x3c');var _0x1299b0=path[_0x5112('0x3d')](_0x5112('0x3e'),_0x5112('0x3f'),_0x5112('0x40'),_0x4b16b0);_0x1ddd5a[_0x5112('0x41')](_0x5112('0x42'),_0x5112('0x43')+_0x4b16b0);_0x1ddd5a[_0x5112('0x1f')](_0x5112('0x44'),_0x5112('0x45'));_0x1ddd5a[_0x5112('0x46')](_0x1299b0);}; \ No newline at end of file +var _0xb400=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','model','keys','License','rawAttributes','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','get','checkLicense','key','demo','downloadLogFile','license-info.log','/var','log','xcally','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x45d088,_0x2a812e){var _0x38fef6=function(_0x2c8e7c){while(--_0x2c8e7c){_0x45d088['push'](_0x45d088['shift']());}};_0x38fef6(++_0x2a812e);}(_0xb400,0x159));var _0x0b40=function(_0x43920c,_0x5436c2){_0x43920c=_0x43920c-0x0;var _0x11307a=_0xb400[_0x43920c];return _0x11307a;};'use strict';var emlformat=require(_0x0b40('0x0'));var rimraf=require(_0x0b40('0x1'));var zipdir=require(_0x0b40('0x2'));var jsonpatch=require(_0x0b40('0x3'));var rp=require('request-promise');var moment=require(_0x0b40('0x4'));var BPromise=require(_0x0b40('0x5'));var Mustache=require(_0x0b40('0x6'));var util=require(_0x0b40('0x7'));var path=require(_0x0b40('0x8'));var sox=require(_0x0b40('0x9'));var csv=require(_0x0b40('0xa'));var ejs=require(_0x0b40('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b40('0xc'));var squel=require(_0x0b40('0xd'));var crypto=require(_0x0b40('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0b40('0xf'));var toCsv=require(_0x0b40('0xa'));var querystring=require(_0x0b40('0x10'));var Papa=require(_0x0b40('0x11'));var Redis=require(_0x0b40('0x12'));var authService=require(_0x0b40('0x13'));var qs=require(_0x0b40('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b40('0x15'));var logger=require(_0x0b40('0x16'))('api');var utils=require(_0x0b40('0x17'));var config=require(_0x0b40('0x18'));var licenseUtil=require(_0x0b40('0x19'));var db=require(_0x0b40('0x1a'))['db'];function respondWithStatusCode(_0x44547e,_0x959d2e){_0x959d2e=_0x959d2e||0xcc;return function(_0x2aed1b){if(_0x2aed1b){return _0x44547e[_0x0b40('0x1b')](_0x959d2e);}return _0x44547e['status'](_0x959d2e)[_0x0b40('0x1c')]();};}function respondWithResult(_0x273903,_0x27533e){_0x27533e=_0x27533e||0xc8;return function(_0x4a2c23){if(_0x4a2c23){return _0x273903[_0x0b40('0x1d')](_0x27533e)['json'](_0x4a2c23);}};}function respondWithFilteredResult(_0x3623b2,_0x41e90f){return function(_0x1ab73c){if(_0x1ab73c){var _0x4d98e5=typeof _0x41e90f[_0x0b40('0x1e')]===_0x0b40('0x1f')&&typeof _0x41e90f['limit']===_0x0b40('0x1f');var _0x4b710d=_0x1ab73c[_0x0b40('0x20')];var _0x2865b5=_0x4d98e5?0x0:_0x41e90f[_0x0b40('0x1e')];var _0x43e887=_0x4d98e5?_0x1ab73c['count']:_0x41e90f[_0x0b40('0x1e')]+_0x41e90f['limit'];var _0x5d6a55;if(_0x43e887>=_0x4b710d){_0x43e887=_0x4b710d;_0x5d6a55=0xc8;}else{_0x5d6a55=0xce;}_0x3623b2['status'](_0x5d6a55);return _0x3623b2['set'](_0x0b40('0x21'),_0x2865b5+'-'+_0x43e887+'/'+_0x4b710d)[_0x0b40('0x22')](_0x1ab73c);}return null;};}function patchUpdates(_0x1bb804){return function(_0x181918){try{jsonpatch[_0x0b40('0x23')](_0x181918,_0x1bb804,!![]);}catch(_0x3e19b7){return BPromise[_0x0b40('0x24')](_0x3e19b7);}return _0x181918[_0x0b40('0x25')]();};}function saveUpdates(_0x445e2f,_0x315986){return function(_0x361005){if(_0x361005){return _0x361005[_0x0b40('0x26')](_0x445e2f)['then'](function(_0xed12ee){return _0xed12ee;});}return null;};}function removeEntity(_0x125a3d,_0xbba77a){return function(_0x416a50){if(_0x416a50){return _0x416a50[_0x0b40('0x27')]()[_0x0b40('0x28')](function(){_0x125a3d[_0x0b40('0x1d')](0xcc)[_0x0b40('0x1c')]();});}};}function handleEntityNotFound(_0x2a442e,_0x5eca81){return function(_0x51eb39){if(!_0x51eb39){_0x2a442e[_0x0b40('0x1b')](0x194);}return _0x51eb39;};}function handleError(_0x2d0dd6,_0x3fb98d){_0x3fb98d=_0x3fb98d||0x1f4;return function(_0x1d201a){logger[_0x0b40('0x29')](_0x1d201a[_0x0b40('0x2a')]);if(_0x1d201a[_0x0b40('0x2b')]){delete _0x1d201a[_0x0b40('0x2b')];}_0x2d0dd6[_0x0b40('0x1d')](_0x3fb98d)[_0x0b40('0x2c')](_0x1d201a);};}var utilLicense=require(_0x0b40('0x19'));exports[_0x0b40('0x2d')]=function(_0x13d042,_0x1a4c22){var _0x703b47={'raw':!![],'where':{'id':0x1}},_0x12e59f={};_0x12e59f[_0x0b40('0x2e')]=_[_0x0b40('0x2f')](db[_0x0b40('0x30')][_0x0b40('0x31')]);_0x12e59f[_0x0b40('0x32')]=_[_0x0b40('0x2f')](_0x13d042[_0x0b40('0x32')]);_0x12e59f['filters']=_[_0x0b40('0x33')](_0x12e59f[_0x0b40('0x2e')],_0x12e59f[_0x0b40('0x32')]);_0x703b47['attributes']=_[_0x0b40('0x33')](_0x12e59f[_0x0b40('0x2e')],qs[_0x0b40('0x34')](_0x13d042[_0x0b40('0x32')][_0x0b40('0x34')]));_0x703b47[_0x0b40('0x35')]=_0x703b47[_0x0b40('0x35')]['length']?_0x703b47[_0x0b40('0x35')]:_0x12e59f[_0x0b40('0x2e')];_0x703b47=_[_0x0b40('0x36')]({},_0x703b47,_0x13d042[_0x0b40('0x37')]);return utilLicense[_0x0b40('0x38')](_0x703b47)['then'](respondWithResult(_0x1a4c22,null))[_0x0b40('0x39')](handleError(_0x1a4c22,null));};exports[_0x0b40('0x26')]=function(_0x1626be,_0x11f943){if(_0x1626be['body']['id']){delete _0x1626be[_0x0b40('0x3a')]['id'];}return db[_0x0b40('0x30')][_0x0b40('0x3b')]({'where':{'id':_0x1626be['params']['id']}})[_0x0b40('0x28')](handleEntityNotFound(_0x11f943,null))[_0x0b40('0x28')](function(_0xc2d5b5){var _0x161e6d=_0xc2d5b5[_0x0b40('0x3c')]({'plain':!![]});return utilLicense[_0x0b40('0x3d')](_0x161e6d,_0x1626be[_0x0b40('0x3a')][_0x0b40('0x3e')]);})[_0x0b40('0x28')](function(_0x5ce6e9){if(!_0x5ce6e9[_0x0b40('0x3f')]){return saveUpdates(_0x1626be[_0x0b40('0x3a')],null);}return _0x5ce6e9;})[_0x0b40('0x28')](respondWithResult(_0x11f943,null))[_0x0b40('0x39')](handleError(_0x11f943,null));};exports[_0x0b40('0x40')]=function(_0x143afb,_0x4d375e){var _0x261beb=_0x0b40('0x41');var _0xf290ed=path['join'](_0x0b40('0x42'),_0x0b40('0x43'),_0x0b40('0x44'),_0x261beb);_0x4d375e['setHeader']('Content-disposition',_0x0b40('0x45')+_0x261beb);_0x4d375e['set'](_0x0b40('0x46'),_0x0b40('0x47'));_0x4d375e['download'](_0xf290ed);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3efe68e..9319fd3 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 _0x62cf=['api','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','util','../../config/logger'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x62cf,0x11e));var _0xf62c=function(_0x244e4c,_0x1ee6a1){_0x244e4c=_0x244e4c-0x0;var _0x2335ed=_0x62cf[_0x244e4c];return _0x2335ed;};'use strict';var _=require('lodash');var util=require(_0xf62c('0x0'));var logger=require(_0xf62c('0x1'))(_0xf62c('0x2'));var moment=require('moment');var BPromise=require(_0xf62c('0x3'));var rp=require(_0xf62c('0x4'));var fs=require('fs');var path=require(_0xf62c('0x5'));var rimraf=require(_0xf62c('0x6'));var config=require(_0xf62c('0x7'));var attributes=require(_0xf62c('0x8'));module['exports']=function(_0x4c00af,_0x3f52f5){return _0x4c00af[_0xf62c('0x9')](_0xf62c('0xa'),attributes,{'tableName':_0xf62c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fe9=['moment','request-promise','path','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api'];(function(_0x14b7bf,_0xe10de8){var _0x25a3e1=function(_0x16c729){while(--_0x16c729){_0x14b7bf['push'](_0x14b7bf['shift']());}};_0x25a3e1(++_0xe10de8);}(_0x5fe9,0xe0));var _0x95fe=function(_0x3a314e,_0x4a6b8c){_0x3a314e=_0x3a314e-0x0;var _0x45799e=_0x5fe9[_0x3a314e];return _0x45799e;};'use strict';var _=require(_0x95fe('0x0'));var util=require(_0x95fe('0x1'));var logger=require(_0x95fe('0x2'))(_0x95fe('0x3'));var moment=require(_0x95fe('0x4'));var BPromise=require('bluebird');var rp=require(_0x95fe('0x5'));var fs=require('fs');var path=require(_0x95fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x95fe('0x7'));module[_0x95fe('0x8')]=function(_0x32c1aa,_0x460626){return _0x32c1aa[_0x95fe('0x9')](_0x95fe('0xa'),attributes,{'tableName':_0x95fe('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 f5fd9aa..6099556 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 _0x3ce8=['request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','License,\x20%s,\x20%s'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x3ce8,0x15c));var _0x83ce=function(_0x3cc319,_0x50be9d){_0x3cc319=_0x3cc319-0x0;var _0x230fe5=_0x3ce8[_0x3cc319];return _0x230fe5;};'use strict';var _=require(_0x83ce('0x0'));var util=require(_0x83ce('0x1'));var moment=require(_0x83ce('0x2'));var BPromise=require('bluebird');var rs=require(_0x83ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83ce('0x4'))['db'];var utils=require(_0x83ce('0x5'));var logger=require(_0x83ce('0x6'))(_0x83ce('0x7'));var config=require(_0x83ce('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x122d96,_0x102d26,_0x3f88b2){return new BPromise(function(_0x565576,_0x5d551a){return client[_0x83ce('0x9')](_0x122d96,_0x3f88b2)[_0x83ce('0xa')](function(_0x8efa48){logger['info'](_0x83ce('0xb'),_0x102d26,_0x83ce('0xc'));logger['debug'](_0x83ce('0xd'),_0x102d26,'request\x20sent',JSON[_0x83ce('0xe')](_0x8efa48));if(_0x8efa48[_0x83ce('0xf')]){if(_0x8efa48['error'][_0x83ce('0x10')]===0x1f4){logger[_0x83ce('0xf')](_0x83ce('0xb'),_0x102d26,_0x8efa48[_0x83ce('0xf')]['message']);return _0x5d551a(_0x8efa48[_0x83ce('0xf')]['message']);}logger['error'](_0x83ce('0xb'),_0x102d26,_0x8efa48[_0x83ce('0xf')]['message']);return _0x565576(_0x8efa48[_0x83ce('0xf')][_0x83ce('0x11')]);}else{logger[_0x83ce('0x12')](_0x83ce('0xb'),_0x102d26,'request\x20sent');_0x565576(_0x8efa48['result'][_0x83ce('0x11')]);}})[_0x83ce('0x13')](function(_0x55c374){logger[_0x83ce('0xf')]('License,\x20%s,\x20%s',_0x102d26,_0x55c374);_0x5d551a(_0x55c374);});});} \ No newline at end of file +var _0x446d=['License,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0x446d,0xae));var _0xd446=function(_0x336f33,_0x43cc91){_0x336f33=_0x336f33-0x0;var _0x3ea123=_0x446d[_0x336f33];return _0x3ea123;};'use strict';var _=require('lodash');var util=require(_0xd446('0x0'));var moment=require(_0xd446('0x1'));var BPromise=require(_0xd446('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd446('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd446('0x4'));var logger=require(_0xd446('0x5'))('rpc');var config=require(_0xd446('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd446('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f647b,_0x2a1b28,_0xd5663d){return new BPromise(function(_0xc193cf,_0x2e69fe){return client['request'](_0x1f647b,_0xd5663d)[_0xd446('0x8')](function(_0x1633f1){logger[_0xd446('0x9')]('License,\x20%s,\x20%s',_0x2a1b28,_0xd446('0xa'));logger[_0xd446('0xb')](_0xd446('0xc'),_0x2a1b28,_0xd446('0xa'),JSON['stringify'](_0x1633f1));if(_0x1633f1['error']){if(_0x1633f1['error'][_0xd446('0xd')]===0x1f4){logger[_0xd446('0xe')]('License,\x20%s,\x20%s',_0x2a1b28,_0x1633f1[_0xd446('0xe')][_0xd446('0xf')]);return _0x2e69fe(_0x1633f1[_0xd446('0xe')][_0xd446('0xf')]);}logger[_0xd446('0xe')](_0xd446('0x10'),_0x2a1b28,_0x1633f1[_0xd446('0xe')][_0xd446('0xf')]);return _0xc193cf(_0x1633f1[_0xd446('0xe')][_0xd446('0xf')]);}else{logger[_0xd446('0x9')](_0xd446('0x10'),_0x2a1b28,'request\x20sent');_0xc193cf(_0x1633f1[_0xd446('0x11')][_0xd446('0xf')]);}})[_0xd446('0x12')](function(_0xfb3821){logger[_0xd446('0xe')](_0xd446('0x10'),_0x2a1b28,_0xfb3821);_0x2e69fe(_0xfb3821);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 328867b..33ff029 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 _0x8113=['/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','addImap','/:id/interactions','addInteraction','addApplications','send','/:id/users','addAgents','put','update','removeDispositions','delete','removeAnswers','destroy','removeAgents','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions'];(function(_0x2c6047,_0x485481){var _0x5a9f17=function(_0x505fe8){while(--_0x505fe8){_0x2c6047['push'](_0x2c6047['shift']());}};_0x5a9f17(++_0x485481);}(_0x8113,0x117));var _0x3811=function(_0x3d84ba,_0xe85039){_0x3d84ba=_0x3d84ba-0x0;var _0x9c4e65=_0x8113[_0x3d84ba];return _0x9c4e65;};'use strict';var multer=require(_0x3811('0x0'));var util=require('util');var path=require(_0x3811('0x1'));var timeout=require(_0x3811('0x2'));var express=require('express');var router=express[_0x3811('0x3')]();var fs_extra=require(_0x3811('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3811('0x5'));var config=require('../../config/environment');var controller=require(_0x3811('0x6'));router[_0x3811('0x7')]('/',auth[_0x3811('0x8')](),controller[_0x3811('0x9')]);router[_0x3811('0x7')](_0x3811('0xa'),auth[_0x3811('0x8')](),controller[_0x3811('0xb')]);router[_0x3811('0x7')](_0x3811('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3811('0x7')](_0x3811('0xd'),auth[_0x3811('0x8')](),controller[_0x3811('0xe')]);router[_0x3811('0x7')](_0x3811('0xf'),auth[_0x3811('0x8')](),controller[_0x3811('0x10')]);router[_0x3811('0x7')](_0x3811('0x11'),auth['isAuthenticated'](),controller['getImap']);router[_0x3811('0x7')](_0x3811('0x12'),auth[_0x3811('0x8')](),controller[_0x3811('0x13')]);router['get']('/:id/interactions',auth[_0x3811('0x8')](),controller[_0x3811('0x14')]);router[_0x3811('0x7')](_0x3811('0x15'),auth['isAuthenticated'](),controller[_0x3811('0x16')]);router[_0x3811('0x7')](_0x3811('0x17'),auth[_0x3811('0x8')](),controller[_0x3811('0x18')]);router[_0x3811('0x7')]('/:id/verify',auth['isAuthenticated'](),controller[_0x3811('0x19')]);router['get']('/:id/users',auth[_0x3811('0x8')](),controller[_0x3811('0x1a')]);router[_0x3811('0x1b')](_0x3811('0xd'),auth[_0x3811('0x8')](),controller['addDisposition']);router[_0x3811('0x1b')](_0x3811('0xf'),auth[_0x3811('0x8')](),controller['addAnswer']);router[_0x3811('0x1b')]('/',auth[_0x3811('0x8')](),controller['create']);router[_0x3811('0x1b')](_0x3811('0x11'),auth[_0x3811('0x8')](),controller[_0x3811('0x1c')]);router['post']('/:id/out_servers',auth[_0x3811('0x8')](),controller['addSmtp']);router['post'](_0x3811('0x1d'),auth[_0x3811('0x8')](),controller[_0x3811('0x1e')]);router[_0x3811('0x1b')](_0x3811('0x15'),auth[_0x3811('0x8')](),controller[_0x3811('0x1f')]);router[_0x3811('0x1b')]('/:id/send',auth[_0x3811('0x8')](),controller[_0x3811('0x20')]);router['post'](_0x3811('0x21'),auth[_0x3811('0x8')](),controller[_0x3811('0x22')]);router[_0x3811('0x23')]('/:id',auth[_0x3811('0x8')](),controller[_0x3811('0x24')]);router['delete']('/:id/dispositions',auth[_0x3811('0x8')](),controller[_0x3811('0x25')]);router[_0x3811('0x26')](_0x3811('0xf'),auth['isAuthenticated'](),controller[_0x3811('0x27')]);router[_0x3811('0x26')](_0x3811('0x11'),auth[_0x3811('0x8')](),controller['removeImap']);router[_0x3811('0x26')](_0x3811('0x12'),auth[_0x3811('0x8')](),controller['removeSmtp']);router[_0x3811('0x26')]('/:id',auth[_0x3811('0x8')](),controller[_0x3811('0x28')]);router[_0x3811('0x26')](_0x3811('0x21'),auth[_0x3811('0x8')](),controller[_0x3811('0x29')]);module['exports']=router; \ No newline at end of file +var _0xa757=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','/:id/in_servers','addImap','/:id/out_servers','/:id/send','send','put','/:id','update','removeDispositions','removeAnswers','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x38d43f,_0x5270db){var _0x466a53=function(_0x1e892e){while(--_0x1e892e){_0x38d43f['push'](_0x38d43f['shift']());}};_0x466a53(++_0x5270db);}(_0xa757,0x1e4));var _0x7a75=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa757[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7a75('0x0'));var util=require(_0x7a75('0x1'));var path=require(_0x7a75('0x2'));var timeout=require(_0x7a75('0x3'));var express=require(_0x7a75('0x4'));var router=express[_0x7a75('0x5')]();var fs_extra=require(_0x7a75('0x6'));var auth=require(_0x7a75('0x7'));var interaction=require(_0x7a75('0x8'));var config=require(_0x7a75('0x9'));var controller=require(_0x7a75('0xa'));router[_0x7a75('0xb')]('/',auth[_0x7a75('0xc')](),controller[_0x7a75('0xd')]);router[_0x7a75('0xb')]('/describe',auth[_0x7a75('0xc')](),controller['describe']);router[_0x7a75('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7a75('0xe')]);router[_0x7a75('0xb')](_0x7a75('0xf'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x10')]);router[_0x7a75('0xb')](_0x7a75('0x11'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x12')]);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x7a75('0x13')]);router[_0x7a75('0xb')]('/:id/out_servers',auth[_0x7a75('0xc')](),controller[_0x7a75('0x14')]);router['get'](_0x7a75('0x15'),auth['isAuthenticated'](),controller[_0x7a75('0x16')]);router[_0x7a75('0xb')](_0x7a75('0x17'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x18')]);router['get']('/:id/messages',auth[_0x7a75('0xc')](),controller[_0x7a75('0x19')]);router[_0x7a75('0xb')](_0x7a75('0x1a'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x1b')]);router['get'](_0x7a75('0x1c'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x1d')]);router['post'](_0x7a75('0xf'),auth[_0x7a75('0xc')](),controller['addDisposition']);router[_0x7a75('0x1e')](_0x7a75('0x11'),auth['isAuthenticated'](),controller[_0x7a75('0x1f')]);router['post']('/',auth[_0x7a75('0xc')](),controller[_0x7a75('0x20')]);router[_0x7a75('0x1e')](_0x7a75('0x21'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x22')]);router[_0x7a75('0x1e')](_0x7a75('0x23'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x7a75('0x1e')](_0x7a75('0x15'),auth[_0x7a75('0xc')](),controller['addInteraction']);router[_0x7a75('0x1e')](_0x7a75('0x17'),auth[_0x7a75('0xc')](),controller['addApplications']);router[_0x7a75('0x1e')](_0x7a75('0x24'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x25')]);router[_0x7a75('0x1e')](_0x7a75('0x1c'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7a75('0x26')](_0x7a75('0x27'),auth['isAuthenticated'](),controller[_0x7a75('0x28')]);router['delete'](_0x7a75('0xf'),auth['isAuthenticated'](),controller[_0x7a75('0x29')]);router['delete'](_0x7a75('0x11'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x2a')]);router[_0x7a75('0x2b')](_0x7a75('0x21'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x2c')]);router[_0x7a75('0x2b')]('/:id/out_servers',auth[_0x7a75('0xc')](),controller[_0x7a75('0x2d')]);router[_0x7a75('0x2b')](_0x7a75('0x27'),auth[_0x7a75('0xc')](),controller[_0x7a75('0x2e')]);router[_0x7a75('0x2b')]('/:id/users',auth[_0x7a75('0xc')](),controller[_0x7a75('0x2f')]);module[_0x7a75('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7dd27a4..08ae00e 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 _0xe713=['hotmail','yahoo','outlook365','provider','custom','getDataValue','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail'];(function(_0x599d7f,_0xc586e8){var _0x3346d3=function(_0x56b820){while(--_0x56b820){_0x599d7f['push'](_0x599d7f['shift']());}};_0x3346d3(++_0xc586e8);}(_0xe713,0xce));var _0x3e71=function(_0x175342,_0x57e790){_0x175342=_0x175342-0x0;var _0x1477a8=_0xe713[_0x175342];return _0x1477a8;};'use strict';var Sequelize=require('sequelize');module[_0x3e71('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x3e71('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x3e71('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x3e71('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x3e71('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x3e71('0x3')]},'markAsUnread':{'type':Sequelize[_0x3e71('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x3e71('0x1')],'allowNull':![],'defaultValue':_0x3e71('0x4')},'fontSize':{'type':Sequelize[_0x3e71('0x5')](0x2)[_0x3e71('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3e71('0x3')],'defaultValue':function(){return _0x3e71('0x7');}},'notificationSound':{'type':Sequelize[_0x3e71('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3e71('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e71('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3e71('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3e71('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3e71('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3e71('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3e71('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x3e71('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x3e71('0x2')],'defaultValue':![],'comment':_0x3e71('0x9'),'set':function(_0x250f99){if(!_0x250f99)this[_0x3e71('0xa')](_0x3e71('0xb'),null);this[_0x3e71('0xa')]('mandatoryDisposition',_0x250f99);}},'provider':{'type':Sequelize[_0x3e71('0xc')](_0x3e71('0xd'),_0x3e71('0xe'),_0x3e71('0xf'),_0x3e71('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x3e71('0x11')))return _0x3e71('0x12');return this[_0x3e71('0x13')]('provider');},'set':function(_0x50a536){if(_0x50a536===_0x3e71('0x12'))_0x50a536=null;return this[_0x3e71('0xa')](_0x3e71('0x11'),_0x50a536);}}}; \ No newline at end of file +var _0x0568=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','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','mandatoryDisposition','ENUM','gmail','yahoo','custom','getDataValue','provider','exports'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x0568,0x1db));var _0x8056=function(_0x4eefbe,_0x268e13){_0x4eefbe=_0x4eefbe-0x0;var _0xd85bf3=_0x0568[_0x4eefbe];return _0xd85bf3;};'use strict';var Sequelize=require('sequelize');module[_0x8056('0x0')]={'description':{'type':Sequelize[_0x8056('0x1')]},'name':{'type':Sequelize[_0x8056('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x8056('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x8056('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x8056('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8056('0x1')],'allowNull':![],'defaultValue':_0x8056('0x3')},'fontSize':{'type':Sequelize[_0x8056('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8056('0x5')],'defaultValue':function(){return _0x8056('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8056('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8056('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8056('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8056('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8056('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8056('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8056('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8056('0x2')],'defaultValue':![],'comment':_0x8056('0x7'),'set':function(_0xa28ea2){if(!_0xa28ea2)this[_0x8056('0x8')](_0x8056('0x9'),null);this[_0x8056('0x8')](_0x8056('0xa'),_0xa28ea2);}},'provider':{'type':Sequelize[_0x8056('0xb')](_0x8056('0xc'),'hotmail',_0x8056('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return _0x8056('0xe');return this[_0x8056('0xf')](_0x8056('0x10'));},'set':function(_0x42f3ee){if(_0x42f3ee===_0x8056('0xe'))_0x42f3ee=null;return this['setDataValue'](_0x8056('0x10'),_0x42f3ee);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index abd95c5..a6d3677 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 _0x0246=['ids','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','getApplications','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','split','CmList','Contacts','updatedAt','CloudProvider','from','%s\x20<%s>','attachments','join','basename','getSmtpOptions','SendMail','sendMail','List','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','update','destroy','MailAccounts','UserProfileResource','sendStatus','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','MailAccount','includeAll','rows','show','params','Pause','mandatoryDispositionPause','include','find','body','provider','secure','Mail\x20Account\x20not\x20found','MailAccountId','create','getDispositions','findOne','Disposition','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers'];(function(_0x139e4,_0x3eb66d){var _0x1d10d3=function(_0xc78081){while(--_0xc78081){_0x139e4['push'](_0x139e4['shift']());}};_0x1d10d3(++_0x3eb66d);}(_0x0246,0x10d));var _0x6024=function(_0x3fa714,_0x48979c){_0x3fa714=_0x3fa714-0x0;var _0xd0a8bc=_0x0246[_0x3fa714];return _0xd0a8bc;};'use strict';var moment=require(_0x6024('0x0'));var BPromise=require(_0x6024('0x1'));var util=require(_0x6024('0x2'));var path=require(_0x6024('0x3'));var _=require(_0x6024('0x4'));var juice=require(_0x6024('0x5'));var Redis=require(_0x6024('0x6'));var qs=require(_0x6024('0x7'));var logger=require('../../config/logger')(_0x6024('0x8'));var config=require(_0x6024('0x9'));var db=require(_0x6024('0xa'))['db'];config[_0x6024('0xb')]=_[_0x6024('0xc')](config[_0x6024('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6024('0xd'))(new Redis(config['redis']));require(_0x6024('0xe'))[_0x6024('0xf')](socket);var jayson=require(_0x6024('0x10'));var client=jayson['client'][_0x6024('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x26884c,_0x4b168d,_0x1f27d6,_0x5116c1){return new BPromise(function(_0x10db2b,_0x328edb){var _0x486002=_0x5116c1||client;return _0x486002[_0x6024('0x12')](_0x26884c,_0x1f27d6)[_0x6024('0x13')](function(_0x27627b){logger[_0x6024('0x14')](_0x6024('0x15'),_0x4b168d,_0x6024('0x16'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4b168d,'request\x20sent',JSON[_0x6024('0x17')](_0x27627b));if(_0x27627b[_0x6024('0x18')]){if(_0x27627b[_0x6024('0x18')][_0x6024('0x19')]===0x1f4){logger['error'](_0x6024('0x15'),_0x4b168d,_0x27627b[_0x6024('0x18')][_0x6024('0x1a')]);return _0x328edb(_0x27627b[_0x6024('0x18')][_0x6024('0x1a')]);}logger['error'](_0x6024('0x15'),_0x4b168d,_0x27627b[_0x6024('0x18')][_0x6024('0x1a')]);return _0x10db2b(_0x27627b[_0x6024('0x18')][_0x6024('0x1a')]);}else{logger[_0x6024('0x14')](_0x6024('0x15'),_0x4b168d,_0x6024('0x16'));_0x10db2b(_0x27627b[_0x6024('0x1b')]['message']);}})[_0x6024('0x1c')](function(_0x4e0054){logger[_0x6024('0x18')]('MailAccount,\x20%s,\x20%s',_0x4b168d,_0x4e0054);_0x328edb(_0x4e0054);});});}function respondWithStatusCode(_0x51f0a3,_0x4a657d){_0x4a657d=_0x4a657d||0xcc;return function(_0x3a5c67){if(_0x3a5c67){return _0x51f0a3['sendStatus'](_0x4a657d);}return _0x51f0a3[_0x6024('0x1d')](_0x4a657d)[_0x6024('0x1e')]();};}function respondWithResult(_0x599330,_0x732ca3){_0x732ca3=_0x732ca3||0xc8;return function(_0x44e6c1){if(_0x44e6c1){return _0x599330[_0x6024('0x1d')](_0x732ca3)['json'](_0x44e6c1);}};}function respondWithFilteredResult(_0x9ca043,_0x30824a){return function(_0x4aa0de){if(_0x4aa0de){var _0x37a705=typeof _0x30824a[_0x6024('0x1f')]==='undefined'&&typeof _0x30824a['limit']===_0x6024('0x20');var _0x3039bc=_0x4aa0de[_0x6024('0x21')];var _0x5a1699=_0x37a705?0x0:_0x30824a['offset'];var _0x25ca57=_0x37a705?_0x4aa0de[_0x6024('0x21')]:_0x30824a['offset']+_0x30824a[_0x6024('0x22')];var _0x3db99a;if(_0x25ca57>=_0x3039bc){_0x25ca57=_0x3039bc;_0x3db99a=0xc8;}else{_0x3db99a=0xce;}_0x9ca043[_0x6024('0x1d')](_0x3db99a);return _0x9ca043[_0x6024('0x23')](_0x6024('0x24'),_0x5a1699+'-'+_0x25ca57+'/'+_0x3039bc)[_0x6024('0x25')](_0x4aa0de);}return null;};}function saveUpdates(_0x3e1320){return function(_0x13b1cc){if(_0x13b1cc){return _0x13b1cc[_0x6024('0x26')](_0x3e1320)[_0x6024('0x13')](function(_0x3ed736){return _0x3ed736;});}return null;};}function removeEntity(_0x4fd8b9){return function(_0x3211b9){if(_0x3211b9){return _0x3211b9[_0x6024('0x27')]()[_0x6024('0x13')](function(){var _0x26b7c7=_0x3211b9['get']({'plain':!![]});var _0x43262f=_0x6024('0x28');return db[_0x6024('0x29')][_0x6024('0x27')]({'where':{'type':_0x43262f,'resourceId':_0x26b7c7['id']}})[_0x6024('0x13')](function(){return _0x3211b9;});})[_0x6024('0x13')](function(){_0x4fd8b9[_0x6024('0x1d')](0xcc)[_0x6024('0x1e')]();});}};}function handleEntityNotFound(_0x5b1862){return function(_0x358afc){if(!_0x358afc){_0x5b1862[_0x6024('0x2a')](0x194);}return _0x358afc;};}function handleError(_0x450fd1,_0x2cb046){_0x2cb046=_0x2cb046||0x1f4;return function(_0x3df0ee){logger[_0x6024('0x18')](_0x3df0ee[_0x6024('0x2b')]);if(_0x3df0ee[_0x6024('0x2c')]){delete _0x3df0ee[_0x6024('0x2c')];}_0x450fd1['status'](_0x2cb046)[_0x6024('0x2d')](_0x3df0ee);};}function getImapHost(_0x5ef240){switch(_0x5ef240){case _0x6024('0x2e'):return _0x6024('0x2f');case _0x6024('0x30'):return _0x6024('0x31');case _0x6024('0x32'):return _0x6024('0x33');case'outlook365':return _0x6024('0x34');}throw new Error(_0x6024('0x35'),_0x5ef240);}function getSmtpHost(_0x38eb59){switch(_0x38eb59){case _0x6024('0x2e'):return _0x6024('0x36');case _0x6024('0x30'):return _0x6024('0x37');case'hotmail':return _0x6024('0x38');case _0x6024('0x39'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x38eb59);}function getAuthenticationOptions(_0x5bda59,_0x136802){var _0x1faf88={};var _0x4801a2={};if(_0x5bda59){_0x1faf88[_0x6024('0x3a')]=_0x4801a2[_0x6024('0x3a')]=_0x136802[_0x6024('0x3b')];_0x1faf88[_0x6024('0x3c')]=_0x4801a2[_0x6024('0x3d')]=_0x136802[_0x6024('0x3c')];if(_0x136802[_0x6024('0x3e')]){_0x1faf88[_0x6024('0x3e')]=_0x4801a2[_0x6024('0x3e')]=!![];_0x1faf88[_0x6024('0x3f')]=_0x4801a2[_0x6024('0x3f')]=_0x136802[_0x6024('0x3f')];_0x1faf88['password']=_0x4801a2[_0x6024('0x3d')]=null;}else{_0x1faf88[_0x6024('0x3f')]=_0x4801a2[_0x6024('0x3f')]=null;}_0x1faf88['host']=getImapHost(_0x5bda59);_0x1faf88[_0x6024('0x40')]=0x3e1;_0x4801a2[_0x6024('0x41')]=getSmtpHost(_0x5bda59);_0x4801a2['port']=0x24b;_0x4801a2['secure']=![];_0x1faf88[_0x6024('0x42')]=_0x4801a2[_0x6024('0x42')]=null;}else{if(_0x136802[_0x6024('0x43')]){_0x1faf88[_0x6024('0x3a')]=_0x4801a2[_0x6024('0x3a')]=_0x136802['username'];_0x1faf88[_0x6024('0x3c')]=_0x4801a2[_0x6024('0x3d')]=_0x136802['password'];}else{_0x1faf88[_0x6024('0x43')]=_0x4801a2[_0x6024('0x43')]=![];_0x1faf88[_0x6024('0x3a')]=_0x4801a2[_0x6024('0x3a')]=null;_0x1faf88[_0x6024('0x3c')]=_0x4801a2['pass']=null;}_0x1faf88[_0x6024('0x41')]=_0x136802[_0x6024('0x44')][_0x6024('0x41')];_0x1faf88[_0x6024('0x40')]=_0x136802[_0x6024('0x44')][_0x6024('0x40')];_0x4801a2[_0x6024('0x41')]=_0x136802[_0x6024('0x45')][_0x6024('0x41')];_0x4801a2[_0x6024('0x40')]=_0x136802[_0x6024('0x45')][_0x6024('0x40')];}return{'Imap':_0x1faf88,'Smtp':_0x4801a2};}exports[_0x6024('0x46')]=function(_0x5dbf01,_0x6ec15b){var _0xb2f68c={'include':[{'model':db[_0x6024('0x47')],'as':_0x6024('0x44')},{'model':db[_0x6024('0x48')],'as':_0x6024('0x45')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x36ad9d={},_0x546f8f={'count':0x0,'rows':[]};var _0x5cac4d=_[_0x6024('0x49')](db['MailAccount'][_0x6024('0x4a')],function(_0xb167b1){return{'name':_0xb167b1[_0x6024('0x4b')],'type':_0xb167b1[_0x6024('0x4c')][_0x6024('0x4d')]};});_0x36ad9d[_0x6024('0x4e')]=_[_0x6024('0x49')](_0x5cac4d,_0x6024('0x2c'));_0x36ad9d['query']=_[_0x6024('0x4f')](_0x5dbf01[_0x6024('0x50')]);_0x36ad9d['filters']=_['intersection'](_0x36ad9d[_0x6024('0x4e')],_0x36ad9d['query']);_0xb2f68c['attributes']=_[_0x6024('0x51')](_0x36ad9d[_0x6024('0x4e')],qs[_0x6024('0x52')](_0x5dbf01[_0x6024('0x50')]['fields']));_0xb2f68c[_0x6024('0x53')]=_0xb2f68c[_0x6024('0x53')][_0x6024('0x54')]?_0xb2f68c[_0x6024('0x53')]:_0x36ad9d[_0x6024('0x4e')];if(!_0x5dbf01['query'][_0x6024('0x55')](_0x6024('0x56'))){_0xb2f68c[_0x6024('0x22')]=qs[_0x6024('0x22')](_0x5dbf01[_0x6024('0x50')]['limit']);_0xb2f68c[_0x6024('0x1f')]=qs['offset'](_0x5dbf01['query']['offset']);}_0xb2f68c[_0x6024('0x57')]=qs[_0x6024('0x58')](_0x5dbf01[_0x6024('0x50')]['sort']);_0xb2f68c['where']=qs[_0x6024('0x59')](_[_0x6024('0x5a')](_0x5dbf01[_0x6024('0x50')],_0x36ad9d[_0x6024('0x59')]),_0x5cac4d);if(_0x5dbf01[_0x6024('0x50')]['filter']){_0xb2f68c[_0x6024('0x5b')]=_[_0x6024('0x5c')](_0xb2f68c['where'],{'$or':_[_0x6024('0x49')](_0x5cac4d,function(_0x134b83){if(_0x134b83[_0x6024('0x4c')]!=='VIRTUAL'){var _0x54c43a={};_0x54c43a[_0x134b83['name']]={'$like':'%'+_0x5dbf01[_0x6024('0x50')][_0x6024('0x5d')]+'%'};return _0x54c43a;}})});}_0xb2f68c=_['merge']({},_0xb2f68c,_0x5dbf01[_0x6024('0x5e')]);var _0x44ec34={'where':_0xb2f68c[_0x6024('0x5b')]};return db[_0x6024('0x5f')][_0x6024('0x21')](_0x44ec34)[_0x6024('0x13')](function(_0x1a9aea){_0x546f8f['count']=_0x1a9aea;if(_0x5dbf01[_0x6024('0x50')][_0x6024('0x60')]){_0xb2f68c['include']=[{'all':!![]}];}return db[_0x6024('0x5f')]['findAll'](_0xb2f68c);})[_0x6024('0x13')](function(_0x5bb158){_0x546f8f[_0x6024('0x61')]=_0x5bb158;return _0x546f8f;})[_0x6024('0x13')](respondWithFilteredResult(_0x6ec15b,_0xb2f68c))[_0x6024('0x1c')](handleError(_0x6ec15b,null));};exports[_0x6024('0x62')]=function(_0x40c45d,_0x5720cf){var _0x1a332f={'raw':![],'where':{'id':_0x40c45d[_0x6024('0x63')]['id']},'include':[{'model':db[_0x6024('0x47')],'as':_0x6024('0x44')},{'model':db[_0x6024('0x48')],'as':_0x6024('0x45')},{'model':db[_0x6024('0x64')],'as':_0x6024('0x65')}]},_0x50e997={};_0x50e997['model']=_[_0x6024('0x4f')](db[_0x6024('0x5f')][_0x6024('0x4a')]);_0x50e997['query']=_[_0x6024('0x4f')](_0x40c45d[_0x6024('0x50')]);_0x50e997[_0x6024('0x59')]=_['intersection'](_0x50e997[_0x6024('0x4e')],_0x50e997[_0x6024('0x50')]);_0x1a332f[_0x6024('0x53')]=_[_0x6024('0x51')](_0x50e997[_0x6024('0x4e')],qs[_0x6024('0x52')](_0x40c45d[_0x6024('0x50')][_0x6024('0x52')]));_0x1a332f[_0x6024('0x53')]=_0x1a332f['attributes'][_0x6024('0x54')]?_0x1a332f[_0x6024('0x53')]:_0x50e997[_0x6024('0x4e')];if(_0x40c45d[_0x6024('0x50')][_0x6024('0x60')]){_0x1a332f[_0x6024('0x66')]=[{'all':!![]}];}_0x1a332f=_[_0x6024('0x5c')]({},_0x1a332f,_0x40c45d[_0x6024('0x5e')]);return db['MailAccount'][_0x6024('0x67')](_0x1a332f)[_0x6024('0x13')](handleEntityNotFound(_0x5720cf,null))[_0x6024('0x13')](respondWithResult(_0x5720cf,null))[_0x6024('0x1c')](handleError(_0x5720cf,null));};exports[_0x6024('0x26')]=function(_0x4821b9,_0x4aaf15){if(_0x4821b9[_0x6024('0x68')]['id']){delete _0x4821b9[_0x6024('0x68')]['id'];}var _0x5f4483=_0x4821b9[_0x6024('0x68')][_0x6024('0x69')]==='custom'?null:_0x4821b9[_0x6024('0x68')][_0x6024('0x69')];var _0x47de75=_0x4821b9[_0x6024('0x68')]['Imap']||{};var _0x6631d8=_0x4821b9[_0x6024('0x68')][_0x6024('0x45')]||{};if(_0x5f4483){_0x47de75[_0x6024('0x41')]=getImapHost(_0x5f4483);_0x47de75[_0x6024('0x40')]=0x3e1;_0x6631d8[_0x6024('0x41')]=getSmtpHost(_0x5f4483);_0x6631d8[_0x6024('0x40')]=0x24b;_0x6631d8[_0x6024('0x6a')]=![];}if(_0x6631d8[_0x6024('0x3e')]){_0x6631d8[_0x6024('0x6a')]=![];}else{_0x6631d8['CloudProviderId']=null;}if(!_0x47de75[_0x6024('0x3e')])_0x47de75[_0x6024('0x3f')]=null;_0x4821b9[_0x6024('0x68')][_0x6024('0x44')]=_0x47de75;_0x4821b9[_0x6024('0x68')][_0x6024('0x45')]=_0x6631d8;return db['MailAccount'][_0x6024('0x67')]({'where':{'id':_0x4821b9[_0x6024('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6024('0x44')},{'model':db['MailServerOut'],'as':_0x6024('0x45')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x6024('0x13')](handleEntityNotFound(_0x4aaf15,null))[_0x6024('0x13')](function(_0x5ed14d){if(!_0x5ed14d)throw new Error(_0x6024('0x6b'));if(_0x5ed14d[_0x6024('0x42')])delete _0x4821b9[_0x6024('0x68')][_0x6024('0x44')];return _0x5ed14d;})['then'](saveUpdates(_0x4821b9[_0x6024('0x68')],null))[_0x6024('0x13')](function(_0x32960d){if(!_0x4821b9[_0x6024('0x68')][_0x6024('0x44')])return _0x32960d;return db[_0x6024('0x47')][_0x6024('0x26')](_0x4821b9[_0x6024('0x68')]['Imap'],{'where':{'MailAccountId':_0x32960d['id']}})[_0x6024('0x13')](function(){return _0x32960d;});})[_0x6024('0x13')](function(_0x1458c1){if(!_0x4821b9[_0x6024('0x68')][_0x6024('0x45')])return _0x1458c1;return db[_0x6024('0x48')][_0x6024('0x26')](_0x4821b9[_0x6024('0x68')][_0x6024('0x45')],{'where':{'MailAccountId':_0x1458c1['id']}})[_0x6024('0x13')](function(){return _0x1458c1;});})[_0x6024('0x13')](respondWithResult(_0x4aaf15,null))[_0x6024('0x1c')](handleError(_0x4aaf15,null));};exports['describe']=function(_0xde2a80,_0x58d411){return db[_0x6024('0x5f')]['describe']()[_0x6024('0x13')](respondWithResult(_0x58d411,null))[_0x6024('0x1c')](handleError(_0x58d411,null));};exports['addDisposition']=function(_0x24d025,_0x24f96b){if(_0x24d025['body']['id']){delete _0x24d025['body']['id'];}return db['MailAccount'][_0x6024('0x67')]({'where':{'id':_0x24d025[_0x6024('0x63')]['id']}})['then'](handleEntityNotFound(_0x24f96b,null))[_0x6024('0x13')](function(_0x538d43){if(_0x538d43){_0x24d025[_0x6024('0x68')][_0x6024('0x6c')]=_0x538d43['id'];return db['Disposition'][_0x6024('0x6d')](_0x24d025[_0x6024('0x68')]);}})['then'](respondWithResult(_0x24f96b,null))[_0x6024('0x1c')](handleError(_0x24f96b,null));};exports[_0x6024('0x6e')]=function(_0x29ebec,_0x34f0c6){var _0x29ef74={'raw':![],'where':{}};var _0x458b05={};var _0xd74c96={'count':0x0,'rows':[]};return db[_0x6024('0x5f')][_0x6024('0x6f')]({'where':{'id':_0x29ebec[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x34f0c6,null))[_0x6024('0x13')](function(_0x462203){if(_0x462203){_0x458b05[_0x6024('0x4e')]=_['keys'](db['Disposition'][_0x6024('0x4a')]);_0x458b05[_0x6024('0x50')]=_[_0x6024('0x4f')](_0x29ebec[_0x6024('0x50')]);_0x458b05[_0x6024('0x59')]=_[_0x6024('0x51')](_0x458b05[_0x6024('0x4e')],_0x458b05['query']);_0x29ef74[_0x6024('0x53')]=_[_0x6024('0x51')](_0x458b05[_0x6024('0x4e')],qs[_0x6024('0x52')](_0x29ebec[_0x6024('0x50')][_0x6024('0x52')]));_0x29ef74[_0x6024('0x53')]=_0x29ef74[_0x6024('0x53')][_0x6024('0x54')]?_0x29ef74[_0x6024('0x53')]:_0x458b05['model'];if(!_0x29ebec['query'][_0x6024('0x55')](_0x6024('0x56'))){_0x29ef74['limit']=qs[_0x6024('0x22')](_0x29ebec[_0x6024('0x50')][_0x6024('0x22')]);_0x29ef74['offset']=qs['offset'](_0x29ebec[_0x6024('0x50')]['offset']);}_0x29ef74['order']=qs[_0x6024('0x58')](_0x29ebec['query']['sort']);_0x29ef74[_0x6024('0x5b')]=qs['filters'](_[_0x6024('0x5a')](_0x29ebec['query'],_0x458b05[_0x6024('0x59')]));_0x29ef74['where'][_0x6024('0x6c')]=_0x462203['id'];if(_0x29ebec['query'][_0x6024('0x5d')]){_0x29ef74[_0x6024('0x5b')]=_[_0x6024('0x5c')](_0x29ef74[_0x6024('0x5b')],{'$or':_[_0x6024('0x49')](_0x29ef74[_0x6024('0x53')],function(_0x46d22f){var _0x23bf3a={};_0x23bf3a[_0x46d22f]={'$like':'%'+_0x29ebec[_0x6024('0x50')]['filter']+'%'};return _0x23bf3a;})});}_0x29ef74=_[_0x6024('0x5c')]({},_0x29ef74,_0x29ebec[_0x6024('0x5e')]);return db['Disposition']['count']({'where':_0x29ef74['where']})[_0x6024('0x13')](function(_0x58c54d){_0xd74c96[_0x6024('0x21')]=_0x58c54d;if(_0x29ebec[_0x6024('0x50')]['includeAll']){_0x29ef74['include']=[{'all':!![]}];}return db[_0x6024('0x70')][_0x6024('0x71')](_0x29ef74);})[_0x6024('0x13')](function(_0x18334f){_0xd74c96['rows']=_0x18334f;return _0xd74c96;});}})[_0x6024('0x13')](respondWithFilteredResult(_0x34f0c6,_0x29ef74))[_0x6024('0x1c')](handleError(_0x34f0c6,null));};exports[_0x6024('0x72')]=function(_0x59c90b,_0x79cfe5){return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x59c90b[_0x6024('0x63')]['id']}})['then'](handleEntityNotFound(_0x79cfe5,null))[_0x6024('0x13')](function(_0x3760fe){if(_0x3760fe){return _0x3760fe[_0x6024('0x72')](_0x59c90b['query']['ids']);}})[_0x6024('0x13')](respondWithStatusCode(_0x79cfe5,null))['catch'](handleError(_0x79cfe5,null));};exports[_0x6024('0x73')]=function(_0x342fa0,_0x2f8fda){if(_0x342fa0[_0x6024('0x68')]['id']){delete _0x342fa0['body']['id'];}return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x342fa0[_0x6024('0x63')]['id']}})['then'](handleEntityNotFound(_0x2f8fda,null))[_0x6024('0x13')](function(_0x17a699){if(_0x17a699){_0x342fa0[_0x6024('0x68')][_0x6024('0x6c')]=_0x17a699['id'];return db[_0x6024('0x74')][_0x6024('0x6d')](_0x342fa0[_0x6024('0x68')]);}})[_0x6024('0x13')](respondWithResult(_0x2f8fda,null))[_0x6024('0x1c')](handleError(_0x2f8fda,null));};exports[_0x6024('0x75')]=function(_0x187546,_0x4af5cf){var _0x1d65a3={'raw':![],'where':{}};var _0x20cd47={};var _0x45d0a5={'count':0x0,'rows':[]};return db[_0x6024('0x5f')][_0x6024('0x6f')]({'where':{'id':_0x187546[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x4af5cf,null))[_0x6024('0x13')](function(_0x2ea430){if(_0x2ea430){_0x20cd47[_0x6024('0x4e')]=_['keys'](db[_0x6024('0x74')]['rawAttributes']);_0x20cd47[_0x6024('0x50')]=_[_0x6024('0x4f')](_0x187546[_0x6024('0x50')]);_0x20cd47[_0x6024('0x59')]=_[_0x6024('0x51')](_0x20cd47['model'],_0x20cd47['query']);_0x1d65a3[_0x6024('0x53')]=_[_0x6024('0x51')](_0x20cd47[_0x6024('0x4e')],qs[_0x6024('0x52')](_0x187546[_0x6024('0x50')][_0x6024('0x52')]));_0x1d65a3['attributes']=_0x1d65a3['attributes']['length']?_0x1d65a3[_0x6024('0x53')]:_0x20cd47[_0x6024('0x4e')];if(!_0x187546[_0x6024('0x50')][_0x6024('0x55')]('nolimit')){_0x1d65a3[_0x6024('0x22')]=qs['limit'](_0x187546[_0x6024('0x50')]['limit']);_0x1d65a3[_0x6024('0x1f')]=qs[_0x6024('0x1f')](_0x187546[_0x6024('0x50')][_0x6024('0x1f')]);}_0x1d65a3['order']=qs['sort'](_0x187546[_0x6024('0x50')][_0x6024('0x58')]);_0x1d65a3[_0x6024('0x5b')]=qs['filters'](_['pick'](_0x187546[_0x6024('0x50')],_0x20cd47[_0x6024('0x59')]));_0x1d65a3[_0x6024('0x5b')][_0x6024('0x6c')]=_0x2ea430['id'];if(_0x187546[_0x6024('0x50')][_0x6024('0x5d')]){_0x1d65a3['where']=_[_0x6024('0x5c')](_0x1d65a3[_0x6024('0x5b')],{'$or':_[_0x6024('0x49')](_0x1d65a3[_0x6024('0x53')],function(_0x2c34b6){var _0x4e616e={};_0x4e616e[_0x2c34b6]={'$like':'%'+_0x187546[_0x6024('0x50')]['filter']+'%'};return _0x4e616e;})});}_0x1d65a3=_['merge']({},_0x1d65a3,_0x187546['options']);return db[_0x6024('0x74')][_0x6024('0x21')]({'where':_0x1d65a3[_0x6024('0x5b')]})[_0x6024('0x13')](function(_0x3f2ddf){_0x45d0a5[_0x6024('0x21')]=_0x3f2ddf;if(_0x187546[_0x6024('0x50')]['includeAll']){_0x1d65a3['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x6024('0x71')](_0x1d65a3);})['then'](function(_0x5ce882){_0x45d0a5[_0x6024('0x61')]=_0x5ce882;return _0x45d0a5;});}})['then'](respondWithFilteredResult(_0x4af5cf,_0x1d65a3))['catch'](handleError(_0x4af5cf,null));};exports[_0x6024('0x76')]=function(_0x22cfd0,_0x5ce179){return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x22cfd0[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x5ce179,null))['then'](function(_0x3b3226){if(_0x3b3226){return _0x3b3226[_0x6024('0x76')](_0x22cfd0[_0x6024('0x50')][_0x6024('0x77')]);}})[_0x6024('0x13')](respondWithStatusCode(_0x5ce179,null))['catch'](handleError(_0x5ce179,null));};exports[_0x6024('0x6d')]=function(_0x22b09,_0x3ad2db){var _0x583fd9={'name':_0x22b09[_0x6024('0x68')]['name'],'key':_0x22b09['body'][_0x6024('0x4d')],'provider':_0x22b09[_0x6024('0x68')][_0x6024('0x69')]===_0x6024('0x78')?null:_0x22b09[_0x6024('0x68')][_0x6024('0x69')],'email':_0x22b09[_0x6024('0x68')][_0x6024('0x79')],'ListId':_0x22b09[_0x6024('0x68')][_0x6024('0x7a')],'active':!_[_0x6024('0x7b')](_0x22b09[_0x6024('0x68')][_0x6024('0x7c')])?_0x22b09[_0x6024('0x68')]['active']:!![],'description':_0x22b09[_0x6024('0x68')][_0x6024('0x7d')]||null};var _0x65741f=getAuthenticationOptions(_0x583fd9[_0x6024('0x69')],_0x22b09[_0x6024('0x68')]);_0x583fd9['Imap']=_0x65741f['Imap'];_0x583fd9['Smtp']=_0x65741f[_0x6024('0x45')];return db[_0x6024('0x5f')][_0x6024('0x6d')](_0x583fd9,{'include':[{'model':db['MailServerOut'],'as':_0x6024('0x45')},{'model':db[_0x6024('0x47')],'as':_0x6024('0x44')}]})[_0x6024('0x13')](function(_0x3378de){var _0x37f44b=_0x22b09[_0x6024('0x3a')]['get']({'plain':!![]});if(!_0x37f44b)throw new Error(_0x6024('0x7e'));if(_0x37f44b[_0x6024('0x7f')]==='user'){var _0x5e9597=_0x3378de['get']({'plain':!![]});return db[_0x6024('0x80')][_0x6024('0x67')]({'where':{'name':_0x6024('0x28'),'userProfileId':_0x37f44b[_0x6024('0x81')]},'raw':!![]})[_0x6024('0x13')](function(_0x174b93){if(_0x174b93&&_0x174b93['autoAssociation']===0x0){return db[_0x6024('0x29')][_0x6024('0x6d')]({'name':_0x5e9597[_0x6024('0x2c')],'resourceId':_0x5e9597['id'],'type':_0x174b93[_0x6024('0x2c')],'sectionId':_0x174b93['id']},{})['then'](function(){return _0x3378de;});}else{return _0x3378de;}})[_0x6024('0x1c')](function(_0x3f3199){logger[_0x6024('0x18')](_0x6024('0x82'),_0x3f3199);throw _0x3f3199;});}return _0x3378de;})[_0x6024('0x13')](respondWithResult(_0x3ad2db,0xc9))[_0x6024('0x1c')](handleError(_0x3ad2db,null));};exports['getImap']=function(_0x35568f,_0x2bf2fc){return db[_0x6024('0x5f')][_0x6024('0x6f')]({'where':{'id':_0x35568f[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x2bf2fc,null))[_0x6024('0x13')](function(_0x440b68){if(_0x440b68){return _0x440b68[_0x6024('0x83')]();}return null;})[_0x6024('0x13')](respondWithResult(_0x2bf2fc,null))[_0x6024('0x1c')](handleError(_0x2bf2fc,null));};exports['addImap']=function(_0x52ef25,_0x56d117){if(_0x52ef25[_0x6024('0x68')]['id']){delete _0x52ef25['body']['id'];}return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x52ef25['params']['id']}})['then'](handleEntityNotFound(_0x56d117,null))[_0x6024('0x13')](function(_0xa6e72e){if(_0xa6e72e){_0x52ef25[_0x6024('0x68')][_0x6024('0x6c')]=_0xa6e72e['id'];return db[_0x6024('0x47')][_0x6024('0x6d')](_0x52ef25[_0x6024('0x68')]);}})[_0x6024('0x13')](respondWithResult(_0x56d117,null))[_0x6024('0x1c')](handleError(_0x56d117,null));};exports[_0x6024('0x84')]=function(_0x1e260,_0x57e502){return db['MailAccount'][_0x6024('0x6f')]({'where':{'id':_0x1e260['params']['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x57e502,null))[_0x6024('0x13')](function(_0x21adda){if(_0x21adda){return _0x21adda[_0x6024('0x85')](null);}return null;})[_0x6024('0x13')](respondWithStatusCode(_0x57e502,null))['catch'](handleError(_0x57e502,null));};exports['getSmtp']=function(_0x51e11c,_0x3db448){return db[_0x6024('0x5f')][_0x6024('0x6f')]({'where':{'id':_0x51e11c[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x3db448,null))[_0x6024('0x13')](function(_0x4b3b7e){if(_0x4b3b7e){return _0x4b3b7e[_0x6024('0x86')]();}return null;})[_0x6024('0x13')](respondWithResult(_0x3db448,null))[_0x6024('0x1c')](handleError(_0x3db448,null));};exports[_0x6024('0x87')]=function(_0x3a8766,_0x381773){if(_0x3a8766[_0x6024('0x68')]['id']){delete _0x3a8766[_0x6024('0x68')]['id'];}return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x3a8766[_0x6024('0x63')]['id']}})['then'](handleEntityNotFound(_0x381773,null))[_0x6024('0x13')](function(_0x4df417){if(_0x4df417){_0x3a8766[_0x6024('0x68')][_0x6024('0x6c')]=_0x4df417['id'];return db[_0x6024('0x48')][_0x6024('0x6d')](_0x3a8766[_0x6024('0x68')]);}})[_0x6024('0x13')](respondWithResult(_0x381773,null))[_0x6024('0x1c')](handleError(_0x381773,null));};exports[_0x6024('0x88')]=function(_0x250ff0,_0x11f4b5){return db[_0x6024('0x5f')]['findOne']({'where':{'id':_0x250ff0[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x11f4b5,null))[_0x6024('0x13')](function(_0x19479d){if(_0x19479d){return _0x19479d[_0x6024('0x89')](null);}return null;})[_0x6024('0x13')](respondWithStatusCode(_0x11f4b5,null))[_0x6024('0x1c')](handleError(_0x11f4b5,null));};exports['addInteraction']=function(_0x276873,_0x410cd){return db[_0x6024('0x8a')]['find']({'where':{'id':_0x276873[_0x6024('0x63')]['id']}})['then'](handleEntityNotFound(_0x410cd,null))[_0x6024('0x13')](function(_0xc2ee5f){if(_0xc2ee5f){return _0xc2ee5f[_0x6024('0x8b')](_0x276873[_0x6024('0x68')]['ids'],_[_0x6024('0x8c')](_0x276873[_0x6024('0x68')],['ids','id'])||{});}})[_0x6024('0x13')](respondWithResult(_0x410cd,null))[_0x6024('0x1c')](handleError(_0x410cd,null));};exports['getInteractions']=function(_0x2d1f1e,_0x343b2e){var _0x4293d3={'raw':![],'where':{}};var _0x42c080={};var _0x58295e={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2d1f1e[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x343b2e,null))[_0x6024('0x13')](function(_0x844d58){if(_0x844d58){_0x42c080['model']=_['keys'](db[_0x6024('0x8a')][_0x6024('0x4a')]);_0x42c080[_0x6024('0x50')]=_[_0x6024('0x4f')](_0x2d1f1e['query']);_0x42c080[_0x6024('0x59')]=_[_0x6024('0x51')](_0x42c080['model'],_0x42c080[_0x6024('0x50')]);_0x4293d3[_0x6024('0x53')]=_['intersection'](_0x42c080[_0x6024('0x4e')],qs[_0x6024('0x52')](_0x2d1f1e['query'][_0x6024('0x52')]));_0x4293d3[_0x6024('0x53')]=_0x4293d3[_0x6024('0x53')][_0x6024('0x54')]?_0x4293d3['attributes']:_0x42c080[_0x6024('0x4e')];if(!_0x2d1f1e[_0x6024('0x50')][_0x6024('0x55')](_0x6024('0x56'))){_0x4293d3[_0x6024('0x22')]=qs[_0x6024('0x22')](_0x2d1f1e[_0x6024('0x50')]['limit']);_0x4293d3[_0x6024('0x1f')]=qs[_0x6024('0x1f')](_0x2d1f1e[_0x6024('0x50')][_0x6024('0x1f')]);}_0x4293d3['order']=qs[_0x6024('0x58')](_0x2d1f1e['query'][_0x6024('0x58')]);_0x4293d3[_0x6024('0x5b')]=qs['filters'](_[_0x6024('0x5a')](_0x2d1f1e[_0x6024('0x50')],_0x42c080[_0x6024('0x59')]));_0x4293d3[_0x6024('0x5b')][_0x6024('0x6c')]=_0x844d58['id'];if(_0x2d1f1e[_0x6024('0x50')][_0x6024('0x5d')]){_0x4293d3['where']=_[_0x6024('0x5c')](_0x4293d3[_0x6024('0x5b')],{'$or':_[_0x6024('0x49')](_0x4293d3['attributes'],function(_0x31bbe9){var _0x362826={};_0x362826[_0x31bbe9]={'$like':'%'+_0x2d1f1e[_0x6024('0x50')][_0x6024('0x5d')]+'%'};return _0x362826;})});}_0x4293d3=_[_0x6024('0x5c')]({},_0x4293d3,_0x2d1f1e[_0x6024('0x5e')]);return db[_0x6024('0x8a')][_0x6024('0x21')]({'where':_0x4293d3[_0x6024('0x5b')]})[_0x6024('0x13')](function(_0x45c968){_0x58295e[_0x6024('0x21')]=_0x45c968;if(_0x2d1f1e['query'][_0x6024('0x60')]){_0x4293d3[_0x6024('0x66')]=[{'model':db[_0x6024('0x8d')],'as':_0x6024('0x8e'),'required':![]},{'model':db[_0x6024('0x8f')],'as':_0x6024('0x90'),'attributes':['name',_0x6024('0x91'),_0x6024('0x92')],'required':![]},{'model':db[_0x6024('0x93')],'as':'Tags','attributes':['id','name','color'],'where':_0x2d1f1e[_0x6024('0x50')][_0x6024('0x94')]?{'id':_0x2d1f1e['query'][_0x6024('0x94')]}:undefined,'required':_0x2d1f1e['query'][_0x6024('0x94')]?!![]:![]}];}return db[_0x6024('0x8a')][_0x6024('0x71')](_0x4293d3);})['then'](function(_0x4ab330){_0x58295e[_0x6024('0x61')]=_0x4ab330;return _0x58295e;});}})[_0x6024('0x13')](respondWithFilteredResult(_0x343b2e,_0x4293d3))[_0x6024('0x1c')](handleError(_0x343b2e,null));};exports[_0x6024('0x95')]=function addApplications(_0x51fbfc,_0x2a194f){var _0x5b111=_0x51fbfc[_0x6024('0x63')]['id'];var _0x673e2=_0x51fbfc[_0x6024('0x68')];var _0x4564c6=0xc8;var _0x2aac90=null;return db[_0x6024('0x96')][_0x6024('0x97')]({'isolationLevel':db[_0x6024('0x96')]['Transaction'][_0x6024('0x98')][_0x6024('0x99')]},function(_0x4aac7f){return db['MailAccount'][_0x6024('0x6f')]({'where':{'id':_0x5b111},'transaction':_0x4aac7f})[_0x6024('0x13')](function(_0x49e2dc){if(_0x49e2dc){return db['MailApplication'][_0x6024('0x27')]({'where':{'MailAccountId':_0x5b111},'transaction':_0x4aac7f})['then'](function(){var _0x36c043=_[_0x6024('0x49')](_0x673e2,function(_0xf987b2){_0xf987b2[_0x6024('0x6c')]=_0x5b111;return _0xf987b2;});return db[_0x6024('0x9a')][_0x6024('0x9b')](_0x36c043,{'transaction':_0x4aac7f});});}else{_0x4564c6=0x194;_0x2aac90=[];}});})[_0x6024('0x13')](function(){if(_0x4564c6!==0x194){return db[_0x6024('0x9a')]['findAndCountAll']({'where':{'MailAccountId':_0x5b111},'order':_0x6024('0x9c')})[_0x6024('0x13')](function(_0x5c448f){_0x2aac90=_0x5c448f;});}})[_0x6024('0x1c')](function(_0x54693b){_0x4564c6=0x1f4;logger[_0x6024('0x18')](_0x54693b[_0x6024('0x2b')]);if(_0x54693b['name']){delete _0x54693b[_0x6024('0x2c')];}_0x2aac90=_0x54693b;})['finally'](function(){if(_0x2aac90===null){_0x2a194f['sendStatus'](_0x4564c6);}else{if(_0x4564c6===0x1f4){_0x2a194f[_0x6024('0x1d')](_0x4564c6)[_0x6024('0x2d')](_0x2aac90);}else{_0x2a194f[_0x6024('0x1d')](_0x4564c6)[_0x6024('0x25')](_0x2aac90);}}});};exports[_0x6024('0x9d')]=function(_0x2e73d7,_0x5b6316){var _0xbec02d={};var _0x29a4d5={};var _0x447cf5;var _0x43ff1e;return db[_0x6024('0x5f')][_0x6024('0x6f')]({'where':{'id':_0x2e73d7[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x5b6316,null))[_0x6024('0x13')](function(_0x2faa4e){if(_0x2faa4e){_0x447cf5=_0x2faa4e;_0x29a4d5[_0x6024('0x4e')]=_[_0x6024('0x4f')](db[_0x6024('0x9a')][_0x6024('0x4a')]);_0x29a4d5['query']=_[_0x6024('0x4f')](_0x2e73d7[_0x6024('0x50')]);_0x29a4d5[_0x6024('0x59')]=_['intersection'](_0x29a4d5[_0x6024('0x4e')],_0x29a4d5[_0x6024('0x50')]);_0xbec02d[_0x6024('0x53')]=_[_0x6024('0x51')](_0x29a4d5[_0x6024('0x4e')],qs[_0x6024('0x52')](_0x2e73d7[_0x6024('0x50')]['fields']));_0xbec02d[_0x6024('0x53')]=_0xbec02d[_0x6024('0x53')][_0x6024('0x54')]?_0xbec02d[_0x6024('0x53')]:_0x29a4d5[_0x6024('0x4e')];_0xbec02d[_0x6024('0x57')]=qs[_0x6024('0x58')](_0x2e73d7[_0x6024('0x50')][_0x6024('0x58')]);_0xbec02d['where']=qs[_0x6024('0x59')](_['pick'](_0x2e73d7[_0x6024('0x50')],_0x29a4d5[_0x6024('0x59')]));if(_0x2e73d7[_0x6024('0x50')][_0x6024('0x5d')]){_0xbec02d['where']=_[_0x6024('0x5c')](_0xbec02d[_0x6024('0x5b')],{'$or':_[_0x6024('0x49')](_0xbec02d[_0x6024('0x53')],function(_0x5eeafc){var _0x39526d={};_0x39526d[_0x5eeafc]={'$like':'%'+_0x2e73d7[_0x6024('0x50')][_0x6024('0x5d')]+'%'};return _0x39526d;})});}_0xbec02d=_[_0x6024('0x5c')]({},_0xbec02d,_0x2e73d7[_0x6024('0x5e')]);return _0x447cf5[_0x6024('0x9d')](_0xbec02d);}})['then'](function(_0x44e8e1){if(_0x44e8e1){_0x43ff1e=_0x44e8e1['length'];if(!_0x2e73d7[_0x6024('0x50')][_0x6024('0x55')](_0x6024('0x56'))){_0xbec02d[_0x6024('0x22')]=qs[_0x6024('0x22')](_0x2e73d7[_0x6024('0x50')]['limit']);_0xbec02d[_0x6024('0x1f')]=qs['offset'](_0x2e73d7[_0x6024('0x50')][_0x6024('0x1f')]);}return _0x447cf5[_0x6024('0x9d')](_0xbec02d);}})[_0x6024('0x13')](function(_0x2fde7e){if(_0x2fde7e){return _0x2fde7e?{'count':_0x43ff1e,'rows':_0x2fde7e}:null;}})['then'](respondWithResult(_0x5b6316,null))[_0x6024('0x1c')](handleError(_0x5b6316,null));};exports['getMessages']=function(_0x4a9f3d,_0x25a8d5){var _0x1b7446={'raw':!![],'where':{}};var _0x1ca6c3={};var _0x1372a1={'count':0x0,'rows':[]};return db[_0x6024('0x5f')][_0x6024('0x6f')]({'where':{'id':_0x4a9f3d[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x25a8d5,null))['then'](function(_0x40d30a){if(_0x40d30a){_0x1ca6c3['model']=_[_0x6024('0x4f')](db['MailMessage']['rawAttributes']);_0x1ca6c3[_0x6024('0x50')]=_[_0x6024('0x4f')](_0x4a9f3d[_0x6024('0x50')]);_0x1ca6c3[_0x6024('0x59')]=_[_0x6024('0x51')](_0x1ca6c3['model'],_0x1ca6c3['query']);_0x1b7446[_0x6024('0x53')]=_['intersection'](_0x1ca6c3[_0x6024('0x4e')],qs[_0x6024('0x52')](_0x4a9f3d['query'][_0x6024('0x52')]));_0x1b7446[_0x6024('0x53')]=_0x1b7446[_0x6024('0x53')][_0x6024('0x54')]?_0x1b7446[_0x6024('0x53')]:_0x1ca6c3[_0x6024('0x4e')];if(!_0x4a9f3d[_0x6024('0x50')]['hasOwnProperty'](_0x6024('0x56'))){_0x1b7446[_0x6024('0x22')]=qs['limit'](_0x4a9f3d[_0x6024('0x50')][_0x6024('0x22')]);_0x1b7446['offset']=qs[_0x6024('0x1f')](_0x4a9f3d[_0x6024('0x50')][_0x6024('0x1f')]);}_0x1b7446['order']=qs[_0x6024('0x58')](_0x4a9f3d[_0x6024('0x50')]['sort']);_0x1b7446[_0x6024('0x5b')]=qs['filters'](_['pick'](_0x4a9f3d[_0x6024('0x50')],_0x1ca6c3[_0x6024('0x59')]));_0x1b7446['where'][_0x6024('0x6c')]=_0x40d30a['id'];if(_0x4a9f3d[_0x6024('0x50')][_0x6024('0x5d')]){_0x1b7446[_0x6024('0x5b')]=_['merge'](_0x1b7446[_0x6024('0x5b')],{'$or':_[_0x6024('0x49')](_0x1b7446[_0x6024('0x53')],function(_0x24e2a4){var _0x8eb71d={};_0x8eb71d[_0x24e2a4]={'$like':'%'+_0x4a9f3d[_0x6024('0x50')][_0x6024('0x5d')]+'%'};return _0x8eb71d;})});}if(_0x4a9f3d[_0x6024('0x50')]['$gte']){var _0x397d06=_0x4a9f3d[_0x6024('0x50')]['$gte']['split'](',');var _0x400186={};_0x400186[_0x397d06[0x0]]={'$gte':moment(_0x397d06[0x1])[_0x6024('0x9e')](_0x6024('0x9f'))};_0x1b7446['where']=_[_0x6024('0x5c')](_0x1b7446[_0x6024('0x5b')],_0x400186);}_0x1b7446=_[_0x6024('0x5c')]({},_0x1b7446,_0x4a9f3d[_0x6024('0x5e')]);return db[_0x6024('0xa0')][_0x6024('0x21')]({'where':_0x1b7446[_0x6024('0x5b')]})[_0x6024('0x13')](function(_0xc0ccdd){_0x1372a1[_0x6024('0x21')]=_0xc0ccdd;if(_0x4a9f3d[_0x6024('0x50')][_0x6024('0x60')]){_0x1b7446['include']=[{'all':!![]}];}return db[_0x6024('0xa0')][_0x6024('0x71')](_0x1b7446);})['then'](function(_0x2c36f4){if(_0x4a9f3d[_0x6024('0x50')][_0x6024('0xa1')]==='true'){for(var _0x5f08c7=0x0;_0x5f08c7<_0x2c36f4['length'];_0x5f08c7++){_0x2c36f4[_0x5f08c7][_0x6024('0x68')]=juice(_0x2c36f4[_0x5f08c7]['body']);}}_0x1372a1[_0x6024('0x61')]=_0x2c36f4;return _0x1372a1;});}})[_0x6024('0x13')](respondWithFilteredResult(_0x25a8d5,_0x1b7446))[_0x6024('0x1c')](handleError(_0x25a8d5,null));};exports[_0x6024('0x2d')]=function(_0x42d546,_0x5c955e){var _0xa7019f,_0x422d77={},_0x21c921;if(_0x42d546[_0x6024('0x68')]['to']){_0x21c921=_0x42d546[_0x6024('0x68')]['to'][_0x6024('0xa2')](',')[0x0];}return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x42d546[_0x6024('0x63')]['id']},'include':[{'model':db[_0x6024('0xa3')],'as':'List','include':[{'model':db[_0x6024('0x8d')],'as':_0x6024('0xa4'),'where':{'email':_0x21c921},'limit':0x1,'order':[[_0x6024('0xa5'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x6024('0xa6')],'as':_0x6024('0xa6'),'raw':!![]}]}]})[_0x6024('0x13')](handleEntityNotFound(_0x5c955e,null))[_0x6024('0x13')](function(_0x47f3cb){if(!_0x47f3cb)return;_0xa7019f=_0x47f3cb;if(!_0x47f3cb['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x6024('0x7b')](_0x42d546[_0x6024('0x68')][_0x6024('0xa7')])){_0x42d546[_0x6024('0x68')]['from']=util[_0x6024('0x9e')](_0x6024('0xa8'),_0x47f3cb[_0x6024('0x2c')],_0x47f3cb[_0x6024('0x79')]||_0x47f3cb[_0x6024('0x45')][_0x6024('0x3a')]);}if(_0x42d546['body']['attachments']&&_0x42d546[_0x6024('0x68')][_0x6024('0xa9')][_0x6024('0x54')]){for(var _0x896a0b=0x0;_0x896a0b<_0x42d546[_0x6024('0x68')][_0x6024('0xa9')][_0x6024('0x54')];_0x896a0b+=0x1){_0x42d546[_0x6024('0x68')][_0x6024('0xa9')][_0x896a0b]={'filename':_0x42d546[_0x6024('0x68')]['attachments'][_0x896a0b][_0x6024('0x2c')],'path':path[_0x6024('0xaa')](config['root'],'server/files/attachments',_0x42d546[_0x6024('0x68')][_0x6024('0xa9')][_0x896a0b][_0x6024('0xab')])};}}var _0x5c728f=_0x47f3cb[_0x6024('0xac')]();return respondWithRpcPromise(_0x6024('0xad'),_0x6024('0xae'),{'account':_0x5c728f,'message':_0x42d546[_0x6024('0x68')]});})['then'](function(_0x38f3f7){if(!_0x38f3f7)return;_0x422d77=_0x38f3f7;if(!_0xa7019f[_0x6024('0xaf')])throw new Error('List\x20not\x20found');if(_0xa7019f[_0x6024('0xaf')]['Contacts'][_0x6024('0x54')])return _0xa7019f[_0x6024('0xaf')][_0x6024('0xa4')][0x0];return db[_0x6024('0x8d')][_0x6024('0x6d')](_[_0x6024('0xc')](_0x42d546[_0x6024('0x68')],{'firstName':_0x42d546[_0x6024('0x68')]['to'],'email':_0x42d546['body']['to'],'phone':_0x42d546[_0x6024('0x68')]['to'],'ListId':_0xa7019f[_0x6024('0x7a')]}));})[_0x6024('0x13')](function(_0x206b93){if(!_0x206b93)return;var _0x25af35={'UserId':_0x42d546[_0x6024('0x3a')]['id'],'ContactId':_0x206b93['id'],'MailAccountId':_0xa7019f['id'],'inReplyTo':_0x422d77[_0x6024('0xb0')],'to':_0x42d546[_0x6024('0x68')][_0x6024('0xa7')],'cc':_0x42d546[_0x6024('0x68')]['cc'],'subject':_0x42d546[_0x6024('0x68')][_0x6024('0xb1')],'attach':_0x42d546['body'][_0x6024('0xb2')],'firstMsgDirection':_0x6024('0xb3'),'lastMsgAt':moment()[_0x6024('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x6024('0xb3'),'Messages':[_[_0x6024('0x5c')](_0x42d546[_0x6024('0x68')],{'messageId':_0x422d77[_0x6024('0xb0')],'sentAt':moment()['format'](_0x6024('0x9f')),'read':!![],'MailAccountId':_0xa7019f['id'],'UserId':_0x42d546[_0x6024('0x3a')]['id'],'ContactId':_0x206b93['id']})]};if(_0x42d546[_0x6024('0x68')][_0x6024('0xb4')]){_0x25af35=_[_0x6024('0x5c')](_0x25af35,_0x42d546[_0x6024('0x68')][_0x6024('0xb4')]);}return db[_0x6024('0x8a')]['create'](_0x25af35,{'include':[{'model':db[_0x6024('0xa0')],'as':_0x6024('0xb5')}]});})[_0x6024('0x13')](respondWithResult(_0x5c955e,null))['catch'](handleError(_0x5c955e,null));};exports[_0x6024('0xb6')]=function(_0x390b6b,_0x2fd639){return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x390b6b['params']['id']},'include':[{'model':db[_0x6024('0x48')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x6024('0xa6')],'as':'CloudProvider','raw':!![]}]}]})[_0x6024('0x13')](handleEntityNotFound(_0x2fd639,null))[_0x6024('0x13')](function(_0x571fcb){if(!_0x571fcb[_0x6024('0x45')])return;var _0x1696fb=_0x571fcb[_0x6024('0xac')]();return respondWithRpcPromise(_0x6024('0xb7'),_0x6024('0xb6'),{'account':_0x1696fb});})[_0x6024('0x13')](respondWithResult(_0x2fd639,null))[_0x6024('0x1c')](handleError(_0x2fd639,null));};exports[_0x6024('0x27')]=function(_0x1a19bb,_0x26b68b){return db['MailAccount']['find']({'where':{'id':_0x1a19bb[_0x6024('0x63')]['id']}})['then'](handleEntityNotFound(_0x26b68b,null))[_0x6024('0x13')](function(_0x2fee83){if(_0x2fee83&&_0x2fee83[_0x6024('0x42')]){throw new db[(_0x6024('0xb8'))][(_0x6024('0xb9'))](_0x6024('0xba'));}return _0x2fee83;})['then'](removeEntity(_0x26b68b,null))[_0x6024('0x1c')](handleError(_0x26b68b,null));};exports[_0x6024('0xbb')]=function(_0x36f1f9,_0x1bb81e){return db[_0x6024('0x5f')][_0x6024('0x67')]({'where':{'id':_0x36f1f9[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x1bb81e,null))[_0x6024('0x13')](function(_0x7b061b){if(_0x7b061b){return _0x7b061b[_0x6024('0xbb')](_0x36f1f9[_0x6024('0x68')]['ids'],_[_0x6024('0x8c')](_0x36f1f9[_0x6024('0x68')],[_0x6024('0x77'),'id'])||{})[_0x6024('0xbc')](function(_0x1d2f1f){for(var _0x418dfa=0x0;_0x418dfa<_0x36f1f9[_0x6024('0x68')]['ids'][_0x6024('0x54')];_0x418dfa+=0x1){socket[_0x6024('0xbd')](_0x6024('0xbe'),{'UserId':Number(_0x36f1f9['body']['ids'][_0x418dfa]),'MailAccountId':Number(_0x36f1f9[_0x6024('0x63')]['id'])});}return _0x1d2f1f;});}})[_0x6024('0x13')](respondWithResult(_0x1bb81e,null))[_0x6024('0x1c')](handleError(_0x1bb81e,null));};exports[_0x6024('0xbf')]=function(_0x3081d6,_0x3268f1){return db[_0x6024('0x5f')]['find']({'where':{'id':_0x3081d6['params']['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x3268f1,null))[_0x6024('0x13')](function(_0x103d74){if(_0x103d74){return _0x103d74[_0x6024('0xbf')](_0x3081d6[_0x6024('0x50')][_0x6024('0x77')])[_0x6024('0x13')](function(){if(_['isArray'](_0x3081d6[_0x6024('0x50')][_0x6024('0x77')])){for(var _0x5c15d6=0x0;_0x5c15d6<_0x3081d6['query'][_0x6024('0x77')][_0x6024('0x54')];_0x5c15d6+=0x1){socket[_0x6024('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x3081d6['query'][_0x6024('0x77')][_0x5c15d6]),'MailAccountId':Number(_0x3081d6[_0x6024('0x63')]['id'])});}}else{socket['emit'](_0x6024('0xc0'),{'UserId':Number(_0x3081d6[_0x6024('0x50')][_0x6024('0x77')]),'MailAccountId':Number(_0x3081d6['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3268f1,null))['catch'](handleError(_0x3268f1,null));};exports['getAgents']=function(_0x1ea0a6,_0x3bab46){var _0x1962ab={};var _0x4cff87={};var _0xa011de;var _0x6c846f;return db[_0x6024('0x5f')]['findOne']({'where':{'id':_0x1ea0a6[_0x6024('0x63')]['id']}})[_0x6024('0x13')](handleEntityNotFound(_0x3bab46,null))[_0x6024('0x13')](function(_0x2c9848){if(_0x2c9848){_0xa011de=_0x2c9848;_0x4cff87[_0x6024('0x4e')]=_[_0x6024('0x4f')](db[_0x6024('0x8f')][_0x6024('0x4a')]);_0x4cff87[_0x6024('0x50')]=_[_0x6024('0x4f')](_0x1ea0a6[_0x6024('0x50')]);_0x4cff87[_0x6024('0x59')]=_[_0x6024('0x51')](_0x4cff87['model'],_0x4cff87['query']);_0x1962ab[_0x6024('0x53')]=_[_0x6024('0x51')](_0x4cff87[_0x6024('0x4e')],qs['fields'](_0x1ea0a6[_0x6024('0x50')][_0x6024('0x52')]));_0x1962ab[_0x6024('0x53')]=_0x1962ab['attributes'][_0x6024('0x54')]?_0x1962ab['attributes']:_0x4cff87[_0x6024('0x4e')];_0x1962ab[_0x6024('0x57')]=qs['sort'](_0x1ea0a6[_0x6024('0x50')]['sort']);_0x1962ab[_0x6024('0x5b')]=qs[_0x6024('0x59')](_['pick'](_0x1ea0a6[_0x6024('0x50')],_0x4cff87[_0x6024('0x59')]));if(_0x1ea0a6['query'][_0x6024('0x5d')]){_0x1962ab[_0x6024('0x5b')]=_[_0x6024('0x5c')](_0x1962ab['where'],{'$or':_[_0x6024('0x49')](_0x1962ab[_0x6024('0x53')],function(_0x239c1e){var _0x1a8c30={};_0x1a8c30[_0x239c1e]={'$like':'%'+_0x1ea0a6[_0x6024('0x50')][_0x6024('0x5d')]+'%'};return _0x1a8c30;})});}_0x1962ab=_[_0x6024('0x5c')]({},_0x1962ab,_0x1ea0a6[_0x6024('0x5e')]);return _0xa011de['getAgents'](_0x1962ab);}})['then'](function(_0x47eb0f){if(_0x47eb0f){_0x6c846f=_0x47eb0f[_0x6024('0x54')];if(!_0x1ea0a6['query'][_0x6024('0x55')](_0x6024('0x56'))){_0x1962ab[_0x6024('0x22')]=qs[_0x6024('0x22')](_0x1ea0a6[_0x6024('0x50')][_0x6024('0x22')]);_0x1962ab[_0x6024('0x1f')]=qs[_0x6024('0x1f')](_0x1ea0a6[_0x6024('0x50')][_0x6024('0x1f')]);}return _0xa011de[_0x6024('0xc1')](_0x1962ab);}})[_0x6024('0x13')](function(_0x529f3c){if(_0x529f3c){return _0x529f3c?{'count':_0x6c846f,'rows':_0x529f3c}:null;}})[_0x6024('0x13')](respondWithResult(_0x3bab46,null))[_0x6024('0x1c')](handleError(_0x3bab46,null));}; \ No newline at end of file +var _0xe922=['%s\x20<%s>','attachments','join','root','basename','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','then','UserProfileResource','destroy','name','send','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','filter','options','where','includeAll','include','findAll','rows','show','params','MailServerIn','Pause','keys','find','update','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','CannedAnswer','create','pick','removeAnswers','ids','email','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','bulkCreate','MailApplication','priority','stack','json','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from'];(function(_0x2b36fa,_0x4529c8){var _0x38e913=function(_0x4949a8){while(--_0x4949a8){_0x2b36fa['push'](_0x2b36fa['shift']());}};_0x38e913(++_0x4529c8);}(_0xe922,0x1a7));var _0x2e92=function(_0x5c3fac,_0x5f0267){_0x5c3fac=_0x5c3fac-0x0;var _0x382099=_0xe922[_0x5c3fac];return _0x382099;};'use strict';var moment=require(_0x2e92('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x2e92('0x1'));var _=require(_0x2e92('0x2'));var juice=require(_0x2e92('0x3'));var Redis=require('ioredis');var qs=require(_0x2e92('0x4'));var logger=require(_0x2e92('0x5'))(_0x2e92('0x6'));var config=require('../../config/environment');var db=require(_0x2e92('0x7'))['db'];config[_0x2e92('0x8')]=_['defaults'](config[_0x2e92('0x8')],{'host':_0x2e92('0x9'),'port':0x18eb});var socket=require(_0x2e92('0xa'))(new Redis(config[_0x2e92('0x8')]));require(_0x2e92('0xb'))[_0x2e92('0xc')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2e92('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x521f6d,_0x274f26,_0x1636a3,_0x5ed359){return new BPromise(function(_0x122700,_0x4382d1){var _0x245ba6=_0x5ed359||client;return _0x245ba6[_0x2e92('0xe')](_0x521f6d,_0x1636a3)['then'](function(_0x12f6ff){logger[_0x2e92('0xf')](_0x2e92('0x10'),_0x274f26,_0x2e92('0x11'));logger[_0x2e92('0x12')](_0x2e92('0x13'),_0x274f26,_0x2e92('0x11'),JSON['stringify'](_0x12f6ff));if(_0x12f6ff['error']){if(_0x12f6ff[_0x2e92('0x14')][_0x2e92('0x15')]===0x1f4){logger[_0x2e92('0x14')](_0x2e92('0x10'),_0x274f26,_0x12f6ff[_0x2e92('0x14')][_0x2e92('0x16')]);return _0x4382d1(_0x12f6ff['error']['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x274f26,_0x12f6ff[_0x2e92('0x14')][_0x2e92('0x16')]);return _0x122700(_0x12f6ff['error'][_0x2e92('0x16')]);}else{logger[_0x2e92('0xf')]('MailAccount,\x20%s,\x20%s',_0x274f26,_0x2e92('0x11'));_0x122700(_0x12f6ff[_0x2e92('0x17')]['message']);}})[_0x2e92('0x18')](function(_0x5db671){logger[_0x2e92('0x14')](_0x2e92('0x10'),_0x274f26,_0x5db671);_0x4382d1(_0x5db671);});});}function respondWithStatusCode(_0x36c9c1,_0x393a7d){_0x393a7d=_0x393a7d||0xcc;return function(_0xa37b9a){if(_0xa37b9a){return _0x36c9c1[_0x2e92('0x19')](_0x393a7d);}return _0x36c9c1[_0x2e92('0x1a')](_0x393a7d)[_0x2e92('0x1b')]();};}function respondWithResult(_0x22413d,_0x2b683d){_0x2b683d=_0x2b683d||0xc8;return function(_0x2c9e99){if(_0x2c9e99){return _0x22413d[_0x2e92('0x1a')](_0x2b683d)['json'](_0x2c9e99);}};}function respondWithFilteredResult(_0x9bc073,_0x84c250){return function(_0xc6f8d){if(_0xc6f8d){var _0x1d1082=typeof _0x84c250[_0x2e92('0x1c')]===_0x2e92('0x1d')&&typeof _0x84c250[_0x2e92('0x1e')]===_0x2e92('0x1d');var _0x12a08c=_0xc6f8d[_0x2e92('0x1f')];var _0xd2e650=_0x1d1082?0x0:_0x84c250['offset'];var _0x4ec558=_0x1d1082?_0xc6f8d['count']:_0x84c250[_0x2e92('0x1c')]+_0x84c250[_0x2e92('0x1e')];var _0xe31115;if(_0x4ec558>=_0x12a08c){_0x4ec558=_0x12a08c;_0xe31115=0xc8;}else{_0xe31115=0xce;}_0x9bc073[_0x2e92('0x1a')](_0xe31115);return _0x9bc073[_0x2e92('0x20')](_0x2e92('0x21'),_0xd2e650+'-'+_0x4ec558+'/'+_0x12a08c)['json'](_0xc6f8d);}return null;};}function saveUpdates(_0x4aac32){return function(_0xe309fa){if(_0xe309fa){return _0xe309fa['update'](_0x4aac32)[_0x2e92('0x22')](function(_0x576195){return _0x576195;});}return null;};}function removeEntity(_0x470926){return function(_0x4cb8d5){if(_0x4cb8d5){return _0x4cb8d5['destroy']()[_0x2e92('0x22')](function(){var _0x134195=_0x4cb8d5['get']({'plain':!![]});var _0x19c725='MailAccounts';return db[_0x2e92('0x23')][_0x2e92('0x24')]({'where':{'type':_0x19c725,'resourceId':_0x134195['id']}})[_0x2e92('0x22')](function(){return _0x4cb8d5;});})['then'](function(){_0x470926[_0x2e92('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x284ee0){return function(_0x38b82f){if(!_0x38b82f){_0x284ee0[_0x2e92('0x19')](0x194);}return _0x38b82f;};}function handleError(_0x5b3e24,_0x33d4d2){_0x33d4d2=_0x33d4d2||0x1f4;return function(_0x18980b){logger[_0x2e92('0x14')](_0x18980b['stack']);if(_0x18980b[_0x2e92('0x25')]){delete _0x18980b[_0x2e92('0x25')];}_0x5b3e24[_0x2e92('0x1a')](_0x33d4d2)[_0x2e92('0x26')](_0x18980b);};}function getImapHost(_0x3293be){switch(_0x3293be){case'gmail':return _0x2e92('0x27');case _0x2e92('0x28'):return'imap.mail.yahoo.com';case _0x2e92('0x29'):return _0x2e92('0x2a');case _0x2e92('0x2b'):return _0x2e92('0x2c');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3293be);}function getSmtpHost(_0x33c198){switch(_0x33c198){case _0x2e92('0x2d'):return _0x2e92('0x2e');case _0x2e92('0x28'):return _0x2e92('0x2f');case _0x2e92('0x29'):return _0x2e92('0x30');case _0x2e92('0x2b'):return _0x2e92('0x31');}throw new Error(_0x2e92('0x32'),_0x33c198);}function getAuthenticationOptions(_0x2da672,_0x42fb40){var _0x84e774={};var _0x14c77c={};if(_0x2da672){_0x84e774['user']=_0x14c77c[_0x2e92('0x33')]=_0x42fb40[_0x2e92('0x34')];_0x84e774['password']=_0x14c77c[_0x2e92('0x35')]=_0x42fb40['password'];if(_0x42fb40[_0x2e92('0x36')]){_0x84e774[_0x2e92('0x36')]=_0x14c77c[_0x2e92('0x36')]=!![];_0x84e774[_0x2e92('0x37')]=_0x14c77c[_0x2e92('0x37')]=_0x42fb40['CloudProviderId'];_0x84e774[_0x2e92('0x38')]=_0x14c77c[_0x2e92('0x35')]=null;}else{_0x84e774[_0x2e92('0x37')]=_0x14c77c[_0x2e92('0x37')]=null;}_0x84e774[_0x2e92('0x39')]=getImapHost(_0x2da672);_0x84e774['port']=0x3e1;_0x14c77c[_0x2e92('0x39')]=getSmtpHost(_0x2da672);_0x14c77c[_0x2e92('0x3a')]=0x24b;_0x14c77c[_0x2e92('0x3b')]=![];_0x84e774['service']=_0x14c77c[_0x2e92('0x3c')]=null;}else{if(_0x42fb40['authentication']){_0x84e774[_0x2e92('0x33')]=_0x14c77c[_0x2e92('0x33')]=_0x42fb40['username'];_0x84e774[_0x2e92('0x38')]=_0x14c77c[_0x2e92('0x35')]=_0x42fb40['password'];}else{_0x84e774[_0x2e92('0x3d')]=_0x14c77c[_0x2e92('0x3d')]=![];_0x84e774[_0x2e92('0x33')]=_0x14c77c[_0x2e92('0x33')]=null;_0x84e774[_0x2e92('0x38')]=_0x14c77c[_0x2e92('0x35')]=null;}_0x84e774[_0x2e92('0x39')]=_0x42fb40[_0x2e92('0x3e')][_0x2e92('0x39')];_0x84e774['port']=_0x42fb40[_0x2e92('0x3e')]['port'];_0x14c77c['host']=_0x42fb40[_0x2e92('0x3f')][_0x2e92('0x39')];_0x14c77c[_0x2e92('0x3a')]=_0x42fb40[_0x2e92('0x3f')][_0x2e92('0x3a')];}return{'Imap':_0x84e774,'Smtp':_0x14c77c};}exports[_0x2e92('0x40')]=function(_0x4f739c,_0x39e320){var _0x4501b0={'include':[{'model':db['MailServerIn'],'as':_0x2e92('0x3e')},{'model':db[_0x2e92('0x41')],'as':_0x2e92('0x3f')},{'model':db['Pause'],'as':_0x2e92('0x42')}]},_0x35d730={},_0x1e4ab7={'count':0x0,'rows':[]};var _0x27585b=_['map'](db[_0x2e92('0x43')][_0x2e92('0x44')],function(_0x44ae1f){return{'name':_0x44ae1f[_0x2e92('0x45')],'type':_0x44ae1f[_0x2e92('0x46')][_0x2e92('0x47')]};});_0x35d730[_0x2e92('0x48')]=_[_0x2e92('0x49')](_0x27585b,_0x2e92('0x25'));_0x35d730[_0x2e92('0x4a')]=_['keys'](_0x4f739c[_0x2e92('0x4a')]);_0x35d730[_0x2e92('0x4b')]=_[_0x2e92('0x4c')](_0x35d730[_0x2e92('0x48')],_0x35d730['query']);_0x4501b0['attributes']=_[_0x2e92('0x4c')](_0x35d730[_0x2e92('0x48')],qs[_0x2e92('0x4d')](_0x4f739c[_0x2e92('0x4a')][_0x2e92('0x4d')]));_0x4501b0[_0x2e92('0x4e')]=_0x4501b0['attributes'][_0x2e92('0x4f')]?_0x4501b0[_0x2e92('0x4e')]:_0x35d730[_0x2e92('0x48')];if(!_0x4f739c[_0x2e92('0x4a')][_0x2e92('0x50')](_0x2e92('0x51'))){_0x4501b0['limit']=qs[_0x2e92('0x1e')](_0x4f739c[_0x2e92('0x4a')][_0x2e92('0x1e')]);_0x4501b0[_0x2e92('0x1c')]=qs[_0x2e92('0x1c')](_0x4f739c[_0x2e92('0x4a')]['offset']);}_0x4501b0[_0x2e92('0x52')]=qs['sort'](_0x4f739c[_0x2e92('0x4a')][_0x2e92('0x53')]);_0x4501b0['where']=qs[_0x2e92('0x4b')](_['pick'](_0x4f739c[_0x2e92('0x4a')],_0x35d730[_0x2e92('0x4b')]),_0x27585b);if(_0x4f739c[_0x2e92('0x4a')]['filter']){_0x4501b0['where']=_[_0x2e92('0x54')](_0x4501b0['where'],{'$or':_[_0x2e92('0x49')](_0x27585b,function(_0x46ca2c){if(_0x46ca2c['type']!=='VIRTUAL'){var _0x10de16={};_0x10de16[_0x46ca2c[_0x2e92('0x25')]]={'$like':'%'+_0x4f739c[_0x2e92('0x4a')][_0x2e92('0x55')]+'%'};return _0x10de16;}})});}_0x4501b0=_[_0x2e92('0x54')]({},_0x4501b0,_0x4f739c[_0x2e92('0x56')]);var _0x2cab72={'where':_0x4501b0[_0x2e92('0x57')]};return db[_0x2e92('0x43')][_0x2e92('0x1f')](_0x2cab72)[_0x2e92('0x22')](function(_0x16479d){_0x1e4ab7[_0x2e92('0x1f')]=_0x16479d;if(_0x4f739c[_0x2e92('0x4a')][_0x2e92('0x58')]){_0x4501b0[_0x2e92('0x59')]=[{'all':!![]}];}return db[_0x2e92('0x43')][_0x2e92('0x5a')](_0x4501b0);})[_0x2e92('0x22')](function(_0x16306d){_0x1e4ab7[_0x2e92('0x5b')]=_0x16306d;return _0x1e4ab7;})[_0x2e92('0x22')](respondWithFilteredResult(_0x39e320,_0x4501b0))['catch'](handleError(_0x39e320,null));};exports[_0x2e92('0x5c')]=function(_0x2d7434,_0x3f6b48){var _0x2871f8={'raw':![],'where':{'id':_0x2d7434[_0x2e92('0x5d')]['id']},'include':[{'model':db[_0x2e92('0x5e')],'as':_0x2e92('0x3e')},{'model':db[_0x2e92('0x41')],'as':_0x2e92('0x3f')},{'model':db[_0x2e92('0x5f')],'as':_0x2e92('0x42')}]},_0x591dfc={};_0x591dfc['model']=_[_0x2e92('0x60')](db[_0x2e92('0x43')][_0x2e92('0x44')]);_0x591dfc[_0x2e92('0x4a')]=_[_0x2e92('0x60')](_0x2d7434['query']);_0x591dfc[_0x2e92('0x4b')]=_[_0x2e92('0x4c')](_0x591dfc[_0x2e92('0x48')],_0x591dfc[_0x2e92('0x4a')]);_0x2871f8[_0x2e92('0x4e')]=_[_0x2e92('0x4c')](_0x591dfc[_0x2e92('0x48')],qs[_0x2e92('0x4d')](_0x2d7434[_0x2e92('0x4a')][_0x2e92('0x4d')]));_0x2871f8[_0x2e92('0x4e')]=_0x2871f8[_0x2e92('0x4e')][_0x2e92('0x4f')]?_0x2871f8[_0x2e92('0x4e')]:_0x591dfc[_0x2e92('0x48')];if(_0x2d7434[_0x2e92('0x4a')][_0x2e92('0x58')]){_0x2871f8[_0x2e92('0x59')]=[{'all':!![]}];}_0x2871f8=_[_0x2e92('0x54')]({},_0x2871f8,_0x2d7434['options']);return db[_0x2e92('0x43')][_0x2e92('0x61')](_0x2871f8)[_0x2e92('0x22')](handleEntityNotFound(_0x3f6b48,null))[_0x2e92('0x22')](respondWithResult(_0x3f6b48,null))[_0x2e92('0x18')](handleError(_0x3f6b48,null));};exports[_0x2e92('0x62')]=function(_0x5d7ce8,_0xc340a1){if(_0x5d7ce8[_0x2e92('0x63')]['id']){delete _0x5d7ce8['body']['id'];}var _0x1b9584=_0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x64')]===_0x2e92('0x65')?null:_0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x64')];var _0x654687=_0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x3e')]||{};var _0x1f829e=_0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x3f')]||{};if(_0x1b9584){_0x654687[_0x2e92('0x39')]=getImapHost(_0x1b9584);_0x654687[_0x2e92('0x3a')]=0x3e1;_0x1f829e['host']=getSmtpHost(_0x1b9584);_0x1f829e['port']=0x24b;_0x1f829e[_0x2e92('0x3b')]=![];}if(_0x1f829e[_0x2e92('0x36')]){_0x1f829e[_0x2e92('0x3b')]=![];}else{_0x1f829e[_0x2e92('0x37')]=null;}if(!_0x654687[_0x2e92('0x36')])_0x654687[_0x2e92('0x37')]=null;_0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x3e')]=_0x654687;_0x5d7ce8['body'][_0x2e92('0x3f')]=_0x1f829e;return db[_0x2e92('0x43')][_0x2e92('0x61')]({'where':{'id':_0x5d7ce8['params']['id']},'include':[{'model':db[_0x2e92('0x5e')],'as':_0x2e92('0x3e')},{'model':db[_0x2e92('0x41')],'as':_0x2e92('0x3f')},{'model':db[_0x2e92('0x5f')],'as':_0x2e92('0x42')}]})['then'](handleEntityNotFound(_0xc340a1,null))[_0x2e92('0x22')](function(_0x629756){if(!_0x629756)throw new Error(_0x2e92('0x66'));if(_0x629756[_0x2e92('0x3c')])delete _0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x3e')];return _0x629756;})['then'](saveUpdates(_0x5d7ce8[_0x2e92('0x63')],null))[_0x2e92('0x22')](function(_0x3a08fc){if(!_0x5d7ce8['body'][_0x2e92('0x3e')])return _0x3a08fc;return db[_0x2e92('0x5e')][_0x2e92('0x62')](_0x5d7ce8[_0x2e92('0x63')]['Imap'],{'where':{'MailAccountId':_0x3a08fc['id']}})[_0x2e92('0x22')](function(){return _0x3a08fc;});})[_0x2e92('0x22')](function(_0x26557b){if(!_0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x3f')])return _0x26557b;return db[_0x2e92('0x41')][_0x2e92('0x62')](_0x5d7ce8[_0x2e92('0x63')][_0x2e92('0x3f')],{'where':{'MailAccountId':_0x26557b['id']}})[_0x2e92('0x22')](function(){return _0x26557b;});})['then'](respondWithResult(_0xc340a1,null))[_0x2e92('0x18')](handleError(_0xc340a1,null));};exports['describe']=function(_0x5d0318,_0x2e527f){return db[_0x2e92('0x43')][_0x2e92('0x67')]()['then'](respondWithResult(_0x2e527f,null))['catch'](handleError(_0x2e527f,null));};exports[_0x2e92('0x68')]=function(_0x42e597,_0x1ac12b){if(_0x42e597[_0x2e92('0x63')]['id']){delete _0x42e597[_0x2e92('0x63')]['id'];}return db[_0x2e92('0x43')][_0x2e92('0x61')]({'where':{'id':_0x42e597[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x1ac12b,null))['then'](function(_0x4b0579){if(_0x4b0579){_0x42e597[_0x2e92('0x63')][_0x2e92('0x69')]=_0x4b0579['id'];return db[_0x2e92('0x6a')]['create'](_0x42e597[_0x2e92('0x63')]);}})['then'](respondWithResult(_0x1ac12b,null))[_0x2e92('0x18')](handleError(_0x1ac12b,null));};exports[_0x2e92('0x6b')]=function(_0x573a8c,_0x252feb){var _0x4875bf={'raw':![],'where':{}};var _0xeea7b1={};var _0x5b6302={'count':0x0,'rows':[]};return db['MailAccount'][_0x2e92('0x6c')]({'where':{'id':_0x573a8c[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x252feb,null))[_0x2e92('0x22')](function(_0x5c8bd7){if(_0x5c8bd7){_0xeea7b1[_0x2e92('0x48')]=_[_0x2e92('0x60')](db[_0x2e92('0x6a')][_0x2e92('0x44')]);_0xeea7b1[_0x2e92('0x4a')]=_[_0x2e92('0x60')](_0x573a8c[_0x2e92('0x4a')]);_0xeea7b1[_0x2e92('0x4b')]=_['intersection'](_0xeea7b1[_0x2e92('0x48')],_0xeea7b1['query']);_0x4875bf['attributes']=_[_0x2e92('0x4c')](_0xeea7b1[_0x2e92('0x48')],qs['fields'](_0x573a8c[_0x2e92('0x4a')][_0x2e92('0x4d')]));_0x4875bf[_0x2e92('0x4e')]=_0x4875bf[_0x2e92('0x4e')][_0x2e92('0x4f')]?_0x4875bf[_0x2e92('0x4e')]:_0xeea7b1[_0x2e92('0x48')];if(!_0x573a8c[_0x2e92('0x4a')][_0x2e92('0x50')](_0x2e92('0x51'))){_0x4875bf[_0x2e92('0x1e')]=qs['limit'](_0x573a8c[_0x2e92('0x4a')][_0x2e92('0x1e')]);_0x4875bf[_0x2e92('0x1c')]=qs[_0x2e92('0x1c')](_0x573a8c[_0x2e92('0x4a')][_0x2e92('0x1c')]);}_0x4875bf[_0x2e92('0x52')]=qs[_0x2e92('0x53')](_0x573a8c['query'][_0x2e92('0x53')]);_0x4875bf[_0x2e92('0x57')]=qs['filters'](_['pick'](_0x573a8c[_0x2e92('0x4a')],_0xeea7b1['filters']));_0x4875bf['where']['MailAccountId']=_0x5c8bd7['id'];if(_0x573a8c[_0x2e92('0x4a')][_0x2e92('0x55')]){_0x4875bf[_0x2e92('0x57')]=_[_0x2e92('0x54')](_0x4875bf['where'],{'$or':_['map'](_0x4875bf['attributes'],function(_0x5339d7){var _0x1e04c2={};_0x1e04c2[_0x5339d7]={'$like':'%'+_0x573a8c[_0x2e92('0x4a')][_0x2e92('0x55')]+'%'};return _0x1e04c2;})});}_0x4875bf=_['merge']({},_0x4875bf,_0x573a8c[_0x2e92('0x56')]);return db[_0x2e92('0x6a')]['count']({'where':_0x4875bf[_0x2e92('0x57')]})['then'](function(_0x20b5c6){_0x5b6302[_0x2e92('0x1f')]=_0x20b5c6;if(_0x573a8c[_0x2e92('0x4a')]['includeAll']){_0x4875bf[_0x2e92('0x59')]=[{'all':!![]}];}return db[_0x2e92('0x6a')]['findAll'](_0x4875bf);})[_0x2e92('0x22')](function(_0x34895d){_0x5b6302[_0x2e92('0x5b')]=_0x34895d;return _0x5b6302;});}})['then'](respondWithFilteredResult(_0x252feb,_0x4875bf))[_0x2e92('0x18')](handleError(_0x252feb,null));};exports['removeDispositions']=function(_0x56ff10,_0x1a420d){return db['MailAccount']['find']({'where':{'id':_0x56ff10[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x1a420d,null))[_0x2e92('0x22')](function(_0x34b7be){if(_0x34b7be){return _0x34b7be['removeDispositions'](_0x56ff10[_0x2e92('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x1a420d,null))['catch'](handleError(_0x1a420d,null));};exports['addAnswer']=function(_0x395393,_0xa2061e){if(_0x395393[_0x2e92('0x63')]['id']){delete _0x395393['body']['id'];}return db[_0x2e92('0x43')][_0x2e92('0x61')]({'where':{'id':_0x395393[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0xa2061e,null))[_0x2e92('0x22')](function(_0x112f8a){if(_0x112f8a){_0x395393[_0x2e92('0x63')][_0x2e92('0x69')]=_0x112f8a['id'];return db[_0x2e92('0x6d')][_0x2e92('0x6e')](_0x395393[_0x2e92('0x63')]);}})[_0x2e92('0x22')](respondWithResult(_0xa2061e,null))['catch'](handleError(_0xa2061e,null));};exports['getAnswers']=function(_0xde94b2,_0x5bcb8c){var _0x203f89={'raw':![],'where':{}};var _0x4327c9={};var _0x5ef599={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0xde94b2[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x5bcb8c,null))[_0x2e92('0x22')](function(_0x41f2a2){if(_0x41f2a2){_0x4327c9[_0x2e92('0x48')]=_[_0x2e92('0x60')](db['CannedAnswer'][_0x2e92('0x44')]);_0x4327c9['query']=_[_0x2e92('0x60')](_0xde94b2[_0x2e92('0x4a')]);_0x4327c9[_0x2e92('0x4b')]=_[_0x2e92('0x4c')](_0x4327c9[_0x2e92('0x48')],_0x4327c9[_0x2e92('0x4a')]);_0x203f89[_0x2e92('0x4e')]=_[_0x2e92('0x4c')](_0x4327c9[_0x2e92('0x48')],qs[_0x2e92('0x4d')](_0xde94b2[_0x2e92('0x4a')][_0x2e92('0x4d')]));_0x203f89[_0x2e92('0x4e')]=_0x203f89[_0x2e92('0x4e')][_0x2e92('0x4f')]?_0x203f89[_0x2e92('0x4e')]:_0x4327c9[_0x2e92('0x48')];if(!_0xde94b2[_0x2e92('0x4a')][_0x2e92('0x50')](_0x2e92('0x51'))){_0x203f89[_0x2e92('0x1e')]=qs[_0x2e92('0x1e')](_0xde94b2[_0x2e92('0x4a')][_0x2e92('0x1e')]);_0x203f89[_0x2e92('0x1c')]=qs[_0x2e92('0x1c')](_0xde94b2[_0x2e92('0x4a')]['offset']);}_0x203f89[_0x2e92('0x52')]=qs[_0x2e92('0x53')](_0xde94b2['query'][_0x2e92('0x53')]);_0x203f89[_0x2e92('0x57')]=qs['filters'](_[_0x2e92('0x6f')](_0xde94b2[_0x2e92('0x4a')],_0x4327c9[_0x2e92('0x4b')]));_0x203f89[_0x2e92('0x57')]['MailAccountId']=_0x41f2a2['id'];if(_0xde94b2[_0x2e92('0x4a')]['filter']){_0x203f89[_0x2e92('0x57')]=_['merge'](_0x203f89[_0x2e92('0x57')],{'$or':_[_0x2e92('0x49')](_0x203f89[_0x2e92('0x4e')],function(_0x17eb42){var _0x1d5f3e={};_0x1d5f3e[_0x17eb42]={'$like':'%'+_0xde94b2[_0x2e92('0x4a')]['filter']+'%'};return _0x1d5f3e;})});}_0x203f89=_[_0x2e92('0x54')]({},_0x203f89,_0xde94b2['options']);return db[_0x2e92('0x6d')][_0x2e92('0x1f')]({'where':_0x203f89['where']})['then'](function(_0x2ac8d0){_0x5ef599['count']=_0x2ac8d0;if(_0xde94b2['query']['includeAll']){_0x203f89[_0x2e92('0x59')]=[{'all':!![]}];}return db[_0x2e92('0x6d')][_0x2e92('0x5a')](_0x203f89);})[_0x2e92('0x22')](function(_0x33071c){_0x5ef599['rows']=_0x33071c;return _0x5ef599;});}})[_0x2e92('0x22')](respondWithFilteredResult(_0x5bcb8c,_0x203f89))['catch'](handleError(_0x5bcb8c,null));};exports[_0x2e92('0x70')]=function(_0x259138,_0x24545c){return db[_0x2e92('0x43')][_0x2e92('0x61')]({'where':{'id':_0x259138['params']['id']}})['then'](handleEntityNotFound(_0x24545c,null))[_0x2e92('0x22')](function(_0x554ed5){if(_0x554ed5){return _0x554ed5[_0x2e92('0x70')](_0x259138[_0x2e92('0x4a')][_0x2e92('0x71')]);}})['then'](respondWithStatusCode(_0x24545c,null))['catch'](handleError(_0x24545c,null));};exports[_0x2e92('0x6e')]=function(_0xce2e68,_0x562f39){var _0x5569ae={'name':_0xce2e68['body'][_0x2e92('0x25')],'key':_0xce2e68['body'][_0x2e92('0x47')],'provider':_0xce2e68['body'][_0x2e92('0x64')]===_0x2e92('0x65')?null:_0xce2e68[_0x2e92('0x63')]['provider'],'email':_0xce2e68[_0x2e92('0x63')][_0x2e92('0x72')],'ListId':_0xce2e68[_0x2e92('0x63')]['ListId'],'active':!_[_0x2e92('0x73')](_0xce2e68['body'][_0x2e92('0x74')])?_0xce2e68[_0x2e92('0x63')]['active']:!![],'description':_0xce2e68[_0x2e92('0x63')][_0x2e92('0x75')]||null};var _0x1d549f=getAuthenticationOptions(_0x5569ae[_0x2e92('0x64')],_0xce2e68[_0x2e92('0x63')]);_0x5569ae[_0x2e92('0x3e')]=_0x1d549f[_0x2e92('0x3e')];_0x5569ae[_0x2e92('0x3f')]=_0x1d549f[_0x2e92('0x3f')];return db['MailAccount'][_0x2e92('0x6e')](_0x5569ae,{'include':[{'model':db[_0x2e92('0x41')],'as':_0x2e92('0x3f')},{'model':db[_0x2e92('0x5e')],'as':_0x2e92('0x3e')}]})[_0x2e92('0x22')](function(_0x345911){var _0xf73b5=_0xce2e68[_0x2e92('0x33')][_0x2e92('0x76')]({'plain':!![]});if(!_0xf73b5)throw new Error(_0x2e92('0x77'));if(_0xf73b5[_0x2e92('0x78')]===_0x2e92('0x33')){var _0x5b59f2=_0x345911['get']({'plain':!![]});return db[_0x2e92('0x79')][_0x2e92('0x61')]({'where':{'name':_0x2e92('0x7a'),'userProfileId':_0xf73b5[_0x2e92('0x7b')]},'raw':!![]})[_0x2e92('0x22')](function(_0x453ca8){if(_0x453ca8&&_0x453ca8['autoAssociation']===0x0){return db[_0x2e92('0x23')][_0x2e92('0x6e')]({'name':_0x5b59f2[_0x2e92('0x25')],'resourceId':_0x5b59f2['id'],'type':_0x453ca8[_0x2e92('0x25')],'sectionId':_0x453ca8['id']},{})['then'](function(){return _0x345911;});}else{return _0x345911;}})[_0x2e92('0x18')](function(_0x5bf56b){logger['error'](_0x2e92('0x7c'),_0x5bf56b);throw _0x5bf56b;});}return _0x345911;})[_0x2e92('0x22')](respondWithResult(_0x562f39,0xc9))[_0x2e92('0x18')](handleError(_0x562f39,null));};exports[_0x2e92('0x7d')]=function(_0x4cbccb,_0x1973a6){return db[_0x2e92('0x43')][_0x2e92('0x6c')]({'where':{'id':_0x4cbccb[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x1973a6,null))[_0x2e92('0x22')](function(_0x345236){if(_0x345236){return _0x345236['getImap']();}return null;})[_0x2e92('0x22')](respondWithResult(_0x1973a6,null))[_0x2e92('0x18')](handleError(_0x1973a6,null));};exports['addImap']=function(_0x38eaee,_0x330e67){if(_0x38eaee[_0x2e92('0x63')]['id']){delete _0x38eaee[_0x2e92('0x63')]['id'];}return db['MailAccount'][_0x2e92('0x61')]({'where':{'id':_0x38eaee[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x330e67,null))['then'](function(_0x29704e){if(_0x29704e){_0x38eaee[_0x2e92('0x63')][_0x2e92('0x69')]=_0x29704e['id'];return db['MailServerIn'][_0x2e92('0x6e')](_0x38eaee[_0x2e92('0x63')]);}})['then'](respondWithResult(_0x330e67,null))[_0x2e92('0x18')](handleError(_0x330e67,null));};exports[_0x2e92('0x7e')]=function(_0x216e7f,_0x378cb9){return db[_0x2e92('0x43')]['findOne']({'where':{'id':_0x216e7f['params']['id']}})['then'](handleEntityNotFound(_0x378cb9,null))['then'](function(_0x4a8cc7){if(_0x4a8cc7){return _0x4a8cc7[_0x2e92('0x7f')](null);}return null;})[_0x2e92('0x22')](respondWithStatusCode(_0x378cb9,null))[_0x2e92('0x18')](handleError(_0x378cb9,null));};exports[_0x2e92('0x80')]=function(_0x45ae3d,_0x4091d6){return db[_0x2e92('0x43')][_0x2e92('0x6c')]({'where':{'id':_0x45ae3d[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x4091d6,null))['then'](function(_0x10c8c1){if(_0x10c8c1){return _0x10c8c1['getSmtp']();}return null;})[_0x2e92('0x22')](respondWithResult(_0x4091d6,null))[_0x2e92('0x18')](handleError(_0x4091d6,null));};exports[_0x2e92('0x81')]=function(_0x1bf1f0,_0x562cc0){if(_0x1bf1f0['body']['id']){delete _0x1bf1f0[_0x2e92('0x63')]['id'];}return db['MailAccount'][_0x2e92('0x61')]({'where':{'id':_0x1bf1f0[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x562cc0,null))[_0x2e92('0x22')](function(_0x5efdd0){if(_0x5efdd0){_0x1bf1f0[_0x2e92('0x63')][_0x2e92('0x69')]=_0x5efdd0['id'];return db[_0x2e92('0x41')][_0x2e92('0x6e')](_0x1bf1f0[_0x2e92('0x63')]);}})[_0x2e92('0x22')](respondWithResult(_0x562cc0,null))[_0x2e92('0x18')](handleError(_0x562cc0,null));};exports[_0x2e92('0x82')]=function(_0x8c0ad9,_0x367515){return db[_0x2e92('0x43')][_0x2e92('0x6c')]({'where':{'id':_0x8c0ad9[_0x2e92('0x5d')]['id']}})['then'](handleEntityNotFound(_0x367515,null))['then'](function(_0x2078c5){if(_0x2078c5){return _0x2078c5[_0x2e92('0x83')](null);}return null;})[_0x2e92('0x22')](respondWithStatusCode(_0x367515,null))[_0x2e92('0x18')](handleError(_0x367515,null));};exports[_0x2e92('0x84')]=function(_0x57b4f8,_0x1fcc8b){return db[_0x2e92('0x85')][_0x2e92('0x61')]({'where':{'id':_0x57b4f8[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x1fcc8b,null))[_0x2e92('0x22')](function(_0x4a1296){if(_0x4a1296){return _0x4a1296['addInteraction'](_0x57b4f8[_0x2e92('0x63')][_0x2e92('0x71')],_[_0x2e92('0x86')](_0x57b4f8['body'],[_0x2e92('0x71'),'id'])||{});}})[_0x2e92('0x22')](respondWithResult(_0x1fcc8b,null))['catch'](handleError(_0x1fcc8b,null));};exports['getInteractions']=function(_0x1ff3f9,_0x53e8a0){var _0x2adef8={'raw':![],'where':{}};var _0x231139={};var _0x4eb035={'count':0x0,'rows':[]};return db[_0x2e92('0x43')][_0x2e92('0x6c')]({'where':{'id':_0x1ff3f9[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x53e8a0,null))[_0x2e92('0x22')](function(_0x46dcfd){if(_0x46dcfd){_0x231139[_0x2e92('0x48')]=_[_0x2e92('0x60')](db['MailInteraction']['rawAttributes']);_0x231139[_0x2e92('0x4a')]=_[_0x2e92('0x60')](_0x1ff3f9[_0x2e92('0x4a')]);_0x231139[_0x2e92('0x4b')]=_[_0x2e92('0x4c')](_0x231139[_0x2e92('0x48')],_0x231139[_0x2e92('0x4a')]);_0x2adef8[_0x2e92('0x4e')]=_[_0x2e92('0x4c')](_0x231139[_0x2e92('0x48')],qs[_0x2e92('0x4d')](_0x1ff3f9[_0x2e92('0x4a')]['fields']));_0x2adef8['attributes']=_0x2adef8[_0x2e92('0x4e')][_0x2e92('0x4f')]?_0x2adef8[_0x2e92('0x4e')]:_0x231139[_0x2e92('0x48')];if(!_0x1ff3f9['query'][_0x2e92('0x50')](_0x2e92('0x51'))){_0x2adef8[_0x2e92('0x1e')]=qs[_0x2e92('0x1e')](_0x1ff3f9[_0x2e92('0x4a')]['limit']);_0x2adef8[_0x2e92('0x1c')]=qs[_0x2e92('0x1c')](_0x1ff3f9[_0x2e92('0x4a')]['offset']);}_0x2adef8[_0x2e92('0x52')]=qs['sort'](_0x1ff3f9[_0x2e92('0x4a')][_0x2e92('0x53')]);_0x2adef8['where']=qs[_0x2e92('0x4b')](_[_0x2e92('0x6f')](_0x1ff3f9[_0x2e92('0x4a')],_0x231139[_0x2e92('0x4b')]));_0x2adef8['where'][_0x2e92('0x69')]=_0x46dcfd['id'];if(_0x1ff3f9[_0x2e92('0x4a')][_0x2e92('0x55')]){_0x2adef8[_0x2e92('0x57')]=_[_0x2e92('0x54')](_0x2adef8['where'],{'$or':_['map'](_0x2adef8[_0x2e92('0x4e')],function(_0x2fa7d9){var _0x13f12e={};_0x13f12e[_0x2fa7d9]={'$like':'%'+_0x1ff3f9[_0x2e92('0x4a')][_0x2e92('0x55')]+'%'};return _0x13f12e;})});}_0x2adef8=_[_0x2e92('0x54')]({},_0x2adef8,_0x1ff3f9['options']);return db['MailInteraction'][_0x2e92('0x1f')]({'where':_0x2adef8[_0x2e92('0x57')]})[_0x2e92('0x22')](function(_0x4f6d31){_0x4eb035['count']=_0x4f6d31;if(_0x1ff3f9['query'][_0x2e92('0x58')]){_0x2adef8['include']=[{'model':db[_0x2e92('0x87')],'as':_0x2e92('0x88'),'required':![]},{'model':db[_0x2e92('0x89')],'as':_0x2e92('0x8a'),'attributes':[_0x2e92('0x25'),_0x2e92('0x8b'),_0x2e92('0x8c')],'required':![]},{'model':db[_0x2e92('0x8d')],'as':_0x2e92('0x8e'),'attributes':['id',_0x2e92('0x25'),_0x2e92('0x8f')],'where':_0x1ff3f9[_0x2e92('0x4a')][_0x2e92('0x90')]?{'id':_0x1ff3f9['query']['tag']}:undefined,'required':_0x1ff3f9['query']['tag']?!![]:![]}];}return db['MailInteraction'][_0x2e92('0x5a')](_0x2adef8);})[_0x2e92('0x22')](function(_0x5cddbd){_0x4eb035['rows']=_0x5cddbd;return _0x4eb035;});}})[_0x2e92('0x22')](respondWithFilteredResult(_0x53e8a0,_0x2adef8))['catch'](handleError(_0x53e8a0,null));};exports[_0x2e92('0x91')]=function addApplications(_0x1fd593,_0x2b9865){var _0xe8eaf5=_0x1fd593[_0x2e92('0x5d')]['id'];var _0x3e7e03=_0x1fd593[_0x2e92('0x63')];var _0x36f5d2=0xc8;var _0x292d4d=null;return db[_0x2e92('0x92')][_0x2e92('0x93')]({'isolationLevel':db[_0x2e92('0x92')][_0x2e92('0x94')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x33b84f){return db['MailAccount'][_0x2e92('0x6c')]({'where':{'id':_0xe8eaf5},'transaction':_0x33b84f})[_0x2e92('0x22')](function(_0x4d6372){if(_0x4d6372){return db['MailApplication'][_0x2e92('0x24')]({'where':{'MailAccountId':_0xe8eaf5},'transaction':_0x33b84f})[_0x2e92('0x22')](function(){var _0x2ddf2c=_[_0x2e92('0x49')](_0x3e7e03,function(_0x103cb6){_0x103cb6[_0x2e92('0x69')]=_0xe8eaf5;return _0x103cb6;});return db['MailApplication'][_0x2e92('0x95')](_0x2ddf2c,{'transaction':_0x33b84f});});}else{_0x36f5d2=0x194;_0x292d4d=[];}});})[_0x2e92('0x22')](function(){if(_0x36f5d2!==0x194){return db[_0x2e92('0x96')]['findAndCountAll']({'where':{'MailAccountId':_0xe8eaf5},'order':_0x2e92('0x97')})['then'](function(_0x1c4b9a){_0x292d4d=_0x1c4b9a;});}})[_0x2e92('0x18')](function(_0x45cb86){_0x36f5d2=0x1f4;logger[_0x2e92('0x14')](_0x45cb86[_0x2e92('0x98')]);if(_0x45cb86[_0x2e92('0x25')]){delete _0x45cb86[_0x2e92('0x25')];}_0x292d4d=_0x45cb86;})['finally'](function(){if(_0x292d4d===null){_0x2b9865[_0x2e92('0x19')](_0x36f5d2);}else{if(_0x36f5d2===0x1f4){_0x2b9865[_0x2e92('0x1a')](_0x36f5d2)[_0x2e92('0x26')](_0x292d4d);}else{_0x2b9865[_0x2e92('0x1a')](_0x36f5d2)[_0x2e92('0x99')](_0x292d4d);}}});};exports[_0x2e92('0x9a')]=function(_0x46dca0,_0x380566){var _0x4dbb18={};var _0x5565a5={};var _0x34d5d4;var _0x7c4898;return db['MailAccount']['findOne']({'where':{'id':_0x46dca0['params']['id']}})['then'](handleEntityNotFound(_0x380566,null))[_0x2e92('0x22')](function(_0x280acc){if(_0x280acc){_0x34d5d4=_0x280acc;_0x5565a5['model']=_[_0x2e92('0x60')](db[_0x2e92('0x96')][_0x2e92('0x44')]);_0x5565a5['query']=_['keys'](_0x46dca0[_0x2e92('0x4a')]);_0x5565a5[_0x2e92('0x4b')]=_['intersection'](_0x5565a5[_0x2e92('0x48')],_0x5565a5[_0x2e92('0x4a')]);_0x4dbb18[_0x2e92('0x4e')]=_[_0x2e92('0x4c')](_0x5565a5['model'],qs[_0x2e92('0x4d')](_0x46dca0[_0x2e92('0x4a')]['fields']));_0x4dbb18[_0x2e92('0x4e')]=_0x4dbb18['attributes'][_0x2e92('0x4f')]?_0x4dbb18[_0x2e92('0x4e')]:_0x5565a5['model'];_0x4dbb18[_0x2e92('0x52')]=qs[_0x2e92('0x53')](_0x46dca0[_0x2e92('0x4a')]['sort']);_0x4dbb18['where']=qs[_0x2e92('0x4b')](_[_0x2e92('0x6f')](_0x46dca0[_0x2e92('0x4a')],_0x5565a5[_0x2e92('0x4b')]));if(_0x46dca0[_0x2e92('0x4a')][_0x2e92('0x55')]){_0x4dbb18['where']=_[_0x2e92('0x54')](_0x4dbb18[_0x2e92('0x57')],{'$or':_[_0x2e92('0x49')](_0x4dbb18['attributes'],function(_0x38cae3){var _0x33c48d={};_0x33c48d[_0x38cae3]={'$like':'%'+_0x46dca0[_0x2e92('0x4a')][_0x2e92('0x55')]+'%'};return _0x33c48d;})});}_0x4dbb18=_[_0x2e92('0x54')]({},_0x4dbb18,_0x46dca0['options']);return _0x34d5d4['getApplications'](_0x4dbb18);}})[_0x2e92('0x22')](function(_0x3bb8ca){if(_0x3bb8ca){_0x7c4898=_0x3bb8ca[_0x2e92('0x4f')];if(!_0x46dca0['query'][_0x2e92('0x50')]('nolimit')){_0x4dbb18['limit']=qs[_0x2e92('0x1e')](_0x46dca0['query'][_0x2e92('0x1e')]);_0x4dbb18[_0x2e92('0x1c')]=qs[_0x2e92('0x1c')](_0x46dca0['query']['offset']);}return _0x34d5d4[_0x2e92('0x9a')](_0x4dbb18);}})[_0x2e92('0x22')](function(_0x4722df){if(_0x4722df){return _0x4722df?{'count':_0x7c4898,'rows':_0x4722df}:null;}})[_0x2e92('0x22')](respondWithResult(_0x380566,null))['catch'](handleError(_0x380566,null));};exports[_0x2e92('0x9b')]=function(_0xb25cf2,_0x1e40a5){var _0x160ee5={'raw':!![],'where':{}};var _0xbdef28={};var _0x444c0b={'count':0x0,'rows':[]};return db[_0x2e92('0x43')][_0x2e92('0x6c')]({'where':{'id':_0xb25cf2['params']['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x1e40a5,null))['then'](function(_0x149386){if(_0x149386){_0xbdef28[_0x2e92('0x48')]=_[_0x2e92('0x60')](db['MailMessage'][_0x2e92('0x44')]);_0xbdef28['query']=_[_0x2e92('0x60')](_0xb25cf2[_0x2e92('0x4a')]);_0xbdef28[_0x2e92('0x4b')]=_[_0x2e92('0x4c')](_0xbdef28[_0x2e92('0x48')],_0xbdef28[_0x2e92('0x4a')]);_0x160ee5[_0x2e92('0x4e')]=_[_0x2e92('0x4c')](_0xbdef28[_0x2e92('0x48')],qs[_0x2e92('0x4d')](_0xb25cf2[_0x2e92('0x4a')][_0x2e92('0x4d')]));_0x160ee5[_0x2e92('0x4e')]=_0x160ee5['attributes'][_0x2e92('0x4f')]?_0x160ee5['attributes']:_0xbdef28[_0x2e92('0x48')];if(!_0xb25cf2['query'][_0x2e92('0x50')](_0x2e92('0x51'))){_0x160ee5[_0x2e92('0x1e')]=qs['limit'](_0xb25cf2[_0x2e92('0x4a')][_0x2e92('0x1e')]);_0x160ee5[_0x2e92('0x1c')]=qs[_0x2e92('0x1c')](_0xb25cf2['query'][_0x2e92('0x1c')]);}_0x160ee5['order']=qs['sort'](_0xb25cf2[_0x2e92('0x4a')][_0x2e92('0x53')]);_0x160ee5[_0x2e92('0x57')]=qs[_0x2e92('0x4b')](_[_0x2e92('0x6f')](_0xb25cf2[_0x2e92('0x4a')],_0xbdef28[_0x2e92('0x4b')]));_0x160ee5[_0x2e92('0x57')][_0x2e92('0x69')]=_0x149386['id'];if(_0xb25cf2[_0x2e92('0x4a')]['filter']){_0x160ee5[_0x2e92('0x57')]=_[_0x2e92('0x54')](_0x160ee5[_0x2e92('0x57')],{'$or':_['map'](_0x160ee5[_0x2e92('0x4e')],function(_0x4ba759){var _0x11b113={};_0x11b113[_0x4ba759]={'$like':'%'+_0xb25cf2[_0x2e92('0x4a')]['filter']+'%'};return _0x11b113;})});}if(_0xb25cf2[_0x2e92('0x4a')][_0x2e92('0x9c')]){var _0x37fd3c=_0xb25cf2[_0x2e92('0x4a')][_0x2e92('0x9c')][_0x2e92('0x9d')](',');var _0x48e335={};_0x48e335[_0x37fd3c[0x0]]={'$gte':moment(_0x37fd3c[0x1])[_0x2e92('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x160ee5['where']=_['merge'](_0x160ee5[_0x2e92('0x57')],_0x48e335);}_0x160ee5=_[_0x2e92('0x54')]({},_0x160ee5,_0xb25cf2['options']);return db[_0x2e92('0x9f')][_0x2e92('0x1f')]({'where':_0x160ee5[_0x2e92('0x57')]})['then'](function(_0x2c36f3){_0x444c0b[_0x2e92('0x1f')]=_0x2c36f3;if(_0xb25cf2[_0x2e92('0x4a')][_0x2e92('0x58')]){_0x160ee5[_0x2e92('0x59')]=[{'all':!![]}];}return db[_0x2e92('0x9f')][_0x2e92('0x5a')](_0x160ee5);})[_0x2e92('0x22')](function(_0x15da4a){if(_0xb25cf2['query'][_0x2e92('0xa0')]===_0x2e92('0xa1')){for(var _0x328c7f=0x0;_0x328c7f<_0x15da4a[_0x2e92('0x4f')];_0x328c7f++){_0x15da4a[_0x328c7f][_0x2e92('0x63')]=juice(_0x15da4a[_0x328c7f]['body']);}}_0x444c0b[_0x2e92('0x5b')]=_0x15da4a;return _0x444c0b;});}})[_0x2e92('0x22')](respondWithFilteredResult(_0x1e40a5,_0x160ee5))[_0x2e92('0x18')](handleError(_0x1e40a5,null));};exports[_0x2e92('0x26')]=function(_0x453b90,_0x22ec73){var _0x48a77e,_0x1f77e0={},_0x4287e3;if(_0x453b90[_0x2e92('0x63')]['to']){_0x4287e3=_0x453b90[_0x2e92('0x63')]['to'][_0x2e92('0x9d')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x453b90[_0x2e92('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x2e92('0xa2'),'include':[{'model':db[_0x2e92('0x87')],'as':_0x2e92('0xa3'),'where':{'email':_0x4287e3},'limit':0x1,'order':[['updatedAt',_0x2e92('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0x2e92('0x3f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2e92('0xa5'),'raw':!![]}]}]})[_0x2e92('0x22')](handleEntityNotFound(_0x22ec73,null))[_0x2e92('0x22')](function(_0x1d11bf){if(!_0x1d11bf)return;_0x48a77e=_0x1d11bf;if(!_0x1d11bf['Smtp'])throw new Error(_0x2e92('0xa6'));if(_[_0x2e92('0x73')](_0x453b90['body'][_0x2e92('0xa7')])){_0x453b90[_0x2e92('0x63')][_0x2e92('0xa7')]=util['format'](_0x2e92('0xa8'),_0x1d11bf[_0x2e92('0x25')],_0x1d11bf[_0x2e92('0x72')]||_0x1d11bf[_0x2e92('0x3f')]['user']);}if(_0x453b90['body'][_0x2e92('0xa9')]&&_0x453b90['body']['attachments']['length']){for(var _0x16e971=0x0;_0x16e971<_0x453b90['body'][_0x2e92('0xa9')]['length'];_0x16e971+=0x1){_0x453b90['body'][_0x2e92('0xa9')][_0x16e971]={'filename':_0x453b90[_0x2e92('0x63')][_0x2e92('0xa9')][_0x16e971][_0x2e92('0x25')],'path':path[_0x2e92('0xaa')](config[_0x2e92('0xab')],'server/files/attachments',_0x453b90[_0x2e92('0x63')][_0x2e92('0xa9')][_0x16e971][_0x2e92('0xac')])};}}var _0x216e47=_0x1d11bf['getSmtpOptions']();return respondWithRpcPromise(_0x2e92('0xad'),_0x2e92('0xae'),{'account':_0x216e47,'message':_0x453b90[_0x2e92('0x63')]});})[_0x2e92('0x22')](function(_0x5d66f5){if(!_0x5d66f5)return;_0x1f77e0=_0x5d66f5;if(!_0x48a77e[_0x2e92('0xa2')])throw new Error(_0x2e92('0xaf'));if(_0x48a77e['List']['Contacts'][_0x2e92('0x4f')])return _0x48a77e[_0x2e92('0xa2')][_0x2e92('0xa3')][0x0];return db['CmContact'][_0x2e92('0x6e')](_[_0x2e92('0xb0')](_0x453b90[_0x2e92('0x63')],{'firstName':_0x453b90[_0x2e92('0x63')]['to'],'email':_0x453b90['body']['to'],'phone':_0x453b90[_0x2e92('0x63')]['to'],'ListId':_0x48a77e[_0x2e92('0xb1')]}));})[_0x2e92('0x22')](function(_0x440f25){if(!_0x440f25)return;var _0x4745b7={'UserId':_0x453b90[_0x2e92('0x33')]['id'],'ContactId':_0x440f25['id'],'MailAccountId':_0x48a77e['id'],'inReplyTo':_0x1f77e0[_0x2e92('0xb2')],'to':_0x453b90[_0x2e92('0x63')][_0x2e92('0xa7')],'cc':_0x453b90['body']['cc'],'subject':_0x453b90[_0x2e92('0x63')][_0x2e92('0xb3')],'attach':_0x453b90[_0x2e92('0x63')][_0x2e92('0xb4')],'firstMsgDirection':_0x2e92('0xb5'),'lastMsgAt':moment()[_0x2e92('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2e92('0xb5'),'Messages':[_[_0x2e92('0x54')](_0x453b90[_0x2e92('0x63')],{'messageId':_0x1f77e0[_0x2e92('0xb2')],'sentAt':moment()[_0x2e92('0x9e')](_0x2e92('0xb6')),'read':!![],'MailAccountId':_0x48a77e['id'],'UserId':_0x453b90[_0x2e92('0x33')]['id'],'ContactId':_0x440f25['id']})]};if(_0x453b90[_0x2e92('0x63')][_0x2e92('0xb7')]){_0x4745b7=_[_0x2e92('0x54')](_0x4745b7,_0x453b90[_0x2e92('0x63')][_0x2e92('0xb7')]);}return db[_0x2e92('0x85')][_0x2e92('0x6e')](_0x4745b7,{'include':[{'model':db['MailMessage'],'as':_0x2e92('0xb8')}]});})['then'](respondWithResult(_0x22ec73,null))[_0x2e92('0x18')](handleError(_0x22ec73,null));};exports[_0x2e92('0xb9')]=function(_0x30aa99,_0x1baa64){return db[_0x2e92('0x43')][_0x2e92('0x61')]({'where':{'id':_0x30aa99[_0x2e92('0x5d')]['id']},'include':[{'model':db[_0x2e92('0x41')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2e92('0xa5'),'raw':!![]}]}]})[_0x2e92('0x22')](handleEntityNotFound(_0x1baa64,null))['then'](function(_0x8c5b10){if(!_0x8c5b10[_0x2e92('0x3f')])return;var _0x2801b1=_0x8c5b10[_0x2e92('0xba')]();return respondWithRpcPromise(_0x2e92('0xbb'),_0x2e92('0xb9'),{'account':_0x2801b1});})[_0x2e92('0x22')](respondWithResult(_0x1baa64,null))[_0x2e92('0x18')](handleError(_0x1baa64,null));};exports['destroy']=function(_0x29e7a4,_0x4f549e){return db[_0x2e92('0x43')][_0x2e92('0x61')]({'where':{'id':_0x29e7a4['params']['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0x4f549e,null))[_0x2e92('0x22')](function(_0x342bf0){if(_0x342bf0&&_0x342bf0[_0x2e92('0x3c')]){throw new db[(_0x2e92('0xbc'))]['ValidationError'](_0x2e92('0xbd'));}return _0x342bf0;})[_0x2e92('0x22')](removeEntity(_0x4f549e,null))[_0x2e92('0x18')](handleError(_0x4f549e,null));};exports[_0x2e92('0xbe')]=function(_0x64c6d0,_0x596aec){return db[_0x2e92('0x43')][_0x2e92('0x61')]({'where':{'id':_0x64c6d0[_0x2e92('0x5d')]['id']}})['then'](handleEntityNotFound(_0x596aec,null))[_0x2e92('0x22')](function(_0x192022){if(_0x192022){return _0x192022[_0x2e92('0xbe')](_0x64c6d0[_0x2e92('0x63')][_0x2e92('0x71')],_[_0x2e92('0x86')](_0x64c6d0['body'],['ids','id'])||{})[_0x2e92('0xbf')](function(_0x3520ae){for(var _0x1a5473=0x0;_0x1a5473<_0x64c6d0['body'][_0x2e92('0x71')][_0x2e92('0x4f')];_0x1a5473+=0x1){socket[_0x2e92('0xc0')]('userMailAccount:save',{'UserId':Number(_0x64c6d0[_0x2e92('0x63')]['ids'][_0x1a5473]),'MailAccountId':Number(_0x64c6d0[_0x2e92('0x5d')]['id'])});}return _0x3520ae;});}})[_0x2e92('0x22')](respondWithResult(_0x596aec,null))['catch'](handleError(_0x596aec,null));};exports[_0x2e92('0xc1')]=function(_0x2389be,_0x372895){return db['MailAccount'][_0x2e92('0x61')]({'where':{'id':_0x2389be['params']['id']}})['then'](handleEntityNotFound(_0x372895,null))[_0x2e92('0x22')](function(_0x45fa15){if(_0x45fa15){return _0x45fa15['removeAgents'](_0x2389be[_0x2e92('0x4a')][_0x2e92('0x71')])[_0x2e92('0x22')](function(){if(_[_0x2e92('0xc2')](_0x2389be[_0x2e92('0x4a')][_0x2e92('0x71')])){for(var _0x54cf5c=0x0;_0x54cf5c<_0x2389be[_0x2e92('0x4a')][_0x2e92('0x71')][_0x2e92('0x4f')];_0x54cf5c+=0x1){socket[_0x2e92('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x2389be[_0x2e92('0x4a')][_0x2e92('0x71')][_0x54cf5c]),'MailAccountId':Number(_0x2389be[_0x2e92('0x5d')]['id'])});}}else{socket[_0x2e92('0xc0')](_0x2e92('0xc3'),{'UserId':Number(_0x2389be[_0x2e92('0x4a')]['ids']),'MailAccountId':Number(_0x2389be[_0x2e92('0x5d')]['id'])});}});}})[_0x2e92('0x22')](respondWithStatusCode(_0x372895,null))[_0x2e92('0x18')](handleError(_0x372895,null));};exports['getAgents']=function(_0x191553,_0xe58043){var _0x5d6f4a={};var _0x4cbf4d={};var _0x83a292;var _0x259f20;return db['MailAccount']['findOne']({'where':{'id':_0x191553[_0x2e92('0x5d')]['id']}})[_0x2e92('0x22')](handleEntityNotFound(_0xe58043,null))[_0x2e92('0x22')](function(_0x21968d){if(_0x21968d){_0x83a292=_0x21968d;_0x4cbf4d[_0x2e92('0x48')]=_[_0x2e92('0x60')](db[_0x2e92('0x89')][_0x2e92('0x44')]);_0x4cbf4d[_0x2e92('0x4a')]=_[_0x2e92('0x60')](_0x191553['query']);_0x4cbf4d[_0x2e92('0x4b')]=_['intersection'](_0x4cbf4d['model'],_0x4cbf4d[_0x2e92('0x4a')]);_0x5d6f4a[_0x2e92('0x4e')]=_[_0x2e92('0x4c')](_0x4cbf4d[_0x2e92('0x48')],qs[_0x2e92('0x4d')](_0x191553['query'][_0x2e92('0x4d')]));_0x5d6f4a['attributes']=_0x5d6f4a['attributes'][_0x2e92('0x4f')]?_0x5d6f4a[_0x2e92('0x4e')]:_0x4cbf4d[_0x2e92('0x48')];_0x5d6f4a[_0x2e92('0x52')]=qs[_0x2e92('0x53')](_0x191553[_0x2e92('0x4a')][_0x2e92('0x53')]);_0x5d6f4a[_0x2e92('0x57')]=qs['filters'](_[_0x2e92('0x6f')](_0x191553[_0x2e92('0x4a')],_0x4cbf4d['filters']));if(_0x191553[_0x2e92('0x4a')]['filter']){_0x5d6f4a['where']=_['merge'](_0x5d6f4a['where'],{'$or':_[_0x2e92('0x49')](_0x5d6f4a['attributes'],function(_0x3027f9){var _0x16c9c4={};_0x16c9c4[_0x3027f9]={'$like':'%'+_0x191553[_0x2e92('0x4a')][_0x2e92('0x55')]+'%'};return _0x16c9c4;})});}_0x5d6f4a=_['merge']({},_0x5d6f4a,_0x191553[_0x2e92('0x56')]);return _0x83a292[_0x2e92('0xc4')](_0x5d6f4a);}})[_0x2e92('0x22')](function(_0x49a869){if(_0x49a869){_0x259f20=_0x49a869['length'];if(!_0x191553[_0x2e92('0x4a')][_0x2e92('0x50')]('nolimit')){_0x5d6f4a[_0x2e92('0x1e')]=qs[_0x2e92('0x1e')](_0x191553['query']['limit']);_0x5d6f4a[_0x2e92('0x1c')]=qs['offset'](_0x191553[_0x2e92('0x4a')][_0x2e92('0x1c')]);}return _0x83a292[_0x2e92('0xc4')](_0x5d6f4a);}})[_0x2e92('0x22')](function(_0xc9d45c){if(_0xc9d45c){return _0xc9d45c?{'count':_0x259f20,'rows':_0xc9d45c}:null;}})[_0x2e92('0x22')](respondWithResult(_0xe58043,null))[_0x2e92('0x18')](handleError(_0xe58043,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b2095be..6ea94e1 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 _0xbd18=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x618268,_0x4fc1fb){var _0x737d9e=function(_0x161ea3){while(--_0x161ea3){_0x618268['push'](_0x618268['shift']());}};_0x737d9e(++_0x4fc1fb);}(_0xbd18,0x195));var _0x8bd1=function(_0x3819ae,_0x3989f8){_0x3819ae=_0x3819ae-0x0;var _0x53400d=_0xbd18[_0x3819ae];return _0x53400d;};'use strict';var EventEmitter=require(_0x8bd1('0x0'));var MailAccount=require(_0x8bd1('0x1'))['db'][_0x8bd1('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8bd1('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4eb187){return function(_0x2cdea7,_0x113554,_0x5abf07){MailAccountEvents['emit'](_0x4eb187+':'+_0x2cdea7['id'],_0x2cdea7);MailAccountEvents[_0x8bd1('0x4')](_0x4eb187,_0x2cdea7);_0x5abf07(null);};}for(var e in events){if(events[_0x8bd1('0x5')](e)){var event=events[e];MailAccount[_0x8bd1('0x6')](e,emitEvent(event));}}module[_0x8bd1('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xaf5a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','MailAccount'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0xaf5a,0x116));var _0xaaf5=function(_0x290612,_0x264e17){_0x290612=_0x290612-0x0;var _0x44aade=_0xaf5a[_0x290612];return _0x44aade;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xaaf5('0x0'))['db'][_0xaaf5('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xaaf5('0x2')](0x0);var events={'afterCreate':_0xaaf5('0x3'),'afterUpdate':_0xaaf5('0x4'),'afterDestroy':_0xaaf5('0x5')};function emitEvent(_0x5c55af){return function(_0x1bdf16,_0x4ae9ed,_0x23fbd9){MailAccountEvents[_0xaaf5('0x6')](_0x5c55af+':'+_0x1bdf16['id'],_0x1bdf16);MailAccountEvents[_0xaaf5('0x6')](_0x5c55af,_0x1bdf16);_0x23fbd9(null);};}for(var e in events){if(events[_0xaaf5('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e69c4c8..3f7bfbf 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 _0x6de4=['data5','pass','./mailAccount.attributes','exports','define','provider','custom','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user'];(function(_0x28771b,_0x45bed7){var _0x4cfdcd=function(_0x4bc141){while(--_0x4bc141){_0x28771b['push'](_0x28771b['shift']());}};_0x4cfdcd(++_0x45bed7);}(_0x6de4,0x134));var _0x46de=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6de4[_0x57b54c];return _0x59cc19;};'use strict';var attributes=require(_0x46de('0x0'));module[_0x46de('0x1')]=function(_0x864f1a){return _0x864f1a[_0x46de('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x463849=this;var _0x48cfe1={'id':_0x463849['id'],'tls':{'rejectUnauthorized':![]}};if(_0x463849[_0x46de('0x3')]!==_0x46de('0x4')){_0x48cfe1['service']=_0x463849[_0x46de('0x3')];}else{_0x48cfe1['host']=_0x463849[_0x46de('0x5')]['host'];_0x48cfe1['port']=_0x463849[_0x46de('0x5')][_0x46de('0x6')];_0x48cfe1[_0x46de('0x7')]=_0x463849[_0x46de('0x5')][_0x46de('0x7')];}if(_0x463849[_0x46de('0x5')][_0x46de('0x8')]){if(_0x463849[_0x46de('0x5')][_0x46de('0x9')]){if(!_0x463849[_0x46de('0x5')][_0x46de('0xa')])throw new Error(_0x46de('0xb'));_0x48cfe1[_0x46de('0xc')]={'type':_0x46de('0xd'),'user':_0x463849[_0x46de('0x5')][_0x46de('0xe')],'accessToken':_0x463849['Smtp'][_0x46de('0xa')][_0x46de('0xf')]};}else{_0x48cfe1[_0x46de('0xc')]={'user':_0x463849[_0x46de('0x5')][_0x46de('0xe')],'pass':_0x463849[_0x46de('0x5')][_0x46de('0x10')]};}}return _0x48cfe1;}}});}; \ No newline at end of file +var _0x60ed=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','port','secure','Smtp','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','pass'];(function(_0x312319,_0x13cea6){var _0x524fa0=function(_0x36f8f4){while(--_0x36f8f4){_0x312319['push'](_0x312319['shift']());}};_0x524fa0(++_0x13cea6);}(_0x60ed,0x78));var _0xd60e=function(_0x55a098,_0x359c3e){_0x55a098=_0x55a098-0x0;var _0x7b25c9=_0x60ed[_0x55a098];return _0x7b25c9;};'use strict';var attributes=require(_0xd60e('0x0'));module[_0xd60e('0x1')]=function(_0x556ebb){return _0x556ebb[_0xd60e('0x2')](_0xd60e('0x3'),attributes,{'tableName':_0xd60e('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x446e8a=this;var _0x4b3f3a={'id':_0x446e8a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x446e8a[_0xd60e('0x5')]!==_0xd60e('0x6')){_0x4b3f3a[_0xd60e('0x7')]=_0x446e8a[_0xd60e('0x5')];}else{_0x4b3f3a[_0xd60e('0x8')]=_0x446e8a['Smtp'][_0xd60e('0x8')];_0x4b3f3a['port']=_0x446e8a['Smtp'][_0xd60e('0x9')];_0x4b3f3a[_0xd60e('0xa')]=_0x446e8a['Smtp'][_0xd60e('0xa')];}if(_0x446e8a[_0xd60e('0xb')][_0xd60e('0xc')]){if(_0x446e8a[_0xd60e('0xb')][_0xd60e('0xd')]){if(!_0x446e8a[_0xd60e('0xb')][_0xd60e('0xe')])throw new Error(_0xd60e('0xf'));_0x4b3f3a[_0xd60e('0x10')]={'type':_0xd60e('0x11'),'user':_0x446e8a[_0xd60e('0xb')]['user'],'accessToken':_0x446e8a[_0xd60e('0xb')][_0xd60e('0xe')]['data5']};}else{_0x4b3f3a['auth']={'user':_0x446e8a['Smtp'][_0xd60e('0x12')],'pass':_0x446e8a[_0xd60e('0xb')][_0xd60e('0x13')]};}}return _0x4b3f3a;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index fc5e86f..226f045 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 _0x82c4=['get','account','omit','smtpOptions','applications','priority','asc','push','length','close','autoclose','*,*,*,*','Contacts','defaults','create','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found','spread','update','subject','interaction','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Attachment','User','unshift','waitForTheAssignedAgent','queueId','queue','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','limit','include','model','map','then','stringify','ShowMailAccount','where','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','find','DESC','Applications','MailServerOut','Smtp','CloudProvider','List'];(function(_0x1edf2a,_0x55c423){var _0x5698f0=function(_0x237e51){while(--_0x237e51){_0x1edf2a['push'](_0x1edf2a['shift']());}};_0x5698f0(++_0x55c423);}(_0x82c4,0x1ca));var _0x482c=function(_0x29f361,_0x199d41){_0x29f361=_0x29f361-0x0;var _0x3e11d8=_0x82c4[_0x29f361];return _0x3e11d8;};'use strict';var _=require(_0x482c('0x0'));var moment=require(_0x482c('0x1'));var BPromise=require(_0x482c('0x2'));var rs=require(_0x482c('0x3'));var Redis=require(_0x482c('0x4'));var db=require(_0x482c('0x5'))['db'];var logger=require(_0x482c('0x6'))('rpc');var config=require(_0x482c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x8')]['http']({'port':0x232c});config[_0x482c('0x9')]=_['defaults'](config[_0x482c('0x9')],{'host':_0x482c('0xa'),'port':0x18eb});var socket=require(_0x482c('0xb'))(new Redis(config[_0x482c('0x9')]));require(_0x482c('0xc'))['register'](socket);function respondWithRpcPromise(_0x171c5b,_0x135cc1,_0x3859ad){return new BPromise(function(_0xc59d41,_0x3c6c56){return client[_0x482c('0xd')](_0x171c5b,_0x3859ad)['then'](function(_0x4df2a1){logger[_0x482c('0xe')](_0x482c('0xf'),_0x135cc1,'request\x20sent');logger[_0x482c('0x10')](_0x482c('0x11'),_0x135cc1,_0x482c('0x12'),JSON['stringify'](_0x4df2a1));if(_0x4df2a1['error']){if(_0x4df2a1[_0x482c('0x13')][_0x482c('0x14')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x135cc1,_0x4df2a1[_0x482c('0x13')][_0x482c('0x15')]);return _0x3c6c56(_0x4df2a1[_0x482c('0x13')][_0x482c('0x15')]);}logger[_0x482c('0x13')](_0x482c('0xf'),_0x135cc1,_0x4df2a1[_0x482c('0x13')][_0x482c('0x15')]);return _0xc59d41(_0x4df2a1[_0x482c('0x13')][_0x482c('0x15')]);}else{logger[_0x482c('0xe')](_0x482c('0xf'),_0x135cc1,'request\x20sent');_0xc59d41(_0x4df2a1[_0x482c('0x16')]['message']);}})[_0x482c('0x17')](function(_0x258148){logger['error']('MailAccount,\x20%s,\x20%s',_0x135cc1,_0x258148);_0x3c6c56(_0x258148);});});}exports[_0x482c('0x18')]=function(_0x584656){var _0x16fe9a=this;return new Promise(function(_0x4784a2,_0x281c60){return db[_0x482c('0x19')]['findAll']({'raw':_0x584656[_0x482c('0x1a')]?_0x584656[_0x482c('0x1a')][_0x482c('0x1b')]===undefined?!![]:![]:!![],'where':_0x584656[_0x482c('0x1a')]?_0x584656[_0x482c('0x1a')]['where']||null:null,'attributes':_0x584656['options']?_0x584656[_0x482c('0x1a')][_0x482c('0x1c')]||null:null,'limit':_0x584656[_0x482c('0x1a')]?_0x584656['options'][_0x482c('0x1d')]||null:null,'include':_0x584656['options']?_0x584656[_0x482c('0x1a')][_0x482c('0x1e')]?_['map'](_0x584656[_0x482c('0x1a')]['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1f')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x1c')],'include':_0x589bc6[_0x482c('0x1e')]?_[_0x482c('0x20')](_0x589bc6[_0x482c('0x1e')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1f')]],'as':_0x215826['as'],'attributes':_0x215826['attributes'],'include':_0x215826[_0x482c('0x1e')]?_[_0x482c('0x20')](_0x215826['include'],function(_0xb01bc3){return{'model':db[_0xb01bc3['model']],'as':_0xb01bc3['as'],'attributes':_0xb01bc3['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0x21')](function(_0x5af04c){logger[_0x482c('0xe')](_0x482c('0x18'),_0x584656);logger[_0x482c('0x10')](_0x482c('0x18'),_0x584656,JSON[_0x482c('0x22')](_0x5af04c));_0x4784a2(_0x5af04c);})[_0x482c('0x17')](function(_0x36b00d){logger[_0x482c('0x13')](_0x482c('0x18'),_0x36b00d[_0x482c('0x15')],_0x584656);_0x281c60(_0x16fe9a[_0x482c('0x13')](0x1f4,_0x36b00d[_0x482c('0x15')]));});});};exports[_0x482c('0x23')]=function(_0x8779c2){var _0x1eac87=this;return new Promise(function(_0x164417,_0x22a8be){return db[_0x482c('0x19')]['find']({'raw':_0x8779c2['options']?_0x8779c2['options'][_0x482c('0x1b')]===undefined?!![]:![]:!![],'where':_0x8779c2[_0x482c('0x1a')]?_0x8779c2[_0x482c('0x1a')][_0x482c('0x24')]||null:null,'attributes':_0x8779c2['options']?_0x8779c2[_0x482c('0x1a')]['attributes']||null:null,'include':_0x8779c2[_0x482c('0x1a')]?_0x8779c2[_0x482c('0x1a')][_0x482c('0x1e')]?_[_0x482c('0x20')](_0x8779c2[_0x482c('0x1a')][_0x482c('0x1e')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1f')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x20')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1f')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x1c')],'include':_0xe62a02['include']?_[_0x482c('0x20')](_0xe62a02[_0x482c('0x1e')],function(_0x67cde9){return{'model':db[_0x67cde9[_0x482c('0x1f')]],'as':_0x67cde9['as'],'attributes':_0x67cde9['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0x21')](function(_0x52a610){if(_0x8779c2[_0x482c('0x1a')]['smtp']===!![])_0x52a610[_0x482c('0x25')]('smtpOptions',_0x52a610[_0x482c('0x26')]());logger[_0x482c('0xe')]('ShowMailAccount',_0x8779c2);logger[_0x482c('0x10')]('ShowMailAccount',_0x8779c2,JSON['stringify'](_0x52a610));_0x164417(_0x52a610);})[_0x482c('0x17')](function(_0x5ad861){logger['error']('ShowMailAccount',_0x5ad861['message'],_0x8779c2);_0x22a8be(_0x1eac87[_0x482c('0x13')](0x1f4,_0x5ad861[_0x482c('0x15')]));});});};exports[_0x482c('0x27')]=function(_0x2fbcec){var _0x4eb326=this;return new Promise(function(_0x5666e9,_0x24f3b5){var _0x43b8c8={'body':_0x2fbcec[_0x482c('0x28')],'channel':_0x482c('0x29')};var _0x5eb2f5=_['difference'](_[_0x482c('0x2a')](db[_0x482c('0x2b')][_0x482c('0x2c')]),[_0x482c('0x2d'),_0x482c('0x2e'),_0x482c('0x2f'),_0x482c('0x30')]);var _0x2cea98=![];if(_0x2fbcec[_0x482c('0x28')]['id']){delete _0x2fbcec[_0x482c('0x28')]['id'];}if(_[_0x482c('0x31')](_0x2fbcec['body'][_0x482c('0x32')])){return _0x24f3b5(_0x4eb326[_0x482c('0x13')](0x1f4,_0x482c('0x33')));}if(_[_0x482c('0x31')](_0x2fbcec[_0x482c('0x28')][_0x482c('0x28')])||_0x2fbcec[_0x482c('0x28')]['body']===''){return _0x24f3b5(_0x4eb326['error'](0x1f4,_0x482c('0x34')));}if(_[_0x482c('0x31')](_0x2fbcec[_0x482c('0x28')]['mapKey'])){return _0x24f3b5(_0x4eb326[_0x482c('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5eb2f5));}if(!_[_0x482c('0x35')](_0x5eb2f5,_0x2fbcec[_0x482c('0x28')][_0x482c('0x36')])){return _0x24f3b5(_0x4eb326[_0x482c('0x13')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5eb2f5));}var _0x1ff623={};_0x1ff623[_0x2fbcec[_0x482c('0x28')][_0x482c('0x36')]]=_0x2fbcec['body'][_0x482c('0x32')];return db[_0x482c('0x19')][_0x482c('0x37')]({'where':{'id':_0x2fbcec['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1ff623,'limit':0x1,'order':[['updatedAt',_0x482c('0x38')]]}]},{'model':db['MailApplication'],'as':_0x482c('0x39')},{'model':db[_0x482c('0x3a')],'as':_0x482c('0x3b'),'include':[{'model':db[_0x482c('0x3c')],'as':_0x482c('0x3c')}]}]})[_0x482c('0x21')](function(_0x37be4f){if(_0x37be4f&&_0x37be4f[_0x482c('0x3d')]){var _0x240592=_0x37be4f[_0x482c('0x3e')]({'plain':!![]});_0x43b8c8[_0x482c('0x3f')]=_[_0x482c('0x40')](_0x240592,[_0x482c('0x39'),_0x482c('0x3d')]);_0x43b8c8[_0x482c('0x3f')][_0x482c('0x41')]=_0x37be4f[_0x482c('0x26')]();_0x43b8c8[_0x482c('0x42')]=_0x240592[_0x482c('0x39')];_0x43b8c8['list']=_0x240592[_0x482c('0x3d')];_0x43b8c8[_0x482c('0x42')]=_['orderBy'](_0x43b8c8[_0x482c('0x42')],[_0x482c('0x43')],[_0x482c('0x44')]);if(_0x43b8c8[_0x482c('0x3f')]&&_0x43b8c8[_0x482c('0x3f')]['autoclose']){_0x43b8c8['applications'][_0x482c('0x45')]({'id':0x0,'priority':_0x43b8c8[_0x482c('0x42')][_0x482c('0x46')]+0x1,'app':_0x482c('0x47'),'appdata':_0x482c('0x48'),'interval':_0x482c('0x49')});}if(_0x43b8c8[_0x482c('0x3f')]['Applications']){delete _0x43b8c8['account']['Applications'];}if(_0x43b8c8[_0x482c('0x3f')][_0x482c('0x3d')]){delete _0x43b8c8[_0x482c('0x3f')][_0x482c('0x3d')];}if(_0x240592[_0x482c('0x3d')][_0x482c('0x4a')][_0x482c('0x46')]){return _0x240592[_0x482c('0x3d')][_0x482c('0x4a')][0x0];}var _0x2d6657=_[_0x482c('0x4b')](_0x2fbcec['body'],{'firstName':_0x2fbcec[_0x482c('0x28')][_0x482c('0x32')],'ListId':_0x240592[_0x482c('0x30')]});_0x2d6657[_0x2fbcec[_0x482c('0x28')][_0x482c('0x36')]]=_0x2fbcec[_0x482c('0x28')][_0x482c('0x32')];return db[_0x482c('0x2b')][_0x482c('0x4c')](_0x2d6657);}else{throw new Error(_0x482c('0x4d'));}})[_0x482c('0x21')](function(_0x1ff536){_0x43b8c8['contact']=_0x1ff536;if(_0x1ff536){if(!_0x2fbcec['body'][_0x482c('0x15')][_0x482c('0x4e')]){_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x4e')]=rs[_0x482c('0x4f')]()+'\x20'+_0x2fbcec['body'][_0x482c('0x15')][_0x482c('0x32')];}var _0x197056={'ContactId':_0x1ff536['id'],'MailAccountId':_0x2fbcec[_0x482c('0x3f')]['id'],'inReplyTo':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x4e')],'to':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x32')],'cc':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['cc'],'subject':_0x2fbcec['body'][_0x482c('0x15')]['subject'],'attach':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x50')],'lastMsgAt':moment()[_0x482c('0x51')](_0x482c('0x52')),'lastMsgDirection':'in'};return db[_0x482c('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0x2fbcec[_0x482c('0x3f')]['id']},'include':[{'model':db[_0x482c('0x54')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['inReplyTo']}}]})[_0x482c('0x21')](function(_0x438402){if(_0x438402){return[_0x438402,![]];}return db[_0x482c('0x53')][_0x482c('0x4c')](_0x197056)['then'](function(_0x31a919){return[_0x31a919,!![]];});});}else{throw new Error(_0x482c('0x55'));}})[_0x482c('0x56')](function(_0x3d67f7,_0x3a37f5){if(_0x3d67f7){_0x2cea98=_0x3a37f5;if(!_0x3a37f5){return _0x3d67f7[_0x482c('0x57')]({'inReplyTo':_0x2fbcec['body']['message'][_0x482c('0x4e')],'to':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['from'],'cc':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['cc'],'subject':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x58')],'attach':_0x3d67f7[_0x482c('0x50')]?_0x3d67f7[_0x482c('0x50')]:_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x482c('0x52')),'lastMsgAt':moment()[_0x482c('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x3d67f7;}}})['then'](function(_0x2475e1){_0x43b8c8[_0x482c('0x59')]=_0x2475e1[_0x482c('0x3e')]({'plain':!![]});_0x43b8c8['interaction']['created']=_0x2cea98;return db['MailMessage'][_0x482c('0x4c')]({'body':_0x2fbcec[_0x482c('0x28')][_0x482c('0x28')],'MailAccountId':_0x2fbcec[_0x482c('0x3f')]['id'],'MailInteractionId':_0x2475e1['id'],'direction':'in','ContactId':_0x43b8c8[_0x482c('0x5a')]['id'],'messageId':_0x2fbcec[_0x482c('0x28')]['message']['messageId'],'from':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x32')],'to':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['to'],'cc':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['cc'],'subject':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x58')],'attach':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['attach'],'Attachments':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x5b')],'originTo':_0x2fbcec['body'][_0x482c('0x15')][_0x482c('0x5c')],'originCc':_0x2fbcec[_0x482c('0x28')]['message'][_0x482c('0x5d')],'bcc':_0x2fbcec['body']['message'][_0x482c('0x5e')],'ChatWebsiteId':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x5f')]||null,'originChannel':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')][_0x482c('0x60')]||'Email','ChatOfflineMessageId':_0x2fbcec[_0x482c('0x28')][_0x482c('0x15')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x482c('0x61')],'as':'Attachments'}]});})['then'](function(_0x5db299){_0x43b8c8[_0x482c('0x15')]=_0x5db299;if(!_0x43b8c8['interaction']['UserId']){return;}return db[_0x482c('0x62')][_0x482c('0x37')]({'attributes':['id','name'],'where':{'id':_0x43b8c8[_0x482c('0x59')]['UserId']}});})['then'](function(_0x5604f8){if(_0x5604f8){_0x43b8c8[_0x482c('0x42')][_0x482c('0x63')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5604f8['name']+','+(_0x43b8c8['account'][_0x482c('0x64')]||0xa),'interval':_0x482c('0x49')});}if(!_0x43b8c8[_0x482c('0x59')]['queueId']){return;}return db['MailQueue'][_0x482c('0x37')]({'attributes':['id','name'],'where':{'id':_0x43b8c8[_0x482c('0x59')][_0x482c('0x65')]}});})['then'](function(_0x426e4a){if(_0x426e4a){_0x43b8c8['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x482c('0x66'),'appdata':_0x426e4a['name']+','+(_0x43b8c8[_0x482c('0x3f')]['waitForTheAssignedQueue']||0x12c),'interval':_0x482c('0x49')});}return respondWithRpcPromise('Start',_0x482c('0x67'),_0x43b8c8);})[_0x482c('0x21')](function(_0x7d0261){_0x5666e9(_0x7d0261);})['catch'](function(_0x19450b){_0x24f3b5(_0x4eb326[_0x482c('0x13')](0x1f4,_0x19450b[_0x482c('0x15')]));});});}; \ No newline at end of file +var _0x0689=['MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','limit','include','map','model','attributes','then','debug','ShowMailAccount','find','where','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','List','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','interaction','get','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId'];(function(_0x32617c,_0x2be1ad){var _0x1cb6c9=function(_0x25b1bc){while(--_0x25b1bc){_0x32617c['push'](_0x32617c['shift']());}};_0x1cb6c9(++_0x2be1ad);}(_0x0689,0x161));var _0x9068=function(_0x1568eb,_0x30882f){_0x1568eb=_0x1568eb-0x0;var _0x19f1c2=_0x0689[_0x1568eb];return _0x19f1c2;};'use strict';var _=require('lodash');var moment=require(_0x9068('0x0'));var BPromise=require('bluebird');var rs=require(_0x9068('0x1'));var Redis=require(_0x9068('0x2'));var db=require(_0x9068('0x3'))['db'];var logger=require(_0x9068('0x4'))(_0x9068('0x5'));var config=require(_0x9068('0x6'));var jayson=require(_0x9068('0x7'));var client=jayson[_0x9068('0x8')][_0x9068('0x9')]({'port':0x232c});config[_0x9068('0xa')]=_['defaults'](config[_0x9068('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9068('0xa')]));require(_0x9068('0xb'))[_0x9068('0xc')](socket);function respondWithRpcPromise(_0x77a2db,_0x1c63d2,_0xf611cf){return new BPromise(function(_0x451a17,_0x141e26){return client[_0x9068('0xd')](_0x77a2db,_0xf611cf)['then'](function(_0x364bd5){logger[_0x9068('0xe')](_0x9068('0xf'),_0x1c63d2,_0x9068('0x10'));logger['debug'](_0x9068('0x11'),_0x1c63d2,_0x9068('0x10'),JSON[_0x9068('0x12')](_0x364bd5));if(_0x364bd5['error']){if(_0x364bd5[_0x9068('0x13')][_0x9068('0x14')]===0x1f4){logger[_0x9068('0x13')]('MailAccount,\x20%s,\x20%s',_0x1c63d2,_0x364bd5[_0x9068('0x13')][_0x9068('0x15')]);return _0x141e26(_0x364bd5['error'][_0x9068('0x15')]);}logger[_0x9068('0x13')]('MailAccount,\x20%s,\x20%s',_0x1c63d2,_0x364bd5[_0x9068('0x13')][_0x9068('0x15')]);return _0x451a17(_0x364bd5[_0x9068('0x13')][_0x9068('0x15')]);}else{logger['info'](_0x9068('0xf'),_0x1c63d2,_0x9068('0x10'));_0x451a17(_0x364bd5[_0x9068('0x16')][_0x9068('0x15')]);}})[_0x9068('0x17')](function(_0x1d09bf){logger[_0x9068('0x13')](_0x9068('0xf'),_0x1c63d2,_0x1d09bf);_0x141e26(_0x1d09bf);});});}exports[_0x9068('0x18')]=function(_0x5844b6){var _0x409a02=this;return new Promise(function(_0x39ed88,_0x424f73){return db[_0x9068('0x19')][_0x9068('0x1a')]({'raw':_0x5844b6[_0x9068('0x1b')]?_0x5844b6[_0x9068('0x1b')][_0x9068('0x1c')]===undefined?!![]:![]:!![],'where':_0x5844b6['options']?_0x5844b6['options']['where']||null:null,'attributes':_0x5844b6[_0x9068('0x1b')]?_0x5844b6['options']['attributes']||null:null,'limit':_0x5844b6[_0x9068('0x1b')]?_0x5844b6[_0x9068('0x1b')][_0x9068('0x1d')]||null:null,'include':_0x5844b6[_0x9068('0x1b')]?_0x5844b6['options'][_0x9068('0x1e')]?_[_0x9068('0x1f')](_0x5844b6[_0x9068('0x1b')][_0x9068('0x1e')],function(_0x12f17f){return{'model':db[_0x12f17f[_0x9068('0x20')]],'as':_0x12f17f['as'],'attributes':_0x12f17f['attributes'],'include':_0x12f17f[_0x9068('0x1e')]?_[_0x9068('0x1f')](_0x12f17f['include'],function(_0x12369a){return{'model':db[_0x12369a[_0x9068('0x20')]],'as':_0x12369a['as'],'attributes':_0x12369a['attributes'],'include':_0x12369a['include']?_[_0x9068('0x1f')](_0x12369a['include'],function(_0x1d197a){return{'model':db[_0x1d197a[_0x9068('0x20')]],'as':_0x1d197a['as'],'attributes':_0x1d197a[_0x9068('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9068('0x22')](function(_0x2f14ab){logger['info'](_0x9068('0x18'),_0x5844b6);logger[_0x9068('0x23')](_0x9068('0x18'),_0x5844b6,JSON[_0x9068('0x12')](_0x2f14ab));_0x39ed88(_0x2f14ab);})['catch'](function(_0x5a49b8){logger[_0x9068('0x13')](_0x9068('0x18'),_0x5a49b8[_0x9068('0x15')],_0x5844b6);_0x424f73(_0x409a02[_0x9068('0x13')](0x1f4,_0x5a49b8[_0x9068('0x15')]));});});};exports[_0x9068('0x24')]=function(_0x1c130b){var _0x31d1f6=this;return new Promise(function(_0xcd8a0d,_0x339b03){return db['MailAccount'][_0x9068('0x25')]({'raw':_0x1c130b[_0x9068('0x1b')]?_0x1c130b[_0x9068('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1c130b[_0x9068('0x1b')]?_0x1c130b[_0x9068('0x1b')][_0x9068('0x26')]||null:null,'attributes':_0x1c130b[_0x9068('0x1b')]?_0x1c130b['options'][_0x9068('0x21')]||null:null,'include':_0x1c130b['options']?_0x1c130b[_0x9068('0x1b')]['include']?_[_0x9068('0x1f')](_0x1c130b[_0x9068('0x1b')][_0x9068('0x1e')],function(_0x526c3a){return{'model':db[_0x526c3a[_0x9068('0x20')]],'as':_0x526c3a['as'],'attributes':_0x526c3a['attributes'],'include':_0x526c3a[_0x9068('0x1e')]?_[_0x9068('0x1f')](_0x526c3a[_0x9068('0x1e')],function(_0x247a76){return{'model':db[_0x247a76[_0x9068('0x20')]],'as':_0x247a76['as'],'attributes':_0x247a76[_0x9068('0x21')],'include':_0x247a76[_0x9068('0x1e')]?_[_0x9068('0x1f')](_0x247a76[_0x9068('0x1e')],function(_0x509483){return{'model':db[_0x509483[_0x9068('0x20')]],'as':_0x509483['as'],'attributes':_0x509483[_0x9068('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9068('0x22')](function(_0xe6f096){if(_0x1c130b['options']['smtp']===!![])_0xe6f096[_0x9068('0x27')](_0x9068('0x28'),_0xe6f096[_0x9068('0x29')]());logger[_0x9068('0xe')](_0x9068('0x24'),_0x1c130b);logger[_0x9068('0x23')](_0x9068('0x24'),_0x1c130b,JSON[_0x9068('0x12')](_0xe6f096));_0xcd8a0d(_0xe6f096);})[_0x9068('0x17')](function(_0x58e2a4){logger[_0x9068('0x13')](_0x9068('0x24'),_0x58e2a4[_0x9068('0x15')],_0x1c130b);_0x339b03(_0x31d1f6[_0x9068('0x13')](0x1f4,_0x58e2a4[_0x9068('0x15')]));});});};exports[_0x9068('0x2a')]=function(_0x3c4b6a){var _0x93800d=this;return new Promise(function(_0x53201f,_0x145881){var _0x45eb4c={'body':_0x3c4b6a[_0x9068('0x2b')],'channel':_0x9068('0x2c')};var _0x49f711=_[_0x9068('0x2d')](_['keys'](db[_0x9068('0x2e')]['rawAttributes']),[_0x9068('0x2f'),_0x9068('0x30'),_0x9068('0x31'),_0x9068('0x32')]);var _0x4a1efd=![];if(_0x3c4b6a[_0x9068('0x2b')]['id']){delete _0x3c4b6a[_0x9068('0x2b')]['id'];}if(_[_0x9068('0x33')](_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x34')])){return _0x145881(_0x93800d[_0x9068('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x2b')])||_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x2b')]===''){return _0x145881(_0x93800d[_0x9068('0x13')](0x1f4,_0x9068('0x35')));}if(_[_0x9068('0x33')](_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x36')])){return _0x145881(_0x93800d[_0x9068('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49f711));}if(!_[_0x9068('0x37')](_0x49f711,_0x3c4b6a[_0x9068('0x2b')]['mapKey'])){return _0x145881(_0x93800d[_0x9068('0x13')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49f711));}var _0xad12b7={};_0xad12b7[_0x3c4b6a['body'][_0x9068('0x36')]]=_0x3c4b6a[_0x9068('0x2b')]['from'];return db[_0x9068('0x19')][_0x9068('0x25')]({'where':{'id':_0x3c4b6a[_0x9068('0x38')]['id']},'include':[{'model':db[_0x9068('0x39')],'as':'List','include':[{'model':db[_0x9068('0x2e')],'as':_0x9068('0x3a'),'where':_0xad12b7,'limit':0x1,'order':[['updatedAt',_0x9068('0x3b')]]}]},{'model':db[_0x9068('0x3c')],'as':_0x9068('0x3d')},{'model':db[_0x9068('0x3e')],'as':_0x9068('0x3f'),'include':[{'model':db[_0x9068('0x40')],'as':_0x9068('0x40')}]}]})['then'](function(_0x49513f){if(_0x49513f&&_0x49513f['List']){var _0x5e29b5=_0x49513f['get']({'plain':!![]});_0x45eb4c[_0x9068('0x38')]=_[_0x9068('0x41')](_0x5e29b5,[_0x9068('0x3d'),_0x9068('0x42')]);_0x45eb4c[_0x9068('0x38')][_0x9068('0x28')]=_0x49513f['getSmtpOptions']();_0x45eb4c[_0x9068('0x43')]=_0x5e29b5['Applications'];_0x45eb4c[_0x9068('0x44')]=_0x5e29b5[_0x9068('0x42')];_0x45eb4c['applications']=_[_0x9068('0x45')](_0x45eb4c[_0x9068('0x43')],[_0x9068('0x46')],[_0x9068('0x47')]);if(_0x45eb4c[_0x9068('0x38')]&&_0x45eb4c[_0x9068('0x38')][_0x9068('0x48')]){_0x45eb4c[_0x9068('0x43')][_0x9068('0x49')]({'id':0x0,'priority':_0x45eb4c[_0x9068('0x43')][_0x9068('0x4a')]+0x1,'app':_0x9068('0x4b'),'appdata':_0x9068('0x48'),'interval':_0x9068('0x4c')});}if(_0x45eb4c[_0x9068('0x38')][_0x9068('0x3d')]){delete _0x45eb4c[_0x9068('0x38')][_0x9068('0x3d')];}if(_0x45eb4c[_0x9068('0x38')]['List']){delete _0x45eb4c[_0x9068('0x38')][_0x9068('0x42')];}if(_0x5e29b5['List'][_0x9068('0x3a')]['length']){return _0x5e29b5[_0x9068('0x42')][_0x9068('0x3a')][0x0];}var _0x44638f=_[_0x9068('0x4d')](_0x3c4b6a[_0x9068('0x2b')],{'firstName':_0x3c4b6a[_0x9068('0x2b')]['from'],'ListId':_0x5e29b5[_0x9068('0x32')]});_0x44638f[_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x36')]]=_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x34')];return db['CmContact'][_0x9068('0x4e')](_0x44638f);}else{throw new Error(_0x9068('0x4f'));}})[_0x9068('0x22')](function(_0x5a65e9){_0x45eb4c['contact']=_0x5a65e9;if(_0x5a65e9){if(!_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x50')]){_0x3c4b6a[_0x9068('0x2b')]['message']['messageId']=rs['generate']()+'\x20'+_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')]['from'];}var _0x553ee4={'ContactId':_0x5a65e9['id'],'MailAccountId':_0x3c4b6a[_0x9068('0x38')]['id'],'inReplyTo':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x50')],'to':_0x3c4b6a[_0x9068('0x2b')]['message'][_0x9068('0x34')],'cc':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')]['cc'],'subject':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x51')],'attach':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x52')],'lastMsgAt':moment()[_0x9068('0x53')](_0x9068('0x54')),'lastMsgDirection':'in'};return db[_0x9068('0x55')][_0x9068('0x25')]({'where':{'closed':![],'MailAccountId':_0x3c4b6a['account']['id']},'include':[{'model':db[_0x9068('0x56')],'as':_0x9068('0x57'),'attributes':['messageId'],'where':{'messageId':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x58')]}}]})[_0x9068('0x22')](function(_0x3d7112){if(_0x3d7112){return[_0x3d7112,![]];}return db[_0x9068('0x55')][_0x9068('0x4e')](_0x553ee4)['then'](function(_0x4aedb4){return[_0x4aedb4,!![]];});});}else{throw new Error(_0x9068('0x59'));}})['spread'](function(_0x591770,_0x12c95b){if(_0x591770){_0x4a1efd=_0x12c95b;if(!_0x12c95b){return _0x591770[_0x9068('0x5a')]({'inReplyTo':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x50')],'to':_0x3c4b6a[_0x9068('0x2b')]['message']['from'],'cc':_0x3c4b6a['body']['message']['cc'],'subject':_0x3c4b6a[_0x9068('0x2b')]['message'][_0x9068('0x51')],'attach':_0x591770[_0x9068('0x52')]?_0x591770['attach']:_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x52')],'substatus':null,'substatusAt':moment()[_0x9068('0x53')](_0x9068('0x54')),'lastMsgAt':moment()[_0x9068('0x53')](_0x9068('0x54')),'lastMsgDirection':'in'});}else{return _0x591770;}}})[_0x9068('0x22')](function(_0x5273c1){_0x45eb4c[_0x9068('0x5b')]=_0x5273c1[_0x9068('0x5c')]({'plain':!![]});_0x45eb4c[_0x9068('0x5b')][_0x9068('0x5d')]=_0x4a1efd;return db[_0x9068('0x56')][_0x9068('0x4e')]({'body':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x2b')],'MailAccountId':_0x3c4b6a[_0x9068('0x38')]['id'],'MailInteractionId':_0x5273c1['id'],'direction':'in','ContactId':_0x45eb4c[_0x9068('0x5e')]['id'],'messageId':_0x3c4b6a['body'][_0x9068('0x15')]['messageId'],'from':_0x3c4b6a['body']['message'][_0x9068('0x34')],'to':_0x3c4b6a[_0x9068('0x2b')]['message']['to'],'cc':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')]['cc'],'subject':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')]['subject'],'attach':_0x3c4b6a[_0x9068('0x2b')]['message'][_0x9068('0x52')],'Attachments':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x5f')],'originTo':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x60')],'originCc':_0x3c4b6a[_0x9068('0x2b')]['message'][_0x9068('0x61')],'bcc':_0x3c4b6a['body']['message'][_0x9068('0x62')],'ChatWebsiteId':_0x3c4b6a[_0x9068('0x2b')]['message'][_0x9068('0x63')]||null,'originChannel':_0x3c4b6a[_0x9068('0x2b')][_0x9068('0x15')][_0x9068('0x64')]||'Email','ChatOfflineMessageId':_0x3c4b6a[_0x9068('0x2b')]['message'][_0x9068('0x65')]||null},{'include':[{'model':db[_0x9068('0x66')],'as':_0x9068('0x67')}]});})['then'](function(_0x2f2ba7){_0x45eb4c[_0x9068('0x15')]=_0x2f2ba7;if(!_0x45eb4c[_0x9068('0x5b')][_0x9068('0x68')]){return;}return db[_0x9068('0x69')]['find']({'attributes':['id',_0x9068('0x6a')],'where':{'id':_0x45eb4c['interaction'][_0x9068('0x68')]}});})[_0x9068('0x22')](function(_0x30bde5){if(_0x30bde5){_0x45eb4c[_0x9068('0x43')][_0x9068('0x6b')]({'id':0x0,'priority':0x0,'app':_0x9068('0x6c'),'appdata':_0x30bde5[_0x9068('0x6a')]+','+(_0x45eb4c[_0x9068('0x38')][_0x9068('0x6d')]||0xa),'interval':_0x9068('0x4c')});}if(!_0x45eb4c['interaction'][_0x9068('0x6e')]){return;}return db[_0x9068('0x6f')][_0x9068('0x25')]({'attributes':['id','name'],'where':{'id':_0x45eb4c['interaction'][_0x9068('0x6e')]}});})[_0x9068('0x22')](function(_0x1ffeb8){if(_0x1ffeb8){_0x45eb4c[_0x9068('0x43')][_0x9068('0x6b')]({'id':0x0,'priority':0x1,'app':_0x9068('0x70'),'appdata':_0x1ffeb8[_0x9068('0x6a')]+','+(_0x45eb4c[_0x9068('0x38')][_0x9068('0x71')]||0x12c),'interval':_0x9068('0x4c')});}return respondWithRpcPromise(_0x9068('0x72'),_0x9068('0x73'),_0x45eb4c);})[_0x9068('0x22')](function(_0x4d0a62){_0x53201f(_0x4d0a62);})[_0x9068('0x17')](function(_0x344755){_0x145881(_0x93800d[_0x9068('0x13')](0x1f4,_0x344755[_0x9068('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b39e5af..3503638 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 _0xa7c0=['save','remove','update','emit','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x4b83de,_0x326e68){var _0x5f5287=function(_0xfc6856){while(--_0xfc6856){_0x4b83de['push'](_0x4b83de['shift']());}};_0x5f5287(++_0x326e68);}(_0xa7c0,0xd7));var _0x0a7c=function(_0x14885d,_0x4b8950){_0x14885d=_0x14885d-0x0;var _0x209e7a=_0xa7c0[_0x14885d];return _0x209e7a;};'use strict';var MailAccountEvents=require(_0x0a7c('0x0'));var events=[_0x0a7c('0x1'),_0x0a7c('0x2'),_0x0a7c('0x3')];function createListener(_0x370164,_0x126b5c){return function(_0x62e781){_0x126b5c[_0x0a7c('0x4')](_0x370164,_0x62e781);};}function removeListener(_0x3a00cd,_0x315288){return function(){MailAccountEvents[_0x0a7c('0x5')](_0x3a00cd,_0x315288);};}exports['register']=function(_0x2d82c6){for(var _0x51fdfd=0x0,_0x59f556=events[_0x0a7c('0x6')];_0x51fdfd<_0x59f556;_0x51fdfd++){var _0x4f6faf=events[_0x51fdfd];var _0x1a423d=createListener(_0x0a7c('0x7')+_0x4f6faf,_0x2d82c6);MailAccountEvents['on'](_0x4f6faf,_0x1a423d);}}; \ No newline at end of file +var _0x06a3=['./mailAccount.events','save','update','emit','removeListener','register','length','mailAccount:'];(function(_0x39c0f8,_0x3d2859){var _0x4a7dbd=function(_0x10b188){while(--_0x10b188){_0x39c0f8['push'](_0x39c0f8['shift']());}};_0x4a7dbd(++_0x3d2859);}(_0x06a3,0xa0));var _0x306a=function(_0x3c7f1d,_0x44b37b){_0x3c7f1d=_0x3c7f1d-0x0;var _0xd7ab0c=_0x06a3[_0x3c7f1d];return _0xd7ab0c;};'use strict';var MailAccountEvents=require(_0x306a('0x0'));var events=[_0x306a('0x1'),'remove',_0x306a('0x2')];function createListener(_0x2e775e,_0x36612d){return function(_0x2ab1c5){_0x36612d[_0x306a('0x3')](_0x2e775e,_0x2ab1c5);};}function removeListener(_0x126ae5,_0x4237a3){return function(){MailAccountEvents[_0x306a('0x4')](_0x126ae5,_0x4237a3);};}exports[_0x306a('0x5')]=function(_0x52ef99){for(var _0x47a5f0=0x0,_0x5338d7=events[_0x306a('0x6')];_0x47a5f0<_0x5338d7;_0x47a5f0++){var _0x3e4cef=events[_0x47a5f0];var _0x355510=createListener(_0x306a('0x7')+_0x3e4cef,_0x52ef99);MailAccountEvents['on'](_0x3e4cef,_0x355510);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9ad3b5f..1979c10 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 _0x067d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x4cf0b7,_0x17821b){var _0x8a50d9=function(_0x403675){while(--_0x403675){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x8a50d9(++_0x17821b);}(_0x067d,0x83));var _0xd067=function(_0xbc13e1,_0x14d88b){_0xbc13e1=_0xbc13e1-0x0;var _0xa87f5a=_0x067d[_0xbc13e1];return _0xa87f5a;};'use strict';var multer=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var path=require(_0xd067('0x2'));var timeout=require(_0xd067('0x3'));var express=require(_0xd067('0x4'));var router=express[_0xd067('0x5')]();var fs_extra=require(_0xd067('0x6'));var auth=require(_0xd067('0x7'));var interaction=require(_0xd067('0x8'));var config=require(_0xd067('0x9'));var controller=require(_0xd067('0xa'));router[_0xd067('0xb')](_0xd067('0xc'),auth[_0xd067('0xd')](),controller['show']);router[_0xd067('0xe')](_0xd067('0xc'),auth[_0xd067('0xd')](),controller[_0xd067('0xf')]);router['delete'](_0xd067('0xc'),auth['isAuthenticated'](),controller[_0xd067('0x10')]);module['exports']=router; \ No newline at end of file +var _0x648b=['update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','put','isAuthenticated'];(function(_0x1786ec,_0x8eef69){var _0x33ede0=function(_0x58bedb){while(--_0x58bedb){_0x1786ec['push'](_0x1786ec['shift']());}};_0x33ede0(++_0x8eef69);}(_0x648b,0x170));var _0xb648=function(_0x59d993,_0xda245e){_0x59d993=_0x59d993-0x0;var _0xd463d9=_0x648b[_0x59d993];return _0xd463d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb648('0x0'));var timeout=require(_0xb648('0x1'));var express=require(_0xb648('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb648('0x3'));var config=require(_0xb648('0x4'));var controller=require(_0xb648('0x5'));router['get'](_0xb648('0x6'),auth['isAuthenticated'](),controller['show']);router[_0xb648('0x7')]('/:id',auth[_0xb648('0x8')](),controller[_0xb648('0x9')]);router[_0xb648('0xa')](_0xb648('0x6'),auth[_0xb648('0x8')](),controller[_0xb648('0xb')]);module[_0xb648('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 79e7e9c..21db7a9 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 _0x6854=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0xb99145,_0x25e720){var _0x3a44cc=function(_0x538e72){while(--_0x538e72){_0xb99145['push'](_0xb99145['shift']());}};_0x3a44cc(++_0x25e720);}(_0x6854,0x14f));var _0x4685=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0x6854[_0x393500];return _0x120d3b;};'use strict';var Sequelize=require(_0x4685('0x0'));module[_0x4685('0x1')]={'priority':{'type':Sequelize[_0x4685('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4685('0x3')},'appdata':{'type':Sequelize[_0x4685('0x4')]()},'description':{'type':Sequelize[_0x4685('0x5')]},'interval':{'type':Sequelize[_0x4685('0x5')],'defaultValue':_0x4685('0x6')}}; \ No newline at end of file +var _0x85da=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x181fe8,_0x5e0526){var _0x28c87d=function(_0x5bcd75){while(--_0x5bcd75){_0x181fe8['push'](_0x181fe8['shift']());}};_0x28c87d(++_0x5e0526);}(_0x85da,0xd4));var _0xa85d=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x85da[_0x322522];return _0x293bcf;};'use strict';var Sequelize=require(_0xa85d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa85d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa85d('0x2')],'allowNull':![],'defaultValue':_0xa85d('0x3')},'appdata':{'type':Sequelize[_0xa85d('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa85d('0x2')],'defaultValue':_0xa85d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index f2f8a91..e864f33 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x1e9f66,_0x19c970){var _0x4f1f02=function(_0x5825de){while(--_0x5825de){_0x1e9f66['push'](_0x1e9f66['shift']());}};_0x4f1f02(++_0x19c970);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x2f06e0,_0x2e1c2a){var _0xf2711b=function(_0x32036c){while(--_0x32036c){_0x2f06e0['push'](_0x2f06e0['shift']());}};_0xf2711b(++_0x2e1c2a);}(_0xe706,0xa3));var _0x6e70=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xe706[_0x2ddfd9];return _0x2668f0;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7dec85a..8ca1144 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 _0xc8aa=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc8aa,0x123));var _0xac8a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc8aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xac8a('0x0'));var util=require(_0xac8a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xac8a('0x2'));var BPromise=require(_0xac8a('0x3'));var rp=require(_0xac8a('0x4'));var fs=require('fs');var path=require(_0xac8a('0x5'));var rimraf=require(_0xac8a('0x6'));var config=require(_0xac8a('0x7'));var attributes=require(_0xac8a('0x8'));module[_0xac8a('0x9')]=function(_0x4b2d5b,_0xa75ff5){return _0x4b2d5b[_0xac8a('0xa')]('MailApplication',attributes,{'tableName':_0xac8a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac8a('0xc'),'collate':_0xac8a('0xd')});}; \ No newline at end of file +var _0x9278=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','rimraf','./mailApplication.attributes','exports','define','MailApplication'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x9278,0x15f));var _0x8927=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9278[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x8927('0x0'));var util=require(_0x8927('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8927('0x2'));var BPromise=require('bluebird');var rp=require(_0x8927('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8927('0x4'));var config=require('../../config/environment');var attributes=require(_0x8927('0x5'));module[_0x8927('0x6')]=function(_0x33b153,_0x387d06){return _0x33b153[_0x8927('0x7')](_0x8927('0x8'),attributes,{'tableName':_0x8927('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8927('0xa'),'collate':_0x8927('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9be4e67..e4d4914 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 _0x7b5e=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','where','attributes','lodash','moment','bluebird'];(function(_0x1a63b6,_0x45b328){var _0xb75519=function(_0x303652){while(--_0x303652){_0x1a63b6['push'](_0x1a63b6['shift']());}};_0xb75519(++_0x45b328);}(_0x7b5e,0x131));var _0xe7b5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7b5e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe7b5('0x0'));var util=require('util');var moment=require(_0xe7b5('0x1'));var BPromise=require(_0xe7b5('0x2'));var rs=require(_0xe7b5('0x3'));var fs=require('fs');var Redis=require(_0xe7b5('0x4'));var db=require(_0xe7b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7b5('0x6'))('rpc');var config=require(_0xe7b5('0x7'));var jayson=require(_0xe7b5('0x8'));var client=jayson[_0xe7b5('0x9')][_0xe7b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x585a23,_0x4df397,_0x14dbf4){return new BPromise(function(_0x5ac82f,_0x3cf03a){return client['request'](_0x585a23,_0x14dbf4)[_0xe7b5('0xb')](function(_0x2dcaec){logger[_0xe7b5('0xc')](_0xe7b5('0xd'),_0x4df397,'request\x20sent');logger[_0xe7b5('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x4df397,_0xe7b5('0xf'),JSON[_0xe7b5('0x10')](_0x2dcaec));if(_0x2dcaec[_0xe7b5('0x11')]){if(_0x2dcaec[_0xe7b5('0x11')][_0xe7b5('0x12')]===0x1f4){logger[_0xe7b5('0x11')](_0xe7b5('0xd'),_0x4df397,_0x2dcaec[_0xe7b5('0x11')][_0xe7b5('0x13')]);return _0x3cf03a(_0x2dcaec[_0xe7b5('0x11')][_0xe7b5('0x13')]);}logger[_0xe7b5('0x11')](_0xe7b5('0xd'),_0x4df397,_0x2dcaec[_0xe7b5('0x11')][_0xe7b5('0x13')]);return _0x5ac82f(_0x2dcaec[_0xe7b5('0x11')][_0xe7b5('0x13')]);}else{logger[_0xe7b5('0xc')](_0xe7b5('0xd'),_0x4df397,'request\x20sent');_0x5ac82f(_0x2dcaec[_0xe7b5('0x14')][_0xe7b5('0x13')]);}})[_0xe7b5('0x15')](function(_0x5b6ecd){logger[_0xe7b5('0x11')](_0xe7b5('0xd'),_0x4df397,_0x5b6ecd);_0x3cf03a(_0x5b6ecd);});});}exports[_0xe7b5('0x16')]=function(_0x161e10){var _0x39529a=this;return new Promise(function(_0x5299ab,_0xc15af7){return db['MailApplication'][_0xe7b5('0x17')](_0x161e10[_0xe7b5('0x18')],{'raw':_0x161e10[_0xe7b5('0x19')]?_0x161e10[_0xe7b5('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x161e10[_0xe7b5('0x19')]?_0x161e10[_0xe7b5('0x19')][_0xe7b5('0x1a')]||null:null,'attributes':_0x161e10[_0xe7b5('0x19')]?_0x161e10[_0xe7b5('0x19')][_0xe7b5('0x1b')]||null:null,'limit':_0x161e10[_0xe7b5('0x19')]?_0x161e10[_0xe7b5('0x19')]['limit']||null:null})[_0xe7b5('0xb')](function(_0x5e9c6c){logger[_0xe7b5('0xc')]('UpdateMailApplication',_0x161e10);logger[_0xe7b5('0xe')](_0xe7b5('0x16'),_0x161e10,JSON['stringify'](_0x5e9c6c));_0x5299ab(_0x5e9c6c);})['catch'](function(_0x370b4e){logger[_0xe7b5('0x11')]('UpdateMailApplication',_0x370b4e['message'],_0x161e10);_0xc15af7(_0x39529a[_0xe7b5('0x11')](0x1f4,_0x370b4e[_0xe7b5('0x13')]));});});}; \ No newline at end of file +var _0x2ac2=['code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','stringify','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x323af7,_0x296299){var _0xf4fc4a=function(_0x78faab){while(--_0x78faab){_0x323af7['push'](_0x323af7['shift']());}};_0xf4fc4a(++_0x296299);}(_0x2ac2,0x125));var _0x22ac=function(_0x1b1964,_0x3577ce){_0x1b1964=_0x1b1964-0x0;var _0x565549=_0x2ac2[_0x1b1964];return _0x565549;};'use strict';var _=require('lodash');var util=require(_0x22ac('0x0'));var moment=require('moment');var BPromise=require(_0x22ac('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x22ac('0x2'));var logger=require(_0x22ac('0x3'))(_0x22ac('0x4'));var config=require('../../config/environment');var jayson=require(_0x22ac('0x5'));var client=jayson[_0x22ac('0x6')][_0x22ac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31cf7b,_0x6d9193,_0x3c95ca){return new BPromise(function(_0x3c5cc2,_0x2f7c75){return client['request'](_0x31cf7b,_0x3c95ca)[_0x22ac('0x8')](function(_0x6948bb){logger[_0x22ac('0x9')](_0x22ac('0xa'),_0x6d9193,_0x22ac('0xb'));logger[_0x22ac('0xc')](_0x22ac('0xd'),_0x6d9193,'request\x20sent',JSON['stringify'](_0x6948bb));if(_0x6948bb[_0x22ac('0xe')]){if(_0x6948bb[_0x22ac('0xe')][_0x22ac('0xf')]===0x1f4){logger[_0x22ac('0xe')](_0x22ac('0xa'),_0x6d9193,_0x6948bb[_0x22ac('0xe')][_0x22ac('0x10')]);return _0x2f7c75(_0x6948bb['error'][_0x22ac('0x10')]);}logger[_0x22ac('0xe')](_0x22ac('0xa'),_0x6d9193,_0x6948bb[_0x22ac('0xe')][_0x22ac('0x10')]);return _0x3c5cc2(_0x6948bb[_0x22ac('0xe')][_0x22ac('0x10')]);}else{logger[_0x22ac('0x9')](_0x22ac('0xa'),_0x6d9193,_0x22ac('0xb'));_0x3c5cc2(_0x6948bb[_0x22ac('0x11')][_0x22ac('0x10')]);}})[_0x22ac('0x12')](function(_0x7b9449){logger['error'](_0x22ac('0xa'),_0x6d9193,_0x7b9449);_0x2f7c75(_0x7b9449);});});}exports[_0x22ac('0x13')]=function(_0xff484e){var _0x39b24b=this;return new Promise(function(_0x9bad09,_0x2e59c5){return db[_0x22ac('0x14')]['update'](_0xff484e[_0x22ac('0x15')],{'raw':_0xff484e[_0x22ac('0x16')]?_0xff484e[_0x22ac('0x16')][_0x22ac('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xff484e['options']?_0xff484e[_0x22ac('0x16')][_0x22ac('0x18')]||null:null,'attributes':_0xff484e['options']?_0xff484e[_0x22ac('0x16')][_0x22ac('0x19')]||null:null,'limit':_0xff484e[_0x22ac('0x16')]?_0xff484e[_0x22ac('0x16')][_0x22ac('0x1a')]||null:null})['then'](function(_0x876277){logger[_0x22ac('0x9')]('UpdateMailApplication',_0xff484e);logger[_0x22ac('0xc')](_0x22ac('0x13'),_0xff484e,JSON[_0x22ac('0x1b')](_0x876277));_0x9bad09(_0x876277);})[_0x22ac('0x12')](function(_0x32ffc7){logger['error']('UpdateMailApplication',_0x32ffc7[_0x22ac('0x10')],_0xff484e);_0x2e59c5(_0x39b24b[_0x22ac('0xe')](0x1f4,_0x32ffc7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index cd6d54f..fa2f98c 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 _0xaabf=['index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','/:id/tags','addTags','put','mail','mailinteraction:update','update','delete','tracked','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x530c6a,_0x146116){var _0x840a27=function(_0x1b92e8){while(--_0x1b92e8){_0x530c6a['push'](_0x530c6a['shift']());}};_0x840a27(++_0x146116);}(_0xaabf,0x1e9));var _0xfaab=function(_0x1ab6f1,_0x2fef8f){_0x1ab6f1=_0x1ab6f1-0x0;var _0xc2ee6b=_0xaabf[_0x1ab6f1];return _0xc2ee6b;};'use strict';var express=require(_0xfaab('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfaab('0x1'));var controller=require(_0xfaab('0x2'));router[_0xfaab('0x3')]('/',auth[_0xfaab('0x4')](),controller[_0xfaab('0x5')]);router[_0xfaab('0x3')](_0xfaab('0x6'),auth[_0xfaab('0x4')](),controller[_0xfaab('0x7')]);router['get'](_0xfaab('0x8'),auth['isAuthenticated'](),controller[_0xfaab('0x9')]);router['get'](_0xfaab('0xa'),auth[_0xfaab('0x4')](),controller['getMessages']);router[_0xfaab('0x3')](_0xfaab('0xb'),auth[_0xfaab('0x4')](),controller[_0xfaab('0xc')]);router[_0xfaab('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfaab('0xd')](_0xfaab('0xa'),auth['isAuthenticated'](),controller['addMessage']);router[_0xfaab('0xd')](_0xfaab('0xe'),auth[_0xfaab('0x4')](),interaction['tracked']('mail','mailinteraction:addtags'),controller[_0xfaab('0xf')]);router[_0xfaab('0x10')](_0xfaab('0x8'),auth[_0xfaab('0x4')](),interaction['tracked'](_0xfaab('0x11'),_0xfaab('0x12')),controller[_0xfaab('0x13')]);router[_0xfaab('0x14')]('/:id',auth[_0xfaab('0x4')](),interaction[_0xfaab('0x15')](_0xfaab('0x11'),_0xfaab('0x16')),controller[_0xfaab('0x17')]);router[_0xfaab('0x14')]('/:id/tags',auth[_0xfaab('0x4')](),controller[_0xfaab('0x18')]);module[_0xfaab('0x19')]=router; \ No newline at end of file +var _0x8a2a=['tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x55aab7,_0x5c4385){var _0x11159a=function(_0x66cdc0){while(--_0x66cdc0){_0x55aab7['push'](_0x55aab7['shift']());}};_0x11159a(++_0x5c4385);}(_0x8a2a,0x8d));var _0xa8a2=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x8a2a[_0x100682];return _0xcb6e87;};'use strict';var express=require('express');var router=express[_0xa8a2('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0xa8a2('0x1'));var controller=require(_0xa8a2('0x2'));router[_0xa8a2('0x3')]('/',auth[_0xa8a2('0x4')](),controller[_0xa8a2('0x5')]);router[_0xa8a2('0x3')]('/describe',auth[_0xa8a2('0x4')](),controller[_0xa8a2('0x6')]);router[_0xa8a2('0x3')](_0xa8a2('0x7'),auth['isAuthenticated'](),controller[_0xa8a2('0x8')]);router[_0xa8a2('0x3')](_0xa8a2('0x9'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa8a2('0x3')](_0xa8a2('0xa'),auth[_0xa8a2('0x4')](),controller['download']);router[_0xa8a2('0xb')]('/',auth[_0xa8a2('0x4')](),controller[_0xa8a2('0xc')]);router[_0xa8a2('0xb')](_0xa8a2('0x9'),auth[_0xa8a2('0x4')](),controller[_0xa8a2('0xd')]);router[_0xa8a2('0xb')](_0xa8a2('0xe'),auth['isAuthenticated'](),interaction[_0xa8a2('0xf')](_0xa8a2('0x10'),_0xa8a2('0x11')),controller[_0xa8a2('0x12')]);router['put']('/:id',auth[_0xa8a2('0x4')](),interaction[_0xa8a2('0xf')](_0xa8a2('0x10'),_0xa8a2('0x13')),controller[_0xa8a2('0x14')]);router[_0xa8a2('0x15')]('/:id',auth[_0xa8a2('0x4')](),interaction['tracked'](_0xa8a2('0x10'),_0xa8a2('0x16')),controller[_0xa8a2('0x17')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0xa8a2('0x18')]);module[_0xa8a2('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 aebf170..b736c89 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 _0x1694=['INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1694,0xf1));var _0x4169=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x1694[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x4169('0x0'));var iconv=require(_0x4169('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4169('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4169('0x3')]},'disposition':{'type':Sequelize[_0x4169('0x4')]},'secondDisposition':{'type':Sequelize[_0x4169('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4169('0x4')]},'note':{'type':Sequelize[_0x4169('0x4')]},'inReplyTo':{'type':Sequelize[_0x4169('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4169('0x5')](_0x4169('0x6'))},'subject':{'type':Sequelize[_0x4169('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4169('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x4169('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4169('0x7')]('in',_0x4169('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4169('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4169('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4169('0x9')]}}; \ No newline at end of file +var _0xad79=['INTEGER','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','out','ENUM'];(function(_0x3de979,_0x340177){var _0x249605=function(_0x426080){while(--_0x426080){_0x3de979['push'](_0x3de979['shift']());}};_0x249605(++_0x340177);}(_0xad79,0x1d7));var _0x9ad7=function(_0x199bdd,_0x5f09e2){_0x199bdd=_0x199bdd-0x0;var _0x5c4f2f=_0xad79[_0x199bdd];return _0x5c4f2f;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x9ad7('0x0'));module[_0x9ad7('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ad7('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9ad7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9ad7('0x3')]},'note':{'type':Sequelize[_0x9ad7('0x3')]},'inReplyTo':{'type':Sequelize[_0x9ad7('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9ad7('0x3')]},'cc':{'type':Sequelize[_0x9ad7('0x4')](_0x9ad7('0x5'))},'subject':{'type':Sequelize[_0x9ad7('0x4')]()},'attach':{'type':Sequelize[_0x9ad7('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9ad7('0x2')]},'substatus':{'type':Sequelize[_0x9ad7('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9ad7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9ad7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9ad7('0x8')]('in',_0x9ad7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9ad7('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9ad7('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4d755b7..a58fddd 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 _0x2a8d=['fields','attributes','includeAll','include','merge','options','create','body','find','describe','addMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','length','rows','setTags','spread','Tag','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','rawAttributes','filters','intersection'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x2a8d,0x1a4));var _0xd2a8=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x2a8d[_0x1d211b];return _0x47c88b;};'use strict';var emlformat=require(_0xd2a8('0x0'));var rimraf=require(_0xd2a8('0x1'));var zipdir=require(_0xd2a8('0x2'));var moment=require('moment');var BPromise=require(_0xd2a8('0x3'));var util=require(_0xd2a8('0x4'));var path=require(_0xd2a8('0x5'));var fs=require('fs');var _=require(_0xd2a8('0x6'));var juice=require(_0xd2a8('0x7'));var Redis=require('ioredis');var interaction=require(_0xd2a8('0x8'));var qs=require(_0xd2a8('0x9'));var logger=require('../../config/logger')(_0xd2a8('0xa'));var config=require(_0xd2a8('0xb'));var db=require(_0xd2a8('0xc'))['db'];var htmlEntities=require(_0xd2a8('0xd'));config['redis']=_[_0xd2a8('0xe')](config[_0xd2a8('0xf')],{'host':_0xd2a8('0x10'),'port':0x18eb});var socket=require(_0xd2a8('0x11'))(new Redis(config[_0xd2a8('0xf')]));require(_0xd2a8('0x12'))[_0xd2a8('0x13')](socket);function respondWithStatusCode(_0x34df50,_0x4d2fac){_0x4d2fac=_0x4d2fac||0xcc;return function(_0x5f7462){if(_0x5f7462){return _0x34df50[_0xd2a8('0x14')](_0x4d2fac);}return _0x34df50[_0xd2a8('0x15')](_0x4d2fac)[_0xd2a8('0x16')]();};}function respondWithResult(_0x45df51,_0x59524d){_0x59524d=_0x59524d||0xc8;return function(_0x324df4){if(_0x324df4){return _0x45df51[_0xd2a8('0x15')](_0x59524d)[_0xd2a8('0x17')](_0x324df4);}};}function respondWithFilteredResult(_0x7b2d81,_0x2e5d8d){return function(_0x1a42d3){if(_0x1a42d3){var _0x5624e5=typeof _0x2e5d8d[_0xd2a8('0x18')]==='undefined'&&typeof _0x2e5d8d[_0xd2a8('0x19')]===_0xd2a8('0x1a');var _0x383038=_0x1a42d3[_0xd2a8('0x1b')];var _0x59f2fd=_0x5624e5?0x0:_0x2e5d8d[_0xd2a8('0x18')];var _0x35a149=_0x5624e5?_0x1a42d3['count']:_0x2e5d8d[_0xd2a8('0x18')]+_0x2e5d8d[_0xd2a8('0x19')];var _0x32954a;if(_0x35a149>=_0x383038){_0x35a149=_0x383038;_0x32954a=0xc8;}else{_0x32954a=0xce;}_0x7b2d81[_0xd2a8('0x15')](_0x32954a);return _0x7b2d81[_0xd2a8('0x1c')](_0xd2a8('0x1d'),_0x59f2fd+'-'+_0x35a149+'/'+_0x383038)[_0xd2a8('0x17')](_0x1a42d3);}return null;};}function saveUpdates(_0x34c45e){return function(_0x59fe22){if(_0x59fe22){return _0x59fe22[_0xd2a8('0x1e')](_0x34c45e)[_0xd2a8('0x1f')](function(_0x3cce10){return _0x3cce10;});}return null;};}function removeEntity(_0x5e5ab5){return function(_0x1667e0){if(_0x1667e0){return _0x1667e0[_0xd2a8('0x20')]()[_0xd2a8('0x1f')](function(){_0x5e5ab5[_0xd2a8('0x15')](0xcc)[_0xd2a8('0x16')]();});}};}function handleEntityNotFound(_0x255c22){return function(_0x2b7fb9){if(!_0x2b7fb9){_0x255c22[_0xd2a8('0x14')](0x194);}return _0x2b7fb9;};}function handleError(_0x4dbe30,_0x2dff38){_0x2dff38=_0x2dff38||0x1f4;return function(_0x27d187){logger[_0xd2a8('0x21')](_0x27d187[_0xd2a8('0x22')]);if(_0x27d187[_0xd2a8('0x23')]){delete _0x27d187[_0xd2a8('0x23')];}_0x4dbe30[_0xd2a8('0x15')](_0x2dff38)[_0xd2a8('0x24')](_0x27d187);};}exports[_0xd2a8('0x25')]=function(_0x15de5a,_0x17fe4d){var _0x2637c4={};var _0x1c6fed=_[_0xd2a8('0x26')](db[_0xd2a8('0x27')]['rawAttributes'],function(_0x44a413){return{'name':_0x44a413[_0xd2a8('0x28')],'type':_0x44a413[_0xd2a8('0x29')][_0xd2a8('0x2a')]};});_0x2637c4=qs[_0xd2a8('0x2b')](_0x1c6fed,_0x15de5a);return interaction[_0xd2a8('0x2c')](_0xd2a8('0x2d'),_0x15de5a[_0xd2a8('0x2e')],_0x15de5a[_0xd2a8('0x2f')],_0x2637c4,_0x1c6fed)['then'](respondWithFilteredResult(_0x17fe4d,_0x2637c4))[_0xd2a8('0x30')](handleError(_0x17fe4d,null));};exports[_0xd2a8('0x31')]=function(_0xba8ce8,_0xd61108){var _0x1a00a7={'raw':![],'where':{'id':_0xba8ce8[_0xd2a8('0x32')]['id']}},_0x3320dc={};_0x3320dc[_0xd2a8('0x33')]=_[_0xd2a8('0x34')](db['MailInteraction'][_0xd2a8('0x35')]);_0x3320dc[_0xd2a8('0x2e')]=_['keys'](_0xba8ce8[_0xd2a8('0x2e')]);_0x3320dc[_0xd2a8('0x36')]=_[_0xd2a8('0x37')](_0x3320dc[_0xd2a8('0x33')],_0x3320dc[_0xd2a8('0x2e')]);_0x1a00a7['attributes']=_[_0xd2a8('0x37')](_0x3320dc[_0xd2a8('0x33')],qs[_0xd2a8('0x38')](_0xba8ce8['query'][_0xd2a8('0x38')]));_0x1a00a7[_0xd2a8('0x39')]=_0x1a00a7[_0xd2a8('0x39')]['length']?_0x1a00a7[_0xd2a8('0x39')]:_0x3320dc[_0xd2a8('0x33')];if(_0xba8ce8['query'][_0xd2a8('0x3a')]){_0x1a00a7[_0xd2a8('0x3b')]=[{'all':!![]}];}_0x1a00a7=_[_0xd2a8('0x3c')]({},_0x1a00a7,_0xba8ce8[_0xd2a8('0x3d')]);return db[_0xd2a8('0x27')]['find'](_0x1a00a7)[_0xd2a8('0x1f')](handleEntityNotFound(_0xd61108,null))[_0xd2a8('0x1f')](respondWithResult(_0xd61108,null))[_0xd2a8('0x30')](handleError(_0xd61108,null));};exports[_0xd2a8('0x3e')]=function(_0x38c603,_0x3ce316){return db[_0xd2a8('0x27')][_0xd2a8('0x3e')](_0x38c603['body'],{})[_0xd2a8('0x1f')](respondWithResult(_0x3ce316,0xc9))['catch'](handleError(_0x3ce316,null));};exports['update']=function(_0x3c4673,_0x9455f6){if(_0x3c4673[_0xd2a8('0x3f')]['id']){delete _0x3c4673[_0xd2a8('0x3f')]['id'];}return db[_0xd2a8('0x27')][_0xd2a8('0x40')]({'where':{'id':_0x3c4673[_0xd2a8('0x32')]['id']}})[_0xd2a8('0x1f')](handleEntityNotFound(_0x9455f6,null))['then'](saveUpdates(_0x3c4673['body'],null))[_0xd2a8('0x1f')](respondWithResult(_0x9455f6,null))[_0xd2a8('0x30')](handleError(_0x9455f6,null));};exports[_0xd2a8('0x20')]=function(_0x152ed4,_0x357054){return db[_0xd2a8('0x27')]['find']({'where':{'id':_0x152ed4[_0xd2a8('0x32')]['id']}})['then'](handleEntityNotFound(_0x357054,null))['then'](removeEntity(_0x357054,null))[_0xd2a8('0x30')](handleError(_0x357054,null));};exports['describe']=function(_0xaf5a03,_0x3a6063){return db[_0xd2a8('0x27')][_0xd2a8('0x41')]()['then'](respondWithResult(_0x3a6063,null))[_0xd2a8('0x30')](handleError(_0x3a6063,null));};exports[_0xd2a8('0x42')]=function(_0x2d8018,_0x370758){return db['MailMessage']['find']({'where':{'id':_0x2d8018[_0xd2a8('0x32')]['id']}})[_0xd2a8('0x1f')](handleEntityNotFound(_0x370758,null))[_0xd2a8('0x1f')](function(_0x45f719){if(_0x45f719){return _0x45f719[_0xd2a8('0x42')](_0x2d8018[_0xd2a8('0x3f')][_0xd2a8('0x43')],_[_0xd2a8('0x44')](_0x2d8018[_0xd2a8('0x3f')],[_0xd2a8('0x43'),'id'])||{});}})[_0xd2a8('0x1f')](respondWithResult(_0x370758,null))[_0xd2a8('0x30')](handleError(_0x370758,null));};exports['getMessages']=function(_0x268e38,_0x24c3c5){var _0x2d7901={'raw':![],'where':{}};var _0x3606e6={};var _0x4b5be4={'count':0x0,'rows':[]};return db[_0xd2a8('0x27')]['findOne']({'where':{'id':_0x268e38[_0xd2a8('0x32')]['id']}})['then'](handleEntityNotFound(_0x24c3c5,null))[_0xd2a8('0x1f')](function(_0x2cb26f){if(_0x2cb26f){_0x3606e6['model']=_[_0xd2a8('0x34')](db['MailMessage'][_0xd2a8('0x35')]);_0x3606e6[_0xd2a8('0x2e')]=_['keys'](_0x268e38[_0xd2a8('0x2e')]);_0x3606e6['filters']=_['intersection'](_0x3606e6[_0xd2a8('0x33')],_0x3606e6[_0xd2a8('0x2e')]);_0x2d7901[_0xd2a8('0x39')]=_[_0xd2a8('0x37')](_0x3606e6[_0xd2a8('0x33')],qs[_0xd2a8('0x38')](_0x268e38[_0xd2a8('0x2e')]['fields']));_0x2d7901['attributes']=_0x2d7901[_0xd2a8('0x39')]['length']?_0x2d7901[_0xd2a8('0x39')]:_0x3606e6[_0xd2a8('0x33')];if(!_0x268e38[_0xd2a8('0x2e')][_0xd2a8('0x45')](_0xd2a8('0x46'))){_0x2d7901['limit']=qs['limit'](_0x268e38[_0xd2a8('0x2e')]['limit']);_0x2d7901[_0xd2a8('0x18')]=qs[_0xd2a8('0x18')](_0x268e38[_0xd2a8('0x2e')][_0xd2a8('0x18')]);}_0x2d7901[_0xd2a8('0x47')]=qs[_0xd2a8('0x48')](_0x268e38[_0xd2a8('0x2e')]['sort']);_0x2d7901[_0xd2a8('0x49')]=qs['filters'](_[_0xd2a8('0x4a')](_0x268e38[_0xd2a8('0x2e')],_0x3606e6['filters']));_0x2d7901[_0xd2a8('0x49')]['MailInteractionId']=_0x2cb26f['id'];if(_0x268e38[_0xd2a8('0x2e')][_0xd2a8('0x4b')]){_0x2d7901[_0xd2a8('0x49')]=_[_0xd2a8('0x3c')](_0x2d7901[_0xd2a8('0x49')],{'$or':_['map'](_0x2d7901[_0xd2a8('0x39')],function(_0x3da6b7){var _0x25c3c9={};_0x25c3c9[_0x3da6b7]={'$like':'%'+_0x268e38[_0xd2a8('0x2e')]['filter']+'%'};return _0x25c3c9;})});}if(_0x268e38['query'][_0xd2a8('0x4c')]){var _0x303d41=_0x268e38['query'][_0xd2a8('0x4c')][_0xd2a8('0x4d')](',');var _0x59b8d2={};_0x59b8d2[_0x303d41[0x0]]={'$gte':moment(_0x303d41[0x1])[_0xd2a8('0x4e')](_0xd2a8('0x4f'))};_0x2d7901[_0xd2a8('0x49')]=_[_0xd2a8('0x3c')](_0x2d7901[_0xd2a8('0x49')],_0x59b8d2);}_0x2d7901=_['merge']({},_0x2d7901,_0x268e38[_0xd2a8('0x3d')]);return db[_0xd2a8('0x50')][_0xd2a8('0x1b')]({'where':_0x2d7901[_0xd2a8('0x49')]})['then'](function(_0x118be1){_0x4b5be4[_0xd2a8('0x1b')]=_0x118be1;if(_0x268e38[_0xd2a8('0x2e')]['includeAll']){_0x2d7901[_0xd2a8('0x3b')]=[{'all':!![]}];}return db[_0xd2a8('0x50')][_0xd2a8('0x2c')](_0x2d7901);})[_0xd2a8('0x1f')](function(_0x310f58){if(_0x268e38[_0xd2a8('0x2e')]['inlineCss']===_0xd2a8('0x51')){for(var _0x2d9089=0x0;_0x2d9089<_0x310f58[_0xd2a8('0x52')];_0x2d9089++){_0x310f58[_0x2d9089][_0xd2a8('0x3f')]=juice(_0x310f58[_0x2d9089][_0xd2a8('0x3f')]);}}_0x4b5be4[_0xd2a8('0x53')]=_0x310f58;return _0x4b5be4;});}})['then'](respondWithFilteredResult(_0x24c3c5,_0x2d7901))[_0xd2a8('0x30')](handleError(_0x24c3c5,null));};exports['addTags']=function(_0x16f94e,_0x3b42f3){return db[_0xd2a8('0x27')][_0xd2a8('0x40')]({'where':{'id':_0x16f94e[_0xd2a8('0x32')]['id']}})[_0xd2a8('0x1f')](handleEntityNotFound(_0x3b42f3,null))['then'](function(_0x1a71e1){if(_0x1a71e1){return _0x1a71e1[_0xd2a8('0x54')](_0x16f94e[_0xd2a8('0x3f')]['ids'],_[_0xd2a8('0x44')](_0x16f94e[_0xd2a8('0x3f')],[_0xd2a8('0x43'),'id'])||{})[_0xd2a8('0x55')](function(){return db[_0xd2a8('0x56')][_0xd2a8('0x2c')]({'attributes':['id',_0xd2a8('0x23'),'color'],'where':{'id':_0x16f94e[_0xd2a8('0x3f')][_0xd2a8('0x43')]}});})['then'](function(_0x393d0f){socket['emit'](_0xd2a8('0x57'),{'id':Number(_0x16f94e[_0xd2a8('0x32')]['id']),'tags':_0x393d0f||[]});return{'id':Number(_0x16f94e[_0xd2a8('0x32')]['id']),'tags':_0x393d0f||[]};});}})['then'](respondWithResult(_0x3b42f3,null))[_0xd2a8('0x30')](handleError(_0x3b42f3,null));};exports[_0xd2a8('0x58')]=function(_0x1f08b4,_0x19a7d5){return db['MailInteraction']['find']({'where':{'id':_0x1f08b4[_0xd2a8('0x32')]['id']}})[_0xd2a8('0x1f')](handleEntityNotFound(_0x19a7d5,null))[_0xd2a8('0x1f')](function(_0x5f2adf){if(_0x5f2adf){return _0x5f2adf[_0xd2a8('0x58')](_0x1f08b4[_0xd2a8('0x2e')][_0xd2a8('0x43')]);}})[_0xd2a8('0x1f')](respondWithStatusCode(_0x19a7d5,null))[_0xd2a8('0x30')](handleError(_0x19a7d5,null));};exports[_0xd2a8('0x59')]=function(_0x549bfb,_0x22f1c1){var _0x4a0a80=moment()[_0xd2a8('0x5a')]()[_0xd2a8('0x5b')]();var _0x444837=path[_0xd2a8('0x5c')](config[_0xd2a8('0x5d')],_0xd2a8('0x5e'),_0xd2a8('0x5f'),_0xd2a8('0x60'));var _0x1b6cc7=path['join'](config[_0xd2a8('0x5d')],_0xd2a8('0x5e'),_0xd2a8('0x5f'),_0xd2a8('0x61'));var _0xabeb45=path[_0xd2a8('0x5c')](_0x444837,_0x4a0a80);var _0x5785f1=util['format'](_0xd2a8('0x62'),_0x549bfb[_0xd2a8('0x32')]['id'],_0x4a0a80);var _0x52bfe7=path['join'](_0x444837,_0x5785f1);var _0x411ed7=[];if(_0x549bfb['query']['attachments']){_0x411ed7[_0xd2a8('0x63')]({'model':db[_0xd2a8('0x64')],'as':_0xd2a8('0x65'),'raw':!![]});}var _0x23dca0=[{'model':db['MailMessage'],'as':_0xd2a8('0x66'),'attributes':['id',_0xd2a8('0x3f'),_0xd2a8('0x67'),'to','cc',_0xd2a8('0x68'),_0xd2a8('0x69'),_0xd2a8('0x6a')],'where':{'secret':![]},'order':qs[_0xd2a8('0x48')]('id'),'include':_0x411ed7}];return db['MailInteraction']['find']({'where':{'id':_0x549bfb['params']['id']},'include':_0x23dca0})[_0xd2a8('0x1f')](handleEntityNotFound(_0x22f1c1,null))[_0xd2a8('0x1f')](function(_0x26201a){if(_0x26201a&&_0x26201a['Messages']){var _0x48a57f=_0x26201a['get']({'plain':!![]});fs[_0xd2a8('0x6b')](_0xabeb45);return BPromise[_0xd2a8('0x6c')](_0x48a57f[_0xd2a8('0x66')],function(_0x471fdc,_0x462a7b){var _0x78b030={'from':_0x471fdc['from'],'to':_0x471fdc['to']||_0xd2a8('0x6d'),'subject':_0x471fdc[_0xd2a8('0x69')],'html':htmlEntities[_0xd2a8('0x6e')](_0x471fdc['body']),'headers':{'Date':moment(_0x471fdc[_0xd2a8('0x6a')])['format'](_0xd2a8('0x6f'))},'attachments':[]};if(_0x471fdc['cc']){_0x78b030[_0xd2a8('0x70')]['Cc']=_0x471fdc['cc'];}if(_0x471fdc['bcc']){_0x78b030['headers'][_0xd2a8('0x71')]=_0x471fdc[_0xd2a8('0x68')];}return new BPromise(function(_0x414b4c,_0x4fa8ab){if(_0x471fdc['Attachments']){for(var _0x882edb=0x0;_0x882edb<_0x471fdc[_0xd2a8('0x65')][_0xd2a8('0x52')];_0x882edb++){var _0x3addf1=_0x471fdc[_0xd2a8('0x65')][_0x882edb];var _0x4b4bc4=path[_0xd2a8('0x5c')](_0x1b6cc7,_0x3addf1[_0xd2a8('0x72')]);if(fs['existsSync'](_0x4b4bc4)){_0x78b030[_0xd2a8('0x61')][_0xd2a8('0x63')]({'name':_0x3addf1[_0xd2a8('0x23')],'contentType':_0x3addf1['type'],'data':fs[_0xd2a8('0x73')](_0x4b4bc4)});}}}emlformat[_0xd2a8('0x74')](_0x78b030,function(_0x393c13,_0x2759bb){if(_0x393c13)return _0x4fa8ab(_0x393c13);fs[_0xd2a8('0x75')](path['join'](_0xabeb45,util['format']('message%d.eml',_0x462a7b)),_0x2759bb);return _0x414b4c(_0x2759bb);});});})[_0xd2a8('0x1f')](function(){return new BPromise(function(_0x5b13ce,_0x3452b6){zipdir(_0xabeb45,{'saveTo':_0x52bfe7},function(_0x301a95,_0x5a948d){if(_0x301a95)return _0x3452b6(_0x301a95);return _0x5b13ce(_0x5a948d);});})[_0xd2a8('0x1f')](function(){return new BPromise(function(_0x527e2b,_0xbaddfc){rimraf(_0xabeb45,function(_0x3a0c45){if(_0x3a0c45)_0xbaddfc(_0x3a0c45);return _0x527e2b();});});})['then'](function(){return _0x22f1c1[_0xd2a8('0x59')](_0x52bfe7,_0x5785f1,function(_0x58f5de){if(!_0x58f5de)fs[_0xd2a8('0x76')](_0x52bfe7);});});});}else{return _0x22f1c1['sendStatus'](0xc8);}})[_0xd2a8('0x30')](handleError(_0x22f1c1,null));}; \ No newline at end of file +var _0x0f8d=['where','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','from','bcc','createdAt','Messages','get','each','missing.recipient@your.company.com','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','then','destroy','error','stack','name','index','map','MailInteraction','fieldName','type','key','findAll','mail','query','user','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','update','describe','addMessage','ids','getMessages','findOne','MailMessage','filters','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x323e7b,_0x4bca15){var _0x13bc2c=function(_0x153686){while(--_0x153686){_0x323e7b['push'](_0x323e7b['shift']());}};_0x13bc2c(++_0x4bca15);}(_0x0f8d,0x187));var _0xd0f8=function(_0x7be910,_0x2b381b){_0x7be910=_0x7be910-0x0;var _0x496ddf=_0x0f8d[_0x7be910];return _0x496ddf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0f8('0x0'));var zipdir=require(_0xd0f8('0x1'));var moment=require(_0xd0f8('0x2'));var BPromise=require(_0xd0f8('0x3'));var util=require('util');var path=require(_0xd0f8('0x4'));var fs=require('fs');var _=require(_0xd0f8('0x5'));var juice=require(_0xd0f8('0x6'));var Redis=require(_0xd0f8('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xd0f8('0x8'))(_0xd0f8('0x9'));var config=require(_0xd0f8('0xa'));var db=require(_0xd0f8('0xb'))['db'];var htmlEntities=require(_0xd0f8('0xc'));config[_0xd0f8('0xd')]=_[_0xd0f8('0xe')](config[_0xd0f8('0xd')],{'host':_0xd0f8('0xf'),'port':0x18eb});var socket=require(_0xd0f8('0x10'))(new Redis(config[_0xd0f8('0xd')]));require(_0xd0f8('0x11'))[_0xd0f8('0x12')](socket);function respondWithStatusCode(_0x4ccfab,_0x1d9f7a){_0x1d9f7a=_0x1d9f7a||0xcc;return function(_0xaf5750){if(_0xaf5750){return _0x4ccfab[_0xd0f8('0x13')](_0x1d9f7a);}return _0x4ccfab[_0xd0f8('0x14')](_0x1d9f7a)[_0xd0f8('0x15')]();};}function respondWithResult(_0x119d54,_0x5822b7){_0x5822b7=_0x5822b7||0xc8;return function(_0x4908ce){if(_0x4908ce){return _0x119d54[_0xd0f8('0x14')](_0x5822b7)[_0xd0f8('0x16')](_0x4908ce);}};}function respondWithFilteredResult(_0x1e2b79,_0x11bc83){return function(_0x366be7){if(_0x366be7){var _0x48da58=typeof _0x11bc83[_0xd0f8('0x17')]===_0xd0f8('0x18')&&typeof _0x11bc83['limit']==='undefined';var _0x104447=_0x366be7[_0xd0f8('0x19')];var _0x45686f=_0x48da58?0x0:_0x11bc83[_0xd0f8('0x17')];var _0x82d521=_0x48da58?_0x366be7['count']:_0x11bc83['offset']+_0x11bc83['limit'];var _0x3be172;if(_0x82d521>=_0x104447){_0x82d521=_0x104447;_0x3be172=0xc8;}else{_0x3be172=0xce;}_0x1e2b79[_0xd0f8('0x14')](_0x3be172);return _0x1e2b79[_0xd0f8('0x1a')](_0xd0f8('0x1b'),_0x45686f+'-'+_0x82d521+'/'+_0x104447)['json'](_0x366be7);}return null;};}function saveUpdates(_0x25c9a4){return function(_0x234801){if(_0x234801){return _0x234801['update'](_0x25c9a4)[_0xd0f8('0x1c')](function(_0x3cd2fa){return _0x3cd2fa;});}return null;};}function removeEntity(_0x1f5442){return function(_0x33467d){if(_0x33467d){return _0x33467d[_0xd0f8('0x1d')]()['then'](function(){_0x1f5442[_0xd0f8('0x14')](0xcc)[_0xd0f8('0x15')]();});}};}function handleEntityNotFound(_0x4ee480){return function(_0x4147da){if(!_0x4147da){_0x4ee480[_0xd0f8('0x13')](0x194);}return _0x4147da;};}function handleError(_0x4501ab,_0x50b37f){_0x50b37f=_0x50b37f||0x1f4;return function(_0x3b8f5e){logger[_0xd0f8('0x1e')](_0x3b8f5e[_0xd0f8('0x1f')]);if(_0x3b8f5e[_0xd0f8('0x20')]){delete _0x3b8f5e['name'];}_0x4501ab[_0xd0f8('0x14')](_0x50b37f)['send'](_0x3b8f5e);};}exports[_0xd0f8('0x21')]=function(_0x2255f0,_0x29311d){var _0xda4803={};var _0x50f764=_[_0xd0f8('0x22')](db[_0xd0f8('0x23')]['rawAttributes'],function(_0x3ad730){return{'name':_0x3ad730[_0xd0f8('0x24')],'type':_0x3ad730[_0xd0f8('0x25')][_0xd0f8('0x26')]};});_0xda4803=qs['getOptions'](_0x50f764,_0x2255f0);return interaction[_0xd0f8('0x27')](_0xd0f8('0x28'),_0x2255f0[_0xd0f8('0x29')],_0x2255f0[_0xd0f8('0x2a')],_0xda4803,_0x50f764)[_0xd0f8('0x1c')](respondWithFilteredResult(_0x29311d,_0xda4803))[_0xd0f8('0x2b')](handleError(_0x29311d,null));};exports[_0xd0f8('0x2c')]=function(_0x565a3f,_0x2882ab){var _0x2fa5be={'raw':![],'where':{'id':_0x565a3f[_0xd0f8('0x2d')]['id']}},_0x2e29a6={};_0x2e29a6[_0xd0f8('0x2e')]=_[_0xd0f8('0x2f')](db['MailInteraction'][_0xd0f8('0x30')]);_0x2e29a6[_0xd0f8('0x29')]=_[_0xd0f8('0x2f')](_0x565a3f['query']);_0x2e29a6['filters']=_[_0xd0f8('0x31')](_0x2e29a6[_0xd0f8('0x2e')],_0x2e29a6[_0xd0f8('0x29')]);_0x2fa5be[_0xd0f8('0x32')]=_[_0xd0f8('0x31')](_0x2e29a6[_0xd0f8('0x2e')],qs[_0xd0f8('0x33')](_0x565a3f['query'][_0xd0f8('0x33')]));_0x2fa5be['attributes']=_0x2fa5be[_0xd0f8('0x32')]['length']?_0x2fa5be[_0xd0f8('0x32')]:_0x2e29a6[_0xd0f8('0x2e')];if(_0x565a3f[_0xd0f8('0x29')][_0xd0f8('0x34')]){_0x2fa5be[_0xd0f8('0x35')]=[{'all':!![]}];}_0x2fa5be=_[_0xd0f8('0x36')]({},_0x2fa5be,_0x565a3f[_0xd0f8('0x37')]);return db['MailInteraction'][_0xd0f8('0x38')](_0x2fa5be)['then'](handleEntityNotFound(_0x2882ab,null))[_0xd0f8('0x1c')](respondWithResult(_0x2882ab,null))[_0xd0f8('0x2b')](handleError(_0x2882ab,null));};exports[_0xd0f8('0x39')]=function(_0x8f6b40,_0x4a8e2b){return db[_0xd0f8('0x23')][_0xd0f8('0x39')](_0x8f6b40[_0xd0f8('0x3a')],{})['then'](respondWithResult(_0x4a8e2b,0xc9))['catch'](handleError(_0x4a8e2b,null));};exports[_0xd0f8('0x3b')]=function(_0x3f1a98,_0x293cf4){if(_0x3f1a98[_0xd0f8('0x3a')]['id']){delete _0x3f1a98[_0xd0f8('0x3a')]['id'];}return db['MailInteraction'][_0xd0f8('0x38')]({'where':{'id':_0x3f1a98[_0xd0f8('0x2d')]['id']}})[_0xd0f8('0x1c')](handleEntityNotFound(_0x293cf4,null))[_0xd0f8('0x1c')](saveUpdates(_0x3f1a98[_0xd0f8('0x3a')],null))[_0xd0f8('0x1c')](respondWithResult(_0x293cf4,null))[_0xd0f8('0x2b')](handleError(_0x293cf4,null));};exports['destroy']=function(_0x1b669e,_0x290c7e){return db[_0xd0f8('0x23')][_0xd0f8('0x38')]({'where':{'id':_0x1b669e['params']['id']}})[_0xd0f8('0x1c')](handleEntityNotFound(_0x290c7e,null))[_0xd0f8('0x1c')](removeEntity(_0x290c7e,null))[_0xd0f8('0x2b')](handleError(_0x290c7e,null));};exports[_0xd0f8('0x3c')]=function(_0x38f2d4,_0x2ce16f){return db['MailInteraction'][_0xd0f8('0x3c')]()[_0xd0f8('0x1c')](respondWithResult(_0x2ce16f,null))['catch'](handleError(_0x2ce16f,null));};exports[_0xd0f8('0x3d')]=function(_0x223a27,_0x1694d9){return db['MailMessage']['find']({'where':{'id':_0x223a27[_0xd0f8('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1694d9,null))['then'](function(_0x592c31){if(_0x592c31){return _0x592c31[_0xd0f8('0x3d')](_0x223a27['body']['ids'],_['omit'](_0x223a27[_0xd0f8('0x3a')],[_0xd0f8('0x3e'),'id'])||{});}})[_0xd0f8('0x1c')](respondWithResult(_0x1694d9,null))[_0xd0f8('0x2b')](handleError(_0x1694d9,null));};exports[_0xd0f8('0x3f')]=function(_0x495ea0,_0x727685){var _0x75f6b0={'raw':![],'where':{}};var _0x1317ce={};var _0x373857={'count':0x0,'rows':[]};return db[_0xd0f8('0x23')][_0xd0f8('0x40')]({'where':{'id':_0x495ea0[_0xd0f8('0x2d')]['id']}})[_0xd0f8('0x1c')](handleEntityNotFound(_0x727685,null))['then'](function(_0xc0efcf){if(_0xc0efcf){_0x1317ce['model']=_['keys'](db[_0xd0f8('0x41')][_0xd0f8('0x30')]);_0x1317ce[_0xd0f8('0x29')]=_[_0xd0f8('0x2f')](_0x495ea0[_0xd0f8('0x29')]);_0x1317ce[_0xd0f8('0x42')]=_['intersection'](_0x1317ce[_0xd0f8('0x2e')],_0x1317ce['query']);_0x75f6b0[_0xd0f8('0x32')]=_[_0xd0f8('0x31')](_0x1317ce[_0xd0f8('0x2e')],qs[_0xd0f8('0x33')](_0x495ea0['query'][_0xd0f8('0x33')]));_0x75f6b0['attributes']=_0x75f6b0[_0xd0f8('0x32')][_0xd0f8('0x43')]?_0x75f6b0[_0xd0f8('0x32')]:_0x1317ce[_0xd0f8('0x2e')];if(!_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x44')](_0xd0f8('0x45'))){_0x75f6b0[_0xd0f8('0x46')]=qs[_0xd0f8('0x46')](_0x495ea0['query'][_0xd0f8('0x46')]);_0x75f6b0['offset']=qs[_0xd0f8('0x17')](_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x17')]);}_0x75f6b0[_0xd0f8('0x47')]=qs[_0xd0f8('0x48')](_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x48')]);_0x75f6b0[_0xd0f8('0x49')]=qs['filters'](_['pick'](_0x495ea0[_0xd0f8('0x29')],_0x1317ce[_0xd0f8('0x42')]));_0x75f6b0[_0xd0f8('0x49')][_0xd0f8('0x4a')]=_0xc0efcf['id'];if(_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x4b')]){_0x75f6b0[_0xd0f8('0x49')]=_[_0xd0f8('0x36')](_0x75f6b0[_0xd0f8('0x49')],{'$or':_[_0xd0f8('0x22')](_0x75f6b0[_0xd0f8('0x32')],function(_0x148a1e){var _0x1e02d2={};_0x1e02d2[_0x148a1e]={'$like':'%'+_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x4b')]+'%'};return _0x1e02d2;})});}if(_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x4c')]){var _0x50874b=_0x495ea0['query'][_0xd0f8('0x4c')][_0xd0f8('0x4d')](',');var _0x3ec823={};_0x3ec823[_0x50874b[0x0]]={'$gte':moment(_0x50874b[0x1])['format'](_0xd0f8('0x4e'))};_0x75f6b0[_0xd0f8('0x49')]=_[_0xd0f8('0x36')](_0x75f6b0[_0xd0f8('0x49')],_0x3ec823);}_0x75f6b0=_[_0xd0f8('0x36')]({},_0x75f6b0,_0x495ea0['options']);return db[_0xd0f8('0x41')][_0xd0f8('0x19')]({'where':_0x75f6b0['where']})[_0xd0f8('0x1c')](function(_0x4f2162){_0x373857['count']=_0x4f2162;if(_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x34')]){_0x75f6b0['include']=[{'all':!![]}];}return db[_0xd0f8('0x41')]['findAll'](_0x75f6b0);})['then'](function(_0x1b3ec3){if(_0x495ea0[_0xd0f8('0x29')][_0xd0f8('0x4f')]===_0xd0f8('0x50')){for(var _0x20e991=0x0;_0x20e991<_0x1b3ec3[_0xd0f8('0x43')];_0x20e991++){_0x1b3ec3[_0x20e991][_0xd0f8('0x3a')]=juice(_0x1b3ec3[_0x20e991][_0xd0f8('0x3a')]);}}_0x373857['rows']=_0x1b3ec3;return _0x373857;});}})[_0xd0f8('0x1c')](respondWithFilteredResult(_0x727685,_0x75f6b0))['catch'](handleError(_0x727685,null));};exports[_0xd0f8('0x51')]=function(_0x1e5c67,_0x3621d7){return db['MailInteraction']['find']({'where':{'id':_0x1e5c67[_0xd0f8('0x2d')]['id']}})[_0xd0f8('0x1c')](handleEntityNotFound(_0x3621d7,null))[_0xd0f8('0x1c')](function(_0x5e6b97){if(_0x5e6b97){return _0x5e6b97[_0xd0f8('0x52')](_0x1e5c67['body'][_0xd0f8('0x3e')],_['omit'](_0x1e5c67['body'],[_0xd0f8('0x3e'),'id'])||{})[_0xd0f8('0x53')](function(){return db[_0xd0f8('0x54')][_0xd0f8('0x27')]({'attributes':['id',_0xd0f8('0x20'),_0xd0f8('0x55')],'where':{'id':_0x1e5c67[_0xd0f8('0x3a')][_0xd0f8('0x3e')]}});})['then'](function(_0x173931){socket['emit'](_0xd0f8('0x56'),{'id':Number(_0x1e5c67[_0xd0f8('0x2d')]['id']),'tags':_0x173931||[]});return{'id':Number(_0x1e5c67[_0xd0f8('0x2d')]['id']),'tags':_0x173931||[]};});}})[_0xd0f8('0x1c')](respondWithResult(_0x3621d7,null))[_0xd0f8('0x2b')](handleError(_0x3621d7,null));};exports[_0xd0f8('0x57')]=function(_0x38440c,_0x3d604a){return db['MailInteraction'][_0xd0f8('0x38')]({'where':{'id':_0x38440c[_0xd0f8('0x2d')]['id']}})[_0xd0f8('0x1c')](handleEntityNotFound(_0x3d604a,null))[_0xd0f8('0x1c')](function(_0x55d40e){if(_0x55d40e){return _0x55d40e[_0xd0f8('0x57')](_0x38440c[_0xd0f8('0x29')][_0xd0f8('0x3e')]);}})[_0xd0f8('0x1c')](respondWithStatusCode(_0x3d604a,null))[_0xd0f8('0x2b')](handleError(_0x3d604a,null));};exports[_0xd0f8('0x58')]=function(_0x3d7f33,_0x3a3088){var _0x5f59c0=moment()[_0xd0f8('0x59')]()[_0xd0f8('0x5a')]();var _0x3d4ddd=path[_0xd0f8('0x5b')](config[_0xd0f8('0x5c')],_0xd0f8('0x5d'),_0xd0f8('0x5e'),'tmp');var _0x3082c1=path[_0xd0f8('0x5b')](config['root'],_0xd0f8('0x5d'),_0xd0f8('0x5e'),_0xd0f8('0x5f'));var _0x3dbbac=path[_0xd0f8('0x5b')](_0x3d4ddd,_0x5f59c0);var _0x38af24=util['format'](_0xd0f8('0x60'),_0x3d7f33['params']['id'],_0x5f59c0);var _0x214a3e=path['join'](_0x3d4ddd,_0x38af24);var _0x142d49=[];if(_0x3d7f33[_0xd0f8('0x29')][_0xd0f8('0x5f')]){_0x142d49[_0xd0f8('0x61')]({'model':db[_0xd0f8('0x62')],'as':_0xd0f8('0x63'),'raw':!![]});}var _0x432830=[{'model':db[_0xd0f8('0x41')],'as':'Messages','attributes':['id',_0xd0f8('0x3a'),_0xd0f8('0x64'),'to','cc',_0xd0f8('0x65'),'subject',_0xd0f8('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x142d49}];return db[_0xd0f8('0x23')][_0xd0f8('0x38')]({'where':{'id':_0x3d7f33[_0xd0f8('0x2d')]['id']},'include':_0x432830})[_0xd0f8('0x1c')](handleEntityNotFound(_0x3a3088,null))['then'](function(_0x3e3655){if(_0x3e3655&&_0x3e3655[_0xd0f8('0x67')]){var _0x4694d7=_0x3e3655[_0xd0f8('0x68')]({'plain':!![]});fs['mkdirSync'](_0x3dbbac);return BPromise[_0xd0f8('0x69')](_0x4694d7[_0xd0f8('0x67')],function(_0x2c20b6,_0x329f3d){var _0x338c31={'from':_0x2c20b6['from'],'to':_0x2c20b6['to']||_0xd0f8('0x6a'),'subject':_0x2c20b6[_0xd0f8('0x6b')],'html':htmlEntities[_0xd0f8('0x6c')](_0x2c20b6[_0xd0f8('0x3a')]),'headers':{'Date':moment(_0x2c20b6[_0xd0f8('0x66')])['format'](_0xd0f8('0x6d'))},'attachments':[]};if(_0x2c20b6['cc']){_0x338c31[_0xd0f8('0x6e')]['Cc']=_0x2c20b6['cc'];}if(_0x2c20b6[_0xd0f8('0x65')]){_0x338c31[_0xd0f8('0x6e')]['Bcc']=_0x2c20b6[_0xd0f8('0x65')];}return new BPromise(function(_0x3ab05a,_0x50113f){if(_0x2c20b6[_0xd0f8('0x63')]){for(var _0x1caf7c=0x0;_0x1caf7c<_0x2c20b6[_0xd0f8('0x63')][_0xd0f8('0x43')];_0x1caf7c++){var _0x512e2b=_0x2c20b6[_0xd0f8('0x63')][_0x1caf7c];var _0x2ee5ed=path[_0xd0f8('0x5b')](_0x3082c1,_0x512e2b['basename']);if(fs['existsSync'](_0x2ee5ed)){_0x338c31[_0xd0f8('0x5f')]['push']({'name':_0x512e2b[_0xd0f8('0x20')],'contentType':_0x512e2b[_0xd0f8('0x25')],'data':fs[_0xd0f8('0x6f')](_0x2ee5ed)});}}}emlformat[_0xd0f8('0x70')](_0x338c31,function(_0x537ffd,_0x506442){if(_0x537ffd)return _0x50113f(_0x537ffd);fs[_0xd0f8('0x71')](path[_0xd0f8('0x5b')](_0x3dbbac,util['format'](_0xd0f8('0x72'),_0x329f3d)),_0x506442);return _0x3ab05a(_0x506442);});});})[_0xd0f8('0x1c')](function(){return new BPromise(function(_0x2c440a,_0x5edeab){zipdir(_0x3dbbac,{'saveTo':_0x214a3e},function(_0x3af029,_0x2a7e49){if(_0x3af029)return _0x5edeab(_0x3af029);return _0x2c440a(_0x2a7e49);});})['then'](function(){return new BPromise(function(_0x1daa5b,_0x5347ef){rimraf(_0x3dbbac,function(_0x10463d){if(_0x10463d)_0x5347ef(_0x10463d);return _0x1daa5b();});});})[_0xd0f8('0x1c')](function(){return _0x3a3088[_0xd0f8('0x58')](_0x214a3e,_0x38af24,function(_0x57a5ec){if(!_0x57a5ec)fs[_0xd0f8('0x73')](_0x214a3e);});});});}else{return _0x3a3088[_0xd0f8('0x13')](0xc8);}})['catch'](handleError(_0x3a3088,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6cce8a0..e4e104a 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 _0x83f2=['exports','events','MailMessage','setMaxListeners','remove','getUsers','then','length','catch','hasOwnProperty'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x83f2,0x1cd));var _0x283f=function(_0x29f158,_0x17d1a0){_0x29f158=_0x29f158-0x0;var _0x4c5420=_0x83f2[_0x29f158];return _0x4c5420;};'use strict';var EventEmitter=require(_0x283f('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x283f('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x283f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x283f('0x3')};function emitEvent(_0x1919a8){return function(_0x38fe82,_0x3aa536,_0x56891f){_0x38fe82[_0x283f('0x4')]({'attributes':['id'],'raw':!![]})[_0x283f('0x5')](function(_0x5da2e2){_0x38fe82['setDataValue']('Users',_0x5da2e2['map'](function(_0x2138de){return{'id':_0x2138de['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x38fe82['id'],'direction':'in','read':![]},'raw':!![]});})[_0x283f('0x5')](function(_0x34e55b){_0x38fe82['setDataValue']('unreadMessages',_0x34e55b[_0x283f('0x6')]);MailInteractionEvents['emit'](_0x1919a8+':'+_0x38fe82['id'],_0x38fe82);MailInteractionEvents['emit'](_0x1919a8,_0x38fe82);_0x56891f(null);})[_0x283f('0x7')](_0x56891f(null));};}for(var e in events){if(events[_0x283f('0x8')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x283f('0x9')]=MailInteractionEvents; \ No newline at end of file +var _0xd945=['exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd945,0xbc));var _0x5d94=function(_0x5cb472,_0x1491fd){_0x5cb472=_0x5cb472-0x0;var _0x5c9af2=_0xd945[_0x5cb472];return _0x5c9af2;};'use strict';var EventEmitter=require(_0x5d94('0x0'));var MailInteraction=require(_0x5d94('0x1'))['db'][_0x5d94('0x2')];var MailMessage=require(_0x5d94('0x1'))['db'][_0x5d94('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5d94('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5d94('0x5')};function emitEvent(_0x9f46d4){return function(_0x3705f1,_0x1d30a9,_0x24bcbd){_0x3705f1[_0x5d94('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x122a1a){_0x3705f1[_0x5d94('0x7')](_0x5d94('0x8'),_0x122a1a[_0x5d94('0x9')](function(_0x41653e){return{'id':_0x41653e['id']};}));return MailMessage[_0x5d94('0xa')]({'where':{'MailInteractionId':_0x3705f1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2304c2){_0x3705f1[_0x5d94('0x7')](_0x5d94('0xb'),_0x2304c2[_0x5d94('0xc')]);MailInteractionEvents['emit'](_0x9f46d4+':'+_0x3705f1['id'],_0x3705f1);MailInteractionEvents[_0x5d94('0xd')](_0x9f46d4,_0x3705f1);_0x24bcbd(null);})['catch'](_0x24bcbd(null));};}for(var e in events){if(events[_0x5d94('0xe')](e)){var event=events[e];MailInteraction[_0x5d94('0xf')](e,emitEvent(event));}}module[_0x5d94('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 54d5762..a4e00eb 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 _0x0552=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','define','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','then','catch','utf8mb4'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x0552,0xd8));var _0x2055=function(_0x26f47f,_0x1c05ae){_0x26f47f=_0x26f47f-0x0;var _0x50fe6c=_0x0552[_0x26f47f];return _0x50fe6c;};'use strict';var _=require('lodash');var util=require(_0x2055('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2055('0x1'));var BPromise=require(_0x2055('0x2'));var rp=require(_0x2055('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2055('0x4'));var config=require(_0x2055('0x5'));var attributes=require(_0x2055('0x6'));module['exports']=function(_0x3b4a95,_0x1fdaa7){return _0x3b4a95[_0x2055('0x7')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x2055('0x8'),'fields':['subject','to'],'type':_0x2055('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11e437,_0xeb3a68,_0x1b4be6){if(_0x11e437[_0x2055('0xa')]){_0x11e437[_0x2055('0xb')]=moment()[_0x2055('0xc')](_0x2055('0xd'));}if(_0x11e437['closed']){_0x11e437[_0x2055('0xe')]=moment()[_0x2055('0xc')](_0x2055('0xd'));}_0x1b4be6(null,_0xeb3a68);},'beforeUpdate':function(_0x18812c,_0x56f3f8,_0x52c256){if(_0x18812c['changed']('substatus')){_0x18812c[_0x2055('0xb')]=_0x18812c['substatus']?moment()['format'](_0x2055('0xd')):null;}if(_0x18812c[_0x2055('0xf')](_0x2055('0x10'))){_0x18812c[_0x2055('0xe')]=moment()['format'](_0x2055('0xd'));_0x18812c[_0x2055('0xa')]=null;_0x18812c[_0x2055('0xb')]=null;}_0x52c256(null,_0x18812c);},'afterUpdate':function(_0x1a8c83,_0x22bb5c,_0x167fb4){var _0x34f23f=_0x3b4a95[_0x2055('0x11')];var _0x203ee2=_0x1a8c83[_0x2055('0x12')]({'plain':!![]});if(_0x203ee2[_0x2055('0x10')]){return _0x34f23f[_0x2055('0x13')][_0x2055('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x203ee2['id']}})[_0x2055('0x15')](function(){_0x167fb4();})[_0x2055('0x16')](function(_0x756804){_0x167fb4(_0x756804);});}else{_0x167fb4();}}},'charset':_0x2055('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1397=['fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions'];(function(_0x1fe5e8,_0x7b9d54){var _0x5645ef=function(_0xe871aa){while(--_0xe871aa){_0x1fe5e8['push'](_0x1fe5e8['shift']());}};_0x5645ef(++_0x7b9d54);}(_0x1397,0x14f));var _0x7139=function(_0x38a6c6,_0x4062ca){_0x38a6c6=_0x38a6c6-0x0;var _0x142f0a=_0x1397[_0x38a6c6];return _0x142f0a;};'use strict';var _=require(_0x7139('0x0'));var util=require('util');var logger=require(_0x7139('0x1'))(_0x7139('0x2'));var moment=require(_0x7139('0x3'));var BPromise=require(_0x7139('0x4'));var rp=require(_0x7139('0x5'));var fs=require('fs');var path=require(_0x7139('0x6'));var rimraf=require(_0x7139('0x7'));var config=require(_0x7139('0x8'));var attributes=require(_0x7139('0x9'));module['exports']=function(_0x2a18de,_0x38d37f){return _0x2a18de[_0x7139('0xa')](_0x7139('0xb'),attributes,{'tableName':_0x7139('0xc'),'paranoid':![],'indexes':[{'name':_0x7139('0xd'),'fields':[_0x7139('0xe'),'to'],'type':_0x7139('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c94ec,_0x2952aa,_0x1ce76d){if(_0x3c94ec[_0x7139('0x10')]){_0x3c94ec[_0x7139('0x11')]=moment()['format'](_0x7139('0x12'));}if(_0x3c94ec[_0x7139('0x13')]){_0x3c94ec[_0x7139('0x14')]=moment()[_0x7139('0x15')](_0x7139('0x12'));}_0x1ce76d(null,_0x2952aa);},'beforeUpdate':function(_0x2b215c,_0x16f6f5,_0x5129b4){if(_0x2b215c[_0x7139('0x16')](_0x7139('0x10'))){_0x2b215c[_0x7139('0x11')]=_0x2b215c['substatus']?moment()[_0x7139('0x15')](_0x7139('0x12')):null;}if(_0x2b215c[_0x7139('0x16')](_0x7139('0x13'))){_0x2b215c[_0x7139('0x14')]=moment()[_0x7139('0x15')](_0x7139('0x12'));_0x2b215c['substatus']=null;_0x2b215c[_0x7139('0x11')]=null;}_0x5129b4(null,_0x2b215c);},'afterUpdate':function(_0x10b91b,_0x23287e,_0x31328e){var _0x4c5fe1=_0x2a18de['models'];var _0x37e464=_0x10b91b['get']({'plain':!![]});if(_0x37e464['closed']){return _0x4c5fe1[_0x7139('0x17')][_0x7139('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x37e464['id']}})[_0x7139('0x19')](function(){_0x31328e();})[_0x7139('0x1a')](function(_0x145e46){_0x31328e(_0x145e46);});}else{_0x31328e();}}},'charset':_0x7139('0x1b'),'collate':_0x7139('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 347734c..a9e2057 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 _0x084d=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','UpdateMailInteraction','MailInteraction','options','raw','where','limit','debug','stringify','AddTagsToMailInteraction','find','body','omit','ids','AddTags','lodash'];(function(_0x163c80,_0x1fc409){var _0x34c280=function(_0x1636ac){while(--_0x1636ac){_0x163c80['push'](_0x163c80['shift']());}};_0x34c280(++_0x1fc409);}(_0x084d,0x147));var _0xd084=function(_0x4fae37,_0x345fb7){_0x4fae37=_0x4fae37-0x0;var _0x58b9f0=_0x084d[_0x4fae37];return _0x58b9f0;};'use strict';var _=require(_0xd084('0x0'));var util=require(_0xd084('0x1'));var moment=require(_0xd084('0x2'));var BPromise=require(_0xd084('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd084('0x4'))['db'];var utils=require(_0xd084('0x5'));var logger=require(_0xd084('0x6'))(_0xd084('0x7'));var config=require(_0xd084('0x8'));var jayson=require(_0xd084('0x9'));var client=jayson[_0xd084('0xa')][_0xd084('0xb')]({'port':0x232a});config[_0xd084('0xc')]=_[_0xd084('0xd')](config[_0xd084('0xc')],{'host':_0xd084('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd084('0xc')]));require(_0xd084('0xf'))['register'](socket);function respondWithRpcPromise(_0x1df380,_0x5e35c7,_0x1a44b0){return new BPromise(function(_0x446148,_0x572b38){return client[_0xd084('0x10')](_0x1df380,_0x1a44b0)[_0xd084('0x11')](function(_0x26fe5e){logger[_0xd084('0x12')](_0xd084('0x13'),_0x5e35c7,_0xd084('0x14'));logger['debug'](_0xd084('0x15'),_0x5e35c7,'request\x20sent',JSON['stringify'](_0x26fe5e));if(_0x26fe5e['error']){if(_0x26fe5e['error'][_0xd084('0x16')]===0x1f4){logger[_0xd084('0x17')]('MailInteraction,\x20%s,\x20%s',_0x5e35c7,_0x26fe5e['error'][_0xd084('0x18')]);return _0x572b38(_0x26fe5e['error'][_0xd084('0x18')]);}logger[_0xd084('0x17')]('MailInteraction,\x20%s,\x20%s',_0x5e35c7,_0x26fe5e[_0xd084('0x17')][_0xd084('0x18')]);return _0x446148(_0x26fe5e[_0xd084('0x17')][_0xd084('0x18')]);}else{logger[_0xd084('0x12')](_0xd084('0x13'),_0x5e35c7,_0xd084('0x14'));_0x446148(_0x26fe5e[_0xd084('0x19')]['message']);}})[_0xd084('0x1a')](function(_0x3b693a){logger['error'](_0xd084('0x13'),_0x5e35c7,_0x3b693a);_0x572b38(_0x3b693a);});});}exports[_0xd084('0x1b')]=function(_0x1f82fc){var _0x27bb93=this;return new Promise(function(_0x2860fb,_0x1c3454){return db[_0xd084('0x1c')]['update'](_0x1f82fc['body'],{'raw':_0x1f82fc[_0xd084('0x1d')]?_0x1f82fc[_0xd084('0x1d')][_0xd084('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f82fc[_0xd084('0x1d')]?_0x1f82fc['options'][_0xd084('0x1f')]||null:null,'attributes':_0x1f82fc['options']?_0x1f82fc[_0xd084('0x1d')]['attributes']||null:null,'limit':_0x1f82fc[_0xd084('0x1d')]?_0x1f82fc[_0xd084('0x1d')][_0xd084('0x20')]||null:null})['then'](function(_0x114251){logger[_0xd084('0x12')](_0xd084('0x1b'),_0x1f82fc);logger[_0xd084('0x21')]('UpdateMailInteraction',_0x1f82fc,JSON[_0xd084('0x22')](_0x114251));_0x2860fb(_0x114251);})['catch'](function(_0x309b31){logger[_0xd084('0x17')](_0xd084('0x1b'),_0x309b31[_0xd084('0x18')],_0x1f82fc);_0x1c3454(_0x27bb93['error'](0x1f4,_0x309b31[_0xd084('0x18')]));});});};exports[_0xd084('0x23')]=function(_0x463441){return new Promise(function(_0x585ad7,_0x83750e){return db[_0xd084('0x1c')][_0xd084('0x24')]({'where':_0x463441[_0xd084('0x1d')]?_0x463441[_0xd084('0x1d')][_0xd084('0x1f')]||null:null})[_0xd084('0x11')](function(_0x40b862){if(_0x40b862){return _0x40b862['addTags'](_0x463441[_0xd084('0x25')]['ids'],_[_0xd084('0x26')](_0x463441[_0xd084('0x25')],[_0xd084('0x27'),'id'])||{});}})['spread'](function(_0x26a274){logger[_0xd084('0x12')](_0xd084('0x28'),_0x463441);logger['debug'](_0xd084('0x28'),_0x463441,JSON['stringify'](_0x26a274));_0x585ad7(_0x26a274);})[_0xd084('0x1a')](function(_0x39c739){logger['error'](_0xd084('0x28'),_0x39c739[_0xd084('0x18')],_0x463441);_0x83750e(_this[_0xd084('0x17')](0x1f4,_0x39c739[_0xd084('0x18')]));});});}; \ No newline at end of file +var _0xd047=['client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','MailInteraction','options','raw','where','attributes','limit','then','UpdateMailInteraction','catch','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd047,0x77));var _0x7d04=function(_0x283136,_0x4907c7){_0x283136=_0x283136-0x0;var _0x5de27e=_0xd047[_0x283136];return _0x5de27e;};'use strict';var _=require(_0x7d04('0x0'));var util=require('util');var moment=require(_0x7d04('0x1'));var BPromise=require(_0x7d04('0x2'));var rs=require(_0x7d04('0x3'));var fs=require('fs');var Redis=require(_0x7d04('0x4'));var db=require(_0x7d04('0x5'))['db'];var utils=require(_0x7d04('0x6'));var logger=require(_0x7d04('0x7'))(_0x7d04('0x8'));var config=require(_0x7d04('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d04('0xa')][_0x7d04('0xb')]({'port':0x232a});config[_0x7d04('0xc')]=_[_0x7d04('0xd')](config[_0x7d04('0xc')],{'host':_0x7d04('0xe'),'port':0x18eb});var socket=require(_0x7d04('0xf'))(new Redis(config[_0x7d04('0xc')]));require(_0x7d04('0x10'))[_0x7d04('0x11')](socket);function respondWithRpcPromise(_0x1b8789,_0x2da292,_0x3969d4){return new BPromise(function(_0x439ad8,_0x2db7a4){return client[_0x7d04('0x12')](_0x1b8789,_0x3969d4)['then'](function(_0x3e8298){logger[_0x7d04('0x13')](_0x7d04('0x14'),_0x2da292,'request\x20sent');logger[_0x7d04('0x15')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2da292,_0x7d04('0x16'),JSON[_0x7d04('0x17')](_0x3e8298));if(_0x3e8298[_0x7d04('0x18')]){if(_0x3e8298['error'][_0x7d04('0x19')]===0x1f4){logger[_0x7d04('0x18')](_0x7d04('0x14'),_0x2da292,_0x3e8298['error'][_0x7d04('0x1a')]);return _0x2db7a4(_0x3e8298[_0x7d04('0x18')][_0x7d04('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2da292,_0x3e8298['error'][_0x7d04('0x1a')]);return _0x439ad8(_0x3e8298[_0x7d04('0x18')][_0x7d04('0x1a')]);}else{logger[_0x7d04('0x13')](_0x7d04('0x14'),_0x2da292,_0x7d04('0x16'));_0x439ad8(_0x3e8298[_0x7d04('0x1b')][_0x7d04('0x1a')]);}})['catch'](function(_0x58ffc3){logger[_0x7d04('0x18')]('MailInteraction,\x20%s,\x20%s',_0x2da292,_0x58ffc3);_0x2db7a4(_0x58ffc3);});});}exports['UpdateMailInteraction']=function(_0xe98dde){var _0x2111ad=this;return new Promise(function(_0x4f3e2d,_0x5aee3c){return db[_0x7d04('0x1c')]['update'](_0xe98dde['body'],{'raw':_0xe98dde[_0x7d04('0x1d')]?_0xe98dde['options'][_0x7d04('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe98dde[_0x7d04('0x1d')]?_0xe98dde['options'][_0x7d04('0x1f')]||null:null,'attributes':_0xe98dde[_0x7d04('0x1d')]?_0xe98dde[_0x7d04('0x1d')][_0x7d04('0x20')]||null:null,'limit':_0xe98dde['options']?_0xe98dde[_0x7d04('0x1d')][_0x7d04('0x21')]||null:null})[_0x7d04('0x22')](function(_0x1678eb){logger[_0x7d04('0x13')](_0x7d04('0x23'),_0xe98dde);logger['debug'](_0x7d04('0x23'),_0xe98dde,JSON['stringify'](_0x1678eb));_0x4f3e2d(_0x1678eb);})[_0x7d04('0x24')](function(_0x1f3860){logger[_0x7d04('0x18')](_0x7d04('0x23'),_0x1f3860[_0x7d04('0x1a')],_0xe98dde);_0x5aee3c(_0x2111ad[_0x7d04('0x18')](0x1f4,_0x1f3860['message']));});});};exports['AddTagsToMailInteraction']=function(_0x4483cc){return new Promise(function(_0x33c7e8,_0x21b835){return db[_0x7d04('0x1c')][_0x7d04('0x25')]({'where':_0x4483cc['options']?_0x4483cc[_0x7d04('0x1d')][_0x7d04('0x1f')]||null:null})[_0x7d04('0x22')](function(_0x40c9fc){if(_0x40c9fc){return _0x40c9fc[_0x7d04('0x26')](_0x4483cc['body']['ids'],_[_0x7d04('0x27')](_0x4483cc['body'],[_0x7d04('0x28'),'id'])||{});}})[_0x7d04('0x29')](function(_0x29be7b){logger[_0x7d04('0x13')](_0x7d04('0x2a'),_0x4483cc);logger[_0x7d04('0x15')](_0x7d04('0x2a'),_0x4483cc,JSON[_0x7d04('0x17')](_0x29be7b));_0x33c7e8(_0x29be7b);})['catch'](function(_0x120a1a){logger[_0x7d04('0x18')](_0x7d04('0x2a'),_0x120a1a[_0x7d04('0x1a')],_0x4483cc);_0x21b835(_this[_0x7d04('0x18')](0x1f4,_0x120a1a[_0x7d04('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e2129fd..f12f6d7 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 _0x49a7=['save','remove','emit','removeListener','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49a7,0x19f));var _0x749a=function(_0x2c7ef3,_0x2f14dd){_0x2c7ef3=_0x2c7ef3-0x0;var _0x108694=_0x49a7[_0x2c7ef3];return _0x108694;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x749a('0x0'),_0x749a('0x1'),'update'];function createListener(_0x55a877,_0x244943){return function(_0x57782f){_0x244943[_0x749a('0x2')](_0x55a877,_0x57782f);};}function removeListener(_0x5472d6,_0x242686){return function(){MailInteractionEvents[_0x749a('0x3')](_0x5472d6,_0x242686);};}exports['register']=function(_0x50e94f){for(var _0x59f0e9=0x0,_0x26ce9a=events[_0x749a('0x4')];_0x59f0e9<_0x26ce9a;_0x59f0e9++){var _0x3bb17b=events[_0x59f0e9];var _0x346554=createListener('mailInteraction:'+_0x3bb17b,_0x50e94f);MailInteractionEvents['on'](_0x3bb17b,_0x346554);}}; \ No newline at end of file +var _0x2421=['update','emit','removeListener','./mailInteraction.events','save','remove'];(function(_0x214d49,_0x20fc2c){var _0x109aa1=function(_0x5c0c7c){while(--_0x5c0c7c){_0x214d49['push'](_0x214d49['shift']());}};_0x109aa1(++_0x20fc2c);}(_0x2421,0x1b3));var _0x1242=function(_0x449a68,_0x2e9f14){_0x449a68=_0x449a68-0x0;var _0x3bcff6=_0x2421[_0x449a68];return _0x3bcff6;};'use strict';var MailInteractionEvents=require(_0x1242('0x0'));var events=[_0x1242('0x1'),_0x1242('0x2'),_0x1242('0x3')];function createListener(_0x39e886,_0x1a3c50){return function(_0x5f5bd4){_0x1a3c50[_0x1242('0x4')](_0x39e886,_0x5f5bd4);};}function removeListener(_0x497d09,_0x51050f){return function(){MailInteractionEvents[_0x1242('0x5')](_0x497d09,_0x51050f);};}exports['register']=function(_0xa991fb){for(var _0x35bd2d=0x0,_0x141cf9=events['length'];_0x35bd2d<_0x141cf9;_0x35bd2d++){var _0x3b4b3a=events[_0x35bd2d];var _0x2844c1=createListener('mailInteraction:'+_0x3b4b3a,_0xa991fb);MailInteractionEvents['on'](_0x3b4b3a,_0x2844c1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6e6c83f..b37b076 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 _0x1beb=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','post','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x1beb,0x165));var _0xb1be=function(_0x15e682,_0x3af3ff){_0x15e682=_0x15e682-0x0;var _0x1dbd21=_0x1beb[_0x15e682];return _0x1dbd21;};'use strict';var multer=require(_0xb1be('0x0'));var util=require(_0xb1be('0x1'));var path=require('path');var timeout=require(_0xb1be('0x2'));var express=require(_0xb1be('0x3'));var router=express[_0xb1be('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb1be('0x5'));var interaction=require(_0xb1be('0x6'));var config=require('../../config/environment');var controller=require(_0xb1be('0x7'));router[_0xb1be('0x8')]('/',auth[_0xb1be('0x9')](),controller[_0xb1be('0xa')]);router[_0xb1be('0x8')](_0xb1be('0xb'),auth[_0xb1be('0x9')](),controller[_0xb1be('0xc')]);router['get'](_0xb1be('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb1be('0x8')](_0xb1be('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xb1be('0xf')]('/',auth[_0xb1be('0x9')](),interaction['tracked'](_0xb1be('0x10'),'mailmessage:create'),controller[_0xb1be('0x11')]);router[_0xb1be('0x12')]('/:id',auth[_0xb1be('0x9')](),controller[_0xb1be('0x13')]);router[_0xb1be('0x12')](_0xb1be('0x14'),auth[_0xb1be('0x9')](),controller[_0xb1be('0x15')]);router[_0xb1be('0x12')](_0xb1be('0x16'),auth['isAuthenticated'](),controller[_0xb1be('0x17')]);router['delete'](_0xb1be('0xd'),auth[_0xb1be('0x9')](),controller[_0xb1be('0x18')]);module[_0xb1be('0x19')]=router; \ No newline at end of file +var _0x9af1=['describe','/:id','show','download','mail','mailmessage:create','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x5dbbce,_0xccfd86){var _0x4b2ae9=function(_0x5e6707){while(--_0x5e6707){_0x5dbbce['push'](_0x5dbbce['shift']());}};_0x4b2ae9(++_0xccfd86);}(_0x9af1,0x68));var _0x19af=function(_0x184e15,_0x3f55ec){_0x184e15=_0x184e15-0x0;var _0x226972=_0x9af1[_0x184e15];return _0x226972;};'use strict';var multer=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var path=require(_0x19af('0x2'));var timeout=require('connect-timeout');var express=require(_0x19af('0x3'));var router=express[_0x19af('0x4')]();var fs_extra=require(_0x19af('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19af('0x6'));var controller=require('./mailMessage.controller');router[_0x19af('0x7')]('/',auth[_0x19af('0x8')](),controller[_0x19af('0x9')]);router[_0x19af('0x7')](_0x19af('0xa'),auth['isAuthenticated'](),controller[_0x19af('0xb')]);router[_0x19af('0x7')](_0x19af('0xc'),auth['isAuthenticated'](),controller[_0x19af('0xd')]);router[_0x19af('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x19af('0xe')]);router['post']('/',auth[_0x19af('0x8')](),interaction['tracked'](_0x19af('0xf'),_0x19af('0x10')),controller[_0x19af('0x11')]);router[_0x19af('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x19af('0x13')]);router[_0x19af('0x12')]('/:id/accept',auth[_0x19af('0x8')](),controller['accept']);router[_0x19af('0x12')]('/:id/reject',auth[_0x19af('0x8')](),controller['reject']);router[_0x19af('0x14')](_0x19af('0xc'),auth['isAuthenticated'](),controller[_0x19af('0x15')]);module[_0x19af('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 76341d1..ecd54ea 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 _0xa122=['medium','BOOLEAN','out','long','DATE','ENUM','Chat','Email','TEXT'];(function(_0x69618f,_0x2bd428){var _0x49df9a=function(_0x48a2b2){while(--_0x48a2b2){_0x69618f['push'](_0x69618f['shift']());}};_0x49df9a(++_0x2bd428);}(_0xa122,0x116));var _0x2a12=function(_0x113cf4,_0x21c9d9){_0x113cf4=_0x113cf4-0x0;var _0x494469=_0xa122[_0x113cf4];return _0x494469;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x2a12('0x0')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2a12('0x1'))},'read':{'type':Sequelize[_0x2a12('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2a12('0x3')),'defaultValue':_0x2a12('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2a12('0x0')](_0x2a12('0x4'))},'cc':{'type':Sequelize[_0x2a12('0x0')](_0x2a12('0x4'))},'bcc':{'type':Sequelize[_0x2a12('0x0')](_0x2a12('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2a12('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2a12('0x5')]},'originTo':{'type':Sequelize[_0x2a12('0x0')](_0x2a12('0x4'))},'originCc':{'type':Sequelize[_0x2a12('0x0')](_0x2a12('0x4'))},'originChannel':{'type':Sequelize[_0x2a12('0x6')]('Email',_0x2a12('0x7')),'defaultValue':_0x2a12('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0x4bf7=['TEXT','DATE','INTEGER','Email','Chat','sequelize','exports','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0xd685e,_0x360045){var _0x5ef5e0=function(_0x37f4b3){while(--_0x37f4b3){_0xd685e['push'](_0xd685e['shift']());}};_0x5ef5e0(++_0x360045);}(_0x4bf7,0x198));var _0x74bf=function(_0x399e27,_0xdcc8e){_0x399e27=_0x399e27-0x0;var _0x5aaff0=_0x4bf7[_0x399e27];return _0x5aaff0;};'use strict';var Sequelize=require(_0x74bf('0x0'));var _=require('lodash');module[_0x74bf('0x1')]={'body':{'type':Sequelize['TEXT'](_0x74bf('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x74bf('0x3'))},'read':{'type':Sequelize[_0x74bf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x74bf('0x5')]('in',_0x74bf('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x74bf('0x7')]},'to':{'type':Sequelize['TEXT'](_0x74bf('0x2'))},'cc':{'type':Sequelize[_0x74bf('0x8')](_0x74bf('0x2'))},'bcc':{'type':Sequelize[_0x74bf('0x8')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x74bf('0x9')]},'attach':{'type':Sequelize[_0x74bf('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x74bf('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x74bf('0x9')]},'originTo':{'type':Sequelize[_0x74bf('0x8')](_0x74bf('0x2'))},'originCc':{'type':Sequelize[_0x74bf('0x8')]('long')},'originChannel':{'type':Sequelize[_0x74bf('0x5')](_0x74bf('0xb'),_0x74bf('0xc')),'defaultValue':_0x74bf('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 586c8ed..3ba1d97 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 _0x3e83=['SIP/%s','channel','motionChannel','EventManager','acceptmessage','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','event','fromString','download','unix','toString','server','files','tmp','from','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','limit','count','set','Content-Range','destroy','sendStatus','stack','name','send','map','MailMessage','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','rows','show','rawAttributes','keys','find','update','params','describe','create','direction','out','body','split','MailAccount','findOne','CmList','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','CmContact','ListId','List\x20not\x20found','sendMail','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','QueryTypes','SELECT','User','fullname','email','internal','manual','interface'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x3e83,0xc3));var _0x33e8=function(_0x13a14d,_0x1e10d2){_0x13a14d=_0x13a14d-0x0;var _0x4772c6=_0x3e83[_0x13a14d];return _0x4772c6;};'use strict';var emlformat=require('eml-format');var moment=require(_0x33e8('0x0'));var BPromise=require(_0x33e8('0x1'));var util=require(_0x33e8('0x2'));var path=require(_0x33e8('0x3'));var fs=require('fs');var _=require(_0x33e8('0x4'));var Redis=require(_0x33e8('0x5'));var htmlToText=require(_0x33e8('0x6'));var qs=require(_0x33e8('0x7'));var logger=require(_0x33e8('0x8'))(_0x33e8('0x9'));var interaction_log=require(_0x33e8('0x8'))(_0x33e8('0xa'));var config=require(_0x33e8('0xb'));var db=require(_0x33e8('0xc'))['db'];config[_0x33e8('0xd')]=_[_0x33e8('0xe')](config[_0x33e8('0xd')],{'host':_0x33e8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33e8('0xd')]));var htmlEntities=require(_0x33e8('0x10'));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x33e8('0x11'));var client=jayson[_0x33e8('0x12')]['http']({'port':0x232c});var client9003=jayson[_0x33e8('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x33e8('0x12')][_0x33e8('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x14e048,_0x4e17b9,_0x3abbe7,_0xc9171a){return new BPromise(function(_0x4a4b5b,_0x3db1f8){var _0x33c236=_0xc9171a||client;return _0x33c236[_0x33e8('0x14')](_0x14e048,_0x3abbe7)[_0x33e8('0x15')](function(_0x191a8b){logger[_0x33e8('0x16')](_0x33e8('0x17'),_0x4e17b9,_0x33e8('0x18'));logger[_0x33e8('0x19')](_0x33e8('0x1a'),_0x4e17b9,_0x33e8('0x18'),JSON[_0x33e8('0x1b')](_0x191a8b));if(_0x191a8b[_0x33e8('0x1c')]){if(_0x191a8b[_0x33e8('0x1c')][_0x33e8('0x1d')]===0x1f4){logger[_0x33e8('0x1c')](_0x33e8('0x17'),_0x4e17b9,_0x191a8b[_0x33e8('0x1c')][_0x33e8('0x1e')]);return _0x3db1f8(_0x191a8b[_0x33e8('0x1c')][_0x33e8('0x1e')]);}logger['error'](_0x33e8('0x17'),_0x4e17b9,_0x191a8b['error'][_0x33e8('0x1e')]);return _0x4a4b5b(_0x191a8b['error'][_0x33e8('0x1e')]);}else{logger['info'](_0x33e8('0x17'),_0x4e17b9,_0x33e8('0x18'));_0x4a4b5b(_0x191a8b['result'][_0x33e8('0x1e')]);}})[_0x33e8('0x1f')](function(_0x112ab0){logger[_0x33e8('0x1c')](_0x33e8('0x17'),_0x4e17b9,_0x112ab0);_0x3db1f8(_0x112ab0);});});}function respondWithResult(_0x1b53a5,_0x4d99d4){_0x4d99d4=_0x4d99d4||0xc8;return function(_0x246e6d){if(_0x246e6d){return _0x1b53a5[_0x33e8('0x20')](_0x4d99d4)[_0x33e8('0x21')](_0x246e6d);}};}function respondWithFilteredResult(_0x14fb85,_0x674d95){return function(_0x17a530){if(_0x17a530){var _0x3b8eb0=typeof _0x674d95[_0x33e8('0x22')]==='undefined'&&typeof _0x674d95[_0x33e8('0x23')]==='undefined';var _0x5da07b=_0x17a530[_0x33e8('0x24')];var _0x5962f4=_0x3b8eb0?0x0:_0x674d95['offset'];var _0x435a46=_0x3b8eb0?_0x17a530[_0x33e8('0x24')]:_0x674d95[_0x33e8('0x22')]+_0x674d95['limit'];var _0x521438;if(_0x435a46>=_0x5da07b){_0x435a46=_0x5da07b;_0x521438=0xc8;}else{_0x521438=0xce;}_0x14fb85[_0x33e8('0x20')](_0x521438);return _0x14fb85[_0x33e8('0x25')](_0x33e8('0x26'),_0x5962f4+'-'+_0x435a46+'/'+_0x5da07b)[_0x33e8('0x21')](_0x17a530);}return null;};}function saveUpdates(_0x2c748d){return function(_0x29b077){if(_0x29b077){return _0x29b077['update'](_0x2c748d)[_0x33e8('0x15')](function(_0x470590){return _0x470590;});}return null;};}function removeEntity(_0x191849){return function(_0x3c22a0){if(_0x3c22a0){return _0x3c22a0[_0x33e8('0x27')]()[_0x33e8('0x15')](function(){_0x191849['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4643a1){return function(_0x4f19f8){if(!_0x4f19f8){_0x4643a1[_0x33e8('0x28')](0x194);}return _0x4f19f8;};}function handleError(_0x5ee033,_0x2299a5){_0x2299a5=_0x2299a5||0x1f4;return function(_0x220cbb){logger['error'](_0x220cbb[_0x33e8('0x29')]);if(_0x220cbb[_0x33e8('0x2a')]){delete _0x220cbb[_0x33e8('0x2a')];}_0x5ee033[_0x33e8('0x20')](_0x2299a5)[_0x33e8('0x2b')](_0x220cbb);};}exports['index']=function(_0x1dcaf4,_0x588b2f){var _0x21b55b={},_0x5a3254={},_0x1c1bdc={'count':0x0,'rows':[]};var _0x2f76cb=_[_0x33e8('0x2c')](db[_0x33e8('0x2d')]['rawAttributes'],function(_0x54c2fe){return{'name':_0x54c2fe[_0x33e8('0x2e')],'type':_0x54c2fe[_0x33e8('0x2f')][_0x33e8('0x30')]};});_0x5a3254[_0x33e8('0x31')]=_[_0x33e8('0x2c')](_0x2f76cb,'name');_0x5a3254[_0x33e8('0x32')]=_['keys'](_0x1dcaf4[_0x33e8('0x32')]);_0x5a3254['filters']=_[_0x33e8('0x33')](_0x5a3254[_0x33e8('0x31')],_0x5a3254['query']);_0x21b55b[_0x33e8('0x34')]=_[_0x33e8('0x33')](_0x5a3254[_0x33e8('0x31')],qs[_0x33e8('0x35')](_0x1dcaf4[_0x33e8('0x32')]['fields']));_0x21b55b['attributes']=_0x21b55b[_0x33e8('0x34')][_0x33e8('0x36')]?_0x21b55b[_0x33e8('0x34')]:_0x5a3254[_0x33e8('0x31')];if(!_0x1dcaf4[_0x33e8('0x32')][_0x33e8('0x37')](_0x33e8('0x38'))){_0x21b55b['limit']=qs[_0x33e8('0x23')](_0x1dcaf4['query'][_0x33e8('0x23')]);_0x21b55b[_0x33e8('0x22')]=qs[_0x33e8('0x22')](_0x1dcaf4[_0x33e8('0x32')][_0x33e8('0x22')]);}_0x21b55b[_0x33e8('0x39')]=qs['sort'](_0x1dcaf4[_0x33e8('0x32')]['sort']);_0x21b55b['where']=qs[_0x33e8('0x3a')](_[_0x33e8('0x3b')](_0x1dcaf4[_0x33e8('0x32')],_0x5a3254['filters']),_0x2f76cb);if(_0x1dcaf4[_0x33e8('0x32')][_0x33e8('0x3c')]){_0x21b55b['where']=_[_0x33e8('0x3d')](_0x21b55b[_0x33e8('0x3e')],{'$or':_[_0x33e8('0x2c')](_0x2f76cb,function(_0x3f1962){if(_0x3f1962['type']!==_0x33e8('0x3f')){var _0x1cc80d={};_0x1cc80d[_0x3f1962[_0x33e8('0x2a')]]={'$like':'%'+_0x1dcaf4[_0x33e8('0x32')][_0x33e8('0x3c')]+'%'};return _0x1cc80d;}})});}_0x21b55b=_['merge']({},_0x21b55b,_0x1dcaf4[_0x33e8('0x40')]);var _0x3d60d6={'where':_0x21b55b[_0x33e8('0x3e')]};return db[_0x33e8('0x2d')][_0x33e8('0x24')](_0x3d60d6)[_0x33e8('0x15')](function(_0x4169eb){_0x1c1bdc[_0x33e8('0x24')]=_0x4169eb;if(_0x1dcaf4['query'][_0x33e8('0x41')]){_0x21b55b['include']=[{'all':!![]}];}return db[_0x33e8('0x2d')]['findAll'](_0x21b55b);})[_0x33e8('0x15')](function(_0x2d4239){_0x1c1bdc[_0x33e8('0x42')]=_0x2d4239;return _0x1c1bdc;})[_0x33e8('0x15')](respondWithFilteredResult(_0x588b2f,_0x21b55b))[_0x33e8('0x1f')](handleError(_0x588b2f,null));};exports[_0x33e8('0x43')]=function(_0x55559b,_0x396b29){var _0x1fcc2d={'raw':!![],'where':{'id':_0x55559b['params']['id']}},_0x216be6={};_0x216be6[_0x33e8('0x31')]=_['keys'](db['MailMessage'][_0x33e8('0x44')]);_0x216be6[_0x33e8('0x32')]=_[_0x33e8('0x45')](_0x55559b[_0x33e8('0x32')]);_0x216be6['filters']=_[_0x33e8('0x33')](_0x216be6[_0x33e8('0x31')],_0x216be6[_0x33e8('0x32')]);_0x1fcc2d[_0x33e8('0x34')]=_['intersection'](_0x216be6[_0x33e8('0x31')],qs[_0x33e8('0x35')](_0x55559b['query']['fields']));_0x1fcc2d[_0x33e8('0x34')]=_0x1fcc2d[_0x33e8('0x34')]['length']?_0x1fcc2d['attributes']:_0x216be6[_0x33e8('0x31')];if(_0x55559b['query'][_0x33e8('0x41')]){_0x1fcc2d['include']=[{'all':!![]}];}_0x1fcc2d=_['merge']({},_0x1fcc2d,_0x55559b[_0x33e8('0x40')]);return db[_0x33e8('0x2d')][_0x33e8('0x46')](_0x1fcc2d)[_0x33e8('0x15')](handleEntityNotFound(_0x396b29,null))[_0x33e8('0x15')](respondWithResult(_0x396b29,null))['catch'](handleError(_0x396b29,null));};exports[_0x33e8('0x47')]=function(_0x32fedc,_0x4e2b5f){if(_0x32fedc['body']['id']){delete _0x32fedc['body']['id'];}return db['MailMessage'][_0x33e8('0x46')]({'where':{'id':_0x32fedc[_0x33e8('0x48')]['id']}})[_0x33e8('0x15')](handleEntityNotFound(_0x4e2b5f,null))['then'](saveUpdates(_0x32fedc['body'],null))['then'](respondWithResult(_0x4e2b5f,null))[_0x33e8('0x1f')](handleError(_0x4e2b5f,null));};exports['destroy']=function(_0xa473fe,_0x2a080b){return db['MailMessage']['find']({'where':{'id':_0xa473fe[_0x33e8('0x48')]['id']}})[_0x33e8('0x15')](handleEntityNotFound(_0x2a080b,null))[_0x33e8('0x15')](removeEntity(_0x2a080b,null))[_0x33e8('0x1f')](handleError(_0x2a080b,null));};exports[_0x33e8('0x49')]=function(_0x490d93,_0x51e121){return db[_0x33e8('0x2d')][_0x33e8('0x49')]()[_0x33e8('0x15')](respondWithResult(_0x51e121,null))[_0x33e8('0x1f')](handleError(_0x51e121,null));};exports[_0x33e8('0x4a')]=function(_0xe6e81,_0x1a7162){return db[_0x33e8('0x2d')][_0x33e8('0x4a')](_0xe6e81['body'])[_0x33e8('0x15')](function(_0x2cb5af){if(_0x2cb5af){if(_0x2cb5af[_0x33e8('0x4b')]===_0x33e8('0x4c')&&!_0x2cb5af['secret']){var _0x303b3a,_0x32c46e,_0x3ca246;if(_0xe6e81[_0x33e8('0x4d')]['to']){_0x32c46e=_0xe6e81[_0x33e8('0x4d')]['to'][_0x33e8('0x4e')](',')[0x0];}return db[_0x33e8('0x4f')][_0x33e8('0x50')]({'where':{'id':_0x2cb5af['MailAccountId']},'include':[{'model':db[_0x33e8('0x51')],'as':'List','include':[{'model':db['CmContact'],'as':_0x33e8('0x52'),'where':{'email':_0x32c46e},'limit':0x1,'order':[[_0x33e8('0x53'),_0x33e8('0x54')]]}]},{'model':db['MailServerOut'],'as':_0x33e8('0x55'),'raw':!![],'include':[{'model':db[_0x33e8('0x56')],'as':_0x33e8('0x56'),'raw':!![]}]}]})[_0x33e8('0x15')](function(_0x2834af){_0x303b3a=_0x2834af;if(!_0x303b3a||!_0x303b3a[_0x33e8('0x55')])return;var _0xbf872f=_0x303b3a[_0x33e8('0x57')]();if(_0xe6e81[_0x33e8('0x4d')][_0x33e8('0x58')]&&_0xe6e81[_0x33e8('0x4d')][_0x33e8('0x58')]['length']){for(var _0x46d6cb=0x0;_0x46d6cb<_0xe6e81[_0x33e8('0x4d')]['attachments'][_0x33e8('0x36')];_0x46d6cb+=0x1){_0xe6e81[_0x33e8('0x4d')]['attachments'][_0x46d6cb]={'filename':_0xe6e81['body']['attachments'][_0x46d6cb][_0x33e8('0x2a')],'path':path[_0x33e8('0x59')](config[_0x33e8('0x5a')],'server/files/attachments',_0xe6e81[_0x33e8('0x4d')]['attachments'][_0x46d6cb][_0x33e8('0x5b')])};}}_0x3ca246={'account':_0xbf872f,'message':_0xe6e81['body']};return;})['then'](function(){if(_0x303b3a[_0x33e8('0x5c')]){if(_0x303b3a[_0x33e8('0x5c')][_0x33e8('0x52')]['length']){return _0x303b3a[_0x33e8('0x5c')][_0x33e8('0x52')][0x0];}else{return db[_0x33e8('0x5d')][_0x33e8('0x4a')](_['defaults'](_0xe6e81[_0x33e8('0x4d')],{'firstName':_0xe6e81[_0x33e8('0x4d')]['to'],'email':_0xe6e81[_0x33e8('0x4d')]['to'],'phone':_0xe6e81[_0x33e8('0x4d')]['to'],'ListId':_0x303b3a[_0x33e8('0x5e')]}));}}else{throw new Error(_0x33e8('0x5f'));}})[_0x33e8('0x15')](function(){if(_0x3ca246){return respondWithRpcPromise('SendMail',_0x33e8('0x60'),_0x3ca246,client9003)[_0x33e8('0x15')](function(_0x127e4d){return _0x2cb5af[_0x33e8('0x47')]({'read':!![],'messageId':_0x127e4d[_0x33e8('0x61')],'sentAt':moment()[_0x33e8('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x33e8('0x1f')](function(_0x1030da){logger['error']('%s',JSON['stringify'](_0x1030da));return _0x2cb5af;});}return _0x2cb5af;});}return _0x2cb5af;}})['then'](respondWithResult(_0x1a7162,0xc9))[_0x33e8('0x1f')](handleError(_0x1a7162,null));};exports[_0x33e8('0x63')]=function(_0x2af4d9,_0x2d4d31){var _0x312b12={'agent':{},'channel':_0x33e8('0x64')};if(_0x2af4d9['body']['id']){delete _0x2af4d9[_0x33e8('0x4d')]['id'];}_0x2af4d9[_0x33e8('0x4d')][_0x33e8('0x65')]=!![];_0x2af4d9['body'][_0x33e8('0x66')]=moment()['format'](_0x33e8('0x67'));_0x2af4d9['body'][_0x33e8('0x68')]=_0x2af4d9[_0x33e8('0x4d')][_0x33e8('0x68')]||_0x2af4d9[_0x33e8('0x69')]['id'];_0x312b12[_0x33e8('0x6a')]['id']=_0x2af4d9[_0x33e8('0x4d')]['UserId'];return db[_0x33e8('0x2d')][_0x33e8('0x46')]({'where':{'id':_0x2af4d9[_0x33e8('0x48')]['id'],'UserId':null}})[_0x33e8('0x15')](handleEntityNotFound(_0x2d4d31,null))[_0x33e8('0x15')](saveUpdates(_0x2af4d9[_0x33e8('0x4d')],null))[_0x33e8('0x15')](function(_0x31c6b5){if(_0x31c6b5){_0x312b12[_0x33e8('0x1e')]=_0x31c6b5[_0x33e8('0x6b')]({'plain':!![]});return db['MailInteraction'][_0x33e8('0x46')]({'where':{'id':_0x31c6b5[_0x33e8('0x6c')]}});}return null;})[_0x33e8('0x15')](handleEntityNotFound(_0x2d4d31,null))[_0x33e8('0x15')](function(_0x44ae7f){if(_0x44ae7f){return _0x44ae7f['update']({'UserId':_0x2af4d9[_0x33e8('0x4d')][_0x33e8('0x68')],'read1stAt':_['isNil'](_0x44ae7f[_0x33e8('0x6d')])?moment()['format'](_0x33e8('0x67')):undefined});}return null;})['then'](function(_0x5a4fbf){if(_0x5a4fbf){_0x312b12[_0x33e8('0x6e')]=_0x5a4fbf[_0x33e8('0x6b')]({'plain':!![]});interaction_log[_0x33e8('0x16')](_0x33e8('0x6f'),_0x2af4d9[_0x33e8('0x69')]['id'],_0x2af4d9['user'][_0x33e8('0x2a')],_0x2af4d9['user'][_0x33e8('0x70')],_0x312b12[_0x33e8('0x6e')]['id'],_0x2af4d9[_0x33e8('0x4d')]?JSON[_0x33e8('0x1b')](_0x2af4d9['body']):_0x33e8('0x71'));return respondWithRpcPromise(_0x33e8('0x72'),_0x33e8('0x73'),_0x312b12);}return null;})[_0x33e8('0x15')](function(_0x54ea73){var _0x3c3272='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x54ea73[_0x33e8('0x1e')][_0x33e8('0x74')];return db['sequelize'][_0x33e8('0x32')](_0x3c3272,{'type':db['Sequelize'][_0x33e8('0x75')][_0x33e8('0x76')],'raw':!![]})[_0x33e8('0x15')](function(_0x231941){return _0x231941;});})['then'](function(_0x6fbdc7){if(_0x6fbdc7){_0x312b12[_0x33e8('0x1e')]['contact']=_0x6fbdc7[0x0];if(!_0x2af4d9[_0x33e8('0x4d')][_0x33e8('0x68')])return;return db[_0x33e8('0x77')][_0x33e8('0x46')]({'where':{'id':_0x2af4d9['body'][_0x33e8('0x68')],'role':_0x33e8('0x6a')},'attributes':['id','name',_0x33e8('0x78'),_0x33e8('0x79'),_0x33e8('0x7a')],'raw':!![]});}return null;})['then'](function(_0x221f7d){if(!_0x221f7d)return null;_0x312b12[_0x33e8('0x1e')][_0x33e8('0x6a')]=_0x221f7d;return _0x312b12;})[_0x33e8('0x15')](function(_0x4cf85d){if(_0x4cf85d){if(_0x2af4d9['body'][_0x33e8('0x7b')]){_0x312b12['message'][_0x33e8('0x7c')]=util['format'](_0x33e8('0x7d'),_0x2af4d9[_0x33e8('0x69')][_0x33e8('0x2a')]);_0x312b12[_0x33e8('0x1e')][_0x33e8('0x7e')]=_0x312b12['channel'];_0x312b12[_0x33e8('0x1e')][_0x33e8('0x7f')]=_0x312b12[_0x33e8('0x7e')];_0x312b12[_0x33e8('0x1e')]['event']=_0x33e8('0x63');_0x312b12[_0x33e8('0x1e')]['body']=htmlToText['fromString'](_0x312b12[_0x33e8('0x1e')][_0x33e8('0x4d')]);return respondWithRpcPromise(_0x33e8('0x80'),_0x33e8('0x80'),{'event':_0x33e8('0x81'),'message':_0x312b12[_0x33e8('0x1e')]},client9002)[_0x33e8('0x15')](function(){return _0x312b12;});}return _0x312b12;}return null;})[_0x33e8('0x15')](respondWithResult(_0x2d4d31,null))[_0x33e8('0x1f')](handleError(_0x2d4d31,null));};exports['reject']=function(_0x12b350,_0x4f750d){var _0xf289ca={'agent':{},'channel':_0x33e8('0x64')};if(_0x12b350[_0x33e8('0x4d')]['id']){delete _0x12b350[_0x33e8('0x4d')]['id'];}_0x12b350[_0x33e8('0x4d')][_0x33e8('0x68')]=_0x12b350['body'][_0x33e8('0x68')]||_0x12b350[_0x33e8('0x69')]['id'];_0xf289ca[_0x33e8('0x6a')]['id']=_0x12b350['body'][_0x33e8('0x68')];return db[_0x33e8('0x2d')][_0x33e8('0x46')]({'where':{'id':_0x12b350['params']['id'],'UserId':null}})[_0x33e8('0x15')](handleEntityNotFound(_0x4f750d,null))[_0x33e8('0x15')](function(_0x20dccb){if(_0x20dccb){_0xf289ca[_0x33e8('0x1e')]=_0x20dccb[_0x33e8('0x6b')]({'plain':!![]});return db[_0x33e8('0x82')]['find']({'where':{'id':_0x20dccb['MailInteractionId']}});}return null;})[_0x33e8('0x15')](handleEntityNotFound(_0x4f750d,null))[_0x33e8('0x15')](function(_0x5d2fa6){if(_0x5d2fa6){_0xf289ca[_0x33e8('0x6e')]=_0x5d2fa6['get']({'plain':!![]});interaction_log[_0x33e8('0x16')](_0x33e8('0x83'),_0x12b350[_0x33e8('0x69')]['id'],_0x12b350[_0x33e8('0x69')][_0x33e8('0x2a')],_0x12b350[_0x33e8('0x69')]['role'],_0xf289ca['interaction']['id'],_0x12b350[_0x33e8('0x4d')]?JSON[_0x33e8('0x1b')](_0x12b350[_0x33e8('0x4d')]):_0x33e8('0x71'));return respondWithRpcPromise(_0x33e8('0x84'),_0x33e8('0x85'),_0xf289ca);}return null;})[_0x33e8('0x15')](function(_0x2a61c4){var _0x4e84de=_0x33e8('0x86')+_0x2a61c4[_0x33e8('0x1e')]['ContactId'];return db[_0x33e8('0x87')][_0x33e8('0x32')](_0x4e84de,{'type':db[_0x33e8('0x88')][_0x33e8('0x75')]['SELECT'],'raw':!![]})[_0x33e8('0x15')](function(_0x3dbb6b){return _0x3dbb6b;});})[_0x33e8('0x15')](function(_0x511a23){if(_0x511a23){_0xf289ca['message'][_0x33e8('0x89')]=_0x511a23[0x0];if(!_0x12b350[_0x33e8('0x4d')][_0x33e8('0x68')])return;return db[_0x33e8('0x77')][_0x33e8('0x46')]({'where':{'id':_0x12b350[_0x33e8('0x4d')][_0x33e8('0x68')],'role':_0x33e8('0x6a')},'attributes':['id',_0x33e8('0x2a'),'fullname',_0x33e8('0x79'),_0x33e8('0x7a')],'raw':!![]});}return null;})[_0x33e8('0x15')](function(_0x34ec3a){if(!_0x34ec3a)return null;_0xf289ca['message'][_0x33e8('0x6a')]=_0x34ec3a;return _0xf289ca;})[_0x33e8('0x15')](function(_0x5bd2b3){if(_0x5bd2b3){_0x5bd2b3[_0x33e8('0x1e')]['interface']=util['format']('SIP/%s',_0x12b350[_0x33e8('0x69')][_0x33e8('0x2a')]);_0x5bd2b3[_0x33e8('0x1e')][_0x33e8('0x7e')]=_0xf289ca['channel'];_0x5bd2b3['message'][_0x33e8('0x7f')]=_0xf289ca['channel'];_0x5bd2b3[_0x33e8('0x1e')][_0x33e8('0x8a')]='reject';_0x5bd2b3[_0x33e8('0x1e')][_0x33e8('0x4d')]=htmlToText[_0x33e8('0x8b')](_0xf289ca[_0x33e8('0x1e')][_0x33e8('0x4d')]);respondWithRpcPromise(_0x33e8('0x80'),_0x33e8('0x80'),{'event':'rejectmessage','message':_0x5bd2b3[_0x33e8('0x1e')]},client9002);return _0xf289ca;}return null;})[_0x33e8('0x15')](respondWithResult(_0x4f750d,null))[_0x33e8('0x1f')](handleError(_0x4f750d,null));};exports[_0x33e8('0x8c')]=function(_0x149081,_0x49e0a7){var _0x554b9b=moment()[_0x33e8('0x8d')]()[_0x33e8('0x8e')]();var _0x21a04c=path['join'](config[_0x33e8('0x5a')],_0x33e8('0x8f'),_0x33e8('0x90'),_0x33e8('0x91'));var _0x29afa0=path[_0x33e8('0x59')](config[_0x33e8('0x5a')],_0x33e8('0x8f'),'files',_0x33e8('0x58'));var _0xe73a3c=util['format']('message-%s.eml',_0x554b9b);return db[_0x33e8('0x2d')][_0x33e8('0x46')]({'where':{'id':_0x149081[_0x33e8('0x48')]['id']},'attributes':['id',_0x33e8('0x4d'),_0x33e8('0x92'),'to','cc',_0x33e8('0x93'),_0x33e8('0x94'),'createdAt'],'include':_0x149081[_0x33e8('0x32')]['attachments']?[{'model':db[_0x33e8('0x95')],'as':_0x33e8('0x96')}]:undefined})[_0x33e8('0x15')](handleEntityNotFound(_0x49e0a7,null))['then'](function(_0x4db338){if(_0x4db338){var _0x2e38ad=_0x4db338;var _0x153272={'from':_0x2e38ad['from'],'to':_0x2e38ad['to'],'subject':_0x2e38ad[_0x33e8('0x94')],'html':htmlEntities[_0x33e8('0x97')](_0x2e38ad[_0x33e8('0x4d')]),'headers':{'Date':moment(_0x2e38ad[_0x33e8('0x98')])[_0x33e8('0x62')](_0x33e8('0x99'))},'attachments':[]};if(_0x4db338['cc']){_0x153272[_0x33e8('0x9a')]['Cc']=_0x4db338['cc'];}if(_0x4db338[_0x33e8('0x93')]){_0x153272[_0x33e8('0x9a')][_0x33e8('0x9b')]=_0x4db338[_0x33e8('0x93')];}return new BPromise(function(_0x4510f7,_0x3e50e5){if(_0x4db338[_0x33e8('0x96')]){for(var _0x5e040e=0x0;_0x5e040e<_0x4db338[_0x33e8('0x96')][_0x33e8('0x36')];_0x5e040e++){var _0x4814d4=_0x4db338[_0x33e8('0x96')][_0x5e040e];var _0x44f06d=path[_0x33e8('0x59')](_0x29afa0,_0x4814d4[_0x33e8('0x5b')]);if(fs['existsSync'](_0x44f06d)){_0x153272[_0x33e8('0x58')]['push']({'name':_0x4814d4['name'],'contentType':_0x4814d4[_0x33e8('0x2f')],'data':fs[_0x33e8('0x9c')](_0x44f06d)});}}}emlformat[_0x33e8('0x9d')](_0x153272,function(_0x1ca91a,_0x5c4568){if(_0x1ca91a)return _0x3e50e5(_0x1ca91a);fs[_0x33e8('0x9e')](path[_0x33e8('0x59')](_0x21a04c,_0xe73a3c),_0x5c4568);return _0x4510f7(_0x5c4568);});});}})[_0x33e8('0x15')](function(_0x1682e2){if(_0x1682e2){return _0x49e0a7[_0x33e8('0x8c')](path['join'](_0x21a04c,_0xe73a3c),_0xe73a3c,function(_0x557f3d){if(!_0x557f3d)fs[_0x33e8('0x9f')](path['join'](_0x21a04c,_0xe73a3c));});}})['catch'](handleError(_0x49e0a7,null));}; \ No newline at end of file +var _0x1b33=['moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','length','include','find','body','params','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','List','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','MailInteraction','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','sequelize','rejectmessage','download','unix','root','server','files','tmp','message-%s.eml','bcc','Attachments','from','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','unlinkSync','eml-format'];(function(_0x3248e8,_0x57b9ae){var _0x1a1373=function(_0x18e476){while(--_0x18e476){_0x3248e8['push'](_0x3248e8['shift']());}};_0x1a1373(++_0x57b9ae);}(_0x1b33,0x145));var _0x31b3=function(_0xcc69c5,_0x5b35b2){_0xcc69c5=_0xcc69c5-0x0;var _0x14ec59=_0x1b33[_0xcc69c5];return _0x14ec59;};'use strict';var emlformat=require(_0x31b3('0x0'));var moment=require(_0x31b3('0x1'));var BPromise=require(_0x31b3('0x2'));var util=require(_0x31b3('0x3'));var path=require(_0x31b3('0x4'));var fs=require('fs');var _=require(_0x31b3('0x5'));var Redis=require(_0x31b3('0x6'));var htmlToText=require(_0x31b3('0x7'));var qs=require(_0x31b3('0x8'));var logger=require('../../config/logger')(_0x31b3('0x9'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x31b3('0xa'));var db=require(_0x31b3('0xb'))['db'];config[_0x31b3('0xc')]=_[_0x31b3('0xd')](config[_0x31b3('0xc')],{'host':_0x31b3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x31b3('0xc')]));var htmlEntities=require(_0x31b3('0xf'));require(_0x31b3('0x10'))[_0x31b3('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x31b3('0x12')][_0x31b3('0x13')]({'port':0x232c});var client9003=jayson[_0x31b3('0x12')][_0x31b3('0x13')]({'port':0x232b});var client9002=jayson[_0x31b3('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29679d,_0x58873b,_0x5709d8,_0x4171d6){return new BPromise(function(_0x3366cf,_0x5ceaa1){var _0x4e95f3=_0x4171d6||client;return _0x4e95f3['request'](_0x29679d,_0x5709d8)[_0x31b3('0x14')](function(_0x4273f5){logger[_0x31b3('0x15')](_0x31b3('0x16'),_0x58873b,_0x31b3('0x17'));logger['debug'](_0x31b3('0x18'),_0x58873b,_0x31b3('0x17'),JSON[_0x31b3('0x19')](_0x4273f5));if(_0x4273f5[_0x31b3('0x1a')]){if(_0x4273f5[_0x31b3('0x1a')]['code']===0x1f4){logger['error'](_0x31b3('0x16'),_0x58873b,_0x4273f5['error'][_0x31b3('0x1b')]);return _0x5ceaa1(_0x4273f5[_0x31b3('0x1a')][_0x31b3('0x1b')]);}logger[_0x31b3('0x1a')](_0x31b3('0x16'),_0x58873b,_0x4273f5[_0x31b3('0x1a')][_0x31b3('0x1b')]);return _0x3366cf(_0x4273f5[_0x31b3('0x1a')][_0x31b3('0x1b')]);}else{logger[_0x31b3('0x15')]('MailMessage,\x20%s,\x20%s',_0x58873b,_0x31b3('0x17'));_0x3366cf(_0x4273f5[_0x31b3('0x1c')][_0x31b3('0x1b')]);}})[_0x31b3('0x1d')](function(_0x5206db){logger['error'](_0x31b3('0x16'),_0x58873b,_0x5206db);_0x5ceaa1(_0x5206db);});});}function respondWithResult(_0x1dabaa,_0x4f3873){_0x4f3873=_0x4f3873||0xc8;return function(_0x118772){if(_0x118772){return _0x1dabaa[_0x31b3('0x1e')](_0x4f3873)[_0x31b3('0x1f')](_0x118772);}};}function respondWithFilteredResult(_0x94c761,_0x227482){return function(_0x91befb){if(_0x91befb){var _0x533f64=typeof _0x227482[_0x31b3('0x20')]==='undefined'&&typeof _0x227482['limit']==='undefined';var _0x561a0f=_0x91befb[_0x31b3('0x21')];var _0x136cee=_0x533f64?0x0:_0x227482[_0x31b3('0x20')];var _0x589186=_0x533f64?_0x91befb[_0x31b3('0x21')]:_0x227482[_0x31b3('0x20')]+_0x227482['limit'];var _0x45e47f;if(_0x589186>=_0x561a0f){_0x589186=_0x561a0f;_0x45e47f=0xc8;}else{_0x45e47f=0xce;}_0x94c761[_0x31b3('0x1e')](_0x45e47f);return _0x94c761[_0x31b3('0x22')](_0x31b3('0x23'),_0x136cee+'-'+_0x589186+'/'+_0x561a0f)[_0x31b3('0x1f')](_0x91befb);}return null;};}function saveUpdates(_0x5643f6){return function(_0x3c7d96){if(_0x3c7d96){return _0x3c7d96[_0x31b3('0x24')](_0x5643f6)[_0x31b3('0x14')](function(_0x11c733){return _0x11c733;});}return null;};}function removeEntity(_0x2afa22){return function(_0x266fdc){if(_0x266fdc){return _0x266fdc[_0x31b3('0x25')]()[_0x31b3('0x14')](function(){_0x2afa22[_0x31b3('0x1e')](0xcc)[_0x31b3('0x26')]();});}};}function handleEntityNotFound(_0x1c713d){return function(_0x11291a){if(!_0x11291a){_0x1c713d[_0x31b3('0x27')](0x194);}return _0x11291a;};}function handleError(_0x402a5f,_0x154a05){_0x154a05=_0x154a05||0x1f4;return function(_0x6b0036){logger['error'](_0x6b0036[_0x31b3('0x28')]);if(_0x6b0036[_0x31b3('0x29')]){delete _0x6b0036[_0x31b3('0x29')];}_0x402a5f[_0x31b3('0x1e')](_0x154a05)[_0x31b3('0x2a')](_0x6b0036);};}exports[_0x31b3('0x2b')]=function(_0x1526db,_0x350feb){var _0x501b85={},_0x3e58d6={},_0x5eca2c={'count':0x0,'rows':[]};var _0x4d869e=_[_0x31b3('0x2c')](db[_0x31b3('0x2d')][_0x31b3('0x2e')],function(_0x385539){return{'name':_0x385539[_0x31b3('0x2f')],'type':_0x385539[_0x31b3('0x30')][_0x31b3('0x31')]};});_0x3e58d6['model']=_[_0x31b3('0x2c')](_0x4d869e,_0x31b3('0x29'));_0x3e58d6[_0x31b3('0x32')]=_[_0x31b3('0x33')](_0x1526db['query']);_0x3e58d6[_0x31b3('0x34')]=_[_0x31b3('0x35')](_0x3e58d6[_0x31b3('0x36')],_0x3e58d6[_0x31b3('0x32')]);_0x501b85['attributes']=_[_0x31b3('0x35')](_0x3e58d6['model'],qs[_0x31b3('0x37')](_0x1526db[_0x31b3('0x32')][_0x31b3('0x37')]));_0x501b85[_0x31b3('0x38')]=_0x501b85[_0x31b3('0x38')]['length']?_0x501b85[_0x31b3('0x38')]:_0x3e58d6[_0x31b3('0x36')];if(!_0x1526db[_0x31b3('0x32')][_0x31b3('0x39')](_0x31b3('0x3a'))){_0x501b85[_0x31b3('0x3b')]=qs[_0x31b3('0x3b')](_0x1526db[_0x31b3('0x32')]['limit']);_0x501b85[_0x31b3('0x20')]=qs[_0x31b3('0x20')](_0x1526db['query'][_0x31b3('0x20')]);}_0x501b85[_0x31b3('0x3c')]=qs['sort'](_0x1526db[_0x31b3('0x32')]['sort']);_0x501b85[_0x31b3('0x3d')]=qs[_0x31b3('0x34')](_[_0x31b3('0x3e')](_0x1526db['query'],_0x3e58d6['filters']),_0x4d869e);if(_0x1526db[_0x31b3('0x32')][_0x31b3('0x3f')]){_0x501b85[_0x31b3('0x3d')]=_[_0x31b3('0x40')](_0x501b85[_0x31b3('0x3d')],{'$or':_[_0x31b3('0x2c')](_0x4d869e,function(_0x33cea3){if(_0x33cea3[_0x31b3('0x30')]!==_0x31b3('0x41')){var _0x303e48={};_0x303e48[_0x33cea3[_0x31b3('0x29')]]={'$like':'%'+_0x1526db['query'][_0x31b3('0x3f')]+'%'};return _0x303e48;}})});}_0x501b85=_[_0x31b3('0x40')]({},_0x501b85,_0x1526db[_0x31b3('0x42')]);var _0x272c19={'where':_0x501b85[_0x31b3('0x3d')]};return db['MailMessage']['count'](_0x272c19)[_0x31b3('0x14')](function(_0x525f9d){_0x5eca2c[_0x31b3('0x21')]=_0x525f9d;if(_0x1526db[_0x31b3('0x32')][_0x31b3('0x43')]){_0x501b85['include']=[{'all':!![]}];}return db['MailMessage'][_0x31b3('0x44')](_0x501b85);})[_0x31b3('0x14')](function(_0x112737){_0x5eca2c[_0x31b3('0x45')]=_0x112737;return _0x5eca2c;})[_0x31b3('0x14')](respondWithFilteredResult(_0x350feb,_0x501b85))['catch'](handleError(_0x350feb,null));};exports[_0x31b3('0x46')]=function(_0x50b643,_0x5ab5bc){var _0x67dab2={'raw':!![],'where':{'id':_0x50b643['params']['id']}},_0x537246={};_0x537246['model']=_[_0x31b3('0x33')](db[_0x31b3('0x2d')][_0x31b3('0x2e')]);_0x537246[_0x31b3('0x32')]=_[_0x31b3('0x33')](_0x50b643[_0x31b3('0x32')]);_0x537246[_0x31b3('0x34')]=_[_0x31b3('0x35')](_0x537246[_0x31b3('0x36')],_0x537246[_0x31b3('0x32')]);_0x67dab2[_0x31b3('0x38')]=_[_0x31b3('0x35')](_0x537246[_0x31b3('0x36')],qs[_0x31b3('0x37')](_0x50b643[_0x31b3('0x32')]['fields']));_0x67dab2[_0x31b3('0x38')]=_0x67dab2[_0x31b3('0x38')][_0x31b3('0x47')]?_0x67dab2[_0x31b3('0x38')]:_0x537246['model'];if(_0x50b643[_0x31b3('0x32')][_0x31b3('0x43')]){_0x67dab2[_0x31b3('0x48')]=[{'all':!![]}];}_0x67dab2=_[_0x31b3('0x40')]({},_0x67dab2,_0x50b643['options']);return db['MailMessage'][_0x31b3('0x49')](_0x67dab2)[_0x31b3('0x14')](handleEntityNotFound(_0x5ab5bc,null))[_0x31b3('0x14')](respondWithResult(_0x5ab5bc,null))['catch'](handleError(_0x5ab5bc,null));};exports[_0x31b3('0x24')]=function(_0x1dab4d,_0x1dcdb5){if(_0x1dab4d['body']['id']){delete _0x1dab4d[_0x31b3('0x4a')]['id'];}return db[_0x31b3('0x2d')][_0x31b3('0x49')]({'where':{'id':_0x1dab4d['params']['id']}})[_0x31b3('0x14')](handleEntityNotFound(_0x1dcdb5,null))[_0x31b3('0x14')](saveUpdates(_0x1dab4d['body'],null))[_0x31b3('0x14')](respondWithResult(_0x1dcdb5,null))[_0x31b3('0x1d')](handleError(_0x1dcdb5,null));};exports[_0x31b3('0x25')]=function(_0x4b3206,_0x383980){return db[_0x31b3('0x2d')][_0x31b3('0x49')]({'where':{'id':_0x4b3206[_0x31b3('0x4b')]['id']}})[_0x31b3('0x14')](handleEntityNotFound(_0x383980,null))[_0x31b3('0x14')](removeEntity(_0x383980,null))['catch'](handleError(_0x383980,null));};exports[_0x31b3('0x4c')]=function(_0x353751,_0x2d2f86){return db[_0x31b3('0x2d')]['describe']()[_0x31b3('0x14')](respondWithResult(_0x2d2f86,null))[_0x31b3('0x1d')](handleError(_0x2d2f86,null));};exports[_0x31b3('0x4d')]=function(_0x99872c,_0x5828e1){return db[_0x31b3('0x2d')]['create'](_0x99872c[_0x31b3('0x4a')])[_0x31b3('0x14')](function(_0x3faf83){if(_0x3faf83){if(_0x3faf83[_0x31b3('0x4e')]===_0x31b3('0x4f')&&!_0x3faf83[_0x31b3('0x50')]){var _0x5c6b4d,_0x5975c4,_0x2a1bfd;if(_0x99872c['body']['to']){_0x5975c4=_0x99872c[_0x31b3('0x4a')]['to'][_0x31b3('0x51')](',')[0x0];}return db['MailAccount'][_0x31b3('0x52')]({'where':{'id':_0x3faf83[_0x31b3('0x53')]},'include':[{'model':db[_0x31b3('0x54')],'as':'List','include':[{'model':db[_0x31b3('0x55')],'as':_0x31b3('0x56'),'where':{'email':_0x5975c4},'limit':0x1,'order':[[_0x31b3('0x57'),_0x31b3('0x58')]]}]},{'model':db[_0x31b3('0x59')],'as':_0x31b3('0x5a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x31b3('0x5b'),'raw':!![]}]}]})['then'](function(_0x3e9eae){_0x5c6b4d=_0x3e9eae;if(!_0x5c6b4d||!_0x5c6b4d[_0x31b3('0x5a')])return;var _0x33fbb6=_0x5c6b4d[_0x31b3('0x5c')]();if(_0x99872c[_0x31b3('0x4a')]['attachments']&&_0x99872c[_0x31b3('0x4a')]['attachments'][_0x31b3('0x47')]){for(var _0x5f4384=0x0;_0x5f4384<_0x99872c[_0x31b3('0x4a')][_0x31b3('0x5d')]['length'];_0x5f4384+=0x1){_0x99872c[_0x31b3('0x4a')][_0x31b3('0x5d')][_0x5f4384]={'filename':_0x99872c[_0x31b3('0x4a')][_0x31b3('0x5d')][_0x5f4384][_0x31b3('0x29')],'path':path[_0x31b3('0x5e')](config['root'],_0x31b3('0x5f'),_0x99872c[_0x31b3('0x4a')][_0x31b3('0x5d')][_0x5f4384][_0x31b3('0x60')])};}}_0x2a1bfd={'account':_0x33fbb6,'message':_0x99872c['body']};return;})[_0x31b3('0x14')](function(){if(_0x5c6b4d[_0x31b3('0x61')]){if(_0x5c6b4d[_0x31b3('0x61')]['Contacts'][_0x31b3('0x47')]){return _0x5c6b4d[_0x31b3('0x61')]['Contacts'][0x0];}else{return db[_0x31b3('0x55')][_0x31b3('0x4d')](_[_0x31b3('0xd')](_0x99872c['body'],{'firstName':_0x99872c[_0x31b3('0x4a')]['to'],'email':_0x99872c[_0x31b3('0x4a')]['to'],'phone':_0x99872c[_0x31b3('0x4a')]['to'],'ListId':_0x5c6b4d[_0x31b3('0x62')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x31b3('0x14')](function(){if(_0x2a1bfd){return respondWithRpcPromise(_0x31b3('0x63'),_0x31b3('0x64'),_0x2a1bfd,client9003)[_0x31b3('0x14')](function(_0x317540){return _0x3faf83[_0x31b3('0x24')]({'read':!![],'messageId':_0x317540[_0x31b3('0x65')],'sentAt':moment()[_0x31b3('0x66')](_0x31b3('0x67'))});})['catch'](function(_0x342668){logger['error']('%s',JSON[_0x31b3('0x19')](_0x342668));return _0x3faf83;});}return _0x3faf83;});}return _0x3faf83;}})[_0x31b3('0x14')](respondWithResult(_0x5828e1,0xc9))['catch'](handleError(_0x5828e1,null));};exports[_0x31b3('0x68')]=function(_0x5a119c,_0x260667){var _0x3bdd22={'agent':{},'channel':_0x31b3('0x69')};if(_0x5a119c[_0x31b3('0x4a')]['id']){delete _0x5a119c[_0x31b3('0x4a')]['id'];}_0x5a119c[_0x31b3('0x4a')][_0x31b3('0x6a')]=!![];_0x5a119c[_0x31b3('0x4a')]['readAt']=moment()[_0x31b3('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a119c[_0x31b3('0x4a')][_0x31b3('0x6b')]=_0x5a119c['body']['UserId']||_0x5a119c[_0x31b3('0x6c')]['id'];_0x3bdd22[_0x31b3('0x6d')]['id']=_0x5a119c[_0x31b3('0x4a')][_0x31b3('0x6b')];return db[_0x31b3('0x2d')][_0x31b3('0x49')]({'where':{'id':_0x5a119c[_0x31b3('0x4b')]['id'],'UserId':null}})[_0x31b3('0x14')](handleEntityNotFound(_0x260667,null))[_0x31b3('0x14')](saveUpdates(_0x5a119c[_0x31b3('0x4a')],null))[_0x31b3('0x14')](function(_0x35ea50){if(_0x35ea50){_0x3bdd22[_0x31b3('0x1b')]=_0x35ea50['get']({'plain':!![]});return db[_0x31b3('0x6e')][_0x31b3('0x49')]({'where':{'id':_0x35ea50['MailInteractionId']}});}return null;})[_0x31b3('0x14')](handleEntityNotFound(_0x260667,null))[_0x31b3('0x14')](function(_0x5787e2){if(_0x5787e2){return _0x5787e2[_0x31b3('0x24')]({'UserId':_0x5a119c['body']['UserId'],'read1stAt':_[_0x31b3('0x6f')](_0x5787e2[_0x31b3('0x70')])?moment()[_0x31b3('0x66')](_0x31b3('0x67')):undefined});}return null;})[_0x31b3('0x14')](function(_0x345da5){if(_0x345da5){_0x3bdd22[_0x31b3('0x71')]=_0x345da5[_0x31b3('0x72')]({'plain':!![]});interaction_log[_0x31b3('0x15')](_0x31b3('0x73'),_0x5a119c['user']['id'],_0x5a119c[_0x31b3('0x6c')]['name'],_0x5a119c[_0x31b3('0x6c')]['role'],_0x3bdd22['interaction']['id'],_0x5a119c[_0x31b3('0x4a')]?JSON[_0x31b3('0x19')](_0x5a119c[_0x31b3('0x4a')]):'null');return respondWithRpcPromise(_0x31b3('0x74'),_0x31b3('0x75'),_0x3bdd22);}return null;})[_0x31b3('0x14')](function(_0x555efc){var _0x57ee3c=_0x31b3('0x76')+_0x555efc[_0x31b3('0x1b')][_0x31b3('0x77')];return db['sequelize']['query'](_0x57ee3c,{'type':db[_0x31b3('0x78')][_0x31b3('0x79')][_0x31b3('0x7a')],'raw':!![]})[_0x31b3('0x14')](function(_0x2dff97){return _0x2dff97;});})['then'](function(_0x1eee6b){if(_0x1eee6b){_0x3bdd22[_0x31b3('0x1b')][_0x31b3('0x7b')]=_0x1eee6b[0x0];if(!_0x5a119c[_0x31b3('0x4a')][_0x31b3('0x6b')])return;return db[_0x31b3('0x7c')]['find']({'where':{'id':_0x5a119c['body'][_0x31b3('0x6b')],'role':_0x31b3('0x6d')},'attributes':['id','name',_0x31b3('0x7d'),_0x31b3('0x7e'),_0x31b3('0x7f')],'raw':!![]});}return null;})['then'](function(_0x19f1af){if(!_0x19f1af)return null;_0x3bdd22[_0x31b3('0x1b')][_0x31b3('0x6d')]=_0x19f1af;return _0x3bdd22;})[_0x31b3('0x14')](function(_0x480c31){if(_0x480c31){if(_0x5a119c[_0x31b3('0x4a')][_0x31b3('0x80')]){_0x3bdd22['message'][_0x31b3('0x81')]=util[_0x31b3('0x66')](_0x31b3('0x82'),_0x5a119c['user']['name']);_0x3bdd22['message'][_0x31b3('0x83')]=_0x3bdd22[_0x31b3('0x83')];_0x3bdd22[_0x31b3('0x1b')][_0x31b3('0x84')]=_0x3bdd22[_0x31b3('0x83')];_0x3bdd22['message'][_0x31b3('0x85')]='accept';_0x3bdd22[_0x31b3('0x1b')][_0x31b3('0x4a')]=htmlToText[_0x31b3('0x86')](_0x3bdd22[_0x31b3('0x1b')][_0x31b3('0x4a')]);return respondWithRpcPromise('EventManager',_0x31b3('0x87'),{'event':_0x31b3('0x88'),'message':_0x3bdd22['message']},client9002)[_0x31b3('0x14')](function(){return _0x3bdd22;});}return _0x3bdd22;}return null;})['then'](respondWithResult(_0x260667,null))[_0x31b3('0x1d')](handleError(_0x260667,null));};exports['reject']=function(_0x191d07,_0x57ad8f){var _0x58df2a={'agent':{},'channel':_0x31b3('0x69')};if(_0x191d07['body']['id']){delete _0x191d07[_0x31b3('0x4a')]['id'];}_0x191d07[_0x31b3('0x4a')][_0x31b3('0x6b')]=_0x191d07[_0x31b3('0x4a')]['UserId']||_0x191d07[_0x31b3('0x6c')]['id'];_0x58df2a[_0x31b3('0x6d')]['id']=_0x191d07[_0x31b3('0x4a')][_0x31b3('0x6b')];return db[_0x31b3('0x2d')][_0x31b3('0x49')]({'where':{'id':_0x191d07['params']['id'],'UserId':null}})[_0x31b3('0x14')](handleEntityNotFound(_0x57ad8f,null))[_0x31b3('0x14')](function(_0x54b103){if(_0x54b103){_0x58df2a[_0x31b3('0x1b')]=_0x54b103[_0x31b3('0x72')]({'plain':!![]});return db[_0x31b3('0x6e')][_0x31b3('0x49')]({'where':{'id':_0x54b103[_0x31b3('0x89')]}});}return null;})[_0x31b3('0x14')](handleEntityNotFound(_0x57ad8f,null))[_0x31b3('0x14')](function(_0x19a94e){if(_0x19a94e){_0x58df2a[_0x31b3('0x71')]=_0x19a94e['get']({'plain':!![]});interaction_log[_0x31b3('0x15')](_0x31b3('0x8a'),_0x191d07[_0x31b3('0x6c')]['id'],_0x191d07[_0x31b3('0x6c')][_0x31b3('0x29')],_0x191d07['user'][_0x31b3('0x8b')],_0x58df2a[_0x31b3('0x71')]['id'],_0x191d07['body']?JSON[_0x31b3('0x19')](_0x191d07[_0x31b3('0x4a')]):_0x31b3('0x8c'));return respondWithRpcPromise('RejectMessage',_0x31b3('0x8d'),_0x58df2a);}return null;})[_0x31b3('0x14')](function(_0x4ad226){var _0x34b9fd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ad226[_0x31b3('0x1b')][_0x31b3('0x77')];return db[_0x31b3('0x8e')][_0x31b3('0x32')](_0x34b9fd,{'type':db[_0x31b3('0x78')][_0x31b3('0x79')]['SELECT'],'raw':!![]})[_0x31b3('0x14')](function(_0xb39885){return _0xb39885;});})[_0x31b3('0x14')](function(_0x3bc595){if(_0x3bc595){_0x58df2a[_0x31b3('0x1b')][_0x31b3('0x7b')]=_0x3bc595[0x0];if(!_0x191d07[_0x31b3('0x4a')][_0x31b3('0x6b')])return;return db[_0x31b3('0x7c')]['find']({'where':{'id':_0x191d07[_0x31b3('0x4a')][_0x31b3('0x6b')],'role':'agent'},'attributes':['id','name',_0x31b3('0x7d'),_0x31b3('0x7e'),_0x31b3('0x7f')],'raw':!![]});}return null;})['then'](function(_0x228362){if(!_0x228362)return null;_0x58df2a[_0x31b3('0x1b')][_0x31b3('0x6d')]=_0x228362;return _0x58df2a;})['then'](function(_0x977410){if(_0x977410){_0x977410['message'][_0x31b3('0x81')]=util[_0x31b3('0x66')](_0x31b3('0x82'),_0x191d07[_0x31b3('0x6c')][_0x31b3('0x29')]);_0x977410['message']['channel']=_0x58df2a[_0x31b3('0x83')];_0x977410['message'][_0x31b3('0x84')]=_0x58df2a[_0x31b3('0x83')];_0x977410[_0x31b3('0x1b')][_0x31b3('0x85')]='reject';_0x977410['message']['body']=htmlToText[_0x31b3('0x86')](_0x58df2a[_0x31b3('0x1b')][_0x31b3('0x4a')]);respondWithRpcPromise('EventManager',_0x31b3('0x87'),{'event':_0x31b3('0x8f'),'message':_0x977410[_0x31b3('0x1b')]},client9002);return _0x58df2a;}return null;})['then'](respondWithResult(_0x57ad8f,null))['catch'](handleError(_0x57ad8f,null));};exports[_0x31b3('0x90')]=function(_0x479be4,_0x41556f){var _0x2d9da4=moment()[_0x31b3('0x91')]()['toString']();var _0x3c0cbc=path[_0x31b3('0x5e')](config[_0x31b3('0x92')],_0x31b3('0x93'),_0x31b3('0x94'),_0x31b3('0x95'));var _0x20b833=path[_0x31b3('0x5e')](config[_0x31b3('0x92')],'server',_0x31b3('0x94'),_0x31b3('0x5d'));var _0x2bb145=util['format'](_0x31b3('0x96'),_0x2d9da4);return db[_0x31b3('0x2d')][_0x31b3('0x49')]({'where':{'id':_0x479be4['params']['id']},'attributes':['id',_0x31b3('0x4a'),'from','to','cc',_0x31b3('0x97'),'subject','createdAt'],'include':_0x479be4[_0x31b3('0x32')][_0x31b3('0x5d')]?[{'model':db['Attachment'],'as':_0x31b3('0x98')}]:undefined})[_0x31b3('0x14')](handleEntityNotFound(_0x41556f,null))['then'](function(_0x5177c8){if(_0x5177c8){var _0x39bee8=_0x5177c8;var _0x331ea8={'from':_0x39bee8[_0x31b3('0x99')],'to':_0x39bee8['to'],'subject':_0x39bee8['subject'],'html':htmlEntities[_0x31b3('0x9a')](_0x39bee8[_0x31b3('0x4a')]),'headers':{'Date':moment(_0x39bee8[_0x31b3('0x9b')])[_0x31b3('0x66')](_0x31b3('0x9c'))},'attachments':[]};if(_0x5177c8['cc']){_0x331ea8[_0x31b3('0x9d')]['Cc']=_0x5177c8['cc'];}if(_0x5177c8[_0x31b3('0x97')]){_0x331ea8[_0x31b3('0x9d')][_0x31b3('0x9e')]=_0x5177c8[_0x31b3('0x97')];}return new BPromise(function(_0x12feea,_0x5d1c5b){if(_0x5177c8[_0x31b3('0x98')]){for(var _0x47141f=0x0;_0x47141f<_0x5177c8[_0x31b3('0x98')][_0x31b3('0x47')];_0x47141f++){var _0x1701c2=_0x5177c8['Attachments'][_0x47141f];var _0x31e48=path['join'](_0x20b833,_0x1701c2[_0x31b3('0x60')]);if(fs[_0x31b3('0x9f')](_0x31e48)){_0x331ea8[_0x31b3('0x5d')][_0x31b3('0xa0')]({'name':_0x1701c2[_0x31b3('0x29')],'contentType':_0x1701c2['type'],'data':fs[_0x31b3('0xa1')](_0x31e48)});}}}emlformat['build'](_0x331ea8,function(_0x3f4ca6,_0x302ca3){if(_0x3f4ca6)return _0x5d1c5b(_0x3f4ca6);fs['writeFileSync'](path['join'](_0x3c0cbc,_0x2bb145),_0x302ca3);return _0x12feea(_0x302ca3);});});}})['then'](function(_0x3005fc){if(_0x3005fc){return _0x41556f[_0x31b3('0x90')](path[_0x31b3('0x5e')](_0x3c0cbc,_0x2bb145),_0x2bb145,function(_0x341573){if(!_0x341573)fs[_0x31b3('0xa2')](path['join'](_0x3c0cbc,_0x2bb145));});}})['catch'](handleError(_0x41556f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 209d995..453c5b8 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 _0x0c27=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x544d7e,_0x5945b8){var _0x3cc699=function(_0x484ba5){while(--_0x484ba5){_0x544d7e['push'](_0x544d7e['shift']());}};_0x3cc699(++_0x5945b8);}(_0x0c27,0xb1));var _0x70c2=function(_0x36e783,_0x306d76){_0x36e783=_0x36e783-0x0;var _0x5693c4=_0x0c27[_0x36e783];return _0x5693c4;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x70c2('0x0'))['db'][_0x70c2('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x70c2('0x2')](0x0);var events={'afterCreate':_0x70c2('0x3'),'afterUpdate':_0x70c2('0x4'),'afterDestroy':_0x70c2('0x5')};function emitEvent(_0x5c46af){return function(_0x20d422,_0x4410ab,_0x18011d){MailMessageEvents[_0x70c2('0x6')](_0x5c46af+':'+_0x20d422['id'],_0x20d422);MailMessageEvents[_0x70c2('0x6')](_0x5c46af,_0x20d422);_0x18011d(null);};}for(var e in events){if(events[_0x70c2('0x7')](e)){var event=events[e];MailMessage[_0x70c2('0x8')](e,emitEvent(event));}}module[_0x70c2('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xc908=['hasOwnProperty','events','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x3cd590,_0x54deaa){var _0x149858=function(_0x8b1312){while(--_0x8b1312){_0x3cd590['push'](_0x3cd590['shift']());}};_0x149858(++_0x54deaa);}(_0xc908,0x179));var _0x8c90=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xc908[_0x15cdcb];return _0x37b069;};'use strict';var EventEmitter=require(_0x8c90('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8c90('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8c90('0x2')](0x0);var events={'afterCreate':_0x8c90('0x3'),'afterUpdate':_0x8c90('0x4'),'afterDestroy':_0x8c90('0x5')};function emitEvent(_0x125c02){return function(_0x7bc31e,_0x3d776e,_0x8bea26){MailMessageEvents['emit'](_0x125c02+':'+_0x7bc31e['id'],_0x7bc31e);MailMessageEvents[_0x8c90('0x6')](_0x125c02,_0x7bc31e);_0x8bea26(null);};}for(var e in events){if(events[_0x8c90('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f23c101..4e637ed 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 _0x75b2=['plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','out','isNil','MailInteraction','findOne','MailInteractionId','update','createdAt','lodash','util','../../config/logger','api','request-promise','html-to-text','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId'];(function(_0x5b78fe,_0x44542c){var _0x24ac3c=function(_0x552b51){while(--_0x552b51){_0x5b78fe['push'](_0x5b78fe['shift']());}};_0x24ac3c(++_0x44542c);}(_0x75b2,0xe6));var _0x275b=function(_0x520407,_0x24a4ce){_0x520407=_0x520407-0x0;var _0x45f7a1=_0x75b2[_0x520407];return _0x45f7a1;};'use strict';var _=require(_0x275b('0x0'));var util=require(_0x275b('0x1'));var logger=require(_0x275b('0x2'))(_0x275b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x275b('0x4'));var htmlToText=require(_0x275b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x275b('0x6'));var config=require(_0x275b('0x7'));var attributes=require('./mailMessage.attributes');module[_0x275b('0x8')]=function(_0x3e0235,_0x3c901d){return _0x3e0235[_0x275b('0x9')](_0x275b('0xa'),attributes,{'tableName':_0x275b('0xb'),'paranoid':![],'indexes':[{'name':_0x275b('0xc'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x275b('0xd'),_0x275b('0xe')],'type':_0x275b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x44b946,_0x26acb9,_0x27e73d){if(_0x44b946[_0x275b('0x10')]){_0x44b946[_0x275b('0xd')]=htmlToText['fromString'](_0x44b946[_0x275b('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x27e73d(null,_0x26acb9);},'afterCreate':function(_0x26aea0,_0x4d3da2,_0x484af8){var _0x1cc8b3=_0x3e0235[_0x275b('0x11')];var _0x538982=_0x26aea0['get']({'plain':!![]});if(_0x538982[_0x275b('0x12')][_0x275b('0x13')]()==='in'||_0x538982['direction'][_0x275b('0x13')]()===_0x275b('0x14')&&!_0x538982['secret']&&!_[_0x275b('0x15')](_0x538982['UserId'])){_0x1cc8b3[_0x275b('0x16')][_0x275b('0x17')]({'where':{'id':_0x538982[_0x275b('0x18')]}})['then'](function(_0x35e9ea){if(_0x35e9ea){_0x35e9ea[_0x275b('0x19')]({'lastMsgAt':_0x538982[_0x275b('0x1a')],'lastMsgDirection':_0x538982['direction']['toLowerCase']()});}})['catch'](function(_0x289943){console['error'](_0x289943);});}_0x484af8();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x919d=['then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId'];(function(_0x228746,_0xed3a06){var _0x3e3c5a=function(_0xf1d31c){while(--_0xf1d31c){_0x228746['push'](_0x228746['shift']());}};_0x3e3c5a(++_0xed3a06);}(_0x919d,0x1d6));var _0xd919=function(_0x1c2505,_0x1a77ae){_0x1c2505=_0x1c2505-0x0;var _0x316005=_0x919d[_0x1c2505];return _0x316005;};'use strict';var _=require(_0xd919('0x0'));var util=require('util');var logger=require(_0xd919('0x1'))(_0xd919('0x2'));var moment=require('moment');var BPromise=require(_0xd919('0x3'));var rp=require(_0xd919('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xd919('0x5'));var rimraf=require('rimraf');var config=require(_0xd919('0x6'));var attributes=require(_0xd919('0x7'));module[_0xd919('0x8')]=function(_0x418952,_0x4aba8d){return _0x418952[_0xd919('0x9')](_0xd919('0xa'),attributes,{'tableName':_0xd919('0xb'),'paranoid':![],'indexes':[{'name':_0xd919('0xc'),'fields':[_0xd919('0xc')]},{'name':_0xd919('0xd'),'fields':[_0xd919('0xe'),_0xd919('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2466d3,_0x4eace8,_0x9149c3){if(_0x2466d3['body']){_0x2466d3[_0xd919('0xe')]=htmlToText['fromString'](_0x2466d3[_0xd919('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x9149c3(null,_0x4eace8);},'afterCreate':function(_0x38eb11,_0x32e1cb,_0x2ee617){var _0x2f08c9=_0x418952['models'];var _0x743857=_0x38eb11['get']({'plain':!![]});if(_0x743857[_0xd919('0x11')][_0xd919('0x12')]()==='in'||_0x743857['direction']['toLowerCase']()===_0xd919('0x13')&&!_0x743857[_0xd919('0x14')]&&!_[_0xd919('0x15')](_0x743857[_0xd919('0x16')])){_0x2f08c9[_0xd919('0x17')][_0xd919('0x18')]({'where':{'id':_0x743857[_0xd919('0x19')]}})[_0xd919('0x1a')](function(_0xc72ad7){if(_0xc72ad7){_0xc72ad7['update']({'lastMsgAt':_0x743857[_0xd919('0x1b')],'lastMsgDirection':_0x743857[_0xd919('0x11')][_0xd919('0x12')]()});}})[_0xd919('0x1c')](function(_0x495dfe){console[_0xd919('0x1d')](_0x495dfe);});}_0x2ee617();}},'charset':'utf8mb4','collate':_0xd919('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d04902c..c198587 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 _0x47c5=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailMessage','create','options','info','debug','CreateMailMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x1e1f03,_0x4816ee){var _0x589d33=function(_0x4ce047){while(--_0x4ce047){_0x1e1f03['push'](_0x1e1f03['shift']());}};_0x589d33(++_0x4816ee);}(_0x47c5,0x165));var _0x547c=function(_0x94c822,_0x12e5a7){_0x94c822=_0x94c822-0x0;var _0x47adb3=_0x47c5[_0x94c822];return _0x47adb3;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});}exports['CreateMailMessage']=function(_0x4511d3){var _0x41149f=this;return new Promise(function(_0x496c38,_0x5453f9){return db[_0x547c('0x1b')][_0x547c('0x1c')](_0x4511d3['body'],{'raw':_0x4511d3[_0x547c('0x1d')]?_0x4511d3[_0x547c('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x547c('0x12')](function(_0x17fd97){logger[_0x547c('0x1e')]('CreateMailMessage',_0x4511d3);logger[_0x547c('0x1f')](_0x547c('0x20'),_0x4511d3,JSON[_0x547c('0x16')](_0x17fd97));_0x496c38(_0x17fd97);})[_0x547c('0x21')](function(_0x1f3581){logger[_0x547c('0x17')](_0x547c('0x20'),_0x1f3581[_0x547c('0x19')],_0x4511d3);_0x5453f9(_0x41149f['error'](0x1f4,_0x1f3581[_0x547c('0x19')]));});});}; \ No newline at end of file +var _0x0972=['message','catch','CreateMailMessage','MailMessage','body','options','raw','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d94b1,_0x29bbad){var _0x3a1d08=function(_0x1a2cbb){while(--_0x1a2cbb){_0x2d94b1['push'](_0x2d94b1['shift']());}};_0x3a1d08(++_0x29bbad);}(_0x0972,0x64));var _0x2097=function(_0xe839a9,_0x1fac48){_0xe839a9=_0xe839a9-0x0;var _0x573d4c=_0x0972[_0xe839a9];return _0x573d4c;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});config[_0x2097('0xa')]=_['defaults'](config[_0x2097('0xa')],{'host':_0x2097('0xb'),'port':0x18eb});var socket=require(_0x2097('0xc'))(new Redis(config[_0x2097('0xa')]));require(_0x2097('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e0024,_0x3b8b76,_0x131f06){return new BPromise(function(_0x430754,_0x7baeb3){return client[_0x2097('0xe')](_0x2e0024,_0x131f06)[_0x2097('0xf')](function(_0x1d1166){logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));logger[_0x2097('0x13')](_0x2097('0x14'),_0x3b8b76,_0x2097('0x12'),JSON[_0x2097('0x15')](_0x1d1166));if(_0x1d1166[_0x2097('0x16')]){if(_0x1d1166[_0x2097('0x16')][_0x2097('0x17')]===0x1f4){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x1d1166['error'][_0x2097('0x18')]);return _0x7baeb3(_0x1d1166[_0x2097('0x16')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x3b8b76,_0x1d1166[_0x2097('0x16')]['message']);return _0x430754(_0x1d1166[_0x2097('0x16')][_0x2097('0x18')]);}else{logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));_0x430754(_0x1d1166['result'][_0x2097('0x18')]);}})[_0x2097('0x19')](function(_0x451584){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x451584);_0x7baeb3(_0x451584);});});}exports[_0x2097('0x1a')]=function(_0x253f5d){var _0x46b5e0=this;return new Promise(function(_0x5d8b9e,_0x4d957e){return db[_0x2097('0x1b')]['create'](_0x253f5d[_0x2097('0x1c')],{'raw':_0x253f5d[_0x2097('0x1d')]?_0x253f5d['options'][_0x2097('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2e17c8){logger[_0x2097('0x10')](_0x2097('0x1a'),_0x253f5d);logger[_0x2097('0x13')](_0x2097('0x1a'),_0x253f5d,JSON[_0x2097('0x15')](_0x2e17c8));_0x5d8b9e(_0x2e17c8);})['catch'](function(_0xae5f9){logger['error'](_0x2097('0x1a'),_0xae5f9[_0x2097('0x18')],_0x253f5d);_0x4d957e(_0x46b5e0[_0x2097('0x16')](0x1f4,_0xae5f9[_0x2097('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ae59205..aa420c7 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 _0xdafe=['register','length','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x8d1e0,_0x255679){var _0x54f655=function(_0x4a611a){while(--_0x4a611a){_0x8d1e0['push'](_0x8d1e0['shift']());}};_0x54f655(++_0x255679);}(_0xdafe,0x6a));var _0xedaf=function(_0xcb511d,_0xed2ed2){_0xcb511d=_0xcb511d-0x0;var _0x48439c=_0xdafe[_0xcb511d];return _0x48439c;};'use strict';var MailMessageEvents=require(_0xedaf('0x0'));var events=[_0xedaf('0x1'),_0xedaf('0x2'),_0xedaf('0x3')];function createListener(_0x372e81,_0x359a93){return function(_0x217a9a){_0x359a93[_0xedaf('0x4')](_0x372e81,_0x217a9a);};}function removeListener(_0xb75813,_0x4037e0){return function(){MailMessageEvents[_0xedaf('0x5')](_0xb75813,_0x4037e0);};}exports[_0xedaf('0x6')]=function(_0x5a85a7){for(var _0x1b0c20=0x0,_0x4ed160=events[_0xedaf('0x7')];_0x1b0c20<_0x4ed160;_0x1b0c20++){var _0x3f2380=events[_0x1b0c20];var _0x54129e=createListener('mailMessage:'+_0x3f2380,_0x5a85a7);MailMessageEvents['on'](_0x3f2380,_0x54129e);}}; \ No newline at end of file +var _0x1457=['remove','register','length','save'];(function(_0x16c536,_0x118d98){var _0x37f817=function(_0x59d85a){while(--_0x59d85a){_0x16c536['push'](_0x16c536['shift']());}};_0x37f817(++_0x118d98);}(_0x1457,0x67));var _0x7145=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x1457[_0x5b6cf1];return _0x46278c;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x7145('0x0'),_0x7145('0x1'),'update'];function createListener(_0x4cb722,_0x1ff8c4){return function(_0x5369f1){_0x1ff8c4['emit'](_0x4cb722,_0x5369f1);};}function removeListener(_0x344ce5,_0x31fad7){return function(){MailMessageEvents['removeListener'](_0x344ce5,_0x31fad7);};}exports[_0x7145('0x2')]=function(_0x451d81){for(var _0x44477e=0x0,_0x3b3b34=events[_0x7145('0x3')];_0x44477e<_0x3b3b34;_0x44477e++){var _0x2e24fc=events[_0x44477e];var _0x2a3067=createListener('mailMessage:'+_0x2e24fc,_0x451d81);MailMessageEvents['on'](_0x2e24fc,_0x2a3067);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 75381bc..2672dbc 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 _0x352e=['/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers'];(function(_0x289f68,_0x561489){var _0xa019c5=function(_0x4418a2){while(--_0x4418a2){_0x289f68['push'](_0x289f68['shift']());}};_0xa019c5(++_0x561489);}(_0x352e,0x150));var _0xe352=function(_0x27854d,_0x2b607a){_0x27854d=_0x27854d-0x0;var _0x57e391=_0x352e[_0x27854d];return _0x57e391;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe352('0x0'));var express=require(_0xe352('0x1'));var router=express[_0xe352('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe352('0x3'));var interaction=require(_0xe352('0x4'));var config=require(_0xe352('0x5'));var controller=require(_0xe352('0x6'));router[_0xe352('0x7')]('/',auth[_0xe352('0x8')](),controller[_0xe352('0x9')]);router[_0xe352('0x7')](_0xe352('0xa'),auth[_0xe352('0x8')](),controller[_0xe352('0xb')]);router[_0xe352('0x7')](_0xe352('0xc'),auth['isAuthenticated'](),controller[_0xe352('0xd')]);router[_0xe352('0x7')]('/:id/members',auth[_0xe352('0x8')](),controller[_0xe352('0xe')]);router[_0xe352('0x7')](_0xe352('0xf'),auth[_0xe352('0x8')](),controller['getTeams']);router[_0xe352('0x7')](_0xe352('0x10'),auth[_0xe352('0x8')](),controller[_0xe352('0x11')]);router[_0xe352('0x12')]('/',auth[_0xe352('0x8')](),controller[_0xe352('0x13')]);router[_0xe352('0x12')](_0xe352('0xf'),auth['isAuthenticated'](),controller[_0xe352('0x14')]);router[_0xe352('0x12')](_0xe352('0x10'),auth[_0xe352('0x8')](),controller[_0xe352('0x15')]);router[_0xe352('0x16')](_0xe352('0xc'),auth[_0xe352('0x8')](),controller[_0xe352('0x17')]);router[_0xe352('0x18')](_0xe352('0xc'),auth[_0xe352('0x8')](),controller['destroy']);router[_0xe352('0x18')](_0xe352('0xf'),auth[_0xe352('0x8')](),controller[_0xe352('0x19')]);router[_0xe352('0x18')](_0xe352('0x10'),auth['isAuthenticated'](),controller[_0xe352('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x758d=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x758d,0xd2));var _0xd758=function(_0x4e0f1f,_0x5360a){_0x4e0f1f=_0x4e0f1f-0x0;var _0x50973b=_0x758d[_0x4e0f1f];return _0x50973b;};'use strict';var multer=require(_0xd758('0x0'));var util=require('util');var path=require(_0xd758('0x1'));var timeout=require(_0xd758('0x2'));var express=require('express');var router=express[_0xd758('0x3')]();var fs_extra=require(_0xd758('0x4'));var auth=require(_0xd758('0x5'));var interaction=require(_0xd758('0x6'));var config=require(_0xd758('0x7'));var controller=require(_0xd758('0x8'));router[_0xd758('0x9')]('/',auth[_0xd758('0xa')](),controller[_0xd758('0xb')]);router[_0xd758('0x9')]('/describe',auth[_0xd758('0xa')](),controller[_0xd758('0xc')]);router[_0xd758('0x9')](_0xd758('0xd'),auth[_0xd758('0xa')](),controller[_0xd758('0xe')]);router['get'](_0xd758('0xf'),auth[_0xd758('0xa')](),controller[_0xd758('0x10')]);router[_0xd758('0x9')](_0xd758('0x11'),auth[_0xd758('0xa')](),controller[_0xd758('0x12')]);router[_0xd758('0x9')](_0xd758('0x13'),auth[_0xd758('0xa')](),controller[_0xd758('0x14')]);router[_0xd758('0x15')]('/',auth[_0xd758('0xa')](),controller[_0xd758('0x16')]);router[_0xd758('0x15')](_0xd758('0x11'),auth['isAuthenticated'](),controller[_0xd758('0x17')]);router[_0xd758('0x15')](_0xd758('0x13'),auth['isAuthenticated'](),controller[_0xd758('0x18')]);router[_0xd758('0x19')](_0xd758('0xd'),auth[_0xd758('0xa')](),controller[_0xd758('0x1a')]);router['delete'](_0xd758('0xd'),auth[_0xd758('0xa')](),controller[_0xd758('0x1b')]);router[_0xd758('0x1c')](_0xd758('0x11'),auth[_0xd758('0xa')](),controller[_0xd758('0x1d')]);router[_0xd758('0x1c')](_0xd758('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 32575b8..c821a82 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 _0x2dcf=['rrmemory','sequelize','name','STRING','INTEGER'];(function(_0x76b627,_0x6fc886){var _0x222da1=function(_0x5d6038){while(--_0x5d6038){_0x76b627['push'](_0x76b627['shift']());}};_0x222da1(++_0x6fc886);}(_0x2dcf,0x1eb));var _0xf2dc=function(_0x43a3b8,_0x48a607){_0x43a3b8=_0x43a3b8-0x0;var _0x27fe90=_0x2dcf[_0x43a3b8];return _0x27fe90;};'use strict';var Sequelize=require(_0xf2dc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf2dc('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf2dc('0x2')]},'timeout':{'type':Sequelize[_0xf2dc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf2dc('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x1da7=['rrmemory','name','STRING'];(function(_0x1c8602,_0x1a9d54){var _0xc507c=function(_0x558a4b){while(--_0x558a4b){_0x1c8602['push'](_0x1c8602['shift']());}};_0xc507c(++_0x1a9d54);}(_0x1da7,0x1cf));var _0x71da=function(_0x36bafd,_0x132dec){_0x36bafd=_0x36bafd-0x0;var _0x42194a=_0x1da7[_0x36bafd];return _0x42194a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x71da('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x71da('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x71da('0x2'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1619e41..9d78496 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 _0x4f31=['end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','fields','attributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserMailQueue','nolimit','sort','pick','MailQueueId','filter','merge','findAndCountAll','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','order','hasOwnProperty','addTeams','ids','User','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','removeTeams','select','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','userMailQueue:save','removeAgents','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','localhost','socket.io-emitter','redis','register','sendStatus','status'];(function(_0x6ba1cb,_0x1f7e4a){var _0x164cbe=function(_0x1f8c34){while(--_0x1f8c34){_0x6ba1cb['push'](_0x6ba1cb['shift']());}};_0x164cbe(++_0x1f7e4a);}(_0x4f31,0xe5));var _0x14f3=function(_0x5674c3,_0xb3b206){_0x5674c3=_0x5674c3-0x0;var _0x2a9e1d=_0x4f31[_0x5674c3];return _0x2a9e1d;};'use strict';var BPromise=require(_0x14f3('0x0'));var util=require(_0x14f3('0x1'));var _=require('lodash');var squel=require(_0x14f3('0x2'));var Redis=require(_0x14f3('0x3'));var qs=require(_0x14f3('0x4'));var logger=require('../../config/logger')(_0x14f3('0x5'));var config=require('../../config/environment');var db=require(_0x14f3('0x6'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x14f3('0x7'),'port':0x18eb});var socket=require(_0x14f3('0x8'))(new Redis(config[_0x14f3('0x9')]));require('./mailQueue.socket')[_0x14f3('0xa')](socket);function respondWithStatusCode(_0x2a2961,_0x4a6885){_0x4a6885=_0x4a6885||0xcc;return function(_0x10a160){if(_0x10a160){return _0x2a2961[_0x14f3('0xb')](_0x4a6885);}return _0x2a2961[_0x14f3('0xc')](_0x4a6885)[_0x14f3('0xd')]();};}function respondWithResult(_0x21e0e1,_0x422374){_0x422374=_0x422374||0xc8;return function(_0x4e6709){if(_0x4e6709){return _0x21e0e1['status'](_0x422374)['json'](_0x4e6709);}};}function respondWithFilteredResult(_0x4e9b9c,_0x50b559){return function(_0x5a7392){if(_0x5a7392){var _0x5c7b59=typeof _0x50b559[_0x14f3('0xe')]===_0x14f3('0xf')&&typeof _0x50b559[_0x14f3('0x10')]==='undefined';var _0x36ba86=_0x5a7392[_0x14f3('0x11')];var _0x5dd200=_0x5c7b59?0x0:_0x50b559['offset'];var _0x5f3467=_0x5c7b59?_0x5a7392[_0x14f3('0x11')]:_0x50b559[_0x14f3('0xe')]+_0x50b559[_0x14f3('0x10')];var _0x43193e;if(_0x5f3467>=_0x36ba86){_0x5f3467=_0x36ba86;_0x43193e=0xc8;}else{_0x43193e=0xce;}_0x4e9b9c[_0x14f3('0xc')](_0x43193e);return _0x4e9b9c[_0x14f3('0x12')](_0x14f3('0x13'),_0x5dd200+'-'+_0x5f3467+'/'+_0x36ba86)[_0x14f3('0x14')](_0x5a7392);}return null;};}function saveUpdates(_0x47622d){return function(_0x87bea1){if(_0x87bea1){return _0x87bea1[_0x14f3('0x15')](_0x47622d)[_0x14f3('0x16')](function(_0x1841e6){return _0x1841e6;});}return null;};}function removeEntity(_0x1ea59c){return function(_0x388111){if(_0x388111){return _0x388111[_0x14f3('0x17')]()['then'](function(){var _0x983009=_0x388111[_0x14f3('0x18')]({'plain':!![]});var _0x318fc0=_0x14f3('0x19');return db[_0x14f3('0x1a')][_0x14f3('0x17')]({'where':{'type':_0x318fc0,'resourceId':_0x983009['id']}})['then'](function(){return _0x388111;});})[_0x14f3('0x16')](function(){_0x1ea59c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x577836){return function(_0x2ef86e){if(!_0x2ef86e){_0x577836[_0x14f3('0xb')](0x194);}return _0x2ef86e;};}function handleError(_0x11ef32,_0x439687){_0x439687=_0x439687||0x1f4;return function(_0x2cee2d){logger[_0x14f3('0x1b')](_0x2cee2d[_0x14f3('0x1c')]);if(_0x2cee2d[_0x14f3('0x1d')]){delete _0x2cee2d[_0x14f3('0x1d')];}_0x11ef32['status'](_0x439687)[_0x14f3('0x1e')](_0x2cee2d);};}exports[_0x14f3('0x1f')]=function(_0x37609b,_0x115c8b){var _0x1445c1={};var _0x1bd6ec={'count':0x0,'rows':[]};var _0x4c1678=_[_0x14f3('0x20')](db[_0x14f3('0x21')][_0x14f3('0x22')],function(_0x2b8fa6){return{'name':_0x2b8fa6[_0x14f3('0x23')],'type':_0x2b8fa6['type']['key']};});_0x1445c1=qs[_0x14f3('0x24')](_0x4c1678,_0x37609b);var _0x13f3d9={'where':_0x1445c1[_0x14f3('0x25')]};return db[_0x14f3('0x21')][_0x14f3('0x11')](_0x13f3d9)[_0x14f3('0x16')](function(_0x5bf77f){_0x1bd6ec[_0x14f3('0x11')]=_0x5bf77f;_0x1445c1[_0x14f3('0x26')]=qs[_0x14f3('0x26')](_0x37609b['query']);return db[_0x14f3('0x21')][_0x14f3('0x27')](_0x1445c1);})[_0x14f3('0x16')](function(_0x156da4){_0x1bd6ec[_0x14f3('0x28')]=_0x156da4;return _0x1bd6ec;})[_0x14f3('0x16')](respondWithFilteredResult(_0x115c8b,_0x1445c1))[_0x14f3('0x29')](handleError(_0x115c8b,null));};exports[_0x14f3('0x2a')]=function(_0x18798c,_0x480419){var _0x42a79d={'raw':!![],'where':{'id':_0x18798c[_0x14f3('0x2b')]['id']}},_0x48c78f={};_0x48c78f[_0x14f3('0x2c')]=_[_0x14f3('0x2d')](db[_0x14f3('0x21')][_0x14f3('0x22')]);_0x48c78f['query']=_[_0x14f3('0x2d')](_0x18798c[_0x14f3('0x2e')]);_0x48c78f[_0x14f3('0x2f')]=_[_0x14f3('0x30')](_0x48c78f[_0x14f3('0x2c')],_0x48c78f['query']);_0x42a79d['attributes']=_['intersection'](_0x48c78f[_0x14f3('0x2c')],qs['fields'](_0x18798c[_0x14f3('0x2e')][_0x14f3('0x31')]));_0x42a79d[_0x14f3('0x32')]=_0x42a79d[_0x14f3('0x32')][_0x14f3('0x33')]?_0x42a79d[_0x14f3('0x32')]:_0x48c78f['model'];if(_0x18798c[_0x14f3('0x2e')]['includeAll']){_0x42a79d[_0x14f3('0x26')]=[{'all':!![]}];}_0x42a79d=_['merge']({},_0x42a79d,_0x18798c[_0x14f3('0x34')]);return db[_0x14f3('0x21')][_0x14f3('0x35')](_0x42a79d)[_0x14f3('0x16')](handleEntityNotFound(_0x480419,null))['then'](respondWithResult(_0x480419,null))[_0x14f3('0x29')](handleError(_0x480419,null));};exports[_0x14f3('0x36')]=function(_0x453d75,_0x2ec8c8){return db[_0x14f3('0x21')][_0x14f3('0x36')](_0x453d75[_0x14f3('0x37')],{})['then'](function(_0x3a16a2){var _0x1c26ca=_0x453d75[_0x14f3('0x38')]['get']({'plain':!![]});if(!_0x1c26ca)throw new Error(_0x14f3('0x39'));if(_0x1c26ca[_0x14f3('0x3a')]===_0x14f3('0x38')){var _0x45afe9=_0x3a16a2['get']({'plain':!![]});var _0x50d371=_0x14f3('0x19');return db[_0x14f3('0x3b')][_0x14f3('0x35')]({'where':{'name':_0x50d371,'userProfileId':_0x1c26ca[_0x14f3('0x3c')]},'raw':!![]})[_0x14f3('0x16')](function(_0x11baf0){if(_0x11baf0&&_0x11baf0[_0x14f3('0x3d')]===0x0){return db[_0x14f3('0x1a')][_0x14f3('0x36')]({'name':_0x45afe9[_0x14f3('0x1d')],'resourceId':_0x45afe9['id'],'type':_0x11baf0[_0x14f3('0x1d')],'sectionId':_0x11baf0['id']},{})['then'](function(){return _0x3a16a2;});}else{return _0x3a16a2;}})[_0x14f3('0x29')](function(_0x68d979){logger[_0x14f3('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x68d979);throw _0x68d979;});}return _0x3a16a2;})[_0x14f3('0x16')](respondWithResult(_0x2ec8c8,0xc9))[_0x14f3('0x29')](handleError(_0x2ec8c8,null));};exports[_0x14f3('0x15')]=function(_0x5d7653,_0x4ab14c){if(_0x5d7653[_0x14f3('0x37')]['id']){delete _0x5d7653[_0x14f3('0x37')]['id'];}return db['MailQueue'][_0x14f3('0x35')]({'where':{'id':_0x5d7653[_0x14f3('0x2b')]['id']}})[_0x14f3('0x16')](handleEntityNotFound(_0x4ab14c,null))[_0x14f3('0x16')](saveUpdates(_0x5d7653[_0x14f3('0x37')],null))[_0x14f3('0x16')](respondWithResult(_0x4ab14c,null))[_0x14f3('0x29')](handleError(_0x4ab14c,null));};exports['destroy']=function(_0x1ab578,_0x570900){return db[_0x14f3('0x21')][_0x14f3('0x35')]({'where':{'id':_0x1ab578[_0x14f3('0x2b')]['id']}})['then'](handleEntityNotFound(_0x570900,null))[_0x14f3('0x16')](removeEntity(_0x570900,null))[_0x14f3('0x29')](handleError(_0x570900,null));};exports[_0x14f3('0x3e')]=function(_0x4c0c25,_0x4b403e){return db[_0x14f3('0x21')][_0x14f3('0x3e')]()[_0x14f3('0x16')](respondWithResult(_0x4b403e,null))['catch'](handleError(_0x4b403e,null));};exports[_0x14f3('0x3f')]=function(_0x282a61,_0xe00e80){var _0x4ece49={'raw':!![],'where':{}},_0x2dc652={},_0x2e4d32;return db[_0x14f3('0x21')][_0x14f3('0x40')]({'where':{'id':_0x282a61['params']['id']}})[_0x14f3('0x16')](handleEntityNotFound(_0xe00e80,null))[_0x14f3('0x16')](function(_0x372ef8){if(_0x372ef8){_0x2e4d32=_0x372ef8[_0x14f3('0x18')]({'plain':!![]});_0x2dc652[_0x14f3('0x2c')]=_[_0x14f3('0x2d')](db[_0x14f3('0x41')]['rawAttributes']);_0x2dc652['query']=_[_0x14f3('0x2d')](_0x282a61[_0x14f3('0x2e')]);_0x2dc652[_0x14f3('0x2f')]=_['intersection'](_0x2dc652[_0x14f3('0x2c')],_0x2dc652[_0x14f3('0x2e')]);_0x4ece49[_0x14f3('0x32')]=_['intersection'](_0x2dc652['model'],qs[_0x14f3('0x31')](_0x282a61[_0x14f3('0x2e')]['fields']));_0x4ece49['attributes']=_0x4ece49[_0x14f3('0x32')][_0x14f3('0x33')]?_0x4ece49[_0x14f3('0x32')]:_0x2dc652[_0x14f3('0x2c')];if(!_0x282a61[_0x14f3('0x2e')]['hasOwnProperty'](_0x14f3('0x42'))){_0x4ece49['limit']=qs[_0x14f3('0x10')](_0x282a61[_0x14f3('0x2e')][_0x14f3('0x10')]);_0x4ece49['offset']=qs[_0x14f3('0xe')](_0x282a61[_0x14f3('0x2e')]['offset']);}_0x4ece49['order']=qs['sort'](_0x282a61[_0x14f3('0x2e')][_0x14f3('0x43')]);_0x4ece49['where']=qs[_0x14f3('0x2f')](_[_0x14f3('0x44')](_0x282a61[_0x14f3('0x2e')],_0x2dc652[_0x14f3('0x2f')]));_0x4ece49[_0x14f3('0x25')][_0x14f3('0x45')]=_0x372ef8['id'];if(_0x282a61[_0x14f3('0x2e')][_0x14f3('0x46')]){_0x4ece49[_0x14f3('0x25')]=_[_0x14f3('0x47')](_0x4ece49[_0x14f3('0x25')],{'$or':_[_0x14f3('0x20')](_0x4ece49[_0x14f3('0x32')],function(_0x1c9917){var _0x48d6fd={};_0x48d6fd[_0x1c9917]={'$like':'%'+_0x282a61[_0x14f3('0x2e')][_0x14f3('0x46')]+'%'};return _0x48d6fd;})});}_0x4ece49=_[_0x14f3('0x47')]({},_0x4ece49,_0x282a61['options']);return db[_0x14f3('0x41')]['findAll'](_0x4ece49);}})[_0x14f3('0x16')](function(_0x428410){if(_0x428410){return db['User'][_0x14f3('0x48')]({'where':{'id':_[_0x14f3('0x20')](_0x428410,'UserId'),'role':_0x14f3('0x49')},'attributes':['id',_0x14f3('0x1d'),_0x14f3('0x4a'),'updatedAt',_0x14f3('0x4b')]});}})['then'](function(_0x51b0bd){if(_0x51b0bd){return{'count':_0x51b0bd[_0x14f3('0x11')],'rows':_[_0x14f3('0x20')](_0x51b0bd['rows'],function(_0x205d97){return{'membername':_0x205d97[_0x14f3('0x1d')],'UserId':_0x205d97['id'],'queue_name':_0x2e4d32[_0x14f3('0x1d')],'MailQueueId':_0x2e4d32['id'],'interface':util['format'](_0x14f3('0x4c'),_0x14f3('0x4d'),_0x205d97[_0x14f3('0x1d')]),'penalty':0x0,'paused':_0x205d97['mailPause'],'createdAt':_0x205d97[_0x14f3('0x4b')],'updatedAt':_0x205d97[_0x14f3('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x14f3('0x16')](respondWithFilteredResult(_0xe00e80,_0x4ece49))[_0x14f3('0x29')](handleError(_0xe00e80,null));};exports[_0x14f3('0x4f')]=function(_0x7079ed,_0x111747){var _0x3b134b={};var _0x3fb54b={};var _0x1e9568;var _0x9696c9;return db[_0x14f3('0x21')][_0x14f3('0x40')]({'where':{'id':_0x7079ed['params']['id']}})['then'](handleEntityNotFound(_0x111747,null))['then'](function(_0x275862){if(_0x275862){_0x1e9568=_0x275862;_0x3fb54b[_0x14f3('0x2c')]=_[_0x14f3('0x2d')](db[_0x14f3('0x50')]['rawAttributes']);_0x3fb54b[_0x14f3('0x2e')]=_['keys'](_0x7079ed[_0x14f3('0x2e')]);_0x3fb54b[_0x14f3('0x2f')]=_[_0x14f3('0x30')](_0x3fb54b[_0x14f3('0x2c')],_0x3fb54b[_0x14f3('0x2e')]);_0x3b134b[_0x14f3('0x32')]=_[_0x14f3('0x30')](_0x3fb54b[_0x14f3('0x2c')],qs[_0x14f3('0x31')](_0x7079ed[_0x14f3('0x2e')][_0x14f3('0x31')]));_0x3b134b[_0x14f3('0x32')]=_0x3b134b['attributes']['length']?_0x3b134b[_0x14f3('0x32')]:_0x3fb54b['model'];_0x3b134b[_0x14f3('0x51')]=qs[_0x14f3('0x43')](_0x7079ed[_0x14f3('0x2e')][_0x14f3('0x43')]);_0x3b134b[_0x14f3('0x25')]=qs['filters'](_[_0x14f3('0x44')](_0x7079ed[_0x14f3('0x2e')],_0x3fb54b['filters']));if(_0x7079ed[_0x14f3('0x2e')][_0x14f3('0x46')]){_0x3b134b[_0x14f3('0x25')]=_[_0x14f3('0x47')](_0x3b134b['where'],{'$or':_['map'](_0x3b134b['attributes'],function(_0x4ba2d3){var _0x194fbd={};_0x194fbd[_0x4ba2d3]={'$like':'%'+_0x7079ed[_0x14f3('0x2e')][_0x14f3('0x46')]+'%'};return _0x194fbd;})});}_0x3b134b=_[_0x14f3('0x47')]({},_0x3b134b,_0x7079ed['options']);return _0x1e9568[_0x14f3('0x4f')](_0x3b134b);}})[_0x14f3('0x16')](function(_0x3d0a34){if(_0x3d0a34){_0x9696c9=_0x3d0a34[_0x14f3('0x33')];if(!_0x7079ed[_0x14f3('0x2e')][_0x14f3('0x52')](_0x14f3('0x42'))){_0x3b134b[_0x14f3('0x10')]=qs[_0x14f3('0x10')](_0x7079ed[_0x14f3('0x2e')][_0x14f3('0x10')]);_0x3b134b[_0x14f3('0xe')]=qs['offset'](_0x7079ed[_0x14f3('0x2e')]['offset']);}return _0x1e9568['getTeams'](_0x3b134b);}})[_0x14f3('0x16')](function(_0x5d80bc){if(_0x5d80bc){return _0x5d80bc?{'count':_0x9696c9,'rows':_0x5d80bc}:null;}})['then'](respondWithResult(_0x111747,null))[_0x14f3('0x29')](handleError(_0x111747,null));};exports[_0x14f3('0x53')]=function(_0x4ec23e,_0x510263){var _0x149b16=_0x4ec23e[_0x14f3('0x37')][_0x14f3('0x54')];return db['Team'][_0x14f3('0x27')]({'where':{'id':_0x149b16},'attributes':['id'],'include':[{'model':db[_0x14f3('0x55')],'as':'Agents','attributes':['id',_0x14f3('0x1d'),_0x14f3('0x56'),_0x14f3('0x57'),'interface'],'raw':!![]}]})[_0x14f3('0x16')](function(_0x875756){if(_0x875756){var _0x46dde1=_[_0x14f3('0x58')](_0x875756,function(_0x4b1aa1){var _0x2fa327=_0x4b1aa1[_0x14f3('0x18')]({'plain':!![]});return _0x2fa327[_0x14f3('0x59')];});return db[_0x14f3('0x21')]['find']({'where':{'id':_0x4ec23e[_0x14f3('0x2b')]['id']}})[_0x14f3('0x16')](function(_0x4ec118){return db['sequelize'][_0x14f3('0x5a')](function(_0x616007){return _0x4ec118[_0x14f3('0x53')](_0x149b16,{'transaction':_0x616007})['then'](function(){return BPromise[_0x14f3('0x5b')](_0x46dde1,function(_0x21a5cd){return db[_0x14f3('0x41')][_0x14f3('0x5c')]({'where':{'UserId':_0x21a5cd['id'],'MailQueueId':_0x4ec23e[_0x14f3('0x2b')]['id']},'transaction':_0x616007});});})['then'](function(){_0x46dde1[_0x14f3('0x5d')](function(_0x10f476){socket[_0x14f3('0x5e')]('userMailQueue:save',{'UserId':_0x10f476['id'],'MailQueueId':_0x4ec118['id']});});});});});}})[_0x14f3('0x16')](respondWithStatusCode(_0x510263,null))[_0x14f3('0x29')](handleError(_0x510263,null));};exports[_0x14f3('0x5f')]=function(_0x453c98,_0x44f51a){return db[_0x14f3('0x50')][_0x14f3('0x27')]({'where':{'id':_0x453c98[_0x14f3('0x2e')][_0x14f3('0x54')]},'attributes':['id'],'include':[{'model':db[_0x14f3('0x55')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x14f3('0x16')](handleEntityNotFound(_0x44f51a,null))[_0x14f3('0x16')](function(_0x13f8cb){var _0x395e5c=_['map'](_0x13f8cb,'id');var _0x5abfdc=[];var _0x212d29=[];var _0x4976a0=squel[_0x14f3('0x60')]();_0x4976a0['field']('tq.TeamId')['from'](_0x14f3('0x61'),'tq')[_0x14f3('0x62')]('user_has_teams','ut',_0x14f3('0x63'))[_0x14f3('0x25')](_0x14f3('0x64'),_0x453c98['params']['id']);for(var _0x5f0162=0x0;_0x5f0162<_0x13f8cb[_0x14f3('0x33')];_0x5f0162+=0x1){let _0x3b09c8=_0x13f8cb[_0x5f0162];for(var _0x1895ed=0x0;_0x1895ed<_0x3b09c8[_0x14f3('0x59')][_0x14f3('0x33')];_0x1895ed+=0x1){let _0x41a21f=_0x3b09c8[_0x14f3('0x59')][_0x1895ed];var _0x4e8b72=_0x4976a0[_0x14f3('0x65')]();_0x4e8b72[_0x14f3('0x25')](_0x14f3('0x66'),_0x41a21f['id']);_0x212d29[_0x14f3('0x67')](db['sequelize'][_0x14f3('0x2e')](_0x4e8b72[_0x14f3('0x68')](),{'type':db[_0x14f3('0x69')][_0x14f3('0x6a')][_0x14f3('0x6b')]})[_0x14f3('0x16')](function(_0x4fe0c6){if(_0x4fe0c6[_0x14f3('0x33')]===0x1){return _0x41a21f['id'];}else{var _0x4bc1a2=_[_0x14f3('0x6c')](_[_0x14f3('0x20')](_0x4fe0c6,_0x14f3('0x6d')),function(_0x27b759){return _[_0x14f3('0x6e')](_0x395e5c,_0x27b759);});if(_0x4bc1a2){return _0x41a21f['id'];}}}));}}return BPromise['all'](_0x212d29)['then'](function(_0x454f8e){_0x5abfdc=_(_0x5abfdc)[_0x14f3('0x6f')](_0x454f8e)[_0x14f3('0x70')]()[_0x14f3('0x71')]();return db[_0x14f3('0x21')][_0x14f3('0x35')]({'where':{'id':_0x453c98[_0x14f3('0x2b')]['id']}})[_0x14f3('0x16')](function(_0x449c17){return db[_0x14f3('0x69')][_0x14f3('0x5a')](function(_0x217c59){return _0x449c17[_0x14f3('0x5f')](_0x453c98['query'][_0x14f3('0x54')],{'transaction':_0x217c59})[_0x14f3('0x16')](function(){if(!_[_0x14f3('0x72')](_0x5abfdc)){return _0x449c17['removeAgents'](_0x5abfdc,{'transaction':_0x217c59});}})[_0x14f3('0x16')](function(){_0x5abfdc[_0x14f3('0x5d')](function(_0x318880){socket[_0x14f3('0x5e')](_0x14f3('0x73'),{'UserId':_0x318880,'MailQueueId':_0x449c17['id']});});});});});});})[_0x14f3('0x16')](respondWithStatusCode(_0x44f51a,null))[_0x14f3('0x29')](handleError(_0x44f51a,null));};exports[_0x14f3('0x74')]=function(_0x4b9e15,_0x78bc18){return db[_0x14f3('0x21')][_0x14f3('0x35')]({'where':{'id':_0x4b9e15[_0x14f3('0x2b')]['id']}})['then'](handleEntityNotFound(_0x78bc18,null))[_0x14f3('0x16')](function(_0xa5c22){if(_0xa5c22){return _0xa5c22[_0x14f3('0x74')](_0x4b9e15[_0x14f3('0x37')][_0x14f3('0x54')],_[_0x14f3('0x75')](_0x4b9e15[_0x14f3('0x37')],['ids','id'])||{})['spread'](function(_0x5efad3){for(var _0x4dbb1f=0x0;_0x4dbb1f<_0x4b9e15[_0x14f3('0x37')][_0x14f3('0x54')][_0x14f3('0x33')];_0x4dbb1f+=0x1){socket[_0x14f3('0x5e')](_0x14f3('0x76'),{'UserId':Number(_0x4b9e15[_0x14f3('0x37')][_0x14f3('0x54')][_0x4dbb1f]),'MailQueueId':Number(_0x4b9e15[_0x14f3('0x2b')]['id'])});}return _0x5efad3;});}})[_0x14f3('0x16')](respondWithResult(_0x78bc18,null))['catch'](handleError(_0x78bc18,null));};exports[_0x14f3('0x77')]=function(_0x121268,_0x2ced9e){return db[_0x14f3('0x21')][_0x14f3('0x35')]({'where':{'id':_0x121268[_0x14f3('0x2b')]['id']}})[_0x14f3('0x16')](handleEntityNotFound(_0x2ced9e,null))[_0x14f3('0x16')](function(_0xa0a6a5){if(_0xa0a6a5){return _0xa0a6a5[_0x14f3('0x77')](_0x121268[_0x14f3('0x2e')]['ids'])['then'](function(){if(_['isArray'](_0x121268[_0x14f3('0x2e')][_0x14f3('0x54')])){for(var _0x33a620=0x0;_0x33a620<_0x121268[_0x14f3('0x2e')][_0x14f3('0x54')][_0x14f3('0x33')];_0x33a620+=0x1){socket[_0x14f3('0x5e')](_0x14f3('0x73'),{'UserId':Number(_0x121268[_0x14f3('0x2e')]['ids'][_0x33a620]),'MailQueueId':Number(_0x121268[_0x14f3('0x2b')]['id'])});}}else{socket[_0x14f3('0x5e')](_0x14f3('0x73'),{'UserId':Number(_0x121268[_0x14f3('0x2e')][_0x14f3('0x54')]),'MailQueueId':Number(_0x121268['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2ced9e,null))[_0x14f3('0x29')](handleError(_0x2ced9e,null));};exports[_0x14f3('0x78')]=function(_0x486629,_0x15f52b){var _0x5641d8={};var _0x21ff33={};var _0x59ab53;var _0x44fcd4;return db[_0x14f3('0x21')][_0x14f3('0x40')]({'where':{'id':_0x486629[_0x14f3('0x2b')]['id']}})[_0x14f3('0x16')](handleEntityNotFound(_0x15f52b,null))[_0x14f3('0x16')](function(_0xa8e906){if(_0xa8e906){_0x59ab53=_0xa8e906;_0x21ff33[_0x14f3('0x2c')]=_['keys'](db[_0x14f3('0x55')][_0x14f3('0x22')]);_0x21ff33[_0x14f3('0x2e')]=_[_0x14f3('0x2d')](_0x486629[_0x14f3('0x2e')]);_0x21ff33[_0x14f3('0x2f')]=_[_0x14f3('0x30')](_0x21ff33['model'],_0x21ff33[_0x14f3('0x2e')]);_0x5641d8[_0x14f3('0x32')]=_[_0x14f3('0x30')](_0x21ff33['model'],qs['fields'](_0x486629[_0x14f3('0x2e')][_0x14f3('0x31')]));_0x5641d8[_0x14f3('0x32')]=_0x5641d8[_0x14f3('0x32')][_0x14f3('0x33')]?_0x5641d8['attributes']:_0x21ff33[_0x14f3('0x2c')];_0x5641d8[_0x14f3('0x51')]=qs[_0x14f3('0x43')](_0x486629['query']['sort']);_0x5641d8['where']=qs[_0x14f3('0x2f')](_[_0x14f3('0x44')](_0x486629[_0x14f3('0x2e')],_0x21ff33[_0x14f3('0x2f')]));if(_0x486629[_0x14f3('0x2e')][_0x14f3('0x46')]){_0x5641d8[_0x14f3('0x25')]=_[_0x14f3('0x47')](_0x5641d8['where'],{'$or':_[_0x14f3('0x20')](_0x5641d8[_0x14f3('0x32')],function(_0x2fe83f){var _0x27139e={};_0x27139e[_0x2fe83f]={'$like':'%'+_0x486629[_0x14f3('0x2e')][_0x14f3('0x46')]+'%'};return _0x27139e;})});}_0x5641d8=_[_0x14f3('0x47')]({},_0x5641d8,_0x486629[_0x14f3('0x34')]);return _0x59ab53[_0x14f3('0x78')](_0x5641d8);}})[_0x14f3('0x16')](function(_0x19981d){if(_0x19981d){_0x44fcd4=_0x19981d[_0x14f3('0x33')];if(!_0x486629[_0x14f3('0x2e')]['hasOwnProperty'](_0x14f3('0x42'))){_0x5641d8['limit']=qs[_0x14f3('0x10')](_0x486629[_0x14f3('0x2e')][_0x14f3('0x10')]);_0x5641d8[_0x14f3('0xe')]=qs[_0x14f3('0xe')](_0x486629[_0x14f3('0x2e')][_0x14f3('0xe')]);}return _0x59ab53[_0x14f3('0x78')](_0x5641d8);}})['then'](function(_0x50093a){if(_0x50093a){return _0x50093a?{'count':_0x44fcd4,'rows':_0x50093a}:null;}})[_0x14f3('0x16')](respondWithResult(_0x15f52b,null))[_0x14f3('0x29')](handleError(_0x15f52b,null));}; \ No newline at end of file +var _0x9ca0=['createdAt','rows','format','SIP','hasOwnProperty','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','userMailQueue:save','removeTeams','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','includes','all','union','value','ids','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','order','sort','where','pick','filter','UserMailQueue','User','findAndCountAll','UserId','mailPause','updatedAt'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0x9ca0,0x18e));var _0x09ca=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x9ca0[_0x4b7b62];return _0x2280df;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x09ca('0x0'));var squel=require('squel');var Redis=require(_0x09ca('0x1'));var qs=require(_0x09ca('0x2'));var logger=require(_0x09ca('0x3'))(_0x09ca('0x4'));var config=require('../../config/environment');var db=require(_0x09ca('0x5'))['db'];config['redis']=_[_0x09ca('0x6')](config[_0x09ca('0x7')],{'host':_0x09ca('0x8'),'port':0x18eb});var socket=require(_0x09ca('0x9'))(new Redis(config[_0x09ca('0x7')]));require(_0x09ca('0xa'))['register'](socket);function respondWithStatusCode(_0x5ac655,_0xbce330){_0xbce330=_0xbce330||0xcc;return function(_0x24c82c){if(_0x24c82c){return _0x5ac655[_0x09ca('0xb')](_0xbce330);}return _0x5ac655['status'](_0xbce330)[_0x09ca('0xc')]();};}function respondWithResult(_0x5addfb,_0x34ed7c){_0x34ed7c=_0x34ed7c||0xc8;return function(_0x297982){if(_0x297982){return _0x5addfb[_0x09ca('0xd')](_0x34ed7c)['json'](_0x297982);}};}function respondWithFilteredResult(_0x16ba56,_0x4604a9){return function(_0x450982){if(_0x450982){var _0x4ddbf6=typeof _0x4604a9[_0x09ca('0xe')]===_0x09ca('0xf')&&typeof _0x4604a9[_0x09ca('0x10')]===_0x09ca('0xf');var _0x10aff0=_0x450982[_0x09ca('0x11')];var _0x5a83ab=_0x4ddbf6?0x0:_0x4604a9[_0x09ca('0xe')];var _0x231ee7=_0x4ddbf6?_0x450982[_0x09ca('0x11')]:_0x4604a9[_0x09ca('0xe')]+_0x4604a9[_0x09ca('0x10')];var _0x44e221;if(_0x231ee7>=_0x10aff0){_0x231ee7=_0x10aff0;_0x44e221=0xc8;}else{_0x44e221=0xce;}_0x16ba56[_0x09ca('0xd')](_0x44e221);return _0x16ba56[_0x09ca('0x12')](_0x09ca('0x13'),_0x5a83ab+'-'+_0x231ee7+'/'+_0x10aff0)['json'](_0x450982);}return null;};}function saveUpdates(_0x2afc0d){return function(_0x6ae935){if(_0x6ae935){return _0x6ae935[_0x09ca('0x14')](_0x2afc0d)[_0x09ca('0x15')](function(_0x42b99d){return _0x42b99d;});}return null;};}function removeEntity(_0x399d08){return function(_0x4a6aa9){if(_0x4a6aa9){return _0x4a6aa9[_0x09ca('0x16')]()[_0x09ca('0x15')](function(){var _0x5e1199=_0x4a6aa9[_0x09ca('0x17')]({'plain':!![]});var _0x16b356='MailQueues';return db[_0x09ca('0x18')][_0x09ca('0x16')]({'where':{'type':_0x16b356,'resourceId':_0x5e1199['id']}})[_0x09ca('0x15')](function(){return _0x4a6aa9;});})[_0x09ca('0x15')](function(){_0x399d08[_0x09ca('0xd')](0xcc)[_0x09ca('0xc')]();});}};}function handleEntityNotFound(_0x56ec92){return function(_0x5d727a){if(!_0x5d727a){_0x56ec92[_0x09ca('0xb')](0x194);}return _0x5d727a;};}function handleError(_0x350a3f,_0x3742b0){_0x3742b0=_0x3742b0||0x1f4;return function(_0x566d9b){logger[_0x09ca('0x19')](_0x566d9b[_0x09ca('0x1a')]);if(_0x566d9b[_0x09ca('0x1b')]){delete _0x566d9b[_0x09ca('0x1b')];}_0x350a3f[_0x09ca('0xd')](_0x3742b0)[_0x09ca('0x1c')](_0x566d9b);};}exports[_0x09ca('0x1d')]=function(_0x1648d3,_0x12a367){var _0x17802d={};var _0x2fdac2={'count':0x0,'rows':[]};var _0x99a858=_[_0x09ca('0x1e')](db[_0x09ca('0x1f')]['rawAttributes'],function(_0x5875af){return{'name':_0x5875af[_0x09ca('0x20')],'type':_0x5875af['type'][_0x09ca('0x21')]};});_0x17802d=qs[_0x09ca('0x22')](_0x99a858,_0x1648d3);var _0x479aea={'where':_0x17802d['where']};return db[_0x09ca('0x1f')][_0x09ca('0x11')](_0x479aea)['then'](function(_0x5ece41){_0x2fdac2[_0x09ca('0x11')]=_0x5ece41;_0x17802d[_0x09ca('0x23')]=qs[_0x09ca('0x23')](_0x1648d3[_0x09ca('0x24')]);return db[_0x09ca('0x1f')][_0x09ca('0x25')](_0x17802d);})[_0x09ca('0x15')](function(_0x11215b){_0x2fdac2['rows']=_0x11215b;return _0x2fdac2;})[_0x09ca('0x15')](respondWithFilteredResult(_0x12a367,_0x17802d))[_0x09ca('0x26')](handleError(_0x12a367,null));};exports[_0x09ca('0x27')]=function(_0x294d28,_0x2c16a8){var _0x28097f={'raw':!![],'where':{'id':_0x294d28[_0x09ca('0x28')]['id']}},_0x2af4ab={};_0x2af4ab[_0x09ca('0x29')]=_[_0x09ca('0x2a')](db[_0x09ca('0x1f')][_0x09ca('0x2b')]);_0x2af4ab[_0x09ca('0x24')]=_[_0x09ca('0x2a')](_0x294d28[_0x09ca('0x24')]);_0x2af4ab[_0x09ca('0x2c')]=_[_0x09ca('0x2d')](_0x2af4ab[_0x09ca('0x29')],_0x2af4ab[_0x09ca('0x24')]);_0x28097f['attributes']=_[_0x09ca('0x2d')](_0x2af4ab[_0x09ca('0x29')],qs[_0x09ca('0x2e')](_0x294d28['query'][_0x09ca('0x2e')]));_0x28097f[_0x09ca('0x2f')]=_0x28097f['attributes'][_0x09ca('0x30')]?_0x28097f[_0x09ca('0x2f')]:_0x2af4ab[_0x09ca('0x29')];if(_0x294d28[_0x09ca('0x24')][_0x09ca('0x31')]){_0x28097f[_0x09ca('0x23')]=[{'all':!![]}];}_0x28097f=_[_0x09ca('0x32')]({},_0x28097f,_0x294d28[_0x09ca('0x33')]);return db[_0x09ca('0x1f')]['find'](_0x28097f)[_0x09ca('0x15')](handleEntityNotFound(_0x2c16a8,null))['then'](respondWithResult(_0x2c16a8,null))[_0x09ca('0x26')](handleError(_0x2c16a8,null));};exports[_0x09ca('0x34')]=function(_0xc762ac,_0x10f85d){return db[_0x09ca('0x1f')][_0x09ca('0x34')](_0xc762ac[_0x09ca('0x35')],{})[_0x09ca('0x15')](function(_0x24434a){var _0x1a97fe=_0xc762ac[_0x09ca('0x36')][_0x09ca('0x17')]({'plain':!![]});if(!_0x1a97fe)throw new Error(_0x09ca('0x37'));if(_0x1a97fe[_0x09ca('0x38')]===_0x09ca('0x36')){var _0x187c4=_0x24434a[_0x09ca('0x17')]({'plain':!![]});var _0x5e7563=_0x09ca('0x39');return db[_0x09ca('0x3a')][_0x09ca('0x3b')]({'where':{'name':_0x5e7563,'userProfileId':_0x1a97fe[_0x09ca('0x3c')]},'raw':!![]})['then'](function(_0x48fee2){if(_0x48fee2&&_0x48fee2[_0x09ca('0x3d')]===0x0){return db['UserProfileResource'][_0x09ca('0x34')]({'name':_0x187c4[_0x09ca('0x1b')],'resourceId':_0x187c4['id'],'type':_0x48fee2['name'],'sectionId':_0x48fee2['id']},{})[_0x09ca('0x15')](function(){return _0x24434a;});}else{return _0x24434a;}})[_0x09ca('0x26')](function(_0x29b051){logger['error'](_0x09ca('0x3e'),_0x29b051);throw _0x29b051;});}return _0x24434a;})[_0x09ca('0x15')](respondWithResult(_0x10f85d,0xc9))[_0x09ca('0x26')](handleError(_0x10f85d,null));};exports[_0x09ca('0x14')]=function(_0x53e42f,_0x3f127e){if(_0x53e42f['body']['id']){delete _0x53e42f[_0x09ca('0x35')]['id'];}return db[_0x09ca('0x1f')][_0x09ca('0x3b')]({'where':{'id':_0x53e42f[_0x09ca('0x28')]['id']}})['then'](handleEntityNotFound(_0x3f127e,null))[_0x09ca('0x15')](saveUpdates(_0x53e42f[_0x09ca('0x35')],null))[_0x09ca('0x15')](respondWithResult(_0x3f127e,null))['catch'](handleError(_0x3f127e,null));};exports[_0x09ca('0x16')]=function(_0x1a2d3b,_0x32e417){return db['MailQueue']['find']({'where':{'id':_0x1a2d3b[_0x09ca('0x28')]['id']}})[_0x09ca('0x15')](handleEntityNotFound(_0x32e417,null))[_0x09ca('0x15')](removeEntity(_0x32e417,null))[_0x09ca('0x26')](handleError(_0x32e417,null));};exports[_0x09ca('0x3f')]=function(_0x55b2eb,_0xbe5055){return db[_0x09ca('0x1f')][_0x09ca('0x3f')]()[_0x09ca('0x15')](respondWithResult(_0xbe5055,null))['catch'](handleError(_0xbe5055,null));};exports[_0x09ca('0x40')]=function(_0x2a26aa,_0x530438){var _0x130880={'raw':!![],'where':{}},_0x258817={},_0x1a1a1d;return db['MailQueue'][_0x09ca('0x41')]({'where':{'id':_0x2a26aa[_0x09ca('0x28')]['id']}})[_0x09ca('0x15')](handleEntityNotFound(_0x530438,null))['then'](function(_0x4e5d2d){if(_0x4e5d2d){_0x1a1a1d=_0x4e5d2d[_0x09ca('0x17')]({'plain':!![]});_0x258817[_0x09ca('0x29')]=_[_0x09ca('0x2a')](db['UserMailQueue'][_0x09ca('0x2b')]);_0x258817['query']=_[_0x09ca('0x2a')](_0x2a26aa['query']);_0x258817[_0x09ca('0x2c')]=_[_0x09ca('0x2d')](_0x258817[_0x09ca('0x29')],_0x258817[_0x09ca('0x24')]);_0x130880['attributes']=_[_0x09ca('0x2d')](_0x258817['model'],qs[_0x09ca('0x2e')](_0x2a26aa[_0x09ca('0x24')][_0x09ca('0x2e')]));_0x130880['attributes']=_0x130880[_0x09ca('0x2f')][_0x09ca('0x30')]?_0x130880['attributes']:_0x258817[_0x09ca('0x29')];if(!_0x2a26aa['query']['hasOwnProperty'](_0x09ca('0x42'))){_0x130880[_0x09ca('0x10')]=qs[_0x09ca('0x10')](_0x2a26aa[_0x09ca('0x24')]['limit']);_0x130880[_0x09ca('0xe')]=qs[_0x09ca('0xe')](_0x2a26aa[_0x09ca('0x24')]['offset']);}_0x130880[_0x09ca('0x43')]=qs[_0x09ca('0x44')](_0x2a26aa[_0x09ca('0x24')]['sort']);_0x130880[_0x09ca('0x45')]=qs['filters'](_[_0x09ca('0x46')](_0x2a26aa[_0x09ca('0x24')],_0x258817['filters']));_0x130880[_0x09ca('0x45')]['MailQueueId']=_0x4e5d2d['id'];if(_0x2a26aa[_0x09ca('0x24')][_0x09ca('0x47')]){_0x130880[_0x09ca('0x45')]=_[_0x09ca('0x32')](_0x130880[_0x09ca('0x45')],{'$or':_[_0x09ca('0x1e')](_0x130880[_0x09ca('0x2f')],function(_0xdad953){var _0x4a4dc3={};_0x4a4dc3[_0xdad953]={'$like':'%'+_0x2a26aa[_0x09ca('0x24')][_0x09ca('0x47')]+'%'};return _0x4a4dc3;})});}_0x130880=_['merge']({},_0x130880,_0x2a26aa[_0x09ca('0x33')]);return db[_0x09ca('0x48')][_0x09ca('0x25')](_0x130880);}})['then'](function(_0x4acc4e){if(_0x4acc4e){return db[_0x09ca('0x49')][_0x09ca('0x4a')]({'where':{'id':_[_0x09ca('0x1e')](_0x4acc4e,_0x09ca('0x4b')),'role':'agent'},'attributes':['id','name',_0x09ca('0x4c'),_0x09ca('0x4d'),_0x09ca('0x4e')]});}})['then'](function(_0x15effd){if(_0x15effd){return{'count':_0x15effd['count'],'rows':_['map'](_0x15effd[_0x09ca('0x4f')],function(_0x214240){return{'membername':_0x214240[_0x09ca('0x1b')],'UserId':_0x214240['id'],'queue_name':_0x1a1a1d[_0x09ca('0x1b')],'MailQueueId':_0x1a1a1d['id'],'interface':util[_0x09ca('0x50')]('%s/%s',_0x09ca('0x51'),_0x214240[_0x09ca('0x1b')]),'penalty':0x0,'paused':_0x214240['mailPause'],'createdAt':_0x214240['createdAt'],'updatedAt':_0x214240[_0x09ca('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x530438,_0x130880))[_0x09ca('0x26')](handleError(_0x530438,null));};exports['getTeams']=function(_0x477f64,_0x567a48){var _0xb2af0b={};var _0x4c0609={};var _0x33897d;var _0x4cf81e;return db[_0x09ca('0x1f')][_0x09ca('0x41')]({'where':{'id':_0x477f64['params']['id']}})[_0x09ca('0x15')](handleEntityNotFound(_0x567a48,null))[_0x09ca('0x15')](function(_0x1c3d7c){if(_0x1c3d7c){_0x33897d=_0x1c3d7c;_0x4c0609['model']=_[_0x09ca('0x2a')](db['Team'][_0x09ca('0x2b')]);_0x4c0609[_0x09ca('0x24')]=_[_0x09ca('0x2a')](_0x477f64[_0x09ca('0x24')]);_0x4c0609[_0x09ca('0x2c')]=_['intersection'](_0x4c0609[_0x09ca('0x29')],_0x4c0609[_0x09ca('0x24')]);_0xb2af0b[_0x09ca('0x2f')]=_[_0x09ca('0x2d')](_0x4c0609[_0x09ca('0x29')],qs[_0x09ca('0x2e')](_0x477f64[_0x09ca('0x24')][_0x09ca('0x2e')]));_0xb2af0b['attributes']=_0xb2af0b[_0x09ca('0x2f')]['length']?_0xb2af0b[_0x09ca('0x2f')]:_0x4c0609[_0x09ca('0x29')];_0xb2af0b['order']=qs[_0x09ca('0x44')](_0x477f64['query'][_0x09ca('0x44')]);_0xb2af0b[_0x09ca('0x45')]=qs['filters'](_[_0x09ca('0x46')](_0x477f64[_0x09ca('0x24')],_0x4c0609[_0x09ca('0x2c')]));if(_0x477f64[_0x09ca('0x24')][_0x09ca('0x47')]){_0xb2af0b[_0x09ca('0x45')]=_['merge'](_0xb2af0b[_0x09ca('0x45')],{'$or':_[_0x09ca('0x1e')](_0xb2af0b[_0x09ca('0x2f')],function(_0x2cdd8d){var _0x2fac3b={};_0x2fac3b[_0x2cdd8d]={'$like':'%'+_0x477f64[_0x09ca('0x24')]['filter']+'%'};return _0x2fac3b;})});}_0xb2af0b=_['merge']({},_0xb2af0b,_0x477f64[_0x09ca('0x33')]);return _0x33897d['getTeams'](_0xb2af0b);}})[_0x09ca('0x15')](function(_0x262b12){if(_0x262b12){_0x4cf81e=_0x262b12[_0x09ca('0x30')];if(!_0x477f64[_0x09ca('0x24')][_0x09ca('0x52')](_0x09ca('0x42'))){_0xb2af0b['limit']=qs[_0x09ca('0x10')](_0x477f64[_0x09ca('0x24')]['limit']);_0xb2af0b[_0x09ca('0xe')]=qs['offset'](_0x477f64[_0x09ca('0x24')][_0x09ca('0xe')]);}return _0x33897d[_0x09ca('0x53')](_0xb2af0b);}})['then'](function(_0x43558b){if(_0x43558b){return _0x43558b?{'count':_0x4cf81e,'rows':_0x43558b}:null;}})['then'](respondWithResult(_0x567a48,null))[_0x09ca('0x26')](handleError(_0x567a48,null));};exports[_0x09ca('0x54')]=function(_0x253043,_0x32c461){var _0x2f40ec=_0x253043[_0x09ca('0x35')]['ids'];return db[_0x09ca('0x55')][_0x09ca('0x25')]({'where':{'id':_0x2f40ec},'attributes':['id'],'include':[{'model':db[_0x09ca('0x49')],'as':_0x09ca('0x56'),'attributes':['id',_0x09ca('0x1b'),_0x09ca('0x57'),_0x09ca('0x58'),_0x09ca('0x59')],'raw':!![]}]})['then'](function(_0x2f28e8){if(_0x2f28e8){var _0x5b1a78=_[_0x09ca('0x5a')](_0x2f28e8,function(_0x140266){var _0x1a5399=_0x140266[_0x09ca('0x17')]({'plain':!![]});return _0x1a5399[_0x09ca('0x56')];});return db['MailQueue'][_0x09ca('0x3b')]({'where':{'id':_0x253043['params']['id']}})['then'](function(_0x2a1a38){return db[_0x09ca('0x5b')][_0x09ca('0x5c')](function(_0x2fcc90){return _0x2a1a38[_0x09ca('0x54')](_0x2f40ec,{'transaction':_0x2fcc90})[_0x09ca('0x15')](function(){return BPromise[_0x09ca('0x5d')](_0x5b1a78,function(_0x13b976){return db[_0x09ca('0x48')]['findOrCreate']({'where':{'UserId':_0x13b976['id'],'MailQueueId':_0x253043[_0x09ca('0x28')]['id']},'transaction':_0x2fcc90});});})[_0x09ca('0x15')](function(){_0x5b1a78['forEach'](function(_0x3bdc1c){socket['emit'](_0x09ca('0x5e'),{'UserId':_0x3bdc1c['id'],'MailQueueId':_0x2a1a38['id']});});});});});}})[_0x09ca('0x15')](respondWithStatusCode(_0x32c461,null))['catch'](handleError(_0x32c461,null));};exports[_0x09ca('0x5f')]=function(_0x187312,_0x392b43){return db[_0x09ca('0x55')]['findAll']({'where':{'id':_0x187312['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x09ca('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x392b43,null))[_0x09ca('0x15')](function(_0xc1d6bf){var _0x5485c7=_['map'](_0xc1d6bf,'id');var _0x3fd741=[];var _0x3acbca=[];var _0x4352b7=squel[_0x09ca('0x60')]();_0x4352b7[_0x09ca('0x61')](_0x09ca('0x62'))['from']('team_has_mail_queues','tq')[_0x09ca('0x63')]('user_has_teams','ut',_0x09ca('0x64'))[_0x09ca('0x45')](_0x09ca('0x65'),_0x187312['params']['id']);for(var _0x44721f=0x0;_0x44721f<_0xc1d6bf[_0x09ca('0x30')];_0x44721f+=0x1){let _0x59e9a6=_0xc1d6bf[_0x44721f];for(var _0x2eb13f=0x0;_0x2eb13f<_0x59e9a6[_0x09ca('0x56')]['length'];_0x2eb13f+=0x1){let _0x461f49=_0x59e9a6['Agents'][_0x2eb13f];var _0x3abab7=_0x4352b7[_0x09ca('0x66')]();_0x3abab7[_0x09ca('0x45')](_0x09ca('0x67'),_0x461f49['id']);_0x3acbca['push'](db[_0x09ca('0x5b')][_0x09ca('0x24')](_0x3abab7[_0x09ca('0x68')](),{'type':db[_0x09ca('0x5b')]['QueryTypes']['SELECT']})['then'](function(_0x2eff49){if(_0x2eff49['length']===0x1){return _0x461f49['id'];}else{var _0x438440=_[_0x09ca('0x69')](_[_0x09ca('0x1e')](_0x2eff49,'TeamId'),function(_0x4cda7a){return _[_0x09ca('0x6a')](_0x5485c7,_0x4cda7a);});if(_0x438440){return _0x461f49['id'];}}}));}}return BPromise[_0x09ca('0x6b')](_0x3acbca)[_0x09ca('0x15')](function(_0x2e63e3){_0x3fd741=_(_0x3fd741)[_0x09ca('0x6c')](_0x2e63e3)['compact']()[_0x09ca('0x6d')]();return db[_0x09ca('0x1f')]['find']({'where':{'id':_0x187312['params']['id']}})[_0x09ca('0x15')](function(_0x37fad1){return db[_0x09ca('0x5b')][_0x09ca('0x5c')](function(_0x534c71){return _0x37fad1[_0x09ca('0x5f')](_0x187312[_0x09ca('0x24')][_0x09ca('0x6e')],{'transaction':_0x534c71})[_0x09ca('0x15')](function(){if(!_['isEmpty'](_0x3fd741)){return _0x37fad1[_0x09ca('0x6f')](_0x3fd741,{'transaction':_0x534c71});}})[_0x09ca('0x15')](function(){_0x3fd741['forEach'](function(_0x1efea0){socket[_0x09ca('0x70')](_0x09ca('0x71'),{'UserId':_0x1efea0,'MailQueueId':_0x37fad1['id']});});});});});});})[_0x09ca('0x15')](respondWithStatusCode(_0x392b43,null))[_0x09ca('0x26')](handleError(_0x392b43,null));};exports[_0x09ca('0x72')]=function(_0x593986,_0x4ffb69){return db[_0x09ca('0x1f')]['find']({'where':{'id':_0x593986['params']['id']}})[_0x09ca('0x15')](handleEntityNotFound(_0x4ffb69,null))[_0x09ca('0x15')](function(_0xe36bd0){if(_0xe36bd0){return _0xe36bd0[_0x09ca('0x72')](_0x593986['body'][_0x09ca('0x6e')],_[_0x09ca('0x73')](_0x593986[_0x09ca('0x35')],[_0x09ca('0x6e'),'id'])||{})[_0x09ca('0x74')](function(_0x465767){for(var _0x1d0aa2=0x0;_0x1d0aa2<_0x593986[_0x09ca('0x35')]['ids'][_0x09ca('0x30')];_0x1d0aa2+=0x1){socket[_0x09ca('0x70')](_0x09ca('0x5e'),{'UserId':Number(_0x593986[_0x09ca('0x35')][_0x09ca('0x6e')][_0x1d0aa2]),'MailQueueId':Number(_0x593986[_0x09ca('0x28')]['id'])});}return _0x465767;});}})[_0x09ca('0x15')](respondWithResult(_0x4ffb69,null))['catch'](handleError(_0x4ffb69,null));};exports[_0x09ca('0x6f')]=function(_0x445a42,_0x3d1091){return db[_0x09ca('0x1f')]['find']({'where':{'id':_0x445a42[_0x09ca('0x28')]['id']}})['then'](handleEntityNotFound(_0x3d1091,null))[_0x09ca('0x15')](function(_0x1c2860){if(_0x1c2860){return _0x1c2860['removeAgents'](_0x445a42[_0x09ca('0x24')][_0x09ca('0x6e')])[_0x09ca('0x15')](function(){if(_[_0x09ca('0x75')](_0x445a42[_0x09ca('0x24')]['ids'])){for(var _0x13405f=0x0;_0x13405f<_0x445a42[_0x09ca('0x24')]['ids'][_0x09ca('0x30')];_0x13405f+=0x1){socket[_0x09ca('0x70')](_0x09ca('0x71'),{'UserId':Number(_0x445a42[_0x09ca('0x24')][_0x09ca('0x6e')][_0x13405f]),'MailQueueId':Number(_0x445a42[_0x09ca('0x28')]['id'])});}}else{socket[_0x09ca('0x70')](_0x09ca('0x71'),{'UserId':Number(_0x445a42[_0x09ca('0x24')][_0x09ca('0x6e')]),'MailQueueId':Number(_0x445a42['params']['id'])});}});}})[_0x09ca('0x15')](respondWithStatusCode(_0x3d1091,null))[_0x09ca('0x26')](handleError(_0x3d1091,null));};exports[_0x09ca('0x76')]=function(_0x508058,_0x891f78){var _0x52b0f0={};var _0xc9a0c9={};var _0x46a20b;var _0x2a319f;return db[_0x09ca('0x1f')]['findOne']({'where':{'id':_0x508058[_0x09ca('0x28')]['id']}})[_0x09ca('0x15')](handleEntityNotFound(_0x891f78,null))[_0x09ca('0x15')](function(_0x395b29){if(_0x395b29){_0x46a20b=_0x395b29;_0xc9a0c9['model']=_['keys'](db[_0x09ca('0x49')][_0x09ca('0x2b')]);_0xc9a0c9[_0x09ca('0x24')]=_['keys'](_0x508058[_0x09ca('0x24')]);_0xc9a0c9[_0x09ca('0x2c')]=_[_0x09ca('0x2d')](_0xc9a0c9[_0x09ca('0x29')],_0xc9a0c9[_0x09ca('0x24')]);_0x52b0f0[_0x09ca('0x2f')]=_[_0x09ca('0x2d')](_0xc9a0c9[_0x09ca('0x29')],qs[_0x09ca('0x2e')](_0x508058['query'][_0x09ca('0x2e')]));_0x52b0f0[_0x09ca('0x2f')]=_0x52b0f0[_0x09ca('0x2f')]['length']?_0x52b0f0[_0x09ca('0x2f')]:_0xc9a0c9[_0x09ca('0x29')];_0x52b0f0[_0x09ca('0x43')]=qs[_0x09ca('0x44')](_0x508058[_0x09ca('0x24')][_0x09ca('0x44')]);_0x52b0f0[_0x09ca('0x45')]=qs['filters'](_[_0x09ca('0x46')](_0x508058[_0x09ca('0x24')],_0xc9a0c9[_0x09ca('0x2c')]));if(_0x508058[_0x09ca('0x24')][_0x09ca('0x47')]){_0x52b0f0[_0x09ca('0x45')]=_[_0x09ca('0x32')](_0x52b0f0[_0x09ca('0x45')],{'$or':_[_0x09ca('0x1e')](_0x52b0f0['attributes'],function(_0x405dd0){var _0x4b3b4e={};_0x4b3b4e[_0x405dd0]={'$like':'%'+_0x508058['query'][_0x09ca('0x47')]+'%'};return _0x4b3b4e;})});}_0x52b0f0=_['merge']({},_0x52b0f0,_0x508058[_0x09ca('0x33')]);return _0x46a20b[_0x09ca('0x76')](_0x52b0f0);}})[_0x09ca('0x15')](function(_0x1c5205){if(_0x1c5205){_0x2a319f=_0x1c5205[_0x09ca('0x30')];if(!_0x508058[_0x09ca('0x24')][_0x09ca('0x52')]('nolimit')){_0x52b0f0[_0x09ca('0x10')]=qs[_0x09ca('0x10')](_0x508058[_0x09ca('0x24')]['limit']);_0x52b0f0[_0x09ca('0xe')]=qs[_0x09ca('0xe')](_0x508058[_0x09ca('0x24')][_0x09ca('0xe')]);}return _0x46a20b[_0x09ca('0x76')](_0x52b0f0);}})['then'](function(_0x4d98dc){if(_0x4d98dc){return _0x4d98dc?{'count':_0x2a319f,'rows':_0x4d98dc}:null;}})[_0x09ca('0x15')](respondWithResult(_0x891f78,null))[_0x09ca('0x26')](handleError(_0x891f78,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7c7786c..f0d3683 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 _0xf842=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4498d5,_0x41c103){var _0x5951c7=function(_0x3fae4b){while(--_0x3fae4b){_0x4498d5['push'](_0x4498d5['shift']());}};_0x5951c7(++_0x41c103);}(_0xf842,0x165));var _0x2f84=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xf842[_0x5f1391];return _0x50ebe3;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x2f84('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2f84('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f84('0x2'),'afterDestroy':_0x2f84('0x3')};function emitEvent(_0x18cbe9){return function(_0x43a17e,_0x576cac,_0x1503c1){MailQueueEvents[_0x2f84('0x4')](_0x18cbe9+':'+_0x43a17e['id'],_0x43a17e);MailQueueEvents[_0x2f84('0x4')](_0x18cbe9,_0x43a17e);_0x1503c1(null);};}for(var e in events){if(events[_0x2f84('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x2f84('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xe665=['../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xddb81e,_0x132454){var _0x2257e9=function(_0x51fe59){while(--_0x51fe59){_0xddb81e['push'](_0xddb81e['shift']());}};_0x2257e9(++_0x132454);}(_0xe665,0x112));var _0x5e66=function(_0x4dac6c,_0x264acc){_0x4dac6c=_0x4dac6c-0x0;var _0x2de6d3=_0xe665[_0x4dac6c];return _0x2de6d3;};'use strict';var EventEmitter=require(_0x5e66('0x0'));var MailQueue=require(_0x5e66('0x1'))['db'][_0x5e66('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5e66('0x3')](0x0);var events={'afterCreate':_0x5e66('0x4'),'afterUpdate':_0x5e66('0x5'),'afterDestroy':_0x5e66('0x6')};function emitEvent(_0x445df9){return function(_0x2a2b96,_0x459702,_0x1c3196){MailQueueEvents[_0x5e66('0x7')](_0x445df9+':'+_0x2a2b96['id'],_0x2a2b96);MailQueueEvents[_0x5e66('0x7')](_0x445df9,_0x2a2b96);_0x1c3196(null);};}for(var e in events){if(events[_0x5e66('0x8')](e)){var event=events[e];MailQueue[_0x5e66('0x9')](e,emitEvent(event));}}module[_0x5e66('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 2273fd5..b3ebc3e 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 _0xac22=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','mail_queues','util'];(function(_0x5d8d18,_0x341ad4){var _0x12cbb5=function(_0x5bd2d5){while(--_0x5bd2d5){_0x5d8d18['push'](_0x5d8d18['shift']());}};_0x12cbb5(++_0x341ad4);}(_0xac22,0x1af));var _0x2ac2=function(_0x3fabd3,_0x1976c3){_0x3fabd3=_0x3fabd3-0x0;var _0x18d166=_0xac22[_0x3fabd3];return _0x18d166;};'use strict';var _=require('lodash');var util=require(_0x2ac2('0x0'));var logger=require(_0x2ac2('0x1'))(_0x2ac2('0x2'));var moment=require(_0x2ac2('0x3'));var BPromise=require(_0x2ac2('0x4'));var rp=require(_0x2ac2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ac2('0x6'));var config=require(_0x2ac2('0x7'));var attributes=require(_0x2ac2('0x8'));module[_0x2ac2('0x9')]=function(_0x4c4613,_0x14be44){return _0x4c4613[_0x2ac2('0xa')]('MailQueue',attributes,{'tableName':_0x2ac2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d90=['api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7d90,0x1d1));var _0x07d9=function(_0x5d7d4f,_0x11b439){_0x5d7d4f=_0x5d7d4f-0x0;var _0x489f2a=_0x7d90[_0x5d7d4f];return _0x489f2a;};'use strict';var _=require(_0x07d9('0x0'));var util=require(_0x07d9('0x1'));var logger=require(_0x07d9('0x2'))(_0x07d9('0x3'));var moment=require(_0x07d9('0x4'));var BPromise=require(_0x07d9('0x5'));var rp=require(_0x07d9('0x6'));var fs=require('fs');var path=require(_0x07d9('0x7'));var rimraf=require('rimraf');var config=require(_0x07d9('0x8'));var attributes=require(_0x07d9('0x9'));module['exports']=function(_0x4403aa,_0xb5dc90){return _0x4403aa[_0x07d9('0xa')](_0x07d9('0xb'),attributes,{'tableName':_0x07d9('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 18b1e0a..5de7650 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 _0xa8c8=['localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','options','raw','where','limit','include','map','model','attributes','GetMailQueue','ShowMailQueue','find','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8c8,0x1d2));var _0x8a8c=function(_0x3e02fd,_0x2ff0da){_0x3e02fd=_0x3e02fd-0x0;var _0x4a2937=_0xa8c8[_0x3e02fd];return _0x4a2937;};'use strict';var _=require(_0x8a8c('0x0'));var util=require(_0x8a8c('0x1'));var moment=require('moment');var BPromise=require(_0x8a8c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a8c('0x3'))(_0x8a8c('0x4'));var config=require(_0x8a8c('0x5'));var jayson=require(_0x8a8c('0x6'));var client=jayson[_0x8a8c('0x7')]['http']({'port':0x232a});config[_0x8a8c('0x8')]=_[_0x8a8c('0x9')](config[_0x8a8c('0x8')],{'host':_0x8a8c('0xa'),'port':0x18eb});var socket=require(_0x8a8c('0xb'))(new Redis(config['redis']));require(_0x8a8c('0xc'))[_0x8a8c('0xd')](socket);function respondWithRpcPromise(_0x4ed503,_0xe7203e,_0x389cc6){return new BPromise(function(_0xec8182,_0x38c228){return client[_0x8a8c('0xe')](_0x4ed503,_0x389cc6)[_0x8a8c('0xf')](function(_0x2f4413){logger[_0x8a8c('0x10')](_0x8a8c('0x11'),_0xe7203e,_0x8a8c('0x12'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0xe7203e,'request\x20sent',JSON[_0x8a8c('0x13')](_0x2f4413));if(_0x2f4413[_0x8a8c('0x14')]){if(_0x2f4413[_0x8a8c('0x14')]['code']===0x1f4){logger[_0x8a8c('0x14')](_0x8a8c('0x11'),_0xe7203e,_0x2f4413[_0x8a8c('0x14')]['message']);return _0x38c228(_0x2f4413['error'][_0x8a8c('0x15')]);}logger['error'](_0x8a8c('0x11'),_0xe7203e,_0x2f4413[_0x8a8c('0x14')][_0x8a8c('0x15')]);return _0xec8182(_0x2f4413[_0x8a8c('0x14')][_0x8a8c('0x15')]);}else{logger['info'](_0x8a8c('0x11'),_0xe7203e,_0x8a8c('0x12'));_0xec8182(_0x2f4413['result'][_0x8a8c('0x15')]);}})[_0x8a8c('0x16')](function(_0x3016cb){logger[_0x8a8c('0x14')]('MailQueue,\x20%s,\x20%s',_0xe7203e,_0x3016cb);_0x38c228(_0x3016cb);});});}exports['GetMailQueue']=function(_0x55365c){var _0x1014c4=this;return new Promise(function(_0x5032fc,_0x1a780d){return db['MailQueue']['findAll']({'raw':_0x55365c[_0x8a8c('0x17')]?_0x55365c[_0x8a8c('0x17')][_0x8a8c('0x18')]===undefined?!![]:![]:!![],'where':_0x55365c[_0x8a8c('0x17')]?_0x55365c['options'][_0x8a8c('0x19')]||null:null,'attributes':_0x55365c['options']?_0x55365c['options']['attributes']||null:null,'limit':_0x55365c[_0x8a8c('0x17')]?_0x55365c['options'][_0x8a8c('0x1a')]||null:null,'include':_0x55365c[_0x8a8c('0x17')]?_0x55365c[_0x8a8c('0x17')][_0x8a8c('0x1b')]?_[_0x8a8c('0x1c')](_0x55365c[_0x8a8c('0x17')][_0x8a8c('0x1b')],function(_0x507f4c){return{'model':db[_0x507f4c[_0x8a8c('0x1d')]],'as':_0x507f4c['as'],'attributes':_0x507f4c[_0x8a8c('0x1e')],'include':_0x507f4c[_0x8a8c('0x1b')]?_['map'](_0x507f4c[_0x8a8c('0x1b')],function(_0x35bc29){return{'model':db[_0x35bc29[_0x8a8c('0x1d')]],'as':_0x35bc29['as'],'attributes':_0x35bc29[_0x8a8c('0x1e')],'include':_0x35bc29[_0x8a8c('0x1b')]?_['map'](_0x35bc29['include'],function(_0x132662){return{'model':db[_0x132662[_0x8a8c('0x1d')]],'as':_0x132662['as'],'attributes':_0x132662[_0x8a8c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8a8c('0xf')](function(_0x92cd9d){logger[_0x8a8c('0x10')](_0x8a8c('0x1f'),_0x55365c);logger['debug']('GetMailQueue',_0x55365c,JSON[_0x8a8c('0x13')](_0x92cd9d));_0x5032fc(_0x92cd9d);})[_0x8a8c('0x16')](function(_0x179cce){logger[_0x8a8c('0x14')](_0x8a8c('0x1f'),_0x179cce[_0x8a8c('0x15')],_0x55365c);_0x1a780d(_0x1014c4['error'](0x1f4,_0x179cce['message']));});});};exports[_0x8a8c('0x20')]=function(_0x5e5b8b){var _0x1b0ddb=this;return new Promise(function(_0x43178b,_0x532d3e){return db['MailQueue'][_0x8a8c('0x21')]({'raw':_0x5e5b8b[_0x8a8c('0x17')]?_0x5e5b8b[_0x8a8c('0x17')][_0x8a8c('0x18')]===undefined?!![]:![]:!![],'where':_0x5e5b8b[_0x8a8c('0x17')]?_0x5e5b8b[_0x8a8c('0x17')][_0x8a8c('0x19')]||null:null,'attributes':_0x5e5b8b[_0x8a8c('0x17')]?_0x5e5b8b[_0x8a8c('0x17')][_0x8a8c('0x1e')]||null:null,'include':_0x5e5b8b[_0x8a8c('0x17')]?_0x5e5b8b[_0x8a8c('0x17')]['include']?_['map'](_0x5e5b8b['options'][_0x8a8c('0x1b')],function(_0x2ffe7f){return{'model':db[_0x2ffe7f['model']],'as':_0x2ffe7f['as'],'attributes':_0x2ffe7f[_0x8a8c('0x1e')],'include':_0x2ffe7f[_0x8a8c('0x1b')]?_[_0x8a8c('0x1c')](_0x2ffe7f[_0x8a8c('0x1b')],function(_0xfcc2f9){return{'model':db[_0xfcc2f9[_0x8a8c('0x1d')]],'as':_0xfcc2f9['as'],'attributes':_0xfcc2f9['attributes'],'include':_0xfcc2f9['include']?_[_0x8a8c('0x1c')](_0xfcc2f9['include'],function(_0x517f4b){return{'model':db[_0x517f4b['model']],'as':_0x517f4b['as'],'attributes':_0x517f4b[_0x8a8c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8a8c('0xf')](function(_0x4c9f6f){logger[_0x8a8c('0x10')](_0x8a8c('0x20'),_0x5e5b8b);logger['debug'](_0x8a8c('0x20'),_0x5e5b8b,JSON[_0x8a8c('0x13')](_0x4c9f6f));_0x43178b(_0x4c9f6f);})['catch'](function(_0x1145e8){logger['error'](_0x8a8c('0x20'),_0x1145e8[_0x8a8c('0x15')],_0x5e5b8b);_0x532d3e(_0x1b0ddb[_0x8a8c('0x14')](0x1f4,_0x1145e8['message']));});});}; \ No newline at end of file +var _0x064b=['find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','raw','options','attributes','include','map','model','ShowMailQueue'];(function(_0x499570,_0x3ef0c6){var _0x23bc65=function(_0x5404c3){while(--_0x5404c3){_0x499570['push'](_0x499570['shift']());}};_0x23bc65(++_0x3ef0c6);}(_0x064b,0xd9));var _0xb064=function(_0x2958c4,_0x491a67){_0x2958c4=_0x2958c4-0x0;var _0x290bb9=_0x064b[_0x2958c4];return _0x290bb9;};'use strict';var _=require(_0xb064('0x0'));var util=require(_0xb064('0x1'));var moment=require(_0xb064('0x2'));var BPromise=require(_0xb064('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb064('0x4'));var db=require(_0xb064('0x5'))['db'];var utils=require(_0xb064('0x6'));var logger=require(_0xb064('0x7'))(_0xb064('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb064('0x9')]({'port':0x232a});config[_0xb064('0xa')]=_[_0xb064('0xb')](config[_0xb064('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb064('0xa')]));require(_0xb064('0xc'))[_0xb064('0xd')](socket);function respondWithRpcPromise(_0x2f9b1a,_0x12510d,_0x10c4f0){return new BPromise(function(_0x3efffe,_0x27a939){return client[_0xb064('0xe')](_0x2f9b1a,_0x10c4f0)[_0xb064('0xf')](function(_0x3b0577){logger[_0xb064('0x10')](_0xb064('0x11'),_0x12510d,_0xb064('0x12'));logger[_0xb064('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x12510d,_0xb064('0x12'),JSON[_0xb064('0x14')](_0x3b0577));if(_0x3b0577[_0xb064('0x15')]){if(_0x3b0577[_0xb064('0x15')]['code']===0x1f4){logger[_0xb064('0x15')](_0xb064('0x11'),_0x12510d,_0x3b0577[_0xb064('0x15')]['message']);return _0x27a939(_0x3b0577['error'][_0xb064('0x16')]);}logger[_0xb064('0x15')](_0xb064('0x11'),_0x12510d,_0x3b0577[_0xb064('0x15')][_0xb064('0x16')]);return _0x3efffe(_0x3b0577[_0xb064('0x15')][_0xb064('0x16')]);}else{logger[_0xb064('0x10')]('MailQueue,\x20%s,\x20%s',_0x12510d,_0xb064('0x12'));_0x3efffe(_0x3b0577[_0xb064('0x17')][_0xb064('0x16')]);}})[_0xb064('0x18')](function(_0x4e8efd){logger[_0xb064('0x15')](_0xb064('0x11'),_0x12510d,_0x4e8efd);_0x27a939(_0x4e8efd);});});}exports[_0xb064('0x19')]=function(_0x39a9e3){var _0xfaa1bf=this;return new Promise(function(_0x3c2023,_0x1da379){return db[_0xb064('0x1a')][_0xb064('0x1b')]({'raw':_0x39a9e3['options']?_0x39a9e3['options'][_0xb064('0x1c')]===undefined?!![]:![]:!![],'where':_0x39a9e3[_0xb064('0x1d')]?_0x39a9e3[_0xb064('0x1d')]['where']||null:null,'attributes':_0x39a9e3[_0xb064('0x1d')]?_0x39a9e3[_0xb064('0x1d')][_0xb064('0x1e')]||null:null,'limit':_0x39a9e3[_0xb064('0x1d')]?_0x39a9e3[_0xb064('0x1d')]['limit']||null:null,'include':_0x39a9e3['options']?_0x39a9e3[_0xb064('0x1d')][_0xb064('0x1f')]?_[_0xb064('0x20')](_0x39a9e3[_0xb064('0x1d')][_0xb064('0x1f')],function(_0x41b73c){return{'model':db[_0x41b73c[_0xb064('0x21')]],'as':_0x41b73c['as'],'attributes':_0x41b73c[_0xb064('0x1e')],'include':_0x41b73c[_0xb064('0x1f')]?_['map'](_0x41b73c[_0xb064('0x1f')],function(_0x2e85f5){return{'model':db[_0x2e85f5[_0xb064('0x21')]],'as':_0x2e85f5['as'],'attributes':_0x2e85f5[_0xb064('0x1e')],'include':_0x2e85f5['include']?_[_0xb064('0x20')](_0x2e85f5[_0xb064('0x1f')],function(_0x2eb1ee){return{'model':db[_0x2eb1ee[_0xb064('0x21')]],'as':_0x2eb1ee['as'],'attributes':_0x2eb1ee['attributes']};}):[]};}):[]};}):[]:[]})[_0xb064('0xf')](function(_0x3e4d58){logger[_0xb064('0x10')](_0xb064('0x19'),_0x39a9e3);logger[_0xb064('0x13')]('GetMailQueue',_0x39a9e3,JSON[_0xb064('0x14')](_0x3e4d58));_0x3c2023(_0x3e4d58);})[_0xb064('0x18')](function(_0x2e24af){logger[_0xb064('0x15')](_0xb064('0x19'),_0x2e24af[_0xb064('0x16')],_0x39a9e3);_0x1da379(_0xfaa1bf['error'](0x1f4,_0x2e24af['message']));});});};exports[_0xb064('0x22')]=function(_0xbba663){var _0x2ae313=this;return new Promise(function(_0x420fce,_0x16a69d){return db['MailQueue'][_0xb064('0x23')]({'raw':_0xbba663['options']?_0xbba663['options'][_0xb064('0x1c')]===undefined?!![]:![]:!![],'where':_0xbba663[_0xb064('0x1d')]?_0xbba663[_0xb064('0x1d')]['where']||null:null,'attributes':_0xbba663['options']?_0xbba663[_0xb064('0x1d')][_0xb064('0x1e')]||null:null,'include':_0xbba663[_0xb064('0x1d')]?_0xbba663[_0xb064('0x1d')]['include']?_[_0xb064('0x20')](_0xbba663[_0xb064('0x1d')][_0xb064('0x1f')],function(_0x56c322){return{'model':db[_0x56c322[_0xb064('0x21')]],'as':_0x56c322['as'],'attributes':_0x56c322['attributes'],'include':_0x56c322[_0xb064('0x1f')]?_[_0xb064('0x20')](_0x56c322['include'],function(_0x48f6f9){return{'model':db[_0x48f6f9['model']],'as':_0x48f6f9['as'],'attributes':_0x48f6f9[_0xb064('0x1e')],'include':_0x48f6f9[_0xb064('0x1f')]?_[_0xb064('0x20')](_0x48f6f9['include'],function(_0x2b69b5){return{'model':db[_0x2b69b5[_0xb064('0x21')]],'as':_0x2b69b5['as'],'attributes':_0x2b69b5[_0xb064('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb064('0xf')](function(_0x12f2a2){logger['info']('ShowMailQueue',_0xbba663);logger[_0xb064('0x13')]('ShowMailQueue',_0xbba663,JSON[_0xb064('0x14')](_0x12f2a2));_0x420fce(_0x12f2a2);})[_0xb064('0x18')](function(_0x53ec01){logger['error'](_0xb064('0x22'),_0x53ec01[_0xb064('0x16')],_0xbba663);_0x16a69d(_0x2ae313[_0xb064('0x15')](0x1f4,_0x53ec01[_0xb064('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 23348e1..c6cd024 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 _0x4aab=['mailQueue:','save','update','emit','removeListener','register'];(function(_0x44f5a7,_0xba870c){var _0x201adb=function(_0x5d1320){while(--_0x5d1320){_0x44f5a7['push'](_0x44f5a7['shift']());}};_0x201adb(++_0xba870c);}(_0x4aab,0xcd));var _0xb4aa=function(_0x200666,_0x39f745){_0x200666=_0x200666-0x0;var _0x147b87=_0x4aab[_0x200666];return _0x147b87;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xb4aa('0x0'),'remove',_0xb4aa('0x1')];function createListener(_0x597e47,_0x5ba3db){return function(_0x114e95){_0x5ba3db[_0xb4aa('0x2')](_0x597e47,_0x114e95);};}function removeListener(_0x463995,_0x526d63){return function(){MailQueueEvents[_0xb4aa('0x3')](_0x463995,_0x526d63);};}exports[_0xb4aa('0x4')]=function(_0x5c22fb){for(var _0x2165c8=0x0,_0x907f58=events['length'];_0x2165c8<_0x907f58;_0x2165c8++){var _0x1a2cb2=events[_0x2165c8];var _0x433d38=createListener(_0xb4aa('0x5')+_0x1a2cb2,_0x5c22fb);MailQueueEvents['on'](_0x1a2cb2,_0x433d38);}}; \ No newline at end of file +var _0x0105=['save','remove','update','emit','register','mailQueue:','./mailQueue.events'];(function(_0x33d588,_0x327c20){var _0x2e7a9a=function(_0x1acb31){while(--_0x1acb31){_0x33d588['push'](_0x33d588['shift']());}};_0x2e7a9a(++_0x327c20);}(_0x0105,0x180));var _0x5010=function(_0x2fe33b,_0x1baa6a){_0x2fe33b=_0x2fe33b-0x0;var _0xe19bc0=_0x0105[_0x2fe33b];return _0xe19bc0;};'use strict';var MailQueueEvents=require(_0x5010('0x0'));var events=[_0x5010('0x1'),_0x5010('0x2'),_0x5010('0x3')];function createListener(_0x2cd6a6,_0x4336ed){return function(_0x2815ac){_0x4336ed[_0x5010('0x4')](_0x2cd6a6,_0x2815ac);};}function removeListener(_0x12a112,_0xca34dd){return function(){MailQueueEvents['removeListener'](_0x12a112,_0xca34dd);};}exports[_0x5010('0x5')]=function(_0x3bbdcd){for(var _0x547d3a=0x0,_0x8838c5=events['length'];_0x547d3a<_0x8838c5;_0x547d3a++){var _0x19275b=events[_0x547d3a];var _0xf8ec06=createListener(_0x5010('0x6')+_0x19275b,_0x3bbdcd);MailQueueEvents['on'](_0x19275b,_0xf8ec06);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index e60a438..c37ae7b 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 _0x21ff=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','post','create','/:id'];(function(_0x4d61dc,_0x3c26f2){var _0x2205fd=function(_0x13d810){while(--_0x13d810){_0x4d61dc['push'](_0x4d61dc['shift']());}};_0x2205fd(++_0x3c26f2);}(_0x21ff,0x1f2));var _0xf21f=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x21ff[_0x307086];return _0x699043;};'use strict';var multer=require('multer');var util=require(_0xf21f('0x0'));var path=require(_0xf21f('0x1'));var timeout=require(_0xf21f('0x2'));var express=require(_0xf21f('0x3'));var router=express['Router']();var fs_extra=require(_0xf21f('0x4'));var auth=require(_0xf21f('0x5'));var interaction=require(_0xf21f('0x6'));var config=require('../../config/environment');var controller=require(_0xf21f('0x7'));router[_0xf21f('0x8')]('/',auth[_0xf21f('0x9')](),controller[_0xf21f('0xa')]);router['get'](_0xf21f('0xb'),auth[_0xf21f('0x9')](),controller['describe']);router[_0xf21f('0x8')]('/:id',auth[_0xf21f('0x9')](),controller['show']);router[_0xf21f('0xc')]('/',auth[_0xf21f('0x9')](),controller[_0xf21f('0xd')]);router['put'](_0xf21f('0xe'),auth[_0xf21f('0x9')](),controller[_0xf21f('0xf')]);router[_0xf21f('0x10')](_0xf21f('0xe'),auth['isAuthenticated'](),controller[_0xf21f('0x11')]);module[_0xf21f('0x12')]=router; \ No newline at end of file +var _0xc4df=['../../components/auth/service','./mailQueueReport.controller','get','/describe','isAuthenticated','/:id','show','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xc4df,0x1ab));var _0xfc4d=function(_0x4d755e,_0xb313ba){_0x4d755e=_0x4d755e-0x0;var _0x565d24=_0xc4df[_0x4d755e];return _0x565d24;};'use strict';var multer=require('multer');var util=require(_0xfc4d('0x0'));var path=require('path');var timeout=require(_0xfc4d('0x1'));var express=require(_0xfc4d('0x2'));var router=express[_0xfc4d('0x3')]();var fs_extra=require(_0xfc4d('0x4'));var auth=require(_0xfc4d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfc4d('0x6'));router[_0xfc4d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfc4d('0x7')](_0xfc4d('0x8'),auth[_0xfc4d('0x9')](),controller['describe']);router[_0xfc4d('0x7')](_0xfc4d('0xa'),auth[_0xfc4d('0x9')](),controller[_0xfc4d('0xb')]);router['post']('/',auth[_0xfc4d('0x9')](),controller[_0xfc4d('0xc')]);router[_0xfc4d('0xd')](_0xfc4d('0xa'),auth[_0xfc4d('0x9')](),controller['update']);router[_0xfc4d('0xe')](_0xfc4d('0xa'),auth[_0xfc4d('0x9')](),controller['destroy']);module[_0xfc4d('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 121caf1..ecb0d78 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 _0x8c02=['sequelize','exports','STRING','DATE','moment'];(function(_0x284c46,_0x591eaa){var _0xaf70b7=function(_0x2519c2){while(--_0x2519c2){_0x284c46['push'](_0x284c46['shift']());}};_0xaf70b7(++_0x591eaa);}(_0x8c02,0x10d));var _0x28c0=function(_0x514ae7,_0x4de92d){_0x514ae7=_0x514ae7-0x0;var _0x4fa789=_0x8c02[_0x514ae7];return _0x4fa789;};'use strict';var moment=require(_0x28c0('0x0'));var Sequelize=require(_0x28c0('0x1'));module[_0x28c0('0x2')]={'uniqueid':{'type':Sequelize[_0x28c0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x28c0('0x3')]},'joinAt':{'type':Sequelize[_0x28c0('0x4')]},'leaveAt':{'type':Sequelize[_0x28c0('0x4')]},'acceptAt':{'type':Sequelize[_0x28c0('0x4')]},'exitAt':{'type':Sequelize[_0x28c0('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x53ae=['DATE','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ae,0x16f));var _0xe53a=function(_0x109819,_0x10210a){_0x109819=_0x109819-0x0;var _0x47d38d=_0x53ae[_0x109819];return _0x47d38d;};'use strict';var moment=require('moment');var Sequelize=require(_0xe53a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe53a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe53a('0x1')]},'joinAt':{'type':Sequelize[_0xe53a('0x2')]},'leaveAt':{'type':Sequelize[_0xe53a('0x2')]},'acceptAt':{'type':Sequelize[_0xe53a('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe53a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index dbad36a..bb5b266 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 _0xa456=['where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xa456,0x142));var _0x6a45=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa456[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x6a45('0x0'));var rimraf=require(_0x6a45('0x1'));var zipdir=require(_0x6a45('0x2'));var jsonpatch=require(_0x6a45('0x3'));var rp=require('request-promise');var moment=require(_0x6a45('0x4'));var BPromise=require(_0x6a45('0x5'));var Mustache=require(_0x6a45('0x6'));var util=require('util');var path=require(_0x6a45('0x7'));var sox=require(_0x6a45('0x8'));var csv=require(_0x6a45('0x9'));var ejs=require(_0x6a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=typeof _0x171176['offset']==='undefined'&&typeof _0x171176['limit']===_0x6a45('0x1b');var _0x391f81=_0x3fab82[_0x6a45('0x1c')];var _0x52a055=_0x13adc0?0x0:_0x171176[_0x6a45('0x1d')];var _0x102981=_0x13adc0?_0x3fab82[_0x6a45('0x1c')]:_0x171176['offset']+_0x171176['limit'];var _0x573453;if(_0x102981>=_0x391f81){_0x102981=_0x391f81;_0x573453=0xc8;}else{_0x573453=0xce;}_0x2c20db[_0x6a45('0x19')](_0x573453);return _0x2c20db[_0x6a45('0x1e')]('Content-Range',_0x52a055+'-'+_0x102981+'/'+_0x391f81)[_0x6a45('0x1f')](_0x3fab82);}return null;};}function patchUpdates(_0x1be485){return function(_0x4f7000){try{jsonpatch[_0x6a45('0x20')](_0x4f7000,_0x1be485,!![]);}catch(_0xdf10c6){return BPromise[_0x6a45('0x21')](_0xdf10c6);}return _0x4f7000[_0x6a45('0x22')]();};}function saveUpdates(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')](_0x15ad0e)[_0x6a45('0x24')](function(_0x11290c){return _0x11290c;});}return null;};}function removeEntity(_0x22373c,_0x25a380){return function(_0x3ad898){if(_0x3ad898){return _0x3ad898[_0x6a45('0x25')]()[_0x6a45('0x24')](function(){_0x22373c[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x1310d7,_0x46587a){return function(_0x5cd761){if(!_0x5cd761){_0x1310d7[_0x6a45('0x18')](0x194);}return _0x5cd761;};}function handleError(_0x5a0389,_0x1b83fa){_0x1b83fa=_0x1b83fa||0x1f4;return function(_0x25467d){logger[_0x6a45('0x26')](_0x25467d[_0x6a45('0x27')]);if(_0x25467d[_0x6a45('0x28')]){delete _0x25467d['name'];}_0x5a0389[_0x6a45('0x19')](_0x1b83fa)[_0x6a45('0x29')](_0x25467d);};}exports[_0x6a45('0x2a')]=function(_0x1ccff0,_0x8265d9){var _0x227b6f={},_0x3fac9b={},_0x313c13={'count':0x0,'rows':[]};var _0x54286d=_[_0x6a45('0x2b')](db[_0x6a45('0x2c')][_0x6a45('0x2d')],function(_0x201369){return{'name':_0x201369[_0x6a45('0x2e')],'type':_0x201369['type'][_0x6a45('0x2f')]};});_0x3fac9b[_0x6a45('0x30')]=_[_0x6a45('0x2b')](_0x54286d,_0x6a45('0x28'));_0x3fac9b['query']=_['keys'](_0x1ccff0[_0x6a45('0x31')]);_0x3fac9b['filters']=_[_0x6a45('0x32')](_0x3fac9b['model'],_0x3fac9b[_0x6a45('0x31')]);_0x227b6f[_0x6a45('0x33')]=_[_0x6a45('0x32')](_0x3fac9b[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x34')]));_0x227b6f[_0x6a45('0x33')]=_0x227b6f[_0x6a45('0x33')][_0x6a45('0x35')]?_0x227b6f[_0x6a45('0x33')]:_0x3fac9b[_0x6a45('0x30')];if(!_0x1ccff0[_0x6a45('0x31')]['hasOwnProperty'](_0x6a45('0x36'))){_0x227b6f['limit']=qs[_0x6a45('0x37')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x37')]);_0x227b6f[_0x6a45('0x1d')]=qs[_0x6a45('0x1d')](_0x1ccff0[_0x6a45('0x31')]['offset']);}_0x227b6f[_0x6a45('0x38')]=qs[_0x6a45('0x39')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x39')]);_0x227b6f[_0x6a45('0x3a')]=qs[_0x6a45('0x3b')](_['pick'](_0x1ccff0[_0x6a45('0x31')],_0x3fac9b[_0x6a45('0x3b')]),_0x54286d);if(_0x1ccff0['query'][_0x6a45('0x3c')]){_0x227b6f[_0x6a45('0x3a')]=_[_0x6a45('0x3d')](_0x227b6f[_0x6a45('0x3a')],{'$or':_[_0x6a45('0x2b')](_0x54286d,function(_0x50ebe0){if(_0x50ebe0[_0x6a45('0x3e')]!==_0x6a45('0x3f')){var _0x205afd={};_0x205afd[_0x50ebe0[_0x6a45('0x28')]]={'$like':'%'+_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x3c')]+'%'};return _0x205afd;}})});}_0x227b6f=_[_0x6a45('0x3d')]({},_0x227b6f,_0x1ccff0['options']);var _0x1c941a={'where':_0x227b6f['where']};return db[_0x6a45('0x2c')][_0x6a45('0x1c')](_0x1c941a)[_0x6a45('0x24')](function(_0x2715dc){_0x313c13['count']=_0x2715dc;if(_0x1ccff0['query'][_0x6a45('0x40')]){_0x227b6f[_0x6a45('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6a45('0x42')](_0x227b6f);})[_0x6a45('0x24')](function(_0x3bd926){_0x313c13[_0x6a45('0x43')]=_0x3bd926;return _0x313c13;})['then'](respondWithFilteredResult(_0x8265d9,_0x227b6f))['catch'](handleError(_0x8265d9,null));};exports['show']=function(_0x5b9798,_0xe90201){var _0xb5d191={'raw':!![],'where':{'id':_0x5b9798[_0x6a45('0x44')]['id']}},_0x328d9f={};_0x328d9f[_0x6a45('0x30')]=_[_0x6a45('0x45')](db[_0x6a45('0x2c')][_0x6a45('0x2d')]);_0x328d9f['query']=_[_0x6a45('0x45')](_0x5b9798['query']);_0x328d9f['filters']=_[_0x6a45('0x32')](_0x328d9f[_0x6a45('0x30')],_0x328d9f['query']);_0xb5d191[_0x6a45('0x33')]=_['intersection'](_0x328d9f[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x5b9798[_0x6a45('0x31')][_0x6a45('0x34')]));_0xb5d191['attributes']=_0xb5d191[_0x6a45('0x33')][_0x6a45('0x35')]?_0xb5d191[_0x6a45('0x33')]:_0x328d9f[_0x6a45('0x30')];if(_0x5b9798[_0x6a45('0x31')]['includeAll']){_0xb5d191[_0x6a45('0x41')]=[{'all':!![]}];}_0xb5d191=_['merge']({},_0xb5d191,_0x5b9798[_0x6a45('0x46')]);return db[_0x6a45('0x2c')]['find'](_0xb5d191)[_0x6a45('0x24')](handleEntityNotFound(_0xe90201,null))[_0x6a45('0x24')](respondWithResult(_0xe90201,null))[_0x6a45('0x47')](handleError(_0xe90201,null));};exports[_0x6a45('0x48')]=function(_0x524296,_0x34bbb7){return db['MailQueueReport'][_0x6a45('0x48')](_0x524296['body'],{})[_0x6a45('0x24')](respondWithResult(_0x34bbb7,0xc9))[_0x6a45('0x47')](handleError(_0x34bbb7,null));};exports[_0x6a45('0x23')]=function(_0x2bf8d3,_0x5d9f52){if(_0x2bf8d3[_0x6a45('0x49')]['id']){delete _0x2bf8d3[_0x6a45('0x49')]['id'];}return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x2bf8d3[_0x6a45('0x44')]['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x5d9f52,null))[_0x6a45('0x24')](saveUpdates(_0x2bf8d3[_0x6a45('0x49')],null))[_0x6a45('0x24')](respondWithResult(_0x5d9f52,null))[_0x6a45('0x47')](handleError(_0x5d9f52,null));};exports['destroy']=function(_0x3ea4a7,_0x8877c7){return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x3ea4a7['params']['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x8877c7,null))[_0x6a45('0x24')](removeEntity(_0x8877c7,null))[_0x6a45('0x47')](handleError(_0x8877c7,null));};exports['describe']=function(_0x4e7967,_0x5a17b8){return db[_0x6a45('0x2c')][_0x6a45('0x4b')]()[_0x6a45('0x24')](respondWithResult(_0x5a17b8,null))[_0x6a45('0x47')](handleError(_0x5a17b8,null));}; \ No newline at end of file +var _0x5464=['undefined','limit','count','set','Content-Range','json','reject','update','then','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','MailQueueReport','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset'];(function(_0x597d6b,_0x1723ee){var _0x3211da=function(_0x43f825){while(--_0x43f825){_0x597d6b['push'](_0x597d6b['shift']());}};_0x3211da(++_0x1723ee);}(_0x5464,0x15d));var _0x4546=function(_0x3b9b4a,_0x49b4a2){_0x3b9b4a=_0x3b9b4a-0x0;var _0x41fdc3=_0x5464[_0x3b9b4a];return _0x41fdc3;};'use strict';var emlformat=require(_0x4546('0x0'));var rimraf=require(_0x4546('0x1'));var zipdir=require(_0x4546('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4546('0x3'));var moment=require('moment');var BPromise=require(_0x4546('0x4'));var Mustache=require('mustache');var util=require(_0x4546('0x5'));var path=require(_0x4546('0x6'));var sox=require(_0x4546('0x7'));var csv=require(_0x4546('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0x8'));var querystring=require(_0x4546('0xd'));var Papa=require(_0x4546('0xe'));var Redis=require(_0x4546('0xf'));var authService=require(_0x4546('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x11'));var hardwareService=require(_0x4546('0x12'));var logger=require(_0x4546('0x13'))('api');var utils=require(_0x4546('0x14'));var config=require(_0x4546('0x15'));var licenseUtil=require(_0x4546('0x16'));var db=require(_0x4546('0x17'))['db'];function respondWithStatusCode(_0x4d31a7,_0x4f2641){_0x4f2641=_0x4f2641||0xcc;return function(_0x3e6622){if(_0x3e6622){return _0x4d31a7['sendStatus'](_0x4f2641);}return _0x4d31a7['status'](_0x4f2641)['end']();};}function respondWithResult(_0x5b64b7,_0x598516){_0x598516=_0x598516||0xc8;return function(_0x4f5571){if(_0x4f5571){return _0x5b64b7[_0x4546('0x18')](_0x598516)['json'](_0x4f5571);}};}function respondWithFilteredResult(_0x363a17,_0x54581c){return function(_0x26fc0e){if(_0x26fc0e){var _0x564f3e=typeof _0x54581c[_0x4546('0x19')]===_0x4546('0x1a')&&typeof _0x54581c[_0x4546('0x1b')]===_0x4546('0x1a');var _0x2a294b=_0x26fc0e[_0x4546('0x1c')];var _0x57d8de=_0x564f3e?0x0:_0x54581c['offset'];var _0x5780a7=_0x564f3e?_0x26fc0e[_0x4546('0x1c')]:_0x54581c[_0x4546('0x19')]+_0x54581c[_0x4546('0x1b')];var _0x3d95c2;if(_0x5780a7>=_0x2a294b){_0x5780a7=_0x2a294b;_0x3d95c2=0xc8;}else{_0x3d95c2=0xce;}_0x363a17[_0x4546('0x18')](_0x3d95c2);return _0x363a17[_0x4546('0x1d')](_0x4546('0x1e'),_0x57d8de+'-'+_0x5780a7+'/'+_0x2a294b)[_0x4546('0x1f')](_0x26fc0e);}return null;};}function patchUpdates(_0x4034a5){return function(_0xceb1d6){try{jsonpatch['apply'](_0xceb1d6,_0x4034a5,!![]);}catch(_0x2d689f){return BPromise[_0x4546('0x20')](_0x2d689f);}return _0xceb1d6['save']();};}function saveUpdates(_0x3067ab,_0x437f55){return function(_0x1a1984){if(_0x1a1984){return _0x1a1984[_0x4546('0x21')](_0x3067ab)[_0x4546('0x22')](function(_0x15b013){return _0x15b013;});}return null;};}function removeEntity(_0x53e402,_0x3dab5c){return function(_0x2cca8b){if(_0x2cca8b){return _0x2cca8b['destroy']()[_0x4546('0x22')](function(){_0x53e402[_0x4546('0x18')](0xcc)[_0x4546('0x23')]();});}};}function handleEntityNotFound(_0x4467ee,_0x23084b){return function(_0x53ae5e){if(!_0x53ae5e){_0x4467ee[_0x4546('0x24')](0x194);}return _0x53ae5e;};}function handleError(_0x3796fe,_0x831fa5){_0x831fa5=_0x831fa5||0x1f4;return function(_0x48fc36){logger['error'](_0x48fc36[_0x4546('0x25')]);if(_0x48fc36[_0x4546('0x26')]){delete _0x48fc36[_0x4546('0x26')];}_0x3796fe[_0x4546('0x18')](_0x831fa5)[_0x4546('0x27')](_0x48fc36);};}exports[_0x4546('0x28')]=function(_0xcea7da,_0x586ff1){var _0x367b23={},_0x52c546={},_0x3a2d12={'count':0x0,'rows':[]};var _0x161815=_['map'](db['MailQueueReport'][_0x4546('0x29')],function(_0x5af997){return{'name':_0x5af997[_0x4546('0x2a')],'type':_0x5af997[_0x4546('0x2b')]['key']};});_0x52c546['model']=_[_0x4546('0x2c')](_0x161815,_0x4546('0x26'));_0x52c546[_0x4546('0x2d')]=_['keys'](_0xcea7da[_0x4546('0x2d')]);_0x52c546[_0x4546('0x2e')]=_['intersection'](_0x52c546[_0x4546('0x2f')],_0x52c546['query']);_0x367b23[_0x4546('0x30')]=_[_0x4546('0x31')](_0x52c546[_0x4546('0x2f')],qs[_0x4546('0x32')](_0xcea7da['query'][_0x4546('0x32')]));_0x367b23[_0x4546('0x30')]=_0x367b23[_0x4546('0x30')][_0x4546('0x33')]?_0x367b23[_0x4546('0x30')]:_0x52c546[_0x4546('0x2f')];if(!_0xcea7da['query'][_0x4546('0x34')](_0x4546('0x35'))){_0x367b23['limit']=qs['limit'](_0xcea7da[_0x4546('0x2d')][_0x4546('0x1b')]);_0x367b23['offset']=qs[_0x4546('0x19')](_0xcea7da[_0x4546('0x2d')]['offset']);}_0x367b23['order']=qs[_0x4546('0x36')](_0xcea7da[_0x4546('0x2d')][_0x4546('0x36')]);_0x367b23[_0x4546('0x37')]=qs[_0x4546('0x2e')](_[_0x4546('0x38')](_0xcea7da['query'],_0x52c546[_0x4546('0x2e')]),_0x161815);if(_0xcea7da[_0x4546('0x2d')]['filter']){_0x367b23[_0x4546('0x37')]=_['merge'](_0x367b23[_0x4546('0x37')],{'$or':_[_0x4546('0x2c')](_0x161815,function(_0x53683e){if(_0x53683e['type']!==_0x4546('0x39')){var _0x453593={};_0x453593[_0x53683e[_0x4546('0x26')]]={'$like':'%'+_0xcea7da['query'][_0x4546('0x3a')]+'%'};return _0x453593;}})});}_0x367b23=_[_0x4546('0x3b')]({},_0x367b23,_0xcea7da[_0x4546('0x3c')]);var _0x1f815e={'where':_0x367b23[_0x4546('0x37')]};return db[_0x4546('0x3d')][_0x4546('0x1c')](_0x1f815e)[_0x4546('0x22')](function(_0x4b67d4){_0x3a2d12[_0x4546('0x1c')]=_0x4b67d4;if(_0xcea7da[_0x4546('0x2d')]['includeAll']){_0x367b23['include']=[{'all':!![]}];}return db[_0x4546('0x3d')][_0x4546('0x3e')](_0x367b23);})[_0x4546('0x22')](function(_0x1ea5c4){_0x3a2d12[_0x4546('0x3f')]=_0x1ea5c4;return _0x3a2d12;})['then'](respondWithFilteredResult(_0x586ff1,_0x367b23))[_0x4546('0x40')](handleError(_0x586ff1,null));};exports[_0x4546('0x41')]=function(_0x1060d1,_0x185b76){var _0x236fc0={'raw':!![],'where':{'id':_0x1060d1[_0x4546('0x42')]['id']}},_0x3fabf0={};_0x3fabf0[_0x4546('0x2f')]=_[_0x4546('0x43')](db['MailQueueReport'][_0x4546('0x29')]);_0x3fabf0[_0x4546('0x2d')]=_[_0x4546('0x43')](_0x1060d1[_0x4546('0x2d')]);_0x3fabf0[_0x4546('0x2e')]=_[_0x4546('0x31')](_0x3fabf0[_0x4546('0x2f')],_0x3fabf0[_0x4546('0x2d')]);_0x236fc0[_0x4546('0x30')]=_[_0x4546('0x31')](_0x3fabf0[_0x4546('0x2f')],qs['fields'](_0x1060d1[_0x4546('0x2d')][_0x4546('0x32')]));_0x236fc0['attributes']=_0x236fc0[_0x4546('0x30')][_0x4546('0x33')]?_0x236fc0[_0x4546('0x30')]:_0x3fabf0['model'];if(_0x1060d1[_0x4546('0x2d')][_0x4546('0x44')]){_0x236fc0[_0x4546('0x45')]=[{'all':!![]}];}_0x236fc0=_[_0x4546('0x3b')]({},_0x236fc0,_0x1060d1[_0x4546('0x3c')]);return db[_0x4546('0x3d')][_0x4546('0x46')](_0x236fc0)[_0x4546('0x22')](handleEntityNotFound(_0x185b76,null))[_0x4546('0x22')](respondWithResult(_0x185b76,null))[_0x4546('0x40')](handleError(_0x185b76,null));};exports['create']=function(_0x395c43,_0x24a637){return db['MailQueueReport'][_0x4546('0x47')](_0x395c43[_0x4546('0x48')],{})[_0x4546('0x22')](respondWithResult(_0x24a637,0xc9))[_0x4546('0x40')](handleError(_0x24a637,null));};exports['update']=function(_0x329566,_0x57bb39){if(_0x329566[_0x4546('0x48')]['id']){delete _0x329566[_0x4546('0x48')]['id'];}return db[_0x4546('0x3d')]['find']({'where':{'id':_0x329566[_0x4546('0x42')]['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x57bb39,null))[_0x4546('0x22')](saveUpdates(_0x329566[_0x4546('0x48')],null))[_0x4546('0x22')](respondWithResult(_0x57bb39,null))[_0x4546('0x40')](handleError(_0x57bb39,null));};exports[_0x4546('0x49')]=function(_0x325181,_0x43f630){return db[_0x4546('0x3d')][_0x4546('0x46')]({'where':{'id':_0x325181['params']['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x43f630,null))[_0x4546('0x22')](removeEntity(_0x43f630,null))['catch'](handleError(_0x43f630,null));};exports[_0x4546('0x4a')]=function(_0xe9e3c1,_0xca0f44){return db['MailQueueReport'][_0x4546('0x4a')]()[_0x4546('0x22')](respondWithResult(_0xca0f44,null))[_0x4546('0x40')](handleError(_0xca0f44,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 01e8c5b..93a9e0a 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 _0xd148=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','util','../../config/logger','api'];(function(_0x186bd4,_0x17be2e){var _0x343493=function(_0x1a9bc1){while(--_0x1a9bc1){_0x186bd4['push'](_0x186bd4['shift']());}};_0x343493(++_0x17be2e);}(_0xd148,0x8d));var _0x8d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd148[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8d14('0x0'));var logger=require(_0x8d14('0x1'))(_0x8d14('0x2'));var moment=require('moment');var BPromise=require(_0x8d14('0x3'));var rp=require(_0x8d14('0x4'));var fs=require('fs');var path=require(_0x8d14('0x5'));var rimraf=require(_0x8d14('0x6'));var config=require(_0x8d14('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x8d14('0x8')]=function(_0x140fdb,_0x20044c){return _0x140fdb[_0x8d14('0x9')](_0x8d14('0xa'),attributes,{'tableName':_0x8d14('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed65=['bluebird','path','rimraf','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','lodash','api','moment'];(function(_0x257735,_0x38d88d){var _0x3b6f7a=function(_0x48ea6b){while(--_0x48ea6b){_0x257735['push'](_0x257735['shift']());}};_0x3b6f7a(++_0x38d88d);}(_0xed65,0x1e7));var _0x5ed6=function(_0x4a6979,_0x5f3d1a){_0x4a6979=_0x4a6979-0x0;var _0x226f93=_0xed65[_0x4a6979];return _0x226f93;};'use strict';var _=require(_0x5ed6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ed6('0x1'));var moment=require(_0x5ed6('0x2'));var BPromise=require(_0x5ed6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ed6('0x4'));var rimraf=require(_0x5ed6('0x5'));var config=require('../../config/environment');var attributes=require(_0x5ed6('0x6'));module['exports']=function(_0x288053,_0x434f6f){return _0x288053['define'](_0x5ed6('0x7'),attributes,{'tableName':_0x5ed6('0x8'),'paranoid':![],'indexes':[{'name':_0x5ed6('0x9'),'fields':[_0x5ed6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6a48f27..02c804a 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x37bbc9,_0x59e732){var _0x428683=function(_0x4a873a){while(--_0x4a873a){_0x37bbc9['push'](_0x37bbc9['shift']());}};_0x428683(++_0x59e732);}(_0xadb5,0xad));var _0x5adb=function(_0x22949f,_0x2feccb){_0x22949f=_0x22949f-0x0;var _0xd14807=_0xadb5[_0x22949f];return _0xd14807;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _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(_0x4df3a2,_0xfbae78){var _0xdd7fa=function(_0x5f5125){while(--_0x5f5125){_0x4df3a2['push'](_0x4df3a2['shift']());}};_0xdd7fa(++_0xfbae78);}(_0xadb5,0xad));var _0x5adb=function(_0x2fc01b,_0x3b460f){_0x2fc01b=_0x2fc01b-0x0;var _0x49fbe1=_0xadb5[_0x2fc01b];return _0x49fbe1;};'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 86ee004..e05671a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a9e88,_0x18a305){var _0x5e64cb=function(_0x5ccd49){while(--_0x5ccd49){_0x4a9e88['push'](_0x4a9e88['shift']());}};_0x5e64cb(++_0x18a305);}(_0xe706,0xa3));var _0x6e70=function(_0x38ead5,_0x5b4fa2){_0x38ead5=_0x38ead5-0x0;var _0x4e40bc=_0xe706[_0x38ead5];return _0x4e40bc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x559b18,_0x5f0cd0){var _0x353eb1=function(_0x14a918){while(--_0x14a918){_0x559b18['push'](_0x559b18['shift']());}};_0x353eb1(++_0x5f0cd0);}(_0x70e0,0x17b));var _0x070e=function(_0x216173,_0x497736){_0x216173=_0x216173-0x0;var _0x404939=_0x70e0[_0x216173];return _0x404939;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9b41d1c..9f68bae 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 _0x2c4a=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x39682d,_0x3ffb1d){var _0x3a64e8=function(_0x183c70){while(--_0x183c70){_0x39682d['push'](_0x39682d['shift']());}};_0x3a64e8(++_0x3ffb1d);}(_0x2c4a,0xd4));var _0xa2c4=function(_0x3b988f,_0x5ebaa5){_0x3b988f=_0x3b988f-0x0;var _0x216684=_0x2c4a[_0x3b988f];return _0x216684;};'use strict';var Sequelize=require(_0xa2c4('0x0'));module['exports']={'description':{'type':Sequelize[_0xa2c4('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa2c4('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa2c4('0x1')]},'password':{'type':Sequelize[_0xa2c4('0x1')]},'port':{'type':Sequelize[_0xa2c4('0x3')]},'tls':{'type':Sequelize[_0xa2c4('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa2c4('0x1')],'defaultValue':_0xa2c4('0x4')},'connTimeout':{'type':Sequelize[_0xa2c4('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xa2c4('0x1')]},'modernAuthentication':{'type':Sequelize[_0xa2c4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x2c49=['INTEGER','exports','STRING','BOOLEAN'];(function(_0xc3ab8b,_0x2ffb1){var _0x113c7f=function(_0x3a1751){while(--_0x3a1751){_0xc3ab8b['push'](_0xc3ab8b['shift']());}};_0x113c7f(++_0x2ffb1);}(_0x2c49,0xd9));var _0x92c4=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x2c49[_0x13ac10];return _0x28eda2;};'use strict';var Sequelize=require('sequelize');module[_0x92c4('0x0')]={'description':{'type':Sequelize[_0x92c4('0x1')]},'host':{'type':Sequelize[_0x92c4('0x1')]},'authentication':{'type':Sequelize[_0x92c4('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x92c4('0x1')]},'password':{'type':Sequelize[_0x92c4('0x1')]},'port':{'type':Sequelize[_0x92c4('0x3')]},'tls':{'type':Sequelize[_0x92c4('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x92c4('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x92c4('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x92c4('0x1')]},'modernAuthentication':{'type':Sequelize[_0x92c4('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 912adb6..a71744d 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 _0x98f9=['mail_servers_in','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x98f9,0xbc));var _0x998f=function(_0x5b0c94,_0x5440f7){_0x5b0c94=_0x5b0c94-0x0;var _0x42ae74=_0x98f9[_0x5b0c94];return _0x42ae74;};'use strict';var _=require(_0x998f('0x0'));var util=require('util');var logger=require(_0x998f('0x1'))(_0x998f('0x2'));var moment=require('moment');var BPromise=require(_0x998f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x998f('0x4'));var config=require(_0x998f('0x5'));var attributes=require(_0x998f('0x6'));module[_0x998f('0x7')]=function(_0x5840db,_0x5e4e36){return _0x5840db[_0x998f('0x8')](_0x998f('0x9'),attributes,{'tableName':_0x998f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0303=['exports','define','MailServerIn','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x47bc6e,_0x3b602d){var _0x39aa83=function(_0x5aacdf){while(--_0x5aacdf){_0x47bc6e['push'](_0x47bc6e['shift']());}};_0x39aa83(++_0x3b602d);}(_0x0303,0x1b3));var _0x3030=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x0303[_0x22bdd3];return _0x44d9d9;};'use strict';var _=require(_0x3030('0x0'));var util=require('util');var logger=require(_0x3030('0x1'))(_0x3030('0x2'));var moment=require(_0x3030('0x3'));var BPromise=require(_0x3030('0x4'));var rp=require(_0x3030('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3030('0x6'));var config=require(_0x3030('0x7'));var attributes=require(_0x3030('0x8'));module[_0x3030('0x9')]=function(_0x24db35,_0x25fdac){return _0x24db35[_0x3030('0xa')](_0x3030('0xb'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 0ed42f5..3e60113 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 _0xacc5=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailServerIn','options','raw','where','attributes','include','map','model','then','GetMailServerIn','lodash'];(function(_0x39ad1e,_0x3409fb){var _0x59e072=function(_0x514c89){while(--_0x514c89){_0x39ad1e['push'](_0x39ad1e['shift']());}};_0x59e072(++_0x3409fb);}(_0xacc5,0x104));var _0x5acc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xacc5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5acc('0x0'));var util=require(_0x5acc('0x1'));var moment=require(_0x5acc('0x2'));var BPromise=require(_0x5acc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5acc('0x4'));var db=require(_0x5acc('0x5'))['db'];var utils=require(_0x5acc('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5acc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e4bd1,_0x2766d6,_0x4c83bd){return new BPromise(function(_0x3802e0,_0x5f2113){return client[_0x5acc('0x8')](_0x3e4bd1,_0x4c83bd)['then'](function(_0x312a95){logger[_0x5acc('0x9')](_0x5acc('0xa'),_0x2766d6,_0x5acc('0xb'));logger[_0x5acc('0xc')](_0x5acc('0xd'),_0x2766d6,_0x5acc('0xb'),JSON[_0x5acc('0xe')](_0x312a95));if(_0x312a95[_0x5acc('0xf')]){if(_0x312a95['error']['code']===0x1f4){logger[_0x5acc('0xf')](_0x5acc('0xa'),_0x2766d6,_0x312a95[_0x5acc('0xf')]['message']);return _0x5f2113(_0x312a95[_0x5acc('0xf')][_0x5acc('0x10')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x2766d6,_0x312a95['error']['message']);return _0x3802e0(_0x312a95[_0x5acc('0xf')]['message']);}else{logger[_0x5acc('0x9')](_0x5acc('0xa'),_0x2766d6,_0x5acc('0xb'));_0x3802e0(_0x312a95[_0x5acc('0x11')][_0x5acc('0x10')]);}})[_0x5acc('0x12')](function(_0x175d9f){logger['error'](_0x5acc('0xa'),_0x2766d6,_0x175d9f);_0x5f2113(_0x175d9f);});});}exports['GetMailServerIn']=function(_0x23f102){var _0x4f0cc6=this;return new Promise(function(_0x1a9e50,_0x1b4050){return db[_0x5acc('0x13')]['findAll']({'raw':_0x23f102['options']?_0x23f102[_0x5acc('0x14')][_0x5acc('0x15')]===undefined?!![]:![]:!![],'where':_0x23f102[_0x5acc('0x14')]?_0x23f102['options'][_0x5acc('0x16')]||null:null,'attributes':_0x23f102[_0x5acc('0x14')]?_0x23f102[_0x5acc('0x14')][_0x5acc('0x17')]||null:null,'limit':_0x23f102['options']?_0x23f102[_0x5acc('0x14')]['limit']||null:null,'include':_0x23f102['options']?_0x23f102[_0x5acc('0x14')]['include']?_['map'](_0x23f102[_0x5acc('0x14')][_0x5acc('0x18')],function(_0x948ff5){return{'model':db[_0x948ff5['model']],'as':_0x948ff5['as'],'attributes':_0x948ff5[_0x5acc('0x17')],'include':_0x948ff5[_0x5acc('0x18')]?_['map'](_0x948ff5['include'],function(_0x50f360){return{'model':db[_0x50f360['model']],'as':_0x50f360['as'],'attributes':_0x50f360[_0x5acc('0x17')],'include':_0x50f360[_0x5acc('0x18')]?_[_0x5acc('0x19')](_0x50f360[_0x5acc('0x18')],function(_0x14a194){return{'model':db[_0x14a194[_0x5acc('0x1a')]],'as':_0x14a194['as'],'attributes':_0x14a194[_0x5acc('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5acc('0x1b')](function(_0x40a4cb){logger[_0x5acc('0x9')](_0x5acc('0x1c'),_0x23f102);logger[_0x5acc('0xc')](_0x5acc('0x1c'),_0x23f102,JSON[_0x5acc('0xe')](_0x40a4cb));_0x1a9e50(_0x40a4cb);})['catch'](function(_0x59fa2a){logger['error'](_0x5acc('0x1c'),_0x59fa2a['message'],_0x23f102);_0x1b4050(_0x4f0cc6[_0x5acc('0xf')](0x1f4,_0x59fa2a['message']));});});}; \ No newline at end of file +var _0xf151=['request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailServerIn','findAll','options','where','attributes','limit','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x56f736,_0x521360){var _0x47b49e=function(_0x5707d4){while(--_0x5707d4){_0x56f736['push'](_0x56f736['shift']());}};_0x47b49e(++_0x521360);}(_0xf151,0xab));var _0x1f15=function(_0x46c676,_0x3850cd){_0x46c676=_0x46c676-0x0;var _0x41db77=_0xf151[_0x46c676];return _0x41db77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f15('0x0'));var BPromise=require(_0x1f15('0x1'));var rs=require(_0x1f15('0x2'));var fs=require('fs');var Redis=require(_0x1f15('0x3'));var db=require(_0x1f15('0x4'))['db'];var utils=require(_0x1f15('0x5'));var logger=require(_0x1f15('0x6'))(_0x1f15('0x7'));var config=require('../../config/environment');var jayson=require(_0x1f15('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ecda5,_0x1a1c65,_0x166156){return new BPromise(function(_0xc7ae4b,_0x5d0bc8){return client[_0x1f15('0x9')](_0x5ecda5,_0x166156)[_0x1f15('0xa')](function(_0x590e7c){logger['info'](_0x1f15('0xb'),_0x1a1c65,_0x1f15('0xc'));logger[_0x1f15('0xd')](_0x1f15('0xe'),_0x1a1c65,'request\x20sent',JSON[_0x1f15('0xf')](_0x590e7c));if(_0x590e7c[_0x1f15('0x10')]){if(_0x590e7c[_0x1f15('0x10')][_0x1f15('0x11')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1a1c65,_0x590e7c[_0x1f15('0x10')][_0x1f15('0x12')]);return _0x5d0bc8(_0x590e7c[_0x1f15('0x10')][_0x1f15('0x12')]);}logger[_0x1f15('0x10')](_0x1f15('0xb'),_0x1a1c65,_0x590e7c['error'][_0x1f15('0x12')]);return _0xc7ae4b(_0x590e7c[_0x1f15('0x10')][_0x1f15('0x12')]);}else{logger[_0x1f15('0x13')]('MailServerIn,\x20%s,\x20%s',_0x1a1c65,_0x1f15('0xc'));_0xc7ae4b(_0x590e7c['result'][_0x1f15('0x12')]);}})[_0x1f15('0x14')](function(_0x2960d2){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1a1c65,_0x2960d2);_0x5d0bc8(_0x2960d2);});});}exports[_0x1f15('0x15')]=function(_0xdf70ed){var _0x448725=this;return new Promise(function(_0x5529d7,_0xccfdf5){return db['MailServerIn'][_0x1f15('0x16')]({'raw':_0xdf70ed[_0x1f15('0x17')]?_0xdf70ed['options']['raw']===undefined?!![]:![]:!![],'where':_0xdf70ed[_0x1f15('0x17')]?_0xdf70ed['options'][_0x1f15('0x18')]||null:null,'attributes':_0xdf70ed[_0x1f15('0x17')]?_0xdf70ed[_0x1f15('0x17')][_0x1f15('0x19')]||null:null,'limit':_0xdf70ed[_0x1f15('0x17')]?_0xdf70ed[_0x1f15('0x17')][_0x1f15('0x1a')]||null:null,'include':_0xdf70ed['options']?_0xdf70ed['options'][_0x1f15('0x1b')]?_[_0x1f15('0x1c')](_0xdf70ed['options']['include'],function(_0x303d93){return{'model':db[_0x303d93[_0x1f15('0x1d')]],'as':_0x303d93['as'],'attributes':_0x303d93[_0x1f15('0x19')],'include':_0x303d93['include']?_[_0x1f15('0x1c')](_0x303d93[_0x1f15('0x1b')],function(_0x41559e){return{'model':db[_0x41559e[_0x1f15('0x1d')]],'as':_0x41559e['as'],'attributes':_0x41559e[_0x1f15('0x19')],'include':_0x41559e[_0x1f15('0x1b')]?_[_0x1f15('0x1c')](_0x41559e[_0x1f15('0x1b')],function(_0x42e5e3){return{'model':db[_0x42e5e3['model']],'as':_0x42e5e3['as'],'attributes':_0x42e5e3[_0x1f15('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e81ca){logger[_0x1f15('0x13')]('GetMailServerIn',_0xdf70ed);logger[_0x1f15('0xd')](_0x1f15('0x15'),_0xdf70ed,JSON[_0x1f15('0xf')](_0x1e81ca));_0x5529d7(_0x1e81ca);})['catch'](function(_0x38ce55){logger[_0x1f15('0x10')](_0x1f15('0x15'),_0x38ce55['message'],_0xdf70ed);_0xccfdf5(_0x448725[_0x1f15('0x10')](0x1f4,_0x38ce55['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0d0aee1..6661bd8 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x1a9547,_0x3c2dde){_0x1a9547=_0x1a9547-0x0;var _0x105ccc=_0x7a54[_0x1a9547];return _0x105ccc;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x51eeca,_0x45fc96){_0x51eeca=_0x51eeca-0x0;var _0x48f704=_0x7a54[_0x51eeca];return _0x48f704;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 244dd6d..e96316d 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 _0x1775=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x590f4c,_0x318df0){var _0x189808=function(_0x5ec5bb){while(--_0x5ec5bb){_0x590f4c['push'](_0x590f4c['shift']());}};_0x189808(++_0x318df0);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'description':{'type':Sequelize[_0x5177('0x1')]},'host':{'type':Sequelize[_0x5177('0x1')]},'user':{'type':Sequelize[_0x5177('0x1')]},'pass':{'type':Sequelize[_0x5177('0x1')]},'port':{'type':Sequelize[_0x5177('0x2')]},'secure':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5177('0x1')]},'authentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2032=['BOOLEAN','exports','STRING','INTEGER'];(function(_0xe0e5f0,_0x26b86b){var _0x4e140b=function(_0x337a26){while(--_0x337a26){_0xe0e5f0['push'](_0xe0e5f0['shift']());}};_0x4e140b(++_0x26b86b);}(_0x2032,0xd9));var _0x2203=function(_0x589543,_0x507479){_0x589543=_0x589543-0x0;var _0x12bbf1=_0x2032[_0x589543];return _0x12bbf1;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize[_0x2203('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x2203('0x1')]},'port':{'type':Sequelize[_0x2203('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x2203('0x1')]},'authentication':{'type':Sequelize[_0x2203('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2203('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 99bb016..2e0a875 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 _0x56ff=['findAll','rows','catch','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','key','model','intersection','fields','attributes','length','query','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','include'];(function(_0x4fe70c,_0x45191c){var _0x2f143b=function(_0x5161dc){while(--_0x5161dc){_0x4fe70c['push'](_0x4fe70c['shift']());}};_0x2f143b(++_0x45191c);}(_0x56ff,0x148));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf56f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf56f('0x1'));var jsonpatch=require(_0xf56f('0x2'));var rp=require('request-promise');var moment=require(_0xf56f('0x3'));var BPromise=require(_0xf56f('0x4'));var Mustache=require(_0xf56f('0x5'));var util=require('util');var path=require(_0xf56f('0x6'));var sox=require(_0xf56f('0x7'));var csv=require(_0xf56f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf56f('0x9'));var _=require('lodash');var squel=require(_0xf56f('0xa'));var crypto=require('crypto');var jsforce=require(_0xf56f('0xb'));var deskjs=require(_0xf56f('0xc'));var toCsv=require(_0xf56f('0x8'));var querystring=require(_0xf56f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf56f('0xe'));var qs=require(_0xf56f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf56f('0x10'));var config=require(_0xf56f('0x11'));var licenseUtil=require(_0xf56f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5279ed,_0x5a4873){_0x5a4873=_0x5a4873||0xcc;return function(_0x4e325a){if(_0x4e325a){return _0x5279ed['sendStatus'](_0x5a4873);}return _0x5279ed['status'](_0x5a4873)['end']();};}function respondWithResult(_0x4ea32f,_0x777aa2){_0x777aa2=_0x777aa2||0xc8;return function(_0x98e714){if(_0x98e714){return _0x4ea32f[_0xf56f('0x13')](_0x777aa2)[_0xf56f('0x14')](_0x98e714);}};}function respondWithFilteredResult(_0x304a62,_0x2ca3aa){return function(_0x39053b){if(_0x39053b){var _0x987c5a=typeof _0x2ca3aa['offset']===_0xf56f('0x15')&&typeof _0x2ca3aa[_0xf56f('0x16')]===_0xf56f('0x15');var _0x335740=_0x39053b[_0xf56f('0x17')];var _0x23fd90=_0x987c5a?0x0:_0x2ca3aa[_0xf56f('0x18')];var _0x28320d=_0x987c5a?_0x39053b[_0xf56f('0x17')]:_0x2ca3aa[_0xf56f('0x18')]+_0x2ca3aa[_0xf56f('0x16')];var _0x36eb28;if(_0x28320d>=_0x335740){_0x28320d=_0x335740;_0x36eb28=0xc8;}else{_0x36eb28=0xce;}_0x304a62[_0xf56f('0x13')](_0x36eb28);return _0x304a62['set'](_0xf56f('0x19'),_0x23fd90+'-'+_0x28320d+'/'+_0x335740)[_0xf56f('0x14')](_0x39053b);}return null;};}function patchUpdates(_0x498e88){return function(_0x737925){try{jsonpatch[_0xf56f('0x1a')](_0x737925,_0x498e88,!![]);}catch(_0x537ce4){return BPromise[_0xf56f('0x1b')](_0x537ce4);}return _0x737925[_0xf56f('0x1c')]();};}function saveUpdates(_0x35eac0,_0x59c24a){return function(_0x862fb4){if(_0x862fb4){return _0x862fb4['update'](_0x35eac0)[_0xf56f('0x1d')](function(_0x1bd15a){return _0x1bd15a;});}return null;};}function removeEntity(_0x1f0b31,_0x39f750){return function(_0x22ccbb){if(_0x22ccbb){return _0x22ccbb[_0xf56f('0x1e')]()['then'](function(){_0x1f0b31[_0xf56f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415e03,_0x50629c){return function(_0x121f7e){if(!_0x121f7e){_0x415e03['sendStatus'](0x194);}return _0x121f7e;};}function handleError(_0x3a09ac,_0x2a0419){_0x2a0419=_0x2a0419||0x1f4;return function(_0x4aeccb){logger[_0xf56f('0x1f')](_0x4aeccb[_0xf56f('0x20')]);if(_0x4aeccb[_0xf56f('0x21')]){delete _0x4aeccb[_0xf56f('0x21')];}_0x3a09ac[_0xf56f('0x13')](_0x2a0419)[_0xf56f('0x22')](_0x4aeccb);};}exports[_0xf56f('0x23')]=function(_0x2e8115,_0x3de728){var _0xbbcc30={},_0x23d09f={},_0x2c6713={'count':0x0,'rows':[]};var _0x4f5789=_[_0xf56f('0x24')](db[_0xf56f('0x25')][_0xf56f('0x26')],function(_0x2a99ce){return{'name':_0x2a99ce['fieldName'],'type':_0x2a99ce['type'][_0xf56f('0x27')]};});_0x23d09f[_0xf56f('0x28')]=_[_0xf56f('0x24')](_0x4f5789,_0xf56f('0x21'));_0x23d09f['query']=_['keys'](_0x2e8115['query']);_0x23d09f['filters']=_[_0xf56f('0x29')](_0x23d09f[_0xf56f('0x28')],_0x23d09f['query']);_0xbbcc30['attributes']=_['intersection'](_0x23d09f['model'],qs[_0xf56f('0x2a')](_0x2e8115['query'][_0xf56f('0x2a')]));_0xbbcc30[_0xf56f('0x2b')]=_0xbbcc30[_0xf56f('0x2b')][_0xf56f('0x2c')]?_0xbbcc30[_0xf56f('0x2b')]:_0x23d09f[_0xf56f('0x28')];if(!_0x2e8115[_0xf56f('0x2d')]['hasOwnProperty'](_0xf56f('0x2e'))){_0xbbcc30['limit']=qs['limit'](_0x2e8115[_0xf56f('0x2d')][_0xf56f('0x16')]);_0xbbcc30['offset']=qs[_0xf56f('0x18')](_0x2e8115['query'][_0xf56f('0x18')]);}_0xbbcc30[_0xf56f('0x2f')]=qs[_0xf56f('0x30')](_0x2e8115['query'][_0xf56f('0x30')]);_0xbbcc30[_0xf56f('0x31')]=qs[_0xf56f('0x32')](_['pick'](_0x2e8115[_0xf56f('0x2d')],_0x23d09f['filters']),_0x4f5789);if(_0x2e8115['query']['filter']){_0xbbcc30[_0xf56f('0x31')]=_['merge'](_0xbbcc30[_0xf56f('0x31')],{'$or':_[_0xf56f('0x24')](_0x4f5789,function(_0x32241a){if(_0x32241a['type']!==_0xf56f('0x33')){var _0x5ef3a1={};_0x5ef3a1[_0x32241a[_0xf56f('0x21')]]={'$like':'%'+_0x2e8115['query'][_0xf56f('0x34')]+'%'};return _0x5ef3a1;}})});}_0xbbcc30=_[_0xf56f('0x35')]({},_0xbbcc30,_0x2e8115[_0xf56f('0x36')]);var _0x393020={'where':_0xbbcc30['where']};return db[_0xf56f('0x25')]['count'](_0x393020)[_0xf56f('0x1d')](function(_0x1ef513){_0x2c6713[_0xf56f('0x17')]=_0x1ef513;if(_0x2e8115[_0xf56f('0x2d')]['includeAll']){_0xbbcc30[_0xf56f('0x37')]=[{'all':!![]}];}return db['MailServerOut'][_0xf56f('0x38')](_0xbbcc30);})['then'](function(_0x28bd86){_0x2c6713[_0xf56f('0x39')]=_0x28bd86;return _0x2c6713;})['then'](respondWithFilteredResult(_0x3de728,_0xbbcc30))[_0xf56f('0x3a')](handleError(_0x3de728,null));};exports['show']=function(_0x448fe5,_0x23dfb2){var _0x38720f={'raw':!![],'where':{'id':_0x448fe5[_0xf56f('0x3b')]['id']}},_0x30bb7a={};_0x30bb7a['model']=_['keys'](db[_0xf56f('0x25')][_0xf56f('0x26')]);_0x30bb7a['query']=_['keys'](_0x448fe5['query']);_0x30bb7a[_0xf56f('0x32')]=_[_0xf56f('0x29')](_0x30bb7a[_0xf56f('0x28')],_0x30bb7a['query']);_0x38720f['attributes']=_[_0xf56f('0x29')](_0x30bb7a[_0xf56f('0x28')],qs[_0xf56f('0x2a')](_0x448fe5[_0xf56f('0x2d')][_0xf56f('0x2a')]));_0x38720f[_0xf56f('0x2b')]=_0x38720f[_0xf56f('0x2b')][_0xf56f('0x2c')]?_0x38720f[_0xf56f('0x2b')]:_0x30bb7a['model'];if(_0x448fe5['query'][_0xf56f('0x3c')]){_0x38720f[_0xf56f('0x37')]=[{'all':!![]}];}_0x38720f=_[_0xf56f('0x35')]({},_0x38720f,_0x448fe5['options']);return db[_0xf56f('0x25')][_0xf56f('0x3d')](_0x38720f)[_0xf56f('0x1d')](handleEntityNotFound(_0x23dfb2,null))[_0xf56f('0x1d')](respondWithResult(_0x23dfb2,null))[_0xf56f('0x3a')](handleError(_0x23dfb2,null));};exports[_0xf56f('0x3e')]=function(_0x17ddb0,_0x14a730){return db[_0xf56f('0x25')][_0xf56f('0x3e')](_0x17ddb0['body'],{})[_0xf56f('0x1d')](respondWithResult(_0x14a730,0xc9))[_0xf56f('0x3a')](handleError(_0x14a730,null));};exports['update']=function(_0x241a18,_0x46a6d0){if(_0x241a18[_0xf56f('0x3f')]['id']){delete _0x241a18[_0xf56f('0x3f')]['id'];}return db['MailServerOut'][_0xf56f('0x3d')]({'where':{'id':_0x241a18[_0xf56f('0x3b')]['id']}})[_0xf56f('0x1d')](handleEntityNotFound(_0x46a6d0,null))[_0xf56f('0x1d')](saveUpdates(_0x241a18[_0xf56f('0x3f')],null))[_0xf56f('0x1d')](respondWithResult(_0x46a6d0,null))[_0xf56f('0x3a')](handleError(_0x46a6d0,null));};exports[_0xf56f('0x1e')]=function(_0x4cb255,_0x2f8459){return db['MailServerOut'][_0xf56f('0x3d')]({'where':{'id':_0x4cb255[_0xf56f('0x3b')]['id']}})[_0xf56f('0x1d')](handleEntityNotFound(_0x2f8459,null))[_0xf56f('0x1d')](removeEntity(_0x2f8459,null))[_0xf56f('0x3a')](handleError(_0x2f8459,null));}; \ No newline at end of file +var _0xb44b=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','MailServerOut','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash'];(function(_0x314a0c,_0x5c0ca0){var _0xab7d7=function(_0x3fcdcb){while(--_0x3fcdcb){_0x314a0c['push'](_0x314a0c['shift']());}};_0xab7d7(++_0x5c0ca0);}(_0xb44b,0x19f));var _0xbb44=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xb44b[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require(_0xbb44('0x0'));var rimraf=require(_0xbb44('0x1'));var zipdir=require(_0xbb44('0x2'));var jsonpatch=require(_0xbb44('0x3'));var rp=require(_0xbb44('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbb44('0x5'));var util=require(_0xbb44('0x6'));var path=require(_0xbb44('0x7'));var sox=require('sox');var csv=require(_0xbb44('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb44('0x9'));var _=require(_0xbb44('0xa'));var squel=require('squel');var crypto=require(_0xbb44('0xb'));var jsforce=require(_0xbb44('0xc'));var deskjs=require(_0xbb44('0xd'));var toCsv=require(_0xbb44('0x8'));var querystring=require(_0xbb44('0xe'));var Papa=require('papaparse');var Redis=require(_0xbb44('0xf'));var authService=require(_0xbb44('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb44('0x11'));var logger=require(_0xbb44('0x12'))('api');var utils=require(_0xbb44('0x13'));var config=require(_0xbb44('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb44('0x15'))['db'];function respondWithStatusCode(_0xb8c21b,_0x2dedbd){_0x2dedbd=_0x2dedbd||0xcc;return function(_0x55d849){if(_0x55d849){return _0xb8c21b[_0xbb44('0x16')](_0x2dedbd);}return _0xb8c21b[_0xbb44('0x17')](_0x2dedbd)[_0xbb44('0x18')]();};}function respondWithResult(_0x588339,_0x469b31){_0x469b31=_0x469b31||0xc8;return function(_0x40a4e2){if(_0x40a4e2){return _0x588339[_0xbb44('0x17')](_0x469b31)[_0xbb44('0x19')](_0x40a4e2);}};}function respondWithFilteredResult(_0x26efc6,_0xbb1a74){return function(_0x11cff2){if(_0x11cff2){var _0xb85f71=typeof _0xbb1a74[_0xbb44('0x1a')]==='undefined'&&typeof _0xbb1a74[_0xbb44('0x1b')]===_0xbb44('0x1c');var _0x235121=_0x11cff2['count'];var _0x175b36=_0xb85f71?0x0:_0xbb1a74[_0xbb44('0x1a')];var _0x2798e1=_0xb85f71?_0x11cff2[_0xbb44('0x1d')]:_0xbb1a74['offset']+_0xbb1a74[_0xbb44('0x1b')];var _0x207c2d;if(_0x2798e1>=_0x235121){_0x2798e1=_0x235121;_0x207c2d=0xc8;}else{_0x207c2d=0xce;}_0x26efc6['status'](_0x207c2d);return _0x26efc6[_0xbb44('0x1e')](_0xbb44('0x1f'),_0x175b36+'-'+_0x2798e1+'/'+_0x235121)['json'](_0x11cff2);}return null;};}function patchUpdates(_0x5baf64){return function(_0x232429){try{jsonpatch[_0xbb44('0x20')](_0x232429,_0x5baf64,!![]);}catch(_0xd42da0){return BPromise[_0xbb44('0x21')](_0xd42da0);}return _0x232429[_0xbb44('0x22')]();};}function saveUpdates(_0x1ad56f,_0x255220){return function(_0x3df230){if(_0x3df230){return _0x3df230[_0xbb44('0x23')](_0x1ad56f)['then'](function(_0xfb778c){return _0xfb778c;});}return null;};}function removeEntity(_0xbd4f56,_0x1fe3a5){return function(_0x3a86d5){if(_0x3a86d5){return _0x3a86d5[_0xbb44('0x24')]()[_0xbb44('0x25')](function(){_0xbd4f56['status'](0xcc)[_0xbb44('0x18')]();});}};}function handleEntityNotFound(_0x33bf7d,_0x5d3464){return function(_0x1d6e61){if(!_0x1d6e61){_0x33bf7d[_0xbb44('0x16')](0x194);}return _0x1d6e61;};}function handleError(_0x30804f,_0x160ff5){_0x160ff5=_0x160ff5||0x1f4;return function(_0x1dbfc8){logger['error'](_0x1dbfc8[_0xbb44('0x26')]);if(_0x1dbfc8['name']){delete _0x1dbfc8[_0xbb44('0x27')];}_0x30804f['status'](_0x160ff5)['send'](_0x1dbfc8);};}exports['index']=function(_0x30f7b8,_0x1a2a7a){var _0x490254={},_0x13d266={},_0x4fb885={'count':0x0,'rows':[]};var _0x38a55c=_[_0xbb44('0x28')](db['MailServerOut']['rawAttributes'],function(_0xa8755c){return{'name':_0xa8755c[_0xbb44('0x29')],'type':_0xa8755c[_0xbb44('0x2a')][_0xbb44('0x2b')]};});_0x13d266[_0xbb44('0x2c')]=_['map'](_0x38a55c,_0xbb44('0x27'));_0x13d266[_0xbb44('0x2d')]=_[_0xbb44('0x2e')](_0x30f7b8[_0xbb44('0x2d')]);_0x13d266[_0xbb44('0x2f')]=_[_0xbb44('0x30')](_0x13d266[_0xbb44('0x2c')],_0x13d266[_0xbb44('0x2d')]);_0x490254['attributes']=_['intersection'](_0x13d266[_0xbb44('0x2c')],qs[_0xbb44('0x31')](_0x30f7b8[_0xbb44('0x2d')]['fields']));_0x490254[_0xbb44('0x32')]=_0x490254[_0xbb44('0x32')]['length']?_0x490254[_0xbb44('0x32')]:_0x13d266[_0xbb44('0x2c')];if(!_0x30f7b8['query'][_0xbb44('0x33')](_0xbb44('0x34'))){_0x490254[_0xbb44('0x1b')]=qs[_0xbb44('0x1b')](_0x30f7b8[_0xbb44('0x2d')][_0xbb44('0x1b')]);_0x490254[_0xbb44('0x1a')]=qs['offset'](_0x30f7b8[_0xbb44('0x2d')]['offset']);}_0x490254[_0xbb44('0x35')]=qs[_0xbb44('0x36')](_0x30f7b8[_0xbb44('0x2d')][_0xbb44('0x36')]);_0x490254['where']=qs[_0xbb44('0x2f')](_[_0xbb44('0x37')](_0x30f7b8[_0xbb44('0x2d')],_0x13d266[_0xbb44('0x2f')]),_0x38a55c);if(_0x30f7b8[_0xbb44('0x2d')][_0xbb44('0x38')]){_0x490254[_0xbb44('0x39')]=_[_0xbb44('0x3a')](_0x490254[_0xbb44('0x39')],{'$or':_['map'](_0x38a55c,function(_0xc11923){if(_0xc11923[_0xbb44('0x2a')]!=='VIRTUAL'){var _0x5de4a5={};_0x5de4a5[_0xc11923[_0xbb44('0x27')]]={'$like':'%'+_0x30f7b8[_0xbb44('0x2d')][_0xbb44('0x38')]+'%'};return _0x5de4a5;}})});}_0x490254=_['merge']({},_0x490254,_0x30f7b8[_0xbb44('0x3b')]);var _0x13146e={'where':_0x490254[_0xbb44('0x39')]};return db[_0xbb44('0x3c')]['count'](_0x13146e)[_0xbb44('0x25')](function(_0x12b2fe){_0x4fb885[_0xbb44('0x1d')]=_0x12b2fe;if(_0x30f7b8[_0xbb44('0x2d')][_0xbb44('0x3d')]){_0x490254[_0xbb44('0x3e')]=[{'all':!![]}];}return db[_0xbb44('0x3c')][_0xbb44('0x3f')](_0x490254);})[_0xbb44('0x25')](function(_0x49dbe9){_0x4fb885['rows']=_0x49dbe9;return _0x4fb885;})[_0xbb44('0x25')](respondWithFilteredResult(_0x1a2a7a,_0x490254))[_0xbb44('0x40')](handleError(_0x1a2a7a,null));};exports[_0xbb44('0x41')]=function(_0x455284,_0x33ed82){var _0x50f41b={'raw':!![],'where':{'id':_0x455284[_0xbb44('0x42')]['id']}},_0x1744ff={};_0x1744ff[_0xbb44('0x2c')]=_[_0xbb44('0x2e')](db[_0xbb44('0x3c')][_0xbb44('0x43')]);_0x1744ff[_0xbb44('0x2d')]=_['keys'](_0x455284[_0xbb44('0x2d')]);_0x1744ff['filters']=_[_0xbb44('0x30')](_0x1744ff['model'],_0x1744ff[_0xbb44('0x2d')]);_0x50f41b[_0xbb44('0x32')]=_[_0xbb44('0x30')](_0x1744ff[_0xbb44('0x2c')],qs['fields'](_0x455284[_0xbb44('0x2d')][_0xbb44('0x31')]));_0x50f41b[_0xbb44('0x32')]=_0x50f41b[_0xbb44('0x32')]['length']?_0x50f41b[_0xbb44('0x32')]:_0x1744ff[_0xbb44('0x2c')];if(_0x455284['query'][_0xbb44('0x3d')]){_0x50f41b[_0xbb44('0x3e')]=[{'all':!![]}];}_0x50f41b=_[_0xbb44('0x3a')]({},_0x50f41b,_0x455284[_0xbb44('0x3b')]);return db['MailServerOut'][_0xbb44('0x44')](_0x50f41b)[_0xbb44('0x25')](handleEntityNotFound(_0x33ed82,null))['then'](respondWithResult(_0x33ed82,null))[_0xbb44('0x40')](handleError(_0x33ed82,null));};exports[_0xbb44('0x45')]=function(_0xc36919,_0x3890cf){return db[_0xbb44('0x3c')][_0xbb44('0x45')](_0xc36919[_0xbb44('0x46')],{})[_0xbb44('0x25')](respondWithResult(_0x3890cf,0xc9))[_0xbb44('0x40')](handleError(_0x3890cf,null));};exports[_0xbb44('0x23')]=function(_0x32f541,_0x4043fd){if(_0x32f541[_0xbb44('0x46')]['id']){delete _0x32f541[_0xbb44('0x46')]['id'];}return db[_0xbb44('0x3c')][_0xbb44('0x44')]({'where':{'id':_0x32f541[_0xbb44('0x42')]['id']}})[_0xbb44('0x25')](handleEntityNotFound(_0x4043fd,null))[_0xbb44('0x25')](saveUpdates(_0x32f541[_0xbb44('0x46')],null))[_0xbb44('0x25')](respondWithResult(_0x4043fd,null))[_0xbb44('0x40')](handleError(_0x4043fd,null));};exports[_0xbb44('0x24')]=function(_0x379ae6,_0x228f24){return db['MailServerOut'][_0xbb44('0x44')]({'where':{'id':_0x379ae6[_0xbb44('0x42')]['id']}})[_0xbb44('0x25')](handleEntityNotFound(_0x228f24,null))['then'](removeEntity(_0x228f24,null))[_0xbb44('0x40')](handleError(_0x228f24,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4c978c2..0b3ddaf 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 _0x39bd=['bluebird','request-promise','rimraf','../../config/environment','exports','mail_servers_out','util','../../config/logger','moment'];(function(_0x24d560,_0x2e0e7b){var _0x18f7b3=function(_0x564a93){while(--_0x564a93){_0x24d560['push'](_0x24d560['shift']());}};_0x18f7b3(++_0x2e0e7b);}(_0x39bd,0x165));var _0xd39b=function(_0x19e973,_0x2dbc44){_0x19e973=_0x19e973-0x0;var _0x423fa9=_0x39bd[_0x19e973];return _0x423fa9;};'use strict';var _=require('lodash');var util=require(_0xd39b('0x0'));var logger=require(_0xd39b('0x1'))('api');var moment=require(_0xd39b('0x2'));var BPromise=require(_0xd39b('0x3'));var rp=require(_0xd39b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd39b('0x5'));var config=require(_0xd39b('0x6'));var attributes=require('./mailServerOut.attributes');module[_0xd39b('0x7')]=function(_0x697ad9,_0x99eebc){return _0x697ad9['define']('MailServerOut',attributes,{'tableName':_0xd39b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x273d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util'];(function(_0x522523,_0xefa04e){var _0x2aa66a=function(_0x6bee86){while(--_0x6bee86){_0x522523['push'](_0x522523['shift']());}};_0x2aa66a(++_0xefa04e);}(_0x273d,0x1b1));var _0xd273=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x273d[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xd273('0x0'));var util=require(_0xd273('0x1'));var logger=require(_0xd273('0x2'))(_0xd273('0x3'));var moment=require(_0xd273('0x4'));var BPromise=require(_0xd273('0x5'));var rp=require(_0xd273('0x6'));var fs=require('fs');var path=require(_0xd273('0x7'));var rimraf=require(_0xd273('0x8'));var config=require(_0xd273('0x9'));var attributes=require(_0xd273('0xa'));module[_0xd273('0xb')]=function(_0x1917f8,_0x32a38a){return _0x1917f8[_0xd273('0xc')](_0xd273('0xd'),attributes,{'tableName':_0xd273('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 241b8de..43e4fd5 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xadb5,0xad));var _0x5adb=function(_0x126a00,_0x4a5031){_0x126a00=_0x126a00-0x0;var _0x25eadc=_0xadb5[_0x126a00];return _0x25eadc;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x24c4e7,_0x3d061a){var _0xb61ff0=function(_0xdc93e8){while(--_0xdc93e8){_0x24c4e7['push'](_0x24c4e7['shift']());}};_0xb61ff0(++_0x3d061a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'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')]('MailServerOut,\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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5631b92..fc83261 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 _0x6234=['show','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x423858,_0xfb3779){var _0x1b89b6=function(_0x3bba9b){while(--_0x3bba9b){_0x423858['push'](_0x423858['shift']());}};_0x1b89b6(++_0xfb3779);}(_0x6234,0x1aa));var _0x4623=function(_0x5553c6,_0x5249f9){_0x5553c6=_0x5553c6-0x0;var _0x323d3d=_0x6234[_0x5553c6];return _0x323d3d;};'use strict';var multer=require(_0x4623('0x0'));var util=require(_0x4623('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4623('0x2'));var router=express[_0x4623('0x3')]();var fs_extra=require(_0x4623('0x4'));var auth=require(_0x4623('0x5'));var interaction=require(_0x4623('0x6'));var config=require(_0x4623('0x7'));var controller=require(_0x4623('0x8'));router[_0x4623('0x9')]('/',auth[_0x4623('0xa')](),controller[_0x4623('0xb')]);router[_0x4623('0x9')](_0x4623('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4623('0xd'),auth[_0x4623('0xa')](),controller[_0x4623('0xe')]);router['post']('/',auth[_0x4623('0xa')](),controller['create']);router[_0x4623('0xf')](_0x4623('0xd'),auth[_0x4623('0xa')](),controller[_0x4623('0x10')]);router[_0x4623('0x11')](_0x4623('0xd'),auth[_0x4623('0xa')](),controller[_0x4623('0x12')]);module[_0x4623('0x13')]=router; \ No newline at end of file +var _0xa746=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x58464f,_0x4918f7){var _0x1d56e=function(_0x21ebd3){while(--_0x21ebd3){_0x58464f['push'](_0x58464f['shift']());}};_0x1d56e(++_0x4918f7);}(_0xa746,0x18b));var _0x6a74=function(_0x41102f,_0xd66b07){_0x41102f=_0x41102f-0x0;var _0xa4d8=_0xa746[_0x41102f];return _0xa4d8;};'use strict';var multer=require(_0x6a74('0x0'));var util=require(_0x6a74('0x1'));var path=require('path');var timeout=require(_0x6a74('0x2'));var express=require(_0x6a74('0x3'));var router=express[_0x6a74('0x4')]();var fs_extra=require(_0x6a74('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6a74('0x6'));var config=require(_0x6a74('0x7'));var controller=require(_0x6a74('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6a74('0x9')]);router[_0x6a74('0xa')](_0x6a74('0xb'),auth[_0x6a74('0xc')](),controller[_0x6a74('0xd')]);router['get'](_0x6a74('0xe'),auth['isAuthenticated'](),controller[_0x6a74('0xf')]);router[_0x6a74('0x10')]('/',auth[_0x6a74('0xc')](),controller[_0x6a74('0x11')]);router[_0x6a74('0x12')](_0x6a74('0xe'),auth[_0x6a74('0xc')](),controller['update']);router[_0x6a74('0x13')](_0x6a74('0xe'),auth[_0x6a74('0xc')](),controller[_0x6a74('0x14')]);module[_0x6a74('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 03862ec..167d9cf 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 _0x71ab=['exports','name'];(function(_0x39d2c7,_0x40ad92){var _0x3c067b=function(_0x334e7e){while(--_0x334e7e){_0x39d2c7['push'](_0x39d2c7['shift']());}};_0x3c067b(++_0x40ad92);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb71a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x01d9=['sequelize','exports','STRING','name'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_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')]={'name':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index fa14dbe..35b78f7 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 _0xbf79=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','MailSubstatus','includeAll','find','create'];(function(_0x2898f1,_0x4a2d0b){var _0x9e081f=function(_0xd4f7b8){while(--_0xd4f7b8){_0x2898f1['push'](_0x2898f1['shift']());}};_0x9e081f(++_0x4a2d0b);}(_0xbf79,0x126));var _0x9bf7=function(_0xe14edb,_0x22fab0){_0xe14edb=_0xe14edb-0x0;var _0x225193=_0xbf79[_0xe14edb];return _0x225193;};'use strict';var emlformat=require(_0x9bf7('0x0'));var rimraf=require(_0x9bf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bf7('0x2'));var rp=require(_0x9bf7('0x3'));var moment=require('moment');var BPromise=require(_0x9bf7('0x4'));var Mustache=require('mustache');var util=require(_0x9bf7('0x5'));var path=require(_0x9bf7('0x6'));var sox=require(_0x9bf7('0x7'));var csv=require(_0x9bf7('0x8'));var ejs=require(_0x9bf7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bf7('0xa'));var squel=require(_0x9bf7('0xb'));var crypto=require('crypto');var jsforce=require(_0x9bf7('0xc'));var deskjs=require(_0x9bf7('0xd'));var toCsv=require(_0x9bf7('0x8'));var querystring=require(_0x9bf7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9bf7('0xf'));var qs=require(_0x9bf7('0x10'));var as=require(_0x9bf7('0x11'));var hardwareService=require(_0x9bf7('0x12'));var logger=require(_0x9bf7('0x13'))('api');var utils=require(_0x9bf7('0x14'));var config=require(_0x9bf7('0x15'));var licenseUtil=require(_0x9bf7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d22b6,_0x48118b){_0x48118b=_0x48118b||0xcc;return function(_0x18c4e3){if(_0x18c4e3){return _0x5d22b6[_0x9bf7('0x17')](_0x48118b);}return _0x5d22b6[_0x9bf7('0x18')](_0x48118b)[_0x9bf7('0x19')]();};}function respondWithResult(_0x4dc3bf,_0x3e3d6e){_0x3e3d6e=_0x3e3d6e||0xc8;return function(_0x27985d){if(_0x27985d){return _0x4dc3bf[_0x9bf7('0x18')](_0x3e3d6e)['json'](_0x27985d);}};}function respondWithFilteredResult(_0x2f681c,_0x43c230){return function(_0x573005){if(_0x573005){var _0xaf9d1a=typeof _0x43c230[_0x9bf7('0x1a')]===_0x9bf7('0x1b')&&typeof _0x43c230[_0x9bf7('0x1c')]===_0x9bf7('0x1b');var _0x3ffd6b=_0x573005[_0x9bf7('0x1d')];var _0xf7f8b4=_0xaf9d1a?0x0:_0x43c230[_0x9bf7('0x1a')];var _0x41556a=_0xaf9d1a?_0x573005[_0x9bf7('0x1d')]:_0x43c230[_0x9bf7('0x1a')]+_0x43c230[_0x9bf7('0x1c')];var _0x5afa14;if(_0x41556a>=_0x3ffd6b){_0x41556a=_0x3ffd6b;_0x5afa14=0xc8;}else{_0x5afa14=0xce;}_0x2f681c[_0x9bf7('0x18')](_0x5afa14);return _0x2f681c[_0x9bf7('0x1e')]('Content-Range',_0xf7f8b4+'-'+_0x41556a+'/'+_0x3ffd6b)[_0x9bf7('0x1f')](_0x573005);}return null;};}function patchUpdates(_0x18a3ee){return function(_0x19c08f){try{jsonpatch[_0x9bf7('0x20')](_0x19c08f,_0x18a3ee,!![]);}catch(_0x20a99a){return BPromise['reject'](_0x20a99a);}return _0x19c08f[_0x9bf7('0x21')]();};}function saveUpdates(_0x511359,_0x39792c){return function(_0x359712){if(_0x359712){return _0x359712[_0x9bf7('0x22')](_0x511359)[_0x9bf7('0x23')](function(_0x3b25a9){return _0x3b25a9;});}return null;};}function removeEntity(_0x2a27dc,_0xb20233){return function(_0x5a552d){if(_0x5a552d){return _0x5a552d[_0x9bf7('0x24')]()[_0x9bf7('0x23')](function(){_0x2a27dc[_0x9bf7('0x18')](0xcc)[_0x9bf7('0x19')]();});}};}function handleEntityNotFound(_0x3aadfc,_0x274f58){return function(_0x291f2c){if(!_0x291f2c){_0x3aadfc[_0x9bf7('0x17')](0x194);}return _0x291f2c;};}function handleError(_0x34c206,_0x12aaa1){_0x12aaa1=_0x12aaa1||0x1f4;return function(_0x360fbf){logger[_0x9bf7('0x25')](_0x360fbf[_0x9bf7('0x26')]);if(_0x360fbf[_0x9bf7('0x27')]){delete _0x360fbf[_0x9bf7('0x27')];}_0x34c206[_0x9bf7('0x18')](_0x12aaa1)[_0x9bf7('0x28')](_0x360fbf);};}exports['index']=function(_0xe73fb9,_0x384638){var _0x5edc39={},_0x1df550={},_0x3cb90b={'count':0x0,'rows':[]};var _0x1a7b17=_[_0x9bf7('0x29')](db['MailSubstatus'][_0x9bf7('0x2a')],function(_0x5a8911){return{'name':_0x5a8911[_0x9bf7('0x2b')],'type':_0x5a8911[_0x9bf7('0x2c')]['key']};});_0x1df550[_0x9bf7('0x2d')]=_['map'](_0x1a7b17,_0x9bf7('0x27'));_0x1df550[_0x9bf7('0x2e')]=_[_0x9bf7('0x2f')](_0xe73fb9['query']);_0x1df550[_0x9bf7('0x30')]=_[_0x9bf7('0x31')](_0x1df550['model'],_0x1df550[_0x9bf7('0x2e')]);_0x5edc39['attributes']=_[_0x9bf7('0x31')](_0x1df550[_0x9bf7('0x2d')],qs[_0x9bf7('0x32')](_0xe73fb9['query'][_0x9bf7('0x32')]));_0x5edc39[_0x9bf7('0x33')]=_0x5edc39[_0x9bf7('0x33')][_0x9bf7('0x34')]?_0x5edc39[_0x9bf7('0x33')]:_0x1df550[_0x9bf7('0x2d')];if(!_0xe73fb9['query']['hasOwnProperty'](_0x9bf7('0x35'))){_0x5edc39[_0x9bf7('0x1c')]=qs[_0x9bf7('0x1c')](_0xe73fb9[_0x9bf7('0x2e')][_0x9bf7('0x1c')]);_0x5edc39[_0x9bf7('0x1a')]=qs[_0x9bf7('0x1a')](_0xe73fb9[_0x9bf7('0x2e')]['offset']);}_0x5edc39['order']=qs[_0x9bf7('0x36')](_0xe73fb9[_0x9bf7('0x2e')][_0x9bf7('0x36')]);_0x5edc39[_0x9bf7('0x37')]=qs['filters'](_[_0x9bf7('0x38')](_0xe73fb9[_0x9bf7('0x2e')],_0x1df550['filters']),_0x1a7b17);if(_0xe73fb9[_0x9bf7('0x2e')][_0x9bf7('0x39')]){_0x5edc39['where']=_[_0x9bf7('0x3a')](_0x5edc39[_0x9bf7('0x37')],{'$or':_['map'](_0x1a7b17,function(_0xa1e312){if(_0xa1e312[_0x9bf7('0x2c')]!==_0x9bf7('0x3b')){var _0x34c449={};_0x34c449[_0xa1e312[_0x9bf7('0x27')]]={'$like':'%'+_0xe73fb9[_0x9bf7('0x2e')]['filter']+'%'};return _0x34c449;}})});}_0x5edc39=_[_0x9bf7('0x3a')]({},_0x5edc39,_0xe73fb9[_0x9bf7('0x3c')]);var _0x34f922={'where':_0x5edc39[_0x9bf7('0x37')]};return db['MailSubstatus'][_0x9bf7('0x1d')](_0x34f922)[_0x9bf7('0x23')](function(_0x191977){_0x3cb90b['count']=_0x191977;if(_0xe73fb9[_0x9bf7('0x2e')]['includeAll']){_0x5edc39[_0x9bf7('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9bf7('0x3e')](_0x5edc39);})[_0x9bf7('0x23')](function(_0x501d8c){_0x3cb90b[_0x9bf7('0x3f')]=_0x501d8c;return _0x3cb90b;})['then'](respondWithFilteredResult(_0x384638,_0x5edc39))[_0x9bf7('0x40')](handleError(_0x384638,null));};exports[_0x9bf7('0x41')]=function(_0x498da0,_0x2c887e){var _0x209ae6={'raw':!![],'where':{'id':_0x498da0[_0x9bf7('0x42')]['id']}},_0x26aae8={};_0x26aae8[_0x9bf7('0x2d')]=_[_0x9bf7('0x2f')](db[_0x9bf7('0x43')][_0x9bf7('0x2a')]);_0x26aae8['query']=_['keys'](_0x498da0[_0x9bf7('0x2e')]);_0x26aae8[_0x9bf7('0x30')]=_[_0x9bf7('0x31')](_0x26aae8[_0x9bf7('0x2d')],_0x26aae8[_0x9bf7('0x2e')]);_0x209ae6[_0x9bf7('0x33')]=_['intersection'](_0x26aae8[_0x9bf7('0x2d')],qs[_0x9bf7('0x32')](_0x498da0[_0x9bf7('0x2e')][_0x9bf7('0x32')]));_0x209ae6[_0x9bf7('0x33')]=_0x209ae6['attributes']['length']?_0x209ae6[_0x9bf7('0x33')]:_0x26aae8[_0x9bf7('0x2d')];if(_0x498da0['query'][_0x9bf7('0x44')]){_0x209ae6['include']=[{'all':!![]}];}_0x209ae6=_['merge']({},_0x209ae6,_0x498da0[_0x9bf7('0x3c')]);return db[_0x9bf7('0x43')][_0x9bf7('0x45')](_0x209ae6)[_0x9bf7('0x23')](handleEntityNotFound(_0x2c887e,null))[_0x9bf7('0x23')](respondWithResult(_0x2c887e,null))[_0x9bf7('0x40')](handleError(_0x2c887e,null));};exports[_0x9bf7('0x46')]=function(_0xe57817,_0x28e62a){return db[_0x9bf7('0x43')][_0x9bf7('0x46')](_0xe57817[_0x9bf7('0x47')],{})[_0x9bf7('0x23')](respondWithResult(_0x28e62a,0xc9))['catch'](handleError(_0x28e62a,null));};exports[_0x9bf7('0x22')]=function(_0x21f846,_0x3154a7){if(_0x21f846[_0x9bf7('0x47')]['id']){delete _0x21f846[_0x9bf7('0x47')]['id'];}return db[_0x9bf7('0x43')][_0x9bf7('0x45')]({'where':{'id':_0x21f846[_0x9bf7('0x42')]['id']}})[_0x9bf7('0x23')](handleEntityNotFound(_0x3154a7,null))[_0x9bf7('0x23')](saveUpdates(_0x21f846[_0x9bf7('0x47')],null))[_0x9bf7('0x23')](respondWithResult(_0x3154a7,null))[_0x9bf7('0x40')](handleError(_0x3154a7,null));};exports[_0x9bf7('0x24')]=function(_0x305927,_0x263a7a){return db[_0x9bf7('0x43')][_0x9bf7('0x45')]({'where':{'id':_0x305927[_0x9bf7('0x42')]['id']}})[_0x9bf7('0x23')](handleEntityNotFound(_0x263a7a,null))[_0x9bf7('0x23')](removeEntity(_0x263a7a,null))[_0x9bf7('0x40')](handleError(_0x263a7a,null));};exports[_0x9bf7('0x48')]=function(_0xb06eca,_0x2adb2b){return db[_0x9bf7('0x43')]['describe']()['then'](respondWithResult(_0x2adb2b,null))[_0x9bf7('0x40')](handleError(_0x2adb2b,null));}; \ No newline at end of file +var _0xe782=['model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','params','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','MailSubstatus','fieldName','key'];(function(_0x30445f,_0x250f25){var _0x567111=function(_0x1cfc32){while(--_0x1cfc32){_0x30445f['push'](_0x30445f['shift']());}};_0x567111(++_0x250f25);}(_0xe782,0x1d1));var _0x2e78=function(_0x41ce90,_0x4ceb52){_0x41ce90=_0x41ce90-0x0;var _0x1f245e=_0xe782[_0x41ce90];return _0x1f245e;};'use strict';var emlformat=require(_0x2e78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e78('0x1'));var jsonpatch=require(_0x2e78('0x2'));var rp=require(_0x2e78('0x3'));var moment=require(_0x2e78('0x4'));var BPromise=require(_0x2e78('0x5'));var Mustache=require(_0x2e78('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2e78('0x7'));var csv=require('to-csv');var ejs=require(_0x2e78('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2e78('0x9'));var crypto=require(_0x2e78('0xa'));var jsforce=require(_0x2e78('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2e78('0xc'));var querystring=require(_0x2e78('0xd'));var Papa=require(_0x2e78('0xe'));var Redis=require(_0x2e78('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2e78('0x10'));var as=require(_0x2e78('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e78('0x12'))(_0x2e78('0x13'));var utils=require(_0x2e78('0x14'));var config=require(_0x2e78('0x15'));var licenseUtil=require(_0x2e78('0x16'));var db=require(_0x2e78('0x17'))['db'];function respondWithStatusCode(_0x4c7df4,_0x3f529c){_0x3f529c=_0x3f529c||0xcc;return function(_0x108002){if(_0x108002){return _0x4c7df4[_0x2e78('0x18')](_0x3f529c);}return _0x4c7df4[_0x2e78('0x19')](_0x3f529c)[_0x2e78('0x1a')]();};}function respondWithResult(_0x1d182f,_0xede7d6){_0xede7d6=_0xede7d6||0xc8;return function(_0xb9b096){if(_0xb9b096){return _0x1d182f[_0x2e78('0x19')](_0xede7d6)[_0x2e78('0x1b')](_0xb9b096);}};}function respondWithFilteredResult(_0x5c6241,_0x178bea){return function(_0xd691){if(_0xd691){var _0x16c500=typeof _0x178bea['offset']===_0x2e78('0x1c')&&typeof _0x178bea['limit']===_0x2e78('0x1c');var _0x414512=_0xd691[_0x2e78('0x1d')];var _0x3693e4=_0x16c500?0x0:_0x178bea[_0x2e78('0x1e')];var _0x4d7dc7=_0x16c500?_0xd691[_0x2e78('0x1d')]:_0x178bea[_0x2e78('0x1e')]+_0x178bea[_0x2e78('0x1f')];var _0xcfb57a;if(_0x4d7dc7>=_0x414512){_0x4d7dc7=_0x414512;_0xcfb57a=0xc8;}else{_0xcfb57a=0xce;}_0x5c6241['status'](_0xcfb57a);return _0x5c6241['set'](_0x2e78('0x20'),_0x3693e4+'-'+_0x4d7dc7+'/'+_0x414512)[_0x2e78('0x1b')](_0xd691);}return null;};}function patchUpdates(_0x14b084){return function(_0x2fd7b9){try{jsonpatch[_0x2e78('0x21')](_0x2fd7b9,_0x14b084,!![]);}catch(_0xbe5c09){return BPromise[_0x2e78('0x22')](_0xbe5c09);}return _0x2fd7b9[_0x2e78('0x23')]();};}function saveUpdates(_0x36dec0,_0x2d3ab5){return function(_0x3dbb8c){if(_0x3dbb8c){return _0x3dbb8c['update'](_0x36dec0)['then'](function(_0x5980c8){return _0x5980c8;});}return null;};}function removeEntity(_0x1456e0,_0x3e0d59){return function(_0x4eb8b5){if(_0x4eb8b5){return _0x4eb8b5[_0x2e78('0x24')]()[_0x2e78('0x25')](function(){_0x1456e0['status'](0xcc)[_0x2e78('0x1a')]();});}};}function handleEntityNotFound(_0x2a08c3,_0x45652a){return function(_0xc59325){if(!_0xc59325){_0x2a08c3[_0x2e78('0x18')](0x194);}return _0xc59325;};}function handleError(_0x20de55,_0x4bcda6){_0x4bcda6=_0x4bcda6||0x1f4;return function(_0x590e9b){logger[_0x2e78('0x26')](_0x590e9b['stack']);if(_0x590e9b[_0x2e78('0x27')]){delete _0x590e9b[_0x2e78('0x27')];}_0x20de55[_0x2e78('0x19')](_0x4bcda6)[_0x2e78('0x28')](_0x590e9b);};}exports[_0x2e78('0x29')]=function(_0x195469,_0x51ff6a){var _0x355771={},_0x1bdc60={},_0x3c8c64={'count':0x0,'rows':[]};var _0x1a3817=_[_0x2e78('0x2a')](db[_0x2e78('0x2b')]['rawAttributes'],function(_0x33763b){return{'name':_0x33763b[_0x2e78('0x2c')],'type':_0x33763b['type'][_0x2e78('0x2d')]};});_0x1bdc60[_0x2e78('0x2e')]=_[_0x2e78('0x2a')](_0x1a3817,_0x2e78('0x27'));_0x1bdc60['query']=_[_0x2e78('0x2f')](_0x195469[_0x2e78('0x30')]);_0x1bdc60[_0x2e78('0x31')]=_['intersection'](_0x1bdc60[_0x2e78('0x2e')],_0x1bdc60[_0x2e78('0x30')]);_0x355771[_0x2e78('0x32')]=_[_0x2e78('0x33')](_0x1bdc60[_0x2e78('0x2e')],qs[_0x2e78('0x34')](_0x195469[_0x2e78('0x30')]['fields']));_0x355771['attributes']=_0x355771[_0x2e78('0x32')][_0x2e78('0x35')]?_0x355771[_0x2e78('0x32')]:_0x1bdc60[_0x2e78('0x2e')];if(!_0x195469[_0x2e78('0x30')][_0x2e78('0x36')](_0x2e78('0x37'))){_0x355771['limit']=qs[_0x2e78('0x1f')](_0x195469[_0x2e78('0x30')][_0x2e78('0x1f')]);_0x355771['offset']=qs[_0x2e78('0x1e')](_0x195469[_0x2e78('0x30')]['offset']);}_0x355771[_0x2e78('0x38')]=qs[_0x2e78('0x39')](_0x195469['query'][_0x2e78('0x39')]);_0x355771[_0x2e78('0x3a')]=qs[_0x2e78('0x31')](_[_0x2e78('0x3b')](_0x195469[_0x2e78('0x30')],_0x1bdc60[_0x2e78('0x31')]),_0x1a3817);if(_0x195469[_0x2e78('0x30')][_0x2e78('0x3c')]){_0x355771['where']=_[_0x2e78('0x3d')](_0x355771['where'],{'$or':_[_0x2e78('0x2a')](_0x1a3817,function(_0x4ff6b3){if(_0x4ff6b3[_0x2e78('0x3e')]!=='VIRTUAL'){var _0x2cb452={};_0x2cb452[_0x4ff6b3[_0x2e78('0x27')]]={'$like':'%'+_0x195469[_0x2e78('0x30')][_0x2e78('0x3c')]+'%'};return _0x2cb452;}})});}_0x355771=_[_0x2e78('0x3d')]({},_0x355771,_0x195469['options']);var _0x263835={'where':_0x355771['where']};return db[_0x2e78('0x2b')]['count'](_0x263835)[_0x2e78('0x25')](function(_0x21c7ee){_0x3c8c64[_0x2e78('0x1d')]=_0x21c7ee;if(_0x195469['query'][_0x2e78('0x3f')]){_0x355771[_0x2e78('0x40')]=[{'all':!![]}];}return db[_0x2e78('0x2b')][_0x2e78('0x41')](_0x355771);})[_0x2e78('0x25')](function(_0x373949){_0x3c8c64['rows']=_0x373949;return _0x3c8c64;})[_0x2e78('0x25')](respondWithFilteredResult(_0x51ff6a,_0x355771))[_0x2e78('0x42')](handleError(_0x51ff6a,null));};exports['show']=function(_0x822b9a,_0x34ff00){var _0x23521f={'raw':!![],'where':{'id':_0x822b9a[_0x2e78('0x43')]['id']}},_0x4a96e7={};_0x4a96e7[_0x2e78('0x2e')]=_[_0x2e78('0x2f')](db[_0x2e78('0x2b')]['rawAttributes']);_0x4a96e7[_0x2e78('0x30')]=_['keys'](_0x822b9a[_0x2e78('0x30')]);_0x4a96e7[_0x2e78('0x31')]=_[_0x2e78('0x33')](_0x4a96e7[_0x2e78('0x2e')],_0x4a96e7['query']);_0x23521f[_0x2e78('0x32')]=_[_0x2e78('0x33')](_0x4a96e7['model'],qs[_0x2e78('0x34')](_0x822b9a[_0x2e78('0x30')]['fields']));_0x23521f[_0x2e78('0x32')]=_0x23521f[_0x2e78('0x32')][_0x2e78('0x35')]?_0x23521f['attributes']:_0x4a96e7[_0x2e78('0x2e')];if(_0x822b9a['query'][_0x2e78('0x3f')]){_0x23521f[_0x2e78('0x40')]=[{'all':!![]}];}_0x23521f=_['merge']({},_0x23521f,_0x822b9a['options']);return db[_0x2e78('0x2b')][_0x2e78('0x44')](_0x23521f)[_0x2e78('0x25')](handleEntityNotFound(_0x34ff00,null))['then'](respondWithResult(_0x34ff00,null))[_0x2e78('0x42')](handleError(_0x34ff00,null));};exports['create']=function(_0x20cfe2,_0xdd97f5){return db[_0x2e78('0x2b')][_0x2e78('0x45')](_0x20cfe2['body'],{})[_0x2e78('0x25')](respondWithResult(_0xdd97f5,0xc9))[_0x2e78('0x42')](handleError(_0xdd97f5,null));};exports[_0x2e78('0x46')]=function(_0x3cd920,_0x386c93){if(_0x3cd920[_0x2e78('0x47')]['id']){delete _0x3cd920['body']['id'];}return db[_0x2e78('0x2b')][_0x2e78('0x44')]({'where':{'id':_0x3cd920[_0x2e78('0x43')]['id']}})['then'](handleEntityNotFound(_0x386c93,null))['then'](saveUpdates(_0x3cd920['body'],null))['then'](respondWithResult(_0x386c93,null))[_0x2e78('0x42')](handleError(_0x386c93,null));};exports[_0x2e78('0x24')]=function(_0x242a80,_0x8078ac){return db['MailSubstatus'][_0x2e78('0x44')]({'where':{'id':_0x242a80[_0x2e78('0x43')]['id']}})[_0x2e78('0x25')](handleEntityNotFound(_0x8078ac,null))[_0x2e78('0x25')](removeEntity(_0x8078ac,null))['catch'](handleError(_0x8078ac,null));};exports[_0x2e78('0x48')]=function(_0x7f2119,_0x4404c3){return db[_0x2e78('0x2b')][_0x2e78('0x48')]()['then'](respondWithResult(_0x4404c3,null))['catch'](handleError(_0x4404c3,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 742273f..b2b7d57 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 _0x1921=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1e40dc,_0x4134ec){var _0xf12c6=function(_0x1f68d9){while(--_0x1f68d9){_0x1e40dc['push'](_0x1e40dc['shift']());}};_0xf12c6(++_0x4134ec);}(_0x1921,0x1ef));var _0x1192=function(_0x22fa55,_0x377e76){_0x22fa55=_0x22fa55-0x0;var _0x45ef6e=_0x1921[_0x22fa55];return _0x45ef6e;};'use strict';var EventEmitter=require(_0x1192('0x0'));var MailSubstatus=require(_0x1192('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x1192('0x2')};function emitEvent(_0x1a9303){return function(_0x96225a,_0x3a442c,_0x486b0e){MailSubstatusEvents[_0x1192('0x3')](_0x1a9303+':'+_0x96225a['id'],_0x96225a);MailSubstatusEvents[_0x1192('0x3')](_0x1a9303,_0x96225a);_0x486b0e(null);};}for(var e in events){if(events[_0x1192('0x4')](e)){var event=events[e];MailSubstatus[_0x1192('0x5')](e,emitEvent(event));}}module[_0x1192('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x0966=['hook','events','MailSubstatus','update','emit'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0966,0xfb));var _0x6096=function(_0x435cb3,_0x231c83){_0x435cb3=_0x435cb3-0x0;var _0x596285=_0x0966[_0x435cb3];return _0x596285;};'use strict';var EventEmitter=require(_0x6096('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x6096('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x6096('0x2')};function emitEvent(_0x5c331c){return function(_0x22fad6,_0x413ec3,_0x456184){MailSubstatusEvents[_0x6096('0x3')](_0x5c331c+':'+_0x22fad6['id'],_0x22fad6);MailSubstatusEvents[_0x6096('0x3')](_0x5c331c,_0x22fad6);_0x456184(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x6096('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d5f90ea..8b57fd9 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 _0xf3ca=['catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues'];(function(_0x348681,_0x486a1d){var _0x30d4b7=function(_0x4b6cb1){while(--_0x4b6cb1){_0x348681['push'](_0x348681['shift']());}};_0x30d4b7(++_0x486a1d);}(_0xf3ca,0x97));var _0xaf3c=function(_0x230d4a,_0xd446be){_0x230d4a=_0x230d4a-0x0;var _0xa041e0=_0xf3ca[_0x230d4a];return _0xa041e0;};'use strict';var attributes=require(_0xaf3c('0x0'));module['exports']=function(_0x3232d0){var _0xdc04e1=_0x3232d0[_0xaf3c('0x1')];return _0x3232d0[_0xaf3c('0x2')](_0xaf3c('0x3'),attributes,{'tableName':_0xaf3c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1d17cd,_0x575ed6,_0xe6e551){return _0xdc04e1[_0xaf3c('0x5')]['update']({'value':_0x1d17cd[_0xaf3c('0x6')]},{'where':{'field':_0xaf3c('0x7'),'value':_0x1d17cd[_0xaf3c('0x8')]['name']}})['then'](function(){_0xe6e551();})[_0xaf3c('0x9')](function(_0x3e642b){_0xe6e551(_0x3e642b);});}}});}; \ No newline at end of file +var _0x266c=['update','name','mailSubstatus','_previousDataValues','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus'];(function(_0x173505,_0x3ded9d){var _0x4c2ca8=function(_0x961349){while(--_0x961349){_0x173505['push'](_0x173505['shift']());}};_0x4c2ca8(++_0x3ded9d);}(_0x266c,0xb9));var _0xc266=function(_0x4a165d,_0xc87cdd){_0x4a165d=_0x4a165d-0x0;var _0xe848a3=_0x266c[_0x4a165d];return _0xe848a3;};'use strict';var attributes=require(_0xc266('0x0'));module[_0xc266('0x1')]=function(_0x4ebd02){var _0x10afe8=_0x4ebd02[_0xc266('0x2')];return _0x4ebd02[_0xc266('0x3')](_0xc266('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2422cc,_0x279add,_0x44d7a0){return _0x10afe8['Condition'][_0xc266('0x5')]({'value':_0x2422cc[_0xc266('0x6')]},{'where':{'field':_0xc266('0x7'),'value':_0x2422cc[_0xc266('0x8')]['name']}})['then'](function(){_0x44d7a0();})[_0xc266('0x9')](function(_0x4a326f){_0x44d7a0(_0x4a326f);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1f9690f..13550a4 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 _0x29b8=['randomstring','rpc','../../config/environment','jayson/promise','client','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','lodash','util','bluebird'];(function(_0x46075c,_0x1befde){var _0x46147d=function(_0xdd64fc){while(--_0xdd64fc){_0x46075c['push'](_0x46075c['shift']());}};_0x46147d(++_0x1befde);}(_0x29b8,0x141));var _0x829b=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x29b8[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x829b('0x0'));var util=require(_0x829b('0x1'));var moment=require('moment');var BPromise=require(_0x829b('0x2'));var rs=require(_0x829b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x829b('0x4'));var config=require(_0x829b('0x5'));var jayson=require(_0x829b('0x6'));var client=jayson[_0x829b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229493,_0x198861,_0x28c728){return new BPromise(function(_0x5978ce,_0x3f0db1){return client[_0x829b('0x8')](_0x229493,_0x28c728)[_0x829b('0x9')](function(_0x1cabe9){logger['info'](_0x829b('0xa'),_0x198861,_0x829b('0xb'));logger[_0x829b('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x198861,'request\x20sent',JSON[_0x829b('0xd')](_0x1cabe9));if(_0x1cabe9['error']){if(_0x1cabe9[_0x829b('0xe')]['code']===0x1f4){logger[_0x829b('0xe')](_0x829b('0xa'),_0x198861,_0x1cabe9[_0x829b('0xe')][_0x829b('0xf')]);return _0x3f0db1(_0x1cabe9[_0x829b('0xe')]['message']);}logger[_0x829b('0xe')](_0x829b('0xa'),_0x198861,_0x1cabe9[_0x829b('0xe')][_0x829b('0xf')]);return _0x5978ce(_0x1cabe9[_0x829b('0xe')]['message']);}else{logger[_0x829b('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x198861,_0x829b('0xb'));_0x5978ce(_0x1cabe9['result'][_0x829b('0xf')]);}})[_0x829b('0x11')](function(_0xe0b9e){logger[_0x829b('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x198861,_0xe0b9e);_0x3f0db1(_0xe0b9e);});});} \ No newline at end of file +var _0x531f=['stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x5362bf,_0x3e7624){var _0xf8630a=function(_0x265c47){while(--_0x265c47){_0x5362bf['push'](_0x5362bf['shift']());}};_0xf8630a(++_0x3e7624);}(_0x531f,0x84));var _0xf531=function(_0x9b01d9,_0x4802b0){_0x9b01d9=_0x9b01d9-0x0;var _0x401588=_0x531f[_0x9b01d9];return _0x401588;};'use strict';var _=require('lodash');var util=require(_0xf531('0x0'));var moment=require(_0xf531('0x1'));var BPromise=require(_0xf531('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf531('0x3'))['db'];var utils=require(_0xf531('0x4'));var logger=require(_0xf531('0x5'))(_0xf531('0x6'));var config=require(_0xf531('0x7'));var jayson=require(_0xf531('0x8'));var client=jayson[_0xf531('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d466,_0x1c9ed2,_0x598ae8){return new BPromise(function(_0xcdea16,_0xf7eb39){return client[_0xf531('0xa')](_0x38d466,_0x598ae8)[_0xf531('0xb')](function(_0xa19529){logger[_0xf531('0xc')](_0xf531('0xd'),_0x1c9ed2,_0xf531('0xe'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1c9ed2,_0xf531('0xe'),JSON[_0xf531('0xf')](_0xa19529));if(_0xa19529[_0xf531('0x10')]){if(_0xa19529[_0xf531('0x10')][_0xf531('0x11')]===0x1f4){logger[_0xf531('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x1c9ed2,_0xa19529[_0xf531('0x10')][_0xf531('0x12')]);return _0xf7eb39(_0xa19529['error'][_0xf531('0x12')]);}logger[_0xf531('0x10')](_0xf531('0xd'),_0x1c9ed2,_0xa19529[_0xf531('0x10')][_0xf531('0x12')]);return _0xcdea16(_0xa19529[_0xf531('0x10')][_0xf531('0x12')]);}else{logger[_0xf531('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x1c9ed2,_0xf531('0xe'));_0xcdea16(_0xa19529[_0xf531('0x13')][_0xf531('0x12')]);}})[_0xf531('0x14')](function(_0x59af2d){logger[_0xf531('0x10')](_0xf531('0xd'),_0x1c9ed2,_0x59af2d);_0xf7eb39(_0x59af2d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5f43fec..8f7b2fd 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 _0x10b0=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x10b0,0x11f));var _0x010b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x10b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x010b('0x0'));var util=require(_0x010b('0x1'));var path=require(_0x010b('0x2'));var timeout=require('connect-timeout');var express=require(_0x010b('0x3'));var router=express[_0x010b('0x4')]();var fs_extra=require(_0x010b('0x5'));var auth=require(_0x010b('0x6'));var interaction=require(_0x010b('0x7'));var config=require(_0x010b('0x8'));var controller=require(_0x010b('0x9'));router[_0x010b('0xa')]('/',auth[_0x010b('0xb')](),controller[_0x010b('0xc')]);router[_0x010b('0xa')](_0x010b('0xd'),auth[_0x010b('0xb')](),controller[_0x010b('0xe')]);router[_0x010b('0xa')](_0x010b('0xf'),auth[_0x010b('0xb')](),controller[_0x010b('0x10')]);router[_0x010b('0x11')]('/',auth[_0x010b('0xb')](),controller[_0x010b('0x12')]);router['put'](_0x010b('0xf'),auth[_0x010b('0xb')](),controller['update']);router[_0x010b('0x13')](_0x010b('0xf'),auth[_0x010b('0xb')](),controller[_0x010b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x904e=['/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x18f65c,_0x41d9d1){var _0x22e5c3=function(_0x16da50){while(--_0x16da50){_0x18f65c['push'](_0x18f65c['shift']());}};_0x22e5c3(++_0x41d9d1);}(_0x904e,0x1b9));var _0xe904=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x904e[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xe904('0x0'));var util=require(_0xe904('0x1'));var path=require(_0xe904('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe904('0x3'));var config=require('../../config/environment');var controller=require(_0xe904('0x4'));router[_0xe904('0x5')]('/',auth[_0xe904('0x6')](),controller['index']);router[_0xe904('0x5')](_0xe904('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xe904('0x5')](_0xe904('0x8'),auth[_0xe904('0x6')](),controller[_0xe904('0x9')]);router[_0xe904('0xa')]('/',auth[_0xe904('0x6')](),controller[_0xe904('0xb')]);router['put'](_0xe904('0x8'),auth[_0xe904('0x6')](),controller[_0xe904('0xc')]);router[_0xe904('0xd')]('/:id',auth[_0xe904('0x6')](),controller[_0xe904('0xe')]);module[_0xe904('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index daffa83..c076224 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3d7933,_0xf5309e){var _0x3777ad=function(_0x40a84a){while(--_0x40a84a){_0x3d7933['push'](_0x3d7933['shift']());}};_0x3777ad(++_0xf5309e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xcb91[_0x5280f4];return _0xba93e7;};'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 +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x54ef,0x112));var _0xf54e=function(_0x5dcdd7,_0x8200b8){_0x5dcdd7=_0x5dcdd7-0x0;var _0x1099ea=_0x54ef[_0x5dcdd7];return _0x1099ea;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6b0a3bc..9c2d9c1 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 _0xd303=['type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','MailTransferReport'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xd303,0x138));var _0x3d30=function(_0x42074b,_0x2e5546){_0x42074b=_0x42074b-0x0;var _0x284f1c=_0xd303[_0x42074b];return _0x284f1c;};'use strict';var emlformat=require(_0x3d30('0x0'));var rimraf=require(_0x3d30('0x1'));var zipdir=require(_0x3d30('0x2'));var jsonpatch=require(_0x3d30('0x3'));var rp=require(_0x3d30('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d30('0x5'));var util=require(_0x3d30('0x6'));var path=require(_0x3d30('0x7'));var sox=require(_0x3d30('0x8'));var csv=require('to-csv');var ejs=require(_0x3d30('0x9'));var fs=require('fs');var fs_extra=require(_0x3d30('0xa'));var _=require(_0x3d30('0xb'));var squel=require('squel');var crypto=require(_0x3d30('0xc'));var jsforce=require(_0x3d30('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3d30('0xe'));var querystring=require('querystring');var Papa=require(_0x3d30('0xf'));var Redis=require(_0x3d30('0x10'));var authService=require(_0x3d30('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d30('0x12'));var logger=require(_0x3d30('0x13'))(_0x3d30('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3d30('0x15'));var db=require(_0x3d30('0x16'))['db'];function respondWithStatusCode(_0x29f03b,_0x20a2ec){_0x20a2ec=_0x20a2ec||0xcc;return function(_0x4ceb15){if(_0x4ceb15){return _0x29f03b[_0x3d30('0x17')](_0x20a2ec);}return _0x29f03b[_0x3d30('0x18')](_0x20a2ec)[_0x3d30('0x19')]();};}function respondWithResult(_0x5e050a,_0x29331d){_0x29331d=_0x29331d||0xc8;return function(_0x30a27f){if(_0x30a27f){return _0x5e050a[_0x3d30('0x18')](_0x29331d)['json'](_0x30a27f);}};}function respondWithFilteredResult(_0x253727,_0x47b38c){return function(_0x54cec4){if(_0x54cec4){var _0x329ab2=typeof _0x47b38c['offset']==='undefined'&&typeof _0x47b38c[_0x3d30('0x1a')]===_0x3d30('0x1b');var _0x18a813=_0x54cec4[_0x3d30('0x1c')];var _0x4bf7ec=_0x329ab2?0x0:_0x47b38c[_0x3d30('0x1d')];var _0x24b324=_0x329ab2?_0x54cec4['count']:_0x47b38c[_0x3d30('0x1d')]+_0x47b38c['limit'];var _0x29d3c6;if(_0x24b324>=_0x18a813){_0x24b324=_0x18a813;_0x29d3c6=0xc8;}else{_0x29d3c6=0xce;}_0x253727[_0x3d30('0x18')](_0x29d3c6);return _0x253727[_0x3d30('0x1e')](_0x3d30('0x1f'),_0x4bf7ec+'-'+_0x24b324+'/'+_0x18a813)[_0x3d30('0x20')](_0x54cec4);}return null;};}function patchUpdates(_0x2c50e7){return function(_0x372086){try{jsonpatch[_0x3d30('0x21')](_0x372086,_0x2c50e7,!![]);}catch(_0x1348c8){return BPromise[_0x3d30('0x22')](_0x1348c8);}return _0x372086[_0x3d30('0x23')]();};}function saveUpdates(_0x31fe77,_0x26a4bf){return function(_0xabc80d){if(_0xabc80d){return _0xabc80d[_0x3d30('0x24')](_0x31fe77)['then'](function(_0x1cd3dd){return _0x1cd3dd;});}return null;};}function removeEntity(_0x40b12e,_0xd6b164){return function(_0x17b3c3){if(_0x17b3c3){return _0x17b3c3[_0x3d30('0x25')]()[_0x3d30('0x26')](function(){_0x40b12e[_0x3d30('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5446,_0x44a0d6){return function(_0x28d274){if(!_0x28d274){_0x3a5446[_0x3d30('0x17')](0x194);}return _0x28d274;};}function handleError(_0x3e193d,_0x7f2f4){_0x7f2f4=_0x7f2f4||0x1f4;return function(_0x402e36){logger[_0x3d30('0x27')](_0x402e36['stack']);if(_0x402e36['name']){delete _0x402e36[_0x3d30('0x28')];}_0x3e193d[_0x3d30('0x18')](_0x7f2f4)[_0x3d30('0x29')](_0x402e36);};}exports['index']=function(_0x4e82ac,_0x38b8f6){var _0x58d6ba={},_0x34bdd5={},_0xa97019={'count':0x0,'rows':[]};var _0x3762b7=_['map'](db[_0x3d30('0x2a')]['rawAttributes'],function(_0x5b28e1){return{'name':_0x5b28e1['fieldName'],'type':_0x5b28e1[_0x3d30('0x2b')]['key']};});_0x34bdd5['model']=_['map'](_0x3762b7,'name');_0x34bdd5[_0x3d30('0x2c')]=_[_0x3d30('0x2d')](_0x4e82ac[_0x3d30('0x2c')]);_0x34bdd5['filters']=_[_0x3d30('0x2e')](_0x34bdd5[_0x3d30('0x2f')],_0x34bdd5[_0x3d30('0x2c')]);_0x58d6ba[_0x3d30('0x30')]=_[_0x3d30('0x2e')](_0x34bdd5[_0x3d30('0x2f')],qs[_0x3d30('0x31')](_0x4e82ac[_0x3d30('0x2c')][_0x3d30('0x31')]));_0x58d6ba[_0x3d30('0x30')]=_0x58d6ba['attributes']['length']?_0x58d6ba[_0x3d30('0x30')]:_0x34bdd5['model'];if(!_0x4e82ac[_0x3d30('0x2c')][_0x3d30('0x32')](_0x3d30('0x33'))){_0x58d6ba[_0x3d30('0x1a')]=qs[_0x3d30('0x1a')](_0x4e82ac['query'][_0x3d30('0x1a')]);_0x58d6ba['offset']=qs[_0x3d30('0x1d')](_0x4e82ac[_0x3d30('0x2c')][_0x3d30('0x1d')]);}_0x58d6ba[_0x3d30('0x34')]=qs[_0x3d30('0x35')](_0x4e82ac['query'][_0x3d30('0x35')]);_0x58d6ba['where']=qs[_0x3d30('0x36')](_[_0x3d30('0x37')](_0x4e82ac[_0x3d30('0x2c')],_0x34bdd5[_0x3d30('0x36')]),_0x3762b7);if(_0x4e82ac[_0x3d30('0x2c')][_0x3d30('0x38')]){_0x58d6ba[_0x3d30('0x39')]=_[_0x3d30('0x3a')](_0x58d6ba[_0x3d30('0x39')],{'$or':_['map'](_0x3762b7,function(_0x1c687a){if(_0x1c687a[_0x3d30('0x2b')]!==_0x3d30('0x3b')){var _0x46e9ef={};_0x46e9ef[_0x1c687a['name']]={'$like':'%'+_0x4e82ac[_0x3d30('0x2c')][_0x3d30('0x38')]+'%'};return _0x46e9ef;}})});}_0x58d6ba=_['merge']({},_0x58d6ba,_0x4e82ac[_0x3d30('0x3c')]);var _0x228a9a={'where':_0x58d6ba[_0x3d30('0x39')]};return db[_0x3d30('0x2a')][_0x3d30('0x1c')](_0x228a9a)[_0x3d30('0x26')](function(_0x62eb59){_0xa97019[_0x3d30('0x1c')]=_0x62eb59;if(_0x4e82ac[_0x3d30('0x2c')][_0x3d30('0x3d')]){_0x58d6ba[_0x3d30('0x3e')]=[{'all':!![]}];}return db[_0x3d30('0x2a')][_0x3d30('0x3f')](_0x58d6ba);})[_0x3d30('0x26')](function(_0x3449f7){_0xa97019[_0x3d30('0x40')]=_0x3449f7;return _0xa97019;})['then'](respondWithFilteredResult(_0x38b8f6,_0x58d6ba))[_0x3d30('0x41')](handleError(_0x38b8f6,null));};exports['show']=function(_0x1f4403,_0x2d7d81){var _0x5b7056={'raw':!![],'where':{'id':_0x1f4403[_0x3d30('0x42')]['id']}},_0x26ec75={};_0x26ec75[_0x3d30('0x2f')]=_[_0x3d30('0x2d')](db[_0x3d30('0x2a')][_0x3d30('0x43')]);_0x26ec75[_0x3d30('0x2c')]=_['keys'](_0x1f4403[_0x3d30('0x2c')]);_0x26ec75[_0x3d30('0x36')]=_['intersection'](_0x26ec75[_0x3d30('0x2f')],_0x26ec75[_0x3d30('0x2c')]);_0x5b7056[_0x3d30('0x30')]=_[_0x3d30('0x2e')](_0x26ec75[_0x3d30('0x2f')],qs[_0x3d30('0x31')](_0x1f4403[_0x3d30('0x2c')]['fields']));_0x5b7056['attributes']=_0x5b7056[_0x3d30('0x30')]['length']?_0x5b7056[_0x3d30('0x30')]:_0x26ec75[_0x3d30('0x2f')];if(_0x1f4403[_0x3d30('0x2c')][_0x3d30('0x3d')]){_0x5b7056[_0x3d30('0x3e')]=[{'all':!![]}];}_0x5b7056=_[_0x3d30('0x3a')]({},_0x5b7056,_0x1f4403['options']);return db['MailTransferReport'][_0x3d30('0x44')](_0x5b7056)['then'](handleEntityNotFound(_0x2d7d81,null))[_0x3d30('0x26')](respondWithResult(_0x2d7d81,null))[_0x3d30('0x41')](handleError(_0x2d7d81,null));};exports['create']=function(_0x512646,_0x46de33){return db['MailTransferReport']['create'](_0x512646['body'],{})[_0x3d30('0x26')](respondWithResult(_0x46de33,0xc9))[_0x3d30('0x41')](handleError(_0x46de33,null));};exports[_0x3d30('0x24')]=function(_0x5c3738,_0x1e6699){if(_0x5c3738[_0x3d30('0x45')]['id']){delete _0x5c3738[_0x3d30('0x45')]['id'];}return db['MailTransferReport'][_0x3d30('0x44')]({'where':{'id':_0x5c3738['params']['id']}})['then'](handleEntityNotFound(_0x1e6699,null))[_0x3d30('0x26')](saveUpdates(_0x5c3738[_0x3d30('0x45')],null))[_0x3d30('0x26')](respondWithResult(_0x1e6699,null))[_0x3d30('0x41')](handleError(_0x1e6699,null));};exports['destroy']=function(_0x4e260f,_0x29958c){return db[_0x3d30('0x2a')][_0x3d30('0x44')]({'where':{'id':_0x4e260f['params']['id']}})['then'](handleEntityNotFound(_0x29958c,null))[_0x3d30('0x26')](removeEntity(_0x29958c,null))['catch'](handleError(_0x29958c,null));};exports['describe']=function(_0x12a55c,_0x481c19){return db[_0x3d30('0x2a')][_0x3d30('0x46')]()[_0x3d30('0x26')](respondWithResult(_0x481c19,null))[_0x3d30('0x41')](handleError(_0x481c19,null));}; \ No newline at end of file +var _0x2ad0=['fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','MailTransferReport','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x375efe,_0x27df2d){var _0x1d5db6=function(_0x43e15d){while(--_0x43e15d){_0x375efe['push'](_0x375efe['shift']());}};_0x1d5db6(++_0x27df2d);}(_0x2ad0,0xa7));var _0x02ad=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x2ad0[_0x188703];return _0x1a0c81;};'use strict';var emlformat=require(_0x02ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x02ad('0x1'));var jsonpatch=require(_0x02ad('0x2'));var rp=require(_0x02ad('0x3'));var moment=require('moment');var BPromise=require(_0x02ad('0x4'));var Mustache=require(_0x02ad('0x5'));var util=require(_0x02ad('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x02ad('0x7'));var ejs=require(_0x02ad('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02ad('0x9'));var squel=require(_0x02ad('0xa'));var crypto=require(_0x02ad('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x02ad('0xc'));var Papa=require(_0x02ad('0xd'));var Redis=require(_0x02ad('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x02ad('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02ad('0x10'));var logger=require(_0x02ad('0x11'))(_0x02ad('0x12'));var utils=require(_0x02ad('0x13'));var config=require(_0x02ad('0x14'));var licenseUtil=require(_0x02ad('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c7574,_0x542511){_0x542511=_0x542511||0xcc;return function(_0x1b480a){if(_0x1b480a){return _0x1c7574['sendStatus'](_0x542511);}return _0x1c7574['status'](_0x542511)['end']();};}function respondWithResult(_0x762d1f,_0x24a024){_0x24a024=_0x24a024||0xc8;return function(_0x2a7649){if(_0x2a7649){return _0x762d1f[_0x02ad('0x16')](_0x24a024)['json'](_0x2a7649);}};}function respondWithFilteredResult(_0x34ec80,_0x3e33db){return function(_0x40b179){if(_0x40b179){var _0xcac2f9=typeof _0x3e33db[_0x02ad('0x17')]===_0x02ad('0x18')&&typeof _0x3e33db[_0x02ad('0x19')]==='undefined';var _0x15ad19=_0x40b179[_0x02ad('0x1a')];var _0xcbbf38=_0xcac2f9?0x0:_0x3e33db[_0x02ad('0x17')];var _0x846c58=_0xcac2f9?_0x40b179[_0x02ad('0x1a')]:_0x3e33db['offset']+_0x3e33db['limit'];var _0x108483;if(_0x846c58>=_0x15ad19){_0x846c58=_0x15ad19;_0x108483=0xc8;}else{_0x108483=0xce;}_0x34ec80[_0x02ad('0x16')](_0x108483);return _0x34ec80['set'](_0x02ad('0x1b'),_0xcbbf38+'-'+_0x846c58+'/'+_0x15ad19)[_0x02ad('0x1c')](_0x40b179);}return null;};}function patchUpdates(_0x50a4ce){return function(_0x120a10){try{jsonpatch[_0x02ad('0x1d')](_0x120a10,_0x50a4ce,!![]);}catch(_0x53cae5){return BPromise[_0x02ad('0x1e')](_0x53cae5);}return _0x120a10[_0x02ad('0x1f')]();};}function saveUpdates(_0x3ee9f,_0x4e33cd){return function(_0x43e66a){if(_0x43e66a){return _0x43e66a[_0x02ad('0x20')](_0x3ee9f)[_0x02ad('0x21')](function(_0x220c79){return _0x220c79;});}return null;};}function removeEntity(_0x26e03c,_0xe4940b){return function(_0x5002d4){if(_0x5002d4){return _0x5002d4[_0x02ad('0x22')]()[_0x02ad('0x21')](function(){_0x26e03c['status'](0xcc)[_0x02ad('0x23')]();});}};}function handleEntityNotFound(_0x3dfebb,_0x561018){return function(_0x37451b){if(!_0x37451b){_0x3dfebb['sendStatus'](0x194);}return _0x37451b;};}function handleError(_0x3830d6,_0x31a579){_0x31a579=_0x31a579||0x1f4;return function(_0x395db2){logger[_0x02ad('0x24')](_0x395db2[_0x02ad('0x25')]);if(_0x395db2[_0x02ad('0x26')]){delete _0x395db2['name'];}_0x3830d6['status'](_0x31a579)[_0x02ad('0x27')](_0x395db2);};}exports[_0x02ad('0x28')]=function(_0x48974c,_0x2bc853){var _0x2fa6b4={},_0x226627={},_0x3cd94a={'count':0x0,'rows':[]};var _0x1af006=_[_0x02ad('0x29')](db['MailTransferReport'][_0x02ad('0x2a')],function(_0x3ca455){return{'name':_0x3ca455[_0x02ad('0x2b')],'type':_0x3ca455[_0x02ad('0x2c')][_0x02ad('0x2d')]};});_0x226627['model']=_[_0x02ad('0x29')](_0x1af006,_0x02ad('0x26'));_0x226627[_0x02ad('0x2e')]=_[_0x02ad('0x2f')](_0x48974c['query']);_0x226627[_0x02ad('0x30')]=_[_0x02ad('0x31')](_0x226627[_0x02ad('0x32')],_0x226627['query']);_0x2fa6b4[_0x02ad('0x33')]=_['intersection'](_0x226627[_0x02ad('0x32')],qs[_0x02ad('0x34')](_0x48974c[_0x02ad('0x2e')]['fields']));_0x2fa6b4[_0x02ad('0x33')]=_0x2fa6b4['attributes'][_0x02ad('0x35')]?_0x2fa6b4[_0x02ad('0x33')]:_0x226627['model'];if(!_0x48974c[_0x02ad('0x2e')]['hasOwnProperty'](_0x02ad('0x36'))){_0x2fa6b4[_0x02ad('0x19')]=qs['limit'](_0x48974c['query']['limit']);_0x2fa6b4[_0x02ad('0x17')]=qs[_0x02ad('0x17')](_0x48974c[_0x02ad('0x2e')][_0x02ad('0x17')]);}_0x2fa6b4[_0x02ad('0x37')]=qs[_0x02ad('0x38')](_0x48974c[_0x02ad('0x2e')]['sort']);_0x2fa6b4[_0x02ad('0x39')]=qs[_0x02ad('0x30')](_[_0x02ad('0x3a')](_0x48974c['query'],_0x226627['filters']),_0x1af006);if(_0x48974c['query'][_0x02ad('0x3b')]){_0x2fa6b4['where']=_['merge'](_0x2fa6b4[_0x02ad('0x39')],{'$or':_['map'](_0x1af006,function(_0x410999){if(_0x410999[_0x02ad('0x2c')]!==_0x02ad('0x3c')){var _0xc4d81d={};_0xc4d81d[_0x410999[_0x02ad('0x26')]]={'$like':'%'+_0x48974c['query']['filter']+'%'};return _0xc4d81d;}})});}_0x2fa6b4=_[_0x02ad('0x3d')]({},_0x2fa6b4,_0x48974c['options']);var _0x384ceb={'where':_0x2fa6b4[_0x02ad('0x39')]};return db[_0x02ad('0x3e')][_0x02ad('0x1a')](_0x384ceb)['then'](function(_0x3dd065){_0x3cd94a[_0x02ad('0x1a')]=_0x3dd065;if(_0x48974c[_0x02ad('0x2e')]['includeAll']){_0x2fa6b4[_0x02ad('0x3f')]=[{'all':!![]}];}return db[_0x02ad('0x3e')]['findAll'](_0x2fa6b4);})[_0x02ad('0x21')](function(_0x1a3ff5){_0x3cd94a[_0x02ad('0x40')]=_0x1a3ff5;return _0x3cd94a;})[_0x02ad('0x21')](respondWithFilteredResult(_0x2bc853,_0x2fa6b4))[_0x02ad('0x41')](handleError(_0x2bc853,null));};exports[_0x02ad('0x42')]=function(_0x25c36f,_0x53be57){var _0x1b472c={'raw':!![],'where':{'id':_0x25c36f[_0x02ad('0x43')]['id']}},_0x56c98b={};_0x56c98b[_0x02ad('0x32')]=_[_0x02ad('0x2f')](db[_0x02ad('0x3e')]['rawAttributes']);_0x56c98b[_0x02ad('0x2e')]=_[_0x02ad('0x2f')](_0x25c36f[_0x02ad('0x2e')]);_0x56c98b['filters']=_[_0x02ad('0x31')](_0x56c98b['model'],_0x56c98b[_0x02ad('0x2e')]);_0x1b472c[_0x02ad('0x33')]=_[_0x02ad('0x31')](_0x56c98b[_0x02ad('0x32')],qs[_0x02ad('0x34')](_0x25c36f['query'][_0x02ad('0x34')]));_0x1b472c[_0x02ad('0x33')]=_0x1b472c[_0x02ad('0x33')][_0x02ad('0x35')]?_0x1b472c[_0x02ad('0x33')]:_0x56c98b[_0x02ad('0x32')];if(_0x25c36f['query'][_0x02ad('0x44')]){_0x1b472c['include']=[{'all':!![]}];}_0x1b472c=_[_0x02ad('0x3d')]({},_0x1b472c,_0x25c36f['options']);return db['MailTransferReport'][_0x02ad('0x45')](_0x1b472c)[_0x02ad('0x21')](handleEntityNotFound(_0x53be57,null))[_0x02ad('0x21')](respondWithResult(_0x53be57,null))[_0x02ad('0x41')](handleError(_0x53be57,null));};exports[_0x02ad('0x46')]=function(_0x3b746,_0x55af5c){return db['MailTransferReport'][_0x02ad('0x46')](_0x3b746[_0x02ad('0x47')],{})[_0x02ad('0x21')](respondWithResult(_0x55af5c,0xc9))[_0x02ad('0x41')](handleError(_0x55af5c,null));};exports[_0x02ad('0x20')]=function(_0x2dd7c4,_0x2aa3b1){if(_0x2dd7c4[_0x02ad('0x47')]['id']){delete _0x2dd7c4[_0x02ad('0x47')]['id'];}return db[_0x02ad('0x3e')][_0x02ad('0x45')]({'where':{'id':_0x2dd7c4[_0x02ad('0x43')]['id']}})[_0x02ad('0x21')](handleEntityNotFound(_0x2aa3b1,null))[_0x02ad('0x21')](saveUpdates(_0x2dd7c4['body'],null))['then'](respondWithResult(_0x2aa3b1,null))['catch'](handleError(_0x2aa3b1,null));};exports['destroy']=function(_0x21f01c,_0x3286e7){return db[_0x02ad('0x3e')]['find']({'where':{'id':_0x21f01c['params']['id']}})[_0x02ad('0x21')](handleEntityNotFound(_0x3286e7,null))[_0x02ad('0x21')](removeEntity(_0x3286e7,null))[_0x02ad('0x41')](handleError(_0x3286e7,null));};exports['describe']=function(_0x43e981,_0x5cb52e){return db[_0x02ad('0x3e')][_0x02ad('0x48')]()['then'](respondWithResult(_0x5cb52e,null))[_0x02ad('0x41')](handleError(_0x5cb52e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 252daab..714972d 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 _0x5a93=['define','MailTransferReport','report_mail_transfer','uniqueid','util','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a93,0xf6));var _0x35a9=function(_0x209955,_0x50e4f){_0x209955=_0x209955-0x0;var _0x4a9620=_0x5a93[_0x209955];return _0x4a9620;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var logger=require('../../config/logger')(_0x35a9('0x1'));var moment=require(_0x35a9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a9('0x3'));var rimraf=require(_0x35a9('0x4'));var config=require(_0x35a9('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0x35a9('0x6')]=function(_0x27ed9f,_0x2e8a14){return _0x27ed9f[_0x35a9('0x7')](_0x35a9('0x8'),attributes,{'tableName':_0x35a9('0x9'),'paranoid':![],'indexes':[{'name':_0x35a9('0xa'),'fields':[_0x35a9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe181=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x52eb5e,_0x3c0402){var _0x13823d=function(_0x524b1c){while(--_0x524b1c){_0x52eb5e['push'](_0x52eb5e['shift']());}};_0x13823d(++_0x3c0402);}(_0xe181,0x68));var _0x1e18=function(_0x54b677,_0x21ee34){_0x54b677=_0x54b677-0x0;var _0x27eb0e=_0xe181[_0x54b677];return _0x27eb0e;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var logger=require(_0x1e18('0x1'))(_0x1e18('0x2'));var moment=require(_0x1e18('0x3'));var BPromise=require(_0x1e18('0x4'));var rp=require(_0x1e18('0x5'));var fs=require('fs');var path=require(_0x1e18('0x6'));var rimraf=require(_0x1e18('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e18('0x8'));module['exports']=function(_0x512343,_0x18fabb){return _0x512343[_0x1e18('0x9')](_0x1e18('0xa'),attributes,{'tableName':_0x1e18('0xb'),'paranoid':![],'indexes':[{'name':_0x1e18('0xc'),'fields':[_0x1e18('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index cb4dd18..e74ecb5 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 _0xe8ab=['code','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x457549,_0x3e0f46){var _0x3c1d6f=function(_0xa15abe){while(--_0xa15abe){_0x457549['push'](_0x457549['shift']());}};_0x3c1d6f(++_0x3e0f46);}(_0xe8ab,0x1e8));var _0xbe8a=function(_0x360812,_0x4a004f){_0x360812=_0x360812-0x0;var _0x16b385=_0xe8ab[_0x360812];return _0x16b385;};'use strict';var _=require(_0xbe8a('0x0'));var util=require(_0xbe8a('0x1'));var moment=require(_0xbe8a('0x2'));var BPromise=require(_0xbe8a('0x3'));var rs=require(_0xbe8a('0x4'));var fs=require('fs');var Redis=require(_0xbe8a('0x5'));var db=require(_0xbe8a('0x6'))['db'];var utils=require(_0xbe8a('0x7'));var logger=require(_0xbe8a('0x8'))('rpc');var config=require(_0xbe8a('0x9'));var jayson=require(_0xbe8a('0xa'));var client=jayson['client'][_0xbe8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24b97c,_0x1cdff9,_0x37c96d){return new BPromise(function(_0x3d4cee,_0x217039){return client[_0xbe8a('0xc')](_0x24b97c,_0x37c96d)['then'](function(_0x12723e){logger[_0xbe8a('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x1cdff9,'request\x20sent');logger[_0xbe8a('0xe')](_0xbe8a('0xf'),_0x1cdff9,_0xbe8a('0x10'),JSON['stringify'](_0x12723e));if(_0x12723e[_0xbe8a('0x11')]){if(_0x12723e[_0xbe8a('0x11')][_0xbe8a('0x12')]===0x1f4){logger[_0xbe8a('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x1cdff9,_0x12723e[_0xbe8a('0x11')][_0xbe8a('0x13')]);return _0x217039(_0x12723e[_0xbe8a('0x11')]['message']);}logger[_0xbe8a('0x11')](_0xbe8a('0x14'),_0x1cdff9,_0x12723e['error'][_0xbe8a('0x13')]);return _0x3d4cee(_0x12723e['error'][_0xbe8a('0x13')]);}else{logger[_0xbe8a('0xd')](_0xbe8a('0x14'),_0x1cdff9,'request\x20sent');_0x3d4cee(_0x12723e[_0xbe8a('0x15')][_0xbe8a('0x13')]);}})[_0xbe8a('0x16')](function(_0x1e7d0e){logger[_0xbe8a('0x11')](_0xbe8a('0x14'),_0x1cdff9,_0x1e7d0e);_0x217039(_0x1e7d0e);});});} \ No newline at end of file +var _0x23ae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x456ba5,_0x4403df){var _0x2d9300=function(_0x354129){while(--_0x354129){_0x456ba5['push'](_0x456ba5['shift']());}};_0x2d9300(++_0x4403df);}(_0x23ae,0x1de));var _0xe23a=function(_0x3eb017,_0x145f85){_0x3eb017=_0x3eb017-0x0;var _0x54f041=_0x23ae[_0x3eb017];return _0x54f041;};'use strict';var _=require('lodash');var util=require(_0xe23a('0x0'));var moment=require(_0xe23a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe23a('0x2'));var db=require(_0xe23a('0x3'))['db'];var utils=require(_0xe23a('0x4'));var logger=require(_0xe23a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe23a('0x6'));var client=jayson[_0xe23a('0x7')][_0xe23a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f1733,_0x52de11,_0xf6b150){return new BPromise(function(_0x5a0a60,_0xed52f8){return client['request'](_0x3f1733,_0xf6b150)[_0xe23a('0x9')](function(_0xe65914){logger[_0xe23a('0xa')](_0xe23a('0xb'),_0x52de11,_0xe23a('0xc'));logger[_0xe23a('0xd')](_0xe23a('0xe'),_0x52de11,_0xe23a('0xc'),JSON[_0xe23a('0xf')](_0xe65914));if(_0xe65914[_0xe23a('0x10')]){if(_0xe65914[_0xe23a('0x10')][_0xe23a('0x11')]===0x1f4){logger[_0xe23a('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x52de11,_0xe65914[_0xe23a('0x10')][_0xe23a('0x12')]);return _0xed52f8(_0xe65914['error'][_0xe23a('0x12')]);}logger[_0xe23a('0x10')](_0xe23a('0xb'),_0x52de11,_0xe65914[_0xe23a('0x10')][_0xe23a('0x12')]);return _0x5a0a60(_0xe65914['error']['message']);}else{logger[_0xe23a('0xa')](_0xe23a('0xb'),_0x52de11,_0xe23a('0xc'));_0x5a0a60(_0xe65914[_0xe23a('0x13')]['message']);}})['catch'](function(_0x16305e){logger[_0xe23a('0x10')](_0xe23a('0xb'),_0x52de11,_0x16305e);_0xed52f8(_0x16305e);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a9e7df7..aec0058 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 _0x64e3=['create','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','/:id','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64e3,0x15b));var _0x364e=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0x64e3[_0x24875d];return _0x181471;};'use strict';var multer=require(_0x364e('0x0'));var util=require(_0x364e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x364e('0x2')]();var fs_extra=require(_0x364e('0x3'));var auth=require(_0x364e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x364e('0x5'));var controller=require(_0x364e('0x6'));router[_0x364e('0x7')]('/',auth['isAuthenticated'](),controller[_0x364e('0x8')]);router['get'](_0x364e('0x9'),auth[_0x364e('0xa')](),controller['describe']);router[_0x364e('0x7')](_0x364e('0xb'),auth[_0x364e('0xa')](),controller['show']);router[_0x364e('0xc')]('/',auth[_0x364e('0xa')](),controller[_0x364e('0xd')]);router[_0x364e('0xe')](_0x364e('0xb'),auth['isAuthenticated'](),controller[_0x364e('0xf')]);router[_0x364e('0x10')](_0x364e('0xb'),auth[_0x364e('0xa')](),controller[_0x364e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9814=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x298884,_0x379013){var _0x27b00b=function(_0x48c073){while(--_0x48c073){_0x298884['push'](_0x298884['shift']());}};_0x27b00b(++_0x379013);}(_0x9814,0x1f2));var _0x4981=function(_0xbff76f,_0x5a53c4){_0xbff76f=_0xbff76f-0x0;var _0x5eb933=_0x9814[_0xbff76f];return _0x5eb933;};'use strict';var multer=require(_0x4981('0x0'));var util=require(_0x4981('0x1'));var path=require(_0x4981('0x2'));var timeout=require('connect-timeout');var express=require(_0x4981('0x3'));var router=express[_0x4981('0x4')]();var fs_extra=require(_0x4981('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4981('0x6'));var config=require(_0x4981('0x7'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x4981('0x8')](),controller[_0x4981('0x9')]);router[_0x4981('0xa')](_0x4981('0xb'),auth[_0x4981('0x8')](),controller[_0x4981('0xc')]);router[_0x4981('0xa')](_0x4981('0xd'),auth[_0x4981('0x8')](),controller['show']);router[_0x4981('0xe')]('/',auth[_0x4981('0x8')](),controller[_0x4981('0xf')]);router[_0x4981('0x10')]('/:id',auth[_0x4981('0x8')](),controller[_0x4981('0x11')]);router[_0x4981('0x12')](_0x4981('0xd'),auth[_0x4981('0x8')](),controller[_0x4981('0x13')]);module[_0x4981('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 876a006..d4b553a 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 _0xe299=['DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x3d0c80,_0xae2bc6){var _0x46ee6f=function(_0x427b4c){while(--_0x427b4c){_0x3d0c80['push'](_0x3d0c80['shift']());}};_0x46ee6f(++_0xae2bc6);}(_0xe299,0x16f));var _0x9e29=function(_0x11769d,_0x565a67){_0x11769d=_0x11769d-0x0;var _0xa4a6cc=_0xe299[_0x11769d];return _0xa4a6cc;};'use strict';var Sequelize=require(_0x9e29('0x0'));var moment=require(_0x9e29('0x1'));module[_0x9e29('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9e29('0x3')]},'type':{'type':Sequelize[_0x9e29('0x3')],'defaultValue':_0x9e29('0x4'),'comment':_0x9e29('0x5')},'duration':{'type':Sequelize[_0x9e29('0x6')]},'enterAt':{'type':Sequelize[_0x9e29('0x7')]},'exitAt':{'type':Sequelize[_0x9e29('0x7')],'set':function(_0x56f89b){var _0x458ae0=moment(_0x56f89b);var _0x2db528=moment(this[_0x9e29('0x8')](_0x9e29('0x9')));var _0x5dc373=_0x458ae0[_0x9e29('0xa')](_0x2db528,'seconds');this[_0x9e29('0xb')]('exitAt',_0x56f89b);this[_0x9e29('0xb')](_0x9e29('0xc'),_0x5dc373>=0x0?_0x5dc373:null);}},'data1':{'type':Sequelize[_0x9e29('0x3')],'comment':_0x9e29('0xd')},'data2':{'type':Sequelize[_0x9e29('0x3')],'comment':_0x9e29('0xe')},'data3':{'type':Sequelize[_0x9e29('0x3')],'comment':_0x9e29('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x9e29('0x10')},'data5':{'type':Sequelize[_0x9e29('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x9e29('0x3')]},'internal':{'type':Sequelize[_0x9e29('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x313c=['INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x329490,_0x5df048){var _0x1dcc8c=function(_0x4d75ab){while(--_0x4d75ab){_0x329490['push'](_0x329490['shift']());}};_0x1dcc8c(++_0x5df048);}(_0x313c,0xda));var _0xc313=function(_0x3c06f1,_0x596062){_0x3c06f1=_0x3c06f1-0x0;var _0x3616ad=_0x313c[_0x3c06f1];return _0x3616ad;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc313('0x0')]={'channel':{'type':Sequelize[_0xc313('0x1')]},'membername':{'type':Sequelize[_0xc313('0x1')]},'interface':{'type':Sequelize[_0xc313('0x1')]},'type':{'type':Sequelize[_0xc313('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xc313('0x2')},'duration':{'type':Sequelize[_0xc313('0x3')]},'enterAt':{'type':Sequelize[_0xc313('0x4')]},'exitAt':{'type':Sequelize[_0xc313('0x4')],'set':function(_0x1e63c9){var _0x5149cc=moment(_0x1e63c9);var _0x58721a=moment(this[_0xc313('0x5')](_0xc313('0x6')));var _0x133303=_0x5149cc[_0xc313('0x7')](_0x58721a,_0xc313('0x8'));this[_0xc313('0x9')](_0xc313('0xa'),_0x1e63c9);this['setDataValue'](_0xc313('0xb'),_0x133303>=0x0?_0x133303:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xc313('0xc')},'data2':{'type':Sequelize[_0xc313('0x1')],'comment':_0xc313('0xd')},'data3':{'type':Sequelize[_0xc313('0x1')],'comment':_0xc313('0xe')},'data4':{'type':Sequelize[_0xc313('0x1')],'comment':_0xc313('0xf')},'data5':{'type':Sequelize[_0xc313('0x1')],'comment':_0xc313('0x10')},'role':{'type':Sequelize[_0xc313('0x1')]},'internal':{'type':Sequelize[_0xc313('0x3')]},'uniqueid':{'type':Sequelize[_0xc313('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 47a5fad..451ba57 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x34e8,0x12c));var _0x834e=function(_0x4c6ae6,_0x51dac0){_0x4c6ae6=_0x4c6ae6-0x0;var _0x51aff8=_0x34e8[_0x4c6ae6];return _0x51aff8;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x5c19d8,_0x10e7aa){var _0x558708=function(_0x2eefd7){while(--_0x2eefd7){_0x5c19d8['push'](_0x5c19d8['shift']());}};_0x558708(++_0x10e7aa);}(_0x008c,0x188));var _0xc008=function(_0x181728,_0x471cc4){_0x181728=_0x181728-0x0;var _0x3525db=_0x008c[_0x181728];return _0x3525db;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index cb4d15b..8724719 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 _0xc55e=['interface','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','membername'];(function(_0x55a384,_0x287c74){var _0x2bb5c5=function(_0x2cf133){while(--_0x2cf133){_0x55a384['push'](_0x55a384['shift']());}};_0x2bb5c5(++_0x287c74);}(_0xc55e,0x146));var _0xec55=function(_0x1e6b3a,_0x412c46){_0x1e6b3a=_0x1e6b3a-0x0;var _0x17acc7=_0xc55e[_0x1e6b3a];return _0x17acc7;};'use strict';var _=require(_0xec55('0x0'));var util=require(_0xec55('0x1'));var logger=require(_0xec55('0x2'))(_0xec55('0x3'));var moment=require(_0xec55('0x4'));var BPromise=require('bluebird');var rp=require(_0xec55('0x5'));var fs=require('fs');var path=require(_0xec55('0x6'));var rimraf=require(_0xec55('0x7'));var config=require(_0xec55('0x8'));var attributes=require(_0xec55('0x9'));module['exports']=function(_0x1cda69,_0x3a887a){return _0x1cda69[_0xec55('0xa')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xec55('0xb'),_0xec55('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d61=['path','rimraf','../../config/environment','./memberReport.attributes','exports','define','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x727b20,_0x41459c){var _0x561251=function(_0x52a144){while(--_0x52a144){_0x727b20['push'](_0x727b20['shift']());}};_0x561251(++_0x41459c);}(_0x9d61,0xbe));var _0x19d6=function(_0x3ae96c,_0x1532d8){_0x3ae96c=_0x3ae96c-0x0;var _0x13db15=_0x9d61[_0x3ae96c];return _0x13db15;};'use strict';var _=require(_0x19d6('0x0'));var util=require(_0x19d6('0x1'));var logger=require(_0x19d6('0x2'))('api');var moment=require(_0x19d6('0x3'));var BPromise=require(_0x19d6('0x4'));var rp=require(_0x19d6('0x5'));var fs=require('fs');var path=require(_0x19d6('0x6'));var rimraf=require(_0x19d6('0x7'));var config=require(_0x19d6('0x8'));var attributes=require(_0x19d6('0x9'));module[_0x19d6('0xa')]=function(_0x63c596,_0xfbf25b){return _0x63c596[_0x19d6('0xb')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x19d6('0xc'),_0x19d6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 3dad002..a1fff93 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 _0xc03e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0xc03e,0x15a));var _0xec03=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0xc03e[_0x229f5e];return _0x2d62ff;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xec03('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec03('0x3'));var logger=require(_0xec03('0x4'))(_0xec03('0x5'));var config=require(_0xec03('0x6'));var jayson=require(_0xec03('0x7'));var client=jayson[_0xec03('0x8')][_0xec03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcaaf03,_0x278f90,_0x529ebd){return new BPromise(function(_0x4205e9,_0xb0638e){return client[_0xec03('0xa')](_0xcaaf03,_0x529ebd)[_0xec03('0xb')](function(_0x4d7e09){logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));logger[_0xec03('0xf')](_0xec03('0x10'),_0x278f90,_0xec03('0xe'),JSON[_0xec03('0x11')](_0x4d7e09));if(_0x4d7e09[_0xec03('0x12')]){if(_0x4d7e09['error'][_0xec03('0x13')]===0x1f4){logger[_0xec03('0x12')](_0xec03('0xd'),_0x278f90,_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);return _0xb0638e(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x4d7e09['error']['message']);return _0x4205e9(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}else{logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));_0x4205e9(_0x4d7e09[_0xec03('0x15')][_0xec03('0x14')]);}})[_0xec03('0x16')](function(_0x5c2f1a){logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x5c2f1a);_0xb0638e(_0x5c2f1a);});});}exports[_0xec03('0x17')]=function(_0x5e8ae2){var _0x25292d=this;return new Promise(function(_0x5b3e04,_0x57dc2d){return db[_0xec03('0x18')][_0xec03('0x19')]({'raw':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1b')]||null:null,'attributes':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1d')]||null:null,'include':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1e')],function(_0x33de1e){return{'model':db[_0x33de1e[_0xec03('0x20')]],'as':_0x33de1e['as'],'attributes':_0x33de1e['attributes'],'include':_0x33de1e[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x33de1e['include'],function(_0x2bfcf6){return{'model':db[_0x2bfcf6[_0xec03('0x20')]],'as':_0x2bfcf6['as'],'attributes':_0x2bfcf6[_0xec03('0x1c')],'include':_0x2bfcf6[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x2bfcf6['include'],function(_0x73cc4f){return{'model':db[_0x73cc4f[_0xec03('0x20')]],'as':_0x73cc4f['as'],'attributes':_0x73cc4f[_0xec03('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xec03('0xb')](function(_0x29e904){logger['info'](_0xec03('0x17'),_0x5e8ae2);logger[_0xec03('0xf')]('GetMemberReport',_0x5e8ae2,JSON['stringify'](_0x29e904));_0x5b3e04(_0x29e904);})[_0xec03('0x16')](function(_0x12b5c9){logger[_0xec03('0x12')](_0xec03('0x17'),_0x12b5c9[_0xec03('0x14')],_0x5e8ae2);_0x57dc2d(_0x25292d[_0xec03('0x12')](0x1f4,_0x12b5c9[_0xec03('0x14')]));});});};exports[_0xec03('0x21')]=function(_0x51fad6){var _0x28f60c=this;return new Promise(function(_0x31c08d,_0x2bd889){return db[_0xec03('0x18')][_0xec03('0x22')](_0x51fad6[_0xec03('0x23')],{'raw':_0x51fad6[_0xec03('0x1a')]?_0x51fad6[_0xec03('0x1a')][_0xec03('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x5d441b){logger['info'](_0xec03('0x21'),_0x51fad6);logger[_0xec03('0xf')](_0xec03('0x21'),_0x51fad6,JSON[_0xec03('0x11')](_0x5d441b));_0x31c08d(_0x5d441b);})['catch'](function(_0x576d5e){logger['error']('CreateMemberReport',_0x576d5e[_0xec03('0x14')],_0x51fad6);_0x2bd889(_0x28f60c[_0xec03('0x12')](0x1f4,_0x576d5e[_0xec03('0x14')]));});});};exports[_0xec03('0x25')]=function(_0x11c75b){var _0x3d7d98=this;return new Promise(function(_0x23a26b,_0x1cee38){return db[_0xec03('0x18')][_0xec03('0x26')](_0x11c75b[_0xec03('0x23')],{'raw':_0x11c75b[_0xec03('0x1a')]?_0x11c75b['options'][_0xec03('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')]['where']||null:null,'attributes':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1d')]||null:null})[_0xec03('0xb')](function(_0x3c55b7){logger[_0xec03('0xc')](_0xec03('0x25'),_0x11c75b);logger[_0xec03('0xf')]('UpdateMemberReport',_0x11c75b,JSON[_0xec03('0x11')](_0x3c55b7));_0x23a26b(_0x3c55b7);})[_0xec03('0x16')](function(_0x37819a){logger[_0xec03('0x12')](_0xec03('0x25'),_0x37819a[_0xec03('0x14')],_0x11c75b);_0x1cee38(_0x3d7d98[_0xec03('0x12')](0x1f4,_0x37819a[_0xec03('0x14')]));});});}; \ No newline at end of file +var _0x4d87=['info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','body','UpdateMemberReport','update','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x4d87,0xf0));var _0x74d8=function(_0x80deee,_0x2bec3d){_0x80deee=_0x80deee-0x0;var _0x55b7de=_0x4d87[_0x80deee];return _0x55b7de;};'use strict';var _=require('lodash');var util=require(_0x74d8('0x0'));var moment=require(_0x74d8('0x1'));var BPromise=require(_0x74d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74d8('0x3'));var db=require(_0x74d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x74d8('0x5'));var config=require(_0x74d8('0x6'));var jayson=require(_0x74d8('0x7'));var client=jayson[_0x74d8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50965b,_0x54c5f6,_0x4149ee){return new BPromise(function(_0x3a3b78,_0x3e6af4){return client[_0x74d8('0x9')](_0x50965b,_0x4149ee)[_0x74d8('0xa')](function(_0x2e7799){logger['info'](_0x74d8('0xb'),_0x54c5f6,_0x74d8('0xc'));logger[_0x74d8('0xd')](_0x74d8('0xe'),_0x54c5f6,_0x74d8('0xc'),JSON[_0x74d8('0xf')](_0x2e7799));if(_0x2e7799[_0x74d8('0x10')]){if(_0x2e7799[_0x74d8('0x10')][_0x74d8('0x11')]===0x1f4){logger['error'](_0x74d8('0xb'),_0x54c5f6,_0x2e7799[_0x74d8('0x10')]['message']);return _0x3e6af4(_0x2e7799[_0x74d8('0x10')][_0x74d8('0x12')]);}logger[_0x74d8('0x10')](_0x74d8('0xb'),_0x54c5f6,_0x2e7799[_0x74d8('0x10')]['message']);return _0x3a3b78(_0x2e7799['error']['message']);}else{logger[_0x74d8('0x13')](_0x74d8('0xb'),_0x54c5f6,_0x74d8('0xc'));_0x3a3b78(_0x2e7799[_0x74d8('0x14')][_0x74d8('0x12')]);}})[_0x74d8('0x15')](function(_0x539c0c){logger[_0x74d8('0x10')]('MemberReport,\x20%s,\x20%s',_0x54c5f6,_0x539c0c);_0x3e6af4(_0x539c0c);});});}exports[_0x74d8('0x16')]=function(_0x221da2){var _0x3ff6d1=this;return new Promise(function(_0x3f6a7b,_0x32fdb0){return db[_0x74d8('0x17')][_0x74d8('0x18')]({'raw':_0x221da2['options']?_0x221da2[_0x74d8('0x19')][_0x74d8('0x1a')]===undefined?!![]:![]:!![],'where':_0x221da2['options']?_0x221da2[_0x74d8('0x19')][_0x74d8('0x1b')]||null:null,'attributes':_0x221da2[_0x74d8('0x19')]?_0x221da2[_0x74d8('0x19')][_0x74d8('0x1c')]||null:null,'limit':_0x221da2[_0x74d8('0x19')]?_0x221da2[_0x74d8('0x19')][_0x74d8('0x1d')]||null:null,'include':_0x221da2[_0x74d8('0x19')]?_0x221da2[_0x74d8('0x19')][_0x74d8('0x1e')]?_[_0x74d8('0x1f')](_0x221da2[_0x74d8('0x19')][_0x74d8('0x1e')],function(_0x3d9d55){return{'model':db[_0x3d9d55[_0x74d8('0x20')]],'as':_0x3d9d55['as'],'attributes':_0x3d9d55[_0x74d8('0x1c')],'include':_0x3d9d55[_0x74d8('0x1e')]?_[_0x74d8('0x1f')](_0x3d9d55['include'],function(_0x44ce3c){return{'model':db[_0x44ce3c[_0x74d8('0x20')]],'as':_0x44ce3c['as'],'attributes':_0x44ce3c[_0x74d8('0x1c')],'include':_0x44ce3c[_0x74d8('0x1e')]?_[_0x74d8('0x1f')](_0x44ce3c[_0x74d8('0x1e')],function(_0x43eefe){return{'model':db[_0x43eefe[_0x74d8('0x20')]],'as':_0x43eefe['as'],'attributes':_0x43eefe[_0x74d8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x74d8('0xa')](function(_0x3ba8e7){logger['info'](_0x74d8('0x16'),_0x221da2);logger[_0x74d8('0xd')]('GetMemberReport',_0x221da2,JSON[_0x74d8('0xf')](_0x3ba8e7));_0x3f6a7b(_0x3ba8e7);})[_0x74d8('0x15')](function(_0x721948){logger[_0x74d8('0x10')]('GetMemberReport',_0x721948[_0x74d8('0x12')],_0x221da2);_0x32fdb0(_0x3ff6d1[_0x74d8('0x10')](0x1f4,_0x721948[_0x74d8('0x12')]));});});};exports[_0x74d8('0x21')]=function(_0x4c3121){var _0x2b6f84=this;return new Promise(function(_0x3b0164,_0x6bdf1d){return db[_0x74d8('0x17')]['create'](_0x4c3121[_0x74d8('0x22')],{'raw':_0x4c3121[_0x74d8('0x19')]?_0x4c3121[_0x74d8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x74d8('0xa')](function(_0x4e2f05){logger[_0x74d8('0x13')](_0x74d8('0x21'),_0x4c3121);logger[_0x74d8('0xd')](_0x74d8('0x21'),_0x4c3121,JSON[_0x74d8('0xf')](_0x4e2f05));_0x3b0164(_0x4e2f05);})[_0x74d8('0x15')](function(_0x45388a){logger[_0x74d8('0x10')](_0x74d8('0x21'),_0x45388a[_0x74d8('0x12')],_0x4c3121);_0x6bdf1d(_0x2b6f84[_0x74d8('0x10')](0x1f4,_0x45388a['message']));});});};exports[_0x74d8('0x23')]=function(_0xeb0dce){var _0x592952=this;return new Promise(function(_0x3f47a1,_0x164264){return db[_0x74d8('0x17')][_0x74d8('0x24')](_0xeb0dce[_0x74d8('0x22')],{'raw':_0xeb0dce[_0x74d8('0x19')]?_0xeb0dce[_0x74d8('0x19')][_0x74d8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeb0dce['options']?_0xeb0dce[_0x74d8('0x19')][_0x74d8('0x1b')]||null:null,'attributes':_0xeb0dce[_0x74d8('0x19')]?_0xeb0dce[_0x74d8('0x19')][_0x74d8('0x1c')]||null:null,'limit':_0xeb0dce[_0x74d8('0x19')]?_0xeb0dce[_0x74d8('0x19')][_0x74d8('0x1d')]||null:null})[_0x74d8('0xa')](function(_0x3bbfa6){logger['info'](_0x74d8('0x23'),_0xeb0dce);logger[_0x74d8('0xd')](_0x74d8('0x23'),_0xeb0dce,JSON[_0x74d8('0xf')](_0x3bbfa6));_0x3f47a1(_0x3bbfa6);})[_0x74d8('0x15')](function(_0x1d06cb){logger[_0x74d8('0x10')](_0x74d8('0x23'),_0x1d06cb[_0x74d8('0x12')],_0xeb0dce);_0x164264(_0x592952[_0x74d8('0x10')](0x1f4,_0x1d06cb[_0x74d8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 508a9a7..b0c4207 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 _0xde74=['fs-extra','../../components/auth/service','../../config/environment','get','index','exports','multer','util','path','Router'];(function(_0x132771,_0x9be6d){var _0x59fbd1=function(_0x52d8bf){while(--_0x52d8bf){_0x132771['push'](_0x132771['shift']());}};_0x59fbd1(++_0x9be6d);}(_0xde74,0x1c8));var _0x4de7=function(_0x3e6fd1,_0x508b0b){_0x3e6fd1=_0x3e6fd1-0x0;var _0xf444b6=_0xde74[_0x3e6fd1];return _0xf444b6;};'use strict';var multer=require(_0x4de7('0x0'));var util=require(_0x4de7('0x1'));var path=require(_0x4de7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4de7('0x3')]();var fs_extra=require(_0x4de7('0x4'));var auth=require(_0x4de7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4de7('0x6'));var controller=require('./migration.controller');router[_0x4de7('0x7')]('/',controller[_0x4de7('0x8')]);module[_0x4de7('0x9')]=router; \ No newline at end of file +var _0x7953=['fs-extra','../../components/auth/service','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4e69f3,_0x56cef5){var _0xb02255=function(_0x357e10){while(--_0x357e10){_0x4e69f3['push'](_0x4e69f3['shift']());}};_0xb02255(++_0x56cef5);}(_0x7953,0x66));var _0x3795=function(_0x280820,_0xce9bc7){_0x280820=_0x280820-0x0;var _0x474787=_0x7953[_0x280820];return _0x474787;};'use strict';var multer=require(_0x3795('0x0'));var util=require(_0x3795('0x1'));var path=require(_0x3795('0x2'));var timeout=require(_0x3795('0x3'));var express=require(_0x3795('0x4'));var router=express[_0x3795('0x5')]();var fs_extra=require(_0x3795('0x6'));var auth=require(_0x3795('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3795('0x8'));router[_0x3795('0x9')]('/',controller[_0x3795('0xa')]);module[_0x3795('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 40f2070..6671dc8 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 _0x5142=['sequelize','exports','STRING','version'];(function(_0x1e6e07,_0x31a58c){var _0x1bc31a=function(_0x44daee){while(--_0x44daee){_0x1e6e07['push'](_0x1e6e07['shift']());}};_0x1bc31a(++_0x31a58c);}(_0x5142,0x180));var _0x2514=function(_0xe370e1,_0x20f364){_0xe370e1=_0xe370e1-0x0;var _0x4ac575=_0x5142[_0xe370e1];return _0x4ac575;};'use strict';var Sequelize=require(_0x2514('0x0'));module[_0x2514('0x1')]={'version':{'type':Sequelize[_0x2514('0x2')],'unique':_0x2514('0x3')}}; \ No newline at end of file +var _0xda2a=['sequelize','exports'];(function(_0x430ea6,_0x58db3b){var _0x8c837=function(_0x1123ef){while(--_0x1123ef){_0x430ea6['push'](_0x430ea6['shift']());}};_0x8c837(++_0x58db3b);}(_0xda2a,0x12a));var _0xada2=function(_0x21e160,_0x12ac6b){_0x21e160=_0x21e160-0x0;var _0x3290df=_0xda2a[_0x21e160];return _0x3290df;};'use strict';var Sequelize=require(_0xada2('0x0'));module[_0xada2('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1790d0f..b4d8c8b 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 _0x099c=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','Migration','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0x099c,0x100));var _0xc099=function(_0x511723,_0x4db8e2){_0x511723=_0x511723-0x0;var _0x25add0=_0x099c[_0x511723];return _0x25add0;};'use strict';var emlformat=require(_0xc099('0x0'));var rimraf=require(_0xc099('0x1'));var zipdir=require(_0xc099('0x2'));var jsonpatch=require(_0xc099('0x3'));var rp=require(_0xc099('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc099('0x5'));var util=require(_0xc099('0x6'));var path=require(_0xc099('0x7'));var sox=require('sox');var csv=require(_0xc099('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc099('0x9'));var _=require('lodash');var squel=require(_0xc099('0xa'));var crypto=require(_0xc099('0xb'));var jsforce=require(_0xc099('0xc'));var deskjs=require(_0xc099('0xd'));var toCsv=require(_0xc099('0x8'));var querystring=require(_0xc099('0xe'));var Papa=require(_0xc099('0xf'));var Redis=require('ioredis');var authService=require(_0xc099('0x10'));var qs=require(_0xc099('0x11'));var as=require(_0xc099('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc099('0x13'))(_0xc099('0x14'));var utils=require(_0xc099('0x15'));var config=require(_0xc099('0x16'));var licenseUtil=require(_0xc099('0x17'));var db=require(_0xc099('0x18'))['db'];function respondWithStatusCode(_0x5e6ca6,_0x3490d1){_0x3490d1=_0x3490d1||0xcc;return function(_0x3887c5){if(_0x3887c5){return _0x5e6ca6['sendStatus'](_0x3490d1);}return _0x5e6ca6[_0xc099('0x19')](_0x3490d1)[_0xc099('0x1a')]();};}function respondWithResult(_0x36eb95,_0x42f513){_0x42f513=_0x42f513||0xc8;return function(_0x4323a6){if(_0x4323a6){return _0x36eb95[_0xc099('0x19')](_0x42f513)['json'](_0x4323a6);}};}function respondWithFilteredResult(_0x3920db,_0x1bf97b){return function(_0x4cf353){if(_0x4cf353){var _0x2b2d0d=typeof _0x1bf97b['offset']===_0xc099('0x1b')&&typeof _0x1bf97b[_0xc099('0x1c')]===_0xc099('0x1b');var _0x22c934=_0x4cf353[_0xc099('0x1d')];var _0x59c518=_0x2b2d0d?0x0:_0x1bf97b[_0xc099('0x1e')];var _0xc711f6=_0x2b2d0d?_0x4cf353[_0xc099('0x1d')]:_0x1bf97b['offset']+_0x1bf97b['limit'];var _0x3ed29b;if(_0xc711f6>=_0x22c934){_0xc711f6=_0x22c934;_0x3ed29b=0xc8;}else{_0x3ed29b=0xce;}_0x3920db[_0xc099('0x19')](_0x3ed29b);return _0x3920db[_0xc099('0x1f')](_0xc099('0x20'),_0x59c518+'-'+_0xc711f6+'/'+_0x22c934)['json'](_0x4cf353);}return null;};}function patchUpdates(_0x152d31){return function(_0x1be683){try{jsonpatch['apply'](_0x1be683,_0x152d31,!![]);}catch(_0x1c0c7e){return BPromise['reject'](_0x1c0c7e);}return _0x1be683[_0xc099('0x21')]();};}function saveUpdates(_0x3df822,_0x3dfe25){return function(_0x24dbe9){if(_0x24dbe9){return _0x24dbe9[_0xc099('0x22')](_0x3df822)[_0xc099('0x23')](function(_0x19a509){return _0x19a509;});}return null;};}function removeEntity(_0x2da669,_0x2cdd24){return function(_0xcd3f62){if(_0xcd3f62){return _0xcd3f62[_0xc099('0x24')]()['then'](function(){_0x2da669[_0xc099('0x19')](0xcc)[_0xc099('0x1a')]();});}};}function handleEntityNotFound(_0x536b7f,_0x2eca1d){return function(_0x3fe79d){if(!_0x3fe79d){_0x536b7f[_0xc099('0x25')](0x194);}return _0x3fe79d;};}function handleError(_0x32299c,_0xf5a546){_0xf5a546=_0xf5a546||0x1f4;return function(_0x5858ab){logger[_0xc099('0x26')](_0x5858ab[_0xc099('0x27')]);if(_0x5858ab[_0xc099('0x28')]){delete _0x5858ab['name'];}_0x32299c['status'](_0xf5a546)[_0xc099('0x29')](_0x5858ab);};}exports[_0xc099('0x2a')]=function(_0x75317a,_0xf6ff17){var _0x51d1a2={},_0xa5a3cf={},_0x1db8ac={'count':0x0,'rows':[]};var _0x435c7f=_['map'](db['Migration'][_0xc099('0x2b')],function(_0x5b480c){return{'name':_0x5b480c[_0xc099('0x2c')],'type':_0x5b480c[_0xc099('0x2d')][_0xc099('0x2e')]};});_0xa5a3cf['model']=_[_0xc099('0x2f')](_0x435c7f,_0xc099('0x28'));_0xa5a3cf[_0xc099('0x30')]=_['keys'](_0x75317a[_0xc099('0x30')]);_0xa5a3cf['filters']=_[_0xc099('0x31')](_0xa5a3cf['model'],_0xa5a3cf['query']);_0x51d1a2['attributes']=_[_0xc099('0x31')](_0xa5a3cf[_0xc099('0x32')],qs[_0xc099('0x33')](_0x75317a['query'][_0xc099('0x33')]));_0x51d1a2[_0xc099('0x34')]=_0x51d1a2['attributes'][_0xc099('0x35')]?_0x51d1a2[_0xc099('0x34')]:_0xa5a3cf[_0xc099('0x32')];if(!_0x75317a[_0xc099('0x30')][_0xc099('0x36')]('nolimit')){_0x51d1a2[_0xc099('0x1c')]=qs[_0xc099('0x1c')](_0x75317a['query'][_0xc099('0x1c')]);_0x51d1a2[_0xc099('0x1e')]=qs['offset'](_0x75317a['query'][_0xc099('0x1e')]);}_0x51d1a2[_0xc099('0x37')]=qs[_0xc099('0x38')](_0x75317a[_0xc099('0x30')]['sort']);_0x51d1a2['where']=qs[_0xc099('0x39')](_[_0xc099('0x3a')](_0x75317a['query'],_0xa5a3cf[_0xc099('0x39')]),_0x435c7f);if(_0x75317a[_0xc099('0x30')]['filter']){_0x51d1a2[_0xc099('0x3b')]=_[_0xc099('0x3c')](_0x51d1a2[_0xc099('0x3b')],{'$or':_[_0xc099('0x2f')](_0x435c7f,function(_0x532669){if(_0x532669['type']!==_0xc099('0x3d')){var _0x196ef7={};_0x196ef7[_0x532669[_0xc099('0x28')]]={'$like':'%'+_0x75317a[_0xc099('0x30')][_0xc099('0x3e')]+'%'};return _0x196ef7;}})});}_0x51d1a2=_['merge']({},_0x51d1a2,_0x75317a[_0xc099('0x3f')]);var _0x2af451={'where':_0x51d1a2[_0xc099('0x3b')]};return db[_0xc099('0x40')][_0xc099('0x1d')](_0x2af451)[_0xc099('0x23')](function(_0x168d74){_0x1db8ac[_0xc099('0x1d')]=_0x168d74;if(_0x75317a[_0xc099('0x30')][_0xc099('0x41')]){_0x51d1a2[_0xc099('0x42')]=[{'all':!![]}];}return db[_0xc099('0x40')]['findAll'](_0x51d1a2);})[_0xc099('0x23')](function(_0x95fc6d){_0x1db8ac[_0xc099('0x43')]=_0x95fc6d;return _0x1db8ac;})[_0xc099('0x23')](respondWithFilteredResult(_0xf6ff17,_0x51d1a2))['catch'](handleError(_0xf6ff17,null));}; \ No newline at end of file +var _0x7fcc=['then','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','error','stack','name','send','Migration','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options'];(function(_0x3c5412,_0x48d37c){var _0x5e5b32=function(_0x4a53e8){while(--_0x4a53e8){_0x3c5412['push'](_0x3c5412['shift']());}};_0x5e5b32(++_0x48d37c);}(_0x7fcc,0x8b));var _0xc7fc=function(_0x49cdc9,_0x3a1469){_0x49cdc9=_0x49cdc9-0x0;var _0x30bfd7=_0x7fcc[_0x49cdc9];return _0x30bfd7;};'use strict';var emlformat=require(_0xc7fc('0x0'));var rimraf=require(_0xc7fc('0x1'));var zipdir=require(_0xc7fc('0x2'));var jsonpatch=require(_0xc7fc('0x3'));var rp=require(_0xc7fc('0x4'));var moment=require(_0xc7fc('0x5'));var BPromise=require(_0xc7fc('0x6'));var Mustache=require(_0xc7fc('0x7'));var util=require(_0xc7fc('0x8'));var path=require(_0xc7fc('0x9'));var sox=require(_0xc7fc('0xa'));var csv=require('to-csv');var ejs=require(_0xc7fc('0xb'));var fs=require('fs');var fs_extra=require(_0xc7fc('0xc'));var _=require(_0xc7fc('0xd'));var squel=require(_0xc7fc('0xe'));var crypto=require('crypto');var jsforce=require(_0xc7fc('0xf'));var deskjs=require(_0xc7fc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc7fc('0x11'));var Papa=require(_0xc7fc('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc7fc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7fc('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc7fc('0x15'));var db=require(_0xc7fc('0x16'))['db'];function respondWithStatusCode(_0x1d50d1,_0x16fbaf){_0x16fbaf=_0x16fbaf||0xcc;return function(_0x167b2f){if(_0x167b2f){return _0x1d50d1[_0xc7fc('0x17')](_0x16fbaf);}return _0x1d50d1[_0xc7fc('0x18')](_0x16fbaf)[_0xc7fc('0x19')]();};}function respondWithResult(_0x5f3b6b,_0x4758fe){_0x4758fe=_0x4758fe||0xc8;return function(_0x377173){if(_0x377173){return _0x5f3b6b[_0xc7fc('0x18')](_0x4758fe)[_0xc7fc('0x1a')](_0x377173);}};}function respondWithFilteredResult(_0x29c329,_0x5451d6){return function(_0x362619){if(_0x362619){var _0x48b2c2=typeof _0x5451d6[_0xc7fc('0x1b')]===_0xc7fc('0x1c')&&typeof _0x5451d6['limit']===_0xc7fc('0x1c');var _0x3d8c27=_0x362619[_0xc7fc('0x1d')];var _0xccba53=_0x48b2c2?0x0:_0x5451d6[_0xc7fc('0x1b')];var _0x73c76b=_0x48b2c2?_0x362619['count']:_0x5451d6[_0xc7fc('0x1b')]+_0x5451d6[_0xc7fc('0x1e')];var _0x3ec57e;if(_0x73c76b>=_0x3d8c27){_0x73c76b=_0x3d8c27;_0x3ec57e=0xc8;}else{_0x3ec57e=0xce;}_0x29c329[_0xc7fc('0x18')](_0x3ec57e);return _0x29c329[_0xc7fc('0x1f')]('Content-Range',_0xccba53+'-'+_0x73c76b+'/'+_0x3d8c27)['json'](_0x362619);}return null;};}function patchUpdates(_0x4e5eef){return function(_0x2e83c1){try{jsonpatch[_0xc7fc('0x20')](_0x2e83c1,_0x4e5eef,!![]);}catch(_0x3c9bbc){return BPromise[_0xc7fc('0x21')](_0x3c9bbc);}return _0x2e83c1[_0xc7fc('0x22')]();};}function saveUpdates(_0x60db45,_0x43ae4a){return function(_0x48fa02){if(_0x48fa02){return _0x48fa02['update'](_0x60db45)['then'](function(_0x1295e1){return _0x1295e1;});}return null;};}function removeEntity(_0x40f1a6,_0x39a6ed){return function(_0x2a47ee){if(_0x2a47ee){return _0x2a47ee[_0xc7fc('0x23')]()['then'](function(){_0x40f1a6[_0xc7fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a9fc2,_0x4e2f66){return function(_0x6232ff){if(!_0x6232ff){_0x5a9fc2[_0xc7fc('0x17')](0x194);}return _0x6232ff;};}function handleError(_0x1da1c5,_0x352a77){_0x352a77=_0x352a77||0x1f4;return function(_0x2bd2bd){logger[_0xc7fc('0x24')](_0x2bd2bd[_0xc7fc('0x25')]);if(_0x2bd2bd[_0xc7fc('0x26')]){delete _0x2bd2bd[_0xc7fc('0x26')];}_0x1da1c5[_0xc7fc('0x18')](_0x352a77)[_0xc7fc('0x27')](_0x2bd2bd);};}exports['index']=function(_0xe49300,_0x50ed83){var _0x4fbd59={},_0x58d9c6={},_0x1d1c84={'count':0x0,'rows':[]};var _0xa6fdc0=_['map'](db[_0xc7fc('0x28')][_0xc7fc('0x29')],function(_0xd487c4){return{'name':_0xd487c4[_0xc7fc('0x2a')],'type':_0xd487c4[_0xc7fc('0x2b')][_0xc7fc('0x2c')]};});_0x58d9c6['model']=_['map'](_0xa6fdc0,_0xc7fc('0x26'));_0x58d9c6['query']=_[_0xc7fc('0x2d')](_0xe49300['query']);_0x58d9c6['filters']=_[_0xc7fc('0x2e')](_0x58d9c6[_0xc7fc('0x2f')],_0x58d9c6[_0xc7fc('0x30')]);_0x4fbd59[_0xc7fc('0x31')]=_[_0xc7fc('0x2e')](_0x58d9c6['model'],qs[_0xc7fc('0x32')](_0xe49300[_0xc7fc('0x30')]['fields']));_0x4fbd59['attributes']=_0x4fbd59[_0xc7fc('0x31')][_0xc7fc('0x33')]?_0x4fbd59[_0xc7fc('0x31')]:_0x58d9c6[_0xc7fc('0x2f')];if(!_0xe49300[_0xc7fc('0x30')][_0xc7fc('0x34')](_0xc7fc('0x35'))){_0x4fbd59['limit']=qs['limit'](_0xe49300[_0xc7fc('0x30')]['limit']);_0x4fbd59[_0xc7fc('0x1b')]=qs[_0xc7fc('0x1b')](_0xe49300[_0xc7fc('0x30')][_0xc7fc('0x1b')]);}_0x4fbd59[_0xc7fc('0x36')]=qs[_0xc7fc('0x37')](_0xe49300['query'][_0xc7fc('0x37')]);_0x4fbd59[_0xc7fc('0x38')]=qs['filters'](_['pick'](_0xe49300[_0xc7fc('0x30')],_0x58d9c6['filters']),_0xa6fdc0);if(_0xe49300[_0xc7fc('0x30')][_0xc7fc('0x39')]){_0x4fbd59[_0xc7fc('0x38')]=_[_0xc7fc('0x3a')](_0x4fbd59[_0xc7fc('0x38')],{'$or':_[_0xc7fc('0x3b')](_0xa6fdc0,function(_0x9328d8){if(_0x9328d8[_0xc7fc('0x2b')]!==_0xc7fc('0x3c')){var _0xeeedeb={};_0xeeedeb[_0x9328d8['name']]={'$like':'%'+_0xe49300['query']['filter']+'%'};return _0xeeedeb;}})});}_0x4fbd59=_[_0xc7fc('0x3a')]({},_0x4fbd59,_0xe49300[_0xc7fc('0x3d')]);var _0x395af1={'where':_0x4fbd59[_0xc7fc('0x38')]};return db[_0xc7fc('0x28')][_0xc7fc('0x1d')](_0x395af1)[_0xc7fc('0x3e')](function(_0xcecf76){_0x1d1c84[_0xc7fc('0x1d')]=_0xcecf76;if(_0xe49300[_0xc7fc('0x30')][_0xc7fc('0x3f')]){_0x4fbd59[_0xc7fc('0x40')]=[{'all':!![]}];}return db[_0xc7fc('0x28')][_0xc7fc('0x41')](_0x4fbd59);})['then'](function(_0x1417fd){_0x1d1c84['rows']=_0x1417fd;return _0x1d1c84;})[_0xc7fc('0x3e')](respondWithFilteredResult(_0x50ed83,_0x4fbd59))[_0xc7fc('0x42')](handleError(_0x50ed83,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f727b54..dbf586b 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 _0xc35e=['define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0x4d94ce,_0x426df){var _0x120e7b=function(_0x398591){while(--_0x398591){_0x4d94ce['push'](_0x4d94ce['shift']());}};_0x120e7b(++_0x426df);}(_0xc35e,0x1e1));var _0xec35=function(_0x1f2f54,_0x2110f1){_0x1f2f54=_0x1f2f54-0x0;var _0x30bed5=_0xc35e[_0x1f2f54];return _0x30bed5;};'use strict';var _=require(_0xec35('0x0'));var util=require(_0xec35('0x1'));var logger=require(_0xec35('0x2'))(_0xec35('0x3'));var moment=require(_0xec35('0x4'));var BPromise=require(_0xec35('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec35('0x6'));var rimraf=require(_0xec35('0x7'));var config=require(_0xec35('0x8'));var attributes=require(_0xec35('0x9'));module[_0xec35('0xa')]=function(_0x414b82,_0x420edd){return _0x414b82[_0xec35('0xb')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a5d=['rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','util','../../config/logger','api','moment','bluebird','path'];(function(_0x42c069,_0xdfa0f9){var _0x4f0740=function(_0x4c9fd9){while(--_0x4c9fd9){_0x42c069['push'](_0x42c069['shift']());}};_0x4f0740(++_0xdfa0f9);}(_0x4a5d,0x1b6));var _0xd4a5=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x4a5d[_0x4776cc];return _0x427bda;};'use strict';var _=require('lodash');var util=require(_0xd4a5('0x0'));var logger=require(_0xd4a5('0x1'))(_0xd4a5('0x2'));var moment=require(_0xd4a5('0x3'));var BPromise=require(_0xd4a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4a5('0x5'));var rimraf=require(_0xd4a5('0x6'));var config=require(_0xd4a5('0x7'));var attributes=require(_0xd4a5('0x8'));module[_0xd4a5('0x9')]=function(_0x433a68,_0x28f670){return _0x433a68['define'](_0xd4a5('0xa'),attributes,{'tableName':_0xd4a5('0xb'),'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 e8e1fc4..23656db 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 _0x98b7=['message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x41771b,_0x5a8fc5){var _0x536f86=function(_0x44e04b){while(--_0x44e04b){_0x41771b['push'](_0x41771b['shift']());}};_0x536f86(++_0x5a8fc5);}(_0x98b7,0xc1));var _0x798b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x98b7[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var moment=require(_0x798b('0x2'));var BPromise=require(_0x798b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x798b('0x4'));var logger=require(_0x798b('0x5'))(_0x798b('0x6'));var config=require(_0x798b('0x7'));var jayson=require(_0x798b('0x8'));var client=jayson['client'][_0x798b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d70b2,_0x2b904b,_0xbf4c6c){return new BPromise(function(_0x3fb4de,_0x14994d){return client[_0x798b('0xa')](_0x5d70b2,_0xbf4c6c)['then'](function(_0x24b028){logger['info'](_0x798b('0xb'),_0x2b904b,'request\x20sent');logger[_0x798b('0xc')](_0x798b('0xd'),_0x2b904b,_0x798b('0xe'),JSON['stringify'](_0x24b028));if(_0x24b028['error']){if(_0x24b028[_0x798b('0xf')][_0x798b('0x10')]===0x1f4){logger[_0x798b('0xf')]('Migration,\x20%s,\x20%s',_0x2b904b,_0x24b028[_0x798b('0xf')]['message']);return _0x14994d(_0x24b028[_0x798b('0xf')]['message']);}logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);return _0x3fb4de(_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);}else{logger[_0x798b('0x12')]('Migration,\x20%s,\x20%s',_0x2b904b,'request\x20sent');_0x3fb4de(_0x24b028[_0x798b('0x13')][_0x798b('0x11')]);}})[_0x798b('0x14')](function(_0x19b15c){logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x19b15c);_0x14994d(_0x19b15c);});});} \ No newline at end of file +var _0x7217=['then','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xd654be,_0x55ef7c){var _0x22cfb8=function(_0x24a763){while(--_0x24a763){_0xd654be['push'](_0xd654be['shift']());}};_0x22cfb8(++_0x55ef7c);}(_0x7217,0xa9));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var rs=require(_0x7721('0x1'));var fs=require('fs');var Redis=require(_0x7721('0x2'));var db=require(_0x7721('0x3'))['db'];var utils=require(_0x7721('0x4'));var logger=require(_0x7721('0x5'))(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x560535,_0x45f1fa,_0x2ddbba){return new BPromise(function(_0x7add4f,_0x4643e8){return client['request'](_0x560535,_0x2ddbba)[_0x7721('0xb')](function(_0x79247d){logger['info'](_0x7721('0xc'),_0x45f1fa,_0x7721('0xd'));logger[_0x7721('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x45f1fa,_0x7721('0xd'),JSON[_0x7721('0xf')](_0x79247d));if(_0x79247d[_0x7721('0x10')]){if(_0x79247d['error'][_0x7721('0x11')]===0x1f4){logger[_0x7721('0x10')]('Migration,\x20%s,\x20%s',_0x45f1fa,_0x79247d[_0x7721('0x10')][_0x7721('0x12')]);return _0x4643e8(_0x79247d['error'][_0x7721('0x12')]);}logger[_0x7721('0x10')](_0x7721('0xc'),_0x45f1fa,_0x79247d[_0x7721('0x10')][_0x7721('0x12')]);return _0x7add4f(_0x79247d['error'][_0x7721('0x12')]);}else{logger[_0x7721('0x13')](_0x7721('0xc'),_0x45f1fa,_0x7721('0xd'));_0x7add4f(_0x79247d['result'][_0x7721('0x12')]);}})['catch'](function(_0x1073dd){logger['error'](_0x7721('0xc'),_0x45f1fa,_0x1073dd);_0x4643e8(_0x1073dd);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 774cd04..1060f9b 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 _0xab00=['./network.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5389ac,_0x14257b){var _0x2497d9=function(_0xbdc9d5){while(--_0xbdc9d5){_0x5389ac['push'](_0x5389ac['shift']());}};_0x2497d9(++_0x14257b);}(_0xab00,0x1b9));var _0x0ab0=function(_0x33de4a,_0x3a1d51){_0x33de4a=_0x33de4a-0x0;var _0x937182=_0xab00[_0x33de4a];return _0x937182;};'use strict';var multer=require(_0x0ab0('0x0'));var util=require(_0x0ab0('0x1'));var path=require(_0x0ab0('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ab0('0x3'));var router=express[_0x0ab0('0x4')]();var fs_extra=require(_0x0ab0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ab0('0x6'));var config=require('../../config/environment');var controller=require(_0x0ab0('0x7'));router[_0x0ab0('0x8')]('/',auth[_0x0ab0('0x9')](),controller[_0x0ab0('0xa')]);router[_0x0ab0('0x8')](_0x0ab0('0xb'),auth['isAuthenticated'](),controller[_0x0ab0('0xc')]);router[_0x0ab0('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ab0('0xe')]);router['put'](_0x0ab0('0xb'),auth[_0x0ab0('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ab0('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf62d=['../../config/environment','./network.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3723e4,_0x1b43b6){var _0x5cc7f3=function(_0x3c7879){while(--_0x3c7879){_0x3723e4['push'](_0x3723e4['shift']());}};_0x5cc7f3(++_0x1b43b6);}(_0xf62d,0x1c0));var _0xdf62=function(_0x3a4f2a,_0x3d590e){_0x3a4f2a=_0x3a4f2a-0x0;var _0x3b8b3e=_0xf62d[_0x3a4f2a];return _0x3b8b3e;};'use strict';var multer=require(_0xdf62('0x0'));var util=require(_0xdf62('0x1'));var path=require('path');var timeout=require(_0xdf62('0x2'));var express=require(_0xdf62('0x3'));var router=express[_0xdf62('0x4')]();var fs_extra=require(_0xdf62('0x5'));var auth=require(_0xdf62('0x6'));var interaction=require(_0xdf62('0x7'));var config=require(_0xdf62('0x8'));var controller=require(_0xdf62('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdf62('0xa')]('/:id',auth[_0xdf62('0xb')](),controller[_0xdf62('0xc')]);router[_0xdf62('0xd')]('/',auth[_0xdf62('0xb')](),controller[_0xdf62('0xe')]);router[_0xdf62('0xf')](_0xdf62('0x10'),auth[_0xdf62('0xb')](),controller[_0xdf62('0x11')]);router['delete'](_0xdf62('0x10'),auth['isAuthenticated'](),controller[_0xdf62('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6b6a057..8d2d884 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 _0xa8e4=['STRING','sequelize','exports','ENUM','localnet'];(function(_0xf1ccb4,_0x36665d){var _0x42e5c7=function(_0x2af5e4){while(--_0x2af5e4){_0xf1ccb4['push'](_0xf1ccb4['shift']());}};_0x42e5c7(++_0x36665d);}(_0xa8e4,0x123));var _0x4a8e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xa8e4[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x4a8e('0x0'));module[_0x4a8e('0x1')]={'type':{'type':Sequelize[_0x4a8e('0x2')](_0x4a8e('0x3'),'externip','stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4a8e('0x4')]},'password':{'type':Sequelize[_0x4a8e('0x4')]}}; \ No newline at end of file +var _0x2da1=['STRING','exports','ENUM','localnet','externip','stun'];(function(_0x54e12f,_0x2366b4){var _0x3ce390=function(_0xb29b55){while(--_0xb29b55){_0x54e12f['push'](_0x54e12f['shift']());}};_0x3ce390(++_0x2366b4);}(_0x2da1,0x12d));var _0x12da=function(_0x139794,_0x5d864f){_0x139794=_0x139794-0x0;var _0x307c22=_0x2da1[_0x139794];return _0x307c22;};'use strict';var Sequelize=require('sequelize');module[_0x12da('0x0')]={'type':{'type':Sequelize[_0x12da('0x1')](_0x12da('0x2'),_0x12da('0x3'),_0x12da('0x4'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x12da('0x5')]},'password':{'type':Sequelize[_0x12da('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 120d3fb..2af89bb 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 _0x3206=['client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','end','stack','name','send','map','Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','TURN','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3206,0xa0));var _0x6320=function(_0x2477a2,_0x1c0ee1){_0x2477a2=_0x2477a2-0x0;var _0x4a6676=_0x3206[_0x2477a2];return _0x4a6676;};'use strict';var util=require(_0x6320('0x0'));var path=require(_0x6320('0x1'));var ejs=require(_0x6320('0x2'));var fs=require('fs');var _=require(_0x6320('0x3'));var qs=require(_0x6320('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x6320('0x5'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6320('0x6')][_0x6320('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54f514,_0x31e914,_0x213fe0,_0x37f84a){return new Promise(function(_0x2ba0e5,_0x4419be){var _0xb3f969=_0x37f84a||client;return _0xb3f969['request'](_0x54f514,_0x213fe0)[_0x6320('0x8')](function(_0x2b00a5){logger[_0x6320('0x9')](_0x6320('0xa'),_0x31e914,_0x6320('0xb'));logger[_0x6320('0xc')](_0x6320('0xd'),_0x31e914,'request\x20sent',JSON[_0x6320('0xe')](_0x2b00a5));if(_0x2b00a5[_0x6320('0xf')]){if(_0x2b00a5[_0x6320('0xf')]['code']===0x1f4){logger['error'](_0x6320('0xa'),_0x31e914,_0x2b00a5[_0x6320('0xf')][_0x6320('0x10')]);return _0x4419be(_0x2b00a5[_0x6320('0xf')]['message']);}logger['error'](_0x6320('0xa'),_0x31e914,_0x2b00a5[_0x6320('0xf')][_0x6320('0x10')]);return _0x2ba0e5(_0x2b00a5['error'][_0x6320('0x10')]);}else{logger[_0x6320('0x9')](_0x6320('0xa'),_0x31e914,_0x6320('0xb'));_0x2ba0e5(_0x2b00a5[_0x6320('0x11')][_0x6320('0x10')]);}})[_0x6320('0x12')](function(_0x2e89f8){logger['error'](_0x6320('0xa'),_0x31e914,_0x2e89f8);_0x4419be(_0x2e89f8);});});}function respondWithResult(_0x509a01,_0x497a90){_0x497a90=_0x497a90||0xc8;return function(_0x178a7a){if(_0x178a7a){return _0x509a01['status'](_0x497a90)[_0x6320('0x13')](_0x178a7a);}};}function respondWithFilteredResult(_0x36364b,_0x209eca){return function(_0x1bf363){if(_0x1bf363){var _0x9aac29=typeof _0x209eca[_0x6320('0x14')]===_0x6320('0x15')&&typeof _0x209eca[_0x6320('0x16')]===_0x6320('0x15');var _0xd23809=_0x1bf363[_0x6320('0x17')];var _0x5ef293=_0x9aac29?0x0:_0x209eca[_0x6320('0x14')];var _0x3a6e12=_0x9aac29?_0x1bf363[_0x6320('0x17')]:_0x209eca[_0x6320('0x14')]+_0x209eca[_0x6320('0x16')];var _0x67eea8;if(_0x3a6e12>=_0xd23809){_0x3a6e12=_0xd23809;_0x67eea8=0xc8;}else{_0x67eea8=0xce;}_0x36364b[_0x6320('0x18')](_0x67eea8);return _0x36364b[_0x6320('0x19')](_0x6320('0x1a'),_0x5ef293+'-'+_0x3a6e12+'/'+_0xd23809)[_0x6320('0x13')](_0x1bf363);}return null;};}function saveUpdates(_0xc46d99){return function(_0x50c5d6){if(_0x50c5d6){return _0x50c5d6[_0x6320('0x1b')](_0xc46d99)[_0x6320('0x8')](function(_0x244840){return _0x244840;});}return null;};}function removeEntity(_0x506151){return function(_0x3151cf){if(_0x3151cf){return _0x3151cf['destroy']()[_0x6320('0x8')](function(){_0x506151[_0x6320('0x18')](0xcc)[_0x6320('0x1c')]();});}};}function handleEntityNotFound(_0xff1443){return function(_0x1b2a5a){if(!_0x1b2a5a){_0xff1443['sendStatus'](0x194);}return _0x1b2a5a;};}function handleError(_0x3c1e66,_0x5a1d45){_0x5a1d45=_0x5a1d45||0x1f4;return function(_0x1197b4){logger[_0x6320('0xf')](_0x1197b4[_0x6320('0x1d')]);if(_0x1197b4[_0x6320('0x1e')]){delete _0x1197b4[_0x6320('0x1e')];}_0x3c1e66[_0x6320('0x18')](_0x5a1d45)[_0x6320('0x1f')](_0x1197b4);};}exports['index']=function(_0x51073c,_0x542324){var _0x39097c={},_0x4e35b7={},_0x28081a={'count':0x0,'rows':[]};var _0xa17fde=_[_0x6320('0x20')](db[_0x6320('0x21')][_0x6320('0x22')],function(_0x371687){return{'name':_0x371687[_0x6320('0x23')],'type':_0x371687[_0x6320('0x24')]['key']};});_0x4e35b7[_0x6320('0x25')]=_[_0x6320('0x20')](_0xa17fde,_0x6320('0x1e'));_0x4e35b7[_0x6320('0x26')]=_[_0x6320('0x27')](_0x51073c[_0x6320('0x26')]);_0x4e35b7[_0x6320('0x28')]=_[_0x6320('0x29')](_0x4e35b7['model'],_0x4e35b7['query']);_0x39097c[_0x6320('0x2a')]=_[_0x6320('0x29')](_0x4e35b7[_0x6320('0x25')],qs[_0x6320('0x2b')](_0x51073c['query']['fields']));_0x39097c['attributes']=_0x39097c['attributes'][_0x6320('0x2c')]?_0x39097c['attributes']:_0x4e35b7[_0x6320('0x25')];if(!_0x51073c[_0x6320('0x26')]['hasOwnProperty'](_0x6320('0x2d'))){_0x39097c['limit']=qs[_0x6320('0x16')](_0x51073c[_0x6320('0x26')][_0x6320('0x16')]);_0x39097c[_0x6320('0x14')]=qs[_0x6320('0x14')](_0x51073c['query']['offset']);}_0x39097c[_0x6320('0x2e')]=qs['sort'](_0x51073c[_0x6320('0x26')][_0x6320('0x2f')]);_0x39097c[_0x6320('0x30')]=qs['filters'](_[_0x6320('0x31')](_0x51073c[_0x6320('0x26')],_0x4e35b7['filters']),_0xa17fde);if(_0x51073c['query']['filter']){_0x39097c[_0x6320('0x30')]=_[_0x6320('0x32')](_0x39097c['where'],{'$or':_[_0x6320('0x20')](_0xa17fde,function(_0x4c89ee){if(_0x4c89ee[_0x6320('0x24')]!==_0x6320('0x33')){var _0x3598f7={};_0x3598f7[_0x4c89ee[_0x6320('0x1e')]]={'$like':'%'+_0x51073c[_0x6320('0x26')]['filter']+'%'};return _0x3598f7;}})});}_0x39097c=_[_0x6320('0x32')]({},_0x39097c,_0x51073c[_0x6320('0x34')]);var _0x1677e6={'where':_0x39097c[_0x6320('0x30')]};return db['Network'][_0x6320('0x17')](_0x1677e6)['then'](function(_0x4b877a){_0x28081a[_0x6320('0x17')]=_0x4b877a;if(_0x51073c[_0x6320('0x26')]['includeAll']){_0x39097c[_0x6320('0x35')]=[{'all':!![]}];}return db['Network'][_0x6320('0x36')](_0x39097c);})[_0x6320('0x8')](function(_0x46dc42){_0x28081a[_0x6320('0x37')]=_0x46dc42;return _0x28081a;})[_0x6320('0x8')](respondWithFilteredResult(_0x542324,_0x39097c))[_0x6320('0x12')](handleError(_0x542324,null));};exports[_0x6320('0x38')]=function(_0x716e16,_0x568f2e){var _0xb42612={'raw':!![],'where':{'id':_0x716e16[_0x6320('0x39')]['id']}},_0x37dabd={};_0x37dabd['model']=_['keys'](db[_0x6320('0x21')][_0x6320('0x22')]);_0x37dabd[_0x6320('0x26')]=_[_0x6320('0x27')](_0x716e16[_0x6320('0x26')]);_0x37dabd[_0x6320('0x28')]=_[_0x6320('0x29')](_0x37dabd[_0x6320('0x25')],_0x37dabd[_0x6320('0x26')]);_0xb42612[_0x6320('0x2a')]=_[_0x6320('0x29')](_0x37dabd['model'],qs[_0x6320('0x2b')](_0x716e16['query'][_0x6320('0x2b')]));_0xb42612[_0x6320('0x2a')]=_0xb42612['attributes'][_0x6320('0x2c')]?_0xb42612[_0x6320('0x2a')]:_0x37dabd[_0x6320('0x25')];if(_0x716e16[_0x6320('0x26')][_0x6320('0x3a')]){_0xb42612[_0x6320('0x35')]=[{'all':!![]}];}_0xb42612=_[_0x6320('0x32')]({},_0xb42612,_0x716e16[_0x6320('0x34')]);return db['Network'][_0x6320('0x3b')](_0xb42612)[_0x6320('0x8')](handleEntityNotFound(_0x568f2e,null))[_0x6320('0x8')](respondWithResult(_0x568f2e,null))['catch'](handleError(_0x568f2e,null));};exports[_0x6320('0x3c')]=function(_0x331540,_0x4efb0a){var _0x4958ed;return db[_0x6320('0x21')][_0x6320('0x3c')](_0x331540['body'],{'raw':!![]})[_0x6320('0x8')](function(_0x9f4344){_0x4958ed=_0x9f4344;return db['Network'][_0x6320('0x36')]({'where':{'type':_0x331540[_0x6320('0x3d')]['type']},'raw':!![]});})['then'](function(_0x27cb83){if(_0x4958ed[_0x6320('0x24')][_0x6320('0x3e')]()==_0x6320('0x3f')){var _0x35a3ef=fs[_0x6320('0x40')](path[_0x6320('0x41')](config[_0x6320('0x42')],_0x6320('0x43')),_0x6320('0x44'));var _0x4e0619=ejs[_0x6320('0x45')](_0x35a3ef,{'networks':_0x27cb83||[]});fs['writeFileSync'](_0x6320('0x46'),_0x4e0619);return respondWithRpcPromise(_0x6320('0x47'),_0x6320('0x3c'),{'module':_0x6320('0x48')});}else if(_0x4958ed['type'][_0x6320('0x3e')]()=='TURN'){var _0x52a56b=fs[_0x6320('0x40')](path['join'](config[_0x6320('0x42')],_0x6320('0x49')),_0x6320('0x44'));var _0x53856d=ejs[_0x6320('0x45')](_0x52a56b,{'networks':_0x27cb83||[]});fs[_0x6320('0x4a')](_0x6320('0x4b'),_0x53856d);return respondWithRpcPromise(_0x6320('0x47'),_0x6320('0x3c'),{'module':_0x6320('0x48')});}else{var _0x207239=fs[_0x6320('0x40')](path[_0x6320('0x41')](config[_0x6320('0x42')],_0x6320('0x4c')),'utf8');var _0x1d2c83=ejs[_0x6320('0x45')](_0x207239,{'networks':_0x27cb83||[]});fs[_0x6320('0x4a')](util[_0x6320('0x4d')](_0x6320('0x4e'),_0x331540[_0x6320('0x3d')]['type'][_0x6320('0x4f')]()),_0x1d2c83);return respondWithRpcPromise(_0x6320('0x47'),_0x6320('0x3c'),{'module':_0x6320('0x50')});}})[_0x6320('0x8')](function(){return _0x4958ed;})[_0x6320('0x8')](respondWithResult(_0x4efb0a,0xc9))[_0x6320('0x12')](handleError(_0x4efb0a,null));};exports[_0x6320('0x1b')]=function(_0x47314a,_0x407103){var _0xaf99e4;return db[_0x6320('0x21')]['find']({'where':{'id':_0x47314a[_0x6320('0x39')]['id']}})['then'](handleEntityNotFound(_0x407103,null))[_0x6320('0x8')](saveUpdates(_0x47314a[_0x6320('0x3d')],null))[_0x6320('0x8')](function(_0x789467){if(_0x789467){_0xaf99e4=_0x789467;return db[_0x6320('0x21')][_0x6320('0x36')]({'where':{'type':_0xaf99e4[_0x6320('0x24')]},'raw':!![]});}return null;})[_0x6320('0x8')](function(_0xf89e03){if(_0xaf99e4['type']['toUpperCase']()==_0x6320('0x3f')){var _0x53a893=fs['readFileSync'](path[_0x6320('0x41')](config['root'],_0x6320('0x43')),'utf8');var _0x59f4fc=ejs[_0x6320('0x45')](_0x53a893,{'networks':_0xf89e03||[]});fs[_0x6320('0x4a')](_0x6320('0x46'),_0x59f4fc);return respondWithRpcPromise(_0x6320('0x47'),_0x6320('0x1b'),{'module':_0x6320('0x48')});}else if(_0xaf99e4['type'][_0x6320('0x3e')]()==_0x6320('0x51')){var _0x379f2a=fs[_0x6320('0x40')](path[_0x6320('0x41')](config[_0x6320('0x42')],_0x6320('0x49')),_0x6320('0x44'));var _0x46abab=ejs['render'](_0x379f2a,{'networks':_0xf89e03||[]});fs['writeFileSync'](_0x6320('0x4b'),_0x46abab);return respondWithRpcPromise(_0x6320('0x47'),_0x6320('0x1b'),{'module':_0x6320('0x48')});}else{var _0x3fff08=fs['readFileSync'](path[_0x6320('0x41')](config[_0x6320('0x42')],_0x6320('0x4c')),_0x6320('0x44'));var _0x3ad5a2=ejs[_0x6320('0x45')](_0x3fff08,{'networks':_0xf89e03||[]});fs[_0x6320('0x4a')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x47314a['body'][_0x6320('0x24')][_0x6320('0x4f')]()),_0x3ad5a2);return respondWithRpcPromise(_0x6320('0x47'),_0x6320('0x1b'),{'module':_0x6320('0x50')});}})[_0x6320('0x8')](function(_0x2daf03){if(_0x2daf03){return _0xaf99e4;}return null;})[_0x6320('0x8')](respondWithResult(_0x407103,null))['catch'](handleError(_0x407103,null));};exports[_0x6320('0x52')]=function(_0x4b7b01,_0xbbb692){var _0x28f88c;return db[_0x6320('0x21')][_0x6320('0x3b')]({'where':{'id':_0x4b7b01[_0x6320('0x39')]['id']}})[_0x6320('0x8')](function(_0x5be813){_0x28f88c=_0x5be813;return _0x5be813;})[_0x6320('0x8')](handleEntityNotFound(_0xbbb692,null))[_0x6320('0x8')](removeEntity(_0xbbb692,null))['then'](function(){if(_0x28f88c){return db[_0x6320('0x21')][_0x6320('0x36')]({'where':{'type':_0x28f88c[_0x6320('0x24')]},'raw':!![]});}})[_0x6320('0x8')](function(_0x4253c4){if(_0x28f88c[_0x6320('0x24')][_0x6320('0x3e')]()==_0x6320('0x3f')){var _0x41638c=fs[_0x6320('0x40')](path[_0x6320('0x41')](config[_0x6320('0x42')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x50c980=ejs[_0x6320('0x45')](_0x41638c,{'networks':_0x4253c4||[]});fs['writeFileSync'](_0x6320('0x46'),_0x50c980);return respondWithRpcPromise(_0x6320('0x47'),'destroy',{'module':_0x6320('0x48')});}else if(_0x28f88c[_0x6320('0x24')][_0x6320('0x3e')]()==_0x6320('0x51')){var _0x4db458=fs['readFileSync'](path['join'](config[_0x6320('0x42')],'server/files/templates/turn_multiple.ejs'),_0x6320('0x44'));var _0x3e209d=ejs[_0x6320('0x45')](_0x4db458,{'networks':_0x4253c4||[]});fs[_0x6320('0x4a')]('/etc/asterisk/turn_xcally.conf',_0x3e209d);return respondWithRpcPromise(_0x6320('0x47'),_0x6320('0x52'),{'module':_0x6320('0x48')});}else{var _0x1a1552=fs[_0x6320('0x40')](path[_0x6320('0x41')](config[_0x6320('0x42')],_0x6320('0x4c')),_0x6320('0x44'));var _0x49b270=ejs['render'](_0x1a1552,{'networks':_0x4253c4||[]});fs['writeFileSync'](util[_0x6320('0x4d')](_0x6320('0x4e'),_0x28f88c[_0x6320('0x24')][_0x6320('0x4f')]()),_0x49b270);return respondWithRpcPromise('Reload',_0x6320('0x52'),{'module':_0x6320('0x50')});}})['catch'](handleError(_0xbbb692,null));}; \ No newline at end of file +var _0x9d97=['where','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','length','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','STUN','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','params','util','path','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort'];(function(_0x5af51b,_0x5279c0){var _0x246f67=function(_0x5481b5){while(--_0x5481b5){_0x5af51b['push'](_0x5af51b['shift']());}};_0x246f67(++_0x5279c0);}(_0x9d97,0xce));var _0x79d9=function(_0x15b733,_0xcfa408){_0x15b733=_0x15b733-0x0;var _0x469bc8=_0x9d97[_0x15b733];return _0x469bc8;};'use strict';var util=require(_0x79d9('0x0'));var path=require(_0x79d9('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x79d9('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x79d9('0x3'))(_0x79d9('0x4'));var config=require(_0x79d9('0x5'));var db=require(_0x79d9('0x6'))['db'];var jayson=require(_0x79d9('0x7'));var client=jayson[_0x79d9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x170143,_0x3b2235,_0x1aa343,_0x58ad33){return new Promise(function(_0x2d7a87,_0x4d1f12){var _0x2401ee=_0x58ad33||client;return _0x2401ee[_0x79d9('0x9')](_0x170143,_0x1aa343)[_0x79d9('0xa')](function(_0x4c0a18){logger[_0x79d9('0xb')](_0x79d9('0xc'),_0x3b2235,_0x79d9('0xd'));logger[_0x79d9('0xe')](_0x79d9('0xf'),_0x3b2235,_0x79d9('0xd'),JSON['stringify'](_0x4c0a18));if(_0x4c0a18['error']){if(_0x4c0a18[_0x79d9('0x10')][_0x79d9('0x11')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x3b2235,_0x4c0a18['error'][_0x79d9('0x12')]);return _0x4d1f12(_0x4c0a18[_0x79d9('0x10')][_0x79d9('0x12')]);}logger[_0x79d9('0x10')](_0x79d9('0xc'),_0x3b2235,_0x4c0a18['error'][_0x79d9('0x12')]);return _0x2d7a87(_0x4c0a18[_0x79d9('0x10')][_0x79d9('0x12')]);}else{logger[_0x79d9('0xb')]('Network,\x20%s,\x20%s',_0x3b2235,_0x79d9('0xd'));_0x2d7a87(_0x4c0a18['result']['message']);}})[_0x79d9('0x13')](function(_0x260f05){logger['error']('Network,\x20%s,\x20%s',_0x3b2235,_0x260f05);_0x4d1f12(_0x260f05);});});}function respondWithResult(_0x5d391b,_0x2091cc){_0x2091cc=_0x2091cc||0xc8;return function(_0x4b01f4){if(_0x4b01f4){return _0x5d391b[_0x79d9('0x14')](_0x2091cc)[_0x79d9('0x15')](_0x4b01f4);}};}function respondWithFilteredResult(_0x27b9e0,_0x4a96a2){return function(_0x1086e9){if(_0x1086e9){var _0x39fafd=typeof _0x4a96a2[_0x79d9('0x16')]===_0x79d9('0x17')&&typeof _0x4a96a2[_0x79d9('0x18')]==='undefined';var _0x27148d=_0x1086e9[_0x79d9('0x19')];var _0x5ac436=_0x39fafd?0x0:_0x4a96a2[_0x79d9('0x16')];var _0x29f54d=_0x39fafd?_0x1086e9[_0x79d9('0x19')]:_0x4a96a2[_0x79d9('0x16')]+_0x4a96a2[_0x79d9('0x18')];var _0x109167;if(_0x29f54d>=_0x27148d){_0x29f54d=_0x27148d;_0x109167=0xc8;}else{_0x109167=0xce;}_0x27b9e0[_0x79d9('0x14')](_0x109167);return _0x27b9e0[_0x79d9('0x1a')](_0x79d9('0x1b'),_0x5ac436+'-'+_0x29f54d+'/'+_0x27148d)[_0x79d9('0x15')](_0x1086e9);}return null;};}function saveUpdates(_0x3265c6){return function(_0x255cd9){if(_0x255cd9){return _0x255cd9[_0x79d9('0x1c')](_0x3265c6)[_0x79d9('0xa')](function(_0xcedee){return _0xcedee;});}return null;};}function removeEntity(_0x34e059){return function(_0x233988){if(_0x233988){return _0x233988[_0x79d9('0x1d')]()['then'](function(){_0x34e059[_0x79d9('0x14')](0xcc)[_0x79d9('0x1e')]();});}};}function handleEntityNotFound(_0x24eeb4){return function(_0xe0a46c){if(!_0xe0a46c){_0x24eeb4['sendStatus'](0x194);}return _0xe0a46c;};}function handleError(_0x540a87,_0x5547c5){_0x5547c5=_0x5547c5||0x1f4;return function(_0x695598){logger['error'](_0x695598[_0x79d9('0x1f')]);if(_0x695598[_0x79d9('0x20')]){delete _0x695598[_0x79d9('0x20')];}_0x540a87[_0x79d9('0x14')](_0x5547c5)[_0x79d9('0x21')](_0x695598);};}exports[_0x79d9('0x22')]=function(_0x322d8e,_0x4b3e61){var _0x38fc49={},_0x30dabb={},_0x3f93a5={'count':0x0,'rows':[]};var _0x45c0a9=_[_0x79d9('0x23')](db['Network'][_0x79d9('0x24')],function(_0x5a40a6){return{'name':_0x5a40a6[_0x79d9('0x25')],'type':_0x5a40a6[_0x79d9('0x26')]['key']};});_0x30dabb[_0x79d9('0x27')]=_[_0x79d9('0x23')](_0x45c0a9,_0x79d9('0x20'));_0x30dabb[_0x79d9('0x28')]=_[_0x79d9('0x29')](_0x322d8e[_0x79d9('0x28')]);_0x30dabb[_0x79d9('0x2a')]=_[_0x79d9('0x2b')](_0x30dabb[_0x79d9('0x27')],_0x30dabb[_0x79d9('0x28')]);_0x38fc49['attributes']=_['intersection'](_0x30dabb['model'],qs[_0x79d9('0x2c')](_0x322d8e[_0x79d9('0x28')][_0x79d9('0x2c')]));_0x38fc49[_0x79d9('0x2d')]=_0x38fc49[_0x79d9('0x2d')]['length']?_0x38fc49[_0x79d9('0x2d')]:_0x30dabb[_0x79d9('0x27')];if(!_0x322d8e[_0x79d9('0x28')][_0x79d9('0x2e')]('nolimit')){_0x38fc49[_0x79d9('0x18')]=qs[_0x79d9('0x18')](_0x322d8e[_0x79d9('0x28')][_0x79d9('0x18')]);_0x38fc49[_0x79d9('0x16')]=qs[_0x79d9('0x16')](_0x322d8e[_0x79d9('0x28')][_0x79d9('0x16')]);}_0x38fc49[_0x79d9('0x2f')]=qs['sort'](_0x322d8e[_0x79d9('0x28')][_0x79d9('0x30')]);_0x38fc49[_0x79d9('0x31')]=qs[_0x79d9('0x2a')](_[_0x79d9('0x32')](_0x322d8e[_0x79d9('0x28')],_0x30dabb[_0x79d9('0x2a')]),_0x45c0a9);if(_0x322d8e[_0x79d9('0x28')][_0x79d9('0x33')]){_0x38fc49['where']=_[_0x79d9('0x34')](_0x38fc49[_0x79d9('0x31')],{'$or':_[_0x79d9('0x23')](_0x45c0a9,function(_0x367eb5){if(_0x367eb5[_0x79d9('0x26')]!==_0x79d9('0x35')){var _0x12c2ed={};_0x12c2ed[_0x367eb5[_0x79d9('0x20')]]={'$like':'%'+_0x322d8e[_0x79d9('0x28')][_0x79d9('0x33')]+'%'};return _0x12c2ed;}})});}_0x38fc49=_['merge']({},_0x38fc49,_0x322d8e[_0x79d9('0x36')]);var _0x2a4597={'where':_0x38fc49[_0x79d9('0x31')]};return db[_0x79d9('0x37')]['count'](_0x2a4597)[_0x79d9('0xa')](function(_0x4d8c73){_0x3f93a5[_0x79d9('0x19')]=_0x4d8c73;if(_0x322d8e[_0x79d9('0x28')][_0x79d9('0x38')]){_0x38fc49[_0x79d9('0x39')]=[{'all':!![]}];}return db[_0x79d9('0x37')][_0x79d9('0x3a')](_0x38fc49);})['then'](function(_0x257ba6){_0x3f93a5[_0x79d9('0x3b')]=_0x257ba6;return _0x3f93a5;})[_0x79d9('0xa')](respondWithFilteredResult(_0x4b3e61,_0x38fc49))['catch'](handleError(_0x4b3e61,null));};exports[_0x79d9('0x3c')]=function(_0x2fb63c,_0xc7921b){var _0x247c6f={'raw':!![],'where':{'id':_0x2fb63c['params']['id']}},_0x3f28a4={};_0x3f28a4['model']=_['keys'](db['Network'][_0x79d9('0x24')]);_0x3f28a4[_0x79d9('0x28')]=_['keys'](_0x2fb63c[_0x79d9('0x28')]);_0x3f28a4[_0x79d9('0x2a')]=_[_0x79d9('0x2b')](_0x3f28a4[_0x79d9('0x27')],_0x3f28a4[_0x79d9('0x28')]);_0x247c6f[_0x79d9('0x2d')]=_['intersection'](_0x3f28a4['model'],qs[_0x79d9('0x2c')](_0x2fb63c['query'][_0x79d9('0x2c')]));_0x247c6f[_0x79d9('0x2d')]=_0x247c6f[_0x79d9('0x2d')][_0x79d9('0x3d')]?_0x247c6f[_0x79d9('0x2d')]:_0x3f28a4[_0x79d9('0x27')];if(_0x2fb63c[_0x79d9('0x28')][_0x79d9('0x38')]){_0x247c6f['include']=[{'all':!![]}];}_0x247c6f=_[_0x79d9('0x34')]({},_0x247c6f,_0x2fb63c[_0x79d9('0x36')]);return db['Network']['find'](_0x247c6f)[_0x79d9('0xa')](handleEntityNotFound(_0xc7921b,null))[_0x79d9('0xa')](respondWithResult(_0xc7921b,null))['catch'](handleError(_0xc7921b,null));};exports[_0x79d9('0x3e')]=function(_0x3591b1,_0x5778da){var _0x4bfff6;return db['Network'][_0x79d9('0x3e')](_0x3591b1['body'],{'raw':!![]})[_0x79d9('0xa')](function(_0x2db632){_0x4bfff6=_0x2db632;return db['Network']['findAll']({'where':{'type':_0x3591b1[_0x79d9('0x3f')]['type']},'raw':!![]});})[_0x79d9('0xa')](function(_0x5355f6){if(_0x4bfff6[_0x79d9('0x26')][_0x79d9('0x40')]()=='STUN'){var _0x3b6f5e=fs[_0x79d9('0x41')](path[_0x79d9('0x42')](config[_0x79d9('0x43')],_0x79d9('0x44')),_0x79d9('0x45'));var _0x114eb1=ejs[_0x79d9('0x46')](_0x3b6f5e,{'networks':_0x5355f6||[]});fs['writeFileSync'](_0x79d9('0x47'),_0x114eb1);return respondWithRpcPromise(_0x79d9('0x48'),'create',{'module':_0x79d9('0x49')});}else if(_0x4bfff6['type'][_0x79d9('0x40')]()==_0x79d9('0x4a')){var _0xacf825=fs[_0x79d9('0x41')](path[_0x79d9('0x42')](config[_0x79d9('0x43')],_0x79d9('0x4b')),_0x79d9('0x45'));var _0x442dc0=ejs[_0x79d9('0x46')](_0xacf825,{'networks':_0x5355f6||[]});fs[_0x79d9('0x4c')](_0x79d9('0x4d'),_0x442dc0);return respondWithRpcPromise(_0x79d9('0x48'),_0x79d9('0x3e'),{'module':'res_stun_monitor.so'});}else{var _0x11fc2d=fs[_0x79d9('0x41')](path[_0x79d9('0x42')](config[_0x79d9('0x43')],_0x79d9('0x4e')),_0x79d9('0x45'));var _0x3eec08=ejs['render'](_0x11fc2d,{'networks':_0x5355f6||[]});fs[_0x79d9('0x4c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3591b1[_0x79d9('0x3f')][_0x79d9('0x26')][_0x79d9('0x4f')]()),_0x3eec08);return respondWithRpcPromise('Reload',_0x79d9('0x3e'),{'module':'chan_sip.so'});}})['then'](function(){return _0x4bfff6;})['then'](respondWithResult(_0x5778da,0xc9))[_0x79d9('0x13')](handleError(_0x5778da,null));};exports[_0x79d9('0x1c')]=function(_0x4fd985,_0x2f7e2b){var _0x2978c3;return db[_0x79d9('0x37')]['find']({'where':{'id':_0x4fd985['params']['id']}})['then'](handleEntityNotFound(_0x2f7e2b,null))[_0x79d9('0xa')](saveUpdates(_0x4fd985[_0x79d9('0x3f')],null))[_0x79d9('0xa')](function(_0x5954b0){if(_0x5954b0){_0x2978c3=_0x5954b0;return db[_0x79d9('0x37')][_0x79d9('0x3a')]({'where':{'type':_0x2978c3['type']},'raw':!![]});}return null;})[_0x79d9('0xa')](function(_0x579642){if(_0x2978c3[_0x79d9('0x26')][_0x79d9('0x40')]()==_0x79d9('0x50')){var _0x3a44a8=fs[_0x79d9('0x41')](path[_0x79d9('0x42')](config['root'],_0x79d9('0x44')),_0x79d9('0x45'));var _0x474768=ejs[_0x79d9('0x46')](_0x3a44a8,{'networks':_0x579642||[]});fs['writeFileSync'](_0x79d9('0x47'),_0x474768);return respondWithRpcPromise(_0x79d9('0x48'),_0x79d9('0x1c'),{'module':_0x79d9('0x49')});}else if(_0x2978c3['type']['toUpperCase']()==_0x79d9('0x4a')){var _0x4e0358=fs[_0x79d9('0x41')](path[_0x79d9('0x42')](config[_0x79d9('0x43')],'server/files/templates/turn_multiple.ejs'),_0x79d9('0x45'));var _0x4ebd53=ejs[_0x79d9('0x46')](_0x4e0358,{'networks':_0x579642||[]});fs[_0x79d9('0x4c')](_0x79d9('0x4d'),_0x4ebd53);return respondWithRpcPromise(_0x79d9('0x48'),_0x79d9('0x1c'),{'module':_0x79d9('0x49')});}else{var _0x542c67=fs['readFileSync'](path[_0x79d9('0x42')](config[_0x79d9('0x43')],'server/files/templates/network.ejs'),_0x79d9('0x45'));var _0x21ef21=ejs[_0x79d9('0x46')](_0x542c67,{'networks':_0x579642||[]});fs[_0x79d9('0x4c')](util[_0x79d9('0x51')](_0x79d9('0x52'),_0x4fd985[_0x79d9('0x3f')][_0x79d9('0x26')][_0x79d9('0x4f')]()),_0x21ef21);return respondWithRpcPromise('Reload',_0x79d9('0x1c'),{'module':_0x79d9('0x53')});}})['then'](function(_0x4e8608){if(_0x4e8608){return _0x2978c3;}return null;})[_0x79d9('0xa')](respondWithResult(_0x2f7e2b,null))[_0x79d9('0x13')](handleError(_0x2f7e2b,null));};exports[_0x79d9('0x1d')]=function(_0x1a0d03,_0x46a5e5){var _0x2c70ad;return db[_0x79d9('0x37')]['find']({'where':{'id':_0x1a0d03[_0x79d9('0x54')]['id']}})[_0x79d9('0xa')](function(_0x543a6f){_0x2c70ad=_0x543a6f;return _0x543a6f;})[_0x79d9('0xa')](handleEntityNotFound(_0x46a5e5,null))[_0x79d9('0xa')](removeEntity(_0x46a5e5,null))[_0x79d9('0xa')](function(){if(_0x2c70ad){return db[_0x79d9('0x37')][_0x79d9('0x3a')]({'where':{'type':_0x2c70ad[_0x79d9('0x26')]},'raw':!![]});}})[_0x79d9('0xa')](function(_0x131316){if(_0x2c70ad[_0x79d9('0x26')]['toUpperCase']()==_0x79d9('0x50')){var _0x156439=fs[_0x79d9('0x41')](path[_0x79d9('0x42')](config[_0x79d9('0x43')],_0x79d9('0x44')),'utf8');var _0x10d37d=ejs[_0x79d9('0x46')](_0x156439,{'networks':_0x131316||[]});fs[_0x79d9('0x4c')]('/etc/asterisk/stun_xcally.conf',_0x10d37d);return respondWithRpcPromise(_0x79d9('0x48'),_0x79d9('0x1d'),{'module':_0x79d9('0x49')});}else if(_0x2c70ad['type']['toUpperCase']()==_0x79d9('0x4a')){var _0x1dcb30=fs['readFileSync'](path[_0x79d9('0x42')](config[_0x79d9('0x43')],_0x79d9('0x4b')),_0x79d9('0x45'));var _0x2ec119=ejs['render'](_0x1dcb30,{'networks':_0x131316||[]});fs[_0x79d9('0x4c')](_0x79d9('0x4d'),_0x2ec119);return respondWithRpcPromise(_0x79d9('0x48'),_0x79d9('0x1d'),{'module':_0x79d9('0x49')});}else{var _0x2a209d=fs[_0x79d9('0x41')](path[_0x79d9('0x42')](config[_0x79d9('0x43')],_0x79d9('0x4e')),_0x79d9('0x45'));var _0x4ea786=ejs[_0x79d9('0x46')](_0x2a209d,{'networks':_0x131316||[]});fs['writeFileSync'](util[_0x79d9('0x51')](_0x79d9('0x52'),_0x2c70ad[_0x79d9('0x26')][_0x79d9('0x4f')]()),_0x4ea786);return respondWithRpcPromise('Reload',_0x79d9('0x1d'),{'module':_0x79d9('0x53')});}})['catch'](handleError(_0x46a5e5,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 532ccf8..5ca96c5 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 _0x4522=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger','api','moment','request-promise'];(function(_0x4554bf,_0x5bcb68){var _0x36cbe3=function(_0x218807){while(--_0x218807){_0x4554bf['push'](_0x4554bf['shift']());}};_0x36cbe3(++_0x5bcb68);}(_0x4522,0x1a0));var _0x2452=function(_0x39af95,_0x4a309a){_0x39af95=_0x39af95-0x0;var _0x275e9f=_0x4522[_0x39af95];return _0x275e9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc9d=['./network.attributes','exports','define','network','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x50a51e,_0x56e813){var _0x8a736e=function(_0x2006a8){while(--_0x2006a8){_0x50a51e['push'](_0x50a51e['shift']());}};_0x8a736e(++_0x56e813);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x375567,_0x17229b){_0x375567=_0x375567-0x0;var _0xf168da=_0xbc9d[_0x375567];return _0xf168da;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var logger=require(_0xdbc9('0x2'))(_0xdbc9('0x3'));var moment=require(_0xdbc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var attributes=require(_0xdbc9('0x7'));module[_0xdbc9('0x8')]=function(_0x6ab397,_0x7c4c55){return _0x6ab397[_0xdbc9('0x9')]('Network',attributes,{'tableName':_0xdbc9('0xa'),'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 a17f552..82fb633 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4004c9,_0x593619){_0x4004c9=_0x4004c9-0x0;var _0x2fbd11=_0x7a54[_0x4004c9];return _0x2fbd11;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1ee4fd,_0x5cc2f2){var _0xbea8d6=function(_0x2d9c4e){while(--_0x2d9c4e){_0x1ee4fd['push'](_0x1ee4fd['shift']());}};_0xbea8d6(++_0x5cc2f2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 a0f2d1b..6af0e26 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 _0xbda0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','notify','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer'];(function(_0x3b9703,_0x4ec964){var _0x1bb1cb=function(_0x24622){while(--_0x24622){_0x3b9703['push'](_0x3b9703['shift']());}};_0x1bb1cb(++_0x4ec964);}(_0xbda0,0x8b));var _0x0bda=function(_0x3357ee,_0xe46df8){_0x3357ee=_0x3357ee-0x0;var _0x185293=_0xbda0[_0x3357ee];return _0x185293;};'use strict';var multer=require(_0x0bda('0x0'));var util=require(_0x0bda('0x1'));var path=require(_0x0bda('0x2'));var timeout=require(_0x0bda('0x3'));var express=require(_0x0bda('0x4'));var router=express[_0x0bda('0x5')]();var fs_extra=require(_0x0bda('0x6'));var auth=require(_0x0bda('0x7'));var interaction=require(_0x0bda('0x8'));var config=require(_0x0bda('0x9'));var controller=require(_0x0bda('0xa'));router[_0x0bda('0xb')]('/',auth[_0x0bda('0xc')](),controller[_0x0bda('0xd')]);router[_0x0bda('0xb')](_0x0bda('0xe'),auth[_0x0bda('0xc')](),controller['describe']);router[_0x0bda('0xb')]('/:id',auth[_0x0bda('0xc')](),controller['show']);router['get']('/:id/dispositions',auth[_0x0bda('0xc')](),controller[_0x0bda('0xf')]);router[_0x0bda('0xb')](_0x0bda('0x10'),auth[_0x0bda('0xc')](),controller[_0x0bda('0x11')]);router[_0x0bda('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0bda('0x12')]);router['get'](_0x0bda('0x13'),auth['isAuthenticated'](),controller[_0x0bda('0x14')]);router[_0x0bda('0xb')](_0x0bda('0x15'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0bda('0x16')]('/',auth[_0x0bda('0xc')](),controller[_0x0bda('0x17')]);router[_0x0bda('0x16')](_0x0bda('0x18'),auth[_0x0bda('0xc')](),controller[_0x0bda('0x19')]);router[_0x0bda('0x16')](_0x0bda('0x10'),auth[_0x0bda('0xc')](),controller[_0x0bda('0x1a')]);router[_0x0bda('0x16')]('/:id/notify',controller[_0x0bda('0x1b')]);router[_0x0bda('0x16')]('/:id/applications',auth[_0x0bda('0xc')](),controller['addApplications']);router[_0x0bda('0x16')]('/:id/users',auth[_0x0bda('0xc')](),controller['addAgents']);router['post']('/:id/send',auth[_0x0bda('0xc')](),controller['send']);router[_0x0bda('0x1c')](_0x0bda('0x1d'),auth[_0x0bda('0xc')](),controller['update']);router[_0x0bda('0x1e')](_0x0bda('0x1d'),auth[_0x0bda('0xc')](),controller[_0x0bda('0x1f')]);router[_0x0bda('0x1e')](_0x0bda('0x18'),auth['isAuthenticated'](),controller[_0x0bda('0x20')]);router[_0x0bda('0x1e')](_0x0bda('0x10'),auth[_0x0bda('0xc')](),controller[_0x0bda('0x21')]);router[_0x0bda('0x1e')](_0x0bda('0x15'),auth[_0x0bda('0xc')](),controller[_0x0bda('0x22')]);module['exports']=router; \ No newline at end of file +var _0x63aa=['show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','addAnswer','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x329ba0,_0x2e889b){var _0x526123=function(_0x42656e){while(--_0x42656e){_0x329ba0['push'](_0x329ba0['shift']());}};_0x526123(++_0x2e889b);}(_0x63aa,0x17f));var _0xa63a=function(_0x4d2459,_0x36dffd){_0x4d2459=_0x4d2459-0x0;var _0x3bdb67=_0x63aa[_0x4d2459];return _0x3bdb67;};'use strict';var multer=require(_0xa63a('0x0'));var util=require(_0xa63a('0x1'));var path=require(_0xa63a('0x2'));var timeout=require(_0xa63a('0x3'));var express=require(_0xa63a('0x4'));var router=express[_0xa63a('0x5')]();var fs_extra=require(_0xa63a('0x6'));var auth=require(_0xa63a('0x7'));var interaction=require(_0xa63a('0x8'));var config=require(_0xa63a('0x9'));var controller=require(_0xa63a('0xa'));router[_0xa63a('0xb')]('/',auth[_0xa63a('0xc')](),controller[_0xa63a('0xd')]);router[_0xa63a('0xb')](_0xa63a('0xe'),auth[_0xa63a('0xc')](),controller[_0xa63a('0xf')]);router[_0xa63a('0xb')](_0xa63a('0x10'),auth['isAuthenticated'](),controller[_0xa63a('0x11')]);router['get'](_0xa63a('0x12'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xa63a('0x13'),auth[_0xa63a('0xc')](),controller['getAnswers']);router[_0xa63a('0xb')](_0xa63a('0x14'),auth[_0xa63a('0xc')](),controller[_0xa63a('0x15')]);router['get'](_0xa63a('0x16'),auth[_0xa63a('0xc')](),controller[_0xa63a('0x17')]);router[_0xa63a('0xb')](_0xa63a('0x18'),auth[_0xa63a('0xc')](),controller['getAgents']);router[_0xa63a('0x19')]('/',auth[_0xa63a('0xc')](),controller[_0xa63a('0x1a')]);router[_0xa63a('0x19')](_0xa63a('0x12'),auth[_0xa63a('0xc')](),controller[_0xa63a('0x1b')]);router[_0xa63a('0x19')](_0xa63a('0x13'),auth['isAuthenticated'](),controller[_0xa63a('0x1c')]);router[_0xa63a('0x19')]('/:id/notify',controller['notify']);router[_0xa63a('0x19')](_0xa63a('0x14'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/users',auth[_0xa63a('0xc')](),controller[_0xa63a('0x1d')]);router[_0xa63a('0x19')](_0xa63a('0x1e'),auth['isAuthenticated'](),controller[_0xa63a('0x1f')]);router[_0xa63a('0x20')](_0xa63a('0x10'),auth[_0xa63a('0xc')](),controller[_0xa63a('0x21')]);router[_0xa63a('0x22')](_0xa63a('0x10'),auth[_0xa63a('0xc')](),controller[_0xa63a('0x23')]);router[_0xa63a('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa63a('0x24')]);router[_0xa63a('0x22')](_0xa63a('0x13'),auth[_0xa63a('0xc')](),controller[_0xa63a('0x25')]);router[_0xa63a('0x22')](_0xa63a('0x18'),auth['isAuthenticated'](),controller[_0xa63a('0x26')]);module[_0xa63a('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a7faeeb..74a53e6 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 _0x3efd=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','TEXT','BOOLEAN','INTEGER'];(function(_0x541e66,_0x3f1e4a){var _0x26578=function(_0x6261be){while(--_0x6261be){_0x541e66['push'](_0x541e66['shift']());}};_0x26578(++_0x3f1e4a);}(_0x3efd,0x1c7));var _0xd3ef=function(_0x4a28b8,_0x409b7c){_0x4a28b8=_0x4a28b8-0x0;var _0x263293=_0x3efd[_0x4a28b8];return _0x263293;};'use strict';var Sequelize=require(_0xd3ef('0x0'));var rs=require(_0xd3ef('0x1'));module['exports']={'name':{'type':Sequelize[_0xd3ef('0x2')],'unique':_0xd3ef('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd3ef('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xd3ef('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd3ef('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd3ef('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd3ef('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd3ef('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd3ef('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd3ef('0x2')]},'queueTransfer':{'type':Sequelize[_0xd3ef('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd3ef('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd3ef('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd3ef('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xd3ef('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xd3ef('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x566606){if(!_0x566606)this['setDataValue'](_0xd3ef('0x8'),null);this[_0xd3ef('0x9')](_0xd3ef('0xa'),_0x566606);}}}; \ No newline at end of file +var _0x2d53=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN'];(function(_0xa1b0d4,_0xbeba0){var _0x19f06c=function(_0x172a9a){while(--_0x172a9a){_0xa1b0d4['push'](_0xa1b0d4['shift']());}};_0x19f06c(++_0xbeba0);}(_0x2d53,0x184));var _0x32d5=function(_0x4bbe00,_0x1d2f14){_0x4bbe00=_0x4bbe00-0x0;var _0x3999d2=_0x2d53[_0x4bbe00];return _0x3999d2;};'use strict';var Sequelize=require(_0x32d5('0x0'));var rs=require(_0x32d5('0x1'));module['exports']={'name':{'type':Sequelize[_0x32d5('0x2')],'unique':_0x32d5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x32d5('0x2')]},'token':{'type':Sequelize[_0x32d5('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x32d5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x32d5('0x4')],'defaultValue':function(){return _0x32d5('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x32d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x32d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x32d5('0x2')]},'queueTransfer':{'type':Sequelize[_0x32d5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x32d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x32d5('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x32d5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x32d5('0x7')],'defaultValue':![],'comment':_0x32d5('0x9'),'set':function(_0x3014f4){if(!_0x3014f4)this[_0x32d5('0xa')]('mandatoryDispositionPauseId',null);this[_0x32d5('0xa')](_0x32d5('0xb'),_0x3014f4);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 0d58e92..bfa0c34 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 _0x15c6=['notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','OpenchannelApplication','List','account','Applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','applications','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','params','describe','OpenchannelAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers'];(function(_0x19cf0c,_0x3bf582){var _0x3ddc04=function(_0x4a7df4){while(--_0x4a7df4){_0x19cf0c['push'](_0x19cf0c['shift']());}};_0x3ddc04(++_0x3bf582);}(_0x15c6,0x1cd));var _0x615c=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x15c6[_0x176329];return _0x31997c;};'use strict';var emlformat=require(_0x615c('0x0'));var rimraf=require(_0x615c('0x1'));var zipdir=require(_0x615c('0x2'));var jsonpatch=require(_0x615c('0x3'));var rp=require(_0x615c('0x4'));var moment=require(_0x615c('0x5'));var BPromise=require(_0x615c('0x6'));var Mustache=require(_0x615c('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x615c('0x8'));var ejs=require(_0x615c('0x9'));var fs=require('fs');var fs_extra=require(_0x615c('0xa'));var _=require('lodash');var squel=require(_0x615c('0xb'));var crypto=require(_0x615c('0xc'));var jsforce=require(_0x615c('0xd'));var deskjs=require(_0x615c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x615c('0xf'));var Papa=require('papaparse');var Redis=require(_0x615c('0x10'));var authService=require(_0x615c('0x11'));var qs=require(_0x615c('0x12'));var as=require(_0x615c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x615c('0x14'));var utils=require(_0x615c('0x15'));var config=require(_0x615c('0x16'));var licenseUtil=require(_0x615c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x615c('0x18')](config[_0x615c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x615c('0x1a'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x615c('0x1b')](socket);var jayson=require(_0x615c('0x1c'));var client=jayson[_0x615c('0x1d')][_0x615c('0x1e')]({'port':0x232c});var client9002=jayson[_0x615c('0x1d')][_0x615c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x55ec9e,_0x2d10d2,_0x41dee1,_0x30205d){return new BPromise(function(_0x48d049,_0x3022bd){var _0x3953aa=_0x30205d||client;return _0x3953aa[_0x615c('0x1f')](_0x55ec9e,_0x41dee1)[_0x615c('0x20')](function(_0x1badec){logger[_0x615c('0x21')](_0x615c('0x22'),_0x2d10d2,_0x615c('0x23'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2d10d2,'request\x20sent',JSON[_0x615c('0x24')](_0x1badec));if(_0x1badec[_0x615c('0x25')]){if(_0x1badec[_0x615c('0x25')][_0x615c('0x26')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2d10d2,_0x1badec[_0x615c('0x25')]['message']);return _0x3022bd(_0x1badec[_0x615c('0x25')]['message']);}logger[_0x615c('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x2d10d2,_0x1badec[_0x615c('0x25')][_0x615c('0x27')]);return _0x48d049(_0x1badec['error']['message']);}else{logger[_0x615c('0x21')](_0x615c('0x22'),_0x2d10d2,_0x615c('0x23'));_0x48d049(_0x1badec[_0x615c('0x28')][_0x615c('0x27')]);}})['catch'](function(_0x32635f){logger[_0x615c('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x2d10d2,_0x32635f);_0x3022bd(_0x32635f);});});}function respondWithStatusCode(_0x49a14a,_0x35ccef){_0x35ccef=_0x35ccef||0xcc;return function(_0x3bcff0){if(_0x3bcff0){return _0x49a14a[_0x615c('0x29')](_0x35ccef);}return _0x49a14a['status'](_0x35ccef)[_0x615c('0x2a')]();};}function respondWithResult(_0x2ad4cc,_0x457f7b){_0x457f7b=_0x457f7b||0xc8;return function(_0x63e725){if(_0x63e725){return _0x2ad4cc['status'](_0x457f7b)[_0x615c('0x2b')](_0x63e725);}};}function respondWithFilteredResult(_0x174259,_0x2a4d37){return function(_0x263f90){if(_0x263f90){var _0x41866b=typeof _0x2a4d37[_0x615c('0x2c')]===_0x615c('0x2d')&&typeof _0x2a4d37[_0x615c('0x2e')]===_0x615c('0x2d');var _0x4593f5=_0x263f90[_0x615c('0x2f')];var _0x1ffab6=_0x41866b?0x0:_0x2a4d37[_0x615c('0x2c')];var _0x167424=_0x41866b?_0x263f90['count']:_0x2a4d37[_0x615c('0x2c')]+_0x2a4d37[_0x615c('0x2e')];var _0xaf6d0d;if(_0x167424>=_0x4593f5){_0x167424=_0x4593f5;_0xaf6d0d=0xc8;}else{_0xaf6d0d=0xce;}_0x174259[_0x615c('0x30')](_0xaf6d0d);return _0x174259[_0x615c('0x31')](_0x615c('0x32'),_0x1ffab6+'-'+_0x167424+'/'+_0x4593f5)['json'](_0x263f90);}return null;};}function patchUpdates(_0xecda5d){return function(_0x25c40a){try{jsonpatch[_0x615c('0x33')](_0x25c40a,_0xecda5d,!![]);}catch(_0xcd2b9d){return BPromise[_0x615c('0x34')](_0xcd2b9d);}return _0x25c40a['save']();};}function saveUpdates(_0xc10e,_0x5b02b6){return function(_0x5ff9c1){if(_0x5ff9c1){return _0x5ff9c1[_0x615c('0x35')](_0xc10e)[_0x615c('0x20')](function(_0x248423){return _0x248423;});}return null;};}function removeEntity(_0x14926e,_0x3d82b5){return function(_0x48de1b){if(_0x48de1b){return _0x48de1b[_0x615c('0x36')]()[_0x615c('0x20')](function(){var _0x2e5df7=_0x48de1b[_0x615c('0x37')]({'plain':!![]});var _0x29069b=_0x615c('0x38');return db[_0x615c('0x39')]['destroy']({'where':{'type':_0x29069b,'resourceId':_0x2e5df7['id']}})[_0x615c('0x20')](function(){return _0x48de1b;});})[_0x615c('0x20')](function(){_0x14926e[_0x615c('0x30')](0xcc)[_0x615c('0x2a')]();});}};}function handleEntityNotFound(_0x51e956,_0x253cc8){return function(_0x17f3bb){if(!_0x17f3bb){_0x51e956[_0x615c('0x29')](0x194);}return _0x17f3bb;};}function handleError(_0x4330ed,_0x4dffb8){_0x4dffb8=_0x4dffb8||0x1f4;return function(_0x5dfd6d){logger[_0x615c('0x25')](_0x5dfd6d[_0x615c('0x3a')]);if(_0x5dfd6d[_0x615c('0x3b')]){delete _0x5dfd6d['name'];}_0x4330ed[_0x615c('0x30')](_0x4dffb8)[_0x615c('0x3c')](_0x5dfd6d);};}exports[_0x615c('0x3d')]=function(_0x195548,_0x57b921){var _0x5b969f={'include':[{'model':db[_0x615c('0x3e')],'as':_0x615c('0x3f')}]},_0x3395f6={},_0x595bed={'count':0x0,'rows':[]};var _0xa59935=_['map'](db[_0x615c('0x40')][_0x615c('0x41')],function(_0x1acf56){return{'name':_0x1acf56[_0x615c('0x42')],'type':_0x1acf56[_0x615c('0x43')]['key']};});_0x3395f6[_0x615c('0x44')]=_[_0x615c('0x45')](_0xa59935,'name');_0x3395f6['query']=_['keys'](_0x195548[_0x615c('0x46')]);_0x3395f6[_0x615c('0x47')]=_['intersection'](_0x3395f6['model'],_0x3395f6[_0x615c('0x46')]);_0x5b969f[_0x615c('0x48')]=_[_0x615c('0x49')](_0x3395f6[_0x615c('0x44')],qs[_0x615c('0x4a')](_0x195548[_0x615c('0x46')][_0x615c('0x4a')]));_0x5b969f[_0x615c('0x48')]=_0x5b969f[_0x615c('0x48')][_0x615c('0x4b')]?_0x5b969f['attributes']:_0x3395f6[_0x615c('0x44')];if(!_0x195548[_0x615c('0x46')][_0x615c('0x4c')](_0x615c('0x4d'))){_0x5b969f['limit']=qs[_0x615c('0x2e')](_0x195548[_0x615c('0x46')][_0x615c('0x2e')]);_0x5b969f[_0x615c('0x2c')]=qs[_0x615c('0x2c')](_0x195548[_0x615c('0x46')]['offset']);}_0x5b969f[_0x615c('0x4e')]=qs['sort'](_0x195548['query'][_0x615c('0x4f')]);_0x5b969f['where']=qs[_0x615c('0x47')](_[_0x615c('0x50')](_0x195548[_0x615c('0x46')],_0x3395f6[_0x615c('0x47')]),_0xa59935);if(_0x195548[_0x615c('0x46')][_0x615c('0x51')]){_0x5b969f[_0x615c('0x52')]=_['merge'](_0x5b969f[_0x615c('0x52')],{'$or':_[_0x615c('0x45')](_0xa59935,function(_0x4b4362){if(_0x4b4362[_0x615c('0x43')]!==_0x615c('0x53')){var _0xbaa3f7={};_0xbaa3f7[_0x4b4362['name']]={'$like':'%'+_0x195548[_0x615c('0x46')][_0x615c('0x51')]+'%'};return _0xbaa3f7;}})});}_0x5b969f=_[_0x615c('0x54')]({},_0x5b969f,_0x195548['options']);var _0x1bd4f1={'where':_0x5b969f['where']};return db[_0x615c('0x40')][_0x615c('0x2f')](_0x1bd4f1)[_0x615c('0x20')](function(_0x1a8aeb){_0x595bed[_0x615c('0x2f')]=_0x1a8aeb;if(_0x195548['query'][_0x615c('0x55')]){_0x5b969f[_0x615c('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x615c('0x57')](_0x5b969f);})['then'](function(_0x25b4e7){_0x595bed[_0x615c('0x58')]=_0x25b4e7;return _0x595bed;})[_0x615c('0x20')](respondWithFilteredResult(_0x57b921,_0x5b969f))[_0x615c('0x59')](handleError(_0x57b921,null));};exports[_0x615c('0x5a')]=function(_0x1bee36,_0x71a8d7){var _0x36e911={'raw':![],'where':{'id':_0x1bee36['params']['id']},'include':[{'model':db[_0x615c('0x3e')],'as':_0x615c('0x3f')}]},_0x2ccd7c={};_0x2ccd7c['model']=_[_0x615c('0x5b')](db[_0x615c('0x40')][_0x615c('0x41')]);_0x2ccd7c[_0x615c('0x46')]=_[_0x615c('0x5b')](_0x1bee36['query']);_0x2ccd7c['filters']=_[_0x615c('0x49')](_0x2ccd7c[_0x615c('0x44')],_0x2ccd7c[_0x615c('0x46')]);_0x36e911[_0x615c('0x48')]=_[_0x615c('0x49')](_0x2ccd7c[_0x615c('0x44')],qs[_0x615c('0x4a')](_0x1bee36[_0x615c('0x46')][_0x615c('0x4a')]));_0x36e911['attributes']=_0x36e911['attributes']['length']?_0x36e911['attributes']:_0x2ccd7c[_0x615c('0x44')];if(_0x1bee36[_0x615c('0x46')][_0x615c('0x55')]){_0x36e911[_0x615c('0x56')]=[{'all':!![]}];}_0x36e911=_[_0x615c('0x54')]({},_0x36e911,_0x1bee36[_0x615c('0x5c')]);return db[_0x615c('0x40')][_0x615c('0x5d')](_0x36e911)[_0x615c('0x20')](handleEntityNotFound(_0x71a8d7,null))[_0x615c('0x20')](respondWithResult(_0x71a8d7,null))[_0x615c('0x59')](handleError(_0x71a8d7,null));};exports[_0x615c('0x5e')]=function(_0x4abe73,_0x120096){return db['OpenchannelAccount']['create'](_0x4abe73['body'],{})[_0x615c('0x20')](function(_0x80c917){var _0x53b65f=_0x4abe73[_0x615c('0x5f')][_0x615c('0x37')]({'plain':!![]});if(!_0x53b65f)throw new Error(_0x615c('0x60'));if(_0x53b65f['role']===_0x615c('0x5f')){var _0x2bb0a3=_0x80c917[_0x615c('0x37')]({'plain':!![]});var _0x378177=_0x615c('0x38');return db[_0x615c('0x61')][_0x615c('0x5d')]({'where':{'name':_0x378177,'userProfileId':_0x53b65f[_0x615c('0x62')]},'raw':!![]})[_0x615c('0x20')](function(_0x2cf1b8){if(_0x2cf1b8&&_0x2cf1b8[_0x615c('0x63')]===0x0){return db[_0x615c('0x39')][_0x615c('0x5e')]({'name':_0x2bb0a3[_0x615c('0x3b')],'resourceId':_0x2bb0a3['id'],'type':_0x2cf1b8['name'],'sectionId':_0x2cf1b8['id']},{})['then'](function(){return _0x80c917;});}else{return _0x80c917;}})['catch'](function(_0x4b650a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b650a);throw _0x4b650a;});}return _0x80c917;})[_0x615c('0x20')](respondWithResult(_0x120096,0xc9))['catch'](handleError(_0x120096,null));};exports[_0x615c('0x35')]=function(_0xc3d440,_0x594b09){if(_0xc3d440[_0x615c('0x64')]['id']){delete _0xc3d440['body']['id'];}return db[_0x615c('0x40')][_0x615c('0x5d')]({'where':{'id':_0xc3d440[_0x615c('0x65')]['id']},'include':[{'model':db[_0x615c('0x3e')],'as':_0x615c('0x3f')}]})['then'](handleEntityNotFound(_0x594b09,null))[_0x615c('0x20')](saveUpdates(_0xc3d440[_0x615c('0x64')],null))['then'](respondWithResult(_0x594b09,null))['catch'](handleError(_0x594b09,null));};exports[_0x615c('0x36')]=function(_0x3cb0ad,_0x2d0080){return db[_0x615c('0x40')]['find']({'where':{'id':_0x3cb0ad[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x2d0080,null))[_0x615c('0x20')](removeEntity(_0x2d0080,null))[_0x615c('0x59')](handleError(_0x2d0080,null));};exports['describe']=function(_0x223292,_0x3dac8f){return db[_0x615c('0x40')][_0x615c('0x66')]()[_0x615c('0x20')](respondWithResult(_0x3dac8f,null))[_0x615c('0x59')](handleError(_0x3dac8f,null));};exports['addDisposition']=function(_0x56c768,_0x23b252,_0x289cd5){if(_0x56c768[_0x615c('0x64')]['id']){delete _0x56c768[_0x615c('0x64')]['id'];}return db[_0x615c('0x40')][_0x615c('0x5d')]({'where':{'id':_0x56c768[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x23b252,null))['then'](function(_0x14405d){if(_0x14405d){_0x56c768['body'][_0x615c('0x67')]=_0x14405d['id'];return db[_0x615c('0x68')]['create'](_0x56c768[_0x615c('0x64')]);}})['then'](respondWithResult(_0x23b252,null))[_0x615c('0x59')](handleError(_0x23b252,null));};exports['getDispositions']=function(_0x3e40b8,_0x4ac0f9,_0x85be38){var _0x1712fe={'raw':![],'where':{}};var _0x1478ef={};var _0x1b498e={'count':0x0,'rows':[]};return db[_0x615c('0x40')]['findOne']({'where':{'id':_0x3e40b8['params']['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x4ac0f9,null))[_0x615c('0x20')](function(_0x2a4df6){if(_0x2a4df6){_0x1478ef[_0x615c('0x44')]=_[_0x615c('0x5b')](db[_0x615c('0x68')]['rawAttributes']);_0x1478ef[_0x615c('0x46')]=_[_0x615c('0x5b')](_0x3e40b8['query']);_0x1478ef['filters']=_[_0x615c('0x49')](_0x1478ef['model'],_0x1478ef[_0x615c('0x46')]);_0x1712fe[_0x615c('0x48')]=_['intersection'](_0x1478ef[_0x615c('0x44')],qs[_0x615c('0x4a')](_0x3e40b8[_0x615c('0x46')][_0x615c('0x4a')]));_0x1712fe[_0x615c('0x48')]=_0x1712fe['attributes'][_0x615c('0x4b')]?_0x1712fe['attributes']:_0x1478ef['model'];if(!_0x3e40b8['query'][_0x615c('0x4c')]('nolimit')){_0x1712fe[_0x615c('0x2e')]=qs[_0x615c('0x2e')](_0x3e40b8[_0x615c('0x46')]['limit']);_0x1712fe[_0x615c('0x2c')]=qs[_0x615c('0x2c')](_0x3e40b8[_0x615c('0x46')][_0x615c('0x2c')]);}_0x1712fe['order']=qs[_0x615c('0x4f')](_0x3e40b8['query'][_0x615c('0x4f')]);_0x1712fe[_0x615c('0x52')]=qs[_0x615c('0x47')](_[_0x615c('0x50')](_0x3e40b8[_0x615c('0x46')],_0x1478ef[_0x615c('0x47')]));_0x1712fe[_0x615c('0x52')][_0x615c('0x67')]=_0x2a4df6['id'];if(_0x3e40b8[_0x615c('0x46')][_0x615c('0x51')]){_0x1712fe[_0x615c('0x52')]=_[_0x615c('0x54')](_0x1712fe[_0x615c('0x52')],{'$or':_[_0x615c('0x45')](_0x1712fe['attributes'],function(_0x2a6e0b){var _0x10d204={};_0x10d204[_0x2a6e0b]={'$like':'%'+_0x3e40b8['query'][_0x615c('0x51')]+'%'};return _0x10d204;})});}_0x1712fe=_[_0x615c('0x54')]({},_0x1712fe,_0x3e40b8[_0x615c('0x5c')]);return db[_0x615c('0x68')][_0x615c('0x2f')]({'where':_0x1712fe[_0x615c('0x52')]})[_0x615c('0x20')](function(_0x5202c4){_0x1b498e['count']=_0x5202c4;if(_0x3e40b8[_0x615c('0x46')][_0x615c('0x55')]){_0x1712fe[_0x615c('0x56')]=[{'all':!![]}];}return db[_0x615c('0x68')][_0x615c('0x57')](_0x1712fe);})[_0x615c('0x20')](function(_0x2728b4){_0x1b498e[_0x615c('0x58')]=_0x2728b4;return _0x1b498e;});}})['then'](respondWithFilteredResult(_0x4ac0f9,_0x1712fe))[_0x615c('0x59')](handleError(_0x4ac0f9,null));};exports[_0x615c('0x69')]=function(_0x10fbc4,_0x2fd58c,_0x1931b3){return db[_0x615c('0x40')][_0x615c('0x5d')]({'where':{'id':_0x10fbc4[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x2fd58c,null))[_0x615c('0x20')](function(_0x363dd2){if(_0x363dd2){return _0x363dd2[_0x615c('0x69')](_0x10fbc4[_0x615c('0x46')][_0x615c('0x6a')]);}})['then'](respondWithStatusCode(_0x2fd58c,null))[_0x615c('0x59')](handleError(_0x2fd58c,null));};exports[_0x615c('0x6b')]=function(_0x5b1b04,_0x1117c9,_0x3811a7){if(_0x5b1b04[_0x615c('0x64')]['id']){delete _0x5b1b04[_0x615c('0x64')]['id'];}return db[_0x615c('0x40')][_0x615c('0x5d')]({'where':{'id':_0x5b1b04['params']['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x1117c9,null))[_0x615c('0x20')](function(_0x9f5b05){if(_0x9f5b05){_0x5b1b04[_0x615c('0x64')]['OpenchannelAccountId']=_0x9f5b05['id'];return db[_0x615c('0x6c')][_0x615c('0x5e')](_0x5b1b04['body']);}})['then'](respondWithResult(_0x1117c9,null))[_0x615c('0x59')](handleError(_0x1117c9,null));};exports[_0x615c('0x6d')]=function(_0x13a4b7,_0x44994e,_0x23c51d){var _0x1205b4={'raw':![],'where':{}};var _0x50ceb6={};var _0x259c4a={'count':0x0,'rows':[]};return db[_0x615c('0x40')][_0x615c('0x6e')]({'where':{'id':_0x13a4b7[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x44994e,null))[_0x615c('0x20')](function(_0xe7d1af){if(_0xe7d1af){_0x50ceb6[_0x615c('0x44')]=_['keys'](db[_0x615c('0x6c')][_0x615c('0x41')]);_0x50ceb6[_0x615c('0x46')]=_[_0x615c('0x5b')](_0x13a4b7['query']);_0x50ceb6[_0x615c('0x47')]=_[_0x615c('0x49')](_0x50ceb6[_0x615c('0x44')],_0x50ceb6[_0x615c('0x46')]);_0x1205b4['attributes']=_['intersection'](_0x50ceb6['model'],qs[_0x615c('0x4a')](_0x13a4b7[_0x615c('0x46')][_0x615c('0x4a')]));_0x1205b4['attributes']=_0x1205b4[_0x615c('0x48')][_0x615c('0x4b')]?_0x1205b4[_0x615c('0x48')]:_0x50ceb6[_0x615c('0x44')];if(!_0x13a4b7[_0x615c('0x46')][_0x615c('0x4c')](_0x615c('0x4d'))){_0x1205b4[_0x615c('0x2e')]=qs['limit'](_0x13a4b7[_0x615c('0x46')][_0x615c('0x2e')]);_0x1205b4[_0x615c('0x2c')]=qs['offset'](_0x13a4b7[_0x615c('0x46')][_0x615c('0x2c')]);}_0x1205b4[_0x615c('0x4e')]=qs[_0x615c('0x4f')](_0x13a4b7[_0x615c('0x46')]['sort']);_0x1205b4[_0x615c('0x52')]=qs[_0x615c('0x47')](_[_0x615c('0x50')](_0x13a4b7[_0x615c('0x46')],_0x50ceb6['filters']));_0x1205b4[_0x615c('0x52')][_0x615c('0x67')]=_0xe7d1af['id'];if(_0x13a4b7[_0x615c('0x46')]['filter']){_0x1205b4['where']=_[_0x615c('0x54')](_0x1205b4[_0x615c('0x52')],{'$or':_[_0x615c('0x45')](_0x1205b4[_0x615c('0x48')],function(_0x176030){var _0x51abd1={};_0x51abd1[_0x176030]={'$like':'%'+_0x13a4b7[_0x615c('0x46')][_0x615c('0x51')]+'%'};return _0x51abd1;})});}_0x1205b4=_[_0x615c('0x54')]({},_0x1205b4,_0x13a4b7[_0x615c('0x5c')]);return db['CannedAnswer'][_0x615c('0x2f')]({'where':_0x1205b4[_0x615c('0x52')]})['then'](function(_0x3b3519){_0x259c4a[_0x615c('0x2f')]=_0x3b3519;if(_0x13a4b7[_0x615c('0x46')][_0x615c('0x55')]){_0x1205b4[_0x615c('0x56')]=[{'all':!![]}];}return db[_0x615c('0x6c')][_0x615c('0x57')](_0x1205b4);})[_0x615c('0x20')](function(_0x4e2d7c){_0x259c4a[_0x615c('0x58')]=_0x4e2d7c;return _0x259c4a;});}})[_0x615c('0x20')](respondWithFilteredResult(_0x44994e,_0x1205b4))[_0x615c('0x59')](handleError(_0x44994e,null));};exports[_0x615c('0x6f')]=function(_0x36f2e5,_0x345be6,_0x584bc9){return db[_0x615c('0x40')][_0x615c('0x5d')]({'where':{'id':_0x36f2e5['params']['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x345be6,null))[_0x615c('0x20')](function(_0x5e6e62){if(_0x5e6e62){return _0x5e6e62[_0x615c('0x6f')](_0x36f2e5[_0x615c('0x46')]['ids']);}})[_0x615c('0x20')](respondWithStatusCode(_0x345be6,null))[_0x615c('0x59')](handleError(_0x345be6,null));};exports[_0x615c('0x70')]=function(_0x2ac177,_0xdfc83a,_0x5db803){var _0x43e532={'body':_0x2ac177[_0x615c('0x64')],'channel':'openchannel'};var _0x4bd5bf=[];var _0x2bf8bc=[];var _0x4fd6a4={};var _0x17ad6d=![];return db[_0x615c('0x71')][_0x615c('0x66')]()[_0x615c('0x20')](function(_0x837857){if(!_0x837857){throw new db[(_0x615c('0x72'))][(_0x615c('0x73'))]('no\x20available\x20attributes');}_0x4bd5bf=_['difference'](_[_0x615c('0x5b')](_0x837857),['createdAt','updatedAt']);_0x2bf8bc=_[_0x615c('0x74')](_['keys'](_0x837857),[_0x615c('0x75'),_0x615c('0x76'),_0x615c('0x77'),_0x615c('0x78')]);if(_0x2ac177[_0x615c('0x64')]['id']){delete _0x2ac177[_0x615c('0x64')]['id'];}if(_['isNil'](_0x2ac177['body'][_0x615c('0x79')])){throw new db[(_0x615c('0x72'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x615c('0x7a')](_0x2ac177[_0x615c('0x64')]['body'])||_0x2ac177[_0x615c('0x64')][_0x615c('0x64')]===''){throw new db[(_0x615c('0x72'))][(_0x615c('0x73'))](_0x615c('0x7b'));}if(_[_0x615c('0x7a')](_0x2ac177['body'][_0x615c('0x7c')])){throw new db[(_0x615c('0x72'))][(_0x615c('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2bf8bc);}if(!_[_0x615c('0x7d')](_0x2bf8bc,_0x2ac177[_0x615c('0x64')][_0x615c('0x7c')])){throw new db['Sequelize'][(_0x615c('0x73'))](_0x615c('0x7e')+_0x2bf8bc);}_0x4fd6a4[_0x2ac177['body']['mapKey']]=_0x2ac177[_0x615c('0x64')][_0x615c('0x79')];})[_0x615c('0x20')](function(){return db[_0x615c('0x40')][_0x615c('0x5d')]({'where':{'id':_0x2ac177[_0x615c('0x65')]['id']},'include':[{'model':db[_0x615c('0x7f')],'as':'List','include':[{'model':db[_0x615c('0x71')],'as':'Contacts','where':_0x4fd6a4,'limit':0x1,'order':[['updatedAt',_0x615c('0x80')]]}]},{'model':db[_0x615c('0x81')],'as':'Applications'}]});})[_0x615c('0x20')](handleEntityNotFound(_0xdfc83a,null))[_0x615c('0x20')](function(_0x11caaf){if(_0x11caaf&&_0x11caaf[_0x615c('0x82')]){_0x43e532[_0x615c('0x83')]=_0x11caaf;_0x43e532['applications']=_0x11caaf[_0x615c('0x84')];_0x43e532[_0x615c('0x85')]=_0x11caaf[_0x615c('0x82')];_0x43e532['applications']=_[_0x615c('0x86')](_0x43e532['applications'],[_0x615c('0x87')],[_0x615c('0x88')]);if(_0x43e532['account'][_0x615c('0x84')]){delete _0x43e532[_0x615c('0x83')][_0x615c('0x84')];}if(_0x43e532[_0x615c('0x83')]['List']&&_0x43e532[_0x615c('0x83')]['List']['Contacts'][_0x615c('0x4b')]){return _0x43e532[_0x615c('0x83')]['List'][_0x615c('0x89')][0x0];}var _0x25661a=_[_0x615c('0x18')](_0x2ac177['body'],{'firstName':_0x2ac177[_0x615c('0x64')][_0x615c('0x79')],'ListId':_0x11caaf['ListId']});_0x25661a[_0x2ac177[_0x615c('0x64')][_0x615c('0x7c')]]=_0x2ac177['body'][_0x615c('0x79')];return db[_0x615c('0x71')]['create'](_0x25661a,{'fields':_0x4bd5bf,'raw':!![]});}})[_0x615c('0x20')](handleEntityNotFound(_0xdfc83a,null))[_0x615c('0x20')](function(_0x3f0a2e){_0x43e532[_0x615c('0x8a')]=_0x3f0a2e;if(_0x3f0a2e){var _0x5a68a8={'ContactId':_0x3f0a2e['id'],'OpenchannelAccountId':_0x2ac177[_0x615c('0x65')]['id'],'from':(_0x3f0a2e[_0x615c('0x8b')]||'')+'\x20'+(_0x3f0a2e[_0x615c('0x8c')]||'')};var _0x18b73e={'OpenchannelAccountId':_0x2ac177[_0x615c('0x65')]['id'],'closed':![]};if(_0x2ac177[_0x615c('0x64')][_0x615c('0x8d')]){_0x18b73e[_0x615c('0x8d')]=_0x2ac177[_0x615c('0x64')][_0x615c('0x8d')];return db[_0x615c('0x8e')][_0x615c('0x5d')]({'where':_0x18b73e})['then'](function(_0x2193c1){if(_0x2193c1){return[_0x2193c1,![]];}_0x5a68a8[_0x615c('0x8d')]=_0x2ac177['body']['threadId'];_0x5a68a8[_0x615c('0x8f')]=_0x2ac177[_0x615c('0x64')][_0x615c('0x8f')];return db[_0x615c('0x8e')][_0x615c('0x5e')](_0x5a68a8)['then'](function(_0xe1071e){return[_0xe1071e,!![]];});});}else{_0x18b73e['threadId']=null;}_0x18b73e[_0x615c('0x90')]=_0x3f0a2e['id'];return db['OpenchannelInteraction'][_0x615c('0x5d')]({'where':_0x18b73e})[_0x615c('0x20')](function(_0x3c79e8){if(_0x3c79e8){return[_0x3c79e8,![]];}return db['OpenchannelInteraction'][_0x615c('0x5e')](_0x5a68a8)['then'](function(_0xe583fb){return[_0xe583fb,!![]];});});}})[_0x615c('0x91')](function(_0x4f3430,_0x5e5754){if(_0x4f3430){_0x17ad6d=_0x5e5754;if(!_0x5e5754){var _0x22c484={'from':(_0x43e532[_0x615c('0x8a')][_0x615c('0x8b')]||'')+'\x20'+(_0x43e532[_0x615c('0x8a')][_0x615c('0x8c')]||'')};if(_0x2ac177[_0x615c('0x64')][_0x615c('0x8d')]&&_0x2ac177[_0x615c('0x64')][_0x615c('0x92')]&&_0x2ac177[_0x615c('0x64')]['threadId']!=_0x2ac177['body'][_0x615c('0x92')]){_0x22c484['threadId']=_0x2ac177[_0x615c('0x64')]['messageId'];}return _0x4f3430[_0x615c('0x35')](_0x22c484);}else{return _0x4f3430;}}})[_0x615c('0x20')](function(_0x4470c5){_0x43e532['interaction']=_0x4470c5['get']({'plain':!![]});_0x43e532[_0x615c('0x93')][_0x615c('0x94')]=_0x17ad6d;if(_0x43e532[_0x615c('0x93')][_0x615c('0x94')]){if(_0x43e532[_0x615c('0x83')][_0x615c('0x95')]){_0x43e532['applications']['push']({'id':0x0,'priority':_0x43e532[_0x615c('0x96')][_0x615c('0x4b')]+0x1,'app':_0x615c('0x97'),'appdata':'unmanaged','interval':_0x615c('0x98')});}}return db['OpenchannelMessage'][_0x615c('0x5e')]({'body':_0x2ac177['body']['body'],'OpenchannelAccountId':_0x2ac177['params']['id'],'OpenchannelInteractionId':_0x4470c5['id'],'direction':'in','ContactId':_0x43e532[_0x615c('0x8a')]['id'],'AttachmentId':_0x2ac177[_0x615c('0x64')]['AttachmentId']});})[_0x615c('0x20')](function(_0x22c874){_0x43e532[_0x615c('0x27')]=_0x22c874;if(!_0x43e532[_0x615c('0x93')][_0x615c('0x99')])return;return db[_0x615c('0x9a')][_0x615c('0x5d')]({'attributes':['id',_0x615c('0x3b')],'where':{'id':_0x43e532['interaction'][_0x615c('0x99')]}});})[_0x615c('0x20')](function(_0x45ec7d){if(_0x45ec7d){_0x43e532[_0x615c('0x96')][_0x615c('0x9b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x45ec7d[_0x615c('0x3b')]+','+(_0x43e532[_0x615c('0x83')][_0x615c('0x9c')]||0xa),'interval':_0x615c('0x98')});}if(!_0x43e532['interaction'][_0x615c('0x9d')])return;return db[_0x615c('0x9e')][_0x615c('0x5d')]({'attributes':['id',_0x615c('0x3b')],'where':{'id':_0x43e532[_0x615c('0x93')][_0x615c('0x9d')]}});})['then'](function(_0x51cce9){if(_0x51cce9){_0x43e532['applications'][_0x615c('0x9b')]({'id':0x0,'priority':0x1,'app':_0x615c('0x9f'),'appdata':_0x51cce9['name']+','+(_0x43e532[_0x615c('0x83')][_0x615c('0xa0')]||0x12c),'interval':_0x615c('0x98')});}return respondWithRpcPromise('Start',_0x615c('0xa1'),_0x43e532);})['then'](function(_0x53d78e){respondWithRpcPromise(_0x615c('0xa2'),'EventManager',{'event':'notify','message':_0x53d78e},client9002);return _0x53d78e;})[_0x615c('0x20')](respondWithResult(_0xdfc83a,null))[_0x615c('0x59')](handleError(_0xdfc83a,null));};exports[_0x615c('0xa3')]=function(_0x2c56f9,_0x4c2ff4){var _0x42ebae=_0x2c56f9[_0x615c('0x65')]['id'];var _0x536618=_0x2c56f9[_0x615c('0x64')];var _0x5cdd48=0xc8;var _0x31eaa5=null;return db[_0x615c('0xa4')][_0x615c('0xa5')]({'isolationLevel':db[_0x615c('0xa4')][_0x615c('0xa6')][_0x615c('0xa7')][_0x615c('0xa8')]},function(_0xd97674){return db[_0x615c('0x40')][_0x615c('0x6e')]({'where':{'id':_0x42ebae},'transaction':_0xd97674})[_0x615c('0x20')](function(_0x259440){if(_0x259440){return db[_0x615c('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x42ebae},'transaction':_0xd97674})['then'](function(){var _0x1e2594=_[_0x615c('0x45')](_0x536618,function(_0x11ee23){_0x11ee23['OpenchannelAccountId']=_0x42ebae;return _0x11ee23;});return db[_0x615c('0x81')]['bulkCreate'](_0x1e2594,{'transaction':_0xd97674});});}else{_0x5cdd48=0x194;_0x31eaa5=[];}});})[_0x615c('0x20')](function(){if(_0x5cdd48!==0x194){return db[_0x615c('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x42ebae},'order':'priority'})[_0x615c('0x20')](function(_0x53c9be){_0x31eaa5=_0x53c9be;});}})[_0x615c('0x59')](function(_0x594925){_0x5cdd48=0x1f4;logger[_0x615c('0x25')](_0x594925[_0x615c('0x3a')]);if(_0x594925[_0x615c('0x3b')]){delete _0x594925[_0x615c('0x3b')];}_0x31eaa5=_0x594925;})[_0x615c('0xa9')](function(){if(_0x31eaa5===null){_0x4c2ff4[_0x615c('0x29')](_0x5cdd48);}else{if(_0x5cdd48===0x1f4){_0x4c2ff4['status'](_0x5cdd48)[_0x615c('0x3c')](_0x31eaa5);}else{_0x4c2ff4[_0x615c('0x30')](_0x5cdd48)[_0x615c('0x2b')](_0x31eaa5);}}});};exports[_0x615c('0xaa')]=function(_0x58d0a8,_0x15c69b,_0x22dd79){var _0x37e96b={};var _0x197530={};var _0x66bfe7;var _0x4582a2;return db[_0x615c('0x40')][_0x615c('0x6e')]({'where':{'id':_0x58d0a8[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x15c69b,null))[_0x615c('0x20')](function(_0xa12d2e){if(_0xa12d2e){_0x66bfe7=_0xa12d2e;_0x197530[_0x615c('0x44')]=_['keys'](db[_0x615c('0x81')]['rawAttributes']);_0x197530[_0x615c('0x46')]=_[_0x615c('0x5b')](_0x58d0a8[_0x615c('0x46')]);_0x197530[_0x615c('0x47')]=_['intersection'](_0x197530[_0x615c('0x44')],_0x197530[_0x615c('0x46')]);_0x37e96b[_0x615c('0x48')]=_[_0x615c('0x49')](_0x197530[_0x615c('0x44')],qs['fields'](_0x58d0a8[_0x615c('0x46')][_0x615c('0x4a')]));_0x37e96b[_0x615c('0x48')]=_0x37e96b[_0x615c('0x48')][_0x615c('0x4b')]?_0x37e96b[_0x615c('0x48')]:_0x197530['model'];_0x37e96b['order']=qs['sort'](_0x58d0a8[_0x615c('0x46')][_0x615c('0x4f')]);_0x37e96b['where']=qs[_0x615c('0x47')](_['pick'](_0x58d0a8[_0x615c('0x46')],_0x197530['filters']));if(_0x58d0a8[_0x615c('0x46')][_0x615c('0x51')]){_0x37e96b[_0x615c('0x52')]=_['merge'](_0x37e96b[_0x615c('0x52')],{'$or':_[_0x615c('0x45')](_0x37e96b[_0x615c('0x48')],function(_0x56b267){var _0x4f5804={};_0x4f5804[_0x56b267]={'$like':'%'+_0x58d0a8[_0x615c('0x46')]['filter']+'%'};return _0x4f5804;})});}_0x37e96b=_['merge']({},_0x37e96b,_0x58d0a8[_0x615c('0x5c')]);return _0x66bfe7[_0x615c('0xaa')](_0x37e96b);}})[_0x615c('0x20')](function(_0x37af77){if(_0x37af77){_0x4582a2=_0x37af77[_0x615c('0x4b')];if(!_0x58d0a8[_0x615c('0x46')][_0x615c('0x4c')](_0x615c('0x4d'))){_0x37e96b[_0x615c('0x2e')]=qs[_0x615c('0x2e')](_0x58d0a8[_0x615c('0x46')][_0x615c('0x2e')]);_0x37e96b[_0x615c('0x2c')]=qs['offset'](_0x58d0a8[_0x615c('0x46')][_0x615c('0x2c')]);}return _0x66bfe7[_0x615c('0xaa')](_0x37e96b);}})['then'](function(_0x2e2ec2){if(_0x2e2ec2){return _0x2e2ec2?{'count':_0x4582a2,'rows':_0x2e2ec2}:null;}})['then'](respondWithResult(_0x15c69b,null))[_0x615c('0x59')](handleError(_0x15c69b,null));};exports[_0x615c('0xab')]=function(_0x83d490,_0x541f84,_0x50c033){var _0xface25={'raw':![],'where':{}};var _0x10ef82={};var _0x1cb675={'count':0x0,'rows':[]};return db[_0x615c('0x40')]['findOne']({'where':{'id':_0x83d490[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x541f84,null))['then'](function(_0x5a5cd2){if(_0x5a5cd2){_0x10ef82[_0x615c('0x44')]=_[_0x615c('0x5b')](db[_0x615c('0x8e')][_0x615c('0x41')]);_0x10ef82[_0x615c('0x46')]=_[_0x615c('0x5b')](_0x83d490[_0x615c('0x46')]);_0x10ef82[_0x615c('0x47')]=_[_0x615c('0x49')](_0x10ef82[_0x615c('0x44')],_0x10ef82[_0x615c('0x46')]);_0xface25[_0x615c('0x48')]=_[_0x615c('0x49')](_0x10ef82[_0x615c('0x44')],qs['fields'](_0x83d490[_0x615c('0x46')]['fields']));_0xface25[_0x615c('0x48')]=_0xface25[_0x615c('0x48')][_0x615c('0x4b')]?_0xface25['attributes']:_0x10ef82[_0x615c('0x44')];if(!_0x83d490[_0x615c('0x46')][_0x615c('0x4c')](_0x615c('0x4d'))){_0xface25[_0x615c('0x2e')]=qs['limit'](_0x83d490[_0x615c('0x46')][_0x615c('0x2e')]);_0xface25[_0x615c('0x2c')]=qs['offset'](_0x83d490[_0x615c('0x46')][_0x615c('0x2c')]);}_0xface25[_0x615c('0x4e')]=qs[_0x615c('0x4f')](_0x83d490['query'][_0x615c('0x4f')]);_0xface25[_0x615c('0x52')]=qs['filters'](_[_0x615c('0x50')](_0x83d490[_0x615c('0x46')],_0x10ef82[_0x615c('0x47')]));_0xface25['where'][_0x615c('0x67')]=_0x5a5cd2['id'];if(_0x83d490['query']['filter']){_0xface25[_0x615c('0x52')]=_[_0x615c('0x54')](_0xface25['where'],{'$or':_[_0x615c('0x45')](_0xface25[_0x615c('0x48')],function(_0xafcb1c){var _0x2657ca={};_0x2657ca[_0xafcb1c]={'$like':'%'+_0x83d490[_0x615c('0x46')][_0x615c('0x51')]+'%'};return _0x2657ca;})});}_0xface25=_['merge']({},_0xface25,_0x83d490[_0x615c('0x5c')]);return db[_0x615c('0x8e')][_0x615c('0x2f')]({'where':_0xface25[_0x615c('0x52')]})[_0x615c('0x20')](function(_0x4647b6){_0x1cb675[_0x615c('0x2f')]=_0x4647b6;if(_0x83d490['query']['includeAll']){_0xface25['include']=[{'model':db[_0x615c('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x615c('0xac'),'attributes':[_0x615c('0x3b'),'fullname',_0x615c('0xad')],'required':![]},{'model':db[_0x615c('0xae')],'as':_0x615c('0xaf'),'attributes':['id',_0x615c('0x3b'),_0x615c('0xb0')],'where':_0x83d490['query'][_0x615c('0xb1')]?{'id':_0x83d490['query']['tag']}:undefined,'required':_0x83d490[_0x615c('0x46')][_0x615c('0xb1')]?!![]:![]}];}return db[_0x615c('0x8e')][_0x615c('0x57')](_0xface25);})[_0x615c('0x20')](function(_0x132e8a){_0x1cb675[_0x615c('0x58')]=_0x132e8a;return _0x1cb675;});}})[_0x615c('0x20')](respondWithFilteredResult(_0x541f84,_0xface25))[_0x615c('0x59')](handleError(_0x541f84,null));};exports[_0x615c('0xb2')]=function(_0x35cd14,_0x30ef62,_0x1a7ee5){return db[_0x615c('0x40')]['find']({'where':{'id':_0x35cd14[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x30ef62,null))[_0x615c('0x20')](function(_0x4e1548){if(_0x4e1548){return _0x4e1548['addAgents'](_0x35cd14[_0x615c('0x64')][_0x615c('0x6a')],_[_0x615c('0xb3')](_0x35cd14[_0x615c('0x64')],['ids','id'])||{})[_0x615c('0x91')](function(_0x3fd1e7){for(var _0x2f2ef6=0x0;_0x2f2ef6<_0x35cd14['body'][_0x615c('0x6a')][_0x615c('0x4b')];_0x2f2ef6+=0x1){socket[_0x615c('0xb4')](_0x615c('0xb5'),{'UserId':Number(_0x35cd14[_0x615c('0x64')]['ids'][_0x2f2ef6]),'OpenchannelAccountId':Number(_0x35cd14['params']['id'])});}return _0x3fd1e7;});}})['then'](respondWithResult(_0x30ef62,null))[_0x615c('0x59')](handleError(_0x30ef62,null));};exports['removeAgents']=function(_0x223d93,_0x3a02ef,_0x3ff61b){return db['OpenchannelAccount']['find']({'where':{'id':_0x223d93['params']['id']}})['then'](handleEntityNotFound(_0x3a02ef,null))['then'](function(_0xcdef2d){if(_0xcdef2d){return _0xcdef2d[_0x615c('0xb6')](_0x223d93[_0x615c('0x46')]['ids'])[_0x615c('0x20')](function(){if(_[_0x615c('0xb7')](_0x223d93['query'][_0x615c('0x6a')])){for(var _0x3a941f=0x0;_0x3a941f<_0x223d93['query']['ids'][_0x615c('0x4b')];_0x3a941f+=0x1){socket[_0x615c('0xb4')](_0x615c('0xb8'),{'UserId':Number(_0x223d93[_0x615c('0x46')][_0x615c('0x6a')][_0x3a941f]),'OpenchannelAccountId':Number(_0x223d93[_0x615c('0x65')]['id'])});}}else{socket[_0x615c('0xb4')](_0x615c('0xb8'),{'UserId':Number(_0x223d93[_0x615c('0x46')][_0x615c('0x6a')]),'OpenchannelAccountId':Number(_0x223d93['params']['id'])});}});}})[_0x615c('0x20')](respondWithStatusCode(_0x3a02ef,null))['catch'](handleError(_0x3a02ef,null));};exports[_0x615c('0xb9')]=function(_0x532809,_0x5f271d,_0x5e3ce7){var _0x39a8bb={};var _0x15ab45={};var _0x5961eb;var _0xdaed36;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x532809[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x5f271d,null))[_0x615c('0x20')](function(_0x59e29b){if(_0x59e29b){_0x5961eb=_0x59e29b;_0x15ab45[_0x615c('0x44')]=_[_0x615c('0x5b')](db[_0x615c('0x9a')][_0x615c('0x41')]);_0x15ab45['query']=_[_0x615c('0x5b')](_0x532809[_0x615c('0x46')]);_0x15ab45['filters']=_[_0x615c('0x49')](_0x15ab45[_0x615c('0x44')],_0x15ab45['query']);_0x39a8bb[_0x615c('0x48')]=_[_0x615c('0x49')](_0x15ab45[_0x615c('0x44')],qs[_0x615c('0x4a')](_0x532809[_0x615c('0x46')]['fields']));_0x39a8bb[_0x615c('0x48')]=_0x39a8bb[_0x615c('0x48')][_0x615c('0x4b')]?_0x39a8bb[_0x615c('0x48')]:_0x15ab45[_0x615c('0x44')];_0x39a8bb[_0x615c('0x4e')]=qs['sort'](_0x532809[_0x615c('0x46')][_0x615c('0x4f')]);_0x39a8bb['where']=qs['filters'](_['pick'](_0x532809[_0x615c('0x46')],_0x15ab45[_0x615c('0x47')]));if(_0x532809['query']['filter']){_0x39a8bb[_0x615c('0x52')]=_[_0x615c('0x54')](_0x39a8bb['where'],{'$or':_[_0x615c('0x45')](_0x39a8bb[_0x615c('0x48')],function(_0x3fd6d0){var _0x47ab62={};_0x47ab62[_0x3fd6d0]={'$like':'%'+_0x532809[_0x615c('0x46')][_0x615c('0x51')]+'%'};return _0x47ab62;})});}_0x39a8bb=_[_0x615c('0x54')]({},_0x39a8bb,_0x532809[_0x615c('0x5c')]);return _0x5961eb['getAgents'](_0x39a8bb);}})[_0x615c('0x20')](function(_0x86a9c1){if(_0x86a9c1){_0xdaed36=_0x86a9c1[_0x615c('0x4b')];if(!_0x532809[_0x615c('0x46')][_0x615c('0x4c')]('nolimit')){_0x39a8bb[_0x615c('0x2e')]=qs[_0x615c('0x2e')](_0x532809['query']['limit']);_0x39a8bb[_0x615c('0x2c')]=qs[_0x615c('0x2c')](_0x532809['query'][_0x615c('0x2c')]);}return _0x5961eb[_0x615c('0xb9')](_0x39a8bb);}})[_0x615c('0x20')](function(_0x3397ee){if(_0x3397ee){return _0x3397ee?{'count':_0xdaed36,'rows':_0x3397ee}:null;}})[_0x615c('0x20')](respondWithResult(_0x5f271d,null))['catch'](handleError(_0x5f271d,null));};exports[_0x615c('0x3c')]=function(_0x5b270c,_0x3ffbbf,_0x2233d2){var _0x29d6ab,_0x1c0fd7,_0x231340;if(_[_0x615c('0x7a')](_0x5b270c[_0x615c('0x64')][_0x615c('0x64')])||_0x5b270c['body']['body']===''){throw new db[(_0x615c('0x72'))]['ValidationError'](_0x615c('0x7b'));}if(_['isNil'](_0x5b270c[_0x615c('0x64')]['to'])){}_0x29d6ab=_0x5b270c[_0x615c('0x64')]['to'];return db[_0x615c('0x40')][_0x615c('0x6e')]({'where':{'id':_0x5b270c[_0x615c('0x65')]['id']}})[_0x615c('0x20')](handleEntityNotFound(_0x3ffbbf,null))['then'](function(_0x40b9aa){if(_0x40b9aa){return db[_0x615c('0x40')][_0x615c('0x5d')]({'where':{'id':_0x40b9aa['id']},'include':[{'model':db[_0x615c('0x7f')],'as':_0x615c('0x82'),'include':[{'model':db[_0x615c('0x71')],'as':_0x615c('0x89'),'where':{[_0x40b9aa[_0x615c('0x7c')]]:_0x29d6ab},'limit':0x1,'order':[[_0x615c('0x76'),_0x615c('0x80')]]}]}]})[_0x615c('0x20')](handleEntityNotFound(_0x3ffbbf,null))[_0x615c('0x20')](function(_0x11ba44){if(_0x11ba44&&_0x11ba44[_0x615c('0x82')]){_0x1c0fd7=_0x11ba44[_0x615c('0x37')]({'plain':!![]});if(_0x1c0fd7[_0x615c('0x82')]&&_0x1c0fd7['List'][_0x615c('0x89')]['length']){return _0x1c0fd7['List'][_0x615c('0x89')][0x0];}return db[_0x615c('0x71')][_0x615c('0x5e')](_[_0x615c('0x18')](_0x5b270c[_0x615c('0x64')],{'firstName':_0x29d6ab,[_0x11ba44[_0x615c('0x7c')]]:_0x29d6ab,'phone':_0x29d6ab,'ListId':_0x1c0fd7[_0x615c('0x78')]}));}})[_0x615c('0x20')](handleEntityNotFound(_0x3ffbbf,null))[_0x615c('0x20')](function(_0x4e35c1){if(_0x4e35c1){_0x231340=_0x4e35c1;return db['OpenchannelInteraction'][_0x615c('0x5d')]({'where':{'ContactId':_0x231340['id'],'closed':![],'OpenchannelAccountId':_0x1c0fd7['id']}})['then'](function(_0x1677a1){if(_0x1677a1){return[_0x1677a1,![]];}return db[_0x615c('0x8e')][_0x615c('0x5e')]({'UserId':_0x5b270c[_0x615c('0x5f')]['id'],'ContactId':_0x231340['id'],'OpenchannelAccountId':_0x1c0fd7['id'],'lastMsgDirection':_0x615c('0xba'),'firstMsgDirection':'out','Messages':[_['merge'](_0x5b270c['body'],{'read':![],'body':_0x5b270c[_0x615c('0x64')][_0x615c('0x64')],'OpenchannelAccountId':_0x1c0fd7['id'],'UserId':_0x5b270c[_0x615c('0x5f')]['id'],'ContactId':_0x231340['id']})]},{'include':[{'model':db[_0x615c('0xbb')],'as':_0x615c('0xbc')}]})['then'](function(_0x1d9a5a){return[_0x1d9a5a,!![]];});});}})[_0x615c('0x91')](function(_0x4c2bf2,_0x155535){if(_0x155535){return _0x4c2bf2;}return db[_0x615c('0xbb')][_0x615c('0x5e')](_['merge'](_0x5b270c[_0x615c('0x64')],{'read':![],'body':_0x5b270c[_0x615c('0x64')][_0x615c('0x64')],'OpenchannelAccountId':_0x1c0fd7['id'],'OpenchannelInteractionId':_0x4c2bf2['id'],'UserId':_0x5b270c[_0x615c('0x5f')]['id'],'ContactId':_0x231340['id']}))[_0x615c('0x20')](function(_0x1b4bb3){_0x4c2bf2['dataValues'][_0x615c('0xbc')]=[];_0x4c2bf2[_0x615c('0xbd')][_0x615c('0xbc')][_0x615c('0xbe')](_0x1b4bb3[_0x615c('0xbd')]);return _0x4c2bf2;});});}})['then'](respondWithResult(_0x3ffbbf,null))[_0x615c('0x59')](handleError(_0x3ffbbf,null));}; \ No newline at end of file +var _0x2709=['internal','Tag','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','OpenchannelAccount','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','include','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','OpenchannelAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','unshift','OpenchannelQueue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','User','Owner','fullname'];(function(_0x4d1d0b,_0x51b325){var _0x46dd1b=function(_0x5c2f15){while(--_0x5c2f15){_0x4d1d0b['push'](_0x4d1d0b['shift']());}};_0x46dd1b(++_0x51b325);}(_0x2709,0x189));var _0x9270=function(_0x53460a,_0x1d2396){_0x53460a=_0x53460a-0x0;var _0x3c0166=_0x2709[_0x53460a];return _0x3c0166;};'use strict';var emlformat=require(_0x9270('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9270('0x1'));var jsonpatch=require(_0x9270('0x2'));var rp=require('request-promise');var moment=require(_0x9270('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9270('0x4'));var util=require(_0x9270('0x5'));var path=require(_0x9270('0x6'));var sox=require(_0x9270('0x7'));var csv=require(_0x9270('0x8'));var ejs=require(_0x9270('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9270('0xa'));var squel=require(_0x9270('0xb'));var crypto=require(_0x9270('0xc'));var jsforce=require(_0x9270('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9270('0x8'));var querystring=require(_0x9270('0xe'));var Papa=require(_0x9270('0xf'));var Redis=require(_0x9270('0x10'));var authService=require(_0x9270('0x11'));var qs=require(_0x9270('0x12'));var as=require(_0x9270('0x13'));var hardwareService=require(_0x9270('0x14'));var logger=require(_0x9270('0x15'))(_0x9270('0x16'));var utils=require('../../config/utils');var config=require(_0x9270('0x17'));var licenseUtil=require(_0x9270('0x18'));var db=require(_0x9270('0x19'))['db'];config['redis']=_['defaults'](config[_0x9270('0x1a')],{'host':_0x9270('0x1b'),'port':0x18eb});var socket=require(_0x9270('0x1c'))(new Redis(config['redis']));require(_0x9270('0x1d'))[_0x9270('0x1e')](socket);var jayson=require(_0x9270('0x1f'));var client=jayson[_0x9270('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9270('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x129100,_0x5ec9b1,_0x3aa820,_0x4ecf89){return new BPromise(function(_0x45432f,_0x425175){var _0x1a24cf=_0x4ecf89||client;return _0x1a24cf['request'](_0x129100,_0x3aa820)['then'](function(_0x3fdc6e){logger[_0x9270('0x22')](_0x9270('0x23'),_0x5ec9b1,'request\x20sent');logger[_0x9270('0x24')](_0x9270('0x25'),_0x5ec9b1,_0x9270('0x26'),JSON[_0x9270('0x27')](_0x3fdc6e));if(_0x3fdc6e[_0x9270('0x28')]){if(_0x3fdc6e[_0x9270('0x28')]['code']===0x1f4){logger[_0x9270('0x28')](_0x9270('0x23'),_0x5ec9b1,_0x3fdc6e[_0x9270('0x28')][_0x9270('0x29')]);return _0x425175(_0x3fdc6e['error'][_0x9270('0x29')]);}logger[_0x9270('0x28')](_0x9270('0x23'),_0x5ec9b1,_0x3fdc6e[_0x9270('0x28')][_0x9270('0x29')]);return _0x45432f(_0x3fdc6e['error'][_0x9270('0x29')]);}else{logger[_0x9270('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ec9b1,_0x9270('0x26'));_0x45432f(_0x3fdc6e[_0x9270('0x2a')][_0x9270('0x29')]);}})[_0x9270('0x2b')](function(_0x35e372){logger[_0x9270('0x28')](_0x9270('0x23'),_0x5ec9b1,_0x35e372);_0x425175(_0x35e372);});});}function respondWithStatusCode(_0x24d16d,_0xaf6f9b){_0xaf6f9b=_0xaf6f9b||0xcc;return function(_0xd7d7a5){if(_0xd7d7a5){return _0x24d16d[_0x9270('0x2c')](_0xaf6f9b);}return _0x24d16d[_0x9270('0x2d')](_0xaf6f9b)['end']();};}function respondWithResult(_0xff5276,_0x5272a8){_0x5272a8=_0x5272a8||0xc8;return function(_0x4e5e15){if(_0x4e5e15){return _0xff5276[_0x9270('0x2d')](_0x5272a8)[_0x9270('0x2e')](_0x4e5e15);}};}function respondWithFilteredResult(_0x4dba44,_0x252ca4){return function(_0x123ac6){if(_0x123ac6){var _0x153b3a=typeof _0x252ca4[_0x9270('0x2f')]==='undefined'&&typeof _0x252ca4[_0x9270('0x30')]===_0x9270('0x31');var _0x5516cd=_0x123ac6[_0x9270('0x32')];var _0x1cb8eb=_0x153b3a?0x0:_0x252ca4[_0x9270('0x2f')];var _0x183b71=_0x153b3a?_0x123ac6[_0x9270('0x32')]:_0x252ca4[_0x9270('0x2f')]+_0x252ca4['limit'];var _0x28029d;if(_0x183b71>=_0x5516cd){_0x183b71=_0x5516cd;_0x28029d=0xc8;}else{_0x28029d=0xce;}_0x4dba44['status'](_0x28029d);return _0x4dba44[_0x9270('0x33')]('Content-Range',_0x1cb8eb+'-'+_0x183b71+'/'+_0x5516cd)['json'](_0x123ac6);}return null;};}function patchUpdates(_0x41e4df){return function(_0x19d51f){try{jsonpatch[_0x9270('0x34')](_0x19d51f,_0x41e4df,!![]);}catch(_0xae503f){return BPromise[_0x9270('0x35')](_0xae503f);}return _0x19d51f['save']();};}function saveUpdates(_0x3225c5,_0x59c8eb){return function(_0x3366fe){if(_0x3366fe){return _0x3366fe[_0x9270('0x36')](_0x3225c5)[_0x9270('0x37')](function(_0x193dd5){return _0x193dd5;});}return null;};}function removeEntity(_0x55901a,_0x59ee74){return function(_0x4bcae1){if(_0x4bcae1){return _0x4bcae1[_0x9270('0x38')]()[_0x9270('0x37')](function(){var _0x423c73=_0x4bcae1[_0x9270('0x39')]({'plain':!![]});var _0x2081c3=_0x9270('0x3a');return db[_0x9270('0x3b')][_0x9270('0x38')]({'where':{'type':_0x2081c3,'resourceId':_0x423c73['id']}})[_0x9270('0x37')](function(){return _0x4bcae1;});})['then'](function(){_0x55901a[_0x9270('0x2d')](0xcc)[_0x9270('0x3c')]();});}};}function handleEntityNotFound(_0x189ab1,_0x495d0e){return function(_0x4658ee){if(!_0x4658ee){_0x189ab1[_0x9270('0x2c')](0x194);}return _0x4658ee;};}function handleError(_0x6c9ed9,_0x554888){_0x554888=_0x554888||0x1f4;return function(_0x553f5a){logger[_0x9270('0x28')](_0x553f5a[_0x9270('0x3d')]);if(_0x553f5a[_0x9270('0x3e')]){delete _0x553f5a[_0x9270('0x3e')];}_0x6c9ed9[_0x9270('0x2d')](_0x554888)[_0x9270('0x3f')](_0x553f5a);};}exports[_0x9270('0x40')]=function(_0x17abd5,_0x4a85af){var _0x5b85a7={'include':[{'model':db[_0x9270('0x41')],'as':'mandatoryDispositionPause'}]},_0x53f0e5={},_0x13a526={'count':0x0,'rows':[]};var _0x34ba48=_['map'](db[_0x9270('0x42')]['rawAttributes'],function(_0x5959ff){return{'name':_0x5959ff['fieldName'],'type':_0x5959ff[_0x9270('0x43')][_0x9270('0x44')]};});_0x53f0e5[_0x9270('0x45')]=_[_0x9270('0x46')](_0x34ba48,'name');_0x53f0e5[_0x9270('0x47')]=_[_0x9270('0x48')](_0x17abd5['query']);_0x53f0e5[_0x9270('0x49')]=_[_0x9270('0x4a')](_0x53f0e5[_0x9270('0x45')],_0x53f0e5[_0x9270('0x47')]);_0x5b85a7[_0x9270('0x4b')]=_[_0x9270('0x4a')](_0x53f0e5[_0x9270('0x45')],qs[_0x9270('0x4c')](_0x17abd5['query'][_0x9270('0x4c')]));_0x5b85a7['attributes']=_0x5b85a7['attributes'][_0x9270('0x4d')]?_0x5b85a7[_0x9270('0x4b')]:_0x53f0e5['model'];if(!_0x17abd5[_0x9270('0x47')][_0x9270('0x4e')]('nolimit')){_0x5b85a7[_0x9270('0x30')]=qs['limit'](_0x17abd5['query']['limit']);_0x5b85a7[_0x9270('0x2f')]=qs[_0x9270('0x2f')](_0x17abd5[_0x9270('0x47')][_0x9270('0x2f')]);}_0x5b85a7[_0x9270('0x4f')]=qs[_0x9270('0x50')](_0x17abd5[_0x9270('0x47')][_0x9270('0x50')]);_0x5b85a7[_0x9270('0x51')]=qs['filters'](_[_0x9270('0x52')](_0x17abd5[_0x9270('0x47')],_0x53f0e5[_0x9270('0x49')]),_0x34ba48);if(_0x17abd5['query'][_0x9270('0x53')]){_0x5b85a7[_0x9270('0x51')]=_[_0x9270('0x54')](_0x5b85a7[_0x9270('0x51')],{'$or':_['map'](_0x34ba48,function(_0xb8b938){if(_0xb8b938[_0x9270('0x43')]!==_0x9270('0x55')){var _0x28eab5={};_0x28eab5[_0xb8b938[_0x9270('0x3e')]]={'$like':'%'+_0x17abd5['query'][_0x9270('0x53')]+'%'};return _0x28eab5;}})});}_0x5b85a7=_['merge']({},_0x5b85a7,_0x17abd5[_0x9270('0x56')]);var _0x647a0d={'where':_0x5b85a7[_0x9270('0x51')]};return db[_0x9270('0x42')][_0x9270('0x32')](_0x647a0d)['then'](function(_0x314e46){_0x13a526[_0x9270('0x32')]=_0x314e46;if(_0x17abd5[_0x9270('0x47')][_0x9270('0x57')]){_0x5b85a7['include']=[{'all':!![]}];}return db[_0x9270('0x42')][_0x9270('0x58')](_0x5b85a7);})[_0x9270('0x37')](function(_0x297488){_0x13a526[_0x9270('0x59')]=_0x297488;return _0x13a526;})['then'](respondWithFilteredResult(_0x4a85af,_0x5b85a7))[_0x9270('0x2b')](handleError(_0x4a85af,null));};exports[_0x9270('0x5a')]=function(_0x20a904,_0x4bfe48){var _0xb53301={'raw':![],'where':{'id':_0x20a904[_0x9270('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x9270('0x5c')}]},_0x164e71={};_0x164e71[_0x9270('0x45')]=_[_0x9270('0x48')](db[_0x9270('0x42')][_0x9270('0x5d')]);_0x164e71[_0x9270('0x47')]=_[_0x9270('0x48')](_0x20a904[_0x9270('0x47')]);_0x164e71[_0x9270('0x49')]=_['intersection'](_0x164e71[_0x9270('0x45')],_0x164e71['query']);_0xb53301[_0x9270('0x4b')]=_['intersection'](_0x164e71[_0x9270('0x45')],qs[_0x9270('0x4c')](_0x20a904['query']['fields']));_0xb53301['attributes']=_0xb53301[_0x9270('0x4b')][_0x9270('0x4d')]?_0xb53301[_0x9270('0x4b')]:_0x164e71['model'];if(_0x20a904['query']['includeAll']){_0xb53301[_0x9270('0x5e')]=[{'all':!![]}];}_0xb53301=_['merge']({},_0xb53301,_0x20a904[_0x9270('0x56')]);return db['OpenchannelAccount'][_0x9270('0x5f')](_0xb53301)[_0x9270('0x37')](handleEntityNotFound(_0x4bfe48,null))['then'](respondWithResult(_0x4bfe48,null))[_0x9270('0x2b')](handleError(_0x4bfe48,null));};exports[_0x9270('0x60')]=function(_0x4ea563,_0x46f528){return db['OpenchannelAccount'][_0x9270('0x60')](_0x4ea563[_0x9270('0x61')],{})[_0x9270('0x37')](function(_0x1faf00){var _0x9946ef=_0x4ea563[_0x9270('0x62')][_0x9270('0x39')]({'plain':!![]});if(!_0x9946ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9946ef[_0x9270('0x63')]==='user'){var _0x177c44=_0x1faf00[_0x9270('0x39')]({'plain':!![]});var _0x3681fa=_0x9270('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x3681fa,'userProfileId':_0x9946ef['userProfileId']},'raw':!![]})['then'](function(_0x466a32){if(_0x466a32&&_0x466a32[_0x9270('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x177c44['name'],'resourceId':_0x177c44['id'],'type':_0x466a32['name'],'sectionId':_0x466a32['id']},{})['then'](function(){return _0x1faf00;});}else{return _0x1faf00;}})[_0x9270('0x2b')](function(_0x5325a8){logger[_0x9270('0x28')](_0x9270('0x65'),_0x5325a8);throw _0x5325a8;});}return _0x1faf00;})[_0x9270('0x37')](respondWithResult(_0x46f528,0xc9))[_0x9270('0x2b')](handleError(_0x46f528,null));};exports[_0x9270('0x36')]=function(_0x60dc53,_0x5d19ad){if(_0x60dc53[_0x9270('0x61')]['id']){delete _0x60dc53[_0x9270('0x61')]['id'];}return db[_0x9270('0x42')][_0x9270('0x5f')]({'where':{'id':_0x60dc53[_0x9270('0x5b')]['id']},'include':[{'model':db[_0x9270('0x41')],'as':_0x9270('0x5c')}]})['then'](handleEntityNotFound(_0x5d19ad,null))[_0x9270('0x37')](saveUpdates(_0x60dc53[_0x9270('0x61')],null))[_0x9270('0x37')](respondWithResult(_0x5d19ad,null))[_0x9270('0x2b')](handleError(_0x5d19ad,null));};exports[_0x9270('0x38')]=function(_0x48b518,_0x1e348c){return db[_0x9270('0x42')][_0x9270('0x5f')]({'where':{'id':_0x48b518[_0x9270('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1e348c,null))['then'](removeEntity(_0x1e348c,null))['catch'](handleError(_0x1e348c,null));};exports['describe']=function(_0x1439bc,_0x28a5a3){return db[_0x9270('0x42')]['describe']()[_0x9270('0x37')](respondWithResult(_0x28a5a3,null))['catch'](handleError(_0x28a5a3,null));};exports['addDisposition']=function(_0x5c364c,_0x5dbe3a,_0x4a251b){if(_0x5c364c[_0x9270('0x61')]['id']){delete _0x5c364c[_0x9270('0x61')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x5c364c[_0x9270('0x5b')]['id']}})[_0x9270('0x37')](handleEntityNotFound(_0x5dbe3a,null))[_0x9270('0x37')](function(_0x4ede5b){if(_0x4ede5b){_0x5c364c['body'][_0x9270('0x66')]=_0x4ede5b['id'];return db['Disposition'][_0x9270('0x60')](_0x5c364c[_0x9270('0x61')]);}})[_0x9270('0x37')](respondWithResult(_0x5dbe3a,null))[_0x9270('0x2b')](handleError(_0x5dbe3a,null));};exports[_0x9270('0x67')]=function(_0x4c944b,_0x2d39e1,_0x21064c){var _0x5ae37c={'raw':![],'where':{}};var _0x3d5656={};var _0x562738={'count':0x0,'rows':[]};return db[_0x9270('0x42')][_0x9270('0x68')]({'where':{'id':_0x4c944b['params']['id']}})['then'](handleEntityNotFound(_0x2d39e1,null))[_0x9270('0x37')](function(_0x48d67d){if(_0x48d67d){_0x3d5656[_0x9270('0x45')]=_[_0x9270('0x48')](db[_0x9270('0x69')]['rawAttributes']);_0x3d5656['query']=_['keys'](_0x4c944b[_0x9270('0x47')]);_0x3d5656[_0x9270('0x49')]=_[_0x9270('0x4a')](_0x3d5656[_0x9270('0x45')],_0x3d5656['query']);_0x5ae37c[_0x9270('0x4b')]=_[_0x9270('0x4a')](_0x3d5656['model'],qs['fields'](_0x4c944b[_0x9270('0x47')][_0x9270('0x4c')]));_0x5ae37c[_0x9270('0x4b')]=_0x5ae37c[_0x9270('0x4b')][_0x9270('0x4d')]?_0x5ae37c[_0x9270('0x4b')]:_0x3d5656['model'];if(!_0x4c944b['query']['hasOwnProperty'](_0x9270('0x6a'))){_0x5ae37c['limit']=qs['limit'](_0x4c944b[_0x9270('0x47')][_0x9270('0x30')]);_0x5ae37c[_0x9270('0x2f')]=qs['offset'](_0x4c944b[_0x9270('0x47')]['offset']);}_0x5ae37c[_0x9270('0x4f')]=qs[_0x9270('0x50')](_0x4c944b['query']['sort']);_0x5ae37c[_0x9270('0x51')]=qs[_0x9270('0x49')](_['pick'](_0x4c944b['query'],_0x3d5656['filters']));_0x5ae37c['where'][_0x9270('0x66')]=_0x48d67d['id'];if(_0x4c944b[_0x9270('0x47')]['filter']){_0x5ae37c[_0x9270('0x51')]=_[_0x9270('0x54')](_0x5ae37c[_0x9270('0x51')],{'$or':_['map'](_0x5ae37c['attributes'],function(_0x511402){var _0x2e4a72={};_0x2e4a72[_0x511402]={'$like':'%'+_0x4c944b[_0x9270('0x47')]['filter']+'%'};return _0x2e4a72;})});}_0x5ae37c=_[_0x9270('0x54')]({},_0x5ae37c,_0x4c944b['options']);return db[_0x9270('0x69')][_0x9270('0x32')]({'where':_0x5ae37c[_0x9270('0x51')]})['then'](function(_0x544828){_0x562738[_0x9270('0x32')]=_0x544828;if(_0x4c944b[_0x9270('0x47')]['includeAll']){_0x5ae37c[_0x9270('0x5e')]=[{'all':!![]}];}return db[_0x9270('0x69')]['findAll'](_0x5ae37c);})[_0x9270('0x37')](function(_0x19d7d1){_0x562738[_0x9270('0x59')]=_0x19d7d1;return _0x562738;});}})['then'](respondWithFilteredResult(_0x2d39e1,_0x5ae37c))[_0x9270('0x2b')](handleError(_0x2d39e1,null));};exports[_0x9270('0x6b')]=function(_0x3c121b,_0x3708f3,_0xb09f29){return db[_0x9270('0x42')][_0x9270('0x5f')]({'where':{'id':_0x3c121b[_0x9270('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3708f3,null))[_0x9270('0x37')](function(_0x396bd5){if(_0x396bd5){return _0x396bd5[_0x9270('0x6b')](_0x3c121b[_0x9270('0x47')][_0x9270('0x6c')]);}})[_0x9270('0x37')](respondWithStatusCode(_0x3708f3,null))['catch'](handleError(_0x3708f3,null));};exports[_0x9270('0x6d')]=function(_0x342878,_0x451689,_0x369766){if(_0x342878[_0x9270('0x61')]['id']){delete _0x342878['body']['id'];}return db['OpenchannelAccount'][_0x9270('0x5f')]({'where':{'id':_0x342878[_0x9270('0x5b')]['id']}})[_0x9270('0x37')](handleEntityNotFound(_0x451689,null))[_0x9270('0x37')](function(_0xa8f0d){if(_0xa8f0d){_0x342878[_0x9270('0x61')][_0x9270('0x66')]=_0xa8f0d['id'];return db[_0x9270('0x6e')]['create'](_0x342878[_0x9270('0x61')]);}})[_0x9270('0x37')](respondWithResult(_0x451689,null))[_0x9270('0x2b')](handleError(_0x451689,null));};exports['getAnswers']=function(_0x31ea9a,_0x38cdac,_0x21529b){var _0x1d1530={'raw':![],'where':{}};var _0x3da0cc={};var _0x2463b1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9270('0x68')]({'where':{'id':_0x31ea9a[_0x9270('0x5b')]['id']}})[_0x9270('0x37')](handleEntityNotFound(_0x38cdac,null))['then'](function(_0x8b7737){if(_0x8b7737){_0x3da0cc['model']=_[_0x9270('0x48')](db['CannedAnswer'][_0x9270('0x5d')]);_0x3da0cc[_0x9270('0x47')]=_[_0x9270('0x48')](_0x31ea9a['query']);_0x3da0cc[_0x9270('0x49')]=_[_0x9270('0x4a')](_0x3da0cc[_0x9270('0x45')],_0x3da0cc['query']);_0x1d1530[_0x9270('0x4b')]=_[_0x9270('0x4a')](_0x3da0cc['model'],qs[_0x9270('0x4c')](_0x31ea9a[_0x9270('0x47')][_0x9270('0x4c')]));_0x1d1530[_0x9270('0x4b')]=_0x1d1530[_0x9270('0x4b')][_0x9270('0x4d')]?_0x1d1530['attributes']:_0x3da0cc[_0x9270('0x45')];if(!_0x31ea9a[_0x9270('0x47')]['hasOwnProperty'](_0x9270('0x6a'))){_0x1d1530[_0x9270('0x30')]=qs['limit'](_0x31ea9a[_0x9270('0x47')]['limit']);_0x1d1530[_0x9270('0x2f')]=qs['offset'](_0x31ea9a[_0x9270('0x47')][_0x9270('0x2f')]);}_0x1d1530[_0x9270('0x4f')]=qs['sort'](_0x31ea9a[_0x9270('0x47')]['sort']);_0x1d1530['where']=qs['filters'](_[_0x9270('0x52')](_0x31ea9a['query'],_0x3da0cc['filters']));_0x1d1530[_0x9270('0x51')][_0x9270('0x66')]=_0x8b7737['id'];if(_0x31ea9a[_0x9270('0x47')][_0x9270('0x53')]){_0x1d1530['where']=_[_0x9270('0x54')](_0x1d1530['where'],{'$or':_['map'](_0x1d1530['attributes'],function(_0x585139){var _0x17a47d={};_0x17a47d[_0x585139]={'$like':'%'+_0x31ea9a['query']['filter']+'%'};return _0x17a47d;})});}_0x1d1530=_[_0x9270('0x54')]({},_0x1d1530,_0x31ea9a[_0x9270('0x56')]);return db[_0x9270('0x6e')]['count']({'where':_0x1d1530[_0x9270('0x51')]})[_0x9270('0x37')](function(_0x2e819e){_0x2463b1['count']=_0x2e819e;if(_0x31ea9a[_0x9270('0x47')][_0x9270('0x57')]){_0x1d1530['include']=[{'all':!![]}];}return db[_0x9270('0x6e')][_0x9270('0x58')](_0x1d1530);})[_0x9270('0x37')](function(_0x402868){_0x2463b1[_0x9270('0x59')]=_0x402868;return _0x2463b1;});}})[_0x9270('0x37')](respondWithFilteredResult(_0x38cdac,_0x1d1530))[_0x9270('0x2b')](handleError(_0x38cdac,null));};exports[_0x9270('0x6f')]=function(_0x219175,_0x13db0c,_0x29287b){return db['OpenchannelAccount'][_0x9270('0x5f')]({'where':{'id':_0x219175[_0x9270('0x5b')]['id']}})['then'](handleEntityNotFound(_0x13db0c,null))[_0x9270('0x37')](function(_0x51e8bf){if(_0x51e8bf){return _0x51e8bf[_0x9270('0x6f')](_0x219175[_0x9270('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x13db0c,null))[_0x9270('0x2b')](handleError(_0x13db0c,null));};exports[_0x9270('0x70')]=function(_0x813fc9,_0x8ec9ba,_0x247244){var _0x593db6={'body':_0x813fc9[_0x9270('0x61')],'channel':_0x9270('0x71')};var _0x4d4b21=[];var _0x2e3520=[];var _0x668e3e={};var _0x31977e=![];return db[_0x9270('0x72')][_0x9270('0x73')]()[_0x9270('0x37')](function(_0x54f566){if(!_0x54f566){throw new db[(_0x9270('0x74'))]['ValidationError'](_0x9270('0x75'));}_0x4d4b21=_[_0x9270('0x76')](_['keys'](_0x54f566),[_0x9270('0x77'),_0x9270('0x78')]);_0x2e3520=_[_0x9270('0x76')](_[_0x9270('0x48')](_0x54f566),[_0x9270('0x77'),_0x9270('0x78'),_0x9270('0x79'),_0x9270('0x7a')]);if(_0x813fc9['body']['id']){delete _0x813fc9['body']['id'];}if(_[_0x9270('0x7b')](_0x813fc9[_0x9270('0x61')][_0x9270('0x7c')])){throw new db[(_0x9270('0x74'))][(_0x9270('0x7d'))](_0x9270('0x7e'));}if(_[_0x9270('0x7b')](_0x813fc9[_0x9270('0x61')][_0x9270('0x61')])||_0x813fc9['body'][_0x9270('0x61')]===''){throw new db['Sequelize'][(_0x9270('0x7d'))](_0x9270('0x7f'));}if(_[_0x9270('0x7b')](_0x813fc9[_0x9270('0x61')][_0x9270('0x80')])){throw new db['Sequelize']['ValidationError'](_0x9270('0x81')+_0x2e3520);}if(!_['includes'](_0x2e3520,_0x813fc9[_0x9270('0x61')][_0x9270('0x80')])){throw new db[(_0x9270('0x74'))][(_0x9270('0x7d'))](_0x9270('0x82')+_0x2e3520);}_0x668e3e[_0x813fc9['body'][_0x9270('0x80')]]=_0x813fc9['body'][_0x9270('0x7c')];})[_0x9270('0x37')](function(){return db['OpenchannelAccount'][_0x9270('0x5f')]({'where':{'id':_0x813fc9[_0x9270('0x5b')]['id']},'include':[{'model':db[_0x9270('0x83')],'as':_0x9270('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x668e3e,'limit':0x1,'order':[[_0x9270('0x78'),_0x9270('0x85')]]}]},{'model':db[_0x9270('0x86')],'as':_0x9270('0x87')}]});})[_0x9270('0x37')](handleEntityNotFound(_0x8ec9ba,null))[_0x9270('0x37')](function(_0x5e7894){if(_0x5e7894&&_0x5e7894[_0x9270('0x84')]){_0x593db6[_0x9270('0x88')]=_0x5e7894;_0x593db6[_0x9270('0x89')]=_0x5e7894[_0x9270('0x87')];_0x593db6[_0x9270('0x8a')]=_0x5e7894[_0x9270('0x84')];_0x593db6['applications']=_[_0x9270('0x8b')](_0x593db6[_0x9270('0x89')],[_0x9270('0x8c')],[_0x9270('0x8d')]);if(_0x593db6['account']['Applications']){delete _0x593db6[_0x9270('0x88')][_0x9270('0x87')];}if(_0x593db6[_0x9270('0x88')][_0x9270('0x84')]&&_0x593db6[_0x9270('0x88')][_0x9270('0x84')][_0x9270('0x8e')][_0x9270('0x4d')]){return _0x593db6[_0x9270('0x88')][_0x9270('0x84')][_0x9270('0x8e')][0x0];}var _0x39ec04=_['defaults'](_0x813fc9[_0x9270('0x61')],{'firstName':_0x813fc9[_0x9270('0x61')][_0x9270('0x7c')],'ListId':_0x5e7894[_0x9270('0x7a')]});_0x39ec04[_0x813fc9[_0x9270('0x61')][_0x9270('0x80')]]=_0x813fc9[_0x9270('0x61')][_0x9270('0x7c')];return db[_0x9270('0x72')]['create'](_0x39ec04,{'fields':_0x4d4b21,'raw':!![]});}})[_0x9270('0x37')](handleEntityNotFound(_0x8ec9ba,null))[_0x9270('0x37')](function(_0x157158){_0x593db6[_0x9270('0x8f')]=_0x157158;if(_0x157158){var _0x9da1b6={'ContactId':_0x157158['id'],'OpenchannelAccountId':_0x813fc9[_0x9270('0x5b')]['id'],'from':(_0x157158[_0x9270('0x90')]||'')+'\x20'+(_0x157158[_0x9270('0x91')]||'')};var _0x285485={'OpenchannelAccountId':_0x813fc9[_0x9270('0x5b')]['id'],'closed':![]};if(_0x813fc9[_0x9270('0x61')][_0x9270('0x92')]){_0x285485[_0x9270('0x92')]=_0x813fc9['body'][_0x9270('0x92')];return db[_0x9270('0x93')]['find']({'where':_0x285485})['then'](function(_0x4b76a6){if(_0x4b76a6){return[_0x4b76a6,![]];}_0x9da1b6[_0x9270('0x92')]=_0x813fc9[_0x9270('0x61')][_0x9270('0x92')];_0x9da1b6[_0x9270('0x94')]=_0x813fc9[_0x9270('0x61')][_0x9270('0x94')];return db[_0x9270('0x93')][_0x9270('0x60')](_0x9da1b6)[_0x9270('0x37')](function(_0x5e1171){return[_0x5e1171,!![]];});});}else{_0x285485[_0x9270('0x92')]=null;}_0x285485['ContactId']=_0x157158['id'];return db[_0x9270('0x93')]['find']({'where':_0x285485})['then'](function(_0x43a9fa){if(_0x43a9fa){return[_0x43a9fa,![]];}return db[_0x9270('0x93')][_0x9270('0x60')](_0x9da1b6)['then'](function(_0x5a1895){return[_0x5a1895,!![]];});});}})[_0x9270('0x95')](function(_0x3617b1,_0x3ab95e){if(_0x3617b1){_0x31977e=_0x3ab95e;if(!_0x3ab95e){var _0x37e6ac={'from':(_0x593db6[_0x9270('0x8f')]['firstName']||'')+'\x20'+(_0x593db6[_0x9270('0x8f')]['lastName']||'')};if(_0x813fc9[_0x9270('0x61')][_0x9270('0x92')]&&_0x813fc9[_0x9270('0x61')]['messageId']&&_0x813fc9[_0x9270('0x61')]['threadId']!=_0x813fc9[_0x9270('0x61')][_0x9270('0x96')]){_0x37e6ac[_0x9270('0x92')]=_0x813fc9[_0x9270('0x61')]['messageId'];}return _0x3617b1[_0x9270('0x36')](_0x37e6ac);}else{return _0x3617b1;}}})['then'](function(_0x347b31){_0x593db6[_0x9270('0x97')]=_0x347b31[_0x9270('0x39')]({'plain':!![]});_0x593db6['interaction'][_0x9270('0x98')]=_0x31977e;if(_0x593db6['interaction'][_0x9270('0x98')]){if(_0x593db6[_0x9270('0x88')][_0x9270('0x99')]){_0x593db6['applications']['push']({'id':0x0,'priority':_0x593db6[_0x9270('0x89')]['length']+0x1,'app':_0x9270('0x9a'),'appdata':_0x9270('0x9b'),'interval':_0x9270('0x9c')});}}return db[_0x9270('0x9d')]['create']({'body':_0x813fc9[_0x9270('0x61')][_0x9270('0x61')],'OpenchannelAccountId':_0x813fc9[_0x9270('0x5b')]['id'],'OpenchannelInteractionId':_0x347b31['id'],'direction':'in','ContactId':_0x593db6[_0x9270('0x8f')]['id'],'AttachmentId':_0x813fc9[_0x9270('0x61')][_0x9270('0x9e')]});})['then'](function(_0x2f5d76){_0x593db6[_0x9270('0x29')]=_0x2f5d76;if(!_0x593db6[_0x9270('0x97')]['UserId'])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x593db6[_0x9270('0x97')]['UserId']}});})['then'](function(_0x1f0f8b){if(_0x1f0f8b){_0x593db6[_0x9270('0x89')][_0x9270('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1f0f8b[_0x9270('0x3e')]+','+(_0x593db6[_0x9270('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x9270('0x9c')});}if(!_0x593db6[_0x9270('0x97')]['queueId'])return;return db[_0x9270('0xa0')][_0x9270('0x5f')]({'attributes':['id',_0x9270('0x3e')],'where':{'id':_0x593db6[_0x9270('0x97')]['queueId']}});})[_0x9270('0x37')](function(_0x2fdd3f){if(_0x2fdd3f){_0x593db6[_0x9270('0x89')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2fdd3f['name']+','+(_0x593db6['account'][_0x9270('0xa1')]||0x12c),'interval':_0x9270('0x9c')});}return respondWithRpcPromise(_0x9270('0xa2'),'startRouting',_0x593db6);})[_0x9270('0x37')](function(_0x5c52c5){respondWithRpcPromise(_0x9270('0xa3'),_0x9270('0xa3'),{'event':_0x9270('0x70'),'message':_0x5c52c5},client9002);return _0x5c52c5;})[_0x9270('0x37')](respondWithResult(_0x8ec9ba,null))['catch'](handleError(_0x8ec9ba,null));};exports[_0x9270('0xa4')]=function(_0x2242a0,_0x3c7f5f){var _0x57239a=_0x2242a0['params']['id'];var _0x71b443=_0x2242a0[_0x9270('0x61')];var _0x25f7d7=0xc8;var _0x47b808=null;return db[_0x9270('0xa5')][_0x9270('0xa6')]({'isolationLevel':db[_0x9270('0xa5')][_0x9270('0xa7')][_0x9270('0xa8')]['READ_COMMITTED']},function(_0x3bf3d8){return db[_0x9270('0x42')][_0x9270('0x68')]({'where':{'id':_0x57239a},'transaction':_0x3bf3d8})[_0x9270('0x37')](function(_0x56e653){if(_0x56e653){return db[_0x9270('0x86')][_0x9270('0x38')]({'where':{'OpenchannelAccountId':_0x57239a},'transaction':_0x3bf3d8})[_0x9270('0x37')](function(){var _0x3e0404=_[_0x9270('0x46')](_0x71b443,function(_0x36e483){_0x36e483[_0x9270('0x66')]=_0x57239a;return _0x36e483;});return db[_0x9270('0x86')][_0x9270('0xa9')](_0x3e0404,{'transaction':_0x3bf3d8});});}else{_0x25f7d7=0x194;_0x47b808=[];}});})[_0x9270('0x37')](function(){if(_0x25f7d7!==0x194){return db[_0x9270('0x86')][_0x9270('0xaa')]({'where':{'OpenchannelAccountId':_0x57239a},'order':_0x9270('0x8c')})[_0x9270('0x37')](function(_0x34f57b){_0x47b808=_0x34f57b;});}})[_0x9270('0x2b')](function(_0xf2d581){_0x25f7d7=0x1f4;logger[_0x9270('0x28')](_0xf2d581['stack']);if(_0xf2d581['name']){delete _0xf2d581[_0x9270('0x3e')];}_0x47b808=_0xf2d581;})[_0x9270('0xab')](function(){if(_0x47b808===null){_0x3c7f5f[_0x9270('0x2c')](_0x25f7d7);}else{if(_0x25f7d7===0x1f4){_0x3c7f5f['status'](_0x25f7d7)['send'](_0x47b808);}else{_0x3c7f5f[_0x9270('0x2d')](_0x25f7d7)[_0x9270('0x2e')](_0x47b808);}}});};exports[_0x9270('0xac')]=function(_0x5c389a,_0x510ea8,_0x3ac4ec){var _0x1272c1={};var _0xe35614={};var _0x1a2ad4;var _0x384594;return db[_0x9270('0x42')][_0x9270('0x68')]({'where':{'id':_0x5c389a[_0x9270('0x5b')]['id']}})[_0x9270('0x37')](handleEntityNotFound(_0x510ea8,null))[_0x9270('0x37')](function(_0x28f338){if(_0x28f338){_0x1a2ad4=_0x28f338;_0xe35614[_0x9270('0x45')]=_[_0x9270('0x48')](db[_0x9270('0x86')][_0x9270('0x5d')]);_0xe35614[_0x9270('0x47')]=_[_0x9270('0x48')](_0x5c389a['query']);_0xe35614['filters']=_[_0x9270('0x4a')](_0xe35614[_0x9270('0x45')],_0xe35614[_0x9270('0x47')]);_0x1272c1['attributes']=_[_0x9270('0x4a')](_0xe35614[_0x9270('0x45')],qs[_0x9270('0x4c')](_0x5c389a[_0x9270('0x47')][_0x9270('0x4c')]));_0x1272c1[_0x9270('0x4b')]=_0x1272c1[_0x9270('0x4b')][_0x9270('0x4d')]?_0x1272c1[_0x9270('0x4b')]:_0xe35614[_0x9270('0x45')];_0x1272c1[_0x9270('0x4f')]=qs[_0x9270('0x50')](_0x5c389a[_0x9270('0x47')][_0x9270('0x50')]);_0x1272c1[_0x9270('0x51')]=qs[_0x9270('0x49')](_['pick'](_0x5c389a[_0x9270('0x47')],_0xe35614[_0x9270('0x49')]));if(_0x5c389a[_0x9270('0x47')][_0x9270('0x53')]){_0x1272c1[_0x9270('0x51')]=_[_0x9270('0x54')](_0x1272c1['where'],{'$or':_['map'](_0x1272c1[_0x9270('0x4b')],function(_0x5d8804){var _0x433e62={};_0x433e62[_0x5d8804]={'$like':'%'+_0x5c389a[_0x9270('0x47')]['filter']+'%'};return _0x433e62;})});}_0x1272c1=_[_0x9270('0x54')]({},_0x1272c1,_0x5c389a[_0x9270('0x56')]);return _0x1a2ad4[_0x9270('0xac')](_0x1272c1);}})[_0x9270('0x37')](function(_0xcfc133){if(_0xcfc133){_0x384594=_0xcfc133['length'];if(!_0x5c389a[_0x9270('0x47')][_0x9270('0x4e')](_0x9270('0x6a'))){_0x1272c1[_0x9270('0x30')]=qs['limit'](_0x5c389a['query'][_0x9270('0x30')]);_0x1272c1[_0x9270('0x2f')]=qs[_0x9270('0x2f')](_0x5c389a[_0x9270('0x47')][_0x9270('0x2f')]);}return _0x1a2ad4['getApplications'](_0x1272c1);}})[_0x9270('0x37')](function(_0x5ed286){if(_0x5ed286){return _0x5ed286?{'count':_0x384594,'rows':_0x5ed286}:null;}})[_0x9270('0x37')](respondWithResult(_0x510ea8,null))['catch'](handleError(_0x510ea8,null));};exports[_0x9270('0xad')]=function(_0x58ded1,_0x520f31,_0x1164a0){var _0x3ddee0={'raw':![],'where':{}};var _0x156569={};var _0x4813d6={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9270('0x68')]({'where':{'id':_0x58ded1['params']['id']}})['then'](handleEntityNotFound(_0x520f31,null))[_0x9270('0x37')](function(_0x24ffc1){if(_0x24ffc1){_0x156569[_0x9270('0x45')]=_[_0x9270('0x48')](db[_0x9270('0x93')][_0x9270('0x5d')]);_0x156569[_0x9270('0x47')]=_[_0x9270('0x48')](_0x58ded1['query']);_0x156569['filters']=_['intersection'](_0x156569[_0x9270('0x45')],_0x156569[_0x9270('0x47')]);_0x3ddee0[_0x9270('0x4b')]=_[_0x9270('0x4a')](_0x156569[_0x9270('0x45')],qs[_0x9270('0x4c')](_0x58ded1[_0x9270('0x47')][_0x9270('0x4c')]));_0x3ddee0[_0x9270('0x4b')]=_0x3ddee0[_0x9270('0x4b')]['length']?_0x3ddee0['attributes']:_0x156569['model'];if(!_0x58ded1[_0x9270('0x47')][_0x9270('0x4e')]('nolimit')){_0x3ddee0[_0x9270('0x30')]=qs[_0x9270('0x30')](_0x58ded1[_0x9270('0x47')][_0x9270('0x30')]);_0x3ddee0['offset']=qs[_0x9270('0x2f')](_0x58ded1[_0x9270('0x47')]['offset']);}_0x3ddee0[_0x9270('0x4f')]=qs[_0x9270('0x50')](_0x58ded1[_0x9270('0x47')][_0x9270('0x50')]);_0x3ddee0[_0x9270('0x51')]=qs[_0x9270('0x49')](_[_0x9270('0x52')](_0x58ded1['query'],_0x156569[_0x9270('0x49')]));_0x3ddee0['where'][_0x9270('0x66')]=_0x24ffc1['id'];if(_0x58ded1[_0x9270('0x47')][_0x9270('0x53')]){_0x3ddee0[_0x9270('0x51')]=_[_0x9270('0x54')](_0x3ddee0[_0x9270('0x51')],{'$or':_['map'](_0x3ddee0[_0x9270('0x4b')],function(_0x2ae055){var _0x4b3e30={};_0x4b3e30[_0x2ae055]={'$like':'%'+_0x58ded1['query']['filter']+'%'};return _0x4b3e30;})});}_0x3ddee0=_[_0x9270('0x54')]({},_0x3ddee0,_0x58ded1['options']);return db[_0x9270('0x93')][_0x9270('0x32')]({'where':_0x3ddee0['where']})[_0x9270('0x37')](function(_0x21273f){_0x4813d6[_0x9270('0x32')]=_0x21273f;if(_0x58ded1[_0x9270('0x47')][_0x9270('0x57')]){_0x3ddee0[_0x9270('0x5e')]=[{'model':db[_0x9270('0x72')],'as':'Contact','required':![]},{'model':db[_0x9270('0xae')],'as':_0x9270('0xaf'),'attributes':[_0x9270('0x3e'),_0x9270('0xb0'),_0x9270('0xb1')],'required':![]},{'model':db[_0x9270('0xb2')],'as':'Tags','attributes':['id','name',_0x9270('0xb3')],'where':_0x58ded1['query']['tag']?{'id':_0x58ded1[_0x9270('0x47')]['tag']}:undefined,'required':_0x58ded1[_0x9270('0x47')][_0x9270('0xb4')]?!![]:![]}];}return db[_0x9270('0x93')][_0x9270('0x58')](_0x3ddee0);})['then'](function(_0x59e81c){_0x4813d6[_0x9270('0x59')]=_0x59e81c;return _0x4813d6;});}})[_0x9270('0x37')](respondWithFilteredResult(_0x520f31,_0x3ddee0))[_0x9270('0x2b')](handleError(_0x520f31,null));};exports[_0x9270('0xb5')]=function(_0x17ba32,_0x120bff,_0xb0bcc3){return db[_0x9270('0x42')][_0x9270('0x5f')]({'where':{'id':_0x17ba32[_0x9270('0x5b')]['id']}})[_0x9270('0x37')](handleEntityNotFound(_0x120bff,null))[_0x9270('0x37')](function(_0x1fd123){if(_0x1fd123){return _0x1fd123[_0x9270('0xb5')](_0x17ba32[_0x9270('0x61')]['ids'],_['omit'](_0x17ba32[_0x9270('0x61')],[_0x9270('0x6c'),'id'])||{})[_0x9270('0x95')](function(_0x5e313d){for(var _0x228004=0x0;_0x228004<_0x17ba32[_0x9270('0x61')][_0x9270('0x6c')][_0x9270('0x4d')];_0x228004+=0x1){socket[_0x9270('0xb6')](_0x9270('0xb7'),{'UserId':Number(_0x17ba32[_0x9270('0x61')][_0x9270('0x6c')][_0x228004]),'OpenchannelAccountId':Number(_0x17ba32['params']['id'])});}return _0x5e313d;});}})[_0x9270('0x37')](respondWithResult(_0x120bff,null))[_0x9270('0x2b')](handleError(_0x120bff,null));};exports[_0x9270('0xb8')]=function(_0x29fe2a,_0xdb9f30,_0x2ff605){return db[_0x9270('0x42')]['find']({'where':{'id':_0x29fe2a[_0x9270('0x5b')]['id']}})[_0x9270('0x37')](handleEntityNotFound(_0xdb9f30,null))[_0x9270('0x37')](function(_0x53c200){if(_0x53c200){return _0x53c200['removeAgents'](_0x29fe2a[_0x9270('0x47')][_0x9270('0x6c')])[_0x9270('0x37')](function(){if(_['isArray'](_0x29fe2a[_0x9270('0x47')][_0x9270('0x6c')])){for(var _0x40c81e=0x0;_0x40c81e<_0x29fe2a[_0x9270('0x47')][_0x9270('0x6c')][_0x9270('0x4d')];_0x40c81e+=0x1){socket['emit'](_0x9270('0xb9'),{'UserId':Number(_0x29fe2a[_0x9270('0x47')]['ids'][_0x40c81e]),'OpenchannelAccountId':Number(_0x29fe2a['params']['id'])});}}else{socket[_0x9270('0xb6')](_0x9270('0xb9'),{'UserId':Number(_0x29fe2a['query'][_0x9270('0x6c')]),'OpenchannelAccountId':Number(_0x29fe2a['params']['id'])});}});}})['then'](respondWithStatusCode(_0xdb9f30,null))[_0x9270('0x2b')](handleError(_0xdb9f30,null));};exports[_0x9270('0xba')]=function(_0x44ea53,_0x1a7e4a,_0x90a648){var _0x5e7c42={};var _0xe1e8dd={};var _0x1ab116;var _0x18d21f;return db[_0x9270('0x42')][_0x9270('0x68')]({'where':{'id':_0x44ea53['params']['id']}})[_0x9270('0x37')](handleEntityNotFound(_0x1a7e4a,null))[_0x9270('0x37')](function(_0x58bebb){if(_0x58bebb){_0x1ab116=_0x58bebb;_0xe1e8dd[_0x9270('0x45')]=_[_0x9270('0x48')](db[_0x9270('0xae')]['rawAttributes']);_0xe1e8dd[_0x9270('0x47')]=_[_0x9270('0x48')](_0x44ea53[_0x9270('0x47')]);_0xe1e8dd[_0x9270('0x49')]=_['intersection'](_0xe1e8dd[_0x9270('0x45')],_0xe1e8dd[_0x9270('0x47')]);_0x5e7c42[_0x9270('0x4b')]=_['intersection'](_0xe1e8dd['model'],qs[_0x9270('0x4c')](_0x44ea53['query']['fields']));_0x5e7c42['attributes']=_0x5e7c42[_0x9270('0x4b')][_0x9270('0x4d')]?_0x5e7c42[_0x9270('0x4b')]:_0xe1e8dd[_0x9270('0x45')];_0x5e7c42[_0x9270('0x4f')]=qs[_0x9270('0x50')](_0x44ea53[_0x9270('0x47')][_0x9270('0x50')]);_0x5e7c42[_0x9270('0x51')]=qs['filters'](_[_0x9270('0x52')](_0x44ea53[_0x9270('0x47')],_0xe1e8dd['filters']));if(_0x44ea53['query']['filter']){_0x5e7c42[_0x9270('0x51')]=_['merge'](_0x5e7c42['where'],{'$or':_[_0x9270('0x46')](_0x5e7c42[_0x9270('0x4b')],function(_0x5eb00f){var _0x3830c3={};_0x3830c3[_0x5eb00f]={'$like':'%'+_0x44ea53['query'][_0x9270('0x53')]+'%'};return _0x3830c3;})});}_0x5e7c42=_[_0x9270('0x54')]({},_0x5e7c42,_0x44ea53[_0x9270('0x56')]);return _0x1ab116[_0x9270('0xba')](_0x5e7c42);}})[_0x9270('0x37')](function(_0x59d8b7){if(_0x59d8b7){_0x18d21f=_0x59d8b7[_0x9270('0x4d')];if(!_0x44ea53['query'][_0x9270('0x4e')](_0x9270('0x6a'))){_0x5e7c42[_0x9270('0x30')]=qs[_0x9270('0x30')](_0x44ea53[_0x9270('0x47')][_0x9270('0x30')]);_0x5e7c42['offset']=qs[_0x9270('0x2f')](_0x44ea53['query']['offset']);}return _0x1ab116[_0x9270('0xba')](_0x5e7c42);}})[_0x9270('0x37')](function(_0x23feec){if(_0x23feec){return _0x23feec?{'count':_0x18d21f,'rows':_0x23feec}:null;}})['then'](respondWithResult(_0x1a7e4a,null))[_0x9270('0x2b')](handleError(_0x1a7e4a,null));};exports[_0x9270('0x3f')]=function(_0x5dff60,_0x2c7948,_0xf864c1){var _0x4f4c51,_0x174c59,_0x86e0fe;if(_['isNil'](_0x5dff60[_0x9270('0x61')]['body'])||_0x5dff60['body'][_0x9270('0x61')]===''){throw new db[(_0x9270('0x74'))][(_0x9270('0x7d'))](_0x9270('0x7f'));}if(_[_0x9270('0x7b')](_0x5dff60[_0x9270('0x61')]['to'])){}_0x4f4c51=_0x5dff60[_0x9270('0x61')]['to'];return db[_0x9270('0x42')][_0x9270('0x68')]({'where':{'id':_0x5dff60[_0x9270('0x5b')]['id']}})[_0x9270('0x37')](handleEntityNotFound(_0x2c7948,null))['then'](function(_0x543b30){if(_0x543b30){return db[_0x9270('0x42')][_0x9270('0x5f')]({'where':{'id':_0x543b30['id']},'include':[{'model':db[_0x9270('0x83')],'as':_0x9270('0x84'),'include':[{'model':db[_0x9270('0x72')],'as':_0x9270('0x8e'),'where':{[_0x543b30['mapKey']]:_0x4f4c51},'limit':0x1,'order':[[_0x9270('0x78'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2c7948,null))['then'](function(_0x1c813f){if(_0x1c813f&&_0x1c813f[_0x9270('0x84')]){_0x174c59=_0x1c813f[_0x9270('0x39')]({'plain':!![]});if(_0x174c59[_0x9270('0x84')]&&_0x174c59[_0x9270('0x84')]['Contacts'][_0x9270('0x4d')]){return _0x174c59[_0x9270('0x84')][_0x9270('0x8e')][0x0];}return db['CmContact']['create'](_['defaults'](_0x5dff60['body'],{'firstName':_0x4f4c51,[_0x1c813f['mapKey']]:_0x4f4c51,'phone':_0x4f4c51,'ListId':_0x174c59[_0x9270('0x7a')]}));}})[_0x9270('0x37')](handleEntityNotFound(_0x2c7948,null))[_0x9270('0x37')](function(_0x1f9cf3){if(_0x1f9cf3){_0x86e0fe=_0x1f9cf3;return db[_0x9270('0x93')][_0x9270('0x5f')]({'where':{'ContactId':_0x86e0fe['id'],'closed':![],'OpenchannelAccountId':_0x174c59['id']}})[_0x9270('0x37')](function(_0x213990){if(_0x213990){return[_0x213990,![]];}return db[_0x9270('0x93')][_0x9270('0x60')]({'UserId':_0x5dff60[_0x9270('0x62')]['id'],'ContactId':_0x86e0fe['id'],'OpenchannelAccountId':_0x174c59['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x9270('0x54')](_0x5dff60[_0x9270('0x61')],{'read':![],'body':_0x5dff60[_0x9270('0x61')]['body'],'OpenchannelAccountId':_0x174c59['id'],'UserId':_0x5dff60['user']['id'],'ContactId':_0x86e0fe['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x9270('0xbb')}]})[_0x9270('0x37')](function(_0xe7789c){return[_0xe7789c,!![]];});});}})[_0x9270('0x95')](function(_0x33c4d9,_0x471c46){if(_0x471c46){return _0x33c4d9;}return db[_0x9270('0x9d')]['create'](_[_0x9270('0x54')](_0x5dff60[_0x9270('0x61')],{'read':![],'body':_0x5dff60[_0x9270('0x61')][_0x9270('0x61')],'OpenchannelAccountId':_0x174c59['id'],'OpenchannelInteractionId':_0x33c4d9['id'],'UserId':_0x5dff60[_0x9270('0x62')]['id'],'ContactId':_0x86e0fe['id']}))[_0x9270('0x37')](function(_0x182996){_0x33c4d9[_0x9270('0xbc')][_0x9270('0xbb')]=[];_0x33c4d9[_0x9270('0xbc')][_0x9270('0xbb')][_0x9270('0xbd')](_0x182996[_0x9270('0xbc')]);return _0x33c4d9;});});}})[_0x9270('0x37')](respondWithResult(_0x2c7948,null))[_0x9270('0x2b')](handleError(_0x2c7948,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d3af900..aec3a9c 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 _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x12382b,_0x3314c6){var _0x142d07=function(_0x1ca1e2){while(--_0x1ca1e2){_0x12382b['push'](_0x12382b['shift']());}};_0x142d07(++_0x3314c6);}(_0x4522,0x1a0));var _0x2452=function(_0x3cc838,_0xadd531){_0x3cc838=_0x3cc838-0x0;var _0x2fee0b=_0x4522[_0x3cc838];return _0x2fee0b;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x3b2c90,_0x4559a9){var _0x21d43c=function(_0x11d47b){while(--_0x11d47b){_0x3b2c90['push'](_0x3b2c90['shift']());}};_0x21d43c(++_0x4559a9);}(_0x13f6,0x124));var _0x613f=function(_0x43ea88,_0x1a6616){_0x43ea88=_0x43ea88-0x0;var _0x1ef39f=_0x13f6[_0x43ea88];return _0x1ef39f;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b19de3b..9d2e430 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(_0x455328,_0x54284e){var _0x366865=function(_0x2641b1){while(--_0x2641b1){_0x455328['push'](_0x455328['shift']());}};_0x366865(++_0x54284e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x5bfd0d,_0x54e2d6){var _0x15095c=function(_0x12f417){while(--_0x12f417){_0x5bfd0d['push'](_0x5bfd0d['shift']());}};_0x15095c(++_0x54e2d6);}(_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 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 3657f6f..bcd4a6b 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 _0xcffe=['register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x41eb44,_0x229d85){var _0x334ba7=function(_0x4b442f){while(--_0x4b442f){_0x41eb44['push'](_0x41eb44['shift']());}};_0x334ba7(++_0x229d85);}(_0xcffe,0x1a1));var _0xecff=function(_0xa08526,_0xd2a376){_0xa08526=_0xa08526-0x0;var _0x2684eb=_0xcffe[_0xa08526];return _0x2684eb;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});config[_0xecff('0xc')]=_[_0xecff('0xd')](config[_0xecff('0xc')],{'host':_0xecff('0xe'),'port':0x18eb});var socket=require(_0xecff('0xf'))(new Redis(config['redis']));require(_0xecff('0x10'))[_0xecff('0x11')](socket);function respondWithRpcPromise(_0x195b15,_0x20ab4f,_0x698e40){return new BPromise(function(_0x4fa444,_0x425380){return client[_0xecff('0x12')](_0x195b15,_0x698e40)[_0xecff('0x13')](function(_0x3ed904){logger[_0xecff('0x14')](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));logger[_0xecff('0x17')](_0xecff('0x18'),_0x20ab4f,_0xecff('0x16'),JSON[_0xecff('0x19')](_0x3ed904));if(_0x3ed904[_0xecff('0x1a')]){if(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1b')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x20ab4f,_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);return _0x425380(_0x3ed904['error'][_0xecff('0x1c')]);}logger[_0xecff('0x1a')](_0xecff('0x15'),_0x20ab4f,_0x3ed904['error']['message']);return _0x4fa444(_0x3ed904[_0xecff('0x1a')][_0xecff('0x1c')]);}else{logger['info'](_0xecff('0x15'),_0x20ab4f,_0xecff('0x16'));_0x4fa444(_0x3ed904[_0xecff('0x1d')][_0xecff('0x1c')]);}})[_0xecff('0x1e')](function(_0x1682a2){logger['error'](_0xecff('0x15'),_0x20ab4f,_0x1682a2);_0x425380(_0x1682a2);});});} \ No newline at end of file +var _0xe9e8=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x576121,_0x9e4f7c){var _0x1e09b6=function(_0x2c04c7){while(--_0x2c04c7){_0x576121['push'](_0x576121['shift']());}};_0x1e09b6(++_0x9e4f7c);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x42c9e0,_0xbecb7f){_0x42c9e0=_0x42c9e0-0x0;var _0x379cb7=_0xe9e8[_0x42c9e0];return _0x379cb7;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});config[_0x8e9e('0xc')]=_[_0x8e9e('0xd')](config['redis'],{'host':_0x8e9e('0xe'),'port':0x18eb});var socket=require(_0x8e9e('0xf'))(new Redis(config[_0x8e9e('0xc')]));require('./openchannelAccount.socket')[_0x8e9e('0x10')](socket);function respondWithRpcPromise(_0x29edcb,_0x449f72,_0x57ffc0){return new BPromise(function(_0xbcfd72,_0x303402){return client[_0x8e9e('0x11')](_0x29edcb,_0x57ffc0)[_0x8e9e('0x12')](function(_0x35f014){logger[_0x8e9e('0x13')](_0x8e9e('0x14'),_0x449f72,'request\x20sent');logger[_0x8e9e('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x449f72,_0x8e9e('0x16'),JSON[_0x8e9e('0x17')](_0x35f014));if(_0x35f014[_0x8e9e('0x18')]){if(_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x19')]===0x1f4){logger[_0x8e9e('0x18')](_0x8e9e('0x14'),_0x449f72,_0x35f014['error']['message']);return _0x303402(_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x1a')]);}logger['error'](_0x8e9e('0x14'),_0x449f72,_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x1a')]);return _0xbcfd72(_0x35f014[_0x8e9e('0x18')][_0x8e9e('0x1a')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x449f72,_0x8e9e('0x16'));_0xbcfd72(_0x35f014[_0x8e9e('0x1b')][_0x8e9e('0x1a')]);}})[_0x8e9e('0x1c')](function(_0xa079b5){logger[_0x8e9e('0x18')](_0x8e9e('0x14'),_0x449f72,_0xa079b5);_0x303402(_0xa079b5);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3804e2b..d274a7c 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 _0x7b05=['length','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x7b05,0x91));var _0x57b0=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0x7b05[_0x249d99];return _0x5bfb05;};'use strict';var OpenchannelAccountEvents=require(_0x57b0('0x0'));var events=[_0x57b0('0x1'),_0x57b0('0x2'),_0x57b0('0x3')];function createListener(_0x522bee,_0x22febc){return function(_0x4f8992){_0x22febc[_0x57b0('0x4')](_0x522bee,_0x4f8992);};}function removeListener(_0x2be876,_0x24b7d6){return function(){OpenchannelAccountEvents[_0x57b0('0x5')](_0x2be876,_0x24b7d6);};}exports[_0x57b0('0x6')]=function(_0x5ce0f2){for(var _0x94ef9b=0x0,_0x4d8aae=events[_0x57b0('0x7')];_0x94ef9b<_0x4d8aae;_0x94ef9b++){var _0x289bea=events[_0x94ef9b];var _0x4c970f=createListener('openchannelAccount:'+_0x289bea,_0x5ce0f2);OpenchannelAccountEvents['on'](_0x289bea,_0x4c970f);}}; \ No newline at end of file +var _0x9879=['update','emit','removeListener','register','length','save','remove'];(function(_0x19ac50,_0x1fb25d){var _0x233154=function(_0x41e406){while(--_0x41e406){_0x19ac50['push'](_0x19ac50['shift']());}};_0x233154(++_0x1fb25d);}(_0x9879,0x98));var _0x9987=function(_0x32169f,_0x3c5da6){_0x32169f=_0x32169f-0x0;var _0x158445=_0x9879[_0x32169f];return _0x158445;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x9987('0x0'),_0x9987('0x1'),_0x9987('0x2')];function createListener(_0x1df4b1,_0x15471b){return function(_0x25f8c9){_0x15471b[_0x9987('0x3')](_0x1df4b1,_0x25f8c9);};}function removeListener(_0x2ab2a8,_0x37ebe8){return function(){OpenchannelAccountEvents[_0x9987('0x4')](_0x2ab2a8,_0x37ebe8);};}exports[_0x9987('0x5')]=function(_0x473510){for(var _0x15193d=0x0,_0xce52bb=events[_0x9987('0x6')];_0x15193d<_0xce52bb;_0x15193d++){var _0x555bb0=events[_0x15193d];var _0x1cf155=createListener('openchannelAccount:'+_0x555bb0,_0x473510);OpenchannelAccountEvents['on'](_0x555bb0,_0x1cf155);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 770c514..111926f 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 _0x355f=['./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0x355f,0xc0));var _0xf355=function(_0x44b2dd,_0x14f66f){_0x44b2dd=_0x44b2dd-0x0;var _0x36171d=_0x355f[_0x44b2dd];return _0x36171d;};'use strict';var multer=require('multer');var util=require(_0xf355('0x0'));var path=require(_0xf355('0x1'));var timeout=require('connect-timeout');var express=require(_0xf355('0x2'));var router=express['Router']();var fs_extra=require(_0xf355('0x3'));var auth=require(_0xf355('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf355('0x5'));var controller=require(_0xf355('0x6'));router['get']('/',auth[_0xf355('0x7')](),controller[_0xf355('0x8')]);router[_0xf355('0x9')](_0xf355('0xa'),auth[_0xf355('0x7')](),controller[_0xf355('0xb')]);router[_0xf355('0xc')]('/',auth['isAuthenticated'](),controller[_0xf355('0xd')]);router['put'](_0xf355('0xa'),auth[_0xf355('0x7')](),controller[_0xf355('0xe')]);router[_0xf355('0xf')]('/:id',auth[_0xf355('0x7')](),controller[_0xf355('0x10')]);module[_0xf355('0x11')]=router; \ No newline at end of file +var _0xdf4c=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x2ed598,_0x48a589){var _0x412e4a=function(_0x1c81fd){while(--_0x1c81fd){_0x2ed598['push'](_0x2ed598['shift']());}};_0x412e4a(++_0x48a589);}(_0xdf4c,0xd9));var _0xcdf4=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xdf4c[_0xc8db6b];return _0x12cb81;};'use strict';var multer=require(_0xcdf4('0x0'));var util=require(_0xcdf4('0x1'));var path=require('path');var timeout=require(_0xcdf4('0x2'));var express=require(_0xcdf4('0x3'));var router=express[_0xcdf4('0x4')]();var fs_extra=require(_0xcdf4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcdf4('0x6'));var config=require(_0xcdf4('0x7'));var controller=require(_0xcdf4('0x8'));router[_0xcdf4('0x9')]('/',auth[_0xcdf4('0xa')](),controller[_0xcdf4('0xb')]);router[_0xcdf4('0x9')](_0xcdf4('0xc'),auth['isAuthenticated'](),controller[_0xcdf4('0xd')]);router[_0xcdf4('0xe')]('/',auth[_0xcdf4('0xa')](),controller['create']);router[_0xcdf4('0xf')]('/:id',auth[_0xcdf4('0xa')](),controller[_0xcdf4('0x10')]);router[_0xcdf4('0x11')](_0xcdf4('0xc'),auth[_0xcdf4('0xa')](),controller[_0xcdf4('0x12')]);module[_0xcdf4('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 1cc80da..81ce2d1 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 _0xcf0b=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x435cc5,_0x3f4545){var _0xfff27=function(_0x37eb70){while(--_0x37eb70){_0x435cc5['push'](_0x435cc5['shift']());}};_0xfff27(++_0x3f4545);}(_0xcf0b,0x120));var _0xbcf0=function(_0x93d7e0,_0x3ecdf4){_0x93d7e0=_0x93d7e0-0x0;var _0x1e93e8=_0xcf0b[_0x93d7e0];return _0x1e93e8;};'use strict';var Sequelize=require(_0xbcf0('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbcf0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbcf0('0x2')],'allowNull':![],'defaultValue':_0xbcf0('0x3')},'appdata':{'type':Sequelize[_0xbcf0('0x4')]()},'description':{'type':Sequelize[_0xbcf0('0x2')]},'interval':{'type':Sequelize[_0xbcf0('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe724=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe724,0x124));var _0x4e72=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xe724[_0x210718];return _0x541bfc;};'use strict';var Sequelize=require(_0x4e72('0x0'));module[_0x4e72('0x1')]={'priority':{'type':Sequelize[_0x4e72('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4e72('0x3')],'allowNull':![],'defaultValue':_0x4e72('0x4')},'appdata':{'type':Sequelize[_0x4e72('0x5')]()},'description':{'type':Sequelize[_0x4e72('0x3')]},'interval':{'type':Sequelize[_0x4e72('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6f459e2..c99ae82 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 _0x6f19=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse'];(function(_0x238f83,_0xf1d44e){var _0x1ee02b=function(_0x2b3b2a){while(--_0x2b3b2a){_0x238f83['push'](_0x238f83['shift']());}};_0x1ee02b(++_0xf1d44e);}(_0x6f19,0x1ef));var _0x96f1=function(_0x5b6b15,_0x542637){_0x5b6b15=_0x5b6b15-0x0;var _0x20c669=_0x6f19[_0x5b6b15];return _0x20c669;};'use strict';var emlformat=require(_0x96f1('0x0'));var rimraf=require(_0x96f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96f1('0x2'));var rp=require(_0x96f1('0x3'));var moment=require(_0x96f1('0x4'));var BPromise=require(_0x96f1('0x5'));var Mustache=require(_0x96f1('0x6'));var util=require(_0x96f1('0x7'));var path=require(_0x96f1('0x8'));var sox=require('sox');var csv=require(_0x96f1('0x9'));var ejs=require(_0x96f1('0xa'));var fs=require('fs');var fs_extra=require(_0x96f1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x96f1('0xc'));var jsforce=require(_0x96f1('0xd'));var deskjs=require(_0x96f1('0xe'));var toCsv=require(_0x96f1('0x9'));var querystring=require('querystring');var Papa=require(_0x96f1('0xf'));var Redis=require(_0x96f1('0x10'));var authService=require(_0x96f1('0x11'));var qs=require(_0x96f1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96f1('0x13'));var logger=require(_0x96f1('0x14'))(_0x96f1('0x15'));var utils=require(_0x96f1('0x16'));var config=require(_0x96f1('0x17'));var licenseUtil=require(_0x96f1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15ffc9,_0x1d5c2a){_0x1d5c2a=_0x1d5c2a||0xcc;return function(_0x25fa03){if(_0x25fa03){return _0x15ffc9['sendStatus'](_0x1d5c2a);}return _0x15ffc9['status'](_0x1d5c2a)[_0x96f1('0x19')]();};}function respondWithResult(_0x1fc5f8,_0x1355c8){_0x1355c8=_0x1355c8||0xc8;return function(_0x4abaea){if(_0x4abaea){return _0x1fc5f8[_0x96f1('0x1a')](_0x1355c8)['json'](_0x4abaea);}};}function respondWithFilteredResult(_0x25ba25,_0x5178b2){return function(_0xc459c0){if(_0xc459c0){var _0x2d49b6=typeof _0x5178b2[_0x96f1('0x1b')]===_0x96f1('0x1c')&&typeof _0x5178b2[_0x96f1('0x1d')]==='undefined';var _0x34aee5=_0xc459c0[_0x96f1('0x1e')];var _0x198bd1=_0x2d49b6?0x0:_0x5178b2['offset'];var _0x437865=_0x2d49b6?_0xc459c0['count']:_0x5178b2['offset']+_0x5178b2[_0x96f1('0x1d')];var _0x131ef2;if(_0x437865>=_0x34aee5){_0x437865=_0x34aee5;_0x131ef2=0xc8;}else{_0x131ef2=0xce;}_0x25ba25[_0x96f1('0x1a')](_0x131ef2);return _0x25ba25['set'](_0x96f1('0x1f'),_0x198bd1+'-'+_0x437865+'/'+_0x34aee5)[_0x96f1('0x20')](_0xc459c0);}return null;};}function patchUpdates(_0x329368){return function(_0x522758){try{jsonpatch[_0x96f1('0x21')](_0x522758,_0x329368,!![]);}catch(_0x356500){return BPromise[_0x96f1('0x22')](_0x356500);}return _0x522758[_0x96f1('0x23')]();};}function saveUpdates(_0x29f6a7,_0x16cb0e){return function(_0x27116a){if(_0x27116a){return _0x27116a[_0x96f1('0x24')](_0x29f6a7)['then'](function(_0x518504){return _0x518504;});}return null;};}function removeEntity(_0x4308c7,_0x1398b3){return function(_0x7776a){if(_0x7776a){return _0x7776a[_0x96f1('0x25')]()[_0x96f1('0x26')](function(){_0x4308c7[_0x96f1('0x1a')](0xcc)[_0x96f1('0x19')]();});}};}function handleEntityNotFound(_0x357f38,_0x48e076){return function(_0x3c35b6){if(!_0x3c35b6){_0x357f38[_0x96f1('0x27')](0x194);}return _0x3c35b6;};}function handleError(_0x14f0ba,_0x4443b1){_0x4443b1=_0x4443b1||0x1f4;return function(_0x43de87){logger['error'](_0x43de87[_0x96f1('0x28')]);if(_0x43de87[_0x96f1('0x29')]){delete _0x43de87[_0x96f1('0x29')];}_0x14f0ba[_0x96f1('0x1a')](_0x4443b1)[_0x96f1('0x2a')](_0x43de87);};}exports[_0x96f1('0x2b')]=function(_0x36c1e5,_0x522f2f){var _0x2f3713={},_0x264947={},_0x3ad2b2={'count':0x0,'rows':[]};var _0x460228=_[_0x96f1('0x2c')](db[_0x96f1('0x2d')][_0x96f1('0x2e')],function(_0x291a94){return{'name':_0x291a94[_0x96f1('0x2f')],'type':_0x291a94[_0x96f1('0x30')]['key']};});_0x264947[_0x96f1('0x31')]=_[_0x96f1('0x2c')](_0x460228,_0x96f1('0x29'));_0x264947[_0x96f1('0x32')]=_[_0x96f1('0x33')](_0x36c1e5[_0x96f1('0x32')]);_0x264947[_0x96f1('0x34')]=_['intersection'](_0x264947[_0x96f1('0x31')],_0x264947[_0x96f1('0x32')]);_0x2f3713[_0x96f1('0x35')]=_[_0x96f1('0x36')](_0x264947[_0x96f1('0x31')],qs[_0x96f1('0x37')](_0x36c1e5[_0x96f1('0x32')][_0x96f1('0x37')]));_0x2f3713['attributes']=_0x2f3713[_0x96f1('0x35')][_0x96f1('0x38')]?_0x2f3713[_0x96f1('0x35')]:_0x264947['model'];if(!_0x36c1e5[_0x96f1('0x32')][_0x96f1('0x39')]('nolimit')){_0x2f3713[_0x96f1('0x1d')]=qs[_0x96f1('0x1d')](_0x36c1e5[_0x96f1('0x32')][_0x96f1('0x1d')]);_0x2f3713[_0x96f1('0x1b')]=qs[_0x96f1('0x1b')](_0x36c1e5[_0x96f1('0x32')][_0x96f1('0x1b')]);}_0x2f3713[_0x96f1('0x3a')]=qs['sort'](_0x36c1e5[_0x96f1('0x32')][_0x96f1('0x3b')]);_0x2f3713[_0x96f1('0x3c')]=qs['filters'](_['pick'](_0x36c1e5[_0x96f1('0x32')],_0x264947[_0x96f1('0x34')]),_0x460228);if(_0x36c1e5[_0x96f1('0x32')]['filter']){_0x2f3713['where']=_['merge'](_0x2f3713[_0x96f1('0x3c')],{'$or':_['map'](_0x460228,function(_0x31490d){if(_0x31490d[_0x96f1('0x30')]!=='VIRTUAL'){var _0x43b0c0={};_0x43b0c0[_0x31490d[_0x96f1('0x29')]]={'$like':'%'+_0x36c1e5[_0x96f1('0x32')][_0x96f1('0x3d')]+'%'};return _0x43b0c0;}})});}_0x2f3713=_[_0x96f1('0x3e')]({},_0x2f3713,_0x36c1e5[_0x96f1('0x3f')]);var _0x43ebaa={'where':_0x2f3713[_0x96f1('0x3c')]};return db[_0x96f1('0x2d')][_0x96f1('0x1e')](_0x43ebaa)[_0x96f1('0x26')](function(_0x35df92){_0x3ad2b2[_0x96f1('0x1e')]=_0x35df92;if(_0x36c1e5['query']['includeAll']){_0x2f3713['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x96f1('0x40')](_0x2f3713);})[_0x96f1('0x26')](function(_0x496c21){_0x3ad2b2[_0x96f1('0x41')]=_0x496c21;return _0x3ad2b2;})['then'](respondWithFilteredResult(_0x522f2f,_0x2f3713))[_0x96f1('0x42')](handleError(_0x522f2f,null));};exports[_0x96f1('0x43')]=function(_0x2b228e,_0x5d2477){var _0x2b2c5c={'raw':!![],'where':{'id':_0x2b228e[_0x96f1('0x44')]['id']}},_0x13100a={};_0x13100a[_0x96f1('0x31')]=_[_0x96f1('0x33')](db[_0x96f1('0x2d')][_0x96f1('0x2e')]);_0x13100a['query']=_['keys'](_0x2b228e['query']);_0x13100a[_0x96f1('0x34')]=_[_0x96f1('0x36')](_0x13100a['model'],_0x13100a[_0x96f1('0x32')]);_0x2b2c5c[_0x96f1('0x35')]=_['intersection'](_0x13100a[_0x96f1('0x31')],qs[_0x96f1('0x37')](_0x2b228e['query'][_0x96f1('0x37')]));_0x2b2c5c[_0x96f1('0x35')]=_0x2b2c5c[_0x96f1('0x35')][_0x96f1('0x38')]?_0x2b2c5c[_0x96f1('0x35')]:_0x13100a['model'];if(_0x2b228e['query']['includeAll']){_0x2b2c5c[_0x96f1('0x45')]=[{'all':!![]}];}_0x2b2c5c=_[_0x96f1('0x3e')]({},_0x2b2c5c,_0x2b228e[_0x96f1('0x3f')]);return db[_0x96f1('0x2d')][_0x96f1('0x46')](_0x2b2c5c)[_0x96f1('0x26')](handleEntityNotFound(_0x5d2477,null))[_0x96f1('0x26')](respondWithResult(_0x5d2477,null))[_0x96f1('0x42')](handleError(_0x5d2477,null));};exports[_0x96f1('0x47')]=function(_0x229242,_0x54ee3f){return db[_0x96f1('0x2d')][_0x96f1('0x47')](_0x229242[_0x96f1('0x48')],{})['then'](respondWithResult(_0x54ee3f,0xc9))[_0x96f1('0x42')](handleError(_0x54ee3f,null));};exports[_0x96f1('0x24')]=function(_0x2a1495,_0x56d7c5){if(_0x2a1495[_0x96f1('0x48')]['id']){delete _0x2a1495[_0x96f1('0x48')]['id'];}return db['OpenchannelApplication'][_0x96f1('0x46')]({'where':{'id':_0x2a1495[_0x96f1('0x44')]['id']}})[_0x96f1('0x26')](handleEntityNotFound(_0x56d7c5,null))[_0x96f1('0x26')](saveUpdates(_0x2a1495[_0x96f1('0x48')],null))[_0x96f1('0x26')](respondWithResult(_0x56d7c5,null))[_0x96f1('0x42')](handleError(_0x56d7c5,null));};exports[_0x96f1('0x25')]=function(_0x5ce95b,_0xa0eb3b){return db[_0x96f1('0x2d')][_0x96f1('0x46')]({'where':{'id':_0x5ce95b[_0x96f1('0x44')]['id']}})[_0x96f1('0x26')](handleEntityNotFound(_0xa0eb3b,null))[_0x96f1('0x26')](removeEntity(_0xa0eb3b,null))['catch'](handleError(_0xa0eb3b,null));}; \ No newline at end of file +var _0x455c=['type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','OpenchannelApplication'];(function(_0x292ecc,_0x2ed340){var _0x59aabc=function(_0x35aa5a){while(--_0x35aa5a){_0x292ecc['push'](_0x292ecc['shift']());}};_0x59aabc(++_0x2ed340);}(_0x455c,0x17e));var _0xc455=function(_0x450eae,_0x2ad04d){_0x450eae=_0x450eae-0x0;var _0x2379d3=_0x455c[_0x450eae];return _0x2379d3;};'use strict';var emlformat=require(_0xc455('0x0'));var rimraf=require(_0xc455('0x1'));var zipdir=require(_0xc455('0x2'));var jsonpatch=require(_0xc455('0x3'));var rp=require(_0xc455('0x4'));var moment=require(_0xc455('0x5'));var BPromise=require(_0xc455('0x6'));var Mustache=require('mustache');var util=require(_0xc455('0x7'));var path=require('path');var sox=require(_0xc455('0x8'));var csv=require('to-csv');var ejs=require(_0xc455('0x9'));var fs=require('fs');var fs_extra=require(_0xc455('0xa'));var _=require(_0xc455('0xb'));var squel=require(_0xc455('0xc'));var crypto=require(_0xc455('0xd'));var jsforce=require(_0xc455('0xe'));var deskjs=require(_0xc455('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc455('0x10'));var Papa=require(_0xc455('0x11'));var Redis=require(_0xc455('0x12'));var authService=require(_0xc455('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc455('0x14'));var logger=require(_0xc455('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc455('0x16'));var db=require(_0xc455('0x17'))['db'];function respondWithStatusCode(_0x3dbca6,_0x540689){_0x540689=_0x540689||0xcc;return function(_0x555eaf){if(_0x555eaf){return _0x3dbca6[_0xc455('0x18')](_0x540689);}return _0x3dbca6[_0xc455('0x19')](_0x540689)[_0xc455('0x1a')]();};}function respondWithResult(_0x2913b7,_0xe42ee6){_0xe42ee6=_0xe42ee6||0xc8;return function(_0x560d4d){if(_0x560d4d){return _0x2913b7[_0xc455('0x19')](_0xe42ee6)[_0xc455('0x1b')](_0x560d4d);}};}function respondWithFilteredResult(_0x2a060c,_0x28e216){return function(_0x1a56fb){if(_0x1a56fb){var _0x279df2=typeof _0x28e216['offset']===_0xc455('0x1c')&&typeof _0x28e216['limit']==='undefined';var _0x6516a4=_0x1a56fb[_0xc455('0x1d')];var _0x1d8b93=_0x279df2?0x0:_0x28e216[_0xc455('0x1e')];var _0x2ff54c=_0x279df2?_0x1a56fb['count']:_0x28e216[_0xc455('0x1e')]+_0x28e216[_0xc455('0x1f')];var _0x4a084f;if(_0x2ff54c>=_0x6516a4){_0x2ff54c=_0x6516a4;_0x4a084f=0xc8;}else{_0x4a084f=0xce;}_0x2a060c[_0xc455('0x19')](_0x4a084f);return _0x2a060c[_0xc455('0x20')](_0xc455('0x21'),_0x1d8b93+'-'+_0x2ff54c+'/'+_0x6516a4)['json'](_0x1a56fb);}return null;};}function patchUpdates(_0x19897b){return function(_0x5e8149){try{jsonpatch['apply'](_0x5e8149,_0x19897b,!![]);}catch(_0x46da89){return BPromise[_0xc455('0x22')](_0x46da89);}return _0x5e8149[_0xc455('0x23')]();};}function saveUpdates(_0x3c642b,_0x39af6d){return function(_0x41b9bc){if(_0x41b9bc){return _0x41b9bc[_0xc455('0x24')](_0x3c642b)[_0xc455('0x25')](function(_0x33b2b6){return _0x33b2b6;});}return null;};}function removeEntity(_0x13363b,_0x4aacfb){return function(_0x1a04db){if(_0x1a04db){return _0x1a04db[_0xc455('0x26')]()[_0xc455('0x25')](function(){_0x13363b['status'](0xcc)[_0xc455('0x1a')]();});}};}function handleEntityNotFound(_0xed1964,_0x1bf8c6){return function(_0x552c0e){if(!_0x552c0e){_0xed1964[_0xc455('0x18')](0x194);}return _0x552c0e;};}function handleError(_0x4d90b8,_0x348573){_0x348573=_0x348573||0x1f4;return function(_0x3972ce){logger[_0xc455('0x27')](_0x3972ce[_0xc455('0x28')]);if(_0x3972ce[_0xc455('0x29')]){delete _0x3972ce[_0xc455('0x29')];}_0x4d90b8[_0xc455('0x19')](_0x348573)[_0xc455('0x2a')](_0x3972ce);};}exports['index']=function(_0x194ea6,_0x105212){var _0x5e3904={},_0x16f9e2={},_0x1abf3c={'count':0x0,'rows':[]};var _0x1f337d=_['map'](db[_0xc455('0x2b')]['rawAttributes'],function(_0x490179){return{'name':_0x490179['fieldName'],'type':_0x490179[_0xc455('0x2c')][_0xc455('0x2d')]};});_0x16f9e2[_0xc455('0x2e')]=_[_0xc455('0x2f')](_0x1f337d,'name');_0x16f9e2['query']=_['keys'](_0x194ea6[_0xc455('0x30')]);_0x16f9e2[_0xc455('0x31')]=_[_0xc455('0x32')](_0x16f9e2[_0xc455('0x2e')],_0x16f9e2['query']);_0x5e3904[_0xc455('0x33')]=_['intersection'](_0x16f9e2[_0xc455('0x2e')],qs['fields'](_0x194ea6[_0xc455('0x30')][_0xc455('0x34')]));_0x5e3904[_0xc455('0x33')]=_0x5e3904[_0xc455('0x33')]['length']?_0x5e3904[_0xc455('0x33')]:_0x16f9e2[_0xc455('0x2e')];if(!_0x194ea6['query'][_0xc455('0x35')]('nolimit')){_0x5e3904[_0xc455('0x1f')]=qs['limit'](_0x194ea6['query'][_0xc455('0x1f')]);_0x5e3904[_0xc455('0x1e')]=qs['offset'](_0x194ea6['query'][_0xc455('0x1e')]);}_0x5e3904['order']=qs[_0xc455('0x36')](_0x194ea6[_0xc455('0x30')]['sort']);_0x5e3904[_0xc455('0x37')]=qs['filters'](_['pick'](_0x194ea6['query'],_0x16f9e2[_0xc455('0x31')]),_0x1f337d);if(_0x194ea6[_0xc455('0x30')][_0xc455('0x38')]){_0x5e3904[_0xc455('0x37')]=_[_0xc455('0x39')](_0x5e3904[_0xc455('0x37')],{'$or':_['map'](_0x1f337d,function(_0x37a4ce){if(_0x37a4ce[_0xc455('0x2c')]!=='VIRTUAL'){var _0x5d454d={};_0x5d454d[_0x37a4ce['name']]={'$like':'%'+_0x194ea6['query'][_0xc455('0x38')]+'%'};return _0x5d454d;}})});}_0x5e3904=_[_0xc455('0x39')]({},_0x5e3904,_0x194ea6[_0xc455('0x3a')]);var _0x134b63={'where':_0x5e3904[_0xc455('0x37')]};return db[_0xc455('0x2b')]['count'](_0x134b63)[_0xc455('0x25')](function(_0x215ce5){_0x1abf3c[_0xc455('0x1d')]=_0x215ce5;if(_0x194ea6[_0xc455('0x30')][_0xc455('0x3b')]){_0x5e3904[_0xc455('0x3c')]=[{'all':!![]}];}return db[_0xc455('0x2b')][_0xc455('0x3d')](_0x5e3904);})[_0xc455('0x25')](function(_0x5ef2f2){_0x1abf3c[_0xc455('0x3e')]=_0x5ef2f2;return _0x1abf3c;})[_0xc455('0x25')](respondWithFilteredResult(_0x105212,_0x5e3904))[_0xc455('0x3f')](handleError(_0x105212,null));};exports[_0xc455('0x40')]=function(_0x4cf836,_0x2ff30c){var _0x2c49c4={'raw':!![],'where':{'id':_0x4cf836['params']['id']}},_0x50a7e5={};_0x50a7e5[_0xc455('0x2e')]=_[_0xc455('0x41')](db[_0xc455('0x2b')][_0xc455('0x42')]);_0x50a7e5[_0xc455('0x30')]=_[_0xc455('0x41')](_0x4cf836[_0xc455('0x30')]);_0x50a7e5[_0xc455('0x31')]=_[_0xc455('0x32')](_0x50a7e5[_0xc455('0x2e')],_0x50a7e5['query']);_0x2c49c4[_0xc455('0x33')]=_[_0xc455('0x32')](_0x50a7e5[_0xc455('0x2e')],qs[_0xc455('0x34')](_0x4cf836[_0xc455('0x30')][_0xc455('0x34')]));_0x2c49c4[_0xc455('0x33')]=_0x2c49c4[_0xc455('0x33')]['length']?_0x2c49c4[_0xc455('0x33')]:_0x50a7e5[_0xc455('0x2e')];if(_0x4cf836[_0xc455('0x30')][_0xc455('0x3b')]){_0x2c49c4['include']=[{'all':!![]}];}_0x2c49c4=_[_0xc455('0x39')]({},_0x2c49c4,_0x4cf836[_0xc455('0x3a')]);return db[_0xc455('0x2b')][_0xc455('0x43')](_0x2c49c4)[_0xc455('0x25')](handleEntityNotFound(_0x2ff30c,null))['then'](respondWithResult(_0x2ff30c,null))[_0xc455('0x3f')](handleError(_0x2ff30c,null));};exports[_0xc455('0x44')]=function(_0x5e9f93,_0x543180){return db[_0xc455('0x2b')]['create'](_0x5e9f93[_0xc455('0x45')],{})['then'](respondWithResult(_0x543180,0xc9))[_0xc455('0x3f')](handleError(_0x543180,null));};exports[_0xc455('0x24')]=function(_0xd4e5c3,_0x6bc97f){if(_0xd4e5c3[_0xc455('0x45')]['id']){delete _0xd4e5c3[_0xc455('0x45')]['id'];}return db[_0xc455('0x2b')]['find']({'where':{'id':_0xd4e5c3[_0xc455('0x46')]['id']}})['then'](handleEntityNotFound(_0x6bc97f,null))[_0xc455('0x25')](saveUpdates(_0xd4e5c3[_0xc455('0x45')],null))['then'](respondWithResult(_0x6bc97f,null))[_0xc455('0x3f')](handleError(_0x6bc97f,null));};exports['destroy']=function(_0x3caf88,_0x393cd7){return db[_0xc455('0x2b')][_0xc455('0x43')]({'where':{'id':_0x3caf88[_0xc455('0x46')]['id']}})[_0xc455('0x25')](handleEntityNotFound(_0x393cd7,null))[_0xc455('0x25')](removeEntity(_0x393cd7,null))[_0xc455('0x3f')](handleError(_0x393cd7,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f888515..9249642 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 _0x61a7=['../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x61a7,0xce));var _0x761a=function(_0x21e4b4,_0x38ba3a){_0x21e4b4=_0x21e4b4-0x0;var _0x1ad879=_0x61a7[_0x21e4b4];return _0x1ad879;};'use strict';var _=require(_0x761a('0x0'));var util=require(_0x761a('0x1'));var logger=require(_0x761a('0x2'))(_0x761a('0x3'));var moment=require(_0x761a('0x4'));var BPromise=require(_0x761a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x761a('0x6'));var rimraf=require('rimraf');var config=require(_0x761a('0x7'));var attributes=require(_0x761a('0x8'));module[_0x761a('0x9')]=function(_0x51a47d,_0x2b6c40){return _0x51a47d[_0x761a('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x761a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x761a('0xc')});}; \ No newline at end of file +var _0xbda4=['exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x53041a,_0x4612d5){var _0xbd67ec=function(_0x2c3b06){while(--_0x2c3b06){_0x53041a['push'](_0x53041a['shift']());}};_0xbd67ec(++_0x4612d5);}(_0xbda4,0x13c));var _0x4bda=function(_0x118a4d,_0x5a6b0d){_0x118a4d=_0x118a4d-0x0;var _0x322551=_0xbda4[_0x118a4d];return _0x322551;};'use strict';var _=require(_0x4bda('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4bda('0x1'));var moment=require(_0x4bda('0x2'));var BPromise=require(_0x4bda('0x3'));var rp=require(_0x4bda('0x4'));var fs=require('fs');var path=require(_0x4bda('0x5'));var rimraf=require(_0x4bda('0x6'));var config=require(_0x4bda('0x7'));var attributes=require(_0x4bda('0x8'));module[_0x4bda('0x9')]=function(_0x608b0a,_0x357c38){return _0x608b0a['define']('OpenchannelApplication',attributes,{'tableName':_0x4bda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4bda('0xb'),'collate':_0x4bda('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 50c73f1..e07cfe4 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 _0xbadc=['request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbadc,0x93));var _0xcbad=function(_0x31efe7,_0x52fe9e){_0x31efe7=_0x31efe7-0x0;var _0x24b6ee=_0xbadc[_0x31efe7];return _0x24b6ee;};'use strict';var _=require(_0xcbad('0x0'));var util=require(_0xcbad('0x1'));var moment=require(_0xcbad('0x2'));var BPromise=require(_0xcbad('0x3'));var rs=require(_0xcbad('0x4'));var fs=require('fs');var Redis=require(_0xcbad('0x5'));var db=require(_0xcbad('0x6'))['db'];var utils=require(_0xcbad('0x7'));var logger=require(_0xcbad('0x8'))('rpc');var config=require(_0xcbad('0x9'));var jayson=require(_0xcbad('0xa'));var client=jayson[_0xcbad('0xb')][_0xcbad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b87af,_0x2a0f85,_0x437051){return new BPromise(function(_0x1515b0,_0x2587fa){return client[_0xcbad('0xd')](_0x5b87af,_0x437051)[_0xcbad('0xe')](function(_0x28a90b){logger[_0xcbad('0xf')](_0xcbad('0x10'),_0x2a0f85,'request\x20sent');logger[_0xcbad('0x11')](_0xcbad('0x12'),_0x2a0f85,_0xcbad('0x13'),JSON[_0xcbad('0x14')](_0x28a90b));if(_0x28a90b[_0xcbad('0x15')]){if(_0x28a90b[_0xcbad('0x15')][_0xcbad('0x16')]===0x1f4){logger[_0xcbad('0x15')](_0xcbad('0x10'),_0x2a0f85,_0x28a90b[_0xcbad('0x15')][_0xcbad('0x17')]);return _0x2587fa(_0x28a90b['error'][_0xcbad('0x17')]);}logger[_0xcbad('0x15')]('OpenchannelApplication,\x20%s,\x20%s',_0x2a0f85,_0x28a90b['error'][_0xcbad('0x17')]);return _0x1515b0(_0x28a90b[_0xcbad('0x15')][_0xcbad('0x17')]);}else{logger[_0xcbad('0xf')](_0xcbad('0x10'),_0x2a0f85,_0xcbad('0x13'));_0x1515b0(_0x28a90b['result'][_0xcbad('0x17')]);}})[_0xcbad('0x18')](function(_0x1f8a2a){logger[_0xcbad('0x15')](_0xcbad('0x10'),_0x2a0f85,_0x1f8a2a);_0x2587fa(_0x1f8a2a);});});}exports[_0xcbad('0x19')]=function(_0x2b1424){var _0x229a5c=this;return new Promise(function(_0x40e037,_0x593380){return db[_0xcbad('0x1a')]['update'](_0x2b1424[_0xcbad('0x1b')],{'raw':_0x2b1424[_0xcbad('0x1c')]?_0x2b1424[_0xcbad('0x1c')][_0xcbad('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b1424[_0xcbad('0x1c')]?_0x2b1424[_0xcbad('0x1c')][_0xcbad('0x1e')]||null:null,'attributes':_0x2b1424['options']?_0x2b1424[_0xcbad('0x1c')]['attributes']||null:null,'limit':_0x2b1424['options']?_0x2b1424[_0xcbad('0x1c')][_0xcbad('0x1f')]||null:null})[_0xcbad('0xe')](function(_0x54defa){logger[_0xcbad('0xf')](_0xcbad('0x19'),_0x2b1424);logger[_0xcbad('0x11')]('UpdateOpenchannelApplication',_0x2b1424,JSON[_0xcbad('0x14')](_0x54defa));_0x40e037(_0x54defa);})[_0xcbad('0x18')](function(_0x3ba85d){logger['error'](_0xcbad('0x19'),_0x3ba85d[_0xcbad('0x17')],_0x2b1424);_0x593380(_0x229a5c[_0xcbad('0x15')](0x1f4,_0x3ba85d['message']));});});}; \ No newline at end of file +var _0x36d3=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateOpenchannelApplication','body','options','raw','attributes','limit','lodash','util','moment','bluebird'];(function(_0x16f164,_0x574c80){var _0x422263=function(_0x5544c6){while(--_0x5544c6){_0x16f164['push'](_0x16f164['shift']());}};_0x422263(++_0x574c80);}(_0x36d3,0xec));var _0x336d=function(_0x2fd16a,_0x3eb499){_0x2fd16a=_0x2fd16a-0x0;var _0x447575=_0x36d3[_0x2fd16a];return _0x447575;};'use strict';var _=require(_0x336d('0x0'));var util=require(_0x336d('0x1'));var moment=require(_0x336d('0x2'));var BPromise=require(_0x336d('0x3'));var rs=require(_0x336d('0x4'));var fs=require('fs');var Redis=require(_0x336d('0x5'));var db=require(_0x336d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x336d('0x7'))(_0x336d('0x8'));var config=require(_0x336d('0x9'));var jayson=require(_0x336d('0xa'));var client=jayson[_0x336d('0xb')][_0x336d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a9a42,_0x56b8fb,_0x34b474){return new BPromise(function(_0x5223db,_0x4c57b1){return client[_0x336d('0xd')](_0x4a9a42,_0x34b474)[_0x336d('0xe')](function(_0x87cda5){logger[_0x336d('0xf')](_0x336d('0x10'),_0x56b8fb,_0x336d('0x11'));logger[_0x336d('0x12')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x56b8fb,_0x336d('0x11'),JSON[_0x336d('0x13')](_0x87cda5));if(_0x87cda5[_0x336d('0x14')]){if(_0x87cda5[_0x336d('0x14')]['code']===0x1f4){logger['error'](_0x336d('0x10'),_0x56b8fb,_0x87cda5[_0x336d('0x14')][_0x336d('0x15')]);return _0x4c57b1(_0x87cda5['error'][_0x336d('0x15')]);}logger['error'](_0x336d('0x10'),_0x56b8fb,_0x87cda5[_0x336d('0x14')][_0x336d('0x15')]);return _0x5223db(_0x87cda5[_0x336d('0x14')][_0x336d('0x15')]);}else{logger[_0x336d('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x56b8fb,_0x336d('0x11'));_0x5223db(_0x87cda5[_0x336d('0x16')][_0x336d('0x15')]);}})[_0x336d('0x17')](function(_0x93df2a){logger[_0x336d('0x14')](_0x336d('0x10'),_0x56b8fb,_0x93df2a);_0x4c57b1(_0x93df2a);});});}exports[_0x336d('0x18')]=function(_0x303d3f){var _0x3187ae=this;return new Promise(function(_0x2c052b,_0x8d0392){return db['OpenchannelApplication']['update'](_0x303d3f[_0x336d('0x19')],{'raw':_0x303d3f[_0x336d('0x1a')]?_0x303d3f[_0x336d('0x1a')][_0x336d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x303d3f[_0x336d('0x1a')]?_0x303d3f['options']['where']||null:null,'attributes':_0x303d3f[_0x336d('0x1a')]?_0x303d3f[_0x336d('0x1a')][_0x336d('0x1c')]||null:null,'limit':_0x303d3f[_0x336d('0x1a')]?_0x303d3f[_0x336d('0x1a')][_0x336d('0x1d')]||null:null})[_0x336d('0xe')](function(_0x356922){logger[_0x336d('0xf')](_0x336d('0x18'),_0x303d3f);logger[_0x336d('0x12')]('UpdateOpenchannelApplication',_0x303d3f,JSON[_0x336d('0x13')](_0x356922));_0x2c052b(_0x356922);})[_0x336d('0x17')](function(_0xc74ca0){logger['error'](_0x336d('0x18'),_0xc74ca0[_0x336d('0x15')],_0x303d3f);_0x8d0392(_0x3187ae[_0x336d('0x14')](0x1f4,_0xc74ca0[_0x336d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9f8b535..8ad1e99 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 _0x058c=['./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x23c205,_0x393201){var _0x41fd01=function(_0x1b4b46){while(--_0x1b4b46){_0x23c205['push'](_0x23c205['shift']());}};_0x41fd01(++_0x393201);}(_0x058c,0xf9));var _0xc058=function(_0x31c971,_0x546ac5){_0x31c971=_0x31c971-0x0;var _0x5be103=_0x058c[_0x31c971];return _0x5be103;};'use strict';var multer=require(_0xc058('0x0'));var util=require(_0xc058('0x1'));var path=require(_0xc058('0x2'));var timeout=require('connect-timeout');var express=require(_0xc058('0x3'));var router=express['Router']();var fs_extra=require(_0xc058('0x4'));var auth=require(_0xc058('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc058('0x6'));var controller=require(_0xc058('0x7'));router[_0xc058('0x8')]('/',auth[_0xc058('0x9')](),controller[_0xc058('0xa')]);router['get'](_0xc058('0xb'),auth[_0xc058('0x9')](),controller['describe']);router[_0xc058('0x8')](_0xc058('0xc'),auth[_0xc058('0x9')](),controller[_0xc058('0xd')]);router[_0xc058('0x8')](_0xc058('0xe'),auth[_0xc058('0x9')](),controller[_0xc058('0xf')]);router[_0xc058('0x8')](_0xc058('0x10'),auth[_0xc058('0x9')](),controller[_0xc058('0x11')]);router[_0xc058('0x12')]('/',auth['isAuthenticated'](),controller[_0xc058('0x13')]);router[_0xc058('0x12')]('/:id/messages',auth[_0xc058('0x9')](),controller[_0xc058('0x14')]);router[_0xc058('0x12')](_0xc058('0x15'),auth[_0xc058('0x9')](),interaction[_0xc058('0x16')]('openchannel',_0xc058('0x17')),controller['addTags']);router[_0xc058('0x18')](_0xc058('0xc'),auth[_0xc058('0x9')](),interaction[_0xc058('0x16')](_0xc058('0x19'),_0xc058('0x1a')),controller[_0xc058('0x1b')]);router['delete'](_0xc058('0xc'),auth[_0xc058('0x9')](),interaction['tracked'](_0xc058('0x19'),_0xc058('0x1c')),controller[_0xc058('0x1d')]);router[_0xc058('0x1e')](_0xc058('0x15'),auth[_0xc058('0x9')](),controller['removeTags']);module[_0xc058('0x1f')]=router; \ No newline at end of file +var _0x5c8b=['show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','delete','openchannel','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0x5c8b,0xac));var _0xb5c8=function(_0x36b292,_0x9f5a48){_0x36b292=_0x36b292-0x0;var _0x39a2ce=_0x5c8b[_0x36b292];return _0x39a2ce;};'use strict';var multer=require(_0xb5c8('0x0'));var util=require(_0xb5c8('0x1'));var path=require(_0xb5c8('0x2'));var timeout=require(_0xb5c8('0x3'));var express=require(_0xb5c8('0x4'));var router=express[_0xb5c8('0x5')]();var fs_extra=require(_0xb5c8('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5c8('0x7'));var controller=require(_0xb5c8('0x8'));router[_0xb5c8('0x9')]('/',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xb')]);router[_0xb5c8('0x9')](_0xb5c8('0xc'),auth[_0xb5c8('0xa')](),controller['describe']);router[_0xb5c8('0x9')](_0xb5c8('0xd'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xe')]);router['get'](_0xb5c8('0xf'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x10')]);router[_0xb5c8('0x9')](_0xb5c8('0x11'),auth[_0xb5c8('0xa')](),controller['download']);router[_0xb5c8('0x12')]('/',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x13')]);router[_0xb5c8('0x12')](_0xb5c8('0xf'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x14')]);router[_0xb5c8('0x12')](_0xb5c8('0x15'),auth['isAuthenticated'](),interaction[_0xb5c8('0x16')]('openchannel',_0xb5c8('0x17')),controller['addTags']);router[_0xb5c8('0x18')]('/:id',auth[_0xb5c8('0xa')](),interaction[_0xb5c8('0x16')]('openchannel',_0xb5c8('0x19')),controller['update']);router[_0xb5c8('0x1a')](_0xb5c8('0xd'),auth['isAuthenticated'](),interaction[_0xb5c8('0x16')](_0xb5c8('0x1b'),_0xb5c8('0x1c')),controller['destroy']);router['delete'](_0xb5c8('0x15'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x1d')]);module[_0xb5c8('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3638622..2f4883d 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 _0x5088=['ENUM','exports','BOOLEAN','DATE','STRING','out'];(function(_0x2862c4,_0x129785){var _0x44f51d=function(_0x40e003){while(--_0x40e003){_0x2862c4['push'](_0x2862c4['shift']());}};_0x44f51d(++_0x129785);}(_0x5088,0xa9));var _0x8508=function(_0x144f18,_0x39c0ae){_0x144f18=_0x144f18-0x0;var _0x49ef67=_0x5088[_0x144f18];return _0x49ef67;};'use strict';var Sequelize=require('sequelize');module[_0x8508('0x0')]={'closed':{'type':Sequelize[_0x8508('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8508('0x2')]},'disposition':{'type':Sequelize[_0x8508('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8508('0x3')]},'note':{'type':Sequelize[_0x8508('0x3')]},'read1stAt':{'type':Sequelize[_0x8508('0x2')]},'threadId':{'type':Sequelize[_0x8508('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x8508('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8508('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x8508('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8508('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8508('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1a9e=['ENUM','out','INTEGER','sequelize','BOOLEAN','STRING','DATE'];(function(_0x4e1b85,_0x29f8c6){var _0x2b862f=function(_0x53eea7){while(--_0x53eea7){_0x4e1b85['push'](_0x4e1b85['shift']());}};_0x2b862f(++_0x29f8c6);}(_0x1a9e,0x122));var _0xe1a9=function(_0x151d70,_0x43e635){_0x151d70=_0x151d70-0x0;var _0x1bcc20=_0x1a9e[_0x151d70];return _0x1bcc20;};'use strict';var Sequelize=require(_0xe1a9('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe1a9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe1a9('0x2')]},'secondDisposition':{'type':Sequelize[_0xe1a9('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe1a9('0x2')]},'note':{'type':Sequelize[_0xe1a9('0x2')]},'read1stAt':{'type':Sequelize[_0xe1a9('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xe1a9('0x2')]},'lastMsgAt':{'type':Sequelize[_0xe1a9('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe1a9('0x4')]('in',_0xe1a9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe1a9('0x4')]('in',_0xe1a9('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xe1a9('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe1a9('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e60cb4f..b636ddc 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 _0xa6c9=['download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','query','catch','show','from','params','model','rawAttributes','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','OpenchannelMessage','omit','ids','findOne','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','rows','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','lastName','attachments','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','fullname','get','mkdirSync','Owner','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','direction','out','System','Contact','firstName','value','renderFile','views','.pdf','Openchannel','createPdfFromHTML'];(function(_0x486da7,_0x448251){var _0x1bb0b=function(_0x50e93b){while(--_0x50e93b){_0x486da7['push'](_0x486da7['shift']());}};_0x1bb0b(++_0x448251);}(_0xa6c9,0x19e));var _0x9a6c=function(_0x523adb,_0x3ac7c0){_0x523adb=_0x523adb-0x0;var _0x55ae1d=_0xa6c9[_0x523adb];return _0x55ae1d;};'use strict';var rimraf=require(_0x9a6c('0x0'));var zipdir=require(_0x9a6c('0x1'));var moment=require(_0x9a6c('0x2'));var util=require(_0x9a6c('0x3'));var path=require(_0x9a6c('0x4'));var ejs=require(_0x9a6c('0x5'));var fs=require('fs');var _=require(_0x9a6c('0x6'));var Redis=require(_0x9a6c('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x9a6c('0x8'));var pdf=require(_0x9a6c('0x9'));var logger=require(_0x9a6c('0xa'))(_0x9a6c('0xb'));var config=require(_0x9a6c('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9a6c('0xd')](config[_0x9a6c('0xe')],{'host':_0x9a6c('0xf'),'port':0x18eb});var socket=require(_0x9a6c('0x10'))(new Redis(config[_0x9a6c('0xe')]));require(_0x9a6c('0x11'))[_0x9a6c('0x12')](socket);function respondWithStatusCode(_0x1325f6,_0x176513){_0x176513=_0x176513||0xcc;return function(_0x24d1cb){if(_0x24d1cb){return _0x1325f6[_0x9a6c('0x13')](_0x176513);}return _0x1325f6[_0x9a6c('0x14')](_0x176513)[_0x9a6c('0x15')]();};}function respondWithResult(_0x9101b7,_0x65913d){_0x65913d=_0x65913d||0xc8;return function(_0x3bcc24){if(_0x3bcc24){return _0x9101b7[_0x9a6c('0x14')](_0x65913d)[_0x9a6c('0x16')](_0x3bcc24);}};}function respondWithFilteredResult(_0x3034bf,_0x34437b){return function(_0x140007){if(_0x140007){var _0x5abae9=typeof _0x34437b['offset']===_0x9a6c('0x17')&&typeof _0x34437b['limit']===_0x9a6c('0x17');var _0x32eb6b=_0x140007[_0x9a6c('0x18')];var _0x16555b=_0x5abae9?0x0:_0x34437b[_0x9a6c('0x19')];var _0x56ab9d=_0x5abae9?_0x140007[_0x9a6c('0x18')]:_0x34437b[_0x9a6c('0x19')]+_0x34437b[_0x9a6c('0x1a')];var _0x5460fc;if(_0x56ab9d>=_0x32eb6b){_0x56ab9d=_0x32eb6b;_0x5460fc=0xc8;}else{_0x5460fc=0xce;}_0x3034bf['status'](_0x5460fc);return _0x3034bf[_0x9a6c('0x1b')](_0x9a6c('0x1c'),_0x16555b+'-'+_0x56ab9d+'/'+_0x32eb6b)[_0x9a6c('0x16')](_0x140007);}return null;};}function saveUpdates(_0x39ba79){return function(_0x1d3f64){if(_0x1d3f64){return _0x1d3f64[_0x9a6c('0x1d')](_0x39ba79)[_0x9a6c('0x1e')](function(_0x517852){return _0x517852;});}return null;};}function removeEntity(_0x2e3bb3){return function(_0xc31e7f){if(_0xc31e7f){return _0xc31e7f['destroy']()[_0x9a6c('0x1e')](function(){_0x2e3bb3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4d73){return function(_0x59096d){if(!_0x59096d){_0x2b4d73['sendStatus'](0x194);}return _0x59096d;};}function handleError(_0x238d2b,_0x78bc2e){_0x78bc2e=_0x78bc2e||0x1f4;return function(_0x262604){logger[_0x9a6c('0x1f')](_0x262604[_0x9a6c('0x20')]);if(_0x262604[_0x9a6c('0x21')]){delete _0x262604['name'];}_0x238d2b[_0x9a6c('0x14')](_0x78bc2e)[_0x9a6c('0x22')](_0x262604);};}exports[_0x9a6c('0x23')]=function(_0x2db46f,_0x4c5494){var _0xf01999={};var _0x1ea2b0=_[_0x9a6c('0x24')](db[_0x9a6c('0x25')]['rawAttributes'],function(_0x409481){return{'name':_0x409481[_0x9a6c('0x26')],'type':_0x409481[_0x9a6c('0x27')][_0x9a6c('0x28')]};});_0xf01999=qs[_0x9a6c('0x29')](_0x1ea2b0,_0x2db46f);return interaction[_0x9a6c('0x2a')](_0x9a6c('0x2b'),_0x2db46f[_0x9a6c('0x2c')],_0x2db46f['user'],_0xf01999,_0x1ea2b0)[_0x9a6c('0x1e')](respondWithFilteredResult(_0x4c5494,_0xf01999))[_0x9a6c('0x2d')](handleError(_0x4c5494,null));};exports[_0x9a6c('0x2e')]=function(_0x4d9c56,_0x59a191){var _0x1d4332={};if(_0x4d9c56[_0x9a6c('0x2c')][_0x9a6c('0x27')]&&_0x4d9c56['query']['type']===_0x9a6c('0x2f')){_0x1d4332['from']=_0x4d9c56['params']['id'];}else{_0x1d4332['id']=_0x4d9c56[_0x9a6c('0x30')]['id'];}var _0x31a7db={'raw':![],'where':_0x1d4332},_0x2657a4={};_0x2657a4[_0x9a6c('0x31')]=_['keys'](db['OpenchannelInteraction'][_0x9a6c('0x32')]);_0x2657a4['query']=_[_0x9a6c('0x33')](_0x4d9c56[_0x9a6c('0x2c')]);_0x2657a4[_0x9a6c('0x34')]=_[_0x9a6c('0x35')](_0x2657a4[_0x9a6c('0x31')],_0x2657a4[_0x9a6c('0x2c')]);_0x31a7db['attributes']=_[_0x9a6c('0x35')](_0x2657a4['model'],qs['fields'](_0x4d9c56[_0x9a6c('0x2c')][_0x9a6c('0x36')]));_0x31a7db[_0x9a6c('0x37')]=_0x31a7db['attributes'][_0x9a6c('0x38')]?_0x31a7db[_0x9a6c('0x37')]:_0x2657a4[_0x9a6c('0x31')];if(_0x4d9c56[_0x9a6c('0x2c')][_0x9a6c('0x39')]){_0x31a7db[_0x9a6c('0x3a')]=[{'all':!![]}];}_0x31a7db=_[_0x9a6c('0x3b')]({},_0x31a7db,_0x4d9c56[_0x9a6c('0x3c')]);return db[_0x9a6c('0x25')]['find'](_0x31a7db)[_0x9a6c('0x1e')](handleEntityNotFound(_0x59a191,null))[_0x9a6c('0x1e')](respondWithResult(_0x59a191,null))[_0x9a6c('0x2d')](handleError(_0x59a191,null));};exports[_0x9a6c('0x3d')]=function(_0x281817,_0x11292d){return db[_0x9a6c('0x25')]['create'](_0x281817['body'],{})[_0x9a6c('0x1e')](respondWithResult(_0x11292d,0xc9))[_0x9a6c('0x2d')](handleError(_0x11292d,null));};exports[_0x9a6c('0x1d')]=function(_0x1f5a90,_0x1d7b03){if(_0x1f5a90[_0x9a6c('0x3e')]['id']){delete _0x1f5a90[_0x9a6c('0x3e')]['id'];}return db[_0x9a6c('0x25')][_0x9a6c('0x3f')]({'where':{'id':_0x1f5a90['params']['id']}})['then'](handleEntityNotFound(_0x1d7b03,null))['then'](saveUpdates(_0x1f5a90['body'],null))[_0x9a6c('0x1e')](respondWithResult(_0x1d7b03,null))['catch'](handleError(_0x1d7b03,null));};exports[_0x9a6c('0x40')]=function(_0x3ceeaf,_0x2f6984){return db[_0x9a6c('0x25')][_0x9a6c('0x3f')]({'where':{'id':_0x3ceeaf[_0x9a6c('0x30')]['id']}})[_0x9a6c('0x1e')](handleEntityNotFound(_0x2f6984,null))[_0x9a6c('0x1e')](removeEntity(_0x2f6984,null))[_0x9a6c('0x2d')](handleError(_0x2f6984,null));};exports[_0x9a6c('0x41')]=function(_0x46d1c4,_0x2f249e){return db[_0x9a6c('0x25')]['describe']()['then'](respondWithResult(_0x2f249e,null))['catch'](handleError(_0x2f249e,null));};exports[_0x9a6c('0x42')]=function(_0xbb81e2,_0x3a4e84){return db[_0x9a6c('0x43')][_0x9a6c('0x3f')]({'where':{'id':_0xbb81e2[_0x9a6c('0x30')]['id']}})[_0x9a6c('0x1e')](handleEntityNotFound(_0x3a4e84,null))[_0x9a6c('0x1e')](function(_0x28cbab){if(_0x28cbab){return _0x28cbab[_0x9a6c('0x42')](_0xbb81e2[_0x9a6c('0x3e')]['ids'],_[_0x9a6c('0x44')](_0xbb81e2[_0x9a6c('0x3e')],[_0x9a6c('0x45'),'id'])||{});}})['then'](respondWithResult(_0x3a4e84,null))[_0x9a6c('0x2d')](handleError(_0x3a4e84,null));};exports['getMessages']=function(_0x2e71c6,_0x102b3f){var _0x100f26={'raw':![],'where':{}};var _0x8543ab={};var _0x970459={'count':0x0,'rows':[]};return db[_0x9a6c('0x25')][_0x9a6c('0x46')]({'where':{'id':_0x2e71c6['params']['id']}})[_0x9a6c('0x1e')](handleEntityNotFound(_0x102b3f,null))['then'](function(_0x27df7f){if(_0x27df7f){_0x8543ab[_0x9a6c('0x31')]=_[_0x9a6c('0x33')](db['OpenchannelMessage'][_0x9a6c('0x32')]);_0x8543ab['query']=_['keys'](_0x2e71c6['query']);_0x8543ab[_0x9a6c('0x34')]=_['intersection'](_0x8543ab[_0x9a6c('0x31')],_0x8543ab[_0x9a6c('0x2c')]);_0x100f26[_0x9a6c('0x37')]=_['intersection'](_0x8543ab[_0x9a6c('0x31')],qs['fields'](_0x2e71c6[_0x9a6c('0x2c')][_0x9a6c('0x36')]));_0x100f26['attributes']=_0x100f26[_0x9a6c('0x37')]['length']?_0x100f26['attributes']:_0x8543ab['model'];if(!_0x2e71c6[_0x9a6c('0x2c')]['hasOwnProperty'](_0x9a6c('0x47'))){_0x100f26[_0x9a6c('0x1a')]=qs[_0x9a6c('0x1a')](_0x2e71c6['query'][_0x9a6c('0x1a')]);_0x100f26[_0x9a6c('0x19')]=qs[_0x9a6c('0x19')](_0x2e71c6[_0x9a6c('0x2c')]['offset']);}_0x100f26[_0x9a6c('0x48')]=qs[_0x9a6c('0x49')](_0x2e71c6[_0x9a6c('0x2c')][_0x9a6c('0x49')]);_0x100f26[_0x9a6c('0x4a')]=qs['filters'](_['pick'](_0x2e71c6['query'],_0x8543ab[_0x9a6c('0x34')]));_0x100f26[_0x9a6c('0x4a')][_0x9a6c('0x4b')]=_0x27df7f['id'];if(_0x2e71c6[_0x9a6c('0x2c')][_0x9a6c('0x4c')]){_0x100f26[_0x9a6c('0x4a')]=_[_0x9a6c('0x3b')](_0x100f26['where'],{'$or':_['map'](_0x100f26[_0x9a6c('0x37')],function(_0x562fc6){var _0x1962a5={};_0x1962a5[_0x562fc6]={'$like':'%'+_0x2e71c6[_0x9a6c('0x2c')][_0x9a6c('0x4c')]+'%'};return _0x1962a5;})});}if(_0x2e71c6[_0x9a6c('0x2c')][_0x9a6c('0x4d')]){var _0x3b6e23=_0x2e71c6[_0x9a6c('0x2c')][_0x9a6c('0x4d')][_0x9a6c('0x4e')](',');var _0x1063fb={};_0x1063fb[_0x3b6e23[0x0]]={'$gte':moment(_0x3b6e23[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x100f26[_0x9a6c('0x4a')]=_[_0x9a6c('0x3b')](_0x100f26[_0x9a6c('0x4a')],_0x1063fb);}_0x100f26=_['merge']({},_0x100f26,_0x2e71c6[_0x9a6c('0x3c')]);return db[_0x9a6c('0x43')][_0x9a6c('0x18')]({'where':_0x100f26[_0x9a6c('0x4a')]})[_0x9a6c('0x1e')](function(_0x2dd630){_0x970459[_0x9a6c('0x18')]=_0x2dd630;if(_0x2e71c6[_0x9a6c('0x2c')][_0x9a6c('0x39')]){_0x100f26[_0x9a6c('0x3a')]=[{'all':!![]}];}return db[_0x9a6c('0x43')][_0x9a6c('0x2a')](_0x100f26);})[_0x9a6c('0x1e')](function(_0x3c1db8){_0x970459[_0x9a6c('0x4f')]=_0x3c1db8;return _0x970459;});}})['then'](respondWithFilteredResult(_0x102b3f,_0x100f26))[_0x9a6c('0x2d')](handleError(_0x102b3f,null));};exports[_0x9a6c('0x50')]=function(_0xd8f5b2,_0x3fb7c7){return db[_0x9a6c('0x25')][_0x9a6c('0x3f')]({'where':{'id':_0xd8f5b2[_0x9a6c('0x30')]['id']}})[_0x9a6c('0x1e')](handleEntityNotFound(_0x3fb7c7,null))[_0x9a6c('0x1e')](function(_0x15bb1d){if(_0x15bb1d){return _0x15bb1d[_0x9a6c('0x51')](_0xd8f5b2[_0x9a6c('0x3e')]['ids'],_[_0x9a6c('0x44')](_0xd8f5b2[_0x9a6c('0x3e')],['ids','id'])||{})[_0x9a6c('0x52')](function(){return db[_0x9a6c('0x53')][_0x9a6c('0x2a')]({'attributes':['id',_0x9a6c('0x21'),'color'],'where':{'id':_0xd8f5b2[_0x9a6c('0x3e')][_0x9a6c('0x45')]}});})['then'](function(_0x4e3bf0){socket[_0x9a6c('0x54')](_0x9a6c('0x55'),{'id':Number(_0xd8f5b2[_0x9a6c('0x30')]['id']),'tags':_0x4e3bf0||[]});return{'id':Number(_0xd8f5b2[_0x9a6c('0x30')]['id']),'tags':_0x4e3bf0||[]};});}})[_0x9a6c('0x1e')](respondWithResult(_0x3fb7c7,null))[_0x9a6c('0x2d')](handleError(_0x3fb7c7,null));};exports[_0x9a6c('0x56')]=function(_0xe7d6dc,_0x1f1d0a){return db[_0x9a6c('0x25')][_0x9a6c('0x3f')]({'where':{'id':_0xe7d6dc['params']['id']}})['then'](handleEntityNotFound(_0x1f1d0a,null))['then'](function(_0x410bf7){if(_0x410bf7){return _0x410bf7[_0x9a6c('0x56')](_0xe7d6dc[_0x9a6c('0x2c')]['ids']);}})[_0x9a6c('0x1e')](respondWithStatusCode(_0x1f1d0a,null))[_0x9a6c('0x2d')](handleError(_0x1f1d0a,null));};exports['download']=function(_0x9eb0de,_0x6b6c4b){var _0x2206be=moment()[_0x9a6c('0x57')]()[_0x9a6c('0x58')]();var _0xb0c116=path[_0x9a6c('0x59')](config[_0x9a6c('0x5a')],_0x9a6c('0x5b'),_0x9a6c('0x5c'),_0x9a6c('0x5d'));var _0x5005ac=path[_0x9a6c('0x59')](config[_0x9a6c('0x5a')],_0x9a6c('0x5b'),'files','attachments');var _0x23a212=path[_0x9a6c('0x59')](_0xb0c116,_0x2206be);var _0x3d0c08=util['format'](_0x9a6c('0x5e'),_0x9eb0de[_0x9a6c('0x30')]['id'],_0x2206be);var _0x4b73dc=path[_0x9a6c('0x59')](_0xb0c116,_0x3d0c08);var _0x550cb3=[];_0x550cb3[_0x9a6c('0x5f')]({'model':db[_0x9a6c('0x60')],'as':_0x9a6c('0x60'),'attributes':['id','fullname'],'raw':!![]});_0x550cb3[_0x9a6c('0x5f')]({'model':db[_0x9a6c('0x61')],'as':'Contact','attributes':['id','firstName',_0x9a6c('0x62')],'raw':!![]});if(_0x9eb0de[_0x9a6c('0x2c')][_0x9a6c('0x63')]){_0x550cb3[_0x9a6c('0x5f')]({'model':db[_0x9a6c('0x64')],'as':'Attachment','raw':!![]});}var _0x387d05=[{'model':db[_0x9a6c('0x43')],'as':_0x9a6c('0x65'),'attributes':['id','body',_0x9a6c('0x66'),'direction',_0x9a6c('0x67'),_0x9a6c('0x68')],'include':_0x550cb3}];_0x387d05[_0x9a6c('0x5f')]({'model':db[_0x9a6c('0x69')],'as':_0x9a6c('0x6a'),'attributes':['id',_0x9a6c('0x21')]});_0x387d05[_0x9a6c('0x5f')]({'model':db[_0x9a6c('0x60')],'as':'Owner','attributes':['id',_0x9a6c('0x6b')]});return db[_0x9a6c('0x25')][_0x9a6c('0x3f')]({'where':{'id':_0x9eb0de['params']['id']},'include':_0x387d05})['then'](handleEntityNotFound(_0x6b6c4b,null))[_0x9a6c('0x1e')](function(_0x249dc4){if(_0x249dc4){var _0x4dc2de=_0x249dc4[_0x9a6c('0x6c')]({'plain':!![]});fs[_0x9a6c('0x6d')](_0x23a212);var _0x1aec7e={'channel':'Openchannel','account':_0x4dc2de['Account'][_0x9a6c('0x21')],'agent':_0x4dc2de[_0x9a6c('0x6e')]?_0x4dc2de[_0x9a6c('0x6e')]['fullname']:'N.A.','createdAt':moment(_0x4dc2de[_0x9a6c('0x66')])[_0x9a6c('0x6f')](_0x9a6c('0x70'))[_0x9a6c('0x58')](),'closedAt':_0x4dc2de[_0x9a6c('0x71')]?moment(_0x4dc2de[_0x9a6c('0x72')])[_0x9a6c('0x6f')](_0x9a6c('0x70'))[_0x9a6c('0x58')]():'','disposition':_0x4dc2de[_0x9a6c('0x73')],'visibility':_0x4dc2de[_0x9a6c('0x74')]?_0x9a6c('0x75'):_0x9a6c('0x76'),'messages':_(_0x4dc2de[_0x9a6c('0x65')])[_0x9a6c('0x4c')]({'secret':![]})[_0x9a6c('0x24')](function(_0x55f994){if(_0x55f994['Attachment']){var _0xb1170f=path[_0x9a6c('0x59')](_0x5005ac,_0x55f994['Attachment'][_0x9a6c('0x77')]);if(fs[_0x9a6c('0x78')](_0xb1170f)){fs['createReadStream'](_0xb1170f)[_0x9a6c('0x79')](fs[_0x9a6c('0x7a')](path[_0x9a6c('0x59')](_0x23a212,_0x55f994[_0x9a6c('0x64')][_0x9a6c('0x77')])));}}return{'date':moment(_0x55f994[_0x9a6c('0x66')])[_0x9a6c('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9a6c('0x58')](),'sender':_0x55f994[_0x9a6c('0x7b')]===_0x9a6c('0x7c')?_0x55f994[_0x9a6c('0x60')]?_0x55f994['User'][_0x9a6c('0x6b')]:_0x9a6c('0x7d'):_0x55f994[_0x9a6c('0x7e')][_0x9a6c('0x7f')]+(_0x55f994[_0x9a6c('0x7e')][_0x9a6c('0x62')]?'\x20'+_0x55f994[_0x9a6c('0x7e')][_0x9a6c('0x62')]:''),'body':_0x55f994['Attachment']?_0x55f994[_0x9a6c('0x64')]['basename']:_0x55f994['body'],'direction':_0x55f994['direction']===_0x9a6c('0x7c')?'A':'C','secret':_0x55f994[_0x9a6c('0x67')],'read':_0x55f994[_0x9a6c('0x68')],'attachment':_0x55f994[_0x9a6c('0x64')]};})[_0x9a6c('0x80')]()};return ejs[_0x9a6c('0x81')](path[_0x9a6c('0x59')](config[_0x9a6c('0x5a')],_0x9a6c('0x5b'),_0x9a6c('0x82'),'downloadInteraction.ejs'),{'interaction':_0x1aec7e})['then'](function(_0x353e19){var _0x3bee94=path[_0x9a6c('0x59')](_0x23a212,'transcript-'+_0x4dc2de['id']+'-'+_0x2206be+_0x9a6c('0x83'));var _0x35e9f7={'path':_0x3bee94,'channel':_0x9a6c('0x84'),'interactionId':_0x4dc2de['id']};return pdf[_0x9a6c('0x85')](_0x353e19,_0x35e9f7);})[_0x9a6c('0x1e')](function(){return new Promise(function(_0x2d1b6b,_0x3ee04c){zipdir(_0x23a212,{'saveTo':_0x4b73dc},function(_0xf6b641,_0x41173d){if(_0xf6b641)return _0x3ee04c(_0xf6b641);return _0x2d1b6b(_0x41173d);});})[_0x9a6c('0x1e')](function(){return new Promise(function(_0x62105d,_0x5b0fee){rimraf(_0x23a212,function(_0x19c0b3){if(_0x19c0b3)_0x5b0fee(_0x19c0b3);return _0x62105d();});});})['then'](function(){return _0x6b6c4b[_0x9a6c('0x86')](_0x4b73dc,_0x3d0c08,function(_0x1b671c){if(_0x1b671c){logger[_0x9a6c('0x1f')](_0x9a6c('0x87'),_0x1b671c);}else{fs[_0x9a6c('0x88')](_0x4b73dc);}});});});}else{return _0x6b6c4b[_0x9a6c('0x13')](0xc8);}})[_0x9a6c('0x2d')](handleError(_0x6b6c4b,null));}; \ No newline at end of file +var _0x54e2=['OpenchannelInteraction','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','ids','getMessages','OpenchannelMessage','keys','nolimit','limit','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','emit','openchannelInteractionTags:save','removeTags','toString','join','root','server','files','tmp','User','fullname','push','CmContact','Contact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','Public','Private','Messages','basename','existsSync','createWriteStream','System','value','views','transcript-','.pdf','download','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','offset','undefined','count','Content-Range','json','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','findAll','query','user','show','from','params','model'];(function(_0xac1d19,_0x447fa8){var _0x1133e0=function(_0x44a661){while(--_0x44a661){_0xac1d19['push'](_0xac1d19['shift']());}};_0x1133e0(++_0x447fa8);}(_0x54e2,0x141));var _0x254e=function(_0x170229,_0x4f09be){_0x170229=_0x170229-0x0;var _0x4a9429=_0x54e2[_0x170229];return _0x4a9429;};'use strict';var rimraf=require(_0x254e('0x0'));var zipdir=require(_0x254e('0x1'));var moment=require(_0x254e('0x2'));var util=require(_0x254e('0x3'));var path=require(_0x254e('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x254e('0x5'));var Redis=require('ioredis');var interaction=require(_0x254e('0x6'));var qs=require(_0x254e('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x254e('0x8'));var config=require(_0x254e('0x9'));var db=require(_0x254e('0xa'))['db'];config[_0x254e('0xb')]=_['defaults'](config[_0x254e('0xb')],{'host':_0x254e('0xc'),'port':0x18eb});var socket=require(_0x254e('0xd'))(new Redis(config[_0x254e('0xb')]));require(_0x254e('0xe'))[_0x254e('0xf')](socket);function respondWithStatusCode(_0x3b2291,_0x525e94){_0x525e94=_0x525e94||0xcc;return function(_0x3c10b2){if(_0x3c10b2){return _0x3b2291[_0x254e('0x10')](_0x525e94);}return _0x3b2291['status'](_0x525e94)[_0x254e('0x11')]();};}function respondWithResult(_0x3080b5,_0x1b6372){_0x1b6372=_0x1b6372||0xc8;return function(_0x41e816){if(_0x41e816){return _0x3080b5[_0x254e('0x12')](_0x1b6372)['json'](_0x41e816);}};}function respondWithFilteredResult(_0x168855,_0x5086d3){return function(_0x551e40){if(_0x551e40){var _0x2245ee=typeof _0x5086d3[_0x254e('0x13')]===_0x254e('0x14')&&typeof _0x5086d3['limit']==='undefined';var _0x3b214f=_0x551e40['count'];var _0x1b5d41=_0x2245ee?0x0:_0x5086d3[_0x254e('0x13')];var _0x22781f=_0x2245ee?_0x551e40[_0x254e('0x15')]:_0x5086d3['offset']+_0x5086d3['limit'];var _0x22131d;if(_0x22781f>=_0x3b214f){_0x22781f=_0x3b214f;_0x22131d=0xc8;}else{_0x22131d=0xce;}_0x168855[_0x254e('0x12')](_0x22131d);return _0x168855['set'](_0x254e('0x16'),_0x1b5d41+'-'+_0x22781f+'/'+_0x3b214f)[_0x254e('0x17')](_0x551e40);}return null;};}function saveUpdates(_0x2cf3b5){return function(_0x294a97){if(_0x294a97){return _0x294a97[_0x254e('0x18')](_0x2cf3b5)[_0x254e('0x19')](function(_0x112911){return _0x112911;});}return null;};}function removeEntity(_0x5aa29e){return function(_0x24271b){if(_0x24271b){return _0x24271b[_0x254e('0x1a')]()['then'](function(){_0x5aa29e[_0x254e('0x12')](0xcc)[_0x254e('0x11')]();});}};}function handleEntityNotFound(_0x1e4fe0){return function(_0x50275d){if(!_0x50275d){_0x1e4fe0[_0x254e('0x10')](0x194);}return _0x50275d;};}function handleError(_0x4dfe5d,_0x5ddf91){_0x5ddf91=_0x5ddf91||0x1f4;return function(_0x1abe54){logger['error'](_0x1abe54[_0x254e('0x1b')]);if(_0x1abe54[_0x254e('0x1c')]){delete _0x1abe54[_0x254e('0x1c')];}_0x4dfe5d[_0x254e('0x12')](_0x5ddf91)['send'](_0x1abe54);};}exports[_0x254e('0x1d')]=function(_0x5998bb,_0xd853da){var _0x83abba={};var _0xbaada8=_[_0x254e('0x1e')](db['OpenchannelInteraction'][_0x254e('0x1f')],function(_0x1a8fe0){return{'name':_0x1a8fe0[_0x254e('0x20')],'type':_0x1a8fe0[_0x254e('0x21')][_0x254e('0x22')]};});_0x83abba=qs['getOptions'](_0xbaada8,_0x5998bb);return interaction[_0x254e('0x23')]('openchannel',_0x5998bb[_0x254e('0x24')],_0x5998bb[_0x254e('0x25')],_0x83abba,_0xbaada8)[_0x254e('0x19')](respondWithFilteredResult(_0xd853da,_0x83abba))['catch'](handleError(_0xd853da,null));};exports[_0x254e('0x26')]=function(_0x2e9884,_0x3913c0){var _0x41f9e5={};if(_0x2e9884['query'][_0x254e('0x21')]&&_0x2e9884['query'][_0x254e('0x21')]===_0x254e('0x27')){_0x41f9e5[_0x254e('0x27')]=_0x2e9884[_0x254e('0x28')]['id'];}else{_0x41f9e5['id']=_0x2e9884['params']['id'];}var _0x28c526={'raw':![],'where':_0x41f9e5},_0x68c620={};_0x68c620[_0x254e('0x29')]=_['keys'](db[_0x254e('0x2a')]['rawAttributes']);_0x68c620[_0x254e('0x24')]=_['keys'](_0x2e9884['query']);_0x68c620[_0x254e('0x2b')]=_['intersection'](_0x68c620[_0x254e('0x29')],_0x68c620[_0x254e('0x24')]);_0x28c526[_0x254e('0x2c')]=_[_0x254e('0x2d')](_0x68c620['model'],qs[_0x254e('0x2e')](_0x2e9884[_0x254e('0x24')][_0x254e('0x2e')]));_0x28c526['attributes']=_0x28c526[_0x254e('0x2c')][_0x254e('0x2f')]?_0x28c526[_0x254e('0x2c')]:_0x68c620[_0x254e('0x29')];if(_0x2e9884[_0x254e('0x24')][_0x254e('0x30')]){_0x28c526[_0x254e('0x31')]=[{'all':!![]}];}_0x28c526=_[_0x254e('0x32')]({},_0x28c526,_0x2e9884[_0x254e('0x33')]);return db[_0x254e('0x2a')][_0x254e('0x34')](_0x28c526)[_0x254e('0x19')](handleEntityNotFound(_0x3913c0,null))[_0x254e('0x19')](respondWithResult(_0x3913c0,null))[_0x254e('0x35')](handleError(_0x3913c0,null));};exports['create']=function(_0x1f48da,_0x14e1fe){return db[_0x254e('0x2a')][_0x254e('0x36')](_0x1f48da[_0x254e('0x37')],{})[_0x254e('0x19')](respondWithResult(_0x14e1fe,0xc9))['catch'](handleError(_0x14e1fe,null));};exports['update']=function(_0x1b0b63,_0x32ef4d){if(_0x1b0b63[_0x254e('0x37')]['id']){delete _0x1b0b63[_0x254e('0x37')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x1b0b63[_0x254e('0x28')]['id']}})['then'](handleEntityNotFound(_0x32ef4d,null))[_0x254e('0x19')](saveUpdates(_0x1b0b63[_0x254e('0x37')],null))[_0x254e('0x19')](respondWithResult(_0x32ef4d,null))[_0x254e('0x35')](handleError(_0x32ef4d,null));};exports[_0x254e('0x1a')]=function(_0x14b002,_0x24b95d){return db[_0x254e('0x2a')][_0x254e('0x34')]({'where':{'id':_0x14b002['params']['id']}})['then'](handleEntityNotFound(_0x24b95d,null))[_0x254e('0x19')](removeEntity(_0x24b95d,null))[_0x254e('0x35')](handleError(_0x24b95d,null));};exports[_0x254e('0x38')]=function(_0x292d8e,_0x2ef86f){return db[_0x254e('0x2a')]['describe']()['then'](respondWithResult(_0x2ef86f,null))[_0x254e('0x35')](handleError(_0x2ef86f,null));};exports[_0x254e('0x39')]=function(_0x5087fd,_0x59b176){return db['OpenchannelMessage']['find']({'where':{'id':_0x5087fd[_0x254e('0x28')]['id']}})[_0x254e('0x19')](handleEntityNotFound(_0x59b176,null))['then'](function(_0x2c15fb){if(_0x2c15fb){return _0x2c15fb[_0x254e('0x39')](_0x5087fd['body'][_0x254e('0x3a')],_['omit'](_0x5087fd['body'],[_0x254e('0x3a'),'id'])||{});}})[_0x254e('0x19')](respondWithResult(_0x59b176,null))[_0x254e('0x35')](handleError(_0x59b176,null));};exports[_0x254e('0x3b')]=function(_0x7f729a,_0x190a68){var _0xd92148={'raw':![],'where':{}};var _0x3a493a={};var _0x271c29={'count':0x0,'rows':[]};return db[_0x254e('0x2a')]['findOne']({'where':{'id':_0x7f729a['params']['id']}})[_0x254e('0x19')](handleEntityNotFound(_0x190a68,null))[_0x254e('0x19')](function(_0x30bd2c){if(_0x30bd2c){_0x3a493a[_0x254e('0x29')]=_['keys'](db[_0x254e('0x3c')]['rawAttributes']);_0x3a493a[_0x254e('0x24')]=_[_0x254e('0x3d')](_0x7f729a[_0x254e('0x24')]);_0x3a493a['filters']=_[_0x254e('0x2d')](_0x3a493a['model'],_0x3a493a[_0x254e('0x24')]);_0xd92148['attributes']=_[_0x254e('0x2d')](_0x3a493a[_0x254e('0x29')],qs['fields'](_0x7f729a[_0x254e('0x24')][_0x254e('0x2e')]));_0xd92148[_0x254e('0x2c')]=_0xd92148['attributes'][_0x254e('0x2f')]?_0xd92148[_0x254e('0x2c')]:_0x3a493a[_0x254e('0x29')];if(!_0x7f729a[_0x254e('0x24')]['hasOwnProperty'](_0x254e('0x3e'))){_0xd92148[_0x254e('0x3f')]=qs[_0x254e('0x3f')](_0x7f729a[_0x254e('0x24')][_0x254e('0x3f')]);_0xd92148['offset']=qs[_0x254e('0x13')](_0x7f729a[_0x254e('0x24')]['offset']);}_0xd92148['order']=qs[_0x254e('0x40')](_0x7f729a[_0x254e('0x24')][_0x254e('0x40')]);_0xd92148[_0x254e('0x41')]=qs[_0x254e('0x2b')](_['pick'](_0x7f729a[_0x254e('0x24')],_0x3a493a[_0x254e('0x2b')]));_0xd92148[_0x254e('0x41')][_0x254e('0x42')]=_0x30bd2c['id'];if(_0x7f729a[_0x254e('0x24')][_0x254e('0x43')]){_0xd92148['where']=_[_0x254e('0x32')](_0xd92148[_0x254e('0x41')],{'$or':_[_0x254e('0x1e')](_0xd92148[_0x254e('0x2c')],function(_0x522df4){var _0x97b4a4={};_0x97b4a4[_0x522df4]={'$like':'%'+_0x7f729a[_0x254e('0x24')][_0x254e('0x43')]+'%'};return _0x97b4a4;})});}if(_0x7f729a[_0x254e('0x24')][_0x254e('0x44')]){var _0x39ec9d=_0x7f729a[_0x254e('0x24')][_0x254e('0x44')][_0x254e('0x45')](',');var _0x155e29={};_0x155e29[_0x39ec9d[0x0]]={'$gte':moment(_0x39ec9d[0x1])[_0x254e('0x46')](_0x254e('0x47'))};_0xd92148['where']=_[_0x254e('0x32')](_0xd92148[_0x254e('0x41')],_0x155e29);}_0xd92148=_[_0x254e('0x32')]({},_0xd92148,_0x7f729a[_0x254e('0x33')]);return db[_0x254e('0x3c')][_0x254e('0x15')]({'where':_0xd92148[_0x254e('0x41')]})[_0x254e('0x19')](function(_0x580a94){_0x271c29['count']=_0x580a94;if(_0x7f729a[_0x254e('0x24')][_0x254e('0x30')]){_0xd92148[_0x254e('0x31')]=[{'all':!![]}];}return db[_0x254e('0x3c')][_0x254e('0x23')](_0xd92148);})[_0x254e('0x19')](function(_0x142e89){_0x271c29[_0x254e('0x48')]=_0x142e89;return _0x271c29;});}})[_0x254e('0x19')](respondWithFilteredResult(_0x190a68,_0xd92148))[_0x254e('0x35')](handleError(_0x190a68,null));};exports[_0x254e('0x49')]=function(_0x5db53e,_0x54fce9){return db[_0x254e('0x2a')][_0x254e('0x34')]({'where':{'id':_0x5db53e[_0x254e('0x28')]['id']}})['then'](handleEntityNotFound(_0x54fce9,null))[_0x254e('0x19')](function(_0x1ec31f){if(_0x1ec31f){return _0x1ec31f[_0x254e('0x4a')](_0x5db53e[_0x254e('0x37')]['ids'],_[_0x254e('0x4b')](_0x5db53e['body'],[_0x254e('0x3a'),'id'])||{})[_0x254e('0x4c')](function(){return db['Tag'][_0x254e('0x23')]({'attributes':['id',_0x254e('0x1c'),_0x254e('0x4d')],'where':{'id':_0x5db53e[_0x254e('0x37')]['ids']}});})[_0x254e('0x19')](function(_0x1d77a5){socket[_0x254e('0x4e')](_0x254e('0x4f'),{'id':Number(_0x5db53e[_0x254e('0x28')]['id']),'tags':_0x1d77a5||[]});return{'id':Number(_0x5db53e[_0x254e('0x28')]['id']),'tags':_0x1d77a5||[]};});}})[_0x254e('0x19')](respondWithResult(_0x54fce9,null))['catch'](handleError(_0x54fce9,null));};exports[_0x254e('0x50')]=function(_0x140599,_0x5c0646){return db[_0x254e('0x2a')][_0x254e('0x34')]({'where':{'id':_0x140599[_0x254e('0x28')]['id']}})[_0x254e('0x19')](handleEntityNotFound(_0x5c0646,null))['then'](function(_0x2f205c){if(_0x2f205c){return _0x2f205c[_0x254e('0x50')](_0x140599['query']['ids']);}})[_0x254e('0x19')](respondWithStatusCode(_0x5c0646,null))['catch'](handleError(_0x5c0646,null));};exports['download']=function(_0x2666cb,_0x59c917){var _0x39e0de=moment()['unix']()[_0x254e('0x51')]();var _0xc10f58=path[_0x254e('0x52')](config[_0x254e('0x53')],_0x254e('0x54'),_0x254e('0x55'),_0x254e('0x56'));var _0x38e234=path[_0x254e('0x52')](config[_0x254e('0x53')],_0x254e('0x54'),'files','attachments');var _0x4a2b1e=path['join'](_0xc10f58,_0x39e0de);var _0x1b4fbb=util[_0x254e('0x46')]('transcript-%d-%s.zip',_0x2666cb[_0x254e('0x28')]['id'],_0x39e0de);var _0x31655d=path[_0x254e('0x52')](_0xc10f58,_0x1b4fbb);var _0x43c5be=[];_0x43c5be['push']({'model':db[_0x254e('0x57')],'as':'User','attributes':['id',_0x254e('0x58')],'raw':!![]});_0x43c5be[_0x254e('0x59')]({'model':db[_0x254e('0x5a')],'as':_0x254e('0x5b'),'attributes':['id',_0x254e('0x5c'),_0x254e('0x5d')],'raw':!![]});if(_0x2666cb[_0x254e('0x24')][_0x254e('0x5e')]){_0x43c5be[_0x254e('0x59')]({'model':db['Attachment'],'as':_0x254e('0x5f'),'raw':!![]});}var _0x52dda4=[{'model':db[_0x254e('0x3c')],'as':'Messages','attributes':['id',_0x254e('0x37'),_0x254e('0x60'),_0x254e('0x61'),_0x254e('0x62'),_0x254e('0x63')],'include':_0x43c5be}];_0x52dda4[_0x254e('0x59')]({'model':db[_0x254e('0x64')],'as':'Account','attributes':['id',_0x254e('0x1c')]});_0x52dda4[_0x254e('0x59')]({'model':db['User'],'as':_0x254e('0x65'),'attributes':['id',_0x254e('0x58')]});return db['OpenchannelInteraction'][_0x254e('0x34')]({'where':{'id':_0x2666cb['params']['id']},'include':_0x52dda4})[_0x254e('0x19')](handleEntityNotFound(_0x59c917,null))[_0x254e('0x19')](function(_0x373cfe){if(_0x373cfe){var _0x51a9b6=_0x373cfe['get']({'plain':!![]});fs[_0x254e('0x66')](_0x4a2b1e);var _0x3cf62b={'channel':_0x254e('0x67'),'account':_0x51a9b6['Account'][_0x254e('0x1c')],'agent':_0x51a9b6[_0x254e('0x65')]?_0x51a9b6[_0x254e('0x65')][_0x254e('0x58')]:_0x254e('0x68'),'createdAt':moment(_0x51a9b6[_0x254e('0x60')])[_0x254e('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x254e('0x51')](),'closedAt':_0x51a9b6[_0x254e('0x69')]?moment(_0x51a9b6[_0x254e('0x6a')])[_0x254e('0x46')](_0x254e('0x47'))[_0x254e('0x51')]():'','disposition':_0x51a9b6['disposition'],'visibility':_0x51a9b6['threadId']?_0x254e('0x6b'):_0x254e('0x6c'),'messages':_(_0x51a9b6[_0x254e('0x6d')])[_0x254e('0x43')]({'secret':![]})[_0x254e('0x1e')](function(_0x3de918){if(_0x3de918['Attachment']){var _0x4751ec=path[_0x254e('0x52')](_0x38e234,_0x3de918['Attachment'][_0x254e('0x6e')]);if(fs[_0x254e('0x6f')](_0x4751ec)){fs['createReadStream'](_0x4751ec)['pipe'](fs[_0x254e('0x70')](path['join'](_0x4a2b1e,_0x3de918[_0x254e('0x5f')][_0x254e('0x6e')])));}}return{'date':moment(_0x3de918[_0x254e('0x60')])['format'](_0x254e('0x47'))[_0x254e('0x51')](),'sender':_0x3de918[_0x254e('0x61')]==='out'?_0x3de918['User']?_0x3de918['User'][_0x254e('0x58')]:_0x254e('0x71'):_0x3de918[_0x254e('0x5b')]['firstName']+(_0x3de918[_0x254e('0x5b')][_0x254e('0x5d')]?'\x20'+_0x3de918[_0x254e('0x5b')][_0x254e('0x5d')]:''),'body':_0x3de918[_0x254e('0x5f')]?_0x3de918['Attachment'][_0x254e('0x6e')]:_0x3de918[_0x254e('0x37')],'direction':_0x3de918[_0x254e('0x61')]==='out'?'A':'C','secret':_0x3de918[_0x254e('0x62')],'read':_0x3de918[_0x254e('0x63')],'attachment':_0x3de918[_0x254e('0x5f')]};})[_0x254e('0x72')]()};return ejs['renderFile'](path[_0x254e('0x52')](config['root'],'server',_0x254e('0x73'),'downloadInteraction.ejs'),{'interaction':_0x3cf62b})[_0x254e('0x19')](function(_0x2c056e){var _0xb424ed=path['join'](_0x4a2b1e,_0x254e('0x74')+_0x51a9b6['id']+'-'+_0x39e0de+_0x254e('0x75'));var _0x90be01={'path':_0xb424ed,'channel':_0x254e('0x67'),'interactionId':_0x51a9b6['id']};return pdf['createPdfFromHTML'](_0x2c056e,_0x90be01);})[_0x254e('0x19')](function(){return new Promise(function(_0x49bf05,_0x11acef){zipdir(_0x4a2b1e,{'saveTo':_0x31655d},function(_0x577546,_0x4abfc7){if(_0x577546)return _0x11acef(_0x577546);return _0x49bf05(_0x4abfc7);});})[_0x254e('0x19')](function(){return new Promise(function(_0x27970a,_0x5ba161){rimraf(_0x4a2b1e,function(_0x13c3bd){if(_0x13c3bd)_0x5ba161(_0x13c3bd);return _0x27970a();});});})[_0x254e('0x19')](function(){return _0x59c917[_0x254e('0x76')](_0x31655d,_0x1b4fbb,function(_0x2aea51){if(_0x2aea51){logger[_0x254e('0x77')](_0x254e('0x78'),_0x2aea51);}else{fs['unlinkSync'](_0x31655d);}});});});}else{return _0x59c917[_0x254e('0x10')](0xc8);}})['catch'](handleError(_0x59c917,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index fb497de..82d7a84 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 _0x8ad9=['emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x33dde6,_0x2c422a){var _0x5610d0=function(_0x315cee){while(--_0x315cee){_0x33dde6['push'](_0x33dde6['shift']());}};_0x5610d0(++_0x2c422a);}(_0x8ad9,0x174));var _0x98ad=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8ad9[_0x25d386];return _0x857f4a;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x98ad('0x0'))['db'][_0x98ad('0x1')];var OpenchannelMessage=require(_0x98ad('0x0'))['db'][_0x98ad('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x98ad('0x3')](0x0);var events={'afterCreate':_0x98ad('0x4'),'afterUpdate':'update','afterDestroy':_0x98ad('0x5')};function emitEvent(_0x1d5fe9){return function(_0x276e43,_0x34d386,_0xee7f73){_0x276e43[_0x98ad('0x6')]({'attributes':['id'],'raw':!![]})[_0x98ad('0x7')](function(_0x5903e2){_0x276e43[_0x98ad('0x8')](_0x98ad('0x9'),_0x5903e2[_0x98ad('0xa')](function(_0x35a43e){return{'id':_0x35a43e['id']};}));return OpenchannelMessage[_0x98ad('0xb')]({'where':{'OpenchannelInteractionId':_0x276e43['id'],'direction':'in','read':![]},'raw':!![]});})[_0x98ad('0x7')](function(_0x372be8){_0x276e43[_0x98ad('0x8')]('unreadMessages',_0x372be8['length']);OpenchannelInteractionEvents[_0x98ad('0xc')](_0x1d5fe9+':'+_0x276e43['id'],_0x276e43);OpenchannelInteractionEvents['emit'](_0x1d5fe9,_0x276e43);_0xee7f73(null);})['catch'](_0xee7f73(null));};}for(var e in events){if(events[_0x98ad('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x98ad('0xe')](e,emitEvent(event));}}module[_0x98ad('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1bf2=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','save','update'];(function(_0x98f2ba,_0x1f681d){var _0x2c9d5c=function(_0x5f0999){while(--_0x5f0999){_0x98f2ba['push'](_0x98f2ba['shift']());}};_0x2c9d5c(++_0x1f681d);}(_0x1bf2,0x183));var _0x21bf=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x1bf2[_0xf50820];return _0x2a9b10;};'use strict';var EventEmitter=require(_0x21bf('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x21bf('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x21bf('0x2'),'afterUpdate':_0x21bf('0x3'),'afterDestroy':_0x21bf('0x4')};function emitEvent(_0x37326c){return function(_0x1f3b67,_0x2b4c0f,_0x3bb8c8){_0x1f3b67[_0x21bf('0x5')]({'attributes':['id'],'raw':!![]})[_0x21bf('0x6')](function(_0x42def0){_0x1f3b67[_0x21bf('0x7')](_0x21bf('0x8'),_0x42def0[_0x21bf('0x9')](function(_0x5ab269){return{'id':_0x5ab269['id']};}));return OpenchannelMessage[_0x21bf('0xa')]({'where':{'OpenchannelInteractionId':_0x1f3b67['id'],'direction':'in','read':![]},'raw':!![]});})[_0x21bf('0x6')](function(_0x44ce0f){_0x1f3b67[_0x21bf('0x7')](_0x21bf('0xb'),_0x44ce0f[_0x21bf('0xc')]);OpenchannelInteractionEvents[_0x21bf('0xd')](_0x37326c+':'+_0x1f3b67['id'],_0x1f3b67);OpenchannelInteractionEvents['emit'](_0x37326c,_0x1f3b67);_0x3bb8c8(null);})[_0x21bf('0xe')](_0x3bb8c8(null));};}for(var e in events){if(events[_0x21bf('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x21bf('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index f3d8372..8f04d6c 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 _0x3987=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x2c20b0,_0x342f02){var _0x3444a6=function(_0x5de9ed){while(--_0x5de9ed){_0x2c20b0['push'](_0x2c20b0['shift']());}};_0x3444a6(++_0x342f02);}(_0x3987,0x12f));var _0x7398=function(_0x46aede,_0x29328f){_0x46aede=_0x46aede-0x0;var _0x263ff2=_0x3987[_0x46aede];return _0x263ff2;};'use strict';var _=require(_0x7398('0x0'));var util=require(_0x7398('0x1'));var logger=require('../../config/logger')(_0x7398('0x2'));var moment=require(_0x7398('0x3'));var BPromise=require(_0x7398('0x4'));var rp=require(_0x7398('0x5'));var fs=require('fs');var path=require(_0x7398('0x6'));var rimraf=require(_0x7398('0x7'));var config=require(_0x7398('0x8'));var attributes=require(_0x7398('0x9'));module[_0x7398('0xa')]=function(_0x203e5f,_0x1555d6){return _0x203e5f[_0x7398('0xb')](_0x7398('0xc'),attributes,{'tableName':_0x7398('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7398('0xe'),'hooks':{'beforeUpdate':function(_0x34863d,_0x443bca,_0x7d0515){if(_0x34863d[_0x7398('0xf')]('closed')){_0x34863d['closedAt']=moment()['format'](_0x7398('0x10'));}_0x7d0515(null,_0x34863d);}}});}; \ No newline at end of file +var _0xabce=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xabce,0x103));var _0xeabc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xabce[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeabc('0xa'),'collate':_0xeabc('0xb'),'hooks':{'beforeUpdate':function(_0x5d59d5,_0x438ccf,_0x341f16){if(_0x5d59d5[_0xeabc('0xc')](_0xeabc('0xd'))){_0x5d59d5[_0xeabc('0xe')]=moment()[_0xeabc('0xf')](_0xeabc('0x10'));}_0x341f16(null,_0x5d59d5);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 60414d3..be83264 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 _0x4c7a=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','then'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4c7a,0xdb));var _0xa4c7=function(_0x24c5fb,_0x571177){_0x24c5fb=_0x24c5fb-0x0;var _0x51b309=_0x4c7a[_0x24c5fb];return _0x51b309;};'use strict';var _=require(_0xa4c7('0x0'));var util=require(_0xa4c7('0x1'));var moment=require(_0xa4c7('0x2'));var BPromise=require(_0xa4c7('0x3'));var rs=require(_0xa4c7('0x4'));var fs=require('fs');var Redis=require(_0xa4c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4c7('0x6'));var logger=require(_0xa4c7('0x7'))(_0xa4c7('0x8'));var config=require(_0xa4c7('0x9'));var jayson=require(_0xa4c7('0xa'));var client=jayson[_0xa4c7('0xb')][_0xa4c7('0xc')]({'port':0x232a});config[_0xa4c7('0xd')]=_['defaults'](config[_0xa4c7('0xd')],{'host':_0xa4c7('0xe'),'port':0x18eb});var socket=require(_0xa4c7('0xf'))(new Redis(config['redis']));require(_0xa4c7('0x10'))[_0xa4c7('0x11')](socket);function respondWithRpcPromise(_0x44f7d8,_0x2c445c,_0x123e41){return new BPromise(function(_0x1ecf12,_0x16a92b){return client['request'](_0x44f7d8,_0x123e41)['then'](function(_0x17c3d9){logger[_0xa4c7('0x12')](_0xa4c7('0x13'),_0x2c445c,_0xa4c7('0x14'));logger[_0xa4c7('0x15')](_0xa4c7('0x16'),_0x2c445c,_0xa4c7('0x14'),JSON[_0xa4c7('0x17')](_0x17c3d9));if(_0x17c3d9[_0xa4c7('0x18')]){if(_0x17c3d9[_0xa4c7('0x18')][_0xa4c7('0x19')]===0x1f4){logger[_0xa4c7('0x18')](_0xa4c7('0x13'),_0x2c445c,_0x17c3d9['error'][_0xa4c7('0x1a')]);return _0x16a92b(_0x17c3d9[_0xa4c7('0x18')][_0xa4c7('0x1a')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2c445c,_0x17c3d9['error'][_0xa4c7('0x1a')]);return _0x1ecf12(_0x17c3d9[_0xa4c7('0x18')][_0xa4c7('0x1a')]);}else{logger[_0xa4c7('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2c445c,_0xa4c7('0x14'));_0x1ecf12(_0x17c3d9[_0xa4c7('0x1b')][_0xa4c7('0x1a')]);}})['catch'](function(_0x3c333a){logger[_0xa4c7('0x18')](_0xa4c7('0x13'),_0x2c445c,_0x3c333a);_0x16a92b(_0x3c333a);});});}exports[_0xa4c7('0x1c')]=function(_0x37db80){var _0x46325b=this;return new Promise(function(_0x331d3a,_0x39a2e9){return db['OpenchannelInteraction'][_0xa4c7('0x1d')](_0x37db80[_0xa4c7('0x1e')],{'raw':_0x37db80[_0xa4c7('0x1f')]?_0x37db80[_0xa4c7('0x1f')][_0xa4c7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37db80['options']?_0x37db80[_0xa4c7('0x1f')][_0xa4c7('0x21')]||null:null,'attributes':_0x37db80[_0xa4c7('0x1f')]?_0x37db80['options'][_0xa4c7('0x22')]||null:null,'limit':_0x37db80[_0xa4c7('0x1f')]?_0x37db80[_0xa4c7('0x1f')]['limit']||null:null})['then'](function(_0x47deb0){logger[_0xa4c7('0x12')](_0xa4c7('0x1c'),_0x37db80);logger[_0xa4c7('0x15')](_0xa4c7('0x1c'),_0x37db80,JSON[_0xa4c7('0x17')](_0x47deb0));_0x331d3a(_0x47deb0);})[_0xa4c7('0x23')](function(_0x2d435e){logger['error']('UpdateOpenchannelInteraction',_0x2d435e[_0xa4c7('0x1a')],_0x37db80);_0x39a2e9(_0x46325b[_0xa4c7('0x18')](0x1f4,_0x2d435e[_0xa4c7('0x1a')]));});});};exports[_0xa4c7('0x24')]=function(_0x666191){return new Promise(function(_0x389ce7,_0x1ecc5a){return db[_0xa4c7('0x25')]['find']({'where':_0x666191[_0xa4c7('0x1f')]?_0x666191[_0xa4c7('0x1f')][_0xa4c7('0x21')]||null:null})[_0xa4c7('0x26')](function(_0x10ea8e){if(_0x10ea8e){return _0x10ea8e['addTags'](_0x666191[_0xa4c7('0x1e')][_0xa4c7('0x27')],_[_0xa4c7('0x28')](_0x666191['body'],['ids','id'])||{});}})[_0xa4c7('0x29')](function(_0x3872ac){logger[_0xa4c7('0x12')](_0xa4c7('0x2a'),_0x666191);logger[_0xa4c7('0x15')](_0xa4c7('0x2a'),_0x666191,JSON[_0xa4c7('0x17')](_0x3872ac));_0x389ce7(_0x3872ac);})[_0xa4c7('0x23')](function(_0x4388f4){logger[_0xa4c7('0x18')]('AddTags',_0x4388f4[_0xa4c7('0x1a')],_0x666191);_0x1ecc5a(_this['error'](0x1f4,_0x4388f4[_0xa4c7('0x1a')]));});});}; \ No newline at end of file +var _0x2567=['request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','OpenchannelInteraction','body','options','raw','attributes','UpdateOpenchannelInteraction','debug','stringify','AddTagsToOpenchannelInteraction','then','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelInteraction.socket','register'];(function(_0x5bc7f2,_0x38afdc){var _0x2b4093=function(_0x47c960){while(--_0x47c960){_0x5bc7f2['push'](_0x5bc7f2['shift']());}};_0x2b4093(++_0x38afdc);}(_0x2567,0x100));var _0x7256=function(_0xfe2c60,_0x1866fd){_0xfe2c60=_0xfe2c60-0x0;var _0x1da88e=_0x2567[_0xfe2c60];return _0x1da88e;};'use strict';var _=require(_0x7256('0x0'));var util=require(_0x7256('0x1'));var moment=require('moment');var BPromise=require(_0x7256('0x2'));var rs=require(_0x7256('0x3'));var fs=require('fs');var Redis=require(_0x7256('0x4'));var db=require(_0x7256('0x5'))['db'];var utils=require(_0x7256('0x6'));var logger=require(_0x7256('0x7'))('rpc');var config=require(_0x7256('0x8'));var jayson=require(_0x7256('0x9'));var client=jayson[_0x7256('0xa')][_0x7256('0xb')]({'port':0x232a});config['redis']=_[_0x7256('0xc')](config[_0x7256('0xd')],{'host':_0x7256('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7256('0xf'))[_0x7256('0x10')](socket);function respondWithRpcPromise(_0x417d04,_0x3a8f42,_0x4cec33){return new BPromise(function(_0x3ece43,_0x3682c1){return client[_0x7256('0x11')](_0x417d04,_0x4cec33)['then'](function(_0x308d22){logger[_0x7256('0x12')](_0x7256('0x13'),_0x3a8f42,_0x7256('0x14'));logger['debug'](_0x7256('0x15'),_0x3a8f42,_0x7256('0x14'),JSON['stringify'](_0x308d22));if(_0x308d22[_0x7256('0x16')]){if(_0x308d22[_0x7256('0x16')]['code']===0x1f4){logger[_0x7256('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a8f42,_0x308d22[_0x7256('0x16')][_0x7256('0x17')]);return _0x3682c1(_0x308d22[_0x7256('0x16')][_0x7256('0x17')]);}logger[_0x7256('0x16')](_0x7256('0x13'),_0x3a8f42,_0x308d22[_0x7256('0x16')][_0x7256('0x17')]);return _0x3ece43(_0x308d22[_0x7256('0x16')][_0x7256('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3a8f42,_0x7256('0x14'));_0x3ece43(_0x308d22[_0x7256('0x18')][_0x7256('0x17')]);}})[_0x7256('0x19')](function(_0x4d4e47){logger[_0x7256('0x16')](_0x7256('0x13'),_0x3a8f42,_0x4d4e47);_0x3682c1(_0x4d4e47);});});}exports['UpdateOpenchannelInteraction']=function(_0xa4abeb){var _0x3cc098=this;return new Promise(function(_0x5c94c5,_0x38c1e8){return db[_0x7256('0x1a')]['update'](_0xa4abeb[_0x7256('0x1b')],{'raw':_0xa4abeb[_0x7256('0x1c')]?_0xa4abeb[_0x7256('0x1c')][_0x7256('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa4abeb[_0x7256('0x1c')]?_0xa4abeb['options']['where']||null:null,'attributes':_0xa4abeb['options']?_0xa4abeb['options'][_0x7256('0x1e')]||null:null,'limit':_0xa4abeb[_0x7256('0x1c')]?_0xa4abeb[_0x7256('0x1c')]['limit']||null:null})['then'](function(_0x397648){logger[_0x7256('0x12')](_0x7256('0x1f'),_0xa4abeb);logger[_0x7256('0x20')](_0x7256('0x1f'),_0xa4abeb,JSON[_0x7256('0x21')](_0x397648));_0x5c94c5(_0x397648);})[_0x7256('0x19')](function(_0x2ecb4f){logger[_0x7256('0x16')](_0x7256('0x1f'),_0x2ecb4f[_0x7256('0x17')],_0xa4abeb);_0x38c1e8(_0x3cc098[_0x7256('0x16')](0x1f4,_0x2ecb4f[_0x7256('0x17')]));});});};exports[_0x7256('0x22')]=function(_0x2e33e6){return new Promise(function(_0x54f094,_0x501a9b){return db[_0x7256('0x1a')]['find']({'where':_0x2e33e6[_0x7256('0x1c')]?_0x2e33e6[_0x7256('0x1c')]['where']||null:null})[_0x7256('0x23')](function(_0x152cb7){if(_0x152cb7){return _0x152cb7[_0x7256('0x24')](_0x2e33e6[_0x7256('0x1b')][_0x7256('0x25')],_['omit'](_0x2e33e6['body'],[_0x7256('0x25'),'id'])||{});}})['spread'](function(_0x5db26f){logger[_0x7256('0x12')](_0x7256('0x26'),_0x2e33e6);logger[_0x7256('0x20')](_0x7256('0x26'),_0x2e33e6,JSON['stringify'](_0x5db26f));_0x54f094(_0x5db26f);})[_0x7256('0x19')](function(_0x26917c){logger[_0x7256('0x16')](_0x7256('0x26'),_0x26917c[_0x7256('0x17')],_0x2e33e6);_0x501a9b(_this[_0x7256('0x16')](0x1f4,_0x26917c[_0x7256('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 36803d0..ea059c6 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 _0x9fed=['emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','update'];(function(_0x153ede,_0x47af6b){var _0x2d1ed4=function(_0x185255){while(--_0x185255){_0x153ede['push'](_0x153ede['shift']());}};_0x2d1ed4(++_0x47af6b);}(_0x9fed,0x169));var _0xd9fe=function(_0x21da60,_0x2b9478){_0x21da60=_0x21da60-0x0;var _0x12764b=_0x9fed[_0x21da60];return _0x12764b;};'use strict';var OpenchannelInteractionEvents=require(_0xd9fe('0x0'));var events=[_0xd9fe('0x1'),'remove',_0xd9fe('0x2')];function createListener(_0x4cd137,_0x28064c){return function(_0x44f8ee){_0x28064c[_0xd9fe('0x3')](_0x4cd137,_0x44f8ee);};}function removeListener(_0x15c2f9,_0x2e912f){return function(){OpenchannelInteractionEvents[_0xd9fe('0x4')](_0x15c2f9,_0x2e912f);};}exports[_0xd9fe('0x5')]=function(_0x8a71f2){for(var _0x2fbd8a=0x0,_0x552dd8=events['length'];_0x2fbd8a<_0x552dd8;_0x2fbd8a++){var _0x362bac=events[_0x2fbd8a];var _0x3b1c27=createListener(_0xd9fe('0x6')+_0x362bac,_0x8a71f2);OpenchannelInteractionEvents['on'](_0x362bac,_0x3b1c27);}}; \ No newline at end of file +var _0xa4a0=['./openchannelInteraction.events','save','remove','update','emit','length','openchannelInteraction:'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa4a0,0x70));var _0x0a4a=function(_0x3f17aa,_0x244c75){_0x3f17aa=_0x3f17aa-0x0;var _0x1a6647=_0xa4a0[_0x3f17aa];return _0x1a6647;};'use strict';var OpenchannelInteractionEvents=require(_0x0a4a('0x0'));var events=[_0x0a4a('0x1'),_0x0a4a('0x2'),_0x0a4a('0x3')];function createListener(_0x46e827,_0x386764){return function(_0x53c814){_0x386764[_0x0a4a('0x4')](_0x46e827,_0x53c814);};}function removeListener(_0x120de5,_0x23137e){return function(){OpenchannelInteractionEvents['removeListener'](_0x120de5,_0x23137e);};}exports['register']=function(_0x17de15){for(var _0x183663=0x0,_0x277dae=events[_0x0a4a('0x5')];_0x183663<_0x277dae;_0x183663++){var _0x7e1c7a=events[_0x183663];var _0x2df998=createListener(_0x0a4a('0x6')+_0x7e1c7a,_0x17de15);OpenchannelInteractionEvents['on'](_0x7e1c7a,_0x2df998);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 91a86ae..3b05859 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x3251ec,_0x625d48){var _0x473f96=function(_0x55c32d){while(--_0x55c32d){_0x3251ec['push'](_0x3251ec['shift']());}};_0x473f96(++_0x625d48);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index f692836..3d24fd1 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 _0x97e6=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x219914,_0x2c7c53){var _0x5d49f5=function(_0x245aa8){while(--_0x245aa8){_0x219914['push'](_0x219914['shift']());}};_0x5d49f5(++_0x2c7c53);}(_0x97e6,0x159));var _0x697e=function(_0x3993f0,_0x40c90e){_0x3993f0=_0x3993f0-0x0;var _0x4545d9=_0x97e6[_0x3993f0];return _0x4545d9;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'body':{'type':Sequelize[_0x697e('0x1')](_0x697e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x697e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x697e('0x4')]('in',_0x697e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x697e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x697e('0x1')]}}; \ No newline at end of file +var _0x20df=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x20df,0x7c));var _0xf20d=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x20df[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require(_0xf20d('0x0'));module[_0xf20d('0x1')]={'body':{'type':Sequelize[_0xf20d('0x2')](_0xf20d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf20d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf20d('0x5')]('in',_0xf20d('0x6')),'defaultValue':_0xf20d('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf20d('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf20d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c1700f5..7bc7eb6 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 _0xdc1e=['path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','end','offset','limit','undefined','count','status','json','reject','save','update','destroy','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','OpenchannelMessage','include','findAll','show','params','rawAttributes','includeAll','create','body','catch','find','describe','accept','openchannel','readAt','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','../../config/logger','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','SIP/%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc1e,0x1f4));var _0xedc1=function(_0x5ec1be,_0x32ef2d){_0x5ec1be=_0x5ec1be-0x0;var _0x45072b=_0xdc1e[_0x5ec1be];return _0x45072b;};'use strict';var emlformat=require(_0xedc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedc1('0x1'));var jsonpatch=require(_0xedc1('0x2'));var rp=require(_0xedc1('0x3'));var moment=require(_0xedc1('0x4'));var BPromise=require(_0xedc1('0x5'));var Mustache=require(_0xedc1('0x6'));var util=require(_0xedc1('0x7'));var path=require(_0xedc1('0x8'));var sox=require('sox');var csv=require(_0xedc1('0x9'));var ejs=require(_0xedc1('0xa'));var fs=require('fs');var fs_extra=require(_0xedc1('0xb'));var _=require(_0xedc1('0xc'));var squel=require('squel');var crypto=require(_0xedc1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xedc1('0x9'));var querystring=require(_0xedc1('0xe'));var Papa=require(_0xedc1('0xf'));var Redis=require(_0xedc1('0x10'));var authService=require(_0xedc1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xedc1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedc1('0x13'));var utils=require(_0xedc1('0x14'));var config=require(_0xedc1('0x15'));var licenseUtil=require(_0xedc1('0x16'));var db=require(_0xedc1('0x17'))['db'];config[_0xedc1('0x18')]=_[_0xedc1('0x19')](config[_0xedc1('0x18')],{'host':_0xedc1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedc1('0x18')]));require(_0xedc1('0x1b'))[_0xedc1('0x1c')](socket);var jayson=require(_0xedc1('0x1d'));var client=jayson[_0xedc1('0x1e')][_0xedc1('0x1f')]({'port':0x232c});var client9002=jayson[_0xedc1('0x1e')][_0xedc1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1421dc,_0x5ae05b,_0x478fde,_0x1f300e){return new BPromise(function(_0x3c2150,_0x4b48b5){var _0xf5c2f1=_0x1f300e||client;return _0xf5c2f1[_0xedc1('0x20')](_0x1421dc,_0x478fde)[_0xedc1('0x21')](function(_0x2422ab){logger[_0xedc1('0x22')](_0xedc1('0x23'),_0x5ae05b,'request\x20sent');logger[_0xedc1('0x24')](_0xedc1('0x25'),_0x5ae05b,_0xedc1('0x26'),JSON[_0xedc1('0x27')](_0x2422ab));if(_0x2422ab[_0xedc1('0x28')]){if(_0x2422ab[_0xedc1('0x28')][_0xedc1('0x29')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x5ae05b,_0x2422ab['error'][_0xedc1('0x2a')]);return _0x4b48b5(_0x2422ab[_0xedc1('0x28')][_0xedc1('0x2a')]);}logger['error'](_0xedc1('0x23'),_0x5ae05b,_0x2422ab['error']['message']);return _0x3c2150(_0x2422ab[_0xedc1('0x28')][_0xedc1('0x2a')]);}else{logger[_0xedc1('0x22')](_0xedc1('0x23'),_0x5ae05b,_0xedc1('0x26'));_0x3c2150(_0x2422ab['result'][_0xedc1('0x2a')]);}})['catch'](function(_0x569c31){logger[_0xedc1('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x5ae05b,_0x569c31);_0x4b48b5(_0x569c31);});});}function respondWithStatusCode(_0x45c47f,_0x502391){_0x502391=_0x502391||0xcc;return function(_0x5852b6){if(_0x5852b6){return _0x45c47f[_0xedc1('0x2b')](_0x502391);}return _0x45c47f['status'](_0x502391)[_0xedc1('0x2c')]();};}function respondWithResult(_0x480ff0,_0x5c1c90){_0x5c1c90=_0x5c1c90||0xc8;return function(_0x1c9fad){if(_0x1c9fad){return _0x480ff0['status'](_0x5c1c90)['json'](_0x1c9fad);}};}function respondWithFilteredResult(_0xd6a604,_0x39c149){return function(_0x3c3289){if(_0x3c3289){var _0x360081=typeof _0x39c149[_0xedc1('0x2d')]==='undefined'&&typeof _0x39c149[_0xedc1('0x2e')]===_0xedc1('0x2f');var _0x43eee4=_0x3c3289[_0xedc1('0x30')];var _0x29d9eb=_0x360081?0x0:_0x39c149[_0xedc1('0x2d')];var _0x2b9a99=_0x360081?_0x3c3289['count']:_0x39c149['offset']+_0x39c149['limit'];var _0x9bd6d3;if(_0x2b9a99>=_0x43eee4){_0x2b9a99=_0x43eee4;_0x9bd6d3=0xc8;}else{_0x9bd6d3=0xce;}_0xd6a604[_0xedc1('0x31')](_0x9bd6d3);return _0xd6a604['set']('Content-Range',_0x29d9eb+'-'+_0x2b9a99+'/'+_0x43eee4)[_0xedc1('0x32')](_0x3c3289);}return null;};}function patchUpdates(_0x5ce45d){return function(_0x89f9){try{jsonpatch['apply'](_0x89f9,_0x5ce45d,!![]);}catch(_0x40aebd){return BPromise[_0xedc1('0x33')](_0x40aebd);}return _0x89f9[_0xedc1('0x34')]();};}function saveUpdates(_0x4c2d08,_0x149aca){return function(_0x1b6472){if(_0x1b6472){return _0x1b6472[_0xedc1('0x35')](_0x4c2d08)['then'](function(_0x23da92){return _0x23da92;});}return null;};}function removeEntity(_0x9313ed,_0x2ee094){return function(_0x3711c8){if(_0x3711c8){return _0x3711c8[_0xedc1('0x36')]()[_0xedc1('0x21')](function(){_0x9313ed[_0xedc1('0x31')](0xcc)[_0xedc1('0x2c')]();});}};}function handleEntityNotFound(_0x587ac6,_0x1c0d8c){return function(_0x559ddf){if(!_0x559ddf){_0x587ac6['sendStatus'](0x194);}return _0x559ddf;};}function handleError(_0x4a757d,_0x4738af){_0x4738af=_0x4738af||0x1f4;return function(_0x1a4a22){logger[_0xedc1('0x28')](_0x1a4a22[_0xedc1('0x37')]);if(_0x1a4a22[_0xedc1('0x38')]){delete _0x1a4a22[_0xedc1('0x38')];}_0x4a757d['status'](_0x4738af)[_0xedc1('0x39')](_0x1a4a22);};}exports[_0xedc1('0x3a')]=function(_0xa029ad,_0x2e28dc){var _0x30e185={},_0x24c6b1={},_0x553086={'count':0x0,'rows':[]};var _0x1a701c=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x1c0a9e){return{'name':_0x1c0a9e['fieldName'],'type':_0x1c0a9e[_0xedc1('0x3b')][_0xedc1('0x3c')]};});_0x24c6b1[_0xedc1('0x3d')]=_[_0xedc1('0x3e')](_0x1a701c,_0xedc1('0x38'));_0x24c6b1[_0xedc1('0x3f')]=_[_0xedc1('0x40')](_0xa029ad[_0xedc1('0x3f')]);_0x24c6b1[_0xedc1('0x41')]=_[_0xedc1('0x42')](_0x24c6b1[_0xedc1('0x3d')],_0x24c6b1[_0xedc1('0x3f')]);_0x30e185[_0xedc1('0x43')]=_[_0xedc1('0x42')](_0x24c6b1[_0xedc1('0x3d')],qs[_0xedc1('0x44')](_0xa029ad[_0xedc1('0x3f')][_0xedc1('0x44')]));_0x30e185[_0xedc1('0x43')]=_0x30e185[_0xedc1('0x43')][_0xedc1('0x45')]?_0x30e185[_0xedc1('0x43')]:_0x24c6b1[_0xedc1('0x3d')];if(!_0xa029ad['query'][_0xedc1('0x46')](_0xedc1('0x47'))){_0x30e185[_0xedc1('0x2e')]=qs['limit'](_0xa029ad[_0xedc1('0x3f')][_0xedc1('0x2e')]);_0x30e185[_0xedc1('0x2d')]=qs[_0xedc1('0x2d')](_0xa029ad['query'][_0xedc1('0x2d')]);}_0x30e185['order']=qs[_0xedc1('0x48')](_0xa029ad['query'][_0xedc1('0x48')]);_0x30e185[_0xedc1('0x49')]=qs[_0xedc1('0x41')](_['pick'](_0xa029ad['query'],_0x24c6b1[_0xedc1('0x41')]),_0x1a701c);if(_0xa029ad[_0xedc1('0x3f')]['filter']){_0x30e185[_0xedc1('0x49')]=_[_0xedc1('0x4a')](_0x30e185[_0xedc1('0x49')],{'$or':_[_0xedc1('0x3e')](_0x1a701c,function(_0x397e61){if(_0x397e61[_0xedc1('0x3b')]!==_0xedc1('0x4b')){var _0x55043b={};_0x55043b[_0x397e61[_0xedc1('0x38')]]={'$like':'%'+_0xa029ad[_0xedc1('0x3f')]['filter']+'%'};return _0x55043b;}})});}_0x30e185=_[_0xedc1('0x4a')]({},_0x30e185,_0xa029ad[_0xedc1('0x4c')]);var _0x2592b1={'where':_0x30e185[_0xedc1('0x49')]};return db[_0xedc1('0x4d')][_0xedc1('0x30')](_0x2592b1)[_0xedc1('0x21')](function(_0x584d74){_0x553086[_0xedc1('0x30')]=_0x584d74;if(_0xa029ad[_0xedc1('0x3f')]['includeAll']){_0x30e185[_0xedc1('0x4e')]=[{'all':!![]}];}return db[_0xedc1('0x4d')][_0xedc1('0x4f')](_0x30e185);})[_0xedc1('0x21')](function(_0x17a15c){_0x553086['rows']=_0x17a15c;return _0x553086;})[_0xedc1('0x21')](respondWithFilteredResult(_0x2e28dc,_0x30e185))['catch'](handleError(_0x2e28dc,null));};exports[_0xedc1('0x50')]=function(_0x456651,_0x1daec8){var _0x7e29d7={'raw':!![],'where':{'id':_0x456651[_0xedc1('0x51')]['id']}},_0x1178f9={};_0x1178f9[_0xedc1('0x3d')]=_[_0xedc1('0x40')](db[_0xedc1('0x4d')][_0xedc1('0x52')]);_0x1178f9[_0xedc1('0x3f')]=_['keys'](_0x456651['query']);_0x1178f9[_0xedc1('0x41')]=_[_0xedc1('0x42')](_0x1178f9[_0xedc1('0x3d')],_0x1178f9[_0xedc1('0x3f')]);_0x7e29d7[_0xedc1('0x43')]=_['intersection'](_0x1178f9[_0xedc1('0x3d')],qs[_0xedc1('0x44')](_0x456651[_0xedc1('0x3f')]['fields']));_0x7e29d7[_0xedc1('0x43')]=_0x7e29d7[_0xedc1('0x43')][_0xedc1('0x45')]?_0x7e29d7[_0xedc1('0x43')]:_0x1178f9[_0xedc1('0x3d')];if(_0x456651['query'][_0xedc1('0x53')]){_0x7e29d7[_0xedc1('0x4e')]=[{'all':!![]}];}_0x7e29d7=_['merge']({},_0x7e29d7,_0x456651[_0xedc1('0x4c')]);return db[_0xedc1('0x4d')]['find'](_0x7e29d7)[_0xedc1('0x21')](handleEntityNotFound(_0x1daec8,null))[_0xedc1('0x21')](respondWithResult(_0x1daec8,null))['catch'](handleError(_0x1daec8,null));};exports['create']=function(_0x1ca5d6,_0x3a0d84){return db[_0xedc1('0x4d')][_0xedc1('0x54')](_0x1ca5d6[_0xedc1('0x55')],{})['then'](respondWithResult(_0x3a0d84,0xc9))[_0xedc1('0x56')](handleError(_0x3a0d84,null));};exports[_0xedc1('0x35')]=function(_0x5e1322,_0x56f5dd){if(_0x5e1322[_0xedc1('0x55')]['id']){delete _0x5e1322[_0xedc1('0x55')]['id'];}return db[_0xedc1('0x4d')][_0xedc1('0x57')]({'where':{'id':_0x5e1322[_0xedc1('0x51')]['id']}})[_0xedc1('0x21')](handleEntityNotFound(_0x56f5dd,null))[_0xedc1('0x21')](saveUpdates(_0x5e1322['body'],null))['then'](respondWithResult(_0x56f5dd,null))[_0xedc1('0x56')](handleError(_0x56f5dd,null));};exports[_0xedc1('0x36')]=function(_0x112587,_0x40d849){return db[_0xedc1('0x4d')][_0xedc1('0x57')]({'where':{'id':_0x112587[_0xedc1('0x51')]['id']}})['then'](handleEntityNotFound(_0x40d849,null))['then'](removeEntity(_0x40d849,null))[_0xedc1('0x56')](handleError(_0x40d849,null));};exports[_0xedc1('0x58')]=function(_0x360fac,_0x345be4){return db[_0xedc1('0x4d')][_0xedc1('0x58')]()[_0xedc1('0x21')](respondWithResult(_0x345be4,null))[_0xedc1('0x56')](handleError(_0x345be4,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xedc1('0x59')]=function(_0xd7b183,_0x2c79ac,_0x4c7658){var _0x44822f={'agent':{},'channel':_0xedc1('0x5a')};if(_0xd7b183[_0xedc1('0x55')]['id']){delete _0xd7b183[_0xedc1('0x55')]['id'];}_0xd7b183['body']['read']=!![];_0xd7b183[_0xedc1('0x55')][_0xedc1('0x5b')]=moment()[_0xedc1('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0xd7b183[_0xedc1('0x55')][_0xedc1('0x5d')]=_0xd7b183[_0xedc1('0x55')][_0xedc1('0x5d')]||_0xd7b183[_0xedc1('0x5e')]['id'];_0x44822f['agent']['id']=_0xd7b183['body'][_0xedc1('0x5d')];return db['OpenchannelMessage'][_0xedc1('0x57')]({'where':{'id':_0xd7b183['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c79ac,null))[_0xedc1('0x21')](saveUpdates(_0xd7b183[_0xedc1('0x55')],null))[_0xedc1('0x21')](function(_0x1334e3){if(_0x1334e3){_0x44822f[_0xedc1('0x2a')]=_0x1334e3[_0xedc1('0x5f')]({'plain':!![]});return db[_0xedc1('0x60')][_0xedc1('0x57')]({'where':{'id':_0x1334e3[_0xedc1('0x61')]}});}return null;})[_0xedc1('0x21')](handleEntityNotFound(_0x2c79ac,null))[_0xedc1('0x21')](function(_0x36ab16){if(_0x36ab16){return _0x36ab16['update']({'UserId':_0xd7b183['body'][_0xedc1('0x5d')],'read1stAt':_['isNil'](_0x36ab16['read1stAt'])?moment()[_0xedc1('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xedc1('0x21')](function(_0x273de4){if(_0x273de4){_0x44822f[_0xedc1('0x62')]=_0x273de4[_0xedc1('0x5f')]({'plain':!![]});interaction_log['info'](_0xedc1('0x63'),_0xd7b183['user']['id'],_0xd7b183['user'][_0xedc1('0x38')],_0xd7b183[_0xedc1('0x5e')][_0xedc1('0x64')],_0x44822f[_0xedc1('0x62')]['id'],_0xd7b183['body']?JSON[_0xedc1('0x27')](_0xd7b183['body']):_0xedc1('0x65'));return respondWithRpcPromise(_0xedc1('0x66'),_0xedc1('0x67'),_0x44822f);}return null;})[_0xedc1('0x21')](function(_0x5cff9e){var _0x98f9e3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5cff9e['message'][_0xedc1('0x68')];return db[_0xedc1('0x69')][_0xedc1('0x3f')](_0x98f9e3,{'type':db[_0xedc1('0x6a')][_0xedc1('0x6b')][_0xedc1('0x6c')],'raw':!![]})[_0xedc1('0x21')](function(_0x308a31){return _0x308a31;});})[_0xedc1('0x21')](function(_0x329164){if(_0x329164){_0x44822f[_0xedc1('0x2a')]['contact']=_0x329164[0x0];if(!_0xd7b183[_0xedc1('0x55')]['UserId'])return;return db[_0xedc1('0x6d')][_0xedc1('0x57')]({'where':{'id':_0xd7b183[_0xedc1('0x55')][_0xedc1('0x5d')],'role':_0xedc1('0x6e')},'attributes':['id',_0xedc1('0x38'),_0xedc1('0x6f'),_0xedc1('0x70'),_0xedc1('0x71')],'raw':!![]});}return null;})[_0xedc1('0x21')](function(_0x478b05){if(!_0x478b05)return null;_0x44822f[_0xedc1('0x2a')]['agent']=_0x478b05;return _0x44822f;})[_0xedc1('0x21')](function(_0x2d3f0f){if(_0x2d3f0f){if(_0xd7b183[_0xedc1('0x55')][_0xedc1('0x72')]){_0x44822f[_0xedc1('0x2a')][_0xedc1('0x73')]=util[_0xedc1('0x5c')]('SIP/%s',_0xd7b183[_0xedc1('0x5e')][_0xedc1('0x38')]);_0x44822f[_0xedc1('0x2a')][_0xedc1('0x74')]=_0x44822f['channel'];_0x44822f[_0xedc1('0x2a')][_0xedc1('0x75')]=_0x44822f[_0xedc1('0x74')];_0x44822f[_0xedc1('0x2a')][_0xedc1('0x76')]=_0xedc1('0x59');return respondWithRpcPromise(_0xedc1('0x77'),'EventManager',{'event':'acceptmessage','message':_0x44822f[_0xedc1('0x2a')]},client9002)[_0xedc1('0x21')](function(){return _0x44822f;});}return _0x44822f;}return null;})['then'](respondWithResult(_0x2c79ac,null))[_0xedc1('0x56')](handleError(_0x2c79ac,null));};var interaction_log=require(_0xedc1('0x78'))(_0xedc1('0x79'));exports['reject']=function(_0x21e49d,_0x4405ee,_0x12b0d8){var _0x181f03={'agent':{},'channel':_0xedc1('0x5a')};if(_0x21e49d[_0xedc1('0x55')]['id']){delete _0x21e49d['body']['id'];}_0x21e49d[_0xedc1('0x55')][_0xedc1('0x5d')]=_0x21e49d[_0xedc1('0x55')]['UserId']||_0x21e49d[_0xedc1('0x5e')]['id'];_0x181f03[_0xedc1('0x6e')]['id']=_0x21e49d['body'][_0xedc1('0x5d')];return db[_0xedc1('0x4d')][_0xedc1('0x57')]({'where':{'id':_0x21e49d[_0xedc1('0x51')]['id'],'UserId':null}})[_0xedc1('0x21')](handleEntityNotFound(_0x4405ee,null))[_0xedc1('0x21')](function(_0x106caa){if(_0x106caa){_0x181f03[_0xedc1('0x2a')]=_0x106caa[_0xedc1('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0xedc1('0x57')]({'where':{'id':_0x106caa['OpenchannelInteractionId']}});}return null;})[_0xedc1('0x21')](handleEntityNotFound(_0x4405ee,null))[_0xedc1('0x21')](function(_0x56c211){if(_0x56c211){_0x181f03[_0xedc1('0x62')]=_0x56c211['get']({'plain':!![]});interaction_log[_0xedc1('0x22')](_0xedc1('0x7a'),_0x21e49d['user']['id'],_0x21e49d['user'][_0xedc1('0x38')],_0x21e49d[_0xedc1('0x5e')][_0xedc1('0x64')],_0x181f03[_0xedc1('0x62')]['id'],_0x21e49d['body']?JSON[_0xedc1('0x27')](_0x21e49d['body']):_0xedc1('0x65'));return respondWithRpcPromise('RejectMessage',_0xedc1('0x7b'),_0x181f03);}return null;})['then'](function(_0x4db520){var _0x4062a1=_0xedc1('0x7c')+_0x4db520[_0xedc1('0x2a')][_0xedc1('0x68')];return db['sequelize'][_0xedc1('0x3f')](_0x4062a1,{'type':db[_0xedc1('0x6a')]['QueryTypes'][_0xedc1('0x6c')],'raw':!![]})[_0xedc1('0x21')](function(_0x2802c9){return _0x2802c9;});})[_0xedc1('0x21')](function(_0x2d5d1c){if(_0x2d5d1c){_0x181f03[_0xedc1('0x2a')][_0xedc1('0x7d')]=_0x2d5d1c[0x0];if(!_0x21e49d['body'][_0xedc1('0x5d')])return;return db['User'][_0xedc1('0x57')]({'where':{'id':_0x21e49d[_0xedc1('0x55')]['UserId'],'role':'agent'},'attributes':['id','name',_0xedc1('0x6f'),_0xedc1('0x70'),_0xedc1('0x71')],'raw':!![]});}return null;})['then'](function(_0xb14ebb){if(!_0xb14ebb)return null;_0x181f03[_0xedc1('0x2a')]['agent']=_0xb14ebb;return _0x181f03;})['then'](function(_0x9be912){if(_0x9be912){_0x9be912[_0xedc1('0x2a')]['interface']=util[_0xedc1('0x5c')](_0xedc1('0x7e'),_0x21e49d['user'][_0xedc1('0x38')]);_0x9be912['message']['channel']=_0x181f03[_0xedc1('0x74')];_0x9be912[_0xedc1('0x2a')]['motionChannel']=_0x181f03[_0xedc1('0x74')];_0x9be912['message'][_0xedc1('0x76')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x9be912[_0xedc1('0x2a')]},client9002);return _0x181f03;}return null;})[_0xedc1('0x21')](respondWithResult(_0x4405ee,null))['catch'](handleError(_0x4405ee,null));}; \ No newline at end of file +var _0xc7c6=['map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','create','body','find','params','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','User','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','RejectMessage','rejectMessage','sequelize','QueryTypes','SELECT','fullname','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','http','client','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','send','index'];(function(_0x43382b,_0x48f8b6){var _0x4f3855=function(_0x45b261){while(--_0x45b261){_0x43382b['push'](_0x43382b['shift']());}};_0x4f3855(++_0x48f8b6);}(_0xc7c6,0xc9));var _0x6c7c=function(_0x5f04aa,_0x361743){_0x5f04aa=_0x5f04aa-0x0;var _0x52f916=_0xc7c6[_0x5f04aa];return _0x52f916;};'use strict';var emlformat=require(_0x6c7c('0x0'));var rimraf=require(_0x6c7c('0x1'));var zipdir=require(_0x6c7c('0x2'));var jsonpatch=require(_0x6c7c('0x3'));var rp=require(_0x6c7c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6c7c('0x5'));var util=require(_0x6c7c('0x6'));var path=require(_0x6c7c('0x7'));var sox=require('sox');var csv=require(_0x6c7c('0x8'));var ejs=require(_0x6c7c('0x9'));var fs=require('fs');var fs_extra=require(_0x6c7c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c7c('0xb'));var deskjs=require(_0x6c7c('0xc'));var toCsv=require(_0x6c7c('0x8'));var querystring=require('querystring');var Papa=require(_0x6c7c('0xd'));var Redis=require(_0x6c7c('0xe'));var authService=require(_0x6c7c('0xf'));var qs=require(_0x6c7c('0x10'));var as=require(_0x6c7c('0x11'));var hardwareService=require(_0x6c7c('0x12'));var logger=require(_0x6c7c('0x13'))(_0x6c7c('0x14'));var utils=require(_0x6c7c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6c7c('0x16'));var db=require(_0x6c7c('0x17'))['db'];config['redis']=_[_0x6c7c('0x18')](config['redis'],{'host':_0x6c7c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6c7c('0x1a')]({'port':0x232c});var client9002=jayson[_0x6c7c('0x1b')][_0x6c7c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x19b350,_0x23f911,_0x240675,_0x3ad92c){return new BPromise(function(_0x5652f1,_0x287c46){var _0x2a33dd=_0x3ad92c||client;return _0x2a33dd['request'](_0x19b350,_0x240675)['then'](function(_0x28e383){logger[_0x6c7c('0x1c')](_0x6c7c('0x1d'),_0x23f911,_0x6c7c('0x1e'));logger[_0x6c7c('0x1f')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x23f911,'request\x20sent',JSON[_0x6c7c('0x20')](_0x28e383));if(_0x28e383['error']){if(_0x28e383['error'][_0x6c7c('0x21')]===0x1f4){logger[_0x6c7c('0x22')](_0x6c7c('0x1d'),_0x23f911,_0x28e383['error']['message']);return _0x287c46(_0x28e383[_0x6c7c('0x22')][_0x6c7c('0x23')]);}logger[_0x6c7c('0x22')](_0x6c7c('0x1d'),_0x23f911,_0x28e383[_0x6c7c('0x22')]['message']);return _0x5652f1(_0x28e383[_0x6c7c('0x22')][_0x6c7c('0x23')]);}else{logger[_0x6c7c('0x1c')](_0x6c7c('0x1d'),_0x23f911,'request\x20sent');_0x5652f1(_0x28e383['result'][_0x6c7c('0x23')]);}})['catch'](function(_0x4525e9){logger[_0x6c7c('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x23f911,_0x4525e9);_0x287c46(_0x4525e9);});});}function respondWithStatusCode(_0x3e7d76,_0x18ba5c){_0x18ba5c=_0x18ba5c||0xcc;return function(_0x321567){if(_0x321567){return _0x3e7d76[_0x6c7c('0x24')](_0x18ba5c);}return _0x3e7d76[_0x6c7c('0x25')](_0x18ba5c)['end']();};}function respondWithResult(_0x4cb3d1,_0x2e0dcb){_0x2e0dcb=_0x2e0dcb||0xc8;return function(_0x15751b){if(_0x15751b){return _0x4cb3d1[_0x6c7c('0x25')](_0x2e0dcb)[_0x6c7c('0x26')](_0x15751b);}};}function respondWithFilteredResult(_0x3591e8,_0x5d3815){return function(_0x9a4750){if(_0x9a4750){var _0x363012=typeof _0x5d3815['offset']===_0x6c7c('0x27')&&typeof _0x5d3815[_0x6c7c('0x28')]===_0x6c7c('0x27');var _0x3c09f4=_0x9a4750[_0x6c7c('0x29')];var _0x426c5b=_0x363012?0x0:_0x5d3815[_0x6c7c('0x2a')];var _0x32f0d9=_0x363012?_0x9a4750[_0x6c7c('0x29')]:_0x5d3815[_0x6c7c('0x2a')]+_0x5d3815[_0x6c7c('0x28')];var _0x2a9355;if(_0x32f0d9>=_0x3c09f4){_0x32f0d9=_0x3c09f4;_0x2a9355=0xc8;}else{_0x2a9355=0xce;}_0x3591e8[_0x6c7c('0x25')](_0x2a9355);return _0x3591e8['set'](_0x6c7c('0x2b'),_0x426c5b+'-'+_0x32f0d9+'/'+_0x3c09f4)[_0x6c7c('0x26')](_0x9a4750);}return null;};}function patchUpdates(_0x3f69ed){return function(_0x107edb){try{jsonpatch[_0x6c7c('0x2c')](_0x107edb,_0x3f69ed,!![]);}catch(_0x10f7ee){return BPromise[_0x6c7c('0x2d')](_0x10f7ee);}return _0x107edb['save']();};}function saveUpdates(_0x52cd5b,_0x183430){return function(_0x56733e){if(_0x56733e){return _0x56733e[_0x6c7c('0x2e')](_0x52cd5b)[_0x6c7c('0x2f')](function(_0x213a09){return _0x213a09;});}return null;};}function removeEntity(_0x1ef417,_0x2d87f4){return function(_0x2213a0){if(_0x2213a0){return _0x2213a0[_0x6c7c('0x30')]()[_0x6c7c('0x2f')](function(){_0x1ef417[_0x6c7c('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce5a4,_0x3b3766){return function(_0x271dca){if(!_0x271dca){_0x2ce5a4[_0x6c7c('0x24')](0x194);}return _0x271dca;};}function handleError(_0x398f37,_0x4c3822){_0x4c3822=_0x4c3822||0x1f4;return function(_0x442407){logger[_0x6c7c('0x22')](_0x442407[_0x6c7c('0x31')]);if(_0x442407[_0x6c7c('0x32')]){delete _0x442407[_0x6c7c('0x32')];}_0x398f37[_0x6c7c('0x25')](_0x4c3822)[_0x6c7c('0x33')](_0x442407);};}exports[_0x6c7c('0x34')]=function(_0x1ed9ab,_0x4c737b){var _0x574711={},_0x1bd44e={},_0x1fbc49={'count':0x0,'rows':[]};var _0x56ea2a=_[_0x6c7c('0x35')](db[_0x6c7c('0x36')][_0x6c7c('0x37')],function(_0xc000b8){return{'name':_0xc000b8[_0x6c7c('0x38')],'type':_0xc000b8[_0x6c7c('0x39')][_0x6c7c('0x3a')]};});_0x1bd44e[_0x6c7c('0x3b')]=_[_0x6c7c('0x35')](_0x56ea2a,_0x6c7c('0x32'));_0x1bd44e['query']=_[_0x6c7c('0x3c')](_0x1ed9ab[_0x6c7c('0x3d')]);_0x1bd44e[_0x6c7c('0x3e')]=_[_0x6c7c('0x3f')](_0x1bd44e['model'],_0x1bd44e['query']);_0x574711[_0x6c7c('0x40')]=_[_0x6c7c('0x3f')](_0x1bd44e[_0x6c7c('0x3b')],qs['fields'](_0x1ed9ab[_0x6c7c('0x3d')][_0x6c7c('0x41')]));_0x574711['attributes']=_0x574711[_0x6c7c('0x40')][_0x6c7c('0x42')]?_0x574711[_0x6c7c('0x40')]:_0x1bd44e['model'];if(!_0x1ed9ab['query'][_0x6c7c('0x43')](_0x6c7c('0x44'))){_0x574711[_0x6c7c('0x28')]=qs[_0x6c7c('0x28')](_0x1ed9ab[_0x6c7c('0x3d')]['limit']);_0x574711[_0x6c7c('0x2a')]=qs[_0x6c7c('0x2a')](_0x1ed9ab[_0x6c7c('0x3d')][_0x6c7c('0x2a')]);}_0x574711[_0x6c7c('0x45')]=qs[_0x6c7c('0x46')](_0x1ed9ab[_0x6c7c('0x3d')][_0x6c7c('0x46')]);_0x574711[_0x6c7c('0x47')]=qs[_0x6c7c('0x3e')](_[_0x6c7c('0x48')](_0x1ed9ab[_0x6c7c('0x3d')],_0x1bd44e[_0x6c7c('0x3e')]),_0x56ea2a);if(_0x1ed9ab[_0x6c7c('0x3d')]['filter']){_0x574711[_0x6c7c('0x47')]=_[_0x6c7c('0x49')](_0x574711[_0x6c7c('0x47')],{'$or':_['map'](_0x56ea2a,function(_0x3c5e41){if(_0x3c5e41['type']!==_0x6c7c('0x4a')){var _0xf99044={};_0xf99044[_0x3c5e41[_0x6c7c('0x32')]]={'$like':'%'+_0x1ed9ab[_0x6c7c('0x3d')][_0x6c7c('0x4b')]+'%'};return _0xf99044;}})});}_0x574711=_[_0x6c7c('0x49')]({},_0x574711,_0x1ed9ab['options']);var _0x129299={'where':_0x574711[_0x6c7c('0x47')]};return db['OpenchannelMessage'][_0x6c7c('0x29')](_0x129299)[_0x6c7c('0x2f')](function(_0x2c2a8e){_0x1fbc49[_0x6c7c('0x29')]=_0x2c2a8e;if(_0x1ed9ab[_0x6c7c('0x3d')][_0x6c7c('0x4c')]){_0x574711[_0x6c7c('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x6c7c('0x4e')](_0x574711);})[_0x6c7c('0x2f')](function(_0x119267){_0x1fbc49['rows']=_0x119267;return _0x1fbc49;})[_0x6c7c('0x2f')](respondWithFilteredResult(_0x4c737b,_0x574711))[_0x6c7c('0x4f')](handleError(_0x4c737b,null));};exports[_0x6c7c('0x50')]=function(_0x14a7f0,_0xa46a22){var _0x4210aa={'raw':!![],'where':{'id':_0x14a7f0['params']['id']}},_0x357562={};_0x357562[_0x6c7c('0x3b')]=_[_0x6c7c('0x3c')](db[_0x6c7c('0x36')][_0x6c7c('0x37')]);_0x357562[_0x6c7c('0x3d')]=_[_0x6c7c('0x3c')](_0x14a7f0[_0x6c7c('0x3d')]);_0x357562[_0x6c7c('0x3e')]=_[_0x6c7c('0x3f')](_0x357562[_0x6c7c('0x3b')],_0x357562[_0x6c7c('0x3d')]);_0x4210aa['attributes']=_[_0x6c7c('0x3f')](_0x357562[_0x6c7c('0x3b')],qs[_0x6c7c('0x41')](_0x14a7f0[_0x6c7c('0x3d')][_0x6c7c('0x41')]));_0x4210aa[_0x6c7c('0x40')]=_0x4210aa[_0x6c7c('0x40')][_0x6c7c('0x42')]?_0x4210aa[_0x6c7c('0x40')]:_0x357562[_0x6c7c('0x3b')];if(_0x14a7f0['query']['includeAll']){_0x4210aa[_0x6c7c('0x4d')]=[{'all':!![]}];}_0x4210aa=_[_0x6c7c('0x49')]({},_0x4210aa,_0x14a7f0['options']);return db[_0x6c7c('0x36')]['find'](_0x4210aa)[_0x6c7c('0x2f')](handleEntityNotFound(_0xa46a22,null))[_0x6c7c('0x2f')](respondWithResult(_0xa46a22,null))['catch'](handleError(_0xa46a22,null));};exports[_0x6c7c('0x51')]=function(_0x57fad4,_0x2b1b5e){return db['OpenchannelMessage'][_0x6c7c('0x51')](_0x57fad4['body'],{})[_0x6c7c('0x2f')](respondWithResult(_0x2b1b5e,0xc9))[_0x6c7c('0x4f')](handleError(_0x2b1b5e,null));};exports[_0x6c7c('0x2e')]=function(_0x2b5eb5,_0x3f1732){if(_0x2b5eb5[_0x6c7c('0x52')]['id']){delete _0x2b5eb5[_0x6c7c('0x52')]['id'];}return db[_0x6c7c('0x36')][_0x6c7c('0x53')]({'where':{'id':_0x2b5eb5[_0x6c7c('0x54')]['id']}})[_0x6c7c('0x2f')](handleEntityNotFound(_0x3f1732,null))[_0x6c7c('0x2f')](saveUpdates(_0x2b5eb5[_0x6c7c('0x52')],null))['then'](respondWithResult(_0x3f1732,null))[_0x6c7c('0x4f')](handleError(_0x3f1732,null));};exports[_0x6c7c('0x30')]=function(_0x59d2f6,_0x3c4551){return db[_0x6c7c('0x36')][_0x6c7c('0x53')]({'where':{'id':_0x59d2f6[_0x6c7c('0x54')]['id']}})[_0x6c7c('0x2f')](handleEntityNotFound(_0x3c4551,null))[_0x6c7c('0x2f')](removeEntity(_0x3c4551,null))[_0x6c7c('0x4f')](handleError(_0x3c4551,null));};exports[_0x6c7c('0x55')]=function(_0x760fdf,_0x29ddf7){return db['OpenchannelMessage'][_0x6c7c('0x55')]()[_0x6c7c('0x2f')](respondWithResult(_0x29ddf7,null))[_0x6c7c('0x4f')](handleError(_0x29ddf7,null));};var interaction_log=require(_0x6c7c('0x13'))(_0x6c7c('0x56'));exports['accept']=function(_0x14b251,_0x576373,_0x27332c){var _0x3e3260={'agent':{},'channel':_0x6c7c('0x57')};if(_0x14b251[_0x6c7c('0x52')]['id']){delete _0x14b251[_0x6c7c('0x52')]['id'];}_0x14b251['body'][_0x6c7c('0x58')]=!![];_0x14b251['body'][_0x6c7c('0x59')]=moment()[_0x6c7c('0x5a')](_0x6c7c('0x5b'));_0x14b251[_0x6c7c('0x52')][_0x6c7c('0x5c')]=_0x14b251[_0x6c7c('0x52')]['UserId']||_0x14b251['user']['id'];_0x3e3260[_0x6c7c('0x5d')]['id']=_0x14b251[_0x6c7c('0x52')]['UserId'];return db[_0x6c7c('0x36')]['find']({'where':{'id':_0x14b251['params']['id'],'UserId':null}})[_0x6c7c('0x2f')](handleEntityNotFound(_0x576373,null))[_0x6c7c('0x2f')](saveUpdates(_0x14b251[_0x6c7c('0x52')],null))[_0x6c7c('0x2f')](function(_0x3beb3b){if(_0x3beb3b){_0x3e3260[_0x6c7c('0x23')]=_0x3beb3b[_0x6c7c('0x5e')]({'plain':!![]});return db[_0x6c7c('0x5f')][_0x6c7c('0x53')]({'where':{'id':_0x3beb3b[_0x6c7c('0x60')]}});}return null;})[_0x6c7c('0x2f')](handleEntityNotFound(_0x576373,null))[_0x6c7c('0x2f')](function(_0x3416c4){if(_0x3416c4){return _0x3416c4[_0x6c7c('0x2e')]({'UserId':_0x14b251[_0x6c7c('0x52')][_0x6c7c('0x5c')],'read1stAt':_[_0x6c7c('0x61')](_0x3416c4[_0x6c7c('0x62')])?moment()[_0x6c7c('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6c7c('0x2f')](function(_0x120e60){if(_0x120e60){_0x3e3260[_0x6c7c('0x63')]=_0x120e60[_0x6c7c('0x5e')]({'plain':!![]});interaction_log[_0x6c7c('0x1c')](_0x6c7c('0x64'),_0x14b251[_0x6c7c('0x65')]['id'],_0x14b251[_0x6c7c('0x65')]['name'],_0x14b251[_0x6c7c('0x65')][_0x6c7c('0x66')],_0x3e3260[_0x6c7c('0x63')]['id'],_0x14b251[_0x6c7c('0x52')]?JSON[_0x6c7c('0x20')](_0x14b251['body']):_0x6c7c('0x67'));return respondWithRpcPromise(_0x6c7c('0x68'),'acceptMessage',_0x3e3260);}return null;})[_0x6c7c('0x2f')](function(_0x5f009f){var _0x40c56d=_0x6c7c('0x69')+_0x5f009f[_0x6c7c('0x23')][_0x6c7c('0x6a')];return db['sequelize'][_0x6c7c('0x3d')](_0x40c56d,{'type':db[_0x6c7c('0x6b')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6c7c('0x2f')](function(_0x486a41){return _0x486a41;});})['then'](function(_0x54aaf1){if(_0x54aaf1){_0x3e3260[_0x6c7c('0x23')][_0x6c7c('0x6c')]=_0x54aaf1[0x0];if(!_0x14b251['body'][_0x6c7c('0x5c')])return;return db[_0x6c7c('0x6d')][_0x6c7c('0x53')]({'where':{'id':_0x14b251[_0x6c7c('0x52')][_0x6c7c('0x5c')],'role':'agent'},'attributes':['id',_0x6c7c('0x32'),'fullname',_0x6c7c('0x6e'),_0x6c7c('0x6f')],'raw':!![]});}return null;})[_0x6c7c('0x2f')](function(_0x4d601c){if(!_0x4d601c)return null;_0x3e3260[_0x6c7c('0x23')][_0x6c7c('0x5d')]=_0x4d601c;return _0x3e3260;})[_0x6c7c('0x2f')](function(_0x1158b7){if(_0x1158b7){if(_0x14b251[_0x6c7c('0x52')][_0x6c7c('0x70')]){_0x3e3260['message'][_0x6c7c('0x71')]=util[_0x6c7c('0x5a')]('SIP/%s',_0x14b251[_0x6c7c('0x65')]['name']);_0x3e3260[_0x6c7c('0x23')][_0x6c7c('0x72')]=_0x3e3260[_0x6c7c('0x72')];_0x3e3260['message'][_0x6c7c('0x73')]=_0x3e3260[_0x6c7c('0x72')];_0x3e3260['message'][_0x6c7c('0x74')]=_0x6c7c('0x75');return respondWithRpcPromise('EventManager',_0x6c7c('0x76'),{'event':'acceptmessage','message':_0x3e3260[_0x6c7c('0x23')]},client9002)[_0x6c7c('0x2f')](function(){return _0x3e3260;});}return _0x3e3260;}return null;})['then'](respondWithResult(_0x576373,null))[_0x6c7c('0x4f')](handleError(_0x576373,null));};var interaction_log=require(_0x6c7c('0x13'))(_0x6c7c('0x56'));exports['reject']=function(_0xa923e9,_0x58c6b8,_0x290050){var _0x8c3aa2={'agent':{},'channel':_0x6c7c('0x57')};if(_0xa923e9[_0x6c7c('0x52')]['id']){delete _0xa923e9[_0x6c7c('0x52')]['id'];}_0xa923e9[_0x6c7c('0x52')][_0x6c7c('0x5c')]=_0xa923e9[_0x6c7c('0x52')][_0x6c7c('0x5c')]||_0xa923e9[_0x6c7c('0x65')]['id'];_0x8c3aa2[_0x6c7c('0x5d')]['id']=_0xa923e9[_0x6c7c('0x52')][_0x6c7c('0x5c')];return db[_0x6c7c('0x36')][_0x6c7c('0x53')]({'where':{'id':_0xa923e9[_0x6c7c('0x54')]['id'],'UserId':null}})[_0x6c7c('0x2f')](handleEntityNotFound(_0x58c6b8,null))[_0x6c7c('0x2f')](function(_0x21db87){if(_0x21db87){_0x8c3aa2[_0x6c7c('0x23')]=_0x21db87['get']({'plain':!![]});return db[_0x6c7c('0x5f')][_0x6c7c('0x53')]({'where':{'id':_0x21db87[_0x6c7c('0x60')]}});}return null;})[_0x6c7c('0x2f')](handleEntityNotFound(_0x58c6b8,null))['then'](function(_0x22a0af){if(_0x22a0af){_0x8c3aa2[_0x6c7c('0x63')]=_0x22a0af[_0x6c7c('0x5e')]({'plain':!![]});interaction_log[_0x6c7c('0x1c')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa923e9['user']['id'],_0xa923e9[_0x6c7c('0x65')][_0x6c7c('0x32')],_0xa923e9['user']['role'],_0x8c3aa2['interaction']['id'],_0xa923e9[_0x6c7c('0x52')]?JSON[_0x6c7c('0x20')](_0xa923e9[_0x6c7c('0x52')]):_0x6c7c('0x67'));return respondWithRpcPromise(_0x6c7c('0x77'),_0x6c7c('0x78'),_0x8c3aa2);}return null;})[_0x6c7c('0x2f')](function(_0x55a687){var _0xca8ff4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55a687[_0x6c7c('0x23')][_0x6c7c('0x6a')];return db[_0x6c7c('0x79')][_0x6c7c('0x3d')](_0xca8ff4,{'type':db[_0x6c7c('0x6b')][_0x6c7c('0x7a')][_0x6c7c('0x7b')],'raw':!![]})[_0x6c7c('0x2f')](function(_0x374e3d){return _0x374e3d;});})[_0x6c7c('0x2f')](function(_0x1a9ce5){if(_0x1a9ce5){_0x8c3aa2[_0x6c7c('0x23')][_0x6c7c('0x6c')]=_0x1a9ce5[0x0];if(!_0xa923e9[_0x6c7c('0x52')][_0x6c7c('0x5c')])return;return db[_0x6c7c('0x6d')][_0x6c7c('0x53')]({'where':{'id':_0xa923e9['body'][_0x6c7c('0x5c')],'role':'agent'},'attributes':['id','name',_0x6c7c('0x7c'),_0x6c7c('0x6e'),_0x6c7c('0x6f')],'raw':!![]});}return null;})[_0x6c7c('0x2f')](function(_0x594fa2){if(!_0x594fa2)return null;_0x8c3aa2[_0x6c7c('0x23')][_0x6c7c('0x5d')]=_0x594fa2;return _0x8c3aa2;})[_0x6c7c('0x2f')](function(_0x3d12d9){if(_0x3d12d9){_0x3d12d9[_0x6c7c('0x23')][_0x6c7c('0x71')]=util['format'](_0x6c7c('0x7d'),_0xa923e9[_0x6c7c('0x65')][_0x6c7c('0x32')]);_0x3d12d9['message']['channel']=_0x8c3aa2[_0x6c7c('0x72')];_0x3d12d9[_0x6c7c('0x23')][_0x6c7c('0x73')]=_0x8c3aa2[_0x6c7c('0x72')];_0x3d12d9[_0x6c7c('0x23')][_0x6c7c('0x74')]=_0x6c7c('0x2d');respondWithRpcPromise('EventManager',_0x6c7c('0x76'),{'event':_0x6c7c('0x7e'),'message':_0x3d12d9[_0x6c7c('0x23')]},client9002);return _0x8c3aa2;}return null;})[_0x6c7c('0x2f')](respondWithResult(_0x58c6b8,null))[_0x6c7c('0x4f')](handleError(_0x58c6b8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1f5ba9a..418a239 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 _0x29df=['hook','events','../../mysqldb','OpenchannelMessage','remove','emit'];(function(_0x1c1555,_0x127b18){var _0x4c8d9d=function(_0x3c96a8){while(--_0x3c96a8){_0x1c1555['push'](_0x1c1555['shift']());}};_0x4c8d9d(++_0x127b18);}(_0x29df,0x1ab));var _0xf29d=function(_0x4960b4,_0xc44bf5){_0x4960b4=_0x4960b4-0x0;var _0x1b9779=_0x29df[_0x4960b4];return _0x1b9779;};'use strict';var EventEmitter=require(_0xf29d('0x0'));var OpenchannelMessage=require(_0xf29d('0x1'))['db'][_0xf29d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf29d('0x3')};function emitEvent(_0x23f7fe){return function(_0x56571f,_0x349e71,_0x4f0ba3){OpenchannelMessageEvents['emit'](_0x23f7fe+':'+_0x56571f['id'],_0x56571f);OpenchannelMessageEvents[_0xf29d('0x4')](_0x23f7fe,_0x56571f);_0x4f0ba3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xf29d('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x4bdb=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4bdb,0xc1));var _0xb4bd=function(_0x52952b,_0x59799e){_0x52952b=_0x52952b-0x0;var _0x1e8b09=_0x4bdb[_0x52952b];return _0x1e8b09;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb4bd('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb4bd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb4bd('0x2'),'afterDestroy':_0xb4bd('0x3')};function emitEvent(_0x5a0516){return function(_0x54d000,_0x3453cd,_0x154601){OpenchannelMessageEvents[_0xb4bd('0x4')](_0x5a0516+':'+_0x54d000['id'],_0x54d000);OpenchannelMessageEvents[_0xb4bd('0x4')](_0x5a0516,_0x54d000);_0x154601(null);};}for(var e in events){if(events[_0xb4bd('0x5')](e)){var event=events[e];OpenchannelMessage[_0xb4bd('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 3806bec..31580e0 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 _0xe36a=['describe','find','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','afterCreate','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','createdAt','catch','out','CmContact'];(function(_0x2cf986,_0x54bbea){var _0x20e954=function(_0x188520){while(--_0x188520){_0x2cf986['push'](_0x2cf986['shift']());}};_0x20e954(++_0x54bbea);}(_0xe36a,0xaf));var _0xae36=function(_0x28104d,_0x1ddce1){_0x28104d=_0x28104d-0x0;var _0xca609b=_0xe36a[_0x28104d];return _0xca609b;};'use strict';var _=require(_0xae36('0x0'));var util=require(_0xae36('0x1'));var logger=require(_0xae36('0x2'))('api');var moment=require(_0xae36('0x3'));var BPromise=require(_0xae36('0x4'));var rp=require(_0xae36('0x5'));var fs=require('fs');var path=require(_0xae36('0x6'));var rimraf=require(_0xae36('0x7'));var config=require(_0xae36('0x8'));var attributes=require(_0xae36('0x9'));module[_0xae36('0xa')]=function(_0x160f4f,_0x4c03b3){return _0x160f4f['define']('OpenchannelMessage',attributes,{'tableName':_0xae36('0xb'),'paranoid':![],'indexes':[{'name':_0xae36('0xc'),'fields':[_0xae36('0xd')],'type':_0xae36('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x805228,_0x55a5fa,_0x534ead){var _0x382138=_0x160f4f[_0xae36('0xf')];var _0x458084=_0x805228[_0xae36('0x10')]({'plain':!![]});if(_0x458084[_0xae36('0x11')]['toLowerCase']()==='in'||_0x458084[_0xae36('0x11')][_0xae36('0x12')]()==='out'&&!_0x458084[_0xae36('0x13')]&&!_[_0xae36('0x14')](_0x458084[_0xae36('0x15')])){_0x382138['OpenchannelInteraction'][_0xae36('0x16')]({'where':{'id':_0x458084[_0xae36('0x17')]}})[_0xae36('0x18')](function(_0x5ab813){if(_0x5ab813){_0x5ab813['update']({'lastMsgAt':_0x458084[_0xae36('0x19')],'lastMsgDirection':_0x458084['direction']['toLowerCase']()});}})[_0xae36('0x1a')](function(_0x1175b9){console['error'](_0x1175b9);});}if(_0x458084['direction']===_0xae36('0x1b')&&!_0x458084[_0xae36('0x13')]){var _0x3744cd;_0x382138[_0xae36('0x1c')][_0xae36('0x1d')]()[_0xae36('0x18')](function(_0x538f69){return _0x382138['OpenchannelAccount'][_0xae36('0x1e')]({'where':{'id':_0x458084['OpenchannelAccountId']},'include':[{'model':_0x382138[_0xae36('0x1f')],'as':_0xae36('0x20'),'where':{'id':_0x458084[_0xae36('0x17')]},'limit':0x1,'include':[{'model':_0x382138[_0xae36('0x1c')],'as':_0xae36('0x21'),'attributes':_[_0xae36('0x22')](_0x538f69)}]}]});})[_0xae36('0x18')](function(_0xa00cf){_0x3744cd=_0xa00cf[_0xae36('0x10')]({'plain':!![]});if(_0x3744cd&&_0x3744cd[_0xae36('0x23')]){logger[_0xae36('0x24')](_0xae36('0x25'),'afterCreate',util[_0xae36('0x26')](_0xae36('0x27'),_0x458084['id'],_0x3744cd['replyUri']));if(_0x3744cd[_0xae36('0x20')]&&_0x3744cd[_0xae36('0x20')][_0xae36('0x28')]){_0x458084[_0xae36('0x29')]=_[_0xae36('0x2a')](_0x3744cd[_0xae36('0x20')][0x0],_0xae36('0x21'));_0x458084[_0xae36('0x21')]=_0x3744cd[_0xae36('0x20')][0x0][_0xae36('0x21')];}var _0x55a5fa={'method':_0xae36('0x2b'),'uri':encodeURI(_0x3744cd['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x55a5fa[_0xae36('0x2c')]){case'GET':_0x55a5fa['qs']=_0x458084;break;case'POST':_0x55a5fa[_0xae36('0xd')]=_0x458084;break;}return rp(_0x55a5fa)[_0xae36('0x18')](function(_0x55e017){logger['info'](_0xae36('0x25'),'afterCreate',util['format'](_0xae36('0x2d'),_0x458084['id'],_0x3744cd[_0xae36('0x23')]));if(_0x55e017[_0xae36('0xd')]['threadId']&&_0x55e017[_0xae36('0xd')]['threadId']!=_0x458084[_0xae36('0x29')][_0xae36('0x2e')]){return _0x382138[_0xae36('0x1f')][_0xae36('0x2f')]({'threadId':_0x55e017[_0xae36('0xd')][_0xae36('0x2e')]},{'where':{'id':_0x458084[_0xae36('0x29')]['id']}});}else{return;}})[_0xae36('0x18')](function(){return _0x805228['update']({'read':!![]});})[_0xae36('0x1a')](function(_0x1b7829){logger['error'](_0xae36('0x25'),_0xae36('0x30'),util['inspect'](_0x1b7829,{'showHidden':![],'depth':null}));_0x534ead();});}else{_0x534ead();}})['finally'](function(){_0x534ead();});}else{_0x534ead();}}},'charset':_0xae36('0x31'),'collate':_0xae36('0x32')});}; \ No newline at end of file +var _0x0695=['api','moment','request-promise','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','FULLTEXT','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','then','createdAt','catch','error','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','POST','method','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','update','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x0695,0xb9));var _0x5069=function(_0x537093,_0x25931f){_0x537093=_0x537093-0x0;var _0x51087d=_0x0695[_0x537093];return _0x51087d;};'use strict';var _=require(_0x5069('0x0'));var util=require(_0x5069('0x1'));var logger=require(_0x5069('0x2'))(_0x5069('0x3'));var moment=require(_0x5069('0x4'));var BPromise=require('bluebird');var rp=require(_0x5069('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5069('0x6'));var attributes=require(_0x5069('0x7'));module[_0x5069('0x8')]=function(_0x52b9a8,_0x12f12c){return _0x52b9a8[_0x5069('0x9')](_0x5069('0xa'),attributes,{'tableName':_0x5069('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x5069('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e6787,_0x5c0910,_0x4d8cf4){var _0x1951b2=_0x52b9a8['models'];var _0x47351c=_0x2e6787['get']({'plain':!![]});if(_0x47351c[_0x5069('0xd')][_0x5069('0xe')]()==='in'||_0x47351c[_0x5069('0xd')][_0x5069('0xe')]()===_0x5069('0xf')&&!_0x47351c[_0x5069('0x10')]&&!_['isNil'](_0x47351c[_0x5069('0x11')])){_0x1951b2[_0x5069('0x12')][_0x5069('0x13')]({'where':{'id':_0x47351c['OpenchannelInteractionId']}})[_0x5069('0x14')](function(_0x343ae6){if(_0x343ae6){_0x343ae6['update']({'lastMsgAt':_0x47351c[_0x5069('0x15')],'lastMsgDirection':_0x47351c[_0x5069('0xd')][_0x5069('0xe')]()});}})[_0x5069('0x16')](function(_0xcdbbbf){console[_0x5069('0x17')](_0xcdbbbf);});}if(_0x47351c[_0x5069('0xd')]==='out'&&!_0x47351c['secret']){var _0x2b967b;_0x1951b2['CmContact'][_0x5069('0x18')]()['then'](function(_0x321c94){return _0x1951b2[_0x5069('0x19')]['find']({'where':{'id':_0x47351c[_0x5069('0x1a')]},'include':[{'model':_0x1951b2['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x47351c[_0x5069('0x1b')]},'limit':0x1,'include':[{'model':_0x1951b2['CmContact'],'as':_0x5069('0x1c'),'attributes':_[_0x5069('0x1d')](_0x321c94)}]}]});})[_0x5069('0x14')](function(_0x2a73d0){_0x2b967b=_0x2a73d0['get']({'plain':!![]});if(_0x2b967b&&_0x2b967b[_0x5069('0x1e')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x5069('0x1f'),util[_0x5069('0x20')](_0x5069('0x21'),_0x47351c['id'],_0x2b967b[_0x5069('0x1e')]));if(_0x2b967b['Interactions']&&_0x2b967b[_0x5069('0x22')][_0x5069('0x23')]){_0x47351c[_0x5069('0x24')]=_['omit'](_0x2b967b[_0x5069('0x22')][0x0],'Contact');_0x47351c[_0x5069('0x1c')]=_0x2b967b[_0x5069('0x22')][0x0][_0x5069('0x1c')];}var _0x5c0910={'method':_0x5069('0x25'),'uri':encodeURI(_0x2b967b['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5c0910[_0x5069('0x26')]){case'GET':_0x5c0910['qs']=_0x47351c;break;case'POST':_0x5c0910['body']=_0x47351c;break;}return rp(_0x5c0910)['then'](function(_0x4bf88b){logger['info'](_0x5069('0x27'),_0x5069('0x1f'),util[_0x5069('0x20')](_0x5069('0x28'),_0x47351c['id'],_0x2b967b[_0x5069('0x1e')]));if(_0x4bf88b[_0x5069('0x29')][_0x5069('0x2a')]&&_0x4bf88b[_0x5069('0x29')][_0x5069('0x2a')]!=_0x47351c[_0x5069('0x24')]['threadId']){return _0x1951b2[_0x5069('0x12')][_0x5069('0x2b')]({'threadId':_0x4bf88b[_0x5069('0x29')][_0x5069('0x2a')]},{'where':{'id':_0x47351c[_0x5069('0x24')]['id']}});}else{return;}})[_0x5069('0x14')](function(){return _0x2e6787[_0x5069('0x2b')]({'read':!![]});})[_0x5069('0x16')](function(_0x40c250){logger[_0x5069('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x5069('0x1f'),util['inspect'](_0x40c250,{'showHidden':![],'depth':null}));_0x4d8cf4();});}else{_0x4d8cf4();}})[_0x5069('0x2c')](function(){_0x4d8cf4();});}else{_0x4d8cf4();}}},'charset':_0x5069('0x2d'),'collate':_0x5069('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6a90c41..be21900 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d0173,_0x4ee49e){var _0x4d47e6=function(_0x348944){while(--_0x348944){_0x1d0173['push'](_0x1d0173['shift']());}};_0x4d47e6(++_0x4ee49e);}(_0x1261,0x144));var _0x1126=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x1261[_0x4f35f4];return _0x2e9a70;};'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});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xfd6ac1,_0x263802){var _0x437382=function(_0x585c4f){while(--_0x585c4f){_0xfd6ac1['push'](_0xfd6ac1['shift']());}};_0x437382(++_0x263802);}(_0x0b0e,0x187));var _0xe0b0=function(_0x8ce506,_0x517f30){_0x8ce506=_0x8ce506-0x0;var _0x23c8e5=_0x0b0e[_0x8ce506];return _0x23c8e5;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 98a2b4d..f6b3ae3 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 _0x9ca1=['remove','update','emit','removeListener','./openchannelMessage.events','save'];(function(_0xdbf8f2,_0x409a32){var _0x4ed5d2=function(_0xe7819c){while(--_0xe7819c){_0xdbf8f2['push'](_0xdbf8f2['shift']());}};_0x4ed5d2(++_0x409a32);}(_0x9ca1,0x1cc));var _0x19ca=function(_0x47fcc9,_0x5d1efb){_0x47fcc9=_0x47fcc9-0x0;var _0x35583e=_0x9ca1[_0x47fcc9];return _0x35583e;};'use strict';var OpenchannelMessageEvents=require(_0x19ca('0x0'));var events=[_0x19ca('0x1'),_0x19ca('0x2'),_0x19ca('0x3')];function createListener(_0x140384,_0x44cf7b){return function(_0x130221){_0x44cf7b[_0x19ca('0x4')](_0x140384,_0x130221);};}function removeListener(_0x207c63,_0xca10f3){return function(){OpenchannelMessageEvents[_0x19ca('0x5')](_0x207c63,_0xca10f3);};}exports['register']=function(_0x219ec1){for(var _0x19d8ef=0x0,_0x233730=events['length'];_0x19d8ef<_0x233730;_0x19d8ef++){var _0x426329=events[_0x19d8ef];var _0x18144a=createListener('openchannelMessage:'+_0x426329,_0x219ec1);OpenchannelMessageEvents['on'](_0x426329,_0x18144a);}}; \ No newline at end of file +var _0xd8fb=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0x25ad0b,_0x16c68b){var _0x2f4d4c=function(_0x999349){while(--_0x999349){_0x25ad0b['push'](_0x25ad0b['shift']());}};_0x2f4d4c(++_0x16c68b);}(_0xd8fb,0x99));var _0xbd8f=function(_0x42810d,_0x1597ce){_0x42810d=_0x42810d-0x0;var _0x1441fa=_0xd8fb[_0x42810d];return _0x1441fa;};'use strict';var OpenchannelMessageEvents=require(_0xbd8f('0x0'));var events=[_0xbd8f('0x1'),_0xbd8f('0x2'),_0xbd8f('0x3')];function createListener(_0x52724c,_0x5ea933){return function(_0x4e9545){_0x5ea933[_0xbd8f('0x4')](_0x52724c,_0x4e9545);};}function removeListener(_0x43d177,_0x53cccc){return function(){OpenchannelMessageEvents[_0xbd8f('0x5')](_0x43d177,_0x53cccc);};}exports[_0xbd8f('0x6')]=function(_0x5543b2){for(var _0x33d541=0x0,_0x4e97cf=events[_0xbd8f('0x7')];_0x33d541<_0x4e97cf;_0x33d541++){var _0x578499=events[_0x33d541];var _0x197827=createListener(_0xbd8f('0x8')+_0x578499,_0x5543b2);OpenchannelMessageEvents['on'](_0x578499,_0x197827);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 954d496..977b7a7 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 _0xa130=['removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete'];(function(_0x200dc9,_0x32473a){var _0xff6774=function(_0x2f17e8){while(--_0x2f17e8){_0x200dc9['push'](_0x200dc9['shift']());}};_0xff6774(++_0x32473a);}(_0xa130,0xda));var _0x0a13=function(_0x1e90b5,_0x161d56){_0x1e90b5=_0x1e90b5-0x0;var _0x2aa79b=_0xa130[_0x1e90b5];return _0x2aa79b;};'use strict';var multer=require('multer');var util=require(_0x0a13('0x0'));var path=require(_0x0a13('0x1'));var timeout=require(_0x0a13('0x2'));var express=require(_0x0a13('0x3'));var router=express[_0x0a13('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0a13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a13('0x6'));var controller=require(_0x0a13('0x7'));router[_0x0a13('0x8')]('/',auth[_0x0a13('0x9')](),controller[_0x0a13('0xa')]);router[_0x0a13('0x8')](_0x0a13('0xb'),auth[_0x0a13('0x9')](),controller[_0x0a13('0xc')]);router[_0x0a13('0x8')](_0x0a13('0xd'),auth[_0x0a13('0x9')](),controller[_0x0a13('0xe')]);router[_0x0a13('0x8')](_0x0a13('0xf'),auth['isAuthenticated'](),controller[_0x0a13('0x10')]);router[_0x0a13('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0a13('0x11')]);router[_0x0a13('0x8')](_0x0a13('0x12'),auth[_0x0a13('0x9')](),controller[_0x0a13('0x13')]);router[_0x0a13('0x14')]('/',auth[_0x0a13('0x9')](),controller[_0x0a13('0x15')]);router[_0x0a13('0x14')]('/:id/teams',auth[_0x0a13('0x9')](),controller['addTeams']);router['post'](_0x0a13('0x12'),auth[_0x0a13('0x9')](),controller[_0x0a13('0x16')]);router['put'](_0x0a13('0xd'),auth[_0x0a13('0x9')](),controller[_0x0a13('0x17')]);router['delete']('/:id',auth[_0x0a13('0x9')](),controller['destroy']);router[_0x0a13('0x18')]('/:id/teams',auth[_0x0a13('0x9')](),controller[_0x0a13('0x19')]);router['delete']('/:id/users',auth[_0x0a13('0x9')](),controller['removeAgents']);module[_0x0a13('0x1a')]=router; \ No newline at end of file +var _0x0606=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','/:id','update','destroy','delete','removeTeams','removeAgents','multer','util','path'];(function(_0x39d239,_0x2e8646){var _0x35bf8b=function(_0x137299){while(--_0x137299){_0x39d239['push'](_0x39d239['shift']());}};_0x35bf8b(++_0x2e8646);}(_0x0606,0x190));var _0x6060=function(_0x250c66,_0x379c76){_0x250c66=_0x250c66-0x0;var _0x39782a=_0x0606[_0x250c66];return _0x39782a;};'use strict';var multer=require(_0x6060('0x0'));var util=require(_0x6060('0x1'));var path=require(_0x6060('0x2'));var timeout=require(_0x6060('0x3'));var express=require('express');var router=express[_0x6060('0x4')]();var fs_extra=require(_0x6060('0x5'));var auth=require(_0x6060('0x6'));var interaction=require(_0x6060('0x7'));var config=require(_0x6060('0x8'));var controller=require(_0x6060('0x9'));router[_0x6060('0xa')]('/',auth[_0x6060('0xb')](),controller['index']);router['get'](_0x6060('0xc'),auth[_0x6060('0xb')](),controller[_0x6060('0xd')]);router[_0x6060('0xa')]('/:id',auth[_0x6060('0xb')](),controller[_0x6060('0xe')]);router[_0x6060('0xa')](_0x6060('0xf'),auth[_0x6060('0xb')](),controller[_0x6060('0x10')]);router[_0x6060('0xa')](_0x6060('0x11'),auth[_0x6060('0xb')](),controller[_0x6060('0x12')]);router[_0x6060('0xa')](_0x6060('0x13'),auth[_0x6060('0xb')](),controller[_0x6060('0x14')]);router['post']('/',auth[_0x6060('0xb')](),controller[_0x6060('0x15')]);router[_0x6060('0x16')](_0x6060('0x11'),auth[_0x6060('0xb')](),controller[_0x6060('0x17')]);router[_0x6060('0x16')]('/:id/users',auth[_0x6060('0xb')](),controller[_0x6060('0x18')]);router['put'](_0x6060('0x19'),auth['isAuthenticated'](),controller[_0x6060('0x1a')]);router['delete'](_0x6060('0x19'),auth[_0x6060('0xb')](),controller[_0x6060('0x1b')]);router[_0x6060('0x1c')](_0x6060('0x11'),auth[_0x6060('0xb')](),controller[_0x6060('0x1d')]);router[_0x6060('0x1c')](_0x6060('0x13'),auth[_0x6060('0xb')](),controller[_0x6060('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 0cb8c37..e2c1012 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 _0xe8e5=['name','INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x2ade6f,_0x18d576){var _0x28fa0f=function(_0x4ad67c){while(--_0x4ad67c){_0x2ade6f['push'](_0x2ade6f['shift']());}};_0x28fa0f(++_0x18d576);}(_0xe8e5,0xba));var _0x5e8e=function(_0x479e97,_0x33c9d1){_0x479e97=_0x479e97-0x0;var _0x2ef302=_0xe8e5[_0x479e97];return _0x2ef302;};'use strict';var Sequelize=require(_0x5e8e('0x0'));module[_0x5e8e('0x1')]={'name':{'type':Sequelize[_0x5e8e('0x2')],'unique':_0x5e8e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e8e('0x2')]},'timeout':{'type':Sequelize[_0x5e8e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e8e('0x5')]('rrmemory',_0x5e8e('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x3707=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3707,0x1df));var _0x7370=function(_0x5cd42a,_0x5e3912){_0x5cd42a=_0x5cd42a-0x0;var _0x35000f=_0x3707[_0x5cd42a];return _0x35000f;};'use strict';var Sequelize=require(_0x7370('0x0'));module['exports']={'name':{'type':Sequelize[_0x7370('0x1')],'unique':_0x7370('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7370('0x1')]},'timeout':{'type':Sequelize[_0x7370('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7370('0x4'),_0x7370('0x5'),_0x7370('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 3cedeb4..9290f12 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 _0x7e32=['findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','map','User','findAndCountAll','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','merge','ids','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','Agents','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','then','get','OpenchannelQueues','UserProfileResource','destroy','stack','name','send','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query'];(function(_0x2c6ae1,_0x317c68){var _0x1cafbf=function(_0xf51602){while(--_0xf51602){_0x2c6ae1['push'](_0x2c6ae1['shift']());}};_0x1cafbf(++_0x317c68);}(_0x7e32,0x1c0));var _0x27e3=function(_0x5ef15e,_0x4765bd){_0x5ef15e=_0x5ef15e-0x0;var _0x2501c6=_0x7e32[_0x5ef15e];return _0x2501c6;};'use strict';var BPromise=require(_0x27e3('0x0'));var util=require(_0x27e3('0x1'));var _=require(_0x27e3('0x2'));var squel=require(_0x27e3('0x3'));var Redis=require('ioredis');var qs=require(_0x27e3('0x4'));var logger=require('../../config/logger')(_0x27e3('0x5'));var config=require(_0x27e3('0x6'));var db=require(_0x27e3('0x7'))['db'];config[_0x27e3('0x8')]=_['defaults'](config[_0x27e3('0x8')],{'host':_0x27e3('0x9'),'port':0x18eb});var socket=require(_0x27e3('0xa'))(new Redis(config[_0x27e3('0x8')]));require(_0x27e3('0xb'))[_0x27e3('0xc')](socket);function respondWithStatusCode(_0x13ead0,_0x4e99da){_0x4e99da=_0x4e99da||0xcc;return function(_0xb9a9d9){if(_0xb9a9d9){return _0x13ead0[_0x27e3('0xd')](_0x4e99da);}return _0x13ead0['status'](_0x4e99da)[_0x27e3('0xe')]();};}function respondWithResult(_0x350c8b,_0x2e586a){_0x2e586a=_0x2e586a||0xc8;return function(_0x1a14e8){if(_0x1a14e8){return _0x350c8b[_0x27e3('0xf')](_0x2e586a)['json'](_0x1a14e8);}};}function respondWithFilteredResult(_0x355c25,_0x3f73f3){return function(_0x51e5e3){if(_0x51e5e3){var _0x304045=typeof _0x3f73f3[_0x27e3('0x10')]==='undefined'&&typeof _0x3f73f3[_0x27e3('0x11')]===_0x27e3('0x12');var _0x37b866=_0x51e5e3[_0x27e3('0x13')];var _0x1c99c8=_0x304045?0x0:_0x3f73f3[_0x27e3('0x10')];var _0x4ae2a3=_0x304045?_0x51e5e3['count']:_0x3f73f3[_0x27e3('0x10')]+_0x3f73f3[_0x27e3('0x11')];var _0xc91213;if(_0x4ae2a3>=_0x37b866){_0x4ae2a3=_0x37b866;_0xc91213=0xc8;}else{_0xc91213=0xce;}_0x355c25[_0x27e3('0xf')](_0xc91213);return _0x355c25[_0x27e3('0x14')](_0x27e3('0x15'),_0x1c99c8+'-'+_0x4ae2a3+'/'+_0x37b866)[_0x27e3('0x16')](_0x51e5e3);}return null;};}function saveUpdates(_0x244c27){return function(_0x1bc05f){if(_0x1bc05f){return _0x1bc05f['update'](_0x244c27)['then'](function(_0x323e2a){return _0x323e2a;});}return null;};}function removeEntity(_0x4bf81e){return function(_0x436148){if(_0x436148){return _0x436148['destroy']()[_0x27e3('0x17')](function(){var _0x163046=_0x436148[_0x27e3('0x18')]({'plain':!![]});var _0x110fa4=_0x27e3('0x19');return db[_0x27e3('0x1a')][_0x27e3('0x1b')]({'where':{'type':_0x110fa4,'resourceId':_0x163046['id']}})[_0x27e3('0x17')](function(){return _0x436148;});})[_0x27e3('0x17')](function(){_0x4bf81e[_0x27e3('0xf')](0xcc)[_0x27e3('0xe')]();});}};}function handleEntityNotFound(_0x361ad1){return function(_0x54cf32){if(!_0x54cf32){_0x361ad1[_0x27e3('0xd')](0x194);}return _0x54cf32;};}function handleError(_0xbf812b,_0x155b4c){_0x155b4c=_0x155b4c||0x1f4;return function(_0x5dce89){logger['error'](_0x5dce89[_0x27e3('0x1c')]);if(_0x5dce89['name']){delete _0x5dce89[_0x27e3('0x1d')];}_0xbf812b[_0x27e3('0xf')](_0x155b4c)[_0x27e3('0x1e')](_0x5dce89);};}exports['index']=function(_0x3015d0,_0xfd817b){var _0x390ac4={};var _0x97e049={'count':0x0,'rows':[]};var _0x504f17=_['map'](db[_0x27e3('0x1f')][_0x27e3('0x20')],function(_0x5eba37){return{'name':_0x5eba37[_0x27e3('0x21')],'type':_0x5eba37[_0x27e3('0x22')][_0x27e3('0x23')]};});_0x390ac4=qs[_0x27e3('0x24')](_0x504f17,_0x3015d0);var _0x3442fb={'where':_0x390ac4[_0x27e3('0x25')]};return db['OpenchannelQueue']['count'](_0x3442fb)['then'](function(_0x5ccdbb){_0x97e049[_0x27e3('0x13')]=_0x5ccdbb;_0x390ac4[_0x27e3('0x26')]=qs[_0x27e3('0x26')](_0x3015d0[_0x27e3('0x27')]);return db['OpenchannelQueue'][_0x27e3('0x28')](_0x390ac4);})['then'](function(_0x888b27){_0x97e049[_0x27e3('0x29')]=_0x888b27;return _0x97e049;})[_0x27e3('0x17')](respondWithFilteredResult(_0xfd817b,_0x390ac4))[_0x27e3('0x2a')](handleError(_0xfd817b,null));};exports[_0x27e3('0x2b')]=function(_0x4102c1,_0x871d77){var _0x3b12c6={'raw':!![],'where':{'id':_0x4102c1[_0x27e3('0x2c')]['id']}},_0x235eff={};_0x235eff[_0x27e3('0x2d')]=_[_0x27e3('0x2e')](db[_0x27e3('0x1f')][_0x27e3('0x20')]);_0x235eff[_0x27e3('0x27')]=_[_0x27e3('0x2e')](_0x4102c1[_0x27e3('0x27')]);_0x235eff[_0x27e3('0x2f')]=_[_0x27e3('0x30')](_0x235eff['model'],_0x235eff[_0x27e3('0x27')]);_0x3b12c6[_0x27e3('0x31')]=_['intersection'](_0x235eff[_0x27e3('0x2d')],qs[_0x27e3('0x32')](_0x4102c1[_0x27e3('0x27')]['fields']));_0x3b12c6[_0x27e3('0x31')]=_0x3b12c6[_0x27e3('0x31')]['length']?_0x3b12c6['attributes']:_0x235eff[_0x27e3('0x2d')];if(_0x4102c1[_0x27e3('0x27')][_0x27e3('0x33')]){_0x3b12c6['include']=[{'all':!![]}];}_0x3b12c6=_['merge']({},_0x3b12c6,_0x4102c1[_0x27e3('0x34')]);return db['OpenchannelQueue'][_0x27e3('0x35')](_0x3b12c6)[_0x27e3('0x17')](handleEntityNotFound(_0x871d77,null))['then'](respondWithResult(_0x871d77,null))[_0x27e3('0x2a')](handleError(_0x871d77,null));};exports[_0x27e3('0x36')]=function(_0x4ea967,_0x1ecb8f){return db[_0x27e3('0x1f')][_0x27e3('0x36')](_0x4ea967[_0x27e3('0x37')],{})['then'](function(_0x25b3cf){var _0x156b5f=_0x4ea967[_0x27e3('0x38')]['get']({'plain':!![]});if(!_0x156b5f)throw new Error(_0x27e3('0x39'));if(_0x156b5f[_0x27e3('0x3a')]===_0x27e3('0x38')){var _0x4c79ae=_0x25b3cf['get']({'plain':!![]});var _0x56d5b3='OpenchannelQueues';return db[_0x27e3('0x3b')][_0x27e3('0x35')]({'where':{'name':_0x56d5b3,'userProfileId':_0x156b5f[_0x27e3('0x3c')]},'raw':!![]})[_0x27e3('0x17')](function(_0x9841c6){if(_0x9841c6&&_0x9841c6[_0x27e3('0x3d')]===0x0){return db[_0x27e3('0x1a')]['create']({'name':_0x4c79ae['name'],'resourceId':_0x4c79ae['id'],'type':_0x9841c6[_0x27e3('0x1d')],'sectionId':_0x9841c6['id']},{})[_0x27e3('0x17')](function(){return _0x25b3cf;});}else{return _0x25b3cf;}})['catch'](function(_0x18e96f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18e96f);throw _0x18e96f;});}return _0x25b3cf;})['then'](respondWithResult(_0x1ecb8f,0xc9))[_0x27e3('0x2a')](handleError(_0x1ecb8f,null));};exports[_0x27e3('0x3e')]=function(_0x5b61b8,_0xafa208){if(_0x5b61b8['body']['id']){delete _0x5b61b8[_0x27e3('0x37')]['id'];}return db[_0x27e3('0x1f')][_0x27e3('0x35')]({'where':{'id':_0x5b61b8[_0x27e3('0x2c')]['id']}})[_0x27e3('0x17')](handleEntityNotFound(_0xafa208,null))['then'](saveUpdates(_0x5b61b8[_0x27e3('0x37')],null))[_0x27e3('0x17')](respondWithResult(_0xafa208,null))['catch'](handleError(_0xafa208,null));};exports[_0x27e3('0x1b')]=function(_0x45fb02,_0x2a50b0){return db['OpenchannelQueue']['find']({'where':{'id':_0x45fb02[_0x27e3('0x2c')]['id']}})[_0x27e3('0x17')](handleEntityNotFound(_0x2a50b0,null))[_0x27e3('0x17')](removeEntity(_0x2a50b0,null))['catch'](handleError(_0x2a50b0,null));};exports['describe']=function(_0x135d1c,_0x236f23){return db[_0x27e3('0x1f')][_0x27e3('0x3f')]()[_0x27e3('0x17')](respondWithResult(_0x236f23,null))['catch'](handleError(_0x236f23,null));};exports['getMembers']=function(_0x663012,_0x239ffa){var _0x38725a={'raw':!![],'where':{}},_0x1fdc86={},_0xc58dad;return db[_0x27e3('0x1f')][_0x27e3('0x40')]({'where':{'id':_0x663012[_0x27e3('0x2c')]['id']}})[_0x27e3('0x17')](handleEntityNotFound(_0x239ffa,null))[_0x27e3('0x17')](function(_0x3dc161){if(_0x3dc161){_0xc58dad=_0x3dc161['get']({'plain':!![]});_0x1fdc86[_0x27e3('0x2d')]=_[_0x27e3('0x2e')](db[_0x27e3('0x41')][_0x27e3('0x20')]);_0x1fdc86[_0x27e3('0x27')]=_['keys'](_0x663012['query']);_0x1fdc86['filters']=_['intersection'](_0x1fdc86[_0x27e3('0x2d')],_0x1fdc86[_0x27e3('0x27')]);_0x38725a[_0x27e3('0x31')]=_[_0x27e3('0x30')](_0x1fdc86[_0x27e3('0x2d')],qs[_0x27e3('0x32')](_0x663012['query']['fields']));_0x38725a['attributes']=_0x38725a[_0x27e3('0x31')][_0x27e3('0x42')]?_0x38725a[_0x27e3('0x31')]:_0x1fdc86[_0x27e3('0x2d')];if(!_0x663012['query'][_0x27e3('0x43')](_0x27e3('0x44'))){_0x38725a[_0x27e3('0x11')]=qs['limit'](_0x663012[_0x27e3('0x27')][_0x27e3('0x11')]);_0x38725a[_0x27e3('0x10')]=qs[_0x27e3('0x10')](_0x663012[_0x27e3('0x27')][_0x27e3('0x10')]);}_0x38725a[_0x27e3('0x45')]=qs[_0x27e3('0x46')](_0x663012[_0x27e3('0x27')]['sort']);_0x38725a[_0x27e3('0x25')]=qs['filters'](_[_0x27e3('0x47')](_0x663012['query'],_0x1fdc86['filters']));_0x38725a['where'][_0x27e3('0x48')]=_0x3dc161['id'];if(_0x663012['query'][_0x27e3('0x49')]){_0x38725a[_0x27e3('0x25')]=_['merge'](_0x38725a[_0x27e3('0x25')],{'$or':_[_0x27e3('0x4a')](_0x38725a[_0x27e3('0x31')],function(_0x116e70){var _0x535355={};_0x535355[_0x116e70]={'$like':'%'+_0x663012[_0x27e3('0x27')][_0x27e3('0x49')]+'%'};return _0x535355;})});}_0x38725a=_['merge']({},_0x38725a,_0x663012['options']);return db[_0x27e3('0x41')][_0x27e3('0x28')](_0x38725a);}})[_0x27e3('0x17')](function(_0x1054bf){if(_0x1054bf){return db[_0x27e3('0x4b')][_0x27e3('0x4c')]({'where':{'id':_[_0x27e3('0x4a')](_0x1054bf,'UserId'),'role':'agent'},'attributes':['id',_0x27e3('0x1d'),'openchannelPause','updatedAt',_0x27e3('0x4d')]});}})[_0x27e3('0x17')](function(_0x564e4b){if(_0x564e4b){return{'count':_0x564e4b[_0x27e3('0x13')],'rows':_[_0x27e3('0x4a')](_0x564e4b['rows'],function(_0x48dc6c){return{'membername':_0x48dc6c[_0x27e3('0x1d')],'UserId':_0x48dc6c['id'],'queue_name':_0xc58dad[_0x27e3('0x1d')],'OpenchannelQueueId':_0xc58dad['id'],'interface':util[_0x27e3('0x4e')](_0x27e3('0x4f'),_0x27e3('0x50'),_0x48dc6c['name']),'penalty':0x0,'paused':_0x48dc6c[_0x27e3('0x51')],'createdAt':_0x48dc6c['createdAt'],'updatedAt':_0x48dc6c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x27e3('0x17')](respondWithFilteredResult(_0x239ffa,_0x38725a))[_0x27e3('0x2a')](handleError(_0x239ffa,null));};exports[_0x27e3('0x52')]=function(_0x13c18b,_0x4cc523){var _0x231249={};var _0x14d5b4={};var _0x3074fa;var _0xb71c5d;return db[_0x27e3('0x1f')]['findOne']({'where':{'id':_0x13c18b['params']['id']}})[_0x27e3('0x17')](handleEntityNotFound(_0x4cc523,null))[_0x27e3('0x17')](function(_0x27ee60){if(_0x27ee60){_0x3074fa=_0x27ee60;_0x14d5b4[_0x27e3('0x2d')]=_[_0x27e3('0x2e')](db[_0x27e3('0x53')][_0x27e3('0x20')]);_0x14d5b4[_0x27e3('0x27')]=_['keys'](_0x13c18b[_0x27e3('0x27')]);_0x14d5b4[_0x27e3('0x2f')]=_[_0x27e3('0x30')](_0x14d5b4[_0x27e3('0x2d')],_0x14d5b4[_0x27e3('0x27')]);_0x231249['attributes']=_[_0x27e3('0x30')](_0x14d5b4[_0x27e3('0x2d')],qs['fields'](_0x13c18b['query'][_0x27e3('0x32')]));_0x231249[_0x27e3('0x31')]=_0x231249[_0x27e3('0x31')][_0x27e3('0x42')]?_0x231249[_0x27e3('0x31')]:_0x14d5b4[_0x27e3('0x2d')];_0x231249[_0x27e3('0x45')]=qs[_0x27e3('0x46')](_0x13c18b[_0x27e3('0x27')][_0x27e3('0x46')]);_0x231249[_0x27e3('0x25')]=qs[_0x27e3('0x2f')](_['pick'](_0x13c18b['query'],_0x14d5b4[_0x27e3('0x2f')]));if(_0x13c18b['query']['filter']){_0x231249['where']=_[_0x27e3('0x54')](_0x231249[_0x27e3('0x25')],{'$or':_[_0x27e3('0x4a')](_0x231249[_0x27e3('0x31')],function(_0x192fc4){var _0x452234={};_0x452234[_0x192fc4]={'$like':'%'+_0x13c18b['query'][_0x27e3('0x49')]+'%'};return _0x452234;})});}_0x231249=_[_0x27e3('0x54')]({},_0x231249,_0x13c18b['options']);return _0x3074fa[_0x27e3('0x52')](_0x231249);}})[_0x27e3('0x17')](function(_0x4359ad){if(_0x4359ad){_0xb71c5d=_0x4359ad[_0x27e3('0x42')];if(!_0x13c18b[_0x27e3('0x27')]['hasOwnProperty'](_0x27e3('0x44'))){_0x231249['limit']=qs[_0x27e3('0x11')](_0x13c18b[_0x27e3('0x27')][_0x27e3('0x11')]);_0x231249[_0x27e3('0x10')]=qs[_0x27e3('0x10')](_0x13c18b[_0x27e3('0x27')][_0x27e3('0x10')]);}return _0x3074fa[_0x27e3('0x52')](_0x231249);}})[_0x27e3('0x17')](function(_0x1e76f8){if(_0x1e76f8){return _0x1e76f8?{'count':_0xb71c5d,'rows':_0x1e76f8}:null;}})[_0x27e3('0x17')](respondWithResult(_0x4cc523,null))[_0x27e3('0x2a')](handleError(_0x4cc523,null));};exports['addTeams']=function(_0x5891b8,_0x50c43b){var _0x3422a1=_0x5891b8[_0x27e3('0x37')][_0x27e3('0x55')];return db[_0x27e3('0x53')][_0x27e3('0x28')]({'where':{'id':_0x3422a1},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x27e3('0x56'),_0x27e3('0x57'),_0x27e3('0x58')],'raw':!![]}]})[_0x27e3('0x17')](function(_0x79235){if(_0x79235){var _0x2b9e03=_['flatMap'](_0x79235,function(_0x31fe7c){var _0x474aa3=_0x31fe7c[_0x27e3('0x18')]({'plain':!![]});return _0x474aa3['Agents'];});return db['OpenchannelQueue']['find']({'where':{'id':_0x5891b8['params']['id']}})['then'](function(_0x14d867){return db[_0x27e3('0x59')][_0x27e3('0x5a')](function(_0x519daf){return _0x14d867['addTeams'](_0x3422a1,{'transaction':_0x519daf})[_0x27e3('0x17')](function(){return BPromise['each'](_0x2b9e03,function(_0x42f44f){return db[_0x27e3('0x41')][_0x27e3('0x5b')]({'where':{'UserId':_0x42f44f['id'],'OpenchannelQueueId':_0x5891b8['params']['id']},'transaction':_0x519daf});});})[_0x27e3('0x17')](function(){_0x2b9e03[_0x27e3('0x5c')](function(_0x3dfa5f){socket[_0x27e3('0x5d')]('userOpenchannelQueue:save',{'UserId':_0x3dfa5f['id'],'OpenchannelQueueId':_0x14d867['id']});});});});});}})['then'](respondWithStatusCode(_0x50c43b,null))[_0x27e3('0x2a')](handleError(_0x50c43b,null));};exports['removeTeams']=function(_0x26581a,_0x1e53a4){return db[_0x27e3('0x53')][_0x27e3('0x28')]({'where':{'id':_0x26581a[_0x27e3('0x27')][_0x27e3('0x55')]},'attributes':['id'],'include':[{'model':db[_0x27e3('0x4b')],'as':_0x27e3('0x5e'),'attributes':['id'],'raw':!![]}]})[_0x27e3('0x17')](handleEntityNotFound(_0x1e53a4,null))[_0x27e3('0x17')](function(_0x3a7526){var _0x44cd19=_['map'](_0x3a7526,'id');var _0x3677b4=[];var _0x333836=[];var _0x2b0d4f=squel[_0x27e3('0x5f')]();_0x2b0d4f[_0x27e3('0x60')](_0x27e3('0x61'))[_0x27e3('0x62')](_0x27e3('0x63'),'tq')[_0x27e3('0x64')](_0x27e3('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x27e3('0x25')](_0x27e3('0x66'),_0x26581a[_0x27e3('0x2c')]['id']);for(var _0x49854c=0x0;_0x49854c<_0x3a7526[_0x27e3('0x42')];_0x49854c+=0x1){let _0x9453d2=_0x3a7526[_0x49854c];for(var _0x53a4ef=0x0;_0x53a4ef<_0x9453d2[_0x27e3('0x5e')][_0x27e3('0x42')];_0x53a4ef+=0x1){let _0x2a4510=_0x9453d2[_0x27e3('0x5e')][_0x53a4ef];var _0x577e09=_0x2b0d4f[_0x27e3('0x67')]();_0x577e09[_0x27e3('0x25')](_0x27e3('0x68'),_0x2a4510['id']);_0x333836[_0x27e3('0x69')](db[_0x27e3('0x59')]['query'](_0x577e09[_0x27e3('0x6a')](),{'type':db[_0x27e3('0x59')][_0x27e3('0x6b')][_0x27e3('0x6c')]})[_0x27e3('0x17')](function(_0x53c90c){if(_0x53c90c[_0x27e3('0x42')]===0x1){return _0x2a4510['id'];}else{var _0x3b36c4=_[_0x27e3('0x6d')](_['map'](_0x53c90c,_0x27e3('0x6e')),function(_0x13eb4c){return _['includes'](_0x44cd19,_0x13eb4c);});if(_0x3b36c4){return _0x2a4510['id'];}}}));}}return BPromise[_0x27e3('0x6f')](_0x333836)['then'](function(_0x29b2d0){_0x3677b4=_(_0x3677b4)['union'](_0x29b2d0)[_0x27e3('0x70')]()[_0x27e3('0x71')]();return db[_0x27e3('0x1f')][_0x27e3('0x35')]({'where':{'id':_0x26581a[_0x27e3('0x2c')]['id']}})['then'](function(_0x2c19dc){return db[_0x27e3('0x59')]['transaction'](function(_0x316309){return _0x2c19dc['removeTeams'](_0x26581a[_0x27e3('0x27')][_0x27e3('0x55')],{'transaction':_0x316309})['then'](function(){if(!_[_0x27e3('0x72')](_0x3677b4)){return _0x2c19dc[_0x27e3('0x73')](_0x3677b4,{'transaction':_0x316309});}})[_0x27e3('0x17')](function(){_0x3677b4['forEach'](function(_0x53684c){socket[_0x27e3('0x5d')](_0x27e3('0x74'),{'UserId':_0x53684c,'OpenchannelQueueId':_0x2c19dc['id']});});});});});});})[_0x27e3('0x17')](respondWithStatusCode(_0x1e53a4,null))['catch'](handleError(_0x1e53a4,null));};exports[_0x27e3('0x75')]=function(_0x369b8e,_0xde4dae){return db[_0x27e3('0x1f')][_0x27e3('0x35')]({'where':{'id':_0x369b8e[_0x27e3('0x2c')]['id']}})[_0x27e3('0x17')](handleEntityNotFound(_0xde4dae,null))['then'](function(_0x5b02de){if(_0x5b02de){return _0x5b02de[_0x27e3('0x75')](_0x369b8e[_0x27e3('0x37')][_0x27e3('0x55')],_[_0x27e3('0x76')](_0x369b8e[_0x27e3('0x37')],[_0x27e3('0x55'),'id'])||{})[_0x27e3('0x77')](function(_0x24d5ed){for(var _0x3cb8c3=0x0;_0x3cb8c3<_0x369b8e[_0x27e3('0x37')][_0x27e3('0x55')]['length'];_0x3cb8c3+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x369b8e['body'][_0x27e3('0x55')][_0x3cb8c3]),'OpenchannelQueueId':Number(_0x369b8e['params']['id'])});}return _0x24d5ed;});}})[_0x27e3('0x17')](respondWithResult(_0xde4dae,null))[_0x27e3('0x2a')](handleError(_0xde4dae,null));};exports[_0x27e3('0x73')]=function(_0x36c5fb,_0x38c3f7){return db[_0x27e3('0x1f')]['find']({'where':{'id':_0x36c5fb[_0x27e3('0x2c')]['id']}})[_0x27e3('0x17')](handleEntityNotFound(_0x38c3f7,null))[_0x27e3('0x17')](function(_0x24498b){if(_0x24498b){return _0x24498b[_0x27e3('0x73')](_0x36c5fb[_0x27e3('0x27')]['ids'])[_0x27e3('0x17')](function(){if(_[_0x27e3('0x78')](_0x36c5fb[_0x27e3('0x27')][_0x27e3('0x55')])){for(var _0x468a20=0x0;_0x468a20<_0x36c5fb[_0x27e3('0x27')][_0x27e3('0x55')][_0x27e3('0x42')];_0x468a20+=0x1){socket['emit'](_0x27e3('0x74'),{'UserId':Number(_0x36c5fb[_0x27e3('0x27')][_0x27e3('0x55')][_0x468a20]),'OpenchannelQueueId':Number(_0x36c5fb['params']['id'])});}}else{socket[_0x27e3('0x5d')](_0x27e3('0x74'),{'UserId':Number(_0x36c5fb[_0x27e3('0x27')]['ids']),'OpenchannelQueueId':Number(_0x36c5fb[_0x27e3('0x2c')]['id'])});}});}})[_0x27e3('0x17')](respondWithStatusCode(_0x38c3f7,null))['catch'](handleError(_0x38c3f7,null));};exports['getAgents']=function(_0x82fd01,_0x2a8eb0){var _0xca76f5={};var _0x2f534c={};var _0x25faa0;var _0x269835;return db[_0x27e3('0x1f')][_0x27e3('0x40')]({'where':{'id':_0x82fd01[_0x27e3('0x2c')]['id']}})[_0x27e3('0x17')](handleEntityNotFound(_0x2a8eb0,null))[_0x27e3('0x17')](function(_0x2bfdeb){if(_0x2bfdeb){_0x25faa0=_0x2bfdeb;_0x2f534c[_0x27e3('0x2d')]=_['keys'](db[_0x27e3('0x4b')]['rawAttributes']);_0x2f534c[_0x27e3('0x27')]=_['keys'](_0x82fd01['query']);_0x2f534c['filters']=_[_0x27e3('0x30')](_0x2f534c[_0x27e3('0x2d')],_0x2f534c[_0x27e3('0x27')]);_0xca76f5[_0x27e3('0x31')]=_[_0x27e3('0x30')](_0x2f534c['model'],qs['fields'](_0x82fd01[_0x27e3('0x27')][_0x27e3('0x32')]));_0xca76f5[_0x27e3('0x31')]=_0xca76f5[_0x27e3('0x31')][_0x27e3('0x42')]?_0xca76f5[_0x27e3('0x31')]:_0x2f534c[_0x27e3('0x2d')];_0xca76f5[_0x27e3('0x45')]=qs[_0x27e3('0x46')](_0x82fd01['query'][_0x27e3('0x46')]);_0xca76f5[_0x27e3('0x25')]=qs['filters'](_[_0x27e3('0x47')](_0x82fd01[_0x27e3('0x27')],_0x2f534c['filters']));if(_0x82fd01[_0x27e3('0x27')][_0x27e3('0x49')]){_0xca76f5[_0x27e3('0x25')]=_['merge'](_0xca76f5[_0x27e3('0x25')],{'$or':_[_0x27e3('0x4a')](_0xca76f5['attributes'],function(_0x14ac77){var _0x5542b2={};_0x5542b2[_0x14ac77]={'$like':'%'+_0x82fd01[_0x27e3('0x27')][_0x27e3('0x49')]+'%'};return _0x5542b2;})});}_0xca76f5=_['merge']({},_0xca76f5,_0x82fd01[_0x27e3('0x34')]);return _0x25faa0[_0x27e3('0x79')](_0xca76f5);}})['then'](function(_0x3d3d1d){if(_0x3d3d1d){_0x269835=_0x3d3d1d[_0x27e3('0x42')];if(!_0x82fd01[_0x27e3('0x27')][_0x27e3('0x43')]('nolimit')){_0xca76f5[_0x27e3('0x11')]=qs[_0x27e3('0x11')](_0x82fd01[_0x27e3('0x27')][_0x27e3('0x11')]);_0xca76f5[_0x27e3('0x10')]=qs[_0x27e3('0x10')](_0x82fd01[_0x27e3('0x27')]['offset']);}return _0x25faa0[_0x27e3('0x79')](_0xca76f5);}})[_0x27e3('0x17')](function(_0x40a5cb){if(_0x40a5cb){return _0x40a5cb?{'count':_0x269835,'rows':_0x40a5cb}:null;}})[_0x27e3('0x17')](respondWithResult(_0x2a8eb0,null))[_0x27e3('0x2a')](handleError(_0x2a8eb0,null));}; \ No newline at end of file +var _0x5f13=['register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','rows','catch','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','params','nolimit','order','sort','OpenchannelQueueId','filter','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','openchannelPause','getTeams','Team','pick','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0xbf757d,_0x4791e4){var _0x139f7f=function(_0x4e2a55){while(--_0x4e2a55){_0xbf757d['push'](_0xbf757d['shift']());}};_0x139f7f(++_0x4791e4);}(_0x5f13,0x163));var _0x35f1=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x5f13[_0x491a7f];return _0x3d8f44;};'use strict';var BPromise=require(_0x35f1('0x0'));var util=require(_0x35f1('0x1'));var _=require(_0x35f1('0x2'));var squel=require(_0x35f1('0x3'));var Redis=require(_0x35f1('0x4'));var qs=require(_0x35f1('0x5'));var logger=require(_0x35f1('0x6'))(_0x35f1('0x7'));var config=require(_0x35f1('0x8'));var db=require(_0x35f1('0x9'))['db'];config[_0x35f1('0xa')]=_[_0x35f1('0xb')](config[_0x35f1('0xa')],{'host':_0x35f1('0xc'),'port':0x18eb});var socket=require(_0x35f1('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x35f1('0xe')](socket);function respondWithStatusCode(_0x4a2ffa,_0x45fe66){_0x45fe66=_0x45fe66||0xcc;return function(_0x2e445a){if(_0x2e445a){return _0x4a2ffa[_0x35f1('0xf')](_0x45fe66);}return _0x4a2ffa[_0x35f1('0x10')](_0x45fe66)[_0x35f1('0x11')]();};}function respondWithResult(_0x485292,_0xe1b52d){_0xe1b52d=_0xe1b52d||0xc8;return function(_0x59540c){if(_0x59540c){return _0x485292[_0x35f1('0x10')](_0xe1b52d)[_0x35f1('0x12')](_0x59540c);}};}function respondWithFilteredResult(_0x565807,_0x12ac8f){return function(_0x445e10){if(_0x445e10){var _0x4066a8=typeof _0x12ac8f[_0x35f1('0x13')]===_0x35f1('0x14')&&typeof _0x12ac8f[_0x35f1('0x15')]===_0x35f1('0x14');var _0x1fa205=_0x445e10['count'];var _0x466f54=_0x4066a8?0x0:_0x12ac8f[_0x35f1('0x13')];var _0x55a45e=_0x4066a8?_0x445e10[_0x35f1('0x16')]:_0x12ac8f[_0x35f1('0x13')]+_0x12ac8f[_0x35f1('0x15')];var _0x3b0913;if(_0x55a45e>=_0x1fa205){_0x55a45e=_0x1fa205;_0x3b0913=0xc8;}else{_0x3b0913=0xce;}_0x565807[_0x35f1('0x10')](_0x3b0913);return _0x565807[_0x35f1('0x17')](_0x35f1('0x18'),_0x466f54+'-'+_0x55a45e+'/'+_0x1fa205)[_0x35f1('0x12')](_0x445e10);}return null;};}function saveUpdates(_0x2f4d42){return function(_0xdaf536){if(_0xdaf536){return _0xdaf536['update'](_0x2f4d42)[_0x35f1('0x19')](function(_0x2ef419){return _0x2ef419;});}return null;};}function removeEntity(_0x36a0aa){return function(_0x413b02){if(_0x413b02){return _0x413b02[_0x35f1('0x1a')]()['then'](function(){var _0x5dd6c9=_0x413b02[_0x35f1('0x1b')]({'plain':!![]});var _0x4cbb0b=_0x35f1('0x1c');return db[_0x35f1('0x1d')]['destroy']({'where':{'type':_0x4cbb0b,'resourceId':_0x5dd6c9['id']}})[_0x35f1('0x19')](function(){return _0x413b02;});})['then'](function(){_0x36a0aa[_0x35f1('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x503b47){return function(_0x6cb7bd){if(!_0x6cb7bd){_0x503b47[_0x35f1('0xf')](0x194);}return _0x6cb7bd;};}function handleError(_0x2438b5,_0x2fca2d){_0x2fca2d=_0x2fca2d||0x1f4;return function(_0xc2df8d){logger[_0x35f1('0x1e')](_0xc2df8d[_0x35f1('0x1f')]);if(_0xc2df8d[_0x35f1('0x20')]){delete _0xc2df8d[_0x35f1('0x20')];}_0x2438b5[_0x35f1('0x10')](_0x2fca2d)['send'](_0xc2df8d);};}exports['index']=function(_0x1ef99f,_0x5cee82){var _0x390ba1={};var _0x5f36ab={'count':0x0,'rows':[]};var _0x19cdb4=_[_0x35f1('0x21')](db[_0x35f1('0x22')][_0x35f1('0x23')],function(_0x199fad){return{'name':_0x199fad[_0x35f1('0x24')],'type':_0x199fad[_0x35f1('0x25')][_0x35f1('0x26')]};});_0x390ba1=qs[_0x35f1('0x27')](_0x19cdb4,_0x1ef99f);var _0x187a29={'where':_0x390ba1[_0x35f1('0x28')]};return db['OpenchannelQueue'][_0x35f1('0x16')](_0x187a29)['then'](function(_0x26e94a){_0x5f36ab[_0x35f1('0x16')]=_0x26e94a;_0x390ba1[_0x35f1('0x29')]=qs[_0x35f1('0x29')](_0x1ef99f[_0x35f1('0x2a')]);return db[_0x35f1('0x22')]['findAll'](_0x390ba1);})[_0x35f1('0x19')](function(_0x25cb61){_0x5f36ab[_0x35f1('0x2b')]=_0x25cb61;return _0x5f36ab;})['then'](respondWithFilteredResult(_0x5cee82,_0x390ba1))[_0x35f1('0x2c')](handleError(_0x5cee82,null));};exports['show']=function(_0x3d4a60,_0x1f6684){var _0x53044f={'raw':!![],'where':{'id':_0x3d4a60['params']['id']}},_0x42e611={};_0x42e611[_0x35f1('0x2d')]=_[_0x35f1('0x2e')](db[_0x35f1('0x22')]['rawAttributes']);_0x42e611[_0x35f1('0x2a')]=_[_0x35f1('0x2e')](_0x3d4a60[_0x35f1('0x2a')]);_0x42e611[_0x35f1('0x2f')]=_[_0x35f1('0x30')](_0x42e611[_0x35f1('0x2d')],_0x42e611[_0x35f1('0x2a')]);_0x53044f[_0x35f1('0x31')]=_[_0x35f1('0x30')](_0x42e611[_0x35f1('0x2d')],qs[_0x35f1('0x32')](_0x3d4a60[_0x35f1('0x2a')]['fields']));_0x53044f['attributes']=_0x53044f[_0x35f1('0x31')][_0x35f1('0x33')]?_0x53044f[_0x35f1('0x31')]:_0x42e611[_0x35f1('0x2d')];if(_0x3d4a60['query'][_0x35f1('0x34')]){_0x53044f[_0x35f1('0x29')]=[{'all':!![]}];}_0x53044f=_[_0x35f1('0x35')]({},_0x53044f,_0x3d4a60[_0x35f1('0x36')]);return db[_0x35f1('0x22')][_0x35f1('0x37')](_0x53044f)[_0x35f1('0x19')](handleEntityNotFound(_0x1f6684,null))[_0x35f1('0x19')](respondWithResult(_0x1f6684,null))['catch'](handleError(_0x1f6684,null));};exports[_0x35f1('0x38')]=function(_0x3d9d09,_0x3bb070){return db[_0x35f1('0x22')][_0x35f1('0x38')](_0x3d9d09[_0x35f1('0x39')],{})[_0x35f1('0x19')](function(_0xf2391){var _0x29d63c=_0x3d9d09['user'][_0x35f1('0x1b')]({'plain':!![]});if(!_0x29d63c)throw new Error(_0x35f1('0x3a'));if(_0x29d63c[_0x35f1('0x3b')]==='user'){var _0x2a7ce7=_0xf2391['get']({'plain':!![]});var _0x551e68=_0x35f1('0x1c');return db[_0x35f1('0x3c')][_0x35f1('0x37')]({'where':{'name':_0x551e68,'userProfileId':_0x29d63c[_0x35f1('0x3d')]},'raw':!![]})['then'](function(_0x1ce795){if(_0x1ce795&&_0x1ce795[_0x35f1('0x3e')]===0x0){return db['UserProfileResource'][_0x35f1('0x38')]({'name':_0x2a7ce7['name'],'resourceId':_0x2a7ce7['id'],'type':_0x1ce795['name'],'sectionId':_0x1ce795['id']},{})[_0x35f1('0x19')](function(){return _0xf2391;});}else{return _0xf2391;}})[_0x35f1('0x2c')](function(_0x43cb47){logger[_0x35f1('0x1e')](_0x35f1('0x3f'),_0x43cb47);throw _0x43cb47;});}return _0xf2391;})[_0x35f1('0x19')](respondWithResult(_0x3bb070,0xc9))[_0x35f1('0x2c')](handleError(_0x3bb070,null));};exports[_0x35f1('0x40')]=function(_0x3273ed,_0x14e2d1){if(_0x3273ed[_0x35f1('0x39')]['id']){delete _0x3273ed[_0x35f1('0x39')]['id'];}return db[_0x35f1('0x22')]['find']({'where':{'id':_0x3273ed['params']['id']}})[_0x35f1('0x19')](handleEntityNotFound(_0x14e2d1,null))[_0x35f1('0x19')](saveUpdates(_0x3273ed[_0x35f1('0x39')],null))[_0x35f1('0x19')](respondWithResult(_0x14e2d1,null))[_0x35f1('0x2c')](handleError(_0x14e2d1,null));};exports[_0x35f1('0x1a')]=function(_0x39264e,_0x1232ab){return db['OpenchannelQueue'][_0x35f1('0x37')]({'where':{'id':_0x39264e['params']['id']}})[_0x35f1('0x19')](handleEntityNotFound(_0x1232ab,null))['then'](removeEntity(_0x1232ab,null))[_0x35f1('0x2c')](handleError(_0x1232ab,null));};exports[_0x35f1('0x41')]=function(_0x534052,_0x42c004){return db[_0x35f1('0x22')]['describe']()['then'](respondWithResult(_0x42c004,null))['catch'](handleError(_0x42c004,null));};exports['getMembers']=function(_0x2919e6,_0x52dd9f){var _0x382fd0={'raw':!![],'where':{}},_0x4c171c={},_0x2b0778;return db[_0x35f1('0x22')][_0x35f1('0x42')]({'where':{'id':_0x2919e6[_0x35f1('0x43')]['id']}})[_0x35f1('0x19')](handleEntityNotFound(_0x52dd9f,null))[_0x35f1('0x19')](function(_0x375010){if(_0x375010){_0x2b0778=_0x375010[_0x35f1('0x1b')]({'plain':!![]});_0x4c171c[_0x35f1('0x2d')]=_[_0x35f1('0x2e')](db['UserOpenchannelQueue'][_0x35f1('0x23')]);_0x4c171c[_0x35f1('0x2a')]=_['keys'](_0x2919e6[_0x35f1('0x2a')]);_0x4c171c[_0x35f1('0x2f')]=_['intersection'](_0x4c171c['model'],_0x4c171c[_0x35f1('0x2a')]);_0x382fd0[_0x35f1('0x31')]=_[_0x35f1('0x30')](_0x4c171c['model'],qs['fields'](_0x2919e6[_0x35f1('0x2a')]['fields']));_0x382fd0[_0x35f1('0x31')]=_0x382fd0[_0x35f1('0x31')][_0x35f1('0x33')]?_0x382fd0[_0x35f1('0x31')]:_0x4c171c[_0x35f1('0x2d')];if(!_0x2919e6[_0x35f1('0x2a')]['hasOwnProperty'](_0x35f1('0x44'))){_0x382fd0[_0x35f1('0x15')]=qs[_0x35f1('0x15')](_0x2919e6['query'][_0x35f1('0x15')]);_0x382fd0['offset']=qs[_0x35f1('0x13')](_0x2919e6['query'][_0x35f1('0x13')]);}_0x382fd0[_0x35f1('0x45')]=qs[_0x35f1('0x46')](_0x2919e6[_0x35f1('0x2a')][_0x35f1('0x46')]);_0x382fd0[_0x35f1('0x28')]=qs[_0x35f1('0x2f')](_['pick'](_0x2919e6[_0x35f1('0x2a')],_0x4c171c[_0x35f1('0x2f')]));_0x382fd0[_0x35f1('0x28')][_0x35f1('0x47')]=_0x375010['id'];if(_0x2919e6[_0x35f1('0x2a')]['filter']){_0x382fd0['where']=_['merge'](_0x382fd0['where'],{'$or':_[_0x35f1('0x21')](_0x382fd0[_0x35f1('0x31')],function(_0x97c658){var _0x374126={};_0x374126[_0x97c658]={'$like':'%'+_0x2919e6['query'][_0x35f1('0x48')]+'%'};return _0x374126;})});}_0x382fd0=_['merge']({},_0x382fd0,_0x2919e6[_0x35f1('0x36')]);return db[_0x35f1('0x49')][_0x35f1('0x4a')](_0x382fd0);}})[_0x35f1('0x19')](function(_0x1ad9da){if(_0x1ad9da){return db[_0x35f1('0x4b')][_0x35f1('0x4c')]({'where':{'id':_[_0x35f1('0x21')](_0x1ad9da,_0x35f1('0x4d')),'role':_0x35f1('0x4e')},'attributes':['id','name','openchannelPause',_0x35f1('0x4f'),_0x35f1('0x50')]});}})[_0x35f1('0x19')](function(_0x101d79){if(_0x101d79){return{'count':_0x101d79[_0x35f1('0x16')],'rows':_[_0x35f1('0x21')](_0x101d79[_0x35f1('0x2b')],function(_0x540054){return{'membername':_0x540054[_0x35f1('0x20')],'UserId':_0x540054['id'],'queue_name':_0x2b0778[_0x35f1('0x20')],'OpenchannelQueueId':_0x2b0778['id'],'interface':util['format'](_0x35f1('0x51'),_0x35f1('0x52'),_0x540054[_0x35f1('0x20')]),'penalty':0x0,'paused':_0x540054[_0x35f1('0x53')],'createdAt':_0x540054[_0x35f1('0x50')],'updatedAt':_0x540054[_0x35f1('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x35f1('0x19')](respondWithFilteredResult(_0x52dd9f,_0x382fd0))['catch'](handleError(_0x52dd9f,null));};exports[_0x35f1('0x54')]=function(_0x2732fa,_0x1d5dc4){var _0x29a3f5={};var _0x39dca9={};var _0x3d51c7;var _0x6ee4ca;return db['OpenchannelQueue'][_0x35f1('0x42')]({'where':{'id':_0x2732fa['params']['id']}})[_0x35f1('0x19')](handleEntityNotFound(_0x1d5dc4,null))[_0x35f1('0x19')](function(_0x40c279){if(_0x40c279){_0x3d51c7=_0x40c279;_0x39dca9[_0x35f1('0x2d')]=_[_0x35f1('0x2e')](db[_0x35f1('0x55')][_0x35f1('0x23')]);_0x39dca9[_0x35f1('0x2a')]=_[_0x35f1('0x2e')](_0x2732fa[_0x35f1('0x2a')]);_0x39dca9[_0x35f1('0x2f')]=_[_0x35f1('0x30')](_0x39dca9['model'],_0x39dca9['query']);_0x29a3f5[_0x35f1('0x31')]=_[_0x35f1('0x30')](_0x39dca9[_0x35f1('0x2d')],qs[_0x35f1('0x32')](_0x2732fa[_0x35f1('0x2a')][_0x35f1('0x32')]));_0x29a3f5[_0x35f1('0x31')]=_0x29a3f5['attributes'][_0x35f1('0x33')]?_0x29a3f5['attributes']:_0x39dca9[_0x35f1('0x2d')];_0x29a3f5['order']=qs[_0x35f1('0x46')](_0x2732fa['query'][_0x35f1('0x46')]);_0x29a3f5['where']=qs[_0x35f1('0x2f')](_[_0x35f1('0x56')](_0x2732fa[_0x35f1('0x2a')],_0x39dca9[_0x35f1('0x2f')]));if(_0x2732fa[_0x35f1('0x2a')][_0x35f1('0x48')]){_0x29a3f5['where']=_[_0x35f1('0x35')](_0x29a3f5[_0x35f1('0x28')],{'$or':_[_0x35f1('0x21')](_0x29a3f5[_0x35f1('0x31')],function(_0xc98c2){var _0x4665eb={};_0x4665eb[_0xc98c2]={'$like':'%'+_0x2732fa[_0x35f1('0x2a')][_0x35f1('0x48')]+'%'};return _0x4665eb;})});}_0x29a3f5=_['merge']({},_0x29a3f5,_0x2732fa['options']);return _0x3d51c7['getTeams'](_0x29a3f5);}})[_0x35f1('0x19')](function(_0x2ecdb7){if(_0x2ecdb7){_0x6ee4ca=_0x2ecdb7[_0x35f1('0x33')];if(!_0x2732fa[_0x35f1('0x2a')][_0x35f1('0x57')](_0x35f1('0x44'))){_0x29a3f5[_0x35f1('0x15')]=qs[_0x35f1('0x15')](_0x2732fa[_0x35f1('0x2a')]['limit']);_0x29a3f5[_0x35f1('0x13')]=qs['offset'](_0x2732fa[_0x35f1('0x2a')][_0x35f1('0x13')]);}return _0x3d51c7[_0x35f1('0x54')](_0x29a3f5);}})[_0x35f1('0x19')](function(_0x3a6f94){if(_0x3a6f94){return _0x3a6f94?{'count':_0x6ee4ca,'rows':_0x3a6f94}:null;}})[_0x35f1('0x19')](respondWithResult(_0x1d5dc4,null))['catch'](handleError(_0x1d5dc4,null));};exports[_0x35f1('0x58')]=function(_0x3a2641,_0x12fbe3){var _0x412318=_0x3a2641[_0x35f1('0x39')][_0x35f1('0x59')];return db[_0x35f1('0x55')][_0x35f1('0x4a')]({'where':{'id':_0x412318},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35f1('0x5a'),'attributes':['id',_0x35f1('0x20'),_0x35f1('0x5b'),_0x35f1('0x5c'),_0x35f1('0x5d')],'raw':!![]}]})[_0x35f1('0x19')](function(_0x3e4ee0){if(_0x3e4ee0){var _0x2e95e8=_[_0x35f1('0x5e')](_0x3e4ee0,function(_0x266f10){var _0x508033=_0x266f10[_0x35f1('0x1b')]({'plain':!![]});return _0x508033['Agents'];});return db[_0x35f1('0x22')][_0x35f1('0x37')]({'where':{'id':_0x3a2641[_0x35f1('0x43')]['id']}})[_0x35f1('0x19')](function(_0x357237){return db['sequelize'][_0x35f1('0x5f')](function(_0x1ffa73){return _0x357237['addTeams'](_0x412318,{'transaction':_0x1ffa73})[_0x35f1('0x19')](function(){return BPromise['each'](_0x2e95e8,function(_0xfffb69){return db['UserOpenchannelQueue'][_0x35f1('0x60')]({'where':{'UserId':_0xfffb69['id'],'OpenchannelQueueId':_0x3a2641[_0x35f1('0x43')]['id']},'transaction':_0x1ffa73});});})[_0x35f1('0x19')](function(){_0x2e95e8[_0x35f1('0x61')](function(_0x56d827){socket[_0x35f1('0x62')](_0x35f1('0x63'),{'UserId':_0x56d827['id'],'OpenchannelQueueId':_0x357237['id']});});});});});}})[_0x35f1('0x19')](respondWithStatusCode(_0x12fbe3,null))[_0x35f1('0x2c')](handleError(_0x12fbe3,null));};exports[_0x35f1('0x64')]=function(_0x44aff6,_0x591856){return db[_0x35f1('0x55')][_0x35f1('0x4a')]({'where':{'id':_0x44aff6[_0x35f1('0x2a')][_0x35f1('0x59')]},'attributes':['id'],'include':[{'model':db[_0x35f1('0x4b')],'as':_0x35f1('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x35f1('0x19')](handleEntityNotFound(_0x591856,null))['then'](function(_0x17dcb6){var _0x477cb7=_[_0x35f1('0x21')](_0x17dcb6,'id');var _0x2243c6=[];var _0x3ab5f6=[];var _0x397e4f=squel['select']();_0x397e4f[_0x35f1('0x65')]('tq.TeamId')[_0x35f1('0x66')](_0x35f1('0x67'),'tq')['join']('user_has_teams','ut',_0x35f1('0x68'))[_0x35f1('0x28')](_0x35f1('0x69'),_0x44aff6[_0x35f1('0x43')]['id']);for(var _0x3fa50b=0x0;_0x3fa50b<_0x17dcb6[_0x35f1('0x33')];_0x3fa50b+=0x1){let _0x7ad613=_0x17dcb6[_0x3fa50b];for(var _0x2bafd9=0x0;_0x2bafd9<_0x7ad613[_0x35f1('0x5a')][_0x35f1('0x33')];_0x2bafd9+=0x1){let _0x2da150=_0x7ad613[_0x35f1('0x5a')][_0x2bafd9];var _0x165762=_0x397e4f['clone']();_0x165762[_0x35f1('0x28')]('ut.UserId\x20=\x20?',_0x2da150['id']);_0x3ab5f6['push'](db['sequelize'][_0x35f1('0x2a')](_0x165762[_0x35f1('0x6a')](),{'type':db[_0x35f1('0x6b')][_0x35f1('0x6c')][_0x35f1('0x6d')]})[_0x35f1('0x19')](function(_0x24feb7){if(_0x24feb7[_0x35f1('0x33')]===0x1){return _0x2da150['id'];}else{var _0xc4ea39=_['every'](_[_0x35f1('0x21')](_0x24feb7,_0x35f1('0x6e')),function(_0x44d56f){return _[_0x35f1('0x6f')](_0x477cb7,_0x44d56f);});if(_0xc4ea39){return _0x2da150['id'];}}}));}}return BPromise[_0x35f1('0x70')](_0x3ab5f6)[_0x35f1('0x19')](function(_0x440878){_0x2243c6=_(_0x2243c6)[_0x35f1('0x71')](_0x440878)[_0x35f1('0x72')]()[_0x35f1('0x73')]();return db[_0x35f1('0x22')][_0x35f1('0x37')]({'where':{'id':_0x44aff6[_0x35f1('0x43')]['id']}})[_0x35f1('0x19')](function(_0x59e17f){return db[_0x35f1('0x6b')]['transaction'](function(_0x1c9772){return _0x59e17f[_0x35f1('0x64')](_0x44aff6[_0x35f1('0x2a')][_0x35f1('0x59')],{'transaction':_0x1c9772})[_0x35f1('0x19')](function(){if(!_[_0x35f1('0x74')](_0x2243c6)){return _0x59e17f[_0x35f1('0x75')](_0x2243c6,{'transaction':_0x1c9772});}})['then'](function(){_0x2243c6[_0x35f1('0x61')](function(_0xde5f0b){socket[_0x35f1('0x62')](_0x35f1('0x76'),{'UserId':_0xde5f0b,'OpenchannelQueueId':_0x59e17f['id']});});});});});});})[_0x35f1('0x19')](respondWithStatusCode(_0x591856,null))['catch'](handleError(_0x591856,null));};exports[_0x35f1('0x77')]=function(_0x2bd3a9,_0x530c90){return db[_0x35f1('0x22')][_0x35f1('0x37')]({'where':{'id':_0x2bd3a9[_0x35f1('0x43')]['id']}})[_0x35f1('0x19')](handleEntityNotFound(_0x530c90,null))[_0x35f1('0x19')](function(_0x1afe50){if(_0x1afe50){return _0x1afe50[_0x35f1('0x77')](_0x2bd3a9[_0x35f1('0x39')][_0x35f1('0x59')],_[_0x35f1('0x78')](_0x2bd3a9[_0x35f1('0x39')],[_0x35f1('0x59'),'id'])||{})['spread'](function(_0x42d1ad){for(var _0x42dc33=0x0;_0x42dc33<_0x2bd3a9['body'][_0x35f1('0x59')][_0x35f1('0x33')];_0x42dc33+=0x1){socket[_0x35f1('0x62')]('userOpenchannelQueue:save',{'UserId':Number(_0x2bd3a9['body']['ids'][_0x42dc33]),'OpenchannelQueueId':Number(_0x2bd3a9[_0x35f1('0x43')]['id'])});}return _0x42d1ad;});}})[_0x35f1('0x19')](respondWithResult(_0x530c90,null))[_0x35f1('0x2c')](handleError(_0x530c90,null));};exports[_0x35f1('0x75')]=function(_0x187316,_0x2fcde1){return db['OpenchannelQueue'][_0x35f1('0x37')]({'where':{'id':_0x187316['params']['id']}})['then'](handleEntityNotFound(_0x2fcde1,null))['then'](function(_0x32a9f5){if(_0x32a9f5){return _0x32a9f5[_0x35f1('0x75')](_0x187316[_0x35f1('0x2a')][_0x35f1('0x59')])['then'](function(){if(_[_0x35f1('0x79')](_0x187316['query'][_0x35f1('0x59')])){for(var _0x4aafdd=0x0;_0x4aafdd<_0x187316['query']['ids']['length'];_0x4aafdd+=0x1){socket[_0x35f1('0x62')](_0x35f1('0x76'),{'UserId':Number(_0x187316[_0x35f1('0x2a')]['ids'][_0x4aafdd]),'OpenchannelQueueId':Number(_0x187316[_0x35f1('0x43')]['id'])});}}else{socket[_0x35f1('0x62')]('userOpenchannelQueue:remove',{'UserId':Number(_0x187316[_0x35f1('0x2a')][_0x35f1('0x59')]),'OpenchannelQueueId':Number(_0x187316['params']['id'])});}});}})[_0x35f1('0x19')](respondWithStatusCode(_0x2fcde1,null))[_0x35f1('0x2c')](handleError(_0x2fcde1,null));};exports[_0x35f1('0x7a')]=function(_0x1c07b4,_0x5c3e92){var _0x196715={};var _0x4ab0a7={};var _0x20dd6f;var _0x17593e;return db[_0x35f1('0x22')][_0x35f1('0x42')]({'where':{'id':_0x1c07b4[_0x35f1('0x43')]['id']}})[_0x35f1('0x19')](handleEntityNotFound(_0x5c3e92,null))[_0x35f1('0x19')](function(_0x10e109){if(_0x10e109){_0x20dd6f=_0x10e109;_0x4ab0a7['model']=_[_0x35f1('0x2e')](db['User'][_0x35f1('0x23')]);_0x4ab0a7['query']=_['keys'](_0x1c07b4['query']);_0x4ab0a7[_0x35f1('0x2f')]=_[_0x35f1('0x30')](_0x4ab0a7[_0x35f1('0x2d')],_0x4ab0a7[_0x35f1('0x2a')]);_0x196715['attributes']=_['intersection'](_0x4ab0a7[_0x35f1('0x2d')],qs['fields'](_0x1c07b4[_0x35f1('0x2a')][_0x35f1('0x32')]));_0x196715[_0x35f1('0x31')]=_0x196715['attributes'][_0x35f1('0x33')]?_0x196715['attributes']:_0x4ab0a7[_0x35f1('0x2d')];_0x196715['order']=qs['sort'](_0x1c07b4['query']['sort']);_0x196715[_0x35f1('0x28')]=qs[_0x35f1('0x2f')](_[_0x35f1('0x56')](_0x1c07b4[_0x35f1('0x2a')],_0x4ab0a7[_0x35f1('0x2f')]));if(_0x1c07b4[_0x35f1('0x2a')][_0x35f1('0x48')]){_0x196715[_0x35f1('0x28')]=_['merge'](_0x196715['where'],{'$or':_['map'](_0x196715[_0x35f1('0x31')],function(_0x28e144){var _0x4fd13b={};_0x4fd13b[_0x28e144]={'$like':'%'+_0x1c07b4[_0x35f1('0x2a')][_0x35f1('0x48')]+'%'};return _0x4fd13b;})});}_0x196715=_[_0x35f1('0x35')]({},_0x196715,_0x1c07b4[_0x35f1('0x36')]);return _0x20dd6f['getAgents'](_0x196715);}})['then'](function(_0x491d7c){if(_0x491d7c){_0x17593e=_0x491d7c['length'];if(!_0x1c07b4[_0x35f1('0x2a')][_0x35f1('0x57')](_0x35f1('0x44'))){_0x196715['limit']=qs['limit'](_0x1c07b4[_0x35f1('0x2a')][_0x35f1('0x15')]);_0x196715[_0x35f1('0x13')]=qs['offset'](_0x1c07b4['query'][_0x35f1('0x13')]);}return _0x20dd6f['getAgents'](_0x196715);}})[_0x35f1('0x19')](function(_0x1ed61f){if(_0x1ed61f){return _0x1ed61f?{'count':_0x17593e,'rows':_0x1ed61f}:null;}})['then'](respondWithResult(_0x5c3e92,null))['catch'](handleError(_0x5c3e92,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 235b196..0d70235 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 _0x1bfe=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x14e207,_0x14f71c){var _0x5f2b53=function(_0x1b556b){while(--_0x1b556b){_0x14e207['push'](_0x14e207['shift']());}};_0x5f2b53(++_0x14f71c);}(_0x1bfe,0x186));var _0xe1bf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1bfe[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xe1bf('0x0'))['db'][_0xe1bf('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe1bf('0x2')](0x0);var events={'afterCreate':_0xe1bf('0x3'),'afterUpdate':_0xe1bf('0x4'),'afterDestroy':_0xe1bf('0x5')};function emitEvent(_0x195286){return function(_0x4e0aa1,_0xb43081,_0x4f06c9){OpenchannelQueueEvents[_0xe1bf('0x6')](_0x195286+':'+_0x4e0aa1['id'],_0x4e0aa1);OpenchannelQueueEvents[_0xe1bf('0x6')](_0x195286,_0x4e0aa1);_0x4f06c9(null);};}for(var e in events){if(events[_0xe1bf('0x7')](e)){var event=events[e];OpenchannelQueue[_0xe1bf('0x8')](e,emitEvent(event));}}module[_0xe1bf('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xee2c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove'];(function(_0x10f17c,_0x25a5f8){var _0x53702b=function(_0x38ec8e){while(--_0x38ec8e){_0x10f17c['push'](_0x10f17c['shift']());}};_0x53702b(++_0x25a5f8);}(_0xee2c,0xf4));var _0xcee2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xee2c[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0xcee2('0x0'));var OpenchannelQueue=require(_0xcee2('0x1'))['db'][_0xcee2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xcee2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcee2('0x4'),'afterDestroy':_0xcee2('0x5')};function emitEvent(_0x26f936){return function(_0x274151,_0x118a2a,_0x535ac4){OpenchannelQueueEvents[_0xcee2('0x6')](_0x26f936+':'+_0x274151['id'],_0x274151);OpenchannelQueueEvents['emit'](_0x26f936,_0x274151);_0x535ac4(null);};}for(var e in events){if(events[_0xcee2('0x7')](e)){var event=events[e];OpenchannelQueue[_0xcee2('0x8')](e,emitEvent(event));}}module[_0xcee2('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f1ad049..ee72ebb 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 _0xa49c=['../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5a3f9f,_0x905b05){var _0x1f9254=function(_0x195dc5){while(--_0x195dc5){_0x5a3f9f['push'](_0x5a3f9f['shift']());}};_0x1f9254(++_0x905b05);}(_0xa49c,0x190));var _0xca49=function(_0x1f23b1,_0x57c83f){_0x1f23b1=_0x1f23b1-0x0;var _0x3c9197=_0xa49c[_0x1f23b1];return _0x3c9197;};'use strict';var _=require(_0xca49('0x0'));var util=require(_0xca49('0x1'));var logger=require(_0xca49('0x2'))('api');var moment=require(_0xca49('0x3'));var BPromise=require(_0xca49('0x4'));var rp=require(_0xca49('0x5'));var fs=require('fs');var path=require(_0xca49('0x6'));var rimraf=require('rimraf');var config=require(_0xca49('0x7'));var attributes=require(_0xca49('0x8'));module[_0xca49('0x9')]=function(_0x3ee925,_0x59ab42){return _0x3ee925['define'](_0xca49('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b52=['rimraf','../../config/environment','exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x0b52,0xf5));var _0x20b5=function(_0x1a861f,_0x2334c0){_0x1a861f=_0x1a861f-0x0;var _0x2e2248=_0x0b52[_0x1a861f];return _0x2e2248;};'use strict';var _=require(_0x20b5('0x0'));var util=require(_0x20b5('0x1'));var logger=require(_0x20b5('0x2'))(_0x20b5('0x3'));var moment=require(_0x20b5('0x4'));var BPromise=require(_0x20b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20b5('0x6'));var rimraf=require(_0x20b5('0x7'));var config=require(_0x20b5('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0x20b5('0x9')]=function(_0x372833,_0x982a59){return _0x372833['define'](_0x20b5('0xa'),attributes,{'tableName':_0x20b5('0xb'),'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 c12cbb4..c4c5382 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 _0xec49=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','request','then','debug','request\x20sent','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','GetOpenchannelQueue','stringify','catch','ShowOpenchannelQueue','find','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xec49,0xfd));var _0x9ec4=function(_0x44e1b7,_0x6b2760){_0x44e1b7=_0x44e1b7-0x0;var _0x1dd040=_0xec49[_0x44e1b7];return _0x1dd040;};'use strict';var _=require('lodash');var util=require(_0x9ec4('0x0'));var moment=require('moment');var BPromise=require(_0x9ec4('0x1'));var rs=require(_0x9ec4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ec4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ec4('0x4'))(_0x9ec4('0x5'));var config=require(_0x9ec4('0x6'));var jayson=require(_0x9ec4('0x7'));var client=jayson[_0x9ec4('0x8')]['http']({'port':0x232a});config[_0x9ec4('0x9')]=_[_0x9ec4('0xa')](config[_0x9ec4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ec4('0xb'))(new Redis(config[_0x9ec4('0x9')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x18f19a,_0x39002b,_0x4edaa0){return new BPromise(function(_0x2b454c,_0x57fedb){return client[_0x9ec4('0xc')](_0x18f19a,_0x4edaa0)[_0x9ec4('0xd')](function(_0x238efb){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x39002b,'request\x20sent');logger[_0x9ec4('0xe')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x39002b,_0x9ec4('0xf'),JSON['stringify'](_0x238efb));if(_0x238efb[_0x9ec4('0x10')]){if(_0x238efb[_0x9ec4('0x10')][_0x9ec4('0x11')]===0x1f4){logger['error'](_0x9ec4('0x12'),_0x39002b,_0x238efb['error'][_0x9ec4('0x13')]);return _0x57fedb(_0x238efb[_0x9ec4('0x10')][_0x9ec4('0x13')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x39002b,_0x238efb[_0x9ec4('0x10')]['message']);return _0x2b454c(_0x238efb[_0x9ec4('0x10')][_0x9ec4('0x13')]);}else{logger['info'](_0x9ec4('0x12'),_0x39002b,_0x9ec4('0xf'));_0x2b454c(_0x238efb[_0x9ec4('0x14')][_0x9ec4('0x13')]);}})['catch'](function(_0x56c4bc){logger[_0x9ec4('0x10')](_0x9ec4('0x12'),_0x39002b,_0x56c4bc);_0x57fedb(_0x56c4bc);});});}exports['GetOpenchannelQueue']=function(_0x2a1ffe){var _0x427701=this;return new Promise(function(_0x4006bd,_0x2711cf){return db[_0x9ec4('0x15')][_0x9ec4('0x16')]({'raw':_0x2a1ffe[_0x9ec4('0x17')]?_0x2a1ffe[_0x9ec4('0x17')][_0x9ec4('0x18')]===undefined?!![]:![]:!![],'where':_0x2a1ffe[_0x9ec4('0x17')]?_0x2a1ffe[_0x9ec4('0x17')][_0x9ec4('0x19')]||null:null,'attributes':_0x2a1ffe[_0x9ec4('0x17')]?_0x2a1ffe[_0x9ec4('0x17')][_0x9ec4('0x1a')]||null:null,'limit':_0x2a1ffe[_0x9ec4('0x17')]?_0x2a1ffe[_0x9ec4('0x17')][_0x9ec4('0x1b')]||null:null,'include':_0x2a1ffe[_0x9ec4('0x17')]?_0x2a1ffe[_0x9ec4('0x17')][_0x9ec4('0x1c')]?_[_0x9ec4('0x1d')](_0x2a1ffe[_0x9ec4('0x17')][_0x9ec4('0x1c')],function(_0x29cc88){return{'model':db[_0x29cc88[_0x9ec4('0x1e')]],'as':_0x29cc88['as'],'attributes':_0x29cc88[_0x9ec4('0x1a')],'include':_0x29cc88[_0x9ec4('0x1c')]?_[_0x9ec4('0x1d')](_0x29cc88['include'],function(_0x4a58e7){return{'model':db[_0x4a58e7[_0x9ec4('0x1e')]],'as':_0x4a58e7['as'],'attributes':_0x4a58e7['attributes'],'include':_0x4a58e7[_0x9ec4('0x1c')]?_[_0x9ec4('0x1d')](_0x4a58e7[_0x9ec4('0x1c')],function(_0x27cc11){return{'model':db[_0x27cc11['model']],'as':_0x27cc11['as'],'attributes':_0x27cc11[_0x9ec4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9ec4('0xd')](function(_0x594558){logger[_0x9ec4('0x1f')](_0x9ec4('0x20'),_0x2a1ffe);logger[_0x9ec4('0xe')](_0x9ec4('0x20'),_0x2a1ffe,JSON[_0x9ec4('0x21')](_0x594558));_0x4006bd(_0x594558);})[_0x9ec4('0x22')](function(_0x1d193f){logger[_0x9ec4('0x10')](_0x9ec4('0x20'),_0x1d193f[_0x9ec4('0x13')],_0x2a1ffe);_0x2711cf(_0x427701[_0x9ec4('0x10')](0x1f4,_0x1d193f[_0x9ec4('0x13')]));});});};exports[_0x9ec4('0x23')]=function(_0x793f2e){var _0x28ca82=this;return new Promise(function(_0x5d0914,_0x31981a){return db[_0x9ec4('0x15')][_0x9ec4('0x24')]({'raw':_0x793f2e[_0x9ec4('0x17')]?_0x793f2e[_0x9ec4('0x17')][_0x9ec4('0x18')]===undefined?!![]:![]:!![],'where':_0x793f2e[_0x9ec4('0x17')]?_0x793f2e[_0x9ec4('0x17')]['where']||null:null,'attributes':_0x793f2e[_0x9ec4('0x17')]?_0x793f2e[_0x9ec4('0x17')][_0x9ec4('0x1a')]||null:null,'include':_0x793f2e[_0x9ec4('0x17')]?_0x793f2e['options'][_0x9ec4('0x1c')]?_[_0x9ec4('0x1d')](_0x793f2e[_0x9ec4('0x17')][_0x9ec4('0x1c')],function(_0x5506c3){return{'model':db[_0x5506c3[_0x9ec4('0x1e')]],'as':_0x5506c3['as'],'attributes':_0x5506c3[_0x9ec4('0x1a')],'include':_0x5506c3['include']?_[_0x9ec4('0x1d')](_0x5506c3[_0x9ec4('0x1c')],function(_0x3cd386){return{'model':db[_0x3cd386[_0x9ec4('0x1e')]],'as':_0x3cd386['as'],'attributes':_0x3cd386[_0x9ec4('0x1a')],'include':_0x3cd386[_0x9ec4('0x1c')]?_['map'](_0x3cd386[_0x9ec4('0x1c')],function(_0x335cd8){return{'model':db[_0x335cd8[_0x9ec4('0x1e')]],'as':_0x335cd8['as'],'attributes':_0x335cd8[_0x9ec4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9ec4('0xd')](function(_0x3ad05d){logger['info'](_0x9ec4('0x23'),_0x793f2e);logger['debug']('ShowOpenchannelQueue',_0x793f2e,JSON[_0x9ec4('0x21')](_0x3ad05d));_0x5d0914(_0x3ad05d);})['catch'](function(_0x2af49c){logger['error']('ShowOpenchannelQueue',_0x2af49c[_0x9ec4('0x13')],_0x793f2e);_0x31981a(_0x28ca82[_0x9ec4('0x10')](0x1f4,_0x2af49c[_0x9ec4('0x13')]));});});}; \ No newline at end of file +var _0x4780=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x4780,0xaf));var _0x0478=function(_0x1ece5d,_0xca4936){_0x1ece5d=_0x1ece5d-0x0;var _0x3c2b25=_0x4780[_0x1ece5d];return _0x3c2b25;};'use strict';var _=require(_0x0478('0x0'));var util=require(_0x0478('0x1'));var moment=require(_0x0478('0x2'));var BPromise=require(_0x0478('0x3'));var rs=require(_0x0478('0x4'));var fs=require('fs');var Redis=require(_0x0478('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0478('0x6'));var logger=require('../../config/logger')(_0x0478('0x7'));var config=require(_0x0478('0x8'));var jayson=require(_0x0478('0x9'));var client=jayson['client'][_0x0478('0xa')]({'port':0x232a});config['redis']=_[_0x0478('0xb')](config['redis'],{'host':_0x0478('0xc'),'port':0x18eb});var socket=require(_0x0478('0xd'))(new Redis(config[_0x0478('0xe')]));require(_0x0478('0xf'))['register'](socket);function respondWithRpcPromise(_0x86639c,_0x1e1631,_0x396008){return new BPromise(function(_0x5b6103,_0x29baa1){return client[_0x0478('0x10')](_0x86639c,_0x396008)[_0x0478('0x11')](function(_0x2f1a93){logger[_0x0478('0x12')](_0x0478('0x13'),_0x1e1631,_0x0478('0x14'));logger[_0x0478('0x15')](_0x0478('0x16'),_0x1e1631,_0x0478('0x14'),JSON[_0x0478('0x17')](_0x2f1a93));if(_0x2f1a93[_0x0478('0x18')]){if(_0x2f1a93[_0x0478('0x18')]['code']===0x1f4){logger[_0x0478('0x18')](_0x0478('0x13'),_0x1e1631,_0x2f1a93[_0x0478('0x18')][_0x0478('0x19')]);return _0x29baa1(_0x2f1a93['error'][_0x0478('0x19')]);}logger[_0x0478('0x18')](_0x0478('0x13'),_0x1e1631,_0x2f1a93[_0x0478('0x18')][_0x0478('0x19')]);return _0x5b6103(_0x2f1a93[_0x0478('0x18')][_0x0478('0x19')]);}else{logger['info'](_0x0478('0x13'),_0x1e1631,'request\x20sent');_0x5b6103(_0x2f1a93['result'][_0x0478('0x19')]);}})[_0x0478('0x1a')](function(_0x477d5f){logger[_0x0478('0x18')](_0x0478('0x13'),_0x1e1631,_0x477d5f);_0x29baa1(_0x477d5f);});});}exports['GetOpenchannelQueue']=function(_0x53ddcc){var _0x281461=this;return new Promise(function(_0x63fe00,_0xaa168f){return db[_0x0478('0x1b')][_0x0478('0x1c')]({'raw':_0x53ddcc[_0x0478('0x1d')]?_0x53ddcc[_0x0478('0x1d')][_0x0478('0x1e')]===undefined?!![]:![]:!![],'where':_0x53ddcc[_0x0478('0x1d')]?_0x53ddcc[_0x0478('0x1d')][_0x0478('0x1f')]||null:null,'attributes':_0x53ddcc[_0x0478('0x1d')]?_0x53ddcc[_0x0478('0x1d')][_0x0478('0x20')]||null:null,'limit':_0x53ddcc[_0x0478('0x1d')]?_0x53ddcc['options'][_0x0478('0x21')]||null:null,'include':_0x53ddcc[_0x0478('0x1d')]?_0x53ddcc['options'][_0x0478('0x22')]?_[_0x0478('0x23')](_0x53ddcc[_0x0478('0x1d')][_0x0478('0x22')],function(_0x11ead7){return{'model':db[_0x11ead7['model']],'as':_0x11ead7['as'],'attributes':_0x11ead7[_0x0478('0x20')],'include':_0x11ead7[_0x0478('0x22')]?_['map'](_0x11ead7[_0x0478('0x22')],function(_0x173a3a){return{'model':db[_0x173a3a[_0x0478('0x24')]],'as':_0x173a3a['as'],'attributes':_0x173a3a[_0x0478('0x20')],'include':_0x173a3a[_0x0478('0x22')]?_[_0x0478('0x23')](_0x173a3a[_0x0478('0x22')],function(_0x179c06){return{'model':db[_0x179c06[_0x0478('0x24')]],'as':_0x179c06['as'],'attributes':_0x179c06['attributes']};}):[]};}):[]};}):[]:[]})[_0x0478('0x11')](function(_0x120456){logger[_0x0478('0x12')]('GetOpenchannelQueue',_0x53ddcc);logger[_0x0478('0x15')]('GetOpenchannelQueue',_0x53ddcc,JSON['stringify'](_0x120456));_0x63fe00(_0x120456);})['catch'](function(_0x410e3a){logger[_0x0478('0x18')](_0x0478('0x25'),_0x410e3a['message'],_0x53ddcc);_0xaa168f(_0x281461[_0x0478('0x18')](0x1f4,_0x410e3a[_0x0478('0x19')]));});});};exports[_0x0478('0x26')]=function(_0xcd2a45){var _0x8ae2c5=this;return new Promise(function(_0xbe9f42,_0x47e891){return db['OpenchannelQueue']['find']({'raw':_0xcd2a45[_0x0478('0x1d')]?_0xcd2a45[_0x0478('0x1d')][_0x0478('0x1e')]===undefined?!![]:![]:!![],'where':_0xcd2a45['options']?_0xcd2a45[_0x0478('0x1d')]['where']||null:null,'attributes':_0xcd2a45['options']?_0xcd2a45[_0x0478('0x1d')]['attributes']||null:null,'include':_0xcd2a45[_0x0478('0x1d')]?_0xcd2a45[_0x0478('0x1d')][_0x0478('0x22')]?_[_0x0478('0x23')](_0xcd2a45['options'][_0x0478('0x22')],function(_0x237c2b){return{'model':db[_0x237c2b[_0x0478('0x24')]],'as':_0x237c2b['as'],'attributes':_0x237c2b[_0x0478('0x20')],'include':_0x237c2b[_0x0478('0x22')]?_[_0x0478('0x23')](_0x237c2b[_0x0478('0x22')],function(_0x55290b){return{'model':db[_0x55290b[_0x0478('0x24')]],'as':_0x55290b['as'],'attributes':_0x55290b[_0x0478('0x20')],'include':_0x55290b['include']?_[_0x0478('0x23')](_0x55290b[_0x0478('0x22')],function(_0x1a7abb){return{'model':db[_0x1a7abb['model']],'as':_0x1a7abb['as'],'attributes':_0x1a7abb[_0x0478('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0478('0x11')](function(_0x52bc35){logger[_0x0478('0x12')](_0x0478('0x26'),_0xcd2a45);logger[_0x0478('0x15')](_0x0478('0x26'),_0xcd2a45,JSON['stringify'](_0x52bc35));_0xbe9f42(_0x52bc35);})[_0x0478('0x1a')](function(_0x431ec9){logger[_0x0478('0x18')](_0x0478('0x26'),_0x431ec9['message'],_0xcd2a45);_0x47e891(_0x8ae2c5['error'](0x1f4,_0x431ec9['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f20bdff..777b385 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 _0x7e46=['register','openchannelQueue:'];(function(_0x3a0c99,_0x1abfa1){var _0x2f741f=function(_0x3d8546){while(--_0x3d8546){_0x3a0c99['push'](_0x3a0c99['shift']());}};_0x2f741f(++_0x1abfa1);}(_0x7e46,0x1d4));var _0x67e4=function(_0x35f8f7,_0x332965){_0x35f8f7=_0x35f8f7-0x0;var _0x4f3301=_0x7e46[_0x35f8f7];return _0x4f3301;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove','update'];function createListener(_0xfcfdc3,_0x36c897){return function(_0x335b48){_0x36c897['emit'](_0xfcfdc3,_0x335b48);};}function removeListener(_0x8b03ea,_0x563ddd){return function(){OpenchannelQueueEvents['removeListener'](_0x8b03ea,_0x563ddd);};}exports[_0x67e4('0x0')]=function(_0x4b04df){for(var _0x3cf373=0x0,_0x30c432=events['length'];_0x3cf373<_0x30c432;_0x3cf373++){var _0x41f1c1=events[_0x3cf373];var _0x45f95b=createListener(_0x67e4('0x1')+_0x41f1c1,_0x4b04df);OpenchannelQueueEvents['on'](_0x41f1c1,_0x45f95b);}}; \ No newline at end of file +var _0x95ab=['length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x20329b,_0x57c147){var _0x3f8ac4=function(_0x30c436){while(--_0x30c436){_0x20329b['push'](_0x20329b['shift']());}};_0x3f8ac4(++_0x57c147);}(_0x95ab,0x107));var _0xb95a=function(_0x3deca3,_0x3b69ab){_0x3deca3=_0x3deca3-0x0;var _0x506acf=_0x95ab[_0x3deca3];return _0x506acf;};'use strict';var OpenchannelQueueEvents=require(_0xb95a('0x0'));var events=[_0xb95a('0x1'),_0xb95a('0x2'),_0xb95a('0x3')];function createListener(_0x20b081,_0x2acae4){return function(_0x158ac0){_0x2acae4[_0xb95a('0x4')](_0x20b081,_0x158ac0);};}function removeListener(_0x1bf252,_0x30f51c){return function(){OpenchannelQueueEvents[_0xb95a('0x5')](_0x1bf252,_0x30f51c);};}exports[_0xb95a('0x6')]=function(_0x6b0cd4){for(var _0x233f96=0x0,_0x5f40d7=events[_0xb95a('0x7')];_0x233f96<_0x5f40d7;_0x233f96++){var _0x53b622=events[_0x233f96];var _0x363646=createListener(_0xb95a('0x8')+_0x53b622,_0x6b0cd4);OpenchannelQueueEvents['on'](_0x53b622,_0x363646);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 241f6ff..fbdf368 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 _0x468d=['../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','post','create','put','delete','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x18a636,_0x2d3ff9){var _0x36fd28=function(_0x1554f0){while(--_0x1554f0){_0x18a636['push'](_0x18a636['shift']());}};_0x36fd28(++_0x2d3ff9);}(_0x468d,0x10b));var _0xd468=function(_0x162646,_0x2024aa){_0x162646=_0x162646-0x0;var _0xbc4b94=_0x468d[_0x162646];return _0xbc4b94;};'use strict';var multer=require(_0xd468('0x0'));var util=require(_0xd468('0x1'));var path=require('path');var timeout=require(_0xd468('0x2'));var express=require('express');var router=express[_0xd468('0x3')]();var fs_extra=require(_0xd468('0x4'));var auth=require(_0xd468('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd468('0x6'));var controller=require(_0xd468('0x7'));router['get']('/',auth[_0xd468('0x8')](),controller['index']);router[_0xd468('0x9')]('/describe',auth[_0xd468('0x8')](),controller[_0xd468('0xa')]);router[_0xd468('0x9')]('/:id',auth[_0xd468('0x8')](),controller['show']);router[_0xd468('0xb')]('/',auth[_0xd468('0x8')](),controller[_0xd468('0xc')]);router[_0xd468('0xd')]('/:id',auth[_0xd468('0x8')](),controller['update']);router[_0xd468('0xe')]('/:id',auth[_0xd468('0x8')](),controller['destroy']);module[_0xd468('0xf')]=router; \ No newline at end of file +var _0x0353=['Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x0353,0x14b));var _0x3035=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x0353[_0x2b8077];return _0x308091;};'use strict';var multer=require(_0x3035('0x0'));var util=require(_0x3035('0x1'));var path=require(_0x3035('0x2'));var timeout=require(_0x3035('0x3'));var express=require(_0x3035('0x4'));var router=express[_0x3035('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3035('0x6'));var config=require(_0x3035('0x7'));var controller=require(_0x3035('0x8'));router['get']('/',auth[_0x3035('0x9')](),controller[_0x3035('0xa')]);router[_0x3035('0xb')](_0x3035('0xc'),auth[_0x3035('0x9')](),controller[_0x3035('0xd')]);router[_0x3035('0xb')](_0x3035('0xe'),auth[_0x3035('0x9')](),controller[_0x3035('0xf')]);router[_0x3035('0x10')]('/',auth[_0x3035('0x9')](),controller['create']);router['put'](_0x3035('0xe'),auth[_0x3035('0x9')](),controller[_0x3035('0x11')]);router[_0x3035('0x12')](_0x3035('0xe'),auth['isAuthenticated'](),controller[_0x3035('0x13')]);module[_0x3035('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c97567f..aca3a21 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 _0xcdbb=['STRING','DATE','sequelize','exports'];(function(_0x2f4482,_0x5dea4c){var _0x4b51bd=function(_0x77f268){while(--_0x77f268){_0x2f4482['push'](_0x2f4482['shift']());}};_0x4b51bd(++_0x5dea4c);}(_0xcdbb,0x1f2));var _0xbcdb=function(_0x41d59f,_0x5764e9){_0x41d59f=_0x41d59f-0x0;var _0x3c2d37=_0xcdbb[_0x41d59f];return _0x3c2d37;};'use strict';var moment=require('moment');var Sequelize=require(_0xbcdb('0x0'));module[_0xbcdb('0x1')]={'uniqueid':{'type':Sequelize[_0xbcdb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbcdb('0x2')]},'joinAt':{'type':Sequelize[_0xbcdb('0x3')]},'leaveAt':{'type':Sequelize[_0xbcdb('0x3')]},'acceptAt':{'type':Sequelize[_0xbcdb('0x3')]},'exitAt':{'type':Sequelize[_0xbcdb('0x3')]},'reason':{'type':Sequelize[_0xbcdb('0x2')]}}; \ No newline at end of file +var _0x1757=['DATE','sequelize','STRING'];(function(_0x131712,_0x2ed068){var _0x292b97=function(_0x106fbd){while(--_0x106fbd){_0x131712['push'](_0x131712['shift']());}};_0x292b97(++_0x2ed068);}(_0x1757,0x11b));var _0x7175=function(_0x26d68e,_0x3c23b9){_0x26d68e=_0x26d68e-0x0;var _0x3776a0=_0x1757[_0x26d68e];return _0x3776a0;};'use strict';var moment=require('moment');var Sequelize=require(_0x7175('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7175('0x1')]},'joinAt':{'type':Sequelize[_0x7175('0x2')]},'leaveAt':{'type':Sequelize[_0x7175('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7175('0x2')]},'reason':{'type':Sequelize[_0x7175('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 76bd349..a3fb56d 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 _0xb022=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','fieldName','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','options','include','findAll','show','params','rawAttributes','intersection','includeAll','create','body','find','catch','describe','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x89966a,_0x2dad94){var _0x187410=function(_0x1b96dc){while(--_0x1b96dc){_0x89966a['push'](_0x89966a['shift']());}};_0x187410(++_0x2dad94);}(_0xb022,0x158));var _0x2b02=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb022[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b02('0x0'));var rp=require('request-promise');var moment=require(_0x2b02('0x1'));var BPromise=require(_0x2b02('0x2'));var Mustache=require(_0x2b02('0x3'));var util=require(_0x2b02('0x4'));var path=require(_0x2b02('0x5'));var sox=require('sox');var csv=require(_0x2b02('0x6'));var ejs=require(_0x2b02('0x7'));var fs=require('fs');var fs_extra=require(_0x2b02('0x8'));var _=require(_0x2b02('0x9'));var squel=require('squel');var crypto=require(_0x2b02('0xa'));var jsforce=require(_0x2b02('0xb'));var deskjs=require(_0x2b02('0xc'));var toCsv=require(_0x2b02('0x6'));var querystring=require(_0x2b02('0xd'));var Papa=require(_0x2b02('0xe'));var Redis=require(_0x2b02('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b02('0x10'));var logger=require(_0x2b02('0x11'))('api');var utils=require(_0x2b02('0x12'));var config=require(_0x2b02('0x13'));var licenseUtil=require(_0x2b02('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548749,_0xdbe937){_0xdbe937=_0xdbe937||0xcc;return function(_0x30145c){if(_0x30145c){return _0x548749[_0x2b02('0x15')](_0xdbe937);}return _0x548749[_0x2b02('0x16')](_0xdbe937)[_0x2b02('0x17')]();};}function respondWithResult(_0x522183,_0x5d6927){_0x5d6927=_0x5d6927||0xc8;return function(_0x14874c){if(_0x14874c){return _0x522183[_0x2b02('0x16')](_0x5d6927)[_0x2b02('0x18')](_0x14874c);}};}function respondWithFilteredResult(_0x135078,_0x2c98fa){return function(_0x5c2128){if(_0x5c2128){var _0x10153d=typeof _0x2c98fa[_0x2b02('0x19')]===_0x2b02('0x1a')&&typeof _0x2c98fa['limit']===_0x2b02('0x1a');var _0x37e4a2=_0x5c2128[_0x2b02('0x1b')];var _0x2bb37c=_0x10153d?0x0:_0x2c98fa[_0x2b02('0x19')];var _0x34be95=_0x10153d?_0x5c2128[_0x2b02('0x1b')]:_0x2c98fa[_0x2b02('0x19')]+_0x2c98fa['limit'];var _0x1fbd59;if(_0x34be95>=_0x37e4a2){_0x34be95=_0x37e4a2;_0x1fbd59=0xc8;}else{_0x1fbd59=0xce;}_0x135078[_0x2b02('0x16')](_0x1fbd59);return _0x135078[_0x2b02('0x1c')]('Content-Range',_0x2bb37c+'-'+_0x34be95+'/'+_0x37e4a2)[_0x2b02('0x18')](_0x5c2128);}return null;};}function patchUpdates(_0xd19aad){return function(_0x573601){try{jsonpatch['apply'](_0x573601,_0xd19aad,!![]);}catch(_0x411e2b){return BPromise[_0x2b02('0x1d')](_0x411e2b);}return _0x573601[_0x2b02('0x1e')]();};}function saveUpdates(_0x4202e9,_0x217031){return function(_0xb5ffcb){if(_0xb5ffcb){return _0xb5ffcb[_0x2b02('0x1f')](_0x4202e9)[_0x2b02('0x20')](function(_0x1da9d2){return _0x1da9d2;});}return null;};}function removeEntity(_0x2476d0,_0x40b966){return function(_0x5e12cd){if(_0x5e12cd){return _0x5e12cd[_0x2b02('0x21')]()[_0x2b02('0x20')](function(){_0x2476d0[_0x2b02('0x16')](0xcc)[_0x2b02('0x17')]();});}};}function handleEntityNotFound(_0x464f55,_0x2549be){return function(_0x3ac4f2){if(!_0x3ac4f2){_0x464f55[_0x2b02('0x15')](0x194);}return _0x3ac4f2;};}function handleError(_0x392a5f,_0x3f9477){_0x3f9477=_0x3f9477||0x1f4;return function(_0x466c8b){logger[_0x2b02('0x22')](_0x466c8b[_0x2b02('0x23')]);if(_0x466c8b[_0x2b02('0x24')]){delete _0x466c8b[_0x2b02('0x24')];}_0x392a5f[_0x2b02('0x16')](_0x3f9477)['send'](_0x466c8b);};}exports[_0x2b02('0x25')]=function(_0xdd5cc1,_0x5b1566){var _0x5e47f8={},_0x5c090a={},_0x436f84={'count':0x0,'rows':[]};var _0x30473d=_[_0x2b02('0x26')](db[_0x2b02('0x27')]['rawAttributes'],function(_0x424cf2){return{'name':_0x424cf2[_0x2b02('0x28')],'type':_0x424cf2['type'][_0x2b02('0x29')]};});_0x5c090a['model']=_[_0x2b02('0x26')](_0x30473d,'name');_0x5c090a[_0x2b02('0x2a')]=_['keys'](_0xdd5cc1[_0x2b02('0x2a')]);_0x5c090a[_0x2b02('0x2b')]=_['intersection'](_0x5c090a['model'],_0x5c090a[_0x2b02('0x2a')]);_0x5e47f8[_0x2b02('0x2c')]=_['intersection'](_0x5c090a[_0x2b02('0x2d')],qs[_0x2b02('0x2e')](_0xdd5cc1['query'][_0x2b02('0x2e')]));_0x5e47f8[_0x2b02('0x2c')]=_0x5e47f8['attributes'][_0x2b02('0x2f')]?_0x5e47f8['attributes']:_0x5c090a[_0x2b02('0x2d')];if(!_0xdd5cc1[_0x2b02('0x2a')][_0x2b02('0x30')](_0x2b02('0x31'))){_0x5e47f8[_0x2b02('0x32')]=qs[_0x2b02('0x32')](_0xdd5cc1[_0x2b02('0x2a')][_0x2b02('0x32')]);_0x5e47f8[_0x2b02('0x19')]=qs[_0x2b02('0x19')](_0xdd5cc1[_0x2b02('0x2a')][_0x2b02('0x19')]);}_0x5e47f8['order']=qs[_0x2b02('0x33')](_0xdd5cc1['query'][_0x2b02('0x33')]);_0x5e47f8['where']=qs['filters'](_[_0x2b02('0x34')](_0xdd5cc1[_0x2b02('0x2a')],_0x5c090a[_0x2b02('0x2b')]),_0x30473d);if(_0xdd5cc1[_0x2b02('0x2a')][_0x2b02('0x35')]){_0x5e47f8[_0x2b02('0x36')]=_[_0x2b02('0x37')](_0x5e47f8[_0x2b02('0x36')],{'$or':_['map'](_0x30473d,function(_0x47a6fe){if(_0x47a6fe[_0x2b02('0x38')]!=='VIRTUAL'){var _0x3f34f6={};_0x3f34f6[_0x47a6fe['name']]={'$like':'%'+_0xdd5cc1[_0x2b02('0x2a')]['filter']+'%'};return _0x3f34f6;}})});}_0x5e47f8=_[_0x2b02('0x37')]({},_0x5e47f8,_0xdd5cc1[_0x2b02('0x39')]);var _0x583e98={'where':_0x5e47f8[_0x2b02('0x36')]};return db[_0x2b02('0x27')][_0x2b02('0x1b')](_0x583e98)['then'](function(_0x2fc797){_0x436f84['count']=_0x2fc797;if(_0xdd5cc1[_0x2b02('0x2a')]['includeAll']){_0x5e47f8[_0x2b02('0x3a')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x2b02('0x3b')](_0x5e47f8);})['then'](function(_0x40b5c8){_0x436f84['rows']=_0x40b5c8;return _0x436f84;})['then'](respondWithFilteredResult(_0x5b1566,_0x5e47f8))['catch'](handleError(_0x5b1566,null));};exports[_0x2b02('0x3c')]=function(_0x411623,_0x9c7fdc){var _0x4eb7cb={'raw':!![],'where':{'id':_0x411623[_0x2b02('0x3d')]['id']}},_0x2fcce3={};_0x2fcce3[_0x2b02('0x2d')]=_['keys'](db[_0x2b02('0x27')][_0x2b02('0x3e')]);_0x2fcce3[_0x2b02('0x2a')]=_['keys'](_0x411623[_0x2b02('0x2a')]);_0x2fcce3['filters']=_[_0x2b02('0x3f')](_0x2fcce3['model'],_0x2fcce3[_0x2b02('0x2a')]);_0x4eb7cb[_0x2b02('0x2c')]=_[_0x2b02('0x3f')](_0x2fcce3['model'],qs['fields'](_0x411623['query']['fields']));_0x4eb7cb[_0x2b02('0x2c')]=_0x4eb7cb[_0x2b02('0x2c')][_0x2b02('0x2f')]?_0x4eb7cb[_0x2b02('0x2c')]:_0x2fcce3['model'];if(_0x411623[_0x2b02('0x2a')][_0x2b02('0x40')]){_0x4eb7cb[_0x2b02('0x3a')]=[{'all':!![]}];}_0x4eb7cb=_[_0x2b02('0x37')]({},_0x4eb7cb,_0x411623['options']);return db[_0x2b02('0x27')]['find'](_0x4eb7cb)[_0x2b02('0x20')](handleEntityNotFound(_0x9c7fdc,null))['then'](respondWithResult(_0x9c7fdc,null))['catch'](handleError(_0x9c7fdc,null));};exports[_0x2b02('0x41')]=function(_0x42fd3a,_0x3a0cf8){return db[_0x2b02('0x27')][_0x2b02('0x41')](_0x42fd3a[_0x2b02('0x42')],{})['then'](respondWithResult(_0x3a0cf8,0xc9))['catch'](handleError(_0x3a0cf8,null));};exports[_0x2b02('0x1f')]=function(_0x31b39c,_0x1b61d5){if(_0x31b39c[_0x2b02('0x42')]['id']){delete _0x31b39c['body']['id'];}return db[_0x2b02('0x27')][_0x2b02('0x43')]({'where':{'id':_0x31b39c['params']['id']}})[_0x2b02('0x20')](handleEntityNotFound(_0x1b61d5,null))[_0x2b02('0x20')](saveUpdates(_0x31b39c['body'],null))[_0x2b02('0x20')](respondWithResult(_0x1b61d5,null))['catch'](handleError(_0x1b61d5,null));};exports[_0x2b02('0x21')]=function(_0x464526,_0x45e0d5){return db[_0x2b02('0x27')]['find']({'where':{'id':_0x464526[_0x2b02('0x3d')]['id']}})[_0x2b02('0x20')](handleEntityNotFound(_0x45e0d5,null))['then'](removeEntity(_0x45e0d5,null))[_0x2b02('0x44')](handleError(_0x45e0d5,null));};exports[_0x2b02('0x45')]=function(_0x1e996c,_0x5b9ff7){return db[_0x2b02('0x27')][_0x2b02('0x45')]()[_0x2b02('0x20')](respondWithResult(_0x5b9ff7,null))[_0x2b02('0x44')](handleError(_0x5b9ff7,null));}; \ No newline at end of file +var _0xcbd9=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','key','model','keys','query'];(function(_0x467ef6,_0x932cef){var _0x3e4aa2=function(_0xb56bb5){while(--_0xb56bb5){_0x467ef6['push'](_0x467ef6['shift']());}};_0x3e4aa2(++_0x932cef);}(_0xcbd9,0x192));var _0x9cbd=function(_0x359683,_0x541394){_0x359683=_0x359683-0x0;var _0xa4b8c4=_0xcbd9[_0x359683];return _0xa4b8c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cbd('0x0'));var zipdir=require(_0x9cbd('0x1'));var jsonpatch=require(_0x9cbd('0x2'));var rp=require(_0x9cbd('0x3'));var moment=require(_0x9cbd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9cbd('0x5'));var path=require(_0x9cbd('0x6'));var sox=require('sox');var csv=require(_0x9cbd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cbd('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9cbd('0x9'));var jsforce=require(_0x9cbd('0xa'));var deskjs=require(_0x9cbd('0xb'));var toCsv=require(_0x9cbd('0x7'));var querystring=require(_0x9cbd('0xc'));var Papa=require(_0x9cbd('0xd'));var Redis=require(_0x9cbd('0xe'));var authService=require(_0x9cbd('0xf'));var qs=require(_0x9cbd('0x10'));var as=require(_0x9cbd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cbd('0x12'))(_0x9cbd('0x13'));var utils=require(_0x9cbd('0x14'));var config=require(_0x9cbd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x536a6a,_0x1eaf74){_0x1eaf74=_0x1eaf74||0xcc;return function(_0x49c26d){if(_0x49c26d){return _0x536a6a['sendStatus'](_0x1eaf74);}return _0x536a6a[_0x9cbd('0x16')](_0x1eaf74)[_0x9cbd('0x17')]();};}function respondWithResult(_0x31f9a4,_0x12b3c9){_0x12b3c9=_0x12b3c9||0xc8;return function(_0x1c1b71){if(_0x1c1b71){return _0x31f9a4[_0x9cbd('0x16')](_0x12b3c9)[_0x9cbd('0x18')](_0x1c1b71);}};}function respondWithFilteredResult(_0x2031fd,_0x560738){return function(_0x1c3e62){if(_0x1c3e62){var _0x12dab0=typeof _0x560738['offset']===_0x9cbd('0x19')&&typeof _0x560738['limit']===_0x9cbd('0x19');var _0x54d76a=_0x1c3e62[_0x9cbd('0x1a')];var _0x6fa52a=_0x12dab0?0x0:_0x560738[_0x9cbd('0x1b')];var _0x4a33cf=_0x12dab0?_0x1c3e62[_0x9cbd('0x1a')]:_0x560738[_0x9cbd('0x1b')]+_0x560738['limit'];var _0x111cd6;if(_0x4a33cf>=_0x54d76a){_0x4a33cf=_0x54d76a;_0x111cd6=0xc8;}else{_0x111cd6=0xce;}_0x2031fd[_0x9cbd('0x16')](_0x111cd6);return _0x2031fd[_0x9cbd('0x1c')](_0x9cbd('0x1d'),_0x6fa52a+'-'+_0x4a33cf+'/'+_0x54d76a)['json'](_0x1c3e62);}return null;};}function patchUpdates(_0x21d290){return function(_0x4574d9){try{jsonpatch[_0x9cbd('0x1e')](_0x4574d9,_0x21d290,!![]);}catch(_0x5368e5){return BPromise['reject'](_0x5368e5);}return _0x4574d9[_0x9cbd('0x1f')]();};}function saveUpdates(_0x157bfe,_0x1c1b78){return function(_0x554dd3){if(_0x554dd3){return _0x554dd3[_0x9cbd('0x20')](_0x157bfe)[_0x9cbd('0x21')](function(_0x5a5924){return _0x5a5924;});}return null;};}function removeEntity(_0x2aaa83,_0x41316e){return function(_0x588b7b){if(_0x588b7b){return _0x588b7b[_0x9cbd('0x22')]()[_0x9cbd('0x21')](function(){_0x2aaa83[_0x9cbd('0x16')](0xcc)[_0x9cbd('0x17')]();});}};}function handleEntityNotFound(_0x504723,_0xef672d){return function(_0x5df169){if(!_0x5df169){_0x504723[_0x9cbd('0x23')](0x194);}return _0x5df169;};}function handleError(_0x18944d,_0x561b65){_0x561b65=_0x561b65||0x1f4;return function(_0x59dd4f){logger[_0x9cbd('0x24')](_0x59dd4f[_0x9cbd('0x25')]);if(_0x59dd4f[_0x9cbd('0x26')]){delete _0x59dd4f['name'];}_0x18944d['status'](_0x561b65)[_0x9cbd('0x27')](_0x59dd4f);};}exports[_0x9cbd('0x28')]=function(_0x388c98,_0x507f16){var _0x368101={},_0x2b6b8f={},_0x1acc13={'count':0x0,'rows':[]};var _0x319fc7=_[_0x9cbd('0x29')](db[_0x9cbd('0x2a')][_0x9cbd('0x2b')],function(_0x2e93d7){return{'name':_0x2e93d7['fieldName'],'type':_0x2e93d7['type'][_0x9cbd('0x2c')]};});_0x2b6b8f[_0x9cbd('0x2d')]=_[_0x9cbd('0x29')](_0x319fc7,_0x9cbd('0x26'));_0x2b6b8f['query']=_[_0x9cbd('0x2e')](_0x388c98[_0x9cbd('0x2f')]);_0x2b6b8f[_0x9cbd('0x30')]=_[_0x9cbd('0x31')](_0x2b6b8f['model'],_0x2b6b8f[_0x9cbd('0x2f')]);_0x368101['attributes']=_[_0x9cbd('0x31')](_0x2b6b8f[_0x9cbd('0x2d')],qs[_0x9cbd('0x32')](_0x388c98['query'][_0x9cbd('0x32')]));_0x368101[_0x9cbd('0x33')]=_0x368101[_0x9cbd('0x33')][_0x9cbd('0x34')]?_0x368101[_0x9cbd('0x33')]:_0x2b6b8f[_0x9cbd('0x2d')];if(!_0x388c98[_0x9cbd('0x2f')][_0x9cbd('0x35')](_0x9cbd('0x36'))){_0x368101[_0x9cbd('0x37')]=qs[_0x9cbd('0x37')](_0x388c98[_0x9cbd('0x2f')][_0x9cbd('0x37')]);_0x368101[_0x9cbd('0x1b')]=qs['offset'](_0x388c98['query'][_0x9cbd('0x1b')]);}_0x368101[_0x9cbd('0x38')]=qs[_0x9cbd('0x39')](_0x388c98[_0x9cbd('0x2f')][_0x9cbd('0x39')]);_0x368101[_0x9cbd('0x3a')]=qs[_0x9cbd('0x30')](_[_0x9cbd('0x3b')](_0x388c98[_0x9cbd('0x2f')],_0x2b6b8f[_0x9cbd('0x30')]),_0x319fc7);if(_0x388c98[_0x9cbd('0x2f')][_0x9cbd('0x3c')]){_0x368101[_0x9cbd('0x3a')]=_[_0x9cbd('0x3d')](_0x368101[_0x9cbd('0x3a')],{'$or':_[_0x9cbd('0x29')](_0x319fc7,function(_0xb541da){if(_0xb541da[_0x9cbd('0x3e')]!==_0x9cbd('0x3f')){var _0x416eb7={};_0x416eb7[_0xb541da['name']]={'$like':'%'+_0x388c98['query']['filter']+'%'};return _0x416eb7;}})});}_0x368101=_[_0x9cbd('0x3d')]({},_0x368101,_0x388c98[_0x9cbd('0x40')]);var _0x146dac={'where':_0x368101['where']};return db['OpenchannelQueueReport'][_0x9cbd('0x1a')](_0x146dac)['then'](function(_0x2c00ec){_0x1acc13[_0x9cbd('0x1a')]=_0x2c00ec;if(_0x388c98[_0x9cbd('0x2f')]['includeAll']){_0x368101[_0x9cbd('0x41')]=[{'all':!![]}];}return db[_0x9cbd('0x2a')][_0x9cbd('0x42')](_0x368101);})[_0x9cbd('0x21')](function(_0x284ae0){_0x1acc13['rows']=_0x284ae0;return _0x1acc13;})[_0x9cbd('0x21')](respondWithFilteredResult(_0x507f16,_0x368101))[_0x9cbd('0x43')](handleError(_0x507f16,null));};exports[_0x9cbd('0x44')]=function(_0x19cfb2,_0x10733f){var _0x178722={'raw':!![],'where':{'id':_0x19cfb2[_0x9cbd('0x45')]['id']}},_0x1b5516={};_0x1b5516[_0x9cbd('0x2d')]=_[_0x9cbd('0x2e')](db[_0x9cbd('0x2a')]['rawAttributes']);_0x1b5516[_0x9cbd('0x2f')]=_['keys'](_0x19cfb2[_0x9cbd('0x2f')]);_0x1b5516[_0x9cbd('0x30')]=_[_0x9cbd('0x31')](_0x1b5516['model'],_0x1b5516[_0x9cbd('0x2f')]);_0x178722['attributes']=_['intersection'](_0x1b5516[_0x9cbd('0x2d')],qs[_0x9cbd('0x32')](_0x19cfb2[_0x9cbd('0x2f')][_0x9cbd('0x32')]));_0x178722[_0x9cbd('0x33')]=_0x178722[_0x9cbd('0x33')][_0x9cbd('0x34')]?_0x178722[_0x9cbd('0x33')]:_0x1b5516['model'];if(_0x19cfb2[_0x9cbd('0x2f')][_0x9cbd('0x46')]){_0x178722[_0x9cbd('0x41')]=[{'all':!![]}];}_0x178722=_[_0x9cbd('0x3d')]({},_0x178722,_0x19cfb2[_0x9cbd('0x40')]);return db[_0x9cbd('0x2a')][_0x9cbd('0x47')](_0x178722)[_0x9cbd('0x21')](handleEntityNotFound(_0x10733f,null))['then'](respondWithResult(_0x10733f,null))[_0x9cbd('0x43')](handleError(_0x10733f,null));};exports['create']=function(_0x3e26c4,_0x3d60eb){return db[_0x9cbd('0x2a')][_0x9cbd('0x48')](_0x3e26c4[_0x9cbd('0x49')],{})[_0x9cbd('0x21')](respondWithResult(_0x3d60eb,0xc9))['catch'](handleError(_0x3d60eb,null));};exports[_0x9cbd('0x20')]=function(_0x951205,_0x4eeb9a){if(_0x951205['body']['id']){delete _0x951205['body']['id'];}return db[_0x9cbd('0x2a')]['find']({'where':{'id':_0x951205[_0x9cbd('0x45')]['id']}})[_0x9cbd('0x21')](handleEntityNotFound(_0x4eeb9a,null))['then'](saveUpdates(_0x951205[_0x9cbd('0x49')],null))['then'](respondWithResult(_0x4eeb9a,null))[_0x9cbd('0x43')](handleError(_0x4eeb9a,null));};exports[_0x9cbd('0x22')]=function(_0x2852b6,_0x393f5c){return db[_0x9cbd('0x2a')][_0x9cbd('0x47')]({'where':{'id':_0x2852b6['params']['id']}})[_0x9cbd('0x21')](handleEntityNotFound(_0x393f5c,null))['then'](removeEntity(_0x393f5c,null))[_0x9cbd('0x43')](handleError(_0x393f5c,null));};exports[_0x9cbd('0x4a')]=function(_0x56fe17,_0x5a463d){return db[_0x9cbd('0x2a')][_0x9cbd('0x4a')]()[_0x9cbd('0x21')](respondWithResult(_0x5a463d,null))[_0x9cbd('0x43')](handleError(_0x5a463d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 03f4848..625bca5 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0xd4a5,_0x12a607){var _0x4c99f6=function(_0x58c621){while(--_0x58c621){_0xd4a5['push'](_0xd4a5['shift']());}};_0x4c99f6(++_0x12a607);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x5fc3[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x814b,0x1a2));var _0xb814=function(_0x59b9d3,_0x384472){_0x59b9d3=_0x59b9d3-0x0;var _0x171163=_0x814b[_0x59b9d3];return _0x171163;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 7a22f98..9b8f239 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 _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0x42c903,_0x5c81bc){var _0xcfd717=function(_0x34fd31){while(--_0x34fd31){_0x42c903['push'](_0x42c903['shift']());}};_0xcfd717(++_0x5c81bc);}(_0x14a0,0x8e));var _0x014a=function(_0x4ccb28,_0x348210){_0x4ccb28=_0x4ccb28-0x0;var _0x2241ba=_0x14a0[_0x4ccb28];return _0x2241ba;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file +var _0x80ed=['catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x584b87,_0x3542b8){var _0x3e7b7e=function(_0xe8964d){while(--_0xe8964d){_0x584b87['push'](_0x584b87['shift']());}};_0x3e7b7e(++_0x3542b8);}(_0x80ed,0x11c));var _0xd80e=function(_0x1f5935,_0x4ab587){_0x1f5935=_0x1f5935-0x0;var _0xc4a47d=_0x80ed[_0x1f5935];return _0xc4a47d;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['CreateOpenchannelQueueReport']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['OpenchannelQueueReport'][_0xd80e('0x17')](_0x21ceec[_0xd80e('0x18')],{'raw':_0x21ceec[_0xd80e('0x19')]?_0x21ceec['options'][_0xd80e('0x1a')]===undefined?!![]:![]:!![]})[_0xd80e('0xc')](function(_0x2765ea){logger[_0xd80e('0xd')](_0xd80e('0x1b'),_0x21ceec);logger['debug']('CreateOpenchannelQueueReport',_0x21ceec,JSON[_0xd80e('0x11')](_0x2765ea));_0x3b543d(_0x2765ea);})[_0xd80e('0x16')](function(_0x3b39bf){logger[_0xd80e('0x12')](_0xd80e('0x1b'),_0x3b39bf[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x3b39bf['message']));});});};exports[_0xd80e('0x1c')]=function(_0x57d70){var _0x170109=this;return new Promise(function(_0x5b0d6d,_0x635ce0){return db[_0xd80e('0x1d')][_0xd80e('0x1e')](_0x57d70['body'],{'raw':_0x57d70['options']?_0x57d70['options'][_0xd80e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d70['options']?_0x57d70[_0xd80e('0x19')][_0xd80e('0x1f')]||null:null,'attributes':_0x57d70['options']?_0x57d70[_0xd80e('0x19')][_0xd80e('0x20')]||null:null,'limit':_0x57d70[_0xd80e('0x19')]?_0x57d70[_0xd80e('0x19')]['limit']||null:null})[_0xd80e('0xc')](function(_0x1ad3bc){logger[_0xd80e('0xd')](_0xd80e('0x1c'),_0x57d70);logger[_0xd80e('0x21')](_0xd80e('0x1c'),_0x57d70,JSON[_0xd80e('0x11')](_0x1ad3bc));_0x5b0d6d(_0x1ad3bc);})[_0xd80e('0x16')](function(_0x5522dd){logger['error'](_0xd80e('0x1c'),_0x5522dd[_0xd80e('0x14')],_0x57d70);_0x635ce0(_0x170109[_0xd80e('0x12')](0x1f4,_0x5522dd[_0xd80e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 03d3ae1..3da2a97 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 _0x1e92=['../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','fs-extra','../../components/auth/service'];(function(_0x67c3e8,_0x5d7c31){var _0x164ba9=function(_0x2a3c2a){while(--_0x2a3c2a){_0x67c3e8['push'](_0x67c3e8['shift']());}};_0x164ba9(++_0x5d7c31);}(_0x1e92,0x183));var _0x21e9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1e92[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x21e9('0x0'));var path=require(_0x21e9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x21e9('0x2'));var auth=require(_0x21e9('0x3'));var interaction=require(_0x21e9('0x4'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x21e9('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21e9('0x5')](_0x21e9('0x6'),auth[_0x21e9('0x7')](),controller[_0x21e9('0x8')]);router['get'](_0x21e9('0x9'),auth[_0x21e9('0x7')](),controller[_0x21e9('0xa')]);router[_0x21e9('0xb')]('/',auth[_0x21e9('0x7')](),controller[_0x21e9('0xc')]);router[_0x21e9('0xd')](_0x21e9('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x21e9('0xe')](_0x21e9('0x9'),auth['isAuthenticated'](),controller[_0x21e9('0xf')]);module[_0x21e9('0x10')]=router; \ No newline at end of file +var _0x4b3c=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x448f0a,_0x39af2f){var _0x4d0ff4=function(_0x184b32){while(--_0x184b32){_0x448f0a['push'](_0x448f0a['shift']());}};_0x4d0ff4(++_0x39af2f);}(_0x4b3c,0x152));var _0xc4b3=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x4b3c[_0x4cd846];return _0x2f2a7d;};'use strict';var multer=require(_0xc4b3('0x0'));var util=require(_0xc4b3('0x1'));var path=require('path');var timeout=require(_0xc4b3('0x2'));var express=require(_0xc4b3('0x3'));var router=express['Router']();var fs_extra=require(_0xc4b3('0x4'));var auth=require(_0xc4b3('0x5'));var interaction=require(_0xc4b3('0x6'));var config=require(_0xc4b3('0x7'));var controller=require(_0xc4b3('0x8'));router[_0xc4b3('0x9')]('/',auth[_0xc4b3('0xa')](),controller[_0xc4b3('0xb')]);router[_0xc4b3('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc4b3('0xc')]);router['get'](_0xc4b3('0xd'),auth[_0xc4b3('0xa')](),controller[_0xc4b3('0xe')]);router['post']('/',auth[_0xc4b3('0xa')](),controller[_0xc4b3('0xf')]);router[_0xc4b3('0x10')]('/:id',auth[_0xc4b3('0xa')](),controller[_0xc4b3('0x11')]);router[_0xc4b3('0x12')](_0xc4b3('0xd'),auth[_0xc4b3('0xa')](),controller[_0xc4b3('0x13')]);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 ea13e56..f7fa73c 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x20632e,_0x124385){var _0x4ee4d4=function(_0x28eed2){while(--_0x28eed2){_0x20632e['push'](_0x20632e['shift']());}};_0x4ee4d4(++_0x124385);}(_0x70e0,0x17b));var _0x070e=function(_0x203ff0,_0x136855){_0x203ff0=_0x203ff0-0x0;var _0x3f70b0=_0x70e0[_0x203ff0];return _0x3f70b0;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3d5115,_0x1f662a){var _0x5a90dd=function(_0x63fd62){while(--_0x63fd62){_0x3d5115['push'](_0x3d5115['shift']());}};_0x5a90dd(++_0x1f662a);}(_0xaa88,0x137));var _0x8aa8=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0xaa88[_0x35d59c];return _0x18cd27;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index da73abf..140d898 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 _0x0a56=['keys','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','catch','show','params'];(function(_0x29bc1c,_0x36ccf2){var _0x1c9311=function(_0x2c3975){while(--_0x2c3975){_0x29bc1c['push'](_0x29bc1c['shift']());}};_0x1c9311(++_0x36ccf2);}(_0x0a56,0x132));var _0x60a5=function(_0x3ff736,_0x1a3422){_0x3ff736=_0x3ff736-0x0;var _0x227f11=_0x0a56[_0x3ff736];return _0x227f11;};'use strict';var emlformat=require(_0x60a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x60a5('0x1'));var jsonpatch=require(_0x60a5('0x2'));var rp=require(_0x60a5('0x3'));var moment=require(_0x60a5('0x4'));var BPromise=require(_0x60a5('0x5'));var Mustache=require(_0x60a5('0x6'));var util=require('util');var path=require(_0x60a5('0x7'));var sox=require(_0x60a5('0x8'));var csv=require(_0x60a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60a5('0xa'));var _=require(_0x60a5('0xb'));var squel=require('squel');var crypto=require(_0x60a5('0xc'));var jsforce=require(_0x60a5('0xd'));var deskjs=require(_0x60a5('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x60a5('0xf'));var Redis=require(_0x60a5('0x10'));var authService=require(_0x60a5('0x11'));var qs=require(_0x60a5('0x12'));var as=require(_0x60a5('0x13'));var hardwareService=require(_0x60a5('0x14'));var logger=require(_0x60a5('0x15'))(_0x60a5('0x16'));var utils=require(_0x60a5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x60a5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc5264d,_0x477803){_0x477803=_0x477803||0xcc;return function(_0x1061df){if(_0x1061df){return _0xc5264d[_0x60a5('0x19')](_0x477803);}return _0xc5264d['status'](_0x477803)[_0x60a5('0x1a')]();};}function respondWithResult(_0xcbaee5,_0x2e86f2){_0x2e86f2=_0x2e86f2||0xc8;return function(_0x4f4137){if(_0x4f4137){return _0xcbaee5[_0x60a5('0x1b')](_0x2e86f2)[_0x60a5('0x1c')](_0x4f4137);}};}function respondWithFilteredResult(_0x5c47e4,_0x885514){return function(_0x40664d){if(_0x40664d){var _0x17eea8=typeof _0x885514[_0x60a5('0x1d')]===_0x60a5('0x1e')&&typeof _0x885514['limit']===_0x60a5('0x1e');var _0x2eba5d=_0x40664d['count'];var _0x1138c5=_0x17eea8?0x0:_0x885514[_0x60a5('0x1d')];var _0x8b833b=_0x17eea8?_0x40664d['count']:_0x885514['offset']+_0x885514[_0x60a5('0x1f')];var _0x952131;if(_0x8b833b>=_0x2eba5d){_0x8b833b=_0x2eba5d;_0x952131=0xc8;}else{_0x952131=0xce;}_0x5c47e4['status'](_0x952131);return _0x5c47e4[_0x60a5('0x20')](_0x60a5('0x21'),_0x1138c5+'-'+_0x8b833b+'/'+_0x2eba5d)[_0x60a5('0x1c')](_0x40664d);}return null;};}function patchUpdates(_0x4e6437){return function(_0x5e0eb3){try{jsonpatch[_0x60a5('0x22')](_0x5e0eb3,_0x4e6437,!![]);}catch(_0x52ae87){return BPromise[_0x60a5('0x23')](_0x52ae87);}return _0x5e0eb3['save']();};}function saveUpdates(_0x55b942,_0x3cdae){return function(_0x313e0d){if(_0x313e0d){return _0x313e0d[_0x60a5('0x24')](_0x55b942)['then'](function(_0x1c945f){return _0x1c945f;});}return null;};}function removeEntity(_0x4effcf,_0xdbea5c){return function(_0x379e4f){if(_0x379e4f){return _0x379e4f[_0x60a5('0x25')]()[_0x60a5('0x26')](function(){_0x4effcf['status'](0xcc)[_0x60a5('0x1a')]();});}};}function handleEntityNotFound(_0xd4c3ea,_0x4a0b7c){return function(_0x5d71ae){if(!_0x5d71ae){_0xd4c3ea[_0x60a5('0x19')](0x194);}return _0x5d71ae;};}function handleError(_0x37ffe6,_0x5b0fb1){_0x5b0fb1=_0x5b0fb1||0x1f4;return function(_0x3d53a2){logger['error'](_0x3d53a2['stack']);if(_0x3d53a2[_0x60a5('0x27')]){delete _0x3d53a2[_0x60a5('0x27')];}_0x37ffe6[_0x60a5('0x1b')](_0x5b0fb1)[_0x60a5('0x28')](_0x3d53a2);};}exports['index']=function(_0x3541bf,_0x3196cc){var _0x16ad7d={},_0x319e69={},_0x4220d0={'count':0x0,'rows':[]};var _0x4ba72b=_[_0x60a5('0x29')](db[_0x60a5('0x2a')][_0x60a5('0x2b')],function(_0x2f86c6){return{'name':_0x2f86c6[_0x60a5('0x2c')],'type':_0x2f86c6[_0x60a5('0x2d')][_0x60a5('0x2e')]};});_0x319e69['model']=_[_0x60a5('0x29')](_0x4ba72b,'name');_0x319e69[_0x60a5('0x2f')]=_['keys'](_0x3541bf['query']);_0x319e69[_0x60a5('0x30')]=_['intersection'](_0x319e69['model'],_0x319e69[_0x60a5('0x2f')]);_0x16ad7d[_0x60a5('0x31')]=_[_0x60a5('0x32')](_0x319e69[_0x60a5('0x33')],qs[_0x60a5('0x34')](_0x3541bf[_0x60a5('0x2f')][_0x60a5('0x34')]));_0x16ad7d['attributes']=_0x16ad7d[_0x60a5('0x31')][_0x60a5('0x35')]?_0x16ad7d[_0x60a5('0x31')]:_0x319e69[_0x60a5('0x33')];if(!_0x3541bf[_0x60a5('0x2f')][_0x60a5('0x36')](_0x60a5('0x37'))){_0x16ad7d[_0x60a5('0x1f')]=qs[_0x60a5('0x1f')](_0x3541bf['query'][_0x60a5('0x1f')]);_0x16ad7d[_0x60a5('0x1d')]=qs[_0x60a5('0x1d')](_0x3541bf[_0x60a5('0x2f')][_0x60a5('0x1d')]);}_0x16ad7d[_0x60a5('0x38')]=qs['sort'](_0x3541bf[_0x60a5('0x2f')][_0x60a5('0x39')]);_0x16ad7d[_0x60a5('0x3a')]=qs[_0x60a5('0x30')](_[_0x60a5('0x3b')](_0x3541bf['query'],_0x319e69[_0x60a5('0x30')]),_0x4ba72b);if(_0x3541bf[_0x60a5('0x2f')][_0x60a5('0x3c')]){_0x16ad7d[_0x60a5('0x3a')]=_[_0x60a5('0x3d')](_0x16ad7d['where'],{'$or':_[_0x60a5('0x29')](_0x4ba72b,function(_0x12f2b){if(_0x12f2b[_0x60a5('0x2d')]!=='VIRTUAL'){var _0x1c2d6e={};_0x1c2d6e[_0x12f2b[_0x60a5('0x27')]]={'$like':'%'+_0x3541bf[_0x60a5('0x2f')][_0x60a5('0x3c')]+'%'};return _0x1c2d6e;}})});}_0x16ad7d=_[_0x60a5('0x3d')]({},_0x16ad7d,_0x3541bf['options']);var _0x2f10ac={'where':_0x16ad7d[_0x60a5('0x3a')]};return db[_0x60a5('0x2a')][_0x60a5('0x3e')](_0x2f10ac)[_0x60a5('0x26')](function(_0x10dfca){_0x4220d0[_0x60a5('0x3e')]=_0x10dfca;if(_0x3541bf['query'][_0x60a5('0x3f')]){_0x16ad7d[_0x60a5('0x40')]=[{'all':!![]}];}return db[_0x60a5('0x2a')][_0x60a5('0x41')](_0x16ad7d);})[_0x60a5('0x26')](function(_0x40b2e0){_0x4220d0['rows']=_0x40b2e0;return _0x4220d0;})['then'](respondWithFilteredResult(_0x3196cc,_0x16ad7d))[_0x60a5('0x42')](handleError(_0x3196cc,null));};exports[_0x60a5('0x43')]=function(_0x2ede26,_0x5d33be){var _0x1c6db9={'raw':!![],'where':{'id':_0x2ede26[_0x60a5('0x44')]['id']}},_0x4adef8={};_0x4adef8[_0x60a5('0x33')]=_[_0x60a5('0x45')](db[_0x60a5('0x2a')][_0x60a5('0x2b')]);_0x4adef8[_0x60a5('0x2f')]=_[_0x60a5('0x45')](_0x2ede26[_0x60a5('0x2f')]);_0x4adef8['filters']=_[_0x60a5('0x32')](_0x4adef8[_0x60a5('0x33')],_0x4adef8[_0x60a5('0x2f')]);_0x1c6db9[_0x60a5('0x31')]=_[_0x60a5('0x32')](_0x4adef8[_0x60a5('0x33')],qs[_0x60a5('0x34')](_0x2ede26[_0x60a5('0x2f')][_0x60a5('0x34')]));_0x1c6db9[_0x60a5('0x31')]=_0x1c6db9[_0x60a5('0x31')][_0x60a5('0x35')]?_0x1c6db9[_0x60a5('0x31')]:_0x4adef8[_0x60a5('0x33')];if(_0x2ede26[_0x60a5('0x2f')][_0x60a5('0x3f')]){_0x1c6db9[_0x60a5('0x40')]=[{'all':!![]}];}_0x1c6db9=_[_0x60a5('0x3d')]({},_0x1c6db9,_0x2ede26[_0x60a5('0x46')]);return db[_0x60a5('0x2a')][_0x60a5('0x47')](_0x1c6db9)[_0x60a5('0x26')](handleEntityNotFound(_0x5d33be,null))['then'](respondWithResult(_0x5d33be,null))[_0x60a5('0x42')](handleError(_0x5d33be,null));};exports[_0x60a5('0x48')]=function(_0xa53266,_0x2c5f8c){return db[_0x60a5('0x2a')][_0x60a5('0x48')](_0xa53266[_0x60a5('0x49')],{})['then'](respondWithResult(_0x2c5f8c,0xc9))['catch'](handleError(_0x2c5f8c,null));};exports[_0x60a5('0x24')]=function(_0x76b9b8,_0x2a9ce2){if(_0x76b9b8[_0x60a5('0x49')]['id']){delete _0x76b9b8[_0x60a5('0x49')]['id'];}return db[_0x60a5('0x2a')]['find']({'where':{'id':_0x76b9b8[_0x60a5('0x44')]['id']}})[_0x60a5('0x26')](handleEntityNotFound(_0x2a9ce2,null))[_0x60a5('0x26')](saveUpdates(_0x76b9b8[_0x60a5('0x49')],null))[_0x60a5('0x26')](respondWithResult(_0x2a9ce2,null))['catch'](handleError(_0x2a9ce2,null));};exports[_0x60a5('0x25')]=function(_0xf0a5e8,_0x2c9acc){return db[_0x60a5('0x2a')][_0x60a5('0x47')]({'where':{'id':_0xf0a5e8[_0x60a5('0x44')]['id']}})[_0x60a5('0x26')](handleEntityNotFound(_0x2c9acc,null))[_0x60a5('0x26')](removeEntity(_0x2c9acc,null))[_0x60a5('0x42')](handleError(_0x2c9acc,null));};exports[_0x60a5('0x4a')]=function(_0xe605c2,_0x4f3506){return db[_0x60a5('0x2a')]['describe']()[_0x60a5('0x26')](respondWithResult(_0x4f3506,null))['catch'](handleError(_0x4f3506,null));}; \ No newline at end of file +var _0xfe88=['name','send','index','map','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','OpenchannelTransferReport','includeAll','include','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','status','error','stack'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfe88,0x199));var _0x8fe8=function(_0x54ab1f,_0x1585d6){_0x54ab1f=_0x54ab1f-0x0;var _0x24c869=_0xfe88[_0x54ab1f];return _0x24c869;};'use strict';var emlformat=require(_0x8fe8('0x0'));var rimraf=require(_0x8fe8('0x1'));var zipdir=require(_0x8fe8('0x2'));var jsonpatch=require(_0x8fe8('0x3'));var rp=require(_0x8fe8('0x4'));var moment=require('moment');var BPromise=require(_0x8fe8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8fe8('0x6'));var sox=require(_0x8fe8('0x7'));var csv=require(_0x8fe8('0x8'));var ejs=require(_0x8fe8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fe8('0xa'));var squel=require(_0x8fe8('0xb'));var crypto=require(_0x8fe8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8fe8('0xd'));var toCsv=require(_0x8fe8('0x8'));var querystring=require(_0x8fe8('0xe'));var Papa=require(_0x8fe8('0xf'));var Redis=require(_0x8fe8('0x10'));var authService=require(_0x8fe8('0x11'));var qs=require(_0x8fe8('0x12'));var as=require(_0x8fe8('0x13'));var hardwareService=require(_0x8fe8('0x14'));var logger=require(_0x8fe8('0x15'))(_0x8fe8('0x16'));var utils=require('../../config/utils');var config=require(_0x8fe8('0x17'));var licenseUtil=require(_0x8fe8('0x18'));var db=require(_0x8fe8('0x19'))['db'];function respondWithStatusCode(_0x3368fb,_0x3ab102){_0x3ab102=_0x3ab102||0xcc;return function(_0x45bf36){if(_0x45bf36){return _0x3368fb['sendStatus'](_0x3ab102);}return _0x3368fb['status'](_0x3ab102)[_0x8fe8('0x1a')]();};}function respondWithResult(_0x2f62d6,_0x5440f4){_0x5440f4=_0x5440f4||0xc8;return function(_0x5ed680){if(_0x5ed680){return _0x2f62d6['status'](_0x5440f4)[_0x8fe8('0x1b')](_0x5ed680);}};}function respondWithFilteredResult(_0x1cf229,_0x3c1360){return function(_0x240863){if(_0x240863){var _0x3478d7=typeof _0x3c1360['offset']===_0x8fe8('0x1c')&&typeof _0x3c1360[_0x8fe8('0x1d')]===_0x8fe8('0x1c');var _0x2a5d7f=_0x240863[_0x8fe8('0x1e')];var _0x3631d3=_0x3478d7?0x0:_0x3c1360['offset'];var _0x22a56f=_0x3478d7?_0x240863[_0x8fe8('0x1e')]:_0x3c1360[_0x8fe8('0x1f')]+_0x3c1360[_0x8fe8('0x1d')];var _0x3504ac;if(_0x22a56f>=_0x2a5d7f){_0x22a56f=_0x2a5d7f;_0x3504ac=0xc8;}else{_0x3504ac=0xce;}_0x1cf229['status'](_0x3504ac);return _0x1cf229[_0x8fe8('0x20')](_0x8fe8('0x21'),_0x3631d3+'-'+_0x22a56f+'/'+_0x2a5d7f)['json'](_0x240863);}return null;};}function patchUpdates(_0x165c85){return function(_0x2fdef9){try{jsonpatch[_0x8fe8('0x22')](_0x2fdef9,_0x165c85,!![]);}catch(_0x1d8a4f){return BPromise['reject'](_0x1d8a4f);}return _0x2fdef9[_0x8fe8('0x23')]();};}function saveUpdates(_0x1c4a04,_0x431671){return function(_0x4daf8b){if(_0x4daf8b){return _0x4daf8b['update'](_0x1c4a04)[_0x8fe8('0x24')](function(_0x4bfbc3){return _0x4bfbc3;});}return null;};}function removeEntity(_0x1b30e5,_0x1cf0f7){return function(_0x5e85e7){if(_0x5e85e7){return _0x5e85e7[_0x8fe8('0x25')]()[_0x8fe8('0x24')](function(){_0x1b30e5[_0x8fe8('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516a47,_0x2313a8){return function(_0x3872fe){if(!_0x3872fe){_0x516a47['sendStatus'](0x194);}return _0x3872fe;};}function handleError(_0x32f916,_0x534455){_0x534455=_0x534455||0x1f4;return function(_0x32a427){logger[_0x8fe8('0x27')](_0x32a427[_0x8fe8('0x28')]);if(_0x32a427[_0x8fe8('0x29')]){delete _0x32a427[_0x8fe8('0x29')];}_0x32f916[_0x8fe8('0x26')](_0x534455)[_0x8fe8('0x2a')](_0x32a427);};}exports[_0x8fe8('0x2b')]=function(_0x43ede2,_0x28fdfc){var _0x22b4dd={},_0x185eb4={},_0x5ab41c={'count':0x0,'rows':[]};var _0x2fd2f9=_[_0x8fe8('0x2c')](db['OpenchannelTransferReport'][_0x8fe8('0x2d')],function(_0x49cc4f){return{'name':_0x49cc4f['fieldName'],'type':_0x49cc4f['type']['key']};});_0x185eb4['model']=_[_0x8fe8('0x2c')](_0x2fd2f9,_0x8fe8('0x29'));_0x185eb4[_0x8fe8('0x2e')]=_['keys'](_0x43ede2[_0x8fe8('0x2e')]);_0x185eb4[_0x8fe8('0x2f')]=_[_0x8fe8('0x30')](_0x185eb4[_0x8fe8('0x31')],_0x185eb4['query']);_0x22b4dd[_0x8fe8('0x32')]=_[_0x8fe8('0x30')](_0x185eb4[_0x8fe8('0x31')],qs['fields'](_0x43ede2[_0x8fe8('0x2e')][_0x8fe8('0x33')]));_0x22b4dd[_0x8fe8('0x32')]=_0x22b4dd[_0x8fe8('0x32')][_0x8fe8('0x34')]?_0x22b4dd[_0x8fe8('0x32')]:_0x185eb4['model'];if(!_0x43ede2[_0x8fe8('0x2e')][_0x8fe8('0x35')](_0x8fe8('0x36'))){_0x22b4dd['limit']=qs[_0x8fe8('0x1d')](_0x43ede2[_0x8fe8('0x2e')][_0x8fe8('0x1d')]);_0x22b4dd['offset']=qs[_0x8fe8('0x1f')](_0x43ede2[_0x8fe8('0x2e')][_0x8fe8('0x1f')]);}_0x22b4dd[_0x8fe8('0x37')]=qs[_0x8fe8('0x38')](_0x43ede2[_0x8fe8('0x2e')][_0x8fe8('0x38')]);_0x22b4dd[_0x8fe8('0x39')]=qs[_0x8fe8('0x2f')](_[_0x8fe8('0x3a')](_0x43ede2[_0x8fe8('0x2e')],_0x185eb4['filters']),_0x2fd2f9);if(_0x43ede2[_0x8fe8('0x2e')][_0x8fe8('0x3b')]){_0x22b4dd[_0x8fe8('0x39')]=_[_0x8fe8('0x3c')](_0x22b4dd[_0x8fe8('0x39')],{'$or':_[_0x8fe8('0x2c')](_0x2fd2f9,function(_0x5b1d81){if(_0x5b1d81[_0x8fe8('0x3d')]!=='VIRTUAL'){var _0xc50384={};_0xc50384[_0x5b1d81[_0x8fe8('0x29')]]={'$like':'%'+_0x43ede2['query'][_0x8fe8('0x3b')]+'%'};return _0xc50384;}})});}_0x22b4dd=_[_0x8fe8('0x3c')]({},_0x22b4dd,_0x43ede2[_0x8fe8('0x3e')]);var _0x90d517={'where':_0x22b4dd['where']};return db[_0x8fe8('0x3f')][_0x8fe8('0x1e')](_0x90d517)[_0x8fe8('0x24')](function(_0x3d63d9){_0x5ab41c['count']=_0x3d63d9;if(_0x43ede2[_0x8fe8('0x2e')][_0x8fe8('0x40')]){_0x22b4dd[_0x8fe8('0x41')]=[{'all':!![]}];}return db[_0x8fe8('0x3f')]['findAll'](_0x22b4dd);})[_0x8fe8('0x24')](function(_0x243af4){_0x5ab41c[_0x8fe8('0x42')]=_0x243af4;return _0x5ab41c;})['then'](respondWithFilteredResult(_0x28fdfc,_0x22b4dd))[_0x8fe8('0x43')](handleError(_0x28fdfc,null));};exports[_0x8fe8('0x44')]=function(_0x527aff,_0x3d85f2){var _0x584876={'raw':!![],'where':{'id':_0x527aff['params']['id']}},_0x24c9d9={};_0x24c9d9['model']=_[_0x8fe8('0x45')](db[_0x8fe8('0x3f')]['rawAttributes']);_0x24c9d9[_0x8fe8('0x2e')]=_[_0x8fe8('0x45')](_0x527aff[_0x8fe8('0x2e')]);_0x24c9d9[_0x8fe8('0x2f')]=_[_0x8fe8('0x30')](_0x24c9d9[_0x8fe8('0x31')],_0x24c9d9['query']);_0x584876[_0x8fe8('0x32')]=_['intersection'](_0x24c9d9['model'],qs['fields'](_0x527aff[_0x8fe8('0x2e')][_0x8fe8('0x33')]));_0x584876[_0x8fe8('0x32')]=_0x584876[_0x8fe8('0x32')][_0x8fe8('0x34')]?_0x584876['attributes']:_0x24c9d9[_0x8fe8('0x31')];if(_0x527aff[_0x8fe8('0x2e')]['includeAll']){_0x584876[_0x8fe8('0x41')]=[{'all':!![]}];}_0x584876=_[_0x8fe8('0x3c')]({},_0x584876,_0x527aff[_0x8fe8('0x3e')]);return db[_0x8fe8('0x3f')][_0x8fe8('0x46')](_0x584876)[_0x8fe8('0x24')](handleEntityNotFound(_0x3d85f2,null))[_0x8fe8('0x24')](respondWithResult(_0x3d85f2,null))[_0x8fe8('0x43')](handleError(_0x3d85f2,null));};exports['create']=function(_0x44cae9,_0x48566d){return db[_0x8fe8('0x3f')][_0x8fe8('0x47')](_0x44cae9[_0x8fe8('0x48')],{})[_0x8fe8('0x24')](respondWithResult(_0x48566d,0xc9))[_0x8fe8('0x43')](handleError(_0x48566d,null));};exports['update']=function(_0x57b899,_0x180b3e){if(_0x57b899[_0x8fe8('0x48')]['id']){delete _0x57b899[_0x8fe8('0x48')]['id'];}return db[_0x8fe8('0x3f')][_0x8fe8('0x46')]({'where':{'id':_0x57b899[_0x8fe8('0x49')]['id']}})[_0x8fe8('0x24')](handleEntityNotFound(_0x180b3e,null))[_0x8fe8('0x24')](saveUpdates(_0x57b899[_0x8fe8('0x48')],null))[_0x8fe8('0x24')](respondWithResult(_0x180b3e,null))[_0x8fe8('0x43')](handleError(_0x180b3e,null));};exports[_0x8fe8('0x25')]=function(_0x3844c9,_0x53476c){return db[_0x8fe8('0x3f')][_0x8fe8('0x46')]({'where':{'id':_0x3844c9[_0x8fe8('0x49')]['id']}})[_0x8fe8('0x24')](handleEntityNotFound(_0x53476c,null))[_0x8fe8('0x24')](removeEntity(_0x53476c,null))[_0x8fe8('0x43')](handleError(_0x53476c,null));};exports[_0x8fe8('0x4a')]=function(_0x119224,_0x14dae2){return db[_0x8fe8('0x3f')][_0x8fe8('0x4a')]()[_0x8fe8('0x24')](respondWithResult(_0x14dae2,null))[_0x8fe8('0x43')](handleError(_0x14dae2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 2f9f69f..aa2e75e 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 _0xfe12=['../../config/logger','api','bluebird','request-promise','path','exports','report_openchannel_transfer','uniqueid','lodash'];(function(_0x29f4b3,_0x453793){var _0x10fed1=function(_0x53cf4a){while(--_0x53cf4a){_0x29f4b3['push'](_0x29f4b3['shift']());}};_0x10fed1(++_0x453793);}(_0xfe12,0x1ee));var _0x2fe1=function(_0x7f14eb,_0x293155){_0x7f14eb=_0x7f14eb-0x0;var _0x554bff=_0xfe12[_0x7f14eb];return _0x554bff;};'use strict';var _=require(_0x2fe1('0x0'));var util=require('util');var logger=require(_0x2fe1('0x1'))(_0x2fe1('0x2'));var moment=require('moment');var BPromise=require(_0x2fe1('0x3'));var rp=require(_0x2fe1('0x4'));var fs=require('fs');var path=require(_0x2fe1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x2fe1('0x6')]=function(_0x2ff67d,_0x315976){return _0x2ff67d['define']('OpenchannelTransferReport',attributes,{'tableName':_0x2fe1('0x7'),'paranoid':![],'indexes':[{'name':_0x2fe1('0x8'),'fields':[_0x2fe1('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45ac=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x45ac,0x1e1));var _0xc45a=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0x45ac[_0x1bc762];return _0x40f70c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc45a('0x0'))(_0xc45a('0x1'));var moment=require(_0xc45a('0x2'));var BPromise=require(_0xc45a('0x3'));var rp=require(_0xc45a('0x4'));var fs=require('fs');var path=require(_0xc45a('0x5'));var rimraf=require(_0xc45a('0x6'));var config=require(_0xc45a('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x3576bb,_0x4712d1){return _0x3576bb[_0xc45a('0x8')](_0xc45a('0x9'),attributes,{'tableName':_0xc45a('0xa'),'paranoid':![],'indexes':[{'name':_0xc45a('0xb'),'fields':[_0xc45a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1e2ba97..80bf9d1 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 _0x2eb2=['request','then','info','request\x20sent','error','OpenchannelTransferReport,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x209724,_0x1d9ed1){var _0x45e3d7=function(_0x21ce2b){while(--_0x21ce2b){_0x209724['push'](_0x209724['shift']());}};_0x45e3d7(++_0x1d9ed1);}(_0x2eb2,0x19f));var _0x22eb=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2eb2[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2de095,_0x801aff){var _0x1d9a32=function(_0x2a189e){while(--_0x2a189e){_0x2de095['push'](_0x2de095['shift']());}};_0x1d9a32(++_0x801aff);}(_0x31f0,0xb7));var _0x031f=function(_0x3acca7,_0x477b51){_0x3acca7=_0x3acca7-0x0;var _0x351162=_0x31f0[_0x3acca7];return _0x351162;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 2e669e7..6d59e14 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 _0xd91d=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','path','express','fs-extra'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xd91d,0x13f));var _0xdd91=function(_0x536829,_0x3ae73){_0x536829=_0x536829-0x0;var _0x1cc969=_0xd91d[_0x536829];return _0x1cc969;};'use strict';var multer=require('multer');var util=require(_0xdd91('0x0'));var path=require(_0xdd91('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd91('0x2'));var router=express['Router']();var fs_extra=require(_0xdd91('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdd91('0x4'));var config=require(_0xdd91('0x5'));var controller=require(_0xdd91('0x6'));router[_0xdd91('0x7')]('/',auth[_0xdd91('0x8')](),controller[_0xdd91('0x9')]);router['get'](_0xdd91('0xa'),auth[_0xdd91('0x8')](),controller[_0xdd91('0xb')]);router[_0xdd91('0xc')]('/',auth[_0xdd91('0x8')](),controller[_0xdd91('0xd')]);router[_0xdd91('0xe')]('/:id',auth[_0xdd91('0x8')](),controller['update']);router['delete'](_0xdd91('0xa'),auth['isAuthenticated'](),controller[_0xdd91('0xf')]);module[_0xdd91('0x10')]=router; \ No newline at end of file +var _0x8a95=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x4fef80,_0x3ae27f){var _0x294b77=function(_0x1a43ee){while(--_0x1a43ee){_0x4fef80['push'](_0x4fef80['shift']());}};_0x294b77(++_0x3ae27f);}(_0x8a95,0x10e));var _0x58a9=function(_0x4753f6,_0x29ce35){_0x4753f6=_0x4753f6-0x0;var _0x37028e=_0x8a95[_0x4753f6];return _0x37028e;};'use strict';var multer=require(_0x58a9('0x0'));var util=require('util');var path=require(_0x58a9('0x1'));var timeout=require(_0x58a9('0x2'));var express=require(_0x58a9('0x3'));var router=express[_0x58a9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x58a9('0x5'));var interaction=require(_0x58a9('0x6'));var config=require(_0x58a9('0x7'));var controller=require(_0x58a9('0x8'));router[_0x58a9('0x9')]('/',auth[_0x58a9('0xa')](),controller[_0x58a9('0xb')]);router[_0x58a9('0x9')](_0x58a9('0xc'),auth['isAuthenticated'](),controller[_0x58a9('0xd')]);router[_0x58a9('0xe')]('/',auth['isAuthenticated'](),controller[_0x58a9('0xf')]);router[_0x58a9('0x10')]('/:id',auth[_0x58a9('0xa')](),controller[_0x58a9('0x11')]);router[_0x58a9('0x12')](_0x58a9('0xc'),auth[_0x58a9('0xa')](),controller['destroy']);module[_0x58a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 95ad1e8..6a916a7 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 _0xdd67=['sequelize','exports','STRING','name'];(function(_0x16c941,_0x41452a){var _0x4d8d8f=function(_0x53d510){while(--_0x53d510){_0x16c941['push'](_0x16c941['shift']());}};_0x4d8d8f(++_0x41452a);}(_0xdd67,0x1a4));var _0x7dd6=function(_0x36cd08,_0x10584d){_0x36cd08=_0x36cd08-0x0;var _0x358512=_0xdd67[_0x36cd08];return _0x358512;};'use strict';var Sequelize=require(_0x7dd6('0x0'));module[_0x7dd6('0x1')]={'name':{'type':Sequelize[_0x7dd6('0x2')],'unique':_0x7dd6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7dd6('0x2')]}}; \ No newline at end of file +var _0x8dee=['STRING','exports'];(function(_0x312e59,_0x2cfcd0){var _0x498a8d=function(_0x533cf8){while(--_0x533cf8){_0x312e59['push'](_0x312e59['shift']());}};_0x498a8d(++_0x2cfcd0);}(_0x8dee,0x65));var _0xe8de=function(_0x17ec60,_0x55aa4a){_0x17ec60=_0x17ec60-0x0;var _0x2fef24=_0x8dee[_0x17ec60];return _0x2fef24;};'use strict';var Sequelize=require('sequelize');module[_0xe8de('0x0')]={'name':{'type':Sequelize[_0xe8de('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe8de('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7e32e2f..7b0afdc 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 _0x163f=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','end','sendStatus','name','send','index','Pause','rawAttributes','fieldName','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','error','eml-format','rimraf'];(function(_0x42cf3b,_0x3bb5d7){var _0x416c2d=function(_0x2c774c){while(--_0x2c774c){_0x42cf3b['push'](_0x42cf3b['shift']());}};_0x416c2d(++_0x3bb5d7);}(_0x163f,0x146));var _0xf163=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x163f[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0xf163('0x0'));var rimraf=require(_0xf163('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf163('0x2'));var rp=require(_0xf163('0x3'));var moment=require('moment');var BPromise=require(_0xf163('0x4'));var Mustache=require(_0xf163('0x5'));var util=require(_0xf163('0x6'));var path=require(_0xf163('0x7'));var sox=require(_0xf163('0x8'));var csv=require(_0xf163('0x9'));var ejs=require(_0xf163('0xa'));var fs=require('fs');var fs_extra=require(_0xf163('0xb'));var _=require('lodash');var squel=require(_0xf163('0xc'));var crypto=require(_0xf163('0xd'));var jsforce=require(_0xf163('0xe'));var deskjs=require(_0xf163('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf163('0x10'));var Papa=require(_0xf163('0x11'));var Redis=require('ioredis');var authService=require(_0xf163('0x12'));var qs=require(_0xf163('0x13'));var as=require(_0xf163('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf163('0x15'))(_0xf163('0x16'));var utils=require('../../config/utils');var config=require(_0xf163('0x17'));var licenseUtil=require(_0xf163('0x18'));var db=require(_0xf163('0x19'))['db'];function respondWithStatusCode(_0x4bc03d,_0x32c885){_0x32c885=_0x32c885||0xcc;return function(_0x3eff1f){if(_0x3eff1f){return _0x4bc03d['sendStatus'](_0x32c885);}return _0x4bc03d[_0xf163('0x1a')](_0x32c885)['end']();};}function respondWithResult(_0x3388c2,_0x42792d){_0x42792d=_0x42792d||0xc8;return function(_0x303310){if(_0x303310){return _0x3388c2[_0xf163('0x1a')](_0x42792d)['json'](_0x303310);}};}function respondWithFilteredResult(_0x2025cd,_0x40bb3b){return function(_0x39e33c){if(_0x39e33c){var _0x1fcc2c=typeof _0x40bb3b[_0xf163('0x1b')]===_0xf163('0x1c')&&typeof _0x40bb3b[_0xf163('0x1d')]===_0xf163('0x1c');var _0x13af25=_0x39e33c[_0xf163('0x1e')];var _0x3adde4=_0x1fcc2c?0x0:_0x40bb3b[_0xf163('0x1b')];var _0x7e0583=_0x1fcc2c?_0x39e33c['count']:_0x40bb3b[_0xf163('0x1b')]+_0x40bb3b[_0xf163('0x1d')];var _0x882e41;if(_0x7e0583>=_0x13af25){_0x7e0583=_0x13af25;_0x882e41=0xc8;}else{_0x882e41=0xce;}_0x2025cd[_0xf163('0x1a')](_0x882e41);return _0x2025cd['set']('Content-Range',_0x3adde4+'-'+_0x7e0583+'/'+_0x13af25)[_0xf163('0x1f')](_0x39e33c);}return null;};}function patchUpdates(_0x4d2113){return function(_0x190f66){try{jsonpatch[_0xf163('0x20')](_0x190f66,_0x4d2113,!![]);}catch(_0x3f135a){return BPromise[_0xf163('0x21')](_0x3f135a);}return _0x190f66[_0xf163('0x22')]();};}function saveUpdates(_0xd182a2,_0x5b1495){return function(_0x4b5e01){if(_0x4b5e01){return _0x4b5e01[_0xf163('0x23')](_0xd182a2)[_0xf163('0x24')](function(_0x9ad475){return _0x9ad475;});}return null;};}function removeEntity(_0x3a688a,_0x3228c3){return function(_0x292293){if(_0x292293){return _0x292293[_0xf163('0x25')]()[_0xf163('0x24')](function(){var _0x83bc92=_0x292293['get']({'plain':!![]});var _0x2b89f2=_0xf163('0x26');return db[_0xf163('0x27')][_0xf163('0x25')]({'where':{'type':_0x2b89f2,'resourceId':_0x83bc92['id']}})[_0xf163('0x24')](function(){return _0x292293;});})[_0xf163('0x24')](function(){_0x3a688a[_0xf163('0x1a')](0xcc)[_0xf163('0x28')]();});}};}function handleEntityNotFound(_0xf68308,_0x46e3cd){return function(_0x3f3ae5){if(!_0x3f3ae5){_0xf68308[_0xf163('0x29')](0x194);}return _0x3f3ae5;};}function handleError(_0x2390c7,_0x5ec186){_0x5ec186=_0x5ec186||0x1f4;return function(_0x4d28e2){logger['error'](_0x4d28e2['stack']);if(_0x4d28e2[_0xf163('0x2a')]){delete _0x4d28e2[_0xf163('0x2a')];}_0x2390c7['status'](_0x5ec186)[_0xf163('0x2b')](_0x4d28e2);};}exports[_0xf163('0x2c')]=function(_0x276548,_0x1b403f){var _0x17c96c={},_0x5253d9={},_0x3bdf56={'count':0x0,'rows':[]};var _0x4292e9=_['map'](db[_0xf163('0x2d')][_0xf163('0x2e')],function(_0x33c770){return{'name':_0x33c770[_0xf163('0x2f')],'type':_0x33c770['type']['key']};});_0x5253d9[_0xf163('0x30')]=_[_0xf163('0x31')](_0x4292e9,_0xf163('0x2a'));_0x5253d9[_0xf163('0x32')]=_['keys'](_0x276548[_0xf163('0x32')]);_0x5253d9['filters']=_[_0xf163('0x33')](_0x5253d9[_0xf163('0x30')],_0x5253d9[_0xf163('0x32')]);_0x17c96c['attributes']=_['intersection'](_0x5253d9['model'],qs[_0xf163('0x34')](_0x276548['query'][_0xf163('0x34')]));_0x17c96c[_0xf163('0x35')]=_0x17c96c[_0xf163('0x35')][_0xf163('0x36')]?_0x17c96c['attributes']:_0x5253d9['model'];if(!_0x276548['query'][_0xf163('0x37')](_0xf163('0x38'))){_0x17c96c[_0xf163('0x1d')]=qs[_0xf163('0x1d')](_0x276548['query'][_0xf163('0x1d')]);_0x17c96c[_0xf163('0x1b')]=qs['offset'](_0x276548[_0xf163('0x32')][_0xf163('0x1b')]);}_0x17c96c['order']=qs[_0xf163('0x39')](_0x276548[_0xf163('0x32')]['sort']);_0x17c96c[_0xf163('0x3a')]=qs['filters'](_[_0xf163('0x3b')](_0x276548[_0xf163('0x32')],_0x5253d9[_0xf163('0x3c')]),_0x4292e9);if(_0x276548[_0xf163('0x32')][_0xf163('0x3d')]){_0x17c96c[_0xf163('0x3a')]=_[_0xf163('0x3e')](_0x17c96c[_0xf163('0x3a')],{'$or':_[_0xf163('0x31')](_0x4292e9,function(_0x39048b){if(_0x39048b[_0xf163('0x3f')]!=='VIRTUAL'){var _0x40a798={};_0x40a798[_0x39048b[_0xf163('0x2a')]]={'$like':'%'+_0x276548['query'][_0xf163('0x3d')]+'%'};return _0x40a798;}})});}_0x17c96c=_[_0xf163('0x3e')]({},_0x17c96c,_0x276548[_0xf163('0x40')]);var _0x2df0c3={'where':_0x17c96c[_0xf163('0x3a')]};return db[_0xf163('0x2d')][_0xf163('0x1e')](_0x2df0c3)['then'](function(_0x45932a){_0x3bdf56[_0xf163('0x1e')]=_0x45932a;if(_0x276548[_0xf163('0x32')][_0xf163('0x41')]){_0x17c96c[_0xf163('0x42')]=[{'all':!![]}];}return db['Pause'][_0xf163('0x43')](_0x17c96c);})['then'](function(_0x16bf14){_0x3bdf56[_0xf163('0x44')]=_0x16bf14;return _0x3bdf56;})['then'](respondWithFilteredResult(_0x1b403f,_0x17c96c))[_0xf163('0x45')](handleError(_0x1b403f,null));};exports[_0xf163('0x46')]=function(_0x1ab458,_0x4f140b){var _0x4a0ffb={'raw':!![],'where':{'id':_0x1ab458[_0xf163('0x47')]['id']}},_0x496c4a={};_0x496c4a['model']=_['keys'](db[_0xf163('0x2d')][_0xf163('0x2e')]);_0x496c4a[_0xf163('0x32')]=_[_0xf163('0x48')](_0x1ab458[_0xf163('0x32')]);_0x496c4a[_0xf163('0x3c')]=_[_0xf163('0x33')](_0x496c4a['model'],_0x496c4a['query']);_0x4a0ffb[_0xf163('0x35')]=_[_0xf163('0x33')](_0x496c4a[_0xf163('0x30')],qs[_0xf163('0x34')](_0x1ab458['query'][_0xf163('0x34')]));_0x4a0ffb[_0xf163('0x35')]=_0x4a0ffb['attributes'][_0xf163('0x36')]?_0x4a0ffb[_0xf163('0x35')]:_0x496c4a[_0xf163('0x30')];if(_0x1ab458['query']['includeAll']){_0x4a0ffb['include']=[{'all':!![]}];}_0x4a0ffb=_['merge']({},_0x4a0ffb,_0x1ab458['options']);return db['Pause'][_0xf163('0x49')](_0x4a0ffb)[_0xf163('0x24')](handleEntityNotFound(_0x4f140b,null))['then'](respondWithResult(_0x4f140b,null))['catch'](handleError(_0x4f140b,null));};exports[_0xf163('0x4a')]=function(_0x3e0e24,_0x4c36b3){return db[_0xf163('0x2d')]['create'](_0x3e0e24[_0xf163('0x4b')],{})[_0xf163('0x24')](function(_0x426a92){var _0x1aee06=_0x3e0e24['user'][_0xf163('0x4c')]({'plain':!![]});if(!_0x1aee06)throw new Error(_0xf163('0x4d'));if(_0x1aee06[_0xf163('0x4e')]===_0xf163('0x4f')){var _0x163b44=_0x426a92[_0xf163('0x4c')]({'plain':!![]});var _0x1fa3b5='Pauses';return db['UserProfileSection'][_0xf163('0x49')]({'where':{'name':_0x1fa3b5,'userProfileId':_0x1aee06[_0xf163('0x50')]},'raw':!![]})[_0xf163('0x24')](function(_0x4d1d3b){if(_0x4d1d3b&&_0x4d1d3b['autoAssociation']===0x0){return db[_0xf163('0x27')]['create']({'name':_0x163b44[_0xf163('0x2a')],'resourceId':_0x163b44['id'],'type':_0x4d1d3b[_0xf163('0x2a')],'sectionId':_0x4d1d3b['id']},{})[_0xf163('0x24')](function(){return _0x426a92;});}else{return _0x426a92;}})[_0xf163('0x45')](function(_0x4b438a){logger[_0xf163('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b438a);throw _0x4b438a;});}return _0x426a92;})[_0xf163('0x24')](respondWithResult(_0x4c36b3,0xc9))[_0xf163('0x45')](handleError(_0x4c36b3,null));};exports[_0xf163('0x23')]=function(_0x3c24c1,_0x27a078){if(_0x3c24c1[_0xf163('0x4b')]['id']){delete _0x3c24c1[_0xf163('0x4b')]['id'];}return db['Pause'][_0xf163('0x49')]({'where':{'id':_0x3c24c1[_0xf163('0x47')]['id']}})[_0xf163('0x24')](handleEntityNotFound(_0x27a078,null))[_0xf163('0x24')](saveUpdates(_0x3c24c1[_0xf163('0x4b')],null))[_0xf163('0x24')](respondWithResult(_0x27a078,null))[_0xf163('0x45')](handleError(_0x27a078,null));};exports[_0xf163('0x25')]=function(_0x1fafc7,_0x50d0f9){return db['Pause'][_0xf163('0x49')]({'where':{'id':_0x1fafc7['params']['id']}})[_0xf163('0x24')](handleEntityNotFound(_0x50d0f9,null))[_0xf163('0x24')](removeEntity(_0x50d0f9,null))[_0xf163('0x45')](handleError(_0x50d0f9,null));}; \ No newline at end of file +var _0x4db7=['offset','Content-Range','then','get','Pauses','UserProfileResource','destroy','error','stack','name','send','index','Pause','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','map','VIRTUAL','merge','includeAll','include','rows','show','params','keys','rawAttributes','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x4db7,0x11d));var _0x74db=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4db7[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x74db('0x0'));var rimraf=require(_0x74db('0x1'));var zipdir=require(_0x74db('0x2'));var jsonpatch=require(_0x74db('0x3'));var rp=require(_0x74db('0x4'));var moment=require(_0x74db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74db('0x6'));var util=require(_0x74db('0x7'));var path=require(_0x74db('0x8'));var sox=require('sox');var csv=require(_0x74db('0x9'));var ejs=require(_0x74db('0xa'));var fs=require('fs');var fs_extra=require(_0x74db('0xb'));var _=require('lodash');var squel=require(_0x74db('0xc'));var crypto=require(_0x74db('0xd'));var jsforce=require(_0x74db('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x74db('0x9'));var querystring=require('querystring');var Papa=require(_0x74db('0xf'));var Redis=require('ioredis');var authService=require(_0x74db('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x74db('0x11'));var hardwareService=require(_0x74db('0x12'));var logger=require(_0x74db('0x13'))(_0x74db('0x14'));var utils=require(_0x74db('0x15'));var config=require(_0x74db('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x74db('0x17'))['db'];function respondWithStatusCode(_0x104bbd,_0x4f2e48){_0x4f2e48=_0x4f2e48||0xcc;return function(_0x3c1d36){if(_0x3c1d36){return _0x104bbd[_0x74db('0x18')](_0x4f2e48);}return _0x104bbd[_0x74db('0x19')](_0x4f2e48)[_0x74db('0x1a')]();};}function respondWithResult(_0x213755,_0x4c6419){_0x4c6419=_0x4c6419||0xc8;return function(_0x286ca7){if(_0x286ca7){return _0x213755['status'](_0x4c6419)[_0x74db('0x1b')](_0x286ca7);}};}function respondWithFilteredResult(_0x3d2d7b,_0x5aa896){return function(_0x5e9b6d){if(_0x5e9b6d){var _0x1bbc75=typeof _0x5aa896['offset']===_0x74db('0x1c')&&typeof _0x5aa896[_0x74db('0x1d')]==='undefined';var _0xf679a=_0x5e9b6d[_0x74db('0x1e')];var _0x68c660=_0x1bbc75?0x0:_0x5aa896[_0x74db('0x1f')];var _0x1ba793=_0x1bbc75?_0x5e9b6d[_0x74db('0x1e')]:_0x5aa896['offset']+_0x5aa896[_0x74db('0x1d')];var _0x24a36c;if(_0x1ba793>=_0xf679a){_0x1ba793=_0xf679a;_0x24a36c=0xc8;}else{_0x24a36c=0xce;}_0x3d2d7b[_0x74db('0x19')](_0x24a36c);return _0x3d2d7b['set'](_0x74db('0x20'),_0x68c660+'-'+_0x1ba793+'/'+_0xf679a)[_0x74db('0x1b')](_0x5e9b6d);}return null;};}function patchUpdates(_0x4623ac){return function(_0x565745){try{jsonpatch['apply'](_0x565745,_0x4623ac,!![]);}catch(_0x16209b){return BPromise['reject'](_0x16209b);}return _0x565745['save']();};}function saveUpdates(_0xdb8292,_0x67bd29){return function(_0x54603c){if(_0x54603c){return _0x54603c['update'](_0xdb8292)[_0x74db('0x21')](function(_0x169613){return _0x169613;});}return null;};}function removeEntity(_0x40ad1f,_0x35ecb2){return function(_0x5a4ef3){if(_0x5a4ef3){return _0x5a4ef3['destroy']()[_0x74db('0x21')](function(){var _0x5a2ec3=_0x5a4ef3[_0x74db('0x22')]({'plain':!![]});var _0x2b83fe=_0x74db('0x23');return db[_0x74db('0x24')][_0x74db('0x25')]({'where':{'type':_0x2b83fe,'resourceId':_0x5a2ec3['id']}})[_0x74db('0x21')](function(){return _0x5a4ef3;});})[_0x74db('0x21')](function(){_0x40ad1f[_0x74db('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256d1e,_0x2bbfa4){return function(_0x164714){if(!_0x164714){_0x256d1e['sendStatus'](0x194);}return _0x164714;};}function handleError(_0x1a5f02,_0x4400ba){_0x4400ba=_0x4400ba||0x1f4;return function(_0x4db973){logger[_0x74db('0x26')](_0x4db973[_0x74db('0x27')]);if(_0x4db973['name']){delete _0x4db973[_0x74db('0x28')];}_0x1a5f02[_0x74db('0x19')](_0x4400ba)[_0x74db('0x29')](_0x4db973);};}exports[_0x74db('0x2a')]=function(_0x5913ce,_0x16e3c7){var _0x4cb792={},_0x3f2cec={},_0x176438={'count':0x0,'rows':[]};var _0x4ba1cd=_['map'](db[_0x74db('0x2b')]['rawAttributes'],function(_0x16b19a){return{'name':_0x16b19a['fieldName'],'type':_0x16b19a[_0x74db('0x2c')][_0x74db('0x2d')]};});_0x3f2cec[_0x74db('0x2e')]=_['map'](_0x4ba1cd,_0x74db('0x28'));_0x3f2cec[_0x74db('0x2f')]=_['keys'](_0x5913ce[_0x74db('0x2f')]);_0x3f2cec[_0x74db('0x30')]=_[_0x74db('0x31')](_0x3f2cec[_0x74db('0x2e')],_0x3f2cec[_0x74db('0x2f')]);_0x4cb792['attributes']=_[_0x74db('0x31')](_0x3f2cec['model'],qs[_0x74db('0x32')](_0x5913ce[_0x74db('0x2f')]['fields']));_0x4cb792[_0x74db('0x33')]=_0x4cb792[_0x74db('0x33')][_0x74db('0x34')]?_0x4cb792['attributes']:_0x3f2cec[_0x74db('0x2e')];if(!_0x5913ce[_0x74db('0x2f')][_0x74db('0x35')]('nolimit')){_0x4cb792['limit']=qs[_0x74db('0x1d')](_0x5913ce[_0x74db('0x2f')][_0x74db('0x1d')]);_0x4cb792[_0x74db('0x1f')]=qs[_0x74db('0x1f')](_0x5913ce[_0x74db('0x2f')][_0x74db('0x1f')]);}_0x4cb792[_0x74db('0x36')]=qs[_0x74db('0x37')](_0x5913ce[_0x74db('0x2f')]['sort']);_0x4cb792[_0x74db('0x38')]=qs['filters'](_['pick'](_0x5913ce[_0x74db('0x2f')],_0x3f2cec[_0x74db('0x30')]),_0x4ba1cd);if(_0x5913ce['query'][_0x74db('0x39')]){_0x4cb792['where']=_['merge'](_0x4cb792[_0x74db('0x38')],{'$or':_[_0x74db('0x3a')](_0x4ba1cd,function(_0x40f23f){if(_0x40f23f[_0x74db('0x2c')]!==_0x74db('0x3b')){var _0x416606={};_0x416606[_0x40f23f[_0x74db('0x28')]]={'$like':'%'+_0x5913ce[_0x74db('0x2f')]['filter']+'%'};return _0x416606;}})});}_0x4cb792=_[_0x74db('0x3c')]({},_0x4cb792,_0x5913ce['options']);var _0x53b658={'where':_0x4cb792[_0x74db('0x38')]};return db['Pause'][_0x74db('0x1e')](_0x53b658)[_0x74db('0x21')](function(_0x4eda84){_0x176438[_0x74db('0x1e')]=_0x4eda84;if(_0x5913ce[_0x74db('0x2f')][_0x74db('0x3d')]){_0x4cb792[_0x74db('0x3e')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x4cb792);})[_0x74db('0x21')](function(_0x402771){_0x176438[_0x74db('0x3f')]=_0x402771;return _0x176438;})['then'](respondWithFilteredResult(_0x16e3c7,_0x4cb792))['catch'](handleError(_0x16e3c7,null));};exports[_0x74db('0x40')]=function(_0x5b08c1,_0x5de0db){var _0x1c5764={'raw':!![],'where':{'id':_0x5b08c1[_0x74db('0x41')]['id']}},_0x5a9e7e={};_0x5a9e7e[_0x74db('0x2e')]=_[_0x74db('0x42')](db[_0x74db('0x2b')][_0x74db('0x43')]);_0x5a9e7e[_0x74db('0x2f')]=_[_0x74db('0x42')](_0x5b08c1['query']);_0x5a9e7e['filters']=_['intersection'](_0x5a9e7e[_0x74db('0x2e')],_0x5a9e7e['query']);_0x1c5764['attributes']=_[_0x74db('0x31')](_0x5a9e7e['model'],qs[_0x74db('0x32')](_0x5b08c1['query']['fields']));_0x1c5764[_0x74db('0x33')]=_0x1c5764[_0x74db('0x33')][_0x74db('0x34')]?_0x1c5764[_0x74db('0x33')]:_0x5a9e7e['model'];if(_0x5b08c1[_0x74db('0x2f')][_0x74db('0x3d')]){_0x1c5764['include']=[{'all':!![]}];}_0x1c5764=_[_0x74db('0x3c')]({},_0x1c5764,_0x5b08c1[_0x74db('0x44')]);return db[_0x74db('0x2b')][_0x74db('0x45')](_0x1c5764)[_0x74db('0x21')](handleEntityNotFound(_0x5de0db,null))['then'](respondWithResult(_0x5de0db,null))['catch'](handleError(_0x5de0db,null));};exports[_0x74db('0x46')]=function(_0x2dbfbb,_0x4c86ba){return db[_0x74db('0x2b')][_0x74db('0x46')](_0x2dbfbb[_0x74db('0x47')],{})[_0x74db('0x21')](function(_0x3d0ccd){var _0x438b0b=_0x2dbfbb['user'][_0x74db('0x22')]({'plain':!![]});if(!_0x438b0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x438b0b[_0x74db('0x48')]===_0x74db('0x49')){var _0x3b83c9=_0x3d0ccd[_0x74db('0x22')]({'plain':!![]});var _0x52672f=_0x74db('0x23');return db[_0x74db('0x4a')][_0x74db('0x45')]({'where':{'name':_0x52672f,'userProfileId':_0x438b0b[_0x74db('0x4b')]},'raw':!![]})[_0x74db('0x21')](function(_0x3b16b4){if(_0x3b16b4&&_0x3b16b4[_0x74db('0x4c')]===0x0){return db[_0x74db('0x24')][_0x74db('0x46')]({'name':_0x3b83c9['name'],'resourceId':_0x3b83c9['id'],'type':_0x3b16b4[_0x74db('0x28')],'sectionId':_0x3b16b4['id']},{})[_0x74db('0x21')](function(){return _0x3d0ccd;});}else{return _0x3d0ccd;}})[_0x74db('0x4d')](function(_0x32004d){logger[_0x74db('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32004d);throw _0x32004d;});}return _0x3d0ccd;})[_0x74db('0x21')](respondWithResult(_0x4c86ba,0xc9))['catch'](handleError(_0x4c86ba,null));};exports[_0x74db('0x4e')]=function(_0x3d4a87,_0x56d9ad){if(_0x3d4a87['body']['id']){delete _0x3d4a87['body']['id'];}return db[_0x74db('0x2b')][_0x74db('0x45')]({'where':{'id':_0x3d4a87[_0x74db('0x41')]['id']}})[_0x74db('0x21')](handleEntityNotFound(_0x56d9ad,null))[_0x74db('0x21')](saveUpdates(_0x3d4a87[_0x74db('0x47')],null))[_0x74db('0x21')](respondWithResult(_0x56d9ad,null))[_0x74db('0x4d')](handleError(_0x56d9ad,null));};exports[_0x74db('0x25')]=function(_0x444e08,_0x43c01f){return db[_0x74db('0x2b')][_0x74db('0x45')]({'where':{'id':_0x444e08[_0x74db('0x41')]['id']}})['then'](handleEntityNotFound(_0x43c01f,null))[_0x74db('0x21')](removeEntity(_0x43c01f,null))[_0x74db('0x4d')](handleError(_0x43c01f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index e257ba9..f0ef286 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0x7217,0x19e));var _0x7721=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x7217[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x1af3f6,_0x319c28){var _0x3b684e=function(_0x3dc174){while(--_0x3dc174){_0x1af3f6['push'](_0x1af3f6['shift']());}};_0x3b684e(++_0x319c28);}(_0x53ec,0x192));var _0xc53e=function(_0x2122f,_0x41c9d7){_0x2122f=_0x2122f-0x0;var _0x25924c=_0x53ec[_0x2122f];return _0x25924c;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index ce7efbc..09b7229 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x39fcc1,_0x9e0ec9){var _0x3564=function(_0x3d583c){while(--_0x3d583c){_0x39fcc1['push'](_0x39fcc1['shift']());}};_0x3564(++_0x9e0ec9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1391a8,_0x4e2f7f){_0x1391a8=_0x1391a8-0x0;var _0x1e3519=_0xb10b[_0x1391a8];return _0x1e3519;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x2b3bcd,_0x431b2d){var _0xed2d0a=function(_0x5958c4){while(--_0x5958c4){_0x2b3bcd['push'](_0x2b3bcd['shift']());}};_0xed2d0a(++_0x431b2d);}(_0x7a54,0x106));var _0x47a5=function(_0x18f0ca,_0x1dc34f){_0x18f0ca=_0x18f0ca-0x0;var _0x5a0bc5=_0x7a54[_0x18f0ca];return _0x5a0bc5;};'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 738e22e..3fd295c 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 _0x826a=['fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','now','post','single','file','webhookPost','put','update','delete','exports','util','connect-timeout','Router'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x826a,0x1aa));var _0xa826=function(_0x1caf7a,_0x2d9534){_0x1caf7a=_0x1caf7a-0x0;var _0x3c7d44=_0x826a[_0x1caf7a];return _0x3c7d44;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),controller[_0xa826('0xb')]);router[_0xa826('0x7')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0x7')](_0xa826('0xe'),auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);var upload=multer({'storage':multer[_0xa826('0x10')]({'destination':function(_0x48df82,_0xbd22fc,_0x4b4caf){_0x4b4caf(null,path[_0xa826('0x11')](config[_0xa826('0x12')],_0xa826('0x13')));},'filename':function(_0xa55bd7,_0x212fac,_0x40838f){_0x212fac[_0xa826('0x14')]=_0x212fac['originalname'][_0xa826('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40838f(null,util['format'](_0xa826('0x16'),path[_0xa826('0x17')](_0x212fac['originalname'],path['extname'](_0x212fac['originalname'])),Date[_0xa826('0x18')](),path['extname'](_0x212fac['originalname'])));}})});router[_0xa826('0x19')]('/',upload[_0xa826('0x1a')](_0xa826('0x1b')),controller['upload']);router[_0xa826('0x19')](_0xa826('0xa'),controller[_0xa826('0x1c')]);router[_0xa826('0x1d')](_0xa826('0xc'),auth['isAuthenticated'](),controller[_0xa826('0x1e')]);router[_0xa826('0x1f')](_0xa826('0xc'),auth['isAuthenticated'](),controller['delete']);module[_0xa826('0x20')]=router; \ No newline at end of file +var _0x9a19=['index','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated'];(function(_0x6a60c1,_0x4913bd){var _0x5958e7=function(_0x250ed0){while(--_0x250ed0){_0x6a60c1['push'](_0x6a60c1['shift']());}};_0x5958e7(++_0x4913bd);}(_0x9a19,0x114));var _0x99a1=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x9a19[_0x421196];return _0x2738af;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/webhook',controller['webhookGet']);router['get'](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller['show']);router['get'](_0x99a1('0xe'),auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);var upload=multer({'storage':multer[_0x99a1('0x10')]({'destination':function(_0x1551a1,_0x537032,_0x28ee99){_0x28ee99(null,path[_0x99a1('0x11')](config[_0x99a1('0x12')],_0x99a1('0x13')));},'filename':function(_0x2c68dd,_0x1bc7aa,_0x2ff655){_0x1bc7aa[_0x99a1('0x14')]=_0x1bc7aa[_0x99a1('0x14')][_0x99a1('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ff655(null,util[_0x99a1('0x16')](_0x99a1('0x17'),path[_0x99a1('0x18')](_0x1bc7aa[_0x99a1('0x14')],path[_0x99a1('0x19')](_0x1bc7aa['originalname'])),Date[_0x99a1('0x1a')](),path[_0x99a1('0x19')](_0x1bc7aa[_0x99a1('0x14')])));}})});router[_0x99a1('0x1b')]('/',upload[_0x99a1('0x1c')](_0x99a1('0x1d')),controller[_0x99a1('0x1e')]);router['post']('/webhook',controller[_0x99a1('0x1f')]);router[_0x99a1('0x20')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x21')]);router[_0x99a1('0x22')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x22')]);module[_0x99a1('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2cd9d52..7f256e2 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 _0x47bb=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script'];(function(_0x2336ea,_0x46e872){var _0x216bf9=function(_0x14a50d){while(--_0x14a50d){_0x2336ea['push'](_0x2336ea['shift']());}};_0x216bf9(++_0x46e872);}(_0x47bb,0x14d));var _0xb47b=function(_0x5ec3e2,_0x5294df){_0x5ec3e2=_0x5ec3e2-0x0;var _0x152654=_0x47bb[_0x5ec3e2];return _0x152654;};'use strict';var Sequelize=require('sequelize');module[_0xb47b('0x0')]={'name':{'type':Sequelize[_0xb47b('0x1')]},'type':{'type':Sequelize[_0xb47b('0x2')](_0xb47b('0x3'),_0xb47b('0x4'))},'description':{'type':Sequelize[_0xb47b('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xb47b('0x6')},'active':{'type':Sequelize[_0xb47b('0x7')],'defaultValue':0x0,'comment':_0xb47b('0x8')},'sidebar':{'type':Sequelize[_0xb47b('0x2')](_0xb47b('0x9'),'agentOnly','always',_0xb47b('0xa')),'defaultValue':_0xb47b('0xb'),'comment':_0xb47b('0xc')},'icon':{'type':Sequelize[_0xb47b('0x1')]},'adminUrl':{'type':Sequelize[_0xb47b('0x1')]},'agentUrl':{'type':Sequelize[_0xb47b('0x1')]},'scriptName':{'type':Sequelize[_0xb47b('0x1')]},'scriptPath':{'type':Sequelize[_0xb47b('0x1')]}}; \ No newline at end of file +var _0x4765=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4765,0x108));var _0x5476=function(_0x149923,_0x4318cf){_0x149923=_0x149923-0x0;var _0x130349=_0x4765[_0x149923];return _0x130349;};'use strict';var Sequelize=require(_0x5476('0x0'));module[_0x5476('0x1')]={'name':{'type':Sequelize[_0x5476('0x2')]},'type':{'type':Sequelize[_0x5476('0x3')]('html',_0x5476('0x4'))},'description':{'type':Sequelize[_0x5476('0x5')]},'version':{'type':Sequelize[_0x5476('0x5')]},'path':{'type':Sequelize[_0x5476('0x2')],'comment':_0x5476('0x6')},'active':{'type':Sequelize[_0x5476('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5476('0x3')](_0x5476('0x8'),_0x5476('0x9'),_0x5476('0xa'),_0x5476('0xb')),'defaultValue':_0x5476('0xa'),'comment':_0x5476('0xc')},'icon':{'type':Sequelize[_0x5476('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5476('0x2')]},'scriptPath':{'type':Sequelize[_0x5476('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f0626bc..e7054e4 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 _0x0003=['\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','error','name','index','map','Plugin','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','includeAll','download','params','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','Plugins','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve'];(function(_0x175188,_0x293ba1){var _0x5908c0=function(_0x34ae18){while(--_0x34ae18){_0x175188['push'](_0x175188['shift']());}};_0x5908c0(++_0x293ba1);}(_0x0003,0xbc));var _0x3000=function(_0x57d944,_0x1f6854){_0x57d944=_0x57d944-0x0;var _0x452990=_0x0003[_0x57d944];return _0x452990;};'use strict';var emlformat=require(_0x3000('0x0'));var rimraf=require(_0x3000('0x1'));var zipdir=require(_0x3000('0x2'));var jsonpatch=require(_0x3000('0x3'));var rp=require('request-promise');var moment=require(_0x3000('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3000('0x5'));var util=require(_0x3000('0x6'));var path=require(_0x3000('0x7'));var sox=require(_0x3000('0x8'));var csv=require('to-csv');var ejs=require(_0x3000('0x9'));var fs=require('fs');var fs_extra=require(_0x3000('0xa'));var _=require(_0x3000('0xb'));var squel=require(_0x3000('0xc'));var crypto=require(_0x3000('0xd'));var jsforce=require(_0x3000('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3000('0xf'));var Papa=require(_0x3000('0x10'));var extract=require(_0x3000('0x11'));var rimraf=require(_0x3000('0x1'));var archiver=require(_0x3000('0x12'));var Redis=require(_0x3000('0x13'));var authService=require(_0x3000('0x14'));var qs=require(_0x3000('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3000('0x16'));var logger=require(_0x3000('0x17'))('api');var utils=require(_0x3000('0x18'));var config=require(_0x3000('0x19'));var licenseUtil=require(_0x3000('0x1a'));var db=require(_0x3000('0x1b'))['db'];config[_0x3000('0x1c')]=_[_0x3000('0x1d')](config['redis'],{'host':_0x3000('0x1e'),'port':0x18eb});var socket=require(_0x3000('0x1f'))(new Redis(config['redis']));require(_0x3000('0x20'))['register'](socket);function respondWithStatusCode(_0x318502,_0x1426ee){_0x1426ee=_0x1426ee||0xcc;return function(_0x3bba7c){if(_0x3bba7c){return _0x318502[_0x3000('0x21')](_0x1426ee);}return _0x318502[_0x3000('0x22')](_0x1426ee)[_0x3000('0x23')]();};}function respondWithResult(_0x5541a5,_0x1f5a83){_0x1f5a83=_0x1f5a83||0xc8;return function(_0x46f2b2){if(_0x46f2b2){return _0x5541a5[_0x3000('0x22')](_0x1f5a83)[_0x3000('0x24')](_0x46f2b2);}};}function respondWithFilteredResult(_0x2bb110,_0x160ca5){return function(_0xf234b4){if(_0xf234b4){var _0x49c5fc=typeof _0x160ca5[_0x3000('0x25')]===_0x3000('0x26')&&typeof _0x160ca5[_0x3000('0x27')]===_0x3000('0x26');var _0x596cb2=_0xf234b4['count'];var _0x297963=_0x49c5fc?0x0:_0x160ca5[_0x3000('0x25')];var _0x21f438=_0x49c5fc?_0xf234b4[_0x3000('0x28')]:_0x160ca5['offset']+_0x160ca5[_0x3000('0x27')];var _0x22939c;if(_0x21f438>=_0x596cb2){_0x21f438=_0x596cb2;_0x22939c=0xc8;}else{_0x22939c=0xce;}_0x2bb110['status'](_0x22939c);return _0x2bb110[_0x3000('0x29')](_0x3000('0x2a'),_0x297963+'-'+_0x21f438+'/'+_0x596cb2)['json'](_0xf234b4);}return null;};}function patchUpdates(_0x598e11){return function(_0x32d66e){try{jsonpatch['apply'](_0x32d66e,_0x598e11,!![]);}catch(_0x104b85){return BPromise[_0x3000('0x2b')](_0x104b85);}return _0x32d66e[_0x3000('0x2c')]();};}function saveUpdates(_0x5672f6,_0x32775d){return function(_0x2e6813){if(_0x2e6813){return _0x2e6813['update'](_0x5672f6)[_0x3000('0x2d')](function(_0x3cff6f){return _0x3cff6f;});}return null;};}function removeEntity(_0x17b6b5,_0x2b97e5){return function(_0x5099ab){if(_0x5099ab){return _0x5099ab[_0x3000('0x2e')]()[_0x3000('0x2d')](function(){var _0x442a00=_0x5099ab['get']({'plain':!![]});var _0x1813bc='Plugins';return db[_0x3000('0x2f')]['destroy']({'where':{'type':_0x1813bc,'resourceId':_0x442a00['id']}})['then'](function(){return _0x5099ab;});})[_0x3000('0x2d')](function(){_0x17b6b5[_0x3000('0x22')](0xcc)[_0x3000('0x23')]();});}};}function handleEntityNotFound(_0x23b5c6,_0x3af1be){return function(_0x405cb4){if(!_0x405cb4){_0x23b5c6['sendStatus'](0x194);}return _0x405cb4;};}function handleError(_0x5c6454,_0x269d7a){_0x269d7a=_0x269d7a||0x1f4;return function(_0x8d9708){logger[_0x3000('0x30')](_0x8d9708['stack']);if(_0x8d9708[_0x3000('0x31')]){delete _0x8d9708['name'];}_0x5c6454[_0x3000('0x22')](_0x269d7a)['send'](_0x8d9708);};}exports[_0x3000('0x32')]=function(_0x2c464e,_0x26994d){var _0x9488c4={},_0xa4e1b3={},_0x2d2263={'count':0x0,'rows':[]};var _0x376996=_[_0x3000('0x33')](db[_0x3000('0x34')][_0x3000('0x35')],function(_0x4793cc){return{'name':_0x4793cc['fieldName'],'type':_0x4793cc[_0x3000('0x36')][_0x3000('0x37')]};});_0xa4e1b3[_0x3000('0x38')]=_['map'](_0x376996,_0x3000('0x31'));_0xa4e1b3[_0x3000('0x39')]=_['keys'](_0x2c464e['query']);_0xa4e1b3['filters']=_[_0x3000('0x3a')](_0xa4e1b3[_0x3000('0x38')],_0xa4e1b3[_0x3000('0x39')]);_0x9488c4['attributes']=_[_0x3000('0x3a')](_0xa4e1b3[_0x3000('0x38')],qs['fields'](_0x2c464e[_0x3000('0x39')][_0x3000('0x3b')]));_0x9488c4[_0x3000('0x3c')]=_0x9488c4['attributes'][_0x3000('0x3d')]?_0x9488c4[_0x3000('0x3c')]:_0xa4e1b3[_0x3000('0x38')];if(!_0x2c464e[_0x3000('0x39')][_0x3000('0x3e')](_0x3000('0x3f'))){_0x9488c4[_0x3000('0x27')]=qs[_0x3000('0x27')](_0x2c464e[_0x3000('0x39')][_0x3000('0x27')]);_0x9488c4[_0x3000('0x25')]=qs[_0x3000('0x25')](_0x2c464e[_0x3000('0x39')][_0x3000('0x25')]);}_0x9488c4[_0x3000('0x40')]=qs[_0x3000('0x41')](_0x2c464e[_0x3000('0x39')]['sort']);_0x9488c4[_0x3000('0x42')]=qs[_0x3000('0x43')](_[_0x3000('0x44')](_0x2c464e[_0x3000('0x39')],_0xa4e1b3['filters']),_0x376996);if(_0x2c464e[_0x3000('0x39')]['filter']){_0x9488c4[_0x3000('0x42')]=_[_0x3000('0x45')](_0x9488c4[_0x3000('0x42')],{'$or':_[_0x3000('0x33')](_0x376996,function(_0x106e2f){if(_0x106e2f['type']!==_0x3000('0x46')){var _0x3471ef={};_0x3471ef[_0x106e2f[_0x3000('0x31')]]={'$like':'%'+_0x2c464e[_0x3000('0x39')][_0x3000('0x47')]+'%'};return _0x3471ef;}})});}_0x9488c4=_[_0x3000('0x45')]({},_0x9488c4,_0x2c464e[_0x3000('0x48')]);var _0x727826={'where':_0x9488c4[_0x3000('0x42')]};return db['Plugin'][_0x3000('0x28')](_0x727826)[_0x3000('0x2d')](function(_0x5dff7c){_0x2d2263[_0x3000('0x28')]=_0x5dff7c;if(_0x2c464e[_0x3000('0x39')]['includeAll']){_0x9488c4[_0x3000('0x49')]=[{'all':!![]}];}return db[_0x3000('0x34')][_0x3000('0x4a')](_0x9488c4);})['then'](function(_0x1bc9b0){_0x2d2263[_0x3000('0x4b')]=_0x1bc9b0;return _0x2d2263;})[_0x3000('0x2d')](respondWithFilteredResult(_0x26994d,_0x9488c4))[_0x3000('0x4c')](handleError(_0x26994d,null));};exports[_0x3000('0x4d')]=function(_0x71a8f,_0x519cc8){var _0x3939eb={'raw':!![],'where':{'id':_0x71a8f['params']['id']}},_0x2305dc={};_0x2305dc[_0x3000('0x38')]=_[_0x3000('0x4e')](db[_0x3000('0x34')][_0x3000('0x35')]);_0x2305dc['query']=_[_0x3000('0x4e')](_0x71a8f[_0x3000('0x39')]);_0x2305dc[_0x3000('0x43')]=_[_0x3000('0x3a')](_0x2305dc[_0x3000('0x38')],_0x2305dc[_0x3000('0x39')]);_0x3939eb[_0x3000('0x3c')]=_[_0x3000('0x3a')](_0x2305dc[_0x3000('0x38')],qs['fields'](_0x71a8f[_0x3000('0x39')]['fields']));_0x3939eb[_0x3000('0x3c')]=_0x3939eb[_0x3000('0x3c')]['length']?_0x3939eb[_0x3000('0x3c')]:_0x2305dc['model'];if(_0x71a8f[_0x3000('0x39')][_0x3000('0x4f')]){_0x3939eb[_0x3000('0x49')]=[{'all':!![]}];}_0x3939eb=_['merge']({},_0x3939eb,_0x71a8f[_0x3000('0x48')]);return db['Plugin']['find'](_0x3939eb)[_0x3000('0x2d')](handleEntityNotFound(_0x519cc8,null))[_0x3000('0x2d')](respondWithResult(_0x519cc8,null))[_0x3000('0x4c')](handleError(_0x519cc8,null));};exports[_0x3000('0x50')]=function(_0x14faac,_0x47cc56,_0x488f00){return db[_0x3000('0x34')]['find']({'where':{'id':_0x14faac[_0x3000('0x51')]['id']},'attributes':[_0x3000('0x31'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x47cc56,null))[_0x3000('0x2d')](function(_0x434f39){if(_0x434f39){var _0x58464e=path[_0x3000('0x52')](config[_0x3000('0x53')],'server/files/plugins',util[_0x3000('0x54')](_0x3000('0x55'),path[_0x3000('0x56')](_0x434f39[_0x3000('0x7')])));var _0x6b3843=fs[_0x3000('0x57')](_0x58464e);var _0x3c4f11=archiver(_0x3000('0x58'),{'zlib':{'level':0x9}});_0x3c4f11['on'](_0x3000('0x59'),function(_0x3eec6a){if(_0x3eec6a[_0x3000('0x5a')]===_0x3000('0x5b')){logger['error'](_0x3eec6a);}else{throw new db[(_0x3000('0x5c'))][(_0x3000('0x5d'))](_0x3000('0x5e'));}});_0x3c4f11['on'](_0x3000('0x30'),function(_0x210961){throw new db[(_0x3000('0x5c'))][(_0x3000('0x5d'))](_0x3000('0x5e'));});_0x3c4f11[_0x3000('0x5f')](_0x6b3843);_0x3c4f11[_0x3000('0x60')](_0x3000('0x61'),{'cwd':path[_0x3000('0x52')](config[_0x3000('0x53')],_0x3000('0x62'),path[_0x3000('0x63')](_0x434f39['path'])),'ignore':[path[_0x3000('0x52')](path[_0x3000('0x56')](_0x434f39[_0x3000('0x7')]),_0x3000('0x64')),path[_0x3000('0x52')](path[_0x3000('0x56')](_0x434f39[_0x3000('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x3000('0x65')]();_0x6b3843['on']('close',function(){if(!fs[_0x3000('0x66')](_0x58464e)){throw new db[(_0x3000('0x5c'))][(_0x3000('0x5d'))](_0x3000('0x67'));}return _0x47cc56[_0x3000('0x50')](_0x58464e,util[_0x3000('0x54')]('%s.zip',path['basename'](_0x434f39[_0x3000('0x7')])),function(_0x2c1ee9){if(_0x2c1ee9){throw new db[(_0x3000('0x5c'))][(_0x3000('0x5d'))](_0x3000('0x68'));}fs[_0x3000('0x69')](_0x58464e);logger[_0x3000('0x6a')](_0x3000('0x6b'));logger['info'](_0x3000('0x6c'));});});}return null;})[_0x3000('0x4c')](handleError(_0x47cc56,null));};exports[_0x3000('0x6d')]=function(_0x951003,_0x2cb069,_0x176a6b){var _0x34dc39=path[_0x3000('0x56')](_0x951003[_0x3000('0x6e')]['filename'],path['extname'](_0x951003[_0x3000('0x6e')]['filename']));var _0x1ab71e=path[_0x3000('0x52')](config[_0x3000('0x53')],_0x3000('0x62'),_0x951003['file']['filename']);var _0x191d62=path[_0x3000('0x52')](config[_0x3000('0x53')],'server/files/plugins',_0x34dc39);logger[_0x3000('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x1ab71e);logger[_0x3000('0x6a')](_0x3000('0x6f'),_0x191d62);try{fs[_0x3000('0x70')](_0x1ab71e,parseInt(_0x3000('0x71'),0x8));extract(_0x1ab71e,{'dir':_0x191d62},function(_0x552a5d){if(_0x552a5d){logger['error'](_0x552a5d);handleError(_0x552a5d,!![]);};var _0x426dfe=fs['readdirSync'](_0x191d62);if(_0x426dfe[_0x3000('0x3d')]>0x1){removeReferences(_0x1ab71e,_0x191d62);logger[_0x3000('0x30')](_0x3000('0x72'));return _0x176a6b(new Error(_0x3000('0x72')));}var _0x30f40f=fs[_0x3000('0x73')](path['join'](_0x191d62,_0x426dfe[0x0]));if(_0x30f40f[_0x3000('0x74')]()){removeReferences(_0x1ab71e,_0x191d62);logger[_0x3000('0x30')](_0x3000('0x72'));return _0x176a6b(new Error(_0x3000('0x72')));}if(_0x30f40f[_0x3000('0x75')]()){var _0x2f6c07=fs[_0x3000('0x76')](path[_0x3000('0x52')](_0x191d62,_0x426dfe[0x0]));if(_0x2f6c07[_0x3000('0x3d')]===0x0){removeReferences(_0x1ab71e,_0x191d62);logger[_0x3000('0x30')]('Invalid\x20plugin\x20structure');return _0x176a6b(new Error(_0x3000('0x72')));}var _0x324684=_0x2f6c07[_0x3000('0x77')](function(_0x4146bb){return _0x4146bb===_0x3000('0x78');});if(!_0x324684){return _0x176a6b(new Error('Plugin\x20manifest\x20missing'));}var _0x123166=fs[_0x3000('0x79')](path[_0x3000('0x52')](_0x191d62,_0x426dfe[0x0],_0x3000('0x78')));var _0xe2190f=JSON['parse'](_0x123166);if(_0x3000('0x26')==typeof _0xe2190f[_0x3000('0x31')]){return _0x176a6b(new Error(_0x3000('0x7a')));}if(_0x3000('0x26')==typeof _0xe2190f['type']){return _0x176a6b(new Error(_0x3000('0x7b')));}if(_0x3000('0x26')==typeof _0xe2190f[_0x3000('0x7c')]){return _0x176a6b(new Error(_0x3000('0x7d')));}if(_0x3000('0x26')==typeof _0xe2190f['parameters']){return _0x176a6b(new Error(_0x3000('0x7e')));}if(_0xe2190f[_0x3000('0x36')]===_0x3000('0x7f')){if(_0x3000('0x26')==typeof _0xe2190f[_0x3000('0x80')]['views']){return _0x176a6b(new Error(_0x3000('0x81')));}if(_0x3000('0x26')==typeof _0xe2190f['parameters'][_0x3000('0x82')]['admin']&&'undefined'==typeof _0xe2190f['parameters'][_0x3000('0x82')]['agent']){return _0x176a6b(new Error(_0x3000('0x83')));}}else if(_0xe2190f[_0x3000('0x36')]==='script'){if(_0x3000('0x26')==typeof _0xe2190f[_0x3000('0x80')][_0x3000('0x84')]){return _0x176a6b(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0xe2190f[_0x3000('0x80')][_0x3000('0x85')]){return _0x176a6b(new Error(_0x3000('0x86')));}}else{return _0x176a6b(new Error(_0x3000('0x87')));}var _0x50e74a=_0xe2190f[_0x3000('0x31')];var _0x1bd1c9=_0xe2190f['description'];var _0x3fa3c4=_0xe2190f[_0x3000('0x36')];var _0x3a3808=_0xe2190f['sidebar']?_0xe2190f['sidebar']:_0x3000('0x88');var _0x228953=_0xe2190f['icon']?_0xe2190f[_0x3000('0x89')]:_0x3000('0x8a');var _0x5f2fb1='';var _0x90cb36='';var _0x183c65='';var _0x3dad0a='';var _0x4f9611=_0xe2190f[_0x3000('0x7c')];if(_0x3fa3c4==='html'){if(_0x3000('0x26')!=typeof _0xe2190f[_0x3000('0x80')][_0x3000('0x82')][_0x3000('0x8b')]){var _0x2d6e68=_0xe2190f[_0x3000('0x80')]['views'][_0x3000('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x3000('0x8c')](_0x2d6e68)){_0x5f2fb1=path['join']('plugins',_0x34dc39,_0x426dfe[0x0],_0x2d6e68);}else{_0x5f2fb1=_0x2d6e68;}}else{logger['info'](_0x3000('0x8d'));}if(_0x3000('0x26')!=typeof _0xe2190f[_0x3000('0x80')][_0x3000('0x82')][_0x3000('0x8e')]){var _0x3fbba5=_0xe2190f['parameters'][_0x3000('0x82')][_0x3000('0x8e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3fbba5)){_0x90cb36=path[_0x3000('0x52')](_0x3000('0x8f'),_0x34dc39,_0x426dfe[0x0],_0x3fbba5);}else{_0x90cb36=_0x3fbba5;}}else{logger[_0x3000('0x6a')](_0x3000('0x90'));}}else if(_0x3fa3c4===_0x3000('0x91')){_0x183c65=_0xe2190f[_0x3000('0x80')][_0x3000('0x84')];_0x3dad0a=_0xe2190f[_0x3000('0x80')][_0x3000('0x85')];if(_0x3000('0x26')!=typeof _0xe2190f['parameters'][_0x3000('0x82')]){if(_0x3000('0x26')!=typeof _0xe2190f['parameters'][_0x3000('0x82')]['admin']){var _0x2d6e68=_0xe2190f['parameters'][_0x3000('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x3000('0x8c')](_0x2d6e68)){_0x5f2fb1=path[_0x3000('0x52')](_0x3000('0x8f'),_0x34dc39,_0x426dfe[0x0],_0x2d6e68);}else{_0x5f2fb1=_0x2d6e68;}}if(_0x3000('0x26')!=typeof _0xe2190f[_0x3000('0x80')][_0x3000('0x82')]['agent']){var _0x3fbba5=_0xe2190f[_0x3000('0x80')][_0x3000('0x82')][_0x3000('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x3000('0x8c')](_0x3fbba5)){_0x90cb36=path[_0x3000('0x52')](_0x3000('0x8f'),_0x34dc39,_0x426dfe[0x0],_0x3fbba5);}else{_0x90cb36=_0x3fbba5;}}}}var _0x3bb9f4={'name':_0x50e74a,'description':_0x1bd1c9,'path':path[_0x3000('0x52')](_0x34dc39,_0x426dfe[0x0]),'type':_0x3fa3c4,'sidebar':_0x3a3808,'icon':_0x228953,'adminUrl':_0x5f2fb1,'agentUrl':_0x90cb36,'scriptName':_0x183c65,'scriptPath':_0x3dad0a,'version':_0x4f9611};removeReferences(_0x1ab71e,null);return db[_0x3000('0x34')]['create'](_0x3bb9f4)[_0x3000('0x2d')](function(_0x10e432){var _0x22a057={'role':_0x951003[_0x3000('0x92')][_0x3000('0x93')],'userProfileId':_0x951003[_0x3000('0x92')][_0x3000('0x94')]};if(!_0x22a057)throw new Error(_0x3000('0x95'));if(_0x22a057['role']===_0x3000('0x96')){var _0x15b1cb=_0x10e432['get']({'plain':!![]});return db['UserProfileSection'][_0x3000('0x97')]({'where':{'name':_0x3000('0x98'),'userProfileId':_0x22a057[_0x3000('0x94')]},'raw':!![]})[_0x3000('0x2d')](function(_0x409930){if(_0x409930&&_0x409930[_0x3000('0x99')]===0x0){return db[_0x3000('0x2f')]['create']({'name':_0x15b1cb[_0x3000('0x31')],'resourceId':_0x15b1cb['id'],'type':_0x409930[_0x3000('0x31')],'sectionId':_0x409930['id']},{})[_0x3000('0x2d')](function(){return _0x10e432;});}else{return _0x10e432;}})[_0x3000('0x4c')](function(_0x1a2dae){logger[_0x3000('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a2dae);throw _0x1a2dae;});}return _0x10e432;})[_0x3000('0x2d')](respondWithResult(_0x2cb069,null))['catch'](handleError(_0x2cb069,null));}});}catch(_0x14ec02){_0x2cb069[_0x3000('0x22')](0x1f4)['send'](_0x14ec02);}};function removeReferences(_0x456ea7,_0x2fd17c){try{if(_0x456ea7){fs['unlinkSync'](_0x456ea7);logger[_0x3000('0x6a')](_0x3000('0x9a'));}if(_0x2fd17c){rimraf(_0x2fd17c,function(){});logger[_0x3000('0x6a')](_0x3000('0x9b'));}}catch(_0x4b8dce){logger[_0x3000('0x30')](_0x4b8dce);}}exports[_0x3000('0x9c')]=function(_0x277df0,_0x27aefd,_0x245ec9){return db[_0x3000('0x34')]['find']({'where':{'id':_0x277df0['params']['id']}})['then'](handleEntityNotFound(_0x27aefd,null))[_0x3000('0x2d')](saveUpdates(_0x277df0[_0x3000('0x92')],null))[_0x3000('0x2d')](respondWithResult(_0x27aefd,null))['catch'](handleError(_0x27aefd,null));};exports[_0x3000('0x9d')]=function(_0xb35ed9,_0x3d659e,_0x212790){return db[_0x3000('0x34')]['find']({'where':{'id':_0xb35ed9[_0x3000('0x51')]['id']}})[_0x3000('0x2d')](function(_0x30151e){if(_0x30151e){return _0x30151e[_0x3000('0x2e')]();}})[_0x3000('0x2d')](function(_0x1b5798){rimraf(path[_0x3000('0x52')](config[_0x3000('0x53')],_0x3000('0x62'),path[_0x3000('0x63')](_0x1b5798[_0x3000('0x7')])),function(){});return _0x1b5798;})[_0x3000('0x2d')](handleEntityNotFound(_0x3d659e,null))[_0x3000('0x2d')](respondWithStatusCode(_0x3d659e,null))['catch'](handleError(_0x3d659e,null));};exports[_0x3000('0x9e')]=function(_0x5819be,_0x4e5977,_0xe68b94){return BPromise[_0x3000('0x9f')]()['then'](function(){if(!_0x5819be[_0x3000('0x39')][_0x3000('0x7')]){throw new Error(_0x3000('0xa0'));}if(!_0x5819be['query'][_0x3000('0xa1')]){throw new Error(_0x3000('0xa2'));}var _0x2d1ea6=_0x5819be[_0x3000('0x39')][_0x3000('0xa3')]?_0x5819be[_0x3000('0x39')][_0x3000('0xa3')]+':'+_0x5819be['query'][_0x3000('0xa1')]:'http://localhost:'+_0x5819be['query']['port'];var _0x166237=_0x5819be[_0x3000('0x39')][_0x3000('0x24')]?_0x5819be[_0x3000('0x39')][_0x3000('0x24')]:!![];var _0x16ee2b=_0x5819be['query'][_0x3000('0xa4')]?_0x5819be[_0x3000('0x39')][_0x3000('0xa4')]:null;var _0x50d849={'method':_0x5819be[_0x3000('0xa5')],'uri':util[_0x3000('0x54')](_0x3000('0xa6'),_0x2d1ea6,_0x5819be[_0x3000('0x39')]['path']),'json':_0x166237,'resolveWithFullResponse':!![],'encoding':_0x16ee2b,'qs':_0x5819be[_0x3000('0x39')]};if(_0x5819be['headers']){_0x50d849[_0x3000('0xa7')]=_0x5819be[_0x3000('0xa7')];if(_0x50d849[_0x3000('0xa7')][_0x3000('0xa8')]){delete _0x50d849[_0x3000('0xa7')][_0x3000('0xa8')];}}if(_0x50d849[_0x3000('0xa7')]['content-type']){delete _0x50d849[_0x3000('0xa7')][_0x3000('0xa9')];}return rp(_0x50d849);})[_0x3000('0x2d')](function(_0x483ae){if(_0x483ae){_0x4e5977[_0x3000('0x29')](_0x483ae[_0x3000('0xa7')]);logger[_0x3000('0x6a')](_0x483ae['body']);if(_[_0x3000('0xaa')](_0x5819be[_0x3000('0x39')][_0x3000('0x7')],'download')&&_0x483ae['statusCode']==0x1f4){return _0x4e5977[_0x3000('0x21')](_0x483ae[_0x3000('0xab')]);}else{return _0x4e5977[_0x3000('0x22')](_0x483ae['statusCode'])[_0x3000('0xac')](_0x483ae[_0x3000('0x92')]);}}else{return _0x4e5977[_0x3000('0x21')](0xc8);}})[_0x3000('0x4c')](handleError(_0x4e5977,null));};exports[_0x3000('0xad')]=function(_0x550af2,_0xda3e0d,_0x139011){return BPromise[_0x3000('0x9f')]()[_0x3000('0x2d')](function(){if(!_0x550af2[_0x3000('0x39')][_0x3000('0x7')]){throw new Error(_0x3000('0xa0'));}if(!_0x550af2[_0x3000('0x39')][_0x3000('0xa1')]){throw new Error(_0x3000('0xa2'));}var _0x19cdc9=_0x550af2[_0x3000('0x39')][_0x3000('0xa3')]?_0x550af2['query']['hostname']+':'+_0x550af2[_0x3000('0x39')]['port']:'http://localhost:'+_0x550af2['query']['port'];var _0x320add=_0x550af2[_0x3000('0x39')][_0x3000('0x24')]?_0x550af2['query'][_0x3000('0x24')]:!![];var _0x5253c4=_0x550af2[_0x3000('0x39')]['encoding']?_0x550af2['query'][_0x3000('0xa4')]:null;var _0x4e4b99={'method':_0x550af2[_0x3000('0xa5')],'uri':util['format'](_0x3000('0xa6'),_0x19cdc9,_0x550af2['query']['path']),'json':_0x320add,'resolveWithFullResponse':!![],'encoding':_0x5253c4,'body':_0x550af2[_0x3000('0x92')]};if(_0x550af2['headers']){_0x4e4b99['headers']=_0x550af2['headers'];if(_0x4e4b99[_0x3000('0xa7')][_0x3000('0xa8')]){delete _0x4e4b99[_0x3000('0xa7')][_0x3000('0xa8')];}}if(_0x4e4b99[_0x3000('0xa7')][_0x3000('0xa9')]){delete _0x4e4b99[_0x3000('0xa7')][_0x3000('0xa9')];}return rp(_0x4e4b99);})['then'](function(_0x478142){if(_0x478142){_0xda3e0d[_0x3000('0x29')](_0x478142[_0x3000('0xa7')]);logger[_0x3000('0x6a')](_0x478142[_0x3000('0x92')]);return _0xda3e0d[_0x3000('0x22')](_0x478142[_0x3000('0xab')])[_0x3000('0xac')](_0x478142[_0x3000('0x92')]);}else{return _0xda3e0d[_0x3000('0x21')](0xc8);}})['catch'](handleError(_0xda3e0d,null));}; \ No newline at end of file +var _0x00f4=['sox','to-csv','squel','crypto','desk.js','querystring','papaparse','rimraf','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','catch','show','params','includeAll','options','find','download','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','method','eml-format','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x00f4,0xa2));var _0x400f=function(_0x462a9e,_0x4a934b){_0x462a9e=_0x462a9e-0x0;var _0x342a9e=_0x00f4[_0x462a9e];return _0x342a9e;};'use strict';var emlformat=require(_0x400f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x400f('0x1'));var rp=require('request-promise');var moment=require(_0x400f('0x2'));var BPromise=require(_0x400f('0x3'));var Mustache=require(_0x400f('0x4'));var util=require('util');var path=require(_0x400f('0x5'));var sox=require(_0x400f('0x6'));var csv=require(_0x400f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x400f('0x8'));var crypto=require(_0x400f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x400f('0xa'));var toCsv=require(_0x400f('0x7'));var querystring=require(_0x400f('0xb'));var Papa=require(_0x400f('0xc'));var extract=require('extract-zip');var rimraf=require(_0x400f('0xd'));var archiver=require(_0x400f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x400f('0xf'));var as=require(_0x400f('0x10'));var hardwareService=require(_0x400f('0x11'));var logger=require(_0x400f('0x12'))('api');var utils=require(_0x400f('0x13'));var config=require(_0x400f('0x14'));var licenseUtil=require(_0x400f('0x15'));var db=require(_0x400f('0x16'))['db'];config[_0x400f('0x17')]=_['defaults'](config['redis'],{'host':_0x400f('0x18'),'port':0x18eb});var socket=require(_0x400f('0x19'))(new Redis(config['redis']));require(_0x400f('0x1a'))[_0x400f('0x1b')](socket);function respondWithStatusCode(_0x35b530,_0xd73d82){_0xd73d82=_0xd73d82||0xcc;return function(_0xd8c187){if(_0xd8c187){return _0x35b530['sendStatus'](_0xd73d82);}return _0x35b530[_0x400f('0x1c')](_0xd73d82)['end']();};}function respondWithResult(_0x17ebae,_0xe48701){_0xe48701=_0xe48701||0xc8;return function(_0x48119c){if(_0x48119c){return _0x17ebae[_0x400f('0x1c')](_0xe48701)[_0x400f('0x1d')](_0x48119c);}};}function respondWithFilteredResult(_0x27442d,_0x39ee29){return function(_0x168ce5){if(_0x168ce5){var _0xb34f22=typeof _0x39ee29[_0x400f('0x1e')]===_0x400f('0x1f')&&typeof _0x39ee29[_0x400f('0x20')]===_0x400f('0x1f');var _0x4aaa75=_0x168ce5[_0x400f('0x21')];var _0x6f0913=_0xb34f22?0x0:_0x39ee29['offset'];var _0x20e33c=_0xb34f22?_0x168ce5['count']:_0x39ee29[_0x400f('0x1e')]+_0x39ee29[_0x400f('0x20')];var _0x25943f;if(_0x20e33c>=_0x4aaa75){_0x20e33c=_0x4aaa75;_0x25943f=0xc8;}else{_0x25943f=0xce;}_0x27442d[_0x400f('0x1c')](_0x25943f);return _0x27442d[_0x400f('0x22')](_0x400f('0x23'),_0x6f0913+'-'+_0x20e33c+'/'+_0x4aaa75)[_0x400f('0x1d')](_0x168ce5);}return null;};}function patchUpdates(_0x3ea44a){return function(_0x59ff33){try{jsonpatch[_0x400f('0x24')](_0x59ff33,_0x3ea44a,!![]);}catch(_0x227057){return BPromise[_0x400f('0x25')](_0x227057);}return _0x59ff33[_0x400f('0x26')]();};}function saveUpdates(_0x2ed861,_0x35b343){return function(_0x4c11ad){if(_0x4c11ad){return _0x4c11ad['update'](_0x2ed861)[_0x400f('0x27')](function(_0x2b4002){return _0x2b4002;});}return null;};}function removeEntity(_0x3f5daf,_0x139c0f){return function(_0x4f4cb3){if(_0x4f4cb3){return _0x4f4cb3[_0x400f('0x28')]()[_0x400f('0x27')](function(){var _0x494fda=_0x4f4cb3[_0x400f('0x29')]({'plain':!![]});var _0x1aa009=_0x400f('0x2a');return db[_0x400f('0x2b')][_0x400f('0x28')]({'where':{'type':_0x1aa009,'resourceId':_0x494fda['id']}})['then'](function(){return _0x4f4cb3;});})['then'](function(){_0x3f5daf[_0x400f('0x1c')](0xcc)[_0x400f('0x2c')]();});}};}function handleEntityNotFound(_0x392cd6,_0x10607f){return function(_0x3134bf){if(!_0x3134bf){_0x392cd6[_0x400f('0x2d')](0x194);}return _0x3134bf;};}function handleError(_0x310fab,_0x2eb20a){_0x2eb20a=_0x2eb20a||0x1f4;return function(_0x527e29){logger[_0x400f('0x2e')](_0x527e29[_0x400f('0x2f')]);if(_0x527e29[_0x400f('0x30')]){delete _0x527e29[_0x400f('0x30')];}_0x310fab[_0x400f('0x1c')](_0x2eb20a)[_0x400f('0x31')](_0x527e29);};}exports[_0x400f('0x32')]=function(_0x179279,_0x9f2ec){var _0x335c18={},_0x8d3f82={},_0x4ff321={'count':0x0,'rows':[]};var _0x372200=_[_0x400f('0x33')](db[_0x400f('0x34')][_0x400f('0x35')],function(_0x4b1434){return{'name':_0x4b1434[_0x400f('0x36')],'type':_0x4b1434['type']['key']};});_0x8d3f82['model']=_[_0x400f('0x33')](_0x372200,_0x400f('0x30'));_0x8d3f82[_0x400f('0x37')]=_[_0x400f('0x38')](_0x179279[_0x400f('0x37')]);_0x8d3f82[_0x400f('0x39')]=_[_0x400f('0x3a')](_0x8d3f82['model'],_0x8d3f82[_0x400f('0x37')]);_0x335c18[_0x400f('0x3b')]=_[_0x400f('0x3a')](_0x8d3f82[_0x400f('0x3c')],qs[_0x400f('0x3d')](_0x179279[_0x400f('0x37')][_0x400f('0x3d')]));_0x335c18[_0x400f('0x3b')]=_0x335c18['attributes'][_0x400f('0x3e')]?_0x335c18[_0x400f('0x3b')]:_0x8d3f82[_0x400f('0x3c')];if(!_0x179279['query']['hasOwnProperty'](_0x400f('0x3f'))){_0x335c18[_0x400f('0x20')]=qs[_0x400f('0x20')](_0x179279[_0x400f('0x37')][_0x400f('0x20')]);_0x335c18[_0x400f('0x1e')]=qs[_0x400f('0x1e')](_0x179279['query'][_0x400f('0x1e')]);}_0x335c18[_0x400f('0x40')]=qs[_0x400f('0x41')](_0x179279[_0x400f('0x37')]['sort']);_0x335c18[_0x400f('0x42')]=qs[_0x400f('0x39')](_[_0x400f('0x43')](_0x179279[_0x400f('0x37')],_0x8d3f82[_0x400f('0x39')]),_0x372200);if(_0x179279[_0x400f('0x37')][_0x400f('0x44')]){_0x335c18[_0x400f('0x42')]=_[_0x400f('0x45')](_0x335c18[_0x400f('0x42')],{'$or':_['map'](_0x372200,function(_0x38f123){if(_0x38f123[_0x400f('0x46')]!=='VIRTUAL'){var _0x2b2210={};_0x2b2210[_0x38f123[_0x400f('0x30')]]={'$like':'%'+_0x179279[_0x400f('0x37')][_0x400f('0x44')]+'%'};return _0x2b2210;}})});}_0x335c18=_[_0x400f('0x45')]({},_0x335c18,_0x179279['options']);var _0x383e60={'where':_0x335c18[_0x400f('0x42')]};return db[_0x400f('0x34')][_0x400f('0x21')](_0x383e60)[_0x400f('0x27')](function(_0x49c066){_0x4ff321[_0x400f('0x21')]=_0x49c066;if(_0x179279['query']['includeAll']){_0x335c18[_0x400f('0x47')]=[{'all':!![]}];}return db[_0x400f('0x34')][_0x400f('0x48')](_0x335c18);})['then'](function(_0x18774e){_0x4ff321['rows']=_0x18774e;return _0x4ff321;})[_0x400f('0x27')](respondWithFilteredResult(_0x9f2ec,_0x335c18))[_0x400f('0x49')](handleError(_0x9f2ec,null));};exports[_0x400f('0x4a')]=function(_0x7376bb,_0x4184e4){var _0x4df30c={'raw':!![],'where':{'id':_0x7376bb[_0x400f('0x4b')]['id']}},_0xba45f7={};_0xba45f7[_0x400f('0x3c')]=_[_0x400f('0x38')](db['Plugin'][_0x400f('0x35')]);_0xba45f7[_0x400f('0x37')]=_[_0x400f('0x38')](_0x7376bb[_0x400f('0x37')]);_0xba45f7[_0x400f('0x39')]=_[_0x400f('0x3a')](_0xba45f7[_0x400f('0x3c')],_0xba45f7[_0x400f('0x37')]);_0x4df30c[_0x400f('0x3b')]=_[_0x400f('0x3a')](_0xba45f7[_0x400f('0x3c')],qs['fields'](_0x7376bb[_0x400f('0x37')][_0x400f('0x3d')]));_0x4df30c['attributes']=_0x4df30c[_0x400f('0x3b')][_0x400f('0x3e')]?_0x4df30c['attributes']:_0xba45f7['model'];if(_0x7376bb[_0x400f('0x37')][_0x400f('0x4c')]){_0x4df30c[_0x400f('0x47')]=[{'all':!![]}];}_0x4df30c=_[_0x400f('0x45')]({},_0x4df30c,_0x7376bb[_0x400f('0x4d')]);return db[_0x400f('0x34')][_0x400f('0x4e')](_0x4df30c)[_0x400f('0x27')](handleEntityNotFound(_0x4184e4,null))[_0x400f('0x27')](respondWithResult(_0x4184e4,null))[_0x400f('0x49')](handleError(_0x4184e4,null));};exports[_0x400f('0x4f')]=function(_0x2d5734,_0xfe346a,_0x48a923){return db[_0x400f('0x34')][_0x400f('0x4e')]({'where':{'id':_0x2d5734['params']['id']},'attributes':[_0x400f('0x30'),_0x400f('0x5')],'raw':!![]})[_0x400f('0x27')](handleEntityNotFound(_0xfe346a,null))[_0x400f('0x27')](function(_0x671963){if(_0x671963){var _0x1104df=path[_0x400f('0x50')](config[_0x400f('0x51')],_0x400f('0x52'),util[_0x400f('0x53')](_0x400f('0x54'),path[_0x400f('0x55')](_0x671963[_0x400f('0x5')])));var _0x2c3191=fs['createWriteStream'](_0x1104df);var _0x405498=archiver(_0x400f('0x56'),{'zlib':{'level':0x9}});_0x405498['on'](_0x400f('0x57'),function(_0xf14307){if(_0xf14307['code']==='ENOENT'){logger[_0x400f('0x2e')](_0xf14307);}else{throw new db[(_0x400f('0x58'))][(_0x400f('0x59'))](_0x400f('0x5a'));}});_0x405498['on']('error',function(_0x1d90bb){throw new db['Sequelize'][(_0x400f('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x405498[_0x400f('0x5b')](_0x2c3191);_0x405498[_0x400f('0x5c')](_0x400f('0x5d'),{'cwd':path[_0x400f('0x50')](config[_0x400f('0x51')],_0x400f('0x52'),path[_0x400f('0x5e')](_0x671963[_0x400f('0x5')])),'ignore':[path[_0x400f('0x50')](path[_0x400f('0x55')](_0x671963[_0x400f('0x5')]),_0x400f('0x5f')),path[_0x400f('0x50')](path[_0x400f('0x55')](_0x671963['path']),_0x400f('0x60'))],'nodir':!![]})[_0x400f('0x61')]();_0x2c3191['on'](_0x400f('0x62'),function(){if(!fs[_0x400f('0x63')](_0x1104df)){throw new db[(_0x400f('0x58'))][(_0x400f('0x59'))](_0x400f('0x64'));}return _0xfe346a['download'](_0x1104df,util['format'](_0x400f('0x54'),path['basename'](_0x671963[_0x400f('0x5')])),function(_0xf76176){if(_0xf76176){throw new db[(_0x400f('0x58'))][(_0x400f('0x59'))](_0x400f('0x65'));}fs['unlinkSync'](_0x1104df);logger[_0x400f('0x66')](_0x400f('0x67'));logger[_0x400f('0x66')](_0x400f('0x68'));});});}return null;})[_0x400f('0x49')](handleError(_0xfe346a,null));};exports['upload']=function(_0x5e84b1,_0x12338a,_0xc08974){var _0x29a9b9=path[_0x400f('0x55')](_0x5e84b1['file'][_0x400f('0x69')],path[_0x400f('0x6a')](_0x5e84b1[_0x400f('0x6b')][_0x400f('0x69')]));var _0x4f7eba=path[_0x400f('0x50')](config['root'],_0x400f('0x52'),_0x5e84b1['file'][_0x400f('0x69')]);var _0x38cd8c=path[_0x400f('0x50')](config['root'],_0x400f('0x52'),_0x29a9b9);logger[_0x400f('0x66')](_0x400f('0x6c'),_0x4f7eba);logger[_0x400f('0x66')](_0x400f('0x6d'),_0x38cd8c);try{fs[_0x400f('0x6e')](_0x4f7eba,parseInt(_0x400f('0x6f'),0x8));extract(_0x4f7eba,{'dir':_0x38cd8c},function(_0x4e00a6){if(_0x4e00a6){logger['error'](_0x4e00a6);handleError(_0x4e00a6,!![]);};var _0x57bf7f=fs[_0x400f('0x70')](_0x38cd8c);if(_0x57bf7f[_0x400f('0x3e')]>0x1){removeReferences(_0x4f7eba,_0x38cd8c);logger[_0x400f('0x2e')](_0x400f('0x71'));return _0xc08974(new Error(_0x400f('0x71')));}var _0x4892e2=fs[_0x400f('0x72')](path[_0x400f('0x50')](_0x38cd8c,_0x57bf7f[0x0]));if(_0x4892e2[_0x400f('0x73')]()){removeReferences(_0x4f7eba,_0x38cd8c);logger['error'](_0x400f('0x71'));return _0xc08974(new Error(_0x400f('0x71')));}if(_0x4892e2['isDirectory']()){var _0x305610=fs[_0x400f('0x70')](path['join'](_0x38cd8c,_0x57bf7f[0x0]));if(_0x305610[_0x400f('0x3e')]===0x0){removeReferences(_0x4f7eba,_0x38cd8c);logger[_0x400f('0x2e')](_0x400f('0x71'));return _0xc08974(new Error(_0x400f('0x71')));}var _0x3bb945=_0x305610[_0x400f('0x74')](function(_0x447789){return _0x447789===_0x400f('0x75');});if(!_0x3bb945){return _0xc08974(new Error('Plugin\x20manifest\x20missing'));}var _0x3b0f05=fs['readFileSync'](path[_0x400f('0x50')](_0x38cd8c,_0x57bf7f[0x0],_0x400f('0x75')));var _0x46ac1b=JSON[_0x400f('0x76')](_0x3b0f05);if(_0x400f('0x1f')==typeof _0x46ac1b[_0x400f('0x30')]){return _0xc08974(new Error(_0x400f('0x77')));}if(_0x400f('0x1f')==typeof _0x46ac1b['type']){return _0xc08974(new Error(_0x400f('0x78')));}if('undefined'==typeof _0x46ac1b[_0x400f('0x79')]){return _0xc08974(new Error(_0x400f('0x7a')));}if(_0x400f('0x1f')==typeof _0x46ac1b[_0x400f('0x7b')]){return _0xc08974(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x46ac1b['type']===_0x400f('0x7c')){if(_0x400f('0x1f')==typeof _0x46ac1b[_0x400f('0x7b')][_0x400f('0x7d')]){return _0xc08974(new Error(_0x400f('0x7e')));}if(_0x400f('0x1f')==typeof _0x46ac1b['parameters']['views']['admin']&&_0x400f('0x1f')==typeof _0x46ac1b['parameters'][_0x400f('0x7d')][_0x400f('0x7f')]){return _0xc08974(new Error(_0x400f('0x80')));}}else if(_0x46ac1b['type']===_0x400f('0x81')){if(_0x400f('0x1f')==typeof _0x46ac1b[_0x400f('0x7b')][_0x400f('0x82')]){return _0xc08974(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x46ac1b['parameters']['scriptPath']){return _0xc08974(new Error(_0x400f('0x83')));}}else{return _0xc08974(new Error(_0x400f('0x84')));}var _0x39e7b1=_0x46ac1b['name'];var _0x3ae2c6=_0x46ac1b[_0x400f('0x85')];var _0x790630=_0x46ac1b[_0x400f('0x46')];var _0x3965b3=_0x46ac1b[_0x400f('0x86')]?_0x46ac1b[_0x400f('0x86')]:_0x400f('0x87');var _0x24762b=_0x46ac1b[_0x400f('0x88')]?_0x46ac1b[_0x400f('0x88')]:'icon-apps';var _0x18f727='';var _0x45682d='';var _0x4b494f='';var _0x106f35='';var _0x13e05a=_0x46ac1b[_0x400f('0x79')];if(_0x790630==='html'){if('undefined'!=typeof _0x46ac1b[_0x400f('0x7b')][_0x400f('0x7d')][_0x400f('0x89')]){var _0x1ad819=_0x46ac1b['parameters']['views'][_0x400f('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x400f('0x8a')](_0x1ad819)){_0x18f727=path[_0x400f('0x50')]('plugins',_0x29a9b9,_0x57bf7f[0x0],_0x1ad819);}else{_0x18f727=_0x1ad819;}}else{logger[_0x400f('0x66')](_0x400f('0x8b'));}if(_0x400f('0x1f')!=typeof _0x46ac1b[_0x400f('0x7b')][_0x400f('0x7d')][_0x400f('0x7f')]){var _0x3d70d3=_0x46ac1b['parameters'][_0x400f('0x7d')][_0x400f('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x400f('0x8a')](_0x3d70d3)){_0x45682d=path[_0x400f('0x50')](_0x400f('0x8c'),_0x29a9b9,_0x57bf7f[0x0],_0x3d70d3);}else{_0x45682d=_0x3d70d3;}}else{logger[_0x400f('0x66')](_0x400f('0x8d'));}}else if(_0x790630==='script'){_0x4b494f=_0x46ac1b[_0x400f('0x7b')]['scriptName'];_0x106f35=_0x46ac1b[_0x400f('0x7b')][_0x400f('0x8e')];if(_0x400f('0x1f')!=typeof _0x46ac1b[_0x400f('0x7b')][_0x400f('0x7d')]){if(_0x400f('0x1f')!=typeof _0x46ac1b[_0x400f('0x7b')]['views'][_0x400f('0x89')]){var _0x1ad819=_0x46ac1b['parameters'][_0x400f('0x7d')][_0x400f('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x400f('0x8a')](_0x1ad819)){_0x18f727=path[_0x400f('0x50')](_0x400f('0x8c'),_0x29a9b9,_0x57bf7f[0x0],_0x1ad819);}else{_0x18f727=_0x1ad819;}}if(_0x400f('0x1f')!=typeof _0x46ac1b['parameters']['views']['agent']){var _0x3d70d3=_0x46ac1b[_0x400f('0x7b')][_0x400f('0x7d')][_0x400f('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x400f('0x8a')](_0x3d70d3)){_0x45682d=path[_0x400f('0x50')](_0x400f('0x8c'),_0x29a9b9,_0x57bf7f[0x0],_0x3d70d3);}else{_0x45682d=_0x3d70d3;}}}}var _0x3f958a={'name':_0x39e7b1,'description':_0x3ae2c6,'path':path[_0x400f('0x50')](_0x29a9b9,_0x57bf7f[0x0]),'type':_0x790630,'sidebar':_0x3965b3,'icon':_0x24762b,'adminUrl':_0x18f727,'agentUrl':_0x45682d,'scriptName':_0x4b494f,'scriptPath':_0x106f35,'version':_0x13e05a};removeReferences(_0x4f7eba,null);return db[_0x400f('0x34')][_0x400f('0x8f')](_0x3f958a)[_0x400f('0x27')](function(_0x388832){var _0x92e80f={'role':_0x5e84b1['body'][_0x400f('0x90')],'userProfileId':_0x5e84b1[_0x400f('0x91')][_0x400f('0x92')]};if(!_0x92e80f)throw new Error(_0x400f('0x93'));if(_0x92e80f[_0x400f('0x90')]===_0x400f('0x94')){var _0x362702=_0x388832[_0x400f('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x400f('0x4e')]({'where':{'name':_0x400f('0x2a'),'userProfileId':_0x92e80f[_0x400f('0x92')]},'raw':!![]})['then'](function(_0x279332){if(_0x279332&&_0x279332[_0x400f('0x95')]===0x0){return db[_0x400f('0x2b')][_0x400f('0x8f')]({'name':_0x362702[_0x400f('0x30')],'resourceId':_0x362702['id'],'type':_0x279332[_0x400f('0x30')],'sectionId':_0x279332['id']},{})[_0x400f('0x27')](function(){return _0x388832;});}else{return _0x388832;}})[_0x400f('0x49')](function(_0x2a4199){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a4199);throw _0x2a4199;});}return _0x388832;})['then'](respondWithResult(_0x12338a,null))['catch'](handleError(_0x12338a,null));}});}catch(_0x1a8c8d){_0x12338a[_0x400f('0x1c')](0x1f4)[_0x400f('0x31')](_0x1a8c8d);}};function removeReferences(_0x34f881,_0x4aef2a){try{if(_0x34f881){fs[_0x400f('0x96')](_0x34f881);logger['info'](_0x400f('0x97'));}if(_0x4aef2a){rimraf(_0x4aef2a,function(){});logger[_0x400f('0x66')](_0x400f('0x98'));}}catch(_0x3f952b){logger[_0x400f('0x2e')](_0x3f952b);}}exports[_0x400f('0x99')]=function(_0x5e3ed3,_0x4786be,_0x43d44b){return db[_0x400f('0x34')][_0x400f('0x4e')]({'where':{'id':_0x5e3ed3['params']['id']}})['then'](handleEntityNotFound(_0x4786be,null))[_0x400f('0x27')](saveUpdates(_0x5e3ed3[_0x400f('0x91')],null))[_0x400f('0x27')](respondWithResult(_0x4786be,null))[_0x400f('0x49')](handleError(_0x4786be,null));};exports['delete']=function(_0x602cc6,_0xf22a8f,_0x5a0ec7){return db[_0x400f('0x34')][_0x400f('0x4e')]({'where':{'id':_0x602cc6['params']['id']}})[_0x400f('0x27')](function(_0x4edcb8){if(_0x4edcb8){return _0x4edcb8[_0x400f('0x28')]();}})[_0x400f('0x27')](function(_0x1f4c59){rimraf(path[_0x400f('0x50')](config[_0x400f('0x51')],_0x400f('0x52'),path[_0x400f('0x5e')](_0x1f4c59[_0x400f('0x5')])),function(){});return _0x1f4c59;})[_0x400f('0x27')](handleEntityNotFound(_0xf22a8f,null))[_0x400f('0x27')](respondWithStatusCode(_0xf22a8f,null))[_0x400f('0x49')](handleError(_0xf22a8f,null));};exports[_0x400f('0x9a')]=function(_0x1540cf,_0x37ea18,_0xabbd3b){return BPromise[_0x400f('0x9b')]()[_0x400f('0x27')](function(){if(!_0x1540cf[_0x400f('0x37')][_0x400f('0x5')]){throw new Error(_0x400f('0x9c'));}if(!_0x1540cf[_0x400f('0x37')][_0x400f('0x9d')]){throw new Error(_0x400f('0x9e'));}var _0x2d151d=_0x1540cf[_0x400f('0x37')]['hostname']?_0x1540cf['query'][_0x400f('0x9f')]+':'+_0x1540cf['query'][_0x400f('0x9d')]:_0x400f('0xa0')+_0x1540cf[_0x400f('0x37')][_0x400f('0x9d')];var _0x13f957=_0x1540cf[_0x400f('0x37')][_0x400f('0x1d')]?_0x1540cf[_0x400f('0x37')][_0x400f('0x1d')]:!![];var _0x2ace1c=_0x1540cf[_0x400f('0x37')][_0x400f('0xa1')]?_0x1540cf['query']['encoding']:null;var _0x3fed13={'method':_0x1540cf['method'],'uri':util[_0x400f('0x53')](_0x400f('0xa2'),_0x2d151d,_0x1540cf[_0x400f('0x37')]['path']),'json':_0x13f957,'resolveWithFullResponse':!![],'encoding':_0x2ace1c,'qs':_0x1540cf[_0x400f('0x37')]};if(_0x1540cf[_0x400f('0xa3')]){_0x3fed13[_0x400f('0xa3')]=_0x1540cf[_0x400f('0xa3')];if(_0x3fed13['headers'][_0x400f('0xa4')]){delete _0x3fed13['headers'][_0x400f('0xa4')];}}if(_0x3fed13[_0x400f('0xa3')][_0x400f('0xa5')]){delete _0x3fed13[_0x400f('0xa3')][_0x400f('0xa5')];}return rp(_0x3fed13);})[_0x400f('0x27')](function(_0x490fd6){if(_0x490fd6){_0x37ea18[_0x400f('0x22')](_0x490fd6['headers']);logger['info'](_0x490fd6[_0x400f('0x91')]);if(_['endsWith'](_0x1540cf['query']['path'],'download')&&_0x490fd6[_0x400f('0xa6')]==0x1f4){return _0x37ea18[_0x400f('0x2d')](_0x490fd6[_0x400f('0xa6')]);}else{return _0x37ea18['status'](_0x490fd6[_0x400f('0xa6')])['send'](_0x490fd6['body']);}}else{return _0x37ea18[_0x400f('0x2d')](0xc8);}})[_0x400f('0x49')](handleError(_0x37ea18,null));};exports['webhookPost']=function(_0x3fe9eb,_0x831e27,_0x166718){return BPromise[_0x400f('0x9b')]()[_0x400f('0x27')](function(){if(!_0x3fe9eb[_0x400f('0x37')][_0x400f('0x5')]){throw new Error(_0x400f('0x9c'));}if(!_0x3fe9eb[_0x400f('0x37')][_0x400f('0x9d')]){throw new Error(_0x400f('0x9e'));}var _0x255983=_0x3fe9eb[_0x400f('0x37')]['hostname']?_0x3fe9eb[_0x400f('0x37')][_0x400f('0x9f')]+':'+_0x3fe9eb[_0x400f('0x37')][_0x400f('0x9d')]:_0x400f('0xa0')+_0x3fe9eb['query'][_0x400f('0x9d')];var _0xfb86a=_0x3fe9eb[_0x400f('0x37')]['json']?_0x3fe9eb['query'][_0x400f('0x1d')]:!![];var _0x16dc62=_0x3fe9eb[_0x400f('0x37')][_0x400f('0xa1')]?_0x3fe9eb[_0x400f('0x37')][_0x400f('0xa1')]:null;var _0x358e06={'method':_0x3fe9eb[_0x400f('0xa7')],'uri':util['format'](_0x400f('0xa2'),_0x255983,_0x3fe9eb['query']['path']),'json':_0xfb86a,'resolveWithFullResponse':!![],'encoding':_0x16dc62,'body':_0x3fe9eb[_0x400f('0x91')]};if(_0x3fe9eb[_0x400f('0xa3')]){_0x358e06[_0x400f('0xa3')]=_0x3fe9eb[_0x400f('0xa3')];if(_0x358e06[_0x400f('0xa3')][_0x400f('0xa4')]){delete _0x358e06['headers'][_0x400f('0xa4')];}}if(_0x358e06[_0x400f('0xa3')]['content-type']){delete _0x358e06[_0x400f('0xa3')]['content-type'];}return rp(_0x358e06);})[_0x400f('0x27')](function(_0x34e455){if(_0x34e455){_0x831e27[_0x400f('0x22')](_0x34e455[_0x400f('0xa3')]);logger[_0x400f('0x66')](_0x34e455['body']);return _0x831e27[_0x400f('0x1c')](_0x34e455['statusCode'])['send'](_0x34e455[_0x400f('0x91')]);}else{return _0x831e27['sendStatus'](0xc8);}})[_0x400f('0x49')](handleError(_0x831e27,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b7dae8e..11892c7 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 _0x29af=['update','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save'];(function(_0x56bf58,_0x5a0758){var _0x5f12c4=function(_0x252a57){while(--_0x252a57){_0x56bf58['push'](_0x56bf58['shift']());}};_0x5f12c4(++_0x5a0758);}(_0x29af,0x134));var _0xf29a=function(_0x598cfc,_0x3ca6c3){_0x598cfc=_0x598cfc-0x0;var _0xc80419=_0x29af[_0x598cfc];return _0xc80419;};'use strict';var EventEmitter=require(_0xf29a('0x0'));var Plugin=require(_0xf29a('0x1'))['db'][_0xf29a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf29a('0x3'),'afterUpdate':_0xf29a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x40ab34){return function(_0x505d15,_0x37e156,_0xf7f92e){PluginEvents['emit'](_0x40ab34+':'+_0x505d15['id'],_0x505d15);PluginEvents['emit'](_0x40ab34,_0x505d15);_0xf7f92e(null);};}for(var e in events){if(events[_0xf29a('0x5')](e)){var event=events[e];Plugin[_0xf29a('0x6')](e,emitEvent(event));}}module[_0xf29a('0x7')]=PluginEvents; \ No newline at end of file +var _0x374c=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x38e717,_0x457019){var _0xdf6554=function(_0x48a443){while(--_0x48a443){_0x38e717['push'](_0x38e717['shift']());}};_0xdf6554(++_0x457019);}(_0x374c,0x1e3));var _0xc374=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x374c[_0x39d544];return _0x5a5ff2;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc374('0x0'))['db'][_0xc374('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc374('0x2')](0x0);var events={'afterCreate':_0xc374('0x3'),'afterUpdate':_0xc374('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8d161e){return function(_0x534707,_0x1f68cf,_0x2561c0){PluginEvents['emit'](_0x8d161e+':'+_0x534707['id'],_0x534707);PluginEvents[_0xc374('0x5')](_0x8d161e,_0x534707);_0x2561c0(null);};}for(var e in events){if(events[_0xc374('0x6')](e)){var event=events[e];Plugin[_0xc374('0x7')](e,emitEvent(event));}}module[_0xc374('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 68ed0d4..ac9d311 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 _0xc31c=['plugins','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xc31c,0x1a5));var _0xcc31=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc31c[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xcc31('0x0'));var util=require('util');var logger=require(_0xcc31('0x1'))(_0xcc31('0x2'));var moment=require(_0xcc31('0x3'));var BPromise=require(_0xcc31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc31('0x5'));var rimraf=require(_0xcc31('0x6'));var config=require(_0xcc31('0x7'));var attributes=require(_0xcc31('0x8'));module[_0xcc31('0x9')]=function(_0x2c5b6a,_0x59ef75){return _0x2c5b6a[_0xcc31('0xa')]('Plugin',attributes,{'tableName':_0xcc31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x742e=['rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x58da8a,_0x1c0584){var _0x5ba3a3=function(_0x31552b){while(--_0x31552b){_0x58da8a['push'](_0x58da8a['shift']());}};_0x5ba3a3(++_0x1c0584);}(_0x742e,0xa2));var _0xe742=function(_0x1054fe,_0x48d898){_0x1054fe=_0x1054fe-0x0;var _0xab2a37=_0x742e[_0x1054fe];return _0xab2a37;};'use strict';var _=require(_0xe742('0x0'));var util=require(_0xe742('0x1'));var logger=require('../../config/logger')(_0xe742('0x2'));var moment=require(_0xe742('0x3'));var BPromise=require(_0xe742('0x4'));var rp=require(_0xe742('0x5'));var fs=require('fs');var path=require(_0xe742('0x6'));var rimraf=require(_0xe742('0x7'));var config=require(_0xe742('0x8'));var attributes=require('./plugin.attributes');module[_0xe742('0x9')]=function(_0x203dd4,_0x592051){return _0x203dd4[_0xe742('0xa')](_0xe742('0xb'),attributes,{'tableName':_0xe742('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 22b967e..db5d6c2 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 _0xaed9=['info','CreatePlugin','Plugin','create','body','options','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','Plugin,\x20%s,\x20%s','debug','request\x20sent','code','error','message'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0xaed9,0x11e));var _0x9aed=function(_0x27bdc6,_0xa70b62){_0x27bdc6=_0x27bdc6-0x0;var _0x2a3c9c=_0xaed9[_0x27bdc6];return _0x2a3c9c;};'use strict';var _=require(_0x9aed('0x0'));var util=require(_0x9aed('0x1'));var moment=require(_0x9aed('0x2'));var BPromise=require(_0x9aed('0x3'));var rs=require(_0x9aed('0x4'));var fs=require('fs');var Redis=require(_0x9aed('0x5'));var db=require(_0x9aed('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9aed('0x7'));var config=require(_0x9aed('0x8'));var jayson=require(_0x9aed('0x9'));var client=jayson[_0x9aed('0xa')][_0x9aed('0xb')]({'port':0x232a});config[_0x9aed('0xc')]=_[_0x9aed('0xd')](config[_0x9aed('0xc')],{'host':_0x9aed('0xe'),'port':0x18eb});var socket=require(_0x9aed('0xf'))(new Redis(config[_0x9aed('0xc')]));require(_0x9aed('0x10'))[_0x9aed('0x11')](socket);function respondWithRpcPromise(_0x45b7b8,_0x26ad7b,_0x18a07f){return new BPromise(function(_0x3f1e4c,_0x1cf27d){return client['request'](_0x45b7b8,_0x18a07f)['then'](function(_0x11aeb3){logger['info'](_0x9aed('0x12'),_0x26ad7b,'request\x20sent');logger[_0x9aed('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x26ad7b,_0x9aed('0x14'),JSON['stringify'](_0x11aeb3));if(_0x11aeb3['error']){if(_0x11aeb3['error'][_0x9aed('0x15')]===0x1f4){logger[_0x9aed('0x16')]('Plugin,\x20%s,\x20%s',_0x26ad7b,_0x11aeb3['error'][_0x9aed('0x17')]);return _0x1cf27d(_0x11aeb3[_0x9aed('0x16')][_0x9aed('0x17')]);}logger[_0x9aed('0x16')](_0x9aed('0x12'),_0x26ad7b,_0x11aeb3[_0x9aed('0x16')][_0x9aed('0x17')]);return _0x3f1e4c(_0x11aeb3['error'][_0x9aed('0x17')]);}else{logger[_0x9aed('0x18')](_0x9aed('0x12'),_0x26ad7b,'request\x20sent');_0x3f1e4c(_0x11aeb3['result'][_0x9aed('0x17')]);}})['catch'](function(_0x5d1967){logger['error'](_0x9aed('0x12'),_0x26ad7b,_0x5d1967);_0x1cf27d(_0x5d1967);});});}exports[_0x9aed('0x19')]=function(_0x9484b1){var _0x14c3df=this;return new Promise(function(_0x1fc8fe,_0x248107){return db[_0x9aed('0x1a')][_0x9aed('0x1b')](_0x9484b1[_0x9aed('0x1c')],{'raw':_0x9484b1[_0x9aed('0x1d')]?_0x9484b1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xd126d1){logger[_0x9aed('0x18')](_0x9aed('0x19'),_0x9484b1);logger['debug'](_0x9aed('0x19'),_0x9484b1,JSON['stringify'](_0xd126d1));_0x1fc8fe(_0xd126d1);})[_0x9aed('0x1e')](function(_0xf038ad){logger[_0x9aed('0x16')](_0x9aed('0x19'),_0xf038ad['message'],_0x9484b1);_0x248107(_0x14c3df['error'](0x1f4,_0xf038ad[_0x9aed('0x17')]));});});}; \ No newline at end of file +var _0x4f1c=['./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f1c,0x198));var _0xc4f1=function(_0x2ba278,_0x5b98af){_0x2ba278=_0x2ba278-0x0;var _0x459085=_0x4f1c[_0x2ba278];return _0x459085;};'use strict';var _=require(_0xc4f1('0x0'));var util=require('util');var moment=require(_0xc4f1('0x1'));var BPromise=require(_0xc4f1('0x2'));var rs=require(_0xc4f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc4f1('0x4'));var logger=require(_0xc4f1('0x5'))(_0xc4f1('0x6'));var config=require(_0xc4f1('0x7'));var jayson=require(_0xc4f1('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc4f1('0x9')]=_['defaults'](config[_0xc4f1('0x9')],{'host':_0xc4f1('0xa'),'port':0x18eb});var socket=require(_0xc4f1('0xb'))(new Redis(config[_0xc4f1('0x9')]));require(_0xc4f1('0xc'))['register'](socket);function respondWithRpcPromise(_0x4db626,_0x2b2cc3,_0x4b91d5){return new BPromise(function(_0x10181a,_0x43e4ac){return client[_0xc4f1('0xd')](_0x4db626,_0x4b91d5)[_0xc4f1('0xe')](function(_0x5ee553){logger['info'](_0xc4f1('0xf'),_0x2b2cc3,_0xc4f1('0x10'));logger[_0xc4f1('0x11')](_0xc4f1('0x12'),_0x2b2cc3,_0xc4f1('0x10'),JSON[_0xc4f1('0x13')](_0x5ee553));if(_0x5ee553[_0xc4f1('0x14')]){if(_0x5ee553[_0xc4f1('0x14')][_0xc4f1('0x15')]===0x1f4){logger[_0xc4f1('0x14')](_0xc4f1('0xf'),_0x2b2cc3,_0x5ee553[_0xc4f1('0x14')]['message']);return _0x43e4ac(_0x5ee553['error'][_0xc4f1('0x16')]);}logger[_0xc4f1('0x14')](_0xc4f1('0xf'),_0x2b2cc3,_0x5ee553[_0xc4f1('0x14')]['message']);return _0x10181a(_0x5ee553[_0xc4f1('0x14')][_0xc4f1('0x16')]);}else{logger['info'](_0xc4f1('0xf'),_0x2b2cc3,'request\x20sent');_0x10181a(_0x5ee553[_0xc4f1('0x17')][_0xc4f1('0x16')]);}})[_0xc4f1('0x18')](function(_0xe2046d){logger[_0xc4f1('0x14')](_0xc4f1('0xf'),_0x2b2cc3,_0xe2046d);_0x43e4ac(_0xe2046d);});});}exports[_0xc4f1('0x19')]=function(_0xa1da10){var _0x3d5179=this;return new Promise(function(_0x25957f,_0x115e59){return db[_0xc4f1('0x1a')][_0xc4f1('0x1b')](_0xa1da10['body'],{'raw':_0xa1da10[_0xc4f1('0x1c')]?_0xa1da10[_0xc4f1('0x1c')][_0xc4f1('0x1d')]===undefined?!![]:![]:!![]})[_0xc4f1('0xe')](function(_0x5c79fc){logger['info'](_0xc4f1('0x19'),_0xa1da10);logger[_0xc4f1('0x11')](_0xc4f1('0x19'),_0xa1da10,JSON[_0xc4f1('0x13')](_0x5c79fc));_0x25957f(_0x5c79fc);})[_0xc4f1('0x18')](function(_0x1f3e7b){logger['error'](_0xc4f1('0x19'),_0x1f3e7b[_0xc4f1('0x16')],_0xa1da10);_0x115e59(_0x3d5179[_0xc4f1('0x14')](0x1f4,_0x1f3e7b['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 56268dc..8803493 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 _0x9a70=['update','emit','register','plugin:','save'];(function(_0xd18ec7,_0x49f4a9){var _0x40050e=function(_0x4585f0){while(--_0x4585f0){_0xd18ec7['push'](_0xd18ec7['shift']());}};_0x40050e(++_0x49f4a9);}(_0x9a70,0xf4));var _0x09a7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9a70[_0x57b54c];return _0x59cc19;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x09a7('0x0'),'remove',_0x09a7('0x1')];function createListener(_0x5c3a0c,_0xae7087){return function(_0x374245){_0xae7087[_0x09a7('0x2')](_0x5c3a0c,_0x374245);};}function removeListener(_0x373222,_0x5b363a){return function(){PluginEvents['removeListener'](_0x373222,_0x5b363a);};}exports[_0x09a7('0x3')]=function(_0x31e867){for(var _0x470278=0x0,_0x186f24=events['length'];_0x470278<_0x186f24;_0x470278++){var _0x4a5801=events[_0x470278];var _0x53a7a2=createListener(_0x09a7('0x4')+_0x4a5801,_0x31e867);PluginEvents['on'](_0x4a5801,_0x53a7a2);}}; \ No newline at end of file +var _0xa79d=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0xa79d,0xa0));var _0xda79=function(_0x39ffa7,_0x1560f1){_0x39ffa7=_0x39ffa7-0x0;var _0x5650e0=_0xa79d[_0x39ffa7];return _0x5650e0;};'use strict';var PluginEvents=require(_0xda79('0x0'));var events=[_0xda79('0x1'),_0xda79('0x2'),_0xda79('0x3')];function createListener(_0x532260,_0x8910b1){return function(_0x50aa1f){_0x8910b1[_0xda79('0x4')](_0x532260,_0x50aa1f);};}function removeListener(_0x452dca,_0x219b96){return function(){PluginEvents[_0xda79('0x5')](_0x452dca,_0x219b96);};}exports[_0xda79('0x6')]=function(_0x169c66){for(var _0x9b64fc=0x0,_0x36fbb7=events[_0xda79('0x7')];_0x9b64fc<_0x36fbb7;_0x9b64fc++){var _0x2e211e=events[_0x9b64fc];var _0x8f0204=createListener(_0xda79('0x8')+_0x2e211e,_0x169c66);PluginEvents['on'](_0x2e211e,_0x8f0204);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9c2e238..78693cf 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(_0x3acd80,_0x410732){var _0x286ca3=function(_0x17f880){while(--_0x17f880){_0x3acd80['push'](_0x3acd80['shift']());}};_0x286ca3(++_0x410732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x39dc4c,_0x43b31a){var _0x435274=function(_0xc1d965){while(--_0xc1d965){_0x39dc4c['push'](_0x39dc4c['shift']());}};_0x435274(++_0x43b31a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 8105f40..a28ec0a 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 _0xd404=['stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','api','path','exec','bluebird','sendStatus','json','name','status','send','npm\x20install','info','error','index','list','then','express','motion2','length','catch','show','describe','params','body','join','script','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0xbb92d0,_0x4bd810){var _0x5514fb=function(_0x3048bc){while(--_0x3048bc){_0xbb92d0['push'](_0xbb92d0['shift']());}};_0x5514fb(++_0x4bd810);}(_0xd404,0x15b));var _0x4d40=function(_0x1a6ca1,_0x1c16f2){_0x1a6ca1=_0x1a6ca1-0x0;var _0x8dd57=_0xd404[_0x1a6ca1];return _0x8dd57;};'use strict';var _=require(_0x4d40('0x0'));var pm2=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var path=require(_0x4d40('0x3'));var exec=require('child_process')[_0x4d40('0x4')];var BPromise=require(_0x4d40('0x5'));function handleEntityNotFound(_0xba821,_0x8bde12){return function(_0xbfb4c6){if(!_0xbfb4c6){_0xba821[_0x4d40('0x6')](0x194);;}return _0xbfb4c6;};}function respondWithResult(_0xc2a9db,_0x24a237){_0x24a237=_0x24a237||0xc8;return function(_0x2e4bd8){if(_0x2e4bd8){return _0xc2a9db['status'](_0x24a237)[_0x4d40('0x7')](_0x2e4bd8);}return null;};}function handleError(_0x116941,_0x5a23a2){_0x5a23a2=_0x5a23a2||0x1f4;return function(_0x3bf81a){logger['error'](_0x3bf81a['stack']);if(_0x3bf81a[_0x4d40('0x8')]){delete _0x3bf81a[_0x4d40('0x8')];}_0x116941[_0x4d40('0x9')](_0x5a23a2)[_0x4d40('0xa')](_0x3bf81a);};}function execChildProcess(){return new BPromise(function(_0x1d00cf,_0x357abf){exec(_0x4d40('0xb'),function(_0x2eab7a,_0x1e18bc,_0x3f5c29){logger[_0x4d40('0xc')](_0x1e18bc);logger[_0x4d40('0xc')](_0x3f5c29);if(_0x2eab7a){logger[_0x4d40('0xd')](_0x2eab7a);return _0x357abf(_0x2eab7a);}return _0x1d00cf(_0x1e18bc);});});}exports[_0x4d40('0xe')]=function(_0x5162f9,_0xa644d2){return pm2[_0x4d40('0xf')]()[_0x4d40('0x10')](function(_0x2083bd){if(_0x2083bd){var _0x477a91=_['reject'](_0x2083bd,function(_0x23de7b){return _0x23de7b[_0x4d40('0x8')]===_0x4d40('0x11')||_0x23de7b[_0x4d40('0x8')]===_0x4d40('0x12');});return{'rows':_0x477a91,'count':_0x477a91[_0x4d40('0x13')]};}return null;})[_0x4d40('0x10')](respondWithResult(_0xa644d2,null))[_0x4d40('0x14')](handleError(_0xa644d2,null));};exports[_0x4d40('0x15')]=function(_0x4b5d23,_0x535989){return pm2[_0x4d40('0x16')](_0x4b5d23[_0x4d40('0x17')]['id'])['then'](respondWithResult(_0x535989,null))[_0x4d40('0x10')](handleEntityNotFound(_0x535989,null))[_0x4d40('0x14')](handleError(_0x535989,null));};exports['create']=function(_0x36d031,_0x5a77e0){if(_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')]&&_0x36d031['body']['script']){var _0x375ce0=path[_0x4d40('0x19')](__dirname,'../../files/plugins',_0x36d031[_0x4d40('0x18')][_0x4d40('0x1a')]);var _0x30f058=process['cwd']();process[_0x4d40('0x1b')](path[_0x4d40('0x1c')](_0x375ce0));return execChildProcess()[_0x4d40('0x10')](function(_0x5ca0a0){process['chdir'](_0x30f058);return pm2[_0x4d40('0x1d')]({'name':_0x36d031[_0x4d40('0x18')][_0x4d40('0x8')],'script':_0x375ce0});})[_0x4d40('0x10')](function(_0x4677c9){pm2['dump']();return _0x4677c9[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a77e0,0xc9))[_0x4d40('0x14')](handleError(_0x5a77e0,null));}else{return _0x5a77e0['status'](0x1f4)['send']({'message':_0x4d40('0x1e')});}};exports[_0x4d40('0x1f')]=function(_0x3fa83e,_0x3ad1d7){if(_0x3fa83e[_0x4d40('0x18')]['id']){delete _0x3fa83e[_0x4d40('0x18')]['id'];}var _0x105635={'online':_0x4d40('0x20'),'stopped':_0x4d40('0x21')};if(_0x105635[_0x4d40('0x22')](_0x3fa83e[_0x4d40('0x18')]['status'])){return pm2[_0x105635[_0x3fa83e['body']['status']]](_0x3fa83e[_0x4d40('0x17')]['id'])[_0x4d40('0x10')](respondWithResult(_0x3ad1d7,0xc8))[_0x4d40('0x14')](handleError(_0x3ad1d7,null));}else{return _0x3ad1d7[_0x4d40('0x9')](0x1f4)['send']({'message':_0x4d40('0x23')});}};exports[_0x4d40('0x24')]=function(_0x429da9,_0x5a6aff){if(_0x429da9[_0x4d40('0x18')]['id']){delete _0x429da9[_0x4d40('0x18')]['id'];}if(_0x429da9[_0x4d40('0x17')]['id']){return pm2[_0x4d40('0x25')](_0x429da9[_0x4d40('0x17')]['id'])['then'](function(_0x2f4b22){pm2['dump']();return _0x2f4b22[0x0];})[_0x4d40('0x10')](respondWithResult(_0x5a6aff,null))[_0x4d40('0x14')](handleError(_0x5a6aff,null));}else{return _0x5a6aff[_0x4d40('0x9')](0x1f4)[_0x4d40('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xc788=['body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','stop','hasOwnProperty','Unknown\x20status','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','sendStatus','status','error','stack','name','info','index','list','then','reject','motion2','catch','show','describe'];(function(_0x5aa1e2,_0x2b5adb){var _0x399098=function(_0xb129fb){while(--_0xb129fb){_0x5aa1e2['push'](_0x5aa1e2['shift']());}};_0x399098(++_0x2b5adb);}(_0xc788,0xc4));var _0x8c78=function(_0x288325,_0x26e4ff){_0x288325=_0x288325-0x0;var _0x3b9fd7=_0xc788[_0x288325];return _0x3b9fd7;};'use strict';var _=require(_0x8c78('0x0'));var pm2=require(_0x8c78('0x1'));var logger=require(_0x8c78('0x2'))('api');var path=require('path');var exec=require(_0x8c78('0x3'))[_0x8c78('0x4')];var BPromise=require(_0x8c78('0x5'));function handleEntityNotFound(_0x1d0670,_0x386f0a){return function(_0x5498f9){if(!_0x5498f9){_0x1d0670[_0x8c78('0x6')](0x194);;}return _0x5498f9;};}function respondWithResult(_0x4555da,_0x329152){_0x329152=_0x329152||0xc8;return function(_0x1ac27f){if(_0x1ac27f){return _0x4555da[_0x8c78('0x7')](_0x329152)['json'](_0x1ac27f);}return null;};}function handleError(_0x247188,_0x299d9d){_0x299d9d=_0x299d9d||0x1f4;return function(_0x9bc075){logger[_0x8c78('0x8')](_0x9bc075[_0x8c78('0x9')]);if(_0x9bc075[_0x8c78('0xa')]){delete _0x9bc075['name'];}_0x247188[_0x8c78('0x7')](_0x299d9d)['send'](_0x9bc075);};}function execChildProcess(){return new BPromise(function(_0x3d55f0,_0x45935a){exec('npm\x20install',function(_0x1a05a7,_0x95e78e,_0x5ee642){logger[_0x8c78('0xb')](_0x95e78e);logger['info'](_0x5ee642);if(_0x1a05a7){logger['error'](_0x1a05a7);return _0x45935a(_0x1a05a7);}return _0x3d55f0(_0x95e78e);});});}exports[_0x8c78('0xc')]=function(_0x1b1d0e,_0x26178c){return pm2[_0x8c78('0xd')]()[_0x8c78('0xe')](function(_0x3d1306){if(_0x3d1306){var _0xe5f8ae=_[_0x8c78('0xf')](_0x3d1306,function(_0x2f44af){return _0x2f44af[_0x8c78('0xa')]==='express'||_0x2f44af[_0x8c78('0xa')]===_0x8c78('0x10');});return{'rows':_0xe5f8ae,'count':_0xe5f8ae['length']};}return null;})[_0x8c78('0xe')](respondWithResult(_0x26178c,null))[_0x8c78('0x11')](handleError(_0x26178c,null));};exports[_0x8c78('0x12')]=function(_0x23824e,_0x2a982c){return pm2[_0x8c78('0x13')](_0x23824e['params']['id'])['then'](respondWithResult(_0x2a982c,null))[_0x8c78('0xe')](handleEntityNotFound(_0x2a982c,null))['catch'](handleError(_0x2a982c,null));};exports['create']=function(_0xece4f0,_0x56c191){if(_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')]&&_0xece4f0['body'][_0x8c78('0x15')]){var _0x5b111b=path[_0x8c78('0x16')](__dirname,_0x8c78('0x17'),_0xece4f0['body'][_0x8c78('0x15')]);var _0x188cc3=process['cwd']();process[_0x8c78('0x18')](path[_0x8c78('0x19')](_0x5b111b));return execChildProcess()[_0x8c78('0xe')](function(_0x9581c6){process[_0x8c78('0x18')](_0x188cc3);return pm2[_0x8c78('0x1a')]({'name':_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')],'script':_0x5b111b});})[_0x8c78('0xe')](function(_0x4a7d20){pm2[_0x8c78('0x1b')]();return _0x4a7d20[0x0];})[_0x8c78('0xe')](respondWithResult(_0x56c191,0xc9))[_0x8c78('0x11')](handleError(_0x56c191,null));}else{return _0x56c191['status'](0x1f4)[_0x8c78('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8c78('0x1d')]=function(_0x24f9a7,_0x8d9ff9){if(_0x24f9a7['body']['id']){delete _0x24f9a7[_0x8c78('0x14')]['id'];}var _0x2568d5={'online':'restart','stopped':_0x8c78('0x1e')};if(_0x2568d5[_0x8c78('0x1f')](_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')])){return pm2[_0x2568d5[_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')]]](_0x24f9a7['params']['id'])[_0x8c78('0xe')](respondWithResult(_0x8d9ff9,0xc8))['catch'](handleError(_0x8d9ff9,null));}else{return _0x8d9ff9[_0x8c78('0x7')](0x1f4)[_0x8c78('0x1c')]({'message':_0x8c78('0x20')});}};exports['destroy']=function(_0x1f1a0c,_0x3816d2){if(_0x1f1a0c['body']['id']){delete _0x1f1a0c[_0x8c78('0x14')]['id'];}if(_0x1f1a0c[_0x8c78('0x21')]['id']){return pm2[_0x8c78('0x22')](_0x1f1a0c['params']['id'])[_0x8c78('0xe')](function(_0x63307e){pm2[_0x8c78('0x1b')]();return _0x63307e[0x0];})['then'](respondWithResult(_0x3816d2,null))[_0x8c78('0x11')](handleError(_0x3816d2,null));}else{return _0x3816d2[_0x8c78('0x7')](0x1f4)['send']({'message':_0x8c78('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e04ba7a..12fa0d7 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 _0xc305=['Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','get','getQueues','express'];(function(_0x35c172,_0x519b4a){var _0x29297d=function(_0x2284d8){while(--_0x2284d8){_0x35c172['push'](_0x35c172['shift']());}};_0x29297d(++_0x519b4a);}(_0xc305,0x117));var _0x5c30=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0xc305[_0x369a98];return _0x29565c;};'use strict';var express=require(_0x5c30('0x0'));var router=express[_0x5c30('0x1')]();var auth=require(_0x5c30('0x2'));var controller=require(_0x5c30('0x3'));router['get'](_0x5c30('0x4'),auth[_0x5c30('0x5')](),controller['getAgents']);router[_0x5c30('0x6')]('/queues',auth['isAuthenticated'](),controller[_0x5c30('0x7')]);module['exports']=router; \ No newline at end of file +var _0x4864=['getQueues','exports','express','Router','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x4864,0x1c4));var _0x4486=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0x4864[_0x55cc58];return _0x26062e;};'use strict';var express=require(_0x4486('0x0'));var router=express[_0x4486('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4486('0x2'));router[_0x4486('0x3')](_0x4486('0x4'),auth[_0x4486('0x5')](),controller[_0x4486('0x6')]);router['get']('/queues',auth[_0x4486('0x5')](),controller[_0x4486('0x7')]);module[_0x4486('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index b028cb7..dd08960 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 _0xbb23=['json','getAgents','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','validateSortParameter','join','getAgentIdsByQueues','getRealtimeAgents','rows','length','map','User','rawAttributes','type','key','role','agent','getOptions','push','sequelize','FIELD(id,','order','forEach','*pause','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','filterAgentAttributes','voice','voiceStatus','talking','sortAgentsByStatus','getQueues','resolve','toLowerCase','startCase','Queue','fieldName','fields','name','dialActive','dialMethod','QueueCampaigns','filter','findAndCountAll','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x236ca7,_0x360385){var _0x32e351=function(_0x18050e){while(--_0x18050e){_0x236ca7['push'](_0x236ca7['shift']());}};_0x32e351(++_0x360385);}(_0xbb23,0x1dd));var _0x3bb2=function(_0x851b03,_0x27a248){_0x851b03=_0x851b03-0x0;var _0x11e934=_0xbb23[_0x851b03];return _0x11e934;};'use strict';var _=require(_0x3bb2('0x0'));var util=require(_0x3bb2('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require(_0x3bb2('0x2'));var utils=require(_0x3bb2('0x3'));var db=require(_0x3bb2('0x4'))['db'];var APIBadRequestError=require(_0x3bb2('0x5'))[_0x3bb2('0x6')];var APIHandleError=require(_0x3bb2('0x5'))[_0x3bb2('0x7')];function respondWithFilteredResult(_0x425b20,_0x590e48){return function(_0x38c65b){if(_0x38c65b){var _0x4d0ebf=typeof _0x590e48[_0x3bb2('0x8')]===_0x3bb2('0x9')&&typeof _0x590e48[_0x3bb2('0xa')]===_0x3bb2('0x9');var _0x34ca63=_0x38c65b[_0x3bb2('0xb')];var _0x8a0a3b=_0x4d0ebf?0x0:_0x590e48[_0x3bb2('0x8')];var _0x8cdfa1=_0x4d0ebf?_0x38c65b[_0x3bb2('0xb')]:_0x590e48['offset']+_0x590e48[_0x3bb2('0xa')];var _0x2c0413;if(_0x8cdfa1>=_0x34ca63){_0x8cdfa1=_0x34ca63;_0x2c0413=0xc8;}else{_0x2c0413=0xce;}_0x425b20[_0x3bb2('0xc')](_0x2c0413);return _0x425b20[_0x3bb2('0xd')](_0x3bb2('0xe'),_0x8a0a3b+'-'+_0x8cdfa1+'/'+_0x34ca63)[_0x3bb2('0xf')](_0x38c65b);}return null;};}exports[_0x3bb2('0x10')]=function(_0x1f8c08,_0xcd391f){var _0x7a5f2a={'count':0x0,'rows':[]};var _0x5490dd={};var _0x382367;var _0x4e5e45=utils['getChannels']();var _0x39bd5e;var _0xd3b1ff;var _0x5c3498=_0x1f8c08['query'][_0x3bb2('0x11')];var _0x27af4e=_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x13')];var _0x37791c=_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x14')];var _0x53b32f=_0x27af4e===_0x3bb2('0x15')||_0x27af4e==='*pause'?!![]:![];var _0x51b989=[];var _0x16c4dd;var _0x244980;Promise['resolve']()[_0x3bb2('0x16')](function(){if(_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x17')]){if(!utils[_0x3bb2('0x18')](_0x1f8c08['query'][_0x3bb2('0x17')])){throw new APIBadRequestError(util[_0x3bb2('0x19')](_0x3bb2('0x1a'),_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x17')]));}_0x382367=_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x17')]['toLowerCase']();}if(!_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x1b')]||!_0x1f8c08[_0x3bb2('0x12')]['sort'][_0x3bb2('0x1c')](_0x3bb2('0x1d'))){_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x1b')]=rta[_0x3bb2('0x1e')](_0x1f8c08[_0x3bb2('0x12')]['sort']);return;}var _0x3c23be=rta['getUpdatedSortOptions'](_0x1f8c08['query'][_0x3bb2('0x1b')]);_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x1b')]=_0x3c23be['fields'][_0x3bb2('0x1f')](',');_0x16c4dd=_0x3c23be['order'];})[_0x3bb2('0x16')](function(){if(!_0x5c3498){return[];}return rta[_0x3bb2('0x20')](_0x5c3498,_0x382367);})[_0x3bb2('0x16')](function(_0x159a37){_0x51b989=_0x159a37;return rta[_0x3bb2('0x21')]();})['then'](function(_0x5a4684){_0xd3b1ff=_0x5a4684[_0x3bb2('0x22')];if((!_0x27af4e||_0x53b32f)&&!_0x16c4dd){return _0x51b989;}if(_0x16c4dd&&!_0x27af4e){return rta['getSortedAgentsIdsByStatus'](_0xd3b1ff,_0x51b989,_0x16c4dd);}else{return rta['getAgentIdsByStatus'](_0xd3b1ff,_0x51b989,_0x27af4e);}})['then'](function(_0x45aca9){_0x51b989=_0x45aca9;var _0x585cd8=![];if(_0x51b989[_0x3bb2('0x23')]===0x0){if(_0x5c3498||_0x27af4e){_0x585cd8=!![];}if(_0x53b32f){_0x585cd8=![];}}if(_0x585cd8){return _0x7a5f2a;}var _0x23a6c6=_[_0x3bb2('0x24')](db[_0x3bb2('0x25')][_0x3bb2('0x26')],function(_0x384d8c){return{'name':_0x384d8c['fieldName'],'type':_0x384d8c[_0x3bb2('0x27')][_0x3bb2('0x28')]};});_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x29')]=_0x3bb2('0x2a');_0x5490dd=qs[_0x3bb2('0x2b')](_0x23a6c6,_0x1f8c08);_0x5490dd['raw']=!![];var _0x52014f=[];if(_0x51b989[_0x3bb2('0x23')]>0x0){_0x52014f[_0x3bb2('0x2c')]({'id':{'$in':_0x51b989}});if(_0x16c4dd&&!_0x27af4e){_0x244980=[db[_0x3bb2('0x2d')]['literal'](_0x3bb2('0x2e')+_0x51b989+')')];_0x5490dd[_0x3bb2('0x2f')]=_0x244980;}}if(_0x53b32f){_0x4e5e45[_0x3bb2('0x30')](function(_0x3c5a87){var _0x42a88b=!![];if(_0x27af4e===_0x3bb2('0x31')&&_0x382367!==_0x3c5a87){_0x42a88b=![];}_0x52014f['push']({[_0x3c5a87+'Pause']:_0x42a88b});});if(_0x37791c){_0x52014f[_0x3bb2('0x2c')]({'pauseType':_0x37791c});}}else if(_0x27af4e){_0x4e5e45[_0x3bb2('0x30')](function(_0x1dccb6){_0x52014f[_0x3bb2('0x2c')]({[_0x1dccb6+_0x3bb2('0x32')]:![]});});}_0x5490dd[_0x3bb2('0x33')]=_[_0x3bb2('0x34')](_0x5490dd['where'],{'$and':_0x52014f});if(_0x1f8c08[_0x3bb2('0x35')]['role']===_0x3bb2('0x35')){var _0x128b83={'params':{'id':_0x1f8c08['user'][_0x3bb2('0x36')]},'query':{'section':_0x3bb2('0x37'),'role':_0x3bb2('0x2a'),'raw':!![],'ids':_0x51b989,'customSorting':_0x244980}};if(_0x1f8c08[_0x3bb2('0x12')][_0x3bb2('0x38')]){_0x128b83[_0x3bb2('0x12')][_0x3bb2('0x38')]=!![];}if(_0x53b32f){_0x128b83[_0x3bb2('0x12')][_0x3bb2('0x39')]=_0x52014f;}_0x128b83[_0x3bb2('0x12')]=Object[_0x3bb2('0x3a')](_0x128b83[_0x3bb2('0x12')],_0x1f8c08[_0x3bb2('0x12')]);return db[_0x3bb2('0x3b')][_0x3bb2('0x3c')](_0x128b83);}return db['User']['findAndCountAll'](_0x5490dd);})[_0x3bb2('0x16')](function(_0x1a3aa9){_0x7a5f2a[_0x3bb2('0xb')]=_0x1a3aa9[_0x3bb2('0xb')];_0x39bd5e=_0x1a3aa9[_0x3bb2('0x22')];return _0x39bd5e[_0x3bb2('0x24')](function(_0xc312a4){var _0x387361=_['find'](_0xd3b1ff,['id',_0xc312a4['id']]);if(_0x387361){var _0x169f44=rta[_0x3bb2('0x3d')](_0x387361);_[_0x3bb2('0x34')](_0xc312a4,_0x169f44);}_0xc312a4[_0x3bb2('0x1d')]=rta['getAgentStatus'](_0xc312a4);if(_0xc312a4[_0x3bb2('0x1d')]['includes']('pause')){_0x4e5e45[_0x3bb2('0x30')](function(_0x66cd5c){if(_0xc312a4[_0x66cd5c+_0x3bb2('0x32')]){if(_0x66cd5c===_0x3bb2('0x3e')){if(_0xc312a4[_0x3bb2('0x3f')]!==_0x3bb2('0x40')){_0xc312a4[_0x3bb2('0x3f')]=_0x3bb2('0x15');}}else{_0xc312a4[_0x66cd5c+'Status']=_0x3bb2('0x15');}}});}return _0xc312a4;});})['then'](function(_0x403f96){if(!_0x16c4dd||_0x244980){return _0x403f96;}return rta[_0x3bb2('0x41')](_0x403f96,_0x16c4dd);})[_0x3bb2('0x16')](function(_0x3de8b7){var _0x230f5b=rta['getRealtimeAgentsQueryFields']();_0x7a5f2a[_0x3bb2('0x22')]=_0x3de8b7['map'](function(_0x49ac1f){return _['pick'](_0x49ac1f,_0x230f5b);});return _0x7a5f2a;})[_0x3bb2('0x16')](respondWithFilteredResult(_0xcd391f,_0x5490dd))['catch'](APIHandleError(_0xcd391f));};exports[_0x3bb2('0x42')]=function(_0x2fda74,_0x498734){var _0x4742e1={'count':0x0,'rows':[]};var _0x5d9291={};var _0x17469;var _0x15fb29;var _0x142018;Promise[_0x3bb2('0x43')]()['then'](function(){if(_0x2fda74[_0x3bb2('0x12')][_0x3bb2('0x17')]){if(!utils[_0x3bb2('0x18')](_0x2fda74[_0x3bb2('0x12')][_0x3bb2('0x17')])){throw new APIBadRequestError(util[_0x3bb2('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2fda74[_0x3bb2('0x12')]['channel']));}_0x17469=_0x2fda74[_0x3bb2('0x12')][_0x3bb2('0x17')][_0x3bb2('0x44')]();}var _0x3966ce=_[_0x3bb2('0x45')](_0x17469)+_0x3bb2('0x46');var _0x475fc7=_[_0x3bb2('0x24')](db[_0x3966ce]['rawAttributes'],function(_0x5b2c08){return{'name':_0x5b2c08[_0x3bb2('0x47')],'type':_0x5b2c08['type'][_0x3bb2('0x28')]};});if(!_0x2fda74[_0x3bb2('0x12')][_0x3bb2('0x48')]){var _0x54aa99=['id',_0x3bb2('0x49')];if(_0x17469===_0x3bb2('0x3e')){_0x54aa99['push'](_0x3bb2('0x27'));if(_0x2fda74['query'][_0x3bb2('0x27')]==='outbound'){_0x54aa99[_0x3bb2('0x2c')]([_0x3bb2('0x4a'),_0x3bb2('0x4b')]);}}_0x2fda74[_0x3bb2('0x12')][_0x3bb2('0x48')]=_0x54aa99['join'](',');}_0x5d9291=qs[_0x3bb2('0x2b')](_0x475fc7,_0x2fda74);if(_0x2fda74['user']['role']===_0x3bb2('0x35')){var _0x24c9f5={'params':{'id':_0x2fda74['user'][_0x3bb2('0x36')]},'query':{'section':_0x17469===_0x3bb2('0x3e')&&_0x2fda74['query'][_0x3bb2('0x27')]==='outbound'?_0x3bb2('0x4c'):_[_0x3bb2('0x45')](_0x17469)+'Queues','type':_0x2fda74[_0x3bb2('0x12')]['type'],'nolimit':!![],'sort':_0x3bb2('0x49'),'filter':_0x2fda74['query'][_0x3bb2('0x4d')]}};_0x24c9f5[_0x3bb2('0x12')]=Object['assign'](_0x24c9f5['query'],_0x2fda74[_0x3bb2('0x12')]);delete _0x24c9f5[_0x3bb2('0x12')]['id'];return db[_0x3bb2('0x3b')]['getResources'](_0x24c9f5);}return db[_0x3966ce][_0x3bb2('0x4e')](_0x5d9291);})[_0x3bb2('0x16')](function(_0x15ee13){_0x4742e1[_0x3bb2('0xb')]=_0x15ee13['count'];_0x15fb29=_0x15ee13[_0x3bb2('0x22')];return rtq[_0x3bb2('0x4f')](_0x2fda74,_0x17469);})[_0x3bb2('0x16')](function(_0x25d8dc){_0x142018=_0x25d8dc['rows'];return rtq[_0x3bb2('0x50')](_0x15fb29,_0x142018,_0x17469,_0x2fda74[_0x3bb2('0x12')][_0x3bb2('0x27')]);})[_0x3bb2('0x16')](function(_0x6ca611){_0x4742e1[_0x3bb2('0x22')]=_0x6ca611;return _0x4742e1;})[_0x3bb2('0x16')](respondWithFilteredResult(_0x498734,_0x5d9291))[_0x3bb2('0x51')](APIHandleError(_0x498734));}; \ No newline at end of file +var _0x7b39=['pauseTypeFilter','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','includes','globalStatus','validateSortParameter','sort','fields','join','order','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','rawAttributes','type','key','agent','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','role','userProfileId','online','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','map','find','filterAgentAttributes','pause','voice','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','pick','startCase','Queue','name','outbound','dialActive','dialMethod','user','QueueCampaigns','Queues','assign','catch','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter'];(function(_0xa65be6,_0xdccffa){var _0x4372af=function(_0x1d8ce9){while(--_0x1d8ce9){_0xa65be6['push'](_0xa65be6['shift']());}};_0x4372af(++_0xdccffa);}(_0x7b39,0x93));var _0x97b3=function(_0x368c1d,_0x4683cd){_0x368c1d=_0x368c1d-0x0;var _0xface06=_0x7b39[_0x368c1d];return _0xface06;};'use strict';var _=require(_0x97b3('0x0'));var util=require(_0x97b3('0x1'));var rta=require(_0x97b3('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x97b3('0x3'));var utils=require(_0x97b3('0x4'));var db=require(_0x97b3('0x5'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require(_0x97b3('0x6'))[_0x97b3('0x7')];function respondWithFilteredResult(_0x28cccc,_0x373732){return function(_0x1035c4){if(_0x1035c4){var _0x2a5939=typeof _0x373732[_0x97b3('0x8')]===_0x97b3('0x9')&&typeof _0x373732[_0x97b3('0xa')]===_0x97b3('0x9');var _0x3d2c9b=_0x1035c4[_0x97b3('0xb')];var _0x13df88=_0x2a5939?0x0:_0x373732[_0x97b3('0x8')];var _0x1ceb79=_0x2a5939?_0x1035c4[_0x97b3('0xb')]:_0x373732[_0x97b3('0x8')]+_0x373732[_0x97b3('0xa')];var _0x51471a;if(_0x1ceb79>=_0x3d2c9b){_0x1ceb79=_0x3d2c9b;_0x51471a=0xc8;}else{_0x51471a=0xce;}_0x28cccc[_0x97b3('0xc')](_0x51471a);return _0x28cccc[_0x97b3('0xd')](_0x97b3('0xe'),_0x13df88+'-'+_0x1ceb79+'/'+_0x3d2c9b)[_0x97b3('0xf')](_0x1035c4);}return null;};}exports[_0x97b3('0x10')]=function(_0x28d165,_0x5ce160){var _0x401e5c={'count':0x0,'rows':[]};var _0x4560ec={};var _0x67921c;var _0x13ab69=utils[_0x97b3('0x11')]();var _0x650848;var _0x25d7ff;var _0x60d480=_0x28d165[_0x97b3('0x12')][_0x97b3('0x13')];var _0x392fad=_0x28d165[_0x97b3('0x12')][_0x97b3('0x14')];var _0x1ab611=_0x28d165[_0x97b3('0x12')][_0x97b3('0x15')];var _0x6cc866=_0x392fad==='pause'||_0x392fad===_0x97b3('0x16')?!![]:![];var _0x551cf9=[];var _0x58faf9;var _0x5202f2;Promise[_0x97b3('0x17')]()[_0x97b3('0x18')](function(){if(_0x28d165[_0x97b3('0x12')][_0x97b3('0x19')]){if(!utils[_0x97b3('0x1a')](_0x28d165['query'][_0x97b3('0x19')])){throw new APIBadRequestError(util[_0x97b3('0x1b')](_0x97b3('0x1c'),_0x28d165['query'][_0x97b3('0x19')]));}_0x67921c=_0x28d165[_0x97b3('0x12')][_0x97b3('0x19')][_0x97b3('0x1d')]();}if(!_0x28d165[_0x97b3('0x12')]['sort']||!_0x28d165[_0x97b3('0x12')]['sort'][_0x97b3('0x1e')](_0x97b3('0x1f'))){_0x28d165[_0x97b3('0x12')]['sort']=rta[_0x97b3('0x20')](_0x28d165['query']['sort']);return;}var _0xec1101=rta['getUpdatedSortOptions'](_0x28d165[_0x97b3('0x12')][_0x97b3('0x21')]);_0x28d165['query'][_0x97b3('0x21')]=_0xec1101[_0x97b3('0x22')][_0x97b3('0x23')](',');_0x58faf9=_0xec1101[_0x97b3('0x24')];})[_0x97b3('0x18')](function(){if(!_0x60d480){return[];}return rta['getAgentIdsByQueues'](_0x60d480,_0x67921c);})['then'](function(_0x57d635){_0x551cf9=_0x57d635;return rta['getRealtimeAgents']();})[_0x97b3('0x18')](function(_0x2fb9bd){_0x25d7ff=_0x2fb9bd[_0x97b3('0x25')];if((!_0x392fad||_0x6cc866)&&!_0x58faf9){return _0x551cf9;}if(_0x58faf9&&!_0x392fad){return rta[_0x97b3('0x26')](_0x25d7ff,_0x551cf9,_0x58faf9);}else{return rta[_0x97b3('0x27')](_0x25d7ff,_0x551cf9,_0x392fad);}})[_0x97b3('0x18')](function(_0x41e212){_0x551cf9=_0x41e212;var _0x1dd547=![];if(_0x551cf9[_0x97b3('0x28')]===0x0){if(_0x60d480||_0x392fad){_0x1dd547=!![];}if(_0x6cc866){_0x1dd547=![];}}if(_0x1dd547){return _0x401e5c;}var _0x279851=_['map'](db['User'][_0x97b3('0x29')],function(_0x38d1c6){return{'name':_0x38d1c6['fieldName'],'type':_0x38d1c6[_0x97b3('0x2a')][_0x97b3('0x2b')]};});_0x28d165['query']['role']=_0x97b3('0x2c');_0x4560ec=qs[_0x97b3('0x2d')](_0x279851,_0x28d165);_0x4560ec[_0x97b3('0x2e')]=!![];var _0x3f8f8b=[];if(_0x551cf9['length']>0x0){_0x3f8f8b[_0x97b3('0x2f')]({'id':{'$in':_0x551cf9}});if(_0x58faf9&&!_0x392fad){_0x5202f2=[db[_0x97b3('0x30')][_0x97b3('0x31')](_0x97b3('0x32')+_0x551cf9+')')];_0x4560ec[_0x97b3('0x24')]=_0x5202f2;}}if(_0x6cc866){_0x13ab69[_0x97b3('0x33')](function(_0x4801c7){var _0x215bff=!![];if(_0x392fad===_0x97b3('0x16')&&_0x67921c!==_0x4801c7){_0x215bff=![];}_0x3f8f8b['push']({[_0x4801c7+_0x97b3('0x34')]:_0x215bff});});if(_0x1ab611){_0x3f8f8b[_0x97b3('0x2f')]({'pauseType':_0x1ab611});}}else if(_0x392fad){_0x13ab69['forEach'](function(_0x4ecd42){_0x3f8f8b['push']({[_0x4ecd42+_0x97b3('0x34')]:![]});});}_0x4560ec[_0x97b3('0x35')]=_[_0x97b3('0x36')](_0x4560ec[_0x97b3('0x35')],{'$and':_0x3f8f8b});if(_0x28d165['user'][_0x97b3('0x37')]==='user'){var _0x14f365={'params':{'id':_0x28d165['user'][_0x97b3('0x38')]},'query':{'section':'Agents','role':_0x97b3('0x2c'),'raw':!![],'ids':_0x551cf9,'customSorting':_0x5202f2}};if(_0x28d165[_0x97b3('0x12')][_0x97b3('0x39')]){_0x14f365[_0x97b3('0x12')]['online']=!![];}if(_0x6cc866){_0x14f365['query'][_0x97b3('0x3a')]=_0x3f8f8b;}_0x14f365[_0x97b3('0x12')]=Object['assign'](_0x14f365['query'],_0x28d165[_0x97b3('0x12')]);return db[_0x97b3('0x3b')][_0x97b3('0x3c')](_0x14f365);}return db[_0x97b3('0x3d')][_0x97b3('0x3e')](_0x4560ec);})[_0x97b3('0x18')](function(_0x201c54){_0x401e5c[_0x97b3('0xb')]=_0x201c54['count'];_0x650848=_0x201c54['rows'];return _0x650848[_0x97b3('0x3f')](function(_0x403eba){var _0x754058=_[_0x97b3('0x40')](_0x25d7ff,['id',_0x403eba['id']]);if(_0x754058){var _0x1454da=rta[_0x97b3('0x41')](_0x754058);_[_0x97b3('0x36')](_0x403eba,_0x1454da);}_0x403eba[_0x97b3('0x1f')]=rta['getAgentStatus'](_0x403eba);if(_0x403eba[_0x97b3('0x1f')][_0x97b3('0x1e')](_0x97b3('0x42'))){_0x13ab69['forEach'](function(_0x29a648){if(_0x403eba[_0x29a648+_0x97b3('0x34')]){if(_0x29a648===_0x97b3('0x43')){if(_0x403eba[_0x97b3('0x44')]!==_0x97b3('0x45')){_0x403eba[_0x97b3('0x44')]=_0x97b3('0x42');}}else{_0x403eba[_0x29a648+_0x97b3('0x46')]='pause';}}});}return _0x403eba;});})[_0x97b3('0x18')](function(_0x3e3b25){if(!_0x58faf9||_0x5202f2){return _0x3e3b25;}return rta['sortAgentsByStatus'](_0x3e3b25,_0x58faf9);})['then'](function(_0x5b276a){var _0x444c98=rta[_0x97b3('0x47')]();_0x401e5c[_0x97b3('0x25')]=_0x5b276a[_0x97b3('0x3f')](function(_0x49da3d){return _[_0x97b3('0x48')](_0x49da3d,_0x444c98);});return _0x401e5c;})['then'](respondWithFilteredResult(_0x5ce160,_0x4560ec))['catch'](APIHandleError(_0x5ce160));};exports['getQueues']=function(_0x208442,_0x50ea0b){var _0x42b801={'count':0x0,'rows':[]};var _0xfa300e={};var _0x22577e;var _0x1316cd;var _0x2c290f;Promise[_0x97b3('0x17')]()[_0x97b3('0x18')](function(){if(_0x208442['query'][_0x97b3('0x19')]){if(!utils[_0x97b3('0x1a')](_0x208442['query'][_0x97b3('0x19')])){throw new APIBadRequestError(util[_0x97b3('0x1b')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x208442[_0x97b3('0x12')]['channel']));}_0x22577e=_0x208442[_0x97b3('0x12')][_0x97b3('0x19')][_0x97b3('0x1d')]();}var _0x11f317=_[_0x97b3('0x49')](_0x22577e)+_0x97b3('0x4a');var _0x301f1c=_[_0x97b3('0x3f')](db[_0x11f317][_0x97b3('0x29')],function(_0x1e4a4a){return{'name':_0x1e4a4a['fieldName'],'type':_0x1e4a4a[_0x97b3('0x2a')][_0x97b3('0x2b')]};});if(!_0x208442[_0x97b3('0x12')][_0x97b3('0x22')]){var _0x184a31=['id',_0x97b3('0x4b')];if(_0x22577e===_0x97b3('0x43')){_0x184a31['push'](_0x97b3('0x2a'));if(_0x208442[_0x97b3('0x12')][_0x97b3('0x2a')]===_0x97b3('0x4c')){_0x184a31[_0x97b3('0x2f')]([_0x97b3('0x4d'),_0x97b3('0x4e')]);}}_0x208442[_0x97b3('0x12')]['fields']=_0x184a31['join'](',');}_0xfa300e=qs['getOptions'](_0x301f1c,_0x208442);if(_0x208442[_0x97b3('0x4f')][_0x97b3('0x37')]===_0x97b3('0x4f')){var _0xd8edef={'params':{'id':_0x208442[_0x97b3('0x4f')][_0x97b3('0x38')]},'query':{'section':_0x22577e===_0x97b3('0x43')&&_0x208442[_0x97b3('0x12')][_0x97b3('0x2a')]==='outbound'?_0x97b3('0x50'):_[_0x97b3('0x49')](_0x22577e)+_0x97b3('0x51'),'type':_0x208442[_0x97b3('0x12')][_0x97b3('0x2a')],'nolimit':!![],'sort':_0x97b3('0x4b'),'filter':_0x208442[_0x97b3('0x12')]['filter']}};_0xd8edef['query']=Object[_0x97b3('0x52')](_0xd8edef[_0x97b3('0x12')],_0x208442[_0x97b3('0x12')]);delete _0xd8edef[_0x97b3('0x12')]['id'];return db[_0x97b3('0x3b')][_0x97b3('0x3c')](_0xd8edef);}return db[_0x11f317][_0x97b3('0x3e')](_0xfa300e);})[_0x97b3('0x18')](function(_0x246a14){_0x42b801['count']=_0x246a14[_0x97b3('0xb')];_0x1316cd=_0x246a14[_0x97b3('0x25')];return rtq['getRealtimeQueues'](_0x208442,_0x22577e);})['then'](function(_0x239183){_0x2c290f=_0x239183[_0x97b3('0x25')];return rtq['initializeQueues'](_0x1316cd,_0x2c290f,_0x22577e,_0x208442['query']['type']);})[_0x97b3('0x18')](function(_0x238dae){_0x42b801['rows']=_0x238dae;return _0x42b801;})[_0x97b3('0x18')](respondWithFilteredResult(_0x50ea0b,_0xfa300e))[_0x97b3('0x53')](APIHandleError(_0x50ea0b));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 427e061..27d7428 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x16d985,_0x55dd8e){var _0x2360a1=function(_0x1d262b){while(--_0x1d262b){_0x16d985['push'](_0x16d985['shift']());}};_0x2360a1(++_0x55dd8e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4403e5,_0x32ddae){var _0x512114=function(_0x1f21cb){while(--_0x1f21cb){_0x4403e5['push'](_0x4403e5['shift']());}};_0x512114(++_0x32ddae);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 0731080..042b196 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 _0xb073=['STRING','DATE','INTEGER','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb073,0x187));var _0x3b07=function(_0x499fca,_0x2bcda5){_0x499fca=_0x499fca-0x0;var _0x3382c6=_0xb073[_0x499fca];return _0x3382c6;};'use strict';var Sequelize=require('sequelize');module[_0x3b07('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3b07('0x1')]},'scheduledat':{'type':Sequelize[_0x3b07('0x2')]},'uniqueid':{'type':Sequelize[_0x3b07('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3b07('0x2')]},'ringtime':{'type':Sequelize[_0x3b07('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3b07('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3b07('0x1')]}}; \ No newline at end of file +var _0xbe2a=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x1f1f39,_0x266224){var _0x1ab191=function(_0x486a07){while(--_0x486a07){_0x1f1f39['push'](_0x1f1f39['shift']());}};_0x1ab191(++_0x266224);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x336e83,_0x33193f){_0x336e83=_0x336e83-0x0;var _0x467682=_0xbe2a[_0x336e83];return _0x467682;};'use strict';var Sequelize=require(_0xabe2('0x0'));module[_0xabe2('0x1')]={'state':{'type':Sequelize[_0xabe2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xabe2('0x3')]},'scheduledat':{'type':Sequelize[_0xabe2('0x4')]},'uniqueid':{'type':Sequelize[_0xabe2('0x3')]},'starttime':{'type':Sequelize[_0xabe2('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xabe2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xabe2('0x3')]},'membername':{'type':Sequelize[_0xabe2('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 490f663..bc1ffa9 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 _0xf046=['../../config/environment','exports','define','report_agent_preview','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x18e664,_0x2dad94){var _0x5cc387=function(_0x4061c7){while(--_0x4061c7){_0x18e664['push'](_0x18e664['shift']());}};_0x5cc387(++_0x2dad94);}(_0xf046,0x1ee));var _0x6f04=function(_0x513986,_0x31bc65){_0x513986=_0x513986-0x0;var _0x282e99=_0xf046[_0x513986];return _0x282e99;};'use strict';var _=require(_0x6f04('0x0'));var util=require(_0x6f04('0x1'));var logger=require(_0x6f04('0x2'))('api');var moment=require(_0x6f04('0x3'));var BPromise=require(_0x6f04('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f04('0x5'));var config=require(_0x6f04('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x6f04('0x7')]=function(_0x4ed6cf,_0x306506){return _0x4ed6cf[_0x6f04('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x6f04('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd30a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x51f402,_0x44257e){var _0x44416d=function(_0x5090df){while(--_0x5090df){_0x51f402['push'](_0x51f402['shift']());}};_0x44416d(++_0x44257e);}(_0xd30a,0xcf));var _0xad30=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xd30a[_0x411add];return _0x238242;};'use strict';var _=require(_0xad30('0x0'));var util=require(_0xad30('0x1'));var logger=require(_0xad30('0x2'))('api');var moment=require(_0xad30('0x3'));var BPromise=require(_0xad30('0x4'));var rp=require(_0xad30('0x5'));var fs=require('fs');var path=require(_0xad30('0x6'));var rimraf=require(_0xad30('0x7'));var config=require(_0xad30('0x8'));var attributes=require(_0xad30('0x9'));module[_0xad30('0xa')]=function(_0x20b8d9,_0x4392ce){return _0x20b8d9[_0xad30('0xb')](_0xad30('0xc'),attributes,{'tableName':_0xad30('0xd'),'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 d0848b5..c4cabd9 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 _0xe864=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','ReportAgentPreview,\x20%s,\x20%s','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0xe864,0x88));var _0x4e86=function(_0x559d48,_0x405119){_0x559d48=_0x559d48-0x0;var _0x482681=_0xe864[_0x559d48];return _0x482681;};'use strict';var _=require(_0x4e86('0x0'));var util=require(_0x4e86('0x1'));var moment=require('moment');var BPromise=require(_0x4e86('0x2'));var rs=require(_0x4e86('0x3'));var fs=require('fs');var Redis=require(_0x4e86('0x4'));var db=require(_0x4e86('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4e86('0x6'));var config=require('../../config/environment');var jayson=require(_0x4e86('0x7'));var client=jayson['client'][_0x4e86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59b3a8,_0x20ab7a,_0x2f062b){return new BPromise(function(_0x2d64ee,_0x2eaf3a){return client[_0x4e86('0x9')](_0x59b3a8,_0x2f062b)[_0x4e86('0xa')](function(_0x83f1d3){logger[_0x4e86('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x20ab7a,_0x4e86('0xc'));logger[_0x4e86('0xd')](_0x4e86('0xe'),_0x20ab7a,_0x4e86('0xc'),JSON[_0x4e86('0xf')](_0x83f1d3));if(_0x83f1d3[_0x4e86('0x10')]){if(_0x83f1d3[_0x4e86('0x10')]['code']===0x1f4){logger[_0x4e86('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x20ab7a,_0x83f1d3['error'][_0x4e86('0x11')]);return _0x2eaf3a(_0x83f1d3[_0x4e86('0x10')]['message']);}logger[_0x4e86('0x10')](_0x4e86('0x12'),_0x20ab7a,_0x83f1d3[_0x4e86('0x10')][_0x4e86('0x11')]);return _0x2d64ee(_0x83f1d3[_0x4e86('0x10')][_0x4e86('0x11')]);}else{logger[_0x4e86('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x20ab7a,_0x4e86('0xc'));_0x2d64ee(_0x83f1d3[_0x4e86('0x13')][_0x4e86('0x11')]);}})['catch'](function(_0x517e7d){logger[_0x4e86('0x10')](_0x4e86('0x12'),_0x20ab7a,_0x517e7d);_0x2eaf3a(_0x517e7d);});});}exports[_0x4e86('0x14')]=function(_0x396c7c){var _0x55aaa6=this;return new Promise(function(_0x1b2fe8,_0x511d60){return db[_0x4e86('0x15')][_0x4e86('0x16')](_0x396c7c[_0x4e86('0x17')],{'raw':_0x396c7c[_0x4e86('0x18')]?_0x396c7c['options']['raw']===undefined?!![]:![]:!![]})[_0x4e86('0xa')](function(_0x596f34){logger[_0x4e86('0xb')](_0x4e86('0x14'),_0x396c7c);logger[_0x4e86('0xd')]('CreateReportAgentPreview',_0x396c7c,JSON[_0x4e86('0xf')](_0x596f34));_0x1b2fe8(_0x596f34);})['catch'](function(_0x54677c){logger[_0x4e86('0x10')](_0x4e86('0x14'),_0x54677c[_0x4e86('0x11')],_0x396c7c);_0x511d60(_0x55aaa6[_0x4e86('0x10')](0x1f4,_0x54677c[_0x4e86('0x11')]));});});}; \ No newline at end of file +var _0x4e60=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x177bb5,_0x56d646){var _0x226f25=function(_0x5d3610){while(--_0x5d3610){_0x177bb5['push'](_0x177bb5['shift']());}};_0x226f25(++_0x56d646);}(_0x4e60,0x150));var _0x04e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4e60[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x04e6('0x0'));var util=require(_0x04e6('0x1'));var moment=require(_0x04e6('0x2'));var BPromise=require(_0x04e6('0x3'));var rs=require(_0x04e6('0x4'));var fs=require('fs');var Redis=require(_0x04e6('0x5'));var db=require(_0x04e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x04e6('0x7'))('rpc');var config=require(_0x04e6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x04e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc39baf,_0x18784c,_0x3e64b5){return new BPromise(function(_0x1e0afd,_0xcd8649){return client[_0x04e6('0xa')](_0xc39baf,_0x3e64b5)['then'](function(_0x54cfda){logger[_0x04e6('0xb')](_0x04e6('0xc'),_0x18784c,_0x04e6('0xd'));logger[_0x04e6('0xe')](_0x04e6('0xf'),_0x18784c,_0x04e6('0xd'),JSON[_0x04e6('0x10')](_0x54cfda));if(_0x54cfda[_0x04e6('0x11')]){if(_0x54cfda[_0x04e6('0x11')][_0x04e6('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x18784c,_0x54cfda['error'][_0x04e6('0x13')]);return _0xcd8649(_0x54cfda['error'][_0x04e6('0x13')]);}logger[_0x04e6('0x11')](_0x04e6('0xc'),_0x18784c,_0x54cfda[_0x04e6('0x11')]['message']);return _0x1e0afd(_0x54cfda['error'][_0x04e6('0x13')]);}else{logger[_0x04e6('0xb')](_0x04e6('0xc'),_0x18784c,_0x04e6('0xd'));_0x1e0afd(_0x54cfda[_0x04e6('0x14')][_0x04e6('0x13')]);}})[_0x04e6('0x15')](function(_0xfb95db){logger[_0x04e6('0x11')](_0x04e6('0xc'),_0x18784c,_0xfb95db);_0xcd8649(_0xfb95db);});});}exports[_0x04e6('0x16')]=function(_0x40608d){var _0x3c4035=this;return new Promise(function(_0x42cf41,_0xaad445){return db[_0x04e6('0x17')]['create'](_0x40608d[_0x04e6('0x18')],{'raw':_0x40608d['options']?_0x40608d['options'][_0x04e6('0x19')]===undefined?!![]:![]:!![]})[_0x04e6('0x1a')](function(_0x4419fa){logger['info'](_0x04e6('0x16'),_0x40608d);logger['debug'](_0x04e6('0x16'),_0x40608d,JSON['stringify'](_0x4419fa));_0x42cf41(_0x4419fa);})['catch'](function(_0x235668){logger[_0x04e6('0x11')]('CreateReportAgentPreview',_0x235668['message'],_0x40608d);_0xaad445(_0x3c4035[_0x04e6('0x11')](0x1f4,_0x235668['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index bd39b05..4c9688b 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 _0x0490=['voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agentCapacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup'];(function(_0x4b91fb,_0xe92b69){var _0x5eca8e=function(_0x3c859f){while(--_0x3c859f){_0x4b91fb['push'](_0x4b91fb['shift']());}};_0x5eca8e(++_0xe92b69);}(_0x0490,0x123));var _0x0049=function(_0x4e12ff,_0x595b9b){_0x4e12ff=_0x4e12ff-0x0;var _0x557b8a=_0x0490[_0x4e12ff];return _0x557b8a;};'use strict';var multer=require(_0x0049('0x0'));var util=require(_0x0049('0x1'));var path=require(_0x0049('0x2'));var express=require(_0x0049('0x3'));var router=express[_0x0049('0x4')]();var auth=require(_0x0049('0x5'));var controller=require(_0x0049('0x6'));router[_0x0049('0x7')](_0x0049('0x8'),auth[_0x0049('0x9')](),controller[_0x0049('0xa')]);router[_0x0049('0x7')](_0x0049('0xb'),auth[_0x0049('0x9')](),controller[_0x0049('0xc')]);router[_0x0049('0x7')](_0x0049('0xd'),auth[_0x0049('0x9')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x0049('0xe'),auth[_0x0049('0x9')](),controller[_0x0049('0xf')]);router[_0x0049('0x7')](_0x0049('0x10'),auth['isAuthenticated'](),controller[_0x0049('0x11')]);router[_0x0049('0x7')]('/mail/queues',auth[_0x0049('0x9')](),controller[_0x0049('0x12')]);router[_0x0049('0x7')]('/mail/accounts',auth[_0x0049('0x9')](),controller[_0x0049('0x13')]);router['get'](_0x0049('0x14'),auth[_0x0049('0x9')](),controller[_0x0049('0x15')]);router[_0x0049('0x7')](_0x0049('0x16'),auth[_0x0049('0x9')](),controller[_0x0049('0x17')]);router[_0x0049('0x7')](_0x0049('0x18'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get'](_0x0049('0x19'),auth[_0x0049('0x9')](),controller[_0x0049('0x1a')]);router[_0x0049('0x7')](_0x0049('0x1b'),auth[_0x0049('0x9')](),controller[_0x0049('0x1c')]);router[_0x0049('0x7')]('/voice/queues/channels',auth[_0x0049('0x9')](),controller[_0x0049('0x1d')]);router[_0x0049('0x7')](_0x0049('0x1e'),auth['isAuthenticated'](),controller[_0x0049('0x1f')]);router[_0x0049('0x7')](_0x0049('0x20'),auth[_0x0049('0x9')](),controller[_0x0049('0x21')]);router[_0x0049('0x7')](_0x0049('0x22'),auth[_0x0049('0x9')](),controller[_0x0049('0x23')]);router[_0x0049('0x7')](_0x0049('0x24'),auth[_0x0049('0x9')](),controller['showVoiceQueues']);router[_0x0049('0x25')]('/voice/queues/:id',auth[_0x0049('0x9')](),controller[_0x0049('0x26')]);router[_0x0049('0x7')]('/outbound',auth['isAuthenticated'](),controller[_0x0049('0x27')]);router[_0x0049('0x7')](_0x0049('0x28'),auth[_0x0049('0x9')](),controller[_0x0049('0x29')]);router[_0x0049('0x7')](_0x0049('0x2a'),auth[_0x0049('0x9')](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x0049('0x9')](),controller[_0x0049('0x2b')]);router['get'](_0x0049('0x2c'),auth['isAuthenticated'](),controller['telephones']);router['get']('/trunks',auth['isAuthenticated'](),controller[_0x0049('0x2d')]);router[_0x0049('0x7')](_0x0049('0x2e'),auth[_0x0049('0x9')](),controller[_0x0049('0x2f')]);router[_0x0049('0x7')](_0x0049('0x30'),auth[_0x0049('0x9')](),controller['faxAccounts']);router[_0x0049('0x7')](_0x0049('0x31'),auth[_0x0049('0x9')](),controller[_0x0049('0x32')]);router[_0x0049('0x7')](_0x0049('0x33'),auth[_0x0049('0x9')](),controller[_0x0049('0x34')]);router['get'](_0x0049('0x35'),auth[_0x0049('0x9')](),controller[_0x0049('0x36')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x0049('0x9')](),controller[_0x0049('0x37')]);router[_0x0049('0x7')](_0x0049('0x38'),auth[_0x0049('0x9')](),controller[_0x0049('0x39')]);router[_0x0049('0x7')](_0x0049('0x3a'),auth[_0x0049('0x9')](),controller[_0x0049('0x3b')]);router[_0x0049('0x7')](_0x0049('0x3c'),auth[_0x0049('0x9')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x0049('0x3d'),auth['isAuthenticated'](),controller[_0x0049('0x3e')](_0x0049('0x3f')));router[_0x0049('0x7')](_0x0049('0x40'),auth[_0x0049('0x9')](),controller['showMailQueues']);router[_0x0049('0x41')]('/chat/queues/:id/notify',auth[_0x0049('0x9')](),controller[_0x0049('0x3e')]('chat'));router['get'](_0x0049('0x42'),auth[_0x0049('0x9')](),controller['showChatQueues']);router[_0x0049('0x41')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0049('0x3e')](_0x0049('0x43')));router[_0x0049('0x7')](_0x0049('0x44'),auth['isAuthenticated'](),controller[_0x0049('0x45')]);router[_0x0049('0x41')](_0x0049('0x46'),auth[_0x0049('0x9')](),controller[_0x0049('0x3e')]('openchannel'));router[_0x0049('0x7')](_0x0049('0x47'),auth[_0x0049('0x9')](),controller[_0x0049('0x48')]);router[_0x0049('0x41')]('/sms/queues/:id/notify',auth[_0x0049('0x9')](),controller['queueNotify']('sms'));router['post'](_0x0049('0x49'),auth[_0x0049('0x9')](),controller[_0x0049('0x3e')](_0x0049('0x4a')));router[_0x0049('0x7')](_0x0049('0x4b'),auth[_0x0049('0x9')](),controller[_0x0049('0x4c')]);router['get'](_0x0049('0x4d'),auth[_0x0049('0x9')](),controller['showWhatsappQueues']);router['post'](_0x0049('0x4e'),auth[_0x0049('0x9')](),controller[_0x0049('0x4f')]);module[_0x0049('0x50')]=router; \ No newline at end of file +var _0xb651=['voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','openchannelQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xb651,0xc5));var _0x1b65=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xb651[_0x29d94e];return _0x106237;};'use strict';var multer=require('multer');var util=require(_0x1b65('0x0'));var path=require(_0x1b65('0x1'));var express=require('express');var router=express[_0x1b65('0x2')]();var auth=require(_0x1b65('0x3'));var controller=require(_0x1b65('0x4'));router[_0x1b65('0x5')]('/voice/channels',auth[_0x1b65('0x6')](),controller[_0x1b65('0x7')]);router[_0x1b65('0x5')](_0x1b65('0x8'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x9')]);router[_0x1b65('0x5')](_0x1b65('0xa'),auth[_0x1b65('0x6')](),controller[_0x1b65('0xb')]);router[_0x1b65('0x5')](_0x1b65('0xc'),auth[_0x1b65('0x6')](),controller[_0x1b65('0xd')]);router['get'](_0x1b65('0xe'),auth['isAuthenticated'](),controller[_0x1b65('0xf')]);router[_0x1b65('0x5')]('/mail/queues',auth[_0x1b65('0x6')](),controller['mailQueues']);router[_0x1b65('0x5')](_0x1b65('0x10'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x11')]);router[_0x1b65('0x5')]('/openchannel/queues',auth[_0x1b65('0x6')](),controller[_0x1b65('0x12')]);router['get']('/sms/queues',auth[_0x1b65('0x6')](),controller['smsQueues']);router['get']('/whatsapp/queues',auth[_0x1b65('0x6')](),controller['whatsappQueues']);router[_0x1b65('0x5')](_0x1b65('0x13'),auth['isAuthenticated'](),controller[_0x1b65('0x14')]);router['get'](_0x1b65('0x15'),auth['isAuthenticated'](),controller[_0x1b65('0x16')]);router[_0x1b65('0x5')](_0x1b65('0x17'),auth[_0x1b65('0x6')](),controller['voiceQueuesChannels']);router[_0x1b65('0x5')](_0x1b65('0x18'),auth['isAuthenticated'](),controller[_0x1b65('0x19')]);router[_0x1b65('0x5')](_0x1b65('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router['get'](_0x1b65('0x1b'),auth[_0x1b65('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x1b65('0x5')](_0x1b65('0x1c'),auth[_0x1b65('0x6')](),controller['showVoiceQueues']);router[_0x1b65('0x1d')](_0x1b65('0x1c'),auth['isAuthenticated'](),controller[_0x1b65('0x1e')]);router[_0x1b65('0x5')]('/outbound',auth['isAuthenticated'](),controller['outbound']);router['get'](_0x1b65('0x1f'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x1b65('0x5')](_0x1b65('0x20'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x21')]);router[_0x1b65('0x1d')](_0x1b65('0x22'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x23')]);router[_0x1b65('0x5')](_0x1b65('0x24'),auth['isAuthenticated'](),controller[_0x1b65('0x25')]);router['get'](_0x1b65('0x26'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x27')]);router[_0x1b65('0x5')](_0x1b65('0x28'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x29')]);router[_0x1b65('0x5')](_0x1b65('0x2a'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x2b')]);router[_0x1b65('0x5')](_0x1b65('0x2c'),auth[_0x1b65('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x1b65('0x5')]('/mail/queues/waitinginteractions',auth[_0x1b65('0x6')](),controller[_0x1b65('0x2d')]);router[_0x1b65('0x5')](_0x1b65('0x2e'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x2f')]);router[_0x1b65('0x5')](_0x1b65('0x30'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x31')]);router[_0x1b65('0x5')](_0x1b65('0x32'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x1b65('0x5')](_0x1b65('0x33'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x34')]);router[_0x1b65('0x5')](_0x1b65('0x35'),auth[_0x1b65('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x1b65('0x36')]('/mail/queues/:id/notify',auth[_0x1b65('0x6')](),controller[_0x1b65('0x37')](_0x1b65('0x38')));router[_0x1b65('0x5')]('/mail/queues/:id',auth[_0x1b65('0x6')](),controller['showMailQueues']);router[_0x1b65('0x36')]('/chat/queues/:id/notify',auth[_0x1b65('0x6')](),controller['queueNotify']('chat'));router['get'](_0x1b65('0x39'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x3a')]);router[_0x1b65('0x36')](_0x1b65('0x3b'),auth['isAuthenticated'](),controller[_0x1b65('0x37')]('fax'));router[_0x1b65('0x5')](_0x1b65('0x3c'),auth[_0x1b65('0x6')](),controller['showFaxQueues']);router['post'](_0x1b65('0x3d'),auth['isAuthenticated'](),controller['queueNotify'](_0x1b65('0x3e')));router[_0x1b65('0x5')](_0x1b65('0x3f'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x40')]);router[_0x1b65('0x36')]('/sms/queues/:id/notify',auth[_0x1b65('0x6')](),controller[_0x1b65('0x37')]('sms'));router[_0x1b65('0x36')](_0x1b65('0x41'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x37')](_0x1b65('0x42')));router[_0x1b65('0x5')](_0x1b65('0x43'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x44')]);router[_0x1b65('0x5')](_0x1b65('0x45'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x46')]);router[_0x1b65('0x36')](_0x1b65('0x47'),auth[_0x1b65('0x6')](),controller[_0x1b65('0x48')]);module[_0x1b65('0x49')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 70e9b51..fcdf53b 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(_0xbc8556,_0x5a1520){var _0x5e7189=function(_0x4fbdb3){while(--_0x4fbdb3){_0xbc8556['push'](_0xbc8556['shift']());}};_0x5e7189(++_0x5a1520);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x56de86,_0x4b3562){var _0x9e29fa=function(_0x27d840){while(--_0x27d840){_0x56de86['push'](_0x56de86['shift']());}};_0x9e29fa(++_0x4b3562);}(_0xe706,0xa3));var _0x6e70=function(_0x1e8461,_0x5e1500){_0x1e8461=_0x1e8461-0x0;var _0x528f4d=_0xe706[_0x1e8461];return _0x528f4d;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 6633cbb..9a2a03f 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 _0xcbb7=['isAuthenticated','index','/:id','show','/:id/run','run','post','create','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcbb7,0x172));var _0x7cbb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcbb7[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x7cbb('0x0'));var util=require(_0x7cbb('0x1'));var path=require(_0x7cbb('0x2'));var timeout=require(_0x7cbb('0x3'));var express=require(_0x7cbb('0x4'));var router=express[_0x7cbb('0x5')]();var fs_extra=require(_0x7cbb('0x6'));var auth=require(_0x7cbb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7cbb('0x8'));var controller=require('./schedule.controller');router[_0x7cbb('0x9')]('/',auth[_0x7cbb('0xa')](),controller[_0x7cbb('0xb')]);router[_0x7cbb('0x9')](_0x7cbb('0xc'),auth[_0x7cbb('0xa')](),controller[_0x7cbb('0xd')]);router[_0x7cbb('0x9')](_0x7cbb('0xe'),auth[_0x7cbb('0xa')](),controller[_0x7cbb('0xf')]);router[_0x7cbb('0x10')]('/',auth[_0x7cbb('0xa')](),controller[_0x7cbb('0x11')]);router['put'](_0x7cbb('0xc'),auth[_0x7cbb('0xa')](),controller[_0x7cbb('0x12')]);router['delete'](_0x7cbb('0xc'),auth[_0x7cbb('0xa')](),controller['destroy']);module[_0x7cbb('0x13')]=router; \ No newline at end of file +var _0x3fd1=['run','post','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/run'];(function(_0x2b4144,_0x54fb24){var _0x50a5c0=function(_0x17c42c){while(--_0x17c42c){_0x2b4144['push'](_0x2b4144['shift']());}};_0x50a5c0(++_0x54fb24);}(_0x3fd1,0x15b));var _0x13fd=function(_0x516701,_0x1cfb3a){_0x516701=_0x516701-0x0;var _0x47b913=_0x3fd1[_0x516701];return _0x47b913;};'use strict';var multer=require(_0x13fd('0x0'));var util=require(_0x13fd('0x1'));var path=require(_0x13fd('0x2'));var timeout=require(_0x13fd('0x3'));var express=require(_0x13fd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x13fd('0x5'));var interaction=require(_0x13fd('0x6'));var config=require(_0x13fd('0x7'));var controller=require('./schedule.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x13fd('0x8')]);router[_0x13fd('0x9')](_0x13fd('0xa'),auth[_0x13fd('0xb')](),controller['show']);router[_0x13fd('0x9')](_0x13fd('0xc'),auth['isAuthenticated'](),controller[_0x13fd('0xd')]);router[_0x13fd('0xe')]('/',auth['isAuthenticated'](),controller[_0x13fd('0xf')]);router['put'](_0x13fd('0xa'),auth[_0x13fd('0xb')](),controller['update']);router[_0x13fd('0x10')](_0x13fd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x13fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 903c879..ccd206a 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 _0x5323=['quarters','weeks','days','hours','minutes','ENUM','csv','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','years'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x5323,0xe8));var _0x3532=function(_0x27bc21,_0xd30617){_0x27bc21=_0x27bc21-0x0;var _0x139be0=_0x5323[_0x27bc21];return _0x139be0;};'use strict';var Sequelize=require(_0x3532('0x0'));module[_0x3532('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3532('0x2')]},'active':{'type':Sequelize[_0x3532('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3532('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x3532('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x3532('0x5'),_0x3532('0x6'),'months',_0x3532('0x7'),_0x3532('0x8'),_0x3532('0x9'),_0x3532('0xa')),'allowNull':![],'defaultValue':_0x3532('0x8')},'output':{'type':Sequelize[_0x3532('0xb')](_0x3532('0xc'),'pdf',_0x3532('0xd')),'allowNull':![],'defaultValue':_0x3532('0xc')},'type':{'type':Sequelize[_0x3532('0xb')](_0x3532('0xe'),_0x3532('0xf')),'allowNull':![],'defaultValue':_0x3532('0xe')},'sendMail':{'type':Sequelize[_0x3532('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3532('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x3532('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x94ed=['years','quarters','months','weeks','days','hours','xlsx','csv','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x5dc7de,_0x2f02cc){var _0x1c004f=function(_0x359de3){while(--_0x359de3){_0x5dc7de['push'](_0x5dc7de['shift']());}};_0x1c004f(++_0x2f02cc);}(_0x94ed,0x1e7));var _0xd94e=function(_0x1866ea,_0x547489){_0x1866ea=_0x1866ea-0x0;var _0x34f90a=_0x94ed[_0x1866ea];return _0x34f90a;};'use strict';var Sequelize=require(_0xd94e('0x0'));module[_0xd94e('0x1')]={'name':{'type':Sequelize[_0xd94e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd94e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd94e('0x3')},'startAt':{'type':Sequelize[_0xd94e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd94e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd94e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd94e('0x6')](_0xd94e('0x7'),_0xd94e('0x8'),_0xd94e('0x9'),_0xd94e('0xa'),_0xd94e('0xb'),_0xd94e('0xc'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xd94e('0x6')]('csv','pdf',_0xd94e('0xd')),'allowNull':![],'defaultValue':_0xd94e('0xe')},'type':{'type':Sequelize[_0xd94e('0x6')](_0xd94e('0xf'),_0xd94e('0x10')),'allowNull':![],'defaultValue':_0xd94e('0xf')},'sendMail':{'type':Sequelize[_0xd94e('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xd94e('0x2')]},'cc':{'type':Sequelize[_0xd94e('0x12')]},'bcc':{'type':Sequelize[_0xd94e('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd94e('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8547439..3a7da3a 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 _0x4f86=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Scheduler','destroy','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x48aaca,_0x140945){var _0xac5ed9=function(_0x180b19){while(--_0x180b19){_0x48aaca['push'](_0x48aaca['shift']());}};_0xac5ed9(++_0x140945);}(_0x4f86,0x95));var _0x64f8=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4f86[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x64f8('0x0'));var rimraf=require(_0x64f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64f8('0x2'));var rp=require(_0x64f8('0x3'));var moment=require(_0x64f8('0x4'));var BPromise=require(_0x64f8('0x5'));var Mustache=require('mustache');var util=require(_0x64f8('0x6'));var path=require('path');var sox=require(_0x64f8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64f8('0x8'));var squel=require(_0x64f8('0x9'));var crypto=require(_0x64f8('0xa'));var jsforce=require(_0x64f8('0xb'));var deskjs=require(_0x64f8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x64f8('0xd'));var Papa=require(_0x64f8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x64f8('0xf'));var hardwareService=require(_0x64f8('0x10'));var logger=require('../../config/logger')(_0x64f8('0x11'));var utils=require(_0x64f8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x64f8('0x13'));var db=require(_0x64f8('0x14'))['db'];function respondWithStatusCode(_0x2b1329,_0xa418c1){_0xa418c1=_0xa418c1||0xcc;return function(_0x5178ad){if(_0x5178ad){return _0x2b1329[_0x64f8('0x15')](_0xa418c1);}return _0x2b1329[_0x64f8('0x16')](_0xa418c1)[_0x64f8('0x17')]();};}function respondWithResult(_0x41009d,_0x4f9ed1){_0x4f9ed1=_0x4f9ed1||0xc8;return function(_0x3d04a5){if(_0x3d04a5){return _0x41009d['status'](_0x4f9ed1)[_0x64f8('0x18')](_0x3d04a5);}};}function respondWithFilteredResult(_0x8e0f70,_0x473347){return function(_0x541f80){if(_0x541f80){var _0x35aaea=typeof _0x473347[_0x64f8('0x19')]===_0x64f8('0x1a')&&typeof _0x473347[_0x64f8('0x1b')]===_0x64f8('0x1a');var _0x3144e4=_0x541f80[_0x64f8('0x1c')];var _0x15e9b2=_0x35aaea?0x0:_0x473347['offset'];var _0x47a85a=_0x35aaea?_0x541f80[_0x64f8('0x1c')]:_0x473347[_0x64f8('0x19')]+_0x473347['limit'];var _0x21a4e0;if(_0x47a85a>=_0x3144e4){_0x47a85a=_0x3144e4;_0x21a4e0=0xc8;}else{_0x21a4e0=0xce;}_0x8e0f70[_0x64f8('0x16')](_0x21a4e0);return _0x8e0f70[_0x64f8('0x1d')](_0x64f8('0x1e'),_0x15e9b2+'-'+_0x47a85a+'/'+_0x3144e4)[_0x64f8('0x18')](_0x541f80);}return null;};}function patchUpdates(_0x5f2779){return function(_0x213677){try{jsonpatch[_0x64f8('0x1f')](_0x213677,_0x5f2779,!![]);}catch(_0x571cb8){return BPromise[_0x64f8('0x20')](_0x571cb8);}return _0x213677['save']();};}function saveUpdates(_0x4c0220,_0x5e557f){return function(_0x4e8ff5){if(_0x4e8ff5){return _0x4e8ff5[_0x64f8('0x21')](_0x4c0220)[_0x64f8('0x22')](function(_0x3d41da){return _0x3d41da;});}return null;};}function removeEntity(_0x50a9b8,_0x3bfdd6){return function(_0x208eb5){if(_0x208eb5){return _0x208eb5['destroy']()[_0x64f8('0x22')](function(){var _0x32be23=_0x208eb5[_0x64f8('0x23')]({'plain':!![]});var _0x198f5c=_0x64f8('0x24');return db['UserProfileResource'][_0x64f8('0x25')]({'where':{'type':_0x198f5c,'resourceId':_0x32be23['id']}})[_0x64f8('0x22')](function(){return _0x208eb5;});})['then'](function(){_0x50a9b8[_0x64f8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32b1dd,_0x179ecb){return function(_0x3e105b){if(!_0x3e105b){_0x32b1dd[_0x64f8('0x15')](0x194);}return _0x3e105b;};}function handleError(_0x5b2c02,_0x1c0b1b){_0x1c0b1b=_0x1c0b1b||0x1f4;return function(_0x36fc31){logger[_0x64f8('0x26')](_0x36fc31[_0x64f8('0x27')]);if(_0x36fc31[_0x64f8('0x28')]){delete _0x36fc31[_0x64f8('0x28')];}_0x5b2c02[_0x64f8('0x16')](_0x1c0b1b)[_0x64f8('0x29')](_0x36fc31);};}exports[_0x64f8('0x2a')]=function(_0x3ea117,_0x114b3b){var _0x52815d={},_0x3a588b={},_0x351ff9={'count':0x0,'rows':[]};var _0x3f5c03=_['map'](db[_0x64f8('0x2b')][_0x64f8('0x2c')],function(_0x4f1ace){return{'name':_0x4f1ace[_0x64f8('0x2d')],'type':_0x4f1ace[_0x64f8('0x2e')][_0x64f8('0x2f')]};});_0x3a588b[_0x64f8('0x30')]=_[_0x64f8('0x31')](_0x3f5c03,'name');_0x3a588b[_0x64f8('0x32')]=_[_0x64f8('0x33')](_0x3ea117[_0x64f8('0x32')]);_0x3a588b['filters']=_[_0x64f8('0x34')](_0x3a588b[_0x64f8('0x30')],_0x3a588b['query']);_0x52815d[_0x64f8('0x35')]=_[_0x64f8('0x34')](_0x3a588b['model'],qs[_0x64f8('0x36')](_0x3ea117[_0x64f8('0x32')][_0x64f8('0x36')]));_0x52815d[_0x64f8('0x35')]=_0x52815d[_0x64f8('0x35')][_0x64f8('0x37')]?_0x52815d[_0x64f8('0x35')]:_0x3a588b[_0x64f8('0x30')];if(!_0x3ea117[_0x64f8('0x32')]['hasOwnProperty']('nolimit')){_0x52815d[_0x64f8('0x1b')]=qs['limit'](_0x3ea117[_0x64f8('0x32')][_0x64f8('0x1b')]);_0x52815d[_0x64f8('0x19')]=qs['offset'](_0x3ea117[_0x64f8('0x32')][_0x64f8('0x19')]);}_0x52815d[_0x64f8('0x38')]=qs[_0x64f8('0x39')](_0x3ea117['query'][_0x64f8('0x39')]);_0x52815d[_0x64f8('0x3a')]=qs[_0x64f8('0x3b')](_['pick'](_0x3ea117['query'],_0x3a588b['filters']),_0x3f5c03);if(_0x3ea117[_0x64f8('0x32')]['filter']){_0x52815d[_0x64f8('0x3a')]=_[_0x64f8('0x3c')](_0x52815d['where'],{'$or':_[_0x64f8('0x31')](_0x3f5c03,function(_0x4b1608){if(_0x4b1608[_0x64f8('0x2e')]!==_0x64f8('0x3d')){var _0x1d0a1f={};_0x1d0a1f[_0x4b1608[_0x64f8('0x28')]]={'$like':'%'+_0x3ea117[_0x64f8('0x32')][_0x64f8('0x3e')]+'%'};return _0x1d0a1f;}})});}_0x52815d=_[_0x64f8('0x3c')]({},_0x52815d,_0x3ea117[_0x64f8('0x3f')]);var _0x24a0e5={'where':_0x52815d[_0x64f8('0x3a')]};return db['Schedule']['count'](_0x24a0e5)['then'](function(_0x483c14){_0x351ff9['count']=_0x483c14;if(_0x3ea117[_0x64f8('0x32')][_0x64f8('0x40')]){_0x52815d[_0x64f8('0x41')]=[{'all':!![]}];}return db[_0x64f8('0x2b')][_0x64f8('0x42')](_0x52815d);})[_0x64f8('0x22')](function(_0x2ab67c){_0x351ff9[_0x64f8('0x43')]=_0x2ab67c;return _0x351ff9;})[_0x64f8('0x22')](respondWithFilteredResult(_0x114b3b,_0x52815d))[_0x64f8('0x44')](handleError(_0x114b3b,null));};exports[_0x64f8('0x45')]=function(_0xadb6e2,_0x5de6ed){var _0x17ef77={'raw':![],'where':{'id':_0xadb6e2[_0x64f8('0x46')]['id']}},_0x171fa2={};_0x171fa2[_0x64f8('0x30')]=_['keys'](db['Schedule'][_0x64f8('0x2c')]);_0x171fa2['query']=_['keys'](_0xadb6e2[_0x64f8('0x32')]);_0x171fa2[_0x64f8('0x3b')]=_[_0x64f8('0x34')](_0x171fa2['model'],_0x171fa2['query']);_0x17ef77[_0x64f8('0x35')]=_[_0x64f8('0x34')](_0x171fa2['model'],qs[_0x64f8('0x36')](_0xadb6e2['query']['fields']));_0x17ef77[_0x64f8('0x35')]=_0x17ef77['attributes'][_0x64f8('0x37')]?_0x17ef77['attributes']:_0x171fa2['model'];if(_0xadb6e2[_0x64f8('0x32')][_0x64f8('0x40')]){_0x17ef77[_0x64f8('0x41')]=[{'all':!![]}];}_0x17ef77=_['merge']({},_0x17ef77,_0xadb6e2[_0x64f8('0x3f')]);return db[_0x64f8('0x2b')][_0x64f8('0x47')](_0x17ef77)['then'](handleEntityNotFound(_0x5de6ed,null))['then'](respondWithResult(_0x5de6ed,null))[_0x64f8('0x44')](handleError(_0x5de6ed,null));};exports['create']=function(_0x7c704c,_0x3d1ad5){return db[_0x64f8('0x2b')][_0x64f8('0x48')](_0x7c704c[_0x64f8('0x49')],{})[_0x64f8('0x22')](function(_0x48cbbe){var _0x3114ad=_0x7c704c[_0x64f8('0x4a')]['get']({'plain':!![]});if(!_0x3114ad)throw new Error(_0x64f8('0x4b'));if(_0x3114ad[_0x64f8('0x4c')]==='user'){var _0x4889af=_0x48cbbe[_0x64f8('0x23')]({'plain':!![]});var _0x4266f6=_0x64f8('0x24');return db[_0x64f8('0x4d')]['find']({'where':{'name':_0x4266f6,'userProfileId':_0x3114ad['userProfileId']},'raw':!![]})[_0x64f8('0x22')](function(_0x1e4f19){if(_0x1e4f19&&_0x1e4f19['autoAssociation']===0x0){return db[_0x64f8('0x4e')][_0x64f8('0x48')]({'name':_0x4889af[_0x64f8('0x28')],'resourceId':_0x4889af['id'],'type':_0x1e4f19[_0x64f8('0x28')],'sectionId':_0x1e4f19['id']},{})['then'](function(){return _0x48cbbe;});}else{return _0x48cbbe;}})['catch'](function(_0xd14edd){logger[_0x64f8('0x26')](_0x64f8('0x4f'),_0xd14edd);throw _0xd14edd;});}return _0x48cbbe;})[_0x64f8('0x22')](respondWithResult(_0x3d1ad5,0xc9))['catch'](handleError(_0x3d1ad5,null));};exports[_0x64f8('0x21')]=function(_0x2ebabe,_0x2af154){if(_0x2ebabe[_0x64f8('0x49')]['id']){delete _0x2ebabe['body']['id'];}return db[_0x64f8('0x2b')][_0x64f8('0x47')]({'where':{'id':_0x2ebabe[_0x64f8('0x46')]['id']}})[_0x64f8('0x22')](handleEntityNotFound(_0x2af154,null))[_0x64f8('0x22')](saveUpdates(_0x2ebabe[_0x64f8('0x49')],null))[_0x64f8('0x22')](respondWithResult(_0x2af154,null))[_0x64f8('0x44')](handleError(_0x2af154,null));};exports['destroy']=function(_0x58f7de,_0x33fad7){return db['Schedule'][_0x64f8('0x47')]({'where':{'id':_0x58f7de['params']['id']}})[_0x64f8('0x22')](handleEntityNotFound(_0x33fad7,null))[_0x64f8('0x22')](removeEntity(_0x33fad7,null))['catch'](handleError(_0x33fad7,null));};exports['run']=function(_0x229864,_0x24639c,_0x359e6a){var _0x454a76=require(_0x64f8('0x50'));return db['Schedule'][_0x64f8('0x47')]({'where':{'id':_0x229864[_0x64f8('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x24639c,null))['then'](function(){_0x454a76[_0x64f8('0x51')](_0x229864['params']['id']);})[_0x64f8('0x22')](respondWithStatusCode(_0x24639c,null))[_0x64f8('0x44')](handleError(_0x24639c,null));}; \ No newline at end of file +var _0xfc3b=['json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','end','error','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','eml-format','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/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x396cd6,_0x329a86){var _0x3b769b=function(_0x1c2acc){while(--_0x1c2acc){_0x396cd6['push'](_0x396cd6['shift']());}};_0x3b769b(++_0x329a86);}(_0xfc3b,0x1a5));var _0xbfc3=function(_0x3a02c6,_0x595ec6){_0x3a02c6=_0x3a02c6-0x0;var _0x3f7ded=_0xfc3b[_0x3a02c6];return _0x3f7ded;};'use strict';var emlformat=require(_0xbfc3('0x0'));var rimraf=require(_0xbfc3('0x1'));var zipdir=require(_0xbfc3('0x2'));var jsonpatch=require(_0xbfc3('0x3'));var rp=require(_0xbfc3('0x4'));var moment=require(_0xbfc3('0x5'));var BPromise=require(_0xbfc3('0x6'));var Mustache=require(_0xbfc3('0x7'));var util=require('util');var path=require(_0xbfc3('0x8'));var sox=require(_0xbfc3('0x9'));var csv=require(_0xbfc3('0xa'));var ejs=require(_0xbfc3('0xb'));var fs=require('fs');var fs_extra=require(_0xbfc3('0xc'));var _=require(_0xbfc3('0xd'));var squel=require('squel');var crypto=require(_0xbfc3('0xe'));var jsforce=require(_0xbfc3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbfc3('0xa'));var querystring=require(_0xbfc3('0x10'));var Papa=require(_0xbfc3('0x11'));var Redis=require(_0xbfc3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbfc3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfc3('0x14'));var logger=require(_0xbfc3('0x15'))(_0xbfc3('0x16'));var utils=require(_0xbfc3('0x17'));var config=require(_0xbfc3('0x18'));var licenseUtil=require(_0xbfc3('0x19'));var db=require(_0xbfc3('0x1a'))['db'];function respondWithStatusCode(_0x52aa0b,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x2c3770){if(_0x2c3770){return _0x52aa0b[_0xbfc3('0x1b')](_0x24343b);}return _0x52aa0b['status'](_0x24343b)['end']();};}function respondWithResult(_0xbca42,_0x3389e5){_0x3389e5=_0x3389e5||0xc8;return function(_0x5abcdf){if(_0x5abcdf){return _0xbca42[_0xbfc3('0x1c')](_0x3389e5)[_0xbfc3('0x1d')](_0x5abcdf);}};}function respondWithFilteredResult(_0x450cf9,_0x30ab09){return function(_0xeeac8c){if(_0xeeac8c){var _0xcc1770=typeof _0x30ab09[_0xbfc3('0x1e')]===_0xbfc3('0x1f')&&typeof _0x30ab09[_0xbfc3('0x20')]===_0xbfc3('0x1f');var _0x2caf4e=_0xeeac8c[_0xbfc3('0x21')];var _0x5b893a=_0xcc1770?0x0:_0x30ab09['offset'];var _0x4b3f15=_0xcc1770?_0xeeac8c[_0xbfc3('0x21')]:_0x30ab09[_0xbfc3('0x1e')]+_0x30ab09['limit'];var _0x1d8b43;if(_0x4b3f15>=_0x2caf4e){_0x4b3f15=_0x2caf4e;_0x1d8b43=0xc8;}else{_0x1d8b43=0xce;}_0x450cf9[_0xbfc3('0x1c')](_0x1d8b43);return _0x450cf9[_0xbfc3('0x22')]('Content-Range',_0x5b893a+'-'+_0x4b3f15+'/'+_0x2caf4e)[_0xbfc3('0x1d')](_0xeeac8c);}return null;};}function patchUpdates(_0x3d49a1){return function(_0x8236d0){try{jsonpatch[_0xbfc3('0x23')](_0x8236d0,_0x3d49a1,!![]);}catch(_0x4b31f8){return BPromise[_0xbfc3('0x24')](_0x4b31f8);}return _0x8236d0[_0xbfc3('0x25')]();};}function saveUpdates(_0x42010d,_0x5b3d9e){return function(_0x52004d){if(_0x52004d){return _0x52004d[_0xbfc3('0x26')](_0x42010d)[_0xbfc3('0x27')](function(_0x58e8ac){return _0x58e8ac;});}return null;};}function removeEntity(_0x471375,_0x21d97a){return function(_0x523ce1){if(_0x523ce1){return _0x523ce1['destroy']()[_0xbfc3('0x27')](function(){var _0x507274=_0x523ce1[_0xbfc3('0x28')]({'plain':!![]});var _0x432409=_0xbfc3('0x29');return db[_0xbfc3('0x2a')][_0xbfc3('0x2b')]({'where':{'type':_0x432409,'resourceId':_0x507274['id']}})[_0xbfc3('0x27')](function(){return _0x523ce1;});})[_0xbfc3('0x27')](function(){_0x471375[_0xbfc3('0x1c')](0xcc)[_0xbfc3('0x2c')]();});}};}function handleEntityNotFound(_0x2b3b87,_0x536dfb){return function(_0x32e6e0){if(!_0x32e6e0){_0x2b3b87[_0xbfc3('0x1b')](0x194);}return _0x32e6e0;};}function handleError(_0x279561,_0x4312d4){_0x4312d4=_0x4312d4||0x1f4;return function(_0x130ee7){logger[_0xbfc3('0x2d')](_0x130ee7['stack']);if(_0x130ee7['name']){delete _0x130ee7['name'];}_0x279561[_0xbfc3('0x1c')](_0x4312d4)[_0xbfc3('0x2e')](_0x130ee7);};}exports[_0xbfc3('0x2f')]=function(_0x454a5f,_0x4d0553){var _0x3d2753={},_0x111e99={},_0x3e4143={'count':0x0,'rows':[]};var _0x42bb56=_[_0xbfc3('0x30')](db[_0xbfc3('0x31')][_0xbfc3('0x32')],function(_0x13316c){return{'name':_0x13316c[_0xbfc3('0x33')],'type':_0x13316c[_0xbfc3('0x34')][_0xbfc3('0x35')]};});_0x111e99[_0xbfc3('0x36')]=_['map'](_0x42bb56,_0xbfc3('0x37'));_0x111e99[_0xbfc3('0x38')]=_[_0xbfc3('0x39')](_0x454a5f[_0xbfc3('0x38')]);_0x111e99[_0xbfc3('0x3a')]=_[_0xbfc3('0x3b')](_0x111e99[_0xbfc3('0x36')],_0x111e99['query']);_0x3d2753[_0xbfc3('0x3c')]=_['intersection'](_0x111e99[_0xbfc3('0x36')],qs[_0xbfc3('0x3d')](_0x454a5f['query']['fields']));_0x3d2753[_0xbfc3('0x3c')]=_0x3d2753['attributes'][_0xbfc3('0x3e')]?_0x3d2753[_0xbfc3('0x3c')]:_0x111e99[_0xbfc3('0x36')];if(!_0x454a5f['query']['hasOwnProperty'](_0xbfc3('0x3f'))){_0x3d2753[_0xbfc3('0x20')]=qs[_0xbfc3('0x20')](_0x454a5f[_0xbfc3('0x38')][_0xbfc3('0x20')]);_0x3d2753[_0xbfc3('0x1e')]=qs['offset'](_0x454a5f['query'][_0xbfc3('0x1e')]);}_0x3d2753[_0xbfc3('0x40')]=qs[_0xbfc3('0x41')](_0x454a5f[_0xbfc3('0x38')][_0xbfc3('0x41')]);_0x3d2753[_0xbfc3('0x42')]=qs['filters'](_[_0xbfc3('0x43')](_0x454a5f[_0xbfc3('0x38')],_0x111e99['filters']),_0x42bb56);if(_0x454a5f['query'][_0xbfc3('0x44')]){_0x3d2753['where']=_['merge'](_0x3d2753[_0xbfc3('0x42')],{'$or':_[_0xbfc3('0x30')](_0x42bb56,function(_0x4f3e7a){if(_0x4f3e7a['type']!==_0xbfc3('0x45')){var _0x51d2ba={};_0x51d2ba[_0x4f3e7a[_0xbfc3('0x37')]]={'$like':'%'+_0x454a5f['query'][_0xbfc3('0x44')]+'%'};return _0x51d2ba;}})});}_0x3d2753=_[_0xbfc3('0x46')]({},_0x3d2753,_0x454a5f[_0xbfc3('0x47')]);var _0xb9b96e={'where':_0x3d2753[_0xbfc3('0x42')]};return db['Schedule'][_0xbfc3('0x21')](_0xb9b96e)['then'](function(_0x15d57d){_0x3e4143[_0xbfc3('0x21')]=_0x15d57d;if(_0x454a5f[_0xbfc3('0x38')][_0xbfc3('0x48')]){_0x3d2753['include']=[{'all':!![]}];}return db[_0xbfc3('0x31')][_0xbfc3('0x49')](_0x3d2753);})[_0xbfc3('0x27')](function(_0x18eb8b){_0x3e4143['rows']=_0x18eb8b;return _0x3e4143;})['then'](respondWithFilteredResult(_0x4d0553,_0x3d2753))[_0xbfc3('0x4a')](handleError(_0x4d0553,null));};exports[_0xbfc3('0x4b')]=function(_0x36c27d,_0x14025e){var _0x12be37={'raw':![],'where':{'id':_0x36c27d[_0xbfc3('0x4c')]['id']}},_0x9f2575={};_0x9f2575[_0xbfc3('0x36')]=_[_0xbfc3('0x39')](db[_0xbfc3('0x31')]['rawAttributes']);_0x9f2575['query']=_[_0xbfc3('0x39')](_0x36c27d[_0xbfc3('0x38')]);_0x9f2575[_0xbfc3('0x3a')]=_[_0xbfc3('0x3b')](_0x9f2575['model'],_0x9f2575['query']);_0x12be37[_0xbfc3('0x3c')]=_[_0xbfc3('0x3b')](_0x9f2575[_0xbfc3('0x36')],qs[_0xbfc3('0x3d')](_0x36c27d[_0xbfc3('0x38')][_0xbfc3('0x3d')]));_0x12be37[_0xbfc3('0x3c')]=_0x12be37[_0xbfc3('0x3c')]['length']?_0x12be37[_0xbfc3('0x3c')]:_0x9f2575[_0xbfc3('0x36')];if(_0x36c27d[_0xbfc3('0x38')][_0xbfc3('0x48')]){_0x12be37[_0xbfc3('0x4d')]=[{'all':!![]}];}_0x12be37=_[_0xbfc3('0x46')]({},_0x12be37,_0x36c27d['options']);return db[_0xbfc3('0x31')][_0xbfc3('0x4e')](_0x12be37)[_0xbfc3('0x27')](handleEntityNotFound(_0x14025e,null))[_0xbfc3('0x27')](respondWithResult(_0x14025e,null))[_0xbfc3('0x4a')](handleError(_0x14025e,null));};exports[_0xbfc3('0x4f')]=function(_0x19bc9c,_0x138847){return db[_0xbfc3('0x31')][_0xbfc3('0x4f')](_0x19bc9c[_0xbfc3('0x50')],{})[_0xbfc3('0x27')](function(_0x453421){var _0x5e662c=_0x19bc9c[_0xbfc3('0x51')][_0xbfc3('0x28')]({'plain':!![]});if(!_0x5e662c)throw new Error(_0xbfc3('0x52'));if(_0x5e662c[_0xbfc3('0x53')]==='user'){var _0x252cd7=_0x453421[_0xbfc3('0x28')]({'plain':!![]});var _0x1e30bb=_0xbfc3('0x29');return db[_0xbfc3('0x54')]['find']({'where':{'name':_0x1e30bb,'userProfileId':_0x5e662c[_0xbfc3('0x55')]},'raw':!![]})[_0xbfc3('0x27')](function(_0x5ed87c){if(_0x5ed87c&&_0x5ed87c[_0xbfc3('0x56')]===0x0){return db[_0xbfc3('0x2a')][_0xbfc3('0x4f')]({'name':_0x252cd7[_0xbfc3('0x37')],'resourceId':_0x252cd7['id'],'type':_0x5ed87c[_0xbfc3('0x37')],'sectionId':_0x5ed87c['id']},{})[_0xbfc3('0x27')](function(){return _0x453421;});}else{return _0x453421;}})[_0xbfc3('0x4a')](function(_0x214946){logger[_0xbfc3('0x2d')](_0xbfc3('0x57'),_0x214946);throw _0x214946;});}return _0x453421;})[_0xbfc3('0x27')](respondWithResult(_0x138847,0xc9))[_0xbfc3('0x4a')](handleError(_0x138847,null));};exports[_0xbfc3('0x26')]=function(_0x1e604d,_0x3ee81e){if(_0x1e604d[_0xbfc3('0x50')]['id']){delete _0x1e604d[_0xbfc3('0x50')]['id'];}return db[_0xbfc3('0x31')][_0xbfc3('0x4e')]({'where':{'id':_0x1e604d[_0xbfc3('0x4c')]['id']}})[_0xbfc3('0x27')](handleEntityNotFound(_0x3ee81e,null))[_0xbfc3('0x27')](saveUpdates(_0x1e604d[_0xbfc3('0x50')],null))['then'](respondWithResult(_0x3ee81e,null))[_0xbfc3('0x4a')](handleError(_0x3ee81e,null));};exports[_0xbfc3('0x2b')]=function(_0x2dabdb,_0x5105db){return db['Schedule']['find']({'where':{'id':_0x2dabdb[_0xbfc3('0x4c')]['id']}})[_0xbfc3('0x27')](handleEntityNotFound(_0x5105db,null))[_0xbfc3('0x27')](removeEntity(_0x5105db,null))[_0xbfc3('0x4a')](handleError(_0x5105db,null));};exports['run']=function(_0x4517ec,_0x17e8f5,_0x17a70c){var _0x2a6f73=require(_0xbfc3('0x58'));return db[_0xbfc3('0x31')][_0xbfc3('0x4e')]({'where':{'id':_0x4517ec['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x17e8f5,null))[_0xbfc3('0x27')](function(){_0x2a6f73[_0xbfc3('0x59')](_0x4517ec[_0xbfc3('0x4c')]['id']);})[_0xbfc3('0x27')](respondWithStatusCode(_0x17e8f5,null))['catch'](handleError(_0x17e8f5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 07c39b7..f101c9e 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 _0x52d5=['Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define'];(function(_0x13cb37,_0x42802a){var _0x167b11=function(_0x8be35){while(--_0x8be35){_0x13cb37['push'](_0x13cb37['shift']());}};_0x167b11(++_0x42802a);}(_0x52d5,0x9d));var _0x552d=function(_0x4bb7c1,_0x35dfa1){_0x4bb7c1=_0x4bb7c1-0x0;var _0x1a81d8=_0x52d5[_0x4bb7c1];return _0x1a81d8;};'use strict';var _=require(_0x552d('0x0'));var util=require(_0x552d('0x1'));var logger=require(_0x552d('0x2'))(_0x552d('0x3'));var moment=require(_0x552d('0x4'));var BPromise=require(_0x552d('0x5'));var rp=require(_0x552d('0x6'));var fs=require('fs');var path=require(_0x552d('0x7'));var rimraf=require(_0x552d('0x8'));var config=require('../../config/environment');var attributes=require(_0x552d('0x9'));module[_0x552d('0xa')]=function(_0x368e3a,_0x31ebe0){return _0x368e3a[_0x552d('0xb')](_0x552d('0xc'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e03=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util'];(function(_0x17edf0,_0x3afaeb){var _0x57d613=function(_0x2a1f46){while(--_0x2a1f46){_0x17edf0['push'](_0x17edf0['shift']());}};_0x57d613(++_0x3afaeb);}(_0x8e03,0xe9));var _0x38e0=function(_0x43d45a,_0x1d45f0){_0x43d45a=_0x43d45a-0x0;var _0x2b441c=_0x8e03[_0x43d45a];return _0x2b441c;};'use strict';var _=require('lodash');var util=require(_0x38e0('0x0'));var logger=require(_0x38e0('0x1'))(_0x38e0('0x2'));var moment=require(_0x38e0('0x3'));var BPromise=require(_0x38e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38e0('0x5'));var rimraf=require(_0x38e0('0x6'));var config=require(_0x38e0('0x7'));var attributes=require(_0x38e0('0x8'));module[_0x38e0('0x9')]=function(_0x48a259,_0x39b39d){return _0x48a259[_0x38e0('0xa')](_0x38e0('0xb'),attributes,{'tableName':_0x38e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b0ef76f..6d8cd19 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 _0xf008=['util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash'];(function(_0x523663,_0x7dc460){var _0x2219f5=function(_0x209e48){while(--_0x209e48){_0x523663['push'](_0x523663['shift']());}};_0x2219f5(++_0x7dc460);}(_0xf008,0x16f));var _0x8f00=function(_0x4e94d1,_0x4b4a1a){_0x4e94d1=_0x4e94d1-0x0;var _0x11537f=_0xf008[_0x4e94d1];return _0x11537f;};'use strict';var _=require(_0x8f00('0x0'));var util=require(_0x8f00('0x1'));var moment=require(_0x8f00('0x2'));var BPromise=require(_0x8f00('0x3'));var rs=require(_0x8f00('0x4'));var fs=require('fs');var Redis=require(_0x8f00('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f00('0x6'))(_0x8f00('0x7'));var config=require(_0x8f00('0x8'));var jayson=require(_0x8f00('0x9'));var client=jayson[_0x8f00('0xa')][_0x8f00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29fcd3,_0x40950e,_0x253a90){return new BPromise(function(_0x2347f5,_0x39742a){return client['request'](_0x29fcd3,_0x253a90)[_0x8f00('0xc')](function(_0x455672){logger[_0x8f00('0xd')](_0x8f00('0xe'),_0x40950e,_0x8f00('0xf'));logger[_0x8f00('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x40950e,_0x8f00('0xf'),JSON[_0x8f00('0x11')](_0x455672));if(_0x455672['error']){if(_0x455672['error'][_0x8f00('0x12')]===0x1f4){logger[_0x8f00('0x13')](_0x8f00('0xe'),_0x40950e,_0x455672[_0x8f00('0x13')]['message']);return _0x39742a(_0x455672[_0x8f00('0x13')]['message']);}logger[_0x8f00('0x13')](_0x8f00('0xe'),_0x40950e,_0x455672['error'][_0x8f00('0x14')]);return _0x2347f5(_0x455672['error'][_0x8f00('0x14')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x40950e,_0x8f00('0xf'));_0x2347f5(_0x455672[_0x8f00('0x15')][_0x8f00('0x14')]);}})[_0x8f00('0x16')](function(_0x28fbca){logger[_0x8f00('0x13')](_0x8f00('0xe'),_0x40950e,_0x28fbca);_0x39742a(_0x28fbca);});});} \ No newline at end of file +var _0x12bc=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x12bc,0xc6));var _0xc12b=function(_0x44f07e,_0x41dfc5){_0x44f07e=_0x44f07e-0x0;var _0x590254=_0x12bc[_0x44f07e];return _0x590254;};'use strict';var _=require(_0xc12b('0x0'));var util=require(_0xc12b('0x1'));var moment=require('moment');var BPromise=require(_0xc12b('0x2'));var rs=require(_0xc12b('0x3'));var fs=require('fs');var Redis=require(_0xc12b('0x4'));var db=require(_0xc12b('0x5'))['db'];var utils=require(_0xc12b('0x6'));var logger=require(_0xc12b('0x7'))(_0xc12b('0x8'));var config=require(_0xc12b('0x9'));var jayson=require(_0xc12b('0xa'));var client=jayson[_0xc12b('0xb')][_0xc12b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x145dbf,_0x448c1d,_0x24f49c){return new BPromise(function(_0x2fe24a,_0x2b9ae2){return client[_0xc12b('0xd')](_0x145dbf,_0x24f49c)[_0xc12b('0xe')](function(_0x3b146b){logger[_0xc12b('0xf')](_0xc12b('0x10'),_0x448c1d,_0xc12b('0x11'));logger['debug'](_0xc12b('0x12'),_0x448c1d,_0xc12b('0x11'),JSON[_0xc12b('0x13')](_0x3b146b));if(_0x3b146b[_0xc12b('0x14')]){if(_0x3b146b[_0xc12b('0x14')]['code']===0x1f4){logger['error'](_0xc12b('0x10'),_0x448c1d,_0x3b146b[_0xc12b('0x14')][_0xc12b('0x15')]);return _0x2b9ae2(_0x3b146b[_0xc12b('0x14')]['message']);}logger[_0xc12b('0x14')](_0xc12b('0x10'),_0x448c1d,_0x3b146b['error'][_0xc12b('0x15')]);return _0x2fe24a(_0x3b146b[_0xc12b('0x14')]['message']);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x448c1d,_0xc12b('0x11'));_0x2fe24a(_0x3b146b[_0xc12b('0x16')]['message']);}})[_0xc12b('0x17')](function(_0x11cc55){logger[_0xc12b('0x14')](_0xc12b('0x10'),_0x448c1d,_0x11cc55);_0x2b9ae2(_0x11cc55);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 5834a0e..0cbe6b8 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 _0x6122=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download','create','put'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6122,0xdf));var _0x2612=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0x6122[_0x2de0a7];return _0x429437;};'use strict';var multer=require(_0x2612('0x0'));var util=require(_0x2612('0x1'));var path=require(_0x2612('0x2'));var timeout=require('connect-timeout');var express=require(_0x2612('0x3'));var router=express[_0x2612('0x4')]();var fs_extra=require(_0x2612('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2612('0x6'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x2612('0x7')]('/',auth['isAuthenticated'](),controller[_0x2612('0x8')]);router[_0x2612('0x7')](_0x2612('0x9'),auth[_0x2612('0xa')](),controller[_0x2612('0xb')]);router['get'](_0x2612('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2612('0x7')](_0x2612('0xd'),auth[_0x2612('0xa')](),controller[_0x2612('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2612('0xf')]);router[_0x2612('0x10')](_0x2612('0xc'),auth['isAuthenticated'](),controller[_0x2612('0x11')]);router[_0x2612('0x12')](_0x2612('0xc'),auth[_0x2612('0xa')](),controller[_0x2612('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6b86=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x6b86,0x1a4));var _0x66b8=function(_0x54b10e,_0xec6532){_0x54b10e=_0x54b10e-0x0;var _0x1ce058=_0x6b86[_0x54b10e];return _0x1ce058;};'use strict';var multer=require(_0x66b8('0x0'));var util=require(_0x66b8('0x1'));var path=require(_0x66b8('0x2'));var timeout=require(_0x66b8('0x3'));var express=require('express');var router=express[_0x66b8('0x4')]();var fs_extra=require(_0x66b8('0x5'));var auth=require(_0x66b8('0x6'));var interaction=require(_0x66b8('0x7'));var config=require(_0x66b8('0x8'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x66b8('0x9')](),controller[_0x66b8('0xa')]);router[_0x66b8('0xb')](_0x66b8('0xc'),auth['isAuthenticated'](),controller[_0x66b8('0xd')]);router['get'](_0x66b8('0xe'),auth[_0x66b8('0x9')](),controller[_0x66b8('0xf')]);router[_0x66b8('0xb')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x66b8('0x10')]('/',auth['isAuthenticated'](),controller[_0x66b8('0x11')]);router[_0x66b8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x66b8('0x13')]);router[_0x66b8('0x14')](_0x66b8('0xe'),auth[_0x66b8('0x9')](),controller[_0x66b8('0x15')]);module[_0x66b8('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0d4dacb..e46cd07 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 _0xd5fc=['STRING','INTEGER','startedAt','setDataValue','duration','DATE','format','MM-DD-YYYY\x20HH:mm','closedAt','createdAt','toString','updatedAt','sequelize','exports','VIRTUAL','getDataValue','value','extname'];(function(_0x8c540d,_0x1eed5b){var _0x22ed75=function(_0x3aefbf){while(--_0x3aefbf){_0x8c540d['push'](_0x8c540d['shift']());}};_0x22ed75(++_0x1eed5b);}(_0xd5fc,0xae));var _0xcd5f=function(_0x173cf0,_0x37a1e7){_0x173cf0=_0x173cf0-0x0;var _0x5e6c76=_0xd5fc[_0x173cf0];return _0x5e6c76;};'use strict';var Sequelize=require(_0xcd5f('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0xcd5f('0x1')]={'format':{'type':Sequelize[_0xcd5f('0x2')],'get':function(){return this[_0xcd5f('0x3')](_0xcd5f('0x4'))?path[_0xcd5f('0x5')](this[_0xcd5f('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xcd5f('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xcd5f('0x6')],'set':function(_0x159b3f){var _0x5af696=_0x159b3f['replace'](/\\/g,'/');this['setDataValue'](_0xcd5f('0x4'),_0x5af696);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xcd5f('0x7')],'set':function(_0x3e63d4){this['setDataValue'](_0xcd5f('0x8'),moment()['subtract'](_0x3e63d4,'ms'));this[_0xcd5f('0x9')]('closedAt',moment());this[_0xcd5f('0x9')](_0xcd5f('0xa'),_0x3e63d4);}},'startedAt':{'type':Sequelize[_0xcd5f('0xb')],'get':function(){return moment(this[_0xcd5f('0x3')]('startedAt'))[_0xcd5f('0xc')](_0xcd5f('0xd'))['toString']();}},'closedAt':{'type':Sequelize[_0xcd5f('0xb')],'get':function(){return moment(this[_0xcd5f('0x3')](_0xcd5f('0xe')))[_0xcd5f('0xc')](_0xcd5f('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0xcd5f('0xb')],'get':function(){return moment(this[_0xcd5f('0x3')](_0xcd5f('0xf')))[_0xcd5f('0xc')](_0xcd5f('0xd'))[_0xcd5f('0x10')]();}},'updatedAt':{'type':Sequelize[_0xcd5f('0xb')],'get':function(){return moment(this['getDataValue'](_0xcd5f('0x11')))[_0xcd5f('0xc')](_0xcd5f('0xd'))[_0xcd5f('0x10')]();}}}; \ No newline at end of file +var _0xf7d9=['toString','createdAt','sequelize','moment','path','../../config/environment','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm'];(function(_0x35c3f5,_0x2d6b07){var _0x31d52c=function(_0x428ece){while(--_0x428ece){_0x35c3f5['push'](_0x35c3f5['shift']());}};_0x31d52c(++_0x2d6b07);}(_0xf7d9,0x122));var _0x9f7d=function(_0x851651,_0x77a929){_0x851651=_0x851651-0x0;var _0x401021=_0xf7d9[_0x851651];return _0x401021;};'use strict';var Sequelize=require(_0x9f7d('0x0'));var moment=require(_0x9f7d('0x1'));var path=require(_0x9f7d('0x2'));var config=require(_0x9f7d('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9f7d('0x4')]('value')?path[_0x9f7d('0x5')](this[_0x9f7d('0x4')](_0x9f7d('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x9f7d('0x7')]},'channel':{'type':Sequelize[_0x9f7d('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x4dc6b9){var _0xf09259=_0x4dc6b9[_0x9f7d('0x8')](/\\/g,'/');this[_0x9f7d('0x9')](_0x9f7d('0x6'),_0xf09259);}},'rating':{'type':Sequelize[_0x9f7d('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9f7d('0xa')],'set':function(_0x5290e2){this[_0x9f7d('0x9')](_0x9f7d('0xb'),moment()['subtract'](_0x5290e2,'ms'));this[_0x9f7d('0x9')](_0x9f7d('0xc'),moment());this[_0x9f7d('0x9')]('duration',_0x5290e2);}},'startedAt':{'type':Sequelize[_0x9f7d('0xd')],'get':function(){return moment(this[_0x9f7d('0x4')](_0x9f7d('0xb')))[_0x9f7d('0xe')](_0x9f7d('0xf'))[_0x9f7d('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9f7d('0x4')](_0x9f7d('0xc')))[_0x9f7d('0xe')](_0x9f7d('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x9f7d('0xd')],'get':function(){return moment(this[_0x9f7d('0x4')](_0x9f7d('0x11')))[_0x9f7d('0xe')](_0x9f7d('0xf'))[_0x9f7d('0x10')]();}},'updatedAt':{'type':Sequelize[_0x9f7d('0xd')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x9f7d('0xe')](_0x9f7d('0xf'))[_0x9f7d('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a0f8972..5dc0835 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 _0xeec6=['options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ScreenRecording','rawAttributes','fieldName','type','model','format','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3fa9a3,_0x30c55d){var _0x146e4e=function(_0x34aa72){while(--_0x34aa72){_0x3fa9a3['push'](_0x3fa9a3['shift']());}};_0x146e4e(++_0x30c55d);}(_0xeec6,0x1c2));var _0x6eec=function(_0x280820,_0xce9bc7){_0x280820=_0x280820-0x0;var _0x474787=_0xeec6[_0x280820];return _0x474787;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require('request-promise');var moment=require(_0x6eec('0x4'));var BPromise=require(_0x6eec('0x5'));var Mustache=require(_0x6eec('0x6'));var util=require(_0x6eec('0x7'));var path=require(_0x6eec('0x8'));var sox=require(_0x6eec('0x9'));var csv=require('to-csv');var ejs=require(_0x6eec('0xa'));var fs=require('fs');var fs_extra=require(_0x6eec('0xb'));var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=typeof _0x393271['offset']===_0x6eec('0x1b')&&typeof _0x393271['limit']===_0x6eec('0x1b');var _0x45aa3f=_0x34a7fc['count'];var _0x3ee353=_0x2ac797?0x0:_0x393271[_0x6eec('0x1c')];var _0xb1eab7=_0x2ac797?_0x34a7fc['count']:_0x393271[_0x6eec('0x1c')]+_0x393271[_0x6eec('0x1d')];var _0x3c7152;if(_0xb1eab7>=_0x45aa3f){_0xb1eab7=_0x45aa3f;_0x3c7152=0xc8;}else{_0x3c7152=0xce;}_0x345852[_0x6eec('0x19')](_0x3c7152);return _0x345852[_0x6eec('0x1e')](_0x6eec('0x1f'),_0x3ee353+'-'+_0xb1eab7+'/'+_0x45aa3f)['json'](_0x34a7fc);}return null;};}function patchUpdates(_0x328693){return function(_0x2f843e){try{jsonpatch[_0x6eec('0x20')](_0x2f843e,_0x328693,!![]);}catch(_0x34522a){return BPromise[_0x6eec('0x21')](_0x34522a);}return _0x2f843e[_0x6eec('0x22')]();};}function saveUpdates(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')](_0x52f941)[_0x6eec('0x24')](function(_0x409b26){return _0x409b26;});}return null;};}function removeEntity(_0x13863c,_0x573249){return function(_0x384586){if(_0x384586){return _0x384586[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x13863c[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x1f386c,_0x29879c){return function(_0x20bed3){if(!_0x20bed3){_0x1f386c[_0x6eec('0x17')](0x194);}return _0x20bed3;};}function handleError(_0x58f95c,_0x1d750c){_0x1d750c=_0x1d750c||0x1f4;return function(_0x44b31c){logger[_0x6eec('0x26')](_0x44b31c[_0x6eec('0x27')]);if(_0x44b31c['name']){delete _0x44b31c[_0x6eec('0x28')];}_0x58f95c[_0x6eec('0x19')](_0x1d750c)['send'](_0x44b31c);};}exports['index']=function(_0x3240c3,_0x47ed95){var _0x20a130={},_0xede270={},_0x3bbdf8={'count':0x0,'rows':[]};var _0x34bdea=_[_0x6eec('0x29')](db[_0x6eec('0x2a')][_0x6eec('0x2b')],function(_0x33e4a1){return{'name':_0x33e4a1[_0x6eec('0x2c')],'type':_0x33e4a1[_0x6eec('0x2d')]['key']};});_0xede270[_0x6eec('0x2e')]=_['differenceBy'](_[_0x6eec('0x29')](_0x34bdea,_0x6eec('0x28')),[_0x6eec('0x2f')]);_0xede270['query']=_['keys'](_0x3240c3['query']);_0xede270[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],_0xede270[_0x6eec('0x32')]);_0x20a130[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x34')]));_0x20a130[_0x6eec('0x33')]=_0x20a130[_0x6eec('0x33')]['length']?_0x20a130[_0x6eec('0x33')]:_0xede270[_0x6eec('0x2e')];if(!_0x3240c3[_0x6eec('0x32')]['hasOwnProperty'](_0x6eec('0x35'))){_0x20a130[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1d')]);_0x20a130[_0x6eec('0x1c')]=qs['offset'](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1c')]);}_0x20a130[_0x6eec('0x36')]=qs['sort'](_0x3240c3['query'][_0x6eec('0x37')]);_0x20a130[_0x6eec('0x38')]=qs[_0x6eec('0x30')](_[_0x6eec('0x39')](_0x3240c3[_0x6eec('0x32')],_0xede270['filters']),_0x34bdea);if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3a')]){_0x20a130[_0x6eec('0x38')]=_[_0x6eec('0x3b')](_0x20a130[_0x6eec('0x38')],{'$or':_[_0x6eec('0x29')](_0x34bdea,function(_0x36cfe1){if(_0x36cfe1[_0x6eec('0x2d')]!=='VIRTUAL'){var _0x2f7a75={};_0x2f7a75[_0x36cfe1[_0x6eec('0x28')]]={'$like':'%'+_0x3240c3['query']['filter']+'%'};return _0x2f7a75;}})});}_0x20a130=_[_0x6eec('0x3b')]({},_0x20a130,_0x3240c3[_0x6eec('0x3c')]);var _0xf056e0={'where':_0x20a130[_0x6eec('0x38')]};return db['ScreenRecording']['count'](_0xf056e0)[_0x6eec('0x24')](function(_0x48fbf6){_0x3bbdf8['count']=_0x48fbf6;if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3d')]){_0x20a130[_0x6eec('0x3e')]=[{'all':!![]}];}return db[_0x6eec('0x2a')][_0x6eec('0x3f')](_0x20a130);})['then'](function(_0x931bcf){_0x3bbdf8[_0x6eec('0x40')]=_0x931bcf;return _0x3bbdf8;})['then'](respondWithFilteredResult(_0x47ed95,_0x20a130))[_0x6eec('0x41')](handleError(_0x47ed95,null));};exports[_0x6eec('0x42')]=function(_0x5028a2,_0x2d39bf){var _0x44d75d={'raw':![],'where':{'id':_0x5028a2[_0x6eec('0x43')]['id']}},_0x4e3b1e={};_0x4e3b1e[_0x6eec('0x2e')]=_[_0x6eec('0x44')](db[_0x6eec('0x2a')]['rawAttributes']);_0x4e3b1e[_0x6eec('0x32')]=_[_0x6eec('0x44')](_0x5028a2[_0x6eec('0x32')]);_0x4e3b1e[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0x4e3b1e['model'],_0x4e3b1e['query']);_0x44d75d[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0x4e3b1e[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x5028a2[_0x6eec('0x32')]['fields']));_0x44d75d[_0x6eec('0x33')]=_0x44d75d['attributes'][_0x6eec('0x45')]?_0x44d75d[_0x6eec('0x33')]:_0x4e3b1e[_0x6eec('0x2e')];if(_0x5028a2['query'][_0x6eec('0x3d')]){_0x44d75d[_0x6eec('0x3e')]=[{'all':!![]}];}_0x44d75d=_[_0x6eec('0x3b')]({},_0x44d75d,_0x5028a2[_0x6eec('0x3c')]);return db[_0x6eec('0x2a')]['find'](_0x44d75d)[_0x6eec('0x24')](handleEntityNotFound(_0x2d39bf,null))['then'](respondWithResult(_0x2d39bf,null))['catch'](handleError(_0x2d39bf,null));};exports[_0x6eec('0x46')]=function(_0x535d96,_0x245a1b){return db[_0x6eec('0x2a')][_0x6eec('0x46')](_0x535d96['body'],{})['then'](respondWithResult(_0x245a1b,0xc9))[_0x6eec('0x41')](handleError(_0x245a1b,null));};exports[_0x6eec('0x23')]=function(_0x1d6626,_0x2d0fc0){if(_0x1d6626[_0x6eec('0x47')]['id']){delete _0x1d6626[_0x6eec('0x47')]['id'];}delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x48')];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x49')];delete _0x1d6626['body']['closedAt'];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x4a')];return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x1d6626[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x2d0fc0,null))[_0x6eec('0x24')](saveUpdates(_0x1d6626[_0x6eec('0x47')],null))[_0x6eec('0x24')](respondWithResult(_0x2d0fc0,null))[_0x6eec('0x41')](handleError(_0x2d0fc0,null));};exports[_0x6eec('0x4b')]=function(_0x413de9,_0x5a6e05){return db[_0x6eec('0x2a')][_0x6eec('0x4b')]()[_0x6eec('0x24')](respondWithResult(_0x5a6e05,null))[_0x6eec('0x41')](handleError(_0x5a6e05,null));};exports['download']=function(_0x51fd37,_0x50436d,_0x36c49b){var _0x32b289=require(_0x6eec('0x4c'));var _0x1de626=![];var _0x5178f5={};if(_0x51fd37['query'][_0x6eec('0x2d')]&&_0x51fd37[_0x6eec('0x32')][_0x6eec('0x2d')]==='uniqueid'){_0x5178f5[_0x6eec('0x4d')]=_0x51fd37[_0x6eec('0x43')]['id'];}else{_0x5178f5['id']=_0x51fd37[_0x6eec('0x43')]['id'];}return db[_0x6eec('0x2a')][_0x6eec('0x4e')]({'where':_0x5178f5,'attributes':['id',_0x6eec('0x4a')],'raw':!![]})[_0x6eec('0x24')](handleEntityNotFound(_0x50436d,null))[_0x6eec('0x24')](function(_0x45fed3){if(_0x45fed3){var _0x4e921a=path[_0x6eec('0x4f')](config['root'],_0x6eec('0x50'),_0x45fed3[_0x6eec('0x4a')]);var _0x424962=util[_0x6eec('0x2f')](_0x6eec('0x51'),_0x4e921a);if(fs[_0x6eec('0x52')](_0x424962)){_0x1de626=!![];return _0x32b289[_0x6eec('0x53')](_0x424962,_0x4e921a,config['secrets'][_0x6eec('0x54')])['then'](function(){return _0x45fed3;});}return _0x45fed3;}})[_0x6eec('0x24')](function(_0x5c905f){if(_0x5c905f){var _0x237324=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x5c905f[_0x6eec('0x4a')]);if(!fs[_0x6eec('0x52')](_0x237324)){throw new db[(_0x6eec('0x56'))][(_0x6eec('0x57'))](_0x6eec('0x58'));}if(_0x5c905f[_0x6eec('0x59')]){return _0x50436d['download'](_0x237324,_0x5c905f['filename']+path[_0x6eec('0x5a')](_0x237324),function(){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}else{return _0x50436d[_0x6eec('0x5c')](_0x237324,function(_0x2c0644){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}}})['catch'](function(_0x1d8fb1){if(_0x1d8fb1[_0x6eec('0x5d')]==='ScreenRecording\x20not\x20found'){_0x50436d['status'](0x194)['send'](_0x6eec('0x5e'));}else{return handleError(_0x50436d,null);}});};exports[_0x6eec('0x25')]=function(_0x4cf859,_0x1d2baf){return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x4cf859[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](function(_0xc852b3){if(_[_0x6eec('0x5f')](_0xc852b3)){throw new ReferenceError('Entity\x20not\x20found');}return _0xc852b3;})['then'](function(_0x54fcd0){var _0x1230fc=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x54fcd0[_0x6eec('0x4a')]);logger[_0x6eec('0x60')](_0x6eec('0x61'),_0x1230fc);if(!_[_0x6eec('0x5f')](_0x54fcd0[_0x6eec('0x4a')])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')](_0x6eec('0x62')+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}_0x1230fc=_0x1230fc+_0x6eec('0x65');if(!_[_0x6eec('0x5f')](_0x54fcd0['value'])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')]('File:\x20\x22'+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}return _0x54fcd0;})['then'](function(_0x7dd727){if(!_0x7dd727)throw new InternalError();return _0x7dd727[_0x6eec('0x25')]();})[_0x6eec('0x24')](function(){_0x1d2baf[_0x6eec('0x19')](0xcc)['end']();})[_0x6eec('0x41')](handleError(_0x1d2baf,null));}; \ No newline at end of file +var _0x7217=['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','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','params','rawAttributes','intersection','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','decryptFile','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2c8df0,_0x32e64b){var _0x5753b1=function(_0x279686){while(--_0x279686){_0x2c8df0['push'](_0x2c8df0['shift']());}};_0x5753b1(++_0x32e64b);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'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('0x34')](_[_0x7721('0x2f')](_0x5c54f0,'name'),[_0x7721('0x35')]);_0xd7d703[_0x7721('0x36')]=_[_0x7721('0x37')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x38')]=_['intersection'](_0xd7d703[_0x7721('0x33')],_0xd7d703[_0x7721('0x36')]);_0x37b9f0[_0x7721('0x39')]=_['intersection'](_0xd7d703[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x158d98['query'][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')][_0x7721('0x3b')]?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3c')](_0x7721('0x3d'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0['offset']=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x3f')](_0x158d98[_0x7721('0x36')][_0x7721('0x3f')]);_0x37b9f0[_0x7721('0x40')]=qs['filters'](_['pick'](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98[_0x7721('0x36')][_0x7721('0x41')]){_0x37b9f0[_0x7721('0x40')]=_[_0x7721('0x42')](_0x37b9f0['where'],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4cf659){if(_0x4cf659[_0x7721('0x32')]!==_0x7721('0x43')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x44')]]={'$like':'%'+_0x158d98[_0x7721('0x36')]['filter']+'%'};return _0x5a278e;}})});}_0x37b9f0=_['merge']({},_0x37b9f0,_0x158d98[_0x7721('0x45')]);var _0xfc4dc4={'where':_0x37b9f0[_0x7721('0x40')]};return db[_0x7721('0x30')]['count'](_0xfc4dc4)[_0x7721('0x29')](function(_0x120de9){_0x1da2d8[_0x7721('0x22')]=_0x120de9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x46')]){_0x37b9f0['include']=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a5b59){_0x1da2d8[_0x7721('0x47')]=_0x4a5b59;return _0x1da2d8;})[_0x7721('0x29')](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x48')](handleError(_0x1ea4d,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x37')](db[_0x7721('0x30')][_0x7721('0x4a')]);_0x481fa8[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x36')]);_0x1ad315[_0x7721('0x39')]=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x1453d4[_0x7721('0x36')][_0x7721('0x3a')]));_0x1ad315[_0x7721('0x39')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x39')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x36')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x42')]({},_0x1ad315,_0x1453d4[_0x7721('0x45')]);return db['ScreenRecording'][_0x7721('0x4c')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x29')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4d')]=function(_0x196be4,_0xf17c40){return db['ScreenRecording'][_0x7721('0x4d')](_0x196be4[_0x7721('0x4e')],{})['then'](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x28')]=function(_0xf88e8c,_0x5c4078){if(_0xf88e8c[_0x7721('0x4e')]['id']){delete _0xf88e8c['body']['id'];}delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x4f')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x50')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x51')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x52')];return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0xf88e8c[_0x7721('0x49')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x5c4078,null))[_0x7721('0x29')](saveUpdates(_0xf88e8c[_0x7721('0x4e')],null))[_0x7721('0x29')](respondWithResult(_0x5c4078,null))['catch'](handleError(_0x5c4078,null));};exports[_0x7721('0x53')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x30')][_0x7721('0x53')]()[_0x7721('0x29')](respondWithResult(_0x8e1214,null))[_0x7721('0x48')](handleError(_0x8e1214,null));};exports['download']=function(_0x234bee,_0x17036e,_0x134908){var _0x3b7382=require(_0x7721('0x54'));var _0x9c0d4=![];var _0x7fbd6c={};if(_0x234bee[_0x7721('0x36')][_0x7721('0x32')]&&_0x234bee[_0x7721('0x36')][_0x7721('0x32')]==='uniqueid'){_0x7fbd6c[_0x7721('0x55')]=_0x234bee[_0x7721('0x49')]['id'];}else{_0x7fbd6c['id']=_0x234bee[_0x7721('0x49')]['id'];}return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':_0x7fbd6c,'attributes':['id',_0x7721('0x52')],'raw':!![]})[_0x7721('0x29')](handleEntityNotFound(_0x17036e,null))[_0x7721('0x29')](function(_0x360882){if(_0x360882){var _0x287452=path[_0x7721('0x56')](config[_0x7721('0x57')],_0x7721('0x58'),_0x360882[_0x7721('0x52')]);var _0x300ea4=util['format']('%s.cypher',_0x287452);if(fs['existsSync'](_0x300ea4)){_0x9c0d4=!![];return _0x3b7382[_0x7721('0x59')](_0x300ea4,_0x287452,config['secrets']['recording'])['then'](function(){return _0x360882;});}return _0x360882;}})['then'](function(_0x47925a){if(_0x47925a){var _0x219181=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x47925a['value']);if(!fs['existsSync'](_0x219181)){throw new db['Sequelize'][(_0x7721('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x47925a['filename']){return _0x17036e['download'](_0x219181,_0x47925a[_0x7721('0x5b')]+path[_0x7721('0x5c')](_0x219181),function(){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}else{return _0x17036e['download'](_0x219181,function(_0x2a025c){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}}})[_0x7721('0x48')](function(_0x168343){if(_0x168343[_0x7721('0x5e')]===_0x7721('0x5f')){_0x17036e[_0x7721('0x1c')](0x194)[_0x7721('0x2d')](_0x7721('0x60'));}else{return handleError(_0x17036e,null);}});};exports[_0x7721('0x2a')]=function(_0x3b03cf,_0x10666e){return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0x3b03cf[_0x7721('0x49')]['id']}})['then'](function(_0x233e5d){if(_[_0x7721('0x61')](_0x233e5d)){throw new ReferenceError(_0x7721('0x62'));}return _0x233e5d;})[_0x7721('0x29')](function(_0x542e30){var _0x103009=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x542e30['value']);logger[_0x7721('0x63')](_0x7721('0x64'),_0x103009);if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}_0x103009=_0x103009+'.cypher';if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}return _0x542e30;})['then'](function(_0xb6f2f2){if(!_0xb6f2f2)throw new InternalError();return _0xb6f2f2[_0x7721('0x2a')]();})['then'](function(){_0x10666e[_0x7721('0x1c')](0xcc)['end']();})[_0x7721('0x48')](handleError(_0x10666e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b0d32f1..c34a307 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 _0xaa84=['../../config/logger','api','moment','request-promise','../../config/environment','./screenRecording.attributes','define','interactionid','lodash'];(function(_0x1b60c9,_0x3cb8fb){var _0x571417=function(_0xa76ca0){while(--_0xa76ca0){_0x1b60c9['push'](_0x1b60c9['shift']());}};_0x571417(++_0x3cb8fb);}(_0xaa84,0x1b8));var _0x4aa8=function(_0x581b84,_0x428e00){_0x581b84=_0x581b84-0x0;var _0x1559a7=_0xaa84[_0x581b84];return _0x1559a7;};'use strict';var _=require(_0x4aa8('0x0'));var util=require('util');var logger=require(_0x4aa8('0x1'))(_0x4aa8('0x2'));var moment=require(_0x4aa8('0x3'));var BPromise=require('bluebird');var rp=require(_0x4aa8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4aa8('0x5'));var attributes=require(_0x4aa8('0x6'));module['exports']=function(_0x563684,_0x2ec1ec){return _0x563684[_0x4aa8('0x7')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x4aa8('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc41e=['ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x8d2881,_0x4a3c8f){var _0x22c610=function(_0xff3ab6){while(--_0xff3ab6){_0x8d2881['push'](_0x8d2881['shift']());}};_0x22c610(++_0x4a3c8f);}(_0xc41e,0x1b5));var _0xec41=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc41e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xec41('0x0'));var util=require(_0xec41('0x1'));var logger=require(_0xec41('0x2'))(_0xec41('0x3'));var moment=require(_0xec41('0x4'));var BPromise=require(_0xec41('0x5'));var rp=require(_0xec41('0x6'));var fs=require('fs');var path=require(_0xec41('0x7'));var rimraf=require(_0xec41('0x8'));var config=require(_0xec41('0x9'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x238f54,_0x485ee4){return _0x238f54[_0xec41('0xa')](_0xec41('0xb'),attributes,{'tableName':_0xec41('0xc'),'paranoid':![],'indexes':[{'name':_0xec41('0xd'),'fields':[_0xec41('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8d944d6..ccd2614 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 _0xa8b7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','bluebird','ioredis'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa8b7,0x97));var _0x7a8b=function(_0x221c2b,_0x79080e){_0x221c2b=_0x221c2b-0x0;var _0xe027c1=_0xa8b7[_0x221c2b];return _0xe027c1;};'use strict';var _=require(_0x7a8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7a8b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a8b('0x2'));var db=require(_0x7a8b('0x3'))['db'];var utils=require(_0x7a8b('0x4'));var logger=require(_0x7a8b('0x5'))(_0x7a8b('0x6'));var config=require(_0x7a8b('0x7'));var jayson=require(_0x7a8b('0x8'));var client=jayson[_0x7a8b('0x9')][_0x7a8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1735a7,_0x3da927,_0x30c770){return new BPromise(function(_0x5ae3e7,_0x3434dc){return client[_0x7a8b('0xb')](_0x1735a7,_0x30c770)[_0x7a8b('0xc')](function(_0x2849f3){logger[_0x7a8b('0xd')](_0x7a8b('0xe'),_0x3da927,'request\x20sent');logger['debug'](_0x7a8b('0xf'),_0x3da927,'request\x20sent',JSON[_0x7a8b('0x10')](_0x2849f3));if(_0x2849f3[_0x7a8b('0x11')]){if(_0x2849f3['error']['code']===0x1f4){logger[_0x7a8b('0x11')](_0x7a8b('0xe'),_0x3da927,_0x2849f3[_0x7a8b('0x11')]['message']);return _0x3434dc(_0x2849f3[_0x7a8b('0x11')]['message']);}logger[_0x7a8b('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x3da927,_0x2849f3[_0x7a8b('0x11')]['message']);return _0x5ae3e7(_0x2849f3[_0x7a8b('0x11')][_0x7a8b('0x12')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x3da927,_0x7a8b('0x13'));_0x5ae3e7(_0x2849f3[_0x7a8b('0x14')]['message']);}})[_0x7a8b('0x15')](function(_0x592c5e){logger[_0x7a8b('0x11')](_0x7a8b('0xe'),_0x3da927,_0x592c5e);_0x3434dc(_0x592c5e);});});} \ No newline at end of file +var _0x107b=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x107b,0x138));var _0xb107=function(_0x49c5f8,_0x223312){_0x49c5f8=_0x49c5f8-0x0;var _0x1786e1=_0x107b[_0x49c5f8];return _0x1786e1;};'use strict';var _=require(_0xb107('0x0'));var util=require(_0xb107('0x1'));var moment=require(_0xb107('0x2'));var BPromise=require(_0xb107('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb107('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb107('0x5'));var logger=require(_0xb107('0x6'))(_0xb107('0x7'));var config=require('../../config/environment');var jayson=require(_0xb107('0x8'));var client=jayson[_0xb107('0x9')][_0xb107('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f68be,_0x454324,_0x4a54e5){return new BPromise(function(_0x3ff303,_0x4979dc){return client[_0xb107('0xb')](_0x4f68be,_0x4a54e5)[_0xb107('0xc')](function(_0x5769b8){logger['info'](_0xb107('0xd'),_0x454324,'request\x20sent');logger['debug'](_0xb107('0xe'),_0x454324,_0xb107('0xf'),JSON[_0xb107('0x10')](_0x5769b8));if(_0x5769b8[_0xb107('0x11')]){if(_0x5769b8[_0xb107('0x11')][_0xb107('0x12')]===0x1f4){logger[_0xb107('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x454324,_0x5769b8['error']['message']);return _0x4979dc(_0x5769b8[_0xb107('0x11')][_0xb107('0x13')]);}logger[_0xb107('0x11')](_0xb107('0xd'),_0x454324,_0x5769b8[_0xb107('0x11')][_0xb107('0x13')]);return _0x3ff303(_0x5769b8[_0xb107('0x11')]['message']);}else{logger['info'](_0xb107('0xd'),_0x454324,_0xb107('0xf'));_0x3ff303(_0x5769b8[_0xb107('0x14')][_0xb107('0x13')]);}})[_0xb107('0x15')](function(_0x242519){logger[_0xb107('0x11')](_0xb107('0xd'),_0x454324,_0x242519);_0x4979dc(_0x242519);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index f7ee3fc..de71e15 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 _0xf1c9=['getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','logologin','addLogoLogin','preferred','single','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','getDate','/:id','/:id/logo','/:id/logo_login'];(function(_0x1042c0,_0x48acd5){var _0x50601e=function(_0x5b2f6d){while(--_0x5b2f6d){_0x1042c0['push'](_0x1042c0['shift']());}};_0x50601e(++_0x48acd5);}(_0xf1c9,0x158));var _0x9f1c=function(_0x4faaad,_0x2c421b){_0x4faaad=_0x4faaad-0x0;var _0x3a18b2=_0xf1c9[_0x4faaad];return _0x3a18b2;};'use strict';var multer=require(_0x9f1c('0x0'));var util=require(_0x9f1c('0x1'));var path=require(_0x9f1c('0x2'));var timeout=require(_0x9f1c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f1c('0x4'));var auth=require(_0x9f1c('0x5'));var interaction=require(_0x9f1c('0x6'));var config=require(_0x9f1c('0x7'));var controller=require(_0x9f1c('0x8'));router[_0x9f1c('0x9')]('/',auth[_0x9f1c('0xa')](),controller[_0x9f1c('0xb')]);router['get']('/now',controller[_0x9f1c('0xc')]);router[_0x9f1c('0x9')](_0x9f1c('0xd'),controller['show']);router[_0x9f1c('0x9')](_0x9f1c('0xe'),controller['getLogo']);router[_0x9f1c('0x9')](_0x9f1c('0xf'),controller[_0x9f1c('0x10')]);router['get'](_0x9f1c('0x11'),controller[_0x9f1c('0x12')]);router['get'](_0x9f1c('0x13'),controller[_0x9f1c('0x14')]);router[_0x9f1c('0x9')](_0x9f1c('0x15'),controller[_0x9f1c('0x16')]);var upload=multer({'storage':multer[_0x9f1c('0x17')]({'destination':function(_0x547b38,_0x1e2266,_0x5ec6d2){_0x5ec6d2(null,path[_0x9f1c('0x18')](config[_0x9f1c('0x19')],_0x9f1c('0x1a')));},'filename':function(_0x24a795,_0x4756e7,_0x10cd24){_0x10cd24(null,util[_0x9f1c('0x1b')](_0x9f1c('0x1c'),_0x9f1c('0x1d'),path[_0x9f1c('0x1e')](_0x4756e7[_0x9f1c('0x1f')])));}})});router[_0x9f1c('0x20')]('/:id/logo',upload['single'](_0x9f1c('0x21')),controller[_0x9f1c('0x22')]);var upload=multer({'storage':multer[_0x9f1c('0x17')]({'destination':function(_0x15238b,_0x58c600,_0x10f964){_0x10f964(null,path['join'](config['root'],_0x9f1c('0x1a')));},'filename':function(_0x5af82d,_0x560f86,_0x33fd71){_0x33fd71(null,util[_0x9f1c('0x1b')](_0x9f1c('0x1c'),_0x9f1c('0x23'),path[_0x9f1c('0x1e')](_0x560f86['originalname'])));}})});router[_0x9f1c('0x20')](_0x9f1c('0xf'),upload['single']('file'),controller[_0x9f1c('0x24')]);var upload=multer({'storage':multer[_0x9f1c('0x17')]({'destination':function(_0x280e60,_0x59ac22,_0xc24110){_0xc24110(null,path[_0x9f1c('0x18')](config['root'],_0x9f1c('0x1a')));},'filename':function(_0x4463c8,_0x321fce,_0x3dac8e){_0x3dac8e(null,util[_0x9f1c('0x1b')]('%s%s',_0x9f1c('0x25'),path['extname'](_0x321fce['originalname'])));}})});router['post'](_0x9f1c('0x13'),upload[_0x9f1c('0x26')](_0x9f1c('0x21')),controller[_0x9f1c('0x27')]);var upload=multer({'storage':multer[_0x9f1c('0x17')]({'destination':function(_0x2387dc,_0x570c93,_0x2c8fb5){_0x2c8fb5(null,path[_0x9f1c('0x18')](config[_0x9f1c('0x19')],_0x9f1c('0x1a')));},'filename':function(_0x162a1e,_0x2aeb37,_0x5d0955){_0x5d0955(null,util[_0x9f1c('0x1b')]('%s%s',_0x9f1c('0x28'),path[_0x9f1c('0x1e')](_0x2aeb37[_0x9f1c('0x1f')])));}})});router['post'](_0x9f1c('0x15'),upload[_0x9f1c('0x26')](_0x9f1c('0x21')),controller[_0x9f1c('0x29')]);router[_0x9f1c('0x2a')]('/:id',auth[_0x9f1c('0xa')](),controller[_0x9f1c('0x2b')]);module[_0x9f1c('0x2c')]=router; \ No newline at end of file +var _0x497c=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','root','logologin','originalname','diskStorage','preferred','favicon','update','exports','util'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x497c,0x1b7));var _0xc497=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x497c[_0x45d3f0];return _0x314b79;};'use strict';var multer=require('multer');var util=require(_0xc497('0x0'));var path=require(_0xc497('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc497('0x2')]();var fs_extra=require(_0xc497('0x3'));var auth=require(_0xc497('0x4'));var interaction=require(_0xc497('0x5'));var config=require('../../config/environment');var controller=require(_0xc497('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc497('0x7')](_0xc497('0x8'),controller[_0xc497('0x9')]);router['get'](_0xc497('0xa'),controller[_0xc497('0xb')]);router[_0xc497('0x7')](_0xc497('0xc'),controller[_0xc497('0xd')]);router[_0xc497('0x7')](_0xc497('0xe'),controller[_0xc497('0xf')]);router[_0xc497('0x7')](_0xc497('0x10'),controller[_0xc497('0x11')]);router[_0xc497('0x7')](_0xc497('0x12'),controller[_0xc497('0x13')]);router[_0xc497('0x7')](_0xc497('0x14'),controller[_0xc497('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11f27b,_0x15ebcb,_0x7700cf){_0x7700cf(null,path[_0xc497('0x16')](config['root'],_0xc497('0x17')));},'filename':function(_0x4daf40,_0x4b54f5,_0x240226){_0x240226(null,util[_0xc497('0x18')](_0xc497('0x19'),_0xc497('0x1a'),path[_0xc497('0x1b')](_0x4b54f5['originalname'])));}})});router[_0xc497('0x1c')](_0xc497('0xc'),upload[_0xc497('0x1d')](_0xc497('0x1e')),controller[_0xc497('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d1162,_0x20ce61,_0x4693a5){_0x4693a5(null,path[_0xc497('0x16')](config[_0xc497('0x20')],_0xc497('0x17')));},'filename':function(_0x1e2a42,_0x57ced1,_0x528482){_0x528482(null,util['format'](_0xc497('0x19'),_0xc497('0x21'),path['extname'](_0x57ced1[_0xc497('0x22')])));}})});router[_0xc497('0x1c')](_0xc497('0xe'),upload['single'](_0xc497('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc497('0x23')]({'destination':function(_0x2e5f14,_0x124961,_0x1d6639){_0x1d6639(null,path['join'](config['root'],_0xc497('0x17')));},'filename':function(_0x38cc74,_0x2978b8,_0x18530d){_0x18530d(null,util[_0xc497('0x18')](_0xc497('0x19'),_0xc497('0x24'),path[_0xc497('0x1b')](_0x2978b8[_0xc497('0x22')])));}})});router['post'](_0xc497('0x12'),upload[_0xc497('0x1d')](_0xc497('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc497('0x23')]({'destination':function(_0x3b288c,_0x31a1e3,_0x16ae67){_0x16ae67(null,path[_0xc497('0x16')](config['root'],_0xc497('0x17')));},'filename':function(_0x6d894b,_0x4f0dc3,_0x242d91){_0x242d91(null,util[_0xc497('0x18')](_0xc497('0x19'),_0xc497('0x25'),path[_0xc497('0x1b')](_0x4f0dc3[_0xc497('0x22')])));}})});router[_0xc497('0x1c')]('/:id/favicon',upload[_0xc497('0x1d')]('file'),controller['addFavicon']);router['put'](_0xc497('0xa'),auth['isAuthenticated'](),controller[_0xc497('0x26')]);module[_0xc497('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b082b3b..4accca3 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(_0x2c1a23,_0x37f700){var _0xc80fd8=function(_0x436404){while(--_0x436404){_0x2c1a23['push'](_0x2c1a23['shift']());}};_0xc80fd8(++_0x37f700);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x5d0073,_0x2e3556){var _0x343603=function(_0x3264da){while(--_0x3264da){_0x5d0073['push'](_0x5d0073['shift']());}};_0x343603(++_0x2e3556);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 775b223..f19fbc3 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 _0x22fd=['addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','request','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','Setting','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','upperFirst','default_logo.svg','existsSync','Sequelize','ValidationError','\x20not\x20found','download','../../config/license/util','default','custom','default_loginLogo.svg','gdpr','securePassword','addPreferred','server/files/images/logos','default_preferred.png'];(function(_0x433b93,_0x40db4f){var _0x116edd=function(_0x62fb77){while(--_0x62fb77){_0x433b93['push'](_0x433b93['shift']());}};_0x116edd(++_0x40db4f);}(_0x22fd,0x166));var _0xd22f=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x22fd[_0x5416db];return _0x243e35;};'use strict';var emlformat=require(_0xd22f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd22f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd22f('0x2'));var BPromise=require(_0xd22f('0x3'));var Mustache=require(_0xd22f('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd22f('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd22f('0x6'));var squel=require('squel');var crypto=require(_0xd22f('0x7'));var jsforce=require(_0xd22f('0x8'));var deskjs=require(_0xd22f('0x9'));var toCsv=require(_0xd22f('0x5'));var querystring=require(_0xd22f('0xa'));var Papa=require('papaparse');var Redis=require(_0xd22f('0xb'));var authService=require(_0xd22f('0xc'));var qs=require(_0xd22f('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd22f('0xe'));var logger=require(_0xd22f('0xf'))(_0xd22f('0x10'));var utils=require(_0xd22f('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd22f('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd22f('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45c7d7,_0x81274e,_0x1c56fe,_0x80cec2){return new BPromise(function(_0x5a4787,_0x562598){var _0x52678d=_0x80cec2||client;return _0x52678d[_0xd22f('0x14')](_0x45c7d7,_0x1c56fe)['then'](function(_0x10f16b){logger['info'](_0xd22f('0x15'),_0x81274e,'request\x20sent');logger['debug'](_0xd22f('0x16'),_0x81274e,_0xd22f('0x17'),JSON['stringify'](_0x10f16b));if(_0x10f16b[_0xd22f('0x18')]){if(_0x10f16b[_0xd22f('0x18')][_0xd22f('0x19')]===0x1f4){logger[_0xd22f('0x18')](_0xd22f('0x15'),_0x81274e,_0x10f16b[_0xd22f('0x18')][_0xd22f('0x1a')]);return _0x562598(_0x10f16b['error'][_0xd22f('0x1a')]);}logger[_0xd22f('0x18')](_0xd22f('0x15'),_0x81274e,_0x10f16b[_0xd22f('0x18')][_0xd22f('0x1a')]);return _0x5a4787(_0x10f16b[_0xd22f('0x18')]['message']);}else{logger[_0xd22f('0x1b')](_0xd22f('0x15'),_0x81274e,'request\x20sent');_0x5a4787(_0x10f16b['result'][_0xd22f('0x1a')]);}})[_0xd22f('0x1c')](function(_0x4d0cf2){logger[_0xd22f('0x18')](_0xd22f('0x15'),_0x81274e,_0x4d0cf2);_0x562598(_0x4d0cf2);});});}function respondWithStatusCode(_0x1aaf3d,_0x20bd97){_0x20bd97=_0x20bd97||0xcc;return function(_0x100ee3){if(_0x100ee3){return _0x1aaf3d[_0xd22f('0x1d')](_0x20bd97);}return _0x1aaf3d[_0xd22f('0x1e')](_0x20bd97)[_0xd22f('0x1f')]();};}function respondWithResult(_0x5c458a,_0xee3fc6){_0xee3fc6=_0xee3fc6||0xc8;return function(_0xa124c3){if(_0xa124c3){return _0x5c458a[_0xd22f('0x1e')](_0xee3fc6)[_0xd22f('0x20')](_0xa124c3);}};}function respondWithFilteredResult(_0x33598a,_0x4a753f){return function(_0x13044f){if(_0x13044f){var _0x301f41=typeof _0x4a753f[_0xd22f('0x21')]===_0xd22f('0x22')&&typeof _0x4a753f[_0xd22f('0x23')]===_0xd22f('0x22');var _0x547b6f=_0x13044f[_0xd22f('0x24')];var _0x356ac9=_0x301f41?0x0:_0x4a753f[_0xd22f('0x21')];var _0x295df2=_0x301f41?_0x13044f['count']:_0x4a753f[_0xd22f('0x21')]+_0x4a753f[_0xd22f('0x23')];var _0x1a6054;if(_0x295df2>=_0x547b6f){_0x295df2=_0x547b6f;_0x1a6054=0xc8;}else{_0x1a6054=0xce;}_0x33598a[_0xd22f('0x1e')](_0x1a6054);return _0x33598a['set'](_0xd22f('0x25'),_0x356ac9+'-'+_0x295df2+'/'+_0x547b6f)[_0xd22f('0x20')](_0x13044f);}return null;};}function patchUpdates(_0x3ddf58){return function(_0x3b5c36){try{jsonpatch[_0xd22f('0x26')](_0x3b5c36,_0x3ddf58,!![]);}catch(_0x47e269){return BPromise[_0xd22f('0x27')](_0x47e269);}return _0x3b5c36[_0xd22f('0x28')]();};}function saveUpdates(_0x51ea25,_0x31b159){return function(_0x2f7f93){if(_0x2f7f93){return _0x2f7f93[_0xd22f('0x29')](_0x51ea25)[_0xd22f('0x2a')](function(_0x122f81){return _0x122f81;});}return null;};}function removeEntity(_0x1f5cbf,_0x403add){return function(_0x1126c2){if(_0x1126c2){return _0x1126c2[_0xd22f('0x2b')]()[_0xd22f('0x2a')](function(){_0x1f5cbf[_0xd22f('0x1e')](0xcc)[_0xd22f('0x1f')]();});}};}function handleEntityNotFound(_0x160acf,_0x53fd2d){return function(_0x2c6697){if(!_0x2c6697){_0x160acf[_0xd22f('0x1d')](0x194);}return _0x2c6697;};}function handleError(_0x342826,_0x39439b){_0x39439b=_0x39439b||0x1f4;return function(_0x339996){logger[_0xd22f('0x18')](_0x339996[_0xd22f('0x2c')]);if(_0x339996[_0xd22f('0x2d')]){delete _0x339996[_0xd22f('0x2d')];}_0x342826[_0xd22f('0x1e')](_0x39439b)['send'](_0x339996);};}exports['index']=function(_0x2898a5,_0xe583c8){var _0x25f4e7={},_0x58c64a={},_0x377f32={'count':0x0,'rows':[]};var _0x4a812b=_[_0xd22f('0x2e')](db[_0xd22f('0x2f')]['rawAttributes'],function(_0x203b9a){return{'name':_0x203b9a[_0xd22f('0x30')],'type':_0x203b9a[_0xd22f('0x31')][_0xd22f('0x32')]};});_0x58c64a[_0xd22f('0x33')]=_[_0xd22f('0x2e')](_0x4a812b,_0xd22f('0x2d'));_0x58c64a['query']=_[_0xd22f('0x34')](_0x2898a5[_0xd22f('0x35')]);_0x58c64a[_0xd22f('0x36')]=_[_0xd22f('0x37')](_0x58c64a['model'],_0x58c64a[_0xd22f('0x35')]);_0x25f4e7[_0xd22f('0x38')]=_[_0xd22f('0x37')](_0x58c64a['model'],qs[_0xd22f('0x39')](_0x2898a5[_0xd22f('0x35')][_0xd22f('0x39')]));_0x25f4e7['attributes']=_0x25f4e7[_0xd22f('0x38')][_0xd22f('0x3a')]?_0x25f4e7[_0xd22f('0x38')]:_0x58c64a[_0xd22f('0x33')];if(!_0x2898a5[_0xd22f('0x35')]['hasOwnProperty'](_0xd22f('0x3b'))){_0x25f4e7[_0xd22f('0x23')]=qs[_0xd22f('0x23')](_0x2898a5[_0xd22f('0x35')][_0xd22f('0x23')]);_0x25f4e7[_0xd22f('0x21')]=qs[_0xd22f('0x21')](_0x2898a5[_0xd22f('0x35')][_0xd22f('0x21')]);}_0x25f4e7[_0xd22f('0x3c')]=qs[_0xd22f('0x3d')](_0x2898a5[_0xd22f('0x35')][_0xd22f('0x3d')]);_0x25f4e7[_0xd22f('0x3e')]=qs[_0xd22f('0x36')](_[_0xd22f('0x3f')](_0x2898a5[_0xd22f('0x35')],_0x58c64a[_0xd22f('0x36')]),_0x4a812b);if(_0x2898a5['query'][_0xd22f('0x40')]){_0x25f4e7['where']=_[_0xd22f('0x41')](_0x25f4e7[_0xd22f('0x3e')],{'$or':_[_0xd22f('0x2e')](_0x4a812b,function(_0x21501f){if(_0x21501f[_0xd22f('0x31')]!==_0xd22f('0x42')){var _0x2753e0={};_0x2753e0[_0x21501f[_0xd22f('0x2d')]]={'$like':'%'+_0x2898a5[_0xd22f('0x35')]['filter']+'%'};return _0x2753e0;}})});}_0x25f4e7=_[_0xd22f('0x41')]({},_0x25f4e7,_0x2898a5['options']);var _0xe2fd1d={'where':_0x25f4e7[_0xd22f('0x3e')]};return db[_0xd22f('0x2f')][_0xd22f('0x24')](_0xe2fd1d)[_0xd22f('0x2a')](function(_0x23f18d){_0x377f32[_0xd22f('0x24')]=_0x23f18d;if(_0x2898a5[_0xd22f('0x35')][_0xd22f('0x43')]){_0x25f4e7[_0xd22f('0x44')]=[{'all':!![]}];}return db['Setting'][_0xd22f('0x45')](_0x25f4e7);})['then'](function(_0x16f6e){_0x377f32[_0xd22f('0x46')]=_0x16f6e;return _0x377f32;})['then'](respondWithFilteredResult(_0xe583c8,_0x25f4e7))['catch'](handleError(_0xe583c8,null));};exports[_0xd22f('0x47')]=function(_0x212b05,_0x5a1885){var _0xbd661b={'raw':![],'where':{'id':_0x212b05[_0xd22f('0x48')]['id']}},_0x5fc31d={};_0x5fc31d[_0xd22f('0x33')]=_[_0xd22f('0x34')](db[_0xd22f('0x2f')][_0xd22f('0x49')]);_0x5fc31d[_0xd22f('0x35')]=_[_0xd22f('0x34')](_0x212b05[_0xd22f('0x35')]);_0x5fc31d['filters']=_[_0xd22f('0x37')](_0x5fc31d[_0xd22f('0x33')],_0x5fc31d[_0xd22f('0x35')]);_0xbd661b[_0xd22f('0x38')]=_[_0xd22f('0x37')](_0x5fc31d[_0xd22f('0x33')],qs[_0xd22f('0x39')](_0x212b05[_0xd22f('0x35')][_0xd22f('0x39')]));_0xbd661b['attributes']=_0xbd661b['attributes'][_0xd22f('0x3a')]?_0xbd661b[_0xd22f('0x38')]:_0x5fc31d[_0xd22f('0x33')];if(_0x212b05['query'][_0xd22f('0x43')]){_0xbd661b[_0xd22f('0x44')]=[{'all':!![]}];}_0xbd661b=_['merge']({},_0xbd661b,_0x212b05[_0xd22f('0x4a')]);return db[_0xd22f('0x2f')][_0xd22f('0x4b')](_0xbd661b)[_0xd22f('0x2a')](handleEntityNotFound(_0x5a1885,null))[_0xd22f('0x2a')](respondWithResult(_0x5a1885,null))[_0xd22f('0x1c')](handleError(_0x5a1885,null));};exports[_0xd22f('0x29')]=function(_0x121485,_0x2a4e66){if(_0x121485[_0xd22f('0x4c')]['id']){delete _0x121485['body']['id'];}return db['Setting'][_0xd22f('0x4b')]({'where':{'id':_0x121485[_0xd22f('0x48')]['id']}})[_0xd22f('0x2a')](handleEntityNotFound(_0x2a4e66,null))[_0xd22f('0x2a')](saveUpdates(_0x121485[_0xd22f('0x4c')],null))[_0xd22f('0x2a')](respondWithResult(_0x2a4e66,null))['catch'](handleError(_0x2a4e66,null));};exports[_0xd22f('0x4d')]=function(_0x4b907f,_0x2ea08c,_0x79cff){if(_0x4b907f[_0xd22f('0x4e')]&&_0x4b907f['file'][_0xd22f('0x4f')]){_0x4b907f[_0xd22f('0x4c')][_0xd22f('0x50')]=_0x4b907f[_0xd22f('0x4e')][_0xd22f('0x4f')];}return db['Setting'][_0xd22f('0x4b')]({'where':{'id':_0x4b907f[_0xd22f('0x48')]['id']}})[_0xd22f('0x2a')](handleEntityNotFound(_0x2ea08c,null))[_0xd22f('0x2a')](saveUpdates(_0x4b907f[_0xd22f('0x4c')],null))[_0xd22f('0x2a')](respondWithResult(_0x2ea08c,null))['catch'](handleError(_0x2ea08c,null));};exports[_0xd22f('0x51')]=function(_0x53f208,_0x24cbad,_0x250dce){if(_0x53f208[_0xd22f('0x4e')]&&_0x53f208[_0xd22f('0x4e')]['filename']){_0x53f208[_0xd22f('0x4c')][_0xd22f('0x52')]=_0x53f208[_0xd22f('0x4e')][_0xd22f('0x4f')];}return db[_0xd22f('0x2f')][_0xd22f('0x4b')]({'where':{'id':_0x53f208[_0xd22f('0x48')]['id']}})['then'](handleEntityNotFound(_0x24cbad,null))[_0xd22f('0x2a')](saveUpdates(_0x53f208['body'],null))['then'](respondWithResult(_0x24cbad,null))[_0xd22f('0x1c')](handleError(_0x24cbad,null));};var utilLicense=require('../../config/license/util');exports[_0xd22f('0x53')]=function(_0x3fbc29,_0x3c9bb7,_0x30036a){var _0x592bfb='server/files/images/logos';var _0xd10a29={'custom':![]};return utilLicense[_0xd22f('0x54')]()[_0xd22f('0x2a')](function(_0x97615b){if(_0x97615b){_0xd10a29=_0x97615b;}return db[_0xd22f('0x2f')][_0xd22f('0x4b')]({'where':{'id':_0x3fbc29[_0xd22f('0x48')]['id']},'attributes':[_0xd22f('0x50'),'loginLogo',_0xd22f('0x55'),_0xd22f('0x56'),_0xd22f('0x57'),_0xd22f('0x58'),_0xd22f('0x59'),_0xd22f('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x3c9bb7,null))[_0xd22f('0x2a')](function(_0x2433a7){if(_0x2433a7){var _0x4a6ff5=_0x2433a7[_0xd22f('0x50')]&&fs['existsSync'](path[_0xd22f('0x5b')](config['root'],_0x592bfb,_[_0xd22f('0x5c')](_0x2433a7['logo'])))?path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x592bfb,_[_0xd22f('0x5c')](_0x2433a7[_0xd22f('0x50')])):path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x592bfb,_[_0xd22f('0x5c')]('default_logo.svg'));var _0x1a604f='default'+_[_0xd22f('0x5e')]('logo');if(_0x2433a7[_0x1a604f]||!_0xd10a29['custom']){_0x4a6ff5=path['join'](config[_0xd22f('0x5d')],_0x592bfb,_['toLower'](_0xd22f('0x5f')));}if(!fs[_0xd22f('0x60')](_0x4a6ff5)){throw new db[(_0xd22f('0x61'))][(_0xd22f('0x62'))](_[_0xd22f('0x5e')]('logo')+_0xd22f('0x63'));}return _0x3c9bb7[_0xd22f('0x64')](_0x4a6ff5);}})['catch'](handleError(_0x3c9bb7,null));};var utilLicense=require(_0xd22f('0x65'));exports['getLogoLogin']=function(_0x478c4b,_0x216c18,_0x30313c){var _0x49fc89='server/files/images/logos';var _0x1549a1={'custom':![]};return utilLicense[_0xd22f('0x54')]()[_0xd22f('0x2a')](function(_0x1389c4){if(_0x1389c4){_0x1549a1=_0x1389c4;}return db[_0xd22f('0x2f')]['find']({'where':{'id':_0x478c4b[_0xd22f('0x48')]['id']},'attributes':[_0xd22f('0x50'),_0xd22f('0x52'),_0xd22f('0x55'),_0xd22f('0x56'),'defaultLogo',_0xd22f('0x58'),_0xd22f('0x59'),_0xd22f('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x216c18,null))['then'](function(_0x5cf41b){if(_0x5cf41b){var _0x3a4169=_0x5cf41b[_0xd22f('0x52')]&&fs[_0xd22f('0x60')](path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x49fc89,_[_0xd22f('0x5c')](_0x5cf41b[_0xd22f('0x52')])))?path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x49fc89,_[_0xd22f('0x5c')](_0x5cf41b[_0xd22f('0x52')])):path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x49fc89,_[_0xd22f('0x5c')]('default_loginLogo.svg'));var _0x2173b1=_0xd22f('0x66')+_[_0xd22f('0x5e')]('loginLogo');if(_0x5cf41b[_0x2173b1]||!_0x1549a1[_0xd22f('0x67')]){_0x3a4169=path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x49fc89,_[_0xd22f('0x5c')](_0xd22f('0x68')));}if(!fs['existsSync'](_0x3a4169)){throw new db[(_0xd22f('0x61'))][(_0xd22f('0x62'))](_[_0xd22f('0x5e')](_0xd22f('0x52'))+_0xd22f('0x63'));}return _0x216c18[_0xd22f('0x64')](_0x3a4169);}})[_0xd22f('0x1c')](handleError(_0x216c18,null));};exports[_0xd22f('0x69')]=function(_0x1fb186,_0x4725d6){return db[_0xd22f('0x2f')][_0xd22f('0x4b')]({'where':{'id':_0x1fb186['params']['id']},'attributes':[_0xd22f('0x6a')]})[_0xd22f('0x2a')](respondWithResult(_0x4725d6,null))[_0xd22f('0x1c')](handleError(_0x4725d6,null));};exports[_0xd22f('0x6b')]=function(_0x8a4a28,_0x4f81ef,_0x22a064){if(_0x8a4a28[_0xd22f('0x4e')]&&_0x8a4a28['file'][_0xd22f('0x4f')]){_0x8a4a28[_0xd22f('0x4c')][_0xd22f('0x55')]=_0x8a4a28[_0xd22f('0x4e')][_0xd22f('0x4f')];}return db[_0xd22f('0x2f')][_0xd22f('0x4b')]({'where':{'id':_0x8a4a28['params']['id']}})['then'](handleEntityNotFound(_0x4f81ef,null))['then'](saveUpdates(_0x8a4a28[_0xd22f('0x4c')],null))[_0xd22f('0x2a')](respondWithResult(_0x4f81ef,null))['catch'](handleError(_0x4f81ef,null));};var utilLicense=require(_0xd22f('0x65'));exports['getPreferred']=function(_0x16c0cf,_0x2b8470,_0x3faa09){var _0x13a5ad=_0xd22f('0x6c');var _0x4dc58f={'custom':![]};return utilLicense[_0xd22f('0x54')]()[_0xd22f('0x2a')](function(_0x573ec5){if(_0x573ec5){_0x4dc58f=_0x573ec5;}return db[_0xd22f('0x2f')][_0xd22f('0x4b')]({'where':{'id':_0x16c0cf['params']['id']},'attributes':[_0xd22f('0x50'),_0xd22f('0x52'),_0xd22f('0x55'),_0xd22f('0x56'),'defaultLogo',_0xd22f('0x58'),'defaultPreferred',_0xd22f('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x2b8470,null))[_0xd22f('0x2a')](function(_0x14efc6){if(_0x14efc6){var _0x661923=_0x14efc6[_0xd22f('0x55')]&&fs[_0xd22f('0x60')](path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x13a5ad,_['toLower'](_0x14efc6['preferred'])))?path[_0xd22f('0x5b')](config['root'],_0x13a5ad,_[_0xd22f('0x5c')](_0x14efc6[_0xd22f('0x55')])):path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x13a5ad,_[_0xd22f('0x5c')](_0xd22f('0x6d')));var _0x2a0b7c=_0xd22f('0x66')+_[_0xd22f('0x5e')](_0xd22f('0x55'));if(_0x14efc6[_0x2a0b7c]||!_0x4dc58f[_0xd22f('0x67')]||!_0x4dc58f['preferred']){_0x661923=path['join'](config[_0xd22f('0x5d')],_0x13a5ad,_[_0xd22f('0x5c')](_0xd22f('0x6d')));}if(!fs['existsSync'](_0x661923)){throw new db[(_0xd22f('0x61'))][(_0xd22f('0x62'))](_[_0xd22f('0x5e')](_0xd22f('0x55'))+_0xd22f('0x63'));}return _0x2b8470[_0xd22f('0x64')](_0x661923);}})['catch'](handleError(_0x2b8470,null));};exports[_0xd22f('0x6e')]=function(_0x2896a6,_0x53689e,_0xbda1a6){if(_0x2896a6[_0xd22f('0x4e')]&&_0x2896a6['file'][_0xd22f('0x4f')]){_0x2896a6[_0xd22f('0x4c')][_0xd22f('0x56')]=_0x2896a6[_0xd22f('0x4e')][_0xd22f('0x4f')];}return db['Setting'][_0xd22f('0x4b')]({'where':{'id':_0x2896a6[_0xd22f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53689e,null))[_0xd22f('0x2a')](saveUpdates(_0x2896a6['body'],null))[_0xd22f('0x2a')](respondWithResult(_0x53689e,null))[_0xd22f('0x1c')](handleError(_0x53689e,null));};var utilLicense=require(_0xd22f('0x65'));exports[_0xd22f('0x6f')]=function(_0x39dd08,_0x5d4c00,_0x16060){var _0x1cc59c=_0xd22f('0x6c');var _0x2770b1={'custom':![]};return utilLicense[_0xd22f('0x54')]()[_0xd22f('0x2a')](function(_0x4dbb2b){if(_0x4dbb2b){_0x2770b1=_0x4dbb2b;}return db[_0xd22f('0x2f')][_0xd22f('0x4b')]({'where':{'id':_0x39dd08['params']['id']},'attributes':['logo',_0xd22f('0x52'),'preferred',_0xd22f('0x56'),'defaultLogo',_0xd22f('0x58'),_0xd22f('0x59'),_0xd22f('0x5a')],'raw':!![]});})[_0xd22f('0x2a')](handleEntityNotFound(_0x5d4c00,null))[_0xd22f('0x2a')](function(_0x4155ed){if(_0x4155ed){var _0x5c3a0a=_0x4155ed[_0xd22f('0x56')]&&fs[_0xd22f('0x60')](path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x1cc59c,_[_0xd22f('0x5c')](_0x4155ed[_0xd22f('0x56')])))?path['join'](config[_0xd22f('0x5d')],_0x1cc59c,_[_0xd22f('0x5c')](_0x4155ed[_0xd22f('0x56')])):path[_0xd22f('0x5b')](config['root'],_0x1cc59c,_[_0xd22f('0x5c')](_0xd22f('0x70')));var _0x20f30a=_0xd22f('0x66')+_[_0xd22f('0x5e')](_0xd22f('0x56'));if(_0x4155ed[_0x20f30a]||!_0x2770b1[_0xd22f('0x67')]){_0x5c3a0a=path[_0xd22f('0x5b')](config[_0xd22f('0x5d')],_0x1cc59c,_[_0xd22f('0x5c')](_0xd22f('0x70')));}if(!fs[_0xd22f('0x60')](_0x5c3a0a)){throw new db[(_0xd22f('0x61'))][(_0xd22f('0x62'))](_['upperFirst'](_0xd22f('0x56'))+_0xd22f('0x63'));}return _0x5d4c00[_0xd22f('0x64')](_0x5c3a0a);}})[_0xd22f('0x1c')](handleError(_0x5d4c00,null));};exports[_0xd22f('0x71')]=function(_0x2c54ac,_0x5df964){var _0x33d0f9={'offset':moment()[_0xd22f('0x72')]()};_0x33d0f9['now']=moment()[_0xd22f('0x72')](_0x33d0f9[_0xd22f('0x21')])['format'](_0xd22f('0x73'));return _0x5df964['status'](0xc8)[_0xd22f('0x74')](_0x33d0f9);}; \ No newline at end of file +var _0xf3c0=['utcOffset','now','format','send','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','then','sendStatus','stack','name','map','Setting','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','include','rows','show','includeAll','options','update','body','find','params','addLogo','file','logo','addLogoLogin','loginLogo','filename','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','Sequelize','addFavicon','getFavicon','defaultPreferred','default_favicon.ico'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xf3c0,0x77));var _0x0f3c=function(_0x570981,_0x4cbc05){_0x570981=_0x570981-0x0;var _0x2f611b=_0xf3c0[_0x570981];return _0x2f611b;};'use strict';var emlformat=require(_0x0f3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f3c('0x1'));var jsonpatch=require(_0x0f3c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f3c('0x3'));var Mustache=require(_0x0f3c('0x4'));var util=require('util');var path=require(_0x0f3c('0x5'));var sox=require('sox');var csv=require(_0x0f3c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f3c('0x7'));var _=require('lodash');var squel=require(_0x0f3c('0x8'));var crypto=require(_0x0f3c('0x9'));var jsforce=require(_0x0f3c('0xa'));var deskjs=require(_0x0f3c('0xb'));var toCsv=require(_0x0f3c('0x6'));var querystring=require('querystring');var Papa=require(_0x0f3c('0xc'));var Redis=require('ioredis');var authService=require(_0x0f3c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0f3c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f3c('0xf'))(_0x0f3c('0x10'));var utils=require('../../config/utils');var config=require(_0x0f3c('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f3c('0x12'))['db'];var jayson=require(_0x0f3c('0x13'));var client=jayson[_0x0f3c('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8907,_0x30fd6e,_0x5292b4,_0xb56e36){return new BPromise(function(_0x461c4d,_0x5abfbb){var _0x5dc4ca=_0xb56e36||client;return _0x5dc4ca[_0x0f3c('0x15')](_0x2d8907,_0x5292b4)['then'](function(_0x23f1d1){logger['info'](_0x0f3c('0x16'),_0x30fd6e,_0x0f3c('0x17'));logger['debug'](_0x0f3c('0x18'),_0x30fd6e,_0x0f3c('0x17'),JSON[_0x0f3c('0x19')](_0x23f1d1));if(_0x23f1d1['error']){if(_0x23f1d1['error'][_0x0f3c('0x1a')]===0x1f4){logger[_0x0f3c('0x1b')](_0x0f3c('0x16'),_0x30fd6e,_0x23f1d1['error']['message']);return _0x5abfbb(_0x23f1d1[_0x0f3c('0x1b')][_0x0f3c('0x1c')]);}logger['error']('Setting,\x20%s,\x20%s',_0x30fd6e,_0x23f1d1[_0x0f3c('0x1b')]['message']);return _0x461c4d(_0x23f1d1['error'][_0x0f3c('0x1c')]);}else{logger['info'](_0x0f3c('0x16'),_0x30fd6e,_0x0f3c('0x17'));_0x461c4d(_0x23f1d1['result']['message']);}})[_0x0f3c('0x1d')](function(_0x19e89c){logger[_0x0f3c('0x1b')](_0x0f3c('0x16'),_0x30fd6e,_0x19e89c);_0x5abfbb(_0x19e89c);});});}function respondWithStatusCode(_0x1eaedd,_0x39d8ed){_0x39d8ed=_0x39d8ed||0xcc;return function(_0x308857){if(_0x308857){return _0x1eaedd['sendStatus'](_0x39d8ed);}return _0x1eaedd[_0x0f3c('0x1e')](_0x39d8ed)[_0x0f3c('0x1f')]();};}function respondWithResult(_0x140ce9,_0x1b500a){_0x1b500a=_0x1b500a||0xc8;return function(_0x4a8f70){if(_0x4a8f70){return _0x140ce9[_0x0f3c('0x1e')](_0x1b500a)['json'](_0x4a8f70);}};}function respondWithFilteredResult(_0x53df92,_0x55f743){return function(_0x4ccc3e){if(_0x4ccc3e){var _0x2f4875=typeof _0x55f743[_0x0f3c('0x20')]===_0x0f3c('0x21')&&typeof _0x55f743['limit']===_0x0f3c('0x21');var _0x1626b6=_0x4ccc3e[_0x0f3c('0x22')];var _0x248446=_0x2f4875?0x0:_0x55f743[_0x0f3c('0x20')];var _0x335a84=_0x2f4875?_0x4ccc3e[_0x0f3c('0x22')]:_0x55f743[_0x0f3c('0x20')]+_0x55f743[_0x0f3c('0x23')];var _0xed6027;if(_0x335a84>=_0x1626b6){_0x335a84=_0x1626b6;_0xed6027=0xc8;}else{_0xed6027=0xce;}_0x53df92[_0x0f3c('0x1e')](_0xed6027);return _0x53df92[_0x0f3c('0x24')](_0x0f3c('0x25'),_0x248446+'-'+_0x335a84+'/'+_0x1626b6)[_0x0f3c('0x26')](_0x4ccc3e);}return null;};}function patchUpdates(_0x10dda1){return function(_0x522694){try{jsonpatch['apply'](_0x522694,_0x10dda1,!![]);}catch(_0x162af3){return BPromise[_0x0f3c('0x27')](_0x162af3);}return _0x522694['save']();};}function saveUpdates(_0x32d446,_0x3e9cd7){return function(_0x226d57){if(_0x226d57){return _0x226d57['update'](_0x32d446)[_0x0f3c('0x28')](function(_0x510c3e){return _0x510c3e;});}return null;};}function removeEntity(_0x350a7c,_0xd1b3b5){return function(_0x3c58eb){if(_0x3c58eb){return _0x3c58eb['destroy']()[_0x0f3c('0x28')](function(){_0x350a7c[_0x0f3c('0x1e')](0xcc)[_0x0f3c('0x1f')]();});}};}function handleEntityNotFound(_0x2d55e6,_0x48377e){return function(_0xab2662){if(!_0xab2662){_0x2d55e6[_0x0f3c('0x29')](0x194);}return _0xab2662;};}function handleError(_0x1c9df1,_0x29a0c5){_0x29a0c5=_0x29a0c5||0x1f4;return function(_0x3a51ad){logger['error'](_0x3a51ad[_0x0f3c('0x2a')]);if(_0x3a51ad[_0x0f3c('0x2b')]){delete _0x3a51ad[_0x0f3c('0x2b')];}_0x1c9df1['status'](_0x29a0c5)['send'](_0x3a51ad);};}exports['index']=function(_0x439310,_0xdb5315){var _0x5c0807={},_0x17a175={},_0xff7b87={'count':0x0,'rows':[]};var _0x13d233=_[_0x0f3c('0x2c')](db[_0x0f3c('0x2d')]['rawAttributes'],function(_0x1a1cee){return{'name':_0x1a1cee[_0x0f3c('0x2e')],'type':_0x1a1cee[_0x0f3c('0x2f')][_0x0f3c('0x30')]};});_0x17a175['model']=_[_0x0f3c('0x2c')](_0x13d233,_0x0f3c('0x2b'));_0x17a175[_0x0f3c('0x31')]=_[_0x0f3c('0x32')](_0x439310['query']);_0x17a175[_0x0f3c('0x33')]=_[_0x0f3c('0x34')](_0x17a175[_0x0f3c('0x35')],_0x17a175[_0x0f3c('0x31')]);_0x5c0807[_0x0f3c('0x36')]=_[_0x0f3c('0x34')](_0x17a175[_0x0f3c('0x35')],qs[_0x0f3c('0x37')](_0x439310['query'][_0x0f3c('0x37')]));_0x5c0807[_0x0f3c('0x36')]=_0x5c0807[_0x0f3c('0x36')][_0x0f3c('0x38')]?_0x5c0807[_0x0f3c('0x36')]:_0x17a175[_0x0f3c('0x35')];if(!_0x439310[_0x0f3c('0x31')][_0x0f3c('0x39')](_0x0f3c('0x3a'))){_0x5c0807[_0x0f3c('0x23')]=qs[_0x0f3c('0x23')](_0x439310[_0x0f3c('0x31')][_0x0f3c('0x23')]);_0x5c0807[_0x0f3c('0x20')]=qs[_0x0f3c('0x20')](_0x439310[_0x0f3c('0x31')]['offset']);}_0x5c0807[_0x0f3c('0x3b')]=qs[_0x0f3c('0x3c')](_0x439310['query'][_0x0f3c('0x3c')]);_0x5c0807[_0x0f3c('0x3d')]=qs['filters'](_[_0x0f3c('0x3e')](_0x439310[_0x0f3c('0x31')],_0x17a175['filters']),_0x13d233);if(_0x439310['query']['filter']){_0x5c0807[_0x0f3c('0x3d')]=_[_0x0f3c('0x3f')](_0x5c0807[_0x0f3c('0x3d')],{'$or':_[_0x0f3c('0x2c')](_0x13d233,function(_0x289142){if(_0x289142[_0x0f3c('0x2f')]!==_0x0f3c('0x40')){var _0xd13fc7={};_0xd13fc7[_0x289142[_0x0f3c('0x2b')]]={'$like':'%'+_0x439310['query']['filter']+'%'};return _0xd13fc7;}})});}_0x5c0807=_[_0x0f3c('0x3f')]({},_0x5c0807,_0x439310['options']);var _0x748f3a={'where':_0x5c0807[_0x0f3c('0x3d')]};return db['Setting'][_0x0f3c('0x22')](_0x748f3a)['then'](function(_0x11bac3){_0xff7b87['count']=_0x11bac3;if(_0x439310[_0x0f3c('0x31')]['includeAll']){_0x5c0807[_0x0f3c('0x41')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x5c0807);})[_0x0f3c('0x28')](function(_0x3e30d7){_0xff7b87[_0x0f3c('0x42')]=_0x3e30d7;return _0xff7b87;})[_0x0f3c('0x28')](respondWithFilteredResult(_0xdb5315,_0x5c0807))[_0x0f3c('0x1d')](handleError(_0xdb5315,null));};exports[_0x0f3c('0x43')]=function(_0x43ab11,_0x2d62a7){var _0x256af1={'raw':![],'where':{'id':_0x43ab11['params']['id']}},_0x3d7b4e={};_0x3d7b4e[_0x0f3c('0x35')]=_[_0x0f3c('0x32')](db['Setting']['rawAttributes']);_0x3d7b4e[_0x0f3c('0x31')]=_[_0x0f3c('0x32')](_0x43ab11[_0x0f3c('0x31')]);_0x3d7b4e[_0x0f3c('0x33')]=_['intersection'](_0x3d7b4e['model'],_0x3d7b4e[_0x0f3c('0x31')]);_0x256af1['attributes']=_[_0x0f3c('0x34')](_0x3d7b4e[_0x0f3c('0x35')],qs[_0x0f3c('0x37')](_0x43ab11['query'][_0x0f3c('0x37')]));_0x256af1[_0x0f3c('0x36')]=_0x256af1[_0x0f3c('0x36')][_0x0f3c('0x38')]?_0x256af1[_0x0f3c('0x36')]:_0x3d7b4e['model'];if(_0x43ab11[_0x0f3c('0x31')][_0x0f3c('0x44')]){_0x256af1[_0x0f3c('0x41')]=[{'all':!![]}];}_0x256af1=_[_0x0f3c('0x3f')]({},_0x256af1,_0x43ab11[_0x0f3c('0x45')]);return db[_0x0f3c('0x2d')]['find'](_0x256af1)['then'](handleEntityNotFound(_0x2d62a7,null))['then'](respondWithResult(_0x2d62a7,null))['catch'](handleError(_0x2d62a7,null));};exports[_0x0f3c('0x46')]=function(_0xf5cefd,_0x54395b){if(_0xf5cefd[_0x0f3c('0x47')]['id']){delete _0xf5cefd[_0x0f3c('0x47')]['id'];}return db['Setting'][_0x0f3c('0x48')]({'where':{'id':_0xf5cefd[_0x0f3c('0x49')]['id']}})[_0x0f3c('0x28')](handleEntityNotFound(_0x54395b,null))[_0x0f3c('0x28')](saveUpdates(_0xf5cefd[_0x0f3c('0x47')],null))[_0x0f3c('0x28')](respondWithResult(_0x54395b,null))[_0x0f3c('0x1d')](handleError(_0x54395b,null));};exports[_0x0f3c('0x4a')]=function(_0x4ca635,_0x4bb6dd,_0x51c1b6){if(_0x4ca635[_0x0f3c('0x4b')]&&_0x4ca635['file']['filename']){_0x4ca635['body'][_0x0f3c('0x4c')]=_0x4ca635['file']['filename'];}return db[_0x0f3c('0x2d')][_0x0f3c('0x48')]({'where':{'id':_0x4ca635[_0x0f3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x4bb6dd,null))[_0x0f3c('0x28')](saveUpdates(_0x4ca635[_0x0f3c('0x47')],null))[_0x0f3c('0x28')](respondWithResult(_0x4bb6dd,null))[_0x0f3c('0x1d')](handleError(_0x4bb6dd,null));};exports[_0x0f3c('0x4d')]=function(_0x3501f0,_0x34beee,_0x323ab4){if(_0x3501f0[_0x0f3c('0x4b')]&&_0x3501f0[_0x0f3c('0x4b')]['filename']){_0x3501f0[_0x0f3c('0x47')][_0x0f3c('0x4e')]=_0x3501f0[_0x0f3c('0x4b')][_0x0f3c('0x4f')];}return db[_0x0f3c('0x2d')]['find']({'where':{'id':_0x3501f0[_0x0f3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x34beee,null))[_0x0f3c('0x28')](saveUpdates(_0x3501f0[_0x0f3c('0x47')],null))['then'](respondWithResult(_0x34beee,null))[_0x0f3c('0x1d')](handleError(_0x34beee,null));};var utilLicense=require(_0x0f3c('0x50'));exports[_0x0f3c('0x51')]=function(_0x3d11e3,_0x2b672c,_0x317f55){var _0x9d0ec=_0x0f3c('0x52');var _0x3d6cee={'custom':![]};return utilLicense[_0x0f3c('0x53')]()[_0x0f3c('0x28')](function(_0x329e35){if(_0x329e35){_0x3d6cee=_0x329e35;}return db[_0x0f3c('0x2d')][_0x0f3c('0x48')]({'where':{'id':_0x3d11e3[_0x0f3c('0x49')]['id']},'attributes':[_0x0f3c('0x4c'),_0x0f3c('0x4e'),_0x0f3c('0x54'),_0x0f3c('0x55'),_0x0f3c('0x56'),_0x0f3c('0x57'),'defaultPreferred',_0x0f3c('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x2b672c,null))['then'](function(_0x237428){if(_0x237428){var _0x36991c=_0x237428[_0x0f3c('0x4c')]&&fs[_0x0f3c('0x59')](path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x9d0ec,_[_0x0f3c('0x5c')](_0x237428[_0x0f3c('0x4c')])))?path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x9d0ec,_[_0x0f3c('0x5c')](_0x237428[_0x0f3c('0x4c')])):path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x9d0ec,_[_0x0f3c('0x5c')]('default_logo.svg'));var _0x32535a=_0x0f3c('0x5d')+_[_0x0f3c('0x5e')](_0x0f3c('0x4c'));if(_0x237428[_0x32535a]||!_0x3d6cee[_0x0f3c('0x5f')]){_0x36991c=path[_0x0f3c('0x5a')](config['root'],_0x9d0ec,_[_0x0f3c('0x5c')](_0x0f3c('0x60')));}if(!fs[_0x0f3c('0x59')](_0x36991c)){throw new db['Sequelize'][(_0x0f3c('0x61'))](_[_0x0f3c('0x5e')](_0x0f3c('0x4c'))+_0x0f3c('0x62'));}return _0x2b672c[_0x0f3c('0x63')](_0x36991c);}})[_0x0f3c('0x1d')](handleError(_0x2b672c,null));};var utilLicense=require(_0x0f3c('0x50'));exports[_0x0f3c('0x64')]=function(_0x3d9a14,_0x213b18,_0x221362){var _0x5c9159=_0x0f3c('0x52');var _0x31eb92={'custom':![]};return utilLicense['getLicense']()[_0x0f3c('0x28')](function(_0x199365){if(_0x199365){_0x31eb92=_0x199365;}return db[_0x0f3c('0x2d')][_0x0f3c('0x48')]({'where':{'id':_0x3d9a14['params']['id']},'attributes':[_0x0f3c('0x4c'),_0x0f3c('0x4e'),_0x0f3c('0x54'),_0x0f3c('0x55'),_0x0f3c('0x56'),'defaultLoginLogo','defaultPreferred',_0x0f3c('0x58')],'raw':!![]});})[_0x0f3c('0x28')](handleEntityNotFound(_0x213b18,null))[_0x0f3c('0x28')](function(_0x47adb6){if(_0x47adb6){var _0x34417d=_0x47adb6[_0x0f3c('0x4e')]&&fs[_0x0f3c('0x59')](path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x5c9159,_[_0x0f3c('0x5c')](_0x47adb6[_0x0f3c('0x4e')])))?path[_0x0f3c('0x5a')](config['root'],_0x5c9159,_[_0x0f3c('0x5c')](_0x47adb6['loginLogo'])):path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x5c9159,_['toLower'](_0x0f3c('0x65')));var _0x42d9d3=_0x0f3c('0x5d')+_[_0x0f3c('0x5e')](_0x0f3c('0x4e'));if(_0x47adb6[_0x42d9d3]||!_0x31eb92[_0x0f3c('0x5f')]){_0x34417d=path[_0x0f3c('0x5a')](config['root'],_0x5c9159,_[_0x0f3c('0x5c')](_0x0f3c('0x65')));}if(!fs[_0x0f3c('0x59')](_0x34417d)){throw new db['Sequelize'][(_0x0f3c('0x61'))](_[_0x0f3c('0x5e')]('loginLogo')+'\x20not\x20found');}return _0x213b18[_0x0f3c('0x63')](_0x34417d);}})[_0x0f3c('0x1d')](handleError(_0x213b18,null));};exports[_0x0f3c('0x66')]=function(_0x1da448,_0x13c3d2){return db['Setting']['find']({'where':{'id':_0x1da448[_0x0f3c('0x49')]['id']},'attributes':[_0x0f3c('0x67')]})[_0x0f3c('0x28')](respondWithResult(_0x13c3d2,null))[_0x0f3c('0x1d')](handleError(_0x13c3d2,null));};exports[_0x0f3c('0x68')]=function(_0x3855ce,_0x30e4b5,_0x2da6f5){if(_0x3855ce[_0x0f3c('0x4b')]&&_0x3855ce[_0x0f3c('0x4b')][_0x0f3c('0x4f')]){_0x3855ce['body'][_0x0f3c('0x54')]=_0x3855ce[_0x0f3c('0x4b')]['filename'];}return db['Setting'][_0x0f3c('0x48')]({'where':{'id':_0x3855ce[_0x0f3c('0x49')]['id']}})[_0x0f3c('0x28')](handleEntityNotFound(_0x30e4b5,null))['then'](saveUpdates(_0x3855ce[_0x0f3c('0x47')],null))[_0x0f3c('0x28')](respondWithResult(_0x30e4b5,null))['catch'](handleError(_0x30e4b5,null));};var utilLicense=require(_0x0f3c('0x50'));exports[_0x0f3c('0x69')]=function(_0x19f5b0,_0x208cda,_0xbfc418){var _0x1c7711=_0x0f3c('0x52');var _0x3be487={'custom':![]};return utilLicense[_0x0f3c('0x53')]()[_0x0f3c('0x28')](function(_0x477dd8){if(_0x477dd8){_0x3be487=_0x477dd8;}return db[_0x0f3c('0x2d')][_0x0f3c('0x48')]({'where':{'id':_0x19f5b0['params']['id']},'attributes':['logo',_0x0f3c('0x4e'),_0x0f3c('0x54'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x0f3c('0x28')](handleEntityNotFound(_0x208cda,null))[_0x0f3c('0x28')](function(_0x33658a){if(_0x33658a){var _0x210f5c=_0x33658a['preferred']&&fs[_0x0f3c('0x59')](path['join'](config[_0x0f3c('0x5b')],_0x1c7711,_['toLower'](_0x33658a[_0x0f3c('0x54')])))?path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x1c7711,_[_0x0f3c('0x5c')](_0x33658a[_0x0f3c('0x54')])):path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x1c7711,_[_0x0f3c('0x5c')]('default_preferred.png'));var _0x39823b=_0x0f3c('0x5d')+_[_0x0f3c('0x5e')](_0x0f3c('0x54'));if(_0x33658a[_0x39823b]||!_0x3be487['custom']||!_0x3be487['preferred']){_0x210f5c=path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0x1c7711,_[_0x0f3c('0x5c')]('default_preferred.png'));}if(!fs['existsSync'](_0x210f5c)){throw new db[(_0x0f3c('0x6a'))][(_0x0f3c('0x61'))](_[_0x0f3c('0x5e')](_0x0f3c('0x54'))+'\x20not\x20found');}return _0x208cda[_0x0f3c('0x63')](_0x210f5c);}})[_0x0f3c('0x1d')](handleError(_0x208cda,null));};exports[_0x0f3c('0x6b')]=function(_0x46bbe4,_0x5e9d19,_0x391628){if(_0x46bbe4[_0x0f3c('0x4b')]&&_0x46bbe4[_0x0f3c('0x4b')][_0x0f3c('0x4f')]){_0x46bbe4['body'][_0x0f3c('0x55')]=_0x46bbe4['file'][_0x0f3c('0x4f')];}return db[_0x0f3c('0x2d')][_0x0f3c('0x48')]({'where':{'id':_0x46bbe4[_0x0f3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e9d19,null))[_0x0f3c('0x28')](saveUpdates(_0x46bbe4['body'],null))[_0x0f3c('0x28')](respondWithResult(_0x5e9d19,null))['catch'](handleError(_0x5e9d19,null));};var utilLicense=require(_0x0f3c('0x50'));exports[_0x0f3c('0x6c')]=function(_0xd0d6e5,_0x2be6e7,_0x35c4a5){var _0xe58ba5=_0x0f3c('0x52');var _0x3e3612={'custom':![]};return utilLicense[_0x0f3c('0x53')]()['then'](function(_0x177de3){if(_0x177de3){_0x3e3612=_0x177de3;}return db[_0x0f3c('0x2d')][_0x0f3c('0x48')]({'where':{'id':_0xd0d6e5[_0x0f3c('0x49')]['id']},'attributes':['logo',_0x0f3c('0x4e'),'preferred',_0x0f3c('0x55'),_0x0f3c('0x56'),_0x0f3c('0x57'),_0x0f3c('0x6d'),_0x0f3c('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x2be6e7,null))[_0x0f3c('0x28')](function(_0x33fec6){if(_0x33fec6){var _0x10088f=_0x33fec6[_0x0f3c('0x55')]&&fs[_0x0f3c('0x59')](path[_0x0f3c('0x5a')](config['root'],_0xe58ba5,_[_0x0f3c('0x5c')](_0x33fec6['favicon'])))?path['join'](config[_0x0f3c('0x5b')],_0xe58ba5,_[_0x0f3c('0x5c')](_0x33fec6[_0x0f3c('0x55')])):path[_0x0f3c('0x5a')](config[_0x0f3c('0x5b')],_0xe58ba5,_[_0x0f3c('0x5c')]('default_favicon.ico'));var _0xead623=_0x0f3c('0x5d')+_[_0x0f3c('0x5e')](_0x0f3c('0x55'));if(_0x33fec6[_0xead623]||!_0x3e3612[_0x0f3c('0x5f')]){_0x10088f=path[_0x0f3c('0x5a')](config['root'],_0xe58ba5,_['toLower'](_0x0f3c('0x6e')));}if(!fs[_0x0f3c('0x59')](_0x10088f)){throw new db[(_0x0f3c('0x6a'))][(_0x0f3c('0x61'))](_[_0x0f3c('0x5e')](_0x0f3c('0x55'))+'\x20not\x20found');}return _0x2be6e7[_0x0f3c('0x63')](_0x10088f);}})['catch'](handleError(_0x2be6e7,null));};exports['getDate']=function(_0x1254ea,_0x33438b){var _0x4f2749={'offset':moment()[_0x0f3c('0x6f')]()};_0x4f2749[_0x0f3c('0x70')]=moment()['utcOffset'](_0x4f2749[_0x0f3c('0x20')])[_0x0f3c('0x71')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x33438b[_0x0f3c('0x1e')](0xc8)[_0x0f3c('0x72')](_0x4f2749);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b753168..abbce7c 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x7217,0x19e));var _0x7721=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7217[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x7217,0x19e));var _0x7721=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x7217[_0x1b349a];return _0x5d1f7c;};'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 9d7bfe8..644934c 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 _0xd8ae=['include','map','model','then','ShowSetting','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','Setting','find','options','raw','attributes'];(function(_0x4f0f66,_0xd3c2f3){var _0x69a519=function(_0x51c31f){while(--_0x51c31f){_0x4f0f66['push'](_0x4f0f66['shift']());}};_0x69a519(++_0xd3c2f3);}(_0xd8ae,0x11e));var _0xed8a=function(_0xc9e031,_0x4ec2ed){_0xc9e031=_0xc9e031-0x0;var _0x4e65aa=_0xd8ae[_0xc9e031];return _0x4e65aa;};'use strict';var _=require(_0xed8a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed8a('0x1'));var fs=require('fs');var Redis=require(_0xed8a('0x2'));var db=require(_0xed8a('0x3'))['db'];var utils=require(_0xed8a('0x4'));var logger=require(_0xed8a('0x5'))(_0xed8a('0x6'));var config=require('../../config/environment');var jayson=require(_0xed8a('0x7'));var client=jayson['client'][_0xed8a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5de644,_0x33b1a8,_0x3001f5){return new BPromise(function(_0x31ae55,_0x5675f9){return client['request'](_0x5de644,_0x3001f5)['then'](function(_0x460d78){logger[_0xed8a('0x9')](_0xed8a('0xa'),_0x33b1a8,'request\x20sent');logger['debug'](_0xed8a('0xb'),_0x33b1a8,'request\x20sent',JSON[_0xed8a('0xc')](_0x460d78));if(_0x460d78['error']){if(_0x460d78[_0xed8a('0xd')]['code']===0x1f4){logger[_0xed8a('0xd')](_0xed8a('0xa'),_0x33b1a8,_0x460d78[_0xed8a('0xd')][_0xed8a('0xe')]);return _0x5675f9(_0x460d78[_0xed8a('0xd')][_0xed8a('0xe')]);}logger[_0xed8a('0xd')](_0xed8a('0xa'),_0x33b1a8,_0x460d78[_0xed8a('0xd')][_0xed8a('0xe')]);return _0x31ae55(_0x460d78[_0xed8a('0xd')][_0xed8a('0xe')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x33b1a8,_0xed8a('0xf'));_0x31ae55(_0x460d78['result'][_0xed8a('0xe')]);}})[_0xed8a('0x10')](function(_0x264b45){logger[_0xed8a('0xd')](_0xed8a('0xa'),_0x33b1a8,_0x264b45);_0x5675f9(_0x264b45);});});}exports['ShowSetting']=function(_0x488167){var _0x1fe8df=this;return new Promise(function(_0x31cb7c,_0x5691fc){return db[_0xed8a('0x11')][_0xed8a('0x12')]({'raw':_0x488167[_0xed8a('0x13')]?_0x488167[_0xed8a('0x13')][_0xed8a('0x14')]===undefined?!![]:![]:!![],'where':_0x488167[_0xed8a('0x13')]?_0x488167[_0xed8a('0x13')]['where']||null:null,'attributes':_0x488167['options']?_0x488167[_0xed8a('0x13')][_0xed8a('0x15')]||null:null,'include':_0x488167[_0xed8a('0x13')]?_0x488167[_0xed8a('0x13')][_0xed8a('0x16')]?_[_0xed8a('0x17')](_0x488167[_0xed8a('0x13')][_0xed8a('0x16')],function(_0x3e6ff8){return{'model':db[_0x3e6ff8[_0xed8a('0x18')]],'as':_0x3e6ff8['as'],'attributes':_0x3e6ff8['attributes'],'include':_0x3e6ff8[_0xed8a('0x16')]?_['map'](_0x3e6ff8[_0xed8a('0x16')],function(_0x64bb0c){return{'model':db[_0x64bb0c[_0xed8a('0x18')]],'as':_0x64bb0c['as'],'attributes':_0x64bb0c[_0xed8a('0x15')],'include':_0x64bb0c[_0xed8a('0x16')]?_[_0xed8a('0x17')](_0x64bb0c[_0xed8a('0x16')],function(_0xc77034){return{'model':db[_0xc77034[_0xed8a('0x18')]],'as':_0xc77034['as'],'attributes':_0xc77034[_0xed8a('0x15')]};}):[]};}):[]};}):[]:[]})[_0xed8a('0x19')](function(_0x519caa){logger[_0xed8a('0x9')](_0xed8a('0x1a'),_0x488167);logger[_0xed8a('0x1b')](_0xed8a('0x1a'),_0x488167,JSON[_0xed8a('0xc')](_0x519caa));_0x31cb7c(_0x519caa);})['catch'](function(_0x4e5fe3){logger[_0xed8a('0xd')](_0xed8a('0x1a'),_0x4e5fe3[_0xed8a('0xe')],_0x488167);_0x5691fc(_0x1fe8df[_0xed8a('0xd')](0x1f4,_0x4e5fe3[_0xed8a('0xe')]));});});}; \ No newline at end of file +var _0xb279=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','find','options','raw','where','include','map','attributes','model','debug','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3d70f6,_0x33d160){var _0x5189db=function(_0x8aa97f){while(--_0x8aa97f){_0x3d70f6['push'](_0x3d70f6['shift']());}};_0x5189db(++_0x33d160);}(_0xb279,0x1e6));var _0x9b27=function(_0xa38f5a,_0x5c2059){_0xa38f5a=_0xa38f5a-0x0;var _0x235716=_0xb279[_0xa38f5a];return _0x235716;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9b27('0x0'));var BPromise=require(_0x9b27('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b27('0x2'))['db'];var utils=require(_0x9b27('0x3'));var logger=require(_0x9b27('0x4'))(_0x9b27('0x5'));var config=require(_0x9b27('0x6'));var jayson=require(_0x9b27('0x7'));var client=jayson[_0x9b27('0x8')][_0x9b27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x380995,_0x1986ff,_0x4a0a21){return new BPromise(function(_0x3fd070,_0x5f0fb0){return client[_0x9b27('0xa')](_0x380995,_0x4a0a21)[_0x9b27('0xb')](function(_0x37a3c8){logger[_0x9b27('0xc')](_0x9b27('0xd'),_0x1986ff,_0x9b27('0xe'));logger['debug'](_0x9b27('0xf'),_0x1986ff,_0x9b27('0xe'),JSON[_0x9b27('0x10')](_0x37a3c8));if(_0x37a3c8['error']){if(_0x37a3c8[_0x9b27('0x11')][_0x9b27('0x12')]===0x1f4){logger[_0x9b27('0x11')](_0x9b27('0xd'),_0x1986ff,_0x37a3c8[_0x9b27('0x11')][_0x9b27('0x13')]);return _0x5f0fb0(_0x37a3c8[_0x9b27('0x11')][_0x9b27('0x13')]);}logger[_0x9b27('0x11')](_0x9b27('0xd'),_0x1986ff,_0x37a3c8['error'][_0x9b27('0x13')]);return _0x3fd070(_0x37a3c8[_0x9b27('0x11')]['message']);}else{logger[_0x9b27('0xc')](_0x9b27('0xd'),_0x1986ff,_0x9b27('0xe'));_0x3fd070(_0x37a3c8['result'][_0x9b27('0x13')]);}})[_0x9b27('0x14')](function(_0x278f4c){logger[_0x9b27('0x11')]('Setting,\x20%s,\x20%s',_0x1986ff,_0x278f4c);_0x5f0fb0(_0x278f4c);});});}exports[_0x9b27('0x15')]=function(_0xc01ec7){var _0x50b5a7=this;return new Promise(function(_0xce3493,_0x4b6701){return db['Setting'][_0x9b27('0x16')]({'raw':_0xc01ec7[_0x9b27('0x17')]?_0xc01ec7[_0x9b27('0x17')][_0x9b27('0x18')]===undefined?!![]:![]:!![],'where':_0xc01ec7[_0x9b27('0x17')]?_0xc01ec7[_0x9b27('0x17')][_0x9b27('0x19')]||null:null,'attributes':_0xc01ec7[_0x9b27('0x17')]?_0xc01ec7['options']['attributes']||null:null,'include':_0xc01ec7[_0x9b27('0x17')]?_0xc01ec7[_0x9b27('0x17')][_0x9b27('0x1a')]?_[_0x9b27('0x1b')](_0xc01ec7[_0x9b27('0x17')]['include'],function(_0x3f5eb5){return{'model':db[_0x3f5eb5['model']],'as':_0x3f5eb5['as'],'attributes':_0x3f5eb5[_0x9b27('0x1c')],'include':_0x3f5eb5[_0x9b27('0x1a')]?_[_0x9b27('0x1b')](_0x3f5eb5[_0x9b27('0x1a')],function(_0x5bf966){return{'model':db[_0x5bf966[_0x9b27('0x1d')]],'as':_0x5bf966['as'],'attributes':_0x5bf966['attributes'],'include':_0x5bf966[_0x9b27('0x1a')]?_[_0x9b27('0x1b')](_0x5bf966[_0x9b27('0x1a')],function(_0x3c32db){return{'model':db[_0x3c32db[_0x9b27('0x1d')]],'as':_0x3c32db['as'],'attributes':_0x3c32db[_0x9b27('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4eed54){logger['info'](_0x9b27('0x15'),_0xc01ec7);logger[_0x9b27('0x1e')](_0x9b27('0x15'),_0xc01ec7,JSON[_0x9b27('0x10')](_0x4eed54));_0xce3493(_0x4eed54);})[_0x9b27('0x14')](function(_0x404080){logger[_0x9b27('0x11')](_0x9b27('0x15'),_0x404080['message'],_0xc01ec7);_0x4b6701(_0x50b5a7['error'](0x1f4,_0x404080['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8f0486e..c0dd5a4 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(_0x46437e,_0x20c7d8){var _0x1189bd=function(_0xc1e31f){while(--_0xc1e31f){_0x46437e['push'](_0x46437e['shift']());}};_0x1189bd(++_0x20c7d8);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x592541,_0x4fab31){var _0x5ba8d8=function(_0xd62b60){while(--_0xd62b60){_0x592541['push'](_0x592541['shift']());}};_0x5ba8d8(++_0x4fab31);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0b60d42..98e7730 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 _0x0ae6=['clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','name','generate','ENUM','skebby','connectel','plivo'];(function(_0x46ec43,_0x37beb8){var _0x4ece65=function(_0x4b244d){while(--_0x4b244d){_0x46ec43['push'](_0x46ec43['shift']());}};_0x4ece65(++_0x37beb8);}(_0x0ae6,0x171));var _0x60ae=function(_0x5c7510,_0x3c7344){_0x5c7510=_0x5c7510-0x0;var _0x36620a=_0x0ae6[_0x5c7510];return _0x36620a;};'use strict';var Sequelize=require(_0x60ae('0x0'));var rs=require('randomstring');module[_0x60ae('0x1')]={'name':{'type':Sequelize[_0x60ae('0x2')],'unique':_0x60ae('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x60ae('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x60ae('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x60ae('0x4')]();}},'phone':{'type':Sequelize[_0x60ae('0x2')]},'type':{'type':Sequelize[_0x60ae('0x5')]('twilio',_0x60ae('0x6'),_0x60ae('0x7'),'clicksend',_0x60ae('0x8'),_0x60ae('0x9'),_0x60ae('0xa'),_0x60ae('0xb'),_0x60ae('0xc'),_0x60ae('0xd'))},'accountSid':{'type':Sequelize[_0x60ae('0x2')]},'authId':{'type':Sequelize[_0x60ae('0x2')]},'authToken':{'type':Sequelize[_0x60ae('0x2')]},'smsMethod':{'type':Sequelize[_0x60ae('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x60ae('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x60ae('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x60ae('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x60ae('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x60ae('0x2')]},'notificationTemplate':{'type':Sequelize[_0x60ae('0xf')],'defaultValue':function(){return _0x60ae('0x10');}},'notificationSound':{'type':Sequelize[_0x60ae('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x60ae('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x60ae('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x60ae('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x60ae('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x60ae('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x60ae('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x60ae('0x11')],'comment':_0x60ae('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5593ec){if(!_0x5593ec)this['setDataValue'](_0x60ae('0x13'),null);this[_0x60ae('0x14')]('mandatoryDisposition',_0x5593ec);}}}; \ No newline at end of file +var _0x9fe0=['twilio','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','ENUM'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x9fe0,0x9c));var _0x09fe=function(_0x4fed6a,_0x3bb3b5){_0x4fed6a=_0x4fed6a-0x0;var _0x5647ca=_0x9fe0[_0x4fed6a];return _0x5647ca;};'use strict';var Sequelize=require(_0x09fe('0x0'));var rs=require(_0x09fe('0x1'));module[_0x09fe('0x2')]={'name':{'type':Sequelize[_0x09fe('0x3')],'unique':_0x09fe('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x09fe('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x09fe('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x09fe('0x3')]},'type':{'type':Sequelize[_0x09fe('0x5')](_0x09fe('0x6'),'skebby','connectel','clicksend',_0x09fe('0x7'),_0x09fe('0x8'),'bandwidth',_0x09fe('0x9'),_0x09fe('0xa'),_0x09fe('0xb'))},'accountSid':{'type':Sequelize[_0x09fe('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x09fe('0x3')]},'smsMethod':{'type':Sequelize[_0x09fe('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x09fe('0x3')]},'password':{'type':Sequelize[_0x09fe('0x3')]},'apiKey':{'type':Sequelize[_0x09fe('0x3')]},'applicationId':{'type':Sequelize[_0x09fe('0x3')]},'accountId':{'type':Sequelize[_0x09fe('0x3')]},'senderString':{'type':Sequelize[_0x09fe('0x3')]},'deliveryReport':{'type':Sequelize[_0x09fe('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x09fe('0x3')]},'notificationTemplate':{'type':Sequelize[_0x09fe('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x09fe('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x09fe('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x09fe('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x09fe('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x09fe('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x09fe('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x09fe('0xe')],'comment':_0x09fe('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x09fe('0x10'),'set':function(_0x4e0901){if(!_0x4e0901)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x09fe('0x11')]('mandatoryDisposition',_0x4e0901);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 48d56f2..7d39a6e 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 _0x4e83=['entity\x20found','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','Messages','spread','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','get','SmsAccounts','destroy','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','keys','Disposition','hasOwnProperty','SmsAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','sms','Applications','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','From','Body','messageId','MessageSid','skebby','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','applications','unshift','agent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e83,0x119));var _0x34e8=function(_0x44ea42,_0x1de248){_0x44ea42=_0x44ea42-0x0;var _0x47ec5b=_0x4e83[_0x44ea42];return _0x47ec5b;};'use strict';var emlformat=require(_0x34e8('0x0'));var rimraf=require(_0x34e8('0x1'));var zipdir=require(_0x34e8('0x2'));var jsonpatch=require(_0x34e8('0x3'));var rp=require(_0x34e8('0x4'));var moment=require(_0x34e8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x34e8('0x6'));var path=require('path');var sox=require(_0x34e8('0x7'));var csv=require(_0x34e8('0x8'));var ejs=require(_0x34e8('0x9'));var fs=require('fs');var fs_extra=require(_0x34e8('0xa'));var _=require('lodash');var squel=require(_0x34e8('0xb'));var crypto=require(_0x34e8('0xc'));var jsforce=require(_0x34e8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x34e8('0x8'));var querystring=require('querystring');var Papa=require(_0x34e8('0xe'));var Redis=require(_0x34e8('0xf'));var authService=require(_0x34e8('0x10'));var qs=require(_0x34e8('0x11'));var as=require(_0x34e8('0x12'));var hardwareService=require(_0x34e8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x34e8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34e8('0x15'))['db'];config[_0x34e8('0x16')]=_['defaults'](config[_0x34e8('0x16')],{'host':_0x34e8('0x17'),'port':0x18eb});var socket=require(_0x34e8('0x18'))(new Redis(config['redis']));require(_0x34e8('0x19'))[_0x34e8('0x1a')](socket);var jayson=require(_0x34e8('0x1b'));var client=jayson['client'][_0x34e8('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x336eb5,_0x4db7d5,_0x192639,_0x5309ce){return new BPromise(function(_0x2817e5,_0x143fbf){var _0x2cf9de=_0x5309ce||client;return _0x2cf9de[_0x34e8('0x1d')](_0x336eb5,_0x192639)[_0x34e8('0x1e')](function(_0x5f2162){logger[_0x34e8('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x4db7d5,_0x34e8('0x20'));logger[_0x34e8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4db7d5,'request\x20sent',JSON[_0x34e8('0x22')](_0x5f2162));if(_0x5f2162[_0x34e8('0x23')]){if(_0x5f2162['error'][_0x34e8('0x24')]===0x1f4){logger[_0x34e8('0x23')](_0x34e8('0x25'),_0x4db7d5,_0x5f2162['error'][_0x34e8('0x26')]);return _0x143fbf(_0x5f2162['error']['message']);}logger[_0x34e8('0x23')](_0x34e8('0x25'),_0x4db7d5,_0x5f2162['error'][_0x34e8('0x26')]);return _0x2817e5(_0x5f2162['error'][_0x34e8('0x26')]);}else{logger['info'](_0x34e8('0x25'),_0x4db7d5,_0x34e8('0x20'));_0x2817e5(_0x5f2162[_0x34e8('0x27')][_0x34e8('0x26')]);}})[_0x34e8('0x28')](function(_0x5dd873){logger['error'](_0x34e8('0x25'),_0x4db7d5,_0x5dd873);_0x143fbf(_0x5dd873);});});}function respondWithStatusCode(_0x36c94a,_0x2c0f68){_0x2c0f68=_0x2c0f68||0xcc;return function(_0x2b9d39){if(_0x2b9d39){return _0x36c94a['sendStatus'](_0x2c0f68);}return _0x36c94a[_0x34e8('0x29')](_0x2c0f68)['end']();};}function respondWithResult(_0x2c4110,_0x34c9c0){_0x34c9c0=_0x34c9c0||0xc8;return function(_0x2b51fc){if(_0x2b51fc){return _0x2c4110['status'](_0x34c9c0)['json'](_0x2b51fc);}};}function respondWithFilteredResult(_0x5e15a9,_0x1c5fb6){return function(_0x5e5367){if(_0x5e5367){var _0x1d76cd=typeof _0x1c5fb6['offset']==='undefined'&&typeof _0x1c5fb6[_0x34e8('0x2a')]===_0x34e8('0x2b');var _0xe4ffd7=_0x5e5367[_0x34e8('0x2c')];var _0x4efd50=_0x1d76cd?0x0:_0x1c5fb6[_0x34e8('0x2d')];var _0xb965ed=_0x1d76cd?_0x5e5367[_0x34e8('0x2c')]:_0x1c5fb6[_0x34e8('0x2d')]+_0x1c5fb6[_0x34e8('0x2a')];var _0x263f96;if(_0xb965ed>=_0xe4ffd7){_0xb965ed=_0xe4ffd7;_0x263f96=0xc8;}else{_0x263f96=0xce;}_0x5e15a9[_0x34e8('0x29')](_0x263f96);return _0x5e15a9[_0x34e8('0x2e')](_0x34e8('0x2f'),_0x4efd50+'-'+_0xb965ed+'/'+_0xe4ffd7)[_0x34e8('0x30')](_0x5e5367);}return null;};}function patchUpdates(_0x3566fc){return function(_0x723aa1){try{jsonpatch[_0x34e8('0x31')](_0x723aa1,_0x3566fc,!![]);}catch(_0x58f794){return BPromise[_0x34e8('0x32')](_0x58f794);}return _0x723aa1['save']();};}function saveUpdates(_0x380dcb,_0x10da19){return function(_0xb4761){if(_0xb4761){return _0xb4761[_0x34e8('0x33')](_0x380dcb)[_0x34e8('0x1e')](function(_0x7b1a89){return _0x7b1a89;});}return null;};}function removeEntity(_0xd76506,_0x19609d){return function(_0x5d934d){if(_0x5d934d){return _0x5d934d['destroy']()[_0x34e8('0x1e')](function(){var _0x1ac82e=_0x5d934d[_0x34e8('0x34')]({'plain':!![]});var _0x398203=_0x34e8('0x35');return db['UserProfileResource'][_0x34e8('0x36')]({'where':{'type':_0x398203,'resourceId':_0x1ac82e['id']}})[_0x34e8('0x1e')](function(){return _0x5d934d;});})[_0x34e8('0x1e')](function(){_0xd76506[_0x34e8('0x29')](0xcc)[_0x34e8('0x37')]();});}};}function handleEntityNotFound(_0x457e8f,_0x3de4d6){return function(_0x1744ab){if(!_0x1744ab){_0x457e8f[_0x34e8('0x38')](0x194);}return _0x1744ab;};}function handleError(_0x46d5f0,_0x274f0e){_0x274f0e=_0x274f0e||0x1f4;return function(_0x343e70){logger[_0x34e8('0x23')](_0x343e70[_0x34e8('0x39')]);if(_0x343e70[_0x34e8('0x3a')]){delete _0x343e70[_0x34e8('0x3a')];}_0x46d5f0[_0x34e8('0x29')](_0x274f0e)[_0x34e8('0x3b')](_0x343e70);};}exports[_0x34e8('0x3c')]=function(_0x531d18,_0x282fa8){var _0x377b77={'include':[{'model':db[_0x34e8('0x3d')],'as':_0x34e8('0x3e')}]},_0x392e58={},_0x22f801={'count':0x0,'rows':[]};var _0x8a0c30=_['map'](db[_0x34e8('0x3f')][_0x34e8('0x40')],function(_0x53641b){return{'name':_0x53641b[_0x34e8('0x41')],'type':_0x53641b[_0x34e8('0x42')][_0x34e8('0x43')]};});_0x392e58[_0x34e8('0x44')]=_[_0x34e8('0x45')](_0x8a0c30,_0x34e8('0x3a'));_0x392e58[_0x34e8('0x46')]=_['keys'](_0x531d18['query']);_0x392e58['filters']=_['intersection'](_0x392e58['model'],_0x392e58['query']);_0x377b77[_0x34e8('0x47')]=_['intersection'](_0x392e58[_0x34e8('0x44')],qs['fields'](_0x531d18[_0x34e8('0x46')][_0x34e8('0x48')]));_0x377b77['attributes']=_0x377b77['attributes'][_0x34e8('0x49')]?_0x377b77[_0x34e8('0x47')]:_0x392e58['model'];if(!_0x531d18['query']['hasOwnProperty'](_0x34e8('0x4a'))){_0x377b77['limit']=qs[_0x34e8('0x2a')](_0x531d18['query']['limit']);_0x377b77[_0x34e8('0x2d')]=qs[_0x34e8('0x2d')](_0x531d18[_0x34e8('0x46')][_0x34e8('0x2d')]);}_0x377b77[_0x34e8('0x4b')]=qs[_0x34e8('0x4c')](_0x531d18['query']['sort']);_0x377b77[_0x34e8('0x4d')]=qs['filters'](_[_0x34e8('0x4e')](_0x531d18[_0x34e8('0x46')],_0x392e58[_0x34e8('0x4f')]),_0x8a0c30);if(_0x531d18[_0x34e8('0x46')][_0x34e8('0x50')]){_0x377b77['where']=_[_0x34e8('0x51')](_0x377b77['where'],{'$or':_[_0x34e8('0x45')](_0x8a0c30,function(_0x383368){if(_0x383368[_0x34e8('0x42')]!=='VIRTUAL'){var _0x37a460={};_0x37a460[_0x383368[_0x34e8('0x3a')]]={'$like':'%'+_0x531d18['query'][_0x34e8('0x50')]+'%'};return _0x37a460;}})});}_0x377b77=_[_0x34e8('0x51')]({},_0x377b77,_0x531d18[_0x34e8('0x52')]);var _0x3771dd={'where':_0x377b77[_0x34e8('0x4d')]};return db[_0x34e8('0x3f')]['count'](_0x3771dd)[_0x34e8('0x1e')](function(_0x59cf6f){_0x22f801[_0x34e8('0x2c')]=_0x59cf6f;if(_0x531d18[_0x34e8('0x46')][_0x34e8('0x53')]){_0x377b77[_0x34e8('0x54')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x377b77);})['then'](function(_0x541f51){_0x22f801[_0x34e8('0x55')]=_0x541f51;return _0x22f801;})[_0x34e8('0x1e')](respondWithFilteredResult(_0x282fa8,_0x377b77))[_0x34e8('0x28')](handleError(_0x282fa8,null));};exports[_0x34e8('0x56')]=function(_0x2ffd15,_0x509c06){var _0x563b8f={'raw':![],'where':{'id':_0x2ffd15[_0x34e8('0x57')]['id']},'include':[{'model':db[_0x34e8('0x3d')],'as':_0x34e8('0x3e')}]},_0x57ab37={};_0x57ab37[_0x34e8('0x44')]=_['keys'](db['SmsAccount'][_0x34e8('0x40')]);_0x57ab37['query']=_['keys'](_0x2ffd15[_0x34e8('0x46')]);_0x57ab37['filters']=_[_0x34e8('0x58')](_0x57ab37[_0x34e8('0x44')],_0x57ab37[_0x34e8('0x46')]);_0x563b8f[_0x34e8('0x47')]=_[_0x34e8('0x58')](_0x57ab37[_0x34e8('0x44')],qs[_0x34e8('0x48')](_0x2ffd15[_0x34e8('0x46')][_0x34e8('0x48')]));_0x563b8f[_0x34e8('0x47')]=_0x563b8f['attributes'][_0x34e8('0x49')]?_0x563b8f['attributes']:_0x57ab37[_0x34e8('0x44')];if(_0x2ffd15[_0x34e8('0x46')][_0x34e8('0x53')]){_0x563b8f['include']=[{'all':!![]}];}_0x563b8f=_[_0x34e8('0x51')]({},_0x563b8f,_0x2ffd15[_0x34e8('0x52')]);return db[_0x34e8('0x3f')][_0x34e8('0x59')](_0x563b8f)['then'](handleEntityNotFound(_0x509c06,null))[_0x34e8('0x1e')](respondWithResult(_0x509c06,null))[_0x34e8('0x28')](handleError(_0x509c06,null));};exports[_0x34e8('0x5a')]=function(_0x499574,_0x27035b){return db[_0x34e8('0x3f')][_0x34e8('0x5a')](_0x499574[_0x34e8('0x5b')],{})[_0x34e8('0x1e')](function(_0x157cd7){var _0x2af8b0=_0x499574[_0x34e8('0x5c')][_0x34e8('0x34')]({'plain':!![]});if(!_0x2af8b0)throw new Error(_0x34e8('0x5d'));if(_0x2af8b0[_0x34e8('0x5e')]===_0x34e8('0x5c')){var _0x50af3f=_0x157cd7['get']({'plain':!![]});var _0x1e08d7=_0x34e8('0x35');return db['UserProfileSection'][_0x34e8('0x59')]({'where':{'name':_0x1e08d7,'userProfileId':_0x2af8b0[_0x34e8('0x5f')]},'raw':!![]})[_0x34e8('0x1e')](function(_0x42ecb1){if(_0x42ecb1&&_0x42ecb1[_0x34e8('0x60')]===0x0){return db[_0x34e8('0x61')]['create']({'name':_0x50af3f['name'],'resourceId':_0x50af3f['id'],'type':_0x42ecb1[_0x34e8('0x3a')],'sectionId':_0x42ecb1['id']},{})[_0x34e8('0x1e')](function(){return _0x157cd7;});}else{return _0x157cd7;}})['catch'](function(_0x33a5e4){logger['error'](_0x34e8('0x62'),_0x33a5e4);throw _0x33a5e4;});}return _0x157cd7;})[_0x34e8('0x1e')](respondWithResult(_0x27035b,0xc9))[_0x34e8('0x28')](handleError(_0x27035b,null));};exports[_0x34e8('0x33')]=function(_0x2c3862,_0x4294d6){if(_0x2c3862['body']['id']){delete _0x2c3862['body']['id'];}return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x2c3862['params']['id']},'include':[{'model':db[_0x34e8('0x3d')],'as':_0x34e8('0x3e')}]})[_0x34e8('0x1e')](handleEntityNotFound(_0x4294d6,null))['then'](saveUpdates(_0x2c3862[_0x34e8('0x5b')],null))['then'](respondWithResult(_0x4294d6,null))['catch'](handleError(_0x4294d6,null));};exports[_0x34e8('0x36')]=function(_0x1bb8bc,_0x2b54c4){return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x1bb8bc['params']['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x2b54c4,null))['then'](removeEntity(_0x2b54c4,null))[_0x34e8('0x28')](handleError(_0x2b54c4,null));};exports[_0x34e8('0x63')]=function(_0x5f172e,_0x1f49d2){return db[_0x34e8('0x3f')]['describe']()[_0x34e8('0x1e')](respondWithResult(_0x1f49d2,null))['catch'](handleError(_0x1f49d2,null));};exports[_0x34e8('0x64')]=function(_0x21d47a,_0x4623d4,_0x313cfc){if(_0x21d47a['body']['id']){delete _0x21d47a[_0x34e8('0x5b')]['id'];}return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x21d47a[_0x34e8('0x57')]['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x4623d4,null))['then'](function(_0x509dc5){if(_0x509dc5){_0x21d47a[_0x34e8('0x5b')]['SmsAccountId']=_0x509dc5['id'];return db['Disposition']['create'](_0x21d47a[_0x34e8('0x5b')]);}})[_0x34e8('0x1e')](respondWithResult(_0x4623d4,null))[_0x34e8('0x28')](handleError(_0x4623d4,null));};exports[_0x34e8('0x65')]=function(_0x1836ef,_0x204834,_0x2df7c3){var _0x45a97={'raw':![],'where':{}};var _0x225dab={};var _0x22f7f0={'count':0x0,'rows':[]};return db[_0x34e8('0x3f')][_0x34e8('0x66')]({'where':{'id':_0x1836ef[_0x34e8('0x57')]['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x204834,null))['then'](function(_0x52e70b){if(_0x52e70b){_0x225dab[_0x34e8('0x44')]=_[_0x34e8('0x67')](db[_0x34e8('0x68')][_0x34e8('0x40')]);_0x225dab[_0x34e8('0x46')]=_[_0x34e8('0x67')](_0x1836ef[_0x34e8('0x46')]);_0x225dab[_0x34e8('0x4f')]=_['intersection'](_0x225dab['model'],_0x225dab[_0x34e8('0x46')]);_0x45a97[_0x34e8('0x47')]=_[_0x34e8('0x58')](_0x225dab[_0x34e8('0x44')],qs[_0x34e8('0x48')](_0x1836ef['query'][_0x34e8('0x48')]));_0x45a97[_0x34e8('0x47')]=_0x45a97['attributes']['length']?_0x45a97['attributes']:_0x225dab['model'];if(!_0x1836ef[_0x34e8('0x46')][_0x34e8('0x69')]('nolimit')){_0x45a97[_0x34e8('0x2a')]=qs[_0x34e8('0x2a')](_0x1836ef[_0x34e8('0x46')][_0x34e8('0x2a')]);_0x45a97[_0x34e8('0x2d')]=qs[_0x34e8('0x2d')](_0x1836ef[_0x34e8('0x46')]['offset']);}_0x45a97[_0x34e8('0x4b')]=qs[_0x34e8('0x4c')](_0x1836ef['query'][_0x34e8('0x4c')]);_0x45a97[_0x34e8('0x4d')]=qs[_0x34e8('0x4f')](_['pick'](_0x1836ef[_0x34e8('0x46')],_0x225dab[_0x34e8('0x4f')]));_0x45a97[_0x34e8('0x4d')][_0x34e8('0x6a')]=_0x52e70b['id'];if(_0x1836ef[_0x34e8('0x46')][_0x34e8('0x50')]){_0x45a97[_0x34e8('0x4d')]=_[_0x34e8('0x51')](_0x45a97[_0x34e8('0x4d')],{'$or':_['map'](_0x45a97['attributes'],function(_0x4424e3){var _0x49c272={};_0x49c272[_0x4424e3]={'$like':'%'+_0x1836ef[_0x34e8('0x46')][_0x34e8('0x50')]+'%'};return _0x49c272;})});}_0x45a97=_[_0x34e8('0x51')]({},_0x45a97,_0x1836ef['options']);return db[_0x34e8('0x68')]['count']({'where':_0x45a97[_0x34e8('0x4d')]})['then'](function(_0x236084){_0x22f7f0[_0x34e8('0x2c')]=_0x236084;if(_0x1836ef[_0x34e8('0x46')]['includeAll']){_0x45a97['include']=[{'all':!![]}];}return db[_0x34e8('0x68')][_0x34e8('0x6b')](_0x45a97);})[_0x34e8('0x1e')](function(_0x2cf497){_0x22f7f0[_0x34e8('0x55')]=_0x2cf497;return _0x22f7f0;});}})[_0x34e8('0x1e')](respondWithFilteredResult(_0x204834,_0x45a97))[_0x34e8('0x28')](handleError(_0x204834,null));};exports[_0x34e8('0x6c')]=function(_0x33f929,_0x4f7e52,_0xd59b7d){return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x33f929['params']['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x4f7e52,null))[_0x34e8('0x1e')](function(_0xee4a1b){if(_0xee4a1b){return _0xee4a1b[_0x34e8('0x6c')](_0x33f929['query']['ids']);}})[_0x34e8('0x1e')](respondWithStatusCode(_0x4f7e52,null))[_0x34e8('0x28')](handleError(_0x4f7e52,null));};exports[_0x34e8('0x6d')]=function(_0x1a4c73,_0x368b8a,_0x4c2859){if(_0x1a4c73[_0x34e8('0x5b')]['id']){delete _0x1a4c73[_0x34e8('0x5b')]['id'];}return db[_0x34e8('0x3f')]['find']({'where':{'id':_0x1a4c73[_0x34e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x368b8a,null))[_0x34e8('0x1e')](function(_0x4560e3){if(_0x4560e3){_0x1a4c73['body'][_0x34e8('0x6a')]=_0x4560e3['id'];return db[_0x34e8('0x6e')]['create'](_0x1a4c73[_0x34e8('0x5b')]);}})[_0x34e8('0x1e')](respondWithResult(_0x368b8a,null))[_0x34e8('0x28')](handleError(_0x368b8a,null));};exports[_0x34e8('0x6f')]=function(_0x2ef953,_0x39d5e5,_0x18e84d){var _0x17755f={'raw':![],'where':{}};var _0x18de02={};var _0x2b4485={'count':0x0,'rows':[]};return db[_0x34e8('0x3f')][_0x34e8('0x66')]({'where':{'id':_0x2ef953[_0x34e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x39d5e5,null))[_0x34e8('0x1e')](function(_0x2607a1){if(_0x2607a1){_0x18de02[_0x34e8('0x44')]=_['keys'](db[_0x34e8('0x6e')][_0x34e8('0x40')]);_0x18de02[_0x34e8('0x46')]=_[_0x34e8('0x67')](_0x2ef953[_0x34e8('0x46')]);_0x18de02[_0x34e8('0x4f')]=_[_0x34e8('0x58')](_0x18de02['model'],_0x18de02[_0x34e8('0x46')]);_0x17755f[_0x34e8('0x47')]=_[_0x34e8('0x58')](_0x18de02[_0x34e8('0x44')],qs['fields'](_0x2ef953['query'][_0x34e8('0x48')]));_0x17755f[_0x34e8('0x47')]=_0x17755f[_0x34e8('0x47')][_0x34e8('0x49')]?_0x17755f['attributes']:_0x18de02['model'];if(!_0x2ef953[_0x34e8('0x46')][_0x34e8('0x69')]('nolimit')){_0x17755f[_0x34e8('0x2a')]=qs['limit'](_0x2ef953[_0x34e8('0x46')][_0x34e8('0x2a')]);_0x17755f['offset']=qs[_0x34e8('0x2d')](_0x2ef953[_0x34e8('0x46')][_0x34e8('0x2d')]);}_0x17755f['order']=qs[_0x34e8('0x4c')](_0x2ef953['query']['sort']);_0x17755f[_0x34e8('0x4d')]=qs[_0x34e8('0x4f')](_[_0x34e8('0x4e')](_0x2ef953[_0x34e8('0x46')],_0x18de02[_0x34e8('0x4f')]));_0x17755f[_0x34e8('0x4d')]['SmsAccountId']=_0x2607a1['id'];if(_0x2ef953['query'][_0x34e8('0x50')]){_0x17755f[_0x34e8('0x4d')]=_[_0x34e8('0x51')](_0x17755f[_0x34e8('0x4d')],{'$or':_[_0x34e8('0x45')](_0x17755f['attributes'],function(_0x354ada){var _0x1bd55f={};_0x1bd55f[_0x354ada]={'$like':'%'+_0x2ef953[_0x34e8('0x46')][_0x34e8('0x50')]+'%'};return _0x1bd55f;})});}_0x17755f=_[_0x34e8('0x51')]({},_0x17755f,_0x2ef953['options']);return db['CannedAnswer'][_0x34e8('0x2c')]({'where':_0x17755f[_0x34e8('0x4d')]})[_0x34e8('0x1e')](function(_0x450a30){_0x2b4485['count']=_0x450a30;if(_0x2ef953[_0x34e8('0x46')][_0x34e8('0x53')]){_0x17755f[_0x34e8('0x54')]=[{'all':!![]}];}return db[_0x34e8('0x6e')][_0x34e8('0x6b')](_0x17755f);})['then'](function(_0x376e6f){_0x2b4485[_0x34e8('0x55')]=_0x376e6f;return _0x2b4485;});}})[_0x34e8('0x1e')](respondWithFilteredResult(_0x39d5e5,_0x17755f))[_0x34e8('0x28')](handleError(_0x39d5e5,null));};exports[_0x34e8('0x70')]=function(_0x1b3d4d,_0x1c70db,_0x2cdd14){return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x1b3d4d[_0x34e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x1c70db,null))[_0x34e8('0x1e')](function(_0x314a84){if(_0x314a84){return _0x314a84[_0x34e8('0x70')](_0x1b3d4d['query'][_0x34e8('0x71')]);}})[_0x34e8('0x1e')](respondWithStatusCode(_0x1c70db,null))[_0x34e8('0x28')](handleError(_0x1c70db,null));};exports['notify']=function(_0x137217,_0x512428,_0x9b2500){var _0x31ddd0={'channel':_0x34e8('0x72')};var _0x1a5303=[];var _0x5e88c6=[];var _0x49cb4c={};return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x137217[_0x34e8('0x57')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x34e8('0x73')}]})[_0x34e8('0x1e')](handleEntityNotFound(_0x512428,null))[_0x34e8('0x1e')](function(_0x4a7f6e){_0x31ddd0['account']=_0x4a7f6e;_0x31ddd0['applications']=_['orderBy'](_0x4a7f6e[_0x34e8('0x73')],['priority'],['asc']);if(_0x31ddd0['account']['Applications']){delete _0x31ddd0[_0x34e8('0x74')][_0x34e8('0x73')];}return db[_0x34e8('0x75')][_0x34e8('0x63')]();})['then'](function(_0x334655){if(!_0x334655){throw new db[(_0x34e8('0x76'))][(_0x34e8('0x77'))](_0x34e8('0x78'));}_0x1a5303=_[_0x34e8('0x79')](_[_0x34e8('0x67')](_0x334655),[_0x34e8('0x7a'),_0x34e8('0x7b')]);_0x5e88c6=_[_0x34e8('0x79')](_[_0x34e8('0x67')](_0x334655),[_0x34e8('0x7a'),_0x34e8('0x7b'),_0x34e8('0x7c'),'ListId']);_0x31ddd0[_0x34e8('0x5b')]={'mapKey':'mobile'};if(_0x31ddd0[_0x34e8('0x74')][_0x34e8('0x42')]){switch(_0x31ddd0[_0x34e8('0x74')][_0x34e8('0x42')]){case _0x34e8('0x7d'):_0x31ddd0['body'][_0x34e8('0x7e')]=_0x137217[_0x34e8('0x5b')][_0x34e8('0x7f')];_0x31ddd0['body']['body']=_0x137217['body'][_0x34e8('0x80')];_0x31ddd0['body'][_0x34e8('0x81')]=_0x137217[_0x34e8('0x5b')][_0x34e8('0x82')];break;case _0x34e8('0x83'):_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')]='+'+_0x137217['body']['sender'];_0x31ddd0[_0x34e8('0x5b')]['body']=_0x137217[_0x34e8('0x5b')]['text'];break;case _0x34e8('0x84'):_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')]=_0x137217[_0x34e8('0x5b')]['from'];_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x5b')]=_0x137217['body'][_0x34e8('0x26')];break;case _0x34e8('0x85'):_0x31ddd0[_0x34e8('0x5b')]['from']=_0x137217['body'][_0x34e8('0x7e')];_0x31ddd0[_0x34e8('0x5b')]['body']=_0x137217[_0x34e8('0x5b')][_0x34e8('0x5b')];_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x81')]=_0x137217['body'][_0x34e8('0x86')];break;case _0x34e8('0x87'):_0x31ddd0['body'][_0x34e8('0x7e')]=_0x137217[_0x34e8('0x5b')][_0x34e8('0x7f')];_0x31ddd0['body']['body']=_0x137217[_0x34e8('0x5b')]['Text'];_0x31ddd0[_0x34e8('0x5b')]['messageId']=_0x137217[_0x34e8('0x5b')][_0x34e8('0x88')];break;case _0x34e8('0x89'):_0x31ddd0[_0x34e8('0x5b')]['from']='+'+_0x137217[_0x34e8('0x5b')][_0x34e8('0x8a')][0x0][_0x34e8('0x7e')];_0x31ddd0[_0x34e8('0x5b')]['body']=_0x137217[_0x34e8('0x5b')][_0x34e8('0x8a')][0x0][_0x34e8('0x8b')];_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x81')]=_0x137217['body'][_0x34e8('0x8a')][0x0][_0x34e8('0x81')];break;case _0x34e8('0x8c'):_0x31ddd0['body']['from']=_0x137217[_0x34e8('0x5b')]['originatingAddress'];_0x31ddd0[_0x34e8('0x5b')]['body']=_0x137217[_0x34e8('0x5b')][_0x34e8('0x8d')][_0x34e8('0x26')];break;case _0x34e8('0x8e'):_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')]=_0x137217['body']['fromNumber'];_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x5b')]=_0x137217[_0x34e8('0x5b')][_0x34e8('0x8b')];_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x81')]=_0x137217['body']['replyMessageId'];break;case _0x34e8('0x8f'):_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x81')]=_0x137217['body'][0x0]['message']['id'];_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')]=_0x137217[_0x34e8('0x5b')][0x0][_0x34e8('0x26')][_0x34e8('0x7e')];_0x31ddd0[_0x34e8('0x5b')]['body']=_0x137217[_0x34e8('0x5b')][0x0][_0x34e8('0x26')][_0x34e8('0x8b')];break;case _0x34e8('0x90'):_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')]=_0x137217[_0x34e8('0x5b')][_0x34e8('0x7e')];_0x31ddd0[_0x34e8('0x5b')]['body']=_0x137217['body'][_0x34e8('0x26')];_0x31ddd0['body']['messageId']=_0x137217['body'][_0x34e8('0x91')];break;}}if(_0x31ddd0[_0x34e8('0x5b')]['id']){delete _0x31ddd0[_0x34e8('0x5b')]['id'];}if(_[_0x34e8('0x92')](_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')])){throw new db[(_0x34e8('0x76'))][(_0x34e8('0x77'))]('from\x20is\x20mandatory');}if(_[_0x34e8('0x92')](_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x5b')])||_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x5b')]===''){throw new db['Sequelize'][(_0x34e8('0x77'))](_0x34e8('0x93'));}if(_[_0x34e8('0x92')](_0x31ddd0['body'][_0x34e8('0x94')])){throw new db[(_0x34e8('0x76'))][(_0x34e8('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e88c6);}if(!_['includes'](_0x5e88c6,_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x94')])){throw new db['Sequelize'][(_0x34e8('0x77'))](_0x34e8('0x95')+_0x5e88c6);}_0x49cb4c[_0x31ddd0['body'][_0x34e8('0x94')]]=_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')];return db[_0x34e8('0x96')]['find']({'where':{'id':_0x31ddd0['account'][_0x34e8('0x97')]},'include':[{'model':db[_0x34e8('0x75')],'as':_0x34e8('0x98'),'where':_0x49cb4c,'limit':0x1,'order':[[_0x34e8('0x7b'),_0x34e8('0x99')]]}]});})[_0x34e8('0x1e')](handleEntityNotFound(_0x512428,null))[_0x34e8('0x1e')](function(_0x5cb7d8){if(_0x5cb7d8){_0x31ddd0[_0x34e8('0x9a')]=_['omit'](_0x5cb7d8,[_0x34e8('0x98')]);if(_0x5cb7d8[_0x34e8('0x98')]['length']){return _0x5cb7d8[_0x34e8('0x98')][0x0];}var _0x1b9f12=_['defaults'](_0x31ddd0[_0x34e8('0x5b')],{'firstName':_0x31ddd0[_0x34e8('0x5b')]['from'],'ListId':_0x5cb7d8['id']});_0x1b9f12[_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x94')]]=_0x31ddd0[_0x34e8('0x5b')]['from'];return db[_0x34e8('0x75')][_0x34e8('0x5a')](_0x1b9f12,{'fields':_0x1a5303,'raw':!![]});}})[_0x34e8('0x1e')](handleEntityNotFound(_0x512428,null))[_0x34e8('0x1e')](function(_0x3839ae){if(_0x3839ae){_0x31ddd0[_0x34e8('0x9b')]=_0x3839ae;var _0x578820={'ContactId':_0x3839ae['id'],'phone':_0x31ddd0[_0x34e8('0x5b')][_0x34e8('0x7e')],'SmsAccountId':_0x137217[_0x34e8('0x57')]['id']};var _0x561320={'ContactId':_0x3839ae['id'],'SmsAccountId':_0x137217[_0x34e8('0x57')]['id'],'closed':![]};return db[_0x34e8('0x9c')][_0x34e8('0x59')]({'where':_0x561320})[_0x34e8('0x1e')](function(_0x2b8d17){if(_0x2b8d17){return[_0x2b8d17,![]];}return db[_0x34e8('0x9c')][_0x34e8('0x5a')](_0x578820)['then'](function(_0x421efb){return[_0x421efb,!![]];});});}})['spread'](function(_0x2247fa,_0x5bc221){_0x31ddd0[_0x34e8('0x9d')]=_0x2247fa[_0x34e8('0x34')]({'plain':!![]});_0x31ddd0[_0x34e8('0x9d')][_0x34e8('0x9e')]=![];if(_0x5bc221){if(_0x31ddd0[_0x34e8('0x74')][_0x34e8('0x9f')]){_0x31ddd0['applications'][_0x34e8('0xa0')]({'id':0x0,'priority':_0x31ddd0['applications'][_0x34e8('0x49')]+0x1,'app':_0x34e8('0xa1'),'appdata':_0x34e8('0xa2'),'interval':_0x34e8('0xa3')});}_0x31ddd0['interaction']['created']=!![];}return db[_0x34e8('0xa4')][_0x34e8('0x5a')]({'phone':_0x31ddd0['body'][_0x34e8('0x7e')],'messageId':_0x31ddd0['body'][_0x34e8('0x81')],'body':_0x31ddd0[_0x34e8('0x5b')]['body'],'SmsAccountId':_0x137217[_0x34e8('0x57')]['id'],'SmsInteractionId':_0x2247fa['id'],'direction':'in','ContactId':_0x2247fa[_0x34e8('0xa5')],'AttachmentId':_0x31ddd0['body']['AttachmentId']});})[_0x34e8('0x1e')](function(_0x12f55e){_0x31ddd0['message']=_0x12f55e;if(!_0x31ddd0['interaction'][_0x34e8('0xa6')])return;return db[_0x34e8('0xa7')]['find']({'attributes':['id',_0x34e8('0x3a')],'where':{'id':_0x31ddd0[_0x34e8('0x9d')][_0x34e8('0xa6')]}});})['then'](function(_0x2e80b7){if(_0x2e80b7){_0x31ddd0[_0x34e8('0xa8')][_0x34e8('0xa9')]({'id':0x0,'priority':0x0,'app':_0x34e8('0xaa'),'appdata':_0x2e80b7[_0x34e8('0x3a')]+','+(_0x31ddd0[_0x34e8('0x74')]['waitForTheAssignedAgent']||0xa),'interval':_0x34e8('0xa3')});}if(!_0x31ddd0['interaction'][_0x34e8('0xab')])return;return db[_0x34e8('0xac')][_0x34e8('0x59')]({'attributes':['id',_0x34e8('0x3a')],'where':{'id':_0x31ddd0[_0x34e8('0x9d')][_0x34e8('0xab')]}});})[_0x34e8('0x1e')](function(_0x4b332b){if(_0x4b332b){_0x31ddd0[_0x34e8('0xa8')]['unshift']({'id':0x0,'priority':0x1,'app':_0x34e8('0xad'),'appdata':_0x4b332b[_0x34e8('0x3a')]+','+(_0x31ddd0[_0x34e8('0x74')][_0x34e8('0xae')]||0x12c),'interval':_0x34e8('0xa3')});}return respondWithRpcPromise(_0x34e8('0xaf'),_0x34e8('0xb0'),_0x31ddd0);})[_0x34e8('0x1e')](function(_0x30f9e1){if(_0x30f9e1){var _0x2b77d9=0xc8;var _0x12a72f=_0x34e8('0xb1');logger[_0x34e8('0x1f')](_0x34e8('0xb2'),_0x12a72f,_0x2b77d9,'entity\x20found');logger[_0x34e8('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x12a72f,_0x2b77d9,_0x34e8('0xb3'),JSON[_0x34e8('0x22')](_0x30f9e1));if(_0x31ddd0[_0x34e8('0x74')][_0x34e8('0x42')]==='twilio'){return _0x512428[_0x34e8('0x29')](_0x2b77d9)[_0x34e8('0x2e')](_0x34e8('0xb4'),_0x34e8('0xb5'))[_0x34e8('0x3b')](_0x34e8('0xb6'));}else{return _0x512428[_0x34e8('0x29')](_0x2b77d9)[_0x34e8('0x30')](_0x30f9e1);}}})[_0x34e8('0x28')](handleError(_0x512428,null));};exports[_0x34e8('0xb7')]=function(_0x2f1350,_0x50bb4c){var _0x2a962c=_0x2f1350['params']['id'];var _0x2942f3=_0x2f1350[_0x34e8('0x5b')];var _0x341e79=0xc8;var _0x11f2c6=null;return db['sequelize'][_0x34e8('0xb8')]({'isolationLevel':db[_0x34e8('0xb9')][_0x34e8('0xba')][_0x34e8('0xbb')][_0x34e8('0xbc')]},function(_0x2b8434){return db[_0x34e8('0x3f')][_0x34e8('0x66')]({'where':{'id':_0x2a962c},'transaction':_0x2b8434})['then'](function(_0x3c421b){if(_0x3c421b){return db[_0x34e8('0xbd')]['destroy']({'where':{'SmsAccountId':_0x2a962c},'transaction':_0x2b8434})[_0x34e8('0x1e')](function(){var _0x477305=_['map'](_0x2942f3,function(_0x40f911){_0x40f911[_0x34e8('0x6a')]=_0x2a962c;return _0x40f911;});return db['SmsApplication']['bulkCreate'](_0x477305,{'transaction':_0x2b8434});});}else{_0x341e79=0x194;_0x11f2c6=[];}});})[_0x34e8('0x1e')](function(){if(_0x341e79!==0x194){return db['SmsApplication'][_0x34e8('0xbe')]({'where':{'SmsAccountId':_0x2a962c},'order':'priority'})[_0x34e8('0x1e')](function(_0x91107f){_0x11f2c6=_0x91107f;});}})[_0x34e8('0x28')](function(_0x1d82e3){_0x341e79=0x1f4;logger['error'](_0x1d82e3[_0x34e8('0x39')]);if(_0x1d82e3[_0x34e8('0x3a')]){delete _0x1d82e3[_0x34e8('0x3a')];}_0x11f2c6=_0x1d82e3;})['finally'](function(){if(_0x11f2c6===null){_0x50bb4c['sendStatus'](_0x341e79);}else{if(_0x341e79===0x1f4){_0x50bb4c[_0x34e8('0x29')](_0x341e79)[_0x34e8('0x3b')](_0x11f2c6);}else{_0x50bb4c[_0x34e8('0x29')](_0x341e79)[_0x34e8('0x30')](_0x11f2c6);}}});};exports[_0x34e8('0xbf')]=function(_0x27f0fc,_0x48f610,_0xf315e7){var _0x59a88b={};var _0x17e99e={};var _0x11b490;var _0x55e618;return db[_0x34e8('0x3f')][_0x34e8('0x66')]({'where':{'id':_0x27f0fc[_0x34e8('0x57')]['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x48f610,null))[_0x34e8('0x1e')](function(_0x138a93){if(_0x138a93){_0x11b490=_0x138a93;_0x17e99e['model']=_[_0x34e8('0x67')](db[_0x34e8('0xbd')][_0x34e8('0x40')]);_0x17e99e[_0x34e8('0x46')]=_[_0x34e8('0x67')](_0x27f0fc[_0x34e8('0x46')]);_0x17e99e[_0x34e8('0x4f')]=_[_0x34e8('0x58')](_0x17e99e['model'],_0x17e99e['query']);_0x59a88b[_0x34e8('0x47')]=_[_0x34e8('0x58')](_0x17e99e[_0x34e8('0x44')],qs[_0x34e8('0x48')](_0x27f0fc[_0x34e8('0x46')][_0x34e8('0x48')]));_0x59a88b[_0x34e8('0x47')]=_0x59a88b[_0x34e8('0x47')]['length']?_0x59a88b[_0x34e8('0x47')]:_0x17e99e[_0x34e8('0x44')];_0x59a88b[_0x34e8('0x4b')]=qs[_0x34e8('0x4c')](_0x27f0fc[_0x34e8('0x46')][_0x34e8('0x4c')]);_0x59a88b['where']=qs[_0x34e8('0x4f')](_[_0x34e8('0x4e')](_0x27f0fc['query'],_0x17e99e[_0x34e8('0x4f')]));if(_0x27f0fc[_0x34e8('0x46')][_0x34e8('0x50')]){_0x59a88b[_0x34e8('0x4d')]=_[_0x34e8('0x51')](_0x59a88b[_0x34e8('0x4d')],{'$or':_[_0x34e8('0x45')](_0x59a88b[_0x34e8('0x47')],function(_0x1f9e36){var _0x3bf175={};_0x3bf175[_0x1f9e36]={'$like':'%'+_0x27f0fc[_0x34e8('0x46')][_0x34e8('0x50')]+'%'};return _0x3bf175;})});}_0x59a88b=_['merge']({},_0x59a88b,_0x27f0fc[_0x34e8('0x52')]);return _0x11b490[_0x34e8('0xbf')](_0x59a88b);}})['then'](function(_0x508781){if(_0x508781){_0x55e618=_0x508781[_0x34e8('0x49')];if(!_0x27f0fc[_0x34e8('0x46')][_0x34e8('0x69')](_0x34e8('0x4a'))){_0x59a88b['limit']=qs[_0x34e8('0x2a')](_0x27f0fc[_0x34e8('0x46')]['limit']);_0x59a88b[_0x34e8('0x2d')]=qs['offset'](_0x27f0fc['query'][_0x34e8('0x2d')]);}return _0x11b490[_0x34e8('0xbf')](_0x59a88b);}})[_0x34e8('0x1e')](function(_0x3e40ee){if(_0x3e40ee){return _0x3e40ee?{'count':_0x55e618,'rows':_0x3e40ee}:null;}})[_0x34e8('0x1e')](respondWithResult(_0x48f610,null))['catch'](handleError(_0x48f610,null));};exports[_0x34e8('0xc0')]=function(_0x253c94,_0xefc7c8,_0x2b596b){var _0x4f0431={'raw':![],'where':{}};var _0x48fce5={};var _0x46d6f2={'count':0x0,'rows':[]};return db[_0x34e8('0x3f')][_0x34e8('0x66')]({'where':{'id':_0x253c94[_0x34e8('0x57')]['id']}})['then'](handleEntityNotFound(_0xefc7c8,null))[_0x34e8('0x1e')](function(_0x5b791f){if(_0x5b791f){_0x48fce5[_0x34e8('0x44')]=_[_0x34e8('0x67')](db[_0x34e8('0x9c')]['rawAttributes']);_0x48fce5['query']=_['keys'](_0x253c94[_0x34e8('0x46')]);_0x48fce5[_0x34e8('0x4f')]=_[_0x34e8('0x58')](_0x48fce5[_0x34e8('0x44')],_0x48fce5[_0x34e8('0x46')]);_0x4f0431[_0x34e8('0x47')]=_[_0x34e8('0x58')](_0x48fce5[_0x34e8('0x44')],qs[_0x34e8('0x48')](_0x253c94['query'][_0x34e8('0x48')]));_0x4f0431['attributes']=_0x4f0431[_0x34e8('0x47')][_0x34e8('0x49')]?_0x4f0431[_0x34e8('0x47')]:_0x48fce5['model'];if(!_0x253c94[_0x34e8('0x46')][_0x34e8('0x69')](_0x34e8('0x4a'))){_0x4f0431[_0x34e8('0x2a')]=qs[_0x34e8('0x2a')](_0x253c94[_0x34e8('0x46')][_0x34e8('0x2a')]);_0x4f0431[_0x34e8('0x2d')]=qs[_0x34e8('0x2d')](_0x253c94[_0x34e8('0x46')][_0x34e8('0x2d')]);}_0x4f0431[_0x34e8('0x4b')]=qs[_0x34e8('0x4c')](_0x253c94[_0x34e8('0x46')][_0x34e8('0x4c')]);_0x4f0431[_0x34e8('0x4d')]=qs[_0x34e8('0x4f')](_[_0x34e8('0x4e')](_0x253c94[_0x34e8('0x46')],_0x48fce5[_0x34e8('0x4f')]));_0x4f0431[_0x34e8('0x4d')][_0x34e8('0x6a')]=_0x5b791f['id'];if(_0x253c94[_0x34e8('0x46')][_0x34e8('0x50')]){_0x4f0431[_0x34e8('0x4d')]=_[_0x34e8('0x51')](_0x4f0431['where'],{'$or':_[_0x34e8('0x45')](_0x4f0431['attributes'],function(_0xe141df){var _0x5a3e83={};_0x5a3e83[_0xe141df]={'$like':'%'+_0x253c94['query'][_0x34e8('0x50')]+'%'};return _0x5a3e83;})});}_0x4f0431=_['merge']({},_0x4f0431,_0x253c94[_0x34e8('0x52')]);return db['SmsInteraction']['count']({'where':_0x4f0431['where']})[_0x34e8('0x1e')](function(_0x4dc680){_0x46d6f2[_0x34e8('0x2c')]=_0x4dc680;if(_0x253c94[_0x34e8('0x46')]['includeAll']){_0x4f0431[_0x34e8('0x54')]=[{'model':db['CmContact'],'as':_0x34e8('0xc1'),'required':![]},{'model':db['User'],'as':_0x34e8('0xc2'),'attributes':[_0x34e8('0x3a'),_0x34e8('0xc3'),_0x34e8('0xc4')],'required':![]},{'model':db['Tag'],'as':_0x34e8('0xc5'),'attributes':['id',_0x34e8('0x3a'),_0x34e8('0xc6')],'where':_0x253c94[_0x34e8('0x46')]['tag']?{'id':_0x253c94[_0x34e8('0x46')][_0x34e8('0xc7')]}:undefined,'required':_0x253c94[_0x34e8('0x46')][_0x34e8('0xc7')]?!![]:![]}];}return db[_0x34e8('0x9c')][_0x34e8('0x6b')](_0x4f0431);})[_0x34e8('0x1e')](function(_0x58edde){_0x46d6f2['rows']=_0x58edde;return _0x46d6f2;});}})[_0x34e8('0x1e')](respondWithFilteredResult(_0xefc7c8,_0x4f0431))['catch'](handleError(_0xefc7c8,null));};exports[_0x34e8('0x3b')]=function(_0x2d9c3e,_0xa1175c,_0x36e648){var _0x45c816,_0x5256f0,_0x52b067;if(_[_0x34e8('0x92')](_0x2d9c3e[_0x34e8('0x5b')][_0x34e8('0x5b')])||_0x2d9c3e[_0x34e8('0x5b')]['body']===''){throw new db[(_0x34e8('0x76'))][(_0x34e8('0x77'))](_0x34e8('0x93'));}if(_['isNil'](_0x2d9c3e[_0x34e8('0x5b')]['to'])){throw new db[(_0x34e8('0x76'))][(_0x34e8('0x77'))](_0x34e8('0xc8'));}_0x45c816=_0x2d9c3e['body']['to'];return db['SmsAccount'][_0x34e8('0x59')]({'where':{'id':_0x2d9c3e[_0x34e8('0x57')]['id']},'include':[{'model':db[_0x34e8('0x96')],'as':'List','include':[{'model':db[_0x34e8('0x75')],'as':_0x34e8('0x98'),'where':{'mobile':_0x45c816},'limit':0x1,'order':[[_0x34e8('0x7b'),_0x34e8('0x99')]]}]}]})[_0x34e8('0x1e')](handleEntityNotFound(_0xa1175c,null))[_0x34e8('0x1e')](function(_0x35c717){if(_0x35c717&&_0x35c717['List']){_0x5256f0=_0x35c717[_0x34e8('0x34')]({'plain':!![]});if(_0x5256f0['List']&&_0x5256f0[_0x34e8('0xc9')]['Contacts'][_0x34e8('0x49')]){return _0x5256f0[_0x34e8('0xc9')]['Contacts'][0x0];}return db[_0x34e8('0x75')][_0x34e8('0x5a')](_['defaults'](_0x2d9c3e['body'],{'firstName':_0x45c816,'mobile':_0x45c816,'phone':_0x45c816,'ListId':_0x5256f0[_0x34e8('0x97')]}));}})[_0x34e8('0x1e')](handleEntityNotFound(_0xa1175c,null))[_0x34e8('0x1e')](function(_0x110752){if(_0x110752){_0x52b067=_0x110752;return db[_0x34e8('0x9c')][_0x34e8('0x59')]({'where':{'ContactId':_0x52b067['id'],'closed':![],'SmsAccountId':_0x5256f0['id']}})[_0x34e8('0x1e')](function(_0x5bac4f){if(_0x5bac4f){return[_0x5bac4f,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d9c3e['user']['id'],'ContactId':_0x52b067['id'],'SmsAccountId':_0x5256f0['id'],'phone':_0x45c816,'firstMsgDirection':'out','Messages':[_[_0x34e8('0x51')](_0x2d9c3e[_0x34e8('0x5b')],{'read':![],'body':_0x2d9c3e[_0x34e8('0x5b')][_0x34e8('0x5b')],'phone':_0x45c816,'SmsAccountId':_0x5256f0['id'],'UserId':_0x2d9c3e['user']['id'],'ContactId':_0x52b067['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x34e8('0xca')}]})[_0x34e8('0x1e')](function(_0x52782f){return[_0x52782f,!![]];});});}})[_0x34e8('0xcb')](function(_0x5f2f77,_0x1105b1){if(_0x1105b1){return _0x5f2f77;}return db[_0x34e8('0xa4')][_0x34e8('0x5a')](_[_0x34e8('0x51')](_0x2d9c3e[_0x34e8('0x5b')],{'read':![],'body':_0x2d9c3e['body'][_0x34e8('0x5b')],'phone':_0x45c816,'SmsAccountId':_0x5256f0['id'],'SmsInteractionId':_0x5f2f77['id'],'UserId':_0x2d9c3e[_0x34e8('0x5c')]['id'],'ContactId':_0x52b067['id']}))[_0x34e8('0x1e')](function(_0x1bb9e0){_0x5f2f77[_0x34e8('0xcc')]['Messages']=[];_0x5f2f77[_0x34e8('0xcc')][_0x34e8('0xca')][_0x34e8('0xa0')](_0x1bb9e0['dataValues']);return _0x5f2f77;});})[_0x34e8('0x1e')](respondWithResult(_0xa1175c,null))[_0x34e8('0x28')](handleError(_0xa1175c,null));};exports['status']=function(_0x2ea958,_0x3975b7,_0x25f9b0){if(_0x2ea958[_0x34e8('0x5b')]['id']){delete _0x2ea958[_0x34e8('0x5b')]['id'];}var _0x3f54fb,_0x348868,_0x4ac2b6;return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x2ea958[_0x34e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x3975b7,null))[_0x34e8('0x1e')](function(_0xc26cf6){if(_0xc26cf6){_0x4ac2b6=_0xc26cf6;logger[_0x34e8('0x21')](_0x34e8('0xb2'),_0x34e8('0x29'),'received\x20delivery\x20report\x20from',_0xc26cf6[_0x34e8('0x42')],util[_0x34e8('0xcd')](_0x2ea958[_0x34e8('0x5b')],{'showHidden':![],'depth':null}));switch(_0xc26cf6[_0x34e8('0x42')]){case _0x34e8('0x83'):if(_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xce')]&&_0x2ea958['body'][_0x34e8('0x29')]){_0x348868=_0x2ea958[_0x34e8('0x5b')][_0x34e8('0x29')];return db['SmsMessage'][_0x34e8('0x59')]({'where':{'messageId':_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xce')]}});}break;case _0x34e8('0x84'):if(_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xcf')]&&_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xd0')]){_0x348868=_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xd0')];return db[_0x34e8('0xa4')][_0x34e8('0x59')]({'where':{'messageId':_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xcf')]}});}break;case'clicksend':if(_0x2ea958[_0x34e8('0x5b')]['message_id']&&_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xd1')]){_0x348868=_0x2ea958[_0x34e8('0x5b')]['status_code'];return db[_0x34e8('0xa4')][_0x34e8('0x59')]({'where':{'messageId':_0x2ea958['body'][_0x34e8('0x86')]}});}break;case _0x34e8('0x89'):var _0x597510=_0x2ea958[_0x34e8('0x5b')][_0x34e8('0x8a')][0x0];if(_0x597510[_0x34e8('0x81')]&&_0x597510[_0x34e8('0x29')][_0x34e8('0xd2')]===_0x34e8('0xd3')){_0x348868=_0x597510[_0x34e8('0x29')][_0x34e8('0xd2')];return db[_0x34e8('0xa4')][_0x34e8('0x59')]({'where':{'messageId':_0x597510['messageId']}});}break;case _0x34e8('0x8e'):if(_0x2ea958[_0x34e8('0x5b')][_0x34e8('0x81')]&&_0x2ea958['body'][_0x34e8('0x29')]){_0x348868=_0x2ea958[_0x34e8('0x5b')][_0x34e8('0x29')];return db['SmsMessage'][_0x34e8('0x59')]({'where':{'messageId':_0x2ea958[_0x34e8('0x5b')][_0x34e8('0x81')]}});}break;case _0x34e8('0x8f'):if(_0x2ea958['body'][0x0][_0x34e8('0x26')]['id']){_0x348868=_0x2ea958[_0x34e8('0x5b')][0x0][_0x34e8('0x42')];return db[_0x34e8('0xa4')][_0x34e8('0x59')]({'where':{'messageId':_0x2ea958[_0x34e8('0x5b')][0x0][_0x34e8('0x26')]['id']}});}break;case'intelepeer':if(_0x2ea958[_0x34e8('0x5b')]['redif']&&_0x2ea958['body'][_0x34e8('0x29')]){_0x348868=_0x2ea958[_0x34e8('0x5b')]['status'];return db['SmsMessage'][_0x34e8('0x59')]({'where':{'messageId':_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xd4')]}});}break;}}})[_0x34e8('0x1e')](handleEntityNotFound(_0x3975b7,null))['then'](function(_0x2a018f){if(_0x2a018f){_0x3f54fb=_0x2a018f;switch(_0x4ac2b6[_0x34e8('0x42')]){case _0x34e8('0x83'):if(_0x348868==='DELIVERED'){return _0x3f54fb[_0x34e8('0x33')]({'read':!![]});}else{logger[_0x34e8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x34e8('0x29'),'skebby',util[_0x34e8('0xcd')](_0x2ea958[_0x34e8('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x34e8('0x84'):if(_0x348868==='1'){return _0x3f54fb[_0x34e8('0x33')]({'read':!![]});}else{logger[_0x34e8('0x23')](_0x34e8('0xb2'),_0x34e8('0x29'),'skebby',util['inspect'](_0x2ea958[_0x34e8('0x5b')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2ea958[_0x34e8('0x5b')][_0x34e8('0xd5')]&&_0x348868>=0xc8&&_0x348868<=0xce){return _0x3f54fb[_0x34e8('0x33')]({'read':!![]});}else{logger[_0x34e8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x34e8('0x85'),util['inspect'](_0x2ea958[_0x34e8('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x34e8('0x89'):var _0x406a2d=_0x2ea958[_0x34e8('0x5b')][_0x34e8('0x8a')][0x0];if(_0x406a2d['status']['groupName']===_0x34e8('0xd3')){return _0x3f54fb[_0x34e8('0x33')]({'read':!![]});}else{logger[_0x34e8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x34e8('0x29'),_0x34e8('0x89'),util[_0x34e8('0xcd')](_0x2ea958['body'],{'showHidden':![],'depth':null}));}break;case _0x34e8('0x8e'):if(_0x348868==_0x34e8('0xd6')||_0x348868==_0x34e8('0xd7')){return _0x3f54fb[_0x34e8('0x33')]({'read':!![]});}else{logger['error'](_0x34e8('0xb2'),_0x34e8('0x29'),'clickatell',util['inspect'](_0x2ea958[_0x34e8('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x348868==_0x34e8('0xd8')){return _0x3f54fb['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x34e8('0x29'),_0x34e8('0x8f'),util['inspect'](_0x2ea958[_0x34e8('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x348868===_0x34e8('0xd9')||_0x348868==='ACCEPTD'){return _0x3f54fb[_0x34e8('0x33')]({'read':!![]});}else{logger[_0x34e8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x34e8('0x29'),_0x34e8('0x90'),util[_0x34e8('0xcd')](_0x2ea958[_0x34e8('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3f54fb;}})['then'](respondWithResult(_0x3975b7,null))['catch'](handleError(_0x3975b7,null));};exports[_0x34e8('0xda')]=function(_0x3720e6,_0x5ca78a,_0xa9778c){var _0x3ebef3,_0x59fcd1,_0x53ff24;return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x3720e6[_0x34e8('0x57')]['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x5ca78a,null))[_0x34e8('0x1e')](function(_0x46404e){if(_0x46404e){_0x53ff24=_0x46404e;logger['debug'](_0x34e8('0xb2'),_0x34e8('0x29'),_0x34e8('0xdb'),_0x46404e[_0x34e8('0x42')],util['inspect'](_0x3720e6[_0x34e8('0x46')],{'showHidden':![],'depth':null}));switch(_0x46404e[_0x34e8('0x42')]){case'csc':if(_0x3720e6['query'][_0x34e8('0xdc')]&&_0x3720e6[_0x34e8('0x46')]['state']){_0x59fcd1=_0x3720e6['query'][_0x34e8('0xdd')];return db[_0x34e8('0xa4')][_0x34e8('0x59')]({'where':{'messageId':_0x3720e6[_0x34e8('0x46')]['message-id']}});}break;}}})[_0x34e8('0x1e')](handleEntityNotFound(_0x5ca78a,null))[_0x34e8('0x1e')](function(_0x47d48e){if(_0x47d48e){_0x3ebef3=_0x47d48e;switch(_0x53ff24[_0x34e8('0x42')]){case'csc':if(_0x59fcd1==='2'||_0x59fcd1==='6'){return _0x3ebef3[_0x34e8('0x33')]({'read':!![]});}else{logger[_0x34e8('0x23')](_0x34e8('0xb2'),_0x34e8('0x29'),_0x34e8('0x8c'),util['inspect'](_0x3720e6[_0x34e8('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x3ebef3;}})[_0x34e8('0x1e')](respondWithResult(_0x5ca78a,null))[_0x34e8('0x28')](handleError(_0x5ca78a,null));};exports[_0x34e8('0xde')]=function(_0x4a25ab,_0x3dd757,_0x2bcc85){return db[_0x34e8('0x3f')][_0x34e8('0x59')]({'where':{'id':_0x4a25ab[_0x34e8('0x57')]['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x3dd757,null))[_0x34e8('0x1e')](function(_0x19fc2a){if(_0x19fc2a){return _0x19fc2a[_0x34e8('0xde')](_0x4a25ab['body'][_0x34e8('0x71')],_[_0x34e8('0xdf')](_0x4a25ab['body'],[_0x34e8('0x71'),'id'])||{})[_0x34e8('0xcb')](function(_0x32eeee){for(var _0x1a3d7f=0x0;_0x1a3d7f<_0x4a25ab[_0x34e8('0x5b')][_0x34e8('0x71')][_0x34e8('0x49')];_0x1a3d7f+=0x1){socket[_0x34e8('0xe0')](_0x34e8('0xe1'),{'UserId':Number(_0x4a25ab[_0x34e8('0x5b')][_0x34e8('0x71')][_0x1a3d7f]),'SmsAccountId':Number(_0x4a25ab['params']['id'])});}return _0x32eeee;});}})[_0x34e8('0x1e')](respondWithResult(_0x3dd757,null))[_0x34e8('0x28')](handleError(_0x3dd757,null));};exports[_0x34e8('0xe2')]=function(_0x1ec6e4,_0x3d7973,_0x3b12db){return db['SmsAccount'][_0x34e8('0x59')]({'where':{'id':_0x1ec6e4[_0x34e8('0x57')]['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x3d7973,null))[_0x34e8('0x1e')](function(_0x30e277){if(_0x30e277){return _0x30e277['removeAgents'](_0x1ec6e4[_0x34e8('0x46')][_0x34e8('0x71')])[_0x34e8('0x1e')](function(){if(_[_0x34e8('0xe3')](_0x1ec6e4['query']['ids'])){for(var _0x224eae=0x0;_0x224eae<_0x1ec6e4[_0x34e8('0x46')][_0x34e8('0x71')][_0x34e8('0x49')];_0x224eae+=0x1){socket[_0x34e8('0xe0')](_0x34e8('0xe4'),{'UserId':Number(_0x1ec6e4['query'][_0x34e8('0x71')][_0x224eae]),'SmsAccountId':Number(_0x1ec6e4[_0x34e8('0x57')]['id'])});}}else{socket[_0x34e8('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x1ec6e4['query'][_0x34e8('0x71')]),'SmsAccountId':Number(_0x1ec6e4[_0x34e8('0x57')]['id'])});}});}})[_0x34e8('0x1e')](respondWithStatusCode(_0x3d7973,null))[_0x34e8('0x28')](handleError(_0x3d7973,null));};exports[_0x34e8('0xe5')]=function(_0x65c1f1,_0x23534c,_0x5b93c1){var _0x81b203={};var _0x27f760={};var _0x181c93;var _0x30c0f7;return db['SmsAccount'][_0x34e8('0x66')]({'where':{'id':_0x65c1f1[_0x34e8('0x57')]['id']}})[_0x34e8('0x1e')](handleEntityNotFound(_0x23534c,null))['then'](function(_0x4d4db7){if(_0x4d4db7){_0x181c93=_0x4d4db7;_0x27f760[_0x34e8('0x44')]=_[_0x34e8('0x67')](db[_0x34e8('0xa7')]['rawAttributes']);_0x27f760['query']=_[_0x34e8('0x67')](_0x65c1f1[_0x34e8('0x46')]);_0x27f760[_0x34e8('0x4f')]=_[_0x34e8('0x58')](_0x27f760[_0x34e8('0x44')],_0x27f760[_0x34e8('0x46')]);_0x81b203[_0x34e8('0x47')]=_[_0x34e8('0x58')](_0x27f760['model'],qs[_0x34e8('0x48')](_0x65c1f1[_0x34e8('0x46')][_0x34e8('0x48')]));_0x81b203[_0x34e8('0x47')]=_0x81b203[_0x34e8('0x47')][_0x34e8('0x49')]?_0x81b203[_0x34e8('0x47')]:_0x27f760[_0x34e8('0x44')];_0x81b203[_0x34e8('0x4b')]=qs['sort'](_0x65c1f1[_0x34e8('0x46')][_0x34e8('0x4c')]);_0x81b203[_0x34e8('0x4d')]=qs[_0x34e8('0x4f')](_[_0x34e8('0x4e')](_0x65c1f1[_0x34e8('0x46')],_0x27f760['filters']));if(_0x65c1f1[_0x34e8('0x46')]['filter']){_0x81b203['where']=_['merge'](_0x81b203[_0x34e8('0x4d')],{'$or':_[_0x34e8('0x45')](_0x81b203[_0x34e8('0x47')],function(_0x5cf629){var _0x1b2767={};_0x1b2767[_0x5cf629]={'$like':'%'+_0x65c1f1['query'][_0x34e8('0x50')]+'%'};return _0x1b2767;})});}_0x81b203=_[_0x34e8('0x51')]({},_0x81b203,_0x65c1f1[_0x34e8('0x52')]);return _0x181c93[_0x34e8('0xe5')](_0x81b203);}})['then'](function(_0x3a4035){if(_0x3a4035){_0x30c0f7=_0x3a4035[_0x34e8('0x49')];if(!_0x65c1f1[_0x34e8('0x46')]['hasOwnProperty'](_0x34e8('0x4a'))){_0x81b203['limit']=qs[_0x34e8('0x2a')](_0x65c1f1[_0x34e8('0x46')][_0x34e8('0x2a')]);_0x81b203[_0x34e8('0x2d')]=qs[_0x34e8('0x2d')](_0x65c1f1[_0x34e8('0x46')][_0x34e8('0x2d')]);}return _0x181c93[_0x34e8('0xe5')](_0x81b203);}})[_0x34e8('0x1e')](function(_0x184219){if(_0x184219){return _0x184219?{'count':_0x30c0f7,'rows':_0x184219}:null;}})[_0x34e8('0x1e')](respondWithResult(_0x23534c,null))[_0x34e8('0x28')](handleError(_0x23534c,null));}; \ No newline at end of file +var _0x9641=['startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','\x0a','addApplications','transaction','Transaction','SmsApplication','bulkCreate','finally','getApplications','nolimit','Owner','internal','Tag','Tags','tag','to\x20is\x20mandatory','CmList','List','SmsMessage','dataValues','Messages','push','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','redif','clicksend','clickatell','RECEIVED_BY_RECIPIENT','message-delivered','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','merge','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','From','Body','skebby','from','sender','text','messageId','message_id','infobip','results','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','omit','SmsInteraction','spread','interaction','autoclose','close','unmanaged','*,*,*,*','created','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','Start'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x9641,0x113));var _0x1964=function(_0x2d5a8e,_0x333734){_0x2d5a8e=_0x2d5a8e-0x0;var _0x3d97f8=_0x9641[_0x2d5a8e];return _0x3d97f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1964('0x0'));var zipdir=require(_0x1964('0x1'));var jsonpatch=require(_0x1964('0x2'));var rp=require(_0x1964('0x3'));var moment=require(_0x1964('0x4'));var BPromise=require(_0x1964('0x5'));var Mustache=require('mustache');var util=require(_0x1964('0x6'));var path=require(_0x1964('0x7'));var sox=require(_0x1964('0x8'));var csv=require(_0x1964('0x9'));var ejs=require(_0x1964('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1964('0xb'));var squel=require('squel');var crypto=require(_0x1964('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1964('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1964('0xe'));var Redis=require('ioredis');var authService=require(_0x1964('0xf'));var qs=require(_0x1964('0x10'));var as=require(_0x1964('0x11'));var hardwareService=require(_0x1964('0x12'));var logger=require(_0x1964('0x13'))(_0x1964('0x14'));var utils=require(_0x1964('0x15'));var config=require(_0x1964('0x16'));var licenseUtil=require(_0x1964('0x17'));var db=require('../../mysqldb')['db'];config[_0x1964('0x18')]=_[_0x1964('0x19')](config[_0x1964('0x18')],{'host':_0x1964('0x1a'),'port':0x18eb});var socket=require(_0x1964('0x1b'))(new Redis(config[_0x1964('0x18')]));require(_0x1964('0x1c'))[_0x1964('0x1d')](socket);var jayson=require(_0x1964('0x1e'));var client=jayson[_0x1964('0x1f')][_0x1964('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1ccee3,_0x53b99a,_0x157d25,_0x2243c9){return new BPromise(function(_0x4c3b7e,_0x17e5d0){var _0x53c4b9=_0x2243c9||client;return _0x53c4b9['request'](_0x1ccee3,_0x157d25)['then'](function(_0x3c1cf8){logger[_0x1964('0x21')](_0x1964('0x22'),_0x53b99a,_0x1964('0x23'));logger[_0x1964('0x24')](_0x1964('0x25'),_0x53b99a,'request\x20sent',JSON['stringify'](_0x3c1cf8));if(_0x3c1cf8[_0x1964('0x26')]){if(_0x3c1cf8[_0x1964('0x26')][_0x1964('0x27')]===0x1f4){logger[_0x1964('0x26')]('SmsAccount,\x20%s,\x20%s',_0x53b99a,_0x3c1cf8[_0x1964('0x26')]['message']);return _0x17e5d0(_0x3c1cf8[_0x1964('0x26')][_0x1964('0x28')]);}logger[_0x1964('0x26')](_0x1964('0x22'),_0x53b99a,_0x3c1cf8[_0x1964('0x26')]['message']);return _0x4c3b7e(_0x3c1cf8['error'][_0x1964('0x28')]);}else{logger[_0x1964('0x21')](_0x1964('0x22'),_0x53b99a,_0x1964('0x23'));_0x4c3b7e(_0x3c1cf8[_0x1964('0x29')][_0x1964('0x28')]);}})['catch'](function(_0x7c75dc){logger['error']('SmsAccount,\x20%s,\x20%s',_0x53b99a,_0x7c75dc);_0x17e5d0(_0x7c75dc);});});}function respondWithStatusCode(_0xc990bb,_0x3c177c){_0x3c177c=_0x3c177c||0xcc;return function(_0x212e8f){if(_0x212e8f){return _0xc990bb[_0x1964('0x2a')](_0x3c177c);}return _0xc990bb['status'](_0x3c177c)[_0x1964('0x2b')]();};}function respondWithResult(_0x406973,_0x4292b1){_0x4292b1=_0x4292b1||0xc8;return function(_0x301294){if(_0x301294){return _0x406973[_0x1964('0x2c')](_0x4292b1)[_0x1964('0x2d')](_0x301294);}};}function respondWithFilteredResult(_0x5090a6,_0x151fb6){return function(_0x1ffc85){if(_0x1ffc85){var _0x48a9f2=typeof _0x151fb6[_0x1964('0x2e')]===_0x1964('0x2f')&&typeof _0x151fb6[_0x1964('0x30')]===_0x1964('0x2f');var _0x15962b=_0x1ffc85['count'];var _0x313e6e=_0x48a9f2?0x0:_0x151fb6[_0x1964('0x2e')];var _0x587163=_0x48a9f2?_0x1ffc85[_0x1964('0x31')]:_0x151fb6[_0x1964('0x2e')]+_0x151fb6['limit'];var _0x33ff52;if(_0x587163>=_0x15962b){_0x587163=_0x15962b;_0x33ff52=0xc8;}else{_0x33ff52=0xce;}_0x5090a6[_0x1964('0x2c')](_0x33ff52);return _0x5090a6[_0x1964('0x32')]('Content-Range',_0x313e6e+'-'+_0x587163+'/'+_0x15962b)[_0x1964('0x2d')](_0x1ffc85);}return null;};}function patchUpdates(_0x23df4d){return function(_0x50fc58){try{jsonpatch['apply'](_0x50fc58,_0x23df4d,!![]);}catch(_0x49cce0){return BPromise[_0x1964('0x33')](_0x49cce0);}return _0x50fc58['save']();};}function saveUpdates(_0x4fff1a,_0x574bcd){return function(_0x2621a8){if(_0x2621a8){return _0x2621a8['update'](_0x4fff1a)[_0x1964('0x34')](function(_0x1f5b27){return _0x1f5b27;});}return null;};}function removeEntity(_0x1e7e48,_0x1e4cf0){return function(_0x557367){if(_0x557367){return _0x557367[_0x1964('0x35')]()['then'](function(){var _0x4c9791=_0x557367[_0x1964('0x36')]({'plain':!![]});var _0x25a0aa=_0x1964('0x37');return db[_0x1964('0x38')]['destroy']({'where':{'type':_0x25a0aa,'resourceId':_0x4c9791['id']}})[_0x1964('0x34')](function(){return _0x557367;});})[_0x1964('0x34')](function(){_0x1e7e48[_0x1964('0x2c')](0xcc)[_0x1964('0x2b')]();});}};}function handleEntityNotFound(_0x3aa852,_0x61f10f){return function(_0x3568cf){if(!_0x3568cf){_0x3aa852['sendStatus'](0x194);}return _0x3568cf;};}function handleError(_0x5fd7b0,_0x27ce1b){_0x27ce1b=_0x27ce1b||0x1f4;return function(_0x1fb6dc){logger[_0x1964('0x26')](_0x1fb6dc[_0x1964('0x39')]);if(_0x1fb6dc[_0x1964('0x3a')]){delete _0x1fb6dc[_0x1964('0x3a')];}_0x5fd7b0[_0x1964('0x2c')](_0x27ce1b)['send'](_0x1fb6dc);};}exports[_0x1964('0x3b')]=function(_0x2d16fe,_0x579057){var _0x1afcf1={'include':[{'model':db[_0x1964('0x3c')],'as':_0x1964('0x3d')}]},_0x3b98fb={},_0x3e6701={'count':0x0,'rows':[]};var _0x137d6d=_[_0x1964('0x3e')](db[_0x1964('0x3f')][_0x1964('0x40')],function(_0x4619d2){return{'name':_0x4619d2[_0x1964('0x41')],'type':_0x4619d2[_0x1964('0x42')][_0x1964('0x43')]};});_0x3b98fb[_0x1964('0x44')]=_[_0x1964('0x3e')](_0x137d6d,_0x1964('0x3a'));_0x3b98fb[_0x1964('0x45')]=_['keys'](_0x2d16fe[_0x1964('0x45')]);_0x3b98fb[_0x1964('0x46')]=_[_0x1964('0x47')](_0x3b98fb[_0x1964('0x44')],_0x3b98fb[_0x1964('0x45')]);_0x1afcf1[_0x1964('0x48')]=_[_0x1964('0x47')](_0x3b98fb[_0x1964('0x44')],qs[_0x1964('0x49')](_0x2d16fe[_0x1964('0x45')]['fields']));_0x1afcf1[_0x1964('0x48')]=_0x1afcf1[_0x1964('0x48')][_0x1964('0x4a')]?_0x1afcf1[_0x1964('0x48')]:_0x3b98fb['model'];if(!_0x2d16fe['query'][_0x1964('0x4b')]('nolimit')){_0x1afcf1[_0x1964('0x30')]=qs[_0x1964('0x30')](_0x2d16fe[_0x1964('0x45')][_0x1964('0x30')]);_0x1afcf1[_0x1964('0x2e')]=qs[_0x1964('0x2e')](_0x2d16fe[_0x1964('0x45')][_0x1964('0x2e')]);}_0x1afcf1[_0x1964('0x4c')]=qs[_0x1964('0x4d')](_0x2d16fe['query'][_0x1964('0x4d')]);_0x1afcf1['where']=qs['filters'](_[_0x1964('0x4e')](_0x2d16fe[_0x1964('0x45')],_0x3b98fb[_0x1964('0x46')]),_0x137d6d);if(_0x2d16fe[_0x1964('0x45')][_0x1964('0x4f')]){_0x1afcf1[_0x1964('0x50')]=_['merge'](_0x1afcf1[_0x1964('0x50')],{'$or':_['map'](_0x137d6d,function(_0x2dc1a1){if(_0x2dc1a1[_0x1964('0x42')]!==_0x1964('0x51')){var _0x4d69f4={};_0x4d69f4[_0x2dc1a1['name']]={'$like':'%'+_0x2d16fe['query'][_0x1964('0x4f')]+'%'};return _0x4d69f4;}})});}_0x1afcf1=_['merge']({},_0x1afcf1,_0x2d16fe[_0x1964('0x52')]);var _0x526586={'where':_0x1afcf1[_0x1964('0x50')]};return db['SmsAccount']['count'](_0x526586)['then'](function(_0x2b5db3){_0x3e6701[_0x1964('0x31')]=_0x2b5db3;if(_0x2d16fe[_0x1964('0x45')][_0x1964('0x53')]){_0x1afcf1[_0x1964('0x54')]=[{'all':!![]}];}return db[_0x1964('0x3f')][_0x1964('0x55')](_0x1afcf1);})['then'](function(_0x3d14c6){_0x3e6701[_0x1964('0x56')]=_0x3d14c6;return _0x3e6701;})[_0x1964('0x34')](respondWithFilteredResult(_0x579057,_0x1afcf1))[_0x1964('0x57')](handleError(_0x579057,null));};exports[_0x1964('0x58')]=function(_0x476ee0,_0x2941d3){var _0x58c0c6={'raw':![],'where':{'id':_0x476ee0[_0x1964('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x1964('0x3d')}]},_0x24c13d={};_0x24c13d[_0x1964('0x44')]=_['keys'](db[_0x1964('0x3f')][_0x1964('0x40')]);_0x24c13d[_0x1964('0x45')]=_[_0x1964('0x5a')](_0x476ee0[_0x1964('0x45')]);_0x24c13d['filters']=_[_0x1964('0x47')](_0x24c13d[_0x1964('0x44')],_0x24c13d[_0x1964('0x45')]);_0x58c0c6['attributes']=_[_0x1964('0x47')](_0x24c13d[_0x1964('0x44')],qs[_0x1964('0x49')](_0x476ee0[_0x1964('0x45')][_0x1964('0x49')]));_0x58c0c6[_0x1964('0x48')]=_0x58c0c6['attributes']['length']?_0x58c0c6['attributes']:_0x24c13d[_0x1964('0x44')];if(_0x476ee0['query'][_0x1964('0x53')]){_0x58c0c6['include']=[{'all':!![]}];}_0x58c0c6=_['merge']({},_0x58c0c6,_0x476ee0['options']);return db[_0x1964('0x3f')][_0x1964('0x5b')](_0x58c0c6)[_0x1964('0x34')](handleEntityNotFound(_0x2941d3,null))['then'](respondWithResult(_0x2941d3,null))['catch'](handleError(_0x2941d3,null));};exports['create']=function(_0x33adea,_0x4161ff){return db['SmsAccount'][_0x1964('0x5c')](_0x33adea[_0x1964('0x5d')],{})[_0x1964('0x34')](function(_0x13e033){var _0x4ce482=_0x33adea[_0x1964('0x5e')][_0x1964('0x36')]({'plain':!![]});if(!_0x4ce482)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ce482[_0x1964('0x5f')]===_0x1964('0x5e')){var _0x1beccc=_0x13e033[_0x1964('0x36')]({'plain':!![]});var _0x258073='SmsAccounts';return db[_0x1964('0x60')][_0x1964('0x5b')]({'where':{'name':_0x258073,'userProfileId':_0x4ce482['userProfileId']},'raw':!![]})[_0x1964('0x34')](function(_0x143334){if(_0x143334&&_0x143334['autoAssociation']===0x0){return db[_0x1964('0x38')][_0x1964('0x5c')]({'name':_0x1beccc['name'],'resourceId':_0x1beccc['id'],'type':_0x143334['name'],'sectionId':_0x143334['id']},{})['then'](function(){return _0x13e033;});}else{return _0x13e033;}})[_0x1964('0x57')](function(_0x4067c8){logger['error'](_0x1964('0x61'),_0x4067c8);throw _0x4067c8;});}return _0x13e033;})['then'](respondWithResult(_0x4161ff,0xc9))['catch'](handleError(_0x4161ff,null));};exports[_0x1964('0x62')]=function(_0x6610c8,_0x18408a){if(_0x6610c8[_0x1964('0x5d')]['id']){delete _0x6610c8[_0x1964('0x5d')]['id'];}return db[_0x1964('0x3f')][_0x1964('0x5b')]({'where':{'id':_0x6610c8[_0x1964('0x59')]['id']},'include':[{'model':db[_0x1964('0x3c')],'as':_0x1964('0x3d')}]})[_0x1964('0x34')](handleEntityNotFound(_0x18408a,null))[_0x1964('0x34')](saveUpdates(_0x6610c8['body'],null))[_0x1964('0x34')](respondWithResult(_0x18408a,null))[_0x1964('0x57')](handleError(_0x18408a,null));};exports[_0x1964('0x35')]=function(_0x283cdf,_0x685b52){return db[_0x1964('0x3f')]['find']({'where':{'id':_0x283cdf['params']['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x685b52,null))['then'](removeEntity(_0x685b52,null))[_0x1964('0x57')](handleError(_0x685b52,null));};exports[_0x1964('0x63')]=function(_0x32eff2,_0x185b22){return db[_0x1964('0x3f')][_0x1964('0x63')]()[_0x1964('0x34')](respondWithResult(_0x185b22,null))[_0x1964('0x57')](handleError(_0x185b22,null));};exports[_0x1964('0x64')]=function(_0x2c8865,_0x4b9991,_0x3773e4){if(_0x2c8865[_0x1964('0x5d')]['id']){delete _0x2c8865[_0x1964('0x5d')]['id'];}return db['SmsAccount'][_0x1964('0x5b')]({'where':{'id':_0x2c8865[_0x1964('0x59')]['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x4b9991,null))['then'](function(_0x42b306){if(_0x42b306){_0x2c8865[_0x1964('0x5d')][_0x1964('0x65')]=_0x42b306['id'];return db[_0x1964('0x66')][_0x1964('0x5c')](_0x2c8865[_0x1964('0x5d')]);}})['then'](respondWithResult(_0x4b9991,null))[_0x1964('0x57')](handleError(_0x4b9991,null));};exports[_0x1964('0x67')]=function(_0xdda223,_0x543b9e,_0x436e35){var _0x532b52={'raw':![],'where':{}};var _0x144f27={};var _0x36955f={'count':0x0,'rows':[]};return db[_0x1964('0x3f')][_0x1964('0x68')]({'where':{'id':_0xdda223[_0x1964('0x59')]['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x543b9e,null))[_0x1964('0x34')](function(_0x294164){if(_0x294164){_0x144f27[_0x1964('0x44')]=_[_0x1964('0x5a')](db[_0x1964('0x66')][_0x1964('0x40')]);_0x144f27['query']=_[_0x1964('0x5a')](_0xdda223['query']);_0x144f27[_0x1964('0x46')]=_[_0x1964('0x47')](_0x144f27[_0x1964('0x44')],_0x144f27[_0x1964('0x45')]);_0x532b52[_0x1964('0x48')]=_[_0x1964('0x47')](_0x144f27['model'],qs['fields'](_0xdda223[_0x1964('0x45')][_0x1964('0x49')]));_0x532b52[_0x1964('0x48')]=_0x532b52[_0x1964('0x48')][_0x1964('0x4a')]?_0x532b52[_0x1964('0x48')]:_0x144f27[_0x1964('0x44')];if(!_0xdda223[_0x1964('0x45')][_0x1964('0x4b')]('nolimit')){_0x532b52[_0x1964('0x30')]=qs['limit'](_0xdda223[_0x1964('0x45')][_0x1964('0x30')]);_0x532b52[_0x1964('0x2e')]=qs[_0x1964('0x2e')](_0xdda223[_0x1964('0x45')][_0x1964('0x2e')]);}_0x532b52[_0x1964('0x4c')]=qs[_0x1964('0x4d')](_0xdda223[_0x1964('0x45')][_0x1964('0x4d')]);_0x532b52[_0x1964('0x50')]=qs[_0x1964('0x46')](_['pick'](_0xdda223['query'],_0x144f27[_0x1964('0x46')]));_0x532b52[_0x1964('0x50')][_0x1964('0x65')]=_0x294164['id'];if(_0xdda223[_0x1964('0x45')]['filter']){_0x532b52[_0x1964('0x50')]=_[_0x1964('0x69')](_0x532b52['where'],{'$or':_['map'](_0x532b52[_0x1964('0x48')],function(_0x487f23){var _0x502360={};_0x502360[_0x487f23]={'$like':'%'+_0xdda223[_0x1964('0x45')]['filter']+'%'};return _0x502360;})});}_0x532b52=_[_0x1964('0x69')]({},_0x532b52,_0xdda223[_0x1964('0x52')]);return db[_0x1964('0x66')][_0x1964('0x31')]({'where':_0x532b52[_0x1964('0x50')]})[_0x1964('0x34')](function(_0xbaa58d){_0x36955f[_0x1964('0x31')]=_0xbaa58d;if(_0xdda223[_0x1964('0x45')][_0x1964('0x53')]){_0x532b52[_0x1964('0x54')]=[{'all':!![]}];}return db[_0x1964('0x66')][_0x1964('0x55')](_0x532b52);})[_0x1964('0x34')](function(_0x361f4){_0x36955f[_0x1964('0x56')]=_0x361f4;return _0x36955f;});}})[_0x1964('0x34')](respondWithFilteredResult(_0x543b9e,_0x532b52))[_0x1964('0x57')](handleError(_0x543b9e,null));};exports[_0x1964('0x6a')]=function(_0x5102ff,_0x573301,_0x54c6b5){return db[_0x1964('0x3f')]['find']({'where':{'id':_0x5102ff[_0x1964('0x59')]['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x573301,null))[_0x1964('0x34')](function(_0x5adf32){if(_0x5adf32){return _0x5adf32[_0x1964('0x6a')](_0x5102ff[_0x1964('0x45')][_0x1964('0x6b')]);}})['then'](respondWithStatusCode(_0x573301,null))['catch'](handleError(_0x573301,null));};exports[_0x1964('0x6c')]=function(_0x2f1f20,_0x536c52,_0x4397d4){if(_0x2f1f20[_0x1964('0x5d')]['id']){delete _0x2f1f20[_0x1964('0x5d')]['id'];}return db['SmsAccount'][_0x1964('0x5b')]({'where':{'id':_0x2f1f20[_0x1964('0x59')]['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x536c52,null))[_0x1964('0x34')](function(_0x3bcc63){if(_0x3bcc63){_0x2f1f20[_0x1964('0x5d')][_0x1964('0x65')]=_0x3bcc63['id'];return db[_0x1964('0x6d')][_0x1964('0x5c')](_0x2f1f20[_0x1964('0x5d')]);}})[_0x1964('0x34')](respondWithResult(_0x536c52,null))['catch'](handleError(_0x536c52,null));};exports[_0x1964('0x6e')]=function(_0x4f35e6,_0x37e4fc,_0x3b694c){var _0x3ba64a={'raw':![],'where':{}};var _0x4b4dce={};var _0x42419f={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x4f35e6[_0x1964('0x59')]['id']}})['then'](handleEntityNotFound(_0x37e4fc,null))['then'](function(_0x3a75de){if(_0x3a75de){_0x4b4dce['model']=_[_0x1964('0x5a')](db[_0x1964('0x6d')][_0x1964('0x40')]);_0x4b4dce['query']=_[_0x1964('0x5a')](_0x4f35e6[_0x1964('0x45')]);_0x4b4dce[_0x1964('0x46')]=_[_0x1964('0x47')](_0x4b4dce[_0x1964('0x44')],_0x4b4dce[_0x1964('0x45')]);_0x3ba64a[_0x1964('0x48')]=_[_0x1964('0x47')](_0x4b4dce[_0x1964('0x44')],qs[_0x1964('0x49')](_0x4f35e6[_0x1964('0x45')]['fields']));_0x3ba64a[_0x1964('0x48')]=_0x3ba64a['attributes'][_0x1964('0x4a')]?_0x3ba64a[_0x1964('0x48')]:_0x4b4dce[_0x1964('0x44')];if(!_0x4f35e6[_0x1964('0x45')]['hasOwnProperty']('nolimit')){_0x3ba64a[_0x1964('0x30')]=qs['limit'](_0x4f35e6[_0x1964('0x45')][_0x1964('0x30')]);_0x3ba64a[_0x1964('0x2e')]=qs[_0x1964('0x2e')](_0x4f35e6[_0x1964('0x45')][_0x1964('0x2e')]);}_0x3ba64a[_0x1964('0x4c')]=qs[_0x1964('0x4d')](_0x4f35e6[_0x1964('0x45')]['sort']);_0x3ba64a[_0x1964('0x50')]=qs[_0x1964('0x46')](_['pick'](_0x4f35e6[_0x1964('0x45')],_0x4b4dce['filters']));_0x3ba64a[_0x1964('0x50')][_0x1964('0x65')]=_0x3a75de['id'];if(_0x4f35e6['query'][_0x1964('0x4f')]){_0x3ba64a['where']=_[_0x1964('0x69')](_0x3ba64a[_0x1964('0x50')],{'$or':_[_0x1964('0x3e')](_0x3ba64a[_0x1964('0x48')],function(_0xbf2f60){var _0x2bd1b6={};_0x2bd1b6[_0xbf2f60]={'$like':'%'+_0x4f35e6[_0x1964('0x45')][_0x1964('0x4f')]+'%'};return _0x2bd1b6;})});}_0x3ba64a=_[_0x1964('0x69')]({},_0x3ba64a,_0x4f35e6[_0x1964('0x52')]);return db[_0x1964('0x6d')]['count']({'where':_0x3ba64a[_0x1964('0x50')]})[_0x1964('0x34')](function(_0x5ac027){_0x42419f[_0x1964('0x31')]=_0x5ac027;if(_0x4f35e6[_0x1964('0x45')][_0x1964('0x53')]){_0x3ba64a[_0x1964('0x54')]=[{'all':!![]}];}return db[_0x1964('0x6d')][_0x1964('0x55')](_0x3ba64a);})[_0x1964('0x34')](function(_0x576586){_0x42419f[_0x1964('0x56')]=_0x576586;return _0x42419f;});}})[_0x1964('0x34')](respondWithFilteredResult(_0x37e4fc,_0x3ba64a))['catch'](handleError(_0x37e4fc,null));};exports[_0x1964('0x6f')]=function(_0x4412ae,_0x3dc05d,_0x4c2df5){return db[_0x1964('0x3f')]['find']({'where':{'id':_0x4412ae['params']['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x3dc05d,null))['then'](function(_0xa3d247){if(_0xa3d247){return _0xa3d247[_0x1964('0x6f')](_0x4412ae[_0x1964('0x45')][_0x1964('0x6b')]);}})[_0x1964('0x34')](respondWithStatusCode(_0x3dc05d,null))[_0x1964('0x57')](handleError(_0x3dc05d,null));};exports[_0x1964('0x70')]=function(_0x3f7939,_0x527b8e,_0x590944){var _0xef82a8={'channel':_0x1964('0x71')};var _0x9b8633=[];var _0x2943bf=[];var _0x42446c={};return db['SmsAccount'][_0x1964('0x5b')]({'where':{'id':_0x3f7939[_0x1964('0x59')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x1964('0x72')}]})['then'](handleEntityNotFound(_0x527b8e,null))['then'](function(_0x119d4c){_0xef82a8[_0x1964('0x73')]=_0x119d4c;_0xef82a8[_0x1964('0x74')]=_[_0x1964('0x75')](_0x119d4c['Applications'],[_0x1964('0x76')],['asc']);if(_0xef82a8[_0x1964('0x73')][_0x1964('0x72')]){delete _0xef82a8[_0x1964('0x73')][_0x1964('0x72')];}return db[_0x1964('0x77')][_0x1964('0x63')]();})[_0x1964('0x34')](function(_0xd8148a){if(!_0xd8148a){throw new db[(_0x1964('0x78'))][(_0x1964('0x79'))](_0x1964('0x7a'));}_0x9b8633=_[_0x1964('0x7b')](_[_0x1964('0x5a')](_0xd8148a),[_0x1964('0x7c'),_0x1964('0x7d')]);_0x2943bf=_[_0x1964('0x7b')](_['keys'](_0xd8148a),[_0x1964('0x7c'),_0x1964('0x7d'),_0x1964('0x7e'),_0x1964('0x7f')]);_0xef82a8[_0x1964('0x5d')]={'mapKey':'mobile'};if(_0xef82a8[_0x1964('0x73')][_0x1964('0x42')]){switch(_0xef82a8[_0x1964('0x73')][_0x1964('0x42')]){case'twilio':_0xef82a8[_0x1964('0x5d')]['from']=_0x3f7939['body'][_0x1964('0x80')];_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')]=_0x3f7939['body'][_0x1964('0x81')];_0xef82a8[_0x1964('0x5d')]['messageId']=_0x3f7939[_0x1964('0x5d')]['MessageSid'];break;case _0x1964('0x82'):_0xef82a8['body'][_0x1964('0x83')]='+'+_0x3f7939[_0x1964('0x5d')][_0x1964('0x84')];_0xef82a8['body']['body']=_0x3f7939[_0x1964('0x5d')][_0x1964('0x85')];break;case'connectel':_0xef82a8['body']['from']=_0x3f7939['body'][_0x1964('0x83')];_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')]=_0x3f7939['body'][_0x1964('0x28')];break;case'clicksend':_0xef82a8['body']['from']=_0x3f7939[_0x1964('0x5d')][_0x1964('0x83')];_0xef82a8['body'][_0x1964('0x5d')]=_0x3f7939[_0x1964('0x5d')]['body'];_0xef82a8[_0x1964('0x5d')][_0x1964('0x86')]=_0x3f7939['body'][_0x1964('0x87')];break;case'plivo':_0xef82a8['body']['from']=_0x3f7939[_0x1964('0x5d')][_0x1964('0x80')];_0xef82a8['body'][_0x1964('0x5d')]=_0x3f7939[_0x1964('0x5d')]['Text'];_0xef82a8[_0x1964('0x5d')]['messageId']=_0x3f7939[_0x1964('0x5d')]['MessageUUID'];break;case _0x1964('0x88'):_0xef82a8[_0x1964('0x5d')][_0x1964('0x83')]='+'+_0x3f7939[_0x1964('0x5d')]['results'][0x0][_0x1964('0x83')];_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')]=_0x3f7939[_0x1964('0x5d')][_0x1964('0x89')][0x0][_0x1964('0x85')];_0xef82a8[_0x1964('0x5d')][_0x1964('0x86')]=_0x3f7939[_0x1964('0x5d')]['results'][0x0]['messageId'];break;case'csc':_0xef82a8[_0x1964('0x5d')][_0x1964('0x83')]=_0x3f7939['body'][_0x1964('0x8a')];_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')]=_0x3f7939['body'][_0x1964('0x8b')][_0x1964('0x28')];break;case'clickatell':_0xef82a8['body'][_0x1964('0x83')]=_0x3f7939[_0x1964('0x5d')]['fromNumber'];_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')]=_0x3f7939[_0x1964('0x5d')][_0x1964('0x85')];_0xef82a8['body']['messageId']=_0x3f7939[_0x1964('0x5d')][_0x1964('0x8c')];break;case _0x1964('0x8d'):_0xef82a8[_0x1964('0x5d')][_0x1964('0x86')]=_0x3f7939[_0x1964('0x5d')][0x0][_0x1964('0x28')]['id'];_0xef82a8[_0x1964('0x5d')][_0x1964('0x83')]=_0x3f7939[_0x1964('0x5d')][0x0][_0x1964('0x28')][_0x1964('0x83')];_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')]=_0x3f7939['body'][0x0][_0x1964('0x28')]['text'];break;case _0x1964('0x8e'):_0xef82a8[_0x1964('0x5d')][_0x1964('0x83')]=_0x3f7939[_0x1964('0x5d')]['from'];_0xef82a8[_0x1964('0x5d')]['body']=_0x3f7939[_0x1964('0x5d')][_0x1964('0x28')];_0xef82a8[_0x1964('0x5d')][_0x1964('0x86')]=_0x3f7939[_0x1964('0x5d')][_0x1964('0x8f')];break;}}if(_0xef82a8[_0x1964('0x5d')]['id']){delete _0xef82a8[_0x1964('0x5d')]['id'];}if(_['isNil'](_0xef82a8[_0x1964('0x5d')][_0x1964('0x83')])){throw new db[(_0x1964('0x78'))][(_0x1964('0x79'))](_0x1964('0x90'));}if(_[_0x1964('0x91')](_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')])||_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')]===''){throw new db[(_0x1964('0x78'))][(_0x1964('0x79'))](_0x1964('0x92'));}if(_['isNil'](_0xef82a8[_0x1964('0x5d')][_0x1964('0x93')])){throw new db['Sequelize'][(_0x1964('0x79'))](_0x1964('0x94')+_0x2943bf);}if(!_[_0x1964('0x95')](_0x2943bf,_0xef82a8[_0x1964('0x5d')][_0x1964('0x93')])){throw new db[(_0x1964('0x78'))]['ValidationError'](_0x1964('0x96')+_0x2943bf);}_0x42446c[_0xef82a8['body'][_0x1964('0x93')]]=_0xef82a8['body']['from'];return db['CmList'][_0x1964('0x5b')]({'where':{'id':_0xef82a8[_0x1964('0x73')][_0x1964('0x7f')]},'include':[{'model':db[_0x1964('0x77')],'as':_0x1964('0x97'),'where':_0x42446c,'limit':0x1,'order':[[_0x1964('0x7d'),'DESC']]}]});})[_0x1964('0x34')](handleEntityNotFound(_0x527b8e,null))[_0x1964('0x34')](function(_0x31ed7e){if(_0x31ed7e){_0xef82a8[_0x1964('0x98')]=_[_0x1964('0x99')](_0x31ed7e,[_0x1964('0x97')]);if(_0x31ed7e[_0x1964('0x97')]['length']){return _0x31ed7e[_0x1964('0x97')][0x0];}var _0x123940=_[_0x1964('0x19')](_0xef82a8[_0x1964('0x5d')],{'firstName':_0xef82a8[_0x1964('0x5d')][_0x1964('0x83')],'ListId':_0x31ed7e['id']});_0x123940[_0xef82a8[_0x1964('0x5d')][_0x1964('0x93')]]=_0xef82a8[_0x1964('0x5d')][_0x1964('0x83')];return db[_0x1964('0x77')][_0x1964('0x5c')](_0x123940,{'fields':_0x9b8633,'raw':!![]});}})[_0x1964('0x34')](handleEntityNotFound(_0x527b8e,null))[_0x1964('0x34')](function(_0x5db948){if(_0x5db948){_0xef82a8['contact']=_0x5db948;var _0x5c38f9={'ContactId':_0x5db948['id'],'phone':_0xef82a8['body']['from'],'SmsAccountId':_0x3f7939[_0x1964('0x59')]['id']};var _0x198355={'ContactId':_0x5db948['id'],'SmsAccountId':_0x3f7939['params']['id'],'closed':![]};return db[_0x1964('0x9a')][_0x1964('0x5b')]({'where':_0x198355})['then'](function(_0x3d658a){if(_0x3d658a){return[_0x3d658a,![]];}return db[_0x1964('0x9a')][_0x1964('0x5c')](_0x5c38f9)['then'](function(_0x258c72){return[_0x258c72,!![]];});});}})[_0x1964('0x9b')](function(_0x4344a7,_0x5005ec){_0xef82a8[_0x1964('0x9c')]=_0x4344a7[_0x1964('0x36')]({'plain':!![]});_0xef82a8[_0x1964('0x9c')]['created']=![];if(_0x5005ec){if(_0xef82a8['account'][_0x1964('0x9d')]){_0xef82a8[_0x1964('0x74')]['push']({'id':0x0,'priority':_0xef82a8[_0x1964('0x74')][_0x1964('0x4a')]+0x1,'app':_0x1964('0x9e'),'appdata':_0x1964('0x9f'),'interval':_0x1964('0xa0')});}_0xef82a8[_0x1964('0x9c')][_0x1964('0xa1')]=!![];}return db['SmsMessage'][_0x1964('0x5c')]({'phone':_0xef82a8['body'][_0x1964('0x83')],'messageId':_0xef82a8[_0x1964('0x5d')][_0x1964('0x86')],'body':_0xef82a8[_0x1964('0x5d')][_0x1964('0x5d')],'SmsAccountId':_0x3f7939[_0x1964('0x59')]['id'],'SmsInteractionId':_0x4344a7['id'],'direction':'in','ContactId':_0x4344a7['ContactId'],'AttachmentId':_0xef82a8[_0x1964('0x5d')][_0x1964('0xa2')]});})[_0x1964('0x34')](function(_0x5469f7){_0xef82a8['message']=_0x5469f7;if(!_0xef82a8[_0x1964('0x9c')][_0x1964('0xa3')])return;return db[_0x1964('0xa4')][_0x1964('0x5b')]({'attributes':['id','name'],'where':{'id':_0xef82a8[_0x1964('0x9c')][_0x1964('0xa3')]}});})[_0x1964('0x34')](function(_0x721e4){if(_0x721e4){_0xef82a8[_0x1964('0x74')][_0x1964('0xa5')]({'id':0x0,'priority':0x0,'app':_0x1964('0xa6'),'appdata':_0x721e4[_0x1964('0x3a')]+','+(_0xef82a8['account'][_0x1964('0xa7')]||0xa),'interval':_0x1964('0xa0')});}if(!_0xef82a8[_0x1964('0x9c')][_0x1964('0xa8')])return;return db[_0x1964('0xa9')][_0x1964('0x5b')]({'attributes':['id','name'],'where':{'id':_0xef82a8[_0x1964('0x9c')][_0x1964('0xa8')]}});})[_0x1964('0x34')](function(_0x128c26){if(_0x128c26){_0xef82a8['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x128c26[_0x1964('0x3a')]+','+(_0xef82a8['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x1964('0xa0')});}return respondWithRpcPromise(_0x1964('0xaa'),_0x1964('0xab'),_0xef82a8);})[_0x1964('0x34')](function(_0x50171f){if(_0x50171f){var _0x5d7f34=0xc8;var _0x42488a=_0x1964('0xac');logger[_0x1964('0x21')](_0x1964('0x25'),_0x42488a,_0x5d7f34,'entity\x20found');logger['debug'](_0x1964('0xad'),_0x42488a,_0x5d7f34,'entity\x20found',JSON['stringify'](_0x50171f));if(_0xef82a8[_0x1964('0x73')]['type']===_0x1964('0xae')){return _0x527b8e[_0x1964('0x2c')](_0x5d7f34)[_0x1964('0x32')](_0x1964('0xaf'),_0x1964('0xb0'))[_0x1964('0xb1')](_0x1964('0xb2'));}else{return _0x527b8e[_0x1964('0x2c')](_0x5d7f34)[_0x1964('0x2d')](_0x50171f);}}})['catch'](handleError(_0x527b8e,null));};exports[_0x1964('0xb3')]=function(_0x2811b0,_0x390f12){var _0x537619=_0x2811b0['params']['id'];var _0x1d4435=_0x2811b0[_0x1964('0x5d')];var _0x6a70b6=0xc8;var _0x379541=null;return db['sequelize'][_0x1964('0xb4')]({'isolationLevel':db['sequelize'][_0x1964('0xb5')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x127624){return db[_0x1964('0x3f')]['findOne']({'where':{'id':_0x537619},'transaction':_0x127624})['then'](function(_0x52b0be){if(_0x52b0be){return db['SmsApplication'][_0x1964('0x35')]({'where':{'SmsAccountId':_0x537619},'transaction':_0x127624})['then'](function(){var _0x54f175=_[_0x1964('0x3e')](_0x1d4435,function(_0x3c0b29){_0x3c0b29['SmsAccountId']=_0x537619;return _0x3c0b29;});return db[_0x1964('0xb6')][_0x1964('0xb7')](_0x54f175,{'transaction':_0x127624});});}else{_0x6a70b6=0x194;_0x379541=[];}});})[_0x1964('0x34')](function(){if(_0x6a70b6!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x537619},'order':_0x1964('0x76')})[_0x1964('0x34')](function(_0x3e958b){_0x379541=_0x3e958b;});}})[_0x1964('0x57')](function(_0x381a65){_0x6a70b6=0x1f4;logger[_0x1964('0x26')](_0x381a65[_0x1964('0x39')]);if(_0x381a65['name']){delete _0x381a65[_0x1964('0x3a')];}_0x379541=_0x381a65;})[_0x1964('0xb8')](function(){if(_0x379541===null){_0x390f12[_0x1964('0x2a')](_0x6a70b6);}else{if(_0x6a70b6===0x1f4){_0x390f12[_0x1964('0x2c')](_0x6a70b6)[_0x1964('0xb1')](_0x379541);}else{_0x390f12[_0x1964('0x2c')](_0x6a70b6)[_0x1964('0x2d')](_0x379541);}}});};exports['getApplications']=function(_0x192d14,_0x5c11f2,_0x3d257e){var _0x4a0238={};var _0x4b27c6={};var _0x469d3b;var _0x5c9f33;return db[_0x1964('0x3f')][_0x1964('0x68')]({'where':{'id':_0x192d14[_0x1964('0x59')]['id']}})['then'](handleEntityNotFound(_0x5c11f2,null))[_0x1964('0x34')](function(_0xbfd784){if(_0xbfd784){_0x469d3b=_0xbfd784;_0x4b27c6[_0x1964('0x44')]=_[_0x1964('0x5a')](db[_0x1964('0xb6')]['rawAttributes']);_0x4b27c6[_0x1964('0x45')]=_['keys'](_0x192d14[_0x1964('0x45')]);_0x4b27c6[_0x1964('0x46')]=_[_0x1964('0x47')](_0x4b27c6[_0x1964('0x44')],_0x4b27c6[_0x1964('0x45')]);_0x4a0238[_0x1964('0x48')]=_[_0x1964('0x47')](_0x4b27c6[_0x1964('0x44')],qs[_0x1964('0x49')](_0x192d14[_0x1964('0x45')]['fields']));_0x4a0238['attributes']=_0x4a0238[_0x1964('0x48')][_0x1964('0x4a')]?_0x4a0238[_0x1964('0x48')]:_0x4b27c6[_0x1964('0x44')];_0x4a0238[_0x1964('0x4c')]=qs[_0x1964('0x4d')](_0x192d14[_0x1964('0x45')][_0x1964('0x4d')]);_0x4a0238['where']=qs[_0x1964('0x46')](_[_0x1964('0x4e')](_0x192d14[_0x1964('0x45')],_0x4b27c6[_0x1964('0x46')]));if(_0x192d14[_0x1964('0x45')][_0x1964('0x4f')]){_0x4a0238[_0x1964('0x50')]=_[_0x1964('0x69')](_0x4a0238[_0x1964('0x50')],{'$or':_[_0x1964('0x3e')](_0x4a0238[_0x1964('0x48')],function(_0x16709e){var _0x398caa={};_0x398caa[_0x16709e]={'$like':'%'+_0x192d14[_0x1964('0x45')][_0x1964('0x4f')]+'%'};return _0x398caa;})});}_0x4a0238=_[_0x1964('0x69')]({},_0x4a0238,_0x192d14[_0x1964('0x52')]);return _0x469d3b[_0x1964('0xb9')](_0x4a0238);}})[_0x1964('0x34')](function(_0x520bd1){if(_0x520bd1){_0x5c9f33=_0x520bd1[_0x1964('0x4a')];if(!_0x192d14['query'][_0x1964('0x4b')](_0x1964('0xba'))){_0x4a0238[_0x1964('0x30')]=qs[_0x1964('0x30')](_0x192d14[_0x1964('0x45')][_0x1964('0x30')]);_0x4a0238[_0x1964('0x2e')]=qs['offset'](_0x192d14[_0x1964('0x45')][_0x1964('0x2e')]);}return _0x469d3b[_0x1964('0xb9')](_0x4a0238);}})[_0x1964('0x34')](function(_0x55ed57){if(_0x55ed57){return _0x55ed57?{'count':_0x5c9f33,'rows':_0x55ed57}:null;}})[_0x1964('0x34')](respondWithResult(_0x5c11f2,null))['catch'](handleError(_0x5c11f2,null));};exports['getInteractions']=function(_0x510850,_0x411a7d,_0x5cc4c0){var _0x5a76f5={'raw':![],'where':{}};var _0x151520={};var _0x10a18d={'count':0x0,'rows':[]};return db[_0x1964('0x3f')][_0x1964('0x68')]({'where':{'id':_0x510850[_0x1964('0x59')]['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x411a7d,null))[_0x1964('0x34')](function(_0x3d999f){if(_0x3d999f){_0x151520['model']=_[_0x1964('0x5a')](db[_0x1964('0x9a')][_0x1964('0x40')]);_0x151520[_0x1964('0x45')]=_[_0x1964('0x5a')](_0x510850[_0x1964('0x45')]);_0x151520[_0x1964('0x46')]=_[_0x1964('0x47')](_0x151520[_0x1964('0x44')],_0x151520[_0x1964('0x45')]);_0x5a76f5[_0x1964('0x48')]=_[_0x1964('0x47')](_0x151520[_0x1964('0x44')],qs['fields'](_0x510850[_0x1964('0x45')]['fields']));_0x5a76f5[_0x1964('0x48')]=_0x5a76f5[_0x1964('0x48')][_0x1964('0x4a')]?_0x5a76f5[_0x1964('0x48')]:_0x151520[_0x1964('0x44')];if(!_0x510850[_0x1964('0x45')][_0x1964('0x4b')](_0x1964('0xba'))){_0x5a76f5[_0x1964('0x30')]=qs['limit'](_0x510850[_0x1964('0x45')][_0x1964('0x30')]);_0x5a76f5[_0x1964('0x2e')]=qs['offset'](_0x510850[_0x1964('0x45')][_0x1964('0x2e')]);}_0x5a76f5['order']=qs[_0x1964('0x4d')](_0x510850[_0x1964('0x45')][_0x1964('0x4d')]);_0x5a76f5[_0x1964('0x50')]=qs['filters'](_[_0x1964('0x4e')](_0x510850[_0x1964('0x45')],_0x151520[_0x1964('0x46')]));_0x5a76f5['where'][_0x1964('0x65')]=_0x3d999f['id'];if(_0x510850[_0x1964('0x45')][_0x1964('0x4f')]){_0x5a76f5[_0x1964('0x50')]=_['merge'](_0x5a76f5['where'],{'$or':_['map'](_0x5a76f5[_0x1964('0x48')],function(_0x15e436){var _0x5afcbe={};_0x5afcbe[_0x15e436]={'$like':'%'+_0x510850['query']['filter']+'%'};return _0x5afcbe;})});}_0x5a76f5=_[_0x1964('0x69')]({},_0x5a76f5,_0x510850[_0x1964('0x52')]);return db[_0x1964('0x9a')][_0x1964('0x31')]({'where':_0x5a76f5[_0x1964('0x50')]})[_0x1964('0x34')](function(_0x217286){_0x10a18d['count']=_0x217286;if(_0x510850['query'][_0x1964('0x53')]){_0x5a76f5[_0x1964('0x54')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1964('0xa4')],'as':_0x1964('0xbb'),'attributes':[_0x1964('0x3a'),'fullname',_0x1964('0xbc')],'required':![]},{'model':db[_0x1964('0xbd')],'as':_0x1964('0xbe'),'attributes':['id',_0x1964('0x3a'),'color'],'where':_0x510850[_0x1964('0x45')][_0x1964('0xbf')]?{'id':_0x510850[_0x1964('0x45')][_0x1964('0xbf')]}:undefined,'required':_0x510850[_0x1964('0x45')][_0x1964('0xbf')]?!![]:![]}];}return db[_0x1964('0x9a')][_0x1964('0x55')](_0x5a76f5);})[_0x1964('0x34')](function(_0x2f1dfa){_0x10a18d[_0x1964('0x56')]=_0x2f1dfa;return _0x10a18d;});}})[_0x1964('0x34')](respondWithFilteredResult(_0x411a7d,_0x5a76f5))[_0x1964('0x57')](handleError(_0x411a7d,null));};exports[_0x1964('0xb1')]=function(_0x1c7ab7,_0x544b7a,_0x24f514){var _0x550ed0,_0x5ec3f8,_0x5955a4;if(_[_0x1964('0x91')](_0x1c7ab7['body']['body'])||_0x1c7ab7[_0x1964('0x5d')][_0x1964('0x5d')]===''){throw new db['Sequelize'][(_0x1964('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1c7ab7[_0x1964('0x5d')]['to'])){throw new db[(_0x1964('0x78'))]['ValidationError'](_0x1964('0xc0'));}_0x550ed0=_0x1c7ab7['body']['to'];return db['SmsAccount'][_0x1964('0x5b')]({'where':{'id':_0x1c7ab7['params']['id']},'include':[{'model':db[_0x1964('0xc1')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x550ed0},'limit':0x1,'order':[[_0x1964('0x7d'),'DESC']]}]}]})[_0x1964('0x34')](handleEntityNotFound(_0x544b7a,null))[_0x1964('0x34')](function(_0x2edda5){if(_0x2edda5&&_0x2edda5[_0x1964('0xc2')]){_0x5ec3f8=_0x2edda5['get']({'plain':!![]});if(_0x5ec3f8[_0x1964('0xc2')]&&_0x5ec3f8[_0x1964('0xc2')][_0x1964('0x97')][_0x1964('0x4a')]){return _0x5ec3f8[_0x1964('0xc2')][_0x1964('0x97')][0x0];}return db[_0x1964('0x77')][_0x1964('0x5c')](_[_0x1964('0x19')](_0x1c7ab7[_0x1964('0x5d')],{'firstName':_0x550ed0,'mobile':_0x550ed0,'phone':_0x550ed0,'ListId':_0x5ec3f8[_0x1964('0x7f')]}));}})[_0x1964('0x34')](handleEntityNotFound(_0x544b7a,null))[_0x1964('0x34')](function(_0x47e2e9){if(_0x47e2e9){_0x5955a4=_0x47e2e9;return db[_0x1964('0x9a')][_0x1964('0x5b')]({'where':{'ContactId':_0x5955a4['id'],'closed':![],'SmsAccountId':_0x5ec3f8['id']}})[_0x1964('0x34')](function(_0xe65c9){if(_0xe65c9){return[_0xe65c9,![]];}return db[_0x1964('0x9a')][_0x1964('0x5c')]({'UserId':_0x1c7ab7[_0x1964('0x5e')]['id'],'ContactId':_0x5955a4['id'],'SmsAccountId':_0x5ec3f8['id'],'phone':_0x550ed0,'firstMsgDirection':'out','Messages':[_[_0x1964('0x69')](_0x1c7ab7[_0x1964('0x5d')],{'read':![],'body':_0x1c7ab7['body'][_0x1964('0x5d')],'phone':_0x550ed0,'SmsAccountId':_0x5ec3f8['id'],'UserId':_0x1c7ab7[_0x1964('0x5e')]['id'],'ContactId':_0x5955a4['id']})]},{'include':[{'model':db[_0x1964('0xc3')],'as':'Messages'}]})[_0x1964('0x34')](function(_0x4f87f2){return[_0x4f87f2,!![]];});});}})['spread'](function(_0x32bd7a,_0x4ed1de){if(_0x4ed1de){return _0x32bd7a;}return db[_0x1964('0xc3')]['create'](_[_0x1964('0x69')](_0x1c7ab7[_0x1964('0x5d')],{'read':![],'body':_0x1c7ab7[_0x1964('0x5d')][_0x1964('0x5d')],'phone':_0x550ed0,'SmsAccountId':_0x5ec3f8['id'],'SmsInteractionId':_0x32bd7a['id'],'UserId':_0x1c7ab7['user']['id'],'ContactId':_0x5955a4['id']}))[_0x1964('0x34')](function(_0x1edadf){_0x32bd7a[_0x1964('0xc4')][_0x1964('0xc5')]=[];_0x32bd7a[_0x1964('0xc4')]['Messages'][_0x1964('0xc6')](_0x1edadf[_0x1964('0xc4')]);return _0x32bd7a;});})[_0x1964('0x34')](respondWithResult(_0x544b7a,null))[_0x1964('0x57')](handleError(_0x544b7a,null));};exports[_0x1964('0x2c')]=function(_0x335281,_0x46767d,_0x2f9ee5){if(_0x335281[_0x1964('0x5d')]['id']){delete _0x335281[_0x1964('0x5d')]['id'];}var _0x21da8a,_0x5dc840,_0x293d85;return db[_0x1964('0x3f')][_0x1964('0x5b')]({'where':{'id':_0x335281[_0x1964('0x59')]['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x46767d,null))[_0x1964('0x34')](function(_0x2f1372){if(_0x2f1372){_0x293d85=_0x2f1372;logger[_0x1964('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1964('0x2c'),'received\x20delivery\x20report\x20from',_0x2f1372[_0x1964('0x42')],util[_0x1964('0xc7')](_0x335281[_0x1964('0x5d')],{'showHidden':![],'depth':null}));switch(_0x2f1372[_0x1964('0x42')]){case'skebby':if(_0x335281['body'][_0x1964('0xc8')]&&_0x335281[_0x1964('0x5d')]['status']){_0x5dc840=_0x335281[_0x1964('0x5d')][_0x1964('0x2c')];return db['SmsMessage'][_0x1964('0x5b')]({'where':{'messageId':_0x335281['body'][_0x1964('0xc8')]}});}break;case _0x1964('0xc9'):if(_0x335281[_0x1964('0x5d')][_0x1964('0xca')]&&_0x335281[_0x1964('0x5d')][_0x1964('0xcb')]){_0x5dc840=_0x335281[_0x1964('0x5d')][_0x1964('0xcb')];return db['SmsMessage']['find']({'where':{'messageId':_0x335281[_0x1964('0x5d')]['requestid']}});}break;case'clicksend':if(_0x335281[_0x1964('0x5d')]['message_id']&&_0x335281[_0x1964('0x5d')]['status_code']){_0x5dc840=_0x335281[_0x1964('0x5d')][_0x1964('0xcc')];return db[_0x1964('0xc3')][_0x1964('0x5b')]({'where':{'messageId':_0x335281[_0x1964('0x5d')][_0x1964('0x87')]}});}break;case'infobip':var _0x164400=_0x335281[_0x1964('0x5d')][_0x1964('0x89')][0x0];if(_0x164400[_0x1964('0x86')]&&_0x164400[_0x1964('0x2c')]['groupName']===_0x1964('0xcd')){_0x5dc840=_0x164400[_0x1964('0x2c')][_0x1964('0xce')];return db[_0x1964('0xc3')]['find']({'where':{'messageId':_0x164400[_0x1964('0x86')]}});}break;case'clickatell':if(_0x335281[_0x1964('0x5d')][_0x1964('0x86')]&&_0x335281[_0x1964('0x5d')][_0x1964('0x2c')]){_0x5dc840=_0x335281[_0x1964('0x5d')]['status'];return db['SmsMessage'][_0x1964('0x5b')]({'where':{'messageId':_0x335281[_0x1964('0x5d')]['messageId']}});}break;case _0x1964('0x8d'):if(_0x335281['body'][0x0]['message']['id']){_0x5dc840=_0x335281[_0x1964('0x5d')][0x0][_0x1964('0x42')];return db[_0x1964('0xc3')][_0x1964('0x5b')]({'where':{'messageId':_0x335281[_0x1964('0x5d')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x335281[_0x1964('0x5d')][_0x1964('0xcf')]&&_0x335281[_0x1964('0x5d')][_0x1964('0x2c')]){_0x5dc840=_0x335281[_0x1964('0x5d')][_0x1964('0x2c')];return db['SmsMessage'][_0x1964('0x5b')]({'where':{'messageId':_0x335281['body'][_0x1964('0xcf')]}});}break;}}})['then'](handleEntityNotFound(_0x46767d,null))[_0x1964('0x34')](function(_0x5735d6){if(_0x5735d6){_0x21da8a=_0x5735d6;switch(_0x293d85[_0x1964('0x42')]){case _0x1964('0x82'):if(_0x5dc840==='DELIVERED'){return _0x21da8a[_0x1964('0x62')]({'read':!![]});}else{logger[_0x1964('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x1964('0xc7')](_0x335281['body'],{'showHidden':![],'depth':null}));}break;case _0x1964('0xc9'):if(_0x5dc840==='1'){return _0x21da8a[_0x1964('0x62')]({'read':!![]});}else{logger[_0x1964('0x26')](_0x1964('0x25'),_0x1964('0x2c'),_0x1964('0x82'),util[_0x1964('0xc7')](_0x335281[_0x1964('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1964('0xd0'):if(!_0x335281['body']['error_code']&&_0x5dc840>=0xc8&&_0x5dc840<=0xce){return _0x21da8a[_0x1964('0x62')]({'read':!![]});}else{logger[_0x1964('0x26')](_0x1964('0x25'),_0x1964('0x2c'),'clicksend',util[_0x1964('0xc7')](_0x335281[_0x1964('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1964('0x88'):var _0x37994d=_0x335281['body'][_0x1964('0x89')][0x0];if(_0x37994d['status'][_0x1964('0xce')]===_0x1964('0xcd')){return _0x21da8a[_0x1964('0x62')]({'read':!![]});}else{logger[_0x1964('0x26')](_0x1964('0x25'),_0x1964('0x2c'),_0x1964('0x88'),util[_0x1964('0xc7')](_0x335281['body'],{'showHidden':![],'depth':null}));}break;case _0x1964('0xd1'):if(_0x5dc840=='DELIVERED_TO_GATEWAY'||_0x5dc840==_0x1964('0xd2')){return _0x21da8a[_0x1964('0x62')]({'read':!![]});}else{logger['error'](_0x1964('0x25'),_0x1964('0x2c'),_0x1964('0xd1'),util['inspect'](_0x335281['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5dc840==_0x1964('0xd3')){return _0x21da8a[_0x1964('0x62')]({'read':!![]});}else{logger[_0x1964('0x26')](_0x1964('0x25'),_0x1964('0x2c'),_0x1964('0x8d'),util[_0x1964('0xc7')](_0x335281[_0x1964('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1964('0x8e'):if(_0x5dc840==='DELIVRD'||_0x5dc840==='ACCEPTD'){return _0x21da8a['update']({'read':!![]});}else{logger[_0x1964('0x26')](_0x1964('0x25'),_0x1964('0x2c'),'intelepeer',util[_0x1964('0xc7')](_0x335281[_0x1964('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x21da8a;}})['then'](respondWithResult(_0x46767d,null))[_0x1964('0x57')](handleError(_0x46767d,null));};exports[_0x1964('0xd4')]=function(_0x506e9f,_0x35e312,_0x4d8678){var _0xffbc,_0x109adf,_0x2171a0;return db[_0x1964('0x3f')][_0x1964('0x5b')]({'where':{'id':_0x506e9f['params']['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x35e312,null))[_0x1964('0x34')](function(_0x3f00ae){if(_0x3f00ae){_0x2171a0=_0x3f00ae;logger[_0x1964('0x24')](_0x1964('0x25'),'status',_0x1964('0xd5'),_0x3f00ae[_0x1964('0x42')],util[_0x1964('0xc7')](_0x506e9f[_0x1964('0x45')],{'showHidden':![],'depth':null}));switch(_0x3f00ae[_0x1964('0x42')]){case _0x1964('0xd6'):if(_0x506e9f['query'][_0x1964('0xd7')]&&_0x506e9f['query'][_0x1964('0xd8')]){_0x109adf=_0x506e9f[_0x1964('0x45')][_0x1964('0xd8')];return db[_0x1964('0xc3')][_0x1964('0x5b')]({'where':{'messageId':_0x506e9f['query'][_0x1964('0xd7')]}});}break;}}})[_0x1964('0x34')](handleEntityNotFound(_0x35e312,null))[_0x1964('0x34')](function(_0x21793d){if(_0x21793d){_0xffbc=_0x21793d;switch(_0x2171a0['type']){case _0x1964('0xd6'):if(_0x109adf==='2'||_0x109adf==='6'){return _0xffbc[_0x1964('0x62')]({'read':!![]});}else{logger[_0x1964('0x26')](_0x1964('0x25'),'status',_0x1964('0xd6'),util[_0x1964('0xc7')](_0x506e9f[_0x1964('0x45')],{'showHidden':![],'depth':null}));};break;}return _0xffbc;}})[_0x1964('0x34')](respondWithResult(_0x35e312,null))['catch'](handleError(_0x35e312,null));};exports[_0x1964('0xd9')]=function(_0x3dea99,_0x207c65,_0x42a7e0){return db[_0x1964('0x3f')][_0x1964('0x5b')]({'where':{'id':_0x3dea99['params']['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x207c65,null))[_0x1964('0x34')](function(_0x2abadb){if(_0x2abadb){return _0x2abadb['addAgents'](_0x3dea99['body'][_0x1964('0x6b')],_[_0x1964('0x99')](_0x3dea99[_0x1964('0x5d')],[_0x1964('0x6b'),'id'])||{})[_0x1964('0x9b')](function(_0x3d236f){for(var _0x3b5bf3=0x0;_0x3b5bf3<_0x3dea99[_0x1964('0x5d')]['ids'][_0x1964('0x4a')];_0x3b5bf3+=0x1){socket[_0x1964('0xda')](_0x1964('0xdb'),{'UserId':Number(_0x3dea99[_0x1964('0x5d')][_0x1964('0x6b')][_0x3b5bf3]),'SmsAccountId':Number(_0x3dea99[_0x1964('0x59')]['id'])});}return _0x3d236f;});}})[_0x1964('0x34')](respondWithResult(_0x207c65,null))[_0x1964('0x57')](handleError(_0x207c65,null));};exports[_0x1964('0xdc')]=function(_0x4fe3b4,_0x41d5d1,_0x2d4069){return db['SmsAccount'][_0x1964('0x5b')]({'where':{'id':_0x4fe3b4['params']['id']}})['then'](handleEntityNotFound(_0x41d5d1,null))['then'](function(_0x2374e5){if(_0x2374e5){return _0x2374e5[_0x1964('0xdc')](_0x4fe3b4[_0x1964('0x45')][_0x1964('0x6b')])[_0x1964('0x34')](function(){if(_['isArray'](_0x4fe3b4[_0x1964('0x45')][_0x1964('0x6b')])){for(var _0x436ccd=0x0;_0x436ccd<_0x4fe3b4[_0x1964('0x45')]['ids']['length'];_0x436ccd+=0x1){socket[_0x1964('0xda')](_0x1964('0xdd'),{'UserId':Number(_0x4fe3b4[_0x1964('0x45')][_0x1964('0x6b')][_0x436ccd]),'SmsAccountId':Number(_0x4fe3b4[_0x1964('0x59')]['id'])});}}else{socket[_0x1964('0xda')](_0x1964('0xdd'),{'UserId':Number(_0x4fe3b4[_0x1964('0x45')][_0x1964('0x6b')]),'SmsAccountId':Number(_0x4fe3b4[_0x1964('0x59')]['id'])});}});}})[_0x1964('0x34')](respondWithStatusCode(_0x41d5d1,null))[_0x1964('0x57')](handleError(_0x41d5d1,null));};exports[_0x1964('0xde')]=function(_0xc4f75f,_0x5bcb6b,_0x50e137){var _0x100ea0={};var _0x89d164={};var _0x36a151;var _0x113cad;return db[_0x1964('0x3f')][_0x1964('0x68')]({'where':{'id':_0xc4f75f[_0x1964('0x59')]['id']}})[_0x1964('0x34')](handleEntityNotFound(_0x5bcb6b,null))[_0x1964('0x34')](function(_0x3088d7){if(_0x3088d7){_0x36a151=_0x3088d7;_0x89d164[_0x1964('0x44')]=_[_0x1964('0x5a')](db[_0x1964('0xa4')][_0x1964('0x40')]);_0x89d164[_0x1964('0x45')]=_[_0x1964('0x5a')](_0xc4f75f[_0x1964('0x45')]);_0x89d164[_0x1964('0x46')]=_[_0x1964('0x47')](_0x89d164[_0x1964('0x44')],_0x89d164[_0x1964('0x45')]);_0x100ea0['attributes']=_[_0x1964('0x47')](_0x89d164[_0x1964('0x44')],qs[_0x1964('0x49')](_0xc4f75f[_0x1964('0x45')][_0x1964('0x49')]));_0x100ea0['attributes']=_0x100ea0[_0x1964('0x48')][_0x1964('0x4a')]?_0x100ea0[_0x1964('0x48')]:_0x89d164[_0x1964('0x44')];_0x100ea0[_0x1964('0x4c')]=qs['sort'](_0xc4f75f[_0x1964('0x45')][_0x1964('0x4d')]);_0x100ea0[_0x1964('0x50')]=qs[_0x1964('0x46')](_[_0x1964('0x4e')](_0xc4f75f[_0x1964('0x45')],_0x89d164[_0x1964('0x46')]));if(_0xc4f75f['query'][_0x1964('0x4f')]){_0x100ea0[_0x1964('0x50')]=_['merge'](_0x100ea0[_0x1964('0x50')],{'$or':_['map'](_0x100ea0['attributes'],function(_0x1251e6){var _0x59d297={};_0x59d297[_0x1251e6]={'$like':'%'+_0xc4f75f[_0x1964('0x45')][_0x1964('0x4f')]+'%'};return _0x59d297;})});}_0x100ea0=_[_0x1964('0x69')]({},_0x100ea0,_0xc4f75f[_0x1964('0x52')]);return _0x36a151[_0x1964('0xde')](_0x100ea0);}})[_0x1964('0x34')](function(_0x3421d0){if(_0x3421d0){_0x113cad=_0x3421d0[_0x1964('0x4a')];if(!_0xc4f75f[_0x1964('0x45')][_0x1964('0x4b')](_0x1964('0xba'))){_0x100ea0['limit']=qs[_0x1964('0x30')](_0xc4f75f[_0x1964('0x45')][_0x1964('0x30')]);_0x100ea0[_0x1964('0x2e')]=qs[_0x1964('0x2e')](_0xc4f75f[_0x1964('0x45')][_0x1964('0x2e')]);}return _0x36a151[_0x1964('0xde')](_0x100ea0);}})[_0x1964('0x34')](function(_0x450873){if(_0x450873){return _0x450873?{'count':_0x113cad,'rows':_0x450873}:null;}})[_0x1964('0x34')](respondWithResult(_0x5bcb6b,null))[_0x1964('0x57')](handleError(_0x5bcb6b,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1ff12bd..803a19e 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 _0xd8ff=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xd8ff,0x1d6));var _0xfd8f=function(_0x4f217f,_0x313163){_0x4f217f=_0x4f217f-0x0;var _0x3b583a=_0xd8ff[_0x4f217f];return _0x3b583a;};'use strict';var EventEmitter=require(_0xfd8f('0x0'));var SmsAccount=require(_0xfd8f('0x1'))['db'][_0xfd8f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfd8f('0x3')](0x0);var events={'afterCreate':_0xfd8f('0x4'),'afterUpdate':_0xfd8f('0x5'),'afterDestroy':_0xfd8f('0x6')};function emitEvent(_0xc76489){return function(_0x1cc229,_0x42fae4,_0x4e0697){SmsAccountEvents[_0xfd8f('0x7')](_0xc76489+':'+_0x1cc229['id'],_0x1cc229);SmsAccountEvents['emit'](_0xc76489,_0x1cc229);_0x4e0697(null);};}for(var e in events){if(events[_0xfd8f('0x8')](e)){var event=events[e];SmsAccount[_0xfd8f('0x9')](e,emitEvent(event));}}module[_0xfd8f('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x277b=['hasOwnProperty','../../mysqldb','SmsAccount','setMaxListeners','update','emit'];(function(_0x2f8640,_0x281449){var _0x403aaf=function(_0x502488){while(--_0x502488){_0x2f8640['push'](_0x2f8640['shift']());}};_0x403aaf(++_0x281449);}(_0x277b,0x1db));var _0xb277=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x277b[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xb277('0x0'))['db'][_0xb277('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb277('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb277('0x3'),'afterDestroy':'remove'};function emitEvent(_0xae0f7c){return function(_0x1b8f70,_0x278c7e,_0x360c2a){SmsAccountEvents['emit'](_0xae0f7c+':'+_0x1b8f70['id'],_0x1b8f70);SmsAccountEvents[_0xb277('0x4')](_0xae0f7c,_0x1b8f70);_0x360c2a(null);};}for(var e in events){if(events[_0xb277('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f799773..fe55cac 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 _0x19a8=['define','SmsAccount','api','moment','bluebird','request-promise','../../config/environment','./smsAccount.attributes','exports'];(function(_0x22320d,_0x41a0d9){var _0x1c1939=function(_0x8b34f){while(--_0x8b34f){_0x22320d['push'](_0x22320d['shift']());}};_0x1c1939(++_0x41a0d9);}(_0x19a8,0x185));var _0x819a=function(_0x4f8e07,_0x114412){_0x4f8e07=_0x4f8e07-0x0;var _0x326120=_0x19a8[_0x4f8e07];return _0x326120;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x819a('0x0'));var moment=require(_0x819a('0x1'));var BPromise=require(_0x819a('0x2'));var rp=require(_0x819a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x819a('0x4'));var attributes=require(_0x819a('0x5'));module[_0x819a('0x6')]=function(_0x546932,_0x4674cb){return _0x546932[_0x819a('0x7')](_0x819a('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x396f=['exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0xb4bf3c,_0x406c3b){var _0x8f6ade=function(_0x56be63){while(--_0x56be63){_0xb4bf3c['push'](_0xb4bf3c['shift']());}};_0x8f6ade(++_0x406c3b);}(_0x396f,0x160));var _0xf396=function(_0x851e50,_0x1b5fbb){_0x851e50=_0x851e50-0x0;var _0x29d474=_0x396f[_0x851e50];return _0x29d474;};'use strict';var _=require(_0xf396('0x0'));var util=require('util');var logger=require(_0xf396('0x1'))(_0xf396('0x2'));var moment=require(_0xf396('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf396('0x4'));var rimraf=require(_0xf396('0x5'));var config=require(_0xf396('0x6'));var attributes=require(_0xf396('0x7'));module[_0xf396('0x8')]=function(_0x17df84,_0x411dad){return _0x17df84[_0xf396('0x9')](_0xf396('0xa'),attributes,{'tableName':_0xf396('0xb'),'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 17a2c4e..ef8fff9 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 _0x88a8=['SmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount'];(function(_0x42e851,_0x267a09){var _0x4c0bb2=function(_0x8bacf9){while(--_0x8bacf9){_0x42e851['push'](_0x42e851['shift']());}};_0x4c0bb2(++_0x267a09);}(_0x88a8,0x15d));var _0x888a=function(_0x3b8aac,_0x4dea4f){_0x3b8aac=_0x3b8aac-0x0;var _0x25d256=_0x88a8[_0x3b8aac];return _0x25d256;};'use strict';var _=require(_0x888a('0x0'));var util=require(_0x888a('0x1'));var moment=require('moment');var BPromise=require(_0x888a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x888a('0x3'))(_0x888a('0x4'));var config=require('../../config/environment');var jayson=require(_0x888a('0x5'));var client=jayson[_0x888a('0x6')][_0x888a('0x7')]({'port':0x232a});config[_0x888a('0x8')]=_[_0x888a('0x9')](config[_0x888a('0x8')],{'host':_0x888a('0xa'),'port':0x18eb});var socket=require(_0x888a('0xb'))(new Redis(config[_0x888a('0x8')]));require('./smsAccount.socket')[_0x888a('0xc')](socket);function respondWithRpcPromise(_0x214c97,_0x1ac026,_0x61ef8b){return new BPromise(function(_0x43c11c,_0xc3f540){return client['request'](_0x214c97,_0x61ef8b)['then'](function(_0x53a853){logger[_0x888a('0xd')]('SmsAccount,\x20%s,\x20%s',_0x1ac026,_0x888a('0xe'));logger[_0x888a('0xf')](_0x888a('0x10'),_0x1ac026,_0x888a('0xe'),JSON[_0x888a('0x11')](_0x53a853));if(_0x53a853[_0x888a('0x12')]){if(_0x53a853[_0x888a('0x12')][_0x888a('0x13')]===0x1f4){logger[_0x888a('0x12')](_0x888a('0x14'),_0x1ac026,_0x53a853[_0x888a('0x12')][_0x888a('0x15')]);return _0xc3f540(_0x53a853[_0x888a('0x12')]['message']);}logger[_0x888a('0x12')](_0x888a('0x14'),_0x1ac026,_0x53a853['error'][_0x888a('0x15')]);return _0x43c11c(_0x53a853[_0x888a('0x12')]['message']);}else{logger['info'](_0x888a('0x14'),_0x1ac026,_0x888a('0xe'));_0x43c11c(_0x53a853[_0x888a('0x16')][_0x888a('0x15')]);}})[_0x888a('0x17')](function(_0x414e13){logger[_0x888a('0x12')](_0x888a('0x14'),_0x1ac026,_0x414e13);_0xc3f540(_0x414e13);});});}exports[_0x888a('0x18')]=function(_0x9e6682){var _0x2a3527=this;return new Promise(function(_0x3e790d,_0x337e08){return db[_0x888a('0x19')][_0x888a('0x1a')]({'raw':_0x9e6682[_0x888a('0x1b')]?_0x9e6682[_0x888a('0x1b')][_0x888a('0x1c')]===undefined?!![]:![]:!![],'where':_0x9e6682[_0x888a('0x1b')]?_0x9e6682[_0x888a('0x1b')][_0x888a('0x1d')]||null:null,'attributes':_0x9e6682['options']?_0x9e6682[_0x888a('0x1b')][_0x888a('0x1e')]||null:null,'include':_0x9e6682[_0x888a('0x1b')]?_0x9e6682[_0x888a('0x1b')][_0x888a('0x1f')]?_['map'](_0x9e6682['options'][_0x888a('0x1f')],function(_0x5d74d2){return{'model':db[_0x5d74d2['model']],'as':_0x5d74d2['as'],'attributes':_0x5d74d2[_0x888a('0x1e')],'include':_0x5d74d2[_0x888a('0x1f')]?_[_0x888a('0x20')](_0x5d74d2['include'],function(_0x5606ec){return{'model':db[_0x5606ec[_0x888a('0x21')]],'as':_0x5606ec['as'],'attributes':_0x5606ec['attributes'],'include':_0x5606ec[_0x888a('0x1f')]?_[_0x888a('0x20')](_0x5606ec[_0x888a('0x1f')],function(_0x53c9e6){return{'model':db[_0x53c9e6[_0x888a('0x21')]],'as':_0x53c9e6['as'],'attributes':_0x53c9e6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x261c43){logger[_0x888a('0xd')]('ShowSmsAccount',_0x9e6682);logger['debug'](_0x888a('0x18'),_0x9e6682,JSON[_0x888a('0x11')](_0x261c43));_0x3e790d(_0x261c43);})[_0x888a('0x17')](function(_0x3cefd8){logger['error']('ShowSmsAccount',_0x3cefd8['message'],_0x9e6682);_0x337e08(_0x2a3527['error'](0x1f4,_0x3cefd8[_0x888a('0x15')]));});});}; \ No newline at end of file +var _0x4e27=['ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0x4e27,0x113));var _0x74e2=function(_0x3c89db,_0x37f3a7){_0x3c89db=_0x3c89db-0x0;var _0x5a8972=_0x4e27[_0x3c89db];return _0x5a8972;};'use strict';var _=require(_0x74e2('0x0'));var util=require('util');var moment=require(_0x74e2('0x1'));var BPromise=require(_0x74e2('0x2'));var rs=require(_0x74e2('0x3'));var fs=require('fs');var Redis=require(_0x74e2('0x4'));var db=require(_0x74e2('0x5'))['db'];var utils=require(_0x74e2('0x6'));var logger=require(_0x74e2('0x7'))('rpc');var config=require(_0x74e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x74e2('0x9')][_0x74e2('0xa')]({'port':0x232a});config['redis']=_[_0x74e2('0xb')](config[_0x74e2('0xc')],{'host':_0x74e2('0xd'),'port':0x18eb});var socket=require(_0x74e2('0xe'))(new Redis(config[_0x74e2('0xc')]));require(_0x74e2('0xf'))[_0x74e2('0x10')](socket);function respondWithRpcPromise(_0x1ff87a,_0x1e66fb,_0x1c85c2){return new BPromise(function(_0x17576c,_0x53e414){return client['request'](_0x1ff87a,_0x1c85c2)[_0x74e2('0x11')](function(_0x1da39f){logger[_0x74e2('0x12')](_0x74e2('0x13'),_0x1e66fb,_0x74e2('0x14'));logger[_0x74e2('0x15')](_0x74e2('0x16'),_0x1e66fb,_0x74e2('0x14'),JSON[_0x74e2('0x17')](_0x1da39f));if(_0x1da39f[_0x74e2('0x18')]){if(_0x1da39f[_0x74e2('0x18')][_0x74e2('0x19')]===0x1f4){logger['error'](_0x74e2('0x13'),_0x1e66fb,_0x1da39f[_0x74e2('0x18')]['message']);return _0x53e414(_0x1da39f[_0x74e2('0x18')]['message']);}logger[_0x74e2('0x18')](_0x74e2('0x13'),_0x1e66fb,_0x1da39f['error'][_0x74e2('0x1a')]);return _0x17576c(_0x1da39f[_0x74e2('0x18')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1e66fb,_0x74e2('0x14'));_0x17576c(_0x1da39f[_0x74e2('0x1b')]['message']);}})[_0x74e2('0x1c')](function(_0x2f0b36){logger[_0x74e2('0x18')]('SmsAccount,\x20%s,\x20%s',_0x1e66fb,_0x2f0b36);_0x53e414(_0x2f0b36);});});}exports[_0x74e2('0x1d')]=function(_0x412c69){var _0x43fec9=this;return new Promise(function(_0x4af469,_0xc7563){return db[_0x74e2('0x1e')]['find']({'raw':_0x412c69[_0x74e2('0x1f')]?_0x412c69['options'][_0x74e2('0x20')]===undefined?!![]:![]:!![],'where':_0x412c69['options']?_0x412c69[_0x74e2('0x1f')][_0x74e2('0x21')]||null:null,'attributes':_0x412c69[_0x74e2('0x1f')]?_0x412c69[_0x74e2('0x1f')][_0x74e2('0x22')]||null:null,'include':_0x412c69['options']?_0x412c69[_0x74e2('0x1f')]['include']?_[_0x74e2('0x23')](_0x412c69[_0x74e2('0x1f')][_0x74e2('0x24')],function(_0x4634d1){return{'model':db[_0x4634d1[_0x74e2('0x25')]],'as':_0x4634d1['as'],'attributes':_0x4634d1[_0x74e2('0x22')],'include':_0x4634d1[_0x74e2('0x24')]?_[_0x74e2('0x23')](_0x4634d1[_0x74e2('0x24')],function(_0x458eb4){return{'model':db[_0x458eb4['model']],'as':_0x458eb4['as'],'attributes':_0x458eb4['attributes'],'include':_0x458eb4[_0x74e2('0x24')]?_['map'](_0x458eb4[_0x74e2('0x24')],function(_0x1088b2){return{'model':db[_0x1088b2['model']],'as':_0x1088b2['as'],'attributes':_0x1088b2[_0x74e2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x74e2('0x11')](function(_0x20302a){logger[_0x74e2('0x12')](_0x74e2('0x1d'),_0x412c69);logger[_0x74e2('0x15')](_0x74e2('0x1d'),_0x412c69,JSON[_0x74e2('0x17')](_0x20302a));_0x4af469(_0x20302a);})['catch'](function(_0x7d5233){logger[_0x74e2('0x18')](_0x74e2('0x1d'),_0x7d5233[_0x74e2('0x1a')],_0x412c69);_0xc7563(_0x43fec9[_0x74e2('0x18')](0x1f4,_0x7d5233[_0x74e2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index d18fdb9..9bb233c 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 bf61ed2..3f211b5 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x337c03,_0x31131f){var _0x3fa1b1=function(_0x31e696){while(--_0x31e696){_0x337c03['push'](_0x337c03['shift']());}};_0x3fa1b1(++_0x31131f);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x4e79a6,_0x4b378a){var _0x434cd2=function(_0xf53436){while(--_0xf53436){_0x4e79a6['push'](_0x4e79a6['shift']());}};_0x434cd2(++_0x4b378a);}(_0xe14b,0x93));var _0xbe14=function(_0x36a879,_0x5049fb){_0x36a879=_0x36a879-0x0;var _0x25221f=_0xe14b[_0x36a879];return _0x25221f;};'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['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 44964dd..3861df1 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 _0x4059=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x19e404,_0x2e6973){var _0x17728f=function(_0x54323f){while(--_0x54323f){_0x19e404['push'](_0x19e404['shift']());}};_0x17728f(++_0x2e6973);}(_0x4059,0x126));var _0x9405=function(_0x3a401c,_0x4ff0d7){_0x3a401c=_0x3a401c-0x0;var _0x28bb3d=_0x4059[_0x3a401c];return _0x28bb3d;};'use strict';var Sequelize=require(_0x9405('0x0'));module[_0x9405('0x1')]={'priority':{'type':Sequelize[_0x9405('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9405('0x3')],'allowNull':![],'defaultValue':_0x9405('0x4')},'appdata':{'type':Sequelize[_0x9405('0x5')]()},'description':{'type':Sequelize[_0x9405('0x3')]},'interval':{'type':Sequelize[_0x9405('0x3')],'defaultValue':_0x9405('0x6')}}; \ No newline at end of file +var _0x4826=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5887ec,_0x504c12){var _0x23b637=function(_0x3f720f){while(--_0x3f720f){_0x5887ec['push'](_0x5887ec['shift']());}};_0x23b637(++_0x504c12);}(_0x4826,0x1bf));var _0x6482=function(_0x2e4e99,_0x2e55ab){_0x2e4e99=_0x2e4e99-0x0;var _0x47b515=_0x4826[_0x2e4e99];return _0x47b515;};'use strict';var Sequelize=require(_0x6482('0x0'));module[_0x6482('0x1')]={'priority':{'type':Sequelize[_0x6482('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6482('0x3')],'allowNull':![],'defaultValue':_0x6482('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6482('0x3')],'defaultValue':_0x6482('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2b027ca..d44019c 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 _0xa2b7=['path','ejs','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SmsApplication','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa2b7,0x8b));var _0x7a2b=function(_0xf27a5d,_0x5a3b2f){_0xf27a5d=_0xf27a5d-0x0;var _0x217da7=_0xa2b7[_0xf27a5d];return _0x217da7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a2b('0x0'));var zipdir=require(_0x7a2b('0x1'));var jsonpatch=require(_0x7a2b('0x2'));var rp=require(_0x7a2b('0x3'));var moment=require(_0x7a2b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7a2b('0x5'));var util=require(_0x7a2b('0x6'));var path=require(_0x7a2b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7a2b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7a2b('0x9'));var crypto=require(_0x7a2b('0xa'));var jsforce=require(_0x7a2b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7a2b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a2b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x7a2b('0xe'));var hardwareService=require(_0x7a2b('0xf'));var logger=require(_0x7a2b('0x10'))(_0x7a2b('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7a2b('0x12'))['db'];function respondWithStatusCode(_0x3e32b8,_0x171234){_0x171234=_0x171234||0xcc;return function(_0xc4e4bc){if(_0xc4e4bc){return _0x3e32b8[_0x7a2b('0x13')](_0x171234);}return _0x3e32b8[_0x7a2b('0x14')](_0x171234)[_0x7a2b('0x15')]();};}function respondWithResult(_0x565d53,_0x4d047d){_0x4d047d=_0x4d047d||0xc8;return function(_0xaf7366){if(_0xaf7366){return _0x565d53['status'](_0x4d047d)[_0x7a2b('0x16')](_0xaf7366);}};}function respondWithFilteredResult(_0x5cda68,_0x17fa43){return function(_0x1f887a){if(_0x1f887a){var _0x5138f6=typeof _0x17fa43['offset']==='undefined'&&typeof _0x17fa43[_0x7a2b('0x17')]===_0x7a2b('0x18');var _0x143942=_0x1f887a['count'];var _0x4169e5=_0x5138f6?0x0:_0x17fa43['offset'];var _0x565666=_0x5138f6?_0x1f887a[_0x7a2b('0x19')]:_0x17fa43[_0x7a2b('0x1a')]+_0x17fa43['limit'];var _0x18f9ff;if(_0x565666>=_0x143942){_0x565666=_0x143942;_0x18f9ff=0xc8;}else{_0x18f9ff=0xce;}_0x5cda68['status'](_0x18f9ff);return _0x5cda68[_0x7a2b('0x1b')](_0x7a2b('0x1c'),_0x4169e5+'-'+_0x565666+'/'+_0x143942)[_0x7a2b('0x16')](_0x1f887a);}return null;};}function patchUpdates(_0x3e5098){return function(_0x5007b1){try{jsonpatch[_0x7a2b('0x1d')](_0x5007b1,_0x3e5098,!![]);}catch(_0x3786d2){return BPromise[_0x7a2b('0x1e')](_0x3786d2);}return _0x5007b1[_0x7a2b('0x1f')]();};}function saveUpdates(_0x143bf7,_0x1b49fb){return function(_0x49763b){if(_0x49763b){return _0x49763b[_0x7a2b('0x20')](_0x143bf7)[_0x7a2b('0x21')](function(_0x3a6b59){return _0x3a6b59;});}return null;};}function removeEntity(_0x3eab36,_0x2f8cae){return function(_0x3d739){if(_0x3d739){return _0x3d739[_0x7a2b('0x22')]()[_0x7a2b('0x21')](function(){_0x3eab36[_0x7a2b('0x14')](0xcc)[_0x7a2b('0x15')]();});}};}function handleEntityNotFound(_0x17f124,_0x244ad1){return function(_0x1c0837){if(!_0x1c0837){_0x17f124[_0x7a2b('0x13')](0x194);}return _0x1c0837;};}function handleError(_0x3d3a45,_0x499787){_0x499787=_0x499787||0x1f4;return function(_0x3c6f72){logger[_0x7a2b('0x23')](_0x3c6f72[_0x7a2b('0x24')]);if(_0x3c6f72[_0x7a2b('0x25')]){delete _0x3c6f72['name'];}_0x3d3a45['status'](_0x499787)[_0x7a2b('0x26')](_0x3c6f72);};}exports[_0x7a2b('0x27')]=function(_0x47a9bf,_0x10bba6){var _0x3eeec8={},_0x468270={},_0x9032c1={'count':0x0,'rows':[]};var _0x1958f4=_['map'](db['SmsApplication']['rawAttributes'],function(_0x374880){return{'name':_0x374880[_0x7a2b('0x28')],'type':_0x374880[_0x7a2b('0x29')][_0x7a2b('0x2a')]};});_0x468270[_0x7a2b('0x2b')]=_[_0x7a2b('0x2c')](_0x1958f4,_0x7a2b('0x25'));_0x468270['query']=_[_0x7a2b('0x2d')](_0x47a9bf['query']);_0x468270[_0x7a2b('0x2e')]=_[_0x7a2b('0x2f')](_0x468270['model'],_0x468270['query']);_0x3eeec8[_0x7a2b('0x30')]=_['intersection'](_0x468270[_0x7a2b('0x2b')],qs[_0x7a2b('0x31')](_0x47a9bf[_0x7a2b('0x32')][_0x7a2b('0x31')]));_0x3eeec8[_0x7a2b('0x30')]=_0x3eeec8[_0x7a2b('0x30')][_0x7a2b('0x33')]?_0x3eeec8[_0x7a2b('0x30')]:_0x468270[_0x7a2b('0x2b')];if(!_0x47a9bf[_0x7a2b('0x32')][_0x7a2b('0x34')]('nolimit')){_0x3eeec8[_0x7a2b('0x17')]=qs[_0x7a2b('0x17')](_0x47a9bf['query'][_0x7a2b('0x17')]);_0x3eeec8[_0x7a2b('0x1a')]=qs[_0x7a2b('0x1a')](_0x47a9bf['query'][_0x7a2b('0x1a')]);}_0x3eeec8[_0x7a2b('0x35')]=qs[_0x7a2b('0x36')](_0x47a9bf[_0x7a2b('0x32')][_0x7a2b('0x36')]);_0x3eeec8[_0x7a2b('0x37')]=qs[_0x7a2b('0x2e')](_[_0x7a2b('0x38')](_0x47a9bf[_0x7a2b('0x32')],_0x468270[_0x7a2b('0x2e')]),_0x1958f4);if(_0x47a9bf['query'][_0x7a2b('0x39')]){_0x3eeec8[_0x7a2b('0x37')]=_[_0x7a2b('0x3a')](_0x3eeec8[_0x7a2b('0x37')],{'$or':_['map'](_0x1958f4,function(_0x2452bc){if(_0x2452bc['type']!==_0x7a2b('0x3b')){var _0x5e077f={};_0x5e077f[_0x2452bc[_0x7a2b('0x25')]]={'$like':'%'+_0x47a9bf[_0x7a2b('0x32')]['filter']+'%'};return _0x5e077f;}})});}_0x3eeec8=_[_0x7a2b('0x3a')]({},_0x3eeec8,_0x47a9bf['options']);var _0x26ce27={'where':_0x3eeec8[_0x7a2b('0x37')]};return db[_0x7a2b('0x3c')][_0x7a2b('0x19')](_0x26ce27)[_0x7a2b('0x21')](function(_0x2893d7){_0x9032c1[_0x7a2b('0x19')]=_0x2893d7;if(_0x47a9bf[_0x7a2b('0x32')][_0x7a2b('0x3d')]){_0x3eeec8[_0x7a2b('0x3e')]=[{'all':!![]}];}return db[_0x7a2b('0x3c')][_0x7a2b('0x3f')](_0x3eeec8);})['then'](function(_0x2e112f){_0x9032c1[_0x7a2b('0x40')]=_0x2e112f;return _0x9032c1;})['then'](respondWithFilteredResult(_0x10bba6,_0x3eeec8))['catch'](handleError(_0x10bba6,null));};exports[_0x7a2b('0x41')]=function(_0x178aba,_0x427fb3){var _0x5b0ee9={'raw':!![],'where':{'id':_0x178aba[_0x7a2b('0x42')]['id']}},_0x4ddce1={};_0x4ddce1['model']=_[_0x7a2b('0x2d')](db[_0x7a2b('0x3c')][_0x7a2b('0x43')]);_0x4ddce1[_0x7a2b('0x32')]=_['keys'](_0x178aba[_0x7a2b('0x32')]);_0x4ddce1[_0x7a2b('0x2e')]=_['intersection'](_0x4ddce1[_0x7a2b('0x2b')],_0x4ddce1[_0x7a2b('0x32')]);_0x5b0ee9[_0x7a2b('0x30')]=_['intersection'](_0x4ddce1['model'],qs[_0x7a2b('0x31')](_0x178aba[_0x7a2b('0x32')][_0x7a2b('0x31')]));_0x5b0ee9['attributes']=_0x5b0ee9['attributes']['length']?_0x5b0ee9['attributes']:_0x4ddce1[_0x7a2b('0x2b')];if(_0x178aba[_0x7a2b('0x32')][_0x7a2b('0x3d')]){_0x5b0ee9[_0x7a2b('0x3e')]=[{'all':!![]}];}_0x5b0ee9=_[_0x7a2b('0x3a')]({},_0x5b0ee9,_0x178aba[_0x7a2b('0x44')]);return db[_0x7a2b('0x3c')][_0x7a2b('0x45')](_0x5b0ee9)[_0x7a2b('0x21')](handleEntityNotFound(_0x427fb3,null))[_0x7a2b('0x21')](respondWithResult(_0x427fb3,null))[_0x7a2b('0x46')](handleError(_0x427fb3,null));};exports[_0x7a2b('0x47')]=function(_0x185e8c,_0x54cdba){return db['SmsApplication']['create'](_0x185e8c[_0x7a2b('0x48')],{})[_0x7a2b('0x21')](respondWithResult(_0x54cdba,0xc9))[_0x7a2b('0x46')](handleError(_0x54cdba,null));};exports[_0x7a2b('0x20')]=function(_0x1183af,_0x2c396b){if(_0x1183af[_0x7a2b('0x48')]['id']){delete _0x1183af[_0x7a2b('0x48')]['id'];}return db['SmsApplication'][_0x7a2b('0x45')]({'where':{'id':_0x1183af['params']['id']}})[_0x7a2b('0x21')](handleEntityNotFound(_0x2c396b,null))[_0x7a2b('0x21')](saveUpdates(_0x1183af[_0x7a2b('0x48')],null))[_0x7a2b('0x21')](respondWithResult(_0x2c396b,null))[_0x7a2b('0x46')](handleError(_0x2c396b,null));};exports[_0x7a2b('0x22')]=function(_0xbf59fd,_0x500b8f){return db[_0x7a2b('0x3c')]['find']({'where':{'id':_0xbf59fd[_0x7a2b('0x42')]['id']}})[_0x7a2b('0x21')](handleEntityNotFound(_0x500b8f,null))[_0x7a2b('0x21')](removeEntity(_0x500b8f,null))[_0x7a2b('0x46')](handleError(_0x500b8f,null));}; \ No newline at end of file +var _0x7c7d=['send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','name'];(function(_0x368acc,_0x133420){var _0x502e88=function(_0x3a5dfe){while(--_0x3a5dfe){_0x368acc['push'](_0x368acc['shift']());}};_0x502e88(++_0x133420);}(_0x7c7d,0x6b));var _0xd7c7=function(_0x16fce8,_0x10ef9d){_0x16fce8=_0x16fce8-0x0;var _0x30a1f2=_0x7c7d[_0x16fce8];return _0x30a1f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd7c7('0x0'));var jsonpatch=require(_0xd7c7('0x1'));var rp=require(_0xd7c7('0x2'));var moment=require(_0xd7c7('0x3'));var BPromise=require(_0xd7c7('0x4'));var Mustache=require(_0xd7c7('0x5'));var util=require(_0xd7c7('0x6'));var path=require('path');var sox=require(_0xd7c7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7c7('0x8'));var squel=require(_0xd7c7('0x9'));var crypto=require(_0xd7c7('0xa'));var jsforce=require(_0xd7c7('0xb'));var deskjs=require(_0xd7c7('0xc'));var toCsv=require(_0xd7c7('0xd'));var querystring=require('querystring');var Papa=require(_0xd7c7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd7c7('0xf'));var as=require(_0xd7c7('0x10'));var hardwareService=require(_0xd7c7('0x11'));var logger=require(_0xd7c7('0x12'))('api');var utils=require(_0xd7c7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd7c7('0x14'));var db=require(_0xd7c7('0x15'))['db'];function respondWithStatusCode(_0x5c3841,_0x4c9aa5){_0x4c9aa5=_0x4c9aa5||0xcc;return function(_0x42bf5f){if(_0x42bf5f){return _0x5c3841[_0xd7c7('0x16')](_0x4c9aa5);}return _0x5c3841[_0xd7c7('0x17')](_0x4c9aa5)['end']();};}function respondWithResult(_0xa39b5f,_0x3aa1d3){_0x3aa1d3=_0x3aa1d3||0xc8;return function(_0x2d1ad8){if(_0x2d1ad8){return _0xa39b5f['status'](_0x3aa1d3)[_0xd7c7('0x18')](_0x2d1ad8);}};}function respondWithFilteredResult(_0x5a994a,_0xee74d6){return function(_0x58842b){if(_0x58842b){var _0x5b0c48=typeof _0xee74d6[_0xd7c7('0x19')]===_0xd7c7('0x1a')&&typeof _0xee74d6[_0xd7c7('0x1b')]===_0xd7c7('0x1a');var _0xdabf20=_0x58842b[_0xd7c7('0x1c')];var _0xba0494=_0x5b0c48?0x0:_0xee74d6['offset'];var _0x4d1060=_0x5b0c48?_0x58842b['count']:_0xee74d6[_0xd7c7('0x19')]+_0xee74d6[_0xd7c7('0x1b')];var _0x543efd;if(_0x4d1060>=_0xdabf20){_0x4d1060=_0xdabf20;_0x543efd=0xc8;}else{_0x543efd=0xce;}_0x5a994a[_0xd7c7('0x17')](_0x543efd);return _0x5a994a['set'](_0xd7c7('0x1d'),_0xba0494+'-'+_0x4d1060+'/'+_0xdabf20)[_0xd7c7('0x18')](_0x58842b);}return null;};}function patchUpdates(_0x3c0965){return function(_0xc1b1c1){try{jsonpatch['apply'](_0xc1b1c1,_0x3c0965,!![]);}catch(_0x240477){return BPromise[_0xd7c7('0x1e')](_0x240477);}return _0xc1b1c1[_0xd7c7('0x1f')]();};}function saveUpdates(_0x54ad9d,_0x3834b7){return function(_0xa5f3a8){if(_0xa5f3a8){return _0xa5f3a8[_0xd7c7('0x20')](_0x54ad9d)[_0xd7c7('0x21')](function(_0x58a807){return _0x58a807;});}return null;};}function removeEntity(_0x5c7426,_0x5e4083){return function(_0x50c471){if(_0x50c471){return _0x50c471['destroy']()[_0xd7c7('0x21')](function(){_0x5c7426[_0xd7c7('0x17')](0xcc)[_0xd7c7('0x22')]();});}};}function handleEntityNotFound(_0x3a4232,_0x14dfa1){return function(_0x106b96){if(!_0x106b96){_0x3a4232[_0xd7c7('0x16')](0x194);}return _0x106b96;};}function handleError(_0x22666a,_0x2574c7){_0x2574c7=_0x2574c7||0x1f4;return function(_0x5e8bec){logger[_0xd7c7('0x23')](_0x5e8bec['stack']);if(_0x5e8bec[_0xd7c7('0x24')]){delete _0x5e8bec[_0xd7c7('0x24')];}_0x22666a['status'](_0x2574c7)[_0xd7c7('0x25')](_0x5e8bec);};}exports[_0xd7c7('0x26')]=function(_0x169bb0,_0x200555){var _0xcd21e9={},_0x3b7148={},_0x4cd7f6={'count':0x0,'rows':[]};var _0x4f9292=_['map'](db[_0xd7c7('0x27')][_0xd7c7('0x28')],function(_0x2ca2ee){return{'name':_0x2ca2ee[_0xd7c7('0x29')],'type':_0x2ca2ee[_0xd7c7('0x2a')][_0xd7c7('0x2b')]};});_0x3b7148[_0xd7c7('0x2c')]=_[_0xd7c7('0x2d')](_0x4f9292,_0xd7c7('0x24'));_0x3b7148[_0xd7c7('0x2e')]=_[_0xd7c7('0x2f')](_0x169bb0[_0xd7c7('0x2e')]);_0x3b7148['filters']=_[_0xd7c7('0x30')](_0x3b7148['model'],_0x3b7148[_0xd7c7('0x2e')]);_0xcd21e9[_0xd7c7('0x31')]=_['intersection'](_0x3b7148['model'],qs[_0xd7c7('0x32')](_0x169bb0[_0xd7c7('0x2e')][_0xd7c7('0x32')]));_0xcd21e9[_0xd7c7('0x31')]=_0xcd21e9[_0xd7c7('0x31')]['length']?_0xcd21e9[_0xd7c7('0x31')]:_0x3b7148[_0xd7c7('0x2c')];if(!_0x169bb0['query']['hasOwnProperty'](_0xd7c7('0x33'))){_0xcd21e9['limit']=qs[_0xd7c7('0x1b')](_0x169bb0[_0xd7c7('0x2e')]['limit']);_0xcd21e9['offset']=qs[_0xd7c7('0x19')](_0x169bb0['query'][_0xd7c7('0x19')]);}_0xcd21e9[_0xd7c7('0x34')]=qs[_0xd7c7('0x35')](_0x169bb0[_0xd7c7('0x2e')][_0xd7c7('0x35')]);_0xcd21e9[_0xd7c7('0x36')]=qs['filters'](_[_0xd7c7('0x37')](_0x169bb0['query'],_0x3b7148[_0xd7c7('0x38')]),_0x4f9292);if(_0x169bb0['query'][_0xd7c7('0x39')]){_0xcd21e9[_0xd7c7('0x36')]=_[_0xd7c7('0x3a')](_0xcd21e9[_0xd7c7('0x36')],{'$or':_[_0xd7c7('0x2d')](_0x4f9292,function(_0x3fb63b){if(_0x3fb63b['type']!==_0xd7c7('0x3b')){var _0x1bcbb0={};_0x1bcbb0[_0x3fb63b[_0xd7c7('0x24')]]={'$like':'%'+_0x169bb0['query'][_0xd7c7('0x39')]+'%'};return _0x1bcbb0;}})});}_0xcd21e9=_[_0xd7c7('0x3a')]({},_0xcd21e9,_0x169bb0[_0xd7c7('0x3c')]);var _0xcb5893={'where':_0xcd21e9[_0xd7c7('0x36')]};return db[_0xd7c7('0x27')][_0xd7c7('0x1c')](_0xcb5893)[_0xd7c7('0x21')](function(_0x3cd7d4){_0x4cd7f6['count']=_0x3cd7d4;if(_0x169bb0[_0xd7c7('0x2e')][_0xd7c7('0x3d')]){_0xcd21e9[_0xd7c7('0x3e')]=[{'all':!![]}];}return db[_0xd7c7('0x27')]['findAll'](_0xcd21e9);})['then'](function(_0x755c1c){_0x4cd7f6[_0xd7c7('0x3f')]=_0x755c1c;return _0x4cd7f6;})[_0xd7c7('0x21')](respondWithFilteredResult(_0x200555,_0xcd21e9))['catch'](handleError(_0x200555,null));};exports[_0xd7c7('0x40')]=function(_0x111dc7,_0x5a8d76){var _0x3ec476={'raw':!![],'where':{'id':_0x111dc7[_0xd7c7('0x41')]['id']}},_0x694cad={};_0x694cad['model']=_[_0xd7c7('0x2f')](db['SmsApplication'][_0xd7c7('0x28')]);_0x694cad[_0xd7c7('0x2e')]=_[_0xd7c7('0x2f')](_0x111dc7[_0xd7c7('0x2e')]);_0x694cad['filters']=_['intersection'](_0x694cad[_0xd7c7('0x2c')],_0x694cad[_0xd7c7('0x2e')]);_0x3ec476['attributes']=_[_0xd7c7('0x30')](_0x694cad[_0xd7c7('0x2c')],qs['fields'](_0x111dc7[_0xd7c7('0x2e')][_0xd7c7('0x32')]));_0x3ec476[_0xd7c7('0x31')]=_0x3ec476['attributes'][_0xd7c7('0x42')]?_0x3ec476[_0xd7c7('0x31')]:_0x694cad['model'];if(_0x111dc7[_0xd7c7('0x2e')][_0xd7c7('0x3d')]){_0x3ec476[_0xd7c7('0x3e')]=[{'all':!![]}];}_0x3ec476=_[_0xd7c7('0x3a')]({},_0x3ec476,_0x111dc7[_0xd7c7('0x3c')]);return db['SmsApplication'][_0xd7c7('0x43')](_0x3ec476)[_0xd7c7('0x21')](handleEntityNotFound(_0x5a8d76,null))[_0xd7c7('0x21')](respondWithResult(_0x5a8d76,null))[_0xd7c7('0x44')](handleError(_0x5a8d76,null));};exports[_0xd7c7('0x45')]=function(_0x2eb89f,_0x5d81e2){return db['SmsApplication'][_0xd7c7('0x45')](_0x2eb89f['body'],{})[_0xd7c7('0x21')](respondWithResult(_0x5d81e2,0xc9))[_0xd7c7('0x44')](handleError(_0x5d81e2,null));};exports['update']=function(_0x48dc3f,_0x121950){if(_0x48dc3f[_0xd7c7('0x46')]['id']){delete _0x48dc3f[_0xd7c7('0x46')]['id'];}return db[_0xd7c7('0x27')][_0xd7c7('0x43')]({'where':{'id':_0x48dc3f['params']['id']}})[_0xd7c7('0x21')](handleEntityNotFound(_0x121950,null))['then'](saveUpdates(_0x48dc3f[_0xd7c7('0x46')],null))[_0xd7c7('0x21')](respondWithResult(_0x121950,null))[_0xd7c7('0x44')](handleError(_0x121950,null));};exports[_0xd7c7('0x47')]=function(_0x49dbf7,_0x5e109c){return db['SmsApplication']['find']({'where':{'id':_0x49dbf7[_0xd7c7('0x41')]['id']}})[_0xd7c7('0x21')](handleEntityNotFound(_0x5e109c,null))[_0xd7c7('0x21')](removeEntity(_0x5e109c,null))[_0xd7c7('0x44')](handleError(_0x5e109c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2cc1f4b..e489776 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 _0x2986=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf','./smsApplication.attributes','exports','define'];(function(_0x304fbd,_0x401f58){var _0x3a4448=function(_0x261bc9){while(--_0x261bc9){_0x304fbd['push'](_0x304fbd['shift']());}};_0x3a4448(++_0x401f58);}(_0x2986,0xa9));var _0x6298=function(_0x19c2a8,_0x4b89eb){_0x19c2a8=_0x19c2a8-0x0;var _0x594475=_0x2986[_0x19c2a8];return _0x594475;};'use strict';var _=require('lodash');var util=require(_0x6298('0x0'));var logger=require(_0x6298('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6298('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6298('0x3'));var config=require('../../config/environment');var attributes=require(_0x6298('0x4'));module[_0x6298('0x5')]=function(_0xb6882a,_0x5e2408){return _0xb6882a[_0x6298('0x6')](_0x6298('0x7'),attributes,{'tableName':_0x6298('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6298('0x9'),'collate':_0x6298('0xa')});}; \ No newline at end of file +var _0x4475=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x26657b,_0x55e3c8){var _0x765027=function(_0xc8ed77){while(--_0xc8ed77){_0x26657b['push'](_0x26657b['shift']());}};_0x765027(++_0x55e3c8);}(_0x4475,0xc1));var _0x5447=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4475[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x5447('0x0'));var util=require('util');var logger=require(_0x5447('0x1'))('api');var moment=require(_0x5447('0x2'));var BPromise=require(_0x5447('0x3'));var rp=require(_0x5447('0x4'));var fs=require('fs');var path=require(_0x5447('0x5'));var rimraf=require(_0x5447('0x6'));var config=require(_0x5447('0x7'));var attributes=require('./smsApplication.attributes');module[_0x5447('0x8')]=function(_0x4f12fd,_0x2b7e4c){return _0x4f12fd[_0x5447('0x9')](_0x5447('0xa'),attributes,{'tableName':_0x5447('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5447('0xc'),'collate':_0x5447('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index efe5d52..8e59609 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 _0x8357=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x4a69db,_0xe88977){var _0x4452a0=function(_0x4f2b40){while(--_0x4f2b40){_0x4a69db['push'](_0x4a69db['shift']());}};_0x4452a0(++_0xe88977);}(_0x8357,0x1e4));var _0x7835=function(_0x5be305,_0x86c53f){_0x5be305=_0x5be305-0x0;var _0x294c25=_0x8357[_0x5be305];return _0x294c25;};'use strict';var _=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var moment=require(_0x7835('0x2'));var BPromise=require('bluebird');var rs=require(_0x7835('0x3'));var fs=require('fs');var Redis=require(_0x7835('0x4'));var db=require(_0x7835('0x5'))['db'];var utils=require(_0x7835('0x6'));var logger=require(_0x7835('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7835('0x8'));var client=jayson['client'][_0x7835('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298c79,_0x504d32,_0x48805f){return new BPromise(function(_0x11835c,_0x5bc0f7){return client[_0x7835('0xa')](_0x298c79,_0x48805f)[_0x7835('0xb')](function(_0x2b34af){logger[_0x7835('0xc')]('SmsApplication,\x20%s,\x20%s',_0x504d32,_0x7835('0xd'));logger[_0x7835('0xe')](_0x7835('0xf'),_0x504d32,_0x7835('0xd'),JSON[_0x7835('0x10')](_0x2b34af));if(_0x2b34af[_0x7835('0x11')]){if(_0x2b34af[_0x7835('0x11')]['code']===0x1f4){logger[_0x7835('0x11')](_0x7835('0x12'),_0x504d32,_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);return _0x5bc0f7(_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);}logger[_0x7835('0x11')](_0x7835('0x12'),_0x504d32,_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);return _0x11835c(_0x2b34af[_0x7835('0x11')][_0x7835('0x13')]);}else{logger[_0x7835('0xc')](_0x7835('0x12'),_0x504d32,'request\x20sent');_0x11835c(_0x2b34af[_0x7835('0x14')][_0x7835('0x13')]);}})[_0x7835('0x15')](function(_0x1792cd){logger[_0x7835('0x11')]('SmsApplication,\x20%s,\x20%s',_0x504d32,_0x1792cd);_0x5bc0f7(_0x1792cd);});});} \ No newline at end of file +var _0x4f7a=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x98a41,_0x9a4edd){var _0x4289ff=function(_0xae3996){while(--_0xae3996){_0x98a41['push'](_0x98a41['shift']());}};_0x4289ff(++_0x9a4edd);}(_0x4f7a,0x105));var _0xa4f7=function(_0x58eb12,_0x3364bd){_0x58eb12=_0x58eb12-0x0;var _0x59102b=_0x4f7a[_0x58eb12];return _0x59102b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4f7('0x0'));var BPromise=require(_0xa4f7('0x1'));var rs=require(_0xa4f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4f7('0x4'))(_0xa4f7('0x5'));var config=require(_0xa4f7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa4f7('0x7')][_0xa4f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c78bd,_0x58e1c7,_0x1cea4c){return new BPromise(function(_0x1e3ff3,_0x1410a1){return client[_0xa4f7('0x9')](_0x4c78bd,_0x1cea4c)[_0xa4f7('0xa')](function(_0x498186){logger[_0xa4f7('0xb')](_0xa4f7('0xc'),_0x58e1c7,_0xa4f7('0xd'));logger[_0xa4f7('0xe')](_0xa4f7('0xf'),_0x58e1c7,_0xa4f7('0xd'),JSON[_0xa4f7('0x10')](_0x498186));if(_0x498186['error']){if(_0x498186['error'][_0xa4f7('0x11')]===0x1f4){logger[_0xa4f7('0x12')]('SmsApplication,\x20%s,\x20%s',_0x58e1c7,_0x498186[_0xa4f7('0x12')][_0xa4f7('0x13')]);return _0x1410a1(_0x498186[_0xa4f7('0x12')]['message']);}logger[_0xa4f7('0x12')](_0xa4f7('0xc'),_0x58e1c7,_0x498186[_0xa4f7('0x12')]['message']);return _0x1e3ff3(_0x498186[_0xa4f7('0x12')][_0xa4f7('0x13')]);}else{logger[_0xa4f7('0xb')](_0xa4f7('0xc'),_0x58e1c7,'request\x20sent');_0x1e3ff3(_0x498186[_0xa4f7('0x14')][_0xa4f7('0x13')]);}})['catch'](function(_0x501fe1){logger[_0xa4f7('0x12')]('SmsApplication,\x20%s,\x20%s',_0x58e1c7,_0x501fe1);_0x1410a1(_0x501fe1);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 4c010d2..dc5f372 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 _0x955f=['fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express'];(function(_0xe43113,_0x4cfdb3){var _0x5c6af6=function(_0x30bb6c){while(--_0x30bb6c){_0xe43113['push'](_0xe43113['shift']());}};_0x5c6af6(++_0x4cfdb3);}(_0x955f,0x1eb));var _0xf955=function(_0x37910f,_0x20c4d2){_0x37910f=_0x37910f-0x0;var _0x2f0123=_0x955f[_0x37910f];return _0x2f0123;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./smsInteraction.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0x7')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller['getMessages']);router[_0xf955('0x7')]('/:id/download',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router[_0xf955('0xf')]('/',auth['isAuthenticated'](),controller[_0xf955('0x10')]);router['post'](_0xf955('0xd'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);router[_0xf955('0xf')](_0xf955('0x12'),auth[_0xf955('0x8')](),interaction[_0xf955('0x13')](_0xf955('0x14'),_0xf955('0x15')),controller[_0xf955('0x16')]);router[_0xf955('0x17')](_0xf955('0xb'),auth['isAuthenticated'](),interaction[_0xf955('0x13')]('sms',_0xf955('0x18')),controller[_0xf955('0x19')]);router[_0xf955('0x1a')](_0xf955('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xf955('0x14'),_0xf955('0x1b')),controller[_0xf955('0x1c')]);router['delete'](_0xf955('0x12'),auth[_0xf955('0x8')](),controller[_0xf955('0x1d')]);module[_0xf955('0x1e')]=router; \ No newline at end of file +var _0xac4a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','get','describe','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x4ef28e,_0xdec966){var _0x5be4f2=function(_0x1d1063){while(--_0x1d1063){_0x4ef28e['push'](_0x4ef28e['shift']());}};_0x5be4f2(++_0xdec966);}(_0xac4a,0x13f));var _0xaac4=function(_0x33693d,_0x3982c9){_0x33693d=_0x33693d-0x0;var _0x1d01c8=_0xac4a[_0x33693d];return _0x1d01c8;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x15')),controller[_0xaac4('0x16')]);router[_0xaac4('0x17')](_0xaac4('0x18'),auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x19')),controller[_0xaac4('0x1a')]);router[_0xaac4('0x1b')]('/:id',auth[_0xaac4('0x9')](),interaction['tracked'](_0xaac4('0x14'),'smsinteraction:destroy'),controller[_0xaac4('0x1c')]);router[_0xaac4('0x1b')](_0xaac4('0x1d'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x1e')]);module[_0xaac4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 7e7fa6b..4656fe2 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 _0x4201=['out','sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x16156b,_0x44e3b4){var _0x265946=function(_0x359998){while(--_0x359998){_0x16156b['push'](_0x16156b['shift']());}};_0x265946(++_0x44e3b4);}(_0x4201,0x71));var _0x1420=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x4201[_0x3167b1];return _0x362152;};'use strict';var Sequelize=require(_0x1420('0x0'));var moment=require(_0x1420('0x1'));module['exports']={'closed':{'type':Sequelize[_0x1420('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1420('0x3')]},'disposition':{'type':Sequelize[_0x1420('0x4')]},'secondDisposition':{'type':Sequelize[_0x1420('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1420('0x4')]},'note':{'type':Sequelize[_0x1420('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1420('0x5')]('in',_0x1420('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1420('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1420('0x5')]('in',_0x1420('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8b0e=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x3a4827,_0x8a4407){var _0xabf933=function(_0x297761){while(--_0x297761){_0x3a4827['push'](_0x3a4827['shift']());}};_0xabf933(++_0x8a4407);}(_0x8b0e,0x166));var _0xe8b0=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x8b0e[_0x3e8cae];return _0x45c4d6;};'use strict';var Sequelize=require(_0xe8b0('0x0'));var moment=require(_0xe8b0('0x1'));module[_0xe8b0('0x2')]={'closed':{'type':Sequelize[_0xe8b0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe8b0('0x4')]},'disposition':{'type':Sequelize[_0xe8b0('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe8b0('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe8b0('0x5')]},'read1stAt':{'type':Sequelize[_0xe8b0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe8b0('0x6')]('in',_0xe8b0('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe8b0('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe8b0('0x6')]('in',_0xe8b0('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe8b0('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 847d2f9..b3184f5 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 _0x1eec=['Content-Range','update','then','destroy','end','stack','name','send','index','map','SmsInteraction','rawAttributes','type','key','findAll','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','SmsMessage','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Owner','mkdirSync','Sms','N.A.','closed','closedAt','toString','System','lastName','out','value','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','zip-dir','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x4756e8,_0x480e7e){var _0x4cd529=function(_0x36d4b1){while(--_0x36d4b1){_0x4756e8['push'](_0x4756e8['shift']());}};_0x4cd529(++_0x480e7e);}(_0x1eec,0xde));var _0xc1ee=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x1eec[_0x29d915];return _0x160f86;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc1ee('0x0'));var moment=require('moment');var BPromise=require(_0xc1ee('0x1'));var util=require(_0xc1ee('0x2'));var path=require('path');var ejs=require(_0xc1ee('0x3'));var fs=require('fs');var _=require(_0xc1ee('0x4'));var Redis=require(_0xc1ee('0x5'));var interaction=require(_0xc1ee('0x6'));var qs=require(_0xc1ee('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xc1ee('0x8'))(_0xc1ee('0x9'));var config=require(_0xc1ee('0xa'));var db=require(_0xc1ee('0xb'))['db'];config['redis']=_[_0xc1ee('0xc')](config['redis'],{'host':_0xc1ee('0xd'),'port':0x18eb});var socket=require(_0xc1ee('0xe'))(new Redis(config[_0xc1ee('0xf')]));require(_0xc1ee('0x10'))[_0xc1ee('0x11')](socket);function respondWithStatusCode(_0x1ba687,_0x46e9b7){_0x46e9b7=_0x46e9b7||0xcc;return function(_0x1e6a66){if(_0x1e6a66){return _0x1ba687[_0xc1ee('0x12')](_0x46e9b7);}return _0x1ba687[_0xc1ee('0x13')](_0x46e9b7)['end']();};}function respondWithResult(_0x2b46b9,_0x51b54e){_0x51b54e=_0x51b54e||0xc8;return function(_0x146066){if(_0x146066){return _0x2b46b9[_0xc1ee('0x13')](_0x51b54e)[_0xc1ee('0x14')](_0x146066);}};}function respondWithFilteredResult(_0x541109,_0x347b29){return function(_0x7e6fbb){if(_0x7e6fbb){var _0x4485a9=typeof _0x347b29[_0xc1ee('0x15')]===_0xc1ee('0x16')&&typeof _0x347b29[_0xc1ee('0x17')]===_0xc1ee('0x16');var _0x4c5e20=_0x7e6fbb[_0xc1ee('0x18')];var _0x2e9082=_0x4485a9?0x0:_0x347b29[_0xc1ee('0x15')];var _0x95d395=_0x4485a9?_0x7e6fbb[_0xc1ee('0x18')]:_0x347b29[_0xc1ee('0x15')]+_0x347b29[_0xc1ee('0x17')];var _0x3f112d;if(_0x95d395>=_0x4c5e20){_0x95d395=_0x4c5e20;_0x3f112d=0xc8;}else{_0x3f112d=0xce;}_0x541109['status'](_0x3f112d);return _0x541109[_0xc1ee('0x19')](_0xc1ee('0x1a'),_0x2e9082+'-'+_0x95d395+'/'+_0x4c5e20)['json'](_0x7e6fbb);}return null;};}function saveUpdates(_0x7fe9fe){return function(_0x42310a){if(_0x42310a){return _0x42310a[_0xc1ee('0x1b')](_0x7fe9fe)[_0xc1ee('0x1c')](function(_0x156b10){return _0x156b10;});}return null;};}function removeEntity(_0x4e3a13){return function(_0x64ce51){if(_0x64ce51){return _0x64ce51[_0xc1ee('0x1d')]()[_0xc1ee('0x1c')](function(){_0x4e3a13[_0xc1ee('0x13')](0xcc)[_0xc1ee('0x1e')]();});}};}function handleEntityNotFound(_0x2c398f){return function(_0x396764){if(!_0x396764){_0x2c398f[_0xc1ee('0x12')](0x194);}return _0x396764;};}function handleError(_0x28f732,_0x31eb9c){_0x31eb9c=_0x31eb9c||0x1f4;return function(_0x21d09d){logger['error'](_0x21d09d[_0xc1ee('0x1f')]);if(_0x21d09d[_0xc1ee('0x20')]){delete _0x21d09d[_0xc1ee('0x20')];}_0x28f732[_0xc1ee('0x13')](_0x31eb9c)[_0xc1ee('0x21')](_0x21d09d);};}exports[_0xc1ee('0x22')]=function(_0x2e442d,_0x530de2){var _0x20d750={};var _0x12beff=_[_0xc1ee('0x23')](db[_0xc1ee('0x24')][_0xc1ee('0x25')],function(_0x44af54){return{'name':_0x44af54['fieldName'],'type':_0x44af54[_0xc1ee('0x26')][_0xc1ee('0x27')]};});_0x20d750=qs['getOptions'](_0x12beff,_0x2e442d);return interaction[_0xc1ee('0x28')](_0xc1ee('0x29'),_0x2e442d[_0xc1ee('0x2a')],_0x2e442d[_0xc1ee('0x2b')],_0x20d750,_0x12beff)['then'](respondWithFilteredResult(_0x530de2,_0x20d750))[_0xc1ee('0x2c')](handleError(_0x530de2,null));};exports['show']=function(_0x17b6ed,_0x46b5bb){var _0x117d07={'raw':![],'where':{'id':_0x17b6ed[_0xc1ee('0x2d')]['id']}},_0x2052c8={};_0x2052c8[_0xc1ee('0x2e')]=_[_0xc1ee('0x2f')](db[_0xc1ee('0x24')][_0xc1ee('0x25')]);_0x2052c8[_0xc1ee('0x2a')]=_['keys'](_0x17b6ed[_0xc1ee('0x2a')]);_0x2052c8[_0xc1ee('0x30')]=_[_0xc1ee('0x31')](_0x2052c8[_0xc1ee('0x2e')],_0x2052c8[_0xc1ee('0x2a')]);_0x117d07[_0xc1ee('0x32')]=_[_0xc1ee('0x31')](_0x2052c8['model'],qs['fields'](_0x17b6ed[_0xc1ee('0x2a')][_0xc1ee('0x33')]));_0x117d07[_0xc1ee('0x32')]=_0x117d07[_0xc1ee('0x32')][_0xc1ee('0x34')]?_0x117d07[_0xc1ee('0x32')]:_0x2052c8['model'];if(_0x17b6ed['query'][_0xc1ee('0x35')]){_0x117d07[_0xc1ee('0x36')]=[{'all':!![]}];}_0x117d07=_[_0xc1ee('0x37')]({},_0x117d07,_0x17b6ed['options']);return db[_0xc1ee('0x24')]['find'](_0x117d07)[_0xc1ee('0x1c')](handleEntityNotFound(_0x46b5bb,null))[_0xc1ee('0x1c')](respondWithResult(_0x46b5bb,null))['catch'](handleError(_0x46b5bb,null));};exports[_0xc1ee('0x38')]=function(_0x8a4a6,_0xe435a3){return db[_0xc1ee('0x24')]['create'](_0x8a4a6[_0xc1ee('0x39')],{})[_0xc1ee('0x1c')](respondWithResult(_0xe435a3,0xc9))['catch'](handleError(_0xe435a3,null));};exports['update']=function(_0x444d53,_0x39904f){if(_0x444d53[_0xc1ee('0x39')]['id']){delete _0x444d53[_0xc1ee('0x39')]['id'];}return db[_0xc1ee('0x24')][_0xc1ee('0x3a')]({'where':{'id':_0x444d53[_0xc1ee('0x2d')]['id']}})[_0xc1ee('0x1c')](handleEntityNotFound(_0x39904f,null))['then'](saveUpdates(_0x444d53['body'],null))[_0xc1ee('0x1c')](respondWithResult(_0x39904f,null))[_0xc1ee('0x2c')](handleError(_0x39904f,null));};exports[_0xc1ee('0x1d')]=function(_0x14db3c,_0x5a6722){return db[_0xc1ee('0x24')]['find']({'where':{'id':_0x14db3c[_0xc1ee('0x2d')]['id']}})[_0xc1ee('0x1c')](handleEntityNotFound(_0x5a6722,null))['then'](removeEntity(_0x5a6722,null))[_0xc1ee('0x2c')](handleError(_0x5a6722,null));};exports[_0xc1ee('0x3b')]=function(_0x3f0455,_0x2cd6ce){return db[_0xc1ee('0x24')][_0xc1ee('0x3b')]()[_0xc1ee('0x1c')](respondWithResult(_0x2cd6ce,null))['catch'](handleError(_0x2cd6ce,null));};exports[_0xc1ee('0x3c')]=function(_0x2b352c,_0x48fa3b){return db['SmsMessage'][_0xc1ee('0x3a')]({'where':{'id':_0x2b352c[_0xc1ee('0x2d')]['id']}})[_0xc1ee('0x1c')](handleEntityNotFound(_0x48fa3b,null))['then'](function(_0x500ae1){if(_0x500ae1){return _0x500ae1['addMessage'](_0x2b352c[_0xc1ee('0x39')][_0xc1ee('0x3d')],_[_0xc1ee('0x3e')](_0x2b352c[_0xc1ee('0x39')],[_0xc1ee('0x3d'),'id'])||{});}})[_0xc1ee('0x1c')](respondWithResult(_0x48fa3b,null))['catch'](handleError(_0x48fa3b,null));};exports[_0xc1ee('0x3f')]=function(_0x2be7b9,_0x1c40e7){var _0x3a7d75={'raw':![],'where':{}};var _0x5e7a30={};var _0x424d0c={'count':0x0,'rows':[]};return db[_0xc1ee('0x24')][_0xc1ee('0x40')]({'where':{'id':_0x2be7b9[_0xc1ee('0x2d')]['id']}})[_0xc1ee('0x1c')](handleEntityNotFound(_0x1c40e7,null))[_0xc1ee('0x1c')](function(_0x175823){if(_0x175823){_0x5e7a30['model']=_[_0xc1ee('0x2f')](db['SmsMessage'][_0xc1ee('0x25')]);_0x5e7a30['query']=_[_0xc1ee('0x2f')](_0x2be7b9[_0xc1ee('0x2a')]);_0x5e7a30[_0xc1ee('0x30')]=_['intersection'](_0x5e7a30[_0xc1ee('0x2e')],_0x5e7a30[_0xc1ee('0x2a')]);_0x3a7d75[_0xc1ee('0x32')]=_['intersection'](_0x5e7a30[_0xc1ee('0x2e')],qs[_0xc1ee('0x33')](_0x2be7b9['query'][_0xc1ee('0x33')]));_0x3a7d75[_0xc1ee('0x32')]=_0x3a7d75[_0xc1ee('0x32')][_0xc1ee('0x34')]?_0x3a7d75[_0xc1ee('0x32')]:_0x5e7a30['model'];if(!_0x2be7b9[_0xc1ee('0x2a')]['hasOwnProperty'](_0xc1ee('0x41'))){_0x3a7d75['limit']=qs[_0xc1ee('0x17')](_0x2be7b9[_0xc1ee('0x2a')][_0xc1ee('0x17')]);_0x3a7d75['offset']=qs['offset'](_0x2be7b9[_0xc1ee('0x2a')][_0xc1ee('0x15')]);}_0x3a7d75[_0xc1ee('0x42')]=qs['sort'](_0x2be7b9[_0xc1ee('0x2a')][_0xc1ee('0x43')]);_0x3a7d75[_0xc1ee('0x44')]=qs[_0xc1ee('0x30')](_[_0xc1ee('0x45')](_0x2be7b9[_0xc1ee('0x2a')],_0x5e7a30[_0xc1ee('0x30')]));_0x3a7d75[_0xc1ee('0x44')][_0xc1ee('0x46')]=_0x175823['id'];if(_0x2be7b9[_0xc1ee('0x2a')][_0xc1ee('0x47')]){_0x3a7d75[_0xc1ee('0x44')]=_[_0xc1ee('0x37')](_0x3a7d75[_0xc1ee('0x44')],{'$or':_[_0xc1ee('0x23')](_0x3a7d75[_0xc1ee('0x32')],function(_0x175132){var _0x40dbac={};_0x40dbac[_0x175132]={'$like':'%'+_0x2be7b9[_0xc1ee('0x2a')]['filter']+'%'};return _0x40dbac;})});}if(_0x2be7b9[_0xc1ee('0x2a')][_0xc1ee('0x48')]){var _0x9ada82=_0x2be7b9[_0xc1ee('0x2a')]['$gte'][_0xc1ee('0x49')](',');var _0x382d16={};_0x382d16[_0x9ada82[0x0]]={'$gte':moment(_0x9ada82[0x1])[_0xc1ee('0x4a')](_0xc1ee('0x4b'))};_0x3a7d75[_0xc1ee('0x44')]=_[_0xc1ee('0x37')](_0x3a7d75[_0xc1ee('0x44')],_0x382d16);}_0x3a7d75=_[_0xc1ee('0x37')]({},_0x3a7d75,_0x2be7b9[_0xc1ee('0x4c')]);return db[_0xc1ee('0x4d')][_0xc1ee('0x18')]({'where':_0x3a7d75[_0xc1ee('0x44')]})['then'](function(_0x4e5e87){_0x424d0c[_0xc1ee('0x18')]=_0x4e5e87;if(_0x2be7b9[_0xc1ee('0x2a')][_0xc1ee('0x35')]){_0x3a7d75['include']=[{'all':!![]}];}return db[_0xc1ee('0x4d')][_0xc1ee('0x28')](_0x3a7d75);})['then'](function(_0x4f0f86){_0x424d0c[_0xc1ee('0x4e')]=_0x4f0f86;return _0x424d0c;});}})['then'](respondWithFilteredResult(_0x1c40e7,_0x3a7d75))[_0xc1ee('0x2c')](handleError(_0x1c40e7,null));};exports[_0xc1ee('0x4f')]=function(_0x1ea27c,_0x4ab81d){return db[_0xc1ee('0x24')][_0xc1ee('0x3a')]({'where':{'id':_0x1ea27c[_0xc1ee('0x2d')]['id']}})[_0xc1ee('0x1c')](handleEntityNotFound(_0x4ab81d,null))['then'](function(_0x4ab78c){if(_0x4ab78c){return _0x4ab78c[_0xc1ee('0x50')](_0x1ea27c[_0xc1ee('0x39')][_0xc1ee('0x3d')],_[_0xc1ee('0x3e')](_0x1ea27c[_0xc1ee('0x39')],[_0xc1ee('0x3d'),'id'])||{})[_0xc1ee('0x51')](function(){return db[_0xc1ee('0x52')][_0xc1ee('0x28')]({'attributes':['id',_0xc1ee('0x20'),_0xc1ee('0x53')],'where':{'id':_0x1ea27c['body'][_0xc1ee('0x3d')]}});})[_0xc1ee('0x1c')](function(_0x37e48c){socket[_0xc1ee('0x54')](_0xc1ee('0x55'),{'id':Number(_0x1ea27c[_0xc1ee('0x2d')]['id']),'tags':_0x37e48c||[]});return{'id':Number(_0x1ea27c[_0xc1ee('0x2d')]['id']),'tags':_0x37e48c||[]};});}})[_0xc1ee('0x1c')](respondWithResult(_0x4ab81d,null))[_0xc1ee('0x2c')](handleError(_0x4ab81d,null));};exports[_0xc1ee('0x56')]=function(_0x5f03f4,_0x5101ef){return db[_0xc1ee('0x24')][_0xc1ee('0x3a')]({'where':{'id':_0x5f03f4[_0xc1ee('0x2d')]['id']}})[_0xc1ee('0x1c')](handleEntityNotFound(_0x5101ef,null))[_0xc1ee('0x1c')](function(_0x147193){if(_0x147193){return _0x147193[_0xc1ee('0x56')](_0x5f03f4[_0xc1ee('0x2a')][_0xc1ee('0x3d')]);}})['then'](respondWithStatusCode(_0x5101ef,null))['catch'](handleError(_0x5101ef,null));};exports[_0xc1ee('0x57')]=function(_0x208f69,_0x308d1a){var _0x438d82=moment()[_0xc1ee('0x58')]()['toString']();var _0x377915=path[_0xc1ee('0x59')](config[_0xc1ee('0x5a')],_0xc1ee('0x5b'),_0xc1ee('0x5c'),_0xc1ee('0x5d'));var _0x429c1d=path[_0xc1ee('0x59')](_0x377915,_0x438d82);var _0x450105=util[_0xc1ee('0x4a')](_0xc1ee('0x5e'),_0x208f69['params']['id'],_0x438d82);var _0x14317b=path[_0xc1ee('0x59')](_0x377915,_0x450105);var _0x537f99=[];_0x537f99[_0xc1ee('0x5f')]({'model':db['User'],'as':_0xc1ee('0x60'),'attributes':['id',_0xc1ee('0x61')],'raw':!![]});_0x537f99[_0xc1ee('0x5f')]({'model':db[_0xc1ee('0x62')],'as':_0xc1ee('0x63'),'attributes':['id',_0xc1ee('0x64'),'lastName'],'raw':!![]});var _0x405b48=[{'model':db[_0xc1ee('0x4d')],'as':_0xc1ee('0x65'),'attributes':['id',_0xc1ee('0x39'),_0xc1ee('0x66'),_0xc1ee('0x67'),_0xc1ee('0x68'),_0xc1ee('0x69')],'include':_0x537f99}];_0x405b48[_0xc1ee('0x5f')]({'model':db[_0xc1ee('0x6a')],'as':'Account','attributes':['id',_0xc1ee('0x20')]});_0x405b48[_0xc1ee('0x5f')]({'model':db['User'],'as':_0xc1ee('0x6b'),'attributes':['id',_0xc1ee('0x61')]});return db[_0xc1ee('0x24')][_0xc1ee('0x3a')]({'where':{'id':_0x208f69[_0xc1ee('0x2d')]['id']},'include':_0x405b48})['then'](handleEntityNotFound(_0x308d1a,null))['then'](function(_0x4979e1){if(_0x4979e1){var _0x4d05e6=_0x4979e1['get']({'plain':!![]});fs[_0xc1ee('0x6c')](_0x429c1d);var _0x37c11c={'channel':_0xc1ee('0x6d'),'account':_0x4d05e6['Account'][_0xc1ee('0x20')],'agent':_0x4d05e6[_0xc1ee('0x6b')]?_0x4d05e6[_0xc1ee('0x6b')]['fullname']:_0xc1ee('0x6e'),'createdAt':moment(_0x4d05e6['createdAt'])[_0xc1ee('0x4a')](_0xc1ee('0x4b'))['toString'](),'closedAt':_0x4d05e6[_0xc1ee('0x6f')]?moment(_0x4d05e6[_0xc1ee('0x70')])[_0xc1ee('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc1ee('0x71')]():'','disposition':_0x4d05e6['disposition'],'messages':_(_0x4d05e6[_0xc1ee('0x65')])[_0xc1ee('0x47')]({'secret':![]})[_0xc1ee('0x23')](function(_0x5b64bc){return{'date':moment(_0x5b64bc[_0xc1ee('0x66')])['format'](_0xc1ee('0x4b'))[_0xc1ee('0x71')](),'sender':_0x5b64bc[_0xc1ee('0x67')]==='out'?_0x5b64bc[_0xc1ee('0x60')]?_0x5b64bc[_0xc1ee('0x60')][_0xc1ee('0x61')]:_0xc1ee('0x72'):_0x5b64bc[_0xc1ee('0x63')][_0xc1ee('0x64')]+(_0x5b64bc[_0xc1ee('0x63')][_0xc1ee('0x73')]?'\x20'+_0x5b64bc[_0xc1ee('0x63')]['lastName']:''),'body':_0x5b64bc['body'],'direction':_0x5b64bc[_0xc1ee('0x67')]===_0xc1ee('0x74')?'A':'C','secret':_0x5b64bc['secret'],'read':_0x5b64bc[_0xc1ee('0x69')]};})[_0xc1ee('0x75')]()};return ejs[_0xc1ee('0x76')](path['join'](config[_0xc1ee('0x5a')],_0xc1ee('0x5b'),'views',_0xc1ee('0x77')),{'interaction':_0x37c11c})[_0xc1ee('0x1c')](function(_0x41dee3){var _0x515ec5=path[_0xc1ee('0x59')](_0x429c1d,'transcript-'+_0x4d05e6['id']+'-'+_0x438d82+_0xc1ee('0x78'));var _0x5b65a3={'path':_0x515ec5,'channel':'Sms','interactionId':_0x4d05e6['id']};return pdf[_0xc1ee('0x79')](_0x41dee3,_0x5b65a3);})[_0xc1ee('0x1c')](function(){return new BPromise(function(_0x225e09,_0x2a3fe1){zipdir(_0x429c1d,{'saveTo':_0x14317b},function(_0x238d0e,_0x386541){if(_0x238d0e)return _0x2a3fe1(_0x238d0e);return _0x225e09(_0x386541);});})[_0xc1ee('0x1c')](function(){return new BPromise(function(_0x2ee9ac,_0x4f0484){rimraf(_0x429c1d,function(_0x5a7b09){if(_0x5a7b09)_0x4f0484(_0x5a7b09);return _0x2ee9ac();});});})[_0xc1ee('0x1c')](function(){return _0x308d1a[_0xc1ee('0x57')](_0x14317b,_0x450105,function(_0x4326be){if(_0x4326be){console[_0xc1ee('0x7a')](_0xc1ee('0x7b'),_0x4326be);}else{fs['unlinkSync'](_0x14317b);}});});});}else{return _0x308d1a[_0xc1ee('0x12')](0xc8);}})['catch'](handleError(_0x308d1a,null));}; \ No newline at end of file +var _0xa8ce=['rawAttributes','fieldName','key','findAll','sms','query','user','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','SmsInteraction','find','catch','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','root','join','push','User','fullname','CmContact','Contact','lastName','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','out','firstName','value','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','sendStatus','status','end','json','limit','count','offset','set','update','then','destroy','stack','name','send','map'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0xa8ce,0xc7));var _0xea8c=function(_0x337aeb,_0x361105){_0x337aeb=_0x337aeb-0x0;var _0x56a5aa=_0xa8ce[_0x337aeb];return _0x56a5aa;};'use strict';var rimraf=require(_0xea8c('0x0'));var zipdir=require(_0xea8c('0x1'));var moment=require(_0xea8c('0x2'));var BPromise=require(_0xea8c('0x3'));var util=require(_0xea8c('0x4'));var path=require(_0xea8c('0x5'));var ejs=require(_0xea8c('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xea8c('0x7'));var interaction=require(_0xea8c('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xea8c('0x9'));var logger=require('../../config/logger')(_0xea8c('0xa'));var config=require('../../config/environment');var db=require(_0xea8c('0xb'))['db'];config['redis']=_[_0xea8c('0xc')](config[_0xea8c('0xd')],{'host':_0xea8c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea8c('0xd')]));require(_0xea8c('0xf'))['register'](socket);function respondWithStatusCode(_0x575748,_0x403de3){_0x403de3=_0x403de3||0xcc;return function(_0x8a8df6){if(_0x8a8df6){return _0x575748[_0xea8c('0x10')](_0x403de3);}return _0x575748[_0xea8c('0x11')](_0x403de3)[_0xea8c('0x12')]();};}function respondWithResult(_0x1ae265,_0x5e688d){_0x5e688d=_0x5e688d||0xc8;return function(_0x12d96b){if(_0x12d96b){return _0x1ae265[_0xea8c('0x11')](_0x5e688d)[_0xea8c('0x13')](_0x12d96b);}};}function respondWithFilteredResult(_0x36488b,_0x2d8830){return function(_0x60bcdf){if(_0x60bcdf){var _0x3ec2c0=typeof _0x2d8830['offset']==='undefined'&&typeof _0x2d8830[_0xea8c('0x14')]==='undefined';var _0xcc357c=_0x60bcdf[_0xea8c('0x15')];var _0x2abdb5=_0x3ec2c0?0x0:_0x2d8830[_0xea8c('0x16')];var _0x4f2e25=_0x3ec2c0?_0x60bcdf[_0xea8c('0x15')]:_0x2d8830[_0xea8c('0x16')]+_0x2d8830[_0xea8c('0x14')];var _0x109263;if(_0x4f2e25>=_0xcc357c){_0x4f2e25=_0xcc357c;_0x109263=0xc8;}else{_0x109263=0xce;}_0x36488b[_0xea8c('0x11')](_0x109263);return _0x36488b[_0xea8c('0x17')]('Content-Range',_0x2abdb5+'-'+_0x4f2e25+'/'+_0xcc357c)[_0xea8c('0x13')](_0x60bcdf);}return null;};}function saveUpdates(_0x1f0fd4){return function(_0x5aa60c){if(_0x5aa60c){return _0x5aa60c[_0xea8c('0x18')](_0x1f0fd4)[_0xea8c('0x19')](function(_0x1fadc9){return _0x1fadc9;});}return null;};}function removeEntity(_0x7daa71){return function(_0x56005d){if(_0x56005d){return _0x56005d[_0xea8c('0x1a')]()[_0xea8c('0x19')](function(){_0x7daa71['status'](0xcc)[_0xea8c('0x12')]();});}};}function handleEntityNotFound(_0x449f9a){return function(_0x192d5c){if(!_0x192d5c){_0x449f9a[_0xea8c('0x10')](0x194);}return _0x192d5c;};}function handleError(_0x3f8382,_0x4c5061){_0x4c5061=_0x4c5061||0x1f4;return function(_0x27246c){logger['error'](_0x27246c[_0xea8c('0x1b')]);if(_0x27246c[_0xea8c('0x1c')]){delete _0x27246c[_0xea8c('0x1c')];}_0x3f8382[_0xea8c('0x11')](_0x4c5061)[_0xea8c('0x1d')](_0x27246c);};}exports['index']=function(_0x2e1780,_0x37c0ce){var _0x2ba757={};var _0x1f3cd1=_[_0xea8c('0x1e')](db['SmsInteraction'][_0xea8c('0x1f')],function(_0x2cd4ca){return{'name':_0x2cd4ca[_0xea8c('0x20')],'type':_0x2cd4ca['type'][_0xea8c('0x21')]};});_0x2ba757=qs['getOptions'](_0x1f3cd1,_0x2e1780);return interaction[_0xea8c('0x22')](_0xea8c('0x23'),_0x2e1780[_0xea8c('0x24')],_0x2e1780[_0xea8c('0x25')],_0x2ba757,_0x1f3cd1)[_0xea8c('0x19')](respondWithFilteredResult(_0x37c0ce,_0x2ba757))['catch'](handleError(_0x37c0ce,null));};exports[_0xea8c('0x26')]=function(_0x1685bd,_0x1938e8){var _0x4801a9={'raw':![],'where':{'id':_0x1685bd[_0xea8c('0x27')]['id']}},_0x366f98={};_0x366f98[_0xea8c('0x28')]=_[_0xea8c('0x29')](db['SmsInteraction']['rawAttributes']);_0x366f98[_0xea8c('0x24')]=_[_0xea8c('0x29')](_0x1685bd[_0xea8c('0x24')]);_0x366f98[_0xea8c('0x2a')]=_['intersection'](_0x366f98[_0xea8c('0x28')],_0x366f98[_0xea8c('0x24')]);_0x4801a9['attributes']=_[_0xea8c('0x2b')](_0x366f98[_0xea8c('0x28')],qs[_0xea8c('0x2c')](_0x1685bd[_0xea8c('0x24')]['fields']));_0x4801a9[_0xea8c('0x2d')]=_0x4801a9[_0xea8c('0x2d')][_0xea8c('0x2e')]?_0x4801a9[_0xea8c('0x2d')]:_0x366f98[_0xea8c('0x28')];if(_0x1685bd[_0xea8c('0x24')][_0xea8c('0x2f')]){_0x4801a9[_0xea8c('0x30')]=[{'all':!![]}];}_0x4801a9=_['merge']({},_0x4801a9,_0x1685bd[_0xea8c('0x31')]);return db[_0xea8c('0x32')][_0xea8c('0x33')](_0x4801a9)[_0xea8c('0x19')](handleEntityNotFound(_0x1938e8,null))[_0xea8c('0x19')](respondWithResult(_0x1938e8,null))[_0xea8c('0x34')](handleError(_0x1938e8,null));};exports['create']=function(_0x59bd11,_0x26df24){return db['SmsInteraction'][_0xea8c('0x35')](_0x59bd11['body'],{})[_0xea8c('0x19')](respondWithResult(_0x26df24,0xc9))[_0xea8c('0x34')](handleError(_0x26df24,null));};exports[_0xea8c('0x18')]=function(_0x524908,_0xf3ea6){if(_0x524908[_0xea8c('0x36')]['id']){delete _0x524908['body']['id'];}return db['SmsInteraction'][_0xea8c('0x33')]({'where':{'id':_0x524908[_0xea8c('0x27')]['id']}})['then'](handleEntityNotFound(_0xf3ea6,null))[_0xea8c('0x19')](saveUpdates(_0x524908['body'],null))['then'](respondWithResult(_0xf3ea6,null))['catch'](handleError(_0xf3ea6,null));};exports[_0xea8c('0x1a')]=function(_0x4367bd,_0x342dac){return db[_0xea8c('0x32')]['find']({'where':{'id':_0x4367bd[_0xea8c('0x27')]['id']}})['then'](handleEntityNotFound(_0x342dac,null))[_0xea8c('0x19')](removeEntity(_0x342dac,null))[_0xea8c('0x34')](handleError(_0x342dac,null));};exports[_0xea8c('0x37')]=function(_0x2ec4a5,_0x219f5b){return db['SmsInteraction'][_0xea8c('0x37')]()[_0xea8c('0x19')](respondWithResult(_0x219f5b,null))['catch'](handleError(_0x219f5b,null));};exports['addMessage']=function(_0x24709c,_0x48ad3c){return db['SmsMessage'][_0xea8c('0x33')]({'where':{'id':_0x24709c[_0xea8c('0x27')]['id']}})[_0xea8c('0x19')](handleEntityNotFound(_0x48ad3c,null))[_0xea8c('0x19')](function(_0x472853){if(_0x472853){return _0x472853[_0xea8c('0x38')](_0x24709c[_0xea8c('0x36')][_0xea8c('0x39')],_[_0xea8c('0x3a')](_0x24709c[_0xea8c('0x36')],[_0xea8c('0x39'),'id'])||{});}})['then'](respondWithResult(_0x48ad3c,null))[_0xea8c('0x34')](handleError(_0x48ad3c,null));};exports[_0xea8c('0x3b')]=function(_0x21b51b,_0x40a68e){var _0x20f37c={'raw':![],'where':{}};var _0x1a2d79={};var _0x4d4ddf={'count':0x0,'rows':[]};return db[_0xea8c('0x32')][_0xea8c('0x3c')]({'where':{'id':_0x21b51b[_0xea8c('0x27')]['id']}})['then'](handleEntityNotFound(_0x40a68e,null))[_0xea8c('0x19')](function(_0xfdda3c){if(_0xfdda3c){_0x1a2d79[_0xea8c('0x28')]=_['keys'](db[_0xea8c('0x3d')][_0xea8c('0x1f')]);_0x1a2d79['query']=_[_0xea8c('0x29')](_0x21b51b[_0xea8c('0x24')]);_0x1a2d79['filters']=_[_0xea8c('0x2b')](_0x1a2d79[_0xea8c('0x28')],_0x1a2d79[_0xea8c('0x24')]);_0x20f37c[_0xea8c('0x2d')]=_[_0xea8c('0x2b')](_0x1a2d79[_0xea8c('0x28')],qs[_0xea8c('0x2c')](_0x21b51b[_0xea8c('0x24')]['fields']));_0x20f37c['attributes']=_0x20f37c[_0xea8c('0x2d')][_0xea8c('0x2e')]?_0x20f37c[_0xea8c('0x2d')]:_0x1a2d79['model'];if(!_0x21b51b[_0xea8c('0x24')][_0xea8c('0x3e')]('nolimit')){_0x20f37c[_0xea8c('0x14')]=qs[_0xea8c('0x14')](_0x21b51b[_0xea8c('0x24')]['limit']);_0x20f37c['offset']=qs[_0xea8c('0x16')](_0x21b51b['query']['offset']);}_0x20f37c['order']=qs['sort'](_0x21b51b['query'][_0xea8c('0x3f')]);_0x20f37c[_0xea8c('0x40')]=qs[_0xea8c('0x2a')](_[_0xea8c('0x41')](_0x21b51b[_0xea8c('0x24')],_0x1a2d79[_0xea8c('0x2a')]));_0x20f37c[_0xea8c('0x40')]['SmsInteractionId']=_0xfdda3c['id'];if(_0x21b51b[_0xea8c('0x24')][_0xea8c('0x42')]){_0x20f37c['where']=_['merge'](_0x20f37c[_0xea8c('0x40')],{'$or':_[_0xea8c('0x1e')](_0x20f37c[_0xea8c('0x2d')],function(_0x221513){var _0x36d42a={};_0x36d42a[_0x221513]={'$like':'%'+_0x21b51b[_0xea8c('0x24')]['filter']+'%'};return _0x36d42a;})});}if(_0x21b51b[_0xea8c('0x24')][_0xea8c('0x43')]){var _0x130dc1=_0x21b51b['query']['$gte'][_0xea8c('0x44')](',');var _0x500961={};_0x500961[_0x130dc1[0x0]]={'$gte':moment(_0x130dc1[0x1])[_0xea8c('0x45')](_0xea8c('0x46'))};_0x20f37c[_0xea8c('0x40')]=_[_0xea8c('0x47')](_0x20f37c[_0xea8c('0x40')],_0x500961);}_0x20f37c=_['merge']({},_0x20f37c,_0x21b51b[_0xea8c('0x31')]);return db[_0xea8c('0x3d')][_0xea8c('0x15')]({'where':_0x20f37c[_0xea8c('0x40')]})['then'](function(_0x1af0c8){_0x4d4ddf[_0xea8c('0x15')]=_0x1af0c8;if(_0x21b51b['query'][_0xea8c('0x2f')]){_0x20f37c[_0xea8c('0x30')]=[{'all':!![]}];}return db[_0xea8c('0x3d')]['findAll'](_0x20f37c);})['then'](function(_0x47d949){_0x4d4ddf[_0xea8c('0x48')]=_0x47d949;return _0x4d4ddf;});}})[_0xea8c('0x19')](respondWithFilteredResult(_0x40a68e,_0x20f37c))[_0xea8c('0x34')](handleError(_0x40a68e,null));};exports[_0xea8c('0x49')]=function(_0x5715b1,_0x531b51){return db[_0xea8c('0x32')][_0xea8c('0x33')]({'where':{'id':_0x5715b1[_0xea8c('0x27')]['id']}})['then'](handleEntityNotFound(_0x531b51,null))['then'](function(_0x1ccaeb){if(_0x1ccaeb){return _0x1ccaeb['setTags'](_0x5715b1[_0xea8c('0x36')][_0xea8c('0x39')],_[_0xea8c('0x3a')](_0x5715b1[_0xea8c('0x36')],[_0xea8c('0x39'),'id'])||{})['spread'](function(){return db[_0xea8c('0x4a')]['findAll']({'attributes':['id',_0xea8c('0x1c'),_0xea8c('0x4b')],'where':{'id':_0x5715b1[_0xea8c('0x36')]['ids']}});})[_0xea8c('0x19')](function(_0x227da0){socket['emit'](_0xea8c('0x4c'),{'id':Number(_0x5715b1[_0xea8c('0x27')]['id']),'tags':_0x227da0||[]});return{'id':Number(_0x5715b1[_0xea8c('0x27')]['id']),'tags':_0x227da0||[]};});}})['then'](respondWithResult(_0x531b51,null))[_0xea8c('0x34')](handleError(_0x531b51,null));};exports[_0xea8c('0x4d')]=function(_0x35eece,_0x252c03){return db[_0xea8c('0x32')][_0xea8c('0x33')]({'where':{'id':_0x35eece[_0xea8c('0x27')]['id']}})[_0xea8c('0x19')](handleEntityNotFound(_0x252c03,null))[_0xea8c('0x19')](function(_0x200b27){if(_0x200b27){return _0x200b27[_0xea8c('0x4d')](_0x35eece['query']['ids']);}})[_0xea8c('0x19')](respondWithStatusCode(_0x252c03,null))[_0xea8c('0x34')](handleError(_0x252c03,null));};exports[_0xea8c('0x4e')]=function(_0x1c4c6b,_0x16b6d6){var _0xf1335d=moment()[_0xea8c('0x4f')]()[_0xea8c('0x50')]();var _0x18baf9=path['join'](config[_0xea8c('0x51')],'server','files','tmp');var _0xfe64c0=path[_0xea8c('0x52')](_0x18baf9,_0xf1335d);var _0x3f6aef=util[_0xea8c('0x45')]('transcript-%d-%s.zip',_0x1c4c6b[_0xea8c('0x27')]['id'],_0xf1335d);var _0x7ad4d3=path[_0xea8c('0x52')](_0x18baf9,_0x3f6aef);var _0x21104a=[];_0x21104a[_0xea8c('0x53')]({'model':db[_0xea8c('0x54')],'as':_0xea8c('0x54'),'attributes':['id',_0xea8c('0x55')],'raw':!![]});_0x21104a[_0xea8c('0x53')]({'model':db[_0xea8c('0x56')],'as':_0xea8c('0x57'),'attributes':['id','firstName',_0xea8c('0x58')],'raw':!![]});var _0x4be23e=[{'model':db[_0xea8c('0x3d')],'as':'Messages','attributes':['id',_0xea8c('0x36'),_0xea8c('0x59'),_0xea8c('0x5a'),_0xea8c('0x5b'),_0xea8c('0x5c')],'include':_0x21104a}];_0x4be23e['push']({'model':db[_0xea8c('0x5d')],'as':_0xea8c('0x5e'),'attributes':['id','name']});_0x4be23e['push']({'model':db[_0xea8c('0x54')],'as':_0xea8c('0x5f'),'attributes':['id','fullname']});return db[_0xea8c('0x32')][_0xea8c('0x33')]({'where':{'id':_0x1c4c6b['params']['id']},'include':_0x4be23e})[_0xea8c('0x19')](handleEntityNotFound(_0x16b6d6,null))[_0xea8c('0x19')](function(_0x38473b){if(_0x38473b){var _0x42fb93=_0x38473b[_0xea8c('0x60')]({'plain':!![]});fs[_0xea8c('0x61')](_0xfe64c0);var _0x24108d={'channel':_0xea8c('0x62'),'account':_0x42fb93['Account'][_0xea8c('0x1c')],'agent':_0x42fb93[_0xea8c('0x5f')]?_0x42fb93[_0xea8c('0x5f')]['fullname']:_0xea8c('0x63'),'createdAt':moment(_0x42fb93[_0xea8c('0x59')])[_0xea8c('0x45')](_0xea8c('0x46'))[_0xea8c('0x50')](),'closedAt':_0x42fb93[_0xea8c('0x64')]?moment(_0x42fb93[_0xea8c('0x65')])[_0xea8c('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xea8c('0x50')]():'','disposition':_0x42fb93['disposition'],'messages':_(_0x42fb93['Messages'])[_0xea8c('0x42')]({'secret':![]})[_0xea8c('0x1e')](function(_0x283318){return{'date':moment(_0x283318['createdAt'])[_0xea8c('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0xea8c('0x50')](),'sender':_0x283318[_0xea8c('0x5a')]===_0xea8c('0x66')?_0x283318[_0xea8c('0x54')]?_0x283318[_0xea8c('0x54')][_0xea8c('0x55')]:'System':_0x283318[_0xea8c('0x57')][_0xea8c('0x67')]+(_0x283318[_0xea8c('0x57')]['lastName']?'\x20'+_0x283318['Contact'][_0xea8c('0x58')]:''),'body':_0x283318['body'],'direction':_0x283318['direction']===_0xea8c('0x66')?'A':'C','secret':_0x283318['secret'],'read':_0x283318['read']};})[_0xea8c('0x68')]()};return ejs[_0xea8c('0x69')](path[_0xea8c('0x52')](config[_0xea8c('0x51')],_0xea8c('0x6a'),_0xea8c('0x6b'),_0xea8c('0x6c')),{'interaction':_0x24108d})[_0xea8c('0x19')](function(_0x13d610){var _0x172f90=path[_0xea8c('0x52')](_0xfe64c0,_0xea8c('0x6d')+_0x42fb93['id']+'-'+_0xf1335d+_0xea8c('0x6e'));var _0x3a067f={'path':_0x172f90,'channel':_0xea8c('0x62'),'interactionId':_0x42fb93['id']};return pdf[_0xea8c('0x6f')](_0x13d610,_0x3a067f);})['then'](function(){return new BPromise(function(_0x453bd2,_0x6aee38){zipdir(_0xfe64c0,{'saveTo':_0x7ad4d3},function(_0xee2ad3,_0x4bf97d){if(_0xee2ad3)return _0x6aee38(_0xee2ad3);return _0x453bd2(_0x4bf97d);});})['then'](function(){return new BPromise(function(_0x18ef3d,_0x1070b7){rimraf(_0xfe64c0,function(_0x5725e6){if(_0x5725e6)_0x1070b7(_0x5725e6);return _0x18ef3d();});});})[_0xea8c('0x19')](function(){return _0x16b6d6['download'](_0x7ad4d3,_0x3f6aef,function(_0x560614){if(_0x560614){console[_0xea8c('0x70')](_0xea8c('0x71'),_0x560614);}else{fs[_0xea8c('0x72')](_0x7ad4d3);}});});});}else{return _0x16b6d6[_0xea8c('0x10')](0xc8);}})[_0xea8c('0x34')](handleError(_0x16b6d6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 383a19f..66b3610 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 _0xc2c7=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then'];(function(_0x48c075,_0xe53b){var _0xddc51a=function(_0x1dadc7){while(--_0x1dadc7){_0x48c075['push'](_0x48c075['shift']());}};_0xddc51a(++_0xe53b);}(_0xc2c7,0x134));var _0x7c2c=function(_0x430863,_0x5a7bde){_0x430863=_0x430863-0x0;var _0x4ea983=_0xc2c7[_0x430863];return _0x4ea983;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x1')];var SmsMessage=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7c2c('0x3')](0x0);var events={'afterCreate':_0x7c2c('0x4'),'afterUpdate':_0x7c2c('0x5'),'afterDestroy':_0x7c2c('0x6')};function emitEvent(_0x4bbc14){return function(_0x59f346,_0x31dc4e,_0x42ecc9){_0x59f346[_0x7c2c('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4abe93){_0x59f346['setDataValue'](_0x7c2c('0x8'),_0x4abe93[_0x7c2c('0x9')](function(_0x3e668f){return{'id':_0x3e668f['id']};}));return SmsMessage[_0x7c2c('0xa')]({'where':{'SmsInteractionId':_0x59f346['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c2c('0xb')](function(_0x57b107){_0x59f346[_0x7c2c('0xc')](_0x7c2c('0xd'),_0x57b107[_0x7c2c('0xe')]);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14+':'+_0x59f346['id'],_0x59f346);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14,_0x59f346);_0x42ecc9(null);})[_0x7c2c('0x10')](_0x42ecc9(null));};}for(var e in events){if(events[_0x7c2c('0x11')](e)){var event=events[e];SmsInteraction[_0x7c2c('0x12')](e,emitEvent(event));}}module[_0x7c2c('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0x6d11=['../../mysqldb','SmsInteraction','SmsMessage','save','update','getUsers','then','setDataValue','findAll','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x31bc7b,_0x1f5b9c){var _0x19a939=function(_0x4516f4){while(--_0x4516f4){_0x31bc7b['push'](_0x31bc7b['shift']());}};_0x19a939(++_0x1f5b9c);}(_0x6d11,0xbf));var _0x16d1=function(_0x15872f,_0x574f38){_0x15872f=_0x15872f-0x0;var _0x3dc290=_0x6d11[_0x15872f];return _0x3dc290;};'use strict';var EventEmitter=require(_0x16d1('0x0'));var SmsInteraction=require(_0x16d1('0x1'))['db'][_0x16d1('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x16d1('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16d1('0x4'),'afterUpdate':_0x16d1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48754e){return function(_0x3e0e86,_0x46f7d7,_0x3eb9e2){_0x3e0e86[_0x16d1('0x6')]({'attributes':['id'],'raw':!![]})[_0x16d1('0x7')](function(_0x150217){_0x3e0e86[_0x16d1('0x8')]('Users',_0x150217['map'](function(_0x4fca47){return{'id':_0x4fca47['id']};}));return SmsMessage[_0x16d1('0x9')]({'where':{'SmsInteractionId':_0x3e0e86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16d1('0x7')](function(_0xe67758){_0x3e0e86[_0x16d1('0x8')]('unreadMessages',_0xe67758[_0x16d1('0xa')]);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e+':'+_0x3e0e86['id'],_0x3e0e86);SmsInteractionEvents[_0x16d1('0xb')](_0x48754e,_0x3e0e86);_0x3eb9e2(null);})[_0x16d1('0xc')](_0x3eb9e2(null));};}for(var e in events){if(events[_0x16d1('0xd')](e)){var event=events[e];SmsInteraction[_0x16d1('0xe')](e,emitEvent(event));}}module[_0x16d1('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 764b6fe..b78003b 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 _0xd5c4=['define','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x5cdfd0,_0x5422f8){var _0x8d441d=function(_0x3f22d5){while(--_0x3f22d5){_0x5cdfd0['push'](_0x5cdfd0['shift']());}};_0x8d441d(++_0x5422f8);}(_0xd5c4,0x186));var _0x4d5c=function(_0xc0d6dd,_0x5f1e94){_0xc0d6dd=_0xc0d6dd-0x0;var _0x1c1daf=_0xd5c4[_0xc0d6dd];return _0x1c1daf;};'use strict';var _=require('lodash');var util=require(_0x4d5c('0x0'));var logger=require(_0x4d5c('0x1'))(_0x4d5c('0x2'));var moment=require('moment');var BPromise=require(_0x4d5c('0x3'));var rp=require(_0x4d5c('0x4'));var fs=require('fs');var path=require(_0x4d5c('0x5'));var rimraf=require(_0x4d5c('0x6'));var config=require(_0x4d5c('0x7'));var attributes=require(_0x4d5c('0x8'));module[_0x4d5c('0x9')]=function(_0x429f40,_0x1f8790){return _0x429f40[_0x4d5c('0xa')](_0x4d5c('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19e9ef,_0x2534df,_0x5ba933){if(_0x19e9ef['changed'](_0x4d5c('0xc'))){_0x19e9ef[_0x4d5c('0xd')]=moment()[_0x4d5c('0xe')](_0x4d5c('0xf'));}_0x5ba933(null,_0x19e9ef);}}});}; \ No newline at end of file +var _0xf930=['../../config/environment','./smsInteraction.attributes','define','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x297288,_0x56a579){var _0x559a18=function(_0xe47208){while(--_0xe47208){_0x297288['push'](_0x297288['shift']());}};_0x559a18(++_0x56a579);}(_0xf930,0xb8));var _0x0f93=function(_0x2c259a,_0x26e290){_0x2c259a=_0x2c259a-0x0;var _0x31e280=_0xf930[_0x2c259a];return _0x31e280;};'use strict';var _=require(_0x0f93('0x0'));var util=require(_0x0f93('0x1'));var logger=require(_0x0f93('0x2'))(_0x0f93('0x3'));var moment=require(_0x0f93('0x4'));var BPromise=require(_0x0f93('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f93('0x6'));var rimraf=require(_0x0f93('0x7'));var config=require(_0x0f93('0x8'));var attributes=require(_0x0f93('0x9'));module['exports']=function(_0x334ff5,_0x249a27){return _0x334ff5[_0x0f93('0xa')]('SmsInteraction',attributes,{'tableName':_0x0f93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc7d4ba,_0x35b426,_0x4d1a6){if(_0xc7d4ba['changed'](_0x0f93('0xc'))){_0xc7d4ba[_0x0f93('0xd')]=moment()[_0x0f93('0xe')](_0x0f93('0xf'));}_0x4d1a6(null,_0xc7d4ba);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b38ade6..d4bd6f8 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 _0xf070=['../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./smsInteraction.socket','register','request','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','SmsInteraction','update','body','options','raw','where','attributes','then','UpdateSmsInteraction','AddTagsToSmsInteraction','find','ids','omit','AddTags','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0xf64e53,_0x4db24b){var _0x1e185e=function(_0x451dc3){while(--_0x451dc3){_0xf64e53['push'](_0xf64e53['shift']());}};_0x1e185e(++_0x4db24b);}(_0xf070,0x15a));var _0x0f07=function(_0x6fddb0,_0x35099b){_0x6fddb0=_0x6fddb0-0x0;var _0x456f86=_0xf070[_0x6fddb0];return _0x456f86;};'use strict';var _=require(_0x0f07('0x0'));var util=require(_0x0f07('0x1'));var moment=require('moment');var BPromise=require(_0x0f07('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f07('0x3'));var db=require(_0x0f07('0x4'))['db'];var utils=require(_0x0f07('0x5'));var logger=require(_0x0f07('0x6'))(_0x0f07('0x7'));var config=require('../../config/environment');var jayson=require(_0x0f07('0x8'));var client=jayson['client'][_0x0f07('0x9')]({'port':0x232a});config[_0x0f07('0xa')]=_[_0x0f07('0xb')](config[_0x0f07('0xa')],{'host':_0x0f07('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f07('0xa')]));require(_0x0f07('0xd'))[_0x0f07('0xe')](socket);function respondWithRpcPromise(_0x1c011f,_0x2d301a,_0x59f9b1){return new BPromise(function(_0x49458b,_0x36d724){return client[_0x0f07('0xf')](_0x1c011f,_0x59f9b1)['then'](function(_0x5d48db){logger[_0x0f07('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x2d301a,'request\x20sent');logger[_0x0f07('0x11')](_0x0f07('0x12'),_0x2d301a,'request\x20sent',JSON[_0x0f07('0x13')](_0x5d48db));if(_0x5d48db['error']){if(_0x5d48db[_0x0f07('0x14')][_0x0f07('0x15')]===0x1f4){logger[_0x0f07('0x14')](_0x0f07('0x16'),_0x2d301a,_0x5d48db['error'][_0x0f07('0x17')]);return _0x36d724(_0x5d48db[_0x0f07('0x14')][_0x0f07('0x17')]);}logger[_0x0f07('0x14')](_0x0f07('0x16'),_0x2d301a,_0x5d48db[_0x0f07('0x14')][_0x0f07('0x17')]);return _0x49458b(_0x5d48db[_0x0f07('0x14')]['message']);}else{logger[_0x0f07('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x2d301a,'request\x20sent');_0x49458b(_0x5d48db['result'][_0x0f07('0x17')]);}})[_0x0f07('0x18')](function(_0xf8a39d){logger[_0x0f07('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2d301a,_0xf8a39d);_0x36d724(_0xf8a39d);});});}exports['UpdateSmsInteraction']=function(_0x5ba45a){var _0x507f8b=this;return new Promise(function(_0x47f38e,_0x15d338){return db[_0x0f07('0x19')][_0x0f07('0x1a')](_0x5ba45a[_0x0f07('0x1b')],{'raw':_0x5ba45a['options']?_0x5ba45a[_0x0f07('0x1c')][_0x0f07('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba45a[_0x0f07('0x1c')]?_0x5ba45a['options'][_0x0f07('0x1e')]||null:null,'attributes':_0x5ba45a[_0x0f07('0x1c')]?_0x5ba45a[_0x0f07('0x1c')][_0x0f07('0x1f')]||null:null,'limit':_0x5ba45a[_0x0f07('0x1c')]?_0x5ba45a[_0x0f07('0x1c')]['limit']||null:null})[_0x0f07('0x20')](function(_0x1cab9f){logger['info']('UpdateSmsInteraction',_0x5ba45a);logger['debug'](_0x0f07('0x21'),_0x5ba45a,JSON[_0x0f07('0x13')](_0x1cab9f));_0x47f38e(_0x1cab9f);})['catch'](function(_0x372d67){logger[_0x0f07('0x14')](_0x0f07('0x21'),_0x372d67[_0x0f07('0x17')],_0x5ba45a);_0x15d338(_0x507f8b[_0x0f07('0x14')](0x1f4,_0x372d67[_0x0f07('0x17')]));});});};exports[_0x0f07('0x22')]=function(_0x26bba5){return new Promise(function(_0x1791b4,_0x433b71){return db[_0x0f07('0x19')][_0x0f07('0x23')]({'where':_0x26bba5[_0x0f07('0x1c')]?_0x26bba5[_0x0f07('0x1c')][_0x0f07('0x1e')]||null:null})[_0x0f07('0x20')](function(_0x4b0d85){if(_0x4b0d85){return _0x4b0d85['addTags'](_0x26bba5[_0x0f07('0x1b')][_0x0f07('0x24')],_[_0x0f07('0x25')](_0x26bba5[_0x0f07('0x1b')],['ids','id'])||{});}})['spread'](function(_0x39cd42){logger['info']('AddTags',_0x26bba5);logger[_0x0f07('0x11')](_0x0f07('0x26'),_0x26bba5,JSON[_0x0f07('0x13')](_0x39cd42));_0x1791b4(_0x39cd42);})['catch'](function(_0x4cb8e2){logger[_0x0f07('0x14')](_0x0f07('0x26'),_0x4cb8e2[_0x0f07('0x17')],_0x26bba5);_0x433b71(_this[_0x0f07('0x14')](0x1f4,_0x4cb8e2[_0x0f07('0x17')]));});});}; \ No newline at end of file +var _0x6283=['error','code','message','result','catch','SmsInteraction','update','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','spread','AddTags','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x6283,0xb7));var _0x3628=function(_0x32623f,_0x253139){_0x32623f=_0x32623f-0x0;var _0x101f4d=_0x6283[_0x32623f];return _0x101f4d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3628('0x0'));var BPromise=require(_0x3628('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3628('0x2'))['db'];var utils=require(_0x3628('0x3'));var logger=require(_0x3628('0x4'))(_0x3628('0x5'));var config=require(_0x3628('0x6'));var jayson=require(_0x3628('0x7'));var client=jayson[_0x3628('0x8')][_0x3628('0x9')]({'port':0x232a});config['redis']=_[_0x3628('0xa')](config[_0x3628('0xb')],{'host':_0x3628('0xc'),'port':0x18eb});var socket=require(_0x3628('0xd'))(new Redis(config['redis']));require(_0x3628('0xe'))['register'](socket);function respondWithRpcPromise(_0x275d05,_0x3bc25d,_0x1947ae){return new BPromise(function(_0x1d3965,_0x520b18){return client[_0x3628('0xf')](_0x275d05,_0x1947ae)[_0x3628('0x10')](function(_0x22b651){logger[_0x3628('0x11')](_0x3628('0x12'),_0x3bc25d,'request\x20sent');logger[_0x3628('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3bc25d,_0x3628('0x14'),JSON[_0x3628('0x15')](_0x22b651));if(_0x22b651[_0x3628('0x16')]){if(_0x22b651['error'][_0x3628('0x17')]===0x1f4){logger[_0x3628('0x16')](_0x3628('0x12'),_0x3bc25d,_0x22b651['error'][_0x3628('0x18')]);return _0x520b18(_0x22b651[_0x3628('0x16')][_0x3628('0x18')]);}logger[_0x3628('0x16')](_0x3628('0x12'),_0x3bc25d,_0x22b651[_0x3628('0x16')]['message']);return _0x1d3965(_0x22b651[_0x3628('0x16')][_0x3628('0x18')]);}else{logger[_0x3628('0x11')](_0x3628('0x12'),_0x3bc25d,_0x3628('0x14'));_0x1d3965(_0x22b651[_0x3628('0x19')][_0x3628('0x18')]);}})[_0x3628('0x1a')](function(_0x19174f){logger[_0x3628('0x16')](_0x3628('0x12'),_0x3bc25d,_0x19174f);_0x520b18(_0x19174f);});});}exports['UpdateSmsInteraction']=function(_0x1e96bc){var _0x5aad62=this;return new Promise(function(_0x5ec3ed,_0x3a6bc5){return db[_0x3628('0x1b')][_0x3628('0x1c')](_0x1e96bc['body'],{'raw':_0x1e96bc[_0x3628('0x1d')]?_0x1e96bc['options'][_0x3628('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e96bc[_0x3628('0x1d')]?_0x1e96bc[_0x3628('0x1d')][_0x3628('0x1f')]||null:null,'attributes':_0x1e96bc[_0x3628('0x1d')]?_0x1e96bc['options']['attributes']||null:null,'limit':_0x1e96bc[_0x3628('0x1d')]?_0x1e96bc[_0x3628('0x1d')][_0x3628('0x20')]||null:null})[_0x3628('0x10')](function(_0x39bae8){logger[_0x3628('0x11')](_0x3628('0x21'),_0x1e96bc);logger['debug']('UpdateSmsInteraction',_0x1e96bc,JSON[_0x3628('0x15')](_0x39bae8));_0x5ec3ed(_0x39bae8);})[_0x3628('0x1a')](function(_0x2b7c97){logger[_0x3628('0x16')](_0x3628('0x21'),_0x2b7c97[_0x3628('0x18')],_0x1e96bc);_0x3a6bc5(_0x5aad62[_0x3628('0x16')](0x1f4,_0x2b7c97[_0x3628('0x18')]));});});};exports[_0x3628('0x22')]=function(_0x4d7479){return new Promise(function(_0x228ab1,_0x2ae254){return db[_0x3628('0x1b')][_0x3628('0x23')]({'where':_0x4d7479[_0x3628('0x1d')]?_0x4d7479[_0x3628('0x1d')][_0x3628('0x1f')]||null:null})['then'](function(_0x27e1c4){if(_0x27e1c4){return _0x27e1c4[_0x3628('0x24')](_0x4d7479[_0x3628('0x25')]['ids'],_['omit'](_0x4d7479[_0x3628('0x25')],[_0x3628('0x26'),'id'])||{});}})[_0x3628('0x27')](function(_0x181df1){logger['info']('AddTags',_0x4d7479);logger[_0x3628('0x13')](_0x3628('0x28'),_0x4d7479,JSON[_0x3628('0x15')](_0x181df1));_0x228ab1(_0x181df1);})[_0x3628('0x1a')](function(_0x2ff248){logger[_0x3628('0x16')](_0x3628('0x28'),_0x2ff248['message'],_0x4d7479);_0x2ae254(_this[_0x3628('0x16')](0x1f4,_0x2ff248[_0x3628('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3586752..b4c8fe0 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 _0x0330=['length','smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener','register'];(function(_0x1c27c7,_0xb18eac){var _0xf02be6=function(_0x32927d){while(--_0x32927d){_0x1c27c7['push'](_0x1c27c7['shift']());}};_0xf02be6(++_0xb18eac);}(_0x0330,0x112));var _0x0033=function(_0x385b93,_0x1c9942){_0x385b93=_0x385b93-0x0;var _0x5d581b=_0x0330[_0x385b93];return _0x5d581b;};'use strict';var SmsInteractionEvents=require(_0x0033('0x0'));var events=[_0x0033('0x1'),_0x0033('0x2'),'update'];function createListener(_0x20d263,_0xd4b9cc){return function(_0x3c2563){_0xd4b9cc[_0x0033('0x3')](_0x20d263,_0x3c2563);};}function removeListener(_0xdda3a1,_0x566a95){return function(){SmsInteractionEvents[_0x0033('0x4')](_0xdda3a1,_0x566a95);};}exports[_0x0033('0x5')]=function(_0x4b060c){for(var _0x307b26=0x0,_0x15e28d=events[_0x0033('0x6')];_0x307b26<_0x15e28d;_0x307b26++){var _0x427067=events[_0x307b26];var _0x36b7d6=createListener(_0x0033('0x7')+_0x427067,_0x4b060c);SmsInteractionEvents['on'](_0x427067,_0x36b7d6);}}; \ No newline at end of file +var _0xbcb2=['emit','removeListener','register','save','update'];(function(_0x2bce36,_0x46cd3a){var _0x55c839=function(_0x73d613){while(--_0x73d613){_0x2bce36['push'](_0x2bce36['shift']());}};_0x55c839(++_0x46cd3a);}(_0xbcb2,0x1c0));var _0x2bcb=function(_0x1d05dc,_0x85cfc8){_0x1d05dc=_0x1d05dc-0x0;var _0xfa8b80=_0xbcb2[_0x1d05dc];return _0xfa8b80;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2bcb('0x0'),'remove',_0x2bcb('0x1')];function createListener(_0x3cd0a6,_0x16718d){return function(_0x445c77){_0x16718d[_0x2bcb('0x2')](_0x3cd0a6,_0x445c77);};}function removeListener(_0x182faa,_0x863f34){return function(){SmsInteractionEvents[_0x2bcb('0x3')](_0x182faa,_0x863f34);};}exports[_0x2bcb('0x4')]=function(_0x210dc2){for(var _0xc634b3=0x0,_0x2b7b25=events['length'];_0xc634b3<_0x2b7b25;_0xc634b3++){var _0x9d2054=events[_0xc634b3];var _0x47199f=createListener('smsInteraction:'+_0x9d2054,_0x210dc2);SmsInteractionEvents['on'](_0x9d2054,_0x47199f);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index adb1559..4eab60b 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 _0x8dae=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','smsmessage:create','create','/:id/status','status','update','/:id/reject','reject','destroy','exports','multer'];(function(_0x495779,_0x52a650){var _0x47ea19=function(_0x2d6b01){while(--_0x2d6b01){_0x495779['push'](_0x495779['shift']());}};_0x47ea19(++_0x52a650);}(_0x8dae,0xa7));var _0xe8da=function(_0xd9a55e,_0x3841a7){_0xd9a55e=_0xd9a55e-0x0;var _0x1345b1=_0x8dae[_0xd9a55e];return _0x1345b1;};'use strict';var multer=require(_0xe8da('0x0'));var util=require('util');var path=require(_0xe8da('0x1'));var timeout=require(_0xe8da('0x2'));var express=require(_0xe8da('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8da('0x4'));var interaction=require(_0xe8da('0x5'));var config=require(_0xe8da('0x6'));var controller=require('./smsMessage.controller');router[_0xe8da('0x7')]('/',auth[_0xe8da('0x8')](),controller[_0xe8da('0x9')]);router[_0xe8da('0x7')](_0xe8da('0xa'),auth[_0xe8da('0x8')](),controller[_0xe8da('0xb')]);router['get'](_0xe8da('0xc'),auth['isAuthenticated'](),controller[_0xe8da('0xd')]);router[_0xe8da('0xe')]('/',auth[_0xe8da('0x8')](),interaction['tracked']('sms',_0xe8da('0xf')),controller[_0xe8da('0x10')]);router[_0xe8da('0xe')](_0xe8da('0x11'),controller[_0xe8da('0x12')]);router['put']('/:id',auth[_0xe8da('0x8')](),controller[_0xe8da('0x13')]);router['put']('/:id/accept',auth[_0xe8da('0x8')](),controller['accept']);router['put'](_0xe8da('0x14'),auth['isAuthenticated'](),controller[_0xe8da('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe8da('0x16')]);module[_0xe8da('0x17')]=router; \ No newline at end of file +var _0x4aab=['../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','isAuthenticated','describe','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','fs-extra'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x4aab,0xcd));var _0xb4aa=function(_0x4911de,_0x3bbc4f){_0x4911de=_0x4911de-0x0;var _0x5b0a99=_0x4aab[_0x4911de];return _0x5b0a99;};'use strict';var multer=require('multer');var util=require(_0xb4aa('0x0'));var path=require('path');var timeout=require(_0xb4aa('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb4aa('0x2'));var auth=require(_0xb4aa('0x3'));var interaction=require(_0xb4aa('0x4'));var config=require('../../config/environment');var controller=require(_0xb4aa('0x5'));router[_0xb4aa('0x6')]('/',auth['isAuthenticated'](),controller[_0xb4aa('0x7')]);router[_0xb4aa('0x6')]('/describe',auth[_0xb4aa('0x8')](),controller[_0xb4aa('0x9')]);router[_0xb4aa('0x6')]('/:id',auth[_0xb4aa('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xb4aa('0xa')](_0xb4aa('0xb'),_0xb4aa('0xc')),controller[_0xb4aa('0xd')]);router['post'](_0xb4aa('0xe'),controller[_0xb4aa('0xf')]);router[_0xb4aa('0x10')](_0xb4aa('0x11'),auth['isAuthenticated'](),controller[_0xb4aa('0x12')]);router[_0xb4aa('0x10')](_0xb4aa('0x13'),auth[_0xb4aa('0x8')](),controller[_0xb4aa('0x14')]);router[_0xb4aa('0x10')](_0xb4aa('0x15'),auth[_0xb4aa('0x8')](),controller[_0xb4aa('0x16')]);router[_0xb4aa('0x17')]('/:id',auth[_0xb4aa('0x8')](),controller[_0xb4aa('0x18')]);module[_0xb4aa('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2720e5e..9153004 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 _0x2c79=['TEXT','medium','ENUM','out','STRING','DATE','sequelize'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x2c79,0x164));var _0x92c7=function(_0x265343,_0x2bdb33){_0x265343=_0x265343-0x0;var _0x5d088c=_0x2c79[_0x265343];return _0x5d088c;};'use strict';var Sequelize=require(_0x92c7('0x0'));module['exports']={'body':{'type':Sequelize[_0x92c7('0x1')](_0x92c7('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x92c7('0x3')]('in','out'),'defaultValue':_0x92c7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x92c7('0x5')]},'readAt':{'type':Sequelize[_0x92c7('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x92c7('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4fba=['BOOLEAN','ENUM','out','STRING','sequelize','medium'];(function(_0x51b8e0,_0x3a2475){var _0x2689c5=function(_0x39905f){while(--_0x39905f){_0x51b8e0['push'](_0x51b8e0['shift']());}};_0x2689c5(++_0x3a2475);}(_0x4fba,0x11e));var _0xa4fb=function(_0x2f318b,_0x484cc4){_0x2f318b=_0x2f318b-0x0;var _0x1e66fd=_0x4fba[_0x2f318b];return _0x1e66fd;};'use strict';var Sequelize=require(_0xa4fb('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xa4fb('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xa4fb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa4fb('0x3')]('in',_0xa4fb('0x4')),'defaultValue':_0xa4fb('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa4fb('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa4fb('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa4fb('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa4fb('0x5')]},'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 0f4170f..d16930d 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 _0x85ed=['options','includeAll','findAll','rows','show','params','find','create','body','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','update','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','SmsInteractionId','interaction','RejectMessage','rejectMessage','ContactId','Sequelize','User','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','groupName','DELIVERED','eml-format','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','name','send','index','map','SmsMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x85ed,0x1e7));var _0xd85e=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x85ed[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0xd85e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd85e('0x1'));var moment=require(_0xd85e('0x2'));var BPromise=require(_0xd85e('0x3'));var Mustache=require(_0xd85e('0x4'));var util=require(_0xd85e('0x5'));var path=require('path');var sox=require(_0xd85e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd85e('0x7'));var squel=require(_0xd85e('0x8'));var crypto=require(_0xd85e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd85e('0xa'));var querystring=require(_0xd85e('0xb'));var Papa=require(_0xd85e('0xc'));var Redis=require(_0xd85e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd85e('0xe'));var as=require(_0xd85e('0xf'));var hardwareService=require(_0xd85e('0x10'));var logger=require(_0xd85e('0x11'))(_0xd85e('0x12'));var utils=require(_0xd85e('0x13'));var config=require(_0xd85e('0x14'));var licenseUtil=require(_0xd85e('0x15'));var db=require(_0xd85e('0x16'))['db'];config[_0xd85e('0x17')]=_[_0xd85e('0x18')](config['redis'],{'host':_0xd85e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd85e('0x1a'))['register'](socket);var jayson=require(_0xd85e('0x1b'));var client=jayson[_0xd85e('0x1c')][_0xd85e('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xd85e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xc59173,_0x4df40d,_0x39acb2,_0x447cd5){return new BPromise(function(_0x125f60,_0xccc81f){var _0x3750be=_0x447cd5||client;return _0x3750be[_0xd85e('0x1e')](_0xc59173,_0x39acb2)[_0xd85e('0x1f')](function(_0x12fbf1){logger['info']('SmsMessage,\x20%s,\x20%s',_0x4df40d,_0xd85e('0x20'));logger[_0xd85e('0x21')](_0xd85e('0x22'),_0x4df40d,_0xd85e('0x20'),JSON[_0xd85e('0x23')](_0x12fbf1));if(_0x12fbf1[_0xd85e('0x24')]){if(_0x12fbf1[_0xd85e('0x24')]['code']===0x1f4){logger[_0xd85e('0x24')](_0xd85e('0x25'),_0x4df40d,_0x12fbf1[_0xd85e('0x24')][_0xd85e('0x26')]);return _0xccc81f(_0x12fbf1[_0xd85e('0x24')][_0xd85e('0x26')]);}logger[_0xd85e('0x24')]('SmsMessage,\x20%s,\x20%s',_0x4df40d,_0x12fbf1[_0xd85e('0x24')][_0xd85e('0x26')]);return _0x125f60(_0x12fbf1[_0xd85e('0x24')]['message']);}else{logger[_0xd85e('0x27')]('SmsMessage,\x20%s,\x20%s',_0x4df40d,'request\x20sent');_0x125f60(_0x12fbf1[_0xd85e('0x28')][_0xd85e('0x26')]);}})[_0xd85e('0x29')](function(_0x45baa9){logger[_0xd85e('0x24')](_0xd85e('0x25'),_0x4df40d,_0x45baa9);_0xccc81f(_0x45baa9);});});}function respondWithStatusCode(_0x1c81d9,_0xa92c43){_0xa92c43=_0xa92c43||0xcc;return function(_0x12f40d){if(_0x12f40d){return _0x1c81d9[_0xd85e('0x2a')](_0xa92c43);}return _0x1c81d9['status'](_0xa92c43)[_0xd85e('0x2b')]();};}function respondWithResult(_0x24aeaf,_0x412d45){_0x412d45=_0x412d45||0xc8;return function(_0x28aab4){if(_0x28aab4){return _0x24aeaf[_0xd85e('0x2c')](_0x412d45)[_0xd85e('0x2d')](_0x28aab4);}};}function respondWithFilteredResult(_0x461413,_0x3b9d0c){return function(_0x336e9e){if(_0x336e9e){var _0x12e820=typeof _0x3b9d0c[_0xd85e('0x2e')]==='undefined'&&typeof _0x3b9d0c[_0xd85e('0x2f')]==='undefined';var _0x417229=_0x336e9e['count'];var _0x1ab657=_0x12e820?0x0:_0x3b9d0c['offset'];var _0x1537d1=_0x12e820?_0x336e9e[_0xd85e('0x30')]:_0x3b9d0c[_0xd85e('0x2e')]+_0x3b9d0c[_0xd85e('0x2f')];var _0x3835e7;if(_0x1537d1>=_0x417229){_0x1537d1=_0x417229;_0x3835e7=0xc8;}else{_0x3835e7=0xce;}_0x461413[_0xd85e('0x2c')](_0x3835e7);return _0x461413[_0xd85e('0x31')](_0xd85e('0x32'),_0x1ab657+'-'+_0x1537d1+'/'+_0x417229)['json'](_0x336e9e);}return null;};}function patchUpdates(_0x80c368){return function(_0x3ac3a4){try{jsonpatch[_0xd85e('0x33')](_0x3ac3a4,_0x80c368,!![]);}catch(_0x52aa96){return BPromise[_0xd85e('0x34')](_0x52aa96);}return _0x3ac3a4[_0xd85e('0x35')]();};}function saveUpdates(_0x5d1f1a,_0xd50baf){return function(_0x266a8e){if(_0x266a8e){return _0x266a8e['update'](_0x5d1f1a)[_0xd85e('0x1f')](function(_0x4b8201){return _0x4b8201;});}return null;};}function removeEntity(_0x49c0f0,_0x249651){return function(_0x366e4d){if(_0x366e4d){return _0x366e4d[_0xd85e('0x36')]()[_0xd85e('0x1f')](function(){_0x49c0f0[_0xd85e('0x2c')](0xcc)[_0xd85e('0x2b')]();});}};}function handleEntityNotFound(_0x2deaef,_0x3ea565){return function(_0xa5b3f2){if(!_0xa5b3f2){_0x2deaef[_0xd85e('0x2a')](0x194);}return _0xa5b3f2;};}function handleError(_0x2a8f69,_0x212e00){_0x212e00=_0x212e00||0x1f4;return function(_0x344215){logger[_0xd85e('0x24')](_0x344215['stack']);if(_0x344215[_0xd85e('0x37')]){delete _0x344215['name'];}_0x2a8f69[_0xd85e('0x2c')](_0x212e00)[_0xd85e('0x38')](_0x344215);};}exports[_0xd85e('0x39')]=function(_0x335567,_0x166424){var _0x3bcf8a={},_0x78cfe9={},_0x18641f={'count':0x0,'rows':[]};var _0x1ede3a=_[_0xd85e('0x3a')](db[_0xd85e('0x3b')][_0xd85e('0x3c')],function(_0x1f86f4){return{'name':_0x1f86f4['fieldName'],'type':_0x1f86f4[_0xd85e('0x3d')][_0xd85e('0x3e')]};});_0x78cfe9[_0xd85e('0x3f')]=_[_0xd85e('0x3a')](_0x1ede3a,_0xd85e('0x37'));_0x78cfe9['query']=_[_0xd85e('0x40')](_0x335567[_0xd85e('0x41')]);_0x78cfe9[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x78cfe9[_0xd85e('0x3f')],_0x78cfe9[_0xd85e('0x41')]);_0x3bcf8a[_0xd85e('0x44')]=_[_0xd85e('0x43')](_0x78cfe9[_0xd85e('0x3f')],qs['fields'](_0x335567[_0xd85e('0x41')][_0xd85e('0x45')]));_0x3bcf8a[_0xd85e('0x44')]=_0x3bcf8a[_0xd85e('0x44')][_0xd85e('0x46')]?_0x3bcf8a[_0xd85e('0x44')]:_0x78cfe9[_0xd85e('0x3f')];if(!_0x335567[_0xd85e('0x41')]['hasOwnProperty']('nolimit')){_0x3bcf8a['limit']=qs[_0xd85e('0x2f')](_0x335567[_0xd85e('0x41')][_0xd85e('0x2f')]);_0x3bcf8a['offset']=qs[_0xd85e('0x2e')](_0x335567[_0xd85e('0x41')][_0xd85e('0x2e')]);}_0x3bcf8a[_0xd85e('0x47')]=qs[_0xd85e('0x48')](_0x335567['query'][_0xd85e('0x48')]);_0x3bcf8a[_0xd85e('0x49')]=qs[_0xd85e('0x42')](_[_0xd85e('0x4a')](_0x335567['query'],_0x78cfe9[_0xd85e('0x42')]),_0x1ede3a);if(_0x335567[_0xd85e('0x41')][_0xd85e('0x4b')]){_0x3bcf8a[_0xd85e('0x49')]=_[_0xd85e('0x4c')](_0x3bcf8a['where'],{'$or':_[_0xd85e('0x3a')](_0x1ede3a,function(_0x1ca963){if(_0x1ca963['type']!=='VIRTUAL'){var _0x2f1173={};_0x2f1173[_0x1ca963['name']]={'$like':'%'+_0x335567[_0xd85e('0x41')][_0xd85e('0x4b')]+'%'};return _0x2f1173;}})});}_0x3bcf8a=_['merge']({},_0x3bcf8a,_0x335567[_0xd85e('0x4d')]);var _0x5c128f={'where':_0x3bcf8a['where']};return db['SmsMessage']['count'](_0x5c128f)[_0xd85e('0x1f')](function(_0x1389e5){_0x18641f['count']=_0x1389e5;if(_0x335567[_0xd85e('0x41')][_0xd85e('0x4e')]){_0x3bcf8a['include']=[{'all':!![]}];}return db[_0xd85e('0x3b')][_0xd85e('0x4f')](_0x3bcf8a);})[_0xd85e('0x1f')](function(_0x33cb8f){_0x18641f[_0xd85e('0x50')]=_0x33cb8f;return _0x18641f;})['then'](respondWithFilteredResult(_0x166424,_0x3bcf8a))[_0xd85e('0x29')](handleError(_0x166424,null));};exports[_0xd85e('0x51')]=function(_0x271953,_0x16b7e4){var _0x25ebfc={'raw':!![],'where':{'id':_0x271953[_0xd85e('0x52')]['id']}},_0x46fa46={};_0x46fa46['model']=_['keys'](db['SmsMessage'][_0xd85e('0x3c')]);_0x46fa46['query']=_['keys'](_0x271953['query']);_0x46fa46[_0xd85e('0x42')]=_[_0xd85e('0x43')](_0x46fa46[_0xd85e('0x3f')],_0x46fa46[_0xd85e('0x41')]);_0x25ebfc[_0xd85e('0x44')]=_[_0xd85e('0x43')](_0x46fa46[_0xd85e('0x3f')],qs['fields'](_0x271953['query'][_0xd85e('0x45')]));_0x25ebfc[_0xd85e('0x44')]=_0x25ebfc['attributes'][_0xd85e('0x46')]?_0x25ebfc['attributes']:_0x46fa46['model'];if(_0x271953[_0xd85e('0x41')]['includeAll']){_0x25ebfc['include']=[{'all':!![]}];}_0x25ebfc=_[_0xd85e('0x4c')]({},_0x25ebfc,_0x271953[_0xd85e('0x4d')]);return db[_0xd85e('0x3b')][_0xd85e('0x53')](_0x25ebfc)[_0xd85e('0x1f')](handleEntityNotFound(_0x16b7e4,null))['then'](respondWithResult(_0x16b7e4,null))[_0xd85e('0x29')](handleError(_0x16b7e4,null));};exports[_0xd85e('0x54')]=function(_0x221863,_0x583c88){return db[_0xd85e('0x3b')][_0xd85e('0x54')](_0x221863[_0xd85e('0x55')],{})[_0xd85e('0x1f')](respondWithResult(_0x583c88,0xc9))['catch'](handleError(_0x583c88,null));};exports['update']=function(_0x17a047,_0x3d0682){if(_0x17a047[_0xd85e('0x55')]['id']){delete _0x17a047[_0xd85e('0x55')]['id'];}return db[_0xd85e('0x3b')][_0xd85e('0x53')]({'where':{'id':_0x17a047['params']['id']}})['then'](handleEntityNotFound(_0x3d0682,null))[_0xd85e('0x1f')](saveUpdates(_0x17a047['body'],null))[_0xd85e('0x1f')](respondWithResult(_0x3d0682,null))['catch'](handleError(_0x3d0682,null));};exports[_0xd85e('0x36')]=function(_0x276d9a,_0x214747){return db[_0xd85e('0x3b')][_0xd85e('0x53')]({'where':{'id':_0x276d9a[_0xd85e('0x52')]['id']}})[_0xd85e('0x1f')](handleEntityNotFound(_0x214747,null))['then'](removeEntity(_0x214747,null))[_0xd85e('0x29')](handleError(_0x214747,null));};exports['describe']=function(_0x11ccea,_0x390185){return db[_0xd85e('0x3b')][_0xd85e('0x56')]()[_0xd85e('0x1f')](respondWithResult(_0x390185,null))['catch'](handleError(_0x390185,null));};var interaction_log=require(_0xd85e('0x11'))(_0xd85e('0x57'));exports[_0xd85e('0x58')]=function(_0x4225ff,_0x2d33a1,_0x513588){var _0x26abbe={'agent':{},'channel':_0xd85e('0x59')};if(_0x4225ff[_0xd85e('0x55')]['id']){delete _0x4225ff[_0xd85e('0x55')]['id'];}_0x4225ff['body'][_0xd85e('0x5a')]=!![];_0x4225ff['body']['readAt']=moment()[_0xd85e('0x5b')](_0xd85e('0x5c'));_0x4225ff[_0xd85e('0x55')][_0xd85e('0x5d')]=_0x4225ff[_0xd85e('0x55')]['UserId']||_0x4225ff[_0xd85e('0x5e')]['id'];_0x26abbe[_0xd85e('0x5f')]['id']=_0x4225ff[_0xd85e('0x55')][_0xd85e('0x5d')];return db[_0xd85e('0x3b')][_0xd85e('0x53')]({'where':{'id':_0x4225ff[_0xd85e('0x52')]['id'],'UserId':null}})[_0xd85e('0x1f')](handleEntityNotFound(_0x2d33a1,null))[_0xd85e('0x1f')](saveUpdates(_0x4225ff[_0xd85e('0x55')],null))[_0xd85e('0x1f')](function(_0x52e7af){if(_0x52e7af){_0x26abbe[_0xd85e('0x26')]=_0x52e7af[_0xd85e('0x60')]({'plain':!![]});return db[_0xd85e('0x61')][_0xd85e('0x53')]({'where':{'id':_0x52e7af['SmsInteractionId']}});}return null;})[_0xd85e('0x1f')](handleEntityNotFound(_0x2d33a1,null))['then'](function(_0x3bd129){if(_0x3bd129){return _0x3bd129[_0xd85e('0x62')]({'UserId':_0x4225ff[_0xd85e('0x55')]['UserId'],'read1stAt':_['isNil'](_0x3bd129['read1stAt'])?moment()[_0xd85e('0x5b')](_0xd85e('0x5c')):undefined});}return null;})[_0xd85e('0x1f')](function(_0x1a963f){if(_0x1a963f){_0x26abbe['interaction']=_0x1a963f[_0xd85e('0x60')]({'plain':!![]});interaction_log[_0xd85e('0x27')](_0xd85e('0x63'),_0x4225ff['user']['id'],_0x4225ff['user'][_0xd85e('0x37')],_0x4225ff[_0xd85e('0x5e')][_0xd85e('0x64')],_0x26abbe['interaction']['id'],_0x4225ff[_0xd85e('0x55')]?JSON['stringify'](_0x4225ff[_0xd85e('0x55')]):_0xd85e('0x65'));return respondWithRpcPromise(_0xd85e('0x66'),_0xd85e('0x67'),_0x26abbe);}return null;})[_0xd85e('0x1f')](function(_0x20c5e0){var _0x425661='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x20c5e0['message']['ContactId'];return db['sequelize'][_0xd85e('0x41')](_0x425661,{'type':db['Sequelize'][_0xd85e('0x68')][_0xd85e('0x69')],'raw':!![]})[_0xd85e('0x1f')](function(_0x5c9f73){return _0x5c9f73;});})[_0xd85e('0x1f')](function(_0x22443f){if(_0x22443f){_0x26abbe[_0xd85e('0x26')][_0xd85e('0x6a')]=_0x22443f[0x0];if(!_0x4225ff[_0xd85e('0x55')]['UserId'])return;return db['User'][_0xd85e('0x53')]({'where':{'id':_0x4225ff['body']['UserId'],'role':'agent'},'attributes':['id','name',_0xd85e('0x6b'),_0xd85e('0x6c'),_0xd85e('0x6d')],'raw':!![]});}return null;})[_0xd85e('0x1f')](function(_0x18b407){if(!_0x18b407)return null;_0x26abbe[_0xd85e('0x26')][_0xd85e('0x5f')]=_0x18b407;return _0x26abbe;})[_0xd85e('0x1f')](function(_0x547d04){if(_0x547d04){if(_0x4225ff['body'][_0xd85e('0x6e')]){_0x26abbe[_0xd85e('0x26')][_0xd85e('0x6f')]=util[_0xd85e('0x5b')](_0xd85e('0x70'),_0x4225ff[_0xd85e('0x5e')][_0xd85e('0x37')]);_0x26abbe[_0xd85e('0x26')][_0xd85e('0x71')]=_0x26abbe[_0xd85e('0x71')];_0x26abbe['message'][_0xd85e('0x72')]=_0x26abbe[_0xd85e('0x71')];_0x26abbe[_0xd85e('0x26')]['event']=_0xd85e('0x58');return respondWithRpcPromise(_0xd85e('0x73'),_0xd85e('0x73'),{'event':_0xd85e('0x74'),'message':_0x26abbe['message']},client9002)[_0xd85e('0x1f')](function(){return _0x26abbe;});}return _0x26abbe;}return null;})['then'](respondWithResult(_0x2d33a1,null))[_0xd85e('0x29')](handleError(_0x2d33a1,null));};var interaction_log=require(_0xd85e('0x11'))(_0xd85e('0x57'));exports[_0xd85e('0x34')]=function(_0x3fe5c6,_0x250488,_0x2c4c03){var _0x23b7ed={'agent':{},'channel':_0xd85e('0x59')};if(_0x3fe5c6['body']['id']){delete _0x3fe5c6[_0xd85e('0x55')]['id'];}_0x3fe5c6[_0xd85e('0x55')][_0xd85e('0x5d')]=_0x3fe5c6['body'][_0xd85e('0x5d')]||_0x3fe5c6['user']['id'];_0x23b7ed[_0xd85e('0x5f')]['id']=_0x3fe5c6[_0xd85e('0x55')][_0xd85e('0x5d')];return db[_0xd85e('0x3b')]['find']({'where':{'id':_0x3fe5c6['params']['id'],'UserId':null}})[_0xd85e('0x1f')](handleEntityNotFound(_0x250488,null))[_0xd85e('0x1f')](function(_0x1cd5c3){if(_0x1cd5c3){_0x23b7ed[_0xd85e('0x26')]=_0x1cd5c3['get']({'plain':!![]});return db['SmsInteraction'][_0xd85e('0x53')]({'where':{'id':_0x1cd5c3[_0xd85e('0x75')]}});}return null;})[_0xd85e('0x1f')](handleEntityNotFound(_0x250488,null))[_0xd85e('0x1f')](function(_0xb2201f){if(_0xb2201f){_0x23b7ed[_0xd85e('0x76')]=_0xb2201f[_0xd85e('0x60')]({'plain':!![]});interaction_log[_0xd85e('0x27')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3fe5c6['user']['id'],_0x3fe5c6[_0xd85e('0x5e')][_0xd85e('0x37')],_0x3fe5c6[_0xd85e('0x5e')]['role'],_0x23b7ed['interaction']['id'],_0x3fe5c6[_0xd85e('0x55')]?JSON[_0xd85e('0x23')](_0x3fe5c6['body']):_0xd85e('0x65'));return respondWithRpcPromise(_0xd85e('0x77'),_0xd85e('0x78'),_0x23b7ed);}return null;})['then'](function(_0x2defd3){var _0x37edfe='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2defd3['message'][_0xd85e('0x79')];return db['sequelize'][_0xd85e('0x41')](_0x37edfe,{'type':db[_0xd85e('0x7a')][_0xd85e('0x68')][_0xd85e('0x69')],'raw':!![]})[_0xd85e('0x1f')](function(_0x111cd0){return _0x111cd0;});})[_0xd85e('0x1f')](function(_0x4ad937){if(_0x4ad937){_0x23b7ed[_0xd85e('0x26')]['contact']=_0x4ad937[0x0];if(!_0x3fe5c6['body'][_0xd85e('0x5d')])return;return db[_0xd85e('0x7b')][_0xd85e('0x53')]({'where':{'id':_0x3fe5c6[_0xd85e('0x55')]['UserId'],'role':_0xd85e('0x5f')},'attributes':['id',_0xd85e('0x37'),_0xd85e('0x6b'),'email',_0xd85e('0x6d')],'raw':!![]});}return null;})[_0xd85e('0x1f')](function(_0x4bef85){if(!_0x4bef85)return null;_0x23b7ed['message'][_0xd85e('0x5f')]=_0x4bef85;return _0x23b7ed;})[_0xd85e('0x1f')](function(_0x409e70){if(_0x409e70){_0x409e70['message'][_0xd85e('0x6f')]=util[_0xd85e('0x5b')](_0xd85e('0x70'),_0x3fe5c6[_0xd85e('0x5e')][_0xd85e('0x37')]);_0x409e70[_0xd85e('0x26')][_0xd85e('0x71')]=_0x23b7ed['channel'];_0x409e70[_0xd85e('0x26')][_0xd85e('0x72')]=_0x23b7ed['channel'];_0x409e70[_0xd85e('0x26')]['event']=_0xd85e('0x34');respondWithRpcPromise(_0xd85e('0x73'),'EventManager',{'event':_0xd85e('0x7c'),'message':_0x409e70['message']},client9002);return _0x23b7ed;}return null;})['then'](respondWithResult(_0x250488,null))[_0xd85e('0x29')](handleError(_0x250488,null));};exports['status']=function(_0x2af69c,_0x3baeee,_0x471dbb){if(_0x2af69c[_0xd85e('0x55')]['id']){delete _0x2af69c['body']['id'];}var _0x22b922;return db[_0xd85e('0x3b')][_0xd85e('0x53')]({'where':{'id':_0x2af69c[_0xd85e('0x52')]['id']}})['then'](handleEntityNotFound(_0x3baeee,null))[_0xd85e('0x1f')](function(_0x5b0180){if(_0x5b0180){_0x22b922=_0x5b0180;return db['SmsAccount']['find']({'where':{'id':_0x5b0180[_0xd85e('0x7d')]}});}})[_0xd85e('0x1f')](handleEntityNotFound(_0x3baeee,null))[_0xd85e('0x1f')](function(_0x49d694){if(_0x49d694){logger[_0xd85e('0x21')](_0xd85e('0x22'),'status',_0xd85e('0x7e'),_0x49d694[_0xd85e('0x3d')],util[_0xd85e('0x7f')](_0x2af69c[_0xd85e('0x55')],{'showHidden':![],'depth':null}));switch(_0x49d694[_0xd85e('0x3d')]){case'twilio':if(_0x2af69c['body'][_0xd85e('0x80')]&&_0x2af69c[_0xd85e('0x55')][_0xd85e('0x80')]===_0x22b922[_0xd85e('0x81')]){return _0x22b922['update']({'read':!![]});}else{logger[_0xd85e('0x24')](_0xd85e('0x82'),_0xd85e('0x2c'),_0xd85e('0x83'),util[_0xd85e('0x7f')](_0x2af69c[_0xd85e('0x55')],{'showHidden':![],'depth':null}));}break;case _0xd85e('0x84'):if(_0x2af69c['body']['MessageUUID']&&_0x2af69c['body'][_0xd85e('0x85')]===_0x22b922[_0xd85e('0x81')]&&_[_0xd85e('0x86')](['sent',_0xd85e('0x87')],_0x2af69c[_0xd85e('0x55')][_0xd85e('0x88')])>=0x0){return _0x22b922['update']({'read':!![]});}else{logger[_0xd85e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd85e('0x2c'),_0xd85e('0x89'),util[_0xd85e('0x7f')](_0x2af69c[_0xd85e('0x55')],{'showHidden':![],'depth':null}));}break;case _0xd85e('0x8a'):var _0x3c0001=_0x2af69c[_0xd85e('0x55')]['results'][0x0];if(_0x3c0001['status'][_0xd85e('0x8b')]===_0xd85e('0x8c')){return _0x22b922['update']({'read':!![]});}else{logger[_0xd85e('0x24')](_0xd85e('0x82'),'status',_0xd85e('0x8a'),util[_0xd85e('0x7f')](_0x2af69c[_0xd85e('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x22b922;}})['then'](respondWithResult(_0x3baeee,null))['catch'](handleError(_0x3baeee,null));}; \ No newline at end of file +var _0xc6c0=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','name','map','SmsMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','include','params','rawAttributes','length','includeAll','options','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','SIP/%s','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','results','groupName','DELIVERED','infobip','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x5463d7,_0x1d8ff8){var _0x59f1b1=function(_0xea0d53){while(--_0xea0d53){_0x5463d7['push'](_0x5463d7['shift']());}};_0x59f1b1(++_0x1d8ff8);}(_0xc6c0,0x1b1));var _0x0c6c=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0xc6c0[_0x9b3efc];return _0x200f05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c6c('0x0'));var zipdir=require(_0x0c6c('0x1'));var jsonpatch=require(_0x0c6c('0x2'));var rp=require(_0x0c6c('0x3'));var moment=require('moment');var BPromise=require(_0x0c6c('0x4'));var Mustache=require(_0x0c6c('0x5'));var util=require(_0x0c6c('0x6'));var path=require(_0x0c6c('0x7'));var sox=require(_0x0c6c('0x8'));var csv=require(_0x0c6c('0x9'));var ejs=require(_0x0c6c('0xa'));var fs=require('fs');var fs_extra=require(_0x0c6c('0xb'));var _=require(_0x0c6c('0xc'));var squel=require(_0x0c6c('0xd'));var crypto=require('crypto');var jsforce=require(_0x0c6c('0xe'));var deskjs=require(_0x0c6c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0c6c('0x10'));var Papa=require(_0x0c6c('0x11'));var Redis=require(_0x0c6c('0x12'));var authService=require(_0x0c6c('0x13'));var qs=require(_0x0c6c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c6c('0x15'));var logger=require('../../config/logger')(_0x0c6c('0x16'));var utils=require(_0x0c6c('0x17'));var config=require(_0x0c6c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x0c6c('0x19')](config[_0x0c6c('0x1a')],{'host':_0x0c6c('0x1b'),'port':0x18eb});var socket=require(_0x0c6c('0x1c'))(new Redis(config['redis']));require(_0x0c6c('0x1d'))[_0x0c6c('0x1e')](socket);var jayson=require(_0x0c6c('0x1f'));var client=jayson['client'][_0x0c6c('0x20')]({'port':0x232c});var client9002=jayson[_0x0c6c('0x21')][_0x0c6c('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3f3ede,_0xb8019c,_0x3a14c1,_0x38f0f3){return new BPromise(function(_0xcf309,_0x11bdf4){var _0x1a588d=_0x38f0f3||client;return _0x1a588d[_0x0c6c('0x22')](_0x3f3ede,_0x3a14c1)[_0x0c6c('0x23')](function(_0x3ead7c){logger['info']('SmsMessage,\x20%s,\x20%s',_0xb8019c,_0x0c6c('0x24'));logger[_0x0c6c('0x25')](_0x0c6c('0x26'),_0xb8019c,'request\x20sent',JSON[_0x0c6c('0x27')](_0x3ead7c));if(_0x3ead7c[_0x0c6c('0x28')]){if(_0x3ead7c[_0x0c6c('0x28')][_0x0c6c('0x29')]===0x1f4){logger[_0x0c6c('0x28')]('SmsMessage,\x20%s,\x20%s',_0xb8019c,_0x3ead7c[_0x0c6c('0x28')][_0x0c6c('0x2a')]);return _0x11bdf4(_0x3ead7c['error'][_0x0c6c('0x2a')]);}logger['error'](_0x0c6c('0x2b'),_0xb8019c,_0x3ead7c['error'][_0x0c6c('0x2a')]);return _0xcf309(_0x3ead7c['error'][_0x0c6c('0x2a')]);}else{logger[_0x0c6c('0x2c')](_0x0c6c('0x2b'),_0xb8019c,_0x0c6c('0x24'));_0xcf309(_0x3ead7c['result']['message']);}})[_0x0c6c('0x2d')](function(_0x1e5b8b){logger[_0x0c6c('0x28')](_0x0c6c('0x2b'),_0xb8019c,_0x1e5b8b);_0x11bdf4(_0x1e5b8b);});});}function respondWithStatusCode(_0x5ac4ef,_0x36cfc2){_0x36cfc2=_0x36cfc2||0xcc;return function(_0x342294){if(_0x342294){return _0x5ac4ef[_0x0c6c('0x2e')](_0x36cfc2);}return _0x5ac4ef[_0x0c6c('0x2f')](_0x36cfc2)[_0x0c6c('0x30')]();};}function respondWithResult(_0x3fef15,_0x3e8c0e){_0x3e8c0e=_0x3e8c0e||0xc8;return function(_0x473889){if(_0x473889){return _0x3fef15[_0x0c6c('0x2f')](_0x3e8c0e)[_0x0c6c('0x31')](_0x473889);}};}function respondWithFilteredResult(_0x17b44f,_0xfdb90f){return function(_0x26b1cd){if(_0x26b1cd){var _0x83e9cb=typeof _0xfdb90f[_0x0c6c('0x32')]===_0x0c6c('0x33')&&typeof _0xfdb90f['limit']===_0x0c6c('0x33');var _0x4b9024=_0x26b1cd['count'];var _0x42843a=_0x83e9cb?0x0:_0xfdb90f[_0x0c6c('0x32')];var _0x2f7325=_0x83e9cb?_0x26b1cd[_0x0c6c('0x34')]:_0xfdb90f[_0x0c6c('0x32')]+_0xfdb90f[_0x0c6c('0x35')];var _0x46a3fd;if(_0x2f7325>=_0x4b9024){_0x2f7325=_0x4b9024;_0x46a3fd=0xc8;}else{_0x46a3fd=0xce;}_0x17b44f[_0x0c6c('0x2f')](_0x46a3fd);return _0x17b44f['set'](_0x0c6c('0x36'),_0x42843a+'-'+_0x2f7325+'/'+_0x4b9024)[_0x0c6c('0x31')](_0x26b1cd);}return null;};}function patchUpdates(_0x46858b){return function(_0x9137c9){try{jsonpatch[_0x0c6c('0x37')](_0x9137c9,_0x46858b,!![]);}catch(_0x65ecb6){return BPromise[_0x0c6c('0x38')](_0x65ecb6);}return _0x9137c9[_0x0c6c('0x39')]();};}function saveUpdates(_0x46ed6c,_0x21cb93){return function(_0x502563){if(_0x502563){return _0x502563[_0x0c6c('0x3a')](_0x46ed6c)[_0x0c6c('0x23')](function(_0x1dc7c8){return _0x1dc7c8;});}return null;};}function removeEntity(_0x5a1876,_0x2f5f0){return function(_0x35e8fe){if(_0x35e8fe){return _0x35e8fe[_0x0c6c('0x3b')]()[_0x0c6c('0x23')](function(){_0x5a1876['status'](0xcc)[_0x0c6c('0x30')]();});}};}function handleEntityNotFound(_0x2bb011,_0x46f4ed){return function(_0x4a6d81){if(!_0x4a6d81){_0x2bb011[_0x0c6c('0x2e')](0x194);}return _0x4a6d81;};}function handleError(_0x48db71,_0x552844){_0x552844=_0x552844||0x1f4;return function(_0x55e536){logger['error'](_0x55e536['stack']);if(_0x55e536[_0x0c6c('0x3c')]){delete _0x55e536[_0x0c6c('0x3c')];}_0x48db71['status'](_0x552844)['send'](_0x55e536);};}exports['index']=function(_0x2bfec7,_0x4926e4){var _0x4ccff2={},_0xecac1a={},_0x2b4df9={'count':0x0,'rows':[]};var _0x21af9b=_[_0x0c6c('0x3d')](db[_0x0c6c('0x3e')]['rawAttributes'],function(_0x3849fd){return{'name':_0x3849fd[_0x0c6c('0x3f')],'type':_0x3849fd[_0x0c6c('0x40')][_0x0c6c('0x41')]};});_0xecac1a[_0x0c6c('0x42')]=_['map'](_0x21af9b,_0x0c6c('0x3c'));_0xecac1a['query']=_[_0x0c6c('0x43')](_0x2bfec7[_0x0c6c('0x44')]);_0xecac1a[_0x0c6c('0x45')]=_[_0x0c6c('0x46')](_0xecac1a[_0x0c6c('0x42')],_0xecac1a[_0x0c6c('0x44')]);_0x4ccff2[_0x0c6c('0x47')]=_[_0x0c6c('0x46')](_0xecac1a['model'],qs['fields'](_0x2bfec7[_0x0c6c('0x44')][_0x0c6c('0x48')]));_0x4ccff2[_0x0c6c('0x47')]=_0x4ccff2[_0x0c6c('0x47')]['length']?_0x4ccff2['attributes']:_0xecac1a[_0x0c6c('0x42')];if(!_0x2bfec7[_0x0c6c('0x44')][_0x0c6c('0x49')](_0x0c6c('0x4a'))){_0x4ccff2[_0x0c6c('0x35')]=qs[_0x0c6c('0x35')](_0x2bfec7[_0x0c6c('0x44')][_0x0c6c('0x35')]);_0x4ccff2[_0x0c6c('0x32')]=qs[_0x0c6c('0x32')](_0x2bfec7['query'][_0x0c6c('0x32')]);}_0x4ccff2[_0x0c6c('0x4b')]=qs[_0x0c6c('0x4c')](_0x2bfec7['query'][_0x0c6c('0x4c')]);_0x4ccff2['where']=qs[_0x0c6c('0x45')](_[_0x0c6c('0x4d')](_0x2bfec7['query'],_0xecac1a['filters']),_0x21af9b);if(_0x2bfec7['query']['filter']){_0x4ccff2[_0x0c6c('0x4e')]=_[_0x0c6c('0x4f')](_0x4ccff2[_0x0c6c('0x4e')],{'$or':_['map'](_0x21af9b,function(_0x4f319b){if(_0x4f319b['type']!==_0x0c6c('0x50')){var _0x3b1962={};_0x3b1962[_0x4f319b[_0x0c6c('0x3c')]]={'$like':'%'+_0x2bfec7[_0x0c6c('0x44')]['filter']+'%'};return _0x3b1962;}})});}_0x4ccff2=_['merge']({},_0x4ccff2,_0x2bfec7['options']);var _0x5b8537={'where':_0x4ccff2[_0x0c6c('0x4e')]};return db['SmsMessage'][_0x0c6c('0x34')](_0x5b8537)['then'](function(_0x1d969f){_0x2b4df9[_0x0c6c('0x34')]=_0x1d969f;if(_0x2bfec7['query']['includeAll']){_0x4ccff2[_0x0c6c('0x51')]=[{'all':!![]}];}return db[_0x0c6c('0x3e')]['findAll'](_0x4ccff2);})[_0x0c6c('0x23')](function(_0x3d9025){_0x2b4df9['rows']=_0x3d9025;return _0x2b4df9;})[_0x0c6c('0x23')](respondWithFilteredResult(_0x4926e4,_0x4ccff2))[_0x0c6c('0x2d')](handleError(_0x4926e4,null));};exports['show']=function(_0x1d53f5,_0x2a839f){var _0x1dfde9={'raw':!![],'where':{'id':_0x1d53f5[_0x0c6c('0x52')]['id']}},_0x7e507d={};_0x7e507d[_0x0c6c('0x42')]=_['keys'](db['SmsMessage'][_0x0c6c('0x53')]);_0x7e507d['query']=_[_0x0c6c('0x43')](_0x1d53f5[_0x0c6c('0x44')]);_0x7e507d['filters']=_[_0x0c6c('0x46')](_0x7e507d['model'],_0x7e507d[_0x0c6c('0x44')]);_0x1dfde9[_0x0c6c('0x47')]=_[_0x0c6c('0x46')](_0x7e507d[_0x0c6c('0x42')],qs['fields'](_0x1d53f5[_0x0c6c('0x44')][_0x0c6c('0x48')]));_0x1dfde9[_0x0c6c('0x47')]=_0x1dfde9[_0x0c6c('0x47')][_0x0c6c('0x54')]?_0x1dfde9[_0x0c6c('0x47')]:_0x7e507d[_0x0c6c('0x42')];if(_0x1d53f5[_0x0c6c('0x44')][_0x0c6c('0x55')]){_0x1dfde9[_0x0c6c('0x51')]=[{'all':!![]}];}_0x1dfde9=_['merge']({},_0x1dfde9,_0x1d53f5[_0x0c6c('0x56')]);return db[_0x0c6c('0x3e')][_0x0c6c('0x57')](_0x1dfde9)['then'](handleEntityNotFound(_0x2a839f,null))[_0x0c6c('0x23')](respondWithResult(_0x2a839f,null))[_0x0c6c('0x2d')](handleError(_0x2a839f,null));};exports['create']=function(_0x160d56,_0x1a6f60){return db['SmsMessage'][_0x0c6c('0x58')](_0x160d56[_0x0c6c('0x59')],{})[_0x0c6c('0x23')](respondWithResult(_0x1a6f60,0xc9))[_0x0c6c('0x2d')](handleError(_0x1a6f60,null));};exports[_0x0c6c('0x3a')]=function(_0x47e361,_0x216949){if(_0x47e361[_0x0c6c('0x59')]['id']){delete _0x47e361[_0x0c6c('0x59')]['id'];}return db[_0x0c6c('0x3e')][_0x0c6c('0x57')]({'where':{'id':_0x47e361[_0x0c6c('0x52')]['id']}})[_0x0c6c('0x23')](handleEntityNotFound(_0x216949,null))[_0x0c6c('0x23')](saveUpdates(_0x47e361[_0x0c6c('0x59')],null))[_0x0c6c('0x23')](respondWithResult(_0x216949,null))[_0x0c6c('0x2d')](handleError(_0x216949,null));};exports[_0x0c6c('0x3b')]=function(_0x571733,_0x22d53a){return db[_0x0c6c('0x3e')][_0x0c6c('0x57')]({'where':{'id':_0x571733['params']['id']}})['then'](handleEntityNotFound(_0x22d53a,null))[_0x0c6c('0x23')](removeEntity(_0x22d53a,null))[_0x0c6c('0x2d')](handleError(_0x22d53a,null));};exports[_0x0c6c('0x5a')]=function(_0x41d495,_0x255f2d){return db[_0x0c6c('0x3e')][_0x0c6c('0x5a')]()['then'](respondWithResult(_0x255f2d,null))[_0x0c6c('0x2d')](handleError(_0x255f2d,null));};var interaction_log=require(_0x0c6c('0x5b'))(_0x0c6c('0x5c'));exports[_0x0c6c('0x5d')]=function(_0x4a2bad,_0x3eb9a2,_0x5e15b0){var _0x45fbf8={'agent':{},'channel':_0x0c6c('0x5e')};if(_0x4a2bad[_0x0c6c('0x59')]['id']){delete _0x4a2bad[_0x0c6c('0x59')]['id'];}_0x4a2bad[_0x0c6c('0x59')][_0x0c6c('0x5f')]=!![];_0x4a2bad[_0x0c6c('0x59')]['readAt']=moment()[_0x0c6c('0x60')](_0x0c6c('0x61'));_0x4a2bad[_0x0c6c('0x59')][_0x0c6c('0x62')]=_0x4a2bad[_0x0c6c('0x59')][_0x0c6c('0x62')]||_0x4a2bad[_0x0c6c('0x63')]['id'];_0x45fbf8[_0x0c6c('0x64')]['id']=_0x4a2bad[_0x0c6c('0x59')]['UserId'];return db[_0x0c6c('0x3e')]['find']({'where':{'id':_0x4a2bad[_0x0c6c('0x52')]['id'],'UserId':null}})[_0x0c6c('0x23')](handleEntityNotFound(_0x3eb9a2,null))[_0x0c6c('0x23')](saveUpdates(_0x4a2bad[_0x0c6c('0x59')],null))[_0x0c6c('0x23')](function(_0x265523){if(_0x265523){_0x45fbf8[_0x0c6c('0x2a')]=_0x265523[_0x0c6c('0x65')]({'plain':!![]});return db[_0x0c6c('0x66')][_0x0c6c('0x57')]({'where':{'id':_0x265523['SmsInteractionId']}});}return null;})[_0x0c6c('0x23')](handleEntityNotFound(_0x3eb9a2,null))[_0x0c6c('0x23')](function(_0x32c05f){if(_0x32c05f){return _0x32c05f['update']({'UserId':_0x4a2bad['body'][_0x0c6c('0x62')],'read1stAt':_['isNil'](_0x32c05f[_0x0c6c('0x67')])?moment()[_0x0c6c('0x60')](_0x0c6c('0x61')):undefined});}return null;})[_0x0c6c('0x23')](function(_0x5a8ec0){if(_0x5a8ec0){_0x45fbf8[_0x0c6c('0x68')]=_0x5a8ec0[_0x0c6c('0x65')]({'plain':!![]});interaction_log[_0x0c6c('0x2c')](_0x0c6c('0x69'),_0x4a2bad[_0x0c6c('0x63')]['id'],_0x4a2bad['user']['name'],_0x4a2bad[_0x0c6c('0x63')][_0x0c6c('0x6a')],_0x45fbf8[_0x0c6c('0x68')]['id'],_0x4a2bad[_0x0c6c('0x59')]?JSON[_0x0c6c('0x27')](_0x4a2bad[_0x0c6c('0x59')]):'null');return respondWithRpcPromise(_0x0c6c('0x6b'),'acceptMessage',_0x45fbf8);}return null;})[_0x0c6c('0x23')](function(_0x3d2862){var _0x5be57a=_0x0c6c('0x6c')+_0x3d2862[_0x0c6c('0x2a')][_0x0c6c('0x6d')];return db[_0x0c6c('0x6e')][_0x0c6c('0x44')](_0x5be57a,{'type':db['Sequelize'][_0x0c6c('0x6f')][_0x0c6c('0x70')],'raw':!![]})['then'](function(_0x39027f){return _0x39027f;});})['then'](function(_0x41d72c){if(_0x41d72c){_0x45fbf8[_0x0c6c('0x2a')][_0x0c6c('0x71')]=_0x41d72c[0x0];if(!_0x4a2bad[_0x0c6c('0x59')][_0x0c6c('0x62')])return;return db[_0x0c6c('0x72')][_0x0c6c('0x57')]({'where':{'id':_0x4a2bad[_0x0c6c('0x59')][_0x0c6c('0x62')],'role':_0x0c6c('0x64')},'attributes':['id','name',_0x0c6c('0x73'),_0x0c6c('0x74'),_0x0c6c('0x75')],'raw':!![]});}return null;})[_0x0c6c('0x23')](function(_0x1cac3f){if(!_0x1cac3f)return null;_0x45fbf8['message'][_0x0c6c('0x64')]=_0x1cac3f;return _0x45fbf8;})[_0x0c6c('0x23')](function(_0x14cbb1){if(_0x14cbb1){if(_0x4a2bad[_0x0c6c('0x59')]['manual']){_0x45fbf8[_0x0c6c('0x2a')][_0x0c6c('0x76')]=util['format']('SIP/%s',_0x4a2bad[_0x0c6c('0x63')][_0x0c6c('0x3c')]);_0x45fbf8[_0x0c6c('0x2a')]['channel']=_0x45fbf8[_0x0c6c('0x77')];_0x45fbf8['message']['motionChannel']=_0x45fbf8[_0x0c6c('0x77')];_0x45fbf8[_0x0c6c('0x2a')][_0x0c6c('0x78')]=_0x0c6c('0x5d');return respondWithRpcPromise('EventManager',_0x0c6c('0x79'),{'event':_0x0c6c('0x7a'),'message':_0x45fbf8[_0x0c6c('0x2a')]},client9002)['then'](function(){return _0x45fbf8;});}return _0x45fbf8;}return null;})[_0x0c6c('0x23')](respondWithResult(_0x3eb9a2,null))[_0x0c6c('0x2d')](handleError(_0x3eb9a2,null));};var interaction_log=require(_0x0c6c('0x5b'))(_0x0c6c('0x5c'));exports['reject']=function(_0x24e725,_0x57195f,_0x3eafe1){var _0x44b60a={'agent':{},'channel':_0x0c6c('0x5e')};if(_0x24e725[_0x0c6c('0x59')]['id']){delete _0x24e725['body']['id'];}_0x24e725['body'][_0x0c6c('0x62')]=_0x24e725[_0x0c6c('0x59')][_0x0c6c('0x62')]||_0x24e725[_0x0c6c('0x63')]['id'];_0x44b60a[_0x0c6c('0x64')]['id']=_0x24e725['body'][_0x0c6c('0x62')];return db[_0x0c6c('0x3e')]['find']({'where':{'id':_0x24e725['params']['id'],'UserId':null}})[_0x0c6c('0x23')](handleEntityNotFound(_0x57195f,null))[_0x0c6c('0x23')](function(_0x156d22){if(_0x156d22){_0x44b60a[_0x0c6c('0x2a')]=_0x156d22['get']({'plain':!![]});return db[_0x0c6c('0x66')][_0x0c6c('0x57')]({'where':{'id':_0x156d22['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x57195f,null))[_0x0c6c('0x23')](function(_0x5589a3){if(_0x5589a3){_0x44b60a[_0x0c6c('0x68')]=_0x5589a3[_0x0c6c('0x65')]({'plain':!![]});interaction_log[_0x0c6c('0x2c')](_0x0c6c('0x7b'),_0x24e725[_0x0c6c('0x63')]['id'],_0x24e725[_0x0c6c('0x63')]['name'],_0x24e725[_0x0c6c('0x63')]['role'],_0x44b60a[_0x0c6c('0x68')]['id'],_0x24e725[_0x0c6c('0x59')]?JSON[_0x0c6c('0x27')](_0x24e725[_0x0c6c('0x59')]):'null');return respondWithRpcPromise(_0x0c6c('0x7c'),_0x0c6c('0x7d'),_0x44b60a);}return null;})[_0x0c6c('0x23')](function(_0x9fb7c5){var _0x359fc7=_0x0c6c('0x6c')+_0x9fb7c5[_0x0c6c('0x2a')][_0x0c6c('0x6d')];return db['sequelize'][_0x0c6c('0x44')](_0x359fc7,{'type':db[_0x0c6c('0x7e')][_0x0c6c('0x6f')][_0x0c6c('0x70')],'raw':!![]})[_0x0c6c('0x23')](function(_0x533d6b){return _0x533d6b;});})[_0x0c6c('0x23')](function(_0x955819){if(_0x955819){_0x44b60a['message'][_0x0c6c('0x71')]=_0x955819[0x0];if(!_0x24e725[_0x0c6c('0x59')][_0x0c6c('0x62')])return;return db[_0x0c6c('0x72')][_0x0c6c('0x57')]({'where':{'id':_0x24e725[_0x0c6c('0x59')][_0x0c6c('0x62')],'role':_0x0c6c('0x64')},'attributes':['id',_0x0c6c('0x3c'),_0x0c6c('0x73'),_0x0c6c('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1db467){if(!_0x1db467)return null;_0x44b60a['message']['agent']=_0x1db467;return _0x44b60a;})[_0x0c6c('0x23')](function(_0x208def){if(_0x208def){_0x208def[_0x0c6c('0x2a')][_0x0c6c('0x76')]=util[_0x0c6c('0x60')](_0x0c6c('0x7f'),_0x24e725['user']['name']);_0x208def[_0x0c6c('0x2a')][_0x0c6c('0x77')]=_0x44b60a[_0x0c6c('0x77')];_0x208def['message'][_0x0c6c('0x80')]=_0x44b60a['channel'];_0x208def['message'][_0x0c6c('0x78')]=_0x0c6c('0x38');respondWithRpcPromise(_0x0c6c('0x79'),_0x0c6c('0x79'),{'event':_0x0c6c('0x81'),'message':_0x208def[_0x0c6c('0x2a')]},client9002);return _0x44b60a;}return null;})['then'](respondWithResult(_0x57195f,null))[_0x0c6c('0x2d')](handleError(_0x57195f,null));};exports['status']=function(_0xa5531f,_0x21464d,_0x331152){if(_0xa5531f[_0x0c6c('0x59')]['id']){delete _0xa5531f[_0x0c6c('0x59')]['id'];}var _0x5a7417;return db[_0x0c6c('0x3e')][_0x0c6c('0x57')]({'where':{'id':_0xa5531f[_0x0c6c('0x52')]['id']}})[_0x0c6c('0x23')](handleEntityNotFound(_0x21464d,null))['then'](function(_0x55960d){if(_0x55960d){_0x5a7417=_0x55960d;return db[_0x0c6c('0x82')]['find']({'where':{'id':_0x55960d[_0x0c6c('0x83')]}});}})[_0x0c6c('0x23')](handleEntityNotFound(_0x21464d,null))[_0x0c6c('0x23')](function(_0x486eed){if(_0x486eed){logger['debug'](_0x0c6c('0x26'),_0x0c6c('0x2f'),_0x0c6c('0x84'),_0x486eed[_0x0c6c('0x40')],util['inspect'](_0xa5531f[_0x0c6c('0x59')],{'showHidden':![],'depth':null}));switch(_0x486eed[_0x0c6c('0x40')]){case _0x0c6c('0x85'):if(_0xa5531f['body'][_0x0c6c('0x86')]&&_0xa5531f['body']['MessageSid']===_0x5a7417[_0x0c6c('0x87')]){return _0x5a7417[_0x0c6c('0x3a')]({'read':!![]});}else{logger[_0x0c6c('0x28')](_0x0c6c('0x88'),_0x0c6c('0x2f'),_0x0c6c('0x85'),util[_0x0c6c('0x89')](_0xa5531f['body'],{'showHidden':![],'depth':null}));}break;case _0x0c6c('0x8a'):if(_0xa5531f['body']['MessageUUID']&&_0xa5531f[_0x0c6c('0x59')][_0x0c6c('0x8b')]===_0x5a7417['messageId']&&_[_0x0c6c('0x8c')]([_0x0c6c('0x8d'),_0x0c6c('0x8e')],_0xa5531f['body']['Status'])>=0x0){return _0x5a7417[_0x0c6c('0x3a')]({'read':!![]});}else{logger[_0x0c6c('0x28')](_0x0c6c('0x88'),'status','plivio',util[_0x0c6c('0x89')](_0xa5531f[_0x0c6c('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xc41825=_0xa5531f[_0x0c6c('0x59')][_0x0c6c('0x8f')][0x0];if(_0xc41825[_0x0c6c('0x2f')][_0x0c6c('0x90')]===_0x0c6c('0x91')){return _0x5a7417[_0x0c6c('0x3a')]({'read':!![]});}else{logger[_0x0c6c('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0c6c('0x2f'),_0x0c6c('0x92'),util['inspect'](_0xa5531f[_0x0c6c('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x5a7417;}})[_0x0c6c('0x23')](respondWithResult(_0x21464d,null))[_0x0c6c('0x2d')](handleError(_0x21464d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index b2f6a4a..60dfa5d 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 _0x4245=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove'];(function(_0x2ebf47,_0x17f633){var _0x5e087a=function(_0x1db0b9){while(--_0x1db0b9){_0x2ebf47['push'](_0x2ebf47['shift']());}};_0x5e087a(++_0x17f633);}(_0x4245,0x81));var _0x5424=function(_0x44c1c2,_0x1e1d9d){_0x44c1c2=_0x44c1c2-0x0;var _0x3d86f2=_0x4245[_0x44c1c2];return _0x3d86f2;};'use strict';var EventEmitter=require(_0x5424('0x0'));var SmsMessage=require(_0x5424('0x1'))['db'][_0x5424('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5424('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5424('0x4'),'afterDestroy':_0x5424('0x5')};function emitEvent(_0x4f2800){return function(_0x407d61,_0x2a02ab,_0x2671c3){SmsMessageEvents[_0x5424('0x6')](_0x4f2800+':'+_0x407d61['id'],_0x407d61);SmsMessageEvents['emit'](_0x4f2800,_0x407d61);_0x2671c3(null);};}for(var e in events){if(events[_0x5424('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x5424('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x4b61=['../../mysqldb','update','hasOwnProperty','hook','events'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x4b61,0xcc));var _0x14b6=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x4b61[_0x2181fc];return _0x315da1;};'use strict';var EventEmitter=require(_0x14b6('0x0'));var SmsMessage=require(_0x14b6('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x14b6('0x2'),'afterDestroy':'remove'};function emitEvent(_0xc44fef){return function(_0x281915,_0x4e5e50,_0x1781be){SmsMessageEvents['emit'](_0xc44fef+':'+_0x281915['id'],_0x281915);SmsMessageEvents['emit'](_0xc44fef,_0x281915);_0x1781be(null);};}for(var e in events){if(events[_0x14b6('0x3')](e)){var event=events[e];SmsMessage[_0x14b6('0x4')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 0b6e314..33dce4b 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 _0xf3d7=['catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','skebby','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','apiKey','login','sender','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Basic\x20%s','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','moment','bluebird','rimraf','../../config/environment','exports','define','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt'];(function(_0x34d663,_0x2d8ec7){var _0x91bd85=function(_0x2b9de6){while(--_0x2b9de6){_0x34d663['push'](_0x34d663['shift']());}};_0x91bd85(++_0x2d8ec7);}(_0xf3d7,0x1d3));var _0x7f3d=function(_0x16dbab,_0x3ac1e1){_0x16dbab=_0x16dbab-0x0;var _0x59b0b2=_0xf3d7[_0x16dbab];return _0x59b0b2;};'use strict';var _=require(_0x7f3d('0x0'));var util=require(_0x7f3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f3d('0x2'));var BPromise=require(_0x7f3d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f3d('0x4'));var config=require(_0x7f3d('0x5'));var attributes=require('./smsMessage.attributes');module[_0x7f3d('0x6')]=function(_0x135ca3,_0x2b5c9c){return _0x135ca3[_0x7f3d('0x7')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x7f3d('0x8'),'fields':[_0x7f3d('0x8')]},{'name':_0x7f3d('0x9'),'fields':[_0x7f3d('0xa')],'type':_0x7f3d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2eaa5,_0x30ce57,_0x18d7f0){var _0x5b2f4c=_0x135ca3['models'];var _0x1bb8ec=_0x2eaa5[_0x7f3d('0xc')]({'plain':!![]});if(_0x1bb8ec[_0x7f3d('0xd')][_0x7f3d('0xe')]()==='in'||_0x1bb8ec['direction'][_0x7f3d('0xe')]()===_0x7f3d('0xf')&&!_0x1bb8ec[_0x7f3d('0x10')]&&!_[_0x7f3d('0x11')](_0x1bb8ec[_0x7f3d('0x12')])&&!_['isNil'](_0x1bb8ec['SmsInteractionId'])){_0x5b2f4c[_0x7f3d('0x13')][_0x7f3d('0x14')]({'where':{'id':_0x1bb8ec[_0x7f3d('0x15')]}})[_0x7f3d('0x16')](function(_0x35b123){if(_0x35b123){_0x35b123[_0x7f3d('0x17')]({'lastMsgAt':_0x1bb8ec[_0x7f3d('0x18')],'lastMsgDirection':_0x1bb8ec['direction'][_0x7f3d('0xe')]()});}})[_0x7f3d('0x19')](function(_0x4b404b){console[_0x7f3d('0x1a')](_0x4b404b);});}if(_0x1bb8ec[_0x7f3d('0xd')]===_0x7f3d('0xf')&&!_0x1bb8ec[_0x7f3d('0x10')]){var _0x34e26a;_0x5b2f4c['SmsAccount'][_0x7f3d('0x1b')]({'where':{'id':_0x1bb8ec[_0x7f3d('0x1c')]},'raw':!![]})[_0x7f3d('0x16')](function(_0x16cf4d){_0x34e26a=_0x16cf4d;if(_0x34e26a&&_0x34e26a[_0x7f3d('0x1d')]){switch(_0x34e26a['type']){case _0x7f3d('0x1e'):var _0x24fed1=require(_0x7f3d('0x1e'));if(_0x34e26a[_0x7f3d('0x1f')]&&_0x34e26a[_0x7f3d('0x20')]&&_0x34e26a[_0x7f3d('0x21')]){var _0x2944f5=new _0x24fed1(_0x34e26a['accountSid'],_0x34e26a[_0x7f3d('0x20')]);_0x2944f5[_0x7f3d('0x22')][_0x7f3d('0x23')]({'body':_0x1bb8ec[_0x7f3d('0xa')],'to':_0x1bb8ec[_0x7f3d('0x21')],'from':_0x34e26a[_0x7f3d('0x21')],'statusCallback':_0x34e26a[_0x7f3d('0x24')]+'/api/sms/messages/'+_0x1bb8ec['id']+_0x7f3d('0x25')+_0x34e26a[_0x7f3d('0x26')]})[_0x7f3d('0x16')](function(_0x446864){if(_0x446864[_0x7f3d('0x27')]){return _0x2eaa5[_0x7f3d('0x17')]({'messageId':_0x446864[_0x7f3d('0x27')]});}})[_0x7f3d('0x19')](function(_0x13e973){logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x1e'),util['inspect'](_0x13e973,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7f3d('0x29'),_0x7f3d('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x2e1a7a=_0x7f3d('0x2a');if(_0x34e26a[_0x7f3d('0x2b')]&&_0x34e26a[_0x7f3d('0x2c')]){var _0x540ad2={'recipient':[_0x1bb8ec['phone']],'message':_0x1bb8ec[_0x7f3d('0xa')],'message_type':_0x34e26a['smsMethod']};if(_0x34e26a[_0x7f3d('0x2d')]&&_0x34e26a[_0x7f3d('0x2d')]!=='SI'){_0x540ad2['sender']=_0x34e26a[_0x7f3d('0x21')];}var _0x162f33={'url':_0x2e1a7a+_0x7f3d('0x2e')+_0x34e26a[_0x7f3d('0x2b')]+_0x7f3d('0x2f')+_0x34e26a[_0x7f3d('0x2c')],'method':_0x7f3d('0x30')};rp(_0x162f33)[_0x7f3d('0x16')](function(_0x1a9e32){var _0x3fb25c=_0x1a9e32[_0x7f3d('0x31')](';');var _0x29cdba={'user_key':_0x3fb25c[0x0],'session_key':_0x3fb25c[0x1]};_0x162f33={'url':_0x2e1a7a+_0x7f3d('0x32'),'method':_0x7f3d('0x33'),'headers':{'user_key':_0x29cdba[_0x7f3d('0x34')],'Session_key':_0x29cdba['session_key']},'json':!![],'body':_0x540ad2};return rp(_0x162f33);})[_0x7f3d('0x16')](function(_0x2aa6c4){if(_0x2aa6c4[_0x7f3d('0x35')]>=0x1){var _0x985022={'messageId':_0x2aa6c4['internal_order_id']};if(_0x34e26a['smsMethod']!=='GP'||!_0x34e26a[_0x7f3d('0x36')]){_0x985022[_0x7f3d('0x37')]=!![];}return _0x2eaa5[_0x7f3d('0x17')](_0x985022);}else{return logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x38'),util[_0x7f3d('0x39')](_0x2aa6c4,{'showHidden':![],'depth':null}));}})[_0x7f3d('0x19')](function(_0x4c99da){return logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),'skebby',util[_0x7f3d('0x39')](_0x4c99da,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7f3d('0x29'),_0x7f3d('0x38'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7f3d('0x3a'):if(_0x34e26a[_0x7f3d('0x20')]){var _0x9daaa1={'recipient':_0x1bb8ec[_0x7f3d('0x21')],'message':_0x1bb8ec[_0x7f3d('0xa')],'sender':_0x34e26a[_0x7f3d('0x3b')]||_0x34e26a[_0x7f3d('0x21')],'authorization':_0x34e26a[_0x7f3d('0x20')]};var _0x30ce57={'method':'POST','uri':_0x7f3d('0x3c'),'body':_0x9daaa1,'json':!![]};rp(_0x30ce57)[_0x7f3d('0x16')](function(_0x5d1008){var _0x4fac57={'messageId':_0x5d1008[_0x7f3d('0x3d')]};if(!_0x34e26a[_0x7f3d('0x36')]){_0x4fac57[_0x7f3d('0x37')]=!![];}return _0x2eaa5['update'](_0x4fac57);})[_0x7f3d('0x19')](function(_0x5a5712){logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x3a'),util['inspect'](_0x5a5712,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x3a'),_0x7f3d('0x3e'));}break;case'clicksend':if(_0x34e26a[_0x7f3d('0x2b')]&&_0x34e26a[_0x7f3d('0x2c')]){var _0x9daaa1={'messages':[{'source':_0x7f3d('0x3f'),'to':_0x1bb8ec[_0x7f3d('0x21')],'body':_0x1bb8ec[_0x7f3d('0xa')],'from':_0x34e26a['senderString']||_0x34e26a[_0x7f3d('0x21')]}]};var _0x5cbc9f=util[_0x7f3d('0x40')]('%s:%s',_0x34e26a['username'],_0x34e26a[_0x7f3d('0x2c')]);var _0x30ce57={'method':_0x7f3d('0x33'),'uri':_0x7f3d('0x41'),'body':_0x9daaa1,'headers':{'Authorization':util[_0x7f3d('0x40')]('Basic\x20%s',new Buffer(_0x5cbc9f)[_0x7f3d('0x42')]('base64'))},'json':!![]};rp(_0x30ce57)[_0x7f3d('0x16')](function(_0x516adb){if(_0x516adb[_0x7f3d('0x43')]>=0xc8&&_0x516adb[_0x7f3d('0x43')]<=0xce){if(_0x516adb[_0x7f3d('0x44')]&&_0x516adb['data'][_0x7f3d('0x45')]>0x0){var _0x1c61f8=_[_0x7f3d('0x46')](_0x516adb[_0x7f3d('0x44')]['messages']);var _0x587b2b={'messageId':_0x1c61f8['message_id']};if(!_0x34e26a[_0x7f3d('0x36')]){_0x587b2b[_0x7f3d('0x37')]=!![];}return _0x2eaa5[_0x7f3d('0x17')](_0x587b2b);}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),'clickSend',util[_0x7f3d('0x39')](_0x516adb,{'showHidden':![],'depth':null}));}}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x47'),util[_0x7f3d('0x39')](_0x516adb,{'showHidden':![],'depth':null}));}})[_0x7f3d('0x19')](function(_0x460e78){logger['error'](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x47'),util[_0x7f3d('0x39')](_0x460e78,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x47'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7f3d('0x48'):if(_0x34e26a[_0x7f3d('0x49')]&&_0x34e26a[_0x7f3d('0x20')]){var _0x9daaa1={'dst':_0x1bb8ec[_0x7f3d('0x21')],'text':_0x1bb8ec['body'],'src':_0x34e26a[_0x7f3d('0x3b')]||_0x34e26a[_0x7f3d('0x21')],'url':_0x34e26a['remote']+_0x7f3d('0x4a')+_0x1bb8ec['id']+_0x7f3d('0x25')+_0x34e26a[_0x7f3d('0x26')]};var _0x5cbc9f=util[_0x7f3d('0x40')]('%s:%s',_0x34e26a[_0x7f3d('0x49')],_0x34e26a[_0x7f3d('0x20')]);var _0x30ce57={'method':_0x7f3d('0x33'),'uri':util['format'](_0x7f3d('0x4b'),_0x34e26a[_0x7f3d('0x49')]),'body':_0x9daaa1,'headers':{'Authorization':util[_0x7f3d('0x40')]('Basic\x20%s',new Buffer(_0x5cbc9f)[_0x7f3d('0x42')]('base64'))},'json':!![]};rp(_0x30ce57)[_0x7f3d('0x16')](function(_0x3cf4af){var _0x160f82={'messageId':_0x3cf4af[_0x7f3d('0x4c')][0x0]};return _0x2eaa5[_0x7f3d('0x17')](_0x160f82);})['catch'](function(_0x18a5c3){logger['error'](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x48'),util[_0x7f3d('0x39')](_0x18a5c3,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x48'),_0x7f3d('0x4d'));}break;case _0x7f3d('0x4e'):if(_0x34e26a[_0x7f3d('0x2b')]&&_0x34e26a[_0x7f3d('0x2c')]){if(_0x34e26a[_0x7f3d('0x4f')]){var _0x19b9a3={'method':_0x7f3d('0x33'),'uri':_0x34e26a['baseUrl']+'/auth/1/session','body':{'username':_0x34e26a[_0x7f3d('0x2b')],'password':_0x34e26a[_0x7f3d('0x2c')]},'json':!![]};return rp(_0x19b9a3)['then'](function(_0x4c2149){var _0x108616={'method':_0x7f3d('0x33'),'uri':_0x34e26a['baseUrl']+_0x7f3d('0x50'),'body':{'messages':[{'from':_0x34e26a[_0x7f3d('0x21')],'destinations':[{'to':_0x1bb8ec[_0x7f3d('0x21')]}],'text':_0x1bb8ec[_0x7f3d('0xa')],'notifyUrl':_0x34e26a[_0x7f3d('0x24')]+_0x7f3d('0x4a')+_0x1bb8ec['id']+_0x7f3d('0x25')+_0x34e26a[_0x7f3d('0x26')],'notifyContentType':_0x7f3d('0x51'),'callbackData':_0x34e26a[_0x7f3d('0x21')]+';'+_0x1bb8ec['body']}]},'headers':{'Authorization':_0x7f3d('0x52')+_0x4c2149[_0x7f3d('0x26')]},'json':!![]};return rp(_0x108616)['then'](function(_0x5e2725){if(_0x5e2725['messages']){var _0x5b178c={'messageId':_0x5e2725[_0x7f3d('0x22')][0x0][_0x7f3d('0x8')]};if(!_0x34e26a[_0x7f3d('0x36')]){_0x5b178c['read']=!![];}return _0x2eaa5[_0x7f3d('0x17')](_0x5b178c);}else{return logger['error'](_0x7f3d('0x28'),_0x7f3d('0x29'),'infobip',util[_0x7f3d('0x39')](_0x5e2725,{'showHidden':![],'depth':null}));}});})[_0x7f3d('0x19')](function(_0x33f047){return logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x4e'),util[_0x7f3d('0x39')](_0x33f047,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x4e'),_0x7f3d('0x53'));}}else{logger[_0x7f3d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7f3d('0x29'),_0x7f3d('0x4e'),_0x7f3d('0x54'));}break;case _0x7f3d('0x55'):var _0xa3a774=require('crypto');if(_0x34e26a[_0x7f3d('0x56')]){var _0x283efb={};_0x283efb[_0x7f3d('0x57')]=_0x34e26a['username'];_0x283efb[_0x7f3d('0x21')]=_0x1bb8ec['phone'];_0x283efb[_0x7f3d('0x58')]=_0x34e26a['phone'];_0x283efb['text']=_0x1bb8ec[_0x7f3d('0xa')];_0x283efb[_0x7f3d('0x59')]=+new Date();var _0x2c6ee='';var _0x36d1b1='';var _0x341b9c=Object[_0x7f3d('0x5a')](_0x283efb);_0x341b9c[_0x7f3d('0x5b')]();for(var _0x3e8343=0x0;_0x3e8343<_0x341b9c[_0x7f3d('0x5c')];_0x3e8343++){if(_0x2c6ee!=''){_0x2c6ee+='&';}_0x2c6ee+=_0x341b9c[_0x3e8343]+'='+encodeURIComponent(_0x283efb[_0x341b9c[_0x3e8343]]);_0x36d1b1+=_0x283efb[_0x341b9c[_0x3e8343]];}_0x36d1b1+=_0x34e26a[_0x7f3d('0x56')];_0x36d1b1=_0xa3a774[_0x7f3d('0x5d')](_0x7f3d('0x5e'))[_0x7f3d('0x17')](_0x36d1b1)[_0x7f3d('0x5f')]('hex');if(_0x2c6ee!==''){_0x2c6ee+='&';}_0x2c6ee+=_0x7f3d('0x60')+_0x36d1b1;var _0x162f33={'method':_0x7f3d('0x30'),'uri':_0x34e26a[_0x7f3d('0x4f')]+_0x7f3d('0x61')+_0x2c6ee,'json':!![]};return rp(_0x162f33)['then'](function(_0x4d2722){var _0x560792=Object['keys'](_0x4d2722);if(_0x4d2722[_0x560792[0x0]][_0x7f3d('0x1a')]&&parseInt(_0x4d2722[_0x560792[0x0]][_0x7f3d('0x1a')])===0x0){var _0xee2eb0={'messageId':_0x4d2722[_0x560792[0x0]][_0x7f3d('0x62')]};if(!_0x34e26a[_0x7f3d('0x36')]){_0xee2eb0[_0x7f3d('0x37')]=!![];}return _0x2eaa5[_0x7f3d('0x17')](_0xee2eb0);}else{return logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),'afterCreate',_0x7f3d('0x55'),util[_0x7f3d('0x39')](_0x4d2722[_0x7f3d('0x1a')],{'showHidden':![],'depth':null}));}})[_0x7f3d('0x19')](function(_0x3e66cb){return logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),'csc',util[_0x7f3d('0x39')](_0x3e66cb,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x55'),'Missing\x20parameters:\x20apiKey');}break;case _0x7f3d('0x63'):if(_0x34e26a[_0x7f3d('0x56')]){var _0x1bbbc3={'method':'POST','uri':_0x7f3d('0x64'),'headers':{'Authorization':_0x34e26a['apiKey']},'body':{'content':_0x1bb8ec[_0x7f3d('0xa')],'to':[_0x1bb8ec[_0x7f3d('0x21')]],'from':_0x34e26a[_0x7f3d('0x21')],'binary':![],'clientMessageId':_0x7f3d('0x65'),'charset':_0x7f3d('0x66')},'json':!![]};rp(_0x1bbbc3)[_0x7f3d('0x16')](function(_0x52f98b){if(!_0x52f98b[_0x7f3d('0x1a')]){var _0x3ca76d={'messageId':_0x52f98b[_0x7f3d('0x22')][0x0][_0x7f3d('0x67')]};if(!_0x34e26a[_0x7f3d('0x36')]){_0x3ca76d['read']=!![];}return _0x2eaa5['update'](_0x3ca76d);}else{return logger['error'](_0x7f3d('0x28'),_0x7f3d('0x29'),'clickatell',util[_0x7f3d('0x39')](_0x52f98b['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x276c0e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7f3d('0x63'),util[_0x7f3d('0x39')](_0x276c0e,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x63'),_0x7f3d('0x68'));}break;case _0x7f3d('0x69'):if(_0x34e26a[_0x7f3d('0x2b')]&&_0x34e26a[_0x7f3d('0x2c')]){var _0x5cbc9f=util[_0x7f3d('0x40')](_0x7f3d('0x6a'),_0x34e26a[_0x7f3d('0x2b')],_0x34e26a[_0x7f3d('0x2c')]);var _0x30ce57={'method':'POST','uri':_0x7f3d('0x6b')+_0x34e26a[_0x7f3d('0x6c')]+_0x7f3d('0x6d'),'body':{'to':[_0x1bb8ec[_0x7f3d('0x21')]],'text':_0x1bb8ec[_0x7f3d('0xa')],'from':_0x34e26a[_0x7f3d('0x21')],'applicationId':_0x34e26a[_0x7f3d('0x6e')]},'headers':{'Authorization':util[_0x7f3d('0x40')](_0x7f3d('0x6f'),new Buffer(_0x5cbc9f)[_0x7f3d('0x42')](_0x7f3d('0x70')))},'json':!![]};rp(_0x30ce57)['then'](function(_0x1e540c){if(_0x1e540c['id']){var _0x22069b={'messageId':_0x1e540c['id']};return _0x2eaa5[_0x7f3d('0x17')](_0x22069b);}else{logger[_0x7f3d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x7f3d('0x39')](_0x1e540c,{'showHidden':![],'depth':null}));}})[_0x7f3d('0x19')](function(_0x1db938){logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x69'),util[_0x7f3d('0x39')](_0x1db938,{'showHidden':![],'depth':null}));});}else{logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x69'),_0x7f3d('0x54'));}break;case _0x7f3d('0x71'):if(_0x34e26a[_0x7f3d('0x56')]){var _0x117cb4={};var _0x162f33={'method':_0x7f3d('0x33'),'uri':_0x7f3d('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x34e26a[_0x7f3d('0x56')],'Content-Type':'application/json'},'body':{'from':_0x34e26a[_0x7f3d('0x21')],'to':_0x1bb8ec[_0x7f3d('0x21')],'text':_0x1bb8ec[_0x7f3d('0xa')]},'json':!![]};return rp(_0x162f33)['then'](function(_0x482b16){if(_0x482b16[_0x7f3d('0x73')]==0xca){_0x117cb4[_0x7f3d('0x74')]=_0x482b16;var _0x2558e1={'method':_0x7f3d('0x33'),'uri':_0x7f3d('0x75'),'headers':{'Authorization':_0x7f3d('0x76')+_0x34e26a[_0x7f3d('0x56')],'Content-Type':_0x7f3d('0x51')},'body':{'refid':_0x117cb4[_0x7f3d('0x74')]['refid']},'json':!![]};return rp(_0x2558e1)[_0x7f3d('0x16')](function(_0x5ec69d){_0x117cb4['status']=_0x5ec69d;var _0x2e26ca={'messageId':_0x117cb4[_0x7f3d('0x74')][_0x7f3d('0x77')],'read':!![]};return _0x2eaa5[_0x7f3d('0x17')](_0x2e26ca);});}else{return logger[_0x7f3d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7f3d('0x29'),_0x7f3d('0x71'),util['inspect'](_0x482b16,{'showHidden':![],'depth':null}));}})[_0x7f3d('0x19')](function(_0x2dfb6d){return logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x71'),util[_0x7f3d('0x39')](_0x2dfb6d,{'showHidden':![],'depth':null}));});}else{return logger[_0x7f3d('0x1a')](_0x7f3d('0x28'),_0x7f3d('0x29'),_0x7f3d('0x71'),_0x7f3d('0x78'));}break;}}})[_0x7f3d('0x79')](function(){_0x18d7f0();});}else{_0x18d7f0();}}},'charset':_0x7f3d('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc207=['hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','finally','utf8mb4','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','toLowerCase','direction','out','UserId','isNil','SmsInteractionId','SmsInteraction','then','catch','secret','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','password','GET','sms','session_key','total_sent','internal_order_id','read','error','inspect','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','update','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','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','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc207,0x96));var _0x7c20=function(_0x57aa39,_0x5b7dd9){_0x57aa39=_0x57aa39-0x0;var _0x1d9f2e=_0xc207[_0x57aa39];return _0x1d9f2e;};'use strict';var _=require(_0x7c20('0x0'));var util=require('util');var logger=require(_0x7c20('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7c20('0x2'));var rp=require(_0x7c20('0x3'));var fs=require('fs');var path=require(_0x7c20('0x4'));var rimraf=require(_0x7c20('0x5'));var config=require(_0x7c20('0x6'));var attributes=require(_0x7c20('0x7'));module[_0x7c20('0x8')]=function(_0x5bdd8d,_0x1a975b){return _0x5bdd8d[_0x7c20('0x9')]('SmsMessage',attributes,{'tableName':_0x7c20('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7c20('0xb')]},{'name':_0x7c20('0xc'),'fields':[_0x7c20('0xd')],'type':_0x7c20('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x243bfb,_0x544832,_0x36ffde){var _0x3225b7=_0x5bdd8d[_0x7c20('0xf')];var _0x210df9=_0x243bfb['get']({'plain':!![]});if(_0x210df9['direction'][_0x7c20('0x10')]()==='in'||_0x210df9[_0x7c20('0x11')][_0x7c20('0x10')]()===_0x7c20('0x12')&&!_0x210df9['secret']&&!_['isNil'](_0x210df9[_0x7c20('0x13')])&&!_[_0x7c20('0x14')](_0x210df9[_0x7c20('0x15')])){_0x3225b7[_0x7c20('0x16')]['findOne']({'where':{'id':_0x210df9[_0x7c20('0x15')]}})[_0x7c20('0x17')](function(_0x25c825){if(_0x25c825){_0x25c825['update']({'lastMsgAt':_0x210df9['createdAt'],'lastMsgDirection':_0x210df9[_0x7c20('0x11')][_0x7c20('0x10')]()});}})[_0x7c20('0x18')](function(_0x3c2d0b){console['error'](_0x3c2d0b);});}if(_0x210df9[_0x7c20('0x11')]===_0x7c20('0x12')&&!_0x210df9[_0x7c20('0x19')]){var _0x2208cd;_0x3225b7[_0x7c20('0x1a')][_0x7c20('0x1b')]({'where':{'id':_0x210df9[_0x7c20('0x1c')]},'raw':!![]})[_0x7c20('0x17')](function(_0xd14759){_0x2208cd=_0xd14759;if(_0x2208cd&&_0x2208cd[_0x7c20('0x1d')]){switch(_0x2208cd[_0x7c20('0x1d')]){case _0x7c20('0x1e'):var _0x18190b=require(_0x7c20('0x1e'));if(_0x2208cd['accountSid']&&_0x2208cd[_0x7c20('0x1f')]&&_0x2208cd[_0x7c20('0x20')]){var _0x51c061=new _0x18190b(_0x2208cd[_0x7c20('0x21')],_0x2208cd[_0x7c20('0x1f')]);_0x51c061[_0x7c20('0x22')][_0x7c20('0x23')]({'body':_0x210df9['body'],'to':_0x210df9[_0x7c20('0x20')],'from':_0x2208cd[_0x7c20('0x20')],'statusCallback':_0x2208cd[_0x7c20('0x24')]+'/api/sms/messages/'+_0x210df9['id']+_0x7c20('0x25')+_0x2208cd[_0x7c20('0x26')]})[_0x7c20('0x17')](function(_0x5555ef){if(_0x5555ef[_0x7c20('0x27')]){return _0x243bfb['update']({'messageId':_0x5555ef[_0x7c20('0x27')]});}})['catch'](function(_0x4b5887){logger['error'](_0x7c20('0x28'),'afterCreate',_0x7c20('0x1e'),util['inspect'](_0x4b5887,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x1e'),_0x7c20('0x2a'));}break;case'skebby':var _0x1a1c2c=_0x7c20('0x2b');if(_0x2208cd['username']&&_0x2208cd['password']){var _0x56dbf1={'recipient':[_0x210df9[_0x7c20('0x20')]],'message':_0x210df9[_0x7c20('0xd')],'message_type':_0x2208cd[_0x7c20('0x2c')]};if(_0x2208cd['smsMethod']&&_0x2208cd['smsMethod']!=='SI'){_0x56dbf1[_0x7c20('0x2d')]=_0x2208cd[_0x7c20('0x20')];}var _0xf8bd7e={'url':_0x1a1c2c+_0x7c20('0x2e')+_0x2208cd[_0x7c20('0x2f')]+_0x7c20('0x30')+_0x2208cd[_0x7c20('0x31')],'method':_0x7c20('0x32')};rp(_0xf8bd7e)[_0x7c20('0x17')](function(_0x151bb5){var _0x1791e3=_0x151bb5['split'](';');var _0x198789={'user_key':_0x1791e3[0x0],'session_key':_0x1791e3[0x1]};_0xf8bd7e={'url':_0x1a1c2c+_0x7c20('0x33'),'method':'POST','headers':{'user_key':_0x198789['user_key'],'Session_key':_0x198789[_0x7c20('0x34')]},'json':!![],'body':_0x56dbf1};return rp(_0xf8bd7e);})[_0x7c20('0x17')](function(_0x336ca0){if(_0x336ca0[_0x7c20('0x35')]>=0x1){var _0x22eea9={'messageId':_0x336ca0[_0x7c20('0x36')]};if(_0x2208cd[_0x7c20('0x2c')]!=='GP'||!_0x2208cd['deliveryReport']){_0x22eea9[_0x7c20('0x37')]=!![];}return _0x243bfb['update'](_0x22eea9);}else{return logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),'skebby',util[_0x7c20('0x39')](_0x336ca0,{'showHidden':![],'depth':null}));}})[_0x7c20('0x18')](function(_0x5f12ca){return logger['error'](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x3a'),util['inspect'](_0x5f12ca,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',_0x7c20('0x3b'));}break;case _0x7c20('0x3c'):if(_0x2208cd[_0x7c20('0x1f')]){var _0x22c845={'recipient':_0x210df9[_0x7c20('0x20')],'message':_0x210df9[_0x7c20('0xd')],'sender':_0x2208cd[_0x7c20('0x3d')]||_0x2208cd[_0x7c20('0x20')],'authorization':_0x2208cd[_0x7c20('0x1f')]};var _0x544832={'method':_0x7c20('0x3e'),'uri':_0x7c20('0x3f'),'body':_0x22c845,'json':!![]};rp(_0x544832)[_0x7c20('0x17')](function(_0x17abf9){var _0x80f218={'messageId':_0x17abf9[_0x7c20('0x40')]};if(!_0x2208cd[_0x7c20('0x41')]){_0x80f218[_0x7c20('0x37')]=!![];}return _0x243bfb[_0x7c20('0x42')](_0x80f218);})['catch'](function(_0x240618){logger[_0x7c20('0x38')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c20('0x29'),_0x7c20('0x3c'),util['inspect'](_0x240618,{'showHidden':![],'depth':null}));});}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x3c'),_0x7c20('0x43'));}break;case _0x7c20('0x44'):if(_0x2208cd[_0x7c20('0x2f')]&&_0x2208cd[_0x7c20('0x31')]){var _0x22c845={'messages':[{'source':_0x7c20('0x45'),'to':_0x210df9[_0x7c20('0x20')],'body':_0x210df9[_0x7c20('0xd')],'from':_0x2208cd['senderString']||_0x2208cd['phone']}]};var _0xe9640a=util[_0x7c20('0x46')](_0x7c20('0x47'),_0x2208cd['username'],_0x2208cd[_0x7c20('0x31')]);var _0x544832={'method':'POST','uri':_0x7c20('0x48'),'body':_0x22c845,'headers':{'Authorization':util[_0x7c20('0x46')](_0x7c20('0x49'),new Buffer(_0xe9640a)[_0x7c20('0x4a')](_0x7c20('0x4b')))},'json':!![]};rp(_0x544832)['then'](function(_0x5bbcdf){if(_0x5bbcdf['http_code']>=0xc8&&_0x5bbcdf[_0x7c20('0x4c')]<=0xce){if(_0x5bbcdf[_0x7c20('0x4d')]&&_0x5bbcdf[_0x7c20('0x4d')][_0x7c20('0x4e')]>0x0){var _0x4adfbe=_[_0x7c20('0x4f')](_0x5bbcdf[_0x7c20('0x4d')]['messages']);var _0x3a30b6={'messageId':_0x4adfbe[_0x7c20('0x50')]};if(!_0x2208cd['deliveryReport']){_0x3a30b6[_0x7c20('0x37')]=!![];}return _0x243bfb['update'](_0x3a30b6);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c20('0x29'),_0x7c20('0x51'),util[_0x7c20('0x39')](_0x5bbcdf,{'showHidden':![],'depth':null}));}}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x51'),util[_0x7c20('0x39')](_0x5bbcdf,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2daa9a){logger[_0x7c20('0x38')](_0x7c20('0x28'),'afterCreate',_0x7c20('0x51'),util['inspect'](_0x2daa9a,{'showHidden':![],'depth':null}));});}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x51'),_0x7c20('0x3b'));}break;case _0x7c20('0x52'):if(_0x2208cd[_0x7c20('0x53')]&&_0x2208cd[_0x7c20('0x1f')]){var _0x22c845={'dst':_0x210df9[_0x7c20('0x20')],'text':_0x210df9['body'],'src':_0x2208cd[_0x7c20('0x3d')]||_0x2208cd[_0x7c20('0x20')],'url':_0x2208cd[_0x7c20('0x24')]+_0x7c20('0x54')+_0x210df9['id']+_0x7c20('0x25')+_0x2208cd[_0x7c20('0x26')]};var _0xe9640a=util[_0x7c20('0x46')]('%s:%s',_0x2208cd['authId'],_0x2208cd['authToken']);var _0x544832={'method':'POST','uri':util[_0x7c20('0x46')](_0x7c20('0x55'),_0x2208cd[_0x7c20('0x53')]),'body':_0x22c845,'headers':{'Authorization':util['format'](_0x7c20('0x49'),new Buffer(_0xe9640a)[_0x7c20('0x4a')](_0x7c20('0x4b')))},'json':!![]};rp(_0x544832)[_0x7c20('0x17')](function(_0x52b9f9){var _0x9d6abc={'messageId':_0x52b9f9['message_uuid'][0x0]};return _0x243bfb[_0x7c20('0x42')](_0x9d6abc);})[_0x7c20('0x18')](function(_0x19cc7b){logger[_0x7c20('0x38')](_0x7c20('0x28'),'afterCreate',_0x7c20('0x52'),util[_0x7c20('0x39')](_0x19cc7b,{'showHidden':![],'depth':null}));});}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x52'),_0x7c20('0x56'));}break;case'infobip':if(_0x2208cd[_0x7c20('0x2f')]&&_0x2208cd[_0x7c20('0x31')]){if(_0x2208cd[_0x7c20('0x57')]){var _0x23733a={'method':_0x7c20('0x3e'),'uri':_0x2208cd[_0x7c20('0x57')]+'/auth/1/session','body':{'username':_0x2208cd[_0x7c20('0x2f')],'password':_0x2208cd['password']},'json':!![]};return rp(_0x23733a)[_0x7c20('0x17')](function(_0x403885){var _0x228d16={'method':'POST','uri':_0x2208cd[_0x7c20('0x57')]+_0x7c20('0x58'),'body':{'messages':[{'from':_0x2208cd[_0x7c20('0x20')],'destinations':[{'to':_0x210df9[_0x7c20('0x20')]}],'text':_0x210df9[_0x7c20('0xd')],'notifyUrl':_0x2208cd[_0x7c20('0x24')]+'/api/sms/messages/'+_0x210df9['id']+_0x7c20('0x25')+_0x2208cd['token'],'notifyContentType':_0x7c20('0x59'),'callbackData':_0x2208cd[_0x7c20('0x20')]+';'+_0x210df9[_0x7c20('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x403885[_0x7c20('0x26')]},'json':!![]};return rp(_0x228d16)[_0x7c20('0x17')](function(_0x43078e){if(_0x43078e[_0x7c20('0x22')]){var _0x1c7a23={'messageId':_0x43078e[_0x7c20('0x22')][0x0][_0x7c20('0xb')]};if(!_0x2208cd[_0x7c20('0x41')]){_0x1c7a23[_0x7c20('0x37')]=!![];}return _0x243bfb['update'](_0x1c7a23);}else{return logger[_0x7c20('0x38')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c20('0x29'),'infobip',util['inspect'](_0x43078e,{'showHidden':![],'depth':null}));}});})[_0x7c20('0x18')](function(_0x19afe2){return logger[_0x7c20('0x38')](_0x7c20('0x28'),'afterCreate',_0x7c20('0x5a'),util[_0x7c20('0x39')](_0x19afe2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c20('0x28'),'afterCreate',_0x7c20('0x5a'),_0x7c20('0x5b'));}}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x5a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7c20('0x5c'):var _0x2589ef=require(_0x7c20('0x5d'));if(_0x2208cd['apiKey']){var _0x28d4b9={};_0x28d4b9[_0x7c20('0x5e')]=_0x2208cd[_0x7c20('0x2f')];_0x28d4b9['phone']=_0x210df9['phone'];_0x28d4b9['sender']=_0x2208cd[_0x7c20('0x20')];_0x28d4b9[_0x7c20('0x5f')]=_0x210df9['body'];_0x28d4b9[_0x7c20('0x60')]=+new Date();var _0x2522e6='';var _0x2bd56b='';var _0x3718a6=Object[_0x7c20('0x61')](_0x28d4b9);_0x3718a6[_0x7c20('0x62')]();for(var _0xb518b1=0x0;_0xb518b1<_0x3718a6[_0x7c20('0x63')];_0xb518b1++){if(_0x2522e6!=''){_0x2522e6+='&';}_0x2522e6+=_0x3718a6[_0xb518b1]+'='+encodeURIComponent(_0x28d4b9[_0x3718a6[_0xb518b1]]);_0x2bd56b+=_0x28d4b9[_0x3718a6[_0xb518b1]];}_0x2bd56b+=_0x2208cd[_0x7c20('0x64')];_0x2bd56b=_0x2589ef[_0x7c20('0x65')]('md5')[_0x7c20('0x42')](_0x2bd56b)['digest'](_0x7c20('0x66'));if(_0x2522e6!==''){_0x2522e6+='&';}_0x2522e6+=_0x7c20('0x67')+_0x2bd56b;var _0xf8bd7e={'method':'GET','uri':_0x2208cd[_0x7c20('0x57')]+_0x7c20('0x68')+_0x2522e6,'json':!![]};return rp(_0xf8bd7e)['then'](function(_0x249a17){var _0x94d6a2=Object[_0x7c20('0x61')](_0x249a17);if(_0x249a17[_0x94d6a2[0x0]][_0x7c20('0x38')]&&parseInt(_0x249a17[_0x94d6a2[0x0]][_0x7c20('0x38')])===0x0){var _0x4f66f9={'messageId':_0x249a17[_0x94d6a2[0x0]][_0x7c20('0x69')]};if(!_0x2208cd[_0x7c20('0x41')]){_0x4f66f9[_0x7c20('0x37')]=!![];}return _0x243bfb['update'](_0x4f66f9);}else{return logger[_0x7c20('0x38')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7c20('0x5c'),util[_0x7c20('0x39')](_0x249a17[_0x7c20('0x38')],{'showHidden':![],'depth':null}));}})[_0x7c20('0x18')](function(_0x2311dc){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c20('0x29'),_0x7c20('0x5c'),util[_0x7c20('0x39')](_0x2311dc,{'showHidden':![],'depth':null}));});}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x5c'),_0x7c20('0x6a'));}break;case'clickatell':if(_0x2208cd[_0x7c20('0x64')]){var _0x12ed91={'method':'POST','uri':_0x7c20('0x6b'),'headers':{'Authorization':_0x2208cd['apiKey']},'body':{'content':_0x210df9[_0x7c20('0xd')],'to':[_0x210df9[_0x7c20('0x20')]],'from':_0x2208cd[_0x7c20('0x20')],'binary':![],'clientMessageId':_0x7c20('0x6c'),'charset':_0x7c20('0x6d')},'json':!![]};rp(_0x12ed91)[_0x7c20('0x17')](function(_0x4154e1){if(!_0x4154e1[_0x7c20('0x38')]){var _0x54e389={'messageId':_0x4154e1[_0x7c20('0x22')][0x0][_0x7c20('0x6e')]};if(!_0x2208cd['deliveryReport']){_0x54e389[_0x7c20('0x37')]=!![];}return _0x243bfb[_0x7c20('0x42')](_0x54e389);}else{return logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x6f'),util['inspect'](_0x4154e1[_0x7c20('0x38')],{'showHidden':![],'depth':null}));}})[_0x7c20('0x18')](function(_0x5582b3){return logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),'clickatell',util['inspect'](_0x5582b3,{'showHidden':![],'depth':null}));});}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x6f'),'Missing\x20parameters:\x20apiKey');}break;case _0x7c20('0x70'):if(_0x2208cd[_0x7c20('0x2f')]&&_0x2208cd['password']){var _0xe9640a=util['format'](_0x7c20('0x47'),_0x2208cd['username'],_0x2208cd[_0x7c20('0x31')]);var _0x544832={'method':_0x7c20('0x3e'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2208cd[_0x7c20('0x71')]+_0x7c20('0x72'),'body':{'to':[_0x210df9[_0x7c20('0x20')]],'text':_0x210df9[_0x7c20('0xd')],'from':_0x2208cd['phone'],'applicationId':_0x2208cd[_0x7c20('0x73')]},'headers':{'Authorization':util[_0x7c20('0x46')](_0x7c20('0x49'),new Buffer(_0xe9640a)[_0x7c20('0x4a')]('base64'))},'json':!![]};rp(_0x544832)[_0x7c20('0x17')](function(_0x222b27){if(_0x222b27['id']){var _0x28ea56={'messageId':_0x222b27['id']};return _0x243bfb[_0x7c20('0x42')](_0x28ea56);}else{logger[_0x7c20('0x38')](_0x7c20('0x28'),'afterCreate',_0x7c20('0x70'),util[_0x7c20('0x39')](_0x222b27,{'showHidden':![],'depth':null}));}})[_0x7c20('0x18')](function(_0x3fb5b3){logger[_0x7c20('0x38')](_0x7c20('0x28'),_0x7c20('0x29'),'bandwidth',util[_0x7c20('0x39')](_0x3fb5b3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c20('0x28'),_0x7c20('0x29'),'bandwidth',_0x7c20('0x3b'));}break;case _0x7c20('0x74'):if(_0x2208cd[_0x7c20('0x64')]){var _0x5a823e={};var _0xf8bd7e={'method':_0x7c20('0x3e'),'uri':_0x7c20('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x2208cd[_0x7c20('0x64')],'Content-Type':_0x7c20('0x59')},'body':{'from':_0x2208cd[_0x7c20('0x20')],'to':_0x210df9[_0x7c20('0x20')],'text':_0x210df9[_0x7c20('0xd')]},'json':!![]};return rp(_0xf8bd7e)[_0x7c20('0x17')](function(_0x19223c){if(_0x19223c[_0x7c20('0x76')]==0xca){_0x5a823e[_0x7c20('0x77')]=_0x19223c;var _0x4d05cd={'method':_0x7c20('0x3e'),'uri':_0x7c20('0x78'),'headers':{'Authorization':_0x7c20('0x79')+_0x2208cd['apiKey'],'Content-Type':_0x7c20('0x59')},'body':{'refid':_0x5a823e[_0x7c20('0x77')][_0x7c20('0x7a')]},'json':!![]};return rp(_0x4d05cd)[_0x7c20('0x17')](function(_0x40e71c){_0x5a823e[_0x7c20('0x7b')]=_0x40e71c;var _0x1a8c1f={'messageId':_0x5a823e[_0x7c20('0x77')]['refid'],'read':!![]};return _0x243bfb['update'](_0x1a8c1f);});}else{return logger['error'](_0x7c20('0x28'),_0x7c20('0x29'),_0x7c20('0x74'),util[_0x7c20('0x39')](_0x19223c,{'showHidden':![],'depth':null}));}})[_0x7c20('0x18')](function(_0x498b95){return logger[_0x7c20('0x38')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c20('0x29'),'intelepeer',util[_0x7c20('0x39')](_0x498b95,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c20('0x29'),_0x7c20('0x74'),'Token\x20not\x20received');}break;}}})[_0x7c20('0x7c')](function(){_0x36ffde();});}else{_0x36ffde();}}},'charset':_0x7c20('0x7d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 89f1689..bdee686 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 _0x4427=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xb1b616,_0x3b9023){var _0x1259b0=function(_0xb2e638){while(--_0xb2e638){_0xb1b616['push'](_0xb1b616['shift']());}};_0x1259b0(++_0x3b9023);}(_0x4427,0xef));var _0x7442=function(_0x56e5a4,_0x3378ff){_0x56e5a4=_0x56e5a4-0x0;var _0x446855=_0x4427[_0x56e5a4];return _0x446855;};'use strict';var _=require(_0x7442('0x0'));var util=require(_0x7442('0x1'));var moment=require(_0x7442('0x2'));var BPromise=require(_0x7442('0x3'));var rs=require(_0x7442('0x4'));var fs=require('fs');var Redis=require(_0x7442('0x5'));var db=require(_0x7442('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7442('0x7'))(_0x7442('0x8'));var config=require(_0x7442('0x9'));var jayson=require(_0x7442('0xa'));var client=jayson[_0x7442('0xb')][_0x7442('0xc')]({'port':0x232a});config['redis']=_[_0x7442('0xd')](config[_0x7442('0xe')],{'host':_0x7442('0xf'),'port':0x18eb});var socket=require(_0x7442('0x10'))(new Redis(config[_0x7442('0xe')]));require('./smsMessage.socket')[_0x7442('0x11')](socket);function respondWithRpcPromise(_0x217268,_0x2030f6,_0x15a92c){return new BPromise(function(_0x433d20,_0x2abf34){return client[_0x7442('0x12')](_0x217268,_0x15a92c)[_0x7442('0x13')](function(_0x5e9b57){logger[_0x7442('0x14')](_0x7442('0x15'),_0x2030f6,_0x7442('0x16'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2030f6,_0x7442('0x16'),JSON[_0x7442('0x17')](_0x5e9b57));if(_0x5e9b57['error']){if(_0x5e9b57['error'][_0x7442('0x18')]===0x1f4){logger[_0x7442('0x19')](_0x7442('0x15'),_0x2030f6,_0x5e9b57[_0x7442('0x19')][_0x7442('0x1a')]);return _0x2abf34(_0x5e9b57[_0x7442('0x19')][_0x7442('0x1a')]);}logger[_0x7442('0x19')](_0x7442('0x15'),_0x2030f6,_0x5e9b57[_0x7442('0x19')]['message']);return _0x433d20(_0x5e9b57['error'][_0x7442('0x1a')]);}else{logger[_0x7442('0x14')](_0x7442('0x15'),_0x2030f6,_0x7442('0x16'));_0x433d20(_0x5e9b57[_0x7442('0x1b')][_0x7442('0x1a')]);}})[_0x7442('0x1c')](function(_0x5c2e74){logger[_0x7442('0x19')](_0x7442('0x15'),_0x2030f6,_0x5c2e74);_0x2abf34(_0x5c2e74);});});}exports[_0x7442('0x1d')]=function(_0xb566cb){var _0x52b5d6=this;return new Promise(function(_0x2b178b,_0x1b023e){return db[_0x7442('0x1e')][_0x7442('0x1f')](_0xb566cb[_0x7442('0x20')],{'raw':_0xb566cb['options']?_0xb566cb['options'][_0x7442('0x21')]===undefined?!![]:![]:!![]})[_0x7442('0x13')](function(_0x1360a5){logger[_0x7442('0x14')](_0x7442('0x1d'),_0xb566cb);logger[_0x7442('0x22')](_0x7442('0x1d'),_0xb566cb,JSON['stringify'](_0x1360a5));_0x2b178b(_0x1360a5);})[_0x7442('0x1c')](function(_0x559843){logger[_0x7442('0x19')](_0x7442('0x1d'),_0x559843[_0x7442('0x1a')],_0xb566cb);_0x1b023e(_0x52b5d6['error'](0x1f4,_0x559843[_0x7442('0x1a')]));});});}; \ No newline at end of file +var _0xb276=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','create','body','options','CreateSmsMessage','lodash','util','moment'];(function(_0x2f31d0,_0x4fce9a){var _0x1d0256=function(_0x3f1ed5){while(--_0x3f1ed5){_0x2f31d0['push'](_0x2f31d0['shift']());}};_0x1d0256(++_0x4fce9a);}(_0xb276,0x1e7));var _0x6b27=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0xb276[_0x11946c];return _0x383935;};'use strict';var _=require(_0x6b27('0x0'));var util=require(_0x6b27('0x1'));var moment=require(_0x6b27('0x2'));var BPromise=require(_0x6b27('0x3'));var rs=require(_0x6b27('0x4'));var fs=require('fs');var Redis=require(_0x6b27('0x5'));var db=require(_0x6b27('0x6'))['db'];var utils=require(_0x6b27('0x7'));var logger=require(_0x6b27('0x8'))(_0x6b27('0x9'));var config=require(_0x6b27('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6b27('0xb')][_0x6b27('0xc')]({'port':0x232a});config[_0x6b27('0xd')]=_[_0x6b27('0xe')](config[_0x6b27('0xd')],{'host':_0x6b27('0xf'),'port':0x18eb});var socket=require(_0x6b27('0x10'))(new Redis(config[_0x6b27('0xd')]));require(_0x6b27('0x11'))[_0x6b27('0x12')](socket);function respondWithRpcPromise(_0x6740f6,_0x547657,_0x38d407){return new BPromise(function(_0x5830c1,_0x3ac066){return client[_0x6b27('0x13')](_0x6740f6,_0x38d407)[_0x6b27('0x14')](function(_0x1872ed){logger[_0x6b27('0x15')]('SmsMessage,\x20%s,\x20%s',_0x547657,_0x6b27('0x16'));logger[_0x6b27('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x547657,'request\x20sent',JSON[_0x6b27('0x18')](_0x1872ed));if(_0x1872ed[_0x6b27('0x19')]){if(_0x1872ed[_0x6b27('0x19')][_0x6b27('0x1a')]===0x1f4){logger[_0x6b27('0x19')](_0x6b27('0x1b'),_0x547657,_0x1872ed[_0x6b27('0x19')][_0x6b27('0x1c')]);return _0x3ac066(_0x1872ed['error'][_0x6b27('0x1c')]);}logger[_0x6b27('0x19')](_0x6b27('0x1b'),_0x547657,_0x1872ed[_0x6b27('0x19')][_0x6b27('0x1c')]);return _0x5830c1(_0x1872ed[_0x6b27('0x19')]['message']);}else{logger[_0x6b27('0x15')](_0x6b27('0x1b'),_0x547657,'request\x20sent');_0x5830c1(_0x1872ed[_0x6b27('0x1d')][_0x6b27('0x1c')]);}})[_0x6b27('0x1e')](function(_0x2b6f1a){logger['error']('SmsMessage,\x20%s,\x20%s',_0x547657,_0x2b6f1a);_0x3ac066(_0x2b6f1a);});});}exports['CreateSmsMessage']=function(_0x104645){var _0xd76c3d=this;return new Promise(function(_0xed7dc0,_0x21ceba){return db['SmsMessage'][_0x6b27('0x1f')](_0x104645[_0x6b27('0x20')],{'raw':_0x104645[_0x6b27('0x21')]?_0x104645[_0x6b27('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6b27('0x14')](function(_0x53092c){logger[_0x6b27('0x15')]('CreateSmsMessage',_0x104645);logger['debug'](_0x6b27('0x22'),_0x104645,JSON['stringify'](_0x53092c));_0xed7dc0(_0x53092c);})[_0x6b27('0x1e')](function(_0x46566e){logger[_0x6b27('0x19')](_0x6b27('0x22'),_0x46566e[_0x6b27('0x1c')],_0x104645);_0x21ceba(_0xd76c3d['error'](0x1f4,_0x46566e[_0x6b27('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fd2a48e..f308d93 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 _0x926d=['removeListener','length','smsMessage:','save','update','emit'];(function(_0x25a6a7,_0x1986cb){var _0x20cfd1=function(_0x520e35){while(--_0x520e35){_0x25a6a7['push'](_0x25a6a7['shift']());}};_0x20cfd1(++_0x1986cb);}(_0x926d,0x75));var _0xd926=function(_0x2899e4,_0x45a511){_0x2899e4=_0x2899e4-0x0;var _0x11d791=_0x926d[_0x2899e4];return _0x11d791;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd926('0x0'),'remove',_0xd926('0x1')];function createListener(_0x456aa9,_0x16a8c){return function(_0x464344){_0x16a8c[_0xd926('0x2')](_0x456aa9,_0x464344);};}function removeListener(_0x3ebced,_0x1aa1b1){return function(){SmsMessageEvents[_0xd926('0x3')](_0x3ebced,_0x1aa1b1);};}exports['register']=function(_0x7fedc1){for(var _0x37cb95=0x0,_0x17cf33=events[_0xd926('0x4')];_0x37cb95<_0x17cf33;_0x37cb95++){var _0xf62a81=events[_0x37cb95];var _0xb7b952=createListener(_0xd926('0x5')+_0xf62a81,_0x7fedc1);SmsMessageEvents['on'](_0xf62a81,_0xb7b952);}}; \ No newline at end of file +var _0x1ef4=['removeListener','register','smsMessage:','./smsMessage.events','remove','update','emit'];(function(_0x3d7add,_0x37bdfe){var _0x55e63b=function(_0x196558){while(--_0x196558){_0x3d7add['push'](_0x3d7add['shift']());}};_0x55e63b(++_0x37bdfe);}(_0x1ef4,0x81));var _0x41ef=function(_0xf2b593,_0x56fbf9){_0xf2b593=_0xf2b593-0x0;var _0x1c86d8=_0x1ef4[_0xf2b593];return _0x1c86d8;};'use strict';var SmsMessageEvents=require(_0x41ef('0x0'));var events=['save',_0x41ef('0x1'),_0x41ef('0x2')];function createListener(_0x39b387,_0x58a713){return function(_0x3ce089){_0x58a713[_0x41ef('0x3')](_0x39b387,_0x3ce089);};}function removeListener(_0x308fc2,_0x43918b){return function(){SmsMessageEvents[_0x41ef('0x4')](_0x308fc2,_0x43918b);};}exports[_0x41ef('0x5')]=function(_0x9af523){for(var _0x53986e=0x0,_0x24ddbc=events['length'];_0x53986e<_0x24ddbc;_0x53986e++){var _0x570ded=events[_0x53986e];var _0x37dc23=createListener(_0x41ef('0x6')+_0x570ded,_0x9af523);SmsMessageEvents['on'](_0x570ded,_0x37dc23);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 992231c..2a189c1 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 _0x89b5=['fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89b5,0x112));var _0x589b=function(_0xa99d55,_0x79e69c){_0xa99d55=_0xa99d55-0x0;var _0x1ca175=_0x89b5[_0xa99d55];return _0x1ca175;};'use strict';var multer=require(_0x589b('0x0'));var util=require(_0x589b('0x1'));var path=require(_0x589b('0x2'));var timeout=require('connect-timeout');var express=require(_0x589b('0x3'));var router=express[_0x589b('0x4')]();var fs_extra=require(_0x589b('0x5'));var auth=require(_0x589b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x589b('0x7'));var controller=require(_0x589b('0x8'));router[_0x589b('0x9')]('/',auth[_0x589b('0xa')](),controller[_0x589b('0xb')]);router[_0x589b('0x9')]('/describe',auth[_0x589b('0xa')](),controller[_0x589b('0xc')]);router['get'](_0x589b('0xd'),auth['isAuthenticated'](),controller[_0x589b('0xe')]);router[_0x589b('0x9')](_0x589b('0xf'),auth[_0x589b('0xa')](),controller[_0x589b('0x10')]);router[_0x589b('0x9')](_0x589b('0x11'),auth[_0x589b('0xa')](),controller[_0x589b('0x12')]);router['get'](_0x589b('0x13'),auth[_0x589b('0xa')](),controller[_0x589b('0x14')]);router[_0x589b('0x15')]('/',auth[_0x589b('0xa')](),controller[_0x589b('0x16')]);router[_0x589b('0x15')](_0x589b('0x11'),auth[_0x589b('0xa')](),controller[_0x589b('0x17')]);router['post']('/:id/users',auth[_0x589b('0xa')](),controller[_0x589b('0x18')]);router[_0x589b('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x589b('0x1a')]);router['delete'](_0x589b('0xd'),auth[_0x589b('0xa')](),controller[_0x589b('0x1b')]);router[_0x589b('0x1c')]('/:id/teams',auth[_0x589b('0xa')](),controller[_0x589b('0x1d')]);router[_0x589b('0x1c')]('/:id/users',auth[_0x589b('0xa')](),controller[_0x589b('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x9dad=['getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','/:id','update','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id/members'];(function(_0xd14a7a,_0x1b5295){var _0x53a9ac=function(_0x10a3a9){while(--_0x10a3a9){_0xd14a7a['push'](_0xd14a7a['shift']());}};_0x53a9ac(++_0x1b5295);}(_0x9dad,0x1f3));var _0xd9da=function(_0x57882e,_0x4e2437){_0x57882e=_0x57882e-0x0;var _0x13a36e=_0x9dad[_0x57882e];return _0x13a36e;};'use strict';var multer=require(_0xd9da('0x0'));var util=require(_0xd9da('0x1'));var path=require(_0xd9da('0x2'));var timeout=require(_0xd9da('0x3'));var express=require('express');var router=express[_0xd9da('0x4')]();var fs_extra=require(_0xd9da('0x5'));var auth=require(_0xd9da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9da('0x7'));var controller=require('./smsQueue.controller');router[_0xd9da('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9da('0x9')]);router['get'](_0xd9da('0xa'),auth[_0xd9da('0xb')](),controller[_0xd9da('0xc')]);router[_0xd9da('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xd9da('0xd'),auth['isAuthenticated'](),controller[_0xd9da('0xe')]);router[_0xd9da('0x8')](_0xd9da('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xd9da('0x8')](_0xd9da('0x10'),auth[_0xd9da('0xb')](),controller['getAgents']);router[_0xd9da('0x11')]('/',auth['isAuthenticated'](),controller[_0xd9da('0x12')]);router[_0xd9da('0x11')](_0xd9da('0xf'),auth[_0xd9da('0xb')](),controller[_0xd9da('0x13')]);router[_0xd9da('0x11')](_0xd9da('0x10'),auth[_0xd9da('0xb')](),controller[_0xd9da('0x14')]);router['put'](_0xd9da('0x15'),auth[_0xd9da('0xb')](),controller[_0xd9da('0x16')]);router['delete']('/:id',auth[_0xd9da('0xb')](),controller[_0xd9da('0x17')]);router[_0xd9da('0x18')]('/:id/teams',auth[_0xd9da('0xb')](),controller[_0xd9da('0x19')]);router[_0xd9da('0x18')](_0xd9da('0x10'),auth[_0xd9da('0xb')](),controller[_0xd9da('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 1608193..f408fdc 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 _0xba1f=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xba1f,0xa6));var _0xfba1=function(_0x309e83,_0x4a8177){_0x309e83=_0x309e83-0x0;var _0x454d7f=_0xba1f[_0x309e83];return _0x454d7f;};'use strict';var Sequelize=require(_0xfba1('0x0'));module[_0xfba1('0x1')]={'name':{'type':Sequelize[_0xfba1('0x2')],'unique':_0xfba1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfba1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfba1('0x5')](_0xfba1('0x6'),_0xfba1('0x7'),_0xfba1('0x8'))}}; \ No newline at end of file +var _0xc6a2=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x414616,_0x48585e){var _0x22a548=function(_0x3027f3){while(--_0x3027f3){_0x414616['push'](_0x414616['shift']());}};_0x22a548(++_0x48585e);}(_0xc6a2,0x198));var _0x2c6a=function(_0x43a3dc,_0x2eb8eb){_0x43a3dc=_0x43a3dc-0x0;var _0x2b804d=_0xc6a2[_0x43a3dc];return _0x2b804d;};'use strict';var Sequelize=require(_0x2c6a('0x0'));module[_0x2c6a('0x1')]={'name':{'type':Sequelize[_0x2c6a('0x2')],'unique':_0x2c6a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2c6a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2c6a('0x4')](_0x2c6a('0x5'),_0x2c6a('0x6'),_0x2c6a('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0cce569..55d127b 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 _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x502a1c,_0x3c8a0f){var _0xf4aef7=function(_0x5a15f7){while(--_0x5a15f7){_0x502a1c['push'](_0x502a1c['shift']());}};_0xf4aef7(++_0x3c8a0f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5eb656,_0x4059bc){_0x5eb656=_0x5eb656-0x0;var _0x4bd9a4=_0x5f2f[_0x5eb656];return _0x4bd9a4;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0xadb5,0xad));var _0x5adb=function(_0x1ebcbe,_0x3fcedd){_0x1ebcbe=_0x1ebcbe-0x0;var _0xfdb7a9=_0xadb5[_0x1ebcbe];return _0xfdb7a9;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ef3b884..56a4a9b 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 _0xa596=['update','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa596,0x15b));var _0x6a59=function(_0x1350bf,_0x4e24e7){_0x1350bf=_0x1350bf-0x0;var _0x327547=_0xa596[_0x1350bf];return _0x327547;};'use strict';var EventEmitter=require(_0x6a59('0x0'));var SmsQueue=require(_0x6a59('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6a59('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6a59('0x3'),'afterDestroy':'remove'};function emitEvent(_0x171d8b){return function(_0x60e9f4,_0x2228a7,_0x1a4bcf){SmsQueueEvents[_0x6a59('0x4')](_0x171d8b+':'+_0x60e9f4['id'],_0x60e9f4);SmsQueueEvents['emit'](_0x171d8b,_0x60e9f4);_0x1a4bcf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x6a59('0x5')](e,emitEvent(event));}}module[_0x6a59('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x404f=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4feb51,_0xb122f5){var _0x26cc87=function(_0x1b55ea){while(--_0x1b55ea){_0x4feb51['push'](_0x4feb51['shift']());}};_0x26cc87(++_0xb122f5);}(_0x404f,0x110));var _0xf404=function(_0x2b11e6,_0x24691a){_0x2b11e6=_0x2b11e6-0x0;var _0x47b8a0=_0x404f[_0x2b11e6];return _0x47b8a0;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xf404('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf404('0x1')](0x0);var events={'afterCreate':_0xf404('0x2'),'afterUpdate':_0xf404('0x3'),'afterDestroy':_0xf404('0x4')};function emitEvent(_0x360805){return function(_0x2bd8d1,_0x2f2720,_0x1cc99c){SmsQueueEvents[_0xf404('0x5')](_0x360805+':'+_0x2bd8d1['id'],_0x2bd8d1);SmsQueueEvents['emit'](_0x360805,_0x2bd8d1);_0x1cc99c(null);};}for(var e in events){if(events[_0xf404('0x6')](e)){var event=events[e];SmsQueue[_0xf404('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1e2eaec..f21a32a 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 _0x8a0b=['define','sms_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x499456,_0x5c83df){var _0x5521e0=function(_0x36b2d1){while(--_0x36b2d1){_0x499456['push'](_0x499456['shift']());}};_0x5521e0(++_0x5c83df);}(_0x8a0b,0x9c));var _0xb8a0=function(_0x9c7078,_0xdcfa44){_0x9c7078=_0x9c7078-0x0;var _0x40a6ef=_0x8a0b[_0x9c7078];return _0x40a6ef;};'use strict';var _=require('lodash');var util=require(_0xb8a0('0x0'));var logger=require(_0xb8a0('0x1'))('api');var moment=require(_0xb8a0('0x2'));var BPromise=require(_0xb8a0('0x3'));var rp=require(_0xb8a0('0x4'));var fs=require('fs');var path=require(_0xb8a0('0x5'));var rimraf=require(_0xb8a0('0x6'));var config=require(_0xb8a0('0x7'));var attributes=require(_0xb8a0('0x8'));module['exports']=function(_0x52ceb5,_0xeb1463){return _0x52ceb5[_0xb8a0('0x9')]('SmsQueue',attributes,{'tableName':_0xb8a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21f2=['moment','request-promise','path','rimraf','define','sms_queues','util','../../config/logger','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x21f2,0x102));var _0x221f=function(_0x2f4e95,_0x8dee12){_0x2f4e95=_0x2f4e95-0x0;var _0x593577=_0x21f2[_0x2f4e95];return _0x593577;};'use strict';var _=require('lodash');var util=require(_0x221f('0x0'));var logger=require(_0x221f('0x1'))(_0x221f('0x2'));var moment=require(_0x221f('0x3'));var BPromise=require('bluebird');var rp=require(_0x221f('0x4'));var fs=require('fs');var path=require(_0x221f('0x5'));var rimraf=require(_0x221f('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0x535194,_0x12ee5f){return _0x535194[_0x221f('0x7')]('SmsQueue',attributes,{'tableName':_0x221f('0x8'),'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 af1c17b..822eada 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 _0x2603=['catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','model','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./smsQueue.socket','request','then','info','debug','request\x20sent','stringify','error','SmsQueue,\x20%s,\x20%s','message','result'];(function(_0x4b6ef3,_0x3e9f59){var _0x512173=function(_0x160850){while(--_0x160850){_0x4b6ef3['push'](_0x4b6ef3['shift']());}};_0x512173(++_0x3e9f59);}(_0x2603,0x15a));var _0x3260=function(_0x32b248,_0x4e4850){_0x32b248=_0x32b248-0x0;var _0x1634c4=_0x2603[_0x32b248];return _0x1634c4;};'use strict';var _=require(_0x3260('0x0'));var util=require(_0x3260('0x1'));var moment=require(_0x3260('0x2'));var BPromise=require(_0x3260('0x3'));var rs=require(_0x3260('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3260('0x5'))(_0x3260('0x6'));var config=require(_0x3260('0x7'));var jayson=require(_0x3260('0x8'));var client=jayson[_0x3260('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3260('0xa'),'port':0x18eb});var socket=require(_0x3260('0xb'))(new Redis(config[_0x3260('0xc')]));require(_0x3260('0xd'))['register'](socket);function respondWithRpcPromise(_0x177da5,_0x2b902b,_0x3582a5){return new BPromise(function(_0x34cb5f,_0x10df8f){return client[_0x3260('0xe')](_0x177da5,_0x3582a5)[_0x3260('0xf')](function(_0x5a4d94){logger[_0x3260('0x10')]('SmsQueue,\x20%s,\x20%s',_0x2b902b,'request\x20sent');logger[_0x3260('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2b902b,_0x3260('0x12'),JSON[_0x3260('0x13')](_0x5a4d94));if(_0x5a4d94[_0x3260('0x14')]){if(_0x5a4d94['error']['code']===0x1f4){logger[_0x3260('0x14')](_0x3260('0x15'),_0x2b902b,_0x5a4d94[_0x3260('0x14')]['message']);return _0x10df8f(_0x5a4d94['error'][_0x3260('0x16')]);}logger[_0x3260('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2b902b,_0x5a4d94['error'][_0x3260('0x16')]);return _0x34cb5f(_0x5a4d94[_0x3260('0x14')][_0x3260('0x16')]);}else{logger[_0x3260('0x10')](_0x3260('0x15'),_0x2b902b,_0x3260('0x12'));_0x34cb5f(_0x5a4d94[_0x3260('0x17')][_0x3260('0x16')]);}})[_0x3260('0x18')](function(_0x68e4dc){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2b902b,_0x68e4dc);_0x10df8f(_0x68e4dc);});});}exports[_0x3260('0x19')]=function(_0x25db8f){var _0x202f08=this;return new Promise(function(_0xbf34cf,_0x58c630){return db[_0x3260('0x1a')][_0x3260('0x1b')]({'raw':_0x25db8f[_0x3260('0x1c')]?_0x25db8f[_0x3260('0x1c')][_0x3260('0x1d')]===undefined?!![]:![]:!![],'where':_0x25db8f[_0x3260('0x1c')]?_0x25db8f['options'][_0x3260('0x1e')]||null:null,'attributes':_0x25db8f[_0x3260('0x1c')]?_0x25db8f[_0x3260('0x1c')][_0x3260('0x1f')]||null:null,'limit':_0x25db8f[_0x3260('0x1c')]?_0x25db8f['options']['limit']||null:null,'include':_0x25db8f[_0x3260('0x1c')]?_0x25db8f[_0x3260('0x1c')][_0x3260('0x20')]?_[_0x3260('0x21')](_0x25db8f[_0x3260('0x1c')][_0x3260('0x20')],function(_0x30ec4a){return{'model':db[_0x30ec4a[_0x3260('0x22')]],'as':_0x30ec4a['as'],'attributes':_0x30ec4a[_0x3260('0x1f')],'include':_0x30ec4a['include']?_[_0x3260('0x21')](_0x30ec4a[_0x3260('0x20')],function(_0x59b6c0){return{'model':db[_0x59b6c0[_0x3260('0x22')]],'as':_0x59b6c0['as'],'attributes':_0x59b6c0[_0x3260('0x1f')],'include':_0x59b6c0[_0x3260('0x20')]?_[_0x3260('0x21')](_0x59b6c0['include'],function(_0x46c152){return{'model':db[_0x46c152['model']],'as':_0x46c152['as'],'attributes':_0x46c152[_0x3260('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3260('0xf')](function(_0x478dcf){logger[_0x3260('0x10')](_0x3260('0x19'),_0x25db8f);logger[_0x3260('0x11')](_0x3260('0x19'),_0x25db8f,JSON[_0x3260('0x13')](_0x478dcf));_0xbf34cf(_0x478dcf);})[_0x3260('0x18')](function(_0x2d7de1){logger[_0x3260('0x14')]('GetSmsQueue',_0x2d7de1['message'],_0x25db8f);_0x58c630(_0x202f08['error'](0x1f4,_0x2d7de1[_0x3260('0x16')]));});});};exports[_0x3260('0x23')]=function(_0xfe010){var _0x48c9c0=this;return new Promise(function(_0x16eca7,_0x7556db){return db['SmsQueue'][_0x3260('0x24')]({'raw':_0xfe010['options']?_0xfe010[_0x3260('0x1c')][_0x3260('0x1d')]===undefined?!![]:![]:!![],'where':_0xfe010[_0x3260('0x1c')]?_0xfe010[_0x3260('0x1c')][_0x3260('0x1e')]||null:null,'attributes':_0xfe010[_0x3260('0x1c')]?_0xfe010['options'][_0x3260('0x1f')]||null:null,'include':_0xfe010[_0x3260('0x1c')]?_0xfe010['options']['include']?_[_0x3260('0x21')](_0xfe010[_0x3260('0x1c')]['include'],function(_0x42f998){return{'model':db[_0x42f998[_0x3260('0x22')]],'as':_0x42f998['as'],'attributes':_0x42f998[_0x3260('0x1f')],'include':_0x42f998[_0x3260('0x20')]?_[_0x3260('0x21')](_0x42f998[_0x3260('0x20')],function(_0x25ce19){return{'model':db[_0x25ce19[_0x3260('0x22')]],'as':_0x25ce19['as'],'attributes':_0x25ce19[_0x3260('0x1f')],'include':_0x25ce19[_0x3260('0x20')]?_['map'](_0x25ce19['include'],function(_0x184cb1){return{'model':db[_0x184cb1[_0x3260('0x22')]],'as':_0x184cb1['as'],'attributes':_0x184cb1[_0x3260('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3260('0xf')](function(_0x30027c){logger[_0x3260('0x10')]('ShowSmsQueue',_0xfe010);logger[_0x3260('0x11')](_0x3260('0x23'),_0xfe010,JSON[_0x3260('0x13')](_0x30027c));_0x16eca7(_0x30027c);})['catch'](function(_0x4710c1){logger[_0x3260('0x14')](_0x3260('0x23'),_0x4710c1['message'],_0xfe010);_0x7556db(_0x48c9c0[_0x3260('0x14')](0x1f4,_0x4710c1['message']));});});}; \ No newline at end of file +var _0x18d9=['options','raw','attributes','map','include','model','where','ShowSmsQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','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','code','error','message','result','catch','GetSmsQueue'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0x18d9,0x1aa));var _0x918d=function(_0x449504,_0x1aa353){_0x449504=_0x449504-0x0;var _0x5f532d=_0x18d9[_0x449504];return _0x5f532d;};'use strict';var _=require('lodash');var util=require(_0x918d('0x0'));var moment=require(_0x918d('0x1'));var BPromise=require(_0x918d('0x2'));var rs=require(_0x918d('0x3'));var fs=require('fs');var Redis=require(_0x918d('0x4'));var db=require(_0x918d('0x5'))['db'];var utils=require(_0x918d('0x6'));var logger=require(_0x918d('0x7'))('rpc');var config=require(_0x918d('0x8'));var jayson=require(_0x918d('0x9'));var client=jayson[_0x918d('0xa')][_0x918d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x918d('0xc'),'port':0x18eb});var socket=require(_0x918d('0xd'))(new Redis(config['redis']));require(_0x918d('0xe'))[_0x918d('0xf')](socket);function respondWithRpcPromise(_0x45765c,_0x1c4e31,_0x533234){return new BPromise(function(_0xb5b9f5,_0x5dcd75){return client[_0x918d('0x10')](_0x45765c,_0x533234)[_0x918d('0x11')](function(_0x308e64){logger[_0x918d('0x12')](_0x918d('0x13'),_0x1c4e31,_0x918d('0x14'));logger[_0x918d('0x15')](_0x918d('0x16'),_0x1c4e31,_0x918d('0x14'),JSON[_0x918d('0x17')](_0x308e64));if(_0x308e64['error']){if(_0x308e64['error'][_0x918d('0x18')]===0x1f4){logger[_0x918d('0x19')](_0x918d('0x13'),_0x1c4e31,_0x308e64[_0x918d('0x19')]['message']);return _0x5dcd75(_0x308e64[_0x918d('0x19')][_0x918d('0x1a')]);}logger['error'](_0x918d('0x13'),_0x1c4e31,_0x308e64[_0x918d('0x19')][_0x918d('0x1a')]);return _0xb5b9f5(_0x308e64[_0x918d('0x19')]['message']);}else{logger[_0x918d('0x12')](_0x918d('0x13'),_0x1c4e31,_0x918d('0x14'));_0xb5b9f5(_0x308e64[_0x918d('0x1b')][_0x918d('0x1a')]);}})[_0x918d('0x1c')](function(_0x284609){logger[_0x918d('0x19')](_0x918d('0x13'),_0x1c4e31,_0x284609);_0x5dcd75(_0x284609);});});}exports[_0x918d('0x1d')]=function(_0x4bb560){var _0xee987f=this;return new Promise(function(_0x545a21,_0x13db04){return db['SmsQueue']['findAll']({'raw':_0x4bb560[_0x918d('0x1e')]?_0x4bb560[_0x918d('0x1e')][_0x918d('0x1f')]===undefined?!![]:![]:!![],'where':_0x4bb560[_0x918d('0x1e')]?_0x4bb560[_0x918d('0x1e')]['where']||null:null,'attributes':_0x4bb560['options']?_0x4bb560[_0x918d('0x1e')][_0x918d('0x20')]||null:null,'limit':_0x4bb560[_0x918d('0x1e')]?_0x4bb560['options']['limit']||null:null,'include':_0x4bb560[_0x918d('0x1e')]?_0x4bb560[_0x918d('0x1e')]['include']?_[_0x918d('0x21')](_0x4bb560[_0x918d('0x1e')][_0x918d('0x22')],function(_0x26e8a3){return{'model':db[_0x26e8a3[_0x918d('0x23')]],'as':_0x26e8a3['as'],'attributes':_0x26e8a3['attributes'],'include':_0x26e8a3['include']?_['map'](_0x26e8a3[_0x918d('0x22')],function(_0x48482d){return{'model':db[_0x48482d[_0x918d('0x23')]],'as':_0x48482d['as'],'attributes':_0x48482d[_0x918d('0x20')],'include':_0x48482d[_0x918d('0x22')]?_[_0x918d('0x21')](_0x48482d['include'],function(_0x5e5539){return{'model':db[_0x5e5539[_0x918d('0x23')]],'as':_0x5e5539['as'],'attributes':_0x5e5539[_0x918d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x918d('0x11')](function(_0xefee51){logger['info'](_0x918d('0x1d'),_0x4bb560);logger['debug'](_0x918d('0x1d'),_0x4bb560,JSON[_0x918d('0x17')](_0xefee51));_0x545a21(_0xefee51);})['catch'](function(_0x3b55fd){logger[_0x918d('0x19')]('GetSmsQueue',_0x3b55fd[_0x918d('0x1a')],_0x4bb560);_0x13db04(_0xee987f[_0x918d('0x19')](0x1f4,_0x3b55fd[_0x918d('0x1a')]));});});};exports['ShowSmsQueue']=function(_0x11b8b7){var _0x1fc369=this;return new Promise(function(_0x4d32ac,_0x5e02cb){return db['SmsQueue']['find']({'raw':_0x11b8b7[_0x918d('0x1e')]?_0x11b8b7['options'][_0x918d('0x1f')]===undefined?!![]:![]:!![],'where':_0x11b8b7['options']?_0x11b8b7[_0x918d('0x1e')][_0x918d('0x24')]||null:null,'attributes':_0x11b8b7[_0x918d('0x1e')]?_0x11b8b7['options'][_0x918d('0x20')]||null:null,'include':_0x11b8b7['options']?_0x11b8b7['options']['include']?_[_0x918d('0x21')](_0x11b8b7[_0x918d('0x1e')]['include'],function(_0xf511c1){return{'model':db[_0xf511c1[_0x918d('0x23')]],'as':_0xf511c1['as'],'attributes':_0xf511c1[_0x918d('0x20')],'include':_0xf511c1[_0x918d('0x22')]?_[_0x918d('0x21')](_0xf511c1[_0x918d('0x22')],function(_0x234efe){return{'model':db[_0x234efe[_0x918d('0x23')]],'as':_0x234efe['as'],'attributes':_0x234efe[_0x918d('0x20')],'include':_0x234efe[_0x918d('0x22')]?_[_0x918d('0x21')](_0x234efe[_0x918d('0x22')],function(_0x5393ee){return{'model':db[_0x5393ee[_0x918d('0x23')]],'as':_0x5393ee['as'],'attributes':_0x5393ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x918d('0x11')](function(_0x331d18){logger[_0x918d('0x12')](_0x918d('0x25'),_0x11b8b7);logger[_0x918d('0x15')](_0x918d('0x25'),_0x11b8b7,JSON[_0x918d('0x17')](_0x331d18));_0x4d32ac(_0x331d18);})['catch'](function(_0x16d59e){logger[_0x918d('0x19')]('ShowSmsQueue',_0x16d59e['message'],_0x11b8b7);_0x5e02cb(_0x1fc369[_0x918d('0x19')](0x1f4,_0x16d59e[_0x918d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 4528e6b..7c847ca 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 _0xa6f4=['length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0xb7edba,_0x327bb9){var _0x46fba0=function(_0x408723){while(--_0x408723){_0xb7edba['push'](_0xb7edba['shift']());}};_0x46fba0(++_0x327bb9);}(_0xa6f4,0x182));var _0x4a6f=function(_0x3c15c2,_0x15bfa3){_0x3c15c2=_0x3c15c2-0x0;var _0x41b21a=_0xa6f4[_0x3c15c2];return _0x41b21a;};'use strict';var SmsQueueEvents=require(_0x4a6f('0x0'));var events=[_0x4a6f('0x1'),_0x4a6f('0x2'),_0x4a6f('0x3')];function createListener(_0x4d82e3,_0x15c837){return function(_0x491291){_0x15c837[_0x4a6f('0x4')](_0x4d82e3,_0x491291);};}function removeListener(_0x26344f,_0x2485b7){return function(){SmsQueueEvents[_0x4a6f('0x5')](_0x26344f,_0x2485b7);};}exports['register']=function(_0x2f7532){for(var _0x5e49df=0x0,_0xe96ab5=events[_0x4a6f('0x6')];_0x5e49df<_0xe96ab5;_0x5e49df++){var _0x373c40=events[_0x5e49df];var _0x1db7e5=createListener(_0x4a6f('0x7')+_0x373c40,_0x2f7532);SmsQueueEvents['on'](_0x373c40,_0x1db7e5);}}; \ No newline at end of file +var _0x099f=['smsQueue:','./smsQueue.events','save','remove','removeListener','register','length'];(function(_0x4da8ee,_0x318f64){var _0x27ec7a=function(_0x3b6c05){while(--_0x3b6c05){_0x4da8ee['push'](_0x4da8ee['shift']());}};_0x27ec7a(++_0x318f64);}(_0x099f,0xa2));var _0xf099=function(_0x1af90b,_0x263d9f){_0x1af90b=_0x1af90b-0x0;var _0x322722=_0x099f[_0x1af90b];return _0x322722;};'use strict';var SmsQueueEvents=require(_0xf099('0x0'));var events=[_0xf099('0x1'),_0xf099('0x2'),'update'];function createListener(_0x5679ce,_0x360b8e){return function(_0x2be107){_0x360b8e['emit'](_0x5679ce,_0x2be107);};}function removeListener(_0x3f651b,_0x1399e4){return function(){SmsQueueEvents[_0xf099('0x3')](_0x3f651b,_0x1399e4);};}exports[_0xf099('0x4')]=function(_0x12d6f4){for(var _0x1ebb36=0x0,_0x1768c0=events[_0xf099('0x5')];_0x1ebb36<_0x1768c0;_0x1ebb36++){var _0x3453ce=events[_0x1ebb36];var _0x521c2b=createListener(_0xf099('0x6')+_0x3453ce,_0x12d6f4);SmsQueueEvents['on'](_0x3453ce,_0x521c2b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index cfe4b54..2c43968 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 _0xdd41=['../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x30f1b6,_0x3d7012){var _0x1c04a6=function(_0x132775){while(--_0x132775){_0x30f1b6['push'](_0x30f1b6['shift']());}};_0x1c04a6(++_0x3d7012);}(_0xdd41,0x1f2));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var path=require(_0x1dd4('0x2'));var timeout=require(_0x1dd4('0x3'));var express=require('express');var router=express[_0x1dd4('0x4')]();var fs_extra=require(_0x1dd4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1dd4('0x6'));var controller=require(_0x1dd4('0x7'));router['get']('/',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x9')]);router['get'](_0x1dd4('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x1dd4('0x8')](),controller['show']);router[_0x1dd4('0xb')]('/',auth[_0x1dd4('0x8')](),controller[_0x1dd4('0xc')]);router[_0x1dd4('0xd')]('/:id',auth[_0x1dd4('0x8')](),controller['update']);router[_0x1dd4('0xe')](_0x1dd4('0xf'),auth[_0x1dd4('0x8')](),controller[_0x1dd4('0x10')]);module[_0x1dd4('0x11')]=router; \ No newline at end of file +var _0x366c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x495516,_0x23f91c){var _0x3752f9=function(_0xbb29fb){while(--_0xbb29fb){_0x495516['push'](_0x495516['shift']());}};_0x3752f9(++_0x23f91c);}(_0x366c,0x9d));var _0xc366=function(_0x59fc79,_0xc7c03){_0x59fc79=_0x59fc79-0x0;var _0x52843d=_0x366c[_0x59fc79];return _0x52843d;};'use strict';var multer=require(_0xc366('0x0'));var util=require(_0xc366('0x1'));var path=require(_0xc366('0x2'));var timeout=require('connect-timeout');var express=require(_0xc366('0x3'));var router=express[_0xc366('0x4')]();var fs_extra=require(_0xc366('0x5'));var auth=require(_0xc366('0x6'));var interaction=require(_0xc366('0x7'));var config=require(_0xc366('0x8'));var controller=require(_0xc366('0x9'));router[_0xc366('0xa')]('/',auth[_0xc366('0xb')](),controller['index']);router['get'](_0xc366('0xc'),auth[_0xc366('0xb')](),controller[_0xc366('0xd')]);router[_0xc366('0xa')](_0xc366('0xe'),auth[_0xc366('0xb')](),controller[_0xc366('0xf')]);router[_0xc366('0x10')]('/',auth[_0xc366('0xb')](),controller[_0xc366('0x11')]);router[_0xc366('0x12')]('/:id',auth[_0xc366('0xb')](),controller[_0xc366('0x13')]);router[_0xc366('0x14')](_0xc366('0xe'),auth[_0xc366('0xb')](),controller[_0xc366('0x15')]);module[_0xc366('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index bac49f1..df0c930 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 _0x0704=['STRING','DATE','moment','exports'];(function(_0x42bd62,_0x27ccd5){var _0x1fe155=function(_0x38a321){while(--_0x38a321){_0x42bd62['push'](_0x42bd62['shift']());}};_0x1fe155(++_0x27ccd5);}(_0x0704,0x1c2));var _0x4070=function(_0x21df89,_0x3c65f5){_0x21df89=_0x21df89-0x0;var _0x4fb7fb=_0x0704[_0x21df89];return _0x4fb7fb;};'use strict';var moment=require(_0x4070('0x0'));var Sequelize=require('sequelize');module[_0x4070('0x1')]={'uniqueid':{'type':Sequelize[_0x4070('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4070('0x2')]},'joinAt':{'type':Sequelize[_0x4070('0x3')]},'leaveAt':{'type':Sequelize[_0x4070('0x3')]},'acceptAt':{'type':Sequelize[_0x4070('0x3')]},'exitAt':{'type':Sequelize[_0x4070('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x71e1=['STRING','DATE','moment','sequelize','exports'];(function(_0x19d469,_0x4051be){var _0x2fb44f=function(_0x37d37f){while(--_0x37d37f){_0x19d469['push'](_0x19d469['shift']());}};_0x2fb44f(++_0x4051be);}(_0x71e1,0x1b0));var _0x171e=function(_0x243211,_0x5275d5){_0x243211=_0x243211-0x0;var _0x2d8008=_0x71e1[_0x243211];return _0x2d8008;};'use strict';var moment=require(_0x171e('0x0'));var Sequelize=require(_0x171e('0x1'));module[_0x171e('0x2')]={'uniqueid':{'type':Sequelize[_0x171e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x171e('0x3')]},'joinAt':{'type':Sequelize[_0x171e('0x4')]},'leaveAt':{'type':Sequelize[_0x171e('0x4')]},'acceptAt':{'type':Sequelize[_0x171e('0x4')]},'exitAt':{'type':Sequelize[_0x171e('0x4')]},'reason':{'type':Sequelize[_0x171e('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index db8a853..2983389 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 _0x8854=['params','length','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','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','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','keys','intersection','attributes','model','query','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8854,0x9b));var _0x4885=function(_0x5e441d,_0x2ded46){_0x5e441d=_0x5e441d-0x0;var _0x45d04c=_0x8854[_0x5e441d];return _0x45d04c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4885('0x0'));var zipdir=require(_0x4885('0x1'));var jsonpatch=require(_0x4885('0x2'));var rp=require(_0x4885('0x3'));var moment=require(_0x4885('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4885('0x5'));var util=require('util');var path=require(_0x4885('0x6'));var sox=require('sox');var csv=require(_0x4885('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4885('0x8'));var _=require(_0x4885('0x9'));var squel=require(_0x4885('0xa'));var crypto=require(_0x4885('0xb'));var jsforce=require(_0x4885('0xc'));var deskjs=require(_0x4885('0xd'));var toCsv=require(_0x4885('0x7'));var querystring=require(_0x4885('0xe'));var Papa=require('papaparse');var Redis=require(_0x4885('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4885('0x10'));var as=require(_0x4885('0x11'));var hardwareService=require(_0x4885('0x12'));var logger=require(_0x4885('0x13'))(_0x4885('0x14'));var utils=require(_0x4885('0x15'));var config=require(_0x4885('0x16'));var licenseUtil=require(_0x4885('0x17'));var db=require(_0x4885('0x18'))['db'];function respondWithStatusCode(_0x369cef,_0xc4ccd9){_0xc4ccd9=_0xc4ccd9||0xcc;return function(_0x3c05c8){if(_0x3c05c8){return _0x369cef[_0x4885('0x19')](_0xc4ccd9);}return _0x369cef['status'](_0xc4ccd9)['end']();};}function respondWithResult(_0x237f0d,_0x3d9ebe){_0x3d9ebe=_0x3d9ebe||0xc8;return function(_0x22875b){if(_0x22875b){return _0x237f0d[_0x4885('0x1a')](_0x3d9ebe)['json'](_0x22875b);}};}function respondWithFilteredResult(_0x52b8c8,_0x511533){return function(_0x3b984d){if(_0x3b984d){var _0x56a269=typeof _0x511533[_0x4885('0x1b')]===_0x4885('0x1c')&&typeof _0x511533[_0x4885('0x1d')]===_0x4885('0x1c');var _0x53b6e2=_0x3b984d[_0x4885('0x1e')];var _0x570a9b=_0x56a269?0x0:_0x511533[_0x4885('0x1b')];var _0x15ee0e=_0x56a269?_0x3b984d[_0x4885('0x1e')]:_0x511533[_0x4885('0x1b')]+_0x511533[_0x4885('0x1d')];var _0x6ea3d0;if(_0x15ee0e>=_0x53b6e2){_0x15ee0e=_0x53b6e2;_0x6ea3d0=0xc8;}else{_0x6ea3d0=0xce;}_0x52b8c8[_0x4885('0x1a')](_0x6ea3d0);return _0x52b8c8[_0x4885('0x1f')](_0x4885('0x20'),_0x570a9b+'-'+_0x15ee0e+'/'+_0x53b6e2)['json'](_0x3b984d);}return null;};}function patchUpdates(_0x3b476b){return function(_0x50cf1b){try{jsonpatch[_0x4885('0x21')](_0x50cf1b,_0x3b476b,!![]);}catch(_0x5026e8){return BPromise['reject'](_0x5026e8);}return _0x50cf1b[_0x4885('0x22')]();};}function saveUpdates(_0x59629e,_0x266d0c){return function(_0x2bcd32){if(_0x2bcd32){return _0x2bcd32[_0x4885('0x23')](_0x59629e)[_0x4885('0x24')](function(_0x42511b){return _0x42511b;});}return null;};}function removeEntity(_0x2e99b3,_0x164342){return function(_0x544812){if(_0x544812){return _0x544812[_0x4885('0x25')]()[_0x4885('0x24')](function(){_0x2e99b3[_0x4885('0x1a')](0xcc)[_0x4885('0x26')]();});}};}function handleEntityNotFound(_0x217fe3,_0x3e5d1a){return function(_0x36c6b2){if(!_0x36c6b2){_0x217fe3[_0x4885('0x19')](0x194);}return _0x36c6b2;};}function handleError(_0x38cfae,_0x2ba684){_0x2ba684=_0x2ba684||0x1f4;return function(_0x290493){logger['error'](_0x290493['stack']);if(_0x290493[_0x4885('0x27')]){delete _0x290493['name'];}_0x38cfae['status'](_0x2ba684)[_0x4885('0x28')](_0x290493);};}exports[_0x4885('0x29')]=function(_0x43d363,_0x3f8c21){var _0x535c1e={},_0x47787d={},_0x34550b={'count':0x0,'rows':[]};var _0x12a04f=_[_0x4885('0x2a')](db[_0x4885('0x2b')][_0x4885('0x2c')],function(_0x3b6914){return{'name':_0x3b6914[_0x4885('0x2d')],'type':_0x3b6914['type'][_0x4885('0x2e')]};});_0x47787d['model']=_[_0x4885('0x2a')](_0x12a04f,_0x4885('0x27'));_0x47787d['query']=_[_0x4885('0x2f')](_0x43d363['query']);_0x47787d['filters']=_[_0x4885('0x30')](_0x47787d['model'],_0x47787d['query']);_0x535c1e[_0x4885('0x31')]=_['intersection'](_0x47787d[_0x4885('0x32')],qs['fields'](_0x43d363[_0x4885('0x33')][_0x4885('0x34')]));_0x535c1e[_0x4885('0x31')]=_0x535c1e[_0x4885('0x31')]['length']?_0x535c1e[_0x4885('0x31')]:_0x47787d[_0x4885('0x32')];if(!_0x43d363['query'][_0x4885('0x35')](_0x4885('0x36'))){_0x535c1e[_0x4885('0x1d')]=qs[_0x4885('0x1d')](_0x43d363[_0x4885('0x33')]['limit']);_0x535c1e['offset']=qs[_0x4885('0x1b')](_0x43d363[_0x4885('0x33')][_0x4885('0x1b')]);}_0x535c1e['order']=qs[_0x4885('0x37')](_0x43d363[_0x4885('0x33')]['sort']);_0x535c1e[_0x4885('0x38')]=qs[_0x4885('0x39')](_['pick'](_0x43d363['query'],_0x47787d['filters']),_0x12a04f);if(_0x43d363[_0x4885('0x33')][_0x4885('0x3a')]){_0x535c1e[_0x4885('0x38')]=_[_0x4885('0x3b')](_0x535c1e[_0x4885('0x38')],{'$or':_[_0x4885('0x2a')](_0x12a04f,function(_0x57d6d6){if(_0x57d6d6['type']!==_0x4885('0x3c')){var _0x40672d={};_0x40672d[_0x57d6d6['name']]={'$like':'%'+_0x43d363[_0x4885('0x33')]['filter']+'%'};return _0x40672d;}})});}_0x535c1e=_[_0x4885('0x3b')]({},_0x535c1e,_0x43d363[_0x4885('0x3d')]);var _0x2a910f={'where':_0x535c1e[_0x4885('0x38')]};return db[_0x4885('0x2b')]['count'](_0x2a910f)[_0x4885('0x24')](function(_0x448a29){_0x34550b[_0x4885('0x1e')]=_0x448a29;if(_0x43d363['query'][_0x4885('0x3e')]){_0x535c1e['include']=[{'all':!![]}];}return db[_0x4885('0x2b')][_0x4885('0x3f')](_0x535c1e);})[_0x4885('0x24')](function(_0x9e2f10){_0x34550b[_0x4885('0x40')]=_0x9e2f10;return _0x34550b;})[_0x4885('0x24')](respondWithFilteredResult(_0x3f8c21,_0x535c1e))[_0x4885('0x41')](handleError(_0x3f8c21,null));};exports[_0x4885('0x42')]=function(_0x1a5abb,_0x2972bb){var _0x33f397={'raw':!![],'where':{'id':_0x1a5abb[_0x4885('0x43')]['id']}},_0x5647da={};_0x5647da['model']=_[_0x4885('0x2f')](db[_0x4885('0x2b')]['rawAttributes']);_0x5647da[_0x4885('0x33')]=_['keys'](_0x1a5abb[_0x4885('0x33')]);_0x5647da[_0x4885('0x39')]=_[_0x4885('0x30')](_0x5647da[_0x4885('0x32')],_0x5647da['query']);_0x33f397[_0x4885('0x31')]=_[_0x4885('0x30')](_0x5647da[_0x4885('0x32')],qs[_0x4885('0x34')](_0x1a5abb[_0x4885('0x33')][_0x4885('0x34')]));_0x33f397[_0x4885('0x31')]=_0x33f397[_0x4885('0x31')][_0x4885('0x44')]?_0x33f397[_0x4885('0x31')]:_0x5647da[_0x4885('0x32')];if(_0x1a5abb['query'][_0x4885('0x3e')]){_0x33f397[_0x4885('0x45')]=[{'all':!![]}];}_0x33f397=_[_0x4885('0x3b')]({},_0x33f397,_0x1a5abb[_0x4885('0x3d')]);return db[_0x4885('0x2b')][_0x4885('0x46')](_0x33f397)[_0x4885('0x24')](handleEntityNotFound(_0x2972bb,null))[_0x4885('0x24')](respondWithResult(_0x2972bb,null))['catch'](handleError(_0x2972bb,null));};exports[_0x4885('0x47')]=function(_0x1ea79c,_0x42c0dd){return db[_0x4885('0x2b')][_0x4885('0x47')](_0x1ea79c['body'],{})['then'](respondWithResult(_0x42c0dd,0xc9))[_0x4885('0x41')](handleError(_0x42c0dd,null));};exports[_0x4885('0x23')]=function(_0x1c5f28,_0x18b808){if(_0x1c5f28[_0x4885('0x48')]['id']){delete _0x1c5f28[_0x4885('0x48')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x1c5f28[_0x4885('0x43')]['id']}})[_0x4885('0x24')](handleEntityNotFound(_0x18b808,null))['then'](saveUpdates(_0x1c5f28['body'],null))[_0x4885('0x24')](respondWithResult(_0x18b808,null))[_0x4885('0x41')](handleError(_0x18b808,null));};exports[_0x4885('0x25')]=function(_0x5d1a3e,_0x2b0011){return db[_0x4885('0x2b')][_0x4885('0x46')]({'where':{'id':_0x5d1a3e[_0x4885('0x43')]['id']}})[_0x4885('0x24')](handleEntityNotFound(_0x2b0011,null))[_0x4885('0x24')](removeEntity(_0x2b0011,null))['catch'](handleError(_0x2b0011,null));};exports[_0x4885('0x49')]=function(_0x356d7a,_0x5f43ec){return db[_0x4885('0x2b')][_0x4885('0x49')]()[_0x4885('0x24')](respondWithResult(_0x5f43ec,null))[_0x4885('0x41')](handleError(_0x5f43ec,null));}; \ No newline at end of file +var _0x46dd=['includeAll','include','findAll','rows','catch','show','params','keys','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','SmsQueueReport'];(function(_0x103670,_0x8adb94){var _0x109fb2=function(_0x1c001b){while(--_0x1c001b){_0x103670['push'](_0x103670['shift']());}};_0x109fb2(++_0x8adb94);}(_0x46dd,0xde));var _0xd46d=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x46dd[_0x3cba93];return _0x4a2991;};'use strict';var emlformat=require(_0xd46d('0x0'));var rimraf=require(_0xd46d('0x1'));var zipdir=require(_0xd46d('0x2'));var jsonpatch=require(_0xd46d('0x3'));var rp=require(_0xd46d('0x4'));var moment=require('moment');var BPromise=require(_0xd46d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd46d('0x6'));var csv=require(_0xd46d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd46d('0x8'));var _=require(_0xd46d('0x9'));var squel=require(_0xd46d('0xa'));var crypto=require('crypto');var jsforce=require(_0xd46d('0xb'));var deskjs=require(_0xd46d('0xc'));var toCsv=require(_0xd46d('0x7'));var querystring=require(_0xd46d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd46d('0xe'));var as=require(_0xd46d('0xf'));var hardwareService=require(_0xd46d('0x10'));var logger=require(_0xd46d('0x11'))(_0xd46d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29d8c0,_0x33e79d){_0x33e79d=_0x33e79d||0xcc;return function(_0x583ad9){if(_0x583ad9){return _0x29d8c0['sendStatus'](_0x33e79d);}return _0x29d8c0[_0xd46d('0x13')](_0x33e79d)[_0xd46d('0x14')]();};}function respondWithResult(_0x196a8b,_0x308d84){_0x308d84=_0x308d84||0xc8;return function(_0x4adfa3){if(_0x4adfa3){return _0x196a8b[_0xd46d('0x13')](_0x308d84)[_0xd46d('0x15')](_0x4adfa3);}};}function respondWithFilteredResult(_0x3baaec,_0x4af4e9){return function(_0x59a12e){if(_0x59a12e){var _0x1c7def=typeof _0x4af4e9[_0xd46d('0x16')]===_0xd46d('0x17')&&typeof _0x4af4e9['limit']==='undefined';var _0x541388=_0x59a12e[_0xd46d('0x18')];var _0x4b6e0d=_0x1c7def?0x0:_0x4af4e9[_0xd46d('0x16')];var _0x3a36bc=_0x1c7def?_0x59a12e[_0xd46d('0x18')]:_0x4af4e9[_0xd46d('0x16')]+_0x4af4e9[_0xd46d('0x19')];var _0x319967;if(_0x3a36bc>=_0x541388){_0x3a36bc=_0x541388;_0x319967=0xc8;}else{_0x319967=0xce;}_0x3baaec[_0xd46d('0x13')](_0x319967);return _0x3baaec['set'](_0xd46d('0x1a'),_0x4b6e0d+'-'+_0x3a36bc+'/'+_0x541388)['json'](_0x59a12e);}return null;};}function patchUpdates(_0x49f8ac){return function(_0x305931){try{jsonpatch[_0xd46d('0x1b')](_0x305931,_0x49f8ac,!![]);}catch(_0x38a3b6){return BPromise[_0xd46d('0x1c')](_0x38a3b6);}return _0x305931[_0xd46d('0x1d')]();};}function saveUpdates(_0x2cbeaa,_0x4d2a61){return function(_0x59df67){if(_0x59df67){return _0x59df67[_0xd46d('0x1e')](_0x2cbeaa)[_0xd46d('0x1f')](function(_0x39df43){return _0x39df43;});}return null;};}function removeEntity(_0x2522eb,_0x518752){return function(_0x96d894){if(_0x96d894){return _0x96d894['destroy']()[_0xd46d('0x1f')](function(){_0x2522eb[_0xd46d('0x13')](0xcc)[_0xd46d('0x14')]();});}};}function handleEntityNotFound(_0x3d3dbb,_0x263302){return function(_0x479877){if(!_0x479877){_0x3d3dbb['sendStatus'](0x194);}return _0x479877;};}function handleError(_0xde9e45,_0x42746a){_0x42746a=_0x42746a||0x1f4;return function(_0x2b6c04){logger[_0xd46d('0x20')](_0x2b6c04[_0xd46d('0x21')]);if(_0x2b6c04[_0xd46d('0x22')]){delete _0x2b6c04['name'];}_0xde9e45[_0xd46d('0x13')](_0x42746a)[_0xd46d('0x23')](_0x2b6c04);};}exports['index']=function(_0x22710d,_0xecbb31){var _0x247c9f={},_0x468606={},_0x24e8b1={'count':0x0,'rows':[]};var _0x2bc1ea=_[_0xd46d('0x24')](db['SmsQueueReport'][_0xd46d('0x25')],function(_0x539baa){return{'name':_0x539baa[_0xd46d('0x26')],'type':_0x539baa['type'][_0xd46d('0x27')]};});_0x468606[_0xd46d('0x28')]=_[_0xd46d('0x24')](_0x2bc1ea,_0xd46d('0x22'));_0x468606[_0xd46d('0x29')]=_['keys'](_0x22710d['query']);_0x468606[_0xd46d('0x2a')]=_['intersection'](_0x468606['model'],_0x468606[_0xd46d('0x29')]);_0x247c9f['attributes']=_[_0xd46d('0x2b')](_0x468606[_0xd46d('0x28')],qs[_0xd46d('0x2c')](_0x22710d['query'][_0xd46d('0x2c')]));_0x247c9f[_0xd46d('0x2d')]=_0x247c9f[_0xd46d('0x2d')][_0xd46d('0x2e')]?_0x247c9f[_0xd46d('0x2d')]:_0x468606['model'];if(!_0x22710d[_0xd46d('0x29')][_0xd46d('0x2f')](_0xd46d('0x30'))){_0x247c9f['limit']=qs[_0xd46d('0x19')](_0x22710d[_0xd46d('0x29')][_0xd46d('0x19')]);_0x247c9f['offset']=qs[_0xd46d('0x16')](_0x22710d[_0xd46d('0x29')][_0xd46d('0x16')]);}_0x247c9f[_0xd46d('0x31')]=qs[_0xd46d('0x32')](_0x22710d[_0xd46d('0x29')][_0xd46d('0x32')]);_0x247c9f['where']=qs['filters'](_[_0xd46d('0x33')](_0x22710d[_0xd46d('0x29')],_0x468606[_0xd46d('0x2a')]),_0x2bc1ea);if(_0x22710d['query'][_0xd46d('0x34')]){_0x247c9f['where']=_[_0xd46d('0x35')](_0x247c9f['where'],{'$or':_[_0xd46d('0x24')](_0x2bc1ea,function(_0x409acb){if(_0x409acb[_0xd46d('0x36')]!==_0xd46d('0x37')){var _0x2acbe1={};_0x2acbe1[_0x409acb[_0xd46d('0x22')]]={'$like':'%'+_0x22710d[_0xd46d('0x29')][_0xd46d('0x34')]+'%'};return _0x2acbe1;}})});}_0x247c9f=_[_0xd46d('0x35')]({},_0x247c9f,_0x22710d[_0xd46d('0x38')]);var _0x48b311={'where':_0x247c9f['where']};return db[_0xd46d('0x39')][_0xd46d('0x18')](_0x48b311)[_0xd46d('0x1f')](function(_0x233e4e){_0x24e8b1[_0xd46d('0x18')]=_0x233e4e;if(_0x22710d['query'][_0xd46d('0x3a')]){_0x247c9f[_0xd46d('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xd46d('0x3c')](_0x247c9f);})[_0xd46d('0x1f')](function(_0x3dde19){_0x24e8b1[_0xd46d('0x3d')]=_0x3dde19;return _0x24e8b1;})[_0xd46d('0x1f')](respondWithFilteredResult(_0xecbb31,_0x247c9f))[_0xd46d('0x3e')](handleError(_0xecbb31,null));};exports[_0xd46d('0x3f')]=function(_0x58cefa,_0x276bca){var _0xc34eab={'raw':!![],'where':{'id':_0x58cefa[_0xd46d('0x40')]['id']}},_0x251032={};_0x251032[_0xd46d('0x28')]=_[_0xd46d('0x41')](db[_0xd46d('0x39')]['rawAttributes']);_0x251032[_0xd46d('0x29')]=_['keys'](_0x58cefa[_0xd46d('0x29')]);_0x251032[_0xd46d('0x2a')]=_[_0xd46d('0x2b')](_0x251032['model'],_0x251032[_0xd46d('0x29')]);_0xc34eab[_0xd46d('0x2d')]=_[_0xd46d('0x2b')](_0x251032[_0xd46d('0x28')],qs['fields'](_0x58cefa[_0xd46d('0x29')][_0xd46d('0x2c')]));_0xc34eab[_0xd46d('0x2d')]=_0xc34eab[_0xd46d('0x2d')][_0xd46d('0x2e')]?_0xc34eab['attributes']:_0x251032[_0xd46d('0x28')];if(_0x58cefa[_0xd46d('0x29')][_0xd46d('0x3a')]){_0xc34eab[_0xd46d('0x3b')]=[{'all':!![]}];}_0xc34eab=_['merge']({},_0xc34eab,_0x58cefa['options']);return db[_0xd46d('0x39')][_0xd46d('0x42')](_0xc34eab)[_0xd46d('0x1f')](handleEntityNotFound(_0x276bca,null))['then'](respondWithResult(_0x276bca,null))[_0xd46d('0x3e')](handleError(_0x276bca,null));};exports['create']=function(_0x2fddbb,_0x5477a3){return db[_0xd46d('0x39')]['create'](_0x2fddbb[_0xd46d('0x43')],{})['then'](respondWithResult(_0x5477a3,0xc9))[_0xd46d('0x3e')](handleError(_0x5477a3,null));};exports[_0xd46d('0x1e')]=function(_0x4d55c7,_0x28103b){if(_0x4d55c7['body']['id']){delete _0x4d55c7[_0xd46d('0x43')]['id'];}return db[_0xd46d('0x39')]['find']({'where':{'id':_0x4d55c7['params']['id']}})['then'](handleEntityNotFound(_0x28103b,null))[_0xd46d('0x1f')](saveUpdates(_0x4d55c7[_0xd46d('0x43')],null))[_0xd46d('0x1f')](respondWithResult(_0x28103b,null))[_0xd46d('0x3e')](handleError(_0x28103b,null));};exports[_0xd46d('0x44')]=function(_0x3d3256,_0x28744b){return db['SmsQueueReport'][_0xd46d('0x42')]({'where':{'id':_0x3d3256[_0xd46d('0x40')]['id']}})[_0xd46d('0x1f')](handleEntityNotFound(_0x28744b,null))[_0xd46d('0x1f')](removeEntity(_0x28744b,null))[_0xd46d('0x3e')](handleError(_0x28744b,null));};exports[_0xd46d('0x45')]=function(_0x36eced,_0x5194fd){return db[_0xd46d('0x39')]['describe']()[_0xd46d('0x1f')](respondWithResult(_0x5194fd,null))['catch'](handleError(_0x5194fd,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 98f1419..5996170 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_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'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1ee150,_0x2e21d1){var _0x1cc5e3=function(_0xb7cf63){while(--_0xb7cf63){_0x1ee150['push'](_0x1ee150['shift']());}};_0x1cc5e3(++_0x2e21d1);}(_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('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ad1a7b6..c31cee6 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 _0x2133=['attributes','limit','UpdateSmsQueueReport','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','debug','update','raw','where'];(function(_0x320000,_0x2d4067){var _0x1f6901=function(_0x268106){while(--_0x268106){_0x320000['push'](_0x320000['shift']());}};_0x1f6901(++_0x2d4067);}(_0x2133,0x148));var _0x3213=function(_0x43b03c,_0x59c2a4){_0x43b03c=_0x43b03c-0x0;var _0x37937b=_0x2133[_0x43b03c];return _0x37937b;};'use strict';var _=require(_0x3213('0x0'));var util=require(_0x3213('0x1'));var moment=require(_0x3213('0x2'));var BPromise=require(_0x3213('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3213('0x4'));var db=require(_0x3213('0x5'))['db'];var utils=require(_0x3213('0x6'));var logger=require(_0x3213('0x7'))(_0x3213('0x8'));var config=require(_0x3213('0x9'));var jayson=require(_0x3213('0xa'));var client=jayson[_0x3213('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22692a,_0x2967c2,_0x186cb8){return new BPromise(function(_0x14efd7,_0x2da116){return client[_0x3213('0xc')](_0x22692a,_0x186cb8)[_0x3213('0xd')](function(_0x3f3fa8){logger['info'](_0x3213('0xe'),_0x2967c2,_0x3213('0xf'));logger['debug'](_0x3213('0x10'),_0x2967c2,_0x3213('0xf'),JSON[_0x3213('0x11')](_0x3f3fa8));if(_0x3f3fa8[_0x3213('0x12')]){if(_0x3f3fa8['error'][_0x3213('0x13')]===0x1f4){logger[_0x3213('0x12')](_0x3213('0xe'),_0x2967c2,_0x3f3fa8[_0x3213('0x12')][_0x3213('0x14')]);return _0x2da116(_0x3f3fa8['error']['message']);}logger['error'](_0x3213('0xe'),_0x2967c2,_0x3f3fa8['error'][_0x3213('0x14')]);return _0x14efd7(_0x3f3fa8['error'][_0x3213('0x14')]);}else{logger[_0x3213('0x15')](_0x3213('0xe'),_0x2967c2,_0x3213('0xf'));_0x14efd7(_0x3f3fa8[_0x3213('0x16')][_0x3213('0x14')]);}})['catch'](function(_0x37be73){logger[_0x3213('0x12')](_0x3213('0xe'),_0x2967c2,_0x37be73);_0x2da116(_0x37be73);});});}exports[_0x3213('0x17')]=function(_0xea380d){var _0x40bd09=this;return new Promise(function(_0x283baa,_0xc180d2){return db[_0x3213('0x18')][_0x3213('0x19')](_0xea380d[_0x3213('0x1a')],{'raw':_0xea380d['options']?_0xea380d[_0x3213('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3213('0xd')](function(_0x461abc){logger[_0x3213('0x15')](_0x3213('0x17'),_0xea380d);logger[_0x3213('0x1c')]('CreateSmsQueueReport',_0xea380d,JSON[_0x3213('0x11')](_0x461abc));_0x283baa(_0x461abc);})['catch'](function(_0x14a9d8){logger[_0x3213('0x12')](_0x3213('0x17'),_0x14a9d8[_0x3213('0x14')],_0xea380d);_0xc180d2(_0x40bd09['error'](0x1f4,_0x14a9d8[_0x3213('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x5826b7){var _0x4a0ee9=this;return new Promise(function(_0x330b12,_0x5583db){return db[_0x3213('0x18')][_0x3213('0x1d')](_0x5826b7['body'],{'raw':_0x5826b7[_0x3213('0x1b')]?_0x5826b7[_0x3213('0x1b')][_0x3213('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5826b7[_0x3213('0x1b')]?_0x5826b7[_0x3213('0x1b')][_0x3213('0x1f')]||null:null,'attributes':_0x5826b7[_0x3213('0x1b')]?_0x5826b7[_0x3213('0x1b')][_0x3213('0x20')]||null:null,'limit':_0x5826b7[_0x3213('0x1b')]?_0x5826b7[_0x3213('0x1b')][_0x3213('0x21')]||null:null})[_0x3213('0xd')](function(_0x2758ce){logger[_0x3213('0x15')]('UpdateSmsQueueReport',_0x5826b7);logger[_0x3213('0x1c')](_0x3213('0x22'),_0x5826b7,JSON[_0x3213('0x11')](_0x2758ce));_0x330b12(_0x2758ce);})[_0x3213('0x23')](function(_0x70fb6e){logger[_0x3213('0x12')](_0x3213('0x22'),_0x70fb6e[_0x3213('0x14')],_0x5826b7);_0x5583db(_0x4a0ee9['error'](0x1f4,_0x70fb6e[_0x3213('0x14')]));});});}; \ No newline at end of file +var _0x05a0=['SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','update','where','UpdateSmsQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x19e666,_0x5cd717){var _0x32db83=function(_0x29e47a){while(--_0x29e47a){_0x19e666['push'](_0x19e666['shift']());}};_0x32db83(++_0x5cd717);}(_0x05a0,0xc8));var _0x005a=function(_0x27afd8,_0x519f7b){_0x27afd8=_0x27afd8-0x0;var _0x305c32=_0x05a0[_0x27afd8];return _0x305c32;};'use strict';var _=require(_0x005a('0x0'));var util=require(_0x005a('0x1'));var moment=require(_0x005a('0x2'));var BPromise=require(_0x005a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005a('0x4'));var db=require(_0x005a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x005a('0x6'));var jayson=require(_0x005a('0x7'));var client=jayson[_0x005a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x228b18,_0xd5a70e,_0x56f33c){return new BPromise(function(_0x164701,_0x1b1b02){return client[_0x005a('0x9')](_0x228b18,_0x56f33c)[_0x005a('0xa')](function(_0x18a1a7){logger[_0x005a('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0xd5a70e,_0x005a('0xc'));logger[_0x005a('0xd')](_0x005a('0xe'),_0xd5a70e,_0x005a('0xc'),JSON['stringify'](_0x18a1a7));if(_0x18a1a7['error']){if(_0x18a1a7[_0x005a('0xf')][_0x005a('0x10')]===0x1f4){logger[_0x005a('0xf')](_0x005a('0x11'),_0xd5a70e,_0x18a1a7['error'][_0x005a('0x12')]);return _0x1b1b02(_0x18a1a7[_0x005a('0xf')][_0x005a('0x12')]);}logger[_0x005a('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0xd5a70e,_0x18a1a7[_0x005a('0xf')][_0x005a('0x12')]);return _0x164701(_0x18a1a7[_0x005a('0xf')]['message']);}else{logger[_0x005a('0xb')](_0x005a('0x11'),_0xd5a70e,'request\x20sent');_0x164701(_0x18a1a7[_0x005a('0x13')][_0x005a('0x12')]);}})[_0x005a('0x14')](function(_0x4f5faf){logger[_0x005a('0xf')](_0x005a('0x11'),_0xd5a70e,_0x4f5faf);_0x1b1b02(_0x4f5faf);});});}exports[_0x005a('0x15')]=function(_0x3f01a9){var _0x2e59e1=this;return new Promise(function(_0x35aaa5,_0x456351){return db[_0x005a('0x16')][_0x005a('0x17')](_0x3f01a9[_0x005a('0x18')],{'raw':_0x3f01a9[_0x005a('0x19')]?_0x3f01a9[_0x005a('0x19')][_0x005a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4d456d){logger[_0x005a('0xb')](_0x005a('0x15'),_0x3f01a9);logger[_0x005a('0xd')](_0x005a('0x15'),_0x3f01a9,JSON[_0x005a('0x1b')](_0x4d456d));_0x35aaa5(_0x4d456d);})['catch'](function(_0x2f80c4){logger[_0x005a('0xf')](_0x005a('0x15'),_0x2f80c4['message'],_0x3f01a9);_0x456351(_0x2e59e1['error'](0x1f4,_0x2f80c4[_0x005a('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x2404a6){var _0x101eb9=this;return new Promise(function(_0x49974a,_0x687049){return db[_0x005a('0x16')][_0x005a('0x1c')](_0x2404a6['body'],{'raw':_0x2404a6[_0x005a('0x19')]?_0x2404a6[_0x005a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2404a6[_0x005a('0x19')]?_0x2404a6[_0x005a('0x19')][_0x005a('0x1d')]||null:null,'attributes':_0x2404a6[_0x005a('0x19')]?_0x2404a6[_0x005a('0x19')]['attributes']||null:null,'limit':_0x2404a6[_0x005a('0x19')]?_0x2404a6['options']['limit']||null:null})[_0x005a('0xa')](function(_0x1da255){logger[_0x005a('0xb')](_0x005a('0x1e'),_0x2404a6);logger[_0x005a('0xd')]('UpdateSmsQueueReport',_0x2404a6,JSON[_0x005a('0x1b')](_0x1da255));_0x49974a(_0x1da255);})[_0x005a('0x14')](function(_0xd5f8ed){logger[_0x005a('0xf')](_0x005a('0x1e'),_0xd5f8ed['message'],_0x2404a6);_0x687049(_0x101eb9[_0x005a('0xf')](0x1f4,_0xd5f8ed[_0x005a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 805f499..d3e6065 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 _0x4006=['path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4006,0x1c7));var _0x6400=function(_0x40b17e,_0x5f4814){_0x40b17e=_0x40b17e-0x0;var _0x530d9c=_0x4006[_0x40b17e];return _0x530d9c;};'use strict';var multer=require('multer');var util=require(_0x6400('0x0'));var path=require(_0x6400('0x1'));var timeout=require(_0x6400('0x2'));var express=require(_0x6400('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6400('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6400('0x5'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x6400('0x6')](),controller['index']);router[_0x6400('0x7')](_0x6400('0x8'),auth[_0x6400('0x6')](),controller[_0x6400('0x9')]);router['get'](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xb')]);router[_0x6400('0xc')]('/',auth[_0x6400('0x6')](),controller[_0x6400('0xd')]);router[_0x6400('0xe')](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xf')]);router[_0x6400('0x10')]('/:id',auth[_0x6400('0x6')](),controller[_0x6400('0x11')]);module[_0x6400('0x12')]=router; \ No newline at end of file +var _0x0faf=['./smsTransferReport.controller','isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x278509,_0x44a32c){var _0x501232=function(_0x6a812b){while(--_0x6a812b){_0x278509['push'](_0x278509['shift']());}};_0x501232(++_0x44a32c);}(_0x0faf,0x132));var _0xf0fa=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x0faf[_0x5cbace];return _0x6de5b8;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),auth[_0xf0fa('0xa')](),controller['describe']);router[_0xf0fa('0xc')](_0xf0fa('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xf0fa('0xf')]('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x10')]);router[_0xf0fa('0x11')](_0xf0fa('0xe'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x12')]);router[_0xf0fa('0x13')]('/:id',auth[_0xf0fa('0xa')](),controller['destroy']);module[_0xf0fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d8dc25b..dba0904 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x12b294,_0x192e53){var _0x7b92cb=function(_0x16898e){while(--_0x16898e){_0x12b294['push'](_0x12b294['shift']());}};_0x7b92cb(++_0x192e53);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x26b1cc,_0x32f3a){var _0x44b8ce=function(_0x423a6b){while(--_0x423a6b){_0x26b1cc['push'](_0x26b1cc['shift']());}};_0x44b8ce(++_0x32f3a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5c77fa,_0x12d176){_0x5c77fa=_0x5c77fa-0x0;var _0x38e350=_0xf4eb[_0x5c77fa];return _0x38e350;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b007954..226f1fa 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 _0xe1a5=['json','offset','undefined','limit','count','apply','reject','update','then','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','intersection','length','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x55e724,_0x8f22f1){var _0x1b317c=function(_0x21d4dd){while(--_0x21d4dd){_0x55e724['push'](_0x55e724['shift']());}};_0x1b317c(++_0x8f22f1);}(_0xe1a5,0x6e));var _0x5e1a=function(_0x38bf0b,_0x4783cb){_0x38bf0b=_0x38bf0b-0x0;var _0x1fe78d=_0xe1a5[_0x38bf0b];return _0x1fe78d;};'use strict';var emlformat=require(_0x5e1a('0x0'));var rimraf=require(_0x5e1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e1a('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(_0x5e1a('0x3'));var sox=require(_0x5e1a('0x4'));var csv=require('to-csv');var ejs=require(_0x5e1a('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e1a('0x6'));var squel=require(_0x5e1a('0x7'));var crypto=require('crypto');var jsforce=require(_0x5e1a('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x5e1a('0x9'));var querystring=require(_0x5e1a('0xa'));var Papa=require(_0x5e1a('0xb'));var Redis=require('ioredis');var authService=require(_0x5e1a('0xc'));var qs=require(_0x5e1a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e1a('0xe'));var logger=require(_0x5e1a('0xf'))(_0x5e1a('0x10'));var utils=require(_0x5e1a('0x11'));var config=require(_0x5e1a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e1a('0x13'))['db'];function respondWithStatusCode(_0xc87eab,_0x1dc1d1){_0x1dc1d1=_0x1dc1d1||0xcc;return function(_0x585464){if(_0x585464){return _0xc87eab[_0x5e1a('0x14')](_0x1dc1d1);}return _0xc87eab[_0x5e1a('0x15')](_0x1dc1d1)['end']();};}function respondWithResult(_0x498153,_0x4efdaa){_0x4efdaa=_0x4efdaa||0xc8;return function(_0x37fb3a){if(_0x37fb3a){return _0x498153[_0x5e1a('0x15')](_0x4efdaa)[_0x5e1a('0x16')](_0x37fb3a);}};}function respondWithFilteredResult(_0x492323,_0x519e39){return function(_0x103c2c){if(_0x103c2c){var _0xfd46d7=typeof _0x519e39[_0x5e1a('0x17')]===_0x5e1a('0x18')&&typeof _0x519e39[_0x5e1a('0x19')]==='undefined';var _0x5b99d4=_0x103c2c[_0x5e1a('0x1a')];var _0x294386=_0xfd46d7?0x0:_0x519e39[_0x5e1a('0x17')];var _0x779d7d=_0xfd46d7?_0x103c2c[_0x5e1a('0x1a')]:_0x519e39[_0x5e1a('0x17')]+_0x519e39['limit'];var _0x167fbd;if(_0x779d7d>=_0x5b99d4){_0x779d7d=_0x5b99d4;_0x167fbd=0xc8;}else{_0x167fbd=0xce;}_0x492323[_0x5e1a('0x15')](_0x167fbd);return _0x492323['set']('Content-Range',_0x294386+'-'+_0x779d7d+'/'+_0x5b99d4)[_0x5e1a('0x16')](_0x103c2c);}return null;};}function patchUpdates(_0x104cff){return function(_0x286d0a){try{jsonpatch[_0x5e1a('0x1b')](_0x286d0a,_0x104cff,!![]);}catch(_0x5ec543){return BPromise[_0x5e1a('0x1c')](_0x5ec543);}return _0x286d0a['save']();};}function saveUpdates(_0x4edf8a,_0x42f8f1){return function(_0x450eb4){if(_0x450eb4){return _0x450eb4[_0x5e1a('0x1d')](_0x4edf8a)[_0x5e1a('0x1e')](function(_0x431580){return _0x431580;});}return null;};}function removeEntity(_0x226de3,_0x253bf0){return function(_0x5f1e27){if(_0x5f1e27){return _0x5f1e27['destroy']()[_0x5e1a('0x1e')](function(){_0x226de3['status'](0xcc)[_0x5e1a('0x1f')]();});}};}function handleEntityNotFound(_0x4ebc60,_0xfb5f62){return function(_0x385ae7){if(!_0x385ae7){_0x4ebc60[_0x5e1a('0x14')](0x194);}return _0x385ae7;};}function handleError(_0x4d682f,_0x2fc8c8){_0x2fc8c8=_0x2fc8c8||0x1f4;return function(_0x25f169){logger[_0x5e1a('0x20')](_0x25f169[_0x5e1a('0x21')]);if(_0x25f169[_0x5e1a('0x22')]){delete _0x25f169[_0x5e1a('0x22')];}_0x4d682f[_0x5e1a('0x15')](_0x2fc8c8)['send'](_0x25f169);};}exports[_0x5e1a('0x23')]=function(_0x5ac109,_0x32f92e){var _0x539de3={},_0x2644e1={},_0x36df30={'count':0x0,'rows':[]};var _0x4f44e5=_[_0x5e1a('0x24')](db[_0x5e1a('0x25')][_0x5e1a('0x26')],function(_0x189799){return{'name':_0x189799[_0x5e1a('0x27')],'type':_0x189799[_0x5e1a('0x28')][_0x5e1a('0x29')]};});_0x2644e1[_0x5e1a('0x2a')]=_[_0x5e1a('0x24')](_0x4f44e5,'name');_0x2644e1['query']=_[_0x5e1a('0x2b')](_0x5ac109[_0x5e1a('0x2c')]);_0x2644e1[_0x5e1a('0x2d')]=_['intersection'](_0x2644e1[_0x5e1a('0x2a')],_0x2644e1[_0x5e1a('0x2c')]);_0x539de3[_0x5e1a('0x2e')]=_['intersection'](_0x2644e1[_0x5e1a('0x2a')],qs[_0x5e1a('0x2f')](_0x5ac109[_0x5e1a('0x2c')][_0x5e1a('0x2f')]));_0x539de3['attributes']=_0x539de3[_0x5e1a('0x2e')]['length']?_0x539de3[_0x5e1a('0x2e')]:_0x2644e1[_0x5e1a('0x2a')];if(!_0x5ac109[_0x5e1a('0x2c')][_0x5e1a('0x30')]('nolimit')){_0x539de3['limit']=qs['limit'](_0x5ac109['query']['limit']);_0x539de3[_0x5e1a('0x17')]=qs[_0x5e1a('0x17')](_0x5ac109[_0x5e1a('0x2c')]['offset']);}_0x539de3[_0x5e1a('0x31')]=qs[_0x5e1a('0x32')](_0x5ac109[_0x5e1a('0x2c')]['sort']);_0x539de3[_0x5e1a('0x33')]=qs[_0x5e1a('0x2d')](_[_0x5e1a('0x34')](_0x5ac109[_0x5e1a('0x2c')],_0x2644e1[_0x5e1a('0x2d')]),_0x4f44e5);if(_0x5ac109[_0x5e1a('0x2c')][_0x5e1a('0x35')]){_0x539de3[_0x5e1a('0x33')]=_[_0x5e1a('0x36')](_0x539de3[_0x5e1a('0x33')],{'$or':_[_0x5e1a('0x24')](_0x4f44e5,function(_0x5e708a){if(_0x5e708a[_0x5e1a('0x28')]!==_0x5e1a('0x37')){var _0x55a174={};_0x55a174[_0x5e708a[_0x5e1a('0x22')]]={'$like':'%'+_0x5ac109[_0x5e1a('0x2c')][_0x5e1a('0x35')]+'%'};return _0x55a174;}})});}_0x539de3=_[_0x5e1a('0x36')]({},_0x539de3,_0x5ac109[_0x5e1a('0x38')]);var _0x7d742d={'where':_0x539de3[_0x5e1a('0x33')]};return db['SmsTransferReport'][_0x5e1a('0x1a')](_0x7d742d)['then'](function(_0x5bb163){_0x36df30['count']=_0x5bb163;if(_0x5ac109[_0x5e1a('0x2c')]['includeAll']){_0x539de3[_0x5e1a('0x39')]=[{'all':!![]}];}return db[_0x5e1a('0x25')]['findAll'](_0x539de3);})[_0x5e1a('0x1e')](function(_0x1a49ea){_0x36df30['rows']=_0x1a49ea;return _0x36df30;})[_0x5e1a('0x1e')](respondWithFilteredResult(_0x32f92e,_0x539de3))['catch'](handleError(_0x32f92e,null));};exports[_0x5e1a('0x3a')]=function(_0x4f2a79,_0x52e727){var _0x3c7210={'raw':!![],'where':{'id':_0x4f2a79['params']['id']}},_0x44882f={};_0x44882f[_0x5e1a('0x2a')]=_['keys'](db[_0x5e1a('0x25')][_0x5e1a('0x26')]);_0x44882f[_0x5e1a('0x2c')]=_[_0x5e1a('0x2b')](_0x4f2a79[_0x5e1a('0x2c')]);_0x44882f[_0x5e1a('0x2d')]=_[_0x5e1a('0x3b')](_0x44882f[_0x5e1a('0x2a')],_0x44882f[_0x5e1a('0x2c')]);_0x3c7210['attributes']=_['intersection'](_0x44882f[_0x5e1a('0x2a')],qs[_0x5e1a('0x2f')](_0x4f2a79[_0x5e1a('0x2c')][_0x5e1a('0x2f')]));_0x3c7210[_0x5e1a('0x2e')]=_0x3c7210[_0x5e1a('0x2e')][_0x5e1a('0x3c')]?_0x3c7210['attributes']:_0x44882f[_0x5e1a('0x2a')];if(_0x4f2a79[_0x5e1a('0x2c')]['includeAll']){_0x3c7210[_0x5e1a('0x39')]=[{'all':!![]}];}_0x3c7210=_['merge']({},_0x3c7210,_0x4f2a79[_0x5e1a('0x38')]);return db['SmsTransferReport']['find'](_0x3c7210)['then'](handleEntityNotFound(_0x52e727,null))[_0x5e1a('0x1e')](respondWithResult(_0x52e727,null))[_0x5e1a('0x3d')](handleError(_0x52e727,null));};exports['create']=function(_0x54df28,_0x19e7cd){return db['SmsTransferReport'][_0x5e1a('0x3e')](_0x54df28[_0x5e1a('0x3f')],{})[_0x5e1a('0x1e')](respondWithResult(_0x19e7cd,0xc9))[_0x5e1a('0x3d')](handleError(_0x19e7cd,null));};exports[_0x5e1a('0x1d')]=function(_0x2fe469,_0x2ec5d9){if(_0x2fe469['body']['id']){delete _0x2fe469[_0x5e1a('0x3f')]['id'];}return db['SmsTransferReport'][_0x5e1a('0x40')]({'where':{'id':_0x2fe469[_0x5e1a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ec5d9,null))[_0x5e1a('0x1e')](saveUpdates(_0x2fe469['body'],null))[_0x5e1a('0x1e')](respondWithResult(_0x2ec5d9,null))['catch'](handleError(_0x2ec5d9,null));};exports['destroy']=function(_0x3c40dd,_0x53e941){return db['SmsTransferReport'][_0x5e1a('0x40')]({'where':{'id':_0x3c40dd[_0x5e1a('0x41')]['id']}})[_0x5e1a('0x1e')](handleEntityNotFound(_0x53e941,null))['then'](removeEntity(_0x53e941,null))[_0x5e1a('0x3d')](handleError(_0x53e941,null));};exports['describe']=function(_0x28b9e7,_0x1d7f30){return db[_0x5e1a('0x25')]['describe']()[_0x5e1a('0x1e')](respondWithResult(_0x1d7f30,null))[_0x5e1a('0x3d')](handleError(_0x1d7f30,null));}; \ No newline at end of file +var _0x44c2=['offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','catch','show','find','create','body','params','describe','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','sendStatus','status','end','json'];(function(_0x209b37,_0x5eec62){var _0x1012e2=function(_0x1e61b2){while(--_0x1e61b2){_0x209b37['push'](_0x209b37['shift']());}};_0x1012e2(++_0x5eec62);}(_0x44c2,0x100));var _0x244c=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x44c2[_0x1c546c];return _0x2cc384;};'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'];function respondWithStatusCode(_0x2440d0,_0x526c3e){_0x526c3e=_0x526c3e||0xcc;return function(_0x13aeb3){if(_0x13aeb3){return _0x2440d0[_0x244c('0x14')](_0x526c3e);}return _0x2440d0[_0x244c('0x15')](_0x526c3e)[_0x244c('0x16')]();};}function respondWithResult(_0x7785a7,_0x4465a9){_0x4465a9=_0x4465a9||0xc8;return function(_0x4331f1){if(_0x4331f1){return _0x7785a7['status'](_0x4465a9)[_0x244c('0x17')](_0x4331f1);}};}function respondWithFilteredResult(_0x4c4001,_0x50538b){return function(_0x151f1f){if(_0x151f1f){var _0x94e7a4=typeof _0x50538b[_0x244c('0x18')]===_0x244c('0x19')&&typeof _0x50538b['limit']===_0x244c('0x19');var _0xe98b9b=_0x151f1f[_0x244c('0x1a')];var _0x1c339f=_0x94e7a4?0x0:_0x50538b[_0x244c('0x18')];var _0x4ee7b2=_0x94e7a4?_0x151f1f[_0x244c('0x1a')]:_0x50538b[_0x244c('0x18')]+_0x50538b[_0x244c('0x1b')];var _0x5a7356;if(_0x4ee7b2>=_0xe98b9b){_0x4ee7b2=_0xe98b9b;_0x5a7356=0xc8;}else{_0x5a7356=0xce;}_0x4c4001['status'](_0x5a7356);return _0x4c4001['set'](_0x244c('0x1c'),_0x1c339f+'-'+_0x4ee7b2+'/'+_0xe98b9b)[_0x244c('0x17')](_0x151f1f);}return null;};}function patchUpdates(_0x1ad17c){return function(_0x1be711){try{jsonpatch[_0x244c('0x1d')](_0x1be711,_0x1ad17c,!![]);}catch(_0x2ed849){return BPromise['reject'](_0x2ed849);}return _0x1be711[_0x244c('0x1e')]();};}function saveUpdates(_0x2de472,_0x10316e){return function(_0x536b8e){if(_0x536b8e){return _0x536b8e[_0x244c('0x1f')](_0x2de472)['then'](function(_0x4bd46e){return _0x4bd46e;});}return null;};}function removeEntity(_0x458fc5,_0x6aa1f4){return function(_0x4d3997){if(_0x4d3997){return _0x4d3997[_0x244c('0x20')]()[_0x244c('0x21')](function(){_0x458fc5[_0x244c('0x15')](0xcc)[_0x244c('0x16')]();});}};}function handleEntityNotFound(_0x54b7ae,_0x1f07bc){return function(_0x264ba2){if(!_0x264ba2){_0x54b7ae[_0x244c('0x14')](0x194);}return _0x264ba2;};}function handleError(_0x1616cf,_0x40adde){_0x40adde=_0x40adde||0x1f4;return function(_0x584d44){logger['error'](_0x584d44[_0x244c('0x22')]);if(_0x584d44[_0x244c('0x23')]){delete _0x584d44[_0x244c('0x23')];}_0x1616cf[_0x244c('0x15')](_0x40adde)[_0x244c('0x24')](_0x584d44);};}exports[_0x244c('0x25')]=function(_0x301111,_0x3f9b84){var _0x2ad9e3={},_0x3dc983={},_0x5553e5={'count':0x0,'rows':[]};var _0x5e823d=_[_0x244c('0x26')](db[_0x244c('0x27')][_0x244c('0x28')],function(_0x455382){return{'name':_0x455382[_0x244c('0x29')],'type':_0x455382[_0x244c('0x2a')]['key']};});_0x3dc983[_0x244c('0x2b')]=_[_0x244c('0x26')](_0x5e823d,_0x244c('0x23'));_0x3dc983[_0x244c('0x2c')]=_[_0x244c('0x2d')](_0x301111[_0x244c('0x2c')]);_0x3dc983[_0x244c('0x2e')]=_[_0x244c('0x2f')](_0x3dc983[_0x244c('0x2b')],_0x3dc983[_0x244c('0x2c')]);_0x2ad9e3[_0x244c('0x30')]=_[_0x244c('0x2f')](_0x3dc983['model'],qs[_0x244c('0x31')](_0x301111[_0x244c('0x2c')][_0x244c('0x31')]));_0x2ad9e3[_0x244c('0x30')]=_0x2ad9e3[_0x244c('0x30')][_0x244c('0x32')]?_0x2ad9e3[_0x244c('0x30')]:_0x3dc983[_0x244c('0x2b')];if(!_0x301111['query'][_0x244c('0x33')](_0x244c('0x34'))){_0x2ad9e3['limit']=qs[_0x244c('0x1b')](_0x301111[_0x244c('0x2c')][_0x244c('0x1b')]);_0x2ad9e3[_0x244c('0x18')]=qs[_0x244c('0x18')](_0x301111[_0x244c('0x2c')][_0x244c('0x18')]);}_0x2ad9e3[_0x244c('0x35')]=qs[_0x244c('0x36')](_0x301111[_0x244c('0x2c')]['sort']);_0x2ad9e3[_0x244c('0x37')]=qs[_0x244c('0x2e')](_[_0x244c('0x38')](_0x301111[_0x244c('0x2c')],_0x3dc983[_0x244c('0x2e')]),_0x5e823d);if(_0x301111['query']['filter']){_0x2ad9e3[_0x244c('0x37')]=_['merge'](_0x2ad9e3[_0x244c('0x37')],{'$or':_[_0x244c('0x26')](_0x5e823d,function(_0x2c86e8){if(_0x2c86e8[_0x244c('0x2a')]!==_0x244c('0x39')){var _0x3f52ce={};_0x3f52ce[_0x2c86e8['name']]={'$like':'%'+_0x301111['query'][_0x244c('0x3a')]+'%'};return _0x3f52ce;}})});}_0x2ad9e3=_[_0x244c('0x3b')]({},_0x2ad9e3,_0x301111[_0x244c('0x3c')]);var _0x16c2d9={'where':_0x2ad9e3['where']};return db[_0x244c('0x27')][_0x244c('0x1a')](_0x16c2d9)['then'](function(_0xbb14b1){_0x5553e5['count']=_0xbb14b1;if(_0x301111[_0x244c('0x2c')][_0x244c('0x3d')]){_0x2ad9e3[_0x244c('0x3e')]=[{'all':!![]}];}return db[_0x244c('0x27')]['findAll'](_0x2ad9e3);})['then'](function(_0x4195e6){_0x5553e5['rows']=_0x4195e6;return _0x5553e5;})[_0x244c('0x21')](respondWithFilteredResult(_0x3f9b84,_0x2ad9e3))[_0x244c('0x3f')](handleError(_0x3f9b84,null));};exports[_0x244c('0x40')]=function(_0x2aaedd,_0x12990c){var _0x2ac921={'raw':!![],'where':{'id':_0x2aaedd['params']['id']}},_0x291c90={};_0x291c90[_0x244c('0x2b')]=_[_0x244c('0x2d')](db[_0x244c('0x27')][_0x244c('0x28')]);_0x291c90[_0x244c('0x2c')]=_[_0x244c('0x2d')](_0x2aaedd[_0x244c('0x2c')]);_0x291c90[_0x244c('0x2e')]=_[_0x244c('0x2f')](_0x291c90[_0x244c('0x2b')],_0x291c90[_0x244c('0x2c')]);_0x2ac921[_0x244c('0x30')]=_[_0x244c('0x2f')](_0x291c90[_0x244c('0x2b')],qs[_0x244c('0x31')](_0x2aaedd[_0x244c('0x2c')][_0x244c('0x31')]));_0x2ac921[_0x244c('0x30')]=_0x2ac921[_0x244c('0x30')]['length']?_0x2ac921['attributes']:_0x291c90[_0x244c('0x2b')];if(_0x2aaedd[_0x244c('0x2c')][_0x244c('0x3d')]){_0x2ac921[_0x244c('0x3e')]=[{'all':!![]}];}_0x2ac921=_['merge']({},_0x2ac921,_0x2aaedd[_0x244c('0x3c')]);return db[_0x244c('0x27')][_0x244c('0x41')](_0x2ac921)[_0x244c('0x21')](handleEntityNotFound(_0x12990c,null))[_0x244c('0x21')](respondWithResult(_0x12990c,null))[_0x244c('0x3f')](handleError(_0x12990c,null));};exports[_0x244c('0x42')]=function(_0x3036a2,_0x55be72){return db[_0x244c('0x27')]['create'](_0x3036a2[_0x244c('0x43')],{})[_0x244c('0x21')](respondWithResult(_0x55be72,0xc9))['catch'](handleError(_0x55be72,null));};exports[_0x244c('0x1f')]=function(_0x21c9e9,_0x22219f){if(_0x21c9e9[_0x244c('0x43')]['id']){delete _0x21c9e9['body']['id'];}return db[_0x244c('0x27')][_0x244c('0x41')]({'where':{'id':_0x21c9e9[_0x244c('0x44')]['id']}})[_0x244c('0x21')](handleEntityNotFound(_0x22219f,null))[_0x244c('0x21')](saveUpdates(_0x21c9e9[_0x244c('0x43')],null))['then'](respondWithResult(_0x22219f,null))['catch'](handleError(_0x22219f,null));};exports[_0x244c('0x20')]=function(_0x12bd0a,_0x15953f){return db[_0x244c('0x27')][_0x244c('0x41')]({'where':{'id':_0x12bd0a[_0x244c('0x44')]['id']}})[_0x244c('0x21')](handleEntityNotFound(_0x15953f,null))[_0x244c('0x21')](removeEntity(_0x15953f,null))[_0x244c('0x3f')](handleError(_0x15953f,null));};exports[_0x244c('0x45')]=function(_0x31a797,_0x100d22){return db[_0x244c('0x27')]['describe']()[_0x244c('0x21')](respondWithResult(_0x100d22,null))[_0x244c('0x3f')](handleError(_0x100d22,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c3bee17..0ee4196 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 _0xf097=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./smsTransferReport.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf097,0x1b2));var _0x7f09=function(_0x727e40,_0x55c539){_0x727e40=_0x727e40-0x0;var _0x734039=_0xf097[_0x727e40];return _0x734039;};'use strict';var _=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var logger=require(_0x7f09('0x2'))(_0x7f09('0x3'));var moment=require(_0x7f09('0x4'));var BPromise=require(_0x7f09('0x5'));var rp=require(_0x7f09('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7f09('0x7'));module[_0x7f09('0x8')]=function(_0x3afb02,_0x44ef71){return _0x3afb02[_0x7f09('0x9')]('SmsTransferReport',attributes,{'tableName':_0x7f09('0xa'),'paranoid':![],'indexes':[{'name':_0x7f09('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x174e=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','./smsTransferReport.attributes','exports','SmsTransferReport'];(function(_0x5716c3,_0x597fb3){var _0x56b006=function(_0x27f5f5){while(--_0x27f5f5){_0x5716c3['push'](_0x5716c3['shift']());}};_0x56b006(++_0x597fb3);}(_0x174e,0x19c));var _0xe174=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x174e[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xe174('0x0'));var util=require(_0xe174('0x1'));var logger=require(_0xe174('0x2'))(_0xe174('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe174('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe174('0x5'));module[_0xe174('0x6')]=function(_0x17d613,_0x50b14e){return _0x17d613['define'](_0xe174('0x7'),attributes,{'tableName':_0xe174('0x8'),'paranoid':![],'indexes':[{'name':_0xe174('0x9'),'fields':[_0xe174('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0b6854e..9ffa633 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 _0xe914=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x33828a,_0x441dfd){var _0x268ac5=function(_0x1cecbd){while(--_0x1cecbd){_0x33828a['push'](_0x33828a['shift']());}};_0x268ac5(++_0x441dfd);}(_0xe914,0x7f));var _0x4e91=function(_0x2a5052,_0x9f5550){_0x2a5052=_0x2a5052-0x0;var _0x545e9d=_0xe914[_0x2a5052];return _0x545e9d;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var moment=require('moment');var BPromise=require(_0x4e91('0x2'));var rs=require(_0x4e91('0x3'));var fs=require('fs');var Redis=require(_0x4e91('0x4'));var db=require(_0x4e91('0x5'))['db'];var utils=require(_0x4e91('0x6'));var logger=require(_0x4e91('0x7'))('rpc');var config=require(_0x4e91('0x8'));var jayson=require(_0x4e91('0x9'));var client=jayson['client'][_0x4e91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4bd6,_0x3f09cb,_0x2f2098){return new BPromise(function(_0x532b72,_0x49174e){return client[_0x4e91('0xb')](_0x1d4bd6,_0x2f2098)['then'](function(_0x523dec){logger[_0x4e91('0xc')](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));logger[_0x4e91('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3f09cb,_0x4e91('0xe'),JSON[_0x4e91('0x10')](_0x523dec));if(_0x523dec[_0x4e91('0x11')]){if(_0x523dec['error'][_0x4e91('0x12')]===0x1f4){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);return _0x49174e(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec['error'][_0x4e91('0x13')]);return _0x532b72(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}else{logger['info'](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));_0x532b72(_0x523dec[_0x4e91('0x14')][_0x4e91('0x13')]);}})[_0x4e91('0x15')](function(_0x34f91f){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x34f91f);_0x49174e(_0x34f91f);});});} \ No newline at end of file +var _0x68f5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x68f5,0x11a));var _0x568f=function(_0x513fb7,_0x28a899){_0x513fb7=_0x513fb7-0x0;var _0x358d08=_0x68f5[_0x513fb7];return _0x358d08;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var moment=require(_0x568f('0x2'));var BPromise=require('bluebird');var rs=require(_0x568f('0x3'));var fs=require('fs');var Redis=require(_0x568f('0x4'));var db=require(_0x568f('0x5'))['db'];var utils=require(_0x568f('0x6'));var logger=require(_0x568f('0x7'))('rpc');var config=require(_0x568f('0x8'));var jayson=require(_0x568f('0x9'));var client=jayson[_0x568f('0xa')][_0x568f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ca62c,_0x541fd2,_0x953f02){return new BPromise(function(_0x3568a0,_0x2492fc){return client['request'](_0x4ca62c,_0x953f02)[_0x568f('0xc')](function(_0x48fe85){logger[_0x568f('0xd')](_0x568f('0xe'),_0x541fd2,'request\x20sent');logger[_0x568f('0xf')](_0x568f('0x10'),_0x541fd2,_0x568f('0x11'),JSON[_0x568f('0x12')](_0x48fe85));if(_0x48fe85[_0x568f('0x13')]){if(_0x48fe85[_0x568f('0x13')][_0x568f('0x14')]===0x1f4){logger[_0x568f('0x13')](_0x568f('0xe'),_0x541fd2,_0x48fe85['error'][_0x568f('0x15')]);return _0x2492fc(_0x48fe85[_0x568f('0x13')][_0x568f('0x15')]);}logger[_0x568f('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x541fd2,_0x48fe85[_0x568f('0x13')]['message']);return _0x3568a0(_0x48fe85['error'][_0x568f('0x15')]);}else{logger[_0x568f('0xd')](_0x568f('0xe'),_0x541fd2,_0x568f('0x11'));_0x3568a0(_0x48fe85[_0x568f('0x16')][_0x568f('0x15')]);}})[_0x568f('0x17')](function(_0x1060cb){logger[_0x568f('0x13')](_0x568f('0xe'),_0x541fd2,_0x1060cb);_0x2492fc(_0x1060cb);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 6119ab7..66b8319 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 _0x48de=['create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','single','file'];(function(_0x34d3ed,_0x28e1e8){var _0x281702=function(_0x166abe){while(--_0x166abe){_0x34d3ed['push'](_0x34d3ed['shift']());}};_0x281702(++_0x28e1e8);}(_0x48de,0x79));var _0xe48d=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x48de[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0xe48d('0x0'));var util=require(_0xe48d('0x1'));var path=require(_0xe48d('0x2'));var timeout=require(_0xe48d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe48d('0x4'));var interaction=require(_0xe48d('0x5'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0xe48d('0x6')](),controller[_0xe48d('0x7')]);router[_0xe48d('0x8')](_0xe48d('0x9'),auth['isAuthenticated'](),controller[_0xe48d('0xa')]);router[_0xe48d('0x8')](_0xe48d('0xb'),auth[_0xe48d('0x6')](),controller['download']);var upload=multer({'storage':multer[_0xe48d('0xc')]({'destination':function(_0x2b3b26,_0x48a089,_0x9fe60a){_0x9fe60a(null,path[_0xe48d('0xd')](config[_0xe48d('0xe')],_0xe48d('0xf')));},'filename':function(_0xb2b5cd,_0x529c3a,_0x10e91e){_0x529c3a[_0xe48d('0x10')]=_0x529c3a['originalname'][_0xe48d('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x10e91e(null,util[_0xe48d('0x12')](_0xe48d('0x13'),path['basename'](_0x529c3a['originalname'],path[_0xe48d('0x14')](_0x529c3a['originalname'])),Date[_0xe48d('0x15')](),path[_0xe48d('0x14')](_0x529c3a['originalname'])));}})});router['post']('/',upload[_0xe48d('0x16')](_0xe48d('0x17')),controller[_0xe48d('0x18')]);router[_0xe48d('0x19')](_0xe48d('0x9'),auth['isAuthenticated'](),controller[_0xe48d('0x1a')]);router['delete'](_0xe48d('0x9'),auth[_0xe48d('0x6')](),controller[_0xe48d('0x1b')]);module[_0xe48d('0x1c')]=router; \ No newline at end of file +var _0x4db3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','originalname','format','%s-%s%s','basename','extname','post','single','file','create','update','delete','exports','multer'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x4db3,0xd1));var _0x34db=function(_0x13bd5f,_0xb45956){_0x13bd5f=_0x13bd5f-0x0;var _0x4a8d2f=_0x4db3[_0x13bd5f];return _0x4a8d2f;};'use strict';var multer=require(_0x34db('0x0'));var util=require(_0x34db('0x1'));var path=require(_0x34db('0x2'));var timeout=require(_0x34db('0x3'));var express=require(_0x34db('0x4'));var router=express[_0x34db('0x5')]();var fs_extra=require(_0x34db('0x6'));var auth=require(_0x34db('0x7'));var interaction=require(_0x34db('0x8'));var config=require(_0x34db('0x9'));var controller=require(_0x34db('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x34db('0xb')](_0x34db('0xc'),auth[_0x34db('0xd')](),controller[_0x34db('0xe')]);router[_0x34db('0xb')](_0x34db('0xf'),auth[_0x34db('0xd')](),controller[_0x34db('0x10')]);var upload=multer({'storage':multer[_0x34db('0x11')]({'destination':function(_0x3aa29e,_0x5dc905,_0xd60fa2){_0xd60fa2(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x27f5f7,_0x275f09,_0x4151aa){_0x275f09[_0x34db('0x12')]=_0x275f09[_0x34db('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4151aa(null,util[_0x34db('0x13')](_0x34db('0x14'),path[_0x34db('0x15')](_0x275f09[_0x34db('0x12')],path[_0x34db('0x16')](_0x275f09['originalname'])),Date['now'](),path[_0x34db('0x16')](_0x275f09[_0x34db('0x12')])));}})});router[_0x34db('0x17')]('/',upload[_0x34db('0x18')](_0x34db('0x19')),controller[_0x34db('0x1a')]);router['put'](_0x34db('0xc'),auth[_0x34db('0xd')](),controller[_0x34db('0x1b')]);router[_0x34db('0x1c')]('/:id',auth[_0x34db('0xd')](),controller['delete']);module[_0x34db('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index da6555f..5bef18a 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 _0x8856=['BIGINT','exports','STRING','name','FLOAT','INTEGER'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x8856,0x12d));var _0x6885=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8856[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6885('0x0')]={'name':{'type':Sequelize[_0x6885('0x1')],'unique':_0x6885('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x6885('0x1')]},'display_name':{'type':Sequelize[_0x6885('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x6885('0x1')]},'original_format':{'type':Sequelize[_0x6885('0x1')]},'original_duration':{'type':Sequelize[_0x6885('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x6885('0x4')]},'original_bitRate':{'type':Sequelize[_0x6885('0x5')]},'original_sampleRate':{'type':Sequelize[_0x6885('0x4')]},'converted_format':{'type':Sequelize[_0x6885('0x1')]},'converted_duration':{'type':Sequelize[_0x6885('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x6885('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x6885('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x6885('0x4')]}}; \ No newline at end of file +var _0x2e7f=['INTEGER','exports','STRING','BIGINT','FLOAT'];(function(_0x1a51db,_0x2eecdc){var _0xea0473=function(_0x54b391){while(--_0x54b391){_0x1a51db['push'](_0x1a51db['shift']());}};_0xea0473(++_0x2eecdc);}(_0x2e7f,0x173));var _0xf2e7=function(_0x339853,_0x38821c){_0x339853=_0x339853-0x0;var _0x7d23b9=_0x2e7f[_0x339853];return _0x7d23b9;};'use strict';var Sequelize=require('sequelize');module[_0xf2e7('0x0')]={'name':{'type':Sequelize[_0xf2e7('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xf2e7('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xf2e7('0x2')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xf2e7('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xf2e7('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xf2e7('0x2')]},'converted_channelCount':{'type':Sequelize[_0xf2e7('0x4')]},'converted_bitRate':{'type':Sequelize[_0xf2e7('0x2')]},'converted_sampleRate':{'type':Sequelize[_0xf2e7('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 83ddf85..fae4704 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 _0x558c=['undefined','count','offset','limit','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','Sound','includeAll','include','findAll','show','params','find','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','download','root','%s.%s','catch','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','format','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json'];(function(_0xd3a8c4,_0x3d867e){var _0x312691=function(_0x471dc9){while(--_0x471dc9){_0xd3a8c4['push'](_0xd3a8c4['shift']());}};_0x312691(++_0x3d867e);}(_0x558c,0x1e6));var _0xc558=function(_0xe42f1b,_0x2e15f3){_0xe42f1b=_0xe42f1b-0x0;var _0x4e3c97=_0x558c[_0xe42f1b];return _0x4e3c97;};'use strict';var emlformat=require(_0xc558('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc558('0x1'));var jsonpatch=require(_0xc558('0x2'));var rp=require(_0xc558('0x3'));var moment=require(_0xc558('0x4'));var BPromise=require(_0xc558('0x5'));var Mustache=require(_0xc558('0x6'));var util=require(_0xc558('0x7'));var path=require('path');var sox=require(_0xc558('0x8'));var csv=require('to-csv');var ejs=require(_0xc558('0x9'));var fs=require('fs');var fs_extra=require(_0xc558('0xa'));var _=require(_0xc558('0xb'));var squel=require(_0xc558('0xc'));var crypto=require(_0xc558('0xd'));var jsforce=require(_0xc558('0xe'));var deskjs=require(_0xc558('0xf'));var toCsv=require(_0xc558('0x10'));var querystring=require(_0xc558('0x11'));var Papa=require(_0xc558('0x12'));var Redis=require(_0xc558('0x13'));var authService=require(_0xc558('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc558('0x15'))(_0xc558('0x16'));var utils=require(_0xc558('0x17'));var config=require(_0xc558('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc558('0x19'))['db'];function respondWithStatusCode(_0x4f14e0,_0x34b2d4){_0x34b2d4=_0x34b2d4||0xcc;return function(_0x400ff1){if(_0x400ff1){return _0x4f14e0[_0xc558('0x1a')](_0x34b2d4);}return _0x4f14e0['status'](_0x34b2d4)[_0xc558('0x1b')]();};}function respondWithResult(_0x3e5a35,_0x3afb7c){_0x3afb7c=_0x3afb7c||0xc8;return function(_0x2e0b95){if(_0x2e0b95){return _0x3e5a35[_0xc558('0x1c')](_0x3afb7c)[_0xc558('0x1d')](_0x2e0b95);}};}function respondWithFilteredResult(_0x3d9234,_0x4dc39a){return function(_0x46a2ce){if(_0x46a2ce){var _0x1e9850=typeof _0x4dc39a['offset']===_0xc558('0x1e')&&typeof _0x4dc39a['limit']===_0xc558('0x1e');var _0x57c52f=_0x46a2ce[_0xc558('0x1f')];var _0x423f65=_0x1e9850?0x0:_0x4dc39a[_0xc558('0x20')];var _0x5d68dc=_0x1e9850?_0x46a2ce[_0xc558('0x1f')]:_0x4dc39a[_0xc558('0x20')]+_0x4dc39a[_0xc558('0x21')];var _0x4866c0;if(_0x5d68dc>=_0x57c52f){_0x5d68dc=_0x57c52f;_0x4866c0=0xc8;}else{_0x4866c0=0xce;}_0x3d9234[_0xc558('0x1c')](_0x4866c0);return _0x3d9234['set'](_0xc558('0x22'),_0x423f65+'-'+_0x5d68dc+'/'+_0x57c52f)[_0xc558('0x1d')](_0x46a2ce);}return null;};}function patchUpdates(_0xf09e6d){return function(_0x4ef019){try{jsonpatch[_0xc558('0x23')](_0x4ef019,_0xf09e6d,!![]);}catch(_0x2ca882){return BPromise[_0xc558('0x24')](_0x2ca882);}return _0x4ef019[_0xc558('0x25')]();};}function saveUpdates(_0x1733f9,_0x399a97){return function(_0x57f610){if(_0x57f610){return _0x57f610[_0xc558('0x26')](_0x1733f9)['then'](function(_0x4f3e11){return _0x4f3e11;});}return null;};}function removeEntity(_0x4f5892,_0x124dd2){return function(_0x5b3d1f){if(_0x5b3d1f){return _0x5b3d1f['destroy']()['then'](function(){var _0x9b8a37=_0x5b3d1f[_0xc558('0x27')]({'plain':!![]});var _0x13ac12='Sounds';return db[_0xc558('0x28')][_0xc558('0x29')]({'where':{'type':_0x13ac12,'resourceId':_0x9b8a37['id']}})[_0xc558('0x2a')](function(){return _0x5b3d1f;});})['then'](function(){_0x4f5892['status'](0xcc)[_0xc558('0x1b')]();});}};}function handleEntityNotFound(_0x115cd0,_0x2c42c5){return function(_0x4ad70e){if(!_0x4ad70e){_0x115cd0[_0xc558('0x1a')](0x194);}return _0x4ad70e;};}function handleError(_0x5b97c4,_0x4e31a1){_0x4e31a1=_0x4e31a1||0x1f4;return function(_0x55449f){logger[_0xc558('0x2b')](_0x55449f[_0xc558('0x2c')]);if(_0x55449f[_0xc558('0x2d')]){delete _0x55449f[_0xc558('0x2d')];}_0x5b97c4['status'](_0x4e31a1)['send'](_0x55449f);};}exports['index']=function(_0x542cf7,_0x45681c){var _0xbff846={},_0x2df83d={},_0x3dbae4={'count':0x0,'rows':[]};var _0x374d23=_[_0xc558('0x2e')](db['Sound'][_0xc558('0x2f')],function(_0x1bae26){return{'name':_0x1bae26[_0xc558('0x30')],'type':_0x1bae26[_0xc558('0x31')][_0xc558('0x32')]};});_0x2df83d[_0xc558('0x33')]=_[_0xc558('0x2e')](_0x374d23,'name');_0x2df83d[_0xc558('0x34')]=_[_0xc558('0x35')](_0x542cf7[_0xc558('0x34')]);_0x2df83d['filters']=_[_0xc558('0x36')](_0x2df83d[_0xc558('0x33')],_0x2df83d[_0xc558('0x34')]);_0xbff846[_0xc558('0x37')]=_[_0xc558('0x36')](_0x2df83d['model'],qs[_0xc558('0x38')](_0x542cf7[_0xc558('0x34')][_0xc558('0x38')]));_0xbff846[_0xc558('0x37')]=_0xbff846[_0xc558('0x37')][_0xc558('0x39')]?_0xbff846['attributes']:_0x2df83d[_0xc558('0x33')];if(!_0x542cf7[_0xc558('0x34')]['hasOwnProperty'](_0xc558('0x3a'))){_0xbff846[_0xc558('0x21')]=qs[_0xc558('0x21')](_0x542cf7[_0xc558('0x34')][_0xc558('0x21')]);_0xbff846[_0xc558('0x20')]=qs[_0xc558('0x20')](_0x542cf7['query'][_0xc558('0x20')]);}_0xbff846[_0xc558('0x3b')]=qs['sort'](_0x542cf7[_0xc558('0x34')][_0xc558('0x3c')]);_0xbff846[_0xc558('0x3d')]=qs['filters'](_[_0xc558('0x3e')](_0x542cf7['query'],_0x2df83d[_0xc558('0x3f')]),_0x374d23);if(_0x542cf7[_0xc558('0x34')][_0xc558('0x40')]){_0xbff846[_0xc558('0x3d')]=_['merge'](_0xbff846['where'],{'$or':_[_0xc558('0x2e')](_0x374d23,function(_0x56e829){if(_0x56e829[_0xc558('0x31')]!==_0xc558('0x41')){var _0x10c962={};_0x10c962[_0x56e829[_0xc558('0x2d')]]={'$like':'%'+_0x542cf7[_0xc558('0x34')][_0xc558('0x40')]+'%'};return _0x10c962;}})});}_0xbff846=_[_0xc558('0x42')]({},_0xbff846,_0x542cf7[_0xc558('0x43')]);var _0x58d287={'where':_0xbff846['where']};return db[_0xc558('0x44')][_0xc558('0x1f')](_0x58d287)[_0xc558('0x2a')](function(_0x40ab76){_0x3dbae4[_0xc558('0x1f')]=_0x40ab76;if(_0x542cf7[_0xc558('0x34')][_0xc558('0x45')]){_0xbff846[_0xc558('0x46')]=[{'all':!![]}];}return db[_0xc558('0x44')][_0xc558('0x47')](_0xbff846);})[_0xc558('0x2a')](function(_0x7ea526){_0x3dbae4['rows']=_0x7ea526;return _0x3dbae4;})[_0xc558('0x2a')](respondWithFilteredResult(_0x45681c,_0xbff846))['catch'](handleError(_0x45681c,null));};exports[_0xc558('0x48')]=function(_0xbe2d8c,_0x48149b){var _0x265940={'raw':!![],'where':{'id':_0xbe2d8c[_0xc558('0x49')]['id']}},_0x142f4d={};_0x142f4d[_0xc558('0x33')]=_[_0xc558('0x35')](db['Sound'][_0xc558('0x2f')]);_0x142f4d[_0xc558('0x34')]=_[_0xc558('0x35')](_0xbe2d8c['query']);_0x142f4d[_0xc558('0x3f')]=_[_0xc558('0x36')](_0x142f4d[_0xc558('0x33')],_0x142f4d[_0xc558('0x34')]);_0x265940['attributes']=_[_0xc558('0x36')](_0x142f4d['model'],qs[_0xc558('0x38')](_0xbe2d8c[_0xc558('0x34')][_0xc558('0x38')]));_0x265940[_0xc558('0x37')]=_0x265940[_0xc558('0x37')][_0xc558('0x39')]?_0x265940['attributes']:_0x142f4d['model'];if(_0xbe2d8c['query'][_0xc558('0x45')]){_0x265940[_0xc558('0x46')]=[{'all':!![]}];}_0x265940=_['merge']({},_0x265940,_0xbe2d8c[_0xc558('0x43')]);return db[_0xc558('0x44')]['find'](_0x265940)[_0xc558('0x2a')](handleEntityNotFound(_0x48149b,null))[_0xc558('0x2a')](respondWithResult(_0x48149b,null))['catch'](handleError(_0x48149b,null));};exports['download']=function(_0x111207,_0x1da4e0,_0x4ef2c4){return db['Sound'][_0xc558('0x4a')]({'where':{'id':_0x111207[_0xc558('0x49')]['id']},'attributes':['name','save_name',_0xc558('0x4b')],'raw':!![]})[_0xc558('0x2a')](handleEntityNotFound(_0x1da4e0,null))[_0xc558('0x2a')](function(_0x486f67){if(_0x486f67){if(!fs[_0xc558('0x4c')](path[_0xc558('0x4d')](config['root'],_0xc558('0x4e'),_0x486f67[_0xc558('0x4f')]+'.'+_0x486f67[_0xc558('0x4b')]))){throw new db[(_0xc558('0x50'))][(_0xc558('0x51'))](_0xc558('0x52'));}return _0x1da4e0[_0xc558('0x53')](path[_0xc558('0x4d')](config[_0xc558('0x54')],_0xc558('0x4e'),util['format'](_0xc558('0x55'),_0x486f67[_0xc558('0x4f')],_0x486f67[_0xc558('0x4b')])),util['format'](_0xc558('0x55'),_0x486f67[_0xc558('0x2d')],_0x486f67['converted_format']));}return null;})[_0xc558('0x56')](handleError(_0x1da4e0,null));};exports[_0xc558('0x57')]=function(_0x3ed616,_0x5d8e5e,_0x2e348f){var _0xc8a840={'name':path['basename'](_0x3ed616[_0xc558('0x58')][_0xc558('0x59')],path[_0xc558('0x5a')](_0x3ed616['file'][_0xc558('0x59')])),'save_name':path[_0xc558('0x5b')](_0x3ed616[_0xc558('0x58')]['filename'],path[_0xc558('0x5a')](_0x3ed616[_0xc558('0x58')][_0xc558('0x5c')])),'original_format':path[_0xc558('0x5a')](_0x3ed616['file'][_0xc558('0x59')])[_0xc558('0x5d')](0x1),'converted_format':_0xc558('0x5e')};var _0x4846ea=path[_0xc558('0x4d')](config[_0xc558('0x54')],_0xc558('0x5f'),_0x3ed616['file']['filename']);var _0x49f295=path[_0xc558('0x4d')](config['root'],_0xc558('0x4e'),util[_0xc558('0x60')](_0xc558('0x55'),path[_0xc558('0x5b')](_0x3ed616[_0xc558('0x58')]['filename'],path['extname'](_0x3ed616[_0xc558('0x58')]['filename'])),_0xc8a840[_0xc558('0x4b')]));logger[_0xc558('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x4846ea);logger[_0xc558('0x61')](_0xc558('0x62'),_0x49f295);try{fs[_0xc558('0x63')](_0x4846ea,parseInt(_0xc558('0x64'),0x8));var _0x5b0d4f=sox[_0xc558('0x65')](_0x4846ea,_0x49f295,{'sampleRate':0x1f40,'format':_0xc558('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5b0d4f['on'](_0xc558('0x2b'),function(_0x489ecc){fs[_0xc558('0x66')](_0x4846ea);_0x5d8e5e[_0xc558('0x1c')](0x1f4)[_0xc558('0x67')](_0x489ecc);});_0x5b0d4f['on'](_0xc558('0x68'),function(_0x26edea){_0xc8a840['original_duration']=isNaN(_0x26edea[_0xc558('0x69')])?null:_0x26edea[_0xc558('0x69')]*0x3e8;_0xc8a840['original_sampleCount']=isNaN(_0x26edea[_0xc558('0x6a')])?null:_0x26edea[_0xc558('0x6a')];_0xc8a840[_0xc558('0x6b')]=isNaN(_0x26edea[_0xc558('0x6c')])?null:_0x26edea[_0xc558('0x6c')];_0xc8a840[_0xc558('0x6d')]=isNaN(_0x26edea[_0xc558('0x6e')])?null:_0x26edea[_0xc558('0x6e')];_0xc8a840['original_sampleRate']=isNaN(_0x26edea[_0xc558('0x6f')])?null:_0x26edea[_0xc558('0x6f')];});_0x5b0d4f['on'](_0xc558('0x70'),function(_0x5aa1c6){_0xc8a840[_0xc558('0x71')]=isNaN(_0x5aa1c6[_0xc558('0x69')])?null:_0x5aa1c6[_0xc558('0x69')]*0x3e8;_0xc8a840['converted_sampleCount']=isNaN(_0x5aa1c6[_0xc558('0x6a')])?null:_0x5aa1c6[_0xc558('0x6a')];_0xc8a840[_0xc558('0x72')]=isNaN(_0x5aa1c6['channelCount'])?null:_0x5aa1c6[_0xc558('0x6c')];_0xc8a840[_0xc558('0x73')]=isNaN(_0x5aa1c6[_0xc558('0x6e')])?null:_0x5aa1c6[_0xc558('0x6e')];_0xc8a840['converted_sampleRate']=isNaN(_0x5aa1c6[_0xc558('0x6f')])?null:_0x5aa1c6[_0xc558('0x6f')];});_0x5b0d4f['on'](_0xc558('0x1b'),function(){fs['chmodSync'](_0x49f295,parseInt(_0xc558('0x64'),0x8));return db[_0xc558('0x44')][_0xc558('0x57')](_0xc8a840)[_0xc558('0x2a')](function(_0x41a015){var _0x44d9b0={'role':_0x3ed616['body'][_0xc558('0x74')],'userProfileId':_0x3ed616[_0xc558('0x75')]['userProfileId']};if(!_0x44d9b0)throw new Error(_0xc558('0x76'));if(_0x44d9b0[_0xc558('0x74')]===_0xc558('0x77')){var _0x247acc=_0x41a015[_0xc558('0x27')]({'plain':!![]});return db[_0xc558('0x78')][_0xc558('0x4a')]({'where':{'name':_0xc558('0x79'),'userProfileId':_0x44d9b0[_0xc558('0x7a')]},'raw':!![]})[_0xc558('0x2a')](function(_0x1ecf01){if(_0x1ecf01&&_0x1ecf01[_0xc558('0x7b')]===0x0){return db[_0xc558('0x28')]['create']({'name':_0x247acc['name'],'resourceId':_0x247acc['id'],'type':_0x1ecf01['name'],'sectionId':_0x1ecf01['id']},{})[_0xc558('0x2a')](function(){return _0x41a015;});}else{return _0x41a015;}})['catch'](function(_0x95dddb){logger[_0xc558('0x2b')](_0xc558('0x7c'),_0x95dddb);throw _0x95dddb;});}return _0x41a015;})[_0xc558('0x2a')](respondWithResult(_0x5d8e5e,null))[_0xc558('0x56')](handleError(_0x5d8e5e,null));});_0x5b0d4f[_0xc558('0x7d')]();}catch(_0x4be9e0){_0x5d8e5e[_0xc558('0x1c')](0x1f4)[_0xc558('0x67')](_0x4be9e0);}};exports[_0xc558('0x26')]=function(_0x121255,_0x87f5e7,_0x4ab0d3){return db[_0xc558('0x44')][_0xc558('0x4a')]({'where':{'id':_0x121255[_0xc558('0x49')]['id']}})[_0xc558('0x2a')](handleEntityNotFound(_0x87f5e7,null))[_0xc558('0x2a')](saveUpdates(_[_0xc558('0x3e')](_0x121255[_0xc558('0x75')],['name',_0xc558('0x7e')]),null))[_0xc558('0x2a')](respondWithResult(_0x87f5e7,null))['catch'](handleError(_0x87f5e7,null));};exports[_0xc558('0x7f')]=function(_0x2feedb,_0x481888,_0x138e11){return db[_0xc558('0x44')][_0xc558('0x4a')]({'where':{'id':_0x2feedb[_0xc558('0x49')]['id']}})[_0xc558('0x2a')](function(_0x1776ff){if(_0x1776ff){return _0x1776ff['destroy']();}})[_0xc558('0x2a')](function(_0x363546){var _0x499d08=path[_0xc558('0x4d')](config[_0xc558('0x54')],'server/files/sounds/original',util[_0xc558('0x60')]('%s.%s',_0x363546[_0xc558('0x4f')],_0x363546[_0xc558('0x80')]));var _0x363491=path[_0xc558('0x4d')](config[_0xc558('0x54')],_0xc558('0x4e'),util[_0xc558('0x60')](_0xc558('0x55'),_0x363546[_0xc558('0x4f')],_0x363546[_0xc558('0x4b')]));fs[_0xc558('0x66')](_0x499d08);fs[_0xc558('0x66')](_0x363491);return _0x363546;})[_0xc558('0x2a')](function(_0x44b0e9){if(_0x44b0e9){return _0x481888[_0xc558('0x1c')](0xcc)['end']();}})[_0xc558('0x2a')](handleEntityNotFound(_0x481888,null))[_0xc558('0x56')](handleError(_0x481888,null));}; \ No newline at end of file +var _0x86f1=['sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','Sounds','UserProfileResource','then','end','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','basename','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','unlinkSync','src','original_duration','duration','original_sampleCount'];(function(_0x55cc0a,_0x21cba7){var _0x590d4a=function(_0x20b972){while(--_0x20b972){_0x55cc0a['push'](_0x55cc0a['shift']());}};_0x590d4a(++_0x21cba7);}(_0x86f1,0xa0));var _0x186f=function(_0x2b89d8,_0x262128){_0x2b89d8=_0x2b89d8-0x0;var _0xefd316=_0x86f1[_0x2b89d8];return _0xefd316;};'use strict';var emlformat=require(_0x186f('0x0'));var rimraf=require(_0x186f('0x1'));var zipdir=require(_0x186f('0x2'));var jsonpatch=require(_0x186f('0x3'));var rp=require(_0x186f('0x4'));var moment=require('moment');var BPromise=require(_0x186f('0x5'));var Mustache=require(_0x186f('0x6'));var util=require('util');var path=require(_0x186f('0x7'));var sox=require(_0x186f('0x8'));var csv=require(_0x186f('0x9'));var ejs=require(_0x186f('0xa'));var fs=require('fs');var fs_extra=require(_0x186f('0xb'));var _=require(_0x186f('0xc'));var squel=require('squel');var crypto=require(_0x186f('0xd'));var jsforce=require(_0x186f('0xe'));var deskjs=require(_0x186f('0xf'));var toCsv=require(_0x186f('0x9'));var querystring=require(_0x186f('0x10'));var Papa=require(_0x186f('0x11'));var Redis=require(_0x186f('0x12'));var authService=require(_0x186f('0x13'));var qs=require(_0x186f('0x14'));var as=require(_0x186f('0x15'));var hardwareService=require(_0x186f('0x16'));var logger=require(_0x186f('0x17'))(_0x186f('0x18'));var utils=require(_0x186f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x186f('0x1a'));var db=require(_0x186f('0x1b'))['db'];function respondWithStatusCode(_0x34ff80,_0x4acaf7){_0x4acaf7=_0x4acaf7||0xcc;return function(_0x2fe51d){if(_0x2fe51d){return _0x34ff80[_0x186f('0x1c')](_0x4acaf7);}return _0x34ff80[_0x186f('0x1d')](_0x4acaf7)['end']();};}function respondWithResult(_0x1ea70a,_0x313d5d){_0x313d5d=_0x313d5d||0xc8;return function(_0x37d9b5){if(_0x37d9b5){return _0x1ea70a[_0x186f('0x1d')](_0x313d5d)[_0x186f('0x1e')](_0x37d9b5);}};}function respondWithFilteredResult(_0x2f4ab4,_0x4b41f5){return function(_0x4e45b7){if(_0x4e45b7){var _0x146d3a=typeof _0x4b41f5[_0x186f('0x1f')]===_0x186f('0x20')&&typeof _0x4b41f5[_0x186f('0x21')]===_0x186f('0x20');var _0x5013f4=_0x4e45b7['count'];var _0x4fc111=_0x146d3a?0x0:_0x4b41f5[_0x186f('0x1f')];var _0x1a13c0=_0x146d3a?_0x4e45b7[_0x186f('0x22')]:_0x4b41f5[_0x186f('0x1f')]+_0x4b41f5[_0x186f('0x21')];var _0x1fd176;if(_0x1a13c0>=_0x5013f4){_0x1a13c0=_0x5013f4;_0x1fd176=0xc8;}else{_0x1fd176=0xce;}_0x2f4ab4[_0x186f('0x1d')](_0x1fd176);return _0x2f4ab4[_0x186f('0x23')](_0x186f('0x24'),_0x4fc111+'-'+_0x1a13c0+'/'+_0x5013f4)['json'](_0x4e45b7);}return null;};}function patchUpdates(_0x4c9cc4){return function(_0x2b54c2){try{jsonpatch[_0x186f('0x25')](_0x2b54c2,_0x4c9cc4,!![]);}catch(_0x3bb7a6){return BPromise[_0x186f('0x26')](_0x3bb7a6);}return _0x2b54c2['save']();};}function saveUpdates(_0x12b5c6,_0x2d5bd8){return function(_0x18fc02){if(_0x18fc02){return _0x18fc02[_0x186f('0x27')](_0x12b5c6)['then'](function(_0x252bf7){return _0x252bf7;});}return null;};}function removeEntity(_0x58df25,_0x3d468d){return function(_0x8ef585){if(_0x8ef585){return _0x8ef585[_0x186f('0x28')]()['then'](function(){var _0xa55d45=_0x8ef585[_0x186f('0x29')]({'plain':!![]});var _0x4a91fb=_0x186f('0x2a');return db[_0x186f('0x2b')][_0x186f('0x28')]({'where':{'type':_0x4a91fb,'resourceId':_0xa55d45['id']}})[_0x186f('0x2c')](function(){return _0x8ef585;});})['then'](function(){_0x58df25['status'](0xcc)[_0x186f('0x2d')]();});}};}function handleEntityNotFound(_0x2ea4cc,_0x3906f9){return function(_0x11a74b){if(!_0x11a74b){_0x2ea4cc['sendStatus'](0x194);}return _0x11a74b;};}function handleError(_0x4b6b47,_0x58fc59){_0x58fc59=_0x58fc59||0x1f4;return function(_0x596cdf){logger['error'](_0x596cdf[_0x186f('0x2e')]);if(_0x596cdf[_0x186f('0x2f')]){delete _0x596cdf[_0x186f('0x2f')];}_0x4b6b47[_0x186f('0x1d')](_0x58fc59)[_0x186f('0x30')](_0x596cdf);};}exports[_0x186f('0x31')]=function(_0x52df9a,_0x4a1dfc){var _0x4f3901={},_0x154d3b={},_0x22a23c={'count':0x0,'rows':[]};var _0x3eb8b6=_['map'](db[_0x186f('0x32')][_0x186f('0x33')],function(_0x5f1734){return{'name':_0x5f1734[_0x186f('0x34')],'type':_0x5f1734[_0x186f('0x35')][_0x186f('0x36')]};});_0x154d3b[_0x186f('0x37')]=_[_0x186f('0x38')](_0x3eb8b6,_0x186f('0x2f'));_0x154d3b[_0x186f('0x39')]=_[_0x186f('0x3a')](_0x52df9a[_0x186f('0x39')]);_0x154d3b[_0x186f('0x3b')]=_[_0x186f('0x3c')](_0x154d3b[_0x186f('0x37')],_0x154d3b[_0x186f('0x39')]);_0x4f3901['attributes']=_[_0x186f('0x3c')](_0x154d3b['model'],qs[_0x186f('0x3d')](_0x52df9a[_0x186f('0x39')][_0x186f('0x3d')]));_0x4f3901['attributes']=_0x4f3901[_0x186f('0x3e')][_0x186f('0x3f')]?_0x4f3901[_0x186f('0x3e')]:_0x154d3b[_0x186f('0x37')];if(!_0x52df9a[_0x186f('0x39')][_0x186f('0x40')]('nolimit')){_0x4f3901[_0x186f('0x21')]=qs[_0x186f('0x21')](_0x52df9a['query'][_0x186f('0x21')]);_0x4f3901[_0x186f('0x1f')]=qs[_0x186f('0x1f')](_0x52df9a['query'][_0x186f('0x1f')]);}_0x4f3901[_0x186f('0x41')]=qs[_0x186f('0x42')](_0x52df9a[_0x186f('0x39')][_0x186f('0x42')]);_0x4f3901[_0x186f('0x43')]=qs[_0x186f('0x3b')](_[_0x186f('0x44')](_0x52df9a[_0x186f('0x39')],_0x154d3b[_0x186f('0x3b')]),_0x3eb8b6);if(_0x52df9a[_0x186f('0x39')][_0x186f('0x45')]){_0x4f3901[_0x186f('0x43')]=_[_0x186f('0x46')](_0x4f3901[_0x186f('0x43')],{'$or':_[_0x186f('0x38')](_0x3eb8b6,function(_0x242e7f){if(_0x242e7f[_0x186f('0x35')]!==_0x186f('0x47')){var _0x2f2297={};_0x2f2297[_0x242e7f['name']]={'$like':'%'+_0x52df9a[_0x186f('0x39')][_0x186f('0x45')]+'%'};return _0x2f2297;}})});}_0x4f3901=_[_0x186f('0x46')]({},_0x4f3901,_0x52df9a[_0x186f('0x48')]);var _0xd2eb33={'where':_0x4f3901['where']};return db['Sound']['count'](_0xd2eb33)[_0x186f('0x2c')](function(_0x29109f){_0x22a23c[_0x186f('0x22')]=_0x29109f;if(_0x52df9a[_0x186f('0x39')][_0x186f('0x49')]){_0x4f3901[_0x186f('0x4a')]=[{'all':!![]}];}return db[_0x186f('0x32')]['findAll'](_0x4f3901);})['then'](function(_0x3f3d8c){_0x22a23c[_0x186f('0x4b')]=_0x3f3d8c;return _0x22a23c;})['then'](respondWithFilteredResult(_0x4a1dfc,_0x4f3901))[_0x186f('0x4c')](handleError(_0x4a1dfc,null));};exports[_0x186f('0x4d')]=function(_0x3a9d61,_0x1311b8){var _0x549408={'raw':!![],'where':{'id':_0x3a9d61[_0x186f('0x4e')]['id']}},_0x5aee6b={};_0x5aee6b[_0x186f('0x37')]=_[_0x186f('0x3a')](db[_0x186f('0x32')][_0x186f('0x33')]);_0x5aee6b[_0x186f('0x39')]=_['keys'](_0x3a9d61['query']);_0x5aee6b['filters']=_[_0x186f('0x3c')](_0x5aee6b['model'],_0x5aee6b[_0x186f('0x39')]);_0x549408['attributes']=_[_0x186f('0x3c')](_0x5aee6b['model'],qs[_0x186f('0x3d')](_0x3a9d61['query'][_0x186f('0x3d')]));_0x549408[_0x186f('0x3e')]=_0x549408[_0x186f('0x3e')][_0x186f('0x3f')]?_0x549408[_0x186f('0x3e')]:_0x5aee6b[_0x186f('0x37')];if(_0x3a9d61[_0x186f('0x39')][_0x186f('0x49')]){_0x549408[_0x186f('0x4a')]=[{'all':!![]}];}_0x549408=_[_0x186f('0x46')]({},_0x549408,_0x3a9d61['options']);return db['Sound'][_0x186f('0x4f')](_0x549408)[_0x186f('0x2c')](handleEntityNotFound(_0x1311b8,null))['then'](respondWithResult(_0x1311b8,null))[_0x186f('0x4c')](handleError(_0x1311b8,null));};exports[_0x186f('0x50')]=function(_0x176bbb,_0x1fa183,_0x125b57){return db[_0x186f('0x32')][_0x186f('0x4f')]({'where':{'id':_0x176bbb[_0x186f('0x4e')]['id']},'attributes':[_0x186f('0x2f'),_0x186f('0x51'),_0x186f('0x52')],'raw':!![]})[_0x186f('0x2c')](handleEntityNotFound(_0x1fa183,null))[_0x186f('0x2c')](function(_0x2ce507){if(_0x2ce507){if(!fs[_0x186f('0x53')](path['join'](config[_0x186f('0x54')],_0x186f('0x55'),_0x2ce507['save_name']+'.'+_0x2ce507[_0x186f('0x52')]))){throw new db[(_0x186f('0x56'))][(_0x186f('0x57'))](_0x186f('0x58'));}return _0x1fa183[_0x186f('0x50')](path[_0x186f('0x59')](config['root'],_0x186f('0x55'),util[_0x186f('0x5a')]('%s.%s',_0x2ce507[_0x186f('0x51')],_0x2ce507[_0x186f('0x52')])),util[_0x186f('0x5a')](_0x186f('0x5b'),_0x2ce507[_0x186f('0x2f')],_0x2ce507['converted_format']));}return null;})[_0x186f('0x4c')](handleError(_0x1fa183,null));};exports['create']=function(_0x41e6ef,_0x4e27ba,_0x5d208b){var _0x46f300={'name':path[_0x186f('0x5c')](_0x41e6ef['file']['originalname'],path[_0x186f('0x5d')](_0x41e6ef[_0x186f('0x5e')]['originalname'])),'save_name':path[_0x186f('0x5c')](_0x41e6ef[_0x186f('0x5e')]['filename'],path[_0x186f('0x5d')](_0x41e6ef['file'][_0x186f('0x5f')])),'original_format':path['extname'](_0x41e6ef['file']['originalname'])[_0x186f('0x60')](0x1),'converted_format':_0x186f('0x61')};var _0x4d2147=path[_0x186f('0x59')](config['root'],_0x186f('0x62'),_0x41e6ef[_0x186f('0x5e')][_0x186f('0x5f')]);var _0x29066f=path['join'](config['root'],_0x186f('0x55'),util[_0x186f('0x5a')](_0x186f('0x5b'),path[_0x186f('0x5c')](_0x41e6ef[_0x186f('0x5e')]['filename'],path[_0x186f('0x5d')](_0x41e6ef[_0x186f('0x5e')][_0x186f('0x5f')])),_0x46f300[_0x186f('0x52')]));logger[_0x186f('0x63')](_0x186f('0x64'),_0x4d2147);logger['info'](_0x186f('0x65'),_0x29066f);try{fs[_0x186f('0x66')](_0x4d2147,parseInt(_0x186f('0x67'),0x8));var _0x57c788=sox['transcode'](_0x4d2147,_0x29066f,{'sampleRate':0x1f40,'format':_0x186f('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x57c788['on'](_0x186f('0x68'),function(_0x1fc535){fs[_0x186f('0x69')](_0x4d2147);_0x4e27ba[_0x186f('0x1d')](0x1f4)[_0x186f('0x30')](_0x1fc535);});_0x57c788['on'](_0x186f('0x6a'),function(_0x16766c){_0x46f300[_0x186f('0x6b')]=isNaN(_0x16766c[_0x186f('0x6c')])?null:_0x16766c[_0x186f('0x6c')]*0x3e8;_0x46f300[_0x186f('0x6d')]=isNaN(_0x16766c[_0x186f('0x6e')])?null:_0x16766c[_0x186f('0x6e')];_0x46f300[_0x186f('0x6f')]=isNaN(_0x16766c[_0x186f('0x70')])?null:_0x16766c[_0x186f('0x70')];_0x46f300[_0x186f('0x71')]=isNaN(_0x16766c[_0x186f('0x72')])?null:_0x16766c[_0x186f('0x72')];_0x46f300[_0x186f('0x73')]=isNaN(_0x16766c['sampleRate'])?null:_0x16766c[_0x186f('0x74')];});_0x57c788['on'](_0x186f('0x75'),function(_0x53f1de){_0x46f300[_0x186f('0x76')]=isNaN(_0x53f1de[_0x186f('0x6c')])?null:_0x53f1de[_0x186f('0x6c')]*0x3e8;_0x46f300[_0x186f('0x77')]=isNaN(_0x53f1de[_0x186f('0x6e')])?null:_0x53f1de[_0x186f('0x6e')];_0x46f300['converted_channelCount']=isNaN(_0x53f1de[_0x186f('0x70')])?null:_0x53f1de['channelCount'];_0x46f300[_0x186f('0x78')]=isNaN(_0x53f1de[_0x186f('0x72')])?null:_0x53f1de['bitRate'];_0x46f300[_0x186f('0x79')]=isNaN(_0x53f1de[_0x186f('0x74')])?null:_0x53f1de[_0x186f('0x74')];});_0x57c788['on'](_0x186f('0x2d'),function(){fs['chmodSync'](_0x29066f,parseInt(_0x186f('0x67'),0x8));return db['Sound'][_0x186f('0x7a')](_0x46f300)[_0x186f('0x2c')](function(_0x41eab1){var _0x186c63={'role':_0x41e6ef['body']['role'],'userProfileId':_0x41e6ef[_0x186f('0x7b')][_0x186f('0x7c')]};if(!_0x186c63)throw new Error(_0x186f('0x7d'));if(_0x186c63[_0x186f('0x7e')]===_0x186f('0x7f')){var _0x195d3a=_0x41eab1['get']({'plain':!![]});return db[_0x186f('0x80')]['find']({'where':{'name':_0x186f('0x2a'),'userProfileId':_0x186c63['userProfileId']},'raw':!![]})[_0x186f('0x2c')](function(_0x625229){if(_0x625229&&_0x625229[_0x186f('0x81')]===0x0){return db['UserProfileResource'][_0x186f('0x7a')]({'name':_0x195d3a[_0x186f('0x2f')],'resourceId':_0x195d3a['id'],'type':_0x625229[_0x186f('0x2f')],'sectionId':_0x625229['id']},{})['then'](function(){return _0x41eab1;});}else{return _0x41eab1;}})['catch'](function(_0x57f0ea){logger[_0x186f('0x68')](_0x186f('0x82'),_0x57f0ea);throw _0x57f0ea;});}return _0x41eab1;})[_0x186f('0x2c')](respondWithResult(_0x4e27ba,null))['catch'](handleError(_0x4e27ba,null));});_0x57c788[_0x186f('0x83')]();}catch(_0x28e754){_0x4e27ba[_0x186f('0x1d')](0x1f4)[_0x186f('0x30')](_0x28e754);}};exports['update']=function(_0x51745a,_0x1117ec,_0x4e511b){return db['Sound']['find']({'where':{'id':_0x51745a[_0x186f('0x4e')]['id']}})[_0x186f('0x2c')](handleEntityNotFound(_0x1117ec,null))[_0x186f('0x2c')](saveUpdates(_[_0x186f('0x44')](_0x51745a[_0x186f('0x7b')],[_0x186f('0x2f'),_0x186f('0x84')]),null))[_0x186f('0x2c')](respondWithResult(_0x1117ec,null))['catch'](handleError(_0x1117ec,null));};exports[_0x186f('0x85')]=function(_0x160704,_0x151f5e,_0x5a5021){return db[_0x186f('0x32')]['find']({'where':{'id':_0x160704['params']['id']}})['then'](function(_0x4fad04){if(_0x4fad04){return _0x4fad04[_0x186f('0x28')]();}})[_0x186f('0x2c')](function(_0x146c7d){var _0x4488bb=path[_0x186f('0x59')](config[_0x186f('0x54')],_0x186f('0x62'),util[_0x186f('0x5a')](_0x186f('0x5b'),_0x146c7d[_0x186f('0x51')],_0x146c7d[_0x186f('0x86')]));var _0x3da78c=path['join'](config[_0x186f('0x54')],'server/files/sounds/converted',util[_0x186f('0x5a')]('%s.%s',_0x146c7d[_0x186f('0x51')],_0x146c7d['converted_format']));fs[_0x186f('0x69')](_0x4488bb);fs['unlinkSync'](_0x3da78c);return _0x146c7d;})[_0x186f('0x2c')](function(_0x5e0877){if(_0x5e0877){return _0x151f5e['status'](0xcc)[_0x186f('0x2d')]();}})[_0x186f('0x2c')](handleEntityNotFound(_0x151f5e,null))[_0x186f('0x4c')](handleError(_0x151f5e,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3159caa..17cf94c 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 _0xeda2=['tools_sounds','lodash','api','bluebird','path','rimraf','./sound.attributes','exports','define','Sound'];(function(_0x143771,_0x3459d1){var _0x49dc42=function(_0x502efb){while(--_0x502efb){_0x143771['push'](_0x143771['shift']());}};_0x49dc42(++_0x3459d1);}(_0xeda2,0xa1));var _0x2eda=function(_0xd07e81,_0x1ccacd){_0xd07e81=_0xd07e81-0x0;var _0x379364=_0xeda2[_0xd07e81];return _0x379364;};'use strict';var _=require(_0x2eda('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2eda('0x1'));var moment=require('moment');var BPromise=require(_0x2eda('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2eda('0x3'));var rimraf=require(_0x2eda('0x4'));var config=require('../../config/environment');var attributes=require(_0x2eda('0x5'));module[_0x2eda('0x6')]=function(_0x4f7d36,_0xdff19b){return _0x4f7d36[_0x2eda('0x7')](_0x2eda('0x8'),attributes,{'tableName':_0x2eda('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f68=['Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./sound.attributes','exports','define'];(function(_0x4a6a97,_0x4feeba){var _0x58a3e7=function(_0x51831f){while(--_0x51831f){_0x4a6a97['push'](_0x4a6a97['shift']());}};_0x58a3e7(++_0x4feeba);}(_0x2f68,0x1ca));var _0x82f6=function(_0x2fd24a,_0x289fcf){_0x2fd24a=_0x2fd24a-0x0;var _0xeb3cab=_0x2f68[_0x2fd24a];return _0xeb3cab;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var BPromise=require(_0x82f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82f6('0x5'));var rimraf=require('rimraf');var config=require(_0x82f6('0x6'));var attributes=require(_0x82f6('0x7'));module[_0x82f6('0x8')]=function(_0x2ccc1a,_0xbc0740){return _0x2ccc1a[_0x82f6('0x9')](_0x82f6('0xa'),attributes,{'tableName':_0x82f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index f0da45e..e81e612 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 _0x2f68=['Sound','find','options','raw','attributes','include','map','model','ShowSound','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','Sound,\x20%s,\x20%s','result'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x2f68,0x14b));var _0x82f6=function(_0x4b391b,_0x4eae98){_0x4b391b=_0x4b391b-0x0;var _0x293b6e=_0x2f68[_0x4b391b];return _0x293b6e;};'use strict';var _=require(_0x82f6('0x0'));var util=require(_0x82f6('0x1'));var moment=require(_0x82f6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82f6('0x3'));var db=require(_0x82f6('0x4'))['db'];var utils=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))(_0x82f6('0x7'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x8'));var client=jayson[_0x82f6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd3ec,_0x2ed5fa,_0x20b1b3){return new BPromise(function(_0x2672dc,_0x12d1bb){return client[_0x82f6('0xa')](_0x4fd3ec,_0x20b1b3)[_0x82f6('0xb')](function(_0x359ee8){logger[_0x82f6('0xc')]('Sound,\x20%s,\x20%s',_0x2ed5fa,_0x82f6('0xd'));logger[_0x82f6('0xe')](_0x82f6('0xf'),_0x2ed5fa,'request\x20sent',JSON['stringify'](_0x359ee8));if(_0x359ee8[_0x82f6('0x10')]){if(_0x359ee8[_0x82f6('0x10')][_0x82f6('0x11')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x2ed5fa,_0x359ee8[_0x82f6('0x10')][_0x82f6('0x12')]);return _0x12d1bb(_0x359ee8[_0x82f6('0x10')]['message']);}logger['error']('Sound,\x20%s,\x20%s',_0x2ed5fa,_0x359ee8[_0x82f6('0x10')][_0x82f6('0x12')]);return _0x2672dc(_0x359ee8[_0x82f6('0x10')][_0x82f6('0x12')]);}else{logger[_0x82f6('0xc')](_0x82f6('0x13'),_0x2ed5fa,_0x82f6('0xd'));_0x2672dc(_0x359ee8[_0x82f6('0x14')][_0x82f6('0x12')]);}})['catch'](function(_0x167276){logger['error'](_0x82f6('0x13'),_0x2ed5fa,_0x167276);_0x12d1bb(_0x167276);});});}exports['ShowSound']=function(_0x451375){var _0x5ff438=this;return new Promise(function(_0x6c51e4,_0x25e448){return db[_0x82f6('0x15')][_0x82f6('0x16')]({'raw':_0x451375[_0x82f6('0x17')]?_0x451375[_0x82f6('0x17')][_0x82f6('0x18')]===undefined?!![]:![]:!![],'where':_0x451375[_0x82f6('0x17')]?_0x451375['options']['where']||null:null,'attributes':_0x451375[_0x82f6('0x17')]?_0x451375[_0x82f6('0x17')][_0x82f6('0x19')]||null:null,'include':_0x451375[_0x82f6('0x17')]?_0x451375[_0x82f6('0x17')][_0x82f6('0x1a')]?_[_0x82f6('0x1b')](_0x451375[_0x82f6('0x17')]['include'],function(_0x3f269a){return{'model':db[_0x3f269a[_0x82f6('0x1c')]],'as':_0x3f269a['as'],'attributes':_0x3f269a['attributes'],'include':_0x3f269a[_0x82f6('0x1a')]?_[_0x82f6('0x1b')](_0x3f269a[_0x82f6('0x1a')],function(_0x4416e2){return{'model':db[_0x4416e2[_0x82f6('0x1c')]],'as':_0x4416e2['as'],'attributes':_0x4416e2[_0x82f6('0x19')],'include':_0x4416e2[_0x82f6('0x1a')]?_[_0x82f6('0x1b')](_0x4416e2['include'],function(_0x1d003a){return{'model':db[_0x1d003a[_0x82f6('0x1c')]],'as':_0x1d003a['as'],'attributes':_0x1d003a['attributes']};}):[]};}):[]};}):[]:[]})[_0x82f6('0xb')](function(_0x14addb){logger[_0x82f6('0xc')](_0x82f6('0x1d'),_0x451375);logger['debug'](_0x82f6('0x1d'),_0x451375,JSON[_0x82f6('0x1e')](_0x14addb));_0x6c51e4(_0x14addb);})[_0x82f6('0x1f')](function(_0x2c774b){logger[_0x82f6('0x10')](_0x82f6('0x1d'),_0x2c774b[_0x82f6('0x12')],_0x451375);_0x25e448(_0x5ff438[_0x82f6('0x10')](0x1f4,_0x2c774b[_0x82f6('0x12')]));});});}; \ No newline at end of file +var _0x3d2f=['info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','message','result','Sound','find','options','raw','where','include','map','model','attributes','ShowSound','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x9cbd0f,_0x46db23){var _0x4305f6=function(_0x424f67){while(--_0x424f67){_0x9cbd0f['push'](_0x9cbd0f['shift']());}};_0x4305f6(++_0x46db23);}(_0x3d2f,0x199));var _0xf3d2=function(_0x22c15a,_0x2d6084){_0x22c15a=_0x22c15a-0x0;var _0x1071ca=_0x3d2f[_0x22c15a];return _0x1071ca;};'use strict';var _=require(_0xf3d2('0x0'));var util=require('util');var moment=require(_0xf3d2('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3d2('0x2'));var fs=require('fs');var Redis=require(_0xf3d2('0x3'));var db=require(_0xf3d2('0x4'))['db'];var utils=require(_0xf3d2('0x5'));var logger=require('../../config/logger')(_0xf3d2('0x6'));var config=require(_0xf3d2('0x7'));var jayson=require(_0xf3d2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56c572,_0x3c4c84,_0x3cf5ed){return new BPromise(function(_0x4bc395,_0x3f3422){return client[_0xf3d2('0x9')](_0x56c572,_0x3cf5ed)[_0xf3d2('0xa')](function(_0x97bc43){logger[_0xf3d2('0xb')](_0xf3d2('0xc'),_0x3c4c84,_0xf3d2('0xd'));logger[_0xf3d2('0xe')](_0xf3d2('0xf'),_0x3c4c84,_0xf3d2('0xd'),JSON['stringify'](_0x97bc43));if(_0x97bc43[_0xf3d2('0x10')]){if(_0x97bc43[_0xf3d2('0x10')]['code']===0x1f4){logger[_0xf3d2('0x10')](_0xf3d2('0xc'),_0x3c4c84,_0x97bc43[_0xf3d2('0x10')][_0xf3d2('0x11')]);return _0x3f3422(_0x97bc43[_0xf3d2('0x10')]['message']);}logger[_0xf3d2('0x10')]('Sound,\x20%s,\x20%s',_0x3c4c84,_0x97bc43['error'][_0xf3d2('0x11')]);return _0x4bc395(_0x97bc43['error'][_0xf3d2('0x11')]);}else{logger[_0xf3d2('0xb')](_0xf3d2('0xc'),_0x3c4c84,_0xf3d2('0xd'));_0x4bc395(_0x97bc43[_0xf3d2('0x12')][_0xf3d2('0x11')]);}})['catch'](function(_0x4aa7cf){logger[_0xf3d2('0x10')](_0xf3d2('0xc'),_0x3c4c84,_0x4aa7cf);_0x3f3422(_0x4aa7cf);});});}exports['ShowSound']=function(_0x31bf10){var _0x5e4289=this;return new Promise(function(_0x4eea2e,_0xf7b949){return db[_0xf3d2('0x13')][_0xf3d2('0x14')]({'raw':_0x31bf10['options']?_0x31bf10[_0xf3d2('0x15')][_0xf3d2('0x16')]===undefined?!![]:![]:!![],'where':_0x31bf10['options']?_0x31bf10[_0xf3d2('0x15')][_0xf3d2('0x17')]||null:null,'attributes':_0x31bf10[_0xf3d2('0x15')]?_0x31bf10['options']['attributes']||null:null,'include':_0x31bf10[_0xf3d2('0x15')]?_0x31bf10[_0xf3d2('0x15')][_0xf3d2('0x18')]?_[_0xf3d2('0x19')](_0x31bf10[_0xf3d2('0x15')]['include'],function(_0x618ca3){return{'model':db[_0x618ca3[_0xf3d2('0x1a')]],'as':_0x618ca3['as'],'attributes':_0x618ca3[_0xf3d2('0x1b')],'include':_0x618ca3[_0xf3d2('0x18')]?_['map'](_0x618ca3[_0xf3d2('0x18')],function(_0x1bbf09){return{'model':db[_0x1bbf09[_0xf3d2('0x1a')]],'as':_0x1bbf09['as'],'attributes':_0x1bbf09['attributes'],'include':_0x1bbf09[_0xf3d2('0x18')]?_[_0xf3d2('0x19')](_0x1bbf09['include'],function(_0x399b47){return{'model':db[_0x399b47[_0xf3d2('0x1a')]],'as':_0x399b47['as'],'attributes':_0x399b47[_0xf3d2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf3d2('0xa')](function(_0x3b0d2b){logger[_0xf3d2('0xb')](_0xf3d2('0x1c'),_0x31bf10);logger[_0xf3d2('0xe')](_0xf3d2('0x1c'),_0x31bf10,JSON[_0xf3d2('0x1d')](_0x3b0d2b));_0x4eea2e(_0x3b0d2b);})['catch'](function(_0x11ca02){logger[_0xf3d2('0x10')](_0xf3d2('0x1c'),_0x11ca02[_0xf3d2('0x11')],_0x31bf10);_0xf7b949(_0x5e4289['error'](0x1f4,_0x11ca02[_0xf3d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b99143b..f1a3ade 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x385417,_0x1d4e6d){var _0x328c65=function(_0x589c2e){while(--_0x589c2e){_0x385417['push'](_0x385417['shift']());}};_0x328c65(++_0x1d4e6d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x5eb8[_0x1d426f];return _0x17f71a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x43bf82,_0x2b3925){var _0x33a6ae=function(_0x29ddf8){while(--_0x29ddf8){_0x43bf82['push'](_0x43bf82['shift']());}};_0x33a6ae(++_0x2b3925);}(_0x5eb8,0xb0));var _0x85eb=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x5eb8[_0x41ee16];return _0x1f60de;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6fb7c6d..3bdb539 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 _0x18ed=['TEXT','sequelize','exports','medium','out','STRING'];(function(_0x2fe182,_0x7a9b59){var _0x4b8a6d=function(_0x3af5ec){while(--_0x3af5ec){_0x2fe182['push'](_0x2fe182['shift']());}};_0x4b8a6d(++_0x7a9b59);}(_0x18ed,0x1ed));var _0xd18e=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x18ed[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xd18e('0x0'));module[_0xd18e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xd18e('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xd18e('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd18e('0x4')]},'providerResponse':{'type':Sequelize[_0xd18e('0x5')]}}; \ No newline at end of file +var _0x5878=['out','TEXT','sequelize','exports','STRING','medium'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5878,0x19a));var _0x8587=function(_0xa980c3,_0x5ec51c){_0xa980c3=_0xa980c3-0x0;var _0x517126=_0x5878[_0xa980c3];return _0x517126;};'use strict';var Sequelize=require(_0x8587('0x0'));module[_0x8587('0x1')]={'uniqueid':{'type':Sequelize[_0x8587('0x2')]},'body':{'type':Sequelize['TEXT'](_0x8587('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8587('0x4')),'defaultValue':_0x8587('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x8587('0x2')]},'providerResponse':{'type':Sequelize[_0x8587('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ce03075..a72803f 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 _0x8fcd=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','merge','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x4d2114,_0x1718a5){_0x4d2114=_0x4d2114-0x0;var _0x651f3=_0x8fcd[_0x4d2114];return _0x651f3;};'use strict';var emlformat=require(_0xd8fc('0x0'));var rimraf=require(_0xd8fc('0x1'));var zipdir=require(_0xd8fc('0x2'));var jsonpatch=require(_0xd8fc('0x3'));var rp=require(_0xd8fc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8fc('0x5'));var util=require(_0xd8fc('0x6'));var path=require(_0xd8fc('0x7'));var sox=require(_0xd8fc('0x8'));var csv=require(_0xd8fc('0x9'));var ejs=require(_0xd8fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8fc('0xc'));var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0x9'));var querystring=require(_0xd8fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd8fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8fc('0x10'));var logger=require(_0xd8fc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd8fc('0x12'));var licenseUtil=require(_0xd8fc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c41e9,_0x955550){_0x955550=_0x955550||0xcc;return function(_0x2b9d7e){if(_0x2b9d7e){return _0x3c41e9[_0xd8fc('0x14')](_0x955550);}return _0x3c41e9[_0xd8fc('0x15')](_0x955550)['end']();};}function respondWithResult(_0x32b375,_0x4f1064){_0x4f1064=_0x4f1064||0xc8;return function(_0x4761f){if(_0x4761f){return _0x32b375[_0xd8fc('0x15')](_0x4f1064)[_0xd8fc('0x16')](_0x4761f);}};}function respondWithFilteredResult(_0x524bac,_0x426e56){return function(_0x233c7e){if(_0x233c7e){var _0x57838b=typeof _0x426e56['offset']===_0xd8fc('0x17')&&typeof _0x426e56[_0xd8fc('0x18')]===_0xd8fc('0x17');var _0x4daf69=_0x233c7e[_0xd8fc('0x19')];var _0x1c744d=_0x57838b?0x0:_0x426e56[_0xd8fc('0x1a')];var _0x1cb0d4=_0x57838b?_0x233c7e[_0xd8fc('0x19')]:_0x426e56[_0xd8fc('0x1a')]+_0x426e56[_0xd8fc('0x18')];var _0x1d7e77;if(_0x1cb0d4>=_0x4daf69){_0x1cb0d4=_0x4daf69;_0x1d7e77=0xc8;}else{_0x1d7e77=0xce;}_0x524bac[_0xd8fc('0x15')](_0x1d7e77);return _0x524bac['set'](_0xd8fc('0x1b'),_0x1c744d+'-'+_0x1cb0d4+'/'+_0x4daf69)[_0xd8fc('0x16')](_0x233c7e);}return null;};}function patchUpdates(_0x24001d){return function(_0x3f9d57){try{jsonpatch[_0xd8fc('0x1c')](_0x3f9d57,_0x24001d,!![]);}catch(_0xd24b3f){return BPromise['reject'](_0xd24b3f);}return _0x3f9d57[_0xd8fc('0x1d')]();};}function saveUpdates(_0x3f0196,_0x5cd1f9){return function(_0x37a93b){if(_0x37a93b){return _0x37a93b['update'](_0x3f0196)[_0xd8fc('0x1e')](function(_0x370a62){return _0x370a62;});}return null;};}function removeEntity(_0x59b0ef,_0x5c852a){return function(_0x47ccff){if(_0x47ccff){return _0x47ccff[_0xd8fc('0x1f')]()[_0xd8fc('0x1e')](function(){_0x59b0ef[_0xd8fc('0x15')](0xcc)[_0xd8fc('0x20')]();});}};}function handleEntityNotFound(_0x495bd2,_0x71dcc1){return function(_0x45ac21){if(!_0x45ac21){_0x495bd2['sendStatus'](0x194);}return _0x45ac21;};}function handleError(_0x270204,_0x5e50c4){_0x5e50c4=_0x5e50c4||0x1f4;return function(_0x200a2b){logger[_0xd8fc('0x21')](_0x200a2b[_0xd8fc('0x22')]);if(_0x200a2b[_0xd8fc('0x23')]){delete _0x200a2b['name'];}_0x270204[_0xd8fc('0x15')](_0x5e50c4)['send'](_0x200a2b);};}exports[_0xd8fc('0x24')]=function(_0x1692d0,_0x4e823d){var _0x4a5383={},_0x56a980={},_0x3bec97={'count':0x0,'rows':[]};var _0x2081ca=_[_0xd8fc('0x25')](db[_0xd8fc('0x26')][_0xd8fc('0x27')],function(_0x281559){return{'name':_0x281559[_0xd8fc('0x28')],'type':_0x281559[_0xd8fc('0x29')][_0xd8fc('0x2a')]};});_0x56a980['model']=_[_0xd8fc('0x25')](_0x2081ca,_0xd8fc('0x23'));_0x56a980['query']=_[_0xd8fc('0x2b')](_0x1692d0[_0xd8fc('0x2c')]);_0x56a980[_0xd8fc('0x2d')]=_['intersection'](_0x56a980[_0xd8fc('0x2e')],_0x56a980[_0xd8fc('0x2c')]);_0x4a5383[_0xd8fc('0x2f')]=_['intersection'](_0x56a980['model'],qs['fields'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0x4a5383[_0xd8fc('0x2f')]=_0x4a5383[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0x4a5383[_0xd8fc('0x2f')]:_0x56a980[_0xd8fc('0x2e')];if(!_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x32')](_0xd8fc('0x33'))){_0x4a5383['limit']=qs[_0xd8fc('0x18')](_0x1692d0['query'][_0xd8fc('0x18')]);_0x4a5383['offset']=qs['offset'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x1a')]);}_0x4a5383[_0xd8fc('0x34')]=qs[_0xd8fc('0x35')](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x35')]);_0x4a5383['where']=qs[_0xd8fc('0x2d')](_[_0xd8fc('0x36')](_0x1692d0[_0xd8fc('0x2c')],_0x56a980['filters']),_0x2081ca);if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x37')]){_0x4a5383['where']=_['merge'](_0x4a5383[_0xd8fc('0x38')],{'$or':_['map'](_0x2081ca,function(_0x1ac864){if(_0x1ac864['type']!==_0xd8fc('0x39')){var _0x2cd726={};_0x2cd726[_0x1ac864[_0xd8fc('0x23')]]={'$like':'%'+_0x1692d0['query'][_0xd8fc('0x37')]+'%'};return _0x2cd726;}})});}_0x4a5383=_['merge']({},_0x4a5383,_0x1692d0[_0xd8fc('0x3a')]);var _0x16f411={'where':_0x4a5383['where']};return db[_0xd8fc('0x26')][_0xd8fc('0x19')](_0x16f411)[_0xd8fc('0x1e')](function(_0x17dba2){_0x3bec97['count']=_0x17dba2;if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x3b')]){_0x4a5383[_0xd8fc('0x3c')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x4a5383);})['then'](function(_0x17ffbb){_0x3bec97[_0xd8fc('0x3d')]=_0x17ffbb;return _0x3bec97;})[_0xd8fc('0x1e')](respondWithFilteredResult(_0x4e823d,_0x4a5383))[_0xd8fc('0x3e')](handleError(_0x4e823d,null));};exports['show']=function(_0x32c555,_0x145f37){var _0xaaa4b2={'raw':!![],'where':{'id':_0x32c555[_0xd8fc('0x3f')]['id']}},_0x126ff4={};_0x126ff4[_0xd8fc('0x2e')]=_[_0xd8fc('0x2b')](db['SquareMessage'][_0xd8fc('0x27')]);_0x126ff4[_0xd8fc('0x2c')]=_['keys'](_0x32c555[_0xd8fc('0x2c')]);_0x126ff4[_0xd8fc('0x2d')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],_0x126ff4[_0xd8fc('0x2c')]);_0xaaa4b2[_0xd8fc('0x2f')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],qs[_0xd8fc('0x30')](_0x32c555[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0xaaa4b2[_0xd8fc('0x2f')]=_0xaaa4b2[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0xaaa4b2['attributes']:_0x126ff4['model'];if(_0x32c555['query'][_0xd8fc('0x3b')]){_0xaaa4b2[_0xd8fc('0x3c')]=[{'all':!![]}];}_0xaaa4b2=_[_0xd8fc('0x41')]({},_0xaaa4b2,_0x32c555[_0xd8fc('0x3a')]);return db['SquareMessage'][_0xd8fc('0x42')](_0xaaa4b2)[_0xd8fc('0x1e')](handleEntityNotFound(_0x145f37,null))[_0xd8fc('0x1e')](respondWithResult(_0x145f37,null))[_0xd8fc('0x3e')](handleError(_0x145f37,null));};exports[_0xd8fc('0x43')]=function(_0x19b43e,_0xc12ace){return db['SquareMessage']['create'](_0x19b43e['body'],{})[_0xd8fc('0x1e')](respondWithResult(_0xc12ace,0xc9))[_0xd8fc('0x3e')](handleError(_0xc12ace,null));};exports[_0xd8fc('0x44')]=function(_0x13cd5d,_0x2dd8e0){if(_0x13cd5d[_0xd8fc('0x45')]['id']){delete _0x13cd5d[_0xd8fc('0x45')]['id'];}return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x13cd5d['params']['id']}})['then'](handleEntityNotFound(_0x2dd8e0,null))[_0xd8fc('0x1e')](saveUpdates(_0x13cd5d['body'],null))[_0xd8fc('0x1e')](respondWithResult(_0x2dd8e0,null))['catch'](handleError(_0x2dd8e0,null));};exports[_0xd8fc('0x1f')]=function(_0x3d913a,_0x57206c){return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x3d913a[_0xd8fc('0x3f')]['id']}})[_0xd8fc('0x1e')](handleEntityNotFound(_0x57206c,null))[_0xd8fc('0x1e')](removeEntity(_0x57206c,null))[_0xd8fc('0x3e')](handleError(_0x57206c,null));}; \ No newline at end of file +var _0x0c8d=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','SquareMessage','include','findAll','catch','show','params','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','end'];(function(_0x7bfe1b,_0x3eb3c3){var _0x24e555=function(_0x13afb8){while(--_0x13afb8){_0x7bfe1b['push'](_0x7bfe1b['shift']());}};_0x24e555(++_0x3eb3c3);}(_0x0c8d,0x79));var _0xd0c8=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0c8d[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0c8('0x0'));var zipdir=require(_0xd0c8('0x1'));var jsonpatch=require(_0xd0c8('0x2'));var rp=require(_0xd0c8('0x3'));var moment=require(_0xd0c8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd0c8('0x5'));var csv=require(_0xd0c8('0x6'));var ejs=require(_0xd0c8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0c8('0x8'));var squel=require('squel');var crypto=require(_0xd0c8('0x9'));var jsforce=require(_0xd0c8('0xa'));var deskjs=require(_0xd0c8('0xb'));var toCsv=require(_0xd0c8('0x6'));var querystring=require(_0xd0c8('0xc'));var Papa=require('papaparse');var Redis=require(_0xd0c8('0xd'));var authService=require(_0xd0c8('0xe'));var qs=require(_0xd0c8('0xf'));var as=require(_0xd0c8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0c8('0x11'));var utils=require(_0xd0c8('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x512702,_0x52b163){_0x52b163=_0x52b163||0xcc;return function(_0x367c89){if(_0x367c89){return _0x512702[_0xd0c8('0x13')](_0x52b163);}return _0x512702['status'](_0x52b163)[_0xd0c8('0x14')]();};}function respondWithResult(_0x133ea4,_0x3346f3){_0x3346f3=_0x3346f3||0xc8;return function(_0x2cb982){if(_0x2cb982){return _0x133ea4[_0xd0c8('0x15')](_0x3346f3)[_0xd0c8('0x16')](_0x2cb982);}};}function respondWithFilteredResult(_0x112b53,_0x29ce57){return function(_0x2c25e8){if(_0x2c25e8){var _0x3f52c9=typeof _0x29ce57[_0xd0c8('0x17')]===_0xd0c8('0x18')&&typeof _0x29ce57['limit']===_0xd0c8('0x18');var _0x345430=_0x2c25e8[_0xd0c8('0x19')];var _0x5d02a5=_0x3f52c9?0x0:_0x29ce57['offset'];var _0x32e360=_0x3f52c9?_0x2c25e8['count']:_0x29ce57['offset']+_0x29ce57[_0xd0c8('0x1a')];var _0x20ea41;if(_0x32e360>=_0x345430){_0x32e360=_0x345430;_0x20ea41=0xc8;}else{_0x20ea41=0xce;}_0x112b53['status'](_0x20ea41);return _0x112b53[_0xd0c8('0x1b')](_0xd0c8('0x1c'),_0x5d02a5+'-'+_0x32e360+'/'+_0x345430)['json'](_0x2c25e8);}return null;};}function patchUpdates(_0x1a5a3d){return function(_0x26bee0){try{jsonpatch[_0xd0c8('0x1d')](_0x26bee0,_0x1a5a3d,!![]);}catch(_0x46415e){return BPromise[_0xd0c8('0x1e')](_0x46415e);}return _0x26bee0[_0xd0c8('0x1f')]();};}function saveUpdates(_0x145b95,_0x1a05fd){return function(_0x1438d6){if(_0x1438d6){return _0x1438d6[_0xd0c8('0x20')](_0x145b95)[_0xd0c8('0x21')](function(_0x1d1065){return _0x1d1065;});}return null;};}function removeEntity(_0x30d143,_0x4100d2){return function(_0x430cbf){if(_0x430cbf){return _0x430cbf[_0xd0c8('0x22')]()[_0xd0c8('0x21')](function(){_0x30d143[_0xd0c8('0x15')](0xcc)[_0xd0c8('0x14')]();});}};}function handleEntityNotFound(_0x5dde87,_0x49fa75){return function(_0xc109ee){if(!_0xc109ee){_0x5dde87[_0xd0c8('0x13')](0x194);}return _0xc109ee;};}function handleError(_0x3fcfa7,_0x2ebc92){_0x2ebc92=_0x2ebc92||0x1f4;return function(_0x1c84e5){logger[_0xd0c8('0x23')](_0x1c84e5[_0xd0c8('0x24')]);if(_0x1c84e5[_0xd0c8('0x25')]){delete _0x1c84e5[_0xd0c8('0x25')];}_0x3fcfa7['status'](_0x2ebc92)[_0xd0c8('0x26')](_0x1c84e5);};}exports[_0xd0c8('0x27')]=function(_0x160032,_0x5b3f45){var _0x51d660={},_0x4fa819={},_0x22e125={'count':0x0,'rows':[]};var _0x58f2c2=_[_0xd0c8('0x28')](db['SquareMessage'][_0xd0c8('0x29')],function(_0x10fe0a){return{'name':_0x10fe0a['fieldName'],'type':_0x10fe0a[_0xd0c8('0x2a')][_0xd0c8('0x2b')]};});_0x4fa819[_0xd0c8('0x2c')]=_['map'](_0x58f2c2,_0xd0c8('0x25'));_0x4fa819[_0xd0c8('0x2d')]=_[_0xd0c8('0x2e')](_0x160032[_0xd0c8('0x2d')]);_0x4fa819[_0xd0c8('0x2f')]=_[_0xd0c8('0x30')](_0x4fa819[_0xd0c8('0x2c')],_0x4fa819[_0xd0c8('0x2d')]);_0x51d660[_0xd0c8('0x31')]=_[_0xd0c8('0x30')](_0x4fa819['model'],qs['fields'](_0x160032['query'][_0xd0c8('0x32')]));_0x51d660['attributes']=_0x51d660[_0xd0c8('0x31')]['length']?_0x51d660[_0xd0c8('0x31')]:_0x4fa819[_0xd0c8('0x2c')];if(!_0x160032[_0xd0c8('0x2d')][_0xd0c8('0x33')](_0xd0c8('0x34'))){_0x51d660[_0xd0c8('0x1a')]=qs[_0xd0c8('0x1a')](_0x160032['query'][_0xd0c8('0x1a')]);_0x51d660[_0xd0c8('0x17')]=qs['offset'](_0x160032[_0xd0c8('0x2d')][_0xd0c8('0x17')]);}_0x51d660[_0xd0c8('0x35')]=qs[_0xd0c8('0x36')](_0x160032[_0xd0c8('0x2d')][_0xd0c8('0x36')]);_0x51d660['where']=qs[_0xd0c8('0x2f')](_[_0xd0c8('0x37')](_0x160032[_0xd0c8('0x2d')],_0x4fa819[_0xd0c8('0x2f')]),_0x58f2c2);if(_0x160032[_0xd0c8('0x2d')][_0xd0c8('0x38')]){_0x51d660[_0xd0c8('0x39')]=_['merge'](_0x51d660[_0xd0c8('0x39')],{'$or':_[_0xd0c8('0x28')](_0x58f2c2,function(_0x1eed24){if(_0x1eed24['type']!==_0xd0c8('0x3a')){var _0x1ca8b2={};_0x1ca8b2[_0x1eed24[_0xd0c8('0x25')]]={'$like':'%'+_0x160032[_0xd0c8('0x2d')][_0xd0c8('0x38')]+'%'};return _0x1ca8b2;}})});}_0x51d660=_[_0xd0c8('0x3b')]({},_0x51d660,_0x160032[_0xd0c8('0x3c')]);var _0x55da3d={'where':_0x51d660[_0xd0c8('0x39')]};return db[_0xd0c8('0x3d')][_0xd0c8('0x19')](_0x55da3d)[_0xd0c8('0x21')](function(_0x226422){_0x22e125[_0xd0c8('0x19')]=_0x226422;if(_0x160032[_0xd0c8('0x2d')]['includeAll']){_0x51d660[_0xd0c8('0x3e')]=[{'all':!![]}];}return db['SquareMessage'][_0xd0c8('0x3f')](_0x51d660);})[_0xd0c8('0x21')](function(_0x5b9ab1){_0x22e125['rows']=_0x5b9ab1;return _0x22e125;})[_0xd0c8('0x21')](respondWithFilteredResult(_0x5b3f45,_0x51d660))[_0xd0c8('0x40')](handleError(_0x5b3f45,null));};exports[_0xd0c8('0x41')]=function(_0x3c3dfe,_0x4e3af0){var _0x2a72c1={'raw':!![],'where':{'id':_0x3c3dfe[_0xd0c8('0x42')]['id']}},_0x296d85={};_0x296d85['model']=_[_0xd0c8('0x2e')](db[_0xd0c8('0x3d')][_0xd0c8('0x29')]);_0x296d85[_0xd0c8('0x2d')]=_[_0xd0c8('0x2e')](_0x3c3dfe['query']);_0x296d85[_0xd0c8('0x2f')]=_[_0xd0c8('0x30')](_0x296d85[_0xd0c8('0x2c')],_0x296d85[_0xd0c8('0x2d')]);_0x2a72c1[_0xd0c8('0x31')]=_[_0xd0c8('0x30')](_0x296d85[_0xd0c8('0x2c')],qs[_0xd0c8('0x32')](_0x3c3dfe[_0xd0c8('0x2d')]['fields']));_0x2a72c1[_0xd0c8('0x31')]=_0x2a72c1[_0xd0c8('0x31')][_0xd0c8('0x43')]?_0x2a72c1['attributes']:_0x296d85[_0xd0c8('0x2c')];if(_0x3c3dfe['query']['includeAll']){_0x2a72c1['include']=[{'all':!![]}];}_0x2a72c1=_[_0xd0c8('0x3b')]({},_0x2a72c1,_0x3c3dfe[_0xd0c8('0x3c')]);return db[_0xd0c8('0x3d')][_0xd0c8('0x44')](_0x2a72c1)['then'](handleEntityNotFound(_0x4e3af0,null))[_0xd0c8('0x21')](respondWithResult(_0x4e3af0,null))[_0xd0c8('0x40')](handleError(_0x4e3af0,null));};exports['create']=function(_0x21d89c,_0x2e598d){return db['SquareMessage'][_0xd0c8('0x45')](_0x21d89c[_0xd0c8('0x46')],{})[_0xd0c8('0x21')](respondWithResult(_0x2e598d,0xc9))['catch'](handleError(_0x2e598d,null));};exports[_0xd0c8('0x20')]=function(_0x125e10,_0x1f0f97){if(_0x125e10[_0xd0c8('0x46')]['id']){delete _0x125e10['body']['id'];}return db[_0xd0c8('0x3d')][_0xd0c8('0x44')]({'where':{'id':_0x125e10['params']['id']}})[_0xd0c8('0x21')](handleEntityNotFound(_0x1f0f97,null))['then'](saveUpdates(_0x125e10[_0xd0c8('0x46')],null))[_0xd0c8('0x21')](respondWithResult(_0x1f0f97,null))[_0xd0c8('0x40')](handleError(_0x1f0f97,null));};exports[_0xd0c8('0x22')]=function(_0x39ae40,_0x43d401){return db[_0xd0c8('0x3d')]['find']({'where':{'id':_0x39ae40[_0xd0c8('0x42')]['id']}})[_0xd0c8('0x21')](handleEntityNotFound(_0x43d401,null))['then'](removeEntity(_0x43d401,null))[_0xd0c8('0x40')](handleError(_0x43d401,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 8e0fc48..b5d18de 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 _0xcfa7=['square_messages','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0xc08d30,_0x45a47b){var _0x5c6681=function(_0x456456){while(--_0x456456){_0xc08d30['push'](_0xc08d30['shift']());}};_0x5c6681(++_0x45a47b);}(_0xcfa7,0xdd));var _0x7cfa=function(_0x5ef7b6,_0x50a2d2){_0x5ef7b6=_0x5ef7b6-0x0;var _0x16927d=_0xcfa7[_0x5ef7b6];return _0x16927d;};'use strict';var _=require(_0x7cfa('0x0'));var util=require(_0x7cfa('0x1'));var logger=require(_0x7cfa('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7cfa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cfa('0x4'));var rimraf=require(_0x7cfa('0x5'));var config=require(_0x7cfa('0x6'));var attributes=require(_0x7cfa('0x7'));module[_0x7cfa('0x8')]=function(_0x40b3e2,_0x1606f6){return _0x40b3e2[_0x7cfa('0x9')]('SquareMessage',attributes,{'tableName':_0x7cfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2390=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x2390,0x165));var _0x0239=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2390[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x0239('0x0'));var logger=require(_0x0239('0x1'))(_0x0239('0x2'));var moment=require(_0x0239('0x3'));var BPromise=require(_0x0239('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0239('0x5'));var rimraf=require(_0x0239('0x6'));var config=require(_0x0239('0x7'));var attributes=require(_0x0239('0x8'));module[_0x0239('0x9')]=function(_0x42eedd,_0x145970){return _0x42eedd[_0x0239('0xa')](_0x0239('0xb'),attributes,{'tableName':_0x0239('0xc'),'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 42a194a..3b00287 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 _0x1cae=['../../config/environment','jayson/promise','client','request','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','SquareMessage,\x20%s,\x20%s','error','message','result','catch','CreateSquareMessage','create','body','options','raw','then','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x24a8c7,_0x26ffdf){var _0x486f46=function(_0x33d502){while(--_0x33d502){_0x24a8c7['push'](_0x24a8c7['shift']());}};_0x486f46(++_0x26ffdf);}(_0x1cae,0x81));var _0xe1ca=function(_0xa6ff4,_0x3a37cd){_0xa6ff4=_0xa6ff4-0x0;var _0x51ca29=_0x1cae[_0xa6ff4];return _0x51ca29;};'use strict';var _=require(_0xe1ca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe1ca('0x1'));var rs=require(_0xe1ca('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe1ca('0x3'));var logger=require(_0xe1ca('0x4'))(_0xe1ca('0x5'));var config=require(_0xe1ca('0x6'));var jayson=require(_0xe1ca('0x7'));var client=jayson[_0xe1ca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b77b4,_0x430820,_0x61e554){return new BPromise(function(_0x4fecf7,_0x59d417){return client[_0xe1ca('0x9')](_0x3b77b4,_0x61e554)['then'](function(_0x19f434){logger[_0xe1ca('0xa')]('SquareMessage,\x20%s,\x20%s',_0x430820,'request\x20sent');logger[_0xe1ca('0xb')](_0xe1ca('0xc'),_0x430820,_0xe1ca('0xd'),JSON[_0xe1ca('0xe')](_0x19f434));if(_0x19f434['error']){if(_0x19f434['error'][_0xe1ca('0xf')]===0x1f4){logger['error'](_0xe1ca('0x10'),_0x430820,_0x19f434[_0xe1ca('0x11')][_0xe1ca('0x12')]);return _0x59d417(_0x19f434[_0xe1ca('0x11')]['message']);}logger[_0xe1ca('0x11')]('SquareMessage,\x20%s,\x20%s',_0x430820,_0x19f434[_0xe1ca('0x11')][_0xe1ca('0x12')]);return _0x4fecf7(_0x19f434[_0xe1ca('0x11')][_0xe1ca('0x12')]);}else{logger[_0xe1ca('0xa')](_0xe1ca('0x10'),_0x430820,_0xe1ca('0xd'));_0x4fecf7(_0x19f434[_0xe1ca('0x13')]['message']);}})[_0xe1ca('0x14')](function(_0x48088a){logger[_0xe1ca('0x11')](_0xe1ca('0x10'),_0x430820,_0x48088a);_0x59d417(_0x48088a);});});}exports[_0xe1ca('0x15')]=function(_0x35cb78){var _0x347b23=this;return new Promise(function(_0x5c8356,_0x308318){return db['SquareMessage'][_0xe1ca('0x16')](_0x35cb78[_0xe1ca('0x17')],{'raw':_0x35cb78['options']?_0x35cb78[_0xe1ca('0x18')][_0xe1ca('0x19')]===undefined?!![]:![]:!![]})[_0xe1ca('0x1a')](function(_0x2910c3){logger[_0xe1ca('0xa')](_0xe1ca('0x15'),_0x35cb78);logger['debug'](_0xe1ca('0x15'),_0x35cb78,JSON[_0xe1ca('0xe')](_0x2910c3));_0x5c8356(_0x2910c3);})[_0xe1ca('0x14')](function(_0x2cd38e){logger[_0xe1ca('0x11')]('CreateSquareMessage',_0x2cd38e[_0xe1ca('0x12')],_0x35cb78);_0x308318(_0x347b23[_0xe1ca('0x11')](0x1f4,_0x2cd38e[_0xe1ca('0x12')]));});});}; \ No newline at end of file +var _0x76ca=['rpc','../../config/environment','client','http','request','then','info','debug','error','code','SquareMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','SquareMessage','create','body','options','raw','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xbad09a,_0x239fa2){var _0xaababe=function(_0x4f4e06){while(--_0x4f4e06){_0xbad09a['push'](_0xbad09a['shift']());}};_0xaababe(++_0x239fa2);}(_0x76ca,0x1c8));var _0xa76c=function(_0xbc9363,_0x51482a){_0xbc9363=_0xbc9363-0x0;var _0x2100cd=_0x76ca[_0xbc9363];return _0x2100cd;};'use strict';var _=require(_0xa76c('0x0'));var util=require(_0xa76c('0x1'));var moment=require(_0xa76c('0x2'));var BPromise=require(_0xa76c('0x3'));var rs=require(_0xa76c('0x4'));var fs=require('fs');var Redis=require(_0xa76c('0x5'));var db=require(_0xa76c('0x6'))['db'];var utils=require(_0xa76c('0x7'));var logger=require('../../config/logger')(_0xa76c('0x8'));var config=require(_0xa76c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa76c('0xa')][_0xa76c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a773,_0x7ef0f0,_0x397a8a){return new BPromise(function(_0x3b5c1f,_0x3c3c6b){return client[_0xa76c('0xc')](_0x58a773,_0x397a8a)[_0xa76c('0xd')](function(_0x48ae37){logger[_0xa76c('0xe')]('SquareMessage,\x20%s,\x20%s',_0x7ef0f0,'request\x20sent');logger[_0xa76c('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x7ef0f0,'request\x20sent',JSON['stringify'](_0x48ae37));if(_0x48ae37[_0xa76c('0x10')]){if(_0x48ae37['error'][_0xa76c('0x11')]===0x1f4){logger[_0xa76c('0x10')](_0xa76c('0x12'),_0x7ef0f0,_0x48ae37[_0xa76c('0x10')]['message']);return _0x3c3c6b(_0x48ae37[_0xa76c('0x10')]['message']);}logger[_0xa76c('0x10')](_0xa76c('0x12'),_0x7ef0f0,_0x48ae37[_0xa76c('0x10')][_0xa76c('0x13')]);return _0x3b5c1f(_0x48ae37[_0xa76c('0x10')]['message']);}else{logger[_0xa76c('0xe')](_0xa76c('0x12'),_0x7ef0f0,_0xa76c('0x14'));_0x3b5c1f(_0x48ae37[_0xa76c('0x15')]['message']);}})[_0xa76c('0x16')](function(_0x57a52e){logger[_0xa76c('0x10')](_0xa76c('0x12'),_0x7ef0f0,_0x57a52e);_0x3c3c6b(_0x57a52e);});});}exports['CreateSquareMessage']=function(_0x109e5e){var _0x32fa24=this;return new Promise(function(_0x1aedb5,_0x2fbef3){return db[_0xa76c('0x17')][_0xa76c('0x18')](_0x109e5e[_0xa76c('0x19')],{'raw':_0x109e5e['options']?_0x109e5e[_0xa76c('0x1a')][_0xa76c('0x1b')]===undefined?!![]:![]:!![]})[_0xa76c('0xd')](function(_0x1f2b44){logger[_0xa76c('0xe')](_0xa76c('0x1c'),_0x109e5e);logger[_0xa76c('0xf')](_0xa76c('0x1c'),_0x109e5e,JSON['stringify'](_0x1f2b44));_0x1aedb5(_0x1f2b44);})['catch'](function(_0x7c500e){logger[_0xa76c('0x10')]('CreateSquareMessage',_0x7c500e[_0xa76c('0x13')],_0x109e5e);_0x2fbef3(_0x32fa24['error'](0x1f4,_0x7c500e[_0xa76c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 79e0136..c42dabb 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 _0xe2e9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s','test','create','put','/:id','update','path'];(function(_0x1aa59b,_0x26612c){var _0x33011c=function(_0x29d625){while(--_0x29d625){_0x1aa59b['push'](_0x1aa59b['shift']());}};_0x33011c(++_0x26612c);}(_0xe2e9,0xe9));var _0x9e2e=function(_0x20f256,_0x2f58ec){_0x20f256=_0x20f256-0x0;var _0x5ced25=_0xe2e9[_0x20f256];return _0x5ced25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e2e('0x0'));var timeout=require(_0x9e2e('0x1'));var express=require(_0x9e2e('0x2'));var router=express[_0x9e2e('0x3')]();var fs_extra=require(_0x9e2e('0x4'));var auth=require(_0x9e2e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e2e('0x6'));router[_0x9e2e('0x7')]('/',auth[_0x9e2e('0x8')](),controller[_0x9e2e('0x9')]);router[_0x9e2e('0x7')]('/:id',auth[_0x9e2e('0x8')](),controller[_0x9e2e('0xa')]);router['get'](_0x9e2e('0xb'),auth['isAuthenticated'](),timeout(_0x9e2e('0xc')),controller[_0x9e2e('0xd')]);router['post']('/',auth[_0x9e2e('0x8')](),controller[_0x9e2e('0xe')]);router[_0x9e2e('0xf')](_0x9e2e('0x10'),auth[_0x9e2e('0x8')](),controller[_0x9e2e('0x11')]);router['delete'](_0x9e2e('0x10'),auth[_0x9e2e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1dc1=['/:id/test','15s','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x23a502,_0x38a13b){var _0x51647f=function(_0xdcaaf4){while(--_0xdcaaf4){_0x23a502['push'](_0x23a502['shift']());}};_0x51647f(++_0x38a13b);}(_0x1dc1,0x181));var _0x11dc=function(_0xd15bc9,_0x2eff46){_0xd15bc9=_0xd15bc9-0x0;var _0x42ccd2=_0x1dc1[_0xd15bc9];return _0x42ccd2;};'use strict';var multer=require(_0x11dc('0x0'));var util=require('util');var path=require(_0x11dc('0x1'));var timeout=require(_0x11dc('0x2'));var express=require(_0x11dc('0x3'));var router=express[_0x11dc('0x4')]();var fs_extra=require(_0x11dc('0x5'));var auth=require(_0x11dc('0x6'));var interaction=require(_0x11dc('0x7'));var config=require('../../config/environment');var controller=require(_0x11dc('0x8'));router[_0x11dc('0x9')]('/',auth[_0x11dc('0xa')](),controller[_0x11dc('0xb')]);router[_0x11dc('0x9')](_0x11dc('0xc'),auth[_0x11dc('0xa')](),controller[_0x11dc('0xd')]);router[_0x11dc('0x9')](_0x11dc('0xe'),auth[_0x11dc('0xa')](),timeout(_0x11dc('0xf')),controller['test']);router['post']('/',auth[_0x11dc('0xa')](),controller[_0x11dc('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x11dc('0x11')]);router[_0x11dc('0x12')](_0x11dc('0xc'),auth[_0x11dc('0xa')](),controller[_0x11dc('0x13')]);module[_0x11dc('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0358149..0532b32 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 _0x1f89=['exports','STRING','name'];(function(_0xc117a0,_0x2c86f6){var _0x3e555b=function(_0x1fb664){while(--_0x1fb664){_0xc117a0['push'](_0xc117a0['shift']());}};_0x3e555b(++_0x2c86f6);}(_0x1f89,0x141));var _0x91f8=function(_0x29fe0e,_0x1968f8){_0x29fe0e=_0x29fe0e-0x0;var _0x17c937=_0x1f89[_0x29fe0e];return _0x17c937;};'use strict';var Sequelize=require('sequelize');module[_0x91f8('0x0')]={'name':{'type':Sequelize[_0x91f8('0x1')],'unique':_0x91f8('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x91f8('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x77d9=['STRING','name','sequelize','exports'];(function(_0x5e96f0,_0x42c808){var _0x37a18f=function(_0x324771){while(--_0x324771){_0x5e96f0['push'](_0x5e96f0['shift']());}};_0x37a18f(++_0x42c808);}(_0x77d9,0x1c6));var _0x977d=function(_0x41a3ab,_0x4bb061){_0x41a3ab=_0x41a3ab-0x0;var _0x3c9da9=_0x77d9[_0x41a3ab];return _0x3c9da9;};'use strict';var Sequelize=require(_0x977d('0x0'));module[_0x977d('0x1')]={'name':{'type':Sequelize[_0x977d('0x2')],'unique':_0x977d('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x977d('0x2')]},'description':{'type':Sequelize[_0x977d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index daed130..d655cf4 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 _0x1111=['undefined','count','set','Content-Range','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','length','create','body','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x2bd742,_0x553151){var _0x3595b3=function(_0x3612c3){while(--_0x3612c3){_0x2bd742['push'](_0x2bd742['shift']());}};_0x3595b3(++_0x553151);}(_0x1111,0x138));var _0x1111=function(_0x3e245f,_0x280fc6){_0x3e245f=_0x3e245f-0x0;var _0x369703=_0x1111[_0x3e245f];return _0x369703;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require(_0x1111('0x1'));var zipdir=require(_0x1111('0x2'));var jsonpatch=require(_0x1111('0x3'));var rp=require(_0x1111('0x4'));var moment=require(_0x1111('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1111('0x6'));var util=require(_0x1111('0x7'));var path=require(_0x1111('0x8'));var sox=require(_0x1111('0x9'));var csv=require(_0x1111('0xa'));var ejs=require(_0x1111('0xb'));var fs=require('fs');var fs_extra=require(_0x1111('0xc'));var _=require(_0x1111('0xd'));var squel=require('squel');var crypto=require(_0x1111('0xe'));var jsforce=require(_0x1111('0xf'));var deskjs=require(_0x1111('0x10'));var toCsv=require(_0x1111('0xa'));var querystring=require('querystring');var Papa=require(_0x1111('0x11'));var Redis=require(_0x1111('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1111('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1111('0x14'))(_0x1111('0x15'));var utils=require(_0x1111('0x16'));var config=require(_0x1111('0x17'));var licenseUtil=require(_0x1111('0x18'));var db=require(_0x1111('0x19'))['db'];function respondWithStatusCode(_0x3c7577,_0x3ec67c){_0x3ec67c=_0x3ec67c||0xcc;return function(_0x3859dc){if(_0x3859dc){return _0x3c7577[_0x1111('0x1a')](_0x3ec67c);}return _0x3c7577[_0x1111('0x1b')](_0x3ec67c)[_0x1111('0x1c')]();};}function respondWithResult(_0x1b213d,_0x27fba7){_0x27fba7=_0x27fba7||0xc8;return function(_0x44e406){if(_0x44e406){return _0x1b213d[_0x1111('0x1b')](_0x27fba7)[_0x1111('0x1d')](_0x44e406);}};}function respondWithFilteredResult(_0x2d6a17,_0x285013){return function(_0x2ce31d){if(_0x2ce31d){var _0x4f1034=typeof _0x285013[_0x1111('0x1e')]==='undefined'&&typeof _0x285013[_0x1111('0x1f')]===_0x1111('0x20');var _0x1bdef0=_0x2ce31d[_0x1111('0x21')];var _0x488336=_0x4f1034?0x0:_0x285013[_0x1111('0x1e')];var _0x352790=_0x4f1034?_0x2ce31d[_0x1111('0x21')]:_0x285013[_0x1111('0x1e')]+_0x285013['limit'];var _0x38dc17;if(_0x352790>=_0x1bdef0){_0x352790=_0x1bdef0;_0x38dc17=0xc8;}else{_0x38dc17=0xce;}_0x2d6a17[_0x1111('0x1b')](_0x38dc17);return _0x2d6a17[_0x1111('0x22')](_0x1111('0x23'),_0x488336+'-'+_0x352790+'/'+_0x1bdef0)[_0x1111('0x1d')](_0x2ce31d);}return null;};}function patchUpdates(_0x1d7aa3){return function(_0x255ee5){try{jsonpatch['apply'](_0x255ee5,_0x1d7aa3,!![]);}catch(_0xeb441f){return BPromise['reject'](_0xeb441f);}return _0x255ee5['save']();};}function saveUpdates(_0x4e237e,_0x224950){return function(_0x5f9058){if(_0x5f9058){return _0x5f9058[_0x1111('0x24')](_0x4e237e)[_0x1111('0x25')](function(_0x4328cc){return _0x4328cc;});}return null;};}function removeEntity(_0x59df10,_0xdcdefe){return function(_0x39f976){if(_0x39f976){return _0x39f976['destroy']()[_0x1111('0x25')](function(){var _0x5d7a0d=_0x39f976[_0x1111('0x26')]({'plain':!![]});var _0x2fc1be=_0x1111('0x27');return db[_0x1111('0x28')][_0x1111('0x29')]({'where':{'type':_0x2fc1be,'resourceId':_0x5d7a0d['id']}})[_0x1111('0x25')](function(){return _0x39f976;});})[_0x1111('0x25')](function(){_0x59df10[_0x1111('0x1b')](0xcc)[_0x1111('0x1c')]();});}};}function handleEntityNotFound(_0x1fec2b,_0x14746e){return function(_0x38fc5f){if(!_0x38fc5f){_0x1fec2b['sendStatus'](0x194);}return _0x38fc5f;};}function handleError(_0x19d541,_0x128c6f){_0x128c6f=_0x128c6f||0x1f4;return function(_0x56aecd){logger[_0x1111('0x2a')](_0x56aecd['stack']);if(_0x56aecd[_0x1111('0x2b')]){delete _0x56aecd[_0x1111('0x2b')];}_0x19d541['status'](_0x128c6f)[_0x1111('0x2c')](_0x56aecd);};}exports[_0x1111('0x2d')]=function(_0xee25fd,_0x126ffd){var _0x196429={},_0x5a7b8d={},_0xbd1bff={'count':0x0,'rows':[]};var _0x136a6e=_[_0x1111('0x2e')](db[_0x1111('0x2f')]['rawAttributes'],function(_0x97380d){return{'name':_0x97380d[_0x1111('0x30')],'type':_0x97380d[_0x1111('0x31')][_0x1111('0x32')]};});_0x5a7b8d[_0x1111('0x33')]=_[_0x1111('0x2e')](_0x136a6e,_0x1111('0x2b'));_0x5a7b8d[_0x1111('0x34')]=_[_0x1111('0x35')](_0xee25fd[_0x1111('0x34')]);_0x5a7b8d[_0x1111('0x36')]=_[_0x1111('0x37')](_0x5a7b8d[_0x1111('0x33')],_0x5a7b8d[_0x1111('0x34')]);_0x196429[_0x1111('0x38')]=_[_0x1111('0x37')](_0x5a7b8d[_0x1111('0x33')],qs[_0x1111('0x39')](_0xee25fd[_0x1111('0x34')][_0x1111('0x39')]));_0x196429['attributes']=_0x196429[_0x1111('0x38')]['length']?_0x196429['attributes']:_0x5a7b8d[_0x1111('0x33')];if(!_0xee25fd[_0x1111('0x34')]['hasOwnProperty'](_0x1111('0x3a'))){_0x196429['limit']=qs[_0x1111('0x1f')](_0xee25fd[_0x1111('0x34')][_0x1111('0x1f')]);_0x196429[_0x1111('0x1e')]=qs[_0x1111('0x1e')](_0xee25fd[_0x1111('0x34')][_0x1111('0x1e')]);}_0x196429[_0x1111('0x3b')]=qs[_0x1111('0x3c')](_0xee25fd[_0x1111('0x34')]['sort']);_0x196429[_0x1111('0x3d')]=qs[_0x1111('0x36')](_[_0x1111('0x3e')](_0xee25fd[_0x1111('0x34')],_0x5a7b8d[_0x1111('0x36')]),_0x136a6e);if(_0xee25fd[_0x1111('0x34')][_0x1111('0x3f')]){_0x196429[_0x1111('0x3d')]=_[_0x1111('0x40')](_0x196429[_0x1111('0x3d')],{'$or':_[_0x1111('0x2e')](_0x136a6e,function(_0x1d0587){if(_0x1d0587[_0x1111('0x31')]!==_0x1111('0x41')){var _0x52cd63={};_0x52cd63[_0x1d0587['name']]={'$like':'%'+_0xee25fd[_0x1111('0x34')][_0x1111('0x3f')]+'%'};return _0x52cd63;}})});}_0x196429=_[_0x1111('0x40')]({},_0x196429,_0xee25fd['options']);var _0x11c29c={'where':_0x196429['where']};return db['SquareOdbc']['count'](_0x11c29c)[_0x1111('0x25')](function(_0x3c3528){_0xbd1bff[_0x1111('0x21')]=_0x3c3528;if(_0xee25fd['query'][_0x1111('0x42')]){_0x196429[_0x1111('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0x1111('0x44')](_0x196429);})[_0x1111('0x25')](function(_0x5c258d){_0xbd1bff[_0x1111('0x45')]=_0x5c258d;return _0xbd1bff;})[_0x1111('0x25')](respondWithFilteredResult(_0x126ffd,_0x196429))[_0x1111('0x46')](handleError(_0x126ffd,null));};exports['show']=function(_0x459db6,_0x43cd92){var _0x571d44={'raw':!![],'where':{'id':_0x459db6[_0x1111('0x47')]['id']}},_0xb98f26={};_0xb98f26[_0x1111('0x33')]=_[_0x1111('0x35')](db[_0x1111('0x2f')][_0x1111('0x48')]);_0xb98f26['query']=_[_0x1111('0x35')](_0x459db6[_0x1111('0x34')]);_0xb98f26[_0x1111('0x36')]=_['intersection'](_0xb98f26[_0x1111('0x33')],_0xb98f26[_0x1111('0x34')]);_0x571d44[_0x1111('0x38')]=_['intersection'](_0xb98f26[_0x1111('0x33')],qs[_0x1111('0x39')](_0x459db6[_0x1111('0x34')]['fields']));_0x571d44[_0x1111('0x38')]=_0x571d44[_0x1111('0x38')][_0x1111('0x49')]?_0x571d44[_0x1111('0x38')]:_0xb98f26['model'];if(_0x459db6['query'][_0x1111('0x42')]){_0x571d44[_0x1111('0x43')]=[{'all':!![]}];}_0x571d44=_['merge']({},_0x571d44,_0x459db6['options']);return db[_0x1111('0x2f')]['find'](_0x571d44)[_0x1111('0x25')](handleEntityNotFound(_0x43cd92,null))[_0x1111('0x25')](respondWithResult(_0x43cd92,null))['catch'](handleError(_0x43cd92,null));};exports[_0x1111('0x4a')]=function(_0x53c9ae,_0x3c493d){return db[_0x1111('0x2f')][_0x1111('0x4a')](_0x53c9ae[_0x1111('0x4b')],{})[_0x1111('0x25')](function(_0x109a7a){var _0x565b2a=_0x53c9ae[_0x1111('0x4c')][_0x1111('0x26')]({'plain':!![]});if(!_0x565b2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x565b2a[_0x1111('0x4d')]==='user'){var _0x4065da=_0x109a7a[_0x1111('0x26')]({'plain':!![]});var _0x397ea5=_0x1111('0x27');return db[_0x1111('0x4e')][_0x1111('0x4f')]({'where':{'name':_0x397ea5,'userProfileId':_0x565b2a[_0x1111('0x50')]},'raw':!![]})[_0x1111('0x25')](function(_0x3adab5){if(_0x3adab5&&_0x3adab5['autoAssociation']===0x0){return db[_0x1111('0x28')][_0x1111('0x4a')]({'name':_0x4065da[_0x1111('0x2b')],'resourceId':_0x4065da['id'],'type':_0x3adab5[_0x1111('0x2b')],'sectionId':_0x3adab5['id']},{})[_0x1111('0x25')](function(){return _0x109a7a;});}else{return _0x109a7a;}})[_0x1111('0x46')](function(_0xc954b8){logger['error'](_0x1111('0x51'),_0xc954b8);throw _0xc954b8;});}return _0x109a7a;})[_0x1111('0x25')](respondWithResult(_0x3c493d,0xc9))[_0x1111('0x46')](handleError(_0x3c493d,null));};exports[_0x1111('0x24')]=function(_0x2128af,_0x185647){if(_0x2128af[_0x1111('0x4b')]['id']){delete _0x2128af[_0x1111('0x4b')]['id'];}return db[_0x1111('0x2f')][_0x1111('0x4f')]({'where':{'id':_0x2128af[_0x1111('0x47')]['id']}})[_0x1111('0x25')](handleEntityNotFound(_0x185647,null))['then'](saveUpdates(_0x2128af['body'],null))[_0x1111('0x25')](respondWithResult(_0x185647,null))[_0x1111('0x46')](handleError(_0x185647,null));};exports[_0x1111('0x29')]=function(_0x41593c,_0x452c5e){return db['SquareOdbc'][_0x1111('0x4f')]({'where':{'id':_0x41593c[_0x1111('0x47')]['id']}})['then'](handleEntityNotFound(_0x452c5e,null))[_0x1111('0x25')](removeEntity(_0x452c5e,null))['catch'](handleError(_0x452c5e,null));};exports[_0x1111('0x52')]=function(_0x4f99d0,_0x23105e,_0x2c3c1f){var _0x578b61;return db[_0x1111('0x2f')][_0x1111('0x4f')]({'where':{'id':_0x4f99d0[_0x1111('0x47')]['id']},'attributes':['id',_0x1111('0x53')]})[_0x1111('0x25')](handleEntityNotFound(_0x23105e,null))[_0x1111('0x25')](function(_0x26a9c1){if(_0x26a9c1){var _0x408f63=require('odbc')();_0x408f63[_0x1111('0x54')](_0x26a9c1[_0x1111('0x53')]);_0x408f63[_0x1111('0x55')]();return _0x26a9c1;}})[_0x1111('0x25')](respondWithResult(_0x23105e,null))[_0x1111('0x46')](handleError(_0x23105e,null));}; \ No newline at end of file +var _0xb70d=['moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','UserProfileResource','then','error','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x64466,_0x2c731a){var _0x6edde5=function(_0x4dd17a){while(--_0x4dd17a){_0x64466['push'](_0x64466['shift']());}};_0x6edde5(++_0x2c731a);}(_0xb70d,0x1c3));var _0xdb70=function(_0xc21596,_0x175eab){_0xc21596=_0xc21596-0x0;var _0x42b136=_0xb70d[_0xc21596];return _0x42b136;};'use strict';var emlformat=require(_0xdb70('0x0'));var rimraf=require(_0xdb70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb70('0x2'));var rp=require(_0xdb70('0x3'));var moment=require(_0xdb70('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb70('0x5'));var util=require(_0xdb70('0x6'));var path=require(_0xdb70('0x7'));var sox=require('sox');var csv=require(_0xdb70('0x8'));var ejs=require(_0xdb70('0x9'));var fs=require('fs');var fs_extra=require(_0xdb70('0xa'));var _=require(_0xdb70('0xb'));var squel=require(_0xdb70('0xc'));var crypto=require(_0xdb70('0xd'));var jsforce=require(_0xdb70('0xe'));var deskjs=require(_0xdb70('0xf'));var toCsv=require(_0xdb70('0x8'));var querystring=require(_0xdb70('0x10'));var Papa=require(_0xdb70('0x11'));var Redis=require(_0xdb70('0x12'));var authService=require(_0xdb70('0x13'));var qs=require(_0xdb70('0x14'));var as=require(_0xdb70('0x15'));var hardwareService=require(_0xdb70('0x16'));var logger=require(_0xdb70('0x17'))(_0xdb70('0x18'));var utils=require(_0xdb70('0x19'));var config=require(_0xdb70('0x1a'));var licenseUtil=require(_0xdb70('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388b54,_0x211e60){_0x211e60=_0x211e60||0xcc;return function(_0x441600){if(_0x441600){return _0x388b54[_0xdb70('0x1c')](_0x211e60);}return _0x388b54['status'](_0x211e60)[_0xdb70('0x1d')]();};}function respondWithResult(_0x13af8b,_0x5e5610){_0x5e5610=_0x5e5610||0xc8;return function(_0x5b3648){if(_0x5b3648){return _0x13af8b[_0xdb70('0x1e')](_0x5e5610)[_0xdb70('0x1f')](_0x5b3648);}};}function respondWithFilteredResult(_0x19d95b,_0x8c22dd){return function(_0x184fe0){if(_0x184fe0){var _0x411b6c=typeof _0x8c22dd[_0xdb70('0x20')]===_0xdb70('0x21')&&typeof _0x8c22dd[_0xdb70('0x22')]===_0xdb70('0x21');var _0x2c43f4=_0x184fe0['count'];var _0x38b5b7=_0x411b6c?0x0:_0x8c22dd[_0xdb70('0x20')];var _0xd6fca=_0x411b6c?_0x184fe0[_0xdb70('0x23')]:_0x8c22dd['offset']+_0x8c22dd[_0xdb70('0x22')];var _0x2892fd;if(_0xd6fca>=_0x2c43f4){_0xd6fca=_0x2c43f4;_0x2892fd=0xc8;}else{_0x2892fd=0xce;}_0x19d95b['status'](_0x2892fd);return _0x19d95b[_0xdb70('0x24')]('Content-Range',_0x38b5b7+'-'+_0xd6fca+'/'+_0x2c43f4)['json'](_0x184fe0);}return null;};}function patchUpdates(_0x27d041){return function(_0xaac646){try{jsonpatch[_0xdb70('0x25')](_0xaac646,_0x27d041,!![]);}catch(_0x17c668){return BPromise[_0xdb70('0x26')](_0x17c668);}return _0xaac646[_0xdb70('0x27')]();};}function saveUpdates(_0x2a605c,_0x450090){return function(_0x490999){if(_0x490999){return _0x490999[_0xdb70('0x28')](_0x2a605c)['then'](function(_0x4b2cc6){return _0x4b2cc6;});}return null;};}function removeEntity(_0x2000a1,_0x3b8efb){return function(_0x35ed87){if(_0x35ed87){return _0x35ed87[_0xdb70('0x29')]()['then'](function(){var _0x2828c4=_0x35ed87[_0xdb70('0x2a')]({'plain':!![]});var _0x84fb8f='ODBC';return db[_0xdb70('0x2b')]['destroy']({'where':{'type':_0x84fb8f,'resourceId':_0x2828c4['id']}})[_0xdb70('0x2c')](function(){return _0x35ed87;});})[_0xdb70('0x2c')](function(){_0x2000a1[_0xdb70('0x1e')](0xcc)[_0xdb70('0x1d')]();});}};}function handleEntityNotFound(_0xe8a3ee,_0x5f361a){return function(_0x40169b){if(!_0x40169b){_0xe8a3ee[_0xdb70('0x1c')](0x194);}return _0x40169b;};}function handleError(_0x529d03,_0x2fbadd){_0x2fbadd=_0x2fbadd||0x1f4;return function(_0x25c24d){logger[_0xdb70('0x2d')](_0x25c24d['stack']);if(_0x25c24d[_0xdb70('0x2e')]){delete _0x25c24d[_0xdb70('0x2e')];}_0x529d03[_0xdb70('0x1e')](_0x2fbadd)[_0xdb70('0x2f')](_0x25c24d);};}exports['index']=function(_0x22af01,_0x4f2538){var _0x303214={},_0x2237a4={},_0x32c4fb={'count':0x0,'rows':[]};var _0x35e09c=_['map'](db[_0xdb70('0x30')][_0xdb70('0x31')],function(_0x29d614){return{'name':_0x29d614[_0xdb70('0x32')],'type':_0x29d614[_0xdb70('0x33')][_0xdb70('0x34')]};});_0x2237a4[_0xdb70('0x35')]=_[_0xdb70('0x36')](_0x35e09c,_0xdb70('0x2e'));_0x2237a4[_0xdb70('0x37')]=_['keys'](_0x22af01[_0xdb70('0x37')]);_0x2237a4[_0xdb70('0x38')]=_[_0xdb70('0x39')](_0x2237a4['model'],_0x2237a4[_0xdb70('0x37')]);_0x303214[_0xdb70('0x3a')]=_[_0xdb70('0x39')](_0x2237a4[_0xdb70('0x35')],qs['fields'](_0x22af01[_0xdb70('0x37')][_0xdb70('0x3b')]));_0x303214[_0xdb70('0x3a')]=_0x303214[_0xdb70('0x3a')][_0xdb70('0x3c')]?_0x303214[_0xdb70('0x3a')]:_0x2237a4[_0xdb70('0x35')];if(!_0x22af01[_0xdb70('0x37')]['hasOwnProperty'](_0xdb70('0x3d'))){_0x303214['limit']=qs['limit'](_0x22af01[_0xdb70('0x37')][_0xdb70('0x22')]);_0x303214['offset']=qs['offset'](_0x22af01['query'][_0xdb70('0x20')]);}_0x303214[_0xdb70('0x3e')]=qs[_0xdb70('0x3f')](_0x22af01[_0xdb70('0x37')][_0xdb70('0x3f')]);_0x303214[_0xdb70('0x40')]=qs[_0xdb70('0x38')](_[_0xdb70('0x41')](_0x22af01[_0xdb70('0x37')],_0x2237a4[_0xdb70('0x38')]),_0x35e09c);if(_0x22af01['query'][_0xdb70('0x42')]){_0x303214[_0xdb70('0x40')]=_[_0xdb70('0x43')](_0x303214[_0xdb70('0x40')],{'$or':_[_0xdb70('0x36')](_0x35e09c,function(_0x10c97f){if(_0x10c97f['type']!=='VIRTUAL'){var _0x2462c7={};_0x2462c7[_0x10c97f[_0xdb70('0x2e')]]={'$like':'%'+_0x22af01['query'][_0xdb70('0x42')]+'%'};return _0x2462c7;}})});}_0x303214=_[_0xdb70('0x43')]({},_0x303214,_0x22af01[_0xdb70('0x44')]);var _0x2dd9a1={'where':_0x303214[_0xdb70('0x40')]};return db['SquareOdbc'][_0xdb70('0x23')](_0x2dd9a1)[_0xdb70('0x2c')](function(_0x29b7d6){_0x32c4fb[_0xdb70('0x23')]=_0x29b7d6;if(_0x22af01[_0xdb70('0x37')][_0xdb70('0x45')]){_0x303214[_0xdb70('0x46')]=[{'all':!![]}];}return db[_0xdb70('0x30')][_0xdb70('0x47')](_0x303214);})['then'](function(_0x845095){_0x32c4fb[_0xdb70('0x48')]=_0x845095;return _0x32c4fb;})['then'](respondWithFilteredResult(_0x4f2538,_0x303214))[_0xdb70('0x49')](handleError(_0x4f2538,null));};exports['show']=function(_0x1ee0ab,_0x28ee75){var _0x5013d5={'raw':!![],'where':{'id':_0x1ee0ab['params']['id']}},_0x462d2b={};_0x462d2b['model']=_['keys'](db[_0xdb70('0x30')][_0xdb70('0x31')]);_0x462d2b['query']=_[_0xdb70('0x4a')](_0x1ee0ab[_0xdb70('0x37')]);_0x462d2b[_0xdb70('0x38')]=_[_0xdb70('0x39')](_0x462d2b[_0xdb70('0x35')],_0x462d2b['query']);_0x5013d5['attributes']=_[_0xdb70('0x39')](_0x462d2b[_0xdb70('0x35')],qs[_0xdb70('0x3b')](_0x1ee0ab[_0xdb70('0x37')][_0xdb70('0x3b')]));_0x5013d5[_0xdb70('0x3a')]=_0x5013d5[_0xdb70('0x3a')]['length']?_0x5013d5['attributes']:_0x462d2b[_0xdb70('0x35')];if(_0x1ee0ab['query']['includeAll']){_0x5013d5[_0xdb70('0x46')]=[{'all':!![]}];}_0x5013d5=_[_0xdb70('0x43')]({},_0x5013d5,_0x1ee0ab[_0xdb70('0x44')]);return db['SquareOdbc'][_0xdb70('0x4b')](_0x5013d5)[_0xdb70('0x2c')](handleEntityNotFound(_0x28ee75,null))[_0xdb70('0x2c')](respondWithResult(_0x28ee75,null))[_0xdb70('0x49')](handleError(_0x28ee75,null));};exports[_0xdb70('0x4c')]=function(_0x289dd1,_0x3c0a41){return db[_0xdb70('0x30')]['create'](_0x289dd1[_0xdb70('0x4d')],{})[_0xdb70('0x2c')](function(_0x7e8385){var _0x2c4190=_0x289dd1['user'][_0xdb70('0x2a')]({'plain':!![]});if(!_0x2c4190)throw new Error(_0xdb70('0x4e'));if(_0x2c4190[_0xdb70('0x4f')]==='user'){var _0x1dc7dc=_0x7e8385[_0xdb70('0x2a')]({'plain':!![]});var _0xeb8733=_0xdb70('0x50');return db[_0xdb70('0x51')][_0xdb70('0x4b')]({'where':{'name':_0xeb8733,'userProfileId':_0x2c4190[_0xdb70('0x52')]},'raw':!![]})[_0xdb70('0x2c')](function(_0x32b564){if(_0x32b564&&_0x32b564[_0xdb70('0x53')]===0x0){return db[_0xdb70('0x2b')]['create']({'name':_0x1dc7dc[_0xdb70('0x2e')],'resourceId':_0x1dc7dc['id'],'type':_0x32b564[_0xdb70('0x2e')],'sectionId':_0x32b564['id']},{})['then'](function(){return _0x7e8385;});}else{return _0x7e8385;}})[_0xdb70('0x49')](function(_0x2e6ed9){logger[_0xdb70('0x2d')](_0xdb70('0x54'),_0x2e6ed9);throw _0x2e6ed9;});}return _0x7e8385;})[_0xdb70('0x2c')](respondWithResult(_0x3c0a41,0xc9))[_0xdb70('0x49')](handleError(_0x3c0a41,null));};exports['update']=function(_0x1b8a6c,_0x466f56){if(_0x1b8a6c[_0xdb70('0x4d')]['id']){delete _0x1b8a6c[_0xdb70('0x4d')]['id'];}return db[_0xdb70('0x30')]['find']({'where':{'id':_0x1b8a6c['params']['id']}})['then'](handleEntityNotFound(_0x466f56,null))[_0xdb70('0x2c')](saveUpdates(_0x1b8a6c[_0xdb70('0x4d')],null))[_0xdb70('0x2c')](respondWithResult(_0x466f56,null))[_0xdb70('0x49')](handleError(_0x466f56,null));};exports[_0xdb70('0x29')]=function(_0x25cd27,_0x17006b){return db[_0xdb70('0x30')][_0xdb70('0x4b')]({'where':{'id':_0x25cd27[_0xdb70('0x55')]['id']}})[_0xdb70('0x2c')](handleEntityNotFound(_0x17006b,null))[_0xdb70('0x2c')](removeEntity(_0x17006b,null))['catch'](handleError(_0x17006b,null));};exports[_0xdb70('0x56')]=function(_0x1bca75,_0x1241de,_0x2a185c){var _0x21fc62;return db['SquareOdbc'][_0xdb70('0x4b')]({'where':{'id':_0x1bca75[_0xdb70('0x55')]['id']},'attributes':['id',_0xdb70('0x57')]})[_0xdb70('0x2c')](handleEntityNotFound(_0x1241de,null))[_0xdb70('0x2c')](function(_0x58299c){if(_0x58299c){var _0x545e71=require(_0xdb70('0x58'))();_0x545e71[_0xdb70('0x59')](_0x58299c[_0xdb70('0x57')]);_0x545e71[_0xdb70('0x5a')]();return _0x58299c;}})[_0xdb70('0x2c')](respondWithResult(_0x1241de,null))['catch'](handleError(_0x1241de,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4288e22..a39df85 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 _0x8cf1=['path','rimraf','./squareOdbc.attributes','define','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a351f,_0x33603d){var _0x42ab38=function(_0x568ee4){while(--_0x568ee4){_0x4a351f['push'](_0x4a351f['shift']());}};_0x42ab38(++_0x33603d);}(_0x8cf1,0xea));var _0x18cf=function(_0x2dc8e5,_0x36aaeb){_0x2dc8e5=_0x2dc8e5-0x0;var _0x11d24e=_0x8cf1[_0x2dc8e5];return _0x11d24e;};'use strict';var _=require('lodash');var util=require(_0x18cf('0x0'));var logger=require(_0x18cf('0x1'))(_0x18cf('0x2'));var moment=require(_0x18cf('0x3'));var BPromise=require(_0x18cf('0x4'));var rp=require(_0x18cf('0x5'));var fs=require('fs');var path=require(_0x18cf('0x6'));var rimraf=require(_0x18cf('0x7'));var config=require('../../config/environment');var attributes=require(_0x18cf('0x8'));module['exports']=function(_0x4571ca,_0x123a46){return _0x4571ca[_0x18cf('0x9')](_0x18cf('0xa'),attributes,{'tableName':_0x18cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7f4=['moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','lodash','api'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0xa7f4,0xb2));var _0x4a7f=function(_0x5ac69d,_0x3cf85b){_0x5ac69d=_0x5ac69d-0x0;var _0x37d9b7=_0xa7f4[_0x5ac69d];return _0x37d9b7;};'use strict';var _=require(_0x4a7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4a7f('0x1'));var moment=require(_0x4a7f('0x2'));var BPromise=require(_0x4a7f('0x3'));var rp=require(_0x4a7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a7f('0x5'));var attributes=require(_0x4a7f('0x6'));module[_0x4a7f('0x7')]=function(_0x5a4e5f,_0x1b42b5){return _0x5a4e5f[_0x4a7f('0x8')]('SquareOdbc',attributes,{'tableName':'square_odbc','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 e129f0c..5686b0d 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 _0x83f0=['http','request','then','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2884c0,_0x556293){var _0x5e5b35=function(_0x11e4de){while(--_0x11e4de){_0x2884c0['push'](_0x2884c0['shift']());}};_0x5e5b35(++_0x556293);}(_0x83f0,0x141));var _0x083f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x83f0[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x083f('0x0'));var util=require('util');var moment=require(_0x083f('0x1'));var BPromise=require(_0x083f('0x2'));var rs=require(_0x083f('0x3'));var fs=require('fs');var Redis=require(_0x083f('0x4'));var db=require(_0x083f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x083f('0x6'))(_0x083f('0x7'));var config=require(_0x083f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x083f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc521d4,_0x50a44f,_0x54f590){return new BPromise(function(_0x385e68,_0x585702){return client[_0x083f('0xa')](_0xc521d4,_0x54f590)[_0x083f('0xb')](function(_0x432bff){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x50a44f,_0x083f('0xc'));logger[_0x083f('0xd')](_0x083f('0xe'),_0x50a44f,_0x083f('0xc'),JSON[_0x083f('0xf')](_0x432bff));if(_0x432bff[_0x083f('0x10')]){if(_0x432bff[_0x083f('0x10')][_0x083f('0x11')]===0x1f4){logger[_0x083f('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x50a44f,_0x432bff[_0x083f('0x10')][_0x083f('0x12')]);return _0x585702(_0x432bff[_0x083f('0x10')]['message']);}logger[_0x083f('0x10')](_0x083f('0x13'),_0x50a44f,_0x432bff[_0x083f('0x10')]['message']);return _0x385e68(_0x432bff['error'][_0x083f('0x12')]);}else{logger['info'](_0x083f('0x13'),_0x50a44f,_0x083f('0xc'));_0x385e68(_0x432bff[_0x083f('0x14')][_0x083f('0x12')]);}})[_0x083f('0x15')](function(_0x319d40){logger[_0x083f('0x10')](_0x083f('0x13'),_0x50a44f,_0x319d40);_0x585702(_0x319d40);});});}exports[_0x083f('0x16')]=function(_0x4cc540){var _0xe268=this;return new Promise(function(_0x3406bc,_0xfde8b5){return db[_0x083f('0x17')][_0x083f('0x18')]({'raw':_0x4cc540[_0x083f('0x19')]?_0x4cc540[_0x083f('0x19')][_0x083f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4cc540['options']?_0x4cc540['options'][_0x083f('0x1b')]||null:null,'attributes':_0x4cc540[_0x083f('0x19')]?_0x4cc540['options'][_0x083f('0x1c')]||null:null,'include':_0x4cc540['options']?_0x4cc540['options'][_0x083f('0x1d')]?_[_0x083f('0x1e')](_0x4cc540[_0x083f('0x19')]['include'],function(_0x5dbef0){return{'model':db[_0x5dbef0[_0x083f('0x1f')]],'as':_0x5dbef0['as'],'attributes':_0x5dbef0[_0x083f('0x1c')],'include':_0x5dbef0['include']?_['map'](_0x5dbef0['include'],function(_0x21ba01){return{'model':db[_0x21ba01[_0x083f('0x1f')]],'as':_0x21ba01['as'],'attributes':_0x21ba01[_0x083f('0x1c')],'include':_0x21ba01[_0x083f('0x1d')]?_[_0x083f('0x1e')](_0x21ba01['include'],function(_0x1e7558){return{'model':db[_0x1e7558[_0x083f('0x1f')]],'as':_0x1e7558['as'],'attributes':_0x1e7558[_0x083f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x083f('0xb')](function(_0x472dbd){logger[_0x083f('0x20')](_0x083f('0x16'),_0x4cc540);logger[_0x083f('0xd')](_0x083f('0x16'),_0x4cc540,JSON[_0x083f('0xf')](_0x472dbd));_0x3406bc(_0x472dbd);})['catch'](function(_0x1ce73e){logger[_0x083f('0x10')]('ShowSquareOdbc',_0x1ce73e[_0x083f('0x12')],_0x4cc540);_0xfde8b5(_0xe268[_0x083f('0x10')](0x1f4,_0x1ce73e[_0x083f('0x12')]));});});}; \ No newline at end of file +var _0x9f16=['SquareOdbc','find','options','where','map','model','attributes','include','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSquareOdbc'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0x9f16,0x1ba));var _0x69f1=function(_0xb4bed2,_0x1ba3db){_0xb4bed2=_0xb4bed2-0x0;var _0x17a2a5=_0x9f16[_0xb4bed2];return _0x17a2a5;};'use strict';var _=require(_0x69f1('0x0'));var util=require(_0x69f1('0x1'));var moment=require('moment');var BPromise=require(_0x69f1('0x2'));var rs=require(_0x69f1('0x3'));var fs=require('fs');var Redis=require(_0x69f1('0x4'));var db=require(_0x69f1('0x5'))['db'];var utils=require(_0x69f1('0x6'));var logger=require(_0x69f1('0x7'))(_0x69f1('0x8'));var config=require(_0x69f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x69f1('0xa')][_0x69f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3007a8,_0x12eb77,_0x7ab43d){return new BPromise(function(_0x237b8f,_0x3bfd08){return client['request'](_0x3007a8,_0x7ab43d)[_0x69f1('0xc')](function(_0x42c981){logger[_0x69f1('0xd')](_0x69f1('0xe'),_0x12eb77,_0x69f1('0xf'));logger[_0x69f1('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x12eb77,_0x69f1('0xf'),JSON[_0x69f1('0x11')](_0x42c981));if(_0x42c981[_0x69f1('0x12')]){if(_0x42c981[_0x69f1('0x12')]['code']===0x1f4){logger[_0x69f1('0x12')](_0x69f1('0xe'),_0x12eb77,_0x42c981[_0x69f1('0x12')][_0x69f1('0x13')]);return _0x3bfd08(_0x42c981['error'][_0x69f1('0x13')]);}logger[_0x69f1('0x12')](_0x69f1('0xe'),_0x12eb77,_0x42c981['error'][_0x69f1('0x13')]);return _0x237b8f(_0x42c981[_0x69f1('0x12')][_0x69f1('0x13')]);}else{logger[_0x69f1('0xd')](_0x69f1('0xe'),_0x12eb77,_0x69f1('0xf'));_0x237b8f(_0x42c981[_0x69f1('0x14')][_0x69f1('0x13')]);}})[_0x69f1('0x15')](function(_0x2ef53c){logger[_0x69f1('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x12eb77,_0x2ef53c);_0x3bfd08(_0x2ef53c);});});}exports[_0x69f1('0x16')]=function(_0x23a4ad){var _0x2b388b=this;return new Promise(function(_0x2119e0,_0x10fd91){return db[_0x69f1('0x17')][_0x69f1('0x18')]({'raw':_0x23a4ad['options']?_0x23a4ad[_0x69f1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x23a4ad[_0x69f1('0x19')]?_0x23a4ad[_0x69f1('0x19')][_0x69f1('0x1a')]||null:null,'attributes':_0x23a4ad[_0x69f1('0x19')]?_0x23a4ad['options']['attributes']||null:null,'include':_0x23a4ad[_0x69f1('0x19')]?_0x23a4ad[_0x69f1('0x19')]['include']?_[_0x69f1('0x1b')](_0x23a4ad[_0x69f1('0x19')]['include'],function(_0x10a0d9){return{'model':db[_0x10a0d9[_0x69f1('0x1c')]],'as':_0x10a0d9['as'],'attributes':_0x10a0d9[_0x69f1('0x1d')],'include':_0x10a0d9['include']?_['map'](_0x10a0d9[_0x69f1('0x1e')],function(_0x3d15ac){return{'model':db[_0x3d15ac['model']],'as':_0x3d15ac['as'],'attributes':_0x3d15ac['attributes'],'include':_0x3d15ac['include']?_['map'](_0x3d15ac[_0x69f1('0x1e')],function(_0x24b27d){return{'model':db[_0x24b27d[_0x69f1('0x1c')]],'as':_0x24b27d['as'],'attributes':_0x24b27d[_0x69f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x69f1('0xc')](function(_0x312c38){logger[_0x69f1('0xd')](_0x69f1('0x16'),_0x23a4ad);logger[_0x69f1('0x10')]('ShowSquareOdbc',_0x23a4ad,JSON[_0x69f1('0x11')](_0x312c38));_0x2119e0(_0x312c38);})[_0x69f1('0x15')](function(_0x215b2f){logger[_0x69f1('0x12')](_0x69f1('0x16'),_0x215b2f[_0x69f1('0x13')],_0x23a4ad);_0x10fd91(_0x2b388b[_0x69f1('0x12')](0x1f4,_0x215b2f[_0x69f1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 93dab47..39c656e 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 _0x2005=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4f6eb2,_0x4f3253){var _0x128bab=function(_0x14bfac){while(--_0x14bfac){_0x4f6eb2['push'](_0x4f6eb2['shift']());}};_0x128bab(++_0x4f3253);}(_0x2005,0x13c));var _0x5200=function(_0x8fe9d5,_0x5dc26d){_0x8fe9d5=_0x8fe9d5-0x0;var _0x12ebbc=_0x2005[_0x8fe9d5];return _0x12ebbc;};'use strict';var multer=require(_0x5200('0x0'));var util=require(_0x5200('0x1'));var path=require(_0x5200('0x2'));var timeout=require(_0x5200('0x3'));var express=require('express');var router=express[_0x5200('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5200('0x5'));var interaction=require(_0x5200('0x6'));var config=require(_0x5200('0x7'));var controller=require(_0x5200('0x8'));router[_0x5200('0x9')]('/',auth[_0x5200('0xa')](),controller[_0x5200('0xb')]);router[_0x5200('0x9')](_0x5200('0xc'),auth[_0x5200('0xa')](),controller[_0x5200('0xd')]);router['post']('/',auth[_0x5200('0xa')](),controller[_0x5200('0xe')]);router['put'](_0x5200('0xc'),auth[_0x5200('0xa')](),controller[_0x5200('0xf')]);router[_0x5200('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5200('0x11')]);module[_0x5200('0x12')]=router; \ No newline at end of file +var _0x8130=['post','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show'];(function(_0x1da533,_0x3ef513){var _0x3ff92a=function(_0x529114){while(--_0x529114){_0x1da533['push'](_0x1da533['shift']());}};_0x3ff92a(++_0x3ef513);}(_0x8130,0x76));var _0x0813=function(_0x250d05,_0xa63ded){_0x250d05=_0x250d05-0x0;var _0xe004c=_0x8130[_0x250d05];return _0xe004c;};'use strict';var multer=require(_0x0813('0x0'));var util=require('util');var path=require(_0x0813('0x1'));var timeout=require(_0x0813('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0813('0x3'));var auth=require(_0x0813('0x4'));var interaction=require(_0x0813('0x5'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router['get']('/',auth[_0x0813('0x6')](),controller['index']);router[_0x0813('0x7')](_0x0813('0x8'),auth[_0x0813('0x6')](),controller[_0x0813('0x9')]);router[_0x0813('0xa')]('/',auth[_0x0813('0x6')](),controller[_0x0813('0xb')]);router[_0x0813('0xc')](_0x0813('0x8'),auth[_0x0813('0x6')](),controller['update']);router[_0x0813('0xd')](_0x0813('0x8'),auth[_0x0813('0x6')](),controller[_0x0813('0xe')]);module[_0x0813('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 98a5e06..a819831 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 _0x50a5=['exports','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','sequelize'];(function(_0x323405,_0x13f1b5){var _0x1f691f=function(_0x507656){while(--_0x507656){_0x323405['push'](_0x323405['shift']());}};_0x1f691f(++_0x13f1b5);}(_0x50a5,0xd1));var _0x550a=function(_0x46d7ef,_0x2260af){_0x46d7ef=_0x46d7ef-0x0;var _0x44ad71=_0x50a5[_0x46d7ef];return _0x44ad71;};'use strict';var Sequelize=require(_0x550a('0x0'));module[_0x550a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x550a('0x2')]('long'),'get':function(){if(this[_0x550a('0x3')](_0x550a('0x4'))){return this[_0x550a('0x3')](_0x550a('0x4'))[_0x550a('0x5')](_0x550a('0x6'));}}},'production':{'type':Sequelize[_0x550a('0x2')](_0x550a('0x7')),'get':function(){if(this[_0x550a('0x3')](_0x550a('0x8'))){return this[_0x550a('0x3')](_0x550a('0x8'))[_0x550a('0x5')]('utf8');}}},'savedAt':{'type':Sequelize[_0x550a('0x9')]},'publishedAt':{'type':Sequelize[_0x550a('0x9')]}}; \ No newline at end of file +var _0x5c82=['preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5c82,0x198));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x25c8('0x0'));module[_0x25c8('0x1')]={'name':{'type':Sequelize[_0x25c8('0x2')],'unique':_0x25c8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x25c8('0x2')]},'notes':{'type':Sequelize[_0x25c8('0x4')]},'preproduction':{'type':Sequelize[_0x25c8('0x5')](_0x25c8('0x6')),'get':function(){if(this[_0x25c8('0x7')](_0x25c8('0x8'))){return this[_0x25c8('0x7')](_0x25c8('0x8'))[_0x25c8('0x9')](_0x25c8('0xa'));}}},'production':{'type':Sequelize[_0x25c8('0x5')](_0x25c8('0x6')),'get':function(){if(this[_0x25c8('0x7')](_0x25c8('0xb'))){return this['getDataValue']('production')['toString'](_0x25c8('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x25c8('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1e67ae1..1d67b10 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 _0xab70=['then','get','UserProfileResource','publish','agi','stringify','end','error','name','status','send','index','SquareProject','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','SquareProjects','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','offset','undefined','count','set','json','update','destroy'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0xab70,0x1e9));var _0x0ab7=function(_0x221a70,_0x364013){_0x221a70=_0x221a70-0x0;var _0x1070b4=_0xab70[_0x221a70];return _0x1070b4;};'use strict';var _=require('lodash');var Redis=require(_0x0ab7('0x0'));var qs=require(_0x0ab7('0x1'));var logger=require('../../config/logger')(_0x0ab7('0x2'));var config=require(_0x0ab7('0x3'));var db=require(_0x0ab7('0x4'))['db'];config['redis']=_['defaults'](config[_0x0ab7('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ab7('0x6'))(new Redis(config[_0x0ab7('0x5')]));require(_0x0ab7('0x7'))['register'](socket);function respondWithResult(_0x4583c9,_0x47e6b3){_0x47e6b3=_0x47e6b3||0xc8;return function(_0x3b2b75){if(_0x3b2b75){return _0x4583c9['status'](_0x47e6b3)['json'](_0x3b2b75);}};}function respondWithFilteredResult(_0x4c6e29,_0x344c77){return function(_0x3f8b79){if(_0x3f8b79){var _0x1284cf=typeof _0x344c77[_0x0ab7('0x8')]===_0x0ab7('0x9')&&typeof _0x344c77['limit']==='undefined';var _0x27e38f=_0x3f8b79[_0x0ab7('0xa')];var _0x1be298=_0x1284cf?0x0:_0x344c77[_0x0ab7('0x8')];var _0x254274=_0x1284cf?_0x3f8b79['count']:_0x344c77[_0x0ab7('0x8')]+_0x344c77['limit'];var _0x20e833;if(_0x254274>=_0x27e38f){_0x254274=_0x27e38f;_0x20e833=0xc8;}else{_0x20e833=0xce;}_0x4c6e29['status'](_0x20e833);return _0x4c6e29[_0x0ab7('0xb')]('Content-Range',_0x1be298+'-'+_0x254274+'/'+_0x27e38f)[_0x0ab7('0xc')](_0x3f8b79);}return null;};}function saveUpdates(_0x20f251){return function(_0x185e77){if(_0x185e77){return _0x185e77[_0x0ab7('0xd')](_0x20f251)['then'](function(_0x222874){return _0x222874;});}return null;};}function removeEntity(_0x355278){return function(_0x178164){if(_0x178164){return _0x178164[_0x0ab7('0xe')]()[_0x0ab7('0xf')](function(){var _0x5a2233=_0x178164[_0x0ab7('0x10')]({'plain':!![]});var _0x1f9a12='SquareProjects';return db[_0x0ab7('0x11')][_0x0ab7('0xe')]({'where':{'type':_0x1f9a12,'resourceId':_0x5a2233['id']}})['then'](function(){return _0x178164;});})[_0x0ab7('0xf')](function(){var _0x237bc6=new Redis(config[_0x0ab7('0x5')]);_0x237bc6[_0x0ab7('0x12')](_0x0ab7('0x13'),JSON[_0x0ab7('0x14')]({'id':_0x178164['id'],'deleted':!![]}));})[_0x0ab7('0xf')](function(){_0x355278['status'](0xcc)[_0x0ab7('0x15')]();});}};}function handleEntityNotFound(_0x159174){return function(_0x214674){if(!_0x214674){_0x159174['sendStatus'](0x194);}return _0x214674;};}function handleError(_0x51fe9d,_0x138b8f){_0x138b8f=_0x138b8f||0x1f4;return function(_0x52349e){logger[_0x0ab7('0x16')](_0x52349e['stack']);if(_0x52349e[_0x0ab7('0x17')]){delete _0x52349e[_0x0ab7('0x17')];}_0x51fe9d[_0x0ab7('0x18')](_0x138b8f)[_0x0ab7('0x19')](_0x52349e);};}exports[_0x0ab7('0x1a')]=function(_0x580e28,_0x23f969){var _0x4977bd={},_0x15b276={},_0x3d1ff6={'count':0x0,'rows':[]};var _0xfbc8c9=_['map'](db[_0x0ab7('0x1b')][_0x0ab7('0x1c')],function(_0x16b480){return{'name':_0x16b480['fieldName'],'type':_0x16b480[_0x0ab7('0x1d')][_0x0ab7('0x1e')]};});_0x15b276[_0x0ab7('0x1f')]=_[_0x0ab7('0x20')](_0xfbc8c9,_0x0ab7('0x17'));_0x15b276['query']=_[_0x0ab7('0x21')](_0x580e28[_0x0ab7('0x22')]);_0x15b276[_0x0ab7('0x23')]=_[_0x0ab7('0x24')](_0x15b276[_0x0ab7('0x1f')],_0x15b276[_0x0ab7('0x22')]);_0x4977bd[_0x0ab7('0x25')]=_['intersection'](_0x15b276['model'],qs[_0x0ab7('0x26')](_0x580e28[_0x0ab7('0x22')][_0x0ab7('0x26')]));_0x4977bd[_0x0ab7('0x25')]=_0x4977bd[_0x0ab7('0x25')][_0x0ab7('0x27')]?_0x4977bd[_0x0ab7('0x25')]:_0x15b276[_0x0ab7('0x1f')];if(!_0x580e28[_0x0ab7('0x22')]['hasOwnProperty'](_0x0ab7('0x28'))){_0x4977bd[_0x0ab7('0x29')]=qs['limit'](_0x580e28['query']['limit']);_0x4977bd[_0x0ab7('0x8')]=qs[_0x0ab7('0x8')](_0x580e28[_0x0ab7('0x22')][_0x0ab7('0x8')]);}_0x4977bd['order']=qs[_0x0ab7('0x2a')](_0x580e28[_0x0ab7('0x22')][_0x0ab7('0x2a')]);_0x4977bd[_0x0ab7('0x2b')]=qs[_0x0ab7('0x23')](_['pick'](_0x580e28[_0x0ab7('0x22')],_0x15b276[_0x0ab7('0x23')]),_0xfbc8c9);if(_0x580e28[_0x0ab7('0x22')][_0x0ab7('0x2c')]){_0x4977bd[_0x0ab7('0x2b')]=_[_0x0ab7('0x2d')](_0x4977bd[_0x0ab7('0x2b')],{'$or':_[_0x0ab7('0x20')](_0xfbc8c9,function(_0x56636c){if(_0x56636c[_0x0ab7('0x1d')]!==_0x0ab7('0x2e')){var _0x54f68b={};_0x54f68b[_0x56636c[_0x0ab7('0x17')]]={'$like':'%'+_0x580e28[_0x0ab7('0x22')][_0x0ab7('0x2c')]+'%'};return _0x54f68b;}})});}_0x4977bd=_[_0x0ab7('0x2d')]({},_0x4977bd,_0x580e28[_0x0ab7('0x2f')]);var _0x5d04c2={'where':_0x4977bd[_0x0ab7('0x2b')]};return db[_0x0ab7('0x1b')]['count'](_0x5d04c2)[_0x0ab7('0xf')](function(_0x2abb80){_0x3d1ff6[_0x0ab7('0xa')]=_0x2abb80;if(_0x580e28['query'][_0x0ab7('0x30')]){_0x4977bd[_0x0ab7('0x31')]=[{'all':!![]}];}return db[_0x0ab7('0x1b')][_0x0ab7('0x32')](_0x4977bd);})[_0x0ab7('0xf')](function(_0x107175){_0x3d1ff6[_0x0ab7('0x33')]=_0x107175;return _0x3d1ff6;})[_0x0ab7('0xf')](respondWithFilteredResult(_0x23f969,_0x4977bd))[_0x0ab7('0x34')](handleError(_0x23f969,null));};exports['show']=function(_0x488b32,_0x3e865c){var _0x478b00={'raw':![],'where':{'id':_0x488b32[_0x0ab7('0x35')]['id']}},_0x14217b={};_0x14217b[_0x0ab7('0x1f')]=_[_0x0ab7('0x21')](db[_0x0ab7('0x1b')][_0x0ab7('0x1c')]);_0x14217b[_0x0ab7('0x22')]=_[_0x0ab7('0x21')](_0x488b32['query']);_0x14217b[_0x0ab7('0x23')]=_[_0x0ab7('0x24')](_0x14217b[_0x0ab7('0x1f')],_0x14217b['query']);_0x478b00['attributes']=_[_0x0ab7('0x24')](_0x14217b['model'],qs[_0x0ab7('0x26')](_0x488b32['query'][_0x0ab7('0x26')]));_0x478b00[_0x0ab7('0x25')]=_0x478b00[_0x0ab7('0x25')][_0x0ab7('0x27')]?_0x478b00[_0x0ab7('0x25')]:_0x14217b['model'];if(_0x488b32[_0x0ab7('0x22')]['includeAll']){_0x478b00[_0x0ab7('0x31')]=[{'all':!![]}];}_0x478b00=_['merge']({},_0x478b00,_0x488b32[_0x0ab7('0x2f')]);return db[_0x0ab7('0x1b')][_0x0ab7('0x36')](_0x478b00)['then'](handleEntityNotFound(_0x3e865c,null))['then'](respondWithResult(_0x3e865c,null))[_0x0ab7('0x34')](handleError(_0x3e865c,null));};exports[_0x0ab7('0x37')]=function(_0x38e1c3,_0x33465a){return db[_0x0ab7('0x1b')][_0x0ab7('0x37')](_0x38e1c3[_0x0ab7('0x38')],{})[_0x0ab7('0xf')](function(_0x1edfc8){var _0x43e1db=_0x38e1c3[_0x0ab7('0x39')][_0x0ab7('0x10')]({'plain':!![]});if(!_0x43e1db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43e1db[_0x0ab7('0x3a')]===_0x0ab7('0x39')){var _0x3b7940=_0x1edfc8[_0x0ab7('0x10')]({'plain':!![]});var _0x1e5edc=_0x0ab7('0x3b');return db['UserProfileSection'][_0x0ab7('0x36')]({'where':{'name':_0x1e5edc,'userProfileId':_0x43e1db[_0x0ab7('0x3c')]},'raw':!![]})[_0x0ab7('0xf')](function(_0xfcba0a){if(_0xfcba0a&&_0xfcba0a['autoAssociation']===0x0){return db['UserProfileResource'][_0x0ab7('0x37')]({'name':_0x3b7940[_0x0ab7('0x17')],'resourceId':_0x3b7940['id'],'type':_0xfcba0a['name'],'sectionId':_0xfcba0a['id']},{})[_0x0ab7('0xf')](function(){return _0x1edfc8;});}else{return _0x1edfc8;}})[_0x0ab7('0x34')](function(_0x16189e){logger['error'](_0x0ab7('0x3d'),_0x16189e);throw _0x16189e;});}return _0x1edfc8;})[_0x0ab7('0xf')](respondWithResult(_0x33465a,0xc9))['catch'](handleError(_0x33465a,null));};exports[_0x0ab7('0xd')]=function(_0x4028f9,_0x3543fb){if(_0x4028f9[_0x0ab7('0x38')]['id']){delete _0x4028f9[_0x0ab7('0x38')]['id'];}return db[_0x0ab7('0x1b')]['find']({'where':{'id':_0x4028f9[_0x0ab7('0x35')]['id']}})[_0x0ab7('0xf')](handleEntityNotFound(_0x3543fb,null))[_0x0ab7('0xf')](saveUpdates(_0x4028f9['body'],null))['then'](function(_0x2b5e1a){if(!_0x2b5e1a)return;var _0x3d981a=_0x2b5e1a[_0x0ab7('0x10')]({'plain':!![]});return _0x3d981a;})[_0x0ab7('0xf')](function(_0x55b331){var _0x56010d=new Redis(config[_0x0ab7('0x5')]);_0x56010d['publish'](_0x0ab7('0x13'),JSON[_0x0ab7('0x14')](_['pick'](_0x55b331,['id',_0x0ab7('0x17'),_0x0ab7('0x3e')])));return _0x55b331;})[_0x0ab7('0xf')](respondWithResult(_0x3543fb,null))['catch'](handleError(_0x3543fb,null));};exports[_0x0ab7('0xe')]=function(_0x4bc634,_0x367578){return db[_0x0ab7('0x1b')][_0x0ab7('0x36')]({'where':{'id':_0x4bc634['params']['id']}})[_0x0ab7('0xf')](handleEntityNotFound(_0x367578,null))[_0x0ab7('0xf')](removeEntity(_0x367578,null))[_0x0ab7('0x34')](handleError(_0x367578,null));}; \ No newline at end of file +var _0x118b=['fieldName','type','key','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','map','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','SquareProjects','publish','agi','stringify','end','error','stack','name','send','SquareProject'];(function(_0x5e3b19,_0x8f774c){var _0xbe3f35=function(_0x24c9bc){while(--_0x24c9bc){_0x5e3b19['push'](_0x5e3b19['shift']());}};_0xbe3f35(++_0x8f774c);}(_0x118b,0x1d1));var _0xb118=function(_0x43406f,_0x4816c7){_0x43406f=_0x43406f-0x0;var _0x39d0fa=_0x118b[_0x43406f];return _0x39d0fa;};'use strict';var _=require(_0xb118('0x0'));var Redis=require(_0xb118('0x1'));var qs=require(_0xb118('0x2'));var logger=require('../../config/logger')(_0xb118('0x3'));var config=require(_0xb118('0x4'));var db=require(_0xb118('0x5'))['db'];config['redis']=_[_0xb118('0x6')](config[_0xb118('0x7')],{'host':_0xb118('0x8'),'port':0x18eb});var socket=require(_0xb118('0x9'))(new Redis(config[_0xb118('0x7')]));require(_0xb118('0xa'))['register'](socket);function respondWithResult(_0x597328,_0x45f91f){_0x45f91f=_0x45f91f||0xc8;return function(_0x52fdce){if(_0x52fdce){return _0x597328[_0xb118('0xb')](_0x45f91f)[_0xb118('0xc')](_0x52fdce);}};}function respondWithFilteredResult(_0x3f8854,_0x4135d1){return function(_0x33dcac){if(_0x33dcac){var _0x46d83a=typeof _0x4135d1[_0xb118('0xd')]===_0xb118('0xe')&&typeof _0x4135d1[_0xb118('0xf')]===_0xb118('0xe');var _0x89b559=_0x33dcac[_0xb118('0x10')];var _0xbda390=_0x46d83a?0x0:_0x4135d1[_0xb118('0xd')];var _0x53f310=_0x46d83a?_0x33dcac['count']:_0x4135d1[_0xb118('0xd')]+_0x4135d1[_0xb118('0xf')];var _0x2a649d;if(_0x53f310>=_0x89b559){_0x53f310=_0x89b559;_0x2a649d=0xc8;}else{_0x2a649d=0xce;}_0x3f8854[_0xb118('0xb')](_0x2a649d);return _0x3f8854[_0xb118('0x11')](_0xb118('0x12'),_0xbda390+'-'+_0x53f310+'/'+_0x89b559)[_0xb118('0xc')](_0x33dcac);}return null;};}function saveUpdates(_0x193500){return function(_0x28f908){if(_0x28f908){return _0x28f908['update'](_0x193500)[_0xb118('0x13')](function(_0x5aca16){return _0x5aca16;});}return null;};}function removeEntity(_0x7f4528){return function(_0x44c5f7){if(_0x44c5f7){return _0x44c5f7[_0xb118('0x14')]()['then'](function(){var _0x281fb8=_0x44c5f7[_0xb118('0x15')]({'plain':!![]});var _0x17208f=_0xb118('0x16');return db['UserProfileResource'][_0xb118('0x14')]({'where':{'type':_0x17208f,'resourceId':_0x281fb8['id']}})[_0xb118('0x13')](function(){return _0x44c5f7;});})['then'](function(){var _0x478f9f=new Redis(config[_0xb118('0x7')]);_0x478f9f[_0xb118('0x17')](_0xb118('0x18'),JSON[_0xb118('0x19')]({'id':_0x44c5f7['id'],'deleted':!![]}));})[_0xb118('0x13')](function(){_0x7f4528[_0xb118('0xb')](0xcc)[_0xb118('0x1a')]();});}};}function handleEntityNotFound(_0xf99543){return function(_0x276f9f){if(!_0x276f9f){_0xf99543['sendStatus'](0x194);}return _0x276f9f;};}function handleError(_0x24bfc4,_0x476c46){_0x476c46=_0x476c46||0x1f4;return function(_0x253501){logger[_0xb118('0x1b')](_0x253501[_0xb118('0x1c')]);if(_0x253501[_0xb118('0x1d')]){delete _0x253501['name'];}_0x24bfc4[_0xb118('0xb')](_0x476c46)[_0xb118('0x1e')](_0x253501);};}exports['index']=function(_0xebe6e,_0x17fca9){var _0x642a4f={},_0x287257={},_0x565344={'count':0x0,'rows':[]};var _0x12015b=_['map'](db[_0xb118('0x1f')]['rawAttributes'],function(_0x179852){return{'name':_0x179852[_0xb118('0x20')],'type':_0x179852[_0xb118('0x21')][_0xb118('0x22')]};});_0x287257['model']=_['map'](_0x12015b,'name');_0x287257['query']=_[_0xb118('0x23')](_0xebe6e[_0xb118('0x24')]);_0x287257[_0xb118('0x25')]=_['intersection'](_0x287257[_0xb118('0x26')],_0x287257[_0xb118('0x24')]);_0x642a4f['attributes']=_['intersection'](_0x287257[_0xb118('0x26')],qs[_0xb118('0x27')](_0xebe6e['query'][_0xb118('0x27')]));_0x642a4f[_0xb118('0x28')]=_0x642a4f['attributes'][_0xb118('0x29')]?_0x642a4f[_0xb118('0x28')]:_0x287257['model'];if(!_0xebe6e['query'][_0xb118('0x2a')](_0xb118('0x2b'))){_0x642a4f[_0xb118('0xf')]=qs[_0xb118('0xf')](_0xebe6e['query'][_0xb118('0xf')]);_0x642a4f[_0xb118('0xd')]=qs[_0xb118('0xd')](_0xebe6e[_0xb118('0x24')][_0xb118('0xd')]);}_0x642a4f[_0xb118('0x2c')]=qs[_0xb118('0x2d')](_0xebe6e['query']['sort']);_0x642a4f['where']=qs[_0xb118('0x25')](_['pick'](_0xebe6e['query'],_0x287257[_0xb118('0x25')]),_0x12015b);if(_0xebe6e[_0xb118('0x24')][_0xb118('0x2e')]){_0x642a4f[_0xb118('0x2f')]=_['merge'](_0x642a4f[_0xb118('0x2f')],{'$or':_[_0xb118('0x30')](_0x12015b,function(_0x6f8937){if(_0x6f8937[_0xb118('0x21')]!=='VIRTUAL'){var _0x475890={};_0x475890[_0x6f8937[_0xb118('0x1d')]]={'$like':'%'+_0xebe6e[_0xb118('0x24')]['filter']+'%'};return _0x475890;}})});}_0x642a4f=_[_0xb118('0x31')]({},_0x642a4f,_0xebe6e[_0xb118('0x32')]);var _0x2ecaaa={'where':_0x642a4f[_0xb118('0x2f')]};return db[_0xb118('0x1f')][_0xb118('0x10')](_0x2ecaaa)[_0xb118('0x13')](function(_0x4f512d){_0x565344[_0xb118('0x10')]=_0x4f512d;if(_0xebe6e['query'][_0xb118('0x33')]){_0x642a4f['include']=[{'all':!![]}];}return db[_0xb118('0x1f')][_0xb118('0x34')](_0x642a4f);})[_0xb118('0x13')](function(_0x1e7081){_0x565344[_0xb118('0x35')]=_0x1e7081;return _0x565344;})['then'](respondWithFilteredResult(_0x17fca9,_0x642a4f))[_0xb118('0x36')](handleError(_0x17fca9,null));};exports[_0xb118('0x37')]=function(_0x529186,_0x47e70a){var _0x1c5cda={'raw':![],'where':{'id':_0x529186[_0xb118('0x38')]['id']}},_0x56ae64={};_0x56ae64['model']=_[_0xb118('0x23')](db[_0xb118('0x1f')][_0xb118('0x39')]);_0x56ae64[_0xb118('0x24')]=_[_0xb118('0x23')](_0x529186['query']);_0x56ae64['filters']=_[_0xb118('0x3a')](_0x56ae64[_0xb118('0x26')],_0x56ae64[_0xb118('0x24')]);_0x1c5cda['attributes']=_[_0xb118('0x3a')](_0x56ae64[_0xb118('0x26')],qs[_0xb118('0x27')](_0x529186['query'][_0xb118('0x27')]));_0x1c5cda[_0xb118('0x28')]=_0x1c5cda[_0xb118('0x28')]['length']?_0x1c5cda['attributes']:_0x56ae64[_0xb118('0x26')];if(_0x529186[_0xb118('0x24')][_0xb118('0x33')]){_0x1c5cda['include']=[{'all':!![]}];}_0x1c5cda=_[_0xb118('0x31')]({},_0x1c5cda,_0x529186[_0xb118('0x32')]);return db[_0xb118('0x1f')][_0xb118('0x3b')](_0x1c5cda)[_0xb118('0x13')](handleEntityNotFound(_0x47e70a,null))[_0xb118('0x13')](respondWithResult(_0x47e70a,null))[_0xb118('0x36')](handleError(_0x47e70a,null));};exports[_0xb118('0x3c')]=function(_0x188678,_0x4f3681){return db['SquareProject'][_0xb118('0x3c')](_0x188678['body'],{})[_0xb118('0x13')](function(_0x36f887){var _0x3b3e0e=_0x188678[_0xb118('0x3d')][_0xb118('0x15')]({'plain':!![]});if(!_0x3b3e0e)throw new Error(_0xb118('0x3e'));if(_0x3b3e0e[_0xb118('0x3f')]===_0xb118('0x3d')){var _0x3df3e8=_0x36f887[_0xb118('0x15')]({'plain':!![]});var _0x2f94c8=_0xb118('0x16');return db[_0xb118('0x40')][_0xb118('0x3b')]({'where':{'name':_0x2f94c8,'userProfileId':_0x3b3e0e[_0xb118('0x41')]},'raw':!![]})[_0xb118('0x13')](function(_0x49d96d){if(_0x49d96d&&_0x49d96d[_0xb118('0x42')]===0x0){return db[_0xb118('0x43')][_0xb118('0x3c')]({'name':_0x3df3e8[_0xb118('0x1d')],'resourceId':_0x3df3e8['id'],'type':_0x49d96d[_0xb118('0x1d')],'sectionId':_0x49d96d['id']},{})[_0xb118('0x13')](function(){return _0x36f887;});}else{return _0x36f887;}})['catch'](function(_0x3d24ab){logger['error'](_0xb118('0x44'),_0x3d24ab);throw _0x3d24ab;});}return _0x36f887;})[_0xb118('0x13')](respondWithResult(_0x4f3681,0xc9))['catch'](handleError(_0x4f3681,null));};exports['update']=function(_0x3e3e80,_0x5422a6){if(_0x3e3e80[_0xb118('0x45')]['id']){delete _0x3e3e80[_0xb118('0x45')]['id'];}return db[_0xb118('0x1f')][_0xb118('0x3b')]({'where':{'id':_0x3e3e80[_0xb118('0x38')]['id']}})['then'](handleEntityNotFound(_0x5422a6,null))['then'](saveUpdates(_0x3e3e80[_0xb118('0x45')],null))[_0xb118('0x13')](function(_0x4d4e35){if(!_0x4d4e35)return;var _0x57e19c=_0x4d4e35[_0xb118('0x15')]({'plain':!![]});return _0x57e19c;})[_0xb118('0x13')](function(_0x23dda2){var _0x1d0452=new Redis(config['redis']);_0x1d0452[_0xb118('0x17')](_0xb118('0x18'),JSON[_0xb118('0x19')](_[_0xb118('0x46')](_0x23dda2,['id',_0xb118('0x1d'),'production'])));return _0x23dda2;})[_0xb118('0x13')](respondWithResult(_0x5422a6,null))[_0xb118('0x36')](handleError(_0x5422a6,null));};exports[_0xb118('0x14')]=function(_0x36f309,_0x22b033){return db[_0xb118('0x1f')][_0xb118('0x3b')]({'where':{'id':_0x36f309[_0xb118('0x38')]['id']}})[_0xb118('0x13')](handleEntityNotFound(_0x22b033,null))[_0xb118('0x13')](removeEntity(_0x22b033,null))[_0xb118('0x36')](handleError(_0x22b033,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a7ae68a..bcf4993 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 _0x3571=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x272fea,_0x204f7e){var _0x28d4dc=function(_0x43909f){while(--_0x43909f){_0x272fea['push'](_0x272fea['shift']());}};_0x28d4dc(++_0x204f7e);}(_0x3571,0x9b));var _0x1357=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x3571[_0x379799];return _0x46e431;};'use strict';var EventEmitter=require(_0x1357('0x0'));var SquareProject=require(_0x1357('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1357('0x2'),'afterUpdate':_0x1357('0x3'),'afterDestroy':_0x1357('0x4')};function emitEvent(_0x31c345){return function(_0x43a60a,_0x65a3c,_0x204502){SquareProjectEvents[_0x1357('0x5')](_0x31c345+':'+_0x43a60a['id'],_0x43a60a);SquareProjectEvents[_0x1357('0x5')](_0x31c345,_0x43a60a);_0x204502(null);};}for(var e in events){if(events[_0x1357('0x6')](e)){var event=events[e];SquareProject[_0x1357('0x7')](e,emitEvent(event));}}module[_0x1357('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xef48=['events','../../mysqldb','setMaxListeners','update','remove','emit','hook'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xef48,0x1d5));var _0x8ef4=function(_0x17e453,_0x421cc5){_0x17e453=_0x17e453-0x0;var _0x37d99e=_0xef48[_0x17e453];return _0x37d99e;};'use strict';var EventEmitter=require(_0x8ef4('0x0'));var SquareProject=require(_0x8ef4('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8ef4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ef4('0x3'),'afterDestroy':_0x8ef4('0x4')};function emitEvent(_0x13ce41){return function(_0x379f7a,_0x18b424,_0x27b867){SquareProjectEvents[_0x8ef4('0x5')](_0x13ce41+':'+_0x379f7a['id'],_0x379f7a);SquareProjectEvents[_0x8ef4('0x5')](_0x13ce41,_0x379f7a);_0x27b867(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8ef4('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2fb6d42..4ad1944 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 _0x6cc5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash'];(function(_0x18dc34,_0x205f71){var _0x4ab15b=function(_0x50572f){while(--_0x50572f){_0x18dc34['push'](_0x18dc34['shift']());}};_0x4ab15b(++_0x205f71);}(_0x6cc5,0x98));var _0x56cc=function(_0x522699,_0x1b4d52){_0x522699=_0x522699-0x0;var _0x510d73=_0x6cc5[_0x522699];return _0x510d73;};'use strict';var _=require(_0x56cc('0x0'));var util=require('util');var logger=require(_0x56cc('0x1'))(_0x56cc('0x2'));var moment=require(_0x56cc('0x3'));var BPromise=require(_0x56cc('0x4'));var rp=require(_0x56cc('0x5'));var fs=require('fs');var path=require(_0x56cc('0x6'));var rimraf=require(_0x56cc('0x7'));var config=require(_0x56cc('0x8'));var attributes=require(_0x56cc('0x9'));module[_0x56cc('0xa')]=function(_0x1f6662,_0x4a31ad){return _0x1f6662[_0x56cc('0xb')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x44c30d,_0x36b135,_0x4159bf){if(_0x44c30d[_0x56cc('0xc')](_0x56cc('0xd'))){_0x44c30d['savedAt']=moment()[_0x56cc('0xe')](_0x56cc('0xf'));}if(_0x44c30d['changed'](_0x56cc('0x10'))){_0x44c30d['publishedAt']=moment()[_0x56cc('0xe')](_0x56cc('0xf'));}_0x4159bf(null,_0x44c30d);}}});}; \ No newline at end of file +var _0xed80=['util','moment','bluebird','request-promise','path','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x1da4bc,_0x148afa){var _0x3cb3f9=function(_0x421787){while(--_0x421787){_0x1da4bc['push'](_0x1da4bc['shift']());}};_0x3cb3f9(++_0x148afa);}(_0xed80,0x13b));var _0x0ed8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xed80[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x0ed8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0ed8('0x1'));var BPromise=require(_0x0ed8('0x2'));var rp=require(_0x0ed8('0x3'));var fs=require('fs');var path=require(_0x0ed8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ed8('0x5'));module[_0x0ed8('0x6')]=function(_0x17a061,_0x2b4cb8){return _0x17a061['define'](_0x0ed8('0x7'),attributes,{'tableName':_0x0ed8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ac83b,_0x5075b9,_0x343712){if(_0x5ac83b[_0x0ed8('0x9')]('preproduction')){_0x5ac83b[_0x0ed8('0xa')]=moment()[_0x0ed8('0xb')](_0x0ed8('0xc'));}if(_0x5ac83b[_0x0ed8('0x9')](_0x0ed8('0xd'))){_0x5ac83b[_0x0ed8('0xe')]=moment()['format'](_0x0ed8('0xc'));}_0x343712(null,_0x5ac83b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 982a3d4..96eaae4 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 _0xe0bb=['debug','stringify','catch','error','message','find','where','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','attributes','limit','include','map','model','then'];(function(_0x126de5,_0x2da830){var _0x38ad2a=function(_0x5d3bc2){while(--_0x5d3bc2){_0x126de5['push'](_0x126de5['shift']());}};_0x38ad2a(++_0x2da830);}(_0xe0bb,0x7c));var _0xbe0b=function(_0x53b6ae,_0x3cb9f4){_0x53b6ae=_0x53b6ae-0x0;var _0x34f4b2=_0xe0bb[_0x53b6ae];return _0x34f4b2;};'use strict';var _=require(_0xbe0b('0x0'));var Redis=require(_0xbe0b('0x1'));var db=require(_0xbe0b('0x2'))['db'];var logger=require(_0xbe0b('0x3'))(_0xbe0b('0x4'));var config=require(_0xbe0b('0x5'));config[_0xbe0b('0x6')]=_[_0xbe0b('0x7')](config[_0xbe0b('0x6')],{'host':_0xbe0b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe0b('0x6')]));require(_0xbe0b('0x9'))[_0xbe0b('0xa')](socket);exports[_0xbe0b('0xb')]=function(_0x2f4116){var _0x2fec01=this;return new Promise(function(_0x368b78,_0x5c3e14){return db['SquareProject'][_0xbe0b('0xc')]({'raw':_0x2f4116[_0xbe0b('0xd')]?_0x2f4116[_0xbe0b('0xd')][_0xbe0b('0xe')]===undefined?!![]:![]:!![],'where':_0x2f4116[_0xbe0b('0xd')]?_0x2f4116[_0xbe0b('0xd')]['where']||null:null,'attributes':_0x2f4116[_0xbe0b('0xd')]?_0x2f4116[_0xbe0b('0xd')][_0xbe0b('0xf')]||null:null,'limit':_0x2f4116[_0xbe0b('0xd')]?_0x2f4116[_0xbe0b('0xd')][_0xbe0b('0x10')]||null:null,'include':_0x2f4116[_0xbe0b('0xd')]?_0x2f4116[_0xbe0b('0xd')][_0xbe0b('0x11')]?_[_0xbe0b('0x12')](_0x2f4116[_0xbe0b('0xd')][_0xbe0b('0x11')],function(_0x1ef605){return{'model':db[_0x1ef605[_0xbe0b('0x13')]],'as':_0x1ef605['as'],'attributes':_0x1ef605[_0xbe0b('0xf')],'include':_0x1ef605[_0xbe0b('0x11')]?_['map'](_0x1ef605['include'],function(_0x591e0d){return{'model':db[_0x591e0d[_0xbe0b('0x13')]],'as':_0x591e0d['as'],'attributes':_0x591e0d[_0xbe0b('0xf')],'include':_0x591e0d[_0xbe0b('0x11')]?_[_0xbe0b('0x12')](_0x591e0d[_0xbe0b('0x11')],function(_0x46cac2){return{'model':db[_0x46cac2[_0xbe0b('0x13')]],'as':_0x46cac2['as'],'attributes':_0x46cac2[_0xbe0b('0xf')]};}):[]};}):[]};}):[]:[]})[_0xbe0b('0x14')](function(_0x5c81d0){logger['info']('GetSquareProjects',_0x2f4116);logger[_0xbe0b('0x15')]('GetSquareProjects',_0x2f4116,JSON[_0xbe0b('0x16')](_0x5c81d0));_0x368b78(_0x5c81d0);})[_0xbe0b('0x17')](function(_0x22fbea){logger['error'](_0xbe0b('0xb'),_0x22fbea['message'],_0x2f4116);_0x5c3e14(_0x2fec01[_0xbe0b('0x18')](0x1f4,_0x22fbea[_0xbe0b('0x19')]));});});};exports['ShowSquareProject']=function(_0x2adc09){var _0x338a99=this;return new Promise(function(_0x160680,_0x2b2738){return db['SquareProject'][_0xbe0b('0x1a')]({'raw':_0x2adc09[_0xbe0b('0xd')]?_0x2adc09[_0xbe0b('0xd')][_0xbe0b('0xe')]===undefined?!![]:![]:!![],'where':_0x2adc09[_0xbe0b('0xd')]?_0x2adc09[_0xbe0b('0xd')][_0xbe0b('0x1b')]||null:null,'attributes':_0x2adc09[_0xbe0b('0xd')]?_0x2adc09[_0xbe0b('0xd')][_0xbe0b('0xf')]||null:null,'include':_0x2adc09[_0xbe0b('0xd')]?_0x2adc09[_0xbe0b('0xd')][_0xbe0b('0x11')]?_[_0xbe0b('0x12')](_0x2adc09[_0xbe0b('0xd')][_0xbe0b('0x11')],function(_0x5e7544){return{'model':db[_0x5e7544[_0xbe0b('0x13')]],'as':_0x5e7544['as'],'attributes':_0x5e7544[_0xbe0b('0xf')],'include':_0x5e7544[_0xbe0b('0x11')]?_['map'](_0x5e7544[_0xbe0b('0x11')],function(_0x3d3681){return{'model':db[_0x3d3681[_0xbe0b('0x13')]],'as':_0x3d3681['as'],'attributes':_0x3d3681[_0xbe0b('0xf')],'include':_0x3d3681[_0xbe0b('0x11')]?_[_0xbe0b('0x12')](_0x3d3681[_0xbe0b('0x11')],function(_0x98956a){return{'model':db[_0x98956a[_0xbe0b('0x13')]],'as':_0x98956a['as'],'attributes':_0x98956a[_0xbe0b('0xf')]};}):[]};}):[]};}):[]:[]})[_0xbe0b('0x14')](function(_0xc845fa){logger['info'](_0xbe0b('0x1c'),_0x2adc09);logger[_0xbe0b('0x15')](_0xbe0b('0x1c'),_0x2adc09,JSON[_0xbe0b('0x16')](_0xc845fa));_0x160680(_0xc845fa);})[_0xbe0b('0x17')](function(_0x42af81){logger[_0xbe0b('0x18')](_0xbe0b('0x1c'),_0x42af81[_0xbe0b('0x19')],_0x2adc09);_0x2b2738(_0x338a99[_0xbe0b('0x18')](0x1f4,_0x42af81[_0xbe0b('0x19')]));});});}; \ No newline at end of file +var _0xeab0=['../../mysqldb','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','ShowSquareProject','SquareProject','find','info','lodash'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xeab0,0xca));var _0x0eab=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xeab0[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x0eab('0x0'));var Redis=require('ioredis');var db=require(_0x0eab('0x1'))['db'];var logger=require(_0x0eab('0x2'))(_0x0eab('0x3'));var config=require(_0x0eab('0x4'));config[_0x0eab('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0eab('0x6'))(new Redis(config[_0x0eab('0x5')]));require(_0x0eab('0x7'))[_0x0eab('0x8')](socket);exports[_0x0eab('0x9')]=function(_0x50b4b4){var _0x3a29b5=this;return new Promise(function(_0x285e0a,_0x4f826c){return db['SquareProject'][_0x0eab('0xa')]({'raw':_0x50b4b4[_0x0eab('0xb')]?_0x50b4b4[_0x0eab('0xb')][_0x0eab('0xc')]===undefined?!![]:![]:!![],'where':_0x50b4b4['options']?_0x50b4b4[_0x0eab('0xb')][_0x0eab('0xd')]||null:null,'attributes':_0x50b4b4[_0x0eab('0xb')]?_0x50b4b4['options'][_0x0eab('0xe')]||null:null,'limit':_0x50b4b4['options']?_0x50b4b4[_0x0eab('0xb')][_0x0eab('0xf')]||null:null,'include':_0x50b4b4[_0x0eab('0xb')]?_0x50b4b4[_0x0eab('0xb')][_0x0eab('0x10')]?_[_0x0eab('0x11')](_0x50b4b4[_0x0eab('0xb')][_0x0eab('0x10')],function(_0x23d6de){return{'model':db[_0x23d6de['model']],'as':_0x23d6de['as'],'attributes':_0x23d6de[_0x0eab('0xe')],'include':_0x23d6de[_0x0eab('0x10')]?_[_0x0eab('0x11')](_0x23d6de['include'],function(_0x5ab122){return{'model':db[_0x5ab122[_0x0eab('0x12')]],'as':_0x5ab122['as'],'attributes':_0x5ab122['attributes'],'include':_0x5ab122[_0x0eab('0x10')]?_['map'](_0x5ab122['include'],function(_0x198253){return{'model':db[_0x198253[_0x0eab('0x12')]],'as':_0x198253['as'],'attributes':_0x198253[_0x0eab('0xe')]};}):[]};}):[]};}):[]:[]})[_0x0eab('0x13')](function(_0x5eca97){logger['info'](_0x0eab('0x9'),_0x50b4b4);logger[_0x0eab('0x14')](_0x0eab('0x9'),_0x50b4b4,JSON[_0x0eab('0x15')](_0x5eca97));_0x285e0a(_0x5eca97);})[_0x0eab('0x16')](function(_0x41b2d2){logger[_0x0eab('0x17')](_0x0eab('0x9'),_0x41b2d2[_0x0eab('0x18')],_0x50b4b4);_0x4f826c(_0x3a29b5[_0x0eab('0x17')](0x1f4,_0x41b2d2[_0x0eab('0x18')]));});});};exports[_0x0eab('0x19')]=function(_0xe5db72){var _0x170970=this;return new Promise(function(_0x303bc1,_0x227808){return db[_0x0eab('0x1a')][_0x0eab('0x1b')]({'raw':_0xe5db72[_0x0eab('0xb')]?_0xe5db72[_0x0eab('0xb')][_0x0eab('0xc')]===undefined?!![]:![]:!![],'where':_0xe5db72[_0x0eab('0xb')]?_0xe5db72[_0x0eab('0xb')]['where']||null:null,'attributes':_0xe5db72[_0x0eab('0xb')]?_0xe5db72[_0x0eab('0xb')][_0x0eab('0xe')]||null:null,'include':_0xe5db72[_0x0eab('0xb')]?_0xe5db72['options'][_0x0eab('0x10')]?_[_0x0eab('0x11')](_0xe5db72[_0x0eab('0xb')]['include'],function(_0x2ddb08){return{'model':db[_0x2ddb08[_0x0eab('0x12')]],'as':_0x2ddb08['as'],'attributes':_0x2ddb08['attributes'],'include':_0x2ddb08['include']?_[_0x0eab('0x11')](_0x2ddb08[_0x0eab('0x10')],function(_0x13f6d3){return{'model':db[_0x13f6d3[_0x0eab('0x12')]],'as':_0x13f6d3['as'],'attributes':_0x13f6d3['attributes'],'include':_0x13f6d3[_0x0eab('0x10')]?_[_0x0eab('0x11')](_0x13f6d3[_0x0eab('0x10')],function(_0x4c42b0){return{'model':db[_0x4c42b0['model']],'as':_0x4c42b0['as'],'attributes':_0x4c42b0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x167537){logger[_0x0eab('0x1c')](_0x0eab('0x19'),_0xe5db72);logger[_0x0eab('0x14')](_0x0eab('0x19'),_0xe5db72,JSON[_0x0eab('0x15')](_0x167537));_0x303bc1(_0x167537);})['catch'](function(_0x5f4f2f){logger['error'](_0x0eab('0x19'),_0x5f4f2f[_0x0eab('0x18')],_0xe5db72);_0x227808(_0x170970[_0x0eab('0x17')](0x1f4,_0x5f4f2f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 39196f3..7211c8c 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 _0x2357=['./squareProject.events','save','remove','update','emit','removeListener','register','squareProject:'];(function(_0x58fec5,_0x90f62f){var _0x49fe16=function(_0x211616){while(--_0x211616){_0x58fec5['push'](_0x58fec5['shift']());}};_0x49fe16(++_0x90f62f);}(_0x2357,0xe0));var _0x7235=function(_0x2cee2b,_0x248339){_0x2cee2b=_0x2cee2b-0x0;var _0x1114d0=_0x2357[_0x2cee2b];return _0x1114d0;};'use strict';var SquareProjectEvents=require(_0x7235('0x0'));var events=[_0x7235('0x1'),_0x7235('0x2'),_0x7235('0x3')];function createListener(_0x54d4d0,_0x6ac508){return function(_0xa92f7c){_0x6ac508[_0x7235('0x4')](_0x54d4d0,_0xa92f7c);};}function removeListener(_0x270e3c,_0x51dbae){return function(){SquareProjectEvents[_0x7235('0x5')](_0x270e3c,_0x51dbae);};}exports[_0x7235('0x6')]=function(_0x1d76a9){for(var _0x8e4193=0x0,_0xed6fc=events['length'];_0x8e4193<_0xed6fc;_0x8e4193++){var _0x34c83f=events[_0x8e4193];var _0x16c697=createListener(_0x7235('0x7')+_0x34c83f,_0x1d76a9);SquareProjectEvents['on'](_0x34c83f,_0x16c697);}}; \ No newline at end of file +var _0xd883=['length','squareProject:','./squareProject.events','save','update','emit','removeListener','register'];(function(_0x4ed73f,_0x1baf4f){var _0x3a6ad4=function(_0x56c8da){while(--_0x56c8da){_0x4ed73f['push'](_0x4ed73f['shift']());}};_0x3a6ad4(++_0x1baf4f);}(_0xd883,0x1ba));var _0x3d88=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xd883[_0x68c979];return _0x4f0001;};'use strict';var SquareProjectEvents=require(_0x3d88('0x0'));var events=[_0x3d88('0x1'),'remove',_0x3d88('0x2')];function createListener(_0x18d954,_0x495f48){return function(_0x55e55e){_0x495f48[_0x3d88('0x3')](_0x18d954,_0x55e55e);};}function removeListener(_0x1bca55,_0x48ed26){return function(){SquareProjectEvents[_0x3d88('0x4')](_0x1bca55,_0x48ed26);};}exports[_0x3d88('0x5')]=function(_0x57a301){for(var _0x5e8d18=0x0,_0x3679b6=events[_0x3d88('0x6')];_0x5e8d18<_0x3679b6;_0x5e8d18++){var _0x370588=events[_0x5e8d18];var _0x54f897=createListener(_0x3d88('0x7')+_0x370588,_0x57a301);SquareProjectEvents['on'](_0x370588,_0x54f897);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8cb8c34..7e104f6 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x588df0,_0x3f4b0c){var _0x4873a5=function(_0x3dab8e){while(--_0x3dab8e){_0x588df0['push'](_0x588df0['shift']());}};_0x4873a5(++_0x3f4b0c);}(_0x1261,0x144));var _0x1126=function(_0x1e896c,_0x3f9948){_0x1e896c=_0x1e896c-0x0;var _0xd149d9=_0x1261[_0x1e896c];return _0xd149d9;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x49348a,_0x2ca546){var _0x209919=function(_0x595087){while(--_0x595087){_0x49348a['push'](_0x49348a['shift']());}};_0x209919(++_0x2ca546);}(_0x326f,0xd1));var _0xf326=function(_0x15d454,_0x2ca4a9){_0x15d454=_0x15d454-0x0;var _0x44d42e=_0x326f[_0x15d454];return _0x44d42e;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index d9b4c71..df61288 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 _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x3a1021,_0x1c3872){var _0x138a79=function(_0x31b3df){while(--_0x31b3df){_0x3a1021['push'](_0x3a1021['shift']());}};_0x138a79(++_0x1c3872);}(_0x31f0,0xb7));var _0x031f=function(_0x457ffc,_0x15f6af){_0x457ffc=_0x457ffc-0x0;var _0x40a0e4=_0x31f0[_0x457ffc];return _0x40a0e4;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file +var _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x33bb8c,_0x22faa2){var _0x18d69e=function(_0x25572c){while(--_0x25572c){_0x33bb8c['push'](_0x33bb8c['shift']());}};_0x18d69e(++_0x22faa2);}(_0x5d17,0x114));var _0x75d1=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0x5d17[_0x4da382];return _0x10073f;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b88d400..fe8bcc8 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 _0x3b5f=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','json','reject','save','update','destroy','then','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','length','options','find','catch','create','body','download','uniqueid','params','savePath','filename','%s.cypher','existsSync','decryptFile','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22'];(function(_0x37d54b,_0x206aa8){var _0x432046=function(_0x5e2141){while(--_0x5e2141){_0x37d54b['push'](_0x37d54b['shift']());}};_0x432046(++_0x206aa8);}(_0x3b5f,0x1c1));var _0xf3b5=function(_0x53c383,_0x2e1f22){_0x53c383=_0x53c383-0x0;var _0x343c03=_0x3b5f[_0x53c383];return _0x343c03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf3b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3b5('0x1'));var rp=require(_0xf3b5('0x2'));var moment=require('moment');var BPromise=require(_0xf3b5('0x3'));var Mustache=require('mustache');var util=require(_0xf3b5('0x4'));var path=require(_0xf3b5('0x5'));var sox=require('sox');var csv=require(_0xf3b5('0x6'));var ejs=require(_0xf3b5('0x7'));var fs=require('fs');var fs_extra=require(_0xf3b5('0x8'));var _=require('lodash');var squel=require(_0xf3b5('0x9'));var crypto=require(_0xf3b5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf3b5('0x6'));var querystring=require(_0xf3b5('0xb'));var Papa=require(_0xf3b5('0xc'));var Redis=require(_0xf3b5('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf3b5('0xe'));var hardwareService=require(_0xf3b5('0xf'));var logger=require(_0xf3b5('0x10'))(_0xf3b5('0x11'));var utils=require(_0xf3b5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf3b5('0x13'))['db'];function respondWithStatusCode(_0x3ae2ed,_0x137504){_0x137504=_0x137504||0xcc;return function(_0x400cc4){if(_0x400cc4){return _0x3ae2ed[_0xf3b5('0x14')](_0x137504);}return _0x3ae2ed['status'](_0x137504)[_0xf3b5('0x15')]();};}function respondWithResult(_0x2944f7,_0x44565f){_0x44565f=_0x44565f||0xc8;return function(_0x48858e){if(_0x48858e){return _0x2944f7['status'](_0x44565f)['json'](_0x48858e);}};}function respondWithFilteredResult(_0x553946,_0x411361){return function(_0x27de08){if(_0x27de08){var _0x1c82d2=typeof _0x411361[_0xf3b5('0x16')]===_0xf3b5('0x17')&&typeof _0x411361['limit']===_0xf3b5('0x17');var _0x5e93e1=_0x27de08[_0xf3b5('0x18')];var _0x3fad35=_0x1c82d2?0x0:_0x411361[_0xf3b5('0x16')];var _0x3d17de=_0x1c82d2?_0x27de08['count']:_0x411361['offset']+_0x411361[_0xf3b5('0x19')];var _0x442f5d;if(_0x3d17de>=_0x5e93e1){_0x3d17de=_0x5e93e1;_0x442f5d=0xc8;}else{_0x442f5d=0xce;}_0x553946[_0xf3b5('0x1a')](_0x442f5d);return _0x553946['set']('Content-Range',_0x3fad35+'-'+_0x3d17de+'/'+_0x5e93e1)[_0xf3b5('0x1b')](_0x27de08);}return null;};}function patchUpdates(_0x53e85f){return function(_0x4177d4){try{jsonpatch['apply'](_0x4177d4,_0x53e85f,!![]);}catch(_0xf26155){return BPromise[_0xf3b5('0x1c')](_0xf26155);}return _0x4177d4[_0xf3b5('0x1d')]();};}function saveUpdates(_0x546c21,_0xcaad54){return function(_0x2cc092){if(_0x2cc092){return _0x2cc092[_0xf3b5('0x1e')](_0x546c21)['then'](function(_0x14c5bd){return _0x14c5bd;});}return null;};}function removeEntity(_0x540672,_0xa7ed54){return function(_0x575699){if(_0x575699){return _0x575699[_0xf3b5('0x1f')]()[_0xf3b5('0x20')](function(){_0x540672['status'](0xcc)[_0xf3b5('0x15')]();});}};}function handleEntityNotFound(_0x35ec0f,_0x147dc0){return function(_0x5dfebd){if(!_0x5dfebd){_0x35ec0f['sendStatus'](0x194);}return _0x5dfebd;};}function handleError(_0x528bf0,_0x28107b){_0x28107b=_0x28107b||0x1f4;return function(_0x2d080d){logger['error'](_0x2d080d[_0xf3b5('0x21')]);if(_0x2d080d['name']){delete _0x2d080d[_0xf3b5('0x22')];}_0x528bf0[_0xf3b5('0x1a')](_0x28107b)[_0xf3b5('0x23')](_0x2d080d);};}exports[_0xf3b5('0x24')]=function(_0x1d09b0,_0x4214e2){var _0x292d17={},_0x1b6c99={},_0x58c652={'count':0x0,'rows':[]};var _0x7ae54=_[_0xf3b5('0x25')](db[_0xf3b5('0x26')][_0xf3b5('0x27')],function(_0x4ef848){return{'name':_0x4ef848[_0xf3b5('0x28')],'type':_0x4ef848[_0xf3b5('0x29')]['key']};});_0x1b6c99[_0xf3b5('0x2a')]=_[_0xf3b5('0x25')](_0x7ae54,_0xf3b5('0x22'));_0x1b6c99[_0xf3b5('0x2b')]=_[_0xf3b5('0x2c')](_0x1d09b0[_0xf3b5('0x2b')]);_0x1b6c99[_0xf3b5('0x2d')]=_[_0xf3b5('0x2e')](_0x1b6c99[_0xf3b5('0x2a')],_0x1b6c99['query']);_0x292d17[_0xf3b5('0x2f')]=_[_0xf3b5('0x2e')](_0x1b6c99['model'],qs[_0xf3b5('0x30')](_0x1d09b0['query'][_0xf3b5('0x30')]));_0x292d17[_0xf3b5('0x2f')]=_0x292d17['attributes']['length']?_0x292d17[_0xf3b5('0x2f')]:_0x1b6c99[_0xf3b5('0x2a')];if(!_0x1d09b0['query'][_0xf3b5('0x31')](_0xf3b5('0x32'))){_0x292d17[_0xf3b5('0x19')]=qs[_0xf3b5('0x19')](_0x1d09b0[_0xf3b5('0x2b')][_0xf3b5('0x19')]);_0x292d17[_0xf3b5('0x16')]=qs[_0xf3b5('0x16')](_0x1d09b0[_0xf3b5('0x2b')][_0xf3b5('0x16')]);}_0x292d17[_0xf3b5('0x33')]=qs[_0xf3b5('0x34')](_0x1d09b0[_0xf3b5('0x2b')][_0xf3b5('0x34')]);_0x292d17['where']=qs[_0xf3b5('0x2d')](_[_0xf3b5('0x35')](_0x1d09b0['query'],_0x1b6c99[_0xf3b5('0x2d')]),_0x7ae54);if(_0x1d09b0[_0xf3b5('0x2b')][_0xf3b5('0x36')]){_0x292d17[_0xf3b5('0x37')]=_['merge'](_0x292d17['where'],{'$or':_[_0xf3b5('0x25')](_0x7ae54,function(_0x4fa878){if(_0x4fa878[_0xf3b5('0x29')]!==_0xf3b5('0x38')){var _0x1e5659={};_0x1e5659[_0x4fa878[_0xf3b5('0x22')]]={'$like':'%'+_0x1d09b0['query']['filter']+'%'};return _0x1e5659;}})});}_0x292d17=_[_0xf3b5('0x39')]({},_0x292d17,_0x1d09b0['options']);var _0x5b2dca={'where':_0x292d17[_0xf3b5('0x37')]};return db['SquareRecording'][_0xf3b5('0x18')](_0x5b2dca)[_0xf3b5('0x20')](function(_0x1ec9c4){_0x58c652[_0xf3b5('0x18')]=_0x1ec9c4;if(_0x1d09b0[_0xf3b5('0x2b')][_0xf3b5('0x3a')]){_0x292d17[_0xf3b5('0x3b')]=[{'all':!![]}];}return db['SquareRecording'][_0xf3b5('0x3c')](_0x292d17);})[_0xf3b5('0x20')](function(_0x4d52de){_0x58c652[_0xf3b5('0x3d')]=_0x4d52de;return _0x58c652;})['then'](respondWithFilteredResult(_0x4214e2,_0x292d17))['catch'](handleError(_0x4214e2,null));};exports['show']=function(_0x26f5c2,_0x13c462){var _0x407fea={'raw':!![],'where':{'id':_0x26f5c2['params']['id']}},_0x520a06={};_0x520a06[_0xf3b5('0x2a')]=_[_0xf3b5('0x2c')](db['SquareRecording'][_0xf3b5('0x27')]);_0x520a06['query']=_[_0xf3b5('0x2c')](_0x26f5c2[_0xf3b5('0x2b')]);_0x520a06[_0xf3b5('0x2d')]=_['intersection'](_0x520a06[_0xf3b5('0x2a')],_0x520a06['query']);_0x407fea[_0xf3b5('0x2f')]=_['intersection'](_0x520a06[_0xf3b5('0x2a')],qs[_0xf3b5('0x30')](_0x26f5c2[_0xf3b5('0x2b')][_0xf3b5('0x30')]));_0x407fea[_0xf3b5('0x2f')]=_0x407fea[_0xf3b5('0x2f')][_0xf3b5('0x3e')]?_0x407fea[_0xf3b5('0x2f')]:_0x520a06[_0xf3b5('0x2a')];if(_0x26f5c2['query']['includeAll']){_0x407fea['include']=[{'all':!![]}];}_0x407fea=_['merge']({},_0x407fea,_0x26f5c2[_0xf3b5('0x3f')]);return db['SquareRecording'][_0xf3b5('0x40')](_0x407fea)[_0xf3b5('0x20')](handleEntityNotFound(_0x13c462,null))['then'](respondWithResult(_0x13c462,null))[_0xf3b5('0x41')](handleError(_0x13c462,null));};exports[_0xf3b5('0x42')]=function(_0x3bf518,_0x588aee){return db[_0xf3b5('0x26')][_0xf3b5('0x42')](_0x3bf518[_0xf3b5('0x43')],{})[_0xf3b5('0x20')](respondWithResult(_0x588aee,0xc9))[_0xf3b5('0x41')](handleError(_0x588aee,null));};exports[_0xf3b5('0x1e')]=function(_0x1f743e,_0x5f4ea5){if(_0x1f743e[_0xf3b5('0x43')]['id']){delete _0x1f743e['body']['id'];}return db[_0xf3b5('0x26')][_0xf3b5('0x40')]({'where':{'id':_0x1f743e['params']['id']}})[_0xf3b5('0x20')](handleEntityNotFound(_0x5f4ea5,null))[_0xf3b5('0x20')](saveUpdates(_0x1f743e['body'],null))['then'](respondWithResult(_0x5f4ea5,null))['catch'](handleError(_0x5f4ea5,null));};exports[_0xf3b5('0x44')]=function(_0x3ca439,_0x548839,_0x5c7865){var _0x35029a=require('../../components/encryptor');var _0x2c6d5b=![];var _0x3d22c3={};if(_0x3ca439[_0xf3b5('0x2b')][_0xf3b5('0x29')]&&_0x3ca439[_0xf3b5('0x2b')][_0xf3b5('0x29')]===_0xf3b5('0x45')){_0x3d22c3[_0xf3b5('0x45')]=_0x3ca439[_0xf3b5('0x46')]['id'];}else{_0x3d22c3['id']=_0x3ca439[_0xf3b5('0x46')]['id'];}return db[_0xf3b5('0x26')]['find']({'where':_0x3d22c3,'attributes':['id',_0xf3b5('0x47'),_0xf3b5('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x548839,null))[_0xf3b5('0x20')](function(_0x4be61f){if(_0x4be61f){var _0x5dc791=_0x4be61f[_0xf3b5('0x47')];var _0x1181fc=util['format'](_0xf3b5('0x49'),_0x5dc791);if(fs[_0xf3b5('0x4a')](_0x1181fc)){_0x2c6d5b=!![];return _0x35029a[_0xf3b5('0x4b')](_0x1181fc,_0x5dc791,config['secrets'][_0xf3b5('0x4c')])[_0xf3b5('0x20')](function(){return _0x4be61f;});}return _0x4be61f;}})[_0xf3b5('0x20')](function(_0x260eae){if(_0x260eae){var _0x204f9c=_0x260eae[_0xf3b5('0x47')];if(!fs[_0xf3b5('0x4a')](_0x204f9c)){throw new db[(_0xf3b5('0x4d'))]['ValidationError'](_0xf3b5('0x4e'));}if(_0x260eae[_0xf3b5('0x48')]){return _0x548839[_0xf3b5('0x44')](_0x204f9c,_0x260eae[_0xf3b5('0x48')]+path['extname'](_0x204f9c),function(){if(_0x2c6d5b){fs[_0xf3b5('0x4f')](_0x204f9c);}});}else{return _0x548839['download'](_0x204f9c,function(_0x1eb2f3){if(_0x2c6d5b){fs[_0xf3b5('0x4f')](_0x204f9c);}});}}})[_0xf3b5('0x41')](function(_0x58c130){if(_0x58c130[_0xf3b5('0x50')]==='SquareRecording\x20not\x20found'){_0x548839[_0xf3b5('0x1a')](0x194)['send'](_0xf3b5('0x51'));}else{return handleError(_0x548839,null);}});};exports[_0xf3b5('0x1f')]=function(_0x2f7e6b,_0x3c0953){return db['SquareRecording']['find']({'where':{'id':_0x2f7e6b[_0xf3b5('0x46')]['id']}})[_0xf3b5('0x20')](function(_0x57f22a){if(_['isNil'](_0x57f22a)){throw new ReferenceError('Entity\x20not\x20found');}return _0x57f22a;})[_0xf3b5('0x20')](function(_0x4f926e){var _0x385103=_0x4f926e['savePath'];logger[_0xf3b5('0x52')](_0xf3b5('0x53'),_0x385103);if(!_['isNil'](_0x4f926e[_0xf3b5('0x47')])&&fs['existsSync'](_0x385103)){logger[_0xf3b5('0x52')](_0xf3b5('0x54')+_0x385103+_0xf3b5('0x55'));fs[_0xf3b5('0x56')](_0x385103);}_0x385103=_0x385103+_0xf3b5('0x57');if(!_[_0xf3b5('0x58')](_0x4f926e[_0xf3b5('0x47')])&&fs[_0xf3b5('0x4a')](_0x385103)){logger[_0xf3b5('0x52')](_0xf3b5('0x54')+_0x385103+_0xf3b5('0x55'));fs[_0xf3b5('0x56')](_0x385103);}return _0x4f926e;})['then'](function(_0xb2c5d6){if(!_0xb2c5d6)throw new InternalError();return _0xb2c5d6[_0xf3b5('0x1f')]();})[_0xf3b5('0x20')](function(){_0x3c0953[_0xf3b5('0x1a')](0xcc)['end']();})['catch'](handleError(_0x3c0953,null));}; \ No newline at end of file +var _0x5cc8=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','SquareRecording','fieldName','type','model','query','keys'];(function(_0x495c1d,_0x572c1b){var _0x537a6c=function(_0x321a67){while(--_0x321a67){_0x495c1d['push'](_0x495c1d['shift']());}};_0x537a6c(++_0x572c1b);}(_0x5cc8,0x1b9));var _0x85cc=function(_0x498365,_0xe2a6f2){_0x498365=_0x498365-0x0;var _0x37dfdf=_0x5cc8[_0x498365];return _0x37dfdf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85cc('0x0'));var zipdir=require(_0x85cc('0x1'));var jsonpatch=require(_0x85cc('0x2'));var rp=require(_0x85cc('0x3'));var moment=require(_0x85cc('0x4'));var BPromise=require(_0x85cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x85cc('0x6'));var sox=require('sox');var csv=require(_0x85cc('0x7'));var ejs=require(_0x85cc('0x8'));var fs=require('fs');var fs_extra=require(_0x85cc('0x9'));var _=require(_0x85cc('0xa'));var squel=require(_0x85cc('0xb'));var crypto=require(_0x85cc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x85cc('0xd'));var toCsv=require(_0x85cc('0x7'));var querystring=require(_0x85cc('0xe'));var Papa=require(_0x85cc('0xf'));var Redis=require(_0x85cc('0x10'));var authService=require(_0x85cc('0x11'));var qs=require(_0x85cc('0x12'));var as=require(_0x85cc('0x13'));var hardwareService=require(_0x85cc('0x14'));var logger=require('../../config/logger')(_0x85cc('0x15'));var utils=require(_0x85cc('0x16'));var config=require(_0x85cc('0x17'));var licenseUtil=require(_0x85cc('0x18'));var db=require(_0x85cc('0x19'))['db'];function respondWithStatusCode(_0x1d66d5,_0x27459a){_0x27459a=_0x27459a||0xcc;return function(_0x52900a){if(_0x52900a){return _0x1d66d5[_0x85cc('0x1a')](_0x27459a);}return _0x1d66d5[_0x85cc('0x1b')](_0x27459a)[_0x85cc('0x1c')]();};}function respondWithResult(_0x206e2a,_0x7143a6){_0x7143a6=_0x7143a6||0xc8;return function(_0x301716){if(_0x301716){return _0x206e2a['status'](_0x7143a6)[_0x85cc('0x1d')](_0x301716);}};}function respondWithFilteredResult(_0x148a82,_0x5a25a4){return function(_0x1c247b){if(_0x1c247b){var _0x59f147=typeof _0x5a25a4['offset']===_0x85cc('0x1e')&&typeof _0x5a25a4['limit']==='undefined';var _0x591e8f=_0x1c247b[_0x85cc('0x1f')];var _0x3f5c6c=_0x59f147?0x0:_0x5a25a4['offset'];var _0x5bbf6f=_0x59f147?_0x1c247b[_0x85cc('0x1f')]:_0x5a25a4['offset']+_0x5a25a4['limit'];var _0x1fdf80;if(_0x5bbf6f>=_0x591e8f){_0x5bbf6f=_0x591e8f;_0x1fdf80=0xc8;}else{_0x1fdf80=0xce;}_0x148a82[_0x85cc('0x1b')](_0x1fdf80);return _0x148a82[_0x85cc('0x20')](_0x85cc('0x21'),_0x3f5c6c+'-'+_0x5bbf6f+'/'+_0x591e8f)[_0x85cc('0x1d')](_0x1c247b);}return null;};}function patchUpdates(_0x52908e){return function(_0x5f1315){try{jsonpatch[_0x85cc('0x22')](_0x5f1315,_0x52908e,!![]);}catch(_0x2c7044){return BPromise[_0x85cc('0x23')](_0x2c7044);}return _0x5f1315[_0x85cc('0x24')]();};}function saveUpdates(_0x3f3803,_0x382acd){return function(_0x45b0b4){if(_0x45b0b4){return _0x45b0b4['update'](_0x3f3803)[_0x85cc('0x25')](function(_0x1ba7f4){return _0x1ba7f4;});}return null;};}function removeEntity(_0x55a706,_0x4f3748){return function(_0x152d03){if(_0x152d03){return _0x152d03['destroy']()[_0x85cc('0x25')](function(){_0x55a706[_0x85cc('0x1b')](0xcc)[_0x85cc('0x1c')]();});}};}function handleEntityNotFound(_0x59377d,_0x33676d){return function(_0x1828ed){if(!_0x1828ed){_0x59377d['sendStatus'](0x194);}return _0x1828ed;};}function handleError(_0x2553cd,_0x187419){_0x187419=_0x187419||0x1f4;return function(_0x12a3c7){logger['error'](_0x12a3c7[_0x85cc('0x26')]);if(_0x12a3c7[_0x85cc('0x27')]){delete _0x12a3c7['name'];}_0x2553cd[_0x85cc('0x1b')](_0x187419)[_0x85cc('0x28')](_0x12a3c7);};}exports[_0x85cc('0x29')]=function(_0x1e839a,_0x5b590b){var _0x2446a7={},_0x2beb13={},_0x354ce4={'count':0x0,'rows':[]};var _0x94e05f=_[_0x85cc('0x2a')](db[_0x85cc('0x2b')]['rawAttributes'],function(_0x117485){return{'name':_0x117485[_0x85cc('0x2c')],'type':_0x117485[_0x85cc('0x2d')]['key']};});_0x2beb13[_0x85cc('0x2e')]=_[_0x85cc('0x2a')](_0x94e05f,'name');_0x2beb13[_0x85cc('0x2f')]=_[_0x85cc('0x30')](_0x1e839a['query']);_0x2beb13[_0x85cc('0x31')]=_[_0x85cc('0x32')](_0x2beb13[_0x85cc('0x2e')],_0x2beb13['query']);_0x2446a7[_0x85cc('0x33')]=_[_0x85cc('0x32')](_0x2beb13[_0x85cc('0x2e')],qs[_0x85cc('0x34')](_0x1e839a[_0x85cc('0x2f')][_0x85cc('0x34')]));_0x2446a7[_0x85cc('0x33')]=_0x2446a7[_0x85cc('0x33')][_0x85cc('0x35')]?_0x2446a7[_0x85cc('0x33')]:_0x2beb13[_0x85cc('0x2e')];if(!_0x1e839a[_0x85cc('0x2f')][_0x85cc('0x36')](_0x85cc('0x37'))){_0x2446a7[_0x85cc('0x38')]=qs[_0x85cc('0x38')](_0x1e839a[_0x85cc('0x2f')][_0x85cc('0x38')]);_0x2446a7[_0x85cc('0x39')]=qs[_0x85cc('0x39')](_0x1e839a[_0x85cc('0x2f')][_0x85cc('0x39')]);}_0x2446a7[_0x85cc('0x3a')]=qs[_0x85cc('0x3b')](_0x1e839a['query'][_0x85cc('0x3b')]);_0x2446a7[_0x85cc('0x3c')]=qs['filters'](_['pick'](_0x1e839a[_0x85cc('0x2f')],_0x2beb13[_0x85cc('0x31')]),_0x94e05f);if(_0x1e839a['query'][_0x85cc('0x3d')]){_0x2446a7[_0x85cc('0x3c')]=_[_0x85cc('0x3e')](_0x2446a7[_0x85cc('0x3c')],{'$or':_[_0x85cc('0x2a')](_0x94e05f,function(_0x5d135c){if(_0x5d135c[_0x85cc('0x2d')]!=='VIRTUAL'){var _0x39aad2={};_0x39aad2[_0x5d135c[_0x85cc('0x27')]]={'$like':'%'+_0x1e839a[_0x85cc('0x2f')][_0x85cc('0x3d')]+'%'};return _0x39aad2;}})});}_0x2446a7=_[_0x85cc('0x3e')]({},_0x2446a7,_0x1e839a[_0x85cc('0x3f')]);var _0x318989={'where':_0x2446a7['where']};return db[_0x85cc('0x2b')]['count'](_0x318989)[_0x85cc('0x25')](function(_0x19d35f){_0x354ce4[_0x85cc('0x1f')]=_0x19d35f;if(_0x1e839a[_0x85cc('0x2f')][_0x85cc('0x40')]){_0x2446a7[_0x85cc('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0x85cc('0x42')](_0x2446a7);})[_0x85cc('0x25')](function(_0x5e982d){_0x354ce4[_0x85cc('0x43')]=_0x5e982d;return _0x354ce4;})[_0x85cc('0x25')](respondWithFilteredResult(_0x5b590b,_0x2446a7))[_0x85cc('0x44')](handleError(_0x5b590b,null));};exports[_0x85cc('0x45')]=function(_0x16afae,_0x1d1605){var _0x4e5784={'raw':!![],'where':{'id':_0x16afae[_0x85cc('0x46')]['id']}},_0x4d5f61={};_0x4d5f61[_0x85cc('0x2e')]=_[_0x85cc('0x30')](db[_0x85cc('0x2b')][_0x85cc('0x47')]);_0x4d5f61[_0x85cc('0x2f')]=_[_0x85cc('0x30')](_0x16afae[_0x85cc('0x2f')]);_0x4d5f61[_0x85cc('0x31')]=_[_0x85cc('0x32')](_0x4d5f61['model'],_0x4d5f61[_0x85cc('0x2f')]);_0x4e5784[_0x85cc('0x33')]=_['intersection'](_0x4d5f61[_0x85cc('0x2e')],qs[_0x85cc('0x34')](_0x16afae['query'][_0x85cc('0x34')]));_0x4e5784[_0x85cc('0x33')]=_0x4e5784['attributes'][_0x85cc('0x35')]?_0x4e5784[_0x85cc('0x33')]:_0x4d5f61[_0x85cc('0x2e')];if(_0x16afae[_0x85cc('0x2f')]['includeAll']){_0x4e5784[_0x85cc('0x41')]=[{'all':!![]}];}_0x4e5784=_[_0x85cc('0x3e')]({},_0x4e5784,_0x16afae[_0x85cc('0x3f')]);return db['SquareRecording'][_0x85cc('0x48')](_0x4e5784)[_0x85cc('0x25')](handleEntityNotFound(_0x1d1605,null))[_0x85cc('0x25')](respondWithResult(_0x1d1605,null))[_0x85cc('0x44')](handleError(_0x1d1605,null));};exports[_0x85cc('0x49')]=function(_0x352aeb,_0x555894){return db[_0x85cc('0x2b')][_0x85cc('0x49')](_0x352aeb[_0x85cc('0x4a')],{})[_0x85cc('0x25')](respondWithResult(_0x555894,0xc9))[_0x85cc('0x44')](handleError(_0x555894,null));};exports[_0x85cc('0x4b')]=function(_0x4bb18d,_0xb25f41){if(_0x4bb18d[_0x85cc('0x4a')]['id']){delete _0x4bb18d[_0x85cc('0x4a')]['id'];}return db[_0x85cc('0x2b')]['find']({'where':{'id':_0x4bb18d['params']['id']}})['then'](handleEntityNotFound(_0xb25f41,null))[_0x85cc('0x25')](saveUpdates(_0x4bb18d[_0x85cc('0x4a')],null))['then'](respondWithResult(_0xb25f41,null))[_0x85cc('0x44')](handleError(_0xb25f41,null));};exports[_0x85cc('0x4c')]=function(_0x55f17a,_0x5eb7f3,_0x6a2d3){var _0x552fc4=require('../../components/encryptor');var _0x5e2bbb=![];var _0x46e0da={};if(_0x55f17a[_0x85cc('0x2f')][_0x85cc('0x2d')]&&_0x55f17a[_0x85cc('0x2f')]['type']===_0x85cc('0x4d')){_0x46e0da[_0x85cc('0x4d')]=_0x55f17a[_0x85cc('0x46')]['id'];}else{_0x46e0da['id']=_0x55f17a[_0x85cc('0x46')]['id'];}return db['SquareRecording'][_0x85cc('0x48')]({'where':_0x46e0da,'attributes':['id',_0x85cc('0x4e'),_0x85cc('0x4f')],'raw':!![]})[_0x85cc('0x25')](handleEntityNotFound(_0x5eb7f3,null))[_0x85cc('0x25')](function(_0x4f197a){if(_0x4f197a){var _0x5537c1=_0x4f197a[_0x85cc('0x4e')];var _0x34ec7b=util[_0x85cc('0x50')](_0x85cc('0x51'),_0x5537c1);if(fs[_0x85cc('0x52')](_0x34ec7b)){_0x5e2bbb=!![];return _0x552fc4[_0x85cc('0x53')](_0x34ec7b,_0x5537c1,config[_0x85cc('0x54')][_0x85cc('0x55')])[_0x85cc('0x25')](function(){return _0x4f197a;});}return _0x4f197a;}})[_0x85cc('0x25')](function(_0x13e3a7){if(_0x13e3a7){var _0x3fd972=_0x13e3a7[_0x85cc('0x4e')];if(!fs[_0x85cc('0x52')](_0x3fd972)){throw new db[(_0x85cc('0x56'))]['ValidationError'](_0x85cc('0x57'));}if(_0x13e3a7[_0x85cc('0x4f')]){return _0x5eb7f3['download'](_0x3fd972,_0x13e3a7[_0x85cc('0x4f')]+path[_0x85cc('0x58')](_0x3fd972),function(){if(_0x5e2bbb){fs[_0x85cc('0x59')](_0x3fd972);}});}else{return _0x5eb7f3[_0x85cc('0x4c')](_0x3fd972,function(_0x5f23c6){if(_0x5e2bbb){fs[_0x85cc('0x59')](_0x3fd972);}});}}})[_0x85cc('0x44')](function(_0x4edb19){if(_0x4edb19[_0x85cc('0x5a')]==='SquareRecording\x20not\x20found'){_0x5eb7f3[_0x85cc('0x1b')](0x194)[_0x85cc('0x28')]('Not\x20found');}else{return handleError(_0x5eb7f3,null);}});};exports[_0x85cc('0x5b')]=function(_0x5bdd9b,_0x22fd70){return db['SquareRecording'][_0x85cc('0x48')]({'where':{'id':_0x5bdd9b[_0x85cc('0x46')]['id']}})[_0x85cc('0x25')](function(_0x19b2c7){if(_[_0x85cc('0x5c')](_0x19b2c7)){throw new ReferenceError(_0x85cc('0x5d'));}return _0x19b2c7;})[_0x85cc('0x25')](function(_0x30fff7){var _0x3503da=_0x30fff7[_0x85cc('0x4e')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3503da);if(!_['isNil'](_0x30fff7[_0x85cc('0x4e')])&&fs[_0x85cc('0x52')](_0x3503da)){logger[_0x85cc('0x5e')](_0x85cc('0x5f')+_0x3503da+_0x85cc('0x60'));fs[_0x85cc('0x61')](_0x3503da);}_0x3503da=_0x3503da+'.cypher';if(!_[_0x85cc('0x5c')](_0x30fff7[_0x85cc('0x4e')])&&fs[_0x85cc('0x52')](_0x3503da)){logger['info'](_0x85cc('0x5f')+_0x3503da+_0x85cc('0x60'));fs[_0x85cc('0x61')](_0x3503da);}return _0x30fff7;})[_0x85cc('0x25')](function(_0x5051fa){if(!_0x5051fa)throw new InternalError();return _0x5051fa[_0x85cc('0x5b')]();})[_0x85cc('0x25')](function(){_0x22fd70[_0x85cc('0x1b')](0xcc)[_0x85cc('0x1c')]();})['catch'](handleError(_0x22fd70,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 25cd304..1363139 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 _0x41ec=['api','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util'];(function(_0x3724a2,_0x45bb68){var _0x2286fc=function(_0x1c4320){while(--_0x1c4320){_0x3724a2['push'](_0x3724a2['shift']());}};_0x2286fc(++_0x45bb68);}(_0x41ec,0x143));var _0xc41e=function(_0x424332,_0x32ebe2){_0x424332=_0x424332-0x0;var _0x2c40db=_0x41ec[_0x424332];return _0x2c40db;};'use strict';var _=require('lodash');var util=require(_0xc41e('0x0'));var logger=require('../../config/logger')(_0xc41e('0x1'));var moment=require(_0xc41e('0x2'));var BPromise=require('bluebird');var rp=require(_0xc41e('0x3'));var fs=require('fs');var path=require(_0xc41e('0x4'));var rimraf=require(_0xc41e('0x5'));var config=require(_0xc41e('0x6'));var attributes=require(_0xc41e('0x7'));module[_0xc41e('0x8')]=function(_0x3351e2,_0x92f7c){return _0x3351e2[_0xc41e('0x9')](_0xc41e('0xa'),attributes,{'tableName':_0xc41e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdc2=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1fab75,_0x983dd4){var _0x49a81e=function(_0x22cbeb){while(--_0x22cbeb){_0x1fab75['push'](_0x1fab75['shift']());}};_0x49a81e(++_0x983dd4);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x1491f7,_0x3dcd9f){_0x1491f7=_0x1491f7-0x0;var _0x4a58fb=_0xcdc2[_0x1491f7];return _0x4a58fb;};'use strict';var _=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var logger=require(_0x2cdc('0x2'))(_0x2cdc('0x3'));var moment=require(_0x2cdc('0x4'));var BPromise=require(_0x2cdc('0x5'));var rp=require(_0x2cdc('0x6'));var fs=require('fs');var path=require(_0x2cdc('0x7'));var rimraf=require(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var attributes=require(_0x2cdc('0xa'));module[_0x2cdc('0xb')]=function(_0x487c5e,_0x581345){return _0x487c5e[_0x2cdc('0xc')]('SquareRecording',attributes,{'tableName':_0x2cdc('0xd'),'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 6cdbd74..e744e4b 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 _0x730d=['../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x730d,0xab));var _0xd730=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x730d[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xd730('0x0'));var util=require(_0xd730('0x1'));var moment=require(_0xd730('0x2'));var BPromise=require(_0xd730('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd730('0x4'));var db=require(_0xd730('0x5'))['db'];var utils=require(_0xd730('0x6'));var logger=require(_0xd730('0x7'))(_0xd730('0x8'));var config=require(_0xd730('0x9'));var jayson=require(_0xd730('0xa'));var client=jayson[_0xd730('0xb')][_0xd730('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a7c41,_0x453eb6,_0x1d1a79){return new BPromise(function(_0x5362ef,_0x2565b5){return client[_0xd730('0xd')](_0x2a7c41,_0x1d1a79)['then'](function(_0x154654){logger[_0xd730('0xe')](_0xd730('0xf'),_0x453eb6,_0xd730('0x10'));logger[_0xd730('0x11')](_0xd730('0x12'),_0x453eb6,_0xd730('0x10'),JSON['stringify'](_0x154654));if(_0x154654[_0xd730('0x13')]){if(_0x154654[_0xd730('0x13')][_0xd730('0x14')]===0x1f4){logger[_0xd730('0x13')](_0xd730('0xf'),_0x453eb6,_0x154654[_0xd730('0x13')][_0xd730('0x15')]);return _0x2565b5(_0x154654['error']['message']);}logger['error'](_0xd730('0xf'),_0x453eb6,_0x154654[_0xd730('0x13')][_0xd730('0x15')]);return _0x5362ef(_0x154654[_0xd730('0x13')]['message']);}else{logger['info'](_0xd730('0xf'),_0x453eb6,'request\x20sent');_0x5362ef(_0x154654['result'][_0xd730('0x15')]);}})[_0xd730('0x16')](function(_0x29d5cd){logger['error']('SquareRecording,\x20%s,\x20%s',_0x453eb6,_0x29d5cd);_0x2565b5(_0x29d5cd);});});}exports[_0xd730('0x17')]=function(_0x2a7533){var _0xaf28a1=this;return new Promise(function(_0x193e26,_0x285b38){return db[_0xd730('0x18')][_0xd730('0x19')](_0x2a7533[_0xd730('0x1a')],{'raw':_0x2a7533['options']?_0x2a7533[_0xd730('0x1b')][_0xd730('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2b6f58){logger[_0xd730('0xe')](_0xd730('0x17'),_0x2a7533);logger[_0xd730('0x11')](_0xd730('0x17'),_0x2a7533,JSON[_0xd730('0x1d')](_0x2b6f58));_0x193e26(_0x2b6f58);})[_0xd730('0x16')](function(_0x5dabee){logger[_0xd730('0x13')](_0xd730('0x17'),_0x5dabee[_0xd730('0x15')],_0x2a7533);_0x285b38(_0xaf28a1['error'](0x1f4,_0x5dabee[_0xd730('0x15')]));});});}; \ No newline at end of file +var _0x920d=['code','SquareRecording,\x20%s,\x20%s','message','result','catch','body','options','raw','CreateSquareRecording','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error'];(function(_0x2c253c,_0xcaaf3d){var _0x550c8b=function(_0x1806c2){while(--_0x1806c2){_0x2c253c['push'](_0x2c253c['shift']());}};_0x550c8b(++_0xcaaf3d);}(_0x920d,0xb2));var _0xd920=function(_0x479a11,_0x107c32){_0x479a11=_0x479a11-0x0;var _0x4c44c8=_0x920d[_0x479a11];return _0x4c44c8;};'use strict';var _=require('lodash');var util=require(_0xd920('0x0'));var moment=require(_0xd920('0x1'));var BPromise=require(_0xd920('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd920('0x3'));var db=require(_0xd920('0x4'))['db'];var utils=require(_0xd920('0x5'));var logger=require(_0xd920('0x6'))(_0xd920('0x7'));var config=require(_0xd920('0x8'));var jayson=require(_0xd920('0x9'));var client=jayson[_0xd920('0xa')][_0xd920('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x143cb4,_0x3d6bdc,_0x16058c){return new BPromise(function(_0x5751af,_0x44e9c8){return client[_0xd920('0xc')](_0x143cb4,_0x16058c)[_0xd920('0xd')](function(_0x292c0c){logger[_0xd920('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3d6bdc,_0xd920('0xf'));logger['debug'](_0xd920('0x10'),_0x3d6bdc,'request\x20sent',JSON['stringify'](_0x292c0c));if(_0x292c0c['error']){if(_0x292c0c[_0xd920('0x11')][_0xd920('0x12')]===0x1f4){logger[_0xd920('0x11')](_0xd920('0x13'),_0x3d6bdc,_0x292c0c[_0xd920('0x11')]['message']);return _0x44e9c8(_0x292c0c[_0xd920('0x11')]['message']);}logger[_0xd920('0x11')](_0xd920('0x13'),_0x3d6bdc,_0x292c0c[_0xd920('0x11')][_0xd920('0x14')]);return _0x5751af(_0x292c0c[_0xd920('0x11')][_0xd920('0x14')]);}else{logger['info'](_0xd920('0x13'),_0x3d6bdc,_0xd920('0xf'));_0x5751af(_0x292c0c[_0xd920('0x15')]['message']);}})[_0xd920('0x16')](function(_0x3d62e6){logger[_0xd920('0x11')](_0xd920('0x13'),_0x3d6bdc,_0x3d62e6);_0x44e9c8(_0x3d62e6);});});}exports['CreateSquareRecording']=function(_0x47ae2b){var _0x4f5492=this;return new Promise(function(_0x5f00c0,_0x403b7b){return db['SquareRecording']['create'](_0x47ae2b[_0xd920('0x17')],{'raw':_0x47ae2b[_0xd920('0x18')]?_0x47ae2b[_0xd920('0x18')][_0xd920('0x19')]===undefined?!![]:![]:!![]})[_0xd920('0xd')](function(_0x3cfd76){logger[_0xd920('0xe')](_0xd920('0x1a'),_0x47ae2b);logger[_0xd920('0x1b')](_0xd920('0x1a'),_0x47ae2b,JSON['stringify'](_0x3cfd76));_0x5f00c0(_0x3cfd76);})[_0xd920('0x16')](function(_0xbb62b){logger[_0xd920('0x11')](_0xd920('0x1a'),_0xbb62b[_0xd920('0x14')],_0x47ae2b);_0x403b7b(_0x4f5492[_0xd920('0x11')](0x1f4,_0xbb62b[_0xd920('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1bcb879..bbcff7b 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x565fdc,_0x100574){var _0x78037c=function(_0x2da140){while(--_0x2da140){_0x565fdc['push'](_0x565fdc['shift']());}};_0x78037c(++_0x100574);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fec1614..c1eeef5 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 _0xfb46=['DATE','BOOLEAN','exports','STRING'];(function(_0xb0e151,_0x17ad50){var _0x11290e=function(_0x156f03){while(--_0x156f03){_0xb0e151['push'](_0xb0e151['shift']());}};_0x11290e(++_0x17ad50);}(_0xfb46,0x1ae));var _0x6fb4=function(_0x2bc7bc,_0x827ea){_0x2bc7bc=_0x2bc7bc-0x0;var _0xbae862=_0xfb46[_0x2bc7bc];return _0xbae862;};'use strict';var Sequelize=require('sequelize');module[_0x6fb4('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x6fb4('0x1')]},'request':{'type':Sequelize[_0x6fb4('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6fb4('0x1')]},'type':{'type':Sequelize[_0x6fb4('0x1')]},'uniqueid':{'type':Sequelize[_0x6fb4('0x1')]},'version':{'type':Sequelize[_0x6fb4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6fb4('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x6fb4('0x1')]},'callington':{'type':Sequelize[_0x6fb4('0x1')]},'callingtns':{'type':Sequelize[_0x6fb4('0x1')]},'dnid':{'type':Sequelize[_0x6fb4('0x1')]},'rdnis':{'type':Sequelize[_0x6fb4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6fb4('0x1')]},'priority':{'type':Sequelize[_0x6fb4('0x1')]},'enhanced':{'type':Sequelize[_0x6fb4('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x6fb4('0x1')]},'joinAt':{'type':Sequelize[_0x6fb4('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6fb4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3fc=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x449ba1,_0x4ad10c){var _0x51eef7=function(_0x109348){while(--_0x109348){_0x449ba1['push'](_0x449ba1['shift']());}};_0x51eef7(++_0x4ad10c);}(_0xf3fc,0x90));var _0xcf3f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf3fc[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xcf3f('0x0'));module[_0xcf3f('0x1')]={'network':{'type':Sequelize[_0xcf3f('0x2')]},'network_script':{'type':Sequelize[_0xcf3f('0x2')]},'request':{'type':Sequelize[_0xcf3f('0x2')]},'channel':{'type':Sequelize[_0xcf3f('0x2')]},'language':{'type':Sequelize[_0xcf3f('0x2')]},'type':{'type':Sequelize[_0xcf3f('0x2')]},'uniqueid':{'type':Sequelize[_0xcf3f('0x2')]},'version':{'type':Sequelize[_0xcf3f('0x2')]},'callerid':{'type':Sequelize[_0xcf3f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xcf3f('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xcf3f('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xcf3f('0x2')]},'rdnis':{'type':Sequelize[_0xcf3f('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xcf3f('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcf3f('0x2')]},'threadid':{'type':Sequelize[_0xcf3f('0x2')]},'project_name':{'type':Sequelize[_0xcf3f('0x2')]},'joinAt':{'type':Sequelize[_0xcf3f('0x3')]},'leaveAt':{'type':Sequelize[_0xcf3f('0x3')]},'bot':{'type':Sequelize[_0xcf3f('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 b7b49ff..58ea479 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 _0x3d78=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','SquareReport','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x2dd628,_0x3c22e4){var _0x2e138c=function(_0x12c4d){while(--_0x12c4d){_0x2dd628['push'](_0x2dd628['shift']());}};_0x2e138c(++_0x3c22e4);}(_0x3d78,0x172));var _0x83d7=function(_0x2e6a26,_0x4d74a2){_0x2e6a26=_0x2e6a26-0x0;var _0x361c57=_0x3d78[_0x2e6a26];return _0x361c57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83d7('0x0'));var zipdir=require(_0x83d7('0x1'));var jsonpatch=require(_0x83d7('0x2'));var rp=require('request-promise');var moment=require(_0x83d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x83d7('0x4'));var util=require('util');var path=require(_0x83d7('0x5'));var sox=require(_0x83d7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83d7('0x7'));var squel=require(_0x83d7('0x8'));var crypto=require('crypto');var jsforce=require(_0x83d7('0x9'));var deskjs=require(_0x83d7('0xa'));var toCsv=require(_0x83d7('0xb'));var querystring=require(_0x83d7('0xc'));var Papa=require(_0x83d7('0xd'));var Redis=require(_0x83d7('0xe'));var authService=require(_0x83d7('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83d7('0x10'));var logger=require('../../config/logger')(_0x83d7('0x11'));var utils=require(_0x83d7('0x12'));var config=require(_0x83d7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d20c7,_0x3748ea){_0x3748ea=_0x3748ea||0xcc;return function(_0xa5dc26){if(_0xa5dc26){return _0x5d20c7[_0x83d7('0x14')](_0x3748ea);}return _0x5d20c7[_0x83d7('0x15')](_0x3748ea)[_0x83d7('0x16')]();};}function respondWithResult(_0x4cc117,_0x456e71){_0x456e71=_0x456e71||0xc8;return function(_0x5ced67){if(_0x5ced67){return _0x4cc117['status'](_0x456e71)[_0x83d7('0x17')](_0x5ced67);}};}function respondWithFilteredResult(_0x1fc45e,_0x4426dd){return function(_0x34bfa2){if(_0x34bfa2){var _0x59a095=typeof _0x4426dd['offset']===_0x83d7('0x18')&&typeof _0x4426dd[_0x83d7('0x19')]===_0x83d7('0x18');var _0xb035d2=_0x34bfa2[_0x83d7('0x1a')];var _0x450f45=_0x59a095?0x0:_0x4426dd[_0x83d7('0x1b')];var _0x506ef5=_0x59a095?_0x34bfa2[_0x83d7('0x1a')]:_0x4426dd[_0x83d7('0x1b')]+_0x4426dd['limit'];var _0x3d5c95;if(_0x506ef5>=_0xb035d2){_0x506ef5=_0xb035d2;_0x3d5c95=0xc8;}else{_0x3d5c95=0xce;}_0x1fc45e[_0x83d7('0x15')](_0x3d5c95);return _0x1fc45e[_0x83d7('0x1c')](_0x83d7('0x1d'),_0x450f45+'-'+_0x506ef5+'/'+_0xb035d2)[_0x83d7('0x17')](_0x34bfa2);}return null;};}function patchUpdates(_0x334938){return function(_0x2a5a9f){try{jsonpatch[_0x83d7('0x1e')](_0x2a5a9f,_0x334938,!![]);}catch(_0x41511e){return BPromise[_0x83d7('0x1f')](_0x41511e);}return _0x2a5a9f[_0x83d7('0x20')]();};}function saveUpdates(_0x147566,_0x10a5ad){return function(_0x54cf5a){if(_0x54cf5a){return _0x54cf5a[_0x83d7('0x21')](_0x147566)[_0x83d7('0x22')](function(_0x4798e6){return _0x4798e6;});}return null;};}function removeEntity(_0xc28e0c,_0x465488){return function(_0x5b3b0b){if(_0x5b3b0b){return _0x5b3b0b[_0x83d7('0x23')]()[_0x83d7('0x22')](function(){_0xc28e0c[_0x83d7('0x15')](0xcc)[_0x83d7('0x16')]();});}};}function handleEntityNotFound(_0x74c397,_0x10e1d2){return function(_0x57d600){if(!_0x57d600){_0x74c397[_0x83d7('0x14')](0x194);}return _0x57d600;};}function handleError(_0x58cc6c,_0x44e17b){_0x44e17b=_0x44e17b||0x1f4;return function(_0xea622f){logger['error'](_0xea622f['stack']);if(_0xea622f[_0x83d7('0x24')]){delete _0xea622f['name'];}_0x58cc6c[_0x83d7('0x15')](_0x44e17b)['send'](_0xea622f);};}exports[_0x83d7('0x25')]=function(_0x493964,_0x356075){var _0x36ce75={},_0x2b40e8={},_0x52f2e4={'count':0x0,'rows':[]};var _0x43b936=_[_0x83d7('0x26')](db[_0x83d7('0x27')]['rawAttributes'],function(_0x3b8e57){return{'name':_0x3b8e57['fieldName'],'type':_0x3b8e57[_0x83d7('0x28')]['key']};});_0x2b40e8[_0x83d7('0x29')]=_[_0x83d7('0x26')](_0x43b936,'name');_0x2b40e8[_0x83d7('0x2a')]=_[_0x83d7('0x2b')](_0x493964['query']);_0x2b40e8[_0x83d7('0x2c')]=_[_0x83d7('0x2d')](_0x2b40e8[_0x83d7('0x29')],_0x2b40e8[_0x83d7('0x2a')]);_0x36ce75['attributes']=_[_0x83d7('0x2d')](_0x2b40e8[_0x83d7('0x29')],qs[_0x83d7('0x2e')](_0x493964[_0x83d7('0x2a')][_0x83d7('0x2e')]));_0x36ce75['attributes']=_0x36ce75[_0x83d7('0x2f')]['length']?_0x36ce75['attributes']:_0x2b40e8[_0x83d7('0x29')];if(!_0x493964[_0x83d7('0x2a')][_0x83d7('0x30')](_0x83d7('0x31'))){_0x36ce75[_0x83d7('0x19')]=qs['limit'](_0x493964[_0x83d7('0x2a')][_0x83d7('0x19')]);_0x36ce75[_0x83d7('0x1b')]=qs[_0x83d7('0x1b')](_0x493964[_0x83d7('0x2a')][_0x83d7('0x1b')]);}_0x36ce75[_0x83d7('0x32')]=qs[_0x83d7('0x33')](_0x493964[_0x83d7('0x2a')][_0x83d7('0x33')]);_0x36ce75[_0x83d7('0x34')]=qs[_0x83d7('0x2c')](_[_0x83d7('0x35')](_0x493964[_0x83d7('0x2a')],_0x2b40e8[_0x83d7('0x2c')]),_0x43b936);if(_0x493964[_0x83d7('0x2a')][_0x83d7('0x36')]){_0x36ce75[_0x83d7('0x34')]=_['merge'](_0x36ce75[_0x83d7('0x34')],{'$or':_[_0x83d7('0x26')](_0x43b936,function(_0x2fa12c){if(_0x2fa12c[_0x83d7('0x28')]!==_0x83d7('0x37')){var _0x139d2e={};_0x139d2e[_0x2fa12c['name']]={'$like':'%'+_0x493964['query'][_0x83d7('0x36')]+'%'};return _0x139d2e;}})});}_0x36ce75=_[_0x83d7('0x38')]({},_0x36ce75,_0x493964[_0x83d7('0x39')]);var _0xbbbf54={'where':_0x36ce75[_0x83d7('0x34')]};return db[_0x83d7('0x27')][_0x83d7('0x1a')](_0xbbbf54)[_0x83d7('0x22')](function(_0x5c358b){_0x52f2e4[_0x83d7('0x1a')]=_0x5c358b;if(_0x493964[_0x83d7('0x2a')][_0x83d7('0x3a')]){_0x36ce75[_0x83d7('0x3b')]=[{'all':!![]}];}return db[_0x83d7('0x27')]['findAll'](_0x36ce75);})['then'](function(_0x114e31){_0x52f2e4[_0x83d7('0x3c')]=_0x114e31;return _0x52f2e4;})['then'](respondWithFilteredResult(_0x356075,_0x36ce75))[_0x83d7('0x3d')](handleError(_0x356075,null));};exports[_0x83d7('0x3e')]=function(_0x30c7ba,_0xff9e10){var _0x3781e6={'raw':!![],'where':{'id':_0x30c7ba[_0x83d7('0x3f')]['id']}},_0x84c1bd={};_0x84c1bd['model']=_[_0x83d7('0x2b')](db[_0x83d7('0x27')][_0x83d7('0x40')]);_0x84c1bd[_0x83d7('0x2a')]=_[_0x83d7('0x2b')](_0x30c7ba[_0x83d7('0x2a')]);_0x84c1bd[_0x83d7('0x2c')]=_[_0x83d7('0x2d')](_0x84c1bd[_0x83d7('0x29')],_0x84c1bd[_0x83d7('0x2a')]);_0x3781e6[_0x83d7('0x2f')]=_['intersection'](_0x84c1bd[_0x83d7('0x29')],qs[_0x83d7('0x2e')](_0x30c7ba[_0x83d7('0x2a')]['fields']));_0x3781e6[_0x83d7('0x2f')]=_0x3781e6[_0x83d7('0x2f')][_0x83d7('0x41')]?_0x3781e6[_0x83d7('0x2f')]:_0x84c1bd[_0x83d7('0x29')];if(_0x30c7ba['query']['includeAll']){_0x3781e6[_0x83d7('0x3b')]=[{'all':!![]}];}_0x3781e6=_[_0x83d7('0x38')]({},_0x3781e6,_0x30c7ba[_0x83d7('0x39')]);return db[_0x83d7('0x27')][_0x83d7('0x42')](_0x3781e6)[_0x83d7('0x22')](handleEntityNotFound(_0xff9e10,null))[_0x83d7('0x22')](respondWithResult(_0xff9e10,null))[_0x83d7('0x3d')](handleError(_0xff9e10,null));};exports[_0x83d7('0x43')]=function(_0x394250,_0x2edead){return db[_0x83d7('0x27')][_0x83d7('0x43')](_0x394250[_0x83d7('0x44')],{})['then'](respondWithResult(_0x2edead,0xc9))[_0x83d7('0x3d')](handleError(_0x2edead,null));};exports[_0x83d7('0x21')]=function(_0x5862f1,_0x1a5bac){if(_0x5862f1[_0x83d7('0x44')]['id']){delete _0x5862f1[_0x83d7('0x44')]['id'];}return db[_0x83d7('0x27')][_0x83d7('0x42')]({'where':{'id':_0x5862f1[_0x83d7('0x3f')]['id']}})[_0x83d7('0x22')](handleEntityNotFound(_0x1a5bac,null))[_0x83d7('0x22')](saveUpdates(_0x5862f1[_0x83d7('0x44')],null))[_0x83d7('0x22')](respondWithResult(_0x1a5bac,null))['catch'](handleError(_0x1a5bac,null));};exports[_0x83d7('0x23')]=function(_0xe35ddf,_0x516e95){return db['SquareReport'][_0x83d7('0x42')]({'where':{'id':_0xe35ddf[_0x83d7('0x3f')]['id']}})[_0x83d7('0x22')](handleEntityNotFound(_0x516e95,null))[_0x83d7('0x22')](removeEntity(_0x516e95,null))[_0x83d7('0x3d')](handleError(_0x516e95,null));};exports[_0x83d7('0x45')]=function(_0x50fbcb,_0x7444e7){return db[_0x83d7('0x27')][_0x83d7('0x45')]()[_0x83d7('0x22')](respondWithResult(_0x7444e7,null))[_0x83d7('0x3d')](handleError(_0x7444e7,null));}; \ No newline at end of file +var _0x8dab=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SquareReport','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','type','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1adf4a,_0x15344f){var _0x4c9c68=function(_0x3ce1b8){while(--_0x3ce1b8){_0x1adf4a['push'](_0x1adf4a['shift']());}};_0x4c9c68(++_0x15344f);}(_0x8dab,0x11f));var _0xb8da=function(_0x42572b,_0x259433){_0x42572b=_0x42572b-0x0;var _0x4d50b3=_0x8dab[_0x42572b];return _0x4d50b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8da('0x0'));var zipdir=require(_0xb8da('0x1'));var jsonpatch=require(_0xb8da('0x2'));var rp=require(_0xb8da('0x3'));var moment=require(_0xb8da('0x4'));var BPromise=require(_0xb8da('0x5'));var Mustache=require(_0xb8da('0x6'));var util=require(_0xb8da('0x7'));var path=require('path');var sox=require(_0xb8da('0x8'));var csv=require(_0xb8da('0x9'));var ejs=require(_0xb8da('0xa'));var fs=require('fs');var fs_extra=require(_0xb8da('0xb'));var _=require(_0xb8da('0xc'));var squel=require(_0xb8da('0xd'));var crypto=require(_0xb8da('0xe'));var jsforce=require(_0xb8da('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8da('0x10'));var Papa=require('papaparse');var Redis=require(_0xb8da('0x11'));var authService=require(_0xb8da('0x12'));var qs=require(_0xb8da('0x13'));var as=require(_0xb8da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8da('0x15'))(_0xb8da('0x16'));var utils=require(_0xb8da('0x17'));var config=require(_0xb8da('0x18'));var licenseUtil=require(_0xb8da('0x19'));var db=require(_0xb8da('0x1a'))['db'];function respondWithStatusCode(_0x13ec18,_0x171750){_0x171750=_0x171750||0xcc;return function(_0x407881){if(_0x407881){return _0x13ec18['sendStatus'](_0x171750);}return _0x13ec18[_0xb8da('0x1b')](_0x171750)[_0xb8da('0x1c')]();};}function respondWithResult(_0x48ef20,_0x42bc31){_0x42bc31=_0x42bc31||0xc8;return function(_0x421ce7){if(_0x421ce7){return _0x48ef20['status'](_0x42bc31)[_0xb8da('0x1d')](_0x421ce7);}};}function respondWithFilteredResult(_0xe75be8,_0x4a489a){return function(_0x5e6209){if(_0x5e6209){var _0x3fab58=typeof _0x4a489a['offset']===_0xb8da('0x1e')&&typeof _0x4a489a[_0xb8da('0x1f')]===_0xb8da('0x1e');var _0x4ffef6=_0x5e6209[_0xb8da('0x20')];var _0x362943=_0x3fab58?0x0:_0x4a489a[_0xb8da('0x21')];var _0xe690bb=_0x3fab58?_0x5e6209[_0xb8da('0x20')]:_0x4a489a[_0xb8da('0x21')]+_0x4a489a['limit'];var _0x556537;if(_0xe690bb>=_0x4ffef6){_0xe690bb=_0x4ffef6;_0x556537=0xc8;}else{_0x556537=0xce;}_0xe75be8[_0xb8da('0x1b')](_0x556537);return _0xe75be8['set'](_0xb8da('0x22'),_0x362943+'-'+_0xe690bb+'/'+_0x4ffef6)[_0xb8da('0x1d')](_0x5e6209);}return null;};}function patchUpdates(_0x10e319){return function(_0x5f3be7){try{jsonpatch[_0xb8da('0x23')](_0x5f3be7,_0x10e319,!![]);}catch(_0x55dc84){return BPromise[_0xb8da('0x24')](_0x55dc84);}return _0x5f3be7[_0xb8da('0x25')]();};}function saveUpdates(_0x3aa767,_0x38b7df){return function(_0x54c5ec){if(_0x54c5ec){return _0x54c5ec[_0xb8da('0x26')](_0x3aa767)[_0xb8da('0x27')](function(_0x263ada){return _0x263ada;});}return null;};}function removeEntity(_0x5bc0c4,_0xe9e9d8){return function(_0xa3d54b){if(_0xa3d54b){return _0xa3d54b[_0xb8da('0x28')]()['then'](function(){_0x5bc0c4[_0xb8da('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba5aa9,_0xa6bd59){return function(_0x1e0699){if(!_0x1e0699){_0xba5aa9[_0xb8da('0x29')](0x194);}return _0x1e0699;};}function handleError(_0x58d736,_0x56af18){_0x56af18=_0x56af18||0x1f4;return function(_0x5c8d4a){logger[_0xb8da('0x2a')](_0x5c8d4a[_0xb8da('0x2b')]);if(_0x5c8d4a['name']){delete _0x5c8d4a[_0xb8da('0x2c')];}_0x58d736[_0xb8da('0x1b')](_0x56af18)[_0xb8da('0x2d')](_0x5c8d4a);};}exports[_0xb8da('0x2e')]=function(_0x77f3c1,_0x2c9c18){var _0x42e662={},_0x3362d7={},_0x4ec1e9={'count':0x0,'rows':[]};var _0x5d45bc=_['map'](db[_0xb8da('0x2f')][_0xb8da('0x30')],function(_0x264e0a){return{'name':_0x264e0a['fieldName'],'type':_0x264e0a['type'][_0xb8da('0x31')]};});_0x3362d7[_0xb8da('0x32')]=_[_0xb8da('0x33')](_0x5d45bc,_0xb8da('0x2c'));_0x3362d7[_0xb8da('0x34')]=_[_0xb8da('0x35')](_0x77f3c1[_0xb8da('0x34')]);_0x3362d7[_0xb8da('0x36')]=_[_0xb8da('0x37')](_0x3362d7['model'],_0x3362d7['query']);_0x42e662['attributes']=_['intersection'](_0x3362d7[_0xb8da('0x32')],qs[_0xb8da('0x38')](_0x77f3c1[_0xb8da('0x34')][_0xb8da('0x38')]));_0x42e662[_0xb8da('0x39')]=_0x42e662[_0xb8da('0x39')][_0xb8da('0x3a')]?_0x42e662[_0xb8da('0x39')]:_0x3362d7[_0xb8da('0x32')];if(!_0x77f3c1[_0xb8da('0x34')][_0xb8da('0x3b')]('nolimit')){_0x42e662['limit']=qs['limit'](_0x77f3c1[_0xb8da('0x34')][_0xb8da('0x1f')]);_0x42e662['offset']=qs[_0xb8da('0x21')](_0x77f3c1['query']['offset']);}_0x42e662[_0xb8da('0x3c')]=qs[_0xb8da('0x3d')](_0x77f3c1[_0xb8da('0x34')][_0xb8da('0x3d')]);_0x42e662['where']=qs[_0xb8da('0x36')](_[_0xb8da('0x3e')](_0x77f3c1[_0xb8da('0x34')],_0x3362d7[_0xb8da('0x36')]),_0x5d45bc);if(_0x77f3c1[_0xb8da('0x34')][_0xb8da('0x3f')]){_0x42e662['where']=_[_0xb8da('0x40')](_0x42e662[_0xb8da('0x41')],{'$or':_['map'](_0x5d45bc,function(_0x40b122){if(_0x40b122[_0xb8da('0x42')]!=='VIRTUAL'){var _0x124492={};_0x124492[_0x40b122[_0xb8da('0x2c')]]={'$like':'%'+_0x77f3c1[_0xb8da('0x34')][_0xb8da('0x3f')]+'%'};return _0x124492;}})});}_0x42e662=_['merge']({},_0x42e662,_0x77f3c1['options']);var _0x23432d={'where':_0x42e662[_0xb8da('0x41')]};return db[_0xb8da('0x2f')][_0xb8da('0x20')](_0x23432d)[_0xb8da('0x27')](function(_0x54793e){_0x4ec1e9[_0xb8da('0x20')]=_0x54793e;if(_0x77f3c1[_0xb8da('0x34')][_0xb8da('0x43')]){_0x42e662[_0xb8da('0x44')]=[{'all':!![]}];}return db[_0xb8da('0x2f')][_0xb8da('0x45')](_0x42e662);})[_0xb8da('0x27')](function(_0xbe625e){_0x4ec1e9[_0xb8da('0x46')]=_0xbe625e;return _0x4ec1e9;})[_0xb8da('0x27')](respondWithFilteredResult(_0x2c9c18,_0x42e662))[_0xb8da('0x47')](handleError(_0x2c9c18,null));};exports[_0xb8da('0x48')]=function(_0x2040e0,_0x357e24){var _0x59ded2={'raw':!![],'where':{'id':_0x2040e0[_0xb8da('0x49')]['id']}},_0x1e7715={};_0x1e7715[_0xb8da('0x32')]=_[_0xb8da('0x35')](db['SquareReport'][_0xb8da('0x30')]);_0x1e7715[_0xb8da('0x34')]=_['keys'](_0x2040e0[_0xb8da('0x34')]);_0x1e7715['filters']=_[_0xb8da('0x37')](_0x1e7715[_0xb8da('0x32')],_0x1e7715[_0xb8da('0x34')]);_0x59ded2[_0xb8da('0x39')]=_['intersection'](_0x1e7715[_0xb8da('0x32')],qs[_0xb8da('0x38')](_0x2040e0[_0xb8da('0x34')][_0xb8da('0x38')]));_0x59ded2['attributes']=_0x59ded2[_0xb8da('0x39')][_0xb8da('0x3a')]?_0x59ded2[_0xb8da('0x39')]:_0x1e7715['model'];if(_0x2040e0[_0xb8da('0x34')][_0xb8da('0x43')]){_0x59ded2[_0xb8da('0x44')]=[{'all':!![]}];}_0x59ded2=_[_0xb8da('0x40')]({},_0x59ded2,_0x2040e0[_0xb8da('0x4a')]);return db['SquareReport']['find'](_0x59ded2)[_0xb8da('0x27')](handleEntityNotFound(_0x357e24,null))['then'](respondWithResult(_0x357e24,null))[_0xb8da('0x47')](handleError(_0x357e24,null));};exports['create']=function(_0x23a4d9,_0x1c28f8){return db[_0xb8da('0x2f')][_0xb8da('0x4b')](_0x23a4d9[_0xb8da('0x4c')],{})[_0xb8da('0x27')](respondWithResult(_0x1c28f8,0xc9))[_0xb8da('0x47')](handleError(_0x1c28f8,null));};exports['update']=function(_0x3b0c38,_0x4f9530){if(_0x3b0c38[_0xb8da('0x4c')]['id']){delete _0x3b0c38['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x3b0c38['params']['id']}})['then'](handleEntityNotFound(_0x4f9530,null))[_0xb8da('0x27')](saveUpdates(_0x3b0c38['body'],null))[_0xb8da('0x27')](respondWithResult(_0x4f9530,null))[_0xb8da('0x47')](handleError(_0x4f9530,null));};exports[_0xb8da('0x28')]=function(_0x52f170,_0x305fb4){return db[_0xb8da('0x2f')][_0xb8da('0x4d')]({'where':{'id':_0x52f170[_0xb8da('0x49')]['id']}})[_0xb8da('0x27')](handleEntityNotFound(_0x305fb4,null))[_0xb8da('0x27')](removeEntity(_0x305fb4,null))[_0xb8da('0x47')](handleError(_0x305fb4,null));};exports['describe']=function(_0x39a780,_0x49624f){return db['SquareReport'][_0xb8da('0x4e')]()[_0xb8da('0x27')](respondWithResult(_0x49624f,null))['catch'](handleError(_0x49624f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c700f20..c5c4235 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 _0x24dd=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3615ec,_0x118524){var _0x2678c4=function(_0x3f7f66){while(--_0x3f7f66){_0x3615ec['push'](_0x3615ec['shift']());}};_0x2678c4(++_0x118524);}(_0x24dd,0x6f));var _0xd24d=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x24dd[_0x3b90ab];return _0x206e92;};'use strict';var _=require(_0xd24d('0x0'));var util=require(_0xd24d('0x1'));var logger=require(_0xd24d('0x2'))(_0xd24d('0x3'));var moment=require('moment');var BPromise=require(_0xd24d('0x4'));var rp=require(_0xd24d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd24d('0x6'));var config=require(_0xd24d('0x7'));var attributes=require(_0xd24d('0x8'));module[_0xd24d('0x9')]=function(_0x181d33,_0x4de5ec){return _0x181d33[_0xd24d('0xa')](_0xd24d('0xb'),attributes,{'tableName':_0xd24d('0xc'),'paranoid':![],'indexes':[{'name':_0xd24d('0xd'),'fields':[_0xd24d('0xe'),_0xd24d('0xf')]},{'name':_0xd24d('0x10'),'fields':[_0xd24d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3489=['request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x3489,0x1db));var _0x9348=function(_0x1765f0,_0x468ec5){_0x1765f0=_0x1765f0-0x0;var _0x4f23da=_0x3489[_0x1765f0];return _0x4f23da;};'use strict';var _=require(_0x9348('0x0'));var util=require('util');var logger=require(_0x9348('0x1'))(_0x9348('0x2'));var moment=require(_0x9348('0x3'));var BPromise=require(_0x9348('0x4'));var rp=require(_0x9348('0x5'));var fs=require('fs');var path=require(_0x9348('0x6'));var rimraf=require(_0x9348('0x7'));var config=require(_0x9348('0x8'));var attributes=require(_0x9348('0x9'));module[_0x9348('0xa')]=function(_0x5dbf88,_0x1a9c5f){return _0x5dbf88[_0x9348('0xb')]('SquareReport',attributes,{'tableName':_0x9348('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x9348('0xd'),_0x9348('0xe')]},{'name':_0x9348('0xf'),'fields':[_0x9348('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 1ed0698..5a1032e 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 _0x4710=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareReport','SquareReport','body','options','catch','UpdateSquareReport','update','raw','where','attributes','limit','lodash','util','moment'];(function(_0x350abe,_0x48eb45){var _0x59153f=function(_0x1e92d9){while(--_0x1e92d9){_0x350abe['push'](_0x350abe['shift']());}};_0x59153f(++_0x48eb45);}(_0x4710,0x1ce));var _0x0471=function(_0x195329,_0x2806e9){_0x195329=_0x195329-0x0;var _0x419984=_0x4710[_0x195329];return _0x419984;};'use strict';var _=require(_0x0471('0x0'));var util=require(_0x0471('0x1'));var moment=require(_0x0471('0x2'));var BPromise=require(_0x0471('0x3'));var rs=require(_0x0471('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0471('0x5'));var logger=require(_0x0471('0x6'))(_0x0471('0x7'));var config=require(_0x0471('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x246104,_0x102e82,_0x1a445c){return new BPromise(function(_0x42cf2d,_0x52844c){return client[_0x0471('0x9')](_0x246104,_0x1a445c)[_0x0471('0xa')](function(_0x22169c){logger[_0x0471('0xb')](_0x0471('0xc'),_0x102e82,_0x0471('0xd'));logger[_0x0471('0xe')](_0x0471('0xf'),_0x102e82,_0x0471('0xd'),JSON[_0x0471('0x10')](_0x22169c));if(_0x22169c[_0x0471('0x11')]){if(_0x22169c[_0x0471('0x11')][_0x0471('0x12')]===0x1f4){logger[_0x0471('0x11')](_0x0471('0xc'),_0x102e82,_0x22169c[_0x0471('0x11')][_0x0471('0x13')]);return _0x52844c(_0x22169c[_0x0471('0x11')]['message']);}logger[_0x0471('0x11')](_0x0471('0xc'),_0x102e82,_0x22169c[_0x0471('0x11')][_0x0471('0x13')]);return _0x42cf2d(_0x22169c[_0x0471('0x11')][_0x0471('0x13')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x102e82,_0x0471('0xd'));_0x42cf2d(_0x22169c['result'][_0x0471('0x13')]);}})['catch'](function(_0x54b208){logger[_0x0471('0x11')]('SquareReport,\x20%s,\x20%s',_0x102e82,_0x54b208);_0x52844c(_0x54b208);});});}exports[_0x0471('0x14')]=function(_0x509952){var _0x156234=this;return new Promise(function(_0x47e90a,_0x2c5bc7){return db[_0x0471('0x15')]['create'](_0x509952[_0x0471('0x16')],{'raw':_0x509952[_0x0471('0x17')]?_0x509952[_0x0471('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x29e93c){logger[_0x0471('0xb')](_0x0471('0x14'),_0x509952);logger[_0x0471('0xe')]('CreateSquareReport',_0x509952,JSON[_0x0471('0x10')](_0x29e93c));_0x47e90a(_0x29e93c);})[_0x0471('0x18')](function(_0x2e38c3){logger[_0x0471('0x11')]('CreateSquareReport',_0x2e38c3[_0x0471('0x13')],_0x509952);_0x2c5bc7(_0x156234[_0x0471('0x11')](0x1f4,_0x2e38c3[_0x0471('0x13')]));});});};exports[_0x0471('0x19')]=function(_0x31dcd2){var _0x536d2a=this;return new Promise(function(_0x503dc5,_0x3efb4f){return db[_0x0471('0x15')][_0x0471('0x1a')](_0x31dcd2[_0x0471('0x16')],{'raw':_0x31dcd2[_0x0471('0x17')]?_0x31dcd2[_0x0471('0x17')][_0x0471('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31dcd2['options']?_0x31dcd2['options'][_0x0471('0x1c')]||null:null,'attributes':_0x31dcd2['options']?_0x31dcd2[_0x0471('0x17')][_0x0471('0x1d')]||null:null,'limit':_0x31dcd2['options']?_0x31dcd2['options'][_0x0471('0x1e')]||null:null})[_0x0471('0xa')](function(_0x3f2a67){logger[_0x0471('0xb')](_0x0471('0x19'),_0x31dcd2);logger[_0x0471('0xe')]('UpdateSquareReport',_0x31dcd2,JSON['stringify'](_0x3f2a67));_0x503dc5(_0x3f2a67);})[_0x0471('0x18')](function(_0xa78c9f){logger[_0x0471('0x11')](_0x0471('0x19'),_0xa78c9f[_0x0471('0x13')],_0x31dcd2);_0x3efb4f(_0x536d2a[_0x0471('0x11')](0x1f4,_0xa78c9f[_0x0471('0x13')]));});});}; \ No newline at end of file +var _0x8b0b=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SquareReport','create','body','options','CreateSquareReport','catch','UpdateSquareReport','lodash','moment','bluebird'];(function(_0x32da1e,_0xa65be8){var _0x21713f=function(_0x87c07f){while(--_0x87c07f){_0x32da1e['push'](_0x32da1e['shift']());}};_0x21713f(++_0xa65be8);}(_0x8b0b,0xc8));var _0xb8b0=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x8b0b[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0xb8b0('0x0'));var util=require('util');var moment=require(_0xb8b0('0x1'));var BPromise=require(_0xb8b0('0x2'));var rs=require(_0xb8b0('0x3'));var fs=require('fs');var Redis=require(_0xb8b0('0x4'));var db=require(_0xb8b0('0x5'))['db'];var utils=require(_0xb8b0('0x6'));var logger=require('../../config/logger')(_0xb8b0('0x7'));var config=require(_0xb8b0('0x8'));var jayson=require(_0xb8b0('0x9'));var client=jayson[_0xb8b0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb157,_0x1c6659,_0x16fa54){return new BPromise(function(_0x2838df,_0x17874f){return client[_0xb8b0('0xb')](_0x2cb157,_0x16fa54)[_0xb8b0('0xc')](function(_0x2ed0e2){logger[_0xb8b0('0xd')](_0xb8b0('0xe'),_0x1c6659,_0xb8b0('0xf'));logger[_0xb8b0('0x10')](_0xb8b0('0x11'),_0x1c6659,'request\x20sent',JSON[_0xb8b0('0x12')](_0x2ed0e2));if(_0x2ed0e2[_0xb8b0('0x13')]){if(_0x2ed0e2['error']['code']===0x1f4){logger['error'](_0xb8b0('0xe'),_0x1c6659,_0x2ed0e2['error'][_0xb8b0('0x14')]);return _0x17874f(_0x2ed0e2[_0xb8b0('0x13')][_0xb8b0('0x14')]);}logger[_0xb8b0('0x13')]('SquareReport,\x20%s,\x20%s',_0x1c6659,_0x2ed0e2['error'][_0xb8b0('0x14')]);return _0x2838df(_0x2ed0e2[_0xb8b0('0x13')][_0xb8b0('0x14')]);}else{logger[_0xb8b0('0xd')](_0xb8b0('0xe'),_0x1c6659,_0xb8b0('0xf'));_0x2838df(_0x2ed0e2[_0xb8b0('0x15')][_0xb8b0('0x14')]);}})['catch'](function(_0x38c8ae){logger[_0xb8b0('0x13')](_0xb8b0('0xe'),_0x1c6659,_0x38c8ae);_0x17874f(_0x38c8ae);});});}exports['CreateSquareReport']=function(_0x5981a1){var _0x45b267=this;return new Promise(function(_0x23368e,_0x2353c2){return db[_0xb8b0('0x16')][_0xb8b0('0x17')](_0x5981a1[_0xb8b0('0x18')],{'raw':_0x5981a1[_0xb8b0('0x19')]?_0x5981a1[_0xb8b0('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb8b0('0xc')](function(_0x226cd7){logger[_0xb8b0('0xd')]('CreateSquareReport',_0x5981a1);logger['debug'](_0xb8b0('0x1a'),_0x5981a1,JSON['stringify'](_0x226cd7));_0x23368e(_0x226cd7);})[_0xb8b0('0x1b')](function(_0x455e42){logger[_0xb8b0('0x13')](_0xb8b0('0x1a'),_0x455e42[_0xb8b0('0x14')],_0x5981a1);_0x2353c2(_0x45b267[_0xb8b0('0x13')](0x1f4,_0x455e42['message']));});});};exports[_0xb8b0('0x1c')]=function(_0x260730){var _0x473952=this;return new Promise(function(_0xefbab9,_0x23211e){return db[_0xb8b0('0x16')]['update'](_0x260730[_0xb8b0('0x18')],{'raw':_0x260730['options']?_0x260730['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260730[_0xb8b0('0x19')]?_0x260730[_0xb8b0('0x19')]['where']||null:null,'attributes':_0x260730[_0xb8b0('0x19')]?_0x260730['options']['attributes']||null:null,'limit':_0x260730[_0xb8b0('0x19')]?_0x260730['options']['limit']||null:null})[_0xb8b0('0xc')](function(_0xb0009b){logger[_0xb8b0('0xd')](_0xb8b0('0x1c'),_0x260730);logger[_0xb8b0('0x10')](_0xb8b0('0x1c'),_0x260730,JSON[_0xb8b0('0x12')](_0xb0009b));_0xefbab9(_0xb0009b);})[_0xb8b0('0x1b')](function(_0x35868c){logger[_0xb8b0('0x13')]('UpdateSquareReport',_0x35868c[_0xb8b0('0x14')],_0x260730);_0x23211e(_0x473952['error'](0x1f4,_0x35868c[_0xb8b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1f20784..99dd7eb 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 _0x12b5=['get','isAuthenticated','index','describe','/:id','show','create','update','delete','destroy','exports','multer','path','Router','fs-extra','../../config/environment','./squareReportDetail.controller'];(function(_0x486a95,_0x18bed7){var _0x1cc0ec=function(_0x53a230){while(--_0x53a230){_0x486a95['push'](_0x486a95['shift']());}};_0x1cc0ec(++_0x18bed7);}(_0x12b5,0x170));var _0x512b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12b5[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x512b('0x0'));var util=require('util');var path=require(_0x512b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x512b('0x2')]();var fs_extra=require(_0x512b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x512b('0x4'));var controller=require(_0x512b('0x5'));router[_0x512b('0x6')]('/',auth[_0x512b('0x7')](),controller[_0x512b('0x8')]);router[_0x512b('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x512b('0x9')]);router[_0x512b('0x6')](_0x512b('0xa'),auth[_0x512b('0x7')](),controller[_0x512b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x512b('0xc')]);router['put'](_0x512b('0xa'),auth[_0x512b('0x7')](),controller[_0x512b('0xd')]);router[_0x512b('0xe')]('/:id',auth[_0x512b('0x7')](),controller[_0x512b('0xf')]);module[_0x512b('0x10')]=router; \ No newline at end of file +var _0x8f79=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','show','post','create','delete','/:id','destroy'];(function(_0x21d541,_0x1b5d3b){var _0x10f701=function(_0x4c8dde){while(--_0x4c8dde){_0x21d541['push'](_0x21d541['shift']());}};_0x10f701(++_0x1b5d3b);}(_0x8f79,0x168));var _0x98f7=function(_0x65cf17,_0x43f5b9){_0x65cf17=_0x65cf17-0x0;var _0x57f96e=_0x8f79[_0x65cf17];return _0x57f96e;};'use strict';var multer=require('multer');var util=require(_0x98f7('0x0'));var path=require(_0x98f7('0x1'));var timeout=require(_0x98f7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x98f7('0x3'));var auth=require(_0x98f7('0x4'));var interaction=require(_0x98f7('0x5'));var config=require(_0x98f7('0x6'));var controller=require(_0x98f7('0x7'));router[_0x98f7('0x8')]('/',auth[_0x98f7('0x9')](),controller[_0x98f7('0xa')]);router[_0x98f7('0x8')](_0x98f7('0xb'),auth[_0x98f7('0x9')](),controller['describe']);router[_0x98f7('0x8')]('/:id',auth[_0x98f7('0x9')](),controller[_0x98f7('0xc')]);router[_0x98f7('0xd')]('/',auth[_0x98f7('0x9')](),controller[_0x98f7('0xe')]);router['put']('/:id',auth[_0x98f7('0x9')](),controller['update']);router[_0x98f7('0xf')](_0x98f7('0x10'),auth['isAuthenticated'](),controller[_0x98f7('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index ca26594..4f7781a 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 _0x4179=['STRING','TEXT','sequelize','exports'];(function(_0x1ca471,_0x2e4ccb){var _0x142d31=function(_0x2d7012){while(--_0x2d7012){_0x1ca471['push'](_0x1ca471['shift']());}};_0x142d31(++_0x2e4ccb);}(_0x4179,0x82));var _0x9417=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x4179[_0xc5a279];return _0xc755d3;};'use strict';var Sequelize=require(_0x9417('0x0'));module[_0x9417('0x1')]={'uniqueid':{'type':Sequelize[_0x9417('0x2')]},'node':{'type':Sequelize[_0x9417('0x2')]},'application':{'type':Sequelize[_0x9417('0x2')]},'data':{'type':Sequelize[_0x9417('0x3')]},'project_name':{'type':Sequelize[_0x9417('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x062f=['STRING','TEXT','sequelize'];(function(_0x10c141,_0x865680){var _0x185e69=function(_0xdb1694){while(--_0xdb1694){_0x10c141['push'](_0x10c141['shift']());}};_0x185e69(++_0x865680);}(_0x062f,0xda));var _0xf062=function(_0x29f258,_0x559572){_0x29f258=_0x29f258-0x0;var _0x1315c7=_0x062f[_0x29f258];return _0x1315c7;};'use strict';var Sequelize=require(_0xf062('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf062('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xf062('0x1')]},'data':{'type':Sequelize[_0xf062('0x2')]},'project_name':{'type':Sequelize[_0xf062('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e72d01f..5597c69 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 _0x34cb=['send','index','map','SquareDetailsReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','where','merge','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../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','undefined','count','offset','set','reject','save','update','then','destroy','sendStatus','error','name'];(function(_0x38ab32,_0x3f9318){var _0x149145=function(_0x50e3eb){while(--_0x50e3eb){_0x38ab32['push'](_0x38ab32['shift']());}};_0x149145(++_0x3f9318);}(_0x34cb,0x177));var _0xb34c=function(_0x369f9f,_0x520a74){_0x369f9f=_0x369f9f-0x0;var _0x246590=_0x34cb[_0x369f9f];return _0x246590;};'use strict';var emlformat=require(_0xb34c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb34c('0x1'));var rp=require(_0xb34c('0x2'));var moment=require(_0xb34c('0x3'));var BPromise=require(_0xb34c('0x4'));var Mustache=require('mustache');var util=require(_0xb34c('0x5'));var path=require('path');var sox=require(_0xb34c('0x6'));var csv=require(_0xb34c('0x7'));var ejs=require(_0xb34c('0x8'));var fs=require('fs');var fs_extra=require(_0xb34c('0x9'));var _=require(_0xb34c('0xa'));var squel=require(_0xb34c('0xb'));var crypto=require(_0xb34c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb34c('0xd'));var toCsv=require(_0xb34c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb34c('0xe'));var qs=require(_0xb34c('0xf'));var as=require(_0xb34c('0x10'));var hardwareService=require(_0xb34c('0x11'));var logger=require(_0xb34c('0x12'))(_0xb34c('0x13'));var utils=require(_0xb34c('0x14'));var config=require(_0xb34c('0x15'));var licenseUtil=require(_0xb34c('0x16'));var db=require(_0xb34c('0x17'))['db'];function respondWithStatusCode(_0x2770d3,_0x18b444){_0x18b444=_0x18b444||0xcc;return function(_0x1554b0){if(_0x1554b0){return _0x2770d3['sendStatus'](_0x18b444);}return _0x2770d3[_0xb34c('0x18')](_0x18b444)[_0xb34c('0x19')]();};}function respondWithResult(_0x2f0ac2,_0x54fa68){_0x54fa68=_0x54fa68||0xc8;return function(_0x3a73af){if(_0x3a73af){return _0x2f0ac2[_0xb34c('0x18')](_0x54fa68)[_0xb34c('0x1a')](_0x3a73af);}};}function respondWithFilteredResult(_0x34b5c3,_0x17d6f3){return function(_0x59f9af){if(_0x59f9af){var _0x49570e=typeof _0x17d6f3['offset']===_0xb34c('0x1b')&&typeof _0x17d6f3['limit']===_0xb34c('0x1b');var _0x4aa7c9=_0x59f9af['count'];var _0x7bab13=_0x49570e?0x0:_0x17d6f3['offset'];var _0x270ad9=_0x49570e?_0x59f9af[_0xb34c('0x1c')]:_0x17d6f3[_0xb34c('0x1d')]+_0x17d6f3['limit'];var _0x1b073f;if(_0x270ad9>=_0x4aa7c9){_0x270ad9=_0x4aa7c9;_0x1b073f=0xc8;}else{_0x1b073f=0xce;}_0x34b5c3[_0xb34c('0x18')](_0x1b073f);return _0x34b5c3[_0xb34c('0x1e')]('Content-Range',_0x7bab13+'-'+_0x270ad9+'/'+_0x4aa7c9)[_0xb34c('0x1a')](_0x59f9af);}return null;};}function patchUpdates(_0x137475){return function(_0x265cb8){try{jsonpatch['apply'](_0x265cb8,_0x137475,!![]);}catch(_0x2e46c5){return BPromise[_0xb34c('0x1f')](_0x2e46c5);}return _0x265cb8[_0xb34c('0x20')]();};}function saveUpdates(_0x2d3e10,_0x4559ad){return function(_0x49a2d2){if(_0x49a2d2){return _0x49a2d2[_0xb34c('0x21')](_0x2d3e10)[_0xb34c('0x22')](function(_0xae7992){return _0xae7992;});}return null;};}function removeEntity(_0x3c19b4,_0x22ff3d){return function(_0x2d2777){if(_0x2d2777){return _0x2d2777[_0xb34c('0x23')]()[_0xb34c('0x22')](function(){_0x3c19b4[_0xb34c('0x18')](0xcc)[_0xb34c('0x19')]();});}};}function handleEntityNotFound(_0x2b0ca9,_0x665322){return function(_0x13b3a4){if(!_0x13b3a4){_0x2b0ca9[_0xb34c('0x24')](0x194);}return _0x13b3a4;};}function handleError(_0xe4eb77,_0xe00d8e){_0xe00d8e=_0xe00d8e||0x1f4;return function(_0x2a8450){logger[_0xb34c('0x25')](_0x2a8450['stack']);if(_0x2a8450[_0xb34c('0x26')]){delete _0x2a8450[_0xb34c('0x26')];}_0xe4eb77[_0xb34c('0x18')](_0xe00d8e)[_0xb34c('0x27')](_0x2a8450);};}exports[_0xb34c('0x28')]=function(_0x4648ea,_0x132dc4){var _0x567f1e={},_0x7caf16={},_0x225aad={'count':0x0,'rows':[]};var _0x153a6d=_[_0xb34c('0x29')](db[_0xb34c('0x2a')][_0xb34c('0x2b')],function(_0x375b5c){return{'name':_0x375b5c['fieldName'],'type':_0x375b5c[_0xb34c('0x2c')][_0xb34c('0x2d')]};});_0x7caf16['model']=_['map'](_0x153a6d,_0xb34c('0x26'));_0x7caf16[_0xb34c('0x2e')]=_[_0xb34c('0x2f')](_0x4648ea[_0xb34c('0x2e')]);_0x7caf16[_0xb34c('0x30')]=_[_0xb34c('0x31')](_0x7caf16[_0xb34c('0x32')],_0x7caf16[_0xb34c('0x2e')]);_0x567f1e['attributes']=_['intersection'](_0x7caf16[_0xb34c('0x32')],qs[_0xb34c('0x33')](_0x4648ea['query'][_0xb34c('0x33')]));_0x567f1e['attributes']=_0x567f1e[_0xb34c('0x34')][_0xb34c('0x35')]?_0x567f1e[_0xb34c('0x34')]:_0x7caf16['model'];if(!_0x4648ea[_0xb34c('0x2e')]['hasOwnProperty']('nolimit')){_0x567f1e['limit']=qs[_0xb34c('0x36')](_0x4648ea[_0xb34c('0x2e')][_0xb34c('0x36')]);_0x567f1e['offset']=qs[_0xb34c('0x1d')](_0x4648ea[_0xb34c('0x2e')][_0xb34c('0x1d')]);}_0x567f1e[_0xb34c('0x37')]=qs['sort'](_0x4648ea[_0xb34c('0x2e')][_0xb34c('0x38')]);_0x567f1e[_0xb34c('0x39')]=qs[_0xb34c('0x30')](_['pick'](_0x4648ea['query'],_0x7caf16[_0xb34c('0x30')]),_0x153a6d);if(_0x4648ea[_0xb34c('0x2e')]['filter']){_0x567f1e[_0xb34c('0x39')]=_[_0xb34c('0x3a')](_0x567f1e[_0xb34c('0x39')],{'$or':_[_0xb34c('0x29')](_0x153a6d,function(_0x169991){if(_0x169991[_0xb34c('0x2c')]!=='VIRTUAL'){var _0x147fac={};_0x147fac[_0x169991['name']]={'$like':'%'+_0x4648ea['query']['filter']+'%'};return _0x147fac;}})});}_0x567f1e=_['merge']({},_0x567f1e,_0x4648ea[_0xb34c('0x3b')]);var _0x33edc9={'where':_0x567f1e[_0xb34c('0x39')]};return db[_0xb34c('0x2a')][_0xb34c('0x1c')](_0x33edc9)[_0xb34c('0x22')](function(_0x13689d){_0x225aad[_0xb34c('0x1c')]=_0x13689d;if(_0x4648ea[_0xb34c('0x2e')][_0xb34c('0x3c')]){_0x567f1e[_0xb34c('0x3d')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x567f1e);})['then'](function(_0x29d0c2){_0x225aad[_0xb34c('0x3e')]=_0x29d0c2;return _0x225aad;})[_0xb34c('0x22')](respondWithFilteredResult(_0x132dc4,_0x567f1e))[_0xb34c('0x3f')](handleError(_0x132dc4,null));};exports['show']=function(_0x3df4e2,_0x2b07f4){var _0x4f8cc6={'raw':!![],'where':{'id':_0x3df4e2[_0xb34c('0x40')]['id']}},_0x41ce4e={};_0x41ce4e[_0xb34c('0x32')]=_['keys'](db[_0xb34c('0x2a')][_0xb34c('0x2b')]);_0x41ce4e[_0xb34c('0x2e')]=_['keys'](_0x3df4e2[_0xb34c('0x2e')]);_0x41ce4e[_0xb34c('0x30')]=_[_0xb34c('0x31')](_0x41ce4e[_0xb34c('0x32')],_0x41ce4e[_0xb34c('0x2e')]);_0x4f8cc6['attributes']=_[_0xb34c('0x31')](_0x41ce4e[_0xb34c('0x32')],qs[_0xb34c('0x33')](_0x3df4e2[_0xb34c('0x2e')][_0xb34c('0x33')]));_0x4f8cc6['attributes']=_0x4f8cc6[_0xb34c('0x34')]['length']?_0x4f8cc6['attributes']:_0x41ce4e[_0xb34c('0x32')];if(_0x3df4e2[_0xb34c('0x2e')][_0xb34c('0x3c')]){_0x4f8cc6[_0xb34c('0x3d')]=[{'all':!![]}];}_0x4f8cc6=_[_0xb34c('0x3a')]({},_0x4f8cc6,_0x3df4e2[_0xb34c('0x3b')]);return db['SquareDetailsReport'][_0xb34c('0x41')](_0x4f8cc6)['then'](handleEntityNotFound(_0x2b07f4,null))[_0xb34c('0x22')](respondWithResult(_0x2b07f4,null))[_0xb34c('0x3f')](handleError(_0x2b07f4,null));};exports[_0xb34c('0x42')]=function(_0x466357,_0xc5e06a){return db[_0xb34c('0x2a')][_0xb34c('0x42')](_0x466357['body'],{})[_0xb34c('0x22')](respondWithResult(_0xc5e06a,0xc9))[_0xb34c('0x3f')](handleError(_0xc5e06a,null));};exports[_0xb34c('0x21')]=function(_0x2e0e5d,_0x5a2af1){if(_0x2e0e5d[_0xb34c('0x43')]['id']){delete _0x2e0e5d['body']['id'];}return db[_0xb34c('0x2a')]['find']({'where':{'id':_0x2e0e5d[_0xb34c('0x40')]['id']}})[_0xb34c('0x22')](handleEntityNotFound(_0x5a2af1,null))[_0xb34c('0x22')](saveUpdates(_0x2e0e5d['body'],null))['then'](respondWithResult(_0x5a2af1,null))['catch'](handleError(_0x5a2af1,null));};exports[_0xb34c('0x23')]=function(_0x5320a7,_0x319291){return db[_0xb34c('0x2a')][_0xb34c('0x41')]({'where':{'id':_0x5320a7[_0xb34c('0x40')]['id']}})[_0xb34c('0x22')](handleEntityNotFound(_0x319291,null))[_0xb34c('0x22')](removeEntity(_0x319291,null))[_0xb34c('0x3f')](handleError(_0x319291,null));};exports[_0xb34c('0x44')]=function(_0x50957f,_0x418279){return db[_0xb34c('0x2a')][_0xb34c('0x44')]()[_0xb34c('0x22')](respondWithResult(_0x418279,null))[_0xb34c('0x3f')](handleError(_0x418279,null));}; \ No newline at end of file +var _0x5b82=['fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','body','update','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','SquareDetailsReport'];(function(_0x2c7a5d,_0x56353f){var _0x3390ab=function(_0x56eba1){while(--_0x56eba1){_0x2c7a5d['push'](_0x2c7a5d['shift']());}};_0x3390ab(++_0x56353f);}(_0x5b82,0x69));var _0x25b8=function(_0x2cce4c,_0x1dfd1d){_0x2cce4c=_0x2cce4c-0x0;var _0x80f54d=_0x5b82[_0x2cce4c];return _0x80f54d;};'use strict';var emlformat=require(_0x25b8('0x0'));var rimraf=require(_0x25b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25b8('0x2'));var BPromise=require(_0x25b8('0x3'));var Mustache=require(_0x25b8('0x4'));var util=require('util');var path=require(_0x25b8('0x5'));var sox=require(_0x25b8('0x6'));var csv=require(_0x25b8('0x7'));var ejs=require(_0x25b8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25b8('0x9'));var squel=require(_0x25b8('0xa'));var crypto=require('crypto');var jsforce=require(_0x25b8('0xb'));var deskjs=require(_0x25b8('0xc'));var toCsv=require(_0x25b8('0x7'));var querystring=require(_0x25b8('0xd'));var Papa=require('papaparse');var Redis=require(_0x25b8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x25b8('0xf'));var as=require(_0x25b8('0x10'));var hardwareService=require(_0x25b8('0x11'));var logger=require(_0x25b8('0x12'))(_0x25b8('0x13'));var utils=require('../../config/utils');var config=require(_0x25b8('0x14'));var licenseUtil=require(_0x25b8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15da71,_0x1e0403){_0x1e0403=_0x1e0403||0xcc;return function(_0x4db96f){if(_0x4db96f){return _0x15da71[_0x25b8('0x16')](_0x1e0403);}return _0x15da71[_0x25b8('0x17')](_0x1e0403)[_0x25b8('0x18')]();};}function respondWithResult(_0x25de9a,_0x2ffdc6){_0x2ffdc6=_0x2ffdc6||0xc8;return function(_0x58e22d){if(_0x58e22d){return _0x25de9a['status'](_0x2ffdc6)[_0x25b8('0x19')](_0x58e22d);}};}function respondWithFilteredResult(_0x42d69b,_0x45fc58){return function(_0x4a85d2){if(_0x4a85d2){var _0x37fa8f=typeof _0x45fc58[_0x25b8('0x1a')]==='undefined'&&typeof _0x45fc58[_0x25b8('0x1b')]==='undefined';var _0x9c64d0=_0x4a85d2[_0x25b8('0x1c')];var _0x4f36eb=_0x37fa8f?0x0:_0x45fc58[_0x25b8('0x1a')];var _0x38fa44=_0x37fa8f?_0x4a85d2[_0x25b8('0x1c')]:_0x45fc58[_0x25b8('0x1a')]+_0x45fc58[_0x25b8('0x1b')];var _0x11937d;if(_0x38fa44>=_0x9c64d0){_0x38fa44=_0x9c64d0;_0x11937d=0xc8;}else{_0x11937d=0xce;}_0x42d69b[_0x25b8('0x17')](_0x11937d);return _0x42d69b[_0x25b8('0x1d')]('Content-Range',_0x4f36eb+'-'+_0x38fa44+'/'+_0x9c64d0)[_0x25b8('0x19')](_0x4a85d2);}return null;};}function patchUpdates(_0x55f9bd){return function(_0x3436e7){try{jsonpatch[_0x25b8('0x1e')](_0x3436e7,_0x55f9bd,!![]);}catch(_0x514b99){return BPromise['reject'](_0x514b99);}return _0x3436e7[_0x25b8('0x1f')]();};}function saveUpdates(_0xed203d,_0x34ef12){return function(_0x444a79){if(_0x444a79){return _0x444a79['update'](_0xed203d)[_0x25b8('0x20')](function(_0x511f34){return _0x511f34;});}return null;};}function removeEntity(_0x34d5ae,_0x258500){return function(_0x3ca083){if(_0x3ca083){return _0x3ca083[_0x25b8('0x21')]()[_0x25b8('0x20')](function(){_0x34d5ae[_0x25b8('0x17')](0xcc)[_0x25b8('0x18')]();});}};}function handleEntityNotFound(_0x159e0b,_0x4c0c14){return function(_0x2196c9){if(!_0x2196c9){_0x159e0b[_0x25b8('0x16')](0x194);}return _0x2196c9;};}function handleError(_0x19b320,_0x5662fe){_0x5662fe=_0x5662fe||0x1f4;return function(_0x1057ed){logger[_0x25b8('0x22')](_0x1057ed[_0x25b8('0x23')]);if(_0x1057ed['name']){delete _0x1057ed[_0x25b8('0x24')];}_0x19b320[_0x25b8('0x17')](_0x5662fe)[_0x25b8('0x25')](_0x1057ed);};}exports[_0x25b8('0x26')]=function(_0x509a32,_0x5b547a){var _0x19d020={},_0x58bf5d={},_0x2ea1d5={'count':0x0,'rows':[]};var _0x4273cc=_[_0x25b8('0x27')](db[_0x25b8('0x28')]['rawAttributes'],function(_0x17b0a7){return{'name':_0x17b0a7[_0x25b8('0x29')],'type':_0x17b0a7[_0x25b8('0x2a')][_0x25b8('0x2b')]};});_0x58bf5d[_0x25b8('0x2c')]=_[_0x25b8('0x27')](_0x4273cc,_0x25b8('0x24'));_0x58bf5d['query']=_['keys'](_0x509a32[_0x25b8('0x2d')]);_0x58bf5d[_0x25b8('0x2e')]=_['intersection'](_0x58bf5d[_0x25b8('0x2c')],_0x58bf5d[_0x25b8('0x2d')]);_0x19d020[_0x25b8('0x2f')]=_['intersection'](_0x58bf5d['model'],qs[_0x25b8('0x30')](_0x509a32['query'][_0x25b8('0x30')]));_0x19d020['attributes']=_0x19d020['attributes'][_0x25b8('0x31')]?_0x19d020[_0x25b8('0x2f')]:_0x58bf5d[_0x25b8('0x2c')];if(!_0x509a32[_0x25b8('0x2d')][_0x25b8('0x32')](_0x25b8('0x33'))){_0x19d020[_0x25b8('0x1b')]=qs[_0x25b8('0x1b')](_0x509a32[_0x25b8('0x2d')][_0x25b8('0x1b')]);_0x19d020[_0x25b8('0x1a')]=qs[_0x25b8('0x1a')](_0x509a32['query'][_0x25b8('0x1a')]);}_0x19d020[_0x25b8('0x34')]=qs[_0x25b8('0x35')](_0x509a32[_0x25b8('0x2d')][_0x25b8('0x35')]);_0x19d020['where']=qs['filters'](_[_0x25b8('0x36')](_0x509a32['query'],_0x58bf5d[_0x25b8('0x2e')]),_0x4273cc);if(_0x509a32['query'][_0x25b8('0x37')]){_0x19d020[_0x25b8('0x38')]=_[_0x25b8('0x39')](_0x19d020[_0x25b8('0x38')],{'$or':_['map'](_0x4273cc,function(_0x2fd79b){if(_0x2fd79b['type']!==_0x25b8('0x3a')){var _0x28feaa={};_0x28feaa[_0x2fd79b['name']]={'$like':'%'+_0x509a32['query'][_0x25b8('0x37')]+'%'};return _0x28feaa;}})});}_0x19d020=_[_0x25b8('0x39')]({},_0x19d020,_0x509a32[_0x25b8('0x3b')]);var _0x4408b9={'where':_0x19d020[_0x25b8('0x38')]};return db['SquareDetailsReport'][_0x25b8('0x1c')](_0x4408b9)['then'](function(_0x3c453a){_0x2ea1d5[_0x25b8('0x1c')]=_0x3c453a;if(_0x509a32['query'][_0x25b8('0x3c')]){_0x19d020[_0x25b8('0x3d')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x25b8('0x3e')](_0x19d020);})[_0x25b8('0x20')](function(_0x5cdb45){_0x2ea1d5[_0x25b8('0x3f')]=_0x5cdb45;return _0x2ea1d5;})[_0x25b8('0x20')](respondWithFilteredResult(_0x5b547a,_0x19d020))[_0x25b8('0x40')](handleError(_0x5b547a,null));};exports[_0x25b8('0x41')]=function(_0x248609,_0x5ac621){var _0x51f73d={'raw':!![],'where':{'id':_0x248609[_0x25b8('0x42')]['id']}},_0x404ed5={};_0x404ed5[_0x25b8('0x2c')]=_['keys'](db[_0x25b8('0x28')]['rawAttributes']);_0x404ed5[_0x25b8('0x2d')]=_[_0x25b8('0x43')](_0x248609['query']);_0x404ed5[_0x25b8('0x2e')]=_[_0x25b8('0x44')](_0x404ed5[_0x25b8('0x2c')],_0x404ed5[_0x25b8('0x2d')]);_0x51f73d[_0x25b8('0x2f')]=_[_0x25b8('0x44')](_0x404ed5[_0x25b8('0x2c')],qs[_0x25b8('0x30')](_0x248609[_0x25b8('0x2d')][_0x25b8('0x30')]));_0x51f73d[_0x25b8('0x2f')]=_0x51f73d[_0x25b8('0x2f')][_0x25b8('0x31')]?_0x51f73d[_0x25b8('0x2f')]:_0x404ed5['model'];if(_0x248609[_0x25b8('0x2d')][_0x25b8('0x3c')]){_0x51f73d[_0x25b8('0x3d')]=[{'all':!![]}];}_0x51f73d=_['merge']({},_0x51f73d,_0x248609['options']);return db[_0x25b8('0x28')][_0x25b8('0x45')](_0x51f73d)[_0x25b8('0x20')](handleEntityNotFound(_0x5ac621,null))[_0x25b8('0x20')](respondWithResult(_0x5ac621,null))['catch'](handleError(_0x5ac621,null));};exports['create']=function(_0xe9bd00,_0x206276){return db[_0x25b8('0x28')]['create'](_0xe9bd00[_0x25b8('0x46')],{})[_0x25b8('0x20')](respondWithResult(_0x206276,0xc9))['catch'](handleError(_0x206276,null));};exports[_0x25b8('0x47')]=function(_0x958d90,_0x1b8d3d){if(_0x958d90[_0x25b8('0x46')]['id']){delete _0x958d90[_0x25b8('0x46')]['id'];}return db[_0x25b8('0x28')][_0x25b8('0x45')]({'where':{'id':_0x958d90[_0x25b8('0x42')]['id']}})[_0x25b8('0x20')](handleEntityNotFound(_0x1b8d3d,null))[_0x25b8('0x20')](saveUpdates(_0x958d90['body'],null))[_0x25b8('0x20')](respondWithResult(_0x1b8d3d,null))['catch'](handleError(_0x1b8d3d,null));};exports['destroy']=function(_0x3ce2da,_0x2e2ee8){return db[_0x25b8('0x28')][_0x25b8('0x45')]({'where':{'id':_0x3ce2da[_0x25b8('0x42')]['id']}})[_0x25b8('0x20')](handleEntityNotFound(_0x2e2ee8,null))[_0x25b8('0x20')](removeEntity(_0x2e2ee8,null))[_0x25b8('0x40')](handleError(_0x2e2ee8,null));};exports[_0x25b8('0x48')]=function(_0x4cb1fa,_0x449d9a){return db['SquareDetailsReport']['describe']()[_0x25b8('0x20')](respondWithResult(_0x449d9a,null))[_0x25b8('0x40')](handleError(_0x449d9a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 34301d2..46bfd63 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 _0x3868=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x3e252e,_0x3657bf){var _0x364145=function(_0x4e26ed){while(--_0x4e26ed){_0x3e252e['push'](_0x3e252e['shift']());}};_0x364145(++_0x3657bf);}(_0x3868,0xeb));var _0x8386=function(_0x3d628f,_0x1ac87f){_0x3d628f=_0x3d628f-0x0;var _0x4923b4=_0x3868[_0x3d628f];return _0x4923b4;};'use strict';var _=require(_0x8386('0x0'));var util=require(_0x8386('0x1'));var logger=require(_0x8386('0x2'))(_0x8386('0x3'));var moment=require(_0x8386('0x4'));var BPromise=require(_0x8386('0x5'));var rp=require(_0x8386('0x6'));var fs=require('fs');var path=require(_0x8386('0x7'));var rimraf=require(_0x8386('0x8'));var config=require(_0x8386('0x9'));var attributes=require(_0x8386('0xa'));module[_0x8386('0xb')]=function(_0x2c21cf,_0x147a33){return _0x2c21cf[_0x8386('0xc')](_0x8386('0xd'),attributes,{'tableName':_0x8386('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd62=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x37cf4a,_0x75dc7f){var _0x146386=function(_0x439f7b){while(--_0x439f7b){_0x37cf4a['push'](_0x37cf4a['shift']());}};_0x146386(++_0x75dc7f);}(_0xdd62,0xd5));var _0x2dd6=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xdd62[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x2dd6('0x0'));var util=require(_0x2dd6('0x1'));var logger=require(_0x2dd6('0x2'))(_0x2dd6('0x3'));var moment=require(_0x2dd6('0x4'));var BPromise=require('bluebird');var rp=require(_0x2dd6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dd6('0x6'));var config=require(_0x2dd6('0x7'));var attributes=require(_0x2dd6('0x8'));module[_0x2dd6('0x9')]=function(_0x2a3051,_0x4236ec){return _0x2a3051[_0x2dd6('0xa')](_0x2dd6('0xb'),attributes,{'tableName':_0x2dd6('0xc'),'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 26c1e12..2af6163 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 _0x19e1=['create','body','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x19e1,0x163));var _0x119e=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0x19e1[_0x46d87a];return _0x115296;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});}exports[_0x119e('0x15')]=function(_0xb3375c){var _0x348ae3=this;return new Promise(function(_0xedc945,_0x2848fa){return db[_0x119e('0x16')][_0x119e('0x17')](_0xb3375c[_0x119e('0x18')],{'raw':_0xb3375c[_0x119e('0x19')]?_0xb3375c['options'][_0x119e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xd4c2d5){logger['info'](_0x119e('0x15'),_0xb3375c);logger[_0x119e('0xc')]('CreateSquareDetailsReport',_0xb3375c,JSON['stringify'](_0xd4c2d5));_0xedc945(_0xd4c2d5);})[_0x119e('0x14')](function(_0x29de19){logger[_0x119e('0xf')]('CreateSquareDetailsReport',_0x29de19['message'],_0xb3375c);_0x2848fa(_0x348ae3[_0x119e('0xf')](0x1f4,_0x29de19['message']));});});}; \ No newline at end of file +var _0x17a7=['debug','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x17a7,0xc2));var _0x717a=function(_0x1352f2,_0x9589a1){_0x1352f2=_0x1352f2-0x0;var _0x3012ea=_0x17a7[_0x1352f2];return _0x3012ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});}exports[_0x717a('0x11')]=function(_0x152e10){var _0x8b295=this;return new Promise(function(_0x45dc38,_0x2fe7a7){return db[_0x717a('0x12')][_0x717a('0x13')](_0x152e10[_0x717a('0x14')],{'raw':_0x152e10[_0x717a('0x15')]?_0x152e10['options']['raw']===undefined?!![]:![]:!![]})[_0x717a('0x8')](function(_0x1d7ebd){logger[_0x717a('0x9')](_0x717a('0x11'),_0x152e10);logger[_0x717a('0x16')](_0x717a('0x11'),_0x152e10,JSON[_0x717a('0xc')](_0x1d7ebd));_0x45dc38(_0x1d7ebd);})[_0x717a('0x17')](function(_0x4e95dc){logger[_0x717a('0xd')](_0x717a('0x11'),_0x4e95dc[_0x717a('0xf')],_0x152e10);_0x2fe7a7(_0x8b295[_0x717a('0xd')](0x1f4,_0x4e95dc[_0x717a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e6cc897..732891d 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 _0xfe04=['./system.controller','get','index','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service'];(function(_0x35425c,_0x235836){var _0xfb9b25=function(_0x2a0772){while(--_0x2a0772){_0x35425c['push'](_0x35425c['shift']());}};_0xfb9b25(++_0x235836);}(_0xfe04,0xa6));var _0x4fe0=function(_0x44f733,_0x30fd79){_0x44f733=_0x44f733-0x0;var _0x35b875=_0xfe04[_0x44f733];return _0x35b875;};'use strict';var express=require('express');var router=express[_0x4fe0('0x0')]();var auth=require(_0x4fe0('0x1'));var controller=require(_0x4fe0('0x2'));router[_0x4fe0('0x3')]('/',auth['isAuthenticated'](),controller[_0x4fe0('0x4')]);router['get'](_0x4fe0('0x5'),auth['isAuthenticated'](),controller[_0x4fe0('0x6')]);module[_0x4fe0('0x7')]=router; \ No newline at end of file +var _0x6ba4=['get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','./system.controller'];(function(_0x4be338,_0x390655){var _0x568f6a=function(_0x128636){while(--_0x128636){_0x4be338['push'](_0x4be338['shift']());}};_0x568f6a(++_0x390655);}(_0x6ba4,0x72));var _0x46ba=function(_0x335c05,_0x2b3e53){_0x335c05=_0x335c05-0x0;var _0x483463=_0x6ba4[_0x335c05];return _0x483463;};'use strict';var express=require(_0x46ba('0x0'));var router=express[_0x46ba('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x46ba('0x2'));router[_0x46ba('0x3')]('/',auth[_0x46ba('0x4')](),controller[_0x46ba('0x5')]);router['get'](_0x46ba('0x6'),auth[_0x46ba('0x4')](),controller[_0x46ba('0x7')]);module[_0x46ba('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 e46dff9..3cf364b 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 _0x7944=['Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','kill','SIGINT','systeminformation','child_process','exec','api','bluebird','lodash','error','inspect','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','length','indexOf'];(function(_0x2b4012,_0x900b6d){var _0xdaf578=function(_0x21c4ec){while(--_0x21c4ec){_0x2b4012['push'](_0x2b4012['shift']());}};_0xdaf578(++_0x900b6d);}(_0x7944,0x18b));var _0x4794=function(_0x3531d0,_0x2d7fa6){_0x3531d0=_0x3531d0-0x0;var _0x5edec8=_0x7944[_0x3531d0];return _0x5edec8;};'use strict';var info=require(_0x4794('0x0'));var exec=require(_0x4794('0x1'))[_0x4794('0x2')];var logger=require('../../config/logger')(_0x4794('0x3'));var util=require('util');var BPromise=require(_0x4794('0x4'));var _=require(_0x4794('0x5'));function handleError(_0x1bc595,_0x4ff452,_0x925f5){_0x4ff452=_0x4ff452||0x1f4;return function(_0x2fd300){logger[_0x4794('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x925f5,_0x4ff452,util[_0x4794('0x7')](_0x2fd300,{'showHidden':![],'depth':null}));delete _0x2fd300['name'];_0x1bc595[_0x4794('0x8')](_0x4ff452)[_0x4794('0x9')](_0x2fd300);};}exports[_0x4794('0xa')]=function(_0x2e735a,_0x2abaac){return info[_0x4794('0xb')]()[_0x4794('0xc')](function(_0x4bf74d){return _0x2abaac['status'](0xc8)[_0x4794('0xd')](_0x4bf74d);})[_0x4794('0xe')](function(_0x4d72c2){return _0x2abaac[_0x4794('0x8')](0x1f4)[_0x4794('0xd')](_0x4d72c2);});};exports[_0x4794('0xf')]=function(_0x407747,_0x2cd7d9){var _0x55d4be=[_0x4794('0x10')];return new BPromise(function(_0x2696cf,_0x3eaacd){return exec(util[_0x4794('0x11')](_0x4794('0x12'),_0x407747['params']['pid']),function(_0x1be2c7,_0x2d4545,_0x178a3d){if(_0x1be2c7){return _0x3eaacd(_0x1be2c7);}return _0x2696cf(_0x2d4545);});})['then'](function(_0x62f2de){var _0x29bdef=![];var _0x10c197=_0x62f2de['split'](/\n/);for(var _0x58d6e4=0x0,_0x181c52=_0x55d4be[_0x4794('0x13')];_0x58d6e4<_0x181c52,_0x29bdef===![];_0x58d6e4+=0x1){if(_0x62f2de[_0x4794('0x14')](_0x55d4be[_0x58d6e4])>=0x0){_0x29bdef=!![];}}if(!_0x29bdef){throw new Error(util[_0x4794('0x11')](_0x4794('0x15'),_0x407747[_0x4794('0x16')][_0x4794('0x17')]));}process[_0x4794('0x18')](_0x407747['params'][_0x4794('0x17')],_0x4794('0x19'));return _0x2cd7d9[_0x4794('0x8')](0xc8)[_0x4794('0xd')]({'message':util[_0x4794('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x407747[_0x4794('0x16')][_0x4794('0x17')])});})['catch'](handleError(_0x2cd7d9,null,_0x4794('0xf')));}; \ No newline at end of file +var _0x2dd1=['util','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','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api'];(function(_0x128239,_0x30a688){var _0x5543df=function(_0x251c03){while(--_0x251c03){_0x128239['push'](_0x128239['shift']());}};_0x5543df(++_0x30a688);}(_0x2dd1,0x1c7));var _0x12dd=function(_0x360c97,_0x1b492f){_0x360c97=_0x360c97-0x0;var _0x52f28f=_0x2dd1[_0x360c97];return _0x52f28f;};'use strict';var info=require(_0x12dd('0x0'));var exec=require(_0x12dd('0x1'))[_0x12dd('0x2')];var logger=require('../../config/logger')(_0x12dd('0x3'));var util=require(_0x12dd('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x51ae7f,_0x46c1c0,_0x108772){_0x46c1c0=_0x46c1c0||0x1f4;return function(_0x354e50){logger[_0x12dd('0x5')](_0x12dd('0x6'),_0x108772,_0x46c1c0,util[_0x12dd('0x7')](_0x354e50,{'showHidden':![],'depth':null}));delete _0x354e50[_0x12dd('0x8')];_0x51ae7f[_0x12dd('0x9')](_0x46c1c0)['send'](_0x354e50);};}exports[_0x12dd('0xa')]=function(_0xe7ed9d,_0x51b7b8){return info[_0x12dd('0xb')]()[_0x12dd('0xc')](function(_0x43d991){return _0x51b7b8[_0x12dd('0x9')](0xc8)[_0x12dd('0xd')](_0x43d991);})[_0x12dd('0xe')](function(_0x2f2e69){return _0x51b7b8[_0x12dd('0x9')](0x1f4)['json'](_0x2f2e69);});};exports[_0x12dd('0xf')]=function(_0x478935,_0x54a8a7){var _0x23c7f3=[_0x12dd('0x10')];return new BPromise(function(_0x5887a1,_0x2ff7fe){return exec(util[_0x12dd('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x478935[_0x12dd('0x12')]['pid']),function(_0x2888a4,_0x56f56c,_0x3e0567){if(_0x2888a4){return _0x2ff7fe(_0x2888a4);}return _0x5887a1(_0x56f56c);});})['then'](function(_0x5f0d46){var _0x310f45=![];var _0xa0d90a=_0x5f0d46[_0x12dd('0x13')](/\n/);for(var _0x28b5b6=0x0,_0xb412d1=_0x23c7f3[_0x12dd('0x14')];_0x28b5b6<_0xb412d1,_0x310f45===![];_0x28b5b6+=0x1){if(_0x5f0d46[_0x12dd('0x15')](_0x23c7f3[_0x28b5b6])>=0x0){_0x310f45=!![];}}if(!_0x310f45){throw new Error(util[_0x12dd('0x11')](_0x12dd('0x16'),_0x478935[_0x12dd('0x12')][_0x12dd('0x17')]));}process[_0x12dd('0x18')](_0x478935[_0x12dd('0x12')]['pid'],_0x12dd('0x19'));return _0x54a8a7[_0x12dd('0x9')](0xc8)[_0x12dd('0xd')]({'message':util['format'](_0x12dd('0x1a'),_0x478935[_0x12dd('0x12')][_0x12dd('0x17')])});})[_0x12dd('0xe')](handleError(_0x54a8a7,null,_0x12dd('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a9e9b30..cdbb131 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 _0x4bb2=['update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x4bb2,0x11c));var _0x24bb=function(_0x14ffc4,_0x219e22){_0x14ffc4=_0x14ffc4-0x0;var _0x557db9=_0x4bb2[_0x14ffc4];return _0x557db9;};'use strict';var multer=require(_0x24bb('0x0'));var util=require('util');var path=require(_0x24bb('0x1'));var timeout=require(_0x24bb('0x2'));var express=require(_0x24bb('0x3'));var router=express['Router']();var fs_extra=require(_0x24bb('0x4'));var auth=require(_0x24bb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x24bb('0x6'));var controller=require(_0x24bb('0x7'));router[_0x24bb('0x8')]('/',auth[_0x24bb('0x9')](),controller[_0x24bb('0xa')]);router[_0x24bb('0x8')](_0x24bb('0xb'),auth[_0x24bb('0x9')](),controller[_0x24bb('0xc')]);router[_0x24bb('0xd')]('/',auth[_0x24bb('0x9')](),controller[_0x24bb('0xe')]);router[_0x24bb('0xf')](_0x24bb('0xb'),auth[_0x24bb('0x9')](),controller[_0x24bb('0x10')]);router[_0x24bb('0x11')](_0x24bb('0xb'),auth[_0x24bb('0x9')](),controller[_0x24bb('0x12')]);module[_0x24bb('0x13')]=router; \ No newline at end of file +var _0x1a5a=['../../components/auth/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x51021f,_0x44af78){var _0xf2ebbf=function(_0x1c75bf){while(--_0x1c75bf){_0x51021f['push'](_0x51021f['shift']());}};_0xf2ebbf(++_0x44af78);}(_0x1a5a,0x1d5));var _0xa1a5=function(_0x184bfb,_0x37eace){_0x184bfb=_0x184bfb-0x0;var _0x54f44a=_0x1a5a[_0x184bfb];return _0x54f44a;};'use strict';var multer=require(_0xa1a5('0x0'));var util=require('util');var path=require(_0xa1a5('0x1'));var timeout=require(_0xa1a5('0x2'));var express=require(_0xa1a5('0x3'));var router=express[_0xa1a5('0x4')]();var fs_extra=require(_0xa1a5('0x5'));var auth=require(_0xa1a5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1a5('0x7'));var controller=require(_0xa1a5('0x8'));router[_0xa1a5('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1a5('0xa')]);router[_0xa1a5('0x9')](_0xa1a5('0xb'),auth[_0xa1a5('0xc')](),controller[_0xa1a5('0xd')]);router['post']('/',auth[_0xa1a5('0xc')](),controller[_0xa1a5('0xe')]);router[_0xa1a5('0xf')](_0xa1a5('0xb'),auth['isAuthenticated'](),controller[_0xa1a5('0x10')]);router[_0xa1a5('0x11')](_0xa1a5('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa1a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 4b36b05..7be6976 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 _0x9af1=['sequelize','exports','STRING','#0091EA'];(function(_0x43c62a,_0x125d82){var _0x367fb8=function(_0x163f52){while(--_0x163f52){_0x43c62a['push'](_0x43c62a['shift']());}};_0x367fb8(++_0x125d82);}(_0x9af1,0x68));var _0x19af=function(_0x4e86a3,_0xda2301){_0x4e86a3=_0x4e86a3-0x0;var _0x420a8f=_0x9af1[_0x4e86a3];return _0x420a8f;};'use strict';var Sequelize=require(_0x19af('0x0'));module[_0x19af('0x1')]={'name':{'type':Sequelize[_0x19af('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x19af('0x2')],'defaultValue':_0x19af('0x3')},'description':{'type':Sequelize[_0x19af('0x2')]}}; \ No newline at end of file +var _0x18c9=['#0091EA','sequelize','exports','STRING','name'];(function(_0xdb2a83,_0x52c59b){var _0x55d456=function(_0x32262e){while(--_0x32262e){_0xdb2a83['push'](_0xdb2a83['shift']());}};_0x55d456(++_0x52c59b);}(_0x18c9,0x13c));var _0x918c=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x18c9[_0x369151];return _0x4292d5;};'use strict';var Sequelize=require(_0x918c('0x0'));module[_0x918c('0x1')]={'name':{'type':Sequelize[_0x918c('0x2')],'unique':_0x918c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x918c('0x2')],'defaultValue':_0x918c('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 917accc..5e6db6a 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 _0x34e8=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','Tag','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','Tags','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x34e8,0x12c));var _0x834e=function(_0x326478,_0x45a0c0){_0x326478=_0x326478-0x0;var _0xc31734=_0x34e8[_0x326478];return _0xc31734;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){var _0x338636=_0x58f4fd['get']({'plain':!![]});var _0x24fcf7=_0x834e('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x24fcf7,'resourceId':_0x338636['id']}})[_0x834e('0x2a')](function(){return _0x58f4fd;});})['then'](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3db026,_0x2cc2eb){return function(_0x3cd928){if(!_0x3cd928){_0x3db026[_0x834e('0x1c')](0x194);}return _0x3cd928;};}function handleError(_0x491919,_0x510780){_0x510780=_0x510780||0x1f4;return function(_0x4dc64a){logger['error'](_0x4dc64a[_0x834e('0x2d')]);if(_0x4dc64a[_0x834e('0x2e')]){delete _0x4dc64a[_0x834e('0x2e')];}_0x491919['status'](_0x510780)[_0x834e('0x2f')](_0x4dc64a);};}exports[_0x834e('0x30')]=function(_0x1f3671,_0x1e026a){var _0x4551f5={},_0x390119={},_0x3d149d={'count':0x0,'rows':[]};var _0xfaf716=_[_0x834e('0x31')](db['Tag'][_0x834e('0x32')],function(_0x5cad11){return{'name':_0x5cad11[_0x834e('0x33')],'type':_0x5cad11[_0x834e('0x34')][_0x834e('0x35')]};});_0x390119[_0x834e('0x36')]=_[_0x834e('0x31')](_0xfaf716,_0x834e('0x2e'));_0x390119[_0x834e('0x37')]=_[_0x834e('0x38')](_0x1f3671[_0x834e('0x37')]);_0x390119[_0x834e('0x39')]=_['intersection'](_0x390119[_0x834e('0x36')],_0x390119[_0x834e('0x37')]);_0x4551f5[_0x834e('0x3a')]=_[_0x834e('0x3b')](_0x390119['model'],qs[_0x834e('0x3c')](_0x1f3671[_0x834e('0x37')]['fields']));_0x4551f5['attributes']=_0x4551f5['attributes'][_0x834e('0x3d')]?_0x4551f5[_0x834e('0x3a')]:_0x390119[_0x834e('0x36')];if(!_0x1f3671[_0x834e('0x37')][_0x834e('0x3e')](_0x834e('0x3f'))){_0x4551f5['limit']=qs[_0x834e('0x20')](_0x1f3671['query'][_0x834e('0x20')]);_0x4551f5[_0x834e('0x22')]=qs['offset'](_0x1f3671[_0x834e('0x37')][_0x834e('0x22')]);}_0x4551f5['order']=qs['sort'](_0x1f3671[_0x834e('0x37')][_0x834e('0x40')]);_0x4551f5[_0x834e('0x41')]=qs[_0x834e('0x39')](_[_0x834e('0x42')](_0x1f3671['query'],_0x390119[_0x834e('0x39')]),_0xfaf716);if(_0x1f3671['query']['filter']){_0x4551f5[_0x834e('0x41')]=_['merge'](_0x4551f5[_0x834e('0x41')],{'$or':_[_0x834e('0x31')](_0xfaf716,function(_0x16aea6){if(_0x16aea6[_0x834e('0x34')]!==_0x834e('0x43')){var _0x574ea8={};_0x574ea8[_0x16aea6[_0x834e('0x2e')]]={'$like':'%'+_0x1f3671[_0x834e('0x37')][_0x834e('0x44')]+'%'};return _0x574ea8;}})});}_0x4551f5=_['merge']({},_0x4551f5,_0x1f3671[_0x834e('0x45')]);var _0x16ac45={'where':_0x4551f5['where']};return db[_0x834e('0x46')]['count'](_0x16ac45)[_0x834e('0x2a')](function(_0x585335){_0x3d149d['count']=_0x585335;if(_0x1f3671['query'][_0x834e('0x47')]){_0x4551f5[_0x834e('0x48')]=[{'all':!![]}];}return db[_0x834e('0x46')][_0x834e('0x49')](_0x4551f5);})[_0x834e('0x2a')](function(_0x23feea){_0x3d149d[_0x834e('0x4a')]=_0x23feea;return _0x3d149d;})['then'](respondWithFilteredResult(_0x1e026a,_0x4551f5))[_0x834e('0x4b')](handleError(_0x1e026a,null));};exports['show']=function(_0x321efa,_0x540685){var _0x1df5b0={'raw':!![],'where':{'id':_0x321efa[_0x834e('0x4c')]['id']}},_0x5a5807={};_0x5a5807[_0x834e('0x36')]=_['keys'](db[_0x834e('0x46')][_0x834e('0x32')]);_0x5a5807[_0x834e('0x37')]=_[_0x834e('0x38')](_0x321efa[_0x834e('0x37')]);_0x5a5807[_0x834e('0x39')]=_[_0x834e('0x3b')](_0x5a5807[_0x834e('0x36')],_0x5a5807[_0x834e('0x37')]);_0x1df5b0[_0x834e('0x3a')]=_['intersection'](_0x5a5807[_0x834e('0x36')],qs[_0x834e('0x3c')](_0x321efa['query'][_0x834e('0x3c')]));_0x1df5b0[_0x834e('0x3a')]=_0x1df5b0[_0x834e('0x3a')][_0x834e('0x3d')]?_0x1df5b0[_0x834e('0x3a')]:_0x5a5807[_0x834e('0x36')];if(_0x321efa['query']['includeAll']){_0x1df5b0[_0x834e('0x48')]=[{'all':!![]}];}_0x1df5b0=_[_0x834e('0x4d')]({},_0x1df5b0,_0x321efa[_0x834e('0x45')]);return db[_0x834e('0x46')][_0x834e('0x4e')](_0x1df5b0)[_0x834e('0x2a')](handleEntityNotFound(_0x540685,null))[_0x834e('0x2a')](respondWithResult(_0x540685,null))[_0x834e('0x4b')](handleError(_0x540685,null));};exports[_0x834e('0x4f')]=function(_0x390c45,_0xf02f0d){return db[_0x834e('0x46')][_0x834e('0x4f')](_0x390c45[_0x834e('0x50')],{})[_0x834e('0x2a')](function(_0x1a3855){var _0x3df078=_0x390c45[_0x834e('0x51')][_0x834e('0x52')]({'plain':!![]});if(!_0x3df078)throw new Error(_0x834e('0x53'));if(_0x3df078['role']===_0x834e('0x51')){var _0x1f08b9=_0x1a3855['get']({'plain':!![]});var _0x3c00a3=_0x834e('0x2c');return db['UserProfileSection'][_0x834e('0x4e')]({'where':{'name':_0x3c00a3,'userProfileId':_0x3df078[_0x834e('0x54')]},'raw':!![]})[_0x834e('0x2a')](function(_0x35636e){if(_0x35636e&&_0x35636e[_0x834e('0x55')]===0x0){return db[_0x834e('0x56')][_0x834e('0x4f')]({'name':_0x1f08b9['name'],'resourceId':_0x1f08b9['id'],'type':_0x35636e[_0x834e('0x2e')],'sectionId':_0x35636e['id']},{})[_0x834e('0x2a')](function(){return _0x1a3855;});}else{return _0x1a3855;}})[_0x834e('0x4b')](function(_0x363675){logger[_0x834e('0x57')](_0x834e('0x58'),_0x363675);throw _0x363675;});}return _0x1a3855;})[_0x834e('0x2a')](respondWithResult(_0xf02f0d,0xc9))[_0x834e('0x4b')](handleError(_0xf02f0d,null));};exports['update']=function(_0x11778e,_0x4dc104){if(_0x11778e[_0x834e('0x50')]['id']){delete _0x11778e['body']['id'];}return db[_0x834e('0x46')]['find']({'where':{'id':_0x11778e['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4dc104,null))[_0x834e('0x2a')](saveUpdates(_0x11778e['body'],null))['then'](respondWithResult(_0x4dc104,null))[_0x834e('0x4b')](handleError(_0x4dc104,null));};exports[_0x834e('0x2b')]=function(_0x138ed2,_0x387365){return db[_0x834e('0x46')][_0x834e('0x4e')]({'where':{'id':_0x138ed2[_0x834e('0x4c')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x387365,null))['then'](removeEntity(_0x387365,null))[_0x834e('0x4b')](handleError(_0x387365,null));}; \ No newline at end of file +var _0xedd9=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','get','Tags','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x46e072,_0x13e36f){var _0x15d7ea=function(_0x436ca0){while(--_0x436ca0){_0x46e072['push'](_0x46e072['shift']());}};_0x15d7ea(++_0x13e36f);}(_0xedd9,0xfc));var _0x9edd=function(_0x7f6d73,_0x50ba11){_0x7f6d73=_0x7f6d73-0x0;var _0x5bfb43=_0xedd9[_0x7f6d73];return _0x5bfb43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){var _0xeaf55a=_0x339a0d[_0x9edd('0x22')]({'plain':!![]});var _0x2f9f86=_0x9edd('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f9f86,'resourceId':_0xeaf55a['id']}})[_0x9edd('0x21')](function(){return _0x339a0d;});})[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x3c2227,_0x4fe471){return function(_0x57a2cc){if(!_0x57a2cc){_0x3c2227[_0x9edd('0x18')](0x194);}return _0x57a2cc;};}function handleError(_0x257a26,_0x1c762c){_0x1c762c=_0x1c762c||0x1f4;return function(_0x52746a){logger[_0x9edd('0x25')](_0x52746a[_0x9edd('0x26')]);if(_0x52746a[_0x9edd('0x27')]){delete _0x52746a[_0x9edd('0x27')];}_0x257a26['status'](_0x1c762c)[_0x9edd('0x28')](_0x52746a);};}exports[_0x9edd('0x29')]=function(_0xbe87e1,_0x12c1bc){var _0xbbf08f={},_0x42e664={},_0x209aba={'count':0x0,'rows':[]};var _0x1fba7b=_[_0x9edd('0x2a')](db[_0x9edd('0x2b')][_0x9edd('0x2c')],function(_0x138002){return{'name':_0x138002[_0x9edd('0x2d')],'type':_0x138002[_0x9edd('0x2e')][_0x9edd('0x2f')]};});_0x42e664['model']=_[_0x9edd('0x2a')](_0x1fba7b,_0x9edd('0x27'));_0x42e664[_0x9edd('0x30')]=_['keys'](_0xbe87e1[_0x9edd('0x30')]);_0x42e664[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],_0x42e664[_0x9edd('0x30')]);_0xbbf08f[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],qs[_0x9edd('0x35')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x35')]));_0xbbf08f[_0x9edd('0x34')]=_0xbbf08f[_0x9edd('0x34')][_0x9edd('0x36')]?_0xbbf08f['attributes']:_0x42e664[_0x9edd('0x33')];if(!_0xbe87e1['query'][_0x9edd('0x37')](_0x9edd('0x38'))){_0xbbf08f[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0xbe87e1[_0x9edd('0x30')]['limit']);_0xbbf08f[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x1b')]);}_0xbbf08f[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3a')]);_0xbbf08f[_0x9edd('0x3b')]=qs[_0x9edd('0x31')](_['pick'](_0xbe87e1[_0x9edd('0x30')],_0x42e664['filters']),_0x1fba7b);if(_0xbe87e1[_0x9edd('0x30')]['filter']){_0xbbf08f[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0xbbf08f[_0x9edd('0x3b')],{'$or':_['map'](_0x1fba7b,function(_0x2e85aa){if(_0x2e85aa[_0x9edd('0x2e')]!==_0x9edd('0x3d')){var _0x48958a={};_0x48958a[_0x2e85aa[_0x9edd('0x27')]]={'$like':'%'+_0xbe87e1['query'][_0x9edd('0x3e')]+'%'};return _0x48958a;}})});}_0xbbf08f=_[_0x9edd('0x3c')]({},_0xbbf08f,_0xbe87e1['options']);var _0x315f52={'where':_0xbbf08f[_0x9edd('0x3b')]};return db[_0x9edd('0x2b')][_0x9edd('0x1e')](_0x315f52)['then'](function(_0x449f01){_0x209aba['count']=_0x449f01;if(_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3f')]){_0xbbf08f['include']=[{'all':!![]}];}return db[_0x9edd('0x2b')]['findAll'](_0xbbf08f);})['then'](function(_0x369b69){_0x209aba[_0x9edd('0x40')]=_0x369b69;return _0x209aba;})[_0x9edd('0x21')](respondWithFilteredResult(_0x12c1bc,_0xbbf08f))[_0x9edd('0x41')](handleError(_0x12c1bc,null));};exports[_0x9edd('0x42')]=function(_0x4737ae,_0x3ff512){var _0x75efbe={'raw':!![],'where':{'id':_0x4737ae[_0x9edd('0x43')]['id']}},_0x18c149={};_0x18c149[_0x9edd('0x33')]=_[_0x9edd('0x44')](db[_0x9edd('0x2b')][_0x9edd('0x2c')]);_0x18c149[_0x9edd('0x30')]=_['keys'](_0x4737ae[_0x9edd('0x30')]);_0x18c149[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x18c149[_0x9edd('0x33')],_0x18c149[_0x9edd('0x30')]);_0x75efbe[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x18c149['model'],qs['fields'](_0x4737ae['query'][_0x9edd('0x35')]));_0x75efbe['attributes']=_0x75efbe[_0x9edd('0x34')][_0x9edd('0x36')]?_0x75efbe[_0x9edd('0x34')]:_0x18c149[_0x9edd('0x33')];if(_0x4737ae[_0x9edd('0x30')]['includeAll']){_0x75efbe[_0x9edd('0x45')]=[{'all':!![]}];}_0x75efbe=_[_0x9edd('0x3c')]({},_0x75efbe,_0x4737ae[_0x9edd('0x46')]);return db['Tag'][_0x9edd('0x47')](_0x75efbe)[_0x9edd('0x21')](handleEntityNotFound(_0x3ff512,null))[_0x9edd('0x21')](respondWithResult(_0x3ff512,null))[_0x9edd('0x41')](handleError(_0x3ff512,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){return db[_0x9edd('0x2b')][_0x9edd('0x48')](_0x35bdec['body'],{})[_0x9edd('0x21')](function(_0x8d8701){var _0x4bb324=_0x35bdec[_0x9edd('0x49')][_0x9edd('0x22')]({'plain':!![]});if(!_0x4bb324)throw new Error(_0x9edd('0x4a'));if(_0x4bb324['role']===_0x9edd('0x49')){var _0x151157=_0x8d8701[_0x9edd('0x22')]({'plain':!![]});var _0x28c7bd='Tags';return db[_0x9edd('0x4b')][_0x9edd('0x47')]({'where':{'name':_0x28c7bd,'userProfileId':_0x4bb324[_0x9edd('0x4c')]},'raw':!![]})['then'](function(_0x16951a){if(_0x16951a&&_0x16951a[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x48')]({'name':_0x151157['name'],'resourceId':_0x151157['id'],'type':_0x16951a[_0x9edd('0x27')],'sectionId':_0x16951a['id']},{})[_0x9edd('0x21')](function(){return _0x8d8701;});}else{return _0x8d8701;}})[_0x9edd('0x41')](function(_0x3fcdf5){logger[_0x9edd('0x25')](_0x9edd('0x4e'),_0x3fcdf5);throw _0x3fcdf5;});}return _0x8d8701;})[_0x9edd('0x21')](respondWithResult(_0x4d4f33,0xc9))[_0x9edd('0x41')](handleError(_0x4d4f33,null));};exports[_0x9edd('0x4f')]=function(_0x25d9cc,_0x31272d){if(_0x25d9cc['body']['id']){delete _0x25d9cc[_0x9edd('0x50')]['id'];}return db[_0x9edd('0x2b')][_0x9edd('0x47')]({'where':{'id':_0x25d9cc['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x31272d,null))['then'](saveUpdates(_0x25d9cc['body'],null))['then'](respondWithResult(_0x31272d,null))[_0x9edd('0x41')](handleError(_0x31272d,null));};exports[_0x9edd('0x51')]=function(_0x366316,_0x35ddb3){return db['Tag']['find']({'where':{'id':_0x366316['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x35ddb3,null))[_0x9edd('0x21')](removeEntity(_0x35ddb3,null))[_0x9edd('0x41')](handleError(_0x35ddb3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 0aeac78..5d9803c 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 _0xa26a=['rimraf','../../config/environment','exports','define','Tag','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa26a,0x1e6));var _0xaa26=function(_0x450eab,_0x5115fb){_0x450eab=_0x450eab-0x0;var _0x1cce6e=_0xa26a[_0x450eab];return _0x1cce6e;};'use strict';var _=require(_0xaa26('0x0'));var util=require(_0xaa26('0x1'));var logger=require(_0xaa26('0x2'))(_0xaa26('0x3'));var moment=require(_0xaa26('0x4'));var BPromise=require(_0xaa26('0x5'));var rp=require(_0xaa26('0x6'));var fs=require('fs');var path=require(_0xaa26('0x7'));var rimraf=require(_0xaa26('0x8'));var config=require(_0xaa26('0x9'));var attributes=require('./tag.attributes');module[_0xaa26('0xa')]=function(_0x52b54d,_0x1be84a){return _0x52b54d[_0xaa26('0xb')](_0xaa26('0xc'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b36=['path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','util','api','moment','bluebird','request-promise'];(function(_0x3b28ba,_0x138c94){var _0x5000a7=function(_0x332968){while(--_0x332968){_0x3b28ba['push'](_0x3b28ba['shift']());}};_0x5000a7(++_0x138c94);}(_0x3b36,0x181));var _0x63b3=function(_0x17f3e1,_0x3038db){_0x17f3e1=_0x17f3e1-0x0;var _0x3e743a=_0x3b36[_0x17f3e1];return _0x3e743a;};'use strict';var _=require('lodash');var util=require(_0x63b3('0x0'));var logger=require('../../config/logger')(_0x63b3('0x1'));var moment=require(_0x63b3('0x2'));var BPromise=require(_0x63b3('0x3'));var rp=require(_0x63b3('0x4'));var fs=require('fs');var path=require(_0x63b3('0x5'));var rimraf=require(_0x63b3('0x6'));var config=require(_0x63b3('0x7'));var attributes=require(_0x63b3('0x8'));module[_0x63b3('0x9')]=function(_0x3866a5,_0x1f3731){return _0x3866a5[_0x63b3('0xa')](_0x63b3('0xb'),attributes,{'tableName':_0x63b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index ee85a07..3c723b8 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 _0xa3e6=['then','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x5a1f20,_0x5b1256){_0x5a1f20=_0x5a1f20-0x0;var _0x4e3917=_0xa3e6[_0x5a1f20];return _0x4e3917;};'use strict';var _=require(_0x6a3e('0x0'));var util=require('util');var moment=require(_0x6a3e('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a3e('0x2'));var fs=require('fs');var Redis=require(_0x6a3e('0x3'));var db=require(_0x6a3e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a3e('0x5'))('rpc');var config=require(_0x6a3e('0x6'));var jayson=require(_0x6a3e('0x7'));var client=jayson[_0x6a3e('0x8')][_0x6a3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19dd88,_0x52a2f8,_0x3d7fbe){return new BPromise(function(_0x3d2a86,_0x5c3b9f){return client['request'](_0x19dd88,_0x3d7fbe)[_0x6a3e('0xa')](function(_0x5707de){logger['info'](_0x6a3e('0xb'),_0x52a2f8,'request\x20sent');logger[_0x6a3e('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x52a2f8,_0x6a3e('0xd'),JSON[_0x6a3e('0xe')](_0x5707de));if(_0x5707de[_0x6a3e('0xf')]){if(_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x10')]===0x1f4){logger[_0x6a3e('0xf')]('Tag,\x20%s,\x20%s',_0x52a2f8,_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x11')]);return _0x5c3b9f(_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x11')]);}logger[_0x6a3e('0xf')](_0x6a3e('0xb'),_0x52a2f8,_0x5707de[_0x6a3e('0xf')]['message']);return _0x3d2a86(_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x11')]);}else{logger[_0x6a3e('0x12')](_0x6a3e('0xb'),_0x52a2f8,'request\x20sent');_0x3d2a86(_0x5707de[_0x6a3e('0x13')][_0x6a3e('0x11')]);}})['catch'](function(_0x5d3d56){logger['error']('Tag,\x20%s,\x20%s',_0x52a2f8,_0x5d3d56);_0x5c3b9f(_0x5d3d56);});});} \ No newline at end of file +var _0xfd7b=['Tag,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xfd7b[_0x4bc65f];return _0x44f85f;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('Tag,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('Tag,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4c416f2..aa465a1 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(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 0f829d2..ad0cc24 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 _0x2032=['name','exports','STRING'];(function(_0x29b1a8,_0x38a83b){var _0x490109=function(_0x5f53fc){while(--_0x5f53fc){_0x29b1a8['push'](_0x29b1a8['shift']());}};_0x490109(++_0x38a83b);}(_0x2032,0xd9));var _0x2203=function(_0x226b43,_0x251152){_0x226b43=_0x226b43-0x0;var _0x402ee7=_0x2032[_0x226b43];return _0x402ee7;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb7e7[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 7b04e16..e7f16e2 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 _0xaa8c=['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','defaults','localhost','socket.io-emitter','redis','./team.socket','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','sort','channel','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','Voice','Sms','Openchannel','Whatsapp','transaction','through','penalty','TeamVoiceQueue','User','findOrCreate','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','addAgents','spread','removeAgents','isArray','Mail','Fax','Queue:remove','QueueId','getAgents','filter','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xcbe787,_0x401e4c){var _0x4c78fa=function(_0x392922){while(--_0x392922){_0xcbe787['push'](_0xcbe787['shift']());}};_0x4c78fa(++_0x401e4c);}(_0xaa8c,0x137));var _0xcaa8=function(_0x230628,_0x4b01f9){_0x230628=_0x230628-0x0;var _0xd221b1=_0xaa8c[_0x230628];return _0xd221b1;};'use strict';var emlformat=require(_0xcaa8('0x0'));var rimraf=require(_0xcaa8('0x1'));var zipdir=require(_0xcaa8('0x2'));var jsonpatch=require(_0xcaa8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcaa8('0x4'));var util=require('util');var path=require(_0xcaa8('0x5'));var sox=require(_0xcaa8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcaa8('0x7'));var _=require(_0xcaa8('0x8'));var squel=require(_0xcaa8('0x9'));var crypto=require(_0xcaa8('0xa'));var jsforce=require(_0xcaa8('0xb'));var deskjs=require(_0xcaa8('0xc'));var toCsv=require(_0xcaa8('0xd'));var querystring=require(_0xcaa8('0xe'));var Papa=require(_0xcaa8('0xf'));var Redis=require(_0xcaa8('0x10'));var authService=require(_0xcaa8('0x11'));var qs=require(_0xcaa8('0x12'));var as=require(_0xcaa8('0x13'));var hardwareService=require(_0xcaa8('0x14'));var logger=require(_0xcaa8('0x15'))(_0xcaa8('0x16'));var utils=require(_0xcaa8('0x17'));var config=require(_0xcaa8('0x18'));var licenseUtil=require(_0xcaa8('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcaa8('0x1a')](config['redis'],{'host':_0xcaa8('0x1b'),'port':0x18eb});var socket=require(_0xcaa8('0x1c'))(new Redis(config[_0xcaa8('0x1d')]));require(_0xcaa8('0x1e'))['register'](socket);function respondWithStatusCode(_0x30f018,_0x346c09){_0x346c09=_0x346c09||0xcc;return function(_0x29d464){if(_0x29d464){return _0x30f018[_0xcaa8('0x1f')](_0x346c09);}return _0x30f018['status'](_0x346c09)[_0xcaa8('0x20')]();};}function respondWithResult(_0x426768,_0x43bcbe){_0x43bcbe=_0x43bcbe||0xc8;return function(_0x5f24b0){if(_0x5f24b0){return _0x426768['status'](_0x43bcbe)['json'](_0x5f24b0);}};}function respondWithFilteredResult(_0x338e4d,_0x1f7694){return function(_0x4ade6d){if(_0x4ade6d){var _0x481c1b=typeof _0x1f7694[_0xcaa8('0x21')]===_0xcaa8('0x22')&&typeof _0x1f7694['limit']===_0xcaa8('0x22');var _0x2d8656=_0x4ade6d['count'];var _0x3f0c5c=_0x481c1b?0x0:_0x1f7694[_0xcaa8('0x21')];var _0xa9deb5=_0x481c1b?_0x4ade6d[_0xcaa8('0x23')]:_0x1f7694[_0xcaa8('0x21')]+_0x1f7694[_0xcaa8('0x24')];var _0x2494e6;if(_0xa9deb5>=_0x2d8656){_0xa9deb5=_0x2d8656;_0x2494e6=0xc8;}else{_0x2494e6=0xce;}_0x338e4d[_0xcaa8('0x25')](_0x2494e6);return _0x338e4d[_0xcaa8('0x26')](_0xcaa8('0x27'),_0x3f0c5c+'-'+_0xa9deb5+'/'+_0x2d8656)[_0xcaa8('0x28')](_0x4ade6d);}return null;};}function patchUpdates(_0x1d4045){return function(_0x477f4f){try{jsonpatch['apply'](_0x477f4f,_0x1d4045,!![]);}catch(_0x5f0eac){return BPromise[_0xcaa8('0x29')](_0x5f0eac);}return _0x477f4f[_0xcaa8('0x2a')]();};}function saveUpdates(_0x42ddd9,_0x281767){return function(_0x36ad41){if(_0x36ad41){return _0x36ad41[_0xcaa8('0x2b')](_0x42ddd9)[_0xcaa8('0x2c')](function(_0x50a635){return _0x50a635;});}return null;};}function handleEntityNotFound(_0x11de40,_0x53407d){return function(_0x269c3d){if(!_0x269c3d){_0x11de40['sendStatus'](0x194);}return _0x269c3d;};}function handleError(_0x14bc55,_0x276df9){_0x276df9=_0x276df9||0x1f4;return function(_0x913031){logger[_0xcaa8('0x2d')](_0x913031['stack']);if(_0x913031[_0xcaa8('0x2e')]){delete _0x913031[_0xcaa8('0x2e')];}_0x14bc55[_0xcaa8('0x25')](_0x276df9)[_0xcaa8('0x2f')](_0x913031);};}exports[_0xcaa8('0x30')]=function(_0x2f99d7,_0xd460da){var _0x4dd7ba={},_0x297233={},_0x580193={'count':0x0,'rows':[]};var _0x176f9e=_[_0xcaa8('0x31')](db[_0xcaa8('0x32')][_0xcaa8('0x33')],function(_0x143e94){return{'name':_0x143e94[_0xcaa8('0x34')],'type':_0x143e94[_0xcaa8('0x35')][_0xcaa8('0x36')]};});_0x297233[_0xcaa8('0x37')]=_[_0xcaa8('0x31')](_0x176f9e,'name');_0x297233[_0xcaa8('0x38')]=_[_0xcaa8('0x39')](_0x2f99d7['query']);_0x297233[_0xcaa8('0x3a')]=_[_0xcaa8('0x3b')](_0x297233[_0xcaa8('0x37')],_0x297233[_0xcaa8('0x38')]);_0x4dd7ba[_0xcaa8('0x3c')]=_[_0xcaa8('0x3b')](_0x297233[_0xcaa8('0x37')],qs[_0xcaa8('0x3d')](_0x2f99d7[_0xcaa8('0x38')][_0xcaa8('0x3d')]));_0x4dd7ba['attributes']=_0x4dd7ba[_0xcaa8('0x3c')][_0xcaa8('0x3e')]?_0x4dd7ba[_0xcaa8('0x3c')]:_0x297233[_0xcaa8('0x37')];if(!_0x2f99d7[_0xcaa8('0x38')]['hasOwnProperty'](_0xcaa8('0x3f'))){_0x4dd7ba[_0xcaa8('0x24')]=qs['limit'](_0x2f99d7[_0xcaa8('0x38')][_0xcaa8('0x24')]);_0x4dd7ba['offset']=qs['offset'](_0x2f99d7['query'][_0xcaa8('0x21')]);}_0x4dd7ba[_0xcaa8('0x40')]=qs['sort'](_0x2f99d7[_0xcaa8('0x38')]['sort']);_0x4dd7ba[_0xcaa8('0x41')]=qs[_0xcaa8('0x3a')](_[_0xcaa8('0x42')](_0x2f99d7['query'],_0x297233[_0xcaa8('0x3a')]),_0x176f9e);if(_0x2f99d7['query']['filter']){_0x4dd7ba[_0xcaa8('0x41')]=_[_0xcaa8('0x43')](_0x4dd7ba[_0xcaa8('0x41')],{'$or':_[_0xcaa8('0x31')](_0x176f9e,function(_0x133bd8){if(_0x133bd8['type']!==_0xcaa8('0x44')){var _0x6aa102={};_0x6aa102[_0x133bd8[_0xcaa8('0x2e')]]={'$like':'%'+_0x2f99d7[_0xcaa8('0x38')]['filter']+'%'};return _0x6aa102;}})});}_0x4dd7ba=_[_0xcaa8('0x43')]({},_0x4dd7ba,_0x2f99d7['options']);var _0x2cd4db={'where':_0x4dd7ba[_0xcaa8('0x41')]};return db[_0xcaa8('0x32')][_0xcaa8('0x23')](_0x2cd4db)[_0xcaa8('0x2c')](function(_0x41de9a){_0x580193['count']=_0x41de9a;if(_0x2f99d7['query'][_0xcaa8('0x45')]){_0x4dd7ba[_0xcaa8('0x46')]=[{'all':!![]}];}return db['Team']['findAll'](_0x4dd7ba);})[_0xcaa8('0x2c')](function(_0x594f5b){_0x580193[_0xcaa8('0x47')]=_0x594f5b;return _0x580193;})['then'](respondWithFilteredResult(_0xd460da,_0x4dd7ba))['catch'](handleError(_0xd460da,null));};exports[_0xcaa8('0x48')]=function(_0x227aa6,_0x5f0cca){var _0x9c0bbf={'raw':![],'where':{'id':_0x227aa6[_0xcaa8('0x49')]['id']}},_0x5c689c={};_0x5c689c['model']=_['keys'](db[_0xcaa8('0x32')][_0xcaa8('0x33')]);_0x5c689c[_0xcaa8('0x38')]=_[_0xcaa8('0x39')](_0x227aa6[_0xcaa8('0x38')]);_0x5c689c['filters']=_['intersection'](_0x5c689c[_0xcaa8('0x37')],_0x5c689c[_0xcaa8('0x38')]);_0x9c0bbf[_0xcaa8('0x3c')]=_[_0xcaa8('0x3b')](_0x5c689c[_0xcaa8('0x37')],qs[_0xcaa8('0x3d')](_0x227aa6[_0xcaa8('0x38')][_0xcaa8('0x3d')]));_0x9c0bbf[_0xcaa8('0x3c')]=_0x9c0bbf['attributes'][_0xcaa8('0x3e')]?_0x9c0bbf[_0xcaa8('0x3c')]:_0x5c689c[_0xcaa8('0x37')];if(_0x227aa6[_0xcaa8('0x38')][_0xcaa8('0x45')]){_0x9c0bbf[_0xcaa8('0x46')]=[{'all':!![]}];}_0x9c0bbf=_[_0xcaa8('0x43')]({},_0x9c0bbf,_0x227aa6[_0xcaa8('0x4a')]);return db[_0xcaa8('0x32')][_0xcaa8('0x4b')](_0x9c0bbf)[_0xcaa8('0x2c')](handleEntityNotFound(_0x5f0cca,null))[_0xcaa8('0x2c')](respondWithResult(_0x5f0cca,null))['catch'](handleError(_0x5f0cca,null));};exports['create']=function(_0x5da391,_0x1a653f){return db[_0xcaa8('0x32')][_0xcaa8('0x4c')](_0x5da391[_0xcaa8('0x4d')],{})[_0xcaa8('0x2c')](function(_0x55716d){var _0x729b45=_0x5da391[_0xcaa8('0x4e')][_0xcaa8('0x4f')]({'plain':!![]});if(!_0x729b45)throw new Error(_0xcaa8('0x50'));if(_0x729b45[_0xcaa8('0x51')]===_0xcaa8('0x4e')){var _0x58277f=_0x55716d['get']({'plain':!![]});var _0x487425=_0xcaa8('0x52');return db[_0xcaa8('0x53')][_0xcaa8('0x4b')]({'where':{'name':_0x487425,'userProfileId':_0x729b45[_0xcaa8('0x54')]},'raw':!![]})[_0xcaa8('0x2c')](function(_0x3eea0b){if(_0x3eea0b&&_0x3eea0b[_0xcaa8('0x55')]===0x0){return db['UserProfileResource'][_0xcaa8('0x4c')]({'name':_0x58277f[_0xcaa8('0x2e')],'resourceId':_0x58277f['id'],'type':_0x3eea0b[_0xcaa8('0x2e')],'sectionId':_0x3eea0b['id']},{})[_0xcaa8('0x2c')](function(){return _0x55716d;});}else{return _0x55716d;}})[_0xcaa8('0x56')](function(_0x2f1e2c){logger[_0xcaa8('0x2d')](_0xcaa8('0x57'),_0x2f1e2c);throw _0x2f1e2c;});}return _0x55716d;})['then'](respondWithResult(_0x1a653f,0xc9))['catch'](handleError(_0x1a653f,null));};exports[_0xcaa8('0x2b')]=function(_0xe6f0a7,_0x4f2e5c){if(_0xe6f0a7[_0xcaa8('0x4d')]['id']){delete _0xe6f0a7[_0xcaa8('0x4d')]['id'];}return db['Team'][_0xcaa8('0x4b')]({'where':{'id':_0xe6f0a7[_0xcaa8('0x49')]['id']}})[_0xcaa8('0x2c')](handleEntityNotFound(_0x4f2e5c,null))[_0xcaa8('0x2c')](saveUpdates(_0xe6f0a7['body'],null))['then'](respondWithResult(_0x4f2e5c,null))[_0xcaa8('0x56')](handleError(_0x4f2e5c,null));};exports[_0xcaa8('0x58')]=function(_0x4b01b4,_0x18cb66){var _0x5f222d=_0x4b01b4[_0xcaa8('0x49')]['id'];var _0x1a0e26=[];return db[_0xcaa8('0x59')]['transaction'](function(_0xe3e340){var _0x3d3b49=_0xcaa8('0x5a')+_0x5f222d;return db[_0xcaa8('0x59')][_0xcaa8('0x38')](_0x3d3b49,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xe3e340})[_0xcaa8('0x2c')](function(_0x37de9f){_0x1a0e26=_['map'](_0x37de9f,function(_0x2f4f9f){return Number(_0x2f4f9f[_0xcaa8('0x5b')]);});})[_0xcaa8('0x2c')](function(){var _0x84ea9f=_0xcaa8('0x5c')+_0x5f222d;return db[_0xcaa8('0x59')][_0xcaa8('0x38')](_0x84ea9f,{'type':db[_0xcaa8('0x5d')]['QueryTypes'][_0xcaa8('0x5e')],'raw':!![],'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(_0x52d6d1){var _0x2a6e02=_['map'](_0x52d6d1,function(_0x4ea02c){return Number(_0x4ea02c[_0xcaa8('0x5f')]);});return db[_0xcaa8('0x60')][_0xcaa8('0x58')]({'where':{'UserId':{'$in':_0x1a0e26},'VoiceQueueId':{'$in':_0x2a6e02}},'transaction':_0xe3e340});})['then'](function(){var _0x4c5bf0=_0xcaa8('0x61')+_0x5f222d;return db['sequelize']['query'](_0x4c5bf0,{'type':db['Sequelize'][_0xcaa8('0x62')][_0xcaa8('0x5e')],'raw':!![],'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(_0x2878b7){var _0x4210ee=_[_0xcaa8('0x31')](_0x2878b7,function(_0xc1fdb0){return Number(_0xc1fdb0[_0xcaa8('0x63')]);});return db[_0xcaa8('0x64')]['destroy']({'where':{'UserId':{'$in':_0x1a0e26},'MailQueueId':{'$in':_0x4210ee}},'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(){var _0x505890=_0xcaa8('0x65')+_0x5f222d;return db['sequelize'][_0xcaa8('0x38')](_0x505890,{'type':db[_0xcaa8('0x5d')]['QueryTypes'][_0xcaa8('0x5e')],'raw':!![],'transaction':_0xe3e340});})['then'](function(_0x726a11){var _0x450c5f=_[_0xcaa8('0x31')](_0x726a11,function(_0x45725a){return Number(_0x45725a['SmsQueueId']);});return db[_0xcaa8('0x66')][_0xcaa8('0x58')]({'where':{'UserId':{'$in':_0x1a0e26},'SmsQueueId':{'$in':_0x450c5f}},'transaction':_0xe3e340});})['then'](function(){var _0x110c7d=_0xcaa8('0x67')+_0x5f222d;return db[_0xcaa8('0x59')][_0xcaa8('0x38')](_0x110c7d,{'type':db[_0xcaa8('0x5d')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(_0x2136cc){var _0x6edaee=_[_0xcaa8('0x31')](_0x2136cc,function(_0x5ddd17){return Number(_0x5ddd17[_0xcaa8('0x68')]);});return db[_0xcaa8('0x69')]['destroy']({'where':{'UserId':{'$in':_0x1a0e26},'ChatQueueId':{'$in':_0x6edaee}},'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(){var _0x348af0='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5f222d;return db[_0xcaa8('0x59')][_0xcaa8('0x38')](_0x348af0,{'type':db['Sequelize'][_0xcaa8('0x62')][_0xcaa8('0x5e')],'raw':!![],'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(_0x49d3cd){var _0x532355=_[_0xcaa8('0x31')](_0x49d3cd,function(_0x268e62){return Number(_0x268e62[_0xcaa8('0x6a')]);});return db[_0xcaa8('0x6b')][_0xcaa8('0x58')]({'where':{'UserId':{'$in':_0x1a0e26},'FaxQueueId':{'$in':_0x532355}},'transaction':_0xe3e340});})['then'](function(){var _0x1d2001=_0xcaa8('0x6c')+_0x5f222d;return db[_0xcaa8('0x59')][_0xcaa8('0x38')](_0x1d2001,{'type':db['Sequelize'][_0xcaa8('0x62')][_0xcaa8('0x5e')],'raw':!![],'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(_0x1832fc){var _0x59fb75=_[_0xcaa8('0x31')](_0x1832fc,function(_0x87807f){return Number(_0x87807f['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0xcaa8('0x58')]({'where':{'UserId':{'$in':_0x1a0e26},'OpenchannelQueueId':{'$in':_0x59fb75}},'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(){var _0x29c03f='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5f222d;return db['sequelize'][_0xcaa8('0x38')](_0x29c03f,{'type':db[_0xcaa8('0x5d')][_0xcaa8('0x62')][_0xcaa8('0x5e')],'raw':!![],'transaction':_0xe3e340});})['then'](function(_0xac4f9a){var _0x4ad8ef=_['map'](_0xac4f9a,function(_0x18b759){return Number(_0x18b759[_0xcaa8('0x6d')]);});return db[_0xcaa8('0x6e')][_0xcaa8('0x58')]({'where':{'UserId':{'$in':_0x1a0e26},'WhatsappQueueId':{'$in':_0x4ad8ef}},'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(){return db[_0xcaa8('0x6f')][_0xcaa8('0x4b')]({'where':{'TeamId':_0x5f222d}});})[_0xcaa8('0x2c')](function(_0x16642d){if(_0x16642d===null){return;}return db[_0xcaa8('0x70')][_0xcaa8('0x58')]({'where':{'UserId':{'$in':_0x1a0e26},'VoicePrefixId':_0x16642d[_0xcaa8('0x71')]},'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(){return db[_0xcaa8('0x32')]['destroy']({'where':{'id':_0x5f222d},'cascade':!![],'transaction':_0xe3e340});})[_0xcaa8('0x2c')](function(_0x5851be){if(_0x5851be===0x0){_0x18cb66['sendStatus'](0x194);}else{return db[_0xcaa8('0x72')][_0xcaa8('0x58')]({'where':{'type':'Teams','resourceId':_0x5f222d},'cascade':!![],'transaction':_0xe3e340})['then'](function(){_0x18cb66['status'](0xcc)[_0xcaa8('0x20')]();});}})['catch'](function(_0x239993){_0x18cb66[_0xcaa8('0x25')](0x1f4)['send'](_0x239993);});});};exports[_0xcaa8('0x73')]=function(_0x4e46aa,_0x384801,_0x5d88e0){return db[_0xcaa8('0x32')][_0xcaa8('0x74')]({'where':{'id':_0x4e46aa[_0xcaa8('0x49')]['id']}})['then'](handleEntityNotFound(_0x384801,null))[_0xcaa8('0x2c')](function(_0x1249ec){if(!_0x4e46aa[_0xcaa8('0x38')]['channel']||!utils[_0xcaa8('0x75')](_0x4e46aa[_0xcaa8('0x38')]['channel'])){throw new db[(_0xcaa8('0x5d'))][(_0xcaa8('0x76'))]('Unknown\x20channel');}var _0x19a90d={};var _0x37a8d7={};_0x37a8d7[_0xcaa8('0x37')]=_[_0xcaa8('0x39')](db[_[_0xcaa8('0x77')](_0x4e46aa[_0xcaa8('0x38')]['channel'][_0xcaa8('0x78')]())+_0xcaa8('0x79')][_0xcaa8('0x33')]);_0x37a8d7['query']=_['keys'](_0x4e46aa[_0xcaa8('0x38')]);_0x37a8d7[_0xcaa8('0x3a')]=_[_0xcaa8('0x3b')](_0x37a8d7[_0xcaa8('0x37')],_0x37a8d7[_0xcaa8('0x38')]);_0x19a90d[_0xcaa8('0x3c')]=_[_0xcaa8('0x3b')](_0x37a8d7['model'],qs[_0xcaa8('0x3d')](_0x4e46aa[_0xcaa8('0x38')]['fields']));_0x19a90d['attributes']=_0x19a90d[_0xcaa8('0x3c')][_0xcaa8('0x3e')]?_0x19a90d[_0xcaa8('0x3c')]:_0x37a8d7[_0xcaa8('0x37')];_0x19a90d['limit']=qs[_0xcaa8('0x24')](_0x4e46aa[_0xcaa8('0x38')][_0xcaa8('0x24')]);_0x19a90d[_0xcaa8('0x21')]=qs[_0xcaa8('0x21')](_0x4e46aa[_0xcaa8('0x38')]['offset']);_0x19a90d[_0xcaa8('0x40')]=qs[_0xcaa8('0x7a')](_0x4e46aa['query'][_0xcaa8('0x7a')]);_0x19a90d[_0xcaa8('0x41')]=qs[_0xcaa8('0x3a')](_[_0xcaa8('0x42')](_0x4e46aa[_0xcaa8('0x38')],_0x37a8d7[_0xcaa8('0x3a')]));_0x19a90d=_[_0xcaa8('0x43')]({},_0x19a90d,_0x4e46aa[_0xcaa8('0x4a')]);return _0x1249ec['get'+_['capitalize'](_0x4e46aa[_0xcaa8('0x38')][_0xcaa8('0x7b')][_0xcaa8('0x78')]())+_0xcaa8('0x7c')](_0x19a90d);})[_0xcaa8('0x2c')](respondWithResult(_0x384801,null))['catch'](handleError(_0x384801,null));};exports[_0xcaa8('0x7d')]=function(_0x109aa4,_0x23de6a,_0x1e4ec0){return db[_0xcaa8('0x32')][_0xcaa8('0x74')]({'where':{'id':_0x109aa4[_0xcaa8('0x49')]['id']}})['then'](function(_0x1bc81b){if(_0x1bc81b){if(!_0x109aa4[_0xcaa8('0x4d')][_0xcaa8('0x7b')]||!utils[_0xcaa8('0x75')](_0x109aa4[_0xcaa8('0x4d')][_0xcaa8('0x7b')])){throw new db[(_0xcaa8('0x5d'))][(_0xcaa8('0x76'))](_0xcaa8('0x7e'));}return _0x1bc81b[_0xcaa8('0x7f')+_[_0xcaa8('0x77')](_0x109aa4[_0xcaa8('0x4d')][_0xcaa8('0x7b')][_0xcaa8('0x78')]())+_0xcaa8('0x7c')](_0x109aa4[_0xcaa8('0x4d')][_0xcaa8('0x80')]);}return null;})['then'](handleEntityNotFound(_0x23de6a,null))[_0xcaa8('0x2c')](respondWithStatusCode(_0x23de6a,null))[_0xcaa8('0x56')](handleError(_0x23de6a,null));};exports[_0xcaa8('0x81')]=function(_0x281e5c,_0x4c416b,_0x3e1e9b){return db['Team'][_0xcaa8('0x74')]({'where':{'id':_0x281e5c[_0xcaa8('0x49')]['id']}})[_0xcaa8('0x2c')](function(_0xe2e32a){if(_0xe2e32a){if(!_0x281e5c[_0xcaa8('0x38')][_0xcaa8('0x7b')]||!utils[_0xcaa8('0x75')](_0x281e5c['query'][_0xcaa8('0x7b')])){throw new db['Sequelize'][(_0xcaa8('0x76'))](_0xcaa8('0x7e'));}return _0xe2e32a[_0xcaa8('0x82')+_[_0xcaa8('0x77')](_0x281e5c[_0xcaa8('0x38')][_0xcaa8('0x7b')][_0xcaa8('0x78')]())+_0xcaa8('0x7c')](_0x281e5c[_0xcaa8('0x38')][_0xcaa8('0x80')]);}return null;})[_0xcaa8('0x2c')](handleEntityNotFound(_0x4c416b,null))[_0xcaa8('0x2c')](respondWithStatusCode(_0x4c416b,null))[_0xcaa8('0x56')](handleError(_0x4c416b,null));};exports['addAgents']=function(_0xf74130,_0x456838){var _0x56181a=_['isArray'](_0xf74130[_0xcaa8('0x4d')][_0xcaa8('0x80')])?_0xf74130[_0xcaa8('0x4d')][_0xcaa8('0x80')]:[_0xf74130[_0xcaa8('0x4d')][_0xcaa8('0x80')]];var _0x475ddb=_0xf74130[_0xcaa8('0x49')]['id'];return db[_0xcaa8('0x32')][_0xcaa8('0x4b')]({'where':{'id':_0x475ddb}})['then'](handleEntityNotFound(_0x456838,null))[_0xcaa8('0x2c')](function(_0x8355da){if(_0x8355da){var _0x5928c8=[_0xcaa8('0x83'),'Chat','Mail',_0xcaa8('0x84'),'Fax',_0xcaa8('0x85'),_0xcaa8('0x86')];return db[_0xcaa8('0x59')][_0xcaa8('0x87')](function(_0x5d5a3f){var _0x27e109=_[_0xcaa8('0x31')](_0x5928c8,function(_0x26149a){var _0x122acc={'attributes':['id',_0xcaa8('0x2e')]};if(_0x26149a===_0xcaa8('0x83')){_0x122acc[_0xcaa8('0x88')]={'attributes':[_0xcaa8('0x89')]};}return _0x8355da[_0xcaa8('0x4f')+_0x26149a+_0xcaa8('0x7c')](_0x122acc)[_0xcaa8('0x2c')](function(_0x59f425){var _0x1a6f6e=_[_0xcaa8('0x31')](_0x59f425,function(_0x15e9f3){var _0xa380cc=_['map'](_0x56181a,function(_0xda9768){var _0x8bde7c={'where':{'UserId':_0xda9768,[_0x26149a+'QueueId']:_0x15e9f3['id']},'transaction':_0x5d5a3f};if(_0x26149a===_0xcaa8('0x83')){_0x8bde7c[_0xcaa8('0x1a')]={'penalty':_0x15e9f3[_0xcaa8('0x8a')][_0xcaa8('0x89')]};}return db[_0xcaa8('0x8b')+_0x26149a+_0xcaa8('0x79')][_0xcaa8('0x8c')](_0x8bde7c)[_0xcaa8('0x2c')](function(){socket['emit'](_0xcaa8('0x4e')+_0x26149a+_0xcaa8('0x8d'),{'UserId':_0xda9768,[_0x26149a+'QueueId']:_0x15e9f3['id']});if(_0x26149a!==_0xcaa8('0x83')){return;}return db['User'][_0xcaa8('0x8e')]({'where':{'id':_0x56181a,'online':0x1},'attributes':['id',_0xcaa8('0x2e'),_0xcaa8('0x8f'),_0xcaa8('0x90'),_0xcaa8('0x91')],'raw':!![]})[_0xcaa8('0x2c')](function(_0x36bd8c){var _0x2ad514=_[_0xcaa8('0x31')](_0x36bd8c,function(_0x536368){return db[_0xcaa8('0x92')][_0xcaa8('0x93')]({'membername':_0x536368[_0xcaa8('0x2e')],'UserId':_0x536368['id'],'queue_name':_0x15e9f3[_0xcaa8('0x2e')],'VoiceQueueId':_0x15e9f3['id'],'interface':_[_0xcaa8('0x94')](_0x536368[_0xcaa8('0x91')])?util[_0xcaa8('0x95')](_0xcaa8('0x96'),_0x536368[_0xcaa8('0x2e')]):_0x536368['interface'],'paused':_0x536368['voicePause']||![],'penalty':_0x15e9f3['TeamVoiceQueue']['penalty']},{'transaction':_0x5d5a3f});});return Promise['all'](_0x2ad514);});});});return Promise['all'](_0xa380cc);});return Promise[_0xcaa8('0x97')](_0x1a6f6e);})[_0xcaa8('0x2c')](function(){return db['TeamVoicePrefix'][_0xcaa8('0x74')]({'where':{'teamId':_0x475ddb}})[_0xcaa8('0x2c')](function(_0x392f10){if(_0x392f10){var _0x260ff9=_[_0xcaa8('0x31')](_0x56181a,function(_0x435e36){db[_0xcaa8('0x70')][_0xcaa8('0x93')]({'UserId':_0x435e36,'VoicePrefixId':_0x392f10[_0xcaa8('0x71')]});});return Promise[_0xcaa8('0x97')](_0x260ff9);}});});});return Promise['all'](_0x27e109)[_0xcaa8('0x2c')](function(){return _0x8355da[_0xcaa8('0x98')](_0x56181a,{'transaction':_0x5d5a3f})[_0xcaa8('0x99')](function(_0x48db74){return _0x48db74;});});});}})[_0xcaa8('0x2c')](respondWithResult(_0x456838,null))[_0xcaa8('0x56')](handleError(_0x456838,null));};exports[_0xcaa8('0x9a')]=function(_0x6ebc84,_0x353b93){var _0x155347=_[_0xcaa8('0x9b')](_0x6ebc84[_0xcaa8('0x38')][_0xcaa8('0x80')])?_0x6ebc84[_0xcaa8('0x38')]['ids']:[_0x6ebc84[_0xcaa8('0x38')]['ids']];var _0x3c5104=_0x6ebc84[_0xcaa8('0x49')]['id'];return db[_0xcaa8('0x32')][_0xcaa8('0x4b')]({'where':{'id':_0x3c5104}})['then'](handleEntityNotFound(_0x353b93,null))['then'](function(_0x2ecd2c){if(_0x2ecd2c){var _0x5c36ce=[_0xcaa8('0x83'),'Chat',_0xcaa8('0x9c'),'Sms',_0xcaa8('0x9d'),_0xcaa8('0x85'),'Whatsapp'];return db[_0xcaa8('0x59')]['transaction'](function(_0xc7f41){var _0x52c8d0=_[_0xcaa8('0x31')](_0x5c36ce,function(_0x540361){var _0x2e9bb1={'attributes':['id',_0xcaa8('0x2e')]};return _0x2ecd2c[_0xcaa8('0x4f')+_0x540361+_0xcaa8('0x7c')](_0x2e9bb1)[_0xcaa8('0x2c')](function(_0x47ced6){var _0x3f8140=_['map'](_0x47ced6,function(_0x30c19a){return _0x30c19a[_0xcaa8('0x9a')](_0x155347,{'transaction':_0xc7f41})[_0xcaa8('0x2c')](function(){var _0x274606=_[_0xcaa8('0x31')](_0x155347,function(_0x262089){socket['emit']('user'+_0x540361+_0xcaa8('0x9e'),{'UserId':Number(_0x262089),[_0x540361+_0xcaa8('0x9f')]:_0x30c19a['id']});if(_0x540361!=='Voice'){return;}return db[_0xcaa8('0x92')][_0xcaa8('0x58')]({'where':{'VoiceQueueId':_0x30c19a['id'],'UserId':_0x262089},'transaction':_0xc7f41});});return Promise[_0xcaa8('0x97')](_0x274606);});});return Promise[_0xcaa8('0x97')](_0x3f8140);});});return Promise[_0xcaa8('0x97')](_0x52c8d0)[_0xcaa8('0x2c')](function(){return _0x2ecd2c[_0xcaa8('0x9a')](_0x155347,{'transaction':_0xc7f41});})[_0xcaa8('0x2c')](function(){return db[_0xcaa8('0x6f')][_0xcaa8('0x74')]({'where':{'teamId':_0x3c5104}})[_0xcaa8('0x2c')](function(_0x3f8b13){if(_0x3f8b13){var _0x4f121d=_['map'](_0x155347,function(_0x57a761){db[_0xcaa8('0x70')][_0xcaa8('0x58')]({'where':{'UserId':_0x57a761,'VoicePrefixId':_0x3f8b13[_0xcaa8('0x71')]}});});return Promise[_0xcaa8('0x97')](_0x4f121d);}});});});}})[_0xcaa8('0x2c')](respondWithStatusCode(_0x353b93,null))[_0xcaa8('0x56')](handleError(_0x353b93,null));};exports[_0xcaa8('0xa0')]=function(_0x59cf1c,_0x3cfebc,_0x8e8673){var _0x2da509={};var _0x2d3589={};var _0x2562f2;var _0x2e0de3;return db[_0xcaa8('0x32')][_0xcaa8('0x74')]({'where':{'id':_0x59cf1c['params']['id']}})['then'](handleEntityNotFound(_0x3cfebc,null))[_0xcaa8('0x2c')](function(_0x28a06c){if(_0x28a06c){_0x2562f2=_0x28a06c;_0x2d3589[_0xcaa8('0x37')]=_[_0xcaa8('0x39')](db[_0xcaa8('0x8b')][_0xcaa8('0x33')]);_0x2d3589[_0xcaa8('0x38')]=_['keys'](_0x59cf1c[_0xcaa8('0x38')]);_0x2d3589[_0xcaa8('0x3a')]=_[_0xcaa8('0x3b')](_0x2d3589['model'],_0x2d3589[_0xcaa8('0x38')]);_0x2da509[_0xcaa8('0x3c')]=_['intersection'](_0x2d3589['model'],qs['fields'](_0x59cf1c[_0xcaa8('0x38')]['fields']));_0x2da509[_0xcaa8('0x3c')]=_0x2da509['attributes'][_0xcaa8('0x3e')]?_0x2da509[_0xcaa8('0x3c')]:_0x2d3589['model'];_0x2da509[_0xcaa8('0x40')]=qs[_0xcaa8('0x7a')](_0x59cf1c[_0xcaa8('0x38')][_0xcaa8('0x7a')]);_0x2da509[_0xcaa8('0x41')]=qs['filters'](_[_0xcaa8('0x42')](_0x59cf1c[_0xcaa8('0x38')],_0x2d3589[_0xcaa8('0x3a')]));if(_0x59cf1c[_0xcaa8('0x38')][_0xcaa8('0xa1')]){_0x2da509['where']=_[_0xcaa8('0x43')](_0x2da509[_0xcaa8('0x41')],{'$or':_['map'](_0x2da509['attributes'],function(_0x17ee2d){var _0x5b35f7={};_0x5b35f7[_0x17ee2d]={'$like':'%'+_0x59cf1c[_0xcaa8('0x38')]['filter']+'%'};return _0x5b35f7;})});}_0x2da509=_[_0xcaa8('0x43')]({},_0x2da509,_0x59cf1c[_0xcaa8('0x4a')]);return _0x2562f2[_0xcaa8('0xa0')](_0x2da509);}})[_0xcaa8('0x2c')](function(_0x2ece54){if(_0x2ece54){_0x2e0de3=_0x2ece54[_0xcaa8('0x3e')];if(!_0x59cf1c['query']['hasOwnProperty'](_0xcaa8('0x3f'))){_0x2da509[_0xcaa8('0x24')]=qs[_0xcaa8('0x24')](_0x59cf1c['query'][_0xcaa8('0x24')]);_0x2da509[_0xcaa8('0x21')]=qs[_0xcaa8('0x21')](_0x59cf1c[_0xcaa8('0x38')][_0xcaa8('0x21')]);}return _0x2562f2['getAgents'](_0x2da509);}})[_0xcaa8('0x2c')](function(_0x4ed8c7){if(_0x4ed8c7){return _0x4ed8c7?{'count':_0x2e0de3,'rows':_0x4ed8c7}:null;}})['then'](respondWithResult(_0x3cfebc,null))['catch'](handleError(_0x3cfebc,null));}; \ No newline at end of file +var _0xe4ab=['SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','capitalize','addQueues','Queues','removeQueues','remove','ids','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','Sms','getAgents','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','error','stack','send','index','map','Team','rawAttributes','fieldName','type','key','model','name','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','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','OpenchannelQueueId','UserOpenchannelQueue'];(function(_0x1ffe6b,_0xdf29dc){var _0x6a0bca=function(_0x519af2){while(--_0x519af2){_0x1ffe6b['push'](_0x1ffe6b['shift']());}};_0x6a0bca(++_0xdf29dc);}(_0xe4ab,0x16c));var _0xbe4a=function(_0x3c2514,_0x3ac020){_0x3c2514=_0x3c2514-0x0;var _0x51d5de=_0xe4ab[_0x3c2514];return _0x51d5de;};'use strict';var emlformat=require(_0xbe4a('0x0'));var rimraf=require(_0xbe4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe4a('0x2'));var rp=require(_0xbe4a('0x3'));var moment=require(_0xbe4a('0x4'));var BPromise=require(_0xbe4a('0x5'));var Mustache=require(_0xbe4a('0x6'));var util=require('util');var path=require(_0xbe4a('0x7'));var sox=require(_0xbe4a('0x8'));var csv=require(_0xbe4a('0x9'));var ejs=require(_0xbe4a('0xa'));var fs=require('fs');var fs_extra=require(_0xbe4a('0xb'));var _=require(_0xbe4a('0xc'));var squel=require(_0xbe4a('0xd'));var crypto=require(_0xbe4a('0xe'));var jsforce=require(_0xbe4a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbe4a('0x9'));var querystring=require(_0xbe4a('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe4a('0x11'));var authService=require(_0xbe4a('0x12'));var qs=require(_0xbe4a('0x13'));var as=require(_0xbe4a('0x14'));var hardwareService=require(_0xbe4a('0x15'));var logger=require(_0xbe4a('0x16'))(_0xbe4a('0x17'));var utils=require('../../config/utils');var config=require(_0xbe4a('0x18'));var licenseUtil=require(_0xbe4a('0x19'));var db=require(_0xbe4a('0x1a'))['db'];config['redis']=_[_0xbe4a('0x1b')](config[_0xbe4a('0x1c')],{'host':_0xbe4a('0x1d'),'port':0x18eb});var socket=require(_0xbe4a('0x1e'))(new Redis(config[_0xbe4a('0x1c')]));require(_0xbe4a('0x1f'))['register'](socket);function respondWithStatusCode(_0x476af3,_0x2060ba){_0x2060ba=_0x2060ba||0xcc;return function(_0x50ffa3){if(_0x50ffa3){return _0x476af3[_0xbe4a('0x20')](_0x2060ba);}return _0x476af3[_0xbe4a('0x21')](_0x2060ba)['end']();};}function respondWithResult(_0xedae82,_0x44b7d4){_0x44b7d4=_0x44b7d4||0xc8;return function(_0x202140){if(_0x202140){return _0xedae82['status'](_0x44b7d4)[_0xbe4a('0x22')](_0x202140);}};}function respondWithFilteredResult(_0x14989b,_0x37e70d){return function(_0x5dab92){if(_0x5dab92){var _0x35b024=typeof _0x37e70d['offset']===_0xbe4a('0x23')&&typeof _0x37e70d[_0xbe4a('0x24')]===_0xbe4a('0x23');var _0x3ac1f5=_0x5dab92['count'];var _0x41c1e0=_0x35b024?0x0:_0x37e70d[_0xbe4a('0x25')];var _0x41a441=_0x35b024?_0x5dab92['count']:_0x37e70d[_0xbe4a('0x25')]+_0x37e70d[_0xbe4a('0x24')];var _0x354afb;if(_0x41a441>=_0x3ac1f5){_0x41a441=_0x3ac1f5;_0x354afb=0xc8;}else{_0x354afb=0xce;}_0x14989b[_0xbe4a('0x21')](_0x354afb);return _0x14989b[_0xbe4a('0x26')](_0xbe4a('0x27'),_0x41c1e0+'-'+_0x41a441+'/'+_0x3ac1f5)['json'](_0x5dab92);}return null;};}function patchUpdates(_0x305d63){return function(_0x17b441){try{jsonpatch[_0xbe4a('0x28')](_0x17b441,_0x305d63,!![]);}catch(_0x4b01ab){return BPromise['reject'](_0x4b01ab);}return _0x17b441[_0xbe4a('0x29')]();};}function saveUpdates(_0x45a8e9,_0x2e51c3){return function(_0xcc8eeb){if(_0xcc8eeb){return _0xcc8eeb[_0xbe4a('0x2a')](_0x45a8e9)[_0xbe4a('0x2b')](function(_0x5d5bcc){return _0x5d5bcc;});}return null;};}function handleEntityNotFound(_0x4b82d5,_0x1aadb3){return function(_0x53022d){if(!_0x53022d){_0x4b82d5[_0xbe4a('0x20')](0x194);}return _0x53022d;};}function handleError(_0x316354,_0x29dbce){_0x29dbce=_0x29dbce||0x1f4;return function(_0x176d24){logger[_0xbe4a('0x2c')](_0x176d24[_0xbe4a('0x2d')]);if(_0x176d24['name']){delete _0x176d24['name'];}_0x316354[_0xbe4a('0x21')](_0x29dbce)[_0xbe4a('0x2e')](_0x176d24);};}exports[_0xbe4a('0x2f')]=function(_0x2e2d44,_0x3995fa){var _0x444711={},_0x410b45={},_0x3d16ee={'count':0x0,'rows':[]};var _0x176c5e=_[_0xbe4a('0x30')](db[_0xbe4a('0x31')][_0xbe4a('0x32')],function(_0x1958c7){return{'name':_0x1958c7[_0xbe4a('0x33')],'type':_0x1958c7[_0xbe4a('0x34')][_0xbe4a('0x35')]};});_0x410b45[_0xbe4a('0x36')]=_[_0xbe4a('0x30')](_0x176c5e,_0xbe4a('0x37'));_0x410b45['query']=_['keys'](_0x2e2d44['query']);_0x410b45[_0xbe4a('0x38')]=_[_0xbe4a('0x39')](_0x410b45[_0xbe4a('0x36')],_0x410b45[_0xbe4a('0x3a')]);_0x444711[_0xbe4a('0x3b')]=_[_0xbe4a('0x39')](_0x410b45['model'],qs[_0xbe4a('0x3c')](_0x2e2d44[_0xbe4a('0x3a')][_0xbe4a('0x3c')]));_0x444711[_0xbe4a('0x3b')]=_0x444711['attributes'][_0xbe4a('0x3d')]?_0x444711['attributes']:_0x410b45['model'];if(!_0x2e2d44[_0xbe4a('0x3a')][_0xbe4a('0x3e')]('nolimit')){_0x444711[_0xbe4a('0x24')]=qs['limit'](_0x2e2d44[_0xbe4a('0x3a')][_0xbe4a('0x24')]);_0x444711[_0xbe4a('0x25')]=qs[_0xbe4a('0x25')](_0x2e2d44[_0xbe4a('0x3a')][_0xbe4a('0x25')]);}_0x444711[_0xbe4a('0x3f')]=qs[_0xbe4a('0x40')](_0x2e2d44[_0xbe4a('0x3a')][_0xbe4a('0x40')]);_0x444711[_0xbe4a('0x41')]=qs[_0xbe4a('0x38')](_[_0xbe4a('0x42')](_0x2e2d44['query'],_0x410b45[_0xbe4a('0x38')]),_0x176c5e);if(_0x2e2d44[_0xbe4a('0x3a')]['filter']){_0x444711[_0xbe4a('0x41')]=_['merge'](_0x444711[_0xbe4a('0x41')],{'$or':_[_0xbe4a('0x30')](_0x176c5e,function(_0x3598a9){if(_0x3598a9[_0xbe4a('0x34')]!=='VIRTUAL'){var _0xa219c4={};_0xa219c4[_0x3598a9[_0xbe4a('0x37')]]={'$like':'%'+_0x2e2d44[_0xbe4a('0x3a')][_0xbe4a('0x43')]+'%'};return _0xa219c4;}})});}_0x444711=_[_0xbe4a('0x44')]({},_0x444711,_0x2e2d44[_0xbe4a('0x45')]);var _0x3027b4={'where':_0x444711[_0xbe4a('0x41')]};return db[_0xbe4a('0x31')][_0xbe4a('0x46')](_0x3027b4)[_0xbe4a('0x2b')](function(_0x1ceeb9){_0x3d16ee[_0xbe4a('0x46')]=_0x1ceeb9;if(_0x2e2d44[_0xbe4a('0x3a')][_0xbe4a('0x47')]){_0x444711[_0xbe4a('0x48')]=[{'all':!![]}];}return db[_0xbe4a('0x31')][_0xbe4a('0x49')](_0x444711);})[_0xbe4a('0x2b')](function(_0x50faaa){_0x3d16ee[_0xbe4a('0x4a')]=_0x50faaa;return _0x3d16ee;})['then'](respondWithFilteredResult(_0x3995fa,_0x444711))['catch'](handleError(_0x3995fa,null));};exports[_0xbe4a('0x4b')]=function(_0x16e395,_0x1e9fa4){var _0x31fba6={'raw':![],'where':{'id':_0x16e395[_0xbe4a('0x4c')]['id']}},_0x140b0a={};_0x140b0a[_0xbe4a('0x36')]=_[_0xbe4a('0x4d')](db[_0xbe4a('0x31')][_0xbe4a('0x32')]);_0x140b0a[_0xbe4a('0x3a')]=_['keys'](_0x16e395[_0xbe4a('0x3a')]);_0x140b0a['filters']=_[_0xbe4a('0x39')](_0x140b0a[_0xbe4a('0x36')],_0x140b0a[_0xbe4a('0x3a')]);_0x31fba6[_0xbe4a('0x3b')]=_[_0xbe4a('0x39')](_0x140b0a[_0xbe4a('0x36')],qs[_0xbe4a('0x3c')](_0x16e395[_0xbe4a('0x3a')]['fields']));_0x31fba6[_0xbe4a('0x3b')]=_0x31fba6[_0xbe4a('0x3b')][_0xbe4a('0x3d')]?_0x31fba6[_0xbe4a('0x3b')]:_0x140b0a['model'];if(_0x16e395[_0xbe4a('0x3a')][_0xbe4a('0x47')]){_0x31fba6[_0xbe4a('0x48')]=[{'all':!![]}];}_0x31fba6=_[_0xbe4a('0x44')]({},_0x31fba6,_0x16e395[_0xbe4a('0x45')]);return db['Team'][_0xbe4a('0x4e')](_0x31fba6)[_0xbe4a('0x2b')](handleEntityNotFound(_0x1e9fa4,null))[_0xbe4a('0x2b')](respondWithResult(_0x1e9fa4,null))[_0xbe4a('0x4f')](handleError(_0x1e9fa4,null));};exports[_0xbe4a('0x50')]=function(_0x4ee644,_0x52a671){return db[_0xbe4a('0x31')][_0xbe4a('0x50')](_0x4ee644[_0xbe4a('0x51')],{})[_0xbe4a('0x2b')](function(_0x51b535){var _0x58d162=_0x4ee644[_0xbe4a('0x52')]['get']({'plain':!![]});if(!_0x58d162)throw new Error(_0xbe4a('0x53'));if(_0x58d162[_0xbe4a('0x54')]===_0xbe4a('0x52')){var _0x438cfe=_0x51b535[_0xbe4a('0x55')]({'plain':!![]});var _0x590a93=_0xbe4a('0x56');return db['UserProfileSection'][_0xbe4a('0x4e')]({'where':{'name':_0x590a93,'userProfileId':_0x58d162[_0xbe4a('0x57')]},'raw':!![]})['then'](function(_0x4c8b53){if(_0x4c8b53&&_0x4c8b53[_0xbe4a('0x58')]===0x0){return db[_0xbe4a('0x59')]['create']({'name':_0x438cfe[_0xbe4a('0x37')],'resourceId':_0x438cfe['id'],'type':_0x4c8b53[_0xbe4a('0x37')],'sectionId':_0x4c8b53['id']},{})['then'](function(){return _0x51b535;});}else{return _0x51b535;}})[_0xbe4a('0x4f')](function(_0x560afa){logger[_0xbe4a('0x2c')](_0xbe4a('0x5a'),_0x560afa);throw _0x560afa;});}return _0x51b535;})[_0xbe4a('0x2b')](respondWithResult(_0x52a671,0xc9))['catch'](handleError(_0x52a671,null));};exports['update']=function(_0x5e811e,_0x4be2e9){if(_0x5e811e['body']['id']){delete _0x5e811e[_0xbe4a('0x51')]['id'];}return db[_0xbe4a('0x31')][_0xbe4a('0x4e')]({'where':{'id':_0x5e811e[_0xbe4a('0x4c')]['id']}})[_0xbe4a('0x2b')](handleEntityNotFound(_0x4be2e9,null))['then'](saveUpdates(_0x5e811e[_0xbe4a('0x51')],null))[_0xbe4a('0x2b')](respondWithResult(_0x4be2e9,null))[_0xbe4a('0x4f')](handleError(_0x4be2e9,null));};exports[_0xbe4a('0x5b')]=function(_0x1d0525,_0x317c49){var _0x1ae955=_0x1d0525[_0xbe4a('0x4c')]['id'];var _0x5e1db3=[];return db[_0xbe4a('0x5c')][_0xbe4a('0x5d')](function(_0x369dbe){var _0x35adaf=_0xbe4a('0x5e')+_0x1ae955;return db[_0xbe4a('0x5c')][_0xbe4a('0x3a')](_0x35adaf,{'type':db[_0xbe4a('0x5f')][_0xbe4a('0x60')][_0xbe4a('0x61')],'raw':!![],'transaction':_0x369dbe})[_0xbe4a('0x2b')](function(_0x4776b7){_0x5e1db3=_['map'](_0x4776b7,function(_0xc57717){return Number(_0xc57717[_0xbe4a('0x62')]);});})[_0xbe4a('0x2b')](function(){var _0x3a1b33=_0xbe4a('0x63')+_0x1ae955;return db[_0xbe4a('0x5c')][_0xbe4a('0x3a')](_0x3a1b33,{'type':db['Sequelize']['QueryTypes'][_0xbe4a('0x61')],'raw':!![],'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(_0x3f91da){var _0xb7effe=_[_0xbe4a('0x30')](_0x3f91da,function(_0x40786d){return Number(_0x40786d[_0xbe4a('0x64')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x5e1db3},'VoiceQueueId':{'$in':_0xb7effe}},'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(){var _0x3c1c24=_0xbe4a('0x65')+_0x1ae955;return db['sequelize'][_0xbe4a('0x3a')](_0x3c1c24,{'type':db[_0xbe4a('0x5f')]['QueryTypes'][_0xbe4a('0x61')],'raw':!![],'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(_0xd67c99){var _0x2568d4=_[_0xbe4a('0x30')](_0xd67c99,function(_0x597963){return Number(_0x597963[_0xbe4a('0x66')]);});return db['UserMailQueue'][_0xbe4a('0x5b')]({'where':{'UserId':{'$in':_0x5e1db3},'MailQueueId':{'$in':_0x2568d4}},'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(){var _0x361ffe=_0xbe4a('0x67')+_0x1ae955;return db[_0xbe4a('0x5c')]['query'](_0x361ffe,{'type':db[_0xbe4a('0x5f')][_0xbe4a('0x60')]['SELECT'],'raw':!![],'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(_0x3e3a4e){var _0x770a2c=_['map'](_0x3e3a4e,function(_0x5ef5b8){return Number(_0x5ef5b8[_0xbe4a('0x68')]);});return db[_0xbe4a('0x69')][_0xbe4a('0x5b')]({'where':{'UserId':{'$in':_0x5e1db3},'SmsQueueId':{'$in':_0x770a2c}},'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(){var _0x337899='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1ae955;return db[_0xbe4a('0x5c')]['query'](_0x337899,{'type':db['Sequelize'][_0xbe4a('0x60')]['SELECT'],'raw':!![],'transaction':_0x369dbe});})['then'](function(_0x5e63ad){var _0x219ecd=_[_0xbe4a('0x30')](_0x5e63ad,function(_0x368e26){return Number(_0x368e26[_0xbe4a('0x6a')]);});return db[_0xbe4a('0x6b')][_0xbe4a('0x5b')]({'where':{'UserId':{'$in':_0x5e1db3},'ChatQueueId':{'$in':_0x219ecd}},'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(){var _0x5765cd=_0xbe4a('0x6c')+_0x1ae955;return db[_0xbe4a('0x5c')][_0xbe4a('0x3a')](_0x5765cd,{'type':db[_0xbe4a('0x5f')][_0xbe4a('0x60')][_0xbe4a('0x61')],'raw':!![],'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(_0x227d62){var _0x4963e2=_[_0xbe4a('0x30')](_0x227d62,function(_0x21d6f3){return Number(_0x21d6f3[_0xbe4a('0x6d')]);});return db[_0xbe4a('0x6e')][_0xbe4a('0x5b')]({'where':{'UserId':{'$in':_0x5e1db3},'FaxQueueId':{'$in':_0x4963e2}},'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(){var _0x4e7966='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1ae955;return db[_0xbe4a('0x5c')][_0xbe4a('0x3a')](_0x4e7966,{'type':db[_0xbe4a('0x5f')][_0xbe4a('0x60')][_0xbe4a('0x61')],'raw':!![],'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(_0x1191a6){var _0x45ac7a=_[_0xbe4a('0x30')](_0x1191a6,function(_0x1d48eb){return Number(_0x1d48eb[_0xbe4a('0x6f')]);});return db[_0xbe4a('0x70')][_0xbe4a('0x5b')]({'where':{'UserId':{'$in':_0x5e1db3},'OpenchannelQueueId':{'$in':_0x45ac7a}},'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(){var _0x9e4b9d=_0xbe4a('0x71')+_0x1ae955;return db[_0xbe4a('0x5c')][_0xbe4a('0x3a')](_0x9e4b9d,{'type':db[_0xbe4a('0x5f')][_0xbe4a('0x60')][_0xbe4a('0x61')],'raw':!![],'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(_0x2c0b0b){var _0x5e61bb=_['map'](_0x2c0b0b,function(_0x423533){return Number(_0x423533[_0xbe4a('0x72')]);});return db['UserWhatsappQueue'][_0xbe4a('0x5b')]({'where':{'UserId':{'$in':_0x5e1db3},'WhatsappQueueId':{'$in':_0x5e61bb}},'transaction':_0x369dbe});})['then'](function(){return db[_0xbe4a('0x73')][_0xbe4a('0x4e')]({'where':{'TeamId':_0x1ae955}});})[_0xbe4a('0x2b')](function(_0x1bb9e6){if(_0x1bb9e6===null){return;}return db['UserVoicePrefix'][_0xbe4a('0x5b')]({'where':{'UserId':{'$in':_0x5e1db3},'VoicePrefixId':_0x1bb9e6[_0xbe4a('0x74')]},'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(){return db[_0xbe4a('0x31')][_0xbe4a('0x5b')]({'where':{'id':_0x1ae955},'cascade':!![],'transaction':_0x369dbe});})[_0xbe4a('0x2b')](function(_0x661cef){if(_0x661cef===0x0){_0x317c49[_0xbe4a('0x20')](0x194);}else{return db[_0xbe4a('0x59')][_0xbe4a('0x5b')]({'where':{'type':'Teams','resourceId':_0x1ae955},'cascade':!![],'transaction':_0x369dbe})[_0xbe4a('0x2b')](function(){_0x317c49[_0xbe4a('0x21')](0xcc)[_0xbe4a('0x75')]();});}})['catch'](function(_0xb1bbb4){_0x317c49[_0xbe4a('0x21')](0x1f4)[_0xbe4a('0x2e')](_0xb1bbb4);});});};exports[_0xbe4a('0x76')]=function(_0x4281ff,_0x16a00d,_0x1f8209){return db[_0xbe4a('0x31')][_0xbe4a('0x77')]({'where':{'id':_0x4281ff['params']['id']}})[_0xbe4a('0x2b')](handleEntityNotFound(_0x16a00d,null))[_0xbe4a('0x2b')](function(_0x3342fd){if(!_0x4281ff[_0xbe4a('0x3a')][_0xbe4a('0x78')]||!utils[_0xbe4a('0x79')](_0x4281ff[_0xbe4a('0x3a')][_0xbe4a('0x78')])){throw new db['Sequelize'][(_0xbe4a('0x7a'))](_0xbe4a('0x7b'));}var _0x402fb3={};var _0x486862={};_0x486862['model']=_[_0xbe4a('0x4d')](db[_['capitalize'](_0x4281ff[_0xbe4a('0x3a')]['channel'][_0xbe4a('0x7c')]())+'Queue'][_0xbe4a('0x32')]);_0x486862[_0xbe4a('0x3a')]=_[_0xbe4a('0x4d')](_0x4281ff['query']);_0x486862['filters']=_[_0xbe4a('0x39')](_0x486862[_0xbe4a('0x36')],_0x486862['query']);_0x402fb3[_0xbe4a('0x3b')]=_['intersection'](_0x486862[_0xbe4a('0x36')],qs[_0xbe4a('0x3c')](_0x4281ff[_0xbe4a('0x3a')][_0xbe4a('0x3c')]));_0x402fb3[_0xbe4a('0x3b')]=_0x402fb3[_0xbe4a('0x3b')][_0xbe4a('0x3d')]?_0x402fb3[_0xbe4a('0x3b')]:_0x486862[_0xbe4a('0x36')];_0x402fb3[_0xbe4a('0x24')]=qs['limit'](_0x4281ff[_0xbe4a('0x3a')][_0xbe4a('0x24')]);_0x402fb3[_0xbe4a('0x25')]=qs['offset'](_0x4281ff[_0xbe4a('0x3a')][_0xbe4a('0x25')]);_0x402fb3[_0xbe4a('0x3f')]=qs[_0xbe4a('0x40')](_0x4281ff[_0xbe4a('0x3a')][_0xbe4a('0x40')]);_0x402fb3['where']=qs[_0xbe4a('0x38')](_['pick'](_0x4281ff[_0xbe4a('0x3a')],_0x486862['filters']));_0x402fb3=_[_0xbe4a('0x44')]({},_0x402fb3,_0x4281ff[_0xbe4a('0x45')]);return _0x3342fd[_0xbe4a('0x55')+_[_0xbe4a('0x7d')](_0x4281ff[_0xbe4a('0x3a')][_0xbe4a('0x78')][_0xbe4a('0x7c')]())+'Queues'](_0x402fb3);})['then'](respondWithResult(_0x16a00d,null))[_0xbe4a('0x4f')](handleError(_0x16a00d,null));};exports[_0xbe4a('0x7e')]=function(_0x50596f,_0x2d6567,_0x1c1264){return db['Team'][_0xbe4a('0x77')]({'where':{'id':_0x50596f[_0xbe4a('0x4c')]['id']}})[_0xbe4a('0x2b')](function(_0x185bb9){if(_0x185bb9){if(!_0x50596f[_0xbe4a('0x51')]['channel']||!utils['isValidChannel'](_0x50596f['body'][_0xbe4a('0x78')])){throw new db[(_0xbe4a('0x5f'))][(_0xbe4a('0x7a'))]('Unknown\x20channel');}return _0x185bb9['add'+_[_0xbe4a('0x7d')](_0x50596f[_0xbe4a('0x51')][_0xbe4a('0x78')][_0xbe4a('0x7c')]())+_0xbe4a('0x7f')](_0x50596f['body']['ids']);}return null;})[_0xbe4a('0x2b')](handleEntityNotFound(_0x2d6567,null))['then'](respondWithStatusCode(_0x2d6567,null))['catch'](handleError(_0x2d6567,null));};exports[_0xbe4a('0x80')]=function(_0x2fc94f,_0x10acf7,_0x2636eb){return db[_0xbe4a('0x31')][_0xbe4a('0x77')]({'where':{'id':_0x2fc94f[_0xbe4a('0x4c')]['id']}})[_0xbe4a('0x2b')](function(_0x41ab67){if(_0x41ab67){if(!_0x2fc94f[_0xbe4a('0x3a')][_0xbe4a('0x78')]||!utils[_0xbe4a('0x79')](_0x2fc94f[_0xbe4a('0x3a')][_0xbe4a('0x78')])){throw new db[(_0xbe4a('0x5f'))][(_0xbe4a('0x7a'))](_0xbe4a('0x7b'));}return _0x41ab67[_0xbe4a('0x81')+_[_0xbe4a('0x7d')](_0x2fc94f[_0xbe4a('0x3a')][_0xbe4a('0x78')][_0xbe4a('0x7c')]())+_0xbe4a('0x7f')](_0x2fc94f['query'][_0xbe4a('0x82')]);}return null;})['then'](handleEntityNotFound(_0x10acf7,null))['then'](respondWithStatusCode(_0x10acf7,null))[_0xbe4a('0x4f')](handleError(_0x10acf7,null));};exports['addAgents']=function(_0x46609b,_0x5d6e29){var _0x35a4ee=_['isArray'](_0x46609b[_0xbe4a('0x51')]['ids'])?_0x46609b['body'][_0xbe4a('0x82')]:[_0x46609b['body'][_0xbe4a('0x82')]];var _0x460e91=_0x46609b[_0xbe4a('0x4c')]['id'];return db['Team'][_0xbe4a('0x4e')]({'where':{'id':_0x460e91}})[_0xbe4a('0x2b')](handleEntityNotFound(_0x5d6e29,null))[_0xbe4a('0x2b')](function(_0x10a111){if(_0x10a111){var _0x5332c1=[_0xbe4a('0x83'),_0xbe4a('0x84'),_0xbe4a('0x85'),'Sms',_0xbe4a('0x86'),_0xbe4a('0x87'),_0xbe4a('0x88')];return db[_0xbe4a('0x5c')][_0xbe4a('0x5d')](function(_0x2aa49e){var _0x354229=_[_0xbe4a('0x30')](_0x5332c1,function(_0x346217){var _0xc29118={'attributes':['id',_0xbe4a('0x37')]};if(_0x346217==='Voice'){_0xc29118['through']={'attributes':[_0xbe4a('0x89')]};}return _0x10a111[_0xbe4a('0x55')+_0x346217+_0xbe4a('0x7f')](_0xc29118)[_0xbe4a('0x2b')](function(_0x370c84){var _0x1ca6a7=_[_0xbe4a('0x30')](_0x370c84,function(_0x2ad7f5){var _0x3616bd=_[_0xbe4a('0x30')](_0x35a4ee,function(_0x155879){var _0x44c5bf={'where':{'UserId':_0x155879,[_0x346217+_0xbe4a('0x8a')]:_0x2ad7f5['id']},'transaction':_0x2aa49e};if(_0x346217===_0xbe4a('0x83')){_0x44c5bf[_0xbe4a('0x1b')]={'penalty':_0x2ad7f5[_0xbe4a('0x8b')]['penalty']};}return db[_0xbe4a('0x8c')+_0x346217+'Queue']['findOrCreate'](_0x44c5bf)['then'](function(){socket[_0xbe4a('0x8d')](_0xbe4a('0x52')+_0x346217+_0xbe4a('0x8e'),{'UserId':_0x155879,[_0x346217+_0xbe4a('0x8a')]:_0x2ad7f5['id']});if(_0x346217!==_0xbe4a('0x83')){return;}return db['User'][_0xbe4a('0x49')]({'where':{'id':_0x35a4ee,'online':0x1},'attributes':['id',_0xbe4a('0x37'),_0xbe4a('0x8f'),_0xbe4a('0x90'),_0xbe4a('0x91')],'raw':!![]})['then'](function(_0x1f058f){var _0x1c9636=_[_0xbe4a('0x30')](_0x1f058f,function(_0x2394c8){return db[_0xbe4a('0x92')][_0xbe4a('0x93')]({'membername':_0x2394c8[_0xbe4a('0x37')],'UserId':_0x2394c8['id'],'queue_name':_0x2ad7f5[_0xbe4a('0x37')],'VoiceQueueId':_0x2ad7f5['id'],'interface':_[_0xbe4a('0x94')](_0x2394c8[_0xbe4a('0x91')])?util[_0xbe4a('0x95')](_0xbe4a('0x96'),_0x2394c8[_0xbe4a('0x37')]):_0x2394c8[_0xbe4a('0x91')],'paused':_0x2394c8[_0xbe4a('0x90')]||![],'penalty':_0x2ad7f5[_0xbe4a('0x8b')]['penalty']},{'transaction':_0x2aa49e});});return Promise['all'](_0x1c9636);});});});return Promise[_0xbe4a('0x97')](_0x3616bd);});return Promise[_0xbe4a('0x97')](_0x1ca6a7);})['then'](function(){return db[_0xbe4a('0x73')]['findOne']({'where':{'teamId':_0x460e91}})[_0xbe4a('0x2b')](function(_0x73f032){if(_0x73f032){var _0x381d1b=_[_0xbe4a('0x30')](_0x35a4ee,function(_0x1d165e){db[_0xbe4a('0x98')][_0xbe4a('0x93')]({'UserId':_0x1d165e,'VoicePrefixId':_0x73f032[_0xbe4a('0x74')]});});return Promise[_0xbe4a('0x97')](_0x381d1b);}});});});return Promise[_0xbe4a('0x97')](_0x354229)[_0xbe4a('0x2b')](function(){return _0x10a111[_0xbe4a('0x99')](_0x35a4ee,{'transaction':_0x2aa49e})[_0xbe4a('0x9a')](function(_0x3ba757){return _0x3ba757;});});});}})[_0xbe4a('0x2b')](respondWithResult(_0x5d6e29,null))[_0xbe4a('0x4f')](handleError(_0x5d6e29,null));};exports[_0xbe4a('0x9b')]=function(_0x451d84,_0x2acabf){var _0x272c87=_['isArray'](_0x451d84[_0xbe4a('0x3a')][_0xbe4a('0x82')])?_0x451d84[_0xbe4a('0x3a')][_0xbe4a('0x82')]:[_0x451d84[_0xbe4a('0x3a')][_0xbe4a('0x82')]];var _0x3dcbb9=_0x451d84[_0xbe4a('0x4c')]['id'];return db[_0xbe4a('0x31')][_0xbe4a('0x4e')]({'where':{'id':_0x3dcbb9}})[_0xbe4a('0x2b')](handleEntityNotFound(_0x2acabf,null))[_0xbe4a('0x2b')](function(_0x5969b8){if(_0x5969b8){var _0x51f244=[_0xbe4a('0x83'),'Chat',_0xbe4a('0x85'),_0xbe4a('0x9c'),_0xbe4a('0x86'),'Openchannel',_0xbe4a('0x88')];return db[_0xbe4a('0x5c')][_0xbe4a('0x5d')](function(_0x39f712){var _0x385981=_[_0xbe4a('0x30')](_0x51f244,function(_0x2a534b){var _0x3bcbd3={'attributes':['id',_0xbe4a('0x37')]};return _0x5969b8[_0xbe4a('0x55')+_0x2a534b+_0xbe4a('0x7f')](_0x3bcbd3)['then'](function(_0x4b995f){var _0x451e24=_[_0xbe4a('0x30')](_0x4b995f,function(_0x4fecaa){return _0x4fecaa[_0xbe4a('0x9b')](_0x272c87,{'transaction':_0x39f712})[_0xbe4a('0x2b')](function(){var _0x181815=_['map'](_0x272c87,function(_0x28d295){socket[_0xbe4a('0x8d')](_0xbe4a('0x52')+_0x2a534b+'Queue:remove',{'UserId':Number(_0x28d295),[_0x2a534b+'QueueId']:_0x4fecaa['id']});if(_0x2a534b!=='Voice'){return;}return db[_0xbe4a('0x92')][_0xbe4a('0x5b')]({'where':{'VoiceQueueId':_0x4fecaa['id'],'UserId':_0x28d295},'transaction':_0x39f712});});return Promise[_0xbe4a('0x97')](_0x181815);});});return Promise[_0xbe4a('0x97')](_0x451e24);});});return Promise['all'](_0x385981)['then'](function(){return _0x5969b8[_0xbe4a('0x9b')](_0x272c87,{'transaction':_0x39f712});})['then'](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x3dcbb9}})[_0xbe4a('0x2b')](function(_0xe9d7fe){if(_0xe9d7fe){var _0x1f24a6=_['map'](_0x272c87,function(_0x253925){db['UserVoicePrefix'][_0xbe4a('0x5b')]({'where':{'UserId':_0x253925,'VoicePrefixId':_0xe9d7fe[_0xbe4a('0x74')]}});});return Promise['all'](_0x1f24a6);}});});});}})[_0xbe4a('0x2b')](respondWithStatusCode(_0x2acabf,null))[_0xbe4a('0x4f')](handleError(_0x2acabf,null));};exports[_0xbe4a('0x9d')]=function(_0x581f37,_0x412392,_0x655e6b){var _0x34e9a4={};var _0x3ad9c4={};var _0x45663d;var _0x45fab3;return db[_0xbe4a('0x31')][_0xbe4a('0x77')]({'where':{'id':_0x581f37['params']['id']}})[_0xbe4a('0x2b')](handleEntityNotFound(_0x412392,null))[_0xbe4a('0x2b')](function(_0x5f26eb){if(_0x5f26eb){_0x45663d=_0x5f26eb;_0x3ad9c4[_0xbe4a('0x36')]=_[_0xbe4a('0x4d')](db['User'][_0xbe4a('0x32')]);_0x3ad9c4[_0xbe4a('0x3a')]=_[_0xbe4a('0x4d')](_0x581f37[_0xbe4a('0x3a')]);_0x3ad9c4['filters']=_[_0xbe4a('0x39')](_0x3ad9c4[_0xbe4a('0x36')],_0x3ad9c4[_0xbe4a('0x3a')]);_0x34e9a4['attributes']=_[_0xbe4a('0x39')](_0x3ad9c4[_0xbe4a('0x36')],qs[_0xbe4a('0x3c')](_0x581f37[_0xbe4a('0x3a')][_0xbe4a('0x3c')]));_0x34e9a4['attributes']=_0x34e9a4['attributes'][_0xbe4a('0x3d')]?_0x34e9a4['attributes']:_0x3ad9c4[_0xbe4a('0x36')];_0x34e9a4['order']=qs[_0xbe4a('0x40')](_0x581f37[_0xbe4a('0x3a')][_0xbe4a('0x40')]);_0x34e9a4[_0xbe4a('0x41')]=qs['filters'](_[_0xbe4a('0x42')](_0x581f37[_0xbe4a('0x3a')],_0x3ad9c4[_0xbe4a('0x38')]));if(_0x581f37[_0xbe4a('0x3a')]['filter']){_0x34e9a4[_0xbe4a('0x41')]=_[_0xbe4a('0x44')](_0x34e9a4[_0xbe4a('0x41')],{'$or':_[_0xbe4a('0x30')](_0x34e9a4[_0xbe4a('0x3b')],function(_0x1026d9){var _0x2c4dc1={};_0x2c4dc1[_0x1026d9]={'$like':'%'+_0x581f37[_0xbe4a('0x3a')]['filter']+'%'};return _0x2c4dc1;})});}_0x34e9a4=_[_0xbe4a('0x44')]({},_0x34e9a4,_0x581f37['options']);return _0x45663d['getAgents'](_0x34e9a4);}})[_0xbe4a('0x2b')](function(_0x2e7d03){if(_0x2e7d03){_0x45fab3=_0x2e7d03[_0xbe4a('0x3d')];if(!_0x581f37[_0xbe4a('0x3a')]['hasOwnProperty'](_0xbe4a('0x9e'))){_0x34e9a4[_0xbe4a('0x24')]=qs[_0xbe4a('0x24')](_0x581f37[_0xbe4a('0x3a')][_0xbe4a('0x24')]);_0x34e9a4['offset']=qs[_0xbe4a('0x25')](_0x581f37['query'][_0xbe4a('0x25')]);}return _0x45663d[_0xbe4a('0x9d')](_0x34e9a4);}})['then'](function(_0x5e84a9){if(_0x5e84a9){return _0x5e84a9?{'count':_0x45fab3,'rows':_0x5e84a9}:null;}})[_0xbe4a('0x2b')](respondWithResult(_0x412392,null))[_0xbe4a('0x4f')](handleError(_0x412392,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index cce19c0..fcd42b6 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 _0xb896=['save','hasOwnProperty','exports','events','../../mysqldb','Team'];(function(_0x2b0a4d,_0x5b2c7f){var _0x446074=function(_0x4d4e09){while(--_0x4d4e09){_0x2b0a4d['push'](_0x2b0a4d['shift']());}};_0x446074(++_0x5b2c7f);}(_0xb896,0x171));var _0x6b89=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xb896[_0x1bd323];return _0x13097b;};'use strict';var EventEmitter=require(_0x6b89('0x0'));var Team=require(_0x6b89('0x1'))['db'][_0x6b89('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b89('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x271309){return function(_0x1677e5,_0x4963fa,_0x5877fe){TeamEvents['emit'](_0x271309+':'+_0x1677e5['id'],_0x1677e5);TeamEvents['emit'](_0x271309,_0x1677e5);_0x5877fe(null);};}for(var e in events){if(events[_0x6b89('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x6b89('0x5')]=TeamEvents; \ No newline at end of file +var _0x6c1f=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4caf24,_0x161c87){var _0x1ace61=function(_0x52198f){while(--_0x52198f){_0x4caf24['push'](_0x4caf24['shift']());}};_0x1ace61(++_0x161c87);}(_0x6c1f,0x19b));var _0xf6c1=function(_0x4edc12,_0x244c5f){_0x4edc12=_0x4edc12-0x0;var _0x3564a7=_0x6c1f[_0x4edc12];return _0x3564a7;};'use strict';var EventEmitter=require(_0xf6c1('0x0'));var Team=require(_0xf6c1('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xf6c1('0x2')](0x0);var events={'afterCreate':_0xf6c1('0x3'),'afterUpdate':_0xf6c1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1836ef){return function(_0x1c5801,_0x21fe4e,_0x10c412){TeamEvents['emit'](_0x1836ef+':'+_0x1c5801['id'],_0x1c5801);TeamEvents['emit'](_0x1836ef,_0x1c5801);_0x10c412(null);};}for(var e in events){if(events[_0xf6c1('0x5')](e)){var event=events[e];Team[_0xf6c1('0x6')](e,emitEvent(event));}}module[_0xf6c1('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 65811f5..b37a46e 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 _0x97e1=['Queues','then','setDataValue','channel','catch','exports','define','teams','Fax','Openchannel','Sms','map','all','./team.attributes'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x97e1,0x109));var _0x197e=function(_0x5338fe,_0x5e71d1){_0x5338fe=_0x5338fe-0x0;var _0xf0a1be=_0x97e1[_0x5338fe];return _0xf0a1be;};'use strict';var _=require('lodash');var attributes=require(_0x197e('0x0'));function getQueuesByChannel(_0x2846da,_0x2e3b88){var _0x533de3='get'+_0x2e3b88+_0x197e('0x1');return _0x2846da[_0x533de3]()[_0x197e('0x2')](function(_0x5ee9e3){return _['map'](_0x5ee9e3,function(_0x2b2643){_0x2b2643[_0x197e('0x3')](_0x197e('0x4'),_0x2e3b88);return _0x2b2643;});})[_0x197e('0x5')](function(_0x3ffdb0){throw _0x3ffdb0;});}module[_0x197e('0x6')]=function(_0x9e10d3){return _0x9e10d3[_0x197e('0x7')]('Team',attributes,{'tableName':_0x197e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x396b4e=this;var _0x385e44=['Chat',_0x197e('0x9'),'Mail',_0x197e('0xa'),_0x197e('0xb'),'Voice','Whatsapp'];return Promise['resolve']()['then'](function(){var _0x19d1bf=_[_0x197e('0xc')](_0x385e44,function(_0x477bb9){return getQueuesByChannel(_0x396b4e,_0x477bb9);});return Promise[_0x197e('0xd')](_0x19d1bf);})[_0x197e('0x5')](function(_0x4a74be){throw _0x4a74be;});}}});}; \ No newline at end of file +var _0xb7b8=['resolve','map','all','lodash','then','setDataValue','channel','catch','define','Team','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp'];(function(_0x579b2d,_0x557f5e){var _0x2ff6bb=function(_0x5794d4){while(--_0x5794d4){_0x579b2d['push'](_0x579b2d['shift']());}};_0x2ff6bb(++_0x557f5e);}(_0xb7b8,0x168));var _0x8b7b=function(_0xdca828,_0x9f1c83){_0xdca828=_0xdca828-0x0;var _0x33b7dd=_0xb7b8[_0xdca828];return _0x33b7dd;};'use strict';var _=require(_0x8b7b('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x4295ae,_0x5b1c07){var _0x1c5d7e='get'+_0x5b1c07+'Queues';return _0x4295ae[_0x1c5d7e]()[_0x8b7b('0x1')](function(_0x27002e){return _['map'](_0x27002e,function(_0x494d6d){_0x494d6d[_0x8b7b('0x2')](_0x8b7b('0x3'),_0x5b1c07);return _0x494d6d;});})[_0x8b7b('0x4')](function(_0x4c5ff6){throw _0x4c5ff6;});}module['exports']=function(_0x30e068){return _0x30e068[_0x8b7b('0x5')](_0x8b7b('0x6'),attributes,{'tableName':_0x8b7b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x48d5b8=this;var _0x5a1535=[_0x8b7b('0x8'),_0x8b7b('0x9'),_0x8b7b('0xa'),'Openchannel',_0x8b7b('0xb'),_0x8b7b('0xc'),_0x8b7b('0xd')];return Promise[_0x8b7b('0xe')]()[_0x8b7b('0x1')](function(){var _0x58dc68=_[_0x8b7b('0xf')](_0x5a1535,function(_0x53b548){return getQueuesByChannel(_0x48d5b8,_0x53b548);});return Promise[_0x8b7b('0x10')](_0x58dc68);})[_0x8b7b('0x4')](function(_0x1ff485){throw _0x1ff485;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d90f45f..0418f52 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 _0xea03=['request','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xea03,0xda));var _0x3ea0=function(_0x2cb111,_0x3c5f83){_0x2cb111=_0x2cb111-0x0;var _0x52d31d=_0xea03[_0x2cb111];return _0x52d31d;};'use strict';var _=require(_0x3ea0('0x0'));var util=require(_0x3ea0('0x1'));var moment=require(_0x3ea0('0x2'));var BPromise=require(_0x3ea0('0x3'));var rs=require(_0x3ea0('0x4'));var fs=require('fs');var Redis=require(_0x3ea0('0x5'));var db=require(_0x3ea0('0x6'))['db'];var utils=require(_0x3ea0('0x7'));var logger=require(_0x3ea0('0x8'))(_0x3ea0('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ea0('0xa')][_0x3ea0('0xb')]({'port':0x232a});config[_0x3ea0('0xc')]=_[_0x3ea0('0xd')](config[_0x3ea0('0xc')],{'host':_0x3ea0('0xe'),'port':0x18eb});var socket=require(_0x3ea0('0xf'))(new Redis(config[_0x3ea0('0xc')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x1af248,_0x2eb82c,_0x44b6a9){return new BPromise(function(_0x48c69a,_0x37f60e){return client[_0x3ea0('0x10')](_0x1af248,_0x44b6a9)['then'](function(_0x1b4c6b){logger[_0x3ea0('0x11')](_0x3ea0('0x12'),_0x2eb82c,'request\x20sent');logger['debug'](_0x3ea0('0x13'),_0x2eb82c,_0x3ea0('0x14'),JSON[_0x3ea0('0x15')](_0x1b4c6b));if(_0x1b4c6b[_0x3ea0('0x16')]){if(_0x1b4c6b[_0x3ea0('0x16')]['code']===0x1f4){logger[_0x3ea0('0x16')](_0x3ea0('0x12'),_0x2eb82c,_0x1b4c6b[_0x3ea0('0x16')][_0x3ea0('0x17')]);return _0x37f60e(_0x1b4c6b[_0x3ea0('0x16')][_0x3ea0('0x17')]);}logger[_0x3ea0('0x16')](_0x3ea0('0x12'),_0x2eb82c,_0x1b4c6b[_0x3ea0('0x16')][_0x3ea0('0x17')]);return _0x48c69a(_0x1b4c6b[_0x3ea0('0x16')][_0x3ea0('0x17')]);}else{logger[_0x3ea0('0x11')](_0x3ea0('0x12'),_0x2eb82c,_0x3ea0('0x14'));_0x48c69a(_0x1b4c6b[_0x3ea0('0x18')][_0x3ea0('0x17')]);}})[_0x3ea0('0x19')](function(_0x2ee641){logger[_0x3ea0('0x16')](_0x3ea0('0x12'),_0x2eb82c,_0x2ee641);_0x37f60e(_0x2ee641);});});} \ No newline at end of file +var _0x94a1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./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','result','catch','lodash'];(function(_0x5cf608,_0x3ed79a){var _0x1e1560=function(_0xaf6e8f){while(--_0xaf6e8f){_0x5cf608['push'](_0x5cf608['shift']());}};_0x1e1560(++_0x3ed79a);}(_0x94a1,0x8b));var _0x194a=function(_0x4d8858,_0x1a1e7f){_0x4d8858=_0x4d8858-0x0;var _0x35e541=_0x94a1[_0x4d8858];return _0x35e541;};'use strict';var _=require(_0x194a('0x0'));var util=require('util');var moment=require(_0x194a('0x1'));var BPromise=require(_0x194a('0x2'));var rs=require(_0x194a('0x3'));var fs=require('fs');var Redis=require(_0x194a('0x4'));var db=require(_0x194a('0x5'))['db'];var utils=require(_0x194a('0x6'));var logger=require(_0x194a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x194a('0x8'));var client=jayson[_0x194a('0x9')][_0x194a('0xa')]({'port':0x232a});config[_0x194a('0xb')]=_['defaults'](config[_0x194a('0xb')],{'host':_0x194a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x194a('0xb')]));require(_0x194a('0xd'))[_0x194a('0xe')](socket);function respondWithRpcPromise(_0x463728,_0x19ec81,_0x585812){return new BPromise(function(_0x223364,_0x5a43ac){return client[_0x194a('0xf')](_0x463728,_0x585812)[_0x194a('0x10')](function(_0x94ad42){logger[_0x194a('0x11')](_0x194a('0x12'),_0x19ec81,_0x194a('0x13'));logger[_0x194a('0x14')](_0x194a('0x15'),_0x19ec81,_0x194a('0x13'),JSON[_0x194a('0x16')](_0x94ad42));if(_0x94ad42[_0x194a('0x17')]){if(_0x94ad42['error'][_0x194a('0x18')]===0x1f4){logger['error'](_0x194a('0x12'),_0x19ec81,_0x94ad42['error'][_0x194a('0x19')]);return _0x5a43ac(_0x94ad42[_0x194a('0x17')][_0x194a('0x19')]);}logger[_0x194a('0x17')](_0x194a('0x12'),_0x19ec81,_0x94ad42[_0x194a('0x17')][_0x194a('0x19')]);return _0x223364(_0x94ad42[_0x194a('0x17')][_0x194a('0x19')]);}else{logger[_0x194a('0x11')](_0x194a('0x12'),_0x19ec81,_0x194a('0x13'));_0x223364(_0x94ad42[_0x194a('0x1a')][_0x194a('0x19')]);}})[_0x194a('0x1b')](function(_0x81b402){logger['error'](_0x194a('0x12'),_0x19ec81,_0x81b402);_0x5a43ac(_0x81b402);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 6a77168..6373353 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 _0x88de=['save','remove','update','emit','removeListener','length','./team.events'];(function(_0x22d667,_0x4ab6f6){var _0xc8eba0=function(_0x217df2){while(--_0x217df2){_0x22d667['push'](_0x22d667['shift']());}};_0xc8eba0(++_0x4ab6f6);}(_0x88de,0x19c));var _0xe88d=function(_0x410e08,_0x44d426){_0x410e08=_0x410e08-0x0;var _0x4c4169=_0x88de[_0x410e08];return _0x4c4169;};'use strict';var TeamEvents=require(_0xe88d('0x0'));var events=[_0xe88d('0x1'),_0xe88d('0x2'),_0xe88d('0x3')];function createListener(_0x5a5996,_0x487ce1){return function(_0x49b8fa){_0x487ce1[_0xe88d('0x4')](_0x5a5996,_0x49b8fa);};}function removeListener(_0x404d05,_0x4c989b){return function(){TeamEvents[_0xe88d('0x5')](_0x404d05,_0x4c989b);};}exports['register']=function(_0x33ce64){for(var _0x1b94dc=0x0,_0x2b25c0=events[_0xe88d('0x6')];_0x1b94dc<_0x2b25c0;_0x1b94dc++){var _0x1bc40f=events[_0x1b94dc];var _0x11ce50=createListener('team:'+_0x1bc40f,_0x33ce64);TeamEvents['on'](_0x1bc40f,_0x11ce50);}}; \ No newline at end of file +var _0x4f8b=['register','team:','./team.events','save','emit','removeListener'];(function(_0x5f2294,_0x211230){var _0x53cfa4=function(_0x4f6227){while(--_0x4f6227){_0x5f2294['push'](_0x5f2294['shift']());}};_0x53cfa4(++_0x211230);}(_0x4f8b,0x12e));var _0xb4f8=function(_0x4ad008,_0x2582ce){_0x4ad008=_0x4ad008-0x0;var _0x485576=_0x4f8b[_0x4ad008];return _0x485576;};'use strict';var TeamEvents=require(_0xb4f8('0x0'));var events=[_0xb4f8('0x1'),'remove','update'];function createListener(_0x4589ac,_0x33ed66){return function(_0x35fcf9){_0x33ed66[_0xb4f8('0x2')](_0x4589ac,_0x35fcf9);};}function removeListener(_0xf0e7db,_0x5d52cb){return function(){TeamEvents[_0xb4f8('0x3')](_0xf0e7db,_0x5d52cb);};}exports[_0xb4f8('0x4')]=function(_0x4851f2){for(var _0x2768ba=0x0,_0x20dc54=events['length'];_0x2768ba<_0x20dc54;_0x2768ba++){var _0xfd890f=events[_0x2768ba];var _0x1ca5c9=createListener(_0xb4f8('0x5')+_0xfd890f,_0x4851f2);TeamEvents['on'](_0xfd890f,_0x1ca5c9);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 642f279..93ff0e1 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 _0x8ca7=['sequelize'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78ca('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfa4b=['INTEGER','sequelize','exports'];(function(_0x48802c,_0x515f71){var _0x515460=function(_0x48ddb8){while(--_0x48ddb8){_0x48802c['push'](_0x48802c['shift']());}};_0x515460(++_0x515f71);}(_0xfa4b,0x175));var _0xbfa4=function(_0x24e7da,_0x714cb4){_0x24e7da=_0x24e7da-0x0;var _0x2cfed0=_0xfa4b[_0x24e7da];return _0x2cfed0;};'use strict';var Sequelize=require(_0xbfa4('0x0'));module[_0xbfa4('0x1')]={'TeamId':{'type':Sequelize[_0xbfa4('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xbfa4('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5e33a42..d94c11b 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 _0x4af8=['path','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4af8,0x1ad));var _0x84af=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4af8[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x84af('0x0'));var BPromise=require(_0x84af('0x1'));var rp=require(_0x84af('0x2'));var fs=require('fs');var path=require(_0x84af('0x3'));var rimraf=require('rimraf');var config=require(_0x84af('0x4'));var attributes=require(_0x84af('0x5'));module['exports']=function(_0x37c4f9,_0x3971f1){return _0x37c4f9['define'](_0x84af('0x6'),attributes,{'tableName':_0x84af('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x345e=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment'];(function(_0x2a1185,_0x2740c5){var _0x5588d9=function(_0x16024c){while(--_0x16024c){_0x2a1185['push'](_0x2a1185['shift']());}};_0x5588d9(++_0x2740c5);}(_0x345e,0x168));var _0xe345=function(_0x5dbc26,_0x59fe73){_0x5dbc26=_0x5dbc26-0x0;var _0x2397ce=_0x345e[_0x5dbc26];return _0x2397ce;};'use strict';var _=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var logger=require('../../config/logger')(_0xe345('0x2'));var moment=require(_0xe345('0x3'));var BPromise=require(_0xe345('0x4'));var rp=require(_0xe345('0x5'));var fs=require('fs');var path=require(_0xe345('0x6'));var rimraf=require(_0xe345('0x7'));var config=require(_0xe345('0x8'));var attributes=require(_0xe345('0x9'));module[_0xe345('0xa')]=function(_0x575c38,_0x4491a9){return _0x575c38[_0xe345('0xb')](_0xe345('0xc'),attributes,{'tableName':_0xe345('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 7369989..6248136 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x175d6e,_0x1bbb1b){var _0x3ec16d=function(_0x4fa380){while(--_0x4fa380){_0x175d6e['push'](_0x175d6e['shift']());}};_0x3ec16d(++_0x1bbb1b);}(_0xedd9,0xfc));var _0x9edd=function(_0x51a9c8,_0x1e0917){_0x51a9c8=_0x51a9c8-0x0;var _0x5d8b7f=_0xedd9[_0x51a9c8];return _0x5d8b7f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2945bf,_0x4b9ab4){var _0x1c78bb=function(_0xff0f4){while(--_0xff0f4){_0x2945bf['push'](_0x2945bf['shift']());}};_0x1c78bb(++_0x4b9ab4);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f68be0f..d8bd246 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 _0x723e=['INTEGER','exports'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0x723e,0x179));var _0xe723=function(_0x240dc2,_0x587f0b){_0x240dc2=_0x240dc2-0x0;var _0x5a0870=_0x723e[_0x240dc2];return _0x5a0870;};'use strict';var Sequelize=require('sequelize');module[_0xe723('0x0')]={'penalty':{'type':Sequelize[_0xe723('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9ca0=['exports','INTEGER','sequelize'];(function(_0x36926a,_0x37ab96){var _0xda5af2=function(_0x2f10dd){while(--_0x2f10dd){_0x36926a['push'](_0x36926a['shift']());}};_0xda5af2(++_0x37ab96);}(_0x9ca0,0x65));var _0x09ca=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x9ca0[_0x235482];return _0x5f5bea;};'use strict';var Sequelize=require(_0x09ca('0x0'));module[_0x09ca('0x1')]={'penalty':{'type':Sequelize[_0x09ca('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index bd59648..32eb31f 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 _0x0851=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util'];(function(_0x1246b0,_0x52795c){var _0x531d08=function(_0x2cf386){while(--_0x2cf386){_0x1246b0['push'](_0x1246b0['shift']());}};_0x531d08(++_0x52795c);}(_0x0851,0x8a));var _0x1085=function(_0x2dbed7,_0x2962d5){_0x2dbed7=_0x2dbed7-0x0;var _0x326efc=_0x0851[_0x2dbed7];return _0x326efc;};'use strict';var _=require(_0x1085('0x0'));var util=require(_0x1085('0x1'));var logger=require(_0x1085('0x2'))(_0x1085('0x3'));var moment=require('moment');var BPromise=require(_0x1085('0x4'));var rp=require(_0x1085('0x5'));var fs=require('fs');var path=require(_0x1085('0x6'));var rimraf=require(_0x1085('0x7'));var config=require(_0x1085('0x8'));var attributes=require(_0x1085('0x9'));module[_0x1085('0xa')]=function(_0x1c9e36,_0x152eeb){return _0x1c9e36[_0x1085('0xb')](_0x1085('0xc'),attributes,{'tableName':_0x1085('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee24=['TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define'];(function(_0x27c80c,_0x32defa){var _0x5c9c40=function(_0x758456){while(--_0x758456){_0x27c80c['push'](_0x27c80c['shift']());}};_0x5c9c40(++_0x32defa);}(_0xee24,0x1a6));var _0x4ee2=function(_0x3942be,_0x46ae5a){_0x3942be=_0x3942be-0x0;var _0x183c4e=_0xee24[_0x3942be];return _0x183c4e;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var logger=require(_0x4ee2('0x1'))('api');var moment=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var rp=require(_0x4ee2('0x4'));var fs=require('fs');var path=require(_0x4ee2('0x5'));var rimraf=require('rimraf');var config=require(_0x4ee2('0x6'));var attributes=require(_0x4ee2('0x7'));module[_0x4ee2('0x8')]=function(_0x1993de,_0x5c778f){return _0x1993de[_0x4ee2('0x9')](_0x4ee2('0xa'),attributes,{'tableName':_0x4ee2('0xb'),'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 737b749..759f3e3 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 _0x55da=['rpc','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x164609,_0x45890e){var _0x4a1a05=function(_0x3e9601){while(--_0x3e9601){_0x164609['push'](_0x164609['shift']());}};_0x4a1a05(++_0x45890e);}(_0x55da,0x16f));var _0xa55d=function(_0xea35ad,_0x3e07b3){_0xea35ad=_0xea35ad-0x0;var _0x51626f=_0x55da[_0xea35ad];return _0x51626f;};'use strict';var _=require('lodash');var util=require(_0xa55d('0x0'));var moment=require(_0xa55d('0x1'));var BPromise=require(_0xa55d('0x2'));var rs=require(_0xa55d('0x3'));var fs=require('fs');var Redis=require(_0xa55d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa55d('0x5'));var logger=require(_0xa55d('0x6'))(_0xa55d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa55d('0x8'));var client=jayson[_0xa55d('0x9')][_0xa55d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eb0a1,_0x2b15fb,_0x1f516d){return new BPromise(function(_0x18c1fb,_0x1751a5){return client[_0xa55d('0xb')](_0x1eb0a1,_0x1f516d)['then'](function(_0x2de9b0){logger[_0xa55d('0xc')](_0xa55d('0xd'),_0x2b15fb,_0xa55d('0xe'));logger['debug'](_0xa55d('0xf'),_0x2b15fb,_0xa55d('0xe'),JSON[_0xa55d('0x10')](_0x2de9b0));if(_0x2de9b0[_0xa55d('0x11')]){if(_0x2de9b0[_0xa55d('0x11')][_0xa55d('0x12')]===0x1f4){logger['error'](_0xa55d('0xd'),_0x2b15fb,_0x2de9b0[_0xa55d('0x11')][_0xa55d('0x13')]);return _0x1751a5(_0x2de9b0[_0xa55d('0x11')][_0xa55d('0x13')]);}logger[_0xa55d('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2b15fb,_0x2de9b0['error'][_0xa55d('0x13')]);return _0x18c1fb(_0x2de9b0['error'][_0xa55d('0x13')]);}else{logger[_0xa55d('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2b15fb,_0xa55d('0xe'));_0x18c1fb(_0x2de9b0[_0xa55d('0x14')][_0xa55d('0x13')]);}})[_0xa55d('0x15')](function(_0x5311eb){logger[_0xa55d('0x11')](_0xa55d('0xd'),_0x2b15fb,_0x5311eb);_0x1751a5(_0x5311eb);});});} \ No newline at end of file +var _0x5dd6=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0x5dd6,0x140));var _0x65dd=function(_0x5a9197,_0x2a1c8f){_0x5a9197=_0x5a9197-0x0;var _0x4f9431=_0x5dd6[_0x5a9197];return _0x4f9431;};'use strict';var _=require(_0x65dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x65dd('0x1'));var rs=require(_0x65dd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65dd('0x3'))['db'];var utils=require(_0x65dd('0x4'));var logger=require(_0x65dd('0x5'))(_0x65dd('0x6'));var config=require(_0x65dd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x65dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6b180f,_0x5ad516,_0x5cf2a6){return new BPromise(function(_0x45cec0,_0x9b2db9){return client[_0x65dd('0x9')](_0x6b180f,_0x5cf2a6)[_0x65dd('0xa')](function(_0x2a9f4b){logger[_0x65dd('0xb')](_0x65dd('0xc'),_0x5ad516,_0x65dd('0xd'));logger['debug'](_0x65dd('0xe'),_0x5ad516,_0x65dd('0xd'),JSON[_0x65dd('0xf')](_0x2a9f4b));if(_0x2a9f4b[_0x65dd('0x10')]){if(_0x2a9f4b[_0x65dd('0x10')][_0x65dd('0x11')]===0x1f4){logger[_0x65dd('0x10')](_0x65dd('0xc'),_0x5ad516,_0x2a9f4b[_0x65dd('0x10')][_0x65dd('0x12')]);return _0x9b2db9(_0x2a9f4b['error'][_0x65dd('0x12')]);}logger[_0x65dd('0x10')](_0x65dd('0xc'),_0x5ad516,_0x2a9f4b[_0x65dd('0x10')][_0x65dd('0x12')]);return _0x45cec0(_0x2a9f4b[_0x65dd('0x10')][_0x65dd('0x12')]);}else{logger[_0x65dd('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5ad516,'request\x20sent');_0x45cec0(_0x2a9f4b['result'][_0x65dd('0x12')]);}})[_0x65dd('0x13')](function(_0x2de3c7){logger[_0x65dd('0x10')](_0x65dd('0xc'),_0x5ad516,_0x2de3c7);_0x9b2db9(_0x2de3c7);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 21efcd1..426b959 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5942=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','post','put','update','delete'];(function(_0xa8f776,_0x420cbf){var _0x435961=function(_0x241c69){while(--_0x241c69){_0xa8f776['push'](_0xa8f776['shift']());}};_0x435961(++_0x420cbf);}(_0x5942,0x16a));var _0x2594=function(_0x528cd8,_0xace592){_0x528cd8=_0x528cd8-0x0;var _0x3d90c1=_0x5942[_0x528cd8];return _0x3d90c1;};'use strict';var multer=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var path=require(_0x2594('0x2'));var timeout=require(_0x2594('0x3'));var express=require(_0x2594('0x4'));var router=express[_0x2594('0x5')]();var fs_extra=require(_0x2594('0x6'));var auth=require(_0x2594('0x7'));var interaction=require(_0x2594('0x8'));var config=require(_0x2594('0x9'));var controller=require(_0x2594('0xa'));router[_0x2594('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2594('0xb')](_0x2594('0xc'),auth[_0x2594('0xd')](),controller['show']);router[_0x2594('0xe')]('/',auth[_0x2594('0xd')](),controller['create']);router[_0x2594('0xf')]('/:id',auth[_0x2594('0xd')](),controller[_0x2594('0x10')]);router[_0x2594('0x11')]('/:id',auth[_0x2594('0xd')](),controller[_0x2594('0x12')]);module[_0x2594('0x13')]=router; \ No newline at end of file +var _0x6d11=['util','path','express','fs-extra','../../components/auth/service','./template.controller','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer'];(function(_0x5cc8cb,_0x3b049e){var _0xc8e597=function(_0x2ff358){while(--_0x2ff358){_0x5cc8cb['push'](_0x5cc8cb['shift']());}};_0xc8e597(++_0x3b049e);}(_0x6d11,0xbf));var _0x16d1=function(_0x5bd5b3,_0x327c8b){_0x5bd5b3=_0x5bd5b3-0x0;var _0x328209=_0x6d11[_0x5bd5b3];return _0x328209;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var fs_extra=require(_0x16d1('0x4'));var auth=require(_0x16d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16d1('0x6'));router[_0x16d1('0x7')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x9')]);router[_0x16d1('0x7')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x16d1('0xb')]);router[_0x16d1('0xc')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['update']);router[_0x16d1('0xd')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0xe')]);module[_0x16d1('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f6a834b..0226dbd 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 _0xc0ac=['STRING','TEXT'];(function(_0x3e75b0,_0x3450d4){var _0x16fdef=function(_0x518c6b){while(--_0x518c6b){_0x3e75b0['push'](_0x3e75b0['shift']());}};_0x16fdef(++_0x3450d4);}(_0xc0ac,0xc8));var _0xcc0a=function(_0x1d9823,_0x21788f){_0x1d9823=_0x1d9823-0x0;var _0x5334c1=_0xc0ac[_0x1d9823];return _0x5334c1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcc0a('0x0')]},'description':{'type':Sequelize[_0xcc0a('0x0')]},'html':{'type':Sequelize[_0xcc0a('0x1')]}}; \ No newline at end of file +var _0xe340=['sequelize','exports','STRING','TEXT'];(function(_0x4cc1f6,_0x191fce){var _0x4689b1=function(_0x39820a){while(--_0x39820a){_0x4cc1f6['push'](_0x4cc1f6['shift']());}};_0x4689b1(++_0x191fce);}(_0xe340,0x7c));var _0x0e34=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xe340[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require(_0x0e34('0x0'));module[_0x0e34('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e34('0x2')]},'html':{'type':Sequelize[_0x0e34('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f25a985..04ec59a 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 _0x7aab=['ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Templates','UserProfileResource','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','Template','includeAll','include','findAll','catch','show','params','find','create','body','user','role','UserProfileSection','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv'];(function(_0x15f34d,_0x5d1983){var _0x88c73e=function(_0xf52304){while(--_0xf52304){_0x15f34d['push'](_0x15f34d['shift']());}};_0x88c73e(++_0x5d1983);}(_0x7aab,0x1de));var _0xb7aa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7aab[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7aa('0x0'));var zipdir=require(_0xb7aa('0x1'));var jsonpatch=require(_0xb7aa('0x2'));var rp=require(_0xb7aa('0x3'));var moment=require('moment');var BPromise=require(_0xb7aa('0x4'));var Mustache=require('mustache');var util=require(_0xb7aa('0x5'));var path=require(_0xb7aa('0x6'));var sox=require('sox');var csv=require(_0xb7aa('0x7'));var ejs=require(_0xb7aa('0x8'));var fs=require('fs');var fs_extra=require(_0xb7aa('0x9'));var _=require(_0xb7aa('0xa'));var squel=require(_0xb7aa('0xb'));var crypto=require('crypto');var jsforce=require(_0xb7aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb7aa('0x7'));var querystring=require(_0xb7aa('0xd'));var Papa=require('papaparse');var Redis=require(_0xb7aa('0xe'));var authService=require(_0xb7aa('0xf'));var qs=require(_0xb7aa('0x10'));var as=require(_0xb7aa('0x11'));var hardwareService=require(_0xb7aa('0x12'));var logger=require(_0xb7aa('0x13'))(_0xb7aa('0x14'));var utils=require('../../config/utils');var config=require(_0xb7aa('0x15'));var licenseUtil=require(_0xb7aa('0x16'));var db=require(_0xb7aa('0x17'))['db'];function respondWithStatusCode(_0x2bfd06,_0x54a1f0){_0x54a1f0=_0x54a1f0||0xcc;return function(_0x2fc7f9){if(_0x2fc7f9){return _0x2bfd06[_0xb7aa('0x18')](_0x54a1f0);}return _0x2bfd06['status'](_0x54a1f0)[_0xb7aa('0x19')]();};}function respondWithResult(_0x44149e,_0x5c1945){_0x5c1945=_0x5c1945||0xc8;return function(_0x53b712){if(_0x53b712){return _0x44149e['status'](_0x5c1945)[_0xb7aa('0x1a')](_0x53b712);}};}function respondWithFilteredResult(_0x1272d0,_0xd2df92){return function(_0x186d9c){if(_0x186d9c){var _0x395e92=typeof _0xd2df92[_0xb7aa('0x1b')]===_0xb7aa('0x1c')&&typeof _0xd2df92[_0xb7aa('0x1d')]===_0xb7aa('0x1c');var _0x23ddfe=_0x186d9c[_0xb7aa('0x1e')];var _0x1a68a8=_0x395e92?0x0:_0xd2df92[_0xb7aa('0x1b')];var _0x338da9=_0x395e92?_0x186d9c[_0xb7aa('0x1e')]:_0xd2df92[_0xb7aa('0x1b')]+_0xd2df92['limit'];var _0x186cdd;if(_0x338da9>=_0x23ddfe){_0x338da9=_0x23ddfe;_0x186cdd=0xc8;}else{_0x186cdd=0xce;}_0x1272d0['status'](_0x186cdd);return _0x1272d0[_0xb7aa('0x1f')](_0xb7aa('0x20'),_0x1a68a8+'-'+_0x338da9+'/'+_0x23ddfe)['json'](_0x186d9c);}return null;};}function patchUpdates(_0xfdb16f){return function(_0x294c99){try{jsonpatch[_0xb7aa('0x21')](_0x294c99,_0xfdb16f,!![]);}catch(_0x2ee053){return BPromise['reject'](_0x2ee053);}return _0x294c99[_0xb7aa('0x22')]();};}function saveUpdates(_0x29db30,_0x463c11){return function(_0x2f5c1c){if(_0x2f5c1c){return _0x2f5c1c[_0xb7aa('0x23')](_0x29db30)[_0xb7aa('0x24')](function(_0x408f38){return _0x408f38;});}return null;};}function removeEntity(_0x348add,_0x415d71){return function(_0x46234b){if(_0x46234b){return _0x46234b[_0xb7aa('0x25')]()['then'](function(){var _0x3089ec=_0x46234b[_0xb7aa('0x26')]({'plain':!![]});var _0x16152b=_0xb7aa('0x27');return db[_0xb7aa('0x28')]['destroy']({'where':{'type':_0x16152b,'resourceId':_0x3089ec['id']}})[_0xb7aa('0x24')](function(){return _0x46234b;});})[_0xb7aa('0x24')](function(){_0x348add[_0xb7aa('0x29')](0xcc)[_0xb7aa('0x19')]();});}};}function handleEntityNotFound(_0xc9da1c,_0x2f52b0){return function(_0x28b6a5){if(!_0x28b6a5){_0xc9da1c[_0xb7aa('0x18')](0x194);}return _0x28b6a5;};}function handleError(_0x12a20b,_0x246d1a){_0x246d1a=_0x246d1a||0x1f4;return function(_0x36dca8){logger[_0xb7aa('0x2a')](_0x36dca8[_0xb7aa('0x2b')]);if(_0x36dca8['name']){delete _0x36dca8[_0xb7aa('0x2c')];}_0x12a20b[_0xb7aa('0x29')](_0x246d1a)[_0xb7aa('0x2d')](_0x36dca8);};}exports[_0xb7aa('0x2e')]=function(_0x44a220,_0x459a3d){var _0x1aed55={},_0x1677b6={},_0x645bc1={'count':0x0,'rows':[]};var _0xd1775b=_[_0xb7aa('0x2f')](db['Template'][_0xb7aa('0x30')],function(_0x481eab){return{'name':_0x481eab[_0xb7aa('0x31')],'type':_0x481eab[_0xb7aa('0x32')][_0xb7aa('0x33')]};});_0x1677b6['model']=_['map'](_0xd1775b,_0xb7aa('0x2c'));_0x1677b6['query']=_[_0xb7aa('0x34')](_0x44a220[_0xb7aa('0x35')]);_0x1677b6[_0xb7aa('0x36')]=_[_0xb7aa('0x37')](_0x1677b6[_0xb7aa('0x38')],_0x1677b6[_0xb7aa('0x35')]);_0x1aed55[_0xb7aa('0x39')]=_[_0xb7aa('0x37')](_0x1677b6[_0xb7aa('0x38')],qs[_0xb7aa('0x3a')](_0x44a220['query'][_0xb7aa('0x3a')]));_0x1aed55[_0xb7aa('0x39')]=_0x1aed55[_0xb7aa('0x39')][_0xb7aa('0x3b')]?_0x1aed55[_0xb7aa('0x39')]:_0x1677b6[_0xb7aa('0x38')];if(!_0x44a220['query'][_0xb7aa('0x3c')](_0xb7aa('0x3d'))){_0x1aed55['limit']=qs[_0xb7aa('0x1d')](_0x44a220[_0xb7aa('0x35')][_0xb7aa('0x1d')]);_0x1aed55[_0xb7aa('0x1b')]=qs[_0xb7aa('0x1b')](_0x44a220[_0xb7aa('0x35')][_0xb7aa('0x1b')]);}_0x1aed55['order']=qs[_0xb7aa('0x3e')](_0x44a220[_0xb7aa('0x35')][_0xb7aa('0x3e')]);_0x1aed55['where']=qs[_0xb7aa('0x36')](_[_0xb7aa('0x3f')](_0x44a220['query'],_0x1677b6[_0xb7aa('0x36')]),_0xd1775b);if(_0x44a220['query'][_0xb7aa('0x40')]){_0x1aed55[_0xb7aa('0x41')]=_[_0xb7aa('0x42')](_0x1aed55[_0xb7aa('0x41')],{'$or':_[_0xb7aa('0x2f')](_0xd1775b,function(_0x544a81){if(_0x544a81[_0xb7aa('0x32')]!=='VIRTUAL'){var _0xb13796={};_0xb13796[_0x544a81[_0xb7aa('0x2c')]]={'$like':'%'+_0x44a220['query'][_0xb7aa('0x40')]+'%'};return _0xb13796;}})});}_0x1aed55=_[_0xb7aa('0x42')]({},_0x1aed55,_0x44a220[_0xb7aa('0x43')]);var _0xc188b7={'where':_0x1aed55[_0xb7aa('0x41')]};return db[_0xb7aa('0x44')][_0xb7aa('0x1e')](_0xc188b7)[_0xb7aa('0x24')](function(_0x2b5a59){_0x645bc1[_0xb7aa('0x1e')]=_0x2b5a59;if(_0x44a220['query'][_0xb7aa('0x45')]){_0x1aed55[_0xb7aa('0x46')]=[{'all':!![]}];}return db[_0xb7aa('0x44')][_0xb7aa('0x47')](_0x1aed55);})['then'](function(_0x1dd478){_0x645bc1['rows']=_0x1dd478;return _0x645bc1;})[_0xb7aa('0x24')](respondWithFilteredResult(_0x459a3d,_0x1aed55))[_0xb7aa('0x48')](handleError(_0x459a3d,null));};exports[_0xb7aa('0x49')]=function(_0x275ead,_0x5cd11a){var _0x2c1fa6={'raw':!![],'where':{'id':_0x275ead[_0xb7aa('0x4a')]['id']}},_0x2c34ca={};_0x2c34ca[_0xb7aa('0x38')]=_[_0xb7aa('0x34')](db['Template'][_0xb7aa('0x30')]);_0x2c34ca[_0xb7aa('0x35')]=_[_0xb7aa('0x34')](_0x275ead[_0xb7aa('0x35')]);_0x2c34ca['filters']=_[_0xb7aa('0x37')](_0x2c34ca['model'],_0x2c34ca[_0xb7aa('0x35')]);_0x2c1fa6[_0xb7aa('0x39')]=_['intersection'](_0x2c34ca[_0xb7aa('0x38')],qs[_0xb7aa('0x3a')](_0x275ead['query'][_0xb7aa('0x3a')]));_0x2c1fa6['attributes']=_0x2c1fa6['attributes']['length']?_0x2c1fa6[_0xb7aa('0x39')]:_0x2c34ca[_0xb7aa('0x38')];if(_0x275ead[_0xb7aa('0x35')][_0xb7aa('0x45')]){_0x2c1fa6[_0xb7aa('0x46')]=[{'all':!![]}];}_0x2c1fa6=_[_0xb7aa('0x42')]({},_0x2c1fa6,_0x275ead['options']);return db[_0xb7aa('0x44')][_0xb7aa('0x4b')](_0x2c1fa6)['then'](handleEntityNotFound(_0x5cd11a,null))['then'](respondWithResult(_0x5cd11a,null))[_0xb7aa('0x48')](handleError(_0x5cd11a,null));};exports[_0xb7aa('0x4c')]=function(_0x403c06,_0x328ca3){return db['Template'][_0xb7aa('0x4c')](_0x403c06[_0xb7aa('0x4d')],{})[_0xb7aa('0x24')](function(_0x1c476b){var _0x469198=_0x403c06[_0xb7aa('0x4e')][_0xb7aa('0x26')]({'plain':!![]});if(!_0x469198)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x469198[_0xb7aa('0x4f')]===_0xb7aa('0x4e')){var _0x478541=_0x1c476b[_0xb7aa('0x26')]({'plain':!![]});var _0x425b60=_0xb7aa('0x27');return db[_0xb7aa('0x50')][_0xb7aa('0x4b')]({'where':{'name':_0x425b60,'userProfileId':_0x469198['userProfileId']},'raw':!![]})[_0xb7aa('0x24')](function(_0x5b886a){if(_0x5b886a&&_0x5b886a['autoAssociation']===0x0){return db['UserProfileResource'][_0xb7aa('0x4c')]({'name':_0x478541['name'],'resourceId':_0x478541['id'],'type':_0x5b886a[_0xb7aa('0x2c')],'sectionId':_0x5b886a['id']},{})[_0xb7aa('0x24')](function(){return _0x1c476b;});}else{return _0x1c476b;}})['catch'](function(_0x3c44cf){logger[_0xb7aa('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c44cf);throw _0x3c44cf;});}return _0x1c476b;})['then'](respondWithResult(_0x328ca3,0xc9))['catch'](handleError(_0x328ca3,null));};exports[_0xb7aa('0x23')]=function(_0x26e1fe,_0x480417){if(_0x26e1fe[_0xb7aa('0x4d')]['id']){delete _0x26e1fe[_0xb7aa('0x4d')]['id'];}return db[_0xb7aa('0x44')][_0xb7aa('0x4b')]({'where':{'id':_0x26e1fe['params']['id']}})['then'](handleEntityNotFound(_0x480417,null))['then'](saveUpdates(_0x26e1fe[_0xb7aa('0x4d')],null))[_0xb7aa('0x24')](respondWithResult(_0x480417,null))[_0xb7aa('0x48')](handleError(_0x480417,null));};exports[_0xb7aa('0x25')]=function(_0x4c6916,_0x1ef12c){return db[_0xb7aa('0x44')][_0xb7aa('0x4b')]({'where':{'id':_0x4c6916[_0xb7aa('0x4a')]['id']}})[_0xb7aa('0x24')](handleEntityNotFound(_0x1ef12c,null))[_0xb7aa('0x24')](removeEntity(_0x1ef12c,null))['catch'](handleError(_0x1ef12c,null));}; \ No newline at end of file +var _0x7075=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','Template','fieldName','type','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','keys','rawAttributes','length','include','body','get','role','user','Templates','UserProfileSection','find','userProfileId','autoAssociation','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7075,0x198));var _0x5707=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7075[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x5707('0x0'));var rimraf=require(_0x5707('0x1'));var zipdir=require(_0x5707('0x2'));var jsonpatch=require(_0x5707('0x3'));var rp=require(_0x5707('0x4'));var moment=require(_0x5707('0x5'));var BPromise=require(_0x5707('0x6'));var Mustache=require(_0x5707('0x7'));var util=require(_0x5707('0x8'));var path=require(_0x5707('0x9'));var sox=require(_0x5707('0xa'));var csv=require('to-csv');var ejs=require(_0x5707('0xb'));var fs=require('fs');var fs_extra=require(_0x5707('0xc'));var _=require('lodash');var squel=require(_0x5707('0xd'));var crypto=require(_0x5707('0xe'));var jsforce=require(_0x5707('0xf'));var deskjs=require(_0x5707('0x10'));var toCsv=require(_0x5707('0x11'));var querystring=require('querystring');var Papa=require(_0x5707('0x12'));var Redis=require('ioredis');var authService=require(_0x5707('0x13'));var qs=require(_0x5707('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5707('0x15'));var logger=require(_0x5707('0x16'))(_0x5707('0x17'));var utils=require(_0x5707('0x18'));var config=require(_0x5707('0x19'));var licenseUtil=require(_0x5707('0x1a'));var db=require(_0x5707('0x1b'))['db'];function respondWithStatusCode(_0x35e6cc,_0x5eac21){_0x5eac21=_0x5eac21||0xcc;return function(_0x4cc0d9){if(_0x4cc0d9){return _0x35e6cc['sendStatus'](_0x5eac21);}return _0x35e6cc[_0x5707('0x1c')](_0x5eac21)[_0x5707('0x1d')]();};}function respondWithResult(_0x4e921b,_0x44328c){_0x44328c=_0x44328c||0xc8;return function(_0xbec67d){if(_0xbec67d){return _0x4e921b['status'](_0x44328c)['json'](_0xbec67d);}};}function respondWithFilteredResult(_0x32e2aa,_0xe8798a){return function(_0x5df734){if(_0x5df734){var _0x2d8992=typeof _0xe8798a[_0x5707('0x1e')]===_0x5707('0x1f')&&typeof _0xe8798a['limit']===_0x5707('0x1f');var _0x1e7196=_0x5df734[_0x5707('0x20')];var _0x3e8697=_0x2d8992?0x0:_0xe8798a[_0x5707('0x1e')];var _0x2a5608=_0x2d8992?_0x5df734[_0x5707('0x20')]:_0xe8798a[_0x5707('0x1e')]+_0xe8798a[_0x5707('0x21')];var _0x5bf243;if(_0x2a5608>=_0x1e7196){_0x2a5608=_0x1e7196;_0x5bf243=0xc8;}else{_0x5bf243=0xce;}_0x32e2aa['status'](_0x5bf243);return _0x32e2aa[_0x5707('0x22')](_0x5707('0x23'),_0x3e8697+'-'+_0x2a5608+'/'+_0x1e7196)[_0x5707('0x24')](_0x5df734);}return null;};}function patchUpdates(_0x140cfd){return function(_0x4ac61f){try{jsonpatch[_0x5707('0x25')](_0x4ac61f,_0x140cfd,!![]);}catch(_0x379cbb){return BPromise['reject'](_0x379cbb);}return _0x4ac61f[_0x5707('0x26')]();};}function saveUpdates(_0x3640ca,_0x907c36){return function(_0x32bc02){if(_0x32bc02){return _0x32bc02[_0x5707('0x27')](_0x3640ca)[_0x5707('0x28')](function(_0x144129){return _0x144129;});}return null;};}function removeEntity(_0x2aaa37,_0x529b16){return function(_0xa2964d){if(_0xa2964d){return _0xa2964d['destroy']()['then'](function(){var _0x30e23f=_0xa2964d['get']({'plain':!![]});var _0x43321f='Templates';return db[_0x5707('0x29')][_0x5707('0x2a')]({'where':{'type':_0x43321f,'resourceId':_0x30e23f['id']}})[_0x5707('0x28')](function(){return _0xa2964d;});})[_0x5707('0x28')](function(){_0x2aaa37[_0x5707('0x1c')](0xcc)[_0x5707('0x1d')]();});}};}function handleEntityNotFound(_0x3f0d1d,_0x44b546){return function(_0x1c69f4){if(!_0x1c69f4){_0x3f0d1d['sendStatus'](0x194);}return _0x1c69f4;};}function handleError(_0x3a7986,_0xd49cab){_0xd49cab=_0xd49cab||0x1f4;return function(_0x3c63d0){logger[_0x5707('0x2b')](_0x3c63d0[_0x5707('0x2c')]);if(_0x3c63d0[_0x5707('0x2d')]){delete _0x3c63d0[_0x5707('0x2d')];}_0x3a7986['status'](_0xd49cab)[_0x5707('0x2e')](_0x3c63d0);};}exports[_0x5707('0x2f')]=function(_0x173590,_0x406f8f){var _0x360f0d={},_0x2bed70={},_0x9702f8={'count':0x0,'rows':[]};var _0x1fe9e7=_[_0x5707('0x30')](db[_0x5707('0x31')]['rawAttributes'],function(_0x509c2e){return{'name':_0x509c2e[_0x5707('0x32')],'type':_0x509c2e[_0x5707('0x33')]['key']};});_0x2bed70['model']=_['map'](_0x1fe9e7,_0x5707('0x2d'));_0x2bed70[_0x5707('0x34')]=_['keys'](_0x173590[_0x5707('0x34')]);_0x2bed70['filters']=_[_0x5707('0x35')](_0x2bed70[_0x5707('0x36')],_0x2bed70[_0x5707('0x34')]);_0x360f0d['attributes']=_[_0x5707('0x35')](_0x2bed70[_0x5707('0x36')],qs[_0x5707('0x37')](_0x173590['query'][_0x5707('0x37')]));_0x360f0d[_0x5707('0x38')]=_0x360f0d[_0x5707('0x38')]['length']?_0x360f0d[_0x5707('0x38')]:_0x2bed70['model'];if(!_0x173590[_0x5707('0x34')][_0x5707('0x39')](_0x5707('0x3a'))){_0x360f0d[_0x5707('0x21')]=qs['limit'](_0x173590[_0x5707('0x34')]['limit']);_0x360f0d[_0x5707('0x1e')]=qs[_0x5707('0x1e')](_0x173590['query'][_0x5707('0x1e')]);}_0x360f0d['order']=qs[_0x5707('0x3b')](_0x173590[_0x5707('0x34')][_0x5707('0x3b')]);_0x360f0d[_0x5707('0x3c')]=qs[_0x5707('0x3d')](_[_0x5707('0x3e')](_0x173590[_0x5707('0x34')],_0x2bed70[_0x5707('0x3d')]),_0x1fe9e7);if(_0x173590[_0x5707('0x34')][_0x5707('0x3f')]){_0x360f0d[_0x5707('0x3c')]=_[_0x5707('0x40')](_0x360f0d[_0x5707('0x3c')],{'$or':_['map'](_0x1fe9e7,function(_0x3485be){if(_0x3485be[_0x5707('0x33')]!==_0x5707('0x41')){var _0x495272={};_0x495272[_0x3485be[_0x5707('0x2d')]]={'$like':'%'+_0x173590[_0x5707('0x34')][_0x5707('0x3f')]+'%'};return _0x495272;}})});}_0x360f0d=_['merge']({},_0x360f0d,_0x173590[_0x5707('0x42')]);var _0x57699c={'where':_0x360f0d[_0x5707('0x3c')]};return db[_0x5707('0x31')][_0x5707('0x20')](_0x57699c)[_0x5707('0x28')](function(_0x48732c){_0x9702f8[_0x5707('0x20')]=_0x48732c;if(_0x173590[_0x5707('0x34')][_0x5707('0x43')]){_0x360f0d['include']=[{'all':!![]}];}return db[_0x5707('0x31')][_0x5707('0x44')](_0x360f0d);})[_0x5707('0x28')](function(_0x2a2a57){_0x9702f8['rows']=_0x2a2a57;return _0x9702f8;})[_0x5707('0x28')](respondWithFilteredResult(_0x406f8f,_0x360f0d))[_0x5707('0x45')](handleError(_0x406f8f,null));};exports['show']=function(_0x5aac51,_0x8221aa){var _0x5574a6={'raw':!![],'where':{'id':_0x5aac51[_0x5707('0x46')]['id']}},_0x59bec5={};_0x59bec5[_0x5707('0x36')]=_[_0x5707('0x47')](db[_0x5707('0x31')][_0x5707('0x48')]);_0x59bec5['query']=_['keys'](_0x5aac51[_0x5707('0x34')]);_0x59bec5[_0x5707('0x3d')]=_[_0x5707('0x35')](_0x59bec5[_0x5707('0x36')],_0x59bec5[_0x5707('0x34')]);_0x5574a6[_0x5707('0x38')]=_[_0x5707('0x35')](_0x59bec5[_0x5707('0x36')],qs['fields'](_0x5aac51['query'][_0x5707('0x37')]));_0x5574a6[_0x5707('0x38')]=_0x5574a6[_0x5707('0x38')][_0x5707('0x49')]?_0x5574a6[_0x5707('0x38')]:_0x59bec5[_0x5707('0x36')];if(_0x5aac51[_0x5707('0x34')][_0x5707('0x43')]){_0x5574a6[_0x5707('0x4a')]=[{'all':!![]}];}_0x5574a6=_['merge']({},_0x5574a6,_0x5aac51[_0x5707('0x42')]);return db[_0x5707('0x31')]['find'](_0x5574a6)[_0x5707('0x28')](handleEntityNotFound(_0x8221aa,null))['then'](respondWithResult(_0x8221aa,null))[_0x5707('0x45')](handleError(_0x8221aa,null));};exports['create']=function(_0x5442ac,_0x467517){return db[_0x5707('0x31')]['create'](_0x5442ac[_0x5707('0x4b')],{})[_0x5707('0x28')](function(_0x12467c){var _0x13f312=_0x5442ac['user'][_0x5707('0x4c')]({'plain':!![]});if(!_0x13f312)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13f312[_0x5707('0x4d')]===_0x5707('0x4e')){var _0x510df3=_0x12467c[_0x5707('0x4c')]({'plain':!![]});var _0x180754=_0x5707('0x4f');return db[_0x5707('0x50')][_0x5707('0x51')]({'where':{'name':_0x180754,'userProfileId':_0x13f312[_0x5707('0x52')]},'raw':!![]})['then'](function(_0x386bd1){if(_0x386bd1&&_0x386bd1[_0x5707('0x53')]===0x0){return db['UserProfileResource'][_0x5707('0x54')]({'name':_0x510df3[_0x5707('0x2d')],'resourceId':_0x510df3['id'],'type':_0x386bd1[_0x5707('0x2d')],'sectionId':_0x386bd1['id']},{})['then'](function(){return _0x12467c;});}else{return _0x12467c;}})['catch'](function(_0x2af1b7){logger[_0x5707('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2af1b7);throw _0x2af1b7;});}return _0x12467c;})[_0x5707('0x28')](respondWithResult(_0x467517,0xc9))[_0x5707('0x45')](handleError(_0x467517,null));};exports[_0x5707('0x27')]=function(_0x518b4c,_0x1a0de1){if(_0x518b4c[_0x5707('0x4b')]['id']){delete _0x518b4c[_0x5707('0x4b')]['id'];}return db[_0x5707('0x31')][_0x5707('0x51')]({'where':{'id':_0x518b4c[_0x5707('0x46')]['id']}})[_0x5707('0x28')](handleEntityNotFound(_0x1a0de1,null))[_0x5707('0x28')](saveUpdates(_0x518b4c[_0x5707('0x4b')],null))['then'](respondWithResult(_0x1a0de1,null))['catch'](handleError(_0x1a0de1,null));};exports[_0x5707('0x2a')]=function(_0x4c13b2,_0x497deb){return db['Template'][_0x5707('0x51')]({'where':{'id':_0x4c13b2[_0x5707('0x46')]['id']}})[_0x5707('0x28')](handleEntityNotFound(_0x497deb,null))['then'](removeEntity(_0x497deb,null))[_0x5707('0x45')](handleError(_0x497deb,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b29d44f..1d64fae 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 _0xa3c3=['request-promise','path','rimraf','../../config/environment','Template','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb31b62,_0x309405){var _0x3928ed=function(_0x34c34a){while(--_0x34c34a){_0xb31b62['push'](_0xb31b62['shift']());}};_0x3928ed(++_0x309405);}(_0xa3c3,0x68));var _0x3a3c=function(_0x9f94fb,_0x3ca108){_0x9f94fb=_0x9f94fb-0x0;var _0x16f451=_0xa3c3[_0x9f94fb];return _0x16f451;};'use strict';var _=require(_0x3a3c('0x0'));var util=require(_0x3a3c('0x1'));var logger=require(_0x3a3c('0x2'))(_0x3a3c('0x3'));var moment=require(_0x3a3c('0x4'));var BPromise=require(_0x3a3c('0x5'));var rp=require(_0x3a3c('0x6'));var fs=require('fs');var path=require(_0x3a3c('0x7'));var rimraf=require(_0x3a3c('0x8'));var config=require(_0x3a3c('0x9'));var attributes=require('./template.attributes');module['exports']=function(_0x1ff52a,_0x7698f6){return _0x1ff52a['define'](_0x3a3c('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2570=['./template.attributes','define','tools_templates','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39ff68,_0xb9a099){var _0x205ccc=function(_0x19efd4){while(--_0x19efd4){_0x39ff68['push'](_0x39ff68['shift']());}};_0x205ccc(++_0xb9a099);}(_0x2570,0x175));var _0x0257=function(_0x9fc5a2,_0x46c38f){_0x9fc5a2=_0x9fc5a2-0x0;var _0x10a4a8=_0x2570[_0x9fc5a2];return _0x10a4a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0257('0x0'));var moment=require(_0x0257('0x1'));var BPromise=require(_0x0257('0x2'));var rp=require(_0x0257('0x3'));var fs=require('fs');var path=require(_0x0257('0x4'));var rimraf=require(_0x0257('0x5'));var config=require(_0x0257('0x6'));var attributes=require(_0x0257('0x7'));module['exports']=function(_0x3703be,_0x58460a){return _0x3703be[_0x0257('0x8')]('Template',attributes,{'tableName':_0x0257('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 9abb87a..0e89d50 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 _0xc815=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x24ce7b,_0x4e5fda){var _0x482800=function(_0x525b76){while(--_0x525b76){_0x24ce7b['push'](_0x24ce7b['shift']());}};_0x482800(++_0x4e5fda);}(_0xc815,0xaa));var _0x5c81=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc815[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x5c81('0x0'));var util=require(_0x5c81('0x1'));var moment=require(_0x5c81('0x2'));var BPromise=require(_0x5c81('0x3'));var rs=require(_0x5c81('0x4'));var fs=require('fs');var Redis=require(_0x5c81('0x5'));var db=require(_0x5c81('0x6'))['db'];var utils=require(_0x5c81('0x7'));var logger=require(_0x5c81('0x8'))(_0x5c81('0x9'));var config=require(_0x5c81('0xa'));var jayson=require(_0x5c81('0xb'));var client=jayson[_0x5c81('0xc')][_0x5c81('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2b7bbb,_0x1fa0e0,_0x517f12){return new BPromise(function(_0x4eadbc,_0x242316){return client[_0x5c81('0xe')](_0x2b7bbb,_0x517f12)[_0x5c81('0xf')](function(_0x50e733){logger[_0x5c81('0x10')](_0x5c81('0x11'),_0x1fa0e0,_0x5c81('0x12'));logger[_0x5c81('0x13')](_0x5c81('0x14'),_0x1fa0e0,_0x5c81('0x12'),JSON[_0x5c81('0x15')](_0x50e733));if(_0x50e733[_0x5c81('0x16')]){if(_0x50e733['error'][_0x5c81('0x17')]===0x1f4){logger[_0x5c81('0x16')]('Template,\x20%s,\x20%s',_0x1fa0e0,_0x50e733['error'][_0x5c81('0x18')]);return _0x242316(_0x50e733[_0x5c81('0x16')][_0x5c81('0x18')]);}logger[_0x5c81('0x16')](_0x5c81('0x11'),_0x1fa0e0,_0x50e733[_0x5c81('0x16')]['message']);return _0x4eadbc(_0x50e733[_0x5c81('0x16')]['message']);}else{logger['info']('Template,\x20%s,\x20%s',_0x1fa0e0,_0x5c81('0x12'));_0x4eadbc(_0x50e733[_0x5c81('0x19')][_0x5c81('0x18')]);}})[_0x5c81('0x1a')](function(_0x5977b2){logger['error']('Template,\x20%s,\x20%s',_0x1fa0e0,_0x5977b2);_0x242316(_0x5977b2);});});}exports[_0x5c81('0x1b')]=function(_0x9be59e){var _0x413a23=this;return new Promise(function(_0x15a444,_0x41b578){return db[_0x5c81('0x1c')][_0x5c81('0x1d')]({'raw':_0x9be59e['options']?_0x9be59e[_0x5c81('0x1e')][_0x5c81('0x1f')]===undefined?!![]:![]:!![],'where':_0x9be59e[_0x5c81('0x1e')]?_0x9be59e[_0x5c81('0x1e')][_0x5c81('0x20')]||null:null,'attributes':_0x9be59e[_0x5c81('0x1e')]?_0x9be59e[_0x5c81('0x1e')][_0x5c81('0x21')]||null:null,'limit':_0x9be59e[_0x5c81('0x1e')]?_0x9be59e[_0x5c81('0x1e')]['limit']||null:null,'include':_0x9be59e[_0x5c81('0x1e')]?_0x9be59e[_0x5c81('0x1e')][_0x5c81('0x22')]?_[_0x5c81('0x23')](_0x9be59e[_0x5c81('0x1e')]['include'],function(_0xebf051){return{'model':db[_0xebf051[_0x5c81('0x24')]],'as':_0xebf051['as'],'attributes':_0xebf051[_0x5c81('0x21')],'include':_0xebf051[_0x5c81('0x22')]?_['map'](_0xebf051[_0x5c81('0x22')],function(_0x34abc1){return{'model':db[_0x34abc1['model']],'as':_0x34abc1['as'],'attributes':_0x34abc1[_0x5c81('0x21')],'include':_0x34abc1[_0x5c81('0x22')]?_[_0x5c81('0x23')](_0x34abc1[_0x5c81('0x22')],function(_0x3be961){return{'model':db[_0x3be961[_0x5c81('0x24')]],'as':_0x3be961['as'],'attributes':_0x3be961[_0x5c81('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5c81('0xf')](function(_0x5592b5){logger[_0x5c81('0x10')](_0x5c81('0x1b'),_0x9be59e);logger[_0x5c81('0x13')](_0x5c81('0x1b'),_0x9be59e,JSON[_0x5c81('0x15')](_0x5592b5));_0x15a444(_0x5592b5);})[_0x5c81('0x1a')](function(_0x2528b5){logger['error'](_0x5c81('0x1b'),_0x2528b5[_0x5c81('0x18')],_0x9be59e);_0x41b578(_0x413a23['error'](0x1f4,_0x2528b5['message']));});});}; \ No newline at end of file +var _0xa8ea=['result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message'];(function(_0x59236c,_0x4eb717){var _0x4dd78f=function(_0x51789a){while(--_0x51789a){_0x59236c['push'](_0x59236c['shift']());}};_0x4dd78f(++_0x4eb717);}(_0xa8ea,0xfb));var _0xaa8e=function(_0x50848c,_0x528b1a){_0x50848c=_0x50848c-0x0;var _0x13b45c=_0xa8ea[_0x50848c];return _0x13b45c;};'use strict';var _=require(_0xaa8e('0x0'));var util=require(_0xaa8e('0x1'));var moment=require(_0xaa8e('0x2'));var BPromise=require(_0xaa8e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa8e('0x4'));var db=require(_0xaa8e('0x5'))['db'];var utils=require(_0xaa8e('0x6'));var logger=require(_0xaa8e('0x7'))(_0xaa8e('0x8'));var config=require(_0xaa8e('0x9'));var jayson=require(_0xaa8e('0xa'));var client=jayson[_0xaa8e('0xb')][_0xaa8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1be20d,_0x5a66d3,_0x3c1211){return new BPromise(function(_0x17db7e,_0x4a987c){return client['request'](_0x1be20d,_0x3c1211)['then'](function(_0x4c6b0a){logger[_0xaa8e('0xd')]('Template,\x20%s,\x20%s',_0x5a66d3,_0xaa8e('0xe'));logger[_0xaa8e('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x5a66d3,'request\x20sent',JSON[_0xaa8e('0x10')](_0x4c6b0a));if(_0x4c6b0a[_0xaa8e('0x11')]){if(_0x4c6b0a['error'][_0xaa8e('0x12')]===0x1f4){logger[_0xaa8e('0x11')](_0xaa8e('0x13'),_0x5a66d3,_0x4c6b0a[_0xaa8e('0x11')][_0xaa8e('0x14')]);return _0x4a987c(_0x4c6b0a[_0xaa8e('0x11')]['message']);}logger['error'](_0xaa8e('0x13'),_0x5a66d3,_0x4c6b0a[_0xaa8e('0x11')]['message']);return _0x17db7e(_0x4c6b0a[_0xaa8e('0x11')][_0xaa8e('0x14')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x5a66d3,_0xaa8e('0xe'));_0x17db7e(_0x4c6b0a[_0xaa8e('0x15')][_0xaa8e('0x14')]);}})[_0xaa8e('0x16')](function(_0x2dd920){logger['error'](_0xaa8e('0x13'),_0x5a66d3,_0x2dd920);_0x4a987c(_0x2dd920);});});}exports[_0xaa8e('0x17')]=function(_0x140d5b){var _0x224594=this;return new Promise(function(_0x5ed916,_0x20d4cb){return db[_0xaa8e('0x18')][_0xaa8e('0x19')]({'raw':_0x140d5b['options']?_0x140d5b[_0xaa8e('0x1a')][_0xaa8e('0x1b')]===undefined?!![]:![]:!![],'where':_0x140d5b[_0xaa8e('0x1a')]?_0x140d5b[_0xaa8e('0x1a')]['where']||null:null,'attributes':_0x140d5b[_0xaa8e('0x1a')]?_0x140d5b[_0xaa8e('0x1a')][_0xaa8e('0x1c')]||null:null,'limit':_0x140d5b[_0xaa8e('0x1a')]?_0x140d5b[_0xaa8e('0x1a')][_0xaa8e('0x1d')]||null:null,'include':_0x140d5b['options']?_0x140d5b[_0xaa8e('0x1a')][_0xaa8e('0x1e')]?_[_0xaa8e('0x1f')](_0x140d5b['options'][_0xaa8e('0x1e')],function(_0x5751d2){return{'model':db[_0x5751d2[_0xaa8e('0x20')]],'as':_0x5751d2['as'],'attributes':_0x5751d2[_0xaa8e('0x1c')],'include':_0x5751d2[_0xaa8e('0x1e')]?_['map'](_0x5751d2['include'],function(_0x4be553){return{'model':db[_0x4be553[_0xaa8e('0x20')]],'as':_0x4be553['as'],'attributes':_0x4be553['attributes'],'include':_0x4be553[_0xaa8e('0x1e')]?_['map'](_0x4be553[_0xaa8e('0x1e')],function(_0x41d4a8){return{'model':db[_0x41d4a8['model']],'as':_0x41d4a8['as'],'attributes':_0x41d4a8[_0xaa8e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa8e('0x21')](function(_0x52bf7f){logger[_0xaa8e('0xd')](_0xaa8e('0x17'),_0x140d5b);logger[_0xaa8e('0xf')](_0xaa8e('0x17'),_0x140d5b,JSON['stringify'](_0x52bf7f));_0x5ed916(_0x52bf7f);})[_0xaa8e('0x16')](function(_0x541d77){logger[_0xaa8e('0x11')](_0xaa8e('0x17'),_0x541d77[_0xaa8e('0x14')],_0x140d5b);_0x20d4cb(_0x224594['error'](0x1f4,_0x541d77[_0xaa8e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 721b524..1416bd0 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 _0xff93=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','create','post','addAnyCondition','addAction','put','delete','destroy','exports','util'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xff93,0x1f3));var _0x3ff9=function(_0x2b9c17,_0xc8ac81){_0x2b9c17=_0x2b9c17-0x0;var _0x28711d=_0xff93[_0x2b9c17];return _0x28711d;};'use strict';var multer=require('multer');var util=require(_0x3ff9('0x0'));var path=require(_0x3ff9('0x1'));var timeout=require('connect-timeout');var express=require(_0x3ff9('0x2'));var router=express[_0x3ff9('0x3')]();var fs_extra=require(_0x3ff9('0x4'));var auth=require(_0x3ff9('0x5'));var interaction=require(_0x3ff9('0x6'));var config=require(_0x3ff9('0x7'));var controller=require(_0x3ff9('0x8'));router['get']('/',auth[_0x3ff9('0x9')](),controller[_0x3ff9('0xa')]);router[_0x3ff9('0xb')](_0x3ff9('0xc'),auth[_0x3ff9('0x9')](),controller['show']);router[_0x3ff9('0xb')](_0x3ff9('0xd'),auth[_0x3ff9('0x9')](),controller[_0x3ff9('0xe')]);router[_0x3ff9('0xb')]('/:id/any_conditions',auth[_0x3ff9('0x9')](),controller[_0x3ff9('0xf')]);router[_0x3ff9('0xb')](_0x3ff9('0x10'),auth[_0x3ff9('0x9')](),controller['getActions']);router['post']('/',auth[_0x3ff9('0x9')](),controller[_0x3ff9('0x11')]);router[_0x3ff9('0x12')](_0x3ff9('0xd'),auth[_0x3ff9('0x9')](),controller['addAllCondition']);router[_0x3ff9('0x12')]('/:id/any_conditions',auth[_0x3ff9('0x9')](),controller[_0x3ff9('0x13')]);router[_0x3ff9('0x12')](_0x3ff9('0x10'),auth[_0x3ff9('0x9')](),controller[_0x3ff9('0x14')]);router[_0x3ff9('0x15')](_0x3ff9('0xc'),auth[_0x3ff9('0x9')](),controller['update']);router[_0x3ff9('0x16')]('/:id',auth[_0x3ff9('0x9')](),controller[_0x3ff9('0x17')]);module[_0x3ff9('0x18')]=router; \ No newline at end of file +var _0x6b00=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','/:id/any_conditions','addAnyCondition','addAction','put','/:id','delete','destroy','multer','util','path'];(function(_0x429548,_0x208606){var _0x1bd3d4=function(_0x5e0ed6){while(--_0x5e0ed6){_0x429548['push'](_0x429548['shift']());}};_0x1bd3d4(++_0x208606);}(_0x6b00,0x1ad));var _0x06b0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6b00[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x06b0('0x0'));var util=require(_0x06b0('0x1'));var path=require(_0x06b0('0x2'));var timeout=require(_0x06b0('0x3'));var express=require(_0x06b0('0x4'));var router=express[_0x06b0('0x5')]();var fs_extra=require(_0x06b0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x06b0('0x7'));var config=require(_0x06b0('0x8'));var controller=require('./trigger.controller');router[_0x06b0('0x9')]('/',auth[_0x06b0('0xa')](),controller['index']);router[_0x06b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x06b0('0xb')]);router[_0x06b0('0x9')](_0x06b0('0xc'),auth[_0x06b0('0xa')](),controller['getAllConditions']);router[_0x06b0('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x06b0('0xd')]);router[_0x06b0('0x9')](_0x06b0('0xe'),auth[_0x06b0('0xa')](),controller[_0x06b0('0xf')]);router[_0x06b0('0x10')]('/',auth[_0x06b0('0xa')](),controller['create']);router[_0x06b0('0x10')](_0x06b0('0xc'),auth[_0x06b0('0xa')](),controller['addAllCondition']);router[_0x06b0('0x10')](_0x06b0('0x11'),auth['isAuthenticated'](),controller[_0x06b0('0x12')]);router['post'](_0x06b0('0xe'),auth['isAuthenticated'](),controller[_0x06b0('0x13')]);router[_0x06b0('0x14')](_0x06b0('0x15'),auth[_0x06b0('0xa')](),controller['update']);router[_0x06b0('0x16')](_0x06b0('0x15'),auth[_0x06b0('0xa')](),controller[_0x06b0('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 d0a429a..3af73b6 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 _0x2694=['BOOLEAN','sequelize','STRING'];(function(_0x432d97,_0xdd9c1d){var _0x5533d3=function(_0x204681){while(--_0x204681){_0x432d97['push'](_0x432d97['shift']());}};_0x5533d3(++_0xdd9c1d);}(_0x2694,0x151));var _0x4269=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2694[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4269('0x0'));module['exports']={'name':{'type':Sequelize[_0x4269('0x1')]},'channel':{'type':Sequelize[_0x4269('0x1')]},'description':{'type':Sequelize[_0x4269('0x1')]},'status':{'type':Sequelize[_0x4269('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x889f=['sequelize','exports','STRING'];(function(_0x4cf0c9,_0x4148d5){var _0xbf3777=function(_0x595034){while(--_0x595034){_0x4cf0c9['push'](_0x4cf0c9['shift']());}};_0xbf3777(++_0x4148d5);}(_0x889f,0x93));var _0xf889=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x889f[_0x369151];return _0x4292d5;};'use strict';var Sequelize=require(_0xf889('0x0'));module[_0xf889('0x1')]={'name':{'type':Sequelize[_0xf889('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf889('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5cc9268..4c87d0e 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 _0x4c9e=['filter','VIRTUAL','Trigger','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','pick','addAction','TriggerId','Action','getActions','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','Triggers','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3d37c7,_0x429a8b){var _0x39b513=function(_0x58011f){while(--_0x58011f){_0x3d37c7['push'](_0x3d37c7['shift']());}};_0x39b513(++_0x429a8b);}(_0x4c9e,0x14a));var _0xe4c9=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x4c9e[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require(_0xe4c9('0x0'));var rimraf=require(_0xe4c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe4c9('0x2'));var moment=require('moment');var BPromise=require(_0xe4c9('0x3'));var Mustache=require(_0xe4c9('0x4'));var util=require(_0xe4c9('0x5'));var path=require(_0xe4c9('0x6'));var sox=require(_0xe4c9('0x7'));var csv=require(_0xe4c9('0x8'));var ejs=require(_0xe4c9('0x9'));var fs=require('fs');var fs_extra=require(_0xe4c9('0xa'));var _=require(_0xe4c9('0xb'));var squel=require('squel');var crypto=require(_0xe4c9('0xc'));var jsforce=require(_0xe4c9('0xd'));var deskjs=require(_0xe4c9('0xe'));var toCsv=require(_0xe4c9('0x8'));var querystring=require(_0xe4c9('0xf'));var Papa=require(_0xe4c9('0x10'));var Redis=require(_0xe4c9('0x11'));var authService=require(_0xe4c9('0x12'));var qs=require(_0xe4c9('0x13'));var as=require(_0xe4c9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4c9('0x15'))(_0xe4c9('0x16'));var utils=require(_0xe4c9('0x17'));var config=require(_0xe4c9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4c9('0x19'))['db'];function respondWithStatusCode(_0x22bc56,_0xcaeddc){_0xcaeddc=_0xcaeddc||0xcc;return function(_0x39544d){if(_0x39544d){return _0x22bc56[_0xe4c9('0x1a')](_0xcaeddc);}return _0x22bc56[_0xe4c9('0x1b')](_0xcaeddc)[_0xe4c9('0x1c')]();};}function respondWithResult(_0x67e459,_0x12b5f2){_0x12b5f2=_0x12b5f2||0xc8;return function(_0x51a109){if(_0x51a109){return _0x67e459[_0xe4c9('0x1b')](_0x12b5f2)['json'](_0x51a109);}};}function respondWithFilteredResult(_0x4cb38a,_0x187be3){return function(_0x1afeda){if(_0x1afeda){var _0x2f1c53=typeof _0x187be3[_0xe4c9('0x1d')]==='undefined'&&typeof _0x187be3[_0xe4c9('0x1e')]==='undefined';var _0x3433c1=_0x1afeda[_0xe4c9('0x1f')];var _0x1755c5=_0x2f1c53?0x0:_0x187be3[_0xe4c9('0x1d')];var _0x1e9935=_0x2f1c53?_0x1afeda[_0xe4c9('0x1f')]:_0x187be3[_0xe4c9('0x1d')]+_0x187be3[_0xe4c9('0x1e')];var _0x4dba3c;if(_0x1e9935>=_0x3433c1){_0x1e9935=_0x3433c1;_0x4dba3c=0xc8;}else{_0x4dba3c=0xce;}_0x4cb38a[_0xe4c9('0x1b')](_0x4dba3c);return _0x4cb38a[_0xe4c9('0x20')](_0xe4c9('0x21'),_0x1755c5+'-'+_0x1e9935+'/'+_0x3433c1)[_0xe4c9('0x22')](_0x1afeda);}return null;};}function patchUpdates(_0x131eec){return function(_0x3c5ed6){try{jsonpatch['apply'](_0x3c5ed6,_0x131eec,!![]);}catch(_0x2b552e){return BPromise[_0xe4c9('0x23')](_0x2b552e);}return _0x3c5ed6[_0xe4c9('0x24')]();};}function saveUpdates(_0x4110f5,_0x4c98a8){return function(_0x74480f){if(_0x74480f){return _0x74480f[_0xe4c9('0x25')](_0x4110f5)['then'](function(_0x314ea7){return _0x314ea7;});}return null;};}function removeEntity(_0x4b93a0,_0x230154){return function(_0x337f21){if(_0x337f21){return _0x337f21[_0xe4c9('0x26')]()[_0xe4c9('0x27')](function(){var _0x199d72=_0x337f21[_0xe4c9('0x28')]({'plain':!![]});var _0x8ddf76=_0xe4c9('0x29');return db['UserProfileResource'][_0xe4c9('0x26')]({'where':{'type':_0x8ddf76,'resourceId':_0x199d72['id']}})[_0xe4c9('0x27')](function(){return _0x337f21;});})['then'](function(){_0x4b93a0[_0xe4c9('0x1b')](0xcc)[_0xe4c9('0x1c')]();});}};}function handleEntityNotFound(_0x38de73,_0x1f547){return function(_0x5be12c){if(!_0x5be12c){_0x38de73['sendStatus'](0x194);}return _0x5be12c;};}function handleError(_0x18db82,_0x583947){_0x583947=_0x583947||0x1f4;return function(_0x11f9ee){logger[_0xe4c9('0x2a')](_0x11f9ee[_0xe4c9('0x2b')]);if(_0x11f9ee[_0xe4c9('0x2c')]){delete _0x11f9ee['name'];}_0x18db82[_0xe4c9('0x1b')](_0x583947)['send'](_0x11f9ee);};}exports['index']=function(_0x26cbd4,_0x22fa68){var _0x3242a7={},_0x52e4e9={},_0x2818f5={'count':0x0,'rows':[]};var _0x4979f6=_[_0xe4c9('0x2d')](db['Trigger'][_0xe4c9('0x2e')],function(_0xb7b630){return{'name':_0xb7b630[_0xe4c9('0x2f')],'type':_0xb7b630[_0xe4c9('0x30')][_0xe4c9('0x31')]};});_0x52e4e9[_0xe4c9('0x32')]=_[_0xe4c9('0x2d')](_0x4979f6,_0xe4c9('0x2c'));_0x52e4e9[_0xe4c9('0x33')]=_[_0xe4c9('0x34')](_0x26cbd4[_0xe4c9('0x33')]);_0x52e4e9[_0xe4c9('0x35')]=_['intersection'](_0x52e4e9[_0xe4c9('0x32')],_0x52e4e9['query']);_0x3242a7[_0xe4c9('0x36')]=_[_0xe4c9('0x37')](_0x52e4e9['model'],qs[_0xe4c9('0x38')](_0x26cbd4['query'][_0xe4c9('0x38')]));_0x3242a7[_0xe4c9('0x36')]=_0x3242a7[_0xe4c9('0x36')]['length']?_0x3242a7[_0xe4c9('0x36')]:_0x52e4e9['model'];if(!_0x26cbd4[_0xe4c9('0x33')][_0xe4c9('0x39')](_0xe4c9('0x3a'))){_0x3242a7[_0xe4c9('0x1e')]=qs[_0xe4c9('0x1e')](_0x26cbd4[_0xe4c9('0x33')][_0xe4c9('0x1e')]);_0x3242a7['offset']=qs[_0xe4c9('0x1d')](_0x26cbd4['query'][_0xe4c9('0x1d')]);}_0x3242a7[_0xe4c9('0x3b')]=qs['sort'](_0x26cbd4[_0xe4c9('0x33')][_0xe4c9('0x3c')]);_0x3242a7[_0xe4c9('0x3d')]=qs['filters'](_['pick'](_0x26cbd4[_0xe4c9('0x33')],_0x52e4e9[_0xe4c9('0x35')]),_0x4979f6);if(_0x26cbd4['query'][_0xe4c9('0x3e')]){_0x3242a7[_0xe4c9('0x3d')]=_['merge'](_0x3242a7[_0xe4c9('0x3d')],{'$or':_[_0xe4c9('0x2d')](_0x4979f6,function(_0x26b7a8){if(_0x26b7a8[_0xe4c9('0x30')]!==_0xe4c9('0x3f')){var _0x5d53ed={};_0x5d53ed[_0x26b7a8[_0xe4c9('0x2c')]]={'$like':'%'+_0x26cbd4[_0xe4c9('0x33')]['filter']+'%'};return _0x5d53ed;}})});}_0x3242a7=_['merge']({},_0x3242a7,_0x26cbd4['options']);var _0xa89251={'where':_0x3242a7['where']};return db[_0xe4c9('0x40')][_0xe4c9('0x1f')](_0xa89251)[_0xe4c9('0x27')](function(_0x1bef0a){_0x2818f5[_0xe4c9('0x1f')]=_0x1bef0a;if(_0x26cbd4[_0xe4c9('0x33')][_0xe4c9('0x41')]){_0x3242a7[_0xe4c9('0x42')]=[{'all':!![]}];}return db[_0xe4c9('0x40')][_0xe4c9('0x43')](_0x3242a7);})[_0xe4c9('0x27')](function(_0x1af669){_0x2818f5[_0xe4c9('0x44')]=_0x1af669;return _0x2818f5;})[_0xe4c9('0x27')](respondWithFilteredResult(_0x22fa68,_0x3242a7))[_0xe4c9('0x45')](handleError(_0x22fa68,null));};exports[_0xe4c9('0x46')]=function(_0x12e896,_0x166ec6){var _0x1fe0de={'raw':![],'where':{'id':_0x12e896[_0xe4c9('0x47')]['id']}},_0x24e4bf={};_0x24e4bf[_0xe4c9('0x32')]=_['keys'](db[_0xe4c9('0x40')]['rawAttributes']);_0x24e4bf[_0xe4c9('0x33')]=_[_0xe4c9('0x34')](_0x12e896[_0xe4c9('0x33')]);_0x24e4bf['filters']=_['intersection'](_0x24e4bf[_0xe4c9('0x32')],_0x24e4bf[_0xe4c9('0x33')]);_0x1fe0de[_0xe4c9('0x36')]=_['intersection'](_0x24e4bf[_0xe4c9('0x32')],qs[_0xe4c9('0x38')](_0x12e896[_0xe4c9('0x33')][_0xe4c9('0x38')]));_0x1fe0de[_0xe4c9('0x36')]=_0x1fe0de['attributes'][_0xe4c9('0x48')]?_0x1fe0de[_0xe4c9('0x36')]:_0x24e4bf[_0xe4c9('0x32')];if(_0x12e896[_0xe4c9('0x33')][_0xe4c9('0x41')]){_0x1fe0de['include']=[{'all':!![]}];}_0x1fe0de=_[_0xe4c9('0x49')]({},_0x1fe0de,_0x12e896[_0xe4c9('0x4a')]);return db[_0xe4c9('0x40')][_0xe4c9('0x4b')](_0x1fe0de)['then'](handleEntityNotFound(_0x166ec6,null))[_0xe4c9('0x27')](respondWithResult(_0x166ec6,null))[_0xe4c9('0x45')](handleError(_0x166ec6,null));};exports['create']=function(_0x193c46,_0x1d1b8d){return db[_0xe4c9('0x40')][_0xe4c9('0x4c')](_0x193c46[_0xe4c9('0x4d')],{})[_0xe4c9('0x27')](function(_0x349544){var _0x2889b9=_0x193c46['user'][_0xe4c9('0x28')]({'plain':!![]});if(!_0x2889b9)throw new Error(_0xe4c9('0x4e'));if(_0x2889b9['role']===_0xe4c9('0x4f')){var _0x12c743=_0x349544[_0xe4c9('0x28')]({'plain':!![]});var _0x13227f=_0xe4c9('0x29');return db[_0xe4c9('0x50')]['find']({'where':{'name':_0x13227f,'userProfileId':_0x2889b9[_0xe4c9('0x51')]},'raw':!![]})[_0xe4c9('0x27')](function(_0x5f57fa){if(_0x5f57fa&&_0x5f57fa[_0xe4c9('0x52')]===0x0){return db[_0xe4c9('0x53')][_0xe4c9('0x4c')]({'name':_0x12c743['name'],'resourceId':_0x12c743['id'],'type':_0x5f57fa['name'],'sectionId':_0x5f57fa['id']},{})[_0xe4c9('0x27')](function(){return _0x349544;});}else{return _0x349544;}})[_0xe4c9('0x45')](function(_0x3ad01c){logger[_0xe4c9('0x2a')](_0xe4c9('0x54'),_0x3ad01c);throw _0x3ad01c;});}return _0x349544;})[_0xe4c9('0x27')](respondWithResult(_0x1d1b8d,0xc9))['catch'](handleError(_0x1d1b8d,null));};exports[_0xe4c9('0x25')]=function(_0x487f3e,_0x23c716){if(_0x487f3e[_0xe4c9('0x4d')]['id']){delete _0x487f3e[_0xe4c9('0x4d')]['id'];}return db['Trigger'][_0xe4c9('0x4b')]({'where':{'id':_0x487f3e['params']['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0x23c716,null))[_0xe4c9('0x27')](saveUpdates(_0x487f3e[_0xe4c9('0x4d')],null))[_0xe4c9('0x27')](respondWithResult(_0x23c716,null))[_0xe4c9('0x45')](handleError(_0x23c716,null));};exports[_0xe4c9('0x26')]=function(_0x885d4c,_0x470735){return db[_0xe4c9('0x40')][_0xe4c9('0x4b')]({'where':{'id':_0x885d4c[_0xe4c9('0x47')]['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0x470735,null))[_0xe4c9('0x27')](removeEntity(_0x470735,null))[_0xe4c9('0x45')](handleError(_0x470735,null));};exports[_0xe4c9('0x55')]=function(_0x41b62b,_0x59ad8b,_0x968345){if(_0x41b62b[_0xe4c9('0x4d')]['id']){delete _0x41b62b['body']['id'];}return db[_0xe4c9('0x40')][_0xe4c9('0x4b')]({'where':{'id':_0x41b62b['params']['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0x59ad8b,null))[_0xe4c9('0x27')](function(_0x3d1757){if(_0x3d1757){_0x41b62b[_0xe4c9('0x4d')][_0xe4c9('0x56')]=_0x3d1757['id'];return db[_0xe4c9('0x57')]['create'](_0x41b62b[_0xe4c9('0x4d')]);}})[_0xe4c9('0x27')](respondWithResult(_0x59ad8b,null))[_0xe4c9('0x45')](handleError(_0x59ad8b,null));};exports[_0xe4c9('0x58')]=function(_0x4833de,_0x5b4c09,_0x502dcb){if(_0x4833de['body']['id']){delete _0x4833de['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x4833de[_0xe4c9('0x47')]['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0x5b4c09,null))[_0xe4c9('0x27')](function(_0x513481){if(_0x513481){_0x4833de[_0xe4c9('0x4d')][_0xe4c9('0x59')]=_0x513481['id'];return db[_0xe4c9('0x57')][_0xe4c9('0x4c')](_0x4833de[_0xe4c9('0x4d')]);}})[_0xe4c9('0x27')](respondWithResult(_0x5b4c09,null))[_0xe4c9('0x45')](handleError(_0x5b4c09,null));};exports[_0xe4c9('0x5a')]=function(_0x13704c,_0xf30fc3,_0x4b4fbe){var _0x29b35b={};var _0x69c1b={};var _0x3082dc;var _0xd9a45;return db[_0xe4c9('0x40')][_0xe4c9('0x5b')]({'where':{'id':_0x13704c[_0xe4c9('0x47')]['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0xf30fc3,null))[_0xe4c9('0x27')](function(_0x245ea7){if(_0x245ea7){_0x3082dc=_0x245ea7;_0x69c1b[_0xe4c9('0x32')]=_['keys'](db[_0xe4c9('0x57')]['rawAttributes']);_0x69c1b[_0xe4c9('0x33')]=_[_0xe4c9('0x34')](_0x13704c['query']);_0x69c1b['filters']=_[_0xe4c9('0x37')](_0x69c1b[_0xe4c9('0x32')],_0x69c1b[_0xe4c9('0x33')]);_0x29b35b['attributes']=_[_0xe4c9('0x37')](_0x69c1b['model'],qs[_0xe4c9('0x38')](_0x13704c['query']['fields']));_0x29b35b[_0xe4c9('0x36')]=_0x29b35b[_0xe4c9('0x36')][_0xe4c9('0x48')]?_0x29b35b[_0xe4c9('0x36')]:_0x69c1b[_0xe4c9('0x32')];_0x29b35b[_0xe4c9('0x3b')]=qs[_0xe4c9('0x3c')](_0x13704c[_0xe4c9('0x33')][_0xe4c9('0x3c')]);_0x29b35b['where']=qs[_0xe4c9('0x35')](_['pick'](_0x13704c[_0xe4c9('0x33')],_0x69c1b[_0xe4c9('0x35')]));if(_0x13704c[_0xe4c9('0x33')][_0xe4c9('0x3e')]){_0x29b35b[_0xe4c9('0x3d')]=_['merge'](_0x29b35b[_0xe4c9('0x3d')],{'$or':_[_0xe4c9('0x2d')](_0x29b35b[_0xe4c9('0x36')],function(_0x46bfdc){var _0x27e015={};_0x27e015[_0x46bfdc]={'$like':'%'+_0x13704c[_0xe4c9('0x33')][_0xe4c9('0x3e')]+'%'};return _0x27e015;})});}_0x29b35b=_[_0xe4c9('0x49')]({},_0x29b35b,_0x13704c[_0xe4c9('0x4a')]);return _0x3082dc['getAllConditions'](_0x29b35b);}})['then'](function(_0x1d7f6f){if(_0x1d7f6f){_0xd9a45=_0x1d7f6f['length'];if(!_0x13704c[_0xe4c9('0x33')][_0xe4c9('0x39')]('nolimit')){_0x29b35b['limit']=qs[_0xe4c9('0x1e')](_0x13704c[_0xe4c9('0x33')][_0xe4c9('0x1e')]);_0x29b35b[_0xe4c9('0x1d')]=qs[_0xe4c9('0x1d')](_0x13704c[_0xe4c9('0x33')]['offset']);}return _0x3082dc[_0xe4c9('0x5a')](_0x29b35b);}})[_0xe4c9('0x27')](function(_0x5908ed){if(_0x5908ed){return _0x5908ed?{'count':_0xd9a45,'rows':_0x5908ed}:null;}})['then'](respondWithResult(_0xf30fc3,null))[_0xe4c9('0x45')](handleError(_0xf30fc3,null));};exports[_0xe4c9('0x5c')]=function(_0x5cf9c9,_0x80079f,_0x2fea9c){var _0x2bccbc={};var _0x45ef59={};var _0x5db52a;var _0x242545;return db['Trigger'][_0xe4c9('0x5b')]({'where':{'id':_0x5cf9c9[_0xe4c9('0x47')]['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0x80079f,null))['then'](function(_0x1d5f0b){if(_0x1d5f0b){_0x5db52a=_0x1d5f0b;_0x45ef59[_0xe4c9('0x32')]=_['keys'](db[_0xe4c9('0x57')]['rawAttributes']);_0x45ef59[_0xe4c9('0x33')]=_['keys'](_0x5cf9c9[_0xe4c9('0x33')]);_0x45ef59[_0xe4c9('0x35')]=_[_0xe4c9('0x37')](_0x45ef59['model'],_0x45ef59['query']);_0x2bccbc[_0xe4c9('0x36')]=_[_0xe4c9('0x37')](_0x45ef59[_0xe4c9('0x32')],qs['fields'](_0x5cf9c9[_0xe4c9('0x33')][_0xe4c9('0x38')]));_0x2bccbc['attributes']=_0x2bccbc[_0xe4c9('0x36')][_0xe4c9('0x48')]?_0x2bccbc['attributes']:_0x45ef59[_0xe4c9('0x32')];_0x2bccbc[_0xe4c9('0x3b')]=qs[_0xe4c9('0x3c')](_0x5cf9c9[_0xe4c9('0x33')]['sort']);_0x2bccbc[_0xe4c9('0x3d')]=qs['filters'](_[_0xe4c9('0x5d')](_0x5cf9c9[_0xe4c9('0x33')],_0x45ef59[_0xe4c9('0x35')]));if(_0x5cf9c9['query'][_0xe4c9('0x3e')]){_0x2bccbc[_0xe4c9('0x3d')]=_['merge'](_0x2bccbc[_0xe4c9('0x3d')],{'$or':_['map'](_0x2bccbc[_0xe4c9('0x36')],function(_0x43e940){var _0x49c6fd={};_0x49c6fd[_0x43e940]={'$like':'%'+_0x5cf9c9[_0xe4c9('0x33')][_0xe4c9('0x3e')]+'%'};return _0x49c6fd;})});}_0x2bccbc=_[_0xe4c9('0x49')]({},_0x2bccbc,_0x5cf9c9[_0xe4c9('0x4a')]);return _0x5db52a[_0xe4c9('0x5c')](_0x2bccbc);}})[_0xe4c9('0x27')](function(_0x10d282){if(_0x10d282){_0x242545=_0x10d282[_0xe4c9('0x48')];if(!_0x5cf9c9[_0xe4c9('0x33')][_0xe4c9('0x39')](_0xe4c9('0x3a'))){_0x2bccbc['limit']=qs[_0xe4c9('0x1e')](_0x5cf9c9['query'][_0xe4c9('0x1e')]);_0x2bccbc[_0xe4c9('0x1d')]=qs[_0xe4c9('0x1d')](_0x5cf9c9['query']['offset']);}return _0x5db52a[_0xe4c9('0x5c')](_0x2bccbc);}})[_0xe4c9('0x27')](function(_0x44234d){if(_0x44234d){return _0x44234d?{'count':_0x242545,'rows':_0x44234d}:null;}})[_0xe4c9('0x27')](respondWithResult(_0x80079f,null))[_0xe4c9('0x45')](handleError(_0x80079f,null));};exports[_0xe4c9('0x5e')]=function(_0x984d4d,_0x51adb0,_0x1a8215){if(_0x984d4d['body']['id']){delete _0x984d4d['body']['id'];}return db[_0xe4c9('0x40')][_0xe4c9('0x4b')]({'where':{'id':_0x984d4d[_0xe4c9('0x47')]['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0x51adb0,null))[_0xe4c9('0x27')](function(_0x1383e8){if(_0x1383e8){_0x984d4d['body'][_0xe4c9('0x5f')]=_0x1383e8['id'];return db[_0xe4c9('0x60')][_0xe4c9('0x4c')](_0x984d4d['body']);}})[_0xe4c9('0x27')](respondWithResult(_0x51adb0,null))[_0xe4c9('0x45')](handleError(_0x51adb0,null));};exports['getActions']=function(_0x30d761,_0x595363,_0x330abc){var _0x2e0024={};var _0x3e6f74={};var _0x1a2a64;var _0x4b28e5;return db[_0xe4c9('0x40')]['findOne']({'where':{'id':_0x30d761[_0xe4c9('0x47')]['id']}})[_0xe4c9('0x27')](handleEntityNotFound(_0x595363,null))[_0xe4c9('0x27')](function(_0x3ca997){if(_0x3ca997){_0x1a2a64=_0x3ca997;_0x3e6f74[_0xe4c9('0x32')]=_['keys'](db[_0xe4c9('0x60')][_0xe4c9('0x2e')]);_0x3e6f74['query']=_[_0xe4c9('0x34')](_0x30d761[_0xe4c9('0x33')]);_0x3e6f74[_0xe4c9('0x35')]=_[_0xe4c9('0x37')](_0x3e6f74[_0xe4c9('0x32')],_0x3e6f74[_0xe4c9('0x33')]);_0x2e0024['attributes']=_[_0xe4c9('0x37')](_0x3e6f74['model'],qs['fields'](_0x30d761['query'][_0xe4c9('0x38')]));_0x2e0024['attributes']=_0x2e0024[_0xe4c9('0x36')][_0xe4c9('0x48')]?_0x2e0024['attributes']:_0x3e6f74[_0xe4c9('0x32')];_0x2e0024[_0xe4c9('0x3b')]=qs[_0xe4c9('0x3c')](_0x30d761['query'][_0xe4c9('0x3c')]);_0x2e0024['where']=qs[_0xe4c9('0x35')](_[_0xe4c9('0x5d')](_0x30d761[_0xe4c9('0x33')],_0x3e6f74[_0xe4c9('0x35')]));if(_0x30d761['query'][_0xe4c9('0x3e')]){_0x2e0024['where']=_[_0xe4c9('0x49')](_0x2e0024[_0xe4c9('0x3d')],{'$or':_[_0xe4c9('0x2d')](_0x2e0024[_0xe4c9('0x36')],function(_0x1bfaeb){var _0x1cd90c={};_0x1cd90c[_0x1bfaeb]={'$like':'%'+_0x30d761[_0xe4c9('0x33')][_0xe4c9('0x3e')]+'%'};return _0x1cd90c;})});}_0x2e0024=_[_0xe4c9('0x49')]({},_0x2e0024,_0x30d761['options']);return _0x1a2a64[_0xe4c9('0x61')](_0x2e0024);}})[_0xe4c9('0x27')](function(_0x4f0cf1){if(_0x4f0cf1){_0x4b28e5=_0x4f0cf1['length'];if(!_0x30d761[_0xe4c9('0x33')][_0xe4c9('0x39')](_0xe4c9('0x3a'))){_0x2e0024[_0xe4c9('0x1e')]=qs['limit'](_0x30d761[_0xe4c9('0x33')]['limit']);_0x2e0024[_0xe4c9('0x1d')]=qs['offset'](_0x30d761['query'][_0xe4c9('0x1d')]);}return _0x1a2a64['getActions'](_0x2e0024);}})['then'](function(_0x4fd486){if(_0x4fd486){return _0x4fd486?{'count':_0x4b28e5,'rows':_0x4fd486}:null;}})[_0xe4c9('0x27')](respondWithResult(_0x595363,null))['catch'](handleError(_0x595363,null));}; \ No newline at end of file +var _0xa94e=['Trigger','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','pick','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','index','map'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa94e,0x94));var _0xea94=function(_0x206ab6,_0x3f7ec3){_0x206ab6=_0x206ab6-0x0;var _0x19abdf=_0xa94e[_0x206ab6];return _0x19abdf;};'use strict';var emlformat=require(_0xea94('0x0'));var rimraf=require(_0xea94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea94('0x2'));var rp=require(_0xea94('0x3'));var moment=require(_0xea94('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea94('0x5'));var path=require(_0xea94('0x6'));var sox=require(_0xea94('0x7'));var csv=require(_0xea94('0x8'));var ejs=require(_0xea94('0x9'));var fs=require('fs');var fs_extra=require(_0xea94('0xa'));var _=require('lodash');var squel=require(_0xea94('0xb'));var crypto=require('crypto');var jsforce=require(_0xea94('0xc'));var deskjs=require(_0xea94('0xd'));var toCsv=require(_0xea94('0x8'));var querystring=require(_0xea94('0xe'));var Papa=require(_0xea94('0xf'));var Redis=require('ioredis');var authService=require(_0xea94('0x10'));var qs=require(_0xea94('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea94('0x12'))(_0xea94('0x13'));var utils=require(_0xea94('0x14'));var config=require(_0xea94('0x15'));var licenseUtil=require(_0xea94('0x16'));var db=require(_0xea94('0x17'))['db'];function respondWithStatusCode(_0x2ecb8f,_0x57757d){_0x57757d=_0x57757d||0xcc;return function(_0x442769){if(_0x442769){return _0x2ecb8f[_0xea94('0x18')](_0x57757d);}return _0x2ecb8f['status'](_0x57757d)[_0xea94('0x19')]();};}function respondWithResult(_0x334aad,_0x96f710){_0x96f710=_0x96f710||0xc8;return function(_0x3ae304){if(_0x3ae304){return _0x334aad[_0xea94('0x1a')](_0x96f710)[_0xea94('0x1b')](_0x3ae304);}};}function respondWithFilteredResult(_0x5050dc,_0x244706){return function(_0x42c144){if(_0x42c144){var _0x1d347c=typeof _0x244706['offset']===_0xea94('0x1c')&&typeof _0x244706[_0xea94('0x1d')]==='undefined';var _0x1f956d=_0x42c144[_0xea94('0x1e')];var _0x3f76f9=_0x1d347c?0x0:_0x244706[_0xea94('0x1f')];var _0x18eef9=_0x1d347c?_0x42c144[_0xea94('0x1e')]:_0x244706['offset']+_0x244706['limit'];var _0xb13917;if(_0x18eef9>=_0x1f956d){_0x18eef9=_0x1f956d;_0xb13917=0xc8;}else{_0xb13917=0xce;}_0x5050dc['status'](_0xb13917);return _0x5050dc[_0xea94('0x20')]('Content-Range',_0x3f76f9+'-'+_0x18eef9+'/'+_0x1f956d)[_0xea94('0x1b')](_0x42c144);}return null;};}function patchUpdates(_0x10de93){return function(_0x3d1019){try{jsonpatch[_0xea94('0x21')](_0x3d1019,_0x10de93,!![]);}catch(_0x4f3a38){return BPromise[_0xea94('0x22')](_0x4f3a38);}return _0x3d1019[_0xea94('0x23')]();};}function saveUpdates(_0x2593ad,_0xd9af4){return function(_0x256dec){if(_0x256dec){return _0x256dec[_0xea94('0x24')](_0x2593ad)['then'](function(_0x41ad4c){return _0x41ad4c;});}return null;};}function removeEntity(_0x208664,_0x218839){return function(_0x5b9d30){if(_0x5b9d30){return _0x5b9d30[_0xea94('0x25')]()[_0xea94('0x26')](function(){var _0x3ee141=_0x5b9d30['get']({'plain':!![]});var _0x5514eb='Triggers';return db['UserProfileResource'][_0xea94('0x25')]({'where':{'type':_0x5514eb,'resourceId':_0x3ee141['id']}})[_0xea94('0x26')](function(){return _0x5b9d30;});})[_0xea94('0x26')](function(){_0x208664[_0xea94('0x1a')](0xcc)[_0xea94('0x19')]();});}};}function handleEntityNotFound(_0x532f90,_0x1e7cfd){return function(_0x4739e5){if(!_0x4739e5){_0x532f90[_0xea94('0x18')](0x194);}return _0x4739e5;};}function handleError(_0x227a21,_0x20407c){_0x20407c=_0x20407c||0x1f4;return function(_0x3672c1){logger[_0xea94('0x27')](_0x3672c1[_0xea94('0x28')]);if(_0x3672c1[_0xea94('0x29')]){delete _0x3672c1[_0xea94('0x29')];}_0x227a21[_0xea94('0x1a')](_0x20407c)['send'](_0x3672c1);};}exports[_0xea94('0x2a')]=function(_0x28c879,_0x86e585){var _0x35b719={},_0x9853fe={},_0x51c477={'count':0x0,'rows':[]};var _0x47dd00=_[_0xea94('0x2b')](db[_0xea94('0x2c')]['rawAttributes'],function(_0x19362){return{'name':_0x19362[_0xea94('0x2d')],'type':_0x19362['type'][_0xea94('0x2e')]};});_0x9853fe[_0xea94('0x2f')]=_[_0xea94('0x2b')](_0x47dd00,'name');_0x9853fe[_0xea94('0x30')]=_[_0xea94('0x31')](_0x28c879['query']);_0x9853fe[_0xea94('0x32')]=_['intersection'](_0x9853fe[_0xea94('0x2f')],_0x9853fe[_0xea94('0x30')]);_0x35b719[_0xea94('0x33')]=_[_0xea94('0x34')](_0x9853fe[_0xea94('0x2f')],qs[_0xea94('0x35')](_0x28c879[_0xea94('0x30')][_0xea94('0x35')]));_0x35b719['attributes']=_0x35b719[_0xea94('0x33')][_0xea94('0x36')]?_0x35b719[_0xea94('0x33')]:_0x9853fe[_0xea94('0x2f')];if(!_0x28c879['query'][_0xea94('0x37')](_0xea94('0x38'))){_0x35b719[_0xea94('0x1d')]=qs[_0xea94('0x1d')](_0x28c879['query'][_0xea94('0x1d')]);_0x35b719[_0xea94('0x1f')]=qs[_0xea94('0x1f')](_0x28c879[_0xea94('0x30')][_0xea94('0x1f')]);}_0x35b719['order']=qs[_0xea94('0x39')](_0x28c879[_0xea94('0x30')][_0xea94('0x39')]);_0x35b719[_0xea94('0x3a')]=qs['filters'](_['pick'](_0x28c879[_0xea94('0x30')],_0x9853fe['filters']),_0x47dd00);if(_0x28c879[_0xea94('0x30')][_0xea94('0x3b')]){_0x35b719[_0xea94('0x3a')]=_['merge'](_0x35b719[_0xea94('0x3a')],{'$or':_[_0xea94('0x2b')](_0x47dd00,function(_0x456cfc){if(_0x456cfc['type']!==_0xea94('0x3c')){var _0x118b24={};_0x118b24[_0x456cfc[_0xea94('0x29')]]={'$like':'%'+_0x28c879[_0xea94('0x30')][_0xea94('0x3b')]+'%'};return _0x118b24;}})});}_0x35b719=_[_0xea94('0x3d')]({},_0x35b719,_0x28c879[_0xea94('0x3e')]);var _0x308486={'where':_0x35b719[_0xea94('0x3a')]};return db[_0xea94('0x2c')]['count'](_0x308486)[_0xea94('0x26')](function(_0x9185b5){_0x51c477[_0xea94('0x1e')]=_0x9185b5;if(_0x28c879[_0xea94('0x30')][_0xea94('0x3f')]){_0x35b719[_0xea94('0x40')]=[{'all':!![]}];}return db[_0xea94('0x2c')][_0xea94('0x41')](_0x35b719);})['then'](function(_0x4f06d9){_0x51c477[_0xea94('0x42')]=_0x4f06d9;return _0x51c477;})[_0xea94('0x26')](respondWithFilteredResult(_0x86e585,_0x35b719))['catch'](handleError(_0x86e585,null));};exports[_0xea94('0x43')]=function(_0x3b6c7c,_0xac1a9b){var _0x4156a9={'raw':![],'where':{'id':_0x3b6c7c[_0xea94('0x44')]['id']}},_0x3575da={};_0x3575da[_0xea94('0x2f')]=_[_0xea94('0x31')](db[_0xea94('0x2c')][_0xea94('0x45')]);_0x3575da[_0xea94('0x30')]=_['keys'](_0x3b6c7c[_0xea94('0x30')]);_0x3575da[_0xea94('0x32')]=_[_0xea94('0x34')](_0x3575da['model'],_0x3575da[_0xea94('0x30')]);_0x4156a9[_0xea94('0x33')]=_['intersection'](_0x3575da['model'],qs[_0xea94('0x35')](_0x3b6c7c['query'][_0xea94('0x35')]));_0x4156a9[_0xea94('0x33')]=_0x4156a9['attributes'][_0xea94('0x36')]?_0x4156a9[_0xea94('0x33')]:_0x3575da[_0xea94('0x2f')];if(_0x3b6c7c[_0xea94('0x30')][_0xea94('0x3f')]){_0x4156a9[_0xea94('0x40')]=[{'all':!![]}];}_0x4156a9=_[_0xea94('0x3d')]({},_0x4156a9,_0x3b6c7c[_0xea94('0x3e')]);return db['Trigger'][_0xea94('0x46')](_0x4156a9)[_0xea94('0x26')](handleEntityNotFound(_0xac1a9b,null))[_0xea94('0x26')](respondWithResult(_0xac1a9b,null))[_0xea94('0x47')](handleError(_0xac1a9b,null));};exports[_0xea94('0x48')]=function(_0x15df43,_0x49da89){return db[_0xea94('0x2c')][_0xea94('0x48')](_0x15df43[_0xea94('0x49')],{})[_0xea94('0x26')](function(_0x10fbf9){var _0x56ed5e=_0x15df43[_0xea94('0x4a')][_0xea94('0x4b')]({'plain':!![]});if(!_0x56ed5e)throw new Error(_0xea94('0x4c'));if(_0x56ed5e[_0xea94('0x4d')]===_0xea94('0x4a')){var _0x75a928=_0x10fbf9[_0xea94('0x4b')]({'plain':!![]});var _0x49aad3='Triggers';return db['UserProfileSection'][_0xea94('0x46')]({'where':{'name':_0x49aad3,'userProfileId':_0x56ed5e[_0xea94('0x4e')]},'raw':!![]})[_0xea94('0x26')](function(_0xe5d55){if(_0xe5d55&&_0xe5d55[_0xea94('0x4f')]===0x0){return db[_0xea94('0x50')]['create']({'name':_0x75a928[_0xea94('0x29')],'resourceId':_0x75a928['id'],'type':_0xe5d55['name'],'sectionId':_0xe5d55['id']},{})[_0xea94('0x26')](function(){return _0x10fbf9;});}else{return _0x10fbf9;}})['catch'](function(_0x23084e){logger['error'](_0xea94('0x51'),_0x23084e);throw _0x23084e;});}return _0x10fbf9;})['then'](respondWithResult(_0x49da89,0xc9))[_0xea94('0x47')](handleError(_0x49da89,null));};exports[_0xea94('0x24')]=function(_0x10fb9d,_0x281f32){if(_0x10fb9d['body']['id']){delete _0x10fb9d[_0xea94('0x49')]['id'];}return db[_0xea94('0x2c')]['find']({'where':{'id':_0x10fb9d['params']['id']}})['then'](handleEntityNotFound(_0x281f32,null))[_0xea94('0x26')](saveUpdates(_0x10fb9d['body'],null))[_0xea94('0x26')](respondWithResult(_0x281f32,null))[_0xea94('0x47')](handleError(_0x281f32,null));};exports['destroy']=function(_0x403261,_0x54d217){return db[_0xea94('0x2c')][_0xea94('0x46')]({'where':{'id':_0x403261['params']['id']}})[_0xea94('0x26')](handleEntityNotFound(_0x54d217,null))[_0xea94('0x26')](removeEntity(_0x54d217,null))['catch'](handleError(_0x54d217,null));};exports[_0xea94('0x52')]=function(_0x5bd029,_0x35cc03,_0x446f4f){if(_0x5bd029['body']['id']){delete _0x5bd029[_0xea94('0x49')]['id'];}return db['Trigger'][_0xea94('0x46')]({'where':{'id':_0x5bd029[_0xea94('0x44')]['id']}})[_0xea94('0x26')](handleEntityNotFound(_0x35cc03,null))[_0xea94('0x26')](function(_0x4ddee9){if(_0x4ddee9){_0x5bd029[_0xea94('0x49')][_0xea94('0x53')]=_0x4ddee9['id'];return db[_0xea94('0x54')][_0xea94('0x48')](_0x5bd029[_0xea94('0x49')]);}})['then'](respondWithResult(_0x35cc03,null))[_0xea94('0x47')](handleError(_0x35cc03,null));};exports[_0xea94('0x55')]=function(_0x4e8ff0,_0x53e997,_0x478c5b){if(_0x4e8ff0[_0xea94('0x49')]['id']){delete _0x4e8ff0[_0xea94('0x49')]['id'];}return db[_0xea94('0x2c')][_0xea94('0x46')]({'where':{'id':_0x4e8ff0['params']['id']}})[_0xea94('0x26')](handleEntityNotFound(_0x53e997,null))[_0xea94('0x26')](function(_0x5a2d3e){if(_0x5a2d3e){_0x4e8ff0['body'][_0xea94('0x56')]=_0x5a2d3e['id'];return db[_0xea94('0x54')]['create'](_0x4e8ff0[_0xea94('0x49')]);}})[_0xea94('0x26')](respondWithResult(_0x53e997,null))['catch'](handleError(_0x53e997,null));};exports[_0xea94('0x57')]=function(_0x95531b,_0x1bb794,_0x1f8552){var _0xd6ba1a={};var _0x2e9e01={};var _0x3745c8;var _0x3d14ab;return db[_0xea94('0x2c')]['findOne']({'where':{'id':_0x95531b['params']['id']}})['then'](handleEntityNotFound(_0x1bb794,null))[_0xea94('0x26')](function(_0x40362e){if(_0x40362e){_0x3745c8=_0x40362e;_0x2e9e01['model']=_[_0xea94('0x31')](db[_0xea94('0x54')][_0xea94('0x45')]);_0x2e9e01[_0xea94('0x30')]=_[_0xea94('0x31')](_0x95531b[_0xea94('0x30')]);_0x2e9e01[_0xea94('0x32')]=_['intersection'](_0x2e9e01[_0xea94('0x2f')],_0x2e9e01[_0xea94('0x30')]);_0xd6ba1a[_0xea94('0x33')]=_[_0xea94('0x34')](_0x2e9e01[_0xea94('0x2f')],qs[_0xea94('0x35')](_0x95531b[_0xea94('0x30')]['fields']));_0xd6ba1a['attributes']=_0xd6ba1a['attributes'][_0xea94('0x36')]?_0xd6ba1a[_0xea94('0x33')]:_0x2e9e01[_0xea94('0x2f')];_0xd6ba1a[_0xea94('0x58')]=qs[_0xea94('0x39')](_0x95531b['query'][_0xea94('0x39')]);_0xd6ba1a['where']=qs['filters'](_[_0xea94('0x59')](_0x95531b[_0xea94('0x30')],_0x2e9e01[_0xea94('0x32')]));if(_0x95531b[_0xea94('0x30')][_0xea94('0x3b')]){_0xd6ba1a['where']=_[_0xea94('0x3d')](_0xd6ba1a['where'],{'$or':_[_0xea94('0x2b')](_0xd6ba1a[_0xea94('0x33')],function(_0x51820c){var _0x2c9c51={};_0x2c9c51[_0x51820c]={'$like':'%'+_0x95531b['query'][_0xea94('0x3b')]+'%'};return _0x2c9c51;})});}_0xd6ba1a=_[_0xea94('0x3d')]({},_0xd6ba1a,_0x95531b[_0xea94('0x3e')]);return _0x3745c8[_0xea94('0x57')](_0xd6ba1a);}})[_0xea94('0x26')](function(_0x2212b7){if(_0x2212b7){_0x3d14ab=_0x2212b7['length'];if(!_0x95531b['query'][_0xea94('0x37')](_0xea94('0x38'))){_0xd6ba1a[_0xea94('0x1d')]=qs[_0xea94('0x1d')](_0x95531b[_0xea94('0x30')][_0xea94('0x1d')]);_0xd6ba1a[_0xea94('0x1f')]=qs[_0xea94('0x1f')](_0x95531b['query'][_0xea94('0x1f')]);}return _0x3745c8[_0xea94('0x57')](_0xd6ba1a);}})[_0xea94('0x26')](function(_0x3cb935){if(_0x3cb935){return _0x3cb935?{'count':_0x3d14ab,'rows':_0x3cb935}:null;}})[_0xea94('0x26')](respondWithResult(_0x1bb794,null))[_0xea94('0x47')](handleError(_0x1bb794,null));};exports[_0xea94('0x5a')]=function(_0x249b06,_0x18106a,_0x2ee69e){var _0x5bb752={};var _0x21e563={};var _0x4a7f1d;var _0x17df0e;return db['Trigger'][_0xea94('0x5b')]({'where':{'id':_0x249b06[_0xea94('0x44')]['id']}})[_0xea94('0x26')](handleEntityNotFound(_0x18106a,null))[_0xea94('0x26')](function(_0x4b8442){if(_0x4b8442){_0x4a7f1d=_0x4b8442;_0x21e563[_0xea94('0x2f')]=_['keys'](db[_0xea94('0x54')][_0xea94('0x45')]);_0x21e563['query']=_[_0xea94('0x31')](_0x249b06[_0xea94('0x30')]);_0x21e563[_0xea94('0x32')]=_['intersection'](_0x21e563[_0xea94('0x2f')],_0x21e563['query']);_0x5bb752[_0xea94('0x33')]=_[_0xea94('0x34')](_0x21e563['model'],qs['fields'](_0x249b06[_0xea94('0x30')]['fields']));_0x5bb752['attributes']=_0x5bb752[_0xea94('0x33')][_0xea94('0x36')]?_0x5bb752['attributes']:_0x21e563[_0xea94('0x2f')];_0x5bb752['order']=qs[_0xea94('0x39')](_0x249b06[_0xea94('0x30')]['sort']);_0x5bb752[_0xea94('0x3a')]=qs[_0xea94('0x32')](_[_0xea94('0x59')](_0x249b06['query'],_0x21e563['filters']));if(_0x249b06[_0xea94('0x30')][_0xea94('0x3b')]){_0x5bb752['where']=_[_0xea94('0x3d')](_0x5bb752[_0xea94('0x3a')],{'$or':_['map'](_0x5bb752[_0xea94('0x33')],function(_0x2c4fcb){var _0x4c38ad={};_0x4c38ad[_0x2c4fcb]={'$like':'%'+_0x249b06[_0xea94('0x30')][_0xea94('0x3b')]+'%'};return _0x4c38ad;})});}_0x5bb752=_[_0xea94('0x3d')]({},_0x5bb752,_0x249b06['options']);return _0x4a7f1d['getAnyConditions'](_0x5bb752);}})[_0xea94('0x26')](function(_0x29a7c5){if(_0x29a7c5){_0x17df0e=_0x29a7c5[_0xea94('0x36')];if(!_0x249b06['query'][_0xea94('0x37')](_0xea94('0x38'))){_0x5bb752['limit']=qs[_0xea94('0x1d')](_0x249b06[_0xea94('0x30')][_0xea94('0x1d')]);_0x5bb752['offset']=qs[_0xea94('0x1f')](_0x249b06['query']['offset']);}return _0x4a7f1d[_0xea94('0x5a')](_0x5bb752);}})[_0xea94('0x26')](function(_0x55ddde){if(_0x55ddde){return _0x55ddde?{'count':_0x17df0e,'rows':_0x55ddde}:null;}})[_0xea94('0x26')](respondWithResult(_0x18106a,null))[_0xea94('0x47')](handleError(_0x18106a,null));};exports[_0xea94('0x5c')]=function(_0xd7b720,_0x3c6f64,_0x289c82){if(_0xd7b720['body']['id']){delete _0xd7b720[_0xea94('0x49')]['id'];}return db[_0xea94('0x2c')]['find']({'where':{'id':_0xd7b720[_0xea94('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c6f64,null))[_0xea94('0x26')](function(_0xb07b0f){if(_0xb07b0f){_0xd7b720[_0xea94('0x49')][_0xea94('0x5d')]=_0xb07b0f['id'];return db[_0xea94('0x5e')][_0xea94('0x48')](_0xd7b720[_0xea94('0x49')]);}})[_0xea94('0x26')](respondWithResult(_0x3c6f64,null))[_0xea94('0x47')](handleError(_0x3c6f64,null));};exports[_0xea94('0x5f')]=function(_0x1b1d55,_0x441db2,_0x40dde8){var _0x191d8a={};var _0x146f28={};var _0x38ddb6;var _0x5d716c;return db[_0xea94('0x2c')][_0xea94('0x5b')]({'where':{'id':_0x1b1d55['params']['id']}})[_0xea94('0x26')](handleEntityNotFound(_0x441db2,null))[_0xea94('0x26')](function(_0x57d675){if(_0x57d675){_0x38ddb6=_0x57d675;_0x146f28[_0xea94('0x2f')]=_[_0xea94('0x31')](db[_0xea94('0x5e')]['rawAttributes']);_0x146f28[_0xea94('0x30')]=_[_0xea94('0x31')](_0x1b1d55[_0xea94('0x30')]);_0x146f28[_0xea94('0x32')]=_['intersection'](_0x146f28[_0xea94('0x2f')],_0x146f28['query']);_0x191d8a[_0xea94('0x33')]=_[_0xea94('0x34')](_0x146f28[_0xea94('0x2f')],qs[_0xea94('0x35')](_0x1b1d55['query'][_0xea94('0x35')]));_0x191d8a[_0xea94('0x33')]=_0x191d8a[_0xea94('0x33')]['length']?_0x191d8a[_0xea94('0x33')]:_0x146f28[_0xea94('0x2f')];_0x191d8a[_0xea94('0x58')]=qs[_0xea94('0x39')](_0x1b1d55[_0xea94('0x30')][_0xea94('0x39')]);_0x191d8a[_0xea94('0x3a')]=qs['filters'](_[_0xea94('0x59')](_0x1b1d55['query'],_0x146f28['filters']));if(_0x1b1d55['query'][_0xea94('0x3b')]){_0x191d8a['where']=_[_0xea94('0x3d')](_0x191d8a['where'],{'$or':_['map'](_0x191d8a['attributes'],function(_0x38987f){var _0x3eadd2={};_0x3eadd2[_0x38987f]={'$like':'%'+_0x1b1d55[_0xea94('0x30')][_0xea94('0x3b')]+'%'};return _0x3eadd2;})});}_0x191d8a=_['merge']({},_0x191d8a,_0x1b1d55['options']);return _0x38ddb6[_0xea94('0x5f')](_0x191d8a);}})['then'](function(_0xf6792a){if(_0xf6792a){_0x5d716c=_0xf6792a[_0xea94('0x36')];if(!_0x1b1d55['query'][_0xea94('0x37')](_0xea94('0x38'))){_0x191d8a[_0xea94('0x1d')]=qs[_0xea94('0x1d')](_0x1b1d55[_0xea94('0x30')]['limit']);_0x191d8a['offset']=qs[_0xea94('0x1f')](_0x1b1d55[_0xea94('0x30')]['offset']);}return _0x38ddb6[_0xea94('0x5f')](_0x191d8a);}})['then'](function(_0x38d581){if(_0x38d581){return _0x38d581?{'count':_0x5d716c,'rows':_0x38d581}:null;}})[_0xea94('0x26')](respondWithResult(_0x441db2,null))[_0xea94('0x47')](handleError(_0x441db2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index fa0f4c2..96ff28f 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 _0xe644=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2e781d,_0x33a1f3){var _0x2e0e54=function(_0x357846){while(--_0x357846){_0x2e781d['push'](_0x2e781d['shift']());}};_0x2e0e54(++_0x33a1f3);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./trigger.attributes','define','Trigger'];(function(_0x5645ff,_0x4f1943){var _0x5d90d7=function(_0x40c008){while(--_0x40c008){_0x5645ff['push'](_0x5645ff['shift']());}};_0x5d90d7(++_0x4f1943);}(_0x99e9,0xb4));var _0x999e=function(_0x12939d,_0x24971d){_0x12939d=_0x12939d-0x0;var _0x38f9ab=_0x99e9[_0x12939d];return _0x38f9ab;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'tools_triggers','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 3c16224..722cec8 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 _0x170b=['client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','catch','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3861b6,_0x4eaf61){var _0x4c6594=function(_0x35e736){while(--_0x35e736){_0x3861b6['push'](_0x3861b6['shift']());}};_0x4c6594(++_0x4eaf61);}(_0x170b,0xae));var _0xb170=function(_0x3d87ba,_0x55e6d6){_0x3d87ba=_0x3d87ba-0x0;var _0x2b951c=_0x170b[_0x3d87ba];return _0x2b951c;};'use strict';var _=require(_0xb170('0x0'));var util=require(_0xb170('0x1'));var moment=require(_0xb170('0x2'));var BPromise=require(_0xb170('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb170('0x4'));var db=require(_0xb170('0x5'))['db'];var utils=require(_0xb170('0x6'));var logger=require(_0xb170('0x7'))(_0xb170('0x8'));var config=require(_0xb170('0x9'));var jayson=require(_0xb170('0xa'));var client=jayson[_0xb170('0xb')][_0xb170('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x245540,_0xdfddd5,_0x1062c7){return new BPromise(function(_0x1c4a86,_0x523df7){return client[_0xb170('0xd')](_0x245540,_0x1062c7)[_0xb170('0xe')](function(_0x57be33){logger[_0xb170('0xf')](_0xb170('0x10'),_0xdfddd5,'request\x20sent');logger[_0xb170('0x11')](_0xb170('0x12'),_0xdfddd5,_0xb170('0x13'),JSON[_0xb170('0x14')](_0x57be33));if(_0x57be33[_0xb170('0x15')]){if(_0x57be33[_0xb170('0x15')][_0xb170('0x16')]===0x1f4){logger['error'](_0xb170('0x10'),_0xdfddd5,_0x57be33['error']['message']);return _0x523df7(_0x57be33['error'][_0xb170('0x17')]);}logger[_0xb170('0x15')]('Trigger,\x20%s,\x20%s',_0xdfddd5,_0x57be33['error']['message']);return _0x1c4a86(_0x57be33[_0xb170('0x15')]['message']);}else{logger[_0xb170('0xf')](_0xb170('0x10'),_0xdfddd5,'request\x20sent');_0x1c4a86(_0x57be33[_0xb170('0x18')][_0xb170('0x17')]);}})['catch'](function(_0x6dafc1){logger['error'](_0xb170('0x10'),_0xdfddd5,_0x6dafc1);_0x523df7(_0x6dafc1);});});}exports[_0xb170('0x19')]=function(_0x39c19d){var _0x77540=this;return new Promise(function(_0x3a19c3,_0x18e357){return db[_0xb170('0x1a')]['findAll']({'raw':_0x39c19d['options']?_0x39c19d[_0xb170('0x1b')][_0xb170('0x1c')]===undefined?!![]:![]:!![],'where':_0x39c19d[_0xb170('0x1b')]?_0x39c19d[_0xb170('0x1b')][_0xb170('0x1d')]||null:null,'attributes':_0x39c19d[_0xb170('0x1b')]?_0x39c19d[_0xb170('0x1b')][_0xb170('0x1e')]||null:null,'limit':_0x39c19d[_0xb170('0x1b')]?_0x39c19d['options']['limit']||null:null,'include':_0x39c19d[_0xb170('0x1b')]?_0x39c19d[_0xb170('0x1b')][_0xb170('0x1f')]?_[_0xb170('0x20')](_0x39c19d[_0xb170('0x1b')][_0xb170('0x1f')],function(_0x15a617){return{'model':db[_0x15a617[_0xb170('0x21')]],'as':_0x15a617['as'],'attributes':_0x15a617['attributes'],'include':_0x15a617[_0xb170('0x1f')]?_[_0xb170('0x20')](_0x15a617[_0xb170('0x1f')],function(_0x4f280b){return{'model':db[_0x4f280b[_0xb170('0x21')]],'as':_0x4f280b['as'],'attributes':_0x4f280b[_0xb170('0x1e')],'include':_0x4f280b[_0xb170('0x1f')]?_['map'](_0x4f280b[_0xb170('0x1f')],function(_0x3d4a0b){return{'model':db[_0x3d4a0b[_0xb170('0x21')]],'as':_0x3d4a0b['as'],'attributes':_0x3d4a0b[_0xb170('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb170('0xe')](function(_0xbbfb79){logger[_0xb170('0xf')](_0xb170('0x19'),_0x39c19d);logger[_0xb170('0x11')](_0xb170('0x19'),_0x39c19d,JSON[_0xb170('0x14')](_0xbbfb79));_0x3a19c3(_0xbbfb79);})[_0xb170('0x22')](function(_0x26ca00){logger['error'](_0xb170('0x19'),_0x26ca00[_0xb170('0x17')],_0x39c19d);_0x18e357(_0x77540[_0xb170('0x15')](0x1f4,_0x26ca00[_0xb170('0x17')]));});});};exports[_0xb170('0x23')]=function(_0x388f93){var _0x17b57b=this;return new Promise(function(_0x5b1b39,_0x148815){return db[_0xb170('0x1a')][_0xb170('0x24')]({'raw':_0x388f93[_0xb170('0x1b')]?_0x388f93['options'][_0xb170('0x1c')]===undefined?!![]:![]:!![],'where':_0x388f93[_0xb170('0x1b')]?_0x388f93[_0xb170('0x1b')][_0xb170('0x1d')]||null:null,'attributes':_0x388f93['options']?_0x388f93[_0xb170('0x1b')][_0xb170('0x1e')]||null:null,'include':_0x388f93['options']?_0x388f93['options'][_0xb170('0x1f')]?_[_0xb170('0x20')](_0x388f93['options'][_0xb170('0x1f')],function(_0x3d2af0){return{'model':db[_0x3d2af0['model']],'as':_0x3d2af0['as'],'attributes':_0x3d2af0[_0xb170('0x1e')],'include':_0x3d2af0[_0xb170('0x1f')]?_[_0xb170('0x20')](_0x3d2af0['include'],function(_0x513270){return{'model':db[_0x513270['model']],'as':_0x513270['as'],'attributes':_0x513270[_0xb170('0x1e')],'include':_0x513270[_0xb170('0x1f')]?_[_0xb170('0x20')](_0x513270['include'],function(_0x2715cc){return{'model':db[_0x2715cc[_0xb170('0x21')]],'as':_0x2715cc['as'],'attributes':_0x2715cc[_0xb170('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb170('0xe')](function(_0xd9c979){logger[_0xb170('0xf')](_0xb170('0x23'),_0x388f93);logger['debug']('ShowTrigger',_0x388f93,JSON[_0xb170('0x14')](_0xd9c979));_0x5b1b39(_0xd9c979);})[_0xb170('0x22')](function(_0x3767f7){logger[_0xb170('0x15')](_0xb170('0x23'),_0x3767f7[_0xb170('0x17')],_0x388f93);_0x148815(_0x17b57b[_0xb170('0x15')](0x1f4,_0x3767f7[_0xb170('0x17')]));});});}; \ No newline at end of file +var _0x3187=['randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','catch','ShowTrigger','find','lodash','util','bluebird'];(function(_0x18030b,_0x4e9071){var _0x52aac6=function(_0x27a74a){while(--_0x27a74a){_0x18030b['push'](_0x18030b['shift']());}};_0x52aac6(++_0x4e9071);}(_0x3187,0x189));var _0x7318=function(_0x53c119,_0x587bf1){_0x53c119=_0x53c119-0x0;var _0x59593e=_0x3187[_0x53c119];return _0x59593e;};'use strict';var _=require(_0x7318('0x0'));var util=require(_0x7318('0x1'));var moment=require('moment');var BPromise=require(_0x7318('0x2'));var rs=require(_0x7318('0x3'));var fs=require('fs');var Redis=require(_0x7318('0x4'));var db=require(_0x7318('0x5'))['db'];var utils=require(_0x7318('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7318('0x7')][_0x7318('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x468100,_0x1ecc01,_0x3d5ffc){return new BPromise(function(_0x82a248,_0x511f24){return client[_0x7318('0x9')](_0x468100,_0x3d5ffc)[_0x7318('0xa')](function(_0x36e62a){logger[_0x7318('0xb')](_0x7318('0xc'),_0x1ecc01,_0x7318('0xd'));logger[_0x7318('0xe')](_0x7318('0xf'),_0x1ecc01,'request\x20sent',JSON[_0x7318('0x10')](_0x36e62a));if(_0x36e62a[_0x7318('0x11')]){if(_0x36e62a[_0x7318('0x11')][_0x7318('0x12')]===0x1f4){logger[_0x7318('0x11')](_0x7318('0xc'),_0x1ecc01,_0x36e62a['error'][_0x7318('0x13')]);return _0x511f24(_0x36e62a[_0x7318('0x11')][_0x7318('0x13')]);}logger[_0x7318('0x11')](_0x7318('0xc'),_0x1ecc01,_0x36e62a[_0x7318('0x11')][_0x7318('0x13')]);return _0x82a248(_0x36e62a['error']['message']);}else{logger[_0x7318('0xb')]('Trigger,\x20%s,\x20%s',_0x1ecc01,_0x7318('0xd'));_0x82a248(_0x36e62a[_0x7318('0x14')][_0x7318('0x13')]);}})['catch'](function(_0x26d677){logger['error'](_0x7318('0xc'),_0x1ecc01,_0x26d677);_0x511f24(_0x26d677);});});}exports[_0x7318('0x15')]=function(_0x3f79c1){var _0x471235=this;return new Promise(function(_0x15e146,_0x9b58d0){return db[_0x7318('0x16')]['findAll']({'raw':_0x3f79c1[_0x7318('0x17')]?_0x3f79c1['options'][_0x7318('0x18')]===undefined?!![]:![]:!![],'where':_0x3f79c1[_0x7318('0x17')]?_0x3f79c1[_0x7318('0x17')][_0x7318('0x19')]||null:null,'attributes':_0x3f79c1[_0x7318('0x17')]?_0x3f79c1[_0x7318('0x17')][_0x7318('0x1a')]||null:null,'limit':_0x3f79c1[_0x7318('0x17')]?_0x3f79c1['options']['limit']||null:null,'include':_0x3f79c1[_0x7318('0x17')]?_0x3f79c1[_0x7318('0x17')][_0x7318('0x1b')]?_[_0x7318('0x1c')](_0x3f79c1[_0x7318('0x17')][_0x7318('0x1b')],function(_0x51550a){return{'model':db[_0x51550a[_0x7318('0x1d')]],'as':_0x51550a['as'],'attributes':_0x51550a[_0x7318('0x1a')],'include':_0x51550a[_0x7318('0x1b')]?_[_0x7318('0x1c')](_0x51550a['include'],function(_0x11539f){return{'model':db[_0x11539f['model']],'as':_0x11539f['as'],'attributes':_0x11539f[_0x7318('0x1a')],'include':_0x11539f[_0x7318('0x1b')]?_['map'](_0x11539f['include'],function(_0x254d67){return{'model':db[_0x254d67[_0x7318('0x1d')]],'as':_0x254d67['as'],'attributes':_0x254d67[_0x7318('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cbfff){logger[_0x7318('0xb')](_0x7318('0x15'),_0x3f79c1);logger['debug'](_0x7318('0x15'),_0x3f79c1,JSON[_0x7318('0x10')](_0x4cbfff));_0x15e146(_0x4cbfff);})[_0x7318('0x1e')](function(_0x572740){logger[_0x7318('0x11')](_0x7318('0x15'),_0x572740[_0x7318('0x13')],_0x3f79c1);_0x9b58d0(_0x471235[_0x7318('0x11')](0x1f4,_0x572740[_0x7318('0x13')]));});});};exports[_0x7318('0x1f')]=function(_0x5878b0){var _0x2c0a66=this;return new Promise(function(_0x44b34d,_0x2dea3a){return db['Trigger'][_0x7318('0x20')]({'raw':_0x5878b0[_0x7318('0x17')]?_0x5878b0['options'][_0x7318('0x18')]===undefined?!![]:![]:!![],'where':_0x5878b0[_0x7318('0x17')]?_0x5878b0[_0x7318('0x17')][_0x7318('0x19')]||null:null,'attributes':_0x5878b0[_0x7318('0x17')]?_0x5878b0[_0x7318('0x17')][_0x7318('0x1a')]||null:null,'include':_0x5878b0['options']?_0x5878b0[_0x7318('0x17')][_0x7318('0x1b')]?_[_0x7318('0x1c')](_0x5878b0[_0x7318('0x17')][_0x7318('0x1b')],function(_0x59064e){return{'model':db[_0x59064e[_0x7318('0x1d')]],'as':_0x59064e['as'],'attributes':_0x59064e[_0x7318('0x1a')],'include':_0x59064e[_0x7318('0x1b')]?_['map'](_0x59064e[_0x7318('0x1b')],function(_0x4b4c71){return{'model':db[_0x4b4c71['model']],'as':_0x4b4c71['as'],'attributes':_0x4b4c71['attributes'],'include':_0x4b4c71['include']?_[_0x7318('0x1c')](_0x4b4c71['include'],function(_0x2dcea6){return{'model':db[_0x2dcea6[_0x7318('0x1d')]],'as':_0x2dcea6['as'],'attributes':_0x2dcea6[_0x7318('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7318('0xa')](function(_0x6bd975){logger['info']('ShowTrigger',_0x5878b0);logger[_0x7318('0xe')](_0x7318('0x1f'),_0x5878b0,JSON[_0x7318('0x10')](_0x6bd975));_0x44b34d(_0x6bd975);})[_0x7318('0x1e')](function(_0x5addd3){logger[_0x7318('0x11')](_0x7318('0x1f'),_0x5addd3[_0x7318('0x13')],_0x5878b0);_0x2dea3a(_0x2c0a66['error'](0x1f4,_0x5addd3['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 2794e70..f036696 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 _0xad04=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','delete','destroy','exports','multer','path'];(function(_0x2a9263,_0x2f7733){var _0x12bff9=function(_0x3677e2){while(--_0x3677e2){_0x2a9263['push'](_0x2a9263['shift']());}};_0x12bff9(++_0x2f7733);}(_0xad04,0xd0));var _0x4ad0=function(_0x478674,_0x273d93){_0x478674=_0x478674-0x0;var _0x132549=_0xad04[_0x478674];return _0x132549;};'use strict';var multer=require(_0x4ad0('0x0'));var util=require('util');var path=require(_0x4ad0('0x1'));var timeout=require(_0x4ad0('0x2'));var express=require(_0x4ad0('0x3'));var router=express[_0x4ad0('0x4')]();var fs_extra=require(_0x4ad0('0x5'));var auth=require(_0x4ad0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4ad0('0x7'));var controller=require(_0x4ad0('0x8'));router[_0x4ad0('0x9')]('/',auth[_0x4ad0('0xa')](),controller[_0x4ad0('0xb')]);router[_0x4ad0('0x9')](_0x4ad0('0xc'),auth[_0x4ad0('0xa')](),controller[_0x4ad0('0xd')]);router[_0x4ad0('0xe')](_0x4ad0('0xf'),auth[_0x4ad0('0xa')](),controller['clone']);router[_0x4ad0('0xe')]('/',auth['isAuthenticated'](),controller[_0x4ad0('0x10')]);router[_0x4ad0('0x11')](_0x4ad0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4ad0('0x12')](_0x4ad0('0xc'),auth[_0x4ad0('0xa')](),controller[_0x4ad0('0x13')]);module[_0x4ad0('0x14')]=router; \ No newline at end of file +var _0xed47=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0xe1ada1,_0x11d856){var _0xa8d955=function(_0x52134d){while(--_0x52134d){_0xe1ada1['push'](_0xe1ada1['shift']());}};_0xa8d955(++_0x11d856);}(_0xed47,0x81));var _0x7ed4=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0xed47[_0xbc346f];return _0x9f9260;};'use strict';var multer=require(_0x7ed4('0x0'));var util=require(_0x7ed4('0x1'));var path=require(_0x7ed4('0x2'));var timeout=require(_0x7ed4('0x3'));var express=require(_0x7ed4('0x4'));var router=express['Router']();var fs_extra=require(_0x7ed4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ed4('0x6'));var controller=require(_0x7ed4('0x7'));router[_0x7ed4('0x8')]('/',auth[_0x7ed4('0x9')](),controller[_0x7ed4('0xa')]);router[_0x7ed4('0x8')](_0x7ed4('0xb'),auth[_0x7ed4('0x9')](),controller[_0x7ed4('0xc')]);router[_0x7ed4('0xd')](_0x7ed4('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0x7ed4('0xd')]('/',auth[_0x7ed4('0x9')](),controller['create']);router['put'](_0x7ed4('0xb'),auth[_0x7ed4('0x9')](),controller[_0x7ed4('0xf')]);router[_0x7ed4('0x10')](_0x7ed4('0xb'),auth[_0x7ed4('0x9')](),controller['destroy']);module[_0x7ed4('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 830d15e..1e441cc 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 _0xbf22=['peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','dynamic','nonat','update,nonat','BOOLEAN','STRING','name','ENUM','friend','user'];(function(_0x2a2c7f,_0x50a1d3){var _0x488e8a=function(_0x28bae2){while(--_0x28bae2){_0x2a2c7f['push'](_0x2a2c7f['shift']());}};_0x488e8a(++_0x50a1d3);}(_0xbf22,0x145));var _0x2bf2=function(_0x4171e4,_0x4ce03e){_0x4171e4=_0x4171e4-0x0;var _0x2eb845=_0xbf22[_0x4171e4];return _0x2eb845;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2bf2('0x0')],'allowNull':![],'unique':_0x2bf2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x3'),_0x2bf2('0x4'),_0x2bf2('0x5')),'allowNull':![],'defaultValue':_0x2bf2('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2bf2('0x6')},'callingpres':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x7'),_0x2bf2('0x8'),_0x2bf2('0x9'),_0x2bf2('0xa'),_0x2bf2('0xb'),_0x2bf2('0xc'),_0x2bf2('0xd'),_0x2bf2('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2bf2('0x0')]},'secret':{'type':Sequelize[_0x2bf2('0x0')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x2bf2('0x0')]},'transport':{'type':Sequelize[_0x2bf2('0x0')],'defaultValue':_0x2bf2('0xf'),'set':function(_0x3e07cd){this[_0x2bf2('0x10')](_0x2bf2('0x11'),_0x3e07cd?_0x3e07cd[_0x2bf2('0x12')](','):null);},'get':function(){return this['getDataValue'](_0x2bf2('0x11'))?this[_0x2bf2('0x13')]('transport')[_0x2bf2('0x14')](','):null;},'comment':_0x2bf2('0x15')},'dtmfmode':{'type':Sequelize[_0x2bf2('0x2')]('rfc2833',_0x2bf2('0x16'),_0x2bf2('0x17'),'inband',_0x2bf2('0x18')),'defaultValue':_0x2bf2('0x19')},'directmedia':{'type':Sequelize[_0x2bf2('0x2')]('yes','no','nonat',_0x2bf2('0x1a'),_0x2bf2('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2bf2('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2bf2('0x0')]},'directmediadeny':{'type':Sequelize[_0x2bf2('0x0')]},'nat':{'type':Sequelize[_0x2bf2('0x0')],'defaultValue':_0x2bf2('0x1d'),'set':function(_0x3b3a2a){this[_0x2bf2('0x10')](_0x2bf2('0x1e'),_0x3b3a2a?_0x3b3a2a['join'](','):null);},'get':function(){return this[_0x2bf2('0x13')](_0x2bf2('0x1e'))?this[_0x2bf2('0x13')](_0x2bf2('0x1e'))[_0x2bf2('0x14')](','):null;},'comment':_0x2bf2('0x1f')},'callgroup':{'type':Sequelize[_0x2bf2('0x0')]},'namedcallgroup':{'type':Sequelize[_0x2bf2('0x0')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2bf2('0x0')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2bf2('0x0')],'defaultValue':_0x2bf2('0x20')},'allow':{'type':Sequelize[_0x2bf2('0x0')],'allowNull':![],'defaultValue':_0x2bf2('0x21'),'set':function(_0x21c58f){this[_0x2bf2('0x10')]('allow',_0x21c58f?_0x21c58f[_0x2bf2('0x12')](';'):_0x2bf2('0x21'));},'get':function(){return this[_0x2bf2('0x13')](_0x2bf2('0x22'))?this[_0x2bf2('0x13')](_0x2bf2('0x22'))[_0x2bf2('0x14')](';'):null;},'comment':_0x2bf2('0x23')},'autoframing':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'insecure':{'type':Sequelize[_0x2bf2('0x0')],'defaultValue':_0x2bf2('0x24'),'set':function(_0xa3a94b){this['setDataValue'](_0x2bf2('0x25'),_0xa3a94b?_0xa3a94b['join'](','):null);},'get':function(){return this[_0x2bf2('0x13')](_0x2bf2('0x25'))?this['getDataValue']('insecure')[_0x2bf2('0x14')](','):null;},'comment':_0x2bf2('0x26')},'trustrpid':{'type':Sequelize[_0x2bf2('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2bf2('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no',_0x2bf2('0x27'))},'promiscredir':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'accountcode':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2bf2('0x0')],'defaultValue':_0x2bf2('0x29')},'amaflags':{'type':Sequelize[_0x2bf2('0x0')]},'callcounter':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2bf2('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2bf2('0x1c'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'mailbox':{'type':Sequelize[_0x2bf2('0x0')]},'session_timers':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x2a'),_0x2bf2('0x2b'),_0x2bf2('0x2c'))},'session_expires':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x2bf2('0x2')]('uac','uas'),'defaultValue':_0x2bf2('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x2bf2('0x0')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2bf2('0x0')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no'),'defaultValue':_0x2bf2('0x1c')},'keepalive':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no',_0x2bf2('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2bf2('0x0')]},'callbackextension':{'type':Sequelize[_0x2bf2('0x0')]},'timert1':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'timerb':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x2bf2('0x0')]},'contactacl':{'type':Sequelize[_0x2bf2('0x0')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x2bf2('0x0')]},'maxforwards':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'encryption':{'type':Sequelize[_0x2bf2('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'force_avp':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'icesupport':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no',_0x2bf2('0x2f'),_0x2bf2('0x30'))},'dtlsrekey':{'type':Sequelize[_0x2bf2('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2bf2('0x0')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x2bf2('0x0')]},'dtlscafile':{'type':Sequelize[_0x2bf2('0x0')]},'dtlscapath':{'type':Sequelize[_0x2bf2('0x0')]},'dtlssetup':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x31'),_0x2bf2('0x32'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2bf2('0x0')]},'usereqphone':{'type':Sequelize[_0x2bf2('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2bf2('0x0')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2bf2('0x0')]},'mohsuggest':{'type':Sequelize[_0x2bf2('0x0')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2bf2('0x0')]},'host':{'type':Sequelize[_0x2bf2('0x0')],'defaultValue':_0x2bf2('0x33')},'canreinvite':{'type':Sequelize[_0x2bf2('0x2')](_0x2bf2('0x1c'),'no',_0x2bf2('0x34'),_0x2bf2('0x1a'),_0x2bf2('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2bf2('0x0')]},'otherFields':{'type':Sequelize[_0x2bf2('0x0')]},'active':{'type':Sequelize[_0x2bf2('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2bf2('0x0')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9ff6=['allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','nonat','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x4ee74c,_0x52ea12){var _0x120b15=function(_0x63fc3){while(--_0x63fc3){_0x4ee74c['push'](_0x4ee74c['shift']());}};_0x120b15(++_0x52ea12);}(_0x9ff6,0xb3));var _0x69ff=function(_0x268396,_0x864c1c){_0x268396=_0x268396-0x0;var _0x2d7b5d=_0x9ff6[_0x268396];return _0x2d7b5d;};'use strict';var Sequelize=require(_0x69ff('0x0'));module[_0x69ff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x69ff('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x4'),_0x69ff('0x5'),_0x69ff('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x69ff('0x7')],'allowNull':![],'defaultValue':_0x69ff('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0x69ff('0x9'),'ALLOWED_PASSED_SCREEN',_0x69ff('0xa'),_0x69ff('0xb'),'PROHIB_NOT_SCREENED',_0x69ff('0xc'),_0x69ff('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x69ff('0x7')]},'permit':{'type':Sequelize[_0x69ff('0x7')]},'secret':{'type':Sequelize[_0x69ff('0x7')]},'md5secret':{'type':Sequelize[_0x69ff('0x7')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x69ff('0x7')],'defaultValue':'udp','set':function(_0x533cb2){this[_0x69ff('0xe')]('transport',_0x533cb2?_0x533cb2[_0x69ff('0xf')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x69ff('0x10')](_0x69ff('0x11'))['split'](','):null;},'comment':_0x69ff('0x12')},'dtmfmode':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x13'),_0x69ff('0x14'),_0x69ff('0x15'),_0x69ff('0x16'),_0x69ff('0x17')),'defaultValue':_0x69ff('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x69ff('0x18'),'no','nonat',_0x69ff('0x19'),_0x69ff('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x69ff('0x7')]},'directmediadeny':{'type':Sequelize[_0x69ff('0x7')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x69ff('0x1b'),'set':function(_0x334dc6){this['setDataValue'](_0x69ff('0x1c'),_0x334dc6?_0x334dc6[_0x69ff('0xf')](','):null);},'get':function(){return this[_0x69ff('0x10')](_0x69ff('0x1c'))?this['getDataValue']('nat')[_0x69ff('0x1d')](','):null;},'comment':_0x69ff('0x1e')},'callgroup':{'type':Sequelize[_0x69ff('0x7')]},'namedcallgroup':{'type':Sequelize[_0x69ff('0x7')]},'pickupgroup':{'type':Sequelize[_0x69ff('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x69ff('0x7')]},'language':{'type':Sequelize[_0x69ff('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x69ff('0x1f')},'allow':{'type':Sequelize[_0x69ff('0x7')],'allowNull':![],'defaultValue':_0x69ff('0x20'),'set':function(_0x5a646d){this[_0x69ff('0xe')]('allow',_0x5a646d?_0x5a646d[_0x69ff('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x69ff('0x21'))?this['getDataValue']('allow')[_0x69ff('0x1d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x69ff('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x69ff('0x7')],'defaultValue':_0x69ff('0x22'),'set':function(_0x1c1ecc){this[_0x69ff('0xe')]('insecure',_0x1c1ecc?_0x1c1ecc[_0x69ff('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x69ff('0x23'))?this[_0x69ff('0x10')]('insecure')[_0x69ff('0x1d')](','):null;},'comment':_0x69ff('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0x69ff('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x69ff('0x18'),'no',_0x69ff('0x25'))},'promiscredir':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'accountcode':{'type':Sequelize[_0x69ff('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x69ff('0x27')},'amaflags':{'type':Sequelize[_0x69ff('0x7')]},'callcounter':{'type':Sequelize[_0x69ff('0x3')]('yes','no'),'defaultValue':_0x69ff('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x69ff('0x7')]},'template':{'type':Sequelize[_0x69ff('0x7')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x69ff('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x69ff('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'mailbox':{'type':Sequelize[_0x69ff('0x7')]},'session_timers':{'type':Sequelize['ENUM'](_0x69ff('0x29'),_0x69ff('0x2a'),_0x69ff('0x2b'))},'session_expires':{'type':Sequelize[_0x69ff('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x69ff('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x2c'),_0x69ff('0x2d')),'defaultValue':_0x69ff('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x69ff('0x7')]},'regexten':{'type':Sequelize[_0x69ff('0x7')]},'fromdomain':{'type':Sequelize[_0x69ff('0x7')]},'fromuser':{'type':Sequelize[_0x69ff('0x7')]},'port':{'type':Sequelize[_0x69ff('0x26')](0x5)},'qualify':{'type':Sequelize[_0x69ff('0x3')]('yes','no'),'defaultValue':_0x69ff('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x69ff('0x7')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x69ff('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x69ff('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x69ff('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x69ff('0x3')]('yes','no',_0x69ff('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x69ff('0x7')]},'timert1':{'type':Sequelize[_0x69ff('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x69ff('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x69ff('0x7')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x69ff('0x7')]},'unsolicited_mailbox':{'type':Sequelize[_0x69ff('0x7')]},'use_q850_reason':{'type':Sequelize[_0x69ff('0x7')]},'maxforwards':{'type':Sequelize[_0x69ff('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x69ff('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x69ff('0x18'),'no')},'icesupport':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no',_0x69ff('0x2f'),_0x69ff('0x30'))},'dtlsrekey':{'type':Sequelize[_0x69ff('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x69ff('0x7')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x69ff('0x7')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x31'),'passive',_0x69ff('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x69ff('0x7')]},'usereqphone':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x69ff('0x7')]},'recordofffeature':{'type':Sequelize[_0x69ff('0x7')]},'call_limit':{'type':Sequelize[_0x69ff('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x69ff('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no')},'vmexten':{'type':Sequelize[_0x69ff('0x7')]},'mohinterpret':{'type':Sequelize[_0x69ff('0x7')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x69ff('0x7')]},'description':{'type':Sequelize[_0x69ff('0x7')]},'host':{'type':Sequelize[_0x69ff('0x7')],'defaultValue':_0x69ff('0x33')},'canreinvite':{'type':Sequelize[_0x69ff('0x3')](_0x69ff('0x18'),'no',_0x69ff('0x34'),_0x69ff('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x69ff('0x7')]},'otherFields':{'type':Sequelize[_0x69ff('0x7')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x69ff('0x7')],'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 e15f9c5..f0475b0 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 _0xf2ca=['omit','createdAt','body','updatedAt','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','get','Trunks','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','Trunk','find','clone'];(function(_0x4f8bfb,_0x2613d8){var _0x31be2a=function(_0x1d0151){while(--_0x1d0151){_0x4f8bfb['push'](_0x4f8bfb['shift']());}};_0x31be2a(++_0x2613d8);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x8bf471,_0x2e9da0){_0x8bf471=_0x8bf471-0x0;var _0x3d93d7=_0xf2ca[_0x8bf471];return _0x3d93d7;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];var jayson=require(_0xaf2c('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15ccb4,_0x8eaf9b,_0x935959,_0x18a8a5){return new BPromise(function(_0x293ca6,_0x152c73){var _0x214f47=_0x18a8a5||client;return _0x214f47[_0xaf2c('0x19')](_0x15ccb4,_0x935959)[_0xaf2c('0x1a')](function(_0x1d0633){logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,_0xaf2c('0x1d'));logger[_0xaf2c('0x1e')](_0xaf2c('0x1f'),_0x8eaf9b,'request\x20sent',JSON[_0xaf2c('0x20')](_0x1d0633));if(_0x1d0633['error']){if(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x22')]===0x1f4){logger[_0xaf2c('0x21')]('Trunk,\x20%s,\x20%s',_0x8eaf9b,_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);return _0x152c73(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}logger[_0xaf2c('0x21')](_0xaf2c('0x1c'),_0x8eaf9b,_0x1d0633['error'][_0xaf2c('0x23')]);return _0x293ca6(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}else{logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,'request\x20sent');_0x293ca6(_0x1d0633[_0xaf2c('0x24')][_0xaf2c('0x23')]);}})[_0xaf2c('0x25')](function(_0x4be6ed){logger['error'](_0xaf2c('0x1c'),_0x8eaf9b,_0x4be6ed);_0x152c73(_0x4be6ed);});});}function respondWithStatusCode(_0x303546,_0x1cafad){_0x1cafad=_0x1cafad||0xcc;return function(_0x99f78d){if(_0x99f78d){return _0x303546['sendStatus'](_0x1cafad);}return _0x303546[_0xaf2c('0x26')](_0x1cafad)[_0xaf2c('0x27')]();};}function respondWithResult(_0x3a0145,_0x3c1ae6){_0x3c1ae6=_0x3c1ae6||0xc8;return function(_0xe929b5){if(_0xe929b5){return _0x3a0145[_0xaf2c('0x26')](_0x3c1ae6)[_0xaf2c('0x28')](_0xe929b5);}};}function respondWithFilteredResult(_0x4a8dd8,_0x29f8b0){return function(_0x2051be){if(_0x2051be){var _0x36f37c=typeof _0x29f8b0[_0xaf2c('0x29')]==='undefined'&&typeof _0x29f8b0[_0xaf2c('0x2a')]==='undefined';var _0x38db1b=_0x2051be[_0xaf2c('0x2b')];var _0x15466b=_0x36f37c?0x0:_0x29f8b0['offset'];var _0x2747bb=_0x36f37c?_0x2051be[_0xaf2c('0x2b')]:_0x29f8b0[_0xaf2c('0x29')]+_0x29f8b0['limit'];var _0xe18ba7;if(_0x2747bb>=_0x38db1b){_0x2747bb=_0x38db1b;_0xe18ba7=0xc8;}else{_0xe18ba7=0xce;}_0x4a8dd8[_0xaf2c('0x26')](_0xe18ba7);return _0x4a8dd8[_0xaf2c('0x2c')](_0xaf2c('0x2d'),_0x15466b+'-'+_0x2747bb+'/'+_0x38db1b)['json'](_0x2051be);}return null;};}function patchUpdates(_0x3da072){return function(_0x4072ff){try{jsonpatch[_0xaf2c('0x2e')](_0x4072ff,_0x3da072,!![]);}catch(_0x51a49c){return BPromise['reject'](_0x51a49c);}return _0x4072ff[_0xaf2c('0x2f')]();};}function saveUpdates(_0x4c9b4f,_0x39c0ed){return function(_0x5e7247){if(_0x5e7247){return _0x5e7247[_0xaf2c('0x30')](_0x4c9b4f)[_0xaf2c('0x1a')](function(_0x4ffbb9){return _0x4ffbb9;});}return null;};}function removeEntity(_0x1408e3,_0x5403f8){return function(_0x54db57){if(_0x54db57){return _0x54db57[_0xaf2c('0x31')]()[_0xaf2c('0x1a')](function(){var _0x211a69=_0x54db57[_0xaf2c('0x32')]({'plain':!![]});var _0x2d6ed7=_0xaf2c('0x33');return db['UserProfileResource'][_0xaf2c('0x31')]({'where':{'type':_0x2d6ed7,'resourceId':_0x211a69['id']}})['then'](function(){return _0x54db57;});})[_0xaf2c('0x1a')](function(){_0x1408e3['status'](0xcc)[_0xaf2c('0x27')]();});}};}function handleEntityNotFound(_0x59f686,_0x2f3d16){return function(_0x4e877e){if(!_0x4e877e){_0x59f686[_0xaf2c('0x34')](0x194);}return _0x4e877e;};}function handleError(_0x4b9c6b,_0x30fd87){_0x30fd87=_0x30fd87||0x1f4;return function(_0x356402){logger[_0xaf2c('0x21')](_0x356402[_0xaf2c('0x35')]);if(_0x356402[_0xaf2c('0x36')]){delete _0x356402['name'];}_0x4b9c6b['status'](_0x30fd87)[_0xaf2c('0x37')](_0x356402);};}exports[_0xaf2c('0x38')]=function(_0x409700,_0xa44813){var _0x4eeecf={},_0x316238={},_0x573db3={'count':0x0,'rows':[]};var _0xa1248e=_[_0xaf2c('0x39')](db['Trunk'][_0xaf2c('0x3a')],function(_0x24668d){return{'name':_0x24668d[_0xaf2c('0x3b')],'type':_0x24668d[_0xaf2c('0x3c')][_0xaf2c('0x3d')]};});_0x316238[_0xaf2c('0x3e')]=_[_0xaf2c('0x39')](_0xa1248e,_0xaf2c('0x36'));_0x316238[_0xaf2c('0x3f')]=_[_0xaf2c('0x40')](_0x409700[_0xaf2c('0x3f')]);_0x316238[_0xaf2c('0x41')]=_[_0xaf2c('0x42')](_0x316238['model'],_0x316238['query']);_0x4eeecf['attributes']=_[_0xaf2c('0x42')](_0x316238[_0xaf2c('0x3e')],qs[_0xaf2c('0x43')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x4eeecf[_0xaf2c('0x44')]=_0x4eeecf['attributes'][_0xaf2c('0x45')]?_0x4eeecf[_0xaf2c('0x44')]:_0x316238[_0xaf2c('0x3e')];if(!_0x409700['query']['hasOwnProperty'](_0xaf2c('0x46'))){_0x4eeecf['limit']=qs[_0xaf2c('0x2a')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x2a')]);_0x4eeecf[_0xaf2c('0x29')]=qs['offset'](_0x409700[_0xaf2c('0x3f')]['offset']);}_0x4eeecf[_0xaf2c('0x47')]=qs[_0xaf2c('0x48')](_0x409700['query'][_0xaf2c('0x48')]);_0x4eeecf['where']=qs[_0xaf2c('0x41')](_[_0xaf2c('0x49')](_0x409700[_0xaf2c('0x3f')],_0x316238[_0xaf2c('0x41')]),_0xa1248e);if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]){_0x4eeecf[_0xaf2c('0x4b')]=_[_0xaf2c('0x4c')](_0x4eeecf[_0xaf2c('0x4b')],{'$or':_['map'](_0xa1248e,function(_0x51d751){if(_0x51d751[_0xaf2c('0x3c')]!=='VIRTUAL'){var _0x4ad36e={};_0x4ad36e[_0x51d751['name']]={'$like':'%'+_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]+'%'};return _0x4ad36e;}})});}_0x4eeecf=_[_0xaf2c('0x4c')]({},_0x4eeecf,_0x409700[_0xaf2c('0x4d')]);var _0x599b2d={'where':_0x4eeecf[_0xaf2c('0x4b')]};return db['Trunk'][_0xaf2c('0x2b')](_0x599b2d)['then'](function(_0x166c26){_0x573db3[_0xaf2c('0x2b')]=_0x166c26;if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x4eeecf[_0xaf2c('0x4f')]=[{'all':!![]}];}return db['Trunk'][_0xaf2c('0x50')](_0x4eeecf);})[_0xaf2c('0x1a')](function(_0x4b3ca4){_0x573db3['rows']=_0x4b3ca4;return _0x573db3;})[_0xaf2c('0x1a')](respondWithFilteredResult(_0xa44813,_0x4eeecf))['catch'](handleError(_0xa44813,null));};exports[_0xaf2c('0x51')]=function(_0x23642b,_0x17b9ec){var _0x315b9f={'raw':![],'where':{'id':_0x23642b[_0xaf2c('0x52')]['id']}},_0x367112={};_0x367112[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x367112[_0xaf2c('0x3f')]=_['keys'](_0x23642b[_0xaf2c('0x3f')]);_0x367112[_0xaf2c('0x41')]=_['intersection'](_0x367112['model'],_0x367112['query']);_0x315b9f[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x367112['model'],qs[_0xaf2c('0x43')](_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x315b9f[_0xaf2c('0x44')]=_0x315b9f[_0xaf2c('0x44')][_0xaf2c('0x45')]?_0x315b9f[_0xaf2c('0x44')]:_0x367112['model'];if(_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x315b9f['include']=[{'all':!![]}];}_0x315b9f=_[_0xaf2c('0x4c')]({},_0x315b9f,_0x23642b[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x315b9f)[_0xaf2c('0x1a')](handleEntityNotFound(_0x17b9ec,null))[_0xaf2c('0x1a')](respondWithResult(_0x17b9ec,null))[_0xaf2c('0x25')](handleError(_0x17b9ec,null));};exports[_0xaf2c('0x55')]=function(_0x19b82d,_0x300254){var _0x133678={'where':{'id':_0x19b82d[_0xaf2c('0x52')]['id']}},_0x10a270={};_0x10a270[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x133678[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x10a270[_0xaf2c('0x3e')],qs['fields'](_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x133678[_0xaf2c('0x44')]=_0x133678['attributes'][_0xaf2c('0x45')]?_0x133678['attributes']:_0x10a270[_0xaf2c('0x3e')];if(_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x133678[_0xaf2c('0x4f')]=[{'all':!![]}];}_0x133678=_[_0xaf2c('0x4c')]({},_0x133678,_0x19b82d[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x133678)[_0xaf2c('0x1a')](handleEntityNotFound(_0x300254,null))['then'](function(_0x41d08b){if(_0x41d08b){var _0x400dcd=_0x41d08b[_0xaf2c('0x32')]({'plain':!![]});_0x400dcd=qs[_0xaf2c('0x56')](_0x400dcd,['id',_0xaf2c('0x57'),'updatedAt']);_0x19b82d[_0xaf2c('0x58')]=_[_0xaf2c('0x56')](_0x19b82d['body'],['id',_0xaf2c('0x57'),_0xaf2c('0x59')]);return db['Trunk']['create'](_[_0xaf2c('0x4c')](_0x400dcd,_0x19b82d[_0xaf2c('0x58')]),{'include':_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x36b6f0){var _0x3f48f1=_0x19b82d['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3f48f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f48f1[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x16e9f4=_0x36b6f0[_0xaf2c('0x32')]({'plain':!![]});var _0x1a297e=_0xaf2c('0x33');return db[_0xaf2c('0x5c')][_0xaf2c('0x54')]({'where':{'name':_0x1a297e,'userProfileId':_0x3f48f1[_0xaf2c('0x5d')]},'raw':!![]})[_0xaf2c('0x1a')](function(_0x53ba41){if(_0x53ba41&&_0x53ba41[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')][_0xaf2c('0x60')]({'name':_0x16e9f4[_0xaf2c('0x36')],'resourceId':_0x16e9f4['id'],'type':_0x53ba41[_0xaf2c('0x36')],'sectionId':_0x53ba41['id']},{})['then'](function(){return _0x36b6f0;});}else{return _0x36b6f0;}})[_0xaf2c('0x25')](function(_0x28b09f){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x28b09f);throw _0x28b09f;});}return _0x36b6f0;});}})[_0xaf2c('0x1a')](respondWithResult(_0x300254,0xc9))['catch'](handleError(_0x300254,null));};exports['create']=function(_0x1166c9,_0x1ead61,_0x5849f8){var _0xf96361;return db[_0xaf2c('0x53')][_0xaf2c('0x60')](_0x1166c9['body'],{'raw':!![]})[_0xaf2c('0x1a')](function(_0x2bd845){_0xf96361=_0x2bd845;return db[_0xaf2c('0x53')][_0xaf2c('0x50')]({'raw':!![]});})['then'](function(_0x32d552){var _0x26129c=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2767c7=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x5d965c=ejs[_0xaf2c('0x67')](_0x26129c,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5d965c);if(_0xf96361[_0xaf2c('0x69')]){var _0x5a95ac=ejs['render'](_0x2767c7,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6a'),_0x5a95ac);}})[_0xaf2c('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xaf2c('0x1a')](function(){var _0x3e972c=_0x1166c9['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3e972c)throw new Error(_0xaf2c('0x6b'));if(_0x3e972c[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x6e1837=_0xf96361[_0xaf2c('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xaf2c('0x54')]({'where':{'name':_0xaf2c('0x33'),'userProfileId':_0x3e972c[_0xaf2c('0x5d')]},'raw':!![]})['then'](function(_0xc9dd21){if(_0xc9dd21&&_0xc9dd21[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')]['create']({'name':_0x6e1837[_0xaf2c('0x36')],'resourceId':_0x6e1837['id'],'type':_0xc9dd21[_0xaf2c('0x36')],'sectionId':_0xc9dd21['id']},{})[_0xaf2c('0x1a')](function(){return _0xf96361;});}else{return _0xf96361;}})[_0xaf2c('0x25')](function(_0x491160){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x491160);throw _0x491160;});}return _0xf96361;})[_0xaf2c('0x1a')](respondWithResult(_0x1ead61,0xc9))['catch'](handleError(_0x1ead61,null));};exports['update']=function(_0x427ece,_0x1b7dc1,_0x5571eb){var _0x3675d9;return db[_0xaf2c('0x53')]['find']({'where':{'id':_0x427ece[_0xaf2c('0x52')]['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1b7dc1,null))[_0xaf2c('0x1a')](saveUpdates(_0x427ece[_0xaf2c('0x58')],null))[_0xaf2c('0x1a')](function(_0x4af252){if(_0x4af252){_0x3675d9=_0x4af252;return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});}})[_0xaf2c('0x1a')](function(_0x55b568){if(_0x55b568){var _0x4f378e=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x4b9fdc=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x6c')),_0xaf2c('0x66'));var _0x41c707=ejs['render'](_0x4f378e,{'trunks':_0x55b568||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x41c707);var _0x483774=ejs['render'](_0x4b9fdc,{'trunks':_0x55b568||[]});fs['writeFileSync'](_0xaf2c('0x6a'),_0x483774);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x30'),{'module':_0xaf2c('0x6f')});}return null;})['then'](function(_0x19fbd5){if(_0x19fbd5){return _0x3675d9;}})[_0xaf2c('0x1a')](respondWithResult(_0x1b7dc1,null))[_0xaf2c('0x25')](handleError(_0x1b7dc1,null));};exports[_0xaf2c('0x31')]=function(_0x4ddf95,_0x1e8fc0,_0x23aeac){var _0x41590;return db[_0xaf2c('0x53')][_0xaf2c('0x54')]({'where':{'id':_0x4ddf95['params']['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1e8fc0,null))[_0xaf2c('0x1a')](removeEntity(_0x1e8fc0,null))['then'](function(){return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});})[_0xaf2c('0x1a')](function(_0x5bce65){var _0x1e6a12=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2a3cb4=fs[_0xaf2c('0x62')](path['join'](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x7724cc=ejs['render'](_0x1e6a12,{'trunks':_0x5bce65});var _0x4a9ea8=ejs[_0xaf2c('0x67')](_0x2a3cb4,{'trunks':_0x5bce65});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x7724cc);fs['writeFileSync'](_0xaf2c('0x6a'),_0x4a9ea8);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x1e8fc0,null));}; \ No newline at end of file +var _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0xe09b48,_0x14d774){var _0x16a14c=function(_0x260066){while(--_0x260066){_0xe09b48['push'](_0xe09b48['shift']());}};_0x16a14c(++_0x14d774);}(_0xa41a,0x6b));var _0xaa41=function(_0x2a11b0,_0x1c8289){_0x2a11b0=_0x2a11b0-0x0;var _0xe3099f=_0xa41a[_0x2a11b0];return _0xe3099f;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 01bb5a8..4aa6e85 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 _0x6d85=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','util','../../config/logger','api','bluebird'];(function(_0x8029f1,_0x3a5f33){var _0x15dcdb=function(_0x227b41){while(--_0x227b41){_0x8029f1['push'](_0x8029f1['shift']());}};_0x15dcdb(++_0x3a5f33);}(_0x6d85,0x74));var _0x56d8=function(_0x481d8f,_0x2b18ab){_0x481d8f=_0x481d8f-0x0;var _0x73f7ad=_0x6d85[_0x481d8f];return _0x73f7ad;};'use strict';var _=require('lodash');var util=require(_0x56d8('0x0'));var logger=require(_0x56d8('0x1'))(_0x56d8('0x2'));var moment=require('moment');var BPromise=require(_0x56d8('0x3'));var rp=require(_0x56d8('0x4'));var fs=require('fs');var path=require(_0x56d8('0x5'));var rimraf=require(_0x56d8('0x6'));var config=require(_0x56d8('0x7'));var attributes=require(_0x56d8('0x8'));module[_0x56d8('0x9')]=function(_0x224370,_0x1d63d7){return _0x224370[_0x56d8('0xa')](_0x56d8('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83ac=['define','Trunk','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x83ac,0xa7));var _0xc83a=function(_0x1eca22,_0x1e3683){_0x1eca22=_0x1eca22-0x0;var _0x1caa35=_0x83ac[_0x1eca22];return _0x1caa35;};'use strict';var _=require('lodash');var util=require(_0xc83a('0x0'));var logger=require(_0xc83a('0x1'))(_0xc83a('0x2'));var moment=require(_0xc83a('0x3'));var BPromise=require('bluebird');var rp=require(_0xc83a('0x4'));var fs=require('fs');var path=require(_0xc83a('0x5'));var rimraf=require(_0xc83a('0x6'));var config=require(_0xc83a('0x7'));var attributes=require('./trunk.attributes');module[_0xc83a('0x8')]=function(_0x50122e,_0x1d9b9c){return _0x50122e[_0xc83a('0x9')](_0xc83a('0xa'),attributes,{'tableName':'tools_trunks','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 98ddf4d..a14a4eb 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 _0x1cb8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowTrunk','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x6f5bdf,_0x37c899){var _0x5e7166=function(_0x878341){while(--_0x878341){_0x6f5bdf['push'](_0x6f5bdf['shift']());}};_0x5e7166(++_0x37c899);}(_0x1cb8,0xd8));var _0x81cb=function(_0x38c70e,_0x42200e){_0x38c70e=_0x38c70e-0x0;var _0x18c024=_0x1cb8[_0x38c70e];return _0x18c024;};'use strict';var _=require(_0x81cb('0x0'));var util=require('util');var moment=require(_0x81cb('0x1'));var BPromise=require('bluebird');var rs=require(_0x81cb('0x2'));var fs=require('fs');var Redis=require(_0x81cb('0x3'));var db=require(_0x81cb('0x4'))['db'];var utils=require(_0x81cb('0x5'));var logger=require(_0x81cb('0x6'))(_0x81cb('0x7'));var config=require(_0x81cb('0x8'));var jayson=require(_0x81cb('0x9'));var client=jayson[_0x81cb('0xa')][_0x81cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e15db,_0x38af81,_0x505676){return new BPromise(function(_0x2a55bc,_0x530711){return client['request'](_0x3e15db,_0x505676)['then'](function(_0x2b60b8){logger[_0x81cb('0xc')](_0x81cb('0xd'),_0x38af81,_0x81cb('0xe'));logger[_0x81cb('0xf')](_0x81cb('0x10'),_0x38af81,'request\x20sent',JSON[_0x81cb('0x11')](_0x2b60b8));if(_0x2b60b8['error']){if(_0x2b60b8[_0x81cb('0x12')][_0x81cb('0x13')]===0x1f4){logger[_0x81cb('0x12')](_0x81cb('0xd'),_0x38af81,_0x2b60b8[_0x81cb('0x12')]['message']);return _0x530711(_0x2b60b8['error']['message']);}logger[_0x81cb('0x12')]('Trunk,\x20%s,\x20%s',_0x38af81,_0x2b60b8[_0x81cb('0x12')][_0x81cb('0x14')]);return _0x2a55bc(_0x2b60b8['error'][_0x81cb('0x14')]);}else{logger['info'](_0x81cb('0xd'),_0x38af81,'request\x20sent');_0x2a55bc(_0x2b60b8[_0x81cb('0x15')][_0x81cb('0x14')]);}})[_0x81cb('0x16')](function(_0x2c940a){logger[_0x81cb('0x12')](_0x81cb('0xd'),_0x38af81,_0x2c940a);_0x530711(_0x2c940a);});});}exports[_0x81cb('0x17')]=function(_0x361fcb){var _0x4f1739=this;return new Promise(function(_0x3ac3fa,_0x220986){return db[_0x81cb('0x18')][_0x81cb('0x19')]({'raw':_0x361fcb['options']?_0x361fcb[_0x81cb('0x1a')][_0x81cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x361fcb[_0x81cb('0x1a')]?_0x361fcb[_0x81cb('0x1a')][_0x81cb('0x1c')]||null:null,'attributes':_0x361fcb['options']?_0x361fcb['options'][_0x81cb('0x1d')]||null:null,'limit':_0x361fcb[_0x81cb('0x1a')]?_0x361fcb[_0x81cb('0x1a')][_0x81cb('0x1e')]||null:null,'include':_0x361fcb[_0x81cb('0x1a')]?_0x361fcb[_0x81cb('0x1a')]['include']?_[_0x81cb('0x1f')](_0x361fcb[_0x81cb('0x1a')][_0x81cb('0x20')],function(_0x254d57){return{'model':db[_0x254d57[_0x81cb('0x21')]],'as':_0x254d57['as'],'attributes':_0x254d57['attributes'],'include':_0x254d57[_0x81cb('0x20')]?_['map'](_0x254d57[_0x81cb('0x20')],function(_0x173170){return{'model':db[_0x173170[_0x81cb('0x21')]],'as':_0x173170['as'],'attributes':_0x173170['attributes'],'include':_0x173170[_0x81cb('0x20')]?_['map'](_0x173170[_0x81cb('0x20')],function(_0x272e32){return{'model':db[_0x272e32['model']],'as':_0x272e32['as'],'attributes':_0x272e32['attributes']};}):[]};}):[]};}):[]:[]})[_0x81cb('0x22')](function(_0x2df306){logger[_0x81cb('0xc')](_0x81cb('0x17'),_0x361fcb);logger[_0x81cb('0xf')](_0x81cb('0x17'),_0x361fcb,JSON[_0x81cb('0x11')](_0x2df306));_0x3ac3fa(_0x2df306);})['catch'](function(_0x3c24bb){logger[_0x81cb('0x12')](_0x81cb('0x17'),_0x3c24bb[_0x81cb('0x14')],_0x361fcb);_0x220986(_0x4f1739['error'](0x1f4,_0x3c24bb['message']));});});};exports[_0x81cb('0x23')]=function(_0x32e6b5){var _0x394de7=this;return new Promise(function(_0x4727d5,_0x4b4dfa){return db['Trunk'][_0x81cb('0x24')]({'raw':_0x32e6b5['options']?_0x32e6b5[_0x81cb('0x1a')][_0x81cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x32e6b5[_0x81cb('0x1a')]?_0x32e6b5[_0x81cb('0x1a')]['where']||null:null,'attributes':_0x32e6b5[_0x81cb('0x1a')]?_0x32e6b5['options'][_0x81cb('0x1d')]||null:null,'include':_0x32e6b5[_0x81cb('0x1a')]?_0x32e6b5[_0x81cb('0x1a')][_0x81cb('0x20')]?_['map'](_0x32e6b5[_0x81cb('0x1a')][_0x81cb('0x20')],function(_0x4c8fb7){return{'model':db[_0x4c8fb7[_0x81cb('0x21')]],'as':_0x4c8fb7['as'],'attributes':_0x4c8fb7['attributes'],'include':_0x4c8fb7[_0x81cb('0x20')]?_[_0x81cb('0x1f')](_0x4c8fb7[_0x81cb('0x20')],function(_0x5b761a){return{'model':db[_0x5b761a[_0x81cb('0x21')]],'as':_0x5b761a['as'],'attributes':_0x5b761a['attributes'],'include':_0x5b761a['include']?_[_0x81cb('0x1f')](_0x5b761a[_0x81cb('0x20')],function(_0x50cb99){return{'model':db[_0x50cb99[_0x81cb('0x21')]],'as':_0x50cb99['as'],'attributes':_0x50cb99[_0x81cb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x409e23){logger[_0x81cb('0xc')]('ShowTrunk',_0x32e6b5);logger[_0x81cb('0xf')]('ShowTrunk',_0x32e6b5,JSON[_0x81cb('0x11')](_0x409e23));_0x4727d5(_0x409e23);})[_0x81cb('0x16')](function(_0x163f78){logger[_0x81cb('0x12')](_0x81cb('0x23'),_0x163f78['message'],_0x32e6b5);_0x4b4dfa(_0x394de7[_0x81cb('0x12')](0x1f4,_0x163f78[_0x81cb('0x14')]));});});}; \ No newline at end of file +var _0x72e5=['Trunk','findAll','options','where','attributes','include','map','model','find','raw','ShowTrunk','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk'];(function(_0x1eac9b,_0x24bf2f){var _0x33dfd6=function(_0x5ba3bc){while(--_0x5ba3bc){_0x1eac9b['push'](_0x1eac9b['shift']());}};_0x33dfd6(++_0x24bf2f);}(_0x72e5,0xba));var _0x572e=function(_0x5ae12f,_0xacd56f){_0x5ae12f=_0x5ae12f-0x0;var _0x56a4f9=_0x72e5[_0x5ae12f];return _0x56a4f9;};'use strict';var _=require('lodash');var util=require(_0x572e('0x0'));var moment=require(_0x572e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x572e('0x2'));var db=require(_0x572e('0x3'))['db'];var utils=require(_0x572e('0x4'));var logger=require(_0x572e('0x5'))(_0x572e('0x6'));var config=require(_0x572e('0x7'));var jayson=require(_0x572e('0x8'));var client=jayson['client'][_0x572e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x155634,_0x26891f,_0x26a520){return new BPromise(function(_0x19a58a,_0x4c0ff7){return client[_0x572e('0xa')](_0x155634,_0x26a520)[_0x572e('0xb')](function(_0x47594e){logger[_0x572e('0xc')]('Trunk,\x20%s,\x20%s',_0x26891f,'request\x20sent');logger[_0x572e('0xd')](_0x572e('0xe'),_0x26891f,_0x572e('0xf'),JSON[_0x572e('0x10')](_0x47594e));if(_0x47594e[_0x572e('0x11')]){if(_0x47594e[_0x572e('0x11')][_0x572e('0x12')]===0x1f4){logger[_0x572e('0x11')](_0x572e('0x13'),_0x26891f,_0x47594e[_0x572e('0x11')][_0x572e('0x14')]);return _0x4c0ff7(_0x47594e[_0x572e('0x11')]['message']);}logger['error'](_0x572e('0x13'),_0x26891f,_0x47594e['error'][_0x572e('0x14')]);return _0x19a58a(_0x47594e[_0x572e('0x11')]['message']);}else{logger[_0x572e('0xc')](_0x572e('0x13'),_0x26891f,'request\x20sent');_0x19a58a(_0x47594e[_0x572e('0x15')][_0x572e('0x14')]);}})[_0x572e('0x16')](function(_0x145b2d){logger['error']('Trunk,\x20%s,\x20%s',_0x26891f,_0x145b2d);_0x4c0ff7(_0x145b2d);});});}exports[_0x572e('0x17')]=function(_0x2842a5){var _0x3f0c3f=this;return new Promise(function(_0x30519f,_0x123e62){return db[_0x572e('0x18')][_0x572e('0x19')]({'raw':_0x2842a5[_0x572e('0x1a')]?_0x2842a5[_0x572e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2842a5[_0x572e('0x1a')]?_0x2842a5[_0x572e('0x1a')][_0x572e('0x1b')]||null:null,'attributes':_0x2842a5[_0x572e('0x1a')]?_0x2842a5['options'][_0x572e('0x1c')]||null:null,'limit':_0x2842a5[_0x572e('0x1a')]?_0x2842a5[_0x572e('0x1a')]['limit']||null:null,'include':_0x2842a5[_0x572e('0x1a')]?_0x2842a5['options'][_0x572e('0x1d')]?_[_0x572e('0x1e')](_0x2842a5[_0x572e('0x1a')]['include'],function(_0x46e2b1){return{'model':db[_0x46e2b1[_0x572e('0x1f')]],'as':_0x46e2b1['as'],'attributes':_0x46e2b1['attributes'],'include':_0x46e2b1['include']?_[_0x572e('0x1e')](_0x46e2b1[_0x572e('0x1d')],function(_0x267173){return{'model':db[_0x267173[_0x572e('0x1f')]],'as':_0x267173['as'],'attributes':_0x267173[_0x572e('0x1c')],'include':_0x267173[_0x572e('0x1d')]?_[_0x572e('0x1e')](_0x267173['include'],function(_0x522f42){return{'model':db[_0x522f42['model']],'as':_0x522f42['as'],'attributes':_0x522f42[_0x572e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c505d){logger[_0x572e('0xc')]('GetTrunk',_0x2842a5);logger['debug'](_0x572e('0x17'),_0x2842a5,JSON['stringify'](_0x1c505d));_0x30519f(_0x1c505d);})['catch'](function(_0x5f26d0){logger[_0x572e('0x11')](_0x572e('0x17'),_0x5f26d0[_0x572e('0x14')],_0x2842a5);_0x123e62(_0x3f0c3f['error'](0x1f4,_0x5f26d0[_0x572e('0x14')]));});});};exports['ShowTrunk']=function(_0x308310){var _0x24cb75=this;return new Promise(function(_0x2f1f99,_0x2f56b0){return db[_0x572e('0x18')][_0x572e('0x20')]({'raw':_0x308310[_0x572e('0x1a')]?_0x308310[_0x572e('0x1a')][_0x572e('0x21')]===undefined?!![]:![]:!![],'where':_0x308310[_0x572e('0x1a')]?_0x308310['options']['where']||null:null,'attributes':_0x308310[_0x572e('0x1a')]?_0x308310[_0x572e('0x1a')][_0x572e('0x1c')]||null:null,'include':_0x308310[_0x572e('0x1a')]?_0x308310[_0x572e('0x1a')]['include']?_[_0x572e('0x1e')](_0x308310[_0x572e('0x1a')][_0x572e('0x1d')],function(_0xc63f8e){return{'model':db[_0xc63f8e[_0x572e('0x1f')]],'as':_0xc63f8e['as'],'attributes':_0xc63f8e[_0x572e('0x1c')],'include':_0xc63f8e[_0x572e('0x1d')]?_[_0x572e('0x1e')](_0xc63f8e[_0x572e('0x1d')],function(_0x5d9540){return{'model':db[_0x5d9540['model']],'as':_0x5d9540['as'],'attributes':_0x5d9540[_0x572e('0x1c')],'include':_0x5d9540['include']?_[_0x572e('0x1e')](_0x5d9540[_0x572e('0x1d')],function(_0x238f1c){return{'model':db[_0x238f1c[_0x572e('0x1f')]],'as':_0x238f1c['as'],'attributes':_0x238f1c[_0x572e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x572e('0xb')](function(_0x4d831c){logger[_0x572e('0xc')](_0x572e('0x22'),_0x308310);logger[_0x572e('0xd')]('ShowTrunk',_0x308310,JSON[_0x572e('0x10')](_0x4d831c));_0x2f1f99(_0x4d831c);})['catch'](function(_0x543bfd){logger[_0x572e('0x11')](_0x572e('0x22'),_0x543bfd[_0x572e('0x14')],_0x308310);_0x2f56b0(_0x24cb75[_0x572e('0x11')](0x1f4,_0x543bfd[_0x572e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index e30b065..b9c5bf7 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 _0x1510=['/:id','update','express','Router','../../components/auth/service','./user-setting.controller'];(function(_0x3da41d,_0x55b75b){var _0x2ad88d=function(_0x1e7d52){while(--_0x1e7d52){_0x3da41d['push'](_0x3da41d['shift']());}};_0x2ad88d(++_0x55b75b);}(_0x1510,0x13a));var _0x0151=function(_0x58da8d,_0x9dfa17){_0x58da8d=_0x58da8d-0x0;var _0x1b1682=_0x1510[_0x58da8d];return _0x1b1682;};'use strict';var express=require(_0x0151('0x0'));var router=express[_0x0151('0x1')]();var auth=require(_0x0151('0x2'));var controller=require(_0x0151('0x3'));router['put'](_0x0151('0x4'),auth['isAuthenticated'](),controller[_0x0151('0x5')]);module['exports']=router; \ No newline at end of file +var _0x699c=['update','exports','express','Router','./user-setting.controller','/:id'];(function(_0x2dad87,_0x2a97da){var _0x8e1a3c=function(_0x25bea3){while(--_0x25bea3){_0x2dad87['push'](_0x2dad87['shift']());}};_0x8e1a3c(++_0x2a97da);}(_0x699c,0xfe));var _0xc699=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x699c[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0xc699('0x0'));var router=express[_0xc699('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc699('0x2'));router['put'](_0xc699('0x3'),auth['isAuthenticated'](),controller[_0xc699('0x4')]);module[_0xc699('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 21b2e50..cec44aa 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 _0x5188=['DATE','INTEGER','sequelize','error','debug','exports','ENUM','BOOLEAN','TEXT'];(function(_0x124a5f,_0x2554ef){var _0x27c18d=function(_0x4ed1bb){while(--_0x4ed1bb){_0x124a5f['push'](_0x124a5f['shift']());}};_0x27c18d(++_0x2554ef);}(_0x5188,0x1a9));var _0x8518=function(_0x4c917f,_0x99781a){_0x4c917f=_0x4c917f-0x0;var _0x4611e0=_0x5188[_0x4c917f];return _0x4611e0;};'use strict';var Sequelize=require(_0x8518('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x8518('0x1'),'warning','info',_0x8518('0x2')];module[_0x8518('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8518('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8518('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8518('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8518('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8518('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8518('0x8')],'unique':'UserId'}}; \ No newline at end of file +var _0x5467=['INTEGER','UserId','sequelize','error','warning','info','debug','exports','BOOLEAN','TEXT','DATE'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5467,0x1d0));var _0x7546=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x5467[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require(_0x7546('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x7546('0x1'),_0x7546('0x2'),_0x7546('0x3'),_0x7546('0x4')];module[_0x7546('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7546('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x7546('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7546('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x7546('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7546('0x9')],'unique':_0x7546('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 17cdb27..06078d8 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 _0x6d0b=['name','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','params','body','lodash','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','update','then'];(function(_0x38f2ca,_0x279eb7){var _0x4673be=function(_0x5c226e){while(--_0x5c226e){_0x38f2ca['push'](_0x38f2ca['shift']());}};_0x4673be(++_0x279eb7);}(_0x6d0b,0x71));var _0xb6d0=function(_0x2e718b,_0x52c61c){_0x2e718b=_0x2e718b-0x0;var _0x2eb186=_0x6d0b[_0x2e718b];return _0x2eb186;};'use strict';var _=require(_0xb6d0('0x0'));var Redis=require('ioredis');var logger=require(_0xb6d0('0x1'))('api');var config=require(_0xb6d0('0x2'));var db=require(_0xb6d0('0x3'))['db'];var socket=require(_0xb6d0('0x4'))(new Redis(config[_0xb6d0('0x5')]));require(_0xb6d0('0x6'))[_0xb6d0('0x7')](socket);config[_0xb6d0('0x5')]=_['defaults'](config[_0xb6d0('0x5')],{'host':_0xb6d0('0x8'),'port':0x18eb});function respondWithResult(_0x23217f,_0x341756){_0x341756=_0x341756||0xc8;return function(_0x440414){if(_0x440414){return _0x23217f[_0xb6d0('0x9')](_0x341756)[_0xb6d0('0xa')](_0x440414);}};}function saveUpdates(_0x354e56){return function(_0x1497e5){if(_0x1497e5){return _0x1497e5[_0xb6d0('0xb')](_0x354e56)[_0xb6d0('0xc')](function(_0x3dff2f){return _0x3dff2f;});}return null;};}function handleEntityNotFound(_0x5d3d75){return function(_0x458941){if(!_0x458941){_0x5d3d75['sendStatus'](0x194);}return _0x458941;};}function handleError(_0x237283,_0x1254cb){_0x1254cb=_0x1254cb||0x1f4;return function(_0x542641){logger['error'](_0x542641['stack']);if(_0x542641[_0xb6d0('0xd')]){delete _0x542641['name'];}_0x237283['status'](_0x1254cb)['send'](_0x542641);};}exports['update']=function(_0x213af0,_0x410af2){if(_0x213af0[_0xb6d0('0xe')][_0xb6d0('0xf')]!==_0xb6d0('0x10'))throw new Error('Unauthorized');if(isNaN(Number(_0x213af0['params']['id'])))throw new Error(_0xb6d0('0x11'));return db[_0xb6d0('0x12')]['find']({'where':{'id':_0x213af0[_0xb6d0('0x13')]['id']}})[_0xb6d0('0xc')](handleEntityNotFound(_0x410af2,null))[_0xb6d0('0xc')](saveUpdates(_0x213af0[_0xb6d0('0x14')],null))[_0xb6d0('0xc')](respondWithResult(_0x410af2,null))['catch'](handleError(_0x410af2,null));}; \ No newline at end of file +var _0x8135=['localhost','status','json','update','then','sendStatus','stack','name','send','user','admin','Unauthorized','params','UserSetting','find','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register'];(function(_0x59a7c6,_0x139b91){var _0x429512=function(_0x368eb0){while(--_0x368eb0){_0x59a7c6['push'](_0x59a7c6['shift']());}};_0x429512(++_0x139b91);}(_0x8135,0x99));var _0x5813=function(_0x8100ce,_0x534c8d){_0x8100ce=_0x8100ce-0x0;var _0x41ee77=_0x8135[_0x8100ce];return _0x41ee77;};'use strict';var _=require('lodash');var Redis=require(_0x5813('0x0'));var logger=require(_0x5813('0x1'))(_0x5813('0x2'));var config=require(_0x5813('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x5813('0x4'))(new Redis(config[_0x5813('0x5')]));require(_0x5813('0x6'))[_0x5813('0x7')](socket);config[_0x5813('0x5')]=_['defaults'](config['redis'],{'host':_0x5813('0x8'),'port':0x18eb});function respondWithResult(_0x2cdde9,_0x3295a7){_0x3295a7=_0x3295a7||0xc8;return function(_0x6b4b42){if(_0x6b4b42){return _0x2cdde9[_0x5813('0x9')](_0x3295a7)[_0x5813('0xa')](_0x6b4b42);}};}function saveUpdates(_0xcb7307){return function(_0x18fd38){if(_0x18fd38){return _0x18fd38[_0x5813('0xb')](_0xcb7307)[_0x5813('0xc')](function(_0x3adb65){return _0x3adb65;});}return null;};}function handleEntityNotFound(_0xe2af95){return function(_0x1aaea8){if(!_0x1aaea8){_0xe2af95[_0x5813('0xd')](0x194);}return _0x1aaea8;};}function handleError(_0x3012b5,_0xf64cca){_0xf64cca=_0xf64cca||0x1f4;return function(_0x1b6f19){logger['error'](_0x1b6f19[_0x5813('0xe')]);if(_0x1b6f19[_0x5813('0xf')]){delete _0x1b6f19[_0x5813('0xf')];}_0x3012b5['status'](_0xf64cca)[_0x5813('0x10')](_0x1b6f19);};}exports[_0x5813('0xb')]=function(_0x495c3f,_0x183445){if(_0x495c3f[_0x5813('0x11')]['role']!==_0x5813('0x12'))throw new Error(_0x5813('0x13'));if(isNaN(Number(_0x495c3f[_0x5813('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x5813('0x15')][_0x5813('0x16')]({'where':{'id':_0x495c3f['params']['id']}})[_0x5813('0xc')](handleEntityNotFound(_0x183445,null))['then'](saveUpdates(_0x495c3f['body'],null))['then'](respondWithResult(_0x183445,null))['catch'](handleError(_0x183445,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 aee105f..541ed9d 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 _0x9683=['exports','../../mysqldb','UserSetting','setMaxListeners','remove','emit','hook'];(function(_0x541043,_0x23275e){var _0x22e846=function(_0x261e98){while(--_0x261e98){_0x541043['push'](_0x541043['shift']());}};_0x22e846(++_0x23275e);}(_0x9683,0x8d));var _0x3968=function(_0x4ab7b9,_0xb04192){_0x4ab7b9=_0x4ab7b9-0x0;var _0x3a7483=_0x9683[_0x4ab7b9];return _0x3a7483;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x3968('0x0'))['db'][_0x3968('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x3968('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3968('0x3')};function emitEvent(_0x1e70ea){return function(_0x593652,_0x47d324,_0x45049e){UserSettingEvents[_0x3968('0x4')](_0x1e70ea+':'+_0x593652['id'],_0x593652);UserSettingEvents[_0x3968('0x4')](_0x1e70ea,_0x593652);_0x45049e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x3968('0x5')](e,emitEvent(event));}}module[_0x3968('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xb86d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x3ef3c8,_0x30a989){var _0x480a9f=function(_0x436137){while(--_0x436137){_0x3ef3c8['push'](_0x3ef3c8['shift']());}};_0x480a9f(++_0x30a989);}(_0xb86d,0x9e));var _0xdb86=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb86d[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0xdb86('0x0'));var UserSetting=require(_0xdb86('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xdb86('0x2')](0x0);var events={'afterCreate':_0xdb86('0x3'),'afterUpdate':_0xdb86('0x4'),'afterDestroy':_0xdb86('0x5')};function emitEvent(_0xa1962e){return function(_0x38aa01,_0x4c7bae,_0x17d651){UserSettingEvents[_0xdb86('0x6')](_0xa1962e+':'+_0x38aa01['id'],_0x38aa01);UserSettingEvents[_0xdb86('0x6')](_0xa1962e,_0x38aa01);_0x17d651(null);};}for(var e in events){if(events[_0xdb86('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index a70a07e..282d635 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 _0xe706=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0xa6f938,_0x445a6e){var _0x439b90=function(_0x330ff0){while(--_0x330ff0){_0xa6f938['push'](_0xa6f938['shift']());}};_0x439b90(++_0x445a6e);}(_0xe706,0xa3));var _0x6e70=function(_0x4728e4,_0x55f332){_0x4728e4=_0x4728e4-0x0;var _0x44ee3c=_0xe706[_0x4728e4];return _0x44ee3c;};'use strict';var attributes=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951){return _0x311951['define'](_0x6e70('0x2'),attributes,{'tableName':_0x6e70('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ca810){if(!_0x2ca810[_0x6e70('0x4')])_0x2ca810[_0x6e70('0x5')]=null;else if(_0x2ca810[_0x6e70('0x5')]===null)_0x2ca810[_0x6e70('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xf2a6=['clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting','clientSideLoggingEnabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x5b6e6b,_0x126363){_0x5b6e6b=_0x5b6e6b-0x0;var _0x263478=_0xf2a6[_0x5b6e6b];return _0x263478;};'use strict';var attributes=require(_0x6f2a('0x0'));module['exports']=function(_0x4e1d7e){return _0x4e1d7e['define'](_0x6f2a('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b14e2){if(!_0x3b14e2[_0x6f2a('0x2')])_0x3b14e2[_0x6f2a('0x3')]=null;else if(_0x3b14e2[_0x6f2a('0x3')]===null)_0x3b14e2[_0x6f2a('0x3')]=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 ccdfe09..5f4dbb4 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 _0x7bd5=['UserId','register','length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update'];(function(_0x49bf95,_0x239f0e){var _0x1f08fe=function(_0xde4f23){while(--_0xde4f23){_0x49bf95['push'](_0x49bf95['shift']());}};_0x1f08fe(++_0x239f0e);}(_0x7bd5,0x1e1));var _0x57bd=function(_0x1cc52b,_0x39b1c8){_0x1cc52b=_0x1cc52b-0x0;var _0x5aaa5a=_0x7bd5[_0x1cc52b];return _0x5aaa5a;};'use strict';var UserSettingEvents=require(_0x57bd('0x0'));var events=['save',_0x57bd('0x1'),_0x57bd('0x2')];function createListener(_0x403503,_0x27aac3){return function(_0x5ef162){_0x27aac3[_0x57bd('0x3')](_0x403503,_0x5ef162);if(_0x403503===_0x57bd('0x4')){_0x27aac3['emit']('user-setting:update:user-'+_0x5ef162[_0x57bd('0x5')],_0x5ef162);}};}exports[_0x57bd('0x6')]=function(_0xd63e7b){for(var _0xd9f72c=0x0,_0x2860af=events[_0x57bd('0x7')];_0xd9f72c<_0x2860af;_0xd9f72c++){var _0x567ba9=events[_0xd9f72c];var _0x846ed4=createListener(_0x57bd('0x8')+_0x567ba9,_0xd63e7b);UserSettingEvents['on'](_0x567ba9,_0x846ed4);}}; \ No newline at end of file +var _0x51a3=['remove','update','emit','user-setting:update','user-setting:update:user-','register','user-setting:','./user-setting.events','save'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x51a3,0x1d2));var _0x351a=function(_0x37d7fd,_0x3b2afd){_0x37d7fd=_0x37d7fd-0x0;var _0x2e644a=_0x51a3[_0x37d7fd];return _0x2e644a;};'use strict';var UserSettingEvents=require(_0x351a('0x0'));var events=[_0x351a('0x1'),_0x351a('0x2'),_0x351a('0x3')];function createListener(_0x3dad1c,_0x393029){return function(_0x19a0af){_0x393029[_0x351a('0x4')](_0x3dad1c,_0x19a0af);if(_0x3dad1c===_0x351a('0x5')){_0x393029[_0x351a('0x4')](_0x351a('0x6')+_0x19a0af['UserId'],_0x19a0af);}};}exports[_0x351a('0x7')]=function(_0x298363){for(var _0x5602ab=0x0,_0x5b707b=events['length'];_0x5602ab<_0x5b707b;_0x5602ab++){var _0x48ef2b=events[_0x5602ab];var _0x4e1d85=createListener(_0x351a('0x8')+_0x48ef2b,_0x298363);UserSettingEvents['on'](_0x48ef2b,_0x4e1d85);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5b67f48..84fa00c 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 _0x15fc=['addTeams','/:id/chat_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','update','put','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','whoami','getPresence','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','/:id/unpause'];(function(_0x24b477,_0x30393b){var _0x4041a6=function(_0x2d64de){while(--_0x2d64de){_0x24b477['push'](_0x24b477['shift']());}};_0x4041a6(++_0x30393b);}(_0x15fc,0x8f));var _0xc15f=function(_0x476a6f,_0x5c14de){_0x476a6f=_0x476a6f-0x0;var _0x521553=_0x15fc[_0x476a6f];return _0x521553;};'use strict';var multer=require('multer');var util=require(_0xc15f('0x0'));var path=require(_0xc15f('0x1'));var timeout=require(_0xc15f('0x2'));var express=require(_0xc15f('0x3'));var router=express[_0xc15f('0x4')]();var fs_extra=require(_0xc15f('0x5'));var auth=require(_0xc15f('0x6'));var interaction=require(_0xc15f('0x7'));var config=require(_0xc15f('0x8'));var controller=require(_0xc15f('0x9'));router['get']('/',auth[_0xc15f('0xa')](),controller[_0xc15f('0xb')]);router[_0xc15f('0xc')](_0xc15f('0xd'),auth['isAuthenticated'](),controller[_0xc15f('0xe')]);router[_0xc15f('0xc')]('/whoami',auth[_0xc15f('0xa')](),controller[_0xc15f('0xf')]);router['get']('/presence',auth[_0xc15f('0xa')](),controller[_0xc15f('0x10')]);router['get'](_0xc15f('0x11'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x12')]);router[_0xc15f('0xc')]('/:id/avatar',controller['getAvatar']);router[_0xc15f('0xc')](_0xc15f('0x13'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x14')]);router[_0xc15f('0xc')](_0xc15f('0x15'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x16')]);router[_0xc15f('0xc')]('/:id/queues',auth[_0xc15f('0xa')](),controller['getQueues']);router[_0xc15f('0xc')](_0xc15f('0x17'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x18')]);router[_0xc15f('0xc')](_0xc15f('0x19'),auth['isAuthenticated'](),controller[_0xc15f('0x1a')]);router['get'](_0xc15f('0x1b'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x1c')]);router[_0xc15f('0xc')]('/:id/screen_recordings',auth[_0xc15f('0xa')](),controller[_0xc15f('0x1d')]);router[_0xc15f('0xc')](_0xc15f('0x1e'),auth[_0xc15f('0xa')](),controller['getChatInteractions']);router[_0xc15f('0xc')](_0xc15f('0x1f'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x20')]);router[_0xc15f('0xc')](_0xc15f('0x21'),auth[_0xc15f('0xa')](),controller['getMailInteractions']);router[_0xc15f('0xc')](_0xc15f('0x22'),auth[_0xc15f('0xa')](),controller['getSmsInteractions']);router[_0xc15f('0xc')](_0xc15f('0x23'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x24')]);router[_0xc15f('0xc')](_0xc15f('0x25'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x26')]);router[_0xc15f('0xc')](_0xc15f('0x27'),auth[_0xc15f('0xa')](),controller['getTeams']);router[_0xc15f('0xc')]('/:id/lists',auth[_0xc15f('0xa')](),controller['getLists']);router[_0xc15f('0xc')](_0xc15f('0x28'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x29')]);router[_0xc15f('0xc')](_0xc15f('0x2a'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x2b')]);router[_0xc15f('0xc')](_0xc15f('0x2c'),auth[_0xc15f('0xa')](),controller['getFaxAccounts']);router[_0xc15f('0xc')](_0xc15f('0x2d'),auth[_0xc15f('0xa')](),controller['getMailAccounts']);router[_0xc15f('0xc')](_0xc15f('0x2e'),auth[_0xc15f('0xa')](),controller['getOpenchannelAccounts']);router[_0xc15f('0xc')]('/:id/sms_accounts',auth[_0xc15f('0xa')](),controller[_0xc15f('0x2f')]);router[_0xc15f('0xc')](_0xc15f('0x30'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x31')]);router[_0xc15f('0xc')](_0xc15f('0x32'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x33')]);router[_0xc15f('0xc')](_0xc15f('0x34'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x35')]);router[_0xc15f('0xc')](_0xc15f('0x36'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x37')]);router[_0xc15f('0x38')](_0xc15f('0x15'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x39')]);router[_0xc15f('0x38')]('/',auth[_0xc15f('0xa')](),controller['create']);router[_0xc15f('0x38')](_0xc15f('0x3a'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x3b')]);router[_0xc15f('0x38')](_0xc15f('0x3c'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x3d')]);var upload=multer({'storage':multer[_0xc15f('0x3e')]({'destination':function(_0x564678,_0x491b0,_0x174dba){_0x174dba(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x2b0e7e,_0x48716d,_0x5620f7){_0x5620f7(null,util[_0xc15f('0x3f')](_0xc15f('0x40'),Date[_0xc15f('0x41')](),_0x48716d[_0xc15f('0x42')]));}})});router['post'](_0xc15f('0x43'),upload['single'](_0xc15f('0x44')),controller[_0xc15f('0x45')]);router[_0xc15f('0x38')](_0xc15f('0x46'),auth['isAuthenticated'](),controller[_0xc15f('0x47')]);router[_0xc15f('0x38')](_0xc15f('0x48'),auth[_0xc15f('0xa')](),controller['logout']);router[_0xc15f('0x38')](_0xc15f('0x49'),auth['isAuthenticated'](),controller['pause']);router[_0xc15f('0x38')](_0xc15f('0x4a'),auth[_0xc15f('0xa')](),controller['unpause']);router[_0xc15f('0x38')](_0xc15f('0x27'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x4b')]);router[_0xc15f('0x38')](_0xc15f('0x4c'),auth[_0xc15f('0xa')](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth[_0xc15f('0xa')](),controller['addMailInteractions']);router['post'](_0xc15f('0x4d'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x4e')]);router['post'](_0xc15f('0x4f'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x50')]);router[_0xc15f('0x38')](_0xc15f('0x51'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x52')]);router[_0xc15f('0x38')](_0xc15f('0x53'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x54')]);router[_0xc15f('0x38')](_0xc15f('0x2c'),auth['isAuthenticated'](),controller[_0xc15f('0x55')]);router[_0xc15f('0x38')]('/:id/mail_accounts',auth[_0xc15f('0xa')](),controller['addMailAccounts']);router[_0xc15f('0x38')](_0xc15f('0x2e'),auth['isAuthenticated'](),controller[_0xc15f('0x56')]);router[_0xc15f('0x38')](_0xc15f('0x57'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x58')]);router[_0xc15f('0x38')]('/:id/chat_websites',auth[_0xc15f('0xa')](),controller[_0xc15f('0x59')]);router['post'](_0xc15f('0x32'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x5a')]);router[_0xc15f('0x38')](_0xc15f('0x36'),auth[_0xc15f('0xa')](),controller['createApiKey']);router['put'](_0xc15f('0x11'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x5b')]);router[_0xc15f('0x5c')](_0xc15f('0x5d'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x5e')]);router[_0xc15f('0x5f')](_0xc15f('0x3c'),auth['isAuthenticated'](),controller[_0xc15f('0x60')]);router['delete']('/:id/teams',auth[_0xc15f('0xa')](),controller['removeTeams']);router[_0xc15f('0x5f')](_0xc15f('0x11'),auth['isAuthenticated'](),controller[_0xc15f('0x61')]);router[_0xc15f('0x5f')](_0xc15f('0x4c'),auth['isAuthenticated'](),controller[_0xc15f('0x62')]);router[_0xc15f('0x5f')](_0xc15f('0x63'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x64')]);router[_0xc15f('0x5f')](_0xc15f('0x4d'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x65')]);router['delete'](_0xc15f('0x4f'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth[_0xc15f('0xa')](),controller['removeOpenchannelInteractions']);router[_0xc15f('0x5f')]('/:id/whatsapp_interactions',auth[_0xc15f('0xa')](),controller['removeWhatsappInteractions']);router[_0xc15f('0x5f')](_0xc15f('0x2c'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x66')]);router[_0xc15f('0x5f')](_0xc15f('0x2d'),auth[_0xc15f('0xa')](),controller['removeMailAccounts']);router['delete'](_0xc15f('0x2e'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x67')]);router[_0xc15f('0x5f')](_0xc15f('0x57'),auth['isAuthenticated'](),controller[_0xc15f('0x68')]);router[_0xc15f('0x5f')]('/:id/chat_websites',auth[_0xc15f('0xa')](),controller[_0xc15f('0x69')]);router[_0xc15f('0x5f')](_0xc15f('0x32'),auth[_0xc15f('0xa')](),controller[_0xc15f('0x6a')]);router[_0xc15f('0x5f')](_0xc15f('0x36'),auth['isAuthenticated'](),controller[_0xc15f('0x6b')]);router[_0xc15f('0x38')]('/:id/messengerSoundNotification',auth[_0xc15f('0xa')](),controller[_0xc15f('0x6c')]);module['exports']=router; \ No newline at end of file +var _0x020c=['addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id','/:id/open_tabs','getOpenTabs','/:id/contacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','/:id/queues','diskStorage','join','root','server/files/images/','format','originalname','single','file','login','/:id/logout','logout','pause','/:id/unpause','/:id/chat_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addOpenchannelAccounts','/:id/sms_accounts'];(function(_0xb746a4,_0x355bdc){var _0x4b6a58=function(_0x3ebf70){while(--_0x3ebf70){_0xb746a4['push'](_0xb746a4['shift']());}};_0x4b6a58(++_0x355bdc);}(_0x020c,0xf8));var _0xc020=function(_0x5da048,_0xca5c85){_0x5da048=_0x5da048-0x0;var _0x13dfc5=_0x020c[_0x5da048];return _0x13dfc5;};'use strict';var multer=require(_0xc020('0x0'));var util=require(_0xc020('0x1'));var path=require(_0xc020('0x2'));var timeout=require(_0xc020('0x3'));var express=require(_0xc020('0x4'));var router=express[_0xc020('0x5')]();var fs_extra=require(_0xc020('0x6'));var auth=require(_0xc020('0x7'));var interaction=require(_0xc020('0x8'));var config=require(_0xc020('0x9'));var controller=require(_0xc020('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xc020('0xb')]);router[_0xc020('0xc')](_0xc020('0xd'),auth[_0xc020('0xe')](),controller[_0xc020('0xf')]);router[_0xc020('0xc')](_0xc020('0x10'),auth['isAuthenticated'](),controller[_0xc020('0x11')]);router[_0xc020('0xc')](_0xc020('0x12'),auth[_0xc020('0xe')](),controller['getPresence']);router[_0xc020('0xc')](_0xc020('0x13'),auth[_0xc020('0xe')](),controller['show']);router[_0xc020('0xc')]('/:id/avatar',controller['getAvatar']);router['get'](_0xc020('0x14'),auth[_0xc020('0xe')](),controller[_0xc020('0x15')]);router[_0xc020('0xc')](_0xc020('0x16'),auth[_0xc020('0xe')](),controller['getContacts']);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0xc020('0x17')]);router[_0xc020('0xc')](_0xc020('0x18'),auth[_0xc020('0xe')](),controller['getVoiceQueuesRt']);router[_0xc020('0xc')](_0xc020('0x19'),auth[_0xc020('0xe')](),controller[_0xc020('0x1a')]);router[_0xc020('0xc')](_0xc020('0x1b'),auth[_0xc020('0xe')](),controller[_0xc020('0x1c')]);router[_0xc020('0xc')](_0xc020('0x1d'),auth[_0xc020('0xe')](),controller['getScreenRecordings']);router['get'](_0xc020('0x1e'),auth[_0xc020('0xe')](),controller[_0xc020('0x1f')]);router['get'](_0xc020('0x20'),auth[_0xc020('0xe')](),controller[_0xc020('0x21')]);router[_0xc020('0xc')](_0xc020('0x22'),auth[_0xc020('0xe')](),controller[_0xc020('0x23')]);router[_0xc020('0xc')](_0xc020('0x24'),auth[_0xc020('0xe')](),controller['getSmsInteractions']);router[_0xc020('0xc')](_0xc020('0x25'),auth[_0xc020('0xe')](),controller['getFaxInteractions']);router['get'](_0xc020('0x26'),auth[_0xc020('0xe')](),controller['getWhatsappInteractions']);router[_0xc020('0xc')](_0xc020('0x27'),auth[_0xc020('0xe')](),controller[_0xc020('0x28')]);router[_0xc020('0xc')](_0xc020('0x29'),auth[_0xc020('0xe')](),controller['getLists']);router[_0xc020('0xc')](_0xc020('0x2a'),auth[_0xc020('0xe')](),controller['getAgents']);router[_0xc020('0xc')]('/:id/prefixes',auth[_0xc020('0xe')](),controller[_0xc020('0x2b')]);router['get']('/:id/fax_accounts',auth[_0xc020('0xe')](),controller[_0xc020('0x2c')]);router[_0xc020('0xc')](_0xc020('0x2d'),auth['isAuthenticated'](),controller[_0xc020('0x2e')]);router[_0xc020('0xc')](_0xc020('0x2f'),auth[_0xc020('0xe')](),controller[_0xc020('0x30')]);router[_0xc020('0xc')]('/:id/sms_accounts',auth[_0xc020('0xe')](),controller[_0xc020('0x31')]);router[_0xc020('0xc')](_0xc020('0x32'),auth[_0xc020('0xe')](),controller['getChatWebsites']);router['get'](_0xc020('0x33'),auth[_0xc020('0xe')](),controller[_0xc020('0x34')]);router[_0xc020('0xc')](_0xc020('0x35'),auth[_0xc020('0xe')](),controller['getScheduledCalls']);router['get'](_0xc020('0x36'),auth[_0xc020('0xe')](),controller[_0xc020('0x37')]);router[_0xc020('0x38')](_0xc020('0x16'),auth[_0xc020('0xe')](),controller[_0xc020('0x39')]);router[_0xc020('0x38')]('/',auth['isAuthenticated'](),controller[_0xc020('0x3a')]);router['post'](_0xc020('0x3b'),auth[_0xc020('0xe')](),controller['bulkCreate']);router[_0xc020('0x38')](_0xc020('0x3c'),auth[_0xc020('0xe')](),controller['addQueues']);var upload=multer({'storage':multer[_0xc020('0x3d')]({'destination':function(_0x342003,_0x588993,_0xe1a64b){_0xe1a64b(null,path[_0xc020('0x3e')](config[_0xc020('0x3f')],_0xc020('0x40')));},'filename':function(_0x243685,_0x569315,_0x559169){_0x559169(null,util[_0xc020('0x41')]('%s-%s',Date['now'](),_0x569315[_0xc020('0x42')]));}})});router['post']('/:id/avatar',upload[_0xc020('0x43')](_0xc020('0x44')),controller['addAvatar']);router['post']('/:id/login',auth[_0xc020('0xe')](),controller[_0xc020('0x45')]);router[_0xc020('0x38')](_0xc020('0x46'),auth[_0xc020('0xe')](),controller[_0xc020('0x47')]);router[_0xc020('0x38')]('/:id/pause',auth['isAuthenticated'](),controller[_0xc020('0x48')]);router[_0xc020('0x38')](_0xc020('0x49'),auth[_0xc020('0xe')](),controller['unpause']);router[_0xc020('0x38')](_0xc020('0x27'),auth[_0xc020('0xe')](),controller['addTeams']);router[_0xc020('0x38')](_0xc020('0x4a'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0xc020('0x38')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xc020('0x4b')]);router[_0xc020('0x38')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xc020('0x4c')]);router[_0xc020('0x38')](_0xc020('0x4d'),auth[_0xc020('0xe')](),controller[_0xc020('0x4e')]);router['post'](_0xc020('0x4f'),auth[_0xc020('0xe')](),controller['addOpenchannelInteractions']);router[_0xc020('0x38')](_0xc020('0x50'),auth[_0xc020('0xe')](),controller[_0xc020('0x51')]);router[_0xc020('0x38')](_0xc020('0x52'),auth[_0xc020('0xe')](),controller['addFaxAccounts']);router[_0xc020('0x38')]('/:id/mail_accounts',auth[_0xc020('0xe')](),controller['addMailAccounts']);router[_0xc020('0x38')](_0xc020('0x2f'),auth['isAuthenticated'](),controller[_0xc020('0x53')]);router[_0xc020('0x38')](_0xc020('0x54'),auth[_0xc020('0xe')](),controller[_0xc020('0x55')]);router[_0xc020('0x38')](_0xc020('0x32'),auth['isAuthenticated'](),controller[_0xc020('0x56')]);router[_0xc020('0x38')](_0xc020('0x33'),auth[_0xc020('0xe')](),controller[_0xc020('0x57')]);router[_0xc020('0x38')](_0xc020('0x36'),auth[_0xc020('0xe')](),controller[_0xc020('0x58')]);router[_0xc020('0x59')]('/:id',auth[_0xc020('0xe')](),controller['update']);router[_0xc020('0x59')](_0xc020('0x5a'),auth[_0xc020('0xe')](),controller[_0xc020('0x5b')]);router[_0xc020('0x5c')](_0xc020('0x3c'),auth[_0xc020('0xe')](),controller[_0xc020('0x5d')]);router[_0xc020('0x5c')](_0xc020('0x27'),auth[_0xc020('0xe')](),controller[_0xc020('0x5e')]);router[_0xc020('0x5c')]('/:id',auth[_0xc020('0xe')](),controller[_0xc020('0x5f')]);router['delete'](_0xc020('0x4a'),auth['isAuthenticated'](),controller[_0xc020('0x60')]);router[_0xc020('0x5c')]('/:id/mail_interactions',auth[_0xc020('0xe')](),controller[_0xc020('0x61')]);router[_0xc020('0x5c')](_0xc020('0x62'),auth[_0xc020('0xe')](),controller[_0xc020('0x63')]);router[_0xc020('0x5c')]('/:id/sms_interactions',auth[_0xc020('0xe')](),controller[_0xc020('0x64')]);router[_0xc020('0x5c')]('/:id/openchannel_interactions',auth[_0xc020('0xe')](),controller[_0xc020('0x65')]);router['delete'](_0xc020('0x50'),auth['isAuthenticated'](),controller[_0xc020('0x66')]);router['delete'](_0xc020('0x52'),auth[_0xc020('0xe')](),controller['removeFaxAccounts']);router[_0xc020('0x5c')](_0xc020('0x2d'),auth[_0xc020('0xe')](),controller[_0xc020('0x67')]);router[_0xc020('0x5c')]('/:id/openchannel_accounts',auth[_0xc020('0xe')](),controller[_0xc020('0x68')]);router[_0xc020('0x5c')](_0xc020('0x54'),auth[_0xc020('0xe')](),controller[_0xc020('0x69')]);router[_0xc020('0x5c')](_0xc020('0x32'),auth[_0xc020('0xe')](),controller[_0xc020('0x6a')]);router[_0xc020('0x5c')](_0xc020('0x33'),auth[_0xc020('0xe')](),controller[_0xc020('0x6b')]);router[_0xc020('0x5c')]('/:id/api_key',auth[_0xc020('0xe')](),controller[_0xc020('0x6c')]);router['post'](_0xc020('0x6d'),auth[_0xc020('0xe')](),controller[_0xc020('0x6e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 026ecc9..4672fbb 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 _0x056e=['icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','agent','INTEGER','internal','accountcode','format','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','user','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','rfc2833','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','passive','actpass','nonat','update,nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp'];(function(_0x472644,_0x5008f9){var _0x26b0b7=function(_0x1c2782){while(--_0x1c2782){_0x472644['push'](_0x472644['shift']());}};_0x26b0b7(++_0x5008f9);}(_0x056e,0x17c));var _0xe056=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x056e[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0xe056('0x0'));var moment=require(_0xe056('0x1'));var util=require(_0xe056('0x2'));var _=require(_0xe056('0x3'));module[_0xe056('0x4')]={'name':{'type':Sequelize[_0xe056('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x18814b){this['setDataValue'](_0xe056('0x6'),_0x18814b);this[_0xe056('0x7')](_0xe056('0x8'),_0x18814b);},'comment':_0xe056('0x9')},'fullname':{'type':Sequelize[_0xe056('0x5')],'allowNull':![],'set':function(_0x436f13){this['setDataValue']('fullname',_0x436f13);this[_0xe056('0x7')](_0xe056('0xa'),util['format'](_0xe056('0xb'),_0x436f13,this[_0xe056('0xc')]('internal')));}},'alias':{'type':Sequelize[_0xe056('0x5')]},'email':{'type':Sequelize[_0xe056('0x5')],'allowNull':![],'unique':_0xe056('0xd'),'validate':{'isEmail':!![]},'set':function(_0x34a5cc){if(_0x34a5cc){this[_0xe056('0x7')](_0xe056('0xd'),_0x34a5cc[_0xe056('0xe')]());}}},'role':{'type':Sequelize[_0xe056('0xf')]('admin','user',_0xe056('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':![],'unique':'internal','set':function(_0x16ddb8){this[_0xe056('0x7')](_0xe056('0x12'),_0x16ddb8);this['setDataValue'](_0xe056('0x13'),_0x16ddb8);this[_0xe056('0x7')](_0xe056('0xa'),util[_0xe056('0x14')](_0xe056('0xb'),this[_0xe056('0xc')]('fullname'),_0x16ddb8));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe056('0x5')]},'mobile':{'type':Sequelize[_0xe056('0x5')]},'address':{'type':Sequelize[_0xe056('0x5')]},'zipcode':{'type':Sequelize[_0xe056('0x5')]},'userpic':{'type':Sequelize[_0xe056('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe056('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe056('0x15')]},'voicePause':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe056('0x5')],'defaultValue':_0xe056('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe056('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe056('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![],'defaultValue':_0xe056('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xe056('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xe056('0x19'),'peer'),'allowNull':!![],'defaultValue':_0xe056('0x1a')},'context':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![],'defaultValue':_0xe056('0x1b')},'callingpres':{'type':Sequelize[_0xe056('0xf')]('ALLOWED_NOT_SCREENED',_0xe056('0x1c'),_0xe056('0x1d'),'ALLOWED',_0xe056('0x1e'),_0xe056('0x1f'),'PROHIB_FAILED_SCREEN',_0xe056('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x5c2039){this['setDataValue'](_0xe056('0x21'),_0x5c2039?_0x5c2039[_0xe056('0x22')](','):null);},'get':function(){return this['getDataValue'](_0xe056('0x21'))?this[_0xe056('0xc')](_0xe056('0x21'))[_0xe056('0x23')](','):null;},'comment':_0xe056('0x24')},'dtmfmode':{'type':Sequelize[_0xe056('0xf')]('rfc2833',_0xe056('0x25'),_0xe056('0x26'),'inband','auto'),'allowNull':!![],'defaultValue':_0xe056('0x27')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xe056('0x28'),_0xe056('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4d0e86){this[_0xe056('0x7')](_0xe056('0x2b'),_0x4d0e86?_0x4d0e86[_0xe056('0x22')](','):null);},'get':function(){return this[_0xe056('0xc')](_0xe056('0x2b'))?this[_0xe056('0xc')]('nat')[_0xe056('0x23')](','):null;},'comment':_0xe056('0x2c')},'callgroup':{'type':Sequelize[_0xe056('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe056('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xe056('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe056('0x5')]},'disallow':{'type':Sequelize[_0xe056('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe056('0x5')],'allowNull':![],'defaultValue':_0xe056('0x2d'),'set':function(_0xc3dda){this[_0xe056('0x7')](_0xe056('0x2e'),_0xc3dda?_0xc3dda[_0xe056('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe056('0xc')](_0xe056('0x2e'))?this[_0xe056('0xc')](_0xe056('0x2e'))[_0xe056('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![],'set':function(_0x4ba60d){this[_0xe056('0x7')](_0xe056('0x2f'),_0x4ba60d?_0x4ba60d[_0xe056('0x22')](','):null);},'get':function(){return this[_0xe056('0xc')]('insecure')?this[_0xe056('0xc')](_0xe056('0x2f'))[_0xe056('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe056('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no',_0xe056('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xe056('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe056('0x31')},'amaflags':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xe056('0x2a')},'busylevel':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xe056('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe056('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe056('0xf')]('yes','no',_0xe056('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xe056('0x33'),'refuse',_0xe056('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x35'),_0xe056('0x36')),'allowNull':!![],'defaultValue':_0xe056('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe056('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xe056('0x2a')},'keepalive':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xe056('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no',_0xe056('0x37'),_0xe056('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe056('0xf')]('active',_0xe056('0x39'),_0xe056('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xe056('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe056('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe056('0xf')](_0xe056('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xe056('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe056('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xe056('0x3b'),_0xe056('0x28'),_0xe056('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe056('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xe056('0x15')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe056('0x3d')]},'showWebBar':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0,'set':function(_0x2e2660){this['setDataValue'](_0xe056('0x3e'),_0x2e2660);var _0x42c9c0=this[_0xe056('0x3f')]({'plain':!![]});switch(_0x2e2660){case 0x0:case 0x1:var _0x26ef7f=_0x42c9c0[_0xe056('0x21')]?_[_0xe056('0x40')](_0x42c9c0[_0xe056('0x21')])?_0x42c9c0['transport']['join']():_0x42c9c0['transport']:_0xe056('0x41');if(_0x26ef7f===_0xe056('0x42')){_0x26ef7f=_0xe056('0x41');}this[_0xe056('0x7')](_0xe056('0x21'),_0x26ef7f);this[_0xe056('0x7')](_0xe056('0x43'),'no');this[_0xe056('0x7')](_0xe056('0x44'),null);this[_0xe056('0x7')](_0xe056('0x45'),null);this['setDataValue'](_0xe056('0x46'),null);this[_0xe056('0x7')](_0xe056('0x47'),null);this['setDataValue'](_0xe056('0x48'),null);this['setDataValue'](_0xe056('0x49'),null);this[_0xe056('0x7')](_0xe056('0x4a'),null);this[_0xe056('0x7')](_0xe056('0x4b'),null);this[_0xe056('0x7')](_0xe056('0x4c'),'no');break;case 0x2:this[_0xe056('0x7')]('transport',_0xe056('0x42'));this[_0xe056('0x7')](_0xe056('0x43'),_0xe056('0x2a'));this['setDataValue'](_0xe056('0x44'),_0xe056('0x2a'));this[_0xe056('0x7')]('force_avp','yes');this[_0xe056('0x7')](_0xe056('0x46'),'yes');this[_0xe056('0x7')](_0xe056('0x47'),_0xe056('0x2a'));this[_0xe056('0x7')](_0xe056('0x48'),'no');this[_0xe056('0x7')](_0xe056('0x49'),_0xe056('0x3a'));this[_0xe056('0x7')](_0xe056('0x4a'),_0x42c9c0[_0xe056('0x4a')]||_0xe056('0x4d'));this[_0xe056('0x7')](_0xe056('0x4b'),_0x42c9c0['dtlsprivatekey']||_0xe056('0x4e'));this['setDataValue'](_0xe056('0x4c'),_0xe056('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xe056('0x3d')],'set':function(_0x7aaba4){this[_0xe056('0x7')](_0xe056('0x4f'),_0x7aaba4?_0x7aaba4['join'](','):[]);},'get':function(){return this[_0xe056('0xc')](_0xe056('0x4f'))?_[_0xe056('0x50')](this['getDataValue'](_0xe056('0x4f'))[_0xe056('0x23')](','),function(_0x4d3d5c){return parseInt(_0x4d3d5c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe056('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe056('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe056('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe056('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xe056('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xe056('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe056('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe056('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xe056('0x51'))?this[_0xe056('0xc')](_0xe056('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![],'set':function(_0x4100bd){if(typeof _0x4100bd===_0xe056('0x52')){var _0x19c628=_0x4100bd==='1'?!![]:_0x4100bd==='0'?![]:_0x4100bd===_0xe056('0x53')?!![]:_0x4100bd===_0xe056('0x54')?![]:![];this[_0xe056('0x7')](_0xe056('0x55'),_0x19c628);}else{this['setDataValue'](_0xe056('0x55'),_0x4100bd);}}},'blocked':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![],'set':function(_0x2f0637){this[_0xe056('0x7')](_0xe056('0x56'),_0x2f0637);if(_0x2f0637===!![]){this[_0xe056('0x7')](_0xe056('0x57'),moment());this['setDataValue'](_0xe056('0x58'),0x0);}else{this[_0xe056('0x7')](_0xe056('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0xe056('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xe056('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xe056('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe056('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe056('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xe056('0x11')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xe056('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xb989=['TEXT','map','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','user','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','showWebBar','get','wss','force_avp','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','encryption','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux'];(function(_0x4fee76,_0xc60073){var _0x4335f4=function(_0xbd9fb1){while(--_0xbd9fb1){_0x4fee76['push'](_0x4fee76['shift']());}};_0x4335f4(++_0xc60073);}(_0xb989,0xbb));var _0x9b98=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xb989[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x9b98('0x0'));var moment=require(_0x9b98('0x1'));var util=require('util');var _=require(_0x9b98('0x2'));module[_0x9b98('0x3')]={'name':{'type':Sequelize[_0x9b98('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1e56a0){this[_0x9b98('0x5')](_0x9b98('0x6'),_0x1e56a0);this[_0x9b98('0x5')](_0x9b98('0x7'),_0x1e56a0);},'comment':_0x9b98('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x22c5bd){this[_0x9b98('0x5')](_0x9b98('0x9'),_0x22c5bd);this['setDataValue']('callerid',util[_0x9b98('0xa')](_0x9b98('0xb'),_0x22c5bd,this[_0x9b98('0xc')](_0x9b98('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9b98('0x4')],'allowNull':![],'unique':_0x9b98('0xe'),'validate':{'isEmail':!![]},'set':function(_0x2599f0){if(_0x2599f0){this[_0x9b98('0x5')](_0x9b98('0xe'),_0x2599f0[_0x9b98('0xf')]());}}},'role':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x11'),'user',_0x9b98('0x12'),_0x9b98('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x9b98('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9b98('0x4')],'defaultValue':_0x9b98('0x14')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x538334){this[_0x9b98('0x5')](_0x9b98('0xd'),_0x538334);this[_0x9b98('0x5')](_0x9b98('0x15'),_0x538334);this[_0x9b98('0x5')]('callerid',util[_0x9b98('0xa')](_0x9b98('0xb'),this['getDataValue'](_0x9b98('0x9')),_0x538334));}},'salt':{'type':Sequelize[_0x9b98('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x9b98('0x4')]},'address':{'type':Sequelize[_0x9b98('0x4')]},'zipcode':{'type':Sequelize[_0x9b98('0x4')]},'userpic':{'type':Sequelize[_0x9b98('0x4')]},'city':{'type':Sequelize[_0x9b98('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9b98('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9b98('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x9b98('0x17')]},'chatCapacity':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9b98('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9b98('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![],'defaultValue':_0x9b98('0x19')},'ipaddr':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9b98('0x10')]('friend',_0x9b98('0x1a'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x1b'),'ALLOWED_PASSED_SCREEN',_0x9b98('0x1c'),_0x9b98('0x1d'),_0x9b98('0x1e'),_0x9b98('0x1f'),_0x9b98('0x20'),_0x9b98('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![],'defaultValue':_0x9b98('0x22'),'set':function(_0x4f9469){this[_0x9b98('0x5')](_0x9b98('0x23'),_0x4f9469?_0x4f9469[_0x9b98('0x24')](','):null);},'get':function(){return this[_0x9b98('0xc')](_0x9b98('0x23'))?this['getDataValue']('transport')[_0x9b98('0x25')](','):null;},'comment':_0x9b98('0x26')},'dtmfmode':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x27'),_0x9b98('0x28'),_0x9b98('0x29'),_0x9b98('0x2a'),_0x9b98('0x2b')),'allowNull':!![],'defaultValue':_0x9b98('0x27')},'directmedia':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no',_0x9b98('0x2d'),_0x9b98('0x2e'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9b98('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x15987a){this['setDataValue'](_0x9b98('0x2f'),_0x15987a?_0x15987a[_0x9b98('0x24')](','):null);},'get':function(){return this[_0x9b98('0xc')](_0x9b98('0x2f'))?this[_0x9b98('0xc')](_0x9b98('0x2f'))['split'](','):null;},'comment':_0x9b98('0x30')},'callgroup':{'type':Sequelize[_0x9b98('0x4')]},'namedcallgroup':{'type':Sequelize[_0x9b98('0x4')]},'pickupgroup':{'type':Sequelize[_0x9b98('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x9b98('0x4')]},'language':{'type':Sequelize[_0x9b98('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9b98('0x4')]},'disallow':{'type':Sequelize[_0x9b98('0x4')],'allowNull':![],'defaultValue':_0x9b98('0x31')},'allow':{'type':Sequelize[_0x9b98('0x4')],'allowNull':![],'defaultValue':_0x9b98('0x32'),'set':function(_0x272771){this['setDataValue']('allow',_0x272771?_0x272771['join'](';'):_0x9b98('0x32'));},'get':function(){return this[_0x9b98('0xc')](_0x9b98('0x33'))?this[_0x9b98('0xc')](_0x9b98('0x33'))['split'](';'):null;},'comment':_0x9b98('0x34')},'autoframing':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![],'set':function(_0x17ea9f){this[_0x9b98('0x5')]('insecure',_0x17ea9f?_0x17ea9f['join'](','):null);},'get':function(){return this['getDataValue'](_0x9b98('0x35'))?this[_0x9b98('0xc')](_0x9b98('0x35'))[_0x9b98('0x25')](','):null;},'comment':_0x9b98('0x36')},'trustrpid':{'type':Sequelize[_0x9b98('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9b98('0x10')]('yes','no',_0x9b98('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x9b98('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x9b98('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9b98('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9b98('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x9b98('0x38'),_0x9b98('0x39'),_0x9b98('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x3b'),_0x9b98('0x3c')),'allowNull':!![],'defaultValue':_0x9b98('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9b98('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x9b98('0x2c')},'keepalive':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9b98('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x9b98('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no',_0x9b98('0x3d'),_0x9b98('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x9b98('0x3f'),_0x9b98('0x40'),_0x9b98('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x9b98('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9b98('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9b98('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no','nonat',_0x9b98('0x2e'),_0x9b98('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9b98('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x9b98('0x17')]},'passwordResetAt':{'type':Sequelize[_0x9b98('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0,'set':function(_0x310755){this[_0x9b98('0x5')](_0x9b98('0x43'),_0x310755);var _0x5581c2=this[_0x9b98('0x44')]({'plain':!![]});switch(_0x310755){case 0x0:case 0x1:var _0x3cad17=_0x5581c2['transport']?_['isArray'](_0x5581c2['transport'])?_0x5581c2[_0x9b98('0x23')]['join']():_0x5581c2['transport']:_0x9b98('0x22');if(_0x3cad17===_0x9b98('0x45')){_0x3cad17=_0x9b98('0x22');}this[_0x9b98('0x5')](_0x9b98('0x23'),_0x3cad17);this['setDataValue']('encryption','no');this[_0x9b98('0x5')]('avpf',null);this[_0x9b98('0x5')](_0x9b98('0x46'),null);this[_0x9b98('0x5')]('icesupport',null);this[_0x9b98('0x5')]('dtlsenable',null);this[_0x9b98('0x5')](_0x9b98('0x47'),null);this[_0x9b98('0x5')](_0x9b98('0x48'),null);this['setDataValue'](_0x9b98('0x49'),null);this[_0x9b98('0x5')](_0x9b98('0x4a'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x9b98('0x23'),_0x9b98('0x45'));this[_0x9b98('0x5')](_0x9b98('0x4b'),_0x9b98('0x2c'));this[_0x9b98('0x5')]('avpf',_0x9b98('0x2c'));this[_0x9b98('0x5')]('force_avp',_0x9b98('0x2c'));this[_0x9b98('0x5')]('icesupport',_0x9b98('0x2c'));this[_0x9b98('0x5')](_0x9b98('0x4c'),_0x9b98('0x2c'));this[_0x9b98('0x5')]('dtlsverify','no');this[_0x9b98('0x5')](_0x9b98('0x48'),'actpass');this[_0x9b98('0x5')](_0x9b98('0x49'),_0x5581c2['dtlscertfile']||_0x9b98('0x4d'));this['setDataValue'](_0x9b98('0x4a'),_0x5581c2[_0x9b98('0x4a')]||_0x9b98('0x4e'));this['setDataValue'](_0x9b98('0x4f'),_0x9b98('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x9b98('0x50')],'set':function(_0x566bb5){this['setDataValue']('permissions',_0x566bb5?_0x566bb5[_0x9b98('0x24')](','):[]);},'get':function(){return this[_0x9b98('0xc')]('permissions')?_[_0x9b98('0x51')](this[_0x9b98('0xc')]('permissions')[_0x9b98('0x25')](','),function(_0x2c58e8){return parseInt(_0x2c58e8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9b98('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x9b98('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9b98('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9b98('0x10')](_0x9b98('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9b98('0xc')](_0x9b98('0x52'))?this[_0x9b98('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x9b98('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9b98('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![],'set':function(_0x39b343){if(typeof _0x39b343===_0x9b98('0x53')){var _0x4840bf=_0x39b343==='1'?!![]:_0x39b343==='0'?![]:_0x39b343==='true'?!![]:_0x39b343==='false'?![]:![];this[_0x9b98('0x5')](_0x9b98('0x54'),_0x4840bf);}else{this[_0x9b98('0x5')](_0x9b98('0x54'),_0x39b343);}}},'blocked':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![],'set':function(_0x55ee99){this['setDataValue'](_0x9b98('0x55'),_0x55ee99);if(_0x55ee99===!![]){this[_0x9b98('0x5')](_0x9b98('0x56'),moment());this[_0x9b98('0x5')](_0x9b98('0x57'),0x0);}else{this[_0x9b98('0x5')](_0x9b98('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x9b98('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9b98('0x18')](0x5)[_0x9b98('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9b98('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9b98('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9b98('0x16')],'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 3374dad..78559db 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 _0x8a14=['user:%s','user:forcelogout','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','forEach','pause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','whatsappPause','pauseType','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','TeamVoicePrefix','getLists','CmList','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','CmContact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','idle','unknown','ringing','teams','inbound','flatten','toString','col','asc','desc','substring','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','messengerSoundNotification','moment','util','lodash','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','socket.io-emitter','redis','./user.socket','register','localhost','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','update','role','agent','emit','userNotification:recalc:','destroy','then','get','admin','Users','user','filter','ignore','map','value','includes','find','UserProfileResource','stack','name','User','rawAttributes','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','where','query','includeAll','userSetting','include','findAll','rows','true','length','push','chat','dataValues','sms','mail','openchannel','whatsapp','all','params','merge','attributes','openTabs','body','catch','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','101','102','113','110','107','100','111','114','115','create','Unauthorized','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','Telephones','autoAssociation','error','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','validatePasswordHistory','passwordHistoryLimit','addQueues','online','loginInPause','interface','isValidChannel','add','capitalize','toLowerCase','penalty','spread','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','removeQueues','channel','Unknown\x20channel','remove','Queues','isArray','Queue:remove','QueueId','addAvatar','userpic','file','filename','getAvatar','existsSync','join','root','server/files/images/','download','getOpenTabs','fax','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','Tag','Tags','tag','getQueues','keys','Queue','intersection','model','fields','order','sort','filters','pick','Unknown\x20role','hasOwnProperty','options','nolimit','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf'];(function(_0x24d23d,_0x3e4d40){var _0x59332d=function(_0x222dbe){while(--_0x222dbe){_0x24d23d['push'](_0x24d23d['shift']());}};_0x59332d(++_0x3e4d40);}(_0x8a14,0x97));var _0x48a1=function(_0x59b8a1,_0x474d8a){_0x59b8a1=_0x59b8a1-0x0;var _0x29b56f=_0x8a14[_0x59b8a1];return _0x29b56f;};'use strict';var moment=require(_0x48a1('0x0'));var util=require(_0x48a1('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x48a1('0x2'));var squel=require('squel');var Redis=require(_0x48a1('0x3'));var authService=require('../../components/auth/service');var contacts=require(_0x48a1('0x4'));var qs=require(_0x48a1('0x5'));var rta=require('../../components/realtime/agents');var logger=require('../../config/logger')(_0x48a1('0x6'));var utils=require(_0x48a1('0x7'));var config=require(_0x48a1('0x8'));var licenseUtil=require(_0x48a1('0x9'));var APIBadRequestError=require(_0x48a1('0xa'))[_0x48a1('0xb')];var APINotFoundError=require(_0x48a1('0xa'))[_0x48a1('0xc')];var APIHandleError=require('../../errors/api')['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0x48a1('0xd'))(new Redis(config[_0x48a1('0xe')]));require(_0x48a1('0xf'))[_0x48a1('0x10')](socket);config[_0x48a1('0xe')]=_['defaults'](config[_0x48a1('0xe')],{'host':_0x48a1('0x11'),'port':0x18eb});var values;function respondWithStatusCode(_0x1a0bc0,_0x28449e){_0x28449e=_0x28449e||0xcc;return function(_0x4aacba){if(_0x4aacba){return _0x1a0bc0[_0x48a1('0x12')](_0x28449e);}return _0x1a0bc0[_0x48a1('0x13')](_0x28449e)[_0x48a1('0x14')]();};}function respondWithResult(_0x21b999,_0x106fc3){_0x106fc3=_0x106fc3||0xc8;return function(_0x24d339){if(_0x24d339){return _0x21b999[_0x48a1('0x13')](_0x106fc3)[_0x48a1('0x15')](_0x24d339);}};}function respondWithFilteredResult(_0x586d50,_0x4f6338){return function(_0x5bae59){if(_0x5bae59){var _0x48b0e5=typeof _0x4f6338['offset']===_0x48a1('0x16')&&typeof _0x4f6338['limit']===_0x48a1('0x16');var _0x353d0f=_0x5bae59['count'];var _0x4a3b23=_0x48b0e5?0x0:_0x4f6338[_0x48a1('0x17')];var _0x22e6fb=_0x48b0e5?_0x5bae59[_0x48a1('0x18')]:_0x4f6338[_0x48a1('0x17')]+_0x4f6338[_0x48a1('0x19')];var _0x1133f7;if(_0x22e6fb>=_0x353d0f){_0x22e6fb=_0x353d0f;_0x1133f7=0xc8;}else{_0x1133f7=0xce;}_0x586d50[_0x48a1('0x13')](_0x1133f7);return _0x586d50[_0x48a1('0x1a')](_0x48a1('0x1b'),_0x4a3b23+'-'+_0x22e6fb+'/'+_0x353d0f)['json'](_0x5bae59);}return null;};}function saveUpdates(_0x343ea6){return function(_0x4fd404){if(_0x4fd404){return _0x4fd404[_0x48a1('0x1c')](_0x343ea6)['then'](function(_0x1ca4a1){if(_0x1ca4a1[_0x48a1('0x1d')]===_0x48a1('0x1e')){socket[_0x48a1('0x1f')](_0x48a1('0x20')+_0x1ca4a1['id'],_0x1ca4a1);}return _0x1ca4a1;});}return null;};}function removeEntity(_0x203d6d){return function(_0x5584ac){if(_0x5584ac){return _0x5584ac[_0x48a1('0x21')]()[_0x48a1('0x22')](function(){var _0x1a5411=_0x5584ac[_0x48a1('0x23')]({'plain':!![]});if(_0x1a5411[_0x48a1('0x1d')]===_0x48a1('0x24'))return;var _0xd68f3e=[{'name':_0x48a1('0x25'),'value':_0x48a1('0x26'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x24646d=_(_0xd68f3e)[_0x48a1('0x27')](_0x48a1('0x28'))[_0x48a1('0x29')]('value')[_0x48a1('0x2a')]();if(_[_0x48a1('0x2b')](_0x24646d,_0x1a5411[_0x48a1('0x1d')])){return;}var _0x273df0=_[_0x48a1('0x2c')](_0xd68f3e,[_0x48a1('0x2a'),_0x1a5411[_0x48a1('0x1d')]])['name'];return db[_0x48a1('0x2d')][_0x48a1('0x21')]({'where':{'type':_0x273df0,'resourceId':_0x1a5411['id']}})['then'](function(){return _0x5584ac;});})[_0x48a1('0x22')](function(){_0x203d6d[_0x48a1('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ddf7d){return function(_0x16c5d9){if(!_0x16c5d9){_0x2ddf7d[_0x48a1('0x12')](0x194);}return _0x16c5d9;};}function handleError(_0x290133,_0x17cbf5){_0x17cbf5=_0x17cbf5||0x1f4;return function(_0x341e7c){logger['error'](_0x341e7c[_0x48a1('0x2e')]);if(_0x341e7c['name']){delete _0x341e7c[_0x48a1('0x2f')];}_0x290133[_0x48a1('0x13')](_0x17cbf5)['send'](_0x341e7c);};}function getUserAttributes(){return _(db[_0x48a1('0x30')][_0x48a1('0x31')])[_0x48a1('0x29')](function(_0x3ca155){return{'name':_0x3ca155[_0x48a1('0x32')],'type':_0x3ca155[_0x48a1('0x33')][_0x48a1('0x34')]};})[_0x48a1('0x27')](function(_0x440afa){return![_0x48a1('0x35'),_0x48a1('0x36'),_0x48a1('0x37'),_0x48a1('0x38'),_0x48a1('0x39'),'md5secret'][_0x48a1('0x2b')](_0x440afa['name']);})[_0x48a1('0x2a')]();}exports[_0x48a1('0x3a')]=function(_0x198825,_0x456ec5){var _0x498267={},_0x59b8ad={'count':0x0,'rows':[]};var _0xfc2174=getUserAttributes();_0x498267=qs[_0x48a1('0x3b')](_0xfc2174,_0x198825);var _0xdfe52={'where':_0x498267[_0x48a1('0x3c')]};return db[_0x48a1('0x30')][_0x48a1('0x18')](_0xdfe52)['then'](function(_0x25dcf1){_0x59b8ad[_0x48a1('0x18')]=_0x25dcf1;if(_0x198825[_0x48a1('0x3d')][_0x48a1('0x3e')]){_0x498267['include']=[{'all':!![]}];}if(_0x198825[_0x48a1('0x3d')][_0x48a1('0x3f')]==='true'){_0x498267[_0x48a1('0x40')]=[{'model':db['UserSetting'],'as':_0x48a1('0x3f')}];}if(!_[_0x48a1('0x2b')](_0x498267['attributes'],'id')){_0x498267['attributes']['push']('id');}return db[_0x48a1('0x30')][_0x48a1('0x41')](_0x498267);})['then'](function(_0x5b1e6a){_0x59b8ad[_0x48a1('0x42')]=_0x5b1e6a;if(_0x198825[_0x48a1('0x3d')]['openTabs']===_0x48a1('0x43')){var _0x160ad6=[];for(var _0x1e8ecb=0x0;_0x1e8ecb<_0x59b8ad[_0x48a1('0x42')][_0x48a1('0x44')];_0x1e8ecb++){_0x160ad6[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x46'),_0x59b8ad['rows'][_0x1e8ecb][_0x48a1('0x47')]));_0x160ad6['push'](get_open_tabs(_0x48a1('0x48'),_0x59b8ad[_0x48a1('0x42')][_0x1e8ecb][_0x48a1('0x47')]));_0x160ad6[_0x48a1('0x45')](get_open_tabs('fax',_0x59b8ad[_0x48a1('0x42')][_0x1e8ecb][_0x48a1('0x47')]));_0x160ad6[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x49'),_0x59b8ad[_0x48a1('0x42')][_0x1e8ecb]['dataValues']));_0x160ad6['push'](get_open_tabs(_0x48a1('0x4a'),_0x59b8ad['rows'][_0x1e8ecb][_0x48a1('0x47')]));_0x160ad6[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x4b'),_0x59b8ad[_0x48a1('0x42')][_0x1e8ecb][_0x48a1('0x47')]));}return Promise[_0x48a1('0x4c')](_0x160ad6)['then'](function(){return _0x59b8ad;});}else{return _0x59b8ad;}})[_0x48a1('0x22')](respondWithFilteredResult(_0x456ec5,_0x498267))['catch'](handleError(_0x456ec5,null));};exports['show']=function(_0x40c3ba,_0x1b0acd){var _0x22f04a=getUserAttributes();_0x40c3ba['query']['id']=_0x40c3ba[_0x48a1('0x4d')]['id'];var _0x488ced=qs['getOptions'](_0x22f04a,_0x40c3ba);if(_0x40c3ba['query'][_0x48a1('0x3e')]){_0x488ced['include']=[{'all':!![]}];}if(_0x40c3ba[_0x48a1('0x3d')][_0x48a1('0x3f')]===_0x48a1('0x43')){_0x488ced[_0x48a1('0x40')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x488ced=_[_0x48a1('0x4e')]({},_0x488ced,_0x40c3ba['options']);if(!_[_0x48a1('0x2b')](_0x488ced[_0x48a1('0x4f')],'id')){_0x488ced[_0x48a1('0x4f')][_0x48a1('0x45')]('id');}return db[_0x48a1('0x30')][_0x48a1('0x2c')](_0x488ced)[_0x48a1('0x22')](handleEntityNotFound(_0x1b0acd,null))[_0x48a1('0x22')](function(_0x46bbda){var _0x581cc5=[];values=_0x46bbda;if(_0x40c3ba[_0x48a1('0x3d')][_0x48a1('0x50')]===_0x48a1('0x43')){_0x581cc5[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x46'),_0x46bbda['dataValues']));_0x581cc5[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x48'),_0x46bbda[_0x48a1('0x47')]));_0x581cc5[_0x48a1('0x45')](get_open_tabs('openchannel',_0x46bbda[_0x48a1('0x47')]));_0x581cc5['push'](get_open_tabs(_0x48a1('0x4b'),_0x46bbda[_0x48a1('0x47')]));_0x581cc5[_0x48a1('0x45')](get_open_tabs('fax',_0x46bbda['dataValues']));_0x581cc5[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x49'),_0x46bbda[_0x48a1('0x47')]));return Promise['all'](_0x581cc5);}else{return values;}})[_0x48a1('0x22')](function(){return values;})[_0x48a1('0x22')](respondWithResult(_0x1b0acd,null))['catch'](handleError(_0x1b0acd,null));};exports[_0x48a1('0x1c')]=function(_0x1bea64,_0x16ec0e){if(_0x1bea64[_0x48a1('0x51')]['id']){delete _0x1bea64['body']['id'];}delete _0x1bea64[_0x48a1('0x51')][_0x48a1('0x1d')];return db['User'][_0x48a1('0x2c')]({'where':{'id':_0x1bea64['params']['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x16ec0e,null))[_0x48a1('0x22')](saveUpdates(_0x1bea64[_0x48a1('0x51')],null))[_0x48a1('0x22')](respondWithResult(_0x16ec0e,null))[_0x48a1('0x52')](handleError(_0x16ec0e,null));};exports[_0x48a1('0x53')]=function(_0x63570d,_0x4ae4b7){return db[_0x48a1('0x30')][_0x48a1('0x53')]()[_0x48a1('0x22')](respondWithResult(_0x4ae4b7,null))['catch'](handleError(_0x4ae4b7,null));};exports[_0x48a1('0x54')]=function(_0x4720f1,_0x523348){return db[_0x48a1('0x30')][_0x48a1('0x2c')]({'where':{'id':_0x4720f1['params']['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x523348,null))[_0x48a1('0x22')](function(_0x3a580d){if(_0x3a580d){return _0x3a580d[_0x48a1('0x54')](_0x4720f1[_0x48a1('0x51')]['ids'],_[_0x48a1('0x55')](_0x4720f1[_0x48a1('0x51')],[_0x48a1('0x56'),'id'])||{});}})[_0x48a1('0x22')](respondWithResult(_0x523348,null))[_0x48a1('0x52')](handleError(_0x523348,null));};function validateUser(_0x457bbb){return new Promise(function(_0x1e0a34,_0x33c0a){if(_0x457bbb[_0x48a1('0x57')])return _0x1e0a34(_0x457bbb);return db[_0x48a1('0x58')][_0x48a1('0x59')](0x1)[_0x48a1('0x22')](function(_0x196531){if(_0x196531[_0x48a1('0x5a')])authService[_0x48a1('0x5b')](_0x457bbb[_0x48a1('0x35')]);db['User'][_0x48a1('0x5c')]('internal')[_0x48a1('0x22')](function(_0x5ecb84){if(_[_0x48a1('0x5d')](_0x5ecb84)){_0x457bbb['internal']=_0x196531[_0x48a1('0x5e')]||0x1;return;}if(_[_0x48a1('0x5d')](_0x196531['min_internal'])||_0x196531['min_internal']===_0x5ecb84){_0x457bbb[_0x48a1('0x57')]=_0x5ecb84+0x1;return;}if(_0x196531[_0x48a1('0x5e')]>_0x5ecb84){_0x457bbb[_0x48a1('0x57')]=_0x196531['min_internal'];return;}return db[_0x48a1('0x5f')][_0x48a1('0x3d')](_0x48a1('0x60'),{'type':db[_0x48a1('0x5f')][_0x48a1('0x61')][_0x48a1('0x62')]})[_0x48a1('0x22')](function(_0x49292b){if(_0x49292b&&_0x49292b[_0x48a1('0x44')]){for(var _0x49cb80=0x0,_0x51c5e9=_0x49292b['length'];_0x49cb80<_0x51c5e9&&_[_0x48a1('0x5d')](_0x457bbb[_0x48a1('0x57')]);_0x49cb80++){if(_0x196531[_0x48a1('0x5e')]<=_0x49292b[_0x49cb80][_0x48a1('0x63')]){_0x457bbb[_0x48a1('0x57')]=_0x49292b[_0x49cb80][_0x48a1('0x63')];}else if(_0x196531[_0x48a1('0x5e')]>_0x49292b[_0x49cb80][_0x48a1('0x63')]&&_0x196531[_0x48a1('0x5e')]<=_0x49292b[_0x49cb80]['to']){_0x457bbb['internal']=_0x196531[_0x48a1('0x5e')];}}}if(_[_0x48a1('0x5d')](_0x457bbb[_0x48a1('0x57')])){_0x457bbb[_0x48a1('0x57')]=_0x5ecb84+0x1;}return _0x1e0a34(_0x457bbb);});});})['catch'](function(_0x7524d0){_0x33c0a(_0x7524d0);});});}function updateUser(_0x49cbba){return new Promise(function(_0xec07bd,_0x2841d2){try{if(_0x49cbba[_0x48a1('0x64')]){_0x49cbba[_0x48a1('0x65')]=_0x49cbba[_0x48a1('0x57')];_0x49cbba[_0x48a1('0x66')]={'mailbox':_0x49cbba['internal'],'password':_0x49cbba[_0x48a1('0x35')],'fullname':_0x49cbba['fullname'],'email':_0x49cbba[_0x48a1('0x67')]};}if(_0x49cbba[_0x48a1('0x1d')]===_0x48a1('0x1e')){if(!_0x49cbba['permissions'])_0x49cbba['permissions']=[_0x48a1('0x68'),_0x48a1('0x69'),'103',_0x48a1('0x6a'),_0x48a1('0x6b'),'104','105','106',_0x48a1('0x6c'),'108','109',_0x48a1('0x6d'),_0x48a1('0x6e'),_0x48a1('0x6f'),_0x48a1('0x70')];}_0xec07bd(_0x49cbba);}catch(_0x225929){_0x2841d2(_0x225929);}});}exports[_0x48a1('0x71')]=function(_0x5a8693,_0x9cddf7){if(_0x5a8693[_0x48a1('0x26')]['role']==='agent')throw new Error(_0x48a1('0x72'));if(_0x5a8693[_0x48a1('0x51')]['role']===_0x48a1('0x26')&&_0x5a8693[_0x48a1('0x26')][_0x48a1('0x1d')]!==_0x48a1('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5a8693['body']['role']===_0x48a1('0x24')&&_0x5a8693[_0x48a1('0x26')][_0x48a1('0x1d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x48a1('0x73')]([_0x5a8693[_0x48a1('0x51')]])['then'](function(){return validateUser(_0x5a8693[_0x48a1('0x51')]);})[_0x48a1('0x22')](function(_0x2c7d83){return updateUser(_0x2c7d83)[_0x48a1('0x22')](function(_0x26e849){if(_0x26e849[_0x48a1('0x1d')]===_0x48a1('0x24')){_0x26e849[_0x48a1('0x74')]=_0x5a8693[_0x48a1('0x26')]['settingsEnabled'];delete _0x26e849[_0x48a1('0x75')];}return _0x26e849;});})[_0x48a1('0x22')](function(_0x314113){return db[_0x48a1('0x30')][_0x48a1('0x71')](_0x314113,{'include':[{'model':db['VoiceMail'],'as':_0x48a1('0x66')}]});})['then'](function(_0x8b10a0){if(_0x5a8693[_0x48a1('0x51')]['role']===_0x48a1('0x26'))return _0x8b10a0;if(_0x5a8693[_0x48a1('0x26')][_0x48a1('0x1d')]!==_0x48a1('0x26'))return _0x8b10a0;return db[_0x48a1('0x76')][_0x48a1('0x2c')]({'where':{'name':_0x8b10a0[_0x48a1('0x1d')]===_0x48a1('0x1e')?_0x48a1('0x77'):_0x48a1('0x78'),'userProfileId':_0x5a8693[_0x48a1('0x26')]['userProfileId']},'raw':!![]})[_0x48a1('0x22')](function(_0x756ccf){if(!_0x756ccf||_0x756ccf[_0x48a1('0x79')]!=0x0)return _0x8b10a0;return db[_0x48a1('0x2d')][_0x48a1('0x71')]({'name':_0x8b10a0[_0x48a1('0x2f')],'resourceId':_0x8b10a0['id'],'type':_0x756ccf[_0x48a1('0x2f')],'sectionId':_0x756ccf['id']},{})['then'](function(){return _0x8b10a0;});})[_0x48a1('0x52')](function(_0x2bfe46){logger[_0x48a1('0x7a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bfe46);throw _0x2bfe46;});})['then'](respondWithResult(_0x9cddf7,0xc9))[_0x48a1('0x52')](handleError(_0x9cddf7,null));};exports[_0x48a1('0x7b')]=function(_0x38662d,_0x101730){var _0x367e71=_0x38662d[_0x48a1('0x51')];var _0x113f10=[];if(_0x38662d['user']['role']===_0x48a1('0x1e'))throw new Error(_0x48a1('0x72'));if(_['some'](_0x367e71,[_0x48a1('0x1d'),_0x48a1('0x26')])&&_0x38662d['user'][_0x48a1('0x1d')]!==_0x48a1('0x24')){throw new Error(_0x48a1('0x7c'));}if(_[_0x48a1('0x7d')](_0x367e71,[_0x48a1('0x1d'),_0x48a1('0x24')])&&_0x38662d[_0x48a1('0x26')][_0x48a1('0x1d')]!==_0x48a1('0x24')){throw new Error(_0x48a1('0x7e'));}return licenseUtil[_0x48a1('0x73')](_0x367e71)[_0x48a1('0x22')](function(){return validateUser(_0x367e71[0x0]);})[_0x48a1('0x22')](function(){for(var _0x10e46c=0x1;_0x10e46c<_0x367e71['length'];_0x10e46c++){var _0x1fe430=_0x367e71[_0x10e46c-0x1][_0x48a1('0x57')];if(!_0x367e71[_0x10e46c][_0x48a1('0x57')])_0x367e71[_0x10e46c][_0x48a1('0x57')]=_0x1fe430+0x1;_0x113f10[_0x48a1('0x45')](validateUser(_0x367e71[_0x10e46c]));}return Promise[_0x48a1('0x4c')](_0x113f10);})['then'](function(){_0x113f10=[];for(var _0x1be79f=0x0;_0x1be79f<_0x367e71[_0x48a1('0x44')];_0x1be79f++){_0x113f10[_0x48a1('0x45')](updateUser(_0x367e71[_0x1be79f]));}return Promise[_0x48a1('0x4c')](_0x113f10);})[_0x48a1('0x22')](function(){_0x113f10=_0x367e71[_0x48a1('0x29')](function(_0x338a9c){return db[_0x48a1('0x30')][_0x48a1('0x71')](_0x338a9c,{'include':[{'model':db[_0x48a1('0x66')],'as':'VoiceMail'}]})[_0x48a1('0x22')](function(_0x132205){_0x338a9c['id']=_0x132205['id'];return _0x338a9c;});});return Promise[_0x48a1('0x4c')](_0x113f10);})[_0x48a1('0x22')](function(_0x4bc8cc){if(_0x38662d[_0x48a1('0x51')][_0x48a1('0x1d')]===_0x48a1('0x26'))return _0x4bc8cc;if(_0x38662d[_0x48a1('0x26')][_0x48a1('0x1d')]!==_0x48a1('0x26'))return _0x4bc8cc;var _0xc0a36e=_['some'](_0x4bc8cc,function(_0x311f7f){return _0x311f7f[_0x48a1('0x1d')]===_0x48a1('0x1e')||_0x311f7f['role']===_0x48a1('0x7f');});if(!_0xc0a36e)return _0x4bc8cc;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x48a1('0x77'),_0x48a1('0x78')]},'userProfileId':_0x38662d[_0x48a1('0x26')][_0x48a1('0x75')]},'raw':!![]})['then'](function(_0x1c07ef){if(_[_0x48a1('0x80')](_0x1c07ef)||!_[_0x48a1('0x7d')](_0x1c07ef,['autoAssociation',0x0]))return _0x4bc8cc;_0x113f10=[];var _0x355945=_(_0x1c07ef)[_0x48a1('0x29')](function(_0xf3ed88){if(_0xf3ed88['autoAssociation']===0x1)return;return _0xf3ed88[_0x48a1('0x2f')]===_0x48a1('0x77')?_0x48a1('0x1e'):_0x48a1('0x7f');})['compact']()[_0x48a1('0x2a')]();for(var _0xb0ee80=0x0;_0xb0ee80<_0x4bc8cc[_0x48a1('0x44')];_0xb0ee80++){if(!_['includes'](_0x355945,_0x4bc8cc[_0xb0ee80][_0x48a1('0x1d')]))return;var _0x31b199=_0x4bc8cc[_0xb0ee80][_0x48a1('0x1d')]===_0x48a1('0x1e')?_0x48a1('0x77'):_0x48a1('0x78');_0x113f10[_0x48a1('0x45')](db[_0x48a1('0x2d')][_0x48a1('0x71')]({'name':_0x4bc8cc[_0xb0ee80]['name'],'resourceId':_0x4bc8cc[_0xb0ee80]['id'],'type':_0x31b199,'sectionId':_['find'](_0x1c07ef,['name',_0x31b199])['id']},{}));}return Promise[_0x48a1('0x4c')](_0x113f10);});})[_0x48a1('0x22')](respondWithResult(_0x101730,0xc9))['catch'](handleError(_0x101730,null));};exports[_0x48a1('0x81')]=function(_0x3ead01,_0xd5d0df){if(_0x3ead01[_0x48a1('0x51')]['id']){delete _0x3ead01[_0x48a1('0x51')]['id'];}return db[_0x48a1('0x30')][_0x48a1('0x2c')]({'where':{'id':_0x3ead01['params']['id']}})[_0x48a1('0x22')](function(_0x2d7833){if(!_0x2d7833)return null;if(_0x2d7833['id']===_0x3ead01[_0x48a1('0x26')]['id']){if(!_0x3ead01[_0x48a1('0x51')]['oldPassword']||!_0x3ead01['body'][_0x48a1('0x82')]){throw new db[(_0x48a1('0x83'))][(_0x48a1('0x84'))](_0x48a1('0x85'));}if(!_0x2d7833[_0x48a1('0x86')](_0x3ead01[_0x48a1('0x51')][_0x48a1('0x87')])){throw new db[(_0x48a1('0x83'))][(_0x48a1('0x84'))]('Wrong\x20credentials');}if(_0x3ead01['body'][_0x48a1('0x87')]===_0x3ead01[_0x48a1('0x51')][_0x48a1('0x82')]){throw new db['Sequelize']['ValidationError'](_0x48a1('0x88'));}}else if(_0x3ead01['user'][_0x48a1('0x1d')]===_0x48a1('0x24')){if(!_0x3ead01[_0x48a1('0x51')][_0x48a1('0x82')]){throw new db[(_0x48a1('0x83'))][(_0x48a1('0x84'))](_0x48a1('0x89'));}}else if(_0x3ead01['user']['role']===_0x48a1('0x26')){if(!_0x3ead01['body'][_0x48a1('0x82')]){throw new db[(_0x48a1('0x83'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x2d7833[_0x48a1('0x1d')]!==_0x48a1('0x1e')){throw new db['Sequelize'][(_0x48a1('0x84'))](_0x48a1('0x72'));}}else{throw new db[(_0x48a1('0x83'))]['ValidationError'](_0x48a1('0x72'));}return _0x2d7833;})['then'](handleEntityNotFound(_0xd5d0df,null))['then'](function(_0x25aa7c){return db[_0x48a1('0x58')][_0x48a1('0x8a')]({'attributes':['id',_0x48a1('0x5a'),_0x48a1('0x8b'),'passwordHistoryLimit']})['then'](function(_0x45e4f3){if(_0x45e4f3[_0x48a1('0x5a')])authService[_0x48a1('0x5b')](_0x3ead01[_0x48a1('0x51')][_0x48a1('0x82')]);if(!_0x45e4f3[_0x48a1('0x8b')]||!_0x25aa7c[_0x48a1('0x37')])return _0x25aa7c;authService[_0x48a1('0x8c')](_0x3ead01[_0x48a1('0x51')][_0x48a1('0x82')],_0x25aa7c[_0x48a1('0x37')],_0x45e4f3[_0x48a1('0x8d')]);return _0x25aa7c;})[_0x48a1('0x22')](saveUpdates({'password':_0x3ead01['body'][_0x48a1('0x82')],'passwordResetAt':_0x3ead01[_0x48a1('0x26')]['id']==_0x3ead01[_0x48a1('0x4d')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x3ead01[_0x48a1('0x51')][_0x48a1('0x82')],_0x25aa7c[_0x48a1('0x37')])},null));})[_0x48a1('0x22')](respondWithResult(_0xd5d0df,null))[_0x48a1('0x52')](handleError(_0xd5d0df,null));};exports[_0x48a1('0x8e')]=function(_0x5e7c1f,_0x4f7b99){var _0x3496b3=_0x5e7c1f[_0x48a1('0x51')]['channel'];return db['User'][_0x48a1('0x2c')]({'where':{'id':_0x5e7c1f['params']['id']},'attributes':['id','name',_0x48a1('0x1d'),_0x48a1('0x8f'),_0x48a1('0x90'),'voicePause',_0x48a1('0x91')]})[_0x48a1('0x22')](handleEntityNotFound(_0x4f7b99,null))['then'](function(_0x39234b){if(_0x39234b){if(!utils[_0x48a1('0x92')](_0x3496b3)){throw new db[(_0x48a1('0x83'))]['ValidationError']('Unknown\x20channel');}return _0x39234b[_0x48a1('0x93')+_[_0x48a1('0x94')](_0x3496b3[_0x48a1('0x95')]())+'Queues'](_0x5e7c1f[_0x48a1('0x51')][_0x48a1('0x56')],{'penalty':_0x5e7c1f[_0x48a1('0x51')][_0x48a1('0x96')]||0x0})[_0x48a1('0x97')](function(_0x2fbb43){for(var _0x4d59ba=0x0;_0x4d59ba<_0x5e7c1f['body'][_0x48a1('0x56')][_0x48a1('0x44')];_0x4d59ba+=0x1){var _0x2f6d0f={'UserId':Number(_0x5e7c1f[_0x48a1('0x4d')]['id'])};_0x2f6d0f[_[_0x48a1('0x94')](_0x3496b3[_0x48a1('0x95')]())+'QueueId']=Number(_0x5e7c1f['body']['ids'][_0x4d59ba]);socket['emit'](_0x48a1('0x26')+_[_0x48a1('0x94')](_0x3496b3[_0x48a1('0x95')]())+_0x48a1('0x98'),_0x2f6d0f);}return _0x2fbb43;})[_0x48a1('0x22')](function(){if(_0x3496b3===_0x48a1('0x99')){return db[_0x48a1('0x9a')][_0x48a1('0x41')]({'where':{'id':_0x5e7c1f['body'][_0x48a1('0x56')]||[]},'raw':!![],'attributes':['id',_0x48a1('0x2f')]});}})[_0x48a1('0x22')](function(_0x3f8dcf){var _0x13608e=_0x39234b[_0x48a1('0x23')]({'plain':!![]});var _0x2eef2a=[];if(_0x3496b3===_0x48a1('0x99')&&_0x13608e[_0x48a1('0x1d')]===_0x48a1('0x1e')&&_0x13608e[_0x48a1('0x8f')]){for(let _0x436489=0x0;_0x436489<_0x3f8dcf[_0x48a1('0x44')];_0x436489+=0x1){_0x2eef2a[_0x48a1('0x45')]({'membername':_0x13608e[_0x48a1('0x2f')],'UserId':_0x13608e['id'],'queue_name':_0x3f8dcf[_0x436489]['name'],'VoiceQueueId':_0x3f8dcf[_0x436489]['id'],'interface':_['isNil'](_0x13608e[_0x48a1('0x91')])?util[_0x48a1('0x9b')](_0x48a1('0x9c'),_0x13608e[_0x48a1('0x2f')]):_0x13608e[_0x48a1('0x91')],'paused':_0x13608e[_0x48a1('0x9d')]||![],'penalty':_0x5e7c1f['body'][_0x48a1('0x96')]||0x0});}return Promise[_0x48a1('0x4c')](_0x2eef2a[_0x48a1('0x29')](function(_0x1564ed){return db[_0x48a1('0x9e')][_0x48a1('0x9f')](_0x1564ed);}));}return _0x39234b;});}})['then'](respondWithStatusCode(_0x4f7b99,null))['catch'](handleError(_0x4f7b99,null));};exports[_0x48a1('0xa0')]=function(_0x2ebfe6,_0x407caa){var _0x5da98e,_0x312db3;return db['User']['find']({'where':{'id':_0x2ebfe6[_0x48a1('0x4d')]['id']},'attributes':['id',_0x48a1('0x2f'),_0x48a1('0x1d')]})[_0x48a1('0x22')](handleEntityNotFound(_0x407caa,null))[_0x48a1('0x22')](function(_0x538c49){if(_0x538c49){_0x5da98e=_0x538c49;if(!_0x2ebfe6[_0x48a1('0x3d')]['channel']||!utils['isValidChannel'](_0x2ebfe6['query'][_0x48a1('0xa1')])){throw new db['Sequelize'][(_0x48a1('0x84'))](_0x48a1('0xa2'));}return _0x538c49[_0x48a1('0xa3')+_['capitalize'](_0x2ebfe6[_0x48a1('0x3d')]['channel'][_0x48a1('0x95')]())+_0x48a1('0xa4')](_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0x56')]);}})[_0x48a1('0x22')](function(_0x4b04c0){if(_[_0x48a1('0xa5')](_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0x56')])){for(var _0x298f74=0x0;_0x298f74<_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0x56')]['length'];_0x298f74+=0x1){_0x312db3={'UserId':Number(_0x2ebfe6['params']['id'])};_0x312db3[_['capitalize'](_0x2ebfe6[_0x48a1('0x3d')]['channel'][_0x48a1('0x95')]())+'QueueId']=Number(_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0x56')][_0x298f74]);socket['emit'](_0x48a1('0x26')+_[_0x48a1('0x94')](_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0xa1')][_0x48a1('0x95')]())+_0x48a1('0xa6'),_0x312db3);}}else{_0x312db3={'UserId':Number(_0x2ebfe6['params']['id'])};_0x312db3[_['capitalize'](_0x2ebfe6[_0x48a1('0x3d')]['channel']['toLowerCase']())+_0x48a1('0xa7')]=Number(_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0x56')]);socket['emit'](_0x48a1('0x26')+_['capitalize'](_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0xa1')][_0x48a1('0x95')]())+_0x48a1('0xa6'),_0x312db3);}return _0x4b04c0;})[_0x48a1('0x22')](function(){if(_0x2ebfe6[_0x48a1('0x3d')][_0x48a1('0xa1')]===_0x48a1('0x99')){return db[_0x48a1('0x9e')]['destroy']({'where':{'UserId':_0x2ebfe6['params']['id'],'VoiceQueueId':_0x2ebfe6['query'][_0x48a1('0x56')]},'individualHooks':!![]})[_0x48a1('0x22')](function(){return _0x5da98e;});}return _0x5da98e;})[_0x48a1('0x22')](respondWithStatusCode(_0x407caa,null))['catch'](handleError(_0x407caa,null));};exports[_0x48a1('0xa8')]=function(_0x81474b,_0x6af07b){_0x81474b[_0x48a1('0x51')][_0x48a1('0xa9')]=_0x81474b[_0x48a1('0xaa')][_0x48a1('0xab')];return db[_0x48a1('0x30')]['find']({'where':{'id':_0x81474b['params']['id']}})['then'](handleEntityNotFound(_0x6af07b,null))[_0x48a1('0x22')](saveUpdates(_0x81474b[_0x48a1('0x51')],null))['then'](respondWithResult(_0x6af07b,null))['catch'](handleError(_0x6af07b,null));};exports[_0x48a1('0xac')]=function(_0x547e32,_0x4a5f80){var _0x4bb2bc=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x48a1('0x30')][_0x48a1('0x2c')]({'where':{'id':_0x547e32[_0x48a1('0x4d')]['id']},'attributes':['id',_0x48a1('0xa9')],'raw':!![]})[_0x48a1('0x22')](handleEntityNotFound(_0x4a5f80,null))[_0x48a1('0x22')](function(_0x457dbf){if(_0x457dbf){if(_[_0x48a1('0x5d')](_0x457dbf[_0x48a1('0xa9')])){return _0x4a5f80['download'](_0x4bb2bc);}else{if(!fs[_0x48a1('0xad')](path[_0x48a1('0xae')](config[_0x48a1('0xaf')],_0x48a1('0xb0'),_0x457dbf[_0x48a1('0xa9')]))){return _0x4a5f80[_0x48a1('0xb1')](_0x4bb2bc);}return _0x4a5f80[_0x48a1('0xb1')](path['join'](config['root'],'server/files/images/',_0x457dbf['userpic']));}}})[_0x48a1('0x52')](handleError(_0x4a5f80,null));};exports[_0x48a1('0xb2')]=function(_0x51389f,_0x294619){return db[_0x48a1('0x30')][_0x48a1('0x2c')]({'where':{'id':_0x51389f['params']['id']},'attributes':['id']})[_0x48a1('0x22')](handleEntityNotFound(_0x294619,null))[_0x48a1('0x22')](function(_0xb1db6c){var _0x54201=[];values=_0xb1db6c['dataValues'];_0x54201[_0x48a1('0x45')](get_open_tabs('chat',_0xb1db6c[_0x48a1('0x47')]));_0x54201[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x48'),_0xb1db6c['dataValues']));_0x54201[_0x48a1('0x45')](get_open_tabs('openchannel',_0xb1db6c[_0x48a1('0x47')]));_0x54201[_0x48a1('0x45')](get_open_tabs(_0x48a1('0x4b'),_0xb1db6c[_0x48a1('0x47')]));_0x54201['push'](get_open_tabs(_0x48a1('0xb3'),_0xb1db6c['dataValues']));_0x54201['push'](get_open_tabs(_0x48a1('0x49'),_0xb1db6c[_0x48a1('0x47')]));return Promise[_0x48a1('0x4c')](_0x54201);})[_0x48a1('0x22')](function(_0x108ba4){if(_0x108ba4){var _0x1c7f29=_[_0x48a1('0x29')](values[_0x48a1('0xb4')],function(_0x53513f){return{'channel':_0x48a1('0xb5'),'id':_0x53513f['id'],'createdAt':_0x53513f[_0x48a1('0xb6')]};});var _0x35f943=_[_0x48a1('0x29')](values[_0x48a1('0xb7')],function(_0x16027c){return{'channel':_0x48a1('0xb8'),'id':_0x16027c['id'],'createdAt':_0x16027c['createdAt']};});var _0x39b945=_[_0x48a1('0x29')](values[_0x48a1('0xb9')],function(_0x3158dd){return{'channel':_0x48a1('0xba'),'id':_0x3158dd['id'],'createdAt':_0x3158dd[_0x48a1('0xb6')]};});var _0x132a08=_[_0x48a1('0x29')](values[_0x48a1('0xbb')],function(_0x4ccf93){return{'channel':_0x48a1('0xbc'),'id':_0x4ccf93['id'],'createdAt':_0x4ccf93[_0x48a1('0xb6')]};});var _0xcb98ce=_[_0x48a1('0x29')](values['SmsOpenTabs'],function(_0x852787){return{'channel':_0x48a1('0xbd'),'id':_0x852787['id'],'createdAt':_0x852787['createdAt']};});var _0x57e90d=_[_0x48a1('0x29')](values[_0x48a1('0xbe')],function(_0x46744a){return{'channel':_0x48a1('0xbf'),'id':_0x46744a['id'],'createdAt':_0x46744a['createdAt']};});var _0x1a34c0=_[_0x48a1('0xc0')](_0x1c7f29,_0x35f943,_0x39b945,_0x132a08,_0xcb98ce,_0x57e90d);var _0x212c34={'count':_0x1a34c0[_0x48a1('0x44')],'rows':_0x1a34c0};return _0x212c34;}else return null;})['then'](respondWithResult(_0x294619,null))['catch'](handleError(_0x294619,null));};exports[_0x48a1('0xc1')]=function(_0x4b407e,_0x5d3f99){var _0x321218={};return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x4b407e[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](function(_0x111f23){if(!_0x111f23){throw new APINotFoundError(util[_0x48a1('0x9b')](_0x48a1('0xc2'),_0x4b407e[_0x48a1('0x4d')]['id']));}return contacts['describe']();})['then'](function(_0x118bf6){_0x4b407e['query']['User']=_0x4b407e['params']['id'];_0x321218=qs[_0x48a1('0x3b')](_0x118bf6,_0x4b407e);if(_0x4b407e[_0x48a1('0x3d')]['hasOwnProperty'](_0x48a1('0x3e'))){_0x321218[_0x48a1('0x40')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x48a1('0xc3')],'as':_0x48a1('0xc4'),'attributes':['id',_0x48a1('0x2f'),'color'],'where':_0x4b407e[_0x48a1('0x3d')][_0x48a1('0xc5')]?{'id':_0x4b407e['query'][_0x48a1('0xc5')]}:undefined,'required':_0x4b407e[_0x48a1('0x3d')][_0x48a1('0xc5')]?!![]:![]}];}return contacts[_0x48a1('0x41')](_0x4b407e[_0x48a1('0x3d')],_0x4b407e[_0x48a1('0x26')],_0x321218,_0x118bf6);})[_0x48a1('0x22')](respondWithFilteredResult(_0x5d3f99,_0x321218))[_0x48a1('0x52')](APIHandleError(_0x5d3f99));};exports[_0x48a1('0xc6')]=function(_0x5c55ef,_0xd48fdb){var _0x1db508;var _0x108aaa={};var _0xa508be;return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x5c55ef[_0x48a1('0x4d')]['id']},'attributes':['id',_0x48a1('0x2f'),_0x48a1('0x1d')]})[_0x48a1('0x22')](handleEntityNotFound(_0xd48fdb,null))['then'](function(_0x195a51){if(!utils['isValidChannel'](_0x5c55ef[_0x48a1('0x3d')]['channel'])){throw new db['Sequelize'][(_0x48a1('0x84'))](_0x48a1('0xa2'));}_0x1db508=_0x195a51;var _0x215c7c={};_0x215c7c['model']=_[_0x48a1('0xc7')](db[_[_0x48a1('0x94')](_0x5c55ef[_0x48a1('0x3d')]['channel'])+_0x48a1('0xc8')][_0x48a1('0x31')]);_0x215c7c[_0x48a1('0x3d')]=_[_0x48a1('0xc7')](_0x5c55ef[_0x48a1('0x3d')]);_0x215c7c['filters']=_[_0x48a1('0xc9')](_0x215c7c[_0x48a1('0xca')],_0x215c7c[_0x48a1('0x3d')]);_0x108aaa[_0x48a1('0x4f')]=_['intersection'](_0x215c7c[_0x48a1('0xca')],qs[_0x48a1('0xcb')](_0x5c55ef[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0x108aaa['attributes']=_0x108aaa[_0x48a1('0x4f')][_0x48a1('0x44')]?_0x108aaa[_0x48a1('0x4f')]:_0x215c7c[_0x48a1('0xca')];_0x108aaa[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x5c55ef['query'][_0x48a1('0xcd')]);_0x108aaa['where']=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x5c55ef[_0x48a1('0x3d')],_0x215c7c[_0x48a1('0xce')]));if(_0x5c55ef['query']['filter']){_0x108aaa['where']=_[_0x48a1('0x4e')](_0x108aaa[_0x48a1('0x3c')],{'$or':_[_0x48a1('0x29')](_0x108aaa[_0x48a1('0x4f')],function(_0x4aa7fa){var _0x2fce67={};_0x2fce67[_0x4aa7fa]={'$like':'%'+_0x5c55ef[_0x48a1('0x3d')]['filter']+'%'};return _0x2fce67;})});}_0x108aaa=_[_0x48a1('0x4e')]({},_0x108aaa,_0x5c55ef['options']);switch(_0x1db508[_0x48a1('0x1d')]){case _0x48a1('0x24'):return db[_[_0x48a1('0x94')](_0x5c55ef['query'][_0x48a1('0xa1')])+'Queue'][_0x48a1('0x41')](_0x108aaa);case _0x48a1('0x26'):case _0x48a1('0x1e'):return _0x1db508[_0x48a1('0x23')+_[_0x48a1('0x94')](_0x5c55ef[_0x48a1('0x3d')][_0x48a1('0xa1')])+_0x48a1('0xa4')](_0x108aaa);default:throw new db[(_0x48a1('0x83'))][(_0x48a1('0x84'))](_0x48a1('0xd0'));}})[_0x48a1('0x22')](function(_0x4487a5){_0xa508be=_0x4487a5[_0x48a1('0x44')];if(!_0x5c55ef[_0x48a1('0x3d')][_0x48a1('0xd1')]('nolimit')){_0x108aaa[_0x48a1('0x19')]=qs[_0x48a1('0x19')](_0x5c55ef[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x108aaa[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x5c55ef['query'][_0x48a1('0x17')]);}switch(_0x1db508[_0x48a1('0x1d')]){case'admin':return db[_[_0x48a1('0x94')](_0x5c55ef[_0x48a1('0x3d')][_0x48a1('0xa1')])+_0x48a1('0xc8')][_0x48a1('0x41')](_0x108aaa);case'user':case _0x48a1('0x1e'):return _0x1db508['get'+_['capitalize'](_0x5c55ef['query'][_0x48a1('0xa1')])+_0x48a1('0xa4')](_0x108aaa);}})[_0x48a1('0x22')](function(_0x13a569){return{'count':_0xa508be,'rows':_0x13a569};})[_0x48a1('0x22')](respondWithResult(_0xd48fdb,null))[_0x48a1('0x52')](handleError(_0xd48fdb,null));};exports['getVoiceQueuesRt']=function(_0xad12f4,_0x4637b1){var _0x2d6bb8={};var _0x664207={};var _0x1c6d0f;var _0x53af0f;return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0xad12f4[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x4637b1,null))[_0x48a1('0x22')](function(_0xe636b7){if(_0xe636b7){_0x1c6d0f=_0xe636b7;_0x664207[_0x48a1('0xca')]=_[_0x48a1('0xc7')](db[_0x48a1('0x9e')][_0x48a1('0x31')]);_0x664207['query']=_['keys'](_0xad12f4[_0x48a1('0x3d')]);_0x664207[_0x48a1('0xce')]=_[_0x48a1('0xc9')](_0x664207[_0x48a1('0xca')],_0x664207[_0x48a1('0x3d')]);_0x2d6bb8[_0x48a1('0x4f')]=_[_0x48a1('0xc9')](_0x664207['model'],qs['fields'](_0xad12f4['query'][_0x48a1('0xcb')]));_0x2d6bb8[_0x48a1('0x4f')]=_0x2d6bb8[_0x48a1('0x4f')]['length']?_0x2d6bb8['attributes']:_0x664207[_0x48a1('0xca')];_0x2d6bb8[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0xad12f4['query'][_0x48a1('0xcd')]);_0x2d6bb8[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0xad12f4['query'],_0x664207[_0x48a1('0xce')]));if(_0xad12f4['query'][_0x48a1('0x27')]){_0x2d6bb8[_0x48a1('0x3c')]=_['merge'](_0x2d6bb8[_0x48a1('0x3c')],{'$or':_['map'](_0x2d6bb8[_0x48a1('0x4f')],function(_0x55506a){var _0x29e732={};_0x29e732[_0x55506a]={'$like':'%'+_0xad12f4[_0x48a1('0x3d')][_0x48a1('0x27')]+'%'};return _0x29e732;})});}_0x2d6bb8=_['merge']({},_0x2d6bb8,_0xad12f4[_0x48a1('0xd2')]);return _0x1c6d0f['getVoiceQueuesRt'](_0x2d6bb8);}})['then'](function(_0xaf28c3){if(_0xaf28c3){_0x53af0f=_0xaf28c3['length'];if(!_0xad12f4[_0x48a1('0x3d')][_0x48a1('0xd1')](_0x48a1('0xd3'))){_0x2d6bb8[_0x48a1('0x19')]=qs[_0x48a1('0x19')](_0xad12f4[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x2d6bb8[_0x48a1('0x17')]=qs['offset'](_0xad12f4['query'][_0x48a1('0x17')]);}return _0x1c6d0f['getVoiceQueuesRt'](_0x2d6bb8);}})['then'](function(_0x44a775){if(_0x44a775){return _0x44a775?{'count':_0x53af0f,'rows':_0x44a775}:null;}})['then'](respondWithResult(_0x4637b1,null))[_0x48a1('0x52')](handleError(_0x4637b1,null));};exports[_0x48a1('0xd4')]=function(_0x4bbaaf,_0x13e1a8){var _0x2d6c4a={};var _0x28c5c1={};var _0x5151e0;var _0x19587a;return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x4bbaaf[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x13e1a8,null))[_0x48a1('0x22')](function(_0x3f96ad){if(_0x3f96ad){_0x5151e0=_0x3f96ad;_0x28c5c1['model']=_[_0x48a1('0xc7')](db[_0x48a1('0xd5')][_0x48a1('0x31')]);_0x28c5c1['query']=_['keys'](_0x4bbaaf[_0x48a1('0x3d')]);_0x28c5c1['filters']=_[_0x48a1('0xc9')](_0x28c5c1[_0x48a1('0xca')],_0x28c5c1[_0x48a1('0x3d')]);_0x2d6c4a[_0x48a1('0x4f')]=_['intersection'](_0x28c5c1[_0x48a1('0xca')],qs[_0x48a1('0xcb')](_0x4bbaaf['query'][_0x48a1('0xcb')]));_0x2d6c4a[_0x48a1('0x4f')]=_0x2d6c4a[_0x48a1('0x4f')][_0x48a1('0x44')]?_0x2d6c4a[_0x48a1('0x4f')]:_0x28c5c1[_0x48a1('0xca')];_0x2d6c4a[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x4bbaaf[_0x48a1('0x3d')][_0x48a1('0xcd')]);_0x2d6c4a[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x4bbaaf[_0x48a1('0x3d')],_0x28c5c1[_0x48a1('0xce')]));if(_0x4bbaaf[_0x48a1('0x3d')][_0x48a1('0x27')]){_0x2d6c4a[_0x48a1('0x3c')]=_['merge'](_0x2d6c4a['where'],{'$or':_[_0x48a1('0x29')](_0x2d6c4a[_0x48a1('0x4f')],function(_0x3a7784){var _0x2b7b31={};_0x2b7b31[_0x3a7784]={'$like':'%'+_0x4bbaaf['query'][_0x48a1('0x27')]+'%'};return _0x2b7b31;})});}_0x2d6c4a=_[_0x48a1('0x4e')]({},_0x2d6c4a,_0x4bbaaf['options']);return _0x5151e0[_0x48a1('0xd4')](_0x2d6c4a);}})[_0x48a1('0x22')](function(_0x41aa8c){if(_0x41aa8c){_0x19587a=_0x41aa8c[_0x48a1('0x44')];if(!_0x4bbaaf[_0x48a1('0x3d')][_0x48a1('0xd1')](_0x48a1('0xd3'))){_0x2d6c4a[_0x48a1('0x19')]=qs[_0x48a1('0x19')](_0x4bbaaf[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x2d6c4a[_0x48a1('0x17')]=qs['offset'](_0x4bbaaf[_0x48a1('0x3d')]['offset']);}return _0x5151e0['getGroups'](_0x2d6c4a);}})[_0x48a1('0x22')](function(_0x2bb788){if(_0x2bb788){return _0x2bb788?{'count':_0x19587a,'rows':_0x2bb788}:null;}})[_0x48a1('0x22')](respondWithResult(_0x13e1a8,null))['catch'](handleError(_0x13e1a8,null));};exports['getRecordings']=function(_0x207d74,_0x6e9403){var _0x43b9d0={'raw':!![],'where':{}};var _0x33d97b={};var _0x210a93={'count':0x0,'rows':[]};return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x207d74[_0x48a1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x6e9403,null))[_0x48a1('0x22')](function(_0x54fe13){if(_0x54fe13){_0x33d97b['model']=_['keys'](db[_0x48a1('0xd6')][_0x48a1('0x31')]);_0x33d97b[_0x48a1('0x3d')]=_[_0x48a1('0xc7')](_0x207d74[_0x48a1('0x3d')]);_0x33d97b[_0x48a1('0xce')]=_[_0x48a1('0xc9')](_0x33d97b[_0x48a1('0xca')],_0x33d97b[_0x48a1('0x3d')]);_0x43b9d0[_0x48a1('0x4f')]=_['intersection'](_0x33d97b['model'],qs[_0x48a1('0xcb')](_0x207d74[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0x43b9d0[_0x48a1('0x4f')]=_0x43b9d0['attributes']['length']?_0x43b9d0['attributes']:_0x33d97b['model'];if(!_0x207d74[_0x48a1('0x3d')][_0x48a1('0xd1')](_0x48a1('0xd3'))){_0x43b9d0[_0x48a1('0x19')]=qs[_0x48a1('0x19')](_0x207d74[_0x48a1('0x3d')]['limit']);_0x43b9d0[_0x48a1('0x17')]=qs['offset'](_0x207d74[_0x48a1('0x3d')]['offset']);}_0x43b9d0[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x207d74[_0x48a1('0x3d')]['sort']);_0x43b9d0['where']=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x207d74['query'],_0x33d97b[_0x48a1('0xce')]));_0x43b9d0[_0x48a1('0x3c')][_0x48a1('0xd7')]=_0x54fe13['id'];if(_0x207d74[_0x48a1('0x3d')][_0x48a1('0x27')]){_0x43b9d0['where']=_[_0x48a1('0x4e')](_0x43b9d0['where'],{'$or':_[_0x48a1('0x29')](_0x43b9d0[_0x48a1('0x4f')],function(_0x24b09e){var _0x4a4d5e={};_0x4a4d5e[_0x24b09e]={'$like':'%'+_0x207d74[_0x48a1('0x3d')][_0x48a1('0x27')]+'%'};return _0x4a4d5e;})});}_0x43b9d0=_[_0x48a1('0x4e')]({},_0x43b9d0,_0x207d74[_0x48a1('0xd2')]);return db['VoiceRecording'][_0x48a1('0x18')]({'where':_0x43b9d0[_0x48a1('0x3c')]})[_0x48a1('0x22')](function(_0x46606b){_0x210a93[_0x48a1('0x18')]=_0x46606b;if(_0x207d74[_0x48a1('0x3d')][_0x48a1('0x3e')]){_0x43b9d0[_0x48a1('0x40')]=[{'all':!![]}];}return db[_0x48a1('0xd6')][_0x48a1('0x41')](_0x43b9d0);})[_0x48a1('0x22')](function(_0x270aa6){_0x210a93[_0x48a1('0x42')]=_0x270aa6;return _0x210a93;});}})[_0x48a1('0x22')](respondWithFilteredResult(_0x6e9403,_0x43b9d0))[_0x48a1('0x52')](handleError(_0x6e9403,null));};exports[_0x48a1('0xd8')]=function(_0x5b2b6b,_0x2c80e1){var _0x180e76={'raw':!![],'where':{}};var _0x22d08e={};var _0x3b56aa={'count':0x0,'rows':[]};return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x5b2b6b[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x2c80e1,null))[_0x48a1('0x22')](function(_0x25b99e){if(_0x25b99e){_0x22d08e['model']=_[_0x48a1('0xc7')](db[_0x48a1('0xd9')][_0x48a1('0x31')]);_0x22d08e[_0x48a1('0x3d')]=_[_0x48a1('0xc7')](_0x5b2b6b[_0x48a1('0x3d')]);_0x22d08e['filters']=_['intersection'](_0x22d08e[_0x48a1('0xca')],_0x22d08e[_0x48a1('0x3d')]);_0x180e76[_0x48a1('0x4f')]=_[_0x48a1('0xc9')](_0x22d08e[_0x48a1('0xca')],qs['fields'](_0x5b2b6b[_0x48a1('0x3d')]['fields']));_0x180e76[_0x48a1('0x4f')]=_0x180e76[_0x48a1('0x4f')]['length']?_0x180e76[_0x48a1('0x4f')]:_0x22d08e[_0x48a1('0xca')];if(!_0x5b2b6b[_0x48a1('0x3d')][_0x48a1('0xd1')]('nolimit')){_0x180e76[_0x48a1('0x19')]=qs['limit'](_0x5b2b6b[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x180e76[_0x48a1('0x17')]=qs['offset'](_0x5b2b6b['query'][_0x48a1('0x17')]);}_0x180e76[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x5b2b6b['query']['sort']);_0x180e76[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_['pick'](_0x5b2b6b[_0x48a1('0x3d')],_0x22d08e['filters']));_0x180e76[_0x48a1('0x3c')]['UserId']=_0x25b99e['id'];if(_0x5b2b6b[_0x48a1('0x3d')][_0x48a1('0x27')]){_0x180e76['where']=_[_0x48a1('0x4e')](_0x180e76[_0x48a1('0x3c')],{'$or':_[_0x48a1('0x29')](_0x180e76[_0x48a1('0x4f')],function(_0x11ac16){var _0x41496d={};_0x41496d[_0x11ac16]={'$like':'%'+_0x5b2b6b['query']['filter']+'%'};return _0x41496d;})});}_0x180e76=_['merge']({},_0x180e76,_0x5b2b6b[_0x48a1('0xd2')]);return db['ScreenRecording'][_0x48a1('0x18')]({'where':_0x180e76[_0x48a1('0x3c')]})['then'](function(_0x6ced92){_0x3b56aa[_0x48a1('0x18')]=_0x6ced92;if(_0x5b2b6b['query'][_0x48a1('0x3e')]){_0x180e76[_0x48a1('0x40')]=[{'all':!![]}];}return db[_0x48a1('0xd9')][_0x48a1('0x41')](_0x180e76);})['then'](function(_0x35ee25){_0x3b56aa[_0x48a1('0x42')]=_0x35ee25;return _0x3b56aa;});}})[_0x48a1('0x22')](respondWithFilteredResult(_0x2c80e1,_0x180e76))[_0x48a1('0x52')](handleError(_0x2c80e1,null));};exports['getChatInteractions']=function(_0x593d2b,_0x1136c7){var _0xcab537={};var _0x158e53={};var _0x653d4c;var _0x3e24b6;return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x593d2b['params']['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x1136c7,null))[_0x48a1('0x22')](function(_0x325205){if(_0x325205){_0x653d4c=_0x325205;_0x158e53[_0x48a1('0xca')]=_['keys'](db['ChatInteraction'][_0x48a1('0x31')]);_0x158e53['query']=_[_0x48a1('0xc7')](_0x593d2b['query']);_0x158e53['filters']=_['intersection'](_0x158e53[_0x48a1('0xca')],_0x158e53['query']);_0xcab537[_0x48a1('0x4f')]=_['intersection'](_0x158e53[_0x48a1('0xca')],qs[_0x48a1('0xcb')](_0x593d2b[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0xcab537[_0x48a1('0x4f')]=_0xcab537['attributes'][_0x48a1('0x44')]?_0xcab537[_0x48a1('0x4f')]:_0x158e53[_0x48a1('0xca')];_0xcab537['order']=qs[_0x48a1('0xcd')](_0x593d2b[_0x48a1('0x3d')]['sort']);_0xcab537[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x593d2b[_0x48a1('0x3d')],_0x158e53[_0x48a1('0xce')]));if(_0x593d2b[_0x48a1('0x3d')]['filter']){_0xcab537['where']=_[_0x48a1('0x4e')](_0xcab537[_0x48a1('0x3c')],{'$or':_[_0x48a1('0x29')](_0xcab537[_0x48a1('0x4f')],function(_0x219ee9){var _0x26a029={};_0x26a029[_0x219ee9]={'$like':'%'+_0x593d2b[_0x48a1('0x3d')][_0x48a1('0x27')]+'%'};return _0x26a029;})});}_0xcab537=_[_0x48a1('0x4e')]({},_0xcab537,_0x593d2b[_0x48a1('0xd2')]);return _0x653d4c[_0x48a1('0xda')](_0xcab537);}})[_0x48a1('0x22')](function(_0x220d75){if(_0x220d75){_0x3e24b6=_0x220d75[_0x48a1('0x44')];if(!_0x593d2b[_0x48a1('0x3d')][_0x48a1('0xd1')](_0x48a1('0xd3'))){_0xcab537[_0x48a1('0x19')]=qs['limit'](_0x593d2b[_0x48a1('0x3d')][_0x48a1('0x19')]);_0xcab537[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x593d2b[_0x48a1('0x3d')]['offset']);}return _0x653d4c[_0x48a1('0xda')](_0xcab537);}})[_0x48a1('0x22')](function(_0x5d5404){if(_0x5d5404){return _0x5d5404?{'count':_0x3e24b6,'rows':_0x5d5404}:null;}})[_0x48a1('0x22')](respondWithResult(_0x1136c7,null))[_0x48a1('0x52')](handleError(_0x1136c7,null));};exports[_0x48a1('0xdb')]=function(_0x13536e,_0x1a7b5b){var _0x6d5090={};var _0x2e32f0={};var _0x40e3c7;var _0x5a851c;return db[_0x48a1('0x30')]['findOne']({'where':{'id':_0x13536e[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x1a7b5b,null))[_0x48a1('0x22')](function(_0xfee1bc){if(_0xfee1bc){_0x40e3c7=_0xfee1bc;_0x2e32f0[_0x48a1('0xca')]=_[_0x48a1('0xc7')](db[_0x48a1('0xdc')]['rawAttributes']);_0x2e32f0[_0x48a1('0x3d')]=_['keys'](_0x13536e[_0x48a1('0x3d')]);_0x2e32f0['filters']=_[_0x48a1('0xc9')](_0x2e32f0[_0x48a1('0xca')],_0x2e32f0[_0x48a1('0x3d')]);_0x6d5090[_0x48a1('0x4f')]=_['intersection'](_0x2e32f0[_0x48a1('0xca')],qs[_0x48a1('0xcb')](_0x13536e[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0x6d5090[_0x48a1('0x4f')]=_0x6d5090[_0x48a1('0x4f')][_0x48a1('0x44')]?_0x6d5090['attributes']:_0x2e32f0[_0x48a1('0xca')];_0x6d5090[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x13536e[_0x48a1('0x3d')][_0x48a1('0xcd')]);_0x6d5090['where']=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x13536e[_0x48a1('0x3d')],_0x2e32f0['filters']));if(_0x13536e[_0x48a1('0x3d')]['filter']){_0x6d5090['where']=_[_0x48a1('0x4e')](_0x6d5090['where'],{'$or':_[_0x48a1('0x29')](_0x6d5090[_0x48a1('0x4f')],function(_0x3c5681){var _0x549e0a={};_0x549e0a[_0x3c5681]={'$like':'%'+_0x13536e[_0x48a1('0x3d')][_0x48a1('0x27')]+'%'};return _0x549e0a;})});}_0x6d5090=_['merge']({},_0x6d5090,_0x13536e[_0x48a1('0xd2')]);return _0x40e3c7[_0x48a1('0xdb')](_0x6d5090);}})[_0x48a1('0x22')](function(_0x4290c0){if(_0x4290c0){_0x5a851c=_0x4290c0[_0x48a1('0x44')];if(!_0x13536e['query'][_0x48a1('0xd1')]('nolimit')){_0x6d5090['limit']=qs[_0x48a1('0x19')](_0x13536e[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x6d5090[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x13536e[_0x48a1('0x3d')][_0x48a1('0x17')]);}return _0x40e3c7[_0x48a1('0xdb')](_0x6d5090);}})[_0x48a1('0x22')](function(_0x5c04eb){if(_0x5c04eb){return _0x5c04eb?{'count':_0x5a851c,'rows':_0x5c04eb}:null;}})[_0x48a1('0x22')](respondWithResult(_0x1a7b5b,null))[_0x48a1('0x52')](handleError(_0x1a7b5b,null));};exports[_0x48a1('0xdd')]=function(_0x12319d,_0x5abd12){var _0x31e30c={'raw':!![],'where':{}};var _0x17d996={};var _0xed3cf8={'count':0x0,'rows':[]};return db['User'][_0x48a1('0x8a')]({'where':{'id':_0x12319d[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x5abd12,null))[_0x48a1('0x22')](function(_0xcb85f8){if(_0xcb85f8){_0x17d996['model']=_[_0x48a1('0xc7')](db['MailInteraction'][_0x48a1('0x31')]);_0x17d996[_0x48a1('0x3d')]=_[_0x48a1('0xc7')](_0x12319d[_0x48a1('0x3d')]);_0x17d996[_0x48a1('0xce')]=_['intersection'](_0x17d996[_0x48a1('0xca')],_0x17d996[_0x48a1('0x3d')]);_0x31e30c[_0x48a1('0x4f')]=_[_0x48a1('0xc9')](_0x17d996['model'],qs['fields'](_0x12319d[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0x31e30c['attributes']=_0x31e30c[_0x48a1('0x4f')][_0x48a1('0x44')]?_0x31e30c[_0x48a1('0x4f')]:_0x17d996[_0x48a1('0xca')];if(!_0x12319d[_0x48a1('0x3d')][_0x48a1('0xd1')](_0x48a1('0xd3'))){_0x31e30c[_0x48a1('0x19')]=qs[_0x48a1('0x19')](_0x12319d[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x31e30c[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x12319d['query'][_0x48a1('0x17')]);}_0x31e30c[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x12319d[_0x48a1('0x3d')][_0x48a1('0xcd')]);_0x31e30c[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x12319d[_0x48a1('0x3d')],_0x17d996['filters']));_0x31e30c[_0x48a1('0x3c')][_0x48a1('0xd7')]=_0xcb85f8['id'];if(_0x12319d['query']['filter']){_0x31e30c[_0x48a1('0x3c')]=_['merge'](_0x31e30c[_0x48a1('0x3c')],{'$or':_['map'](_0x31e30c['attributes'],function(_0x2e517e){var _0xfbca72={};_0xfbca72[_0x2e517e]={'$like':'%'+_0x12319d[_0x48a1('0x3d')][_0x48a1('0x27')]+'%'};return _0xfbca72;})});}_0x31e30c=_[_0x48a1('0x4e')]({},_0x31e30c,_0x12319d['options']);return db['MailInteraction']['count']({'where':_0x31e30c['where']})['then'](function(_0x47a1fd){_0xed3cf8['count']=_0x47a1fd;if(_0x12319d[_0x48a1('0x3d')][_0x48a1('0x3e')]){_0x31e30c[_0x48a1('0x40')]=[{'all':!![]}];}return db[_0x48a1('0xde')][_0x48a1('0x41')](_0x31e30c);})['then'](function(_0x5d7567){_0xed3cf8['rows']=_0x5d7567;return _0xed3cf8;});}})[_0x48a1('0x22')](respondWithFilteredResult(_0x5abd12,_0x31e30c))[_0x48a1('0x52')](handleError(_0x5abd12,null));};exports[_0x48a1('0xdf')]=function(_0x393c33,_0x685ae9){var _0x14416a={};var _0x47747a={};var _0x4003db;var _0x4302d4;return db['User'][_0x48a1('0x8a')]({'where':{'id':_0x393c33[_0x48a1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x685ae9,null))[_0x48a1('0x22')](function(_0x257090){if(_0x257090){_0x4003db=_0x257090;_0x47747a[_0x48a1('0xca')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x47747a[_0x48a1('0x3d')]=_[_0x48a1('0xc7')](_0x393c33[_0x48a1('0x3d')]);_0x47747a[_0x48a1('0xce')]=_[_0x48a1('0xc9')](_0x47747a['model'],_0x47747a[_0x48a1('0x3d')]);_0x14416a[_0x48a1('0x4f')]=_[_0x48a1('0xc9')](_0x47747a[_0x48a1('0xca')],qs[_0x48a1('0xcb')](_0x393c33[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0x14416a[_0x48a1('0x4f')]=_0x14416a[_0x48a1('0x4f')]['length']?_0x14416a[_0x48a1('0x4f')]:_0x47747a[_0x48a1('0xca')];_0x14416a[_0x48a1('0xcc')]=qs['sort'](_0x393c33['query'][_0x48a1('0xcd')]);_0x14416a[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x393c33[_0x48a1('0x3d')],_0x47747a[_0x48a1('0xce')]));if(_0x393c33['query'][_0x48a1('0x27')]){_0x14416a[_0x48a1('0x3c')]=_[_0x48a1('0x4e')](_0x14416a['where'],{'$or':_[_0x48a1('0x29')](_0x14416a[_0x48a1('0x4f')],function(_0x1a9356){var _0x1ffb50={};_0x1ffb50[_0x1a9356]={'$like':'%'+_0x393c33[_0x48a1('0x3d')][_0x48a1('0x27')]+'%'};return _0x1ffb50;})});}_0x14416a=_['merge']({},_0x14416a,_0x393c33[_0x48a1('0xd2')]);return _0x4003db[_0x48a1('0xdf')](_0x14416a);}})[_0x48a1('0x22')](function(_0xb1b3cd){if(_0xb1b3cd){_0x4302d4=_0xb1b3cd[_0x48a1('0x44')];if(!_0x393c33[_0x48a1('0x3d')]['hasOwnProperty'](_0x48a1('0xd3'))){_0x14416a[_0x48a1('0x19')]=qs[_0x48a1('0x19')](_0x393c33[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x14416a[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x393c33[_0x48a1('0x3d')][_0x48a1('0x17')]);}return _0x4003db[_0x48a1('0xdf')](_0x14416a);}})[_0x48a1('0x22')](function(_0x53e4e9){if(_0x53e4e9){return _0x53e4e9?{'count':_0x4302d4,'rows':_0x53e4e9}:null;}})[_0x48a1('0x22')](respondWithResult(_0x685ae9,null))[_0x48a1('0x52')](handleError(_0x685ae9,null));};exports[_0x48a1('0xe0')]=function(_0x54c967,_0x3d932f){var _0x5c80eb={};var _0x1381c={};var _0x5d50bd;var _0x34e07f;return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x54c967[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x3d932f,null))[_0x48a1('0x22')](function(_0x52ecca){if(_0x52ecca){_0x5d50bd=_0x52ecca;_0x1381c[_0x48a1('0xca')]=_['keys'](db['FaxInteraction'][_0x48a1('0x31')]);_0x1381c['query']=_[_0x48a1('0xc7')](_0x54c967[_0x48a1('0x3d')]);_0x1381c[_0x48a1('0xce')]=_[_0x48a1('0xc9')](_0x1381c['model'],_0x1381c[_0x48a1('0x3d')]);_0x5c80eb[_0x48a1('0x4f')]=_[_0x48a1('0xc9')](_0x1381c['model'],qs[_0x48a1('0xcb')](_0x54c967['query'][_0x48a1('0xcb')]));_0x5c80eb['attributes']=_0x5c80eb[_0x48a1('0x4f')][_0x48a1('0x44')]?_0x5c80eb['attributes']:_0x1381c[_0x48a1('0xca')];_0x5c80eb[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x54c967[_0x48a1('0x3d')][_0x48a1('0xcd')]);_0x5c80eb[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x54c967[_0x48a1('0x3d')],_0x1381c[_0x48a1('0xce')]));if(_0x54c967['query'][_0x48a1('0x27')]){_0x5c80eb['where']=_[_0x48a1('0x4e')](_0x5c80eb[_0x48a1('0x3c')],{'$or':_[_0x48a1('0x29')](_0x5c80eb[_0x48a1('0x4f')],function(_0x2e8cc8){var _0x30f08d={};_0x30f08d[_0x2e8cc8]={'$like':'%'+_0x54c967['query'][_0x48a1('0x27')]+'%'};return _0x30f08d;})});}_0x5c80eb=_[_0x48a1('0x4e')]({},_0x5c80eb,_0x54c967[_0x48a1('0xd2')]);return _0x5d50bd[_0x48a1('0xe0')](_0x5c80eb);}})[_0x48a1('0x22')](function(_0x58b492){if(_0x58b492){_0x34e07f=_0x58b492[_0x48a1('0x44')];if(!_0x54c967[_0x48a1('0x3d')][_0x48a1('0xd1')]('nolimit')){_0x5c80eb['limit']=qs[_0x48a1('0x19')](_0x54c967[_0x48a1('0x3d')][_0x48a1('0x19')]);_0x5c80eb[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x54c967[_0x48a1('0x3d')]['offset']);}return _0x5d50bd[_0x48a1('0xe0')](_0x5c80eb);}})[_0x48a1('0x22')](function(_0x2b523a){if(_0x2b523a){return _0x2b523a?{'count':_0x34e07f,'rows':_0x2b523a}:null;}})[_0x48a1('0x22')](respondWithResult(_0x3d932f,null))[_0x48a1('0x52')](handleError(_0x3d932f,null));};exports['getWhatsappInteractions']=function(_0x172c80,_0x3368d8){var _0xa02e30={};var _0x31f3cf={};var _0x3f8688;var _0x29173d;return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x172c80['params']['id']}})['then'](handleEntityNotFound(_0x3368d8,null))[_0x48a1('0x22')](function(_0x3f57bd){if(_0x3f57bd){_0x3f8688=_0x3f57bd;_0x31f3cf['model']=_[_0x48a1('0xc7')](db[_0x48a1('0xe1')]['rawAttributes']);_0x31f3cf[_0x48a1('0x3d')]=_['keys'](_0x172c80[_0x48a1('0x3d')]);_0x31f3cf[_0x48a1('0xce')]=_['intersection'](_0x31f3cf['model'],_0x31f3cf[_0x48a1('0x3d')]);_0xa02e30[_0x48a1('0x4f')]=_[_0x48a1('0xc9')](_0x31f3cf[_0x48a1('0xca')],qs['fields'](_0x172c80[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0xa02e30[_0x48a1('0x4f')]=_0xa02e30[_0x48a1('0x4f')][_0x48a1('0x44')]?_0xa02e30[_0x48a1('0x4f')]:_0x31f3cf[_0x48a1('0xca')];_0xa02e30['order']=qs[_0x48a1('0xcd')](_0x172c80[_0x48a1('0x3d')][_0x48a1('0xcd')]);_0xa02e30[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_['pick'](_0x172c80[_0x48a1('0x3d')],_0x31f3cf['filters']));if(_0x172c80['query'][_0x48a1('0x27')]){_0xa02e30[_0x48a1('0x3c')]=_[_0x48a1('0x4e')](_0xa02e30[_0x48a1('0x3c')],{'$or':_['map'](_0xa02e30[_0x48a1('0x4f')],function(_0x327e92){var _0xc7456f={};_0xc7456f[_0x327e92]={'$like':'%'+_0x172c80['query'][_0x48a1('0x27')]+'%'};return _0xc7456f;})});}_0xa02e30=_[_0x48a1('0x4e')]({},_0xa02e30,_0x172c80[_0x48a1('0xd2')]);return _0x3f8688[_0x48a1('0xe2')](_0xa02e30);}})[_0x48a1('0x22')](function(_0x17606b){if(_0x17606b){_0x29173d=_0x17606b['length'];if(!_0x172c80['query']['hasOwnProperty'](_0x48a1('0xd3'))){_0xa02e30[_0x48a1('0x19')]=qs['limit'](_0x172c80['query'][_0x48a1('0x19')]);_0xa02e30[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x172c80[_0x48a1('0x3d')][_0x48a1('0x17')]);}return _0x3f8688[_0x48a1('0xe2')](_0xa02e30);}})[_0x48a1('0x22')](function(_0x46f390){if(_0x46f390){return _0x46f390?{'count':_0x29173d,'rows':_0x46f390}:null;}})[_0x48a1('0x22')](respondWithResult(_0x3368d8,null))[_0x48a1('0x52')](handleError(_0x3368d8,null));};exports[_0x48a1('0xe3')]=function(_0x84907,_0x54c76d,_0x598db3){var _0x166367;var _0x16ffe7;var _0x383ead;var _0x489590=!_[_0x48a1('0x5d')](_0x84907['params']['id'])?_0x84907[_0x48a1('0x4d')]['id']:!_['isNil'](_0x84907['user']['id'])?_0x84907[_0x48a1('0x26')]['id']:null;return db[_0x48a1('0x30')][_0x48a1('0x2c')]({'where':{'id':_0x489590,'role':{'$or':[_0x48a1('0x24'),_0x48a1('0x26'),_0x48a1('0x1e')]}},'attributes':['id','name',_0x48a1('0xe4'),_0x48a1('0xe5'),_0x48a1('0x1d'),_0x48a1('0x57'),_0x48a1('0x90')]})['then'](function(_0x42a13a){if(_0x42a13a){if(_0x42a13a[_0x48a1('0x1d')]===_0x48a1('0x1e')){_0x166367=_0x42a13a;if(_0x84907[_0x48a1('0x51')][_0x48a1('0x91')]){_0x383ead=util[_0x48a1('0x9b')](_0x48a1('0xe6'),_0x166367[_0x84907[_0x48a1('0x51')][_0x48a1('0x91')]]);}else if(_0x84907[_0x48a1('0x51')][_0x48a1('0xe7')]){_0x383ead=util[_0x48a1('0x9b')](_0x48a1('0x9c'),_0x84907['body'][_0x48a1('0xe7')]);}else{_0x383ead=util[_0x48a1('0x9b')]('SIP/%s',_0x166367[_0x48a1('0x2f')]);}socket['to'](util[_0x48a1('0x9b')](_0x48a1('0xe8'),_0x166367['name']))[_0x48a1('0x1f')](_0x48a1('0xe9'),{'user':{'id':_0x166367['id'],'name':_0x166367[_0x48a1('0x2f')]},'ip':_0x84907['headers'][_0x48a1('0xea')]||_0x84907['connection'][_0x48a1('0xeb')]||_0x84907[_0x48a1('0xec')][_0x48a1('0xeb')]||_0x84907[_0x48a1('0xed')][_0x48a1('0xec')][_0x48a1('0xeb')]});return db[_0x48a1('0x9e')][_0x48a1('0x21')]({'where':{'membername':_0x166367['name']},'individualHooks':!![]});}}else{throw new db[(_0x48a1('0x83'))]['ValidationError'](_0x48a1('0xee'));}})[_0x48a1('0x22')](function(){if(_0x166367){return _0x166367[_0x48a1('0xef')]({'raw':!![]});}})[_0x48a1('0x22')](function(_0x4454b9){if(_0x166367){if(_0x4454b9){_0x16ffe7=_0x4454b9;if(_0x16ffe7['length']){var _0x222159=_0x16ffe7[_0x48a1('0x29')](function(_0x261c4d){var _0x2f28cf={'membername':_0x166367[_0x48a1('0x2f')],'UserId':_0x166367['id'],'queue_name':_0x261c4d[_0x48a1('0x2f')],'VoiceQueueId':_0x261c4d['id'],'interface':_0x383ead,'paused':_0x166367['loginInPause']||![],'penalty':_0x261c4d[_0x48a1('0xf0')]||0x0};return db['UserVoiceQueueRt'][_0x48a1('0x9f')](_0x2f28cf);});return Promise[_0x48a1('0x4c')](_0x222159);}}}})['then'](function(){if(_0x166367){return db[_0x48a1('0xf1')][_0x48a1('0x41')]({'where':{'membername':_0x166367[_0x48a1('0x2f')],'exitAt':null}});}})[_0x48a1('0x22')](function(_0xe9048a){if(_0x166367){var _0x333187=[];_0xe9048a['forEach'](function(_0x4eb229){_0x333187[_0x48a1('0x45')](_0x4eb229[_0x48a1('0x1c')]({'exitAt':moment()['format'](_0x48a1('0xf2'))}));});return Promise['all'](_0x333187);}})[_0x48a1('0x22')](function(){if(_0x166367){var _0x559113=[];var _0xa82745=[];var _0x589ab1=utils['getChannels']();var _0x84b66b={'membername':_0x166367[_0x48a1('0x2f')],'interface':_0x383ead,'enterAt':moment()[_0x48a1('0x9b')](_0x48a1('0xf2')),'role':_0x166367[_0x48a1('0x1d')],'internal':_0x166367['internal']};_0x589ab1['forEach'](function(_0x504fca){_0x559113['push'](_['merge']({'channel':_0x504fca,'type':_0x48a1('0xf3'),'data1':_0x84907[_0x48a1('0x51')][_0x48a1('0xf4')],'data2':_0x383ead},_0x84b66b));if(_0x166367[_0x48a1('0x90')]){_0xa82745['push'](_[_0x48a1('0x4e')]({'channel':_0x504fca,'type':_0x48a1('0xf5'),'data1':_0x48a1('0xf6')},_0x84b66b));}});return db[_0x48a1('0xf1')][_0x48a1('0x7b')](_0x559113[_0x48a1('0xc0')](_0xa82745),{'individualHooks':!![]});}})[_0x48a1('0x22')](function(){if(_0x166367){return _0x166367[_0x48a1('0x1c')]({'online':!![],'lastLoginAt':moment()[_0x48a1('0x9b')](_0x48a1('0xf2')),'voicePause':_0x166367[_0x48a1('0x90')]||![],'mailPause':_0x166367['loginInPause']||![],'chatPause':_0x166367[_0x48a1('0x90')]||![],'faxPause':_0x166367['loginInPause']||![],'smsPause':_0x166367[_0x48a1('0x90')]||![],'openchannelPause':_0x166367[_0x48a1('0x90')]||![],'whatsappPause':_0x166367[_0x48a1('0x90')]||![],'pauseType':_0x166367[_0x48a1('0x90')]?_0x48a1('0xf6'):null,'interface':_0x383ead,'lastPauseAt':moment()[_0x48a1('0x9b')](_0x48a1('0xf2'))});}})[_0x48a1('0x22')](function(_0x369d52){if(_0x84907[_0x48a1('0xf7')]){return _0x598db3();}else{return Promise[_0x48a1('0xf8')](_0x369d52)[_0x48a1('0x22')](respondWithResult(_0x54c76d,null));}})['catch'](handleError(_0x54c76d,null));};exports['logout']=function(_0x9765c4,_0x444886){var _0x2bbf75;return db[_0x48a1('0x30')][_0x48a1('0x2c')]({'where':{'id':_0x9765c4[_0x48a1('0x4d')]['id'],'role':_0x48a1('0x1e')},'attributes':['id',_0x48a1('0x2f'),_0x48a1('0x1d')]})[_0x48a1('0x22')](handleEntityNotFound(_0x444886,null))[_0x48a1('0x22')](function(_0x1e7f1b){if(_0x1e7f1b){_0x2bbf75=_0x1e7f1b;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2bbf75[_0x48a1('0x2f')]},'individualHooks':!![]});}})[_0x48a1('0x22')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x2bbf75[_0x48a1('0x2f')],'exitAt':null}});})['then'](function(_0x3f6a63){var _0x1a9d10=[];_0x3f6a63[_0x48a1('0xf9')](function(_0x5886ad){_0x1a9d10[_0x48a1('0x45')](_0x5886ad[_0x48a1('0x1c')]({'exitAt':moment()[_0x48a1('0x9b')](_0x48a1('0xf2'))}));});return Promise['all'](_0x1a9d10);})[_0x48a1('0x22')](function(){return _0x2bbf75['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x48a1('0x22')](respondWithResult(_0x444886,null))[_0x48a1('0x52')](handleError(_0x444886,null));};exports[_0x48a1('0xfa')]=function(_0x360e14,_0x14097b){var _0x45bd5b;return db[_0x48a1('0x9e')]['update']({'paused':0x1},{'where':{'UserId':_0x360e14['params']['id']},'individualHooks':!![]})[_0x48a1('0x22')](function(){return db[_0x48a1('0x30')][_0x48a1('0x2c')]({'where':{'id':_0x360e14['params']['id'],'role':_0x48a1('0x1e')},'attributes':['id',_0x48a1('0x2f'),_0x48a1('0x1d'),'internal',_0x48a1('0x91'),'online']});})[_0x48a1('0x22')](handleEntityNotFound(_0x14097b,null))[_0x48a1('0x22')](function(_0x4a6d77){if(_0x4a6d77){_0x45bd5b=_0x4a6d77;return db['MemberReport'][_0x48a1('0x41')]({'where':{'membername':_0x45bd5b[_0x48a1('0x2f')],'type':_0x48a1('0xf5'),'exitAt':null}});}})[_0x48a1('0x22')](function(_0x4b9bc3){if(_0x4b9bc3[_0x48a1('0x44')]){var _0x531da1=moment()[_0x48a1('0x9b')](_0x48a1('0xf2'));for(var _0x35aa90=0x0,_0x43ccf7=_0x4b9bc3[_0x48a1('0x44')];_0x35aa90<_0x43ccf7;_0x35aa90++){_0x4b9bc3[_0x35aa90][_0x48a1('0xfb')]({'exitAt':_0x531da1});}}})[_0x48a1('0x22')](function(){var _0x2b89a6=[];var _0x530b3e=utils[_0x48a1('0xfc')]();_0x530b3e[_0x48a1('0xf9')](function(_0x515c15){_0x2b89a6[_0x48a1('0x45')]({'channel':_0x515c15,'membername':_0x45bd5b[_0x48a1('0x2f')],'interface':_[_0x48a1('0x5d')](_0x45bd5b['interface'])?util['format'](_0x48a1('0x9c'),_0x45bd5b[_0x48a1('0x2f')]):_0x45bd5b[_0x48a1('0x91')],'type':'PAUSE','enterAt':moment()['format'](_0x48a1('0xf2')),'data1':_0x360e14['body'][_0x48a1('0x33')]||_0x48a1('0xfd'),'role':_0x45bd5b[_0x48a1('0x1d')],'internal':_0x45bd5b[_0x48a1('0x57')]});});return db[_0x48a1('0xf1')][_0x48a1('0x7b')](_0x2b89a6,{'individualHooks':!![]});})[_0x48a1('0x22')](function(){return _0x45bd5b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x360e14[_0x48a1('0x51')][_0x48a1('0x33')]||_0x48a1('0xfd'),'lastPauseAt':moment()[_0x48a1('0x9b')](_0x48a1('0xf2'))});})['then'](respondWithResult(_0x14097b,null))[_0x48a1('0x52')](handleError(_0x14097b,null));};exports[_0x48a1('0xfe')]=function(_0x5a06c4,_0x4bd1b9){if(_0x5a06c4[_0x48a1('0x51')][_0x48a1('0xa1')]&&!utils[_0x48a1('0x92')](_0x5a06c4[_0x48a1('0x51')][_0x48a1('0xa1')])){throw new APIBadRequestError(util[_0x48a1('0x9b')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5a06c4[_0x48a1('0x51')][_0x48a1('0xa1')]));}return db['User'][_0x48a1('0x2c')]({'where':{'id':_0x5a06c4[_0x48a1('0x4d')]['id']},'attributes':['id',_0x48a1('0x2f'),'role',_0x48a1('0x57'),_0x48a1('0x91'),_0x48a1('0x8f'),_0x48a1('0x9d'),_0x48a1('0xff'),_0x48a1('0x100'),'faxPause','openchannelPause','smsPause',_0x48a1('0x101'),_0x48a1('0x102'),'lastPauseAt']})[_0x48a1('0x22')](function(_0x4fd3cb){if(!_0x4fd3cb){throw new APINotFoundError(util[_0x48a1('0x9b')](_0x48a1('0xc2'),_0x5a06c4[_0x48a1('0x4d')]['id']));}return _0x4fd3cb[_0x48a1('0xfe')](_0x5a06c4[_0x48a1('0x51')]['channel']);})[_0x48a1('0x22')](respondWithResult(_0x4bd1b9,null))['catch'](APIHandleError(_0x4bd1b9));};exports[_0x48a1('0x103')]=function(_0x520caf,_0x43924b){var _0xee7ec5={};var _0x324a7b={};var _0x562227;var _0x6743c4;return db[_0x48a1('0x30')]['findOne']({'where':{'id':_0x520caf[_0x48a1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43924b,null))[_0x48a1('0x22')](function(_0x54b51b){if(_0x54b51b){_0x562227=_0x54b51b;_0x324a7b[_0x48a1('0xca')]=_[_0x48a1('0xc7')](db[_0x48a1('0x104')]['rawAttributes']);_0x324a7b['query']=_[_0x48a1('0xc7')](_0x520caf[_0x48a1('0x3d')]);_0x324a7b[_0x48a1('0xce')]=_[_0x48a1('0xc9')](_0x324a7b[_0x48a1('0xca')],_0x324a7b['query']);_0xee7ec5['attributes']=_[_0x48a1('0xc9')](_0x324a7b[_0x48a1('0xca')],qs[_0x48a1('0xcb')](_0x520caf[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0xee7ec5[_0x48a1('0x4f')]=_0xee7ec5[_0x48a1('0x4f')]['length']?_0xee7ec5[_0x48a1('0x4f')]:_0x324a7b[_0x48a1('0xca')];_0xee7ec5[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x520caf[_0x48a1('0x3d')][_0x48a1('0xcd')]);_0xee7ec5['where']=qs['filters'](_[_0x48a1('0xcf')](_0x520caf['query'],_0x324a7b[_0x48a1('0xce')]));if(_0x520caf[_0x48a1('0x3d')][_0x48a1('0x27')]){_0xee7ec5[_0x48a1('0x3c')]=_[_0x48a1('0x4e')](_0xee7ec5[_0x48a1('0x3c')],{'$or':_[_0x48a1('0x29')](_0xee7ec5[_0x48a1('0x4f')],function(_0x48c98f){var _0x124875={};_0x124875[_0x48c98f]={'$like':'%'+_0x520caf['query'][_0x48a1('0x27')]+'%'};return _0x124875;})});}_0xee7ec5=_['merge']({},_0xee7ec5,_0x520caf[_0x48a1('0xd2')]);return _0x562227[_0x48a1('0x103')](_0xee7ec5);}})['then'](function(_0x22cb15){if(_0x22cb15){_0x6743c4=_0x22cb15[_0x48a1('0x44')];if(!_0x520caf[_0x48a1('0x3d')][_0x48a1('0xd1')](_0x48a1('0xd3'))){_0xee7ec5[_0x48a1('0x19')]=qs['limit'](_0x520caf[_0x48a1('0x3d')][_0x48a1('0x19')]);_0xee7ec5[_0x48a1('0x17')]=qs[_0x48a1('0x17')](_0x520caf[_0x48a1('0x3d')][_0x48a1('0x17')]);}return _0x562227[_0x48a1('0x103')](_0xee7ec5);}})[_0x48a1('0x22')](function(_0x37053e){if(_0x37053e){return _0x37053e?{'count':_0x6743c4,'rows':_0x37053e}:null;}})[_0x48a1('0x22')](respondWithResult(_0x43924b,null))[_0x48a1('0x52')](handleError(_0x43924b,null));};exports[_0x48a1('0x105')]=function(_0x564f63,_0x24d6c8){var _0x49126e=_0x564f63[_0x48a1('0x4d')]['id'];var _0x53b14e=_0x564f63[_0x48a1('0x51')]?_0x564f63[_0x48a1('0x51')][_0x48a1('0x56')]:null;var _0x2fad22=[];return Promise[_0x48a1('0xf8')]()[_0x48a1('0x22')](function(){if(!_0x53b14e)throw new APIBadRequestError(_0x48a1('0x106'));})[_0x48a1('0x22')](function(){return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x49126e}});})[_0x48a1('0x22')](function(_0x30b05b){if(!_0x30b05b)throw new APINotFoundError(util[_0x48a1('0x9b')]('User\x20with\x20id\x20%s\x20not\x20found',_0x564f63[_0x48a1('0x4d')]['id']));return db[_0x48a1('0x5f')][_0x48a1('0x107')](function(_0x2f1f18){return _0x30b05b[_0x48a1('0x105')](_0x53b14e,{'transaction':_0x2f1f18})['then'](function(){return db[_0x48a1('0x104')][_0x48a1('0x41')]({'where':{'id':{'$in':_0x53b14e}}});})[_0x48a1('0x22')](function(_0xa37a62){var _0x4f15fe=_[_0x48a1('0x29')](_0xa37a62,function(_0x47a91e){return _0x47a91e[_0x48a1('0x108')]();});return Promise[_0x48a1('0x4c')](_0x4f15fe);})['then'](function(_0x50c923){_0x2fad22=_[_0x48a1('0x109')](_0x50c923);var _0x10a8da=_[_0x48a1('0x29')](_0x2fad22,function(_0x4c0853){return _0x4c0853[_0x48a1('0x10a')](_0x30b05b['id'],{'transaction':_0x2f1f18});});return Promise[_0x48a1('0x4c')](_0x10a8da);})[_0x48a1('0x22')](function(){if(!_0x30b05b[_0x48a1('0x8f')])return;var _0x391041=_[_0x48a1('0x27')](_0x2fad22,function(_0x5351a3){return _0x5351a3[_0x48a1('0x10b')](_0x48a1('0xa1'))===_0x48a1('0x10c');});var _0x2ece8a=_['map'](_0x391041,function(_0x1179ae){return db[_0x48a1('0x9e')][_0x48a1('0x9f')]({'membername':_0x30b05b[_0x48a1('0x2f')],'UserId':_0x30b05b['id'],'queue_name':_0x1179ae[_0x48a1('0x2f')],'VoiceQueueId':_0x1179ae['id'],'interface':_['isNil'](_0x30b05b[_0x48a1('0x91')])?util[_0x48a1('0x9b')]('SIP/%s',_0x30b05b['name']):_0x30b05b[_0x48a1('0x91')],'paused':_0x30b05b[_0x48a1('0x9d')]||![],'penalty':_0x30b05b[_0x48a1('0x96')]},{'transaction':_0x2f1f18});});return Promise['all'](_0x2ece8a);})[_0x48a1('0x22')](function(){return db['TeamVoicePrefix'][_0x48a1('0x41')]({'where':{'teamId':{'$in':_0x53b14e}}});})[_0x48a1('0x22')](function(_0xe7578d){var _0x2bacae=_[_0x48a1('0x29')](_0xe7578d,function(_0x4f7866){return db[_0x48a1('0x10d')][_0x48a1('0x71')]({'UserId':_0x30b05b['id'],'VoicePrefixId':_0x4f7866[_0x48a1('0x10e')]},{'transaction':_0x2f1f18});});return Promise[_0x48a1('0x4c')](_0x2bacae);});});})[_0x48a1('0x22')](function(){for(var _0xf794fb=0x0;_0xf794fb<_0x2fad22['length'];_0xf794fb++){var _0x2f79dd=_0x2fad22[_0xf794fb][_0x48a1('0x10b')](_0x48a1('0xa1'));var _0x2c9f22=_0x2f79dd+_0x48a1('0xa7');socket[_0x48a1('0x1f')](_0x48a1('0x26')+_0x2f79dd+'Queue:save',{'UserId':_0x49126e,['queueField']:_0x2fad22[_0xf794fb]['id']});}})[_0x48a1('0x22')](respondWithStatusCode(_0x24d6c8,null))[_0x48a1('0x52')](APIHandleError(_0x24d6c8));};exports[_0x48a1('0x10f')]=function(_0x641bef,_0x1f5cea){var _0x540b2a=_0x641bef['params']['id'];var _0x209a23=null;if(_0x641bef['query'][_0x48a1('0x56')]){_0x209a23=_['isArray'](_0x641bef[_0x48a1('0x3d')][_0x48a1('0x56')])?_0x641bef['query'][_0x48a1('0x56')]:[_0x641bef[_0x48a1('0x3d')][_0x48a1('0x56')]];}var _0x145468=[];return Promise[_0x48a1('0xf8')]()[_0x48a1('0x22')](function(){if(!_0x209a23)throw new APIBadRequestError(_0x48a1('0x110'));})[_0x48a1('0x22')](function(){return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x540b2a}});})[_0x48a1('0x22')](function(_0xb8353c){if(!_0xb8353c)throw new APINotFoundError(util['format'](_0x48a1('0xc2'),_0x641bef['params']['id']));return db[_0x48a1('0x5f')]['transaction'](function(_0xd97929){return _0xb8353c[_0x48a1('0x10f')](_0x209a23,{'transaction':_0xd97929})[_0x48a1('0x22')](function(){return db[_0x48a1('0x104')][_0x48a1('0x41')]({'where':{'id':{'$in':_0x209a23}}});})[_0x48a1('0x22')](function(_0x1acc2d){var _0x12768f=_['map'](_0x1acc2d,function(_0x38fdae){return _0x38fdae['getAssociatedQueues']();});return Promise[_0x48a1('0x4c')](_0x12768f);})[_0x48a1('0x22')](function(_0x2a80da){_0x145468=_[_0x48a1('0x109')](_0x2a80da);var _0x463342=_['map'](_0x145468,function(_0x1a5717){return _0x1a5717[_0x48a1('0x111')](_0xb8353c['id'],{'transaction':_0xd97929});});return Promise['all'](_0x463342);})['then'](function(){if(!_0xb8353c['online'])return;var _0x1604f0=_['filter'](_0x145468,function(_0x1441e4){return _0x1441e4[_0x48a1('0x10b')]('channel')==='Voice';});var _0x4a513a=_['map'](_0x1604f0,function(_0x34a96b){return db[_0x48a1('0x9e')]['destroy']({'where':{'VoiceQueueId':_0x34a96b['id'],'UserId':_0xb8353c['id']},'transaction':_0xd97929});});return Promise['all'](_0x4a513a);})[_0x48a1('0x22')](function(){return db[_0x48a1('0x112')]['findAll']({'where':{'teamId':{'$in':_0x209a23}}});})[_0x48a1('0x22')](function(_0x110979){var _0x1edc38=_['map'](_0x110979,function(_0x5d3d24){return db['UserVoicePrefix'][_0x48a1('0x21')]({'where':{'UserId':_0xb8353c['id'],'VoicePrefixId':_0x5d3d24[_0x48a1('0x10e')]}},{'transaction':_0xd97929});});return Promise[_0x48a1('0x4c')](_0x1edc38);});});})['then'](function(){for(var _0x21877d=0x0;_0x21877d<_0x145468[_0x48a1('0x44')];_0x21877d++){var _0x754eff=_0x145468[_0x21877d][_0x48a1('0x10b')]('channel');var _0x24c83c=_0x754eff+_0x48a1('0xa7');socket[_0x48a1('0x1f')](_0x48a1('0x26')+_0x754eff+_0x48a1('0xa6'),{'UserId':_0x540b2a,['queueField']:_0x145468[_0x21877d]['id']});}})['then'](respondWithStatusCode(_0x1f5cea,null))[_0x48a1('0x52')](APIHandleError(_0x1f5cea));};exports[_0x48a1('0x113')]=function(_0x19f5d9,_0x489280){var _0xe54dd8={};var _0x94dda8={};var _0x5ddb04;var _0x33ba57;return db['User'][_0x48a1('0x8a')]({'where':{'id':_0x19f5d9[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x489280,null))[_0x48a1('0x22')](function(_0x1ab1d3){if(_0x1ab1d3){_0x5ddb04=_0x1ab1d3;_0x94dda8[_0x48a1('0xca')]=_[_0x48a1('0xc7')](db[_0x48a1('0x114')][_0x48a1('0x31')]);_0x94dda8[_0x48a1('0x3d')]=_[_0x48a1('0xc7')](_0x19f5d9[_0x48a1('0x3d')]);_0x94dda8[_0x48a1('0xce')]=_['intersection'](_0x94dda8[_0x48a1('0xca')],_0x94dda8[_0x48a1('0x3d')]);_0xe54dd8['attributes']=_['intersection'](_0x94dda8[_0x48a1('0xca')],qs[_0x48a1('0xcb')](_0x19f5d9[_0x48a1('0x3d')][_0x48a1('0xcb')]));_0xe54dd8[_0x48a1('0x4f')]=_0xe54dd8[_0x48a1('0x4f')][_0x48a1('0x44')]?_0xe54dd8['attributes']:_0x94dda8[_0x48a1('0xca')];_0xe54dd8['order']=qs[_0x48a1('0xcd')](_0x19f5d9[_0x48a1('0x3d')]['sort']);_0xe54dd8[_0x48a1('0x3c')]=qs['filters'](_[_0x48a1('0xcf')](_0x19f5d9['query'],_0x94dda8[_0x48a1('0xce')]));if(_0x19f5d9['query'][_0x48a1('0x27')]){_0xe54dd8[_0x48a1('0x3c')]=_[_0x48a1('0x4e')](_0xe54dd8[_0x48a1('0x3c')],{'$or':_['map'](_0xe54dd8[_0x48a1('0x4f')],function(_0x1a1d0d){var _0x26f95f={};_0x26f95f[_0x1a1d0d]={'$like':'%'+_0x19f5d9[_0x48a1('0x3d')]['filter']+'%'};return _0x26f95f;})});}_0xe54dd8=_['merge']({},_0xe54dd8,_0x19f5d9['options']);return _0x5ddb04[_0x48a1('0x113')](_0xe54dd8);}})['then'](function(_0x181eba){if(_0x181eba){_0x33ba57=_0x181eba[_0x48a1('0x44')];if(!_0x19f5d9[_0x48a1('0x3d')][_0x48a1('0xd1')]('nolimit')){_0xe54dd8[_0x48a1('0x19')]=qs['limit'](_0x19f5d9['query'][_0x48a1('0x19')]);_0xe54dd8[_0x48a1('0x17')]=qs['offset'](_0x19f5d9['query'][_0x48a1('0x17')]);}return _0x5ddb04[_0x48a1('0x113')](_0xe54dd8);}})[_0x48a1('0x22')](function(_0x30e4eb){if(_0x30e4eb){return _0x30e4eb?{'count':_0x33ba57,'rows':_0x30e4eb}:null;}})[_0x48a1('0x22')](respondWithResult(_0x489280,null))[_0x48a1('0x52')](handleError(_0x489280,null));};exports[_0x48a1('0x115')]=function(_0x39ef8f,_0x337dcc){var _0x30fcd7={};var _0x23dab4={};var _0x216d3d;return db[_0x48a1('0x30')][_0x48a1('0x8a')]({'where':{'id':_0x39ef8f[_0x48a1('0x4d')]['id']}})[_0x48a1('0x22')](handleEntityNotFound(_0x337dcc,null))[_0x48a1('0x22')](function(_0x4adc24){if(_0x4adc24){_0x216d3d=_0x4adc24;_0x23dab4['model']=_[_0x48a1('0xc7')](db[_0x48a1('0x30')][_0x48a1('0x31')]);_0x23dab4['query']=_[_0x48a1('0xc7')](_0x39ef8f['query']);_0x23dab4[_0x48a1('0xce')]=_[_0x48a1('0xc9')](_0x23dab4[_0x48a1('0xca')],_0x23dab4['query']);_0x30fcd7[_0x48a1('0x4f')]=_[_0x48a1('0xc9')](_0x23dab4[_0x48a1('0xca')],qs['fields'](_0x39ef8f['query'][_0x48a1('0xcb')]));_0x30fcd7[_0x48a1('0x4f')]=_0x30fcd7[_0x48a1('0x4f')]['length']?_0x30fcd7[_0x48a1('0x4f')]:_0x23dab4[_0x48a1('0xca')];_0x30fcd7[_0x48a1('0xcc')]=qs[_0x48a1('0xcd')](_0x39ef8f[_0x48a1('0x3d')]['sort']);_0x30fcd7[_0x48a1('0x3c')]=qs[_0x48a1('0xce')](_[_0x48a1('0xcf')](_0x39ef8f[_0x48a1('0x3d')],_0x23dab4['filters']));if(_0x39ef8f[_0x48a1('0x3d')][_0x48a1('0x27')]){_0x30fcd7[_0x48a1('0x3c')]=_[_0x48a1('0x4e')](_0x30fcd7['where'],{'$or':_[_0x48a1('0x29')](_0x30fcd7[_0x48a1('0x4f')],function(_0x22c7fb){var _0x203b25={};_0x203b25[_0x22c7fb]={'$like':'%'+_0x39ef8f['query'][_0x48a1('0x27')]+'%'};return _0x203b25;})});}_0x30fcd7[_0x48a1('0xca')]=db['User'];_0x30fcd7['as']=_0x48a1('0x77');_0x30fcd7=_[_0x48a1('0x4e')]({},_0x30fcd7,_0x39ef8f[_0x48a1('0xd2')]);return _0x216d3d[_0x48a1('0xef')]({'include':[_0x30fcd7]});}})[_0x48a1('0x22')](function(_0x4be1bb){if(_0x4be1bb){var _0x444031={},_0x28a006=[];for(var _0x5d599a=0x0;_0x5d599a<_0x4be1bb[_0x48a1('0x44')];_0x5d599a+=0x1){for(var _0x518f1b=0x0,_0x3bd4f0;_0x518f1b<_0x4be1bb[_0x5d599a][_0x48a1('0x77')][_0x48a1('0x44')];_0x518f1b+=0x1){_0x3bd4f0=_0x4be1bb[_0x5d599a][_0x48a1('0x77')][_0x518f1b]['get']({'plain':!![]});_0x444031[_0x3bd4f0['id']]=_0x3bd4f0;}}_0x444031=_[_0x48a1('0x116')](_0x444031);for(var _0xf870cd=qs[_0x48a1('0x17')](_0x39ef8f[_0x48a1('0x3d')][_0x48a1('0x17')]);_0xf870cd<_0x444031[_0x48a1('0x44')]&&_0x28a006[_0x48a1('0x44')]=_0x18bf52){_0x1ca6d8=_0x18bf52;_0x3f52fe=0xc8;}else{_0x3f52fe=0xce;}_0x5be9c4[_0x37c0('0x13')](_0x3f52fe);return _0x5be9c4['set'](_0x37c0('0x1a'),_0x472f87+'-'+_0x1ca6d8+'/'+_0x18bf52)[_0x37c0('0x15')](_0x5f0aa8);}return null;};}function saveUpdates(_0x4b33bf){return function(_0x40cb82){if(_0x40cb82){return _0x40cb82[_0x37c0('0x1b')](_0x4b33bf)['then'](function(_0x23a941){if(_0x23a941['role']==='agent'){socket[_0x37c0('0x1c')](_0x37c0('0x1d')+_0x23a941['id'],_0x23a941);}return _0x23a941;});}return null;};}function removeEntity(_0x2955c0){return function(_0xb50bfe){if(_0xb50bfe){return _0xb50bfe[_0x37c0('0x1e')]()['then'](function(){var _0x3f41df=_0xb50bfe[_0x37c0('0x1f')]({'plain':!![]});if(_0x3f41df['role']===_0x37c0('0x20'))return;var _0xc1827e=[{'name':_0x37c0('0x21'),'value':_0x37c0('0x22'),'ignore':!![]},{'name':_0x37c0('0x23'),'value':_0x37c0('0x24'),'ignore':![]},{'name':_0x37c0('0x25'),'value':_0x37c0('0x26'),'ignore':![]}];var _0x4f190c=_(_0xc1827e)[_0x37c0('0x27')](_0x37c0('0x28'))[_0x37c0('0x29')](_0x37c0('0x2a'))[_0x37c0('0x2a')]();if(_[_0x37c0('0x2b')](_0x4f190c,_0x3f41df[_0x37c0('0x2c')])){return;}var _0x60aa3c=_[_0x37c0('0x2d')](_0xc1827e,[_0x37c0('0x2a'),_0x3f41df[_0x37c0('0x2c')]])[_0x37c0('0x2e')];return db[_0x37c0('0x2f')][_0x37c0('0x1e')]({'where':{'type':_0x60aa3c,'resourceId':_0x3f41df['id']}})[_0x37c0('0x30')](function(){return _0xb50bfe;});})['then'](function(){_0x2955c0[_0x37c0('0x13')](0xcc)[_0x37c0('0x14')]();});}};}function handleEntityNotFound(_0x50a8be){return function(_0x1499fe){if(!_0x1499fe){_0x50a8be[_0x37c0('0x31')](0x194);}return _0x1499fe;};}function handleError(_0x4709a8,_0x2d44e6){_0x2d44e6=_0x2d44e6||0x1f4;return function(_0x27ed4c){logger['error'](_0x27ed4c[_0x37c0('0x32')]);if(_0x27ed4c[_0x37c0('0x2e')]){delete _0x27ed4c[_0x37c0('0x2e')];}_0x4709a8[_0x37c0('0x13')](_0x2d44e6)[_0x37c0('0x33')](_0x27ed4c);};}function getUserAttributes(){return _(db[_0x37c0('0x34')]['rawAttributes'])[_0x37c0('0x29')](function(_0x2c5165){return{'name':_0x2c5165[_0x37c0('0x35')],'type':_0x2c5165[_0x37c0('0x36')][_0x37c0('0x37')]};})['filter'](function(_0x7daebe){return!['password','salt',_0x37c0('0x38'),_0x37c0('0x39'),_0x37c0('0x3a'),'md5secret'][_0x37c0('0x2b')](_0x7daebe[_0x37c0('0x2e')]);})['value']();}exports['index']=function(_0x43ff2b,_0xe97acd){var _0x15c6ba={},_0x2c325a={'count':0x0,'rows':[]};var _0x66ace7=getUserAttributes();_0x15c6ba=qs[_0x37c0('0x3b')](_0x66ace7,_0x43ff2b);var _0xb0a204={'where':_0x15c6ba[_0x37c0('0x3c')]};return db[_0x37c0('0x34')]['count'](_0xb0a204)[_0x37c0('0x30')](function(_0x224a7f){_0x2c325a[_0x37c0('0x18')]=_0x224a7f;if(_0x43ff2b[_0x37c0('0x3d')][_0x37c0('0x3e')]){_0x15c6ba[_0x37c0('0x3f')]=[{'all':!![]}];}if(_0x43ff2b['query']['userSetting']===_0x37c0('0x40')){_0x15c6ba[_0x37c0('0x3f')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_['includes'](_0x15c6ba[_0x37c0('0x41')],'id')){_0x15c6ba[_0x37c0('0x41')]['push']('id');}return db[_0x37c0('0x34')][_0x37c0('0x42')](_0x15c6ba);})['then'](function(_0x3da024){_0x2c325a[_0x37c0('0x43')]=_0x3da024;if(_0x43ff2b[_0x37c0('0x3d')][_0x37c0('0x44')]==='true'){var _0x2eac9f=[];for(var _0x508f44=0x0;_0x508f44<_0x2c325a[_0x37c0('0x43')][_0x37c0('0x45')];_0x508f44++){_0x2eac9f[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x47'),_0x2c325a[_0x37c0('0x43')][_0x508f44]['dataValues']));_0x2eac9f[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x48'),_0x2c325a[_0x37c0('0x43')][_0x508f44][_0x37c0('0x49')]));_0x2eac9f['push'](get_open_tabs('fax',_0x2c325a[_0x37c0('0x43')][_0x508f44]['dataValues']));_0x2eac9f[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x4a'),_0x2c325a['rows'][_0x508f44][_0x37c0('0x49')]));_0x2eac9f['push'](get_open_tabs('openchannel',_0x2c325a['rows'][_0x508f44][_0x37c0('0x49')]));_0x2eac9f[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x4b'),_0x2c325a[_0x37c0('0x43')][_0x508f44][_0x37c0('0x49')]));}return Promise['all'](_0x2eac9f)[_0x37c0('0x30')](function(){return _0x2c325a;});}else{return _0x2c325a;}})[_0x37c0('0x30')](respondWithFilteredResult(_0xe97acd,_0x15c6ba))['catch'](handleError(_0xe97acd,null));};exports[_0x37c0('0x4c')]=function(_0x5be4d9,_0xbc201a){var _0x11f3a7=getUserAttributes();_0x5be4d9['query']['id']=_0x5be4d9['params']['id'];var _0x55fe82=qs['getOptions'](_0x11f3a7,_0x5be4d9);if(_0x5be4d9[_0x37c0('0x3d')]['includeAll']){_0x55fe82[_0x37c0('0x3f')]=[{'all':!![]}];}if(_0x5be4d9[_0x37c0('0x3d')][_0x37c0('0x4d')]===_0x37c0('0x40')){_0x55fe82[_0x37c0('0x3f')]=[{'model':db[_0x37c0('0x4e')],'as':_0x37c0('0x4d')}];}_0x55fe82=_[_0x37c0('0x4f')]({},_0x55fe82,_0x5be4d9[_0x37c0('0x50')]);if(!_[_0x37c0('0x2b')](_0x55fe82[_0x37c0('0x41')],'id')){_0x55fe82[_0x37c0('0x41')]['push']('id');}return db['User'][_0x37c0('0x2d')](_0x55fe82)[_0x37c0('0x30')](handleEntityNotFound(_0xbc201a,null))['then'](function(_0x1aa3e){var _0x2d8b9e=[];values=_0x1aa3e;if(_0x5be4d9['query']['openTabs']===_0x37c0('0x40')){_0x2d8b9e['push'](get_open_tabs(_0x37c0('0x47'),_0x1aa3e['dataValues']));_0x2d8b9e[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x48'),_0x1aa3e['dataValues']));_0x2d8b9e['push'](get_open_tabs(_0x37c0('0x51'),_0x1aa3e[_0x37c0('0x49')]));_0x2d8b9e[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x4b'),_0x1aa3e[_0x37c0('0x49')]));_0x2d8b9e['push'](get_open_tabs(_0x37c0('0x52'),_0x1aa3e[_0x37c0('0x49')]));_0x2d8b9e[_0x37c0('0x46')](get_open_tabs('mail',_0x1aa3e[_0x37c0('0x49')]));return Promise[_0x37c0('0x53')](_0x2d8b9e);}else{return values;}})[_0x37c0('0x30')](function(){return values;})[_0x37c0('0x30')](respondWithResult(_0xbc201a,null))[_0x37c0('0x54')](handleError(_0xbc201a,null));};exports[_0x37c0('0x1b')]=function(_0x286e3e,_0x189e6b){if(_0x286e3e[_0x37c0('0x55')]['id']){delete _0x286e3e[_0x37c0('0x55')]['id'];}delete _0x286e3e[_0x37c0('0x55')][_0x37c0('0x2c')];return db['User']['find']({'where':{'id':_0x286e3e[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x189e6b,null))[_0x37c0('0x30')](saveUpdates(_0x286e3e[_0x37c0('0x55')],null))[_0x37c0('0x30')](respondWithResult(_0x189e6b,null))['catch'](handleError(_0x189e6b,null));};exports[_0x37c0('0x57')]=function(_0x4c3af1,_0x4c1d76){return db[_0x37c0('0x34')][_0x37c0('0x57')]()[_0x37c0('0x30')](respondWithResult(_0x4c1d76,null))[_0x37c0('0x54')](handleError(_0x4c1d76,null));};exports['addContacts']=function(_0x530360,_0x37e009){return db[_0x37c0('0x34')][_0x37c0('0x2d')]({'where':{'id':_0x530360[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x37e009,null))['then'](function(_0x2d3dd2){if(_0x2d3dd2){return _0x2d3dd2[_0x37c0('0x58')](_0x530360[_0x37c0('0x55')][_0x37c0('0x59')],_[_0x37c0('0x5a')](_0x530360[_0x37c0('0x55')],[_0x37c0('0x59'),'id'])||{});}})[_0x37c0('0x30')](respondWithResult(_0x37e009,null))[_0x37c0('0x54')](handleError(_0x37e009,null));};function validateUser(_0x27df3d){return new Promise(function(_0x2cf409,_0x4eddcc){if(_0x27df3d[_0x37c0('0x5b')])return _0x2cf409(_0x27df3d);return db[_0x37c0('0x5c')]['findById'](0x1)[_0x37c0('0x30')](function(_0x8c31c){if(_0x8c31c[_0x37c0('0x5d')])authService['validatePasswordPattern'](_0x27df3d[_0x37c0('0x5e')]);db['User'][_0x37c0('0x5f')](_0x37c0('0x5b'))[_0x37c0('0x30')](function(_0x3688ce){if(_[_0x37c0('0x60')](_0x3688ce)){_0x27df3d['internal']=_0x8c31c[_0x37c0('0x61')]||0x1;return;}if(_['isNil'](_0x8c31c['min_internal'])||_0x8c31c[_0x37c0('0x61')]===_0x3688ce){_0x27df3d[_0x37c0('0x5b')]=_0x3688ce+0x1;return;}if(_0x8c31c['min_internal']>_0x3688ce){_0x27df3d['internal']=_0x8c31c[_0x37c0('0x61')];return;}return db['sequelize'][_0x37c0('0x3d')](_0x37c0('0x62'),{'type':db[_0x37c0('0x63')]['QueryTypes'][_0x37c0('0x64')]})['then'](function(_0x5aa56c){if(_0x5aa56c&&_0x5aa56c['length']){for(var _0x504501=0x0,_0x29af24=_0x5aa56c['length'];_0x504501<_0x29af24&&_[_0x37c0('0x60')](_0x27df3d[_0x37c0('0x5b')]);_0x504501++){if(_0x8c31c['min_internal']<=_0x5aa56c[_0x504501][_0x37c0('0x65')]){_0x27df3d['internal']=_0x5aa56c[_0x504501][_0x37c0('0x65')];}else if(_0x8c31c[_0x37c0('0x61')]>_0x5aa56c[_0x504501][_0x37c0('0x65')]&&_0x8c31c[_0x37c0('0x61')]<=_0x5aa56c[_0x504501]['to']){_0x27df3d['internal']=_0x8c31c['min_internal'];}}}if(_[_0x37c0('0x60')](_0x27df3d[_0x37c0('0x5b')])){_0x27df3d[_0x37c0('0x5b')]=_0x3688ce+0x1;}return _0x2cf409(_0x27df3d);});});})['catch'](function(_0xb8eb2a){_0x4eddcc(_0xb8eb2a);});});}function updateUser(_0x129c20){return new Promise(function(_0x3b0510,_0x286356){try{if(_0x129c20[_0x37c0('0x66')]){_0x129c20[_0x37c0('0x67')]=_0x129c20[_0x37c0('0x5b')];_0x129c20[_0x37c0('0x68')]={'mailbox':_0x129c20['internal'],'password':_0x129c20[_0x37c0('0x5e')],'fullname':_0x129c20[_0x37c0('0x69')],'email':_0x129c20['email']};}if(_0x129c20[_0x37c0('0x2c')]==='agent'){if(!_0x129c20[_0x37c0('0x6a')])_0x129c20[_0x37c0('0x6a')]=[_0x37c0('0x6b'),_0x37c0('0x6c'),_0x37c0('0x6d'),'113',_0x37c0('0x6e'),_0x37c0('0x6f'),_0x37c0('0x70'),_0x37c0('0x71'),_0x37c0('0x72'),_0x37c0('0x73'),_0x37c0('0x74'),_0x37c0('0x75'),_0x37c0('0x76'),_0x37c0('0x77'),_0x37c0('0x78')];}_0x3b0510(_0x129c20);}catch(_0x2944ae){_0x286356(_0x2944ae);}});}exports[_0x37c0('0x79')]=function(_0x377036,_0x4d40b4){if(_0x377036[_0x37c0('0x22')][_0x37c0('0x2c')]===_0x37c0('0x24'))throw new Error(_0x37c0('0x7a'));if(_0x377036['body'][_0x37c0('0x2c')]===_0x37c0('0x22')&&_0x377036[_0x37c0('0x22')][_0x37c0('0x2c')]!=='admin'){throw new Error(_0x37c0('0x7b'));}if(_0x377036[_0x37c0('0x55')][_0x37c0('0x2c')]==='admin'&&_0x377036[_0x37c0('0x22')][_0x37c0('0x2c')]!==_0x37c0('0x20')){throw new Error(_0x37c0('0x7c'));}return licenseUtil[_0x37c0('0x7d')]([_0x377036['body']])['then'](function(){return validateUser(_0x377036['body']);})[_0x37c0('0x30')](function(_0x3e7a1b){return updateUser(_0x3e7a1b)[_0x37c0('0x30')](function(_0x27392a){if(_0x27392a[_0x37c0('0x2c')]===_0x37c0('0x20')){_0x27392a[_0x37c0('0x7e')]=_0x377036[_0x37c0('0x22')][_0x37c0('0x7e')];delete _0x27392a[_0x37c0('0x7f')];}return _0x27392a;});})['then'](function(_0x43cb7c){return db[_0x37c0('0x34')][_0x37c0('0x79')](_0x43cb7c,{'include':[{'model':db[_0x37c0('0x68')],'as':_0x37c0('0x68')}]});})['then'](function(_0x5bfc13){if(_0x377036['body'][_0x37c0('0x2c')]===_0x37c0('0x22'))return _0x5bfc13;if(_0x377036[_0x37c0('0x22')]['role']!==_0x37c0('0x22'))return _0x5bfc13;return db[_0x37c0('0x80')]['find']({'where':{'name':_0x5bfc13['role']===_0x37c0('0x24')?_0x37c0('0x23'):_0x37c0('0x25'),'userProfileId':_0x377036[_0x37c0('0x22')][_0x37c0('0x7f')]},'raw':!![]})['then'](function(_0x13f7b7){if(!_0x13f7b7||_0x13f7b7['autoAssociation']!=0x0)return _0x5bfc13;return db[_0x37c0('0x2f')]['create']({'name':_0x5bfc13['name'],'resourceId':_0x5bfc13['id'],'type':_0x13f7b7[_0x37c0('0x2e')],'sectionId':_0x13f7b7['id']},{})[_0x37c0('0x30')](function(){return _0x5bfc13;});})[_0x37c0('0x54')](function(_0x5addd3){logger[_0x37c0('0x81')](_0x37c0('0x82'),_0x5addd3);throw _0x5addd3;});})['then'](respondWithResult(_0x4d40b4,0xc9))[_0x37c0('0x54')](handleError(_0x4d40b4,null));};exports['bulkCreate']=function(_0x2a0d4d,_0x42c3b0){var _0x13293e=_0x2a0d4d['body'];var _0x13a712=[];if(_0x2a0d4d[_0x37c0('0x22')][_0x37c0('0x2c')]===_0x37c0('0x24'))throw new Error('Unauthorized');if(_[_0x37c0('0x83')](_0x13293e,[_0x37c0('0x2c'),_0x37c0('0x22')])&&_0x2a0d4d[_0x37c0('0x22')]['role']!==_0x37c0('0x20')){throw new Error(_0x37c0('0x7b'));}if(_['some'](_0x13293e,[_0x37c0('0x2c'),_0x37c0('0x20')])&&_0x2a0d4d['user']['role']!=='admin'){throw new Error(_0x37c0('0x84'));}return licenseUtil[_0x37c0('0x7d')](_0x13293e)[_0x37c0('0x30')](function(){return validateUser(_0x13293e[0x0]);})[_0x37c0('0x30')](function(){for(var _0x5a1673=0x1;_0x5a1673<_0x13293e[_0x37c0('0x45')];_0x5a1673++){var _0x31776d=_0x13293e[_0x5a1673-0x1][_0x37c0('0x5b')];if(!_0x13293e[_0x5a1673][_0x37c0('0x5b')])_0x13293e[_0x5a1673][_0x37c0('0x5b')]=_0x31776d+0x1;_0x13a712['push'](validateUser(_0x13293e[_0x5a1673]));}return Promise[_0x37c0('0x53')](_0x13a712);})[_0x37c0('0x30')](function(){_0x13a712=[];for(var _0x16c81e=0x0;_0x16c81e<_0x13293e[_0x37c0('0x45')];_0x16c81e++){_0x13a712['push'](updateUser(_0x13293e[_0x16c81e]));}return Promise[_0x37c0('0x53')](_0x13a712);})[_0x37c0('0x30')](function(){_0x13a712=_0x13293e[_0x37c0('0x29')](function(_0x446bad){return db[_0x37c0('0x34')][_0x37c0('0x79')](_0x446bad,{'include':[{'model':db['VoiceMail'],'as':_0x37c0('0x68')}]})[_0x37c0('0x30')](function(_0x21a027){_0x446bad['id']=_0x21a027['id'];return _0x446bad;});});return Promise['all'](_0x13a712);})['then'](function(_0x37524f){if(_0x2a0d4d[_0x37c0('0x55')][_0x37c0('0x2c')]==='user')return _0x37524f;if(_0x2a0d4d['user'][_0x37c0('0x2c')]!==_0x37c0('0x22'))return _0x37524f;var _0x54a9be=_['some'](_0x37524f,function(_0x248426){return _0x248426[_0x37c0('0x2c')]===_0x37c0('0x24')||_0x248426['role']===_0x37c0('0x26');});if(!_0x54a9be)return _0x37524f;return db[_0x37c0('0x80')][_0x37c0('0x42')]({'where':{'name':{'$or':[_0x37c0('0x23'),_0x37c0('0x25')]},'userProfileId':_0x2a0d4d[_0x37c0('0x22')]['userProfileId']},'raw':!![]})[_0x37c0('0x30')](function(_0x2261cb){if(_['isEmpty'](_0x2261cb)||!_[_0x37c0('0x83')](_0x2261cb,[_0x37c0('0x85'),0x0]))return _0x37524f;_0x13a712=[];var _0x81a098=_(_0x2261cb)[_0x37c0('0x29')](function(_0x2e6e2f){if(_0x2e6e2f[_0x37c0('0x85')]===0x1)return;return _0x2e6e2f[_0x37c0('0x2e')]==='Agents'?_0x37c0('0x24'):_0x37c0('0x26');})[_0x37c0('0x86')]()[_0x37c0('0x2a')]();for(var _0x497b0a=0x0;_0x497b0a<_0x37524f['length'];_0x497b0a++){if(!_[_0x37c0('0x2b')](_0x81a098,_0x37524f[_0x497b0a]['role']))return;var _0x572a0d=_0x37524f[_0x497b0a]['role']===_0x37c0('0x24')?_0x37c0('0x23'):'Telephones';_0x13a712[_0x37c0('0x46')](db[_0x37c0('0x2f')][_0x37c0('0x79')]({'name':_0x37524f[_0x497b0a][_0x37c0('0x2e')],'resourceId':_0x37524f[_0x497b0a]['id'],'type':_0x572a0d,'sectionId':_[_0x37c0('0x2d')](_0x2261cb,[_0x37c0('0x2e'),_0x572a0d])['id']},{}));}return Promise[_0x37c0('0x53')](_0x13a712);});})[_0x37c0('0x30')](respondWithResult(_0x42c3b0,0xc9))[_0x37c0('0x54')](handleError(_0x42c3b0,null));};exports[_0x37c0('0x87')]=function(_0x3279f4,_0x41600e){if(_0x3279f4[_0x37c0('0x55')]['id']){delete _0x3279f4[_0x37c0('0x55')]['id'];}return db[_0x37c0('0x34')][_0x37c0('0x2d')]({'where':{'id':_0x3279f4[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](function(_0x83032d){if(!_0x83032d)return null;if(_0x83032d['id']===_0x3279f4[_0x37c0('0x22')]['id']){if(!_0x3279f4['body'][_0x37c0('0x88')]||!_0x3279f4[_0x37c0('0x55')][_0x37c0('0x89')]){throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))](_0x37c0('0x8c'));}if(!_0x83032d['authenticate'](_0x3279f4[_0x37c0('0x55')]['oldPassword'])){throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))](_0x37c0('0x8d'));}if(_0x3279f4[_0x37c0('0x55')][_0x37c0('0x88')]===_0x3279f4['body'][_0x37c0('0x89')]){throw new db[(_0x37c0('0x8a'))]['ValidationError'](_0x37c0('0x8e'));}}else if(_0x3279f4[_0x37c0('0x22')][_0x37c0('0x2c')]===_0x37c0('0x20')){if(!_0x3279f4[_0x37c0('0x55')]['newPassword']){throw new db['Sequelize'][(_0x37c0('0x8b'))](_0x37c0('0x8f'));}}else if(_0x3279f4[_0x37c0('0x22')][_0x37c0('0x2c')]===_0x37c0('0x22')){if(!_0x3279f4[_0x37c0('0x55')][_0x37c0('0x89')]){throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x83032d[_0x37c0('0x2c')]!==_0x37c0('0x24')){throw new db[(_0x37c0('0x8a'))]['ValidationError'](_0x37c0('0x7a'));}}else{throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))]('Unauthorized');}return _0x83032d;})[_0x37c0('0x30')](handleEntityNotFound(_0x41600e,null))[_0x37c0('0x30')](function(_0x51f89a){return db[_0x37c0('0x5c')][_0x37c0('0x90')]({'attributes':['id',_0x37c0('0x5d'),_0x37c0('0x91'),'passwordHistoryLimit']})[_0x37c0('0x30')](function(_0x57214c){if(_0x57214c[_0x37c0('0x5d')])authService[_0x37c0('0x92')](_0x3279f4[_0x37c0('0x55')][_0x37c0('0x89')]);if(!_0x57214c[_0x37c0('0x91')]||!_0x51f89a[_0x37c0('0x38')])return _0x51f89a;authService[_0x37c0('0x93')](_0x3279f4[_0x37c0('0x55')][_0x37c0('0x89')],_0x51f89a['previousPasswords'],_0x57214c[_0x37c0('0x94')]);return _0x51f89a;})[_0x37c0('0x30')](saveUpdates({'password':_0x3279f4[_0x37c0('0x55')][_0x37c0('0x89')],'passwordResetAt':_0x3279f4[_0x37c0('0x22')]['id']==_0x3279f4[_0x37c0('0x56')]['id']?moment():null,'previousPasswords':authService[_0x37c0('0x95')](_0x3279f4[_0x37c0('0x55')]['newPassword'],_0x51f89a[_0x37c0('0x38')])},null));})[_0x37c0('0x30')](respondWithResult(_0x41600e,null))[_0x37c0('0x54')](handleError(_0x41600e,null));};exports[_0x37c0('0x96')]=function(_0xeff6da,_0x56f9b9){var _0x420336=_0xeff6da[_0x37c0('0x55')][_0x37c0('0x97')];return db['User'][_0x37c0('0x2d')]({'where':{'id':_0xeff6da[_0x37c0('0x56')]['id']},'attributes':['id','name',_0x37c0('0x2c'),_0x37c0('0x98'),_0x37c0('0x99'),_0x37c0('0x9a'),_0x37c0('0x9b')]})[_0x37c0('0x30')](handleEntityNotFound(_0x56f9b9,null))[_0x37c0('0x30')](function(_0x379002){if(_0x379002){if(!utils['isValidChannel'](_0x420336)){throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))](_0x37c0('0x9c'));}return _0x379002[_0x37c0('0x9d')+_[_0x37c0('0x9e')](_0x420336[_0x37c0('0x9f')]())+'Queues'](_0xeff6da[_0x37c0('0x55')][_0x37c0('0x59')],{'penalty':_0xeff6da['body'][_0x37c0('0xa0')]||0x0})[_0x37c0('0xa1')](function(_0x2286d9){for(var _0xf2ea74=0x0;_0xf2ea74<_0xeff6da['body'][_0x37c0('0x59')][_0x37c0('0x45')];_0xf2ea74+=0x1){var _0x8652eb={'UserId':Number(_0xeff6da['params']['id'])};_0x8652eb[_['capitalize'](_0x420336[_0x37c0('0x9f')]())+_0x37c0('0xa2')]=Number(_0xeff6da[_0x37c0('0x55')][_0x37c0('0x59')][_0xf2ea74]);socket['emit']('user'+_[_0x37c0('0x9e')](_0x420336[_0x37c0('0x9f')]())+_0x37c0('0xa3'),_0x8652eb);}return _0x2286d9;})[_0x37c0('0x30')](function(){if(_0x420336===_0x37c0('0xa4')){return db[_0x37c0('0xa5')][_0x37c0('0x42')]({'where':{'id':_0xeff6da['body'][_0x37c0('0x59')]||[]},'raw':!![],'attributes':['id',_0x37c0('0x2e')]});}})[_0x37c0('0x30')](function(_0x5d0e96){var _0x19f589=_0x379002['get']({'plain':!![]});var _0x179be5=[];if(_0x420336===_0x37c0('0xa4')&&_0x19f589[_0x37c0('0x2c')]===_0x37c0('0x24')&&_0x19f589[_0x37c0('0x98')]){for(let _0x4a2d70=0x0;_0x4a2d70<_0x5d0e96['length'];_0x4a2d70+=0x1){_0x179be5[_0x37c0('0x46')]({'membername':_0x19f589['name'],'UserId':_0x19f589['id'],'queue_name':_0x5d0e96[_0x4a2d70][_0x37c0('0x2e')],'VoiceQueueId':_0x5d0e96[_0x4a2d70]['id'],'interface':_['isNil'](_0x19f589[_0x37c0('0x9b')])?util[_0x37c0('0xa6')](_0x37c0('0xa7'),_0x19f589[_0x37c0('0x2e')]):_0x19f589[_0x37c0('0x9b')],'paused':_0x19f589[_0x37c0('0x9a')]||![],'penalty':_0xeff6da[_0x37c0('0x55')][_0x37c0('0xa0')]||0x0});}return Promise[_0x37c0('0x53')](_0x179be5[_0x37c0('0x29')](function(_0x2a835f){return db[_0x37c0('0xa8')][_0x37c0('0xa9')](_0x2a835f);}));}return _0x379002;});}})[_0x37c0('0x30')](respondWithStatusCode(_0x56f9b9,null))['catch'](handleError(_0x56f9b9,null));};exports['removeQueues']=function(_0x5838fa,_0xd8ab50){var _0xe792d1,_0x106777;return db[_0x37c0('0x34')]['find']({'where':{'id':_0x5838fa[_0x37c0('0x56')]['id']},'attributes':['id',_0x37c0('0x2e'),_0x37c0('0x2c')]})[_0x37c0('0x30')](handleEntityNotFound(_0xd8ab50,null))[_0x37c0('0x30')](function(_0x3e4a04){if(_0x3e4a04){_0xe792d1=_0x3e4a04;if(!_0x5838fa['query']['channel']||!utils['isValidChannel'](_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x97')])){throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))](_0x37c0('0x9c'));}return _0x3e4a04[_0x37c0('0xaa')+_[_0x37c0('0x9e')](_0x5838fa['query'][_0x37c0('0x97')]['toLowerCase']())+'Queues'](_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x59')]);}})[_0x37c0('0x30')](function(_0x1387d8){if(_[_0x37c0('0xab')](_0x5838fa[_0x37c0('0x3d')]['ids'])){for(var _0x13d717=0x0;_0x13d717<_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x59')][_0x37c0('0x45')];_0x13d717+=0x1){_0x106777={'UserId':Number(_0x5838fa['params']['id'])};_0x106777[_[_0x37c0('0x9e')](_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x97')]['toLowerCase']())+'QueueId']=Number(_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x59')][_0x13d717]);socket[_0x37c0('0x1c')](_0x37c0('0x22')+_[_0x37c0('0x9e')](_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x97')][_0x37c0('0x9f')]())+'Queue:remove',_0x106777);}}else{_0x106777={'UserId':Number(_0x5838fa[_0x37c0('0x56')]['id'])};_0x106777[_[_0x37c0('0x9e')](_0x5838fa['query'][_0x37c0('0x97')][_0x37c0('0x9f')]())+'QueueId']=Number(_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x59')]);socket[_0x37c0('0x1c')](_0x37c0('0x22')+_[_0x37c0('0x9e')](_0x5838fa['query'][_0x37c0('0x97')][_0x37c0('0x9f')]())+_0x37c0('0xac'),_0x106777);}return _0x1387d8;})[_0x37c0('0x30')](function(){if(_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x97')]==='voice'){return db[_0x37c0('0xa8')][_0x37c0('0x1e')]({'where':{'UserId':_0x5838fa[_0x37c0('0x56')]['id'],'VoiceQueueId':_0x5838fa[_0x37c0('0x3d')][_0x37c0('0x59')]},'individualHooks':!![]})['then'](function(){return _0xe792d1;});}return _0xe792d1;})[_0x37c0('0x30')](respondWithStatusCode(_0xd8ab50,null))[_0x37c0('0x54')](handleError(_0xd8ab50,null));};exports[_0x37c0('0xad')]=function(_0xba3b4e,_0x24ff62){_0xba3b4e['body'][_0x37c0('0xae')]=_0xba3b4e['file'][_0x37c0('0xaf')];return db[_0x37c0('0x34')]['find']({'where':{'id':_0xba3b4e[_0x37c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x24ff62,null))[_0x37c0('0x30')](saveUpdates(_0xba3b4e[_0x37c0('0x55')],null))['then'](respondWithResult(_0x24ff62,null))['catch'](handleError(_0x24ff62,null));};exports[_0x37c0('0xb0')]=function(_0x4181d1,_0x17644a){var _0x236186=path['join'](config['root'],_0x37c0('0xb1'));return db[_0x37c0('0x34')][_0x37c0('0x2d')]({'where':{'id':_0x4181d1['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x17644a,null))[_0x37c0('0x30')](function(_0x2f339b){if(_0x2f339b){if(_[_0x37c0('0x60')](_0x2f339b['userpic'])){return _0x17644a['download'](_0x236186);}else{if(!fs[_0x37c0('0xb2')](path['join'](config[_0x37c0('0xb3')],'server/files/images/',_0x2f339b[_0x37c0('0xae')]))){return _0x17644a[_0x37c0('0xb4')](_0x236186);}return _0x17644a[_0x37c0('0xb4')](path[_0x37c0('0xb5')](config[_0x37c0('0xb3')],_0x37c0('0xb6'),_0x2f339b[_0x37c0('0xae')]));}}})[_0x37c0('0x54')](handleError(_0x17644a,null));};exports['getOpenTabs']=function(_0x49be5e,_0x56db7e){return db[_0x37c0('0x34')][_0x37c0('0x2d')]({'where':{'id':_0x49be5e[_0x37c0('0x56')]['id']},'attributes':['id']})[_0x37c0('0x30')](handleEntityNotFound(_0x56db7e,null))[_0x37c0('0x30')](function(_0x38b1cc){var _0x18ebc5=[];values=_0x38b1cc[_0x37c0('0x49')];_0x18ebc5[_0x37c0('0x46')](get_open_tabs('chat',_0x38b1cc['dataValues']));_0x18ebc5[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x48'),_0x38b1cc[_0x37c0('0x49')]));_0x18ebc5[_0x37c0('0x46')](get_open_tabs('openchannel',_0x38b1cc[_0x37c0('0x49')]));_0x18ebc5['push'](get_open_tabs(_0x37c0('0x4b'),_0x38b1cc[_0x37c0('0x49')]));_0x18ebc5[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x52'),_0x38b1cc[_0x37c0('0x49')]));_0x18ebc5[_0x37c0('0x46')](get_open_tabs(_0x37c0('0x4a'),_0x38b1cc['dataValues']));return Promise['all'](_0x18ebc5);})[_0x37c0('0x30')](function(_0x58ea9f){if(_0x58ea9f){var _0xc807ae=_[_0x37c0('0x29')](values[_0x37c0('0xb7')],function(_0x236b62){return{'channel':_0x37c0('0xb8'),'id':_0x236b62['id'],'createdAt':_0x236b62[_0x37c0('0xb9')]};});var _0x4a63be=_[_0x37c0('0x29')](values[_0x37c0('0xba')],function(_0x378265){return{'channel':'FAX','id':_0x378265['id'],'createdAt':_0x378265[_0x37c0('0xb9')]};});var _0x4dbb56=_[_0x37c0('0x29')](values[_0x37c0('0xbb')],function(_0x228015){return{'channel':_0x37c0('0xbc'),'id':_0x228015['id'],'createdAt':_0x228015['createdAt']};});var _0x16711e=_['map'](values[_0x37c0('0xbd')],function(_0x315951){return{'channel':'MAIL','id':_0x315951['id'],'createdAt':_0x315951[_0x37c0('0xb9')]};});var _0x431f48=_[_0x37c0('0x29')](values[_0x37c0('0xbe')],function(_0x282f3f){return{'channel':_0x37c0('0xbf'),'id':_0x282f3f['id'],'createdAt':_0x282f3f['createdAt']};});var _0x1fc94f=_[_0x37c0('0x29')](values[_0x37c0('0xc0')],function(_0x23ab6c){return{'channel':'WHATSAPP','id':_0x23ab6c['id'],'createdAt':_0x23ab6c[_0x37c0('0xb9')]};});var _0x1f1bfa=_['concat'](_0xc807ae,_0x4a63be,_0x4dbb56,_0x16711e,_0x431f48,_0x1fc94f);var _0xdbb8b8={'count':_0x1f1bfa[_0x37c0('0x45')],'rows':_0x1f1bfa};return _0xdbb8b8;}else return null;})['then'](respondWithResult(_0x56db7e,null))[_0x37c0('0x54')](handleError(_0x56db7e,null));};exports[_0x37c0('0xc1')]=function(_0xced28c,_0x3b736f){var _0x501a55={};return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0xced28c[_0x37c0('0x56')]['id']}})['then'](function(_0x5c38da){if(!_0x5c38da){throw new APINotFoundError(util['format'](_0x37c0('0xc2'),_0xced28c['params']['id']));}return contacts[_0x37c0('0x57')]();})['then'](function(_0x36de39){_0xced28c[_0x37c0('0x3d')]['User']=_0xced28c[_0x37c0('0x56')]['id'];_0x501a55=qs['getOptions'](_0x36de39,_0xced28c);if(_0xced28c[_0x37c0('0x3d')]['hasOwnProperty'](_0x37c0('0x3e'))){_0x501a55['include']=[{'model':db[_0x37c0('0xc3')],'as':'List','required':![]},{'model':db[_0x37c0('0xc4')],'as':_0x37c0('0xc5'),'attributes':['id',_0x37c0('0x2e'),'color'],'where':_0xced28c[_0x37c0('0x3d')]['tag']?{'id':_0xced28c[_0x37c0('0x3d')][_0x37c0('0xc6')]}:undefined,'required':_0xced28c[_0x37c0('0x3d')]['tag']?!![]:![]}];}return contacts[_0x37c0('0x42')](_0xced28c[_0x37c0('0x3d')],_0xced28c['user'],_0x501a55,_0x36de39);})[_0x37c0('0x30')](respondWithFilteredResult(_0x3b736f,_0x501a55))[_0x37c0('0x54')](APIHandleError(_0x3b736f));};exports[_0x37c0('0xc7')]=function(_0x8935b0,_0x13228d){var _0x1488c2;var _0x598aba={};var _0x31c147;return db['User'][_0x37c0('0x90')]({'where':{'id':_0x8935b0['params']['id']},'attributes':['id',_0x37c0('0x2e'),_0x37c0('0x2c')]})['then'](handleEntityNotFound(_0x13228d,null))['then'](function(_0x3306d4){if(!utils['isValidChannel'](_0x8935b0[_0x37c0('0x3d')]['channel'])){throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))](_0x37c0('0x9c'));}_0x1488c2=_0x3306d4;var _0x5a0535={};_0x5a0535[_0x37c0('0xc8')]=_['keys'](db[_[_0x37c0('0x9e')](_0x8935b0[_0x37c0('0x3d')][_0x37c0('0x97')])+_0x37c0('0xc9')][_0x37c0('0xca')]);_0x5a0535[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x8935b0[_0x37c0('0x3d')]);_0x5a0535[_0x37c0('0xcc')]=_[_0x37c0('0xcd')](_0x5a0535[_0x37c0('0xc8')],_0x5a0535['query']);_0x598aba[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x5a0535[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x8935b0[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x598aba['attributes']=_0x598aba[_0x37c0('0x41')][_0x37c0('0x45')]?_0x598aba[_0x37c0('0x41')]:_0x5a0535[_0x37c0('0xc8')];_0x598aba[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x8935b0[_0x37c0('0x3d')][_0x37c0('0xd0')]);_0x598aba[_0x37c0('0x3c')]=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x8935b0[_0x37c0('0x3d')],_0x5a0535[_0x37c0('0xcc')]));if(_0x8935b0[_0x37c0('0x3d')][_0x37c0('0x27')]){_0x598aba[_0x37c0('0x3c')]=_['merge'](_0x598aba[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x598aba['attributes'],function(_0x58913a){var _0x47d5ba={};_0x47d5ba[_0x58913a]={'$like':'%'+_0x8935b0[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0x47d5ba;})});}_0x598aba=_['merge']({},_0x598aba,_0x8935b0[_0x37c0('0x50')]);switch(_0x1488c2[_0x37c0('0x2c')]){case'admin':return db[_['capitalize'](_0x8935b0[_0x37c0('0x3d')]['channel'])+_0x37c0('0xc9')][_0x37c0('0x42')](_0x598aba);case _0x37c0('0x22'):case'agent':return _0x1488c2['get'+_[_0x37c0('0x9e')](_0x8935b0[_0x37c0('0x3d')][_0x37c0('0x97')])+_0x37c0('0xd2')](_0x598aba);default:throw new db[(_0x37c0('0x8a'))]['ValidationError'](_0x37c0('0xd3'));}})[_0x37c0('0x30')](function(_0x4a7710){_0x31c147=_0x4a7710['length'];if(!_0x8935b0[_0x37c0('0x3d')][_0x37c0('0xd4')]('nolimit')){_0x598aba[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0x8935b0['query']['limit']);_0x598aba[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x8935b0[_0x37c0('0x3d')][_0x37c0('0x16')]);}switch(_0x1488c2[_0x37c0('0x2c')]){case _0x37c0('0x20'):return db[_[_0x37c0('0x9e')](_0x8935b0['query'][_0x37c0('0x97')])+_0x37c0('0xc9')]['findAll'](_0x598aba);case _0x37c0('0x22'):case _0x37c0('0x24'):return _0x1488c2[_0x37c0('0x1f')+_['capitalize'](_0x8935b0[_0x37c0('0x3d')]['channel'])+_0x37c0('0xd2')](_0x598aba);}})['then'](function(_0x2a9076){return{'count':_0x31c147,'rows':_0x2a9076};})[_0x37c0('0x30')](respondWithResult(_0x13228d,null))[_0x37c0('0x54')](handleError(_0x13228d,null));};exports[_0x37c0('0xd5')]=function(_0x589ee1,_0x466f19){var _0x23d509={};var _0x149def={};var _0x2df3ff;var _0x2edec1;return db['User'][_0x37c0('0x90')]({'where':{'id':_0x589ee1[_0x37c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x466f19,null))[_0x37c0('0x30')](function(_0x15b293){if(_0x15b293){_0x2df3ff=_0x15b293;_0x149def['model']=_[_0x37c0('0xcb')](db['UserVoiceQueueRt'][_0x37c0('0xca')]);_0x149def[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x589ee1['query']);_0x149def[_0x37c0('0xcc')]=_[_0x37c0('0xcd')](_0x149def[_0x37c0('0xc8')],_0x149def['query']);_0x23d509[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x149def['model'],qs[_0x37c0('0xce')](_0x589ee1[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x23d509[_0x37c0('0x41')]=_0x23d509[_0x37c0('0x41')][_0x37c0('0x45')]?_0x23d509[_0x37c0('0x41')]:_0x149def[_0x37c0('0xc8')];_0x23d509['order']=qs[_0x37c0('0xd0')](_0x589ee1[_0x37c0('0x3d')][_0x37c0('0xd0')]);_0x23d509[_0x37c0('0x3c')]=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x589ee1[_0x37c0('0x3d')],_0x149def[_0x37c0('0xcc')]));if(_0x589ee1[_0x37c0('0x3d')]['filter']){_0x23d509[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x23d509[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x23d509[_0x37c0('0x41')],function(_0x5609bc){var _0x5bd409={};_0x5bd409[_0x5609bc]={'$like':'%'+_0x589ee1['query'][_0x37c0('0x27')]+'%'};return _0x5bd409;})});}_0x23d509=_[_0x37c0('0x4f')]({},_0x23d509,_0x589ee1[_0x37c0('0x50')]);return _0x2df3ff[_0x37c0('0xd5')](_0x23d509);}})[_0x37c0('0x30')](function(_0x3dce09){if(_0x3dce09){_0x2edec1=_0x3dce09[_0x37c0('0x45')];if(!_0x589ee1[_0x37c0('0x3d')]['hasOwnProperty'](_0x37c0('0xd6'))){_0x23d509['limit']=qs[_0x37c0('0x19')](_0x589ee1[_0x37c0('0x3d')]['limit']);_0x23d509[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x589ee1['query'][_0x37c0('0x16')]);}return _0x2df3ff[_0x37c0('0xd5')](_0x23d509);}})[_0x37c0('0x30')](function(_0x52d6d4){if(_0x52d6d4){return _0x52d6d4?{'count':_0x2edec1,'rows':_0x52d6d4}:null;}})[_0x37c0('0x30')](respondWithResult(_0x466f19,null))[_0x37c0('0x54')](handleError(_0x466f19,null));};exports[_0x37c0('0xd7')]=function(_0x3108dc,_0x57314b){var _0x438eae={};var _0x6a4436={};var _0x327674;var _0x1c8343;return db[_0x37c0('0x34')]['findOne']({'where':{'id':_0x3108dc['params']['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x57314b,null))[_0x37c0('0x30')](function(_0x11a443){if(_0x11a443){_0x327674=_0x11a443;_0x6a4436[_0x37c0('0xc8')]=_[_0x37c0('0xcb')](db[_0x37c0('0xd8')][_0x37c0('0xca')]);_0x6a4436[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x3108dc[_0x37c0('0x3d')]);_0x6a4436[_0x37c0('0xcc')]=_[_0x37c0('0xcd')](_0x6a4436[_0x37c0('0xc8')],_0x6a4436['query']);_0x438eae[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x6a4436[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x3108dc[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x438eae[_0x37c0('0x41')]=_0x438eae['attributes'][_0x37c0('0x45')]?_0x438eae[_0x37c0('0x41')]:_0x6a4436['model'];_0x438eae[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x3108dc['query']['sort']);_0x438eae[_0x37c0('0x3c')]=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x3108dc[_0x37c0('0x3d')],_0x6a4436[_0x37c0('0xcc')]));if(_0x3108dc[_0x37c0('0x3d')][_0x37c0('0x27')]){_0x438eae[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x438eae[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x438eae[_0x37c0('0x41')],function(_0x231b95){var _0x1e45a4={};_0x1e45a4[_0x231b95]={'$like':'%'+_0x3108dc[_0x37c0('0x3d')]['filter']+'%'};return _0x1e45a4;})});}_0x438eae=_[_0x37c0('0x4f')]({},_0x438eae,_0x3108dc['options']);return _0x327674[_0x37c0('0xd7')](_0x438eae);}})[_0x37c0('0x30')](function(_0x3c8516){if(_0x3c8516){_0x1c8343=_0x3c8516[_0x37c0('0x45')];if(!_0x3108dc[_0x37c0('0x3d')]['hasOwnProperty'](_0x37c0('0xd6'))){_0x438eae[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0x3108dc[_0x37c0('0x3d')]['limit']);_0x438eae['offset']=qs[_0x37c0('0x16')](_0x3108dc['query'][_0x37c0('0x16')]);}return _0x327674[_0x37c0('0xd7')](_0x438eae);}})[_0x37c0('0x30')](function(_0x326db3){if(_0x326db3){return _0x326db3?{'count':_0x1c8343,'rows':_0x326db3}:null;}})[_0x37c0('0x30')](respondWithResult(_0x57314b,null))[_0x37c0('0x54')](handleError(_0x57314b,null));};exports[_0x37c0('0xd9')]=function(_0x19a711,_0x4123fa){var _0x9111b={'raw':!![],'where':{}};var _0x511325={};var _0x1b6dff={'count':0x0,'rows':[]};return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0x19a711['params']['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x4123fa,null))['then'](function(_0x5b487e){if(_0x5b487e){_0x511325[_0x37c0('0xc8')]=_[_0x37c0('0xcb')](db[_0x37c0('0xda')][_0x37c0('0xca')]);_0x511325['query']=_[_0x37c0('0xcb')](_0x19a711[_0x37c0('0x3d')]);_0x511325[_0x37c0('0xcc')]=_[_0x37c0('0xcd')](_0x511325[_0x37c0('0xc8')],_0x511325[_0x37c0('0x3d')]);_0x9111b[_0x37c0('0x41')]=_['intersection'](_0x511325[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x19a711['query'][_0x37c0('0xce')]));_0x9111b['attributes']=_0x9111b[_0x37c0('0x41')][_0x37c0('0x45')]?_0x9111b['attributes']:_0x511325[_0x37c0('0xc8')];if(!_0x19a711['query'][_0x37c0('0xd4')](_0x37c0('0xd6'))){_0x9111b[_0x37c0('0x19')]=qs['limit'](_0x19a711[_0x37c0('0x3d')][_0x37c0('0x19')]);_0x9111b[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x19a711[_0x37c0('0x3d')][_0x37c0('0x16')]);}_0x9111b[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x19a711[_0x37c0('0x3d')]['sort']);_0x9111b['where']=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x19a711[_0x37c0('0x3d')],_0x511325['filters']));_0x9111b[_0x37c0('0x3c')][_0x37c0('0xdb')]=_0x5b487e['id'];if(_0x19a711[_0x37c0('0x3d')]['filter']){_0x9111b['where']=_[_0x37c0('0x4f')](_0x9111b[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x9111b['attributes'],function(_0x3a9020){var _0x87a328={};_0x87a328[_0x3a9020]={'$like':'%'+_0x19a711[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0x87a328;})});}_0x9111b=_['merge']({},_0x9111b,_0x19a711[_0x37c0('0x50')]);return db[_0x37c0('0xda')][_0x37c0('0x18')]({'where':_0x9111b[_0x37c0('0x3c')]})[_0x37c0('0x30')](function(_0x1bc49f){_0x1b6dff[_0x37c0('0x18')]=_0x1bc49f;if(_0x19a711[_0x37c0('0x3d')][_0x37c0('0x3e')]){_0x9111b[_0x37c0('0x3f')]=[{'all':!![]}];}return db[_0x37c0('0xda')][_0x37c0('0x42')](_0x9111b);})[_0x37c0('0x30')](function(_0x29ff71){_0x1b6dff[_0x37c0('0x43')]=_0x29ff71;return _0x1b6dff;});}})[_0x37c0('0x30')](respondWithFilteredResult(_0x4123fa,_0x9111b))[_0x37c0('0x54')](handleError(_0x4123fa,null));};exports[_0x37c0('0xdc')]=function(_0x251eab,_0x3a99f0){var _0x25e6ef={'raw':!![],'where':{}};var _0x386c37={};var _0x41cfd5={'count':0x0,'rows':[]};return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0x251eab[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x3a99f0,null))[_0x37c0('0x30')](function(_0x4f7cc5){if(_0x4f7cc5){_0x386c37['model']=_['keys'](db[_0x37c0('0xdd')][_0x37c0('0xca')]);_0x386c37[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x251eab[_0x37c0('0x3d')]);_0x386c37['filters']=_[_0x37c0('0xcd')](_0x386c37[_0x37c0('0xc8')],_0x386c37['query']);_0x25e6ef['attributes']=_[_0x37c0('0xcd')](_0x386c37[_0x37c0('0xc8')],qs['fields'](_0x251eab[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x25e6ef[_0x37c0('0x41')]=_0x25e6ef[_0x37c0('0x41')][_0x37c0('0x45')]?_0x25e6ef[_0x37c0('0x41')]:_0x386c37[_0x37c0('0xc8')];if(!_0x251eab[_0x37c0('0x3d')][_0x37c0('0xd4')](_0x37c0('0xd6'))){_0x25e6ef[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0x251eab[_0x37c0('0x3d')][_0x37c0('0x19')]);_0x25e6ef[_0x37c0('0x16')]=qs['offset'](_0x251eab[_0x37c0('0x3d')]['offset']);}_0x25e6ef[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x251eab[_0x37c0('0x3d')][_0x37c0('0xd0')]);_0x25e6ef[_0x37c0('0x3c')]=qs[_0x37c0('0xcc')](_['pick'](_0x251eab[_0x37c0('0x3d')],_0x386c37[_0x37c0('0xcc')]));_0x25e6ef[_0x37c0('0x3c')][_0x37c0('0xdb')]=_0x4f7cc5['id'];if(_0x251eab['query']['filter']){_0x25e6ef[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x25e6ef[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x25e6ef[_0x37c0('0x41')],function(_0x53d087){var _0x3dd3c7={};_0x3dd3c7[_0x53d087]={'$like':'%'+_0x251eab[_0x37c0('0x3d')]['filter']+'%'};return _0x3dd3c7;})});}_0x25e6ef=_['merge']({},_0x25e6ef,_0x251eab['options']);return db[_0x37c0('0xdd')][_0x37c0('0x18')]({'where':_0x25e6ef['where']})[_0x37c0('0x30')](function(_0x3c8eae){_0x41cfd5[_0x37c0('0x18')]=_0x3c8eae;if(_0x251eab[_0x37c0('0x3d')][_0x37c0('0x3e')]){_0x25e6ef[_0x37c0('0x3f')]=[{'all':!![]}];}return db[_0x37c0('0xdd')]['findAll'](_0x25e6ef);})[_0x37c0('0x30')](function(_0xca1e11){_0x41cfd5['rows']=_0xca1e11;return _0x41cfd5;});}})['then'](respondWithFilteredResult(_0x3a99f0,_0x25e6ef))[_0x37c0('0x54')](handleError(_0x3a99f0,null));};exports[_0x37c0('0xde')]=function(_0x1a6d4c,_0x250445){var _0x1c1923={};var _0x46f050={};var _0x6de1ae;var _0x73f9ea;return db['User'][_0x37c0('0x90')]({'where':{'id':_0x1a6d4c[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x250445,null))['then'](function(_0x21d0e4){if(_0x21d0e4){_0x6de1ae=_0x21d0e4;_0x46f050['model']=_[_0x37c0('0xcb')](db[_0x37c0('0xdf')][_0x37c0('0xca')]);_0x46f050['query']=_[_0x37c0('0xcb')](_0x1a6d4c['query']);_0x46f050[_0x37c0('0xcc')]=_[_0x37c0('0xcd')](_0x46f050[_0x37c0('0xc8')],_0x46f050[_0x37c0('0x3d')]);_0x1c1923[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x46f050[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x1a6d4c['query'][_0x37c0('0xce')]));_0x1c1923[_0x37c0('0x41')]=_0x1c1923['attributes'][_0x37c0('0x45')]?_0x1c1923[_0x37c0('0x41')]:_0x46f050['model'];_0x1c1923[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x1a6d4c[_0x37c0('0x3d')][_0x37c0('0xd0')]);_0x1c1923[_0x37c0('0x3c')]=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x1a6d4c['query'],_0x46f050[_0x37c0('0xcc')]));if(_0x1a6d4c[_0x37c0('0x3d')][_0x37c0('0x27')]){_0x1c1923[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x1c1923[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x1c1923[_0x37c0('0x41')],function(_0x2e0861){var _0x59f2b3={};_0x59f2b3[_0x2e0861]={'$like':'%'+_0x1a6d4c[_0x37c0('0x3d')]['filter']+'%'};return _0x59f2b3;})});}_0x1c1923=_[_0x37c0('0x4f')]({},_0x1c1923,_0x1a6d4c[_0x37c0('0x50')]);return _0x6de1ae[_0x37c0('0xde')](_0x1c1923);}})['then'](function(_0x56bd1e){if(_0x56bd1e){_0x73f9ea=_0x56bd1e['length'];if(!_0x1a6d4c[_0x37c0('0x3d')]['hasOwnProperty'](_0x37c0('0xd6'))){_0x1c1923[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0x1a6d4c['query'][_0x37c0('0x19')]);_0x1c1923[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x1a6d4c[_0x37c0('0x3d')][_0x37c0('0x16')]);}return _0x6de1ae[_0x37c0('0xde')](_0x1c1923);}})[_0x37c0('0x30')](function(_0x1a519e){if(_0x1a519e){return _0x1a519e?{'count':_0x73f9ea,'rows':_0x1a519e}:null;}})['then'](respondWithResult(_0x250445,null))['catch'](handleError(_0x250445,null));};exports[_0x37c0('0xe0')]=function(_0x309f03,_0x5a2b60){var _0x3669db={};var _0x57bfa0={};var _0x2aa8c5;var _0x1ee051;return db['User']['findOne']({'where':{'id':_0x309f03[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x5a2b60,null))['then'](function(_0x30c9ae){if(_0x30c9ae){_0x2aa8c5=_0x30c9ae;_0x57bfa0[_0x37c0('0xc8')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x57bfa0[_0x37c0('0x3d')]=_['keys'](_0x309f03[_0x37c0('0x3d')]);_0x57bfa0['filters']=_[_0x37c0('0xcd')](_0x57bfa0[_0x37c0('0xc8')],_0x57bfa0[_0x37c0('0x3d')]);_0x3669db[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x57bfa0[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x309f03[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x3669db['attributes']=_0x3669db[_0x37c0('0x41')][_0x37c0('0x45')]?_0x3669db[_0x37c0('0x41')]:_0x57bfa0[_0x37c0('0xc8')];_0x3669db[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x309f03[_0x37c0('0x3d')][_0x37c0('0xd0')]);_0x3669db[_0x37c0('0x3c')]=qs['filters'](_[_0x37c0('0xd1')](_0x309f03[_0x37c0('0x3d')],_0x57bfa0['filters']));if(_0x309f03[_0x37c0('0x3d')][_0x37c0('0x27')]){_0x3669db[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x3669db[_0x37c0('0x3c')],{'$or':_['map'](_0x3669db[_0x37c0('0x41')],function(_0x119136){var _0x4918e3={};_0x4918e3[_0x119136]={'$like':'%'+_0x309f03[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0x4918e3;})});}_0x3669db=_[_0x37c0('0x4f')]({},_0x3669db,_0x309f03['options']);return _0x2aa8c5[_0x37c0('0xe0')](_0x3669db);}})[_0x37c0('0x30')](function(_0xd63111){if(_0xd63111){_0x1ee051=_0xd63111['length'];if(!_0x309f03[_0x37c0('0x3d')]['hasOwnProperty'](_0x37c0('0xd6'))){_0x3669db['limit']=qs[_0x37c0('0x19')](_0x309f03[_0x37c0('0x3d')][_0x37c0('0x19')]);_0x3669db[_0x37c0('0x16')]=qs['offset'](_0x309f03['query'][_0x37c0('0x16')]);}return _0x2aa8c5[_0x37c0('0xe0')](_0x3669db);}})[_0x37c0('0x30')](function(_0x21d050){if(_0x21d050){return _0x21d050?{'count':_0x1ee051,'rows':_0x21d050}:null;}})[_0x37c0('0x30')](respondWithResult(_0x5a2b60,null))['catch'](handleError(_0x5a2b60,null));};exports[_0x37c0('0xe1')]=function(_0x410faa,_0x37ae92){var _0x3dd551={'raw':!![],'where':{}};var _0x5d7cd1={};var _0x57024e={'count':0x0,'rows':[]};return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0x410faa[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x37ae92,null))[_0x37c0('0x30')](function(_0x293866){if(_0x293866){_0x5d7cd1[_0x37c0('0xc8')]=_[_0x37c0('0xcb')](db['MailInteraction'][_0x37c0('0xca')]);_0x5d7cd1['query']=_[_0x37c0('0xcb')](_0x410faa[_0x37c0('0x3d')]);_0x5d7cd1['filters']=_[_0x37c0('0xcd')](_0x5d7cd1[_0x37c0('0xc8')],_0x5d7cd1['query']);_0x3dd551[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x5d7cd1[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x410faa[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x3dd551[_0x37c0('0x41')]=_0x3dd551['attributes'][_0x37c0('0x45')]?_0x3dd551[_0x37c0('0x41')]:_0x5d7cd1['model'];if(!_0x410faa[_0x37c0('0x3d')][_0x37c0('0xd4')](_0x37c0('0xd6'))){_0x3dd551[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0x410faa[_0x37c0('0x3d')]['limit']);_0x3dd551[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x410faa[_0x37c0('0x3d')][_0x37c0('0x16')]);}_0x3dd551[_0x37c0('0xcf')]=qs['sort'](_0x410faa['query']['sort']);_0x3dd551[_0x37c0('0x3c')]=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x410faa[_0x37c0('0x3d')],_0x5d7cd1[_0x37c0('0xcc')]));_0x3dd551[_0x37c0('0x3c')][_0x37c0('0xdb')]=_0x293866['id'];if(_0x410faa[_0x37c0('0x3d')]['filter']){_0x3dd551[_0x37c0('0x3c')]=_['merge'](_0x3dd551[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x3dd551[_0x37c0('0x41')],function(_0x33589a){var _0x2f812={};_0x2f812[_0x33589a]={'$like':'%'+_0x410faa[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0x2f812;})});}_0x3dd551=_[_0x37c0('0x4f')]({},_0x3dd551,_0x410faa[_0x37c0('0x50')]);return db[_0x37c0('0xe2')][_0x37c0('0x18')]({'where':_0x3dd551['where']})[_0x37c0('0x30')](function(_0xbade51){_0x57024e[_0x37c0('0x18')]=_0xbade51;if(_0x410faa[_0x37c0('0x3d')][_0x37c0('0x3e')]){_0x3dd551['include']=[{'all':!![]}];}return db[_0x37c0('0xe2')]['findAll'](_0x3dd551);})[_0x37c0('0x30')](function(_0x3d180d){_0x57024e['rows']=_0x3d180d;return _0x57024e;});}})[_0x37c0('0x30')](respondWithFilteredResult(_0x37ae92,_0x3dd551))[_0x37c0('0x54')](handleError(_0x37ae92,null));};exports[_0x37c0('0xe3')]=function(_0x10b526,_0x30508e){var _0x770cd4={};var _0x129905={};var _0x1a4965;var _0x577a85;return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0x10b526[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x30508e,null))[_0x37c0('0x30')](function(_0x55e932){if(_0x55e932){_0x1a4965=_0x55e932;_0x129905[_0x37c0('0xc8')]=_[_0x37c0('0xcb')](db[_0x37c0('0xe4')]['rawAttributes']);_0x129905[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x10b526[_0x37c0('0x3d')]);_0x129905[_0x37c0('0xcc')]=_['intersection'](_0x129905[_0x37c0('0xc8')],_0x129905['query']);_0x770cd4[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x129905['model'],qs[_0x37c0('0xce')](_0x10b526[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x770cd4['attributes']=_0x770cd4['attributes']['length']?_0x770cd4[_0x37c0('0x41')]:_0x129905[_0x37c0('0xc8')];_0x770cd4[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x10b526[_0x37c0('0x3d')][_0x37c0('0xd0')]);_0x770cd4['where']=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x10b526[_0x37c0('0x3d')],_0x129905[_0x37c0('0xcc')]));if(_0x10b526['query']['filter']){_0x770cd4[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x770cd4['where'],{'$or':_[_0x37c0('0x29')](_0x770cd4['attributes'],function(_0x572bd8){var _0xb90617={};_0xb90617[_0x572bd8]={'$like':'%'+_0x10b526[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0xb90617;})});}_0x770cd4=_[_0x37c0('0x4f')]({},_0x770cd4,_0x10b526['options']);return _0x1a4965[_0x37c0('0xe3')](_0x770cd4);}})['then'](function(_0x5a8800){if(_0x5a8800){_0x577a85=_0x5a8800[_0x37c0('0x45')];if(!_0x10b526[_0x37c0('0x3d')][_0x37c0('0xd4')]('nolimit')){_0x770cd4[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0x10b526[_0x37c0('0x3d')][_0x37c0('0x19')]);_0x770cd4[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x10b526[_0x37c0('0x3d')][_0x37c0('0x16')]);}return _0x1a4965['getSmsInteractions'](_0x770cd4);}})[_0x37c0('0x30')](function(_0x42e196){if(_0x42e196){return _0x42e196?{'count':_0x577a85,'rows':_0x42e196}:null;}})['then'](respondWithResult(_0x30508e,null))['catch'](handleError(_0x30508e,null));};exports[_0x37c0('0xe5')]=function(_0xfd52ed,_0x3bd052){var _0x196682={};var _0x566de5={};var _0x176230;var _0x27db1d;return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0xfd52ed[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x3bd052,null))['then'](function(_0x6c3991){if(_0x6c3991){_0x176230=_0x6c3991;_0x566de5[_0x37c0('0xc8')]=_['keys'](db[_0x37c0('0xe6')][_0x37c0('0xca')]);_0x566de5['query']=_['keys'](_0xfd52ed['query']);_0x566de5[_0x37c0('0xcc')]=_[_0x37c0('0xcd')](_0x566de5['model'],_0x566de5[_0x37c0('0x3d')]);_0x196682[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x566de5['model'],qs[_0x37c0('0xce')](_0xfd52ed[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x196682[_0x37c0('0x41')]=_0x196682[_0x37c0('0x41')][_0x37c0('0x45')]?_0x196682[_0x37c0('0x41')]:_0x566de5['model'];_0x196682[_0x37c0('0xcf')]=qs['sort'](_0xfd52ed[_0x37c0('0x3d')][_0x37c0('0xd0')]);_0x196682['where']=qs['filters'](_['pick'](_0xfd52ed[_0x37c0('0x3d')],_0x566de5['filters']));if(_0xfd52ed[_0x37c0('0x3d')][_0x37c0('0x27')]){_0x196682[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x196682['where'],{'$or':_[_0x37c0('0x29')](_0x196682[_0x37c0('0x41')],function(_0x1bcc9d){var _0x33df91={};_0x33df91[_0x1bcc9d]={'$like':'%'+_0xfd52ed[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0x33df91;})});}_0x196682=_[_0x37c0('0x4f')]({},_0x196682,_0xfd52ed[_0x37c0('0x50')]);return _0x176230[_0x37c0('0xe5')](_0x196682);}})[_0x37c0('0x30')](function(_0xcaad22){if(_0xcaad22){_0x27db1d=_0xcaad22[_0x37c0('0x45')];if(!_0xfd52ed[_0x37c0('0x3d')][_0x37c0('0xd4')](_0x37c0('0xd6'))){_0x196682[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0xfd52ed[_0x37c0('0x3d')][_0x37c0('0x19')]);_0x196682[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0xfd52ed['query'][_0x37c0('0x16')]);}return _0x176230['getFaxInteractions'](_0x196682);}})[_0x37c0('0x30')](function(_0x176da3){if(_0x176da3){return _0x176da3?{'count':_0x27db1d,'rows':_0x176da3}:null;}})[_0x37c0('0x30')](respondWithResult(_0x3bd052,null))[_0x37c0('0x54')](handleError(_0x3bd052,null));};exports['getWhatsappInteractions']=function(_0x23c903,_0x54ec77){var _0x26a87b={};var _0x4912e7={};var _0xcc329b;var _0x1e159a;return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0x23c903[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x54ec77,null))['then'](function(_0x786271){if(_0x786271){_0xcc329b=_0x786271;_0x4912e7['model']=_[_0x37c0('0xcb')](db[_0x37c0('0xe7')][_0x37c0('0xca')]);_0x4912e7[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x23c903[_0x37c0('0x3d')]);_0x4912e7['filters']=_[_0x37c0('0xcd')](_0x4912e7[_0x37c0('0xc8')],_0x4912e7[_0x37c0('0x3d')]);_0x26a87b[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x4912e7[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x23c903[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x26a87b[_0x37c0('0x41')]=_0x26a87b['attributes'][_0x37c0('0x45')]?_0x26a87b[_0x37c0('0x41')]:_0x4912e7[_0x37c0('0xc8')];_0x26a87b[_0x37c0('0xcf')]=qs['sort'](_0x23c903['query'][_0x37c0('0xd0')]);_0x26a87b[_0x37c0('0x3c')]=qs['filters'](_[_0x37c0('0xd1')](_0x23c903[_0x37c0('0x3d')],_0x4912e7['filters']));if(_0x23c903[_0x37c0('0x3d')][_0x37c0('0x27')]){_0x26a87b[_0x37c0('0x3c')]=_[_0x37c0('0x4f')](_0x26a87b[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0x26a87b['attributes'],function(_0x581e81){var _0x125bf2={};_0x125bf2[_0x581e81]={'$like':'%'+_0x23c903[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0x125bf2;})});}_0x26a87b=_[_0x37c0('0x4f')]({},_0x26a87b,_0x23c903[_0x37c0('0x50')]);return _0xcc329b['getWhatsappInteractions'](_0x26a87b);}})['then'](function(_0x61c04e){if(_0x61c04e){_0x1e159a=_0x61c04e[_0x37c0('0x45')];if(!_0x23c903[_0x37c0('0x3d')]['hasOwnProperty'](_0x37c0('0xd6'))){_0x26a87b[_0x37c0('0x19')]=qs[_0x37c0('0x19')](_0x23c903[_0x37c0('0x3d')][_0x37c0('0x19')]);_0x26a87b['offset']=qs[_0x37c0('0x16')](_0x23c903[_0x37c0('0x3d')][_0x37c0('0x16')]);}return _0xcc329b['getWhatsappInteractions'](_0x26a87b);}})[_0x37c0('0x30')](function(_0x5583ef){if(_0x5583ef){return _0x5583ef?{'count':_0x1e159a,'rows':_0x5583ef}:null;}})[_0x37c0('0x30')](respondWithResult(_0x54ec77,null))['catch'](handleError(_0x54ec77,null));};exports[_0x37c0('0xe8')]=function(_0x37f0a0,_0x506509,_0x2d27ad){var _0x5872d0;var _0x17f2b7;var _0x1d899c;var _0x4ed47f=!_['isNil'](_0x37f0a0[_0x37c0('0x56')]['id'])?_0x37f0a0[_0x37c0('0x56')]['id']:!_[_0x37c0('0x60')](_0x37f0a0[_0x37c0('0x22')]['id'])?_0x37f0a0[_0x37c0('0x22')]['id']:null;return db[_0x37c0('0x34')][_0x37c0('0x2d')]({'where':{'id':_0x4ed47f,'role':{'$or':['admin','user',_0x37c0('0x24')]}},'attributes':['id','name',_0x37c0('0xe9'),_0x37c0('0xea'),_0x37c0('0x2c'),'internal',_0x37c0('0x99')]})['then'](function(_0x132ae0){if(_0x132ae0){if(_0x132ae0['role']===_0x37c0('0x24')){_0x5872d0=_0x132ae0;if(_0x37f0a0[_0x37c0('0x55')][_0x37c0('0x9b')]){_0x1d899c=util[_0x37c0('0xa6')]('LOCAL/%s@from-sip/n',_0x5872d0[_0x37f0a0[_0x37c0('0x55')][_0x37c0('0x9b')]]);}else if(_0x37f0a0['body'][_0x37c0('0xeb')]){_0x1d899c=util[_0x37c0('0xa6')]('SIP/%s',_0x37f0a0[_0x37c0('0x55')][_0x37c0('0xeb')]);}else{_0x1d899c=util[_0x37c0('0xa6')]('SIP/%s',_0x5872d0['name']);}socket['to'](util[_0x37c0('0xa6')](_0x37c0('0xec'),_0x5872d0['name']))[_0x37c0('0x1c')](_0x37c0('0xed'),{'user':{'id':_0x5872d0['id'],'name':_0x5872d0[_0x37c0('0x2e')]},'ip':_0x37f0a0[_0x37c0('0xee')][_0x37c0('0xef')]||_0x37f0a0[_0x37c0('0xf0')][_0x37c0('0xf1')]||_0x37f0a0['socket'][_0x37c0('0xf1')]||_0x37f0a0['connection'][_0x37c0('0xf2')][_0x37c0('0xf1')]});return db[_0x37c0('0xa8')][_0x37c0('0x1e')]({'where':{'membername':_0x5872d0[_0x37c0('0x2e')]},'individualHooks':!![]});}}else{throw new db[(_0x37c0('0x8a'))][(_0x37c0('0x8b'))](_0x37c0('0xf3'));}})[_0x37c0('0x30')](function(){if(_0x5872d0){return _0x5872d0[_0x37c0('0xf4')]({'raw':!![]});}})[_0x37c0('0x30')](function(_0x3f3d70){if(_0x5872d0){if(_0x3f3d70){_0x17f2b7=_0x3f3d70;if(_0x17f2b7[_0x37c0('0x45')]){var _0x487000=_0x17f2b7[_0x37c0('0x29')](function(_0xf60346){var _0x408ab6={'membername':_0x5872d0[_0x37c0('0x2e')],'UserId':_0x5872d0['id'],'queue_name':_0xf60346[_0x37c0('0x2e')],'VoiceQueueId':_0xf60346['id'],'interface':_0x1d899c,'paused':_0x5872d0[_0x37c0('0x99')]||![],'penalty':_0xf60346[_0x37c0('0xf5')]||0x0};return db['UserVoiceQueueRt'][_0x37c0('0xa9')](_0x408ab6);});return Promise[_0x37c0('0x53')](_0x487000);}}}})[_0x37c0('0x30')](function(){if(_0x5872d0){return db[_0x37c0('0xf6')][_0x37c0('0x42')]({'where':{'membername':_0x5872d0['name'],'exitAt':null}});}})[_0x37c0('0x30')](function(_0x14e5b0){if(_0x5872d0){var _0x561597=[];_0x14e5b0[_0x37c0('0xf7')](function(_0x444ae4){_0x561597[_0x37c0('0x46')](_0x444ae4['update']({'exitAt':moment()['format'](_0x37c0('0xf8'))}));});return Promise['all'](_0x561597);}})[_0x37c0('0x30')](function(){if(_0x5872d0){var _0x54d050=[];var _0x4f49d8=[];var _0x4cc024=utils['getChannels']();var _0xfb15f0={'membername':_0x5872d0[_0x37c0('0x2e')],'interface':_0x1d899c,'enterAt':moment()[_0x37c0('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5872d0['role'],'internal':_0x5872d0['internal']};_0x4cc024[_0x37c0('0xf7')](function(_0x4ea69e){_0x54d050[_0x37c0('0x46')](_[_0x37c0('0x4f')]({'channel':_0x4ea69e,'type':_0x37c0('0xf9'),'data1':_0x37f0a0['body']['device'],'data2':_0x1d899c},_0xfb15f0));if(_0x5872d0[_0x37c0('0x99')]){_0x4f49d8[_0x37c0('0x46')](_[_0x37c0('0x4f')]({'channel':_0x4ea69e,'type':'PAUSE','data1':_0x37c0('0xfa')},_0xfb15f0));}});return db['MemberReport'][_0x37c0('0xfb')](_0x54d050[_0x37c0('0xfc')](_0x4f49d8),{'individualHooks':!![]});}})[_0x37c0('0x30')](function(){if(_0x5872d0){return _0x5872d0['update']({'online':!![],'lastLoginAt':moment()[_0x37c0('0xa6')](_0x37c0('0xf8')),'voicePause':_0x5872d0[_0x37c0('0x99')]||![],'mailPause':_0x5872d0[_0x37c0('0x99')]||![],'chatPause':_0x5872d0['loginInPause']||![],'faxPause':_0x5872d0[_0x37c0('0x99')]||![],'smsPause':_0x5872d0[_0x37c0('0x99')]||![],'openchannelPause':_0x5872d0['loginInPause']||![],'whatsappPause':_0x5872d0[_0x37c0('0x99')]||![],'pauseType':_0x5872d0[_0x37c0('0x99')]?_0x37c0('0xfa'):null,'interface':_0x1d899c,'lastPauseAt':moment()[_0x37c0('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x37c0('0x30')](function(_0x5d1e6){if(_0x37f0a0['isMiddleware']){return _0x2d27ad();}else{return Promise['resolve'](_0x5d1e6)['then'](respondWithResult(_0x506509,null));}})[_0x37c0('0x54')](handleError(_0x506509,null));};exports['logout']=function(_0x39e821,_0x3075cb){var _0x5d9962;return db[_0x37c0('0x34')][_0x37c0('0x2d')]({'where':{'id':_0x39e821[_0x37c0('0x56')]['id'],'role':_0x37c0('0x24')},'attributes':['id',_0x37c0('0x2e'),_0x37c0('0x2c')]})[_0x37c0('0x30')](handleEntityNotFound(_0x3075cb,null))[_0x37c0('0x30')](function(_0x340109){if(_0x340109){_0x5d9962=_0x340109;return db[_0x37c0('0xa8')][_0x37c0('0x1e')]({'where':{'membername':_0x5d9962[_0x37c0('0x2e')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x37c0('0x42')]({'where':{'membername':_0x5d9962['name'],'exitAt':null}});})[_0x37c0('0x30')](function(_0x28756){var _0x59fcfa=[];_0x28756[_0x37c0('0xf7')](function(_0x549ff7){_0x59fcfa[_0x37c0('0x46')](_0x549ff7[_0x37c0('0x1b')]({'exitAt':moment()[_0x37c0('0xa6')](_0x37c0('0xf8'))}));});return Promise[_0x37c0('0x53')](_0x59fcfa);})['then'](function(){return _0x5d9962[_0x37c0('0x1b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x37c0('0x30')](respondWithResult(_0x3075cb,null))[_0x37c0('0x54')](handleError(_0x3075cb,null));};exports[_0x37c0('0xfd')]=function(_0x3d8e62,_0x571832){var _0x406567;return db[_0x37c0('0xa8')][_0x37c0('0x1b')]({'paused':0x1},{'where':{'UserId':_0x3d8e62[_0x37c0('0x56')]['id']},'individualHooks':!![]})[_0x37c0('0x30')](function(){return db['User'][_0x37c0('0x2d')]({'where':{'id':_0x3d8e62[_0x37c0('0x56')]['id'],'role':_0x37c0('0x24')},'attributes':['id','name','role',_0x37c0('0x5b'),_0x37c0('0x9b'),_0x37c0('0x98')]});})[_0x37c0('0x30')](handleEntityNotFound(_0x571832,null))[_0x37c0('0x30')](function(_0x33089c){if(_0x33089c){_0x406567=_0x33089c;return db[_0x37c0('0xf6')][_0x37c0('0x42')]({'where':{'membername':_0x406567['name'],'type':'PAUSE','exitAt':null}});}})[_0x37c0('0x30')](function(_0x2b0555){if(_0x2b0555[_0x37c0('0x45')]){var _0x17faab=moment()['format'](_0x37c0('0xf8'));for(var _0x460ab9=0x0,_0x50c301=_0x2b0555[_0x37c0('0x45')];_0x460ab9<_0x50c301;_0x460ab9++){_0x2b0555[_0x460ab9][_0x37c0('0xfe')]({'exitAt':_0x17faab});}}})['then'](function(){var _0x4901f5=[];var _0x2934bc=utils[_0x37c0('0xff')]();_0x2934bc[_0x37c0('0xf7')](function(_0x5c6b85){_0x4901f5[_0x37c0('0x46')]({'channel':_0x5c6b85,'membername':_0x406567[_0x37c0('0x2e')],'interface':_[_0x37c0('0x60')](_0x406567[_0x37c0('0x9b')])?util['format'](_0x37c0('0xa7'),_0x406567[_0x37c0('0x2e')]):_0x406567['interface'],'type':_0x37c0('0x100'),'enterAt':moment()[_0x37c0('0xa6')](_0x37c0('0xf8')),'data1':_0x3d8e62['body'][_0x37c0('0x36')]||_0x37c0('0x101'),'role':_0x406567[_0x37c0('0x2c')],'internal':_0x406567['internal']});});return db[_0x37c0('0xf6')][_0x37c0('0xfb')](_0x4901f5,{'individualHooks':!![]});})[_0x37c0('0x30')](function(){return _0x406567[_0x37c0('0x1b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3d8e62[_0x37c0('0x55')][_0x37c0('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x37c0('0xa6')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x37c0('0x30')](respondWithResult(_0x571832,null))[_0x37c0('0x54')](handleError(_0x571832,null));};exports[_0x37c0('0x102')]=function(_0x2d484d,_0x4a9bd9){if(_0x2d484d[_0x37c0('0x55')][_0x37c0('0x97')]&&!utils[_0x37c0('0x103')](_0x2d484d[_0x37c0('0x55')]['channel'])){throw new APIBadRequestError(util[_0x37c0('0xa6')](_0x37c0('0x104'),_0x2d484d[_0x37c0('0x55')][_0x37c0('0x97')]));}return db[_0x37c0('0x34')]['find']({'where':{'id':_0x2d484d[_0x37c0('0x56')]['id']},'attributes':['id','name',_0x37c0('0x2c'),_0x37c0('0x5b'),'interface','online',_0x37c0('0x9a'),'mailPause',_0x37c0('0x105'),'faxPause','openchannelPause',_0x37c0('0x106'),'whatsappPause',_0x37c0('0x107'),_0x37c0('0x108')]})[_0x37c0('0x30')](function(_0xd3f91c){if(!_0xd3f91c){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x2d484d[_0x37c0('0x56')]['id']));}return _0xd3f91c[_0x37c0('0x102')](_0x2d484d[_0x37c0('0x55')][_0x37c0('0x97')]);})['then'](respondWithResult(_0x4a9bd9,null))[_0x37c0('0x54')](APIHandleError(_0x4a9bd9));};exports['getTeams']=function(_0x47feb9,_0x1edb16){var _0x5c058e={};var _0x8c1dbb={};var _0x3b3304;var _0x1e89f3;return db[_0x37c0('0x34')]['findOne']({'where':{'id':_0x47feb9[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x1edb16,null))[_0x37c0('0x30')](function(_0x5773d1){if(_0x5773d1){_0x3b3304=_0x5773d1;_0x8c1dbb[_0x37c0('0xc8')]=_[_0x37c0('0xcb')](db[_0x37c0('0x109')]['rawAttributes']);_0x8c1dbb[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x47feb9['query']);_0x8c1dbb['filters']=_[_0x37c0('0xcd')](_0x8c1dbb[_0x37c0('0xc8')],_0x8c1dbb[_0x37c0('0x3d')]);_0x5c058e[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0x8c1dbb[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x47feb9[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x5c058e[_0x37c0('0x41')]=_0x5c058e[_0x37c0('0x41')][_0x37c0('0x45')]?_0x5c058e[_0x37c0('0x41')]:_0x8c1dbb[_0x37c0('0xc8')];_0x5c058e[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x47feb9[_0x37c0('0x3d')]['sort']);_0x5c058e['where']=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x47feb9[_0x37c0('0x3d')],_0x8c1dbb[_0x37c0('0xcc')]));if(_0x47feb9[_0x37c0('0x3d')]['filter']){_0x5c058e[_0x37c0('0x3c')]=_['merge'](_0x5c058e[_0x37c0('0x3c')],{'$or':_['map'](_0x5c058e[_0x37c0('0x41')],function(_0x5e5295){var _0x585d9d={};_0x585d9d[_0x5e5295]={'$like':'%'+_0x47feb9['query'][_0x37c0('0x27')]+'%'};return _0x585d9d;})});}_0x5c058e=_[_0x37c0('0x4f')]({},_0x5c058e,_0x47feb9[_0x37c0('0x50')]);return _0x3b3304['getTeams'](_0x5c058e);}})[_0x37c0('0x30')](function(_0x310d16){if(_0x310d16){_0x1e89f3=_0x310d16[_0x37c0('0x45')];if(!_0x47feb9[_0x37c0('0x3d')]['hasOwnProperty'](_0x37c0('0xd6'))){_0x5c058e['limit']=qs[_0x37c0('0x19')](_0x47feb9[_0x37c0('0x3d')][_0x37c0('0x19')]);_0x5c058e[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x47feb9[_0x37c0('0x3d')][_0x37c0('0x16')]);}return _0x3b3304['getTeams'](_0x5c058e);}})['then'](function(_0x4836d7){if(_0x4836d7){return _0x4836d7?{'count':_0x1e89f3,'rows':_0x4836d7}:null;}})['then'](respondWithResult(_0x1edb16,null))[_0x37c0('0x54')](handleError(_0x1edb16,null));};exports[_0x37c0('0x10a')]=function(_0x5c3587,_0x42179a){var _0x29baf8=_0x5c3587[_0x37c0('0x56')]['id'];var _0x2933e6=_0x5c3587[_0x37c0('0x55')]?_0x5c3587[_0x37c0('0x55')][_0x37c0('0x59')]:null;var _0x3c31b4=[];return Promise[_0x37c0('0x10b')]()[_0x37c0('0x30')](function(){if(!_0x2933e6)throw new APIBadRequestError(_0x37c0('0x10c'));})[_0x37c0('0x30')](function(){return db[_0x37c0('0x34')][_0x37c0('0x90')]({'where':{'id':_0x29baf8}});})[_0x37c0('0x30')](function(_0x46651f){if(!_0x46651f)throw new APINotFoundError(util[_0x37c0('0xa6')](_0x37c0('0xc2'),_0x5c3587['params']['id']));return db[_0x37c0('0x63')][_0x37c0('0x10d')](function(_0x3529ad){return _0x46651f['addTeams'](_0x2933e6,{'transaction':_0x3529ad})['then'](function(){return db[_0x37c0('0x109')][_0x37c0('0x42')]({'where':{'id':{'$in':_0x2933e6}}});})[_0x37c0('0x30')](function(_0x53d620){var _0x5903e1=_[_0x37c0('0x29')](_0x53d620,function(_0x489979){return _0x489979[_0x37c0('0x10e')]();});return Promise[_0x37c0('0x53')](_0x5903e1);})[_0x37c0('0x30')](function(_0x3fa9cc){_0x3c31b4=_['flattenDeep'](_0x3fa9cc);var _0x55b104=_['map'](_0x3c31b4,function(_0x2dd44d){return _0x2dd44d[_0x37c0('0x10f')](_0x46651f['id'],{'transaction':_0x3529ad});});return Promise[_0x37c0('0x53')](_0x55b104);})[_0x37c0('0x30')](function(){if(!_0x46651f[_0x37c0('0x98')])return;var _0x1fc33b=_['filter'](_0x3c31b4,function(_0x59dd71){return _0x59dd71[_0x37c0('0x110')](_0x37c0('0x97'))===_0x37c0('0x111');});var _0x355e9b=_[_0x37c0('0x29')](_0x1fc33b,function(_0x13351a){return db['UserVoiceQueueRt'][_0x37c0('0xa9')]({'membername':_0x46651f[_0x37c0('0x2e')],'UserId':_0x46651f['id'],'queue_name':_0x13351a[_0x37c0('0x2e')],'VoiceQueueId':_0x13351a['id'],'interface':_[_0x37c0('0x60')](_0x46651f[_0x37c0('0x9b')])?util[_0x37c0('0xa6')](_0x37c0('0xa7'),_0x46651f['name']):_0x46651f[_0x37c0('0x9b')],'paused':_0x46651f[_0x37c0('0x9a')]||![],'penalty':_0x46651f[_0x37c0('0xa0')]},{'transaction':_0x3529ad});});return Promise[_0x37c0('0x53')](_0x355e9b);})['then'](function(){return db[_0x37c0('0x112')][_0x37c0('0x42')]({'where':{'teamId':{'$in':_0x2933e6}}});})['then'](function(_0x5495ac){var _0xe4a163=_[_0x37c0('0x29')](_0x5495ac,function(_0x3b019d){return db['UserVoicePrefix'][_0x37c0('0x79')]({'UserId':_0x46651f['id'],'VoicePrefixId':_0x3b019d['VoicePrefixId']},{'transaction':_0x3529ad});});return Promise['all'](_0xe4a163);});});})['then'](function(){for(var _0x5287d5=0x0;_0x5287d5<_0x3c31b4[_0x37c0('0x45')];_0x5287d5++){var _0x486dd8=_0x3c31b4[_0x5287d5][_0x37c0('0x110')](_0x37c0('0x97'));var _0x54dc5e=_0x486dd8+_0x37c0('0xa2');socket['emit'](_0x37c0('0x22')+_0x486dd8+_0x37c0('0xa3'),{'UserId':_0x29baf8,['queueField']:_0x3c31b4[_0x5287d5]['id']});}})[_0x37c0('0x30')](respondWithStatusCode(_0x42179a,null))[_0x37c0('0x54')](APIHandleError(_0x42179a));};exports[_0x37c0('0x113')]=function(_0x2f96fc,_0x11212f){var _0xd768f7=_0x2f96fc[_0x37c0('0x56')]['id'];var _0x5a7a79=null;if(_0x2f96fc[_0x37c0('0x3d')][_0x37c0('0x59')]){_0x5a7a79=_['isArray'](_0x2f96fc[_0x37c0('0x3d')][_0x37c0('0x59')])?_0x2f96fc[_0x37c0('0x3d')][_0x37c0('0x59')]:[_0x2f96fc[_0x37c0('0x3d')]['ids']];}var _0x2015fd=[];return Promise[_0x37c0('0x10b')]()['then'](function(){if(!_0x5a7a79)throw new APIBadRequestError(_0x37c0('0x114'));})[_0x37c0('0x30')](function(){return db['User'][_0x37c0('0x90')]({'where':{'id':_0xd768f7}});})[_0x37c0('0x30')](function(_0x246af5){if(!_0x246af5)throw new APINotFoundError(util[_0x37c0('0xa6')](_0x37c0('0xc2'),_0x2f96fc['params']['id']));return db[_0x37c0('0x63')][_0x37c0('0x10d')](function(_0x5071a6){return _0x246af5[_0x37c0('0x113')](_0x5a7a79,{'transaction':_0x5071a6})['then'](function(){return db[_0x37c0('0x109')]['findAll']({'where':{'id':{'$in':_0x5a7a79}}});})[_0x37c0('0x30')](function(_0x53466e){var _0x307ee9=_[_0x37c0('0x29')](_0x53466e,function(_0xb5d5c5){return _0xb5d5c5[_0x37c0('0x10e')]();});return Promise['all'](_0x307ee9);})[_0x37c0('0x30')](function(_0xcd152b){_0x2015fd=_['flattenDeep'](_0xcd152b);var _0x49ca8b=_[_0x37c0('0x29')](_0x2015fd,function(_0x677e77){return _0x677e77[_0x37c0('0x115')](_0x246af5['id'],{'transaction':_0x5071a6});});return Promise[_0x37c0('0x53')](_0x49ca8b);})[_0x37c0('0x30')](function(){if(!_0x246af5[_0x37c0('0x98')])return;var _0x4ee201=_[_0x37c0('0x27')](_0x2015fd,function(_0x454b2e){return _0x454b2e[_0x37c0('0x110')](_0x37c0('0x97'))===_0x37c0('0x111');});var _0x50d4a1=_['map'](_0x4ee201,function(_0x1f2c03){return db[_0x37c0('0xa8')]['destroy']({'where':{'VoiceQueueId':_0x1f2c03['id'],'UserId':_0x246af5['id']},'transaction':_0x5071a6});});return Promise[_0x37c0('0x53')](_0x50d4a1);})[_0x37c0('0x30')](function(){return db['TeamVoicePrefix'][_0x37c0('0x42')]({'where':{'teamId':{'$in':_0x5a7a79}}});})[_0x37c0('0x30')](function(_0x57642d){var _0x141ef3=_['map'](_0x57642d,function(_0x48ea06){return db['UserVoicePrefix'][_0x37c0('0x1e')]({'where':{'UserId':_0x246af5['id'],'VoicePrefixId':_0x48ea06['VoicePrefixId']}},{'transaction':_0x5071a6});});return Promise[_0x37c0('0x53')](_0x141ef3);});});})['then'](function(){for(var _0x1b15ca=0x0;_0x1b15ca<_0x2015fd[_0x37c0('0x45')];_0x1b15ca++){var _0x5e4e76=_0x2015fd[_0x1b15ca][_0x37c0('0x110')](_0x37c0('0x97'));var _0x988e81=_0x5e4e76+'QueueId';socket[_0x37c0('0x1c')](_0x37c0('0x22')+_0x5e4e76+'Queue:remove',{'UserId':_0xd768f7,['queueField']:_0x2015fd[_0x1b15ca]['id']});}})[_0x37c0('0x30')](respondWithStatusCode(_0x11212f,null))['catch'](APIHandleError(_0x11212f));};exports[_0x37c0('0x116')]=function(_0x36464e,_0x1bed92){var _0xd58258={};var _0x1136c1={};var _0x69e238;var _0x3fac26;return db[_0x37c0('0x34')]['findOne']({'where':{'id':_0x36464e[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x1bed92,null))[_0x37c0('0x30')](function(_0x5af8ca){if(_0x5af8ca){_0x69e238=_0x5af8ca;_0x1136c1[_0x37c0('0xc8')]=_['keys'](db[_0x37c0('0xc3')]['rawAttributes']);_0x1136c1['query']=_[_0x37c0('0xcb')](_0x36464e[_0x37c0('0x3d')]);_0x1136c1[_0x37c0('0xcc')]=_[_0x37c0('0xcd')](_0x1136c1[_0x37c0('0xc8')],_0x1136c1[_0x37c0('0x3d')]);_0xd58258['attributes']=_[_0x37c0('0xcd')](_0x1136c1[_0x37c0('0xc8')],qs[_0x37c0('0xce')](_0x36464e[_0x37c0('0x3d')][_0x37c0('0xce')]));_0xd58258[_0x37c0('0x41')]=_0xd58258[_0x37c0('0x41')]['length']?_0xd58258[_0x37c0('0x41')]:_0x1136c1[_0x37c0('0xc8')];_0xd58258[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x36464e[_0x37c0('0x3d')]['sort']);_0xd58258[_0x37c0('0x3c')]=qs['filters'](_[_0x37c0('0xd1')](_0x36464e[_0x37c0('0x3d')],_0x1136c1[_0x37c0('0xcc')]));if(_0x36464e['query'][_0x37c0('0x27')]){_0xd58258['where']=_[_0x37c0('0x4f')](_0xd58258[_0x37c0('0x3c')],{'$or':_[_0x37c0('0x29')](_0xd58258[_0x37c0('0x41')],function(_0x5d6c5f){var _0x1cb303={};_0x1cb303[_0x5d6c5f]={'$like':'%'+_0x36464e['query'][_0x37c0('0x27')]+'%'};return _0x1cb303;})});}_0xd58258=_[_0x37c0('0x4f')]({},_0xd58258,_0x36464e[_0x37c0('0x50')]);return _0x69e238[_0x37c0('0x116')](_0xd58258);}})[_0x37c0('0x30')](function(_0x4b0d64){if(_0x4b0d64){_0x3fac26=_0x4b0d64[_0x37c0('0x45')];if(!_0x36464e[_0x37c0('0x3d')][_0x37c0('0xd4')](_0x37c0('0xd6'))){_0xd58258['limit']=qs[_0x37c0('0x19')](_0x36464e[_0x37c0('0x3d')][_0x37c0('0x19')]);_0xd58258[_0x37c0('0x16')]=qs[_0x37c0('0x16')](_0x36464e['query'][_0x37c0('0x16')]);}return _0x69e238['getLists'](_0xd58258);}})['then'](function(_0x2e6d91){if(_0x2e6d91){return _0x2e6d91?{'count':_0x3fac26,'rows':_0x2e6d91}:null;}})[_0x37c0('0x30')](respondWithResult(_0x1bed92,null))[_0x37c0('0x54')](handleError(_0x1bed92,null));};exports[_0x37c0('0x117')]=function(_0x2e1ff0,_0x4662d5){var _0x293d9f={};var _0xa14f99={};var _0x2d14df;return db[_0x37c0('0x34')]['findOne']({'where':{'id':_0x2e1ff0[_0x37c0('0x56')]['id']}})[_0x37c0('0x30')](handleEntityNotFound(_0x4662d5,null))[_0x37c0('0x30')](function(_0x5ca4b4){if(_0x5ca4b4){_0x2d14df=_0x5ca4b4;_0xa14f99['model']=_['keys'](db[_0x37c0('0x34')][_0x37c0('0xca')]);_0xa14f99[_0x37c0('0x3d')]=_[_0x37c0('0xcb')](_0x2e1ff0[_0x37c0('0x3d')]);_0xa14f99['filters']=_['intersection'](_0xa14f99['model'],_0xa14f99[_0x37c0('0x3d')]);_0x293d9f[_0x37c0('0x41')]=_[_0x37c0('0xcd')](_0xa14f99[_0x37c0('0xc8')],qs['fields'](_0x2e1ff0[_0x37c0('0x3d')][_0x37c0('0xce')]));_0x293d9f[_0x37c0('0x41')]=_0x293d9f[_0x37c0('0x41')][_0x37c0('0x45')]?_0x293d9f[_0x37c0('0x41')]:_0xa14f99['model'];_0x293d9f[_0x37c0('0xcf')]=qs[_0x37c0('0xd0')](_0x2e1ff0['query'][_0x37c0('0xd0')]);_0x293d9f['where']=qs[_0x37c0('0xcc')](_[_0x37c0('0xd1')](_0x2e1ff0['query'],_0xa14f99[_0x37c0('0xcc')]));if(_0x2e1ff0[_0x37c0('0x3d')][_0x37c0('0x27')]){_0x293d9f['where']=_[_0x37c0('0x4f')](_0x293d9f['where'],{'$or':_[_0x37c0('0x29')](_0x293d9f[_0x37c0('0x41')],function(_0x25ace3){var _0x36b9b7={};_0x36b9b7[_0x25ace3]={'$like':'%'+_0x2e1ff0[_0x37c0('0x3d')][_0x37c0('0x27')]+'%'};return _0x36b9b7;})});}_0x293d9f[_0x37c0('0xc8')]=db[_0x37c0('0x34')];_0x293d9f['as']='Agents';_0x293d9f=_[_0x37c0('0x4f')]({},_0x293d9f,_0x2e1ff0[_0x37c0('0x50')]);return _0x2d14df[_0x37c0('0xf4')]({'include':[_0x293d9f]});}})['then'](function(_0x3104c9){if(_0x3104c9){var _0x70e386={},_0x3c3493=[];for(var _0x27ca1b=0x0;_0x27ca1b<_0x3104c9[_0x37c0('0x45')];_0x27ca1b+=0x1){for(var _0x4be17f=0x0,_0x3e3f01;_0x4be17f<_0x3104c9[_0x27ca1b][_0x37c0('0x23')][_0x37c0('0x45')];_0x4be17f+=0x1){_0x3e3f01=_0x3104c9[_0x27ca1b][_0x37c0('0x23')][_0x4be17f][_0x37c0('0x1f')]({'plain':!![]});_0x70e386[_0x3e3f01['id']]=_0x3e3f01;}}_0x70e386=_[_0x37c0('0x118')](_0x70e386);for(var _0x22616d=qs[_0x37c0('0x16')](_0x2e1ff0[_0x37c0('0x3d')]['offset']);_0x22616d<_0x70e386[_0x37c0('0x45')]&&_0x3c3493[_0x37c0('0x45')]=_0x470861[_0x665c('0x4e')]){throw new Error(_0x665c('0x4f'));}})['then'](function(){if(_0x7b574d){return db[_0x665c('0x24')][_0x665c('0x44')]({'where':{'membername':_0x7b574d[_0x665c('0x26')]},'individualHooks':!![]});}})[_0x665c('0x12')](function(){if(_0x7b574d){return _0x7b574d[_0x665c('0x50')]({'raw':!![]});}})['then'](function(_0x1d58bb){if(_0x7b574d){if(_0x1d58bb){var _0x2ad729=[];_0x5724a5=_0x1d58bb;if(_0x5724a5[_0x665c('0x28')]){for(var _0x120089=0x0;_0x120089<_0x5724a5[_0x665c('0x28')];_0x120089++){_0x2ad729[_0x665c('0x2e')](db['UserVoiceQueueRt']['upsert']({'membername':_0x7b574d['name'],'UserId':_0x7b574d['id'],'queue_name':_0x5724a5[_0x120089][_0x665c('0x26')],'VoiceQueueId':_0x5724a5[_0x120089]['id'],'interface':_0xefb36a,'paused':_0x7b574d[_0x665c('0x48')]||![],'penalty':_0x5724a5[_0x120089]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x665c('0x45')](_0x2ad729);}}}})[_0x665c('0x12')](function(){if(_0x7b574d){return db[_0x665c('0x25')]['findAll']({'where':{'membername':_0x7b574d[_0x665c('0x26')],'exitAt':null}});}})['then'](function(_0x4020f7){if(_0x7b574d){if(_0x4020f7&&_0x4020f7['length']){var _0x59fa6f=[];_0x4020f7[_0x665c('0x2d')](function(_0x5400be){_0x59fa6f[_0x665c('0x2e')](_0x5400be[_0x665c('0x33')]({'exitAt':moment()[_0x665c('0x29')](_0x665c('0x2a'))}));});return BPromise['all'](_0x59fa6f);}}})[_0x665c('0x12')](function(){if(_0x7b574d){var _0x40e223=[];var _0x366282=[];var _0x59cc8b=utils[_0x665c('0x2c')]();var _0x2404e8={'membername':_0x7b574d[_0x665c('0x26')],'interface':_0xefb36a,'enterAt':moment()['format'](_0x665c('0x2a')),'role':_0x7b574d[_0x665c('0x1f')],'internal':_0x7b574d[_0x665c('0x20')]};_0x59cc8b[_0x665c('0x2d')](function(_0x3bbb4c){_0x40e223[_0x665c('0x2e')](_['merge']({'channel':_0x3bbb4c,'type':_0x665c('0x51'),'data1':_0x665c('0x52'),'data2':_0xefb36a},_0x2404e8));if(_0x7b574d['loginInPause']){_0x366282[_0x665c('0x2e')](_[_0x665c('0x53')]({'channel':_0x3bbb4c,'type':_0x665c('0x27'),'data1':_0x665c('0x54')},_0x2404e8));}});return db[_0x665c('0x25')]['bulkCreate'](_0x40e223[_0x665c('0x55')](_0x366282),{'individualHooks':!![]});}})[_0x665c('0x12')](function(){if(_0x7b574d){return _0x7b574d[_0x665c('0x33')]({'online':!![],'lastLoginAt':moment()[_0x665c('0x29')](_0x665c('0x2a')),'voicePause':_0x7b574d['loginInPause']||![],'mailPause':_0x7b574d[_0x665c('0x48')]||![],'chatPause':_0x7b574d[_0x665c('0x48')]||![],'faxPause':_0x7b574d[_0x665c('0x48')]||![],'smsPause':_0x7b574d[_0x665c('0x48')]||![],'openchannelPause':_0x7b574d[_0x665c('0x48')]||![],'pauseType':_0x7b574d[_0x665c('0x48')]?_0x665c('0x54'):null,'lastPauseAt':moment()[_0x665c('0x29')](_0x665c('0x2a')),'interface':_0xefb36a});}})['then'](function(_0x1862af){_0x1dd887(_0x1862af);})[_0x665c('0x1d')](function(_0x1362e4){_0x4d41e2(_0xadc1b9[_0x665c('0x17')](0x1f4,_0x1362e4['message']));});});}; \ No newline at end of file +var _0xf9d9=['UserVoiceQueueRt','length','all','phone','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','loginInPause','LOGININPAUSE','concat','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowUser','raw','PauseUser','find','name','role','interface','format','update','PAUSE','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','SIP/%s','DEFAULT\x20PAUSE','body','uniqueid','MemberReport','bulkCreate','resolve','channel','isValidChannel','findOne','internal','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','system'];(function(_0x4e83fd,_0x1e4d14){var _0x52b86f=function(_0x39a519){while(--_0x39a519){_0x4e83fd['push'](_0x4e83fd['shift']());}};_0x52b86f(++_0x1e4d14);}(_0xf9d9,0x6a));var _0x9f9d=function(_0x451ef3,_0x4331d7){_0x451ef3=_0x451ef3-0x0;var _0x257295=_0xf9d9[_0x451ef3];return _0x257295;};'use strict';var _=require(_0x9f9d('0x0'));var util=require('util');var moment=require(_0x9f9d('0x1'));var BPromise=require(_0x9f9d('0x2'));var Redis=require(_0x9f9d('0x3'));var db=require(_0x9f9d('0x4'))['db'];var utils=require(_0x9f9d('0x5'));var logger=require(_0x9f9d('0x6'))(_0x9f9d('0x7'));var config=require(_0x9f9d('0x8'));config[_0x9f9d('0x9')]=_[_0x9f9d('0xa')](config[_0x9f9d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f9d('0xb'))(new Redis(config[_0x9f9d('0x9')]));require(_0x9f9d('0xc'))[_0x9f9d('0xd')](socket);exports[_0x9f9d('0xe')]=function(_0x629144){var _0x3e93d9=this;return new Promise(function(_0x2cfd7f,_0x561b21){return db[_0x9f9d('0xf')][_0x9f9d('0x10')]({'raw':_0x629144['options']?_0x629144[_0x9f9d('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x629144[_0x9f9d('0x11')]?_0x629144[_0x9f9d('0x11')][_0x9f9d('0x12')]||null:null,'attributes':_0x629144[_0x9f9d('0x11')]?_0x629144[_0x9f9d('0x11')][_0x9f9d('0x13')]||null:null,'limit':_0x629144[_0x9f9d('0x11')]?_0x629144[_0x9f9d('0x11')][_0x9f9d('0x14')]||null:null,'include':_0x629144[_0x9f9d('0x11')]?_0x629144[_0x9f9d('0x11')][_0x9f9d('0x15')]?_[_0x9f9d('0x16')](_0x629144[_0x9f9d('0x11')]['include'],function(_0x18b4fa){return{'model':db[_0x18b4fa['model']],'as':_0x18b4fa['as'],'attributes':_0x18b4fa[_0x9f9d('0x13')],'include':_0x18b4fa[_0x9f9d('0x15')]?_['map'](_0x18b4fa['include'],function(_0x345165){return{'model':db[_0x345165['model']],'as':_0x345165['as'],'attributes':_0x345165[_0x9f9d('0x13')],'include':_0x345165[_0x9f9d('0x15')]?_['map'](_0x345165[_0x9f9d('0x15')],function(_0xfe9a52){return{'model':db[_0xfe9a52[_0x9f9d('0x17')]],'as':_0xfe9a52['as'],'attributes':_0xfe9a52[_0x9f9d('0x13')]};}):[]};}):[]};}):[]:[]})[_0x9f9d('0x18')](function(_0x3ea5a5){logger[_0x9f9d('0x19')](_0x9f9d('0xe'),_0x629144);logger[_0x9f9d('0x1a')](_0x9f9d('0xe'),_0x629144,JSON[_0x9f9d('0x1b')](_0x3ea5a5));_0x2cfd7f(_0x3ea5a5);})[_0x9f9d('0x1c')](function(_0xde8a1f){logger[_0x9f9d('0x1d')](_0x9f9d('0xe'),_0xde8a1f['message'],_0x629144);_0x561b21(_0x3e93d9['error'](0x1f4,_0xde8a1f[_0x9f9d('0x1e')]));});});};exports[_0x9f9d('0x1f')]=function(_0x1cb0fd){var _0x2b87d1=this;return new Promise(function(_0x3f3c6f,_0x5248d4){return db[_0x9f9d('0xf')]['find']({'raw':_0x1cb0fd['options']?_0x1cb0fd[_0x9f9d('0x11')][_0x9f9d('0x20')]===undefined?!![]:![]:!![],'where':_0x1cb0fd[_0x9f9d('0x11')]?_0x1cb0fd['options']['where']||null:null,'attributes':_0x1cb0fd[_0x9f9d('0x11')]?_0x1cb0fd['options']['attributes']||null:null,'include':_0x1cb0fd['options']?_0x1cb0fd['options'][_0x9f9d('0x15')]?_['map'](_0x1cb0fd[_0x9f9d('0x11')]['include'],function(_0x3a9158){return{'model':db[_0x3a9158[_0x9f9d('0x17')]],'as':_0x3a9158['as'],'attributes':_0x3a9158['attributes'],'include':_0x3a9158[_0x9f9d('0x15')]?_['map'](_0x3a9158[_0x9f9d('0x15')],function(_0x3fa76e){return{'model':db[_0x3fa76e[_0x9f9d('0x17')]],'as':_0x3fa76e['as'],'attributes':_0x3fa76e[_0x9f9d('0x13')],'include':_0x3fa76e[_0x9f9d('0x15')]?_[_0x9f9d('0x16')](_0x3fa76e[_0x9f9d('0x15')],function(_0x5d0f3a){return{'model':db[_0x5d0f3a[_0x9f9d('0x17')]],'as':_0x5d0f3a['as'],'attributes':_0x5d0f3a[_0x9f9d('0x13')]};}):[]};}):[]};}):[]:[]})[_0x9f9d('0x18')](function(_0x5f0ffb){logger['info'](_0x9f9d('0x1f'),_0x1cb0fd);logger[_0x9f9d('0x1a')](_0x9f9d('0x1f'),_0x1cb0fd,JSON[_0x9f9d('0x1b')](_0x5f0ffb));_0x3f3c6f(_0x5f0ffb);})[_0x9f9d('0x1c')](function(_0x2a3446){logger[_0x9f9d('0x1d')]('ShowUser',_0x2a3446[_0x9f9d('0x1e')],_0x1cb0fd);_0x5248d4(_0x2b87d1[_0x9f9d('0x1d')](0x1f4,_0x2a3446[_0x9f9d('0x1e')]));});});};exports[_0x9f9d('0x21')]=function(_0xe2cf1f){var _0x49b9c9;return db['User'][_0x9f9d('0x22')]({'where':_0xe2cf1f[_0x9f9d('0x11')][_0x9f9d('0x12')]||{},'attributes':['id',_0x9f9d('0x23'),_0x9f9d('0x24'),'internal',_0x9f9d('0x25')]})[_0x9f9d('0x18')](function(_0x2bac78){if(!_0x2bac78){throw new Error(util[_0x9f9d('0x26')]('User\x20with\x20id\x20%s\x20not\x20found',_0xe2cf1f['params']['id']));}_0x49b9c9=_0x2bac78;return db['UserVoiceQueueRt'][_0x9f9d('0x27')]({'paused':0x1},{'where':{'UserId':_0x49b9c9['id']},'individualHooks':!![]});})[_0x9f9d('0x18')](function(){return db['MemberReport'][_0x9f9d('0x10')]({'where':{'membername':_0x49b9c9['name'],'type':_0x9f9d('0x28'),'exitAt':null}});})[_0x9f9d('0x18')](function(_0x44f72b){if(_0x44f72b&&_0x44f72b['length']){var _0x556859=moment()[_0x9f9d('0x26')](_0x9f9d('0x29'));for(var _0x4d4928=0x0,_0x2f5662=_0x44f72b['length'];_0x4d4928<_0x2f5662;_0x4d4928++){_0x44f72b[_0x4d4928][_0x9f9d('0x2a')]({'exitAt':_0x556859});}}})[_0x9f9d('0x18')](function(){var _0x34d8e8=[];var _0x59eaa0=utils[_0x9f9d('0x2b')]();_0x59eaa0[_0x9f9d('0x2c')](function(_0x18b516){_0x34d8e8[_0x9f9d('0x2d')]({'channel':_0x18b516,'membername':_0x49b9c9['name'],'interface':_['isNil'](_0x49b9c9[_0x9f9d('0x25')])?util['format'](_0x9f9d('0x2e'),_0x49b9c9[_0x9f9d('0x23')]):_0x49b9c9[_0x9f9d('0x25')],'type':'PAUSE','enterAt':moment()['format'](_0x9f9d('0x29')),'data1':_0xe2cf1f['body']['type']||_0x9f9d('0x2f'),'role':_0x49b9c9['role'],'internal':_0x49b9c9['internal'],'uniqueid':_0xe2cf1f[_0x9f9d('0x30')][_0x9f9d('0x31')]||null});});return db[_0x9f9d('0x32')][_0x9f9d('0x33')](_0x34d8e8,{'individualHooks':!![]});})[_0x9f9d('0x18')](function(){return _0x49b9c9[_0x9f9d('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xe2cf1f[_0x9f9d('0x30')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9f9d('0x26')](_0x9f9d('0x29'))});})['catch'](function(_0x1dcc84){throw _0x1dcc84;});};exports['UnpauseUser']=function(_0x57c464){return Promise[_0x9f9d('0x34')]()[_0x9f9d('0x18')](function(){if(_0x57c464['body'][_0x9f9d('0x35')]&&!utils[_0x9f9d('0x36')](_0x57c464['body'][_0x9f9d('0x35')])){throw new Error(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x57c464['body'][_0x9f9d('0x35')]));}return db[_0x9f9d('0xf')][_0x9f9d('0x37')]({'where':_0x57c464[_0x9f9d('0x11')]['where']||{},'attributes':['id',_0x9f9d('0x23'),_0x9f9d('0x24'),_0x9f9d('0x38'),_0x9f9d('0x25'),_0x9f9d('0x39'),_0x9f9d('0x3a'),_0x9f9d('0x3b'),_0x9f9d('0x3c'),_0x9f9d('0x3d'),_0x9f9d('0x3e'),'smsPause',_0x9f9d('0x3f'),_0x9f9d('0x40'),_0x9f9d('0x41')]});})[_0x9f9d('0x18')](function(_0x11eb03){if(!_0x11eb03){throw new Error(util[_0x9f9d('0x26')](_0x9f9d('0x42'),_0x57c464[_0x9f9d('0x43')]['id']));}return _0x11eb03[_0x9f9d('0x44')](_0x57c464['body'][_0x9f9d('0x35')],_0x9f9d('0x45'));})['catch'](function(_0x40f5ea){throw _0x40f5ea;});};exports['LogoutUser']=function(_0x4174ac){var _0x2d6839=this;return new Promise(function(_0x4c33d6,_0x59d63c){var _0x460f9b;return db[_0x9f9d('0xf')][_0x9f9d('0x37')]({'where':_0x4174ac[_0x9f9d('0x11')][_0x9f9d('0x12')]||{},'attributes':['id',_0x9f9d('0x23')]})[_0x9f9d('0x18')](function(_0x291fb9){if(_0x291fb9){_0x460f9b=_0x291fb9;return db[_0x9f9d('0x46')]['destroy']({'where':{'membername':_0x460f9b['name']},'individualHooks':!![]});}})[_0x9f9d('0x18')](function(){if(_0x460f9b){return db['MemberReport'][_0x9f9d('0x10')]({'where':{'membername':_0x460f9b['name'],'exitAt':null}});}})[_0x9f9d('0x18')](function(_0xe46ffc){if(_0x460f9b){if(_0xe46ffc&&_0xe46ffc[_0x9f9d('0x47')]){var _0x43535a=[];_0xe46ffc[_0x9f9d('0x2c')](function(_0x148e2d){_0x43535a[_0x9f9d('0x2d')](_0x148e2d['update']({'exitAt':moment()[_0x9f9d('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9f9d('0x48')](_0x43535a);}}})[_0x9f9d('0x18')](function(){if(_0x460f9b){return _0x460f9b[_0x9f9d('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9f9d('0x18')](function(_0x40101a){_0x4c33d6(_0x40101a);})[_0x9f9d('0x1c')](function(_0x405ed9){_0x59d63c(_0x2d6839[_0x9f9d('0x1d')](0x1f4,_0x405ed9[_0x9f9d('0x1e')]));});});};exports['LoginUser']=function(_0x178ba5){var _0x544740=this;return new Promise(function(_0x70433,_0x4038f5){var _0x3ee3a3;var _0x5e0bbd;var _0x3a142a;var _0x29d11;return db[_0x9f9d('0xf')][_0x9f9d('0x37')]({'where':_0x178ba5[_0x9f9d('0x11')][_0x9f9d('0x12')]||{},'attributes':['id',_0x9f9d('0x23'),_0x9f9d('0x24'),'mobile',_0x9f9d('0x49'),'internal','loginInPause',_0x9f9d('0x25')]})[_0x9f9d('0x18')](function(_0x1d3036){if(_0x1d3036){_0x3ee3a3=_0x1d3036;_0x29d11=_0x178ba5[_0x9f9d('0x30')][_0x9f9d('0x25')]?_0x178ba5[_0x9f9d('0x30')][_0x9f9d('0x25')]:util[_0x9f9d('0x26')]('SIP/%s',_0x3ee3a3[_0x9f9d('0x23')]);return db['User'][_0x9f9d('0x4a')]({'where':{'role':_0x9f9d('0x4b'),'online':!![],'id':{'$ne':_0x3ee3a3['id']}}});}})[_0x9f9d('0x18')](function(_0x32c59c){if(_0x32c59c){_0x3a142a=_0x32c59c;return require('../../config/license/util')[_0x9f9d('0x4c')]();}})[_0x9f9d('0x18')](function(_0x1248a1){if(_0x1248a1&&_0x1248a1[_0x9f9d('0x4d')]&&_0x3a142a>=_0x1248a1['agents']){throw new Error(_0x9f9d('0x4e'));}})['then'](function(){if(_0x3ee3a3){return db[_0x9f9d('0x46')]['destroy']({'where':{'membername':_0x3ee3a3[_0x9f9d('0x23')]},'individualHooks':!![]});}})[_0x9f9d('0x18')](function(){if(_0x3ee3a3){return _0x3ee3a3[_0x9f9d('0x4f')]({'raw':!![]});}})[_0x9f9d('0x18')](function(_0x228d0f){if(_0x3ee3a3){if(_0x228d0f){var _0x4ad3ed=[];_0x5e0bbd=_0x228d0f;if(_0x5e0bbd[_0x9f9d('0x47')]){for(var _0x5d3cf5=0x0;_0x5d3cf5<_0x5e0bbd[_0x9f9d('0x47')];_0x5d3cf5++){_0x4ad3ed[_0x9f9d('0x2d')](db[_0x9f9d('0x46')][_0x9f9d('0x50')]({'membername':_0x3ee3a3[_0x9f9d('0x23')],'UserId':_0x3ee3a3['id'],'queue_name':_0x5e0bbd[_0x5d3cf5][_0x9f9d('0x23')],'VoiceQueueId':_0x5e0bbd[_0x5d3cf5]['id'],'interface':_0x29d11,'paused':_0x3ee3a3['loginInPause']||![],'penalty':_0x5e0bbd[_0x5d3cf5][_0x9f9d('0x51')]||0x0}));}return BPromise[_0x9f9d('0x48')](_0x4ad3ed);}}}})[_0x9f9d('0x18')](function(){if(_0x3ee3a3){return db[_0x9f9d('0x32')][_0x9f9d('0x10')]({'where':{'membername':_0x3ee3a3[_0x9f9d('0x23')],'exitAt':null}});}})[_0x9f9d('0x18')](function(_0x3f4efa){if(_0x3ee3a3){if(_0x3f4efa&&_0x3f4efa['length']){var _0x57e690=[];_0x3f4efa[_0x9f9d('0x2c')](function(_0x5414c1){_0x57e690[_0x9f9d('0x2d')](_0x5414c1[_0x9f9d('0x27')]({'exitAt':moment()[_0x9f9d('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9f9d('0x48')](_0x57e690);}}})[_0x9f9d('0x18')](function(){if(_0x3ee3a3){var _0x5b945d=[];var _0xf6e960=[];var _0x279526=utils[_0x9f9d('0x2b')]();var _0x1d1bb3={'membername':_0x3ee3a3['name'],'interface':_0x29d11,'enterAt':moment()['format'](_0x9f9d('0x29')),'role':_0x3ee3a3[_0x9f9d('0x24')],'internal':_0x3ee3a3[_0x9f9d('0x38')]};_0x279526['forEach'](function(_0x1f51af){_0x5b945d['push'](_[_0x9f9d('0x52')]({'channel':_0x1f51af,'type':_0x9f9d('0x53'),'data1':_0x9f9d('0x54'),'data2':_0x29d11},_0x1d1bb3));if(_0x3ee3a3[_0x9f9d('0x55')]){_0xf6e960[_0x9f9d('0x2d')](_[_0x9f9d('0x52')]({'channel':_0x1f51af,'type':_0x9f9d('0x28'),'data1':_0x9f9d('0x56')},_0x1d1bb3));}});return db[_0x9f9d('0x32')]['bulkCreate'](_0x5b945d[_0x9f9d('0x57')](_0xf6e960),{'individualHooks':!![]});}})[_0x9f9d('0x18')](function(){if(_0x3ee3a3){return _0x3ee3a3[_0x9f9d('0x27')]({'online':!![],'lastLoginAt':moment()['format'](_0x9f9d('0x29')),'voicePause':_0x3ee3a3['loginInPause']||![],'mailPause':_0x3ee3a3[_0x9f9d('0x55')]||![],'chatPause':_0x3ee3a3[_0x9f9d('0x55')]||![],'faxPause':_0x3ee3a3['loginInPause']||![],'smsPause':_0x3ee3a3[_0x9f9d('0x55')]||![],'openchannelPause':_0x3ee3a3[_0x9f9d('0x55')]||![],'pauseType':_0x3ee3a3[_0x9f9d('0x55')]?_0x9f9d('0x56'):null,'lastPauseAt':moment()[_0x9f9d('0x26')](_0x9f9d('0x29')),'interface':_0x29d11});}})[_0x9f9d('0x18')](function(_0x46b283){_0x70433(_0x46b283);})[_0x9f9d('0x1c')](function(_0x51d737){_0x4038f5(_0x544740[_0x9f9d('0x1d')](0x1f4,_0x51d737[_0x9f9d('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 2e1fb59..512ca0d 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 _0x0638=['save','remove','emit','register','length','user:','./user.events'];(function(_0x40b241,_0x2ce6cc){var _0x22b4b1=function(_0x83fc40){while(--_0x83fc40){_0x40b241['push'](_0x40b241['shift']());}};_0x22b4b1(++_0x2ce6cc);}(_0x0638,0x156));var _0x8063=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x0638[_0x28a5ad];return _0x176b8a;};'use strict';var UserEvents=require(_0x8063('0x0'));var events=[_0x8063('0x1'),_0x8063('0x2'),'update'];function createListener(_0x404a20,_0x3923f2){return function(_0x27211e){_0x3923f2[_0x8063('0x3')](_0x404a20,_0x27211e);};}function removeListener(_0x1a18e3,_0x4f346c){return function(){UserEvents['removeListener'](_0x1a18e3,_0x4f346c);};}exports[_0x8063('0x4')]=function(_0x4eed6f){for(var _0x51a588=0x0,_0x170b89=events[_0x8063('0x5')];_0x51a588<_0x170b89;_0x51a588++){var _0x3a9612=events[_0x51a588];var _0x2c35f8=createListener(_0x8063('0x6')+_0x3a9612,_0x4eed6f);UserEvents['on'](_0x3a9612,_0x2c35f8);}}; \ No newline at end of file +var _0x8b2d=['user:','./user.events','save','remove','update','removeListener','register','length'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0x8b2d,0x91));var _0xd8b2=function(_0x47b8d9,_0x2fd2e0){_0x47b8d9=_0x47b8d9-0x0;var _0x48216f=_0x8b2d[_0x47b8d9];return _0x48216f;};'use strict';var UserEvents=require(_0xd8b2('0x0'));var events=[_0xd8b2('0x1'),_0xd8b2('0x2'),_0xd8b2('0x3')];function createListener(_0x3f80ce,_0xecd4cf){return function(_0x2bbb63){_0xecd4cf['emit'](_0x3f80ce,_0x2bbb63);};}function removeListener(_0x34da99,_0x1d480f){return function(){UserEvents[_0xd8b2('0x4')](_0x34da99,_0x1d480f);};}exports[_0xd8b2('0x5')]=function(_0x1a022c){for(var _0x2444d8=0x0,_0x277ebd=events[_0xd8b2('0x6')];_0x2444d8<_0x277ebd;_0x2444d8++){var _0x4223e8=events[_0x2444d8];var _0x53bab9=createListener(_0xd8b2('0x7')+_0x4223e8,_0x1a022c);UserEvents['on'](_0x4223e8,_0x53bab9);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index cf98f2b..263c45f 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4dc963,_0x10c0ce){var _0x1bd13c=function(_0x3930bc){while(--_0x3930bc){_0x4dc963['push'](_0x4dc963['shift']());}};_0x1bd13c(++_0x10c0ce);}(_0xe706,0xa3));var _0x6e70=function(_0x2e0a25,_0x2da7a6){_0x2e0a25=_0x2e0a25-0x0;var _0x359873=_0xe706[_0x2e0a25];return _0x359873;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5b9aaf,_0x4f4c40){var _0x4b7b82=function(_0x4b514d){while(--_0x4b514d){_0x5b9aaf['push'](_0x5b9aaf['shift']());}};_0x4b7b82(++_0x4f4c40);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0xcb91[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 457e7f0..5f465f6 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 _0x1ead=['exports','INTEGER','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1ead,0xa4));var _0xd1ea=function(_0x38750f,_0x1b5ef5){_0x38750f=_0x38750f-0x0;var _0x46f376=_0x1ead[_0x38750f];return _0x46f376;};'use strict';var Sequelize=require(_0xd1ea('0x0'));module[_0xd1ea('0x1')]={'penalty':{'type':Sequelize[_0xd1ea('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x03db=['sequelize','exports','INTEGER'];(function(_0x4d3d46,_0x5cd814){var _0x2b43b9=function(_0x2982f3){while(--_0x2982f3){_0x4d3d46['push'](_0x4d3d46['shift']());}};_0x2b43b9(++_0x5cd814);}(_0x03db,0x156));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb03d('0x0'));module[_0xb03d('0x1')]={'penalty':{'type':Sequelize[_0xb03d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 4383ee8..0397a57 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 _0x4d77=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash'];(function(_0x4f5cda,_0x46a84a){var _0x2a3488=function(_0x3c706e){while(--_0x3c706e){_0x4f5cda['push'](_0x4f5cda['shift']());}};_0x2a3488(++_0x46a84a);}(_0x4d77,0x99));var _0x74d7=function(_0x32f2c4,_0x2edbe0){_0x32f2c4=_0x32f2c4-0x0;var _0x2e37dd=_0x4d77[_0x32f2c4];return _0x2e37dd;};'use strict';var _=require(_0x74d7('0x0'));var util=require(_0x74d7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x74d7('0x2'));var BPromise=require(_0x74d7('0x3'));var rp=require(_0x74d7('0x4'));var fs=require('fs');var path=require(_0x74d7('0x5'));var rimraf=require(_0x74d7('0x6'));var config=require(_0x74d7('0x7'));var attributes=require(_0x74d7('0x8'));module[_0x74d7('0x9')]=function(_0x1a04b9,_0x5811c1){return _0x1a04b9[_0x74d7('0xa')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ea=['api','moment','bluebird','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x2fd3dd,_0x3a7795){var _0xffa2b3=function(_0x3cfddf){while(--_0x3cfddf){_0x2fd3dd['push'](_0x2fd3dd['shift']());}};_0xffa2b3(++_0x3a7795);}(_0xb9ea,0xc3));var _0xab9e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9ea[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xab9e('0x0'));var util=require(_0xab9e('0x1'));var logger=require(_0xab9e('0x2'))(_0xab9e('0x3'));var moment=require(_0xab9e('0x4'));var BPromise=require(_0xab9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab9e('0x6'));var config=require(_0xab9e('0x7'));var attributes=require(_0xab9e('0x8'));module['exports']=function(_0xb36352,_0x300473){return _0xb36352['define'](_0xab9e('0x9'),attributes,{'tableName':_0xab9e('0xa'),'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 2b8fc64..9e03be0 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 _0x0213=['debug','error','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x57af0a,_0x157bfd){var _0x14b571=function(_0x3ac45c){while(--_0x3ac45c){_0x57af0a['push'](_0x57af0a['shift']());}};_0x14b571(++_0x157bfd);}(_0x0213,0xba));var _0x3021=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x0213[_0x6f1a87];return _0x2495c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3021('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3021('0x1'));var db=require(_0x3021('0x2'))['db'];var utils=require(_0x3021('0x3'));var logger=require(_0x3021('0x4'))(_0x3021('0x5'));var config=require(_0x3021('0x6'));var jayson=require(_0x3021('0x7'));var client=jayson[_0x3021('0x8')][_0x3021('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57302c,_0x3e158a,_0x192421){return new BPromise(function(_0x3dd6d0,_0x536d5d){return client[_0x3021('0xa')](_0x57302c,_0x192421)[_0x3021('0xb')](function(_0x5c8dec){logger['info'](_0x3021('0xc'),_0x3e158a,_0x3021('0xd'));logger[_0x3021('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3e158a,_0x3021('0xd'),JSON['stringify'](_0x5c8dec));if(_0x5c8dec[_0x3021('0xf')]){if(_0x5c8dec[_0x3021('0xf')]['code']===0x1f4){logger[_0x3021('0xf')](_0x3021('0xc'),_0x3e158a,_0x5c8dec[_0x3021('0xf')]['message']);return _0x536d5d(_0x5c8dec['error']['message']);}logger[_0x3021('0xf')](_0x3021('0xc'),_0x3e158a,_0x5c8dec[_0x3021('0xf')][_0x3021('0x10')]);return _0x3dd6d0(_0x5c8dec[_0x3021('0xf')][_0x3021('0x10')]);}else{logger[_0x3021('0x11')](_0x3021('0xc'),_0x3e158a,_0x3021('0xd'));_0x3dd6d0(_0x5c8dec[_0x3021('0x12')]['message']);}})[_0x3021('0x13')](function(_0x8671cf){logger[_0x3021('0xf')](_0x3021('0xc'),_0x3e158a,_0x8671cf);_0x536d5d(_0x8671cf);});});} \ No newline at end of file +var _0x6b20=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x6b20,0xfd));var _0x06b2=function(_0x4e9b38,_0x1d4759){_0x4e9b38=_0x4e9b38-0x0;var _0x126a89=_0x6b20[_0x4e9b38];return _0x126a89;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require(_0x06b2('0x2'));var BPromise=require(_0x06b2('0x3'));var rs=require(_0x06b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06b2('0x5'))['db'];var utils=require(_0x06b2('0x6'));var logger=require('../../config/logger')(_0x06b2('0x7'));var config=require(_0x06b2('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4aa36d,_0x455ada,_0x17eb31){return new BPromise(function(_0x26393c,_0x277fe8){return client[_0x06b2('0x9')](_0x4aa36d,_0x17eb31)[_0x06b2('0xa')](function(_0xc70f44){logger[_0x06b2('0xb')](_0x06b2('0xc'),_0x455ada,_0x06b2('0xd'));logger[_0x06b2('0xe')](_0x06b2('0xf'),_0x455ada,_0x06b2('0xd'),JSON[_0x06b2('0x10')](_0xc70f44));if(_0xc70f44[_0x06b2('0x11')]){if(_0xc70f44[_0x06b2('0x11')][_0x06b2('0x12')]===0x1f4){logger[_0x06b2('0x11')](_0x06b2('0xc'),_0x455ada,_0xc70f44[_0x06b2('0x11')][_0x06b2('0x13')]);return _0x277fe8(_0xc70f44[_0x06b2('0x11')][_0x06b2('0x13')]);}logger[_0x06b2('0x11')](_0x06b2('0xc'),_0x455ada,_0xc70f44[_0x06b2('0x11')][_0x06b2('0x13')]);return _0x26393c(_0xc70f44[_0x06b2('0x11')][_0x06b2('0x13')]);}else{logger['info'](_0x06b2('0xc'),_0x455ada,_0x06b2('0xd'));_0x26393c(_0xc70f44[_0x06b2('0x14')][_0x06b2('0x13')]);}})['catch'](function(_0x4750b6){logger[_0x06b2('0x11')](_0x06b2('0xc'),_0x455ada,_0x4750b6);_0x277fe8(_0x4750b6);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5f7cccf..4116313 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5f1952,_0x13916e){var _0x592599=function(_0x8b4ec4){while(--_0x8b4ec4){_0x5f1952['push'](_0x5f1952['shift']());}};_0x592599(++_0x13916e);}(_0x70e0,0x17b));var _0x070e=function(_0x5666ad,_0x1ac2d1){_0x5666ad=_0x5666ad-0x0;var _0xb2cea5=_0x70e0[_0x5666ad];return _0xb2cea5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x10b902,_0x224ddd){var _0x42c3a9=function(_0x81fa71){while(--_0x81fa71){_0x10b902['push'](_0x10b902['shift']());}};_0x42c3a9(++_0x224ddd);}(_0x70e0,0x17b));var _0x070e=function(_0x1f2a2a,_0x4f07a7){_0x1f2a2a=_0x1f2a2a-0x0;var _0x33f9c8=_0x70e0[_0x1f2a2a];return _0x33f9c8;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index de8ee75..f061ac5 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 _0x899c=['exports','INTEGER','STRING','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x899c,0xaf));var _0xc899=function(_0x40b7ea,_0x550490){_0x40b7ea=_0x40b7ea-0x0;var _0x2627ec=_0x899c[_0x40b7ea];return _0x2627ec;};'use strict';var Sequelize=require(_0xc899('0x0'));module[_0xc899('0x1')]={'penalty':{'type':Sequelize[_0xc899('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc899('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc899('0x3')]}}; \ No newline at end of file +var _0x2538=['INTEGER','STRING','sequelize','exports'];(function(_0x164008,_0x52381e){var _0x4118b0=function(_0x50b3b4){while(--_0x50b3b4){_0x164008['push'](_0x164008['shift']());}};_0x4118b0(++_0x52381e);}(_0x2538,0x146));var _0x8253=function(_0xd5f3ac,_0x5a575a){_0xd5f3ac=_0xd5f3ac-0x0;var _0x38aed8=_0x2538[_0xd5f3ac];return _0x38aed8;};'use strict';var Sequelize=require(_0x8253('0x0'));module[_0x8253('0x1')]={'penalty':{'type':Sequelize[_0x8253('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8253('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5ad020f..56be533 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 _0x1b61=['../../config/environment','./userFaxQueue.attributes','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5cc8dd,_0x282979){var _0x5db421=function(_0x19f19e){while(--_0x19f19e){_0x5cc8dd['push'](_0x5cc8dd['shift']());}};_0x5db421(++_0x282979);}(_0x1b61,0x1b4));var _0x11b6=function(_0x29542a,_0x484491){_0x29542a=_0x29542a-0x0;var _0x580180=_0x1b61[_0x29542a];return _0x580180;};'use strict';var _=require(_0x11b6('0x0'));var util=require(_0x11b6('0x1'));var logger=require(_0x11b6('0x2'))(_0x11b6('0x3'));var moment=require(_0x11b6('0x4'));var BPromise=require(_0x11b6('0x5'));var rp=require(_0x11b6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11b6('0x7'));var config=require(_0x11b6('0x8'));var attributes=require(_0x11b6('0x9'));module['exports']=function(_0xfe36cb,_0x532b54){return _0xfe36cb['define'](_0x11b6('0xa'),attributes,{'tableName':_0x11b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe134=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0x2db45e,_0x3c3b37){var _0x200a5=function(_0x2a9fb2){while(--_0x2a9fb2){_0x2db45e['push'](_0x2db45e['shift']());}};_0x200a5(++_0x3c3b37);}(_0xe134,0x198));var _0x4e13=function(_0x1e526d,_0x57576e){_0x1e526d=_0x1e526d-0x0;var _0x13ab29=_0xe134[_0x1e526d];return _0x13ab29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e13('0x0'))(_0x4e13('0x1'));var moment=require(_0x4e13('0x2'));var BPromise=require(_0x4e13('0x3'));var rp=require(_0x4e13('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e13('0x5'));var config=require(_0x4e13('0x6'));var attributes=require(_0x4e13('0x7'));module[_0x4e13('0x8')]=function(_0x58139a,_0x213a58){return _0x58139a[_0x4e13('0x9')](_0x4e13('0xa'),attributes,{'tableName':_0x4e13('0xb'),'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 cf7b29e..0e9cde8 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 _0xfb68=['../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb68,0x1c8));var _0x8fb6=function(_0x75c507,_0x43e3bc){_0x75c507=_0x75c507-0x0;var _0x3054f7=_0xfb68[_0x75c507];return _0x3054f7;};'use strict';var _=require('lodash');var util=require(_0x8fb6('0x0'));var moment=require(_0x8fb6('0x1'));var BPromise=require(_0x8fb6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fb6('0x3'));var db=require(_0x8fb6('0x4'))['db'];var utils=require(_0x8fb6('0x5'));var logger=require(_0x8fb6('0x6'))(_0x8fb6('0x7'));var config=require(_0x8fb6('0x8'));var jayson=require(_0x8fb6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ab1a5,_0x2431f4,_0x1ee5d8){return new BPromise(function(_0x5dc2e3,_0x4ed431){return client['request'](_0x5ab1a5,_0x1ee5d8)[_0x8fb6('0xa')](function(_0xad1ba5){logger[_0x8fb6('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x2431f4,_0x8fb6('0xc'));logger[_0x8fb6('0xd')](_0x8fb6('0xe'),_0x2431f4,_0x8fb6('0xc'),JSON[_0x8fb6('0xf')](_0xad1ba5));if(_0xad1ba5['error']){if(_0xad1ba5[_0x8fb6('0x10')][_0x8fb6('0x11')]===0x1f4){logger[_0x8fb6('0x10')](_0x8fb6('0x12'),_0x2431f4,_0xad1ba5[_0x8fb6('0x10')]['message']);return _0x4ed431(_0xad1ba5[_0x8fb6('0x10')][_0x8fb6('0x13')]);}logger[_0x8fb6('0x10')](_0x8fb6('0x12'),_0x2431f4,_0xad1ba5[_0x8fb6('0x10')][_0x8fb6('0x13')]);return _0x5dc2e3(_0xad1ba5['error']['message']);}else{logger[_0x8fb6('0xb')](_0x8fb6('0x12'),_0x2431f4,'request\x20sent');_0x5dc2e3(_0xad1ba5['result'][_0x8fb6('0x13')]);}})[_0x8fb6('0x14')](function(_0x154750){logger[_0x8fb6('0x10')](_0x8fb6('0x12'),_0x2431f4,_0x154750);_0x4ed431(_0x154750);});});} \ No newline at end of file +var _0x4f72=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4f72,0x11b));var _0x24f7=function(_0x549940,_0x4c4aaa){_0x549940=_0x549940-0x0;var _0x561f71=_0x4f72[_0x549940];return _0x561f71;};'use strict';var _=require('lodash');var util=require(_0x24f7('0x0'));var moment=require('moment');var BPromise=require(_0x24f7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24f7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x24f7('0x3'));var logger=require(_0x24f7('0x4'))(_0x24f7('0x5'));var config=require(_0x24f7('0x6'));var jayson=require(_0x24f7('0x7'));var client=jayson[_0x24f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a67ea,_0x5dc66b,_0x55b000){return new BPromise(function(_0x47865e,_0x5c3371){return client[_0x24f7('0x9')](_0x1a67ea,_0x55b000)[_0x24f7('0xa')](function(_0xae457e){logger[_0x24f7('0xb')](_0x24f7('0xc'),_0x5dc66b,_0x24f7('0xd'));logger[_0x24f7('0xe')](_0x24f7('0xf'),_0x5dc66b,_0x24f7('0xd'),JSON[_0x24f7('0x10')](_0xae457e));if(_0xae457e[_0x24f7('0x11')]){if(_0xae457e['error'][_0x24f7('0x12')]===0x1f4){logger['error'](_0x24f7('0xc'),_0x5dc66b,_0xae457e[_0x24f7('0x11')][_0x24f7('0x13')]);return _0x5c3371(_0xae457e[_0x24f7('0x11')][_0x24f7('0x13')]);}logger[_0x24f7('0x11')](_0x24f7('0xc'),_0x5dc66b,_0xae457e[_0x24f7('0x11')]['message']);return _0x47865e(_0xae457e[_0x24f7('0x11')][_0x24f7('0x13')]);}else{logger[_0x24f7('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x5dc66b,_0x24f7('0xd'));_0x47865e(_0xae457e[_0x24f7('0x14')][_0x24f7('0x13')]);}})[_0x24f7('0x15')](function(_0x4308f4){logger[_0x24f7('0x11')](_0x24f7('0xc'),_0x5dc66b,_0x4308f4);_0x5c3371(_0x4308f4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ab90905..f6f37c3 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x24b2a4,_0x472bfa){var _0x49e01d=function(_0x20a8a1){while(--_0x20a8a1){_0x24b2a4['push'](_0x24b2a4['shift']());}};_0x49e01d(++_0x472bfa);}(_0x70e0,0x17b));var _0x070e=function(_0x1e4e53,_0x3e055f){_0x1e4e53=_0x1e4e53-0x0;var _0x3ae6fe=_0x70e0[_0x1e4e53];return _0x3ae6fe;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x324da5,_0x55c880){var _0x51eb27=function(_0x175f35){while(--_0x175f35){_0x324da5['push'](_0x324da5['shift']());}};_0x51eb27(++_0x55c880);}(_0x70e0,0x17b));var _0x070e=function(_0x4f47d0,_0x5d9ee5){_0x4f47d0=_0x4f47d0-0x0;var _0x4e0898=_0x70e0[_0x4f47d0];return _0x4e0898;};'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 27da6f1..b231664 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 _0xc5cc=['exports','INTEGER','sequelize'];(function(_0xf81479,_0x23d02f){var _0x10d9fc=function(_0x2777c9){while(--_0x2777c9){_0xf81479['push'](_0xf81479['shift']());}};_0x10d9fc(++_0x23d02f);}(_0xc5cc,0x86));var _0xcc5c=function(_0x3b470e,_0x5b1dcd){_0x3b470e=_0x3b470e-0x0;var _0x43a6f6=_0xc5cc[_0x3b470e];return _0x43a6f6;};'use strict';var Sequelize=require(_0xcc5c('0x0'));module[_0xcc5c('0x1')]={'penalty':{'type':Sequelize[_0xcc5c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4434=['INTEGER','exports'];(function(_0x32d558,_0x9e5626){var _0x2bc401=function(_0x5e1d54){while(--_0x5e1d54){_0x32d558['push'](_0x32d558['shift']());}};_0x2bc401(++_0x9e5626);}(_0x4434,0x175));var _0x4443=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4434[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x4443('0x0')]={'penalty':{'type':Sequelize[_0x4443('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a58bbad..f3c1b72 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 _0x19c9=['rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','api','moment','request-promise'];(function(_0x90904,_0x33f6f9){var _0x12ebba=function(_0x4b4010){while(--_0x4b4010){_0x90904['push'](_0x90904['shift']());}};_0x12ebba(++_0x33f6f9);}(_0x19c9,0x10e));var _0x919c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x19c9[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x919c('0x0'));var util=require(_0x919c('0x1'));var logger=require('../../config/logger')(_0x919c('0x2'));var moment=require(_0x919c('0x3'));var BPromise=require('bluebird');var rp=require(_0x919c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x919c('0x5'));var config=require(_0x919c('0x6'));var attributes=require(_0x919c('0x7'));module[_0x919c('0x8')]=function(_0x296de0,_0x1be0f5){return _0x296de0[_0x919c('0x9')]('UserMailQueue',attributes,{'tableName':_0x919c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5498=['../../config/environment','exports','define','UserMailQueue','lodash','util','moment','bluebird','path','rimraf'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5498,0x176));var _0x8549=function(_0x4b056b,_0x19697a){_0x4b056b=_0x4b056b-0x0;var _0x22b684=_0x5498[_0x4b056b];return _0x22b684;};'use strict';var _=require(_0x8549('0x0'));var util=require(_0x8549('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8549('0x2'));var BPromise=require(_0x8549('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8549('0x4'));var rimraf=require(_0x8549('0x5'));var config=require(_0x8549('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x8549('0x7')]=function(_0x18c581,_0xd052a5){return _0x18c581[_0x8549('0x8')](_0x8549('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index be8c2c4..aa3d38d 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x450a6b,_0x4901d3){var _0x28ae6e=function(_0x1cc60e){while(--_0x1cc60e){_0x450a6b['push'](_0x450a6b['shift']());}};_0x28ae6e(++_0x4901d3);}(_0x34e8,0x12c));var _0x834e=function(_0x445593,_0x3e9cb4){_0x445593=_0x445593-0x0;var _0x55d756=_0x34e8[_0x445593];return _0x55d756;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x54236f,_0x19042b){var _0x220d0f=function(_0x575a1a){while(--_0x575a1a){_0x54236f['push'](_0x54236f['shift']());}};_0x220d0f(++_0x19042b);}(_0x3e74,0x175));var _0x43e7=function(_0x43001f,_0x19f084){_0x43001f=_0x43001f-0x0;var _0xc0e76c=_0x3e74[_0x43001f];return _0xc0e76c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3a556b0..4c2eeaf 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 _0x21a7=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x21a7,0x111));var _0x721a=function(_0x541a13,_0x1077dc){_0x541a13=_0x541a13-0x0;var _0x5ac075=_0x21a7[_0x541a13];return _0x5ac075;};'use strict';var multer=require(_0x721a('0x0'));var util=require('util');var path=require(_0x721a('0x1'));var timeout=require(_0x721a('0x2'));var express=require(_0x721a('0x3'));var router=express[_0x721a('0x4')]();var fs_extra=require(_0x721a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x721a('0x6'));var config=require(_0x721a('0x7'));var controller=require(_0x721a('0x8'));router['post']('/',auth[_0x721a('0x9')](),controller[_0x721a('0xa')]);module[_0x721a('0xb')]=router; \ No newline at end of file +var _0x43cc=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','post','isAuthenticated','exports'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x43cc,0x158));var _0xc43c=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x43cc[_0x39096d];return _0x13da4f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc43c('0x0'));var express=require(_0xc43c('0x1'));var router=express['Router']();var fs_extra=require(_0xc43c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc43c('0x3'));var config=require(_0xc43c('0x4'));var controller=require('./userNotification.controller');router[_0xc43c('0x5')]('/',auth[_0xc43c('0x6')](),controller['sendUserNotification']);module[_0xc43c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 74bcf57..356cc17 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 _0x1d39=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x1d39,0x71));var _0x91d3=function(_0x3a1b92,_0x28d1ff){_0x3a1b92=_0x3a1b92-0x0;var _0x3c35ae=_0x1d39[_0x3a1b92];return _0x3c35ae;};'use strict';var Sequelize=require(_0x91d3('0x0'));module[_0x91d3('0x1')]={'body':{'type':Sequelize[_0x91d3('0x2')]},'senderName':{'type':Sequelize[_0x91d3('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x91d3('0x4')]}}; \ No newline at end of file +var _0x1f4e=['STRING','sequelize'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x1f4e,0x197));var _0xe1f4=function(_0x1c2051,_0x4cb6b9){_0x1c2051=_0x1c2051-0x0;var _0x2b58a0=_0x1f4e[_0x1c2051];return _0x2b58a0;};'use strict';var Sequelize=require(_0xe1f4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xe1f4('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index af01b1c..5bfabe5 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 _0x84a2=['mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','User','queue','Queue','ids','push','all','flatten','getAgents','map','rimraf','fast-json-patch','request-promise','moment'];(function(_0x35d9af,_0x225c68){var _0x2b70c5=function(_0x43b503){while(--_0x43b503){_0x35d9af['push'](_0x35d9af['shift']());}};_0x2b70c5(++_0x225c68);}(_0x84a2,0x194));var _0x284a=function(_0xe17cea,_0x3eac1e){_0xe17cea=_0xe17cea-0x0;var _0x48bb15=_0x84a2[_0xe17cea];return _0x48bb15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x284a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x284a('0x1'));var rp=require(_0x284a('0x2'));var moment=require(_0x284a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x284a('0x4'));var util=require(_0x284a('0x5'));var path=require(_0x284a('0x6'));var sox=require(_0x284a('0x7'));var csv=require('to-csv');var ejs=require(_0x284a('0x8'));var fs=require('fs');var fs_extra=require(_0x284a('0x9'));var _=require('lodash');var squel=require(_0x284a('0xa'));var crypto=require('crypto');var jsforce=require(_0x284a('0xb'));var deskjs=require(_0x284a('0xc'));var toCsv=require(_0x284a('0xd'));var querystring=require(_0x284a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x284a('0xf'));var qs=require(_0x284a('0x10'));var as=require(_0x284a('0x11'));var hardwareService=require(_0x284a('0x12'));var logger=require('../../config/logger')(_0x284a('0x13'));var utils=require(_0x284a('0x14'));var config=require(_0x284a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x284a('0x16'))['db'];config[_0x284a('0x17')]=_[_0x284a('0x18')](config[_0x284a('0x17')],{'host':_0x284a('0x19'),'port':0x18eb});var socket=require(_0x284a('0x1a'))(new Redis(config[_0x284a('0x17')]));require(_0x284a('0x1b'))['register'](socket);function respondWithStatusCode(_0x4696ac,_0x53ea29){_0x53ea29=_0x53ea29||0xcc;return function(_0x11c01a){if(_0x11c01a){return _0x4696ac[_0x284a('0x1c')](_0x53ea29);}return _0x4696ac['status'](_0x53ea29)[_0x284a('0x1d')]();};}function respondWithResult(_0x4726bc,_0x479c13){_0x479c13=_0x479c13||0xc8;return function(_0x4ea252){if(_0x4ea252){return _0x4726bc['status'](_0x479c13)[_0x284a('0x1e')](_0x4ea252);}};}function respondWithFilteredResult(_0x1ab767,_0x3ed014){return function(_0x9ef69){if(_0x9ef69){var _0x1d82bb=typeof _0x3ed014[_0x284a('0x1f')]==='undefined'&&typeof _0x3ed014[_0x284a('0x20')]===_0x284a('0x21');var _0x4fff6c=_0x9ef69[_0x284a('0x22')];var _0xacf351=_0x1d82bb?0x0:_0x3ed014['offset'];var _0x1359f7=_0x1d82bb?_0x9ef69[_0x284a('0x22')]:_0x3ed014[_0x284a('0x1f')]+_0x3ed014[_0x284a('0x20')];var _0x23f537;if(_0x1359f7>=_0x4fff6c){_0x1359f7=_0x4fff6c;_0x23f537=0xc8;}else{_0x23f537=0xce;}_0x1ab767[_0x284a('0x23')](_0x23f537);return _0x1ab767[_0x284a('0x24')](_0x284a('0x25'),_0xacf351+'-'+_0x1359f7+'/'+_0x4fff6c)[_0x284a('0x1e')](_0x9ef69);}return null;};}function patchUpdates(_0x41c21d){return function(_0x15fa5e){try{jsonpatch[_0x284a('0x26')](_0x15fa5e,_0x41c21d,!![]);}catch(_0xa67bab){return BPromise[_0x284a('0x27')](_0xa67bab);}return _0x15fa5e[_0x284a('0x28')]();};}function saveUpdates(_0x56d836,_0x52d352){return function(_0x122d22){if(_0x122d22){return _0x122d22[_0x284a('0x29')](_0x56d836)['then'](function(_0x133083){return _0x133083;});}return null;};}function removeEntity(_0x2e9f9b,_0x4c01a7){return function(_0x13ea37){if(_0x13ea37){return _0x13ea37[_0x284a('0x2a')]()[_0x284a('0x2b')](function(){_0x2e9f9b[_0x284a('0x23')](0xcc)[_0x284a('0x1d')]();});}};}function handleEntityNotFound(_0x25bde0,_0x2db956){return function(_0x2772e9){if(!_0x2772e9){_0x25bde0['sendStatus'](0x194);}return _0x2772e9;};}function handleError(_0x4ec619,_0x53ff67){_0x53ff67=_0x53ff67||0x1f4;return function(_0x2bf9cd){logger[_0x284a('0x2c')](_0x2bf9cd[_0x284a('0x2d')]);if(_0x2bf9cd[_0x284a('0x2e')]){delete _0x2bf9cd['name'];}_0x4ec619[_0x284a('0x23')](_0x53ff67)[_0x284a('0x2f')](_0x2bf9cd);};}exports[_0x284a('0x30')]=function(_0x48ccfd,_0x8cd0e6,_0x204e62){if(!_0x48ccfd['body'][_0x284a('0x31')](_0x284a('0x32'))&&!_0x48ccfd[_0x284a('0x33')][_0x284a('0x31')](_0x284a('0x34'))){throw new db[(_0x284a('0x35'))][(_0x284a('0x36'))](_0x284a('0x37'));}else{if(_0x48ccfd['body'][_0x284a('0x31')](_0x284a('0x34'))&&!_0x48ccfd[_0x284a('0x33')][_0x284a('0x31')]('view')){throw new db[(_0x284a('0x35'))]['ValidationError'](_0x284a('0x38'));}if(!_0x48ccfd[_0x284a('0x33')][_0x284a('0x31')](_0x284a('0x39'))){throw new db[(_0x284a('0x35'))][(_0x284a('0x36'))](_0x284a('0x3a'));}else{try{var _0x27d1a7=JSON['parse'](_0x48ccfd[_0x284a('0x33')][_0x284a('0x39')]);}catch(_0x1d3103){logger[_0x284a('0x2c')](_0x1d3103);throw new db[(_0x284a('0x35'))][(_0x284a('0x36'))](_0x284a('0x3b'));}var _0x86f7ae=[_0x284a('0x3c'),_0x284a('0x3d'),'mailqueue',_0x284a('0x3e'),_0x284a('0x3f'),_0x284a('0x40'),_0x284a('0x41'),'team',_0x284a('0x42')];if(_[_0x284a('0x43')](_0x27d1a7,function(_0x48b5ad){return!_[_0x284a('0x44')](_0x86f7ae,_0x48b5ad[_0x284a('0x45')]['toLowerCase']());})){throw new db[(_0x284a('0x35'))][(_0x284a('0x36'))](_0x284a('0x46'));}}}var _0x24bb75={};_0x24bb75[_0x284a('0x47')]=_0x48ccfd[_0x284a('0x33')]['hasOwnProperty']('senderName')?_0x48ccfd[_0x284a('0x33')][_0x284a('0x47')]:_0x48ccfd[_0x284a('0x42')]['fullname'];_0x24bb75[_0x284a('0x48')]=_[_0x284a('0x49')](_0x48ccfd[_0x284a('0x33')]['recipientsDescription'])?null:_0x48ccfd[_0x284a('0x33')][_0x284a('0x48')];_0x24bb75['beep']=_0x48ccfd[_0x284a('0x33')][_0x284a('0x4a')]||![];_0x24bb75[_0x284a('0x4b')]=_0x48ccfd['user']['id'];return getContent(_0x48ccfd[_0x284a('0x33')])[_0x284a('0x2b')](function(_0x2eae90){_0x24bb75['body']=_0x2eae90;return getRecipients(_0x27d1a7);})[_0x284a('0x2b')](function(_0x426f6b){_0x24bb75[_0x284a('0x4c')]=_['sortBy'](_0x426f6b)[_0x284a('0x4d')](',');return db[_0x284a('0x4e')][_0x284a('0x4f')](function(_0x50e747){return db[_0x284a('0x50')][_0x284a('0x51')](_0x24bb75,{'raw':!![],'transaction':_0x50e747})['then'](function(_0x4f9bc5){var _0x2cd13d={'sender':_0x24bb75[_0x284a('0x47')],'description':_0x24bb75[_0x284a('0x48')],'content':_0x24bb75[_0x284a('0x33')],'beep':_0x24bb75[_0x284a('0x4a')]};_0x426f6b[_0x284a('0x52')](function(_0x307257){_0x2cd13d[_0x284a('0x53')]=_0x307257;socket[_0x284a('0x54')](_0x284a('0x55'),_0x2cd13d);});return _0x4f9bc5;});});})['then'](respondWithResult(_0x8cd0e6,0xc9))[_0x284a('0x56')](handleError(_0x8cd0e6,null));};function getContent(_0x2aa260){return new BPromise(function(_0x9adacd,_0x3dfe10){if(_0x2aa260[_0x284a('0x32')]){_0x9adacd(_0x2aa260[_0x284a('0x32')]);return;}return db[_0x284a('0x57')][_0x284a('0x58')]({'attributes':[_0x284a('0x59')],'where':{'id':_0x2aa260[_0x284a('0x34')]},'raw':!![]})[_0x284a('0x2b')](function(_0x5c8aba){if(!_0x5c8aba)throw new db[(_0x284a('0x35'))][(_0x284a('0x36'))](_0x284a('0x5a'));var _0x1ca604=Mustache['render'](_0x5c8aba[_0x284a('0x59')],_0x2aa260[_0x284a('0x5b')]);_0x9adacd(_0x1ca604);})[_0x284a('0x56')](function(_0x3c7981){_0x3dfe10(_0x3c7981);});});}function getRecipients(_0x4c5f5e){return new BPromise(function(_0x18d6c0,_0xf0014d){var _0xe96375=[];var _0x32981b=[];_0x4c5f5e[_0x284a('0x52')](function(_0xd57a47){var _0xb159ab=_[_0x284a('0x5c')](_0xd57a47['model']['toLowerCase']());if(_0xb159ab===_0x284a('0x5d')){_0xe96375=_['union'](_0xe96375,_0xd57a47['ids']);}else{if(_[_0x284a('0x44')](_0xb159ab,_0x284a('0x5e')))_0xb159ab=_0xb159ab['replace'](_0x284a('0x5e'),_0x284a('0x5f'));_0xd57a47[_0x284a('0x60')][_0x284a('0x52')](function(_0x548747){_0x32981b[_0x284a('0x61')](getAgents(_0xb159ab,_0x548747));});}});return BPromise[_0x284a('0x62')](_0x32981b)['then'](function(_0x1e9f4d){_0xe96375=_['union'](_0xe96375,_[_0x284a('0x63')](_0x1e9f4d));_0x18d6c0(_0xe96375);})[_0x284a('0x56')](function(_0x8fbc4c){_0xf0014d(_0x8fbc4c);});});}function getAgents(_0x5caa4a,_0x2d7139){return new BPromise(function(_0x519f03,_0x2a8e8d){return db[_0x5caa4a][_0x284a('0x58')]({'where':{'id':_0x2d7139}})['then'](function(_0x28c617){return _0x28c617[_0x284a('0x64')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a0b0e){var _0x32fc56=_[_0x284a('0x65')](_0x5a0b0e,'id');_0x519f03(_0x32fc56);});})[_0x284a('0x56')](function(_0x3c028a){_0x2a8e8d(_0x3c028a);});});} \ No newline at end of file +var _0x8531=['html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','ids','queue','replace','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./userNotification.socket','status','json','offset','undefined','limit','count','set','Content-Range','save','update','end','sendStatus','error','stack','name','send','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','then','sortBy','join','sequelize','transaction','forEach','recipient','userNotification:send','catch','findOne'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0x8531,0x196));var _0x1853=function(_0x34750b,_0x34aae5){_0x34750b=_0x34750b-0x0;var _0x244258=_0x8531[_0x34750b];return _0x244258;};'use strict';var emlformat=require(_0x1853('0x0'));var rimraf=require(_0x1853('0x1'));var zipdir=require(_0x1853('0x2'));var jsonpatch=require(_0x1853('0x3'));var rp=require(_0x1853('0x4'));var moment=require(_0x1853('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1853('0x6'));var util=require('util');var path=require(_0x1853('0x7'));var sox=require(_0x1853('0x8'));var csv=require(_0x1853('0x9'));var ejs=require(_0x1853('0xa'));var fs=require('fs');var fs_extra=require(_0x1853('0xb'));var _=require(_0x1853('0xc'));var squel=require(_0x1853('0xd'));var crypto=require('crypto');var jsforce=require(_0x1853('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1853('0x9'));var querystring=require(_0x1853('0xf'));var Papa=require('papaparse');var Redis=require(_0x1853('0x10'));var authService=require(_0x1853('0x11'));var qs=require(_0x1853('0x12'));var as=require(_0x1853('0x13'));var hardwareService=require(_0x1853('0x14'));var logger=require(_0x1853('0x15'))(_0x1853('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1853('0x17'))['db'];config[_0x1853('0x18')]=_[_0x1853('0x19')](config[_0x1853('0x18')],{'host':_0x1853('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1853('0x18')]));require(_0x1853('0x1b'))['register'](socket);function respondWithStatusCode(_0x586c4c,_0x5315c3){_0x5315c3=_0x5315c3||0xcc;return function(_0x2f3f0f){if(_0x2f3f0f){return _0x586c4c['sendStatus'](_0x5315c3);}return _0x586c4c[_0x1853('0x1c')](_0x5315c3)['end']();};}function respondWithResult(_0x32e409,_0x473b62){_0x473b62=_0x473b62||0xc8;return function(_0x5984a2){if(_0x5984a2){return _0x32e409[_0x1853('0x1c')](_0x473b62)[_0x1853('0x1d')](_0x5984a2);}};}function respondWithFilteredResult(_0x32354f,_0x23c857){return function(_0xc55a27){if(_0xc55a27){var _0x94ea92=typeof _0x23c857[_0x1853('0x1e')]===_0x1853('0x1f')&&typeof _0x23c857[_0x1853('0x20')]==='undefined';var _0x10804d=_0xc55a27[_0x1853('0x21')];var _0x4f298a=_0x94ea92?0x0:_0x23c857[_0x1853('0x1e')];var _0x30fda8=_0x94ea92?_0xc55a27[_0x1853('0x21')]:_0x23c857[_0x1853('0x1e')]+_0x23c857[_0x1853('0x20')];var _0x564c53;if(_0x30fda8>=_0x10804d){_0x30fda8=_0x10804d;_0x564c53=0xc8;}else{_0x564c53=0xce;}_0x32354f[_0x1853('0x1c')](_0x564c53);return _0x32354f[_0x1853('0x22')](_0x1853('0x23'),_0x4f298a+'-'+_0x30fda8+'/'+_0x10804d)['json'](_0xc55a27);}return null;};}function patchUpdates(_0x59051f){return function(_0xf345f9){try{jsonpatch['apply'](_0xf345f9,_0x59051f,!![]);}catch(_0x1c020b){return BPromise['reject'](_0x1c020b);}return _0xf345f9[_0x1853('0x24')]();};}function saveUpdates(_0x28c8ae,_0x4cb507){return function(_0x223686){if(_0x223686){return _0x223686[_0x1853('0x25')](_0x28c8ae)['then'](function(_0x5792fd){return _0x5792fd;});}return null;};}function removeEntity(_0xb360aa,_0x2cab26){return function(_0x888f81){if(_0x888f81){return _0x888f81['destroy']()['then'](function(){_0xb360aa[_0x1853('0x1c')](0xcc)[_0x1853('0x26')]();});}};}function handleEntityNotFound(_0x3647e3,_0x33b152){return function(_0x2842be){if(!_0x2842be){_0x3647e3[_0x1853('0x27')](0x194);}return _0x2842be;};}function handleError(_0x142c7d,_0x2b403a){_0x2b403a=_0x2b403a||0x1f4;return function(_0x602827){logger[_0x1853('0x28')](_0x602827[_0x1853('0x29')]);if(_0x602827[_0x1853('0x2a')]){delete _0x602827[_0x1853('0x2a')];}_0x142c7d[_0x1853('0x1c')](_0x2b403a)[_0x1853('0x2b')](_0x602827);};}exports[_0x1853('0x2c')]=function(_0x3e5785,_0x56b65c,_0x37fb81){if(!_0x3e5785['body'][_0x1853('0x2d')](_0x1853('0x2e'))&&!_0x3e5785['body'][_0x1853('0x2d')](_0x1853('0x2f'))){throw new db[(_0x1853('0x30'))][(_0x1853('0x31'))](_0x1853('0x32'));}else{if(_0x3e5785[_0x1853('0x33')][_0x1853('0x2d')](_0x1853('0x2f'))&&!_0x3e5785[_0x1853('0x33')][_0x1853('0x2d')](_0x1853('0x34'))){throw new db[(_0x1853('0x30'))][(_0x1853('0x31'))](_0x1853('0x35'));}if(!_0x3e5785[_0x1853('0x33')]['hasOwnProperty'](_0x1853('0x36'))){throw new db[(_0x1853('0x30'))][(_0x1853('0x31'))](_0x1853('0x37'));}else{try{var _0x497124=JSON[_0x1853('0x38')](_0x3e5785[_0x1853('0x33')][_0x1853('0x36')]);}catch(_0x234403){logger[_0x1853('0x28')](_0x234403);throw new db[(_0x1853('0x30'))][(_0x1853('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x37f24b=[_0x1853('0x39'),_0x1853('0x3a'),'mailqueue',_0x1853('0x3b'),_0x1853('0x3c'),_0x1853('0x3d'),_0x1853('0x3e'),_0x1853('0x3f'),_0x1853('0x40')];if(_[_0x1853('0x41')](_0x497124,function(_0x197df5){return!_[_0x1853('0x42')](_0x37f24b,_0x197df5[_0x1853('0x43')]['toLowerCase']());})){throw new db[(_0x1853('0x30'))][(_0x1853('0x31'))](_0x1853('0x44'));}}}var _0x5302a2={};_0x5302a2[_0x1853('0x45')]=_0x3e5785[_0x1853('0x33')][_0x1853('0x2d')](_0x1853('0x45'))?_0x3e5785[_0x1853('0x33')][_0x1853('0x45')]:_0x3e5785[_0x1853('0x40')][_0x1853('0x46')];_0x5302a2[_0x1853('0x47')]=_['isEmpty'](_0x3e5785[_0x1853('0x33')][_0x1853('0x47')])?null:_0x3e5785[_0x1853('0x33')]['recipientsDescription'];_0x5302a2['beep']=_0x3e5785[_0x1853('0x33')][_0x1853('0x48')]||![];_0x5302a2[_0x1853('0x49')]=_0x3e5785[_0x1853('0x40')]['id'];return getContent(_0x3e5785[_0x1853('0x33')])[_0x1853('0x4a')](function(_0xfb0762){_0x5302a2[_0x1853('0x33')]=_0xfb0762;return getRecipients(_0x497124);})[_0x1853('0x4a')](function(_0x3df017){_0x5302a2['recipientsId']=_[_0x1853('0x4b')](_0x3df017)[_0x1853('0x4c')](',');return db[_0x1853('0x4d')][_0x1853('0x4e')](function(_0x42fb73){return db['UserNotification']['create'](_0x5302a2,{'raw':!![],'transaction':_0x42fb73})['then'](function(_0x34b234){var _0x385f42={'sender':_0x5302a2[_0x1853('0x45')],'description':_0x5302a2['recipientsDescription'],'content':_0x5302a2[_0x1853('0x33')],'beep':_0x5302a2['beep']};_0x3df017[_0x1853('0x4f')](function(_0x24003a){_0x385f42[_0x1853('0x50')]=_0x24003a;socket['emit'](_0x1853('0x51'),_0x385f42);});return _0x34b234;});});})[_0x1853('0x4a')](respondWithResult(_0x56b65c,0xc9))[_0x1853('0x52')](handleError(_0x56b65c,null));};function getContent(_0x3cdbc8){return new BPromise(function(_0x4bfa37,_0x22bd93){if(_0x3cdbc8[_0x1853('0x2e')]){_0x4bfa37(_0x3cdbc8[_0x1853('0x2e')]);return;}return db['Template'][_0x1853('0x53')]({'attributes':[_0x1853('0x54')],'where':{'id':_0x3cdbc8[_0x1853('0x2f')]},'raw':!![]})[_0x1853('0x4a')](function(_0x5dee83){if(!_0x5dee83)throw new db['Sequelize'][(_0x1853('0x31'))](_0x1853('0x55'));var _0x3429af=Mustache[_0x1853('0x56')](_0x5dee83['html'],_0x3cdbc8[_0x1853('0x34')]);_0x4bfa37(_0x3429af);})[_0x1853('0x52')](function(_0x33acf5){_0x22bd93(_0x33acf5);});});}function getRecipients(_0xe2a9a3){return new BPromise(function(_0x1d54ab,_0x5c535e){var _0x5e870e=[];var _0x61f4c4=[];_0xe2a9a3['forEach'](function(_0x4eaebb){var _0x2272b7=_[_0x1853('0x57')](_0x4eaebb['model'][_0x1853('0x58')]());if(_0x2272b7===_0x1853('0x59')){_0x5e870e=_[_0x1853('0x5a')](_0x5e870e,_0x4eaebb[_0x1853('0x5b')]);}else{if(_[_0x1853('0x42')](_0x2272b7,_0x1853('0x5c')))_0x2272b7=_0x2272b7[_0x1853('0x5d')](_0x1853('0x5c'),'Queue');_0x4eaebb['ids']['forEach'](function(_0x54ff87){_0x61f4c4[_0x1853('0x5e')](getAgents(_0x2272b7,_0x54ff87));});}});return BPromise[_0x1853('0x5f')](_0x61f4c4)[_0x1853('0x4a')](function(_0x56494c){_0x5e870e=_[_0x1853('0x5a')](_0x5e870e,_['flatten'](_0x56494c));_0x1d54ab(_0x5e870e);})['catch'](function(_0x62129e){_0x5c535e(_0x62129e);});});}function getAgents(_0x99fb15,_0x55ca14){return new BPromise(function(_0x187411,_0x350c81){return db[_0x99fb15]['findOne']({'where':{'id':_0x55ca14}})[_0x1853('0x4a')](function(_0x123f5f){return _0x123f5f[_0x1853('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x484f62){var _0x514866=_[_0x1853('0x61')](_0x484f62,'id');_0x187411(_0x514866);});})[_0x1853('0x52')](function(_0x1aab99){_0x350c81(_0x1aab99);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 911e9f5..0090b23 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 _0x5e83=['exports','events','../../mysqldb','UserNotification','setMaxListeners','save','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5e83,0xf1));var _0x35e8=function(_0x1486bc,_0x204e1f){_0x1486bc=_0x1486bc-0x0;var _0x4009e1=_0x5e83[_0x1486bc];return _0x4009e1;};'use strict';var EventEmitter=require(_0x35e8('0x0'));var UserNotification=require(_0x35e8('0x1'))['db'][_0x35e8('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x35e8('0x3')](0x0);var events={'afterCreate':_0x35e8('0x4'),'afterUpdate':'update','afterDestroy':_0x35e8('0x5')};function emitEvent(_0x3e0c6d){return function(_0x8ecfac,_0x2e057f,_0x216ca7){UserNotificationEvents[_0x35e8('0x6')](_0x3e0c6d+':'+_0x8ecfac['id'],_0x8ecfac);UserNotificationEvents[_0x35e8('0x6')](_0x3e0c6d,_0x8ecfac);_0x216ca7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x35e8('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x7af2=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3c1984,_0x4536f8){var _0x9bc24=function(_0x397339){while(--_0x397339){_0x3c1984['push'](_0x3c1984['shift']());}};_0x9bc24(++_0x4536f8);}(_0x7af2,0x10c));var _0x27af=function(_0x1764c2,_0x4e0886){_0x1764c2=_0x1764c2-0x0;var _0x5e5446=_0x7af2[_0x1764c2];return _0x5e5446;};'use strict';var EventEmitter=require(_0x27af('0x0'));var UserNotification=require(_0x27af('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x27af('0x2')](0x0);var events={'afterCreate':_0x27af('0x3'),'afterUpdate':'update','afterDestroy':_0x27af('0x4')};function emitEvent(_0x1311ca){return function(_0x3bfa64,_0x305f1e,_0x207c57){UserNotificationEvents[_0x27af('0x5')](_0x1311ca+':'+_0x3bfa64['id'],_0x3bfa64);UserNotificationEvents[_0x27af('0x5')](_0x1311ca,_0x3bfa64);_0x207c57(null);};}for(var e in events){if(events[_0x27af('0x6')](e)){var event=events[e];UserNotification[_0x27af('0x7')](e,emitEvent(event));}}module[_0x27af('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 dab877d..8597b98 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 _0xf8c8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf8c8,0x1cf));var _0x8f8c=function(_0x10abd1,_0x8d988d){_0x10abd1=_0x10abd1-0x0;var _0x354083=_0xf8c8[_0x10abd1];return _0x354083;};'use strict';var _=require(_0x8f8c('0x0'));var util=require('util');var logger=require(_0x8f8c('0x1'))(_0x8f8c('0x2'));var moment=require(_0x8f8c('0x3'));var BPromise=require(_0x8f8c('0x4'));var rp=require(_0x8f8c('0x5'));var fs=require('fs');var path=require(_0x8f8c('0x6'));var rimraf=require(_0x8f8c('0x7'));var config=require(_0x8f8c('0x8'));var attributes=require(_0x8f8c('0x9'));module['exports']=function(_0x348e95,_0x29cc92){return _0x348e95[_0x8f8c('0xa')](_0x8f8c('0xb'),attributes,{'tableName':_0x8f8c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f8c('0xd'),'collate':_0x8f8c('0xe')});}; \ No newline at end of file +var _0x0a14=['lodash','api','moment','request-promise','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x34d28c,_0x489a06){var _0x5bf526=function(_0x16f7ea){while(--_0x16f7ea){_0x34d28c['push'](_0x34d28c['shift']());}};_0x5bf526(++_0x489a06);}(_0x0a14,0x1b8));var _0x40a1=function(_0xb18b25,_0x404b6a){_0xb18b25=_0xb18b25-0x0;var _0x4850e1=_0x0a14[_0xb18b25];return _0x4850e1;};'use strict';var _=require(_0x40a1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x40a1('0x1'));var moment=require(_0x40a1('0x2'));var BPromise=require('bluebird');var rp=require(_0x40a1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x40a1('0x4'));var attributes=require('./userNotification.attributes');module[_0x40a1('0x5')]=function(_0x30bc6d,_0x129821){return _0x30bc6d[_0x40a1('0x6')](_0x40a1('0x7'),attributes,{'tableName':_0x40a1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x40a1('0x9'),'collate':_0x40a1('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index baea808..3b7085b 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 _0x1668=['stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x4436a1,_0x45bf24){var _0xeac2da=function(_0xb1c6d){while(--_0xb1c6d){_0x4436a1['push'](_0x4436a1['shift']());}};_0xeac2da(++_0x45bf24);}(_0x1668,0xf6));var _0x8166=function(_0x2c6a76,_0x1edd9a){_0x2c6a76=_0x2c6a76-0x0;var _0x889d=_0x1668[_0x2c6a76];return _0x889d;};'use strict';var _=require('lodash');var util=require(_0x8166('0x0'));var moment=require(_0x8166('0x1'));var BPromise=require(_0x8166('0x2'));var rs=require(_0x8166('0x3'));var fs=require('fs');var Redis=require(_0x8166('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8166('0x5'))('rpc');var config=require(_0x8166('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8166('0x7')]({'port':0x232a});config['redis']=_[_0x8166('0x8')](config[_0x8166('0x9')],{'host':_0x8166('0xa'),'port':0x18eb});var socket=require(_0x8166('0xb'))(new Redis(config[_0x8166('0x9')]));require('./userNotification.socket')[_0x8166('0xc')](socket);function respondWithRpcPromise(_0x309d9b,_0x4d30f7,_0x183d34){return new BPromise(function(_0x36a024,_0x30bc56){return client[_0x8166('0xd')](_0x309d9b,_0x183d34)['then'](function(_0x4cba6c){logger['info'](_0x8166('0xe'),_0x4d30f7,_0x8166('0xf'));logger[_0x8166('0x10')](_0x8166('0x11'),_0x4d30f7,_0x8166('0xf'),JSON[_0x8166('0x12')](_0x4cba6c));if(_0x4cba6c['error']){if(_0x4cba6c[_0x8166('0x13')][_0x8166('0x14')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x4d30f7,_0x4cba6c[_0x8166('0x13')][_0x8166('0x15')]);return _0x30bc56(_0x4cba6c[_0x8166('0x13')][_0x8166('0x15')]);}logger[_0x8166('0x13')](_0x8166('0xe'),_0x4d30f7,_0x4cba6c['error'][_0x8166('0x15')]);return _0x36a024(_0x4cba6c['error']['message']);}else{logger[_0x8166('0x16')](_0x8166('0xe'),_0x4d30f7,'request\x20sent');_0x36a024(_0x4cba6c['result']['message']);}})[_0x8166('0x17')](function(_0x13b7a4){logger['error'](_0x8166('0xe'),_0x4d30f7,_0x13b7a4);_0x30bc56(_0x13b7a4);});});} \ No newline at end of file +var _0x7a92=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45c978,_0x2cca46){var _0x50bf8e=function(_0x9461e){while(--_0x9461e){_0x45c978['push'](_0x45c978['shift']());}};_0x50bf8e(++_0x2cca46);}(_0x7a92,0x66));var _0x27a9=function(_0x127bd8,_0x3e20a8){_0x127bd8=_0x127bd8-0x0;var _0x4c6147=_0x7a92[_0x127bd8];return _0x4c6147;};'use strict';var _=require(_0x27a9('0x0'));var util=require('util');var moment=require(_0x27a9('0x1'));var BPromise=require(_0x27a9('0x2'));var rs=require(_0x27a9('0x3'));var fs=require('fs');var Redis=require(_0x27a9('0x4'));var db=require(_0x27a9('0x5'))['db'];var utils=require(_0x27a9('0x6'));var logger=require(_0x27a9('0x7'))(_0x27a9('0x8'));var config=require(_0x27a9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x27a9('0xa')][_0x27a9('0xb')]({'port':0x232a});config[_0x27a9('0xc')]=_[_0x27a9('0xd')](config[_0x27a9('0xc')],{'host':_0x27a9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27a9('0xc')]));require(_0x27a9('0xf'))['register'](socket);function respondWithRpcPromise(_0x465f1f,_0x1ee8e8,_0x33b160){return new BPromise(function(_0x1c2093,_0x254f33){return client[_0x27a9('0x10')](_0x465f1f,_0x33b160)[_0x27a9('0x11')](function(_0x3cae19){logger[_0x27a9('0x12')](_0x27a9('0x13'),_0x1ee8e8,_0x27a9('0x14'));logger['debug'](_0x27a9('0x15'),_0x1ee8e8,_0x27a9('0x14'),JSON[_0x27a9('0x16')](_0x3cae19));if(_0x3cae19['error']){if(_0x3cae19[_0x27a9('0x17')][_0x27a9('0x18')]===0x1f4){logger[_0x27a9('0x17')](_0x27a9('0x13'),_0x1ee8e8,_0x3cae19[_0x27a9('0x17')][_0x27a9('0x19')]);return _0x254f33(_0x3cae19[_0x27a9('0x17')]['message']);}logger['error'](_0x27a9('0x13'),_0x1ee8e8,_0x3cae19[_0x27a9('0x17')][_0x27a9('0x19')]);return _0x1c2093(_0x3cae19[_0x27a9('0x17')][_0x27a9('0x19')]);}else{logger[_0x27a9('0x12')](_0x27a9('0x13'),_0x1ee8e8,'request\x20sent');_0x1c2093(_0x3cae19[_0x27a9('0x1a')][_0x27a9('0x19')]);}})['catch'](function(_0x2555cc){logger[_0x27a9('0x17')](_0x27a9('0x13'),_0x1ee8e8,_0x2555cc);_0x254f33(_0x2555cc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 15ca9f5..5f38042 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 _0x6a40=['userNotification:','./userNotification.events','save','update','removeListener','length'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x6a40,0x109));var _0x06a4=function(_0x38f398,_0x17d212){_0x38f398=_0x38f398-0x0;var _0x35196a=_0x6a40[_0x38f398];return _0x35196a;};'use strict';var UserNotificationEvents=require(_0x06a4('0x0'));var events=[_0x06a4('0x1'),'remove',_0x06a4('0x2')];function createListener(_0x59ed1b,_0x36d68b){return function(_0x56b6ce){_0x36d68b['emit'](_0x59ed1b,_0x56b6ce);};}function removeListener(_0x35fc87,_0x3ff001){return function(){UserNotificationEvents[_0x06a4('0x3')](_0x35fc87,_0x3ff001);};}exports['register']=function(_0x1832d7){for(var _0x52fbb3=0x0,_0x48c8b5=events[_0x06a4('0x4')];_0x52fbb3<_0x48c8b5;_0x52fbb3++){var _0x1dc6e9=events[_0x52fbb3];var _0x5d2a7c=createListener(_0x06a4('0x5')+_0x1dc6e9,_0x1832d7);UserNotificationEvents['on'](_0x1dc6e9,_0x5d2a7c);}}; \ No newline at end of file +var _0xcf43=['save','remove','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcf43,0xdf));var _0x3cf4=function(_0x1103c4,_0x562d1d){_0x1103c4=_0x1103c4-0x0;var _0x1c19ab=_0xcf43[_0x1103c4];return _0x1c19ab;};'use strict';var UserNotificationEvents=require(_0x3cf4('0x0'));var events=[_0x3cf4('0x1'),_0x3cf4('0x2'),'update'];function createListener(_0x5dc798,_0x4da011){return function(_0x4e4057){_0x4da011[_0x3cf4('0x3')](_0x5dc798,_0x4e4057);};}function removeListener(_0x3317a3,_0x35b04c){return function(){UserNotificationEvents[_0x3cf4('0x4')](_0x3317a3,_0x35b04c);};}exports[_0x3cf4('0x5')]=function(_0x178c06){for(var _0x368d14=0x0,_0x276702=events[_0x3cf4('0x6')];_0x368d14<_0x276702;_0x368d14++){var _0x25dba1=events[_0x368d14];var _0x381506=createListener(_0x3cf4('0x7')+_0x25dba1,_0x178c06);UserNotificationEvents['on'](_0x25dba1,_0x381506);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 906f43f..54cec7f 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x40b25d,_0x5ce24a){var _0x12b2bd=function(_0xdaec24){while(--_0xdaec24){_0x40b25d['push'](_0x40b25d['shift']());}};_0x12b2bd(++_0x5ce24a);}(_0xe706,0xa3));var _0x6e70=function(_0x20f3a3,_0xe879a){_0x20f3a3=_0x20f3a3-0x0;var _0x4ecd05=_0xe706[_0x20f3a3];return _0x4ecd05;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x44586a,_0x2f8c7f){var _0x512c56=function(_0x59b65b){while(--_0x59b65b){_0x44586a['push'](_0x44586a['shift']());}};_0x512c56(++_0x2f8c7f);}(_0x70e0,0x17b));var _0x070e=function(_0x2f63ba,_0x586ecf){_0x2f63ba=_0x2f63ba-0x0;var _0x136bee=_0x70e0[_0x2f63ba];return _0x136bee;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 6abc328..d2687ff 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 _0x7058=['exports','sequelize'];(function(_0x404474,_0x106c0c){var _0x223277=function(_0xc9efcb){while(--_0xc9efcb){_0x404474['push'](_0x404474['shift']());}};_0x223277(++_0x106c0c);}(_0x7058,0xc9));var _0x8705=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7058[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x8705('0x0'));module[_0x8705('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7266=['exports','INTEGER','sequelize'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x7266,0xec));var _0x6726=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7266[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x6726('0x0'));module[_0x6726('0x1')]={'penalty':{'type':Sequelize[_0x6726('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 0cc2175..6e16877 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 _0x6f2d=['UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x41fb10,_0x4f93b0){var _0x1c1c0c=function(_0x25db6f){while(--_0x25db6f){_0x41fb10['push'](_0x41fb10['shift']());}};_0x1c1c0c(++_0x4f93b0);}(_0x6f2d,0x175));var _0xd6f2=function(_0x538970,_0x2cee6b){_0x538970=_0x538970-0x0;var _0x185674=_0x6f2d[_0x538970];return _0x185674;};'use strict';var _=require(_0xd6f2('0x0'));var util=require(_0xd6f2('0x1'));var logger=require(_0xd6f2('0x2'))(_0xd6f2('0x3'));var moment=require(_0xd6f2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6f2('0x5'));var fs=require('fs');var path=require(_0xd6f2('0x6'));var rimraf=require(_0xd6f2('0x7'));var config=require(_0xd6f2('0x8'));var attributes=require(_0xd6f2('0x9'));module[_0xd6f2('0xa')]=function(_0x331cea,_0xc18502){return _0x331cea['define'](_0xd6f2('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7449=['UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x191cb0,_0x1fd42c){var _0x4629fd=function(_0x178ed8){while(--_0x178ed8){_0x191cb0['push'](_0x191cb0['shift']());}};_0x4629fd(++_0x1fd42c);}(_0x7449,0x119));var _0x9744=function(_0x122689,_0xf37da3){_0x122689=_0x122689-0x0;var _0x40384a=_0x7449[_0x122689];return _0x40384a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9744('0x0'))('api');var moment=require(_0x9744('0x1'));var BPromise=require(_0x9744('0x2'));var rp=require(_0x9744('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9744('0x4'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0x9744('0x5')]=function(_0x52cdf0,_0x1d3000){return _0x52cdf0[_0x9744('0x6')](_0x9744('0x7'),attributes,{'tableName':_0x9744('0x8'),'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 efe981a..5a72d9b 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 _0x719d=['stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x55a715,_0x51b70e){var _0x4b918a=function(_0x3e564e){while(--_0x3e564e){_0x55a715['push'](_0x55a715['shift']());}};_0x4b918a(++_0x51b70e);}(_0x719d,0x9d));var _0xd719=function(_0x55d6a5,_0x377f48){_0x55d6a5=_0x55d6a5-0x0;var _0x3c8ea2=_0x719d[_0x55d6a5];return _0x3c8ea2;};'use strict';var _=require(_0xd719('0x0'));var util=require(_0xd719('0x1'));var moment=require(_0xd719('0x2'));var BPromise=require(_0xd719('0x3'));var rs=require(_0xd719('0x4'));var fs=require('fs');var Redis=require(_0xd719('0x5'));var db=require(_0xd719('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd719('0x7'))(_0xd719('0x8'));var config=require(_0xd719('0x9'));var jayson=require(_0xd719('0xa'));var client=jayson[_0xd719('0xb')][_0xd719('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f1822,_0x151fe1,_0x459ec0){return new BPromise(function(_0x59b9a0,_0xeb592a){return client[_0xd719('0xd')](_0x5f1822,_0x459ec0)[_0xd719('0xe')](function(_0x3bb05c){logger['info'](_0xd719('0xf'),_0x151fe1,'request\x20sent');logger[_0xd719('0x10')](_0xd719('0x11'),_0x151fe1,'request\x20sent',JSON[_0xd719('0x12')](_0x3bb05c));if(_0x3bb05c[_0xd719('0x13')]){if(_0x3bb05c[_0xd719('0x13')]['code']===0x1f4){logger['error'](_0xd719('0xf'),_0x151fe1,_0x3bb05c[_0xd719('0x13')]['message']);return _0xeb592a(_0x3bb05c[_0xd719('0x13')]['message']);}logger[_0xd719('0x13')](_0xd719('0xf'),_0x151fe1,_0x3bb05c[_0xd719('0x13')][_0xd719('0x14')]);return _0x59b9a0(_0x3bb05c['error']['message']);}else{logger[_0xd719('0x15')](_0xd719('0xf'),_0x151fe1,_0xd719('0x16'));_0x59b9a0(_0x3bb05c[_0xd719('0x17')][_0xd719('0x14')]);}})[_0xd719('0x18')](function(_0x3431b4){logger[_0xd719('0x13')](_0xd719('0xf'),_0x151fe1,_0x3431b4);_0xeb592a(_0x3431b4);});});} \ No newline at end of file +var _0x918b=['../../config/logger','rpc','../../config/environment','http','request','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1d174c,_0xd71a94){var _0x193cbf=function(_0x140302){while(--_0x140302){_0x1d174c['push'](_0x1d174c['shift']());}};_0x193cbf(++_0xd71a94);}(_0x918b,0x13e));var _0xb918=function(_0x26c9fb,_0x4282e2){_0x26c9fb=_0x26c9fb-0x0;var _0x3210a8=_0x918b[_0x26c9fb];return _0x3210a8;};'use strict';var _=require('lodash');var util=require(_0xb918('0x0'));var moment=require(_0xb918('0x1'));var BPromise=require(_0xb918('0x2'));var rs=require(_0xb918('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb918('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb918('0x5'))(_0xb918('0x6'));var config=require(_0xb918('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb918('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54343b,_0x552067,_0x27e1df){return new BPromise(function(_0x1154b0,_0x20c103){return client[_0xb918('0x9')](_0x54343b,_0x27e1df)['then'](function(_0x378bb3){logger[_0xb918('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x552067,'request\x20sent');logger[_0xb918('0xb')](_0xb918('0xc'),_0x552067,_0xb918('0xd'),JSON['stringify'](_0x378bb3));if(_0x378bb3['error']){if(_0x378bb3[_0xb918('0xe')][_0xb918('0xf')]===0x1f4){logger[_0xb918('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x552067,_0x378bb3[_0xb918('0xe')][_0xb918('0x10')]);return _0x20c103(_0x378bb3[_0xb918('0xe')][_0xb918('0x10')]);}logger['error'](_0xb918('0x11'),_0x552067,_0x378bb3[_0xb918('0xe')][_0xb918('0x10')]);return _0x1154b0(_0x378bb3['error'][_0xb918('0x10')]);}else{logger[_0xb918('0xa')](_0xb918('0x11'),_0x552067,'request\x20sent');_0x1154b0(_0x378bb3[_0xb918('0x12')][_0xb918('0x10')]);}})['catch'](function(_0xecd461){logger[_0xb918('0xe')](_0xb918('0x11'),_0x552067,_0xecd461);_0x20c103(_0xecd461);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 0daa80e..e3e50b4 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 _0x002e=['describe','/:id','show','/:id/resources','create','post','/:id/clone','/:id/sections','addSections','addResources','put','delete','destroy','removeSections','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x002e,0x186));var _0xe002=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x002e[_0x1e4f2f];return _0xccea89;};'use strict';var multer=require(_0xe002('0x0'));var util=require('util');var path=require(_0xe002('0x1'));var timeout=require(_0xe002('0x2'));var express=require(_0xe002('0x3'));var router=express[_0xe002('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe002('0x5'));var interaction=require(_0xe002('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router['get']('/',auth[_0xe002('0x7')](),controller['index']);router[_0xe002('0x8')](_0xe002('0x9'),auth[_0xe002('0x7')](),controller[_0xe002('0xa')]);router['get'](_0xe002('0xb'),auth[_0xe002('0x7')](),controller[_0xe002('0xc')]);router[_0xe002('0x8')]('/:id/sections',auth['isAuthenticated'](),controller['getSections']);router[_0xe002('0x8')](_0xe002('0xd'),auth[_0xe002('0x7')](),controller['getResources']);router['post']('/',auth[_0xe002('0x7')](),controller[_0xe002('0xe')]);router[_0xe002('0xf')](_0xe002('0x10'),auth[_0xe002('0x7')](),controller['clone']);router['post'](_0xe002('0x11'),auth['isAuthenticated'](),controller[_0xe002('0x12')]);router[_0xe002('0xf')](_0xe002('0xd'),auth[_0xe002('0x7')](),controller[_0xe002('0x13')]);router[_0xe002('0x14')](_0xe002('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe002('0x15')](_0xe002('0xb'),auth[_0xe002('0x7')](),controller[_0xe002('0x16')]);router['delete'](_0xe002('0x11'),auth['isAuthenticated'](),controller[_0xe002('0x17')]);router[_0xe002('0x15')](_0xe002('0xd'),auth[_0xe002('0x7')](),controller['removeResources']);module[_0xe002('0x18')]=router; \ No newline at end of file +var _0x6cae=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6cae,0xf0));var _0xe6ca=function(_0x33b0fa,_0x50e000){_0x33b0fa=_0x33b0fa-0x0;var _0xb7b8e6=_0x6cae[_0x33b0fa];return _0xb7b8e6;};'use strict';var multer=require(_0xe6ca('0x0'));var util=require(_0xe6ca('0x1'));var path=require('path');var timeout=require(_0xe6ca('0x2'));var express=require(_0xe6ca('0x3'));var router=express[_0xe6ca('0x4')]();var fs_extra=require(_0xe6ca('0x5'));var auth=require(_0xe6ca('0x6'));var interaction=require(_0xe6ca('0x7'));var config=require(_0xe6ca('0x8'));var controller=require('./userProfile.controller');router[_0xe6ca('0x9')]('/',auth[_0xe6ca('0xa')](),controller[_0xe6ca('0xb')]);router[_0xe6ca('0x9')](_0xe6ca('0xc'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0xd')]);router[_0xe6ca('0x9')](_0xe6ca('0xe'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0xf')]);router[_0xe6ca('0x9')]('/:id/sections',auth[_0xe6ca('0xa')](),controller['getSections']);router[_0xe6ca('0x9')](_0xe6ca('0x10'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0x11')]);router[_0xe6ca('0x12')]('/',auth['isAuthenticated'](),controller[_0xe6ca('0x13')]);router[_0xe6ca('0x12')](_0xe6ca('0x14'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0x15')]);router[_0xe6ca('0x12')](_0xe6ca('0x16'),auth[_0xe6ca('0xa')](),controller['addSections']);router[_0xe6ca('0x12')]('/:id/resources',auth[_0xe6ca('0xa')](),controller[_0xe6ca('0x17')]);router[_0xe6ca('0x18')](_0xe6ca('0xe'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0x19')]);router[_0xe6ca('0x1a')](_0xe6ca('0xe'),auth['isAuthenticated'](),controller[_0xe6ca('0x1b')]);router[_0xe6ca('0x1a')](_0xe6ca('0x16'),auth[_0xe6ca('0xa')](),controller[_0xe6ca('0x1c')]);router['delete']('/:id/resources',auth[_0xe6ca('0xa')](),controller[_0xe6ca('0x1d')]);module[_0xe6ca('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2dc6458..04bbaa5 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 _0xc331=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3557d0,_0x39f204){var _0x38d56c=function(_0x5a582e){while(--_0x5a582e){_0x3557d0['push'](_0x3557d0['shift']());}};_0x38d56c(++_0x39f204);}(_0xc331,0x76));var _0x1c33=function(_0x455e83,_0x4d945b){_0x455e83=_0x455e83-0x0;var _0x17cc28=_0xc331[_0x455e83];return _0x17cc28;};'use strict';var Sequelize=require(_0x1c33('0x0'));module[_0x1c33('0x1')]={'name':{'type':Sequelize[_0x1c33('0x2')],'allowNull':![],'unique':_0x1c33('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xd08099){this[_0x1c33('0x4')](_0x1c33('0x5'),_0xd08099?_0xd08099[_0x1c33('0x6')](''):[]);},'get':function(){return this[_0x1c33('0x7')](_0x1c33('0x5'))?this[_0x1c33('0x7')](_0x1c33('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1c33('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x1c33('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x1c33('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x1c33('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x1c33('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1c33('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x1c33('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1c33('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc85b=['getDataValue','split','BOOLEAN','exports','STRING','crudPermissions'];(function(_0x2721fe,_0x5a87d5){var _0x232c7e=function(_0x33a222){while(--_0x33a222){_0x2721fe['push'](_0x2721fe['shift']());}};_0x232c7e(++_0x5a87d5);}(_0xc85b,0x117));var _0xbc85=function(_0x3fd672,_0x57bdb9){_0x3fd672=_0x3fd672-0x0;var _0x2d8397=_0xc85b[_0x3fd672];return _0x2d8397;};'use strict';var Sequelize=require('sequelize');module[_0xbc85('0x0')]={'name':{'type':Sequelize[_0xbc85('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xbc85('0x1')],'set':function(_0x2fe6b5){this['setDataValue'](_0xbc85('0x2'),_0x2fe6b5?_0x2fe6b5['join'](''):[]);},'get':function(){return this[_0xbc85('0x3')](_0xbc85('0x2'))?this[_0xbc85('0x3')](_0xbc85('0x2'))[_0xbc85('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xbc85('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xbc85('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 03574e8..ff0b380 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 _0x6a72=['nolimit','sort','filters','pick','filter','merge','where','type','VIRTUAL','include','rows','rawAttributes','includeAll','options','find','catch','create','params','get','omit','createdAt','updatedAt','body','sequelize','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','Resources','destroy','describe','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','Dashboard','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','getResources','section','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','UserProfile','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0x6a72,0x1ec));var _0x26a7=function(_0x5a9397,_0x2e444c){_0x5a9397=_0x5a9397-0x0;var _0x5b89be=_0x6a72[_0x5a9397];return _0x5b89be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26a7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26a7('0x1'));var rp=require(_0x26a7('0x2'));var moment=require(_0x26a7('0x3'));var BPromise=require(_0x26a7('0x4'));var Mustache=require(_0x26a7('0x5'));var util=require(_0x26a7('0x6'));var path=require(_0x26a7('0x7'));var sox=require(_0x26a7('0x8'));var csv=require(_0x26a7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26a7('0xa'));var _=require('lodash');var squel=require(_0x26a7('0xb'));var crypto=require('crypto');var jsforce=require(_0x26a7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x26a7('0x9'));var querystring=require(_0x26a7('0xd'));var Papa=require(_0x26a7('0xe'));var Redis=require('ioredis');var authService=require(_0x26a7('0xf'));var qs=require(_0x26a7('0x10'));var as=require(_0x26a7('0x11'));var hardwareService=require(_0x26a7('0x12'));var logger=require(_0x26a7('0x13'))(_0x26a7('0x14'));var utils=require('../../config/utils');var config=require(_0x26a7('0x15'));var licenseUtil=require(_0x26a7('0x16'));var db=require(_0x26a7('0x17'))['db'];config[_0x26a7('0x18')]=_[_0x26a7('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x26a7('0x1a'))(new Redis(config[_0x26a7('0x18')]));require(_0x26a7('0x1b'))[_0x26a7('0x1c')](socket);function respondWithStatusCode(_0x4d3e32,_0x429d14){_0x429d14=_0x429d14||0xcc;return function(_0x5b3274){if(_0x5b3274){return _0x4d3e32[_0x26a7('0x1d')](_0x429d14);}return _0x4d3e32[_0x26a7('0x1e')](_0x429d14)[_0x26a7('0x1f')]();};}function respondWithResult(_0x35dcf0,_0x509139){_0x509139=_0x509139||0xc8;return function(_0x37e86c){if(_0x37e86c){return _0x35dcf0['status'](_0x509139)[_0x26a7('0x20')](_0x37e86c);}};}function respondWithFilteredResult(_0x529768,_0x39c229){return function(_0x2361a7){if(_0x2361a7){var _0x2b8580=typeof _0x39c229[_0x26a7('0x21')]===_0x26a7('0x22')&&typeof _0x39c229['limit']===_0x26a7('0x22');var _0x3c67ea=_0x2361a7[_0x26a7('0x23')];var _0x25769e=_0x2b8580?0x0:_0x39c229[_0x26a7('0x21')];var _0x233998=_0x2b8580?_0x2361a7['count']:_0x39c229['offset']+_0x39c229[_0x26a7('0x24')];var _0x2e1075;if(_0x233998>=_0x3c67ea){_0x233998=_0x3c67ea;_0x2e1075=0xc8;}else{_0x2e1075=0xce;}_0x529768['status'](_0x2e1075);return _0x529768[_0x26a7('0x25')](_0x26a7('0x26'),_0x25769e+'-'+_0x233998+'/'+_0x3c67ea)[_0x26a7('0x20')](_0x2361a7);}return null;};}function patchUpdates(_0x34972e){return function(_0xe5696d){try{jsonpatch[_0x26a7('0x27')](_0xe5696d,_0x34972e,!![]);}catch(_0x201d48){return BPromise[_0x26a7('0x28')](_0x201d48);}return _0xe5696d['save']();};}function saveUpdates(_0xa32b88,_0x4f9935){return function(_0x3a559b){if(_0x3a559b){return _0x3a559b[_0x26a7('0x29')](_0xa32b88)[_0x26a7('0x2a')](function(_0xceb0f1){return _0xceb0f1;});}return null;};}function removeEntity(_0x322d0b,_0x1bd9eb){return function(_0x8a6b68){if(_0x8a6b68){return _0x8a6b68['destroy']()[_0x26a7('0x2a')](function(){_0x322d0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2235f5,_0x538702){return function(_0x1a5e72){if(!_0x1a5e72){_0x2235f5[_0x26a7('0x1d')](0x194);}return _0x1a5e72;};}function handleError(_0xd56720,_0x5b78d5){_0x5b78d5=_0x5b78d5||0x1f4;return function(_0x55a5f6){logger[_0x26a7('0x2b')](_0x55a5f6[_0x26a7('0x2c')]);if(_0x55a5f6['name']){delete _0x55a5f6[_0x26a7('0x2d')];}_0xd56720[_0x26a7('0x1e')](_0x5b78d5)['send'](_0x55a5f6);};}exports[_0x26a7('0x2e')]=function(_0x239b8a,_0x398fce){var _0x5b7195={},_0x45ecea={},_0x1446d8={'count':0x0,'rows':[]};var _0x45c3d6=_[_0x26a7('0x2f')](db[_0x26a7('0x30')]['rawAttributes'],function(_0x13f8dc){return{'name':_0x13f8dc['fieldName'],'type':_0x13f8dc['type'][_0x26a7('0x31')]};});_0x45ecea[_0x26a7('0x32')]=_[_0x26a7('0x2f')](_0x45c3d6,'name');_0x45ecea[_0x26a7('0x33')]=_[_0x26a7('0x34')](_0x239b8a['query']);_0x45ecea['filters']=_[_0x26a7('0x35')](_0x45ecea[_0x26a7('0x32')],_0x45ecea[_0x26a7('0x33')]);_0x5b7195[_0x26a7('0x36')]=_[_0x26a7('0x35')](_0x45ecea['model'],qs[_0x26a7('0x37')](_0x239b8a['query'][_0x26a7('0x37')]));_0x5b7195[_0x26a7('0x36')]=_0x5b7195[_0x26a7('0x36')][_0x26a7('0x38')]?_0x5b7195[_0x26a7('0x36')]:_0x45ecea['model'];if(!_0x239b8a[_0x26a7('0x33')][_0x26a7('0x39')](_0x26a7('0x3a'))){_0x5b7195[_0x26a7('0x24')]=qs[_0x26a7('0x24')](_0x239b8a[_0x26a7('0x33')][_0x26a7('0x24')]);_0x5b7195[_0x26a7('0x21')]=qs[_0x26a7('0x21')](_0x239b8a[_0x26a7('0x33')]['offset']);}_0x5b7195['order']=qs[_0x26a7('0x3b')](_0x239b8a['query'][_0x26a7('0x3b')]);_0x5b7195['where']=qs[_0x26a7('0x3c')](_[_0x26a7('0x3d')](_0x239b8a[_0x26a7('0x33')],_0x45ecea[_0x26a7('0x3c')]),_0x45c3d6);if(_0x239b8a[_0x26a7('0x33')][_0x26a7('0x3e')]){_0x5b7195['where']=_[_0x26a7('0x3f')](_0x5b7195[_0x26a7('0x40')],{'$or':_[_0x26a7('0x2f')](_0x45c3d6,function(_0x70ee58){if(_0x70ee58[_0x26a7('0x41')]!==_0x26a7('0x42')){var _0xe8e246={};_0xe8e246[_0x70ee58[_0x26a7('0x2d')]]={'$like':'%'+_0x239b8a[_0x26a7('0x33')][_0x26a7('0x3e')]+'%'};return _0xe8e246;}})});}_0x5b7195=_[_0x26a7('0x3f')]({},_0x5b7195,_0x239b8a['options']);var _0x496846={'where':_0x5b7195['where']};return db[_0x26a7('0x30')][_0x26a7('0x23')](_0x496846)['then'](function(_0x4b9ba9){_0x1446d8[_0x26a7('0x23')]=_0x4b9ba9;if(_0x239b8a[_0x26a7('0x33')]['includeAll']){_0x5b7195[_0x26a7('0x43')]=[{'all':!![]}];}return db[_0x26a7('0x30')]['findAll'](_0x5b7195);})[_0x26a7('0x2a')](function(_0x1b5fab){_0x1446d8[_0x26a7('0x44')]=_0x1b5fab;return _0x1446d8;})[_0x26a7('0x2a')](respondWithFilteredResult(_0x398fce,_0x5b7195))['catch'](handleError(_0x398fce,null));};exports['show']=function(_0x57bdb8,_0x331620){var _0x346781={'raw':![],'where':{'id':_0x57bdb8['params']['id']}},_0x1388b4={};_0x1388b4[_0x26a7('0x32')]=_[_0x26a7('0x34')](db['UserProfile'][_0x26a7('0x45')]);_0x1388b4[_0x26a7('0x33')]=_[_0x26a7('0x34')](_0x57bdb8[_0x26a7('0x33')]);_0x1388b4[_0x26a7('0x3c')]=_[_0x26a7('0x35')](_0x1388b4[_0x26a7('0x32')],_0x1388b4[_0x26a7('0x33')]);_0x346781['attributes']=_[_0x26a7('0x35')](_0x1388b4[_0x26a7('0x32')],qs[_0x26a7('0x37')](_0x57bdb8[_0x26a7('0x33')]['fields']));_0x346781[_0x26a7('0x36')]=_0x346781[_0x26a7('0x36')][_0x26a7('0x38')]?_0x346781[_0x26a7('0x36')]:_0x1388b4['model'];if(_0x57bdb8[_0x26a7('0x33')][_0x26a7('0x46')]){_0x346781[_0x26a7('0x43')]=[{'all':!![]}];}_0x346781=_['merge']({},_0x346781,_0x57bdb8[_0x26a7('0x47')]);return db[_0x26a7('0x30')][_0x26a7('0x48')](_0x346781)[_0x26a7('0x2a')](handleEntityNotFound(_0x331620,null))[_0x26a7('0x2a')](respondWithResult(_0x331620,null))[_0x26a7('0x49')](handleError(_0x331620,null));};exports['create']=function(_0x310643,_0x3e4d66){return db[_0x26a7('0x30')][_0x26a7('0x4a')](_0x310643['body'],{})[_0x26a7('0x2a')](respondWithResult(_0x3e4d66,0xc9))[_0x26a7('0x49')](handleError(_0x3e4d66,null));};exports['clone']=function(_0x1483d1,_0xb81320){var _0x2b59f7={'where':{'id':_0x1483d1[_0x26a7('0x4b')]['id']}},_0x10ee1f={};_0x10ee1f[_0x26a7('0x32')]=_[_0x26a7('0x34')](db['UserProfile'][_0x26a7('0x45')]);_0x2b59f7[_0x26a7('0x36')]=_[_0x26a7('0x35')](_0x10ee1f[_0x26a7('0x32')],qs[_0x26a7('0x37')](_0x1483d1[_0x26a7('0x33')][_0x26a7('0x37')]));_0x2b59f7[_0x26a7('0x36')]=_0x2b59f7[_0x26a7('0x36')][_0x26a7('0x38')]?_0x2b59f7[_0x26a7('0x36')]:_0x10ee1f[_0x26a7('0x32')];if(_0x1483d1[_0x26a7('0x33')]['includeAll']){_0x2b59f7[_0x26a7('0x43')]=[{'all':!![]}];}_0x2b59f7=_['merge']({},_0x2b59f7,_0x1483d1[_0x26a7('0x47')]);return db['UserProfile'][_0x26a7('0x48')](_0x2b59f7)[_0x26a7('0x2a')](handleEntityNotFound(_0xb81320,null))[_0x26a7('0x2a')](function(_0x19980f){if(_0x19980f){var _0x3b4ca0=_0x19980f[_0x26a7('0x4c')]({'plain':!![]});_0x3b4ca0=qs[_0x26a7('0x4d')](_0x3b4ca0,['id',_0x26a7('0x4e'),_0x26a7('0x4f'),'crudPermissions']);_0x1483d1[_0x26a7('0x50')]=_[_0x26a7('0x4d')](_0x1483d1[_0x26a7('0x50')],['id',_0x26a7('0x4e'),_0x26a7('0x4f')]);return db[_0x26a7('0x51')]['transaction'](function(_0x584995){return db['UserProfile'][_0x26a7('0x4a')](_[_0x26a7('0x3f')](_0x3b4ca0,_0x1483d1[_0x26a7('0x50')]),{'include':_0x1483d1['query'][_0x26a7('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x584995})[_0x26a7('0x2a')](function(_0xe74889){var _0x2aebc5=_0xe74889[_0x26a7('0x4c')]({'plain':!![]});return db[_0x26a7('0x52')][_0x26a7('0x53')]({'where':{'userProfileId':_0x1483d1['params']['id']},'raw':!![]})[_0x26a7('0x2a')](function(_0x2e67c8){if(_0x2e67c8){return BPromise['each'](_0x2e67c8,function(_0x1fcfe5){return new BPromise(function(_0x3c6496,_0x57366b){if(_0x1fcfe5[_0x26a7('0x54')]===null||_0x1fcfe5['autoAssociation']===0x1)_0x3c6496(null);return db[_0x26a7('0x55')]['findAll']({'where':{'sectionId':_0x1fcfe5['id']},'raw':!![]})[_0x26a7('0x2a')](function(_0x105688){var _0x3b62ad=_[_0x26a7('0x2f')](_0x105688,function(_0x1f7b03){return qs[_0x26a7('0x4d')](_0x1f7b03,['id',_0x26a7('0x4e'),'updatedAt',_0x26a7('0x56')]);});_0x3c6496(_0x3b62ad);})[_0x26a7('0x49')](function(_0x5c18f8){_0x57366b(_0x5c18f8);});})[_0x26a7('0x2a')](function(_0x3553fc){var _0x301e06=qs[_0x26a7('0x4d')](_0x1fcfe5,['id',_0x26a7('0x4e'),_0x26a7('0x4f')]);_0x301e06['userProfileId']=_0x2aebc5['id'];if(_0x3553fc)_0x301e06[_0x26a7('0x57')]=_0x3553fc;return _0x301e06;})[_0x26a7('0x2a')](function(_0x2f14f9){return db[_0x26a7('0x52')][_0x26a7('0x4a')](_0x2f14f9,{'include':[{'model':db[_0x26a7('0x55')],'as':_0x26a7('0x57')}],'raw':!![],'transaction':_0x584995});});})['then'](function(){return _0x2aebc5;});}});});});}})['then'](respondWithResult(_0xb81320,0xc9))[_0x26a7('0x49')](handleError(_0xb81320,null));};exports[_0x26a7('0x29')]=function(_0x335de9,_0x237505){if(_0x335de9[_0x26a7('0x50')]['id']){delete _0x335de9['body']['id'];}return db[_0x26a7('0x30')]['find']({'where':{'id':_0x335de9[_0x26a7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x237505,null))[_0x26a7('0x2a')](saveUpdates(_0x335de9[_0x26a7('0x50')],null))[_0x26a7('0x2a')](respondWithResult(_0x237505,null))[_0x26a7('0x49')](handleError(_0x237505,null));};exports[_0x26a7('0x58')]=function(_0x48f715,_0x278c9c){return db[_0x26a7('0x30')][_0x26a7('0x48')]({'where':{'id':_0x48f715['params']['id']}})['then'](handleEntityNotFound(_0x278c9c,null))[_0x26a7('0x2a')](removeEntity(_0x278c9c,null))[_0x26a7('0x49')](handleError(_0x278c9c,null));};exports[_0x26a7('0x59')]=function(_0x48275f,_0x1d06fa){return db[_0x26a7('0x30')][_0x26a7('0x59')]()['then'](respondWithResult(_0x1d06fa,null))[_0x26a7('0x49')](handleError(_0x1d06fa,null));};exports['addSections']=function(_0x159d39,_0x181a7b){var _0x30d435=_0x159d39[_0x26a7('0x50')];return db[_0x26a7('0x30')][_0x26a7('0x48')]({'where':{'id':_0x159d39[_0x26a7('0x4b')]['id']}})[_0x26a7('0x2a')](handleEntityNotFound(_0x181a7b,null))['then'](function(_0xbe9c53){if(_0xbe9c53){return db['sequelize']['transaction'](function(_0x599449){return db[_0x26a7('0x52')][_0x26a7('0x58')]({'where':{'userProfileId':_0x159d39[_0x26a7('0x4b')]['id'],'sectionId':_[_0x26a7('0x2f')](_0x30d435,function(_0x22a165){return _0x22a165[_0x26a7('0x56')];})},'transaction':_0x599449})[_0x26a7('0x2a')](function(){var _0x40fd53=_['map'](_0x30d435,function(_0xa54611){_0xa54611[_0x26a7('0x5a')]=_0x159d39['params']['id'];return _0xa54611;});var _0x274ca0=[];return BPromise['each'](_0x40fd53,function(_0x3189f9){return db['UserProfileSection'][_0x26a7('0x4a')](_0x3189f9,{'include':[{'model':db[_0x26a7('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x599449})['then'](function(_0x51e78d){_0x274ca0[_0x26a7('0x5b')](_0x51e78d['get']({'plain':!![]}));});})[_0x26a7('0x2a')](function(){return _0x274ca0;});});});}})[_0x26a7('0x2a')](function(_0x10238f){return _0x10238f;})['then'](respondWithResult(_0x181a7b,null))[_0x26a7('0x49')](handleError(_0x181a7b,null));};exports[_0x26a7('0x5c')]=function(_0xf121f9,_0x41ffef){var _0x39c575;return db[_0x26a7('0x30')][_0x26a7('0x48')]({'where':{'id':_0xf121f9[_0x26a7('0x4b')]['id']},'attributes':['id','name']})[_0x26a7('0x2a')](handleEntityNotFound(_0x41ffef,null))['then'](function(_0x4be641){if(_0x4be641){_0x39c575=_0x4be641;return db[_0x26a7('0x52')][_0x26a7('0x58')]({'where':{'userProfileId':_0xf121f9[_0x26a7('0x4b')]['id'],'sectionId':_0xf121f9[_0x26a7('0x33')][_0x26a7('0x5d')]}});}})['then'](function(){return _0x39c575;})['then'](respondWithStatusCode(_0x41ffef,null))[_0x26a7('0x49')](handleError(_0x41ffef,null));};exports[_0x26a7('0x5e')]=function(_0x493f68,_0x3516fd){var _0x98db05=[];var _0x324583=[];return db[_0x26a7('0x52')][_0x26a7('0x53')]({'where':{'userProfileId':_0x493f68[_0x26a7('0x4b')]['id']},'raw':!![]})[_0x26a7('0x2a')](function(_0xb76c84){_0x98db05=_[_0x26a7('0x3e')](_0xb76c84,function(_0x2b4d34){return _0x2b4d34[_0x26a7('0x5f')]===0x1||_[_0x26a7('0x60')]([0x3eb,0x709],_0x2b4d34[_0x26a7('0x56')]);});if(!_[_0x26a7('0x61')](_0x98db05)){return _['map'](_0x98db05,function(_0x14c5ec){return _0x14c5ec[_0x26a7('0x56')];});}else{return;}})[_0x26a7('0x2a')](function(_0x164a86){if(_0x164a86)_0x324583=_0x164a86;if(_['includes'](_0x324583,0x64)){var _0x335ee8=_[_0x26a7('0x48')](_0x98db05,{'sectionId':0x64});return hasDefaultDashboard(_0x335ee8)[_0x26a7('0x2a')](function(_0x31a571){return _[_0x26a7('0x2f')](_0x98db05,function(_0x34645c){if(_0x34645c[_0x26a7('0x56')]===0x64){_0x34645c[_0x26a7('0x62')]=_0x31a571;}return _0x34645c;});});}else{return;}})[_0x26a7('0x2a')](function(_0xa1a8b8){if(_0xa1a8b8)_0x98db05=_0xa1a8b8;if(_[_0x26a7('0x60')](_0x324583,0x3eb)){var _0x297360=_[_0x26a7('0x48')](_0x98db05,{'sectionId':0x3eb});return getCustomDashboards(_0x297360)['then'](function(_0x347581){return _[_0x26a7('0x2f')](_0x98db05,function(_0x1ca5a1){if(_0x297360[_0x26a7('0x5f')]){if(_0x1ca5a1[_0x26a7('0x56')]===0x3eb){_0x1ca5a1[_0x26a7('0x62')]=_0x347581;}}else{if(_0x1ca5a1[_0x26a7('0x56')]===0x64){if(!_0x1ca5a1['subsections']){_0x1ca5a1['subsections']=[];}_0x1ca5a1[_0x26a7('0x62')]=_0x1ca5a1['subsections'][_0x26a7('0x63')](_0x347581);}}return _0x1ca5a1;});});}else{return;}})[_0x26a7('0x2a')](function(_0x1378dd){if(_0x1378dd)_0x98db05=_0x1378dd;if(_['includes'](_0x324583,0x709)){var _0x4f36c5=_[_0x26a7('0x48')](_0x98db05,{'sectionId':0x709});return getPlugins(_0x4f36c5)['then'](function(_0x441cac){if(_0x4f36c5['enabled']){return _['map'](_0x98db05,function(_0x1453d7){if(_0x1453d7[_0x26a7('0x56')]===0x709){_0x1453d7[_0x26a7('0x62')]=_0x441cac;}return _0x1453d7;});}else{var _0x7d1bb9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x441cac};var _0x4bad06=_['map'](_0x98db05);_0x4bad06[_0x26a7('0x5b')](_0x7d1bb9);return _0x4bad06;}});}else{return;}})['then'](function(_0x3415fe){if(_0x3415fe)_0x98db05=_0x3415fe;return _[_0x26a7('0x3e')](_0x98db05,[_0x26a7('0x5f'),0x1]);})[_0x26a7('0x2a')](respondWithResult(_0x3516fd,null))[_0x26a7('0x49')](handleError(_0x3516fd,null));};function hasDefaultDashboard(_0x24ce32){var _0x599e93=[0x65];return new BPromise(function(_0xf6f85e,_0x49e11f){try{if(_0x24ce32['autoAssociation']){_0xf6f85e(_0x599e93);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x24ce32['id']},'raw':!![]})['then'](function(_0x3742a7){_0x3742a7?_0xf6f85e(_0x599e93):_0xf6f85e();});}}catch(_0x3efcad){_0x49e11f(_0x3efcad);}});}function getCustomDashboards(_0x5498d9){var _0x2624e8=[];return new BPromise(function(_0x3c99ea,_0xbf2443){try{if(_0x5498d9[_0x26a7('0x54')]){return db[_0x26a7('0x64')][_0x26a7('0x53')]({'raw':!![]})[_0x26a7('0x2a')](function(_0xa25b49){_0xa25b49[_0x26a7('0x65')](function(_0x26275a){_0x2624e8[_0x26a7('0x5b')](_0x26275a['id']+0x1869f);});_0x3c99ea(_0x2624e8);});}else{return db[_0x26a7('0x55')][_0x26a7('0x53')]({'where':{'sectionId':_0x5498d9['id']},'raw':!![]})['then'](function(_0x2276f0){_0x2276f0[_0x26a7('0x65')](function(_0x1ed2da){_0x2624e8[_0x26a7('0x5b')](_0x1ed2da[_0x26a7('0x66')]+0x1869f);});_0x3c99ea(_0x2624e8);});}}catch(_0x514c1e){_0xbf2443(_0x514c1e);}});}function getPlugins(_0x1e8dc2){var _0x3448ae=[];return new BPromise(function(_0x942dd3,_0x20e115){try{if(_0x1e8dc2['autoAssociation']){return db[_0x26a7('0x67')][_0x26a7('0x53')]({'raw':!![]})[_0x26a7('0x2a')](function(_0x1c4b4c){_0x1c4b4c['forEach'](function(_0x4be3c1){_0x3448ae[_0x26a7('0x5b')](_0x4be3c1['id']+0x15b38);});_0x942dd3(_0x3448ae);});}else{return db[_0x26a7('0x55')][_0x26a7('0x53')]({'where':{'sectionId':_0x1e8dc2['id']},'raw':!![]})['then'](function(_0x58073e){_0x58073e[_0x26a7('0x65')](function(_0x235ee8){_0x3448ae[_0x26a7('0x5b')](_0x235ee8['resourceId']+0x15b38);});_0x942dd3(_0x3448ae);});}}catch(_0x55b77d){_0x20e115(_0x55b77d);}});}exports[_0x26a7('0x68')]=function(_0xc81799,_0x4312d4){return db[_0x26a7('0x30')]['find']({'where':{'id':_0xc81799[_0x26a7('0x4b')]['id']}})[_0x26a7('0x2a')](handleEntityNotFound(_0x4312d4,null))[_0x26a7('0x2a')](function(_0x1c5dc8){if(_0x1c5dc8){return db[_0x26a7('0x51')][_0x26a7('0x69')](function(_0x869b1d){return db[_0x26a7('0x52')][_0x26a7('0x53')]({'where':{'userProfileId':_0xc81799[_0x26a7('0x4b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x557b75){if(_0x557b75){return db[_0x26a7('0x52')]['destroy']({'where':{'userProfileId':_0xc81799['params']['id'],'id':_[_0x26a7('0x2f')](_0x557b75,function(_0x165daf){return _0x165daf['id'];})},'transaction':_0x869b1d});}})['then'](function(_0x2de68c){var _0x3d3ce3=_[_0x26a7('0x2f')](_0xc81799[_0x26a7('0x50')],function(_0x471b11){_0x471b11[_0x26a7('0x5a')]=_0xc81799[_0x26a7('0x4b')]['id'];return _0x471b11;});return db[_0x26a7('0x52')][_0x26a7('0x6a')](_0x3d3ce3,{'raw':!![],'transaction':_0x869b1d});})['then'](function(_0x27535e){var _0x1a5204=_['filter'](_[_0x26a7('0x2f')](_0x27535e,function(_0x1fb4e6){return _0x1fb4e6[_0x26a7('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x1a5204){return db['UserProfileSection'][_0x26a7('0x53')]({'where':{'userProfileId':_0xc81799['params']['id'],'sectionId':_[_0x26a7('0x2f')](_0x1a5204,function(_0xf38bf){return _0xf38bf[_0x26a7('0x56')];})},'attributes':['id',_0x26a7('0x56')],'raw':!![]})[_0x26a7('0x2a')](function(_0xfd3f34){var _0x498a94=_['map'](_0xc81799[_0x26a7('0x50')],function(_0xa7d135){_0xa7d135[_0x26a7('0x5a')]=_0xc81799['params']['id'];return _0xa7d135;});return db['UserProfileResource'][_0x26a7('0x6a')](_0x498a94,{'raw':!![],'transaction':_0x869b1d});});}})[_0x26a7('0x49')](handleError(_0x4312d4,null));});}})[_0x26a7('0x2a')](function(_0x7601a0){var _0x2bc332=_[_0x26a7('0x2f')](_0x7601a0,function(_0x5719bc){return _0x5719bc['get']({'plain':!![]});});})[_0x26a7('0x2a')](respondWithResult(_0x4312d4,null))[_0x26a7('0x49')](handleError(_0x4312d4,null));};exports['removeResources']=function(_0xc6f9b1,_0x148833,_0x2a98d1){return db[_0x26a7('0x30')][_0x26a7('0x48')]({'where':{'id':_0xc6f9b1[_0x26a7('0x4b')]['id']}})[_0x26a7('0x2a')](handleEntityNotFound(_0x148833,null))['then'](function(_0x1242c4){if(_0x1242c4){return _0x1242c4[_0x26a7('0x6b')](_0xc6f9b1['query'][_0x26a7('0x5d')]);}})['then'](respondWithStatusCode(_0x148833,null))['catch'](handleError(_0x148833,null));};exports[_0x26a7('0x6c')]=function(_0x311fb4,_0x54fcac){var _0x252848={};if(!_0x311fb4['query'][_0x26a7('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x311fb4[_0x26a7('0x33')][_0x26a7('0x39')](_0x26a7('0x3a'))){_0x252848[_0x26a7('0x24')]=qs['limit'](_0x311fb4['query'][_0x26a7('0x24')]);_0x252848[_0x26a7('0x21')]=qs[_0x26a7('0x21')](_0x311fb4['query'][_0x26a7('0x21')]);}return db[_0x26a7('0x30')][_0x26a7('0x48')]({'where':{'id':_0x311fb4['params']['id']}})[_0x26a7('0x2a')](function(_0x32559e){if(!_0x32559e)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x311fb4[_0x26a7('0x4b')]['id']);return db[_0x26a7('0x30')][_0x26a7('0x6c')](_0x311fb4);})[_0x26a7('0x2a')](respondWithFilteredResult(_0x54fcac,_0x252848))['catch'](handleError(_0x54fcac,null));}; \ No newline at end of file +var _0x625e=['end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','body','clone','get','updatedAt','crudPermissions','omit','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','Resources','UserProfileResource','catch','update','describe','userProfileId','push','removeSections','ids','getSections','enabled','isEmpty','subsections','includes','concat','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userProfile.socket','register','sendStatus','status'];(function(_0x2aee7b,_0x181285){var _0x5a4554=function(_0x3d9332){while(--_0x3d9332){_0x2aee7b['push'](_0x2aee7b['shift']());}};_0x5a4554(++_0x181285);}(_0x625e,0x145));var _0xe625=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x625e[_0x50e593];return _0x3821d0;};'use strict';var emlformat=require(_0xe625('0x0'));var rimraf=require(_0xe625('0x1'));var zipdir=require(_0xe625('0x2'));var jsonpatch=require(_0xe625('0x3'));var rp=require(_0xe625('0x4'));var moment=require(_0xe625('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe625('0x6'));var util=require('util');var path=require(_0xe625('0x7'));var sox=require(_0xe625('0x8'));var csv=require(_0xe625('0x9'));var ejs=require(_0xe625('0xa'));var fs=require('fs');var fs_extra=require(_0xe625('0xb'));var _=require('lodash');var squel=require(_0xe625('0xc'));var crypto=require(_0xe625('0xd'));var jsforce=require(_0xe625('0xe'));var deskjs=require(_0xe625('0xf'));var toCsv=require(_0xe625('0x9'));var querystring=require(_0xe625('0x10'));var Papa=require(_0xe625('0x11'));var Redis=require(_0xe625('0x12'));var authService=require(_0xe625('0x13'));var qs=require(_0xe625('0x14'));var as=require(_0xe625('0x15'));var hardwareService=require(_0xe625('0x16'));var logger=require(_0xe625('0x17'))(_0xe625('0x18'));var utils=require(_0xe625('0x19'));var config=require(_0xe625('0x1a'));var licenseUtil=require(_0xe625('0x1b'));var db=require(_0xe625('0x1c'))['db'];config[_0xe625('0x1d')]=_['defaults'](config[_0xe625('0x1d')],{'host':_0xe625('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe625('0x1d')]));require(_0xe625('0x1f'))[_0xe625('0x20')](socket);function respondWithStatusCode(_0xd50c69,_0x17f4b0){_0x17f4b0=_0x17f4b0||0xcc;return function(_0x5d83ca){if(_0x5d83ca){return _0xd50c69[_0xe625('0x21')](_0x17f4b0);}return _0xd50c69[_0xe625('0x22')](_0x17f4b0)[_0xe625('0x23')]();};}function respondWithResult(_0x201ea6,_0x141bd9){_0x141bd9=_0x141bd9||0xc8;return function(_0x5bfa01){if(_0x5bfa01){return _0x201ea6[_0xe625('0x22')](_0x141bd9)[_0xe625('0x24')](_0x5bfa01);}};}function respondWithFilteredResult(_0x29184c,_0xeb9a82){return function(_0x3b58ad){if(_0x3b58ad){var _0x397e09=typeof _0xeb9a82['offset']==='undefined'&&typeof _0xeb9a82[_0xe625('0x25')]===_0xe625('0x26');var _0x3b4df5=_0x3b58ad[_0xe625('0x27')];var _0x3035e9=_0x397e09?0x0:_0xeb9a82[_0xe625('0x28')];var _0x302e79=_0x397e09?_0x3b58ad[_0xe625('0x27')]:_0xeb9a82[_0xe625('0x28')]+_0xeb9a82['limit'];var _0x473ed8;if(_0x302e79>=_0x3b4df5){_0x302e79=_0x3b4df5;_0x473ed8=0xc8;}else{_0x473ed8=0xce;}_0x29184c[_0xe625('0x22')](_0x473ed8);return _0x29184c[_0xe625('0x29')]('Content-Range',_0x3035e9+'-'+_0x302e79+'/'+_0x3b4df5)[_0xe625('0x24')](_0x3b58ad);}return null;};}function patchUpdates(_0x25a7dc){return function(_0x30b71f){try{jsonpatch[_0xe625('0x2a')](_0x30b71f,_0x25a7dc,!![]);}catch(_0x52f26e){return BPromise[_0xe625('0x2b')](_0x52f26e);}return _0x30b71f[_0xe625('0x2c')]();};}function saveUpdates(_0x42e0b0,_0x54f34e){return function(_0xc89230){if(_0xc89230){return _0xc89230['update'](_0x42e0b0)[_0xe625('0x2d')](function(_0x1c2c02){return _0x1c2c02;});}return null;};}function removeEntity(_0x359971,_0x9f82ab){return function(_0x1ad83a){if(_0x1ad83a){return _0x1ad83a[_0xe625('0x2e')]()['then'](function(){_0x359971[_0xe625('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d002,_0x4dbad8){return function(_0x5b3b25){if(!_0x5b3b25){_0x16d002[_0xe625('0x21')](0x194);}return _0x5b3b25;};}function handleError(_0x1d4d8e,_0x20c148){_0x20c148=_0x20c148||0x1f4;return function(_0x5193cc){logger[_0xe625('0x2f')](_0x5193cc[_0xe625('0x30')]);if(_0x5193cc[_0xe625('0x31')]){delete _0x5193cc[_0xe625('0x31')];}_0x1d4d8e[_0xe625('0x22')](_0x20c148)[_0xe625('0x32')](_0x5193cc);};}exports[_0xe625('0x33')]=function(_0x1772c4,_0x3251d2){var _0x3e79e1={},_0x34d132={},_0x4074cc={'count':0x0,'rows':[]};var _0x140e99=_['map'](db[_0xe625('0x34')][_0xe625('0x35')],function(_0x35308e){return{'name':_0x35308e[_0xe625('0x36')],'type':_0x35308e[_0xe625('0x37')][_0xe625('0x38')]};});_0x34d132[_0xe625('0x39')]=_[_0xe625('0x3a')](_0x140e99,_0xe625('0x31'));_0x34d132[_0xe625('0x3b')]=_['keys'](_0x1772c4['query']);_0x34d132[_0xe625('0x3c')]=_[_0xe625('0x3d')](_0x34d132['model'],_0x34d132[_0xe625('0x3b')]);_0x3e79e1['attributes']=_[_0xe625('0x3d')](_0x34d132['model'],qs[_0xe625('0x3e')](_0x1772c4[_0xe625('0x3b')]['fields']));_0x3e79e1[_0xe625('0x3f')]=_0x3e79e1[_0xe625('0x3f')][_0xe625('0x40')]?_0x3e79e1[_0xe625('0x3f')]:_0x34d132['model'];if(!_0x1772c4[_0xe625('0x3b')][_0xe625('0x41')]('nolimit')){_0x3e79e1[_0xe625('0x25')]=qs[_0xe625('0x25')](_0x1772c4[_0xe625('0x3b')][_0xe625('0x25')]);_0x3e79e1[_0xe625('0x28')]=qs[_0xe625('0x28')](_0x1772c4[_0xe625('0x3b')][_0xe625('0x28')]);}_0x3e79e1['order']=qs['sort'](_0x1772c4['query'][_0xe625('0x42')]);_0x3e79e1['where']=qs[_0xe625('0x3c')](_[_0xe625('0x43')](_0x1772c4['query'],_0x34d132['filters']),_0x140e99);if(_0x1772c4['query'][_0xe625('0x44')]){_0x3e79e1[_0xe625('0x45')]=_[_0xe625('0x46')](_0x3e79e1[_0xe625('0x45')],{'$or':_[_0xe625('0x3a')](_0x140e99,function(_0x478f18){if(_0x478f18[_0xe625('0x37')]!==_0xe625('0x47')){var _0x502ca9={};_0x502ca9[_0x478f18[_0xe625('0x31')]]={'$like':'%'+_0x1772c4[_0xe625('0x3b')][_0xe625('0x44')]+'%'};return _0x502ca9;}})});}_0x3e79e1=_[_0xe625('0x46')]({},_0x3e79e1,_0x1772c4[_0xe625('0x48')]);var _0x205c15={'where':_0x3e79e1[_0xe625('0x45')]};return db[_0xe625('0x34')][_0xe625('0x27')](_0x205c15)[_0xe625('0x2d')](function(_0x5d3f4c){_0x4074cc[_0xe625('0x27')]=_0x5d3f4c;if(_0x1772c4['query'][_0xe625('0x49')]){_0x3e79e1[_0xe625('0x4a')]=[{'all':!![]}];}return db[_0xe625('0x34')][_0xe625('0x4b')](_0x3e79e1);})['then'](function(_0x17eb1e){_0x4074cc[_0xe625('0x4c')]=_0x17eb1e;return _0x4074cc;})['then'](respondWithFilteredResult(_0x3251d2,_0x3e79e1))['catch'](handleError(_0x3251d2,null));};exports['show']=function(_0x5c649b,_0x3e3e4e){var _0x53d69e={'raw':![],'where':{'id':_0x5c649b[_0xe625('0x4d')]['id']}},_0x4b9ca4={};_0x4b9ca4[_0xe625('0x39')]=_[_0xe625('0x4e')](db[_0xe625('0x34')][_0xe625('0x35')]);_0x4b9ca4['query']=_[_0xe625('0x4e')](_0x5c649b['query']);_0x4b9ca4[_0xe625('0x3c')]=_[_0xe625('0x3d')](_0x4b9ca4[_0xe625('0x39')],_0x4b9ca4[_0xe625('0x3b')]);_0x53d69e[_0xe625('0x3f')]=_[_0xe625('0x3d')](_0x4b9ca4[_0xe625('0x39')],qs[_0xe625('0x3e')](_0x5c649b[_0xe625('0x3b')]['fields']));_0x53d69e[_0xe625('0x3f')]=_0x53d69e[_0xe625('0x3f')][_0xe625('0x40')]?_0x53d69e[_0xe625('0x3f')]:_0x4b9ca4['model'];if(_0x5c649b[_0xe625('0x3b')]['includeAll']){_0x53d69e[_0xe625('0x4a')]=[{'all':!![]}];}_0x53d69e=_[_0xe625('0x46')]({},_0x53d69e,_0x5c649b[_0xe625('0x48')]);return db['UserProfile'][_0xe625('0x4f')](_0x53d69e)[_0xe625('0x2d')](handleEntityNotFound(_0x3e3e4e,null))['then'](respondWithResult(_0x3e3e4e,null))['catch'](handleError(_0x3e3e4e,null));};exports[_0xe625('0x50')]=function(_0x1d6ccc,_0x32a9ad){return db['UserProfile'][_0xe625('0x50')](_0x1d6ccc[_0xe625('0x51')],{})[_0xe625('0x2d')](respondWithResult(_0x32a9ad,0xc9))['catch'](handleError(_0x32a9ad,null));};exports[_0xe625('0x52')]=function(_0x51379e,_0x3e9787){var _0x5be049={'where':{'id':_0x51379e[_0xe625('0x4d')]['id']}},_0x1eab89={};_0x1eab89[_0xe625('0x39')]=_['keys'](db['UserProfile'][_0xe625('0x35')]);_0x5be049['attributes']=_[_0xe625('0x3d')](_0x1eab89[_0xe625('0x39')],qs['fields'](_0x51379e['query']['fields']));_0x5be049[_0xe625('0x3f')]=_0x5be049[_0xe625('0x3f')][_0xe625('0x40')]?_0x5be049[_0xe625('0x3f')]:_0x1eab89['model'];if(_0x51379e[_0xe625('0x3b')][_0xe625('0x49')]){_0x5be049[_0xe625('0x4a')]=[{'all':!![]}];}_0x5be049=_['merge']({},_0x5be049,_0x51379e[_0xe625('0x48')]);return db[_0xe625('0x34')][_0xe625('0x4f')](_0x5be049)[_0xe625('0x2d')](handleEntityNotFound(_0x3e9787,null))['then'](function(_0x213879){if(_0x213879){var _0x59ba8b=_0x213879[_0xe625('0x53')]({'plain':!![]});_0x59ba8b=qs['omit'](_0x59ba8b,['id','createdAt',_0xe625('0x54'),_0xe625('0x55')]);_0x51379e[_0xe625('0x51')]=_[_0xe625('0x56')](_0x51379e[_0xe625('0x51')],['id',_0xe625('0x57'),'updatedAt']);return db[_0xe625('0x58')][_0xe625('0x59')](function(_0x3df391){return db[_0xe625('0x34')][_0xe625('0x50')](_[_0xe625('0x46')](_0x59ba8b,_0x51379e[_0xe625('0x51')]),{'include':_0x51379e[_0xe625('0x3b')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3df391})[_0xe625('0x2d')](function(_0x330199){var _0x32a35c=_0x330199['get']({'plain':!![]});return db[_0xe625('0x5a')][_0xe625('0x4b')]({'where':{'userProfileId':_0x51379e[_0xe625('0x4d')]['id']},'raw':!![]})[_0xe625('0x2d')](function(_0x15af89){if(_0x15af89){return BPromise[_0xe625('0x5b')](_0x15af89,function(_0x15aee2){return new BPromise(function(_0x1a8610,_0x38850d){if(_0x15aee2[_0xe625('0x5c')]===null||_0x15aee2[_0xe625('0x5c')]===0x1)_0x1a8610(null);return db['UserProfileResource'][_0xe625('0x4b')]({'where':{'sectionId':_0x15aee2['id']},'raw':!![]})[_0xe625('0x2d')](function(_0x175513){var _0x42ce5d=_[_0xe625('0x3a')](_0x175513,function(_0x5cba64){return qs['omit'](_0x5cba64,['id',_0xe625('0x57'),_0xe625('0x54'),_0xe625('0x5d')]);});_0x1a8610(_0x42ce5d);})['catch'](function(_0x361515){_0x38850d(_0x361515);});})['then'](function(_0x113cbe){var _0x1c961c=qs[_0xe625('0x56')](_0x15aee2,['id',_0xe625('0x57'),_0xe625('0x54')]);_0x1c961c['userProfileId']=_0x32a35c['id'];if(_0x113cbe)_0x1c961c[_0xe625('0x5e')]=_0x113cbe;return _0x1c961c;})[_0xe625('0x2d')](function(_0x262a34){return db[_0xe625('0x5a')]['create'](_0x262a34,{'include':[{'model':db[_0xe625('0x5f')],'as':_0xe625('0x5e')}],'raw':!![],'transaction':_0x3df391});});})[_0xe625('0x2d')](function(){return _0x32a35c;});}});});});}})[_0xe625('0x2d')](respondWithResult(_0x3e9787,0xc9))[_0xe625('0x60')](handleError(_0x3e9787,null));};exports[_0xe625('0x61')]=function(_0x2b328e,_0xc13eba){if(_0x2b328e['body']['id']){delete _0x2b328e[_0xe625('0x51')]['id'];}return db[_0xe625('0x34')][_0xe625('0x4f')]({'where':{'id':_0x2b328e[_0xe625('0x4d')]['id']}})[_0xe625('0x2d')](handleEntityNotFound(_0xc13eba,null))['then'](saveUpdates(_0x2b328e[_0xe625('0x51')],null))[_0xe625('0x2d')](respondWithResult(_0xc13eba,null))['catch'](handleError(_0xc13eba,null));};exports[_0xe625('0x2e')]=function(_0x35959e,_0x46cc2c){return db[_0xe625('0x34')][_0xe625('0x4f')]({'where':{'id':_0x35959e['params']['id']}})['then'](handleEntityNotFound(_0x46cc2c,null))[_0xe625('0x2d')](removeEntity(_0x46cc2c,null))['catch'](handleError(_0x46cc2c,null));};exports[_0xe625('0x62')]=function(_0x11e4aa,_0x45d2d1){return db[_0xe625('0x34')][_0xe625('0x62')]()[_0xe625('0x2d')](respondWithResult(_0x45d2d1,null))[_0xe625('0x60')](handleError(_0x45d2d1,null));};exports['addSections']=function(_0x281eb2,_0x1cf860){var _0x149fae=_0x281eb2[_0xe625('0x51')];return db[_0xe625('0x34')][_0xe625('0x4f')]({'where':{'id':_0x281eb2[_0xe625('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1cf860,null))[_0xe625('0x2d')](function(_0x538b3c){if(_0x538b3c){return db['sequelize'][_0xe625('0x59')](function(_0x37f302){return db[_0xe625('0x5a')][_0xe625('0x2e')]({'where':{'userProfileId':_0x281eb2['params']['id'],'sectionId':_['map'](_0x149fae,function(_0x146680){return _0x146680['sectionId'];})},'transaction':_0x37f302})[_0xe625('0x2d')](function(){var _0x3dd4b4=_[_0xe625('0x3a')](_0x149fae,function(_0x1c68eb){_0x1c68eb[_0xe625('0x63')]=_0x281eb2[_0xe625('0x4d')]['id'];return _0x1c68eb;});var _0x4908e1=[];return BPromise['each'](_0x3dd4b4,function(_0xeb732d){return db[_0xe625('0x5a')]['create'](_0xeb732d,{'include':[{'model':db[_0xe625('0x5f')],'as':_0xe625('0x5e')}],'raw':!![],'transaction':_0x37f302})['then'](function(_0x522f76){_0x4908e1[_0xe625('0x64')](_0x522f76[_0xe625('0x53')]({'plain':!![]}));});})['then'](function(){return _0x4908e1;});});});}})[_0xe625('0x2d')](function(_0x26158d){return _0x26158d;})['then'](respondWithResult(_0x1cf860,null))[_0xe625('0x60')](handleError(_0x1cf860,null));};exports[_0xe625('0x65')]=function(_0x1866b5,_0x1f47a1){var _0x254c58;return db['UserProfile'][_0xe625('0x4f')]({'where':{'id':_0x1866b5['params']['id']},'attributes':['id',_0xe625('0x31')]})['then'](handleEntityNotFound(_0x1f47a1,null))[_0xe625('0x2d')](function(_0x2680bd){if(_0x2680bd){_0x254c58=_0x2680bd;return db[_0xe625('0x5a')][_0xe625('0x2e')]({'where':{'userProfileId':_0x1866b5[_0xe625('0x4d')]['id'],'sectionId':_0x1866b5[_0xe625('0x3b')][_0xe625('0x66')]}});}})[_0xe625('0x2d')](function(){return _0x254c58;})[_0xe625('0x2d')](respondWithStatusCode(_0x1f47a1,null))['catch'](handleError(_0x1f47a1,null));};exports[_0xe625('0x67')]=function(_0x2ae846,_0x5a6509){var _0x5c5914=[];var _0x11ed90=[];return db[_0xe625('0x5a')][_0xe625('0x4b')]({'where':{'userProfileId':_0x2ae846[_0xe625('0x4d')]['id']},'raw':!![]})[_0xe625('0x2d')](function(_0x4ccb26){_0x5c5914=_['filter'](_0x4ccb26,function(_0x37fe5a){return _0x37fe5a[_0xe625('0x68')]===0x1||_['includes']([0x3eb,0x709],_0x37fe5a[_0xe625('0x5d')]);});if(!_[_0xe625('0x69')](_0x5c5914)){return _[_0xe625('0x3a')](_0x5c5914,function(_0x328b39){return _0x328b39[_0xe625('0x5d')];});}else{return;}})[_0xe625('0x2d')](function(_0x3d8f85){if(_0x3d8f85)_0x11ed90=_0x3d8f85;if(_['includes'](_0x11ed90,0x64)){var _0x3ef192=_[_0xe625('0x4f')](_0x5c5914,{'sectionId':0x64});return hasDefaultDashboard(_0x3ef192)[_0xe625('0x2d')](function(_0x1da9b3){return _[_0xe625('0x3a')](_0x5c5914,function(_0x12d058){if(_0x12d058[_0xe625('0x5d')]===0x64){_0x12d058[_0xe625('0x6a')]=_0x1da9b3;}return _0x12d058;});});}else{return;}})[_0xe625('0x2d')](function(_0x5db790){if(_0x5db790)_0x5c5914=_0x5db790;if(_[_0xe625('0x6b')](_0x11ed90,0x3eb)){var _0x36f971=_[_0xe625('0x4f')](_0x5c5914,{'sectionId':0x3eb});return getCustomDashboards(_0x36f971)[_0xe625('0x2d')](function(_0x3ecf47){return _[_0xe625('0x3a')](_0x5c5914,function(_0x30f40a){if(_0x36f971[_0xe625('0x68')]){if(_0x30f40a['sectionId']===0x3eb){_0x30f40a[_0xe625('0x6a')]=_0x3ecf47;}}else{if(_0x30f40a['sectionId']===0x64){if(!_0x30f40a[_0xe625('0x6a')]){_0x30f40a['subsections']=[];}_0x30f40a[_0xe625('0x6a')]=_0x30f40a[_0xe625('0x6a')][_0xe625('0x6c')](_0x3ecf47);}}return _0x30f40a;});});}else{return;}})[_0xe625('0x2d')](function(_0x5c8ee8){if(_0x5c8ee8)_0x5c5914=_0x5c8ee8;if(_['includes'](_0x11ed90,0x709)){var _0x2dc280=_['find'](_0x5c5914,{'sectionId':0x709});return getPlugins(_0x2dc280)[_0xe625('0x2d')](function(_0xfa0cbf){if(_0x2dc280['enabled']){return _[_0xe625('0x3a')](_0x5c5914,function(_0x5bb460){if(_0x5bb460[_0xe625('0x5d')]===0x709){_0x5bb460[_0xe625('0x6a')]=_0xfa0cbf;}return _0x5bb460;});}else{var _0x38c01a={'sectionId':0x76c,'enabled':0x1,'subsections':_0xfa0cbf};var _0x253041=_[_0xe625('0x3a')](_0x5c5914);_0x253041[_0xe625('0x64')](_0x38c01a);return _0x253041;}});}else{return;}})[_0xe625('0x2d')](function(_0x9982d5){if(_0x9982d5)_0x5c5914=_0x9982d5;return _[_0xe625('0x44')](_0x5c5914,[_0xe625('0x68'),0x1]);})[_0xe625('0x2d')](respondWithResult(_0x5a6509,null))[_0xe625('0x60')](handleError(_0x5a6509,null));};function hasDefaultDashboard(_0x397564){var _0x4c216a=[0x65];return new BPromise(function(_0x1ebcb9,_0x55574d){try{if(_0x397564[_0xe625('0x5c')]){_0x1ebcb9(_0x4c216a);}else{return db[_0xe625('0x5f')]['findOne']({'where':{'sectionId':_0x397564['id']},'raw':!![]})['then'](function(_0x953ee3){_0x953ee3?_0x1ebcb9(_0x4c216a):_0x1ebcb9();});}}catch(_0x41ce39){_0x55574d(_0x41ce39);}});}function getCustomDashboards(_0xbaab40){var _0x59193d=[];return new BPromise(function(_0x49432c,_0x43cfe4){try{if(_0xbaab40['autoAssociation']){return db[_0xe625('0x6d')][_0xe625('0x4b')]({'raw':!![]})['then'](function(_0x29d9f7){_0x29d9f7[_0xe625('0x6e')](function(_0x1beb15){_0x59193d['push'](_0x1beb15['id']+0x1869f);});_0x49432c(_0x59193d);});}else{return db['UserProfileResource'][_0xe625('0x4b')]({'where':{'sectionId':_0xbaab40['id']},'raw':!![]})[_0xe625('0x2d')](function(_0x15d64e){_0x15d64e[_0xe625('0x6e')](function(_0xe73004){_0x59193d[_0xe625('0x64')](_0xe73004['resourceId']+0x1869f);});_0x49432c(_0x59193d);});}}catch(_0x4629d6){_0x43cfe4(_0x4629d6);}});}function getPlugins(_0x2578fa){var _0x20131b=[];return new BPromise(function(_0x2752dc,_0x5eb3c1){try{if(_0x2578fa[_0xe625('0x5c')]){return db[_0xe625('0x6f')][_0xe625('0x4b')]({'raw':!![]})['then'](function(_0x2325cb){_0x2325cb[_0xe625('0x6e')](function(_0x3ca0ad){_0x20131b[_0xe625('0x64')](_0x3ca0ad['id']+0x15b38);});_0x2752dc(_0x20131b);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2578fa['id']},'raw':!![]})[_0xe625('0x2d')](function(_0x2da1aa){_0x2da1aa[_0xe625('0x6e')](function(_0xe5e489){_0x20131b[_0xe625('0x64')](_0xe5e489[_0xe625('0x70')]+0x15b38);});_0x2752dc(_0x20131b);});}}catch(_0x494063){_0x5eb3c1(_0x494063);}});}exports['addResources']=function(_0x6764df,_0x1e0be0){return db['UserProfile']['find']({'where':{'id':_0x6764df['params']['id']}})[_0xe625('0x2d')](handleEntityNotFound(_0x1e0be0,null))['then'](function(_0x8e4735){if(_0x8e4735){return db[_0xe625('0x58')]['transaction'](function(_0x5115f4){return db[_0xe625('0x5a')][_0xe625('0x4b')]({'where':{'userProfileId':_0x6764df[_0xe625('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0xe625('0x2d')](function(_0x4d3dfe){if(_0x4d3dfe){return db[_0xe625('0x5a')][_0xe625('0x2e')]({'where':{'userProfileId':_0x6764df[_0xe625('0x4d')]['id'],'id':_[_0xe625('0x3a')](_0x4d3dfe,function(_0x445da2){return _0x445da2['id'];})},'transaction':_0x5115f4});}})[_0xe625('0x2d')](function(_0x4fb43c){var _0x545094=_[_0xe625('0x3a')](_0x6764df['body'],function(_0x132de6){_0x132de6['userProfileId']=_0x6764df[_0xe625('0x4d')]['id'];return _0x132de6;});return db[_0xe625('0x5a')][_0xe625('0x71')](_0x545094,{'raw':!![],'transaction':_0x5115f4});})[_0xe625('0x2d')](function(_0xcf029e){var _0x48f8f3=_[_0xe625('0x44')](_[_0xe625('0x3a')](_0xcf029e,function(_0x318ad2){return _0x318ad2[_0xe625('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x48f8f3){return db[_0xe625('0x5a')][_0xe625('0x4b')]({'where':{'userProfileId':_0x6764df[_0xe625('0x4d')]['id'],'sectionId':_['map'](_0x48f8f3,function(_0x1df14e){return _0x1df14e[_0xe625('0x5d')];})},'attributes':['id',_0xe625('0x5d')],'raw':!![]})[_0xe625('0x2d')](function(_0x24e7ef){var _0x336d18=_[_0xe625('0x3a')](_0x6764df[_0xe625('0x51')],function(_0x5daf1b){_0x5daf1b[_0xe625('0x63')]=_0x6764df[_0xe625('0x4d')]['id'];return _0x5daf1b;});return db[_0xe625('0x5f')][_0xe625('0x71')](_0x336d18,{'raw':!![],'transaction':_0x5115f4});});}})[_0xe625('0x60')](handleError(_0x1e0be0,null));});}})[_0xe625('0x2d')](function(_0x1f61cc){var _0x44c561=_[_0xe625('0x3a')](_0x1f61cc,function(_0x362d87){return _0x362d87[_0xe625('0x53')]({'plain':!![]});});})['then'](respondWithResult(_0x1e0be0,null))[_0xe625('0x60')](handleError(_0x1e0be0,null));};exports[_0xe625('0x72')]=function(_0x54ead1,_0x1e1566,_0x5acbba){return db[_0xe625('0x34')]['find']({'where':{'id':_0x54ead1[_0xe625('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e1566,null))[_0xe625('0x2d')](function(_0x586da2){if(_0x586da2){return _0x586da2[_0xe625('0x72')](_0x54ead1[_0xe625('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x1e1566,null))['catch'](handleError(_0x1e1566,null));};exports['getResources']=function(_0x354d97,_0x32159d){var _0xd05107={};if(!_0x354d97[_0xe625('0x3b')][_0xe625('0x73')])throw new Error(_0xe625('0x74'));if(!_0x354d97[_0xe625('0x3b')][_0xe625('0x41')](_0xe625('0x75'))){_0xd05107[_0xe625('0x25')]=qs[_0xe625('0x25')](_0x354d97[_0xe625('0x3b')][_0xe625('0x25')]);_0xd05107[_0xe625('0x28')]=qs[_0xe625('0x28')](_0x354d97[_0xe625('0x3b')][_0xe625('0x28')]);}return db[_0xe625('0x34')][_0xe625('0x4f')]({'where':{'id':_0x354d97['params']['id']}})['then'](function(_0xca557){if(!_0xca557)throw new Error(_0xe625('0x76')+_0x354d97[_0xe625('0x4d')]['id']);return db[_0xe625('0x34')][_0xe625('0x77')](_0x354d97);})[_0xe625('0x2d')](respondWithFilteredResult(_0x32159d,_0xd05107))[_0xe625('0x60')](handleError(_0x32159d,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 886c3ef..9280d2f 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 _0x74af=['UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x74af,0x178));var _0xf74a=function(_0x329dae,_0x560e52){_0x329dae=_0x329dae-0x0;var _0x4e5f2f=_0x74af[_0x329dae];return _0x4e5f2f;};'use strict';var EventEmitter=require(_0xf74a('0x0'));var UserProfile=require(_0xf74a('0x1'))['db'][_0xf74a('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf74a('0x3')](0x0);var events={'afterCreate':_0xf74a('0x4'),'afterUpdate':_0xf74a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21fcb){return function(_0x321dc5,_0x349c77,_0x282618){UserProfileEvents[_0xf74a('0x6')](_0x21fcb+':'+_0x321dc5['id'],_0x321dc5);UserProfileEvents[_0xf74a('0x6')](_0x21fcb,_0x321dc5);_0x282618(null);};}for(var e in events){if(events[_0xf74a('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xf74a('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x5ae0=['emit','hasOwnProperty','exports','../../mysqldb','UserProfile','save','update'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5ae0,0xf8));var _0x05ae=function(_0x295bd4,_0xe4c4cd){_0x295bd4=_0x295bd4-0x0;var _0x39d146=_0x5ae0[_0x295bd4];return _0x39d146;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x05ae('0x0'))['db'][_0x05ae('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05ae('0x2'),'afterUpdate':_0x05ae('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd7e47f){return function(_0xaae02b,_0x4aac85,_0x554b43){UserProfileEvents[_0x05ae('0x4')](_0xd7e47f+':'+_0xaae02b['id'],_0xaae02b);UserProfileEvents[_0x05ae('0x4')](_0xd7e47f,_0xaae02b);_0x554b43(null);};}for(var e in events){if(events[_0x05ae('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x05ae('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f5866bd..510a99b 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 _0xd4ea=['Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','Interval','Pause','scheduler','Schedule','Sound','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','SELECT','select','ui.','InteractionId','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','../../components/parsers/qs','query','raw','section','mergeResources','length','push','UserProfileSection','find','params','ignore','isEmpty','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','include','Tags','color','tag','ThroughTags','openTabs','dataValues','sms','fax','mail','openchannel','whatsapp','all','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','associatedResources','map','catch','model','then','name','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','contacts','CmContact','Lists','ListId','CmList','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','Agents','membername','role','agent','Telephones','User','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','chanspies','VoiceChanSpy','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0xd4ea,0x12d));var _0xad4e=function(_0x50dbc2,_0x1cc018){_0x50dbc2=_0x50dbc2-0x0;var _0x16f4ab=_0xd4ea[_0x50dbc2];return _0x16f4ab;};'use strict';var _=require(_0xad4e('0x0'));var attributes=require(_0xad4e('0x1'));var squel=require(_0xad4e('0x2'));module[_0xad4e('0x3')]=function(_0x2a6033){var _0x290586=_0x2a6033[_0xad4e('0x4')];function _0x52540b(_0x58d0d6,_0x38ba65){return new Promise(function(_0x408742,_0x517ff7){if(!_0x38ba65)return _0x408742(null);var _0x20c2c6=_0x38ba65[_0xad4e('0x5')]?{[_0x38ba65[_0xad4e('0x5')][_0xad4e('0x6')]]:_0x38ba65['filter'][_0xad4e('0x7')]}:undefined;return _0x290586[_0x58d0d6][_0xad4e('0x8')]({'where':_0x20c2c6,'raw':!![]})['then'](function(_0xc6d0f0){_0x38ba65[_0xad4e('0x9')]=_[_0xad4e('0xa')](_0xc6d0f0,'id');_0x408742(_0x38ba65);})[_0xad4e('0xb')](function(_0x350b97){_0x517ff7(_0x350b97);});});}function _0x4e2d24(_0x36cfd0,_0x861dac){return new Promise(function(_0x39c569,_0x42f2ba){var _0x3b5b6c=_0x36cfd0[_0xad4e('0x5')]?{[_0x36cfd0['filter'][_0xad4e('0x6')]]:_0x36cfd0[_0xad4e('0x5')][_0xad4e('0x7')]}:undefined;return _0x290586[_0x36cfd0[_0xad4e('0xc')]]['findAll']({'where':_0x3b5b6c,'raw':!![]})[_0xad4e('0xd')](function(_0x5baf0e){_0x861dac[_0xad4e('0x9')]=_[_0xad4e('0xa')](_0x5baf0e,function(_0x4c8f41){return _0x4c8f41[_0xad4e('0xe')];});_0x39c569(_0x861dac);})[_0xad4e('0xb')](function(_0x2c80cc){_0x42f2ba(_0x2c80cc);});});}function _0x903439(_0x554582,_0x1372ad,_0x2cf254){if(!_0x1372ad)return Promise['resolve'](null);return new Promise(function(_0x125e1d,_0x11919b){return _0x290586['UserProfileResource'][_0xad4e('0x8')]({'where':{'sectionId':_0x1372ad['id']},'raw':!![]})['then'](function(_0x367865){if(_0x554582['field']&&_0x554582['field']!=='id'){_0x1372ad['associatedResources']=_[_0xad4e('0xa')](_0x367865,function(_0x13eaba){return _0x13eaba[_0x554582[_0xad4e('0x6')]];});}else{if(_0x2cf254===_0xad4e('0xf')){_0x1372ad['associatedResources']=_[_0xad4e('0xa')](_0x367865,function(_0x3fa411){return{'id':_0x3fa411[_0xad4e('0x10')],'type':_0x3fa411[_0xad4e('0x11')]};});}else{_0x1372ad[_0xad4e('0x9')]=_[_0xad4e('0xa')](_0x367865,function(_0x1c57a8){return _0x1c57a8['resourceId'];});}}_0x125e1d(_0x1372ad);})[_0xad4e('0xb')](function(_0x425384){_0x11919b(_0x425384);});});}function _0x53840a(_0x4f62b1,_0x275339){var _0xfaf2e8={'parentSections':[]};switch(_0x4f62b1[_0xad4e('0x12')]()){case _0xad4e('0x13'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x15');break;case'odbc':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x16');break;case _0xad4e('0x17'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x18');_0xfaf2e8[_0xad4e('0x19')]=[{'name':'SquareProjects','field':_0xad4e('0xe'),'foreignKey':_0xad4e('0x1a')}];break;case _0xad4e('0x1b'):_0xfaf2e8[_0xad4e('0x14')]='JscriptyProject';break;case _0xad4e('0x1c'):_0xfaf2e8['childModel']=_0xad4e('0x1d');_0xfaf2e8['parentSections']=[{'name':_0xad4e('0x1e'),'field':'id','foreignKey':_0xad4e('0x1f')}];break;case'lists':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x20');break;case'companies':_0xfaf2e8[_0xad4e('0x14')]='CmCompany';break;case _0xad4e('0x21'):_0xfaf2e8[_0xad4e('0x14')]='CmCustomField';break;case _0xad4e('0x22'):_0xfaf2e8['childModel']=_0xad4e('0x23');break;case _0xad4e('0x24'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x25');break;case _0xad4e('0x26'):_0xfaf2e8['childModel']=_0xad4e('0x27');break;case _0xad4e('0x28'):_0xfaf2e8[_0xad4e('0x14')]='FaxAccount';break;case _0xad4e('0x29'):case'internalroutes':case _0xad4e('0x2a'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x2b');break;case _0xad4e('0x2c'):_0xfaf2e8['childModel']=_0xad4e('0x2d');break;case'voicemails':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x2e');break;case _0xad4e('0x2f'):_0xfaf2e8[_0xad4e('0x14')]='VoiceRecording';_0xfaf2e8[_0xad4e('0x19')]=[{'name':_0xad4e('0x30'),'field':'name','foreignKey':_0xad4e('0x31'),'model':'User','filter':{'field':_0xad4e('0x32'),'value':[_0xad4e('0x33')]}},{'name':_0xad4e('0x34'),'field':_0xad4e('0xe'),'foreignKey':_0xad4e('0x31'),'model':_0xad4e('0x35'),'filter':{'field':_0xad4e('0x32'),'value':['telephone']}},{'name':_0xad4e('0x36'),'field':'name','foreignKey':_0xad4e('0x37'),'model':_0xad4e('0x38'),'filter':{'field':'type','value':[_0xad4e('0x39')]}},{'name':_0xad4e('0x3a'),'field':'name','foreignKey':'queue','model':_0xad4e('0x38'),'filter':{'field':_0xad4e('0x11'),'value':['outbound']}}];break;case'musiconholds':_0xfaf2e8['childModel']='VoiceMusicOnHold';break;case _0xad4e('0x3b'):_0xfaf2e8['childModel']=_0xad4e('0x3c');break;case'voiceprefixes':_0xfaf2e8[_0xad4e('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0xfaf2e8[_0xad4e('0x14')]='Campaign';break;case _0xad4e('0x3d'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x3e');break;case _0xad4e('0x3f'):_0xfaf2e8[_0xad4e('0x14')]='MailAccount';break;case _0xad4e('0x40'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x41');break;case'openchannelqueues':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x42');break;case _0xad4e('0x43'):_0xfaf2e8[_0xad4e('0x14')]='OpenchannelAccount';break;case _0xad4e('0x44'):_0xfaf2e8[_0xad4e('0x14')]='SmsQueue';break;case _0xad4e('0x45'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x46');break;case'whatsappqueues':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x47');break;case _0xad4e('0x48'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x49');break;case _0xad4e('0x4a'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x4b');break;case _0xad4e('0x4c'):case _0xad4e('0x4d'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x38');if(_0x275339){_0xfaf2e8[_0xad4e('0x19')]=[{'name':_0xad4e('0x36')},{'name':_0xad4e('0x3a')}];}break;case _0xad4e('0x4e'):case _0xad4e('0x4f'):case _0xad4e('0x50'):_0xfaf2e8['childModel']=_0xad4e('0x35');if(_0x275339){_0xfaf2e8['parentSections']=[{'name':_0xad4e('0x51'),'filter':{'field':_0xad4e('0x32'),'value':[_0xad4e('0x52'),_0xad4e('0x53')]},'ignore':!![]},{'name':_0xad4e('0x30')},{'name':_0xad4e('0x34')}];}break;case _0xad4e('0x54'):_0xfaf2e8['childModel']=_0xad4e('0x55');break;case _0xad4e('0x56'):_0xfaf2e8[_0xad4e('0x14')]='SalesforceAccount';break;case _0xad4e('0x57'):_0xfaf2e8['childModel']=_0xad4e('0x58');break;case _0xad4e('0x59'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x5a');break;case'deskaccounts':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x5b');break;case _0xad4e('0x5c'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x5d');break;case'vtigeraccounts':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x35');break;case _0xad4e('0x5e'):_0xfaf2e8[_0xad4e('0x14')]='CannedAnswer';break;case _0xad4e('0x5f'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x60');break;case _0xad4e('0x61'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x62');break;case'intervals':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x63');break;case'pauses':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x64');break;case _0xad4e('0x65'):_0xfaf2e8['childModel']=_0xad4e('0x66');break;case'sounds':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x67');break;case'tags':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x68');break;case'templates':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x69');break;case _0xad4e('0x6a'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x6b');break;case _0xad4e('0x6c'):_0xfaf2e8['childModel']=_0xad4e('0x6d');break;case _0xad4e('0x6e'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x6f');break;case _0xad4e('0x70'):_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0x71');break;case'extractedreports':_0xfaf2e8[_0xad4e('0x14')]=_0xad4e('0xf');_0xfaf2e8[_0xad4e('0x19')]=[{'name':_0xad4e('0x72'),'field':'id','foreignKey':_0xad4e('0x73')}];break;case _0xad4e('0x74'):_0xfaf2e8['childModel']=_0xad4e('0x75');break;}return _0xfaf2e8;}function _0x1cf405(_0x5c0bd2,_0x42cb0b){var _0x1cf506=_0x5c0bd2[_0xad4e('0x76')](0x0)['toUpperCase']()+_0x5c0bd2[_0xad4e('0x77')](0x1);var _0x3bdfae={'type':_0x290586[_0xad4e('0x78')]['QueryTypes'][_0xad4e('0x79')],'raw':!![]};return new Promise(function(_0x57cc60,_0x42c08e){var _0x4b6e46=squel[_0xad4e('0x7a')]()[_0xad4e('0x6')](_0xad4e('0x7b')+_0x1cf506+_0xad4e('0x7c'),'id')[_0xad4e('0x6')]('ui.createdAt')['from']('user_has_'+_0x5c0bd2+_0xad4e('0x7d'),'ui')[_0xad4e('0x7e')](_0xad4e('0x7f'),_0x42cb0b['id']);return _0x290586[_0xad4e('0x80')]['query'](_0x4b6e46[_0xad4e('0x81')](),_0x3bdfae)[_0xad4e('0xd')](function(_0x8c52e5){_0x42cb0b[_0x1cf506+_0xad4e('0x82')]=_0x8c52e5;_0x57cc60(_0x8c52e5);})[_0xad4e('0xb')](function(_0x5ca0a7){_0x42c08e(_0x5ca0a7);});});}return _0x2a6033[_0xad4e('0x83')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5ec8c2){var _0x44793c=require(_0xad4e('0x84'));var _0x284aa8={'raw':_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0x86')],'where':{}};var _0x46aca2={};var _0x354296={'count':0x0,'rows':[]};var _0x7d9a10=_0x5ec8c2['query'][_0xad4e('0x87')];var _0xafe90d=_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0x88')]||![];var _0x1a0405=_0x53840a(_0x7d9a10,_0xafe90d);if(!_0x1a0405['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x7d9a10+'\x27');var _0x3ea8fb=[{'name':_0x7d9a10}];if(!_['isEmpty'](_0x1a0405[_0xad4e('0x19')]))_0x3ea8fb=_0x1a0405['parentSections'];var _0xb952fe=[];for(var _0x3e5d87=0x0;_0x3e5d87<_0x3ea8fb[_0xad4e('0x89')];_0x3e5d87++){_0xb952fe[_0xad4e('0x8a')](_0x290586[_0xad4e('0x8b')][_0xad4e('0x8c')]({'where':{'userProfileId':_0x5ec8c2[_0xad4e('0x8d')]['id'],'name':_0x3ea8fb[_0x3e5d87][_0xad4e('0xe')]},'raw':!![]}));}return Promise['all'](_0xb952fe)[_0xad4e('0xd')](function(_0x25e5e6){var _0x507498=_[_0xad4e('0x5')](_0x25e5e6,function(_0x139dfe){return _0x139dfe?_0x139dfe:undefined;});var _0x315fd0=_[_0xad4e('0x5')](_0x3ea8fb,[_0xad4e('0x8e'),!![]]);var _0x3b4af8=_[_0xad4e('0x8f')](_0x507498)&&_[_0xad4e('0x8f')](_0x315fd0)?null:_[_0xad4e('0x90')](_0x315fd0,_0x507498);if(!_0x3b4af8)return null;var _0x29a900=[];for(var _0x5e3dc0=0x0;_0x5e3dc0<_0x3b4af8['length'];_0x5e3dc0++){var _0x2c720d=_[_0xad4e('0x8c')](_0x3ea8fb,function(_0x2e8534){return _0x3b4af8[_0x5e3dc0]?_0x2e8534['name']===_0x3b4af8[_0x5e3dc0][_0xad4e('0xe')]:null;});if(_0x2c720d){if(_0x3b4af8[_0x5e3dc0][_0xad4e('0x8e')]){_0x29a900[_0xad4e('0x8a')](_0x52540b(_0x1a0405[_0xad4e('0x14')],_0x3b4af8[_0x5e3dc0]));}else{if(!_0x3b4af8[_0x5e3dc0][_0xad4e('0x91')]){_0x29a900['push'](_0x903439(_0x2c720d,_0x3b4af8[_0x5e3dc0],_0x1a0405[_0xad4e('0x14')]));}else{if(_0x2c720d[_0xad4e('0xc')]){_0x29a900[_0xad4e('0x8a')](_0x4e2d24(_0x2c720d,_0x3b4af8[_0x5e3dc0]));}}}}}return Promise['all'](_0x29a900);})[_0xad4e('0xd')](function(_0x38f42f){var _0x2bcbfe=_0x38f42f;var _0x71df2c=null;if(_0x2bcbfe){_0x71df2c=_0x2bcbfe[_0xad4e('0x89')]===0x1?_0x2bcbfe[0x0]:null;}if(!_0x71df2c&&!_0x2bcbfe)return _0x354296;var _0x172e2c=_0x290586[_0x1a0405[_0xad4e('0x14')]][_0xad4e('0x92')];_0x46aca2['model']=_[_0xad4e('0x93')](_0x172e2c);_0x46aca2[_0xad4e('0x85')]=_[_0xad4e('0x93')](_0x5ec8c2[_0xad4e('0x85')]);_0x46aca2[_0xad4e('0x94')]=_[_0xad4e('0x95')](_0x46aca2[_0xad4e('0xc')],_0x46aca2[_0xad4e('0x85')]);_0x284aa8[_0xad4e('0x96')]=_[_0xad4e('0x95')](_0x46aca2[_0xad4e('0xc')],_0x44793c[_0xad4e('0x97')](_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0x97')]));_0x284aa8[_0xad4e('0x96')]=_0x284aa8['attributes'][_0xad4e('0x89')]?_0x284aa8[_0xad4e('0x96')]:_0x46aca2[_0xad4e('0xc')];if(!_0x5ec8c2[_0xad4e('0x85')]['hasOwnProperty'](_0xad4e('0x98'))){_0x284aa8[_0xad4e('0x99')]=_0x44793c['limit'](_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0x99')]);_0x284aa8[_0xad4e('0x9a')]=_0x44793c[_0xad4e('0x9a')](_0x5ec8c2[_0xad4e('0x85')]['offset']);}_0x284aa8['order']=_0x44793c[_0xad4e('0x9b')](_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0x9b')]);_0x284aa8[_0xad4e('0x7e')]=_0x44793c['filters'](_[_0xad4e('0x9c')](_0x5ec8c2[_0xad4e('0x85')],_0x46aca2[_0xad4e('0x94')]));if(_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0x5')]){_0x284aa8[_0xad4e('0x7e')]=_[_0xad4e('0x9d')](_0x284aa8[_0xad4e('0x7e')],{'$or':_[_0xad4e('0xa')](_0x172e2c,function(_0xcf56e6){if(_0xcf56e6[_0xad4e('0x11')][_0xad4e('0x9e')]!==_0xad4e('0x9f')){var _0x3bbf78={};_0x3bbf78[_0xcf56e6[_0xad4e('0x6')]]={'$like':'%'+_0x5ec8c2['query'][_0xad4e('0x5')]+'%'};return _0x3bbf78;}})});}var _0x28ed29=[];var _0x5893c9=null;var _0x43be87={};if(_0x71df2c){_0x5893c9=_[_0xad4e('0x8c')](_0x3ea8fb,['name',_0x71df2c[_0xad4e('0xe')]]);if(_0x5893c9['field']){_0x43be87={};if(_0x1a0405[_0xad4e('0x14')]==='AnalyticExtractedReport'){_0x43be87[_0x5893c9[_0xad4e('0xa0')]]=_['map'](_0x71df2c[_0xad4e('0x9')],'id');}else{_0x43be87[_0x5893c9['foreignKey']]=_0x71df2c[_0xad4e('0x9')];}_0x28ed29[_0xad4e('0x8a')](_0x43be87);}else{_0x284aa8[_0xad4e('0x7e')]['id']=_0x71df2c['associatedResources'];}}else{for(var _0x484361=0x0;_0x484361<_0x2bcbfe[_0xad4e('0x89')];_0x484361++){_0x5893c9=_['find'](_0x3ea8fb,[_0xad4e('0xe'),_0x2bcbfe[_0x484361]['name']]);if(_0x5893c9['field']){_0x43be87={};_0x43be87[_0x5893c9[_0xad4e('0xa0')]]=_0x2bcbfe[_0x484361][_0xad4e('0x9')];_0x28ed29[_0xad4e('0x8a')](_0x43be87);}else{if(!_0x284aa8[_0xad4e('0x7e')]['id'])_0x284aa8[_0xad4e('0x7e')]['id']=[];_0x2bcbfe[_0x484361][_0xad4e('0x9')][_0xad4e('0xa1')](function(_0x10fc6f){_0x284aa8[_0xad4e('0x7e')]['id'][_0xad4e('0x8a')](_0x10fc6f);});}}}if(!_['isEmpty'](_0x28ed29)){_0x284aa8[_0xad4e('0x7e')]=_[_0xad4e('0x9d')](_0x284aa8[_0xad4e('0x7e')],{'$and':{'$or':_0x28ed29}});}_0x284aa8=_[_0xad4e('0x9d')]({},_0x284aa8,_0x5ec8c2[_0xad4e('0xa2')]);if(_0x71df2c&&!_0x71df2c['autoAssociation']&&_0x1a0405[_0xad4e('0x14')]===_0xad4e('0xf')){if(_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xa3')]){_0x284aa8['include']=[{'all':!![]}];}return _0x290586[_0x1a0405[_0xad4e('0x14')]][_0xad4e('0x8')](_0x284aa8)[_0xad4e('0xd')](function(_0xa77e65){var _0xdf242d=[];_0xa77e65[_0xad4e('0xa1')](function(_0x555342){var _0x104335;switch(_0x555342[_0xad4e('0xa4')]){case _0xad4e('0xa5'):_0x104335=_[_0xad4e('0x8c')](_0x71df2c[_0xad4e('0x9')],function(_0x832abd){return _0x832abd['id']===_0x555342[_0xad4e('0x73')]&&_0x832abd[_0xad4e('0x11')]===_0xad4e('0xa6');});break;case _0xad4e('0xa7'):_0x104335=_['find'](_0x71df2c[_0xad4e('0x9')],function(_0x535873){return _0x535873['id']===_0x555342[_0xad4e('0x73')]&&_0x535873['type']===_0xad4e('0xa8');});break;}if(_0x104335)_0xdf242d['push'](_0x555342);});_0x354296[_0xad4e('0xa9')]=_0xdf242d['length'];_0x354296[_0xad4e('0xaa')]=_0xdf242d;return _0x354296;});}else{if(!_[_0xad4e('0x8f')](_0x5ec8c2[_0xad4e('0x85')]['ids'])){_0x284aa8[_0xad4e('0x7e')]['id']=_0x284aa8[_0xad4e('0x7e')]['id']?_[_0xad4e('0x95')](_0x284aa8[_0xad4e('0x7e')]['id'],_0x5ec8c2['query'][_0xad4e('0xab')]):_0x5ec8c2[_0xad4e('0x85')]['ids'];if(_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xac')]){_0x284aa8[_0xad4e('0xad')]=_0x5ec8c2['query'][_0xad4e('0xac')];}}if(_0x5ec8c2['query'][_0xad4e('0xae')]){_0x284aa8[_0xad4e('0x7e')]=_[_0xad4e('0x9d')](_0x284aa8['where'],{'$and':_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xae')]});}return _0x290586[_0x1a0405[_0xad4e('0x14')]][_0xad4e('0xa9')]({'where':_0x284aa8[_0xad4e('0x7e')]})['then'](function(_0x53784c){_0x354296['count']=_0x53784c;if(_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xa3')]){if(_0x1a0405[_0xad4e('0x14')]===_0xad4e('0x1d')){_0x284aa8[_0xad4e('0xaf')]=[{'model':_0x290586['Tag'],'as':_0xad4e('0xb0'),'attributes':['id',_0xad4e('0xe'),_0xad4e('0xb1')],'required':_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xb2')]?!![]:![]},{'model':_0x290586[_0xad4e('0x68')],'as':_0xad4e('0xb3'),'attributes':['id',_0xad4e('0xe'),'color'],'through':_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xb2')]?{'attributes':[],'where':{'TagId':_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xb2')]||undefined}}:{},'required':_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xb2')]?!![]:![]}];}else{_0x284aa8[_0xad4e('0xaf')]=[{'all':!![]}];}}return _0x290586[_0x1a0405[_0xad4e('0x14')]][_0xad4e('0x8')](_0x284aa8);})[_0xad4e('0xd')](function(_0x545074){_0x354296[_0xad4e('0xaa')]=_0x545074;if(_0x7d9a10===_0xad4e('0x30')&&_0x5ec8c2[_0xad4e('0x85')][_0xad4e('0xb4')]==='true'){var _0x4ab6ae=[];for(var _0x2a1153=0x0;_0x2a1153<_0x354296[_0xad4e('0xaa')]['length'];_0x2a1153++){_0x4ab6ae[_0xad4e('0x8a')](_0x1cf405('chat',_0x354296[_0xad4e('0xaa')][_0x2a1153][_0xad4e('0xb5')]));_0x4ab6ae[_0xad4e('0x8a')](_0x1cf405(_0xad4e('0xb6'),_0x354296[_0xad4e('0xaa')][_0x2a1153]['dataValues']));_0x4ab6ae['push'](_0x1cf405(_0xad4e('0xb7'),_0x354296[_0xad4e('0xaa')][_0x2a1153][_0xad4e('0xb5')]));_0x4ab6ae[_0xad4e('0x8a')](_0x1cf405(_0xad4e('0xb8'),_0x354296['rows'][_0x2a1153][_0xad4e('0xb5')]));_0x4ab6ae[_0xad4e('0x8a')](_0x1cf405(_0xad4e('0xb9'),_0x354296[_0xad4e('0xaa')][_0x2a1153][_0xad4e('0xb5')]));_0x4ab6ae[_0xad4e('0x8a')](_0x1cf405(_0xad4e('0xba'),_0x354296[_0xad4e('0xaa')][_0x2a1153][_0xad4e('0xb5')]));}return Promise[_0xad4e('0xbb')](_0x4ab6ae)[_0xad4e('0xd')](function(){return _0x354296;});}return _0x354296;});}});}}});}; \ No newline at end of file +var _0xa8a1=['mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','Sound','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','query','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','key','VIRTUAL','foreignKey','forEach','merge','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','reportId','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','Tag','ThroughTags','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','models','filter','value','findAll','then','associatedResources','map','field','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','JscriptyProject','contacts','CmContact','Lists','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','queue','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue'];(function(_0x895824,_0x358ef1){var _0x182f24=function(_0x1886a5){while(--_0x1886a5){_0x895824['push'](_0x895824['shift']());}};_0x182f24(++_0x358ef1);}(_0xa8a1,0x80));var _0x1a8a=function(_0x1190a1,_0x2253c6){_0x1190a1=_0x1190a1-0x0;var _0x5ef664=_0xa8a1[_0x1190a1];return _0x5ef664;};'use strict';var _=require('lodash');var attributes=require(_0x1a8a('0x0'));var squel=require(_0x1a8a('0x1'));module[_0x1a8a('0x2')]=function(_0x45f2ac){var _0x4a4ae6=_0x45f2ac[_0x1a8a('0x3')];function _0x1a5af5(_0x2e1ee8,_0x418579){return new Promise(function(_0x5f352d,_0x8d287f){if(!_0x418579)return _0x5f352d(null);var _0x36a7cb=_0x418579[_0x1a8a('0x4')]?{[_0x418579[_0x1a8a('0x4')]['field']]:_0x418579[_0x1a8a('0x4')][_0x1a8a('0x5')]}:undefined;return _0x4a4ae6[_0x2e1ee8][_0x1a8a('0x6')]({'where':_0x36a7cb,'raw':!![]})[_0x1a8a('0x7')](function(_0x5e3eed){_0x418579[_0x1a8a('0x8')]=_[_0x1a8a('0x9')](_0x5e3eed,'id');_0x5f352d(_0x418579);})['catch'](function(_0x4b4ab3){_0x8d287f(_0x4b4ab3);});});}function _0x35e160(_0x181e8e,_0x389e62){return new Promise(function(_0x5eda84,_0xf968a2){var _0xeb4bfc=_0x181e8e[_0x1a8a('0x4')]?{[_0x181e8e[_0x1a8a('0x4')][_0x1a8a('0xa')]]:_0x181e8e['filter'][_0x1a8a('0x5')]}:undefined;return _0x4a4ae6[_0x181e8e['model']][_0x1a8a('0x6')]({'where':_0xeb4bfc,'raw':!![]})['then'](function(_0x115425){_0x389e62[_0x1a8a('0x8')]=_[_0x1a8a('0x9')](_0x115425,function(_0xb3c2d3){return _0xb3c2d3[_0x1a8a('0xb')];});_0x5eda84(_0x389e62);})[_0x1a8a('0xc')](function(_0x6c1aed){_0xf968a2(_0x6c1aed);});});}function _0x560d86(_0x1254db,_0x3a0e35,_0x3b6f8a){if(!_0x3a0e35)return Promise[_0x1a8a('0xd')](null);return new Promise(function(_0x27b2f5,_0x52ee63){return _0x4a4ae6[_0x1a8a('0xe')][_0x1a8a('0x6')]({'where':{'sectionId':_0x3a0e35['id']},'raw':!![]})[_0x1a8a('0x7')](function(_0x589f2d){if(_0x1254db['field']&&_0x1254db[_0x1a8a('0xa')]!=='id'){_0x3a0e35['associatedResources']=_[_0x1a8a('0x9')](_0x589f2d,function(_0x492546){return _0x492546[_0x1254db[_0x1a8a('0xa')]];});}else{if(_0x3b6f8a===_0x1a8a('0xf')){_0x3a0e35[_0x1a8a('0x8')]=_['map'](_0x589f2d,function(_0x366f9c){return{'id':_0x366f9c[_0x1a8a('0x10')],'type':_0x366f9c[_0x1a8a('0x11')]};});}else{_0x3a0e35[_0x1a8a('0x8')]=_[_0x1a8a('0x9')](_0x589f2d,function(_0xd15a80){return _0xd15a80[_0x1a8a('0x10')];});}}_0x27b2f5(_0x3a0e35);})['catch'](function(_0x37985c){_0x52ee63(_0x37985c);});});}function _0x245bc7(_0x460e6d,_0x305792){var _0x23c425={'parentSections':[]};switch(_0x460e6d[_0x1a8a('0x12')]()){case _0x1a8a('0x13'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x15');break;case _0x1a8a('0x16'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x17');break;case _0x1a8a('0x18'):_0x23c425['childModel']=_0x1a8a('0x19');_0x23c425[_0x1a8a('0x1a')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case'projects':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x1b');break;case _0x1a8a('0x1c'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x1d');_0x23c425[_0x1a8a('0x1a')]=[{'name':_0x1a8a('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0x1a8a('0x1f'):_0x23c425[_0x1a8a('0x14')]='CmList';break;case _0x1a8a('0x20'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x21');break;case'globalcustomfields':_0x23c425['childModel']=_0x1a8a('0x22');break;case _0x1a8a('0x23'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x24');break;case _0x1a8a('0x25'):_0x23c425['childModel']=_0x1a8a('0x26');break;case _0x1a8a('0x27'):_0x23c425['childModel']=_0x1a8a('0x28');break;case _0x1a8a('0x29'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x2a');break;case _0x1a8a('0x2b'):case _0x1a8a('0x2c'):case _0x1a8a('0x2d'):_0x23c425[_0x1a8a('0x14')]='VoiceExtension';break;case'contexts':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x2e');break;case'voicemails':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x2f');break;case _0x1a8a('0x30'):_0x23c425['childModel']=_0x1a8a('0x31');_0x23c425[_0x1a8a('0x1a')]=[{'name':_0x1a8a('0x32'),'field':_0x1a8a('0xb'),'foreignKey':_0x1a8a('0x33'),'model':_0x1a8a('0x34'),'filter':{'field':_0x1a8a('0x35'),'value':[_0x1a8a('0x36')]}},{'name':_0x1a8a('0x37'),'field':_0x1a8a('0xb'),'foreignKey':_0x1a8a('0x33'),'model':_0x1a8a('0x34'),'filter':{'field':_0x1a8a('0x35'),'value':[_0x1a8a('0x38')]}},{'name':'VoiceQueues','field':_0x1a8a('0xb'),'foreignKey':_0x1a8a('0x39'),'model':'VoiceQueue','filter':{'field':_0x1a8a('0x11'),'value':['inbound']}},{'name':_0x1a8a('0x3a'),'field':_0x1a8a('0xb'),'foreignKey':'queue','model':_0x1a8a('0x3b'),'filter':{'field':_0x1a8a('0x11'),'value':[_0x1a8a('0x3c')]}}];break;case _0x1a8a('0x3d'):_0x23c425['childModel']=_0x1a8a('0x3e');break;case _0x1a8a('0x3f'):_0x23c425['childModel']='VoiceChanSpy';break;case _0x1a8a('0x40'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x41');break;case _0x1a8a('0x42'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x43');break;case _0x1a8a('0x44'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x45');break;case _0x1a8a('0x46'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x47');break;case _0x1a8a('0x48'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x49');break;case _0x1a8a('0x4a'):_0x23c425['childModel']=_0x1a8a('0x4b');break;case'openchannelaccounts':_0x23c425[_0x1a8a('0x14')]='OpenchannelAccount';break;case _0x1a8a('0x4c'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x4d');break;case _0x1a8a('0x4e'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x4f');break;case _0x1a8a('0x50'):_0x23c425['childModel']='WhatsappQueue';break;case _0x1a8a('0x51'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x52');break;case _0x1a8a('0x53'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x54');break;case _0x1a8a('0x55'):case _0x1a8a('0x56'):_0x23c425['childModel']='VoiceQueue';if(_0x305792){_0x23c425[_0x1a8a('0x1a')]=[{'name':_0x1a8a('0x57')},{'name':_0x1a8a('0x3a')}];}break;case _0x1a8a('0x58'):case _0x1a8a('0x59'):case _0x1a8a('0x5a'):_0x23c425['childModel']=_0x1a8a('0x34');if(_0x305792){_0x23c425[_0x1a8a('0x1a')]=[{'name':_0x1a8a('0x5b'),'filter':{'field':_0x1a8a('0x35'),'value':[_0x1a8a('0x5c'),_0x1a8a('0x5d')]},'ignore':!![]},{'name':_0x1a8a('0x32')},{'name':_0x1a8a('0x37')}];}break;case _0x1a8a('0x5e'):_0x23c425[_0x1a8a('0x14')]='ZendeskAccount';break;case _0x1a8a('0x5f'):_0x23c425[_0x1a8a('0x14')]='SalesforceAccount';break;case _0x1a8a('0x60'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x61');break;case _0x1a8a('0x62'):_0x23c425[_0x1a8a('0x14')]='SugarcrmAccount';break;case _0x1a8a('0x63'):_0x23c425[_0x1a8a('0x14')]='DeskAccount';break;case'zohoaccounts':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x64');break;case'vtigeraccounts':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x34');break;case'cannedanswers':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x65');break;case _0x1a8a('0x66'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x67');break;case _0x1a8a('0x68'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x69');break;case'intervals':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x6a');break;case _0x1a8a('0x6b'):_0x23c425['childModel']=_0x1a8a('0x6c');break;case _0x1a8a('0x6d'):_0x23c425['childModel']=_0x1a8a('0x6e');break;case'sounds':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x6f');break;case'tags':_0x23c425[_0x1a8a('0x14')]='Tag';break;case'templates':_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x70');break;case _0x1a8a('0x71'):_0x23c425['childModel']=_0x1a8a('0x72');break;case _0x1a8a('0x73'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x74');break;case _0x1a8a('0x75'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x76');break;case _0x1a8a('0x77'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x78');break;case _0x1a8a('0x79'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0xf');_0x23c425[_0x1a8a('0x1a')]=[{'name':_0x1a8a('0x7a'),'field':'id','foreignKey':'reportId'}];break;case _0x1a8a('0x7b'):_0x23c425[_0x1a8a('0x14')]=_0x1a8a('0x7c');break;}return _0x23c425;}function _0x3c548e(_0x3ac553,_0x280ec4){var _0x4a04ef=_0x3ac553[_0x1a8a('0x7d')](0x0)[_0x1a8a('0x7e')]()+_0x3ac553[_0x1a8a('0x7f')](0x1);var _0x4e34d5={'type':_0x4a4ae6[_0x1a8a('0x80')][_0x1a8a('0x81')][_0x1a8a('0x82')],'raw':!![]};return new Promise(function(_0x513806,_0x15407b){var _0x75abd3=squel['select']()['field'](_0x1a8a('0x83')+_0x4a04ef+_0x1a8a('0x84'),'id')['field'](_0x1a8a('0x85'))[_0x1a8a('0x86')](_0x1a8a('0x87')+_0x3ac553+_0x1a8a('0x88'),'ui')['where'](_0x1a8a('0x89'),_0x280ec4['id']);return _0x4a4ae6['sequelize'][_0x1a8a('0x8a')](_0x75abd3['toString'](),_0x4e34d5)[_0x1a8a('0x7')](function(_0x5949ff){_0x280ec4[_0x4a04ef+'OpenTabs']=_0x5949ff;_0x513806(_0x5949ff);})[_0x1a8a('0xc')](function(_0x3a9a10){_0x15407b(_0x3a9a10);});});}return _0x45f2ac[_0x1a8a('0x8b')](_0x1a8a('0x8c'),attributes,{'tableName':_0x1a8a('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x190802){var _0xe64aa6=require(_0x1a8a('0x8e'));var _0x4ebf86={'raw':_0x190802[_0x1a8a('0x8a')][_0x1a8a('0x8f')],'where':{}};var _0x220691={};var _0x584113={'count':0x0,'rows':[]};var _0x4027d5=_0x190802[_0x1a8a('0x8a')][_0x1a8a('0x90')];var _0x4b6bfa=_0x190802[_0x1a8a('0x8a')][_0x1a8a('0x91')]||![];var _0x2cc1f6=_0x245bc7(_0x4027d5,_0x4b6bfa);if(!_0x2cc1f6['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x4027d5+'\x27');var _0x129c58=[{'name':_0x4027d5}];if(!_['isEmpty'](_0x2cc1f6['parentSections']))_0x129c58=_0x2cc1f6[_0x1a8a('0x1a')];var _0x24f020=[];for(var _0x42e84c=0x0;_0x42e84c<_0x129c58[_0x1a8a('0x92')];_0x42e84c++){_0x24f020[_0x1a8a('0x93')](_0x4a4ae6[_0x1a8a('0x94')][_0x1a8a('0x95')]({'where':{'userProfileId':_0x190802[_0x1a8a('0x96')]['id'],'name':_0x129c58[_0x42e84c][_0x1a8a('0xb')]},'raw':!![]}));}return Promise[_0x1a8a('0x97')](_0x24f020)[_0x1a8a('0x7')](function(_0x118cfe){var _0x1b1193=_[_0x1a8a('0x4')](_0x118cfe,function(_0x5bc1ca){return _0x5bc1ca?_0x5bc1ca:undefined;});var _0x322a87=_[_0x1a8a('0x4')](_0x129c58,[_0x1a8a('0x98'),!![]]);var _0x4001d9=_['isEmpty'](_0x1b1193)&&_[_0x1a8a('0x99')](_0x322a87)?null:_[_0x1a8a('0x9a')](_0x322a87,_0x1b1193);if(!_0x4001d9)return null;var _0x479f44=[];for(var _0x3e4217=0x0;_0x3e4217<_0x4001d9['length'];_0x3e4217++){var _0x135521=_[_0x1a8a('0x95')](_0x129c58,function(_0x1a1ee4){return _0x4001d9[_0x3e4217]?_0x1a1ee4[_0x1a8a('0xb')]===_0x4001d9[_0x3e4217][_0x1a8a('0xb')]:null;});if(_0x135521){if(_0x4001d9[_0x3e4217][_0x1a8a('0x98')]){_0x479f44['push'](_0x1a5af5(_0x2cc1f6[_0x1a8a('0x14')],_0x4001d9[_0x3e4217]));}else{if(!_0x4001d9[_0x3e4217]['autoAssociation']){_0x479f44[_0x1a8a('0x93')](_0x560d86(_0x135521,_0x4001d9[_0x3e4217],_0x2cc1f6[_0x1a8a('0x14')]));}else{if(_0x135521[_0x1a8a('0x9b')]){_0x479f44[_0x1a8a('0x93')](_0x35e160(_0x135521,_0x4001d9[_0x3e4217]));}}}}}return Promise['all'](_0x479f44);})['then'](function(_0x535736){var _0x3f416a=_0x535736;var _0x1f54aa=null;if(_0x3f416a){_0x1f54aa=_0x3f416a['length']===0x1?_0x3f416a[0x0]:null;}if(!_0x1f54aa&&!_0x3f416a)return _0x584113;var _0x2dc41a=_0x4a4ae6[_0x2cc1f6[_0x1a8a('0x14')]]['rawAttributes'];_0x220691[_0x1a8a('0x9b')]=_[_0x1a8a('0x9c')](_0x2dc41a);_0x220691[_0x1a8a('0x8a')]=_['keys'](_0x190802['query']);_0x220691[_0x1a8a('0x9d')]=_[_0x1a8a('0x9e')](_0x220691[_0x1a8a('0x9b')],_0x220691[_0x1a8a('0x8a')]);_0x4ebf86['attributes']=_[_0x1a8a('0x9e')](_0x220691[_0x1a8a('0x9b')],_0xe64aa6[_0x1a8a('0x9f')](_0x190802[_0x1a8a('0x8a')][_0x1a8a('0x9f')]));_0x4ebf86[_0x1a8a('0xa0')]=_0x4ebf86[_0x1a8a('0xa0')][_0x1a8a('0x92')]?_0x4ebf86[_0x1a8a('0xa0')]:_0x220691['model'];if(!_0x190802['query'][_0x1a8a('0xa1')](_0x1a8a('0xa2'))){_0x4ebf86[_0x1a8a('0xa3')]=_0xe64aa6['limit'](_0x190802['query'][_0x1a8a('0xa3')]);_0x4ebf86['offset']=_0xe64aa6[_0x1a8a('0xa4')](_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xa4')]);}_0x4ebf86['order']=_0xe64aa6['sort'](_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xa5')]);_0x4ebf86[_0x1a8a('0xa6')]=_0xe64aa6[_0x1a8a('0x9d')](_[_0x1a8a('0xa7')](_0x190802[_0x1a8a('0x8a')],_0x220691[_0x1a8a('0x9d')]));if(_0x190802[_0x1a8a('0x8a')][_0x1a8a('0x4')]){_0x4ebf86[_0x1a8a('0xa6')]=_['merge'](_0x4ebf86['where'],{'$or':_[_0x1a8a('0x9')](_0x2dc41a,function(_0x1276ad){if(_0x1276ad[_0x1a8a('0x11')][_0x1a8a('0xa8')]!==_0x1a8a('0xa9')){var _0x43673f={};_0x43673f[_0x1276ad['field']]={'$like':'%'+_0x190802['query'][_0x1a8a('0x4')]+'%'};return _0x43673f;}})});}var _0x2cc365=[];var _0x1093c7=null;var _0x5bc60d={};if(_0x1f54aa){_0x1093c7=_['find'](_0x129c58,[_0x1a8a('0xb'),_0x1f54aa[_0x1a8a('0xb')]]);if(_0x1093c7['field']){_0x5bc60d={};if(_0x2cc1f6[_0x1a8a('0x14')]==='AnalyticExtractedReport'){_0x5bc60d[_0x1093c7[_0x1a8a('0xaa')]]=_[_0x1a8a('0x9')](_0x1f54aa[_0x1a8a('0x8')],'id');}else{_0x5bc60d[_0x1093c7[_0x1a8a('0xaa')]]=_0x1f54aa[_0x1a8a('0x8')];}_0x2cc365[_0x1a8a('0x93')](_0x5bc60d);}else{_0x4ebf86[_0x1a8a('0xa6')]['id']=_0x1f54aa['associatedResources'];}}else{for(var _0x5d4a8a=0x0;_0x5d4a8a<_0x3f416a[_0x1a8a('0x92')];_0x5d4a8a++){_0x1093c7=_[_0x1a8a('0x95')](_0x129c58,[_0x1a8a('0xb'),_0x3f416a[_0x5d4a8a][_0x1a8a('0xb')]]);if(_0x1093c7[_0x1a8a('0xa')]){_0x5bc60d={};_0x5bc60d[_0x1093c7[_0x1a8a('0xaa')]]=_0x3f416a[_0x5d4a8a][_0x1a8a('0x8')];_0x2cc365[_0x1a8a('0x93')](_0x5bc60d);}else{if(!_0x4ebf86[_0x1a8a('0xa6')]['id'])_0x4ebf86[_0x1a8a('0xa6')]['id']=[];_0x3f416a[_0x5d4a8a][_0x1a8a('0x8')][_0x1a8a('0xab')](function(_0x1caf4c){_0x4ebf86['where']['id'][_0x1a8a('0x93')](_0x1caf4c);});}}}if(!_['isEmpty'](_0x2cc365)){_0x4ebf86[_0x1a8a('0xa6')]=_[_0x1a8a('0xac')](_0x4ebf86[_0x1a8a('0xa6')],{'$and':{'$or':_0x2cc365}});}_0x4ebf86=_[_0x1a8a('0xac')]({},_0x4ebf86,_0x190802['options']);if(_0x1f54aa&&!_0x1f54aa[_0x1a8a('0xad')]&&_0x2cc1f6[_0x1a8a('0x14')]===_0x1a8a('0xf')){if(_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xae')]){_0x4ebf86[_0x1a8a('0xaf')]=[{'all':!![]}];}return _0x4a4ae6[_0x2cc1f6[_0x1a8a('0x14')]][_0x1a8a('0x6')](_0x4ebf86)[_0x1a8a('0x7')](function(_0xd0f644){var _0x215cd6=[];_0xd0f644[_0x1a8a('0xab')](function(_0xc52a38){var _0x2de1f5;switch(_0xc52a38[_0x1a8a('0xb0')]){case _0x1a8a('0xb1'):_0x2de1f5=_[_0x1a8a('0x95')](_0x1f54aa[_0x1a8a('0x8')],function(_0x663a01){return _0x663a01['id']===_0xc52a38['reportId']&&_0x663a01['type']===_0x1a8a('0xb2');});break;case _0x1a8a('0xb3'):_0x2de1f5=_[_0x1a8a('0x95')](_0x1f54aa[_0x1a8a('0x8')],function(_0x80f780){return _0x80f780['id']===_0xc52a38[_0x1a8a('0xb4')]&&_0x80f780[_0x1a8a('0x11')]==='CustomReports';});break;}if(_0x2de1f5)_0x215cd6[_0x1a8a('0x93')](_0xc52a38);});_0x584113[_0x1a8a('0xb5')]=_0x215cd6['length'];_0x584113[_0x1a8a('0xb6')]=_0x215cd6;return _0x584113;});}else{if(!_[_0x1a8a('0x99')](_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xb7')])){_0x4ebf86['where']['id']=_0x4ebf86[_0x1a8a('0xa6')]['id']?_[_0x1a8a('0x9e')](_0x4ebf86[_0x1a8a('0xa6')]['id'],_0x190802[_0x1a8a('0x8a')]['ids']):_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xb7')];if(_0x190802['query'][_0x1a8a('0xb8')]){_0x4ebf86['order']=_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xb8')];}}if(_0x190802[_0x1a8a('0x8a')]['extraQueryConditions']){_0x4ebf86[_0x1a8a('0xa6')]=_[_0x1a8a('0xac')](_0x4ebf86[_0x1a8a('0xa6')],{'$and':_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xb9')]});}return _0x4a4ae6[_0x2cc1f6['childModel']][_0x1a8a('0xb5')]({'where':_0x4ebf86['where']})[_0x1a8a('0x7')](function(_0x10b0de){_0x584113[_0x1a8a('0xb5')]=_0x10b0de;if(_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xae')]){if(_0x2cc1f6[_0x1a8a('0x14')]===_0x1a8a('0x1d')){_0x4ebf86['include']=[{'model':_0x4a4ae6['Tag'],'as':_0x1a8a('0xba'),'attributes':['id',_0x1a8a('0xb'),_0x1a8a('0xbb')],'required':_0x190802['query'][_0x1a8a('0xbc')]?!![]:![]},{'model':_0x4a4ae6[_0x1a8a('0xbd')],'as':_0x1a8a('0xbe'),'attributes':['id',_0x1a8a('0xb'),_0x1a8a('0xbb')],'through':_0x190802[_0x1a8a('0x8a')]['tag']?{'attributes':[],'where':{'TagId':_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xbc')]||undefined}}:{},'required':_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xbc')]?!![]:![]}];}else{_0x4ebf86[_0x1a8a('0xaf')]=[{'all':!![]}];}}return _0x4a4ae6[_0x2cc1f6[_0x1a8a('0x14')]][_0x1a8a('0x6')](_0x4ebf86);})[_0x1a8a('0x7')](function(_0x4067bb){_0x584113['rows']=_0x4067bb;if(_0x4027d5===_0x1a8a('0x32')&&_0x190802[_0x1a8a('0x8a')][_0x1a8a('0xbf')]===_0x1a8a('0xc0')){var _0x48cfc1=[];for(var _0xc31b2d=0x0;_0xc31b2d<_0x584113['rows'][_0x1a8a('0x92')];_0xc31b2d++){_0x48cfc1[_0x1a8a('0x93')](_0x3c548e(_0x1a8a('0xc1'),_0x584113['rows'][_0xc31b2d]['dataValues']));_0x48cfc1['push'](_0x3c548e('sms',_0x584113[_0x1a8a('0xb6')][_0xc31b2d][_0x1a8a('0xc2')]));_0x48cfc1['push'](_0x3c548e('fax',_0x584113[_0x1a8a('0xb6')][_0xc31b2d][_0x1a8a('0xc2')]));_0x48cfc1[_0x1a8a('0x93')](_0x3c548e(_0x1a8a('0xc3'),_0x584113[_0x1a8a('0xb6')][_0xc31b2d][_0x1a8a('0xc2')]));_0x48cfc1['push'](_0x3c548e(_0x1a8a('0xc4'),_0x584113[_0x1a8a('0xb6')][_0xc31b2d]['dataValues']));_0x48cfc1[_0x1a8a('0x93')](_0x3c548e(_0x1a8a('0xc5'),_0x584113[_0x1a8a('0xb6')][_0xc31b2d][_0x1a8a('0xc2')]));}return Promise['all'](_0x48cfc1)[_0x1a8a('0x7')](function(){return _0x584113;});}return _0x584113;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f4e0a08..8adfde7 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 _0xfb67=['UserProfile,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x29f083,_0x29b559){var _0x53e7b4=function(_0x5e0b39){while(--_0x5e0b39){_0x29f083['push'](_0x29f083['shift']());}};_0x53e7b4(++_0x29b559);}(_0xfb67,0xdd));var _0x7fb6=function(_0x5363e6,_0x45900c){_0x5363e6=_0x5363e6-0x0;var _0x295f23=_0xfb67[_0x5363e6];return _0x295f23;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var moment=require(_0x7fb6('0x2'));var BPromise=require(_0x7fb6('0x3'));var rs=require(_0x7fb6('0x4'));var fs=require('fs');var Redis=require(_0x7fb6('0x5'));var db=require(_0x7fb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fb6('0x7'))(_0x7fb6('0x8'));var config=require(_0x7fb6('0x9'));var jayson=require(_0x7fb6('0xa'));var client=jayson[_0x7fb6('0xb')]['http']({'port':0x232a});config[_0x7fb6('0xc')]=_[_0x7fb6('0xd')](config[_0x7fb6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7fb6('0xe'))(new Redis(config[_0x7fb6('0xc')]));require('./userProfile.socket')[_0x7fb6('0xf')](socket);function respondWithRpcPromise(_0x24beb3,_0x46cd91,_0x55e8a0){return new BPromise(function(_0x25473f,_0x539c7a){return client[_0x7fb6('0x10')](_0x24beb3,_0x55e8a0)[_0x7fb6('0x11')](function(_0x973821){logger[_0x7fb6('0x12')]('UserProfile,\x20%s,\x20%s',_0x46cd91,_0x7fb6('0x13'));logger[_0x7fb6('0x14')](_0x7fb6('0x15'),_0x46cd91,'request\x20sent',JSON['stringify'](_0x973821));if(_0x973821['error']){if(_0x973821['error']['code']===0x1f4){logger['error'](_0x7fb6('0x16'),_0x46cd91,_0x973821[_0x7fb6('0x17')]['message']);return _0x539c7a(_0x973821[_0x7fb6('0x17')][_0x7fb6('0x18')]);}logger[_0x7fb6('0x17')](_0x7fb6('0x16'),_0x46cd91,_0x973821[_0x7fb6('0x17')][_0x7fb6('0x18')]);return _0x25473f(_0x973821[_0x7fb6('0x17')][_0x7fb6('0x18')]);}else{logger[_0x7fb6('0x12')](_0x7fb6('0x16'),_0x46cd91,_0x7fb6('0x13'));_0x25473f(_0x973821[_0x7fb6('0x19')]['message']);}})[_0x7fb6('0x1a')](function(_0x426508){logger[_0x7fb6('0x17')](_0x7fb6('0x16'),_0x46cd91,_0x426508);_0x539c7a(_0x426508);});});} \ No newline at end of file +var _0x78e0=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x28038f,_0x492076){var _0x3b16b8=function(_0x55f30e){while(--_0x55f30e){_0x28038f['push'](_0x28038f['shift']());}};_0x3b16b8(++_0x492076);}(_0x78e0,0x13e));var _0x078e=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0x78e0[_0x34b1b8];return _0x542dd8;};'use strict';var _=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var moment=require(_0x078e('0x2'));var BPromise=require(_0x078e('0x3'));var rs=require(_0x078e('0x4'));var fs=require('fs');var Redis=require(_0x078e('0x5'));var db=require(_0x078e('0x6'))['db'];var utils=require(_0x078e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x078e('0x8'));var jayson=require(_0x078e('0x9'));var client=jayson[_0x078e('0xa')][_0x078e('0xb')]({'port':0x232a});config[_0x078e('0xc')]=_['defaults'](config[_0x078e('0xc')],{'host':_0x078e('0xd'),'port':0x18eb});var socket=require(_0x078e('0xe'))(new Redis(config[_0x078e('0xc')]));require(_0x078e('0xf'))[_0x078e('0x10')](socket);function respondWithRpcPromise(_0x1f6779,_0x507f38,_0x3c144e){return new BPromise(function(_0xb02b76,_0x121aca){return client[_0x078e('0x11')](_0x1f6779,_0x3c144e)[_0x078e('0x12')](function(_0x2cf01b){logger[_0x078e('0x13')](_0x078e('0x14'),_0x507f38,_0x078e('0x15'));logger['debug'](_0x078e('0x16'),_0x507f38,'request\x20sent',JSON['stringify'](_0x2cf01b));if(_0x2cf01b[_0x078e('0x17')]){if(_0x2cf01b['error'][_0x078e('0x18')]===0x1f4){logger[_0x078e('0x17')](_0x078e('0x14'),_0x507f38,_0x2cf01b[_0x078e('0x17')][_0x078e('0x19')]);return _0x121aca(_0x2cf01b[_0x078e('0x17')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x507f38,_0x2cf01b[_0x078e('0x17')][_0x078e('0x19')]);return _0xb02b76(_0x2cf01b['error'][_0x078e('0x19')]);}else{logger[_0x078e('0x13')](_0x078e('0x14'),_0x507f38,_0x078e('0x15'));_0xb02b76(_0x2cf01b[_0x078e('0x1a')][_0x078e('0x19')]);}})[_0x078e('0x1b')](function(_0x2900e3){logger[_0x078e('0x17')](_0x078e('0x14'),_0x507f38,_0x2900e3);_0x121aca(_0x2900e3);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e0f3059..3ba1225 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 _0x631e=['save','update','emit','removeListener','register','length','userProfile:'];(function(_0x462d50,_0x37f1e9){var _0x290b53=function(_0x132abf){while(--_0x132abf){_0x462d50['push'](_0x462d50['shift']());}};_0x290b53(++_0x37f1e9);}(_0x631e,0x1ea));var _0xe631=function(_0x2c563f,_0x5c9177){_0x2c563f=_0x2c563f-0x0;var _0x2c0660=_0x631e[_0x2c563f];return _0x2c0660;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xe631('0x0'),'remove',_0xe631('0x1')];function createListener(_0x2042ef,_0x3f6750){return function(_0x203bbf){_0x3f6750[_0xe631('0x2')](_0x2042ef,_0x203bbf);};}function removeListener(_0x2a1700,_0x394ca8){return function(){UserProfileEvents[_0xe631('0x3')](_0x2a1700,_0x394ca8);};}exports[_0xe631('0x4')]=function(_0x3c7609){for(var _0x677c34=0x0,_0x15af2c=events[_0xe631('0x5')];_0x677c34<_0x15af2c;_0x677c34++){var _0xca7d48=events[_0x677c34];var _0x31d7cf=createListener(_0xe631('0x6')+_0xca7d48,_0x3c7609);UserProfileEvents['on'](_0xca7d48,_0x31d7cf);}}; \ No newline at end of file +var _0xc860=['update','removeListener','length','userProfile:','./userProfile.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc860,0xd1));var _0x0c86=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xc860[_0x4154a6];return _0x3b2786;};'use strict';var UserProfileEvents=require(_0x0c86('0x0'));var events=['save','remove',_0x0c86('0x1')];function createListener(_0x5776cb,_0x2ede7c){return function(_0x30ee19){_0x2ede7c['emit'](_0x5776cb,_0x30ee19);};}function removeListener(_0x2903a2,_0x1fa8b6){return function(){UserProfileEvents[_0x0c86('0x2')](_0x2903a2,_0x1fa8b6);};}exports['register']=function(_0x15e05a){for(var _0x10b95d=0x0,_0x4114cc=events[_0x0c86('0x3')];_0x10b95d<_0x4114cc;_0x10b95d++){var _0x5b8973=events[_0x10b95d];var _0x79c98b=createListener(_0x0c86('0x4')+_0x5b8973,_0x15e05a);UserProfileEvents['on'](_0x5b8973,_0x79c98b);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 47dd2f0..137ca4a 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 _0xdedd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe','show','create','/:id','destroy','multer','util','path'];(function(_0xaf680f,_0x5140c7){var _0x4cd190=function(_0x25d64f){while(--_0x25d64f){_0xaf680f['push'](_0xaf680f['shift']());}};_0x4cd190(++_0x5140c7);}(_0xdedd,0x141));var _0xdded=function(_0x4e036a,_0x166d77){_0x4e036a=_0x4e036a-0x0;var _0x419833=_0xdedd[_0x4e036a];return _0x419833;};'use strict';var multer=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var path=require(_0xdded('0x2'));var timeout=require(_0xdded('0x3'));var express=require(_0xdded('0x4'));var router=express[_0xdded('0x5')]();var fs_extra=require(_0xdded('0x6'));var auth=require(_0xdded('0x7'));var interaction=require(_0xdded('0x8'));var config=require(_0xdded('0x9'));var controller=require(_0xdded('0xa'));router['get']('/',auth[_0xdded('0xb')](),controller['index']);router[_0xdded('0xc')](_0xdded('0xd'),auth[_0xdded('0xb')](),controller['describe']);router[_0xdded('0xc')]('/:id',auth[_0xdded('0xb')](),controller[_0xdded('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdded('0xf')]);router['put']('/:id',auth[_0xdded('0xb')](),controller['update']);router['delete'](_0xdded('0x10'),auth['isAuthenticated'](),controller[_0xdded('0x11')]);module['exports']=router; \ No newline at end of file +var _0x128f=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update'];(function(_0x1dad4f,_0x13b837){var _0x22468b=function(_0x218601){while(--_0x218601){_0x1dad4f['push'](_0x1dad4f['shift']());}};_0x22468b(++_0x13b837);}(_0x128f,0xff));var _0xf128=function(_0x31e48b,_0x230c22){_0x31e48b=_0x31e48b-0x0;var _0x38ee1e=_0x128f[_0x31e48b];return _0x38ee1e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf128('0x0'));var timeout=require(_0xf128('0x1'));var express=require(_0xf128('0x2'));var router=express[_0xf128('0x3')]();var fs_extra=require(_0xf128('0x4'));var auth=require(_0xf128('0x5'));var interaction=require(_0xf128('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xf128('0x7')]('/',auth[_0xf128('0x8')](),controller[_0xf128('0x9')]);router[_0xf128('0x7')](_0xf128('0xa'),auth[_0xf128('0x8')](),controller[_0xf128('0xb')]);router[_0xf128('0x7')]('/:id',auth[_0xf128('0x8')](),controller[_0xf128('0xc')]);router[_0xf128('0xd')]('/',auth[_0xf128('0x8')](),controller[_0xf128('0xe')]);router[_0xf128('0xf')](_0xf128('0x10'),auth[_0xf128('0x8')](),controller[_0xf128('0x11')]);router[_0xf128('0x12')](_0xf128('0x10'),auth[_0xf128('0x8')](),controller[_0xf128('0x13')]);module[_0xf128('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6fa25f6..594b486 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 _0x91f0=['sequelize','STRING'];(function(_0x409cc5,_0x1979af){var _0x175a59=function(_0x2a6a7c){while(--_0x2a6a7c){_0x409cc5['push'](_0x409cc5['shift']());}};_0x175a59(++_0x1979af);}(_0x91f0,0x1b8));var _0x091f=function(_0x1e5619,_0x52d213){_0x1e5619=_0x1e5619-0x0;var _0x6c18c=_0x91f0[_0x1e5619];return _0x6c18c;};'use strict';var Sequelize=require(_0x091f('0x0'));module['exports']={'name':{'type':Sequelize[_0x091f('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc92a=['INTEGER','STRING','exports'];(function(_0x15adc6,_0xbc8322){var _0x3bb841=function(_0x16945d){while(--_0x16945d){_0x15adc6['push'](_0x15adc6['shift']());}};_0x3bb841(++_0xbc8322);}(_0xc92a,0x101));var _0xac92=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc92a[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xac92('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xac92('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xac92('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 2f29b1c..5a56cfe 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 _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x1cb455,_0x183114){var _0x5f1d53=function(_0x5e2c11){while(--_0x5e2c11){_0x1cb455['push'](_0x1cb455['shift']());}};_0x5f1d53(++_0x183114);}(_0x0295,0x1f0));var _0x5029=function(_0x1aef65,_0x521e60){_0x1aef65=_0x1aef65-0x0;var _0x4a4594=_0x0295[_0x1aef65];return _0x4a4594;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x2fbfe8,_0x2acad1){var _0x7298da=function(_0xd96a5b){while(--_0xd96a5b){_0x2fbfe8['push'](_0x2fbfe8['shift']());}};_0x7298da(++_0x2acad1);}(_0x0295,0x1f0));var _0x5029=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x0295[_0x359bbe];return _0x1b3353;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1e3899e..b5c434a 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 _0xe81a=['resourceId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x2908cf,_0x1f9bb1){var _0x4e6bd8=function(_0x367132){while(--_0x367132){_0x2908cf['push'](_0x2908cf['shift']());}};_0x4e6bd8(++_0x1f9bb1);}(_0xe81a,0xb1));var _0xae81=function(_0x210a9e,_0x5c1a84){_0x210a9e=_0x210a9e-0x0;var _0x330ada=_0xe81a[_0x210a9e];return _0x330ada;};'use strict';var _=require(_0xae81('0x0'));var util=require(_0xae81('0x1'));var logger=require(_0xae81('0x2'))(_0xae81('0x3'));var moment=require(_0xae81('0x4'));var BPromise=require(_0xae81('0x5'));var rp=require(_0xae81('0x6'));var fs=require('fs');var path=require(_0xae81('0x7'));var rimraf=require(_0xae81('0x8'));var config=require(_0xae81('0x9'));var attributes=require(_0xae81('0xa'));module[_0xae81('0xb')]=function(_0x8aa748,_0x97ac29){return _0x8aa748['define'](_0xae81('0xc'),attributes,{'tableName':_0xae81('0xd'),'paranoid':![],'indexes':[{'name':_0xae81('0xe'),'fields':[_0xae81('0xf'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x935c=['compositeIndex','resourceId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0x935c,0x147));var _0xc935=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x935c[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc935('0x0'))('api');var moment=require(_0xc935('0x1'));var BPromise=require(_0xc935('0x2'));var rp=require(_0xc935('0x3'));var fs=require('fs');var path=require(_0xc935('0x4'));var rimraf=require(_0xc935('0x5'));var config=require(_0xc935('0x6'));var attributes=require(_0xc935('0x7'));module[_0xc935('0x8')]=function(_0x24e9ef,_0x54bde3){return _0x24e9ef['define'](_0xc935('0x9'),attributes,{'tableName':_0xc935('0xa'),'paranoid':![],'indexes':[{'name':_0xc935('0xb'),'fields':[_0xc935('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 87becd3..7900a27 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 _0xa1ab=['http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x365cee,_0x77e7bf){var _0x981331=function(_0x1052df){while(--_0x1052df){_0x365cee['push'](_0x365cee['shift']());}};_0x981331(++_0x77e7bf);}(_0xa1ab,0x1ab));var _0xba1a=function(_0x3178ad,_0x2c6d79){_0x3178ad=_0x3178ad-0x0;var _0x19e055=_0xa1ab[_0x3178ad];return _0x19e055;};'use strict';var _=require('lodash');var util=require(_0xba1a('0x0'));var moment=require(_0xba1a('0x1'));var BPromise=require('bluebird');var rs=require(_0xba1a('0x2'));var fs=require('fs');var Redis=require(_0xba1a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xba1a('0x4'));var logger=require(_0xba1a('0x5'))(_0xba1a('0x6'));var config=require(_0xba1a('0x7'));var jayson=require(_0xba1a('0x8'));var client=jayson[_0xba1a('0x9')][_0xba1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1897fd,_0x4ccdfd,_0x21aaa3){return new BPromise(function(_0x2511f2,_0x184696){return client[_0xba1a('0xb')](_0x1897fd,_0x21aaa3)[_0xba1a('0xc')](function(_0x12d635){logger['info'](_0xba1a('0xd'),_0x4ccdfd,_0xba1a('0xe'));logger[_0xba1a('0xf')](_0xba1a('0x10'),_0x4ccdfd,_0xba1a('0xe'),JSON['stringify'](_0x12d635));if(_0x12d635[_0xba1a('0x11')]){if(_0x12d635['error'][_0xba1a('0x12')]===0x1f4){logger[_0xba1a('0x11')](_0xba1a('0xd'),_0x4ccdfd,_0x12d635[_0xba1a('0x11')][_0xba1a('0x13')]);return _0x184696(_0x12d635['error'][_0xba1a('0x13')]);}logger[_0xba1a('0x11')](_0xba1a('0xd'),_0x4ccdfd,_0x12d635[_0xba1a('0x11')][_0xba1a('0x13')]);return _0x2511f2(_0x12d635['error'][_0xba1a('0x13')]);}else{logger[_0xba1a('0x14')](_0xba1a('0xd'),_0x4ccdfd,_0xba1a('0xe'));_0x2511f2(_0x12d635[_0xba1a('0x15')]['message']);}})[_0xba1a('0x16')](function(_0x503828){logger['error'](_0xba1a('0xd'),_0x4ccdfd,_0x503828);_0x184696(_0x503828);});});} \ No newline at end of file +var _0x2e5b=['client','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','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x2e5b,0xc4));var _0xb2e5=function(_0x4c0b2a,_0x4a1f3f){_0x4c0b2a=_0x4c0b2a-0x0;var _0x51bf05=_0x2e5b[_0x4c0b2a];return _0x51bf05;};'use strict';var _=require(_0xb2e5('0x0'));var util=require(_0xb2e5('0x1'));var moment=require(_0xb2e5('0x2'));var BPromise=require(_0xb2e5('0x3'));var rs=require(_0xb2e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2e5('0x5'))['db'];var utils=require(_0xb2e5('0x6'));var logger=require(_0xb2e5('0x7'))(_0xb2e5('0x8'));var config=require(_0xb2e5('0x9'));var jayson=require(_0xb2e5('0xa'));var client=jayson[_0xb2e5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8c1b7,_0x7c5db1,_0x50b3d9){return new BPromise(function(_0x421bea,_0x4b1f7a){return client['request'](_0x8c1b7,_0x50b3d9)[_0xb2e5('0xc')](function(_0x2a5e0c){logger[_0xb2e5('0xd')](_0xb2e5('0xe'),_0x7c5db1,_0xb2e5('0xf'));logger[_0xb2e5('0x10')](_0xb2e5('0x11'),_0x7c5db1,'request\x20sent',JSON[_0xb2e5('0x12')](_0x2a5e0c));if(_0x2a5e0c['error']){if(_0x2a5e0c[_0xb2e5('0x13')][_0xb2e5('0x14')]===0x1f4){logger[_0xb2e5('0x13')](_0xb2e5('0xe'),_0x7c5db1,_0x2a5e0c[_0xb2e5('0x13')]['message']);return _0x4b1f7a(_0x2a5e0c[_0xb2e5('0x13')][_0xb2e5('0x15')]);}logger[_0xb2e5('0x13')](_0xb2e5('0xe'),_0x7c5db1,_0x2a5e0c['error']['message']);return _0x421bea(_0x2a5e0c[_0xb2e5('0x13')]['message']);}else{logger['info'](_0xb2e5('0xe'),_0x7c5db1,'request\x20sent');_0x421bea(_0x2a5e0c['result']['message']);}})[_0xb2e5('0x16')](function(_0x42e634){logger[_0xb2e5('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x7c5db1,_0x42e634);_0x4b1f7a(_0x42e634);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index af93593..ff98ce7 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 _0x5e98=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','describe','show','post','create','put','update','exports','multer','util','path'];(function(_0x19cd2a,_0x52bf9e){var _0x41f8b7=function(_0x132d14){while(--_0x132d14){_0x19cd2a['push'](_0x19cd2a['shift']());}};_0x41f8b7(++_0x52bf9e);}(_0x5e98,0x12d));var _0x85e9=function(_0x31164d,_0x1d472c){_0x31164d=_0x31164d-0x0;var _0x4093dd=_0x5e98[_0x31164d];return _0x4093dd;};'use strict';var multer=require(_0x85e9('0x0'));var util=require(_0x85e9('0x1'));var path=require(_0x85e9('0x2'));var timeout=require(_0x85e9('0x3'));var express=require(_0x85e9('0x4'));var router=express['Router']();var fs_extra=require(_0x85e9('0x5'));var auth=require(_0x85e9('0x6'));var interaction=require(_0x85e9('0x7'));var config=require(_0x85e9('0x8'));var controller=require(_0x85e9('0x9'));router[_0x85e9('0xa')]('/',auth[_0x85e9('0xb')](),controller['index']);router['get']('/describe',auth[_0x85e9('0xb')](),controller[_0x85e9('0xc')]);router[_0x85e9('0xa')]('/:id',auth[_0x85e9('0xb')](),controller[_0x85e9('0xd')]);router[_0x85e9('0xe')]('/',auth[_0x85e9('0xb')](),controller[_0x85e9('0xf')]);router[_0x85e9('0x10')]('/:id',auth[_0x85e9('0xb')](),controller[_0x85e9('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x85e9('0x12')]=router; \ No newline at end of file +var _0xe7c5=['multer','util','path','express','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','post','create','update','destroy','exports'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0xe7c5,0x1e0));var _0x5e7c=function(_0x365113,_0x4b58e2){_0x365113=_0x365113-0x0;var _0x5f1450=_0xe7c5[_0x365113];return _0x5f1450;};'use strict';var multer=require(_0x5e7c('0x0'));var util=require(_0x5e7c('0x1'));var path=require(_0x5e7c('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e7c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e7c('0x4'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x5e7c('0x5')](),controller[_0x5e7c('0x6')]);router['get'](_0x5e7c('0x7'),auth[_0x5e7c('0x5')](),controller[_0x5e7c('0x8')]);router[_0x5e7c('0x9')](_0x5e7c('0xa'),auth[_0x5e7c('0x5')](),controller['show']);router[_0x5e7c('0xb')]('/',auth['isAuthenticated'](),controller[_0x5e7c('0xc')]);router['put'](_0x5e7c('0xa'),auth['isAuthenticated'](),controller[_0x5e7c('0xd')]);router['delete'](_0x5e7c('0xa'),auth['isAuthenticated'](),controller[_0x5e7c('0xe')]);module[_0x5e7c('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 8c65e7a..41510ce 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 _0xd7d1=['setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x47ca5a,_0x5c6798){_0x47ca5a=_0x47ca5a-0x0;var _0x4c8724=_0xd7d1[_0x47ca5a];return _0x4c8724;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x1d7d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x1d7d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x1d7d('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x1d7d('0x2')],'set':function(_0x1ac097){this[_0x1d7d('0x5')](_0x1d7d('0x6'),_0x1ac097?_0x1ac097[_0x1d7d('0x7')](''):[]);},'get':function(){return this[_0x1d7d('0x8')]('crudPermissions')?this[_0x1d7d('0x8')](_0x1d7d('0x6'))[_0x1d7d('0x9')](''):[];}}}; \ No newline at end of file +var _0xe820=['sequelize','STRING','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x5c8670,_0x434528){var _0x5bfe9f=function(_0x35c390){while(--_0x35c390){_0x5c8670['push'](_0x5c8670['shift']());}};_0x5bfe9f(++_0x434528);}(_0xe820,0xd2));var _0x0e82=function(_0x1ceeac,_0x464130){_0x1ceeac=_0x1ceeac-0x0;var _0x4d2b57=_0xe820[_0x1ceeac];return _0x4d2b57;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e82('0x1')],'set':function(_0x59b28d){this[_0x0e82('0x3')]('crudPermissions',_0x59b28d?_0x59b28d[_0x0e82('0x4')](''):[]);},'get':function(){return this[_0x0e82('0x5')](_0x0e82('0x6'))?this[_0x0e82('0x5')](_0x0e82('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1ef1774..8f70a7f 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 _0x0aec=['params','destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','offset','undefined','limit','count','set','json','save','update','then','end','error','name','send','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','UserProfileSection','findAll','show','includeAll','find','catch','create','body'];(function(_0x33fb23,_0x1084e2){var _0x1550a5=function(_0x5080d7){while(--_0x5080d7){_0x33fb23['push'](_0x33fb23['shift']());}};_0x1550a5(++_0x1084e2);}(_0x0aec,0x16b));var _0xc0ae=function(_0xffdec4,_0x322bec){_0xffdec4=_0xffdec4-0x0;var _0x479138=_0x0aec[_0xffdec4];return _0x479138;};'use strict';var emlformat=require(_0xc0ae('0x0'));var rimraf=require(_0xc0ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc0ae('0x2'));var moment=require('moment');var BPromise=require(_0xc0ae('0x3'));var Mustache=require(_0xc0ae('0x4'));var util=require(_0xc0ae('0x5'));var path=require(_0xc0ae('0x6'));var sox=require(_0xc0ae('0x7'));var csv=require(_0xc0ae('0x8'));var ejs=require(_0xc0ae('0x9'));var fs=require('fs');var fs_extra=require(_0xc0ae('0xa'));var _=require(_0xc0ae('0xb'));var squel=require(_0xc0ae('0xc'));var crypto=require(_0xc0ae('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc0ae('0xe'));var toCsv=require(_0xc0ae('0x8'));var querystring=require(_0xc0ae('0xf'));var Papa=require(_0xc0ae('0x10'));var Redis=require(_0xc0ae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0ae('0x12'));var as=require(_0xc0ae('0x13'));var hardwareService=require(_0xc0ae('0x14'));var logger=require(_0xc0ae('0x15'))(_0xc0ae('0x16'));var utils=require(_0xc0ae('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc0ae('0x18'));var db=require(_0xc0ae('0x19'))['db'];function respondWithStatusCode(_0x1211ad,_0x2c3f2b){_0x2c3f2b=_0x2c3f2b||0xcc;return function(_0x48cf40){if(_0x48cf40){return _0x1211ad[_0xc0ae('0x1a')](_0x2c3f2b);}return _0x1211ad[_0xc0ae('0x1b')](_0x2c3f2b)['end']();};}function respondWithResult(_0x4e9835,_0x2ac41c){_0x2ac41c=_0x2ac41c||0xc8;return function(_0xfae23f){if(_0xfae23f){return _0x4e9835[_0xc0ae('0x1b')](_0x2ac41c)['json'](_0xfae23f);}};}function respondWithFilteredResult(_0x34667b,_0x3b090f){return function(_0x437430){if(_0x437430){var _0x1c136f=typeof _0x3b090f[_0xc0ae('0x1c')]===_0xc0ae('0x1d')&&typeof _0x3b090f[_0xc0ae('0x1e')]===_0xc0ae('0x1d');var _0x3ddbfb=_0x437430[_0xc0ae('0x1f')];var _0x4dc9bd=_0x1c136f?0x0:_0x3b090f[_0xc0ae('0x1c')];var _0x1ad9e2=_0x1c136f?_0x437430['count']:_0x3b090f['offset']+_0x3b090f['limit'];var _0x35b97a;if(_0x1ad9e2>=_0x3ddbfb){_0x1ad9e2=_0x3ddbfb;_0x35b97a=0xc8;}else{_0x35b97a=0xce;}_0x34667b[_0xc0ae('0x1b')](_0x35b97a);return _0x34667b[_0xc0ae('0x20')]('Content-Range',_0x4dc9bd+'-'+_0x1ad9e2+'/'+_0x3ddbfb)[_0xc0ae('0x21')](_0x437430);}return null;};}function patchUpdates(_0x4c0fc2){return function(_0x13284a){try{jsonpatch['apply'](_0x13284a,_0x4c0fc2,!![]);}catch(_0x30b8ef){return BPromise['reject'](_0x30b8ef);}return _0x13284a[_0xc0ae('0x22')]();};}function saveUpdates(_0x33607f,_0x114089){return function(_0x348188){if(_0x348188){return _0x348188[_0xc0ae('0x23')](_0x33607f)[_0xc0ae('0x24')](function(_0x5d4bf3){return _0x5d4bf3;});}return null;};}function removeEntity(_0x49bc42,_0x11f62e){return function(_0x195639){if(_0x195639){return _0x195639['destroy']()[_0xc0ae('0x24')](function(){_0x49bc42['status'](0xcc)[_0xc0ae('0x25')]();});}};}function handleEntityNotFound(_0x7abf75,_0x73dca7){return function(_0x490e3c){if(!_0x490e3c){_0x7abf75[_0xc0ae('0x1a')](0x194);}return _0x490e3c;};}function handleError(_0x5d558f,_0x2eb3d8){_0x2eb3d8=_0x2eb3d8||0x1f4;return function(_0x41a642){logger[_0xc0ae('0x26')](_0x41a642['stack']);if(_0x41a642['name']){delete _0x41a642[_0xc0ae('0x27')];}_0x5d558f[_0xc0ae('0x1b')](_0x2eb3d8)[_0xc0ae('0x28')](_0x41a642);};}exports['index']=function(_0x2cfc63,_0x57d321){var _0xf63968={},_0x29e68f={},_0x59c5e3={'count':0x0,'rows':[]};var _0x2566b6=_[_0xc0ae('0x29')](db['UserProfileSection']['rawAttributes'],function(_0x523f28){return{'name':_0x523f28[_0xc0ae('0x2a')],'type':_0x523f28['type'][_0xc0ae('0x2b')]};});_0x29e68f[_0xc0ae('0x2c')]=_['map'](_0x2566b6,_0xc0ae('0x27'));_0x29e68f[_0xc0ae('0x2d')]=_['keys'](_0x2cfc63['query']);_0x29e68f[_0xc0ae('0x2e')]=_[_0xc0ae('0x2f')](_0x29e68f[_0xc0ae('0x2c')],_0x29e68f['query']);_0xf63968[_0xc0ae('0x30')]=_[_0xc0ae('0x2f')](_0x29e68f[_0xc0ae('0x2c')],qs[_0xc0ae('0x31')](_0x2cfc63[_0xc0ae('0x2d')][_0xc0ae('0x31')]));_0xf63968[_0xc0ae('0x30')]=_0xf63968['attributes'][_0xc0ae('0x32')]?_0xf63968['attributes']:_0x29e68f['model'];if(!_0x2cfc63[_0xc0ae('0x2d')][_0xc0ae('0x33')](_0xc0ae('0x34'))){_0xf63968[_0xc0ae('0x1e')]=qs[_0xc0ae('0x1e')](_0x2cfc63['query']['limit']);_0xf63968[_0xc0ae('0x1c')]=qs[_0xc0ae('0x1c')](_0x2cfc63[_0xc0ae('0x2d')]['offset']);}_0xf63968[_0xc0ae('0x35')]=qs[_0xc0ae('0x36')](_0x2cfc63[_0xc0ae('0x2d')][_0xc0ae('0x36')]);_0xf63968[_0xc0ae('0x37')]=qs['filters'](_[_0xc0ae('0x38')](_0x2cfc63['query'],_0x29e68f[_0xc0ae('0x2e')]),_0x2566b6);if(_0x2cfc63[_0xc0ae('0x2d')]['filter']){_0xf63968[_0xc0ae('0x37')]=_['merge'](_0xf63968[_0xc0ae('0x37')],{'$or':_[_0xc0ae('0x29')](_0x2566b6,function(_0x4b2dab){if(_0x4b2dab[_0xc0ae('0x39')]!=='VIRTUAL'){var _0x4ecbf3={};_0x4ecbf3[_0x4b2dab[_0xc0ae('0x27')]]={'$like':'%'+_0x2cfc63[_0xc0ae('0x2d')][_0xc0ae('0x3a')]+'%'};return _0x4ecbf3;}})});}_0xf63968=_['merge']({},_0xf63968,_0x2cfc63[_0xc0ae('0x3b')]);var _0x2737d0={'where':_0xf63968[_0xc0ae('0x37')]};return db['UserProfileSection'][_0xc0ae('0x1f')](_0x2737d0)[_0xc0ae('0x24')](function(_0x202b95){_0x59c5e3['count']=_0x202b95;if(_0x2cfc63[_0xc0ae('0x2d')]['includeAll']){_0xf63968[_0xc0ae('0x3c')]=[{'all':!![]}];}return db[_0xc0ae('0x3d')][_0xc0ae('0x3e')](_0xf63968);})[_0xc0ae('0x24')](function(_0x2729c9){_0x59c5e3['rows']=_0x2729c9;return _0x59c5e3;})[_0xc0ae('0x24')](respondWithFilteredResult(_0x57d321,_0xf63968))['catch'](handleError(_0x57d321,null));};exports[_0xc0ae('0x3f')]=function(_0x20ca26,_0x2a98dd){var _0x195530={'raw':![],'where':{'id':_0x20ca26['params']['id']}},_0x5cc933={};_0x5cc933['model']=_['keys'](db[_0xc0ae('0x3d')]['rawAttributes']);_0x5cc933[_0xc0ae('0x2d')]=_['keys'](_0x20ca26[_0xc0ae('0x2d')]);_0x5cc933[_0xc0ae('0x2e')]=_[_0xc0ae('0x2f')](_0x5cc933['model'],_0x5cc933[_0xc0ae('0x2d')]);_0x195530[_0xc0ae('0x30')]=_[_0xc0ae('0x2f')](_0x5cc933['model'],qs[_0xc0ae('0x31')](_0x20ca26[_0xc0ae('0x2d')][_0xc0ae('0x31')]));_0x195530[_0xc0ae('0x30')]=_0x195530[_0xc0ae('0x30')][_0xc0ae('0x32')]?_0x195530[_0xc0ae('0x30')]:_0x5cc933[_0xc0ae('0x2c')];if(_0x20ca26[_0xc0ae('0x2d')][_0xc0ae('0x40')]){_0x195530[_0xc0ae('0x3c')]=[{'all':!![]}];}_0x195530=_['merge']({},_0x195530,_0x20ca26[_0xc0ae('0x3b')]);return db[_0xc0ae('0x3d')][_0xc0ae('0x41')](_0x195530)['then'](handleEntityNotFound(_0x2a98dd,null))[_0xc0ae('0x24')](respondWithResult(_0x2a98dd,null))[_0xc0ae('0x42')](handleError(_0x2a98dd,null));};exports[_0xc0ae('0x43')]=function(_0x21aaa9,_0x5870b2){return db[_0xc0ae('0x3d')]['create'](_0x21aaa9[_0xc0ae('0x44')],{})['then'](respondWithResult(_0x5870b2,0xc9))[_0xc0ae('0x42')](handleError(_0x5870b2,null));};exports[_0xc0ae('0x23')]=function(_0x5445e4,_0x4d67c8){if(_0x5445e4[_0xc0ae('0x44')]['id']){delete _0x5445e4[_0xc0ae('0x44')]['id'];}return db[_0xc0ae('0x3d')][_0xc0ae('0x41')]({'where':{'id':_0x5445e4[_0xc0ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d67c8,null))[_0xc0ae('0x24')](saveUpdates(_0x5445e4[_0xc0ae('0x44')],null))[_0xc0ae('0x24')](respondWithResult(_0x4d67c8,null))['catch'](handleError(_0x4d67c8,null));};exports[_0xc0ae('0x46')]=function(_0x2f02db,_0x3cf868){return db[_0xc0ae('0x3d')][_0xc0ae('0x41')]({'where':{'id':_0x2f02db['params']['id']}})[_0xc0ae('0x24')](handleEntityNotFound(_0x3cf868,null))['then'](removeEntity(_0x3cf868,null))[_0xc0ae('0x42')](handleError(_0x3cf868,null));};exports['describe']=function(_0x1288f5,_0x563b1b){return db[_0xc0ae('0x3d')][_0xc0ae('0x47')]()[_0xc0ae('0x24')](respondWithResult(_0x563b1b,null))[_0xc0ae('0x42')](handleError(_0x563b1b,null));}; \ No newline at end of file +var _0x0606=['merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','VIRTUAL','filter'];(function(_0x23e4cf,_0x12704d){var _0x2bd35a=function(_0xaa827a){while(--_0xaa827a){_0x23e4cf['push'](_0x23e4cf['shift']());}};_0x2bd35a(++_0x12704d);}(_0x0606,0x132));var _0x6060=function(_0x101fdf,_0x3ac78a){_0x101fdf=_0x101fdf-0x0;var _0xe63f2a=_0x0606[_0x101fdf];return _0xe63f2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6060('0x0'));var zipdir=require(_0x6060('0x1'));var jsonpatch=require(_0x6060('0x2'));var rp=require('request-promise');var moment=require(_0x6060('0x3'));var BPromise=require(_0x6060('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6060('0x5'));var sox=require(_0x6060('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6060('0x7'));var _=require(_0x6060('0x8'));var squel=require('squel');var crypto=require(_0x6060('0x9'));var jsforce=require(_0x6060('0xa'));var deskjs=require(_0x6060('0xb'));var toCsv=require(_0x6060('0xc'));var querystring=require(_0x6060('0xd'));var Papa=require(_0x6060('0xe'));var Redis=require(_0x6060('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6060('0x10'));var as=require(_0x6060('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6060('0x12'));var utils=require(_0x6060('0x13'));var config=require(_0x6060('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2260fb,_0x1cabf1){_0x1cabf1=_0x1cabf1||0xcc;return function(_0x33142b){if(_0x33142b){return _0x2260fb[_0x6060('0x15')](_0x1cabf1);}return _0x2260fb[_0x6060('0x16')](_0x1cabf1)[_0x6060('0x17')]();};}function respondWithResult(_0x88f5ec,_0x10debd){_0x10debd=_0x10debd||0xc8;return function(_0x1a0fd){if(_0x1a0fd){return _0x88f5ec['status'](_0x10debd)[_0x6060('0x18')](_0x1a0fd);}};}function respondWithFilteredResult(_0x5bd9fa,_0x1f0b35){return function(_0x3f6253){if(_0x3f6253){var _0x2ae434=typeof _0x1f0b35[_0x6060('0x19')]===_0x6060('0x1a')&&typeof _0x1f0b35['limit']==='undefined';var _0x326b6c=_0x3f6253[_0x6060('0x1b')];var _0x5d92ac=_0x2ae434?0x0:_0x1f0b35[_0x6060('0x19')];var _0xe49d07=_0x2ae434?_0x3f6253['count']:_0x1f0b35[_0x6060('0x19')]+_0x1f0b35[_0x6060('0x1c')];var _0x4e0ffc;if(_0xe49d07>=_0x326b6c){_0xe49d07=_0x326b6c;_0x4e0ffc=0xc8;}else{_0x4e0ffc=0xce;}_0x5bd9fa[_0x6060('0x16')](_0x4e0ffc);return _0x5bd9fa[_0x6060('0x1d')](_0x6060('0x1e'),_0x5d92ac+'-'+_0xe49d07+'/'+_0x326b6c)[_0x6060('0x18')](_0x3f6253);}return null;};}function patchUpdates(_0x5482c0){return function(_0x1e07ca){try{jsonpatch[_0x6060('0x1f')](_0x1e07ca,_0x5482c0,!![]);}catch(_0x3732d6){return BPromise[_0x6060('0x20')](_0x3732d6);}return _0x1e07ca[_0x6060('0x21')]();};}function saveUpdates(_0x140107,_0x151423){return function(_0x36120e){if(_0x36120e){return _0x36120e['update'](_0x140107)['then'](function(_0xfcaf8b){return _0xfcaf8b;});}return null;};}function removeEntity(_0x11461d,_0x1d6a08){return function(_0x56a8ef){if(_0x56a8ef){return _0x56a8ef[_0x6060('0x22')]()[_0x6060('0x23')](function(){_0x11461d[_0x6060('0x16')](0xcc)[_0x6060('0x17')]();});}};}function handleEntityNotFound(_0x772b87,_0x63dbdd){return function(_0x206267){if(!_0x206267){_0x772b87['sendStatus'](0x194);}return _0x206267;};}function handleError(_0x50ccbd,_0xad4c85){_0xad4c85=_0xad4c85||0x1f4;return function(_0xb95aa4){logger['error'](_0xb95aa4[_0x6060('0x24')]);if(_0xb95aa4[_0x6060('0x25')]){delete _0xb95aa4[_0x6060('0x25')];}_0x50ccbd['status'](_0xad4c85)[_0x6060('0x26')](_0xb95aa4);};}exports[_0x6060('0x27')]=function(_0xabea02,_0x329f77){var _0x369e4a={},_0x23780d={},_0x59b6e8={'count':0x0,'rows':[]};var _0x5a54ae=_[_0x6060('0x28')](db[_0x6060('0x29')][_0x6060('0x2a')],function(_0x91905b){return{'name':_0x91905b[_0x6060('0x2b')],'type':_0x91905b['type'][_0x6060('0x2c')]};});_0x23780d[_0x6060('0x2d')]=_[_0x6060('0x28')](_0x5a54ae,_0x6060('0x25'));_0x23780d[_0x6060('0x2e')]=_[_0x6060('0x2f')](_0xabea02[_0x6060('0x2e')]);_0x23780d[_0x6060('0x30')]=_['intersection'](_0x23780d['model'],_0x23780d['query']);_0x369e4a[_0x6060('0x31')]=_[_0x6060('0x32')](_0x23780d['model'],qs[_0x6060('0x33')](_0xabea02['query'][_0x6060('0x33')]));_0x369e4a[_0x6060('0x31')]=_0x369e4a[_0x6060('0x31')][_0x6060('0x34')]?_0x369e4a[_0x6060('0x31')]:_0x23780d[_0x6060('0x2d')];if(!_0xabea02['query']['hasOwnProperty'](_0x6060('0x35'))){_0x369e4a['limit']=qs[_0x6060('0x1c')](_0xabea02['query'][_0x6060('0x1c')]);_0x369e4a[_0x6060('0x19')]=qs[_0x6060('0x19')](_0xabea02[_0x6060('0x2e')][_0x6060('0x19')]);}_0x369e4a[_0x6060('0x36')]=qs[_0x6060('0x37')](_0xabea02[_0x6060('0x2e')]['sort']);_0x369e4a[_0x6060('0x38')]=qs[_0x6060('0x30')](_['pick'](_0xabea02[_0x6060('0x2e')],_0x23780d['filters']),_0x5a54ae);if(_0xabea02[_0x6060('0x2e')]['filter']){_0x369e4a[_0x6060('0x38')]=_['merge'](_0x369e4a['where'],{'$or':_[_0x6060('0x28')](_0x5a54ae,function(_0x2ca008){if(_0x2ca008['type']!==_0x6060('0x39')){var _0x36a407={};_0x36a407[_0x2ca008[_0x6060('0x25')]]={'$like':'%'+_0xabea02[_0x6060('0x2e')][_0x6060('0x3a')]+'%'};return _0x36a407;}})});}_0x369e4a=_[_0x6060('0x3b')]({},_0x369e4a,_0xabea02[_0x6060('0x3c')]);var _0x452f5f={'where':_0x369e4a[_0x6060('0x38')]};return db[_0x6060('0x29')][_0x6060('0x1b')](_0x452f5f)[_0x6060('0x23')](function(_0x5ed1f2){_0x59b6e8[_0x6060('0x1b')]=_0x5ed1f2;if(_0xabea02[_0x6060('0x2e')][_0x6060('0x3d')]){_0x369e4a[_0x6060('0x3e')]=[{'all':!![]}];}return db[_0x6060('0x29')][_0x6060('0x3f')](_0x369e4a);})[_0x6060('0x23')](function(_0x574c74){_0x59b6e8[_0x6060('0x40')]=_0x574c74;return _0x59b6e8;})[_0x6060('0x23')](respondWithFilteredResult(_0x329f77,_0x369e4a))[_0x6060('0x41')](handleError(_0x329f77,null));};exports[_0x6060('0x42')]=function(_0x40ea33,_0x1b5036){var _0xc7c25={'raw':![],'where':{'id':_0x40ea33[_0x6060('0x43')]['id']}},_0x41cd27={};_0x41cd27[_0x6060('0x2d')]=_[_0x6060('0x2f')](db['UserProfileSection'][_0x6060('0x2a')]);_0x41cd27[_0x6060('0x2e')]=_[_0x6060('0x2f')](_0x40ea33[_0x6060('0x2e')]);_0x41cd27[_0x6060('0x30')]=_[_0x6060('0x32')](_0x41cd27[_0x6060('0x2d')],_0x41cd27[_0x6060('0x2e')]);_0xc7c25[_0x6060('0x31')]=_[_0x6060('0x32')](_0x41cd27[_0x6060('0x2d')],qs[_0x6060('0x33')](_0x40ea33['query']['fields']));_0xc7c25[_0x6060('0x31')]=_0xc7c25[_0x6060('0x31')][_0x6060('0x34')]?_0xc7c25['attributes']:_0x41cd27[_0x6060('0x2d')];if(_0x40ea33[_0x6060('0x2e')]['includeAll']){_0xc7c25[_0x6060('0x3e')]=[{'all':!![]}];}_0xc7c25=_[_0x6060('0x3b')]({},_0xc7c25,_0x40ea33['options']);return db[_0x6060('0x29')][_0x6060('0x44')](_0xc7c25)[_0x6060('0x23')](handleEntityNotFound(_0x1b5036,null))[_0x6060('0x23')](respondWithResult(_0x1b5036,null))[_0x6060('0x41')](handleError(_0x1b5036,null));};exports[_0x6060('0x45')]=function(_0x44fd3d,_0x14a880){return db[_0x6060('0x29')][_0x6060('0x45')](_0x44fd3d[_0x6060('0x46')],{})[_0x6060('0x23')](respondWithResult(_0x14a880,0xc9))[_0x6060('0x41')](handleError(_0x14a880,null));};exports[_0x6060('0x47')]=function(_0xe1b1e2,_0x32b3ba){if(_0xe1b1e2[_0x6060('0x46')]['id']){delete _0xe1b1e2[_0x6060('0x46')]['id'];}return db[_0x6060('0x29')][_0x6060('0x44')]({'where':{'id':_0xe1b1e2['params']['id']}})[_0x6060('0x23')](handleEntityNotFound(_0x32b3ba,null))[_0x6060('0x23')](saveUpdates(_0xe1b1e2['body'],null))[_0x6060('0x23')](respondWithResult(_0x32b3ba,null))[_0x6060('0x41')](handleError(_0x32b3ba,null));};exports[_0x6060('0x22')]=function(_0x12c51f,_0x1866b4){return db[_0x6060('0x29')][_0x6060('0x44')]({'where':{'id':_0x12c51f[_0x6060('0x43')]['id']}})['then'](handleEntityNotFound(_0x1866b4,null))[_0x6060('0x23')](removeEntity(_0x1866b4,null))['catch'](handleError(_0x1866b4,null));};exports[_0x6060('0x48')]=function(_0x3a410c,_0x19a695){return db['UserProfileSection']['describe']()[_0x6060('0x23')](respondWithResult(_0x19a695,null))[_0x6060('0x41')](handleError(_0x19a695,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9c879b0..647512b 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 _0xd1c1=['exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x235db5,_0x3aa095){var _0x4c6798=function(_0xb57d8b){while(--_0xb57d8b){_0x235db5['push'](_0x235db5['shift']());}};_0x4c6798(++_0x3aa095);}(_0xd1c1,0x136));var _0x1d1c=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xd1c1[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require('lodash');var util=require(_0x1d1c('0x0'));var logger=require(_0x1d1c('0x1'))(_0x1d1c('0x2'));var moment=require(_0x1d1c('0x3'));var BPromise=require(_0x1d1c('0x4'));var rp=require(_0x1d1c('0x5'));var fs=require('fs');var path=require(_0x1d1c('0x6'));var rimraf=require(_0x1d1c('0x7'));var config=require(_0x1d1c('0x8'));var attributes=require(_0x1d1c('0x9'));module[_0x1d1c('0xa')]=function(_0x117fb8,_0x2305fe){return _0x117fb8[_0x1d1c('0xb')](_0x1d1c('0xc'),attributes,{'tableName':_0x1d1c('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1d1c('0xe'),_0x1d1c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2358=['path','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','api','bluebird','request-promise'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0x2358,0x1e0));var _0x8235=function(_0x114b3c,_0x4a0ebc){_0x114b3c=_0x114b3c-0x0;var _0x29a707=_0x2358[_0x114b3c];return _0x29a707;};'use strict';var _=require('lodash');var util=require(_0x8235('0x0'));var logger=require('../../config/logger')(_0x8235('0x1'));var moment=require('moment');var BPromise=require(_0x8235('0x2'));var rp=require(_0x8235('0x3'));var fs=require('fs');var path=require(_0x8235('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x8235('0x5')]=function(_0x1b3422,_0x4d28b9){return _0x1b3422[_0x8235('0x6')]('UserProfileSection',attributes,{'tableName':_0x8235('0x7'),'paranoid':![],'indexes':[{'name':_0x8235('0x8'),'fields':[_0x8235('0x9'),_0x8235('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 2c74019..7740886 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 _0xb0ee=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xb0ee,0x192));var _0xeb0e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb0ee[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xeb0e('0x0'));var util=require(_0xeb0e('0x1'));var moment=require(_0xeb0e('0x2'));var BPromise=require(_0xeb0e('0x3'));var rs=require(_0xeb0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb0e('0x5'))(_0xeb0e('0x6'));var config=require(_0xeb0e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb0e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34dbfe,_0x18abb5,_0xab0de5){return new BPromise(function(_0x52b272,_0x119b29){return client['request'](_0x34dbfe,_0xab0de5)[_0xeb0e('0x9')](function(_0x2f9666){logger['info'](_0xeb0e('0xa'),_0x18abb5,_0xeb0e('0xb'));logger[_0xeb0e('0xc')](_0xeb0e('0xd'),_0x18abb5,_0xeb0e('0xb'),JSON['stringify'](_0x2f9666));if(_0x2f9666[_0xeb0e('0xe')]){if(_0x2f9666[_0xeb0e('0xe')][_0xeb0e('0xf')]===0x1f4){logger[_0xeb0e('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x18abb5,_0x2f9666[_0xeb0e('0xe')][_0xeb0e('0x10')]);return _0x119b29(_0x2f9666['error'][_0xeb0e('0x10')]);}logger[_0xeb0e('0xe')](_0xeb0e('0xa'),_0x18abb5,_0x2f9666[_0xeb0e('0xe')]['message']);return _0x52b272(_0x2f9666[_0xeb0e('0xe')][_0xeb0e('0x10')]);}else{logger[_0xeb0e('0x11')](_0xeb0e('0xa'),_0x18abb5,_0xeb0e('0xb'));_0x52b272(_0x2f9666[_0xeb0e('0x12')][_0xeb0e('0x10')]);}})[_0xeb0e('0x13')](function(_0x69a589){logger[_0xeb0e('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x18abb5,_0x69a589);_0x119b29(_0x69a589);});});} \ No newline at end of file +var _0xba75=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x56ba83,_0x5b93c6){var _0x130ed3=function(_0x4a859c){while(--_0x4a859c){_0x56ba83['push'](_0x56ba83['shift']());}};_0x130ed3(++_0x5b93c6);}(_0xba75,0x1a5));var _0x5ba7=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xba75[_0x37e886];return _0x57c5cd;};'use strict';var _=require(_0x5ba7('0x0'));var util=require(_0x5ba7('0x1'));var moment=require('moment');var BPromise=require(_0x5ba7('0x2'));var rs=require(_0x5ba7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ba7('0x4'))['db'];var utils=require(_0x5ba7('0x5'));var logger=require(_0x5ba7('0x6'))(_0x5ba7('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ba7('0x8'));var client=jayson[_0x5ba7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34978c,_0x5839ca,_0x46a160){return new BPromise(function(_0x5bafcf,_0x4ccdb4){return client['request'](_0x34978c,_0x46a160)['then'](function(_0x15b9f2){logger['info'](_0x5ba7('0xa'),_0x5839ca,_0x5ba7('0xb'));logger[_0x5ba7('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5839ca,_0x5ba7('0xb'),JSON[_0x5ba7('0xd')](_0x15b9f2));if(_0x15b9f2[_0x5ba7('0xe')]){if(_0x15b9f2[_0x5ba7('0xe')]['code']===0x1f4){logger['error'](_0x5ba7('0xa'),_0x5839ca,_0x15b9f2[_0x5ba7('0xe')][_0x5ba7('0xf')]);return _0x4ccdb4(_0x15b9f2[_0x5ba7('0xe')][_0x5ba7('0xf')]);}logger['error'](_0x5ba7('0xa'),_0x5839ca,_0x15b9f2[_0x5ba7('0xe')]['message']);return _0x5bafcf(_0x15b9f2[_0x5ba7('0xe')][_0x5ba7('0xf')]);}else{logger[_0x5ba7('0x10')](_0x5ba7('0xa'),_0x5839ca,_0x5ba7('0xb'));_0x5bafcf(_0x15b9f2[_0x5ba7('0x11')][_0x5ba7('0xf')]);}})[_0x5ba7('0x12')](function(_0x36839b){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5839ca,_0x36839b);_0x4ccdb4(_0x36839b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5ec4171..eec49a7 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ee7fd,_0xff9ac4){var _0x283b97=function(_0x1da0f2){while(--_0x1da0f2){_0x5ee7fd['push'](_0x5ee7fd['shift']());}};_0x283b97(++_0xff9ac4);}(_0xe706,0xa3));var _0x6e70=function(_0x366776,_0x48f0bf){_0x366776=_0x366776-0x0;var _0x34e2ad=_0xe706[_0x366776];return _0x34e2ad;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x47ddda,_0x48f220){var _0xefc948=function(_0x1bbc17){while(--_0x1bbc17){_0x47ddda['push'](_0x47ddda['shift']());}};_0xefc948(++_0x48f220);}(_0xedd9,0xfc));var _0x9edd=function(_0x56a3e8,_0x14e6f8){_0x56a3e8=_0x56a3e8-0x0;var _0xe3abab=_0xedd9[_0x56a3e8];return _0xe3abab;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index fd3a588..5f16a75 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 _0x633e=['sequelize','exports','INTEGER'];(function(_0x3c85c9,_0x5c2337){var _0x396e7c=function(_0x2df5ca){while(--_0x2df5ca){_0x3c85c9['push'](_0x3c85c9['shift']());}};_0x396e7c(++_0x5c2337);}(_0x633e,0x150));var _0xe633=function(_0x469d4d,_0x45ab56){_0x469d4d=_0x469d4d-0x0;var _0x28a509=_0x633e[_0x469d4d];return _0x28a509;};'use strict';var Sequelize=require(_0xe633('0x0'));module[_0xe633('0x1')]={'penalty':{'type':Sequelize[_0xe633('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9491=['exports','INTEGER','sequelize'];(function(_0x17d24a,_0x31dba1){var _0x1b3c5e=function(_0x8a2b6a){while(--_0x8a2b6a){_0x17d24a['push'](_0x17d24a['shift']());}};_0x1b3c5e(++_0x31dba1);}(_0x9491,0xb6));var _0x1949=function(_0x5177fa,_0x3cba42){_0x5177fa=_0x5177fa-0x0;var _0x16c930=_0x9491[_0x5177fa];return _0x16c930;};'use strict';var Sequelize=require(_0x1949('0x0'));module[_0x1949('0x1')]={'penalty':{'type':Sequelize[_0x1949('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 84d47be..f07097c 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 _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x3f560e,_0x289aa8){var _0x5bf213=function(_0xcc2f71){while(--_0xcc2f71){_0x3f560e['push'](_0x3f560e['shift']());}};_0x5bf213(++_0x289aa8);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2da6=['moment','bluebird','request-promise','path','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x55f5e0,_0x2840fb){var _0x3eee67=function(_0x40aa28){while(--_0x40aa28){_0x55f5e0['push'](_0x55f5e0['shift']());}};_0x3eee67(++_0x2840fb);}(_0x2da6,0x1dd));var _0x62da=function(_0x3998d5,_0x18411d){_0x3998d5=_0x3998d5-0x0;var _0x141ed1=_0x2da6[_0x3998d5];return _0x141ed1;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var logger=require(_0x62da('0x2'))(_0x62da('0x3'));var moment=require(_0x62da('0x4'));var BPromise=require(_0x62da('0x5'));var rp=require(_0x62da('0x6'));var fs=require('fs');var path=require(_0x62da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62da('0x8'));module[_0x62da('0x9')]=function(_0x3a59f8,_0x30437f){return _0x3a59f8[_0x62da('0xa')](_0x62da('0xb'),attributes,{'tableName':_0x62da('0xc'),'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 3c63665..c72cbed 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 _0xe759=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0xb770d6,_0x297aed){var _0x490b6c=function(_0x3c6a53){while(--_0x3c6a53){_0xb770d6['push'](_0xb770d6['shift']());}};_0x490b6c(++_0x297aed);}(_0xe759,0x18a));var _0x9e75=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe759[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9e75('0x0'));var moment=require(_0x9e75('0x1'));var BPromise=require('bluebird');var rs=require(_0x9e75('0x2'));var fs=require('fs');var Redis=require(_0x9e75('0x3'));var db=require(_0x9e75('0x4'))['db'];var utils=require(_0x9e75('0x5'));var logger=require(_0x9e75('0x6'))(_0x9e75('0x7'));var config=require(_0x9e75('0x8'));var jayson=require(_0x9e75('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x367550,_0x15bccb,_0x519937){return new BPromise(function(_0x434136,_0x641a67){return client['request'](_0x367550,_0x519937)[_0x9e75('0xa')](function(_0x2cd5b0){logger[_0x9e75('0xb')](_0x9e75('0xc'),_0x15bccb,_0x9e75('0xd'));logger[_0x9e75('0xe')](_0x9e75('0xf'),_0x15bccb,_0x9e75('0xd'),JSON[_0x9e75('0x10')](_0x2cd5b0));if(_0x2cd5b0['error']){if(_0x2cd5b0[_0x9e75('0x11')][_0x9e75('0x12')]===0x1f4){logger[_0x9e75('0x11')](_0x9e75('0xc'),_0x15bccb,_0x2cd5b0[_0x9e75('0x11')]['message']);return _0x641a67(_0x2cd5b0['error'][_0x9e75('0x13')]);}logger['error'](_0x9e75('0xc'),_0x15bccb,_0x2cd5b0[_0x9e75('0x11')]['message']);return _0x434136(_0x2cd5b0[_0x9e75('0x11')][_0x9e75('0x13')]);}else{logger[_0x9e75('0xb')](_0x9e75('0xc'),_0x15bccb,_0x9e75('0xd'));_0x434136(_0x2cd5b0[_0x9e75('0x14')]['message']);}})[_0x9e75('0x15')](function(_0x1c03cd){logger[_0x9e75('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x15bccb,_0x1c03cd);_0x641a67(_0x1c03cd);});});} \ No newline at end of file +var _0xa25b=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x5defd0,_0x370ed8){var _0x2aa994=function(_0x48eda4){while(--_0x48eda4){_0x5defd0['push'](_0x5defd0['shift']());}};_0x2aa994(++_0x370ed8);}(_0xa25b,0xfb));var _0xba25=function(_0x68b52,_0x5097eb){_0x68b52=_0x68b52-0x0;var _0x4ed4c2=_0xa25b[_0x68b52];return _0x4ed4c2;};'use strict';var _=require(_0xba25('0x0'));var util=require(_0xba25('0x1'));var moment=require(_0xba25('0x2'));var BPromise=require(_0xba25('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba25('0x4'));var db=require(_0xba25('0x5'))['db'];var utils=require(_0xba25('0x6'));var logger=require(_0xba25('0x7'))('rpc');var config=require(_0xba25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba25('0x9')][_0xba25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50741c,_0x4ee7eb,_0x23027a){return new BPromise(function(_0x581cba,_0x469336){return client['request'](_0x50741c,_0x23027a)['then'](function(_0x200c95){logger[_0xba25('0xb')](_0xba25('0xc'),_0x4ee7eb,_0xba25('0xd'));logger[_0xba25('0xe')](_0xba25('0xf'),_0x4ee7eb,_0xba25('0xd'),JSON[_0xba25('0x10')](_0x200c95));if(_0x200c95['error']){if(_0x200c95[_0xba25('0x11')][_0xba25('0x12')]===0x1f4){logger['error'](_0xba25('0xc'),_0x4ee7eb,_0x200c95[_0xba25('0x11')][_0xba25('0x13')]);return _0x469336(_0x200c95[_0xba25('0x11')][_0xba25('0x13')]);}logger[_0xba25('0x11')](_0xba25('0xc'),_0x4ee7eb,_0x200c95['error'][_0xba25('0x13')]);return _0x581cba(_0x200c95['error'][_0xba25('0x13')]);}else{logger[_0xba25('0xb')](_0xba25('0xc'),_0x4ee7eb,_0xba25('0xd'));_0x581cba(_0x200c95[_0xba25('0x14')]['message']);}})[_0xba25('0x15')](function(_0x2b9cd4){logger[_0xba25('0x11')](_0xba25('0xc'),_0x4ee7eb,_0x2b9cd4);_0x469336(_0x2b9cd4);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index cbb51b6..12437b3 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 _0x7456=['sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7456,0xf1));var _0x6745=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x7456[_0x385c76];return _0x5c8367;};'use strict';var Sequelize=require(_0x6745('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4e90=['exports','INTEGER'];(function(_0xcbcc2a,_0x612e0f){var _0x15d06d=function(_0x4d7442){while(--_0x4d7442){_0xcbcc2a['push'](_0xcbcc2a['shift']());}};_0x15d06d(++_0x612e0f);}(_0x4e90,0x19e));var _0x04e9=function(_0x1771b6,_0x197939){_0x1771b6=_0x1771b6-0x0;var _0x173302=_0x4e90[_0x1771b6];return _0x173302;};'use strict';var Sequelize=require('sequelize');module[_0x04e9('0x0')]={'UserId':{'type':Sequelize[_0x04e9('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 79f6dd7..2b4136b 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(_0x338946,_0x495c19){var _0xc4dccf=function(_0x1cc50c){while(--_0x1cc50c){_0x338946['push'](_0x338946['shift']());}};_0xc4dccf(++_0x495c19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x3c2ad1,_0x144e28){var _0x38651c=function(_0x29bd26){while(--_0x29bd26){_0x3c2ad1['push'](_0x3c2ad1['shift']());}};_0x38651c(++_0x144e28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 255fd4a..6146d96 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2b7474,_0x4e6069){var _0x42c877=function(_0x3929a0){while(--_0x3929a0){_0x2b7474['push'](_0x2b7474['shift']());}};_0x42c877(++_0x4e6069);}(_0xedd9,0xfc));var _0x9edd=function(_0xb4ba26,_0x13be74){_0xb4ba26=_0xb4ba26-0x0;var _0x249820=_0xedd9[_0xb4ba26];return _0x249820;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x110347,_0x53628f){var _0x382cab=function(_0x3c4d32){while(--_0x3c4d32){_0x110347['push'](_0x110347['shift']());}};_0x382cab(++_0x53628f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xcb91[_0x836465];return _0x2150ea;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 486bd03..bc1260f 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 _0x4a1f=['exports','INTEGER','sequelize'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x4a1f,0xaa));var _0xf4a1=function(_0x49fa22,_0x3a8ccb){_0x49fa22=_0x49fa22-0x0;var _0x4af7a1=_0x4a1f[_0x49fa22];return _0x4af7a1;};'use strict';var Sequelize=require(_0xf4a1('0x0'));module[_0xf4a1('0x1')]={'penalty':{'type':Sequelize[_0xf4a1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x14ba=['exports','INTEGER'];(function(_0xef0f93,_0x2f1ca7){var _0x593466=function(_0x1873a5){while(--_0x1873a5){_0xef0f93['push'](_0xef0f93['shift']());}};_0x593466(++_0x2f1ca7);}(_0x14ba,0x9a));var _0xa14b=function(_0x16662e,_0x50b29d){_0x16662e=_0x16662e-0x0;var _0x34a83c=_0x14ba[_0x16662e];return _0x34a83c;};'use strict';var Sequelize=require('sequelize');module[_0xa14b('0x0')]={'penalty':{'type':Sequelize[_0xa14b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ce7e64b..07b364f 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 _0x340b=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x340b,0xc4));var _0xb340=function(_0x2a65c5,_0x353109){_0x2a65c5=_0x2a65c5-0x0;var _0x18ab73=_0x340b[_0x2a65c5];return _0x18ab73;};'use strict';var _=require(_0xb340('0x0'));var util=require(_0xb340('0x1'));var logger=require(_0xb340('0x2'))(_0xb340('0x3'));var moment=require('moment');var BPromise=require(_0xb340('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb340('0x5'));var rimraf=require(_0xb340('0x6'));var config=require(_0xb340('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0xb340('0x8')]=function(_0x18746d,_0x370f0f){return _0x18746d[_0xb340('0x9')](_0xb340('0xa'),attributes,{'tableName':_0xb340('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72e4=['user_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x387ad3,_0x26a42f){var _0x12c881=function(_0xb8c023){while(--_0xb8c023){_0x387ad3['push'](_0x387ad3['shift']());}};_0x12c881(++_0x26a42f);}(_0x72e4,0x85));var _0x472e=function(_0x5e265e,_0x43d295){_0x5e265e=_0x5e265e-0x0;var _0x5d4caa=_0x72e4[_0x5e265e];return _0x5d4caa;};'use strict';var _=require('lodash');var util=require(_0x472e('0x0'));var logger=require(_0x472e('0x1'))(_0x472e('0x2'));var moment=require(_0x472e('0x3'));var BPromise=require(_0x472e('0x4'));var rp=require(_0x472e('0x5'));var fs=require('fs');var path=require(_0x472e('0x6'));var rimraf=require('rimraf');var config=require(_0x472e('0x7'));var attributes=require(_0x472e('0x8'));module[_0x472e('0x9')]=function(_0x262c96,_0x4dbf7b){return _0x262c96['define']('UserVoiceQueue',attributes,{'tableName':_0x472e('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 3e06489..fccc8dc 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 _0x793b=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3541b1,_0x3058e0){var _0x176967=function(_0x436423){while(--_0x436423){_0x3541b1['push'](_0x3541b1['shift']());}};_0x176967(++_0x3058e0);}(_0x793b,0x156));var _0xb793=function(_0x1a3165,_0x105ec5){_0x1a3165=_0x1a3165-0x0;var _0x4a72b4=_0x793b[_0x1a3165];return _0x4a72b4;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var moment=require(_0xb793('0x2'));var BPromise=require('bluebird');var rs=require(_0xb793('0x3'));var fs=require('fs');var Redis=require(_0xb793('0x4'));var db=require(_0xb793('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb793('0x6'))(_0xb793('0x7'));var config=require(_0xb793('0x8'));var jayson=require(_0xb793('0x9'));var client=jayson['client'][_0xb793('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a8587,_0x36afce,_0x211194){return new BPromise(function(_0x25fced,_0x48836a){return client[_0xb793('0xb')](_0x2a8587,_0x211194)[_0xb793('0xc')](function(_0x3787b6){logger[_0xb793('0xd')](_0xb793('0xe'),_0x36afce,'request\x20sent');logger[_0xb793('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x36afce,_0xb793('0x10'),JSON[_0xb793('0x11')](_0x3787b6));if(_0x3787b6['error']){if(_0x3787b6[_0xb793('0x12')][_0xb793('0x13')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x36afce,_0x3787b6[_0xb793('0x12')]['message']);return _0x48836a(_0x3787b6['error'][_0xb793('0x14')]);}logger['error'](_0xb793('0xe'),_0x36afce,_0x3787b6[_0xb793('0x12')]['message']);return _0x25fced(_0x3787b6['error'][_0xb793('0x14')]);}else{logger[_0xb793('0xd')](_0xb793('0xe'),_0x36afce,_0xb793('0x10'));_0x25fced(_0x3787b6[_0xb793('0x15')][_0xb793('0x14')]);}})[_0xb793('0x16')](function(_0x8a4464){logger[_0xb793('0x12')](_0xb793('0xe'),_0x36afce,_0x8a4464);_0x48836a(_0x8a4464);});});} \ No newline at end of file +var _0x21e7=['http','request','then','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56e9bb,_0x186019){var _0x48dbe5=function(_0x23327b){while(--_0x23327b){_0x56e9bb['push'](_0x56e9bb['shift']());}};_0x48dbe5(++_0x186019);}(_0x21e7,0x1ef));var _0x721e=function(_0x1f68ce,_0xe76a1a){_0x1f68ce=_0x1f68ce-0x0;var _0x3af20a=_0x21e7[_0x1f68ce];return _0x3af20a;};'use strict';var _=require('lodash');var util=require(_0x721e('0x0'));var moment=require('moment');var BPromise=require(_0x721e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x721e('0x2'));var db=require(_0x721e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x721e('0x4'))(_0x721e('0x5'));var config=require(_0x721e('0x6'));var jayson=require(_0x721e('0x7'));var client=jayson[_0x721e('0x8')][_0x721e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x259391,_0x2988b2,_0x47aaf5){return new BPromise(function(_0x3164c4,_0x3d0209){return client[_0x721e('0xa')](_0x259391,_0x47aaf5)[_0x721e('0xb')](function(_0x3b2d1a){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2988b2,_0x721e('0xc'));logger[_0x721e('0xd')](_0x721e('0xe'),_0x2988b2,_0x721e('0xc'),JSON[_0x721e('0xf')](_0x3b2d1a));if(_0x3b2d1a[_0x721e('0x10')]){if(_0x3b2d1a[_0x721e('0x10')][_0x721e('0x11')]===0x1f4){logger[_0x721e('0x10')](_0x721e('0x12'),_0x2988b2,_0x3b2d1a['error'][_0x721e('0x13')]);return _0x3d0209(_0x3b2d1a[_0x721e('0x10')][_0x721e('0x13')]);}logger[_0x721e('0x10')](_0x721e('0x12'),_0x2988b2,_0x3b2d1a[_0x721e('0x10')][_0x721e('0x13')]);return _0x3164c4(_0x3b2d1a[_0x721e('0x10')][_0x721e('0x13')]);}else{logger[_0x721e('0x14')](_0x721e('0x12'),_0x2988b2,_0x721e('0xc'));_0x3164c4(_0x3b2d1a['result']['message']);}})['catch'](function(_0x36a86a){logger[_0x721e('0x10')](_0x721e('0x12'),_0x2988b2,_0x36a86a);_0x3d0209(_0x36a86a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6736466..ef4030b 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1a60e1,_0x4d9865){var _0x59c922=function(_0x5e2b22){while(--_0x5e2b22){_0x1a60e1['push'](_0x1a60e1['shift']());}};_0x59c922(++_0x4d9865);}(_0x70e0,0x17b));var _0x070e=function(_0x3d9d33,_0xa72365){_0x3d9d33=_0x3d9d33-0x0;var _0x3c8fbe=_0x70e0[_0x3d9d33];return _0x3c8fbe;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1efc87,_0x2774b4){var _0x29f3cd=function(_0x5bd1cd){while(--_0x5bd1cd){_0x1efc87['push'](_0x1efc87['shift']());}};_0x29f3cd(++_0x2774b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2a0e49e..363d2a7 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 _0x47a8=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3ed79c,_0x1ca263){var _0x3c7523=function(_0x3630be){while(--_0x3630be){_0x3ed79c['push'](_0x3ed79c['shift']());}};_0x3c7523(++_0x1ca263);}(_0x47a8,0x1b6));var _0x847a=function(_0x2ffdad,_0x5d135d){_0x2ffdad=_0x2ffdad-0x0;var _0xfa095f=_0x47a8[_0x2ffdad];return _0xfa095f;};'use strict';var Sequelize=require(_0x847a('0x0'));module[_0x847a('0x1')]={'uniqueid':{'type':Sequelize[_0x847a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x847a('0x3')},'membername':{'type':Sequelize[_0x847a('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x847a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x847a('0x4')],'allowNull':![],'unique':_0x847a('0x5'),'comment':_0x847a('0x3')},'VoiceQueueId':{'type':Sequelize[_0x847a('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x847a('0x5'),'comment':_0x847a('0x3')},'penalty':{'type':Sequelize[_0x847a('0x2')](0xb),'defaultValue':0x0,'comment':_0x847a('0x3')},'paused':{'type':Sequelize[_0x847a('0x2')](0xb),'defaultValue':0x0,'comment':_0x847a('0x3')}}; \ No newline at end of file +var _0x8a3d=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x2f6233,_0x90172){var _0x1c9c36=function(_0x3ac680){while(--_0x3ac680){_0x2f6233['push'](_0x2f6233['shift']());}};_0x1c9c36(++_0x90172);}(_0x8a3d,0xd5));var _0xd8a3=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0x8a3d[_0x3f940e];return _0x424b2e;};'use strict';var Sequelize=require(_0xd8a3('0x0'));module[_0xd8a3('0x1')]={'uniqueid':{'type':Sequelize[_0xd8a3('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd8a3('0x3')},'membername':{'type':Sequelize[_0xd8a3('0x4')],'allowNull':![],'comment':_0xd8a3('0x3')},'UserId':{'type':Sequelize[_0xd8a3('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xd8a3('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xd8a3('0x3')},'VoiceQueueId':{'type':Sequelize[_0xd8a3('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xd8a3('0x4')],'allowNull':![],'unique':_0xd8a3('0x5'),'comment':_0xd8a3('0x3')},'penalty':{'type':Sequelize[_0xd8a3('0x2')](0xb),'defaultValue':0x0,'comment':_0xd8a3('0x3')},'paused':{'type':Sequelize[_0xd8a3('0x2')](0xb),'defaultValue':0x0,'comment':_0xd8a3('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 73f367a..cd82b92 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 _0x52c1=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x4f7f48,_0x263947){var _0x3ab73f=function(_0x5d567d){while(--_0x5d567d){_0x4f7f48['push'](_0x4f7f48['shift']());}};_0x3ab73f(++_0x263947);}(_0x52c1,0xa7));var _0x152c=function(_0x370482,_0x45e9fd){_0x370482=_0x370482-0x0;var _0x3fd6ca=_0x52c1[_0x370482];return _0x3fd6ca;};'use strict';var EventEmitter=require(_0x152c('0x0'));var UserVoiceQueueRt=require(_0x152c('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x152c('0x2')](0x0);var events={'afterCreate':_0x152c('0x3'),'afterUpdate':_0x152c('0x4'),'afterDestroy':_0x152c('0x5')};function emitEvent(_0x147dfd){return function(_0x43827f,_0x41ca8c,_0x255186){UserVoiceQueueRtEvents[_0x152c('0x6')](_0x147dfd+':'+_0x43827f['id'],_0x43827f);UserVoiceQueueRtEvents[_0x152c('0x6')](_0x147dfd,_0x43827f);_0x255186(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x152c('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xbf7e=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1f086c,_0x3fefa3){var _0x522de5=function(_0x58c93b){while(--_0x58c93b){_0x1f086c['push'](_0x1f086c['shift']());}};_0x522de5(++_0x3fefa3);}(_0xbf7e,0x17c));var _0xebf7=function(_0x2823c1,_0x52ddda){_0x2823c1=_0x2823c1-0x0;var _0x370a82=_0xbf7e[_0x2823c1];return _0x370a82;};'use strict';var EventEmitter=require(_0xebf7('0x0'));var UserVoiceQueueRt=require(_0xebf7('0x1'))['db'][_0xebf7('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xebf7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xebf7('0x4'),'afterDestroy':_0xebf7('0x5')};function emitEvent(_0x48b544){return function(_0x16979f,_0x30455c,_0x53ef54){UserVoiceQueueRtEvents[_0xebf7('0x6')](_0x48b544+':'+_0x16979f['id'],_0x16979f);UserVoiceQueueRtEvents['emit'](_0x48b544,_0x16979f);_0x53ef54(null);};}for(var e in events){if(events[_0xebf7('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xebf7('0x8')](e,emitEvent(event));}}module[_0xebf7('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 6c26423..a058784 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 _0x13a1=['bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','moment'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x13a1,0x158));var _0x113a=function(_0x67d628,_0x400796){_0x67d628=_0x67d628-0x0;var _0x3d1b4b=_0x13a1[_0x67d628];return _0x3d1b4b;};'use strict';var _=require('lodash');var util=require(_0x113a('0x0'));var logger=require(_0x113a('0x1'))(_0x113a('0x2'));var moment=require(_0x113a('0x3'));var BPromise=require(_0x113a('0x4'));var rp=require(_0x113a('0x5'));var fs=require('fs');var path=require(_0x113a('0x6'));var rimraf=require('rimraf');var config=require(_0x113a('0x7'));var attributes=require(_0x113a('0x8'));module[_0x113a('0x9')]=function(_0xc56cd7,_0x1c45ec){return _0xc56cd7['define'](_0x113a('0xa'),attributes,{'tableName':_0x113a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af0=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4af0,0xf2));var _0x04af=function(_0x45a4e0,_0x345f4d){_0x45a4e0=_0x45a4e0-0x0;var _0x43f49d=_0x4af0[_0x45a4e0];return _0x43f49d;};'use strict';var _=require(_0x04af('0x0'));var util=require('util');var logger=require(_0x04af('0x1'))(_0x04af('0x2'));var moment=require(_0x04af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x04af('0x4'));var config=require(_0x04af('0x5'));var attributes=require(_0x04af('0x6'));module['exports']=function(_0x232b82,_0x1590c3){return _0x232b82[_0x04af('0x7')](_0x04af('0x8'),attributes,{'tableName':_0x04af('0x9'),'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 625712e..6508a6c 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 _0xe777=['redis','defaults','./userVoiceQueueRt.socket','register','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','result','catch','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe777,0x1af));var _0x7e77=function(_0x4ac0a6,_0x8704ee){_0x4ac0a6=_0x4ac0a6-0x0;var _0x23c2c6=_0xe777[_0x4ac0a6];return _0x23c2c6;};'use strict';var _=require(_0x7e77('0x0'));var util=require(_0x7e77('0x1'));var moment=require(_0x7e77('0x2'));var BPromise=require(_0x7e77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e77('0x4'));var db=require(_0x7e77('0x5'))['db'];var utils=require(_0x7e77('0x6'));var logger=require(_0x7e77('0x7'))(_0x7e77('0x8'));var config=require(_0x7e77('0x9'));var jayson=require(_0x7e77('0xa'));var client=jayson[_0x7e77('0xb')][_0x7e77('0xc')]({'port':0x232a});config[_0x7e77('0xd')]=_[_0x7e77('0xe')](config[_0x7e77('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e77('0xd')]));require(_0x7e77('0xf'))[_0x7e77('0x10')](socket);function respondWithRpcPromise(_0x2f8520,_0x4654a5,_0x5c1d2f){return new BPromise(function(_0x102d31,_0x596787){return client['request'](_0x2f8520,_0x5c1d2f)['then'](function(_0x3e27a7){logger[_0x7e77('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4654a5,'request\x20sent');logger[_0x7e77('0x12')](_0x7e77('0x13'),_0x4654a5,'request\x20sent',JSON[_0x7e77('0x14')](_0x3e27a7));if(_0x3e27a7[_0x7e77('0x15')]){if(_0x3e27a7[_0x7e77('0x15')][_0x7e77('0x16')]===0x1f4){logger[_0x7e77('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4654a5,_0x3e27a7[_0x7e77('0x15')][_0x7e77('0x17')]);return _0x596787(_0x3e27a7['error'][_0x7e77('0x17')]);}logger[_0x7e77('0x15')](_0x7e77('0x18'),_0x4654a5,_0x3e27a7[_0x7e77('0x15')][_0x7e77('0x17')]);return _0x102d31(_0x3e27a7['error']['message']);}else{logger[_0x7e77('0x11')](_0x7e77('0x18'),_0x4654a5,_0x7e77('0x19'));_0x102d31(_0x3e27a7[_0x7e77('0x1a')][_0x7e77('0x17')]);}})[_0x7e77('0x1b')](function(_0x2c89aa){logger[_0x7e77('0x15')](_0x7e77('0x18'),_0x4654a5,_0x2c89aa);_0x596787(_0x2c89aa);});});}exports['GetVoiceQueueRtPauses']=function(_0x5e6fd7){var _0x1fc8bd=this;return new Promise(function(_0xec8139,_0x339e4b){return db['UserVoiceQueueRt'][_0x7e77('0x1c')]({'raw':_0x5e6fd7['options']?_0x5e6fd7[_0x7e77('0x1d')][_0x7e77('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e6fd7[_0x7e77('0x1d')]?_0x5e6fd7[_0x7e77('0x1d')][_0x7e77('0x1f')]||null:null,'attributes':[[db[_0x7e77('0x20')]['fn'](_0x7e77('0x21'),db[_0x7e77('0x20')]['fn']('IF',db[_0x7e77('0x20')][_0x7e77('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0x7e77('0x23')]]})['then'](function(_0x21d56f){logger[_0x7e77('0x11')](_0x7e77('0x24'),_0x5e6fd7);logger['debug']('GetVoiceQueueRtPauses',_0x5e6fd7,JSON['stringify'](_0x21d56f));_0xec8139(_0x21d56f);})[_0x7e77('0x1b')](function(_0x3b9a92){logger[_0x7e77('0x15')]('GetVoiceQueueRtPauses',_0x3b9a92['message'],_0x5e6fd7);_0x339e4b(_0x1fc8bd[_0x7e77('0x15')](0x1f4,_0x3b9a92[_0x7e77('0x17')]));});});}; \ No newline at end of file +var _0x58fe=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','debug','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x167923,_0x1b5f10){var _0x2eb4dd=function(_0x28af09){while(--_0x28af09){_0x167923['push'](_0x167923['shift']());}};_0x2eb4dd(++_0x1b5f10);}(_0x58fe,0x179));var _0xe58f=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x58fe[_0x1d211b];return _0x47c88b;};'use strict';var _=require(_0xe58f('0x0'));var util=require(_0xe58f('0x1'));var moment=require(_0xe58f('0x2'));var BPromise=require(_0xe58f('0x3'));var rs=require(_0xe58f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe58f('0x5'))(_0xe58f('0x6'));var config=require(_0xe58f('0x7'));var jayson=require(_0xe58f('0x8'));var client=jayson[_0xe58f('0x9')][_0xe58f('0xa')]({'port':0x232a});config[_0xe58f('0xb')]=_[_0xe58f('0xc')](config[_0xe58f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe58f('0xd'))(new Redis(config[_0xe58f('0xb')]));require(_0xe58f('0xe'))[_0xe58f('0xf')](socket);function respondWithRpcPromise(_0x950e2c,_0x193f0d,_0x427eb3){return new BPromise(function(_0x3d819c,_0xa2d01e){return client['request'](_0x950e2c,_0x427eb3)[_0xe58f('0x10')](function(_0x413362){logger[_0xe58f('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x193f0d,_0xe58f('0x12'));logger[_0xe58f('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x193f0d,'request\x20sent',JSON[_0xe58f('0x14')](_0x413362));if(_0x413362[_0xe58f('0x15')]){if(_0x413362['error'][_0xe58f('0x16')]===0x1f4){logger[_0xe58f('0x15')](_0xe58f('0x17'),_0x193f0d,_0x413362[_0xe58f('0x15')][_0xe58f('0x18')]);return _0xa2d01e(_0x413362['error'][_0xe58f('0x18')]);}logger[_0xe58f('0x15')](_0xe58f('0x17'),_0x193f0d,_0x413362[_0xe58f('0x15')]['message']);return _0x3d819c(_0x413362[_0xe58f('0x15')][_0xe58f('0x18')]);}else{logger[_0xe58f('0x11')](_0xe58f('0x17'),_0x193f0d,_0xe58f('0x12'));_0x3d819c(_0x413362['result'][_0xe58f('0x18')]);}})[_0xe58f('0x19')](function(_0x52a5b0){logger[_0xe58f('0x15')](_0xe58f('0x17'),_0x193f0d,_0x52a5b0);_0xa2d01e(_0x52a5b0);});});}exports[_0xe58f('0x1a')]=function(_0x5d0cdd){var _0x3ed0fa=this;return new Promise(function(_0x2f49f0,_0x2683d1){return db['UserVoiceQueueRt'][_0xe58f('0x1b')]({'raw':_0x5d0cdd[_0xe58f('0x1c')]?_0x5d0cdd[_0xe58f('0x1c')][_0xe58f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d0cdd['options']?_0x5d0cdd[_0xe58f('0x1c')][_0xe58f('0x1e')]||null:null,'attributes':[[db[_0xe58f('0x1f')]['fn'](_0xe58f('0x20'),db['sequelize']['fn']('IF',db[_0xe58f('0x1f')][_0xe58f('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0xe58f('0x22')]]})[_0xe58f('0x10')](function(_0x1965a8){logger[_0xe58f('0x11')](_0xe58f('0x1a'),_0x5d0cdd);logger['debug'](_0xe58f('0x1a'),_0x5d0cdd,JSON[_0xe58f('0x14')](_0x1965a8));_0x2f49f0(_0x1965a8);})[_0xe58f('0x19')](function(_0x350b2c){logger[_0xe58f('0x15')](_0xe58f('0x1a'),_0x350b2c[_0xe58f('0x18')],_0x5d0cdd);_0x2683d1(_0x3ed0fa[_0xe58f('0x15')](0x1f4,_0x350b2c['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1a62d4b..e08b684 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 _0x3cb7=['register','length','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3cb7,0xcf));var _0x73cb=function(_0x497d8c,_0x2904c9){_0x497d8c=_0x497d8c-0x0;var _0xeafed7=_0x3cb7[_0x497d8c];return _0xeafed7;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x73cb('0x0'),'update'];function createListener(_0x1d074d,_0x346066){return function(_0x236824){_0x346066[_0x73cb('0x1')](_0x1d074d,_0x236824);};}function removeListener(_0x1374a7,_0x3e3503){return function(){UserVoiceQueueRtEvents[_0x73cb('0x2')](_0x1374a7,_0x3e3503);};}exports[_0x73cb('0x3')]=function(_0x574e69){for(var _0x28a10b=0x0,_0x28c95e=events[_0x73cb('0x4')];_0x28a10b<_0x28c95e;_0x28a10b++){var _0x2319d0=events[_0x28a10b];var _0x40d9d2=createListener('userVoiceQueueRt:'+_0x2319d0,_0x574e69);UserVoiceQueueRtEvents['on'](_0x2319d0,_0x40d9d2);}}; \ No newline at end of file +var _0xacd6=['emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xacd6,0xef));var _0x6acd=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xacd6[_0x497b1e];return _0x3f72e1;};'use strict';var UserVoiceQueueRtEvents=require(_0x6acd('0x0'));var events=[_0x6acd('0x1'),_0x6acd('0x2'),_0x6acd('0x3')];function createListener(_0x339d03,_0x395606){return function(_0x27beed){_0x395606[_0x6acd('0x4')](_0x339d03,_0x27beed);};}function removeListener(_0xac184f,_0x34bae2){return function(){UserVoiceQueueRtEvents[_0x6acd('0x5')](_0xac184f,_0x34bae2);};}exports[_0x6acd('0x6')]=function(_0x592d42){for(var _0x115a7b=0x0,_0x1c6c37=events[_0x6acd('0x7')];_0x115a7b<_0x1c6c37;_0x115a7b++){var _0x9dec1e=events[_0x115a7b];var _0x1b834a=createListener(_0x6acd('0x8')+_0x9dec1e,_0x592d42);UserVoiceQueueRtEvents['on'](_0x9dec1e,_0x1b834a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1cda8f5..756c164 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x15395c,_0x1751a2){var _0x8cfff5=function(_0x2a6b95){while(--_0x2a6b95){_0x15395c['push'](_0x15395c['shift']());}};_0x8cfff5(++_0x1751a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index ca42501..7a510e0 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 _0x7118=['sequelize','exports','INTEGER'];(function(_0x3a2cf1,_0x2faa77){var _0x31f411=function(_0xfc8ae7){while(--_0xfc8ae7){_0x3a2cf1['push'](_0x3a2cf1['shift']());}};_0x31f411(++_0x2faa77);}(_0x7118,0xb7));var _0x8711=function(_0x3efd2d,_0x246efb){_0x3efd2d=_0x3efd2d-0x0;var _0x3e9007=_0x7118[_0x3efd2d];return _0x3e9007;};'use strict';var Sequelize=require(_0x8711('0x0'));module[_0x8711('0x1')]={'penalty':{'type':Sequelize[_0x8711('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcf1d=['INTEGER','sequelize'];(function(_0x840106,_0x59c538){var _0x41edcd=function(_0x4c1dc1){while(--_0x4c1dc1){_0x840106['push'](_0x840106['shift']());}};_0x41edcd(++_0x59c538);}(_0xcf1d,0x143));var _0xdcf1=function(_0x328920,_0x5ab752){_0x328920=_0x328920-0x0;var _0x3018a8=_0xcf1d[_0x328920];return _0x3018a8;};'use strict';var Sequelize=require(_0xdcf1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdcf1('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 f530103..00d0971 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 _0x7df4=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment','request-promise','path','../../config/environment'];(function(_0x49f722,_0x19698f){var _0x623e55=function(_0x1400d0){while(--_0x1400d0){_0x49f722['push'](_0x49f722['shift']());}};_0x623e55(++_0x19698f);}(_0x7df4,0x10d));var _0x47df=function(_0x18cebb,_0x19503d){_0x18cebb=_0x18cebb-0x0;var _0x27b789=_0x7df4[_0x18cebb];return _0x27b789;};'use strict';var _=require(_0x47df('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x47df('0x1'));var moment=require(_0x47df('0x2'));var BPromise=require('bluebird');var rp=require(_0x47df('0x3'));var fs=require('fs');var path=require(_0x47df('0x4'));var rimraf=require('rimraf');var config=require(_0x47df('0x5'));var attributes=require(_0x47df('0x6'));module[_0x47df('0x7')]=function(_0x57dc42,_0x19d4ee){return _0x57dc42[_0x47df('0x8')](_0x47df('0x9'),attributes,{'tableName':_0x47df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7492=['bluebird','request-promise','rimraf','../../config/environment','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment'];(function(_0x3dfb56,_0xfe844d){var _0x5e6e1b=function(_0x4e002f){while(--_0x4e002f){_0x3dfb56['push'](_0x3dfb56['shift']());}};_0x5e6e1b(++_0xfe844d);}(_0x7492,0x1c9));var _0x2749=function(_0x2d9b7c,_0x181125){_0x2d9b7c=_0x2d9b7c-0x0;var _0x4d4fe2=_0x7492[_0x2d9b7c];return _0x4d4fe2;};'use strict';var _=require(_0x2749('0x0'));var util=require('util');var logger=require(_0x2749('0x1'))('api');var moment=require(_0x2749('0x2'));var BPromise=require(_0x2749('0x3'));var rp=require(_0x2749('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2749('0x5'));var config=require(_0x2749('0x6'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x3e77f4,_0x2c7abf){return _0x3e77f4[_0x2749('0x7')](_0x2749('0x8'),attributes,{'tableName':_0x2749('0x9'),'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 130dade..fb83ea9 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 _0x3d89=['http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','moment','randomstring','ioredis','../../mysqldb','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d89,0x17b));var _0x93d8=function(_0xbd2d70,_0x177eb3){_0xbd2d70=_0xbd2d70-0x0;var _0x18da1b=_0x3d89[_0xbd2d70];return _0x18da1b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x93d8('0x0'));var BPromise=require('bluebird');var rs=require(_0x93d8('0x1'));var fs=require('fs');var Redis=require(_0x93d8('0x2'));var db=require(_0x93d8('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x93d8('0x4'));var client=jayson['client'][_0x93d8('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x559b93,_0x5e9131,_0xbe8bb3){return new BPromise(function(_0x3cc308,_0x7cbd97){return client[_0x93d8('0x6')](_0x559b93,_0xbe8bb3)[_0x93d8('0x7')](function(_0x5d85c3){logger[_0x93d8('0x8')](_0x93d8('0x9'),_0x5e9131,_0x93d8('0xa'));logger[_0x93d8('0xb')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5e9131,'request\x20sent',JSON[_0x93d8('0xc')](_0x5d85c3));if(_0x5d85c3['error']){if(_0x5d85c3[_0x93d8('0xd')]['code']===0x1f4){logger[_0x93d8('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5e9131,_0x5d85c3['error']['message']);return _0x7cbd97(_0x5d85c3[_0x93d8('0xd')][_0x93d8('0xe')]);}logger[_0x93d8('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5e9131,_0x5d85c3[_0x93d8('0xd')][_0x93d8('0xe')]);return _0x3cc308(_0x5d85c3[_0x93d8('0xd')][_0x93d8('0xe')]);}else{logger[_0x93d8('0x8')](_0x93d8('0x9'),_0x5e9131,_0x93d8('0xa'));_0x3cc308(_0x5d85c3['result']['message']);}})[_0x93d8('0xf')](function(_0x538770){logger[_0x93d8('0xd')](_0x93d8('0x9'),_0x5e9131,_0x538770);_0x7cbd97(_0x538770);});});} \ No newline at end of file +var _0x7df4=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7df4,0xb6));var _0x47df=function(_0x2de4b8,_0x43cc7e){_0x2de4b8=_0x2de4b8-0x0;var _0x2af84e=_0x7df4[_0x2de4b8];return _0x2af84e;};'use strict';var _=require(_0x47df('0x0'));var util=require(_0x47df('0x1'));var moment=require(_0x47df('0x2'));var BPromise=require('bluebird');var rs=require(_0x47df('0x3'));var fs=require('fs');var Redis=require(_0x47df('0x4'));var db=require(_0x47df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47df('0x6'))(_0x47df('0x7'));var config=require(_0x47df('0x8'));var jayson=require(_0x47df('0x9'));var client=jayson[_0x47df('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29f882,_0x2e99df,_0x515ea8){return new BPromise(function(_0x476618,_0x5acaf5){return client[_0x47df('0xb')](_0x29f882,_0x515ea8)[_0x47df('0xc')](function(_0x4a4fc9){logger[_0x47df('0xd')](_0x47df('0xe'),_0x2e99df,_0x47df('0xf'));logger[_0x47df('0x10')](_0x47df('0x11'),_0x2e99df,_0x47df('0xf'),JSON[_0x47df('0x12')](_0x4a4fc9));if(_0x4a4fc9[_0x47df('0x13')]){if(_0x4a4fc9[_0x47df('0x13')]['code']===0x1f4){logger[_0x47df('0x13')](_0x47df('0xe'),_0x2e99df,_0x4a4fc9[_0x47df('0x13')][_0x47df('0x14')]);return _0x5acaf5(_0x4a4fc9[_0x47df('0x13')]['message']);}logger[_0x47df('0x13')](_0x47df('0xe'),_0x2e99df,_0x4a4fc9[_0x47df('0x13')][_0x47df('0x14')]);return _0x476618(_0x4a4fc9[_0x47df('0x13')]['message']);}else{logger['info'](_0x47df('0xe'),_0x2e99df,_0x47df('0xf'));_0x476618(_0x4a4fc9[_0x47df('0x15')]['message']);}})[_0x47df('0x16')](function(_0x1f7ba3){logger[_0x47df('0x13')](_0x47df('0xe'),_0x2e99df,_0x1f7ba3);_0x5acaf5(_0x1f7ba3);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 3eedc4d..371649d 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 _0xf23b=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','create','put','/:id'];(function(_0x393b1a,_0x37721b){var _0x440b35=function(_0x240602){while(--_0x240602){_0x393b1a['push'](_0x393b1a['shift']());}};_0x440b35(++_0x37721b);}(_0xf23b,0x133));var _0xbf23=function(_0x2c8249,_0x8bacc8){_0x2c8249=_0x2c8249-0x0;var _0x546529=_0xf23b[_0x2c8249];return _0x546529;};'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 _0x639d=['show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x15b461,_0x2efcaa){var _0x55ea91=function(_0x54b573){while(--_0x54b573){_0x15b461['push'](_0x15b461['shift']());}};_0x55ea91(++_0x2efcaa);}(_0x639d,0xbb));var _0xd639=function(_0x165554,_0x3e8500){_0x165554=_0x165554-0x0;var _0x38ea5b=_0x639d[_0x165554];return _0x38ea5b;};'use strict';var multer=require(_0xd639('0x0'));var util=require(_0xd639('0x1'));var path=require(_0xd639('0x2'));var timeout=require('connect-timeout');var express=require(_0xd639('0x3'));var router=express[_0xd639('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd639('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd639('0x6'));var controller=require('./variable.controller');router['get']('/',auth[_0xd639('0x7')](),controller[_0xd639('0x8')]);router[_0xd639('0x9')](_0xd639('0xa'),auth[_0xd639('0x7')](),controller[_0xd639('0xb')]);router[_0xd639('0xc')]('/',auth[_0xd639('0x7')](),controller['create']);router[_0xd639('0xd')](_0xd639('0xa'),auth[_0xd639('0x7')](),controller[_0xd639('0xe')]);router[_0xd639('0xf')](_0xd639('0xa'),auth[_0xd639('0x7')](),controller[_0xd639('0x10')]);module[_0xd639('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8d7e3b6..d26806c 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 _0x3e68=['sequelize','name'];(function(_0x1a59e2,_0x697329){var _0x2235db=function(_0x30626a){while(--_0x30626a){_0x1a59e2['push'](_0x1a59e2['shift']());}};_0x2235db(++_0x697329);}(_0x3e68,0x190));var _0x83e6=function(_0x3a72db,_0xcf0f78){_0x3a72db=_0x3a72db-0x0;var _0x2ec747=_0x3e68[_0x3a72db];return _0x2ec747;};'use strict';var Sequelize=require(_0x83e6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x83e6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3cb0=['STRING','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3cb0,0x123));var _0x03cb=function(_0xc48f8,_0x455841){_0xc48f8=_0xc48f8-0x0;var _0x15a79c=_0x3cb0[_0xc48f8];return _0x15a79c;};'use strict';var Sequelize=require('sequelize');module[_0x03cb('0x0')]={'name':{'type':Sequelize[_0x03cb('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x03cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d515f11..502f8ca 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 _0xcfc9=['rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','get','Variables','error','stack','name','send','index','map','Variable'];(function(_0x3d9f90,_0x45d21e){var _0x3e3e63=function(_0x4b79bd){while(--_0x4b79bd){_0x3d9f90['push'](_0x3d9f90['shift']());}};_0x3e3e63(++_0x45d21e);}(_0xcfc9,0xc6));var _0x9cfc=function(_0x20442f,_0x3afb19){_0x20442f=_0x20442f-0x0;var _0x24eda7=_0xcfc9[_0x20442f];return _0x24eda7;};'use strict';var emlformat=require(_0x9cfc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9cfc('0x1'));var jsonpatch=require(_0x9cfc('0x2'));var rp=require(_0x9cfc('0x3'));var moment=require(_0x9cfc('0x4'));var BPromise=require(_0x9cfc('0x5'));var Mustache=require(_0x9cfc('0x6'));var util=require(_0x9cfc('0x7'));var path=require('path');var sox=require(_0x9cfc('0x8'));var csv=require(_0x9cfc('0x9'));var ejs=require(_0x9cfc('0xa'));var fs=require('fs');var fs_extra=require(_0x9cfc('0xb'));var _=require(_0x9cfc('0xc'));var squel=require(_0x9cfc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9cfc('0xe'));var toCsv=require(_0x9cfc('0x9'));var querystring=require(_0x9cfc('0xf'));var Papa=require(_0x9cfc('0x10'));var Redis=require(_0x9cfc('0x11'));var authService=require(_0x9cfc('0x12'));var qs=require(_0x9cfc('0x13'));var as=require(_0x9cfc('0x14'));var hardwareService=require(_0x9cfc('0x15'));var logger=require(_0x9cfc('0x16'))(_0x9cfc('0x17'));var utils=require(_0x9cfc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9cfc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x69c64b,_0x2d77dd){_0x2d77dd=_0x2d77dd||0xcc;return function(_0x10bd60){if(_0x10bd60){return _0x69c64b[_0x9cfc('0x1a')](_0x2d77dd);}return _0x69c64b[_0x9cfc('0x1b')](_0x2d77dd)[_0x9cfc('0x1c')]();};}function respondWithResult(_0x721efb,_0x153958){_0x153958=_0x153958||0xc8;return function(_0x383e00){if(_0x383e00){return _0x721efb[_0x9cfc('0x1b')](_0x153958)[_0x9cfc('0x1d')](_0x383e00);}};}function respondWithFilteredResult(_0x58da04,_0x699719){return function(_0x37fea9){if(_0x37fea9){var _0x5cde1e=typeof _0x699719['offset']===_0x9cfc('0x1e')&&typeof _0x699719[_0x9cfc('0x1f')]===_0x9cfc('0x1e');var _0x4363f4=_0x37fea9[_0x9cfc('0x20')];var _0x4d6a8d=_0x5cde1e?0x0:_0x699719[_0x9cfc('0x21')];var _0x365d24=_0x5cde1e?_0x37fea9['count']:_0x699719[_0x9cfc('0x21')]+_0x699719[_0x9cfc('0x1f')];var _0xb505f2;if(_0x365d24>=_0x4363f4){_0x365d24=_0x4363f4;_0xb505f2=0xc8;}else{_0xb505f2=0xce;}_0x58da04[_0x9cfc('0x1b')](_0xb505f2);return _0x58da04['set']('Content-Range',_0x4d6a8d+'-'+_0x365d24+'/'+_0x4363f4)[_0x9cfc('0x1d')](_0x37fea9);}return null;};}function patchUpdates(_0x155bfb){return function(_0x4f04da){try{jsonpatch[_0x9cfc('0x22')](_0x4f04da,_0x155bfb,!![]);}catch(_0x2d43d8){return BPromise[_0x9cfc('0x23')](_0x2d43d8);}return _0x4f04da[_0x9cfc('0x24')]();};}function saveUpdates(_0x329d32,_0x7135d7){return function(_0x5ad1a0){if(_0x5ad1a0){return _0x5ad1a0[_0x9cfc('0x25')](_0x329d32)[_0x9cfc('0x26')](function(_0x1c32d3){return _0x1c32d3;});}return null;};}function removeEntity(_0x2b9a6a,_0x28ae6d){return function(_0x1baa9f){if(_0x1baa9f){return _0x1baa9f['destroy']()['then'](function(){var _0x127a30=_0x1baa9f[_0x9cfc('0x27')]({'plain':!![]});var _0x3b9859=_0x9cfc('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b9859,'resourceId':_0x127a30['id']}})['then'](function(){return _0x1baa9f;});})[_0x9cfc('0x26')](function(){_0x2b9a6a[_0x9cfc('0x1b')](0xcc)[_0x9cfc('0x1c')]();});}};}function handleEntityNotFound(_0x2d5b47,_0x10f5af){return function(_0x191b95){if(!_0x191b95){_0x2d5b47['sendStatus'](0x194);}return _0x191b95;};}function handleError(_0x2b1952,_0x476fbf){_0x476fbf=_0x476fbf||0x1f4;return function(_0x50448a){logger[_0x9cfc('0x29')](_0x50448a[_0x9cfc('0x2a')]);if(_0x50448a[_0x9cfc('0x2b')]){delete _0x50448a[_0x9cfc('0x2b')];}_0x2b1952['status'](_0x476fbf)[_0x9cfc('0x2c')](_0x50448a);};}exports[_0x9cfc('0x2d')]=function(_0x3c088e,_0x54f8a0){var _0x17f4bf={},_0xc89963={},_0x36cc91={'count':0x0,'rows':[]};var _0x3a5fca=_[_0x9cfc('0x2e')](db[_0x9cfc('0x2f')][_0x9cfc('0x30')],function(_0x3909aa){return{'name':_0x3909aa[_0x9cfc('0x31')],'type':_0x3909aa[_0x9cfc('0x32')]['key']};});_0xc89963[_0x9cfc('0x33')]=_[_0x9cfc('0x2e')](_0x3a5fca,_0x9cfc('0x2b'));_0xc89963['query']=_[_0x9cfc('0x34')](_0x3c088e[_0x9cfc('0x35')]);_0xc89963[_0x9cfc('0x36')]=_[_0x9cfc('0x37')](_0xc89963[_0x9cfc('0x33')],_0xc89963[_0x9cfc('0x35')]);_0x17f4bf['attributes']=_[_0x9cfc('0x37')](_0xc89963[_0x9cfc('0x33')],qs[_0x9cfc('0x38')](_0x3c088e[_0x9cfc('0x35')][_0x9cfc('0x38')]));_0x17f4bf['attributes']=_0x17f4bf[_0x9cfc('0x39')][_0x9cfc('0x3a')]?_0x17f4bf[_0x9cfc('0x39')]:_0xc89963[_0x9cfc('0x33')];if(!_0x3c088e[_0x9cfc('0x35')][_0x9cfc('0x3b')](_0x9cfc('0x3c'))){_0x17f4bf[_0x9cfc('0x1f')]=qs['limit'](_0x3c088e[_0x9cfc('0x35')][_0x9cfc('0x1f')]);_0x17f4bf['offset']=qs[_0x9cfc('0x21')](_0x3c088e['query'][_0x9cfc('0x21')]);}_0x17f4bf[_0x9cfc('0x3d')]=qs[_0x9cfc('0x3e')](_0x3c088e[_0x9cfc('0x35')][_0x9cfc('0x3e')]);_0x17f4bf[_0x9cfc('0x3f')]=qs[_0x9cfc('0x36')](_['pick'](_0x3c088e[_0x9cfc('0x35')],_0xc89963['filters']),_0x3a5fca);if(_0x3c088e[_0x9cfc('0x35')][_0x9cfc('0x40')]){_0x17f4bf[_0x9cfc('0x3f')]=_[_0x9cfc('0x41')](_0x17f4bf[_0x9cfc('0x3f')],{'$or':_['map'](_0x3a5fca,function(_0x16ef84){if(_0x16ef84['type']!==_0x9cfc('0x42')){var _0x3a56bb={};_0x3a56bb[_0x16ef84[_0x9cfc('0x2b')]]={'$like':'%'+_0x3c088e[_0x9cfc('0x35')][_0x9cfc('0x40')]+'%'};return _0x3a56bb;}})});}_0x17f4bf=_[_0x9cfc('0x41')]({},_0x17f4bf,_0x3c088e['options']);var _0xa2fc0d={'where':_0x17f4bf[_0x9cfc('0x3f')]};return db[_0x9cfc('0x2f')][_0x9cfc('0x20')](_0xa2fc0d)[_0x9cfc('0x26')](function(_0x1f1d95){_0x36cc91[_0x9cfc('0x20')]=_0x1f1d95;if(_0x3c088e[_0x9cfc('0x35')][_0x9cfc('0x43')]){_0x17f4bf[_0x9cfc('0x44')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x17f4bf);})[_0x9cfc('0x26')](function(_0x206284){_0x36cc91[_0x9cfc('0x45')]=_0x206284;return _0x36cc91;})[_0x9cfc('0x26')](respondWithFilteredResult(_0x54f8a0,_0x17f4bf))[_0x9cfc('0x46')](handleError(_0x54f8a0,null));};exports[_0x9cfc('0x47')]=function(_0x1b7d25,_0x4db234){var _0x387fe3={'raw':!![],'where':{'id':_0x1b7d25['params']['id']}},_0x34ffe5={};_0x34ffe5[_0x9cfc('0x33')]=_[_0x9cfc('0x34')](db[_0x9cfc('0x2f')]['rawAttributes']);_0x34ffe5[_0x9cfc('0x35')]=_['keys'](_0x1b7d25[_0x9cfc('0x35')]);_0x34ffe5[_0x9cfc('0x36')]=_[_0x9cfc('0x37')](_0x34ffe5[_0x9cfc('0x33')],_0x34ffe5[_0x9cfc('0x35')]);_0x387fe3['attributes']=_['intersection'](_0x34ffe5[_0x9cfc('0x33')],qs['fields'](_0x1b7d25['query']['fields']));_0x387fe3[_0x9cfc('0x39')]=_0x387fe3[_0x9cfc('0x39')]['length']?_0x387fe3[_0x9cfc('0x39')]:_0x34ffe5[_0x9cfc('0x33')];if(_0x1b7d25[_0x9cfc('0x35')]['includeAll']){_0x387fe3[_0x9cfc('0x44')]=[{'all':!![]}];}_0x387fe3=_[_0x9cfc('0x41')]({},_0x387fe3,_0x1b7d25['options']);return db[_0x9cfc('0x2f')][_0x9cfc('0x48')](_0x387fe3)['then'](handleEntityNotFound(_0x4db234,null))[_0x9cfc('0x26')](respondWithResult(_0x4db234,null))[_0x9cfc('0x46')](handleError(_0x4db234,null));};exports[_0x9cfc('0x49')]=function(_0x1776e4,_0x3a6710){return db[_0x9cfc('0x2f')][_0x9cfc('0x49')](_0x1776e4[_0x9cfc('0x4a')],{})[_0x9cfc('0x26')](function(_0x2be6cd){var _0x43a885=_0x1776e4[_0x9cfc('0x4b')][_0x9cfc('0x27')]({'plain':!![]});if(!_0x43a885)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43a885[_0x9cfc('0x4c')]===_0x9cfc('0x4b')){var _0x3dff5e=_0x2be6cd[_0x9cfc('0x27')]({'plain':!![]});var _0x48f705=_0x9cfc('0x28');return db['UserProfileSection'][_0x9cfc('0x48')]({'where':{'name':_0x48f705,'userProfileId':_0x43a885[_0x9cfc('0x4d')]},'raw':!![]})[_0x9cfc('0x26')](function(_0x5f38f8){if(_0x5f38f8&&_0x5f38f8[_0x9cfc('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3dff5e[_0x9cfc('0x2b')],'resourceId':_0x3dff5e['id'],'type':_0x5f38f8[_0x9cfc('0x2b')],'sectionId':_0x5f38f8['id']},{})[_0x9cfc('0x26')](function(){return _0x2be6cd;});}else{return _0x2be6cd;}})[_0x9cfc('0x46')](function(_0x1e5d73){logger[_0x9cfc('0x29')](_0x9cfc('0x4f'),_0x1e5d73);throw _0x1e5d73;});}return _0x2be6cd;})[_0x9cfc('0x26')](respondWithResult(_0x3a6710,0xc9))['catch'](handleError(_0x3a6710,null));};exports[_0x9cfc('0x25')]=function(_0x5bb2ad,_0x52679d){if(_0x5bb2ad[_0x9cfc('0x4a')]['id']){delete _0x5bb2ad[_0x9cfc('0x4a')]['id'];}return db[_0x9cfc('0x2f')]['find']({'where':{'id':_0x5bb2ad['params']['id']}})['then'](handleEntityNotFound(_0x52679d,null))['then'](saveUpdates(_0x5bb2ad[_0x9cfc('0x4a')],null))[_0x9cfc('0x26')](respondWithResult(_0x52679d,null))[_0x9cfc('0x46')](handleError(_0x52679d,null));};exports[_0x9cfc('0x50')]=function(_0x44423d,_0x949979){return db[_0x9cfc('0x2f')][_0x9cfc('0x48')]({'where':{'id':_0x44423d[_0x9cfc('0x51')]['id']}})[_0x9cfc('0x26')](handleEntityNotFound(_0x949979,null))['then'](removeEntity(_0x949979,null))['catch'](handleError(_0x949979,null));}; \ No newline at end of file +var _0x8748=['name','send','index','Variable','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','map','filter','merge','options','findAll','rows','catch','show','params','rawAttributes','filters','length','includeAll','find','create','user','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','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','sendStatus','stack'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x8748,0xd2));var _0x8874=function(_0x3dbed2,_0x41f015){_0x3dbed2=_0x3dbed2-0x0;var _0x336542=_0x8748[_0x3dbed2];return _0x336542;};'use strict';var emlformat=require(_0x8874('0x0'));var rimraf=require(_0x8874('0x1'));var zipdir=require(_0x8874('0x2'));var jsonpatch=require(_0x8874('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8874('0x4'));var Mustache=require(_0x8874('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8874('0x6'));var csv=require('to-csv');var ejs=require(_0x8874('0x7'));var fs=require('fs');var fs_extra=require(_0x8874('0x8'));var _=require(_0x8874('0x9'));var squel=require(_0x8874('0xa'));var crypto=require(_0x8874('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8874('0xc'));var querystring=require(_0x8874('0xd'));var Papa=require(_0x8874('0xe'));var Redis=require(_0x8874('0xf'));var authService=require(_0x8874('0x10'));var qs=require(_0x8874('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8874('0x12'));var logger=require('../../config/logger')(_0x8874('0x13'));var utils=require(_0x8874('0x14'));var config=require(_0x8874('0x15'));var licenseUtil=require(_0x8874('0x16'));var db=require(_0x8874('0x17'))['db'];function respondWithStatusCode(_0x232203,_0x183ff4){_0x183ff4=_0x183ff4||0xcc;return function(_0x132bcf){if(_0x132bcf){return _0x232203['sendStatus'](_0x183ff4);}return _0x232203[_0x8874('0x18')](_0x183ff4)[_0x8874('0x19')]();};}function respondWithResult(_0x1b37c6,_0x462d1f){_0x462d1f=_0x462d1f||0xc8;return function(_0x5047b3){if(_0x5047b3){return _0x1b37c6[_0x8874('0x18')](_0x462d1f)[_0x8874('0x1a')](_0x5047b3);}};}function respondWithFilteredResult(_0x402f1b,_0x31c71e){return function(_0x1e306a){if(_0x1e306a){var _0x139c9c=typeof _0x31c71e[_0x8874('0x1b')]==='undefined'&&typeof _0x31c71e[_0x8874('0x1c')]===_0x8874('0x1d');var _0x3190fd=_0x1e306a['count'];var _0x42e50c=_0x139c9c?0x0:_0x31c71e['offset'];var _0x211a4e=_0x139c9c?_0x1e306a[_0x8874('0x1e')]:_0x31c71e['offset']+_0x31c71e[_0x8874('0x1c')];var _0x4200f9;if(_0x211a4e>=_0x3190fd){_0x211a4e=_0x3190fd;_0x4200f9=0xc8;}else{_0x4200f9=0xce;}_0x402f1b[_0x8874('0x18')](_0x4200f9);return _0x402f1b[_0x8874('0x1f')](_0x8874('0x20'),_0x42e50c+'-'+_0x211a4e+'/'+_0x3190fd)['json'](_0x1e306a);}return null;};}function patchUpdates(_0x44ac31){return function(_0x12b04b){try{jsonpatch['apply'](_0x12b04b,_0x44ac31,!![]);}catch(_0x4cf3cf){return BPromise[_0x8874('0x21')](_0x4cf3cf);}return _0x12b04b[_0x8874('0x22')]();};}function saveUpdates(_0x5d919d,_0xa53932){return function(_0x5db696){if(_0x5db696){return _0x5db696[_0x8874('0x23')](_0x5d919d)[_0x8874('0x24')](function(_0x17313c){return _0x17313c;});}return null;};}function removeEntity(_0x5c47b7,_0x2c2f3a){return function(_0x5e0299){if(_0x5e0299){return _0x5e0299['destroy']()['then'](function(){var _0x3ac579=_0x5e0299[_0x8874('0x25')]({'plain':!![]});var _0x6ebfa5='Variables';return db[_0x8874('0x26')][_0x8874('0x27')]({'where':{'type':_0x6ebfa5,'resourceId':_0x3ac579['id']}})['then'](function(){return _0x5e0299;});})[_0x8874('0x24')](function(){_0x5c47b7[_0x8874('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0312,_0x5e4b56){return function(_0x13b2ee){if(!_0x13b2ee){_0x5b0312[_0x8874('0x28')](0x194);}return _0x13b2ee;};}function handleError(_0x49bac8,_0x5e615b){_0x5e615b=_0x5e615b||0x1f4;return function(_0x5d1530){logger['error'](_0x5d1530[_0x8874('0x29')]);if(_0x5d1530['name']){delete _0x5d1530[_0x8874('0x2a')];}_0x49bac8[_0x8874('0x18')](_0x5e615b)[_0x8874('0x2b')](_0x5d1530);};}exports[_0x8874('0x2c')]=function(_0x1a48ed,_0x1d7530){var _0x44f0ae={},_0x26ad1f={},_0x2a5e26={'count':0x0,'rows':[]};var _0x4432d8=_['map'](db[_0x8874('0x2d')]['rawAttributes'],function(_0x245fd4){return{'name':_0x245fd4[_0x8874('0x2e')],'type':_0x245fd4[_0x8874('0x2f')][_0x8874('0x30')]};});_0x26ad1f[_0x8874('0x31')]=_['map'](_0x4432d8,'name');_0x26ad1f[_0x8874('0x32')]=_[_0x8874('0x33')](_0x1a48ed['query']);_0x26ad1f['filters']=_[_0x8874('0x34')](_0x26ad1f[_0x8874('0x31')],_0x26ad1f[_0x8874('0x32')]);_0x44f0ae[_0x8874('0x35')]=_[_0x8874('0x34')](_0x26ad1f['model'],qs[_0x8874('0x36')](_0x1a48ed[_0x8874('0x32')][_0x8874('0x36')]));_0x44f0ae[_0x8874('0x35')]=_0x44f0ae[_0x8874('0x35')]['length']?_0x44f0ae['attributes']:_0x26ad1f[_0x8874('0x31')];if(!_0x1a48ed[_0x8874('0x32')]['hasOwnProperty'](_0x8874('0x37'))){_0x44f0ae[_0x8874('0x1c')]=qs[_0x8874('0x1c')](_0x1a48ed['query'][_0x8874('0x1c')]);_0x44f0ae['offset']=qs[_0x8874('0x1b')](_0x1a48ed[_0x8874('0x32')][_0x8874('0x1b')]);}_0x44f0ae[_0x8874('0x38')]=qs['sort'](_0x1a48ed[_0x8874('0x32')][_0x8874('0x39')]);_0x44f0ae[_0x8874('0x3a')]=qs['filters'](_[_0x8874('0x3b')](_0x1a48ed[_0x8874('0x32')],_0x26ad1f['filters']),_0x4432d8);if(_0x1a48ed[_0x8874('0x32')]['filter']){_0x44f0ae[_0x8874('0x3a')]=_['merge'](_0x44f0ae['where'],{'$or':_[_0x8874('0x3c')](_0x4432d8,function(_0x2c10b3){if(_0x2c10b3['type']!=='VIRTUAL'){var _0x4a8915={};_0x4a8915[_0x2c10b3['name']]={'$like':'%'+_0x1a48ed['query'][_0x8874('0x3d')]+'%'};return _0x4a8915;}})});}_0x44f0ae=_[_0x8874('0x3e')]({},_0x44f0ae,_0x1a48ed[_0x8874('0x3f')]);var _0x13b97a={'where':_0x44f0ae['where']};return db[_0x8874('0x2d')]['count'](_0x13b97a)['then'](function(_0x7239fd){_0x2a5e26[_0x8874('0x1e')]=_0x7239fd;if(_0x1a48ed[_0x8874('0x32')]['includeAll']){_0x44f0ae['include']=[{'all':!![]}];}return db[_0x8874('0x2d')][_0x8874('0x40')](_0x44f0ae);})['then'](function(_0x369024){_0x2a5e26[_0x8874('0x41')]=_0x369024;return _0x2a5e26;})['then'](respondWithFilteredResult(_0x1d7530,_0x44f0ae))[_0x8874('0x42')](handleError(_0x1d7530,null));};exports[_0x8874('0x43')]=function(_0x3506ea,_0x5c2f2f){var _0xd0d14c={'raw':!![],'where':{'id':_0x3506ea[_0x8874('0x44')]['id']}},_0x498b82={};_0x498b82['model']=_[_0x8874('0x33')](db['Variable'][_0x8874('0x45')]);_0x498b82[_0x8874('0x32')]=_[_0x8874('0x33')](_0x3506ea[_0x8874('0x32')]);_0x498b82[_0x8874('0x46')]=_[_0x8874('0x34')](_0x498b82['model'],_0x498b82['query']);_0xd0d14c[_0x8874('0x35')]=_[_0x8874('0x34')](_0x498b82[_0x8874('0x31')],qs[_0x8874('0x36')](_0x3506ea[_0x8874('0x32')][_0x8874('0x36')]));_0xd0d14c[_0x8874('0x35')]=_0xd0d14c['attributes'][_0x8874('0x47')]?_0xd0d14c[_0x8874('0x35')]:_0x498b82[_0x8874('0x31')];if(_0x3506ea[_0x8874('0x32')][_0x8874('0x48')]){_0xd0d14c['include']=[{'all':!![]}];}_0xd0d14c=_[_0x8874('0x3e')]({},_0xd0d14c,_0x3506ea[_0x8874('0x3f')]);return db[_0x8874('0x2d')][_0x8874('0x49')](_0xd0d14c)[_0x8874('0x24')](handleEntityNotFound(_0x5c2f2f,null))[_0x8874('0x24')](respondWithResult(_0x5c2f2f,null))['catch'](handleError(_0x5c2f2f,null));};exports[_0x8874('0x4a')]=function(_0x54ec96,_0x4219bc){return db[_0x8874('0x2d')][_0x8874('0x4a')](_0x54ec96['body'],{})['then'](function(_0x38e485){var _0x3758dc=_0x54ec96[_0x8874('0x4b')]['get']({'plain':!![]});if(!_0x3758dc)throw new Error(_0x8874('0x4c'));if(_0x3758dc[_0x8874('0x4d')]===_0x8874('0x4b')){var _0x1f9844=_0x38e485[_0x8874('0x25')]({'plain':!![]});var _0x113f8c=_0x8874('0x4e');return db[_0x8874('0x4f')][_0x8874('0x49')]({'where':{'name':_0x113f8c,'userProfileId':_0x3758dc[_0x8874('0x50')]},'raw':!![]})[_0x8874('0x24')](function(_0x493223){if(_0x493223&&_0x493223[_0x8874('0x51')]===0x0){return db[_0x8874('0x26')][_0x8874('0x4a')]({'name':_0x1f9844[_0x8874('0x2a')],'resourceId':_0x1f9844['id'],'type':_0x493223[_0x8874('0x2a')],'sectionId':_0x493223['id']},{})[_0x8874('0x24')](function(){return _0x38e485;});}else{return _0x38e485;}})['catch'](function(_0x2a37c2){logger['error'](_0x8874('0x52'),_0x2a37c2);throw _0x2a37c2;});}return _0x38e485;})[_0x8874('0x24')](respondWithResult(_0x4219bc,0xc9))[_0x8874('0x42')](handleError(_0x4219bc,null));};exports[_0x8874('0x23')]=function(_0x42c882,_0x2c5496){if(_0x42c882[_0x8874('0x53')]['id']){delete _0x42c882[_0x8874('0x53')]['id'];}return db[_0x8874('0x2d')]['find']({'where':{'id':_0x42c882[_0x8874('0x44')]['id']}})[_0x8874('0x24')](handleEntityNotFound(_0x2c5496,null))[_0x8874('0x24')](saveUpdates(_0x42c882[_0x8874('0x53')],null))[_0x8874('0x24')](respondWithResult(_0x2c5496,null))[_0x8874('0x42')](handleError(_0x2c5496,null));};exports[_0x8874('0x27')]=function(_0x28ea8c,_0x3cada8){return db[_0x8874('0x2d')][_0x8874('0x49')]({'where':{'id':_0x28ea8c[_0x8874('0x44')]['id']}})[_0x8874('0x24')](handleEntityNotFound(_0x3cada8,null))[_0x8874('0x24')](removeEntity(_0x3cada8,null))['catch'](handleError(_0x3cada8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3e4d2cd..916c4da 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 _0x86cb=['request-promise','path','rimraf','./variable.attributes','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5bfb00,_0x52ffc4){var _0x24885f=function(_0x422009){while(--_0x422009){_0x5bfb00['push'](_0x5bfb00['shift']());}};_0x24885f(++_0x52ffc4);}(_0x86cb,0x1b7));var _0xb86c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x86cb[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xb86c('0x0'));var util=require('util');var logger=require(_0xb86c('0x1'))(_0xb86c('0x2'));var moment=require(_0xb86c('0x3'));var BPromise=require(_0xb86c('0x4'));var rp=require(_0xb86c('0x5'));var fs=require('fs');var path=require(_0xb86c('0x6'));var rimraf=require(_0xb86c('0x7'));var config=require('../../config/environment');var attributes=require(_0xb86c('0x8'));module[_0xb86c('0x9')]=function(_0x5cf342,_0x28157){return _0x5cf342[_0xb86c('0xa')]('Variable',attributes,{'tableName':_0xb86c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x865e=['Variable','tools_variables','lodash','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x34e747,_0x173163){var _0x200a90=function(_0x2cfb42){while(--_0x2cfb42){_0x34e747['push'](_0x34e747['shift']());}};_0x200a90(++_0x173163);}(_0x865e,0x11a));var _0xe865=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x865e[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xe865('0x0'));var util=require(_0xe865('0x1'));var logger=require('../../config/logger')(_0xe865('0x2'));var moment=require(_0xe865('0x3'));var BPromise=require(_0xe865('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe865('0x5'));var rimraf=require(_0xe865('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xe865('0x7')]=function(_0xf90fd7,_0x34ecb6){return _0xf90fd7['define'](_0xe865('0x8'),attributes,{'tableName':_0xe865('0x9'),'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 a14ea3b..81acdcb 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x25a9c3,_0x2e643d){var _0x5b12cd=function(_0x27d543){while(--_0x27d543){_0x25a9c3['push'](_0x25a9c3['shift']());}};_0x5b12cd(++_0x2e643d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x41ed13,_0x1044be){_0x41ed13=_0x41ed13-0x0;var _0x1bb4d5=_0x7fbe[_0x41ed13];return _0x1bb4d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xa41a,0x6b));var _0xaa41=function(_0xfa24ef,_0x4ae5eb){_0xfa24ef=_0xfa24ef-0x0;var _0x11232e=_0xa41a[_0xfa24ef];return _0x11232e;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7933f3e..8347098 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 _0xeb07=['/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','restart'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb07,0x157));var _0x7eb0=function(_0x52cd33,_0x451f1c){_0x52cd33=_0x52cd33-0x0;var _0x404649=_0xeb07[_0x52cd33];return _0x404649;};'use strict';var express=require(_0x7eb0('0x0'));var router=express[_0x7eb0('0x1')]();var auth=require(_0x7eb0('0x2'));var controller=require(_0x7eb0('0x3'));router[_0x7eb0('0x4')]('/',controller['index']);router[_0x7eb0('0x4')](_0x7eb0('0x5'),auth[_0x7eb0('0x6')](),auth['canUpdate'](),controller[_0x7eb0('0x7')]);router[_0x7eb0('0x4')](_0x7eb0('0x8'),auth[_0x7eb0('0x6')](),auth[_0x7eb0('0x9')](),controller[_0x7eb0('0xa')]);router['get'](_0x7eb0('0xb'),auth[_0x7eb0('0x6')](),auth[_0x7eb0('0x9')](),controller[_0x7eb0('0xc')]);router[_0x7eb0('0x4')]('/restart',auth[_0x7eb0('0x6')](),controller[_0x7eb0('0xd')]);router[_0x7eb0('0x4')](_0x7eb0('0xe'),controller[_0x7eb0('0xf')]);module[_0x7eb0('0x10')]=router; \ No newline at end of file +var _0x8915=['migrations','exports','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','/restart','restart'];(function(_0x22920d,_0x29e1ef){var _0x1c1711=function(_0x5761b0){while(--_0x5761b0){_0x22920d['push'](_0x22920d['shift']());}};_0x1c1711(++_0x29e1ef);}(_0x8915,0x102));var _0x5891=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x8915[_0x1b4b23];return _0x2a325b;};'use strict';var express=require(_0x5891('0x0'));var router=express[_0x5891('0x1')]();var auth=require(_0x5891('0x2'));var controller=require('./version.controller');router[_0x5891('0x3')]('/',controller[_0x5891('0x4')]);router[_0x5891('0x3')](_0x5891('0x5'),auth[_0x5891('0x6')](),auth['canUpdate'](),controller[_0x5891('0x7')]);router[_0x5891('0x3')](_0x5891('0x8'),auth[_0x5891('0x6')](),auth[_0x5891('0x9')](),controller[_0x5891('0xa')]);router['get']('/pull',auth['isAuthenticated'](),auth[_0x5891('0x9')](),controller[_0x5891('0xb')]);router[_0x5891('0x3')](_0x5891('0xc'),auth[_0x5891('0x6')](),controller[_0x5891('0xd')]);router['get']('/migrations',controller[_0x5891('0xe')]);module[_0x5891('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b254bc7..d9b2d4f 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 _0x388b=['status','json','origin','info','git\x20fetch','reset','FETCH_HEAD','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','migrations','join','replace','push','sort','Migration','sequelize','getQueryInterface','constructor','server','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0'];(function(_0x5d481d,_0x35f790){var _0x2b1c38=function(_0x1c2758){while(--_0x1c2758){_0x5d481d['push'](_0x5d481d['shift']());}};_0x2b1c38(++_0x35f790);}(_0x388b,0x1c0));var _0xb388=function(_0x40bd56,_0x2491d1){_0x40bd56=_0x40bd56-0x0;var _0x20947d=_0x388b[_0x40bd56];return _0x20947d;};'use strict';var Umzug=require(_0xb388('0x0'));var path=require(_0xb388('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb388('0x2'))(module,_0xb388('0x3'));var compareVersions=require(_0xb388('0x4'));var exec=require(_0xb388('0x5'))[_0xb388('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xb388('0x7'));var pm2=require(_0xb388('0x8'));var logger=require(_0xb388('0x9'))(_0xb388('0xa'));var git=require(_0xb388('0xb'))(config[_0xb388('0xc')]);exports[_0xb388('0xd')]=function(_0xa5761a,_0x4e493c){var _0x53ad4b={'current':module[_0xb388('0xe')][_0xb388('0x3')],'phonebar':0x2};if(_0xa5761a[_0xb388('0xf')]&&_0xa5761a[_0xb388('0xf')][_0xb388('0x10')]){return git[_0xb388('0x11')]()[_0xb388('0x12')](function(_0x2b18e8,_0x279039){_0x53ad4b[_0xb388('0x10')]=(_0x2b18e8?module['exports'][_0xb388('0x3')]:_0x279039['latest'])||_0xb388('0x13');return _0x4e493c[_0xb388('0x14')](0xc8)[_0xb388('0x15')](_0x53ad4b);});}else{return _0x4e493c[_0xb388('0x14')](0xc8)[_0xb388('0x15')](_0x53ad4b);}};exports['fetch']=function(_0x4afbd3,_0x321e48){return git[_0xb388('0x11')]([_0xb388('0x16'),'master'],function(_0x81b91f){if(_0x81b91f){logger['error'](_0x81b91f);return _0x321e48['status'](0x1f4)['json'](_0x81b91f);}logger[_0xb388('0x17')](_0xb388('0x18'));return _0x321e48[_0xb388('0x14')](0xc8)[_0xb388('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xb388('0x19')]=function(_0x41e6d0,_0x3aa4ab){return git[_0xb388('0x19')](['--hard',_0xb388('0x1a')],function(_0xb405f4){if(_0xb405f4){logger[_0xb388('0x1b')](_0xb405f4);return _0x3aa4ab[_0xb388('0x14')](0x1f4)[_0xb388('0x15')](_0xb405f4);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3aa4ab[_0xb388('0x14')](0xc8)[_0xb388('0x15')]({'output':_0xb388('0x1c')});});};exports[_0xb388('0x1d')]=function(_0x54703c,_0x43134f){exec(_0xb388('0x1e'),function(_0x27f0b0,_0x56478e,_0x153978){logger[_0xb388('0x17')](_0x56478e);logger[_0xb388('0x17')](_0x153978);if(_0x27f0b0){logger[_0xb388('0x1b')](_0x27f0b0);return _0x43134f['status'](0x1f4)['json'](_0x27f0b0);}return _0x43134f[_0xb388('0x14')](0xc8)[_0xb388('0x15')]({'output':_0x56478e});});};exports[_0xb388('0x1f')]=function(_0x155996,_0x16d61a){return pm2[_0xb388('0x1f')](_0xb388('0x20'))['then'](function(_0x1feff8){logger[_0xb388('0x17')](_0xb388('0x21'),_0x1feff8);return _0x16d61a['status'](0xc8)[_0xb388('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x2d0250){logger[_0xb388('0x1b')](_0x2d0250);return _0x16d61a[_0xb388('0x14')](0x1f4)[_0xb388('0x15')](_0x2d0250);});};exports[_0xb388('0x22')]=function(_0x41f611,_0x335bb0){var _0x112389=fs['readdirSync'](path[_0xb388('0x23')](config['root'],'server','migrations'));var _0x17450e=[];for(var _0x4f1e54=0x0;_0x4f1e54<_0x112389['length'];_0x4f1e54++){var _0x59b555=_0x112389[_0x4f1e54][_0xb388('0x24')]('.js','');if(compareVersions(module[_0xb388('0xe')]['version'],_0x59b555)===-0x1){_0x17450e[_0xb388('0x25')](_0x59b555);}}if(_0x17450e['length']){var _0x521899=_0x17450e[_0xb388('0x26')](compareVersions);var _0x33ede2=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xb388('0x27')],'modelName':_0xb388('0x27'),'columnName':_0xb388('0x3')},'migrations':{'params':[db[_0xb388('0x28')][_0xb388('0x29')](),db['sequelize'][_0xb388('0x2a')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xb388('0x23')](config[_0xb388('0xc')],_0xb388('0x2b'),'migrations'),'pattern':/\.js$/}});_0x33ede2['up']({'migrations':_[_0xb388('0x2c')](_0x521899,function(_0x16c04b){return _0x16c04b+_0xb388('0x2d');})})[_0xb388('0x2e')](function(){return _0x335bb0[_0xb388('0x14')](0xc8)[_0xb388('0x15')]({'output':_0xb388('0x2f')+module['exports'][_0xb388('0x3')]+_0xb388('0x30')+_[_0xb388('0x31')](_0x521899),'migrations':_['join'](_0x521899)});})['catch'](function(_0x81bcea){if(_0x81bcea instanceof db['sequelize'][_0xb388('0x32')]){return _0x335bb0[_0xb388('0x14')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x335bb0[_0xb388('0x14')](0x1f4)[_0xb388('0x15')](_0x81bcea);}});}else{return _0x335bb0[_0xb388('0x14')](0xc8)[_0xb388('0x15')]({'output':_0xb388('0x33')});}}; \ No newline at end of file +var _0x80d0=['Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','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','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','query','fetch','tags','exports','version','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s'];(function(_0x55e296,_0xc2d880){var _0x30db7e=function(_0x20162b){while(--_0x20162b){_0x55e296['push'](_0x55e296['shift']());}};_0x30db7e(++_0xc2d880);}(_0x80d0,0xbf));var _0x080d=function(_0xf55de8,_0x11b923){_0xf55de8=_0xf55de8-0x0;var _0x16a3d6=_0x80d0[_0xf55de8];return _0x16a3d6;};'use strict';var Umzug=require(_0x080d('0x0'));var path=require(_0x080d('0x1'));var fs=require('fs');var _=require(_0x080d('0x2'));var pkginfo=require(_0x080d('0x3'))(module,'version');var compareVersions=require(_0x080d('0x4'));var exec=require(_0x080d('0x5'))['exec'];var db=require(_0x080d('0x6'))['db'];var config=require(_0x080d('0x7'));var pm2=require(_0x080d('0x8'));var logger=require(_0x080d('0x9'))(_0x080d('0xa'));var git=require(_0x080d('0xb'))(config['root']);exports[_0x080d('0xc')]=function(_0x2d0c9d,_0xbe642b){var _0x44100f={'current':module['exports']['version'],'phonebar':0x2};if(_0x2d0c9d['query']&&_0x2d0c9d[_0x080d('0xd')]['latest']){return git[_0x080d('0xe')]()[_0x080d('0xf')](function(_0x6cf62e,_0xdd1112){_0x44100f['latest']=(_0x6cf62e?module[_0x080d('0x10')][_0x080d('0x11')]:_0xdd1112['latest'])||_0x080d('0x12');return _0xbe642b[_0x080d('0x13')](0xc8)['json'](_0x44100f);});}else{return _0xbe642b['status'](0xc8)[_0x080d('0x14')](_0x44100f);}};exports[_0x080d('0xe')]=function(_0x3aff87,_0x3b995a){return git[_0x080d('0xe')]([_0x080d('0x15'),_0x080d('0x16')],function(_0x5f4515){if(_0x5f4515){logger[_0x080d('0x17')](_0x5f4515);return _0x3b995a['status'](0x1f4)['json'](_0x5f4515);}logger[_0x080d('0x18')](_0x080d('0x19'));return _0x3b995a[_0x080d('0x13')](0xc8)[_0x080d('0x14')]({'output':_0x080d('0x1a')});});};exports[_0x080d('0x1b')]=function(_0x34bf5f,_0x2d9089){return git['reset']([_0x080d('0x1c'),_0x080d('0x1d')],function(_0x207baf){if(_0x207baf){logger[_0x080d('0x17')](_0x207baf);return _0x2d9089[_0x080d('0x13')](0x1f4)[_0x080d('0x14')](_0x207baf);}logger[_0x080d('0x18')](_0x080d('0x1e'));return _0x2d9089['status'](0xc8)['json']({'output':_0x080d('0x1f')});});};exports['pull']=function(_0x322128,_0xd6eb93){exec(_0x080d('0x20'),function(_0x350f4f,_0x10835d,_0x3ac18b){logger[_0x080d('0x18')](_0x10835d);logger['info'](_0x3ac18b);if(_0x350f4f){logger['error'](_0x350f4f);return _0xd6eb93[_0x080d('0x13')](0x1f4)[_0x080d('0x14')](_0x350f4f);}return _0xd6eb93['status'](0xc8)[_0x080d('0x14')]({'output':_0x10835d});});};exports[_0x080d('0x21')]=function(_0x497333,_0x375952){return pm2[_0x080d('0x21')](_0x080d('0x22'))[_0x080d('0x23')](function(_0x20bc1e){logger['info'](_0x080d('0x24'),_0x20bc1e);return _0x375952[_0x080d('0x13')](0xc8)['json']({'output':_0x080d('0x25')});})[_0x080d('0x26')](function(_0xedba4f){logger[_0x080d('0x17')](_0xedba4f);return _0x375952[_0x080d('0x13')](0x1f4)['json'](_0xedba4f);});};exports[_0x080d('0x27')]=function(_0x589955,_0x468520){var _0x25787a=fs[_0x080d('0x28')](path[_0x080d('0x29')](config[_0x080d('0x2a')],_0x080d('0x2b'),_0x080d('0x27')));var _0x4c1ed5=[];for(var _0x2cf341=0x0;_0x2cf341<_0x25787a[_0x080d('0x2c')];_0x2cf341++){var _0x22ec8d=_0x25787a[_0x2cf341][_0x080d('0x2d')]('.js','');if(compareVersions(module[_0x080d('0x10')][_0x080d('0x11')],_0x22ec8d)===-0x1){_0x4c1ed5['push'](_0x22ec8d);}}if(_0x4c1ed5[_0x080d('0x2c')]){var _0xae281b=_0x4c1ed5[_0x080d('0x2e')](compareVersions);var _0x23e06f=new Umzug({'storage':_0x080d('0x2f'),'storageOptions':{'model':db[_0x080d('0x30')],'modelName':_0x080d('0x30'),'columnName':_0x080d('0x11')},'migrations':{'params':[db[_0x080d('0x2f')][_0x080d('0x31')](),db[_0x080d('0x2f')][_0x080d('0x32')],function(){throw new Error(_0x080d('0x33'));}],'path':path[_0x080d('0x29')](config['root'],_0x080d('0x2b'),_0x080d('0x27')),'pattern':/\.js$/}});_0x23e06f['up']({'migrations':_[_0x080d('0x34')](_0xae281b,function(_0x331e4a){return _0x331e4a+'.js';})})[_0x080d('0x23')](function(){return _0x468520[_0x080d('0x13')](0xc8)['json']({'output':_0x080d('0x35')+module['exports'][_0x080d('0x11')]+_0x080d('0x36')+_[_0x080d('0x37')](_0xae281b),'migrations':_[_0x080d('0x29')](_0xae281b)});})[_0x080d('0x26')](function(_0x51d9e3){if(_0x51d9e3 instanceof db[_0x080d('0x2f')]['UniqueConstraintError']){return _0x468520[_0x080d('0x13')](0xc8)[_0x080d('0x14')]({'output':_0x080d('0x38')});}else{return _0x468520[_0x080d('0x13')](0x1f4)['json'](_0x51d9e3);}});}else{return _0x468520[_0x080d('0x13')](0xc8)[_0x080d('0x14')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9f3569a..260e338 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 _0x15e4=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','show','post','put','update','delete','exports','multer'];(function(_0x7b544a,_0x33c45a){var _0x33dcb4=function(_0x5ebc7f){while(--_0x5ebc7f){_0x7b544a['push'](_0x7b544a['shift']());}};_0x33dcb4(++_0x33c45a);}(_0x15e4,0xe3));var _0x415e=function(_0x5ec5d5,_0xfbe071){_0x5ec5d5=_0x5ec5d5-0x0;var _0x58e97d=_0x15e4[_0x5ec5d5];return _0x58e97d;};'use strict';var multer=require(_0x415e('0x0'));var util=require('util');var path=require(_0x415e('0x1'));var timeout=require(_0x415e('0x2'));var express=require(_0x415e('0x3'));var router=express[_0x415e('0x4')]();var fs_extra=require(_0x415e('0x5'));var auth=require(_0x415e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x415e('0x7'));var controller=require(_0x415e('0x8'));router[_0x415e('0x9')]('/',auth[_0x415e('0xa')](),controller['index']);router[_0x415e('0x9')](_0x415e('0xb'),auth[_0x415e('0xa')](),controller['describe']);router[_0x415e('0x9')](_0x415e('0xc'),auth['isAuthenticated'](),controller[_0x415e('0xd')]);router[_0x415e('0xe')]('/',auth[_0x415e('0xa')](),controller['create']);router[_0x415e('0xf')](_0x415e('0xc'),auth[_0x415e('0xa')](),controller[_0x415e('0x10')]);router[_0x415e('0x11')](_0x415e('0xc'),auth[_0x415e('0xa')](),controller['destroy']);module[_0x415e('0x12')]=router; \ No newline at end of file +var _0x6746=['create','put','/:id','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','describe','show','post'];(function(_0x4d58f4,_0x4f0a9d){var _0x5cb110=function(_0x55c95c){while(--_0x55c95c){_0x4d58f4['push'](_0x4d58f4['shift']());}};_0x5cb110(++_0x4f0a9d);}(_0x6746,0x65));var _0x6674=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x6746[_0x2f6541];return _0x4d76d8;};'use strict';var multer=require(_0x6674('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6674('0x1'));var router=express[_0x6674('0x2')]();var fs_extra=require(_0x6674('0x3'));var auth=require(_0x6674('0x4'));var interaction=require(_0x6674('0x5'));var config=require(_0x6674('0x6'));var controller=require(_0x6674('0x7'));router[_0x6674('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x6674('0x9')](),controller[_0x6674('0xa')]);router[_0x6674('0x8')]('/:id',auth[_0x6674('0x9')](),controller[_0x6674('0xb')]);router[_0x6674('0xc')]('/',auth[_0x6674('0x9')](),controller[_0x6674('0xd')]);router[_0x6674('0xe')](_0x6674('0xf'),auth[_0x6674('0x9')](),controller[_0x6674('0x10')]);router[_0x6674('0x11')](_0x6674('0xf'),auth[_0x6674('0x9')](),controller[_0x6674('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 997d370..0261770 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 _0x583c=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x14db94,_0x302e46){var _0x92b7fc=function(_0x48e200){while(--_0x48e200){_0x14db94['push'](_0x14db94['shift']());}};_0x92b7fc(++_0x302e46);}(_0x583c,0x12b));var _0xc583=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x583c[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'type':{'type':Sequelize[_0xc583('0x2')]},'uniqueid':{'type':Sequelize[_0xc583('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc583('0x2')]},'queue':{'type':Sequelize[_0xc583('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc583('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc583('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xc583('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc583('0x3')]},'holdtime':{'type':Sequelize[_0xc583('0x4')]},'agentcomplete':{'type':Sequelize[_0xc583('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc583('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc583('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc583('0x4')]},'reason':{'type':Sequelize[_0xc583('0x2')]},'lastevent':{'type':Sequelize[_0xc583('0x2')]},'channel':{'type':Sequelize[_0xc583('0x2')]},'channelstate':{'type':Sequelize[_0xc583('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc583('0x2')]},'connectedlinename':{'type':Sequelize[_0xc583('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc583('0x2')]},'context':{'type':Sequelize[_0xc583('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc583('0x2')]},'destchannel':{'type':Sequelize[_0xc583('0x2')]},'destchannelstate':{'type':Sequelize[_0xc583('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc583('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc583('0x2')]},'destcalleridname':{'type':Sequelize[_0xc583('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc583('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc583('0x2')]},'destlanguage':{'type':Sequelize[_0xc583('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc583('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc583('0x2')]},'destuniqueid':{'type':Sequelize[_0xc583('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc583('0x2')]},'transfer':{'type':Sequelize[_0xc583('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc583('0x6')},'transferexten':{'type':Sequelize[_0xc583('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xc583('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x80ed=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN'];(function(_0x4cdf63,_0x44485e){var _0x98c42=function(_0x5c926b){while(--_0x5c926b){_0x4cdf63['push'](_0x4cdf63['shift']());}};_0x98c42(++_0x44485e);}(_0x80ed,0x11c));var _0xd80e=function(_0x450dc6,_0x1be963){_0x450dc6=_0x450dc6-0x0;var _0x1eeb68=_0x80ed[_0x450dc6];return _0x1eeb68;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'type':{'type':Sequelize[_0xd80e('0x1')]},'uniqueid':{'type':Sequelize[_0xd80e('0x1')]},'calleridnum':{'type':Sequelize[_0xd80e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd80e('0x1')]},'interface':{'type':Sequelize[_0xd80e('0x1')]},'membername':{'type':Sequelize[_0xd80e('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd80e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xd80e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd80e('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd80e('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd80e('0x4')]},'agentacw':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd80e('0x4')]},'reason':{'type':Sequelize[_0xd80e('0x1')]},'lastevent':{'type':Sequelize[_0xd80e('0x1')]},'channel':{'type':Sequelize[_0xd80e('0x1')]},'channelstate':{'type':Sequelize[_0xd80e('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd80e('0x1')]},'connectedlinename':{'type':Sequelize[_0xd80e('0x1')]},'language':{'type':Sequelize[_0xd80e('0x1')]},'accountcode':{'type':Sequelize[_0xd80e('0x1')]},'context':{'type':Sequelize[_0xd80e('0x1')]},'exten':{'type':Sequelize[_0xd80e('0x1')]},'priority':{'type':Sequelize[_0xd80e('0x1')]},'destchannel':{'type':Sequelize[_0xd80e('0x1')]},'destchannelstate':{'type':Sequelize[_0xd80e('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xd80e('0x1')]},'destlanguage':{'type':Sequelize[_0xd80e('0x1')]},'destaccountcode':{'type':Sequelize[_0xd80e('0x1')]},'destcontext':{'type':Sequelize[_0xd80e('0x1')]},'destexten':{'type':Sequelize[_0xd80e('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd80e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd80e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd80e('0x1')]},'transfer':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd80e('0x1')],'comment':_0xd80e('0x5')},'transferexten':{'type':Sequelize[_0xd80e('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd80e('0x1')]},'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 975d5b6..9ada059 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(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 a7244c1..0d6975c 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 _0xafdd=['exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x162aaa,_0x1936da){var _0x2f8823=function(_0x4268e0){while(--_0x4268e0){_0x162aaa['push'](_0x162aaa['shift']());}};_0x2f8823(++_0x1936da);}(_0xafdd,0x19a));var _0xdafd=function(_0xffa23c,_0x5404c6){_0xffa23c=_0xffa23c-0x0;var _0x421bb1=_0xafdd[_0xffa23c];return _0x421bb1;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var logger=require(_0xdafd('0x2'))(_0xdafd('0x3'));var moment=require(_0xdafd('0x4'));var BPromise=require(_0xdafd('0x5'));var rp=require(_0xdafd('0x6'));var fs=require('fs');var path=require(_0xdafd('0x7'));var rimraf=require('rimraf');var config=require(_0xdafd('0x8'));var attributes=require(_0xdafd('0x9'));module[_0xdafd('0xa')]=function(_0x37f05a,_0xfa4ad6){return _0x37f05a[_0xdafd('0xb')](_0xdafd('0xc'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xdafd('0xd'),_0xdafd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9649=['util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash'];(function(_0x175593,_0x1614d6){var _0x4fe84a=function(_0x2252f2){while(--_0x2252f2){_0x175593['push'](_0x175593['shift']());}};_0x4fe84a(++_0x1614d6);}(_0x9649,0x19f));var _0x9964=function(_0x32edad,_0x5bda8c){_0x32edad=_0x32edad-0x0;var _0xa2a8e2=_0x9649[_0x32edad];return _0xa2a8e2;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9964('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9bd8023..344448a 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 _0xd23a=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','where','attributes','lodash','../../config/utils'];(function(_0x2498b5,_0x514ddb){var _0x5c48d8=function(_0xee9bb5){while(--_0xee9bb5){_0x2498b5['push'](_0x2498b5['shift']());}};_0x5c48d8(++_0x514ddb);}(_0xd23a,0x1eb));var _0xad23=function(_0x7e6bf8,_0x5602fe){_0x7e6bf8=_0x7e6bf8-0x0;var _0xb67c90=_0xd23a[_0x7e6bf8];return _0xb67c90;};'use strict';var _=require(_0xad23('0x0'));var util=require('util');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(_0xad23('0x1'));var logger=require(_0xad23('0x2'))('rpc');var config=require(_0xad23('0x3'));var jayson=require(_0xad23('0x4'));var client=jayson[_0xad23('0x5')][_0xad23('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x586337,_0x27f97f,_0x25488f){return new BPromise(function(_0x12f798,_0x536854){return client[_0xad23('0x7')](_0x586337,_0x25488f)[_0xad23('0x8')](function(_0x4a8654){logger[_0xad23('0x9')]('VoiceAgentReport,\x20%s,\x20%s',_0x27f97f,'request\x20sent');logger[_0xad23('0xa')](_0xad23('0xb'),_0x27f97f,_0xad23('0xc'),JSON[_0xad23('0xd')](_0x4a8654));if(_0x4a8654[_0xad23('0xe')]){if(_0x4a8654[_0xad23('0xe')][_0xad23('0xf')]===0x1f4){logger[_0xad23('0xe')](_0xad23('0x10'),_0x27f97f,_0x4a8654[_0xad23('0xe')][_0xad23('0x11')]);return _0x536854(_0x4a8654[_0xad23('0xe')][_0xad23('0x11')]);}logger[_0xad23('0xe')](_0xad23('0x10'),_0x27f97f,_0x4a8654[_0xad23('0xe')][_0xad23('0x11')]);return _0x12f798(_0x4a8654['error'][_0xad23('0x11')]);}else{logger[_0xad23('0x9')](_0xad23('0x10'),_0x27f97f,'request\x20sent');_0x12f798(_0x4a8654[_0xad23('0x12')][_0xad23('0x11')]);}})[_0xad23('0x13')](function(_0x5e753f){logger[_0xad23('0xe')](_0xad23('0x10'),_0x27f97f,_0x5e753f);_0x536854(_0x5e753f);});});}exports[_0xad23('0x14')]=function(_0x96b6ca){var _0x539905=this;return new Promise(function(_0x46ffe8,_0x28b27f){return db[_0xad23('0x15')][_0xad23('0x16')](_0x96b6ca[_0xad23('0x17')],{'raw':_0x96b6ca['options']?_0x96b6ca[_0xad23('0x18')][_0xad23('0x19')]===undefined?!![]:![]:!![]})[_0xad23('0x8')](function(_0x5ab021){logger['info'](_0xad23('0x14'),_0x96b6ca);logger[_0xad23('0xa')](_0xad23('0x14'),_0x96b6ca,JSON['stringify'](_0x5ab021));_0x46ffe8(_0x5ab021);})['catch'](function(_0x424415){logger[_0xad23('0xe')](_0xad23('0x14'),_0x424415['message'],_0x96b6ca);_0x28b27f(_0x539905['error'](0x1f4,_0x424415[_0xad23('0x11')]));});});};exports[_0xad23('0x1a')]=function(_0x5bad5e){var _0x3cd02b=this;return new Promise(function(_0x5e1831,_0x2c28e0){return db['VoiceAgentReport']['update'](_0x5bad5e[_0xad23('0x17')],{'raw':_0x5bad5e['options']?_0x5bad5e['options'][_0xad23('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bad5e[_0xad23('0x18')]?_0x5bad5e[_0xad23('0x18')][_0xad23('0x1b')]||null:null,'attributes':_0x5bad5e[_0xad23('0x18')]?_0x5bad5e[_0xad23('0x18')][_0xad23('0x1c')]||null:null,'limit':_0x5bad5e['options']?_0x5bad5e[_0xad23('0x18')]['limit']||null:null})['then'](function(_0x344197){logger['info'](_0xad23('0x1a'),_0x5bad5e);logger['debug'](_0xad23('0x1a'),_0x5bad5e,JSON[_0xad23('0xd')](_0x344197));_0x5e1831(_0x344197);})[_0xad23('0x13')](function(_0x185e0b){logger[_0xad23('0xe')](_0xad23('0x1a'),_0x185e0b[_0xad23('0x11')],_0x5bad5e);_0x2c28e0(_0x3cd02b[_0xad23('0xe')](0x1f4,_0x185e0b[_0xad23('0x11')]));});});}; \ No newline at end of file +var _0xdaa7=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','stringify','catch','UpdateVoiceAgentReport','update','options','where','attributes','limit','then','moment'];(function(_0x2f2e2b,_0xef6f3b){var _0x534971=function(_0x18156b){while(--_0x18156b){_0x2f2e2b['push'](_0x2f2e2b['shift']());}};_0x534971(++_0xef6f3b);}(_0xdaa7,0x9f));var _0x7daa=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xdaa7[_0x5c72ee];return _0x231876;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7daa('0x0'));var BPromise=require(_0x7daa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7daa('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7daa('0x3'));var logger=require(_0x7daa('0x4'))(_0x7daa('0x5'));var config=require('../../config/environment');var jayson=require(_0x7daa('0x6'));var client=jayson[_0x7daa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9943,_0x89e78f,_0x19fd5b){return new BPromise(function(_0x587032,_0x50e225){return client[_0x7daa('0x8')](_0x2c9943,_0x19fd5b)['then'](function(_0x1e4251){logger['info'](_0x7daa('0x9'),_0x89e78f,_0x7daa('0xa'));logger[_0x7daa('0xb')](_0x7daa('0xc'),_0x89e78f,_0x7daa('0xa'),JSON['stringify'](_0x1e4251));if(_0x1e4251[_0x7daa('0xd')]){if(_0x1e4251['error'][_0x7daa('0xe')]===0x1f4){logger[_0x7daa('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x89e78f,_0x1e4251[_0x7daa('0xd')][_0x7daa('0xf')]);return _0x50e225(_0x1e4251[_0x7daa('0xd')][_0x7daa('0xf')]);}logger[_0x7daa('0xd')](_0x7daa('0x9'),_0x89e78f,_0x1e4251[_0x7daa('0xd')][_0x7daa('0xf')]);return _0x587032(_0x1e4251[_0x7daa('0xd')][_0x7daa('0xf')]);}else{logger[_0x7daa('0x10')](_0x7daa('0x9'),_0x89e78f,'request\x20sent');_0x587032(_0x1e4251[_0x7daa('0x11')][_0x7daa('0xf')]);}})['catch'](function(_0xcde7e9){logger[_0x7daa('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x89e78f,_0xcde7e9);_0x50e225(_0xcde7e9);});});}exports[_0x7daa('0x12')]=function(_0x2312ce){var _0x345cbc=this;return new Promise(function(_0x256ca6,_0x3a23ef){return db[_0x7daa('0x13')][_0x7daa('0x14')](_0x2312ce[_0x7daa('0x15')],{'raw':_0x2312ce['options']?_0x2312ce['options'][_0x7daa('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x24839e){logger[_0x7daa('0x10')](_0x7daa('0x12'),_0x2312ce);logger[_0x7daa('0xb')]('CreateVoiceAgentReport',_0x2312ce,JSON[_0x7daa('0x17')](_0x24839e));_0x256ca6(_0x24839e);})[_0x7daa('0x18')](function(_0x13f04c){logger[_0x7daa('0xd')](_0x7daa('0x12'),_0x13f04c['message'],_0x2312ce);_0x3a23ef(_0x345cbc[_0x7daa('0xd')](0x1f4,_0x13f04c['message']));});});};exports[_0x7daa('0x19')]=function(_0x4e374d){var _0x2ae8d8=this;return new Promise(function(_0x2c32c0,_0x31a175){return db[_0x7daa('0x13')][_0x7daa('0x1a')](_0x4e374d[_0x7daa('0x15')],{'raw':_0x4e374d[_0x7daa('0x1b')]?_0x4e374d[_0x7daa('0x1b')][_0x7daa('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e374d[_0x7daa('0x1b')]?_0x4e374d[_0x7daa('0x1b')][_0x7daa('0x1c')]||null:null,'attributes':_0x4e374d['options']?_0x4e374d['options'][_0x7daa('0x1d')]||null:null,'limit':_0x4e374d[_0x7daa('0x1b')]?_0x4e374d[_0x7daa('0x1b')][_0x7daa('0x1e')]||null:null})[_0x7daa('0x1f')](function(_0x3314ab){logger[_0x7daa('0x10')](_0x7daa('0x19'),_0x4e374d);logger['debug'](_0x7daa('0x19'),_0x4e374d,JSON[_0x7daa('0x17')](_0x3314ab));_0x2c32c0(_0x3314ab);})[_0x7daa('0x18')](function(_0x8b92b1){logger[_0x7daa('0xd')](_0x7daa('0x19'),_0x8b92b1[_0x7daa('0xf')],_0x4e374d);_0x31a175(_0x2ae8d8[_0x7daa('0xd')](0x1f4,_0x8b92b1['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 873634c..a005dd7 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 _0x56e7=['put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x3fb450,_0xfb464c){var _0x61bb1e=function(_0x1d5548){while(--_0x1d5548){_0x3fb450['push'](_0x3fb450['shift']());}};_0x61bb1e(++_0xfb464c);}(_0x56e7,0x7b));var _0x756e=function(_0x9d6855,_0x5b6da6){_0x9d6855=_0x9d6855-0x0;var _0x3bbc78=_0x56e7[_0x9d6855];return _0x3bbc78;};'use strict';var multer=require('multer');var util=require(_0x756e('0x0'));var path=require(_0x756e('0x1'));var timeout=require('connect-timeout');var express=require(_0x756e('0x2'));var router=express[_0x756e('0x3')]();var fs_extra=require(_0x756e('0x4'));var auth=require(_0x756e('0x5'));var interaction=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var controller=require(_0x756e('0x8'));router['get']('/',auth[_0x756e('0x9')](),controller[_0x756e('0xa')]);router[_0x756e('0xb')](_0x756e('0xc'),auth['isAuthenticated'](),controller[_0x756e('0xd')]);router['get'](_0x756e('0xe'),auth[_0x756e('0x9')](),controller[_0x756e('0xf')]);router[_0x756e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x756e('0x11')](_0x756e('0xe'),auth[_0x756e('0x9')](),controller['update']);router[_0x756e('0x12')](_0x756e('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x756e('0x13')]=router; \ No newline at end of file +var _0x4b84=['update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x525798,_0x77a707){var _0x57da9a=function(_0x20837b){while(--_0x20837b){_0x525798['push'](_0x525798['shift']());}};_0x57da9a(++_0x77a707);}(_0x4b84,0x1cc));var _0x44b8=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x4b84[_0x48c4ef];return _0x435715;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xd')](_0x44b8('0xe'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xf')]);router[_0x44b8('0x10')](_0x44b8('0xe'),auth['isAuthenticated'](),controller[_0x44b8('0x11')]);module[_0x44b8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index e9bc82d..b923ecd 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 _0x8163=['DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound'];(function(_0x396539,_0x44d8b3){var _0x35540f=function(_0x4bc016){while(--_0x4bc016){_0x396539['push'](_0x396539['shift']());}};_0x35540f(++_0x44d8b3);}(_0x8163,0x13a));var _0x3816=function(_0x3d874c,_0x5dd40f){_0x3d874c=_0x3d874c-0x0;var _0x3c3956=_0x8163[_0x3d874c];return _0x3c3956;};'use strict';var Sequelize=require('sequelize');module[_0x3816('0x0')]={'uniqueid':{'type':Sequelize[_0x3816('0x1')]},'type':{'type':Sequelize[_0x3816('0x2')](_0x3816('0x3'),_0x3816('0x4'),_0x3816('0x5'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0x3816('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x3816('0x1')]},'destination':{'type':Sequelize[_0x3816('0x1')]},'destinationcontext':{'type':Sequelize[_0x3816('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x3816('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x3816('0x6')]},'systemanswertime':{'type':Sequelize[_0x3816('0x6')]},'answertime':{'type':Sequelize[_0x3816('0x6')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x3816('0x7')]},'billableseconds':{'type':Sequelize[_0x3816('0x7')]},'mohtime':{'type':Sequelize[_0x3816('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3816('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x3816('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x3816('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x3816('0x1')]},'note':{'type':Sequelize[_0x3816('0x1')]},'prefix':{'type':Sequelize[_0x3816('0x1')]},'routeid':{'type':Sequelize[_0x3816('0x7')]},'sipcallid':{'type':Sequelize[_0x3816('0x1')]}}; \ No newline at end of file +var _0xd33c=['inbound','outbound','outbound-fax','dialer','STRING','DATE','INTEGER','sequelize','exports','ENUM'];(function(_0x119940,_0x265a3f){var _0x59af49=function(_0x580199){while(--_0x580199){_0x119940['push'](_0x119940['shift']());}};_0x59af49(++_0x265a3f);}(_0xd33c,0x115));var _0xcd33=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xd33c[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0xcd33('0x0'));module[_0xcd33('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcd33('0x2')](_0xcd33('0x3'),'internal',_0xcd33('0x4'),'inbound-fax',_0xcd33('0x5'),_0xcd33('0x6'))},'tag':{'type':Sequelize[_0xcd33('0x7')]},'accountcode':{'type':Sequelize[_0xcd33('0x7')]},'source':{'type':Sequelize[_0xcd33('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xcd33('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcd33('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xcd33('0x8')]},'answertime':{'type':Sequelize[_0xcd33('0x8')]},'endtime':{'type':Sequelize[_0xcd33('0x8')]},'duration':{'type':Sequelize[_0xcd33('0x9')]},'billableseconds':{'type':Sequelize[_0xcd33('0x9')]},'mohtime':{'type':Sequelize[_0xcd33('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcd33('0x7')]},'amaflags':{'type':Sequelize[_0xcd33('0x7')]},'userfield':{'type':Sequelize[_0xcd33('0x7')]},'userDisposition':{'type':Sequelize[_0xcd33('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xcd33('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xcd33('0x7')]},'note':{'type':Sequelize[_0xcd33('0x7')]},'prefix':{'type':Sequelize[_0xcd33('0x7')]},'routeid':{'type':Sequelize[_0xcd33('0x9')]},'sipcallid':{'type':Sequelize[_0xcd33('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2ccd822..8ef0884 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0xac9ef3,_0x3dae87){_0xac9ef3=_0xac9ef3-0x0;var _0x31060e=_0x2032[_0xac9ef3];return _0x31060e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 45cce17..2fb7477 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 _0x4003=['uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x323316,_0x36226e){var _0x1c0881=function(_0x3bad6b){while(--_0x3bad6b){_0x323316['push'](_0x323316['shift']());}};_0x1c0881(++_0x36226e);}(_0x4003,0x1a1));var _0x3400=function(_0x2d47ed,_0x260bb5){_0x2d47ed=_0x2d47ed-0x0;var _0x1f53f5=_0x4003[_0x2d47ed];return _0x1f53f5;};'use strict';var _=require(_0x3400('0x0'));var util=require(_0x3400('0x1'));var logger=require('../../config/logger')(_0x3400('0x2'));var moment=require(_0x3400('0x3'));var BPromise=require(_0x3400('0x4'));var rp=require(_0x3400('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3400('0x6'));var config=require(_0x3400('0x7'));var attributes=require(_0x3400('0x8'));module[_0x3400('0x9')]=function(_0x2883fc,_0x45563b){return _0x2883fc['define'](_0x3400('0xa'),attributes,{'tableName':_0x3400('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3400('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6315=['api','moment','bluebird','path','rimraf','./voiceCallReport.attributes','define','VoiceCallReport','uniqueid','util'];(function(_0xc70ff5,_0x1f8a90){var _0x3f84b4=function(_0x5d55d5){while(--_0x5d55d5){_0xc70ff5['push'](_0xc70ff5['shift']());}};_0x3f84b4(++_0x1f8a90);}(_0x6315,0x185));var _0x5631=function(_0x120189,_0x2ef93f){_0x120189=_0x120189-0x0;var _0x60c389=_0x6315[_0x120189];return _0x60c389;};'use strict';var _=require('lodash');var util=require(_0x5631('0x0'));var logger=require('../../config/logger')(_0x5631('0x1'));var moment=require(_0x5631('0x2'));var BPromise=require(_0x5631('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5631('0x4'));var rimraf=require(_0x5631('0x5'));var config=require('../../config/environment');var attributes=require(_0x5631('0x6'));module['exports']=function(_0x47c1eb,_0x1d8710){return _0x47c1eb[_0x5631('0x7')](_0x5631('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x5631('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 11d8781..0382695 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 _0x6b66=['request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','findAll','options','raw','where','limit','include','map','model','attributes','debug','create','body','then','CreateVoiceCallReport','UpdateVoiceCallReport','VoiceCallReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6b66,0x185));var _0x66b6=function(_0x4b8654,_0x530d52){_0x4b8654=_0x4b8654-0x0;var _0x14902c=_0x6b66[_0x4b8654];return _0x14902c;};'use strict';var _=require('lodash');var util=require(_0x66b6('0x0'));var moment=require(_0x66b6('0x1'));var BPromise=require(_0x66b6('0x2'));var rs=require(_0x66b6('0x3'));var fs=require('fs');var Redis=require(_0x66b6('0x4'));var db=require(_0x66b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x66b6('0x6'))('rpc');var config=require(_0x66b6('0x7'));var jayson=require(_0x66b6('0x8'));var client=jayson[_0x66b6('0x9')][_0x66b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd972cd,_0x403145,_0x4ecdc3){return new BPromise(function(_0x5b5cfa,_0x23fc43){return client[_0x66b6('0xb')](_0xd972cd,_0x4ecdc3)['then'](function(_0x4a66be){logger['info'](_0x66b6('0xc'),_0x403145,_0x66b6('0xd'));logger['debug'](_0x66b6('0xe'),_0x403145,_0x66b6('0xd'),JSON[_0x66b6('0xf')](_0x4a66be));if(_0x4a66be['error']){if(_0x4a66be[_0x66b6('0x10')][_0x66b6('0x11')]===0x1f4){logger[_0x66b6('0x10')](_0x66b6('0xc'),_0x403145,_0x4a66be[_0x66b6('0x10')][_0x66b6('0x12')]);return _0x23fc43(_0x4a66be['error'][_0x66b6('0x12')]);}logger['error'](_0x66b6('0xc'),_0x403145,_0x4a66be['error'][_0x66b6('0x12')]);return _0x5b5cfa(_0x4a66be[_0x66b6('0x10')][_0x66b6('0x12')]);}else{logger[_0x66b6('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x403145,_0x66b6('0xd'));_0x5b5cfa(_0x4a66be[_0x66b6('0x14')][_0x66b6('0x12')]);}})[_0x66b6('0x15')](function(_0x72183d){logger[_0x66b6('0x10')](_0x66b6('0xc'),_0x403145,_0x72183d);_0x23fc43(_0x72183d);});});}exports[_0x66b6('0x16')]=function(_0x1da79d){var _0x3447c7=this;return new Promise(function(_0x33a126,_0xdfb24f){return db['VoiceCallReport'][_0x66b6('0x17')]({'raw':_0x1da79d[_0x66b6('0x18')]?_0x1da79d['options'][_0x66b6('0x19')]===undefined?!![]:![]:!![],'where':_0x1da79d[_0x66b6('0x18')]?_0x1da79d[_0x66b6('0x18')][_0x66b6('0x1a')]||null:null,'attributes':_0x1da79d[_0x66b6('0x18')]?_0x1da79d['options']['attributes']||null:null,'limit':_0x1da79d[_0x66b6('0x18')]?_0x1da79d[_0x66b6('0x18')][_0x66b6('0x1b')]||null:null,'include':_0x1da79d['options']?_0x1da79d[_0x66b6('0x18')][_0x66b6('0x1c')]?_[_0x66b6('0x1d')](_0x1da79d[_0x66b6('0x18')][_0x66b6('0x1c')],function(_0x47dd56){return{'model':db[_0x47dd56[_0x66b6('0x1e')]],'as':_0x47dd56['as'],'attributes':_0x47dd56['attributes'],'include':_0x47dd56[_0x66b6('0x1c')]?_[_0x66b6('0x1d')](_0x47dd56[_0x66b6('0x1c')],function(_0x11d4be){return{'model':db[_0x11d4be['model']],'as':_0x11d4be['as'],'attributes':_0x11d4be[_0x66b6('0x1f')],'include':_0x11d4be['include']?_[_0x66b6('0x1d')](_0x11d4be[_0x66b6('0x1c')],function(_0x124088){return{'model':db[_0x124088[_0x66b6('0x1e')]],'as':_0x124088['as'],'attributes':_0x124088[_0x66b6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30eee1){logger[_0x66b6('0x13')](_0x66b6('0x16'),_0x1da79d);logger[_0x66b6('0x20')]('GetVoiceCallReport',_0x1da79d,JSON[_0x66b6('0xf')](_0x30eee1));_0x33a126(_0x30eee1);})[_0x66b6('0x15')](function(_0x37b6f7){logger[_0x66b6('0x10')](_0x66b6('0x16'),_0x37b6f7['message'],_0x1da79d);_0xdfb24f(_0x3447c7['error'](0x1f4,_0x37b6f7[_0x66b6('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x341fb4){var _0x638ffa=this;return new Promise(function(_0x11843f,_0x2abb5a){return db['VoiceCallReport'][_0x66b6('0x21')](_0x341fb4[_0x66b6('0x22')],{'raw':_0x341fb4['options']?_0x341fb4[_0x66b6('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x66b6('0x23')](function(_0x29a73d){logger['info'](_0x66b6('0x24'),_0x341fb4);logger['debug']('CreateVoiceCallReport',_0x341fb4,JSON[_0x66b6('0xf')](_0x29a73d));_0x11843f(_0x29a73d);})[_0x66b6('0x15')](function(_0x178399){logger[_0x66b6('0x10')](_0x66b6('0x24'),_0x178399[_0x66b6('0x12')],_0x341fb4);_0x2abb5a(_0x638ffa[_0x66b6('0x10')](0x1f4,_0x178399[_0x66b6('0x12')]));});});};exports[_0x66b6('0x25')]=function(_0x24455d){var _0x5d4a00=this;return new Promise(function(_0x3793b3,_0x5d6881){return db[_0x66b6('0x26')][_0x66b6('0x27')](_0x24455d[_0x66b6('0x22')],{'raw':_0x24455d[_0x66b6('0x18')]?_0x24455d[_0x66b6('0x18')][_0x66b6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24455d[_0x66b6('0x18')]?_0x24455d[_0x66b6('0x18')][_0x66b6('0x1a')]||null:null,'attributes':_0x24455d[_0x66b6('0x18')]?_0x24455d['options'][_0x66b6('0x1f')]||null:null,'limit':_0x24455d[_0x66b6('0x18')]?_0x24455d[_0x66b6('0x18')][_0x66b6('0x1b')]||null:null})[_0x66b6('0x23')](function(_0x49fc97){logger['info']('UpdateVoiceCallReport',_0x24455d);logger[_0x66b6('0x20')](_0x66b6('0x25'),_0x24455d,JSON[_0x66b6('0xf')](_0x49fc97));_0x3793b3(_0x49fc97);})['catch'](function(_0x2918bd){logger[_0x66b6('0x10')](_0x66b6('0x25'),_0x2918bd[_0x66b6('0x12')],_0x24455d);_0x5d6881(_0x5d4a00[_0x66b6('0x10')](0x1f4,_0x2918bd['message']));});});}; \ No newline at end of file +var _0xbca4=['debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','VoiceCallReport','findAll','options','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','raw','update','where','UpdateVoiceCallReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xbca4,0x158));var _0x4bca=function(_0x22603b,_0x41e7b2){_0x22603b=_0x22603b-0x0;var _0x2d59c9=_0xbca4[_0x22603b];return _0x2d59c9;};'use strict';var _=require(_0x4bca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4bca('0x1'));var rs=require(_0x4bca('0x2'));var fs=require('fs');var Redis=require(_0x4bca('0x3'));var db=require(_0x4bca('0x4'))['db'];var utils=require(_0x4bca('0x5'));var logger=require(_0x4bca('0x6'))(_0x4bca('0x7'));var config=require(_0x4bca('0x8'));var jayson=require(_0x4bca('0x9'));var client=jayson[_0x4bca('0xa')][_0x4bca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12001e,_0x7d5042,_0x48d014){return new BPromise(function(_0x22a882,_0x24ba64){return client[_0x4bca('0xc')](_0x12001e,_0x48d014)[_0x4bca('0xd')](function(_0x2e261d){logger[_0x4bca('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x7d5042,_0x4bca('0xf'));logger[_0x4bca('0x10')](_0x4bca('0x11'),_0x7d5042,_0x4bca('0xf'),JSON[_0x4bca('0x12')](_0x2e261d));if(_0x2e261d[_0x4bca('0x13')]){if(_0x2e261d['error'][_0x4bca('0x14')]===0x1f4){logger[_0x4bca('0x13')](_0x4bca('0x15'),_0x7d5042,_0x2e261d['error'][_0x4bca('0x16')]);return _0x24ba64(_0x2e261d[_0x4bca('0x13')]['message']);}logger[_0x4bca('0x13')](_0x4bca('0x15'),_0x7d5042,_0x2e261d['error'][_0x4bca('0x16')]);return _0x22a882(_0x2e261d[_0x4bca('0x13')][_0x4bca('0x16')]);}else{logger[_0x4bca('0xe')](_0x4bca('0x15'),_0x7d5042,'request\x20sent');_0x22a882(_0x2e261d['result']['message']);}})[_0x4bca('0x17')](function(_0x53dd54){logger[_0x4bca('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x7d5042,_0x53dd54);_0x24ba64(_0x53dd54);});});}exports['GetVoiceCallReport']=function(_0x506aa8){var _0x1dadcf=this;return new Promise(function(_0x3950d7,_0x404b1b){return db[_0x4bca('0x18')][_0x4bca('0x19')]({'raw':_0x506aa8['options']?_0x506aa8['options']['raw']===undefined?!![]:![]:!![],'where':_0x506aa8[_0x4bca('0x1a')]?_0x506aa8[_0x4bca('0x1a')]['where']||null:null,'attributes':_0x506aa8[_0x4bca('0x1a')]?_0x506aa8['options'][_0x4bca('0x1b')]||null:null,'limit':_0x506aa8['options']?_0x506aa8['options'][_0x4bca('0x1c')]||null:null,'include':_0x506aa8['options']?_0x506aa8[_0x4bca('0x1a')][_0x4bca('0x1d')]?_[_0x4bca('0x1e')](_0x506aa8[_0x4bca('0x1a')][_0x4bca('0x1d')],function(_0xa5ac45){return{'model':db[_0xa5ac45[_0x4bca('0x1f')]],'as':_0xa5ac45['as'],'attributes':_0xa5ac45[_0x4bca('0x1b')],'include':_0xa5ac45[_0x4bca('0x1d')]?_[_0x4bca('0x1e')](_0xa5ac45[_0x4bca('0x1d')],function(_0x863106){return{'model':db[_0x863106['model']],'as':_0x863106['as'],'attributes':_0x863106[_0x4bca('0x1b')],'include':_0x863106[_0x4bca('0x1d')]?_[_0x4bca('0x1e')](_0x863106[_0x4bca('0x1d')],function(_0x29427d){return{'model':db[_0x29427d[_0x4bca('0x1f')]],'as':_0x29427d['as'],'attributes':_0x29427d[_0x4bca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4bca('0xd')](function(_0x5bd7bf){logger[_0x4bca('0xe')](_0x4bca('0x20'),_0x506aa8);logger[_0x4bca('0x10')]('GetVoiceCallReport',_0x506aa8,JSON[_0x4bca('0x12')](_0x5bd7bf));_0x3950d7(_0x5bd7bf);})[_0x4bca('0x17')](function(_0x56462f){logger[_0x4bca('0x13')](_0x4bca('0x20'),_0x56462f[_0x4bca('0x16')],_0x506aa8);_0x404b1b(_0x1dadcf[_0x4bca('0x13')](0x1f4,_0x56462f[_0x4bca('0x16')]));});});};exports[_0x4bca('0x21')]=function(_0x5674cd){var _0x7bec5c=this;return new Promise(function(_0x58428a,_0x42c42c){return db[_0x4bca('0x18')][_0x4bca('0x22')](_0x5674cd[_0x4bca('0x23')],{'raw':_0x5674cd['options']?_0x5674cd['options'][_0x4bca('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x2054f7){logger[_0x4bca('0xe')]('CreateVoiceCallReport',_0x5674cd);logger[_0x4bca('0x10')](_0x4bca('0x21'),_0x5674cd,JSON['stringify'](_0x2054f7));_0x58428a(_0x2054f7);})['catch'](function(_0x274eb5){logger[_0x4bca('0x13')](_0x4bca('0x21'),_0x274eb5['message'],_0x5674cd);_0x42c42c(_0x7bec5c[_0x4bca('0x13')](0x1f4,_0x274eb5[_0x4bca('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x3ae6c0){var _0x13a279=this;return new Promise(function(_0x360f29,_0x3f9acb){return db['VoiceCallReport'][_0x4bca('0x25')](_0x3ae6c0[_0x4bca('0x23')],{'raw':_0x3ae6c0[_0x4bca('0x1a')]?_0x3ae6c0['options'][_0x4bca('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ae6c0[_0x4bca('0x1a')]?_0x3ae6c0['options'][_0x4bca('0x26')]||null:null,'attributes':_0x3ae6c0[_0x4bca('0x1a')]?_0x3ae6c0[_0x4bca('0x1a')][_0x4bca('0x1b')]||null:null,'limit':_0x3ae6c0[_0x4bca('0x1a')]?_0x3ae6c0[_0x4bca('0x1a')]['limit']||null:null})['then'](function(_0x4f7fd7){logger['info'](_0x4bca('0x27'),_0x3ae6c0);logger[_0x4bca('0x10')](_0x4bca('0x27'),_0x3ae6c0,JSON[_0x4bca('0x12')](_0x4f7fd7));_0x360f29(_0x4f7fd7);})[_0x4bca('0x17')](function(_0x15101c){logger['error'](_0x4bca('0x27'),_0x15101c['message'],_0x3ae6c0);_0x3f9acb(_0x13a279[_0x4bca('0x13')](0x1f4,_0x15101c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index fad0025..7b9efeb 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 _0x6ae1=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x542a7c,_0x3ea76a){var _0x3769d5=function(_0x38d169){while(--_0x38d169){_0x542a7c['push'](_0x542a7c['shift']());}};_0x3769d5(++_0x3ea76a);}(_0x6ae1,0x13b));var _0x16ae=function(_0x4c063c,_0x1ceeca){_0x4c063c=_0x4c063c-0x0;var _0x50331a=_0x6ae1[_0x4c063c];return _0x50331a;};'use strict';var multer=require('multer');var util=require(_0x16ae('0x0'));var path=require('path');var timeout=require(_0x16ae('0x1'));var express=require(_0x16ae('0x2'));var router=express[_0x16ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x16ae('0x4'));var interaction=require(_0x16ae('0x5'));var config=require(_0x16ae('0x6'));var controller=require(_0x16ae('0x7'));router[_0x16ae('0x8')]('/',auth[_0x16ae('0x9')](),controller['index']);router[_0x16ae('0x8')](_0x16ae('0xa'),auth[_0x16ae('0x9')](),controller[_0x16ae('0xb')]);router[_0x16ae('0xc')]('/',auth[_0x16ae('0x9')](),controller[_0x16ae('0xd')]);router[_0x16ae('0xe')](_0x16ae('0xa'),auth['isAuthenticated'](),controller[_0x16ae('0xf')]);router[_0x16ae('0x10')](_0x16ae('0xa'),auth[_0x16ae('0x9')](),controller[_0x16ae('0x11')]);module[_0x16ae('0x12')]=router; \ No newline at end of file +var _0x4357=['isAuthenticated','show','post','create','put','delete','destroy','exports','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get'];(function(_0x19c44e,_0x542bde){var _0x4fbde6=function(_0x1d62fc){while(--_0x1d62fc){_0x19c44e['push'](_0x19c44e['shift']());}};_0x4fbde6(++_0x542bde);}(_0x4357,0xd8));var _0x7435=function(_0x5afeab,_0x536dcd){_0x5afeab=_0x5afeab-0x0;var _0x419cd3=_0x4357[_0x5afeab];return _0x419cd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7435('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7435('0x1')]();var fs_extra=require(_0x7435('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7435('0x3'));var config=require(_0x7435('0x4'));var controller=require(_0x7435('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x7435('0x6')]);router[_0x7435('0x7')]('/:id',auth[_0x7435('0x8')](),controller[_0x7435('0x9')]);router[_0x7435('0xa')]('/',auth[_0x7435('0x8')](),controller[_0x7435('0xb')]);router[_0x7435('0xc')]('/:id',auth[_0x7435('0x8')](),controller['update']);router[_0x7435('0xd')]('/:id',auth[_0x7435('0x8')](),controller[_0x7435('0xe')]);module[_0x7435('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 81e18dd..ef969b7 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 _0x0a21=['STRING','sequelize','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x4a44d5,_0x210ebb){var _0xc514ca=function(_0x4a5b51){while(--_0x4a5b51){_0x4a44d5['push'](_0x4a44d5['shift']());}};_0xc514ca(++_0x210ebb);}(_0x0a21,0xe1));var _0x10a2=function(_0x258bea,_0x14453d){_0x258bea=_0x258bea-0x0;var _0x2a18a3=_0x0a21[_0x258bea];return _0x2a18a3;};'use strict';var Sequelize=require(_0x10a2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x10a2('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x57abfa){this['setDataValue'](_0x10a2('0x2'),_0x57abfa?_0x57abfa[_0x10a2('0x3')](''):[]);},'get':function(){return this[_0x10a2('0x4')](_0x10a2('0x2'))?this['getDataValue']('options')[_0x10a2('0x5')](''):[];}},'auth':{'type':Sequelize[_0x10a2('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x10a2('0x7')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x10a2('0x7')]},'description':{'type':Sequelize[_0x10a2('0x7')]}}; \ No newline at end of file +var _0x056e=['exports','STRING','name','options','getDataValue','split','BOOLEAN'];(function(_0x4dde94,_0x52b903){var _0x30acf7=function(_0x2d0ead){while(--_0x2d0ead){_0x4dde94['push'](_0x4dde94['shift']());}};_0x30acf7(++_0x52b903);}(_0x056e,0x1e3));var _0xe056=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x056e[_0x176317];return _0xef2759;};'use strict';var Sequelize=require('sequelize');module[_0xe056('0x0')]={'name':{'type':Sequelize[_0xe056('0x1')]},'prefix':{'type':Sequelize[_0xe056('0x1')],'unique':_0xe056('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xeff131){this['setDataValue'](_0xe056('0x3'),_0xeff131?_0xeff131['join'](''):[]);},'get':function(){return this[_0xe056('0x4')](_0xe056('0x3'))?this['getDataValue'](_0xe056('0x3'))[_0xe056('0x5')](''):[];}},'auth':{'type':Sequelize[_0xe056('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xe056('0x1')]},'record':{'type':Sequelize[_0xe056('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe056('0x1')]},'description':{'type':Sequelize[_0xe056('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 0ffeff3..468de54 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 _0x87df=['UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x87df,0x167));var _0xf87d=function(_0x42f3e4,_0x2646fd){_0x42f3e4=_0x42f3e4-0x0;var _0x1d7aa6=_0x87df[_0x42f3e4];return _0x1d7aa6;};'use strict';var emlformat=require(_0xf87d('0x0'));var rimraf=require(_0xf87d('0x1'));var zipdir=require(_0xf87d('0x2'));var jsonpatch=require(_0xf87d('0x3'));var rp=require(_0xf87d('0x4'));var moment=require(_0xf87d('0x5'));var BPromise=require(_0xf87d('0x6'));var Mustache=require(_0xf87d('0x7'));var util=require(_0xf87d('0x8'));var path=require(_0xf87d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf87d('0xa'));var fs=require('fs');var fs_extra=require(_0xf87d('0xb'));var _=require('lodash');var squel=require(_0xf87d('0xc'));var crypto=require(_0xf87d('0xd'));var jsforce=require(_0xf87d('0xe'));var deskjs=require(_0xf87d('0xf'));var toCsv=require(_0xf87d('0x10'));var querystring=require(_0xf87d('0x11'));var Papa=require(_0xf87d('0x12'));var Redis=require(_0xf87d('0x13'));var authService=require(_0xf87d('0x14'));var qs=require(_0xf87d('0x15'));var as=require(_0xf87d('0x16'));var hardwareService=require(_0xf87d('0x17'));var logger=require(_0xf87d('0x18'))(_0xf87d('0x19'));var utils=require(_0xf87d('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf87d('0x1b'));var db=require(_0xf87d('0x1c'))['db'];function respondWithStatusCode(_0x3f21b2,_0x53c769){_0x53c769=_0x53c769||0xcc;return function(_0x29a8a0){if(_0x29a8a0){return _0x3f21b2[_0xf87d('0x1d')](_0x53c769);}return _0x3f21b2[_0xf87d('0x1e')](_0x53c769)[_0xf87d('0x1f')]();};}function respondWithResult(_0x5638fd,_0x3d74ed){_0x3d74ed=_0x3d74ed||0xc8;return function(_0x2487f0){if(_0x2487f0){return _0x5638fd['status'](_0x3d74ed)[_0xf87d('0x20')](_0x2487f0);}};}function respondWithFilteredResult(_0x5ec8b7,_0x3f4507){return function(_0x368872){if(_0x368872){var _0x2b72fc=typeof _0x3f4507[_0xf87d('0x21')]===_0xf87d('0x22')&&typeof _0x3f4507['limit']===_0xf87d('0x22');var _0x19889a=_0x368872[_0xf87d('0x23')];var _0x5986ec=_0x2b72fc?0x0:_0x3f4507[_0xf87d('0x21')];var _0x1e6627=_0x2b72fc?_0x368872[_0xf87d('0x23')]:_0x3f4507[_0xf87d('0x21')]+_0x3f4507[_0xf87d('0x24')];var _0x350bee;if(_0x1e6627>=_0x19889a){_0x1e6627=_0x19889a;_0x350bee=0xc8;}else{_0x350bee=0xce;}_0x5ec8b7['status'](_0x350bee);return _0x5ec8b7[_0xf87d('0x25')](_0xf87d('0x26'),_0x5986ec+'-'+_0x1e6627+'/'+_0x19889a)['json'](_0x368872);}return null;};}function patchUpdates(_0x2e5a73){return function(_0x17b09e){try{jsonpatch[_0xf87d('0x27')](_0x17b09e,_0x2e5a73,!![]);}catch(_0x2a3edb){return BPromise[_0xf87d('0x28')](_0x2a3edb);}return _0x17b09e[_0xf87d('0x29')]();};}function saveUpdates(_0x31f71c,_0x5b7ac5){return function(_0x254927){if(_0x254927){return _0x254927[_0xf87d('0x2a')](_0x31f71c)[_0xf87d('0x2b')](function(_0xb026bd){return _0xb026bd;});}return null;};}function removeEntity(_0x26cda9,_0x1af656){return function(_0x5ebd5d){if(_0x5ebd5d){return _0x5ebd5d['destroy']()[_0xf87d('0x2b')](function(){var _0xcbb515=_0x5ebd5d[_0xf87d('0x2c')]({'plain':!![]});var _0x2ef1c3='ChanSpies';return db[_0xf87d('0x2d')][_0xf87d('0x2e')]({'where':{'type':_0x2ef1c3,'resourceId':_0xcbb515['id']}})[_0xf87d('0x2b')](function(){return _0x5ebd5d;});})[_0xf87d('0x2b')](function(){_0x26cda9[_0xf87d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19cbc4,_0x12b933){return function(_0x1daaf8){if(!_0x1daaf8){_0x19cbc4[_0xf87d('0x1d')](0x194);}return _0x1daaf8;};}function handleError(_0x3a0b95,_0x4784c2){_0x4784c2=_0x4784c2||0x1f4;return function(_0x1155c9){logger[_0xf87d('0x2f')](_0x1155c9[_0xf87d('0x30')]);if(_0x1155c9[_0xf87d('0x31')]){delete _0x1155c9[_0xf87d('0x31')];}_0x3a0b95['status'](_0x4784c2)[_0xf87d('0x32')](_0x1155c9);};}exports[_0xf87d('0x33')]=function(_0x5663b4,_0x33408e){var _0x3d00d1={},_0x4cfb7c={},_0xd06243={'count':0x0,'rows':[]};var _0x2c1550=_['map'](db[_0xf87d('0x34')][_0xf87d('0x35')],function(_0x1c7e92){return{'name':_0x1c7e92[_0xf87d('0x36')],'type':_0x1c7e92[_0xf87d('0x37')][_0xf87d('0x38')]};});_0x4cfb7c[_0xf87d('0x39')]=_['map'](_0x2c1550,_0xf87d('0x31'));_0x4cfb7c[_0xf87d('0x3a')]=_[_0xf87d('0x3b')](_0x5663b4['query']);_0x4cfb7c[_0xf87d('0x3c')]=_[_0xf87d('0x3d')](_0x4cfb7c[_0xf87d('0x39')],_0x4cfb7c[_0xf87d('0x3a')]);_0x3d00d1[_0xf87d('0x3e')]=_[_0xf87d('0x3d')](_0x4cfb7c[_0xf87d('0x39')],qs[_0xf87d('0x3f')](_0x5663b4['query']['fields']));_0x3d00d1['attributes']=_0x3d00d1[_0xf87d('0x3e')]['length']?_0x3d00d1[_0xf87d('0x3e')]:_0x4cfb7c[_0xf87d('0x39')];if(!_0x5663b4[_0xf87d('0x3a')][_0xf87d('0x40')](_0xf87d('0x41'))){_0x3d00d1[_0xf87d('0x24')]=qs[_0xf87d('0x24')](_0x5663b4[_0xf87d('0x3a')]['limit']);_0x3d00d1[_0xf87d('0x21')]=qs['offset'](_0x5663b4[_0xf87d('0x3a')][_0xf87d('0x21')]);}_0x3d00d1[_0xf87d('0x42')]=qs[_0xf87d('0x43')](_0x5663b4[_0xf87d('0x3a')][_0xf87d('0x43')]);_0x3d00d1[_0xf87d('0x44')]=qs[_0xf87d('0x3c')](_[_0xf87d('0x45')](_0x5663b4[_0xf87d('0x3a')],_0x4cfb7c['filters']),_0x2c1550);if(_0x5663b4[_0xf87d('0x3a')]['filter']){_0x3d00d1['where']=_[_0xf87d('0x46')](_0x3d00d1[_0xf87d('0x44')],{'$or':_[_0xf87d('0x47')](_0x2c1550,function(_0x1a9aa7){if(_0x1a9aa7[_0xf87d('0x37')]!==_0xf87d('0x48')){var _0x19ef7e={};_0x19ef7e[_0x1a9aa7[_0xf87d('0x31')]]={'$like':'%'+_0x5663b4[_0xf87d('0x3a')][_0xf87d('0x49')]+'%'};return _0x19ef7e;}})});}_0x3d00d1=_[_0xf87d('0x46')]({},_0x3d00d1,_0x5663b4['options']);var _0x32530a={'where':_0x3d00d1[_0xf87d('0x44')]};return db[_0xf87d('0x34')][_0xf87d('0x23')](_0x32530a)['then'](function(_0x1b12f4){_0xd06243[_0xf87d('0x23')]=_0x1b12f4;if(_0x5663b4['query'][_0xf87d('0x4a')]){_0x3d00d1['include']=[{'all':!![]}];}return db[_0xf87d('0x34')][_0xf87d('0x4b')](_0x3d00d1);})[_0xf87d('0x2b')](function(_0x4b0a62){_0xd06243['rows']=_0x4b0a62;return _0xd06243;})[_0xf87d('0x2b')](respondWithFilteredResult(_0x33408e,_0x3d00d1))[_0xf87d('0x4c')](handleError(_0x33408e,null));};exports[_0xf87d('0x4d')]=function(_0x295df4,_0x5600c3){var _0x443cf8={'raw':![],'where':{'id':_0x295df4[_0xf87d('0x4e')]['id']}},_0x448113={};_0x448113[_0xf87d('0x39')]=_[_0xf87d('0x3b')](db[_0xf87d('0x34')]['rawAttributes']);_0x448113[_0xf87d('0x3a')]=_[_0xf87d('0x3b')](_0x295df4[_0xf87d('0x3a')]);_0x448113[_0xf87d('0x3c')]=_['intersection'](_0x448113['model'],_0x448113[_0xf87d('0x3a')]);_0x443cf8[_0xf87d('0x3e')]=_['intersection'](_0x448113[_0xf87d('0x39')],qs[_0xf87d('0x3f')](_0x295df4['query'][_0xf87d('0x3f')]));_0x443cf8[_0xf87d('0x3e')]=_0x443cf8[_0xf87d('0x3e')]['length']?_0x443cf8[_0xf87d('0x3e')]:_0x448113[_0xf87d('0x39')];if(_0x295df4[_0xf87d('0x3a')][_0xf87d('0x4a')]){_0x443cf8[_0xf87d('0x4f')]=[{'all':!![]}];}_0x443cf8=_[_0xf87d('0x46')]({},_0x443cf8,_0x295df4['options']);return db[_0xf87d('0x34')][_0xf87d('0x50')](_0x443cf8)[_0xf87d('0x2b')](handleEntityNotFound(_0x5600c3,null))[_0xf87d('0x2b')](respondWithResult(_0x5600c3,null))['catch'](handleError(_0x5600c3,null));};exports[_0xf87d('0x51')]=function(_0x251f7c,_0x560f58){return db[_0xf87d('0x34')][_0xf87d('0x51')](_0x251f7c[_0xf87d('0x52')],{})[_0xf87d('0x2b')](function(_0x3627a2){var _0x36f6f9=_0x251f7c[_0xf87d('0x53')][_0xf87d('0x2c')]({'plain':!![]});if(!_0x36f6f9)throw new Error(_0xf87d('0x54'));if(_0x36f6f9[_0xf87d('0x55')]==='user'){var _0x4d4028=_0x3627a2[_0xf87d('0x2c')]({'plain':!![]});var _0x1cc997='ChanSpies';return db[_0xf87d('0x56')]['find']({'where':{'name':_0x1cc997,'userProfileId':_0x36f6f9[_0xf87d('0x57')]},'raw':!![]})[_0xf87d('0x2b')](function(_0x4f0859){if(_0x4f0859&&_0x4f0859[_0xf87d('0x58')]===0x0){return db['UserProfileResource'][_0xf87d('0x51')]({'name':_0x4d4028[_0xf87d('0x31')],'resourceId':_0x4d4028['id'],'type':_0x4f0859['name'],'sectionId':_0x4f0859['id']},{})[_0xf87d('0x2b')](function(){return _0x3627a2;});}else{return _0x3627a2;}})[_0xf87d('0x4c')](function(_0x5344af){logger[_0xf87d('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5344af);throw _0x5344af;});}return _0x3627a2;})[_0xf87d('0x2b')](respondWithResult(_0x560f58,0xc9))[_0xf87d('0x4c')](handleError(_0x560f58,null));};exports['update']=function(_0x46f540,_0x3fe24e){if(_0x46f540[_0xf87d('0x52')]['id']){delete _0x46f540[_0xf87d('0x52')]['id'];}return db[_0xf87d('0x34')][_0xf87d('0x50')]({'where':{'id':_0x46f540[_0xf87d('0x4e')]['id']}})[_0xf87d('0x2b')](handleEntityNotFound(_0x3fe24e,null))[_0xf87d('0x2b')](saveUpdates(_0x46f540[_0xf87d('0x52')],null))[_0xf87d('0x2b')](respondWithResult(_0x3fe24e,null))[_0xf87d('0x4c')](handleError(_0x3fe24e,null));};exports[_0xf87d('0x2e')]=function(_0x3b98ea,_0x40d3a8){return db[_0xf87d('0x34')][_0xf87d('0x50')]({'where':{'id':_0x3b98ea[_0xf87d('0x4e')]['id']}})[_0xf87d('0x2b')](handleEntityNotFound(_0x40d3a8,null))[_0xf87d('0x2b')](removeEntity(_0x40d3a8,null))[_0xf87d('0x4c')](handleError(_0x40d3a8,null));}; \ No newline at end of file +var _0x8d97=['save','then','destroy','ChanSpies','UserProfileResource','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','get','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0xda5bf2,_0x1e199b){var _0x2b41a1=function(_0x370d2a){while(--_0x370d2a){_0xda5bf2['push'](_0xda5bf2['shift']());}};_0x2b41a1(++_0x1e199b);}(_0x8d97,0x82));var _0x78d9=function(_0x299c84,_0x4c1666){_0x299c84=_0x299c84-0x0;var _0x45bf54=_0x8d97[_0x299c84];return _0x45bf54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d9('0x0'));var zipdir=require(_0x78d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78d9('0x2'));var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var Mustache=require(_0x78d9('0x5'));var util=require(_0x78d9('0x6'));var path=require('path');var sox=require(_0x78d9('0x7'));var csv=require(_0x78d9('0x8'));var ejs=require(_0x78d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x78d9('0xa'));var jsforce=require(_0x78d9('0xb'));var deskjs=require(_0x78d9('0xc'));var toCsv=require(_0x78d9('0x8'));var querystring=require(_0x78d9('0xd'));var Papa=require(_0x78d9('0xe'));var Redis=require('ioredis');var authService=require(_0x78d9('0xf'));var qs=require(_0x78d9('0x10'));var as=require(_0x78d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78d9('0x12'));var utils=require(_0x78d9('0x13'));var config=require(_0x78d9('0x14'));var licenseUtil=require(_0x78d9('0x15'));var db=require(_0x78d9('0x16'))['db'];function respondWithStatusCode(_0x22d36f,_0x528746){_0x528746=_0x528746||0xcc;return function(_0x8186eb){if(_0x8186eb){return _0x22d36f[_0x78d9('0x17')](_0x528746);}return _0x22d36f[_0x78d9('0x18')](_0x528746)[_0x78d9('0x19')]();};}function respondWithResult(_0x1db1b1,_0x2928a8){_0x2928a8=_0x2928a8||0xc8;return function(_0x2b27a9){if(_0x2b27a9){return _0x1db1b1[_0x78d9('0x18')](_0x2928a8)[_0x78d9('0x1a')](_0x2b27a9);}};}function respondWithFilteredResult(_0x21cee0,_0x826882){return function(_0x38aa28){if(_0x38aa28){var _0x45934d=typeof _0x826882[_0x78d9('0x1b')]===_0x78d9('0x1c')&&typeof _0x826882[_0x78d9('0x1d')]===_0x78d9('0x1c');var _0x5e8122=_0x38aa28[_0x78d9('0x1e')];var _0x3b4dde=_0x45934d?0x0:_0x826882[_0x78d9('0x1b')];var _0x8d0153=_0x45934d?_0x38aa28[_0x78d9('0x1e')]:_0x826882[_0x78d9('0x1b')]+_0x826882[_0x78d9('0x1d')];var _0x2969fa;if(_0x8d0153>=_0x5e8122){_0x8d0153=_0x5e8122;_0x2969fa=0xc8;}else{_0x2969fa=0xce;}_0x21cee0[_0x78d9('0x18')](_0x2969fa);return _0x21cee0[_0x78d9('0x1f')](_0x78d9('0x20'),_0x3b4dde+'-'+_0x8d0153+'/'+_0x5e8122)[_0x78d9('0x1a')](_0x38aa28);}return null;};}function patchUpdates(_0x36bcf9){return function(_0x148e30){try{jsonpatch[_0x78d9('0x21')](_0x148e30,_0x36bcf9,!![]);}catch(_0x1d8d3c){return BPromise['reject'](_0x1d8d3c);}return _0x148e30[_0x78d9('0x22')]();};}function saveUpdates(_0x4285d4,_0x24d236){return function(_0x18bb18){if(_0x18bb18){return _0x18bb18['update'](_0x4285d4)[_0x78d9('0x23')](function(_0x41f732){return _0x41f732;});}return null;};}function removeEntity(_0x45b6f6,_0x51549d){return function(_0x51c4ce){if(_0x51c4ce){return _0x51c4ce[_0x78d9('0x24')]()['then'](function(){var _0x47a331=_0x51c4ce['get']({'plain':!![]});var _0x28b7e1=_0x78d9('0x25');return db[_0x78d9('0x26')][_0x78d9('0x24')]({'where':{'type':_0x28b7e1,'resourceId':_0x47a331['id']}})[_0x78d9('0x23')](function(){return _0x51c4ce;});})[_0x78d9('0x23')](function(){_0x45b6f6['status'](0xcc)[_0x78d9('0x19')]();});}};}function handleEntityNotFound(_0x53a0ab,_0x145c0c){return function(_0x3d9a53){if(!_0x3d9a53){_0x53a0ab[_0x78d9('0x17')](0x194);}return _0x3d9a53;};}function handleError(_0x507492,_0x7ecc39){_0x7ecc39=_0x7ecc39||0x1f4;return function(_0x337816){logger['error'](_0x337816['stack']);if(_0x337816['name']){delete _0x337816['name'];}_0x507492[_0x78d9('0x18')](_0x7ecc39)[_0x78d9('0x27')](_0x337816);};}exports[_0x78d9('0x28')]=function(_0x45002a,_0x40a789){var _0x3fe42b={},_0x457cc9={},_0x10cf27={'count':0x0,'rows':[]};var _0x198e36=_[_0x78d9('0x29')](db['VoiceChanSpy'][_0x78d9('0x2a')],function(_0x5ce1fa){return{'name':_0x5ce1fa['fieldName'],'type':_0x5ce1fa[_0x78d9('0x2b')][_0x78d9('0x2c')]};});_0x457cc9[_0x78d9('0x2d')]=_[_0x78d9('0x29')](_0x198e36,_0x78d9('0x2e'));_0x457cc9[_0x78d9('0x2f')]=_[_0x78d9('0x30')](_0x45002a['query']);_0x457cc9[_0x78d9('0x31')]=_[_0x78d9('0x32')](_0x457cc9[_0x78d9('0x2d')],_0x457cc9[_0x78d9('0x2f')]);_0x3fe42b['attributes']=_[_0x78d9('0x32')](_0x457cc9['model'],qs['fields'](_0x45002a['query']['fields']));_0x3fe42b[_0x78d9('0x33')]=_0x3fe42b[_0x78d9('0x33')][_0x78d9('0x34')]?_0x3fe42b[_0x78d9('0x33')]:_0x457cc9[_0x78d9('0x2d')];if(!_0x45002a[_0x78d9('0x2f')][_0x78d9('0x35')](_0x78d9('0x36'))){_0x3fe42b[_0x78d9('0x1d')]=qs[_0x78d9('0x1d')](_0x45002a[_0x78d9('0x2f')][_0x78d9('0x1d')]);_0x3fe42b[_0x78d9('0x1b')]=qs[_0x78d9('0x1b')](_0x45002a[_0x78d9('0x2f')][_0x78d9('0x1b')]);}_0x3fe42b[_0x78d9('0x37')]=qs[_0x78d9('0x38')](_0x45002a['query']['sort']);_0x3fe42b[_0x78d9('0x39')]=qs[_0x78d9('0x31')](_[_0x78d9('0x3a')](_0x45002a[_0x78d9('0x2f')],_0x457cc9[_0x78d9('0x31')]),_0x198e36);if(_0x45002a[_0x78d9('0x2f')]['filter']){_0x3fe42b[_0x78d9('0x39')]=_[_0x78d9('0x3b')](_0x3fe42b[_0x78d9('0x39')],{'$or':_[_0x78d9('0x29')](_0x198e36,function(_0xe29300){if(_0xe29300['type']!==_0x78d9('0x3c')){var _0x3ec28a={};_0x3ec28a[_0xe29300[_0x78d9('0x2e')]]={'$like':'%'+_0x45002a[_0x78d9('0x2f')]['filter']+'%'};return _0x3ec28a;}})});}_0x3fe42b=_[_0x78d9('0x3b')]({},_0x3fe42b,_0x45002a[_0x78d9('0x3d')]);var _0x335bd1={'where':_0x3fe42b[_0x78d9('0x39')]};return db[_0x78d9('0x3e')][_0x78d9('0x1e')](_0x335bd1)[_0x78d9('0x23')](function(_0x381ed5){_0x10cf27[_0x78d9('0x1e')]=_0x381ed5;if(_0x45002a['query'][_0x78d9('0x3f')]){_0x3fe42b[_0x78d9('0x40')]=[{'all':!![]}];}return db[_0x78d9('0x3e')][_0x78d9('0x41')](_0x3fe42b);})[_0x78d9('0x23')](function(_0x2d4c80){_0x10cf27[_0x78d9('0x42')]=_0x2d4c80;return _0x10cf27;})[_0x78d9('0x23')](respondWithFilteredResult(_0x40a789,_0x3fe42b))[_0x78d9('0x43')](handleError(_0x40a789,null));};exports[_0x78d9('0x44')]=function(_0x412aea,_0x541ea9){var _0x4b874f={'raw':![],'where':{'id':_0x412aea[_0x78d9('0x45')]['id']}},_0x3989e4={};_0x3989e4['model']=_[_0x78d9('0x30')](db[_0x78d9('0x3e')][_0x78d9('0x2a')]);_0x3989e4[_0x78d9('0x2f')]=_[_0x78d9('0x30')](_0x412aea[_0x78d9('0x2f')]);_0x3989e4[_0x78d9('0x31')]=_[_0x78d9('0x32')](_0x3989e4[_0x78d9('0x2d')],_0x3989e4[_0x78d9('0x2f')]);_0x4b874f['attributes']=_[_0x78d9('0x32')](_0x3989e4[_0x78d9('0x2d')],qs[_0x78d9('0x46')](_0x412aea[_0x78d9('0x2f')][_0x78d9('0x46')]));_0x4b874f['attributes']=_0x4b874f['attributes'][_0x78d9('0x34')]?_0x4b874f[_0x78d9('0x33')]:_0x3989e4['model'];if(_0x412aea['query'][_0x78d9('0x3f')]){_0x4b874f['include']=[{'all':!![]}];}_0x4b874f=_[_0x78d9('0x3b')]({},_0x4b874f,_0x412aea[_0x78d9('0x3d')]);return db[_0x78d9('0x3e')][_0x78d9('0x47')](_0x4b874f)[_0x78d9('0x23')](handleEntityNotFound(_0x541ea9,null))[_0x78d9('0x23')](respondWithResult(_0x541ea9,null))[_0x78d9('0x43')](handleError(_0x541ea9,null));};exports[_0x78d9('0x48')]=function(_0x404a60,_0x3cec0a){return db[_0x78d9('0x3e')]['create'](_0x404a60[_0x78d9('0x49')],{})['then'](function(_0x3ac0f0){var _0x453aa3=_0x404a60[_0x78d9('0x4a')][_0x78d9('0x4b')]({'plain':!![]});if(!_0x453aa3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x453aa3[_0x78d9('0x4c')]==='user'){var _0x4923fa=_0x3ac0f0['get']({'plain':!![]});var _0x9bba1=_0x78d9('0x25');return db[_0x78d9('0x4d')][_0x78d9('0x47')]({'where':{'name':_0x9bba1,'userProfileId':_0x453aa3[_0x78d9('0x4e')]},'raw':!![]})['then'](function(_0x2bfecf){if(_0x2bfecf&&_0x2bfecf['autoAssociation']===0x0){return db[_0x78d9('0x26')][_0x78d9('0x48')]({'name':_0x4923fa[_0x78d9('0x2e')],'resourceId':_0x4923fa['id'],'type':_0x2bfecf[_0x78d9('0x2e')],'sectionId':_0x2bfecf['id']},{})['then'](function(){return _0x3ac0f0;});}else{return _0x3ac0f0;}})['catch'](function(_0x3e6076){logger[_0x78d9('0x4f')](_0x78d9('0x50'),_0x3e6076);throw _0x3e6076;});}return _0x3ac0f0;})[_0x78d9('0x23')](respondWithResult(_0x3cec0a,0xc9))[_0x78d9('0x43')](handleError(_0x3cec0a,null));};exports[_0x78d9('0x51')]=function(_0x28bb8c,_0x11a776){if(_0x28bb8c[_0x78d9('0x49')]['id']){delete _0x28bb8c[_0x78d9('0x49')]['id'];}return db[_0x78d9('0x3e')][_0x78d9('0x47')]({'where':{'id':_0x28bb8c['params']['id']}})[_0x78d9('0x23')](handleEntityNotFound(_0x11a776,null))[_0x78d9('0x23')](saveUpdates(_0x28bb8c[_0x78d9('0x49')],null))[_0x78d9('0x23')](respondWithResult(_0x11a776,null))['catch'](handleError(_0x11a776,null));};exports[_0x78d9('0x24')]=function(_0x42c3b9,_0x517c0e){return db[_0x78d9('0x3e')]['find']({'where':{'id':_0x42c3b9['params']['id']}})[_0x78d9('0x23')](handleEntityNotFound(_0x517c0e,null))[_0x78d9('0x23')](removeEntity(_0x517c0e,null))[_0x78d9('0x43')](handleError(_0x517c0e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b9d669d..87acf7c 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 _0x8719=['then','catch','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','name','options','StopMixMonitor','length','concat','findAll','agent'];(function(_0x34f99e,_0x27a7a6){var _0x5764a5=function(_0x3c8714){while(--_0x3c8714){_0x34f99e['push'](_0x34f99e['shift']());}};_0x5764a5(++_0x27a7a6);}(_0x8719,0x104));var _0x9871=function(_0x33bcf6,_0x2217b5){_0x33bcf6=_0x33bcf6-0x0;var _0x27ae56=_0x8719[_0x33bcf6];return _0x27ae56;};'use strict';var _=require('lodash');var util=require(_0x9871('0x0'));var BPromise=require(_0x9871('0x1'));var attributes=require(_0x9871('0x2'));var getUserApplications=function(_0x495cd0,_0xad93fd,_0x3043a9){var _0x25c8d1=0x1;var _0x539501=[];var _0x54a40d={'context':_0xad93fd[_0x9871('0x3')]||_0x9871('0x4'),'exten':util['format'](_0x9871('0x5'),_0x495cd0[_0x9871('0x6')],_0x3043a9),'type':_0x9871('0x7'),'isApp':![],'ChanSpyId':_0x495cd0['id'],'UserId':_0xad93fd['id']};_0x539501[_0x9871('0x8')](_[_0x9871('0x9')]({'app':_0x9871('0xa'),'appdata':util[_0x9871('0xb')](_0x9871('0xc'),_0x9871('0xd')),'priority':_0x25c8d1++},_0x54a40d));if(_0x495cd0[_0x9871('0xe')]){_0x539501['push'](_[_0x9871('0x9')]({'app':_0x9871('0xf'),'appdata':util[_0x9871('0xb')](_0x9871('0x10'),_0x495cd0[_0x9871('0x11')]),'priority':_0x25c8d1++},_0x54a40d));}if(_0x495cd0[_0x9871('0x12')]){_0x539501['push'](_[_0x9871('0x9')]({'app':_0x9871('0x13'),'appdata':_0x495cd0['password'],'priority':_0x25c8d1++},_0x54a40d));}_0x539501['push'](_['merge']({'app':_0x9871('0x14'),'appdata':util['format']('SIP/%s,%s',_0xad93fd[_0x9871('0x15')],_0x495cd0[_0x9871('0x16')]?_0x495cd0[_0x9871('0x16')]['join'](''):''),'priority':_0x25c8d1++},_0x54a40d));if(_0x495cd0[_0x9871('0xe')]){_0x539501['push'](_[_0x9871('0x9')]({'app':_0x9871('0x17'),'priority':_0x25c8d1++},_0x54a40d));}return _0x539501;};var getChanSpyApplications=function(_0x2ffd2b,_0x2f8a49){var _0x23555e=[];for(var _0x4e1f5e=0x0,_0x103539=0x1;_0x4e1f5e<_0x2f8a49[_0x9871('0x18')];_0x4e1f5e++,_0x103539=0x1){_0x23555e=_0x23555e[_0x9871('0x19')](getUserApplications(_0x2ffd2b,_0x2f8a49[_0x4e1f5e],_0x2f8a49[_0x4e1f5e]['internal']));if(_0x2f8a49[_0x4e1f5e]['internal']!=_0x2f8a49[_0x4e1f5e][_0x9871('0x15')]){_0x23555e=_0x23555e[_0x9871('0x19')](getUserApplications(_0x2ffd2b,_0x2f8a49[_0x4e1f5e],_0x2f8a49[_0x4e1f5e][_0x9871('0x15')]));}}return _0x23555e;};var getChanSpyPromise=function(_0x5f4e51,_0x2d2c7e){return new BPromise(function(_0x54a6ba,_0x10f028){return _0x5f4e51['User'][_0x9871('0x1a')]({'attributes':['id',_0x9871('0x15'),'internal'],'where':{'role':_0x9871('0x1b'),'chanspy':!![]},'raw':!![]})[_0x9871('0x1c')](function(_0x18714f){if(_0x18714f){return _0x54a6ba(getChanSpyApplications(_0x2d2c7e,_0x18714f));}return _0x54a6ba([]);})[_0x9871('0x1d')](function(_0x4149dc){_0x10f028(_0x4149dc);});});};module['exports']=function(_0x167440,_0x9f0162){var _0x3e9490=_0x167440[_0x9871('0x1e')];return _0x167440[_0x9871('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0x9871('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bb8da,_0x308d52,_0x392998){return getChanSpyPromise(_0x3e9490,_0x2bb8da)[_0x9871('0x1c')](function(_0x49a034){if(_0x49a034&&_0x49a034[_0x9871('0x18')]){return _0x3e9490[_0x9871('0x21')][_0x9871('0x22')](_0x49a034);}})['then'](function(){_0x392998();})['catch'](function(_0x3bf402){_0x392998(_0x3bf402);});},'afterUpdate':function(_0x3db34b,_0x2936b1,_0x20c8f0){return _0x3e9490['VoiceExtension'][_0x9871('0x23')]({'where':{'ChanSpyId':_0x3db34b['id']}})[_0x9871('0x1c')](function(){return getChanSpyPromise(_0x3e9490,_0x3db34b);})[_0x9871('0x1c')](function(_0x4b5885){if(_0x4b5885&&_0x4b5885[_0x9871('0x18')]){return _0x3e9490[_0x9871('0x21')][_0x9871('0x22')](_0x4b5885);}})[_0x9871('0x1c')](function(){_0x20c8f0();})[_0x9871('0x1d')](function(_0x1a675b){_0x20c8f0(_0x1a675b);});},'afterDestroy':function(_0xef537e,_0x20dadd,_0x5d5c33){return _0x3e9490[_0x9871('0x21')][_0x9871('0x23')]({'where':{'ChanSpyId':_0xef537e['id']}})[_0x9871('0x1c')](function(){_0x5d5c33();})[_0x9871('0x1d')](function(_0x510bbb){_0x5d5c33(_0x510bbb);});}}});}; \ No newline at end of file +var _0x5c76=['models','define','VoiceChanSpy','voice_chanspy','length','bulkCreate','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','ChanSpy','SIP/%s,%s','options','StopMixMonitor','concat','internal','name','User','agent','then','catch','exports'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x5c76,0x15e));var _0x65c7=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x5c76[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x65c7('0x0'));var util=require('util');var BPromise=require(_0x65c7('0x1'));var attributes=require(_0x65c7('0x2'));var getUserApplications=function(_0x42813e,_0x30c55b,_0x2d67ad){var _0x249052=0x1;var _0x29351d=[];var _0x5d3948={'context':_0x30c55b[_0x65c7('0x3')]||'from-sip','exten':util[_0x65c7('0x4')](_0x65c7('0x5'),_0x42813e[_0x65c7('0x6')],_0x2d67ad),'type':_0x65c7('0x7'),'isApp':![],'ChanSpyId':_0x42813e['id'],'UserId':_0x30c55b['id']};_0x29351d[_0x65c7('0x8')](_[_0x65c7('0x9')]({'app':_0x65c7('0xa'),'appdata':util[_0x65c7('0x4')](_0x65c7('0xb'),_0x65c7('0xc')),'priority':_0x249052++},_0x5d3948));if(_0x42813e[_0x65c7('0xd')]){_0x29351d[_0x65c7('0x8')](_[_0x65c7('0x9')]({'app':_0x65c7('0xe'),'appdata':util[_0x65c7('0x4')](_0x65c7('0xf'),_0x42813e[_0x65c7('0x10')]),'priority':_0x249052++},_0x5d3948));}if(_0x42813e[_0x65c7('0x11')]){_0x29351d[_0x65c7('0x8')](_['merge']({'app':'Authenticate','appdata':_0x42813e['password'],'priority':_0x249052++},_0x5d3948));}_0x29351d[_0x65c7('0x8')](_[_0x65c7('0x9')]({'app':_0x65c7('0x12'),'appdata':util[_0x65c7('0x4')](_0x65c7('0x13'),_0x30c55b['name'],_0x42813e[_0x65c7('0x14')]?_0x42813e[_0x65c7('0x14')]['join'](''):''),'priority':_0x249052++},_0x5d3948));if(_0x42813e[_0x65c7('0xd')]){_0x29351d[_0x65c7('0x8')](_[_0x65c7('0x9')]({'app':_0x65c7('0x15'),'priority':_0x249052++},_0x5d3948));}return _0x29351d;};var getChanSpyApplications=function(_0x4c880a,_0x2036f0){var _0x1666f4=[];for(var _0x2449b3=0x0,_0x3ff157=0x1;_0x2449b3<_0x2036f0['length'];_0x2449b3++,_0x3ff157=0x1){_0x1666f4=_0x1666f4[_0x65c7('0x16')](getUserApplications(_0x4c880a,_0x2036f0[_0x2449b3],_0x2036f0[_0x2449b3][_0x65c7('0x17')]));if(_0x2036f0[_0x2449b3][_0x65c7('0x17')]!=_0x2036f0[_0x2449b3][_0x65c7('0x18')]){_0x1666f4=_0x1666f4[_0x65c7('0x16')](getUserApplications(_0x4c880a,_0x2036f0[_0x2449b3],_0x2036f0[_0x2449b3][_0x65c7('0x18')]));}}return _0x1666f4;};var getChanSpyPromise=function(_0x3d844d,_0x35b116){return new BPromise(function(_0x5d7957,_0x494cff){return _0x3d844d[_0x65c7('0x19')]['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x65c7('0x1a'),'chanspy':!![]},'raw':!![]})[_0x65c7('0x1b')](function(_0x1db455){if(_0x1db455){return _0x5d7957(getChanSpyApplications(_0x35b116,_0x1db455));}return _0x5d7957([]);})[_0x65c7('0x1c')](function(_0x4f07e2){_0x494cff(_0x4f07e2);});});};module[_0x65c7('0x1d')]=function(_0x52cc69,_0x226e65){var _0x2f9e0f=_0x52cc69[_0x65c7('0x1e')];return _0x52cc69[_0x65c7('0x1f')](_0x65c7('0x20'),attributes,{'tableName':_0x65c7('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7c77b0,_0x29a10b,_0x210e27){return getChanSpyPromise(_0x2f9e0f,_0x7c77b0)[_0x65c7('0x1b')](function(_0x2bf636){if(_0x2bf636&&_0x2bf636[_0x65c7('0x22')]){return _0x2f9e0f['VoiceExtension'][_0x65c7('0x23')](_0x2bf636);}})[_0x65c7('0x1b')](function(){_0x210e27();})[_0x65c7('0x1c')](function(_0x931af1){_0x210e27(_0x931af1);});},'afterUpdate':function(_0x12dfc2,_0x56449c,_0xde5120){return _0x2f9e0f[_0x65c7('0x24')][_0x65c7('0x25')]({'where':{'ChanSpyId':_0x12dfc2['id']}})[_0x65c7('0x1b')](function(){return getChanSpyPromise(_0x2f9e0f,_0x12dfc2);})['then'](function(_0x4cbbc3){if(_0x4cbbc3&&_0x4cbbc3[_0x65c7('0x22')]){return _0x2f9e0f[_0x65c7('0x24')][_0x65c7('0x23')](_0x4cbbc3);}})[_0x65c7('0x1b')](function(){_0xde5120();})['catch'](function(_0x3eb2d3){_0xde5120(_0x3eb2d3);});},'afterDestroy':function(_0x4892de,_0xa3b9f8,_0x47dbaa){return _0x2f9e0f['VoiceExtension'][_0x65c7('0x25')]({'where':{'ChanSpyId':_0x4892de['id']}})[_0x65c7('0x1b')](function(){_0x47dbaa();})['catch'](function(_0x465cb2){_0x47dbaa(_0x465cb2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6d329d9..9c99c02 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 _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x0fd9[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x55e0,0xdc));var _0x055e=function(_0x549972,_0x50d1bc){_0x549972=_0x549972-0x0;var _0x2fee27=_0x55e0[_0x549972];return _0x2fee27;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index fe4d665..13a4fd5 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 _0x43f8=['show','post','put','/:id','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated'];(function(_0x5d5898,_0x363773){var _0x17166a=function(_0x4b7b60){while(--_0x4b7b60){_0x5d5898['push'](_0x5d5898['shift']());}};_0x17166a(++_0x363773);}(_0x43f8,0xf6));var _0x843f=function(_0x105b90,_0x6a1466){_0x105b90=_0x105b90-0x0;var _0x47e031=_0x43f8[_0x105b90];return _0x47e031;};'use strict';var multer=require(_0x843f('0x0'));var util=require(_0x843f('0x1'));var path=require('path');var timeout=require(_0x843f('0x2'));var express=require(_0x843f('0x3'));var router=express[_0x843f('0x4')]();var fs_extra=require(_0x843f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x843f('0x6'));var config=require('../../config/environment');var controller=require(_0x843f('0x7'));router[_0x843f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x843f('0x8')]('/:id',auth[_0x843f('0x9')](),controller[_0x843f('0xa')]);router[_0x843f('0xb')]('/',auth[_0x843f('0x9')](),controller['create']);router[_0x843f('0xc')](_0x843f('0xd'),auth[_0x843f('0x9')](),controller[_0x843f('0xe')]);router[_0x843f('0xf')]('/:id',auth[_0x843f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0355=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index','isAuthenticated','show','post','create','/:id','update','destroy','exports'];(function(_0x15da6e,_0x3bd05e){var _0x2dd920=function(_0x2224f6){while(--_0x2224f6){_0x15da6e['push'](_0x15da6e['shift']());}};_0x2dd920(++_0x3bd05e);}(_0x0355,0x98));var _0x5035=function(_0x41cf16,_0x17ff65){_0x41cf16=_0x41cf16-0x0;var _0x54c205=_0x0355[_0x41cf16];return _0x54c205;};'use strict';var multer=require('multer');var util=require(_0x5035('0x0'));var path=require(_0x5035('0x1'));var timeout=require(_0x5035('0x2'));var express=require(_0x5035('0x3'));var router=express[_0x5035('0x4')]();var fs_extra=require(_0x5035('0x5'));var auth=require(_0x5035('0x6'));var interaction=require(_0x5035('0x7'));var config=require('../../config/environment');var controller=require(_0x5035('0x8'));router[_0x5035('0x9')]('/',auth['isAuthenticated'](),controller[_0x5035('0xa')]);router[_0x5035('0x9')]('/:id',auth[_0x5035('0xb')](),controller[_0x5035('0xc')]);router[_0x5035('0xd')]('/',auth[_0x5035('0xb')](),controller[_0x5035('0xe')]);router['put'](_0x5035('0xf'),auth['isAuthenticated'](),controller[_0x5035('0x10')]);router['delete']('/:id',auth[_0x5035('0xb')](),controller[_0x5035('0x11')]);module[_0x5035('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 40e8af2..da7f9a3 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 _0x5f7a=['STRING','BOOLEAN','exports'];(function(_0x33d3d9,_0x15a435){var _0x4068c2=function(_0x4cab11){while(--_0x4cab11){_0x33d3d9['push'](_0x33d3d9['shift']());}};_0x4068c2(++_0x15a435);}(_0x5f7a,0x1eb));var _0xa5f7=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x5f7a[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require('sequelize');module[_0xa5f7('0x0')]={'name':{'type':Sequelize[_0xa5f7('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa5f7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd15f=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd15f,0x1ce));var _0xfd15=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xd15f[_0x2d8d69];return _0x39ae22;};'use strict';var Sequelize=require(_0xfd15('0x0'));module[_0xfd15('0x1')]={'name':{'type':Sequelize[_0xfd15('0x2')],'unique':_0xfd15('0x3')},'description':{'type':Sequelize[_0xfd15('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xfd15('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index c0d4965..c0c44a0 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 _0x1f97=['../../config/license/hardware','../../config/utils','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','options','find','create','body','readFileSync','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','findAll','join','utf8','render','root','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x1f97,0xbb));var _0x71f9=function(_0x4564e1,_0x256969){_0x4564e1=_0x4564e1-0x0;var _0x1700a5=_0x1f97[_0x4564e1];return _0x1700a5;};'use strict';var emlformat=require(_0x71f9('0x0'));var rimraf=require(_0x71f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71f9('0x2'));var rp=require('request-promise');var moment=require(_0x71f9('0x3'));var BPromise=require(_0x71f9('0x4'));var Mustache=require(_0x71f9('0x5'));var util=require(_0x71f9('0x6'));var path=require(_0x71f9('0x7'));var sox=require('sox');var csv=require(_0x71f9('0x8'));var ejs=require(_0x71f9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71f9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x71f9('0xb'));var deskjs=require(_0x71f9('0xc'));var toCsv=require(_0x71f9('0x8'));var querystring=require(_0x71f9('0xd'));var Papa=require(_0x71f9('0xe'));var Redis=require(_0x71f9('0xf'));var authService=require(_0x71f9('0x10'));var qs=require(_0x71f9('0x11'));var as=require(_0x71f9('0x12'));var hardwareService=require(_0x71f9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x71f9('0x14'));var config=require(_0x71f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x71f9('0x16')][_0x71f9('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2dac35,_0x3d58f7,_0x3720fe,_0x5d6fad){return new BPromise(function(_0xdfe643,_0x1e44c3){var _0x3fddeb=_0x5d6fad||client;return _0x3fddeb[_0x71f9('0x18')](_0x2dac35,_0x3720fe)[_0x71f9('0x19')](function(_0x476603){logger[_0x71f9('0x1a')](_0x71f9('0x1b'),_0x3d58f7,_0x71f9('0x1c'));logger['debug'](_0x71f9('0x1d'),_0x3d58f7,_0x71f9('0x1c'),JSON[_0x71f9('0x1e')](_0x476603));if(_0x476603[_0x71f9('0x1f')]){if(_0x476603[_0x71f9('0x1f')][_0x71f9('0x20')]===0x1f4){logger[_0x71f9('0x1f')](_0x71f9('0x1b'),_0x3d58f7,_0x476603[_0x71f9('0x1f')][_0x71f9('0x21')]);return _0x1e44c3(_0x476603[_0x71f9('0x1f')][_0x71f9('0x21')]);}logger[_0x71f9('0x1f')](_0x71f9('0x1b'),_0x3d58f7,_0x476603['error'][_0x71f9('0x21')]);return _0xdfe643(_0x476603[_0x71f9('0x1f')]['message']);}else{logger[_0x71f9('0x1a')](_0x71f9('0x1b'),_0x3d58f7,_0x71f9('0x1c'));_0xdfe643(_0x476603[_0x71f9('0x22')]['message']);}})['catch'](function(_0x13a44d){logger[_0x71f9('0x1f')](_0x71f9('0x1b'),_0x3d58f7,_0x13a44d);_0x1e44c3(_0x13a44d);});});}function respondWithStatusCode(_0x571e1f,_0x46edd3){_0x46edd3=_0x46edd3||0xcc;return function(_0x3067d0){if(_0x3067d0){return _0x571e1f[_0x71f9('0x23')](_0x46edd3);}return _0x571e1f[_0x71f9('0x24')](_0x46edd3)[_0x71f9('0x25')]();};}function respondWithResult(_0x118229,_0x101d53){_0x101d53=_0x101d53||0xc8;return function(_0x3f3679){if(_0x3f3679){return _0x118229[_0x71f9('0x24')](_0x101d53)[_0x71f9('0x26')](_0x3f3679);}};}function respondWithFilteredResult(_0x66c29d,_0x37e894){return function(_0x3c2053){if(_0x3c2053){var _0x47db12=typeof _0x37e894['offset']===_0x71f9('0x27')&&typeof _0x37e894['limit']==='undefined';var _0x13769e=_0x3c2053[_0x71f9('0x28')];var _0x48fa46=_0x47db12?0x0:_0x37e894[_0x71f9('0x29')];var _0x1d4cd6=_0x47db12?_0x3c2053[_0x71f9('0x28')]:_0x37e894[_0x71f9('0x29')]+_0x37e894['limit'];var _0x41417a;if(_0x1d4cd6>=_0x13769e){_0x1d4cd6=_0x13769e;_0x41417a=0xc8;}else{_0x41417a=0xce;}_0x66c29d[_0x71f9('0x24')](_0x41417a);return _0x66c29d[_0x71f9('0x2a')](_0x71f9('0x2b'),_0x48fa46+'-'+_0x1d4cd6+'/'+_0x13769e)[_0x71f9('0x26')](_0x3c2053);}return null;};}function patchUpdates(_0x20b95c){return function(_0x39634f){try{jsonpatch[_0x71f9('0x2c')](_0x39634f,_0x20b95c,!![]);}catch(_0xf04f57){return BPromise[_0x71f9('0x2d')](_0xf04f57);}return _0x39634f[_0x71f9('0x2e')]();};}function saveUpdates(_0x493d7e,_0x1a6f51){return function(_0x3bccb3){if(_0x3bccb3){return _0x3bccb3[_0x71f9('0x2f')](_0x493d7e)[_0x71f9('0x19')](function(_0x35b456){return _0x35b456;});}return null;};}function removeEntity(_0x3de143,_0x143ff8){return function(_0x253a31){if(_0x253a31){return _0x253a31[_0x71f9('0x30')]()[_0x71f9('0x19')](function(){var _0x55f1cb=_0x253a31[_0x71f9('0x31')]({'plain':!![]});var _0x3b1e47=_0x71f9('0x32');return db[_0x71f9('0x33')]['destroy']({'where':{'type':_0x3b1e47,'resourceId':_0x55f1cb['id']}})['then'](function(){return _0x253a31;});})[_0x71f9('0x19')](function(){_0x3de143[_0x71f9('0x24')](0xcc)[_0x71f9('0x25')]();});}};}function handleEntityNotFound(_0x15e91f,_0x1b2979){return function(_0x2a5b52){if(!_0x2a5b52){_0x15e91f[_0x71f9('0x23')](0x194);}return _0x2a5b52;};}function handleError(_0x501c7c,_0x49bcc7){_0x49bcc7=_0x49bcc7||0x1f4;return function(_0x2fcef8){logger[_0x71f9('0x1f')](_0x2fcef8[_0x71f9('0x34')]);if(_0x2fcef8[_0x71f9('0x35')]){delete _0x2fcef8['name'];}_0x501c7c['status'](_0x49bcc7)[_0x71f9('0x36')](_0x2fcef8);};}exports[_0x71f9('0x37')]=function(_0x35f90e,_0x43e64e){var _0x476ca4={},_0x322c94={},_0x5efc85={'count':0x0,'rows':[]};var _0xb8b37=_[_0x71f9('0x38')](db[_0x71f9('0x39')][_0x71f9('0x3a')],function(_0x3666e9){return{'name':_0x3666e9['fieldName'],'type':_0x3666e9['type'][_0x71f9('0x3b')]};});_0x322c94[_0x71f9('0x3c')]=_[_0x71f9('0x38')](_0xb8b37,_0x71f9('0x35'));_0x322c94[_0x71f9('0x3d')]=_[_0x71f9('0x3e')](_0x35f90e[_0x71f9('0x3d')]);_0x322c94[_0x71f9('0x3f')]=_[_0x71f9('0x40')](_0x322c94['model'],_0x322c94[_0x71f9('0x3d')]);_0x476ca4[_0x71f9('0x41')]=_[_0x71f9('0x40')](_0x322c94[_0x71f9('0x3c')],qs[_0x71f9('0x42')](_0x35f90e[_0x71f9('0x3d')]['fields']));_0x476ca4[_0x71f9('0x41')]=_0x476ca4[_0x71f9('0x41')]['length']?_0x476ca4['attributes']:_0x322c94[_0x71f9('0x3c')];if(!_0x35f90e['query']['hasOwnProperty'](_0x71f9('0x43'))){_0x476ca4[_0x71f9('0x44')]=qs[_0x71f9('0x44')](_0x35f90e[_0x71f9('0x3d')][_0x71f9('0x44')]);_0x476ca4['offset']=qs[_0x71f9('0x29')](_0x35f90e['query']['offset']);}_0x476ca4[_0x71f9('0x45')]=qs[_0x71f9('0x46')](_0x35f90e[_0x71f9('0x3d')]['sort']);_0x476ca4[_0x71f9('0x47')]=qs[_0x71f9('0x3f')](_[_0x71f9('0x48')](_0x35f90e[_0x71f9('0x3d')],_0x322c94[_0x71f9('0x3f')]),_0xb8b37);if(_0x35f90e[_0x71f9('0x3d')]['filter']){_0x476ca4[_0x71f9('0x47')]=_[_0x71f9('0x49')](_0x476ca4[_0x71f9('0x47')],{'$or':_['map'](_0xb8b37,function(_0x30eace){if(_0x30eace[_0x71f9('0x4a')]!==_0x71f9('0x4b')){var _0x5edb94={};_0x5edb94[_0x30eace['name']]={'$like':'%'+_0x35f90e['query'][_0x71f9('0x4c')]+'%'};return _0x5edb94;}})});}_0x476ca4=_[_0x71f9('0x49')]({},_0x476ca4,_0x35f90e['options']);var _0x202807={'where':_0x476ca4[_0x71f9('0x47')]};return db[_0x71f9('0x39')]['count'](_0x202807)[_0x71f9('0x19')](function(_0x12a8b6){_0x5efc85['count']=_0x12a8b6;if(_0x35f90e[_0x71f9('0x3d')][_0x71f9('0x4d')]){_0x476ca4[_0x71f9('0x4e')]=[{'all':!![]}];}return db[_0x71f9('0x39')]['findAll'](_0x476ca4);})[_0x71f9('0x19')](function(_0x56db9c){_0x5efc85[_0x71f9('0x4f')]=_0x56db9c;return _0x5efc85;})[_0x71f9('0x19')](respondWithFilteredResult(_0x43e64e,_0x476ca4))[_0x71f9('0x50')](handleError(_0x43e64e,null));};exports[_0x71f9('0x51')]=function(_0x3a8b85,_0x30d439){var _0x19ce92={'raw':![],'where':{'id':_0x3a8b85['params']['id']}},_0x224bf6={};_0x224bf6[_0x71f9('0x3c')]=_['keys'](db[_0x71f9('0x39')][_0x71f9('0x3a')]);_0x224bf6['query']=_[_0x71f9('0x3e')](_0x3a8b85[_0x71f9('0x3d')]);_0x224bf6[_0x71f9('0x3f')]=_[_0x71f9('0x40')](_0x224bf6[_0x71f9('0x3c')],_0x224bf6[_0x71f9('0x3d')]);_0x19ce92[_0x71f9('0x41')]=_[_0x71f9('0x40')](_0x224bf6[_0x71f9('0x3c')],qs[_0x71f9('0x42')](_0x3a8b85['query']['fields']));_0x19ce92[_0x71f9('0x41')]=_0x19ce92['attributes']['length']?_0x19ce92[_0x71f9('0x41')]:_0x224bf6[_0x71f9('0x3c')];if(_0x3a8b85['query'][_0x71f9('0x4d')]){_0x19ce92[_0x71f9('0x4e')]=[{'all':!![]}];}_0x19ce92=_[_0x71f9('0x49')]({},_0x19ce92,_0x3a8b85[_0x71f9('0x52')]);return db[_0x71f9('0x39')][_0x71f9('0x53')](_0x19ce92)['then'](handleEntityNotFound(_0x30d439,null))[_0x71f9('0x19')](respondWithResult(_0x30d439,null))[_0x71f9('0x50')](handleError(_0x30d439,null));};exports[_0x71f9('0x54')]=function(_0xd43ac3,_0x6af09c,_0x4e9c33){var _0x174477;return db[_0x71f9('0x39')][_0x71f9('0x54')](_0xd43ac3[_0x71f9('0x55')],{'raw':!![]})['then'](function(_0x98c59e){_0x174477=_0x98c59e;return db[_0x71f9('0x39')]['findAll']({'raw':!![]});})['then'](function(_0x2a7981){var _0x1cd304=fs[_0x71f9('0x56')](path['join'](config['root'],_0x71f9('0x57')),'utf8');var _0x343ac4=ejs['render'](_0x1cd304,{'contexts':_0x2a7981||[]});fs[_0x71f9('0x58')](_0x71f9('0x59'),_0x343ac4);})[_0x71f9('0x19')](function(){return respondWithRpcPromise(_0x71f9('0x5a'),_0x71f9('0x54'),{'module':_0x71f9('0x5b')});})['then'](function(){var _0x165f8b=_0xd43ac3[_0x71f9('0x5c')][_0x71f9('0x31')]({'plain':!![]});if(!_0x165f8b)throw new Error(_0x71f9('0x5d'));if(_0x165f8b[_0x71f9('0x5e')]===_0x71f9('0x5c')){var _0x4d0d56=_0x174477['get']({'plain':!![]});return db[_0x71f9('0x5f')]['find']({'where':{'name':_0x71f9('0x32'),'userProfileId':_0x165f8b['userProfileId']},'raw':!![]})['then'](function(_0x1ac3f5){if(_0x1ac3f5&&_0x1ac3f5[_0x71f9('0x60')]===0x0){return db[_0x71f9('0x33')]['create']({'name':_0x4d0d56['name'],'resourceId':_0x4d0d56['id'],'type':_0x1ac3f5[_0x71f9('0x35')],'sectionId':_0x1ac3f5['id']},{})[_0x71f9('0x19')](function(){return _0x174477;});}else{return _0x174477;}})[_0x71f9('0x50')](function(_0x5bed43){logger[_0x71f9('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bed43);throw _0x5bed43;});}return _0x174477;})[_0x71f9('0x19')](respondWithResult(_0x6af09c,0xc9))[_0x71f9('0x50')](handleError(_0x6af09c,null));};exports[_0x71f9('0x2f')]=function(_0x246608,_0x4a3667,_0x17f285){var _0x8d7c1a;return db[_0x71f9('0x39')][_0x71f9('0x53')]({'where':{'id':_0x246608[_0x71f9('0x61')]['id']}})[_0x71f9('0x19')](handleEntityNotFound(_0x4a3667,null))['then'](saveUpdates(_0x246608['body'],null))['then'](function(_0x419407){if(_0x419407){_0x8d7c1a=_0x419407;return db['VoiceContext'][_0x71f9('0x62')]({'raw':!![]});}})[_0x71f9('0x19')](function(_0x21e215){var _0x47cd23=fs[_0x71f9('0x56')](path[_0x71f9('0x63')](config['root'],_0x71f9('0x57')),_0x71f9('0x64'));var _0x301a9c=ejs[_0x71f9('0x65')](_0x47cd23,{'contexts':_0x21e215||[]});fs[_0x71f9('0x58')](_0x71f9('0x59'),_0x301a9c);})[_0x71f9('0x19')](function(){return respondWithRpcPromise(_0x71f9('0x5a'),_0x71f9('0x2f'),{'module':_0x71f9('0x5b')});})[_0x71f9('0x19')](function(){return _0x8d7c1a;})[_0x71f9('0x19')](respondWithResult(_0x4a3667,null))[_0x71f9('0x50')](handleError(_0x4a3667,null));};exports[_0x71f9('0x30')]=function(_0x28af76,_0x1ac936,_0x107d92){var _0x414709;return db[_0x71f9('0x39')]['find']({'where':{'id':_0x28af76['params']['id']}})['then'](handleEntityNotFound(_0x1ac936,null))[_0x71f9('0x19')](removeEntity(_0x1ac936,null))[_0x71f9('0x19')](function(){return db[_0x71f9('0x39')][_0x71f9('0x62')]({'raw':!![]});})[_0x71f9('0x19')](function(_0x67924a){var _0x53b70b=fs['readFileSync'](path['join'](config[_0x71f9('0x66')],'server/files/templates/context.ejs'),_0x71f9('0x64'));var _0x630f86=ejs[_0x71f9('0x65')](_0x53b70b,{'contexts':_0x67924a});fs[_0x71f9('0x58')](_0x71f9('0x59'),_0x630f86);return respondWithRpcPromise(_0x71f9('0x5a'),_0x71f9('0x30'),{'module':'chan_sip.so'});})[_0x71f9('0x50')](handleError(_0x1ac936,null));}; \ No newline at end of file +var _0xf0d7=['render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','readFileSync','root','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','undefined','limit','count','offset','apply','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','VoiceContext','rawAttributes','include','options','find','create','join','server/files/templates/context.ejs','utf8'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0xf0d7,0xe1));var _0x7f0d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf0d7[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7f0d('0x0'));var rimraf=require(_0x7f0d('0x1'));var zipdir=require(_0x7f0d('0x2'));var jsonpatch=require(_0x7f0d('0x3'));var rp=require(_0x7f0d('0x4'));var moment=require('moment');var BPromise=require(_0x7f0d('0x5'));var Mustache=require(_0x7f0d('0x6'));var util=require(_0x7f0d('0x7'));var path=require(_0x7f0d('0x8'));var sox=require(_0x7f0d('0x9'));var csv=require('to-csv');var ejs=require(_0x7f0d('0xa'));var fs=require('fs');var fs_extra=require(_0x7f0d('0xb'));var _=require(_0x7f0d('0xc'));var squel=require(_0x7f0d('0xd'));var crypto=require(_0x7f0d('0xe'));var jsforce=require(_0x7f0d('0xf'));var deskjs=require(_0x7f0d('0x10'));var toCsv=require(_0x7f0d('0x11'));var querystring=require('querystring');var Papa=require(_0x7f0d('0x12'));var Redis=require(_0x7f0d('0x13'));var authService=require(_0x7f0d('0x14'));var qs=require(_0x7f0d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f0d('0x16'));var logger=require(_0x7f0d('0x17'))(_0x7f0d('0x18'));var utils=require(_0x7f0d('0x19'));var config=require(_0x7f0d('0x1a'));var licenseUtil=require(_0x7f0d('0x1b'));var db=require(_0x7f0d('0x1c'))['db'];var jayson=require(_0x7f0d('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x226491,_0x2394b8,_0x4b7ada,_0x8ce203){return new BPromise(function(_0x197805,_0x323c82){var _0x324468=_0x8ce203||client;return _0x324468[_0x7f0d('0x1e')](_0x226491,_0x4b7ada)[_0x7f0d('0x1f')](function(_0x50387e){logger[_0x7f0d('0x20')](_0x7f0d('0x21'),_0x2394b8,_0x7f0d('0x22'));logger['debug'](_0x7f0d('0x23'),_0x2394b8,_0x7f0d('0x22'),JSON[_0x7f0d('0x24')](_0x50387e));if(_0x50387e[_0x7f0d('0x25')]){if(_0x50387e[_0x7f0d('0x25')]['code']===0x1f4){logger[_0x7f0d('0x25')](_0x7f0d('0x21'),_0x2394b8,_0x50387e[_0x7f0d('0x25')][_0x7f0d('0x26')]);return _0x323c82(_0x50387e['error'][_0x7f0d('0x26')]);}logger[_0x7f0d('0x25')](_0x7f0d('0x21'),_0x2394b8,_0x50387e[_0x7f0d('0x25')][_0x7f0d('0x26')]);return _0x197805(_0x50387e[_0x7f0d('0x25')][_0x7f0d('0x26')]);}else{logger[_0x7f0d('0x20')]('VoiceContext,\x20%s,\x20%s',_0x2394b8,_0x7f0d('0x22'));_0x197805(_0x50387e['result'][_0x7f0d('0x26')]);}})[_0x7f0d('0x27')](function(_0x216cd4){logger[_0x7f0d('0x25')](_0x7f0d('0x21'),_0x2394b8,_0x216cd4);_0x323c82(_0x216cd4);});});}function respondWithStatusCode(_0x1b3e8f,_0x6321d9){_0x6321d9=_0x6321d9||0xcc;return function(_0x370670){if(_0x370670){return _0x1b3e8f[_0x7f0d('0x28')](_0x6321d9);}return _0x1b3e8f[_0x7f0d('0x29')](_0x6321d9)['end']();};}function respondWithResult(_0x20be71,_0x2037e3){_0x2037e3=_0x2037e3||0xc8;return function(_0x4a7e0a){if(_0x4a7e0a){return _0x20be71[_0x7f0d('0x29')](_0x2037e3)[_0x7f0d('0x2a')](_0x4a7e0a);}};}function respondWithFilteredResult(_0x4f3f0d,_0x1f088c){return function(_0x2fb186){if(_0x2fb186){var _0x322717=typeof _0x1f088c['offset']===_0x7f0d('0x2b')&&typeof _0x1f088c[_0x7f0d('0x2c')]===_0x7f0d('0x2b');var _0x157395=_0x2fb186['count'];var _0x76e411=_0x322717?0x0:_0x1f088c['offset'];var _0x2c5077=_0x322717?_0x2fb186[_0x7f0d('0x2d')]:_0x1f088c[_0x7f0d('0x2e')]+_0x1f088c[_0x7f0d('0x2c')];var _0x57eb9c;if(_0x2c5077>=_0x157395){_0x2c5077=_0x157395;_0x57eb9c=0xc8;}else{_0x57eb9c=0xce;}_0x4f3f0d['status'](_0x57eb9c);return _0x4f3f0d['set']('Content-Range',_0x76e411+'-'+_0x2c5077+'/'+_0x157395)[_0x7f0d('0x2a')](_0x2fb186);}return null;};}function patchUpdates(_0x167fbc){return function(_0x3850b5){try{jsonpatch[_0x7f0d('0x2f')](_0x3850b5,_0x167fbc,!![]);}catch(_0x4cc963){return BPromise['reject'](_0x4cc963);}return _0x3850b5['save']();};}function saveUpdates(_0x4e5518,_0x4fd5fa){return function(_0x276d97){if(_0x276d97){return _0x276d97[_0x7f0d('0x30')](_0x4e5518)[_0x7f0d('0x1f')](function(_0x16b587){return _0x16b587;});}return null;};}function removeEntity(_0x482eb0,_0x568846){return function(_0x17d775){if(_0x17d775){return _0x17d775[_0x7f0d('0x31')]()['then'](function(){var _0x2a5284=_0x17d775[_0x7f0d('0x32')]({'plain':!![]});var _0x3dbf6e=_0x7f0d('0x33');return db[_0x7f0d('0x34')][_0x7f0d('0x31')]({'where':{'type':_0x3dbf6e,'resourceId':_0x2a5284['id']}})[_0x7f0d('0x1f')](function(){return _0x17d775;});})[_0x7f0d('0x1f')](function(){_0x482eb0[_0x7f0d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x397bf2,_0x479bad){return function(_0x14b058){if(!_0x14b058){_0x397bf2[_0x7f0d('0x28')](0x194);}return _0x14b058;};}function handleError(_0x419ca0,_0x58698d){_0x58698d=_0x58698d||0x1f4;return function(_0x13bdc9){logger[_0x7f0d('0x25')](_0x13bdc9[_0x7f0d('0x35')]);if(_0x13bdc9[_0x7f0d('0x36')]){delete _0x13bdc9[_0x7f0d('0x36')];}_0x419ca0[_0x7f0d('0x29')](_0x58698d)[_0x7f0d('0x37')](_0x13bdc9);};}exports[_0x7f0d('0x38')]=function(_0x5e7cbc,_0x3a3c5b){var _0x5e177e={},_0x24f6de={},_0x509b24={'count':0x0,'rows':[]};var _0x4178f0=_[_0x7f0d('0x39')](db['VoiceContext']['rawAttributes'],function(_0x401f1e){return{'name':_0x401f1e[_0x7f0d('0x3a')],'type':_0x401f1e[_0x7f0d('0x3b')][_0x7f0d('0x3c')]};});_0x24f6de[_0x7f0d('0x3d')]=_['map'](_0x4178f0,_0x7f0d('0x36'));_0x24f6de[_0x7f0d('0x3e')]=_[_0x7f0d('0x3f')](_0x5e7cbc[_0x7f0d('0x3e')]);_0x24f6de[_0x7f0d('0x40')]=_[_0x7f0d('0x41')](_0x24f6de[_0x7f0d('0x3d')],_0x24f6de['query']);_0x5e177e[_0x7f0d('0x42')]=_[_0x7f0d('0x41')](_0x24f6de[_0x7f0d('0x3d')],qs[_0x7f0d('0x43')](_0x5e7cbc[_0x7f0d('0x3e')][_0x7f0d('0x43')]));_0x5e177e[_0x7f0d('0x42')]=_0x5e177e[_0x7f0d('0x42')][_0x7f0d('0x44')]?_0x5e177e['attributes']:_0x24f6de[_0x7f0d('0x3d')];if(!_0x5e7cbc['query'][_0x7f0d('0x45')](_0x7f0d('0x46'))){_0x5e177e[_0x7f0d('0x2c')]=qs[_0x7f0d('0x2c')](_0x5e7cbc[_0x7f0d('0x3e')]['limit']);_0x5e177e[_0x7f0d('0x2e')]=qs[_0x7f0d('0x2e')](_0x5e7cbc[_0x7f0d('0x3e')][_0x7f0d('0x2e')]);}_0x5e177e[_0x7f0d('0x47')]=qs[_0x7f0d('0x48')](_0x5e7cbc[_0x7f0d('0x3e')][_0x7f0d('0x48')]);_0x5e177e[_0x7f0d('0x49')]=qs[_0x7f0d('0x40')](_[_0x7f0d('0x4a')](_0x5e7cbc[_0x7f0d('0x3e')],_0x24f6de['filters']),_0x4178f0);if(_0x5e7cbc[_0x7f0d('0x3e')][_0x7f0d('0x4b')]){_0x5e177e[_0x7f0d('0x49')]=_[_0x7f0d('0x4c')](_0x5e177e[_0x7f0d('0x49')],{'$or':_[_0x7f0d('0x39')](_0x4178f0,function(_0x20be77){if(_0x20be77[_0x7f0d('0x3b')]!==_0x7f0d('0x4d')){var _0xe1fcd2={};_0xe1fcd2[_0x20be77[_0x7f0d('0x36')]]={'$like':'%'+_0x5e7cbc[_0x7f0d('0x3e')][_0x7f0d('0x4b')]+'%'};return _0xe1fcd2;}})});}_0x5e177e=_[_0x7f0d('0x4c')]({},_0x5e177e,_0x5e7cbc['options']);var _0x32739c={'where':_0x5e177e[_0x7f0d('0x49')]};return db['VoiceContext'][_0x7f0d('0x2d')](_0x32739c)[_0x7f0d('0x1f')](function(_0x12889d){_0x509b24['count']=_0x12889d;if(_0x5e7cbc[_0x7f0d('0x3e')][_0x7f0d('0x4e')]){_0x5e177e['include']=[{'all':!![]}];}return db['VoiceContext'][_0x7f0d('0x4f')](_0x5e177e);})[_0x7f0d('0x1f')](function(_0x1cf53f){_0x509b24[_0x7f0d('0x50')]=_0x1cf53f;return _0x509b24;})['then'](respondWithFilteredResult(_0x3a3c5b,_0x5e177e))[_0x7f0d('0x27')](handleError(_0x3a3c5b,null));};exports['show']=function(_0x3f5de1,_0x41f77c){var _0x3d5b6b={'raw':![],'where':{'id':_0x3f5de1['params']['id']}},_0x52ffe6={};_0x52ffe6[_0x7f0d('0x3d')]=_['keys'](db[_0x7f0d('0x51')][_0x7f0d('0x52')]);_0x52ffe6[_0x7f0d('0x3e')]=_[_0x7f0d('0x3f')](_0x3f5de1['query']);_0x52ffe6['filters']=_['intersection'](_0x52ffe6[_0x7f0d('0x3d')],_0x52ffe6[_0x7f0d('0x3e')]);_0x3d5b6b[_0x7f0d('0x42')]=_[_0x7f0d('0x41')](_0x52ffe6[_0x7f0d('0x3d')],qs[_0x7f0d('0x43')](_0x3f5de1[_0x7f0d('0x3e')][_0x7f0d('0x43')]));_0x3d5b6b[_0x7f0d('0x42')]=_0x3d5b6b['attributes']['length']?_0x3d5b6b[_0x7f0d('0x42')]:_0x52ffe6[_0x7f0d('0x3d')];if(_0x3f5de1[_0x7f0d('0x3e')][_0x7f0d('0x4e')]){_0x3d5b6b[_0x7f0d('0x53')]=[{'all':!![]}];}_0x3d5b6b=_[_0x7f0d('0x4c')]({},_0x3d5b6b,_0x3f5de1[_0x7f0d('0x54')]);return db[_0x7f0d('0x51')][_0x7f0d('0x55')](_0x3d5b6b)[_0x7f0d('0x1f')](handleEntityNotFound(_0x41f77c,null))[_0x7f0d('0x1f')](respondWithResult(_0x41f77c,null))[_0x7f0d('0x27')](handleError(_0x41f77c,null));};exports[_0x7f0d('0x56')]=function(_0x1d9a7b,_0x7c9000,_0x580ffa){var _0x59074b;return db[_0x7f0d('0x51')][_0x7f0d('0x56')](_0x1d9a7b['body'],{'raw':!![]})[_0x7f0d('0x1f')](function(_0x1e003d){_0x59074b=_0x1e003d;return db['VoiceContext'][_0x7f0d('0x4f')]({'raw':!![]});})['then'](function(_0x4d58b7){var _0x166d39=fs['readFileSync'](path[_0x7f0d('0x57')](config['root'],_0x7f0d('0x58')),_0x7f0d('0x59'));var _0x1e4629=ejs[_0x7f0d('0x5a')](_0x166d39,{'contexts':_0x4d58b7||[]});fs[_0x7f0d('0x5b')](_0x7f0d('0x5c'),_0x1e4629);})['then'](function(){return respondWithRpcPromise('Reload',_0x7f0d('0x56'),{'module':_0x7f0d('0x5d')});})[_0x7f0d('0x1f')](function(){var _0x301c12=_0x1d9a7b['user'][_0x7f0d('0x32')]({'plain':!![]});if(!_0x301c12)throw new Error(_0x7f0d('0x5e'));if(_0x301c12['role']===_0x7f0d('0x5f')){var _0x4ca8d9=_0x59074b[_0x7f0d('0x32')]({'plain':!![]});return db[_0x7f0d('0x60')][_0x7f0d('0x55')]({'where':{'name':_0x7f0d('0x33'),'userProfileId':_0x301c12[_0x7f0d('0x61')]},'raw':!![]})[_0x7f0d('0x1f')](function(_0x596f48){if(_0x596f48&&_0x596f48[_0x7f0d('0x62')]===0x0){return db[_0x7f0d('0x34')][_0x7f0d('0x56')]({'name':_0x4ca8d9[_0x7f0d('0x36')],'resourceId':_0x4ca8d9['id'],'type':_0x596f48[_0x7f0d('0x36')],'sectionId':_0x596f48['id']},{})['then'](function(){return _0x59074b;});}else{return _0x59074b;}})[_0x7f0d('0x27')](function(_0x5e1990){logger[_0x7f0d('0x25')](_0x7f0d('0x63'),_0x5e1990);throw _0x5e1990;});}return _0x59074b;})['then'](respondWithResult(_0x7c9000,0xc9))[_0x7f0d('0x27')](handleError(_0x7c9000,null));};exports[_0x7f0d('0x30')]=function(_0x47c608,_0x50d5a6,_0x53f5d3){var _0x476c2e;return db[_0x7f0d('0x51')][_0x7f0d('0x55')]({'where':{'id':_0x47c608[_0x7f0d('0x64')]['id']}})['then'](handleEntityNotFound(_0x50d5a6,null))[_0x7f0d('0x1f')](saveUpdates(_0x47c608[_0x7f0d('0x65')],null))['then'](function(_0x1dcbfc){if(_0x1dcbfc){_0x476c2e=_0x1dcbfc;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x1169ec){var _0x698dab=fs[_0x7f0d('0x66')](path[_0x7f0d('0x57')](config[_0x7f0d('0x67')],_0x7f0d('0x58')),'utf8');var _0x36d45b=ejs['render'](_0x698dab,{'contexts':_0x1169ec||[]});fs[_0x7f0d('0x5b')](_0x7f0d('0x5c'),_0x36d45b);})['then'](function(){return respondWithRpcPromise(_0x7f0d('0x68'),'update',{'module':_0x7f0d('0x5d')});})[_0x7f0d('0x1f')](function(){return _0x476c2e;})[_0x7f0d('0x1f')](respondWithResult(_0x50d5a6,null))['catch'](handleError(_0x50d5a6,null));};exports[_0x7f0d('0x31')]=function(_0x6cc41c,_0x33e314,_0x12fadd){var _0x4db076;return db[_0x7f0d('0x51')]['find']({'where':{'id':_0x6cc41c[_0x7f0d('0x64')]['id']}})[_0x7f0d('0x1f')](handleEntityNotFound(_0x33e314,null))[_0x7f0d('0x1f')](removeEntity(_0x33e314,null))[_0x7f0d('0x1f')](function(){return db[_0x7f0d('0x51')]['findAll']({'raw':!![]});})[_0x7f0d('0x1f')](function(_0x4a6e1a){var _0x1dcf1d=fs[_0x7f0d('0x66')](path[_0x7f0d('0x57')](config['root'],_0x7f0d('0x58')),_0x7f0d('0x59'));var _0x21887c=ejs['render'](_0x1dcf1d,{'contexts':_0x4a6e1a});fs[_0x7f0d('0x5b')](_0x7f0d('0x5c'),_0x21887c);return respondWithRpcPromise(_0x7f0d('0x68'),_0x7f0d('0x31'),{'module':_0x7f0d('0x5d')});})[_0x7f0d('0x27')](handleError(_0x33e314,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 401cc0b..4a2c511 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 _0xc19f=['rimraf','../../config/environment','./voiceContext.attributes','exports','voice_contexts','../../config/logger','api','request-promise','path'];(function(_0x470d22,_0x1b6a4f){var _0x3cc44d=function(_0x4a3749){while(--_0x4a3749){_0x470d22['push'](_0x470d22['shift']());}};_0x3cc44d(++_0x1b6a4f);}(_0xc19f,0x164));var _0xfc19=function(_0x28752d,_0x2457f1){_0x28752d=_0x28752d-0x0;var _0x2d17a5=_0xc19f[_0x28752d];return _0x2d17a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc19('0x0'))(_0xfc19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc19('0x2'));var fs=require('fs');var path=require(_0xfc19('0x3'));var rimraf=require(_0xfc19('0x4'));var config=require(_0xfc19('0x5'));var attributes=require(_0xfc19('0x6'));module[_0xfc19('0x7')]=function(_0x3ca66e,_0x56332d){return _0x3ca66e['define']('VoiceContext',attributes,{'tableName':_0xfc19('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc895=['../../config/logger','moment','bluebird','rimraf','./voiceContext.attributes','exports','define','VoiceContext','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc895,0x167));var _0x5c89=function(_0x76bd2,_0x487abe){_0x76bd2=_0x76bd2-0x0;var _0x2e50f3=_0xc895[_0x76bd2];return _0x2e50f3;};'use strict';var _=require(_0x5c89('0x0'));var util=require('util');var logger=require(_0x5c89('0x1'))('api');var moment=require(_0x5c89('0x2'));var BPromise=require(_0x5c89('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5c89('0x4'));var config=require('../../config/environment');var attributes=require(_0x5c89('0x5'));module[_0x5c89('0x6')]=function(_0x2ccf93,_0xf3b980){return _0x2ccf93[_0x5c89('0x7')](_0x5c89('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index aeacc12..5b99382 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 _0xd509=['request','then','info','debug','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x58b643,_0x36aaa1){var _0x19ccff=function(_0x210545){while(--_0x210545){_0x58b643['push'](_0x58b643['shift']());}};_0x19ccff(++_0x36aaa1);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d50('0x0'));var BPromise=require(_0x9d50('0x1'));var rs=require(_0x9d50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9d50('0x3'));var logger=require(_0x9d50('0x4'))('rpc');var config=require(_0x9d50('0x5'));var jayson=require(_0x9d50('0x6'));var client=jayson[_0x9d50('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x907927,_0x57ca79,_0x427cee){return new BPromise(function(_0x9b5ecd,_0x2f7c2f){return client[_0x9d50('0x8')](_0x907927,_0x427cee)[_0x9d50('0x9')](function(_0x5380be){logger[_0x9d50('0xa')]('VoiceContext,\x20%s,\x20%s',_0x57ca79,'request\x20sent');logger[_0x9d50('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x57ca79,_0x9d50('0xc'),JSON[_0x9d50('0xd')](_0x5380be));if(_0x5380be[_0x9d50('0xe')]){if(_0x5380be[_0x9d50('0xe')][_0x9d50('0xf')]===0x1f4){logger[_0x9d50('0xe')](_0x9d50('0x10'),_0x57ca79,_0x5380be['error'][_0x9d50('0x11')]);return _0x2f7c2f(_0x5380be['error'][_0x9d50('0x11')]);}logger[_0x9d50('0xe')](_0x9d50('0x10'),_0x57ca79,_0x5380be[_0x9d50('0xe')][_0x9d50('0x11')]);return _0x9b5ecd(_0x5380be[_0x9d50('0xe')][_0x9d50('0x11')]);}else{logger[_0x9d50('0xa')](_0x9d50('0x10'),_0x57ca79,_0x9d50('0xc'));_0x9b5ecd(_0x5380be[_0x9d50('0x12')][_0x9d50('0x11')]);}})['catch'](function(_0x12d178){logger[_0x9d50('0xe')](_0x9d50('0x10'),_0x57ca79,_0x12d178);_0x2f7c2f(_0x12d178);});});} \ No newline at end of file +var _0x39d7=['stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0xbaf572,_0x1a7434){var _0x5e0093=function(_0x482c4e){while(--_0x482c4e){_0xbaf572['push'](_0xbaf572['shift']());}};_0x5e0093(++_0x1a7434);}(_0x39d7,0x12d));var _0x739d=function(_0x482b9e,_0x418a65){_0x482b9e=_0x482b9e-0x0;var _0x311212=_0x39d7[_0x482b9e];return _0x311212;};'use strict';var _=require(_0x739d('0x0'));var util=require(_0x739d('0x1'));var moment=require(_0x739d('0x2'));var BPromise=require('bluebird');var rs=require(_0x739d('0x3'));var fs=require('fs');var Redis=require(_0x739d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x739d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x739d('0x6'));var jayson=require(_0x739d('0x7'));var client=jayson[_0x739d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ca07e,_0x5be789,_0x5f12cd){return new BPromise(function(_0x2c8dbd,_0x5866b5){return client[_0x739d('0x9')](_0x3ca07e,_0x5f12cd)[_0x739d('0xa')](function(_0x148601){logger['info']('VoiceContext,\x20%s,\x20%s',_0x5be789,_0x739d('0xb'));logger[_0x739d('0xc')](_0x739d('0xd'),_0x5be789,_0x739d('0xb'),JSON[_0x739d('0xe')](_0x148601));if(_0x148601[_0x739d('0xf')]){if(_0x148601[_0x739d('0xf')][_0x739d('0x10')]===0x1f4){logger[_0x739d('0xf')](_0x739d('0x11'),_0x5be789,_0x148601[_0x739d('0xf')][_0x739d('0x12')]);return _0x5866b5(_0x148601[_0x739d('0xf')][_0x739d('0x12')]);}logger[_0x739d('0xf')](_0x739d('0x11'),_0x5be789,_0x148601[_0x739d('0xf')]['message']);return _0x2c8dbd(_0x148601[_0x739d('0xf')][_0x739d('0x12')]);}else{logger[_0x739d('0x13')](_0x739d('0x11'),_0x5be789,'request\x20sent');_0x2c8dbd(_0x148601[_0x739d('0x14')][_0x739d('0x12')]);}})['catch'](function(_0x1fd578){logger[_0x739d('0xf')](_0x739d('0x11'),_0x5be789,_0x1fd578);_0x5866b5(_0x1fd578);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a909a58..b8e5b1f 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 _0x9a59=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x2faebd,_0x4b87d9){var _0x3e3a7a=function(_0x5d7e35){while(--_0x5d7e35){_0x2faebd['push'](_0x2faebd['shift']());}};_0x3e3a7a(++_0x4b87d9);}(_0x9a59,0xce));var _0x99a5=function(_0x1910d1,_0x4483a3){_0x1910d1=_0x1910d1-0x0;var _0x311fc6=_0x9a59[_0x1910d1];return _0x311fc6;};'use strict';var multer=require(_0x99a5('0x0'));var util=require(_0x99a5('0x1'));var path=require(_0x99a5('0x2'));var timeout=require(_0x99a5('0x3'));var express=require(_0x99a5('0x4'));var router=express[_0x99a5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99a5('0x6'));var interaction=require(_0x99a5('0x7'));var config=require(_0x99a5('0x8'));var controller=require(_0x99a5('0x9'));router[_0x99a5('0xa')]('/',auth['isAuthenticated'](),controller[_0x99a5('0xb')]);router[_0x99a5('0xa')](_0x99a5('0xc'),auth[_0x99a5('0xd')](),controller[_0x99a5('0xe')]);router['get']('/:id',auth[_0x99a5('0xd')](),controller[_0x99a5('0xf')]);router[_0x99a5('0x10')]('/',auth[_0x99a5('0xd')](),controller[_0x99a5('0x11')]);router[_0x99a5('0x12')](_0x99a5('0x13'),auth[_0x99a5('0xd')](),controller[_0x99a5('0x14')]);router['delete'](_0x99a5('0x13'),auth[_0x99a5('0xd')](),controller[_0x99a5('0x15')]);module[_0x99a5('0x16')]=router; \ No newline at end of file +var _0xb001=['delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb001,0x7a));var _0x1b00=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xb001[_0x32f7d7];return _0x133d09;};'use strict';var multer=require(_0x1b00('0x0'));var util=require('util');var path=require(_0x1b00('0x1'));var timeout=require(_0x1b00('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b00('0x3'));var auth=require(_0x1b00('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1b00('0x5'));var controller=require(_0x1b00('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1b00('0x7')](_0x1b00('0x8'),auth[_0x1b00('0x9')](),controller[_0x1b00('0xa')]);router[_0x1b00('0x7')](_0x1b00('0xb'),auth[_0x1b00('0x9')](),controller['show']);router['post']('/',auth[_0x1b00('0x9')](),controller['create']);router[_0x1b00('0xc')](_0x1b00('0xb'),auth['isAuthenticated'](),controller[_0x1b00('0xd')]);router[_0x1b00('0xe')](_0x1b00('0xb'),auth[_0x1b00('0x9')](),controller[_0x1b00('0xf')]);module[_0x1b00('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b727bbf..fae335d 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 _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x9f62,0x154));var _0x29f6=function(_0x1903a4,_0x92a10f){_0x1903a4=_0x1903a4-0x0;var _0x253362=_0x9f62[_0x1903a4];return _0x253362;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file +var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x900e1e,_0x3803e4){var _0x57191d=function(_0x47e68e){while(--_0x47e68e){_0x900e1e['push'](_0x900e1e['shift']());}};_0x57191d(++_0x3803e4);}(_0xedd9,0xfc));var _0x9edd=function(_0x1e920c,_0x5340a8){_0x1e920c=_0x1e920c-0x0;var _0x414368=_0xedd9[_0x1e920c];return _0x414368;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 95c262e..cfc7753 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 _0x413a=['rows','catch','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x413a,0xdd));var _0xa413=function(_0xa4eb73,_0xb7f65d){_0xa4eb73=_0xa4eb73-0x0;var _0x1a2b7b=_0x413a[_0xa4eb73];return _0x1a2b7b;};'use strict';var emlformat=require(_0xa413('0x0'));var rimraf=require(_0xa413('0x1'));var zipdir=require(_0xa413('0x2'));var jsonpatch=require(_0xa413('0x3'));var rp=require(_0xa413('0x4'));var moment=require(_0xa413('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa413('0x6'));var util=require('util');var path=require(_0xa413('0x7'));var sox=require('sox');var csv=require(_0xa413('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa413('0x9'));var _=require(_0xa413('0xa'));var squel=require(_0xa413('0xb'));var crypto=require(_0xa413('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa413('0xd'));var toCsv=require(_0xa413('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa413('0xe'));var authService=require(_0xa413('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa413('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa413('0x11'))(_0xa413('0x12'));var utils=require(_0xa413('0x13'));var config=require(_0xa413('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa413('0x15'))['db'];function respondWithStatusCode(_0x36f4b8,_0x367aa2){_0x367aa2=_0x367aa2||0xcc;return function(_0x2fdd78){if(_0x2fdd78){return _0x36f4b8[_0xa413('0x16')](_0x367aa2);}return _0x36f4b8[_0xa413('0x17')](_0x367aa2)[_0xa413('0x18')]();};}function respondWithResult(_0x40ce56,_0x38783a){_0x38783a=_0x38783a||0xc8;return function(_0x5c1d12){if(_0x5c1d12){return _0x40ce56['status'](_0x38783a)[_0xa413('0x19')](_0x5c1d12);}};}function respondWithFilteredResult(_0x227f95,_0x3503d3){return function(_0x3650df){if(_0x3650df){var _0x33a50b=typeof _0x3503d3[_0xa413('0x1a')]===_0xa413('0x1b')&&typeof _0x3503d3[_0xa413('0x1c')]===_0xa413('0x1b');var _0x509cf4=_0x3650df[_0xa413('0x1d')];var _0x358a09=_0x33a50b?0x0:_0x3503d3[_0xa413('0x1a')];var _0x3a3408=_0x33a50b?_0x3650df[_0xa413('0x1d')]:_0x3503d3[_0xa413('0x1a')]+_0x3503d3['limit'];var _0x4fdcc3;if(_0x3a3408>=_0x509cf4){_0x3a3408=_0x509cf4;_0x4fdcc3=0xc8;}else{_0x4fdcc3=0xce;}_0x227f95[_0xa413('0x17')](_0x4fdcc3);return _0x227f95[_0xa413('0x1e')](_0xa413('0x1f'),_0x358a09+'-'+_0x3a3408+'/'+_0x509cf4)[_0xa413('0x19')](_0x3650df);}return null;};}function patchUpdates(_0x9642db){return function(_0x366ee5){try{jsonpatch['apply'](_0x366ee5,_0x9642db,!![]);}catch(_0x423645){return BPromise[_0xa413('0x20')](_0x423645);}return _0x366ee5['save']();};}function saveUpdates(_0x26783e,_0x15eef6){return function(_0x432aab){if(_0x432aab){return _0x432aab[_0xa413('0x21')](_0x26783e)[_0xa413('0x22')](function(_0x4c3531){return _0x4c3531;});}return null;};}function removeEntity(_0x2a91cd,_0x5b7847){return function(_0x35b0f2){if(_0x35b0f2){return _0x35b0f2[_0xa413('0x23')]()[_0xa413('0x22')](function(){_0x2a91cd[_0xa413('0x17')](0xcc)[_0xa413('0x18')]();});}};}function handleEntityNotFound(_0x3bc326,_0x1bc6d7){return function(_0x50a98a){if(!_0x50a98a){_0x3bc326[_0xa413('0x16')](0x194);}return _0x50a98a;};}function handleError(_0x2ad66b,_0x2794e9){_0x2794e9=_0x2794e9||0x1f4;return function(_0x57f035){logger[_0xa413('0x24')](_0x57f035[_0xa413('0x25')]);if(_0x57f035[_0xa413('0x26')]){delete _0x57f035[_0xa413('0x26')];}_0x2ad66b[_0xa413('0x17')](_0x2794e9)[_0xa413('0x27')](_0x57f035);};}exports[_0xa413('0x28')]=function(_0x360a1a,_0xd67c77){var _0x53de70={},_0x15b891={},_0x53596c={'count':0x0,'rows':[]};var _0x591162=_[_0xa413('0x29')](db[_0xa413('0x2a')][_0xa413('0x2b')],function(_0x10687a){return{'name':_0x10687a[_0xa413('0x2c')],'type':_0x10687a['type'][_0xa413('0x2d')]};});_0x15b891['model']=_[_0xa413('0x29')](_0x591162,_0xa413('0x26'));_0x15b891[_0xa413('0x2e')]=_[_0xa413('0x2f')](_0x360a1a[_0xa413('0x2e')]);_0x15b891[_0xa413('0x30')]=_['intersection'](_0x15b891[_0xa413('0x31')],_0x15b891[_0xa413('0x2e')]);_0x53de70[_0xa413('0x32')]=_[_0xa413('0x33')](_0x15b891[_0xa413('0x31')],qs[_0xa413('0x34')](_0x360a1a[_0xa413('0x2e')][_0xa413('0x34')]));_0x53de70['attributes']=_0x53de70[_0xa413('0x32')]['length']?_0x53de70[_0xa413('0x32')]:_0x15b891['model'];if(!_0x360a1a[_0xa413('0x2e')][_0xa413('0x35')](_0xa413('0x36'))){_0x53de70['limit']=qs[_0xa413('0x1c')](_0x360a1a[_0xa413('0x2e')][_0xa413('0x1c')]);_0x53de70[_0xa413('0x1a')]=qs['offset'](_0x360a1a['query'][_0xa413('0x1a')]);}_0x53de70['order']=qs['sort'](_0x360a1a['query'][_0xa413('0x37')]);_0x53de70[_0xa413('0x38')]=qs[_0xa413('0x30')](_[_0xa413('0x39')](_0x360a1a[_0xa413('0x2e')],_0x15b891[_0xa413('0x30')]),_0x591162);if(_0x360a1a['query'][_0xa413('0x3a')]){_0x53de70[_0xa413('0x38')]=_[_0xa413('0x3b')](_0x53de70[_0xa413('0x38')],{'$or':_[_0xa413('0x29')](_0x591162,function(_0x2b8b3b){if(_0x2b8b3b['type']!=='VIRTUAL'){var _0xbf25c5={};_0xbf25c5[_0x2b8b3b['name']]={'$like':'%'+_0x360a1a[_0xa413('0x2e')][_0xa413('0x3a')]+'%'};return _0xbf25c5;}})});}_0x53de70=_[_0xa413('0x3b')]({},_0x53de70,_0x360a1a[_0xa413('0x3c')]);var _0x2c8d99={'where':_0x53de70[_0xa413('0x38')]};return db[_0xa413('0x2a')][_0xa413('0x1d')](_0x2c8d99)['then'](function(_0x1900a7){_0x53596c[_0xa413('0x1d')]=_0x1900a7;if(_0x360a1a[_0xa413('0x2e')][_0xa413('0x3d')]){_0x53de70[_0xa413('0x3e')]=[{'all':!![]}];}return db[_0xa413('0x2a')]['findAll'](_0x53de70);})[_0xa413('0x22')](function(_0x2a11ec){_0x53596c[_0xa413('0x3f')]=_0x2a11ec;return _0x53596c;})[_0xa413('0x22')](respondWithFilteredResult(_0xd67c77,_0x53de70))[_0xa413('0x40')](handleError(_0xd67c77,null));};exports['show']=function(_0x4bb241,_0x4ae5b4){var _0x2242a3={'raw':!![],'where':{'id':_0x4bb241['params']['id']}},_0x5ecab5={};_0x5ecab5[_0xa413('0x31')]=_['keys'](db[_0xa413('0x2a')]['rawAttributes']);_0x5ecab5[_0xa413('0x2e')]=_['keys'](_0x4bb241[_0xa413('0x2e')]);_0x5ecab5[_0xa413('0x30')]=_[_0xa413('0x33')](_0x5ecab5[_0xa413('0x31')],_0x5ecab5[_0xa413('0x2e')]);_0x2242a3[_0xa413('0x32')]=_[_0xa413('0x33')](_0x5ecab5[_0xa413('0x31')],qs[_0xa413('0x34')](_0x4bb241[_0xa413('0x2e')][_0xa413('0x34')]));_0x2242a3[_0xa413('0x32')]=_0x2242a3[_0xa413('0x32')][_0xa413('0x41')]?_0x2242a3[_0xa413('0x32')]:_0x5ecab5['model'];if(_0x4bb241[_0xa413('0x2e')]['includeAll']){_0x2242a3[_0xa413('0x3e')]=[{'all':!![]}];}_0x2242a3=_[_0xa413('0x3b')]({},_0x2242a3,_0x4bb241[_0xa413('0x3c')]);return db[_0xa413('0x2a')][_0xa413('0x42')](_0x2242a3)[_0xa413('0x22')](handleEntityNotFound(_0x4ae5b4,null))['then'](respondWithResult(_0x4ae5b4,null))[_0xa413('0x40')](handleError(_0x4ae5b4,null));};exports[_0xa413('0x43')]=function(_0x30f20b,_0xa57a7b){return db[_0xa413('0x2a')]['create'](_0x30f20b['body'],{})['then'](respondWithResult(_0xa57a7b,0xc9))[_0xa413('0x40')](handleError(_0xa57a7b,null));};exports['update']=function(_0x2582f2,_0x349d8b){if(_0x2582f2[_0xa413('0x44')]['id']){delete _0x2582f2['body']['id'];}return db[_0xa413('0x2a')]['find']({'where':{'id':_0x2582f2[_0xa413('0x45')]['id']}})[_0xa413('0x22')](handleEntityNotFound(_0x349d8b,null))[_0xa413('0x22')](saveUpdates(_0x2582f2[_0xa413('0x44')],null))[_0xa413('0x22')](respondWithResult(_0x349d8b,null))['catch'](handleError(_0x349d8b,null));};exports['destroy']=function(_0x2a04c2,_0x1d85c3){return db['VoiceDialReport'][_0xa413('0x42')]({'where':{'id':_0x2a04c2['params']['id']}})[_0xa413('0x22')](handleEntityNotFound(_0x1d85c3,null))['then'](removeEntity(_0x1d85c3,null))[_0xa413('0x40')](handleError(_0x1d85c3,null));};exports[_0xa413('0x46')]=function(_0x20159e,_0xd45314){return db['VoiceDialReport'][_0xa413('0x46')]()[_0xa413('0x22')](respondWithResult(_0xd45314,null))[_0xa413('0x40')](handleError(_0xd45314,null));}; \ No newline at end of file +var _0x7c94=['findAll','rows','catch','show','includeAll','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x524965,_0x257b16){var _0xc310b0=function(_0x5db4ea){while(--_0x5db4ea){_0x524965['push'](_0x524965['shift']());}};_0xc310b0(++_0x257b16);}(_0x7c94,0x134));var _0x47c9=function(_0x44fb5f,_0x53f8ac){_0x44fb5f=_0x44fb5f-0x0;var _0x2a1150=_0x7c94[_0x44fb5f];return _0x2a1150;};'use strict';var emlformat=require(_0x47c9('0x0'));var rimraf=require(_0x47c9('0x1'));var zipdir=require(_0x47c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47c9('0x3'));var moment=require(_0x47c9('0x4'));var BPromise=require(_0x47c9('0x5'));var Mustache=require(_0x47c9('0x6'));var util=require(_0x47c9('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x47c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47c9('0x9'));var squel=require(_0x47c9('0xa'));var crypto=require(_0x47c9('0xb'));var jsforce=require(_0x47c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x47c9('0x8'));var querystring=require(_0x47c9('0xd'));var Papa=require('papaparse');var Redis=require(_0x47c9('0xe'));var authService=require(_0x47c9('0xf'));var qs=require(_0x47c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47c9('0x11'));var logger=require('../../config/logger')(_0x47c9('0x12'));var utils=require(_0x47c9('0x13'));var config=require(_0x47c9('0x14'));var licenseUtil=require(_0x47c9('0x15'));var db=require(_0x47c9('0x16'))['db'];function respondWithStatusCode(_0x37b27b,_0x1c7fcb){_0x1c7fcb=_0x1c7fcb||0xcc;return function(_0x171cc9){if(_0x171cc9){return _0x37b27b['sendStatus'](_0x1c7fcb);}return _0x37b27b[_0x47c9('0x17')](_0x1c7fcb)[_0x47c9('0x18')]();};}function respondWithResult(_0x118ac4,_0x5a5a8b){_0x5a5a8b=_0x5a5a8b||0xc8;return function(_0x5d9aea){if(_0x5d9aea){return _0x118ac4['status'](_0x5a5a8b)[_0x47c9('0x19')](_0x5d9aea);}};}function respondWithFilteredResult(_0x4f5b67,_0x51fa32){return function(_0x1c80f4){if(_0x1c80f4){var _0x7f1498=typeof _0x51fa32[_0x47c9('0x1a')]===_0x47c9('0x1b')&&typeof _0x51fa32['limit']===_0x47c9('0x1b');var _0xe31647=_0x1c80f4[_0x47c9('0x1c')];var _0x405f46=_0x7f1498?0x0:_0x51fa32['offset'];var _0x1216e0=_0x7f1498?_0x1c80f4[_0x47c9('0x1c')]:_0x51fa32[_0x47c9('0x1a')]+_0x51fa32[_0x47c9('0x1d')];var _0xf39a01;if(_0x1216e0>=_0xe31647){_0x1216e0=_0xe31647;_0xf39a01=0xc8;}else{_0xf39a01=0xce;}_0x4f5b67[_0x47c9('0x17')](_0xf39a01);return _0x4f5b67[_0x47c9('0x1e')](_0x47c9('0x1f'),_0x405f46+'-'+_0x1216e0+'/'+_0xe31647)[_0x47c9('0x19')](_0x1c80f4);}return null;};}function patchUpdates(_0x1b23cf){return function(_0x40c815){try{jsonpatch[_0x47c9('0x20')](_0x40c815,_0x1b23cf,!![]);}catch(_0x27ce3a){return BPromise['reject'](_0x27ce3a);}return _0x40c815[_0x47c9('0x21')]();};}function saveUpdates(_0x542b07,_0x4a0be9){return function(_0x467780){if(_0x467780){return _0x467780['update'](_0x542b07)[_0x47c9('0x22')](function(_0x3ffb91){return _0x3ffb91;});}return null;};}function removeEntity(_0x1258dd,_0x50cb93){return function(_0x4fc678){if(_0x4fc678){return _0x4fc678[_0x47c9('0x23')]()[_0x47c9('0x22')](function(){_0x1258dd[_0x47c9('0x17')](0xcc)[_0x47c9('0x18')]();});}};}function handleEntityNotFound(_0x5e3feb,_0x149537){return function(_0x14002b){if(!_0x14002b){_0x5e3feb[_0x47c9('0x24')](0x194);}return _0x14002b;};}function handleError(_0x250bdb,_0x3f6d85){_0x3f6d85=_0x3f6d85||0x1f4;return function(_0x3495cf){logger['error'](_0x3495cf[_0x47c9('0x25')]);if(_0x3495cf[_0x47c9('0x26')]){delete _0x3495cf['name'];}_0x250bdb[_0x47c9('0x17')](_0x3f6d85)[_0x47c9('0x27')](_0x3495cf);};}exports[_0x47c9('0x28')]=function(_0x4797d2,_0x4171d8){var _0x1f13c0={},_0x3a229f={},_0x58d721={'count':0x0,'rows':[]};var _0x112439=_[_0x47c9('0x29')](db[_0x47c9('0x2a')]['rawAttributes'],function(_0x4b9374){return{'name':_0x4b9374[_0x47c9('0x2b')],'type':_0x4b9374[_0x47c9('0x2c')][_0x47c9('0x2d')]};});_0x3a229f[_0x47c9('0x2e')]=_[_0x47c9('0x29')](_0x112439,_0x47c9('0x26'));_0x3a229f[_0x47c9('0x2f')]=_[_0x47c9('0x30')](_0x4797d2[_0x47c9('0x2f')]);_0x3a229f[_0x47c9('0x31')]=_['intersection'](_0x3a229f[_0x47c9('0x2e')],_0x3a229f[_0x47c9('0x2f')]);_0x1f13c0[_0x47c9('0x32')]=_[_0x47c9('0x33')](_0x3a229f[_0x47c9('0x2e')],qs[_0x47c9('0x34')](_0x4797d2[_0x47c9('0x2f')][_0x47c9('0x34')]));_0x1f13c0[_0x47c9('0x32')]=_0x1f13c0[_0x47c9('0x32')][_0x47c9('0x35')]?_0x1f13c0[_0x47c9('0x32')]:_0x3a229f[_0x47c9('0x2e')];if(!_0x4797d2['query']['hasOwnProperty'](_0x47c9('0x36'))){_0x1f13c0['limit']=qs[_0x47c9('0x1d')](_0x4797d2[_0x47c9('0x2f')][_0x47c9('0x1d')]);_0x1f13c0['offset']=qs[_0x47c9('0x1a')](_0x4797d2[_0x47c9('0x2f')][_0x47c9('0x1a')]);}_0x1f13c0['order']=qs[_0x47c9('0x37')](_0x4797d2[_0x47c9('0x2f')][_0x47c9('0x37')]);_0x1f13c0[_0x47c9('0x38')]=qs[_0x47c9('0x31')](_[_0x47c9('0x39')](_0x4797d2[_0x47c9('0x2f')],_0x3a229f[_0x47c9('0x31')]),_0x112439);if(_0x4797d2['query'][_0x47c9('0x3a')]){_0x1f13c0['where']=_[_0x47c9('0x3b')](_0x1f13c0[_0x47c9('0x38')],{'$or':_[_0x47c9('0x29')](_0x112439,function(_0x7a9d05){if(_0x7a9d05[_0x47c9('0x2c')]!==_0x47c9('0x3c')){var _0x343f3d={};_0x343f3d[_0x7a9d05[_0x47c9('0x26')]]={'$like':'%'+_0x4797d2[_0x47c9('0x2f')]['filter']+'%'};return _0x343f3d;}})});}_0x1f13c0=_[_0x47c9('0x3b')]({},_0x1f13c0,_0x4797d2[_0x47c9('0x3d')]);var _0x436509={'where':_0x1f13c0[_0x47c9('0x38')]};return db[_0x47c9('0x2a')]['count'](_0x436509)['then'](function(_0x54043d){_0x58d721['count']=_0x54043d;if(_0x4797d2[_0x47c9('0x2f')]['includeAll']){_0x1f13c0['include']=[{'all':!![]}];}return db[_0x47c9('0x2a')][_0x47c9('0x3e')](_0x1f13c0);})[_0x47c9('0x22')](function(_0x3f2e45){_0x58d721[_0x47c9('0x3f')]=_0x3f2e45;return _0x58d721;})[_0x47c9('0x22')](respondWithFilteredResult(_0x4171d8,_0x1f13c0))[_0x47c9('0x40')](handleError(_0x4171d8,null));};exports[_0x47c9('0x41')]=function(_0x22ab4c,_0x2d482d){var _0x78ca5c={'raw':!![],'where':{'id':_0x22ab4c['params']['id']}},_0x1562ff={};_0x1562ff['model']=_[_0x47c9('0x30')](db[_0x47c9('0x2a')]['rawAttributes']);_0x1562ff[_0x47c9('0x2f')]=_[_0x47c9('0x30')](_0x22ab4c[_0x47c9('0x2f')]);_0x1562ff[_0x47c9('0x31')]=_[_0x47c9('0x33')](_0x1562ff[_0x47c9('0x2e')],_0x1562ff[_0x47c9('0x2f')]);_0x78ca5c['attributes']=_[_0x47c9('0x33')](_0x1562ff[_0x47c9('0x2e')],qs[_0x47c9('0x34')](_0x22ab4c['query'][_0x47c9('0x34')]));_0x78ca5c['attributes']=_0x78ca5c[_0x47c9('0x32')][_0x47c9('0x35')]?_0x78ca5c[_0x47c9('0x32')]:_0x1562ff[_0x47c9('0x2e')];if(_0x22ab4c[_0x47c9('0x2f')][_0x47c9('0x42')]){_0x78ca5c[_0x47c9('0x43')]=[{'all':!![]}];}_0x78ca5c=_[_0x47c9('0x3b')]({},_0x78ca5c,_0x22ab4c['options']);return db[_0x47c9('0x2a')][_0x47c9('0x44')](_0x78ca5c)[_0x47c9('0x22')](handleEntityNotFound(_0x2d482d,null))[_0x47c9('0x22')](respondWithResult(_0x2d482d,null))[_0x47c9('0x40')](handleError(_0x2d482d,null));};exports[_0x47c9('0x45')]=function(_0x25ae6c,_0x53f7b3){return db[_0x47c9('0x2a')][_0x47c9('0x45')](_0x25ae6c[_0x47c9('0x46')],{})[_0x47c9('0x22')](respondWithResult(_0x53f7b3,0xc9))['catch'](handleError(_0x53f7b3,null));};exports[_0x47c9('0x47')]=function(_0xa80cee,_0x109591){if(_0xa80cee[_0x47c9('0x46')]['id']){delete _0xa80cee['body']['id'];}return db[_0x47c9('0x2a')]['find']({'where':{'id':_0xa80cee[_0x47c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x109591,null))['then'](saveUpdates(_0xa80cee['body'],null))[_0x47c9('0x22')](respondWithResult(_0x109591,null))[_0x47c9('0x40')](handleError(_0x109591,null));};exports[_0x47c9('0x23')]=function(_0x253807,_0x3f27f4){return db[_0x47c9('0x2a')]['find']({'where':{'id':_0x253807[_0x47c9('0x48')]['id']}})[_0x47c9('0x22')](handleEntityNotFound(_0x3f27f4,null))[_0x47c9('0x22')](removeEntity(_0x3f27f4,null))['catch'](handleError(_0x3f27f4,null));};exports[_0x47c9('0x49')]=function(_0x44a602,_0x414c04){return db[_0x47c9('0x2a')][_0x47c9('0x49')]()['then'](respondWithResult(_0x414c04,null))[_0x47c9('0x40')](handleError(_0x414c04,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9264b81..e2556b7 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 _0x16ea=['exports','define','report_dial','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x4e7e2d,_0x15ab03){var _0x134856=function(_0xfb1197){while(--_0xfb1197){_0x4e7e2d['push'](_0x4e7e2d['shift']());}};_0x134856(++_0x15ab03);}(_0x16ea,0x78));var _0xa16e=function(_0x302914,_0xea16d0){_0x302914=_0x302914-0x0;var _0x59ebf9=_0x16ea[_0x302914];return _0x59ebf9;};'use strict';var _=require('lodash');var util=require(_0xa16e('0x0'));var logger=require(_0xa16e('0x1'))(_0xa16e('0x2'));var moment=require(_0xa16e('0x3'));var BPromise=require(_0xa16e('0x4'));var rp=require(_0xa16e('0x5'));var fs=require('fs');var path=require(_0xa16e('0x6'));var rimraf=require(_0xa16e('0x7'));var config=require(_0xa16e('0x8'));var attributes=require(_0xa16e('0x9'));module[_0xa16e('0xa')]=function(_0xe84d74,_0x3db5d8){return _0xe84d74[_0xa16e('0xb')]('VoiceDialReport',attributes,{'tableName':_0xa16e('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x40df=['request-promise','rimraf','../../config/environment','exports','define','report_dial','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x23c6dc,_0x11e6da){var _0x4101c4=function(_0x3d3f02){while(--_0x3d3f02){_0x23c6dc['push'](_0x23c6dc['shift']());}};_0x4101c4(++_0x11e6da);}(_0x40df,0xaf));var _0xf40d=function(_0x2d01a2,_0x45c16d){_0x2d01a2=_0x2d01a2-0x0;var _0x3ca413=_0x40df[_0x2d01a2];return _0x3ca413;};'use strict';var _=require(_0xf40d('0x0'));var util=require(_0xf40d('0x1'));var logger=require('../../config/logger')(_0xf40d('0x2'));var moment=require(_0xf40d('0x3'));var BPromise=require(_0xf40d('0x4'));var rp=require(_0xf40d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf40d('0x6'));var config=require(_0xf40d('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xf40d('0x8')]=function(_0x416b46,_0x17b800){return _0x416b46[_0xf40d('0x9')]('VoiceDialReport',attributes,{'tableName':_0xf40d('0xa'),'paranoid':![],'indexes':[{'fields':[_0xf40d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0716d07..b16f690 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 _0x2549=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','update','body','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21b90b,_0x2e9e48){var _0x545063=function(_0x2e2281){while(--_0x2e2281){_0x21b90b['push'](_0x21b90b['shift']());}};_0x545063(++_0x2e9e48);}(_0x2549,0x1aa));var _0x9254=function(_0x482d86,_0x4ed535){_0x482d86=_0x482d86-0x0;var _0x221d1b=_0x2549[_0x482d86];return _0x221d1b;};'use strict';var _=require(_0x9254('0x0'));var util=require(_0x9254('0x1'));var moment=require(_0x9254('0x2'));var BPromise=require('bluebird');var rs=require(_0x9254('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9254('0x4'));var logger=require(_0x9254('0x5'))(_0x9254('0x6'));var config=require(_0x9254('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9254('0x8')][_0x9254('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29bc55,_0x2d21e0,_0x5cad7a){return new BPromise(function(_0x204420,_0xc06b55){return client[_0x9254('0xa')](_0x29bc55,_0x5cad7a)[_0x9254('0xb')](function(_0x518479){logger[_0x9254('0xc')](_0x9254('0xd'),_0x2d21e0,_0x9254('0xe'));logger[_0x9254('0xf')](_0x9254('0x10'),_0x2d21e0,'request\x20sent',JSON[_0x9254('0x11')](_0x518479));if(_0x518479[_0x9254('0x12')]){if(_0x518479['error'][_0x9254('0x13')]===0x1f4){logger['error'](_0x9254('0xd'),_0x2d21e0,_0x518479[_0x9254('0x12')][_0x9254('0x14')]);return _0xc06b55(_0x518479[_0x9254('0x12')][_0x9254('0x14')]);}logger['error'](_0x9254('0xd'),_0x2d21e0,_0x518479[_0x9254('0x12')][_0x9254('0x14')]);return _0x204420(_0x518479[_0x9254('0x12')][_0x9254('0x14')]);}else{logger[_0x9254('0xc')](_0x9254('0xd'),_0x2d21e0,_0x9254('0xe'));_0x204420(_0x518479[_0x9254('0x15')]['message']);}})[_0x9254('0x16')](function(_0xcf49ed){logger[_0x9254('0x12')](_0x9254('0xd'),_0x2d21e0,_0xcf49ed);_0xc06b55(_0xcf49ed);});});}exports[_0x9254('0x17')]=function(_0x5e258f){var _0x2b7cfb=this;return new Promise(function(_0x2adc5f,_0x5039ff){return db[_0x9254('0x18')][_0x9254('0x19')](_0x5e258f['body'],{'raw':_0x5e258f['options']?_0x5e258f[_0x9254('0x1a')][_0x9254('0x1b')]===undefined?!![]:![]:!![]})[_0x9254('0xb')](function(_0x3b60d9){logger[_0x9254('0xc')](_0x9254('0x17'),_0x5e258f);logger[_0x9254('0xf')](_0x9254('0x17'),_0x5e258f,JSON[_0x9254('0x11')](_0x3b60d9));_0x2adc5f(_0x3b60d9);})[_0x9254('0x16')](function(_0x2c9fe0){logger['error']('CreateVoiceDialReport',_0x2c9fe0['message'],_0x5e258f);_0x5039ff(_0x2b7cfb[_0x9254('0x12')](0x1f4,_0x2c9fe0['message']));});});};exports['UpdateVoiceDialReport']=function(_0x1e0e20){var _0x30ade8=this;return new Promise(function(_0x54f975,_0x3dc110){return db[_0x9254('0x18')][_0x9254('0x1c')](_0x1e0e20[_0x9254('0x1d')],{'raw':_0x1e0e20[_0x9254('0x1a')]?_0x1e0e20[_0x9254('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0e20[_0x9254('0x1a')]?_0x1e0e20[_0x9254('0x1a')][_0x9254('0x1e')]||null:null,'attributes':_0x1e0e20[_0x9254('0x1a')]?_0x1e0e20['options'][_0x9254('0x1f')]||null:null,'limit':_0x1e0e20[_0x9254('0x1a')]?_0x1e0e20[_0x9254('0x1a')][_0x9254('0x20')]||null:null})['then'](function(_0x3859d2){logger[_0x9254('0xc')]('UpdateVoiceDialReport',_0x1e0e20);logger[_0x9254('0xf')]('UpdateVoiceDialReport',_0x1e0e20,JSON[_0x9254('0x11')](_0x3859d2));_0x54f975(_0x3859d2);})['catch'](function(_0x5d5f58){logger[_0x9254('0x12')](_0x9254('0x21'),_0x5d5f58[_0x9254('0x14')],_0x1e0e20);_0x3dc110(_0x30ade8[_0x9254('0x12')](0x1f4,_0x5d5f58['message']));});});}; \ No newline at end of file +var _0x1971=['then','lodash','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','debug','catch','UpdateVoiceDialReport','update','where','attributes','limit'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x1971,0x121));var _0x1197=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x1971[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x1197('0x0'));var util=require(_0x1197('0x1'));var moment=require(_0x1197('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1197('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1197('0x4'))(_0x1197('0x5'));var config=require('../../config/environment');var jayson=require(_0x1197('0x6'));var client=jayson['client'][_0x1197('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a33c3,_0x4fa02b,_0x42d7f3){return new BPromise(function(_0x2818f4,_0x478499){return client[_0x1197('0x8')](_0x3a33c3,_0x42d7f3)['then'](function(_0x48dc38){logger[_0x1197('0x9')](_0x1197('0xa'),_0x4fa02b,_0x1197('0xb'));logger['debug'](_0x1197('0xc'),_0x4fa02b,_0x1197('0xb'),JSON[_0x1197('0xd')](_0x48dc38));if(_0x48dc38['error']){if(_0x48dc38[_0x1197('0xe')][_0x1197('0xf')]===0x1f4){logger[_0x1197('0xe')](_0x1197('0xa'),_0x4fa02b,_0x48dc38[_0x1197('0xe')]['message']);return _0x478499(_0x48dc38[_0x1197('0xe')][_0x1197('0x10')]);}logger['error'](_0x1197('0xa'),_0x4fa02b,_0x48dc38[_0x1197('0xe')][_0x1197('0x10')]);return _0x2818f4(_0x48dc38[_0x1197('0xe')][_0x1197('0x10')]);}else{logger['info'](_0x1197('0xa'),_0x4fa02b,'request\x20sent');_0x2818f4(_0x48dc38[_0x1197('0x11')]['message']);}})['catch'](function(_0x1c0d38){logger[_0x1197('0xe')](_0x1197('0xa'),_0x4fa02b,_0x1c0d38);_0x478499(_0x1c0d38);});});}exports['CreateVoiceDialReport']=function(_0x3ff1f6){var _0x479749=this;return new Promise(function(_0x2b89bd,_0x2cd3e){return db[_0x1197('0x12')][_0x1197('0x13')](_0x3ff1f6[_0x1197('0x14')],{'raw':_0x3ff1f6[_0x1197('0x15')]?_0x3ff1f6['options'][_0x1197('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5405bb){logger[_0x1197('0x9')](_0x1197('0x17'),_0x3ff1f6);logger[_0x1197('0x18')](_0x1197('0x17'),_0x3ff1f6,JSON[_0x1197('0xd')](_0x5405bb));_0x2b89bd(_0x5405bb);})[_0x1197('0x19')](function(_0x11c27c){logger[_0x1197('0xe')]('CreateVoiceDialReport',_0x11c27c['message'],_0x3ff1f6);_0x2cd3e(_0x479749[_0x1197('0xe')](0x1f4,_0x11c27c[_0x1197('0x10')]));});});};exports[_0x1197('0x1a')]=function(_0x202d23){var _0x17f05d=this;return new Promise(function(_0x53c209,_0x5cbdb7){return db[_0x1197('0x12')][_0x1197('0x1b')](_0x202d23[_0x1197('0x14')],{'raw':_0x202d23['options']?_0x202d23[_0x1197('0x15')][_0x1197('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x202d23[_0x1197('0x15')]?_0x202d23[_0x1197('0x15')][_0x1197('0x1c')]||null:null,'attributes':_0x202d23[_0x1197('0x15')]?_0x202d23[_0x1197('0x15')][_0x1197('0x1d')]||null:null,'limit':_0x202d23[_0x1197('0x15')]?_0x202d23['options'][_0x1197('0x1e')]||null:null})[_0x1197('0x1f')](function(_0x2f2dfb){logger['info'](_0x1197('0x1a'),_0x202d23);logger[_0x1197('0x18')](_0x1197('0x1a'),_0x202d23,JSON[_0x1197('0xd')](_0x2f2dfb));_0x53c209(_0x2f2dfb);})[_0x1197('0x19')](function(_0x42423d){logger['error'](_0x1197('0x1a'),_0x42423d[_0x1197('0x10')],_0x202d23);_0x5cbdb7(_0x17f05d[_0x1197('0xe')](0x1f4,_0x42423d[_0x1197('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ec99f59..92b34a4 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 _0xb9fe=['isAuthenticated','index','get','/:id','show','post','addApplications','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller'];(function(_0x175374,_0x3c2440){var _0x4e1f61=function(_0x23e306){while(--_0x23e306){_0x175374['push'](_0x175374['shift']());}};_0x4e1f61(++_0x3c2440);}(_0xb9fe,0xfb));var _0xeb9f=function(_0x4a085f,_0x458623){_0x4a085f=_0x4a085f-0x0;var _0x530332=_0xb9fe[_0x4a085f];return _0x530332;};'use strict';var multer=require(_0xeb9f('0x0'));var util=require('util');var path=require(_0xeb9f('0x1'));var timeout=require(_0xeb9f('0x2'));var express=require(_0xeb9f('0x3'));var router=express[_0xeb9f('0x4')]();var fs_extra=require(_0xeb9f('0x5'));var auth=require(_0xeb9f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb9f('0x7'));var controller=require(_0xeb9f('0x8'));router['get']('/',auth[_0xeb9f('0x9')](),controller[_0xeb9f('0xa')]);router[_0xeb9f('0xb')](_0xeb9f('0xc'),auth[_0xeb9f('0x9')](),controller[_0xeb9f('0xd')]);router[_0xeb9f('0xe')]('/',auth[_0xeb9f('0x9')](),controller['create']);router[_0xeb9f('0xe')]('/:id/applications',auth[_0xeb9f('0x9')](),controller[_0xeb9f('0xf')]);router[_0xeb9f('0x10')](_0xeb9f('0xc'),auth[_0xeb9f('0x9')](),controller[_0xeb9f('0x11')]);router['delete']('/:id',auth[_0xeb9f('0x9')](),controller[_0xeb9f('0x12')]);module[_0xeb9f('0x13')]=router; \ No newline at end of file +var _0x5a3f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','/:id/applications','addApplications','put','exports','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a3f,0x9b));var _0xf5a3=function(_0x57b671,_0x5bd095){_0x57b671=_0x57b671-0x0;var _0x26811c=_0x5a3f[_0x57b671];return _0x26811c;};'use strict';var multer=require(_0xf5a3('0x0'));var util=require(_0xf5a3('0x1'));var path=require(_0xf5a3('0x2'));var timeout=require(_0xf5a3('0x3'));var express=require(_0xf5a3('0x4'));var router=express[_0xf5a3('0x5')]();var fs_extra=require(_0xf5a3('0x6'));var auth=require(_0xf5a3('0x7'));var interaction=require(_0xf5a3('0x8'));var config=require(_0xf5a3('0x9'));var controller=require(_0xf5a3('0xa'));router[_0xf5a3('0xb')]('/',auth[_0xf5a3('0xc')](),controller['index']);router[_0xf5a3('0xb')](_0xf5a3('0xd'),auth[_0xf5a3('0xc')](),controller[_0xf5a3('0xe')]);router[_0xf5a3('0xf')]('/',auth[_0xf5a3('0xc')](),controller['create']);router['post'](_0xf5a3('0x10'),auth['isAuthenticated'](),controller[_0xf5a3('0x11')]);router[_0xf5a3('0x12')](_0xf5a3('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf5a3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5a3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 8d477cc..1d0963f 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 _0x33b5=['NoOp','ENUM','inbound-fax','outbound-fax','any','BOOLEAN','INTEGER','wav','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x26b49f,_0x455422){var _0x3cbd41=function(_0x3be357){while(--_0x3be357){_0x26b49f['push'](_0x26b49f['shift']());}};_0x3cbd41(++_0x455422);}(_0x33b5,0xbf));var _0x533b=function(_0x3fe2c2,_0x233fe4){_0x3fe2c2=_0x3fe2c2-0x0;var _0x3e7be7=_0x33b5[_0x3fe2c2];return _0x3e7be7;};'use strict';var Sequelize=require(_0x533b('0x0'));module[_0x533b('0x1')]={'context':{'type':Sequelize[_0x533b('0x2')],'allowNull':![],'unique':_0x533b('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x533b('0x2')],'allowNull':![],'unique':_0x533b('0x3')},'priority':{'type':Sequelize[_0x533b('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x533b('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x533b('0x2')],'allowNull':![],'defaultValue':_0x533b('0x4')},'appdata':{'type':Sequelize[_0x533b('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x533b('0x5')]('inbound','outbound','internal',_0x533b('0x6'),_0x533b('0x7'),'system',_0x533b('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x533b('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x533b('0x9')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x533b('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x533b('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x533b('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x533b('0xa')]},'recordingFormat':{'type':Sequelize[_0x533b('0x2')],'defaultValue':_0x533b('0xb')},'answer':{'type':Sequelize[_0x533b('0x9')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4af96a){return this['getDataValue'](_0x533b('0xc'));}},'alias':{'type':Sequelize[_0x533b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7165=['internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7165,0x14f));var _0x5716=function(_0x4899d9,_0x289583){_0x4899d9=_0x4899d9-0x0;var _0x5b742d=_0x7165[_0x4899d9];return _0x5b742d;};'use strict';var Sequelize=require(_0x5716('0x0'));module['exports']={'context':{'type':Sequelize[_0x5716('0x1')],'allowNull':![],'unique':_0x5716('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5716('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x5716('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5716('0x1')],'allowNull':![],'defaultValue':_0x5716('0x3')},'appdata':{'type':Sequelize[_0x5716('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5716('0x4')](_0x5716('0x5'),_0x5716('0x6'),_0x5716('0x7'),_0x5716('0x8'),_0x5716('0x9'),_0x5716('0xa'),_0x5716('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x5716('0x1')]},'interval':{'type':Sequelize[_0x5716('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x5716('0xc')]},'isApp':{'type':Sequelize[_0x5716('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5716('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x5716('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x5716('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5716('0xc')]},'recordingFormat':{'type':Sequelize[_0x5716('0x1')],'defaultValue':_0x5716('0xe')},'answer':{'type':Sequelize[_0x5716('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5716('0xf')],'get':function(_0xe6d992){return this[_0x5716('0x10')](_0x5716('0x11'));}},'alias':{'type':Sequelize[_0x5716('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 99c40fb..d2b0900 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 _0x5087=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','body','startsWith','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','lodash','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','end','error','stack','send','index','VoiceExtension','rawAttributes','key','model','query'];(function(_0x3e89a6,_0x3c86c1){var _0x20ec82=function(_0x7e8ae7){while(--_0x7e8ae7){_0x3e89a6['push'](_0x3e89a6['shift']());}};_0x20ec82(++_0x3c86c1);}(_0x5087,0x148));var _0x7508=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x5087[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x7508('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7508('0x1'))(_0x7508('0x2'));var config=require(_0x7508('0x3'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7508('0x4')](config['redis'],{'host':_0x7508('0x5'),'port':0x18eb});var socket=require(_0x7508('0x6'))(new Redis(config[_0x7508('0x7')]));require(_0x7508('0x8'))[_0x7508('0x9')](socket);function respondWithStatusCode(_0x20e165,_0x10e66f){_0x10e66f=_0x10e66f||0xcc;return function(_0x1cb350){if(_0x1cb350){return _0x20e165[_0x7508('0xa')](_0x10e66f);}return _0x20e165[_0x7508('0xb')](_0x10e66f)['end']();};}function respondWithResult(_0x3d755e,_0x3df372){_0x3df372=_0x3df372||0xc8;return function(_0x2b82df){if(_0x2b82df){return _0x3d755e['status'](_0x3df372)[_0x7508('0xc')](_0x2b82df);}};}function respondWithFilteredResult(_0x4537d3,_0x4ae93c){return function(_0x57efb0){if(_0x57efb0){var _0x4793d2=typeof _0x4ae93c['offset']===_0x7508('0xd')&&typeof _0x4ae93c[_0x7508('0xe')]==='undefined';var _0x442f38=_0x57efb0['count'];var _0x147aa0=_0x4793d2?0x0:_0x4ae93c[_0x7508('0xf')];var _0x28d965=_0x4793d2?_0x57efb0[_0x7508('0x10')]:_0x4ae93c[_0x7508('0xf')]+_0x4ae93c[_0x7508('0xe')];var _0x440bec;if(_0x28d965>=_0x442f38){_0x28d965=_0x442f38;_0x440bec=0xc8;}else{_0x440bec=0xce;}_0x4537d3[_0x7508('0xb')](_0x440bec);return _0x4537d3[_0x7508('0x11')](_0x7508('0x12'),_0x147aa0+'-'+_0x28d965+'/'+_0x442f38)[_0x7508('0xc')](_0x57efb0);}return null;};}function removeEntity(_0x109ac5){return function(_0x382440){if(_0x382440){return _0x382440[_0x7508('0x13')]()[_0x7508('0x14')](function(){var _0x1387b0=_0x382440['get']({'plain':!![]});var _0x2d5669=[{'name':_0x7508('0x15'),'value':_0x7508('0x16'),'ignore':![]},{'name':_0x7508('0x17'),'value':_0x7508('0x18'),'ignore':![]},{'name':_0x7508('0x19'),'value':_0x7508('0x1a'),'ignore':![]}];var _0x283384=_(_0x2d5669)[_0x7508('0x1b')](_0x7508('0x1c'))[_0x7508('0x1d')](_0x7508('0x1e'))[_0x7508('0x1e')]();if(_['includes'](_0x283384,_0x1387b0[_0x7508('0x1f')])){return;}var _0x325586=_[_0x7508('0x20')](_0x2d5669,[_0x7508('0x1e'),_0x1387b0['type']])[_0x7508('0x21')];return db['UserProfileResource']['destroy']({'where':{'type':_0x325586,'resourceId':_0x1387b0['id']}})[_0x7508('0x14')](function(){return _0x382440;});})[_0x7508('0x14')](function(){_0x109ac5[_0x7508('0xb')](0xcc)[_0x7508('0x22')]();});}};}function handleEntityNotFound(_0x337d12){return function(_0xb13828){if(!_0xb13828){_0x337d12[_0x7508('0xa')](0x194);}return _0xb13828;};}function handleError(_0x36a0ec,_0x3a6ba8){_0x3a6ba8=_0x3a6ba8||0x1f4;return function(_0x56cc85){logger[_0x7508('0x23')](_0x56cc85[_0x7508('0x24')]);if(_0x56cc85[_0x7508('0x21')]){delete _0x56cc85[_0x7508('0x21')];}_0x36a0ec['status'](_0x3a6ba8)[_0x7508('0x25')](_0x56cc85);};}exports[_0x7508('0x26')]=function(_0x8263ec,_0x27dcd0){var _0x11791e={},_0x57e839={},_0x1c7f28={'count':0x0,'rows':[]};var _0x52cdcb=_[_0x7508('0x1d')](db[_0x7508('0x27')][_0x7508('0x28')],function(_0x89915b){return{'name':_0x89915b['fieldName'],'type':_0x89915b[_0x7508('0x1f')][_0x7508('0x29')]};});_0x57e839[_0x7508('0x2a')]=_[_0x7508('0x1d')](_0x52cdcb,_0x7508('0x21'));_0x57e839[_0x7508('0x2b')]=_[_0x7508('0x2c')](_0x8263ec['query']);_0x57e839[_0x7508('0x2d')]=_['intersection'](_0x57e839[_0x7508('0x2a')],_0x57e839[_0x7508('0x2b')]);_0x11791e[_0x7508('0x2e')]=_[_0x7508('0x2f')](_0x57e839[_0x7508('0x2a')],qs[_0x7508('0x30')](_0x8263ec[_0x7508('0x2b')]['fields']));_0x11791e['attributes']=_0x11791e[_0x7508('0x2e')][_0x7508('0x31')]?_0x11791e[_0x7508('0x2e')]:_0x57e839[_0x7508('0x2a')];if(!_0x8263ec[_0x7508('0x2b')][_0x7508('0x32')]('nolimit')){_0x11791e[_0x7508('0xe')]=qs[_0x7508('0xe')](_0x8263ec[_0x7508('0x2b')][_0x7508('0xe')]);_0x11791e[_0x7508('0xf')]=qs[_0x7508('0xf')](_0x8263ec[_0x7508('0x2b')][_0x7508('0xf')]);}_0x11791e[_0x7508('0x33')]=qs[_0x7508('0x34')](_0x8263ec[_0x7508('0x2b')][_0x7508('0x34')]);_0x11791e['where']=qs[_0x7508('0x2d')](_[_0x7508('0x35')](_0x8263ec[_0x7508('0x2b')],_0x57e839[_0x7508('0x2d')]),_0x52cdcb);if(_0x8263ec[_0x7508('0x2b')][_0x7508('0x1b')]){_0x11791e[_0x7508('0x36')]=_[_0x7508('0x37')](_0x11791e[_0x7508('0x36')],{'$or':_['map'](_0x52cdcb,function(_0xb0d92b){if(_0xb0d92b['type']!==_0x7508('0x38')){var _0x1e38bf={};_0x1e38bf[_0xb0d92b['name']]={'$like':'%'+_0x8263ec[_0x7508('0x2b')][_0x7508('0x1b')]+'%'};return _0x1e38bf;}})});}_0x11791e=_['merge']({},_0x11791e,_0x8263ec[_0x7508('0x39')]);var _0x39027f={'where':_0x11791e[_0x7508('0x36')]};return db['VoiceExtension']['count'](_0x39027f)[_0x7508('0x14')](function(_0x95843b){_0x1c7f28[_0x7508('0x10')]=_0x95843b;if(_0x8263ec[_0x7508('0x2b')][_0x7508('0x3a')]){_0x11791e[_0x7508('0x3b')]=[{'all':!![]}];}return db[_0x7508('0x27')]['findAll'](_0x11791e);})['then'](function(_0x227eef){_0x1c7f28['rows']=_0x227eef;return _0x1c7f28;})['then'](respondWithFilteredResult(_0x27dcd0,_0x11791e))[_0x7508('0x3c')](handleError(_0x27dcd0,null));};exports[_0x7508('0x3d')]=function(_0x43da53,_0x11a2ec){var _0x1ba642={'raw':![],'where':{'id':_0x43da53[_0x7508('0x3e')]['id']}},_0x206df1={};_0x206df1[_0x7508('0x2a')]=_['keys'](db[_0x7508('0x27')]['rawAttributes']);_0x206df1[_0x7508('0x2b')]=_['keys'](_0x43da53[_0x7508('0x2b')]);_0x206df1[_0x7508('0x2d')]=_[_0x7508('0x2f')](_0x206df1[_0x7508('0x2a')],_0x206df1[_0x7508('0x2b')]);_0x1ba642[_0x7508('0x2e')]=_[_0x7508('0x2f')](_0x206df1['model'],qs['fields'](_0x43da53[_0x7508('0x2b')]['fields']));_0x1ba642['attributes']=_0x1ba642[_0x7508('0x2e')][_0x7508('0x31')]?_0x1ba642[_0x7508('0x2e')]:_0x206df1[_0x7508('0x2a')];if(_0x43da53[_0x7508('0x2b')]['includeAll']){_0x1ba642[_0x7508('0x3b')]=[{'all':!![]}];}_0x1ba642=_[_0x7508('0x37')]({},_0x1ba642,_0x43da53[_0x7508('0x39')]);return db[_0x7508('0x27')][_0x7508('0x20')](_0x1ba642)[_0x7508('0x14')](handleEntityNotFound(_0x11a2ec,null))[_0x7508('0x14')](respondWithResult(_0x11a2ec,null))[_0x7508('0x3c')](handleError(_0x11a2ec,null));};exports[_0x7508('0x13')]=function(_0xd4c284,_0xd11865){return db['VoiceExtension'][_0x7508('0x20')]({'where':{'id':_0xd4c284[_0x7508('0x3e')]['id']}})[_0x7508('0x14')](handleEntityNotFound(_0xd11865,null))[_0x7508('0x14')](removeEntity(_0xd11865,null))[_0x7508('0x3c')](handleError(_0xd11865,null));};exports['create']=function(_0x41863f,_0x2f8fcc){if(_0x41863f[_0x7508('0x3f')][_0x7508('0x1f')]==='outbound'&&!_[_0x7508('0x40')](_0x41863f[_0x7508('0x3f')]['exten'],'_')){_0x41863f[_0x7508('0x3f')][_0x7508('0x41')]='_'[_0x7508('0x42')](_0x41863f['body'][_0x7508('0x41')]);}return db[_0x7508('0x27')][_0x7508('0x43')](_0x41863f[_0x7508('0x3f')],{'raw':![]})[_0x7508('0x14')](function(_0x14c3a8){var _0xc20a24=_0x41863f[_0x7508('0x44')][_0x7508('0x45')]({'plain':!![]});if(!_0xc20a24)throw new Error(_0x7508('0x46'));if(_0xc20a24['role']===_0x7508('0x44')){var _0x214735=_0x14c3a8[_0x7508('0x45')]({'plain':!![]});var _0x37209d=[{'name':_0x7508('0x15'),'value':_0x7508('0x16')},{'name':_0x7508('0x17'),'value':_0x7508('0x18')},{'name':_0x7508('0x19'),'value':_0x7508('0x1a')}];var _0x117ecb=_[_0x7508('0x20')](_0x37209d,[_0x7508('0x1e'),_0x214735['type']])['name'];return db[_0x7508('0x47')][_0x7508('0x20')]({'where':{'name':_0x117ecb,'userProfileId':_0xc20a24[_0x7508('0x48')]},'raw':!![]})[_0x7508('0x14')](function(_0x3ae3fb){if(_0x3ae3fb&&_0x3ae3fb[_0x7508('0x49')]===0x0){return db[_0x7508('0x4a')][_0x7508('0x43')]({'name':_0x214735[_0x7508('0x21')],'resourceId':_0x214735['id'],'type':_0x3ae3fb[_0x7508('0x21')],'sectionId':_0x3ae3fb['id']},{})[_0x7508('0x14')](function(){return _0x14c3a8;});}else{return _0x14c3a8;}})['catch'](function(_0x45eacc){logger[_0x7508('0x23')](_0x7508('0x4b'),_0x45eacc);throw _0x45eacc;});}return _0x14c3a8;})[_0x7508('0x14')](respondWithResult(_0x2f8fcc,0xc9))[_0x7508('0x3c')](handleError(_0x2f8fcc,null));};exports[_0x7508('0x4c')]=function(_0x46d1ba,_0x3be609){if(_0x46d1ba[_0x7508('0x3f')]['id']){delete _0x46d1ba['body']['id'];}return db[_0x7508('0x27')]['find']({'where':{'id':_0x46d1ba[_0x7508('0x3e')]['id']}})[_0x7508('0x14')](handleEntityNotFound(_0x3be609,null))['then'](function(_0xc79a05){if(_0xc79a05){return db[_0x7508('0x27')]['update'](_[_0x7508('0x35')](_0x46d1ba[_0x7508('0x3f')],['exten','context',_0x7508('0x4d'),_0x7508('0x4e'),'cutdigits',_0x7508('0x4f'),_0x7508('0x50')]),{'where':{'context':_0xc79a05[_0x7508('0x51')],'exten':_0xc79a05[_0x7508('0x41')]},'individualHooks':!![]})[_0x7508('0x14')](function(_0x2ae514){return _0x2ae514;});}return null;})[_0x7508('0x14')](respondWithStatusCode(_0x3be609,null))[_0x7508('0x3c')](handleError(_0x3be609,null));};exports[_0x7508('0x52')]=function(_0x26a4b4,_0x4cd178){var _0xc73ccf=_0x26a4b4[_0x7508('0x3e')]['id'];var _0x549afb=_0x26a4b4['body'];var _0xca6402=0xc8;var _0x1a3883=null;return db[_0x7508('0x53')][_0x7508('0x54')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x7508('0x55')]},function(_0x80890b){return db[_0x7508('0x27')][_0x7508('0x56')]({'where':{'id':_0xc73ccf},'transaction':_0x80890b})[_0x7508('0x14')](function(_0x269404){if(_0x269404){return db[_0x7508('0x27')][_0x7508('0x13')]({'where':{'VoiceExtensionId':_0xc73ccf},'transaction':_0x80890b})[_0x7508('0x14')](function(){var _0x219436=_[_0x7508('0x1d')](_0x549afb,function(_0x1c9aac){_0x1c9aac[_0x7508('0x57')]=_0xc73ccf;_0x1c9aac[_0x7508('0x58')]=!![];return _0x1c9aac;});return _0x269404[_0x7508('0x59')](_0x219436);})[_0x7508('0x14')](function(_0x222d89){return db['VoiceExtension'][_0x7508('0x5a')](_0x222d89,{'transaction':_0x80890b});});}else{_0xca6402=0x194;_0x1a3883=[];}});})['then'](function(){if(_0xca6402!==0x194){return db[_0x7508('0x27')][_0x7508('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xc73ccf},'order':'cast(priority\x20as\x20unsigned)'})[_0x7508('0x14')](function(_0x69ff08){_0x1a3883=_0x69ff08;});}})[_0x7508('0x3c')](function(_0x2b4411){_0xca6402=0x1f4;logger[_0x7508('0x23')](_0x2b4411['stack']);if(_0x2b4411[_0x7508('0x21')]){delete _0x2b4411[_0x7508('0x21')];}_0x1a3883=_0x2b4411;})[_0x7508('0x5c')](function(){if(_0x1a3883===null){_0x4cd178[_0x7508('0xa')](_0xca6402);}else{if(_0xca6402===0x1f4){_0x4cd178[_0x7508('0xb')](_0xca6402)[_0x7508('0x25')](_0x1a3883);}else{_0x4cd178[_0x7508('0xb')](_0xca6402)['json'](_0x1a3883);}}});}; \ No newline at end of file +var _0xfad8=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','destroy','get','inbound','outbound','InternalRoutes','filter','ignore','value','type','find','name','UserProfileResource','then','end','error','stack','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','sort','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','keys','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','context','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','send','json','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment'];(function(_0x234095,_0x515f55){var _0x4799f6=function(_0x1dd2d7){while(--_0x1dd2d7){_0x234095['push'](_0x234095['shift']());}};_0x4799f6(++_0x515f55);}(_0xfad8,0x101));var _0x8fad=function(_0x18ae4b,_0x3fccea){_0x18ae4b=_0x18ae4b-0x0;var _0x409b8b=_0xfad8[_0x18ae4b];return _0x409b8b;};'use strict';var _=require('lodash');var Redis=require(_0x8fad('0x0'));var qs=require(_0x8fad('0x1'));var logger=require(_0x8fad('0x2'))('api');var config=require(_0x8fad('0x3'));var db=require(_0x8fad('0x4'))['db'];config[_0x8fad('0x5')]=_[_0x8fad('0x6')](config[_0x8fad('0x5')],{'host':_0x8fad('0x7'),'port':0x18eb});var socket=require(_0x8fad('0x8'))(new Redis(config[_0x8fad('0x5')]));require(_0x8fad('0x9'))[_0x8fad('0xa')](socket);function respondWithStatusCode(_0x242114,_0x149db8){_0x149db8=_0x149db8||0xcc;return function(_0x6d5b9e){if(_0x6d5b9e){return _0x242114[_0x8fad('0xb')](_0x149db8);}return _0x242114[_0x8fad('0xc')](_0x149db8)['end']();};}function respondWithResult(_0x3c90df,_0x200f0e){_0x200f0e=_0x200f0e||0xc8;return function(_0x4016bd){if(_0x4016bd){return _0x3c90df[_0x8fad('0xc')](_0x200f0e)['json'](_0x4016bd);}};}function respondWithFilteredResult(_0x18538d,_0x2a0b59){return function(_0x4e6f64){if(_0x4e6f64){var _0x5d42ce=typeof _0x2a0b59[_0x8fad('0xd')]===_0x8fad('0xe')&&typeof _0x2a0b59[_0x8fad('0xf')]==='undefined';var _0x361264=_0x4e6f64[_0x8fad('0x10')];var _0x55edf1=_0x5d42ce?0x0:_0x2a0b59[_0x8fad('0xd')];var _0x557952=_0x5d42ce?_0x4e6f64[_0x8fad('0x10')]:_0x2a0b59[_0x8fad('0xd')]+_0x2a0b59['limit'];var _0xa1bc09;if(_0x557952>=_0x361264){_0x557952=_0x361264;_0xa1bc09=0xc8;}else{_0xa1bc09=0xce;}_0x18538d['status'](_0xa1bc09);return _0x18538d[_0x8fad('0x11')](_0x8fad('0x12'),_0x55edf1+'-'+_0x557952+'/'+_0x361264)['json'](_0x4e6f64);}return null;};}function removeEntity(_0x20c8b7){return function(_0x19f9e2){if(_0x19f9e2){return _0x19f9e2[_0x8fad('0x13')]()['then'](function(){var _0x1eda58=_0x19f9e2[_0x8fad('0x14')]({'plain':!![]});var _0x5303cd=[{'name':'InboundRoutes','value':_0x8fad('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0x8fad('0x16'),'ignore':![]},{'name':_0x8fad('0x17'),'value':'internal','ignore':![]}];var _0x185a36=_(_0x5303cd)[_0x8fad('0x18')](_0x8fad('0x19'))['map']('value')[_0x8fad('0x1a')]();if(_['includes'](_0x185a36,_0x1eda58[_0x8fad('0x1b')])){return;}var _0x53ecbc=_[_0x8fad('0x1c')](_0x5303cd,[_0x8fad('0x1a'),_0x1eda58[_0x8fad('0x1b')]])[_0x8fad('0x1d')];return db[_0x8fad('0x1e')]['destroy']({'where':{'type':_0x53ecbc,'resourceId':_0x1eda58['id']}})['then'](function(){return _0x19f9e2;});})[_0x8fad('0x1f')](function(){_0x20c8b7[_0x8fad('0xc')](0xcc)[_0x8fad('0x20')]();});}};}function handleEntityNotFound(_0x43252b){return function(_0x1742f2){if(!_0x1742f2){_0x43252b['sendStatus'](0x194);}return _0x1742f2;};}function handleError(_0x5cc660,_0x10b74b){_0x10b74b=_0x10b74b||0x1f4;return function(_0x3fabe3){logger[_0x8fad('0x21')](_0x3fabe3[_0x8fad('0x22')]);if(_0x3fabe3[_0x8fad('0x1d')]){delete _0x3fabe3['name'];}_0x5cc660[_0x8fad('0xc')](_0x10b74b)['send'](_0x3fabe3);};}exports[_0x8fad('0x23')]=function(_0x5f28a0,_0xdcd0d5){var _0x250347={},_0x2811f5={},_0x48344e={'count':0x0,'rows':[]};var _0x4c2b21=_[_0x8fad('0x24')](db['VoiceExtension'][_0x8fad('0x25')],function(_0x3ec5eb){return{'name':_0x3ec5eb['fieldName'],'type':_0x3ec5eb[_0x8fad('0x1b')][_0x8fad('0x26')]};});_0x2811f5[_0x8fad('0x27')]=_[_0x8fad('0x24')](_0x4c2b21,_0x8fad('0x1d'));_0x2811f5[_0x8fad('0x28')]=_['keys'](_0x5f28a0[_0x8fad('0x28')]);_0x2811f5[_0x8fad('0x29')]=_['intersection'](_0x2811f5['model'],_0x2811f5['query']);_0x250347[_0x8fad('0x2a')]=_[_0x8fad('0x2b')](_0x2811f5[_0x8fad('0x27')],qs[_0x8fad('0x2c')](_0x5f28a0[_0x8fad('0x28')][_0x8fad('0x2c')]));_0x250347[_0x8fad('0x2a')]=_0x250347[_0x8fad('0x2a')][_0x8fad('0x2d')]?_0x250347[_0x8fad('0x2a')]:_0x2811f5[_0x8fad('0x27')];if(!_0x5f28a0[_0x8fad('0x28')]['hasOwnProperty']('nolimit')){_0x250347[_0x8fad('0xf')]=qs[_0x8fad('0xf')](_0x5f28a0['query'][_0x8fad('0xf')]);_0x250347[_0x8fad('0xd')]=qs[_0x8fad('0xd')](_0x5f28a0[_0x8fad('0x28')]['offset']);}_0x250347['order']=qs[_0x8fad('0x2e')](_0x5f28a0[_0x8fad('0x28')]['sort']);_0x250347['where']=qs[_0x8fad('0x29')](_['pick'](_0x5f28a0[_0x8fad('0x28')],_0x2811f5[_0x8fad('0x29')]),_0x4c2b21);if(_0x5f28a0['query']['filter']){_0x250347[_0x8fad('0x2f')]=_[_0x8fad('0x30')](_0x250347[_0x8fad('0x2f')],{'$or':_['map'](_0x4c2b21,function(_0x4bd837){if(_0x4bd837['type']!==_0x8fad('0x31')){var _0x257c3c={};_0x257c3c[_0x4bd837[_0x8fad('0x1d')]]={'$like':'%'+_0x5f28a0[_0x8fad('0x28')][_0x8fad('0x18')]+'%'};return _0x257c3c;}})});}_0x250347=_[_0x8fad('0x30')]({},_0x250347,_0x5f28a0[_0x8fad('0x32')]);var _0x39277a={'where':_0x250347['where']};return db[_0x8fad('0x33')][_0x8fad('0x10')](_0x39277a)['then'](function(_0x4f5ccf){_0x48344e['count']=_0x4f5ccf;if(_0x5f28a0[_0x8fad('0x28')][_0x8fad('0x34')]){_0x250347[_0x8fad('0x35')]=[{'all':!![]}];}return db[_0x8fad('0x33')]['findAll'](_0x250347);})[_0x8fad('0x1f')](function(_0x5c153e){_0x48344e[_0x8fad('0x36')]=_0x5c153e;return _0x48344e;})['then'](respondWithFilteredResult(_0xdcd0d5,_0x250347))[_0x8fad('0x37')](handleError(_0xdcd0d5,null));};exports[_0x8fad('0x38')]=function(_0x3ffeb0,_0x7bdf82){var _0x2efb9d={'raw':![],'where':{'id':_0x3ffeb0['params']['id']}},_0x949958={};_0x949958[_0x8fad('0x27')]=_[_0x8fad('0x39')](db[_0x8fad('0x33')][_0x8fad('0x25')]);_0x949958['query']=_['keys'](_0x3ffeb0[_0x8fad('0x28')]);_0x949958[_0x8fad('0x29')]=_['intersection'](_0x949958[_0x8fad('0x27')],_0x949958[_0x8fad('0x28')]);_0x2efb9d[_0x8fad('0x2a')]=_[_0x8fad('0x2b')](_0x949958[_0x8fad('0x27')],qs[_0x8fad('0x2c')](_0x3ffeb0[_0x8fad('0x28')][_0x8fad('0x2c')]));_0x2efb9d['attributes']=_0x2efb9d[_0x8fad('0x2a')][_0x8fad('0x2d')]?_0x2efb9d[_0x8fad('0x2a')]:_0x949958[_0x8fad('0x27')];if(_0x3ffeb0[_0x8fad('0x28')]['includeAll']){_0x2efb9d[_0x8fad('0x35')]=[{'all':!![]}];}_0x2efb9d=_[_0x8fad('0x30')]({},_0x2efb9d,_0x3ffeb0[_0x8fad('0x32')]);return db[_0x8fad('0x33')][_0x8fad('0x1c')](_0x2efb9d)[_0x8fad('0x1f')](handleEntityNotFound(_0x7bdf82,null))[_0x8fad('0x1f')](respondWithResult(_0x7bdf82,null))[_0x8fad('0x37')](handleError(_0x7bdf82,null));};exports['destroy']=function(_0x43ed6f,_0x4d6bc0){return db['VoiceExtension'][_0x8fad('0x1c')]({'where':{'id':_0x43ed6f[_0x8fad('0x3a')]['id']}})[_0x8fad('0x1f')](handleEntityNotFound(_0x4d6bc0,null))[_0x8fad('0x1f')](removeEntity(_0x4d6bc0,null))[_0x8fad('0x37')](handleError(_0x4d6bc0,null));};exports[_0x8fad('0x3b')]=function(_0x4e5db5,_0x46469c){if(_0x4e5db5[_0x8fad('0x3c')][_0x8fad('0x1b')]==='outbound'&&!_[_0x8fad('0x3d')](_0x4e5db5[_0x8fad('0x3c')][_0x8fad('0x3e')],'_')){_0x4e5db5[_0x8fad('0x3c')]['exten']='_'[_0x8fad('0x3f')](_0x4e5db5[_0x8fad('0x3c')][_0x8fad('0x3e')]);}return db[_0x8fad('0x33')][_0x8fad('0x3b')](_0x4e5db5[_0x8fad('0x3c')],{'raw':![]})['then'](function(_0x136eab){var _0x446e27=_0x4e5db5[_0x8fad('0x40')][_0x8fad('0x14')]({'plain':!![]});if(!_0x446e27)throw new Error(_0x8fad('0x41'));if(_0x446e27['role']===_0x8fad('0x40')){var _0x5cef1f=_0x136eab[_0x8fad('0x14')]({'plain':!![]});var _0x1f8e06=[{'name':_0x8fad('0x42'),'value':_0x8fad('0x15')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x8fad('0x17'),'value':'internal'}];var _0x3ad563=_[_0x8fad('0x1c')](_0x1f8e06,[_0x8fad('0x1a'),_0x5cef1f[_0x8fad('0x1b')]])['name'];return db[_0x8fad('0x43')][_0x8fad('0x1c')]({'where':{'name':_0x3ad563,'userProfileId':_0x446e27[_0x8fad('0x44')]},'raw':!![]})[_0x8fad('0x1f')](function(_0x3ea033){if(_0x3ea033&&_0x3ea033[_0x8fad('0x45')]===0x0){return db['UserProfileResource'][_0x8fad('0x3b')]({'name':_0x5cef1f[_0x8fad('0x1d')],'resourceId':_0x5cef1f['id'],'type':_0x3ea033[_0x8fad('0x1d')],'sectionId':_0x3ea033['id']},{})[_0x8fad('0x1f')](function(){return _0x136eab;});}else{return _0x136eab;}})[_0x8fad('0x37')](function(_0x37d499){logger[_0x8fad('0x21')](_0x8fad('0x46'),_0x37d499);throw _0x37d499;});}return _0x136eab;})[_0x8fad('0x1f')](respondWithResult(_0x46469c,0xc9))[_0x8fad('0x37')](handleError(_0x46469c,null));};exports['update']=function(_0x2b24b7,_0x553cad){if(_0x2b24b7['body']['id']){delete _0x2b24b7[_0x8fad('0x3c')]['id'];}return db[_0x8fad('0x33')][_0x8fad('0x1c')]({'where':{'id':_0x2b24b7[_0x8fad('0x3a')]['id']}})[_0x8fad('0x1f')](handleEntityNotFound(_0x553cad,null))[_0x8fad('0x1f')](function(_0x10b028){if(_0x10b028){return db[_0x8fad('0x33')][_0x8fad('0x47')](_['pick'](_0x2b24b7[_0x8fad('0x3c')],['exten','context','description',_0x8fad('0x48'),_0x8fad('0x49'),'mandatoryDisposition','alias']),{'where':{'context':_0x10b028[_0x8fad('0x4a')],'exten':_0x10b028[_0x8fad('0x3e')]},'individualHooks':!![]})[_0x8fad('0x1f')](function(_0x23151b){return _0x23151b;});}return null;})[_0x8fad('0x1f')](respondWithStatusCode(_0x553cad,null))[_0x8fad('0x37')](handleError(_0x553cad,null));};exports[_0x8fad('0x4b')]=function(_0x5d504c,_0x3511ab){var _0x5ba1c6=_0x5d504c[_0x8fad('0x3a')]['id'];var _0x436191=_0x5d504c[_0x8fad('0x3c')];var _0x1ef63f=0xc8;var _0x4c0c82=null;return db['sequelize'][_0x8fad('0x4c')]({'isolationLevel':db[_0x8fad('0x4d')][_0x8fad('0x4e')][_0x8fad('0x4f')][_0x8fad('0x50')]},function(_0x4024ca){return db[_0x8fad('0x33')]['findOne']({'where':{'id':_0x5ba1c6},'transaction':_0x4024ca})[_0x8fad('0x1f')](function(_0x5a68eb){if(_0x5a68eb){return db[_0x8fad('0x33')][_0x8fad('0x13')]({'where':{'VoiceExtensionId':_0x5ba1c6},'transaction':_0x4024ca})[_0x8fad('0x1f')](function(){var _0x38e347=_[_0x8fad('0x24')](_0x436191,function(_0x4c1bac){_0x4c1bac[_0x8fad('0x51')]=_0x5ba1c6;_0x4c1bac[_0x8fad('0x52')]=!![];return _0x4c1bac;});return _0x5a68eb['createRouting'](_0x38e347);})[_0x8fad('0x1f')](function(_0x5bf246){return db[_0x8fad('0x33')][_0x8fad('0x53')](_0x5bf246,{'transaction':_0x4024ca});});}else{_0x1ef63f=0x194;_0x4c0c82=[];}});})['then'](function(){if(_0x1ef63f!==0x194){return db[_0x8fad('0x33')][_0x8fad('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5ba1c6},'order':'cast(priority\x20as\x20unsigned)'})[_0x8fad('0x1f')](function(_0x46d55f){_0x4c0c82=_0x46d55f;});}})[_0x8fad('0x37')](function(_0x451860){_0x1ef63f=0x1f4;logger[_0x8fad('0x21')](_0x451860[_0x8fad('0x22')]);if(_0x451860[_0x8fad('0x1d')]){delete _0x451860[_0x8fad('0x1d')];}_0x4c0c82=_0x451860;})['finally'](function(){if(_0x4c0c82===null){_0x3511ab[_0x8fad('0xb')](_0x1ef63f);}else{if(_0x1ef63f===0x1f4){_0x3511ab[_0x8fad('0xc')](_0x1ef63f)[_0x8fad('0x55')](_0x4c0c82);}else{_0x3511ab[_0x8fad('0xc')](_0x1ef63f)[_0x8fad('0x56')](_0x4c0c82);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0413ee1..204a615 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 _0x8901=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension'];(function(_0xc4982,_0x101aab){var _0x41af41=function(_0x24cd26){while(--_0x24cd26){_0xc4982['push'](_0xc4982['shift']());}};_0x41af41(++_0x101aab);}(_0x8901,0x1ac));var _0x1890=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x8901[_0x585d81];return _0x1aca0d;};'use strict';var EventEmitter=require(_0x1890('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x1890('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1890('0x2')](0x0);var events={'afterCreate':_0x1890('0x3'),'afterUpdate':_0x1890('0x4'),'afterDestroy':_0x1890('0x5')};function emitEvent(_0x2bfc93){return function(_0x55b22e,_0x4ea73f,_0x1d1e2b){VoiceExtensionEvents[_0x1890('0x6')](_0x2bfc93+':'+_0x55b22e['id'],_0x55b22e);VoiceExtensionEvents[_0x1890('0x6')](_0x2bfc93,_0x55b22e);_0x1d1e2b(null);};}for(var e in events){if(events[_0x1890('0x7')](e)){var event=events[e];VoiceExtension[_0x1890('0x8')](e,emitEvent(event));}}module[_0x1890('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9286=['update','emit','exports','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x11a9ad,_0x557c65){var _0x4bfc38=function(_0x96f2c8){while(--_0x96f2c8){_0x11a9ad['push'](_0x11a9ad['shift']());}};_0x4bfc38(++_0x557c65);}(_0x9286,0x1b9));var _0x6928=function(_0x4eaa9c,_0x3a879a){_0x4eaa9c=_0x4eaa9c-0x0;var _0x46b796=_0x9286[_0x4eaa9c];return _0x46b796;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x6928('0x0'))['db'][_0x6928('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6928('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6928('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4aa31b){return function(_0x3c4628,_0x4b200f,_0xdb3bd9){VoiceExtensionEvents[_0x6928('0x4')](_0x4aa31b+':'+_0x3c4628['id'],_0x3c4628);VoiceExtensionEvents['emit'](_0x4aa31b,_0x3c4628);_0xdb3bd9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x6928('0x5')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 85f441b..8bd1edf 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 _0x3e68=['):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','url','split','length','name','param','phone','prefix','SIP','join','options','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','voice_extensions','concat','Hangup','lodash','models','type','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','Set','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x46fd5e,_0xedba8c){var _0x503ea7=function(_0x49f199){while(--_0x49f199){_0x46fd5e['push'](_0x46fd5e['shift']());}};_0x503ea7(++_0xedba8c);}(_0x3e68,0x190));var _0x83e6=function(_0x99b49e,_0x595423){_0x99b49e=_0x99b49e-0x0;var _0x1ae3ad=_0x3e68[_0x99b49e];return _0x1ae3ad;};'use strict';var _=require(_0x83e6('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0xe9d4eb){var _0x522596=_0xe9d4eb[_0x83e6('0x1')];function _0x3b0873(_0x6f421e){var _0x11e41e=0x2;var _0x3ef9f3=[{'type':_0x6f421e[_0x83e6('0x2')],'app':'Set','appdata':_0x83e6('0x3')+_0x6f421e[_0x83e6('0x2')],'context':_0x6f421e[_0x83e6('0x4')],'exten':_0x6f421e[_0x83e6('0x5')],'priority':_0x11e41e++,'VoiceExtensionId':_0x6f421e['id']},{'type':_0x6f421e[_0x83e6('0x2')],'app':_0x6f421e[_0x83e6('0x6')]?'Set':_0x83e6('0x7'),'appdata':_0x6f421e[_0x83e6('0x6')]?_0x83e6('0x8')+_0x6f421e[_0x83e6('0x6')]:_0x83e6('0x9'),'context':_0x6f421e[_0x83e6('0x4')],'exten':_0x6f421e[_0x83e6('0x5')],'priority':_0x11e41e++,'VoiceExtensionId':_0x6f421e['id']}];if(_0x6f421e[_0x83e6('0x2')]===_0x83e6('0xa')){_0x3ef9f3[_0x83e6('0xb')]({'type':'inbound','app':'Set','appdata':'CDR(routeid)='+_0x6f421e['id'],'context':_0x6f421e[_0x83e6('0x4')],'exten':_0x6f421e[_0x83e6('0x5')],'priority':_0x11e41e++,'VoiceExtensionId':_0x6f421e['id']});}_0x3ef9f3[_0x83e6('0xb')]({'type':_0x6f421e['type'],'app':_0x83e6('0xc'),'appdata':_0x83e6('0xd'),'context':_0x6f421e[_0x83e6('0x4')],'exten':_0x6f421e['exten'],'priority':_0x11e41e++,'VoiceExtensionId':_0x6f421e['id']},{'type':_0x6f421e[_0x83e6('0x2')],'app':'Set','appdata':_0x83e6('0xe'),'context':_0x6f421e[_0x83e6('0x4')],'exten':_0x6f421e[_0x83e6('0x5')],'priority':_0x11e41e++,'VoiceExtensionId':_0x6f421e['id']},{'type':_0x6f421e[_0x83e6('0x2')],'app':'Set','appdata':_0x83e6('0xf'),'context':_0x6f421e[_0x83e6('0x4')],'exten':_0x6f421e[_0x83e6('0x5')],'priority':_0x11e41e++,'VoiceExtensionId':_0x6f421e['id']});return _0x3ef9f3;}function _0x1be5de(_0x19ce33){var _0x433f3c=0x2;var _0x5ea836=[{'type':'outbound','app':_0x83e6('0xc'),'appdata':_0x83e6('0x10'),'context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33[_0x83e6('0x5')],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':'outbound','app':_0x19ce33[_0x83e6('0x6')]?_0x83e6('0xc'):'NoOp','appdata':_0x19ce33[_0x83e6('0x6')]?_0x83e6('0x8')+_0x19ce33[_0x83e6('0x6')]:_0x83e6('0x9'),'context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33[_0x83e6('0x5')],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x12')+(_0x19ce33[_0x83e6('0x13')]?_0x83e6('0x14')+_0x19ce33[_0x83e6('0x13')]+'}':_0x83e6('0x15')),'context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33[_0x83e6('0x5')],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x16')+_0x19ce33['id'],'context':_0x19ce33['context'],'exten':_0x19ce33[_0x83e6('0x5')],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':_0x83e6('0x17'),'appdata':_0x83e6('0x18')+(_0x433f3c+0x2)+_0x83e6('0x19')+(_0x433f3c+0x1)+')','context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33[_0x83e6('0x5')],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':'Set','appdata':_0x19ce33[_0x83e6('0x13')]?_0x83e6('0x1a')+_0x19ce33[_0x83e6('0x13')]+'}':_0x83e6('0x1b'),'context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33['exten'],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':'Set','appdata':_0x83e6('0xd'),'context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33['exten'],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':'Set','appdata':_0x83e6('0xe'),'context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33[_0x83e6('0x5')],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':_0x83e6('0xc'),'appdata':'MONITOR_OPTIONS=ab','context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33['exten'],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x1c')+_0x19ce33['id'],'context':_0x19ce33[_0x83e6('0x4')],'exten':_0x19ce33['exten'],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']}];if(_0x19ce33[_0x83e6('0x1d')]('recordingFormat')&&_0x19ce33[_0x83e6('0x1e')]!==_0x83e6('0x1f')){_0x5ea836[_0x83e6('0xb')]({'type':_0x83e6('0x11'),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x20'),'context':_0x19ce33['context'],'exten':_0x19ce33[_0x83e6('0x5')],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']},{'type':_0x83e6('0x11'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x19ce33[_0x83e6('0x1e')]||_0x83e6('0x21'),'context':_0x19ce33['context'],'exten':_0x19ce33['exten'],'priority':_0x433f3c++,'VoiceExtensionId':_0x19ce33['id']});}return _0x5ea836;}function _0x7e1c60(_0x51a77f,_0x1f2d88){var _0x1e3738=[{'name':_0x83e6('0x22'),'param':0x0},{'name':_0x83e6('0x23'),'param':0x1},{'name':'options','param':0x2},{'name':_0x83e6('0x24'),'param':0x3}];var _0x1fcde1={};var _0x2fe028=_0x1f2d88[_0x83e6('0x25')](',');var _0x57b4e7=[];for(var _0x1dd8c=0x0;_0x1dd8c<_0x1e3738[_0x83e6('0x26')];_0x1dd8c++){switch(_0x1e3738[_0x1dd8c][_0x83e6('0x27')]){case _0x83e6('0x22'):_0x1fcde1[_0x83e6('0x22')]=_0x2fe028[_0x1e3738[_0x1dd8c][_0x83e6('0x28')]]['split']('/')[0x1];_0x1fcde1[_0x83e6('0x29')]=_0x2fe028[_0x1e3738[_0x1dd8c][_0x83e6('0x28')]][_0x83e6('0x25')]('/')[0x2];_0x1fcde1[_0x83e6('0x2a')]=_0x1fcde1[_0x83e6('0x29')]?_0x1fcde1[_0x83e6('0x29')][_0x83e6('0x25')]('$')[0x0]:undefined;_0x1fcde1[_0x83e6('0x29')]=_0x51a77f[_0x83e6('0x13')]?(_0x1fcde1[_0x83e6('0x2a')]||'')+_0x83e6('0x14')+_0x51a77f[_0x83e6('0x13')]+'}':(_0x1fcde1[_0x83e6('0x2a')]||'')+_0x83e6('0x15');_0x57b4e7[_0x1e3738[_0x1dd8c][_0x83e6('0x28')]]=[_0x83e6('0x2b'),_0x1fcde1[_0x83e6('0x22')],_0x1fcde1[_0x83e6('0x29')]][_0x83e6('0x2c')]('/');break;case _0x83e6('0x2d'):_0x1fcde1[_0x83e6('0x2d')]=_0x2fe028[_0x1e3738[_0x1dd8c][_0x83e6('0x28')]];if(_0x51a77f[_0x83e6('0x1e')]!==_0x83e6('0x1f')){if(_0x1fcde1[_0x83e6('0x2d')]['indexOf'](_0x83e6('0x2e'))<0x0){_0x1fcde1[_0x83e6('0x2d')]+='U(xcally-mixmonitor-context)';}}else{_0x1fcde1[_0x83e6('0x2d')]=_0x1fcde1[_0x83e6('0x2d')]['replace'](_0x83e6('0x2e'),'');}_0x57b4e7[_0x1e3738[_0x1dd8c][_0x83e6('0x28')]]=_0x1fcde1[_0x83e6('0x2d')];break;default:_0x57b4e7[_0x1e3738[_0x1dd8c][_0x83e6('0x28')]]=_0x2fe028[_0x1e3738[_0x1dd8c][_0x83e6('0x28')]];}}return _0x57b4e7[_0x83e6('0x2c')](',');}function _0x5255c5(_0x2faaa3,_0x1b1b94,_0x3e826a){return new Promise(function(_0x4383ab,_0x26da4d){var _0x2295a2=[];if(_[_0x83e6('0x2f')](_0x1b1b94))return _0x4383ab(_0x2295a2);_0x522596['Interval'][_0x83e6('0x30')]({'attributes':['id',_0x83e6('0x31'),_0x83e6('0x32')],'raw':!![]})[_0x83e6('0x33')](function(_0x11c226){for(var _0x56a18c=0x0,_0x4ff9e5=0x0;_0x56a18c<_0x1b1b94[_0x83e6('0x26')];_0x56a18c++,_0x4ff9e5=0x0){var _0x2ed278=_0x1b1b94[_0x56a18c];var _0x58256d=[];var _0x2b5307=[];delete _0x2ed278['id'];if(_0x2ed278[_0x83e6('0x31')]!==_0x83e6('0x34')){_0x2ed278[_0x83e6('0x35')]=[_0x2ed278['interval']];}else{_0x2ed278['intervals']=_0x2ed278[_0x83e6('0x32')]?_['map'](_[_0x83e6('0x36')](_0x11c226,{'IntervalId':_0x2ed278[_0x83e6('0x32')]}),_0x83e6('0x31')):[];}_0x2ed278[_0x83e6('0x4')]=_0x2faaa3['context'];_0x2ed278[_0x83e6('0x5')]=_0x2faaa3['exten'];if(_0x2ed278[_0x83e6('0x2')])_0x2ed278[_0x83e6('0x2')]=_0x2ed278[_0x83e6('0x2')][_0x83e6('0x37')]();if(_0x2faaa3[_0x83e6('0x2')]===_0x83e6('0x11')){if(_0x2ed278[_0x83e6('0x1d')](_0x83e6('0x38'))&&_0x2ed278[_0x83e6('0x38')]&&_0x2ed278[_0x83e6('0x38')]!=='--'){_0x58256d['push']({'type':_0x2ed278[_0x83e6('0x2')]['toLowerCase'](),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x39')+_0x2ed278['tag'],'context':_0x2faaa3[_0x83e6('0x4')],'exten':_0x2faaa3[_0x83e6('0x5')],'priority':_0x2ed278['intervals'][_0x83e6('0x26')]+_0x3e826a+_0x4ff9e5++,'VoiceExtensionId':_0x2faaa3['id']});}_0x58256d[_0x83e6('0xb')]({'type':_0x2ed278[_0x83e6('0x2')][_0x83e6('0x37')](),'app':_0x83e6('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x2ed278[_0x83e6('0x3a')]?_0x83e6('0x3b')+_0x2ed278[_0x83e6('0x3a')]+')':_0x83e6('0x3c')),'context':_0x2faaa3['context'],'exten':_0x2faaa3['exten'],'priority':_0x2ed278[_0x83e6('0x35')][_0x83e6('0x26')]+_0x3e826a+_0x4ff9e5++,'VoiceExtensionId':_0x2faaa3['id']});}else{if(_0x2ed278[_0x83e6('0x1d')](_0x83e6('0x3d'))){if([_0x83e6('0x3e'),_0x83e6('0x3f')][_0x83e6('0x40')](_0x2ed278[_0x83e6('0x41')][_0x83e6('0x37')]())&&_0x2ed278[_0x83e6('0x42')]!==_0x83e6('0x43')){if(_0x2ed278[_0x83e6('0x3d')]){_0x58256d[_0x83e6('0xb')]({'type':_0x2ed278[_0x83e6('0x2')]['toLowerCase'](),'app':'ExecIf','appdata':_0x83e6('0x44'),'context':_0x2faaa3['context'],'exten':_0x2faaa3['exten'],'priority':_0x2ed278[_0x83e6('0x35')]['length']+_0x3e826a+_0x4ff9e5++,'VoiceExtensionId':_0x2faaa3['id']});_0x58256d[_0x83e6('0xb')]({'type':_0x2ed278[_0x83e6('0x2')][_0x83e6('0x37')](),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x45'),'context':_0x2faaa3[_0x83e6('0x4')],'exten':_0x2faaa3[_0x83e6('0x5')],'priority':_0x2ed278['intervals'][_0x83e6('0x26')]+_0x3e826a+_0x4ff9e5++,'VoiceExtensionId':_0x2faaa3['id']});}else{_0x58256d[_0x83e6('0xb')]({'type':_0x2ed278[_0x83e6('0x2')][_0x83e6('0x37')](),'app':_0x83e6('0x17'),'appdata':_0x83e6('0x46'),'context':_0x2faaa3[_0x83e6('0x4')],'exten':_0x2faaa3['exten'],'priority':_0x2ed278['intervals'][_0x83e6('0x26')]+_0x3e826a+_0x4ff9e5++,'VoiceExtensionId':_0x2faaa3['id']});_0x58256d[_0x83e6('0xb')]({'type':_0x2ed278[_0x83e6('0x2')][_0x83e6('0x37')](),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x47'),'context':_0x2faaa3[_0x83e6('0x4')],'exten':_0x2faaa3[_0x83e6('0x5')],'priority':_0x2ed278[_0x83e6('0x35')][_0x83e6('0x26')]+_0x3e826a+_0x4ff9e5++,'VoiceExtensionId':_0x2faaa3['id']});}}}}for(var _0x17d8ee=0x0;_0x17d8ee<_0x2ed278[_0x83e6('0x35')][_0x83e6('0x26')];_0x17d8ee++){var _0x4ee828=_0x3e826a+_0x2ed278['intervals']['length'];var _0x161a0e=_0x17d8ee===_0x2ed278[_0x83e6('0x35')][_0x83e6('0x26')]-0x1?_0x3e826a+_0x58256d[_0x83e6('0x26')]+_0x2b5307[_0x83e6('0x26')]+0x2:_0x3e826a+_0x17d8ee+0x1;_0x58256d['splice'](_0x17d8ee,0x0,{'type':_0x2faaa3['type'],'app':_0x83e6('0x48'),'appdata':_0x2ed278[_0x83e6('0x35')][_0x17d8ee]+'?'+_0x2faaa3[_0x83e6('0x4')]+_0x83e6('0x49')+_0x4ee828+':'+_0x2faaa3[_0x83e6('0x4')]+',${EXTEN},'+_0x161a0e,'exten':_0x2faaa3['exten'],'context':_0x2faaa3[_0x83e6('0x4')],'priority':_0x3e826a+_0x17d8ee,'VoiceExtensionId':_0x2faaa3['id']});}if(_0x2ed278[_0x83e6('0x42')]===_0x83e6('0x4a')){_0x2ed278[_0x83e6('0x4b')]=_0x7e1c60(_0x2faaa3,_0x2ed278['appdata']);}if(_0x2ed278[_0x83e6('0x42')]===_0x83e6('0x4c')){_0x58256d[_0x83e6('0xb')]({'type':_0x2ed278[_0x83e6('0x2')][_0x83e6('0x37')](),'app':_0x83e6('0xc'),'appdata':_0x83e6('0x4d'),'context':_0x2faaa3[_0x83e6('0x4')],'exten':_0x2faaa3[_0x83e6('0x5')],'priority':_0x2ed278[_0x83e6('0x35')][_0x83e6('0x26')]+_0x3e826a+_0x4ff9e5++,'VoiceExtensionId':_0x2faaa3['id']});}_0x2ed278[_0x83e6('0x4e')]=_0x58256d['length']?_[_0x83e6('0x4f')](_0x58256d)[_0x83e6('0x4e')]+0x1:_0x3e826a;_0x2295a2=_['concat'](_0x2295a2,_0x58256d,[_0x2ed278],_0x2b5307);_0x3e826a=_['last'](_0x2295a2)[_0x83e6('0x4e')]+0x1;}return _0x4383ab(_0x2295a2);})[_0x83e6('0x50')](function(_0x562cab){_0x26da4d(_0x562cab);});});}return _0xe9d4eb[_0x83e6('0x51')]('VoiceExtension',attributes,{'tableName':_0x83e6('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x41dc9b){var _0xdb665c=this['get']({'plain':!![]});var _0x418fe6=_0xdb665c[_0x83e6('0x2')]===_0x83e6('0x11')?_0x1be5de(_0xdb665c):_0x3b0873(_0xdb665c);return _0x5255c5(_0xdb665c,_0x41dc9b,_['last'](_0x418fe6)['priority']+0x1)[_0x83e6('0x33')](function(_0x5853c4){var _0x3e2380=_[_0x83e6('0x53')](_0x418fe6,_0x5853c4);_0x3e2380[_0x83e6('0xb')]({'type':_0xdb665c[_0x83e6('0x2')],'app':_0x83e6('0x54'),'exten':_0xdb665c['exten'],'context':_0xdb665c['context'],'priority':_[_0x83e6('0x4f')](_0x3e2380)[_0x83e6('0x4e')]+0x1,'VoiceExtensionId':_0xdb665c['id']});return _0x3e2380;});}}});}; \ No newline at end of file +var _0x7e1b=['replace','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','agi','priority','catch','define','VoiceExtension','get','last','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','length','trunk','phone','param','split','prefix','join','indexOf','U(xcally-mixmonitor-context)'];(function(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0x7e1b,0x119));var _0xb7e1=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x7e1b[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0xb7e1('0x0'));var attributes=require(_0xb7e1('0x1'));module[_0xb7e1('0x2')]=function(_0x284afe){var _0x3f79ae=_0x284afe[_0xb7e1('0x3')];function _0x1909d2(_0x3bc475){var _0x4cddf9=0x2;var _0x1d7b0f=[{'type':_0x3bc475[_0xb7e1('0x4')],'app':'Set','appdata':_0xb7e1('0x5')+_0x3bc475[_0xb7e1('0x4')],'context':_0x3bc475['context'],'exten':_0x3bc475[_0xb7e1('0x6')],'priority':_0x4cddf9++,'VoiceExtensionId':_0x3bc475['id']},{'type':_0x3bc475[_0xb7e1('0x4')],'app':_0x3bc475[_0xb7e1('0x7')]?_0xb7e1('0x8'):_0xb7e1('0x9'),'appdata':_0x3bc475['alias']?_0xb7e1('0xa')+_0x3bc475[_0xb7e1('0x7')]:_0xb7e1('0xb'),'context':_0x3bc475[_0xb7e1('0xc')],'exten':_0x3bc475[_0xb7e1('0x6')],'priority':_0x4cddf9++,'VoiceExtensionId':_0x3bc475['id']}];if(_0x3bc475['type']==='inbound'){_0x1d7b0f[_0xb7e1('0xd')]({'type':'inbound','app':_0xb7e1('0x8'),'appdata':_0xb7e1('0xe')+_0x3bc475['id'],'context':_0x3bc475[_0xb7e1('0xc')],'exten':_0x3bc475[_0xb7e1('0x6')],'priority':_0x4cddf9++,'VoiceExtensionId':_0x3bc475['id']});}_0x1d7b0f['push']({'type':_0x3bc475[_0xb7e1('0x4')],'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0xf'),'context':_0x3bc475[_0xb7e1('0xc')],'exten':_0x3bc475[_0xb7e1('0x6')],'priority':_0x4cddf9++,'VoiceExtensionId':_0x3bc475['id']},{'type':_0x3bc475['type'],'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0x10'),'context':_0x3bc475['context'],'exten':_0x3bc475[_0xb7e1('0x6')],'priority':_0x4cddf9++,'VoiceExtensionId':_0x3bc475['id']},{'type':_0x3bc475[_0xb7e1('0x4')],'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0x11'),'context':_0x3bc475[_0xb7e1('0xc')],'exten':_0x3bc475['exten'],'priority':_0x4cddf9++,'VoiceExtensionId':_0x3bc475['id']});return _0x1d7b0f;}function _0x287bac(_0x3292f4){var _0x567a99=0x2;var _0x388893=[{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0x13'),'context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4[_0xb7e1('0x6')],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0x3292f4['alias']?_0xb7e1('0x8'):_0xb7e1('0x9'),'appdata':_0x3292f4[_0xb7e1('0x7')]?'CDR(routeAlias)='+_0x3292f4['alias']:'No\x20alias\x20set','context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4['exten'],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':'Set','appdata':_0xb7e1('0x14')+(_0x3292f4['cutdigits']?_0xb7e1('0x15')+_0x3292f4[_0xb7e1('0x16')]+'}':_0xb7e1('0x17')),'context':_0x3292f4['context'],'exten':_0x3292f4[_0xb7e1('0x6')],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':'CDR(routeid)='+_0x3292f4['id'],'context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4['exten'],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x18'),'appdata':_0xb7e1('0x19')+(_0x567a99+0x2)+_0xb7e1('0x1a')+(_0x567a99+0x1)+')','context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4[_0xb7e1('0x6')],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':_0x3292f4[_0xb7e1('0x16')]?_0xb7e1('0x1b')+_0x3292f4[_0xb7e1('0x16')]+'}':_0xb7e1('0x1c'),'context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4[_0xb7e1('0x6')],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0xf'),'context':_0x3292f4['context'],'exten':_0x3292f4['exten'],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4[_0xb7e1('0x6')],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4['exten'],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':'outboundrouteid='+_0x3292f4['id'],'context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4[_0xb7e1('0x6')],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']}];if(_0x3292f4[_0xb7e1('0x1d')](_0xb7e1('0x1e'))&&_0x3292f4[_0xb7e1('0x1e')]!==_0xb7e1('0x1f')){_0x388893[_0xb7e1('0xd')]({'type':_0xb7e1('0x12'),'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0x20'),'context':_0x3292f4['context'],'exten':_0x3292f4[_0xb7e1('0x6')],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']},{'type':_0xb7e1('0x12'),'app':'Set','appdata':_0xb7e1('0x21')+_0x3292f4[_0xb7e1('0x1e')]||_0xb7e1('0x22'),'context':_0x3292f4[_0xb7e1('0xc')],'exten':_0x3292f4['exten'],'priority':_0x567a99++,'VoiceExtensionId':_0x3292f4['id']});}return _0x388893;}function _0x34918b(_0x17ce1d,_0x3cf003){var _0x5ceab8=[{'name':'trunk','param':0x0},{'name':_0xb7e1('0x23'),'param':0x1},{'name':_0xb7e1('0x24'),'param':0x2},{'name':_0xb7e1('0x25'),'param':0x3}];var _0x1d4a78={};var _0x3bb790=_0x3cf003['split'](',');var _0x21110c=[];for(var _0x1d6956=0x0;_0x1d6956<_0x5ceab8[_0xb7e1('0x26')];_0x1d6956++){switch(_0x5ceab8[_0x1d6956]['name']){case'trunk':_0x1d4a78[_0xb7e1('0x27')]=_0x3bb790[_0x5ceab8[_0x1d6956]['param']]['split']('/')[0x1];_0x1d4a78[_0xb7e1('0x28')]=_0x3bb790[_0x5ceab8[_0x1d6956][_0xb7e1('0x29')]][_0xb7e1('0x2a')]('/')[0x2];_0x1d4a78['prefix']=_0x1d4a78['phone']?_0x1d4a78[_0xb7e1('0x28')][_0xb7e1('0x2a')]('$')[0x0]:undefined;_0x1d4a78[_0xb7e1('0x28')]=_0x17ce1d[_0xb7e1('0x16')]?(_0x1d4a78[_0xb7e1('0x2b')]||'')+'${EXTEN:'+_0x17ce1d[_0xb7e1('0x16')]+'}':(_0x1d4a78[_0xb7e1('0x2b')]||'')+_0xb7e1('0x17');_0x21110c[_0x5ceab8[_0x1d6956][_0xb7e1('0x29')]]=['SIP',_0x1d4a78['trunk'],_0x1d4a78[_0xb7e1('0x28')]][_0xb7e1('0x2c')]('/');break;case _0xb7e1('0x24'):_0x1d4a78['options']=_0x3bb790[_0x5ceab8[_0x1d6956]['param']];if(_0x17ce1d[_0xb7e1('0x1e')]!==_0xb7e1('0x1f')){if(_0x1d4a78[_0xb7e1('0x24')][_0xb7e1('0x2d')](_0xb7e1('0x2e'))<0x0){_0x1d4a78[_0xb7e1('0x24')]+=_0xb7e1('0x2e');}}else{_0x1d4a78[_0xb7e1('0x24')]=_0x1d4a78['options'][_0xb7e1('0x2f')](_0xb7e1('0x2e'),'');}_0x21110c[_0x5ceab8[_0x1d6956][_0xb7e1('0x29')]]=_0x1d4a78[_0xb7e1('0x24')];break;default:_0x21110c[_0x5ceab8[_0x1d6956][_0xb7e1('0x29')]]=_0x3bb790[_0x5ceab8[_0x1d6956][_0xb7e1('0x29')]];}}return _0x21110c[_0xb7e1('0x2c')](',');}function _0x29c74c(_0x457e69,_0x43cae0,_0x10cf32){return new Promise(function(_0x53b8c6,_0x553983){var _0x19ba79=[];if(_['isEmpty'](_0x43cae0))return _0x53b8c6(_0x19ba79);_0x3f79ae[_0xb7e1('0x30')][_0xb7e1('0x31')]({'attributes':['id',_0xb7e1('0x32'),_0xb7e1('0x33')],'raw':!![]})['then'](function(_0x958fc2){for(var _0xb02732=0x0,_0x6ea5c8=0x0;_0xb02732<_0x43cae0[_0xb7e1('0x26')];_0xb02732++,_0x6ea5c8=0x0){var _0x5b1e08=_0x43cae0[_0xb02732];var _0x4e0462=[];var _0x4d950d=[];delete _0x5b1e08['id'];if(_0x5b1e08[_0xb7e1('0x32')]!==_0xb7e1('0x34')){_0x5b1e08[_0xb7e1('0x35')]=[_0x5b1e08['interval']];}else{_0x5b1e08['intervals']=_0x5b1e08[_0xb7e1('0x33')]?_['map'](_[_0xb7e1('0x36')](_0x958fc2,{'IntervalId':_0x5b1e08['IntervalId']}),'interval'):[];}_0x5b1e08[_0xb7e1('0xc')]=_0x457e69[_0xb7e1('0xc')];_0x5b1e08[_0xb7e1('0x6')]=_0x457e69['exten'];if(_0x5b1e08[_0xb7e1('0x4')])_0x5b1e08[_0xb7e1('0x4')]=_0x5b1e08[_0xb7e1('0x4')][_0xb7e1('0x37')]();if(_0x457e69[_0xb7e1('0x4')]===_0xb7e1('0x12')){if(_0x5b1e08[_0xb7e1('0x1d')](_0xb7e1('0x38'))&&_0x5b1e08[_0xb7e1('0x38')]&&_0x5b1e08[_0xb7e1('0x38')]!=='--'){_0x4e0462[_0xb7e1('0xd')]({'type':_0x5b1e08[_0xb7e1('0x4')][_0xb7e1('0x37')](),'app':'Set','appdata':_0xb7e1('0x39')+_0x5b1e08[_0xb7e1('0x38')],'context':_0x457e69[_0xb7e1('0xc')],'exten':_0x457e69[_0xb7e1('0x6')],'priority':_0x5b1e08['intervals'][_0xb7e1('0x26')]+_0x10cf32+_0x6ea5c8++,'VoiceExtensionId':_0x457e69['id']});}_0x4e0462[_0xb7e1('0xd')]({'type':_0x5b1e08[_0xb7e1('0x4')][_0xb7e1('0x37')](),'app':'ExecIf','appdata':_0xb7e1('0x3a')+(_0x5b1e08[_0xb7e1('0x3b')]?_0xb7e1('0x3c')+_0x5b1e08[_0xb7e1('0x3b')]+')':'NoOp(No\x20number\x20available)'),'context':_0x457e69[_0xb7e1('0xc')],'exten':_0x457e69[_0xb7e1('0x6')],'priority':_0x5b1e08['intervals'][_0xb7e1('0x26')]+_0x10cf32+_0x6ea5c8++,'VoiceExtensionId':_0x457e69['id']});}else{if(_0x5b1e08[_0xb7e1('0x1d')](_0xb7e1('0x3d'))){if([_0xb7e1('0x3e'),'playback'][_0xb7e1('0x3f')](_0x5b1e08[_0xb7e1('0x40')][_0xb7e1('0x37')]())&&_0x5b1e08[_0xb7e1('0x41')]!==_0xb7e1('0x42')){if(_0x5b1e08['answer']){_0x4e0462[_0xb7e1('0xd')]({'type':_0x5b1e08['type'][_0xb7e1('0x37')](),'app':_0xb7e1('0x18'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x457e69[_0xb7e1('0xc')],'exten':_0x457e69['exten'],'priority':_0x5b1e08[_0xb7e1('0x35')][_0xb7e1('0x26')]+_0x10cf32+_0x6ea5c8++,'VoiceExtensionId':_0x457e69['id']});_0x4e0462['push']({'type':_0x5b1e08[_0xb7e1('0x4')][_0xb7e1('0x37')](),'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0x43'),'context':_0x457e69[_0xb7e1('0xc')],'exten':_0x457e69['exten'],'priority':_0x5b1e08[_0xb7e1('0x35')]['length']+_0x10cf32+_0x6ea5c8++,'VoiceExtensionId':_0x457e69['id']});}else{_0x4e0462['push']({'type':_0x5b1e08[_0xb7e1('0x4')][_0xb7e1('0x37')](),'app':_0xb7e1('0x18'),'appdata':_0xb7e1('0x44'),'context':_0x457e69[_0xb7e1('0xc')],'exten':_0x457e69[_0xb7e1('0x6')],'priority':_0x5b1e08['intervals'][_0xb7e1('0x26')]+_0x10cf32+_0x6ea5c8++,'VoiceExtensionId':_0x457e69['id']});_0x4e0462[_0xb7e1('0xd')]({'type':_0x5b1e08[_0xb7e1('0x4')][_0xb7e1('0x37')](),'app':_0xb7e1('0x8'),'appdata':_0xb7e1('0x45'),'context':_0x457e69[_0xb7e1('0xc')],'exten':_0x457e69[_0xb7e1('0x6')],'priority':_0x5b1e08[_0xb7e1('0x35')][_0xb7e1('0x26')]+_0x10cf32+_0x6ea5c8++,'VoiceExtensionId':_0x457e69['id']});}}}}for(var _0xdd3288=0x0;_0xdd3288<_0x5b1e08[_0xb7e1('0x35')][_0xb7e1('0x26')];_0xdd3288++){var _0xe78033=_0x10cf32+_0x5b1e08['intervals'][_0xb7e1('0x26')];var _0x3643f8=_0xdd3288===_0x5b1e08['intervals']['length']-0x1?_0x10cf32+_0x4e0462[_0xb7e1('0x26')]+_0x4d950d[_0xb7e1('0x26')]+0x2:_0x10cf32+_0xdd3288+0x1;_0x4e0462['splice'](_0xdd3288,0x0,{'type':_0x457e69[_0xb7e1('0x4')],'app':_0xb7e1('0x46'),'appdata':_0x5b1e08[_0xb7e1('0x35')][_0xdd3288]+'?'+_0x457e69[_0xb7e1('0xc')]+_0xb7e1('0x47')+_0xe78033+':'+_0x457e69[_0xb7e1('0xc')]+_0xb7e1('0x47')+_0x3643f8,'exten':_0x457e69['exten'],'context':_0x457e69[_0xb7e1('0xc')],'priority':_0x10cf32+_0xdd3288,'VoiceExtensionId':_0x457e69['id']});}if(_0x5b1e08[_0xb7e1('0x41')]==='outboundDial'){_0x5b1e08[_0xb7e1('0x48')]=_0x34918b(_0x457e69,_0x5b1e08[_0xb7e1('0x48')]);}if(_0x5b1e08[_0xb7e1('0x41')]===_0xb7e1('0x49')){_0x4e0462[_0xb7e1('0xd')]({'type':_0x5b1e08['type'][_0xb7e1('0x37')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x457e69[_0xb7e1('0xc')],'exten':_0x457e69['exten'],'priority':_0x5b1e08['intervals'][_0xb7e1('0x26')]+_0x10cf32+_0x6ea5c8++,'VoiceExtensionId':_0x457e69['id']});}_0x5b1e08[_0xb7e1('0x4a')]=_0x4e0462['length']?_['last'](_0x4e0462)[_0xb7e1('0x4a')]+0x1:_0x10cf32;_0x19ba79=_['concat'](_0x19ba79,_0x4e0462,[_0x5b1e08],_0x4d950d);_0x10cf32=_['last'](_0x19ba79)[_0xb7e1('0x4a')]+0x1;}return _0x53b8c6(_0x19ba79);})[_0xb7e1('0x4b')](function(_0x139b16){_0x553983(_0x139b16);});});}return _0x284afe[_0xb7e1('0x4c')](_0xb7e1('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1d87ca){var _0x376ba3=this[_0xb7e1('0x4e')]({'plain':!![]});var _0x6b113c=_0x376ba3['type']==='outbound'?_0x287bac(_0x376ba3):_0x1909d2(_0x376ba3);return _0x29c74c(_0x376ba3,_0x1d87ca,_[_0xb7e1('0x4f')](_0x6b113c)[_0xb7e1('0x4a')]+0x1)['then'](function(_0x21f010){var _0x3b28a3=_[_0xb7e1('0x50')](_0x6b113c,_0x21f010);_0x3b28a3[_0xb7e1('0xd')]({'type':_0x376ba3[_0xb7e1('0x4')],'app':_0xb7e1('0x51'),'exten':_0x376ba3[_0xb7e1('0x6')],'context':_0x376ba3[_0xb7e1('0xc')],'priority':_[_0xb7e1('0x4f')](_0x3b28a3)[_0xb7e1('0x4a')]+0x1,'VoiceExtensionId':_0x376ba3['id']});return _0x3b28a3;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index cbdf373..7f502ce 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 _0x9576=['attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where'];(function(_0x48d6c2,_0x1ce5d2){var _0x39eeb1=function(_0xa992a7){while(--_0xa992a7){_0x48d6c2['push'](_0x48d6c2['shift']());}};_0x39eeb1(++_0x1ce5d2);}(_0x9576,0x182));var _0x6957=function(_0x3c26be,_0x9f2d08){_0x3c26be=_0x3c26be-0x0;var _0x397835=_0x9576[_0x3c26be];return _0x397835;};'use strict';var _=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var moment=require(_0x6957('0x2'));var BPromise=require(_0x6957('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6957('0x4'))['db'];var utils=require(_0x6957('0x5'));var logger=require(_0x6957('0x6'))(_0x6957('0x7'));var config=require(_0x6957('0x8'));var jayson=require(_0x6957('0x9'));var client=jayson[_0x6957('0xa')]['http']({'port':0x232a});config[_0x6957('0xb')]=_[_0x6957('0xc')](config[_0x6957('0xb')],{'host':_0x6957('0xd'),'port':0x18eb});var socket=require(_0x6957('0xe'))(new Redis(config[_0x6957('0xb')]));require('./voiceExtension.socket')[_0x6957('0xf')](socket);function respondWithRpcPromise(_0x1dded8,_0x483af0,_0x55078f){return new BPromise(function(_0x3e0520,_0x25c338){return client[_0x6957('0x10')](_0x1dded8,_0x55078f)[_0x6957('0x11')](function(_0x3e2f16){logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x483af0,_0x6957('0x14'),JSON[_0x6957('0x15')](_0x3e2f16));if(_0x3e2f16[_0x6957('0x16')]){if(_0x3e2f16[_0x6957('0x16')][_0x6957('0x17')]===0x1f4){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16['error']['message']);return _0x25c338(_0x3e2f16['error'][_0x6957('0x18')]);}logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x3e2f16[_0x6957('0x16')]['message']);return _0x3e0520(_0x3e2f16[_0x6957('0x16')]['message']);}else{logger[_0x6957('0x12')](_0x6957('0x13'),_0x483af0,'request\x20sent');_0x3e0520(_0x3e2f16[_0x6957('0x19')][_0x6957('0x18')]);}})[_0x6957('0x1a')](function(_0x4c527c){logger[_0x6957('0x16')](_0x6957('0x13'),_0x483af0,_0x4c527c);_0x25c338(_0x4c527c);});});}exports[_0x6957('0x1b')]=function(_0x135893){var _0x1ce753=this;return new Promise(function(_0x26d3fd,_0x35ee5b){return db[_0x6957('0x1c')]['findAll']({'raw':_0x135893['options']?_0x135893[_0x6957('0x1d')][_0x6957('0x1e')]===undefined?!![]:![]:!![],'where':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')][_0x6957('0x1f')]||null:null,'attributes':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')][_0x6957('0x20')]||null:null,'limit':_0x135893['options']?_0x135893[_0x6957('0x1d')][_0x6957('0x21')]||null:null,'include':_0x135893[_0x6957('0x1d')]?_0x135893[_0x6957('0x1d')]['include']?_['map'](_0x135893[_0x6957('0x1d')][_0x6957('0x22')],function(_0x5c4e49){return{'model':db[_0x5c4e49['model']],'as':_0x5c4e49['as'],'attributes':_0x5c4e49[_0x6957('0x20')],'include':_0x5c4e49[_0x6957('0x22')]?_[_0x6957('0x23')](_0x5c4e49['include'],function(_0x330015){return{'model':db[_0x330015[_0x6957('0x24')]],'as':_0x330015['as'],'attributes':_0x330015[_0x6957('0x20')],'include':_0x330015[_0x6957('0x22')]?_[_0x6957('0x23')](_0x330015[_0x6957('0x22')],function(_0x2d33ef){return{'model':db[_0x2d33ef[_0x6957('0x24')]],'as':_0x2d33ef['as'],'attributes':_0x2d33ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x6957('0x11')](function(_0x3a6e07){logger[_0x6957('0x12')](_0x6957('0x1b'),_0x135893);logger[_0x6957('0x25')](_0x6957('0x1b'),_0x135893,JSON[_0x6957('0x15')](_0x3a6e07));_0x26d3fd(_0x3a6e07);})[_0x6957('0x1a')](function(_0x1300b1){logger[_0x6957('0x16')](_0x6957('0x1b'),_0x1300b1['message'],_0x135893);_0x35ee5b(_0x1ce753['error'](0x1f4,_0x1300b1[_0x6957('0x18')]));});});}; \ No newline at end of file +var _0x7f94=['./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','include','model','map','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x44cadc,_0xca1a65){var _0x1aa117=function(_0x5e24a4){while(--_0x5e24a4){_0x44cadc['push'](_0x44cadc['shift']());}};_0x1aa117(++_0xca1a65);}(_0x7f94,0x65));var _0x47f9=function(_0x559ece,_0x4cd982){_0x559ece=_0x559ece-0x0;var _0x4b54ef=_0x7f94[_0x559ece];return _0x4b54ef;};'use strict';var _=require(_0x47f9('0x0'));var util=require('util');var moment=require(_0x47f9('0x1'));var BPromise=require(_0x47f9('0x2'));var rs=require(_0x47f9('0x3'));var fs=require('fs');var Redis=require(_0x47f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47f9('0x5'));var logger=require(_0x47f9('0x6'))(_0x47f9('0x7'));var config=require(_0x47f9('0x8'));var jayson=require(_0x47f9('0x9'));var client=jayson[_0x47f9('0xa')][_0x47f9('0xb')]({'port':0x232a});config['redis']=_[_0x47f9('0xc')](config[_0x47f9('0xd')],{'host':_0x47f9('0xe'),'port':0x18eb});var socket=require(_0x47f9('0xf'))(new Redis(config[_0x47f9('0xd')]));require(_0x47f9('0x10'))[_0x47f9('0x11')](socket);function respondWithRpcPromise(_0x5228e5,_0x4ea32d,_0x56ebcf){return new BPromise(function(_0x578fbe,_0x2f4e9d){return client[_0x47f9('0x12')](_0x5228e5,_0x56ebcf)[_0x47f9('0x13')](function(_0x32cb8f){logger[_0x47f9('0x14')](_0x47f9('0x15'),_0x4ea32d,'request\x20sent');logger['debug'](_0x47f9('0x16'),_0x4ea32d,'request\x20sent',JSON['stringify'](_0x32cb8f));if(_0x32cb8f['error']){if(_0x32cb8f[_0x47f9('0x17')][_0x47f9('0x18')]===0x1f4){logger['error'](_0x47f9('0x15'),_0x4ea32d,_0x32cb8f[_0x47f9('0x17')][_0x47f9('0x19')]);return _0x2f4e9d(_0x32cb8f[_0x47f9('0x17')]['message']);}logger[_0x47f9('0x17')](_0x47f9('0x15'),_0x4ea32d,_0x32cb8f[_0x47f9('0x17')][_0x47f9('0x19')]);return _0x578fbe(_0x32cb8f[_0x47f9('0x17')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x4ea32d,_0x47f9('0x1a'));_0x578fbe(_0x32cb8f[_0x47f9('0x1b')][_0x47f9('0x19')]);}})[_0x47f9('0x1c')](function(_0x16b44f){logger[_0x47f9('0x17')](_0x47f9('0x15'),_0x4ea32d,_0x16b44f);_0x2f4e9d(_0x16b44f);});});}exports[_0x47f9('0x1d')]=function(_0x2d20d2){var _0x85bafd=this;return new Promise(function(_0x34fba6,_0x328d14){return db[_0x47f9('0x1e')]['findAll']({'raw':_0x2d20d2['options']?_0x2d20d2[_0x47f9('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2d20d2[_0x47f9('0x1f')]?_0x2d20d2[_0x47f9('0x1f')][_0x47f9('0x20')]||null:null,'attributes':_0x2d20d2[_0x47f9('0x1f')]?_0x2d20d2[_0x47f9('0x1f')][_0x47f9('0x21')]||null:null,'limit':_0x2d20d2[_0x47f9('0x1f')]?_0x2d20d2[_0x47f9('0x1f')]['limit']||null:null,'include':_0x2d20d2[_0x47f9('0x1f')]?_0x2d20d2[_0x47f9('0x1f')]['include']?_['map'](_0x2d20d2[_0x47f9('0x1f')]['include'],function(_0x76077d){return{'model':db[_0x76077d['model']],'as':_0x76077d['as'],'attributes':_0x76077d[_0x47f9('0x21')],'include':_0x76077d[_0x47f9('0x22')]?_['map'](_0x76077d[_0x47f9('0x22')],function(_0x3991ee){return{'model':db[_0x3991ee[_0x47f9('0x23')]],'as':_0x3991ee['as'],'attributes':_0x3991ee[_0x47f9('0x21')],'include':_0x3991ee[_0x47f9('0x22')]?_[_0x47f9('0x24')](_0x3991ee[_0x47f9('0x22')],function(_0x52927a){return{'model':db[_0x52927a['model']],'as':_0x52927a['as'],'attributes':_0x52927a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a5b58){logger['info'](_0x47f9('0x1d'),_0x2d20d2);logger[_0x47f9('0x25')](_0x47f9('0x1d'),_0x2d20d2,JSON[_0x47f9('0x26')](_0x1a5b58));_0x34fba6(_0x1a5b58);})[_0x47f9('0x1c')](function(_0x40bf15){logger['error']('GetVoiceExtension',_0x40bf15[_0x47f9('0x19')],_0x2d20d2);_0x328d14(_0x85bafd[_0x47f9('0x17')](0x1f4,_0x40bf15['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c0f3e5f..b6fad09 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x86fd6a,_0x472f0f){var _0x2a100a=function(_0x535651){while(--_0x535651){_0x86fd6a['push'](_0x86fd6a['shift']());}};_0x2a100a(++_0x472f0f);}(_0x1261,0x144));var _0x1126=function(_0x1b1948,_0x49f451){_0x1b1948=_0x1b1948-0x0;var _0x3cbd38=_0x1261[_0x1b1948];return _0x3cbd38;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x5a23dd,_0x218c2a){var _0x38e1a4=function(_0x3453fe){while(--_0x3453fe){_0x5a23dd['push'](_0x5a23dd['shift']());}};_0x38e1a4(++_0x218c2a);}(_0xabce,0x103));var _0xeabc=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xabce[_0x494d1f];return _0x457b6e;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f297c70..f696c32 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 _0x0adf=['put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','post','create'];(function(_0x245e2d,_0x1515a6){var _0x2d1b6f=function(_0xd5b890){while(--_0xd5b890){_0x245e2d['push'](_0x245e2d['shift']());}};_0x2d1b6f(++_0x1515a6);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x4357f2,_0x4d6e18){_0x4357f2=_0x4357f2-0x0;var _0x52e4b1=_0x0adf[_0x4357f2];return _0x52e4b1;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xb')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['getMessages']);router[_0xf0ad('0xf')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x12')]);router['delete']('/:id',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x13')]);module[_0xf0ad('0x14')]=router; \ No newline at end of file +var _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x0424,0x159));var _0x4042=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x0424[_0x264b9b];return _0x4c7a0e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['show']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['post']('/',auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);router[_0x4042('0xf')](_0x4042('0x9'),auth['isAuthenticated'](),controller[_0x4042('0x10')]);module[_0x4042('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ee77b92..dec9cad 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 _0xeef4=['sequelize','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xeef4,0xe1));var _0x4eef=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0xeef4[_0x186d17];return _0x5d4b89;};'use strict';var Sequelize=require(_0x4eef('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x4eef('0x1')]},'context':{'type':Sequelize[_0x4eef('0x1')],'defaultValue':'from-voicemail','unique':_0x4eef('0x2')},'mailbox':{'type':Sequelize[_0x4eef('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x4eef('0x1')]},'fullname':{'type':Sequelize[_0x4eef('0x1')]},'email':{'type':Sequelize[_0x4eef('0x1')],'validate':{'isEmail':!![]},'set':function(_0x32ccab){this[_0x4eef('0x3')](_0x4eef('0x4'),typeof _0x32ccab===_0x4eef('0x5')&&_0x32ccab[_0x4eef('0x6')]()?_0x32ccab['trim']():null);}},'pager':{'type':Sequelize[_0x4eef('0x1')]},'tz':{'type':Sequelize[_0x4eef('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4eef('0x7')](_0x4eef('0x8'),'no'),'defaultValue':_0x4eef('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4eef('0x7')]('yes','no'),'defaultValue':_0x4eef('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4eef('0x1')]},'callback':{'type':Sequelize[_0x4eef('0x1')]},'review':{'type':Sequelize[_0x4eef('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4eef('0x7')](_0x4eef('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4eef('0x7')](_0x4eef('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4eef('0x7')](_0x4eef('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4eef('0x7')](_0x4eef('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4eef('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x4eef('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4eef('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x4eef('0x8'),'no'),'defaultValue':_0x4eef('0x8'),'allowNull':![]},'stamp':{'type':_0x4eef('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4eef('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4eef('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4eef('0xb')],'get':function(){return this[_0x4eef('0xc')]('fullname')+_0x4eef('0xd')+this[_0x4eef('0xc')](_0x4eef('0xe'));}}}; \ No newline at end of file +var _0x2e34=['setDataValue','string','trim','central','ENUM','yes','INTEGER','VIRTUAL','getDataValue','\x20-\x20','sequelize','exports','STRING','contest_mailbox'];(function(_0x2bb13d,_0x4e4ee7){var _0xe0b61a=function(_0x475003){while(--_0x475003){_0x2bb13d['push'](_0x2bb13d['shift']());}};_0xe0b61a(++_0x4e4ee7);}(_0x2e34,0x122));var _0x42e3=function(_0x761999,_0x360f06){_0x761999=_0x761999-0x0;var _0x219be2=_0x2e34[_0x761999];return _0x219be2;};'use strict';var Sequelize=require(_0x42e3('0x0'));module[_0x42e3('0x1')]={'customer_id':{'type':Sequelize[_0x42e3('0x2')]},'context':{'type':Sequelize[_0x42e3('0x2')],'defaultValue':'from-voicemail','unique':_0x42e3('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x42e3('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x42e3('0x2')]},'email':{'type':Sequelize[_0x42e3('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2949f8){this[_0x42e3('0x4')]('email',typeof _0x2949f8===_0x42e3('0x5')&&_0x2949f8[_0x42e3('0x6')]()?_0x2949f8[_0x42e3('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x42e3('0x7')},'attach':{'type':Sequelize[_0x42e3('0x8')]('yes','no'),'defaultValue':_0x42e3('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x42e3('0x8')]('yes','no'),'defaultValue':_0x42e3('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x42e3('0x2')]},'callback':{'type':Sequelize[_0x42e3('0x2')]},'review':{'type':Sequelize[_0x42e3('0x8')](_0x42e3('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x42e3('0x8')](_0x42e3('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x42e3('0x8')](_0x42e3('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x42e3('0x8')](_0x42e3('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x42e3('0x8')](_0x42e3('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x42e3('0x9'),'no'),'defaultValue':_0x42e3('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x42e3('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x42e3('0x8')](_0x42e3('0x9'),'no'),'defaultValue':_0x42e3('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x42e3('0x2')]},'maxsecs':{'type':Sequelize[_0x42e3('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x42e3('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x42e3('0xb')],'get':function(){return this[_0x42e3('0xc')]('fullname')+_0x42e3('0xd')+this[_0x42e3('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 72f8b87..6ec9998 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 _0x4e81=['merge','VIRTUAL','filter','options','rows','catch','show','params','length','includeAll','include','find','create','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','findOne','VoiceMailMessage','hasOwnProperty','pick','findAndCountAll','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Voicemails','UserProfileResource','end','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where'];(function(_0x17542e,_0x497c31){var _0x28c798=function(_0x18baa5){while(--_0x18baa5){_0x17542e['push'](_0x17542e['shift']());}};_0x28c798(++_0x497c31);}(_0x4e81,0x1bc));var _0x14e8=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x4e81[_0x40aaa4];return _0x4e21e5;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37eccb,_0x59c6c9){_0x59c6c9=_0x59c6c9||0xcc;return function(_0x2607ef){if(_0x2607ef){return _0x37eccb[_0x14e8('0x19')](_0x59c6c9);}return _0x37eccb[_0x14e8('0x1a')](_0x59c6c9)['end']();};}function respondWithResult(_0x22fa86,_0x4e1064){_0x4e1064=_0x4e1064||0xc8;return function(_0x458e4a){if(_0x458e4a){return _0x22fa86['status'](_0x4e1064)[_0x14e8('0x1b')](_0x458e4a);}};}function respondWithFilteredResult(_0x3761a1,_0xc6101f){return function(_0x135996){if(_0x135996){var _0x52e64f=typeof _0xc6101f[_0x14e8('0x1c')]===_0x14e8('0x1d')&&typeof _0xc6101f[_0x14e8('0x1e')]===_0x14e8('0x1d');var _0xd4d6b2=_0x135996[_0x14e8('0x1f')];var _0x10dc8b=_0x52e64f?0x0:_0xc6101f[_0x14e8('0x1c')];var _0x5a38c1=_0x52e64f?_0x135996[_0x14e8('0x1f')]:_0xc6101f[_0x14e8('0x1c')]+_0xc6101f[_0x14e8('0x1e')];var _0x7b10f2;if(_0x5a38c1>=_0xd4d6b2){_0x5a38c1=_0xd4d6b2;_0x7b10f2=0xc8;}else{_0x7b10f2=0xce;}_0x3761a1[_0x14e8('0x1a')](_0x7b10f2);return _0x3761a1['set'](_0x14e8('0x20'),_0x10dc8b+'-'+_0x5a38c1+'/'+_0xd4d6b2)[_0x14e8('0x1b')](_0x135996);}return null;};}function patchUpdates(_0x2abfec){return function(_0x48e30a){try{jsonpatch[_0x14e8('0x21')](_0x48e30a,_0x2abfec,!![]);}catch(_0x47f060){return BPromise[_0x14e8('0x22')](_0x47f060);}return _0x48e30a[_0x14e8('0x23')]();};}function saveUpdates(_0x3e8d5c,_0x117b00){return function(_0xcf673){if(_0xcf673){return _0xcf673['update'](_0x3e8d5c)[_0x14e8('0x24')](function(_0x5b11f9){return _0x5b11f9;});}return null;};}function removeEntity(_0x31bdd3,_0x185a0e){return function(_0x4ffc8b){if(_0x4ffc8b){return _0x4ffc8b['destroy']()['then'](function(){var _0x4a758c=_0x4ffc8b[_0x14e8('0x25')]({'plain':!![]});var _0x3eae0b=_0x14e8('0x26');return db[_0x14e8('0x27')]['destroy']({'where':{'type':_0x3eae0b,'resourceId':_0x4a758c['id']}})[_0x14e8('0x24')](function(){return _0x4ffc8b;});})[_0x14e8('0x24')](function(){_0x31bdd3[_0x14e8('0x1a')](0xcc)[_0x14e8('0x28')]();});}};}function handleEntityNotFound(_0x28035a,_0xfc0545){return function(_0x2813ae){if(!_0x2813ae){_0x28035a['sendStatus'](0x194);}return _0x2813ae;};}function handleError(_0x38d7a7,_0x151090){_0x151090=_0x151090||0x1f4;return function(_0x393ab0){logger['error'](_0x393ab0['stack']);if(_0x393ab0['name']){delete _0x393ab0[_0x14e8('0x29')];}_0x38d7a7[_0x14e8('0x1a')](_0x151090)['send'](_0x393ab0);};}exports[_0x14e8('0x2a')]=function(_0x1d71ca,_0x176e8f){var _0xa83433={},_0x5c2635={},_0x1f1259={'count':0x0,'rows':[]};var _0x260d51=_[_0x14e8('0x2b')](db[_0x14e8('0x2c')][_0x14e8('0x2d')],function(_0x54068d){return{'name':_0x54068d[_0x14e8('0x2e')],'type':_0x54068d[_0x14e8('0x2f')][_0x14e8('0x30')]};});_0x5c2635[_0x14e8('0x31')]=_['map'](_0x260d51,_0x14e8('0x29'));_0x5c2635['query']=_[_0x14e8('0x32')](_0x1d71ca[_0x14e8('0x33')]);_0x5c2635[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],_0x5c2635[_0x14e8('0x33')]);_0xa83433[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x5c2635[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x37')]));_0xa83433['attributes']=_0xa83433['attributes']['length']?_0xa83433[_0x14e8('0x36')]:_0x5c2635['model'];if(!_0x1d71ca[_0x14e8('0x33')]['hasOwnProperty'](_0x14e8('0x38'))){_0xa83433[_0x14e8('0x1e')]=qs[_0x14e8('0x1e')](_0x1d71ca[_0x14e8('0x33')]['limit']);_0xa83433[_0x14e8('0x1c')]=qs['offset'](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0xa83433[_0x14e8('0x39')]=qs[_0x14e8('0x3a')](_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3a')]);_0xa83433['where']=qs[_0x14e8('0x34')](_['pick'](_0x1d71ca[_0x14e8('0x33')],_0x5c2635[_0x14e8('0x34')]),_0x260d51);if(_0x1d71ca[_0x14e8('0x33')]['filter']){_0xa83433[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0xa83433['where'],{'$or':_[_0x14e8('0x2b')](_0x260d51,function(_0x38b874){if(_0x38b874[_0x14e8('0x2f')]!==_0x14e8('0x3d')){var _0x77e8a0={};_0x77e8a0[_0x38b874[_0x14e8('0x29')]]={'$like':'%'+_0x1d71ca[_0x14e8('0x33')][_0x14e8('0x3e')]+'%'};return _0x77e8a0;}})});}_0xa83433=_[_0x14e8('0x3c')]({},_0xa83433,_0x1d71ca[_0x14e8('0x3f')]);var _0x11f0ee={'where':_0xa83433[_0x14e8('0x3b')]};return db[_0x14e8('0x2c')][_0x14e8('0x1f')](_0x11f0ee)[_0x14e8('0x24')](function(_0x596ac7){_0x1f1259[_0x14e8('0x1f')]=_0x596ac7;if(_0x1d71ca['query']['includeAll']){_0xa83433['include']=[{'all':!![]}];}return db[_0x14e8('0x2c')]['findAll'](_0xa83433);})[_0x14e8('0x24')](function(_0x45bff0){_0x1f1259[_0x14e8('0x40')]=_0x45bff0;return _0x1f1259;})[_0x14e8('0x24')](respondWithFilteredResult(_0x176e8f,_0xa83433))[_0x14e8('0x41')](handleError(_0x176e8f,null));};exports[_0x14e8('0x42')]=function(_0x125af5,_0xd52530){var _0x2ccd6c={'raw':!![],'where':{'id':_0x125af5[_0x14e8('0x43')]['id']}},_0x3f9da0={};_0x3f9da0['model']=_[_0x14e8('0x32')](db[_0x14e8('0x2c')][_0x14e8('0x2d')]);_0x3f9da0[_0x14e8('0x33')]=_['keys'](_0x125af5[_0x14e8('0x33')]);_0x3f9da0[_0x14e8('0x34')]=_['intersection'](_0x3f9da0['model'],_0x3f9da0[_0x14e8('0x33')]);_0x2ccd6c['attributes']=_['intersection'](_0x3f9da0[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x125af5['query'][_0x14e8('0x37')]));_0x2ccd6c[_0x14e8('0x36')]=_0x2ccd6c['attributes'][_0x14e8('0x44')]?_0x2ccd6c[_0x14e8('0x36')]:_0x3f9da0[_0x14e8('0x31')];if(_0x125af5[_0x14e8('0x33')][_0x14e8('0x45')]){_0x2ccd6c[_0x14e8('0x46')]=[{'all':!![]}];}_0x2ccd6c=_[_0x14e8('0x3c')]({},_0x2ccd6c,_0x125af5[_0x14e8('0x3f')]);return db[_0x14e8('0x2c')][_0x14e8('0x47')](_0x2ccd6c)[_0x14e8('0x24')](handleEntityNotFound(_0xd52530,null))[_0x14e8('0x24')](respondWithResult(_0xd52530,null))[_0x14e8('0x41')](handleError(_0xd52530,null));};exports[_0x14e8('0x48')]=function(_0x1bf742,_0x1f50bc){return db['VoiceMail'][_0x14e8('0x48')](_0x1bf742['body'],{})[_0x14e8('0x24')](function(_0x3fadc2){var _0x403628=_0x1bf742[_0x14e8('0x49')]['get']({'plain':!![]});if(!_0x403628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x403628['role']===_0x14e8('0x49')){var _0x49657e=_0x3fadc2['get']({'plain':!![]});var _0xd2b281=_0x14e8('0x26');return db['UserProfileSection'][_0x14e8('0x47')]({'where':{'name':_0xd2b281,'userProfileId':_0x403628[_0x14e8('0x4a')]},'raw':!![]})[_0x14e8('0x24')](function(_0x416e65){if(_0x416e65&&_0x416e65['autoAssociation']===0x0){return db['UserProfileResource'][_0x14e8('0x48')]({'name':_0x49657e[_0x14e8('0x29')],'resourceId':_0x49657e['id'],'type':_0x416e65[_0x14e8('0x29')],'sectionId':_0x416e65['id']},{})[_0x14e8('0x24')](function(){return _0x3fadc2;});}else{return _0x3fadc2;}})[_0x14e8('0x41')](function(_0x2fbac7){logger['error'](_0x14e8('0x4b'),_0x2fbac7);throw _0x2fbac7;});}return _0x3fadc2;})[_0x14e8('0x24')](respondWithResult(_0x1f50bc,0xc9))[_0x14e8('0x41')](handleError(_0x1f50bc,null));};exports[_0x14e8('0x4c')]=function(_0x5e6083,_0x2af48f){if(_0x5e6083[_0x14e8('0x4d')]['id']){delete _0x5e6083[_0x14e8('0x4d')]['id'];}return db[_0x14e8('0x2c')]['find']({'where':{'id':_0x5e6083[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x2af48f,null))[_0x14e8('0x24')](saveUpdates(_0x5e6083[_0x14e8('0x4d')],null))[_0x14e8('0x24')](respondWithResult(_0x2af48f,null))[_0x14e8('0x41')](handleError(_0x2af48f,null));};exports[_0x14e8('0x4e')]=function(_0x168b8a,_0x5ab659){return db['VoiceMail'][_0x14e8('0x47')]({'where':{'id':_0x168b8a[_0x14e8('0x43')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x5ab659,null))[_0x14e8('0x24')](removeEntity(_0x5ab659,null))[_0x14e8('0x41')](handleError(_0x5ab659,null));};exports['getMessages']=function(_0x4a631a,_0x4c49e5,_0xf8a05d){return db[_0x14e8('0x2c')][_0x14e8('0x4f')]({'where':{'id':_0x4a631a['params']['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x4c49e5,null))[_0x14e8('0x24')](function(_0x1d6683){var _0x54e164;var _0x274837={},_0x63b342={};_0x63b342[_0x14e8('0x31')]=_[_0x14e8('0x32')](db[_0x14e8('0x50')][_0x14e8('0x2d')]);_0x63b342[_0x14e8('0x33')]=_[_0x14e8('0x32')](_0x4a631a[_0x14e8('0x33')]);_0x63b342[_0x14e8('0x34')]=_[_0x14e8('0x35')](_0x63b342['model'],_0x63b342[_0x14e8('0x33')]);_0x274837[_0x14e8('0x36')]=_[_0x14e8('0x35')](_0x63b342[_0x14e8('0x31')],qs[_0x14e8('0x37')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x37')]));_0x274837[_0x14e8('0x36')]=_0x274837[_0x14e8('0x36')][_0x14e8('0x44')]?_0x274837[_0x14e8('0x36')]:_0x63b342[_0x14e8('0x31')];if(!_0x4a631a['query'][_0x14e8('0x51')](_0x14e8('0x38'))){_0x274837['limit']=qs[_0x14e8('0x1e')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1e')]);_0x274837[_0x14e8('0x1c')]=qs[_0x14e8('0x1c')](_0x4a631a[_0x14e8('0x33')][_0x14e8('0x1c')]);}_0x274837['order']=qs['sort'](_0x4a631a['query'][_0x14e8('0x3a')]);_0x274837[_0x14e8('0x3b')]=qs[_0x14e8('0x34')](_[_0x14e8('0x52')](_0x4a631a[_0x14e8('0x33')],_0x63b342[_0x14e8('0x34')]));if(_0x4a631a[_0x14e8('0x33')]['filter']){_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837['where'],{'$or':_[_0x14e8('0x2b')](_0x274837[_0x14e8('0x36')],function(_0x4c3ead){var _0x58fa2e={};_0x58fa2e[_0x4c3ead]={'$like':'%'+_0x4a631a['query'][_0x14e8('0x3e')]+'%'};return _0x58fa2e;})});}_0x274837[_0x14e8('0x3b')]=_[_0x14e8('0x3c')](_0x274837[_0x14e8('0x3b')],{'mailboxuser':_0x1d6683['mailbox']});_0x274837=_[_0x14e8('0x3c')]({},_0x274837,_0x4a631a[_0x14e8('0x3f')]);return db[_0x14e8('0x50')][_0x14e8('0x53')](_0x274837)[_0x14e8('0x24')](respondWithFilteredResult(_0x4c49e5,_0x274837));})[_0x14e8('0x41')](handleError(_0x4c49e5,null));}; \ No newline at end of file +var _0x91a7=['status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','order','mailbox','options','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x35181c,_0x82694a){var _0xe14bf9=function(_0x2be9b7){while(--_0x2be9b7){_0x35181c['push'](_0x35181c['shift']());}};_0xe14bf9(++_0x82694a);}(_0x91a7,0xe7));var _0x791a=function(_0x1019dc,_0x360386){_0x1019dc=_0x1019dc-0x0;var _0x3cf2cc=_0x91a7[_0x1019dc];return _0x3cf2cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':!![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['VoiceMail'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));};exports[_0x791a('0x4e')]=function(_0x18ad89,_0xf11dea,_0x3b760c){return db[_0x791a('0x2c')][_0x791a('0x4f')]({'where':{'id':_0x18ad89['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0xf11dea,null))[_0x791a('0x22')](function(_0xc34c5b){var _0x1a4376;var _0x2d671f={},_0xe062f1={};_0xe062f1[_0x791a('0x30')]=_['keys'](db[_0x791a('0x50')]['rawAttributes']);_0xe062f1['query']=_[_0x791a('0x31')](_0x18ad89[_0x791a('0x32')]);_0xe062f1[_0x791a('0x33')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],_0xe062f1[_0x791a('0x32')]);_0x2d671f[_0x791a('0x35')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],qs[_0x791a('0x36')](_0x18ad89[_0x791a('0x32')][_0x791a('0x36')]));_0x2d671f[_0x791a('0x35')]=_0x2d671f[_0x791a('0x35')][_0x791a('0x37')]?_0x2d671f[_0x791a('0x35')]:_0xe062f1[_0x791a('0x30')];if(!_0x18ad89[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x2d671f['limit']=qs[_0x791a('0x3a')](_0x18ad89[_0x791a('0x32')][_0x791a('0x3a')]);_0x2d671f[_0x791a('0x1a')]=qs[_0x791a('0x1a')](_0x18ad89['query'][_0x791a('0x1a')]);}_0x2d671f[_0x791a('0x51')]=qs[_0x791a('0x3b')](_0x18ad89[_0x791a('0x32')]['sort']);_0x2d671f[_0x791a('0x3c')]=qs['filters'](_['pick'](_0x18ad89['query'],_0xe062f1['filters']));if(_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]){_0x2d671f[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x2d671f[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0x2d671f[_0x791a('0x35')],function(_0x5dca78){var _0x522cb8={};_0x522cb8[_0x5dca78]={'$like':'%'+_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]+'%'};return _0x522cb8;})});}_0x2d671f['where']=_['merge'](_0x2d671f[_0x791a('0x3c')],{'mailboxuser':_0xc34c5b[_0x791a('0x52')]});_0x2d671f=_['merge']({},_0x2d671f,_0x18ad89[_0x791a('0x53')]);return db[_0x791a('0x50')][_0x791a('0x54')](_0x2d671f)[_0x791a('0x22')](respondWithFilteredResult(_0xf11dea,_0x2d671f));})['catch'](handleError(_0xf11dea,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index df21442..0640f66 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 _0x48dc=['bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','api','moment'];(function(_0x45b0e8,_0x212b00){var _0x4c9ab2=function(_0x4b2266){while(--_0x4b2266){_0x45b0e8['push'](_0x45b0e8['shift']());}};_0x4c9ab2(++_0x212b00);}(_0x48dc,0x102));var _0xc48d=function(_0x2fe5b9,_0x127e48){_0x2fe5b9=_0x2fe5b9-0x0;var _0x6f874=_0x48dc[_0x2fe5b9];return _0x6f874;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc48d('0x0'));var moment=require(_0xc48d('0x1'));var BPromise=require(_0xc48d('0x2'));var rp=require(_0xc48d('0x3'));var fs=require('fs');var path=require(_0xc48d('0x4'));var rimraf=require(_0xc48d('0x5'));var config=require('../../config/environment');var attributes=require(_0xc48d('0x6'));module[_0xc48d('0x7')]=function(_0x2c101c,_0x43fbdb){return _0x2c101c[_0xc48d('0x8')](_0xc48d('0x9'),attributes,{'tableName':_0xc48d('0xa'),'paranoid':![],'indexes':[{'name':_0xc48d('0xb'),'fields':[_0xc48d('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0505=['mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail'];(function(_0x10e8aa,_0x3c0012){var _0x121dc4=function(_0x21b498){while(--_0x21b498){_0x10e8aa['push'](_0x10e8aa['shift']());}};_0x121dc4(++_0x3c0012);}(_0x0505,0xe3));var _0x5050=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x0505[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x5050('0x0'));var util=require(_0x5050('0x1'));var logger=require(_0x5050('0x2'))('api');var moment=require(_0x5050('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5050('0x4'));var rimraf=require(_0x5050('0x5'));var config=require(_0x5050('0x6'));var attributes=require(_0x5050('0x7'));module[_0x5050('0x8')]=function(_0x510252,_0x10de09){return _0x510252[_0x5050('0x9')](_0x5050('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x5050('0xb'),'fields':[_0x5050('0xc'),_0x5050('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 630cbd4..0da1f18 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 _0xad45=['rpc','../../config/environment','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1d006c,_0xa607ff){var _0x49cbe1=function(_0x5b4202){while(--_0x5b4202){_0x1d006c['push'](_0x1d006c['shift']());}};_0x49cbe1(++_0xa607ff);}(_0xad45,0x1c7));var _0x5ad4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad45[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5ad4('0x0'));var util=require('util');var moment=require(_0x5ad4('0x1'));var BPromise=require(_0x5ad4('0x2'));var rs=require(_0x5ad4('0x3'));var fs=require('fs');var Redis=require(_0x5ad4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ad4('0x5'));var logger=require(_0x5ad4('0x6'))(_0x5ad4('0x7'));var config=require(_0x5ad4('0x8'));var jayson=require(_0x5ad4('0x9'));var client=jayson[_0x5ad4('0xa')][_0x5ad4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21af15,_0x553ef1,_0x51fbcc){return new BPromise(function(_0x40e0e2,_0x3cffe3){return client[_0x5ad4('0xc')](_0x21af15,_0x51fbcc)['then'](function(_0x27bd58){logger['info'](_0x5ad4('0xd'),_0x553ef1,_0x5ad4('0xe'));logger[_0x5ad4('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x553ef1,_0x5ad4('0xe'),JSON[_0x5ad4('0x10')](_0x27bd58));if(_0x27bd58[_0x5ad4('0x11')]){if(_0x27bd58[_0x5ad4('0x11')][_0x5ad4('0x12')]===0x1f4){logger[_0x5ad4('0x11')](_0x5ad4('0xd'),_0x553ef1,_0x27bd58[_0x5ad4('0x11')]['message']);return _0x3cffe3(_0x27bd58[_0x5ad4('0x11')][_0x5ad4('0x13')]);}logger[_0x5ad4('0x11')](_0x5ad4('0xd'),_0x553ef1,_0x27bd58['error'][_0x5ad4('0x13')]);return _0x40e0e2(_0x27bd58[_0x5ad4('0x11')][_0x5ad4('0x13')]);}else{logger['info'](_0x5ad4('0xd'),_0x553ef1,_0x5ad4('0xe'));_0x40e0e2(_0x27bd58[_0x5ad4('0x14')][_0x5ad4('0x13')]);}})[_0x5ad4('0x15')](function(_0x9baa81){logger['error']('VoiceMail,\x20%s,\x20%s',_0x553ef1,_0x9baa81);_0x3cffe3(_0x9baa81);});});} \ No newline at end of file +var _0x10c9=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x430854,_0x2d4ac2){var _0x15d8cc=function(_0x41b0f5){while(--_0x41b0f5){_0x430854['push'](_0x430854['shift']());}};_0x15d8cc(++_0x2d4ac2);}(_0x10c9,0x189));var _0x910c=function(_0x5c22c9,_0x4deaa){_0x5c22c9=_0x5c22c9-0x0;var _0x126c40=_0x10c9[_0x5c22c9];return _0x126c40;};'use strict';var _=require(_0x910c('0x0'));var util=require(_0x910c('0x1'));var moment=require('moment');var BPromise=require(_0x910c('0x2'));var rs=require(_0x910c('0x3'));var fs=require('fs');var Redis=require(_0x910c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x910c('0x5'));var logger=require('../../config/logger')(_0x910c('0x6'));var config=require('../../config/environment');var jayson=require(_0x910c('0x7'));var client=jayson[_0x910c('0x8')][_0x910c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x379507,_0x1d413a,_0x252238){return new BPromise(function(_0x4a0dd9,_0x2418c8){return client[_0x910c('0xa')](_0x379507,_0x252238)[_0x910c('0xb')](function(_0x38521c){logger[_0x910c('0xc')](_0x910c('0xd'),_0x1d413a,_0x910c('0xe'));logger[_0x910c('0xf')](_0x910c('0x10'),_0x1d413a,_0x910c('0xe'),JSON[_0x910c('0x11')](_0x38521c));if(_0x38521c['error']){if(_0x38521c['error'][_0x910c('0x12')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x1d413a,_0x38521c[_0x910c('0x13')][_0x910c('0x14')]);return _0x2418c8(_0x38521c[_0x910c('0x13')]['message']);}logger[_0x910c('0x13')](_0x910c('0xd'),_0x1d413a,_0x38521c['error'][_0x910c('0x14')]);return _0x4a0dd9(_0x38521c['error'][_0x910c('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x1d413a,_0x910c('0xe'));_0x4a0dd9(_0x38521c[_0x910c('0x15')]['message']);}})[_0x910c('0x16')](function(_0x5064bd){logger[_0x910c('0x13')]('VoiceMail,\x20%s,\x20%s',_0x1d413a,_0x5064bd);_0x2418c8(_0x5064bd);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f8749a9..8cc8f71 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 _0x5d0d=['/:id','show','/:id/download','download','post','put','update','delete','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x89226b,_0x13e242){var _0x4ee4ad=function(_0x45757b){while(--_0x45757b){_0x89226b['push'](_0x89226b['shift']());}};_0x4ee4ad(++_0x13e242);}(_0x5d0d,0x194));var _0xd5d0=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x5d0d[_0x3bab09];return _0x164376;};'use strict';var multer=require(_0xd5d0('0x0'));var util=require(_0xd5d0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd5d0('0x2'));var router=express['Router']();var fs_extra=require(_0xd5d0('0x3'));var auth=require(_0xd5d0('0x4'));var interaction=require(_0xd5d0('0x5'));var config=require('../../config/environment');var controller=require(_0xd5d0('0x6'));router[_0xd5d0('0x7')]('/',auth[_0xd5d0('0x8')](),controller[_0xd5d0('0x9')]);router[_0xd5d0('0x7')](_0xd5d0('0xa'),auth[_0xd5d0('0x8')](),controller[_0xd5d0('0xb')]);router['get'](_0xd5d0('0xc'),auth[_0xd5d0('0x8')](),controller[_0xd5d0('0xd')]);router[_0xd5d0('0xe')]('/',auth[_0xd5d0('0x8')](),controller['create']);router[_0xd5d0('0xf')](_0xd5d0('0xa'),auth[_0xd5d0('0x8')](),controller[_0xd5d0('0x10')]);router[_0xd5d0('0x11')](_0xd5d0('0xa'),auth[_0xd5d0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1e4f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','/:id/download','post','put','/:id','delete','destroy','exports'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x1e4f,0xd1));var _0xf1e4=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x1e4f[_0x3d4ef1];return _0x409423;};'use strict';var multer=require('multer');var util=require(_0xf1e4('0x0'));var path=require(_0xf1e4('0x1'));var timeout=require(_0xf1e4('0x2'));var express=require(_0xf1e4('0x3'));var router=express[_0xf1e4('0x4')]();var fs_extra=require(_0xf1e4('0x5'));var auth=require(_0xf1e4('0x6'));var interaction=require(_0xf1e4('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0xf1e4('0x8')](),controller[_0xf1e4('0x9')]);router[_0xf1e4('0xa')]('/:id',auth[_0xf1e4('0x8')](),controller[_0xf1e4('0xb')]);router['get'](_0xf1e4('0xc'),auth[_0xf1e4('0x8')](),controller['download']);router[_0xf1e4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf1e4('0xe')](_0xf1e4('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf1e4('0x10')](_0xf1e4('0xf'),auth[_0xf1e4('0x8')](),controller[_0xf1e4('0x11')]);module[_0xf1e4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 43044ea..194f8f8 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 _0x1fff=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x3d49e9,_0x562c57){var _0x52230f=function(_0x245406){while(--_0x245406){_0x3d49e9['push'](_0x3d49e9['shift']());}};_0x52230f(++_0x562c57);}(_0x1fff,0xdd));var _0xf1ff=function(_0x1e588b,_0x144ee5){_0x1e588b=_0x1e588b-0x0;var _0xf3f4a3=_0x1fff[_0x1e588b];return _0xf3f4a3;};'use strict';var Sequelize=require('sequelize');module[_0xf1ff('0x0')]={'name':{'type':Sequelize[_0xf1ff('0x1')],'get':function(_0x2c97f3){return this[_0xf1ff('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf1ff('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xf1ff('0x5')](_0xf1ff('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xf1ff('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xf1ff('0x7'),'defaultValue':Sequelize[_0xf1ff('0x8')](_0xf1ff('0x9'))}}; \ No newline at end of file +var _0x1af8=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x514932,_0x4490f6){var _0x20b772=function(_0x548261){while(--_0x548261){_0x514932['push'](_0x514932['shift']());}};_0x20b772(++_0x4490f6);}(_0x1af8,0xf3));var _0x81af=function(_0x2da4fb,_0x538b35){_0x2da4fb=_0x2da4fb-0x0;var _0x2c7ee7=_0x1af8[_0x2da4fb];return _0x2c7ee7;};'use strict';var Sequelize=require(_0x81af('0x0'));module['exports']={'name':{'type':Sequelize[_0x81af('0x1')],'get':function(_0x55086b){return this[_0x81af('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x81af('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x81af('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x81af('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x81af('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x81af('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x81af('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x81af('0x5')](_0x81af('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x81af('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x81af('0x4')],'defaultValue':''},'stamp':{'type':_0x81af('0x7'),'defaultValue':Sequelize[_0x81af('0x8')](_0x81af('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c538dc2..06e838c 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 _0x0be0=['../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x28f67b,_0x4b0884){var _0xef0c94=function(_0x81620d){while(--_0x81620d){_0x28f67b['push'](_0x28f67b['shift']());}};_0xef0c94(++_0x4b0884);}(_0x0be0,0x1e7));var _0x00be=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0be0[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0x00be('0x0'));var rimraf=require(_0x00be('0x1'));var zipdir=require(_0x00be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00be('0x3'));var moment=require(_0x00be('0x4'));var BPromise=require(_0x00be('0x5'));var Mustache=require(_0x00be('0x6'));var util=require('util');var path=require(_0x00be('0x7'));var sox=require(_0x00be('0x8'));var csv=require('to-csv');var ejs=require(_0x00be('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x00be('0xa'));var crypto=require('crypto');var jsforce=require(_0x00be('0xb'));var deskjs=require(_0x00be('0xc'));var toCsv=require(_0x00be('0xd'));var querystring=require(_0x00be('0xe'));var Papa=require(_0x00be('0xf'));var Redis=require(_0x00be('0x10'));var authService=require(_0x00be('0x11'));var qs=require(_0x00be('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00be('0x13'));var logger=require(_0x00be('0x14'))(_0x00be('0x15'));var utils=require(_0x00be('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x00be('0x17'));var db=require(_0x00be('0x18'))['db'];function respondWithStatusCode(_0x3eac3b,_0x4a865d){_0x4a865d=_0x4a865d||0xcc;return function(_0x14569f){if(_0x14569f){return _0x3eac3b['sendStatus'](_0x4a865d);}return _0x3eac3b['status'](_0x4a865d)[_0x00be('0x19')]();};}function respondWithResult(_0xa3fd4e,_0x17b7d8){_0x17b7d8=_0x17b7d8||0xc8;return function(_0x2c90d2){if(_0x2c90d2){return _0xa3fd4e[_0x00be('0x1a')](_0x17b7d8)[_0x00be('0x1b')](_0x2c90d2);}};}function respondWithFilteredResult(_0x22e78b,_0x1e9244){return function(_0x4c2694){if(_0x4c2694){var _0x314c79=typeof _0x1e9244['offset']===_0x00be('0x1c')&&typeof _0x1e9244['limit']===_0x00be('0x1c');var _0x28a9fa=_0x4c2694[_0x00be('0x1d')];var _0x52ac2d=_0x314c79?0x0:_0x1e9244[_0x00be('0x1e')];var _0x32d696=_0x314c79?_0x4c2694['count']:_0x1e9244['offset']+_0x1e9244[_0x00be('0x1f')];var _0x4ece98;if(_0x32d696>=_0x28a9fa){_0x32d696=_0x28a9fa;_0x4ece98=0xc8;}else{_0x4ece98=0xce;}_0x22e78b[_0x00be('0x1a')](_0x4ece98);return _0x22e78b[_0x00be('0x20')](_0x00be('0x21'),_0x52ac2d+'-'+_0x32d696+'/'+_0x28a9fa)['json'](_0x4c2694);}return null;};}function patchUpdates(_0x34b48f){return function(_0x50768f){try{jsonpatch[_0x00be('0x22')](_0x50768f,_0x34b48f,!![]);}catch(_0x3eec6a){return BPromise[_0x00be('0x23')](_0x3eec6a);}return _0x50768f[_0x00be('0x24')]();};}function saveUpdates(_0x4abc64,_0x29c949){return function(_0x56a56c){if(_0x56a56c){return _0x56a56c[_0x00be('0x25')](_0x4abc64)[_0x00be('0x26')](function(_0x39224b){return _0x39224b;});}return null;};}function removeEntity(_0x1c3606,_0x56b2e3){return function(_0x759524){if(_0x759524){return _0x759524['destroy']()['then'](function(){_0x1c3606[_0x00be('0x1a')](0xcc)[_0x00be('0x19')]();});}};}function handleEntityNotFound(_0xf7bfed,_0x3589e9){return function(_0x3c56c7){if(!_0x3c56c7){_0xf7bfed[_0x00be('0x27')](0x194);}return _0x3c56c7;};}function handleError(_0x5b1c45,_0x5d66f2){_0x5d66f2=_0x5d66f2||0x1f4;return function(_0x465fd8){logger[_0x00be('0x28')](_0x465fd8['stack']);if(_0x465fd8['name']){delete _0x465fd8['name'];}_0x5b1c45[_0x00be('0x1a')](_0x5d66f2)[_0x00be('0x29')](_0x465fd8);};}exports[_0x00be('0x2a')]=function(_0x460a40,_0x1a9c2b){var _0x3b7946={},_0x12ec64={},_0x56cde3={'count':0x0,'rows':[]};var _0x2ed3fd=_[_0x00be('0x2b')](db[_0x00be('0x2c')][_0x00be('0x2d')],function(_0x4aace8){return{'name':_0x4aace8[_0x00be('0x2e')],'type':_0x4aace8[_0x00be('0x2f')][_0x00be('0x30')]};});_0x12ec64[_0x00be('0x31')]=_[_0x00be('0x32')](_[_0x00be('0x2b')](_0x2ed3fd,_0x00be('0x33')),[_0x00be('0x33')]);_0x12ec64[_0x00be('0x34')]=_[_0x00be('0x35')](_0x460a40['query']);_0x12ec64[_0x00be('0x36')]=_[_0x00be('0x37')](_0x12ec64[_0x00be('0x31')],_0x12ec64[_0x00be('0x34')]);_0x3b7946[_0x00be('0x38')]=_[_0x00be('0x37')](_0x12ec64[_0x00be('0x31')],qs['fields'](_0x460a40['query'][_0x00be('0x39')]));_0x3b7946[_0x00be('0x38')]=_0x3b7946[_0x00be('0x38')]['length']?_0x3b7946['attributes']:_0x12ec64['model'];if(!_0x460a40[_0x00be('0x34')][_0x00be('0x3a')]('nolimit')){_0x3b7946[_0x00be('0x1f')]=qs[_0x00be('0x1f')](_0x460a40[_0x00be('0x34')]['limit']);_0x3b7946[_0x00be('0x1e')]=qs['offset'](_0x460a40[_0x00be('0x34')][_0x00be('0x1e')]);}_0x3b7946['order']=qs['sort'](_0x460a40['query'][_0x00be('0x3b')]);_0x3b7946['where']=qs[_0x00be('0x36')](_[_0x00be('0x3c')](_0x460a40['query'],_0x12ec64[_0x00be('0x36')]),_0x2ed3fd);if(_0x460a40[_0x00be('0x34')][_0x00be('0x3d')]){_0x3b7946[_0x00be('0x3e')]=_[_0x00be('0x3f')](_0x3b7946[_0x00be('0x3e')],{'$or':_[_0x00be('0x2b')](_0x2ed3fd,function(_0x42496a){if(_0x42496a[_0x00be('0x2f')]!==_0x00be('0x40')){var _0x3c3d67={};_0x3c3d67[_0x42496a['name']]={'$like':'%'+_0x460a40[_0x00be('0x34')][_0x00be('0x3d')]+'%'};return _0x3c3d67;}})});}_0x3b7946=_[_0x00be('0x3f')]({},_0x3b7946,_0x460a40[_0x00be('0x41')]);var _0x286284={'where':_0x3b7946[_0x00be('0x3e')]};return db[_0x00be('0x2c')][_0x00be('0x1d')](_0x286284)[_0x00be('0x26')](function(_0xafa2c6){_0x56cde3[_0x00be('0x1d')]=_0xafa2c6;if(_0x460a40[_0x00be('0x34')][_0x00be('0x42')]){_0x3b7946[_0x00be('0x43')]=[{'all':!![]}];}return db[_0x00be('0x2c')]['findAll'](_0x3b7946);})[_0x00be('0x26')](function(_0x4ed88e){_0x56cde3[_0x00be('0x44')]=_0x4ed88e;return _0x56cde3;})[_0x00be('0x26')](respondWithFilteredResult(_0x1a9c2b,_0x3b7946))[_0x00be('0x45')](handleError(_0x1a9c2b,null));};exports[_0x00be('0x46')]=function(_0x42820c,_0x1b2874){var _0x4c9fb8={'raw':!![],'where':{'id':_0x42820c[_0x00be('0x47')]['id']}},_0x298bc8={};_0x298bc8[_0x00be('0x31')]=_['keys'](db[_0x00be('0x2c')][_0x00be('0x2d')]);_0x298bc8[_0x00be('0x34')]=_['keys'](_0x42820c['query']);_0x298bc8[_0x00be('0x36')]=_[_0x00be('0x37')](_0x298bc8[_0x00be('0x31')],_0x298bc8['query']);_0x4c9fb8[_0x00be('0x38')]=_[_0x00be('0x37')](_0x298bc8['model'],qs[_0x00be('0x39')](_0x42820c[_0x00be('0x34')][_0x00be('0x39')]));_0x4c9fb8[_0x00be('0x38')]=_0x4c9fb8[_0x00be('0x38')]['length']?_0x4c9fb8[_0x00be('0x38')]:_0x298bc8[_0x00be('0x31')];if(_0x42820c[_0x00be('0x34')][_0x00be('0x42')]){_0x4c9fb8['include']=[{'all':!![]}];}_0x4c9fb8=_[_0x00be('0x3f')]({},_0x4c9fb8,_0x42820c[_0x00be('0x41')]);return db['VoiceMailMessage']['find'](_0x4c9fb8)[_0x00be('0x26')](handleEntityNotFound(_0x1b2874,null))[_0x00be('0x26')](respondWithResult(_0x1b2874,null))[_0x00be('0x45')](handleError(_0x1b2874,null));};exports[_0x00be('0x48')]=function(_0x50185a,_0x3235ef){return db['VoiceMailMessage'][_0x00be('0x48')](_0x50185a[_0x00be('0x49')],{})[_0x00be('0x26')](respondWithResult(_0x3235ef,0xc9))[_0x00be('0x45')](handleError(_0x3235ef,null));};exports[_0x00be('0x25')]=function(_0x28cac2,_0x524cde){if(_0x28cac2[_0x00be('0x49')]['id']){delete _0x28cac2['body']['id'];}return db['VoiceMailMessage'][_0x00be('0x4a')]({'where':{'id':_0x28cac2[_0x00be('0x47')]['id']}})[_0x00be('0x26')](handleEntityNotFound(_0x524cde,null))[_0x00be('0x26')](saveUpdates(_0x28cac2[_0x00be('0x49')],null))['then'](respondWithResult(_0x524cde,null))[_0x00be('0x45')](handleError(_0x524cde,null));};exports[_0x00be('0x4b')]=function(_0xccf2dd,_0x40e1f1){return db[_0x00be('0x2c')][_0x00be('0x4a')]({'where':{'id':_0xccf2dd[_0x00be('0x47')]['id']}})[_0x00be('0x26')](handleEntityNotFound(_0x40e1f1,null))['then'](removeEntity(_0x40e1f1,null))[_0x00be('0x45')](handleError(_0x40e1f1,null));};exports[_0x00be('0x4c')]=function(_0x1243aa,_0x873a67,_0xf1197b){return db[_0x00be('0x2c')]['find']({'where':{'id':_0x1243aa['params']['id']},'attributes':['id','recording','msg_id']})['then'](handleEntityNotFound(_0x873a67,null))['then'](function(_0x4d49c6){if(_0x4d49c6){if(!_0x4d49c6[_0x00be('0x4d')]){throw new db[(_0x00be('0x4e'))][(_0x00be('0x4f'))](_0x00be('0x50'));}var _0x3c2eba={'Content-Type':_0x00be('0x51'),'Content-Disposition':'attachment'};if(_0x4d49c6[_0x00be('0x52')]){_0x3c2eba[_0x00be('0x53')]='attachment;\x20filename=\x22'+_0x4d49c6['msg_id']+_0x00be('0x54');}_0x873a67[_0x00be('0x20')](_0x3c2eba);return _0x873a67['send'](new Buffer(_0x4d49c6['recording']));}})['catch'](handleError(_0x873a67,null));}; \ No newline at end of file +var _0x00a3=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x327a6f,_0x139cf2){var _0x44ad99=function(_0xdf5d1a){while(--_0xdf5d1a){_0x327a6f['push'](_0x327a6f['shift']());}};_0x44ad99(++_0x139cf2);}(_0x00a3,0xa3));var _0x300a=function(_0x278fca,_0x5a2391){_0x278fca=_0x278fca-0x0;var _0x408de9=_0x00a3[_0x278fca];return _0x408de9;};'use strict';var emlformat=require(_0x300a('0x0'));var rimraf=require(_0x300a('0x1'));var zipdir=require(_0x300a('0x2'));var jsonpatch=require(_0x300a('0x3'));var rp=require(_0x300a('0x4'));var moment=require(_0x300a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x300a('0x6'));var util=require('util');var path=require(_0x300a('0x7'));var sox=require(_0x300a('0x8'));var csv=require(_0x300a('0x9'));var ejs=require(_0x300a('0xa'));var fs=require('fs');var fs_extra=require(_0x300a('0xb'));var _=require(_0x300a('0xc'));var squel=require(_0x300a('0xd'));var crypto=require(_0x300a('0xe'));var jsforce=require(_0x300a('0xf'));var deskjs=require(_0x300a('0x10'));var toCsv=require(_0x300a('0x9'));var querystring=require(_0x300a('0x11'));var Papa=require('papaparse');var Redis=require(_0x300a('0x12'));var authService=require(_0x300a('0x13'));var qs=require(_0x300a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x300a('0x15'))('api');var utils=require(_0x300a('0x16'));var config=require(_0x300a('0x17'));var licenseUtil=require(_0x300a('0x18'));var db=require(_0x300a('0x19'))['db'];function respondWithStatusCode(_0x22cbc3,_0x154d3f){_0x154d3f=_0x154d3f||0xcc;return function(_0x128256){if(_0x128256){return _0x22cbc3[_0x300a('0x1a')](_0x154d3f);}return _0x22cbc3[_0x300a('0x1b')](_0x154d3f)[_0x300a('0x1c')]();};}function respondWithResult(_0x33df66,_0x265b19){_0x265b19=_0x265b19||0xc8;return function(_0x3343e6){if(_0x3343e6){return _0x33df66[_0x300a('0x1b')](_0x265b19)[_0x300a('0x1d')](_0x3343e6);}};}function respondWithFilteredResult(_0x55245f,_0x49fb5e){return function(_0x1729c5){if(_0x1729c5){var _0x316061=typeof _0x49fb5e[_0x300a('0x1e')]===_0x300a('0x1f')&&typeof _0x49fb5e[_0x300a('0x20')]===_0x300a('0x1f');var _0xb2dd65=_0x1729c5[_0x300a('0x21')];var _0x317a62=_0x316061?0x0:_0x49fb5e[_0x300a('0x1e')];var _0x4bae87=_0x316061?_0x1729c5[_0x300a('0x21')]:_0x49fb5e[_0x300a('0x1e')]+_0x49fb5e[_0x300a('0x20')];var _0x673abe;if(_0x4bae87>=_0xb2dd65){_0x4bae87=_0xb2dd65;_0x673abe=0xc8;}else{_0x673abe=0xce;}_0x55245f[_0x300a('0x1b')](_0x673abe);return _0x55245f['set']('Content-Range',_0x317a62+'-'+_0x4bae87+'/'+_0xb2dd65)['json'](_0x1729c5);}return null;};}function patchUpdates(_0x7668a6){return function(_0x5a3a9a){try{jsonpatch[_0x300a('0x22')](_0x5a3a9a,_0x7668a6,!![]);}catch(_0x3f31a8){return BPromise[_0x300a('0x23')](_0x3f31a8);}return _0x5a3a9a[_0x300a('0x24')]();};}function saveUpdates(_0x349254,_0x23dbea){return function(_0xadefac){if(_0xadefac){return _0xadefac['update'](_0x349254)[_0x300a('0x25')](function(_0x1c1fff){return _0x1c1fff;});}return null;};}function removeEntity(_0x58355c,_0x574c50){return function(_0x37c56b){if(_0x37c56b){return _0x37c56b[_0x300a('0x26')]()[_0x300a('0x25')](function(){_0x58355c['status'](0xcc)[_0x300a('0x1c')]();});}};}function handleEntityNotFound(_0x924ece,_0x3d185c){return function(_0xa0780b){if(!_0xa0780b){_0x924ece[_0x300a('0x1a')](0x194);}return _0xa0780b;};}function handleError(_0x232daf,_0x102d7a){_0x102d7a=_0x102d7a||0x1f4;return function(_0x4f3443){logger[_0x300a('0x27')](_0x4f3443[_0x300a('0x28')]);if(_0x4f3443[_0x300a('0x29')]){delete _0x4f3443[_0x300a('0x29')];}_0x232daf['status'](_0x102d7a)[_0x300a('0x2a')](_0x4f3443);};}exports[_0x300a('0x2b')]=function(_0x25d1c3,_0x250ed8){var _0x50c5c9={},_0x3a875b={},_0x29fffe={'count':0x0,'rows':[]};var _0x5dfafb=_[_0x300a('0x2c')](db[_0x300a('0x2d')][_0x300a('0x2e')],function(_0x468aed){return{'name':_0x468aed[_0x300a('0x2f')],'type':_0x468aed[_0x300a('0x30')]['key']};});_0x3a875b[_0x300a('0x31')]=_['differenceBy'](_['map'](_0x5dfafb,_0x300a('0x29')),[_0x300a('0x29')]);_0x3a875b['query']=_[_0x300a('0x32')](_0x25d1c3[_0x300a('0x33')]);_0x3a875b[_0x300a('0x34')]=_['intersection'](_0x3a875b['model'],_0x3a875b['query']);_0x50c5c9[_0x300a('0x35')]=_[_0x300a('0x36')](_0x3a875b[_0x300a('0x31')],qs[_0x300a('0x37')](_0x25d1c3[_0x300a('0x33')]['fields']));_0x50c5c9['attributes']=_0x50c5c9['attributes'][_0x300a('0x38')]?_0x50c5c9[_0x300a('0x35')]:_0x3a875b[_0x300a('0x31')];if(!_0x25d1c3['query'][_0x300a('0x39')](_0x300a('0x3a'))){_0x50c5c9['limit']=qs[_0x300a('0x20')](_0x25d1c3[_0x300a('0x33')][_0x300a('0x20')]);_0x50c5c9[_0x300a('0x1e')]=qs[_0x300a('0x1e')](_0x25d1c3['query'][_0x300a('0x1e')]);}_0x50c5c9['order']=qs['sort'](_0x25d1c3[_0x300a('0x33')][_0x300a('0x3b')]);_0x50c5c9[_0x300a('0x3c')]=qs['filters'](_['pick'](_0x25d1c3[_0x300a('0x33')],_0x3a875b[_0x300a('0x34')]),_0x5dfafb);if(_0x25d1c3[_0x300a('0x33')][_0x300a('0x3d')]){_0x50c5c9[_0x300a('0x3c')]=_[_0x300a('0x3e')](_0x50c5c9[_0x300a('0x3c')],{'$or':_[_0x300a('0x2c')](_0x5dfafb,function(_0x2e815a){if(_0x2e815a['type']!==_0x300a('0x3f')){var _0x3385bf={};_0x3385bf[_0x2e815a['name']]={'$like':'%'+_0x25d1c3[_0x300a('0x33')][_0x300a('0x3d')]+'%'};return _0x3385bf;}})});}_0x50c5c9=_[_0x300a('0x3e')]({},_0x50c5c9,_0x25d1c3[_0x300a('0x40')]);var _0x55fb58={'where':_0x50c5c9[_0x300a('0x3c')]};return db['VoiceMailMessage'][_0x300a('0x21')](_0x55fb58)[_0x300a('0x25')](function(_0x49bf91){_0x29fffe[_0x300a('0x21')]=_0x49bf91;if(_0x25d1c3['query']['includeAll']){_0x50c5c9[_0x300a('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x300a('0x42')](_0x50c5c9);})['then'](function(_0x58022a){_0x29fffe[_0x300a('0x43')]=_0x58022a;return _0x29fffe;})['then'](respondWithFilteredResult(_0x250ed8,_0x50c5c9))[_0x300a('0x44')](handleError(_0x250ed8,null));};exports[_0x300a('0x45')]=function(_0x5a160a,_0x504702){var _0x9fb440={'raw':!![],'where':{'id':_0x5a160a['params']['id']}},_0x412db1={};_0x412db1[_0x300a('0x31')]=_[_0x300a('0x32')](db['VoiceMailMessage']['rawAttributes']);_0x412db1['query']=_[_0x300a('0x32')](_0x5a160a[_0x300a('0x33')]);_0x412db1[_0x300a('0x34')]=_[_0x300a('0x36')](_0x412db1['model'],_0x412db1['query']);_0x9fb440[_0x300a('0x35')]=_[_0x300a('0x36')](_0x412db1['model'],qs[_0x300a('0x37')](_0x5a160a['query'][_0x300a('0x37')]));_0x9fb440['attributes']=_0x9fb440['attributes']['length']?_0x9fb440['attributes']:_0x412db1[_0x300a('0x31')];if(_0x5a160a[_0x300a('0x33')][_0x300a('0x46')]){_0x9fb440[_0x300a('0x41')]=[{'all':!![]}];}_0x9fb440=_[_0x300a('0x3e')]({},_0x9fb440,_0x5a160a['options']);return db[_0x300a('0x2d')][_0x300a('0x47')](_0x9fb440)[_0x300a('0x25')](handleEntityNotFound(_0x504702,null))[_0x300a('0x25')](respondWithResult(_0x504702,null))[_0x300a('0x44')](handleError(_0x504702,null));};exports[_0x300a('0x48')]=function(_0x3b7ac4,_0x19fec9){return db['VoiceMailMessage'][_0x300a('0x48')](_0x3b7ac4[_0x300a('0x49')],{})[_0x300a('0x25')](respondWithResult(_0x19fec9,0xc9))[_0x300a('0x44')](handleError(_0x19fec9,null));};exports[_0x300a('0x4a')]=function(_0x2aa981,_0x6772c4){if(_0x2aa981[_0x300a('0x49')]['id']){delete _0x2aa981[_0x300a('0x49')]['id'];}return db[_0x300a('0x2d')][_0x300a('0x47')]({'where':{'id':_0x2aa981['params']['id']}})[_0x300a('0x25')](handleEntityNotFound(_0x6772c4,null))[_0x300a('0x25')](saveUpdates(_0x2aa981[_0x300a('0x49')],null))[_0x300a('0x25')](respondWithResult(_0x6772c4,null))[_0x300a('0x44')](handleError(_0x6772c4,null));};exports[_0x300a('0x26')]=function(_0x3400fd,_0x32bb3e){return db[_0x300a('0x2d')][_0x300a('0x47')]({'where':{'id':_0x3400fd[_0x300a('0x4b')]['id']}})[_0x300a('0x25')](handleEntityNotFound(_0x32bb3e,null))[_0x300a('0x25')](removeEntity(_0x32bb3e,null))[_0x300a('0x44')](handleError(_0x32bb3e,null));};exports[_0x300a('0x4c')]=function(_0x434853,_0x4b105e,_0x2c33e3){return db[_0x300a('0x2d')]['find']({'where':{'id':_0x434853[_0x300a('0x4b')]['id']},'attributes':['id',_0x300a('0x4d'),_0x300a('0x4e')]})[_0x300a('0x25')](handleEntityNotFound(_0x4b105e,null))[_0x300a('0x25')](function(_0x5b4397){if(_0x5b4397){if(!_0x5b4397[_0x300a('0x4d')]){throw new db[(_0x300a('0x4f'))][(_0x300a('0x50'))](_0x300a('0x51'));}var _0x390342={'Content-Type':_0x300a('0x52'),'Content-Disposition':_0x300a('0x53')};if(_0x5b4397['msg_id']){_0x390342['Content-Disposition']=_0x300a('0x54')+_0x5b4397[_0x300a('0x4e')]+'.wav\x22';}_0x4b105e[_0x300a('0x55')](_0x390342);return _0x4b105e[_0x300a('0x2a')](new Buffer(_0x5b4397[_0x300a('0x4d')]));}})[_0x300a('0x44')](handleError(_0x4b105e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 041e672..f55eeec 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 _0x2840=['util','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x1cfc39,_0x1d3913){var _0x957a28=function(_0x2be930){while(--_0x2be930){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x957a28(++_0x1d3913);}(_0x2840,0xd7));var _0x0284=function(_0x499d15,_0x5376c1){_0x499d15=_0x499d15-0x0;var _0x189291=_0x2840[_0x499d15];return _0x189291;};'use strict';var _=require(_0x0284('0x0'));var util=require(_0x0284('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0284('0x2'));var rp=require(_0x0284('0x3'));var fs=require('fs');var path=require(_0x0284('0x4'));var rimraf=require(_0x0284('0x5'));var config=require(_0x0284('0x6'));var attributes=require(_0x0284('0x7'));module['exports']=function(_0x51517d,_0x2792ed){return _0x51517d[_0x0284('0x8')](_0x0284('0x9'),attributes,{'tableName':_0x0284('0xa'),'paranoid':![],'indexes':[{'name':_0x0284('0xb'),'fields':[_0x0284('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4f52=['request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment'];(function(_0xa2e018,_0x4ffa1d){var _0x387f5b=function(_0x28f370){while(--_0x28f370){_0xa2e018['push'](_0xa2e018['shift']());}};_0x387f5b(++_0x4ffa1d);}(_0x4f52,0x14d));var _0x24f5=function(_0x38e3ab,_0x2ddd25){_0x38e3ab=_0x38e3ab-0x0;var _0x5809eb=_0x4f52[_0x38e3ab];return _0x5809eb;};'use strict';var _=require(_0x24f5('0x0'));var util=require(_0x24f5('0x1'));var logger=require(_0x24f5('0x2'))(_0x24f5('0x3'));var moment=require(_0x24f5('0x4'));var BPromise=require('bluebird');var rp=require(_0x24f5('0x5'));var fs=require('fs');var path=require(_0x24f5('0x6'));var rimraf=require('rimraf');var config=require(_0x24f5('0x7'));var attributes=require(_0x24f5('0x8'));module[_0x24f5('0x9')]=function(_0x85ea02,_0x269e99){return _0x85ea02[_0x24f5('0xa')](_0x24f5('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x24f5('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 09b79f5..6531dd3 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 _0x72a1=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x17637d,_0x25f4fc){var _0x2de382=function(_0x403b87){while(--_0x403b87){_0x17637d['push'](_0x17637d['shift']());}};_0x2de382(++_0x25f4fc);}(_0x72a1,0xe4));var _0x172a=function(_0x342d31,_0x225162){_0x342d31=_0x342d31-0x0;var _0x159adc=_0x72a1[_0x342d31];return _0x159adc;};'use strict';var _=require(_0x172a('0x0'));var util=require(_0x172a('0x1'));var moment=require(_0x172a('0x2'));var BPromise=require(_0x172a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x172a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x172a('0x5'));var logger=require(_0x172a('0x6'))(_0x172a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x172a('0x8')][_0x172a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55e9eb,_0x4ddd3b,_0x1ecf3f){return new BPromise(function(_0x295f77,_0x229301){return client[_0x172a('0xa')](_0x55e9eb,_0x1ecf3f)[_0x172a('0xb')](function(_0x24ee68){logger['info'](_0x172a('0xc'),_0x4ddd3b,'request\x20sent');logger[_0x172a('0xd')](_0x172a('0xe'),_0x4ddd3b,'request\x20sent',JSON[_0x172a('0xf')](_0x24ee68));if(_0x24ee68[_0x172a('0x10')]){if(_0x24ee68[_0x172a('0x10')][_0x172a('0x11')]===0x1f4){logger[_0x172a('0x10')](_0x172a('0xc'),_0x4ddd3b,_0x24ee68['error'][_0x172a('0x12')]);return _0x229301(_0x24ee68[_0x172a('0x10')]['message']);}logger[_0x172a('0x10')](_0x172a('0xc'),_0x4ddd3b,_0x24ee68['error'][_0x172a('0x12')]);return _0x295f77(_0x24ee68[_0x172a('0x10')][_0x172a('0x12')]);}else{logger[_0x172a('0x13')](_0x172a('0xc'),_0x4ddd3b,_0x172a('0x14'));_0x295f77(_0x24ee68[_0x172a('0x15')]['message']);}})['catch'](function(_0x1e4a2d){logger[_0x172a('0x10')](_0x172a('0xc'),_0x4ddd3b,_0x1e4a2d);_0x229301(_0x1e4a2d);});});} \ No newline at end of file +var _0x9876=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9876,0xa0));var _0x6987=function(_0x2e473b,_0x5009a1){_0x2e473b=_0x2e473b-0x0;var _0x5df407=_0x9876[_0x2e473b];return _0x5df407;};'use strict';var _=require(_0x6987('0x0'));var util=require(_0x6987('0x1'));var moment=require(_0x6987('0x2'));var BPromise=require(_0x6987('0x3'));var rs=require(_0x6987('0x4'));var fs=require('fs');var Redis=require(_0x6987('0x5'));var db=require(_0x6987('0x6'))['db'];var utils=require(_0x6987('0x7'));var logger=require(_0x6987('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6987('0x9'));var client=jayson['client'][_0x6987('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7fe1,_0x3d3a79,_0x1504d4){return new BPromise(function(_0x1b45a3,_0x4ffa42){return client[_0x6987('0xb')](_0x2b7fe1,_0x1504d4)[_0x6987('0xc')](function(_0x126534){logger[_0x6987('0xd')](_0x6987('0xe'),_0x3d3a79,_0x6987('0xf'));logger['debug'](_0x6987('0x10'),_0x3d3a79,'request\x20sent',JSON[_0x6987('0x11')](_0x126534));if(_0x126534['error']){if(_0x126534[_0x6987('0x12')][_0x6987('0x13')]===0x1f4){logger[_0x6987('0x12')](_0x6987('0xe'),_0x3d3a79,_0x126534['error']['message']);return _0x4ffa42(_0x126534[_0x6987('0x12')][_0x6987('0x14')]);}logger[_0x6987('0x12')](_0x6987('0xe'),_0x3d3a79,_0x126534[_0x6987('0x12')][_0x6987('0x14')]);return _0x1b45a3(_0x126534[_0x6987('0x12')]['message']);}else{logger[_0x6987('0xd')](_0x6987('0xe'),_0x3d3a79,_0x6987('0xf'));_0x1b45a3(_0x126534[_0x6987('0x15')][_0x6987('0x14')]);}})['catch'](function(_0x5e55f2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x3d3a79,_0x5e55f2);_0x4ffa42(_0x5e55f2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6b2f856..e89974d 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 _0xcb66=['addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post'];(function(_0x2d36a6,_0x2f8cd0){var _0x59cec0=function(_0x5a56d0){while(--_0x5a56d0){_0x2d36a6['push'](_0x2d36a6['shift']());}};_0x59cec0(++_0x2f8cd0);}(_0xcb66,0x9a));var _0x6cb6=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xcb66[_0x3cbe1c];return _0x5ee08b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6cb6('0x0')]();var fs_extra=require(_0x6cb6('0x1'));var auth=require(_0x6cb6('0x2'));var interaction=require(_0x6cb6('0x3'));var config=require(_0x6cb6('0x4'));var controller=require(_0x6cb6('0x5'));router[_0x6cb6('0x6')]('/',auth[_0x6cb6('0x7')](),controller[_0x6cb6('0x8')]);router[_0x6cb6('0x6')](_0x6cb6('0x9'),auth[_0x6cb6('0x7')](),controller[_0x6cb6('0xa')]);router[_0x6cb6('0x6')](_0x6cb6('0xb'),auth[_0x6cb6('0x7')](),controller[_0x6cb6('0xc')]);router[_0x6cb6('0xd')]('/',auth[_0x6cb6('0x7')](),controller['create']);router[_0x6cb6('0xd')](_0x6cb6('0xb'),auth[_0x6cb6('0x7')](),controller[_0x6cb6('0xe')]);router[_0x6cb6('0xf')](_0x6cb6('0x9'),auth[_0x6cb6('0x7')](),controller['update']);router[_0x6cb6('0x10')](_0x6cb6('0x9'),auth['isAuthenticated'](),controller[_0x6cb6('0x11')]);router[_0x6cb6('0x10')](_0x6cb6('0x12'),auth[_0x6cb6('0x7')](),controller[_0x6cb6('0x13')]);module[_0x6cb6('0x14')]=router; \ No newline at end of file +var _0xb5d2=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','create','/:id/sounds','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x146cd8,_0x18add3){var _0x2a3c87=function(_0x28cb0d){while(--_0x28cb0d){_0x146cd8['push'](_0x146cd8['shift']());}};_0x2a3c87(++_0x18add3);}(_0xb5d2,0xe5));var _0x2b5d=function(_0x131574,_0x1dd346){_0x131574=_0x131574-0x0;var _0x5dba1d=_0xb5d2[_0x131574];return _0x5dba1d;};'use strict';var multer=require(_0x2b5d('0x0'));var util=require(_0x2b5d('0x1'));var path=require(_0x2b5d('0x2'));var timeout=require(_0x2b5d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b5d('0x4'));var interaction=require(_0x2b5d('0x5'));var config=require(_0x2b5d('0x6'));var controller=require(_0x2b5d('0x7'));router[_0x2b5d('0x8')]('/',auth[_0x2b5d('0x9')](),controller[_0x2b5d('0xa')]);router[_0x2b5d('0x8')](_0x2b5d('0xb'),auth[_0x2b5d('0x9')](),controller[_0x2b5d('0xc')]);router['get']('/:id/sounds',auth['isAuthenticated'](),controller[_0x2b5d('0xd')]);router[_0x2b5d('0xe')]('/',auth[_0x2b5d('0x9')](),controller[_0x2b5d('0xf')]);router['post'](_0x2b5d('0x10'),auth[_0x2b5d('0x9')](),controller['addSound']);router[_0x2b5d('0x11')](_0x2b5d('0xb'),auth['isAuthenticated'](),controller[_0x2b5d('0x12')]);router[_0x2b5d('0x13')]('/:id',auth[_0x2b5d('0x9')](),controller['destroy']);router[_0x2b5d('0x13')](_0x2b5d('0x14'),auth[_0x2b5d('0x9')](),controller[_0x2b5d('0x15')]);module[_0x2b5d('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c17f3d8..a1d3c30 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 _0x37b3=['alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x37b3,0x188));var _0x337b=function(_0x330740,_0x58c0c0){_0x330740=_0x330740-0x0;var _0x1cb5f2=_0x37b3[_0x330740];return _0x1cb5f2;};'use strict';var Sequelize=require(_0x337b('0x0'));module[_0x337b('0x1')]={'name':{'type':Sequelize[_0x337b('0x2')],'allowNull':![],'unique':_0x337b('0x3')},'mode':{'type':Sequelize[_0x337b('0x4')](_0x337b('0x5'),_0x337b('0x6'),_0x337b('0x7'),_0x337b('0x8'),_0x337b('0x9'),_0x337b('0xa')),'allowNull':!![],'defaultValue':_0x337b('0x6')},'directory':{'type':Sequelize[_0x337b('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x337b('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x337b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x337b('0x2')],'allowNull':!![],'defaultValue':_0x337b('0xb')},'format':{'type':Sequelize[_0x337b('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x337b('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e0a=['sequelize','exports','STRING','name','ENUM','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x7f8d7c,_0x105a37){var _0x592d82=function(_0x548bdc){while(--_0x548bdc){_0x7f8d7c['push'](_0x7f8d7c['shift']());}};_0x592d82(++_0x105a37);}(_0x3e0a,0xdc));var _0xa3e0=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x3e0a[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xa3e0('0x0'));module[_0xa3e0('0x1')]={'name':{'type':Sequelize[_0xa3e0('0x2')],'allowNull':![],'unique':_0xa3e0('0x3')},'mode':{'type':Sequelize[_0xa3e0('0x4')]('custom',_0xa3e0('0x5'),_0xa3e0('0x6'),_0xa3e0('0x7'),'quietmp3',_0xa3e0('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xa3e0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa3e0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa3e0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa3e0('0x2')],'allowNull':!![],'defaultValue':_0xa3e0('0x9')},'format':{'type':Sequelize[_0xa3e0('0x2')],'allowNull':!![]},'stamp':{'type':_0xa3e0('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 6c15056..7920f06 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 _0xa6bb=['find','body','create','sequelize','transaction','mode','files','join','server/files/moh','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','root','format','%s.%s','extname','converted_format','symlinkSync','removeSound','id2','unlinkSync','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','MusicOnHolds','destroy','then','stack','name','send','index','VoiceMusicOnHold','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x47ad88,_0x53e221){var _0x315c8b=function(_0x1e43fd){while(--_0x1e43fd){_0x47ad88['push'](_0x47ad88['shift']());}};_0x315c8b(++_0x53e221);}(_0xa6bb,0x176));var _0xba6b=function(_0x58424a,_0x6a0dd3){_0x58424a=_0x58424a-0x0;var _0x2f4733=_0xa6bb[_0x58424a];return _0x2f4733;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba6b('0x0'));var zipdir=require(_0xba6b('0x1'));var jsonpatch=require(_0xba6b('0x2'));var rp=require(_0xba6b('0x3'));var moment=require(_0xba6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba6b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xba6b('0x6'));var csv=require(_0xba6b('0x7'));var ejs=require(_0xba6b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba6b('0x9'));var squel=require(_0xba6b('0xa'));var crypto=require('crypto');var jsforce=require(_0xba6b('0xb'));var deskjs=require(_0xba6b('0xc'));var toCsv=require(_0xba6b('0x7'));var querystring=require(_0xba6b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba6b('0xe'));var as=require(_0xba6b('0xf'));var hardwareService=require(_0xba6b('0x10'));var logger=require(_0xba6b('0x11'))(_0xba6b('0x12'));var utils=require(_0xba6b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xba6b('0x14'));var db=require(_0xba6b('0x15'))['db'];function respondWithStatusCode(_0x38ba21,_0x1c4eb6){_0x1c4eb6=_0x1c4eb6||0xcc;return function(_0x87ef9a){if(_0x87ef9a){return _0x38ba21['sendStatus'](_0x1c4eb6);}return _0x38ba21[_0xba6b('0x16')](_0x1c4eb6)[_0xba6b('0x17')]();};}function respondWithResult(_0x226394,_0x136690){_0x136690=_0x136690||0xc8;return function(_0x305bbf){if(_0x305bbf){return _0x226394['status'](_0x136690)['json'](_0x305bbf);}};}function respondWithFilteredResult(_0x167251,_0x4ee91d){return function(_0x1b4f14){if(_0x1b4f14){var _0x51e142=typeof _0x4ee91d[_0xba6b('0x18')]==='undefined'&&typeof _0x4ee91d[_0xba6b('0x19')]==='undefined';var _0x1f7dc9=_0x1b4f14[_0xba6b('0x1a')];var _0x156350=_0x51e142?0x0:_0x4ee91d[_0xba6b('0x18')];var _0x145dda=_0x51e142?_0x1b4f14[_0xba6b('0x1a')]:_0x4ee91d[_0xba6b('0x18')]+_0x4ee91d[_0xba6b('0x19')];var _0x5d7292;if(_0x145dda>=_0x1f7dc9){_0x145dda=_0x1f7dc9;_0x5d7292=0xc8;}else{_0x5d7292=0xce;}_0x167251[_0xba6b('0x16')](_0x5d7292);return _0x167251[_0xba6b('0x1b')](_0xba6b('0x1c'),_0x156350+'-'+_0x145dda+'/'+_0x1f7dc9)[_0xba6b('0x1d')](_0x1b4f14);}return null;};}function patchUpdates(_0x5534c6){return function(_0xf8104c){try{jsonpatch[_0xba6b('0x1e')](_0xf8104c,_0x5534c6,!![]);}catch(_0x4ca369){return BPromise[_0xba6b('0x1f')](_0x4ca369);}return _0xf8104c[_0xba6b('0x20')]();};}function saveUpdates(_0x541a9e,_0xf77145){return function(_0x2d408e){if(_0x2d408e){return _0x2d408e[_0xba6b('0x21')](_0x541a9e)['then'](function(_0x144d83){return _0x144d83;});}return null;};}function removeEntity(_0x248aaf,_0x44dcff){return function(_0x4c77e0){if(_0x4c77e0){return _0x4c77e0['destroy']()['then'](function(){var _0x3613ce=_0x4c77e0['get']({'plain':!![]});var _0x5cb6a5=_0xba6b('0x22');return db['UserProfileResource'][_0xba6b('0x23')]({'where':{'type':_0x5cb6a5,'resourceId':_0x3613ce['id']}})['then'](function(){return _0x4c77e0;});})[_0xba6b('0x24')](function(){_0x248aaf[_0xba6b('0x16')](0xcc)[_0xba6b('0x17')]();});}};}function handleEntityNotFound(_0x3a537b,_0x1dc735){return function(_0x48593a){if(!_0x48593a){_0x3a537b['sendStatus'](0x194);}return _0x48593a;};}function handleError(_0x1cebde,_0x4f7ce7){_0x4f7ce7=_0x4f7ce7||0x1f4;return function(_0x2c2c18){logger['error'](_0x2c2c18[_0xba6b('0x25')]);if(_0x2c2c18[_0xba6b('0x26')]){delete _0x2c2c18[_0xba6b('0x26')];}_0x1cebde[_0xba6b('0x16')](_0x4f7ce7)[_0xba6b('0x27')](_0x2c2c18);};}exports[_0xba6b('0x28')]=function(_0x1173df,_0x376a65){var _0x3d9150={},_0x2f2628={},_0x545a51={'count':0x0,'rows':[]};var _0xe0f75f=_['map'](db[_0xba6b('0x29')][_0xba6b('0x2a')],function(_0xdf1d5b){return{'name':_0xdf1d5b['fieldName'],'type':_0xdf1d5b[_0xba6b('0x2b')][_0xba6b('0x2c')]};});_0x2f2628[_0xba6b('0x2d')]=_[_0xba6b('0x2e')](_0xe0f75f,_0xba6b('0x26'));_0x2f2628[_0xba6b('0x2f')]=_[_0xba6b('0x30')](_0x1173df[_0xba6b('0x2f')]);_0x2f2628[_0xba6b('0x31')]=_[_0xba6b('0x32')](_0x2f2628[_0xba6b('0x2d')],_0x2f2628[_0xba6b('0x2f')]);_0x3d9150[_0xba6b('0x33')]=_['intersection'](_0x2f2628['model'],qs[_0xba6b('0x34')](_0x1173df[_0xba6b('0x2f')][_0xba6b('0x34')]));_0x3d9150[_0xba6b('0x33')]=_0x3d9150['attributes'][_0xba6b('0x35')]?_0x3d9150[_0xba6b('0x33')]:_0x2f2628['model'];if(!_0x1173df[_0xba6b('0x2f')][_0xba6b('0x36')](_0xba6b('0x37'))){_0x3d9150[_0xba6b('0x19')]=qs[_0xba6b('0x19')](_0x1173df['query'][_0xba6b('0x19')]);_0x3d9150[_0xba6b('0x18')]=qs[_0xba6b('0x18')](_0x1173df[_0xba6b('0x2f')][_0xba6b('0x18')]);}_0x3d9150[_0xba6b('0x38')]=qs[_0xba6b('0x39')](_0x1173df[_0xba6b('0x2f')]['sort']);delete _0x1173df[_0xba6b('0x2f')]['sort'];_0x3d9150['where']=qs[_0xba6b('0x31')](_[_0xba6b('0x3a')](_0x1173df[_0xba6b('0x2f')],_0x2f2628[_0xba6b('0x31')]),_0xe0f75f);if(_0x1173df[_0xba6b('0x2f')]['filter']){_0x3d9150[_0xba6b('0x3b')]=_[_0xba6b('0x3c')](_0x3d9150['where'],{'$or':_[_0xba6b('0x2e')](_0xe0f75f,function(_0x257d68){if(_0x257d68[_0xba6b('0x2b')]!=='VIRTUAL'){var _0x28ec18={};_0x28ec18[_0x257d68[_0xba6b('0x26')]]={'$like':'%'+_0x1173df['query'][_0xba6b('0x3d')]+'%'};return _0x28ec18;}})});}_0x3d9150=_[_0xba6b('0x3c')]({},_0x3d9150,_0x1173df[_0xba6b('0x3e')]);var _0x59bcac={'where':_0x3d9150[_0xba6b('0x3b')]};return db[_0xba6b('0x29')]['count'](_0x59bcac)[_0xba6b('0x24')](function(_0x1f8903){_0x545a51['count']=_0x1f8903;if(_0x1173df['query'][_0xba6b('0x3f')]){_0x3d9150[_0xba6b('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xba6b('0x41')](_0x3d9150);})['then'](function(_0x21db76){_0x545a51[_0xba6b('0x42')]=_0x21db76;return _0x545a51;})['then'](respondWithFilteredResult(_0x376a65,_0x3d9150))[_0xba6b('0x43')](handleError(_0x376a65,null));};exports[_0xba6b('0x44')]=function(_0x3ce3ce,_0x250cee){var _0x3fc86a={'raw':![],'where':{'id':_0x3ce3ce[_0xba6b('0x45')]['id']}},_0x294a48={};_0x294a48['model']=_[_0xba6b('0x30')](db[_0xba6b('0x29')]['rawAttributes']);_0x294a48[_0xba6b('0x2f')]=_['keys'](_0x3ce3ce[_0xba6b('0x2f')]);_0x294a48[_0xba6b('0x31')]=_[_0xba6b('0x32')](_0x294a48[_0xba6b('0x2d')],_0x294a48[_0xba6b('0x2f')]);_0x3fc86a[_0xba6b('0x33')]=_[_0xba6b('0x32')](_0x294a48[_0xba6b('0x2d')],qs['fields'](_0x3ce3ce[_0xba6b('0x2f')]['fields']));_0x3fc86a[_0xba6b('0x33')]=_0x3fc86a[_0xba6b('0x33')][_0xba6b('0x35')]?_0x3fc86a[_0xba6b('0x33')]:_0x294a48[_0xba6b('0x2d')];if(_0x3ce3ce[_0xba6b('0x2f')]['includeAll']){_0x3fc86a[_0xba6b('0x40')]=[{'all':!![]}];}_0x3fc86a=_[_0xba6b('0x3c')]({},_0x3fc86a,_0x3ce3ce[_0xba6b('0x3e')]);return db['VoiceMusicOnHold'][_0xba6b('0x46')](_0x3fc86a)[_0xba6b('0x24')](handleEntityNotFound(_0x250cee,null))['then'](respondWithResult(_0x250cee,null))[_0xba6b('0x43')](handleError(_0x250cee,null));};exports[_0xba6b('0x21')]=function(_0x345f45,_0x3f0bd7){if(_0x345f45[_0xba6b('0x47')]['id']){delete _0x345f45['body']['id'];}return db[_0xba6b('0x29')][_0xba6b('0x46')]({'where':{'id':_0x345f45[_0xba6b('0x45')]['id']}})[_0xba6b('0x24')](handleEntityNotFound(_0x3f0bd7,null))[_0xba6b('0x24')](saveUpdates(_0x345f45['body'],null))[_0xba6b('0x24')](respondWithResult(_0x3f0bd7,null))[_0xba6b('0x43')](handleError(_0x3f0bd7,null));};exports[_0xba6b('0x48')]=function(_0x785549,_0x580454,_0x1a67ab){return db[_0xba6b('0x49')][_0xba6b('0x4a')](function(_0xd38dd6){if(_0x785549[_0xba6b('0x47')][_0xba6b('0x4b')]===_0xba6b('0x4c')){_0x785549['body']['directory']=path[_0xba6b('0x4d')](config['root'],_0xba6b('0x4e'),_0x785549['body'][_0xba6b('0x26')]);}return db[_0xba6b('0x29')][_0xba6b('0x48')](_0x785549[_0xba6b('0x47')],{'transaction':_0xd38dd6})[_0xba6b('0x24')](function(_0x3d8af2){if(_0x785549['body'][_0xba6b('0x4b')]===_0xba6b('0x4c')){fs[_0xba6b('0x4f')](_0x3d8af2[_0xba6b('0x50')],parseInt(_0xba6b('0x51'),0x8));}var _0xe5f242=_0x785549[_0xba6b('0x52')][_0xba6b('0x53')]({'plain':!![]});if(!_0xe5f242)throw new Error(_0xba6b('0x54'));if(_0xe5f242[_0xba6b('0x55')]===_0xba6b('0x52')){var _0x1e8745=_0x3d8af2['get']({'plain':!![]});return db[_0xba6b('0x56')][_0xba6b('0x46')]({'where':{'name':_0xba6b('0x22'),'userProfileId':_0xe5f242['userProfileId']},'raw':!![]})['then'](function(_0x5ca8e8){if(_0x5ca8e8&&_0x5ca8e8[_0xba6b('0x57')]===0x0){return db[_0xba6b('0x58')]['create']({'name':_0x1e8745[_0xba6b('0x26')],'resourceId':_0x1e8745['id'],'type':_0x5ca8e8[_0xba6b('0x26')],'sectionId':_0x5ca8e8['id']},{})[_0xba6b('0x24')](function(){return _0x3d8af2;});}else{return _0x3d8af2;}})[_0xba6b('0x43')](function(_0x2ca64d){logger[_0xba6b('0x59')](_0xba6b('0x5a'),_0x2ca64d);});}return _0x3d8af2;});})[_0xba6b('0x24')](respondWithResult(_0x580454,0xc9))['catch'](handleError(_0x580454,null));};exports[_0xba6b('0x23')]=function(_0x40c039,_0x509987,_0x43d7ea){var _0x4a8228;return db['VoiceMusicOnHold'][_0xba6b('0x46')]({'where':{'id':_0x40c039[_0xba6b('0x45')]['id']}})[_0xba6b('0x24')](function(_0x11182b){if(_0x11182b){return db[_0xba6b('0x49')][_0xba6b('0x4a')](function(_0x895d15){return _0x11182b[_0xba6b('0x23')]({'transaction':_0x895d15,'raw':!![]})[_0xba6b('0x24')](function(_0x10db96){if(_0x10db96[_0xba6b('0x50')]){fs[_0xba6b('0x5b')](_0x10db96[_0xba6b('0x50')])['forEach'](function(_0x90b5a6){fs['unlinkSync'](path['join'](_0x10db96['directory'],_0x90b5a6));});fs[_0xba6b('0x5c')](_0x10db96['directory']);}return _0x10db96;});})['catch'](function(_0x2a149f){throw new db[(_0xba6b('0x5d'))][(_0xba6b('0x5e'))](_0x2a149f[_0xba6b('0x5f')]);});}})['then'](handleEntityNotFound(_0x509987,null))[_0xba6b('0x24')](removeEntity(_0x509987,null))[_0xba6b('0x43')](handleError(_0x509987,null));};exports[_0xba6b('0x60')]=function(_0x5e6de8,_0x5f3d19,_0xcd9690){return db['sequelize']['transaction'](function(_0x4f0c85){var _0x117394;return db['VoiceMusicOnHold'][_0xba6b('0x46')]({'where':{'id':_0x5e6de8['params']['id']}})[_0xba6b('0x24')](function(_0x2b7416){if(_0x2b7416){_0x117394=_0x2b7416;return _0x2b7416[_0xba6b('0x60')](_0x5e6de8['body']['id'],{'transaction':_0x4f0c85});}})[_0xba6b('0x24')](function(_0xb2c030){if(_0xb2c030){return db[_0xba6b('0x61')][_0xba6b('0x62')]({'where':{'id':_0x5e6de8['body']['id']},'attributes':['id',_0xba6b('0x26'),_0xba6b('0x63'),'converted_format',_0xba6b('0x64')],'raw':!![]});}})[_0xba6b('0x24')](function(_0x241231){if(_0x241231){var _0x37b558=path[_0xba6b('0x4d')](config[_0xba6b('0x65')],'server/files/sounds/converted',util[_0xba6b('0x66')](_0xba6b('0x67'),path['basename'](_0x241231[_0xba6b('0x63')],path[_0xba6b('0x68')](_0x241231[_0xba6b('0x63')])),_0x241231[_0xba6b('0x69')]));var _0x1d65ea=path[_0xba6b('0x4d')](config[_0xba6b('0x65')],_0xba6b('0x4e'),_0x117394['name'],util[_0xba6b('0x66')](_0xba6b('0x67'),_0x241231[_0xba6b('0x26')],_0x241231[_0xba6b('0x69')]));fs[_0xba6b('0x6a')](_0x37b558,_0x1d65ea);return _0x241231;}})[_0xba6b('0x43')](function(_0x65aa05){throw new db[(_0xba6b('0x5d'))][(_0xba6b('0x5e'))](_0x65aa05['message']);});})['then'](handleEntityNotFound(_0x5f3d19,null))[_0xba6b('0x24')](respondWithResult(_0x5f3d19,0xc9))[_0xba6b('0x43')](handleError(_0x5f3d19,null));};exports[_0xba6b('0x6b')]=function(_0x481c10,_0x205c16,_0x5921b5){return db[_0xba6b('0x49')][_0xba6b('0x4a')](function(_0x68d363){var _0x314e25;return db[_0xba6b('0x29')][_0xba6b('0x62')]({'where':{'id':_0x481c10[_0xba6b('0x45')]['id']}})[_0xba6b('0x24')](handleEntityNotFound(_0x205c16,null))[_0xba6b('0x24')](function(_0x25dc18){if(_0x25dc18){_0x314e25=_0x25dc18;return _0x25dc18['removeSound'](_0x481c10[_0xba6b('0x45')][_0xba6b('0x6c')]);}})[_0xba6b('0x24')](function(_0x3552b0){if(_0x3552b0){return db[_0xba6b('0x61')][_0xba6b('0x62')]({'where':{'id':_0x481c10[_0xba6b('0x45')][_0xba6b('0x6c')]},'attributes':['id',_0xba6b('0x26'),'save_name',_0xba6b('0x69'),_0xba6b('0x64')],'raw':!![]});}})[_0xba6b('0x24')](function(_0x34b2b0){if(_0x34b2b0){fs[_0xba6b('0x6d')](path[_0xba6b('0x4d')](_0x314e25[_0xba6b('0x50')],util[_0xba6b('0x66')](_0xba6b('0x67'),_0x34b2b0[_0xba6b('0x26')],_0x34b2b0['converted_format'])));return _0x34b2b0;}})[_0xba6b('0x43')](function(_0x84003c){throw new db['Sequelize'][(_0xba6b('0x5e'))](_0x84003c[_0xba6b('0x5f')]);});})[_0xba6b('0x24')](handleEntityNotFound(_0x205c16,null))['then'](respondWithStatusCode(_0x205c16,0xcc))[_0xba6b('0x43')](handleError(_0x205c16,null));};exports['getSounds']=function(_0x3685eb,_0x49c7f2,_0x2755b5){var _0x40810b={};var _0x2e8059={};var _0x48e02e;var _0x41eb49;return db[_0xba6b('0x29')][_0xba6b('0x62')]({'where':{'id':_0x3685eb[_0xba6b('0x45')]['id']}})[_0xba6b('0x24')](handleEntityNotFound(_0x49c7f2,null))[_0xba6b('0x24')](function(_0x2e4e7d){if(_0x2e4e7d){_0x48e02e=_0x2e4e7d;_0x2e8059[_0xba6b('0x2d')]=_[_0xba6b('0x30')](db[_0xba6b('0x61')]['rawAttributes']);_0x2e8059[_0xba6b('0x2f')]=_[_0xba6b('0x30')](_0x3685eb[_0xba6b('0x2f')]);_0x2e8059[_0xba6b('0x31')]=_[_0xba6b('0x32')](_0x2e8059['model'],_0x2e8059[_0xba6b('0x2f')]);_0x40810b['attributes']=_['intersection'](_0x2e8059[_0xba6b('0x2d')],qs[_0xba6b('0x34')](_0x3685eb[_0xba6b('0x2f')]['fields']));_0x40810b['attributes']=_0x40810b[_0xba6b('0x33')][_0xba6b('0x35')]?_0x40810b['attributes']:_0x2e8059[_0xba6b('0x2d')];_0x40810b[_0xba6b('0x38')]=qs[_0xba6b('0x39')](_0x3685eb[_0xba6b('0x2f')][_0xba6b('0x39')]);_0x40810b['where']=qs[_0xba6b('0x31')](_[_0xba6b('0x3a')](_0x3685eb['query'],_0x2e8059[_0xba6b('0x31')]));if(_0x3685eb[_0xba6b('0x2f')]['filter']){_0x40810b[_0xba6b('0x3b')]=_[_0xba6b('0x3c')](_0x40810b[_0xba6b('0x3b')],{'$or':_['map'](_0x40810b[_0xba6b('0x33')],function(_0x4df47c){var _0x4e8744={};_0x4e8744[_0x4df47c]={'$like':'%'+_0x3685eb['query'][_0xba6b('0x3d')]+'%'};return _0x4e8744;})});}_0x40810b=_[_0xba6b('0x3c')]({},_0x40810b,_0x3685eb[_0xba6b('0x3e')]);return _0x48e02e['getSounds'](_0x40810b);}})[_0xba6b('0x24')](function(_0x56987e){if(_0x56987e){_0x41eb49=_0x56987e[_0xba6b('0x35')];if(!_0x3685eb[_0xba6b('0x2f')][_0xba6b('0x36')](_0xba6b('0x37'))){_0x40810b['limit']=qs[_0xba6b('0x19')](_0x3685eb[_0xba6b('0x2f')][_0xba6b('0x19')]);_0x40810b[_0xba6b('0x18')]=qs[_0xba6b('0x18')](_0x3685eb[_0xba6b('0x2f')]['offset']);}return _0x48e02e[_0xba6b('0x6e')](_0x40810b);}})['then'](function(_0x1b59bb){if(_0x1b59bb){return _0x1b59bb?{'count':_0x41eb49,'rows':_0x1b59bb}:null;}})[_0xba6b('0x24')](respondWithResult(_0x49c7f2,null))[_0xba6b('0x43')](handleError(_0x49c7f2,null));}; \ No newline at end of file +var _0xbc75=['error','stack','name','send','index','map','VoiceMusicOnHold','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','merge','find','body','sequelize','transaction','directory','join','root','server/files/moh','create','mode','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','message','removeSound','id2','unlinkSync','getSounds','pick','eml-format','rimraf','zip-dir','moment','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xbc75,0x1aa));var _0x5bc7=function(_0x58c720,_0x21e5cd){_0x58c720=_0x58c720-0x0;var _0x30ca36=_0xbc75[_0x58c720];return _0x30ca36;};'use strict';var emlformat=require(_0x5bc7('0x0'));var rimraf=require(_0x5bc7('0x1'));var zipdir=require(_0x5bc7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5bc7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bc7('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5bc7('0x5'));var csv=require(_0x5bc7('0x6'));var ejs=require(_0x5bc7('0x7'));var fs=require('fs');var fs_extra=require(_0x5bc7('0x8'));var _=require(_0x5bc7('0x9'));var squel=require(_0x5bc7('0xa'));var crypto=require(_0x5bc7('0xb'));var jsforce=require(_0x5bc7('0xc'));var deskjs=require(_0x5bc7('0xd'));var toCsv=require(_0x5bc7('0x6'));var querystring=require(_0x5bc7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5bc7('0xf'));var qs=require(_0x5bc7('0x10'));var as=require(_0x5bc7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bc7('0x12'))(_0x5bc7('0x13'));var utils=require('../../config/utils');var config=require(_0x5bc7('0x14'));var licenseUtil=require(_0x5bc7('0x15'));var db=require(_0x5bc7('0x16'))['db'];function respondWithStatusCode(_0x550dce,_0x2d4cce){_0x2d4cce=_0x2d4cce||0xcc;return function(_0x37cd5b){if(_0x37cd5b){return _0x550dce[_0x5bc7('0x17')](_0x2d4cce);}return _0x550dce[_0x5bc7('0x18')](_0x2d4cce)[_0x5bc7('0x19')]();};}function respondWithResult(_0x5a47ad,_0x35f1f0){_0x35f1f0=_0x35f1f0||0xc8;return function(_0x50740e){if(_0x50740e){return _0x5a47ad[_0x5bc7('0x18')](_0x35f1f0)[_0x5bc7('0x1a')](_0x50740e);}};}function respondWithFilteredResult(_0x7ad779,_0x502bfc){return function(_0x238434){if(_0x238434){var _0x380f3c=typeof _0x502bfc[_0x5bc7('0x1b')]==='undefined'&&typeof _0x502bfc[_0x5bc7('0x1c')]===_0x5bc7('0x1d');var _0xc23a1d=_0x238434[_0x5bc7('0x1e')];var _0x41c0e3=_0x380f3c?0x0:_0x502bfc['offset'];var _0x15330f=_0x380f3c?_0x238434['count']:_0x502bfc[_0x5bc7('0x1b')]+_0x502bfc[_0x5bc7('0x1c')];var _0x16f29a;if(_0x15330f>=_0xc23a1d){_0x15330f=_0xc23a1d;_0x16f29a=0xc8;}else{_0x16f29a=0xce;}_0x7ad779['status'](_0x16f29a);return _0x7ad779[_0x5bc7('0x1f')](_0x5bc7('0x20'),_0x41c0e3+'-'+_0x15330f+'/'+_0xc23a1d)['json'](_0x238434);}return null;};}function patchUpdates(_0x3a6753){return function(_0x2e8975){try{jsonpatch[_0x5bc7('0x21')](_0x2e8975,_0x3a6753,!![]);}catch(_0x25b960){return BPromise[_0x5bc7('0x22')](_0x25b960);}return _0x2e8975[_0x5bc7('0x23')]();};}function saveUpdates(_0x2f6f21,_0xfecc78){return function(_0x2f9d36){if(_0x2f9d36){return _0x2f9d36[_0x5bc7('0x24')](_0x2f6f21)[_0x5bc7('0x25')](function(_0x352958){return _0x352958;});}return null;};}function removeEntity(_0x1f2b16,_0x7dba99){return function(_0x5129bf){if(_0x5129bf){return _0x5129bf[_0x5bc7('0x26')]()[_0x5bc7('0x25')](function(){var _0x1cbb14=_0x5129bf[_0x5bc7('0x27')]({'plain':!![]});var _0x1b45d9=_0x5bc7('0x28');return db[_0x5bc7('0x29')][_0x5bc7('0x26')]({'where':{'type':_0x1b45d9,'resourceId':_0x1cbb14['id']}})[_0x5bc7('0x25')](function(){return _0x5129bf;});})[_0x5bc7('0x25')](function(){_0x1f2b16[_0x5bc7('0x18')](0xcc)[_0x5bc7('0x19')]();});}};}function handleEntityNotFound(_0x28ee6e,_0x161827){return function(_0x3b123d){if(!_0x3b123d){_0x28ee6e[_0x5bc7('0x17')](0x194);}return _0x3b123d;};}function handleError(_0x283153,_0xf61869){_0xf61869=_0xf61869||0x1f4;return function(_0x19b094){logger[_0x5bc7('0x2a')](_0x19b094[_0x5bc7('0x2b')]);if(_0x19b094[_0x5bc7('0x2c')]){delete _0x19b094['name'];}_0x283153[_0x5bc7('0x18')](_0xf61869)[_0x5bc7('0x2d')](_0x19b094);};}exports[_0x5bc7('0x2e')]=function(_0x32de9b,_0x47a28b){var _0x2ff0f4={},_0x49a7c9={},_0x41ff0b={'count':0x0,'rows':[]};var _0x5cda4c=_[_0x5bc7('0x2f')](db[_0x5bc7('0x30')]['rawAttributes'],function(_0x29ed97){return{'name':_0x29ed97['fieldName'],'type':_0x29ed97[_0x5bc7('0x31')][_0x5bc7('0x32')]};});_0x49a7c9['model']=_[_0x5bc7('0x2f')](_0x5cda4c,_0x5bc7('0x2c'));_0x49a7c9[_0x5bc7('0x33')]=_['keys'](_0x32de9b[_0x5bc7('0x33')]);_0x49a7c9[_0x5bc7('0x34')]=_[_0x5bc7('0x35')](_0x49a7c9[_0x5bc7('0x36')],_0x49a7c9[_0x5bc7('0x33')]);_0x2ff0f4[_0x5bc7('0x37')]=_[_0x5bc7('0x35')](_0x49a7c9[_0x5bc7('0x36')],qs[_0x5bc7('0x38')](_0x32de9b[_0x5bc7('0x33')][_0x5bc7('0x38')]));_0x2ff0f4[_0x5bc7('0x37')]=_0x2ff0f4[_0x5bc7('0x37')][_0x5bc7('0x39')]?_0x2ff0f4[_0x5bc7('0x37')]:_0x49a7c9[_0x5bc7('0x36')];if(!_0x32de9b[_0x5bc7('0x33')][_0x5bc7('0x3a')](_0x5bc7('0x3b'))){_0x2ff0f4[_0x5bc7('0x1c')]=qs[_0x5bc7('0x1c')](_0x32de9b['query'][_0x5bc7('0x1c')]);_0x2ff0f4[_0x5bc7('0x1b')]=qs[_0x5bc7('0x1b')](_0x32de9b[_0x5bc7('0x33')][_0x5bc7('0x1b')]);}_0x2ff0f4[_0x5bc7('0x3c')]=qs[_0x5bc7('0x3d')](_0x32de9b[_0x5bc7('0x33')][_0x5bc7('0x3d')]);delete _0x32de9b[_0x5bc7('0x33')][_0x5bc7('0x3d')];_0x2ff0f4['where']=qs[_0x5bc7('0x34')](_['pick'](_0x32de9b[_0x5bc7('0x33')],_0x49a7c9[_0x5bc7('0x34')]),_0x5cda4c);if(_0x32de9b[_0x5bc7('0x33')][_0x5bc7('0x3e')]){_0x2ff0f4[_0x5bc7('0x3f')]=_['merge'](_0x2ff0f4[_0x5bc7('0x3f')],{'$or':_['map'](_0x5cda4c,function(_0x405b95){if(_0x405b95[_0x5bc7('0x31')]!==_0x5bc7('0x40')){var _0x3ed6dd={};_0x3ed6dd[_0x405b95[_0x5bc7('0x2c')]]={'$like':'%'+_0x32de9b[_0x5bc7('0x33')][_0x5bc7('0x3e')]+'%'};return _0x3ed6dd;}})});}_0x2ff0f4=_['merge']({},_0x2ff0f4,_0x32de9b[_0x5bc7('0x41')]);var _0x524a10={'where':_0x2ff0f4[_0x5bc7('0x3f')]};return db[_0x5bc7('0x30')][_0x5bc7('0x1e')](_0x524a10)[_0x5bc7('0x25')](function(_0x2c09e4){_0x41ff0b[_0x5bc7('0x1e')]=_0x2c09e4;if(_0x32de9b['query'][_0x5bc7('0x42')]){_0x2ff0f4['include']=[{'all':!![]}];}return db[_0x5bc7('0x30')][_0x5bc7('0x43')](_0x2ff0f4);})['then'](function(_0x9f5296){_0x41ff0b[_0x5bc7('0x44')]=_0x9f5296;return _0x41ff0b;})['then'](respondWithFilteredResult(_0x47a28b,_0x2ff0f4))[_0x5bc7('0x45')](handleError(_0x47a28b,null));};exports[_0x5bc7('0x46')]=function(_0x201d6c,_0x2725c0){var _0x1e2c02={'raw':![],'where':{'id':_0x201d6c[_0x5bc7('0x47')]['id']}},_0x50d2ab={};_0x50d2ab[_0x5bc7('0x36')]=_[_0x5bc7('0x48')](db[_0x5bc7('0x30')][_0x5bc7('0x49')]);_0x50d2ab[_0x5bc7('0x33')]=_['keys'](_0x201d6c[_0x5bc7('0x33')]);_0x50d2ab['filters']=_['intersection'](_0x50d2ab[_0x5bc7('0x36')],_0x50d2ab[_0x5bc7('0x33')]);_0x1e2c02[_0x5bc7('0x37')]=_['intersection'](_0x50d2ab[_0x5bc7('0x36')],qs[_0x5bc7('0x38')](_0x201d6c[_0x5bc7('0x33')][_0x5bc7('0x38')]));_0x1e2c02[_0x5bc7('0x37')]=_0x1e2c02[_0x5bc7('0x37')][_0x5bc7('0x39')]?_0x1e2c02['attributes']:_0x50d2ab[_0x5bc7('0x36')];if(_0x201d6c['query'][_0x5bc7('0x42')]){_0x1e2c02[_0x5bc7('0x4a')]=[{'all':!![]}];}_0x1e2c02=_[_0x5bc7('0x4b')]({},_0x1e2c02,_0x201d6c[_0x5bc7('0x41')]);return db['VoiceMusicOnHold'][_0x5bc7('0x4c')](_0x1e2c02)[_0x5bc7('0x25')](handleEntityNotFound(_0x2725c0,null))[_0x5bc7('0x25')](respondWithResult(_0x2725c0,null))[_0x5bc7('0x45')](handleError(_0x2725c0,null));};exports['update']=function(_0x49a683,_0x2c474a){if(_0x49a683['body']['id']){delete _0x49a683[_0x5bc7('0x4d')]['id'];}return db['VoiceMusicOnHold'][_0x5bc7('0x4c')]({'where':{'id':_0x49a683['params']['id']}})[_0x5bc7('0x25')](handleEntityNotFound(_0x2c474a,null))['then'](saveUpdates(_0x49a683[_0x5bc7('0x4d')],null))[_0x5bc7('0x25')](respondWithResult(_0x2c474a,null))[_0x5bc7('0x45')](handleError(_0x2c474a,null));};exports['create']=function(_0x2921f8,_0x446412,_0x3c914c){return db[_0x5bc7('0x4e')][_0x5bc7('0x4f')](function(_0x54cb34){if(_0x2921f8[_0x5bc7('0x4d')]['mode']==='files'){_0x2921f8[_0x5bc7('0x4d')][_0x5bc7('0x50')]=path[_0x5bc7('0x51')](config[_0x5bc7('0x52')],_0x5bc7('0x53'),_0x2921f8['body'][_0x5bc7('0x2c')]);}return db[_0x5bc7('0x30')][_0x5bc7('0x54')](_0x2921f8[_0x5bc7('0x4d')],{'transaction':_0x54cb34})[_0x5bc7('0x25')](function(_0x1bc590){if(_0x2921f8['body'][_0x5bc7('0x55')]===_0x5bc7('0x56')){fs[_0x5bc7('0x57')](_0x1bc590[_0x5bc7('0x50')],parseInt(_0x5bc7('0x58'),0x8));}var _0x3d53fd=_0x2921f8[_0x5bc7('0x59')][_0x5bc7('0x27')]({'plain':!![]});if(!_0x3d53fd)throw new Error(_0x5bc7('0x5a'));if(_0x3d53fd[_0x5bc7('0x5b')]==='user'){var _0xe59295=_0x1bc590[_0x5bc7('0x27')]({'plain':!![]});return db[_0x5bc7('0x5c')][_0x5bc7('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3d53fd[_0x5bc7('0x5d')]},'raw':!![]})[_0x5bc7('0x25')](function(_0xa7683f){if(_0xa7683f&&_0xa7683f[_0x5bc7('0x5e')]===0x0){return db[_0x5bc7('0x29')]['create']({'name':_0xe59295['name'],'resourceId':_0xe59295['id'],'type':_0xa7683f['name'],'sectionId':_0xa7683f['id']},{})['then'](function(){return _0x1bc590;});}else{return _0x1bc590;}})[_0x5bc7('0x45')](function(_0x24964e){logger['error'](_0x5bc7('0x5f'),_0x24964e);});}return _0x1bc590;});})[_0x5bc7('0x25')](respondWithResult(_0x446412,0xc9))[_0x5bc7('0x45')](handleError(_0x446412,null));};exports[_0x5bc7('0x26')]=function(_0x2f7875,_0x15a5b3,_0x1fe269){var _0x15236b;return db[_0x5bc7('0x30')]['find']({'where':{'id':_0x2f7875[_0x5bc7('0x47')]['id']}})[_0x5bc7('0x25')](function(_0x1c228a){if(_0x1c228a){return db[_0x5bc7('0x4e')][_0x5bc7('0x4f')](function(_0x3f8fa8){return _0x1c228a[_0x5bc7('0x26')]({'transaction':_0x3f8fa8,'raw':!![]})[_0x5bc7('0x25')](function(_0x436d65){if(_0x436d65[_0x5bc7('0x50')]){fs['readdirSync'](_0x436d65[_0x5bc7('0x50')])[_0x5bc7('0x60')](function(_0x449558){fs['unlinkSync'](path[_0x5bc7('0x51')](_0x436d65[_0x5bc7('0x50')],_0x449558));});fs[_0x5bc7('0x61')](_0x436d65['directory']);}return _0x436d65;});})['catch'](function(_0x102368){throw new db[(_0x5bc7('0x62'))][(_0x5bc7('0x63'))](_0x102368['message']);});}})[_0x5bc7('0x25')](handleEntityNotFound(_0x15a5b3,null))[_0x5bc7('0x25')](removeEntity(_0x15a5b3,null))[_0x5bc7('0x45')](handleError(_0x15a5b3,null));};exports[_0x5bc7('0x64')]=function(_0x4fd612,_0x4db3a7,_0x573cce){return db[_0x5bc7('0x4e')][_0x5bc7('0x4f')](function(_0x1f87ac){var _0x4a74c6;return db[_0x5bc7('0x30')][_0x5bc7('0x4c')]({'where':{'id':_0x4fd612[_0x5bc7('0x47')]['id']}})[_0x5bc7('0x25')](function(_0x17cafe){if(_0x17cafe){_0x4a74c6=_0x17cafe;return _0x17cafe[_0x5bc7('0x64')](_0x4fd612['body']['id'],{'transaction':_0x1f87ac});}})[_0x5bc7('0x25')](function(_0x363691){if(_0x363691){return db[_0x5bc7('0x65')][_0x5bc7('0x66')]({'where':{'id':_0x4fd612[_0x5bc7('0x4d')]['id']},'attributes':['id',_0x5bc7('0x2c'),_0x5bc7('0x67'),_0x5bc7('0x68'),_0x5bc7('0x69')],'raw':!![]});}})[_0x5bc7('0x25')](function(_0x117c08){if(_0x117c08){var _0x420120=path[_0x5bc7('0x51')](config[_0x5bc7('0x52')],_0x5bc7('0x6a'),util[_0x5bc7('0x6b')](_0x5bc7('0x6c'),path['basename'](_0x117c08[_0x5bc7('0x67')],path[_0x5bc7('0x6d')](_0x117c08['save_name'])),_0x117c08[_0x5bc7('0x68')]));var _0x2ac7f7=path[_0x5bc7('0x51')](config[_0x5bc7('0x52')],_0x5bc7('0x53'),_0x4a74c6['name'],util[_0x5bc7('0x6b')](_0x5bc7('0x6c'),_0x117c08[_0x5bc7('0x2c')],_0x117c08[_0x5bc7('0x68')]));fs[_0x5bc7('0x6e')](_0x420120,_0x2ac7f7);return _0x117c08;}})['catch'](function(_0x352e98){throw new db['Sequelize']['ValidationError'](_0x352e98[_0x5bc7('0x6f')]);});})['then'](handleEntityNotFound(_0x4db3a7,null))[_0x5bc7('0x25')](respondWithResult(_0x4db3a7,0xc9))[_0x5bc7('0x45')](handleError(_0x4db3a7,null));};exports[_0x5bc7('0x70')]=function(_0x31f556,_0x3e962f,_0x1c9b31){return db[_0x5bc7('0x4e')][_0x5bc7('0x4f')](function(_0x521eec){var _0x138aba;return db[_0x5bc7('0x30')]['findOne']({'where':{'id':_0x31f556['params']['id']}})[_0x5bc7('0x25')](handleEntityNotFound(_0x3e962f,null))['then'](function(_0x3179f0){if(_0x3179f0){_0x138aba=_0x3179f0;return _0x3179f0['removeSound'](_0x31f556[_0x5bc7('0x47')][_0x5bc7('0x71')]);}})[_0x5bc7('0x25')](function(_0x9637c2){if(_0x9637c2){return db['Sound'][_0x5bc7('0x66')]({'where':{'id':_0x31f556[_0x5bc7('0x47')][_0x5bc7('0x71')]},'attributes':['id',_0x5bc7('0x2c'),_0x5bc7('0x67'),_0x5bc7('0x68'),_0x5bc7('0x69')],'raw':!![]});}})[_0x5bc7('0x25')](function(_0x253615){if(_0x253615){fs[_0x5bc7('0x72')](path['join'](_0x138aba[_0x5bc7('0x50')],util[_0x5bc7('0x6b')](_0x5bc7('0x6c'),_0x253615[_0x5bc7('0x2c')],_0x253615[_0x5bc7('0x68')])));return _0x253615;}})[_0x5bc7('0x45')](function(_0x35cd41){throw new db[(_0x5bc7('0x62'))][(_0x5bc7('0x63'))](_0x35cd41['message']);});})[_0x5bc7('0x25')](handleEntityNotFound(_0x3e962f,null))[_0x5bc7('0x25')](respondWithStatusCode(_0x3e962f,0xcc))[_0x5bc7('0x45')](handleError(_0x3e962f,null));};exports[_0x5bc7('0x73')]=function(_0x517719,_0x3cd108,_0x2c1270){var _0xe52c85={};var _0x16828e={};var _0x531a98;var _0x10db19;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x517719[_0x5bc7('0x47')]['id']}})[_0x5bc7('0x25')](handleEntityNotFound(_0x3cd108,null))['then'](function(_0x891799){if(_0x891799){_0x531a98=_0x891799;_0x16828e['model']=_[_0x5bc7('0x48')](db[_0x5bc7('0x65')][_0x5bc7('0x49')]);_0x16828e[_0x5bc7('0x33')]=_[_0x5bc7('0x48')](_0x517719[_0x5bc7('0x33')]);_0x16828e[_0x5bc7('0x34')]=_[_0x5bc7('0x35')](_0x16828e['model'],_0x16828e[_0x5bc7('0x33')]);_0xe52c85[_0x5bc7('0x37')]=_[_0x5bc7('0x35')](_0x16828e[_0x5bc7('0x36')],qs[_0x5bc7('0x38')](_0x517719['query'][_0x5bc7('0x38')]));_0xe52c85['attributes']=_0xe52c85[_0x5bc7('0x37')][_0x5bc7('0x39')]?_0xe52c85[_0x5bc7('0x37')]:_0x16828e[_0x5bc7('0x36')];_0xe52c85[_0x5bc7('0x3c')]=qs[_0x5bc7('0x3d')](_0x517719['query'][_0x5bc7('0x3d')]);_0xe52c85[_0x5bc7('0x3f')]=qs[_0x5bc7('0x34')](_[_0x5bc7('0x74')](_0x517719[_0x5bc7('0x33')],_0x16828e['filters']));if(_0x517719[_0x5bc7('0x33')][_0x5bc7('0x3e')]){_0xe52c85[_0x5bc7('0x3f')]=_[_0x5bc7('0x4b')](_0xe52c85[_0x5bc7('0x3f')],{'$or':_[_0x5bc7('0x2f')](_0xe52c85[_0x5bc7('0x37')],function(_0x4cffb4){var _0x2dec2a={};_0x2dec2a[_0x4cffb4]={'$like':'%'+_0x517719[_0x5bc7('0x33')][_0x5bc7('0x3e')]+'%'};return _0x2dec2a;})});}_0xe52c85=_[_0x5bc7('0x4b')]({},_0xe52c85,_0x517719[_0x5bc7('0x41')]);return _0x531a98[_0x5bc7('0x73')](_0xe52c85);}})[_0x5bc7('0x25')](function(_0x20e99d){if(_0x20e99d){_0x10db19=_0x20e99d[_0x5bc7('0x39')];if(!_0x517719[_0x5bc7('0x33')][_0x5bc7('0x3a')](_0x5bc7('0x3b'))){_0xe52c85[_0x5bc7('0x1c')]=qs['limit'](_0x517719['query'][_0x5bc7('0x1c')]);_0xe52c85[_0x5bc7('0x1b')]=qs[_0x5bc7('0x1b')](_0x517719[_0x5bc7('0x33')]['offset']);}return _0x531a98[_0x5bc7('0x73')](_0xe52c85);}})[_0x5bc7('0x25')](function(_0x5c54e8){if(_0x5c54e8){return _0x5c54e8?{'count':_0x10db19,'rows':_0x5c54e8}:null;}})[_0x5bc7('0x25')](respondWithResult(_0x3cd108,null))[_0x5bc7('0x45')](handleError(_0x3cd108,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b9cd068..9c459e3 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 _0x7cd0=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes'];(function(_0xef5d92,_0x1ec977){var _0x2edc8b=function(_0x52ff7a){while(--_0x52ff7a){_0xef5d92['push'](_0xef5d92['shift']());}};_0x2edc8b(++_0x1ec977);}(_0x7cd0,0x10c));var _0x07cd=function(_0x216bb8,_0x103b3b){_0x216bb8=_0x216bb8-0x0;var _0x5756ad=_0x7cd0[_0x216bb8];return _0x5756ad;};'use strict';var _=require(_0x07cd('0x0'));var util=require(_0x07cd('0x1'));var logger=require('../../config/logger')(_0x07cd('0x2'));var moment=require(_0x07cd('0x3'));var BPromise=require(_0x07cd('0x4'));var rp=require(_0x07cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x07cd('0x7'));module[_0x07cd('0x8')]=function(_0x2d3f9e,_0x37b72c){return _0x2d3f9e[_0x07cd('0x9')](_0x07cd('0xa'),attributes,{'tableName':_0x07cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9535=['./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5a5050,_0x3ddfb7){var _0x307a4d=function(_0x272435){while(--_0x272435){_0x5a5050['push'](_0x5a5050['shift']());}};_0x307a4d(++_0x3ddfb7);}(_0x9535,0x17d));var _0x5953=function(_0x556871,_0x44675c){_0x556871=_0x556871-0x0;var _0x566d73=_0x9535[_0x556871];return _0x566d73;};'use strict';var _=require(_0x5953('0x0'));var util=require(_0x5953('0x1'));var logger=require(_0x5953('0x2'))(_0x5953('0x3'));var moment=require(_0x5953('0x4'));var BPromise=require(_0x5953('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5953('0x6'));var rimraf=require(_0x5953('0x7'));var config=require(_0x5953('0x8'));var attributes=require(_0x5953('0x9'));module[_0x5953('0xa')]=function(_0x29c0ee,_0x24691e){return _0x29c0ee['define'](_0x5953('0xb'),attributes,{'tableName':_0x5953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 80b8e15..db45fe7 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(_0x46bf75,_0x30fdce){var _0x594e96=function(_0x5d7f11){while(--_0x5d7f11){_0x46bf75['push'](_0x46bf75['shift']());}};_0x594e96(++_0x30fdce);}(_0x70e0,0x17b));var _0x070e=function(_0x1bec5e,_0x1637ee){_0x1bec5e=_0x1bec5e-0x0;var _0x41db67=_0x70e0[_0x1bec5e];return _0x41db67;};'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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2c4e50,_0x12b6ef){var _0x1d6d9e=function(_0x30a8dc){while(--_0x30a8dc){_0x2c4e50['push'](_0x2c4e50['shift']());}};_0x1d6d9e(++_0x12b6ef);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 72e1ac1..26b0733 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 _0x3645=['delete','removeAgents','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','update'];(function(_0x470adc,_0x10ab66){var _0x5a2d94=function(_0x36a798){while(--_0x36a798){_0x470adc['push'](_0x470adc['shift']());}};_0x5a2d94(++_0x10ab66);}(_0x3645,0x154));var _0x5364=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x3645[_0x37d3f3];return _0x185c9c;};'use strict';var multer=require('multer');var util=require(_0x5364('0x0'));var path=require(_0x5364('0x1'));var timeout=require(_0x5364('0x2'));var express=require(_0x5364('0x3'));var router=express[_0x5364('0x4')]();var fs_extra=require(_0x5364('0x5'));var auth=require(_0x5364('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5364('0x7'));var controller=require(_0x5364('0x8'));router[_0x5364('0x9')]('/',auth[_0x5364('0xa')](),controller[_0x5364('0xb')]);router[_0x5364('0x9')](_0x5364('0xc'),auth[_0x5364('0xa')](),controller[_0x5364('0xd')]);router['get'](_0x5364('0xe'),auth[_0x5364('0xa')](),controller[_0x5364('0xf')]);router[_0x5364('0x9')](_0x5364('0x10'),auth[_0x5364('0xa')](),controller[_0x5364('0x11')]);router[_0x5364('0x9')](_0x5364('0x12'),auth[_0x5364('0xa')](),controller[_0x5364('0x13')]);router[_0x5364('0x14')]('/',auth[_0x5364('0xa')](),controller['create']);router[_0x5364('0x14')](_0x5364('0x10'),auth[_0x5364('0xa')](),controller[_0x5364('0x15')]);router['post'](_0x5364('0x12'),auth['isAuthenticated'](),controller[_0x5364('0x16')]);router['put'](_0x5364('0xe'),auth[_0x5364('0xa')](),controller[_0x5364('0x17')]);router[_0x5364('0x18')](_0x5364('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x5364('0x18')](_0x5364('0x10'),auth[_0x5364('0xa')](),controller[_0x5364('0x19')]);router[_0x5364('0x18')](_0x5364('0x12'),auth[_0x5364('0xa')](),controller[_0x5364('0x1a')]);module[_0x5364('0x1b')]=router; \ No newline at end of file +var _0xe132=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe132,0x162));var _0x2e13=function(_0x39c0b9,_0x55a16e){_0x39c0b9=_0x39c0b9-0x0;var _0x5b828b=_0xe132[_0x39c0b9];return _0x5b828b;};'use strict';var multer=require(_0x2e13('0x0'));var util=require('util');var path=require(_0x2e13('0x1'));var timeout=require(_0x2e13('0x2'));var express=require(_0x2e13('0x3'));var router=express[_0x2e13('0x4')]();var fs_extra=require(_0x2e13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x9')]);router[_0x2e13('0xa')](_0x2e13('0xb'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xc')]);router[_0x2e13('0xa')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xe')]);router['get'](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x10')]);router[_0x2e13('0xa')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x12')]);router['post']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x13')]);router[_0x2e13('0x14')](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x15')]);router[_0x2e13('0x14')]('/:id/teams',auth[_0x2e13('0x8')](),controller[_0x2e13('0x16')]);router[_0x2e13('0x17')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x18')]);router[_0x2e13('0x19')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x1a')]);router[_0x2e13('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x2e13('0x1b')]);router[_0x2e13('0x19')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x1c')]);module[_0x2e13('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a507227..aa10fbb 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 _0x8cb5=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','exports'];(function(_0x2cf32f,_0x2fa7b3){var _0x2b819c=function(_0x18d071){while(--_0x18d071){_0x2cf32f['push'](_0x2cf32f['shift']());}};_0x2b819c(++_0x2fa7b3);}(_0x8cb5,0x1a3));var _0x58cb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8cb5[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x58cb('0x0')]={'name':{'type':Sequelize[_0x58cb('0x1')],'allowNull':![],'unique':_0x58cb('0x2')},'prefix':{'type':Sequelize[_0x58cb('0x3')],'get':function(_0x583c70){return _0x58cb('0x4')+this[_0x58cb('0x5')](_0x58cb('0x2'))+'-';}},'description':{'type':Sequelize[_0x58cb('0x1')]},'callerIdAll':{'type':Sequelize[_0x58cb('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x58cb('0x6')]}}; \ No newline at end of file +var _0x3c22=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','exports'];(function(_0x524b5b,_0x3ed9d3){var _0x52ea85=function(_0x800087){while(--_0x800087){_0x524b5b['push'](_0x524b5b['shift']());}};_0x52ea85(++_0x3ed9d3);}(_0x3c22,0x1c6));var _0x23c2=function(_0x4e3e5c,_0x2470c6){_0x4e3e5c=_0x4e3e5c-0x0;var _0x3ae2e8=_0x3c22[_0x4e3e5c];return _0x3ae2e8;};'use strict';var Sequelize=require('sequelize');module[_0x23c2('0x0')]={'name':{'type':Sequelize[_0x23c2('0x1')],'allowNull':![],'unique':_0x23c2('0x2')},'prefix':{'type':Sequelize[_0x23c2('0x3')],'get':function(_0x35122b){return _0x23c2('0x4')+this[_0x23c2('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x23c2('0x1')]},'callerIdAll':{'type':Sequelize[_0x23c2('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x23c2('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7dbb78e..1207caf 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 _0x1775=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','User','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x51fed5,_0x2dffcf){var _0x5115df=function(_0xce44d1){while(--_0xce44d1){_0x51fed5['push'](_0x51fed5['shift']());}};_0x5115df(++_0x2dffcf);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){var _0x231d35=_0x577bf7[_0x5177('0x31')]({'plain':!![]});var _0x58846c=_0x5177('0x32');return db[_0x5177('0x33')][_0x5177('0x30')]({'where':{'type':_0x58846c,'resourceId':_0x231d35['id']}})[_0x5177('0x34')](function(){return _0x577bf7;});})[_0x5177('0x34')](function(){_0x19a0c2[_0x5177('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498fcd,_0x45cf20){return function(_0x1c660e){if(!_0x1c660e){_0x498fcd[_0x5177('0x22')](0x194);}return _0x1c660e;};}function handleError(_0x174f7a,_0x2e1985){_0x2e1985=_0x2e1985||0x1f4;return function(_0x8134f9){logger[_0x5177('0x35')](_0x8134f9[_0x5177('0x36')]);if(_0x8134f9['name']){delete _0x8134f9[_0x5177('0x37')];}_0x174f7a[_0x5177('0x23')](_0x2e1985)['send'](_0x8134f9);};}exports[_0x5177('0x38')]=function(_0x5e4c48,_0x172b36){var _0x1a2c46={},_0x1ba51c={},_0x5e2e5a={'count':0x0,'rows':[]};var _0x4f70df=_[_0x5177('0x39')](db[_0x5177('0x3a')][_0x5177('0x3b')],function(_0x3735e9){return{'name':_0x3735e9[_0x5177('0x3c')],'type':_0x3735e9[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x1ba51c[_0x5177('0x3f')]=_['map'](_0x4f70df,_0x5177('0x37'));_0x1ba51c[_0x5177('0x40')]=_['keys'](_0x5e4c48[_0x5177('0x40')]);_0x1ba51c[_0x5177('0x41')]=_[_0x5177('0x42')](_0x1ba51c[_0x5177('0x3f')],_0x1ba51c[_0x5177('0x40')]);_0x1a2c46[_0x5177('0x43')]=_['intersection'](_0x1ba51c[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x44')]));_0x1a2c46[_0x5177('0x43')]=_0x1a2c46[_0x5177('0x43')][_0x5177('0x45')]?_0x1a2c46['attributes']:_0x1ba51c[_0x5177('0x3f')];if(!_0x5e4c48[_0x5177('0x40')]['hasOwnProperty']('nolimit')){_0x1a2c46[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x28')]);_0x1a2c46[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x26')]);}_0x1a2c46[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x47')]);_0x1a2c46[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x5e4c48[_0x5177('0x40')],_0x1ba51c['filters']),_0x4f70df);if(_0x5e4c48[_0x5177('0x40')]['filter']){_0x1a2c46[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x1a2c46[_0x5177('0x48')],{'$or':_['map'](_0x4f70df,function(_0x56eba4){if(_0x56eba4[_0x5177('0x3d')]!==_0x5177('0x4b')){var _0x1a149b={};_0x1a149b[_0x56eba4[_0x5177('0x37')]]={'$like':'%'+_0x5e4c48[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x1a149b;}})});}_0x1a2c46=_[_0x5177('0x4a')]({},_0x1a2c46,_0x5e4c48[_0x5177('0x4d')]);var _0x4e287e={'where':_0x1a2c46[_0x5177('0x48')]};return db['VoicePrefix']['count'](_0x4e287e)[_0x5177('0x34')](function(_0x17dc98){_0x5e2e5a['count']=_0x17dc98;if(_0x5e4c48[_0x5177('0x40')]['includeAll']){_0x1a2c46['include']=[{'all':!![]}];}return db[_0x5177('0x3a')][_0x5177('0x4e')](_0x1a2c46);})[_0x5177('0x34')](function(_0x3776b8){_0x5e2e5a[_0x5177('0x4f')]=_0x3776b8;return _0x5e2e5a;})[_0x5177('0x34')](respondWithFilteredResult(_0x172b36,_0x1a2c46))[_0x5177('0x50')](handleError(_0x172b36,null));};exports['show']=function(_0x5396cc,_0x12b70){var _0x511dc0={'raw':![],'where':{'id':_0x5396cc[_0x5177('0x51')]['id']}},_0x23be2a={};_0x23be2a[_0x5177('0x3f')]=_[_0x5177('0x52')](db['VoicePrefix'][_0x5177('0x3b')]);_0x23be2a[_0x5177('0x40')]=_[_0x5177('0x52')](_0x5396cc[_0x5177('0x40')]);_0x23be2a[_0x5177('0x41')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],_0x23be2a[_0x5177('0x40')]);_0x511dc0[_0x5177('0x43')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],qs['fields'](_0x5396cc[_0x5177('0x40')]['fields']));_0x511dc0['attributes']=_0x511dc0['attributes'][_0x5177('0x45')]?_0x511dc0[_0x5177('0x43')]:_0x23be2a['model'];if(_0x5396cc[_0x5177('0x40')][_0x5177('0x53')]){_0x511dc0[_0x5177('0x54')]=[{'all':!![]}];}_0x511dc0=_['merge']({},_0x511dc0,_0x5396cc[_0x5177('0x4d')]);return db['VoicePrefix']['find'](_0x511dc0)['then'](handleEntityNotFound(_0x12b70,null))[_0x5177('0x34')](respondWithResult(_0x12b70,null))[_0x5177('0x50')](handleError(_0x12b70,null));};exports[_0x5177('0x30')]=function(_0x5a1f8b,_0x4e53e4){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x5a1f8b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x34')](removeEntity(_0x4e53e4,null))[_0x5177('0x50')](handleError(_0x4e53e4,null));};exports[_0x5177('0x55')]=function(_0xa0edd7,_0x26bac0){return db[_0x5177('0x3a')][_0x5177('0x55')]()[_0x5177('0x34')](respondWithResult(_0x26bac0,null))[_0x5177('0x50')](handleError(_0x26bac0,null));};exports[_0x5177('0x56')]=function(_0x422d6c,_0x4c2068){var _0x59376b;return db[_0x5177('0x57')]['transaction'](function(_0x649c6f){return db['VoicePrefix'][_0x5177('0x56')](_0x422d6c[_0x5177('0x58')],{'transaction':_0x649c6f})[_0x5177('0x34')](function(_0x55a0b6){_0x59376b=_0x55a0b6['get']({'plain':!![]});return db[_0x5177('0x59')][_0x5177('0x5a')]({'where':{'id':_0x59376b[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x4a4758){return createVoicePrefixExtensions(_0x59376b,_0x4a4758,_0x649c6f);});});})['then'](function(){var _0x3f0e89=_0x422d6c[_0x5177('0x5c')][_0x5177('0x31')]({'plain':!![]});if(!_0x3f0e89)throw new Error(_0x5177('0x5d'));if(_0x3f0e89['role']===_0x5177('0x5c')){var _0x143aff=_0x59376b;return db[_0x5177('0x5e')]['find']({'where':{'name':_0x5177('0x32'),'userProfileId':_0x3f0e89[_0x5177('0x5f')]},'raw':!![]})[_0x5177('0x34')](function(_0x49e3e3){if(_0x49e3e3&&_0x49e3e3[_0x5177('0x60')]===0x0){return db['UserProfileResource'][_0x5177('0x56')]({'name':_0x143aff[_0x5177('0x37')],'resourceId':_0x143aff['id'],'type':_0x49e3e3[_0x5177('0x37')],'sectionId':_0x49e3e3['id']},{})['then'](function(){return _0x59376b;});}else{return _0x59376b;}})[_0x5177('0x50')](function(_0x161e03){logger[_0x5177('0x35')](_0x5177('0x61'),_0x161e03);throw _0x161e03;});}return _0x59376b;})[_0x5177('0x34')](respondWithResult(_0x4c2068,null))[_0x5177('0x50')](handleError(_0x4c2068,null));};function Extension(_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){this['context']=_0x5177('0x62');this[_0x5177('0x63')]=_0x37380c;this[_0x5177('0x64')]=_0x5ceed2;this[_0x5177('0x3d')]=_0x5177('0x65');this[_0x5177('0x66')]='Voice\x20Prefix\x20Extension';this['priority']=_0x267599;this[_0x5177('0x67')]=_0x5d96ce;}function createVoicePrefixExtensions(_0x23eb6e,_0x1f294e,_0x336017){return new BPromise(function(_0x123d40,_0x1b1778){var _0x2d1745=new Extension(formatPrefixName(_0x23eb6e[_0x5177('0x68')]),0x1,_0x5177('0x69'),'Voice\x20Prefix');_0x2d1745[_0x5177('0x6a')]=_0x23eb6e['id'];return db[_0x5177('0x59')]['create'](_0x2d1745,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4481b6){var _0x4edebc=_0x4481b6[_0x5177('0x31')]({'plain':!![]});var _0x2f3344=_[_0x5177('0x39')](addVoicePrefixExtensions(_0x23eb6e,_0x1f294e),function(_0x4be4b2){_0x4be4b2[_0x5177('0x5b')]=_0x4edebc['id'];_0x4be4b2[_0x5177('0x6a')]=_0x23eb6e['id'];return _0x4be4b2;});return db['VoiceExtension']['bulkCreate'](_0x2f3344,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4f76d7){if(!_0x4f76d7){return _0x1b1778(_0x5177('0x6b'));}else{return _0x123d40(_0x4f76d7);}})['catch'](function(_0x2771fa){return _0x1b1778(_0x2771fa);});});;});};function addVoicePrefixExtensions(_0x16f17c,_0x5a8ada){var _0x2af938=[];var _0x3b090d=formatPrefixName(_0x16f17c[_0x5177('0x68')]);_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x2,_0x5177('0x6d'),_0x5177('0x6e')+_0x16f17c[_0x5177('0x37')]));if(_0x16f17c['callerIdAll']){_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'Set','PREFIX-CALLERIDALL='+_0x16f17c[_0x5177('0x6f')]));}else{_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'NoOp',_0x5177('0x70')));}_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x4,_0x5177('0x71'),_0x5a8ada[_0x5177('0x72')]+','+_0x5177('0x73')+(0x8+_0x16f17c[_0x5177('0x37')][_0x5177('0x45')])+'}'+','+0x1));return _0x2af938;}function formatPrefixName(_0x3b26f4){var _0x478d5e='_';for(var _0x54b28f=0x0;_0x54b28f<_0x3b26f4[_0x5177('0x45')];_0x54b28f++){if(_0x3b26f4[_0x5177('0x74')](_0x54b28f)=='-'){_0x478d5e+=_0x3b26f4[_0x5177('0x74')](_0x54b28f);}else{_0x478d5e+='['+_0x3b26f4[_0x5177('0x74')](_0x54b28f)+']';}}_0x478d5e+='.';return _0x478d5e;}exports[_0x5177('0x2f')]=function(_0x3dd58f,_0x4fc289,_0x3692b2){var _0x397b75=_0x3dd58f[_0x5177('0x58')];_0x397b75[_0x5177('0x68')]='system-'+_0x397b75[_0x5177('0x37')]+'-';return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x22da9d){return db[_0x5177('0x3a')]['update'](_0x397b75,{'where':{'id':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x30')]({'where':{'VoicePrefixId':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x5a')]({'where':{'id':_0x397b75[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x44ed82){return createVoicePrefixExtensions(_0x397b75,_0x44ed82,_0x22da9d);});});});})['then'](function(){return db[_0x5177('0x3a')][_0x5177('0x76')](_0x397b75['id']);})[_0x5177('0x34')](respondWithResult(_0x4fc289,null))[_0x5177('0x50')](handleError(_0x4fc289,null));};exports['addAgents']=function(_0x16b85b,_0x17456b,_0x3502dd){return db['VoicePrefix']['find']({'where':{'id':_0x16b85b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x17456b,null))[_0x5177('0x34')](function(_0x170e25){if(_0x170e25){return _0x170e25[_0x5177('0x77')](_0x16b85b[_0x5177('0x58')][_0x5177('0x78')],_[_0x5177('0x79')](_0x16b85b[_0x5177('0x58')],['ids','id'])||{})['spread'](function(_0x597a84){for(var _0x290315=0x0;_0x290315<_0x16b85b['body'][_0x5177('0x78')][_0x5177('0x45')];_0x290315+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':Number(_0x16b85b[_0x5177('0x58')]['ids'][_0x290315]),'VoicePrefixId':Number(_0x16b85b[_0x5177('0x51')]['id'])});}return _0x597a84;});}})[_0x5177('0x34')](respondWithResult(_0x17456b,null))[_0x5177('0x50')](handleError(_0x17456b,null));};exports['removeAgents']=function(_0x3d845e,_0x484762,_0x3d95df){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x3d845e[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x484762,null))['then'](function(_0x5f0141){if(_0x5f0141){return _0x5f0141[_0x5177('0x7c')](_0x3d845e['query'][_0x5177('0x78')])[_0x5177('0x34')](function(){if(_['isArray'](_0x3d845e[_0x5177('0x40')][_0x5177('0x78')])){for(var _0xcbbb73=0x0;_0xcbbb73<_0x3d845e[_0x5177('0x40')][_0x5177('0x78')][_0x5177('0x45')];_0xcbbb73+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e['query'][_0x5177('0x78')][_0xcbbb73]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}}else{socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e[_0x5177('0x40')][_0x5177('0x78')]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}});}})[_0x5177('0x34')](respondWithStatusCode(_0x484762,null))[_0x5177('0x50')](handleError(_0x484762,null));};exports['getAgents']=function(_0x17efe1,_0x30c2dc,_0x523012){var _0x33e1a6={};var _0x5f57bc={};var _0x3f1aad;var _0x558e04;return db['VoicePrefix']['findOne']({'where':{'id':_0x17efe1[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x30c2dc,null))[_0x5177('0x34')](function(_0x516d0b){if(_0x516d0b){_0x3f1aad=_0x516d0b;_0x5f57bc[_0x5177('0x3f')]=_[_0x5177('0x52')](db[_0x5177('0x7e')][_0x5177('0x3b')]);_0x5f57bc[_0x5177('0x40')]=_['keys'](_0x17efe1[_0x5177('0x40')]);_0x5f57bc[_0x5177('0x41')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],_0x5f57bc['query']);_0x33e1a6[_0x5177('0x43')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x17efe1[_0x5177('0x40')][_0x5177('0x44')]));_0x33e1a6[_0x5177('0x43')]=_0x33e1a6[_0x5177('0x43')]['length']?_0x33e1a6['attributes']:_0x5f57bc[_0x5177('0x3f')];_0x33e1a6[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x17efe1['query'][_0x5177('0x47')]);_0x33e1a6[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x17efe1['query'],_0x5f57bc[_0x5177('0x41')]));if(_0x17efe1[_0x5177('0x40')][_0x5177('0x4c')]){_0x33e1a6['where']=_[_0x5177('0x4a')](_0x33e1a6['where'],{'$or':_[_0x5177('0x39')](_0x33e1a6[_0x5177('0x43')],function(_0x5a40f1){var _0x5a8146={};_0x5a8146[_0x5a40f1]={'$like':'%'+_0x17efe1['query'][_0x5177('0x4c')]+'%'};return _0x5a8146;})});}_0x33e1a6=_['merge']({},_0x33e1a6,_0x17efe1[_0x5177('0x4d')]);return _0x3f1aad[_0x5177('0x7f')](_0x33e1a6);}})[_0x5177('0x34')](function(_0x57adf4){if(_0x57adf4){_0x558e04=_0x57adf4['length'];if(!_0x17efe1['query'][_0x5177('0x80')](_0x5177('0x81'))){_0x33e1a6[_0x5177('0x28')]=qs['limit'](_0x17efe1[_0x5177('0x40')][_0x5177('0x28')]);_0x33e1a6['offset']=qs[_0x5177('0x26')](_0x17efe1['query'][_0x5177('0x26')]);}return _0x3f1aad['getAgents'](_0x33e1a6);}})['then'](function(_0x5910a8){if(_0x5910a8){return _0x5910a8?{'count':_0x558e04,'rows':_0x5910a8}:null;}})[_0x5177('0x34')](respondWithResult(_0x30c2dc,null))['catch'](handleError(_0x30c2dc,null));};exports[_0x5177('0x82')]=function(_0x450c61,_0x1d351b,_0x1372ad){var _0x3b4cab={};var _0x197377={};var _0x580d34;var _0x1e76cf;return db[_0x5177('0x3a')]['findOne']({'where':{'id':_0x450c61[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x1d351b,null))[_0x5177('0x34')](function(_0x51f7ce){if(_0x51f7ce){_0x580d34=_0x51f7ce;_0x197377['model']=_['keys'](db[_0x5177('0x83')][_0x5177('0x3b')]);_0x197377[_0x5177('0x40')]=_[_0x5177('0x52')](_0x450c61[_0x5177('0x40')]);_0x197377[_0x5177('0x41')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],_0x197377[_0x5177('0x40')]);_0x3b4cab[_0x5177('0x43')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],qs['fields'](_0x450c61[_0x5177('0x40')]['fields']));_0x3b4cab[_0x5177('0x43')]=_0x3b4cab[_0x5177('0x43')][_0x5177('0x45')]?_0x3b4cab['attributes']:_0x197377[_0x5177('0x3f')];_0x3b4cab[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x450c61[_0x5177('0x40')][_0x5177('0x47')]);_0x3b4cab[_0x5177('0x48')]=qs[_0x5177('0x41')](_[_0x5177('0x49')](_0x450c61['query'],_0x197377['filters']));if(_0x450c61[_0x5177('0x40')]['filter']){_0x3b4cab[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x3b4cab['where'],{'$or':_[_0x5177('0x39')](_0x3b4cab[_0x5177('0x43')],function(_0x54efd0){var _0x3e8a29={};_0x3e8a29[_0x54efd0]={'$like':'%'+_0x450c61[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x3e8a29;})});}_0x3b4cab=_[_0x5177('0x4a')]({},_0x3b4cab,_0x450c61[_0x5177('0x4d')]);return _0x580d34[_0x5177('0x82')](_0x3b4cab);}})[_0x5177('0x34')](function(_0x7a67fb){if(_0x7a67fb){_0x1e76cf=_0x7a67fb[_0x5177('0x45')];if(!_0x450c61[_0x5177('0x40')][_0x5177('0x80')](_0x5177('0x81'))){_0x3b4cab[_0x5177('0x28')]=qs['limit'](_0x450c61[_0x5177('0x40')][_0x5177('0x28')]);_0x3b4cab[_0x5177('0x26')]=qs['offset'](_0x450c61[_0x5177('0x40')][_0x5177('0x26')]);}return _0x580d34['getTeams'](_0x3b4cab);}})[_0x5177('0x34')](function(_0x5cbc48){if(_0x5cbc48){return _0x5cbc48?{'count':_0x1e76cf,'rows':_0x5cbc48}:null;}})['then'](respondWithResult(_0x1d351b,null))[_0x5177('0x50')](handleError(_0x1d351b,null));};exports[_0x5177('0x84')]=function(_0xd8f8f3,_0x40ded0,_0x356874){var _0x219a7c=_0xd8f8f3['body'][_0x5177('0x78')];var _0xcb831c;return db['Team'][_0x5177('0x4e')]({'where':{'id':_0x219a7c},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id',_0x5177('0x37'),_0x5177('0x86'),_0x5177('0x87'),_0x5177('0x88')],'raw':!![]}]})[_0x5177('0x34')](function(_0x4e60b2){if(_0x4e60b2){_0xcb831c=_0x4e60b2;var _0x193dbf=_['flatMap'](_0x4e60b2,function(_0xecd419){var _0x4970b3=_0xecd419[_0x5177('0x31')]({'plain':!![]});return _0x4970b3[_0x5177('0x85')];});return db[_0x5177('0x3a')][_0x5177('0x5a')]({'where':{'id':_0xd8f8f3['params']['id']}})[_0x5177('0x34')](function(_0x1b7c52){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x4e8c0c){return _0x1b7c52['addTeams'](_0x219a7c,{'transaction':_0x4e8c0c})['then'](function(){return BPromise['each'](_0xcb831c,function(_0xaafc9f){return db['TeamVoicePrefix'][_0x5177('0x89')]({'TeamId':_0xaafc9f['id'],'VoicePrefixId':_0xd8f8f3['params']['id']},{'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){return BPromise['each'](_0x193dbf,function(_0x384af7){return db[_0x5177('0x8a')][_0x5177('0x8b')]({'where':{'UserId':_0x384af7['id'],'VoicePrefixId':_0xd8f8f3[_0x5177('0x51')]['id']},'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){_0x193dbf[_0x5177('0x8c')](function(_0x3a9c65){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':_0x3a9c65['id'],'VoicePrefixId':_0x1b7c52['id']});});});});});}})[_0x5177('0x34')](respondWithStatusCode(_0x40ded0,null))['catch'](handleError(_0x40ded0,null));};exports[_0x5177('0x8d')]=function(_0x13fa90,_0x3475c3,_0x5ed46a){return db[_0x5177('0x83')][_0x5177('0x4e')]({'where':{'id':_0x13fa90[_0x5177('0x40')][_0x5177('0x78')]},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id'],'raw':!![]}]})[_0x5177('0x34')](handleEntityNotFound(_0x3475c3,null))[_0x5177('0x34')](function(_0xb8f7de){var _0x1bc4cb=_[_0x5177('0x39')](_0xb8f7de,'id');var _0x4d29b7=[];var _0x1f8c26=[];var _0x365b68=squel[_0x5177('0x8e')]();_0x365b68['field'](_0x5177('0x8f'))[_0x5177('0x90')]('team_has_voice_prefixes','tq')[_0x5177('0x91')](_0x5177('0x92'),'ut',_0x5177('0x93'))['where'](_0x5177('0x94'),_0x13fa90[_0x5177('0x51')]['id']);for(var _0x3b8c79=0x0;_0x3b8c79<_0xb8f7de[_0x5177('0x45')];_0x3b8c79+=0x1){let _0x2a16ed=_0xb8f7de[_0x3b8c79];for(var _0x5d1909=0x0;_0x5d1909<_0x2a16ed['Agents'][_0x5177('0x45')];_0x5d1909+=0x1){let _0x61ead2=_0x2a16ed['Agents'][_0x5d1909];var _0x2ffb25=_0x365b68[_0x5177('0x95')]();_0x2ffb25['where'](_0x5177('0x96'),_0x61ead2['id']);_0x1f8c26[_0x5177('0x6c')](db['sequelize']['query'](_0x2ffb25[_0x5177('0x97')](),{'type':db['sequelize']['QueryTypes'][_0x5177('0x98')]})[_0x5177('0x34')](function(_0x58170f){if(_0x58170f[_0x5177('0x45')]===0x1){return _0x61ead2['id'];}else{var _0xdc5504=_[_0x5177('0x99')](_[_0x5177('0x39')](_0x58170f,_0x5177('0x9a')),function(_0x2fa026){return _['includes'](_0x1bc4cb,_0x2fa026);});if(_0xdc5504){return _0x61ead2['id'];}}}));}}return BPromise[_0x5177('0x9b')](_0x1f8c26)['then'](function(_0x55e914){_0x4d29b7=_(_0x4d29b7)[_0x5177('0x9c')](_0x55e914)[_0x5177('0x9d')]()[_0x5177('0x9e')]();return db['VoicePrefix'][_0x5177('0x5a')]({'where':{'id':_0x13fa90[_0x5177('0x51')]['id']}})[_0x5177('0x34')](function(_0x3873ca){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x10698d){return _0x3873ca[_0x5177('0x8d')](_0x13fa90[_0x5177('0x40')][_0x5177('0x78')],{'transaction':_0x10698d})[_0x5177('0x34')](function(){if(!_[_0x5177('0x9f')](_0x4d29b7)){return _0x3873ca['removeAgents'](_0x4d29b7,{'transaction':_0x10698d});}})[_0x5177('0x34')](function(){_0x4d29b7[_0x5177('0x8c')](function(_0x38f0f4){socket[_0x5177('0x7a')]('userVoicePrefix:remove',{'UserId':_0x38f0f4,'VoicePrefixId':_0x3873ca['id']});});});});});});})['then'](respondWithStatusCode(_0x3475c3,null))['catch'](handleError(_0x3475c3,null));}; \ No newline at end of file +var _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x2aa942,_0x24dd71){var _0x1d971e=function(_0x8b059d){while(--_0x8b059d){_0x2aa942['push'](_0x2aa942['shift']());}};_0x1d971e(++_0x24dd71);}(_0x2032,0xd9));var _0x2203=function(_0x3d13a7,_0x13cf55){_0x3d13a7=_0x3d13a7-0x0;var _0x228617=_0x2032[_0x3d13a7];return _0x228617;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7e6cd5b..badfd47 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 _0x4ca1=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x204a6f,_0xf149a){var _0x447627=function(_0x289b47){while(--_0x289b47){_0x204a6f['push'](_0x204a6f['shift']());}};_0x447627(++_0xf149a);}(_0x4ca1,0x1f3));var _0x14ca=function(_0x4a352c,_0x1844ac){_0x4a352c=_0x4a352c-0x0;var _0x488000=_0x4ca1[_0x4a352c];return _0x488000;};'use strict';var EventEmitter=require(_0x14ca('0x0'));var VoicePrefix=require(_0x14ca('0x1'))['db'][_0x14ca('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x14ca('0x3')](0x0);var events={'afterCreate':_0x14ca('0x4'),'afterUpdate':'update','afterDestroy':_0x14ca('0x5')};function emitEvent(_0x55b63b){return function(_0xd55b1b,_0x2c2379,_0x3c2dd0){VoicePrefixEvents[_0x14ca('0x6')](_0x55b63b+':'+_0xd55b1b['id'],_0xd55b1b);VoicePrefixEvents[_0x14ca('0x6')](_0x55b63b,_0xd55b1b);_0x3c2dd0(null);};}for(var e in events){if(events[_0x14ca('0x7')](e)){var event=events[e];VoicePrefix[_0x14ca('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xbdf4=['update','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x56d605,_0x1e1d41){var _0x1e42b5=function(_0x16ada7){while(--_0x16ada7){_0x56d605['push'](_0x56d605['shift']());}};_0x1e42b5(++_0x1e1d41);}(_0xbdf4,0xa4));var _0x4bdf=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xbdf4[_0x2642cb];return _0xe6e41;};'use strict';var EventEmitter=require(_0x4bdf('0x0'));var VoicePrefix=require(_0x4bdf('0x1'))['db'][_0x4bdf('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4bdf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4bdf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5100ba){return function(_0x396ea0,_0x1bf574,_0x1037bf){VoicePrefixEvents[_0x4bdf('0x5')](_0x5100ba+':'+_0x396ea0['id'],_0x396ea0);VoicePrefixEvents[_0x4bdf('0x5')](_0x5100ba,_0x396ea0);_0x1037bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x4bdf('0x6')](e,emitEvent(event));}}module[_0x4bdf('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index dde8e96..605e7d9 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 _0xc381=['./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29975a,_0x2ca253){var _0x41bcac=function(_0x4023ba){while(--_0x4023ba){_0x29975a['push'](_0x29975a['shift']());}};_0x41bcac(++_0x2ca253);}(_0xc381,0x17d));var _0x1c38=function(_0x627f56,_0x173a24){_0x627f56=_0x627f56-0x0;var _0x4b1f12=_0xc381[_0x627f56];return _0x4b1f12;};'use strict';var _=require('lodash');var util=require(_0x1c38('0x0'));var logger=require(_0x1c38('0x1'))(_0x1c38('0x2'));var moment=require(_0x1c38('0x3'));var BPromise=require(_0x1c38('0x4'));var rp=require(_0x1c38('0x5'));var fs=require('fs');var path=require(_0x1c38('0x6'));var rimraf=require(_0x1c38('0x7'));var config=require(_0x1c38('0x8'));var attributes=require(_0x1c38('0x9'));module['exports']=function(_0x91ade3,_0x103ae7){return _0x91ade3[_0x1c38('0xa')](_0x1c38('0xb'),attributes,{'tableName':_0x1c38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3067=['voice_prefixes','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x313c18,_0xa46788){var _0x4a0fb1=function(_0x5d8bde){while(--_0x5d8bde){_0x313c18['push'](_0x313c18['shift']());}};_0x4a0fb1(++_0xa46788);}(_0x3067,0xde));var _0x7306=function(_0x3e56c8,_0x4ccad9){_0x3e56c8=_0x3e56c8-0x0;var _0xef2dbb=_0x3067[_0x3e56c8];return _0xef2dbb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7306('0x0'))(_0x7306('0x1'));var moment=require(_0x7306('0x2'));var BPromise=require(_0x7306('0x3'));var rp=require(_0x7306('0x4'));var fs=require('fs');var path=require(_0x7306('0x5'));var rimraf=require(_0x7306('0x6'));var config=require(_0x7306('0x7'));var attributes=require(_0x7306('0x8'));module[_0x7306('0x9')]=function(_0x320e5f,_0x100541){return _0x320e5f[_0x7306('0xa')](_0x7306('0xb'),attributes,{'tableName':_0x7306('0xc'),'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 ddf49c8..2c204c0 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 _0xbd36=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x116d96,_0xa9829){var _0x3d9f42=function(_0x24f9e8){while(--_0x24f9e8){_0x116d96['push'](_0x116d96['shift']());}};_0x3d9f42(++_0xa9829);}(_0xbd36,0x65));var _0x6bd3=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xbd36[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var moment=require(_0x6bd3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd3('0x3'));var db=require(_0x6bd3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bd3('0x5'))(_0x6bd3('0x6'));var config=require(_0x6bd3('0x7'));var jayson=require(_0x6bd3('0x8'));var client=jayson['client'][_0x6bd3('0x9')]({'port':0x232a});config[_0x6bd3('0xa')]=_[_0x6bd3('0xb')](config[_0x6bd3('0xa')],{'host':_0x6bd3('0xc'),'port':0x18eb});var socket=require(_0x6bd3('0xd'))(new Redis(config[_0x6bd3('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x310f54,_0x50f7f4,_0x2ce148){return new BPromise(function(_0x18004a,_0x25056a){return client[_0x6bd3('0xe')](_0x310f54,_0x2ce148)[_0x6bd3('0xf')](function(_0x56e88f){logger[_0x6bd3('0x10')](_0x6bd3('0x11'),_0x50f7f4,'request\x20sent');logger[_0x6bd3('0x12')](_0x6bd3('0x13'),_0x50f7f4,_0x6bd3('0x14'),JSON[_0x6bd3('0x15')](_0x56e88f));if(_0x56e88f[_0x6bd3('0x16')]){if(_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x17')]===0x1f4){logger[_0x6bd3('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x50f7f4,_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x18')]);return _0x25056a(_0x56e88f['error']['message']);}logger['error'](_0x6bd3('0x11'),_0x50f7f4,_0x56e88f['error'][_0x6bd3('0x18')]);return _0x18004a(_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x18')]);}else{logger[_0x6bd3('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x50f7f4,'request\x20sent');_0x18004a(_0x56e88f[_0x6bd3('0x19')][_0x6bd3('0x18')]);}})[_0x6bd3('0x1a')](function(_0x45ae0e){logger[_0x6bd3('0x16')](_0x6bd3('0x11'),_0x50f7f4,_0x45ae0e);_0x25056a(_0x45ae0e);});});} \ No newline at end of file +var _0x9219=['http','redis','defaults','localhost','socket.io-emitter','then','info','VoicePrefix,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','randomstring','../../config/utils','../../config/environment','jayson/promise'];(function(_0x1d3019,_0x8dbbd5){var _0x36458e=function(_0x5d60db){while(--_0x5d60db){_0x1d3019['push'](_0x1d3019['shift']());}};_0x36458e(++_0x8dbbd5);}(_0x9219,0x19e));var _0x9921=function(_0x5a2ab8,_0xab87a5){_0x5a2ab8=_0x5a2ab8-0x0;var _0x551dd3=_0x9219[_0x5a2ab8];return _0x551dd3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9921('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9921('0x1'));var logger=require('../../config/logger')('rpc');var config=require(_0x9921('0x2'));var jayson=require(_0x9921('0x3'));var client=jayson['client'][_0x9921('0x4')]({'port':0x232a});config[_0x9921('0x5')]=_[_0x9921('0x6')](config[_0x9921('0x5')],{'host':_0x9921('0x7'),'port':0x18eb});var socket=require(_0x9921('0x8'))(new Redis(config[_0x9921('0x5')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x5c6b6f,_0x2ac547,_0x4b975c){return new BPromise(function(_0x122f00,_0x591e9a){return client['request'](_0x5c6b6f,_0x4b975c)[_0x9921('0x9')](function(_0x168c4a){logger[_0x9921('0xa')](_0x9921('0xb'),_0x2ac547,'request\x20sent');logger[_0x9921('0xc')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2ac547,'request\x20sent',JSON[_0x9921('0xd')](_0x168c4a));if(_0x168c4a[_0x9921('0xe')]){if(_0x168c4a['error'][_0x9921('0xf')]===0x1f4){logger[_0x9921('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x2ac547,_0x168c4a[_0x9921('0xe')][_0x9921('0x10')]);return _0x591e9a(_0x168c4a[_0x9921('0xe')]['message']);}logger[_0x9921('0xe')](_0x9921('0xb'),_0x2ac547,_0x168c4a[_0x9921('0xe')]['message']);return _0x122f00(_0x168c4a[_0x9921('0xe')][_0x9921('0x10')]);}else{logger[_0x9921('0xa')](_0x9921('0xb'),_0x2ac547,'request\x20sent');_0x122f00(_0x168c4a[_0x9921('0x11')][_0x9921('0x10')]);}})[_0x9921('0x12')](function(_0x55f82c){logger[_0x9921('0xe')](_0x9921('0xb'),_0x2ac547,_0x55f82c);_0x591e9a(_0x55f82c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 2fbb577..9b7bc07 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 _0x720c=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update','emit'];(function(_0x289bb1,_0x4b17ab){var _0x288d7a=function(_0x36169d){while(--_0x36169d){_0x289bb1['push'](_0x289bb1['shift']());}};_0x288d7a(++_0x4b17ab);}(_0x720c,0x154));var _0xc720=function(_0x338c61,_0x1aa1e6){_0x338c61=_0x338c61-0x0;var _0x2136c6=_0x720c[_0x338c61];return _0x2136c6;};'use strict';var VoicePrefixEvents=require(_0xc720('0x0'));var events=['save',_0xc720('0x1'),_0xc720('0x2')];function createListener(_0x304440,_0x127edb){return function(_0x5e0261){_0x127edb[_0xc720('0x3')](_0x304440,_0x5e0261);};}function removeListener(_0x2336e6,_0x3e4155){return function(){VoicePrefixEvents[_0xc720('0x4')](_0x2336e6,_0x3e4155);};}exports[_0xc720('0x5')]=function(_0x6f8d9f){for(var _0x7d6830=0x0,_0x5bc8b0=events[_0xc720('0x6')];_0x7d6830<_0x5bc8b0;_0x7d6830++){var _0x8a01fc=events[_0x7d6830];var _0x10a2c8=createListener(_0xc720('0x7')+_0x8a01fc,_0x6f8d9f);VoicePrefixEvents['on'](_0x8a01fc,_0x10a2c8);}}; \ No newline at end of file +var _0xd136=['voicePrefix:','save','remove','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd136,0x94));var _0x6d13=function(_0x3109b0,_0x1ea452){_0x3109b0=_0x3109b0-0x0;var _0x363e7d=_0xd136[_0x3109b0];return _0x363e7d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x6d13('0x0'),_0x6d13('0x1'),'update'];function createListener(_0x56824,_0x2d8f30){return function(_0x12b9d6){_0x2d8f30[_0x6d13('0x2')](_0x56824,_0x12b9d6);};}function removeListener(_0xec09ab,_0x387947){return function(){VoicePrefixEvents[_0x6d13('0x3')](_0xec09ab,_0x387947);};}exports[_0x6d13('0x4')]=function(_0x147026){for(var _0x4aabef=0x0,_0x335482=events[_0x6d13('0x5')];_0x4aabef<_0x335482;_0x4aabef++){var _0x4c563a=events[_0x4aabef];var _0x598021=createListener(_0x6d13('0x6')+_0x4c563a,_0x147026);VoicePrefixEvents['on'](_0x4c563a,_0x598021);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 81fb2bf..e80aeae 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(_0xf20b6,_0x49ddbb){var _0x4ff567=function(_0x3ccc7f){while(--_0x3ccc7f){_0xf20b6['push'](_0xf20b6['shift']());}};_0x4ff567(++_0x49ddbb);}(_0xb10b,0x12a));var _0xbb10=function(_0x3db750,_0x5d66c2){_0x3db750=_0x3db750-0x0;var _0x5427a=_0xb10b[_0x3db750];return _0x5427a;};'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(_0x21cc82,_0x79069b){var _0x243178=function(_0x3737f6){while(--_0x3737f6){_0x21cc82['push'](_0x21cc82['shift']());}};_0x243178(++_0x79069b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 e7e2544..ad3d6e7 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 _0x2e32=['Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','booked','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x2e32,0x118));var _0x22e3=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x2e32[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x22e3('0x0'));module[_0x22e3('0x1')]={'name':{'type':Sequelize[_0x22e3('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x22e3('0x3')]('inbound','outbound'),'allowNull':![],'defaultValue':_0x22e3('0x4')},'musiconhold':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':_0x22e3('0x5')},'announce':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x22e3('0x6'),_0x22e3('0x7'),_0x22e3('0x8'),'random',_0x22e3('0x9'),_0x22e3('0xa'),_0x22e3('0xb'),_0x22e3('0xc')),'allowNull':![],'defaultValue':_0x22e3('0x6'),'set':function(_0x101554){this[_0x22e3('0xd')](_0x22e3('0xe'),_0x101554?_0x101554:_0x22e3('0x9'));},'get':function(){var _0x522e6f=this['getDataValue'](_0x22e3('0xf'));var _0xbe928d=this[_0x22e3('0x10')]('dialMethod');var _0x542047=this[_0x22e3('0x10')](_0x22e3('0xe'));if(_0x522e6f==='outbound'){if(_0xbe928d==='preview'){return null;}if(_0xbe928d===_0x22e3('0x11')&&![_0x22e3('0x9'),'roundrobin'][_0x22e3('0x12')](_0x542047)){this[_0x22e3('0xd')](_0x22e3('0xe'),_0x22e3('0x9'));}}return _0x542047;}},'servicelevel':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x22e3('0x13')](0xb)},'timeout':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x22e3('0x2')]},'weight':{'type':Sequelize[_0x22e3('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no'),'defaultValue':_0x22e3('0x14')},'autopause':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no',_0x22e3('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x22e3('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x22e3('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x22e3('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x22e3('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x22e3('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x22e3('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x22e3('0x3')]('yes','no'),'defaultValue':_0x22e3('0x14')},'announce_holdtime':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no',_0x22e3('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x22e3('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x22e3('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x22e3('0x2')]},'queue_youarenext':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x22e3('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x22e3('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x22e3('0x2')]},'periodic_announce':{'type':Sequelize[_0x22e3('0x17')],'set':function(_0x214a2b){this[_0x22e3('0xd')](_0x22e3('0x18'),_0x214a2b?_0x214a2b[_0x22e3('0x19')](','):[]);},'get':function(){return this[_0x22e3('0x10')](_0x22e3('0x18'))?this[_0x22e3('0x10')](_0x22e3('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x22e3('0x14'),'set':function(_0x421fb6){this[_0x22e3('0xd')]('joinempty',_0x421fb6?_0x421fb6['join'](','):undefined);},'get':function(){return this[_0x22e3('0x10')](_0x22e3('0x1a'))?this['getDataValue'](_0x22e3('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':'no','set':function(_0x5138f7){this['setDataValue'](_0x22e3('0x1b'),_0x5138f7?_0x5138f7[_0x22e3('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x22e3('0x1b'))?this[_0x22e3('0x10')]('leavewhenempty')[_0x22e3('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x22e3('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x22e3('0x2')]},'description':{'type':Sequelize[_0x22e3('0x2')]},'acw':{'type':Sequelize[_0x22e3('0x1d')],'defaultValue':0x0,'set':function(_0x3cdfa8){this[_0x22e3('0xd')](_0x22e3('0x1e'),_0x3cdfa8);if(_0x3cdfa8){if(this[_0x22e3('0x10')](_0x22e3('0x1f'))<0x2){this['setDataValue'](_0x22e3('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x22e3('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x22e3('0x1d')],'defaultValue':0x0,'comment':_0x22e3('0x20')},'dialMethod':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x21'),_0x22e3('0x22'),_0x22e3('0x23'),_0x22e3('0x24'),_0x22e3('0x11')),'defaultValue':_0x22e3('0x22'),'comment':_0x22e3('0x25')},'dialLimitChannel':{'type':Sequelize[_0x22e3('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x22e3('0x26')},'dialLimitQueue':{'type':Sequelize[_0x22e3('0x13')](0x4)[_0x22e3('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x22e3('0x28')},'dialPowerLevel':{'type':Sequelize[_0x22e3('0x29')](0x2)[_0x22e3('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x22e3('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x22e3('0x2b'),'dropRate'),'defaultValue':_0x22e3('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x22e3('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x22e3('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x22e3('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x22e3('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x22e3('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x22e3('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x22e3('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22e3('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':_0x22e3('0x30'),'comment':_0x22e3('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22e3('0x32')},'dialQueueProject':{'type':Sequelize[_0x22e3('0x2')],'comment':_0x22e3('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x22e3('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22e3('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22e3('0x35')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x22e3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22e3('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x22e3('0x13')](0x5)[_0x22e3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22e3('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':_0x22e3('0x38')},'dialPrefix':{'type':Sequelize[_0x22e3('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x22e3('0x3')]('always',_0x22e3('0x39'),_0x22e3('0x3a')),'defaultValue':_0x22e3('0x3b')},'dialAMDActive':{'type':Sequelize[_0x22e3('0x1d')],'defaultValue':0x0,'comment':_0x22e3('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x22e3('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x22e3('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x22e3('0x13')](0x9)[_0x22e3('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x22e3('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x22e3('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x22e3('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x22e3('0x13')](0x9)[_0x22e3('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x22e3('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x22e3('0x13')](0x9)[_0x22e3('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x22e3('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x22e3('0x13')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x22e3('0x13')](0x5)[_0x22e3('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x22e3('0x13')](0x9)[_0x22e3('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x22e3('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x22e3('0x13')](0x5)[_0x22e3('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x22e3('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x22e3('0x3')](_0x22e3('0x44'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x22e3('0x2')],'comment':_0x22e3('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x22e3('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x22e3('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x22e3('0x45')},'dialCutDigit':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x22e3('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22e3('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x22e3('0x13')](0x5)[_0x22e3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22e3('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x22e3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x22e3('0x13')](0x5)[_0x22e3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22e3('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x22e3('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x22e3('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22e3('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x22e3('0x13')](0x5)[_0x22e3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x22e3('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x22e3('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x22e3('0x1d')],'defaultValue':![],'comment':_0x22e3('0x4e'),'set':function(_0x6dafae){if(!_0x6dafae)this[_0x22e3('0xd')]('mandatoryDispositionPauseId',null);this[_0x22e3('0xd')](_0x22e3('0x4f'),_0x6dafae);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x22e3('0x13')](0x3)[_0x22e3('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x22e3('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x22e3('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x22e3('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xf7d8=['default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','onlyIfOpen','always','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)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#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\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','inbound','outbound'];(function(_0x54d970,_0x3a6dc0){var _0xe36268=function(_0x8c5616){while(--_0x8c5616){_0x54d970['push'](_0x54d970['shift']());}};_0xe36268(++_0x3a6dc0);}(_0xf7d8,0x195));var _0x8f7d=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0xf7d8[_0xb3b452];return _0x238983;};'use strict';var Sequelize=require(_0x8f7d('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f7d('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x3'),_0x8f7d('0x4')),'allowNull':![],'defaultValue':_0x8f7d('0x3')},'musiconhold':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':_0x8f7d('0x5')},'announce':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8f7d('0x2')]('rr',_0x8f7d('0x6'),_0x8f7d('0x7'),_0x8f7d('0x8'),_0x8f7d('0x9'),_0x8f7d('0xa'),_0x8f7d('0xb'),_0x8f7d('0xc'),_0x8f7d('0xd')),'allowNull':![],'defaultValue':_0x8f7d('0x6'),'set':function(_0x22d2b2){this[_0x8f7d('0xe')](_0x8f7d('0xf'),_0x22d2b2?_0x22d2b2:'rrmemory');},'get':function(){var _0x896f77=this[_0x8f7d('0x10')](_0x8f7d('0x11'));var _0x1c4f78=this['getDataValue'](_0x8f7d('0x12'));var _0x1b654c=this[_0x8f7d('0x10')](_0x8f7d('0xf'));if(_0x896f77==='outbound'){if(_0x1c4f78==='preview'){return null;}if(_0x1c4f78===_0x8f7d('0x13')&&![_0x8f7d('0xa'),'roundrobin'][_0x8f7d('0x14')](_0x1b654c)){this['setDataValue'](_0x8f7d('0xf'),'rrmemory');}}return _0x1b654c;}},'servicelevel':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8f7d('0x15')](0xb)},'timeout':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x8f7d('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x16'),'no',_0x8f7d('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x8f7d('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x8f7d('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x8f7d('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8f7d('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8f7d('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8f7d('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x16'),'no'),'defaultValue':_0x8f7d('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x8f7d('0x16'),'no',_0x8f7d('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8f7d('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x8f7d('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8f7d('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8f7d('0x1')]},'queue_youarenext':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8f7d('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8f7d('0x1')]},'queue_quantity1':{'type':Sequelize[_0x8f7d('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x8f7d('0x1')]},'periodic_announce':{'type':Sequelize[_0x8f7d('0x19')],'set':function(_0x1df441){this['setDataValue'](_0x8f7d('0x1a'),_0x1df441?_0x1df441[_0x8f7d('0x1b')](','):[]);},'get':function(){return this[_0x8f7d('0x10')]('periodic_announce')?this[_0x8f7d('0x10')](_0x8f7d('0x1a'))[_0x8f7d('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x8f7d('0x16'),'set':function(_0x43c93c){this[_0x8f7d('0xe')](_0x8f7d('0x1d'),_0x43c93c?_0x43c93c[_0x8f7d('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x8f7d('0x1d'))?this[_0x8f7d('0x10')](_0x8f7d('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':'no','set':function(_0x548dc3){this[_0x8f7d('0xe')](_0x8f7d('0x1e'),_0x548dc3?_0x548dc3[_0x8f7d('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x8f7d('0x1e'))?this[_0x8f7d('0x10')](_0x8f7d('0x1e'))[_0x8f7d('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8f7d('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x8f7d('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8f7d('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8f7d('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':0x0,'set':function(_0x18023f){this[_0x8f7d('0xe')](_0x8f7d('0x20'),_0x18023f);if(_0x18023f){if(this['getDataValue'](_0x8f7d('0x21'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8f7d('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':0x0,'comment':_0x8f7d('0x22')},'dialMethod':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x23'),_0x8f7d('0x24'),_0x8f7d('0x25'),'predictive',_0x8f7d('0x13')),'defaultValue':_0x8f7d('0x24'),'comment':_0x8f7d('0x26')},'dialLimitChannel':{'type':Sequelize[_0x8f7d('0x15')](0x4)[_0x8f7d('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x8f7d('0x15')](0x4)[_0x8f7d('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8f7d('0x28')},'dialPowerLevel':{'type':Sequelize[_0x8f7d('0x29')](0x2)[_0x8f7d('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8f7d('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x2b'),_0x8f7d('0x2c')),'defaultValue':_0x8f7d('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8f7d('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8f7d('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':_0x8f7d('0x2f'),'comment':_0x8f7d('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8f7d('0x15')](0x5)[_0x8f7d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f7d('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8f7d('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f7d('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8f7d('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8f7d('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8f7d('0x2')]('always','never',_0x8f7d('0x37')),'defaultValue':_0x8f7d('0x38')},'dialAMDActive':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':0x0,'comment':_0x8f7d('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x8f7d('0x15')](0x9)[_0x8f7d('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8f7d('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x8f7d('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8f7d('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8f7d('0x15')](0x9)[_0x8f7d('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8f7d('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8f7d('0x15')](0x9)[_0x8f7d('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8f7d('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x8f7d('0x15')](0x9)[_0x8f7d('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8f7d('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8f7d('0x15')](0x9)[_0x8f7d('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8f7d('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8f7d('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8f7d('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8f7d('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8f7d('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x8f7d('0x15')](0x5)[_0x8f7d('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8f7d('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8f7d('0x2')](_0x8f7d('0x43'),_0x8f7d('0x44')),'defaultValue':_0x8f7d('0x43')},'dialQueueProject2':{'type':Sequelize[_0x8f7d('0x1')],'comment':_0x8f7d('0x45')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8f7d('0x46')},'dialCutDigit':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8f7d('0x15')](0x5)[_0x8f7d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x47')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8f7d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f7d('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8f7d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f7d('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8f7d('0x15')](0x5)[_0x8f7d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f7d('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8f7d('0x15')](0x5)[_0x8f7d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f7d('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x8f7d('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':![],'comment':_0x8f7d('0x4f'),'set':function(_0x6a390d){if(!_0x6a390d)this[_0x8f7d('0xe')](_0x8f7d('0x50'),null);this[_0x8f7d('0xe')](_0x8f7d('0x51'),_0x6a390d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x8f7d('0x15')](0x3)[_0x8f7d('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8f7d('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 0bbfdee..81e00ae 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 _0xf3cd=['CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','forEach','emit','removeTeams','Team','ids','select','field','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','name','UserProfileResource','VoiceQueue','fieldName','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','options','find','create','body','user','role','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','merge','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','order','sort','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0xbabaca,_0x21cbaf){var _0x5ccc9b=function(_0x74f80e){while(--_0x74f80e){_0xbabaca['push'](_0xbabaca['shift']());}};_0x5ccc9b(++_0x21cbaf);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4b33d1,_0x2414e1){_0x4b33d1=_0x4b33d1-0x0;var _0x9e7221=_0xf3cd[_0x4b33d1];return _0x9e7221;};'use strict';var moment=require(_0xdf3c('0x0'));var BPromise=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var _=require(_0xdf3c('0x3'));var squel=require(_0xdf3c('0x4'));var Redis=require(_0xdf3c('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x6'))(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x9')]=_[_0xdf3c('0xa')](config[_0xdf3c('0x9')],{'host':_0xdf3c('0xb'),'port':0x18eb});var socket=require(_0xdf3c('0xc'))(new Redis(config[_0xdf3c('0x9')]));require('./voiceQueue.socket')[_0xdf3c('0xd')](socket);function respondWithStatusCode(_0x52cf30,_0x52f855){_0x52f855=_0x52f855||0xcc;return function(_0x22d8ae){if(_0x22d8ae){return _0x52cf30[_0xdf3c('0xe')](_0x52f855);}return _0x52cf30['status'](_0x52f855)[_0xdf3c('0xf')]();};}function respondWithResult(_0x205f33,_0x2d420c){_0x2d420c=_0x2d420c||0xc8;return function(_0x21a6e5){if(_0x21a6e5){return _0x205f33[_0xdf3c('0x10')](_0x2d420c)[_0xdf3c('0x11')](_0x21a6e5);}};}function respondWithFilteredResult(_0xf7da9d,_0x32d2db){return function(_0x5e8925){if(_0x5e8925){var _0x1d483c=typeof _0x32d2db[_0xdf3c('0x12')]===_0xdf3c('0x13')&&typeof _0x32d2db[_0xdf3c('0x14')]==='undefined';var _0x2ae4ad=_0x5e8925[_0xdf3c('0x15')];var _0x13ea5f=_0x1d483c?0x0:_0x32d2db['offset'];var _0x18aafa=_0x1d483c?_0x5e8925[_0xdf3c('0x15')]:_0x32d2db[_0xdf3c('0x12')]+_0x32d2db[_0xdf3c('0x14')];var _0x21e587;if(_0x18aafa>=_0x2ae4ad){_0x18aafa=_0x2ae4ad;_0x21e587=0xc8;}else{_0x21e587=0xce;}_0xf7da9d[_0xdf3c('0x10')](_0x21e587);return _0xf7da9d[_0xdf3c('0x16')](_0xdf3c('0x17'),_0x13ea5f+'-'+_0x18aafa+'/'+_0x2ae4ad)[_0xdf3c('0x11')](_0x5e8925);}return null;};}function saveUpdates(_0x5d3991){return function(_0x54cdd4){if(_0x54cdd4){return _0x54cdd4[_0xdf3c('0x18')](_0x5d3991)[_0xdf3c('0x19')](function(_0xf1da1f){return _0xf1da1f;});}return null;};}function removeEntity(_0x18d4ec){return function(_0x1e2690){if(_0x1e2690){return _0x1e2690[_0xdf3c('0x1a')]()[_0xdf3c('0x19')](function(){var _0x3ee0af=_0x1e2690[_0xdf3c('0x1b')]({'plain':!![]});var _0x18fb5f=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d'),'ignore':![]},{'name':_0xdf3c('0x1e'),'value':'outbound','ignore':![]}];var _0x4d620f=_(_0x18fb5f)[_0xdf3c('0x1f')]('ignore')[_0xdf3c('0x20')](_0xdf3c('0x21'))[_0xdf3c('0x21')]();if(_[_0xdf3c('0x22')](_0x4d620f,_0x3ee0af[_0xdf3c('0x23')])){return;}var _0x36ba1c=_['find'](_0x18fb5f,[_0xdf3c('0x21'),_0x3ee0af[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x25')][_0xdf3c('0x1a')]({'where':{'type':_0x36ba1c,'resourceId':_0x3ee0af['id']}})[_0xdf3c('0x19')](function(){return _0x1e2690;});})[_0xdf3c('0x19')](function(){_0x18d4ec[_0xdf3c('0x10')](0xcc)[_0xdf3c('0xf')]();});}};}function handleEntityNotFound(_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x1adee4[_0xdf3c('0xe')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x24')];}_0x153daa[_0xdf3c('0x10')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={};var _0x1ccdd4={'count':0x0,'rows':[]};var _0x5c98a2=_[_0xdf3c('0x20')](db[_0xdf3c('0x26')]['rawAttributes'],function(_0x51e0a4){return{'name':_0x51e0a4[_0xdf3c('0x27')],'type':_0x51e0a4[_0xdf3c('0x23')][_0xdf3c('0x28')]};});_0xd3cfcb=qs['getOptions'](_0x5c98a2,_0x37ecfd);var _0x2355f6={'where':_0xd3cfcb[_0xdf3c('0x29')]};return db[_0xdf3c('0x26')][_0xdf3c('0x15')](_0x2355f6)['then'](function(_0xda0de0){_0x1ccdd4[_0xdf3c('0x15')]=_0xda0de0;_0xd3cfcb['include']=qs[_0xdf3c('0x2a')](_0x37ecfd[_0xdf3c('0x2b')]);return db[_0xdf3c('0x26')][_0xdf3c('0x2c')](_0xd3cfcb);})['then'](function(_0x33632f){_0x1ccdd4[_0xdf3c('0x2d')]=_0x33632f;return _0x1ccdd4;})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x2e')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x474564,_0x3e7a4b){var _0x5ddd21={'raw':![],'where':{'id':_0x474564[_0xdf3c('0x2f')]['id']}},_0x4f68f9={};_0x4f68f9['model']=_[_0xdf3c('0x30')](db['VoiceQueue']['rawAttributes']);_0x4f68f9['query']=_[_0xdf3c('0x30')](_0x474564[_0xdf3c('0x2b')]);_0x4f68f9[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4f68f9['model'],_0x4f68f9['query']);_0x5ddd21[_0xdf3c('0x33')]=_['intersection'](_0x4f68f9[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x474564[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5ddd21[_0xdf3c('0x33')]=_0x5ddd21[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5ddd21[_0xdf3c('0x33')]:_0x4f68f9[_0xdf3c('0x34')];if(_0x474564['query'][_0xdf3c('0x37')]){_0x5ddd21['include']=[{'all':!![]}];}_0x5ddd21=_['merge']({},_0x5ddd21,_0x474564[_0xdf3c('0x38')]);return db['VoiceQueue'][_0xdf3c('0x39')](_0x5ddd21)['then'](handleEntityNotFound(_0x3e7a4b,null))[_0xdf3c('0x19')](respondWithResult(_0x3e7a4b,null))[_0xdf3c('0x2e')](handleError(_0x3e7a4b,null));};exports[_0xdf3c('0x3a')]=function(_0x1349a4,_0x3098cb){return db[_0xdf3c('0x26')][_0xdf3c('0x3a')](_0x1349a4[_0xdf3c('0x3b')],{})[_0xdf3c('0x19')](function(_0xa65478){var _0x424acf=_0x1349a4[_0xdf3c('0x3c')]['get']({'plain':!![]});if(!_0x424acf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424acf[_0xdf3c('0x3d')]==='user'){var _0x3a6527=_0xa65478[_0xdf3c('0x1b')]({'plain':!![]});var _0x46194d=[{'name':_0xdf3c('0x1c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xdf3c('0x3e')}];var _0x33edab=_[_0xdf3c('0x39')](_0x46194d,['value',_0x3a6527[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x3f')][_0xdf3c('0x39')]({'where':{'name':_0x33edab,'userProfileId':_0x424acf['userProfileId']},'raw':!![]})[_0xdf3c('0x19')](function(_0x3e9be9){if(_0x3e9be9&&_0x3e9be9[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')][_0xdf3c('0x3a')]({'name':_0x3a6527['name'],'resourceId':_0x3a6527['id'],'type':_0x3e9be9[_0xdf3c('0x24')],'sectionId':_0x3e9be9['id']},{})[_0xdf3c('0x19')](function(){return _0xa65478;});}else{return _0xa65478;}})[_0xdf3c('0x2e')](function(_0x2456cf){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x2456cf);throw _0x2456cf;});}return _0xa65478;})['then'](respondWithResult(_0x3098cb,0xc9))['catch'](handleError(_0x3098cb,null));};exports[_0xdf3c('0x43')]=function(_0x2be86d,_0x5a4443){var _0x5c9885={'where':{'id':_0x2be86d[_0xdf3c('0x2f')]['id']}},_0x269723={};_0x269723[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x26')][_0xdf3c('0x44')]);_0x5c9885[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x269723[_0xdf3c('0x34')],qs['fields'](_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5c9885[_0xdf3c('0x33')]=_0x5c9885[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5c9885[_0xdf3c('0x33')]:_0x269723[_0xdf3c('0x34')];if(_0x2be86d['query'][_0xdf3c('0x37')]){_0x5c9885['include']=[{'all':!![]}];}_0x5c9885=_[_0xdf3c('0x45')]({},_0x5c9885,_0x2be86d['options']);return db[_0xdf3c('0x26')][_0xdf3c('0x39')](_0x5c9885)[_0xdf3c('0x19')](handleEntityNotFound(_0x5a4443,null))[_0xdf3c('0x19')](function(_0x5eef94){if(_0x5eef94){var _0x55da0f=_0x5eef94['get']({'plain':!![]});_0x55da0f=qs[_0xdf3c('0x46')](_0x55da0f,['id','createdAt',_0xdf3c('0x47')]);_0x2be86d[_0xdf3c('0x3b')]=_[_0xdf3c('0x46')](_0x2be86d[_0xdf3c('0x3b')],['id',_0xdf3c('0x48'),'updatedAt']);return db['VoiceQueue'][_0xdf3c('0x3a')](_[_0xdf3c('0x45')](_0x55da0f,_0x2be86d['body']),{'include':_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x37')]?[{'all':!![]}]:undefined})[_0xdf3c('0x19')](function(_0x3fda0a){var _0x38de63=_0x2be86d[_0xdf3c('0x3c')][_0xdf3c('0x1b')]({'plain':!![]});if(!_0x38de63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38de63['role']===_0xdf3c('0x3c')){var _0x28030e=_0x3fda0a[_0xdf3c('0x1b')]({'plain':!![]});var _0x1ad771=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d')},{'name':_0xdf3c('0x1e'),'value':_0xdf3c('0x3e')}];var _0x143d01=_[_0xdf3c('0x39')](_0x1ad771,[_0xdf3c('0x21'),_0x28030e['type']])[_0xdf3c('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x143d01,'userProfileId':_0x38de63['userProfileId']},'raw':!![]})['then'](function(_0x541c57){if(_0x541c57&&_0x541c57[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')]['create']({'name':_0x28030e[_0xdf3c('0x24')],'resourceId':_0x28030e['id'],'type':_0x541c57[_0xdf3c('0x24')],'sectionId':_0x541c57['id']},{})['then'](function(){return _0x3fda0a;});}else{return _0x3fda0a;}})[_0xdf3c('0x2e')](function(_0x28f935){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x28f935);throw _0x28f935;});}return _0x3fda0a;});}})[_0xdf3c('0x19')](respondWithResult(_0x5a4443,0xc9))[_0xdf3c('0x2e')](handleError(_0x5a4443,null));};exports[_0xdf3c('0x18')]=function(_0xdc859,_0x42efa2){if(_0xdc859[_0xdf3c('0x3b')]['id']){delete _0xdc859[_0xdf3c('0x3b')]['id'];}return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xdc859[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x42efa2,null))['then'](saveUpdates(_0xdc859[_0xdf3c('0x3b')],null))[_0xdf3c('0x19')](respondWithResult(_0x42efa2,null))[_0xdf3c('0x2e')](handleError(_0x42efa2,null));};exports['destroy']=function(_0x1effdb,_0x13bf69){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x1effdb['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x13bf69,null))[_0xdf3c('0x19')](removeEntity(_0x13bf69,null))[_0xdf3c('0x2e')](handleError(_0x13bf69,null));};exports[_0xdf3c('0x49')]=function(_0xed2a78,_0x30e6e1){var _0x3fca95={'raw':![],'where':{}};var _0x2a1559={};var _0x2922d8={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xed2a78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30e6e1,null))[_0xdf3c('0x19')](function(_0x204110){if(_0x204110){_0x2a1559[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmHopper']['rawAttributes']);_0x2a1559[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0xed2a78[_0xdf3c('0x2b')]);_0x2a1559['filters']=_[_0xdf3c('0x32')](_0x2a1559['model'],_0x2a1559['query']);_0x3fca95[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x2a1559[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x3fca95[_0xdf3c('0x33')]=_0x3fca95[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x3fca95[_0xdf3c('0x33')]:_0x2a1559[_0xdf3c('0x34')];if(!_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4b')]('nolimit')){_0x3fca95[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x3fca95[_0xdf3c('0x12')]=qs['offset'](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x3fca95[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x3fca95[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xed2a78[_0xdf3c('0x2b')],_0x2a1559['filters']));_0x3fca95[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x204110['id'];if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x3fca95[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x3fca95[_0xdf3c('0x29')],{'$or':_['map'](_0x3fca95[_0xdf3c('0x33')],function(_0x662fd5){var _0x4e1b77={};_0x4e1b77[_0x662fd5]={'$like':'%'+_0xed2a78['query'][_0xdf3c('0x1f')]+'%'};return _0x4e1b77;})});}_0x3fca95=_[_0xdf3c('0x45')]({},_0x3fca95,_0xed2a78[_0xdf3c('0x38')]);return db[_0xdf3c('0x50')][_0xdf3c('0x15')]({'where':_0x3fca95[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x38af90){_0x2922d8['count']=_0x38af90;if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x3fca95[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopper'][_0xdf3c('0x2c')](_0x3fca95);})[_0xdf3c('0x19')](function(_0x43d299){_0x2922d8['rows']=_0x43d299;return _0x2922d8;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x30e6e1,_0x3fca95))[_0xdf3c('0x2e')](handleError(_0x30e6e1,null));};exports[_0xdf3c('0x51')]=function(_0x1b279f,_0xe01538){var _0x12f737={'raw':!![],'where':{}};var _0x560348={};var _0x50753f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1b279f['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xe01538,null))[_0xdf3c('0x19')](function(_0xf66fae){if(_0xf66fae){_0x560348['model']=_[_0xdf3c('0x30')](db[_0xdf3c('0x52')][_0xdf3c('0x44')]);_0x560348['query']=_['keys'](_0x1b279f[_0xdf3c('0x2b')]);_0x560348['filters']=_[_0xdf3c('0x32')](_0x560348['model'],_0x560348[_0xdf3c('0x2b')]);_0x12f737[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x560348[_0xdf3c('0x34')],qs['fields'](_0x1b279f['query'][_0xdf3c('0x35')]));_0x12f737[_0xdf3c('0x33')]=_0x12f737[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x12f737[_0xdf3c('0x33')]:_0x560348[_0xdf3c('0x34')];if(!_0x1b279f['query'][_0xdf3c('0x4b')]('nolimit')){_0x12f737[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x12f737[_0xdf3c('0x12')]=qs['offset'](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x12f737[_0xdf3c('0x4c')]=qs['sort'](_0x1b279f['query']['sort']);_0x12f737['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1b279f[_0xdf3c('0x2b')],_0x560348[_0xdf3c('0x31')]));_0x12f737[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0xf66fae['id'];if(_0x1b279f['query'][_0xdf3c('0x1f')]){_0x12f737['where']=_[_0xdf3c('0x45')](_0x12f737[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x12f737[_0xdf3c('0x33')],function(_0x320452){var _0x3a221d={};_0x3a221d[_0x320452]={'$like':'%'+_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x3a221d;})});}_0x12f737=_[_0xdf3c('0x45')]({},_0x12f737,_0x1b279f[_0xdf3c('0x38')]);return db[_0xdf3c('0x52')][_0xdf3c('0x15')]({'where':_0x12f737[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x55fd73){_0x50753f[_0xdf3c('0x15')]=_0x55fd73;if(_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x12f737[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf3c('0x2c')](_0x12f737);})[_0xdf3c('0x19')](function(_0x54b7b8){_0x50753f['rows']=_0x54b7b8;return _0x50753f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0xe01538,_0x12f737))[_0xdf3c('0x2e')](handleError(_0xe01538,null));};exports[_0xdf3c('0x53')]=function(_0x1aaf8b,_0x44dd2a){var _0x56fc77={'raw':!![],'where':{}};var _0x50105b={};var _0x471d8f={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1aaf8b[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x44dd2a,null))['then'](function(_0x30235e){if(_0x30235e){_0x50105b[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x54')][_0xdf3c('0x44')]);_0x50105b['query']=_['keys'](_0x1aaf8b['query']);_0x50105b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],_0x50105b[_0xdf3c('0x2b')]);_0x56fc77[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1aaf8b['query'][_0xdf3c('0x35')]));_0x56fc77[_0xdf3c('0x33')]=_0x56fc77[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x56fc77[_0xdf3c('0x33')]:_0x50105b[_0xdf3c('0x34')];if(!_0x1aaf8b['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x56fc77['limit']=qs['limit'](_0x1aaf8b[_0xdf3c('0x2b')]['limit']);_0x56fc77[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1aaf8b['query'][_0xdf3c('0x12')]);}_0x56fc77[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x56fc77[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x1aaf8b[_0xdf3c('0x2b')],_0x50105b[_0xdf3c('0x31')]));_0x56fc77[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x30235e['id'];if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x56fc77['where']=_['merge'](_0x56fc77[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x56fc77[_0xdf3c('0x33')],function(_0x5b6419){var _0x38c374={};_0x38c374[_0x5b6419]={'$like':'%'+_0x1aaf8b['query']['filter']+'%'};return _0x38c374;})});}_0x56fc77=_[_0xdf3c('0x45')]({},_0x56fc77,_0x1aaf8b[_0xdf3c('0x38')]);return db['CmHopperFinal'][_0xdf3c('0x15')]({'where':_0x56fc77['where']})[_0xdf3c('0x19')](function(_0x4b35ff){_0x471d8f[_0xdf3c('0x15')]=_0x4b35ff;if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x56fc77[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x54')][_0xdf3c('0x2c')](_0x56fc77);})[_0xdf3c('0x19')](function(_0x2dc0d2){_0x471d8f[_0xdf3c('0x2d')]=_0x2dc0d2;return _0x471d8f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x44dd2a,_0x56fc77))[_0xdf3c('0x2e')](handleError(_0x44dd2a,null));};exports[_0xdf3c('0x56')]=function(_0x10528d,_0x1acc47){var _0x5b3aa5={'raw':!![],'where':{}};var _0x3cf465={};var _0x22bacf={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x10528d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x1acc47,null))[_0xdf3c('0x19')](function(_0x6e1899){if(_0x6e1899){_0x3cf465[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x57')][_0xdf3c('0x44')]);_0x3cf465[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x10528d[_0xdf3c('0x2b')]);_0x3cf465['filters']=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],_0x3cf465[_0xdf3c('0x2b')]);_0x5b3aa5[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5b3aa5[_0xdf3c('0x33')]=_0x5b3aa5[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5b3aa5['attributes']:_0x3cf465[_0xdf3c('0x34')];if(!_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x5b3aa5[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x10528d[_0xdf3c('0x2b')]['limit']);_0x5b3aa5[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x5b3aa5['order']=qs[_0xdf3c('0x4d')](_0x10528d[_0xdf3c('0x2b')]['sort']);_0x5b3aa5[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x10528d[_0xdf3c('0x2b')],_0x3cf465['filters']));_0x5b3aa5[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x6e1899['id'];if(_0x10528d[_0xdf3c('0x2b')]['filter']){_0x5b3aa5['where']=_[_0xdf3c('0x45')](_0x5b3aa5['where'],{'$or':_[_0xdf3c('0x20')](_0x5b3aa5[_0xdf3c('0x33')],function(_0x161604){var _0x91dd6e={};_0x91dd6e[_0x161604]={'$like':'%'+_0x10528d['query'][_0xdf3c('0x1f')]+'%'};return _0x91dd6e;})});}_0x5b3aa5=_[_0xdf3c('0x45')]({},_0x5b3aa5,_0x10528d['options']);return db[_0xdf3c('0x57')]['count']({'where':_0x5b3aa5[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x5429b6){_0x22bacf['count']=_0x5429b6;if(_0x10528d[_0xdf3c('0x2b')]['includeAll']){_0x5b3aa5[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x57')][_0xdf3c('0x2c')](_0x5b3aa5);})[_0xdf3c('0x19')](function(_0x19a723){_0x22bacf[_0xdf3c('0x2d')]=_0x19a723;return _0x22bacf;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1acc47,_0x5b3aa5))[_0xdf3c('0x2e')](handleError(_0x1acc47,null));};exports[_0xdf3c('0x58')]=function(_0x3d8ff0,_0x2a2f03){var _0x55975e={};var _0x4299d1={};var _0x132c27;var _0x52a641;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x3d8ff0[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2a2f03,null))[_0xdf3c('0x19')](function(_0x12576e){if(_0x12576e){_0x132c27=_0x12576e;_0x4299d1['model']=_[_0xdf3c('0x30')](db['Team'][_0xdf3c('0x44')]);_0x4299d1[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x3d8ff0[_0xdf3c('0x2b')]);_0x4299d1[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4299d1['model'],_0x4299d1[_0xdf3c('0x2b')]);_0x55975e[_0xdf3c('0x33')]=_['intersection'](_0x4299d1[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x55975e[_0xdf3c('0x33')]=_0x55975e[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x55975e[_0xdf3c('0x33')]:_0x4299d1['model'];_0x55975e['order']=qs[_0xdf3c('0x4d')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x55975e[_0xdf3c('0x29')]=qs['filters'](_['pick'](_0x3d8ff0[_0xdf3c('0x2b')],_0x4299d1['filters']));if(_0x3d8ff0[_0xdf3c('0x2b')]['filter']){_0x55975e[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x55975e[_0xdf3c('0x29')],{'$or':_['map'](_0x55975e[_0xdf3c('0x33')],function(_0x142cd0){var _0x5bf9a9={};_0x5bf9a9[_0x142cd0]={'$like':'%'+_0x3d8ff0['query'][_0xdf3c('0x1f')]+'%'};return _0x5bf9a9;})});}_0x55975e=_[_0xdf3c('0x45')]({},_0x55975e,_0x3d8ff0[_0xdf3c('0x38')]);return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x294682){if(_0x294682){_0x52a641=_0x294682[_0xdf3c('0x36')];if(!_0x3d8ff0['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x55975e[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x55975e[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x322cf5){if(_0x322cf5){return _0x322cf5?{'count':_0x52a641,'rows':_0x322cf5}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x2a2f03,null))[_0xdf3c('0x2e')](handleError(_0x2a2f03,null));};exports[_0xdf3c('0x59')]=function(_0x199ff0,_0x244bf0){var _0x1a0d61=_0x199ff0[_0xdf3c('0x3b')]['teams'];var _0x4c6615=_[_0xdf3c('0x20')](_0x1a0d61,'id');return db['Team']['findAll']({'where':{'id':_0x4c6615},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':'Agents','attributes':['id',_0xdf3c('0x24'),_0xdf3c('0x5b'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1c7b50){if(_0x1c7b50){var _0x3e0a0f=_[_0xdf3c('0x5c')](_0x1c7b50,function(_0x4d5216){var _0x197b8a=_0x4d5216['get']({'plain':!![]});_0x197b8a[_0xdf3c('0x5d')]['forEach'](function(_0x5b0101){_0x5b0101[_0xdf3c('0x5e')]=_[_0xdf3c('0x39')](_0x1a0d61,{'id':_0x197b8a['id']})[_0xdf3c('0x5e')];});return _0x197b8a[_0xdf3c('0x5d')];});return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x199ff0['params']['id']}})['then'](function(_0x128a4e){return db['sequelize'][_0xdf3c('0x5f')](function(_0x14244a){return _0x128a4e[_0xdf3c('0x59')](_0x4c6615,{'transaction':_0x14244a})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x1a0d61,function(_0x619c66){return db[_0xdf3c('0x61')]['upsert']({'TeamId':_0x619c66['id'],'VoiceQueueId':_0x199ff0['params']['id'],'penalty':_0x619c66[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x3e0a0f,function(_0x13a882){return db['UserVoiceQueue'][_0xdf3c('0x62')]({'where':{'UserId':_0x13a882['id'],'VoiceQueueId':_0x199ff0[_0xdf3c('0x2f')]['id']},'defaults':{'penalty':_0x13a882[_0xdf3c('0x5e')]},'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_[_0xdf3c('0x1f')](_0x3e0a0f,{'online':!![]}),function(_0x524482){return db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x524482['name'],'UserId':_0x524482['id'],'queue_name':_0x128a4e[_0xdf3c('0x24')],'VoiceQueueId':_0x128a4e['id'],'interface':_[_0xdf3c('0x65')](_0x524482[_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x524482[_0xdf3c('0x24')]):_0x524482[_0xdf3c('0x66')],'paused':_0x524482[_0xdf3c('0x68')]||![],'penalty':_0x524482[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){_0x3e0a0f[_0xdf3c('0x69')](function(_0x12ffd3){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':_0x12ffd3['id'],'VoiceQueueId':_0x128a4e['id']});});});});});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x244bf0,null))['catch'](handleError(_0x244bf0,null));};exports[_0xdf3c('0x6b')]=function(_0x160568,_0xfcf42f){return db[_0xdf3c('0x6c')][_0xdf3c('0x2c')]({'where':{'id':_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':_0xdf3c('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xdf3c('0x19')](handleEntityNotFound(_0xfcf42f,null))[_0xdf3c('0x19')](function(_0x5f09a0){var _0x379996=_[_0xdf3c('0x20')](_0x5f09a0,'id');var _0x5f1b51=[];var _0x323058=[];var _0x8fd9e4=squel[_0xdf3c('0x6e')]();_0x8fd9e4[_0xdf3c('0x6f')]('tq.TeamId')[_0xdf3c('0x70')](_0xdf3c('0x71'),'tq')[_0xdf3c('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xdf3c('0x73'),_0x160568[_0xdf3c('0x2f')]['id']);for(var _0x403ac5=0x0;_0x403ac5<_0x5f09a0[_0xdf3c('0x36')];_0x403ac5+=0x1){let _0x44d862=_0x5f09a0[_0x403ac5];for(var _0x33132b=0x0;_0x33132b<_0x44d862[_0xdf3c('0x5d')][_0xdf3c('0x36')];_0x33132b+=0x1){let _0x49c29e=_0x44d862[_0xdf3c('0x5d')][_0x33132b];var _0x5e868a=_0x8fd9e4[_0xdf3c('0x43')]();_0x5e868a[_0xdf3c('0x29')](_0xdf3c('0x74'),_0x49c29e['id']);_0x323058[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x5e868a['toString'](),{'type':db[_0xdf3c('0x76')][_0xdf3c('0x77')]['SELECT']})[_0xdf3c('0x19')](function(_0x270353){if(_0x270353[_0xdf3c('0x36')]===0x1){return _0x49c29e['id'];}else{var _0x3f6df9=_['every'](_[_0xdf3c('0x20')](_0x270353,'TeamId'),function(_0x7d9a0f){return _[_0xdf3c('0x22')](_0x379996,_0x7d9a0f);});if(_0x3f6df9){return _0x49c29e['id'];}}}));}}return BPromise[_0xdf3c('0x78')](_0x323058)[_0xdf3c('0x19')](function(_0x17669f){_0x5f1b51=_(_0x5f1b51)[_0xdf3c('0x79')](_0x17669f)['compact']()['value']();return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x160568[_0xdf3c('0x2f')]['id']}})['then'](function(_0x528c97){return db[_0xdf3c('0x76')]['transaction'](function(_0x58a2d8){return _0x528c97['removeTeams'](_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')],{'transaction':_0x58a2d8})[_0xdf3c('0x19')](function(){if(!_['isEmpty'](_0x5f1b51)){return _0x528c97[_0xdf3c('0x7a')](_0x5f1b51,{'transaction':_0x58a2d8})['then'](function(){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x160568[_0xdf3c('0x2f')]['id'],'UserId':_0x5f1b51},'transaction':_0x58a2d8});});}})[_0xdf3c('0x19')](function(){_0x5f1b51[_0xdf3c('0x69')](function(_0x467090){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':_0x467090,'VoiceQueueId':_0x528c97['id']});});});});});});})[_0xdf3c('0x19')](respondWithStatusCode(_0xfcf42f,null))['catch'](handleError(_0xfcf42f,null));};exports[_0xdf3c('0x7c')]=function(_0x4652af,_0x5e08bc){var _0x2702ca,_0x1e8646;return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x4652af['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x5e08bc,null))[_0xdf3c('0x19')](function(_0x3ea47d){if(_0x3ea47d){_0x1e8646=_0x3ea47d;return _0x3ea47d[_0xdf3c('0x7c')](_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x4652af[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{})[_0xdf3c('0x7d')](function(_0xfdb4e2){for(var _0x1c31ee=0x0;_0x1c31ee<_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x1c31ee+=0x1){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':Number(_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0x1c31ee]),'VoiceQueueId':Number(_0x4652af['params']['id'])});}return _0xfdb4e2;});}})[_0xdf3c('0x19')](function(_0xf39067){_0x2702ca=_0xf39067||[];if(_0x1e8646){return db[_0xdf3c('0x5a')][_0xdf3c('0x2c')]({'where':{'id':_0x4652af['body'][_0xdf3c('0x6d')]},'attributes':['id',_0xdf3c('0x24'),'online',_0xdf3c('0x68'),_0xdf3c('0x66')],'raw':!![]});}})['then'](function(_0x59c8f9){if(!_[_0xdf3c('0x7e')](_0x59c8f9)){var _0x388f8d=[];for(var _0x1c4964=0x0;_0x1c4964<_0x59c8f9['length'];_0x1c4964++){if(_0x59c8f9[_0x1c4964][_0xdf3c('0x5b')]){_0x388f8d['push'](db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x59c8f9[_0x1c4964][_0xdf3c('0x24')],'UserId':_0x59c8f9[_0x1c4964]['id'],'queue_name':_0x1e8646[_0xdf3c('0x24')],'VoiceQueueId':_0x1e8646['id'],'interface':_[_0xdf3c('0x65')](_0x59c8f9[_0x1c4964][_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x59c8f9[_0x1c4964]['name']):_0x59c8f9[_0x1c4964][_0xdf3c('0x66')],'paused':_0x59c8f9[_0x1c4964][_0xdf3c('0x68')]||![],'penalty':_0x4652af[_0xdf3c('0x3b')]['penalty']||0x0}));}}return BPromise[_0xdf3c('0x78')](_0x388f8d);}})['then'](function(){return _0x2702ca;})[_0xdf3c('0x19')](respondWithResult(_0x5e08bc,null))[_0xdf3c('0x2e')](handleError(_0x5e08bc,null));};exports['removeAgents']=function(_0x153bce,_0x4185f0){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x153bce['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4185f0,null))[_0xdf3c('0x19')](function(_0xa61c3f){if(_0xa61c3f){return _0xa61c3f[_0xdf3c('0x7a')](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])[_0xdf3c('0x19')](function(){if(_['isArray'](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])){for(var _0x26251d=0x0;_0x26251d<_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x26251d+=0x1){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0x26251d]),'VoiceQueueId':Number(_0x153bce[_0xdf3c('0x2f')]['id'])});}}else{socket['emit'](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')]),'VoiceQueueId':Number(_0x153bce['params']['id'])});}});}})[_0xdf3c('0x19')](function(_0x109153){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x153bce[_0xdf3c('0x2f')]['id'],'UserId':_0x153bce['query'][_0xdf3c('0x6d')]}})[_0xdf3c('0x19')](function(){return _0x109153;});})['then'](respondWithStatusCode(_0x4185f0,null))[_0xdf3c('0x2e')](handleError(_0x4185f0,null));};exports[_0xdf3c('0x7f')]=function(_0x38c6f3,_0xb39cc){var _0xcc2f18={};var _0x13ee9b={};var _0x8d7c0c;var _0x3d9041;return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x38c6f3[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xb39cc,null))['then'](function(_0x39bc51){if(_0x39bc51){_0x8d7c0c=_0x39bc51;_0x13ee9b[_0xdf3c('0x34')]=_['keys'](db['User'][_0xdf3c('0x44')]);_0x13ee9b[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x38c6f3[_0xdf3c('0x2b')]);_0x13ee9b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],_0x13ee9b[_0xdf3c('0x2b')]);_0xcc2f18['attributes']=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x38c6f3[_0xdf3c('0x2b')]['fields']));_0xcc2f18[_0xdf3c('0x33')]=_0xcc2f18[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0xcc2f18[_0xdf3c('0x33')]:_0x13ee9b['model'];_0xcc2f18[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x38c6f3[_0xdf3c('0x2b')]['sort']);_0xcc2f18['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x38c6f3[_0xdf3c('0x2b')],_0x13ee9b['filters']));if(_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0xcc2f18[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0xcc2f18[_0xdf3c('0x29')],{'$or':_['map'](_0xcc2f18['attributes'],function(_0x1cd1a7){var _0x48141c={};_0x48141c[_0x1cd1a7]={'$like':'%'+_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x48141c;})});}_0xcc2f18=_[_0xdf3c('0x45')]({},_0xcc2f18,_0x38c6f3[_0xdf3c('0x38')]);return _0x8d7c0c[_0xdf3c('0x7f')](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5a56b5){if(_0x5a56b5){_0x3d9041=_0x5a56b5[_0xdf3c('0x36')];if(!_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0xcc2f18['limit']=qs[_0xdf3c('0x14')](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0xcc2f18['offset']=qs['offset'](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x8d7c0c['getAgents'](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5eebe3){if(_0x5eebe3){return _0x5eebe3?{'count':_0x3d9041,'rows':_0x5eebe3}:null;}})[_0xdf3c('0x19')](respondWithResult(_0xb39cc,null))[_0xdf3c('0x2e')](handleError(_0xb39cc,null));};exports[_0xdf3c('0x80')]=function(_0x1961cd,_0x30659d){var _0x27f25a={};var _0x5e5dad={};var _0x19ce27;var _0x2c24b7;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1961cd[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30659d,null))[_0xdf3c('0x19')](function(_0x1dee13){if(_0x1dee13){_0x19ce27=_0x1dee13;_0x5e5dad[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x63')]['rawAttributes']);_0x5e5dad[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x1961cd['query']);_0x5e5dad[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x5e5dad[_0xdf3c('0x34')],_0x5e5dad[_0xdf3c('0x2b')]);_0x27f25a[_0xdf3c('0x33')]=_['intersection'](_0x5e5dad[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x27f25a[_0xdf3c('0x33')]=_0x27f25a[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x27f25a[_0xdf3c('0x33')]:_0x5e5dad[_0xdf3c('0x34')];_0x27f25a[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x27f25a['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1961cd['query'],_0x5e5dad[_0xdf3c('0x31')]));if(_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x27f25a[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x27f25a[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x27f25a[_0xdf3c('0x33')],function(_0xc3b6a1){var _0x3d9a1e={};_0x3d9a1e[_0xc3b6a1]={'$like':'%'+_0x1961cd['query'][_0xdf3c('0x1f')]+'%'};return _0x3d9a1e;})});}_0x27f25a=_[_0xdf3c('0x45')]({},_0x27f25a,_0x1961cd['options']);return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})['then'](function(_0x330ee0){if(_0x330ee0){_0x2c24b7=_0x330ee0['length'];if(!_0x1961cd[_0xdf3c('0x2b')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x27f25a[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x27f25a[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1961cd[_0xdf3c('0x2b')]['offset']);}return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})[_0xdf3c('0x19')](function(_0x1b3daa){return _0x1b3daa?{'count':_0x2c24b7,'rows':_0x1b3daa}:null;})['then'](respondWithResult(_0x30659d,null))[_0xdf3c('0x2e')](handleError(_0x30659d,null));};exports[_0xdf3c('0x81')]=function(_0x30e5ab,_0x465c59){var _0x571f14={};var _0x55a4fa={};var _0x4f7b39;var _0x5e5af3;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x30e5ab[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x465c59,null))[_0xdf3c('0x19')](function(_0x323d9b){if(_0x323d9b){_0x4f7b39=_0x323d9b;_0x55a4fa[_0xdf3c('0x34')]=_['keys'](db[_0xdf3c('0x82')]['rawAttributes']);_0x55a4fa[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x30e5ab[_0xdf3c('0x2b')]);_0x55a4fa[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x55a4fa[_0xdf3c('0x34')],_0x55a4fa[_0xdf3c('0x2b')]);_0x571f14[_0xdf3c('0x33')]=_['intersection'](_0x55a4fa[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x571f14[_0xdf3c('0x33')]=_0x571f14['attributes']['length']?_0x571f14[_0xdf3c('0x33')]:_0x55a4fa[_0xdf3c('0x34')];_0x571f14[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x571f14[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x30e5ab[_0xdf3c('0x2b')],_0x55a4fa[_0xdf3c('0x31')]));if(_0x30e5ab['query'][_0xdf3c('0x1f')]){_0x571f14[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x571f14[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x571f14[_0xdf3c('0x33')],function(_0x184a55){var _0x4e8ad8={};_0x4e8ad8[_0x184a55]={'$like':'%'+_0x30e5ab[_0xdf3c('0x2b')]['filter']+'%'};return _0x4e8ad8;})});}_0x571f14=_[_0xdf3c('0x45')]({},_0x571f14,_0x30e5ab['options']);return _0x4f7b39[_0xdf3c('0x81')](_0x571f14);}})[_0xdf3c('0x19')](function(_0x54d975){if(_0x54d975){_0x5e5af3=_0x54d975['length'];if(!_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x571f14[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x30e5ab['query'][_0xdf3c('0x14')]);_0x571f14[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x4f7b39['getLists'](_0x571f14);}})[_0xdf3c('0x19')](function(_0x55a593){if(_0x55a593){return _0x55a593?{'count':_0x5e5af3,'rows':_0x55a593}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x465c59,null))['catch'](handleError(_0x465c59,null));};exports['addLists']=function(_0x42d720,_0x2da908){var _0x3e2a89=moment()[_0xdf3c('0x83')](_0xdf3c('0x84'));var _0x4f4afd,_0xd3d760;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x42d720[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2da908,null))[_0xdf3c('0x19')](function(_0x386a3b){if(_0x386a3b){_0xd3d760=_0x386a3b;return _0x386a3b[_0xdf3c('0x85')](_0x42d720['body'][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x42d720[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x511630){var _0x2cf46;_0x4f4afd=_0x511630||[];var _0x43fc55=[];if(_0x511630){for(var _0x81b8dd=0x0;_0x81b8dd<_0x511630[_0xdf3c('0x36')];_0x81b8dd+=0x1){var _0xb852c5=_0x511630[_0x81b8dd][_0xdf3c('0x1b')]({'plain':!![]});_0xd3d760[_0xdf3c('0x86')]=_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]?_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]:_0xd3d760[_0xdf3c('0x86')];switch(_0xd3d760[_0xdf3c('0x86')]){case _0xdf3c('0x87'):_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0x8a'))[_0xdf3c('0x8b')](['phone',_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),'updatedAt'],squel[_0xdf3c('0x6e')]()['field'](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))['field']('\x27'+_0x3e2a89+'\x27','createdAt')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))['where'](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')]())['where'](_0xdf3c('0x94'))[_0xdf3c('0x29')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0xdf3c('0x70')](_0xdf3c('0x95'))[_0xdf3c('0x29')](_0xdf3c('0x73'),_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))[_0xdf3c('0x70')](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]())))[_0xdf3c('0x91')]();break;case _0xdf3c('0x97'):_0x2cf46=squel['insert']()[_0xdf3c('0x89')](_0xdf3c('0x8a'))['fromQuery']([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('phone','phone')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),_0xdf3c('0x8e'))['field'](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),'VoiceQueueId')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))['from'](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')]('ListId\x20=\x20?',_0xb852c5['CmListId']['toString']())[_0xdf3c('0x29')](_0xdf3c('0x94'))[_0xdf3c('0x29')](_0xdf3c('0x98'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))['from'](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id']['toString']())))[_0xdf3c('0x91')]();break;default:_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')]('cm_hopper')[_0xdf3c('0x8b')]([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27','scheduledAt')[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5['CmListId'][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id']['toString'](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')](_0xdf3c('0x99'),_0xb852c5[_0xdf3c('0x90')]['toString']())[_0xdf3c('0x29')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x43fc55['push'](db['sequelize'][_0xdf3c('0x2b')](_0x2cf46));}return BPromise[_0xdf3c('0x78')](_0x43fc55);}})[_0xdf3c('0x19')](function(){var _0x1eb736=[];var _0x321ff1=squel[_0xdf3c('0x88')]()['into'](_0xdf3c('0x9a'))['fromQuery']([_0xdf3c('0x9b'),_0xdf3c('0x8f'),_0xdf3c('0x9c'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x9d'))[_0xdf3c('0x6f')]('ci.item')[_0xdf3c('0x6f')](_0xdf3c('0x9e'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27','updatedAt')[_0xdf3c('0x70')](_0xdf3c('0x9f'),'ci')[_0xdf3c('0x72')](_0xdf3c('0x8a'),'h','h.ContactId=ci.CmContactId')[_0xdf3c('0x29')](_0xdf3c('0xa0'),_0x3e2a89)[_0xdf3c('0x29')](_0xdf3c('0xa1'),_0xdf3c('0xa2')))[_0xdf3c('0x91')]();_0x1eb736[_0xdf3c('0x75')](db['sequelize'][_0xdf3c('0x2b')](_0x321ff1));return BPromise[_0xdf3c('0x78')](_0x1eb736);})[_0xdf3c('0x19')](function(){return _0x4f4afd;})[_0xdf3c('0x19')](respondWithResult(_0x2da908,null))[_0xdf3c('0x2e')](handleError(_0x2da908,null));};exports[_0xdf3c('0xa3')]=function(_0x51404d,_0x4cfc67){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x51404d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4cfc67,null))[_0xdf3c('0x19')](function(_0x5e06a2){if(_0x5e06a2){return _0x5e06a2[_0xdf3c('0xa3')](_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})[_0xdf3c('0x19')](function(_0x2cab31){if(_0x2cab31){return db[_0xdf3c('0x50')]['destroy']({'where':{'ListId':_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0x51404d['params']['id']}})[_0xdf3c('0x19')](function(){return _0x2cab31;});}})['then'](respondWithStatusCode(_0x4cfc67,null))[_0xdf3c('0x2e')](handleError(_0x4cfc67,null));};exports[_0xdf3c('0xa4')]=function(_0xa6fa19,_0x16b173){var _0x578e41={};var _0x4815ee={};var _0xa523c8;var _0x52ae27;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xa6fa19[_0xdf3c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x16b173,null))[_0xdf3c('0x19')](function(_0x148785){if(_0x148785){_0xa523c8=_0x148785;_0x4815ee[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmList']['rawAttributes']);_0x4815ee[_0xdf3c('0x2b')]=_['keys'](_0xa6fa19[_0xdf3c('0x2b')]);_0x4815ee[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],_0x4815ee[_0xdf3c('0x2b')]);_0x578e41['attributes']=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xa6fa19['query'][_0xdf3c('0x35')]));_0x578e41[_0xdf3c('0x33')]=_0x578e41[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x578e41[_0xdf3c('0x33')]:_0x4815ee[_0xdf3c('0x34')];_0x578e41[_0xdf3c('0x4c')]=qs['sort'](_0xa6fa19['query'][_0xdf3c('0x4d')]);_0x578e41['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xa6fa19[_0xdf3c('0x2b')],_0x4815ee[_0xdf3c('0x31')]));if(_0xa6fa19['query'][_0xdf3c('0x1f')]){_0x578e41['where']=_[_0xdf3c('0x45')](_0x578e41['where'],{'$or':_[_0xdf3c('0x20')](_0x578e41[_0xdf3c('0x33')],function(_0x36fb96){var _0x2ac2ca={};_0x2ac2ca[_0x36fb96]={'$like':'%'+_0xa6fa19[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x2ac2ca;})});}_0x578e41=_[_0xdf3c('0x45')]({},_0x578e41,_0xa6fa19['options']);return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})[_0xdf3c('0x19')](function(_0x25d312){if(_0x25d312){_0x52ae27=_0x25d312[_0xdf3c('0x36')];if(!_0xa6fa19['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x578e41[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xa6fa19[_0xdf3c('0x2b')]['limit']);_0x578e41['offset']=qs['offset'](_0xa6fa19[_0xdf3c('0x2b')]['offset']);}return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})['then'](function(_0xbbc217){if(_0xbbc217){return _0xbbc217?{'count':_0x52ae27,'rows':_0xbbc217}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x16b173,null))[_0xdf3c('0x2e')](handleError(_0x16b173,null));};exports['addBlackLists']=function(_0x47d44e,_0x4dd133){var _0x2b8425;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x47d44e[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4dd133,null))[_0xdf3c('0x19')](function(_0x4009e0){if(_0x4009e0){return _0x4009e0[_0xdf3c('0xa5')](_0x47d44e[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x47d44e['body'],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x37e578){var _0x11436f;_0x2b8425=_0x37e578||[];var _0x1d66b6=[];if(_0x37e578){for(var _0x4b4bab=0x0;_0x4b4bab<_0x37e578[_0xdf3c('0x36')];_0x4b4bab+=0x1){var _0x290778=_0x37e578[_0x4b4bab][_0xdf3c('0x1b')]({'plain':!![]});_0x11436f=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0xa6'))['fromQuery']([_0xdf3c('0x8f'),'ContactId',_0xdf3c('0x8e'),_0xdf3c('0x4f'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('id','ContactId')[_0xdf3c('0x6f')](_0x290778[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x47d44e['params']['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x48'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0x290778['CmListId'][_0xdf3c('0x91')]())[_0xdf3c('0x29')](_0xdf3c('0x94')))[_0xdf3c('0x91')]();_0x1d66b6[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x11436f));}return BPromise[_0xdf3c('0x78')](_0x1d66b6);}})[_0xdf3c('0x19')](function(){return _0x2b8425;})[_0xdf3c('0x19')](respondWithResult(_0x4dd133,null))[_0xdf3c('0x2e')](handleError(_0x4dd133,null));};exports[_0xdf3c('0xa8')]=function(_0xc5ac78,_0x567748){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x567748,null))['then'](function(_0x290a39){if(_0x290a39){return _0x290a39['removeBlackLists'](_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})['then'](function(_0xabf05c){if(_0xabf05c){return db[_0xdf3c('0x57')][_0xdf3c('0x1a')]({'where':{'ListId':_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](function(){return _0xabf05c;});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x567748,null))['catch'](handleError(_0x567748,null));}; \ No newline at end of file +var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x2101d5,_0x48e156){var _0x49ee84=function(_0x5320de){while(--_0x5320de){_0x2101d5['push'](_0x2101d5['shift']());}};_0x49ee84(++_0x48e156);}(_0xe14b,0x93));var _0xbe14=function(_0x3581ab,_0x16f98e){_0x3581ab=_0x3581ab-0x0;var _0x349ae9=_0xe14b[_0x3581ab];return _0x349ae9;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b78dafc..9d9c39b 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 _0x261a=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x582421,_0x262ab7){var _0x26a5f6=function(_0x2ee83){while(--_0x2ee83){_0x582421['push'](_0x582421['shift']());}};_0x26a5f6(++_0x262ab7);}(_0x261a,0x158));var _0xa261=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x261a[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xa261('0x0'));var VoiceQueue=require(_0xa261('0x1'))['db'][_0xa261('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa261('0x3')](0x0);var events={'afterCreate':_0xa261('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1cd64f){return function(_0x21f581,_0x2cbee1,_0x27c293){VoiceQueueEvents[_0xa261('0x5')](_0x1cd64f+':'+_0x21f581['id'],_0x21f581);VoiceQueueEvents[_0xa261('0x5')](_0x1cd64f,_0x21f581);_0x27c293(null);};}for(var e in events){if(events[_0xa261('0x6')](e)){var event=events[e];VoiceQueue[_0xa261('0x7')](e,emitEvent(event));}}module[_0xa261('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x6be2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','save'];(function(_0x4965b0,_0x3b3974){var _0x12485f=function(_0x5ee829){while(--_0x5ee829){_0x4965b0['push'](_0x4965b0['shift']());}};_0x12485f(++_0x3b3974);}(_0x6be2,0xb9));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x26be('0x0'));var VoiceQueue=require(_0x26be('0x1'))['db'][_0x26be('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x26be('0x3'),'afterUpdate':'update','afterDestroy':_0x26be('0x4')};function emitEvent(_0x317bd4){return function(_0x5afdd4,_0x1f7847,_0x5a55bd){VoiceQueueEvents[_0x26be('0x5')](_0x317bd4+':'+_0x5afdd4['id'],_0x5afdd4);VoiceQueueEvents['emit'](_0x317bd4,_0x5afdd4);_0x5a55bd(null);};}for(var e in events){if(events[_0x26be('0x6')](e)){var event=events[e];VoiceQueue[_0x26be('0x7')](e,emitEvent(event));}}module[_0x26be('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 337188f..9a926c4 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x55ca,0x126));var _0xa55c=function(_0x4c9cc4,_0x1b6528){_0x4c9cc4=_0x4c9cc4-0x0;var _0x4384fb=_0x55ca[_0x4c9cc4];return _0x4384fb;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1278ec,_0x169c43){var _0x324fc1=function(_0x3f9fee){while(--_0x3f9fee){_0x1278ec['push'](_0x1278ec['shift']());}};_0x324fc1(++_0x169c43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b1753fc..26c41d9 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 _0xaa9a=['find','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xaa9a,0x16a));var _0xaaa9=function(_0x43b169,_0x4dc1ae){_0x43b169=_0x43b169-0x0;var _0x256bba=_0xaa9a[_0x43b169];return _0x256bba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaaa9('0x0'));var BPromise=require(_0xaaa9('0x1'));var rs=require(_0xaaa9('0x2'));var fs=require('fs');var Redis=require(_0xaaa9('0x3'));var db=require(_0xaaa9('0x4'))['db'];var utils=require(_0xaaa9('0x5'));var logger=require(_0xaaa9('0x6'))('rpc');var config=require(_0xaaa9('0x7'));var jayson=require(_0xaaa9('0x8'));var client=jayson[_0xaaa9('0x9')]['http']({'port':0x232a});config[_0xaaa9('0xa')]=_[_0xaaa9('0xb')](config[_0xaaa9('0xa')],{'host':_0xaaa9('0xc'),'port':0x18eb});var socket=require(_0xaaa9('0xd'))(new Redis(config[_0xaaa9('0xa')]));require('./voiceQueue.socket')[_0xaaa9('0xe')](socket);function respondWithRpcPromise(_0x51dc30,_0x5043a7,_0xb6be88){return new BPromise(function(_0x3c2e3a,_0x78add){return client[_0xaaa9('0xf')](_0x51dc30,_0xb6be88)['then'](function(_0x3a19ce){logger[_0xaaa9('0x10')](_0xaaa9('0x11'),_0x5043a7,_0xaaa9('0x12'));logger[_0xaaa9('0x13')](_0xaaa9('0x14'),_0x5043a7,_0xaaa9('0x12'),JSON[_0xaaa9('0x15')](_0x3a19ce));if(_0x3a19ce[_0xaaa9('0x16')]){if(_0x3a19ce[_0xaaa9('0x16')][_0xaaa9('0x17')]===0x1f4){logger[_0xaaa9('0x16')](_0xaaa9('0x11'),_0x5043a7,_0x3a19ce[_0xaaa9('0x16')][_0xaaa9('0x18')]);return _0x78add(_0x3a19ce[_0xaaa9('0x16')]['message']);}logger[_0xaaa9('0x16')](_0xaaa9('0x11'),_0x5043a7,_0x3a19ce['error']['message']);return _0x3c2e3a(_0x3a19ce[_0xaaa9('0x16')][_0xaaa9('0x18')]);}else{logger[_0xaaa9('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x5043a7,_0xaaa9('0x12'));_0x3c2e3a(_0x3a19ce['result']['message']);}})['catch'](function(_0x5759b5){logger['error'](_0xaaa9('0x11'),_0x5043a7,_0x5759b5);_0x78add(_0x5759b5);});});}exports[_0xaaa9('0x19')]=function(_0x4b3dfa){var _0x220abf=this;return new Promise(function(_0x93c6b1,_0xbaf23e){return db[_0xaaa9('0x1a')][_0xaaa9('0x1b')]({'raw':_0x4b3dfa['options']?_0x4b3dfa[_0xaaa9('0x1c')][_0xaaa9('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b3dfa[_0xaaa9('0x1c')]?_0x4b3dfa[_0xaaa9('0x1c')][_0xaaa9('0x1e')]||null:null,'attributes':_0x4b3dfa[_0xaaa9('0x1c')]?_0x4b3dfa[_0xaaa9('0x1c')][_0xaaa9('0x1f')]||null:null,'limit':_0x4b3dfa[_0xaaa9('0x1c')]?_0x4b3dfa[_0xaaa9('0x1c')][_0xaaa9('0x20')]||null:null,'include':_0x4b3dfa['options']?_0x4b3dfa[_0xaaa9('0x1c')][_0xaaa9('0x21')]?_[_0xaaa9('0x22')](_0x4b3dfa[_0xaaa9('0x1c')][_0xaaa9('0x21')],function(_0x106d96){return{'model':db[_0x106d96[_0xaaa9('0x23')]],'as':_0x106d96['as'],'attributes':_0x106d96[_0xaaa9('0x1f')],'include':_0x106d96[_0xaaa9('0x21')]?_[_0xaaa9('0x22')](_0x106d96['include'],function(_0x1b7157){return{'model':db[_0x1b7157[_0xaaa9('0x23')]],'as':_0x1b7157['as'],'attributes':_0x1b7157[_0xaaa9('0x1f')],'include':_0x1b7157['include']?_[_0xaaa9('0x22')](_0x1b7157['include'],function(_0xdad494){return{'model':db[_0xdad494['model']],'as':_0xdad494['as'],'attributes':_0xdad494[_0xaaa9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaaa9('0x24')](function(_0x1e90d5){logger[_0xaaa9('0x10')](_0xaaa9('0x19'),_0x4b3dfa);logger[_0xaaa9('0x13')](_0xaaa9('0x19'),_0x4b3dfa,JSON[_0xaaa9('0x15')](_0x1e90d5));_0x93c6b1(_0x1e90d5);})['catch'](function(_0x104c0f){logger[_0xaaa9('0x16')](_0xaaa9('0x19'),_0x104c0f['message'],_0x4b3dfa);_0xbaf23e(_0x220abf[_0xaaa9('0x16')](0x1f4,_0x104c0f[_0xaaa9('0x18')]));});});};exports[_0xaaa9('0x25')]=function(_0x2384e5){var _0x322051=this;return new Promise(function(_0x18e84d,_0x12d0f4){return db[_0xaaa9('0x1a')][_0xaaa9('0x26')]({'raw':_0x2384e5[_0xaaa9('0x1c')]?_0x2384e5['options'][_0xaaa9('0x1d')]===undefined?!![]:![]:!![],'where':_0x2384e5[_0xaaa9('0x1c')]?_0x2384e5[_0xaaa9('0x1c')][_0xaaa9('0x1e')]||null:null,'attributes':_0x2384e5['options']?_0x2384e5['options']['attributes']||null:null,'include':_0x2384e5['options']?_0x2384e5[_0xaaa9('0x1c')]['include']?_[_0xaaa9('0x22')](_0x2384e5[_0xaaa9('0x1c')][_0xaaa9('0x21')],function(_0x383c41){return{'model':db[_0x383c41[_0xaaa9('0x23')]],'as':_0x383c41['as'],'attributes':_0x383c41[_0xaaa9('0x1f')],'include':_0x383c41[_0xaaa9('0x21')]?_[_0xaaa9('0x22')](_0x383c41['include'],function(_0x55292b){return{'model':db[_0x55292b[_0xaaa9('0x23')]],'as':_0x55292b['as'],'attributes':_0x55292b['attributes'],'include':_0x55292b[_0xaaa9('0x21')]?_[_0xaaa9('0x22')](_0x55292b['include'],function(_0x296cf0){return{'model':db[_0x296cf0[_0xaaa9('0x23')]],'as':_0x296cf0['as'],'attributes':_0x296cf0[_0xaaa9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaaa9('0x24')](function(_0x25aea4){logger[_0xaaa9('0x10')]('ShowVoiceQueue',_0x2384e5);logger['debug'](_0xaaa9('0x25'),_0x2384e5,JSON['stringify'](_0x25aea4));_0x18e84d(_0x25aea4);})[_0xaaa9('0x27')](function(_0x1c1937){logger[_0xaaa9('0x16')](_0xaaa9('0x25'),_0x1c1937[_0xaaa9('0x18')],_0x2384e5);_0x12d0f4(_0x322051['error'](0x1f4,_0x1c1937[_0xaaa9('0x18')]));});});}; \ No newline at end of file +var _0x7c34=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','where','map','include','attributes','model','then','ShowVoiceQueue','find','lodash','util','moment','bluebird'];(function(_0x20638a,_0x57f58f){var _0x3b708a=function(_0x2bf7ce){while(--_0x2bf7ce){_0x20638a['push'](_0x20638a['shift']());}};_0x3b708a(++_0x57f58f);}(_0x7c34,0xb5));var _0x47c3=function(_0x4dc1fc,_0x2a5546){_0x4dc1fc=_0x4dc1fc-0x0;var _0x32769a=_0x7c34[_0x4dc1fc];return _0x32769a;};'use strict';var _=require(_0x47c3('0x0'));var util=require(_0x47c3('0x1'));var moment=require(_0x47c3('0x2'));var BPromise=require(_0x47c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47c3('0x4'));var db=require(_0x47c3('0x5'))['db'];var utils=require(_0x47c3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x47c3('0x7'));var jayson=require(_0x47c3('0x8'));var client=jayson['client'][_0x47c3('0x9')]({'port':0x232a});config[_0x47c3('0xa')]=_[_0x47c3('0xb')](config[_0x47c3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x47c3('0xc'))(new Redis(config['redis']));require(_0x47c3('0xd'))[_0x47c3('0xe')](socket);function respondWithRpcPromise(_0x27113c,_0x5624ac,_0x2d55dd){return new BPromise(function(_0x3b2aaf,_0x4d3ccf){return client['request'](_0x27113c,_0x2d55dd)['then'](function(_0x4751f1){logger[_0x47c3('0xf')](_0x47c3('0x10'),_0x5624ac,_0x47c3('0x11'));logger[_0x47c3('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5624ac,_0x47c3('0x11'),JSON[_0x47c3('0x13')](_0x4751f1));if(_0x4751f1[_0x47c3('0x14')]){if(_0x4751f1['error'][_0x47c3('0x15')]===0x1f4){logger[_0x47c3('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x5624ac,_0x4751f1[_0x47c3('0x14')][_0x47c3('0x16')]);return _0x4d3ccf(_0x4751f1[_0x47c3('0x14')][_0x47c3('0x16')]);}logger['error'](_0x47c3('0x10'),_0x5624ac,_0x4751f1['error'][_0x47c3('0x16')]);return _0x3b2aaf(_0x4751f1[_0x47c3('0x14')][_0x47c3('0x16')]);}else{logger['info'](_0x47c3('0x10'),_0x5624ac,_0x47c3('0x11'));_0x3b2aaf(_0x4751f1[_0x47c3('0x17')][_0x47c3('0x16')]);}})[_0x47c3('0x18')](function(_0x6844d5){logger['error'](_0x47c3('0x10'),_0x5624ac,_0x6844d5);_0x4d3ccf(_0x6844d5);});});}exports[_0x47c3('0x19')]=function(_0x2ca10e){var _0x3a6416=this;return new Promise(function(_0x40f250,_0x36da6a){return db['VoiceQueue'][_0x47c3('0x1a')]({'raw':_0x2ca10e[_0x47c3('0x1b')]?_0x2ca10e[_0x47c3('0x1b')][_0x47c3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ca10e[_0x47c3('0x1b')]?_0x2ca10e['options'][_0x47c3('0x1d')]||null:null,'attributes':_0x2ca10e[_0x47c3('0x1b')]?_0x2ca10e[_0x47c3('0x1b')]['attributes']||null:null,'limit':_0x2ca10e[_0x47c3('0x1b')]?_0x2ca10e[_0x47c3('0x1b')]['limit']||null:null,'include':_0x2ca10e[_0x47c3('0x1b')]?_0x2ca10e[_0x47c3('0x1b')]['include']?_[_0x47c3('0x1e')](_0x2ca10e[_0x47c3('0x1b')][_0x47c3('0x1f')],function(_0x522902){return{'model':db[_0x522902['model']],'as':_0x522902['as'],'attributes':_0x522902[_0x47c3('0x20')],'include':_0x522902[_0x47c3('0x1f')]?_[_0x47c3('0x1e')](_0x522902[_0x47c3('0x1f')],function(_0x351402){return{'model':db[_0x351402['model']],'as':_0x351402['as'],'attributes':_0x351402[_0x47c3('0x20')],'include':_0x351402['include']?_['map'](_0x351402[_0x47c3('0x1f')],function(_0x373473){return{'model':db[_0x373473[_0x47c3('0x21')]],'as':_0x373473['as'],'attributes':_0x373473[_0x47c3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x47c3('0x22')](function(_0x266a72){logger[_0x47c3('0xf')](_0x47c3('0x19'),_0x2ca10e);logger['debug'](_0x47c3('0x19'),_0x2ca10e,JSON[_0x47c3('0x13')](_0x266a72));_0x40f250(_0x266a72);})['catch'](function(_0xc8bf09){logger[_0x47c3('0x14')](_0x47c3('0x19'),_0xc8bf09[_0x47c3('0x16')],_0x2ca10e);_0x36da6a(_0x3a6416['error'](0x1f4,_0xc8bf09['message']));});});};exports[_0x47c3('0x23')]=function(_0xfddf67){var _0x1c76f4=this;return new Promise(function(_0x5c2cc3,_0xb0006){return db['VoiceQueue'][_0x47c3('0x24')]({'raw':_0xfddf67[_0x47c3('0x1b')]?_0xfddf67['options'][_0x47c3('0x1c')]===undefined?!![]:![]:!![],'where':_0xfddf67[_0x47c3('0x1b')]?_0xfddf67[_0x47c3('0x1b')][_0x47c3('0x1d')]||null:null,'attributes':_0xfddf67[_0x47c3('0x1b')]?_0xfddf67[_0x47c3('0x1b')][_0x47c3('0x20')]||null:null,'include':_0xfddf67['options']?_0xfddf67[_0x47c3('0x1b')]['include']?_[_0x47c3('0x1e')](_0xfddf67[_0x47c3('0x1b')][_0x47c3('0x1f')],function(_0x1991db){return{'model':db[_0x1991db['model']],'as':_0x1991db['as'],'attributes':_0x1991db[_0x47c3('0x20')],'include':_0x1991db['include']?_[_0x47c3('0x1e')](_0x1991db['include'],function(_0x32f146){return{'model':db[_0x32f146[_0x47c3('0x21')]],'as':_0x32f146['as'],'attributes':_0x32f146[_0x47c3('0x20')],'include':_0x32f146[_0x47c3('0x1f')]?_[_0x47c3('0x1e')](_0x32f146[_0x47c3('0x1f')],function(_0x1cd857){return{'model':db[_0x1cd857[_0x47c3('0x21')]],'as':_0x1cd857['as'],'attributes':_0x1cd857[_0x47c3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x47c3('0x22')](function(_0x5d4ebe){logger[_0x47c3('0xf')]('ShowVoiceQueue',_0xfddf67);logger[_0x47c3('0x12')](_0x47c3('0x23'),_0xfddf67,JSON[_0x47c3('0x13')](_0x5d4ebe));_0x5c2cc3(_0x5d4ebe);})[_0x47c3('0x18')](function(_0x3e3f29){logger['error'](_0x47c3('0x23'),_0x3e3f29['message'],_0xfddf67);_0xb0006(_0x1c76f4[_0x47c3('0x14')](0x1f4,_0x3e3f29[_0x47c3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 28b4777..56db612 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 _0xfd41=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xfd41,0x162));var _0x1fd4=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xfd41[_0x242a4f];return _0x122117;};'use strict';var VoiceQueueEvents=require(_0x1fd4('0x0'));var events=[_0x1fd4('0x1'),_0x1fd4('0x2'),_0x1fd4('0x3')];function createListener(_0x2c9c53,_0x11239b){return function(_0x3c527a){_0x11239b[_0x1fd4('0x4')](_0x2c9c53,_0x3c527a);};}function removeListener(_0xb926f2,_0x17cb4d){return function(){VoiceQueueEvents['removeListener'](_0xb926f2,_0x17cb4d);};}exports[_0x1fd4('0x5')]=function(_0x274703){for(var _0x105bb2=0x0,_0x4f21f6=events[_0x1fd4('0x6')];_0x105bb2<_0x4f21f6;_0x105bb2++){var _0x201e6e=events[_0x105bb2];var _0x463cd2=createListener(_0x1fd4('0x7')+_0x201e6e,_0x274703);VoiceQueueEvents['on'](_0x201e6e,_0x463cd2);}}; \ No newline at end of file +var _0x23aa=['removeListener','length','save','update','emit'];(function(_0x4d5a20,_0xf26c89){var _0x14b4f1=function(_0x692bc7){while(--_0x692bc7){_0x4d5a20['push'](_0x4d5a20['shift']());}};_0x14b4f1(++_0xf26c89);}(_0x23aa,0x93));var _0xa23a=function(_0x22348e,_0x4981ae){_0x22348e=_0x22348e-0x0;var _0x2742f2=_0x23aa[_0x22348e];return _0x2742f2;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa23a('0x0'),'remove',_0xa23a('0x1')];function createListener(_0x2ac33f,_0x5e4641){return function(_0x536e2c){_0x5e4641[_0xa23a('0x2')](_0x2ac33f,_0x536e2c);};}function removeListener(_0x3ad8a4,_0x1de016){return function(){VoiceQueueEvents[_0xa23a('0x3')](_0x3ad8a4,_0x1de016);};}exports['register']=function(_0x589f9f){for(var _0x21dcc7=0x0,_0x5959af=events[_0xa23a('0x4')];_0x21dcc7<_0x5959af;_0x21dcc7++){var _0x3f1f9f=events[_0x21dcc7];var _0x31281b=createListener('voiceQueue:'+_0x3f1f9f,_0x589f9f);VoiceQueueEvents['on'](_0x3f1f9f,_0x31281b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d9d17a6..e69e49a 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 _0x3675=['create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','show','post'];(function(_0x190ecd,_0x44a3bd){var _0x44d5c6=function(_0xf1767e){while(--_0xf1767e){_0x190ecd['push'](_0x190ecd['shift']());}};_0x44d5c6(++_0x44a3bd);}(_0x3675,0x193));var _0x5367=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x3675[_0x34933a];return _0x36abb4;};'use strict';var multer=require(_0x5367('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5367('0x1'));var express=require('express');var router=express[_0x5367('0x2')]();var fs_extra=require(_0x5367('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5367('0x4'));var config=require(_0x5367('0x5'));var controller=require(_0x5367('0x6'));router[_0x5367('0x7')]('/',auth[_0x5367('0x8')](),controller['index']);router[_0x5367('0x7')](_0x5367('0x9'),auth[_0x5367('0x8')](),controller[_0x5367('0xa')]);router[_0x5367('0x7')](_0x5367('0xb'),auth[_0x5367('0x8')](),controller[_0x5367('0xc')]);router[_0x5367('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5367('0xd')]);router[_0x5367('0xe')]('/',auth[_0x5367('0x8')](),controller[_0x5367('0xf')]);router[_0x5367('0x10')](_0x5367('0x11'),auth['isAuthenticated'](),controller[_0x5367('0x12')]);router[_0x5367('0x13')](_0x5367('0x11'),auth[_0x5367('0x8')](),controller[_0x5367('0x14')]);module[_0x5367('0x15')]=router; \ No newline at end of file +var _0x47a6=['./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x25e561,_0x11caab){var _0x252a5e=function(_0x51583f){while(--_0x51583f){_0x25e561['push'](_0x25e561['shift']());}};_0x252a5e(++_0x11caab);}(_0x47a6,0x7d));var _0x647a=function(_0xdfaeef,_0xe21d5e){_0xdfaeef=_0xdfaeef-0x0;var _0x11acb8=_0x47a6[_0xdfaeef];return _0x11acb8;};'use strict';var multer=require(_0x647a('0x0'));var util=require(_0x647a('0x1'));var path=require('path');var timeout=require(_0x647a('0x2'));var express=require(_0x647a('0x3'));var router=express['Router']();var fs_extra=require(_0x647a('0x4'));var auth=require(_0x647a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x647a('0x6'));var controller=require(_0x647a('0x7'));router[_0x647a('0x8')]('/',auth[_0x647a('0x9')](),controller['index']);router[_0x647a('0x8')](_0x647a('0xa'),auth[_0x647a('0x9')](),controller[_0x647a('0xb')]);router[_0x647a('0x8')](_0x647a('0xc'),auth['isAuthenticated'](),controller[_0x647a('0xd')]);router['get'](_0x647a('0xe'),auth['isAuthenticated'](),controller[_0x647a('0xf')]);router[_0x647a('0x10')]('/',auth[_0x647a('0x9')](),controller[_0x647a('0x11')]);router[_0x647a('0x12')](_0x647a('0xe'),auth[_0x647a('0x9')](),controller[_0x647a('0x13')]);router[_0x647a('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x647a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ec4065b..6d4688f 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 _0x5a66=['diff','seconds','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x5a66,0x1f4));var _0x65a6=function(_0x3e0d81,_0x258d37){_0x3e0d81=_0x3e0d81-0x0;var _0x1fa8ca=_0x5a66[_0x3e0d81];return _0x1fa8ca;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x65a6('0x0')]={'type':{'type':Sequelize[_0x65a6('0x1')]},'uniqueid':{'type':Sequelize[_0x65a6('0x1')]},'calleridnum':{'type':Sequelize[_0x65a6('0x1')]},'calleridname':{'type':Sequelize[_0x65a6('0x1')]},'queue':{'type':Sequelize[_0x65a6('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x65a6('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x59d981){var _0x51eeb1=moment(_0x59d981);var _0x10f255=moment(this[_0x65a6('0x3')](_0x65a6('0x4')))[_0x65a6('0x5')](_0x65a6('0x6'));var _0x394243=_0x51eeb1[_0x65a6('0x7')](_0x10f255,_0x65a6('0x8'));this[_0x65a6('0x9')]('queuecallerleaveAt',_0x59d981);this[_0x65a6('0x9')]('holdtime',_0x394243||null);}},'position':{'type':Sequelize[_0x65a6('0xa')]},'count':{'type':Sequelize[_0x65a6('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x65a6('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x65a6('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x65a6('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x65a6('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x65a6('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x65a6('0xa')]},'channel':{'type':Sequelize[_0x65a6('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x65a6('0x1')]},'context':{'type':Sequelize[_0x65a6('0x1')]},'exten':{'type':Sequelize[_0x65a6('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x65a6('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x65a6('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x65a6('0x1')],'comment':_0x65a6('0xc')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x65a6('0x1')]},'disposition':{'type':Sequelize[_0x65a6('0x1')]},'secondDisposition':{'type':Sequelize[_0x65a6('0x1')]},'thirdDisposition':{'type':Sequelize[_0x65a6('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x65a6('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe975=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0xe975,0x1b2));var _0x5e97=function(_0x3ce976,_0x50e889){_0x3ce976=_0x3ce976-0x0;var _0xcefdde=_0xe975[_0x3ce976];return _0xcefdde;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x5e97('0x0')]},'uniqueid':{'type':Sequelize[_0x5e97('0x0')]},'calleridnum':{'type':Sequelize[_0x5e97('0x0')]},'calleridname':{'type':Sequelize[_0x5e97('0x0')]},'queue':{'type':Sequelize[_0x5e97('0x0')]},'queuecallerjoinAt':{'type':Sequelize[_0x5e97('0x1')]},'queuecallerleaveAt':{'type':Sequelize[_0x5e97('0x1')],'set':function(_0x391866){var _0x5833d2=moment(_0x391866);var _0x21de90=moment(this[_0x5e97('0x2')]('queuecallerjoinAt'))[_0x5e97('0x3')](_0x5e97('0x4'));var _0x1c79f6=_0x5833d2['diff'](_0x21de90,_0x5e97('0x5'));this['setDataValue']('queuecallerleaveAt',_0x391866);this['setDataValue'](_0x5e97('0x6'),_0x1c79f6||null);}},'position':{'type':Sequelize[_0x5e97('0x7')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x5e97('0x8')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5e97('0x1')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x5e97('0x8')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x5e97('0x0')],'comment':_0x5e97('0x9')},'originalposition':{'type':Sequelize[_0x5e97('0x7')]},'channel':{'type':Sequelize[_0x5e97('0x0')]},'connectedlinenum':{'type':Sequelize[_0x5e97('0x0')]},'connectedlinename':{'type':Sequelize[_0x5e97('0x0')]},'accountcode':{'type':Sequelize[_0x5e97('0x0')]},'context':{'type':Sequelize[_0x5e97('0x0')]},'exten':{'type':Sequelize[_0x5e97('0x0')]},'priority':{'type':Sequelize[_0x5e97('0x0')]},'holdtime':{'type':Sequelize[_0x5e97('0x7')]},'mohtime':{'type':Sequelize[_0x5e97('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5e97('0x8')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5e97('0x0')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5e97('0x0')],'comment':_0x5e97('0xa')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x5e97('0x0')]},'disposition':{'type':Sequelize[_0x5e97('0x0')]},'secondDisposition':{'type':Sequelize[_0x5e97('0x0')]},'thirdDisposition':{'type':Sequelize[_0x5e97('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0x5e97('0x7')],'defaultValue':0x0},'note':{'type':Sequelize[_0x5e97('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 515a130..c30b99c 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 _0x3ef1=['set','Content-Range','apply','reject','update','then','destroy','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','filter','merge','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','describe','getVoiceQueuesReport','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x3ef1,0x1b7));var _0x13ef=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x3ef1[_0x13b02f];return _0x12e9a6;};'use strict';var emlformat=require(_0x13ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13ef('0x1'));var jsonpatch=require(_0x13ef('0x2'));var rp=require(_0x13ef('0x3'));var moment=require(_0x13ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13ef('0x5'));var util=require('util');var path=require(_0x13ef('0x6'));var sox=require(_0x13ef('0x7'));var csv=require('to-csv');var ejs=require(_0x13ef('0x8'));var fs=require('fs');var fs_extra=require(_0x13ef('0x9'));var _=require(_0x13ef('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x13ef('0xb'));var querystring=require('querystring');var Papa=require(_0x13ef('0xc'));var Redis=require(_0x13ef('0xd'));var authService=require(_0x13ef('0xe'));var qs=require(_0x13ef('0xf'));var as=require(_0x13ef('0x10'));var hardwareService=require(_0x13ef('0x11'));var logger=require('../../config/logger')(_0x13ef('0x12'));var utils=require(_0x13ef('0x13'));var config=require(_0x13ef('0x14'));var licenseUtil=require(_0x13ef('0x15'));var db=require(_0x13ef('0x16'))['db'];config['redis']=_[_0x13ef('0x17')](config[_0x13ef('0x18')],{'host':_0x13ef('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13ef('0x18')]));require('./voiceQueueReport.socket')[_0x13ef('0x1a')](socket);function respondWithStatusCode(_0x265381,_0x599ff1){_0x599ff1=_0x599ff1||0xcc;return function(_0x3ee76d){if(_0x3ee76d){return _0x265381[_0x13ef('0x1b')](_0x599ff1);}return _0x265381[_0x13ef('0x1c')](_0x599ff1)[_0x13ef('0x1d')]();};}function respondWithResult(_0x53a31e,_0xa14e91){_0xa14e91=_0xa14e91||0xc8;return function(_0x1e8515){if(_0x1e8515){return _0x53a31e[_0x13ef('0x1c')](_0xa14e91)[_0x13ef('0x1e')](_0x1e8515);}};}function respondWithFilteredResult(_0x2a372c,_0x239208){return function(_0x1d1174){if(_0x1d1174){var _0x43590f=typeof _0x239208[_0x13ef('0x1f')]===_0x13ef('0x20')&&typeof _0x239208['limit']===_0x13ef('0x20');var _0x8f6318=_0x1d1174[_0x13ef('0x21')];var _0x29ccec=_0x43590f?0x0:_0x239208[_0x13ef('0x1f')];var _0x1061cc=_0x43590f?_0x1d1174[_0x13ef('0x21')]:_0x239208[_0x13ef('0x1f')]+_0x239208[_0x13ef('0x22')];var _0x3aff4d;if(_0x1061cc>=_0x8f6318){_0x1061cc=_0x8f6318;_0x3aff4d=0xc8;}else{_0x3aff4d=0xce;}_0x2a372c[_0x13ef('0x1c')](_0x3aff4d);return _0x2a372c[_0x13ef('0x23')](_0x13ef('0x24'),_0x29ccec+'-'+_0x1061cc+'/'+_0x8f6318)[_0x13ef('0x1e')](_0x1d1174);}return null;};}function patchUpdates(_0x4c6cfb){return function(_0x22c8fa){try{jsonpatch[_0x13ef('0x25')](_0x22c8fa,_0x4c6cfb,!![]);}catch(_0x48fecd){return BPromise[_0x13ef('0x26')](_0x48fecd);}return _0x22c8fa['save']();};}function saveUpdates(_0x1d4ab4,_0xf15623){return function(_0x586735){if(_0x586735){return _0x586735[_0x13ef('0x27')](_0x1d4ab4)[_0x13ef('0x28')](function(_0x3bdafb){return _0x3bdafb;});}return null;};}function removeEntity(_0x19e414,_0x465bd4){return function(_0xfce0f4){if(_0xfce0f4){return _0xfce0f4[_0x13ef('0x29')]()['then'](function(){_0x19e414[_0x13ef('0x1c')](0xcc)[_0x13ef('0x1d')]();});}};}function handleEntityNotFound(_0x4f4e3e,_0x2b8ea3){return function(_0x2258e0){if(!_0x2258e0){_0x4f4e3e[_0x13ef('0x1b')](0x194);}return _0x2258e0;};}function handleError(_0x31311f,_0x21bebc){_0x21bebc=_0x21bebc||0x1f4;return function(_0x2e0897){logger[_0x13ef('0x2a')](_0x2e0897[_0x13ef('0x2b')]);if(_0x2e0897['name']){delete _0x2e0897[_0x13ef('0x2c')];}_0x31311f[_0x13ef('0x1c')](_0x21bebc)['send'](_0x2e0897);};}exports['index']=function(_0x3ee528,_0x274174){var _0x2e2cd2={},_0x3704dd={},_0x1d4e10={'count':0x0,'rows':[]};var _0x185cff=_[_0x13ef('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x66eb7f){return{'name':_0x66eb7f[_0x13ef('0x2e')],'type':_0x66eb7f[_0x13ef('0x2f')]['key']};});_0x3704dd[_0x13ef('0x30')]=_[_0x13ef('0x2d')](_0x185cff,_0x13ef('0x2c'));_0x3704dd[_0x13ef('0x31')]=_[_0x13ef('0x32')](_0x3ee528['query']);_0x3704dd[_0x13ef('0x33')]=_[_0x13ef('0x34')](_0x3704dd[_0x13ef('0x30')],_0x3704dd[_0x13ef('0x31')]);_0x2e2cd2[_0x13ef('0x35')]=_['intersection'](_0x3704dd['model'],qs[_0x13ef('0x36')](_0x3ee528[_0x13ef('0x31')][_0x13ef('0x36')]));_0x2e2cd2['attributes']=_0x2e2cd2[_0x13ef('0x35')][_0x13ef('0x37')]?_0x2e2cd2[_0x13ef('0x35')]:_0x3704dd[_0x13ef('0x30')];if(!_0x3ee528[_0x13ef('0x31')][_0x13ef('0x38')]('nolimit')){_0x2e2cd2[_0x13ef('0x22')]=qs[_0x13ef('0x22')](_0x3ee528[_0x13ef('0x31')][_0x13ef('0x22')]);_0x2e2cd2['offset']=qs[_0x13ef('0x1f')](_0x3ee528['query'][_0x13ef('0x1f')]);}_0x2e2cd2[_0x13ef('0x39')]=qs[_0x13ef('0x3a')](_0x3ee528[_0x13ef('0x31')]['sort']);_0x2e2cd2['where']=qs[_0x13ef('0x33')](_[_0x13ef('0x3b')](_0x3ee528[_0x13ef('0x31')],_0x3704dd[_0x13ef('0x33')]),_0x185cff);if(_0x3ee528['query']['filter']){_0x2e2cd2['where']=_['merge'](_0x2e2cd2[_0x13ef('0x3c')],{'$or':_[_0x13ef('0x2d')](_0x185cff,function(_0x509485){if(_0x509485[_0x13ef('0x2f')]!=='VIRTUAL'){var _0x520e41={};_0x520e41[_0x509485[_0x13ef('0x2c')]]={'$like':'%'+_0x3ee528[_0x13ef('0x31')][_0x13ef('0x3d')]+'%'};return _0x520e41;}})});}_0x2e2cd2=_[_0x13ef('0x3e')]({},_0x2e2cd2,_0x3ee528['options']);var _0x356669={'where':_0x2e2cd2[_0x13ef('0x3c')]};return db[_0x13ef('0x3f')]['count'](_0x356669)[_0x13ef('0x28')](function(_0x3482ac){_0x1d4e10[_0x13ef('0x21')]=_0x3482ac;if(_0x3ee528[_0x13ef('0x31')][_0x13ef('0x40')]){_0x2e2cd2[_0x13ef('0x41')]=[{'all':!![]}];}return db[_0x13ef('0x3f')][_0x13ef('0x42')](_0x2e2cd2);})[_0x13ef('0x28')](function(_0x5b7d5e){_0x1d4e10[_0x13ef('0x43')]=_0x5b7d5e;return _0x1d4e10;})[_0x13ef('0x28')](respondWithFilteredResult(_0x274174,_0x2e2cd2))[_0x13ef('0x44')](handleError(_0x274174,null));};exports[_0x13ef('0x45')]=function(_0x51cb6a,_0x4c360c){var _0x3591f7={'raw':![],'where':{'id':_0x51cb6a[_0x13ef('0x46')]['id']}},_0x2ae581={};_0x2ae581[_0x13ef('0x30')]=_[_0x13ef('0x32')](db[_0x13ef('0x3f')][_0x13ef('0x47')]);_0x2ae581[_0x13ef('0x31')]=_['keys'](_0x51cb6a[_0x13ef('0x31')]);_0x2ae581[_0x13ef('0x33')]=_[_0x13ef('0x34')](_0x2ae581[_0x13ef('0x30')],_0x2ae581['query']);_0x3591f7['attributes']=_[_0x13ef('0x34')](_0x2ae581[_0x13ef('0x30')],qs[_0x13ef('0x36')](_0x51cb6a[_0x13ef('0x31')][_0x13ef('0x36')]));_0x3591f7['attributes']=_0x3591f7[_0x13ef('0x35')][_0x13ef('0x37')]?_0x3591f7[_0x13ef('0x35')]:_0x2ae581[_0x13ef('0x30')];if(_0x51cb6a[_0x13ef('0x31')]['includeAll']){_0x3591f7[_0x13ef('0x41')]=[{'all':!![]}];}_0x3591f7=_[_0x13ef('0x3e')]({},_0x3591f7,_0x51cb6a[_0x13ef('0x48')]);return db[_0x13ef('0x3f')]['find'](_0x3591f7)[_0x13ef('0x28')](handleEntityNotFound(_0x4c360c,null))['then'](respondWithResult(_0x4c360c,null))['catch'](handleError(_0x4c360c,null));};exports[_0x13ef('0x49')]=function(_0x3be008,_0x9b7e32){return db[_0x13ef('0x3f')]['create'](_0x3be008[_0x13ef('0x4a')],{})[_0x13ef('0x28')](respondWithResult(_0x9b7e32,0xc9))[_0x13ef('0x44')](handleError(_0x9b7e32,null));};exports[_0x13ef('0x27')]=function(_0x19511b,_0x11855c){if(_0x19511b[_0x13ef('0x4a')]['id']){delete _0x19511b[_0x13ef('0x4a')]['id'];}return db[_0x13ef('0x3f')][_0x13ef('0x4b')]({'where':{'id':_0x19511b[_0x13ef('0x46')]['id']}})[_0x13ef('0x28')](handleEntityNotFound(_0x11855c,null))[_0x13ef('0x28')](saveUpdates(_0x19511b[_0x13ef('0x4a')],null))[_0x13ef('0x28')](respondWithResult(_0x11855c,null))['catch'](handleError(_0x11855c,null));};exports[_0x13ef('0x29')]=function(_0x5a2835,_0x126f79){return db[_0x13ef('0x3f')][_0x13ef('0x4b')]({'where':{'id':_0x5a2835[_0x13ef('0x46')]['id']}})[_0x13ef('0x28')](handleEntityNotFound(_0x126f79,null))[_0x13ef('0x28')](removeEntity(_0x126f79,null))[_0x13ef('0x44')](handleError(_0x126f79,null));};exports[_0x13ef('0x4c')]=function(_0x5a177a,_0x3dae08){return db['VoiceQueueReport'][_0x13ef('0x4c')]()[_0x13ef('0x28')](respondWithResult(_0x3dae08,null))[_0x13ef('0x44')](handleError(_0x3dae08,null));};exports[_0x13ef('0x4d')]=function(_0x4e5680,_0x2b2df1){var _0x3c6806={},_0xa74b2c={},_0x32d63a={'count':0x0,'rows':[]};_0xa74b2c[_0x13ef('0x30')]=_[_0x13ef('0x32')](db[_0x13ef('0x3f')][_0x13ef('0x47')]);_0xa74b2c[_0x13ef('0x31')]=_['keys'](_0x4e5680['query']);_0xa74b2c[_0x13ef('0x33')]=_[_0x13ef('0x34')](_0xa74b2c['model'],_0xa74b2c[_0x13ef('0x31')]);_0x3c6806['attributes']=_[_0x13ef('0x34')](_0xa74b2c[_0x13ef('0x30')],qs[_0x13ef('0x36')](_0x4e5680[_0x13ef('0x31')][_0x13ef('0x36')]));_0x3c6806[_0x13ef('0x35')]=_0x3c6806['attributes']['length']?_0x3c6806[_0x13ef('0x35')]:_0xa74b2c[_0x13ef('0x30')];if(!_0x4e5680[_0x13ef('0x31')]['hasOwnProperty'](_0x13ef('0x4e'))){_0x3c6806[_0x13ef('0x22')]=qs[_0x13ef('0x22')](_0x4e5680[_0x13ef('0x31')][_0x13ef('0x22')]);_0x3c6806[_0x13ef('0x1f')]=qs['offset'](_0x4e5680['query'][_0x13ef('0x1f')]);}_0x3c6806['order']=qs[_0x13ef('0x3a')](_0x4e5680[_0x13ef('0x31')]['sort']);_0x3c6806[_0x13ef('0x3c')]=qs[_0x13ef('0x33')](_[_0x13ef('0x3b')](_0x4e5680[_0x13ef('0x31')],_0xa74b2c[_0x13ef('0x33')]));if(_0x4e5680['query'][_0x13ef('0x3d')]){_0x3c6806[_0x13ef('0x3c')]=_[_0x13ef('0x3e')](_0x3c6806[_0x13ef('0x3c')],{'$or':_[_0x13ef('0x2d')](_0x3c6806['attributes'],function(_0x217b55){var _0x2c3903={};_0x2c3903[_0x217b55]={'$like':'%'+_0x4e5680[_0x13ef('0x31')][_0x13ef('0x3d')]+'%'};return _0x2c3903;})});}_0x3c6806=_['merge']({},_0x3c6806,_0x4e5680[_0x13ef('0x48')]);var _0x472a8b={'where':_0x3c6806[_0x13ef('0x3c')]};return db[_0x13ef('0x3f')][_0x13ef('0x21')](_0x472a8b)[_0x13ef('0x28')](function(_0x59ee32){_0x32d63a['count']=_0x59ee32;if(_0x4e5680[_0x13ef('0x31')][_0x13ef('0x40')]){_0x3c6806[_0x13ef('0x41')]=[{'all':!![]}];}return db[_0x13ef('0x3f')][_0x13ef('0x42')](_0x3c6806);})['then'](function(_0x1d12d9){_0x32d63a[_0x13ef('0x43')]=_0x1d12d9;return _0x32d63a;})[_0x13ef('0x28')](respondWithFilteredResult(_0x2b2df1,_0x3c6806,_0x13ef('0x4d')))['catch'](handleError(_0x2b2df1,null,_0x13ef('0x4d')));}; \ No newline at end of file +var _0x959e=['params','includeAll','create','body','find','describe','length','nolimit','order','findAll','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','name','index','VoiceQueueReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch'];(function(_0x4f5aba,_0x3e0562){var _0x303f0f=function(_0x2abb15){while(--_0x2abb15){_0x4f5aba['push'](_0x4f5aba['shift']());}};_0x303f0f(++_0x3e0562);}(_0x959e,0xa7));var _0xe959=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x959e[_0x26f702];return _0x11417d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe959('0x0'));var zipdir=require(_0xe959('0x1'));var jsonpatch=require(_0xe959('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe959('0x3'));var Mustache=require(_0xe959('0x4'));var util=require(_0xe959('0x5'));var path=require('path');var sox=require(_0xe959('0x6'));var csv=require(_0xe959('0x7'));var ejs=require(_0xe959('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe959('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe959('0xa'));var toCsv=require(_0xe959('0x7'));var querystring=require(_0xe959('0xb'));var Papa=require(_0xe959('0xc'));var Redis=require('ioredis');var authService=require(_0xe959('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xe959('0xe'));var hardwareService=require(_0xe959('0xf'));var logger=require(_0xe959('0x10'))(_0xe959('0x11'));var utils=require(_0xe959('0x12'));var config=require(_0xe959('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe959('0x14'))['db'];config[_0xe959('0x15')]=_['defaults'](config[_0xe959('0x15')],{'host':_0xe959('0x16'),'port':0x18eb});var socket=require(_0xe959('0x17'))(new Redis(config[_0xe959('0x15')]));require(_0xe959('0x18'))[_0xe959('0x19')](socket);function respondWithStatusCode(_0x423610,_0x2880dd){_0x2880dd=_0x2880dd||0xcc;return function(_0x332e1f){if(_0x332e1f){return _0x423610[_0xe959('0x1a')](_0x2880dd);}return _0x423610[_0xe959('0x1b')](_0x2880dd)[_0xe959('0x1c')]();};}function respondWithResult(_0x2229e0,_0x2dd105){_0x2dd105=_0x2dd105||0xc8;return function(_0x4251a4){if(_0x4251a4){return _0x2229e0[_0xe959('0x1b')](_0x2dd105)[_0xe959('0x1d')](_0x4251a4);}};}function respondWithFilteredResult(_0xa40bd4,_0x14b393){return function(_0x5e27b6){if(_0x5e27b6){var _0x4a2fe3=typeof _0x14b393['offset']===_0xe959('0x1e')&&typeof _0x14b393[_0xe959('0x1f')]===_0xe959('0x1e');var _0x4a1028=_0x5e27b6[_0xe959('0x20')];var _0x3ae79c=_0x4a2fe3?0x0:_0x14b393[_0xe959('0x21')];var _0x2e6ffa=_0x4a2fe3?_0x5e27b6['count']:_0x14b393[_0xe959('0x21')]+_0x14b393[_0xe959('0x1f')];var _0x393ceb;if(_0x2e6ffa>=_0x4a1028){_0x2e6ffa=_0x4a1028;_0x393ceb=0xc8;}else{_0x393ceb=0xce;}_0xa40bd4['status'](_0x393ceb);return _0xa40bd4[_0xe959('0x22')](_0xe959('0x23'),_0x3ae79c+'-'+_0x2e6ffa+'/'+_0x4a1028)[_0xe959('0x1d')](_0x5e27b6);}return null;};}function patchUpdates(_0x1d1054){return function(_0x97b1ad){try{jsonpatch[_0xe959('0x24')](_0x97b1ad,_0x1d1054,!![]);}catch(_0x302d83){return BPromise['reject'](_0x302d83);}return _0x97b1ad[_0xe959('0x25')]();};}function saveUpdates(_0x28c79e,_0x316777){return function(_0x37099f){if(_0x37099f){return _0x37099f[_0xe959('0x26')](_0x28c79e)['then'](function(_0x24e92a){return _0x24e92a;});}return null;};}function removeEntity(_0x577ffe,_0x41542f){return function(_0x5e4134){if(_0x5e4134){return _0x5e4134[_0xe959('0x27')]()[_0xe959('0x28')](function(){_0x577ffe[_0xe959('0x1b')](0xcc)[_0xe959('0x1c')]();});}};}function handleEntityNotFound(_0x4f4c70,_0x3c1c0d){return function(_0x6b5b57){if(!_0x6b5b57){_0x4f4c70['sendStatus'](0x194);}return _0x6b5b57;};}function handleError(_0x5d3809,_0xf8a412){_0xf8a412=_0xf8a412||0x1f4;return function(_0x387bee){logger[_0xe959('0x29')](_0x387bee['stack']);if(_0x387bee[_0xe959('0x2a')]){delete _0x387bee[_0xe959('0x2a')];}_0x5d3809['status'](_0xf8a412)['send'](_0x387bee);};}exports[_0xe959('0x2b')]=function(_0x100c05,_0x19062b){var _0x750e2d={},_0x4ea6b0={},_0x4dc676={'count':0x0,'rows':[]};var _0x2599a2=_['map'](db[_0xe959('0x2c')][_0xe959('0x2d')],function(_0x59b0ed){return{'name':_0x59b0ed[_0xe959('0x2e')],'type':_0x59b0ed[_0xe959('0x2f')]['key']};});_0x4ea6b0['model']=_[_0xe959('0x30')](_0x2599a2,_0xe959('0x2a'));_0x4ea6b0[_0xe959('0x31')]=_[_0xe959('0x32')](_0x100c05[_0xe959('0x31')]);_0x4ea6b0[_0xe959('0x33')]=_[_0xe959('0x34')](_0x4ea6b0[_0xe959('0x35')],_0x4ea6b0[_0xe959('0x31')]);_0x750e2d[_0xe959('0x36')]=_[_0xe959('0x34')](_0x4ea6b0[_0xe959('0x35')],qs[_0xe959('0x37')](_0x100c05['query'][_0xe959('0x37')]));_0x750e2d[_0xe959('0x36')]=_0x750e2d[_0xe959('0x36')]['length']?_0x750e2d[_0xe959('0x36')]:_0x4ea6b0[_0xe959('0x35')];if(!_0x100c05[_0xe959('0x31')][_0xe959('0x38')]('nolimit')){_0x750e2d['limit']=qs[_0xe959('0x1f')](_0x100c05[_0xe959('0x31')][_0xe959('0x1f')]);_0x750e2d[_0xe959('0x21')]=qs[_0xe959('0x21')](_0x100c05[_0xe959('0x31')]['offset']);}_0x750e2d['order']=qs['sort'](_0x100c05[_0xe959('0x31')][_0xe959('0x39')]);_0x750e2d[_0xe959('0x3a')]=qs['filters'](_[_0xe959('0x3b')](_0x100c05[_0xe959('0x31')],_0x4ea6b0['filters']),_0x2599a2);if(_0x100c05['query'][_0xe959('0x3c')]){_0x750e2d[_0xe959('0x3a')]=_[_0xe959('0x3d')](_0x750e2d[_0xe959('0x3a')],{'$or':_[_0xe959('0x30')](_0x2599a2,function(_0x5a3b28){if(_0x5a3b28[_0xe959('0x2f')]!==_0xe959('0x3e')){var _0x38b73c={};_0x38b73c[_0x5a3b28['name']]={'$like':'%'+_0x100c05['query'][_0xe959('0x3c')]+'%'};return _0x38b73c;}})});}_0x750e2d=_[_0xe959('0x3d')]({},_0x750e2d,_0x100c05[_0xe959('0x3f')]);var _0xd01a5c={'where':_0x750e2d[_0xe959('0x3a')]};return db[_0xe959('0x2c')]['count'](_0xd01a5c)[_0xe959('0x28')](function(_0x3cae20){_0x4dc676[_0xe959('0x20')]=_0x3cae20;if(_0x100c05[_0xe959('0x31')]['includeAll']){_0x750e2d[_0xe959('0x40')]=[{'all':!![]}];}return db[_0xe959('0x2c')]['findAll'](_0x750e2d);})['then'](function(_0x2ca27d){_0x4dc676[_0xe959('0x41')]=_0x2ca27d;return _0x4dc676;})[_0xe959('0x28')](respondWithFilteredResult(_0x19062b,_0x750e2d))[_0xe959('0x42')](handleError(_0x19062b,null));};exports['show']=function(_0x2e6c12,_0x2026d3){var _0x35c966={'raw':![],'where':{'id':_0x2e6c12[_0xe959('0x43')]['id']}},_0xfb49d5={};_0xfb49d5['model']=_[_0xe959('0x32')](db['VoiceQueueReport'][_0xe959('0x2d')]);_0xfb49d5['query']=_[_0xe959('0x32')](_0x2e6c12['query']);_0xfb49d5[_0xe959('0x33')]=_[_0xe959('0x34')](_0xfb49d5['model'],_0xfb49d5[_0xe959('0x31')]);_0x35c966[_0xe959('0x36')]=_[_0xe959('0x34')](_0xfb49d5['model'],qs['fields'](_0x2e6c12['query'][_0xe959('0x37')]));_0x35c966[_0xe959('0x36')]=_0x35c966[_0xe959('0x36')]['length']?_0x35c966[_0xe959('0x36')]:_0xfb49d5[_0xe959('0x35')];if(_0x2e6c12[_0xe959('0x31')][_0xe959('0x44')]){_0x35c966['include']=[{'all':!![]}];}_0x35c966=_[_0xe959('0x3d')]({},_0x35c966,_0x2e6c12[_0xe959('0x3f')]);return db[_0xe959('0x2c')]['find'](_0x35c966)[_0xe959('0x28')](handleEntityNotFound(_0x2026d3,null))[_0xe959('0x28')](respondWithResult(_0x2026d3,null))[_0xe959('0x42')](handleError(_0x2026d3,null));};exports[_0xe959('0x45')]=function(_0x27a800,_0x4e6bf0){return db[_0xe959('0x2c')][_0xe959('0x45')](_0x27a800[_0xe959('0x46')],{})[_0xe959('0x28')](respondWithResult(_0x4e6bf0,0xc9))[_0xe959('0x42')](handleError(_0x4e6bf0,null));};exports[_0xe959('0x26')]=function(_0xae76e2,_0x231826){if(_0xae76e2['body']['id']){delete _0xae76e2[_0xe959('0x46')]['id'];}return db[_0xe959('0x2c')][_0xe959('0x47')]({'where':{'id':_0xae76e2['params']['id']}})[_0xe959('0x28')](handleEntityNotFound(_0x231826,null))[_0xe959('0x28')](saveUpdates(_0xae76e2[_0xe959('0x46')],null))['then'](respondWithResult(_0x231826,null))[_0xe959('0x42')](handleError(_0x231826,null));};exports[_0xe959('0x27')]=function(_0x4d5023,_0x318f17){return db[_0xe959('0x2c')][_0xe959('0x47')]({'where':{'id':_0x4d5023[_0xe959('0x43')]['id']}})[_0xe959('0x28')](handleEntityNotFound(_0x318f17,null))[_0xe959('0x28')](removeEntity(_0x318f17,null))[_0xe959('0x42')](handleError(_0x318f17,null));};exports['describe']=function(_0x1fb240,_0x459298){return db['VoiceQueueReport'][_0xe959('0x48')]()[_0xe959('0x28')](respondWithResult(_0x459298,null))['catch'](handleError(_0x459298,null));};exports['getVoiceQueuesReport']=function(_0x285abd,_0x2c0857){var _0x47008d={},_0xa378dd={},_0xd5e5dc={'count':0x0,'rows':[]};_0xa378dd[_0xe959('0x35')]=_[_0xe959('0x32')](db[_0xe959('0x2c')][_0xe959('0x2d')]);_0xa378dd[_0xe959('0x31')]=_['keys'](_0x285abd[_0xe959('0x31')]);_0xa378dd[_0xe959('0x33')]=_[_0xe959('0x34')](_0xa378dd[_0xe959('0x35')],_0xa378dd[_0xe959('0x31')]);_0x47008d['attributes']=_[_0xe959('0x34')](_0xa378dd['model'],qs[_0xe959('0x37')](_0x285abd[_0xe959('0x31')][_0xe959('0x37')]));_0x47008d[_0xe959('0x36')]=_0x47008d[_0xe959('0x36')][_0xe959('0x49')]?_0x47008d[_0xe959('0x36')]:_0xa378dd[_0xe959('0x35')];if(!_0x285abd[_0xe959('0x31')][_0xe959('0x38')](_0xe959('0x4a'))){_0x47008d['limit']=qs[_0xe959('0x1f')](_0x285abd['query'][_0xe959('0x1f')]);_0x47008d[_0xe959('0x21')]=qs[_0xe959('0x21')](_0x285abd[_0xe959('0x31')][_0xe959('0x21')]);}_0x47008d[_0xe959('0x4b')]=qs['sort'](_0x285abd['query'][_0xe959('0x39')]);_0x47008d[_0xe959('0x3a')]=qs['filters'](_[_0xe959('0x3b')](_0x285abd['query'],_0xa378dd['filters']));if(_0x285abd[_0xe959('0x31')][_0xe959('0x3c')]){_0x47008d['where']=_[_0xe959('0x3d')](_0x47008d[_0xe959('0x3a')],{'$or':_[_0xe959('0x30')](_0x47008d[_0xe959('0x36')],function(_0x2813ca){var _0x3103c0={};_0x3103c0[_0x2813ca]={'$like':'%'+_0x285abd[_0xe959('0x31')][_0xe959('0x3c')]+'%'};return _0x3103c0;})});}_0x47008d=_[_0xe959('0x3d')]({},_0x47008d,_0x285abd[_0xe959('0x3f')]);var _0x1dc7c0={'where':_0x47008d[_0xe959('0x3a')]};return db[_0xe959('0x2c')][_0xe959('0x20')](_0x1dc7c0)[_0xe959('0x28')](function(_0x4e3e61){_0xd5e5dc[_0xe959('0x20')]=_0x4e3e61;if(_0x285abd[_0xe959('0x31')][_0xe959('0x44')]){_0x47008d[_0xe959('0x40')]=[{'all':!![]}];}return db[_0xe959('0x2c')][_0xe959('0x4c')](_0x47008d);})[_0xe959('0x28')](function(_0x1a15f7){_0xd5e5dc[_0xe959('0x41')]=_0x1a15f7;return _0xd5e5dc;})['then'](respondWithFilteredResult(_0x2c0857,_0x47008d,_0xe959('0x4d')))['catch'](handleError(_0x2c0857,null,_0xe959('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index cb2c459..d46bede 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 _0x7bbb=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit'];(function(_0x57b600,_0xa0391a){var _0xf7d47a=function(_0x10f7da){while(--_0x10f7da){_0x57b600['push'](_0x57b600['shift']());}};_0xf7d47a(++_0xa0391a);}(_0x7bbb,0x1d3));var _0xb7bb=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7bbb[_0x8de54f];return _0x14cba4;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xb7bb('0x0'))['db'][_0xb7bb('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb7bb('0x2')](0x0);var events={'afterCreate':_0xb7bb('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4df3d3){return function(_0x2da90c,_0x4a6896,_0x539d40){VoiceQueueReportEvents[_0xb7bb('0x4')](_0x4df3d3+':'+_0x2da90c['id'],_0x2da90c);VoiceQueueReportEvents[_0xb7bb('0x4')](_0x4df3d3,_0x2da90c);_0x539d40(null);};}for(var e in events){if(events[_0xb7bb('0x5')](e)){var event=events[e];VoiceQueueReport[_0xb7bb('0x6')](e,emitEvent(event));}}module[_0xb7bb('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x31dd=['events','VoiceQueueReport','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3f06e3,_0x19818f){var _0x1be1a5=function(_0x5babdd){while(--_0x5babdd){_0x3f06e3['push'](_0x3f06e3['shift']());}};_0x1be1a5(++_0x19818f);}(_0x31dd,0xb8));var _0xd31d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x31dd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd31d('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xd31d('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd31d('0x2'),'afterDestroy':_0xd31d('0x3')};function emitEvent(_0x1eefc8){return function(_0x4d822d,_0x8da79e,_0x56830b){VoiceQueueReportEvents['emit'](_0x1eefc8+':'+_0x4d822d['id'],_0x4d822d);VoiceQueueReportEvents[_0xd31d('0x4')](_0x1eefc8,_0x4d822d);_0x56830b(null);};}for(var e in events){if(events[_0xd31d('0x5')](e)){var event=events[e];VoiceQueueReport[_0xd31d('0x6')](e,emitEvent(event));}}module[_0xd31d('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c04bbe3..909e158 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 _0xbb07=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','VoiceQueueReport','report_queue','lodash','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbb07,0x166));var _0x7bb0=function(_0x3cf1ad,_0x5a153d){_0x3cf1ad=_0x3cf1ad-0x0;var _0x481ca3=_0xbb07[_0x3cf1ad];return _0x481ca3;};'use strict';var _=require(_0x7bb0('0x0'));var util=require(_0x7bb0('0x1'));var logger=require('../../config/logger')(_0x7bb0('0x2'));var moment=require(_0x7bb0('0x3'));var BPromise=require(_0x7bb0('0x4'));var rp=require(_0x7bb0('0x5'));var fs=require('fs');var path=require(_0x7bb0('0x6'));var rimraf=require(_0x7bb0('0x7'));var config=require(_0x7bb0('0x8'));var attributes=require(_0x7bb0('0x9'));module['exports']=function(_0x557ae2,_0x252056){return _0x557ae2['define'](_0x7bb0('0xa'),attributes,{'tableName':_0x7bb0('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9963=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util'];(function(_0x118f69,_0x4f569d){var _0x48e068=function(_0x4ab786){while(--_0x4ab786){_0x118f69['push'](_0x118f69['shift']());}};_0x48e068(++_0x4f569d);}(_0x9963,0x1c0));var _0x3996=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x9963[_0x474d97];return _0x1edf25;};'use strict';var _=require(_0x3996('0x0'));var util=require(_0x3996('0x1'));var logger=require(_0x3996('0x2'))('api');var moment=require(_0x3996('0x3'));var BPromise=require(_0x3996('0x4'));var rp=require(_0x3996('0x5'));var fs=require('fs');var path=require(_0x3996('0x6'));var rimraf=require('rimraf');var config=require(_0x3996('0x7'));var attributes=require(_0x3996('0x8'));module[_0x3996('0x9')]=function(_0x2dc83c,_0x246aaf){return _0x2dc83c[_0x3996('0xa')](_0x3996('0xb'),attributes,{'tableName':_0x3996('0xc'),'paranoid':![],'indexes':[{'fields':[_0x3996('0xd')]},{'fields':[_0x3996('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 1fc3c02..0f83c93 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 _0xaa63=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','VoiceQueueReport','options','raw','where','map','include','attributes','model','GetVoiceQueueReport','stringify','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then'];(function(_0x18b81b,_0x4b36c0){var _0x8f9452=function(_0x41633c){while(--_0x41633c){_0x18b81b['push'](_0x18b81b['shift']());}};_0x8f9452(++_0x4b36c0);}(_0xaa63,0x127));var _0x3aa6=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0xaa63[_0x2feb53];return _0x5700ee;};'use strict';var _=require(_0x3aa6('0x0'));var util=require(_0x3aa6('0x1'));var moment=require(_0x3aa6('0x2'));var BPromise=require(_0x3aa6('0x3'));var rs=require(_0x3aa6('0x4'));var fs=require('fs');var Redis=require(_0x3aa6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3aa6('0x6'));var logger=require(_0x3aa6('0x7'))(_0x3aa6('0x8'));var config=require(_0x3aa6('0x9'));var jayson=require(_0x3aa6('0xa'));var client=jayson[_0x3aa6('0xb')]['http']({'port':0x232a});config[_0x3aa6('0xc')]=_[_0x3aa6('0xd')](config[_0x3aa6('0xc')],{'host':_0x3aa6('0xe'),'port':0x18eb});var socket=require(_0x3aa6('0xf'))(new Redis(config[_0x3aa6('0xc')]));require(_0x3aa6('0x10'))[_0x3aa6('0x11')](socket);function respondWithRpcPromise(_0x5a0e,_0xd223eb,_0x27fe87){return new BPromise(function(_0x5e6ebc,_0x19dbe7){return client[_0x3aa6('0x12')](_0x5a0e,_0x27fe87)[_0x3aa6('0x13')](function(_0x2dba95){logger['info'](_0x3aa6('0x14'),_0xd223eb,_0x3aa6('0x15'));logger[_0x3aa6('0x16')](_0x3aa6('0x17'),_0xd223eb,_0x3aa6('0x15'),JSON['stringify'](_0x2dba95));if(_0x2dba95[_0x3aa6('0x18')]){if(_0x2dba95[_0x3aa6('0x18')][_0x3aa6('0x19')]===0x1f4){logger['error'](_0x3aa6('0x14'),_0xd223eb,_0x2dba95[_0x3aa6('0x18')][_0x3aa6('0x1a')]);return _0x19dbe7(_0x2dba95[_0x3aa6('0x18')][_0x3aa6('0x1a')]);}logger[_0x3aa6('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0xd223eb,_0x2dba95[_0x3aa6('0x18')][_0x3aa6('0x1a')]);return _0x5e6ebc(_0x2dba95['error'][_0x3aa6('0x1a')]);}else{logger[_0x3aa6('0x1b')]('VoiceQueueReport,\x20%s,\x20%s',_0xd223eb,_0x3aa6('0x15'));_0x5e6ebc(_0x2dba95[_0x3aa6('0x1c')][_0x3aa6('0x1a')]);}})['catch'](function(_0x289680){logger[_0x3aa6('0x18')](_0x3aa6('0x14'),_0xd223eb,_0x289680);_0x19dbe7(_0x289680);});});}exports['GetVoiceQueueReport']=function(_0x14e934){var _0x14e4d8=this;return new Promise(function(_0x495d06,_0x5a353b){return db[_0x3aa6('0x1d')]['findAll']({'raw':_0x14e934[_0x3aa6('0x1e')]?_0x14e934[_0x3aa6('0x1e')][_0x3aa6('0x1f')]===undefined?!![]:![]:!![],'where':_0x14e934[_0x3aa6('0x1e')]?_0x14e934[_0x3aa6('0x1e')][_0x3aa6('0x20')]||null:null,'attributes':_0x14e934[_0x3aa6('0x1e')]?_0x14e934[_0x3aa6('0x1e')]['attributes']||null:null,'limit':_0x14e934[_0x3aa6('0x1e')]?_0x14e934[_0x3aa6('0x1e')]['limit']||null:null,'include':_0x14e934[_0x3aa6('0x1e')]?_0x14e934['options']['include']?_[_0x3aa6('0x21')](_0x14e934['options'][_0x3aa6('0x22')],function(_0x2c611f){return{'model':db[_0x2c611f['model']],'as':_0x2c611f['as'],'attributes':_0x2c611f[_0x3aa6('0x23')],'include':_0x2c611f['include']?_[_0x3aa6('0x21')](_0x2c611f[_0x3aa6('0x22')],function(_0x40e97f){return{'model':db[_0x40e97f[_0x3aa6('0x24')]],'as':_0x40e97f['as'],'attributes':_0x40e97f[_0x3aa6('0x23')],'include':_0x40e97f[_0x3aa6('0x22')]?_['map'](_0x40e97f[_0x3aa6('0x22')],function(_0x1fe1b1){return{'model':db[_0x1fe1b1[_0x3aa6('0x24')]],'as':_0x1fe1b1['as'],'attributes':_0x1fe1b1[_0x3aa6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3aa6('0x13')](function(_0x36bf14){logger[_0x3aa6('0x1b')](_0x3aa6('0x25'),_0x14e934);logger[_0x3aa6('0x16')](_0x3aa6('0x25'),_0x14e934,JSON[_0x3aa6('0x26')](_0x36bf14));_0x495d06(_0x36bf14);})[_0x3aa6('0x27')](function(_0xed3cc7){logger[_0x3aa6('0x18')](_0x3aa6('0x25'),_0xed3cc7[_0x3aa6('0x1a')],_0x14e934);_0x5a353b(_0x14e4d8[_0x3aa6('0x18')](0x1f4,_0xed3cc7[_0x3aa6('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x30e8d6){var _0x41229c=this;return new Promise(function(_0x4dca88,_0x2a5bc7){return db[_0x3aa6('0x1d')][_0x3aa6('0x28')](_0x30e8d6[_0x3aa6('0x29')],{'raw':_0x30e8d6[_0x3aa6('0x1e')]?_0x30e8d6[_0x3aa6('0x1e')][_0x3aa6('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3db392){logger['info'](_0x3aa6('0x2a'),_0x30e8d6);logger[_0x3aa6('0x16')](_0x3aa6('0x2a'),_0x30e8d6,JSON[_0x3aa6('0x26')](_0x3db392));_0x4dca88(_0x3db392);})['catch'](function(_0x221333){logger[_0x3aa6('0x18')]('CreateVoiceQueueReport',_0x221333[_0x3aa6('0x1a')],_0x30e8d6);_0x2a5bc7(_0x41229c[_0x3aa6('0x18')](0x1f4,_0x221333[_0x3aa6('0x1a')]));});});};exports[_0x3aa6('0x2b')]=function(_0x2ca777){var _0x528982=this;return new Promise(function(_0x3906d6,_0x12e39a){return db[_0x3aa6('0x1d')][_0x3aa6('0x2c')](_0x2ca777[_0x3aa6('0x29')],{'raw':_0x2ca777[_0x3aa6('0x1e')]?_0x2ca777['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca777[_0x3aa6('0x1e')]?_0x2ca777[_0x3aa6('0x1e')][_0x3aa6('0x20')]||null:null,'attributes':_0x2ca777[_0x3aa6('0x1e')]?_0x2ca777[_0x3aa6('0x1e')][_0x3aa6('0x23')]||null:null,'limit':_0x2ca777[_0x3aa6('0x1e')]?_0x2ca777[_0x3aa6('0x1e')]['limit']||null:null})[_0x3aa6('0x13')](function(_0x4f320f){logger[_0x3aa6('0x1b')](_0x3aa6('0x2b'),_0x2ca777);logger[_0x3aa6('0x16')](_0x3aa6('0x2b'),_0x2ca777,JSON[_0x3aa6('0x26')](_0x4f320f));_0x3906d6(_0x4f320f);})[_0x3aa6('0x27')](function(_0x14c6ec){logger[_0x3aa6('0x18')](_0x3aa6('0x2b'),_0x14c6ec[_0x3aa6('0x1a')],_0x2ca777);_0x12e39a(_0x528982[_0x3aa6('0x18')](0x1f4,_0x14c6ec[_0x3aa6('0x1a')]));});});}; \ No newline at end of file +var _0xd031=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueReport','findAll','options','raw','limit','include','map','model','attributes','info','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','debug'];(function(_0x47497d,_0x20b467){var _0x2ea5e5=function(_0x587fb5){while(--_0x587fb5){_0x47497d['push'](_0x47497d['shift']());}};_0x2ea5e5(++_0x20b467);}(_0xd031,0x191));var _0x1d03=function(_0x253e27,_0x18b655){_0x253e27=_0x253e27-0x0;var _0x40e4f3=_0xd031[_0x253e27];return _0x40e4f3;};'use strict';var _=require('lodash');var util=require(_0x1d03('0x0'));var moment=require(_0x1d03('0x1'));var BPromise=require(_0x1d03('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d03('0x3'))['db'];var utils=require(_0x1d03('0x4'));var logger=require(_0x1d03('0x5'))('rpc');var config=require(_0x1d03('0x6'));var jayson=require(_0x1d03('0x7'));var client=jayson[_0x1d03('0x8')][_0x1d03('0x9')]({'port':0x232a});config[_0x1d03('0xa')]=_[_0x1d03('0xb')](config[_0x1d03('0xa')],{'host':_0x1d03('0xc'),'port':0x18eb});var socket=require(_0x1d03('0xd'))(new Redis(config[_0x1d03('0xa')]));require(_0x1d03('0xe'))[_0x1d03('0xf')](socket);function respondWithRpcPromise(_0x54d3f7,_0x4f8d40,_0x5a321f){return new BPromise(function(_0x153f00,_0x3a6901){return client['request'](_0x54d3f7,_0x5a321f)[_0x1d03('0x10')](function(_0x1c1e47){logger['info'](_0x1d03('0x11'),_0x4f8d40,'request\x20sent');logger[_0x1d03('0x12')](_0x1d03('0x13'),_0x4f8d40,_0x1d03('0x14'),JSON[_0x1d03('0x15')](_0x1c1e47));if(_0x1c1e47['error']){if(_0x1c1e47[_0x1d03('0x16')][_0x1d03('0x17')]===0x1f4){logger[_0x1d03('0x16')](_0x1d03('0x11'),_0x4f8d40,_0x1c1e47[_0x1d03('0x16')]['message']);return _0x3a6901(_0x1c1e47[_0x1d03('0x16')][_0x1d03('0x18')]);}logger[_0x1d03('0x16')](_0x1d03('0x11'),_0x4f8d40,_0x1c1e47['error'][_0x1d03('0x18')]);return _0x153f00(_0x1c1e47[_0x1d03('0x16')][_0x1d03('0x18')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x4f8d40,'request\x20sent');_0x153f00(_0x1c1e47['result']['message']);}})[_0x1d03('0x19')](function(_0x5942c0){logger[_0x1d03('0x16')](_0x1d03('0x11'),_0x4f8d40,_0x5942c0);_0x3a6901(_0x5942c0);});});}exports[_0x1d03('0x1a')]=function(_0x5cb87c){var _0x4ee4a8=this;return new Promise(function(_0x16095b,_0x4eb786){return db['VoiceQueueReport'][_0x1d03('0x1b')]({'raw':_0x5cb87c[_0x1d03('0x1c')]?_0x5cb87c[_0x1d03('0x1c')][_0x1d03('0x1d')]===undefined?!![]:![]:!![],'where':_0x5cb87c[_0x1d03('0x1c')]?_0x5cb87c['options']['where']||null:null,'attributes':_0x5cb87c[_0x1d03('0x1c')]?_0x5cb87c[_0x1d03('0x1c')]['attributes']||null:null,'limit':_0x5cb87c[_0x1d03('0x1c')]?_0x5cb87c['options'][_0x1d03('0x1e')]||null:null,'include':_0x5cb87c[_0x1d03('0x1c')]?_0x5cb87c[_0x1d03('0x1c')][_0x1d03('0x1f')]?_[_0x1d03('0x20')](_0x5cb87c[_0x1d03('0x1c')][_0x1d03('0x1f')],function(_0x3165f3){return{'model':db[_0x3165f3[_0x1d03('0x21')]],'as':_0x3165f3['as'],'attributes':_0x3165f3['attributes'],'include':_0x3165f3[_0x1d03('0x1f')]?_[_0x1d03('0x20')](_0x3165f3[_0x1d03('0x1f')],function(_0x38bf75){return{'model':db[_0x38bf75[_0x1d03('0x21')]],'as':_0x38bf75['as'],'attributes':_0x38bf75[_0x1d03('0x22')],'include':_0x38bf75[_0x1d03('0x1f')]?_[_0x1d03('0x20')](_0x38bf75['include'],function(_0x2a2018){return{'model':db[_0x2a2018[_0x1d03('0x21')]],'as':_0x2a2018['as'],'attributes':_0x2a2018['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d03('0x10')](function(_0xfcd184){logger[_0x1d03('0x23')]('GetVoiceQueueReport',_0x5cb87c);logger[_0x1d03('0x12')](_0x1d03('0x1a'),_0x5cb87c,JSON['stringify'](_0xfcd184));_0x16095b(_0xfcd184);})[_0x1d03('0x19')](function(_0x49fbd0){logger['error'](_0x1d03('0x1a'),_0x49fbd0['message'],_0x5cb87c);_0x4eb786(_0x4ee4a8[_0x1d03('0x16')](0x1f4,_0x49fbd0[_0x1d03('0x18')]));});});};exports[_0x1d03('0x24')]=function(_0x1cf400){var _0x426aea=this;return new Promise(function(_0x7de5ea,_0x3c6627){return db['VoiceQueueReport'][_0x1d03('0x25')](_0x1cf400[_0x1d03('0x26')],{'raw':_0x1cf400[_0x1d03('0x1c')]?_0x1cf400[_0x1d03('0x1c')][_0x1d03('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x8cb9a1){logger[_0x1d03('0x23')](_0x1d03('0x24'),_0x1cf400);logger[_0x1d03('0x12')]('CreateVoiceQueueReport',_0x1cf400,JSON['stringify'](_0x8cb9a1));_0x7de5ea(_0x8cb9a1);})[_0x1d03('0x19')](function(_0x2dfbe5){logger[_0x1d03('0x16')](_0x1d03('0x24'),_0x2dfbe5[_0x1d03('0x18')],_0x1cf400);_0x3c6627(_0x426aea[_0x1d03('0x16')](0x1f4,_0x2dfbe5[_0x1d03('0x18')]));});});};exports[_0x1d03('0x27')]=function(_0x5cf475){var _0x4a25c0=this;return new Promise(function(_0x522224,_0x15e51c){return db['VoiceQueueReport'][_0x1d03('0x28')](_0x5cf475['body'],{'raw':_0x5cf475[_0x1d03('0x1c')]?_0x5cf475[_0x1d03('0x1c')][_0x1d03('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf475['options']?_0x5cf475['options'][_0x1d03('0x29')]||null:null,'attributes':_0x5cf475[_0x1d03('0x1c')]?_0x5cf475['options'][_0x1d03('0x22')]||null:null,'limit':_0x5cf475[_0x1d03('0x1c')]?_0x5cf475[_0x1d03('0x1c')][_0x1d03('0x1e')]||null:null})['then'](function(_0x3e9eba){logger[_0x1d03('0x23')](_0x1d03('0x27'),_0x5cf475);logger['debug'](_0x1d03('0x27'),_0x5cf475,JSON['stringify'](_0x3e9eba));_0x522224(_0x3e9eba);})[_0x1d03('0x19')](function(_0x2839d6){logger[_0x1d03('0x16')](_0x1d03('0x27'),_0x2839d6[_0x1d03('0x18')],_0x5cf475);_0x15e51c(_0x4a25c0['error'](0x1f4,_0x2839d6[_0x1d03('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 638d9f0..b2ce6d2 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 _0xe8a1=['save','remove','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xe8a1,0xad));var _0x1e8a=function(_0x28a4e5,_0x5c251d){_0x28a4e5=_0x28a4e5-0x0;var _0xdb860f=_0xe8a1[_0x28a4e5];return _0xdb860f;};'use strict';var VoiceQueueReportEvents=require(_0x1e8a('0x0'));var events=[_0x1e8a('0x1'),_0x1e8a('0x2'),'update'];function createListener(_0x2f4060,_0x4b22e2){return function(_0x3142e6){_0x4b22e2['emit'](_0x2f4060,_0x3142e6);};}function removeListener(_0x3d2731,_0x48e299){return function(){VoiceQueueReportEvents['removeListener'](_0x3d2731,_0x48e299);};}exports[_0x1e8a('0x3')]=function(_0x32e924){for(var _0x3fe04c=0x0,_0x108e52=events[_0x1e8a('0x4')];_0x3fe04c<_0x108e52;_0x3fe04c++){var _0xe517d3=events[_0x3fe04c];var _0x35368e=createListener(_0x1e8a('0x5')+_0xe517d3,_0x32e924);VoiceQueueReportEvents['on'](_0xe517d3,_0x35368e);}}; \ No newline at end of file +var _0x0d4e=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x86a321,_0x4c3abe){var _0x2be869=function(_0x366997){while(--_0x366997){_0x86a321['push'](_0x86a321['shift']());}};_0x2be869(++_0x4c3abe);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0d4e[_0x2c91e9];return _0x13f0ff;};'use strict';var VoiceQueueReportEvents=require(_0xe0d4('0x0'));var events=[_0xe0d4('0x1'),_0xe0d4('0x2'),_0xe0d4('0x3')];function createListener(_0x37586a,_0xe383c4){return function(_0xbfd24e){_0xe383c4[_0xe0d4('0x4')](_0x37586a,_0xbfd24e);};}function removeListener(_0x251804,_0x56b43f){return function(){VoiceQueueReportEvents[_0xe0d4('0x5')](_0x251804,_0x56b43f);};}exports[_0xe0d4('0x6')]=function(_0x2cc782){for(var _0x25bdbe=0x0,_0x54a11f=events['length'];_0x25bdbe<_0x54a11f;_0x25bdbe++){var _0x312e09=events[_0x25bdbe];var _0x1ba14d=createListener(_0xe0d4('0x7')+_0x312e09,_0x2cc782);VoiceQueueReportEvents['on'](_0x312e09,_0x1ba14d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8157cbe..f3165fb 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 _0x06fe=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','put','update','destroy','exports'];(function(_0x1fc1ac,_0x344da0){var _0x55b1e9=function(_0x1254b0){while(--_0x1254b0){_0x1fc1ac['push'](_0x1fc1ac['shift']());}};_0x55b1e9(++_0x344da0);}(_0x06fe,0xff));var _0xe06f=function(_0x11bc40,_0x537bbc){_0x11bc40=_0x11bc40-0x0;var _0x2b7a99=_0x06fe[_0x11bc40];return _0x2b7a99;};'use strict';var multer=require(_0xe06f('0x0'));var util=require('util');var path=require(_0xe06f('0x1'));var timeout=require('connect-timeout');var express=require(_0xe06f('0x2'));var router=express[_0xe06f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe06f('0x4'));var interaction=require(_0xe06f('0x5'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0xe06f('0x6')]('/',auth[_0xe06f('0x7')](),controller[_0xe06f('0x8')]);router[_0xe06f('0x6')](_0xe06f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe06f('0xa')]('/',auth[_0xe06f('0x7')](),controller['create']);router[_0xe06f('0xb')](_0xe06f('0x9'),auth['isAuthenticated'](),controller[_0xe06f('0xc')]);router['delete']('/:id',auth[_0xe06f('0x7')](),controller[_0xe06f('0xd')]);module[_0xe06f('0xe')]=router; \ No newline at end of file +var _0x88c0=['isAuthenticated','post','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x493f2b,_0x4948cf){var _0x1f36d0=function(_0x320268){while(--_0x320268){_0x493f2b['push'](_0x493f2b['shift']());}};_0x1f36d0(++_0x4948cf);}(_0x88c0,0x149));var _0x088c=function(_0x20360a,_0x5bb3e4){_0x20360a=_0x20360a-0x0;var _0x4bc94e=_0x88c0[_0x20360a];return _0x4bc94e;};'use strict';var multer=require('multer');var util=require(_0x088c('0x0'));var path=require(_0x088c('0x1'));var timeout=require(_0x088c('0x2'));var express=require(_0x088c('0x3'));var router=express[_0x088c('0x4')]();var fs_extra=require(_0x088c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x088c('0x6'));var config=require(_0x088c('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x088c('0x8')]('/',auth['isAuthenticated'](),controller[_0x088c('0x9')]);router[_0x088c('0x8')](_0x088c('0xa'),auth[_0x088c('0xb')](),controller['show']);router[_0x088c('0xc')]('/',auth[_0x088c('0xb')](),controller[_0x088c('0xd')]);router['put'](_0x088c('0xa'),auth['isAuthenticated'](),controller[_0x088c('0xe')]);router[_0x088c('0xf')](_0x088c('0xa'),auth[_0x088c('0xb')](),controller['destroy']);module[_0x088c('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index ac3b9a7..24acd4c 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 _0x5314=['STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x39729c,_0x1f0b88){var _0x534d40=function(_0x384813){while(--_0x384813){_0x39729c['push'](_0x39729c['shift']());}};_0x534d40(++_0x1f0b88);}(_0x5314,0x17a));var _0x4531=function(_0x3543b5,_0x596023){_0x3543b5=_0x3543b5-0x0;var _0x2fa9cd=_0x5314[_0x3543b5];return _0x2fa9cd;};'use strict';var Sequelize=require(_0x4531('0x0'));var moment=require('moment');module[_0x4531('0x1')]={'time':{'type':Sequelize[_0x4531('0x2')]},'callid':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4531('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0x4531('0x3'))}}; \ No newline at end of file +var _0xa1de=['moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x2b05bf,_0x1cc994){var _0x47ae39=function(_0x12d2bb){while(--_0x12d2bb){_0x2b05bf['push'](_0x2b05bf['shift']());}};_0x47ae39(++_0x1cc994);}(_0xa1de,0x1b8));var _0xea1d=function(_0x40c402,_0x42ee7d){_0x40c402=_0x40c402-0x0;var _0x4e7680=_0xa1de[_0x40c402];return _0x4e7680;};'use strict';var Sequelize=require(_0xea1d('0x0'));var moment=require(_0xea1d('0x1'));module[_0xea1d('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xea1d('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xea1d('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xea1d('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xea1d('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xea1d('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xea1d('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xea1d('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xea1d('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xea1d('0x5')](_0xea1d('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f8f5aaa..af1d17c 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 _0xae1a=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xae1a,0x1ea));var _0xaae1=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xae1a[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0xaae1('0x0'));var rimraf=require(_0xaae1('0x1'));var zipdir=require(_0xaae1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaae1('0x3'));var moment=require(_0xaae1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaae1('0x5'));var util=require(_0xaae1('0x6'));var path=require(_0xaae1('0x7'));var sox=require(_0xaae1('0x8'));var csv=require(_0xaae1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaae1('0xa'));var squel=require(_0xaae1('0xb'));var crypto=require(_0xaae1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaae1('0xd'));var toCsv=require(_0xaae1('0x9'));var querystring=require(_0xaae1('0xe'));var Papa=require(_0xaae1('0xf'));var Redis=require('ioredis');var authService=require(_0xaae1('0x10'));var qs=require(_0xaae1('0x11'));var as=require(_0xaae1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaae1('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e37bb,_0x4e48f5){_0x4e48f5=_0x4e48f5||0xcc;return function(_0x130295){if(_0x130295){return _0x4e37bb[_0xaae1('0x14')](_0x4e48f5);}return _0x4e37bb[_0xaae1('0x15')](_0x4e48f5)[_0xaae1('0x16')]();};}function respondWithResult(_0x3c42c9,_0xaf698a){_0xaf698a=_0xaf698a||0xc8;return function(_0x1eb471){if(_0x1eb471){return _0x3c42c9[_0xaae1('0x15')](_0xaf698a)[_0xaae1('0x17')](_0x1eb471);}};}function respondWithFilteredResult(_0x30a0b3,_0x5a1404){return function(_0x541891){if(_0x541891){var _0x245db8=typeof _0x5a1404[_0xaae1('0x18')]==='undefined'&&typeof _0x5a1404['limit']===_0xaae1('0x19');var _0x50b0b1=_0x541891[_0xaae1('0x1a')];var _0x39ed26=_0x245db8?0x0:_0x5a1404[_0xaae1('0x18')];var _0x4aad0b=_0x245db8?_0x541891[_0xaae1('0x1a')]:_0x5a1404[_0xaae1('0x18')]+_0x5a1404[_0xaae1('0x1b')];var _0x3a041e;if(_0x4aad0b>=_0x50b0b1){_0x4aad0b=_0x50b0b1;_0x3a041e=0xc8;}else{_0x3a041e=0xce;}_0x30a0b3[_0xaae1('0x15')](_0x3a041e);return _0x30a0b3[_0xaae1('0x1c')](_0xaae1('0x1d'),_0x39ed26+'-'+_0x4aad0b+'/'+_0x50b0b1)[_0xaae1('0x17')](_0x541891);}return null;};}function patchUpdates(_0x26675c){return function(_0x2ba312){try{jsonpatch[_0xaae1('0x1e')](_0x2ba312,_0x26675c,!![]);}catch(_0x5a3448){return BPromise[_0xaae1('0x1f')](_0x5a3448);}return _0x2ba312[_0xaae1('0x20')]();};}function saveUpdates(_0x280eef,_0x1c8afc){return function(_0x692198){if(_0x692198){return _0x692198[_0xaae1('0x21')](_0x280eef)[_0xaae1('0x22')](function(_0x24fa7c){return _0x24fa7c;});}return null;};}function removeEntity(_0x2bd104,_0x2b44ef){return function(_0x570239){if(_0x570239){return _0x570239[_0xaae1('0x23')]()[_0xaae1('0x22')](function(){_0x2bd104[_0xaae1('0x15')](0xcc)[_0xaae1('0x16')]();});}};}function handleEntityNotFound(_0x3bb94d,_0x2f6762){return function(_0x3394c0){if(!_0x3394c0){_0x3bb94d[_0xaae1('0x14')](0x194);}return _0x3394c0;};}function handleError(_0x588d5d,_0x253c5c){_0x253c5c=_0x253c5c||0x1f4;return function(_0x4dc789){logger[_0xaae1('0x24')](_0x4dc789['stack']);if(_0x4dc789[_0xaae1('0x25')]){delete _0x4dc789[_0xaae1('0x25')];}_0x588d5d['status'](_0x253c5c)[_0xaae1('0x26')](_0x4dc789);};}exports[_0xaae1('0x27')]=function(_0x9aa426,_0x1d51ca){var _0x453376={},_0x2bdea7={},_0x221a49={'count':0x0,'rows':[]};var _0x4941d0=_[_0xaae1('0x28')](db[_0xaae1('0x29')][_0xaae1('0x2a')],function(_0x582d99){return{'name':_0x582d99['fieldName'],'type':_0x582d99[_0xaae1('0x2b')][_0xaae1('0x2c')]};});_0x2bdea7['model']=_['map'](_0x4941d0,'name');_0x2bdea7[_0xaae1('0x2d')]=_[_0xaae1('0x2e')](_0x9aa426[_0xaae1('0x2d')]);_0x2bdea7['filters']=_[_0xaae1('0x2f')](_0x2bdea7[_0xaae1('0x30')],_0x2bdea7[_0xaae1('0x2d')]);_0x453376[_0xaae1('0x31')]=_['intersection'](_0x2bdea7['model'],qs[_0xaae1('0x32')](_0x9aa426[_0xaae1('0x2d')][_0xaae1('0x32')]));_0x453376[_0xaae1('0x31')]=_0x453376['attributes'][_0xaae1('0x33')]?_0x453376[_0xaae1('0x31')]:_0x2bdea7[_0xaae1('0x30')];if(!_0x9aa426[_0xaae1('0x2d')][_0xaae1('0x34')](_0xaae1('0x35'))){_0x453376[_0xaae1('0x1b')]=qs[_0xaae1('0x1b')](_0x9aa426[_0xaae1('0x2d')][_0xaae1('0x1b')]);_0x453376[_0xaae1('0x18')]=qs['offset'](_0x9aa426[_0xaae1('0x2d')][_0xaae1('0x18')]);}_0x453376[_0xaae1('0x36')]=qs['sort'](_0x9aa426[_0xaae1('0x2d')][_0xaae1('0x37')]);_0x453376['where']=qs[_0xaae1('0x38')](_[_0xaae1('0x39')](_0x9aa426[_0xaae1('0x2d')],_0x2bdea7[_0xaae1('0x38')]),_0x4941d0);if(_0x9aa426['query'][_0xaae1('0x3a')]){_0x453376[_0xaae1('0x3b')]=_[_0xaae1('0x3c')](_0x453376[_0xaae1('0x3b')],{'$or':_['map'](_0x4941d0,function(_0x597627){if(_0x597627['type']!==_0xaae1('0x3d')){var _0x47be9c={};_0x47be9c[_0x597627[_0xaae1('0x25')]]={'$like':'%'+_0x9aa426[_0xaae1('0x2d')]['filter']+'%'};return _0x47be9c;}})});}_0x453376=_[_0xaae1('0x3c')]({},_0x453376,_0x9aa426[_0xaae1('0x3e')]);var _0x1b417f={'where':_0x453376[_0xaae1('0x3b')]};return db[_0xaae1('0x29')][_0xaae1('0x1a')](_0x1b417f)['then'](function(_0x1db745){_0x221a49['count']=_0x1db745;if(_0x9aa426[_0xaae1('0x2d')][_0xaae1('0x3f')]){_0x453376[_0xaae1('0x40')]=[{'all':!![]}];}return db[_0xaae1('0x29')][_0xaae1('0x41')](_0x453376);})['then'](function(_0x2fb084){_0x221a49['rows']=_0x2fb084;return _0x221a49;})[_0xaae1('0x22')](respondWithFilteredResult(_0x1d51ca,_0x453376))[_0xaae1('0x42')](handleError(_0x1d51ca,null));};exports[_0xaae1('0x43')]=function(_0x86ae5b,_0xfd3751){var _0x4ebc4c={'raw':!![],'where':{'id':_0x86ae5b[_0xaae1('0x44')]['id']}},_0x4a83da={};_0x4a83da[_0xaae1('0x30')]=_[_0xaae1('0x2e')](db['VoiceQueuesLog']['rawAttributes']);_0x4a83da[_0xaae1('0x2d')]=_[_0xaae1('0x2e')](_0x86ae5b['query']);_0x4a83da['filters']=_[_0xaae1('0x2f')](_0x4a83da[_0xaae1('0x30')],_0x4a83da['query']);_0x4ebc4c[_0xaae1('0x31')]=_[_0xaae1('0x2f')](_0x4a83da[_0xaae1('0x30')],qs['fields'](_0x86ae5b['query'][_0xaae1('0x32')]));_0x4ebc4c[_0xaae1('0x31')]=_0x4ebc4c[_0xaae1('0x31')][_0xaae1('0x33')]?_0x4ebc4c[_0xaae1('0x31')]:_0x4a83da['model'];if(_0x86ae5b[_0xaae1('0x2d')][_0xaae1('0x3f')]){_0x4ebc4c['include']=[{'all':!![]}];}_0x4ebc4c=_[_0xaae1('0x3c')]({},_0x4ebc4c,_0x86ae5b[_0xaae1('0x3e')]);return db[_0xaae1('0x29')]['find'](_0x4ebc4c)[_0xaae1('0x22')](handleEntityNotFound(_0xfd3751,null))[_0xaae1('0x22')](respondWithResult(_0xfd3751,null))[_0xaae1('0x42')](handleError(_0xfd3751,null));};exports[_0xaae1('0x45')]=function(_0xbd783d,_0x283731){return db[_0xaae1('0x29')][_0xaae1('0x45')](_0xbd783d['body'],{})[_0xaae1('0x22')](respondWithResult(_0x283731,0xc9))['catch'](handleError(_0x283731,null));};exports['update']=function(_0x13e413,_0x97b52a){if(_0x13e413[_0xaae1('0x46')]['id']){delete _0x13e413['body']['id'];}return db[_0xaae1('0x29')]['find']({'where':{'id':_0x13e413[_0xaae1('0x44')]['id']}})[_0xaae1('0x22')](handleEntityNotFound(_0x97b52a,null))[_0xaae1('0x22')](saveUpdates(_0x13e413[_0xaae1('0x46')],null))['then'](respondWithResult(_0x97b52a,null))[_0xaae1('0x42')](handleError(_0x97b52a,null));};exports['destroy']=function(_0x5edcb9,_0x2cfad8){return db['VoiceQueuesLog'][_0xaae1('0x47')]({'where':{'id':_0x5edcb9[_0xaae1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cfad8,null))['then'](removeEntity(_0x2cfad8,null))[_0xaae1('0x42')](handleError(_0x2cfad8,null));}; \ No newline at end of file +var _0x9553=['mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x39c7c4,_0x58d54e){var _0xef9b43=function(_0x5074db){while(--_0x5074db){_0x39c7c4['push'](_0x39c7c4['shift']());}};_0xef9b43(++_0x58d54e);}(_0x9553,0x9b));var _0x3955=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9553[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x3955('0x0'));var rimraf=require(_0x3955('0x1'));var zipdir=require(_0x3955('0x2'));var jsonpatch=require(_0x3955('0x3'));var rp=require(_0x3955('0x4'));var moment=require(_0x3955('0x5'));var BPromise=require(_0x3955('0x6'));var Mustache=require(_0x3955('0x7'));var util=require(_0x3955('0x8'));var path=require(_0x3955('0x9'));var sox=require(_0x3955('0xa'));var csv=require('to-csv');var ejs=require(_0x3955('0xb'));var fs=require('fs');var fs_extra=require(_0x3955('0xc'));var _=require(_0x3955('0xd'));var squel=require(_0x3955('0xe'));var crypto=require('crypto');var jsforce=require(_0x3955('0xf'));var deskjs=require(_0x3955('0x10'));var toCsv=require(_0x3955('0x11'));var querystring=require(_0x3955('0x12'));var Papa=require(_0x3955('0x13'));var Redis=require(_0x3955('0x14'));var authService=require(_0x3955('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x3955('0x16'));var hardwareService=require(_0x3955('0x17'));var logger=require(_0x3955('0x18'))(_0x3955('0x19'));var utils=require(_0x3955('0x1a'));var config=require(_0x3955('0x1b'));var licenseUtil=require(_0x3955('0x1c'));var db=require(_0x3955('0x1d'))['db'];function respondWithStatusCode(_0x24e9f5,_0xbe2763){_0xbe2763=_0xbe2763||0xcc;return function(_0x58cc7a){if(_0x58cc7a){return _0x24e9f5[_0x3955('0x1e')](_0xbe2763);}return _0x24e9f5[_0x3955('0x1f')](_0xbe2763)[_0x3955('0x20')]();};}function respondWithResult(_0x5b4c89,_0x3dd38e){_0x3dd38e=_0x3dd38e||0xc8;return function(_0x495c2c){if(_0x495c2c){return _0x5b4c89[_0x3955('0x1f')](_0x3dd38e)[_0x3955('0x21')](_0x495c2c);}};}function respondWithFilteredResult(_0x4cee2e,_0x168736){return function(_0x3fb20c){if(_0x3fb20c){var _0x217880=typeof _0x168736[_0x3955('0x22')]===_0x3955('0x23')&&typeof _0x168736[_0x3955('0x24')]===_0x3955('0x23');var _0x2bece2=_0x3fb20c[_0x3955('0x25')];var _0x52b0d3=_0x217880?0x0:_0x168736[_0x3955('0x22')];var _0x3a1451=_0x217880?_0x3fb20c['count']:_0x168736['offset']+_0x168736[_0x3955('0x24')];var _0x40acbf;if(_0x3a1451>=_0x2bece2){_0x3a1451=_0x2bece2;_0x40acbf=0xc8;}else{_0x40acbf=0xce;}_0x4cee2e['status'](_0x40acbf);return _0x4cee2e['set'](_0x3955('0x26'),_0x52b0d3+'-'+_0x3a1451+'/'+_0x2bece2)['json'](_0x3fb20c);}return null;};}function patchUpdates(_0x40303c){return function(_0xc1bff5){try{jsonpatch[_0x3955('0x27')](_0xc1bff5,_0x40303c,!![]);}catch(_0x3520c1){return BPromise[_0x3955('0x28')](_0x3520c1);}return _0xc1bff5[_0x3955('0x29')]();};}function saveUpdates(_0x525920,_0x42bceb){return function(_0x5b931f){if(_0x5b931f){return _0x5b931f['update'](_0x525920)['then'](function(_0x30f35f){return _0x30f35f;});}return null;};}function removeEntity(_0x382922,_0x836fd0){return function(_0x4eb2e5){if(_0x4eb2e5){return _0x4eb2e5[_0x3955('0x2a')]()[_0x3955('0x2b')](function(){_0x382922[_0x3955('0x1f')](0xcc)[_0x3955('0x20')]();});}};}function handleEntityNotFound(_0x235fd7,_0x51b950){return function(_0x196a6f){if(!_0x196a6f){_0x235fd7[_0x3955('0x1e')](0x194);}return _0x196a6f;};}function handleError(_0x2dd1f4,_0x440d4b){_0x440d4b=_0x440d4b||0x1f4;return function(_0x18a7f1){logger[_0x3955('0x2c')](_0x18a7f1['stack']);if(_0x18a7f1[_0x3955('0x2d')]){delete _0x18a7f1[_0x3955('0x2d')];}_0x2dd1f4[_0x3955('0x1f')](_0x440d4b)[_0x3955('0x2e')](_0x18a7f1);};}exports[_0x3955('0x2f')]=function(_0x3137d1,_0x19a13b){var _0x1073dd={},_0x2ff38e={},_0x161be3={'count':0x0,'rows':[]};var _0x4e0c05=_['map'](db[_0x3955('0x30')][_0x3955('0x31')],function(_0xc9f470){return{'name':_0xc9f470[_0x3955('0x32')],'type':_0xc9f470[_0x3955('0x33')][_0x3955('0x34')]};});_0x2ff38e[_0x3955('0x35')]=_[_0x3955('0x36')](_0x4e0c05,_0x3955('0x2d'));_0x2ff38e['query']=_[_0x3955('0x37')](_0x3137d1[_0x3955('0x38')]);_0x2ff38e['filters']=_[_0x3955('0x39')](_0x2ff38e[_0x3955('0x35')],_0x2ff38e[_0x3955('0x38')]);_0x1073dd[_0x3955('0x3a')]=_['intersection'](_0x2ff38e[_0x3955('0x35')],qs[_0x3955('0x3b')](_0x3137d1[_0x3955('0x38')][_0x3955('0x3b')]));_0x1073dd[_0x3955('0x3a')]=_0x1073dd[_0x3955('0x3a')][_0x3955('0x3c')]?_0x1073dd[_0x3955('0x3a')]:_0x2ff38e[_0x3955('0x35')];if(!_0x3137d1[_0x3955('0x38')]['hasOwnProperty'](_0x3955('0x3d'))){_0x1073dd[_0x3955('0x24')]=qs[_0x3955('0x24')](_0x3137d1[_0x3955('0x38')]['limit']);_0x1073dd[_0x3955('0x22')]=qs['offset'](_0x3137d1[_0x3955('0x38')]['offset']);}_0x1073dd[_0x3955('0x3e')]=qs[_0x3955('0x3f')](_0x3137d1[_0x3955('0x38')][_0x3955('0x3f')]);_0x1073dd['where']=qs[_0x3955('0x40')](_['pick'](_0x3137d1[_0x3955('0x38')],_0x2ff38e[_0x3955('0x40')]),_0x4e0c05);if(_0x3137d1[_0x3955('0x38')][_0x3955('0x41')]){_0x1073dd[_0x3955('0x42')]=_[_0x3955('0x43')](_0x1073dd[_0x3955('0x42')],{'$or':_[_0x3955('0x36')](_0x4e0c05,function(_0x4c7f3e){if(_0x4c7f3e[_0x3955('0x33')]!==_0x3955('0x44')){var _0x3c355b={};_0x3c355b[_0x4c7f3e[_0x3955('0x2d')]]={'$like':'%'+_0x3137d1[_0x3955('0x38')][_0x3955('0x41')]+'%'};return _0x3c355b;}})});}_0x1073dd=_['merge']({},_0x1073dd,_0x3137d1[_0x3955('0x45')]);var _0x1d664a={'where':_0x1073dd[_0x3955('0x42')]};return db[_0x3955('0x30')][_0x3955('0x25')](_0x1d664a)[_0x3955('0x2b')](function(_0x32e817){_0x161be3[_0x3955('0x25')]=_0x32e817;if(_0x3137d1[_0x3955('0x38')][_0x3955('0x46')]){_0x1073dd[_0x3955('0x47')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x3955('0x48')](_0x1073dd);})['then'](function(_0x53dbb0){_0x161be3[_0x3955('0x49')]=_0x53dbb0;return _0x161be3;})[_0x3955('0x2b')](respondWithFilteredResult(_0x19a13b,_0x1073dd))[_0x3955('0x4a')](handleError(_0x19a13b,null));};exports[_0x3955('0x4b')]=function(_0x2d6e66,_0x5098c1){var _0x495b3d={'raw':!![],'where':{'id':_0x2d6e66[_0x3955('0x4c')]['id']}},_0x6fb2a0={};_0x6fb2a0['model']=_[_0x3955('0x37')](db[_0x3955('0x30')][_0x3955('0x31')]);_0x6fb2a0[_0x3955('0x38')]=_['keys'](_0x2d6e66[_0x3955('0x38')]);_0x6fb2a0['filters']=_[_0x3955('0x39')](_0x6fb2a0[_0x3955('0x35')],_0x6fb2a0[_0x3955('0x38')]);_0x495b3d['attributes']=_[_0x3955('0x39')](_0x6fb2a0[_0x3955('0x35')],qs[_0x3955('0x3b')](_0x2d6e66[_0x3955('0x38')][_0x3955('0x3b')]));_0x495b3d['attributes']=_0x495b3d[_0x3955('0x3a')][_0x3955('0x3c')]?_0x495b3d['attributes']:_0x6fb2a0[_0x3955('0x35')];if(_0x2d6e66[_0x3955('0x38')][_0x3955('0x46')]){_0x495b3d[_0x3955('0x47')]=[{'all':!![]}];}_0x495b3d=_[_0x3955('0x43')]({},_0x495b3d,_0x2d6e66['options']);return db['VoiceQueuesLog']['find'](_0x495b3d)[_0x3955('0x2b')](handleEntityNotFound(_0x5098c1,null))[_0x3955('0x2b')](respondWithResult(_0x5098c1,null))[_0x3955('0x4a')](handleError(_0x5098c1,null));};exports['create']=function(_0xbc2d3a,_0x11d9e9){return db['VoiceQueuesLog'][_0x3955('0x4d')](_0xbc2d3a[_0x3955('0x4e')],{})[_0x3955('0x2b')](respondWithResult(_0x11d9e9,0xc9))['catch'](handleError(_0x11d9e9,null));};exports[_0x3955('0x4f')]=function(_0x1204bf,_0x2c3000){if(_0x1204bf[_0x3955('0x4e')]['id']){delete _0x1204bf[_0x3955('0x4e')]['id'];}return db[_0x3955('0x30')][_0x3955('0x50')]({'where':{'id':_0x1204bf[_0x3955('0x4c')]['id']}})[_0x3955('0x2b')](handleEntityNotFound(_0x2c3000,null))[_0x3955('0x2b')](saveUpdates(_0x1204bf['body'],null))['then'](respondWithResult(_0x2c3000,null))[_0x3955('0x4a')](handleError(_0x2c3000,null));};exports[_0x3955('0x2a')]=function(_0x2d7096,_0x4e7344){return db['VoiceQueuesLog'][_0x3955('0x50')]({'where':{'id':_0x2d7096[_0x3955('0x4c')]['id']}})[_0x3955('0x2b')](handleEntityNotFound(_0x4e7344,null))[_0x3955('0x2b')](removeEntity(_0x4e7344,null))['catch'](handleError(_0x4e7344,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 4549c2e..f0bd152 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 _0x59e7=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event','dtm'];(function(_0x359849,_0x59f4de){var _0x25dcb0=function(_0x4e3633){while(--_0x4e3633){_0x359849['push'](_0x359849['shift']());}};_0x25dcb0(++_0x59f4de);}(_0x59e7,0x1ce));var _0x759e=function(_0x32e4b0,_0x15a633){_0x32e4b0=_0x32e4b0-0x0;var _0x1d84ba=_0x59e7[_0x32e4b0];return _0x1d84ba;};'use strict';var _=require('lodash');var util=require(_0x759e('0x0'));var logger=require('../../config/logger')(_0x759e('0x1'));var moment=require(_0x759e('0x2'));var BPromise=require(_0x759e('0x3'));var rp=require(_0x759e('0x4'));var fs=require('fs');var path=require(_0x759e('0x5'));var rimraf=require(_0x759e('0x6'));var config=require(_0x759e('0x7'));var attributes=require(_0x759e('0x8'));module['exports']=function(_0x32c87c,_0x5a73a5){return _0x32c87c[_0x759e('0x9')](_0x759e('0xa'),attributes,{'tableName':_0x759e('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x759e('0xc'),_0x759e('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x71c8=['exports','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','bluebird','path','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0x71c8,0x149));var _0x871c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x71c8[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x871c('0x0'));var util=require(_0x871c('0x1'));var logger=require(_0x871c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x871c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x871c('0x4'));var rimraf=require('rimraf');var config=require(_0x871c('0x5'));var attributes=require(_0x871c('0x6'));module[_0x871c('0x7')]=function(_0x225544,_0x412b3b){return _0x225544['define'](_0x871c('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x871c('0x9'),'fields':[_0x871c('0xa'),_0x871c('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index abe7b0e..6e85b9a 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 _0x12aa=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x459af0,_0x287e9e){var _0x5b75b3=function(_0x2da9a4){while(--_0x2da9a4){_0x459af0['push'](_0x459af0['shift']());}};_0x5b75b3(++_0x287e9e);}(_0x12aa,0x1a0));var _0xa12a=function(_0xe49138,_0x551d47){_0xe49138=_0xe49138-0x0;var _0x2613e9=_0x12aa[_0xe49138];return _0x2613e9;};'use strict';var _=require(_0xa12a('0x0'));var util=require(_0xa12a('0x1'));var moment=require('moment');var BPromise=require(_0xa12a('0x2'));var rs=require(_0xa12a('0x3'));var fs=require('fs');var Redis=require(_0xa12a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa12a('0x5'));var logger=require(_0xa12a('0x6'))('rpc');var config=require(_0xa12a('0x7'));var jayson=require(_0xa12a('0x8'));var client=jayson[_0xa12a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf785c7,_0x261987,_0xfc8356){return new BPromise(function(_0x5a6901,_0x365fa5){return client[_0xa12a('0xa')](_0xf785c7,_0xfc8356)[_0xa12a('0xb')](function(_0x30d8e6){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x261987,_0xa12a('0xc'));logger[_0xa12a('0xd')](_0xa12a('0xe'),_0x261987,_0xa12a('0xc'),JSON[_0xa12a('0xf')](_0x30d8e6));if(_0x30d8e6['error']){if(_0x30d8e6[_0xa12a('0x10')]['code']===0x1f4){logger[_0xa12a('0x10')](_0xa12a('0x11'),_0x261987,_0x30d8e6[_0xa12a('0x10')]['message']);return _0x365fa5(_0x30d8e6[_0xa12a('0x10')][_0xa12a('0x12')]);}logger[_0xa12a('0x10')](_0xa12a('0x11'),_0x261987,_0x30d8e6['error'][_0xa12a('0x12')]);return _0x5a6901(_0x30d8e6[_0xa12a('0x10')]['message']);}else{logger[_0xa12a('0x13')](_0xa12a('0x11'),_0x261987,_0xa12a('0xc'));_0x5a6901(_0x30d8e6[_0xa12a('0x14')]['message']);}})[_0xa12a('0x15')](function(_0x28bdbe){logger['error'](_0xa12a('0x11'),_0x261987,_0x28bdbe);_0x365fa5(_0x28bdbe);});});} \ No newline at end of file +var _0x10a7=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x10a7,0xd4));var _0x710a=function(_0x200219,_0x2cab16){_0x200219=_0x200219-0x0;var _0x52367c=_0x10a7[_0x200219];return _0x52367c;};'use strict';var _=require(_0x710a('0x0'));var util=require(_0x710a('0x1'));var moment=require(_0x710a('0x2'));var BPromise=require(_0x710a('0x3'));var rs=require(_0x710a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x710a('0x5'))['db'];var utils=require(_0x710a('0x6'));var logger=require(_0x710a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x710a('0x8')][_0x710a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5da46a,_0x12c446,_0x485920){return new BPromise(function(_0x3a700f,_0x4dedb7){return client[_0x710a('0xa')](_0x5da46a,_0x485920)[_0x710a('0xb')](function(_0x3841e6){logger[_0x710a('0xc')](_0x710a('0xd'),_0x12c446,_0x710a('0xe'));logger[_0x710a('0xf')](_0x710a('0x10'),_0x12c446,_0x710a('0xe'),JSON[_0x710a('0x11')](_0x3841e6));if(_0x3841e6['error']){if(_0x3841e6[_0x710a('0x12')]['code']===0x1f4){logger[_0x710a('0x12')](_0x710a('0xd'),_0x12c446,_0x3841e6[_0x710a('0x12')]['message']);return _0x4dedb7(_0x3841e6[_0x710a('0x12')][_0x710a('0x13')]);}logger[_0x710a('0x12')](_0x710a('0xd'),_0x12c446,_0x3841e6[_0x710a('0x12')]['message']);return _0x3a700f(_0x3841e6[_0x710a('0x12')][_0x710a('0x13')]);}else{logger[_0x710a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x12c446,'request\x20sent');_0x3a700f(_0x3841e6['result'][_0x710a('0x13')]);}})[_0x710a('0x14')](function(_0x50ddc1){logger[_0x710a('0x12')](_0x710a('0xd'),_0x12c446,_0x50ddc1);_0x4dedb7(_0x50ddc1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6cc2314..f40e4d9 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 _0xdeba=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','delete','destroy','exports','multer'];(function(_0x2cabca,_0x39751b){var _0x5494a4=function(_0x7fb7cb){while(--_0x7fb7cb){_0x2cabca['push'](_0x2cabca['shift']());}};_0x5494a4(++_0x39751b);}(_0xdeba,0x10d));var _0xadeb=function(_0x43c76c,_0x1bbbf9){_0x43c76c=_0x43c76c-0x0;var _0x584d5d=_0xdeba[_0x43c76c];return _0x584d5d;};'use strict';var multer=require(_0xadeb('0x0'));var util=require('util');var path=require(_0xadeb('0x1'));var timeout=require(_0xadeb('0x2'));var express=require(_0xadeb('0x3'));var router=express[_0xadeb('0x4')]();var fs_extra=require(_0xadeb('0x5'));var auth=require(_0xadeb('0x6'));var interaction=require(_0xadeb('0x7'));var config=require(_0xadeb('0x8'));var controller=require(_0xadeb('0x9'));router[_0xadeb('0xa')]('/',auth[_0xadeb('0xb')](),controller['index']);router['get']('/describe',auth[_0xadeb('0xb')](),controller[_0xadeb('0xc')]);router['get'](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller['show']);router[_0xadeb('0xa')](_0xadeb('0xe'),auth[_0xadeb('0xb')](),controller[_0xadeb('0xf')]);router[_0xadeb('0xa')](_0xadeb('0x10'),controller[_0xadeb('0x11')]);router[_0xadeb('0xa')](_0xadeb('0x12'),auth[_0xadeb('0xb')](),controller[_0xadeb('0x13')]);router[_0xadeb('0x14')]('/',auth[_0xadeb('0xb')](),controller[_0xadeb('0x15')]);router['post']('/:id/transcribe',auth['isAuthenticated'](),controller[_0xadeb('0x16')]);router[_0xadeb('0x17')](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller['update']);router[_0xadeb('0x18')](_0xadeb('0xd'),auth[_0xadeb('0xb')](),controller[_0xadeb('0x19')]);module[_0xadeb('0x1a')]=router; \ No newline at end of file +var _0x8253=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','multer'];(function(_0x1ee5ce,_0x1582f5){var _0x33e653=function(_0x2b0deb){while(--_0x2b0deb){_0x1ee5ce['push'](_0x1ee5ce['shift']());}};_0x33e653(++_0x1582f5);}(_0x8253,0x1a3));var _0x3825=function(_0x179c0c,_0x20fe42){_0x179c0c=_0x179c0c-0x0;var _0x2ab663=_0x8253[_0x179c0c];return _0x2ab663;};'use strict';var multer=require(_0x3825('0x0'));var util=require(_0x3825('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3825('0x2'));var router=express[_0x3825('0x3')]();var fs_extra=require(_0x3825('0x4'));var auth=require(_0x3825('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3825('0x6'));var controller=require('./voiceRecording.controller');router[_0x3825('0x7')]('/',auth[_0x3825('0x8')](),controller[_0x3825('0x9')]);router[_0x3825('0x7')](_0x3825('0xa'),auth[_0x3825('0x8')](),controller['describe']);router[_0x3825('0x7')](_0x3825('0xb'),auth[_0x3825('0x8')](),controller['show']);router['get'](_0x3825('0xc'),auth[_0x3825('0x8')](),controller[_0x3825('0xd')]);router[_0x3825('0x7')](_0x3825('0xe'),controller['downloads']);router[_0x3825('0x7')](_0x3825('0xf'),auth[_0x3825('0x8')](),controller[_0x3825('0x10')]);router[_0x3825('0x11')]('/',auth[_0x3825('0x8')](),controller['create']);router[_0x3825('0x11')](_0x3825('0xf'),auth[_0x3825('0x8')](),controller[_0x3825('0x12')]);router['put'](_0x3825('0xb'),auth['isAuthenticated'](),controller[_0x3825('0x13')]);router[_0x3825('0x14')](_0x3825('0xb'),auth[_0x3825('0x8')](),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 987e39f..12330ac 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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 a4a4872..1677971 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 _0x40e2=['location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','then','destroy','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filters','filter','merge','where','options','rows','catch','params','includeAll','include','create','body','find','describe','download','../../components/encryptor','uniqueid','existsSync','decryptFile','secrets','recording','value','Sequelize','filename','extname','unlink','VoiceRecording\x20not\x20found','Not\x20found','sequelize','col','push','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket'];(function(_0x38207e,_0x18a893){var _0x488be4=function(_0x271a83){while(--_0x271a83){_0x38207e['push'](_0x38207e['shift']());}};_0x488be4(++_0x18a893);}(_0x40e2,0x149));var _0x240e=function(_0x2fe299,_0x2e1408){_0x2fe299=_0x2fe299-0x0;var _0x3e7659=_0x40e2[_0x2fe299];return _0x3e7659;};'use strict';var emlformat=require(_0x240e('0x0'));var rimraf=require(_0x240e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x240e('0x2'));var moment=require(_0x240e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x240e('0x4'));var util=require(_0x240e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x240e('0x6'));var ejs=require(_0x240e('0x7'));var fs=require('fs');var fs_extra=require(_0x240e('0x8'));var _=require(_0x240e('0x9'));var squel=require(_0x240e('0xa'));var crypto=require(_0x240e('0xb'));var jsforce=require(_0x240e('0xc'));var deskjs=require(_0x240e('0xd'));var toCsv=require(_0x240e('0x6'));var querystring=require(_0x240e('0xe'));var Papa=require(_0x240e('0xf'));var AWS=require(_0x240e('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x240e('0x11'));var authService=require(_0x240e('0x12'));var qs=require(_0x240e('0x13'));var as=require(_0x240e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x240e('0x15'))(_0x240e('0x16'));var utils=require(_0x240e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x240e('0x18'))['db'];function respondWithStatusCode(_0x5b02a,_0x554ef3){_0x554ef3=_0x554ef3||0xcc;return function(_0x2c2b25){if(_0x2c2b25){return _0x5b02a[_0x240e('0x19')](_0x554ef3);}return _0x5b02a['status'](_0x554ef3)[_0x240e('0x1a')]();};}function respondWithResult(_0x1faeec,_0x36ddbf){_0x36ddbf=_0x36ddbf||0xc8;return function(_0x3dfb2f){if(_0x3dfb2f){return _0x1faeec['status'](_0x36ddbf)[_0x240e('0x1b')](_0x3dfb2f);}};}function respondWithFilteredResult(_0x295817,_0x134073){return function(_0x12ee2d){if(_0x12ee2d){var _0x31c17e=typeof _0x134073[_0x240e('0x1c')]===_0x240e('0x1d')&&typeof _0x134073[_0x240e('0x1e')]===_0x240e('0x1d');var _0x3dc3fc=_0x12ee2d[_0x240e('0x1f')];var _0x58234f=_0x31c17e?0x0:_0x134073['offset'];var _0x2b0808=_0x31c17e?_0x12ee2d[_0x240e('0x1f')]:_0x134073['offset']+_0x134073['limit'];var _0x12a070;if(_0x2b0808>=_0x3dc3fc){_0x2b0808=_0x3dc3fc;_0x12a070=0xc8;}else{_0x12a070=0xce;}_0x295817[_0x240e('0x20')](_0x12a070);return _0x295817[_0x240e('0x21')](_0x240e('0x22'),_0x58234f+'-'+_0x2b0808+'/'+_0x3dc3fc)['json'](_0x12ee2d);}return null;};}function patchUpdates(_0x552dd3){return function(_0x5df254){try{jsonpatch['apply'](_0x5df254,_0x552dd3,!![]);}catch(_0xbf4f21){return BPromise[_0x240e('0x23')](_0xbf4f21);}return _0x5df254[_0x240e('0x24')]();};}function saveUpdates(_0x5a1a28,_0xb253e5){return function(_0x2fa9ae){if(_0x2fa9ae){return _0x2fa9ae['update'](_0x5a1a28)[_0x240e('0x25')](function(_0x1f4189){return _0x1f4189;});}return null;};}function removeEntity(_0x3fe13a,_0x520d14){return function(_0x46f343){if(_0x46f343){return _0x46f343[_0x240e('0x26')]()[_0x240e('0x25')](function(){_0x3fe13a[_0x240e('0x20')](0xcc)[_0x240e('0x1a')]();});}};}function handleEntityNotFound(_0x508be5,_0x58ab02){return function(_0x1aa7b5){if(!_0x1aa7b5){_0x508be5[_0x240e('0x19')](0x194);}return _0x1aa7b5;};}function handleError(_0x3fa0c8,_0x1bf466){_0x1bf466=_0x1bf466||0x1f4;return function(_0x1a5b07){logger['error'](_0x1a5b07['stack']);if(_0x1a5b07[_0x240e('0x27')]){delete _0x1a5b07['name'];}_0x3fa0c8[_0x240e('0x20')](_0x1bf466)[_0x240e('0x28')](_0x1a5b07);};}exports[_0x240e('0x29')]=function(_0x5e274c,_0x55651a){var _0x1ba4e0={},_0x6bb7d4={},_0x4a354a={'count':0x0,'rows':[]};var _0x3d8914=_['map'](db[_0x240e('0x2a')][_0x240e('0x2b')],function(_0x50fe9e){return{'name':_0x50fe9e[_0x240e('0x2c')],'type':_0x50fe9e[_0x240e('0x2d')][_0x240e('0x2e')]};});_0x6bb7d4[_0x240e('0x2f')]=_[_0x240e('0x30')](_['map'](_0x3d8914,_0x240e('0x27')),[_0x240e('0x31')]);_0x6bb7d4[_0x240e('0x32')]=_[_0x240e('0x33')](_0x5e274c['query']);_0x6bb7d4['filters']=_['intersection'](_0x6bb7d4[_0x240e('0x2f')],_0x6bb7d4[_0x240e('0x32')]);_0x1ba4e0['attributes']=_[_0x240e('0x34')](_0x6bb7d4[_0x240e('0x2f')],qs['fields'](_0x5e274c['query'][_0x240e('0x35')]));_0x1ba4e0['attributes']=_0x1ba4e0[_0x240e('0x36')][_0x240e('0x37')]?_0x1ba4e0[_0x240e('0x36')]:_0x6bb7d4[_0x240e('0x2f')];if(!_0x5e274c[_0x240e('0x32')][_0x240e('0x38')]('nolimit')){_0x1ba4e0['limit']=qs[_0x240e('0x1e')](_0x5e274c[_0x240e('0x32')]['limit']);_0x1ba4e0[_0x240e('0x1c')]=qs[_0x240e('0x1c')](_0x5e274c[_0x240e('0x32')][_0x240e('0x1c')]);}_0x1ba4e0[_0x240e('0x39')]=qs[_0x240e('0x3a')](_0x5e274c['query'][_0x240e('0x3a')]);_0x1ba4e0['where']=qs['filters'](_[_0x240e('0x3b')](_0x5e274c['query'],_0x6bb7d4[_0x240e('0x3c')]),_0x3d8914);if(_0x5e274c[_0x240e('0x32')][_0x240e('0x3d')]){_0x1ba4e0['where']=_[_0x240e('0x3e')](_0x1ba4e0[_0x240e('0x3f')],{'$or':_['map'](_0x3d8914,function(_0x1c00ea){if(_0x1c00ea['type']!=='VIRTUAL'){var _0x5d9586={};_0x5d9586[_0x1c00ea[_0x240e('0x27')]]={'$like':'%'+_0x5e274c[_0x240e('0x32')][_0x240e('0x3d')]+'%'};return _0x5d9586;}})});}_0x1ba4e0=_[_0x240e('0x3e')]({},_0x1ba4e0,_0x5e274c[_0x240e('0x40')]);var _0x1e980a={'where':_0x1ba4e0['where']};return db['VoiceRecording'][_0x240e('0x1f')](_0x1e980a)['then'](function(_0x10d5c9){_0x4a354a[_0x240e('0x1f')]=_0x10d5c9;if(_0x5e274c[_0x240e('0x32')]['includeAll']){_0x1ba4e0['include']=[{'all':!![]}];}return db[_0x240e('0x2a')]['findAll'](_0x1ba4e0);})['then'](function(_0x4057e5){_0x4a354a[_0x240e('0x41')]=_0x4057e5;return _0x4a354a;})[_0x240e('0x25')](respondWithFilteredResult(_0x55651a,_0x1ba4e0))[_0x240e('0x42')](handleError(_0x55651a,null));};exports['show']=function(_0x485ac0,_0x570dee){var _0x2b3448={'raw':![],'where':{'id':_0x485ac0[_0x240e('0x43')]['id']}},_0x21234e={};_0x21234e[_0x240e('0x2f')]=_['keys'](db[_0x240e('0x2a')][_0x240e('0x2b')]);_0x21234e[_0x240e('0x32')]=_[_0x240e('0x33')](_0x485ac0[_0x240e('0x32')]);_0x21234e[_0x240e('0x3c')]=_[_0x240e('0x34')](_0x21234e[_0x240e('0x2f')],_0x21234e['query']);_0x2b3448[_0x240e('0x36')]=_[_0x240e('0x34')](_0x21234e[_0x240e('0x2f')],qs[_0x240e('0x35')](_0x485ac0['query'][_0x240e('0x35')]));_0x2b3448['attributes']=_0x2b3448['attributes']['length']?_0x2b3448[_0x240e('0x36')]:_0x21234e[_0x240e('0x2f')];if(_0x485ac0['query'][_0x240e('0x44')]){_0x2b3448[_0x240e('0x45')]=[{'all':!![]}];}_0x2b3448=_[_0x240e('0x3e')]({},_0x2b3448,_0x485ac0[_0x240e('0x40')]);return db['VoiceRecording']['find'](_0x2b3448)[_0x240e('0x25')](handleEntityNotFound(_0x570dee,null))[_0x240e('0x25')](respondWithResult(_0x570dee,null))[_0x240e('0x42')](handleError(_0x570dee,null));};exports[_0x240e('0x46')]=function(_0x153fe8,_0x349d30){return db[_0x240e('0x2a')][_0x240e('0x46')](_0x153fe8[_0x240e('0x47')],{})[_0x240e('0x25')](respondWithResult(_0x349d30,0xc9))[_0x240e('0x42')](handleError(_0x349d30,null));};exports['update']=function(_0x217dc1,_0x17bb62){if(_0x217dc1[_0x240e('0x47')]['id']){delete _0x217dc1[_0x240e('0x47')]['id'];}return db[_0x240e('0x2a')][_0x240e('0x48')]({'where':{'id':_0x217dc1[_0x240e('0x43')]['id']}})[_0x240e('0x25')](handleEntityNotFound(_0x17bb62,null))[_0x240e('0x25')](saveUpdates(_0x217dc1['body'],null))[_0x240e('0x25')](respondWithResult(_0x17bb62,null))[_0x240e('0x42')](handleError(_0x17bb62,null));};exports['describe']=function(_0x13905b,_0x3d97a3){return db['VoiceRecording'][_0x240e('0x49')]()[_0x240e('0x25')](respondWithResult(_0x3d97a3,null))[_0x240e('0x42')](handleError(_0x3d97a3,null));};exports[_0x240e('0x4a')]=function(_0x1bc14f,_0x48798a,_0x12e80d){var _0x14a23b=require(_0x240e('0x4b'));var _0xb59b60=![];var _0x4622fb={};if(_0x1bc14f[_0x240e('0x32')][_0x240e('0x2d')]&&_0x1bc14f[_0x240e('0x32')][_0x240e('0x2d')]==='uniqueid'){_0x4622fb[_0x240e('0x4c')]=_0x1bc14f[_0x240e('0x43')]['id'];}else{_0x4622fb['id']=_0x1bc14f[_0x240e('0x43')]['id'];}return db['VoiceRecording']['find']({'where':_0x4622fb,'attributes':['id','value'],'raw':!![]})[_0x240e('0x25')](handleEntityNotFound(_0x48798a,null))[_0x240e('0x25')](function(_0x49e8a6){if(_0x49e8a6){var _0x216638=_0x49e8a6['value'];var _0x567fd9=util[_0x240e('0x31')]('%s.cypher',_0x216638);if(fs[_0x240e('0x4d')](_0x567fd9)){_0xb59b60=!![];return _0x14a23b[_0x240e('0x4e')](_0x567fd9,_0x216638,config[_0x240e('0x4f')][_0x240e('0x50')])[_0x240e('0x25')](function(){return _0x49e8a6;});}return _0x49e8a6;}})[_0x240e('0x25')](function(_0x57fd6d){if(_0x57fd6d){var _0x3dfbf2=_0x57fd6d[_0x240e('0x51')];if(!fs[_0x240e('0x4d')](_0x3dfbf2)){throw new db[(_0x240e('0x52'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x57fd6d[_0x240e('0x53')]){return _0x48798a['download'](_0x3dfbf2,_0x57fd6d[_0x240e('0x53')]+path[_0x240e('0x54')](_0x3dfbf2),function(){if(_0xb59b60){fs[_0x240e('0x55')](_0x3dfbf2);}});}else{return _0x48798a[_0x240e('0x4a')](_0x3dfbf2,function(_0x17ab1f){if(_0xb59b60){fs['unlink'](_0x3dfbf2);}});}}})[_0x240e('0x42')](function(_0x29c93b){if(_0x29c93b['message']===_0x240e('0x56')){_0x48798a[_0x240e('0x20')](0x194)[_0x240e('0x28')](_0x240e('0x57'));}else{return handleError(_0x48798a,null);}});};exports['downloads']=function(_0x221dca,_0x5b0ecb,_0x5f05de){var _0x26c80e=require(_0x240e('0x4b'));var _0x106004=![];var _0x1bb161={'$and':[db[_0x240e('0x58')][_0x240e('0x3f')](db[_0x240e('0x58')]['fn']('MD5',db[_0x240e('0x58')][_0x240e('0x59')](_0x240e('0x4c'))),_0x221dca[_0x240e('0x32')]['token'])]};if(_0x221dca[_0x240e('0x32')][_0x240e('0x2d')]&&_0x221dca[_0x240e('0x32')]['type']==='uniqueid'){_0x1bb161['$and']['push']({'uniqueid':_0x221dca[_0x240e('0x43')]['id']});}else{_0x1bb161['$and'][_0x240e('0x5a')]({'id':_0x221dca[_0x240e('0x43')]['id']});}return db[_0x240e('0x2a')][_0x240e('0x48')]({'where':_0x1bb161,'attributes':['id',_0x240e('0x51')],'raw':!![]})[_0x240e('0x25')](handleEntityNotFound(_0x5b0ecb,null))[_0x240e('0x25')](function(_0x1d09f9){if(_0x1d09f9){var _0x3000f2=util['format']('%s.cypher',_0x1d09f9[_0x240e('0x51')]);if(fs['existsSync'](_0x3000f2)){_0x106004=!![];return _0x26c80e['decryptFile'](_0x3000f2,_0x1d09f9[_0x240e('0x51')],config[_0x240e('0x4f')]['recording'])['then'](function(){return _0x1d09f9;});}return _0x1d09f9;}})[_0x240e('0x25')](function(_0xc01727){if(_0xc01727){if(!fs[_0x240e('0x4d')](_0xc01727[_0x240e('0x51')])){throw new db[(_0x240e('0x52'))][(_0x240e('0x5b'))](_0x240e('0x56'));}if(_0xc01727[_0x240e('0x53')]){return _0x5b0ecb[_0x240e('0x4a')](_0xc01727['value'],_0xc01727[_0x240e('0x53')]+path[_0x240e('0x54')](_0xc01727[_0x240e('0x51')]),function(){if(_0x106004){fs[_0x240e('0x55')](_0xc01727[_0x240e('0x51')]);}});}else{return _0x5b0ecb['download'](_0xc01727[_0x240e('0x51')],function(_0x2ba789){if(_0x106004){fs[_0x240e('0x55')](_0xc01727[_0x240e('0x51')]);}});}}})[_0x240e('0x42')](handleError(_0x5b0ecb,null));};exports[_0x240e('0x26')]=function(_0x1389f1,_0x298895){return db[_0x240e('0x2a')][_0x240e('0x48')]({'where':{'id':_0x1389f1[_0x240e('0x43')]['id']}})[_0x240e('0x25')](function(_0x117030){if(_[_0x240e('0x5c')](_0x117030)){throw new ReferenceError(_0x240e('0x5d'));}return _0x117030;})['then'](function(_0xf8101a){var _0x1eb6cc=_0xf8101a[_0x240e('0x51')];logger[_0x240e('0x5e')](_0x240e('0x5f'),_0x1eb6cc);if(!_[_0x240e('0x5c')](_0xf8101a[_0x240e('0x51')])&&fs[_0x240e('0x4d')](_0x1eb6cc)){logger[_0x240e('0x5e')](_0x240e('0x60')+_0x1eb6cc+_0x240e('0x61'));fs[_0x240e('0x62')](_0x1eb6cc);}_0x1eb6cc=_0x1eb6cc+_0x240e('0x63');if(!_[_0x240e('0x5c')](_0xf8101a[_0x240e('0x51')])&&fs['existsSync'](_0x1eb6cc)){logger[_0x240e('0x5e')](_0x240e('0x60')+_0x1eb6cc+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x240e('0x62')](_0x1eb6cc);}return _0xf8101a;})['then'](function(_0x34d81c){if(!_0x34d81c)throw new InternalError();return _0x34d81c[_0x240e('0x26')]();})[_0x240e('0x25')](function(){_0x298895['status'](0xcc)[_0x240e('0x1a')]();})['catch'](handleError(_0x298895,null));};function getBucketslist(_0x2bbb44,_0x584e35,_0x548031){return new Promise(function(_0x424702,_0x443617){var _0x162da6=new AWS['S3']({'accessKeyId':_0x584e35,'secretAccessKey':_0x2bbb44,'region':_0x548031});_0x162da6['listBuckets']({},function(_0x2bed4a,_0x584eb2){if(_0x2bed4a){return _0x443617(_0x2bed4a);}else{return _0x424702(_0x584eb2);}});});}function createBucket(_0x17e64d,_0x175994,_0x5413e3,_0x574fe6){return new Promise(function(_0x1b8de2,_0xeea1ee){var _0x5797ce=new AWS['S3']({'accessKeyId':_0x175994,'secretAccessKey':_0x17e64d,'region':_0x5413e3});_0x5797ce['createBucket']({'Bucket':_0x574fe6},function(_0x361561,_0x13d9d4){if(_0x361561){return _0xeea1ee(_0x361561);}else{return _0x1b8de2(_0x13d9d4);}});});}function uploadFile(_0x20a91d,_0x13d868,_0x1f1082,_0x269fa9,_0x555e50,_0x4e7872){return new Promise(function(_0x445fa5,_0x5bf202){var _0x23a3c1=new AWS['S3']({'accessKeyId':_0x13d868,'secretAccessKey':_0x20a91d,'region':_0x1f1082});_0x23a3c1[_0x240e('0x64')]({'Bucket':_0x269fa9,'Key':_0x555e50,'Body':_0x4e7872},function(_0xfdd4bc,_0x47b72c){if(_0xfdd4bc){return _0x5bf202(_0xfdd4bc);}else{return _0x445fa5(_0x47b72c);}});});}function startTranscribe(_0x318b30,_0x44400c,_0x58ba4a,_0x48baed,_0x40c074,_0xc8401e){return new Promise(function(_0x22412a,_0x1e35e1){var _0x60aa5=new AWS[(_0x240e('0x65'))]({'accessKeyId':_0x44400c,'secretAccessKey':_0x318b30,'region':_0x58ba4a});_0x60aa5['startTranscriptionJob']({'TranscriptionJobName':_0x48baed,'LanguageCode':_0x40c074,'Media':{'MediaFileUri':_0xc8401e}},function(_0x2775ba,_0x10d3bc){if(_0x2775ba){return _0x1e35e1(_0x2775ba);}else{return _0x22412a(_0x10d3bc);}});});}function transcribe(_0x4f73be,_0x3e3e87,_0x5e299a,_0x5c1fa0,_0x28a27c,_0x52d6ee,_0x1b93c0){return new Promise(function(_0x42e7a0,_0x1b6428){var _0x13affc={};logger[_0x240e('0x5e')](util[_0x240e('0x31')](_0x240e('0x66'),_0x4f73be,_0x28a27c));return uploadFile(_0x3e3e87,_0x5e299a,_0x5c1fa0,_0x28a27c,path['basename'](_0x52d6ee),fs['readFileSync'](_0x52d6ee))['then'](function(_0x5bc7d8){logger[_0x240e('0x5e')](util[_0x240e('0x31')](_0x240e('0x67'),_0x4f73be,_0x28a27c,_0x5bc7d8['Location']));_0x13affc[_0x240e('0x68')]=_0x5bc7d8[_0x240e('0x69')];_0x13affc[_0x240e('0x6a')]=_0x5bc7d8[_0x240e('0x6b')];logger[_0x240e('0x5e')](util[_0x240e('0x31')](_0x240e('0x6c'),_0x4f73be));return startTranscribe(_0x3e3e87,_0x5e299a,_0x5c1fa0,uuidv4(),_0x1b93c0,_0x5bc7d8[_0x240e('0x6b')]);})['then'](function(_0x5748a3){logger['info'](util[_0x240e('0x31')](_0x240e('0x6d'),_0x4f73be,_0x5748a3[_0x240e('0x6e')][_0x240e('0x6f')]));_0x13affc[_0x240e('0x70')]=_0x5748a3[_0x240e('0x6e')][_0x240e('0x6f')];_0x13affc['transcribeStatus']=_0x5748a3[_0x240e('0x6e')][_0x240e('0x71')];return _0x42e7a0(_0x13affc);})[_0x240e('0x42')](function(_0x4c82a9){return _0x1b6428(_0x4c82a9);});});}exports[_0x240e('0x72')]=function(_0x108766,_0x2cf38e,_0x545926){var _0x5b94b5;var _0x1929e2;var _0x5c8c90;var _0x450a7d=require(_0x240e('0x4b'));return db['VoiceRecording'][_0x240e('0x73')]({'where':{'id':_0x108766['params']['id']}})[_0x240e('0x25')](function(_0x59c05f){if(_0x59c05f){var _0x2f8f00=util['format'](_0x240e('0x74'),_0x59c05f['value']);if(fs[_0x240e('0x4d')](_0x2f8f00)){cypher=!![];return _0x450a7d[_0x240e('0x4e')](_0x2f8f00,_0x59c05f[_0x240e('0x51')],config[_0x240e('0x4f')][_0x240e('0x50')])[_0x240e('0x25')](function(){return _0x59c05f;});}return _0x59c05f;}})[_0x240e('0x25')](function(_0x4be2e5){if(!_0x4be2e5){throw new db[(_0x240e('0x52'))]['ValidationError'](_0x240e('0x75'));}_0x1929e2=_0x4be2e5;return db[_0x240e('0x76')][_0x240e('0x73')]({'where':{'id':0x1}});})[_0x240e('0x25')](handleEntityNotFound(_0x2cf38e,null))[_0x240e('0x25')](function(_0x409fe6){if(_0x409fe6){_0x5b94b5=_0x409fe6;if(!_0x5b94b5[_0x240e('0x77')]||!_0x5b94b5['transcribeAccountId']||!_0x5b94b5['transcribeRegion']||!_0x5b94b5[_0x240e('0x78')]||!_0x5b94b5['bucket']){throw new db[(_0x240e('0x52'))][(_0x240e('0x5b'))](_0x240e('0x79'));}if(_0x108766[_0x240e('0x47')][_0x240e('0x7a')]&&(!_0x5b94b5[_0x240e('0x7b')]||!_0x5b94b5['sentimentAccountId']||!_0x5b94b5[_0x240e('0x7c')]||!_0x5b94b5[_0x240e('0x78')]||!_0x5b94b5[_0x240e('0x68')])){throw new db[(_0x240e('0x52'))]['ValidationError'](_0x240e('0x7d'));}return db[_0x240e('0x7e')]['findOne']({'where':{'id':_0x5b94b5[_0x240e('0x7f')]}});}})[_0x240e('0x25')](function(_0x125ad1){if(!_0x125ad1){throw new db[(_0x240e('0x52'))][(_0x240e('0x5b'))](_0x240e('0x80'));}if(!_0x125ad1[_0x240e('0x81')]||!_0x125ad1[_0x240e('0x82')]){throw new db[(_0x240e('0x52'))][(_0x240e('0x5b'))](_0x240e('0x83'));}_0x5c8c90=_0x125ad1;return getBucketslist(_0x5c8c90[_0x240e('0x81')],_0x5c8c90[_0x240e('0x82')],_0x5b94b5[_0x240e('0x84')]);})['then'](function(_0x5eff63){if(_0x5eff63&&_0x5eff63['Buckets']){var _0x3fc1a5=_[_0x240e('0x48')](_0x5eff63[_0x240e('0x85')],function(_0x136226){return _0x136226[_0x240e('0x86')]===_0x5b94b5[_0x240e('0x68')];});if(!_0x3fc1a5){logger[_0x240e('0x5e')](util[_0x240e('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x108766['params']['id'],_0x5b94b5[_0x240e('0x68')]));return createBucket(_0x5c8c90['data1'],_0x5c8c90[_0x240e('0x82')],_0x5b94b5['transcribeRegion'],_0x5b94b5['bucket']);}logger[_0x240e('0x5e')](util[_0x240e('0x31')](_0x240e('0x87'),_0x108766[_0x240e('0x43')]['id'],_0x5b94b5[_0x240e('0x68')]));return;}})[_0x240e('0x25')](function(_0x520122){if(_0x1929e2[_0x240e('0x88')]===_0x240e('0x89')){return transcribe(_0x108766[_0x240e('0x43')]['id'],_0x5c8c90[_0x240e('0x81')],_0x5c8c90[_0x240e('0x82')],_0x5b94b5[_0x240e('0x84')],_0x5b94b5[_0x240e('0x68')],_0x1929e2[_0x240e('0x51')],_0x5b94b5[_0x240e('0x78')]);}else{logger[_0x240e('0x5e')](util[_0x240e('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x108766[_0x240e('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x240e('0x25')](function(_0x2aaa0f){if(_0x2aaa0f){_0x2aaa0f[_0x240e('0x8a')]=_0x108766[_0x240e('0x47')][_0x240e('0x7a')];return _0x1929e2[_0x240e('0x8b')](_0x2aaa0f);}})[_0x240e('0x25')](respondWithResult(_0x2cf38e,null))[_0x240e('0x42')](handleError(_0x2cf38e,null));};function writeFile(_0xb8fb5c,_0x1a9c34){return new Promise(function(_0x1df094,_0x2f8fc5){fs[_0x240e('0x8c')](_0x1a9c34,_0xb8fb5c,function(_0x4456f7,_0x29d976){if(_0x4456f7){return _0x2f8fc5(_0x4456f7);}else{return _0x1df094(_0x29d976);}});});}exports['downloadTranscribe']=function(_0x5cbb0d,_0x2ea61c,_0x5ea322){return db[_0x240e('0x2a')][_0x240e('0x73')]({'where':{'id':_0x5cbb0d[_0x240e('0x43')]['id']}})[_0x240e('0x25')](handleEntityNotFound(_0x2ea61c))[_0x240e('0x25')](function(_0x3e070f){if(_0x3e070f&&_0x3e070f['fileText']){var _0x37d05a=_0x3e070f[_0x240e('0x8d')];var _0x239a60=config[_0x240e('0x8e')]+_0x240e('0x8f')+_0x3e070f['id']+'.txt';if(fs['existsSync'](_0x239a60)){return _0x239a60;}return writeFile(_0x37d05a,_0x239a60)[_0x240e('0x25')](function(){return _0x239a60;});}else{throw new db[(_0x240e('0x52'))][(_0x240e('0x5b'))](_0x240e('0x90'));}})[_0x240e('0x25')](function(_0x55c23d){return _0x2ea61c['download'](_0x55c23d);})[_0x240e('0x42')](handleError(_0x2ea61c));}; \ No newline at end of file +var _0x2cd5=['unlinkSync','.cypher','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','stack','name','send','index','VoiceRecording','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','update','describe','uniqueid','value','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','format','secrets','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x4a1831,_0x299eaf){var _0x3f4dbc=function(_0xb8d51a){while(--_0xb8d51a){_0x4a1831['push'](_0x4a1831['shift']());}};_0x3f4dbc(++_0x299eaf);}(_0x2cd5,0xcc));var _0x52cd=function(_0x96ca7b,_0x16dd08){_0x96ca7b=_0x96ca7b-0x0;var _0x4002c3=_0x2cd5[_0x96ca7b];return _0x4002c3;};'use strict';var emlformat=require(_0x52cd('0x0'));var rimraf=require(_0x52cd('0x1'));var zipdir=require(_0x52cd('0x2'));var jsonpatch=require(_0x52cd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x52cd('0x4'));var Mustache=require(_0x52cd('0x5'));var util=require(_0x52cd('0x6'));var path=require(_0x52cd('0x7'));var sox=require('sox');var csv=require(_0x52cd('0x8'));var ejs=require(_0x52cd('0x9'));var fs=require('fs');var fs_extra=require(_0x52cd('0xa'));var _=require(_0x52cd('0xb'));var squel=require(_0x52cd('0xc'));var crypto=require(_0x52cd('0xd'));var jsforce=require(_0x52cd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x52cd('0xf'));var Papa=require(_0x52cd('0x10'));var AWS=require(_0x52cd('0x11'));var uuidv4=require(_0x52cd('0x12'));var Redis=require(_0x52cd('0x13'));var authService=require(_0x52cd('0x14'));var qs=require(_0x52cd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x52cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x52cd('0x17'));var db=require(_0x52cd('0x18'))['db'];function respondWithStatusCode(_0x11fde9,_0x7b9f5d){_0x7b9f5d=_0x7b9f5d||0xcc;return function(_0xd84541){if(_0xd84541){return _0x11fde9[_0x52cd('0x19')](_0x7b9f5d);}return _0x11fde9[_0x52cd('0x1a')](_0x7b9f5d)[_0x52cd('0x1b')]();};}function respondWithResult(_0x494017,_0x2d0fb0){_0x2d0fb0=_0x2d0fb0||0xc8;return function(_0x16b96b){if(_0x16b96b){return _0x494017[_0x52cd('0x1a')](_0x2d0fb0)[_0x52cd('0x1c')](_0x16b96b);}};}function respondWithFilteredResult(_0x32baeb,_0x1fe0e9){return function(_0x163f89){if(_0x163f89){var _0x5d66d2=typeof _0x1fe0e9[_0x52cd('0x1d')]===_0x52cd('0x1e')&&typeof _0x1fe0e9['limit']==='undefined';var _0x5ab149=_0x163f89[_0x52cd('0x1f')];var _0x426295=_0x5d66d2?0x0:_0x1fe0e9['offset'];var _0x2433f1=_0x5d66d2?_0x163f89[_0x52cd('0x1f')]:_0x1fe0e9[_0x52cd('0x1d')]+_0x1fe0e9[_0x52cd('0x20')];var _0x5e3c55;if(_0x2433f1>=_0x5ab149){_0x2433f1=_0x5ab149;_0x5e3c55=0xc8;}else{_0x5e3c55=0xce;}_0x32baeb[_0x52cd('0x1a')](_0x5e3c55);return _0x32baeb[_0x52cd('0x21')](_0x52cd('0x22'),_0x426295+'-'+_0x2433f1+'/'+_0x5ab149)[_0x52cd('0x1c')](_0x163f89);}return null;};}function patchUpdates(_0x5e7f97){return function(_0x3d1042){try{jsonpatch['apply'](_0x3d1042,_0x5e7f97,!![]);}catch(_0x56fe56){return BPromise[_0x52cd('0x23')](_0x56fe56);}return _0x3d1042[_0x52cd('0x24')]();};}function saveUpdates(_0x1f2535,_0x35fdee){return function(_0x235e90){if(_0x235e90){return _0x235e90['update'](_0x1f2535)[_0x52cd('0x25')](function(_0x3a9e97){return _0x3a9e97;});}return null;};}function removeEntity(_0x448215,_0x1e174f){return function(_0x4b839e){if(_0x4b839e){return _0x4b839e['destroy']()[_0x52cd('0x25')](function(){_0x448215[_0x52cd('0x1a')](0xcc)[_0x52cd('0x1b')]();});}};}function handleEntityNotFound(_0x3675dc,_0xbacb1c){return function(_0x2bff38){if(!_0x2bff38){_0x3675dc[_0x52cd('0x19')](0x194);}return _0x2bff38;};}function handleError(_0x2e2dae,_0x1b5d08){_0x1b5d08=_0x1b5d08||0x1f4;return function(_0x23dbaa){logger['error'](_0x23dbaa[_0x52cd('0x26')]);if(_0x23dbaa[_0x52cd('0x27')]){delete _0x23dbaa[_0x52cd('0x27')];}_0x2e2dae[_0x52cd('0x1a')](_0x1b5d08)[_0x52cd('0x28')](_0x23dbaa);};}exports[_0x52cd('0x29')]=function(_0x69a20,_0x4fa2cc){var _0x2b54dd={},_0x2e0bb3={},_0x115c00={'count':0x0,'rows':[]};var _0x3f956c=_['map'](db[_0x52cd('0x2a')][_0x52cd('0x2b')],function(_0x28d06c){return{'name':_0x28d06c['fieldName'],'type':_0x28d06c[_0x52cd('0x2c')][_0x52cd('0x2d')]};});_0x2e0bb3[_0x52cd('0x2e')]=_['differenceBy'](_[_0x52cd('0x2f')](_0x3f956c,_0x52cd('0x27')),['format']);_0x2e0bb3[_0x52cd('0x30')]=_[_0x52cd('0x31')](_0x69a20['query']);_0x2e0bb3[_0x52cd('0x32')]=_['intersection'](_0x2e0bb3['model'],_0x2e0bb3[_0x52cd('0x30')]);_0x2b54dd[_0x52cd('0x33')]=_[_0x52cd('0x34')](_0x2e0bb3[_0x52cd('0x2e')],qs[_0x52cd('0x35')](_0x69a20[_0x52cd('0x30')][_0x52cd('0x35')]));_0x2b54dd[_0x52cd('0x33')]=_0x2b54dd[_0x52cd('0x33')]['length']?_0x2b54dd[_0x52cd('0x33')]:_0x2e0bb3[_0x52cd('0x2e')];if(!_0x69a20[_0x52cd('0x30')][_0x52cd('0x36')](_0x52cd('0x37'))){_0x2b54dd['limit']=qs['limit'](_0x69a20[_0x52cd('0x30')][_0x52cd('0x20')]);_0x2b54dd[_0x52cd('0x1d')]=qs['offset'](_0x69a20[_0x52cd('0x30')][_0x52cd('0x1d')]);}_0x2b54dd[_0x52cd('0x38')]=qs['sort'](_0x69a20[_0x52cd('0x30')]['sort']);_0x2b54dd['where']=qs['filters'](_['pick'](_0x69a20[_0x52cd('0x30')],_0x2e0bb3[_0x52cd('0x32')]),_0x3f956c);if(_0x69a20[_0x52cd('0x30')][_0x52cd('0x39')]){_0x2b54dd[_0x52cd('0x3a')]=_[_0x52cd('0x3b')](_0x2b54dd[_0x52cd('0x3a')],{'$or':_[_0x52cd('0x2f')](_0x3f956c,function(_0x3d5add){if(_0x3d5add[_0x52cd('0x2c')]!==_0x52cd('0x3c')){var _0x2f6008={};_0x2f6008[_0x3d5add[_0x52cd('0x27')]]={'$like':'%'+_0x69a20[_0x52cd('0x30')][_0x52cd('0x39')]+'%'};return _0x2f6008;}})});}_0x2b54dd=_[_0x52cd('0x3b')]({},_0x2b54dd,_0x69a20[_0x52cd('0x3d')]);var _0x2cd94a={'where':_0x2b54dd[_0x52cd('0x3a')]};return db[_0x52cd('0x2a')][_0x52cd('0x1f')](_0x2cd94a)[_0x52cd('0x25')](function(_0x56d693){_0x115c00[_0x52cd('0x1f')]=_0x56d693;if(_0x69a20['query'][_0x52cd('0x3e')]){_0x2b54dd[_0x52cd('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x52cd('0x40')](_0x2b54dd);})['then'](function(_0x405306){_0x115c00[_0x52cd('0x41')]=_0x405306;return _0x115c00;})[_0x52cd('0x25')](respondWithFilteredResult(_0x4fa2cc,_0x2b54dd))['catch'](handleError(_0x4fa2cc,null));};exports[_0x52cd('0x42')]=function(_0x44dd1f,_0x18c1d7){var _0xca7729={'raw':![],'where':{'id':_0x44dd1f[_0x52cd('0x43')]['id']}},_0x3152af={};_0x3152af[_0x52cd('0x2e')]=_[_0x52cd('0x31')](db[_0x52cd('0x2a')][_0x52cd('0x2b')]);_0x3152af[_0x52cd('0x30')]=_[_0x52cd('0x31')](_0x44dd1f[_0x52cd('0x30')]);_0x3152af[_0x52cd('0x32')]=_[_0x52cd('0x34')](_0x3152af[_0x52cd('0x2e')],_0x3152af['query']);_0xca7729[_0x52cd('0x33')]=_[_0x52cd('0x34')](_0x3152af[_0x52cd('0x2e')],qs[_0x52cd('0x35')](_0x44dd1f[_0x52cd('0x30')]['fields']));_0xca7729[_0x52cd('0x33')]=_0xca7729[_0x52cd('0x33')][_0x52cd('0x44')]?_0xca7729[_0x52cd('0x33')]:_0x3152af[_0x52cd('0x2e')];if(_0x44dd1f[_0x52cd('0x30')][_0x52cd('0x3e')]){_0xca7729[_0x52cd('0x3f')]=[{'all':!![]}];}_0xca7729=_[_0x52cd('0x3b')]({},_0xca7729,_0x44dd1f['options']);return db['VoiceRecording'][_0x52cd('0x45')](_0xca7729)[_0x52cd('0x25')](handleEntityNotFound(_0x18c1d7,null))['then'](respondWithResult(_0x18c1d7,null))[_0x52cd('0x46')](handleError(_0x18c1d7,null));};exports[_0x52cd('0x47')]=function(_0x14bd2b,_0x421332){return db['VoiceRecording'][_0x52cd('0x47')](_0x14bd2b[_0x52cd('0x48')],{})['then'](respondWithResult(_0x421332,0xc9))[_0x52cd('0x46')](handleError(_0x421332,null));};exports[_0x52cd('0x49')]=function(_0x37738a,_0x3bfd77){if(_0x37738a['body']['id']){delete _0x37738a[_0x52cd('0x48')]['id'];}return db[_0x52cd('0x2a')][_0x52cd('0x45')]({'where':{'id':_0x37738a['params']['id']}})[_0x52cd('0x25')](handleEntityNotFound(_0x3bfd77,null))[_0x52cd('0x25')](saveUpdates(_0x37738a['body'],null))[_0x52cd('0x25')](respondWithResult(_0x3bfd77,null))[_0x52cd('0x46')](handleError(_0x3bfd77,null));};exports[_0x52cd('0x4a')]=function(_0x3766d6,_0x57c092){return db[_0x52cd('0x2a')][_0x52cd('0x4a')]()[_0x52cd('0x25')](respondWithResult(_0x57c092,null))[_0x52cd('0x46')](handleError(_0x57c092,null));};exports['download']=function(_0x1f97b5,_0xc9247f,_0x421fc2){var _0x298734=require('../../components/encryptor');var _0xe87e2e=![];var _0x47e187={};if(_0x1f97b5[_0x52cd('0x30')]['type']&&_0x1f97b5[_0x52cd('0x30')][_0x52cd('0x2c')]==='uniqueid'){_0x47e187[_0x52cd('0x4b')]=_0x1f97b5['params']['id'];}else{_0x47e187['id']=_0x1f97b5[_0x52cd('0x43')]['id'];}return db['VoiceRecording'][_0x52cd('0x45')]({'where':_0x47e187,'attributes':['id',_0x52cd('0x4c')],'raw':!![]})[_0x52cd('0x25')](handleEntityNotFound(_0xc9247f,null))[_0x52cd('0x25')](function(_0x2f950c){if(_0x2f950c){var _0x4f60ec=_0x2f950c[_0x52cd('0x4c')];var _0x244a35=util['format']('%s.cypher',_0x4f60ec);if(fs[_0x52cd('0x4d')](_0x244a35)){_0xe87e2e=!![];return _0x298734[_0x52cd('0x4e')](_0x244a35,_0x4f60ec,config['secrets'][_0x52cd('0x4f')])['then'](function(){return _0x2f950c;});}return _0x2f950c;}})['then'](function(_0x4097f4){if(_0x4097f4){var _0x189b1e=_0x4097f4[_0x52cd('0x4c')];if(!fs[_0x52cd('0x4d')](_0x189b1e)){throw new db[(_0x52cd('0x50'))][(_0x52cd('0x51'))](_0x52cd('0x52'));}if(_0x4097f4[_0x52cd('0x53')]){return _0xc9247f[_0x52cd('0x54')](_0x189b1e,_0x4097f4[_0x52cd('0x53')]+path[_0x52cd('0x55')](_0x189b1e),function(){if(_0xe87e2e){fs[_0x52cd('0x56')](_0x189b1e);}});}else{return _0xc9247f['download'](_0x189b1e,function(_0xfbbd32){if(_0xe87e2e){fs[_0x52cd('0x56')](_0x189b1e);}});}}})[_0x52cd('0x46')](function(_0x3f5662){if(_0x3f5662['message']===_0x52cd('0x52')){_0xc9247f[_0x52cd('0x1a')](0x194)[_0x52cd('0x28')](_0x52cd('0x57'));}else{return handleError(_0xc9247f,null);}});};exports[_0x52cd('0x58')]=function(_0x3b14f7,_0x1f6323,_0x1f2c74){var _0x4c939f=require(_0x52cd('0x59'));var _0x46966d=![];var _0x2fc277={'$and':[db[_0x52cd('0x5a')][_0x52cd('0x3a')](db[_0x52cd('0x5a')]['fn'](_0x52cd('0x5b'),db['sequelize'][_0x52cd('0x5c')](_0x52cd('0x4b'))),_0x3b14f7[_0x52cd('0x30')]['token'])]};if(_0x3b14f7[_0x52cd('0x30')]['type']&&_0x3b14f7['query'][_0x52cd('0x2c')]===_0x52cd('0x4b')){_0x2fc277[_0x52cd('0x5d')]['push']({'uniqueid':_0x3b14f7['params']['id']});}else{_0x2fc277[_0x52cd('0x5d')][_0x52cd('0x5e')]({'id':_0x3b14f7[_0x52cd('0x43')]['id']});}return db[_0x52cd('0x2a')][_0x52cd('0x45')]({'where':_0x2fc277,'attributes':['id',_0x52cd('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x1f6323,null))[_0x52cd('0x25')](function(_0x130438){if(_0x130438){var _0xbb21b2=util[_0x52cd('0x5f')]('%s.cypher',_0x130438[_0x52cd('0x4c')]);if(fs['existsSync'](_0xbb21b2)){_0x46966d=!![];return _0x4c939f[_0x52cd('0x4e')](_0xbb21b2,_0x130438['value'],config[_0x52cd('0x60')][_0x52cd('0x4f')])[_0x52cd('0x25')](function(){return _0x130438;});}return _0x130438;}})[_0x52cd('0x25')](function(_0x461b1c){if(_0x461b1c){if(!fs[_0x52cd('0x4d')](_0x461b1c['value'])){throw new db['Sequelize'][(_0x52cd('0x51'))](_0x52cd('0x52'));}if(_0x461b1c['filename']){return _0x1f6323[_0x52cd('0x54')](_0x461b1c[_0x52cd('0x4c')],_0x461b1c[_0x52cd('0x53')]+path[_0x52cd('0x55')](_0x461b1c[_0x52cd('0x4c')]),function(){if(_0x46966d){fs[_0x52cd('0x56')](_0x461b1c['value']);}});}else{return _0x1f6323['download'](_0x461b1c[_0x52cd('0x4c')],function(_0x1279b6){if(_0x46966d){fs['unlink'](_0x461b1c['value']);}});}}})[_0x52cd('0x46')](handleError(_0x1f6323,null));};exports[_0x52cd('0x61')]=function(_0x28e5c6,_0x5f5b73){return db[_0x52cd('0x2a')][_0x52cd('0x45')]({'where':{'id':_0x28e5c6['params']['id']}})[_0x52cd('0x25')](function(_0x1aab89){if(_[_0x52cd('0x62')](_0x1aab89)){throw new ReferenceError(_0x52cd('0x63'));}return _0x1aab89;})[_0x52cd('0x25')](function(_0x2e7dfe){var _0x428a9d=_0x2e7dfe['value'];logger[_0x52cd('0x64')](_0x52cd('0x65'),_0x428a9d);if(!_['isNil'](_0x2e7dfe['value'])&&fs['existsSync'](_0x428a9d)){logger['info'](_0x52cd('0x66')+_0x428a9d+_0x52cd('0x67'));fs[_0x52cd('0x68')](_0x428a9d);}_0x428a9d=_0x428a9d+_0x52cd('0x69');if(!_[_0x52cd('0x62')](_0x2e7dfe[_0x52cd('0x4c')])&&fs[_0x52cd('0x4d')](_0x428a9d)){logger[_0x52cd('0x64')]('File:\x20\x22'+_0x428a9d+_0x52cd('0x67'));fs['unlinkSync'](_0x428a9d);}return _0x2e7dfe;})[_0x52cd('0x25')](function(_0xf60a32){if(!_0xf60a32)throw new InternalError();return _0xf60a32['destroy']();})['then'](function(){_0x5f5b73[_0x52cd('0x1a')](0xcc)[_0x52cd('0x1b')]();})[_0x52cd('0x46')](handleError(_0x5f5b73,null));};function getBucketslist(_0x3bd125,_0xeadab7,_0x2f6269){return new Promise(function(_0x1178a1,_0x18b129){var _0x475044=new AWS['S3']({'accessKeyId':_0xeadab7,'secretAccessKey':_0x3bd125,'region':_0x2f6269});_0x475044['listBuckets']({},function(_0x1cb950,_0x3a1ba1){if(_0x1cb950){return _0x18b129(_0x1cb950);}else{return _0x1178a1(_0x3a1ba1);}});});}function createBucket(_0x36a6a4,_0xb471ad,_0x5dd173,_0x2acf1c){return new Promise(function(_0x425c1b,_0x58f89c){var _0x1916be=new AWS['S3']({'accessKeyId':_0xb471ad,'secretAccessKey':_0x36a6a4,'region':_0x5dd173});_0x1916be['createBucket']({'Bucket':_0x2acf1c},function(_0x117ff1,_0x1f5004){if(_0x117ff1){return _0x58f89c(_0x117ff1);}else{return _0x425c1b(_0x1f5004);}});});}function uploadFile(_0x2e713c,_0x149331,_0x1c26dd,_0x19bce2,_0x2cb21d,_0x4ad397){return new Promise(function(_0x6030ba,_0x203757){var _0x791468=new AWS['S3']({'accessKeyId':_0x149331,'secretAccessKey':_0x2e713c,'region':_0x1c26dd});_0x791468[_0x52cd('0x6a')]({'Bucket':_0x19bce2,'Key':_0x2cb21d,'Body':_0x4ad397},function(_0x4ce84b,_0x23f5a9){if(_0x4ce84b){return _0x203757(_0x4ce84b);}else{return _0x6030ba(_0x23f5a9);}});});}function startTranscribe(_0x5bddbb,_0xa20f81,_0x39d58e,_0x469f2a,_0x135b2b,_0xc703c0){return new Promise(function(_0x5c2aec,_0x35231e){var _0x22b8cd=new AWS[(_0x52cd('0x6b'))]({'accessKeyId':_0xa20f81,'secretAccessKey':_0x5bddbb,'region':_0x39d58e});_0x22b8cd['startTranscriptionJob']({'TranscriptionJobName':_0x469f2a,'LanguageCode':_0x135b2b,'Media':{'MediaFileUri':_0xc703c0}},function(_0x589a6a,_0x266f0a){if(_0x589a6a){return _0x35231e(_0x589a6a);}else{return _0x5c2aec(_0x266f0a);}});});}function transcribe(_0x1b2764,_0x4f33fd,_0x8d9ea2,_0x1fb8d3,_0x49a263,_0x4749a9,_0x466cce){return new Promise(function(_0x5dca10,_0x8a3b7b){var _0x45c11c={};logger['info'](util[_0x52cd('0x5f')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1b2764,_0x49a263));return uploadFile(_0x4f33fd,_0x8d9ea2,_0x1fb8d3,_0x49a263,path[_0x52cd('0x6c')](_0x4749a9),fs[_0x52cd('0x6d')](_0x4749a9))[_0x52cd('0x25')](function(_0x27a0ac){logger[_0x52cd('0x64')](util[_0x52cd('0x5f')](_0x52cd('0x6e'),_0x1b2764,_0x49a263,_0x27a0ac['Location']));_0x45c11c[_0x52cd('0x6f')]=_0x27a0ac[_0x52cd('0x70')];_0x45c11c[_0x52cd('0x71')]=_0x27a0ac[_0x52cd('0x72')];logger[_0x52cd('0x64')](util[_0x52cd('0x5f')](_0x52cd('0x73'),_0x1b2764));return startTranscribe(_0x4f33fd,_0x8d9ea2,_0x1fb8d3,uuidv4(),_0x466cce,_0x27a0ac['Location']);})[_0x52cd('0x25')](function(_0x161aec){logger[_0x52cd('0x64')](util[_0x52cd('0x5f')](_0x52cd('0x74'),_0x1b2764,_0x161aec[_0x52cd('0x75')][_0x52cd('0x76')]));_0x45c11c[_0x52cd('0x77')]=_0x161aec['TranscriptionJob']['TranscriptionJobName'];_0x45c11c[_0x52cd('0x78')]=_0x161aec[_0x52cd('0x75')][_0x52cd('0x79')];return _0x5dca10(_0x45c11c);})[_0x52cd('0x46')](function(_0x1abae5){return _0x8a3b7b(_0x1abae5);});});}exports[_0x52cd('0x7a')]=function(_0x596be9,_0x417347,_0x5ad00d){var _0x3c8ea9;var _0x484fd5;var _0xf5ef9f;var _0x14ce9b=require(_0x52cd('0x59'));return db[_0x52cd('0x2a')][_0x52cd('0x7b')]({'where':{'id':_0x596be9[_0x52cd('0x43')]['id']}})[_0x52cd('0x25')](function(_0x258034){if(_0x258034){var _0x4d9e81=util['format'](_0x52cd('0x7c'),_0x258034['value']);if(fs[_0x52cd('0x4d')](_0x4d9e81)){cypher=!![];return _0x14ce9b[_0x52cd('0x4e')](_0x4d9e81,_0x258034['value'],config[_0x52cd('0x60')]['recording'])['then'](function(){return _0x258034;});}return _0x258034;}})[_0x52cd('0x25')](function(_0x58487b){if(!_0x58487b){throw new db['Sequelize'][(_0x52cd('0x51'))](_0x52cd('0x7d'));}_0x484fd5=_0x58487b;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x52cd('0x25')](handleEntityNotFound(_0x417347,null))[_0x52cd('0x25')](function(_0x14ad03){if(_0x14ad03){_0x3c8ea9=_0x14ad03;if(!_0x3c8ea9[_0x52cd('0x7e')]||!_0x3c8ea9[_0x52cd('0x7f')]||!_0x3c8ea9[_0x52cd('0x80')]||!_0x3c8ea9[_0x52cd('0x81')]||!_0x3c8ea9[_0x52cd('0x6f')]){throw new db[(_0x52cd('0x50'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x596be9[_0x52cd('0x48')]['runSentiment']&&(!_0x3c8ea9[_0x52cd('0x82')]||!_0x3c8ea9[_0x52cd('0x83')]||!_0x3c8ea9[_0x52cd('0x84')]||!_0x3c8ea9['language']||!_0x3c8ea9[_0x52cd('0x6f')])){throw new db[(_0x52cd('0x50'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x52cd('0x85')][_0x52cd('0x7b')]({'where':{'id':_0x3c8ea9['transcribeAccountId']}});}})[_0x52cd('0x25')](function(_0x2508d2){if(!_0x2508d2){throw new db[(_0x52cd('0x50'))]['ValidationError'](_0x52cd('0x86'));}if(!_0x2508d2[_0x52cd('0x87')]||!_0x2508d2[_0x52cd('0x88')]){throw new db['Sequelize'][(_0x52cd('0x51'))](_0x52cd('0x89'));}_0xf5ef9f=_0x2508d2;return getBucketslist(_0xf5ef9f[_0x52cd('0x87')],_0xf5ef9f['data2'],_0x3c8ea9[_0x52cd('0x80')]);})[_0x52cd('0x25')](function(_0x410f7a){if(_0x410f7a&&_0x410f7a['Buckets']){var _0xdbd545=_[_0x52cd('0x45')](_0x410f7a[_0x52cd('0x8a')],function(_0x257812){return _0x257812[_0x52cd('0x8b')]===_0x3c8ea9['bucket'];});if(!_0xdbd545){logger[_0x52cd('0x64')](util[_0x52cd('0x5f')](_0x52cd('0x8c'),_0x596be9[_0x52cd('0x43')]['id'],_0x3c8ea9[_0x52cd('0x6f')]));return createBucket(_0xf5ef9f[_0x52cd('0x87')],_0xf5ef9f[_0x52cd('0x88')],_0x3c8ea9['transcribeRegion'],_0x3c8ea9['bucket']);}logger[_0x52cd('0x64')](util['format'](_0x52cd('0x8d'),_0x596be9[_0x52cd('0x43')]['id'],_0x3c8ea9['bucket']));return;}})[_0x52cd('0x25')](function(_0x2a001b){if(_0x484fd5[_0x52cd('0x78')]===_0x52cd('0x8e')){return transcribe(_0x596be9[_0x52cd('0x43')]['id'],_0xf5ef9f['data1'],_0xf5ef9f[_0x52cd('0x88')],_0x3c8ea9['transcribeRegion'],_0x3c8ea9['bucket'],_0x484fd5[_0x52cd('0x4c')],_0x3c8ea9[_0x52cd('0x81')]);}else{logger[_0x52cd('0x64')](util['format'](_0x52cd('0x8f'),_0x596be9[_0x52cd('0x43')]['id']));return{'transcribeStatus':_0x52cd('0x90')};}})['then'](function(_0x2a1903){if(_0x2a1903){_0x2a1903[_0x52cd('0x91')]=_0x596be9[_0x52cd('0x48')][_0x52cd('0x92')];return _0x484fd5['updateAttributes'](_0x2a1903);}})[_0x52cd('0x25')](respondWithResult(_0x417347,null))[_0x52cd('0x46')](handleError(_0x417347,null));};function writeFile(_0x45b365,_0x427d58){return new Promise(function(_0x53840f,_0x10d747){fs[_0x52cd('0x93')](_0x427d58,_0x45b365,function(_0x55a19f,_0x3d8dca){if(_0x55a19f){return _0x10d747(_0x55a19f);}else{return _0x53840f(_0x3d8dca);}});});}exports[_0x52cd('0x94')]=function(_0x3c4127,_0x387426,_0x3d9909){return db[_0x52cd('0x2a')][_0x52cd('0x7b')]({'where':{'id':_0x3c4127['params']['id']}})[_0x52cd('0x25')](handleEntityNotFound(_0x387426))['then'](function(_0x2bda06){if(_0x2bda06&&_0x2bda06[_0x52cd('0x95')]){var _0x5ed466=_0x2bda06['fileText'];var _0x27d10a=config[_0x52cd('0x96')]+_0x52cd('0x97')+_0x2bda06['id']+_0x52cd('0x98');if(fs[_0x52cd('0x4d')](_0x27d10a)){return _0x27d10a;}return writeFile(_0x5ed466,_0x27d10a)[_0x52cd('0x25')](function(){return _0x27d10a;});}else{throw new db[(_0x52cd('0x50'))][(_0x52cd('0x51'))](_0x52cd('0x99'));}})[_0x52cd('0x25')](function(_0x32ff32){return _0x387426[_0x52cd('0x54')](_0x32ff32);})[_0x52cd('0x46')](handleError(_0x387426));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index cf7f45f..7f5f284 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 _0x6e12=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x3faa4d,_0xc0dce7){var _0x4e9ade=function(_0x15e0fc){while(--_0x15e0fc){_0x3faa4d['push'](_0x3faa4d['shift']());}};_0x4e9ade(++_0xc0dce7);}(_0x6e12,0x154));var _0x26e1=function(_0x3d29a6,_0x5e72ac){_0x3d29a6=_0x3d29a6-0x0;var _0x113581=_0x6e12[_0x3d29a6];return _0x113581;};'use strict';var attributes=require(_0x26e1('0x0'));module[_0x26e1('0x1')]=function(_0x195130,_0x6733d8){return _0x195130['define'](_0x26e1('0x2'),attributes,{'tableName':_0x26e1('0x3'),'paranoid':![],'indexes':[{'name':_0x26e1('0x4'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0x26e1('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf197=['./voiceRecording.attributes','exports','VoiceRecording','transcribeStatus'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xf197,0x130));var _0x7f19=function(_0x356ae7,_0x1433cf){_0x356ae7=_0x356ae7-0x0;var _0x57a808=_0xf197[_0x356ae7];return _0x57a808;};'use strict';var attributes=require(_0x7f19('0x0'));module[_0x7f19('0x1')]=function(_0x37f54a,_0x4aa601){return _0x37f54a['define'](_0x7f19('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0x7f19('0x3'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 650c78b..f71e68a 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 _0x0295=['client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5e6d37,_0x1eef31){var _0x21a7dd=function(_0x2585f4){while(--_0x2585f4){_0x5e6d37['push'](_0x5e6d37['shift']());}};_0x21a7dd(++_0x1eef31);}(_0x0295,0x1f0));var _0x5029=function(_0xbe48c2,_0x3db103){_0xbe48c2=_0xbe48c2-0x0;var _0x39a679=_0x0295[_0xbe48c2];return _0x39a679;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['UpdateVoiceRecording']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')](_0x1ed567[_0x5029('0x17')],{'raw':_0x1ed567['options']?_0x1ed567[_0x5029('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed567[_0x5029('0x18')]?_0x1ed567[_0x5029('0x18')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options']['attributes']||null:null,'limit':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options'][_0x5029('0x1a')]||null:null})[_0x5029('0xa')](function(_0x1eb228){logger[_0x5029('0xb')](_0x5029('0x1b'),_0x1ed567);logger[_0x5029('0xd')](_0x5029('0x1b'),_0x1ed567,JSON[_0x5029('0xf')](_0x1eb228));_0x35de81(_0x1eb228);})[_0x5029('0x14')](function(_0x4ceaae){logger['error']('UpdateVoiceRecording',_0x4ceaae[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155[_0x5029('0x10')](0x1f4,_0x4ceaae['message']));});});};exports['CreateVoiceRecording']=function(_0x181da0){var _0x1e7e61=this;return new Promise(function(_0x36d810,_0x5527fc){var _0x2c501f=require(_0x5029('0x1c'));var _0x5e45c4;return db[_0x5029('0x1d')][_0x5029('0x1e')]({'attributes':['id',_0x5029('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32da06){_0x5e45c4=_0x32da06;return db[_0x5029('0x15')][_0x5029('0x20')](_0x181da0['body']);})[_0x5029('0xa')](function(_0x2bb398){if(_0x5e45c4['callRecordingEncryption']&&fs[_0x5029('0x21')](_0x2bb398[_0x5029('0x22')])){var _0x4434ff=util[_0x5029('0x23')](_0x5029('0x24'),_0x2bb398[_0x5029('0x22')]);return _0x2c501f[_0x5029('0x25')](_0x2bb398[_0x5029('0x22')],_0x4434ff,config[_0x5029('0x26')][_0x5029('0x27')])[_0x5029('0xa')](function(){fs[_0x5029('0x28')](_0x2bb398['value']);logger[_0x5029('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2bb398;});}return _0x2bb398;})[_0x5029('0xa')](function(_0x4f672e){logger['info'](_0x5029('0x29'),_0x181da0);logger[_0x5029('0xd')](_0x5029('0x29'),_0x181da0,JSON['stringify'](_0x4f672e));_0x36d810(_0x4f672e);})[_0x5029('0x14')](function(_0x15d882){logger[_0x5029('0x10')](_0x5029('0x29'),_0x15d882[_0x5029('0x12')],_0x181da0);_0x5527fc(_0x1e7e61[_0x5029('0x10')](0x1f4,_0x15d882[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x5f66=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','UpdateVoiceRecording','update','raw','options','where','attributes','../../components/encryptor','findOne','callRecordingEncryption','body','existsSync','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird'];(function(_0x5ce575,_0x3e8ab9){var _0x402fc5=function(_0x3ee2a0){while(--_0x3ee2a0){_0x5ce575['push'](_0x5ce575['shift']());}};_0x402fc5(++_0x3e8ab9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'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')]('VoiceRecording,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['VoiceRecording'][_0x65f6('0x16')](_0x1f974c['body'],{'raw':_0x1f974c['options']?_0x1f974c['options'][_0x65f6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f974c[_0x65f6('0x18')]?_0x1f974c['options'][_0x65f6('0x19')]||null:null,'attributes':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')][_0x65f6('0x1a')]||null:null,'limit':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')]['limit']||null:null})[_0x65f6('0xa')](function(_0x4bb39e){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')]('UpdateVoiceRecording',_0x1f974c,JSON[_0x65f6('0xf')](_0x4bb39e));_0x18380e(_0x4bb39e);})[_0x65f6('0x14')](function(_0x2317ce){logger[_0x65f6('0x12')]('UpdateVoiceRecording',_0x2317ce[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x2317ce[_0x65f6('0x11')]));});});};exports['CreateVoiceRecording']=function(_0x5cb131){var _0x4fde2f=this;return new Promise(function(_0x29abdb,_0x16cde8){var _0x4b2292=require(_0x65f6('0x1b'));var _0x28f710;return db['Setting'][_0x65f6('0x1c')]({'attributes':['id',_0x65f6('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x65f6('0xa')](function(_0x559330){_0x28f710=_0x559330;return db['VoiceRecording']['create'](_0x5cb131[_0x65f6('0x1e')]);})[_0x65f6('0xa')](function(_0x4344b3){if(_0x28f710[_0x65f6('0x1d')]&&fs[_0x65f6('0x1f')](_0x4344b3[_0x65f6('0x20')])){var _0x144e55=util['format']('%s.cypher',_0x4344b3[_0x65f6('0x20')]);return _0x4b2292[_0x65f6('0x21')](_0x4344b3['value'],_0x144e55,config['secrets'][_0x65f6('0x22')])[_0x65f6('0xa')](function(){fs[_0x65f6('0x23')](_0x4344b3[_0x65f6('0x20')]);logger[_0x65f6('0x13')](_0x65f6('0x24'));return _0x4344b3;});}return _0x4344b3;})['then'](function(_0x103265){logger[_0x65f6('0x13')](_0x65f6('0x25'),_0x5cb131);logger['debug'](_0x65f6('0x25'),_0x5cb131,JSON[_0x65f6('0xf')](_0x103265));_0x29abdb(_0x103265);})[_0x65f6('0x14')](function(_0x45510a){logger[_0x65f6('0x12')](_0x65f6('0x25'),_0x45510a['message'],_0x5cb131);_0x16cde8(_0x4fde2f[_0x65f6('0x12')](0x1f4,_0x45510a[_0x65f6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ad5a657..71f2802 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 _0x12ce=['get','isAuthenticated','index','/describe','describe','show','post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3e290f,_0x2e8395){var _0x234b0c=function(_0x2bb528){while(--_0x2bb528){_0x3e290f['push'](_0x3e290f['shift']());}};_0x234b0c(++_0x2e8395);}(_0x12ce,0x103));var _0xe12c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x12ce[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xe12c('0x0'));var util=require('util');var path=require(_0xe12c('0x1'));var timeout=require(_0xe12c('0x2'));var express=require('express');var router=express[_0xe12c('0x3')]();var fs_extra=require(_0xe12c('0x4'));var auth=require(_0xe12c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe12c('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xe12c('0x7')]('/',auth[_0xe12c('0x8')](),controller[_0xe12c('0x9')]);router[_0xe12c('0x7')](_0xe12c('0xa'),auth[_0xe12c('0x8')](),controller[_0xe12c('0xb')]);router[_0xe12c('0x7')]('/:id',auth[_0xe12c('0x8')](),controller[_0xe12c('0xc')]);router[_0xe12c('0xd')]('/',auth[_0xe12c('0x8')](),controller['create']);router['put'](_0xe12c('0xe'),auth['isAuthenticated'](),controller[_0xe12c('0xf')]);router[_0xe12c('0x10')]('/:id',auth[_0xe12c('0x8')](),controller[_0xe12c('0x11')]);module[_0xe12c('0x12')]=router; \ No newline at end of file +var _0x4f5c=['index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x3cbdb1,_0x1b055b){var _0x32100b=function(_0x201b6c){while(--_0x201b6c){_0x3cbdb1['push'](_0x3cbdb1['shift']());}};_0x32100b(++_0x1b055b);}(_0x4f5c,0x1f1));var _0xc4f5=function(_0x21aa94,_0x23a4bf){_0x21aa94=_0x21aa94-0x0;var _0x40a3e3=_0x4f5c[_0x21aa94];return _0x40a3e3;};'use strict';var multer=require(_0xc4f5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4f5('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc4f5('0x2'));var config=require(_0xc4f5('0x3'));var controller=require(_0xc4f5('0x4'));router[_0xc4f5('0x5')]('/',auth[_0xc4f5('0x6')](),controller[_0xc4f5('0x7')]);router['get']('/describe',auth[_0xc4f5('0x6')](),controller[_0xc4f5('0x8')]);router[_0xc4f5('0x5')](_0xc4f5('0x9'),auth[_0xc4f5('0x6')](),controller[_0xc4f5('0xa')]);router[_0xc4f5('0xb')]('/',auth[_0xc4f5('0x6')](),controller[_0xc4f5('0xc')]);router[_0xc4f5('0xd')](_0xc4f5('0x9'),auth[_0xc4f5('0x6')](),controller[_0xc4f5('0xe')]);router[_0xc4f5('0xf')](_0xc4f5('0x9'),auth[_0xc4f5('0x6')](),controller[_0xc4f5('0x10')]);module[_0xc4f5('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 65222ca..fabcdf4 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 _0x9bc8=['moment','ENUM','blind','STRING','Yes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9bc8,0x17c));var _0x89bc=function(_0x2e9ded,_0x235e2b){_0x2e9ded=_0x2e9ded-0x0;var _0xc88a61=_0x9bc8[_0x2e9ded];return _0xc88a61;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x89bc('0x0'));module['exports']={'type':{'type':Sequelize[_0x89bc('0x1')](_0x89bc('0x2'),'attended')},'result':{'type':Sequelize[_0x89bc('0x3')]},'transfererchannel':{'type':Sequelize[_0x89bc('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x89bc('0x3')]},'transferercalleridname':{'type':Sequelize[_0x89bc('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x89bc('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x89bc('0x3')]},'transferercontext':{'type':Sequelize[_0x89bc('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x89bc('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x89bc('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x89bc('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x89bc('0x3')]},'transfereecontext':{'type':Sequelize[_0x89bc('0x3')]},'transfereeexten':{'type':Sequelize[_0x89bc('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x89bc('0x1')](_0x89bc('0x4'),'No')},'context':{'type':Sequelize[_0x89bc('0x3')]},'extension':{'type':Sequelize[_0x89bc('0x3')]}}; \ No newline at end of file +var _0x56bc=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x2fe18d,_0x3b9d80){var _0x18cc81=function(_0x583f12){while(--_0x583f12){_0x2fe18d['push'](_0x2fe18d['shift']());}};_0x18cc81(++_0x3b9d80);}(_0x56bc,0xcd));var _0xc56b=function(_0x4461a0,_0x10fe41){_0x4461a0=_0x4461a0-0x0;var _0x3c8d9d=_0x56bc[_0x4461a0];return _0x3c8d9d;};'use strict';var Sequelize=require(_0xc56b('0x0'));var moment=require('moment');module[_0xc56b('0x1')]={'type':{'type':Sequelize[_0xc56b('0x2')](_0xc56b('0x3'),_0xc56b('0x4'))},'result':{'type':Sequelize[_0xc56b('0x5')]},'transfererchannel':{'type':Sequelize[_0xc56b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xc56b('0x5')]},'transferercalleridname':{'type':Sequelize[_0xc56b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xc56b('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xc56b('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xc56b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xc56b('0x5')]},'transfereechannel':{'type':Sequelize[_0xc56b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xc56b('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xc56b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc56b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc56b('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xc56b('0x5')]},'transfereeexten':{'type':Sequelize[_0xc56b('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xc56b('0x2')](_0xc56b('0x6'),'No')},'context':{'type':Sequelize[_0xc56b('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c449dc6..683b83e 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 _0xed20=['create','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','includeAll','findAll','rows','catch','show','include','find'];(function(_0x45c8e5,_0x57c993){var _0x508e63=function(_0x59d609){while(--_0x59d609){_0x45c8e5['push'](_0x45c8e5['shift']());}};_0x508e63(++_0x57c993);}(_0xed20,0xdf));var _0x0ed2=function(_0x31393d,_0x41ab1){_0x31393d=_0x31393d-0x0;var _0x3d6c0e=_0xed20[_0x31393d];return _0x3d6c0e;};'use strict';var emlformat=require(_0x0ed2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ed2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ed2('0x2'));var BPromise=require(_0x0ed2('0x3'));var Mustache=require(_0x0ed2('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0ed2('0x5'));var csv=require(_0x0ed2('0x6'));var ejs=require(_0x0ed2('0x7'));var fs=require('fs');var fs_extra=require(_0x0ed2('0x8'));var _=require(_0x0ed2('0x9'));var squel=require(_0x0ed2('0xa'));var crypto=require('crypto');var jsforce=require(_0x0ed2('0xb'));var deskjs=require(_0x0ed2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ed2('0xd'));var Redis=require(_0x0ed2('0xe'));var authService=require(_0x0ed2('0xf'));var qs=require(_0x0ed2('0x10'));var as=require(_0x0ed2('0x11'));var hardwareService=require(_0x0ed2('0x12'));var logger=require(_0x0ed2('0x13'))(_0x0ed2('0x14'));var utils=require('../../config/utils');var config=require(_0x0ed2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540ca2,_0x39fcfc){_0x39fcfc=_0x39fcfc||0xcc;return function(_0x28feb8){if(_0x28feb8){return _0x540ca2[_0x0ed2('0x16')](_0x39fcfc);}return _0x540ca2['status'](_0x39fcfc)['end']();};}function respondWithResult(_0xdc6be3,_0x1f015e){_0x1f015e=_0x1f015e||0xc8;return function(_0x1bfc29){if(_0x1bfc29){return _0xdc6be3[_0x0ed2('0x17')](_0x1f015e)[_0x0ed2('0x18')](_0x1bfc29);}};}function respondWithFilteredResult(_0x537b59,_0x5de416){return function(_0x5bd059){if(_0x5bd059){var _0x469dca=typeof _0x5de416[_0x0ed2('0x19')]===_0x0ed2('0x1a')&&typeof _0x5de416[_0x0ed2('0x1b')]===_0x0ed2('0x1a');var _0x2261a4=_0x5bd059[_0x0ed2('0x1c')];var _0x330338=_0x469dca?0x0:_0x5de416[_0x0ed2('0x19')];var _0x81341=_0x469dca?_0x5bd059[_0x0ed2('0x1c')]:_0x5de416[_0x0ed2('0x19')]+_0x5de416[_0x0ed2('0x1b')];var _0x4aaef0;if(_0x81341>=_0x2261a4){_0x81341=_0x2261a4;_0x4aaef0=0xc8;}else{_0x4aaef0=0xce;}_0x537b59[_0x0ed2('0x17')](_0x4aaef0);return _0x537b59['set'](_0x0ed2('0x1d'),_0x330338+'-'+_0x81341+'/'+_0x2261a4)[_0x0ed2('0x18')](_0x5bd059);}return null;};}function patchUpdates(_0x21f8d0){return function(_0xd60f24){try{jsonpatch['apply'](_0xd60f24,_0x21f8d0,!![]);}catch(_0x19c7a9){return BPromise[_0x0ed2('0x1e')](_0x19c7a9);}return _0xd60f24[_0x0ed2('0x1f')]();};}function saveUpdates(_0x522d63,_0x22fb23){return function(_0x6d923e){if(_0x6d923e){return _0x6d923e[_0x0ed2('0x20')](_0x522d63)['then'](function(_0x2e3f11){return _0x2e3f11;});}return null;};}function removeEntity(_0x305d63,_0x4c441a){return function(_0x5a9026){if(_0x5a9026){return _0x5a9026[_0x0ed2('0x21')]()[_0x0ed2('0x22')](function(){_0x305d63[_0x0ed2('0x17')](0xcc)[_0x0ed2('0x23')]();});}};}function handleEntityNotFound(_0x4f90d5,_0x2a4c8d){return function(_0x5a4b26){if(!_0x5a4b26){_0x4f90d5['sendStatus'](0x194);}return _0x5a4b26;};}function handleError(_0x4c9dd4,_0x1adfae){_0x1adfae=_0x1adfae||0x1f4;return function(_0x433ee0){logger[_0x0ed2('0x24')](_0x433ee0[_0x0ed2('0x25')]);if(_0x433ee0[_0x0ed2('0x26')]){delete _0x433ee0[_0x0ed2('0x26')];}_0x4c9dd4[_0x0ed2('0x17')](_0x1adfae)[_0x0ed2('0x27')](_0x433ee0);};}exports[_0x0ed2('0x28')]=function(_0x3fb5a5,_0x24f2dc){var _0x1e48dd={},_0xa414d7={},_0x474c5f={'count':0x0,'rows':[]};var _0x5134ef=_[_0x0ed2('0x29')](db[_0x0ed2('0x2a')][_0x0ed2('0x2b')],function(_0xdb0092){return{'name':_0xdb0092[_0x0ed2('0x2c')],'type':_0xdb0092[_0x0ed2('0x2d')][_0x0ed2('0x2e')]};});_0xa414d7[_0x0ed2('0x2f')]=_[_0x0ed2('0x29')](_0x5134ef,_0x0ed2('0x26'));_0xa414d7['query']=_[_0x0ed2('0x30')](_0x3fb5a5[_0x0ed2('0x31')]);_0xa414d7[_0x0ed2('0x32')]=_[_0x0ed2('0x33')](_0xa414d7[_0x0ed2('0x2f')],_0xa414d7[_0x0ed2('0x31')]);_0x1e48dd['attributes']=_['intersection'](_0xa414d7[_0x0ed2('0x2f')],qs[_0x0ed2('0x34')](_0x3fb5a5[_0x0ed2('0x31')][_0x0ed2('0x34')]));_0x1e48dd[_0x0ed2('0x35')]=_0x1e48dd[_0x0ed2('0x35')][_0x0ed2('0x36')]?_0x1e48dd[_0x0ed2('0x35')]:_0xa414d7[_0x0ed2('0x2f')];if(!_0x3fb5a5['query']['hasOwnProperty'](_0x0ed2('0x37'))){_0x1e48dd[_0x0ed2('0x1b')]=qs['limit'](_0x3fb5a5[_0x0ed2('0x31')][_0x0ed2('0x1b')]);_0x1e48dd['offset']=qs['offset'](_0x3fb5a5[_0x0ed2('0x31')][_0x0ed2('0x19')]);}_0x1e48dd[_0x0ed2('0x38')]=qs['sort'](_0x3fb5a5[_0x0ed2('0x31')][_0x0ed2('0x39')]);_0x1e48dd['where']=qs[_0x0ed2('0x32')](_[_0x0ed2('0x3a')](_0x3fb5a5[_0x0ed2('0x31')],_0xa414d7['filters']),_0x5134ef);if(_0x3fb5a5[_0x0ed2('0x31')][_0x0ed2('0x3b')]){_0x1e48dd[_0x0ed2('0x3c')]=_['merge'](_0x1e48dd[_0x0ed2('0x3c')],{'$or':_[_0x0ed2('0x29')](_0x5134ef,function(_0x35ca8a){if(_0x35ca8a[_0x0ed2('0x2d')]!=='VIRTUAL'){var _0x74f037={};_0x74f037[_0x35ca8a[_0x0ed2('0x26')]]={'$like':'%'+_0x3fb5a5['query'][_0x0ed2('0x3b')]+'%'};return _0x74f037;}})});}_0x1e48dd=_[_0x0ed2('0x3d')]({},_0x1e48dd,_0x3fb5a5['options']);var _0x5d40e2={'where':_0x1e48dd[_0x0ed2('0x3c')]};return db['VoiceTransferReport'][_0x0ed2('0x1c')](_0x5d40e2)['then'](function(_0x37e143){_0x474c5f[_0x0ed2('0x1c')]=_0x37e143;if(_0x3fb5a5[_0x0ed2('0x31')][_0x0ed2('0x3e')]){_0x1e48dd['include']=[{'all':!![]}];}return db[_0x0ed2('0x2a')][_0x0ed2('0x3f')](_0x1e48dd);})[_0x0ed2('0x22')](function(_0x2a8d3e){_0x474c5f[_0x0ed2('0x40')]=_0x2a8d3e;return _0x474c5f;})['then'](respondWithFilteredResult(_0x24f2dc,_0x1e48dd))[_0x0ed2('0x41')](handleError(_0x24f2dc,null));};exports[_0x0ed2('0x42')]=function(_0x5411de,_0x5c52ba){var _0x1ed40f={'raw':!![],'where':{'id':_0x5411de['params']['id']}},_0x1c1845={};_0x1c1845[_0x0ed2('0x2f')]=_[_0x0ed2('0x30')](db[_0x0ed2('0x2a')][_0x0ed2('0x2b')]);_0x1c1845['query']=_[_0x0ed2('0x30')](_0x5411de[_0x0ed2('0x31')]);_0x1c1845[_0x0ed2('0x32')]=_[_0x0ed2('0x33')](_0x1c1845[_0x0ed2('0x2f')],_0x1c1845[_0x0ed2('0x31')]);_0x1ed40f[_0x0ed2('0x35')]=_[_0x0ed2('0x33')](_0x1c1845['model'],qs[_0x0ed2('0x34')](_0x5411de['query']['fields']));_0x1ed40f[_0x0ed2('0x35')]=_0x1ed40f[_0x0ed2('0x35')][_0x0ed2('0x36')]?_0x1ed40f[_0x0ed2('0x35')]:_0x1c1845[_0x0ed2('0x2f')];if(_0x5411de[_0x0ed2('0x31')]['includeAll']){_0x1ed40f[_0x0ed2('0x43')]=[{'all':!![]}];}_0x1ed40f=_['merge']({},_0x1ed40f,_0x5411de['options']);return db['VoiceTransferReport'][_0x0ed2('0x44')](_0x1ed40f)['then'](handleEntityNotFound(_0x5c52ba,null))[_0x0ed2('0x22')](respondWithResult(_0x5c52ba,null))[_0x0ed2('0x41')](handleError(_0x5c52ba,null));};exports[_0x0ed2('0x45')]=function(_0x21ae31,_0x1f017e){return db[_0x0ed2('0x2a')][_0x0ed2('0x45')](_0x21ae31[_0x0ed2('0x46')],{})['then'](respondWithResult(_0x1f017e,0xc9))[_0x0ed2('0x41')](handleError(_0x1f017e,null));};exports[_0x0ed2('0x20')]=function(_0x534f59,_0x4d7029){if(_0x534f59['body']['id']){delete _0x534f59[_0x0ed2('0x46')]['id'];}return db[_0x0ed2('0x2a')][_0x0ed2('0x44')]({'where':{'id':_0x534f59[_0x0ed2('0x47')]['id']}})[_0x0ed2('0x22')](handleEntityNotFound(_0x4d7029,null))['then'](saveUpdates(_0x534f59[_0x0ed2('0x46')],null))['then'](respondWithResult(_0x4d7029,null))[_0x0ed2('0x41')](handleError(_0x4d7029,null));};exports[_0x0ed2('0x21')]=function(_0x39fbae,_0x2bd53c){return db[_0x0ed2('0x2a')][_0x0ed2('0x44')]({'where':{'id':_0x39fbae['params']['id']}})[_0x0ed2('0x22')](handleEntityNotFound(_0x2bd53c,null))[_0x0ed2('0x22')](removeEntity(_0x2bd53c,null))[_0x0ed2('0x41')](handleError(_0x2bd53c,null));};exports[_0x0ed2('0x48')]=function(_0x20734d,_0x282e10){return db[_0x0ed2('0x2a')][_0x0ed2('0x48')]()[_0x0ed2('0x22')](respondWithResult(_0x282e10,null))[_0x0ed2('0x41')](handleError(_0x282e10,null));}; \ No newline at end of file +var _0xc6cc=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','VoiceTransferReport','findAll','rows','catch','show','length','include','find','body','params','describe','eml-format','rimraf'];(function(_0x3a6d3d,_0xa49d86){var _0x3a81bb=function(_0x4b30fa){while(--_0x4b30fa){_0x3a6d3d['push'](_0x3a6d3d['shift']());}};_0x3a81bb(++_0xa49d86);}(_0xc6cc,0x12a));var _0xcc6c=function(_0x4ef837,_0x529c31){_0x4ef837=_0x4ef837-0x0;var _0x942ea6=_0xc6cc[_0x4ef837];return _0x942ea6;};'use strict';var emlformat=require(_0xcc6c('0x0'));var rimraf=require(_0xcc6c('0x1'));var zipdir=require(_0xcc6c('0x2'));var jsonpatch=require(_0xcc6c('0x3'));var rp=require(_0xcc6c('0x4'));var moment=require(_0xcc6c('0x5'));var BPromise=require(_0xcc6c('0x6'));var Mustache=require(_0xcc6c('0x7'));var util=require('util');var path=require(_0xcc6c('0x8'));var sox=require('sox');var csv=require(_0xcc6c('0x9'));var ejs=require(_0xcc6c('0xa'));var fs=require('fs');var fs_extra=require(_0xcc6c('0xb'));var _=require(_0xcc6c('0xc'));var squel=require('squel');var crypto=require(_0xcc6c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcc6c('0xe'));var toCsv=require(_0xcc6c('0x9'));var querystring=require(_0xcc6c('0xf'));var Papa=require(_0xcc6c('0x10'));var Redis=require(_0xcc6c('0x11'));var authService=require(_0xcc6c('0x12'));var qs=require(_0xcc6c('0x13'));var as=require(_0xcc6c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc6c('0x15'))(_0xcc6c('0x16'));var utils=require(_0xcc6c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcc6c('0x18'));var db=require(_0xcc6c('0x19'))['db'];function respondWithStatusCode(_0x2dd5e5,_0x491dfa){_0x491dfa=_0x491dfa||0xcc;return function(_0x3ec50c){if(_0x3ec50c){return _0x2dd5e5['sendStatus'](_0x491dfa);}return _0x2dd5e5[_0xcc6c('0x1a')](_0x491dfa)[_0xcc6c('0x1b')]();};}function respondWithResult(_0x53a257,_0x5b5d96){_0x5b5d96=_0x5b5d96||0xc8;return function(_0x2a6226){if(_0x2a6226){return _0x53a257[_0xcc6c('0x1a')](_0x5b5d96)[_0xcc6c('0x1c')](_0x2a6226);}};}function respondWithFilteredResult(_0xf2ab4a,_0x54c10a){return function(_0x3f5e91){if(_0x3f5e91){var _0xd7cf32=typeof _0x54c10a[_0xcc6c('0x1d')]===_0xcc6c('0x1e')&&typeof _0x54c10a[_0xcc6c('0x1f')]===_0xcc6c('0x1e');var _0x1bc826=_0x3f5e91[_0xcc6c('0x20')];var _0xdcab48=_0xd7cf32?0x0:_0x54c10a['offset'];var _0x1b3d56=_0xd7cf32?_0x3f5e91[_0xcc6c('0x20')]:_0x54c10a[_0xcc6c('0x1d')]+_0x54c10a[_0xcc6c('0x1f')];var _0x2c6762;if(_0x1b3d56>=_0x1bc826){_0x1b3d56=_0x1bc826;_0x2c6762=0xc8;}else{_0x2c6762=0xce;}_0xf2ab4a['status'](_0x2c6762);return _0xf2ab4a[_0xcc6c('0x21')]('Content-Range',_0xdcab48+'-'+_0x1b3d56+'/'+_0x1bc826)[_0xcc6c('0x1c')](_0x3f5e91);}return null;};}function patchUpdates(_0x39bffb){return function(_0x551f97){try{jsonpatch[_0xcc6c('0x22')](_0x551f97,_0x39bffb,!![]);}catch(_0x31dfbb){return BPromise['reject'](_0x31dfbb);}return _0x551f97[_0xcc6c('0x23')]();};}function saveUpdates(_0x3c06cd,_0x12aa80){return function(_0x3dc78c){if(_0x3dc78c){return _0x3dc78c[_0xcc6c('0x24')](_0x3c06cd)[_0xcc6c('0x25')](function(_0x31fc76){return _0x31fc76;});}return null;};}function removeEntity(_0x2535fb,_0x2f48fb){return function(_0x30f383){if(_0x30f383){return _0x30f383[_0xcc6c('0x26')]()[_0xcc6c('0x25')](function(){_0x2535fb[_0xcc6c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275d5f,_0x2d1829){return function(_0x3e1338){if(!_0x3e1338){_0x275d5f['sendStatus'](0x194);}return _0x3e1338;};}function handleError(_0x79c61c,_0x3633b2){_0x3633b2=_0x3633b2||0x1f4;return function(_0x3441ea){logger[_0xcc6c('0x27')](_0x3441ea[_0xcc6c('0x28')]);if(_0x3441ea['name']){delete _0x3441ea[_0xcc6c('0x29')];}_0x79c61c[_0xcc6c('0x1a')](_0x3633b2)[_0xcc6c('0x2a')](_0x3441ea);};}exports[_0xcc6c('0x2b')]=function(_0x534adf,_0x50219f){var _0x44543a={},_0x74c319={},_0x448847={'count':0x0,'rows':[]};var _0x575c04=_[_0xcc6c('0x2c')](db['VoiceTransferReport'][_0xcc6c('0x2d')],function(_0x2ed3b9){return{'name':_0x2ed3b9[_0xcc6c('0x2e')],'type':_0x2ed3b9['type'][_0xcc6c('0x2f')]};});_0x74c319[_0xcc6c('0x30')]=_[_0xcc6c('0x2c')](_0x575c04,_0xcc6c('0x29'));_0x74c319[_0xcc6c('0x31')]=_[_0xcc6c('0x32')](_0x534adf[_0xcc6c('0x31')]);_0x74c319[_0xcc6c('0x33')]=_[_0xcc6c('0x34')](_0x74c319[_0xcc6c('0x30')],_0x74c319[_0xcc6c('0x31')]);_0x44543a[_0xcc6c('0x35')]=_['intersection'](_0x74c319['model'],qs['fields'](_0x534adf[_0xcc6c('0x31')][_0xcc6c('0x36')]));_0x44543a['attributes']=_0x44543a[_0xcc6c('0x35')]['length']?_0x44543a['attributes']:_0x74c319['model'];if(!_0x534adf['query'][_0xcc6c('0x37')]('nolimit')){_0x44543a[_0xcc6c('0x1f')]=qs['limit'](_0x534adf[_0xcc6c('0x31')][_0xcc6c('0x1f')]);_0x44543a[_0xcc6c('0x1d')]=qs[_0xcc6c('0x1d')](_0x534adf['query'][_0xcc6c('0x1d')]);}_0x44543a['order']=qs[_0xcc6c('0x38')](_0x534adf[_0xcc6c('0x31')]['sort']);_0x44543a[_0xcc6c('0x39')]=qs[_0xcc6c('0x33')](_[_0xcc6c('0x3a')](_0x534adf[_0xcc6c('0x31')],_0x74c319[_0xcc6c('0x33')]),_0x575c04);if(_0x534adf[_0xcc6c('0x31')][_0xcc6c('0x3b')]){_0x44543a['where']=_[_0xcc6c('0x3c')](_0x44543a[_0xcc6c('0x39')],{'$or':_[_0xcc6c('0x2c')](_0x575c04,function(_0x4682dc){if(_0x4682dc['type']!==_0xcc6c('0x3d')){var _0x1f9315={};_0x1f9315[_0x4682dc['name']]={'$like':'%'+_0x534adf[_0xcc6c('0x31')][_0xcc6c('0x3b')]+'%'};return _0x1f9315;}})});}_0x44543a=_[_0xcc6c('0x3c')]({},_0x44543a,_0x534adf[_0xcc6c('0x3e')]);var _0x5cca13={'where':_0x44543a['where']};return db['VoiceTransferReport'][_0xcc6c('0x20')](_0x5cca13)[_0xcc6c('0x25')](function(_0x47e0f6){_0x448847[_0xcc6c('0x20')]=_0x47e0f6;if(_0x534adf[_0xcc6c('0x31')][_0xcc6c('0x3f')]){_0x44543a['include']=[{'all':!![]}];}return db[_0xcc6c('0x40')][_0xcc6c('0x41')](_0x44543a);})[_0xcc6c('0x25')](function(_0x1ec5d2){_0x448847[_0xcc6c('0x42')]=_0x1ec5d2;return _0x448847;})[_0xcc6c('0x25')](respondWithFilteredResult(_0x50219f,_0x44543a))[_0xcc6c('0x43')](handleError(_0x50219f,null));};exports[_0xcc6c('0x44')]=function(_0x590244,_0x32cff0){var _0x76f3a={'raw':!![],'where':{'id':_0x590244['params']['id']}},_0x4b8522={};_0x4b8522['model']=_[_0xcc6c('0x32')](db[_0xcc6c('0x40')]['rawAttributes']);_0x4b8522[_0xcc6c('0x31')]=_[_0xcc6c('0x32')](_0x590244[_0xcc6c('0x31')]);_0x4b8522[_0xcc6c('0x33')]=_[_0xcc6c('0x34')](_0x4b8522['model'],_0x4b8522[_0xcc6c('0x31')]);_0x76f3a['attributes']=_[_0xcc6c('0x34')](_0x4b8522[_0xcc6c('0x30')],qs[_0xcc6c('0x36')](_0x590244[_0xcc6c('0x31')][_0xcc6c('0x36')]));_0x76f3a[_0xcc6c('0x35')]=_0x76f3a['attributes'][_0xcc6c('0x45')]?_0x76f3a['attributes']:_0x4b8522[_0xcc6c('0x30')];if(_0x590244[_0xcc6c('0x31')][_0xcc6c('0x3f')]){_0x76f3a[_0xcc6c('0x46')]=[{'all':!![]}];}_0x76f3a=_['merge']({},_0x76f3a,_0x590244['options']);return db['VoiceTransferReport'][_0xcc6c('0x47')](_0x76f3a)[_0xcc6c('0x25')](handleEntityNotFound(_0x32cff0,null))[_0xcc6c('0x25')](respondWithResult(_0x32cff0,null))[_0xcc6c('0x43')](handleError(_0x32cff0,null));};exports['create']=function(_0x2e998a,_0x17e6a4){return db['VoiceTransferReport']['create'](_0x2e998a[_0xcc6c('0x48')],{})['then'](respondWithResult(_0x17e6a4,0xc9))[_0xcc6c('0x43')](handleError(_0x17e6a4,null));};exports[_0xcc6c('0x24')]=function(_0x405697,_0x45d711){if(_0x405697[_0xcc6c('0x48')]['id']){delete _0x405697[_0xcc6c('0x48')]['id'];}return db[_0xcc6c('0x40')][_0xcc6c('0x47')]({'where':{'id':_0x405697['params']['id']}})[_0xcc6c('0x25')](handleEntityNotFound(_0x45d711,null))[_0xcc6c('0x25')](saveUpdates(_0x405697[_0xcc6c('0x48')],null))[_0xcc6c('0x25')](respondWithResult(_0x45d711,null))['catch'](handleError(_0x45d711,null));};exports[_0xcc6c('0x26')]=function(_0x133203,_0x3e4433){return db['VoiceTransferReport'][_0xcc6c('0x47')]({'where':{'id':_0x133203[_0xcc6c('0x49')]['id']}})[_0xcc6c('0x25')](handleEntityNotFound(_0x3e4433,null))['then'](removeEntity(_0x3e4433,null))[_0xcc6c('0x43')](handleError(_0x3e4433,null));};exports[_0xcc6c('0x4a')]=function(_0x129db4,_0x3e0964){return db[_0xcc6c('0x40')][_0xcc6c('0x4a')]()[_0xcc6c('0x25')](respondWithResult(_0x3e0964,null))[_0xcc6c('0x43')](handleError(_0x3e0964,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f55c3e9..374f80c 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 _0x3477=['moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x1c0b71,_0x5a9945){var _0x29eddc=function(_0x182fa2){while(--_0x182fa2){_0x1c0b71['push'](_0x1c0b71['shift']());}};_0x29eddc(++_0x5a9945);}(_0x3477,0x81));var _0x7347=function(_0x3e8315,_0x47d23c){_0x3e8315=_0x3e8315-0x0;var _0x3c9a65=_0x3477[_0x3e8315];return _0x3c9a65;};'use strict';var _=require(_0x7347('0x0'));var util=require(_0x7347('0x1'));var logger=require(_0x7347('0x2'))('api');var moment=require(_0x7347('0x3'));var BPromise=require(_0x7347('0x4'));var rp=require(_0x7347('0x5'));var fs=require('fs');var path=require(_0x7347('0x6'));var rimraf=require('rimraf');var config=require(_0x7347('0x7'));var attributes=require(_0x7347('0x8'));module[_0x7347('0x9')]=function(_0x246c35,_0x5047d6){return _0x246c35[_0x7347('0xa')](_0x7347('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75e=['api','moment','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','../../config/logger'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa75e,0xbc));var _0xea75=function(_0x1f5494,_0x107c1f){_0x1f5494=_0x1f5494-0x0;var _0x36f9ea=_0xa75e[_0x1f5494];return _0x36f9ea;};'use strict';var _=require(_0xea75('0x0'));var util=require('util');var logger=require(_0xea75('0x1'))(_0xea75('0x2'));var moment=require(_0xea75('0x3'));var BPromise=require('bluebird');var rp=require(_0xea75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea75('0x5'));var config=require('../../config/environment');var attributes=require(_0xea75('0x6'));module[_0xea75('0x7')]=function(_0x4b34cf,_0x1ed6db){return _0x4b34cf[_0xea75('0x8')](_0xea75('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index c46626e..81ed269 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 _0xa4ca=['../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc5c4c8,_0x4fd908){var _0x73035f=function(_0x58c4d5){while(--_0x58c4d5){_0xc5c4c8['push'](_0xc5c4c8['shift']());}};_0x73035f(++_0x4fd908);}(_0xa4ca,0x1c8));var _0xaa4c=function(_0x374fc5,_0x10e737){_0x374fc5=_0x374fc5-0x0;var _0x41b9b4=_0xa4ca[_0x374fc5];return _0x41b9b4;};'use strict';var _=require(_0xaa4c('0x0'));var util=require(_0xaa4c('0x1'));var moment=require(_0xaa4c('0x2'));var BPromise=require(_0xaa4c('0x3'));var rs=require(_0xaa4c('0x4'));var fs=require('fs');var Redis=require(_0xaa4c('0x5'));var db=require(_0xaa4c('0x6'))['db'];var utils=require(_0xaa4c('0x7'));var logger=require(_0xaa4c('0x8'))('rpc');var config=require(_0xaa4c('0x9'));var jayson=require(_0xaa4c('0xa'));var client=jayson[_0xaa4c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a3c4,_0x4e061c,_0xcacd2a){return new BPromise(function(_0x3ca7a9,_0x305e7c){return client[_0xaa4c('0xc')](_0x53a3c4,_0xcacd2a)[_0xaa4c('0xd')](function(_0x2e8c72){logger['info'](_0xaa4c('0xe'),_0x4e061c,_0xaa4c('0xf'));logger[_0xaa4c('0x10')](_0xaa4c('0x11'),_0x4e061c,_0xaa4c('0xf'),JSON[_0xaa4c('0x12')](_0x2e8c72));if(_0x2e8c72[_0xaa4c('0x13')]){if(_0x2e8c72[_0xaa4c('0x13')][_0xaa4c('0x14')]===0x1f4){logger[_0xaa4c('0x13')](_0xaa4c('0xe'),_0x4e061c,_0x2e8c72[_0xaa4c('0x13')][_0xaa4c('0x15')]);return _0x305e7c(_0x2e8c72[_0xaa4c('0x13')]['message']);}logger[_0xaa4c('0x13')](_0xaa4c('0xe'),_0x4e061c,_0x2e8c72[_0xaa4c('0x13')][_0xaa4c('0x15')]);return _0x3ca7a9(_0x2e8c72[_0xaa4c('0x13')][_0xaa4c('0x15')]);}else{logger[_0xaa4c('0x16')](_0xaa4c('0xe'),_0x4e061c,'request\x20sent');_0x3ca7a9(_0x2e8c72[_0xaa4c('0x17')][_0xaa4c('0x15')]);}})[_0xaa4c('0x18')](function(_0x28f10b){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4e061c,_0x28f10b);_0x305e7c(_0x28f10b);});});}exports[_0xaa4c('0x19')]=function(_0x1239d5){var _0x265548=this;return new Promise(function(_0x139db4,_0x351f4d){return db[_0xaa4c('0x1a')][_0xaa4c('0x1b')](_0x1239d5[_0xaa4c('0x1c')],{'raw':_0x1239d5[_0xaa4c('0x1d')]?_0x1239d5[_0xaa4c('0x1d')][_0xaa4c('0x1e')]===undefined?!![]:![]:!![]})[_0xaa4c('0xd')](function(_0x4dd11d){logger[_0xaa4c('0x16')](_0xaa4c('0x19'),_0x1239d5);logger['debug'](_0xaa4c('0x19'),_0x1239d5,JSON['stringify'](_0x4dd11d));_0x139db4(_0x4dd11d);})[_0xaa4c('0x18')](function(_0x49eb50){logger['error']('CreateVoiceTransferReport',_0x49eb50[_0xaa4c('0x15')],_0x1239d5);_0x351f4d(_0x265548['error'](0x1f4,_0x49eb50[_0xaa4c('0x15')]));});});}; \ No newline at end of file +var _0xadfe=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateVoiceTransferReport','create','options','raw','stringify','util','moment','bluebird','randomstring','ioredis'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xadfe,0xe5));var _0xeadf=function(_0x538159,_0xdcf373){_0x538159=_0x538159-0x0;var _0x33d875=_0xadfe[_0x538159];return _0x33d875;};'use strict';var _=require('lodash');var util=require(_0xeadf('0x0'));var moment=require(_0xeadf('0x1'));var BPromise=require(_0xeadf('0x2'));var rs=require(_0xeadf('0x3'));var fs=require('fs');var Redis=require(_0xeadf('0x4'));var db=require(_0xeadf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeadf('0x6'))(_0xeadf('0x7'));var config=require('../../config/environment');var jayson=require(_0xeadf('0x8'));var client=jayson[_0xeadf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c74af,_0x4bb9ab,_0x4506a1){return new BPromise(function(_0x3c1a47,_0x227d1a){return client[_0xeadf('0xa')](_0x2c74af,_0x4506a1)[_0xeadf('0xb')](function(_0x4eab60){logger[_0xeadf('0xc')](_0xeadf('0xd'),_0x4bb9ab,'request\x20sent');logger[_0xeadf('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4bb9ab,_0xeadf('0xf'),JSON['stringify'](_0x4eab60));if(_0x4eab60[_0xeadf('0x10')]){if(_0x4eab60[_0xeadf('0x10')][_0xeadf('0x11')]===0x1f4){logger[_0xeadf('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4bb9ab,_0x4eab60[_0xeadf('0x10')]['message']);return _0x227d1a(_0x4eab60['error'][_0xeadf('0x12')]);}logger['error'](_0xeadf('0xd'),_0x4bb9ab,_0x4eab60[_0xeadf('0x10')]['message']);return _0x3c1a47(_0x4eab60[_0xeadf('0x10')][_0xeadf('0x12')]);}else{logger[_0xeadf('0xc')](_0xeadf('0xd'),_0x4bb9ab,_0xeadf('0xf'));_0x3c1a47(_0x4eab60[_0xeadf('0x13')][_0xeadf('0x12')]);}})[_0xeadf('0x14')](function(_0x14dab5){logger[_0xeadf('0x10')](_0xeadf('0xd'),_0x4bb9ab,_0x14dab5);_0x227d1a(_0x14dab5);});});}exports[_0xeadf('0x15')]=function(_0x483446){var _0x1c8087=this;return new Promise(function(_0x341c9d,_0x36f892){return db['VoiceTransferReport'][_0xeadf('0x16')](_0x483446['body'],{'raw':_0x483446['options']?_0x483446[_0xeadf('0x17')][_0xeadf('0x18')]===undefined?!![]:![]:!![]})[_0xeadf('0xb')](function(_0xcb2095){logger[_0xeadf('0xc')]('CreateVoiceTransferReport',_0x483446);logger[_0xeadf('0xe')](_0xeadf('0x15'),_0x483446,JSON[_0xeadf('0x19')](_0xcb2095));_0x341c9d(_0xcb2095);})[_0xeadf('0x14')](function(_0x1f65fe){logger[_0xeadf('0x10')](_0xeadf('0x15'),_0x1f65fe[_0xeadf('0x12')],_0x483446);_0x36f892(_0x1c8087[_0xeadf('0x10')](0x1f4,_0x1f65fe['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c6e18b9..3993ab1 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 _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x504582,_0x5b3965){var _0x43c6ce=function(_0x1199a4){while(--_0x1199a4){_0x504582['push'](_0x504582['shift']());}};_0x43c6ce(++_0x5b3965);}(_0x34e8,0x12c));var _0x834e=function(_0x4a48,_0x224810){_0x4a48=_0x4a48-0x0;var _0x3f3868=_0x34e8[_0x4a48];return _0x3f3868;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 68d5c79..700f88f 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 _0x1b32=['emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','length','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','hangup\x20executed!','catch','answer','answer\x20fired:','webbar:answer','hold','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x43af6f,_0x3af2f3){var _0x263537=function(_0x388f4c){while(--_0x388f4c){_0x43af6f['push'](_0x43af6f['shift']());}};_0x263537(++_0x3af2f3);}(_0x1b32,0x85));var _0x21b3=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x1b32[_0x486f4a];return _0x135d99;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x21b3('0x0'));var db=require(_0x21b3('0x1'))['db'];var config=require(_0x21b3('0x2'));var util=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var jayson=require(_0x21b3('0x5'));var amiClient=jayson[_0x21b3('0x6')][_0x21b3('0x7')]({'port':0x232a});var logger=require(_0x21b3('0x8'))(_0x21b3('0x9'));var Redis=require(_0x21b3('0xa'));config[_0x21b3('0xb')]=_[_0x21b3('0xc')](config[_0x21b3('0xb')],{'host':_0x21b3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21b3('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x12')]},'transferNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x15662a,_0xe6b2b7,_0x29f286){logger[_0x21b3('0x14')](_0x15662a,_0xe6b2b7,JSON['stringify'](_0x29f286));io['to'](_0x15662a)[_0x21b3('0x15')](_0xe6b2b7,_0x29f286);}function handleError(_0x47ae6c){return function(_0x408c17){console[_0x21b3('0x16')](_0x21b3('0x17'),_0x408c17,_0x408c17 instanceof RangeError);logger[_0x21b3('0x18')](_0x408c17['stack']);if(_0x408c17 instanceof RangeError){if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x194)['send'](_0x408c17);}else{if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x1f4)[_0x21b3('0x1b')](_0x408c17);}};}function checkError(){return function(_0x360e57){if(!_0x360e57){throw new RangeError(_0x21b3('0x1c'));}return _0x360e57;};}function respondWithRpcPromise(_0x1e5181,_0x4cc8e0){return new BPromise(function(_0xbb78f3,_0x54695b){var _0x139672=amiClient;return _0x139672[_0x21b3('0x1d')](_0x1e5181,_0x4cc8e0)[_0x21b3('0x1e')](function(_0x4fcb87){if(_0x4fcb87[_0x21b3('0x18')]){if(_0x4fcb87['error'][_0x21b3('0x1f')]===0x1f4){return _0x54695b(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}return _0xbb78f3(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}else{_0xbb78f3(_0x4fcb87[_0x21b3('0x21')]);}})['catch'](function(_0x5b752c){_0x54695b(_0x5b752c);});});}function getAgent(_0x49aab8){return db[_0x21b3('0x22')][_0x21b3('0x23')]({'where':{'id':_0x49aab8,'role':_0x21b3('0x24')}})[_0x21b3('0x1e')](checkError());}function getAgentCheckSession(_0x18eba4,_0x58a356){return new BPromise(function(_0x170e78,_0x564313){var _0x16d012=respondWithRpcPromise('VoiceChannels');var _0x469e42=getAgent(_0x18eba4);Promise[_0x21b3('0x25')]([_0x16d012,_0x469e42])[_0x21b3('0x1e')](function(_0x4f6432){var _0x291e52=_0x4f6432[0x0];var _0x300977=_0x4f6432[0x1];var _0x336b1e=_[_0x21b3('0x26')](_0x291e52[_0x21b3('0x27')],function(_0x210c49){return _0x210c49[_0x21b3('0x28')]==_0x300977['id']&&_0x210c49['sessionId']==_0x58a356;});if(_0x336b1e['length']==0x1){_0x170e78(_0x300977);}else{_0x564313(new RangeError(_0x21b3('0x29')+_0x58a356+_0x21b3('0x2a')));}});});}exports['originate']=function(_0x45c753,_0xa04ac7){logger[_0x21b3('0x14')](_0x21b3('0x2b'),_0x45c753[_0x21b3('0x2c')]);var _0x6c56f5=originateValidation[_0x21b3('0x2d')](_0x45c753[_0x21b3('0x2c')]);if(_0x6c56f5[_0x21b3('0x2e')]>0x0){return _0xa04ac7['status'](0x190)['json'](_0x6c56f5);}var _0x18946f=_0x45c753['body'][_0x21b3('0x2f')];var _0x2d8c12=_0x45c753['body'][_0x21b3('0x30')];var _0x403cec=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x31')];var _0x4c4239=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x32')];return getAgent(_0x18946f)[_0x21b3('0x1e')](function(_0x118b9b){logger['info'](_0x21b3('0x33'),_0x118b9b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x118b9b[_0x21b3('0x19')]),_0x21b3('0x36'),{'callNumber':_0x2d8c12,'callerId':_0x403cec,'callbackUrl':_0x4c4239});return _0xa04ac7[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x38')});})['catch'](handleError(_0xa04ac7));};exports['hangup']=function(_0x28641f,_0x86027e){logger[_0x21b3('0x14')](_0x21b3('0x39'),_0x28641f['body']);var _0x1c190e=hangupValidation[_0x21b3('0x2d')](_0x28641f[_0x21b3('0x2c')]);if(_0x1c190e[_0x21b3('0x2e')]>0x0){return _0x86027e[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x1c190e);}var _0xbb93cd=_0x28641f[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x3145b2=_0x28641f[_0x21b3('0x2c')]['sessionId'];return getAgent(_0xbb93cd)[_0x21b3('0x1e')](function(_0x321050){logger['info'](_0x21b3('0x33'),_0x321050['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x321050['name']),'webbar:hangup',{'sessionId':_0x3145b2});return _0x86027e['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x3a')});})[_0x21b3('0x3b')](handleError(_0x86027e));};exports[_0x21b3('0x3c')]=function(_0x548652,_0x5d310c){logger[_0x21b3('0x14')](_0x21b3('0x3d'),_0x548652[_0x21b3('0x2c')]);var _0x28adbc=answerValidation[_0x21b3('0x2d')](_0x548652[_0x21b3('0x2c')]);if(_0x28adbc[_0x21b3('0x2e')]>0x0){return _0x5d310c['status'](0x190)[_0x21b3('0x37')](_0x28adbc);}var _0x44cf7d=_0x548652[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x119b43=_0x548652[_0x21b3('0x2c')]['sessionId'];return getAgent(_0x44cf7d)['then'](function(_0x1e7e1b){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x1e7e1b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x1e7e1b[_0x21b3('0x19')]),_0x21b3('0x3e'),{'sessionId':_0x119b43});return _0x5d310c[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'answer\x20executed!'});})[_0x21b3('0x3b')](handleError(_0x5d310c));};exports[_0x21b3('0x3f')]=function(_0x3bc4ef,_0x4e3d2b){logger['info']('hold\x20fired:',_0x3bc4ef[_0x21b3('0x2c')]);var _0x17b878=holdValidation[_0x21b3('0x2d')](_0x3bc4ef[_0x21b3('0x2c')]);if(_0x17b878[_0x21b3('0x2e')]>0x0){return _0x4e3d2b[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x17b878);}var _0x30d48b=_0x3bc4ef[_0x21b3('0x2c')]['userId'];var _0x542ef4=_0x3bc4ef['body'][_0x21b3('0x40')];return getAgent(_0x30d48b)[_0x21b3('0x1e')](function(_0x4046cd){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x4046cd[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x4046cd[_0x21b3('0x19')]),_0x21b3('0x41'),{'sessionId':_0x542ef4});return _0x4e3d2b['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x42')});})[_0x21b3('0x3b')](handleError(_0x4e3d2b));};exports[_0x21b3('0x43')]=function(_0x34509e,_0x2c7019){logger[_0x21b3('0x14')](_0x21b3('0x44'),_0x34509e[_0x21b3('0x2c')]);var _0x58c568=unholdValidation[_0x21b3('0x2d')](_0x34509e[_0x21b3('0x2c')]);if(_0x58c568[_0x21b3('0x2e')]>0x0){return _0x2c7019[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x58c568);}var _0x5d7ee7=_0x34509e['body'][_0x21b3('0x2f')];var _0x4bd19f=_0x34509e[_0x21b3('0x2c')][_0x21b3('0x40')];return getAgent(_0x5d7ee7)[_0x21b3('0x1e')](function(_0x412536){logger['info']('entityFound:',_0x412536[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x412536[_0x21b3('0x19')]),'webbar:unhold',{'sessionId':_0x4bd19f});return _0x2c7019[_0x21b3('0x1a')](0xc8)['json']({'error':![],'message':_0x21b3('0x45')});})[_0x21b3('0x3b')](handleError(_0x2c7019));};exports['calls']=function(_0x5f55ff,_0x3fd841){logger[_0x21b3('0x14')](_0x21b3('0x46'),_0x3fd841[_0x21b3('0x2c')]);var _0xc612b5=callsValidation[_0x21b3('0x2d')](_0x5f55ff[_0x21b3('0x2c')]);if(_0xc612b5['length']>0x0){return _0x3fd841[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0xc612b5);}var _0x166a31=_0x5f55ff[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x49a40e=respondWithRpcPromise('VoiceChannels');var _0x31c8f8=getAgent(_0x166a31);return Promise[_0x21b3('0x25')]([_0x49a40e,_0x31c8f8])[_0x21b3('0x1e')](function(_0x279b7d){var _0x18582e=_0x279b7d[0x0];var _0x4f728=_0x279b7d[0x1];var _0x5b1611=_[_0x21b3('0x26')](_0x18582e[_0x21b3('0x27')],function(_0x552141){return _0x552141[_0x21b3('0x28')]==_0x4f728['id'];});return _0x3fd841['status'](0xc8)[_0x21b3('0x37')]({'count':_0x5b1611[_0x21b3('0x2e')],'rows':_0x5b1611});})[_0x21b3('0x3b')](handleError(_0x3fd841));};exports[_0x21b3('0x47')]=function(_0x542c4e,_0x193317){logger['info'](_0x21b3('0x48'),_0x542c4e[_0x21b3('0x2c')]);var _0x3d285f=conferenceValidation[_0x21b3('0x2d')](_0x542c4e[_0x21b3('0x2c')]);if(_0x3d285f['length']>0x0){return _0x193317[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3d285f);}var _0x1821bf=_0x542c4e[_0x21b3('0x2c')][_0x21b3('0x2f')];return getAgent(_0x1821bf)[_0x21b3('0x1e')](function(_0xf6eb3){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0xf6eb3[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0xf6eb3[_0x21b3('0x19')]),_0x21b3('0x49'));return _0x193317[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x4a')});})[_0x21b3('0x3b')](handleError(_0x193317));};exports['transfer']=function(_0x412e3b,_0xc0c8f){logger[_0x21b3('0x14')]('transfer\x20fired:',_0x412e3b[_0x21b3('0x2c')]);var _0x3572e1=transferValidation[_0x21b3('0x2d')](_0x412e3b['body']);if(_0x3572e1[_0x21b3('0x2e')]>0x0){return _0xc0c8f[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3572e1);}var _0x1655e4=_0x412e3b[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x2d33a7=_0x412e3b['body']['sessionId'];var _0x31c511=_0x412e3b['body'][_0x21b3('0x4b')];return getAgent(_0x1655e4)[_0x21b3('0x1e')](function(_0x164d9f){logger['info'](_0x21b3('0x33'),_0x164d9f[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x164d9f[_0x21b3('0x19')]),_0x21b3('0x4c'),{'sessionId':_0x2d33a7,'transferNumber':_0x31c511});return _0xc0c8f[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc0c8f));}; \ No newline at end of file +var _0x1cc7=['stringify','emit','log','handleError:','stack','name','send','status','NotFound','request','then','error','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','hangup','hangup\x20fired:','userId','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','jayson/promise','client','http','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number'];(function(_0x2bc6b7,_0x524f6c){var _0x4205c0=function(_0x5283d4){while(--_0x5283d4){_0x2bc6b7['push'](_0x2bc6b7['shift']());}};_0x4205c0(++_0x524f6c);}(_0x1cc7,0x15a));var _0x71cc=function(_0x11e5b1,_0x5de0e7){_0x11e5b1=_0x11e5b1-0x0;var _0x3dd083=_0x1cc7[_0x11e5b1];return _0x3dd083;};'use strict';var path=require(_0x71cc('0x0'));var fs=require('fs');var _=require(_0x71cc('0x1'));var db=require(_0x71cc('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x71cc('0x3'));var amiClient=jayson[_0x71cc('0x4')][_0x71cc('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0x71cc('0x6')]=_['defaults'](config[_0x71cc('0x6')],{'host':_0x71cc('0x7'),'port':0x18eb});var io=require(_0x71cc('0x8'))(new Redis(config[_0x71cc('0x6')]));var Schema=require(_0x71cc('0x9'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x71cc('0xa')]},'callNumber':{'type':_0x71cc('0xb'),'required':[!![],_0x71cc('0xc')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x71cc('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x71cc('0xd'),'required':[!![],_0x71cc('0xa')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x71cc('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x71cc('0xb'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x71cc('0xb'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x71cc('0xd'),'required':[!![],_0x71cc('0xa')]},'sessionId':{'type':_0x71cc('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x71cc('0xd'),'required':[!![],_0x71cc('0xa')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x71cc('0xd'),'required':[!![],_0x71cc('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0x71cc('0xd'),'required':[!![],_0x71cc('0xa')]}});function emit(_0x3875b8,_0x14087c,_0x1e359d){logger['info'](_0x3875b8,_0x14087c,JSON[_0x71cc('0xe')](_0x1e359d));io['to'](_0x3875b8)[_0x71cc('0xf')](_0x14087c,_0x1e359d);}function handleError(_0x1a7d71){return function(_0x1d1da8){console[_0x71cc('0x10')](_0x71cc('0x11'),_0x1d1da8,_0x1d1da8 instanceof RangeError);logger['error'](_0x1d1da8[_0x71cc('0x12')]);if(_0x1d1da8 instanceof RangeError){if(_0x1d1da8[_0x71cc('0x13')]){delete _0x1d1da8['name'];}_0x1a7d71['status'](0x194)[_0x71cc('0x14')](_0x1d1da8);}else{if(_0x1d1da8[_0x71cc('0x13')]){delete _0x1d1da8[_0x71cc('0x13')];}_0x1a7d71[_0x71cc('0x15')](0x1f4)[_0x71cc('0x14')](_0x1d1da8);}};}function checkError(){return function(_0xccbfb){if(!_0xccbfb){throw new RangeError(_0x71cc('0x16'));}return _0xccbfb;};}function respondWithRpcPromise(_0x18683d,_0x4cfba0){return new BPromise(function(_0x1442ef,_0x109239){var _0x587a0b=amiClient;return _0x587a0b[_0x71cc('0x17')](_0x18683d,_0x4cfba0)[_0x71cc('0x18')](function(_0x38f58e){if(_0x38f58e[_0x71cc('0x19')]){if(_0x38f58e[_0x71cc('0x19')][_0x71cc('0x1a')]===0x1f4){return _0x109239(_0x38f58e['error'][_0x71cc('0x1b')]);}return _0x1442ef(_0x38f58e[_0x71cc('0x19')][_0x71cc('0x1b')]);}else{_0x1442ef(_0x38f58e[_0x71cc('0x1c')]);}})[_0x71cc('0x1d')](function(_0x5fa323){_0x109239(_0x5fa323);});});}function getAgent(_0x27b933){return db[_0x71cc('0x1e')][_0x71cc('0x1f')]({'where':{'id':_0x27b933,'role':'agent'}})[_0x71cc('0x18')](checkError());}function getAgentCheckSession(_0x43c155,_0x28e095){return new BPromise(function(_0x26becf,_0x20b093){var _0x1fa9c1=respondWithRpcPromise(_0x71cc('0x20'));var _0x9a7ca3=getAgent(_0x43c155);Promise[_0x71cc('0x21')]([_0x1fa9c1,_0x9a7ca3])[_0x71cc('0x18')](function(_0x30f94d){var _0x35f723=_0x30f94d[0x0];var _0x1d5805=_0x30f94d[0x1];var _0x2db9c9=_[_0x71cc('0x22')](_0x35f723[_0x71cc('0x23')],function(_0x4fa63e){return _0x4fa63e[_0x71cc('0x24')]==_0x1d5805['id']&&_0x4fa63e[_0x71cc('0x25')]==_0x28e095;});if(_0x2db9c9[_0x71cc('0x26')]==0x1){_0x26becf(_0x1d5805);}else{_0x20b093(new RangeError(_0x71cc('0x27')+_0x28e095+_0x71cc('0x28')));}});});}exports[_0x71cc('0x29')]=function(_0x4a44c1,_0x3110e3){logger[_0x71cc('0x2a')](_0x71cc('0x2b'),_0x4a44c1[_0x71cc('0x2c')]);var _0x3b11ba=originateValidation[_0x71cc('0x9')](_0x4a44c1[_0x71cc('0x2c')]);if(_0x3b11ba['length']>0x0){return _0x3110e3[_0x71cc('0x15')](0x190)['json'](_0x3b11ba);}var _0x5f3c24=_0x4a44c1[_0x71cc('0x2c')]['userId'];var _0x4fa34d=_0x4a44c1[_0x71cc('0x2c')]['callNumber'];var _0xf86f30=_0x4a44c1['body'][_0x71cc('0x2d')];var _0x1d8560=_0x4a44c1['body'][_0x71cc('0x2e')];return getAgent(_0x5f3c24)[_0x71cc('0x18')](function(_0x2ab9fb){logger[_0x71cc('0x2a')](_0x71cc('0x2f'),_0x2ab9fb[_0x71cc('0x13')]);emit(util[_0x71cc('0x30')](_0x71cc('0x31'),_0x2ab9fb[_0x71cc('0x13')]),_0x71cc('0x32'),{'callNumber':_0x4fa34d,'callerId':_0xf86f30,'callbackUrl':_0x1d8560});return _0x3110e3['status'](0xc8)[_0x71cc('0x33')]({'error':![],'message':'originate\x20executed!'});})[_0x71cc('0x1d')](handleError(_0x3110e3));};exports[_0x71cc('0x34')]=function(_0x3e9812,_0x9328e2){logger[_0x71cc('0x2a')](_0x71cc('0x35'),_0x3e9812['body']);var _0x38a701=hangupValidation['validate'](_0x3e9812[_0x71cc('0x2c')]);if(_0x38a701[_0x71cc('0x26')]>0x0){return _0x9328e2[_0x71cc('0x15')](0x190)['json'](_0x38a701);}var _0x588748=_0x3e9812['body'][_0x71cc('0x36')];var _0x33190b=_0x3e9812[_0x71cc('0x2c')][_0x71cc('0x25')];return getAgent(_0x588748)[_0x71cc('0x18')](function(_0x1e7e67){logger[_0x71cc('0x2a')](_0x71cc('0x2f'),_0x1e7e67[_0x71cc('0x13')]);emit(util[_0x71cc('0x30')](_0x71cc('0x31'),_0x1e7e67[_0x71cc('0x13')]),'webbar:hangup',{'sessionId':_0x33190b});return _0x9328e2[_0x71cc('0x15')](0xc8)[_0x71cc('0x33')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x9328e2));};exports[_0x71cc('0x37')]=function(_0x21492b,_0x490b46){logger[_0x71cc('0x2a')](_0x71cc('0x38'),_0x21492b[_0x71cc('0x2c')]);var _0x19d7c8=answerValidation[_0x71cc('0x9')](_0x21492b['body']);if(_0x19d7c8['length']>0x0){return _0x490b46['status'](0x190)[_0x71cc('0x33')](_0x19d7c8);}var _0x51c0e7=_0x21492b[_0x71cc('0x2c')][_0x71cc('0x36')];var _0x70cd0e=_0x21492b[_0x71cc('0x2c')][_0x71cc('0x25')];return getAgent(_0x51c0e7)[_0x71cc('0x18')](function(_0x383af4){logger[_0x71cc('0x2a')](_0x71cc('0x2f'),_0x383af4[_0x71cc('0x13')]);emit(util[_0x71cc('0x30')](_0x71cc('0x31'),_0x383af4[_0x71cc('0x13')]),'webbar:answer',{'sessionId':_0x70cd0e});return _0x490b46[_0x71cc('0x15')](0xc8)[_0x71cc('0x33')]({'error':![],'message':_0x71cc('0x39')});})['catch'](handleError(_0x490b46));};exports[_0x71cc('0x3a')]=function(_0x3478f1,_0x30cf8a){logger[_0x71cc('0x2a')](_0x71cc('0x3b'),_0x3478f1[_0x71cc('0x2c')]);var _0x14f645=holdValidation[_0x71cc('0x9')](_0x3478f1[_0x71cc('0x2c')]);if(_0x14f645[_0x71cc('0x26')]>0x0){return _0x30cf8a[_0x71cc('0x15')](0x190)[_0x71cc('0x33')](_0x14f645);}var _0x47cefc=_0x3478f1[_0x71cc('0x2c')][_0x71cc('0x36')];var _0x3050c6=_0x3478f1[_0x71cc('0x2c')][_0x71cc('0x25')];return getAgent(_0x47cefc)[_0x71cc('0x18')](function(_0x430387){logger['info'](_0x71cc('0x2f'),_0x430387[_0x71cc('0x13')]);emit(util['format'](_0x71cc('0x31'),_0x430387[_0x71cc('0x13')]),_0x71cc('0x3c'),{'sessionId':_0x3050c6});return _0x30cf8a[_0x71cc('0x15')](0xc8)[_0x71cc('0x33')]({'error':![],'message':_0x71cc('0x3d')});})[_0x71cc('0x1d')](handleError(_0x30cf8a));};exports[_0x71cc('0x3e')]=function(_0x3cf0bf,_0x1647ce){logger[_0x71cc('0x2a')]('unhold\x20fired:',_0x3cf0bf[_0x71cc('0x2c')]);var _0x4e5bba=unholdValidation[_0x71cc('0x9')](_0x3cf0bf['body']);if(_0x4e5bba[_0x71cc('0x26')]>0x0){return _0x1647ce[_0x71cc('0x15')](0x190)['json'](_0x4e5bba);}var _0x2cac03=_0x3cf0bf[_0x71cc('0x2c')]['userId'];var _0x3edacf=_0x3cf0bf[_0x71cc('0x2c')][_0x71cc('0x25')];return getAgent(_0x2cac03)[_0x71cc('0x18')](function(_0x3ac021){logger[_0x71cc('0x2a')](_0x71cc('0x2f'),_0x3ac021['name']);emit(util[_0x71cc('0x30')](_0x71cc('0x31'),_0x3ac021['name']),'webbar:unhold',{'sessionId':_0x3edacf});return _0x1647ce[_0x71cc('0x15')](0xc8)[_0x71cc('0x33')]({'error':![],'message':'unhold\x20executed!'});})[_0x71cc('0x1d')](handleError(_0x1647ce));};exports[_0x71cc('0x3f')]=function(_0x3a2a0a,_0x3dd56d){logger[_0x71cc('0x2a')](_0x71cc('0x40'),_0x3dd56d['body']);var _0x49cd24=callsValidation[_0x71cc('0x9')](_0x3a2a0a['body']);if(_0x49cd24['length']>0x0){return _0x3dd56d[_0x71cc('0x15')](0x190)['json'](_0x49cd24);}var _0x47de7b=_0x3a2a0a['body']['userId'];var _0x572c62=respondWithRpcPromise(_0x71cc('0x20'));var _0x4b5587=getAgent(_0x47de7b);return Promise['all']([_0x572c62,_0x4b5587])[_0x71cc('0x18')](function(_0xbf7295){var _0x37190f=_0xbf7295[0x0];var _0x98e79b=_0xbf7295[0x1];var _0x2b108e=_[_0x71cc('0x22')](_0x37190f['rows'],function(_0x5b5bd0){return _0x5b5bd0['UserId']==_0x98e79b['id'];});return _0x3dd56d[_0x71cc('0x15')](0xc8)[_0x71cc('0x33')]({'count':_0x2b108e[_0x71cc('0x26')],'rows':_0x2b108e});})[_0x71cc('0x1d')](handleError(_0x3dd56d));};exports[_0x71cc('0x41')]=function(_0x5b1560,_0xcd78b5){logger[_0x71cc('0x2a')]('conference\x20fired:',_0x5b1560['body']);var _0x349d62=conferenceValidation[_0x71cc('0x9')](_0x5b1560['body']);if(_0x349d62['length']>0x0){return _0xcd78b5[_0x71cc('0x15')](0x190)['json'](_0x349d62);}var _0x48735b=_0x5b1560[_0x71cc('0x2c')][_0x71cc('0x36')];return getAgent(_0x48735b)[_0x71cc('0x18')](function(_0x5ed6b9){logger[_0x71cc('0x2a')](_0x71cc('0x2f'),_0x5ed6b9[_0x71cc('0x13')]);emit(util['format']('user:%s',_0x5ed6b9['name']),_0x71cc('0x42'));return _0xcd78b5[_0x71cc('0x15')](0xc8)[_0x71cc('0x33')]({'error':![],'message':_0x71cc('0x43')});})[_0x71cc('0x1d')](handleError(_0xcd78b5));};exports[_0x71cc('0x44')]=function(_0x515d18,_0x48b10c){logger[_0x71cc('0x2a')](_0x71cc('0x45'),_0x515d18[_0x71cc('0x2c')]);var _0x1c60f0=transferValidation[_0x71cc('0x9')](_0x515d18[_0x71cc('0x2c')]);if(_0x1c60f0[_0x71cc('0x26')]>0x0){return _0x48b10c[_0x71cc('0x15')](0x190)[_0x71cc('0x33')](_0x1c60f0);}var _0x17ecd1=_0x515d18['body']['userId'];var _0x36944a=_0x515d18[_0x71cc('0x2c')][_0x71cc('0x25')];var _0x2d05b5=_0x515d18[_0x71cc('0x2c')][_0x71cc('0x46')];return getAgent(_0x17ecd1)[_0x71cc('0x18')](function(_0x2f89b1){logger[_0x71cc('0x2a')]('entityFound:',_0x2f89b1[_0x71cc('0x13')]);emit(util[_0x71cc('0x30')](_0x71cc('0x31'),_0x2f89b1[_0x71cc('0x13')]),'webbar:transfer',{'sessionId':_0x36944a,'transferNumber':_0x2d05b5});return _0x48b10c['status'](0xc8)[_0x71cc('0x33')]({'error':![],'message':_0x71cc('0x47')});})[_0x71cc('0x1d')](handleError(_0x48b10c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 052d9f8..7b4e555 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 _0xf292=['/:id/applications','getApplications','post','create','addAnswer','/:id/users','addAgents','notify','/:id/send','send','put','delete','removeDispositions','removeAgents','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents'];(function(_0x2dff3a,_0x1baaf4){var _0x36f489=function(_0x2133b6){while(--_0x2133b6){_0x2dff3a['push'](_0x2dff3a['shift']());}};_0x36f489(++_0x1baaf4);}(_0xf292,0x162));var _0x2f29=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xf292[_0x2aea9e];return _0x430b92;};'use strict';var multer=require(_0x2f29('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2f29('0x1'));var express=require(_0x2f29('0x2'));var router=express[_0x2f29('0x3')]();var fs_extra=require(_0x2f29('0x4'));var auth=require(_0x2f29('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2f29('0x6'));var controller=require(_0x2f29('0x7'));router[_0x2f29('0x8')]('/',auth[_0x2f29('0x9')](),controller[_0x2f29('0xa')]);router['get'](_0x2f29('0xb'),auth[_0x2f29('0x9')](),controller[_0x2f29('0xc')]);router['get'](_0x2f29('0xd'),auth[_0x2f29('0x9')](),controller[_0x2f29('0xe')]);router[_0x2f29('0x8')](_0x2f29('0xf'),auth['isAuthenticated'](),controller[_0x2f29('0x10')]);router['get'](_0x2f29('0x11'),auth[_0x2f29('0x9')](),controller[_0x2f29('0x12')]);router[_0x2f29('0x8')]('/:id/users',auth[_0x2f29('0x9')](),controller[_0x2f29('0x13')]);router[_0x2f29('0x8')](_0x2f29('0x14'),auth[_0x2f29('0x9')](),controller[_0x2f29('0x15')]);router[_0x2f29('0x16')]('/',auth['isAuthenticated'](),controller[_0x2f29('0x17')]);router['post'](_0x2f29('0xf'),auth[_0x2f29('0x9')](),controller['addDisposition']);router[_0x2f29('0x16')](_0x2f29('0x11'),auth['isAuthenticated'](),controller[_0x2f29('0x18')]);router['post'](_0x2f29('0x19'),auth[_0x2f29('0x9')](),controller[_0x2f29('0x1a')]);router[_0x2f29('0x16')](_0x2f29('0x14'),auth[_0x2f29('0x9')](),controller['addApplications']);router[_0x2f29('0x16')]('/:id/notify',controller[_0x2f29('0x1b')]);router[_0x2f29('0x16')](_0x2f29('0x1c'),auth[_0x2f29('0x9')](),controller[_0x2f29('0x1d')]);router[_0x2f29('0x1e')](_0x2f29('0xd'),auth[_0x2f29('0x9')](),controller['update']);router[_0x2f29('0x1f')](_0x2f29('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x2f29('0x1f')](_0x2f29('0xf'),auth['isAuthenticated'](),controller[_0x2f29('0x20')]);router[_0x2f29('0x1f')](_0x2f29('0x11'),auth[_0x2f29('0x9')](),controller['removeAnswers']);router[_0x2f29('0x1f')](_0x2f29('0x19'),auth[_0x2f29('0x9')](),controller[_0x2f29('0x21')]);module['exports']=router; \ No newline at end of file +var _0xfbc7=['delete','destroy','removeAnswers','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','describe','/:id','isAuthenticated','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','addApplications','notify','send','put','update'];(function(_0x2d7884,_0x2f9c9b){var _0x5ce703=function(_0x1d77df){while(--_0x1d77df){_0x2d7884['push'](_0x2d7884['shift']());}};_0x5ce703(++_0x2f9c9b);}(_0xfbc7,0x6b));var _0x7fbc=function(_0x49509b,_0x2e57b0){_0x49509b=_0x49509b-0x0;var _0x2f9bc0=_0xfbc7[_0x49509b];return _0x2f9bc0;};'use strict';var multer=require('multer');var util=require(_0x7fbc('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fbc('0x1'));var router=express[_0x7fbc('0x2')]();var fs_extra=require(_0x7fbc('0x3'));var auth=require(_0x7fbc('0x4'));var interaction=require(_0x7fbc('0x5'));var config=require(_0x7fbc('0x6'));var controller=require(_0x7fbc('0x7'));router[_0x7fbc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7fbc('0x9'),auth['isAuthenticated'](),controller[_0x7fbc('0xa')]);router[_0x7fbc('0x8')](_0x7fbc('0xb'),auth[_0x7fbc('0xc')](),controller['show']);router[_0x7fbc('0x8')](_0x7fbc('0xd'),auth[_0x7fbc('0xc')](),controller['getDispositions']);router[_0x7fbc('0x8')](_0x7fbc('0xe'),auth[_0x7fbc('0xc')](),controller[_0x7fbc('0xf')]);router['get'](_0x7fbc('0x10'),auth['isAuthenticated'](),controller[_0x7fbc('0x11')]);router['get'](_0x7fbc('0x12'),auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x13')]);router[_0x7fbc('0x14')]('/',auth[_0x7fbc('0xc')](),controller['create']);router['post']('/:id/dispositions',auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x15')]);router[_0x7fbc('0x14')](_0x7fbc('0xe'),auth['isAuthenticated'](),controller[_0x7fbc('0x16')]);router['post'](_0x7fbc('0x10'),auth['isAuthenticated'](),controller[_0x7fbc('0x17')]);router['post'](_0x7fbc('0x12'),auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x18')]);router[_0x7fbc('0x14')]('/:id/notify',controller[_0x7fbc('0x19')]);router[_0x7fbc('0x14')]('/:id/send',auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x1a')]);router[_0x7fbc('0x1b')](_0x7fbc('0xb'),auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x1c')]);router[_0x7fbc('0x1d')](_0x7fbc('0xb'),auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x1e')]);router[_0x7fbc('0x1d')](_0x7fbc('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x7fbc('0x1d')](_0x7fbc('0xe'),auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x1f')]);router[_0x7fbc('0x1d')](_0x7fbc('0x10'),auth[_0x7fbc('0xc')](),controller[_0x7fbc('0x20')]);module[_0x7fbc('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 87a33b7..78e598d 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 _0x395a=['STRING','ENUM','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name'];(function(_0x3ed2c2,_0x4c9dd9){var _0x3227ab=function(_0x2617cc){while(--_0x2617cc){_0x3ed2c2['push'](_0x3ed2c2['shift']());}};_0x3227ab(++_0x4c9dd9);}(_0x395a,0x128));var _0xa395=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x395a[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require(_0xa395('0x0'));var rs=require(_0xa395('0x1'));module[_0xa395('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xa395('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa395('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xa395('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xa395('0x4')]},'type':{'type':Sequelize[_0xa395('0x5')]('twilio',_0xa395('0x6'))},'accountSid':{'type':Sequelize[_0xa395('0x4')]},'baseUrl':{'type':Sequelize[_0xa395('0x4')]},'authToken':{'type':Sequelize[_0xa395('0x4')]},'notificationTemplate':{'type':Sequelize[_0xa395('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa395('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa395('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa395('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa395('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa395('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa395('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa395('0x9')],'comment':_0xa395('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xa395('0x8')],'defaultValue':![],'comment':_0xa395('0xb'),'set':function(_0x2444c1){if(!_0x2444c1){this[_0xa395('0xc')](_0xa395('0xd'),null);}this[_0xa395('0xc')](_0xa395('0xe'),_0x2444c1);}},'description':{'type':Sequelize[_0xa395('0x4')]}}; \ No newline at end of file +var _0x2580=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0xa3d1a6,_0x5040cb){var _0x1682ad=function(_0x2bceca){while(--_0x2bceca){_0xa3d1a6['push'](_0xa3d1a6['shift']());}};_0x1682ad(++_0x5040cb);}(_0x2580,0xa6));var _0x0258=function(_0x3c8280,_0x6c0663){_0x3c8280=_0x3c8280-0x0;var _0x3531b7=_0x2580[_0x3c8280];return _0x3531b7;};'use strict';var Sequelize=require(_0x0258('0x0'));var rs=require('randomstring');module[_0x0258('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0258('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0258('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0258('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0258('0x3')],'defaultValue':function(){return rs[_0x0258('0x4')]();}},'phone':{'type':Sequelize[_0x0258('0x3')]},'type':{'type':Sequelize[_0x0258('0x5')](_0x0258('0x6'),_0x0258('0x7'))},'accountSid':{'type':Sequelize[_0x0258('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x0258('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0258('0x8');}},'notificationSound':{'type':Sequelize[_0x0258('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0258('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0258('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0258('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0258('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0258('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x0258('0x9')],'defaultValue':![],'comment':_0x0258('0xc'),'set':function(_0x31b81c){if(!_0x31b81c){this[_0x0258('0xd')](_0x0258('0xe'),null);}this[_0x0258('0xd')](_0x0258('0xf'),_0x31b81c);}},'description':{'type':Sequelize[_0x0258('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 891d9f2..63e0345 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 _0x02ce=['waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','dataValues','eml-format','rimraf','zip-dir','request-promise','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','jayson/promise','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','fields','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','timestamp','message_id','orderBy','asc','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','notifications','from','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','created','WhatsappMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x02ce,0x1ac));var _0xe02c=function(_0x276ebe,_0x1ea2fb){_0x276ebe=_0x276ebe-0x0;var _0x1a0822=_0x02ce[_0x276ebe];return _0x1a0822;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];config[_0xe02c('0x1c')]=_[_0xe02c('0x1d')](config['redis'],{'host':_0xe02c('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe02c('0x1f'))['register'](socket);var jayson=require(_0xe02c('0x20'));var client=jayson['client'][_0xe02c('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x4e9c6d,_0x256311,_0x366893,_0x59f2f6){return new BPromise(function(_0x10a2a6,_0x226a80){var _0x51676c=_0x59f2f6||client;return _0x51676c[_0xe02c('0x22')](_0x4e9c6d,_0x366893)[_0xe02c('0x23')](function(_0x5a4583){logger['info'](_0xe02c('0x24'),_0x256311,'request\x20sent');logger[_0xe02c('0x25')](_0xe02c('0x26'),_0x256311,_0xe02c('0x27'),JSON[_0xe02c('0x28')](_0x5a4583));if(_0x5a4583[_0xe02c('0x29')]){if(_0x5a4583['error'][_0xe02c('0x2a')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x256311,_0x5a4583[_0xe02c('0x29')][_0xe02c('0x2b')]);return _0x226a80(_0x5a4583['error'][_0xe02c('0x2b')]);}logger[_0xe02c('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x256311,_0x5a4583[_0xe02c('0x29')][_0xe02c('0x2b')]);return _0x10a2a6(_0x5a4583[_0xe02c('0x29')][_0xe02c('0x2b')]);}else{logger[_0xe02c('0x2c')](_0xe02c('0x24'),_0x256311,_0xe02c('0x27'));_0x10a2a6(_0x5a4583[_0xe02c('0x2d')][_0xe02c('0x2b')]);}})[_0xe02c('0x2e')](function(_0x60b65e){logger['error'](_0xe02c('0x24'),_0x256311,_0x60b65e);_0x226a80(_0x60b65e);});});}function respondWithStatusCode(_0x4411d8,_0x3592ca){_0x3592ca=_0x3592ca||0xcc;return function(_0x14ffba){if(_0x14ffba){return _0x4411d8[_0xe02c('0x2f')](_0x3592ca);}return _0x4411d8[_0xe02c('0x30')](_0x3592ca)[_0xe02c('0x31')]();};}function respondWithResult(_0x1c14d6,_0x55ef2a){_0x55ef2a=_0x55ef2a||0xc8;return function(_0x55e475){if(_0x55e475){return _0x1c14d6[_0xe02c('0x30')](_0x55ef2a)[_0xe02c('0x32')](_0x55e475);}};}function respondWithFilteredResult(_0x481e02,_0x18b572){return function(_0x2d1d98){if(_0x2d1d98){var _0x445421=typeof _0x18b572[_0xe02c('0x33')]===_0xe02c('0x34')&&typeof _0x18b572[_0xe02c('0x35')]===_0xe02c('0x34');var _0x1b8f21=_0x2d1d98[_0xe02c('0x36')];var _0x288004=_0x445421?0x0:_0x18b572[_0xe02c('0x33')];var _0x5a2da0=_0x445421?_0x2d1d98[_0xe02c('0x36')]:_0x18b572[_0xe02c('0x33')]+_0x18b572[_0xe02c('0x35')];var _0x8928f0;if(_0x5a2da0>=_0x1b8f21){_0x5a2da0=_0x1b8f21;_0x8928f0=0xc8;}else{_0x8928f0=0xce;}_0x481e02[_0xe02c('0x30')](_0x8928f0);return _0x481e02[_0xe02c('0x37')]('Content-Range',_0x288004+'-'+_0x5a2da0+'/'+_0x1b8f21)[_0xe02c('0x32')](_0x2d1d98);}return null;};}function patchUpdates(_0x1e605c){return function(_0x4fc4fd){try{jsonpatch[_0xe02c('0x38')](_0x4fc4fd,_0x1e605c,!![]);}catch(_0x242a2e){return BPromise[_0xe02c('0x39')](_0x242a2e);}return _0x4fc4fd[_0xe02c('0x3a')]();};}function saveUpdates(_0x2b5ebe,_0x538001){return function(_0x4a0350){if(_0x4a0350){return _0x4a0350[_0xe02c('0x3b')](_0x2b5ebe)[_0xe02c('0x23')](function(_0x57928e){return _0x57928e;});}return null;};}function removeEntity(_0x1afae6,_0x58c724){return function(_0x42d617){if(_0x42d617){return _0x42d617[_0xe02c('0x3c')]()[_0xe02c('0x23')](function(){var _0x45c6cd=_0x42d617[_0xe02c('0x3d')]({'plain':!![]});var _0x587e4c=_0xe02c('0x3e');return db['UserProfileResource'][_0xe02c('0x3c')]({'where':{'type':_0x587e4c,'resourceId':_0x45c6cd['id']}})[_0xe02c('0x23')](function(){return _0x42d617;});})[_0xe02c('0x23')](function(){_0x1afae6[_0xe02c('0x30')](0xcc)[_0xe02c('0x31')]();});}};}function handleEntityNotFound(_0x232d36,_0x559bc1){return function(_0x1c795a){if(!_0x1c795a){_0x232d36[_0xe02c('0x2f')](0x194);}return _0x1c795a;};}function handleError(_0x534c09,_0xcb664c){_0xcb664c=_0xcb664c||0x1f4;return function(_0xa6028){logger['error'](_0xa6028[_0xe02c('0x3f')]);if(_0xa6028['name']){delete _0xa6028[_0xe02c('0x40')];}_0x534c09[_0xe02c('0x30')](_0xcb664c)['send'](_0xa6028);};}exports[_0xe02c('0x41')]=function(_0x1eeddb,_0x2502c8){var _0x441961={'include':[{'model':db['Pause'],'as':_0xe02c('0x42')}]},_0x3c4a65={},_0x28922a={'count':0x0,'rows':[]};var _0x4a5433=_['map'](db[_0xe02c('0x43')][_0xe02c('0x44')],function(_0x42fbac){return{'name':_0x42fbac[_0xe02c('0x45')],'type':_0x42fbac['type'][_0xe02c('0x46')]};});_0x3c4a65[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x4a5433,'name');_0x3c4a65['query']=_[_0xe02c('0x49')](_0x1eeddb[_0xe02c('0x4a')]);_0x3c4a65[_0xe02c('0x4b')]=_[_0xe02c('0x4c')](_0x3c4a65[_0xe02c('0x47')],_0x3c4a65[_0xe02c('0x4a')]);_0x441961[_0xe02c('0x4d')]=_[_0xe02c('0x4c')](_0x3c4a65[_0xe02c('0x47')],qs['fields'](_0x1eeddb[_0xe02c('0x4a')]['fields']));_0x441961['attributes']=_0x441961[_0xe02c('0x4d')][_0xe02c('0x4e')]?_0x441961[_0xe02c('0x4d')]:_0x3c4a65[_0xe02c('0x47')];if(!_0x1eeddb[_0xe02c('0x4a')][_0xe02c('0x4f')](_0xe02c('0x50'))){_0x441961[_0xe02c('0x35')]=qs['limit'](_0x1eeddb['query'][_0xe02c('0x35')]);_0x441961[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x1eeddb['query'][_0xe02c('0x33')]);}_0x441961[_0xe02c('0x51')]=qs[_0xe02c('0x52')](_0x1eeddb[_0xe02c('0x4a')][_0xe02c('0x52')]);_0x441961[_0xe02c('0x53')]=qs[_0xe02c('0x4b')](_[_0xe02c('0x54')](_0x1eeddb[_0xe02c('0x4a')],_0x3c4a65[_0xe02c('0x4b')]),_0x4a5433);if(_0x1eeddb['query'][_0xe02c('0x55')]){_0x441961[_0xe02c('0x53')]=_[_0xe02c('0x56')](_0x441961[_0xe02c('0x53')],{'$or':_[_0xe02c('0x48')](_0x4a5433,function(_0x3f6aec){if(_0x3f6aec[_0xe02c('0x57')]!==_0xe02c('0x58')){var _0x30dc90={};_0x30dc90[_0x3f6aec[_0xe02c('0x40')]]={'$like':'%'+_0x1eeddb[_0xe02c('0x4a')][_0xe02c('0x55')]+'%'};return _0x30dc90;}})});}_0x441961=_[_0xe02c('0x56')]({},_0x441961,_0x1eeddb['options']);var _0x25e790={'where':_0x441961['where']};return db[_0xe02c('0x43')][_0xe02c('0x36')](_0x25e790)[_0xe02c('0x23')](function(_0x266390){_0x28922a[_0xe02c('0x36')]=_0x266390;if(_0x1eeddb[_0xe02c('0x4a')][_0xe02c('0x59')]){_0x441961[_0xe02c('0x5a')]=[{'all':!![]}];}return db[_0xe02c('0x43')][_0xe02c('0x5b')](_0x441961);})['then'](function(_0x1a666a){_0x28922a[_0xe02c('0x5c')]=_0x1a666a;return _0x28922a;})[_0xe02c('0x23')](respondWithFilteredResult(_0x2502c8,_0x441961))['catch'](handleError(_0x2502c8,null));};exports[_0xe02c('0x5d')]=function(_0x5ab97d,_0x21a126){var _0x56b9e2={'raw':![],'where':{'id':_0x5ab97d['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5b41e4={};_0x5b41e4['model']=_[_0xe02c('0x49')](db[_0xe02c('0x43')][_0xe02c('0x44')]);_0x5b41e4[_0xe02c('0x4a')]=_['keys'](_0x5ab97d[_0xe02c('0x4a')]);_0x5b41e4[_0xe02c('0x4b')]=_['intersection'](_0x5b41e4[_0xe02c('0x47')],_0x5b41e4[_0xe02c('0x4a')]);_0x56b9e2[_0xe02c('0x4d')]=_['intersection'](_0x5b41e4['model'],qs[_0xe02c('0x5e')](_0x5ab97d[_0xe02c('0x4a')][_0xe02c('0x5e')]));_0x56b9e2['attributes']=_0x56b9e2[_0xe02c('0x4d')]['length']?_0x56b9e2['attributes']:_0x5b41e4[_0xe02c('0x47')];if(_0x5ab97d[_0xe02c('0x4a')]['includeAll']){_0x56b9e2[_0xe02c('0x5a')]=[{'all':!![]}];}_0x56b9e2=_[_0xe02c('0x56')]({},_0x56b9e2,_0x5ab97d[_0xe02c('0x5f')]);return db['WhatsappAccount'][_0xe02c('0x60')](_0x56b9e2)[_0xe02c('0x23')](handleEntityNotFound(_0x21a126,null))['then'](respondWithResult(_0x21a126,null))[_0xe02c('0x2e')](handleError(_0x21a126,null));};exports[_0xe02c('0x61')]=function(_0x17de1c,_0x1c7206){return db[_0xe02c('0x43')][_0xe02c('0x61')](_0x17de1c[_0xe02c('0x62')],{})[_0xe02c('0x23')](function(_0xf7e836){var _0x49b1b4=_0x17de1c['user']['get']({'plain':!![]});if(!_0x49b1b4)throw new Error(_0xe02c('0x63'));if(_0x49b1b4[_0xe02c('0x64')]===_0xe02c('0x65')){var _0x496eb1=_0xf7e836['get']({'plain':!![]});var _0x3b5e1d=_0xe02c('0x3e');return db[_0xe02c('0x66')][_0xe02c('0x60')]({'where':{'name':_0x3b5e1d,'userProfileId':_0x49b1b4[_0xe02c('0x67')]},'raw':!![]})['then'](function(_0x3b4e74){if(_0x3b4e74&&_0x3b4e74[_0xe02c('0x68')]===0x0){return db['UserProfileResource']['create']({'name':_0x496eb1[_0xe02c('0x40')],'resourceId':_0x496eb1['id'],'type':_0x3b4e74['name'],'sectionId':_0x3b4e74['id']},{})['then'](function(){return _0xf7e836;});}else{return _0xf7e836;}})['catch'](function(_0x3b19c9){logger[_0xe02c('0x29')](_0xe02c('0x69'),_0x3b19c9);throw _0x3b19c9;});}return _0xf7e836;})[_0xe02c('0x23')](respondWithResult(_0x1c7206,0xc9))[_0xe02c('0x2e')](handleError(_0x1c7206,null));};exports[_0xe02c('0x3b')]=function(_0x5c021a,_0x562e6a){if(_0x5c021a['body']['id']){delete _0x5c021a['body']['id'];}return db[_0xe02c('0x43')][_0xe02c('0x60')]({'where':{'id':_0x5c021a[_0xe02c('0x6a')]['id']},'include':[{'model':db[_0xe02c('0x6b')],'as':'mandatoryDispositionPause'}]})[_0xe02c('0x23')](handleEntityNotFound(_0x562e6a,null))[_0xe02c('0x23')](saveUpdates(_0x5c021a['body'],null))[_0xe02c('0x23')](respondWithResult(_0x562e6a,null))[_0xe02c('0x2e')](handleError(_0x562e6a,null));};exports['destroy']=function(_0xc3c539,_0x391dfb){return db[_0xe02c('0x43')][_0xe02c('0x60')]({'where':{'id':_0xc3c539[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x391dfb,null))[_0xe02c('0x23')](removeEntity(_0x391dfb,null))['catch'](handleError(_0x391dfb,null));};exports[_0xe02c('0x6c')]=function(_0x4fb3ed,_0x558344){return db['WhatsappAccount'][_0xe02c('0x6c')]()[_0xe02c('0x23')](respondWithResult(_0x558344,null))[_0xe02c('0x2e')](handleError(_0x558344,null));};exports[_0xe02c('0x6d')]=function(_0x5a99a3,_0x32e149,_0x327777){if(_0x5a99a3['body']['id']){delete _0x5a99a3['body']['id'];}return db['WhatsappAccount'][_0xe02c('0x60')]({'where':{'id':_0x5a99a3[_0xe02c('0x6a')]['id']}})['then'](handleEntityNotFound(_0x32e149,null))['then'](function(_0x38789c){if(_0x38789c){_0x5a99a3[_0xe02c('0x62')][_0xe02c('0x6e')]=_0x38789c['id'];return db[_0xe02c('0x6f')][_0xe02c('0x61')](_0x5a99a3['body']);}})[_0xe02c('0x23')](respondWithResult(_0x32e149,null))[_0xe02c('0x2e')](handleError(_0x32e149,null));};exports[_0xe02c('0x70')]=function(_0x2776c0,_0x11c506,_0x119119){var _0x526276={'raw':![],'where':{}};var _0x1d9d2b={};var _0x42219f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xe02c('0x71')]({'where':{'id':_0x2776c0[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x11c506,null))[_0xe02c('0x23')](function(_0x5d2455){if(_0x5d2455){_0x1d9d2b[_0xe02c('0x47')]=_[_0xe02c('0x49')](db['Disposition']['rawAttributes']);_0x1d9d2b['query']=_[_0xe02c('0x49')](_0x2776c0[_0xe02c('0x4a')]);_0x1d9d2b[_0xe02c('0x4b')]=_[_0xe02c('0x4c')](_0x1d9d2b[_0xe02c('0x47')],_0x1d9d2b['query']);_0x526276[_0xe02c('0x4d')]=_[_0xe02c('0x4c')](_0x1d9d2b[_0xe02c('0x47')],qs['fields'](_0x2776c0['query']['fields']));_0x526276[_0xe02c('0x4d')]=_0x526276[_0xe02c('0x4d')][_0xe02c('0x4e')]?_0x526276[_0xe02c('0x4d')]:_0x1d9d2b['model'];if(!_0x2776c0[_0xe02c('0x4a')]['hasOwnProperty']('nolimit')){_0x526276[_0xe02c('0x35')]=qs[_0xe02c('0x35')](_0x2776c0[_0xe02c('0x4a')][_0xe02c('0x35')]);_0x526276[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x2776c0[_0xe02c('0x4a')][_0xe02c('0x33')]);}_0x526276['order']=qs[_0xe02c('0x52')](_0x2776c0[_0xe02c('0x4a')][_0xe02c('0x52')]);_0x526276[_0xe02c('0x53')]=qs[_0xe02c('0x4b')](_[_0xe02c('0x54')](_0x2776c0[_0xe02c('0x4a')],_0x1d9d2b[_0xe02c('0x4b')]));_0x526276[_0xe02c('0x53')][_0xe02c('0x6e')]=_0x5d2455['id'];if(_0x2776c0['query']['filter']){_0x526276[_0xe02c('0x53')]=_[_0xe02c('0x56')](_0x526276[_0xe02c('0x53')],{'$or':_[_0xe02c('0x48')](_0x526276[_0xe02c('0x4d')],function(_0x4e4fb9){var _0x405b16={};_0x405b16[_0x4e4fb9]={'$like':'%'+_0x2776c0[_0xe02c('0x4a')][_0xe02c('0x55')]+'%'};return _0x405b16;})});}_0x526276=_[_0xe02c('0x56')]({},_0x526276,_0x2776c0[_0xe02c('0x5f')]);return db[_0xe02c('0x6f')][_0xe02c('0x36')]({'where':_0x526276[_0xe02c('0x53')]})[_0xe02c('0x23')](function(_0x159f58){_0x42219f[_0xe02c('0x36')]=_0x159f58;if(_0x2776c0[_0xe02c('0x4a')]['includeAll']){_0x526276['include']=[{'all':!![]}];}return db[_0xe02c('0x6f')][_0xe02c('0x5b')](_0x526276);})['then'](function(_0x1d90a1){_0x42219f['rows']=_0x1d90a1;return _0x42219f;});}})[_0xe02c('0x23')](respondWithFilteredResult(_0x11c506,_0x526276))['catch'](handleError(_0x11c506,null));};exports[_0xe02c('0x72')]=function(_0x16c217,_0x43c503,_0x18c946){return db[_0xe02c('0x43')][_0xe02c('0x60')]({'where':{'id':_0x16c217[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x43c503,null))[_0xe02c('0x23')](function(_0xd0d895){if(_0xd0d895){return _0xd0d895['removeDispositions'](_0x16c217['query']['ids']);}})[_0xe02c('0x23')](respondWithStatusCode(_0x43c503,null))[_0xe02c('0x2e')](handleError(_0x43c503,null));};exports[_0xe02c('0x73')]=function(_0x1133ce,_0x3adbcd,_0x365c24){if(_0x1133ce[_0xe02c('0x62')]['id']){delete _0x1133ce[_0xe02c('0x62')]['id'];}return db[_0xe02c('0x43')][_0xe02c('0x60')]({'where':{'id':_0x1133ce[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x3adbcd,null))[_0xe02c('0x23')](function(_0x4b363b){if(_0x4b363b){_0x1133ce['body'][_0xe02c('0x6e')]=_0x4b363b['id'];return db[_0xe02c('0x74')][_0xe02c('0x61')](_0x1133ce['body']);}})[_0xe02c('0x23')](respondWithResult(_0x3adbcd,null))[_0xe02c('0x2e')](handleError(_0x3adbcd,null));};exports[_0xe02c('0x75')]=function(_0x32f8aa,_0xf2ea75,_0x5c0506){var _0x3a749d={'raw':![],'where':{}};var _0x3b2bac={};var _0x80a459={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xe02c('0x71')]({'where':{'id':_0x32f8aa[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0xf2ea75,null))[_0xe02c('0x23')](function(_0xdba9d5){if(_0xdba9d5){_0x3b2bac['model']=_[_0xe02c('0x49')](db[_0xe02c('0x74')][_0xe02c('0x44')]);_0x3b2bac['query']=_[_0xe02c('0x49')](_0x32f8aa[_0xe02c('0x4a')]);_0x3b2bac[_0xe02c('0x4b')]=_[_0xe02c('0x4c')](_0x3b2bac[_0xe02c('0x47')],_0x3b2bac['query']);_0x3a749d[_0xe02c('0x4d')]=_[_0xe02c('0x4c')](_0x3b2bac['model'],qs[_0xe02c('0x5e')](_0x32f8aa['query']['fields']));_0x3a749d['attributes']=_0x3a749d[_0xe02c('0x4d')][_0xe02c('0x4e')]?_0x3a749d[_0xe02c('0x4d')]:_0x3b2bac[_0xe02c('0x47')];if(!_0x32f8aa[_0xe02c('0x4a')][_0xe02c('0x4f')](_0xe02c('0x50'))){_0x3a749d[_0xe02c('0x35')]=qs[_0xe02c('0x35')](_0x32f8aa[_0xe02c('0x4a')][_0xe02c('0x35')]);_0x3a749d[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x32f8aa[_0xe02c('0x4a')][_0xe02c('0x33')]);}_0x3a749d[_0xe02c('0x51')]=qs['sort'](_0x32f8aa[_0xe02c('0x4a')]['sort']);_0x3a749d[_0xe02c('0x53')]=qs[_0xe02c('0x4b')](_[_0xe02c('0x54')](_0x32f8aa[_0xe02c('0x4a')],_0x3b2bac[_0xe02c('0x4b')]));_0x3a749d[_0xe02c('0x53')][_0xe02c('0x6e')]=_0xdba9d5['id'];if(_0x32f8aa[_0xe02c('0x4a')][_0xe02c('0x55')]){_0x3a749d[_0xe02c('0x53')]=_[_0xe02c('0x56')](_0x3a749d[_0xe02c('0x53')],{'$or':_['map'](_0x3a749d[_0xe02c('0x4d')],function(_0x371676){var _0x51686d={};_0x51686d[_0x371676]={'$like':'%'+_0x32f8aa[_0xe02c('0x4a')]['filter']+'%'};return _0x51686d;})});}_0x3a749d=_['merge']({},_0x3a749d,_0x32f8aa[_0xe02c('0x5f')]);return db[_0xe02c('0x74')][_0xe02c('0x36')]({'where':_0x3a749d[_0xe02c('0x53')]})['then'](function(_0x4acd4c){_0x80a459[_0xe02c('0x36')]=_0x4acd4c;if(_0x32f8aa[_0xe02c('0x4a')]['includeAll']){_0x3a749d[_0xe02c('0x5a')]=[{'all':!![]}];}return db[_0xe02c('0x74')][_0xe02c('0x5b')](_0x3a749d);})[_0xe02c('0x23')](function(_0x1d3d3d){_0x80a459[_0xe02c('0x5c')]=_0x1d3d3d;return _0x80a459;});}})['then'](respondWithFilteredResult(_0xf2ea75,_0x3a749d))[_0xe02c('0x2e')](handleError(_0xf2ea75,null));};exports[_0xe02c('0x76')]=function(_0x1784d1,_0x24928e,_0x1a13dd){return db[_0xe02c('0x43')][_0xe02c('0x60')]({'where':{'id':_0x1784d1[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x24928e,null))[_0xe02c('0x23')](function(_0x92e52e){if(_0x92e52e){return _0x92e52e[_0xe02c('0x76')](_0x1784d1[_0xe02c('0x4a')][_0xe02c('0x77')]);}})['then'](respondWithStatusCode(_0x24928e,null))[_0xe02c('0x2e')](handleError(_0x24928e,null));};exports[_0xe02c('0x78')]=function(_0xbdeca0,_0x4a0334,_0x3bd125){return db[_0xe02c('0x43')][_0xe02c('0x60')]({'where':{'id':_0xbdeca0[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x4a0334,null))[_0xe02c('0x23')](function(_0x2f3ecd){if(_0x2f3ecd){return _0x2f3ecd['addAgents'](_0xbdeca0[_0xe02c('0x62')][_0xe02c('0x77')],_[_0xe02c('0x79')](_0xbdeca0[_0xe02c('0x62')],[_0xe02c('0x77'),'id'])||{})[_0xe02c('0x7a')](function(_0x1c2222){for(var _0x14a0db=0x0;_0x14a0db<_0xbdeca0[_0xe02c('0x62')]['ids'][_0xe02c('0x4e')];_0x14a0db+=0x1){socket[_0xe02c('0x7b')]('userWhatsappAccount:save',{'UserId':Number(_0xbdeca0[_0xe02c('0x62')][_0xe02c('0x77')][_0x14a0db]),'WhatsappAccountId':Number(_0xbdeca0[_0xe02c('0x6a')]['id'])});}return _0x1c2222;});}})[_0xe02c('0x23')](respondWithResult(_0x4a0334,null))[_0xe02c('0x2e')](handleError(_0x4a0334,null));};exports[_0xe02c('0x7c')]=function(_0x536642,_0xc21958,_0x1eb3f0){return db[_0xe02c('0x43')]['find']({'where':{'id':_0x536642['params']['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0xc21958,null))[_0xe02c('0x23')](function(_0xad5c90){if(_0xad5c90){return _0xad5c90['removeAgents'](_0x536642[_0xe02c('0x4a')][_0xe02c('0x77')])[_0xe02c('0x23')](function(){if(_[_0xe02c('0x7d')](_0x536642[_0xe02c('0x4a')]['ids'])){for(var _0x927258=0x0;_0x927258<_0x536642[_0xe02c('0x4a')][_0xe02c('0x77')][_0xe02c('0x4e')];_0x927258+=0x1){socket[_0xe02c('0x7b')](_0xe02c('0x7e'),{'UserId':Number(_0x536642[_0xe02c('0x4a')][_0xe02c('0x77')][_0x927258]),'WhatsappAccountId':Number(_0x536642[_0xe02c('0x6a')]['id'])});}}else{socket[_0xe02c('0x7b')](_0xe02c('0x7e'),{'UserId':Number(_0x536642[_0xe02c('0x4a')][_0xe02c('0x77')]),'WhatsappAccountId':Number(_0x536642[_0xe02c('0x6a')]['id'])});}});}})[_0xe02c('0x23')](respondWithStatusCode(_0xc21958,null))[_0xe02c('0x2e')](handleError(_0xc21958,null));};exports[_0xe02c('0x7f')]=function(_0x49e06b,_0x481da3,_0x4400b2){var _0x5e2af8={};var _0x4a8691={};var _0x5472a0;var _0x406de8;return db[_0xe02c('0x43')][_0xe02c('0x71')]({'where':{'id':_0x49e06b['params']['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x481da3,null))['then'](function(_0x501ebb){if(_0x501ebb){_0x5472a0=_0x501ebb;_0x4a8691[_0xe02c('0x47')]=_[_0xe02c('0x49')](db['User'][_0xe02c('0x44')]);_0x4a8691['query']=_['keys'](_0x49e06b[_0xe02c('0x4a')]);_0x4a8691[_0xe02c('0x4b')]=_[_0xe02c('0x4c')](_0x4a8691[_0xe02c('0x47')],_0x4a8691['query']);_0x5e2af8[_0xe02c('0x4d')]=_[_0xe02c('0x4c')](_0x4a8691[_0xe02c('0x47')],qs[_0xe02c('0x5e')](_0x49e06b[_0xe02c('0x4a')][_0xe02c('0x5e')]));_0x5e2af8[_0xe02c('0x4d')]=_0x5e2af8[_0xe02c('0x4d')][_0xe02c('0x4e')]?_0x5e2af8[_0xe02c('0x4d')]:_0x4a8691[_0xe02c('0x47')];_0x5e2af8[_0xe02c('0x51')]=qs[_0xe02c('0x52')](_0x49e06b[_0xe02c('0x4a')][_0xe02c('0x52')]);_0x5e2af8[_0xe02c('0x53')]=qs[_0xe02c('0x4b')](_['pick'](_0x49e06b[_0xe02c('0x4a')],_0x4a8691[_0xe02c('0x4b')]));if(_0x49e06b['query'][_0xe02c('0x55')]){_0x5e2af8[_0xe02c('0x53')]=_[_0xe02c('0x56')](_0x5e2af8['where'],{'$or':_[_0xe02c('0x48')](_0x5e2af8[_0xe02c('0x4d')],function(_0x27ff77){var _0x480f41={};_0x480f41[_0x27ff77]={'$like':'%'+_0x49e06b[_0xe02c('0x4a')][_0xe02c('0x55')]+'%'};return _0x480f41;})});}_0x5e2af8=_[_0xe02c('0x56')]({},_0x5e2af8,_0x49e06b[_0xe02c('0x5f')]);return _0x5472a0[_0xe02c('0x7f')](_0x5e2af8);}})['then'](function(_0x46eec2){if(_0x46eec2){_0x406de8=_0x46eec2['length'];if(!_0x49e06b[_0xe02c('0x4a')]['hasOwnProperty'](_0xe02c('0x50'))){_0x5e2af8['limit']=qs[_0xe02c('0x35')](_0x49e06b[_0xe02c('0x4a')][_0xe02c('0x35')]);_0x5e2af8[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x49e06b['query']['offset']);}return _0x5472a0[_0xe02c('0x7f')](_0x5e2af8);}})[_0xe02c('0x23')](function(_0x2e14b2){if(_0x2e14b2){return _0x2e14b2?{'count':_0x406de8,'rows':_0x2e14b2}:null;}})[_0xe02c('0x23')](respondWithResult(_0x481da3,null))[_0xe02c('0x2e')](handleError(_0x481da3,null));};exports['addApplications']=function(_0x12b8a5,_0x359a80){var _0x34b426=_0x12b8a5['params']['id'];var _0x1f31d3=_0x12b8a5[_0xe02c('0x62')];var _0x303c6c=0xc8;var _0x74bcb1=null;return db[_0xe02c('0x80')][_0xe02c('0x81')]({'isolationLevel':db['sequelize']['Transaction'][_0xe02c('0x82')][_0xe02c('0x83')]},function(_0x4b9fb7){return db['WhatsappAccount']['findOne']({'where':{'id':_0x34b426},'transaction':_0x4b9fb7})['then'](function(_0x329e4d){if(_0x329e4d){return db[_0xe02c('0x84')][_0xe02c('0x3c')]({'where':{'WhatsappAccountId':_0x34b426},'transaction':_0x4b9fb7})[_0xe02c('0x23')](function(){var _0x169537=_[_0xe02c('0x48')](_0x1f31d3,function(_0x2e0339){_0x2e0339[_0xe02c('0x6e')]=_0x34b426;return _0x2e0339;});return db[_0xe02c('0x84')]['bulkCreate'](_0x169537,{'transaction':_0x4b9fb7});});}else{_0x303c6c=0x194;_0x74bcb1=[];}});})['then'](function(){if(_0x303c6c!==0x194){return db[_0xe02c('0x84')][_0xe02c('0x85')]({'where':{'WhatsappAccountId':_0x34b426},'order':_0xe02c('0x86')})[_0xe02c('0x23')](function(_0x406c62){_0x74bcb1=_0x406c62;});}})[_0xe02c('0x2e')](function(_0x2ac19e){_0x303c6c=0x1f4;logger['error'](_0x2ac19e[_0xe02c('0x3f')]);if(_0x2ac19e['name']){delete _0x2ac19e['name'];}_0x74bcb1=_0x2ac19e;})[_0xe02c('0x87')](function(){if(_0x74bcb1===null){_0x359a80['sendStatus'](_0x303c6c);}else{if(_0x303c6c===0x1f4){_0x359a80[_0xe02c('0x30')](_0x303c6c)[_0xe02c('0x88')](_0x74bcb1);}else{_0x359a80[_0xe02c('0x30')](_0x303c6c)['json'](_0x74bcb1);}}});};exports['getApplications']=function(_0x261ff7,_0x20a743,_0x3786b7){var _0x22c105={};var _0x523c3f={};var _0x486d6f;var _0x416e79;return db[_0xe02c('0x43')][_0xe02c('0x71')]({'where':{'id':_0x261ff7[_0xe02c('0x6a')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x20a743,null))['then'](function(_0x2b8503){if(_0x2b8503){_0x486d6f=_0x2b8503;_0x523c3f[_0xe02c('0x47')]=_[_0xe02c('0x49')](db[_0xe02c('0x84')]['rawAttributes']);_0x523c3f[_0xe02c('0x4a')]=_[_0xe02c('0x49')](_0x261ff7[_0xe02c('0x4a')]);_0x523c3f['filters']=_['intersection'](_0x523c3f[_0xe02c('0x47')],_0x523c3f[_0xe02c('0x4a')]);_0x22c105[_0xe02c('0x4d')]=_[_0xe02c('0x4c')](_0x523c3f[_0xe02c('0x47')],qs['fields'](_0x261ff7[_0xe02c('0x4a')][_0xe02c('0x5e')]));_0x22c105[_0xe02c('0x4d')]=_0x22c105[_0xe02c('0x4d')][_0xe02c('0x4e')]?_0x22c105['attributes']:_0x523c3f['model'];_0x22c105[_0xe02c('0x51')]=qs[_0xe02c('0x52')](_0x261ff7[_0xe02c('0x4a')][_0xe02c('0x52')]);_0x22c105[_0xe02c('0x53')]=qs[_0xe02c('0x4b')](_[_0xe02c('0x54')](_0x261ff7[_0xe02c('0x4a')],_0x523c3f[_0xe02c('0x4b')]));if(_0x261ff7[_0xe02c('0x4a')][_0xe02c('0x55')]){_0x22c105['where']=_['merge'](_0x22c105['where'],{'$or':_[_0xe02c('0x48')](_0x22c105['attributes'],function(_0x3d2be5){var _0x14f58b={};_0x14f58b[_0x3d2be5]={'$like':'%'+_0x261ff7[_0xe02c('0x4a')]['filter']+'%'};return _0x14f58b;})});}_0x22c105=_['merge']({},_0x22c105,_0x261ff7[_0xe02c('0x5f')]);return _0x486d6f['getApplications'](_0x22c105);}})[_0xe02c('0x23')](function(_0x1213a4){if(_0x1213a4){_0x416e79=_0x1213a4[_0xe02c('0x4e')];if(!_0x261ff7[_0xe02c('0x4a')][_0xe02c('0x4f')](_0xe02c('0x50'))){_0x22c105[_0xe02c('0x35')]=qs[_0xe02c('0x35')](_0x261ff7[_0xe02c('0x4a')][_0xe02c('0x35')]);_0x22c105[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x261ff7[_0xe02c('0x4a')][_0xe02c('0x33')]);}return _0x486d6f[_0xe02c('0x89')](_0x22c105);}})[_0xe02c('0x23')](function(_0x2e5d99){if(_0x2e5d99){return _0x2e5d99?{'count':_0x416e79,'rows':_0x2e5d99}:null;}})[_0xe02c('0x23')](respondWithResult(_0x20a743,null))[_0xe02c('0x2e')](handleError(_0x20a743,null));};exports[_0xe02c('0x8a')]=function(_0x52a1e7,_0x1c00fa,_0x249fdc){var _0x1e6e2c={'channel':_0xe02c('0x8b')};var _0x44cd42=[];var _0x35580f=[];var _0x5b372c={};return db['WhatsappAccount'][_0xe02c('0x60')]({'where':{'id':_0x52a1e7[_0xe02c('0x6a')]['id']},'include':[{'model':db[_0xe02c('0x84')],'as':_0xe02c('0x8c')}]})['then'](handleEntityNotFound(_0x1c00fa,null))[_0xe02c('0x23')](function(_0x313491){_0x1e6e2c['account']=_0x313491;if(_0x1e6e2c['account']&&_0x1e6e2c[_0xe02c('0x8d')][_0xe02c('0x57')]===_0xe02c('0x8e')&&_0x52a1e7[_0xe02c('0x62')][_0xe02c('0x8f')]){if(_0x52a1e7[_0xe02c('0x62')][_0xe02c('0x8f')][_0xe02c('0x4e')]===0x0)return;if(_0x52a1e7['body'][_0xe02c('0x8f')][0x0][_0xe02c('0x90')]!=='read')return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x52a1e7[_0xe02c('0x62')][_0xe02c('0x8f')][0x0][_0xe02c('0x91')]},{'where':{'messageId':_0x52a1e7[_0xe02c('0x62')][_0xe02c('0x8f')][0x0][_0xe02c('0x92')]},'individualHooks':!![]})[_0xe02c('0x23')](function(_0x439006){return _0x1c00fa[_0xe02c('0x30')](0xc8)[_0xe02c('0x32')](_0x439006);});}_0x1e6e2c['applications']=_[_0xe02c('0x93')](_0x313491[_0xe02c('0x8c')],[_0xe02c('0x86')],[_0xe02c('0x94')]);if(_0x1e6e2c[_0xe02c('0x8d')][_0xe02c('0x8c')]){delete _0x1e6e2c[_0xe02c('0x8d')]['Applications'];}return db['CmContact']['describe']()['then'](function(_0x26f0b1){if(!_0x26f0b1){throw new db[(_0xe02c('0x95'))]['ValidationError'](_0xe02c('0x96'));}_0x44cd42=_[_0xe02c('0x97')](_[_0xe02c('0x49')](_0x26f0b1),['createdAt',_0xe02c('0x98')]);_0x35580f=_[_0xe02c('0x97')](_[_0xe02c('0x49')](_0x26f0b1),[_0xe02c('0x99'),_0xe02c('0x98'),'CompanyId',_0xe02c('0x9a')]);_0x1e6e2c[_0xe02c('0x62')]={'mapKey':_0xe02c('0x9b')};if(_0x1e6e2c['account']&&_0x1e6e2c[_0xe02c('0x8d')]['type']===_0xe02c('0x9c')){_0x1e6e2c[_0xe02c('0x62')]['from']=_0x52a1e7[_0xe02c('0x62')][_0xe02c('0x9d')][_0xe02c('0x9e')](_0xe02c('0x9f'),'');_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0x62')]=_0x52a1e7[_0xe02c('0x62')][_0xe02c('0xa0')];_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa1')]=_0x52a1e7[_0xe02c('0x62')]['MessageSid'];}if(_0x1e6e2c[_0xe02c('0x8d')]&&_0x1e6e2c[_0xe02c('0x8d')]['type']==='sinch'){_0x1e6e2c[_0xe02c('0x62')]['from']=_0x52a1e7['body'][_0xe02c('0xa2')][0x0][_0xe02c('0xa3')];_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0x62')]=_0x52a1e7[_0xe02c('0x62')][_0xe02c('0xa2')][0x0][_0xe02c('0x2b')]['body'];_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa1')]=_0x52a1e7['body']['notifications'][0x0][_0xe02c('0x92')];}if(_0x1e6e2c[_0xe02c('0x62')]['id']){delete _0x1e6e2c[_0xe02c('0x62')]['id'];}if(_[_0xe02c('0xa4')](_0x1e6e2c['body']['from'])){throw new db[(_0xe02c('0x95'))][(_0xe02c('0xa5'))](_0xe02c('0xa6'));}if(_['isNil'](_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0x62')])||_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0x62')]===''){throw new db[(_0xe02c('0x95'))][(_0xe02c('0xa5'))](_0xe02c('0xa7'));}if(_['isNil'](_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa8')])){throw new db[(_0xe02c('0x95'))][(_0xe02c('0xa5'))](_0xe02c('0xa9')+_0x35580f);}if(!_[_0xe02c('0xaa')](_0x35580f,_0x1e6e2c[_0xe02c('0x62')]['mapKey'])){throw new db[(_0xe02c('0x95'))]['ValidationError'](_0xe02c('0xab')+_0x35580f);}_0x5b372c[_0x1e6e2c['body'][_0xe02c('0xa8')]]=_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa3')];return db[_0xe02c('0xac')]['find']({'where':{'id':_0x1e6e2c[_0xe02c('0x8d')][_0xe02c('0x9a')]},'include':[{'model':db[_0xe02c('0xad')],'as':_0xe02c('0xae'),'where':_0x5b372c,'limit':0x1,'order':[[_0xe02c('0x98'),_0xe02c('0xaf')]]}]});})[_0xe02c('0x23')](handleEntityNotFound(_0x1c00fa,null))[_0xe02c('0x23')](function(_0x186f7d){if(_0x186f7d){_0x1e6e2c[_0xe02c('0xb0')]=_[_0xe02c('0x79')](_0x186f7d,[_0xe02c('0xae')]);if(_0x186f7d[_0xe02c('0xae')][_0xe02c('0x4e')]){return _0x186f7d[_0xe02c('0xae')][0x0];}var _0x1c9887=_[_0xe02c('0x1d')](_0x1e6e2c[_0xe02c('0x62')],{'firstName':_0x1e6e2c['body']['from'],'ListId':_0x186f7d['id']});_0x1c9887[_0x1e6e2c[_0xe02c('0x62')]['mapKey']]=_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa3')];return db[_0xe02c('0xad')][_0xe02c('0x61')](_0x1c9887,{'fields':_0x44cd42,'raw':!![]});}})['then'](handleEntityNotFound(_0x1c00fa,null))['then'](function(_0x47c469){if(_0x47c469){_0x1e6e2c[_0xe02c('0xb1')]=_0x47c469;var _0x2a1f02={'ContactId':_0x47c469['id'],'phone':_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa3')],'WhatsappAccountId':_0x52a1e7['params']['id']};var _0x24d158={'ContactId':_0x47c469['id'],'WhatsappAccountId':_0x52a1e7['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0xe02c('0x60')]({'where':_0x24d158})[_0xe02c('0x23')](function(_0x21591b){if(_0x21591b){return[_0x21591b,![]];}return db['WhatsappInteraction'][_0xe02c('0x61')](_0x2a1f02)[_0xe02c('0x23')](function(_0x123477){return[_0x123477,!![]];});});}})[_0xe02c('0x7a')](function(_0x1cf4f9,_0x142500){_0x1e6e2c[_0xe02c('0xb2')]=_0x1cf4f9[_0xe02c('0x3d')]({'plain':!![]});_0x1e6e2c['interaction']['created']=![];if(_0x142500){if(_0x1e6e2c[_0xe02c('0x8d')][_0xe02c('0xb3')]){_0x1e6e2c[_0xe02c('0xb4')][_0xe02c('0xb5')]({'id':0x0,'priority':_0x1e6e2c['applications']['length']+0x1,'app':_0xe02c('0xb6'),'appdata':_0xe02c('0xb7'),'interval':_0xe02c('0xb8')});}_0x1e6e2c[_0xe02c('0xb2')][_0xe02c('0xb9')]=!![];}return db[_0xe02c('0xba')][_0xe02c('0x61')]({'phone':_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa3')],'messageId':_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xa1')],'body':_0x1e6e2c['body'][_0xe02c('0x62')],'WhatsappAccountId':_0x52a1e7[_0xe02c('0x6a')]['id'],'WhatsappInteractionId':_0x1cf4f9['id'],'direction':'in','ContactId':_0x1cf4f9['ContactId'],'AttachmentId':_0x1e6e2c[_0xe02c('0x62')][_0xe02c('0xbb')]});})['then'](function(_0x247789){_0x1e6e2c[_0xe02c('0x2b')]=_0x247789;if(!_0x1e6e2c[_0xe02c('0xb2')][_0xe02c('0xbc')])return;return db[_0xe02c('0xbd')][_0xe02c('0x60')]({'attributes':['id',_0xe02c('0x40')],'where':{'id':_0x1e6e2c[_0xe02c('0xb2')][_0xe02c('0xbc')]}});})[_0xe02c('0x23')](function(_0x25d42c){if(_0x25d42c){_0x1e6e2c[_0xe02c('0xb4')][_0xe02c('0xbe')]({'id':0x0,'priority':0x0,'app':_0xe02c('0xbf'),'appdata':_0x25d42c[_0xe02c('0x40')]+','+(_0x1e6e2c[_0xe02c('0x8d')][_0xe02c('0xc0')]||0xa),'interval':_0xe02c('0xb8')});}if(!_0x1e6e2c[_0xe02c('0xb2')][_0xe02c('0xc1')])return;return db[_0xe02c('0xc2')][_0xe02c('0x60')]({'attributes':['id','name'],'where':{'id':_0x1e6e2c[_0xe02c('0xb2')][_0xe02c('0xc1')]}});})['then'](function(_0x40593c){if(_0x40593c){_0x1e6e2c[_0xe02c('0xb4')][_0xe02c('0xbe')]({'id':0x0,'priority':0x1,'app':_0xe02c('0xc3'),'appdata':_0x40593c['name']+','+(_0x1e6e2c['account'][_0xe02c('0xc4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe02c('0xc5'),_0xe02c('0xc6'),_0x1e6e2c);})[_0xe02c('0x23')](function(_0x360318){if(_0x360318){var _0x59ef3f=0xc8;var _0x5a460b=_0xe02c('0xc7');logger[_0xe02c('0x2c')](_0xe02c('0x26'),_0x5a460b,_0x59ef3f,_0xe02c('0xc8'));logger[_0xe02c('0x25')](_0xe02c('0xc9'),_0x5a460b,_0x59ef3f,_0xe02c('0xc8'),JSON[_0xe02c('0x28')](_0x360318));if(_0x1e6e2c[_0xe02c('0x8d')][_0xe02c('0x57')]===_0xe02c('0x9c')){return _0x1c00fa[_0xe02c('0x30')](_0x59ef3f)[_0xe02c('0x37')]('Content-Type','text/xml')[_0xe02c('0x88')](_0xe02c('0xca'));}else{return _0x1c00fa['status'](_0x59ef3f)[_0xe02c('0x32')](_0x360318);}}});})[_0xe02c('0x2e')](handleError(_0x1c00fa,null));};exports['send']=function(_0x19eaa5,_0x10cad9,_0x559cfc){var _0xbfc1d3,_0x2df575,_0x595f90;if(_['isNil'](_0x19eaa5[_0xe02c('0x62')][_0xe02c('0x62')])||_0x19eaa5[_0xe02c('0x62')]['body']===''){throw new db[(_0xe02c('0x95'))]['ValidationError'](_0xe02c('0xa7'));}if(_[_0xe02c('0xa4')](_0x19eaa5[_0xe02c('0x62')]['to'])){throw new db[(_0xe02c('0x95'))][(_0xe02c('0xa5'))](_0xe02c('0xcb'));}_0xbfc1d3=_0x19eaa5[_0xe02c('0x62')]['to'];return db[_0xe02c('0x43')][_0xe02c('0x60')]({'where':{'id':_0x19eaa5[_0xe02c('0x6a')]['id']},'include':[{'model':db[_0xe02c('0xac')],'as':_0xe02c('0xcc'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0xbfc1d3},'limit':0x1,'order':[[_0xe02c('0x98'),_0xe02c('0xaf')]]}]}]})[_0xe02c('0x23')](handleEntityNotFound(_0x10cad9,null))[_0xe02c('0x23')](function(_0x43e9c4){if(_0x43e9c4&&_0x43e9c4[_0xe02c('0xcc')]){_0x2df575=_0x43e9c4[_0xe02c('0x3d')]({'plain':!![]});if(_0x2df575[_0xe02c('0xcc')]&&_0x2df575[_0xe02c('0xcc')][_0xe02c('0xae')][_0xe02c('0x4e')]){return _0x2df575['List']['Contacts'][0x0];}return db['CmContact'][_0xe02c('0x61')](_['defaults'](_0x19eaa5[_0xe02c('0x62')],{'firstName':_0xbfc1d3,'mobile':_0xbfc1d3,'phone':_0xbfc1d3,'ListId':_0x2df575[_0xe02c('0x9a')]}));}})['then'](handleEntityNotFound(_0x10cad9,null))[_0xe02c('0x23')](function(_0x1860e4){if(_0x1860e4){_0x595f90=_0x1860e4;return db[_0xe02c('0xcd')]['find']({'where':{'ContactId':_0x595f90['id'],'closed':![],'WhatsappAccountId':_0x2df575['id']}})[_0xe02c('0x23')](function(_0x43e8c7){if(_0x43e8c7){return[_0x43e8c7,![]];}return db[_0xe02c('0xcd')][_0xe02c('0x61')]({'UserId':_0x19eaa5[_0xe02c('0x65')]['id'],'ContactId':_0x595f90['id'],'WhatsappAccountId':_0x2df575['id'],'phone':_0xbfc1d3,'firstMsgDirection':_0xe02c('0xce'),'Messages':[_[_0xe02c('0x56')](_0x19eaa5['body'],{'read':![],'body':_0x19eaa5[_0xe02c('0x62')][_0xe02c('0x62')],'phone':_0xbfc1d3,'WhatsappAccountId':_0x2df575['id'],'UserId':_0x19eaa5[_0xe02c('0x65')]['id'],'ContactId':_0x595f90['id']})]},{'include':[{'model':db[_0xe02c('0xba')],'as':'Messages'}]})[_0xe02c('0x23')](function(_0x590630){return[_0x590630,!![]];});});}})[_0xe02c('0x7a')](function(_0x45a8af,_0xf8ad33){if(_0xf8ad33){return _0x45a8af;}return db[_0xe02c('0xba')][_0xe02c('0x61')](_[_0xe02c('0x56')](_0x19eaa5[_0xe02c('0x62')],{'read':![],'body':_0x19eaa5[_0xe02c('0x62')][_0xe02c('0x62')],'phone':_0xbfc1d3,'WhatsappAccountId':_0x2df575['id'],'WhatsappInteractionId':_0x45a8af['id'],'UserId':_0x19eaa5[_0xe02c('0x65')]['id'],'ContactId':_0x595f90['id']}))[_0xe02c('0x23')](function(_0x123f15){_0x45a8af[_0xe02c('0xcf')]['Messages']=[];_0x45a8af['dataValues']['Messages']['push'](_0x123f15[_0xe02c('0xcf')]);return _0x45a8af;});})[_0xe02c('0x23')](respondWithResult(_0x10cad9,null))[_0xe02c('0x2e')](handleError(_0x10cad9,null));}; \ No newline at end of file +var _0xb338=['./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','mandatoryDispositionPause','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','statuses','read','message_id','applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','list','omit','defaults','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','*,*,*,*','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x47d23b,_0x419b44){var _0x32fc76=function(_0x2c5117){while(--_0x2c5117){_0x47d23b['push'](_0x47d23b['shift']());}};_0x32fc76(++_0x419b44);}(_0xb338,0x16e));var _0x8b33=function(_0xfacee2,_0x29c3b0){_0xfacee2=_0xfacee2-0x0;var _0x4cc9ea=_0xb338[_0xfacee2];return _0x4cc9ea;};'use strict';var emlformat=require(_0x8b33('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b33('0x1'));var rp=require(_0x8b33('0x2'));var moment=require(_0x8b33('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8b33('0x4'));var sox=require(_0x8b33('0x5'));var csv=require('to-csv');var ejs=require(_0x8b33('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b33('0x7'));var squel=require(_0x8b33('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b33('0x9'));var toCsv=require(_0x8b33('0xa'));var querystring=require(_0x8b33('0xb'));var Papa=require(_0x8b33('0xc'));var Redis=require(_0x8b33('0xd'));var authService=require(_0x8b33('0xe'));var qs=require(_0x8b33('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b33('0x10'));var logger=require(_0x8b33('0x11'))(_0x8b33('0x12'));var utils=require(_0x8b33('0x13'));var config=require(_0x8b33('0x14'));var licenseUtil=require(_0x8b33('0x15'));var db=require(_0x8b33('0x16'))['db'];config[_0x8b33('0x17')]=_['defaults'](config[_0x8b33('0x17')],{'host':_0x8b33('0x18'),'port':0x18eb});var socket=require(_0x8b33('0x19'))(new Redis(config[_0x8b33('0x17')]));require(_0x8b33('0x1a'))[_0x8b33('0x1b')](socket);var jayson=require(_0x8b33('0x1c'));var client=jayson[_0x8b33('0x1d')][_0x8b33('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x4caa9a,_0xc92ef6,_0x50d538,_0x3ac8d8){return new BPromise(function(_0xbf6d75,_0x24e40a){var _0x541a20=_0x3ac8d8||client;return _0x541a20[_0x8b33('0x1f')](_0x4caa9a,_0x50d538)[_0x8b33('0x20')](function(_0x526548){logger[_0x8b33('0x21')](_0x8b33('0x22'),_0xc92ef6,_0x8b33('0x23'));logger[_0x8b33('0x24')](_0x8b33('0x25'),_0xc92ef6,'request\x20sent',JSON[_0x8b33('0x26')](_0x526548));if(_0x526548[_0x8b33('0x27')]){if(_0x526548[_0x8b33('0x27')][_0x8b33('0x28')]===0x1f4){logger[_0x8b33('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0xc92ef6,_0x526548[_0x8b33('0x27')]['message']);return _0x24e40a(_0x526548[_0x8b33('0x27')][_0x8b33('0x29')]);}logger[_0x8b33('0x27')](_0x8b33('0x22'),_0xc92ef6,_0x526548[_0x8b33('0x27')][_0x8b33('0x29')]);return _0xbf6d75(_0x526548[_0x8b33('0x27')]['message']);}else{logger[_0x8b33('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0xc92ef6,_0x8b33('0x23'));_0xbf6d75(_0x526548[_0x8b33('0x2a')][_0x8b33('0x29')]);}})[_0x8b33('0x2b')](function(_0x3e9c93){logger[_0x8b33('0x27')](_0x8b33('0x22'),_0xc92ef6,_0x3e9c93);_0x24e40a(_0x3e9c93);});});}function respondWithStatusCode(_0x5e410e,_0x2c01a1){_0x2c01a1=_0x2c01a1||0xcc;return function(_0x39f834){if(_0x39f834){return _0x5e410e['sendStatus'](_0x2c01a1);}return _0x5e410e[_0x8b33('0x2c')](_0x2c01a1)[_0x8b33('0x2d')]();};}function respondWithResult(_0x519ba8,_0x48b787){_0x48b787=_0x48b787||0xc8;return function(_0x5ed44a){if(_0x5ed44a){return _0x519ba8[_0x8b33('0x2c')](_0x48b787)[_0x8b33('0x2e')](_0x5ed44a);}};}function respondWithFilteredResult(_0x471ac9,_0x55d7c3){return function(_0x3a3dce){if(_0x3a3dce){var _0x3295d3=typeof _0x55d7c3[_0x8b33('0x2f')]===_0x8b33('0x30')&&typeof _0x55d7c3[_0x8b33('0x31')]===_0x8b33('0x30');var _0x578fab=_0x3a3dce[_0x8b33('0x32')];var _0x23ff1c=_0x3295d3?0x0:_0x55d7c3[_0x8b33('0x2f')];var _0x46deb9=_0x3295d3?_0x3a3dce[_0x8b33('0x32')]:_0x55d7c3[_0x8b33('0x2f')]+_0x55d7c3[_0x8b33('0x31')];var _0x8ed7e3;if(_0x46deb9>=_0x578fab){_0x46deb9=_0x578fab;_0x8ed7e3=0xc8;}else{_0x8ed7e3=0xce;}_0x471ac9['status'](_0x8ed7e3);return _0x471ac9[_0x8b33('0x33')](_0x8b33('0x34'),_0x23ff1c+'-'+_0x46deb9+'/'+_0x578fab)['json'](_0x3a3dce);}return null;};}function patchUpdates(_0x22f1f6){return function(_0x2938f1){try{jsonpatch[_0x8b33('0x35')](_0x2938f1,_0x22f1f6,!![]);}catch(_0x36ec8b){return BPromise['reject'](_0x36ec8b);}return _0x2938f1['save']();};}function saveUpdates(_0x4a1f2d,_0x305d94){return function(_0x3c0c20){if(_0x3c0c20){return _0x3c0c20[_0x8b33('0x36')](_0x4a1f2d)[_0x8b33('0x20')](function(_0x256f62){return _0x256f62;});}return null;};}function removeEntity(_0x1c101b,_0x50d4e7){return function(_0x3f1631){if(_0x3f1631){return _0x3f1631[_0x8b33('0x37')]()[_0x8b33('0x20')](function(){var _0x1de1fd=_0x3f1631['get']({'plain':!![]});var _0x20fbcf=_0x8b33('0x38');return db[_0x8b33('0x39')][_0x8b33('0x37')]({'where':{'type':_0x20fbcf,'resourceId':_0x1de1fd['id']}})[_0x8b33('0x20')](function(){return _0x3f1631;});})['then'](function(){_0x1c101b[_0x8b33('0x2c')](0xcc)[_0x8b33('0x2d')]();});}};}function handleEntityNotFound(_0xee7766,_0x448ed6){return function(_0x1c3998){if(!_0x1c3998){_0xee7766[_0x8b33('0x3a')](0x194);}return _0x1c3998;};}function handleError(_0x54fd05,_0x4f9805){_0x4f9805=_0x4f9805||0x1f4;return function(_0x3d37ff){logger[_0x8b33('0x27')](_0x3d37ff[_0x8b33('0x3b')]);if(_0x3d37ff[_0x8b33('0x3c')]){delete _0x3d37ff[_0x8b33('0x3c')];}_0x54fd05[_0x8b33('0x2c')](_0x4f9805)[_0x8b33('0x3d')](_0x3d37ff);};}exports['index']=function(_0x17a21b,_0x269b96){var _0x2499d8={'include':[{'model':db[_0x8b33('0x3e')],'as':'mandatoryDispositionPause'}]},_0xd5d3c9={},_0x2de46e={'count':0x0,'rows':[]};var _0x5a5bc8=_[_0x8b33('0x3f')](db[_0x8b33('0x40')][_0x8b33('0x41')],function(_0x26b559){return{'name':_0x26b559[_0x8b33('0x42')],'type':_0x26b559[_0x8b33('0x43')][_0x8b33('0x44')]};});_0xd5d3c9[_0x8b33('0x45')]=_['map'](_0x5a5bc8,_0x8b33('0x3c'));_0xd5d3c9[_0x8b33('0x46')]=_[_0x8b33('0x47')](_0x17a21b[_0x8b33('0x46')]);_0xd5d3c9[_0x8b33('0x48')]=_[_0x8b33('0x49')](_0xd5d3c9['model'],_0xd5d3c9[_0x8b33('0x46')]);_0x2499d8[_0x8b33('0x4a')]=_[_0x8b33('0x49')](_0xd5d3c9['model'],qs[_0x8b33('0x4b')](_0x17a21b[_0x8b33('0x46')]['fields']));_0x2499d8['attributes']=_0x2499d8[_0x8b33('0x4a')][_0x8b33('0x4c')]?_0x2499d8['attributes']:_0xd5d3c9['model'];if(!_0x17a21b[_0x8b33('0x46')][_0x8b33('0x4d')](_0x8b33('0x4e'))){_0x2499d8[_0x8b33('0x31')]=qs[_0x8b33('0x31')](_0x17a21b[_0x8b33('0x46')][_0x8b33('0x31')]);_0x2499d8[_0x8b33('0x2f')]=qs[_0x8b33('0x2f')](_0x17a21b[_0x8b33('0x46')][_0x8b33('0x2f')]);}_0x2499d8[_0x8b33('0x4f')]=qs[_0x8b33('0x50')](_0x17a21b[_0x8b33('0x46')]['sort']);_0x2499d8[_0x8b33('0x51')]=qs['filters'](_[_0x8b33('0x52')](_0x17a21b[_0x8b33('0x46')],_0xd5d3c9['filters']),_0x5a5bc8);if(_0x17a21b[_0x8b33('0x46')][_0x8b33('0x53')]){_0x2499d8[_0x8b33('0x51')]=_[_0x8b33('0x54')](_0x2499d8['where'],{'$or':_['map'](_0x5a5bc8,function(_0x2ad92a){if(_0x2ad92a['type']!=='VIRTUAL'){var _0x257155={};_0x257155[_0x2ad92a[_0x8b33('0x3c')]]={'$like':'%'+_0x17a21b[_0x8b33('0x46')][_0x8b33('0x53')]+'%'};return _0x257155;}})});}_0x2499d8=_[_0x8b33('0x54')]({},_0x2499d8,_0x17a21b[_0x8b33('0x55')]);var _0x5821a9={'where':_0x2499d8[_0x8b33('0x51')]};return db[_0x8b33('0x40')][_0x8b33('0x32')](_0x5821a9)[_0x8b33('0x20')](function(_0x4ce034){_0x2de46e['count']=_0x4ce034;if(_0x17a21b[_0x8b33('0x46')][_0x8b33('0x56')]){_0x2499d8[_0x8b33('0x57')]=[{'all':!![]}];}return db[_0x8b33('0x40')][_0x8b33('0x58')](_0x2499d8);})[_0x8b33('0x20')](function(_0x36cf86){_0x2de46e[_0x8b33('0x59')]=_0x36cf86;return _0x2de46e;})[_0x8b33('0x20')](respondWithFilteredResult(_0x269b96,_0x2499d8))['catch'](handleError(_0x269b96,null));};exports['show']=function(_0x58d387,_0x1dccaf){var _0x31ca0b={'raw':![],'where':{'id':_0x58d387[_0x8b33('0x5a')]['id']},'include':[{'model':db[_0x8b33('0x3e')],'as':_0x8b33('0x5b')}]},_0x5122e1={};_0x5122e1[_0x8b33('0x45')]=_[_0x8b33('0x47')](db[_0x8b33('0x40')][_0x8b33('0x41')]);_0x5122e1[_0x8b33('0x46')]=_['keys'](_0x58d387[_0x8b33('0x46')]);_0x5122e1['filters']=_[_0x8b33('0x49')](_0x5122e1[_0x8b33('0x45')],_0x5122e1['query']);_0x31ca0b[_0x8b33('0x4a')]=_[_0x8b33('0x49')](_0x5122e1[_0x8b33('0x45')],qs[_0x8b33('0x4b')](_0x58d387['query'][_0x8b33('0x4b')]));_0x31ca0b[_0x8b33('0x4a')]=_0x31ca0b['attributes'][_0x8b33('0x4c')]?_0x31ca0b[_0x8b33('0x4a')]:_0x5122e1[_0x8b33('0x45')];if(_0x58d387['query'][_0x8b33('0x56')]){_0x31ca0b[_0x8b33('0x57')]=[{'all':!![]}];}_0x31ca0b=_[_0x8b33('0x54')]({},_0x31ca0b,_0x58d387[_0x8b33('0x55')]);return db[_0x8b33('0x40')][_0x8b33('0x5c')](_0x31ca0b)[_0x8b33('0x20')](handleEntityNotFound(_0x1dccaf,null))[_0x8b33('0x20')](respondWithResult(_0x1dccaf,null))[_0x8b33('0x2b')](handleError(_0x1dccaf,null));};exports[_0x8b33('0x5d')]=function(_0x2e7671,_0x2461c5){return db['WhatsappAccount'][_0x8b33('0x5d')](_0x2e7671['body'],{})[_0x8b33('0x20')](function(_0x36d837){var _0x452faf=_0x2e7671[_0x8b33('0x5e')][_0x8b33('0x5f')]({'plain':!![]});if(!_0x452faf)throw new Error(_0x8b33('0x60'));if(_0x452faf['role']===_0x8b33('0x5e')){var _0x2dd836=_0x36d837[_0x8b33('0x5f')]({'plain':!![]});var _0x37cc20=_0x8b33('0x38');return db[_0x8b33('0x61')][_0x8b33('0x5c')]({'where':{'name':_0x37cc20,'userProfileId':_0x452faf[_0x8b33('0x62')]},'raw':!![]})['then'](function(_0x341997){if(_0x341997&&_0x341997[_0x8b33('0x63')]===0x0){return db[_0x8b33('0x39')][_0x8b33('0x5d')]({'name':_0x2dd836[_0x8b33('0x3c')],'resourceId':_0x2dd836['id'],'type':_0x341997[_0x8b33('0x3c')],'sectionId':_0x341997['id']},{})[_0x8b33('0x20')](function(){return _0x36d837;});}else{return _0x36d837;}})[_0x8b33('0x2b')](function(_0xf42b19){logger[_0x8b33('0x27')](_0x8b33('0x64'),_0xf42b19);throw _0xf42b19;});}return _0x36d837;})[_0x8b33('0x20')](respondWithResult(_0x2461c5,0xc9))['catch'](handleError(_0x2461c5,null));};exports['update']=function(_0x40225c,_0xc6cb07){if(_0x40225c[_0x8b33('0x65')]['id']){delete _0x40225c[_0x8b33('0x65')]['id'];}return db[_0x8b33('0x40')][_0x8b33('0x5c')]({'where':{'id':_0x40225c['params']['id']},'include':[{'model':db[_0x8b33('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x8b33('0x20')](handleEntityNotFound(_0xc6cb07,null))[_0x8b33('0x20')](saveUpdates(_0x40225c[_0x8b33('0x65')],null))[_0x8b33('0x20')](respondWithResult(_0xc6cb07,null))[_0x8b33('0x2b')](handleError(_0xc6cb07,null));};exports['destroy']=function(_0x3fec7e,_0x111c4b){return db['WhatsappAccount'][_0x8b33('0x5c')]({'where':{'id':_0x3fec7e[_0x8b33('0x5a')]['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0x111c4b,null))['then'](removeEntity(_0x111c4b,null))['catch'](handleError(_0x111c4b,null));};exports[_0x8b33('0x66')]=function(_0x3806ef,_0x374603){return db[_0x8b33('0x40')][_0x8b33('0x66')]()[_0x8b33('0x20')](respondWithResult(_0x374603,null))['catch'](handleError(_0x374603,null));};exports[_0x8b33('0x67')]=function(_0x569941,_0x3f908b,_0x18afe7){if(_0x569941[_0x8b33('0x65')]['id']){delete _0x569941[_0x8b33('0x65')]['id'];}return db['WhatsappAccount'][_0x8b33('0x5c')]({'where':{'id':_0x569941['params']['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0x3f908b,null))['then'](function(_0x26c104){if(_0x26c104){_0x569941[_0x8b33('0x65')]['WhatsappAccountId']=_0x26c104['id'];return db[_0x8b33('0x68')][_0x8b33('0x5d')](_0x569941['body']);}})[_0x8b33('0x20')](respondWithResult(_0x3f908b,null))['catch'](handleError(_0x3f908b,null));};exports[_0x8b33('0x69')]=function(_0x11ea64,_0x5a6436,_0x2d895f){var _0xc5d99c={'raw':![],'where':{}};var _0x24553f={};var _0x2303e9={'count':0x0,'rows':[]};return db[_0x8b33('0x40')][_0x8b33('0x6a')]({'where':{'id':_0x11ea64[_0x8b33('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5a6436,null))[_0x8b33('0x20')](function(_0x556a4d){if(_0x556a4d){_0x24553f['model']=_['keys'](db[_0x8b33('0x68')][_0x8b33('0x41')]);_0x24553f[_0x8b33('0x46')]=_[_0x8b33('0x47')](_0x11ea64[_0x8b33('0x46')]);_0x24553f['filters']=_['intersection'](_0x24553f[_0x8b33('0x45')],_0x24553f[_0x8b33('0x46')]);_0xc5d99c[_0x8b33('0x4a')]=_[_0x8b33('0x49')](_0x24553f[_0x8b33('0x45')],qs[_0x8b33('0x4b')](_0x11ea64[_0x8b33('0x46')]['fields']));_0xc5d99c[_0x8b33('0x4a')]=_0xc5d99c[_0x8b33('0x4a')][_0x8b33('0x4c')]?_0xc5d99c[_0x8b33('0x4a')]:_0x24553f['model'];if(!_0x11ea64[_0x8b33('0x46')][_0x8b33('0x4d')]('nolimit')){_0xc5d99c[_0x8b33('0x31')]=qs[_0x8b33('0x31')](_0x11ea64[_0x8b33('0x46')][_0x8b33('0x31')]);_0xc5d99c['offset']=qs['offset'](_0x11ea64[_0x8b33('0x46')][_0x8b33('0x2f')]);}_0xc5d99c[_0x8b33('0x4f')]=qs[_0x8b33('0x50')](_0x11ea64[_0x8b33('0x46')][_0x8b33('0x50')]);_0xc5d99c[_0x8b33('0x51')]=qs[_0x8b33('0x48')](_[_0x8b33('0x52')](_0x11ea64[_0x8b33('0x46')],_0x24553f[_0x8b33('0x48')]));_0xc5d99c['where'][_0x8b33('0x6b')]=_0x556a4d['id'];if(_0x11ea64[_0x8b33('0x46')][_0x8b33('0x53')]){_0xc5d99c['where']=_[_0x8b33('0x54')](_0xc5d99c[_0x8b33('0x51')],{'$or':_[_0x8b33('0x3f')](_0xc5d99c[_0x8b33('0x4a')],function(_0x523db9){var _0x5bf72e={};_0x5bf72e[_0x523db9]={'$like':'%'+_0x11ea64[_0x8b33('0x46')]['filter']+'%'};return _0x5bf72e;})});}_0xc5d99c=_[_0x8b33('0x54')]({},_0xc5d99c,_0x11ea64['options']);return db['Disposition'][_0x8b33('0x32')]({'where':_0xc5d99c['where']})['then'](function(_0x44d489){_0x2303e9[_0x8b33('0x32')]=_0x44d489;if(_0x11ea64['query']['includeAll']){_0xc5d99c[_0x8b33('0x57')]=[{'all':!![]}];}return db[_0x8b33('0x68')][_0x8b33('0x58')](_0xc5d99c);})[_0x8b33('0x20')](function(_0x5ddc23){_0x2303e9['rows']=_0x5ddc23;return _0x2303e9;});}})['then'](respondWithFilteredResult(_0x5a6436,_0xc5d99c))[_0x8b33('0x2b')](handleError(_0x5a6436,null));};exports[_0x8b33('0x6c')]=function(_0x1bfa4a,_0x2a6752,_0x24b8cf){return db[_0x8b33('0x40')]['find']({'where':{'id':_0x1bfa4a[_0x8b33('0x5a')]['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0x2a6752,null))[_0x8b33('0x20')](function(_0x14ffcb){if(_0x14ffcb){return _0x14ffcb['removeDispositions'](_0x1bfa4a[_0x8b33('0x46')][_0x8b33('0x6d')]);}})[_0x8b33('0x20')](respondWithStatusCode(_0x2a6752,null))['catch'](handleError(_0x2a6752,null));};exports['addAnswer']=function(_0x3b8310,_0x457dbe,_0x3ed15a){if(_0x3b8310[_0x8b33('0x65')]['id']){delete _0x3b8310[_0x8b33('0x65')]['id'];}return db[_0x8b33('0x40')][_0x8b33('0x5c')]({'where':{'id':_0x3b8310[_0x8b33('0x5a')]['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0x457dbe,null))['then'](function(_0x42022d){if(_0x42022d){_0x3b8310[_0x8b33('0x65')]['WhatsappAccountId']=_0x42022d['id'];return db[_0x8b33('0x6e')]['create'](_0x3b8310['body']);}})[_0x8b33('0x20')](respondWithResult(_0x457dbe,null))['catch'](handleError(_0x457dbe,null));};exports[_0x8b33('0x6f')]=function(_0x459a79,_0x4f3781,_0x2bf53a){var _0x44b9e0={'raw':![],'where':{}};var _0x16d72e={};var _0x25e0ec={'count':0x0,'rows':[]};return db[_0x8b33('0x40')]['findOne']({'where':{'id':_0x459a79[_0x8b33('0x5a')]['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0x4f3781,null))[_0x8b33('0x20')](function(_0x22feda){if(_0x22feda){_0x16d72e[_0x8b33('0x45')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x16d72e['query']=_[_0x8b33('0x47')](_0x459a79[_0x8b33('0x46')]);_0x16d72e['filters']=_[_0x8b33('0x49')](_0x16d72e[_0x8b33('0x45')],_0x16d72e['query']);_0x44b9e0[_0x8b33('0x4a')]=_[_0x8b33('0x49')](_0x16d72e[_0x8b33('0x45')],qs['fields'](_0x459a79['query'][_0x8b33('0x4b')]));_0x44b9e0[_0x8b33('0x4a')]=_0x44b9e0[_0x8b33('0x4a')][_0x8b33('0x4c')]?_0x44b9e0[_0x8b33('0x4a')]:_0x16d72e['model'];if(!_0x459a79[_0x8b33('0x46')][_0x8b33('0x4d')](_0x8b33('0x4e'))){_0x44b9e0[_0x8b33('0x31')]=qs['limit'](_0x459a79[_0x8b33('0x46')][_0x8b33('0x31')]);_0x44b9e0[_0x8b33('0x2f')]=qs[_0x8b33('0x2f')](_0x459a79[_0x8b33('0x46')][_0x8b33('0x2f')]);}_0x44b9e0[_0x8b33('0x4f')]=qs['sort'](_0x459a79['query']['sort']);_0x44b9e0['where']=qs[_0x8b33('0x48')](_[_0x8b33('0x52')](_0x459a79[_0x8b33('0x46')],_0x16d72e[_0x8b33('0x48')]));_0x44b9e0[_0x8b33('0x51')][_0x8b33('0x6b')]=_0x22feda['id'];if(_0x459a79[_0x8b33('0x46')][_0x8b33('0x53')]){_0x44b9e0[_0x8b33('0x51')]=_['merge'](_0x44b9e0['where'],{'$or':_[_0x8b33('0x3f')](_0x44b9e0[_0x8b33('0x4a')],function(_0x4e62ba){var _0x29e0a1={};_0x29e0a1[_0x4e62ba]={'$like':'%'+_0x459a79[_0x8b33('0x46')][_0x8b33('0x53')]+'%'};return _0x29e0a1;})});}_0x44b9e0=_[_0x8b33('0x54')]({},_0x44b9e0,_0x459a79[_0x8b33('0x55')]);return db[_0x8b33('0x6e')][_0x8b33('0x32')]({'where':_0x44b9e0[_0x8b33('0x51')]})['then'](function(_0x37a310){_0x25e0ec['count']=_0x37a310;if(_0x459a79[_0x8b33('0x46')][_0x8b33('0x56')]){_0x44b9e0[_0x8b33('0x57')]=[{'all':!![]}];}return db[_0x8b33('0x6e')]['findAll'](_0x44b9e0);})[_0x8b33('0x20')](function(_0x2e80f1){_0x25e0ec['rows']=_0x2e80f1;return _0x25e0ec;});}})[_0x8b33('0x20')](respondWithFilteredResult(_0x4f3781,_0x44b9e0))[_0x8b33('0x2b')](handleError(_0x4f3781,null));};exports['removeAnswers']=function(_0x1f0f70,_0xb325b6,_0x2d7cb2){return db[_0x8b33('0x40')][_0x8b33('0x5c')]({'where':{'id':_0x1f0f70[_0x8b33('0x5a')]['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0xb325b6,null))[_0x8b33('0x20')](function(_0x2b617a){if(_0x2b617a){return _0x2b617a[_0x8b33('0x70')](_0x1f0f70['query']['ids']);}})[_0x8b33('0x20')](respondWithStatusCode(_0xb325b6,null))[_0x8b33('0x2b')](handleError(_0xb325b6,null));};exports[_0x8b33('0x71')]=function(_0x1a78c0,_0x1bf5c8,_0x173d95){return db['WhatsappAccount']['find']({'where':{'id':_0x1a78c0['params']['id']}})['then'](handleEntityNotFound(_0x1bf5c8,null))[_0x8b33('0x20')](function(_0x5df236){if(_0x5df236){return _0x5df236[_0x8b33('0x71')](_0x1a78c0[_0x8b33('0x65')]['ids'],_['omit'](_0x1a78c0[_0x8b33('0x65')],[_0x8b33('0x6d'),'id'])||{})[_0x8b33('0x72')](function(_0x44467f){for(var _0xfa42f0=0x0;_0xfa42f0<_0x1a78c0[_0x8b33('0x65')][_0x8b33('0x6d')]['length'];_0xfa42f0+=0x1){socket[_0x8b33('0x73')](_0x8b33('0x74'),{'UserId':Number(_0x1a78c0[_0x8b33('0x65')][_0x8b33('0x6d')][_0xfa42f0]),'WhatsappAccountId':Number(_0x1a78c0[_0x8b33('0x5a')]['id'])});}return _0x44467f;});}})[_0x8b33('0x20')](respondWithResult(_0x1bf5c8,null))[_0x8b33('0x2b')](handleError(_0x1bf5c8,null));};exports['removeAgents']=function(_0x23b140,_0x3a9946,_0x28d52b){return db[_0x8b33('0x40')][_0x8b33('0x5c')]({'where':{'id':_0x23b140[_0x8b33('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a9946,null))[_0x8b33('0x20')](function(_0x38e4d7){if(_0x38e4d7){return _0x38e4d7[_0x8b33('0x75')](_0x23b140[_0x8b33('0x46')][_0x8b33('0x6d')])['then'](function(){if(_[_0x8b33('0x76')](_0x23b140['query'][_0x8b33('0x6d')])){for(var _0x52b2b9=0x0;_0x52b2b9<_0x23b140['query'][_0x8b33('0x6d')]['length'];_0x52b2b9+=0x1){socket['emit'](_0x8b33('0x77'),{'UserId':Number(_0x23b140[_0x8b33('0x46')][_0x8b33('0x6d')][_0x52b2b9]),'WhatsappAccountId':Number(_0x23b140[_0x8b33('0x5a')]['id'])});}}else{socket[_0x8b33('0x73')](_0x8b33('0x77'),{'UserId':Number(_0x23b140[_0x8b33('0x46')][_0x8b33('0x6d')]),'WhatsappAccountId':Number(_0x23b140[_0x8b33('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a9946,null))[_0x8b33('0x2b')](handleError(_0x3a9946,null));};exports[_0x8b33('0x78')]=function(_0x67e462,_0x2cafaa,_0x52f8d8){var _0xd1e3a8={};var _0x354c5d={};var _0x3c2ee8;var _0x48c36b;return db[_0x8b33('0x40')]['findOne']({'where':{'id':_0x67e462['params']['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0x2cafaa,null))['then'](function(_0x298371){if(_0x298371){_0x3c2ee8=_0x298371;_0x354c5d[_0x8b33('0x45')]=_['keys'](db[_0x8b33('0x79')][_0x8b33('0x41')]);_0x354c5d[_0x8b33('0x46')]=_['keys'](_0x67e462[_0x8b33('0x46')]);_0x354c5d['filters']=_['intersection'](_0x354c5d[_0x8b33('0x45')],_0x354c5d[_0x8b33('0x46')]);_0xd1e3a8[_0x8b33('0x4a')]=_[_0x8b33('0x49')](_0x354c5d['model'],qs[_0x8b33('0x4b')](_0x67e462[_0x8b33('0x46')][_0x8b33('0x4b')]));_0xd1e3a8['attributes']=_0xd1e3a8[_0x8b33('0x4a')][_0x8b33('0x4c')]?_0xd1e3a8['attributes']:_0x354c5d[_0x8b33('0x45')];_0xd1e3a8[_0x8b33('0x4f')]=qs[_0x8b33('0x50')](_0x67e462['query'][_0x8b33('0x50')]);_0xd1e3a8[_0x8b33('0x51')]=qs[_0x8b33('0x48')](_[_0x8b33('0x52')](_0x67e462[_0x8b33('0x46')],_0x354c5d[_0x8b33('0x48')]));if(_0x67e462[_0x8b33('0x46')][_0x8b33('0x53')]){_0xd1e3a8[_0x8b33('0x51')]=_[_0x8b33('0x54')](_0xd1e3a8[_0x8b33('0x51')],{'$or':_[_0x8b33('0x3f')](_0xd1e3a8[_0x8b33('0x4a')],function(_0x413a22){var _0x427701={};_0x427701[_0x413a22]={'$like':'%'+_0x67e462['query']['filter']+'%'};return _0x427701;})});}_0xd1e3a8=_[_0x8b33('0x54')]({},_0xd1e3a8,_0x67e462[_0x8b33('0x55')]);return _0x3c2ee8[_0x8b33('0x78')](_0xd1e3a8);}})[_0x8b33('0x20')](function(_0x2545cb){if(_0x2545cb){_0x48c36b=_0x2545cb[_0x8b33('0x4c')];if(!_0x67e462[_0x8b33('0x46')]['hasOwnProperty'](_0x8b33('0x4e'))){_0xd1e3a8['limit']=qs[_0x8b33('0x31')](_0x67e462[_0x8b33('0x46')]['limit']);_0xd1e3a8['offset']=qs['offset'](_0x67e462[_0x8b33('0x46')][_0x8b33('0x2f')]);}return _0x3c2ee8[_0x8b33('0x78')](_0xd1e3a8);}})[_0x8b33('0x20')](function(_0x47f15b){if(_0x47f15b){return _0x47f15b?{'count':_0x48c36b,'rows':_0x47f15b}:null;}})['then'](respondWithResult(_0x2cafaa,null))['catch'](handleError(_0x2cafaa,null));};exports[_0x8b33('0x7a')]=function(_0x2d72b7,_0x12987d){var _0x592c42=_0x2d72b7['params']['id'];var _0x441f18=_0x2d72b7[_0x8b33('0x65')];var _0x182a1d=0xc8;var _0x25a28b=null;return db[_0x8b33('0x7b')]['transaction']({'isolationLevel':db[_0x8b33('0x7b')][_0x8b33('0x7c')][_0x8b33('0x7d')][_0x8b33('0x7e')]},function(_0x27323e){return db[_0x8b33('0x40')][_0x8b33('0x6a')]({'where':{'id':_0x592c42},'transaction':_0x27323e})[_0x8b33('0x20')](function(_0x4d4916){if(_0x4d4916){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x592c42},'transaction':_0x27323e})[_0x8b33('0x20')](function(){var _0x25b320=_['map'](_0x441f18,function(_0xe01ef){_0xe01ef[_0x8b33('0x6b')]=_0x592c42;return _0xe01ef;});return db[_0x8b33('0x7f')][_0x8b33('0x80')](_0x25b320,{'transaction':_0x27323e});});}else{_0x182a1d=0x194;_0x25a28b=[];}});})[_0x8b33('0x20')](function(){if(_0x182a1d!==0x194){return db[_0x8b33('0x7f')][_0x8b33('0x81')]({'where':{'WhatsappAccountId':_0x592c42},'order':'priority'})['then'](function(_0x2eb9bb){_0x25a28b=_0x2eb9bb;});}})['catch'](function(_0x3557e9){_0x182a1d=0x1f4;logger[_0x8b33('0x27')](_0x3557e9[_0x8b33('0x3b')]);if(_0x3557e9[_0x8b33('0x3c')]){delete _0x3557e9[_0x8b33('0x3c')];}_0x25a28b=_0x3557e9;})[_0x8b33('0x82')](function(){if(_0x25a28b===null){_0x12987d[_0x8b33('0x3a')](_0x182a1d);}else{if(_0x182a1d===0x1f4){_0x12987d[_0x8b33('0x2c')](_0x182a1d)[_0x8b33('0x3d')](_0x25a28b);}else{_0x12987d[_0x8b33('0x2c')](_0x182a1d)[_0x8b33('0x2e')](_0x25a28b);}}});};exports['getApplications']=function(_0x570c20,_0x537ad6,_0x259082){var _0x4d1acd={};var _0x5b0587={};var _0x1f5e7e;var _0xb28503;return db[_0x8b33('0x40')][_0x8b33('0x6a')]({'where':{'id':_0x570c20[_0x8b33('0x5a')]['id']}})[_0x8b33('0x20')](handleEntityNotFound(_0x537ad6,null))[_0x8b33('0x20')](function(_0x5d373a){if(_0x5d373a){_0x1f5e7e=_0x5d373a;_0x5b0587[_0x8b33('0x45')]=_[_0x8b33('0x47')](db[_0x8b33('0x7f')][_0x8b33('0x41')]);_0x5b0587[_0x8b33('0x46')]=_['keys'](_0x570c20['query']);_0x5b0587[_0x8b33('0x48')]=_[_0x8b33('0x49')](_0x5b0587[_0x8b33('0x45')],_0x5b0587[_0x8b33('0x46')]);_0x4d1acd['attributes']=_[_0x8b33('0x49')](_0x5b0587[_0x8b33('0x45')],qs[_0x8b33('0x4b')](_0x570c20[_0x8b33('0x46')][_0x8b33('0x4b')]));_0x4d1acd[_0x8b33('0x4a')]=_0x4d1acd[_0x8b33('0x4a')][_0x8b33('0x4c')]?_0x4d1acd[_0x8b33('0x4a')]:_0x5b0587[_0x8b33('0x45')];_0x4d1acd[_0x8b33('0x4f')]=qs[_0x8b33('0x50')](_0x570c20[_0x8b33('0x46')][_0x8b33('0x50')]);_0x4d1acd['where']=qs['filters'](_[_0x8b33('0x52')](_0x570c20['query'],_0x5b0587['filters']));if(_0x570c20[_0x8b33('0x46')][_0x8b33('0x53')]){_0x4d1acd[_0x8b33('0x51')]=_[_0x8b33('0x54')](_0x4d1acd[_0x8b33('0x51')],{'$or':_[_0x8b33('0x3f')](_0x4d1acd['attributes'],function(_0x551d26){var _0x43f563={};_0x43f563[_0x551d26]={'$like':'%'+_0x570c20['query'][_0x8b33('0x53')]+'%'};return _0x43f563;})});}_0x4d1acd=_['merge']({},_0x4d1acd,_0x570c20[_0x8b33('0x55')]);return _0x1f5e7e[_0x8b33('0x83')](_0x4d1acd);}})[_0x8b33('0x20')](function(_0x35a43b){if(_0x35a43b){_0xb28503=_0x35a43b['length'];if(!_0x570c20['query']['hasOwnProperty'](_0x8b33('0x4e'))){_0x4d1acd[_0x8b33('0x31')]=qs[_0x8b33('0x31')](_0x570c20['query'][_0x8b33('0x31')]);_0x4d1acd[_0x8b33('0x2f')]=qs[_0x8b33('0x2f')](_0x570c20[_0x8b33('0x46')]['offset']);}return _0x1f5e7e['getApplications'](_0x4d1acd);}})[_0x8b33('0x20')](function(_0x1cee98){if(_0x1cee98){return _0x1cee98?{'count':_0xb28503,'rows':_0x1cee98}:null;}})[_0x8b33('0x20')](respondWithResult(_0x537ad6,null))['catch'](handleError(_0x537ad6,null));};exports[_0x8b33('0x84')]=function(_0x4dcbad,_0x2a9409,_0x45ca6b){var _0xfd00c9={'channel':_0x8b33('0x85')};var _0x215e44=[];var _0x30019d=[];var _0x16643b={};return db['WhatsappAccount'][_0x8b33('0x5c')]({'where':{'id':_0x4dcbad['params']['id']},'include':[{'model':db[_0x8b33('0x7f')],'as':_0x8b33('0x86')}]})['then'](handleEntityNotFound(_0x2a9409,null))[_0x8b33('0x20')](function(_0x2b8309){_0xfd00c9['account']=_0x2b8309;if(_0xfd00c9[_0x8b33('0x87')]&&_0xfd00c9['account'][_0x8b33('0x43')]==='sinch'&&_0x4dcbad[_0x8b33('0x65')][_0x8b33('0x88')]){if(_0x4dcbad['body']['statuses'][_0x8b33('0x4c')]===0x0)return;if(_0x4dcbad[_0x8b33('0x65')][_0x8b33('0x88')][0x0]['state']!==_0x8b33('0x89'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x4dcbad['body'][_0x8b33('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x4dcbad[_0x8b33('0x65')][_0x8b33('0x88')][0x0][_0x8b33('0x8a')]},'individualHooks':!![]})[_0x8b33('0x20')](function(_0x2a426f){return _0x2a9409[_0x8b33('0x2c')](0xc8)[_0x8b33('0x2e')](_0x2a426f);});}_0xfd00c9[_0x8b33('0x8b')]=_['orderBy'](_0x2b8309[_0x8b33('0x86')],[_0x8b33('0x8c')],[_0x8b33('0x8d')]);if(_0xfd00c9['account'][_0x8b33('0x86')]){delete _0xfd00c9[_0x8b33('0x87')][_0x8b33('0x86')];}return db[_0x8b33('0x8e')][_0x8b33('0x66')]()[_0x8b33('0x20')](function(_0x3fedb2){if(!_0x3fedb2){throw new db[(_0x8b33('0x8f'))][(_0x8b33('0x90'))](_0x8b33('0x91'));}_0x215e44=_[_0x8b33('0x92')](_[_0x8b33('0x47')](_0x3fedb2),[_0x8b33('0x93'),_0x8b33('0x94')]);_0x30019d=_['difference'](_[_0x8b33('0x47')](_0x3fedb2),[_0x8b33('0x93'),'updatedAt',_0x8b33('0x95'),_0x8b33('0x96')]);_0xfd00c9['body']={'mapKey':'mobile'};if(_0xfd00c9[_0x8b33('0x87')]&&_0xfd00c9[_0x8b33('0x87')][_0x8b33('0x43')]===_0x8b33('0x97')){_0xfd00c9[_0x8b33('0x65')][_0x8b33('0x98')]=_0x4dcbad[_0x8b33('0x65')][_0x8b33('0x99')][_0x8b33('0x9a')](_0x8b33('0x9b'),'');_0xfd00c9['body'][_0x8b33('0x65')]=_0x4dcbad[_0x8b33('0x65')]['Body'];_0xfd00c9['body'][_0x8b33('0x9c')]=_0x4dcbad[_0x8b33('0x65')][_0x8b33('0x9d')];}if(_0xfd00c9[_0x8b33('0x87')]&&_0xfd00c9['account'][_0x8b33('0x43')]==='sinch'){_0xfd00c9[_0x8b33('0x65')]['from']=_0x4dcbad['body']['notifications'][0x0][_0x8b33('0x98')];_0xfd00c9[_0x8b33('0x65')][_0x8b33('0x65')]=_0x4dcbad[_0x8b33('0x65')][_0x8b33('0x9e')][0x0][_0x8b33('0x29')][_0x8b33('0x65')];_0xfd00c9['body']['messageId']=_0x4dcbad['body']['notifications'][0x0][_0x8b33('0x8a')];}if(_0xfd00c9[_0x8b33('0x65')]['id']){delete _0xfd00c9[_0x8b33('0x65')]['id'];}if(_[_0x8b33('0x9f')](_0xfd00c9['body']['from'])){throw new db[(_0x8b33('0x8f'))][(_0x8b33('0x90'))](_0x8b33('0xa0'));}if(_[_0x8b33('0x9f')](_0xfd00c9[_0x8b33('0x65')]['body'])||_0xfd00c9[_0x8b33('0x65')][_0x8b33('0x65')]===''){throw new db[(_0x8b33('0x8f'))][(_0x8b33('0x90'))](_0x8b33('0xa1'));}if(_[_0x8b33('0x9f')](_0xfd00c9[_0x8b33('0x65')]['mapKey'])){throw new db[(_0x8b33('0x8f'))][(_0x8b33('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x30019d);}if(!_[_0x8b33('0xa2')](_0x30019d,_0xfd00c9[_0x8b33('0x65')]['mapKey'])){throw new db[(_0x8b33('0x8f'))]['ValidationError'](_0x8b33('0xa3')+_0x30019d);}_0x16643b[_0xfd00c9[_0x8b33('0x65')][_0x8b33('0xa4')]]=_0xfd00c9['body'][_0x8b33('0x98')];return db['CmList']['find']({'where':{'id':_0xfd00c9[_0x8b33('0x87')][_0x8b33('0x96')]},'include':[{'model':db['CmContact'],'as':_0x8b33('0xa5'),'where':_0x16643b,'limit':0x1,'order':[[_0x8b33('0x94'),_0x8b33('0xa6')]]}]});})[_0x8b33('0x20')](handleEntityNotFound(_0x2a9409,null))[_0x8b33('0x20')](function(_0x4a2165){if(_0x4a2165){_0xfd00c9[_0x8b33('0xa7')]=_[_0x8b33('0xa8')](_0x4a2165,['Contacts']);if(_0x4a2165[_0x8b33('0xa5')][_0x8b33('0x4c')]){return _0x4a2165[_0x8b33('0xa5')][0x0];}var _0x4af1c9=_[_0x8b33('0xa9')](_0xfd00c9[_0x8b33('0x65')],{'firstName':_0xfd00c9[_0x8b33('0x65')][_0x8b33('0x98')],'ListId':_0x4a2165['id']});_0x4af1c9[_0xfd00c9[_0x8b33('0x65')]['mapKey']]=_0xfd00c9['body'][_0x8b33('0x98')];return db[_0x8b33('0x8e')]['create'](_0x4af1c9,{'fields':_0x215e44,'raw':!![]});}})[_0x8b33('0x20')](handleEntityNotFound(_0x2a9409,null))['then'](function(_0x513b84){if(_0x513b84){_0xfd00c9['contact']=_0x513b84;var _0x4dd324={'ContactId':_0x513b84['id'],'phone':_0xfd00c9[_0x8b33('0x65')][_0x8b33('0x98')],'WhatsappAccountId':_0x4dcbad[_0x8b33('0x5a')]['id']};var _0x99a81f={'ContactId':_0x513b84['id'],'WhatsappAccountId':_0x4dcbad[_0x8b33('0x5a')]['id'],'closed':![]};return db[_0x8b33('0xaa')][_0x8b33('0x5c')]({'where':_0x99a81f})[_0x8b33('0x20')](function(_0x5a115d){if(_0x5a115d){return[_0x5a115d,![]];}return db[_0x8b33('0xaa')]['create'](_0x4dd324)[_0x8b33('0x20')](function(_0x49db35){return[_0x49db35,!![]];});});}})['spread'](function(_0x1a2c8a,_0x2f6875){_0xfd00c9[_0x8b33('0xab')]=_0x1a2c8a['get']({'plain':!![]});_0xfd00c9[_0x8b33('0xab')][_0x8b33('0xac')]=![];if(_0x2f6875){if(_0xfd00c9[_0x8b33('0x87')][_0x8b33('0xad')]){_0xfd00c9['applications'][_0x8b33('0xae')]({'id':0x0,'priority':_0xfd00c9['applications'][_0x8b33('0x4c')]+0x1,'app':_0x8b33('0xaf'),'appdata':_0x8b33('0xb0'),'interval':'*,*,*,*'});}_0xfd00c9[_0x8b33('0xab')][_0x8b33('0xac')]=!![];}return db[_0x8b33('0xb1')][_0x8b33('0x5d')]({'phone':_0xfd00c9['body']['from'],'messageId':_0xfd00c9[_0x8b33('0x65')][_0x8b33('0x9c')],'body':_0xfd00c9['body'][_0x8b33('0x65')],'WhatsappAccountId':_0x4dcbad[_0x8b33('0x5a')]['id'],'WhatsappInteractionId':_0x1a2c8a['id'],'direction':'in','ContactId':_0x1a2c8a[_0x8b33('0xb2')],'AttachmentId':_0xfd00c9[_0x8b33('0x65')][_0x8b33('0xb3')]});})['then'](function(_0x35b546){_0xfd00c9[_0x8b33('0x29')]=_0x35b546;if(!_0xfd00c9[_0x8b33('0xab')][_0x8b33('0xb4')])return;return db['User']['find']({'attributes':['id',_0x8b33('0x3c')],'where':{'id':_0xfd00c9['interaction'][_0x8b33('0xb4')]}});})['then'](function(_0x5436ed){if(_0x5436ed){_0xfd00c9[_0x8b33('0x8b')][_0x8b33('0xb5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5436ed[_0x8b33('0x3c')]+','+(_0xfd00c9[_0x8b33('0x87')][_0x8b33('0xb6')]||0xa),'interval':'*,*,*,*'});}if(!_0xfd00c9[_0x8b33('0xab')][_0x8b33('0xb7')])return;return db['WhatsappQueue'][_0x8b33('0x5c')]({'attributes':['id','name'],'where':{'id':_0xfd00c9[_0x8b33('0xab')][_0x8b33('0xb7')]}});})[_0x8b33('0x20')](function(_0x46ca64){if(_0x46ca64){_0xfd00c9[_0x8b33('0x8b')][_0x8b33('0xb5')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x46ca64[_0x8b33('0x3c')]+','+(_0xfd00c9[_0x8b33('0x87')][_0x8b33('0xb8')]||0x12c),'interval':_0x8b33('0xb9')});}return respondWithRpcPromise(_0x8b33('0xba'),'startRouting',_0xfd00c9);})['then'](function(_0x240f6b){if(_0x240f6b){var _0x2d4ac2=0xc8;var _0x5710b4='receiveMessage';logger['info'](_0x8b33('0x25'),_0x5710b4,_0x2d4ac2,_0x8b33('0xbb'));logger['debug'](_0x8b33('0xbc'),_0x5710b4,_0x2d4ac2,_0x8b33('0xbb'),JSON[_0x8b33('0x26')](_0x240f6b));if(_0xfd00c9[_0x8b33('0x87')][_0x8b33('0x43')]==='twilio'){return _0x2a9409['status'](_0x2d4ac2)[_0x8b33('0x33')]('Content-Type','text/xml')[_0x8b33('0x3d')](_0x8b33('0xbd'));}else{return _0x2a9409[_0x8b33('0x2c')](_0x2d4ac2)['json'](_0x240f6b);}}});})[_0x8b33('0x2b')](handleError(_0x2a9409,null));};exports[_0x8b33('0x3d')]=function(_0x4eaab3,_0x150571,_0x20f5f2){var _0x5e4b61,_0x15fa7f,_0x329cc3;if(_['isNil'](_0x4eaab3['body'][_0x8b33('0x65')])||_0x4eaab3['body'][_0x8b33('0x65')]===''){throw new db[(_0x8b33('0x8f'))][(_0x8b33('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4eaab3[_0x8b33('0x65')]['to'])){throw new db[(_0x8b33('0x8f'))][(_0x8b33('0x90'))](_0x8b33('0xbe'));}_0x5e4b61=_0x4eaab3[_0x8b33('0x65')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x4eaab3['params']['id']},'include':[{'model':db[_0x8b33('0xbf')],'as':'List','include':[{'model':db[_0x8b33('0x8e')],'as':_0x8b33('0xa5'),'where':{'mobile':_0x5e4b61},'limit':0x1,'order':[[_0x8b33('0x94'),_0x8b33('0xa6')]]}]}]})[_0x8b33('0x20')](handleEntityNotFound(_0x150571,null))['then'](function(_0x1aa74b){if(_0x1aa74b&&_0x1aa74b[_0x8b33('0xc0')]){_0x15fa7f=_0x1aa74b[_0x8b33('0x5f')]({'plain':!![]});if(_0x15fa7f[_0x8b33('0xc0')]&&_0x15fa7f[_0x8b33('0xc0')][_0x8b33('0xa5')][_0x8b33('0x4c')]){return _0x15fa7f[_0x8b33('0xc0')][_0x8b33('0xa5')][0x0];}return db[_0x8b33('0x8e')][_0x8b33('0x5d')](_['defaults'](_0x4eaab3[_0x8b33('0x65')],{'firstName':_0x5e4b61,'mobile':_0x5e4b61,'phone':_0x5e4b61,'ListId':_0x15fa7f[_0x8b33('0x96')]}));}})[_0x8b33('0x20')](handleEntityNotFound(_0x150571,null))[_0x8b33('0x20')](function(_0x577412){if(_0x577412){_0x329cc3=_0x577412;return db['WhatsappInteraction'][_0x8b33('0x5c')]({'where':{'ContactId':_0x329cc3['id'],'closed':![],'WhatsappAccountId':_0x15fa7f['id']}})[_0x8b33('0x20')](function(_0x126223){if(_0x126223){return[_0x126223,![]];}return db[_0x8b33('0xaa')][_0x8b33('0x5d')]({'UserId':_0x4eaab3[_0x8b33('0x5e')]['id'],'ContactId':_0x329cc3['id'],'WhatsappAccountId':_0x15fa7f['id'],'phone':_0x5e4b61,'firstMsgDirection':_0x8b33('0xc1'),'Messages':[_[_0x8b33('0x54')](_0x4eaab3[_0x8b33('0x65')],{'read':![],'body':_0x4eaab3[_0x8b33('0x65')][_0x8b33('0x65')],'phone':_0x5e4b61,'WhatsappAccountId':_0x15fa7f['id'],'UserId':_0x4eaab3['user']['id'],'ContactId':_0x329cc3['id']})]},{'include':[{'model':db[_0x8b33('0xb1')],'as':_0x8b33('0xc2')}]})['then'](function(_0x3c038f){return[_0x3c038f,!![]];});});}})[_0x8b33('0x72')](function(_0x2c3bdc,_0x223d65){if(_0x223d65){return _0x2c3bdc;}return db['WhatsappMessage'][_0x8b33('0x5d')](_[_0x8b33('0x54')](_0x4eaab3[_0x8b33('0x65')],{'read':![],'body':_0x4eaab3[_0x8b33('0x65')][_0x8b33('0x65')],'phone':_0x5e4b61,'WhatsappAccountId':_0x15fa7f['id'],'WhatsappInteractionId':_0x2c3bdc['id'],'UserId':_0x4eaab3['user']['id'],'ContactId':_0x329cc3['id']}))[_0x8b33('0x20')](function(_0x4debdd){_0x2c3bdc[_0x8b33('0xc3')]['Messages']=[];_0x2c3bdc[_0x8b33('0xc3')][_0x8b33('0xc2')][_0x8b33('0xae')](_0x4debdd[_0x8b33('0xc3')]);return _0x2c3bdc;});})[_0x8b33('0x20')](respondWithResult(_0x150571,null))[_0x8b33('0x2b')](handleError(_0x150571,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 81a2960..1c44f7a 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 _0xcb5a=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5b24d8,_0x3c5c58){var _0x1a3945=function(_0x4560fa){while(--_0x4560fa){_0x5b24d8['push'](_0x5b24d8['shift']());}};_0x1a3945(++_0x3c5c58);}(_0xcb5a,0xb4));var _0xacb5=function(_0x95b585,_0x282d1b){_0x95b585=_0x95b585-0x0;var _0x4c3d88=_0xcb5a[_0x95b585];return _0x4c3d88;};'use strict';var EventEmitter=require(_0xacb5('0x0'));var WhatsappAccount=require(_0xacb5('0x1'))['db'][_0xacb5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xacb5('0x3')](0x0);var events={'afterCreate':_0xacb5('0x4'),'afterUpdate':_0xacb5('0x5'),'afterDestroy':_0xacb5('0x6')};function emitEvent(_0x47d7d7){return function(_0x21e834,_0x4470b4,_0x598171){WhatsappAccountEvents[_0xacb5('0x7')](_0x47d7d7+':'+_0x21e834['id'],_0x21e834);WhatsappAccountEvents['emit'](_0x47d7d7,_0x21e834);_0x598171(null);};}for(var e in events){if(events[_0xacb5('0x8')](e)){var event=events[e];WhatsappAccount[_0xacb5('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xb517=['update','emit','hasOwnProperty','exports','../../mysqldb','WhatsappAccount','save'];(function(_0x17c7be,_0x5e6d74){var _0x362961=function(_0xf28fbd){while(--_0xf28fbd){_0x17c7be['push'](_0x17c7be['shift']());}};_0x362961(++_0x5e6d74);}(_0xb517,0x1bd));var _0x7b51=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xb517[_0xfcbcb8];return _0x1b1f97;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x7b51('0x0'))['db'][_0x7b51('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7b51('0x2'),'afterUpdate':_0x7b51('0x3'),'afterDestroy':'remove'};function emitEvent(_0x191c76){return function(_0x1e2ce9,_0xa4dad2,_0x451c27){WhatsappAccountEvents[_0x7b51('0x4')](_0x191c76+':'+_0x1e2ce9['id'],_0x1e2ce9);WhatsappAccountEvents['emit'](_0x191c76,_0x1e2ce9);_0x451c27(null);};}for(var e in events){if(events[_0x7b51('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x7b51('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 989ae22..138dfad 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 _0x70f8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x70f8,0xa8));var _0x870f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x70f8[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x870f('0x0'));var util=require('util');var logger=require(_0x870f('0x1'))(_0x870f('0x2'));var moment=require(_0x870f('0x3'));var BPromise=require(_0x870f('0x4'));var rp=require(_0x870f('0x5'));var fs=require('fs');var path=require(_0x870f('0x6'));var rimraf=require(_0x870f('0x7'));var config=require('../../config/environment');var attributes=require(_0x870f('0x8'));module[_0x870f('0x9')]=function(_0x58fdea,_0x24ccb4){return _0x58fdea[_0x870f('0xa')](_0x870f('0xb'),attributes,{'tableName':_0x870f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb754=['moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','util','api'];(function(_0x287ed8,_0x38a3b4){var _0x328647=function(_0x4ed843){while(--_0x4ed843){_0x287ed8['push'](_0x287ed8['shift']());}};_0x328647(++_0x38a3b4);}(_0xb754,0xe8));var _0x4b75=function(_0x4bc413,_0x4a5161){_0x4bc413=_0x4bc413-0x0;var _0x13910d=_0xb754[_0x4bc413];return _0x13910d;};'use strict';var _=require('lodash');var util=require(_0x4b75('0x0'));var logger=require('../../config/logger')(_0x4b75('0x1'));var moment=require(_0x4b75('0x2'));var BPromise=require(_0x4b75('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b75('0x4'));var rimraf=require(_0x4b75('0x5'));var config=require(_0x4b75('0x6'));var attributes=require(_0x4b75('0x7'));module['exports']=function(_0x1d09ec,_0x2a7664){return _0x1d09ec['define'](_0x4b75('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 8953fb5..2d51850 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 _0x2fbd=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','ShowWhatsappAccount','find','options','raw','where','include','map','model','attributes','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','request','WhatsappAccount,\x20%s,\x20%s'];(function(_0x5a3c0d,_0x29e892){var _0x232cba=function(_0x2c7a35){while(--_0x2c7a35){_0x5a3c0d['push'](_0x5a3c0d['shift']());}};_0x232cba(++_0x29e892);}(_0x2fbd,0x12c));var _0xd2fb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2fbd[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xd2fb('0x0'));var moment=require(_0xd2fb('0x1'));var BPromise=require(_0xd2fb('0x2'));var rs=require(_0xd2fb('0x3'));var fs=require('fs');var Redis=require(_0xd2fb('0x4'));var db=require(_0xd2fb('0x5'))['db'];var utils=require(_0xd2fb('0x6'));var logger=require(_0xd2fb('0x7'))(_0xd2fb('0x8'));var config=require(_0xd2fb('0x9'));var jayson=require(_0xd2fb('0xa'));var client=jayson['client'][_0xd2fb('0xb')]({'port':0x232a});config[_0xd2fb('0xc')]=_['defaults'](config[_0xd2fb('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2fb('0xc')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x56eead,_0x3f5af9,_0x4afc07){return new BPromise(function(_0x2a9bc6,_0x3f6729){return client[_0xd2fb('0xd')](_0x56eead,_0x4afc07)['then'](function(_0x2e6003){logger['info'](_0xd2fb('0xe'),_0x3f5af9,_0xd2fb('0xf'));logger[_0xd2fb('0x10')](_0xd2fb('0x11'),_0x3f5af9,_0xd2fb('0xf'),JSON[_0xd2fb('0x12')](_0x2e6003));if(_0x2e6003['error']){if(_0x2e6003['error'][_0xd2fb('0x13')]===0x1f4){logger[_0xd2fb('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x3f5af9,_0x2e6003[_0xd2fb('0x14')]['message']);return _0x3f6729(_0x2e6003[_0xd2fb('0x14')][_0xd2fb('0x15')]);}logger[_0xd2fb('0x14')](_0xd2fb('0xe'),_0x3f5af9,_0x2e6003['error'][_0xd2fb('0x15')]);return _0x2a9bc6(_0x2e6003[_0xd2fb('0x14')][_0xd2fb('0x15')]);}else{logger[_0xd2fb('0x16')](_0xd2fb('0xe'),_0x3f5af9,'request\x20sent');_0x2a9bc6(_0x2e6003[_0xd2fb('0x17')][_0xd2fb('0x15')]);}})[_0xd2fb('0x18')](function(_0x32d9dd){logger[_0xd2fb('0x14')](_0xd2fb('0xe'),_0x3f5af9,_0x32d9dd);_0x3f6729(_0x32d9dd);});});}exports[_0xd2fb('0x19')]=function(_0x48d8b1){var _0x30468f=this;return new Promise(function(_0x1563fe,_0x9ce408){return db['WhatsappAccount'][_0xd2fb('0x1a')]({'raw':_0x48d8b1[_0xd2fb('0x1b')]?_0x48d8b1[_0xd2fb('0x1b')][_0xd2fb('0x1c')]===undefined?!![]:![]:!![],'where':_0x48d8b1[_0xd2fb('0x1b')]?_0x48d8b1['options'][_0xd2fb('0x1d')]||null:null,'attributes':_0x48d8b1[_0xd2fb('0x1b')]?_0x48d8b1[_0xd2fb('0x1b')]['attributes']||null:null,'include':_0x48d8b1[_0xd2fb('0x1b')]?_0x48d8b1[_0xd2fb('0x1b')][_0xd2fb('0x1e')]?_[_0xd2fb('0x1f')](_0x48d8b1['options'][_0xd2fb('0x1e')],function(_0x5ee8ee){return{'model':db[_0x5ee8ee[_0xd2fb('0x20')]],'as':_0x5ee8ee['as'],'attributes':_0x5ee8ee[_0xd2fb('0x21')],'include':_0x5ee8ee['include']?_['map'](_0x5ee8ee[_0xd2fb('0x1e')],function(_0x24bddb){return{'model':db[_0x24bddb[_0xd2fb('0x20')]],'as':_0x24bddb['as'],'attributes':_0x24bddb['attributes'],'include':_0x24bddb['include']?_[_0xd2fb('0x1f')](_0x24bddb[_0xd2fb('0x1e')],function(_0x6bf6c3){return{'model':db[_0x6bf6c3[_0xd2fb('0x20')]],'as':_0x6bf6c3['as'],'attributes':_0x6bf6c3[_0xd2fb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd2fb('0x22')](function(_0x57c3b9){logger[_0xd2fb('0x16')](_0xd2fb('0x19'),_0x48d8b1);logger['debug']('ShowWhatsappAccount',_0x48d8b1,JSON[_0xd2fb('0x12')](_0x57c3b9));_0x1563fe(_0x57c3b9);})[_0xd2fb('0x18')](function(_0x2fed04){logger[_0xd2fb('0x14')]('ShowWhatsappAccount',_0x2fed04[_0xd2fb('0x15')],_0x48d8b1);_0x9ce408(_0x30468f[_0xd2fb('0x14')](0x1f4,_0x2fed04[_0xd2fb('0x15')]));});});}; \ No newline at end of file +var _0x2cdb=['options','raw','where','attributes','include','model','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x2cdb,0x15b));var _0xb2cd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2cdb[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb2cd('0x0'));var util=require(_0xb2cd('0x1'));var moment=require(_0xb2cd('0x2'));var BPromise=require('bluebird');var rs=require(_0xb2cd('0x3'));var fs=require('fs');var Redis=require(_0xb2cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2cd('0x5'));var logger=require(_0xb2cd('0x6'))(_0xb2cd('0x7'));var config=require(_0xb2cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb2cd('0x9')]=_[_0xb2cd('0xa')](config['redis'],{'host':_0xb2cd('0xb'),'port':0x18eb});var socket=require(_0xb2cd('0xc'))(new Redis(config['redis']));require(_0xb2cd('0xd'))['register'](socket);function respondWithRpcPromise(_0x20ba3e,_0x4ec676,_0x1ad5ab){return new BPromise(function(_0x311871,_0x3f3084){return client[_0xb2cd('0xe')](_0x20ba3e,_0x1ad5ab)[_0xb2cd('0xf')](function(_0x1a5376){logger[_0xb2cd('0x10')](_0xb2cd('0x11'),_0x4ec676,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4ec676,_0xb2cd('0x12'),JSON[_0xb2cd('0x13')](_0x1a5376));if(_0x1a5376[_0xb2cd('0x14')]){if(_0x1a5376[_0xb2cd('0x14')][_0xb2cd('0x15')]===0x1f4){logger[_0xb2cd('0x14')](_0xb2cd('0x11'),_0x4ec676,_0x1a5376['error']['message']);return _0x3f3084(_0x1a5376[_0xb2cd('0x14')][_0xb2cd('0x16')]);}logger[_0xb2cd('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x4ec676,_0x1a5376['error'][_0xb2cd('0x16')]);return _0x311871(_0x1a5376[_0xb2cd('0x14')][_0xb2cd('0x16')]);}else{logger[_0xb2cd('0x10')](_0xb2cd('0x11'),_0x4ec676,'request\x20sent');_0x311871(_0x1a5376[_0xb2cd('0x17')][_0xb2cd('0x16')]);}})[_0xb2cd('0x18')](function(_0x346ce5){logger[_0xb2cd('0x14')](_0xb2cd('0x11'),_0x4ec676,_0x346ce5);_0x3f3084(_0x346ce5);});});}exports[_0xb2cd('0x19')]=function(_0x1c13c9){var _0x30b585=this;return new Promise(function(_0x548598,_0x13e899){return db[_0xb2cd('0x1a')]['find']({'raw':_0x1c13c9[_0xb2cd('0x1b')]?_0x1c13c9[_0xb2cd('0x1b')][_0xb2cd('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c13c9['options']?_0x1c13c9['options'][_0xb2cd('0x1d')]||null:null,'attributes':_0x1c13c9[_0xb2cd('0x1b')]?_0x1c13c9[_0xb2cd('0x1b')][_0xb2cd('0x1e')]||null:null,'include':_0x1c13c9[_0xb2cd('0x1b')]?_0x1c13c9['options'][_0xb2cd('0x1f')]?_['map'](_0x1c13c9[_0xb2cd('0x1b')][_0xb2cd('0x1f')],function(_0x3da01f){return{'model':db[_0x3da01f[_0xb2cd('0x20')]],'as':_0x3da01f['as'],'attributes':_0x3da01f[_0xb2cd('0x1e')],'include':_0x3da01f[_0xb2cd('0x1f')]?_[_0xb2cd('0x21')](_0x3da01f[_0xb2cd('0x1f')],function(_0x136fcc){return{'model':db[_0x136fcc['model']],'as':_0x136fcc['as'],'attributes':_0x136fcc[_0xb2cd('0x1e')],'include':_0x136fcc[_0xb2cd('0x1f')]?_['map'](_0x136fcc['include'],function(_0x1e8178){return{'model':db[_0x1e8178['model']],'as':_0x1e8178['as'],'attributes':_0x1e8178[_0xb2cd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb2cd('0xf')](function(_0x59f61d){logger[_0xb2cd('0x10')](_0xb2cd('0x19'),_0x1c13c9);logger['debug']('ShowWhatsappAccount',_0x1c13c9,JSON[_0xb2cd('0x13')](_0x59f61d));_0x548598(_0x59f61d);})[_0xb2cd('0x18')](function(_0x27de04){logger[_0xb2cd('0x14')]('ShowWhatsappAccount',_0x27de04[_0xb2cd('0x16')],_0x1c13c9);_0x13e899(_0x30b585[_0xb2cd('0x14')](0x1f4,_0x27de04['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4d77961..9c8c922 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 _0x4d17=['removeListener','register','length','./whatsappAccount.events','remove','update','emit'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4d17,0x16f));var _0x74d1=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0x4d17[_0x5e5c4c];return _0x176148;};'use strict';var WhatsappAccountEvents=require(_0x74d1('0x0'));var events=['save',_0x74d1('0x1'),_0x74d1('0x2')];function createListener(_0x28880c,_0x442a1d){return function(_0x1d12cb){_0x442a1d[_0x74d1('0x3')](_0x28880c,_0x1d12cb);};}function removeListener(_0x13d910,_0x4928e8){return function(){WhatsappAccountEvents[_0x74d1('0x4')](_0x13d910,_0x4928e8);};}exports[_0x74d1('0x5')]=function(_0x3e61c8){for(var _0x3d107a=0x0,_0x9ec6d8=events[_0x74d1('0x6')];_0x3d107a<_0x9ec6d8;_0x3d107a++){var _0xbf0c66=events[_0x3d107a];var _0x288d7d=createListener('whatsappAccount:'+_0xbf0c66,_0x3e61c8);WhatsappAccountEvents['on'](_0xbf0c66,_0x288d7d);}}; \ No newline at end of file +var _0xb2d8=['./whatsappAccount.events','remove','removeListener','register','whatsappAccount:'];(function(_0x407b07,_0x525c69){var _0x2c9b12=function(_0x54b368){while(--_0x54b368){_0x407b07['push'](_0x407b07['shift']());}};_0x2c9b12(++_0x525c69);}(_0xb2d8,0x6e));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0x8b2d('0x0'));var events=['save',_0x8b2d('0x1'),'update'];function createListener(_0x57b36c,_0x4bd521){return function(_0x4391f0){_0x4bd521['emit'](_0x57b36c,_0x4391f0);};}function removeListener(_0x537e53,_0x5c49dd){return function(){WhatsappAccountEvents[_0x8b2d('0x2')](_0x537e53,_0x5c49dd);};}exports[_0x8b2d('0x3')]=function(_0x3ebe90){for(var _0x188477=0x0,_0x217c80=events['length'];_0x188477<_0x217c80;_0x188477++){var _0xcea391=events[_0x188477];var _0x340ec3=createListener(_0x8b2d('0x4')+_0xcea391,_0x3ebe90);WhatsappAccountEvents['on'](_0xcea391,_0x340ec3);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index edebbb1..7417cd8 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 _0xdb28=['delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x19f8ee,_0x3e08c2){var _0x3b68f2=function(_0x1f0f13){while(--_0x1f0f13){_0x19f8ee['push'](_0x19f8ee['shift']());}};_0x3b68f2(++_0x3e08c2);}(_0xdb28,0xc9));var _0x8db2=function(_0x220c51,_0x3a8553){_0x220c51=_0x220c51-0x0;var _0x32ec38=_0xdb28[_0x220c51];return _0x32ec38;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8db2('0x2')]();var fs_extra=require(_0x8db2('0x3'));var auth=require(_0x8db2('0x4'));var interaction=require(_0x8db2('0x5'));var config=require('../../config/environment');var controller=require(_0x8db2('0x6'));router[_0x8db2('0x7')]('/',auth[_0x8db2('0x8')](),controller[_0x8db2('0x9')]);router['get'](_0x8db2('0xa'),auth[_0x8db2('0x8')](),controller[_0x8db2('0xb')]);router['post']('/',auth[_0x8db2('0x8')](),controller[_0x8db2('0xc')]);router[_0x8db2('0xd')](_0x8db2('0xa'),auth[_0x8db2('0x8')](),controller[_0x8db2('0xe')]);router[_0x8db2('0xf')](_0x8db2('0xa'),auth[_0x8db2('0x8')](),controller[_0x8db2('0x10')]);module[_0x8db2('0x11')]=router; \ No newline at end of file +var _0x8448=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x4e0bc3,_0x1c8d67){var _0x5764b1=function(_0x49a211){while(--_0x49a211){_0x4e0bc3['push'](_0x4e0bc3['shift']());}};_0x5764b1(++_0x1c8d67);}(_0x8448,0x9e));var _0x8844=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x8448[_0x16938f];return _0x5c66e9;};'use strict';var multer=require(_0x8844('0x0'));var util=require(_0x8844('0x1'));var path=require('path');var timeout=require(_0x8844('0x2'));var express=require(_0x8844('0x3'));var router=express[_0x8844('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8844('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8844('0x6'));var controller=require(_0x8844('0x7'));router[_0x8844('0x8')]('/',auth[_0x8844('0x9')](),controller[_0x8844('0xa')]);router[_0x8844('0x8')](_0x8844('0xb'),auth[_0x8844('0x9')](),controller['show']);router[_0x8844('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8844('0xd')](_0x8844('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8844('0xe')]('/:id',auth[_0x8844('0x9')](),controller[_0x8844('0xf')]);module[_0x8844('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b4610fb..86b55e0 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 _0xa19c=['exports','STRING','noop','TEXT','sequelize'];(function(_0x506c4c,_0x6cc5df){var _0x4165d6=function(_0x2d4ca2){while(--_0x2d4ca2){_0x506c4c['push'](_0x506c4c['shift']());}};_0x4165d6(++_0x6cc5df);}(_0xa19c,0x1bc));var _0xca19=function(_0x381563,_0x4e1f8a){_0x381563=_0x381563-0x0;var _0x5255e3=_0xa19c[_0x381563];return _0x5255e3;};'use strict';var Sequelize=require(_0xca19('0x0'));module[_0xca19('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xca19('0x2')],'allowNull':![],'defaultValue':_0xca19('0x3')},'appdata':{'type':Sequelize[_0xca19('0x4')]()},'description':{'type':Sequelize[_0xca19('0x2')]},'interval':{'type':Sequelize[_0xca19('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd079=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0x1858d6,_0x1b0c23){var _0x5cff88=function(_0x599e32){while(--_0x599e32){_0x1858d6['push'](_0x1858d6['shift']());}};_0x5cff88(++_0x1b0c23);}(_0xd079,0x1a5));var _0x9d07=function(_0x1a5004,_0x352c70){_0x1a5004=_0x1a5004-0x0;var _0x20621a=_0xd079[_0x1a5004];return _0x20621a;};'use strict';var Sequelize=require(_0x9d07('0x0'));module[_0x9d07('0x1')]={'priority':{'type':Sequelize[_0x9d07('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9d07('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9d07('0x4')]},'interval':{'type':Sequelize[_0x9d07('0x4')],'defaultValue':_0x9d07('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 985c122..1549d5c 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 _0x2deb=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','intersection','include','create','body','find'];(function(_0x4bb435,_0x323d73){var _0x596175=function(_0x4f23f9){while(--_0x4f23f9){_0x4bb435['push'](_0x4bb435['shift']());}};_0x596175(++_0x323d73);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb2de('0x0'));var rimraf=require(_0xb2de('0x1'));var zipdir=require(_0xb2de('0x2'));var jsonpatch=require(_0xb2de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb2de('0x4'));var Mustache=require(_0xb2de('0x5'));var util=require(_0xb2de('0x6'));var path=require(_0xb2de('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2de('0x8'));var fs=require('fs');var fs_extra=require(_0xb2de('0x9'));var _=require(_0xb2de('0xa'));var squel=require('squel');var crypto=require(_0xb2de('0xb'));var jsforce=require(_0xb2de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb2de('0xd'));var querystring=require(_0xb2de('0xe'));var Papa=require(_0xb2de('0xf'));var Redis=require('ioredis');var authService=require(_0xb2de('0x10'));var qs=require(_0xb2de('0x11'));var as=require(_0xb2de('0x12'));var hardwareService=require(_0xb2de('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb2de('0x14'));var config=require(_0xb2de('0x15'));var licenseUtil=require(_0xb2de('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e2237,_0x343024){_0x343024=_0x343024||0xcc;return function(_0xec4373){if(_0xec4373){return _0x1e2237['sendStatus'](_0x343024);}return _0x1e2237[_0xb2de('0x17')](_0x343024)['end']();};}function respondWithResult(_0x160d61,_0x4feb90){_0x4feb90=_0x4feb90||0xc8;return function(_0x10ef21){if(_0x10ef21){return _0x160d61[_0xb2de('0x17')](_0x4feb90)[_0xb2de('0x18')](_0x10ef21);}};}function respondWithFilteredResult(_0x5a1f02,_0x209429){return function(_0x40f29d){if(_0x40f29d){var _0x2dc98f=typeof _0x209429[_0xb2de('0x19')]===_0xb2de('0x1a')&&typeof _0x209429[_0xb2de('0x1b')]===_0xb2de('0x1a');var _0x2db287=_0x40f29d[_0xb2de('0x1c')];var _0x5d06ac=_0x2dc98f?0x0:_0x209429[_0xb2de('0x19')];var _0x53d213=_0x2dc98f?_0x40f29d[_0xb2de('0x1c')]:_0x209429[_0xb2de('0x19')]+_0x209429['limit'];var _0x2fbe63;if(_0x53d213>=_0x2db287){_0x53d213=_0x2db287;_0x2fbe63=0xc8;}else{_0x2fbe63=0xce;}_0x5a1f02[_0xb2de('0x17')](_0x2fbe63);return _0x5a1f02['set'](_0xb2de('0x1d'),_0x5d06ac+'-'+_0x53d213+'/'+_0x2db287)[_0xb2de('0x18')](_0x40f29d);}return null;};}function patchUpdates(_0x34b228){return function(_0x148c91){try{jsonpatch[_0xb2de('0x1e')](_0x148c91,_0x34b228,!![]);}catch(_0x3014b9){return BPromise[_0xb2de('0x1f')](_0x3014b9);}return _0x148c91[_0xb2de('0x20')]();};}function saveUpdates(_0x20d7f8,_0x506a50){return function(_0x280644){if(_0x280644){return _0x280644[_0xb2de('0x21')](_0x20d7f8)[_0xb2de('0x22')](function(_0xa97fb4){return _0xa97fb4;});}return null;};}function removeEntity(_0x521e47,_0x55051f){return function(_0x102da8){if(_0x102da8){return _0x102da8[_0xb2de('0x23')]()[_0xb2de('0x22')](function(){_0x521e47['status'](0xcc)[_0xb2de('0x24')]();});}};}function handleEntityNotFound(_0x1cc2db,_0x4a6d12){return function(_0x16c249){if(!_0x16c249){_0x1cc2db['sendStatus'](0x194);}return _0x16c249;};}function handleError(_0x2d9fd1,_0xd6693f){_0xd6693f=_0xd6693f||0x1f4;return function(_0x1c8eaf){logger[_0xb2de('0x25')](_0x1c8eaf[_0xb2de('0x26')]);if(_0x1c8eaf[_0xb2de('0x27')]){delete _0x1c8eaf['name'];}_0x2d9fd1[_0xb2de('0x17')](_0xd6693f)['send'](_0x1c8eaf);};}exports[_0xb2de('0x28')]=function(_0x5c74e6,_0x579d6c){var _0x3ed36e={},_0x4269ab={},_0x345e20={'count':0x0,'rows':[]};var _0x1b6c37=_[_0xb2de('0x29')](db[_0xb2de('0x2a')][_0xb2de('0x2b')],function(_0x88f02){return{'name':_0x88f02[_0xb2de('0x2c')],'type':_0x88f02[_0xb2de('0x2d')][_0xb2de('0x2e')]};});_0x4269ab[_0xb2de('0x2f')]=_['map'](_0x1b6c37,_0xb2de('0x27'));_0x4269ab[_0xb2de('0x30')]=_['keys'](_0x5c74e6[_0xb2de('0x30')]);_0x4269ab[_0xb2de('0x31')]=_['intersection'](_0x4269ab[_0xb2de('0x2f')],_0x4269ab[_0xb2de('0x30')]);_0x3ed36e[_0xb2de('0x32')]=_['intersection'](_0x4269ab[_0xb2de('0x2f')],qs[_0xb2de('0x33')](_0x5c74e6[_0xb2de('0x30')][_0xb2de('0x33')]));_0x3ed36e[_0xb2de('0x32')]=_0x3ed36e[_0xb2de('0x32')][_0xb2de('0x34')]?_0x3ed36e[_0xb2de('0x32')]:_0x4269ab[_0xb2de('0x2f')];if(!_0x5c74e6[_0xb2de('0x30')][_0xb2de('0x35')]('nolimit')){_0x3ed36e[_0xb2de('0x1b')]=qs[_0xb2de('0x1b')](_0x5c74e6[_0xb2de('0x30')][_0xb2de('0x1b')]);_0x3ed36e[_0xb2de('0x19')]=qs[_0xb2de('0x19')](_0x5c74e6[_0xb2de('0x30')][_0xb2de('0x19')]);}_0x3ed36e[_0xb2de('0x36')]=qs[_0xb2de('0x37')](_0x5c74e6[_0xb2de('0x30')][_0xb2de('0x37')]);_0x3ed36e[_0xb2de('0x38')]=qs[_0xb2de('0x31')](_[_0xb2de('0x39')](_0x5c74e6['query'],_0x4269ab[_0xb2de('0x31')]),_0x1b6c37);if(_0x5c74e6['query'][_0xb2de('0x3a')]){_0x3ed36e[_0xb2de('0x38')]=_[_0xb2de('0x3b')](_0x3ed36e[_0xb2de('0x38')],{'$or':_[_0xb2de('0x29')](_0x1b6c37,function(_0x2cc362){if(_0x2cc362[_0xb2de('0x2d')]!==_0xb2de('0x3c')){var _0x24f53b={};_0x24f53b[_0x2cc362[_0xb2de('0x27')]]={'$like':'%'+_0x5c74e6[_0xb2de('0x30')][_0xb2de('0x3a')]+'%'};return _0x24f53b;}})});}_0x3ed36e=_[_0xb2de('0x3b')]({},_0x3ed36e,_0x5c74e6[_0xb2de('0x3d')]);var _0x3dc4c0={'where':_0x3ed36e['where']};return db[_0xb2de('0x2a')][_0xb2de('0x1c')](_0x3dc4c0)['then'](function(_0x317a31){_0x345e20[_0xb2de('0x1c')]=_0x317a31;if(_0x5c74e6[_0xb2de('0x30')][_0xb2de('0x3e')]){_0x3ed36e['include']=[{'all':!![]}];}return db[_0xb2de('0x2a')][_0xb2de('0x3f')](_0x3ed36e);})['then'](function(_0x47448a){_0x345e20[_0xb2de('0x40')]=_0x47448a;return _0x345e20;})['then'](respondWithFilteredResult(_0x579d6c,_0x3ed36e))[_0xb2de('0x41')](handleError(_0x579d6c,null));};exports['show']=function(_0x5f30cc,_0x29e9a0){var _0x5ad6cf={'raw':!![],'where':{'id':_0x5f30cc[_0xb2de('0x42')]['id']}},_0x514623={};_0x514623[_0xb2de('0x2f')]=_['keys'](db[_0xb2de('0x2a')][_0xb2de('0x2b')]);_0x514623[_0xb2de('0x30')]=_[_0xb2de('0x43')](_0x5f30cc['query']);_0x514623[_0xb2de('0x31')]=_[_0xb2de('0x44')](_0x514623[_0xb2de('0x2f')],_0x514623[_0xb2de('0x30')]);_0x5ad6cf[_0xb2de('0x32')]=_[_0xb2de('0x44')](_0x514623[_0xb2de('0x2f')],qs['fields'](_0x5f30cc[_0xb2de('0x30')][_0xb2de('0x33')]));_0x5ad6cf[_0xb2de('0x32')]=_0x5ad6cf['attributes'][_0xb2de('0x34')]?_0x5ad6cf['attributes']:_0x514623[_0xb2de('0x2f')];if(_0x5f30cc[_0xb2de('0x30')][_0xb2de('0x3e')]){_0x5ad6cf[_0xb2de('0x45')]=[{'all':!![]}];}_0x5ad6cf=_['merge']({},_0x5ad6cf,_0x5f30cc[_0xb2de('0x3d')]);return db[_0xb2de('0x2a')]['find'](_0x5ad6cf)['then'](handleEntityNotFound(_0x29e9a0,null))[_0xb2de('0x22')](respondWithResult(_0x29e9a0,null))[_0xb2de('0x41')](handleError(_0x29e9a0,null));};exports[_0xb2de('0x46')]=function(_0x3d16b6,_0x22caba){return db['WhatsappApplication'][_0xb2de('0x46')](_0x3d16b6['body'],{})[_0xb2de('0x22')](respondWithResult(_0x22caba,0xc9))['catch'](handleError(_0x22caba,null));};exports[_0xb2de('0x21')]=function(_0x3dca27,_0x4c52bc){if(_0x3dca27[_0xb2de('0x47')]['id']){delete _0x3dca27['body']['id'];}return db[_0xb2de('0x2a')][_0xb2de('0x48')]({'where':{'id':_0x3dca27[_0xb2de('0x42')]['id']}})[_0xb2de('0x22')](handleEntityNotFound(_0x4c52bc,null))['then'](saveUpdates(_0x3dca27[_0xb2de('0x47')],null))[_0xb2de('0x22')](respondWithResult(_0x4c52bc,null))[_0xb2de('0x41')](handleError(_0x4c52bc,null));};exports[_0xb2de('0x23')]=function(_0x2a7d51,_0x4a80c3){return db[_0xb2de('0x2a')][_0xb2de('0x48')]({'where':{'id':_0x2a7d51[_0xb2de('0x42')]['id']}})[_0xb2de('0x22')](handleEntityNotFound(_0x4a80c3,null))[_0xb2de('0x22')](removeEntity(_0x4a80c3,null))['catch'](handleError(_0x4a80c3,null));}; \ No newline at end of file +var _0x8b8e=['limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','then','rows','params','includeAll','catch','create','body','find','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x31fb92,_0x50ddeb){var _0x592731=function(_0x15d541){while(--_0x15d541){_0x31fb92['push'](_0x31fb92['shift']());}};_0x592731(++_0x50ddeb);}(_0x8b8e,0x108));var _0xe8b8=function(_0xb251c0,_0x526eac){_0xb251c0=_0xb251c0-0x0;var _0xf9372f=_0x8b8e[_0xb251c0];return _0xf9372f;};'use strict';var emlformat=require(_0xe8b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8b8('0x3'));var util=require(_0xe8b8('0x4'));var path=require(_0xe8b8('0x5'));var sox=require(_0xe8b8('0x6'));var csv=require(_0xe8b8('0x7'));var ejs=require(_0xe8b8('0x8'));var fs=require('fs');var fs_extra=require(_0xe8b8('0x9'));var _=require(_0xe8b8('0xa'));var squel=require(_0xe8b8('0xb'));var crypto=require(_0xe8b8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe8b8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe8b8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe8b8('0xf'));var qs=require(_0xe8b8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8b8('0x11'))(_0xe8b8('0x12'));var utils=require(_0xe8b8('0x13'));var config=require(_0xe8b8('0x14'));var licenseUtil=require(_0xe8b8('0x15'));var db=require(_0xe8b8('0x16'))['db'];function respondWithStatusCode(_0x3de76b,_0x11fb1a){_0x11fb1a=_0x11fb1a||0xcc;return function(_0x151e09){if(_0x151e09){return _0x3de76b[_0xe8b8('0x17')](_0x11fb1a);}return _0x3de76b[_0xe8b8('0x18')](_0x11fb1a)[_0xe8b8('0x19')]();};}function respondWithResult(_0x30bfc7,_0x43698d){_0x43698d=_0x43698d||0xc8;return function(_0x4a3e9f){if(_0x4a3e9f){return _0x30bfc7[_0xe8b8('0x18')](_0x43698d)['json'](_0x4a3e9f);}};}function respondWithFilteredResult(_0x282ea8,_0x290c30){return function(_0x288699){if(_0x288699){var _0x36df40=typeof _0x290c30[_0xe8b8('0x1a')]===_0xe8b8('0x1b')&&typeof _0x290c30[_0xe8b8('0x1c')]===_0xe8b8('0x1b');var _0x4110b6=_0x288699[_0xe8b8('0x1d')];var _0x504738=_0x36df40?0x0:_0x290c30[_0xe8b8('0x1a')];var _0xaba717=_0x36df40?_0x288699['count']:_0x290c30[_0xe8b8('0x1a')]+_0x290c30[_0xe8b8('0x1c')];var _0x2b2b80;if(_0xaba717>=_0x4110b6){_0xaba717=_0x4110b6;_0x2b2b80=0xc8;}else{_0x2b2b80=0xce;}_0x282ea8[_0xe8b8('0x18')](_0x2b2b80);return _0x282ea8[_0xe8b8('0x1e')](_0xe8b8('0x1f'),_0x504738+'-'+_0xaba717+'/'+_0x4110b6)[_0xe8b8('0x20')](_0x288699);}return null;};}function patchUpdates(_0x36c273){return function(_0x29e96){try{jsonpatch[_0xe8b8('0x21')](_0x29e96,_0x36c273,!![]);}catch(_0x3fdc80){return BPromise[_0xe8b8('0x22')](_0x3fdc80);}return _0x29e96[_0xe8b8('0x23')]();};}function saveUpdates(_0x15abeb,_0x35dc1d){return function(_0x838cd4){if(_0x838cd4){return _0x838cd4[_0xe8b8('0x24')](_0x15abeb)['then'](function(_0x57faf7){return _0x57faf7;});}return null;};}function removeEntity(_0x566721,_0x4769fe){return function(_0x51297e){if(_0x51297e){return _0x51297e[_0xe8b8('0x25')]()['then'](function(){_0x566721[_0xe8b8('0x18')](0xcc)[_0xe8b8('0x19')]();});}};}function handleEntityNotFound(_0x5e3fa2,_0x5ac435){return function(_0x19f7b3){if(!_0x19f7b3){_0x5e3fa2[_0xe8b8('0x17')](0x194);}return _0x19f7b3;};}function handleError(_0x56f459,_0x3ce9b2){_0x3ce9b2=_0x3ce9b2||0x1f4;return function(_0x32141f){logger[_0xe8b8('0x26')](_0x32141f[_0xe8b8('0x27')]);if(_0x32141f[_0xe8b8('0x28')]){delete _0x32141f['name'];}_0x56f459[_0xe8b8('0x18')](_0x3ce9b2)['send'](_0x32141f);};}exports[_0xe8b8('0x29')]=function(_0x402e6c,_0x28d703){var _0x390154={},_0x589877={},_0x50c1f6={'count':0x0,'rows':[]};var _0xc98ea8=_[_0xe8b8('0x2a')](db[_0xe8b8('0x2b')][_0xe8b8('0x2c')],function(_0x2f92a5){return{'name':_0x2f92a5['fieldName'],'type':_0x2f92a5[_0xe8b8('0x2d')][_0xe8b8('0x2e')]};});_0x589877[_0xe8b8('0x2f')]=_[_0xe8b8('0x2a')](_0xc98ea8,_0xe8b8('0x28'));_0x589877[_0xe8b8('0x30')]=_[_0xe8b8('0x31')](_0x402e6c[_0xe8b8('0x30')]);_0x589877[_0xe8b8('0x32')]=_[_0xe8b8('0x33')](_0x589877[_0xe8b8('0x2f')],_0x589877['query']);_0x390154[_0xe8b8('0x34')]=_[_0xe8b8('0x33')](_0x589877[_0xe8b8('0x2f')],qs['fields'](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x35')]));_0x390154[_0xe8b8('0x34')]=_0x390154[_0xe8b8('0x34')][_0xe8b8('0x36')]?_0x390154[_0xe8b8('0x34')]:_0x589877[_0xe8b8('0x2f')];if(!_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x37')]('nolimit')){_0x390154[_0xe8b8('0x1c')]=qs[_0xe8b8('0x1c')](_0x402e6c['query'][_0xe8b8('0x1c')]);_0x390154[_0xe8b8('0x1a')]=qs[_0xe8b8('0x1a')](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x1a')]);}_0x390154['order']=qs[_0xe8b8('0x38')](_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x38')]);_0x390154[_0xe8b8('0x39')]=qs[_0xe8b8('0x32')](_[_0xe8b8('0x3a')](_0x402e6c['query'],_0x589877[_0xe8b8('0x32')]),_0xc98ea8);if(_0x402e6c['query'][_0xe8b8('0x3b')]){_0x390154[_0xe8b8('0x39')]=_['merge'](_0x390154['where'],{'$or':_[_0xe8b8('0x2a')](_0xc98ea8,function(_0x1ae916){if(_0x1ae916[_0xe8b8('0x2d')]!==_0xe8b8('0x3c')){var _0x53a18d={};_0x53a18d[_0x1ae916[_0xe8b8('0x28')]]={'$like':'%'+_0x402e6c[_0xe8b8('0x30')][_0xe8b8('0x3b')]+'%'};return _0x53a18d;}})});}_0x390154=_[_0xe8b8('0x3d')]({},_0x390154,_0x402e6c[_0xe8b8('0x3e')]);var _0xecddc8={'where':_0x390154[_0xe8b8('0x39')]};return db[_0xe8b8('0x2b')]['count'](_0xecddc8)['then'](function(_0x2086fa){_0x50c1f6[_0xe8b8('0x1d')]=_0x2086fa;if(_0x402e6c[_0xe8b8('0x30')]['includeAll']){_0x390154[_0xe8b8('0x3f')]=[{'all':!![]}];}return db[_0xe8b8('0x2b')][_0xe8b8('0x40')](_0x390154);})[_0xe8b8('0x41')](function(_0x3fa8b2){_0x50c1f6[_0xe8b8('0x42')]=_0x3fa8b2;return _0x50c1f6;})[_0xe8b8('0x41')](respondWithFilteredResult(_0x28d703,_0x390154))['catch'](handleError(_0x28d703,null));};exports['show']=function(_0x4a851f,_0x16480b){var _0x1b553e={'raw':!![],'where':{'id':_0x4a851f[_0xe8b8('0x43')]['id']}},_0x1068eb={};_0x1068eb['model']=_[_0xe8b8('0x31')](db[_0xe8b8('0x2b')][_0xe8b8('0x2c')]);_0x1068eb[_0xe8b8('0x30')]=_['keys'](_0x4a851f['query']);_0x1068eb[_0xe8b8('0x32')]=_[_0xe8b8('0x33')](_0x1068eb[_0xe8b8('0x2f')],_0x1068eb['query']);_0x1b553e[_0xe8b8('0x34')]=_[_0xe8b8('0x33')](_0x1068eb[_0xe8b8('0x2f')],qs[_0xe8b8('0x35')](_0x4a851f['query'][_0xe8b8('0x35')]));_0x1b553e[_0xe8b8('0x34')]=_0x1b553e[_0xe8b8('0x34')][_0xe8b8('0x36')]?_0x1b553e[_0xe8b8('0x34')]:_0x1068eb[_0xe8b8('0x2f')];if(_0x4a851f[_0xe8b8('0x30')][_0xe8b8('0x44')]){_0x1b553e[_0xe8b8('0x3f')]=[{'all':!![]}];}_0x1b553e=_[_0xe8b8('0x3d')]({},_0x1b553e,_0x4a851f[_0xe8b8('0x3e')]);return db[_0xe8b8('0x2b')]['find'](_0x1b553e)['then'](handleEntityNotFound(_0x16480b,null))[_0xe8b8('0x41')](respondWithResult(_0x16480b,null))[_0xe8b8('0x45')](handleError(_0x16480b,null));};exports[_0xe8b8('0x46')]=function(_0x340880,_0xb78cdb){return db[_0xe8b8('0x2b')][_0xe8b8('0x46')](_0x340880['body'],{})['then'](respondWithResult(_0xb78cdb,0xc9))[_0xe8b8('0x45')](handleError(_0xb78cdb,null));};exports[_0xe8b8('0x24')]=function(_0x5f1e0c,_0x41a1d1){if(_0x5f1e0c[_0xe8b8('0x47')]['id']){delete _0x5f1e0c[_0xe8b8('0x47')]['id'];}return db[_0xe8b8('0x2b')][_0xe8b8('0x48')]({'where':{'id':_0x5f1e0c[_0xe8b8('0x43')]['id']}})[_0xe8b8('0x41')](handleEntityNotFound(_0x41a1d1,null))[_0xe8b8('0x41')](saveUpdates(_0x5f1e0c[_0xe8b8('0x47')],null))[_0xe8b8('0x41')](respondWithResult(_0x41a1d1,null))[_0xe8b8('0x45')](handleError(_0x41a1d1,null));};exports[_0xe8b8('0x25')]=function(_0x5a5322,_0x39f11e){return db['WhatsappApplication'][_0xe8b8('0x48')]({'where':{'id':_0x5a5322[_0xe8b8('0x43')]['id']}})[_0xe8b8('0x41')](handleEntityNotFound(_0x39f11e,null))[_0xe8b8('0x41')](removeEntity(_0x39f11e,null))['catch'](handleError(_0x39f11e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e7a1ae6..e64c750 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 _0x7250=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7250,0x1b1));var _0x0725=function(_0x2a75ae,_0x10720a){_0x2a75ae=_0x2a75ae-0x0;var _0x277e62=_0x7250[_0x2a75ae];return _0x277e62;};'use strict';var _=require(_0x0725('0x0'));var util=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var moment=require(_0x0725('0x3'));var BPromise=require(_0x0725('0x4'));var rp=require(_0x0725('0x5'));var fs=require('fs');var path=require(_0x0725('0x6'));var rimraf=require(_0x0725('0x7'));var config=require('../../config/environment');var attributes=require(_0x0725('0x8'));module['exports']=function(_0x4e8c6c,_0xa32c3f){return _0x4e8c6c['define'](_0x0725('0x9'),attributes,{'tableName':_0x0725('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0725('0xb')});}; \ No newline at end of file +var _0x1c9a=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0xa91791,_0x2bd125){_0xa91791=_0xa91791-0x0;var _0x19918e=_0x1c9a[_0xa91791];return _0x19918e;};'use strict';var _=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var logger=require('../../config/logger')(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var rp=require(_0xa1c9('0x5'));var fs=require('fs');var path=require(_0xa1c9('0x6'));var rimraf=require('rimraf');var config=require(_0xa1c9('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xa1c9('0x8')]=function(_0xdd22bf,_0x237862){return _0xdd22bf[_0xa1c9('0x9')](_0xa1c9('0xa'),attributes,{'tableName':_0xa1c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1c9('0xc'),'collate':_0xa1c9('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 4b1bbbe..f91d1d1 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 _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x3ba2d6,_0x4910cb){var _0x6f362a=function(_0x4ac813){while(--_0x4ac813){_0x3ba2d6['push'](_0x3ba2d6['shift']());}};_0x6f362a(++_0x4910cb);}(_0xb821,0xa7));var _0x1b82=function(_0x27fe9d,_0x1d4a28){_0x27fe9d=_0x27fe9d-0x0;var _0x3293f6=_0xb821[_0x27fe9d];return _0x3293f6;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','WhatsappApplication,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x4564fa,_0x37cba9){var _0x5ae568=function(_0x3b0a0e){while(--_0x3b0a0e){_0x4564fa['push'](_0x4564fa['shift']());}};_0x5ae568(++_0x37cba9);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d2616fe..22860b4 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 _0x06ae=['isAuthenticated','describe','/:id','/:id/download','post','/:id/messages','/:id/tags','tracked','whatsapp','addTags','put','update','whatsappinteraction:destroy','delete','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xe06a('0x0'));var path=require(_0xe06a('0x1'));var timeout=require(_0xe06a('0x2'));var express=require(_0xe06a('0x3'));var router=express[_0xe06a('0x4')]();var fs_extra=require(_0xe06a('0x5'));var auth=require(_0xe06a('0x6'));var interaction=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe06a('0x9')]);router[_0xe06a('0xa')](_0xe06a('0xb'),auth[_0xe06a('0xc')](),controller[_0xe06a('0xd')]);router['get'](_0xe06a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xe06a('0xa')]('/:id/messages',auth[_0xe06a('0xc')](),controller['getMessages']);router['get'](_0xe06a('0xf'),auth[_0xe06a('0xc')](),controller['download']);router[_0xe06a('0x10')]('/',auth[_0xe06a('0xc')](),controller['create']);router[_0xe06a('0x10')](_0xe06a('0x11'),auth[_0xe06a('0xc')](),controller['addMessage']);router[_0xe06a('0x10')](_0xe06a('0x12'),auth[_0xe06a('0xc')](),interaction[_0xe06a('0x13')](_0xe06a('0x14'),'whatsappinteraction:addtags'),controller[_0xe06a('0x15')]);router[_0xe06a('0x16')](_0xe06a('0xe'),auth[_0xe06a('0xc')](),interaction[_0xe06a('0x13')](_0xe06a('0x14'),'whatsappinteraction:update'),controller[_0xe06a('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xe06a('0x13')](_0xe06a('0x14'),_0xe06a('0x18')),controller['destroy']);router[_0xe06a('0x19')](_0xe06a('0x12'),auth['isAuthenticated'](),controller[_0xe06a('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb091=['./whatsappInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x5b83c0,_0x157769){var _0x3416fc=function(_0x366391){while(--_0x366391){_0x5b83c0['push'](_0x5b83c0['shift']());}};_0x3416fc(++_0x157769);}(_0xb091,0x16e));var _0x1b09=function(_0x30d5f9,_0x2abb74){_0x30d5f9=_0x30d5f9-0x0;var _0x425ebd=_0xb091[_0x30d5f9];return _0x425ebd;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/describe',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0x9')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0x9')]('/:id/download',auth[_0x1b09('0x7')](),controller[_0x1b09('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1b09('0x10')]);router[_0x1b09('0x11')](_0x1b09('0xd'),auth[_0x1b09('0x7')](),controller[_0x1b09('0x12')]);router[_0x1b09('0x11')](_0x1b09('0x13'),auth['isAuthenticated'](),interaction[_0x1b09('0x14')]('whatsapp',_0x1b09('0x15')),controller[_0x1b09('0x16')]);router[_0x1b09('0x17')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),interaction[_0x1b09('0x14')](_0x1b09('0x18'),_0x1b09('0x19')),controller[_0x1b09('0x1a')]);router[_0x1b09('0x1b')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),interaction[_0x1b09('0x14')]('whatsapp',_0x1b09('0x1c')),controller[_0x1b09('0x1d')]);router['delete']('/:id/tags',auth[_0x1b09('0x7')](),controller['removeTags']);module[_0x1b09('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0a0015f..2ae1218 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 _0x5b6e=['DATE','ENUM','out','INTEGER','sequelize','moment','BOOLEAN','STRING'];(function(_0x456be1,_0x248c6e){var _0x43fa66=function(_0x8c0df9){while(--_0x8c0df9){_0x456be1['push'](_0x456be1['shift']());}};_0x43fa66(++_0x248c6e);}(_0x5b6e,0x14c));var _0xe5b6=function(_0x4efb1b,_0x4b4cb0){_0x4efb1b=_0x4efb1b-0x0;var _0x10a4ff=_0x5b6e[_0x4efb1b];return _0x10a4ff;};'use strict';var Sequelize=require(_0xe5b6('0x0'));var moment=require(_0xe5b6('0x1'));module['exports']={'closed':{'type':Sequelize[_0xe5b6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe5b6('0x3')]},'secondDisposition':{'type':Sequelize[_0xe5b6('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe5b6('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe5b6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe5b6('0x5')]('in',_0xe5b6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe5b6('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe5b6('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe5b6('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe5b6('0x7')]}}; \ No newline at end of file +var _0x3609=['DATE','STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN'];(function(_0x1c4530,_0x3671cf){var _0x2139df=function(_0xad99ad){while(--_0xad99ad){_0x1c4530['push'](_0x1c4530['shift']());}};_0x2139df(++_0x3671cf);}(_0x3609,0x101));var _0x9360=function(_0xf096e4,_0x1d0c4c){_0xf096e4=_0xf096e4-0x0;var _0x33c61f=_0x3609[_0xf096e4];return _0x33c61f;};'use strict';var Sequelize=require(_0x9360('0x0'));var moment=require(_0x9360('0x1'));module[_0x9360('0x2')]={'closed':{'type':Sequelize[_0x9360('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9360('0x4')]},'disposition':{'type':Sequelize[_0x9360('0x5')]},'secondDisposition':{'type':Sequelize[_0x9360('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9360('0x5')]},'phone':{'type':Sequelize[_0x9360('0x5')]},'read1stAt':{'type':Sequelize[_0x9360('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9360('0x6')]('in',_0x9360('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9360('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b4e059a..4b1d823 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 _0x129f=['findOne','keys','rawAttributes','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','User','CmContact','Contact','firstName','Attachment','Messages','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','N.A.','createdAt','closed','closedAt','disposition','basename','existsSync','direction','out','System','lastName','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','err','rimraf','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','then','destroy','error','stack','name','index','map','WhatsappInteraction','key','getOptions','findAll','whatsapp','query','user','catch','show','params','filters','intersection','model','attributes','fields','length','includeAll','include','merge','create','body','find','describe','addMessage','WhatsappMessage','omit','ids'];(function(_0x4fadaf,_0x179d85){var _0x4738a8=function(_0x34ce7b){while(--_0x34ce7b){_0x4fadaf['push'](_0x4fadaf['shift']());}};_0x4738a8(++_0x179d85);}(_0x129f,0x13f));var _0xf129=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x129f[_0x2d7f0e];return _0x110b07;};'use strict';var rimraf=require(_0xf129('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xf129('0x1'));var util=require(_0xf129('0x2'));var path=require(_0xf129('0x3'));var ejs=require(_0xf129('0x4'));var fs=require('fs');var _=require(_0xf129('0x5'));var Redis=require(_0xf129('0x6'));var interaction=require(_0xf129('0x7'));var qs=require(_0xf129('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xf129('0x9'))(_0xf129('0xa'));var config=require(_0xf129('0xb'));var db=require(_0xf129('0xc'))['db'];config['redis']=_['defaults'](config[_0xf129('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf129('0xe'))(new Redis(config[_0xf129('0xd')]));require(_0xf129('0xf'))[_0xf129('0x10')](socket);function respondWithStatusCode(_0x6171ed,_0x4fed21){_0x4fed21=_0x4fed21||0xcc;return function(_0x3e5859){if(_0x3e5859){return _0x6171ed[_0xf129('0x11')](_0x4fed21);}return _0x6171ed[_0xf129('0x12')](_0x4fed21)['end']();};}function respondWithResult(_0x22db94,_0x2d83d6){_0x2d83d6=_0x2d83d6||0xc8;return function(_0x4704fc){if(_0x4704fc){return _0x22db94['status'](_0x2d83d6)[_0xf129('0x13')](_0x4704fc);}};}function respondWithFilteredResult(_0x216dbc,_0x1cd6c9){return function(_0x4feb3b){if(_0x4feb3b){var _0x197f50=typeof _0x1cd6c9[_0xf129('0x14')]==='undefined'&&typeof _0x1cd6c9[_0xf129('0x15')]==='undefined';var _0x33d20f=_0x4feb3b[_0xf129('0x16')];var _0x566327=_0x197f50?0x0:_0x1cd6c9['offset'];var _0xcb63c4=_0x197f50?_0x4feb3b[_0xf129('0x16')]:_0x1cd6c9['offset']+_0x1cd6c9[_0xf129('0x15')];var _0x1d0eaa;if(_0xcb63c4>=_0x33d20f){_0xcb63c4=_0x33d20f;_0x1d0eaa=0xc8;}else{_0x1d0eaa=0xce;}_0x216dbc['status'](_0x1d0eaa);return _0x216dbc[_0xf129('0x17')](_0xf129('0x18'),_0x566327+'-'+_0xcb63c4+'/'+_0x33d20f)[_0xf129('0x13')](_0x4feb3b);}return null;};}function saveUpdates(_0x44f3b8){return function(_0x58dff4){if(_0x58dff4){return _0x58dff4['update'](_0x44f3b8)[_0xf129('0x19')](function(_0x2c684e){return _0x2c684e;});}return null;};}function removeEntity(_0x87334c){return function(_0xbaa68c){if(_0xbaa68c){return _0xbaa68c[_0xf129('0x1a')]()[_0xf129('0x19')](function(){_0x87334c[_0xf129('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11852d){return function(_0x5b4133){if(!_0x5b4133){_0x11852d['sendStatus'](0x194);}return _0x5b4133;};}function handleError(_0x5b0fff,_0x380d1c){_0x380d1c=_0x380d1c||0x1f4;return function(_0x876b93){logger[_0xf129('0x1b')](_0x876b93[_0xf129('0x1c')]);if(_0x876b93[_0xf129('0x1d')]){delete _0x876b93[_0xf129('0x1d')];}_0x5b0fff[_0xf129('0x12')](_0x380d1c)['send'](_0x876b93);};}exports[_0xf129('0x1e')]=function(_0x3d099a,_0xa859a1){var _0x5dce81={};var _0x2de3c2=_[_0xf129('0x1f')](db[_0xf129('0x20')]['rawAttributes'],function(_0x8cb2fe){return{'name':_0x8cb2fe['fieldName'],'type':_0x8cb2fe['type'][_0xf129('0x21')]};});_0x5dce81=qs[_0xf129('0x22')](_0x2de3c2,_0x3d099a);return interaction[_0xf129('0x23')](_0xf129('0x24'),_0x3d099a[_0xf129('0x25')],_0x3d099a[_0xf129('0x26')],_0x5dce81,_0x2de3c2)[_0xf129('0x19')](respondWithFilteredResult(_0xa859a1,_0x5dce81))[_0xf129('0x27')](handleError(_0xa859a1,null));};exports[_0xf129('0x28')]=function(_0x58ad4f,_0x19225a){var _0x391fe6={'raw':![],'where':{'id':_0x58ad4f[_0xf129('0x29')]['id']}},_0xaf4806={};_0xaf4806['model']=_['keys'](db[_0xf129('0x20')]['rawAttributes']);_0xaf4806[_0xf129('0x25')]=_['keys'](_0x58ad4f[_0xf129('0x25')]);_0xaf4806[_0xf129('0x2a')]=_[_0xf129('0x2b')](_0xaf4806[_0xf129('0x2c')],_0xaf4806[_0xf129('0x25')]);_0x391fe6[_0xf129('0x2d')]=_[_0xf129('0x2b')](_0xaf4806[_0xf129('0x2c')],qs[_0xf129('0x2e')](_0x58ad4f['query'][_0xf129('0x2e')]));_0x391fe6['attributes']=_0x391fe6[_0xf129('0x2d')][_0xf129('0x2f')]?_0x391fe6[_0xf129('0x2d')]:_0xaf4806['model'];if(_0x58ad4f[_0xf129('0x25')][_0xf129('0x30')]){_0x391fe6[_0xf129('0x31')]=[{'all':!![]}];}_0x391fe6=_[_0xf129('0x32')]({},_0x391fe6,_0x58ad4f['options']);return db['WhatsappInteraction']['find'](_0x391fe6)[_0xf129('0x19')](handleEntityNotFound(_0x19225a,null))['then'](respondWithResult(_0x19225a,null))[_0xf129('0x27')](handleError(_0x19225a,null));};exports[_0xf129('0x33')]=function(_0x16e89d,_0x4569f7){return db[_0xf129('0x20')][_0xf129('0x33')](_0x16e89d['body'],{})['then'](respondWithResult(_0x4569f7,0xc9))[_0xf129('0x27')](handleError(_0x4569f7,null));};exports['update']=function(_0x1a2e9,_0x27bf8f){if(_0x1a2e9['body']['id']){delete _0x1a2e9[_0xf129('0x34')]['id'];}return db[_0xf129('0x20')][_0xf129('0x35')]({'where':{'id':_0x1a2e9[_0xf129('0x29')]['id']}})[_0xf129('0x19')](handleEntityNotFound(_0x27bf8f,null))['then'](saveUpdates(_0x1a2e9[_0xf129('0x34')],null))[_0xf129('0x19')](respondWithResult(_0x27bf8f,null))[_0xf129('0x27')](handleError(_0x27bf8f,null));};exports[_0xf129('0x1a')]=function(_0x2a8a37,_0x308876){return db[_0xf129('0x20')][_0xf129('0x35')]({'where':{'id':_0x2a8a37[_0xf129('0x29')]['id']}})[_0xf129('0x19')](handleEntityNotFound(_0x308876,null))[_0xf129('0x19')](removeEntity(_0x308876,null))[_0xf129('0x27')](handleError(_0x308876,null));};exports['describe']=function(_0x47d42c,_0x537555){return db[_0xf129('0x20')][_0xf129('0x36')]()['then'](respondWithResult(_0x537555,null))[_0xf129('0x27')](handleError(_0x537555,null));};exports[_0xf129('0x37')]=function(_0x4f70d0,_0x1f9456){return db[_0xf129('0x38')][_0xf129('0x35')]({'where':{'id':_0x4f70d0['params']['id']}})['then'](handleEntityNotFound(_0x1f9456,null))['then'](function(_0x534bea){if(_0x534bea){return _0x534bea[_0xf129('0x37')](_0x4f70d0[_0xf129('0x34')]['ids'],_[_0xf129('0x39')](_0x4f70d0[_0xf129('0x34')],[_0xf129('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x1f9456,null))[_0xf129('0x27')](handleError(_0x1f9456,null));};exports['getMessages']=function(_0xc8b393,_0x1973f3){var _0x556599={'raw':![],'where':{}};var _0xd155b5={};var _0x30e7f7={'count':0x0,'rows':[]};return db[_0xf129('0x20')][_0xf129('0x3b')]({'where':{'id':_0xc8b393[_0xf129('0x29')]['id']}})[_0xf129('0x19')](handleEntityNotFound(_0x1973f3,null))[_0xf129('0x19')](function(_0x553510){if(_0x553510){_0xd155b5['model']=_[_0xf129('0x3c')](db[_0xf129('0x38')][_0xf129('0x3d')]);_0xd155b5[_0xf129('0x25')]=_[_0xf129('0x3c')](_0xc8b393[_0xf129('0x25')]);_0xd155b5[_0xf129('0x2a')]=_[_0xf129('0x2b')](_0xd155b5[_0xf129('0x2c')],_0xd155b5[_0xf129('0x25')]);_0x556599[_0xf129('0x2d')]=_['intersection'](_0xd155b5['model'],qs[_0xf129('0x2e')](_0xc8b393['query'][_0xf129('0x2e')]));_0x556599[_0xf129('0x2d')]=_0x556599[_0xf129('0x2d')][_0xf129('0x2f')]?_0x556599[_0xf129('0x2d')]:_0xd155b5[_0xf129('0x2c')];if(!_0xc8b393[_0xf129('0x25')][_0xf129('0x3e')](_0xf129('0x3f'))){_0x556599[_0xf129('0x15')]=qs[_0xf129('0x15')](_0xc8b393[_0xf129('0x25')][_0xf129('0x15')]);_0x556599[_0xf129('0x14')]=qs['offset'](_0xc8b393['query'][_0xf129('0x14')]);}_0x556599[_0xf129('0x40')]=qs[_0xf129('0x41')](_0xc8b393[_0xf129('0x25')][_0xf129('0x41')]);_0x556599[_0xf129('0x42')]=qs[_0xf129('0x2a')](_[_0xf129('0x43')](_0xc8b393[_0xf129('0x25')],_0xd155b5[_0xf129('0x2a')]));_0x556599[_0xf129('0x42')][_0xf129('0x44')]=_0x553510['id'];if(_0xc8b393[_0xf129('0x25')][_0xf129('0x45')]){_0x556599[_0xf129('0x42')]=_[_0xf129('0x32')](_0x556599[_0xf129('0x42')],{'$or':_[_0xf129('0x1f')](_0x556599['attributes'],function(_0x2c482d){var _0x4e9dea={};_0x4e9dea[_0x2c482d]={'$like':'%'+_0xc8b393[_0xf129('0x25')][_0xf129('0x45')]+'%'};return _0x4e9dea;})});}if(_0xc8b393[_0xf129('0x25')]['$gte']){var _0x487648=_0xc8b393[_0xf129('0x25')][_0xf129('0x46')][_0xf129('0x47')](',');var _0xdd3c6a={};_0xdd3c6a[_0x487648[0x0]]={'$gte':moment(_0x487648[0x1])[_0xf129('0x48')](_0xf129('0x49'))};_0x556599[_0xf129('0x42')]=_[_0xf129('0x32')](_0x556599[_0xf129('0x42')],_0xdd3c6a);}_0x556599=_[_0xf129('0x32')]({},_0x556599,_0xc8b393[_0xf129('0x4a')]);return db[_0xf129('0x38')][_0xf129('0x16')]({'where':_0x556599[_0xf129('0x42')]})[_0xf129('0x19')](function(_0x50eebd){_0x30e7f7[_0xf129('0x16')]=_0x50eebd;if(_0xc8b393[_0xf129('0x25')][_0xf129('0x30')]){_0x556599[_0xf129('0x31')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xf129('0x23')](_0x556599);})['then'](function(_0x3b3807){_0x30e7f7[_0xf129('0x4b')]=_0x3b3807;return _0x30e7f7;});}})[_0xf129('0x19')](respondWithFilteredResult(_0x1973f3,_0x556599))['catch'](handleError(_0x1973f3,null));};exports[_0xf129('0x4c')]=function(_0x3646fa,_0x52b658){return db['WhatsappInteraction'][_0xf129('0x35')]({'where':{'id':_0x3646fa[_0xf129('0x29')]['id']}})['then'](handleEntityNotFound(_0x52b658,null))[_0xf129('0x19')](function(_0x5e2a6e){if(_0x5e2a6e){return _0x5e2a6e[_0xf129('0x4d')](_0x3646fa['body']['ids'],_[_0xf129('0x39')](_0x3646fa[_0xf129('0x34')],['ids','id'])||{})[_0xf129('0x4e')](function(){return db[_0xf129('0x4f')][_0xf129('0x23')]({'attributes':['id','name','color'],'where':{'id':_0x3646fa[_0xf129('0x34')][_0xf129('0x3a')]}});})[_0xf129('0x19')](function(_0x4be180){socket[_0xf129('0x50')](_0xf129('0x51'),{'id':Number(_0x3646fa['params']['id']),'tags':_0x4be180||[]});return{'id':Number(_0x3646fa[_0xf129('0x29')]['id']),'tags':_0x4be180||[]};});}})[_0xf129('0x19')](respondWithResult(_0x52b658,null))[_0xf129('0x27')](handleError(_0x52b658,null));};exports[_0xf129('0x52')]=function(_0x28978c,_0x325fe0){return db[_0xf129('0x20')][_0xf129('0x35')]({'where':{'id':_0x28978c[_0xf129('0x29')]['id']}})[_0xf129('0x19')](handleEntityNotFound(_0x325fe0,null))[_0xf129('0x19')](function(_0x2a6e3f){if(_0x2a6e3f){return _0x2a6e3f[_0xf129('0x52')](_0x28978c[_0xf129('0x25')]['ids']);}})['then'](respondWithStatusCode(_0x325fe0,null))['catch'](handleError(_0x325fe0,null));};exports[_0xf129('0x53')]=function(_0x16f713,_0xc460a7){var _0x4c21cd=moment()[_0xf129('0x54')]()[_0xf129('0x55')]();var _0x480dcc=path[_0xf129('0x56')](config[_0xf129('0x57')],_0xf129('0x58'),_0xf129('0x59'),_0xf129('0x5a'));var _0x22f881=path[_0xf129('0x56')](config[_0xf129('0x57')],_0xf129('0x58'),'files',_0xf129('0x5b'));var _0x16a0c8=path['join'](_0x480dcc,_0x4c21cd);var _0x3fef8a=util['format']('transcript-%d-%s.zip',_0x16f713[_0xf129('0x29')]['id'],_0x4c21cd);var _0x1e3f97=path[_0xf129('0x56')](_0x480dcc,_0x3fef8a);var _0x4023cc=[];_0x4023cc[_0xf129('0x5c')]({'model':db[_0xf129('0x5d')],'as':_0xf129('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x4023cc['push']({'model':db[_0xf129('0x5e')],'as':_0xf129('0x5f'),'attributes':['id',_0xf129('0x60'),'lastName'],'raw':!![]});if(_0x16f713[_0xf129('0x25')][_0xf129('0x5b')]){_0x4023cc[_0xf129('0x5c')]({'model':db[_0xf129('0x61')],'as':'Attachment','raw':!![]});}var _0x3f2b71=[{'model':db[_0xf129('0x38')],'as':_0xf129('0x62'),'attributes':['id',_0xf129('0x34'),'createdAt','direction','secret','read'],'include':_0x4023cc}];_0x3f2b71[_0xf129('0x5c')]({'model':db[_0xf129('0x63')],'as':_0xf129('0x64'),'attributes':['id',_0xf129('0x1d')]});_0x3f2b71[_0xf129('0x5c')]({'model':db['User'],'as':_0xf129('0x65'),'attributes':['id',_0xf129('0x66')]});return db[_0xf129('0x20')][_0xf129('0x35')]({'where':{'id':_0x16f713[_0xf129('0x29')]['id']},'include':_0x3f2b71})['then'](handleEntityNotFound(_0xc460a7,null))[_0xf129('0x19')](function(_0xd4797e){if(_0xd4797e){var _0x552682=_0xd4797e[_0xf129('0x67')]({'plain':!![]});fs[_0xf129('0x68')](_0x16a0c8);var _0x41f0cb={'channel':'Whatsapp','account':_0x552682[_0xf129('0x64')][_0xf129('0x1d')],'agent':_0x552682['Owner']?_0x552682[_0xf129('0x65')]['fullname']:_0xf129('0x69'),'createdAt':moment(_0x552682[_0xf129('0x6a')])[_0xf129('0x48')](_0xf129('0x49'))[_0xf129('0x55')](),'closedAt':_0x552682[_0xf129('0x6b')]?moment(_0x552682[_0xf129('0x6c')])[_0xf129('0x48')](_0xf129('0x49'))['toString']():'','disposition':_0x552682[_0xf129('0x6d')],'messages':_(_0x552682[_0xf129('0x62')])[_0xf129('0x45')]({'secret':![]})[_0xf129('0x1f')](function(_0x5b29e3){if(_0x5b29e3['Attachment']){var _0x380746=path[_0xf129('0x56')](_0x22f881,_0x5b29e3[_0xf129('0x61')][_0xf129('0x6e')]);if(fs[_0xf129('0x6f')](_0x380746)){fs['createReadStream'](_0x380746)['pipe'](fs['createWriteStream'](path[_0xf129('0x56')](_0x16a0c8,_0x5b29e3[_0xf129('0x61')][_0xf129('0x6e')])));}}return{'date':moment(_0x5b29e3[_0xf129('0x6a')])[_0xf129('0x48')](_0xf129('0x49'))[_0xf129('0x55')](),'sender':_0x5b29e3[_0xf129('0x70')]===_0xf129('0x71')?_0x5b29e3[_0xf129('0x5d')]?_0x5b29e3[_0xf129('0x5d')][_0xf129('0x66')]:_0xf129('0x72'):_0x5b29e3[_0xf129('0x5f')][_0xf129('0x60')]+(_0x5b29e3[_0xf129('0x5f')][_0xf129('0x73')]?'\x20'+_0x5b29e3['Contact']['lastName']:''),'body':_0x5b29e3[_0xf129('0x61')]?_0x5b29e3[_0xf129('0x61')][_0xf129('0x6e')]:_0x5b29e3[_0xf129('0x34')],'direction':_0x5b29e3['direction']===_0xf129('0x71')?'A':'C','secret':_0x5b29e3[_0xf129('0x74')],'read':_0x5b29e3[_0xf129('0x75')],'attachment':_0x5b29e3['Attachment']};})[_0xf129('0x76')]()};return ejs[_0xf129('0x77')](path[_0xf129('0x56')](config[_0xf129('0x57')],'server',_0xf129('0x78'),_0xf129('0x79')),{'interaction':_0x41f0cb})[_0xf129('0x19')](function(_0x42ad51){var _0x2e3488=path[_0xf129('0x56')](_0x16a0c8,_0xf129('0x7a')+_0x552682['id']+'-'+_0x4c21cd+'.pdf');var _0x41e6cb={'path':_0x2e3488,'channel':_0xf129('0x7b'),'interactionId':_0x552682['id']};return pdf[_0xf129('0x7c')](_0x42ad51,_0x41e6cb);})[_0xf129('0x19')](function(){return new BPromise(function(_0x1853b3,_0xd12b53){zipdir(_0x16a0c8,{'saveTo':_0x1e3f97},function(_0x1b1372,_0x562c2e){if(_0x1b1372)return _0xd12b53(_0x1b1372);return _0x1853b3(_0x562c2e);});})[_0xf129('0x19')](function(){return new BPromise(function(_0x20ae8d,_0x52102e){rimraf(_0x16a0c8,function(_0x228722){if(_0x228722)_0x52102e(_0x228722);return _0x20ae8d();});});})['then'](function(){return _0xc460a7[_0xf129('0x53')](_0x1e3f97,_0x3fef8a,function(_0x3caf8a){if(_0x3caf8a){console['log'](_0xf129('0x7d'),_0x3caf8a);}else{fs['unlinkSync'](_0x1e3f97);}});});});}else{return _0xc460a7[_0xf129('0x11')](0xc8);}})[_0xf129('0x27')](handleError(_0xc460a7,null));}; \ No newline at end of file +var _0x371f=['./whatsappInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then','end','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','query','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','addMessage','WhatsappMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','push','CmContact','Contact','lastName','Attachment','Messages','direction','read','WhatsappAccount','User','Owner','fullname','get','mkdirSync','Whatsapp','Account','N.A.','closed','disposition','basename','createReadStream','pipe','createWriteStream','out','System','firstName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','util','lodash','ioredis','../../components/export/pdf','api','redis','defaults','socket.io-emitter'];(function(_0x2ff9a,_0x4d2e32){var _0xb3382f=function(_0x2913f0){while(--_0x2913f0){_0x2ff9a['push'](_0x2ff9a['shift']());}};_0xb3382f(++_0x4d2e32);}(_0x371f,0x169));var _0xf371=function(_0x54efaa,_0x3d2841){_0x54efaa=_0x54efaa-0x0;var _0x57b791=_0x371f[_0x54efaa];return _0x57b791;};'use strict';var rimraf=require(_0xf371('0x0'));var zipdir=require(_0xf371('0x1'));var moment=require('moment');var BPromise=require(_0xf371('0x2'));var util=require(_0xf371('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf371('0x4'));var Redis=require(_0xf371('0x5'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xf371('0x6'));var logger=require('../../config/logger')(_0xf371('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf371('0x8')]=_[_0xf371('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf371('0xa'))(new Redis(config['redis']));require(_0xf371('0xb'))[_0xf371('0xc')](socket);function respondWithStatusCode(_0x205e34,_0x292d87){_0x292d87=_0x292d87||0xcc;return function(_0x491026){if(_0x491026){return _0x205e34[_0xf371('0xd')](_0x292d87);}return _0x205e34[_0xf371('0xe')](_0x292d87)['end']();};}function respondWithResult(_0x211a8c,_0x48badb){_0x48badb=_0x48badb||0xc8;return function(_0x268a9d){if(_0x268a9d){return _0x211a8c[_0xf371('0xe')](_0x48badb)['json'](_0x268a9d);}};}function respondWithFilteredResult(_0x21901a,_0x4d84c4){return function(_0x5b4994){if(_0x5b4994){var _0x51dcd4=typeof _0x4d84c4[_0xf371('0xf')]===_0xf371('0x10')&&typeof _0x4d84c4[_0xf371('0x11')]==='undefined';var _0x16fd04=_0x5b4994[_0xf371('0x12')];var _0x1f680b=_0x51dcd4?0x0:_0x4d84c4[_0xf371('0xf')];var _0x27a7a7=_0x51dcd4?_0x5b4994[_0xf371('0x12')]:_0x4d84c4[_0xf371('0xf')]+_0x4d84c4[_0xf371('0x11')];var _0xb33afc;if(_0x27a7a7>=_0x16fd04){_0x27a7a7=_0x16fd04;_0xb33afc=0xc8;}else{_0xb33afc=0xce;}_0x21901a[_0xf371('0xe')](_0xb33afc);return _0x21901a['set'](_0xf371('0x13'),_0x1f680b+'-'+_0x27a7a7+'/'+_0x16fd04)[_0xf371('0x14')](_0x5b4994);}return null;};}function saveUpdates(_0x2f6efb){return function(_0x8c1fa8){if(_0x8c1fa8){return _0x8c1fa8[_0xf371('0x15')](_0x2f6efb)[_0xf371('0x16')](function(_0x1941de){return _0x1941de;});}return null;};}function removeEntity(_0x28a243){return function(_0x482fee){if(_0x482fee){return _0x482fee['destroy']()['then'](function(){_0x28a243[_0xf371('0xe')](0xcc)[_0xf371('0x17')]();});}};}function handleEntityNotFound(_0x31972e){return function(_0x5f140c){if(!_0x5f140c){_0x31972e['sendStatus'](0x194);}return _0x5f140c;};}function handleError(_0x1dd9b8,_0x1a9943){_0x1a9943=_0x1a9943||0x1f4;return function(_0x5b4e8c){logger[_0xf371('0x18')](_0x5b4e8c[_0xf371('0x19')]);if(_0x5b4e8c[_0xf371('0x1a')]){delete _0x5b4e8c['name'];}_0x1dd9b8['status'](_0x1a9943)[_0xf371('0x1b')](_0x5b4e8c);};}exports[_0xf371('0x1c')]=function(_0x1d8f03,_0x43f6e9){var _0x37ea82={};var _0x5a48bb=_[_0xf371('0x1d')](db[_0xf371('0x1e')][_0xf371('0x1f')],function(_0x3f07e8){return{'name':_0x3f07e8['fieldName'],'type':_0x3f07e8[_0xf371('0x20')][_0xf371('0x21')]};});_0x37ea82=qs[_0xf371('0x22')](_0x5a48bb,_0x1d8f03);return interaction[_0xf371('0x23')]('whatsapp',_0x1d8f03[_0xf371('0x24')],_0x1d8f03['user'],_0x37ea82,_0x5a48bb)[_0xf371('0x16')](respondWithFilteredResult(_0x43f6e9,_0x37ea82))['catch'](handleError(_0x43f6e9,null));};exports[_0xf371('0x25')]=function(_0x4ae2ed,_0x592a1a){var _0x192d8d={'raw':![],'where':{'id':_0x4ae2ed[_0xf371('0x26')]['id']}},_0x26cea2={};_0x26cea2[_0xf371('0x27')]=_[_0xf371('0x28')](db[_0xf371('0x1e')]['rawAttributes']);_0x26cea2[_0xf371('0x24')]=_[_0xf371('0x28')](_0x4ae2ed[_0xf371('0x24')]);_0x26cea2['filters']=_[_0xf371('0x29')](_0x26cea2[_0xf371('0x27')],_0x26cea2[_0xf371('0x24')]);_0x192d8d[_0xf371('0x2a')]=_[_0xf371('0x29')](_0x26cea2[_0xf371('0x27')],qs[_0xf371('0x2b')](_0x4ae2ed[_0xf371('0x24')][_0xf371('0x2b')]));_0x192d8d[_0xf371('0x2a')]=_0x192d8d['attributes'][_0xf371('0x2c')]?_0x192d8d['attributes']:_0x26cea2[_0xf371('0x27')];if(_0x4ae2ed[_0xf371('0x24')][_0xf371('0x2d')]){_0x192d8d[_0xf371('0x2e')]=[{'all':!![]}];}_0x192d8d=_[_0xf371('0x2f')]({},_0x192d8d,_0x4ae2ed[_0xf371('0x30')]);return db[_0xf371('0x1e')][_0xf371('0x31')](_0x192d8d)['then'](handleEntityNotFound(_0x592a1a,null))[_0xf371('0x16')](respondWithResult(_0x592a1a,null))[_0xf371('0x32')](handleError(_0x592a1a,null));};exports[_0xf371('0x33')]=function(_0x390356,_0x13d5ed){return db[_0xf371('0x1e')][_0xf371('0x33')](_0x390356['body'],{})[_0xf371('0x16')](respondWithResult(_0x13d5ed,0xc9))[_0xf371('0x32')](handleError(_0x13d5ed,null));};exports[_0xf371('0x15')]=function(_0x24e9dc,_0x4be7e2){if(_0x24e9dc[_0xf371('0x34')]['id']){delete _0x24e9dc['body']['id'];}return db[_0xf371('0x1e')]['find']({'where':{'id':_0x24e9dc['params']['id']}})['then'](handleEntityNotFound(_0x4be7e2,null))[_0xf371('0x16')](saveUpdates(_0x24e9dc[_0xf371('0x34')],null))[_0xf371('0x16')](respondWithResult(_0x4be7e2,null))[_0xf371('0x32')](handleError(_0x4be7e2,null));};exports['destroy']=function(_0x3cbf07,_0x1f43ec){return db[_0xf371('0x1e')][_0xf371('0x31')]({'where':{'id':_0x3cbf07['params']['id']}})[_0xf371('0x16')](handleEntityNotFound(_0x1f43ec,null))[_0xf371('0x16')](removeEntity(_0x1f43ec,null))[_0xf371('0x32')](handleError(_0x1f43ec,null));};exports['describe']=function(_0x2af5f2,_0x58ce54){return db['WhatsappInteraction']['describe']()[_0xf371('0x16')](respondWithResult(_0x58ce54,null))[_0xf371('0x32')](handleError(_0x58ce54,null));};exports[_0xf371('0x35')]=function(_0x1ed8f1,_0x123422){return db[_0xf371('0x36')][_0xf371('0x31')]({'where':{'id':_0x1ed8f1[_0xf371('0x26')]['id']}})[_0xf371('0x16')](handleEntityNotFound(_0x123422,null))[_0xf371('0x16')](function(_0x9c025a){if(_0x9c025a){return _0x9c025a['addMessage'](_0x1ed8f1['body'][_0xf371('0x37')],_[_0xf371('0x38')](_0x1ed8f1[_0xf371('0x34')],[_0xf371('0x37'),'id'])||{});}})['then'](respondWithResult(_0x123422,null))[_0xf371('0x32')](handleError(_0x123422,null));};exports[_0xf371('0x39')]=function(_0x19aa41,_0x1b2f23){var _0x34b732={'raw':![],'where':{}};var _0x34cc55={};var _0x4fd6b7={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x19aa41['params']['id']}})[_0xf371('0x16')](handleEntityNotFound(_0x1b2f23,null))[_0xf371('0x16')](function(_0x3bb861){if(_0x3bb861){_0x34cc55[_0xf371('0x27')]=_[_0xf371('0x28')](db['WhatsappMessage'][_0xf371('0x1f')]);_0x34cc55['query']=_[_0xf371('0x28')](_0x19aa41['query']);_0x34cc55[_0xf371('0x3a')]=_[_0xf371('0x29')](_0x34cc55[_0xf371('0x27')],_0x34cc55[_0xf371('0x24')]);_0x34b732[_0xf371('0x2a')]=_[_0xf371('0x29')](_0x34cc55[_0xf371('0x27')],qs[_0xf371('0x2b')](_0x19aa41[_0xf371('0x24')][_0xf371('0x2b')]));_0x34b732[_0xf371('0x2a')]=_0x34b732[_0xf371('0x2a')][_0xf371('0x2c')]?_0x34b732[_0xf371('0x2a')]:_0x34cc55[_0xf371('0x27')];if(!_0x19aa41['query'][_0xf371('0x3b')](_0xf371('0x3c'))){_0x34b732[_0xf371('0x11')]=qs[_0xf371('0x11')](_0x19aa41[_0xf371('0x24')][_0xf371('0x11')]);_0x34b732[_0xf371('0xf')]=qs[_0xf371('0xf')](_0x19aa41[_0xf371('0x24')]['offset']);}_0x34b732[_0xf371('0x3d')]=qs[_0xf371('0x3e')](_0x19aa41[_0xf371('0x24')]['sort']);_0x34b732[_0xf371('0x3f')]=qs[_0xf371('0x3a')](_[_0xf371('0x40')](_0x19aa41[_0xf371('0x24')],_0x34cc55['filters']));_0x34b732[_0xf371('0x3f')][_0xf371('0x41')]=_0x3bb861['id'];if(_0x19aa41[_0xf371('0x24')]['filter']){_0x34b732['where']=_[_0xf371('0x2f')](_0x34b732[_0xf371('0x3f')],{'$or':_[_0xf371('0x1d')](_0x34b732[_0xf371('0x2a')],function(_0x50a827){var _0x35b26b={};_0x35b26b[_0x50a827]={'$like':'%'+_0x19aa41[_0xf371('0x24')][_0xf371('0x42')]+'%'};return _0x35b26b;})});}if(_0x19aa41[_0xf371('0x24')]['$gte']){var _0x32412f=_0x19aa41['query'][_0xf371('0x43')][_0xf371('0x44')](',');var _0x69acf9={};_0x69acf9[_0x32412f[0x0]]={'$gte':moment(_0x32412f[0x1])['format'](_0xf371('0x45'))};_0x34b732[_0xf371('0x3f')]=_[_0xf371('0x2f')](_0x34b732[_0xf371('0x3f')],_0x69acf9);}_0x34b732=_['merge']({},_0x34b732,_0x19aa41['options']);return db[_0xf371('0x36')]['count']({'where':_0x34b732['where']})['then'](function(_0x29110e){_0x4fd6b7['count']=_0x29110e;if(_0x19aa41[_0xf371('0x24')]['includeAll']){_0x34b732[_0xf371('0x2e')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xf371('0x23')](_0x34b732);})[_0xf371('0x16')](function(_0x30a3f1){_0x4fd6b7[_0xf371('0x46')]=_0x30a3f1;return _0x4fd6b7;});}})[_0xf371('0x16')](respondWithFilteredResult(_0x1b2f23,_0x34b732))[_0xf371('0x32')](handleError(_0x1b2f23,null));};exports[_0xf371('0x47')]=function(_0x2daec2,_0x2b8cc9){return db[_0xf371('0x1e')][_0xf371('0x31')]({'where':{'id':_0x2daec2['params']['id']}})[_0xf371('0x16')](handleEntityNotFound(_0x2b8cc9,null))[_0xf371('0x16')](function(_0x1e092b){if(_0x1e092b){return _0x1e092b[_0xf371('0x48')](_0x2daec2['body']['ids'],_[_0xf371('0x38')](_0x2daec2[_0xf371('0x34')],['ids','id'])||{})[_0xf371('0x49')](function(){return db[_0xf371('0x4a')]['findAll']({'attributes':['id',_0xf371('0x1a'),_0xf371('0x4b')],'where':{'id':_0x2daec2[_0xf371('0x34')][_0xf371('0x37')]}});})[_0xf371('0x16')](function(_0x4debad){socket[_0xf371('0x4c')](_0xf371('0x4d'),{'id':Number(_0x2daec2[_0xf371('0x26')]['id']),'tags':_0x4debad||[]});return{'id':Number(_0x2daec2[_0xf371('0x26')]['id']),'tags':_0x4debad||[]};});}})['then'](respondWithResult(_0x2b8cc9,null))['catch'](handleError(_0x2b8cc9,null));};exports[_0xf371('0x4e')]=function(_0x25f753,_0x2c5e82){return db['WhatsappInteraction']['find']({'where':{'id':_0x25f753[_0xf371('0x26')]['id']}})[_0xf371('0x16')](handleEntityNotFound(_0x2c5e82,null))[_0xf371('0x16')](function(_0xa504f5){if(_0xa504f5){return _0xa504f5['removeTags'](_0x25f753[_0xf371('0x24')][_0xf371('0x37')]);}})[_0xf371('0x16')](respondWithStatusCode(_0x2c5e82,null))['catch'](handleError(_0x2c5e82,null));};exports[_0xf371('0x4f')]=function(_0x7891e5,_0x1d481b){var _0x4854f1=moment()[_0xf371('0x50')]()[_0xf371('0x51')]();var _0x111660=path[_0xf371('0x52')](config['root'],_0xf371('0x53'),_0xf371('0x54'),_0xf371('0x55'));var _0x1b5b28=path[_0xf371('0x52')](config[_0xf371('0x56')],_0xf371('0x53'),_0xf371('0x54'),_0xf371('0x57'));var _0x197a49=path['join'](_0x111660,_0x4854f1);var _0xf1d641=util[_0xf371('0x58')](_0xf371('0x59'),_0x7891e5[_0xf371('0x26')]['id'],_0x4854f1);var _0x4e1d68=path[_0xf371('0x52')](_0x111660,_0xf1d641);var _0x31b557=[];_0x31b557[_0xf371('0x5a')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x31b557[_0xf371('0x5a')]({'model':db[_0xf371('0x5b')],'as':_0xf371('0x5c'),'attributes':['id','firstName',_0xf371('0x5d')],'raw':!![]});if(_0x7891e5[_0xf371('0x24')]['attachments']){_0x31b557[_0xf371('0x5a')]({'model':db['Attachment'],'as':_0xf371('0x5e'),'raw':!![]});}var _0x4e7045=[{'model':db[_0xf371('0x36')],'as':_0xf371('0x5f'),'attributes':['id',_0xf371('0x34'),'createdAt',_0xf371('0x60'),'secret',_0xf371('0x61')],'include':_0x31b557}];_0x4e7045['push']({'model':db[_0xf371('0x62')],'as':'Account','attributes':['id',_0xf371('0x1a')]});_0x4e7045[_0xf371('0x5a')]({'model':db[_0xf371('0x63')],'as':_0xf371('0x64'),'attributes':['id',_0xf371('0x65')]});return db[_0xf371('0x1e')][_0xf371('0x31')]({'where':{'id':_0x7891e5[_0xf371('0x26')]['id']},'include':_0x4e7045})[_0xf371('0x16')](handleEntityNotFound(_0x1d481b,null))[_0xf371('0x16')](function(_0x18eb6e){if(_0x18eb6e){var _0xea44bd=_0x18eb6e[_0xf371('0x66')]({'plain':!![]});fs[_0xf371('0x67')](_0x197a49);var _0x335df7={'channel':_0xf371('0x68'),'account':_0xea44bd[_0xf371('0x69')][_0xf371('0x1a')],'agent':_0xea44bd['Owner']?_0xea44bd[_0xf371('0x64')][_0xf371('0x65')]:_0xf371('0x6a'),'createdAt':moment(_0xea44bd['createdAt'])[_0xf371('0x58')](_0xf371('0x45'))[_0xf371('0x51')](),'closedAt':_0xea44bd[_0xf371('0x6b')]?moment(_0xea44bd['closedAt'])[_0xf371('0x58')](_0xf371('0x45'))['toString']():'','disposition':_0xea44bd[_0xf371('0x6c')],'messages':_(_0xea44bd[_0xf371('0x5f')])['filter']({'secret':![]})[_0xf371('0x1d')](function(_0x21dfb9){if(_0x21dfb9[_0xf371('0x5e')]){var _0x297468=path[_0xf371('0x52')](_0x1b5b28,_0x21dfb9[_0xf371('0x5e')][_0xf371('0x6d')]);if(fs['existsSync'](_0x297468)){fs[_0xf371('0x6e')](_0x297468)[_0xf371('0x6f')](fs[_0xf371('0x70')](path[_0xf371('0x52')](_0x197a49,_0x21dfb9[_0xf371('0x5e')][_0xf371('0x6d')])));}}return{'date':moment(_0x21dfb9['createdAt'])[_0xf371('0x58')](_0xf371('0x45'))[_0xf371('0x51')](),'sender':_0x21dfb9[_0xf371('0x60')]===_0xf371('0x71')?_0x21dfb9[_0xf371('0x63')]?_0x21dfb9[_0xf371('0x63')][_0xf371('0x65')]:_0xf371('0x72'):_0x21dfb9[_0xf371('0x5c')][_0xf371('0x73')]+(_0x21dfb9['Contact'][_0xf371('0x5d')]?'\x20'+_0x21dfb9[_0xf371('0x5c')][_0xf371('0x5d')]:''),'body':_0x21dfb9[_0xf371('0x5e')]?_0x21dfb9['Attachment']['basename']:_0x21dfb9[_0xf371('0x34')],'direction':_0x21dfb9['direction']===_0xf371('0x71')?'A':'C','secret':_0x21dfb9['secret'],'read':_0x21dfb9[_0xf371('0x61')],'attachment':_0x21dfb9[_0xf371('0x5e')]};})[_0xf371('0x74')]()};return ejs[_0xf371('0x75')](path[_0xf371('0x52')](config['root'],_0xf371('0x53'),'views',_0xf371('0x76')),{'interaction':_0x335df7})[_0xf371('0x16')](function(_0x21f4be){var _0x20f012=path[_0xf371('0x52')](_0x197a49,_0xf371('0x77')+_0xea44bd['id']+'-'+_0x4854f1+_0xf371('0x78'));var _0x13c51d={'path':_0x20f012,'channel':_0xf371('0x68'),'interactionId':_0xea44bd['id']};return pdf[_0xf371('0x79')](_0x21f4be,_0x13c51d);})['then'](function(){return new BPromise(function(_0x342a0d,_0x224c0b){zipdir(_0x197a49,{'saveTo':_0x4e1d68},function(_0x1ed7d5,_0xb8dda0){if(_0x1ed7d5)return _0x224c0b(_0x1ed7d5);return _0x342a0d(_0xb8dda0);});})[_0xf371('0x16')](function(){return new BPromise(function(_0x2de10a,_0x13f177){rimraf(_0x197a49,function(_0x282c5b){if(_0x282c5b)_0x13f177(_0x282c5b);return _0x2de10a();});});})[_0xf371('0x16')](function(){return _0x1d481b['download'](_0x4e1d68,_0xf1d641,function(_0x33d844){if(_0x33d844){console[_0xf371('0x7a')](_0xf371('0x7b'),_0x33d844);}else{fs['unlinkSync'](_0x4e1d68);}});});});}else{return _0x1d481b['sendStatus'](0xc8);}})[_0xf371('0x32')](handleError(_0x1d481b,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f68c799..7239c57 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 _0x3d7f=['setMaxListeners','save','update','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','exports','events','WhatsappInteraction','WhatsappMessage'];(function(_0x4afc33,_0x5088fd){var _0x448b1c=function(_0x152051){while(--_0x152051){_0x4afc33['push'](_0x4afc33['shift']());}};_0x448b1c(++_0x5088fd);}(_0x3d7f,0x1a1));var _0xf3d7=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x3d7f[_0x2555d0];return _0x3bb486;};'use strict';var EventEmitter=require(_0xf3d7('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf3d7('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xf3d7('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf3d7('0x3')](0x0);var events={'afterCreate':_0xf3d7('0x4'),'afterUpdate':_0xf3d7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x574073){return function(_0x433483,_0x20fb37,_0x5b667c){_0x433483['getUsers']({'attributes':['id'],'raw':!![]})[_0xf3d7('0x6')](function(_0x17d875){_0x433483[_0xf3d7('0x7')]('Users',_0x17d875[_0xf3d7('0x8')](function(_0x2d2bcd){return{'id':_0x2d2bcd['id']};}));return WhatsappMessage[_0xf3d7('0x9')]({'where':{'WhatsappInteractionId':_0x433483['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf3d7('0x6')](function(_0x167637){_0x433483[_0xf3d7('0x7')](_0xf3d7('0xa'),_0x167637[_0xf3d7('0xb')]);WhatsappInteractionEvents[_0xf3d7('0xc')](_0x574073+':'+_0x433483['id'],_0x433483);WhatsappInteractionEvents[_0xf3d7('0xc')](_0x574073,_0x433483);_0x5b667c(null);})[_0xf3d7('0xd')](_0x5b667c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf3d7('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd138=['setDataValue','Users','then','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save'];(function(_0x1f969a,_0x2d4f10){var _0x3dc4a7=function(_0x2a3cac){while(--_0x2a3cac){_0x1f969a['push'](_0x1f969a['shift']());}};_0x3dc4a7(++_0x2d4f10);}(_0xd138,0x1dc));var _0x8d13=function(_0x2c60de,_0x565bf9){_0x2c60de=_0x2c60de-0x0;var _0x277399=_0xd138[_0x2c60de];return _0x277399;};'use strict';var EventEmitter=require(_0x8d13('0x0'));var WhatsappInteraction=require(_0x8d13('0x1'))['db'][_0x8d13('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d13('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5f7cd3){return function(_0x58ddff,_0x4ad8cf,_0x5c1a82){_0x58ddff['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x317105){_0x58ddff[_0x8d13('0x4')](_0x8d13('0x5'),_0x317105['map'](function(_0x3f23ef){return{'id':_0x3f23ef['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x58ddff['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8d13('0x6')](function(_0x98805f){_0x58ddff['setDataValue']('unreadMessages',_0x98805f[_0x8d13('0x7')]);WhatsappInteractionEvents[_0x8d13('0x8')](_0x5f7cd3+':'+_0x58ddff['id'],_0x58ddff);WhatsappInteractionEvents[_0x8d13('0x8')](_0x5f7cd3,_0x58ddff);_0x5c1a82(null);})['catch'](_0x5c1a82(null));};}for(var e in events){if(events[_0x8d13('0x9')](e)){var event=events[e];WhatsappInteraction[_0x8d13('0xa')](e,emitEvent(event));}}module[_0x8d13('0xb')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 82b868d..fc22933 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 _0xd84c=['exports','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0xd51c92,_0x3b8872){var _0x1e49aa=function(_0x29c1bc){while(--_0x29c1bc){_0xd51c92['push'](_0xd51c92['shift']());}};_0x1e49aa(++_0x3b8872);}(_0xd84c,0x17d));var _0xcd84=function(_0x1e8e63,_0x4b2ef0){_0x1e8e63=_0x1e8e63-0x0;var _0x146abf=_0xd84c[_0x1e8e63];return _0x146abf;};'use strict';var _=require(_0xcd84('0x0'));var util=require(_0xcd84('0x1'));var logger=require(_0xcd84('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcd84('0x3'));var rp=require(_0xcd84('0x4'));var fs=require('fs');var path=require(_0xcd84('0x5'));var rimraf=require(_0xcd84('0x6'));var config=require(_0xcd84('0x7'));var attributes=require(_0xcd84('0x8'));module[_0xcd84('0x9')]=function(_0x112462,_0x11cacc){return _0x112462['define'](_0xcd84('0xa'),attributes,{'tableName':_0xcd84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1be0f5,_0x316c30,_0x2d51eb){if(_0x1be0f5['changed'](_0xcd84('0xc'))){_0x1be0f5['closedAt']=moment()[_0xcd84('0xd')](_0xcd84('0xe'));}_0x2d51eb(null,_0x1be0f5);}}});}; \ No newline at end of file +var _0xa29b=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa29b,0xd3));var _0xba29=function(_0x283a81,_0x42f033){_0x283a81=_0x283a81-0x0;var _0x57533f=_0xa29b[_0x283a81];return _0x57533f;};'use strict';var _=require(_0xba29('0x0'));var util=require(_0xba29('0x1'));var logger=require(_0xba29('0x2'))(_0xba29('0x3'));var moment=require(_0xba29('0x4'));var BPromise=require(_0xba29('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba29('0x6'));var config=require(_0xba29('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0xba29('0x8')]=function(_0x2a5625,_0x4a6f56){return _0x2a5625[_0xba29('0x9')](_0xba29('0xa'),attributes,{'tableName':_0xba29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd71054,_0x37e433,_0x54f684){if(_0xd71054[_0xba29('0xc')]('closed')){_0xd71054[_0xba29('0xd')]=moment()[_0xba29('0xe')](_0xba29('0xf'));}_0x54f684(null,_0xd71054);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3d543ee..2feb968 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 _0x8825=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8825,0x1d9));var _0x5882=function(_0x470c3d,_0x2be227){_0x470c3d=_0x470c3d-0x0;var _0x31043f=_0x8825[_0x470c3d];return _0x31043f;};'use strict';var _=require(_0x5882('0x0'));var util=require(_0x5882('0x1'));var moment=require('moment');var BPromise=require(_0x5882('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5882('0x3'));var logger=require(_0x5882('0x4'))(_0x5882('0x5'));var config=require(_0x5882('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5882('0x7')]({'port':0x232a});config[_0x5882('0x8')]=_[_0x5882('0x9')](config[_0x5882('0x8')],{'host':_0x5882('0xa'),'port':0x18eb});var socket=require(_0x5882('0xb'))(new Redis(config[_0x5882('0x8')]));require('./whatsappInteraction.socket')[_0x5882('0xc')](socket);function respondWithRpcPromise(_0x501c6d,_0x2586ea,_0x234b4d){return new BPromise(function(_0x31f135,_0x132efe){return client[_0x5882('0xd')](_0x501c6d,_0x234b4d)[_0x5882('0xe')](function(_0x10faee){logger[_0x5882('0xf')](_0x5882('0x10'),_0x2586ea,'request\x20sent');logger[_0x5882('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x2586ea,_0x5882('0x12'),JSON[_0x5882('0x13')](_0x10faee));if(_0x10faee[_0x5882('0x14')]){if(_0x10faee[_0x5882('0x14')][_0x5882('0x15')]===0x1f4){logger['error'](_0x5882('0x10'),_0x2586ea,_0x10faee[_0x5882('0x14')]['message']);return _0x132efe(_0x10faee[_0x5882('0x14')][_0x5882('0x16')]);}logger[_0x5882('0x14')](_0x5882('0x10'),_0x2586ea,_0x10faee['error'][_0x5882('0x16')]);return _0x31f135(_0x10faee[_0x5882('0x14')][_0x5882('0x16')]);}else{logger[_0x5882('0xf')](_0x5882('0x10'),_0x2586ea,_0x5882('0x12'));_0x31f135(_0x10faee[_0x5882('0x17')][_0x5882('0x16')]);}})[_0x5882('0x18')](function(_0x4e33df){logger[_0x5882('0x14')](_0x5882('0x10'),_0x2586ea,_0x4e33df);_0x132efe(_0x4e33df);});});}exports['UpdateWhatsappInteraction']=function(_0x222ab8){var _0x1fb385=this;return new Promise(function(_0xf39d76,_0x4e9c42){return db['WhatsappInteraction']['update'](_0x222ab8[_0x5882('0x19')],{'raw':_0x222ab8[_0x5882('0x1a')]?_0x222ab8[_0x5882('0x1a')][_0x5882('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x222ab8[_0x5882('0x1a')]?_0x222ab8['options'][_0x5882('0x1c')]||null:null,'attributes':_0x222ab8['options']?_0x222ab8[_0x5882('0x1a')][_0x5882('0x1d')]||null:null,'limit':_0x222ab8[_0x5882('0x1a')]?_0x222ab8[_0x5882('0x1a')][_0x5882('0x1e')]||null:null})[_0x5882('0xe')](function(_0x3a49d8){logger[_0x5882('0xf')](_0x5882('0x1f'),_0x222ab8);logger[_0x5882('0x11')](_0x5882('0x1f'),_0x222ab8,JSON[_0x5882('0x13')](_0x3a49d8));_0xf39d76(_0x3a49d8);})['catch'](function(_0x11d8b2){logger[_0x5882('0x14')]('UpdateWhatsappInteraction',_0x11d8b2[_0x5882('0x16')],_0x222ab8);_0x4e9c42(_0x1fb385[_0x5882('0x14')](0x1f4,_0x11d8b2[_0x5882('0x16')]));});});};exports[_0x5882('0x20')]=function(_0x263fea){return new Promise(function(_0x34153d,_0x5701fc){return db[_0x5882('0x21')][_0x5882('0x22')]({'where':_0x263fea[_0x5882('0x1a')]?_0x263fea[_0x5882('0x1a')][_0x5882('0x1c')]||null:null})['then'](function(_0x42716b){if(_0x42716b){return _0x42716b[_0x5882('0x23')](_0x263fea['body'][_0x5882('0x24')],_[_0x5882('0x25')](_0x263fea['body'],['ids','id'])||{});}})[_0x5882('0x26')](function(_0x4565b3){logger[_0x5882('0xf')](_0x5882('0x27'),_0x263fea);logger[_0x5882('0x11')](_0x5882('0x27'),_0x263fea,JSON[_0x5882('0x13')](_0x4565b3));_0x34153d(_0x4565b3);})[_0x5882('0x18')](function(_0x4ca1fc){logger['error'](_0x5882('0x27'),_0x4ca1fc[_0x5882('0x16')],_0x263fea);_0x5701fc(_this[_0x5882('0x14')](0x1f4,_0x4ca1fc[_0x5882('0x16')]));});});}; \ No newline at end of file +var _0x1792=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','find','ids','omit','spread','util','moment'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1792,0xb7));var _0x2179=function(_0x5a0383,_0x312ffe){_0x5a0383=_0x5a0383-0x0;var _0x1adda7=_0x1792[_0x5a0383];return _0x1adda7;};'use strict';var _=require('lodash');var util=require(_0x2179('0x0'));var moment=require(_0x2179('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2179('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2179('0x3'));var logger=require(_0x2179('0x4'))('rpc');var config=require(_0x2179('0x5'));var jayson=require(_0x2179('0x6'));var client=jayson[_0x2179('0x7')]['http']({'port':0x232a});config[_0x2179('0x8')]=_[_0x2179('0x9')](config[_0x2179('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2179('0xa'))(new Redis(config['redis']));require(_0x2179('0xb'))['register'](socket);function respondWithRpcPromise(_0x440cd6,_0x372310,_0x20c772){return new BPromise(function(_0x25d23d,_0x27115e){return client[_0x2179('0xc')](_0x440cd6,_0x20c772)[_0x2179('0xd')](function(_0x462813){logger[_0x2179('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x372310,_0x2179('0xf'));logger[_0x2179('0x10')](_0x2179('0x11'),_0x372310,'request\x20sent',JSON[_0x2179('0x12')](_0x462813));if(_0x462813['error']){if(_0x462813['error'][_0x2179('0x13')]===0x1f4){logger[_0x2179('0x14')](_0x2179('0x15'),_0x372310,_0x462813[_0x2179('0x14')][_0x2179('0x16')]);return _0x27115e(_0x462813[_0x2179('0x14')][_0x2179('0x16')]);}logger[_0x2179('0x14')](_0x2179('0x15'),_0x372310,_0x462813[_0x2179('0x14')][_0x2179('0x16')]);return _0x25d23d(_0x462813[_0x2179('0x14')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x372310,_0x2179('0xf'));_0x25d23d(_0x462813['result'][_0x2179('0x16')]);}})[_0x2179('0x17')](function(_0x5f4b1a){logger[_0x2179('0x14')](_0x2179('0x15'),_0x372310,_0x5f4b1a);_0x27115e(_0x5f4b1a);});});}exports[_0x2179('0x18')]=function(_0xbcf3f2){var _0x10c5d8=this;return new Promise(function(_0x32036f,_0x313912){return db[_0x2179('0x19')][_0x2179('0x1a')](_0xbcf3f2[_0x2179('0x1b')],{'raw':_0xbcf3f2[_0x2179('0x1c')]?_0xbcf3f2[_0x2179('0x1c')][_0x2179('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbcf3f2[_0x2179('0x1c')]?_0xbcf3f2[_0x2179('0x1c')][_0x2179('0x1e')]||null:null,'attributes':_0xbcf3f2[_0x2179('0x1c')]?_0xbcf3f2[_0x2179('0x1c')][_0x2179('0x1f')]||null:null,'limit':_0xbcf3f2[_0x2179('0x1c')]?_0xbcf3f2[_0x2179('0x1c')]['limit']||null:null})['then'](function(_0x587d8d){logger['info'](_0x2179('0x18'),_0xbcf3f2);logger[_0x2179('0x10')]('UpdateWhatsappInteraction',_0xbcf3f2,JSON['stringify'](_0x587d8d));_0x32036f(_0x587d8d);})[_0x2179('0x17')](function(_0x10ed60){logger['error'](_0x2179('0x18'),_0x10ed60[_0x2179('0x16')],_0xbcf3f2);_0x313912(_0x10c5d8['error'](0x1f4,_0x10ed60[_0x2179('0x16')]));});});};exports[_0x2179('0x20')]=function(_0x7c45f0){return new Promise(function(_0x1fc251,_0x356922){return db[_0x2179('0x19')][_0x2179('0x21')]({'where':_0x7c45f0[_0x2179('0x1c')]?_0x7c45f0[_0x2179('0x1c')][_0x2179('0x1e')]||null:null})['then'](function(_0x229d73){if(_0x229d73){return _0x229d73['addTags'](_0x7c45f0[_0x2179('0x1b')][_0x2179('0x22')],_[_0x2179('0x23')](_0x7c45f0[_0x2179('0x1b')],['ids','id'])||{});}})[_0x2179('0x24')](function(_0x534f69){logger['info']('AddTags',_0x7c45f0);logger['debug']('AddTags',_0x7c45f0,JSON[_0x2179('0x12')](_0x534f69));_0x1fc251(_0x534f69);})['catch'](function(_0x753edc){logger[_0x2179('0x14')]('AddTags',_0x753edc['message'],_0x7c45f0);_0x356922(_this[_0x2179('0x14')](0x1f4,_0x753edc[_0x2179('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 2d22195..2370238 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 _0x4278=['save','removeListener','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x4278,0xdb));var _0x8427=function(_0x594c78,_0x31e0c8){_0x594c78=_0x594c78-0x0;var _0x365868=_0x4278[_0x594c78];return _0x365868;};'use strict';var WhatsappInteractionEvents=require(_0x8427('0x0'));var events=[_0x8427('0x1'),'remove','update'];function createListener(_0xb961d5,_0x2cd671){return function(_0x3a1fa9){_0x2cd671['emit'](_0xb961d5,_0x3a1fa9);};}function removeListener(_0x2ed7b5,_0x2c1b99){return function(){WhatsappInteractionEvents[_0x8427('0x2')](_0x2ed7b5,_0x2c1b99);};}exports['register']=function(_0xa844de){for(var _0x4b18d5=0x0,_0x539d0c=events[_0x8427('0x3')];_0x4b18d5<_0x539d0c;_0x4b18d5++){var _0x5aedce=events[_0x4b18d5];var _0x2294d3=createListener(_0x8427('0x4')+_0x5aedce,_0xa844de);WhatsappInteractionEvents['on'](_0x5aedce,_0x2294d3);}}; \ No newline at end of file +var _0x3e9e=['length','whatsappInteraction:','./whatsappInteraction.events','save','emit','removeListener','register'];(function(_0x8b230c,_0xd35696){var _0x336ef5=function(_0x3a69cf){while(--_0x3a69cf){_0x8b230c['push'](_0x8b230c['shift']());}};_0x336ef5(++_0xd35696);}(_0x3e9e,0x1ad));var _0xe3e9=function(_0x1c76cc,_0x4c991d){_0x1c76cc=_0x1c76cc-0x0;var _0x152e03=_0x3e9e[_0x1c76cc];return _0x152e03;};'use strict';var WhatsappInteractionEvents=require(_0xe3e9('0x0'));var events=[_0xe3e9('0x1'),'remove','update'];function createListener(_0x567c14,_0x55774a){return function(_0x4c01ba){_0x55774a[_0xe3e9('0x2')](_0x567c14,_0x4c01ba);};}function removeListener(_0x28099f,_0x51adaf){return function(){WhatsappInteractionEvents[_0xe3e9('0x3')](_0x28099f,_0x51adaf);};}exports[_0xe3e9('0x4')]=function(_0xe3cbc2){for(var _0x201f82=0x0,_0x3a8cd4=events[_0xe3e9('0x5')];_0x201f82<_0x3a8cd4;_0x201f82++){var _0x56f940=events[_0x201f82];var _0xb5a5d5=createListener(_0xe3e9('0x6')+_0x56f940,_0xe3cbc2);WhatsappInteractionEvents['on'](_0x56f940,_0xb5a5d5);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5b734a5..d416205 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 _0x6b8b=['Router','../../components/auth/service','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','/:id/status','status','put','update','accept','reject','delete','destroy','exports','multer','util','path','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6b8b,0x11c));var _0xb6b8=function(_0x22f86d,_0x3ad632){_0x22f86d=_0x22f86d-0x0;var _0x137d5d=_0x6b8b[_0x22f86d];return _0x137d5d;};'use strict';var multer=require(_0xb6b8('0x0'));var util=require(_0xb6b8('0x1'));var path=require(_0xb6b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6b8('0x3'));var router=express[_0xb6b8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6b8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb6b8('0x6'));router[_0xb6b8('0x7')]('/',auth[_0xb6b8('0x8')](),controller[_0xb6b8('0x9')]);router[_0xb6b8('0x7')]('/describe',auth[_0xb6b8('0x8')](),controller[_0xb6b8('0xa')]);router['get'](_0xb6b8('0xb'),auth['isAuthenticated'](),controller[_0xb6b8('0xc')]);router[_0xb6b8('0xd')]('/',auth[_0xb6b8('0x8')](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller[_0xb6b8('0xe')]);router['post'](_0xb6b8('0xf'),controller[_0xb6b8('0x10')]);router[_0xb6b8('0x11')]('/:id',auth[_0xb6b8('0x8')](),controller[_0xb6b8('0x12')]);router['put']('/:id/accept',auth[_0xb6b8('0x8')](),controller[_0xb6b8('0x13')]);router[_0xb6b8('0x11')]('/:id/reject',auth[_0xb6b8('0x8')](),controller[_0xb6b8('0x14')]);router[_0xb6b8('0x15')](_0xb6b8('0xb'),auth[_0xb6b8('0x8')](),controller[_0xb6b8('0x16')]);module[_0xb6b8('0x17')]=router; \ No newline at end of file +var _0xfe20=['isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','path','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get'];(function(_0x24abda,_0x4ca849){var _0x26746a=function(_0x352f0a){while(--_0x352f0a){_0x24abda['push'](_0x24abda['shift']());}};_0x26746a(++_0x4ca849);}(_0xfe20,0x171));var _0x0fe2=function(_0x4b7d51,_0x36e0f9){_0x4b7d51=_0x4b7d51-0x0;var _0x18864c=_0xfe20[_0x4b7d51];return _0x18864c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0fe2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0fe2('0x1')]();var fs_extra=require(_0x0fe2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x0fe2('0x3'));var config=require('../../config/environment');var controller=require(_0x0fe2('0x4'));router[_0x0fe2('0x5')]('/',auth[_0x0fe2('0x6')](),controller[_0x0fe2('0x7')]);router[_0x0fe2('0x5')](_0x0fe2('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0fe2('0x9'),auth[_0x0fe2('0x6')](),controller[_0x0fe2('0xa')]);router[_0x0fe2('0xb')]('/',auth['isAuthenticated'](),interaction[_0x0fe2('0xc')](_0x0fe2('0xd'),_0x0fe2('0xe')),controller[_0x0fe2('0xf')]);router['post']('/:id/status',controller[_0x0fe2('0x10')]);router[_0x0fe2('0x11')](_0x0fe2('0x9'),auth[_0x0fe2('0x6')](),controller[_0x0fe2('0x12')]);router[_0x0fe2('0x11')](_0x0fe2('0x13'),auth['isAuthenticated'](),controller[_0x0fe2('0x14')]);router[_0x0fe2('0x11')](_0x0fe2('0x15'),auth[_0x0fe2('0x6')](),controller[_0x0fe2('0x16')]);router[_0x0fe2('0x17')](_0x0fe2('0x9'),auth[_0x0fe2('0x6')](),controller[_0x0fe2('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index cfc3418..af79553 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 _0xebda=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x34ea51,_0x802f46){var _0x2f21cb=function(_0x4d974d){while(--_0x4d974d){_0x34ea51['push'](_0x34ea51['shift']());}};_0x2f21cb(++_0x802f46);}(_0xebda,0x170));var _0xaebd=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xebda[_0x30cd7e];return _0x462a02;};'use strict';var Sequelize=require('sequelize');module[_0xaebd('0x0')]={'body':{'type':Sequelize[_0xaebd('0x1')](_0xaebd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xaebd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaebd('0x4')]('in','out'),'defaultValue':_0xaebd('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xaebd('0x6')]},'readAt':{'type':Sequelize[_0xaebd('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaebd('0x6')]},'providerResponse':{'type':Sequelize[_0xaebd('0x1')]}}; \ No newline at end of file +var _0x67e8=['BOOLEAN','sequelize','exports','TEXT','ENUM','out','STRING'];(function(_0x2147ae,_0x37d08e){var _0x577f4a=function(_0x2ba48c){while(--_0x2ba48c){_0x2147ae['push'](_0x2147ae['shift']());}};_0x577f4a(++_0x37d08e);}(_0x67e8,0x86));var _0x867e=function(_0x16a313,_0x5cf5f1){_0x16a313=_0x16a313-0x0;var _0x449820=_0x67e8[_0x16a313];return _0x449820;};'use strict';var Sequelize=require(_0x867e('0x0'));module[_0x867e('0x1')]={'body':{'type':Sequelize[_0x867e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x867e('0x3')]('in',_0x867e('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x867e('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x867e('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x867e('0x5')]},'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 4077b5e..c647184 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 _0x0104=['Content-Range','save','update','sendStatus','send','index','WhatsappMessage','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','show','params','rawAttributes','create','body','destroy','find','catch','describe','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','QueryTypes','internal','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','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count'];(function(_0x3a6035,_0x1f37b8){var _0x3cdea9=function(_0x23e6d2){while(--_0x23e6d2){_0x3a6035['push'](_0x3a6035['shift']());}};_0x3cdea9(++_0x1f37b8);}(_0x0104,0xe6));var _0x4010=function(_0x28aa51,_0x44a855){_0x28aa51=_0x28aa51-0x0;var _0x2776ef=_0x0104[_0x28aa51];return _0x2776ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4010('0x0'));var zipdir=require(_0x4010('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4010('0x2'));var moment=require(_0x4010('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4010('0x4'));var util=require(_0x4010('0x5'));var path=require(_0x4010('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4010('0x7'));var fs=require('fs');var fs_extra=require(_0x4010('0x8'));var _=require(_0x4010('0x9'));var squel=require(_0x4010('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4010('0xb'));var toCsv=require(_0x4010('0xc'));var querystring=require('querystring');var Papa=require(_0x4010('0xd'));var Redis=require(_0x4010('0xe'));var authService=require(_0x4010('0xf'));var qs=require(_0x4010('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4010('0x11'));var logger=require(_0x4010('0x12'))(_0x4010('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4010('0x14'));var db=require(_0x4010('0x15'))['db'];config[_0x4010('0x16')]=_['defaults'](config[_0x4010('0x16')],{'host':_0x4010('0x17'),'port':0x18eb});var socket=require(_0x4010('0x18'))(new Redis(config[_0x4010('0x16')]));require('./whatsappMessage.socket')[_0x4010('0x19')](socket);var jayson=require(_0x4010('0x1a'));var client=jayson[_0x4010('0x1b')][_0x4010('0x1c')]({'port':0x232c});var client9002=jayson[_0x4010('0x1b')][_0x4010('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5c5f73,_0x2863cc,_0x24a00e,_0x3f0fb9){return new BPromise(function(_0x39cbee,_0x1ee694){var _0x108e69=_0x3f0fb9||client;return _0x108e69[_0x4010('0x1d')](_0x5c5f73,_0x24a00e)[_0x4010('0x1e')](function(_0xcb121c){logger[_0x4010('0x1f')](_0x4010('0x20'),_0x2863cc,'request\x20sent');logger[_0x4010('0x21')](_0x4010('0x22'),_0x2863cc,_0x4010('0x23'),JSON[_0x4010('0x24')](_0xcb121c));if(_0xcb121c[_0x4010('0x25')]){if(_0xcb121c['error'][_0x4010('0x26')]===0x1f4){logger[_0x4010('0x25')](_0x4010('0x20'),_0x2863cc,_0xcb121c[_0x4010('0x25')][_0x4010('0x27')]);return _0x1ee694(_0xcb121c[_0x4010('0x25')][_0x4010('0x27')]);}logger['error'](_0x4010('0x20'),_0x2863cc,_0xcb121c[_0x4010('0x25')]['message']);return _0x39cbee(_0xcb121c[_0x4010('0x25')][_0x4010('0x27')]);}else{logger[_0x4010('0x1f')](_0x4010('0x20'),_0x2863cc,_0x4010('0x23'));_0x39cbee(_0xcb121c[_0x4010('0x28')][_0x4010('0x27')]);}})['catch'](function(_0x31c86a){logger[_0x4010('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x2863cc,_0x31c86a);_0x1ee694(_0x31c86a);});});}function respondWithStatusCode(_0x5d158a,_0x5af768){_0x5af768=_0x5af768||0xcc;return function(_0x16fdf6){if(_0x16fdf6){return _0x5d158a['sendStatus'](_0x5af768);}return _0x5d158a[_0x4010('0x29')](_0x5af768)[_0x4010('0x2a')]();};}function respondWithResult(_0x512086,_0x5b5aa2){_0x5b5aa2=_0x5b5aa2||0xc8;return function(_0x22c40c){if(_0x22c40c){return _0x512086[_0x4010('0x29')](_0x5b5aa2)[_0x4010('0x2b')](_0x22c40c);}};}function respondWithFilteredResult(_0x394427,_0x4904a2){return function(_0x1e65d2){if(_0x1e65d2){var _0x2e843c=typeof _0x4904a2[_0x4010('0x2c')]===_0x4010('0x2d')&&typeof _0x4904a2[_0x4010('0x2e')]===_0x4010('0x2d');var _0xdd4fee=_0x1e65d2[_0x4010('0x2f')];var _0x3da6a7=_0x2e843c?0x0:_0x4904a2[_0x4010('0x2c')];var _0x5984f3=_0x2e843c?_0x1e65d2[_0x4010('0x2f')]:_0x4904a2[_0x4010('0x2c')]+_0x4904a2['limit'];var _0x206056;if(_0x5984f3>=_0xdd4fee){_0x5984f3=_0xdd4fee;_0x206056=0xc8;}else{_0x206056=0xce;}_0x394427[_0x4010('0x29')](_0x206056);return _0x394427['set'](_0x4010('0x30'),_0x3da6a7+'-'+_0x5984f3+'/'+_0xdd4fee)[_0x4010('0x2b')](_0x1e65d2);}return null;};}function patchUpdates(_0x58aa73){return function(_0x207e8e){try{jsonpatch['apply'](_0x207e8e,_0x58aa73,!![]);}catch(_0xea4117){return BPromise['reject'](_0xea4117);}return _0x207e8e[_0x4010('0x31')]();};}function saveUpdates(_0x1b1e9a,_0x229eac){return function(_0x286a9d){if(_0x286a9d){return _0x286a9d[_0x4010('0x32')](_0x1b1e9a)['then'](function(_0x3b4e8){return _0x3b4e8;});}return null;};}function removeEntity(_0x37ab66,_0x213d45){return function(_0x2da15e){if(_0x2da15e){return _0x2da15e['destroy']()[_0x4010('0x1e')](function(){_0x37ab66[_0x4010('0x29')](0xcc)[_0x4010('0x2a')]();});}};}function handleEntityNotFound(_0x1247dd,_0x162b54){return function(_0x57dda6){if(!_0x57dda6){_0x1247dd[_0x4010('0x33')](0x194);}return _0x57dda6;};}function handleError(_0x56c7ec,_0x57db33){_0x57db33=_0x57db33||0x1f4;return function(_0x1bc62a){logger['error'](_0x1bc62a['stack']);if(_0x1bc62a['name']){delete _0x1bc62a['name'];}_0x56c7ec[_0x4010('0x29')](_0x57db33)[_0x4010('0x34')](_0x1bc62a);};}exports[_0x4010('0x35')]=function(_0x4c34ca,_0x18673b){var _0x21a1a4={},_0x4d3d58={},_0x1c4eae={'count':0x0,'rows':[]};var _0x33de20=_['map'](db[_0x4010('0x36')]['rawAttributes'],function(_0x3b401b){return{'name':_0x3b401b[_0x4010('0x37')],'type':_0x3b401b[_0x4010('0x38')][_0x4010('0x39')]};});_0x4d3d58[_0x4010('0x3a')]=_['map'](_0x33de20,_0x4010('0x3b'));_0x4d3d58[_0x4010('0x3c')]=_[_0x4010('0x3d')](_0x4c34ca['query']);_0x4d3d58['filters']=_[_0x4010('0x3e')](_0x4d3d58[_0x4010('0x3a')],_0x4d3d58[_0x4010('0x3c')]);_0x21a1a4['attributes']=_[_0x4010('0x3e')](_0x4d3d58[_0x4010('0x3a')],qs[_0x4010('0x3f')](_0x4c34ca[_0x4010('0x3c')][_0x4010('0x3f')]));_0x21a1a4[_0x4010('0x40')]=_0x21a1a4[_0x4010('0x40')][_0x4010('0x41')]?_0x21a1a4[_0x4010('0x40')]:_0x4d3d58[_0x4010('0x3a')];if(!_0x4c34ca[_0x4010('0x3c')][_0x4010('0x42')](_0x4010('0x43'))){_0x21a1a4[_0x4010('0x2e')]=qs['limit'](_0x4c34ca[_0x4010('0x3c')][_0x4010('0x2e')]);_0x21a1a4[_0x4010('0x2c')]=qs[_0x4010('0x2c')](_0x4c34ca[_0x4010('0x3c')][_0x4010('0x2c')]);}_0x21a1a4[_0x4010('0x44')]=qs[_0x4010('0x45')](_0x4c34ca['query']['sort']);_0x21a1a4[_0x4010('0x46')]=qs[_0x4010('0x47')](_[_0x4010('0x48')](_0x4c34ca[_0x4010('0x3c')],_0x4d3d58[_0x4010('0x47')]),_0x33de20);if(_0x4c34ca[_0x4010('0x3c')][_0x4010('0x49')]){_0x21a1a4['where']=_[_0x4010('0x4a')](_0x21a1a4['where'],{'$or':_[_0x4010('0x4b')](_0x33de20,function(_0x9cf388){if(_0x9cf388[_0x4010('0x38')]!=='VIRTUAL'){var _0x20022b={};_0x20022b[_0x9cf388['name']]={'$like':'%'+_0x4c34ca[_0x4010('0x3c')][_0x4010('0x49')]+'%'};return _0x20022b;}})});}_0x21a1a4=_[_0x4010('0x4a')]({},_0x21a1a4,_0x4c34ca[_0x4010('0x4c')]);var _0x1bf90f={'where':_0x21a1a4[_0x4010('0x46')]};return db[_0x4010('0x36')][_0x4010('0x2f')](_0x1bf90f)[_0x4010('0x1e')](function(_0x13430a){_0x1c4eae[_0x4010('0x2f')]=_0x13430a;if(_0x4c34ca[_0x4010('0x3c')][_0x4010('0x4d')]){_0x21a1a4[_0x4010('0x4e')]=[{'all':!![]}];}return db[_0x4010('0x36')][_0x4010('0x4f')](_0x21a1a4);})['then'](function(_0x130cc6){_0x1c4eae['rows']=_0x130cc6;return _0x1c4eae;})[_0x4010('0x1e')](respondWithFilteredResult(_0x18673b,_0x21a1a4))['catch'](handleError(_0x18673b,null));};exports[_0x4010('0x50')]=function(_0x59093e,_0x4e2a56){var _0x2c87c3={'raw':!![],'where':{'id':_0x59093e[_0x4010('0x51')]['id']}},_0x505595={};_0x505595[_0x4010('0x3a')]=_[_0x4010('0x3d')](db['WhatsappMessage'][_0x4010('0x52')]);_0x505595[_0x4010('0x3c')]=_[_0x4010('0x3d')](_0x59093e[_0x4010('0x3c')]);_0x505595[_0x4010('0x47')]=_[_0x4010('0x3e')](_0x505595[_0x4010('0x3a')],_0x505595[_0x4010('0x3c')]);_0x2c87c3[_0x4010('0x40')]=_[_0x4010('0x3e')](_0x505595[_0x4010('0x3a')],qs[_0x4010('0x3f')](_0x59093e['query'][_0x4010('0x3f')]));_0x2c87c3[_0x4010('0x40')]=_0x2c87c3['attributes']['length']?_0x2c87c3[_0x4010('0x40')]:_0x505595[_0x4010('0x3a')];if(_0x59093e[_0x4010('0x3c')][_0x4010('0x4d')]){_0x2c87c3['include']=[{'all':!![]}];}_0x2c87c3=_[_0x4010('0x4a')]({},_0x2c87c3,_0x59093e[_0x4010('0x4c')]);return db[_0x4010('0x36')]['find'](_0x2c87c3)[_0x4010('0x1e')](handleEntityNotFound(_0x4e2a56,null))['then'](respondWithResult(_0x4e2a56,null))['catch'](handleError(_0x4e2a56,null));};exports[_0x4010('0x53')]=function(_0x1e17bb,_0x23a726){return db[_0x4010('0x36')][_0x4010('0x53')](_0x1e17bb[_0x4010('0x54')],{})[_0x4010('0x1e')](respondWithResult(_0x23a726,0xc9))['catch'](handleError(_0x23a726,null));};exports['update']=function(_0xf2857e,_0x1045ab){if(_0xf2857e[_0x4010('0x54')]['id']){delete _0xf2857e[_0x4010('0x54')]['id'];}return db[_0x4010('0x36')]['find']({'where':{'id':_0xf2857e['params']['id']}})[_0x4010('0x1e')](handleEntityNotFound(_0x1045ab,null))[_0x4010('0x1e')](saveUpdates(_0xf2857e[_0x4010('0x54')],null))['then'](respondWithResult(_0x1045ab,null))['catch'](handleError(_0x1045ab,null));};exports[_0x4010('0x55')]=function(_0x2ac926,_0x4f994f){return db['WhatsappMessage'][_0x4010('0x56')]({'where':{'id':_0x2ac926[_0x4010('0x51')]['id']}})[_0x4010('0x1e')](handleEntityNotFound(_0x4f994f,null))[_0x4010('0x1e')](removeEntity(_0x4f994f,null))[_0x4010('0x57')](handleError(_0x4f994f,null));};exports[_0x4010('0x58')]=function(_0xf43106,_0x139c09){return db[_0x4010('0x36')]['describe']()[_0x4010('0x1e')](respondWithResult(_0x139c09,null))['catch'](handleError(_0x139c09,null));};var interaction_log=require(_0x4010('0x12'))('whatsapp-interactions');exports[_0x4010('0x59')]=function(_0x59ccbf,_0x411480,_0x59b4fd){var _0x327c0f={'agent':{},'channel':_0x4010('0x5a')};if(_0x59ccbf[_0x4010('0x54')]['id']){delete _0x59ccbf['body']['id'];}_0x59ccbf[_0x4010('0x54')][_0x4010('0x5b')]=!![];_0x59ccbf[_0x4010('0x54')]['readAt']=moment()[_0x4010('0x5c')](_0x4010('0x5d'));_0x59ccbf[_0x4010('0x54')][_0x4010('0x5e')]=_0x59ccbf[_0x4010('0x54')][_0x4010('0x5e')]||_0x59ccbf['user']['id'];_0x327c0f[_0x4010('0x5f')]['id']=_0x59ccbf[_0x4010('0x54')][_0x4010('0x5e')];return db['WhatsappMessage'][_0x4010('0x56')]({'where':{'id':_0x59ccbf[_0x4010('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x411480,null))[_0x4010('0x1e')](saveUpdates(_0x59ccbf[_0x4010('0x54')],null))[_0x4010('0x1e')](function(_0x375977){if(_0x375977){_0x327c0f[_0x4010('0x27')]=_0x375977[_0x4010('0x60')]({'plain':!![]});return db[_0x4010('0x61')][_0x4010('0x56')]({'where':{'id':_0x375977[_0x4010('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x411480,null))['then'](function(_0x16249c){if(_0x16249c){return _0x16249c[_0x4010('0x32')]({'UserId':_0x59ccbf[_0x4010('0x54')]['UserId'],'read1stAt':_[_0x4010('0x63')](_0x16249c['read1stAt'])?moment()[_0x4010('0x5c')](_0x4010('0x5d')):undefined});}return null;})[_0x4010('0x1e')](function(_0x2b5e83){if(_0x2b5e83){_0x327c0f[_0x4010('0x64')]=_0x2b5e83['get']({'plain':!![]});interaction_log[_0x4010('0x1f')](_0x4010('0x65'),_0x59ccbf['user']['id'],_0x59ccbf[_0x4010('0x66')][_0x4010('0x3b')],_0x59ccbf[_0x4010('0x66')][_0x4010('0x67')],_0x327c0f['interaction']['id'],_0x59ccbf[_0x4010('0x54')]?JSON['stringify'](_0x59ccbf[_0x4010('0x54')]):_0x4010('0x68'));return respondWithRpcPromise(_0x4010('0x69'),_0x4010('0x6a'),_0x327c0f);}return null;})[_0x4010('0x1e')](function(_0x5d393e){var _0xf80754=_0x4010('0x6b')+_0x5d393e[_0x4010('0x27')]['ContactId'];return db['sequelize'][_0x4010('0x3c')](_0xf80754,{'type':db[_0x4010('0x6c')]['QueryTypes'][_0x4010('0x6d')],'raw':!![]})['then'](function(_0x62339a){return _0x62339a;});})[_0x4010('0x1e')](function(_0x3cead6){if(_0x3cead6){_0x327c0f[_0x4010('0x27')]['contact']=_0x3cead6[0x0];if(!_0x59ccbf['body'][_0x4010('0x5e')])return;return db[_0x4010('0x6e')][_0x4010('0x56')]({'where':{'id':_0x59ccbf[_0x4010('0x54')][_0x4010('0x5e')],'role':_0x4010('0x5f')},'attributes':['id',_0x4010('0x3b'),_0x4010('0x6f'),_0x4010('0x70'),'internal'],'raw':!![]});}return null;})[_0x4010('0x1e')](function(_0x5009e6){if(!_0x5009e6)return null;_0x327c0f[_0x4010('0x27')][_0x4010('0x5f')]=_0x5009e6;return _0x327c0f;})['then'](function(_0x3d490a){if(_0x3d490a){if(_0x59ccbf[_0x4010('0x54')][_0x4010('0x71')]){_0x327c0f['message'][_0x4010('0x72')]=util[_0x4010('0x5c')](_0x4010('0x73'),_0x59ccbf[_0x4010('0x66')]['name']);_0x327c0f[_0x4010('0x27')][_0x4010('0x74')]=_0x327c0f[_0x4010('0x74')];_0x327c0f[_0x4010('0x27')][_0x4010('0x75')]=_0x327c0f['channel'];_0x327c0f['message'][_0x4010('0x76')]='accept';return respondWithRpcPromise('EventManager',_0x4010('0x77'),{'event':_0x4010('0x78'),'message':_0x327c0f[_0x4010('0x27')]},client9002)[_0x4010('0x1e')](function(){return _0x327c0f;});}return _0x327c0f;}return null;})[_0x4010('0x1e')](respondWithResult(_0x411480,null))[_0x4010('0x57')](handleError(_0x411480,null));};var interaction_log=require(_0x4010('0x12'))(_0x4010('0x79'));exports[_0x4010('0x7a')]=function(_0x3d310e,_0x4b9d68,_0x14c076){var _0x875562={'agent':{},'channel':_0x4010('0x5a')};if(_0x3d310e[_0x4010('0x54')]['id']){delete _0x3d310e[_0x4010('0x54')]['id'];}_0x3d310e[_0x4010('0x54')][_0x4010('0x5e')]=_0x3d310e[_0x4010('0x54')][_0x4010('0x5e')]||_0x3d310e['user']['id'];_0x875562[_0x4010('0x5f')]['id']=_0x3d310e[_0x4010('0x54')][_0x4010('0x5e')];return db['WhatsappMessage'][_0x4010('0x56')]({'where':{'id':_0x3d310e[_0x4010('0x51')]['id'],'UserId':null}})[_0x4010('0x1e')](handleEntityNotFound(_0x4b9d68,null))['then'](function(_0x1b34c1){if(_0x1b34c1){_0x875562[_0x4010('0x27')]=_0x1b34c1[_0x4010('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0x4010('0x56')]({'where':{'id':_0x1b34c1[_0x4010('0x62')]}});}return null;})[_0x4010('0x1e')](handleEntityNotFound(_0x4b9d68,null))[_0x4010('0x1e')](function(_0x1fd3c4){if(_0x1fd3c4){_0x875562[_0x4010('0x64')]=_0x1fd3c4[_0x4010('0x60')]({'plain':!![]});interaction_log[_0x4010('0x1f')](_0x4010('0x7b'),_0x3d310e[_0x4010('0x66')]['id'],_0x3d310e[_0x4010('0x66')][_0x4010('0x3b')],_0x3d310e[_0x4010('0x66')][_0x4010('0x67')],_0x875562[_0x4010('0x64')]['id'],_0x3d310e[_0x4010('0x54')]?JSON['stringify'](_0x3d310e[_0x4010('0x54')]):_0x4010('0x68'));return respondWithRpcPromise(_0x4010('0x7c'),'rejectMessage',_0x875562);}return null;})['then'](function(_0x56676b){var _0x86bd30='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56676b[_0x4010('0x27')]['ContactId'];return db[_0x4010('0x7d')]['query'](_0x86bd30,{'type':db['Sequelize'][_0x4010('0x7e')][_0x4010('0x6d')],'raw':!![]})['then'](function(_0x31a64a){return _0x31a64a;});})[_0x4010('0x1e')](function(_0x21c193){if(_0x21c193){_0x875562[_0x4010('0x27')]['contact']=_0x21c193[0x0];if(!_0x3d310e[_0x4010('0x54')][_0x4010('0x5e')])return;return db[_0x4010('0x6e')][_0x4010('0x56')]({'where':{'id':_0x3d310e[_0x4010('0x54')][_0x4010('0x5e')],'role':_0x4010('0x5f')},'attributes':['id','name',_0x4010('0x6f'),_0x4010('0x70'),_0x4010('0x7f')],'raw':!![]});}return null;})['then'](function(_0x26258a){if(!_0x26258a)return null;_0x875562['message'][_0x4010('0x5f')]=_0x26258a;return _0x875562;})['then'](function(_0x7606f6){if(_0x7606f6){_0x7606f6[_0x4010('0x27')][_0x4010('0x72')]=util[_0x4010('0x5c')](_0x4010('0x73'),_0x3d310e['user'][_0x4010('0x3b')]);_0x7606f6[_0x4010('0x27')][_0x4010('0x74')]=_0x875562[_0x4010('0x74')];_0x7606f6[_0x4010('0x27')][_0x4010('0x75')]=_0x875562['channel'];_0x7606f6[_0x4010('0x27')][_0x4010('0x76')]=_0x4010('0x7a');respondWithRpcPromise(_0x4010('0x77'),_0x4010('0x77'),{'event':_0x4010('0x80'),'message':_0x7606f6[_0x4010('0x27')]},client9002);return _0x875562;}return null;})[_0x4010('0x1e')](respondWithResult(_0x4b9d68,null))[_0x4010('0x57')](handleError(_0x4b9d68,null));};exports[_0x4010('0x29')]=function(_0x3705bd,_0x8197b6,_0x26b58a){if(_0x3705bd[_0x4010('0x54')]['id']){delete _0x3705bd[_0x4010('0x54')]['id'];}var _0x198659;return db[_0x4010('0x36')]['find']({'where':{'id':_0x3705bd[_0x4010('0x51')]['id']}})['then'](handleEntityNotFound(_0x8197b6,null))[_0x4010('0x1e')](function(_0x22e8ec){if(_0x22e8ec){_0x198659=_0x22e8ec;return db[_0x4010('0x81')][_0x4010('0x56')]({'where':{'id':_0x22e8ec[_0x4010('0x82')]}});}})[_0x4010('0x1e')](handleEntityNotFound(_0x8197b6,null))[_0x4010('0x1e')](function(_0x3f1120){if(_0x3f1120){logger['debug'](_0x4010('0x83'),_0x4010('0x29'),_0x4010('0x84'),_0x3f1120[_0x4010('0x38')],util[_0x4010('0x85')](_0x3705bd[_0x4010('0x54')],{'showHidden':![],'depth':null}));switch(_0x3f1120[_0x4010('0x38')]){case _0x4010('0x86'):if(_0x3705bd[_0x4010('0x54')]['MessageSid']&&_0x3705bd[_0x4010('0x54')][_0x4010('0x87')]===_0x198659[_0x4010('0x88')]&&_0x3705bd['body']['MessageStatus']&&_0x3705bd['body'][_0x4010('0x89')]===_0x4010('0x5b')){return _0x198659[_0x4010('0x32')]({'read':!![]});}else{logger['error'](_0x4010('0x8a'),_0x4010('0x29'),_0x4010('0x86'),util['inspect'](_0x3705bd[_0x4010('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x198659;}})[_0x4010('0x1e')](respondWithResult(_0x8197b6,null))[_0x4010('0x57')](handleError(_0x8197b6,null));}; \ No newline at end of file +var _0xbd64=['acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','twilio','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','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','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','limit','undefined','offset','count','set','apply','reject','save','then','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','create','body','find','describe','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager'];(function(_0x35446e,_0x34f8cc){var _0x50f39b=function(_0x24c306){while(--_0x24c306){_0x35446e['push'](_0x35446e['shift']());}};_0x50f39b(++_0x34f8cc);}(_0xbd64,0x12f));var _0x4bd6=function(_0x1b1654,_0x40eb52){_0x1b1654=_0x1b1654-0x0;var _0x4a1c35=_0xbd64[_0x1b1654];return _0x4a1c35;};'use strict';var emlformat=require(_0x4bd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bd6('0x1'));var jsonpatch=require(_0x4bd6('0x2'));var rp=require(_0x4bd6('0x3'));var moment=require(_0x4bd6('0x4'));var BPromise=require(_0x4bd6('0x5'));var Mustache=require(_0x4bd6('0x6'));var util=require(_0x4bd6('0x7'));var path=require(_0x4bd6('0x8'));var sox=require(_0x4bd6('0x9'));var csv=require(_0x4bd6('0xa'));var ejs=require(_0x4bd6('0xb'));var fs=require('fs');var fs_extra=require(_0x4bd6('0xc'));var _=require(_0x4bd6('0xd'));var squel=require(_0x4bd6('0xe'));var crypto=require(_0x4bd6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4bd6('0x10'));var toCsv=require(_0x4bd6('0xa'));var querystring=require(_0x4bd6('0x11'));var Papa=require(_0x4bd6('0x12'));var Redis=require('ioredis');var authService=require(_0x4bd6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bd6('0x14'));var logger=require(_0x4bd6('0x15'))(_0x4bd6('0x16'));var utils=require(_0x4bd6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4bd6('0x18'));var db=require(_0x4bd6('0x19'))['db'];config[_0x4bd6('0x1a')]=_[_0x4bd6('0x1b')](config[_0x4bd6('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4bd6('0x1c'))(new Redis(config['redis']));require(_0x4bd6('0x1d'))[_0x4bd6('0x1e')](socket);var jayson=require(_0x4bd6('0x1f'));var client=jayson['client'][_0x4bd6('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x4bd6('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1f9ccf,_0x44e0f8,_0x12f795,_0x158153){return new BPromise(function(_0x4e2c42,_0x2a9ee2){var _0x36c003=_0x158153||client;return _0x36c003[_0x4bd6('0x21')](_0x1f9ccf,_0x12f795)['then'](function(_0x2a18a6){logger[_0x4bd6('0x22')](_0x4bd6('0x23'),_0x44e0f8,_0x4bd6('0x24'));logger['debug'](_0x4bd6('0x25'),_0x44e0f8,_0x4bd6('0x24'),JSON[_0x4bd6('0x26')](_0x2a18a6));if(_0x2a18a6[_0x4bd6('0x27')]){if(_0x2a18a6[_0x4bd6('0x27')][_0x4bd6('0x28')]===0x1f4){logger[_0x4bd6('0x27')](_0x4bd6('0x23'),_0x44e0f8,_0x2a18a6[_0x4bd6('0x27')][_0x4bd6('0x29')]);return _0x2a9ee2(_0x2a18a6[_0x4bd6('0x27')][_0x4bd6('0x29')]);}logger[_0x4bd6('0x27')](_0x4bd6('0x23'),_0x44e0f8,_0x2a18a6[_0x4bd6('0x27')][_0x4bd6('0x29')]);return _0x4e2c42(_0x2a18a6['error'][_0x4bd6('0x29')]);}else{logger[_0x4bd6('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x44e0f8,_0x4bd6('0x24'));_0x4e2c42(_0x2a18a6[_0x4bd6('0x2a')][_0x4bd6('0x29')]);}})[_0x4bd6('0x2b')](function(_0x36a7b4){logger[_0x4bd6('0x27')](_0x4bd6('0x23'),_0x44e0f8,_0x36a7b4);_0x2a9ee2(_0x36a7b4);});});}function respondWithStatusCode(_0x304e44,_0x2358d2){_0x2358d2=_0x2358d2||0xcc;return function(_0x2e7302){if(_0x2e7302){return _0x304e44[_0x4bd6('0x2c')](_0x2358d2);}return _0x304e44['status'](_0x2358d2)[_0x4bd6('0x2d')]();};}function respondWithResult(_0x582610,_0x86b87a){_0x86b87a=_0x86b87a||0xc8;return function(_0x556fc2){if(_0x556fc2){return _0x582610[_0x4bd6('0x2e')](_0x86b87a)[_0x4bd6('0x2f')](_0x556fc2);}};}function respondWithFilteredResult(_0x33618f,_0x47b033){return function(_0xbb39ce){if(_0xbb39ce){var _0x1ace58=typeof _0x47b033['offset']==='undefined'&&typeof _0x47b033[_0x4bd6('0x30')]===_0x4bd6('0x31');var _0x362dc7=_0xbb39ce['count'];var _0xebbfc8=_0x1ace58?0x0:_0x47b033[_0x4bd6('0x32')];var _0x1b6157=_0x1ace58?_0xbb39ce[_0x4bd6('0x33')]:_0x47b033['offset']+_0x47b033[_0x4bd6('0x30')];var _0x3f0220;if(_0x1b6157>=_0x362dc7){_0x1b6157=_0x362dc7;_0x3f0220=0xc8;}else{_0x3f0220=0xce;}_0x33618f[_0x4bd6('0x2e')](_0x3f0220);return _0x33618f[_0x4bd6('0x34')]('Content-Range',_0xebbfc8+'-'+_0x1b6157+'/'+_0x362dc7)['json'](_0xbb39ce);}return null;};}function patchUpdates(_0x171b88){return function(_0x1e14f8){try{jsonpatch[_0x4bd6('0x35')](_0x1e14f8,_0x171b88,!![]);}catch(_0xcbfdb4){return BPromise[_0x4bd6('0x36')](_0xcbfdb4);}return _0x1e14f8[_0x4bd6('0x37')]();};}function saveUpdates(_0x49fbe7,_0x43e206){return function(_0x4d740b){if(_0x4d740b){return _0x4d740b['update'](_0x49fbe7)[_0x4bd6('0x38')](function(_0x5d1f99){return _0x5d1f99;});}return null;};}function removeEntity(_0x30490c,_0x1690cb){return function(_0xc1e2e3){if(_0xc1e2e3){return _0xc1e2e3[_0x4bd6('0x39')]()[_0x4bd6('0x38')](function(){_0x30490c[_0x4bd6('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10f581,_0x210d18){return function(_0x53a9d3){if(!_0x53a9d3){_0x10f581[_0x4bd6('0x2c')](0x194);}return _0x53a9d3;};}function handleError(_0x54ee89,_0x3ed615){_0x3ed615=_0x3ed615||0x1f4;return function(_0x2bfe84){logger[_0x4bd6('0x27')](_0x2bfe84[_0x4bd6('0x3a')]);if(_0x2bfe84[_0x4bd6('0x3b')]){delete _0x2bfe84['name'];}_0x54ee89[_0x4bd6('0x2e')](_0x3ed615)[_0x4bd6('0x3c')](_0x2bfe84);};}exports[_0x4bd6('0x3d')]=function(_0x2165e1,_0x4ace0c){var _0x492db0={},_0x2396db={},_0xdced7b={'count':0x0,'rows':[]};var _0x1e9d7a=_[_0x4bd6('0x3e')](db[_0x4bd6('0x3f')][_0x4bd6('0x40')],function(_0x4da688){return{'name':_0x4da688[_0x4bd6('0x41')],'type':_0x4da688['type'][_0x4bd6('0x42')]};});_0x2396db[_0x4bd6('0x43')]=_[_0x4bd6('0x3e')](_0x1e9d7a,'name');_0x2396db['query']=_[_0x4bd6('0x44')](_0x2165e1[_0x4bd6('0x45')]);_0x2396db[_0x4bd6('0x46')]=_[_0x4bd6('0x47')](_0x2396db[_0x4bd6('0x43')],_0x2396db[_0x4bd6('0x45')]);_0x492db0[_0x4bd6('0x48')]=_['intersection'](_0x2396db[_0x4bd6('0x43')],qs[_0x4bd6('0x49')](_0x2165e1[_0x4bd6('0x45')]['fields']));_0x492db0[_0x4bd6('0x48')]=_0x492db0['attributes'][_0x4bd6('0x4a')]?_0x492db0[_0x4bd6('0x48')]:_0x2396db['model'];if(!_0x2165e1['query']['hasOwnProperty'](_0x4bd6('0x4b'))){_0x492db0[_0x4bd6('0x30')]=qs[_0x4bd6('0x30')](_0x2165e1[_0x4bd6('0x45')]['limit']);_0x492db0[_0x4bd6('0x32')]=qs[_0x4bd6('0x32')](_0x2165e1['query']['offset']);}_0x492db0[_0x4bd6('0x4c')]=qs[_0x4bd6('0x4d')](_0x2165e1[_0x4bd6('0x45')][_0x4bd6('0x4d')]);_0x492db0[_0x4bd6('0x4e')]=qs['filters'](_['pick'](_0x2165e1[_0x4bd6('0x45')],_0x2396db['filters']),_0x1e9d7a);if(_0x2165e1[_0x4bd6('0x45')][_0x4bd6('0x4f')]){_0x492db0['where']=_[_0x4bd6('0x50')](_0x492db0[_0x4bd6('0x4e')],{'$or':_['map'](_0x1e9d7a,function(_0x3435f1){if(_0x3435f1[_0x4bd6('0x51')]!==_0x4bd6('0x52')){var _0x5e97fb={};_0x5e97fb[_0x3435f1[_0x4bd6('0x3b')]]={'$like':'%'+_0x2165e1['query'][_0x4bd6('0x4f')]+'%'};return _0x5e97fb;}})});}_0x492db0=_[_0x4bd6('0x50')]({},_0x492db0,_0x2165e1['options']);var _0x2f5b92={'where':_0x492db0[_0x4bd6('0x4e')]};return db[_0x4bd6('0x3f')][_0x4bd6('0x33')](_0x2f5b92)['then'](function(_0x486b8a){_0xdced7b[_0x4bd6('0x33')]=_0x486b8a;if(_0x2165e1[_0x4bd6('0x45')][_0x4bd6('0x53')]){_0x492db0[_0x4bd6('0x54')]=[{'all':!![]}];}return db[_0x4bd6('0x3f')][_0x4bd6('0x55')](_0x492db0);})[_0x4bd6('0x38')](function(_0x21fff4){_0xdced7b[_0x4bd6('0x56')]=_0x21fff4;return _0xdced7b;})[_0x4bd6('0x38')](respondWithFilteredResult(_0x4ace0c,_0x492db0))[_0x4bd6('0x2b')](handleError(_0x4ace0c,null));};exports[_0x4bd6('0x57')]=function(_0x4bc68c,_0x3aa9dd){var _0x34b340={'raw':!![],'where':{'id':_0x4bc68c[_0x4bd6('0x58')]['id']}},_0x42448b={};_0x42448b[_0x4bd6('0x43')]=_[_0x4bd6('0x44')](db[_0x4bd6('0x3f')]['rawAttributes']);_0x42448b[_0x4bd6('0x45')]=_[_0x4bd6('0x44')](_0x4bc68c[_0x4bd6('0x45')]);_0x42448b[_0x4bd6('0x46')]=_[_0x4bd6('0x47')](_0x42448b['model'],_0x42448b['query']);_0x34b340['attributes']=_[_0x4bd6('0x47')](_0x42448b[_0x4bd6('0x43')],qs[_0x4bd6('0x49')](_0x4bc68c['query'][_0x4bd6('0x49')]));_0x34b340[_0x4bd6('0x48')]=_0x34b340[_0x4bd6('0x48')][_0x4bd6('0x4a')]?_0x34b340[_0x4bd6('0x48')]:_0x42448b[_0x4bd6('0x43')];if(_0x4bc68c[_0x4bd6('0x45')][_0x4bd6('0x53')]){_0x34b340[_0x4bd6('0x54')]=[{'all':!![]}];}_0x34b340=_['merge']({},_0x34b340,_0x4bc68c['options']);return db['WhatsappMessage']['find'](_0x34b340)['then'](handleEntityNotFound(_0x3aa9dd,null))[_0x4bd6('0x38')](respondWithResult(_0x3aa9dd,null))[_0x4bd6('0x2b')](handleError(_0x3aa9dd,null));};exports[_0x4bd6('0x59')]=function(_0x505e54,_0x213c2c){return db[_0x4bd6('0x3f')]['create'](_0x505e54[_0x4bd6('0x5a')],{})[_0x4bd6('0x38')](respondWithResult(_0x213c2c,0xc9))[_0x4bd6('0x2b')](handleError(_0x213c2c,null));};exports['update']=function(_0x47afd8,_0x3a75fd){if(_0x47afd8['body']['id']){delete _0x47afd8[_0x4bd6('0x5a')]['id'];}return db[_0x4bd6('0x3f')][_0x4bd6('0x5b')]({'where':{'id':_0x47afd8[_0x4bd6('0x58')]['id']}})[_0x4bd6('0x38')](handleEntityNotFound(_0x3a75fd,null))[_0x4bd6('0x38')](saveUpdates(_0x47afd8[_0x4bd6('0x5a')],null))['then'](respondWithResult(_0x3a75fd,null))[_0x4bd6('0x2b')](handleError(_0x3a75fd,null));};exports[_0x4bd6('0x39')]=function(_0x5b186f,_0x2de1dd){return db[_0x4bd6('0x3f')][_0x4bd6('0x5b')]({'where':{'id':_0x5b186f[_0x4bd6('0x58')]['id']}})[_0x4bd6('0x38')](handleEntityNotFound(_0x2de1dd,null))['then'](removeEntity(_0x2de1dd,null))[_0x4bd6('0x2b')](handleError(_0x2de1dd,null));};exports['describe']=function(_0x43e6f6,_0x440a2e){return db[_0x4bd6('0x3f')][_0x4bd6('0x5c')]()['then'](respondWithResult(_0x440a2e,null))[_0x4bd6('0x2b')](handleError(_0x440a2e,null));};var interaction_log=require(_0x4bd6('0x15'))('whatsapp-interactions');exports[_0x4bd6('0x5d')]=function(_0x61d5f7,_0x470ef4,_0x403c15){var _0x3181ae={'agent':{},'channel':_0x4bd6('0x5e')};if(_0x61d5f7[_0x4bd6('0x5a')]['id']){delete _0x61d5f7[_0x4bd6('0x5a')]['id'];}_0x61d5f7['body']['read']=!![];_0x61d5f7['body'][_0x4bd6('0x5f')]=moment()[_0x4bd6('0x60')](_0x4bd6('0x61'));_0x61d5f7[_0x4bd6('0x5a')]['UserId']=_0x61d5f7[_0x4bd6('0x5a')][_0x4bd6('0x62')]||_0x61d5f7[_0x4bd6('0x63')]['id'];_0x3181ae['agent']['id']=_0x61d5f7[_0x4bd6('0x5a')][_0x4bd6('0x62')];return db['WhatsappMessage'][_0x4bd6('0x5b')]({'where':{'id':_0x61d5f7[_0x4bd6('0x58')]['id'],'UserId':null}})[_0x4bd6('0x38')](handleEntityNotFound(_0x470ef4,null))[_0x4bd6('0x38')](saveUpdates(_0x61d5f7[_0x4bd6('0x5a')],null))[_0x4bd6('0x38')](function(_0x2dc144){if(_0x2dc144){_0x3181ae[_0x4bd6('0x29')]=_0x2dc144[_0x4bd6('0x64')]({'plain':!![]});return db[_0x4bd6('0x65')][_0x4bd6('0x5b')]({'where':{'id':_0x2dc144[_0x4bd6('0x66')]}});}return null;})[_0x4bd6('0x38')](handleEntityNotFound(_0x470ef4,null))[_0x4bd6('0x38')](function(_0x18fc4b){if(_0x18fc4b){return _0x18fc4b[_0x4bd6('0x67')]({'UserId':_0x61d5f7[_0x4bd6('0x5a')][_0x4bd6('0x62')],'read1stAt':_[_0x4bd6('0x68')](_0x18fc4b[_0x4bd6('0x69')])?moment()[_0x4bd6('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4bd6('0x38')](function(_0x5c3909){if(_0x5c3909){_0x3181ae['interaction']=_0x5c3909[_0x4bd6('0x64')]({'plain':!![]});interaction_log[_0x4bd6('0x22')](_0x4bd6('0x6a'),_0x61d5f7[_0x4bd6('0x63')]['id'],_0x61d5f7['user'][_0x4bd6('0x3b')],_0x61d5f7[_0x4bd6('0x63')][_0x4bd6('0x6b')],_0x3181ae['interaction']['id'],_0x61d5f7[_0x4bd6('0x5a')]?JSON[_0x4bd6('0x26')](_0x61d5f7[_0x4bd6('0x5a')]):_0x4bd6('0x6c'));return respondWithRpcPromise(_0x4bd6('0x6d'),_0x4bd6('0x6e'),_0x3181ae);}return null;})[_0x4bd6('0x38')](function(_0x4b1ef5){var _0x142a8a=_0x4bd6('0x6f')+_0x4b1ef5[_0x4bd6('0x29')][_0x4bd6('0x70')];return db[_0x4bd6('0x71')][_0x4bd6('0x45')](_0x142a8a,{'type':db[_0x4bd6('0x72')][_0x4bd6('0x73')][_0x4bd6('0x74')],'raw':!![]})[_0x4bd6('0x38')](function(_0x50c130){return _0x50c130;});})[_0x4bd6('0x38')](function(_0x5daf31){if(_0x5daf31){_0x3181ae[_0x4bd6('0x29')][_0x4bd6('0x75')]=_0x5daf31[0x0];if(!_0x61d5f7[_0x4bd6('0x5a')]['UserId'])return;return db[_0x4bd6('0x76')][_0x4bd6('0x5b')]({'where':{'id':_0x61d5f7['body'][_0x4bd6('0x62')],'role':_0x4bd6('0x77')},'attributes':['id',_0x4bd6('0x3b'),_0x4bd6('0x78'),_0x4bd6('0x79'),_0x4bd6('0x7a')],'raw':!![]});}return null;})['then'](function(_0x49ccd5){if(!_0x49ccd5)return null;_0x3181ae[_0x4bd6('0x29')][_0x4bd6('0x77')]=_0x49ccd5;return _0x3181ae;})[_0x4bd6('0x38')](function(_0x3f0bb8){if(_0x3f0bb8){if(_0x61d5f7[_0x4bd6('0x5a')]['manual']){_0x3181ae[_0x4bd6('0x29')][_0x4bd6('0x7b')]=util[_0x4bd6('0x60')](_0x4bd6('0x7c'),_0x61d5f7[_0x4bd6('0x63')][_0x4bd6('0x3b')]);_0x3181ae[_0x4bd6('0x29')][_0x4bd6('0x7d')]=_0x3181ae[_0x4bd6('0x7d')];_0x3181ae['message'][_0x4bd6('0x7e')]=_0x3181ae[_0x4bd6('0x7d')];_0x3181ae[_0x4bd6('0x29')][_0x4bd6('0x7f')]='accept';return respondWithRpcPromise(_0x4bd6('0x80'),_0x4bd6('0x80'),{'event':_0x4bd6('0x81'),'message':_0x3181ae[_0x4bd6('0x29')]},client9002)['then'](function(){return _0x3181ae;});}return _0x3181ae;}return null;})[_0x4bd6('0x38')](respondWithResult(_0x470ef4,null))[_0x4bd6('0x2b')](handleError(_0x470ef4,null));};var interaction_log=require(_0x4bd6('0x15'))(_0x4bd6('0x82'));exports['reject']=function(_0x1ef6fc,_0x1ea8c2,_0x2ad2a7){var _0x24c9ea={'agent':{},'channel':_0x4bd6('0x5e')};if(_0x1ef6fc[_0x4bd6('0x5a')]['id']){delete _0x1ef6fc[_0x4bd6('0x5a')]['id'];}_0x1ef6fc[_0x4bd6('0x5a')][_0x4bd6('0x62')]=_0x1ef6fc['body'][_0x4bd6('0x62')]||_0x1ef6fc[_0x4bd6('0x63')]['id'];_0x24c9ea[_0x4bd6('0x77')]['id']=_0x1ef6fc[_0x4bd6('0x5a')][_0x4bd6('0x62')];return db['WhatsappMessage'][_0x4bd6('0x5b')]({'where':{'id':_0x1ef6fc[_0x4bd6('0x58')]['id'],'UserId':null}})[_0x4bd6('0x38')](handleEntityNotFound(_0x1ea8c2,null))['then'](function(_0x1cc658){if(_0x1cc658){_0x24c9ea[_0x4bd6('0x29')]=_0x1cc658[_0x4bd6('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x4bd6('0x5b')]({'where':{'id':_0x1cc658[_0x4bd6('0x66')]}});}return null;})[_0x4bd6('0x38')](handleEntityNotFound(_0x1ea8c2,null))[_0x4bd6('0x38')](function(_0x2a2aaf){if(_0x2a2aaf){_0x24c9ea['interaction']=_0x2a2aaf[_0x4bd6('0x64')]({'plain':!![]});interaction_log[_0x4bd6('0x22')](_0x4bd6('0x83'),_0x1ef6fc[_0x4bd6('0x63')]['id'],_0x1ef6fc[_0x4bd6('0x63')][_0x4bd6('0x3b')],_0x1ef6fc['user']['role'],_0x24c9ea[_0x4bd6('0x84')]['id'],_0x1ef6fc[_0x4bd6('0x5a')]?JSON[_0x4bd6('0x26')](_0x1ef6fc[_0x4bd6('0x5a')]):_0x4bd6('0x6c'));return respondWithRpcPromise(_0x4bd6('0x85'),'rejectMessage',_0x24c9ea);}return null;})[_0x4bd6('0x38')](function(_0x425c2b){var _0x47077c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x425c2b[_0x4bd6('0x29')]['ContactId'];return db[_0x4bd6('0x71')]['query'](_0x47077c,{'type':db[_0x4bd6('0x72')][_0x4bd6('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x1d79c1){return _0x1d79c1;});})[_0x4bd6('0x38')](function(_0x16e4f6){if(_0x16e4f6){_0x24c9ea[_0x4bd6('0x29')][_0x4bd6('0x75')]=_0x16e4f6[0x0];if(!_0x1ef6fc[_0x4bd6('0x5a')][_0x4bd6('0x62')])return;return db[_0x4bd6('0x76')]['find']({'where':{'id':_0x1ef6fc['body']['UserId'],'role':_0x4bd6('0x77')},'attributes':['id',_0x4bd6('0x3b'),'fullname',_0x4bd6('0x79'),'internal'],'raw':!![]});}return null;})[_0x4bd6('0x38')](function(_0x13cd39){if(!_0x13cd39)return null;_0x24c9ea[_0x4bd6('0x29')][_0x4bd6('0x77')]=_0x13cd39;return _0x24c9ea;})[_0x4bd6('0x38')](function(_0x5a01ed){if(_0x5a01ed){_0x5a01ed[_0x4bd6('0x29')][_0x4bd6('0x7b')]=util[_0x4bd6('0x60')](_0x4bd6('0x7c'),_0x1ef6fc[_0x4bd6('0x63')][_0x4bd6('0x3b')]);_0x5a01ed[_0x4bd6('0x29')][_0x4bd6('0x7d')]=_0x24c9ea[_0x4bd6('0x7d')];_0x5a01ed[_0x4bd6('0x29')][_0x4bd6('0x7e')]=_0x24c9ea[_0x4bd6('0x7d')];_0x5a01ed[_0x4bd6('0x29')]['event']=_0x4bd6('0x36');respondWithRpcPromise(_0x4bd6('0x80'),_0x4bd6('0x80'),{'event':_0x4bd6('0x86'),'message':_0x5a01ed['message']},client9002);return _0x24c9ea;}return null;})[_0x4bd6('0x38')](respondWithResult(_0x1ea8c2,null))['catch'](handleError(_0x1ea8c2,null));};exports['status']=function(_0x5dd947,_0x3ed4df,_0x5094e7){if(_0x5dd947[_0x4bd6('0x5a')]['id']){delete _0x5dd947[_0x4bd6('0x5a')]['id'];}var _0x2b6c94;return db['WhatsappMessage']['find']({'where':{'id':_0x5dd947['params']['id']}})[_0x4bd6('0x38')](handleEntityNotFound(_0x3ed4df,null))[_0x4bd6('0x38')](function(_0x26b757){if(_0x26b757){_0x2b6c94=_0x26b757;return db[_0x4bd6('0x87')][_0x4bd6('0x5b')]({'where':{'id':_0x26b757[_0x4bd6('0x88')]}});}})[_0x4bd6('0x38')](handleEntityNotFound(_0x3ed4df,null))[_0x4bd6('0x38')](function(_0x5eaf41){if(_0x5eaf41){logger[_0x4bd6('0x89')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x4bd6('0x8a'),_0x5eaf41[_0x4bd6('0x51')],util['inspect'](_0x5dd947[_0x4bd6('0x5a')],{'showHidden':![],'depth':null}));switch(_0x5eaf41[_0x4bd6('0x51')]){case _0x4bd6('0x8b'):if(_0x5dd947['body']['MessageSid']&&_0x5dd947[_0x4bd6('0x5a')]['MessageSid']===_0x2b6c94['messageId']&&_0x5dd947[_0x4bd6('0x5a')][_0x4bd6('0x8c')]&&_0x5dd947[_0x4bd6('0x5a')][_0x4bd6('0x8c')]===_0x4bd6('0x8d')){return _0x2b6c94[_0x4bd6('0x67')]({'read':!![]});}else{logger['error'](_0x4bd6('0x8e'),_0x4bd6('0x2e'),'twilio',util[_0x4bd6('0x8f')](_0x5dd947[_0x4bd6('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2b6c94;}})[_0x4bd6('0x38')](respondWithResult(_0x3ed4df,null))[_0x4bd6('0x2b')](handleError(_0x3ed4df,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a468284..a61bf01 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 _0x3070=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x16ff66,_0x3a65c4){var _0x169038=function(_0x578db1){while(--_0x578db1){_0x16ff66['push'](_0x16ff66['shift']());}};_0x169038(++_0x3a65c4);}(_0x3070,0x75));var _0x0307=function(_0x407c6f,_0x353d42){_0x407c6f=_0x407c6f-0x0;var _0x5b6622=_0x3070[_0x407c6f];return _0x5b6622;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x0307('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0307('0x1')](0x0);var events={'afterCreate':_0x0307('0x2'),'afterUpdate':_0x0307('0x3'),'afterDestroy':_0x0307('0x4')};function emitEvent(_0x3dd3a5){return function(_0xb7229f,_0x5b39b8,_0x5e4edd){WhatsappMessageEvents[_0x0307('0x5')](_0x3dd3a5+':'+_0xb7229f['id'],_0xb7229f);WhatsappMessageEvents[_0x0307('0x5')](_0x3dd3a5,_0xb7229f);_0x5e4edd(null);};}for(var e in events){if(events[_0x0307('0x6')](e)){var event=events[e];WhatsappMessage[_0x0307('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xd547=['hook','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xd547,0x1c1));var _0x7d54=function(_0x23285f,_0x5529ce){_0x23285f=_0x23285f-0x0;var _0x1a5a34=_0xd547[_0x23285f];return _0x1a5a34;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x7d54('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d54('0x1')](0x0);var events={'afterCreate':_0x7d54('0x2'),'afterUpdate':_0x7d54('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ab00b){return function(_0x21c23f,_0x5d21c1,_0x22ea09){WhatsappMessageEvents['emit'](_0x4ab00b+':'+_0x21c23f['id'],_0x21c23f);WhatsappMessageEvents[_0x7d54('0x4')](_0x4ab00b,_0x21c23f);_0x22ea09(null);};}for(var e in events){if(events[_0x7d54('0x5')](e)){var event=events[e];WhatsappMessage[_0x7d54('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 99bfbdb..9b3fdd5 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 _0x2196=['error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid'];(function(_0x233da2,_0x727354){var _0x57d8f5=function(_0x3b3e18){while(--_0x3b3e18){_0x233da2['push'](_0x233da2['shift']());}};_0x57d8f5(++_0x727354);}(_0x2196,0x1ef));var _0x6219=function(_0x27a0a9,_0x1e7dd1){_0x27a0a9=_0x27a0a9-0x0;var _0x11cb3b=_0x2196[_0x27a0a9];return _0x11cb3b;};'use strict';var _=require(_0x6219('0x0'));var util=require(_0x6219('0x1'));var logger=require(_0x6219('0x2'))('api');var moment=require(_0x6219('0x3'));var BPromise=require(_0x6219('0x4'));var rp=require(_0x6219('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x6219('0x6'));var rimraf=require(_0x6219('0x7'));var config=require(_0x6219('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x6219('0x9')]=function(_0x4660c1,_0x26ab21){return _0x4660c1[_0x6219('0xa')](_0x6219('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6219('0xc'),'fields':['messageId']},{'name':_0x6219('0xd'),'fields':[_0x6219('0xe')],'type':_0x6219('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x578fa7,_0x1c8678,_0x1874ae){var _0x3af945=_0x4660c1[_0x6219('0x10')];var _0x1c56bf=_0x578fa7[_0x6219('0x11')]({'plain':!![]});if(_0x1c56bf['direction'][_0x6219('0x12')]()==='in'||_0x1c56bf[_0x6219('0x13')][_0x6219('0x12')]()===_0x6219('0x14')&&!_0x1c56bf[_0x6219('0x15')]&&!_[_0x6219('0x16')](_0x1c56bf[_0x6219('0x17')])){_0x3af945[_0x6219('0x18')][_0x6219('0x19')]({'where':{'id':_0x1c56bf[_0x6219('0x1a')]}})[_0x6219('0x1b')](function(_0x1d2d7e){if(_0x1d2d7e){_0x1d2d7e[_0x6219('0x1c')]({'lastMsgAt':_0x1c56bf[_0x6219('0x1d')],'lastMsgDirection':_0x1c56bf['direction'][_0x6219('0x12')]()});}})[_0x6219('0x1e')](function(_0x16a5be){console['error'](_0x16a5be);});}if(_0x1c56bf[_0x6219('0x13')]===_0x6219('0x14')&&!_0x1c56bf[_0x6219('0x15')]){var _0x336a3b;_0x3af945['WhatsappAccount'][_0x6219('0x1f')]({'where':{'id':_0x1c56bf[_0x6219('0x20')]},'raw':!![]})[_0x6219('0x1b')](function(_0x5be519){_0x336a3b=_0x5be519;if(_0x336a3b&&_0x336a3b['type']){switch(_0x336a3b[_0x6219('0x21')]){case _0x6219('0x22'):var _0x4e5b35=require('twilio');if(_0x336a3b[_0x6219('0x23')]&&_0x336a3b['authToken']&&_0x336a3b[_0x6219('0x24')]){var _0x1528d6=new _0x4e5b35(_0x336a3b['accountSid'],_0x336a3b[_0x6219('0x25')]);_0x1528d6[_0x6219('0x26')][_0x6219('0x27')]({'body':_0x1c56bf[_0x6219('0xe')],'to':'whatsapp:'+_0x1c56bf['phone'],'from':_0x6219('0x28')+_0x336a3b[_0x6219('0x24')],'statusCallback':_0x336a3b[_0x6219('0x29')]+_0x6219('0x2a')+_0x1c56bf['id']+_0x6219('0x2b')+_0x336a3b['token']})[_0x6219('0x1b')](function(_0x2e4a05){if(_0x2e4a05[_0x6219('0x2c')]){return _0x578fa7[_0x6219('0x1c')]({'messageId':_0x2e4a05[_0x6219('0x2c')]});}})[_0x6219('0x1e')](function(_0xe10a96){logger[_0x6219('0x2d')](_0x6219('0x2e'),'afterCreate',_0x6219('0x22'),util['inspect'](_0xe10a96,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6219('0x2e'),_0x6219('0x2f'),_0x6219('0x22'),_0x6219('0x30'));}break;case _0x6219('0x31'):var _0x4f5263=_0x336a3b[_0x6219('0x23')];var _0x539e31=_0x336a3b['authToken'];var _0x4ca1cb=_0x336a3b[_0x6219('0x32')]+_0x6219('0x33')+_0x4f5263+_0x6219('0x34');var _0x3b95b1={'to':[_0x1c56bf[_0x6219('0x24')]],'message':{'type':_0x6219('0x35'),'text':_0x1c56bf['body']}};var _0x49dc72={'method':'POST','uri':_0x4ca1cb,'headers':{'Authorization':'Bearer\x20'+_0x539e31,'Content-Type':_0x6219('0x36')},'body':_0x3b95b1,'json':!![]};rp(_0x49dc72)[_0x6219('0x1b')](function(_0x4e38c7){if(_0x4e38c7[_0x6219('0x37')][0x0]['message_id']){return _0x578fa7[_0x6219('0x1c')]({'messageId':_0x4e38c7[_0x6219('0x37')][0x0][_0x6219('0x38')]});}})['catch'](function(_0x585b88){logger['err'](_0x6219('0x39'),_0x585b88);});break;}}})[_0x6219('0x3a')](function(){_0x1874ae();});}else{_0x1874ae();}}},'charset':_0x6219('0x3b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb58d=['message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','token','then','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb58d,0x1ef));var _0xdb58=function(_0x40ac72,_0x55d051){_0x40ac72=_0x40ac72-0x0;var _0x831a8a=_0xb58d[_0x40ac72];return _0x831a8a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdb58('0x0'));var moment=require(_0xdb58('0x1'));var BPromise=require(_0xdb58('0x2'));var rp=require(_0xdb58('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xdb58('0x4'));var rimraf=require(_0xdb58('0x5'));var config=require(_0xdb58('0x6'));var attributes=require(_0xdb58('0x7'));module['exports']=function(_0x2e3f38,_0x535f1a){return _0x2e3f38[_0xdb58('0x8')](_0xdb58('0x9'),attributes,{'tableName':_0xdb58('0xa'),'paranoid':![],'indexes':[{'name':_0xdb58('0xb'),'fields':[_0xdb58('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0xdb58('0xc')],'type':_0xdb58('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37d14b,_0x1f0e0b,_0x4b3055){var _0x3c6809=_0x2e3f38[_0xdb58('0xe')];var _0x200459=_0x37d14b[_0xdb58('0xf')]({'plain':!![]});if(_0x200459[_0xdb58('0x10')][_0xdb58('0x11')]()==='in'||_0x200459[_0xdb58('0x10')][_0xdb58('0x11')]()===_0xdb58('0x12')&&!_0x200459[_0xdb58('0x13')]&&!_[_0xdb58('0x14')](_0x200459[_0xdb58('0x15')])){_0x3c6809[_0xdb58('0x16')][_0xdb58('0x17')]({'where':{'id':_0x200459[_0xdb58('0x18')]}})['then'](function(_0x9b0b53){if(_0x9b0b53){_0x9b0b53['update']({'lastMsgAt':_0x200459[_0xdb58('0x19')],'lastMsgDirection':_0x200459[_0xdb58('0x10')][_0xdb58('0x11')]()});}})['catch'](function(_0x417d2e){console[_0xdb58('0x1a')](_0x417d2e);});}if(_0x200459[_0xdb58('0x10')]===_0xdb58('0x12')&&!_0x200459[_0xdb58('0x13')]){var _0x1146c9;_0x3c6809[_0xdb58('0x1b')][_0xdb58('0x1c')]({'where':{'id':_0x200459[_0xdb58('0x1d')]},'raw':!![]})['then'](function(_0x2799a4){_0x1146c9=_0x2799a4;if(_0x1146c9&&_0x1146c9[_0xdb58('0x1e')]){switch(_0x1146c9[_0xdb58('0x1e')]){case _0xdb58('0x1f'):var _0x557cf7=require('twilio');if(_0x1146c9[_0xdb58('0x20')]&&_0x1146c9[_0xdb58('0x21')]&&_0x1146c9[_0xdb58('0x22')]){var _0x33ed46=new _0x557cf7(_0x1146c9['accountSid'],_0x1146c9['authToken']);_0x33ed46[_0xdb58('0x23')]['create']({'body':_0x200459[_0xdb58('0xc')],'to':_0xdb58('0x24')+_0x200459[_0xdb58('0x22')],'from':_0xdb58('0x24')+_0x1146c9['phone'],'statusCallback':_0x1146c9[_0xdb58('0x25')]+_0xdb58('0x26')+_0x200459['id']+'/status?token='+_0x1146c9[_0xdb58('0x27')]})[_0xdb58('0x28')](function(_0x21b10e){if(_0x21b10e[_0xdb58('0x29')]){return _0x37d14b['update']({'messageId':_0x21b10e[_0xdb58('0x29')]});}})['catch'](function(_0x37bc4b){logger[_0xdb58('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xdb58('0x2a'),_0xdb58('0x1f'),util[_0xdb58('0x2b')](_0x37bc4b,{'showHidden':![],'depth':null}));});}else{logger[_0xdb58('0x1a')](_0xdb58('0x2c'),_0xdb58('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xdb58('0x2d'):var _0x5189c4=_0x1146c9[_0xdb58('0x20')];var _0x1d5491=_0x1146c9[_0xdb58('0x21')];var _0x58ff15=_0x1146c9[_0xdb58('0x2e')]+_0xdb58('0x2f')+_0x5189c4+_0xdb58('0x30');var _0x25b4dc={'to':[_0x200459[_0xdb58('0x22')]],'message':{'type':_0xdb58('0x31'),'text':_0x200459[_0xdb58('0xc')]}};var _0x336ad2={'method':_0xdb58('0x32'),'uri':_0x58ff15,'headers':{'Authorization':_0xdb58('0x33')+_0x1d5491,'Content-Type':_0xdb58('0x34')},'body':_0x25b4dc,'json':!![]};rp(_0x336ad2)[_0xdb58('0x28')](function(_0x5ffaf2){if(_0x5ffaf2[_0xdb58('0x35')][0x0][_0xdb58('0x36')]){return _0x37d14b['update']({'messageId':_0x5ffaf2[_0xdb58('0x35')][0x0]['message_id']});}})[_0xdb58('0x37')](function(_0x314bfa){logger[_0xdb58('0x38')](_0xdb58('0x39'),_0x314bfa);});break;}}})[_0xdb58('0x3a')](function(){_0x4b3055();});}else{_0x4b3055();}}},'charset':_0xdb58('0x3b'),'collate':_0xdb58('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 4b19bf4..e44940e 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 _0x1d8a=['request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','WhatsappMessage','create','options','CreateWhatsappMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x1d16b3,_0x198237){var _0x37e344=function(_0xaacd74){while(--_0xaacd74){_0x1d16b3['push'](_0x1d16b3['shift']());}};_0x37e344(++_0x198237);}(_0x1d8a,0x12f));var _0xa1d8=function(_0x1b84da,_0x5e570c){_0x1b84da=_0x1b84da-0x0;var _0x23f794=_0x1d8a[_0x1b84da];return _0x23f794;};'use strict';var _=require(_0xa1d8('0x0'));var util=require('util');var moment=require(_0xa1d8('0x1'));var BPromise=require(_0xa1d8('0x2'));var rs=require(_0xa1d8('0x3'));var fs=require('fs');var Redis=require(_0xa1d8('0x4'));var db=require(_0xa1d8('0x5'))['db'];var utils=require(_0xa1d8('0x6'));var logger=require(_0xa1d8('0x7'))(_0xa1d8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa1d8('0x9')]({'port':0x232a});config[_0xa1d8('0xa')]=_['defaults'](config[_0xa1d8('0xa')],{'host':_0xa1d8('0xb'),'port':0x18eb});var socket=require(_0xa1d8('0xc'))(new Redis(config[_0xa1d8('0xa')]));require('./whatsappMessage.socket')[_0xa1d8('0xd')](socket);function respondWithRpcPromise(_0xee8a9f,_0x7edd0e,_0x920918){return new BPromise(function(_0x56c1f3,_0x327cad){return client['request'](_0xee8a9f,_0x920918)[_0xa1d8('0xe')](function(_0x1a90a4){logger[_0xa1d8('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x7edd0e,_0xa1d8('0x10'));logger[_0xa1d8('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7edd0e,'request\x20sent',JSON[_0xa1d8('0x12')](_0x1a90a4));if(_0x1a90a4[_0xa1d8('0x13')]){if(_0x1a90a4['error'][_0xa1d8('0x14')]===0x1f4){logger[_0xa1d8('0x13')](_0xa1d8('0x15'),_0x7edd0e,_0x1a90a4[_0xa1d8('0x13')][_0xa1d8('0x16')]);return _0x327cad(_0x1a90a4[_0xa1d8('0x13')][_0xa1d8('0x16')]);}logger[_0xa1d8('0x13')](_0xa1d8('0x15'),_0x7edd0e,_0x1a90a4[_0xa1d8('0x13')][_0xa1d8('0x16')]);return _0x56c1f3(_0x1a90a4['error'][_0xa1d8('0x16')]);}else{logger[_0xa1d8('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x7edd0e,_0xa1d8('0x10'));_0x56c1f3(_0x1a90a4[_0xa1d8('0x17')]['message']);}})[_0xa1d8('0x18')](function(_0x46a29b){logger[_0xa1d8('0x13')](_0xa1d8('0x15'),_0x7edd0e,_0x46a29b);_0x327cad(_0x46a29b);});});}exports['CreateWhatsappMessage']=function(_0x1d8b33){var _0x58ef40=this;return new Promise(function(_0xef6b41,_0x5a25e2){return db[_0xa1d8('0x19')][_0xa1d8('0x1a')](_0x1d8b33['body'],{'raw':_0x1d8b33['options']?_0x1d8b33[_0xa1d8('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa1d8('0xe')](function(_0x21456f){logger['info']('CreateWhatsappMessage',_0x1d8b33);logger[_0xa1d8('0x11')](_0xa1d8('0x1c'),_0x1d8b33,JSON[_0xa1d8('0x12')](_0x21456f));_0xef6b41(_0x21456f);})[_0xa1d8('0x18')](function(_0x198fa2){logger[_0xa1d8('0x13')](_0xa1d8('0x1c'),_0x198fa2[_0xa1d8('0x16')],_0x1d8b33);_0x5a25e2(_0x58ef40[_0xa1d8('0x13')](0x1f4,_0x198fa2[_0xa1d8('0x16')]));});});}; \ No newline at end of file +var _0x8b36=['http','redis','defaults','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappMessage','create','body','options','then','CreateWhatsappMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x97be3d,_0x3f3bd2){var _0x47ddc4=function(_0x3036ee){while(--_0x3036ee){_0x97be3d['push'](_0x97be3d['shift']());}};_0x47ddc4(++_0x3f3bd2);}(_0x8b36,0xe8));var _0x68b3=function(_0x35ef0e,_0xcd3ea3){_0x35ef0e=_0x35ef0e-0x0;var _0x5e7dec=_0x8b36[_0x35ef0e];return _0x5e7dec;};'use strict';var _=require(_0x68b3('0x0'));var util=require(_0x68b3('0x1'));var moment=require(_0x68b3('0x2'));var BPromise=require(_0x68b3('0x3'));var rs=require(_0x68b3('0x4'));var fs=require('fs');var Redis=require(_0x68b3('0x5'));var db=require(_0x68b3('0x6'))['db'];var utils=require(_0x68b3('0x7'));var logger=require(_0x68b3('0x8'))(_0x68b3('0x9'));var config=require(_0x68b3('0xa'));var jayson=require(_0x68b3('0xb'));var client=jayson[_0x68b3('0xc')][_0x68b3('0xd')]({'port':0x232a});config[_0x68b3('0xe')]=_[_0x68b3('0xf')](config[_0x68b3('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68b3('0xe')]));require(_0x68b3('0x10'))[_0x68b3('0x11')](socket);function respondWithRpcPromise(_0x16feed,_0x2a64e9,_0x37efc2){return new BPromise(function(_0x17e372,_0x42ded9){return client[_0x68b3('0x12')](_0x16feed,_0x37efc2)['then'](function(_0x4b4f05){logger[_0x68b3('0x13')](_0x68b3('0x14'),_0x2a64e9,_0x68b3('0x15'));logger['debug'](_0x68b3('0x16'),_0x2a64e9,_0x68b3('0x15'),JSON[_0x68b3('0x17')](_0x4b4f05));if(_0x4b4f05[_0x68b3('0x18')]){if(_0x4b4f05[_0x68b3('0x18')][_0x68b3('0x19')]===0x1f4){logger[_0x68b3('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x2a64e9,_0x4b4f05['error'][_0x68b3('0x1a')]);return _0x42ded9(_0x4b4f05[_0x68b3('0x18')]['message']);}logger['error'](_0x68b3('0x14'),_0x2a64e9,_0x4b4f05[_0x68b3('0x18')][_0x68b3('0x1a')]);return _0x17e372(_0x4b4f05['error']['message']);}else{logger[_0x68b3('0x13')](_0x68b3('0x14'),_0x2a64e9,_0x68b3('0x15'));_0x17e372(_0x4b4f05['result']['message']);}})[_0x68b3('0x1b')](function(_0x54b055){logger[_0x68b3('0x18')](_0x68b3('0x14'),_0x2a64e9,_0x54b055);_0x42ded9(_0x54b055);});});}exports['CreateWhatsappMessage']=function(_0xad7af8){var _0x443591=this;return new Promise(function(_0x45ba97,_0x2c337f){return db[_0x68b3('0x1c')][_0x68b3('0x1d')](_0xad7af8[_0x68b3('0x1e')],{'raw':_0xad7af8[_0x68b3('0x1f')]?_0xad7af8['options']['raw']===undefined?!![]:![]:!![]})[_0x68b3('0x20')](function(_0x1a5e46){logger['info'](_0x68b3('0x21'),_0xad7af8);logger[_0x68b3('0x22')](_0x68b3('0x21'),_0xad7af8,JSON[_0x68b3('0x17')](_0x1a5e46));_0x45ba97(_0x1a5e46);})['catch'](function(_0x55a8bd){logger['error'](_0x68b3('0x21'),_0x55a8bd['message'],_0xad7af8);_0x2c337f(_0x443591['error'](0x1f4,_0x55a8bd[_0x68b3('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5b340fb..1eab447 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 _0x3101=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','emit'];(function(_0x38b247,_0x34a1c5){var _0x526349=function(_0x23de7d){while(--_0x23de7d){_0x38b247['push'](_0x38b247['shift']());}};_0x526349(++_0x34a1c5);}(_0x3101,0x1a8));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x1310('0x0'));var events=['save',_0x1310('0x1'),'update'];function createListener(_0x2b35fc,_0x8763b3){return function(_0x1df521){_0x8763b3[_0x1310('0x2')](_0x2b35fc,_0x1df521);};}function removeListener(_0x6b4bc2,_0x3a08e6){return function(){WhatsappMessageEvents[_0x1310('0x3')](_0x6b4bc2,_0x3a08e6);};}exports[_0x1310('0x4')]=function(_0xf62d67){for(var _0x28c117=0x0,_0x5834f1=events[_0x1310('0x5')];_0x28c117<_0x5834f1;_0x28c117++){var _0x15f5e6=events[_0x28c117];var _0x5627de=createListener(_0x1310('0x6')+_0x15f5e6,_0xf62d67);WhatsappMessageEvents['on'](_0x15f5e6,_0x5627de);}}; \ No newline at end of file +var _0x45eb=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x5e98c3,_0x328bed){var _0x1683ed=function(_0x382661){while(--_0x382661){_0x5e98c3['push'](_0x5e98c3['shift']());}};_0x1683ed(++_0x328bed);}(_0x45eb,0x11b));var _0xb45e=function(_0x2331ef,_0x2483c1){_0x2331ef=_0x2331ef-0x0;var _0x2370c3=_0x45eb[_0x2331ef];return _0x2370c3;};'use strict';var WhatsappMessageEvents=require(_0xb45e('0x0'));var events=[_0xb45e('0x1'),_0xb45e('0x2'),_0xb45e('0x3')];function createListener(_0x322489,_0x242c2b){return function(_0x25640b){_0x242c2b[_0xb45e('0x4')](_0x322489,_0x25640b);};}function removeListener(_0x51535d,_0x3178b9){return function(){WhatsappMessageEvents[_0xb45e('0x5')](_0x51535d,_0x3178b9);};}exports[_0xb45e('0x6')]=function(_0x420ca2){for(var _0x16e7a6=0x0,_0x12bd30=events[_0xb45e('0x7')];_0x16e7a6<_0x12bd30;_0x16e7a6++){var _0x1efc4e=events[_0x16e7a6];var _0x50c344=createListener(_0xb45e('0x8')+_0x1efc4e,_0x420ca2);WhatsappMessageEvents['on'](_0x1efc4e,_0x50c344);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5cafe9b..49b8623 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 _0x49fb=['post','put','update','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x4a6575,_0x308d97){var _0x5c3561=function(_0x1f664e){while(--_0x1f664e){_0x4a6575['push'](_0x4a6575['shift']());}};_0x5c3561(++_0x308d97);}(_0x49fb,0x10c));var _0xb49f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x49fb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb49f('0x0'));var util=require(_0xb49f('0x1'));var path=require('path');var timeout=require(_0xb49f('0x2'));var express=require(_0xb49f('0x3'));var router=express[_0xb49f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb49f('0x5'));var interaction=require(_0xb49f('0x6'));var config=require('../../config/environment');var controller=require(_0xb49f('0x7'));router[_0xb49f('0x8')]('/',auth[_0xb49f('0x9')](),controller['index']);router['get'](_0xb49f('0xa'),auth['isAuthenticated'](),controller[_0xb49f('0xb')]);router[_0xb49f('0x8')](_0xb49f('0xc'),auth[_0xb49f('0x9')](),controller['show']);router['get'](_0xb49f('0xd'),auth[_0xb49f('0x9')](),controller[_0xb49f('0xe')]);router['get'](_0xb49f('0xf'),auth[_0xb49f('0x9')](),controller[_0xb49f('0x10')]);router[_0xb49f('0x8')]('/:id/users',auth[_0xb49f('0x9')](),controller[_0xb49f('0x11')]);router[_0xb49f('0x12')]('/',auth[_0xb49f('0x9')](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xb49f('0x13')]('/:id',auth[_0xb49f('0x9')](),controller[_0xb49f('0x14')]);router['delete'](_0xb49f('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xb49f('0x15')](_0xb49f('0xf'),auth[_0xb49f('0x9')](),controller[_0xb49f('0x16')]);router[_0xb49f('0x15')](_0xb49f('0x17'),auth[_0xb49f('0x9')](),controller[_0xb49f('0x18')]);module[_0xb49f('0x19')]=router; \ No newline at end of file +var _0x129d=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x40f8b7,_0x39cc49){var _0xcfd3f0=function(_0x391497){while(--_0x391497){_0x40f8b7['push'](_0x40f8b7['shift']());}};_0xcfd3f0(++_0x39cc49);}(_0x129d,0x1b3));var _0xd129=function(_0x385093,_0x44f577){_0x385093=_0x385093-0x0;var _0x50bc92=_0x129d[_0x385093];return _0x50bc92;};'use strict';var multer=require(_0xd129('0x0'));var util=require(_0xd129('0x1'));var path=require(_0xd129('0x2'));var timeout=require(_0xd129('0x3'));var express=require(_0xd129('0x4'));var router=express[_0xd129('0x5')]();var fs_extra=require(_0xd129('0x6'));var auth=require(_0xd129('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xd129('0x8')]('/',auth[_0xd129('0x9')](),controller[_0xd129('0xa')]);router[_0xd129('0x8')](_0xd129('0xb'),auth[_0xd129('0x9')](),controller[_0xd129('0xc')]);router[_0xd129('0x8')](_0xd129('0xd'),auth[_0xd129('0x9')](),controller[_0xd129('0xe')]);router[_0xd129('0x8')](_0xd129('0xf'),auth[_0xd129('0x9')](),controller[_0xd129('0x10')]);router[_0xd129('0x8')](_0xd129('0x11'),auth[_0xd129('0x9')](),controller[_0xd129('0x12')]);router[_0xd129('0x8')](_0xd129('0x13'),auth[_0xd129('0x9')](),controller[_0xd129('0x14')]);router[_0xd129('0x15')]('/',auth[_0xd129('0x9')](),controller[_0xd129('0x16')]);router[_0xd129('0x15')](_0xd129('0x11'),auth['isAuthenticated'](),controller[_0xd129('0x17')]);router[_0xd129('0x15')]('/:id/users',auth[_0xd129('0x9')](),controller[_0xd129('0x18')]);router[_0xd129('0x19')]('/:id',auth[_0xd129('0x9')](),controller[_0xd129('0x1a')]);router[_0xd129('0x1b')](_0xd129('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xd129('0x1b')](_0xd129('0x11'),auth[_0xd129('0x9')](),controller[_0xd129('0x1c')]);router[_0xd129('0x1b')](_0xd129('0x13'),auth[_0xd129('0x9')](),controller['removeAgents']);module[_0xd129('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 52e0001..0d48bef 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 _0xc298=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x54c10d,_0x2f2251){var _0x1fa703=function(_0x508eb4){while(--_0x508eb4){_0x54c10d['push'](_0x54c10d['shift']());}};_0x1fa703(++_0x2f2251);}(_0xc298,0x143));var _0x8c29=function(_0x533012,_0x39e55b){_0x533012=_0x533012-0x0;var _0x4348fb=_0xc298[_0x533012];return _0x4348fb;};'use strict';var Sequelize=require('sequelize');module[_0x8c29('0x0')]={'name':{'type':Sequelize[_0x8c29('0x1')],'unique':_0x8c29('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8c29('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c29('0x4')](_0x8c29('0x5'),'beepall',_0x8c29('0x6'))},'description':{'type':Sequelize[_0x8c29('0x1')]}}; \ No newline at end of file +var _0xd84c=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x90771a,_0x31cd7c){var _0x44c8c4=function(_0x19bf53){while(--_0x19bf53){_0x90771a['push'](_0x90771a['shift']());}};_0x44c8c4(++_0x31cd7c);}(_0xd84c,0x102));var _0xcd84=function(_0x2f3819,_0x1e0039){_0x2f3819=_0x2f3819-0x0;var _0xcb3bf3=_0xd84c[_0x2f3819];return _0xcb3bf3;};'use strict';var Sequelize=require(_0xcd84('0x0'));module[_0xcd84('0x1')]={'name':{'type':Sequelize[_0xcd84('0x2')],'unique':_0xcd84('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcd84('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd84('0x5')](_0xcd84('0x6'),_0xcd84('0x7'),_0xcd84('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f3a1fe9..f5e8d47 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 _0x3e14=['options','UserWhatsappQueue','User','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','union','compact','value','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','index','map','WhatsappQueue','key','getOptions','where','include','query','findAll','catch','show','params','rawAttributes','keys','filters','intersection','model','fields','attributes','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter'];(function(_0x33f31f,_0xd266d3){var _0x4a8f4d=function(_0x55c475){while(--_0x55c475){_0x33f31f['push'](_0x33f31f['shift']());}};_0x4a8f4d(++_0xd266d3);}(_0x3e14,0x9c));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x43e1('0x0'));var util=require(_0x43e1('0x1'));var _=require(_0x43e1('0x2'));var squel=require('squel');var Redis=require(_0x43e1('0x3'));var qs=require(_0x43e1('0x4'));var logger=require(_0x43e1('0x5'))('api');var config=require(_0x43e1('0x6'));var db=require(_0x43e1('0x7'))['db'];config[_0x43e1('0x8')]=_['defaults'](config[_0x43e1('0x8')],{'host':_0x43e1('0x9'),'port':0x18eb});var socket=require(_0x43e1('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x43e1('0xb')](socket);function respondWithStatusCode(_0x43eb49,_0x18ec1f){_0x18ec1f=_0x18ec1f||0xcc;return function(_0x4515fb){if(_0x4515fb){return _0x43eb49[_0x43e1('0xc')](_0x18ec1f);}return _0x43eb49[_0x43e1('0xd')](_0x18ec1f)[_0x43e1('0xe')]();};}function respondWithResult(_0x5d51a1,_0x1670cc){_0x1670cc=_0x1670cc||0xc8;return function(_0x5576eb){if(_0x5576eb){return _0x5d51a1['status'](_0x1670cc)[_0x43e1('0xf')](_0x5576eb);}};}function respondWithFilteredResult(_0x195572,_0x1819a8){return function(_0x517e58){if(_0x517e58){var _0x4d13cb=typeof _0x1819a8[_0x43e1('0x10')]==='undefined'&&typeof _0x1819a8[_0x43e1('0x11')]===_0x43e1('0x12');var _0x2ac7a3=_0x517e58[_0x43e1('0x13')];var _0x3a0fc8=_0x4d13cb?0x0:_0x1819a8['offset'];var _0x416aa5=_0x4d13cb?_0x517e58['count']:_0x1819a8[_0x43e1('0x10')]+_0x1819a8[_0x43e1('0x11')];var _0x310ece;if(_0x416aa5>=_0x2ac7a3){_0x416aa5=_0x2ac7a3;_0x310ece=0xc8;}else{_0x310ece=0xce;}_0x195572[_0x43e1('0xd')](_0x310ece);return _0x195572[_0x43e1('0x14')](_0x43e1('0x15'),_0x3a0fc8+'-'+_0x416aa5+'/'+_0x2ac7a3)['json'](_0x517e58);}return null;};}function saveUpdates(_0x29da52){return function(_0x156400){if(_0x156400){return _0x156400[_0x43e1('0x16')](_0x29da52)[_0x43e1('0x17')](function(_0x6e0093){return _0x6e0093;});}return null;};}function removeEntity(_0x4f6bf6){return function(_0x149985){if(_0x149985){return _0x149985[_0x43e1('0x18')]()['then'](function(){var _0x12455f=_0x149985[_0x43e1('0x19')]({'plain':!![]});var _0x1ebe2f=_0x43e1('0x1a');return db[_0x43e1('0x1b')][_0x43e1('0x18')]({'where':{'type':_0x1ebe2f,'resourceId':_0x12455f['id']}})[_0x43e1('0x17')](function(){return _0x149985;});})[_0x43e1('0x17')](function(){_0x4f6bf6['status'](0xcc)[_0x43e1('0xe')]();});}};}function handleEntityNotFound(_0x18d2dd){return function(_0x52d65d){if(!_0x52d65d){_0x18d2dd['sendStatus'](0x194);}return _0x52d65d;};}function handleError(_0x33f80d,_0x3841b3){_0x3841b3=_0x3841b3||0x1f4;return function(_0x514b81){logger[_0x43e1('0x1c')](_0x514b81['stack']);if(_0x514b81['name']){delete _0x514b81[_0x43e1('0x1d')];}_0x33f80d['status'](_0x3841b3)['send'](_0x514b81);};}exports[_0x43e1('0x1e')]=function(_0x1415ed,_0x191e1b){var _0x21860a={};var _0x5336c6={'count':0x0,'rows':[]};var _0x4eaf15=_[_0x43e1('0x1f')](db[_0x43e1('0x20')]['rawAttributes'],function(_0x2458d5){return{'name':_0x2458d5['fieldName'],'type':_0x2458d5['type'][_0x43e1('0x21')]};});_0x21860a=qs[_0x43e1('0x22')](_0x4eaf15,_0x1415ed);var _0x51e9bb={'where':_0x21860a[_0x43e1('0x23')]};return db[_0x43e1('0x20')][_0x43e1('0x13')](_0x51e9bb)[_0x43e1('0x17')](function(_0x1c9452){_0x5336c6[_0x43e1('0x13')]=_0x1c9452;_0x21860a['include']=qs[_0x43e1('0x24')](_0x1415ed[_0x43e1('0x25')]);return db[_0x43e1('0x20')][_0x43e1('0x26')](_0x21860a);})[_0x43e1('0x17')](function(_0x586a23){_0x5336c6['rows']=_0x586a23;return _0x5336c6;})[_0x43e1('0x17')](respondWithFilteredResult(_0x191e1b,_0x21860a))[_0x43e1('0x27')](handleError(_0x191e1b,null));};exports[_0x43e1('0x28')]=function(_0x1e0f71,_0x153063){var _0x22ec1d={'raw':!![],'where':{'id':_0x1e0f71[_0x43e1('0x29')]['id']}},_0x4185fb={};_0x4185fb['model']=_['keys'](db[_0x43e1('0x20')][_0x43e1('0x2a')]);_0x4185fb[_0x43e1('0x25')]=_[_0x43e1('0x2b')](_0x1e0f71['query']);_0x4185fb[_0x43e1('0x2c')]=_[_0x43e1('0x2d')](_0x4185fb['model'],_0x4185fb[_0x43e1('0x25')]);_0x22ec1d['attributes']=_['intersection'](_0x4185fb[_0x43e1('0x2e')],qs[_0x43e1('0x2f')](_0x1e0f71[_0x43e1('0x25')][_0x43e1('0x2f')]));_0x22ec1d['attributes']=_0x22ec1d[_0x43e1('0x30')][_0x43e1('0x31')]?_0x22ec1d['attributes']:_0x4185fb[_0x43e1('0x2e')];if(_0x1e0f71[_0x43e1('0x25')][_0x43e1('0x32')]){_0x22ec1d[_0x43e1('0x24')]=[{'all':!![]}];}_0x22ec1d=_[_0x43e1('0x33')]({},_0x22ec1d,_0x1e0f71['options']);return db['WhatsappQueue'][_0x43e1('0x34')](_0x22ec1d)[_0x43e1('0x17')](handleEntityNotFound(_0x153063,null))[_0x43e1('0x17')](respondWithResult(_0x153063,null))[_0x43e1('0x27')](handleError(_0x153063,null));};exports[_0x43e1('0x35')]=function(_0x582d86,_0x14cf18){return db[_0x43e1('0x20')]['create'](_0x582d86[_0x43e1('0x36')],{})[_0x43e1('0x17')](function(_0x4dda98){var _0x5b6b18=_0x582d86[_0x43e1('0x37')]['get']({'plain':!![]});if(!_0x5b6b18)throw new Error(_0x43e1('0x38'));if(_0x5b6b18[_0x43e1('0x39')]===_0x43e1('0x37')){var _0x592f98=_0x4dda98[_0x43e1('0x19')]({'plain':!![]});var _0x13b28d=_0x43e1('0x1a');return db[_0x43e1('0x3a')][_0x43e1('0x34')]({'where':{'name':_0x13b28d,'userProfileId':_0x5b6b18['userProfileId']},'raw':!![]})[_0x43e1('0x17')](function(_0x312444){if(_0x312444&&_0x312444['autoAssociation']===0x0){return db[_0x43e1('0x1b')]['create']({'name':_0x592f98['name'],'resourceId':_0x592f98['id'],'type':_0x312444[_0x43e1('0x1d')],'sectionId':_0x312444['id']},{})['then'](function(){return _0x4dda98;});}else{return _0x4dda98;}})[_0x43e1('0x27')](function(_0x4c8b09){logger[_0x43e1('0x1c')](_0x43e1('0x3b'),_0x4c8b09);throw _0x4c8b09;});}return _0x4dda98;})[_0x43e1('0x17')](respondWithResult(_0x14cf18,0xc9))['catch'](handleError(_0x14cf18,null));};exports[_0x43e1('0x16')]=function(_0x50b81a,_0x5e7151){if(_0x50b81a['body']['id']){delete _0x50b81a['body']['id'];}return db['WhatsappQueue'][_0x43e1('0x34')]({'where':{'id':_0x50b81a[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](handleEntityNotFound(_0x5e7151,null))[_0x43e1('0x17')](saveUpdates(_0x50b81a[_0x43e1('0x36')],null))[_0x43e1('0x17')](respondWithResult(_0x5e7151,null))['catch'](handleError(_0x5e7151,null));};exports[_0x43e1('0x18')]=function(_0x1a1668,_0x107e3b){return db[_0x43e1('0x20')][_0x43e1('0x34')]({'where':{'id':_0x1a1668[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](handleEntityNotFound(_0x107e3b,null))[_0x43e1('0x17')](removeEntity(_0x107e3b,null))['catch'](handleError(_0x107e3b,null));};exports[_0x43e1('0x3c')]=function(_0x18acd7,_0x2f3a75){return db['WhatsappQueue'][_0x43e1('0x3c')]()['then'](respondWithResult(_0x2f3a75,null))['catch'](handleError(_0x2f3a75,null));};exports[_0x43e1('0x3d')]=function(_0xb7a1ea,_0x522779){var _0x25c5f5={'raw':!![],'where':{}},_0x521c8e={},_0x477fa9;return db[_0x43e1('0x20')][_0x43e1('0x3e')]({'where':{'id':_0xb7a1ea[_0x43e1('0x29')]['id']}})['then'](handleEntityNotFound(_0x522779,null))[_0x43e1('0x17')](function(_0x4785e2){if(_0x4785e2){_0x477fa9=_0x4785e2[_0x43e1('0x19')]({'plain':!![]});_0x521c8e[_0x43e1('0x2e')]=_[_0x43e1('0x2b')](db['UserWhatsappQueue'][_0x43e1('0x2a')]);_0x521c8e['query']=_[_0x43e1('0x2b')](_0xb7a1ea[_0x43e1('0x25')]);_0x521c8e[_0x43e1('0x2c')]=_['intersection'](_0x521c8e[_0x43e1('0x2e')],_0x521c8e[_0x43e1('0x25')]);_0x25c5f5['attributes']=_[_0x43e1('0x2d')](_0x521c8e[_0x43e1('0x2e')],qs['fields'](_0xb7a1ea['query']['fields']));_0x25c5f5[_0x43e1('0x30')]=_0x25c5f5[_0x43e1('0x30')][_0x43e1('0x31')]?_0x25c5f5[_0x43e1('0x30')]:_0x521c8e[_0x43e1('0x2e')];if(!_0xb7a1ea['query'][_0x43e1('0x3f')](_0x43e1('0x40'))){_0x25c5f5[_0x43e1('0x11')]=qs['limit'](_0xb7a1ea[_0x43e1('0x25')][_0x43e1('0x11')]);_0x25c5f5[_0x43e1('0x10')]=qs[_0x43e1('0x10')](_0xb7a1ea[_0x43e1('0x25')][_0x43e1('0x10')]);}_0x25c5f5[_0x43e1('0x41')]=qs[_0x43e1('0x42')](_0xb7a1ea['query']['sort']);_0x25c5f5[_0x43e1('0x23')]=qs[_0x43e1('0x2c')](_[_0x43e1('0x43')](_0xb7a1ea['query'],_0x521c8e[_0x43e1('0x2c')]));_0x25c5f5[_0x43e1('0x23')][_0x43e1('0x44')]=_0x4785e2['id'];if(_0xb7a1ea[_0x43e1('0x25')][_0x43e1('0x45')]){_0x25c5f5[_0x43e1('0x23')]=_[_0x43e1('0x33')](_0x25c5f5[_0x43e1('0x23')],{'$or':_[_0x43e1('0x1f')](_0x25c5f5[_0x43e1('0x30')],function(_0x45d6a4){var _0x17baea={};_0x17baea[_0x45d6a4]={'$like':'%'+_0xb7a1ea['query'][_0x43e1('0x45')]+'%'};return _0x17baea;})});}_0x25c5f5=_['merge']({},_0x25c5f5,_0xb7a1ea[_0x43e1('0x46')]);return db[_0x43e1('0x47')]['findAll'](_0x25c5f5);}})[_0x43e1('0x17')](function(_0x11fe90){if(_0x11fe90){return db[_0x43e1('0x48')]['findAndCountAll']({'where':{'id':_[_0x43e1('0x1f')](_0x11fe90,_0x43e1('0x49')),'role':'agent'},'attributes':['id',_0x43e1('0x1d'),_0x43e1('0x4a'),_0x43e1('0x4b'),_0x43e1('0x4c')]});}})['then'](function(_0x27a32e){if(_0x27a32e){return{'count':_0x27a32e[_0x43e1('0x13')],'rows':_[_0x43e1('0x1f')](_0x27a32e['rows'],function(_0x14a8f2){return{'membername':_0x14a8f2['name'],'UserId':_0x14a8f2['id'],'queue_name':_0x477fa9[_0x43e1('0x1d')],'WhatsappQueueId':_0x477fa9['id'],'interface':util[_0x43e1('0x4d')](_0x43e1('0x4e'),'SIP',_0x14a8f2[_0x43e1('0x1d')]),'penalty':0x0,'paused':_0x14a8f2[_0x43e1('0x4a')],'createdAt':_0x14a8f2[_0x43e1('0x4c')],'updatedAt':_0x14a8f2[_0x43e1('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x522779,_0x25c5f5))[_0x43e1('0x27')](handleError(_0x522779,null));};exports[_0x43e1('0x4f')]=function(_0x4703d4,_0x38534c){var _0x5d644d={};var _0x2b9b80={};var _0x5e3ce8;var _0x4e4bbf;return db[_0x43e1('0x20')][_0x43e1('0x3e')]({'where':{'id':_0x4703d4[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](handleEntityNotFound(_0x38534c,null))[_0x43e1('0x17')](function(_0x88c3f6){if(_0x88c3f6){_0x5e3ce8=_0x88c3f6;_0x2b9b80[_0x43e1('0x2e')]=_[_0x43e1('0x2b')](db[_0x43e1('0x50')][_0x43e1('0x2a')]);_0x2b9b80['query']=_[_0x43e1('0x2b')](_0x4703d4[_0x43e1('0x25')]);_0x2b9b80['filters']=_[_0x43e1('0x2d')](_0x2b9b80['model'],_0x2b9b80['query']);_0x5d644d['attributes']=_[_0x43e1('0x2d')](_0x2b9b80[_0x43e1('0x2e')],qs[_0x43e1('0x2f')](_0x4703d4['query'][_0x43e1('0x2f')]));_0x5d644d['attributes']=_0x5d644d['attributes'][_0x43e1('0x31')]?_0x5d644d[_0x43e1('0x30')]:_0x2b9b80[_0x43e1('0x2e')];_0x5d644d[_0x43e1('0x41')]=qs[_0x43e1('0x42')](_0x4703d4[_0x43e1('0x25')][_0x43e1('0x42')]);_0x5d644d[_0x43e1('0x23')]=qs['filters'](_[_0x43e1('0x43')](_0x4703d4[_0x43e1('0x25')],_0x2b9b80[_0x43e1('0x2c')]));if(_0x4703d4[_0x43e1('0x25')][_0x43e1('0x45')]){_0x5d644d[_0x43e1('0x23')]=_['merge'](_0x5d644d[_0x43e1('0x23')],{'$or':_['map'](_0x5d644d[_0x43e1('0x30')],function(_0x5b2e76){var _0x4c2e1e={};_0x4c2e1e[_0x5b2e76]={'$like':'%'+_0x4703d4[_0x43e1('0x25')]['filter']+'%'};return _0x4c2e1e;})});}_0x5d644d=_[_0x43e1('0x33')]({},_0x5d644d,_0x4703d4[_0x43e1('0x46')]);return _0x5e3ce8[_0x43e1('0x4f')](_0x5d644d);}})[_0x43e1('0x17')](function(_0xc026d9){if(_0xc026d9){_0x4e4bbf=_0xc026d9['length'];if(!_0x4703d4[_0x43e1('0x25')][_0x43e1('0x3f')](_0x43e1('0x40'))){_0x5d644d[_0x43e1('0x11')]=qs[_0x43e1('0x11')](_0x4703d4['query']['limit']);_0x5d644d[_0x43e1('0x10')]=qs[_0x43e1('0x10')](_0x4703d4[_0x43e1('0x25')][_0x43e1('0x10')]);}return _0x5e3ce8[_0x43e1('0x4f')](_0x5d644d);}})['then'](function(_0x1435bc){if(_0x1435bc){return _0x1435bc?{'count':_0x4e4bbf,'rows':_0x1435bc}:null;}})[_0x43e1('0x17')](respondWithResult(_0x38534c,null))[_0x43e1('0x27')](handleError(_0x38534c,null));};exports['addTeams']=function(_0x2c56f1,_0xb78052){var _0x5c9e99=_0x2c56f1['body'][_0x43e1('0x51')];return db[_0x43e1('0x50')][_0x43e1('0x26')]({'where':{'id':_0x5c9e99},'attributes':['id'],'include':[{'model':db[_0x43e1('0x48')],'as':'Agents','attributes':['id',_0x43e1('0x1d'),_0x43e1('0x52'),'voicePause',_0x43e1('0x53')],'raw':!![]}]})[_0x43e1('0x17')](function(_0x164236){if(_0x164236){var _0x25852f=_[_0x43e1('0x54')](_0x164236,function(_0x5d20e8){var _0x2a0439=_0x5d20e8[_0x43e1('0x19')]({'plain':!![]});return _0x2a0439[_0x43e1('0x55')];});return db[_0x43e1('0x20')]['find']({'where':{'id':_0x2c56f1[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](function(_0x143a16){return db[_0x43e1('0x56')][_0x43e1('0x57')](function(_0x24d54b){return _0x143a16['addTeams'](_0x5c9e99,{'transaction':_0x24d54b})[_0x43e1('0x17')](function(){return BPromise[_0x43e1('0x58')](_0x25852f,function(_0x54fe05){return db[_0x43e1('0x47')][_0x43e1('0x59')]({'where':{'UserId':_0x54fe05['id'],'WhatsappQueueId':_0x2c56f1[_0x43e1('0x29')]['id']},'transaction':_0x24d54b});});})[_0x43e1('0x17')](function(){_0x25852f['forEach'](function(_0x1d1bb5){socket[_0x43e1('0x5a')](_0x43e1('0x5b'),{'UserId':_0x1d1bb5['id'],'WhatsappQueueId':_0x143a16['id']});});});});});}})[_0x43e1('0x17')](respondWithStatusCode(_0xb78052,null))['catch'](handleError(_0xb78052,null));};exports[_0x43e1('0x5c')]=function(_0x318095,_0x4a336f){return db[_0x43e1('0x50')][_0x43e1('0x26')]({'where':{'id':_0x318095[_0x43e1('0x25')][_0x43e1('0x51')]},'attributes':['id'],'include':[{'model':db[_0x43e1('0x48')],'as':_0x43e1('0x55'),'attributes':['id'],'raw':!![]}]})[_0x43e1('0x17')](handleEntityNotFound(_0x4a336f,null))[_0x43e1('0x17')](function(_0x2dfec3){var _0xd43eaf=_['map'](_0x2dfec3,'id');var _0x289d01=[];var _0x33d03e=[];var _0x4623f3=squel[_0x43e1('0x5d')]();_0x4623f3[_0x43e1('0x5e')](_0x43e1('0x5f'))['from']('team_has_whatsapp_queues','tq')[_0x43e1('0x60')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x43e1('0x23')]('WhatsappQueueId\x20=\x20?',_0x318095['params']['id']);for(var _0x298e4f=0x0;_0x298e4f<_0x2dfec3[_0x43e1('0x31')];_0x298e4f+=0x1){let _0x25deff=_0x2dfec3[_0x298e4f];for(var _0x11c386=0x0;_0x11c386<_0x25deff['Agents'][_0x43e1('0x31')];_0x11c386+=0x1){let _0x61a12e=_0x25deff['Agents'][_0x11c386];var _0x145277=_0x4623f3[_0x43e1('0x61')]();_0x145277[_0x43e1('0x23')](_0x43e1('0x62'),_0x61a12e['id']);_0x33d03e[_0x43e1('0x63')](db[_0x43e1('0x56')][_0x43e1('0x25')](_0x145277['toString'](),{'type':db['sequelize'][_0x43e1('0x64')]['SELECT']})[_0x43e1('0x17')](function(_0x2749af){if(_0x2749af[_0x43e1('0x31')]===0x1){return _0x61a12e['id'];}else{var _0x3a1663=_['every'](_[_0x43e1('0x1f')](_0x2749af,_0x43e1('0x65')),function(_0x5c871d){return _['includes'](_0xd43eaf,_0x5c871d);});if(_0x3a1663){return _0x61a12e['id'];}}}));}}return BPromise['all'](_0x33d03e)[_0x43e1('0x17')](function(_0x42c90b){_0x289d01=_(_0x289d01)[_0x43e1('0x66')](_0x42c90b)[_0x43e1('0x67')]()[_0x43e1('0x68')]();return db['WhatsappQueue'][_0x43e1('0x34')]({'where':{'id':_0x318095[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](function(_0x40ed1b){return db[_0x43e1('0x56')]['transaction'](function(_0x3a8d40){return _0x40ed1b[_0x43e1('0x5c')](_0x318095['query'][_0x43e1('0x51')],{'transaction':_0x3a8d40})[_0x43e1('0x17')](function(){if(!_[_0x43e1('0x69')](_0x289d01)){return _0x40ed1b['removeAgents'](_0x289d01,{'transaction':_0x3a8d40});}})['then'](function(){_0x289d01[_0x43e1('0x6a')](function(_0x539795){socket[_0x43e1('0x5a')](_0x43e1('0x6b'),{'UserId':_0x539795,'WhatsappQueueId':_0x40ed1b['id']});});});});});});})[_0x43e1('0x17')](respondWithStatusCode(_0x4a336f,null))[_0x43e1('0x27')](handleError(_0x4a336f,null));};exports[_0x43e1('0x6c')]=function(_0x2c1c8a,_0x202b97){return db[_0x43e1('0x20')][_0x43e1('0x34')]({'where':{'id':_0x2c1c8a[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](handleEntityNotFound(_0x202b97,null))['then'](function(_0x1395d9){if(_0x1395d9){return _0x1395d9[_0x43e1('0x6c')](_0x2c1c8a[_0x43e1('0x36')][_0x43e1('0x51')],_[_0x43e1('0x6d')](_0x2c1c8a['body'],[_0x43e1('0x51'),'id'])||{})['spread'](function(_0x67b2a1){for(var _0xf2796=0x0;_0xf2796<_0x2c1c8a['body']['ids'][_0x43e1('0x31')];_0xf2796+=0x1){socket[_0x43e1('0x5a')](_0x43e1('0x5b'),{'UserId':Number(_0x2c1c8a[_0x43e1('0x36')][_0x43e1('0x51')][_0xf2796]),'WhatsappQueueId':Number(_0x2c1c8a['params']['id'])});}return _0x67b2a1;});}})[_0x43e1('0x17')](respondWithResult(_0x202b97,null))[_0x43e1('0x27')](handleError(_0x202b97,null));};exports[_0x43e1('0x6e')]=function(_0x44c8f4,_0xf5a193){return db[_0x43e1('0x20')][_0x43e1('0x34')]({'where':{'id':_0x44c8f4[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](handleEntityNotFound(_0xf5a193,null))[_0x43e1('0x17')](function(_0x96e0b5){if(_0x96e0b5){return _0x96e0b5['removeAgents'](_0x44c8f4[_0x43e1('0x25')][_0x43e1('0x51')])[_0x43e1('0x17')](function(){if(_[_0x43e1('0x6f')](_0x44c8f4['query'][_0x43e1('0x51')])){for(var _0x3a71f5=0x0;_0x3a71f5<_0x44c8f4[_0x43e1('0x25')]['ids'][_0x43e1('0x31')];_0x3a71f5+=0x1){socket[_0x43e1('0x5a')]('userWhatsappQueue:remove',{'UserId':Number(_0x44c8f4[_0x43e1('0x25')][_0x43e1('0x51')][_0x3a71f5]),'WhatsappQueueId':Number(_0x44c8f4[_0x43e1('0x29')]['id'])});}}else{socket[_0x43e1('0x5a')](_0x43e1('0x6b'),{'UserId':Number(_0x44c8f4['query'][_0x43e1('0x51')]),'WhatsappQueueId':Number(_0x44c8f4[_0x43e1('0x29')]['id'])});}});}})[_0x43e1('0x17')](respondWithStatusCode(_0xf5a193,null))[_0x43e1('0x27')](handleError(_0xf5a193,null));};exports[_0x43e1('0x70')]=function(_0x514b14,_0x58007a){var _0x140eb0={};var _0x1ced72={};var _0x40efe7;var _0xea6b63;return db[_0x43e1('0x20')][_0x43e1('0x3e')]({'where':{'id':_0x514b14[_0x43e1('0x29')]['id']}})[_0x43e1('0x17')](handleEntityNotFound(_0x58007a,null))[_0x43e1('0x17')](function(_0x415523){if(_0x415523){_0x40efe7=_0x415523;_0x1ced72[_0x43e1('0x2e')]=_[_0x43e1('0x2b')](db[_0x43e1('0x48')][_0x43e1('0x2a')]);_0x1ced72['query']=_['keys'](_0x514b14[_0x43e1('0x25')]);_0x1ced72['filters']=_[_0x43e1('0x2d')](_0x1ced72['model'],_0x1ced72['query']);_0x140eb0[_0x43e1('0x30')]=_['intersection'](_0x1ced72['model'],qs[_0x43e1('0x2f')](_0x514b14[_0x43e1('0x25')][_0x43e1('0x2f')]));_0x140eb0[_0x43e1('0x30')]=_0x140eb0[_0x43e1('0x30')][_0x43e1('0x31')]?_0x140eb0[_0x43e1('0x30')]:_0x1ced72[_0x43e1('0x2e')];_0x140eb0[_0x43e1('0x41')]=qs[_0x43e1('0x42')](_0x514b14['query'][_0x43e1('0x42')]);_0x140eb0['where']=qs[_0x43e1('0x2c')](_['pick'](_0x514b14[_0x43e1('0x25')],_0x1ced72[_0x43e1('0x2c')]));if(_0x514b14[_0x43e1('0x25')]['filter']){_0x140eb0[_0x43e1('0x23')]=_[_0x43e1('0x33')](_0x140eb0[_0x43e1('0x23')],{'$or':_['map'](_0x140eb0['attributes'],function(_0x35ca8f){var _0x21a514={};_0x21a514[_0x35ca8f]={'$like':'%'+_0x514b14[_0x43e1('0x25')]['filter']+'%'};return _0x21a514;})});}_0x140eb0=_[_0x43e1('0x33')]({},_0x140eb0,_0x514b14[_0x43e1('0x46')]);return _0x40efe7[_0x43e1('0x70')](_0x140eb0);}})['then'](function(_0x23274a){if(_0x23274a){_0xea6b63=_0x23274a[_0x43e1('0x31')];if(!_0x514b14['query'][_0x43e1('0x3f')](_0x43e1('0x40'))){_0x140eb0[_0x43e1('0x11')]=qs[_0x43e1('0x11')](_0x514b14[_0x43e1('0x25')][_0x43e1('0x11')]);_0x140eb0[_0x43e1('0x10')]=qs['offset'](_0x514b14[_0x43e1('0x25')][_0x43e1('0x10')]);}return _0x40efe7['getAgents'](_0x140eb0);}})[_0x43e1('0x17')](function(_0x1b9faa){if(_0x1b9faa){return _0x1b9faa?{'count':_0xea6b63,'rows':_0x1b9faa}:null;}})[_0x43e1('0x17')](respondWithResult(_0x58007a,null))[_0x43e1('0x27')](handleError(_0x58007a,null));}; \ No newline at end of file +var _0xdd3a=['updatedAt','%s/%s','SIP','whatsappPause','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','each','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','every','TeamId','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','where','include','query','rows','show','params','rawAttributes','keys','filters','intersection','model','fields','attributes','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','merge','options','findAll','User','findAndCountAll','UserId','agent'];(function(_0x2186ad,_0x3a2ce4){var _0x54189d=function(_0x417641){while(--_0x417641){_0x2186ad['push'](_0x2186ad['shift']());}};_0x54189d(++_0x3a2ce4);}(_0xdd3a,0x191));var _0xadd3=function(_0x1f14b4,_0x327dfd){_0x1f14b4=_0x1f14b4-0x0;var _0x5806b9=_0xdd3a[_0x1f14b4];return _0x5806b9;};'use strict';var BPromise=require(_0xadd3('0x0'));var util=require(_0xadd3('0x1'));var _=require(_0xadd3('0x2'));var squel=require(_0xadd3('0x3'));var Redis=require(_0xadd3('0x4'));var qs=require(_0xadd3('0x5'));var logger=require(_0xadd3('0x6'))(_0xadd3('0x7'));var config=require(_0xadd3('0x8'));var db=require(_0xadd3('0x9'))['db'];config['redis']=_[_0xadd3('0xa')](config[_0xadd3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xadd3('0xc'))(new Redis(config[_0xadd3('0xb')]));require(_0xadd3('0xd'))[_0xadd3('0xe')](socket);function respondWithStatusCode(_0x50fd37,_0x2e08ad){_0x2e08ad=_0x2e08ad||0xcc;return function(_0x9095ca){if(_0x9095ca){return _0x50fd37['sendStatus'](_0x2e08ad);}return _0x50fd37['status'](_0x2e08ad)[_0xadd3('0xf')]();};}function respondWithResult(_0x3c187f,_0x5765f0){_0x5765f0=_0x5765f0||0xc8;return function(_0x2af281){if(_0x2af281){return _0x3c187f[_0xadd3('0x10')](_0x5765f0)['json'](_0x2af281);}};}function respondWithFilteredResult(_0x5d4a3c,_0x5134f8){return function(_0x1e5115){if(_0x1e5115){var _0x33f6ba=typeof _0x5134f8[_0xadd3('0x11')]===_0xadd3('0x12')&&typeof _0x5134f8[_0xadd3('0x13')]===_0xadd3('0x12');var _0x48f7fe=_0x1e5115['count'];var _0xc0e665=_0x33f6ba?0x0:_0x5134f8['offset'];var _0x280668=_0x33f6ba?_0x1e5115[_0xadd3('0x14')]:_0x5134f8['offset']+_0x5134f8[_0xadd3('0x13')];var _0x69299f;if(_0x280668>=_0x48f7fe){_0x280668=_0x48f7fe;_0x69299f=0xc8;}else{_0x69299f=0xce;}_0x5d4a3c['status'](_0x69299f);return _0x5d4a3c[_0xadd3('0x15')](_0xadd3('0x16'),_0xc0e665+'-'+_0x280668+'/'+_0x48f7fe)[_0xadd3('0x17')](_0x1e5115);}return null;};}function saveUpdates(_0x630469){return function(_0x48db5b){if(_0x48db5b){return _0x48db5b[_0xadd3('0x18')](_0x630469)[_0xadd3('0x19')](function(_0x23103c){return _0x23103c;});}return null;};}function removeEntity(_0x27e9db){return function(_0x1371e3){if(_0x1371e3){return _0x1371e3[_0xadd3('0x1a')]()[_0xadd3('0x19')](function(){var _0x1d581b=_0x1371e3[_0xadd3('0x1b')]({'plain':!![]});var _0x1aaed3='WhatsappQueues';return db[_0xadd3('0x1c')]['destroy']({'where':{'type':_0x1aaed3,'resourceId':_0x1d581b['id']}})[_0xadd3('0x19')](function(){return _0x1371e3;});})[_0xadd3('0x19')](function(){_0x27e9db[_0xadd3('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d7b43){return function(_0x4e5f72){if(!_0x4e5f72){_0x3d7b43[_0xadd3('0x1d')](0x194);}return _0x4e5f72;};}function handleError(_0xa33cf7,_0x3df8c7){_0x3df8c7=_0x3df8c7||0x1f4;return function(_0x81f406){logger[_0xadd3('0x1e')](_0x81f406[_0xadd3('0x1f')]);if(_0x81f406['name']){delete _0x81f406[_0xadd3('0x20')];}_0xa33cf7['status'](_0x3df8c7)[_0xadd3('0x21')](_0x81f406);};}exports[_0xadd3('0x22')]=function(_0x596c27,_0x13935f){var _0x8e9446={};var _0x4b67a4={'count':0x0,'rows':[]};var _0x23cc0c=_[_0xadd3('0x23')](db[_0xadd3('0x24')]['rawAttributes'],function(_0x1a92b3){return{'name':_0x1a92b3[_0xadd3('0x25')],'type':_0x1a92b3[_0xadd3('0x26')][_0xadd3('0x27')]};});_0x8e9446=qs['getOptions'](_0x23cc0c,_0x596c27);var _0x2b2660={'where':_0x8e9446[_0xadd3('0x28')]};return db[_0xadd3('0x24')][_0xadd3('0x14')](_0x2b2660)[_0xadd3('0x19')](function(_0x69676d){_0x4b67a4['count']=_0x69676d;_0x8e9446['include']=qs[_0xadd3('0x29')](_0x596c27[_0xadd3('0x2a')]);return db[_0xadd3('0x24')]['findAll'](_0x8e9446);})[_0xadd3('0x19')](function(_0x3e1853){_0x4b67a4[_0xadd3('0x2b')]=_0x3e1853;return _0x4b67a4;})[_0xadd3('0x19')](respondWithFilteredResult(_0x13935f,_0x8e9446))['catch'](handleError(_0x13935f,null));};exports[_0xadd3('0x2c')]=function(_0x15a6f7,_0x56f7d5){var _0x302ae6={'raw':!![],'where':{'id':_0x15a6f7[_0xadd3('0x2d')]['id']}},_0xe6e083={};_0xe6e083['model']=_['keys'](db['WhatsappQueue'][_0xadd3('0x2e')]);_0xe6e083[_0xadd3('0x2a')]=_[_0xadd3('0x2f')](_0x15a6f7[_0xadd3('0x2a')]);_0xe6e083[_0xadd3('0x30')]=_[_0xadd3('0x31')](_0xe6e083[_0xadd3('0x32')],_0xe6e083['query']);_0x302ae6['attributes']=_[_0xadd3('0x31')](_0xe6e083[_0xadd3('0x32')],qs[_0xadd3('0x33')](_0x15a6f7[_0xadd3('0x2a')][_0xadd3('0x33')]));_0x302ae6[_0xadd3('0x34')]=_0x302ae6['attributes'][_0xadd3('0x35')]?_0x302ae6[_0xadd3('0x34')]:_0xe6e083[_0xadd3('0x32')];if(_0x15a6f7['query'][_0xadd3('0x36')]){_0x302ae6['include']=[{'all':!![]}];}_0x302ae6=_['merge']({},_0x302ae6,_0x15a6f7['options']);return db[_0xadd3('0x24')][_0xadd3('0x37')](_0x302ae6)[_0xadd3('0x19')](handleEntityNotFound(_0x56f7d5,null))[_0xadd3('0x19')](respondWithResult(_0x56f7d5,null))[_0xadd3('0x38')](handleError(_0x56f7d5,null));};exports[_0xadd3('0x39')]=function(_0x8c949e,_0x50485c){return db[_0xadd3('0x24')]['create'](_0x8c949e[_0xadd3('0x3a')],{})[_0xadd3('0x19')](function(_0xe93893){var _0x1ebcbb=_0x8c949e[_0xadd3('0x3b')][_0xadd3('0x1b')]({'plain':!![]});if(!_0x1ebcbb)throw new Error(_0xadd3('0x3c'));if(_0x1ebcbb[_0xadd3('0x3d')]===_0xadd3('0x3b')){var _0x30a8ea=_0xe93893[_0xadd3('0x1b')]({'plain':!![]});var _0x5e54bc='WhatsappQueues';return db[_0xadd3('0x3e')][_0xadd3('0x37')]({'where':{'name':_0x5e54bc,'userProfileId':_0x1ebcbb[_0xadd3('0x3f')]},'raw':!![]})[_0xadd3('0x19')](function(_0x359916){if(_0x359916&&_0x359916['autoAssociation']===0x0){return db[_0xadd3('0x1c')][_0xadd3('0x39')]({'name':_0x30a8ea[_0xadd3('0x20')],'resourceId':_0x30a8ea['id'],'type':_0x359916[_0xadd3('0x20')],'sectionId':_0x359916['id']},{})['then'](function(){return _0xe93893;});}else{return _0xe93893;}})[_0xadd3('0x38')](function(_0x5dce09){logger[_0xadd3('0x1e')](_0xadd3('0x40'),_0x5dce09);throw _0x5dce09;});}return _0xe93893;})[_0xadd3('0x19')](respondWithResult(_0x50485c,0xc9))[_0xadd3('0x38')](handleError(_0x50485c,null));};exports[_0xadd3('0x18')]=function(_0x4d0f5f,_0xe5ebd2){if(_0x4d0f5f[_0xadd3('0x3a')]['id']){delete _0x4d0f5f[_0xadd3('0x3a')]['id'];}return db[_0xadd3('0x24')][_0xadd3('0x37')]({'where':{'id':_0x4d0f5f[_0xadd3('0x2d')]['id']}})['then'](handleEntityNotFound(_0xe5ebd2,null))[_0xadd3('0x19')](saveUpdates(_0x4d0f5f[_0xadd3('0x3a')],null))[_0xadd3('0x19')](respondWithResult(_0xe5ebd2,null))[_0xadd3('0x38')](handleError(_0xe5ebd2,null));};exports['destroy']=function(_0x1a04a0,_0x5872d7){return db[_0xadd3('0x24')][_0xadd3('0x37')]({'where':{'id':_0x1a04a0[_0xadd3('0x2d')]['id']}})[_0xadd3('0x19')](handleEntityNotFound(_0x5872d7,null))[_0xadd3('0x19')](removeEntity(_0x5872d7,null))['catch'](handleError(_0x5872d7,null));};exports[_0xadd3('0x41')]=function(_0x496ba0,_0x3b5272){return db['WhatsappQueue'][_0xadd3('0x41')]()['then'](respondWithResult(_0x3b5272,null))[_0xadd3('0x38')](handleError(_0x3b5272,null));};exports[_0xadd3('0x42')]=function(_0x266fe7,_0x2970eb){var _0x477e0d={'raw':!![],'where':{}},_0x5ec065={},_0x5c5627;return db['WhatsappQueue'][_0xadd3('0x43')]({'where':{'id':_0x266fe7[_0xadd3('0x2d')]['id']}})[_0xadd3('0x19')](handleEntityNotFound(_0x2970eb,null))[_0xadd3('0x19')](function(_0x23ea30){if(_0x23ea30){_0x5c5627=_0x23ea30['get']({'plain':!![]});_0x5ec065['model']=_[_0xadd3('0x2f')](db[_0xadd3('0x44')][_0xadd3('0x2e')]);_0x5ec065['query']=_[_0xadd3('0x2f')](_0x266fe7[_0xadd3('0x2a')]);_0x5ec065[_0xadd3('0x30')]=_[_0xadd3('0x31')](_0x5ec065[_0xadd3('0x32')],_0x5ec065[_0xadd3('0x2a')]);_0x477e0d['attributes']=_[_0xadd3('0x31')](_0x5ec065[_0xadd3('0x32')],qs[_0xadd3('0x33')](_0x266fe7[_0xadd3('0x2a')][_0xadd3('0x33')]));_0x477e0d[_0xadd3('0x34')]=_0x477e0d[_0xadd3('0x34')][_0xadd3('0x35')]?_0x477e0d['attributes']:_0x5ec065[_0xadd3('0x32')];if(!_0x266fe7[_0xadd3('0x2a')][_0xadd3('0x45')](_0xadd3('0x46'))){_0x477e0d[_0xadd3('0x13')]=qs[_0xadd3('0x13')](_0x266fe7[_0xadd3('0x2a')][_0xadd3('0x13')]);_0x477e0d[_0xadd3('0x11')]=qs['offset'](_0x266fe7[_0xadd3('0x2a')][_0xadd3('0x11')]);}_0x477e0d[_0xadd3('0x47')]=qs['sort'](_0x266fe7[_0xadd3('0x2a')][_0xadd3('0x48')]);_0x477e0d[_0xadd3('0x28')]=qs[_0xadd3('0x30')](_[_0xadd3('0x49')](_0x266fe7[_0xadd3('0x2a')],_0x5ec065[_0xadd3('0x30')]));_0x477e0d[_0xadd3('0x28')][_0xadd3('0x4a')]=_0x23ea30['id'];if(_0x266fe7[_0xadd3('0x2a')][_0xadd3('0x4b')]){_0x477e0d[_0xadd3('0x28')]=_[_0xadd3('0x4c')](_0x477e0d[_0xadd3('0x28')],{'$or':_[_0xadd3('0x23')](_0x477e0d['attributes'],function(_0x48510a){var _0x26f3ca={};_0x26f3ca[_0x48510a]={'$like':'%'+_0x266fe7[_0xadd3('0x2a')][_0xadd3('0x4b')]+'%'};return _0x26f3ca;})});}_0x477e0d=_['merge']({},_0x477e0d,_0x266fe7[_0xadd3('0x4d')]);return db['UserWhatsappQueue'][_0xadd3('0x4e')](_0x477e0d);}})[_0xadd3('0x19')](function(_0x2a3be4){if(_0x2a3be4){return db[_0xadd3('0x4f')][_0xadd3('0x50')]({'where':{'id':_[_0xadd3('0x23')](_0x2a3be4,_0xadd3('0x51')),'role':_0xadd3('0x52')},'attributes':['id',_0xadd3('0x20'),'whatsappPause',_0xadd3('0x53'),'createdAt']});}})[_0xadd3('0x19')](function(_0x405015){if(_0x405015){return{'count':_0x405015[_0xadd3('0x14')],'rows':_[_0xadd3('0x23')](_0x405015[_0xadd3('0x2b')],function(_0x3675e7){return{'membername':_0x3675e7[_0xadd3('0x20')],'UserId':_0x3675e7['id'],'queue_name':_0x5c5627[_0xadd3('0x20')],'WhatsappQueueId':_0x5c5627['id'],'interface':util['format'](_0xadd3('0x54'),_0xadd3('0x55'),_0x3675e7[_0xadd3('0x20')]),'penalty':0x0,'paused':_0x3675e7[_0xadd3('0x56')],'createdAt':_0x3675e7['createdAt'],'updatedAt':_0x3675e7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xadd3('0x19')](respondWithFilteredResult(_0x2970eb,_0x477e0d))['catch'](handleError(_0x2970eb,null));};exports[_0xadd3('0x57')]=function(_0x46aff1,_0x3695d5){var _0x3aac7f={};var _0x17bae8={};var _0x292c32;var _0x533e19;return db[_0xadd3('0x24')]['findOne']({'where':{'id':_0x46aff1['params']['id']}})[_0xadd3('0x19')](handleEntityNotFound(_0x3695d5,null))[_0xadd3('0x19')](function(_0x2cbb36){if(_0x2cbb36){_0x292c32=_0x2cbb36;_0x17bae8[_0xadd3('0x32')]=_[_0xadd3('0x2f')](db[_0xadd3('0x58')][_0xadd3('0x2e')]);_0x17bae8[_0xadd3('0x2a')]=_[_0xadd3('0x2f')](_0x46aff1[_0xadd3('0x2a')]);_0x17bae8['filters']=_[_0xadd3('0x31')](_0x17bae8[_0xadd3('0x32')],_0x17bae8[_0xadd3('0x2a')]);_0x3aac7f[_0xadd3('0x34')]=_[_0xadd3('0x31')](_0x17bae8[_0xadd3('0x32')],qs[_0xadd3('0x33')](_0x46aff1[_0xadd3('0x2a')]['fields']));_0x3aac7f[_0xadd3('0x34')]=_0x3aac7f[_0xadd3('0x34')][_0xadd3('0x35')]?_0x3aac7f[_0xadd3('0x34')]:_0x17bae8['model'];_0x3aac7f[_0xadd3('0x47')]=qs[_0xadd3('0x48')](_0x46aff1['query'][_0xadd3('0x48')]);_0x3aac7f[_0xadd3('0x28')]=qs[_0xadd3('0x30')](_[_0xadd3('0x49')](_0x46aff1[_0xadd3('0x2a')],_0x17bae8[_0xadd3('0x30')]));if(_0x46aff1[_0xadd3('0x2a')][_0xadd3('0x4b')]){_0x3aac7f['where']=_[_0xadd3('0x4c')](_0x3aac7f[_0xadd3('0x28')],{'$or':_[_0xadd3('0x23')](_0x3aac7f[_0xadd3('0x34')],function(_0x2ffff1){var _0x54c2ee={};_0x54c2ee[_0x2ffff1]={'$like':'%'+_0x46aff1['query'][_0xadd3('0x4b')]+'%'};return _0x54c2ee;})});}_0x3aac7f=_[_0xadd3('0x4c')]({},_0x3aac7f,_0x46aff1[_0xadd3('0x4d')]);return _0x292c32[_0xadd3('0x57')](_0x3aac7f);}})[_0xadd3('0x19')](function(_0x5a8a68){if(_0x5a8a68){_0x533e19=_0x5a8a68['length'];if(!_0x46aff1[_0xadd3('0x2a')]['hasOwnProperty'](_0xadd3('0x46'))){_0x3aac7f[_0xadd3('0x13')]=qs['limit'](_0x46aff1[_0xadd3('0x2a')][_0xadd3('0x13')]);_0x3aac7f['offset']=qs[_0xadd3('0x11')](_0x46aff1[_0xadd3('0x2a')][_0xadd3('0x11')]);}return _0x292c32[_0xadd3('0x57')](_0x3aac7f);}})[_0xadd3('0x19')](function(_0x14aa4a){if(_0x14aa4a){return _0x14aa4a?{'count':_0x533e19,'rows':_0x14aa4a}:null;}})[_0xadd3('0x19')](respondWithResult(_0x3695d5,null))[_0xadd3('0x38')](handleError(_0x3695d5,null));};exports[_0xadd3('0x59')]=function(_0xd75e6e,_0x36edc5){var _0xb8070c=_0xd75e6e[_0xadd3('0x3a')][_0xadd3('0x5a')];return db[_0xadd3('0x58')][_0xadd3('0x4e')]({'where':{'id':_0xb8070c},'attributes':['id'],'include':[{'model':db[_0xadd3('0x4f')],'as':'Agents','attributes':['id',_0xadd3('0x20'),_0xadd3('0x5b'),'voicePause',_0xadd3('0x5c')],'raw':!![]}]})[_0xadd3('0x19')](function(_0x466a49){if(_0x466a49){var _0x3e5282=_[_0xadd3('0x5d')](_0x466a49,function(_0x4858d8){var _0x1e8b8f=_0x4858d8[_0xadd3('0x1b')]({'plain':!![]});return _0x1e8b8f[_0xadd3('0x5e')];});return db[_0xadd3('0x24')][_0xadd3('0x37')]({'where':{'id':_0xd75e6e['params']['id']}})['then'](function(_0x2750e5){return db[_0xadd3('0x5f')]['transaction'](function(_0x46e9aa){return _0x2750e5[_0xadd3('0x59')](_0xb8070c,{'transaction':_0x46e9aa})['then'](function(){return BPromise[_0xadd3('0x60')](_0x3e5282,function(_0x491f59){return db[_0xadd3('0x44')]['findOrCreate']({'where':{'UserId':_0x491f59['id'],'WhatsappQueueId':_0xd75e6e[_0xadd3('0x2d')]['id']},'transaction':_0x46e9aa});});})['then'](function(){_0x3e5282['forEach'](function(_0x55f898){socket[_0xadd3('0x61')](_0xadd3('0x62'),{'UserId':_0x55f898['id'],'WhatsappQueueId':_0x2750e5['id']});});});});});}})[_0xadd3('0x19')](respondWithStatusCode(_0x36edc5,null))['catch'](handleError(_0x36edc5,null));};exports[_0xadd3('0x63')]=function(_0x1cd96b,_0x26537d){return db[_0xadd3('0x58')][_0xadd3('0x4e')]({'where':{'id':_0x1cd96b[_0xadd3('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xadd3('0x5e'),'attributes':['id'],'raw':!![]}]})[_0xadd3('0x19')](handleEntityNotFound(_0x26537d,null))[_0xadd3('0x19')](function(_0x56bb70){var _0x638180=_[_0xadd3('0x23')](_0x56bb70,'id');var _0x1f28f3=[];var _0x5522ca=[];var _0x251b96=squel[_0xadd3('0x64')]();_0x251b96['field'](_0xadd3('0x65'))[_0xadd3('0x66')]('team_has_whatsapp_queues','tq')[_0xadd3('0x67')](_0xadd3('0x68'),'ut',_0xadd3('0x69'))[_0xadd3('0x28')]('WhatsappQueueId\x20=\x20?',_0x1cd96b[_0xadd3('0x2d')]['id']);for(var _0x3cec54=0x0;_0x3cec54<_0x56bb70[_0xadd3('0x35')];_0x3cec54+=0x1){let _0x157e00=_0x56bb70[_0x3cec54];for(var _0x134765=0x0;_0x134765<_0x157e00[_0xadd3('0x5e')][_0xadd3('0x35')];_0x134765+=0x1){let _0x32d7f2=_0x157e00[_0xadd3('0x5e')][_0x134765];var _0x1ea7c9=_0x251b96[_0xadd3('0x6a')]();_0x1ea7c9[_0xadd3('0x28')](_0xadd3('0x6b'),_0x32d7f2['id']);_0x5522ca[_0xadd3('0x6c')](db[_0xadd3('0x5f')][_0xadd3('0x2a')](_0x1ea7c9['toString'](),{'type':db[_0xadd3('0x5f')]['QueryTypes']['SELECT']})['then'](function(_0x19a8f6){if(_0x19a8f6[_0xadd3('0x35')]===0x1){return _0x32d7f2['id'];}else{var _0x10ff2b=_[_0xadd3('0x6d')](_[_0xadd3('0x23')](_0x19a8f6,_0xadd3('0x6e')),function(_0x446f8b){return _['includes'](_0x638180,_0x446f8b);});if(_0x10ff2b){return _0x32d7f2['id'];}}}));}}return BPromise['all'](_0x5522ca)[_0xadd3('0x19')](function(_0x292490){_0x1f28f3=_(_0x1f28f3)[_0xadd3('0x6f')](_0x292490)[_0xadd3('0x70')]()[_0xadd3('0x71')]();return db[_0xadd3('0x24')][_0xadd3('0x37')]({'where':{'id':_0x1cd96b[_0xadd3('0x2d')]['id']}})[_0xadd3('0x19')](function(_0x24abad){return db[_0xadd3('0x5f')]['transaction'](function(_0xba6d9b){return _0x24abad[_0xadd3('0x63')](_0x1cd96b['query'][_0xadd3('0x5a')],{'transaction':_0xba6d9b})[_0xadd3('0x19')](function(){if(!_['isEmpty'](_0x1f28f3)){return _0x24abad[_0xadd3('0x72')](_0x1f28f3,{'transaction':_0xba6d9b});}})['then'](function(){_0x1f28f3['forEach'](function(_0x6416f7){socket[_0xadd3('0x61')](_0xadd3('0x73'),{'UserId':_0x6416f7,'WhatsappQueueId':_0x24abad['id']});});});});});});})[_0xadd3('0x19')](respondWithStatusCode(_0x26537d,null))[_0xadd3('0x38')](handleError(_0x26537d,null));};exports[_0xadd3('0x74')]=function(_0xebba31,_0x200dc1){return db[_0xadd3('0x24')][_0xadd3('0x37')]({'where':{'id':_0xebba31['params']['id']}})['then'](handleEntityNotFound(_0x200dc1,null))['then'](function(_0x534552){if(_0x534552){return _0x534552[_0xadd3('0x74')](_0xebba31[_0xadd3('0x3a')][_0xadd3('0x5a')],_[_0xadd3('0x75')](_0xebba31['body'],[_0xadd3('0x5a'),'id'])||{})[_0xadd3('0x76')](function(_0x5b672f){for(var _0x534677=0x0;_0x534677<_0xebba31[_0xadd3('0x3a')][_0xadd3('0x5a')][_0xadd3('0x35')];_0x534677+=0x1){socket[_0xadd3('0x61')](_0xadd3('0x62'),{'UserId':Number(_0xebba31[_0xadd3('0x3a')][_0xadd3('0x5a')][_0x534677]),'WhatsappQueueId':Number(_0xebba31[_0xadd3('0x2d')]['id'])});}return _0x5b672f;});}})['then'](respondWithResult(_0x200dc1,null))['catch'](handleError(_0x200dc1,null));};exports[_0xadd3('0x72')]=function(_0x2d3da5,_0x45d5cd){return db[_0xadd3('0x24')][_0xadd3('0x37')]({'where':{'id':_0x2d3da5[_0xadd3('0x2d')]['id']}})[_0xadd3('0x19')](handleEntityNotFound(_0x45d5cd,null))['then'](function(_0x21664b){if(_0x21664b){return _0x21664b['removeAgents'](_0x2d3da5[_0xadd3('0x2a')][_0xadd3('0x5a')])[_0xadd3('0x19')](function(){if(_[_0xadd3('0x77')](_0x2d3da5['query'][_0xadd3('0x5a')])){for(var _0x4d8ae1=0x0;_0x4d8ae1<_0x2d3da5[_0xadd3('0x2a')][_0xadd3('0x5a')][_0xadd3('0x35')];_0x4d8ae1+=0x1){socket[_0xadd3('0x61')](_0xadd3('0x73'),{'UserId':Number(_0x2d3da5[_0xadd3('0x2a')][_0xadd3('0x5a')][_0x4d8ae1]),'WhatsappQueueId':Number(_0x2d3da5[_0xadd3('0x2d')]['id'])});}}else{socket[_0xadd3('0x61')](_0xadd3('0x73'),{'UserId':Number(_0x2d3da5[_0xadd3('0x2a')][_0xadd3('0x5a')]),'WhatsappQueueId':Number(_0x2d3da5[_0xadd3('0x2d')]['id'])});}});}})[_0xadd3('0x19')](respondWithStatusCode(_0x45d5cd,null))[_0xadd3('0x38')](handleError(_0x45d5cd,null));};exports[_0xadd3('0x78')]=function(_0x308881,_0x36f847){var _0x431e79={};var _0x13c31f={};var _0x2b5140;var _0x274f28;return db[_0xadd3('0x24')][_0xadd3('0x43')]({'where':{'id':_0x308881['params']['id']}})[_0xadd3('0x19')](handleEntityNotFound(_0x36f847,null))[_0xadd3('0x19')](function(_0x3e0967){if(_0x3e0967){_0x2b5140=_0x3e0967;_0x13c31f[_0xadd3('0x32')]=_['keys'](db[_0xadd3('0x4f')][_0xadd3('0x2e')]);_0x13c31f['query']=_[_0xadd3('0x2f')](_0x308881[_0xadd3('0x2a')]);_0x13c31f[_0xadd3('0x30')]=_[_0xadd3('0x31')](_0x13c31f[_0xadd3('0x32')],_0x13c31f[_0xadd3('0x2a')]);_0x431e79['attributes']=_['intersection'](_0x13c31f[_0xadd3('0x32')],qs[_0xadd3('0x33')](_0x308881['query']['fields']));_0x431e79[_0xadd3('0x34')]=_0x431e79['attributes']['length']?_0x431e79[_0xadd3('0x34')]:_0x13c31f['model'];_0x431e79[_0xadd3('0x47')]=qs[_0xadd3('0x48')](_0x308881[_0xadd3('0x2a')][_0xadd3('0x48')]);_0x431e79[_0xadd3('0x28')]=qs['filters'](_[_0xadd3('0x49')](_0x308881['query'],_0x13c31f[_0xadd3('0x30')]));if(_0x308881[_0xadd3('0x2a')][_0xadd3('0x4b')]){_0x431e79[_0xadd3('0x28')]=_[_0xadd3('0x4c')](_0x431e79[_0xadd3('0x28')],{'$or':_[_0xadd3('0x23')](_0x431e79['attributes'],function(_0x47c482){var _0x4ce4a1={};_0x4ce4a1[_0x47c482]={'$like':'%'+_0x308881[_0xadd3('0x2a')][_0xadd3('0x4b')]+'%'};return _0x4ce4a1;})});}_0x431e79=_[_0xadd3('0x4c')]({},_0x431e79,_0x308881[_0xadd3('0x4d')]);return _0x2b5140[_0xadd3('0x78')](_0x431e79);}})[_0xadd3('0x19')](function(_0x1ee6a8){if(_0x1ee6a8){_0x274f28=_0x1ee6a8['length'];if(!_0x308881[_0xadd3('0x2a')][_0xadd3('0x45')](_0xadd3('0x46'))){_0x431e79[_0xadd3('0x13')]=qs['limit'](_0x308881[_0xadd3('0x2a')][_0xadd3('0x13')]);_0x431e79[_0xadd3('0x11')]=qs[_0xadd3('0x11')](_0x308881[_0xadd3('0x2a')][_0xadd3('0x11')]);}return _0x2b5140[_0xadd3('0x78')](_0x431e79);}})['then'](function(_0x2e6c8b){if(_0x2e6c8b){return _0x2e6c8b?{'count':_0x274f28,'rows':_0x2e6c8b}:null;}})['then'](respondWithResult(_0x36f847,null))[_0xadd3('0x38')](handleError(_0x36f847,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 624fd3d..bf98a53 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 _0x3568=['update','remove','hasOwnProperty','hook','events','WhatsappQueue','setMaxListeners'];(function(_0x178b41,_0x13a5ad){var _0x46abc0=function(_0x67cb82){while(--_0x67cb82){_0x178b41['push'](_0x178b41['shift']());}};_0x46abc0(++_0x13a5ad);}(_0x3568,0xb3));var _0x8356=function(_0x380711,_0x274f90){_0x380711=_0x380711-0x0;var _0x23156e=_0x3568[_0x380711];return _0x23156e;};'use strict';var EventEmitter=require(_0x8356('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x8356('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8356('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8356('0x3'),'afterDestroy':_0x8356('0x4')};function emitEvent(_0x2e265e){return function(_0x82d269,_0x499a55,_0x41015e){WhatsappQueueEvents['emit'](_0x2e265e+':'+_0x82d269['id'],_0x82d269);WhatsappQueueEvents['emit'](_0x2e265e,_0x82d269);_0x41015e(null);};}for(var e in events){if(events[_0x8356('0x5')](e)){var event=events[e];WhatsappQueue[_0x8356('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x1f93=['hasOwnProperty','exports','setMaxListeners','emit'];(function(_0x1a512,_0x3e5b57){var _0x2c1c01=function(_0x3046b2){while(--_0x3046b2){_0x1a512['push'](_0x1a512['shift']());}};_0x2c1c01(++_0x3e5b57);}(_0x1f93,0x9a));var _0x31f9=function(_0x32cb2d,_0x49fc9c){_0x32cb2d=_0x32cb2d-0x0;var _0x4e3c74=_0x1f93[_0x32cb2d];return _0x4e3c74;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x31f9('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3c3c9d){return function(_0x41d5ef,_0x246704,_0x5c9283){WhatsappQueueEvents[_0x31f9('0x1')](_0x3c3c9d+':'+_0x41d5ef['id'],_0x41d5ef);WhatsappQueueEvents['emit'](_0x3c3c9d,_0x41d5ef);_0x5c9283(null);};}for(var e in events){if(events[_0x31f9('0x2')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x31f9('0x3')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f3817d1..33cc362 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 _0x77dc=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x77dc,0x18c));var _0xc77d=function(_0xaf342f,_0x297d96){_0xaf342f=_0xaf342f-0x0;var _0x2328b0=_0x77dc[_0xaf342f];return _0x2328b0;};'use strict';var _=require('lodash');var util=require(_0xc77d('0x0'));var logger=require(_0xc77d('0x1'))(_0xc77d('0x2'));var moment=require(_0xc77d('0x3'));var BPromise=require(_0xc77d('0x4'));var rp=require(_0xc77d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc77d('0x6'));var config=require(_0xc77d('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xc77d('0x8')]=function(_0x1e9102,_0x3850df){return _0x1e9102['define'](_0xc77d('0x9'),attributes,{'tableName':_0xc77d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b31=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x592d7c,_0x405966){var _0xaa8d19=function(_0x20a67a){while(--_0x20a67a){_0x592d7c['push'](_0x592d7c['shift']());}};_0xaa8d19(++_0x405966);}(_0x7b31,0xa6));var _0x17b3=function(_0x4f2a1b,_0x2c8343){_0x4f2a1b=_0x4f2a1b-0x0;var _0x5b3f27=_0x7b31[_0x4f2a1b];return _0x5b3f27;};'use strict';var _=require(_0x17b3('0x0'));var util=require(_0x17b3('0x1'));var logger=require(_0x17b3('0x2'))('api');var moment=require(_0x17b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x17b3('0x4'));var fs=require('fs');var path=require(_0x17b3('0x5'));var rimraf=require(_0x17b3('0x6'));var config=require(_0x17b3('0x7'));var attributes=require(_0x17b3('0x8'));module[_0x17b3('0x9')]=function(_0x464056,_0x3f5e44){return _0x464056['define'](_0x17b3('0xa'),attributes,{'tableName':_0x17b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c5d773c..2e8d84c 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 _0xd4b5=['ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','./whatsappQueue.socket','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','stringify','catch','then'];(function(_0x2edd77,_0x20b713){var _0x65ae9=function(_0x1a4fb7){while(--_0x1a4fb7){_0x2edd77['push'](_0x2edd77['shift']());}};_0x65ae9(++_0x20b713);}(_0xd4b5,0x169));var _0x5d4b=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xd4b5[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x5d4b('0x0'));var util=require(_0x5d4b('0x1'));var moment=require(_0x5d4b('0x2'));var BPromise=require(_0x5d4b('0x3'));var rs=require(_0x5d4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d4b('0x5'))['db'];var utils=require(_0x5d4b('0x6'));var logger=require(_0x5d4b('0x7'))('rpc');var config=require(_0x5d4b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5d4b('0x9')]['http']({'port':0x232a});config[_0x5d4b('0xa')]=_[_0x5d4b('0xb')](config['redis'],{'host':_0x5d4b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d4b('0xa')]));require(_0x5d4b('0xd'))['register'](socket);function respondWithRpcPromise(_0x1f5e6a,_0x123b85,_0x28f500){return new BPromise(function(_0x455e2b,_0x37c740){return client['request'](_0x1f5e6a,_0x28f500)['then'](function(_0x5cfe62){logger['info'](_0x5d4b('0xe'),_0x123b85,_0x5d4b('0xf'));logger[_0x5d4b('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x123b85,_0x5d4b('0xf'),JSON['stringify'](_0x5cfe62));if(_0x5cfe62[_0x5d4b('0x11')]){if(_0x5cfe62[_0x5d4b('0x11')][_0x5d4b('0x12')]===0x1f4){logger[_0x5d4b('0x11')](_0x5d4b('0xe'),_0x123b85,_0x5cfe62[_0x5d4b('0x11')][_0x5d4b('0x13')]);return _0x37c740(_0x5cfe62[_0x5d4b('0x11')][_0x5d4b('0x13')]);}logger[_0x5d4b('0x11')](_0x5d4b('0xe'),_0x123b85,_0x5cfe62[_0x5d4b('0x11')][_0x5d4b('0x13')]);return _0x455e2b(_0x5cfe62[_0x5d4b('0x11')][_0x5d4b('0x13')]);}else{logger[_0x5d4b('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x123b85,'request\x20sent');_0x455e2b(_0x5cfe62[_0x5d4b('0x15')][_0x5d4b('0x13')]);}})['catch'](function(_0x2f056d){logger['error'](_0x5d4b('0xe'),_0x123b85,_0x2f056d);_0x37c740(_0x2f056d);});});}exports[_0x5d4b('0x16')]=function(_0x3af453){var _0x2b70e3=this;return new Promise(function(_0x369395,_0x28e3c6){return db[_0x5d4b('0x17')][_0x5d4b('0x18')]({'raw':_0x3af453[_0x5d4b('0x19')]?_0x3af453['options'][_0x5d4b('0x1a')]===undefined?!![]:![]:!![],'where':_0x3af453[_0x5d4b('0x19')]?_0x3af453['options'][_0x5d4b('0x1b')]||null:null,'attributes':_0x3af453[_0x5d4b('0x19')]?_0x3af453[_0x5d4b('0x19')][_0x5d4b('0x1c')]||null:null,'limit':_0x3af453['options']?_0x3af453[_0x5d4b('0x19')]['limit']||null:null,'include':_0x3af453[_0x5d4b('0x19')]?_0x3af453[_0x5d4b('0x19')][_0x5d4b('0x1d')]?_[_0x5d4b('0x1e')](_0x3af453[_0x5d4b('0x19')][_0x5d4b('0x1d')],function(_0x1cb85e){return{'model':db[_0x1cb85e[_0x5d4b('0x1f')]],'as':_0x1cb85e['as'],'attributes':_0x1cb85e[_0x5d4b('0x1c')],'include':_0x1cb85e[_0x5d4b('0x1d')]?_[_0x5d4b('0x1e')](_0x1cb85e['include'],function(_0x36eb62){return{'model':db[_0x36eb62['model']],'as':_0x36eb62['as'],'attributes':_0x36eb62['attributes'],'include':_0x36eb62['include']?_[_0x5d4b('0x1e')](_0x36eb62[_0x5d4b('0x1d')],function(_0x25ded6){return{'model':db[_0x25ded6[_0x5d4b('0x1f')]],'as':_0x25ded6['as'],'attributes':_0x25ded6[_0x5d4b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bc5dc){logger['info'](_0x5d4b('0x16'),_0x3af453);logger[_0x5d4b('0x10')](_0x5d4b('0x16'),_0x3af453,JSON[_0x5d4b('0x20')](_0x1bc5dc));_0x369395(_0x1bc5dc);})[_0x5d4b('0x21')](function(_0x1cad63){logger[_0x5d4b('0x11')]('GetWhatsappQueue',_0x1cad63[_0x5d4b('0x13')],_0x3af453);_0x28e3c6(_0x2b70e3[_0x5d4b('0x11')](0x1f4,_0x1cad63[_0x5d4b('0x13')]));});});};exports['ShowWhatsappQueue']=function(_0x350210){var _0x152f2a=this;return new Promise(function(_0x1d82cb,_0x3680eb){return db[_0x5d4b('0x17')]['find']({'raw':_0x350210[_0x5d4b('0x19')]?_0x350210[_0x5d4b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x350210[_0x5d4b('0x19')]?_0x350210[_0x5d4b('0x19')][_0x5d4b('0x1b')]||null:null,'attributes':_0x350210['options']?_0x350210[_0x5d4b('0x19')][_0x5d4b('0x1c')]||null:null,'include':_0x350210[_0x5d4b('0x19')]?_0x350210[_0x5d4b('0x19')][_0x5d4b('0x1d')]?_['map'](_0x350210[_0x5d4b('0x19')][_0x5d4b('0x1d')],function(_0x365481){return{'model':db[_0x365481[_0x5d4b('0x1f')]],'as':_0x365481['as'],'attributes':_0x365481[_0x5d4b('0x1c')],'include':_0x365481['include']?_['map'](_0x365481['include'],function(_0x43df1b){return{'model':db[_0x43df1b[_0x5d4b('0x1f')]],'as':_0x43df1b['as'],'attributes':_0x43df1b[_0x5d4b('0x1c')],'include':_0x43df1b[_0x5d4b('0x1d')]?_[_0x5d4b('0x1e')](_0x43df1b['include'],function(_0x210b1d){return{'model':db[_0x210b1d[_0x5d4b('0x1f')]],'as':_0x210b1d['as'],'attributes':_0x210b1d[_0x5d4b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5d4b('0x22')](function(_0x4db1c0){logger[_0x5d4b('0x14')](_0x5d4b('0x23'),_0x350210);logger[_0x5d4b('0x10')](_0x5d4b('0x23'),_0x350210,JSON[_0x5d4b('0x20')](_0x4db1c0));_0x1d82cb(_0x4db1c0);})[_0x5d4b('0x21')](function(_0x159836){logger[_0x5d4b('0x11')]('ShowWhatsappQueue',_0x159836[_0x5d4b('0x13')],_0x350210);_0x3680eb(_0x152f2a['error'](0x1f4,_0x159836[_0x5d4b('0x13')]));});});}; \ No newline at end of file +var _0x2dd6=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','include','map','model','ShowWhatsappQueue','find','then','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2dd6,0xb3));var _0x62dd=function(_0x4043ce,_0x175dcc){_0x4043ce=_0x4043ce-0x0;var _0x191365=_0x2dd6[_0x4043ce];return _0x191365;};'use strict';var _=require(_0x62dd('0x0'));var util=require(_0x62dd('0x1'));var moment=require(_0x62dd('0x2'));var BPromise=require('bluebird');var rs=require(_0x62dd('0x3'));var fs=require('fs');var Redis=require(_0x62dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x62dd('0x5'));var logger=require(_0x62dd('0x6'))(_0x62dd('0x7'));var config=require(_0x62dd('0x8'));var jayson=require(_0x62dd('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x62dd('0xa')]=_[_0x62dd('0xb')](config[_0x62dd('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62dd('0xa')]));require(_0x62dd('0xc'))[_0x62dd('0xd')](socket);function respondWithRpcPromise(_0x484823,_0x27dde9,_0x2951a6){return new BPromise(function(_0x14fae2,_0xf21368){return client[_0x62dd('0xe')](_0x484823,_0x2951a6)['then'](function(_0x12d482){logger['info'](_0x62dd('0xf'),_0x27dde9,_0x62dd('0x10'));logger[_0x62dd('0x11')](_0x62dd('0x12'),_0x27dde9,_0x62dd('0x10'),JSON[_0x62dd('0x13')](_0x12d482));if(_0x12d482[_0x62dd('0x14')]){if(_0x12d482[_0x62dd('0x14')]['code']===0x1f4){logger[_0x62dd('0x14')](_0x62dd('0xf'),_0x27dde9,_0x12d482[_0x62dd('0x14')][_0x62dd('0x15')]);return _0xf21368(_0x12d482[_0x62dd('0x14')]['message']);}logger[_0x62dd('0x14')](_0x62dd('0xf'),_0x27dde9,_0x12d482[_0x62dd('0x14')][_0x62dd('0x15')]);return _0x14fae2(_0x12d482[_0x62dd('0x14')][_0x62dd('0x15')]);}else{logger[_0x62dd('0x16')](_0x62dd('0xf'),_0x27dde9,_0x62dd('0x10'));_0x14fae2(_0x12d482[_0x62dd('0x17')][_0x62dd('0x15')]);}})['catch'](function(_0x76b092){logger[_0x62dd('0x14')](_0x62dd('0xf'),_0x27dde9,_0x76b092);_0xf21368(_0x76b092);});});}exports[_0x62dd('0x18')]=function(_0x262c43){var _0x285f96=this;return new Promise(function(_0x5e8429,_0x170c1f){return db[_0x62dd('0x19')][_0x62dd('0x1a')]({'raw':_0x262c43['options']?_0x262c43[_0x62dd('0x1b')][_0x62dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x262c43['options']?_0x262c43[_0x62dd('0x1b')]['where']||null:null,'attributes':_0x262c43[_0x62dd('0x1b')]?_0x262c43[_0x62dd('0x1b')][_0x62dd('0x1d')]||null:null,'limit':_0x262c43[_0x62dd('0x1b')]?_0x262c43[_0x62dd('0x1b')]['limit']||null:null,'include':_0x262c43[_0x62dd('0x1b')]?_0x262c43[_0x62dd('0x1b')][_0x62dd('0x1e')]?_[_0x62dd('0x1f')](_0x262c43[_0x62dd('0x1b')][_0x62dd('0x1e')],function(_0x1d4408){return{'model':db[_0x1d4408['model']],'as':_0x1d4408['as'],'attributes':_0x1d4408[_0x62dd('0x1d')],'include':_0x1d4408[_0x62dd('0x1e')]?_[_0x62dd('0x1f')](_0x1d4408['include'],function(_0x2e459a){return{'model':db[_0x2e459a[_0x62dd('0x20')]],'as':_0x2e459a['as'],'attributes':_0x2e459a[_0x62dd('0x1d')],'include':_0x2e459a[_0x62dd('0x1e')]?_[_0x62dd('0x1f')](_0x2e459a['include'],function(_0x3cb043){return{'model':db[_0x3cb043[_0x62dd('0x20')]],'as':_0x3cb043['as'],'attributes':_0x3cb043[_0x62dd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34cfd5){logger[_0x62dd('0x16')](_0x62dd('0x18'),_0x262c43);logger[_0x62dd('0x11')](_0x62dd('0x18'),_0x262c43,JSON[_0x62dd('0x13')](_0x34cfd5));_0x5e8429(_0x34cfd5);})['catch'](function(_0x39e1e9){logger[_0x62dd('0x14')](_0x62dd('0x18'),_0x39e1e9['message'],_0x262c43);_0x170c1f(_0x285f96['error'](0x1f4,_0x39e1e9[_0x62dd('0x15')]));});});};exports[_0x62dd('0x21')]=function(_0xd48169){var _0x2081e7=this;return new Promise(function(_0x415d84,_0x46e05c){return db[_0x62dd('0x19')][_0x62dd('0x22')]({'raw':_0xd48169[_0x62dd('0x1b')]?_0xd48169[_0x62dd('0x1b')][_0x62dd('0x1c')]===undefined?!![]:![]:!![],'where':_0xd48169[_0x62dd('0x1b')]?_0xd48169['options']['where']||null:null,'attributes':_0xd48169[_0x62dd('0x1b')]?_0xd48169[_0x62dd('0x1b')][_0x62dd('0x1d')]||null:null,'include':_0xd48169[_0x62dd('0x1b')]?_0xd48169[_0x62dd('0x1b')][_0x62dd('0x1e')]?_[_0x62dd('0x1f')](_0xd48169[_0x62dd('0x1b')][_0x62dd('0x1e')],function(_0x38c3aa){return{'model':db[_0x38c3aa[_0x62dd('0x20')]],'as':_0x38c3aa['as'],'attributes':_0x38c3aa['attributes'],'include':_0x38c3aa[_0x62dd('0x1e')]?_[_0x62dd('0x1f')](_0x38c3aa[_0x62dd('0x1e')],function(_0x3bc370){return{'model':db[_0x3bc370['model']],'as':_0x3bc370['as'],'attributes':_0x3bc370[_0x62dd('0x1d')],'include':_0x3bc370[_0x62dd('0x1e')]?_[_0x62dd('0x1f')](_0x3bc370[_0x62dd('0x1e')],function(_0x51a414){return{'model':db[_0x51a414[_0x62dd('0x20')]],'as':_0x51a414['as'],'attributes':_0x51a414['attributes']};}):[]};}):[]};}):[]:[]})[_0x62dd('0x23')](function(_0x3853c0){logger[_0x62dd('0x16')](_0x62dd('0x21'),_0xd48169);logger[_0x62dd('0x11')](_0x62dd('0x21'),_0xd48169,JSON[_0x62dd('0x13')](_0x3853c0));_0x415d84(_0x3853c0);})[_0x62dd('0x24')](function(_0x2f381c){logger[_0x62dd('0x14')]('ShowWhatsappQueue',_0x2f381c['message'],_0xd48169);_0x46e05c(_0x2081e7['error'](0x1f4,_0x2f381c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b0933a3..563b0ca 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 _0xff6c=['whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x50269b,_0x574be7){var _0x17773a=function(_0x5b3e57){while(--_0x5b3e57){_0x50269b['push'](_0x50269b['shift']());}};_0x17773a(++_0x574be7);}(_0xff6c,0xe8));var _0xcff6=function(_0x3e149a,_0x2cfd8c){_0x3e149a=_0x3e149a-0x0;var _0x229fad=_0xff6c[_0x3e149a];return _0x229fad;};'use strict';var WhatsappQueueEvents=require(_0xcff6('0x0'));var events=[_0xcff6('0x1'),_0xcff6('0x2'),_0xcff6('0x3')];function createListener(_0x360021,_0x577149){return function(_0x4eddcf){_0x577149['emit'](_0x360021,_0x4eddcf);};}function removeListener(_0x2a75d0,_0x193bcd){return function(){WhatsappQueueEvents[_0xcff6('0x4')](_0x2a75d0,_0x193bcd);};}exports[_0xcff6('0x5')]=function(_0x7c39de){for(var _0x21bd8d=0x0,_0x4e0d17=events['length'];_0x21bd8d<_0x4e0d17;_0x21bd8d++){var _0x57cb80=events[_0x21bd8d];var _0xac6e61=createListener(_0xcff6('0x6')+_0x57cb80,_0x7c39de);WhatsappQueueEvents['on'](_0x57cb80,_0xac6e61);}}; \ No newline at end of file +var _0x1296=['emit','register','length','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x4af4b1,_0x49be70){var _0x18a76e=function(_0x4cbc08){while(--_0x4cbc08){_0x4af4b1['push'](_0x4af4b1['shift']());}};_0x18a76e(++_0x49be70);}(_0x1296,0x18c));var _0x6129=function(_0x2546de,_0x2b155d){_0x2546de=_0x2546de-0x0;var _0x374ba5=_0x1296[_0x2546de];return _0x374ba5;};'use strict';var WhatsappQueueEvents=require(_0x6129('0x0'));var events=[_0x6129('0x1'),'remove',_0x6129('0x2')];function createListener(_0x45cfbf,_0x5006e3){return function(_0x1724fa){_0x5006e3[_0x6129('0x3')](_0x45cfbf,_0x1724fa);};}function removeListener(_0x20dc33,_0x58e5f1){return function(){WhatsappQueueEvents['removeListener'](_0x20dc33,_0x58e5f1);};}exports[_0x6129('0x4')]=function(_0x179867){for(var _0x259c0a=0x0,_0x3a3f13=events[_0x6129('0x5')];_0x259c0a<_0x3a3f13;_0x259c0a++){var _0x499159=events[_0x259c0a];var _0x17ecec=createListener(_0x6129('0x6')+_0x499159,_0x179867);WhatsappQueueEvents['on'](_0x499159,_0x17ecec);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c3d4c0c..afc48b2 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 _0x3632=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x3632,0x8b));var _0x2363=function(_0x303b9b,_0xe17713){_0x303b9b=_0x303b9b-0x0;var _0xfd5b99=_0x3632[_0x303b9b];return _0xfd5b99;};'use strict';var multer=require(_0x2363('0x0'));var util=require('util');var path=require(_0x2363('0x1'));var timeout=require('connect-timeout');var express=require(_0x2363('0x2'));var router=express[_0x2363('0x3')]();var fs_extra=require(_0x2363('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2363('0x5'));var config=require(_0x2363('0x6'));var controller=require(_0x2363('0x7'));router['get']('/',auth[_0x2363('0x8')](),controller[_0x2363('0x9')]);router[_0x2363('0xa')](_0x2363('0xb'),auth[_0x2363('0x8')](),controller['describe']);router[_0x2363('0xa')](_0x2363('0xc'),auth[_0x2363('0x8')](),controller[_0x2363('0xd')]);router[_0x2363('0xe')]('/',auth[_0x2363('0x8')](),controller[_0x2363('0xf')]);router[_0x2363('0x10')]('/:id',auth[_0x2363('0x8')](),controller['update']);router[_0x2363('0x11')](_0x2363('0xc'),auth[_0x2363('0x8')](),controller[_0x2363('0x12')]);module[_0x2363('0x13')]=router; \ No newline at end of file +var _0x1394=['util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x367f0a,_0x43263a){var _0x334abb=function(_0x26b74f){while(--_0x26b74f){_0x367f0a['push'](_0x367f0a['shift']());}};_0x334abb(++_0x43263a);}(_0x1394,0xb3));var _0x4139=function(_0x92a719,_0x1b0051){_0x92a719=_0x92a719-0x0;var _0x4849d0=_0x1394[_0x92a719];return _0x4849d0;};'use strict';var multer=require(_0x4139('0x0'));var util=require(_0x4139('0x1'));var path=require(_0x4139('0x2'));var timeout=require('connect-timeout');var express=require(_0x4139('0x3'));var router=express['Router']();var fs_extra=require(_0x4139('0x4'));var auth=require(_0x4139('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4139('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x4139('0x7')]('/',auth[_0x4139('0x8')](),controller[_0x4139('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4139('0xa')]);router[_0x4139('0x7')](_0x4139('0xb'),auth[_0x4139('0x8')](),controller[_0x4139('0xc')]);router[_0x4139('0xd')]('/',auth[_0x4139('0x8')](),controller[_0x4139('0xe')]);router['put'](_0x4139('0xb'),auth[_0x4139('0x8')](),controller[_0x4139('0xf')]);router[_0x4139('0x10')](_0x4139('0xb'),auth[_0x4139('0x8')](),controller[_0x4139('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e36a140..40a9766 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x404163,_0x2a0306){var _0x2a429d=function(_0x543eeb){while(--_0x543eeb){_0x404163['push'](_0x404163['shift']());}};_0x2a429d(++_0x2a0306);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x57cb34,_0x5e2b6f){var _0x99686e=function(_0x5162fd){while(--_0x5162fd){_0x57cb34['push'](_0x57cb34['shift']());}};_0x99686e(++_0x5e2b6f);}(_0x7a54,0x106));var _0x47a5=function(_0x22289d,_0x48942d){_0x22289d=_0x22289d-0x0;var _0x48613f=_0x7a54[_0x22289d];return _0x48613f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index aa8a285..70f908b 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 _0xb78e=['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','json','apply','reject','save','destroy','error','stack','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xdd895a,_0x4dc6d0){var _0x53ca06=function(_0x40fd97){while(--_0x40fd97){_0xdd895a['push'](_0xdd895a['shift']());}};_0x53ca06(++_0x4dc6d0);}(_0xb78e,0x1c9));var _0xeb78=function(_0x25edbc,_0x3a5dca){_0x25edbc=_0x25edbc-0x0;var _0x1f587f=_0xb78e[_0x25edbc];return _0x1f587f;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){_0x3c8e66[_0xeb78('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a00b,_0x5fc575){return function(_0x315f98){if(!_0x315f98){_0x9a00b[_0xeb78('0x1d')](0x194);}return _0x315f98;};}function handleError(_0x4bcdcf,_0x108052){_0x108052=_0x108052||0x1f4;return function(_0x515158){logger[_0xeb78('0x28')](_0x515158[_0xeb78('0x29')]);if(_0x515158[_0xeb78('0x2a')]){delete _0x515158['name'];}_0x4bcdcf[_0xeb78('0x1e')](_0x108052)[_0xeb78('0x2b')](_0x515158);};}exports[_0xeb78('0x2c')]=function(_0x381b2f,_0x3d4a97){var _0x3516b8={},_0x1131a9={},_0x22c25f={'count':0x0,'rows':[]};var _0x29d6cf=_[_0xeb78('0x2d')](db[_0xeb78('0x2e')]['rawAttributes'],function(_0x555d89){return{'name':_0x555d89['fieldName'],'type':_0x555d89[_0xeb78('0x2f')][_0xeb78('0x30')]};});_0x1131a9[_0xeb78('0x31')]=_['map'](_0x29d6cf,_0xeb78('0x2a'));_0x1131a9[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x381b2f[_0xeb78('0x32')]);_0x1131a9[_0xeb78('0x34')]=_[_0xeb78('0x35')](_0x1131a9[_0xeb78('0x31')],_0x1131a9[_0xeb78('0x32')]);_0x3516b8[_0xeb78('0x36')]=_['intersection'](_0x1131a9[_0xeb78('0x31')],qs['fields'](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x37')]));_0x3516b8[_0xeb78('0x36')]=_0x3516b8[_0xeb78('0x36')][_0xeb78('0x38')]?_0x3516b8[_0xeb78('0x36')]:_0x1131a9['model'];if(!_0x381b2f['query'][_0xeb78('0x39')](_0xeb78('0x3a'))){_0x3516b8[_0xeb78('0x3b')]=qs[_0xeb78('0x3b')](_0x381b2f[_0xeb78('0x32')]['limit']);_0x3516b8[_0xeb78('0x20')]=qs[_0xeb78('0x20')](_0x381b2f[_0xeb78('0x32')][_0xeb78('0x20')]);}_0x3516b8[_0xeb78('0x3c')]=qs[_0xeb78('0x3d')](_0x381b2f['query']['sort']);_0x3516b8['where']=qs['filters'](_[_0xeb78('0x3e')](_0x381b2f[_0xeb78('0x32')],_0x1131a9[_0xeb78('0x34')]),_0x29d6cf);if(_0x381b2f['query'][_0xeb78('0x3f')]){_0x3516b8[_0xeb78('0x40')]=_['merge'](_0x3516b8['where'],{'$or':_['map'](_0x29d6cf,function(_0xbea3b8){if(_0xbea3b8[_0xeb78('0x2f')]!==_0xeb78('0x41')){var _0x4ea5e2={};_0x4ea5e2[_0xbea3b8[_0xeb78('0x2a')]]={'$like':'%'+_0x381b2f[_0xeb78('0x32')][_0xeb78('0x3f')]+'%'};return _0x4ea5e2;}})});}_0x3516b8=_['merge']({},_0x3516b8,_0x381b2f[_0xeb78('0x42')]);var _0x119848={'where':_0x3516b8[_0xeb78('0x40')]};return db[_0xeb78('0x2e')]['count'](_0x119848)['then'](function(_0x45eaa1){_0x22c25f[_0xeb78('0x22')]=_0x45eaa1;if(_0x381b2f[_0xeb78('0x32')][_0xeb78('0x43')]){_0x3516b8[_0xeb78('0x44')]=[{'all':!![]}];}return db[_0xeb78('0x2e')][_0xeb78('0x45')](_0x3516b8);})[_0xeb78('0x46')](function(_0x47567d){_0x22c25f['rows']=_0x47567d;return _0x22c25f;})[_0xeb78('0x46')](respondWithFilteredResult(_0x3d4a97,_0x3516b8))[_0xeb78('0x47')](handleError(_0x3d4a97,null));};exports[_0xeb78('0x48')]=function(_0x4dfb67,_0x382d6d){var _0x47d80b={'raw':!![],'where':{'id':_0x4dfb67[_0xeb78('0x49')]['id']}},_0x21f81b={};_0x21f81b[_0xeb78('0x31')]=_['keys'](db[_0xeb78('0x2e')][_0xeb78('0x4a')]);_0x21f81b[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x4dfb67[_0xeb78('0x32')]);_0x21f81b['filters']=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],_0x21f81b['query']);_0x47d80b[_0xeb78('0x36')]=_[_0xeb78('0x35')](_0x21f81b[_0xeb78('0x31')],qs['fields'](_0x4dfb67[_0xeb78('0x32')][_0xeb78('0x37')]));_0x47d80b[_0xeb78('0x36')]=_0x47d80b[_0xeb78('0x36')][_0xeb78('0x38')]?_0x47d80b[_0xeb78('0x36')]:_0x21f81b['model'];if(_0x4dfb67['query'][_0xeb78('0x43')]){_0x47d80b[_0xeb78('0x44')]=[{'all':!![]}];}_0x47d80b=_['merge']({},_0x47d80b,_0x4dfb67[_0xeb78('0x42')]);return db[_0xeb78('0x2e')][_0xeb78('0x4b')](_0x47d80b)[_0xeb78('0x46')](handleEntityNotFound(_0x382d6d,null))[_0xeb78('0x46')](respondWithResult(_0x382d6d,null))[_0xeb78('0x47')](handleError(_0x382d6d,null));};exports[_0xeb78('0x4c')]=function(_0x8b7c79,_0x9d5b17){return db[_0xeb78('0x2e')][_0xeb78('0x4c')](_0x8b7c79[_0xeb78('0x4d')],{})[_0xeb78('0x46')](respondWithResult(_0x9d5b17,0xc9))[_0xeb78('0x47')](handleError(_0x9d5b17,null));};exports[_0xeb78('0x4e')]=function(_0x58e361,_0x2c4616){if(_0x58e361[_0xeb78('0x4d')]['id']){delete _0x58e361[_0xeb78('0x4d')]['id'];}return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x58e361[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x2c4616,null))[_0xeb78('0x46')](saveUpdates(_0x58e361[_0xeb78('0x4d')],null))[_0xeb78('0x46')](respondWithResult(_0x2c4616,null))['catch'](handleError(_0x2c4616,null));};exports['destroy']=function(_0x553f6d,_0x438c20){return db[_0xeb78('0x2e')]['find']({'where':{'id':_0x553f6d[_0xeb78('0x49')]['id']}})[_0xeb78('0x46')](handleEntityNotFound(_0x438c20,null))[_0xeb78('0x46')](removeEntity(_0x438c20,null))['catch'](handleError(_0x438c20,null));};exports['describe']=function(_0x39a4d1,_0x48e2){return db[_0xeb78('0x2e')]['describe']()[_0xeb78('0x46')](respondWithResult(_0x48e2,null))[_0xeb78('0x47')](handleError(_0x48e2,null));}; \ No newline at end of file +var _0xa478=['filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys'];(function(_0x198e15,_0x1b32a6){var _0x856817=function(_0x43cc64){while(--_0x43cc64){_0x198e15['push'](_0x198e15['shift']());}};_0x856817(++_0x1b32a6);}(_0xa478,0x136));var _0x8a47=function(_0x215393,_0x4c406d){_0x215393=_0x215393-0x0;var _0x595198=_0xa478[_0x215393];return _0x595198;};'use strict';var emlformat=require(_0x8a47('0x0'));var rimraf=require(_0x8a47('0x1'));var zipdir=require(_0x8a47('0x2'));var jsonpatch=require(_0x8a47('0x3'));var rp=require(_0x8a47('0x4'));var moment=require(_0x8a47('0x5'));var BPromise=require(_0x8a47('0x6'));var Mustache=require(_0x8a47('0x7'));var util=require(_0x8a47('0x8'));var path=require(_0x8a47('0x9'));var sox=require(_0x8a47('0xa'));var csv=require(_0x8a47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a47('0xc'));var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var Redis=require(_0x8a47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a47('0x14'));var as=require(_0x8a47('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x16'))('api');var utils=require(_0x8a47('0x17'));var config=require(_0x8a47('0x18'));var licenseUtil=require(_0x8a47('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e3166,_0x59efc7){_0x59efc7=_0x59efc7||0xcc;return function(_0x36941a){if(_0x36941a){return _0x5e3166[_0x8a47('0x1a')](_0x59efc7);}return _0x5e3166['status'](_0x59efc7)[_0x8a47('0x1b')]();};}function respondWithResult(_0x28bbc5,_0x1a9a6f){_0x1a9a6f=_0x1a9a6f||0xc8;return function(_0x55985c){if(_0x55985c){return _0x28bbc5[_0x8a47('0x1c')](_0x1a9a6f)[_0x8a47('0x1d')](_0x55985c);}};}function respondWithFilteredResult(_0x2f682e,_0x1c8488){return function(_0x41bdaf){if(_0x41bdaf){var _0x18f2be=typeof _0x1c8488[_0x8a47('0x1e')]===_0x8a47('0x1f')&&typeof _0x1c8488[_0x8a47('0x20')]==='undefined';var _0x20fbf7=_0x41bdaf[_0x8a47('0x21')];var _0x3f9093=_0x18f2be?0x0:_0x1c8488['offset'];var _0x341089=_0x18f2be?_0x41bdaf['count']:_0x1c8488['offset']+_0x1c8488[_0x8a47('0x20')];var _0x2174b1;if(_0x341089>=_0x20fbf7){_0x341089=_0x20fbf7;_0x2174b1=0xc8;}else{_0x2174b1=0xce;}_0x2f682e[_0x8a47('0x1c')](_0x2174b1);return _0x2f682e[_0x8a47('0x22')](_0x8a47('0x23'),_0x3f9093+'-'+_0x341089+'/'+_0x20fbf7)[_0x8a47('0x1d')](_0x41bdaf);}return null;};}function patchUpdates(_0x44e119){return function(_0x1bbed6){try{jsonpatch[_0x8a47('0x24')](_0x1bbed6,_0x44e119,!![]);}catch(_0xc2065a){return BPromise['reject'](_0xc2065a);}return _0x1bbed6[_0x8a47('0x25')]();};}function saveUpdates(_0x5923ec,_0x289f28){return function(_0x3d7993){if(_0x3d7993){return _0x3d7993[_0x8a47('0x26')](_0x5923ec)[_0x8a47('0x27')](function(_0x5d4b6c){return _0x5d4b6c;});}return null;};}function removeEntity(_0x116b5e,_0x5ae186){return function(_0x50f6ba){if(_0x50f6ba){return _0x50f6ba['destroy']()['then'](function(){_0x116b5e[_0x8a47('0x1c')](0xcc)[_0x8a47('0x1b')]();});}};}function handleEntityNotFound(_0x5bed3e,_0x2bb0d4){return function(_0xb4590d){if(!_0xb4590d){_0x5bed3e[_0x8a47('0x1a')](0x194);}return _0xb4590d;};}function handleError(_0xfb9ae0,_0x44cf20){_0x44cf20=_0x44cf20||0x1f4;return function(_0xd06be6){logger[_0x8a47('0x28')](_0xd06be6['stack']);if(_0xd06be6[_0x8a47('0x29')]){delete _0xd06be6['name'];}_0xfb9ae0[_0x8a47('0x1c')](_0x44cf20)[_0x8a47('0x2a')](_0xd06be6);};}exports['index']=function(_0x1e89b1,_0x526571){var _0x4d5d32={},_0x12470a={},_0x9b51b8={'count':0x0,'rows':[]};var _0x1ddbcf=_[_0x8a47('0x2b')](db[_0x8a47('0x2c')][_0x8a47('0x2d')],function(_0x58aa06){return{'name':_0x58aa06[_0x8a47('0x2e')],'type':_0x58aa06['type']['key']};});_0x12470a[_0x8a47('0x2f')]=_[_0x8a47('0x2b')](_0x1ddbcf,_0x8a47('0x29'));_0x12470a[_0x8a47('0x30')]=_[_0x8a47('0x31')](_0x1e89b1[_0x8a47('0x30')]);_0x12470a[_0x8a47('0x32')]=_[_0x8a47('0x33')](_0x12470a[_0x8a47('0x2f')],_0x12470a[_0x8a47('0x30')]);_0x4d5d32['attributes']=_[_0x8a47('0x33')](_0x12470a[_0x8a47('0x2f')],qs[_0x8a47('0x34')](_0x1e89b1['query'][_0x8a47('0x34')]));_0x4d5d32[_0x8a47('0x35')]=_0x4d5d32['attributes'][_0x8a47('0x36')]?_0x4d5d32[_0x8a47('0x35')]:_0x12470a[_0x8a47('0x2f')];if(!_0x1e89b1[_0x8a47('0x30')]['hasOwnProperty']('nolimit')){_0x4d5d32[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x20')]);_0x4d5d32[_0x8a47('0x1e')]=qs[_0x8a47('0x1e')](_0x1e89b1[_0x8a47('0x30')]['offset']);}_0x4d5d32['order']=qs[_0x8a47('0x37')](_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x37')]);_0x4d5d32[_0x8a47('0x38')]=qs[_0x8a47('0x32')](_[_0x8a47('0x39')](_0x1e89b1[_0x8a47('0x30')],_0x12470a[_0x8a47('0x32')]),_0x1ddbcf);if(_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x3a')]){_0x4d5d32[_0x8a47('0x38')]=_['merge'](_0x4d5d32[_0x8a47('0x38')],{'$or':_['map'](_0x1ddbcf,function(_0x541832){if(_0x541832['type']!=='VIRTUAL'){var _0x57d38e={};_0x57d38e[_0x541832[_0x8a47('0x29')]]={'$like':'%'+_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x3a')]+'%'};return _0x57d38e;}})});}_0x4d5d32=_[_0x8a47('0x3b')]({},_0x4d5d32,_0x1e89b1[_0x8a47('0x3c')]);var _0x20ba1c={'where':_0x4d5d32[_0x8a47('0x38')]};return db[_0x8a47('0x2c')]['count'](_0x20ba1c)['then'](function(_0x442870){_0x9b51b8[_0x8a47('0x21')]=_0x442870;if(_0x1e89b1[_0x8a47('0x30')][_0x8a47('0x3d')]){_0x4d5d32['include']=[{'all':!![]}];}return db[_0x8a47('0x2c')][_0x8a47('0x3e')](_0x4d5d32);})[_0x8a47('0x27')](function(_0x369dd5){_0x9b51b8[_0x8a47('0x3f')]=_0x369dd5;return _0x9b51b8;})['then'](respondWithFilteredResult(_0x526571,_0x4d5d32))[_0x8a47('0x40')](handleError(_0x526571,null));};exports[_0x8a47('0x41')]=function(_0x3010af,_0x5d23ed){var _0x2b3874={'raw':!![],'where':{'id':_0x3010af[_0x8a47('0x42')]['id']}},_0x2c70ea={};_0x2c70ea[_0x8a47('0x2f')]=_['keys'](db[_0x8a47('0x2c')][_0x8a47('0x2d')]);_0x2c70ea[_0x8a47('0x30')]=_[_0x8a47('0x31')](_0x3010af[_0x8a47('0x30')]);_0x2c70ea[_0x8a47('0x32')]=_['intersection'](_0x2c70ea['model'],_0x2c70ea[_0x8a47('0x30')]);_0x2b3874[_0x8a47('0x35')]=_[_0x8a47('0x33')](_0x2c70ea['model'],qs[_0x8a47('0x34')](_0x3010af[_0x8a47('0x30')]['fields']));_0x2b3874['attributes']=_0x2b3874[_0x8a47('0x35')]['length']?_0x2b3874[_0x8a47('0x35')]:_0x2c70ea[_0x8a47('0x2f')];if(_0x3010af[_0x8a47('0x30')][_0x8a47('0x3d')]){_0x2b3874[_0x8a47('0x43')]=[{'all':!![]}];}_0x2b3874=_[_0x8a47('0x3b')]({},_0x2b3874,_0x3010af['options']);return db['WhatsappQueueReport'][_0x8a47('0x44')](_0x2b3874)[_0x8a47('0x27')](handleEntityNotFound(_0x5d23ed,null))[_0x8a47('0x27')](respondWithResult(_0x5d23ed,null))[_0x8a47('0x40')](handleError(_0x5d23ed,null));};exports[_0x8a47('0x45')]=function(_0x55dd7c,_0x4898d0){return db[_0x8a47('0x2c')]['create'](_0x55dd7c[_0x8a47('0x46')],{})[_0x8a47('0x27')](respondWithResult(_0x4898d0,0xc9))['catch'](handleError(_0x4898d0,null));};exports[_0x8a47('0x26')]=function(_0x237ed1,_0x14e22c){if(_0x237ed1[_0x8a47('0x46')]['id']){delete _0x237ed1[_0x8a47('0x46')]['id'];}return db[_0x8a47('0x2c')][_0x8a47('0x44')]({'where':{'id':_0x237ed1[_0x8a47('0x42')]['id']}})['then'](handleEntityNotFound(_0x14e22c,null))[_0x8a47('0x27')](saveUpdates(_0x237ed1[_0x8a47('0x46')],null))[_0x8a47('0x27')](respondWithResult(_0x14e22c,null))[_0x8a47('0x40')](handleError(_0x14e22c,null));};exports['destroy']=function(_0x11db4e,_0xa428dd){return db[_0x8a47('0x2c')][_0x8a47('0x44')]({'where':{'id':_0x11db4e[_0x8a47('0x42')]['id']}})[_0x8a47('0x27')](handleEntityNotFound(_0xa428dd,null))['then'](removeEntity(_0xa428dd,null))['catch'](handleError(_0xa428dd,null));};exports[_0x8a47('0x47')]=function(_0x5db5d3,_0x1da8b7){return db[_0x8a47('0x2c')]['describe']()[_0x8a47('0x27')](respondWithResult(_0x1da8b7,null))['catch'](handleError(_0x1da8b7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index da80a9e..f8db4f9 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 _0x5fec=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x32da14,_0x477a3e){var _0x36306b=function(_0x24f0ba){while(--_0x24f0ba){_0x32da14['push'](_0x32da14['shift']());}};_0x36306b(++_0x477a3e);}(_0x5fec,0x142));var _0xc5fe=function(_0x443c94,_0x485394){_0x443c94=_0x443c94-0x0;var _0x5c2cf6=_0x5fec[_0x443c94];return _0x5c2cf6;};'use strict';var _=require(_0xc5fe('0x0'));var util=require(_0xc5fe('0x1'));var logger=require(_0xc5fe('0x2'))('api');var moment=require(_0xc5fe('0x3'));var BPromise=require('bluebird');var rp=require(_0xc5fe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5fe('0x5'));var config=require(_0xc5fe('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0xc5fe('0x7')]=function(_0x16e29c,_0x44bf4d){return _0x16e29c['define'](_0xc5fe('0x8'),attributes,{'tableName':_0xc5fe('0x9'),'paranoid':![],'indexes':[{'name':_0xc5fe('0xa'),'fields':[_0xc5fe('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1302=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x4a7906,_0x3ef77d){var _0x558373=function(_0xd892c3){while(--_0xd892c3){_0x4a7906['push'](_0x4a7906['shift']());}};_0x558373(++_0x3ef77d);}(_0x1302,0x1aa));var _0x2130=function(_0x5abda3,_0x56a152){_0x5abda3=_0x5abda3-0x0;var _0x2aa4b9=_0x1302[_0x5abda3];return _0x2aa4b9;};'use strict';var _=require(_0x2130('0x0'));var util=require(_0x2130('0x1'));var logger=require(_0x2130('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2130('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2130('0x4'));var config=require(_0x2130('0x5'));var attributes=require(_0x2130('0x6'));module[_0x2130('0x7')]=function(_0x2785f7,_0x41867a){return _0x2785f7[_0x2130('0x8')](_0x2130('0x9'),attributes,{'tableName':_0x2130('0xa'),'paranoid':![],'indexes':[{'name':_0x2130('0xb'),'fields':[_0x2130('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 6484ef8..789b3cd 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 _0xe910=['body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xe910,0xb2));var _0x0e91=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0xe910[_0x115d5b];return _0x6cfc50;};'use strict';var _=require(_0x0e91('0x0'));var util=require('util');var moment=require(_0x0e91('0x1'));var BPromise=require(_0x0e91('0x2'));var rs=require(_0x0e91('0x3'));var fs=require('fs');var Redis=require(_0x0e91('0x4'));var db=require(_0x0e91('0x5'))['db'];var utils=require(_0x0e91('0x6'));var logger=require(_0x0e91('0x7'))(_0x0e91('0x8'));var config=require(_0x0e91('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0e91('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a9154,_0x2c8a08,_0x55592a){return new BPromise(function(_0x2d928e,_0x4d9f7a){return client[_0x0e91('0xb')](_0x4a9154,_0x55592a)[_0x0e91('0xc')](function(_0x3a2680){logger[_0x0e91('0xd')](_0x0e91('0xe'),_0x2c8a08,'request\x20sent');logger[_0x0e91('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2c8a08,'request\x20sent',JSON[_0x0e91('0x10')](_0x3a2680));if(_0x3a2680['error']){if(_0x3a2680['error'][_0x0e91('0x11')]===0x1f4){logger[_0x0e91('0x12')](_0x0e91('0xe'),_0x2c8a08,_0x3a2680[_0x0e91('0x12')][_0x0e91('0x13')]);return _0x4d9f7a(_0x3a2680[_0x0e91('0x12')][_0x0e91('0x13')]);}logger[_0x0e91('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c8a08,_0x3a2680[_0x0e91('0x12')]['message']);return _0x2d928e(_0x3a2680['error'][_0x0e91('0x13')]);}else{logger[_0x0e91('0xd')](_0x0e91('0xe'),_0x2c8a08,_0x0e91('0x14'));_0x2d928e(_0x3a2680[_0x0e91('0x15')][_0x0e91('0x13')]);}})[_0x0e91('0x16')](function(_0x5c1821){logger['error'](_0x0e91('0xe'),_0x2c8a08,_0x5c1821);_0x4d9f7a(_0x5c1821);});});}exports[_0x0e91('0x17')]=function(_0x739618){var _0x3c931e=this;return new Promise(function(_0x7c3001,_0x1242e2){return db[_0x0e91('0x18')][_0x0e91('0x19')](_0x739618[_0x0e91('0x1a')],{'raw':_0x739618[_0x0e91('0x1b')]?_0x739618['options'][_0x0e91('0x1c')]===undefined?!![]:![]:!![]})[_0x0e91('0xc')](function(_0xa7de02){logger[_0x0e91('0xd')](_0x0e91('0x17'),_0x739618);logger['debug'](_0x0e91('0x17'),_0x739618,JSON['stringify'](_0xa7de02));_0x7c3001(_0xa7de02);})[_0x0e91('0x16')](function(_0x4d638f){logger['error'](_0x0e91('0x17'),_0x4d638f[_0x0e91('0x13')],_0x739618);_0x1242e2(_0x3c931e[_0x0e91('0x12')](0x1f4,_0x4d638f['message']));});});};exports[_0x0e91('0x1d')]=function(_0x3ea1ee){var _0x96a791=this;return new Promise(function(_0x5a2f36,_0x2ffe29){return db[_0x0e91('0x18')][_0x0e91('0x1e')](_0x3ea1ee[_0x0e91('0x1a')],{'raw':_0x3ea1ee['options']?_0x3ea1ee['options'][_0x0e91('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ea1ee[_0x0e91('0x1b')]?_0x3ea1ee[_0x0e91('0x1b')][_0x0e91('0x1f')]||null:null,'attributes':_0x3ea1ee[_0x0e91('0x1b')]?_0x3ea1ee[_0x0e91('0x1b')][_0x0e91('0x20')]||null:null,'limit':_0x3ea1ee['options']?_0x3ea1ee[_0x0e91('0x1b')][_0x0e91('0x21')]||null:null})[_0x0e91('0xc')](function(_0x1ec644){logger[_0x0e91('0xd')]('UpdateWhatsappQueueReport',_0x3ea1ee);logger[_0x0e91('0xf')]('UpdateWhatsappQueueReport',_0x3ea1ee,JSON[_0x0e91('0x10')](_0x1ec644));_0x5a2f36(_0x1ec644);})['catch'](function(_0x353911){logger[_0x0e91('0x12')](_0x0e91('0x1d'),_0x353911[_0x0e91('0x13')],_0x3ea1ee);_0x2ffe29(_0x96a791[_0x0e91('0x12')](0x1f4,_0x353911['message']));});});}; \ No newline at end of file +var _0x9528=['code','WhatsappQueueReport,\x20%s,\x20%s','message','request\x20sent','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x504549,_0x263e38){var _0x8cad00=function(_0x175fcf){while(--_0x175fcf){_0x504549['push'](_0x504549['shift']());}};_0x8cad00(++_0x263e38);}(_0x9528,0xaf));var _0x8952=function(_0x3febc3,_0x518267){_0x3febc3=_0x3febc3-0x0;var _0x577df5=_0x9528[_0x3febc3];return _0x577df5;};'use strict';var _=require(_0x8952('0x0'));var util=require(_0x8952('0x1'));var moment=require(_0x8952('0x2'));var BPromise=require('bluebird');var rs=require(_0x8952('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8952('0x4'))['db'];var utils=require(_0x8952('0x5'));var logger=require('../../config/logger')(_0x8952('0x6'));var config=require(_0x8952('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8952('0x8')][_0x8952('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bb95f,_0x5efbd1,_0xd11d2b){return new BPromise(function(_0x576228,_0x147904){return client[_0x8952('0xa')](_0x5bb95f,_0xd11d2b)[_0x8952('0xb')](function(_0x3093d4){logger[_0x8952('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5efbd1,'request\x20sent');logger[_0x8952('0xd')](_0x8952('0xe'),_0x5efbd1,'request\x20sent',JSON[_0x8952('0xf')](_0x3093d4));if(_0x3093d4[_0x8952('0x10')]){if(_0x3093d4[_0x8952('0x10')][_0x8952('0x11')]===0x1f4){logger[_0x8952('0x10')](_0x8952('0x12'),_0x5efbd1,_0x3093d4[_0x8952('0x10')][_0x8952('0x13')]);return _0x147904(_0x3093d4[_0x8952('0x10')]['message']);}logger['error'](_0x8952('0x12'),_0x5efbd1,_0x3093d4[_0x8952('0x10')][_0x8952('0x13')]);return _0x576228(_0x3093d4[_0x8952('0x10')][_0x8952('0x13')]);}else{logger['info'](_0x8952('0x12'),_0x5efbd1,_0x8952('0x14'));_0x576228(_0x3093d4['result'][_0x8952('0x13')]);}})[_0x8952('0x15')](function(_0x3aa7ec){logger[_0x8952('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5efbd1,_0x3aa7ec);_0x147904(_0x3aa7ec);});});}exports[_0x8952('0x16')]=function(_0x4ef0e2){var _0x33c99b=this;return new Promise(function(_0xf46a07,_0x39c6ca){return db[_0x8952('0x17')][_0x8952('0x18')](_0x4ef0e2[_0x8952('0x19')],{'raw':_0x4ef0e2['options']?_0x4ef0e2[_0x8952('0x1a')][_0x8952('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22f52a){logger[_0x8952('0xc')]('CreateWhatsappQueueReport',_0x4ef0e2);logger[_0x8952('0xd')](_0x8952('0x16'),_0x4ef0e2,JSON['stringify'](_0x22f52a));_0xf46a07(_0x22f52a);})[_0x8952('0x15')](function(_0x4ba7d0){logger[_0x8952('0x10')](_0x8952('0x16'),_0x4ba7d0[_0x8952('0x13')],_0x4ef0e2);_0x39c6ca(_0x33c99b[_0x8952('0x10')](0x1f4,_0x4ba7d0[_0x8952('0x13')]));});});};exports[_0x8952('0x1c')]=function(_0x2529a7){var _0x6c0878=this;return new Promise(function(_0x35eb8c,_0x277417){return db[_0x8952('0x17')]['update'](_0x2529a7[_0x8952('0x19')],{'raw':_0x2529a7[_0x8952('0x1a')]?_0x2529a7[_0x8952('0x1a')][_0x8952('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2529a7[_0x8952('0x1a')]?_0x2529a7[_0x8952('0x1a')][_0x8952('0x1d')]||null:null,'attributes':_0x2529a7[_0x8952('0x1a')]?_0x2529a7['options'][_0x8952('0x1e')]||null:null,'limit':_0x2529a7[_0x8952('0x1a')]?_0x2529a7[_0x8952('0x1a')][_0x8952('0x1f')]||null:null})[_0x8952('0xb')](function(_0x1c035c){logger['info']('UpdateWhatsappQueueReport',_0x2529a7);logger[_0x8952('0xd')](_0x8952('0x1c'),_0x2529a7,JSON[_0x8952('0xf')](_0x1c035c));_0x35eb8c(_0x1c035c);})[_0x8952('0x15')](function(_0x109cbe){logger[_0x8952('0x10')](_0x8952('0x1c'),_0x109cbe[_0x8952('0x13')],_0x2529a7);_0x277417(_0x6c0878[_0x8952('0x10')](0x1f4,_0x109cbe[_0x8952('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 5e80e02..d9bbf0b 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 _0x69b4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','util','path','connect-timeout'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x69b4,0x95));var _0x469b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x69b4[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x469b('0x0'));var path=require(_0x469b('0x1'));var timeout=require(_0x469b('0x2'));var express=require(_0x469b('0x3'));var router=express[_0x469b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x469b('0x5'));var interaction=require(_0x469b('0x6'));var config=require(_0x469b('0x7'));var controller=require(_0x469b('0x8'));router[_0x469b('0x9')]('/',auth[_0x469b('0xa')](),controller[_0x469b('0xb')]);router[_0x469b('0x9')](_0x469b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x469b('0x9')](_0x469b('0xd'),auth['isAuthenticated'](),controller[_0x469b('0xe')]);router[_0x469b('0xf')]('/',auth[_0x469b('0xa')](),controller['create']);router[_0x469b('0x10')](_0x469b('0xd'),auth[_0x469b('0xa')](),controller[_0x469b('0x11')]);router['delete'](_0x469b('0xd'),auth[_0x469b('0xa')](),controller[_0x469b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7dc0=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','update'];(function(_0x4784cd,_0x389736){var _0x1a8a2a=function(_0x4a1042){while(--_0x4a1042){_0x4784cd['push'](_0x4784cd['shift']());}};_0x1a8a2a(++_0x389736);}(_0x7dc0,0x133));var _0x07dc=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x7dc0[_0xbb14db];return _0x36bed7;};'use strict';var multer=require('multer');var util=require(_0x07dc('0x0'));var path=require(_0x07dc('0x1'));var timeout=require(_0x07dc('0x2'));var express=require(_0x07dc('0x3'));var router=express[_0x07dc('0x4')]();var fs_extra=require(_0x07dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x07dc('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x07dc('0x7')]('/',auth[_0x07dc('0x8')](),controller['index']);router[_0x07dc('0x7')](_0x07dc('0x9'),auth[_0x07dc('0x8')](),controller[_0x07dc('0xa')]);router[_0x07dc('0x7')](_0x07dc('0xb'),auth[_0x07dc('0x8')](),controller[_0x07dc('0xc')]);router[_0x07dc('0xd')]('/',auth[_0x07dc('0x8')](),controller[_0x07dc('0xe')]);router['put'](_0x07dc('0xb'),auth['isAuthenticated'](),controller[_0x07dc('0xf')]);router[_0x07dc('0x10')](_0x07dc('0xb'),auth[_0x07dc('0x8')](),controller[_0x07dc('0x11')]);module[_0x07dc('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 2140e98..a305d68 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 _0x7cdc=['exports','STRING','account','agent','queue'];(function(_0x132399,_0x1c4b0f){var _0x2a27e9=function(_0x4eac3b){while(--_0x4eac3b){_0x132399['push'](_0x132399['shift']());}};_0x2a27e9(++_0x1c4b0f);}(_0x7cdc,0x190));var _0xc7cd=function(_0x35d063,_0x5c341d){_0x35d063=_0x35d063-0x0;var _0x5bacc1=_0x7cdc[_0x35d063];return _0x5bacc1;};'use strict';var Sequelize=require('sequelize');module[_0xc7cd('0x0')]={'uniqueid':{'type':Sequelize[_0xc7cd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc7cd('0x2'),_0xc7cd('0x3'),_0xc7cd('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x8109=['DATE','sequelize','STRING','ENUM','agent','queue'];(function(_0x5d3cf2,_0xd8b64c){var _0x38477c=function(_0x1be8bb){while(--_0x1be8bb){_0x5d3cf2['push'](_0x5d3cf2['shift']());}};_0x38477c(++_0xd8b64c);}(_0x8109,0xa9));var _0x9810=function(_0x33e2e0,_0x2aee72){_0x33e2e0=_0x33e2e0-0x0;var _0xcabb61=_0x8109[_0x33e2e0];return _0xcabb61;};'use strict';var Sequelize=require(_0x9810('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9810('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9810('0x2')]('account',_0x9810('0x3'),_0x9810('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x9810('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bd42697..982bd78 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 _0x1ab3=['body','params','destroy','describe','eml-format','rimraf','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','stack','name','send','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','options','WhatsappTransferReport','findAll','rows','show','length','include','find','catch','create'];(function(_0xcae267,_0x23f2af){var _0x56f6f7=function(_0x2bfdb8){while(--_0x2bfdb8){_0xcae267['push'](_0xcae267['shift']());}};_0x56f6f7(++_0x23f2af);}(_0x1ab3,0x8e));var _0x31ab=function(_0x4007a8,_0x40e092){_0x4007a8=_0x4007a8-0x0;var _0x16ca25=_0x1ab3[_0x4007a8];return _0x16ca25;};'use strict';var emlformat=require(_0x31ab('0x0'));var rimraf=require(_0x31ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x31ab('0x2'));var BPromise=require(_0x31ab('0x3'));var Mustache=require('mustache');var util=require(_0x31ab('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x31ab('0x5'));var ejs=require(_0x31ab('0x6'));var fs=require('fs');var fs_extra=require(_0x31ab('0x7'));var _=require('lodash');var squel=require(_0x31ab('0x8'));var crypto=require(_0x31ab('0x9'));var jsforce=require(_0x31ab('0xa'));var deskjs=require(_0x31ab('0xb'));var toCsv=require(_0x31ab('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x31ab('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x31ab('0xd'));var as=require(_0x31ab('0xe'));var hardwareService=require(_0x31ab('0xf'));var logger=require(_0x31ab('0x10'))(_0x31ab('0x11'));var utils=require(_0x31ab('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x31ab('0x13'));var db=require(_0x31ab('0x14'))['db'];function respondWithStatusCode(_0xb40f9,_0x38ac27){_0x38ac27=_0x38ac27||0xcc;return function(_0x4876a1){if(_0x4876a1){return _0xb40f9[_0x31ab('0x15')](_0x38ac27);}return _0xb40f9[_0x31ab('0x16')](_0x38ac27)[_0x31ab('0x17')]();};}function respondWithResult(_0x481f00,_0x99e6c8){_0x99e6c8=_0x99e6c8||0xc8;return function(_0x24f5e9){if(_0x24f5e9){return _0x481f00['status'](_0x99e6c8)['json'](_0x24f5e9);}};}function respondWithFilteredResult(_0x4489cc,_0xd55cf3){return function(_0x472662){if(_0x472662){var _0x151f3b=typeof _0xd55cf3[_0x31ab('0x18')]===_0x31ab('0x19')&&typeof _0xd55cf3[_0x31ab('0x1a')]===_0x31ab('0x19');var _0x22beaf=_0x472662[_0x31ab('0x1b')];var _0x5c22ce=_0x151f3b?0x0:_0xd55cf3['offset'];var _0x1f10ae=_0x151f3b?_0x472662[_0x31ab('0x1b')]:_0xd55cf3[_0x31ab('0x18')]+_0xd55cf3[_0x31ab('0x1a')];var _0x35d374;if(_0x1f10ae>=_0x22beaf){_0x1f10ae=_0x22beaf;_0x35d374=0xc8;}else{_0x35d374=0xce;}_0x4489cc[_0x31ab('0x16')](_0x35d374);return _0x4489cc['set'](_0x31ab('0x1c'),_0x5c22ce+'-'+_0x1f10ae+'/'+_0x22beaf)[_0x31ab('0x1d')](_0x472662);}return null;};}function patchUpdates(_0x53a57e){return function(_0x1b95ac){try{jsonpatch[_0x31ab('0x1e')](_0x1b95ac,_0x53a57e,!![]);}catch(_0x380a23){return BPromise[_0x31ab('0x1f')](_0x380a23);}return _0x1b95ac['save']();};}function saveUpdates(_0x21ff75,_0x31f054){return function(_0x340cd5){if(_0x340cd5){return _0x340cd5[_0x31ab('0x20')](_0x21ff75)[_0x31ab('0x21')](function(_0x134ec0){return _0x134ec0;});}return null;};}function removeEntity(_0x465242,_0x13cf5c){return function(_0x69697){if(_0x69697){return _0x69697['destroy']()[_0x31ab('0x21')](function(){_0x465242[_0x31ab('0x16')](0xcc)[_0x31ab('0x17')]();});}};}function handleEntityNotFound(_0xa3438b,_0xdc2358){return function(_0x45d2a5){if(!_0x45d2a5){_0xa3438b['sendStatus'](0x194);}return _0x45d2a5;};}function handleError(_0x313664,_0x4cf9e8){_0x4cf9e8=_0x4cf9e8||0x1f4;return function(_0x4f7159){logger['error'](_0x4f7159[_0x31ab('0x22')]);if(_0x4f7159[_0x31ab('0x23')]){delete _0x4f7159[_0x31ab('0x23')];}_0x313664[_0x31ab('0x16')](_0x4cf9e8)[_0x31ab('0x24')](_0x4f7159);};}exports['index']=function(_0xd2e3ec,_0x437241){var _0x4120f6={},_0x24f2ea={},_0x50d3d6={'count':0x0,'rows':[]};var _0x1c9d58=_['map'](db['WhatsappTransferReport'][_0x31ab('0x25')],function(_0x2a41da){return{'name':_0x2a41da['fieldName'],'type':_0x2a41da[_0x31ab('0x26')]['key']};});_0x24f2ea[_0x31ab('0x27')]=_['map'](_0x1c9d58,'name');_0x24f2ea[_0x31ab('0x28')]=_[_0x31ab('0x29')](_0xd2e3ec[_0x31ab('0x28')]);_0x24f2ea[_0x31ab('0x2a')]=_['intersection'](_0x24f2ea[_0x31ab('0x27')],_0x24f2ea[_0x31ab('0x28')]);_0x4120f6['attributes']=_[_0x31ab('0x2b')](_0x24f2ea[_0x31ab('0x27')],qs['fields'](_0xd2e3ec[_0x31ab('0x28')][_0x31ab('0x2c')]));_0x4120f6[_0x31ab('0x2d')]=_0x4120f6[_0x31ab('0x2d')]['length']?_0x4120f6[_0x31ab('0x2d')]:_0x24f2ea[_0x31ab('0x27')];if(!_0xd2e3ec[_0x31ab('0x28')][_0x31ab('0x2e')](_0x31ab('0x2f'))){_0x4120f6[_0x31ab('0x1a')]=qs[_0x31ab('0x1a')](_0xd2e3ec[_0x31ab('0x28')]['limit']);_0x4120f6[_0x31ab('0x18')]=qs[_0x31ab('0x18')](_0xd2e3ec[_0x31ab('0x28')][_0x31ab('0x18')]);}_0x4120f6[_0x31ab('0x30')]=qs[_0x31ab('0x31')](_0xd2e3ec[_0x31ab('0x28')]['sort']);_0x4120f6['where']=qs[_0x31ab('0x2a')](_[_0x31ab('0x32')](_0xd2e3ec[_0x31ab('0x28')],_0x24f2ea['filters']),_0x1c9d58);if(_0xd2e3ec[_0x31ab('0x28')]['filter']){_0x4120f6[_0x31ab('0x33')]=_[_0x31ab('0x34')](_0x4120f6[_0x31ab('0x33')],{'$or':_[_0x31ab('0x35')](_0x1c9d58,function(_0x5cec8d){if(_0x5cec8d[_0x31ab('0x26')]!==_0x31ab('0x36')){var _0x3adf8e={};_0x3adf8e[_0x5cec8d[_0x31ab('0x23')]]={'$like':'%'+_0xd2e3ec[_0x31ab('0x28')]['filter']+'%'};return _0x3adf8e;}})});}_0x4120f6=_[_0x31ab('0x34')]({},_0x4120f6,_0xd2e3ec[_0x31ab('0x37')]);var _0x16e9f4={'where':_0x4120f6[_0x31ab('0x33')]};return db[_0x31ab('0x38')][_0x31ab('0x1b')](_0x16e9f4)['then'](function(_0x5d5a02){_0x50d3d6[_0x31ab('0x1b')]=_0x5d5a02;if(_0xd2e3ec['query']['includeAll']){_0x4120f6['include']=[{'all':!![]}];}return db[_0x31ab('0x38')][_0x31ab('0x39')](_0x4120f6);})[_0x31ab('0x21')](function(_0x8a522b){_0x50d3d6[_0x31ab('0x3a')]=_0x8a522b;return _0x50d3d6;})[_0x31ab('0x21')](respondWithFilteredResult(_0x437241,_0x4120f6))['catch'](handleError(_0x437241,null));};exports[_0x31ab('0x3b')]=function(_0xb1a796,_0x54cdd7){var _0x6ff405={'raw':!![],'where':{'id':_0xb1a796['params']['id']}},_0x6a45b3={};_0x6a45b3['model']=_[_0x31ab('0x29')](db[_0x31ab('0x38')]['rawAttributes']);_0x6a45b3[_0x31ab('0x28')]=_['keys'](_0xb1a796[_0x31ab('0x28')]);_0x6a45b3[_0x31ab('0x2a')]=_[_0x31ab('0x2b')](_0x6a45b3[_0x31ab('0x27')],_0x6a45b3[_0x31ab('0x28')]);_0x6ff405[_0x31ab('0x2d')]=_['intersection'](_0x6a45b3['model'],qs[_0x31ab('0x2c')](_0xb1a796[_0x31ab('0x28')][_0x31ab('0x2c')]));_0x6ff405['attributes']=_0x6ff405[_0x31ab('0x2d')][_0x31ab('0x3c')]?_0x6ff405[_0x31ab('0x2d')]:_0x6a45b3['model'];if(_0xb1a796[_0x31ab('0x28')]['includeAll']){_0x6ff405[_0x31ab('0x3d')]=[{'all':!![]}];}_0x6ff405=_[_0x31ab('0x34')]({},_0x6ff405,_0xb1a796[_0x31ab('0x37')]);return db[_0x31ab('0x38')][_0x31ab('0x3e')](_0x6ff405)['then'](handleEntityNotFound(_0x54cdd7,null))[_0x31ab('0x21')](respondWithResult(_0x54cdd7,null))[_0x31ab('0x3f')](handleError(_0x54cdd7,null));};exports['create']=function(_0x2259c4,_0x735be2){return db[_0x31ab('0x38')][_0x31ab('0x40')](_0x2259c4[_0x31ab('0x41')],{})['then'](respondWithResult(_0x735be2,0xc9))[_0x31ab('0x3f')](handleError(_0x735be2,null));};exports[_0x31ab('0x20')]=function(_0x1d06f6,_0x2b0b5d){if(_0x1d06f6[_0x31ab('0x41')]['id']){delete _0x1d06f6[_0x31ab('0x41')]['id'];}return db[_0x31ab('0x38')][_0x31ab('0x3e')]({'where':{'id':_0x1d06f6[_0x31ab('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b0b5d,null))[_0x31ab('0x21')](saveUpdates(_0x1d06f6[_0x31ab('0x41')],null))[_0x31ab('0x21')](respondWithResult(_0x2b0b5d,null))['catch'](handleError(_0x2b0b5d,null));};exports[_0x31ab('0x43')]=function(_0x486936,_0x3d9445){return db['WhatsappTransferReport'][_0x31ab('0x3e')]({'where':{'id':_0x486936[_0x31ab('0x42')]['id']}})[_0x31ab('0x21')](handleEntityNotFound(_0x3d9445,null))[_0x31ab('0x21')](removeEntity(_0x3d9445,null))[_0x31ab('0x3f')](handleError(_0x3d9445,null));};exports[_0x31ab('0x44')]=function(_0x5d4e01,_0x2f4873){return db[_0x31ab('0x38')][_0x31ab('0x44')]()['then'](respondWithResult(_0x2f4873,null))[_0x31ab('0x3f')](handleError(_0x2f4873,null));}; \ No newline at end of file +var _0xf5c4=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xf5c4,0x1ae));var _0x4f5c=function(_0x3017c4,_0x1af339){_0x3017c4=_0x3017c4-0x0;var _0x6c2222=_0xf5c4[_0x3017c4];return _0x6c2222;};'use strict';var emlformat=require(_0x4f5c('0x0'));var rimraf=require(_0x4f5c('0x1'));var zipdir=require(_0x4f5c('0x2'));var jsonpatch=require(_0x4f5c('0x3'));var rp=require(_0x4f5c('0x4'));var moment=require(_0x4f5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f5c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4f5c('0x7'));var csv=require(_0x4f5c('0x8'));var ejs=require(_0x4f5c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f5c('0xa'));var squel=require(_0x4f5c('0xb'));var crypto=require('crypto');var jsforce=require(_0x4f5c('0xc'));var deskjs=require(_0x4f5c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4f5c('0xe'));var Redis=require(_0x4f5c('0xf'));var authService=require(_0x4f5c('0x10'));var qs=require(_0x4f5c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f5c('0x12'));var logger=require('../../config/logger')(_0x4f5c('0x13'));var utils=require(_0x4f5c('0x14'));var config=require(_0x4f5c('0x15'));var licenseUtil=require(_0x4f5c('0x16'));var db=require(_0x4f5c('0x17'))['db'];function respondWithStatusCode(_0x4ec410,_0x46e319){_0x46e319=_0x46e319||0xcc;return function(_0x554382){if(_0x554382){return _0x4ec410[_0x4f5c('0x18')](_0x46e319);}return _0x4ec410[_0x4f5c('0x19')](_0x46e319)['end']();};}function respondWithResult(_0x4a37d8,_0x1a160a){_0x1a160a=_0x1a160a||0xc8;return function(_0xfe0e5){if(_0xfe0e5){return _0x4a37d8[_0x4f5c('0x19')](_0x1a160a)['json'](_0xfe0e5);}};}function respondWithFilteredResult(_0x2ae5f6,_0x796709){return function(_0x4bb4b3){if(_0x4bb4b3){var _0x3ea3dd=typeof _0x796709[_0x4f5c('0x1a')]===_0x4f5c('0x1b')&&typeof _0x796709[_0x4f5c('0x1c')]===_0x4f5c('0x1b');var _0x55ccb6=_0x4bb4b3[_0x4f5c('0x1d')];var _0x2b1fad=_0x3ea3dd?0x0:_0x796709[_0x4f5c('0x1a')];var _0x47739d=_0x3ea3dd?_0x4bb4b3['count']:_0x796709[_0x4f5c('0x1a')]+_0x796709[_0x4f5c('0x1c')];var _0x5db75b;if(_0x47739d>=_0x55ccb6){_0x47739d=_0x55ccb6;_0x5db75b=0xc8;}else{_0x5db75b=0xce;}_0x2ae5f6[_0x4f5c('0x19')](_0x5db75b);return _0x2ae5f6[_0x4f5c('0x1e')]('Content-Range',_0x2b1fad+'-'+_0x47739d+'/'+_0x55ccb6)[_0x4f5c('0x1f')](_0x4bb4b3);}return null;};}function patchUpdates(_0x300410){return function(_0x25fca0){try{jsonpatch[_0x4f5c('0x20')](_0x25fca0,_0x300410,!![]);}catch(_0x1f942f){return BPromise[_0x4f5c('0x21')](_0x1f942f);}return _0x25fca0['save']();};}function saveUpdates(_0x56e3bb,_0x3843de){return function(_0xa7b7df){if(_0xa7b7df){return _0xa7b7df[_0x4f5c('0x22')](_0x56e3bb)[_0x4f5c('0x23')](function(_0xe6871){return _0xe6871;});}return null;};}function removeEntity(_0x1af746,_0x1691e5){return function(_0x1b0829){if(_0x1b0829){return _0x1b0829[_0x4f5c('0x24')]()['then'](function(){_0x1af746[_0x4f5c('0x19')](0xcc)[_0x4f5c('0x25')]();});}};}function handleEntityNotFound(_0x555b88,_0x16f81b){return function(_0x93f18){if(!_0x93f18){_0x555b88[_0x4f5c('0x18')](0x194);}return _0x93f18;};}function handleError(_0x3a7589,_0x281d9a){_0x281d9a=_0x281d9a||0x1f4;return function(_0x45ada7){logger[_0x4f5c('0x26')](_0x45ada7[_0x4f5c('0x27')]);if(_0x45ada7[_0x4f5c('0x28')]){delete _0x45ada7[_0x4f5c('0x28')];}_0x3a7589[_0x4f5c('0x19')](_0x281d9a)['send'](_0x45ada7);};}exports[_0x4f5c('0x29')]=function(_0x208695,_0x3072fa){var _0x38abd2={},_0x30d50e={},_0x1fe00f={'count':0x0,'rows':[]};var _0x4a58ed=_[_0x4f5c('0x2a')](db[_0x4f5c('0x2b')][_0x4f5c('0x2c')],function(_0x578393){return{'name':_0x578393[_0x4f5c('0x2d')],'type':_0x578393['type']['key']};});_0x30d50e[_0x4f5c('0x2e')]=_[_0x4f5c('0x2a')](_0x4a58ed,_0x4f5c('0x28'));_0x30d50e['query']=_[_0x4f5c('0x2f')](_0x208695['query']);_0x30d50e[_0x4f5c('0x30')]=_[_0x4f5c('0x31')](_0x30d50e[_0x4f5c('0x2e')],_0x30d50e[_0x4f5c('0x32')]);_0x38abd2[_0x4f5c('0x33')]=_[_0x4f5c('0x31')](_0x30d50e[_0x4f5c('0x2e')],qs[_0x4f5c('0x34')](_0x208695['query'][_0x4f5c('0x34')]));_0x38abd2[_0x4f5c('0x33')]=_0x38abd2[_0x4f5c('0x33')][_0x4f5c('0x35')]?_0x38abd2['attributes']:_0x30d50e[_0x4f5c('0x2e')];if(!_0x208695[_0x4f5c('0x32')][_0x4f5c('0x36')](_0x4f5c('0x37'))){_0x38abd2[_0x4f5c('0x1c')]=qs[_0x4f5c('0x1c')](_0x208695[_0x4f5c('0x32')][_0x4f5c('0x1c')]);_0x38abd2[_0x4f5c('0x1a')]=qs['offset'](_0x208695[_0x4f5c('0x32')][_0x4f5c('0x1a')]);}_0x38abd2[_0x4f5c('0x38')]=qs[_0x4f5c('0x39')](_0x208695['query'][_0x4f5c('0x39')]);_0x38abd2[_0x4f5c('0x3a')]=qs[_0x4f5c('0x30')](_[_0x4f5c('0x3b')](_0x208695['query'],_0x30d50e['filters']),_0x4a58ed);if(_0x208695[_0x4f5c('0x32')][_0x4f5c('0x3c')]){_0x38abd2[_0x4f5c('0x3a')]=_[_0x4f5c('0x3d')](_0x38abd2[_0x4f5c('0x3a')],{'$or':_['map'](_0x4a58ed,function(_0x55a09c){if(_0x55a09c[_0x4f5c('0x3e')]!==_0x4f5c('0x3f')){var _0x5c87ad={};_0x5c87ad[_0x55a09c[_0x4f5c('0x28')]]={'$like':'%'+_0x208695[_0x4f5c('0x32')][_0x4f5c('0x3c')]+'%'};return _0x5c87ad;}})});}_0x38abd2=_[_0x4f5c('0x3d')]({},_0x38abd2,_0x208695[_0x4f5c('0x40')]);var _0xdfbd2e={'where':_0x38abd2[_0x4f5c('0x3a')]};return db[_0x4f5c('0x2b')]['count'](_0xdfbd2e)[_0x4f5c('0x23')](function(_0x322ac5){_0x1fe00f[_0x4f5c('0x1d')]=_0x322ac5;if(_0x208695[_0x4f5c('0x32')][_0x4f5c('0x41')]){_0x38abd2[_0x4f5c('0x42')]=[{'all':!![]}];}return db[_0x4f5c('0x2b')]['findAll'](_0x38abd2);})[_0x4f5c('0x23')](function(_0x545262){_0x1fe00f[_0x4f5c('0x43')]=_0x545262;return _0x1fe00f;})[_0x4f5c('0x23')](respondWithFilteredResult(_0x3072fa,_0x38abd2))['catch'](handleError(_0x3072fa,null));};exports[_0x4f5c('0x44')]=function(_0x50b43e,_0x564eeb){var _0x41ab5a={'raw':!![],'where':{'id':_0x50b43e[_0x4f5c('0x45')]['id']}},_0x1dc368={};_0x1dc368[_0x4f5c('0x2e')]=_[_0x4f5c('0x2f')](db['WhatsappTransferReport'][_0x4f5c('0x2c')]);_0x1dc368[_0x4f5c('0x32')]=_[_0x4f5c('0x2f')](_0x50b43e[_0x4f5c('0x32')]);_0x1dc368[_0x4f5c('0x30')]=_[_0x4f5c('0x31')](_0x1dc368[_0x4f5c('0x2e')],_0x1dc368[_0x4f5c('0x32')]);_0x41ab5a[_0x4f5c('0x33')]=_[_0x4f5c('0x31')](_0x1dc368[_0x4f5c('0x2e')],qs[_0x4f5c('0x34')](_0x50b43e['query'][_0x4f5c('0x34')]));_0x41ab5a[_0x4f5c('0x33')]=_0x41ab5a['attributes'][_0x4f5c('0x35')]?_0x41ab5a[_0x4f5c('0x33')]:_0x1dc368['model'];if(_0x50b43e[_0x4f5c('0x32')][_0x4f5c('0x41')]){_0x41ab5a[_0x4f5c('0x42')]=[{'all':!![]}];}_0x41ab5a=_[_0x4f5c('0x3d')]({},_0x41ab5a,_0x50b43e[_0x4f5c('0x40')]);return db['WhatsappTransferReport'][_0x4f5c('0x46')](_0x41ab5a)[_0x4f5c('0x23')](handleEntityNotFound(_0x564eeb,null))[_0x4f5c('0x23')](respondWithResult(_0x564eeb,null))[_0x4f5c('0x47')](handleError(_0x564eeb,null));};exports['create']=function(_0x1fedc0,_0x33c7bf){return db[_0x4f5c('0x2b')][_0x4f5c('0x48')](_0x1fedc0[_0x4f5c('0x49')],{})[_0x4f5c('0x23')](respondWithResult(_0x33c7bf,0xc9))[_0x4f5c('0x47')](handleError(_0x33c7bf,null));};exports['update']=function(_0x493159,_0x30793e){if(_0x493159[_0x4f5c('0x49')]['id']){delete _0x493159['body']['id'];}return db[_0x4f5c('0x2b')]['find']({'where':{'id':_0x493159[_0x4f5c('0x45')]['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x30793e,null))['then'](saveUpdates(_0x493159[_0x4f5c('0x49')],null))[_0x4f5c('0x23')](respondWithResult(_0x30793e,null))['catch'](handleError(_0x30793e,null));};exports[_0x4f5c('0x24')]=function(_0x128ac0,_0x45ba33){return db[_0x4f5c('0x2b')][_0x4f5c('0x46')]({'where':{'id':_0x128ac0[_0x4f5c('0x45')]['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x45ba33,null))[_0x4f5c('0x23')](removeEntity(_0x45ba33,null))[_0x4f5c('0x47')](handleError(_0x45ba33,null));};exports[_0x4f5c('0x4a')]=function(_0x268b95,_0x5a63ee){return db['WhatsappTransferReport'][_0x4f5c('0x4a')]()[_0x4f5c('0x23')](respondWithResult(_0x5a63ee,null))[_0x4f5c('0x47')](handleError(_0x5a63ee,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 148499d..3db47f1 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 _0x84fd=['define','WhatsappTransferReport','report_whatsapp_transfer','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x84fd,0x92));var _0xd84f=function(_0x4e4ac6,_0x4ddab4){_0x4e4ac6=_0x4e4ac6-0x0;var _0x13c2cc=_0x84fd[_0x4e4ac6];return _0x13c2cc;};'use strict';var _=require('lodash');var util=require(_0xd84f('0x0'));var logger=require(_0xd84f('0x1'))(_0xd84f('0x2'));var moment=require('moment');var BPromise=require(_0xd84f('0x3'));var rp=require(_0xd84f('0x4'));var fs=require('fs');var path=require(_0xd84f('0x5'));var rimraf=require('rimraf');var config=require(_0xd84f('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd84f('0x7')]=function(_0x52ac3,_0x27a75e){return _0x52ac3[_0xd84f('0x8')](_0xd84f('0x9'),attributes,{'tableName':_0xd84f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9007=['../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x525d18,_0x28770d){var _0x2cb12e=function(_0x31ebea){while(--_0x31ebea){_0x525d18['push'](_0x525d18['shift']());}};_0x2cb12e(++_0x28770d);}(_0x9007,0x185));var _0x7900=function(_0x1b2748,_0x4b3ad2){_0x1b2748=_0x1b2748-0x0;var _0x18fe11=_0x9007[_0x1b2748];return _0x18fe11;};'use strict';var _=require('lodash');var util=require(_0x7900('0x0'));var logger=require('../../config/logger')(_0x7900('0x1'));var moment=require(_0x7900('0x2'));var BPromise=require(_0x7900('0x3'));var rp=require(_0x7900('0x4'));var fs=require('fs');var path=require(_0x7900('0x5'));var rimraf=require(_0x7900('0x6'));var config=require(_0x7900('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x3e43bc,_0x3b890d){return _0x3e43bc[_0x7900('0x8')](_0x7900('0x9'),attributes,{'tableName':_0x7900('0xa'),'paranoid':![],'indexes':[{'name':_0x7900('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6596605..7cbe9ea 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 _0x25bb=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x23db19,_0x4ac567){var _0x3becef=function(_0x14a37b){while(--_0x14a37b){_0x23db19['push'](_0x23db19['shift']());}};_0x3becef(++_0x4ac567);}(_0x25bb,0xba));var _0xb25b=function(_0x5954f6,_0x1462ac){_0x5954f6=_0x5954f6-0x0;var _0x2800e5=_0x25bb[_0x5954f6];return _0x2800e5;};'use strict';var _=require(_0xb25b('0x0'));var util=require('util');var moment=require(_0xb25b('0x1'));var BPromise=require(_0xb25b('0x2'));var rs=require(_0xb25b('0x3'));var fs=require('fs');var Redis=require(_0xb25b('0x4'));var db=require(_0xb25b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb25b('0x6'))(_0xb25b('0x7'));var config=require(_0xb25b('0x8'));var jayson=require(_0xb25b('0x9'));var client=jayson[_0xb25b('0xa')][_0xb25b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29a6d3,_0x3e6155,_0x534e15){return new BPromise(function(_0xfd087,_0x1e826b){return client['request'](_0x29a6d3,_0x534e15)[_0xb25b('0xc')](function(_0x5e3b31){logger[_0xb25b('0xd')](_0xb25b('0xe'),_0x3e6155,_0xb25b('0xf'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x3e6155,'request\x20sent',JSON[_0xb25b('0x10')](_0x5e3b31));if(_0x5e3b31[_0xb25b('0x11')]){if(_0x5e3b31['error'][_0xb25b('0x12')]===0x1f4){logger['error'](_0xb25b('0xe'),_0x3e6155,_0x5e3b31['error']['message']);return _0x1e826b(_0x5e3b31[_0xb25b('0x11')][_0xb25b('0x13')]);}logger[_0xb25b('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3e6155,_0x5e3b31[_0xb25b('0x11')][_0xb25b('0x13')]);return _0xfd087(_0x5e3b31[_0xb25b('0x11')][_0xb25b('0x13')]);}else{logger['info'](_0xb25b('0xe'),_0x3e6155,_0xb25b('0xf'));_0xfd087(_0x5e3b31['result'][_0xb25b('0x13')]);}})[_0xb25b('0x14')](function(_0x216f24){logger[_0xb25b('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3e6155,_0x216f24);_0x1e826b(_0x216f24);});});} \ No newline at end of file +var _0xa7b0=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then'];(function(_0x10dd87,_0x1cf157){var _0x1c82e9=function(_0x38d536){while(--_0x38d536){_0x10dd87['push'](_0x10dd87['shift']());}};_0x1c82e9(++_0x1cf157);}(_0xa7b0,0x15c));var _0x0a7b=function(_0x266945,_0x5c5e8c){_0x266945=_0x266945-0x0;var _0x4477d5=_0xa7b0[_0x266945];return _0x4477d5;};'use strict';var _=require(_0x0a7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0a7b('0x1'));var rs=require(_0x0a7b('0x2'));var fs=require('fs');var Redis=require(_0x0a7b('0x3'));var db=require(_0x0a7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a7b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a7b('0x6'));var client=jayson[_0x0a7b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59ed12,_0x2f3696,_0x43f3a){return new BPromise(function(_0x5c5914,_0x7ab4fa){return client['request'](_0x59ed12,_0x43f3a)[_0x0a7b('0x8')](function(_0x4f83c1){logger[_0x0a7b('0x9')](_0x0a7b('0xa'),_0x2f3696,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x2f3696,_0x0a7b('0xb'),JSON[_0x0a7b('0xc')](_0x4f83c1));if(_0x4f83c1[_0x0a7b('0xd')]){if(_0x4f83c1['error']['code']===0x1f4){logger[_0x0a7b('0xd')](_0x0a7b('0xa'),_0x2f3696,_0x4f83c1['error']['message']);return _0x7ab4fa(_0x4f83c1['error'][_0x0a7b('0xe')]);}logger[_0x0a7b('0xd')](_0x0a7b('0xa'),_0x2f3696,_0x4f83c1[_0x0a7b('0xd')]['message']);return _0x5c5914(_0x4f83c1[_0x0a7b('0xd')]['message']);}else{logger[_0x0a7b('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2f3696,_0x0a7b('0xb'));_0x5c5914(_0x4f83c1[_0x0a7b('0xf')][_0x0a7b('0xe')]);}})[_0x0a7b('0x10')](function(_0x316842){logger[_0x0a7b('0xd')](_0x0a7b('0xa'),_0x2f3696,_0x316842);_0x7ab4fa(_0x316842);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a4d78f6..3bde4c2 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36b2=['./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','start','info','exitCode','number','length','name','filter','Offline\x20apps:','map','status','online','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc'];(function(_0x42d51b,_0x41bab1){var _0xbd1473=function(_0x3063ed){while(--_0x3063ed){_0x42d51b['push'](_0x42d51b['shift']());}};_0xbd1473(++_0x41bab1);}(_0x36b2,0x6b));var _0x236b=function(_0x1f1971,_0x5a4b5f){_0x1f1971=_0x1f1971-0x0;var _0x25a60b=_0x36b2[_0x1f1971];return _0x25a60b;};'use strict';var _=require(_0x236b('0x0'));var db=require(_0x236b('0x1'))['db'];var seedDb=require(_0x236b('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x236b('0x3'));var config=require(_0x236b('0x4'));var logger=require(_0x236b('0x5'))('app');var pm2=require(_0x236b('0x6'));var pm2Config=require(_0x236b('0x7'));var schedule=require('./config/schedule');var chat=require(_0x236b('0x8'));var whatsapp=require(_0x236b('0x9'));var transcribe=require(_0x236b('0xa'));var provider=require(_0x236b('0xb'));function main(){return db[_0x236b('0xc')][_0x236b('0xd')]()['then'](function(){if(config[_0x236b('0xe')]){return seedDb[_0x236b('0xf')]();}})[_0x236b('0x10')](function(){return checkLicense[_0x236b('0xf')]();})['then'](function(){return rpc[_0x236b('0x11')]();})[_0x236b('0x10')](function(_0x2fd270){logger['info'](_0x2fd270);return chat[_0x236b('0x12')]();})[_0x236b('0x10')](function(){return whatsapp[_0x236b('0x12')]();})['then'](function(){return schedule[_0x236b('0x12')]();})['then'](function(){return transcribe['start']();})[_0x236b('0x10')](function(){return provider['start']();})[_0x236b('0x10')](function(_0x3a081c){logger[_0x236b('0x13')](_0x3a081c);return pm2[_0x236b('0x12')](pm2Config);})[_0x236b('0x10')](function(_0xa772f3){var _0x2c38b8=_0xa772f3['filter'](function(_0x5476ac){return typeof _0x5476ac[_0x236b('0x14')]===_0x236b('0x15')&&_0x5476ac[_0x236b('0x14')]>=0x0;});if(_0x2c38b8[_0x236b('0x16')]>0x0){throw new Error(_0x2c38b8[_0x236b('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x2c38b8,function(_0xab13f4){return'\x22'+_0xab13f4['pm2_env'][_0x236b('0x17')]+'\x22';}));}logger[_0x236b('0x13')]('Online\x20apps:',_['map'](_[_0x236b('0x18')](_0xa772f3,{'status':'online'}),_0x236b('0x17'))['join']());logger['info'](_0x236b('0x19'),_[_0x236b('0x1a')](_[_0x236b('0x18')](_0xa772f3,function(_0x35e4f1){return _0x35e4f1[_0x236b('0x1b')]!==_0x236b('0x1c');}),_0x236b('0x17'))[_0x236b('0x1d')]()||_0x236b('0x1e'));console[_0x236b('0x1f')](_0x236b('0x20'));})[_0x236b('0x21')](function(_0x4dabc9){console[_0x236b('0x1f')](_0x236b('0x22'),_0x4dabc9);logger['error'](_0x236b('0x23'),_0x4dabc9);process[_0x236b('0x24')](0x1);});}main(); \ No newline at end of file +var _0xb182=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','number','length','pm2_env','name','Online\x20apps:','map','online','join','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','./mysqldb','./config/seedDB','./config/license','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat'];(function(_0x20861e,_0x270147){var _0xef5594=function(_0x40f304){while(--_0x40f304){_0x20861e['push'](_0x20861e['shift']());}};_0xef5594(++_0x270147);}(_0xb182,0x121));var _0x2b18=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xb182[_0x305b20];return _0x26d64a;};'use strict';var _=require('lodash');var db=require(_0x2b18('0x0'))['db'];var seedDb=require(_0x2b18('0x1'));var checkLicense=require(_0x2b18('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x2b18('0x3'))(_0x2b18('0x4'));var pm2=require(_0x2b18('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x2b18('0x6'));var chat=require(_0x2b18('0x7'));var whatsapp=require(_0x2b18('0x8'));var transcribe=require(_0x2b18('0x9'));var provider=require(_0x2b18('0xa'));function main(){return db[_0x2b18('0xb')][_0x2b18('0xc')]()['then'](function(){if(config[_0x2b18('0xd')]){return seedDb[_0x2b18('0xe')]();}})[_0x2b18('0xf')](function(){return checkLicense[_0x2b18('0xe')]();})[_0x2b18('0xf')](function(){return rpc[_0x2b18('0x10')]();})[_0x2b18('0xf')](function(_0x261b64){logger[_0x2b18('0x11')](_0x261b64);return chat[_0x2b18('0x12')]();})[_0x2b18('0xf')](function(){return whatsapp[_0x2b18('0x12')]();})[_0x2b18('0xf')](function(){return schedule['start']();})[_0x2b18('0xf')](function(){return transcribe[_0x2b18('0x12')]();})['then'](function(){return provider['start']();})[_0x2b18('0xf')](function(_0xf2643c){logger[_0x2b18('0x11')](_0xf2643c);return pm2[_0x2b18('0x12')](pm2Config);})[_0x2b18('0xf')](function(_0x195a26){var _0x1fb7f1=_0x195a26[_0x2b18('0x13')](function(_0x5e4785){return typeof _0x5e4785[_0x2b18('0x14')]===_0x2b18('0x15')&&_0x5e4785[_0x2b18('0x14')]>=0x0;});if(_0x1fb7f1['length']>0x0){throw new Error(_0x1fb7f1[_0x2b18('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x1fb7f1,function(_0x480cd3){return'\x22'+_0x480cd3[_0x2b18('0x17')][_0x2b18('0x18')]+'\x22';}));}logger[_0x2b18('0x11')](_0x2b18('0x19'),_[_0x2b18('0x1a')](_[_0x2b18('0x13')](_0x195a26,{'status':_0x2b18('0x1b')}),'name')[_0x2b18('0x1c')]());logger[_0x2b18('0x11')]('Offline\x20apps:',_['map'](_[_0x2b18('0x13')](_0x195a26,function(_0x603b94){return _0x603b94['status']!==_0x2b18('0x1b');}),_0x2b18('0x18'))[_0x2b18('0x1c')]()||_0x2b18('0x1d'));console['log'](_0x2b18('0x1e'));})['catch'](function(_0x729668){console[_0x2b18('0x1f')](_0x2b18('0x20'),_0x729668);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x729668);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 10d268f..686823e 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 _0x6e6c=['catch','isAuthenticated','headers','authorization','startsWith','Basic','User','find','authenticate','pass','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','role','cookie','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','regenerateApiKey','apiKeyIat','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','unshift','encryptString','join','promisify','sign','payload','options','randomBytes','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','express-jwt','basic-auth','bluebird','util','secrets','session','fullname','name','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','findOne','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.'];(function(_0x253589,_0x29b8bb){var _0x267456=function(_0x500e0f){while(--_0x500e0f){_0x253589['push'](_0x253589['shift']());}};_0x267456(++_0x29b8bb);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var db=require(_0xc6e6('0x0'))['db'];var config=require(_0xc6e6('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xc6e6('0x2'));var encryptor=require(_0xc6e6('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xc6e6('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0xc6e6('0x5'));var crypto=require('crypto');var BPromise=require(_0xc6e6('0x6'));var util=require(_0xc6e6('0x7'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xc6e6('0x8')][_0xc6e6('0x9')]});var userAttributes=['id','role',_0xc6e6('0xa'),_0xc6e6('0xb'),'internal',_0xc6e6('0xc'),'userpic',_0xc6e6('0xd'),_0xc6e6('0xe'),_0xc6e6('0xf'),_0xc6e6('0x10'),_0xc6e6('0x11'),_0xc6e6('0x12'),_0xc6e6('0x13'),_0xc6e6('0x14'),_0xc6e6('0x15'),'showWebBar',_0xc6e6('0x16'),'lastPauseAt',_0xc6e6('0x17'),_0xc6e6('0x18'),_0xc6e6('0x19'),_0xc6e6('0x1a'),'phoneBarAutoAnswer',_0xc6e6('0x1b'),_0xc6e6('0x1c'),_0xc6e6('0x1d'),_0xc6e6('0x1e'),_0xc6e6('0x1f'),'phoneBarExpires',_0xc6e6('0x20'),_0xc6e6('0x21'),'phoneBarRemoteControlPort',_0xc6e6('0x22'),_0xc6e6('0x23'),_0xc6e6('0x24'),'privacyEnabled','settingsEnabled','wssPort',_0xc6e6('0x25'),'downloadOmnichannelInteractions',_0xc6e6('0x26'),_0xc6e6('0x27'),_0xc6e6('0x28'),_0xc6e6('0x29'),_0xc6e6('0x2a'),_0xc6e6('0x2b'),_0xc6e6('0x2c'),_0xc6e6('0x2d'),_0xc6e6('0x2e'),_0xc6e6('0x2f'),'openchannelAutoanswerDelay',_0xc6e6('0x30'),'faxAutoanswerDelay',_0xc6e6('0x31'),_0xc6e6('0x32'),_0xc6e6('0x33')];exports[_0xc6e6('0x34')]=function(){return this['isAuthenticated'](!![])[_0xc6e6('0x35')](function(_0xc87d11,_0x3a96df,_0x36ebfa){if(_0xc87d11[_0xc6e6('0x36')]){_0x36ebfa();}else{return db['ChatInteraction'][_0xc6e6('0x37')]({'where':{'id':_0xc87d11['params']['id']},'attributes':['id',_0xc6e6('0x38'),_0xc6e6('0x39')],'raw':!![]})[_0xc6e6('0x3a')](function(_0x64e1dc){if(_0x64e1dc&&_0x64e1dc['closed']){return _0x3a96df[_0xc6e6('0x3b')](_0x64e1dc['disposition']===_0xc6e6('0x3c')?0x195:0x193)['json']({'message':_0x64e1dc[_0xc6e6('0x39')]===_0xc6e6('0x3c')?_0xc6e6('0x3d'):_0xc6e6('0x3e')});}else{_0x36ebfa();}})[_0xc6e6('0x3f')](function(_0x5e34f6){_0x36ebfa(_0x5e34f6);});}});};exports[_0xc6e6('0x40')]=function isAuthenticated(_0x1501bd){return compose()[_0xc6e6('0x35')](function(_0x1af05c,_0x4d1284,_0x34ae96){var _0x50b735;if(_0x1af05c[_0xc6e6('0x41')][_0xc6e6('0x42')]){if(_[_0xc6e6('0x43')](_0x1af05c[_0xc6e6('0x41')][_0xc6e6('0x42')],_0xc6e6('0x44'))){var _0x43ff9c=basicAuth(_0x1af05c);db[_0xc6e6('0x45')][_0xc6e6('0x46')]({'where':{'name':_0x43ff9c[_0xc6e6('0xb')]}})[_0xc6e6('0x3a')](function(_0x214d6a){if(!_0x214d6a||!_0x214d6a[_0xc6e6('0x47')](_0x43ff9c[_0xc6e6('0x48')])){return _0x4d1284[_0xc6e6('0x3b')](0x191)[_0xc6e6('0x49')]({'message':_0xc6e6('0x4a')});}_0x1af05c['user']={'id':_0x214d6a['id']};_0x34ae96();})[_0xc6e6('0x3f')](function(_0x457c1f){_0x34ae96(_0x457c1f);});}else if(_['startsWith'](_0x1af05c['headers'][_0xc6e6('0x42')],_0xc6e6('0x4b'))){validateJwt(_0x1af05c,_0x4d1284,_0x34ae96);}else{if(_0x1501bd){_0x34ae96();}else{return _0x4d1284[_0xc6e6('0x3b')](0x193)[_0xc6e6('0x49')]({'message':_0xc6e6('0x4c')});}}}else if(_0x1af05c[_0xc6e6('0x4d')]['apikey']){try{var _0x290baf={'audience':hardwareConf[_0xc6e6('0x4e')](),'issuer':hardwareConf[_0xc6e6('0x4e')]()};verifyJwt(_0x1af05c['query']['apikey'],_0x290baf)[_0xc6e6('0x3a')](function(_0xcf753){return db[_0xc6e6('0x45')][_0xc6e6('0x46')]({'where':{'id':_0xcf753['sub']}})['then'](function(_0x24a690){_0x50b735=_0x24a690;return db['Setting'][_0xc6e6('0x37')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc6e6('0x4f')],'raw':!![]});})[_0xc6e6('0x3a')](function(_0x1cbb1d){if(!_0x50b735||!_[_0xc6e6('0x50')](_0x50b735['apiKeyNonce'],_0xcf753['nonce'])){return _0x4d1284[_0xc6e6('0x3b')](0x191)[_0xc6e6('0x49')]({'message':_0xc6e6('0x51')});}if(_0x50b735[_0xc6e6('0x52')]){return _0x4d1284['status'](0x191)['json']({'message':_0xc6e6('0x53')});}if(_0x50b735[_0xc6e6('0x54')]){if(_0x1cbb1d[_0xc6e6('0x4f')]>0x0){if(moment(_0x50b735[_0xc6e6('0x55')])['add'](_0x1cbb1d[_0xc6e6('0x4f')],_0xc6e6('0x56'))>moment()){return _0x4d1284['status'](0x191)['json']({'message':_0xc6e6('0x53')});}}else{return _0x4d1284['status'](0x191)[_0xc6e6('0x49')]({'message':_0xc6e6('0x53')});}}_0x1af05c['user']={'id':_0x50b735['id']};_0x34ae96();});})[_0xc6e6('0x3f')](function(){return _0x4d1284['status'](0x191)[_0xc6e6('0x49')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x2a6a9e){_0x34ae96(_0x2a6a9e);}}else if(_0x1501bd){_0x34ae96();}else{return _0x4d1284[_0xc6e6('0x3b')](0x193)[_0xc6e6('0x49')]({'message':_0xc6e6('0x4c')});}})[_0xc6e6('0x35')](function(_0xcf70c8,_0x2db1c7,_0x69766){if(_0xcf70c8[_0xc6e6('0x36')]){db['User'][_0xc6e6('0x46')]({'where':{'id':_0xcf70c8[_0xc6e6('0x36')]['id']},'attributes':userAttributes})[_0xc6e6('0x3a')](function(_0x1dd7ad){if(!_0x1dd7ad){return _0x2db1c7['status'](0x194)[_0xc6e6('0x49')]({'message':_0xc6e6('0x57')});}_0xcf70c8[_0xc6e6('0x36')]=_0x1dd7ad;_0x69766();})[_0xc6e6('0x3f')](function(_0x5ab058){_0x69766(_0x5ab058);});}else if(_0x1501bd){_0x69766();}else{return _0x2db1c7[_0xc6e6('0x3b')](0x194)[_0xc6e6('0x49')]({'message':_0xc6e6('0x58')});}});};exports[_0xc6e6('0x59')]=function canUpdate(){return compose()[_0xc6e6('0x35')](function(_0x581de6,_0x2aef4f,_0x518fa2){return licenseUtil[_0xc6e6('0x5a')]()['then'](function(_0xe8a6cd){if(_0xe8a6cd[_0xc6e6('0x5b')]){_0x518fa2();}else{return _0x2aef4f[_0xc6e6('0x3b')](0x193)[_0xc6e6('0x49')]({'message':_0xc6e6('0x5c')});}})[_0xc6e6('0x3f')](function(_0x46f947){_0x518fa2(_0x46f947);});});};exports[_0xc6e6('0x5d')]=function isWebrtcLicence(){return compose()['use'](function(_0x270526,_0x23d741,_0x2fe3d4){return licenseUtil['getLicense']()[_0xc6e6('0x3a')](function(_0x461cb3){if(_0x461cb3[_0xc6e6('0x5e')]){_0x2fe3d4();}else{return _0x23d741[_0xc6e6('0x3b')](0x193)[_0xc6e6('0x49')]({'message':_0xc6e6('0x5c')});}})[_0xc6e6('0x3f')](function(_0x327bf5){_0x2fe3d4(_0x327bf5);});});};exports[_0xc6e6('0x5f')]=function(_0x11af09,_0x3bfe85,_0x470167){_0x11af09[_0xc6e6('0x5f')]=!![];return _0x470167();};exports[_0xc6e6('0x60')]=function signToken(_0x4f361c){return signJwt(_0x4f361c);};exports[_0xc6e6('0x61')]=function(_0x5566df,_0x2c48e7){if(!_0x5566df[_0xc6e6('0x36')]){return _0x2c48e7['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5d3b3a={'payload':{'id':_0x5566df['user']['id'],'role':_0x5566df[_0xc6e6('0x36')][_0xc6e6('0x62')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5d3b3a)[_0xc6e6('0x3a')](function(_0x310195){_0x2c48e7[_0xc6e6('0x63')]('motion.token',_0x310195);_0x2c48e7['redirect'](_0xc6e6('0x64'));})[_0xc6e6('0x3f')](function(_0x1aa872){return _0x2c48e7[_0xc6e6('0x3b')](0x1f4)['send'](_0x1aa872);});};exports[_0xc6e6('0x65')]=function(_0x467e9b){if(_[_0xc6e6('0x66')](_0x467e9b[_0xc6e6('0x67')])||_[_0xc6e6('0x66')](_0x467e9b['apiKeyIat'])){return null;}else{return createJwt(_0x467e9b);}};exports[_0xc6e6('0x68')]=function(_0x862215){_0x862215[_0xc6e6('0x67')]=generateNonce();_0x862215['apiKeyIat']=generateIssuedAt();return createJwt(_0x862215);};exports[_0xc6e6('0x69')]=function(_0x2c2ece,_0xa0032b){var _0x14e03e=_0x2c2ece[_0xc6e6('0x4d')]['apikey'];if(_0x14e03e){var _0x46e8b1={'nonce':_0xa0032b[_0xc6e6('0x67')],'iat':_0xa0032b[_0xc6e6('0x6a')],'audience':hardwareConf[_0xc6e6('0x4e')](),'issuer':hardwareConf[_0xc6e6('0x4e')]()};return verifyJwt(_0x14e03e,_0x46e8b1)['then'](function(){return generateApiKey(_0xa0032b);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x3bc240){var _0x250275=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x250275[_0xc6e6('0x6b')](_0x3bc240))throw new db[(_0xc6e6('0x6c'))][(_0xc6e6('0x6d'))](_0xc6e6('0x6e'));return;};exports['validatePasswordHistory']=function(_0xcd3d5d,_0x50f52a,_0x26f0e0){var _0x419a3f=encryptor[_0xc6e6('0x6f')](_0x50f52a)['split'](',');for(var _0x210dcd=0x0;_0x210dcd<_0x26f0e0;_0x210dcd++){if(!_0x419a3f[_0x210dcd])break;if(_0xcd3d5d['toLowerCase']()===_0x419a3f[_0x210dcd][_0xc6e6('0x70')]()){var _0x50ac31=util['format'](_0xc6e6('0x71'),_0x26f0e0);if(_0x26f0e0===0x1){_0x50ac31='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0xc6e6('0x6d'))](_0x50ac31);}}return;};exports[_0xc6e6('0x72')]=function(_0x4f8f37,_0x20c4cf){var _0x414bc4=_0x20c4cf?encryptor[_0xc6e6('0x6f')](_0x20c4cf)[_0xc6e6('0x73')](','):[];if(_0x414bc4[_0xc6e6('0x74')]===0x5){_0x414bc4['splice'](-0x1,0x1);}_0x414bc4[_0xc6e6('0x75')](_0x4f8f37);return encryptor[_0xc6e6('0x76')](_0x414bc4[_0xc6e6('0x77')](','));};function signJwt(_0x345bc3){var _0x4f7707=BPromise[_0xc6e6('0x78')](jwt[_0xc6e6('0x79')],{'context':jwt});var _0x12410f=_0x345bc3['secret']||config['secrets'][_0xc6e6('0x9')];return new BPromise(function(_0x5ddc81,_0x5bba84){_0x4f7707(_0x345bc3[_0xc6e6('0x7a')],_0x12410f,_0x345bc3[_0xc6e6('0x7b')])[_0xc6e6('0x3a')](function(_0x2bc06c){_0x5ddc81(_0x2bc06c);})[_0xc6e6('0x3f')](function(_0x45bde1){_0x5bba84(_0x45bde1);});});}function verifyJwt(_0x38a636,_0x179f3a,_0x8bfc70){var _0x1956be=BPromise[_0xc6e6('0x78')](jwt['verify'],{'context':jwt});var _0x552b4f=_0x8bfc70||config[_0xc6e6('0x8')]['session'];return new BPromise(function(_0x576e49,_0x3f8d68){_0x1956be(_0x38a636,_0x552b4f,_0x179f3a)[_0xc6e6('0x3a')](function(_0x27c5f0){_0x576e49(_0x27c5f0);})['catch'](function(_0x3384ee){_0x3f8d68(_0x3384ee);});});}function generateNonce(){return crypto[_0xc6e6('0x7c')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xc6e6('0x7d')](Date[_0xc6e6('0x7e')]()/0x3e8)[_0xc6e6('0x7f')]();}function createJwt(_0x22eaa9){var _0xdc4e64={'payload':{'iat':_0x22eaa9[_0xc6e6('0x6a')],'nonce':_0x22eaa9['apiKeyNonce']},'options':{'algorithm':_0xc6e6('0x80'),'subject':_0x22eaa9['id'][_0xc6e6('0x7f')](),'issuer':hardwareConf[_0xc6e6('0x4e')](),'audience':hardwareConf[_0xc6e6('0x4e')]()}};return signJwt(_0xdc4e64)[_0xc6e6('0x3a')](function(_0x490461){return{'iat':_0x22eaa9[_0xc6e6('0x6a')],'nonce':_0x22eaa9[_0xc6e6('0x67')],'token':_0x490461};});} \ No newline at end of file +var _0x9348=['payload','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','findOne','params','closed','then','status','disposition','json','unmanaged','Unmanaged.','catch','isAuthenticated','headers','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','authorization','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','motion.token','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','unshift','encryptString','promisify','secret','session'];(function(_0xbe1633,_0x131480){var _0x843975=function(_0x1070f){while(--_0x1070f){_0xbe1633['push'](_0xbe1633['shift']());}};_0x843975(++_0x131480);}(_0x9348,0x10d));var _0x8934=function(_0x15e2a3,_0x1cab23){_0x15e2a3=_0x15e2a3-0x0;var _0x75de08=_0x9348[_0x15e2a3];return _0x75de08;};'use strict';var db=require(_0x8934('0x0'))['db'];var config=require(_0x8934('0x1'));var hardwareConf=require(_0x8934('0x2'));var licenseUtil=require(_0x8934('0x3'));var encryptor=require(_0x8934('0x4'));var _=require('lodash');var jwt=require(_0x8934('0x5'));var expressJwt=require(_0x8934('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x8934('0x7'));var crypto=require(_0x8934('0x8'));var BPromise=require(_0x8934('0x9'));var util=require(_0x8934('0xa'));var moment=require(_0x8934('0xb'));var validateJwt=expressJwt({'secret':config[_0x8934('0xc')]['session']});var userAttributes=['id',_0x8934('0xd'),_0x8934('0xe'),_0x8934('0xf'),'internal','email','userpic','permissions',_0x8934('0x10'),'voicePause',_0x8934('0x11'),_0x8934('0x12'),_0x8934('0x13'),_0x8934('0x14'),_0x8934('0x15'),_0x8934('0x16'),_0x8934('0x17'),_0x8934('0x18'),'lastPauseAt',_0x8934('0x19'),_0x8934('0x1a'),_0x8934('0x1b'),_0x8934('0x1c'),_0x8934('0x1d'),_0x8934('0x1e'),'phoneBarDnd',_0x8934('0x1f'),_0x8934('0x20'),_0x8934('0x21'),_0x8934('0x22'),_0x8934('0x23'),_0x8934('0x24'),_0x8934('0x25'),_0x8934('0x26'),'interface',_0x8934('0x27'),_0x8934('0x28'),_0x8934('0x29'),'wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0x8934('0x2a'),'ignorePauseForPreviewCalls',_0x8934('0x2b'),_0x8934('0x2c'),_0x8934('0x2d'),_0x8934('0x2e'),_0x8934('0x2f'),'smsAutoanswer',_0x8934('0x30'),'openchannelAutoanswer',_0x8934('0x31'),_0x8934('0x32'),_0x8934('0x33'),_0x8934('0x34'),_0x8934('0x35'),_0x8934('0x36')];exports[_0x8934('0x37')]=function(){return this['isAuthenticated'](!![])[_0x8934('0x38')](function(_0x2a5e67,_0x32020a,_0x343e09){if(_0x2a5e67[_0x8934('0x39')]){_0x343e09();}else{return db['ChatInteraction'][_0x8934('0x3a')]({'where':{'id':_0x2a5e67[_0x8934('0x3b')]['id']},'attributes':['id',_0x8934('0x3c'),'disposition'],'raw':!![]})[_0x8934('0x3d')](function(_0x561df2){if(_0x561df2&&_0x561df2[_0x8934('0x3c')]){return _0x32020a[_0x8934('0x3e')](_0x561df2[_0x8934('0x3f')]==='unmanaged'?0x195:0x193)[_0x8934('0x40')]({'message':_0x561df2[_0x8934('0x3f')]===_0x8934('0x41')?_0x8934('0x42'):'Forbidden.'});}else{_0x343e09();}})[_0x8934('0x43')](function(_0x249031){_0x343e09(_0x249031);});}});};exports[_0x8934('0x44')]=function isAuthenticated(_0x3d93c7){return compose()[_0x8934('0x38')](function(_0x20d448,_0x3f328a,_0x457634){var _0x9c6a71;if(_0x20d448[_0x8934('0x45')]['authorization']){if(_[_0x8934('0x46')](_0x20d448[_0x8934('0x45')]['authorization'],_0x8934('0x47'))){var _0x3d60f9=basicAuth(_0x20d448);db[_0x8934('0x48')][_0x8934('0x49')]({'where':{'name':_0x3d60f9['name']}})[_0x8934('0x3d')](function(_0x18e881){if(!_0x18e881||!_0x18e881[_0x8934('0x4a')](_0x3d60f9[_0x8934('0x4b')])){return _0x3f328a[_0x8934('0x3e')](0x191)['json']({'message':_0x8934('0x4c')});}_0x20d448['user']={'id':_0x18e881['id']};_0x457634();})['catch'](function(_0xff95be){_0x457634(_0xff95be);});}else if(_[_0x8934('0x46')](_0x20d448[_0x8934('0x45')][_0x8934('0x4d')],'Bearer')){validateJwt(_0x20d448,_0x3f328a,_0x457634);}else{if(_0x3d93c7){_0x457634();}else{return _0x3f328a[_0x8934('0x3e')](0x193)[_0x8934('0x40')]({'message':_0x8934('0x4e')});}}}else if(_0x20d448[_0x8934('0x4f')][_0x8934('0x50')]){try{var _0x4cd282={'audience':hardwareConf[_0x8934('0x51')](),'issuer':hardwareConf[_0x8934('0x51')]()};verifyJwt(_0x20d448['query']['apikey'],_0x4cd282)[_0x8934('0x3d')](function(_0x2a790f){return db['User']['find']({'where':{'id':_0x2a790f[_0x8934('0x52')]}})[_0x8934('0x3d')](function(_0x2f710a){_0x9c6a71=_0x2f710a;return db[_0x8934('0x53')][_0x8934('0x3a')]({'where':{'id':0x1},'attributes':[_0x8934('0x54'),_0x8934('0x55')],'raw':!![]});})[_0x8934('0x3d')](function(_0x27920e){if(!_0x9c6a71||!_[_0x8934('0x56')](_0x9c6a71[_0x8934('0x57')],_0x2a790f['nonce'])){return _0x3f328a[_0x8934('0x3e')](0x191)[_0x8934('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x9c6a71[_0x8934('0x58')]){return _0x3f328a[_0x8934('0x3e')](0x191)[_0x8934('0x40')]({'message':_0x8934('0x59')});}if(_0x9c6a71[_0x8934('0x5a')]){if(_0x27920e['blockDuration']>0x0){if(moment(_0x9c6a71['blockedAt'])['add'](_0x27920e[_0x8934('0x55')],_0x8934('0x5b'))>moment()){return _0x3f328a[_0x8934('0x3e')](0x191)['json']({'message':_0x8934('0x59')});}}else{return _0x3f328a['status'](0x191)['json']({'message':_0x8934('0x59')});}}_0x20d448[_0x8934('0x39')]={'id':_0x9c6a71['id']};_0x457634();});})['catch'](function(){return _0x3f328a['status'](0x191)[_0x8934('0x40')]({'message':_0x8934('0x59')});});}catch(_0x3d2b14){_0x457634(_0x3d2b14);}}else if(_0x3d93c7){_0x457634();}else{return _0x3f328a['status'](0x193)[_0x8934('0x40')]({'message':'Unknown\x20authorization\x20format'});}})[_0x8934('0x38')](function(_0x58559d,_0x3cd028,_0x476ed9){if(_0x58559d[_0x8934('0x39')]){db['User'][_0x8934('0x49')]({'where':{'id':_0x58559d[_0x8934('0x39')]['id']},'attributes':userAttributes})[_0x8934('0x3d')](function(_0x1e339a){if(!_0x1e339a){return _0x3cd028['status'](0x194)[_0x8934('0x40')]({'message':_0x8934('0x5c')});}_0x58559d[_0x8934('0x39')]=_0x1e339a;_0x476ed9();})[_0x8934('0x43')](function(_0x6e63ff){_0x476ed9(_0x6e63ff);});}else if(_0x3d93c7){_0x476ed9();}else{return _0x3cd028[_0x8934('0x3e')](0x194)[_0x8934('0x40')]({'message':_0x8934('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x510152,_0x1daae2,_0x44dfe2){return licenseUtil['getLicense']()[_0x8934('0x3d')](function(_0x4f0a90){if(_0x4f0a90[_0x8934('0x5e')]){_0x44dfe2();}else{return _0x1daae2[_0x8934('0x3e')](0x193)['json']({'message':_0x8934('0x5f')});}})[_0x8934('0x43')](function(_0x3f7562){_0x44dfe2(_0x3f7562);});});};exports[_0x8934('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x2adb63,_0xa35ac9,_0x5991fc){return licenseUtil[_0x8934('0x61')]()[_0x8934('0x3d')](function(_0x27a98c){if(_0x27a98c[_0x8934('0x62')]){_0x5991fc();}else{return _0xa35ac9[_0x8934('0x3e')](0x193)[_0x8934('0x40')]({'message':_0x8934('0x5f')});}})[_0x8934('0x43')](function(_0x76684){_0x5991fc(_0x76684);});});};exports[_0x8934('0x63')]=function(_0x1e2175,_0xe212bc,_0x2c322d){_0x1e2175[_0x8934('0x63')]=!![];return _0x2c322d();};exports[_0x8934('0x64')]=function signToken(_0x245176){return signJwt(_0x245176);};exports[_0x8934('0x65')]=function(_0x248d88,_0x53d058){if(!_0x248d88[_0x8934('0x39')]){return _0x53d058[_0x8934('0x3e')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a52c0={'payload':{'id':_0x248d88['user']['id'],'role':_0x248d88[_0x8934('0x39')][_0x8934('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a52c0)[_0x8934('0x3d')](function(_0x4d1433){_0x53d058['cookie'](_0x8934('0x66'),_0x4d1433);_0x53d058['redirect']('/dashboards/general');})[_0x8934('0x43')](function(_0x2778f9){return _0x53d058[_0x8934('0x3e')](0x1f4)[_0x8934('0x67')](_0x2778f9);});};exports[_0x8934('0x68')]=function(_0x1b66d8){if(_[_0x8934('0x69')](_0x1b66d8['apiKeyNonce'])||_[_0x8934('0x69')](_0x1b66d8['apiKeyIat'])){return null;}else{return createJwt(_0x1b66d8);}};exports[_0x8934('0x6a')]=function(_0x3f2ee0){_0x3f2ee0[_0x8934('0x57')]=generateNonce();_0x3f2ee0[_0x8934('0x6b')]=generateIssuedAt();return createJwt(_0x3f2ee0);};exports[_0x8934('0x6c')]=function(_0x265b0a,_0x1f6c5f){var _0x251cfe=_0x265b0a['query'][_0x8934('0x50')];if(_0x251cfe){var _0x345a95={'nonce':_0x1f6c5f[_0x8934('0x57')],'iat':_0x1f6c5f[_0x8934('0x6b')],'audience':hardwareConf[_0x8934('0x51')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x251cfe,_0x345a95)[_0x8934('0x3d')](function(){return generateApiKey(_0x1f6c5f);});}else{throw{'message':_0x8934('0x6d')};}};exports[_0x8934('0x6e')]=function(_0x4c2a52){var _0x447110=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x447110[_0x8934('0x6f')](_0x4c2a52))throw new db[(_0x8934('0x70'))]['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~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x3d5b45,_0x8e3e85,_0x3aab00){var _0x4ceb9b=encryptor[_0x8934('0x71')](_0x8e3e85)[_0x8934('0x72')](',');for(var _0x5f447c=0x0;_0x5f447c<_0x3aab00;_0x5f447c++){if(!_0x4ceb9b[_0x5f447c])break;if(_0x3d5b45['toLowerCase']()===_0x4ceb9b[_0x5f447c][_0x8934('0x73')]()){var _0x429769=util[_0x8934('0x74')](_0x8934('0x75'),_0x3aab00);if(_0x3aab00===0x1){_0x429769='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x429769);}}return;};exports['updatePasswordsHistory']=function(_0x43933f,_0x2b8837){var _0x18d08e=_0x2b8837?encryptor[_0x8934('0x71')](_0x2b8837)[_0x8934('0x72')](','):[];if(_0x18d08e[_0x8934('0x76')]===0x5){_0x18d08e['splice'](-0x1,0x1);}_0x18d08e[_0x8934('0x77')](_0x43933f);return encryptor[_0x8934('0x78')](_0x18d08e['join'](','));};function signJwt(_0x41e6b4){var _0x5abde1=BPromise[_0x8934('0x79')](jwt['sign'],{'context':jwt});var _0x29acc9=_0x41e6b4[_0x8934('0x7a')]||config[_0x8934('0xc')][_0x8934('0x7b')];return new BPromise(function(_0x458895,_0x3cae46){_0x5abde1(_0x41e6b4[_0x8934('0x7c')],_0x29acc9,_0x41e6b4['options'])['then'](function(_0x321dad){_0x458895(_0x321dad);})[_0x8934('0x43')](function(_0x181a07){_0x3cae46(_0x181a07);});});}function verifyJwt(_0x458aaf,_0x511ac6,_0x18850a){var _0x35c437=BPromise[_0x8934('0x79')](jwt[_0x8934('0x7d')],{'context':jwt});var _0x2b1888=_0x18850a||config[_0x8934('0xc')][_0x8934('0x7b')];return new BPromise(function(_0x5bcb09,_0x143d9e){_0x35c437(_0x458aaf,_0x2b1888,_0x511ac6)['then'](function(_0x5c2819){_0x5bcb09(_0x5c2819);})[_0x8934('0x43')](function(_0x11b2c6){_0x143d9e(_0x11b2c6);});});}function generateNonce(){return crypto[_0x8934('0x7e')](0x10)[_0x8934('0x7f')](_0x8934('0x80'));}function generateIssuedAt(){return Math[_0x8934('0x81')](Date[_0x8934('0x82')]()/0x3e8)['toString']();}function createJwt(_0x1ccd22){var _0x3f51dc={'payload':{'iat':_0x1ccd22['apiKeyIat'],'nonce':_0x1ccd22[_0x8934('0x57')]},'options':{'algorithm':'HS512','subject':_0x1ccd22['id'][_0x8934('0x7f')](),'issuer':hardwareConf[_0x8934('0x51')](),'audience':hardwareConf[_0x8934('0x51')]()}};return signJwt(_0x3f51dc)['then'](function(_0x2e1b40){return{'iat':_0x1ccd22[_0x8934('0x6b')],'nonce':_0x1ccd22['apiKeyNonce'],'token':_0x2e1b40};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 6e69ad7..365d8ed 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 _0xb584=['ids','count','User','buildContactsQuery','clause','getFilteredContacts','describe','CmContact','keys','startsWith','cf_','map','slice','all','length','fieldType','lodash','./sql-utils','findAll','skipContactsQuery','getContactsSubquery','then','search','parseQueryParameters','where','default','fields','filter','tags','user','skip'];(function(_0x2f9ba4,_0x32c5a1){var _0x38e95d=function(_0x4b2f0f){while(--_0x4b2f0f){_0x2f9ba4['push'](_0x2f9ba4['shift']());}};_0x38e95d(++_0x32c5a1);}(_0xb584,0xab));var _0x4b58=function(_0x4d9a00,_0x191996){_0x4d9a00=_0x4d9a00-0x0;var _0x5d8f76=_0xb584[_0x4d9a00];return _0x5d8f76;};'use strict';var _=require(_0x4b58('0x0'));var sqlUtils=require(_0x4b58('0x1'));var db=require('../../mysqldb')['db'];exports[_0x4b58('0x2')]=function(_0x3803ec,_0x59b125,_0x5cab72,_0x1916ab){var _0x4e072c={'count':0x0,'rows':[]};var _0x3a0d17=sqlUtils[_0x4b58('0x3')](_0x59b125,_0x3803ec);if(_0x3a0d17){return Promise['resolve'](_0x4e072c);}var _0x2bca02=sqlUtils[_0x4b58('0x4')]();var _0x3fdfae={};var _0x4a32e2=![];var _0x1465f=![];return Promise['resolve']()[_0x4b58('0x5')](function(){if(_0x3803ec[_0x4b58('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x3803ec[_0x4b58('0x6')],_0x1916ab);}else{return sqlUtils[_0x4b58('0x7')](_0x3803ec,_0x1916ab);}})[_0x4b58('0x5')](function(_0x46fd60){_0x2bca02[_0x4b58('0x8')](_0x46fd60[_0x4b58('0x9')]);_0x2bca02[_0x4b58('0x8')](_0x46fd60[_0x4b58('0xa')]);_0x2bca02[_0x4b58('0x8')](_0x46fd60[_0x4b58('0xb')]);_0x2bca02[_0x4b58('0x8')](_0x46fd60['user']['clause']);_0x3fdfae=_0x46fd60[_0x4b58('0xc')];_0x1465f=_0x46fd60[_0x4b58('0xd')][_0x4b58('0xe')];return sqlUtils['checkListsRestrictions'](_0x59b125,_0x3803ec,_0x1465f);})[_0x4b58('0x5')](function(_0x3dfd90){_0x2bca02[_0x4b58('0x8')](_0x3dfd90);var _0x53ce2b=_0x3803ec[_0x4b58('0x6')]?_0x3fdfae[_0x4b58('0xf')]:_0x3803ec['tag'];_0x4a32e2=_0x53ce2b?!![]:![];return sqlUtils['countFilteredContacts'](_0x2bca02,_0x53ce2b);})['then'](function(_0x40c02d){_0x4e072c[_0x4b58('0x10')]=_0x40c02d;if(_0x4e072c['count']===0x0){return;}if(_0x3803ec[_0x4b58('0x11')]){_0x1465f=!![];}return sqlUtils[_0x4b58('0x12')](_0x2bca02,_0x3803ec[_0x4b58('0xa')],_0x5cab72,_0x4a32e2,_0x3fdfae[_0x4b58('0x13')],_0x1465f);})['then'](function(_0x4c7596){if(!_0x4c7596){return[];}return sqlUtils[_0x4b58('0x14')](_0x4c7596,_0x3803ec,_0x5cab72);})[_0x4b58('0x5')](function(_0xd1a450){_0x4e072c['rows']=_0xd1a450;return _0x4e072c;})['catch'](function(_0x102a23){throw _0x102a23;});};exports[_0x4b58('0x15')]=function(){var _0xdde52f={};var _0x2bb1cb=[];return db[_0x4b58('0x16')][_0x4b58('0x15')]()[_0x4b58('0x5')](function(_0x3d2120){_0xdde52f=_0x3d2120;var _0x1dea6c=Object[_0x4b58('0x17')](_0xdde52f)[_0x4b58('0xb')](function(_0x70a13d){return _[_0x4b58('0x18')](_0x70a13d,_0x4b58('0x19'))?_0x70a13d:undefined;});var _0x28bd70=_0x1dea6c[_0x4b58('0x1a')](function(_0x3ac37f){return db['CmCustomField']['findOne']({'where':{'id':_0x3ac37f[_0x4b58('0x1b')](0x3)},'raw':!![]});});return Promise[_0x4b58('0x1c')](_0x28bd70);})['then'](function(_0x354557){for(var _0x20fc34=0x0;_0x20fc34<_0x354557[_0x4b58('0x1d')];_0x20fc34++){if(_0x354557[_0x20fc34]){var _0x310120='cf_'+_0x354557[_0x20fc34]['id'];_0xdde52f[_0x310120][_0x4b58('0x1e')]=_0x354557[_0x20fc34]['type'];}}_0x2bb1cb=_[_0x4b58('0x1a')](Object['keys'](_0xdde52f),function(_0x317355){return{'name':_0x317355,'type':_0xdde52f[_0x317355]['type']};});return _0x2bb1cb;})['catch'](function(_0x47193c){throw _0x47193c;});}; \ No newline at end of file +var _0xd501=['where','fields','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','filter','startsWith','cf_','CmCustomField','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','then','default'];(function(_0x5dc0ef,_0x50f7b8){var _0x55446c=function(_0x1e3df1){while(--_0x1e3df1){_0x5dc0ef['push'](_0x5dc0ef['shift']());}};_0x55446c(++_0x50f7b8);}(_0xd501,0x1e3));var _0x1d50=function(_0x4904e3,_0x31dbb6){_0x4904e3=_0x4904e3-0x0;var _0x5143e4=_0xd501[_0x4904e3];return _0x5143e4;};'use strict';var _=require(_0x1d50('0x0'));var sqlUtils=require(_0x1d50('0x1'));var db=require(_0x1d50('0x2'))['db'];exports[_0x1d50('0x3')]=function(_0x3f0bc2,_0x172c14,_0x189b30,_0x2c3437){var _0x414649={'count':0x0,'rows':[]};var _0x45224a=sqlUtils[_0x1d50('0x4')](_0x172c14,_0x3f0bc2);if(_0x45224a){return Promise[_0x1d50('0x5')](_0x414649);}var _0x22d0fc=sqlUtils[_0x1d50('0x6')]();var _0x5ad975={};var _0x2288c8=![];var _0x12e73e=![];return Promise[_0x1d50('0x5')]()['then'](function(){if(_0x3f0bc2[_0x1d50('0x7')]){return sqlUtils[_0x1d50('0x8')](_0x3f0bc2[_0x1d50('0x7')],_0x2c3437);}else{return sqlUtils['parseQueryParameters'](_0x3f0bc2,_0x2c3437);}})[_0x1d50('0x9')](function(_0xbd22f0){_0x22d0fc['where'](_0xbd22f0[_0x1d50('0xa')]);_0x22d0fc[_0x1d50('0xb')](_0xbd22f0[_0x1d50('0xc')]);_0x22d0fc['where'](_0xbd22f0['filter']);_0x22d0fc[_0x1d50('0xb')](_0xbd22f0[_0x1d50('0xd')][_0x1d50('0xe')]);_0x5ad975=_0xbd22f0[_0x1d50('0xf')];_0x12e73e=_0xbd22f0[_0x1d50('0xd')][_0x1d50('0x10')];return sqlUtils[_0x1d50('0x11')](_0x172c14,_0x3f0bc2,_0x12e73e);})[_0x1d50('0x9')](function(_0x248dfa){_0x22d0fc[_0x1d50('0xb')](_0x248dfa);var _0x2230de=_0x3f0bc2[_0x1d50('0x7')]?_0x5ad975[_0x1d50('0x12')]:_0x3f0bc2[_0x1d50('0x13')];_0x2288c8=_0x2230de?!![]:![];return sqlUtils[_0x1d50('0x14')](_0x22d0fc,_0x2230de);})[_0x1d50('0x9')](function(_0x3713ba){_0x414649[_0x1d50('0x15')]=_0x3713ba;if(_0x414649[_0x1d50('0x15')]===0x0){return;}if(_0x3f0bc2['User']){_0x12e73e=!![];}return sqlUtils[_0x1d50('0x16')](_0x22d0fc,_0x3f0bc2[_0x1d50('0xc')],_0x189b30,_0x2288c8,_0x5ad975[_0x1d50('0xe')],_0x12e73e);})[_0x1d50('0x9')](function(_0x2ef608){if(!_0x2ef608){return[];}return sqlUtils[_0x1d50('0x17')](_0x2ef608,_0x3f0bc2,_0x189b30);})[_0x1d50('0x9')](function(_0x3c557d){_0x414649[_0x1d50('0x18')]=_0x3c557d;return _0x414649;})[_0x1d50('0x19')](function(_0x232d3f){throw _0x232d3f;});};exports['describe']=function(){var _0x1b84ba={};var _0x4bff04=[];return db[_0x1d50('0x1a')][_0x1d50('0x1b')]()['then'](function(_0x5962db){_0x1b84ba=_0x5962db;var _0x37e720=Object[_0x1d50('0x1c')](_0x1b84ba)[_0x1d50('0x1d')](function(_0x4a4ee8){return _[_0x1d50('0x1e')](_0x4a4ee8,_0x1d50('0x1f'))?_0x4a4ee8:undefined;});var _0x3958a5=_0x37e720['map'](function(_0x73f2ad){return db[_0x1d50('0x20')]['findOne']({'where':{'id':_0x73f2ad[_0x1d50('0x21')](0x3)},'raw':!![]});});return Promise[_0x1d50('0x22')](_0x3958a5);})[_0x1d50('0x9')](function(_0x1d6410){for(var _0x7fef81=0x0;_0x7fef81<_0x1d6410[_0x1d50('0x23')];_0x7fef81++){if(_0x1d6410[_0x7fef81]){var _0x2846ed=_0x1d50('0x1f')+_0x1d6410[_0x7fef81]['id'];_0x1b84ba[_0x2846ed][_0x1d50('0x24')]=_0x1d6410[_0x7fef81][_0x1d50('0x25')];}}_0x4bff04=_['map'](Object[_0x1d50('0x1c')](_0x1b84ba),function(_0x2c96f5){return{'name':_0x2c96f5,'type':_0x1b84ba[_0x2c96f5][_0x1d50('0x25')]};});return _0x4bff04;})['catch'](function(_0x280f10){throw _0x280f10;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index f8c1783..32e7590 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 _0x0eab=['dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','start','Tag','value','split','map','tags','ids','User','user','clause','and','uc.UserId\x20=\x20?','skip','some','compact','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','c.ListId\x20IS\x20NULL','attributes','select','c.id','limit','offset','having','order','DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','group','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','subqry','firstName','lastName','mobile','fax','email','createdAt','deletedAt','includes','push','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','replace','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','find','name'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x0eab,0x17f));var _0xb0ea=function(_0x1797eb,_0x3e31c3){_0x1797eb=_0x1797eb-0x0;var _0x53bbb8=_0x0eab[_0x1797eb];return _0x53bbb8;};'use strict';var _=require(_0xb0ea('0x0'));var squel=require(_0xb0ea('0x1'));var as=require(_0xb0ea('0x2'));var qs=require(_0xb0ea('0x3'));var utils=require(_0xb0ea('0x4'));var db=require(_0xb0ea('0x5'))['db'];function skipContactsQuery(_0x596ca1,_0x29eacb){var _0x560fba=![];if(_0x596ca1[_0xb0ea('0x6')]===_0xb0ea('0x7')&&!_0x29eacb[_0xb0ea('0x8')]&&!_0x29eacb[_0xb0ea('0x9')]&&_0x29eacb['autocomplete']!==_0xb0ea('0xa')){_0x560fba=!![];}return _0x560fba;}function getContactsSubquery(){return squel['select']()[_0xb0ea('0xb')](_0xb0ea('0xc'),'c')[_0xb0ea('0xd')](_0xb0ea('0xe'));}function applyJoinClauses(_0xd92c9e,_0x255cde){var _0x3c22ef=_0x255cde?'c':'subqry';_0xd92c9e[_0xb0ea('0xf')](_0xb0ea('0x10'),'uc',_0xb0ea('0x11')+_0x3c22ef+_0xb0ea('0x12'))['left_join'](_0xb0ea('0x13'),'ct',_0xb0ea('0x14')+_0x3c22ef+_0xb0ea('0x12'))[_0xb0ea('0xf')](_0xb0ea('0x15'),'t','t.id\x20=\x20ct.TagId');return _0xd92c9e;}function addFieldsToQuery(_0x5322bf,_0x1ce161,_0x4e23dc,_0x2339ec,_0x4958d2){var _0x19189d=_0x4958d2?'c':_0xb0ea('0x16');if(!_0x1ce161){_0x1ce161=['id',_0xb0ea('0x17'),_0xb0ea('0x18'),'phone',_0xb0ea('0x19'),_0xb0ea('0x1a'),_0xb0ea('0x1b'),_0xb0ea('0x9'),'CompanyId',_0xb0ea('0x1c'),'updatedAt',_0xb0ea('0x1d'),'TagIds'];}else if(!_0x1ce161[_0xb0ea('0x1e')]('id')){_0x1ce161[_0xb0ea('0x1f')]('id');}var _0x149b0b=_0x4e23dc&&_0x4958d2||!_0x4e23dc&&!_0x4958d2;if(_0x2339ec){_0x149b0b=_0x2339ec&&_0x4958d2||!_0x2339ec&&!_0x4958d2;}_0x1ce161['forEach'](function(_0x30d4ba){if(_0x30d4ba===_0xb0ea('0x20')){if(_0x149b0b){_0x5322bf[_0xb0ea('0x21')](_0xb0ea('0x22'),_0x30d4ba);}else if(_0x4e23dc||_0x2339ec){_0x5322bf['field'](_0x19189d+'.'+_0x30d4ba);}}else{_0x5322bf[_0xb0ea('0x21')](_0x19189d+'.'+_0x30d4ba);}});return _0x5322bf;}function getSqlClauses(){var _0x1a8530={'default':squel[_0xb0ea('0x23')](),'fields':squel[_0xb0ea('0x23')](),'filter':squel[_0xb0ea('0x23')](),'tags':{'clause':squel[_0xb0ea('0x23')](),'ids':null},'user':{'clause':squel[_0xb0ea('0x23')](),'skip':![]}};return _0x1a8530;}function parseTagParameter(_0x3e164b){var _0x4d261d=squel['expr']();if(_0x3e164b){var _0xc37b5e=utils[_0xb0ea('0x24')](_0x3e164b);_0xc37b5e[_0xb0ea('0x25')](function(_0x5e8888){_0x4d261d['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5e8888+',%');});}return _0x4d261d;}function parseSearchFilter(_0x521d5d){var _0x299f55=squel[_0xb0ea('0x23')]();if(_0x521d5d){var _0x522883=_0x521d5d['replace']('\x5c','\x5c\x5c')[_0xb0ea('0x26')](/'/g,'\x27\x27');if(_0x522883['split']('\x20')[_0xb0ea('0x27')]>0x1){_0x299f55['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb0ea('0x28')](_0x522883,!![]),null);}else{if(qs['isNumeric'](_0x522883)){_0x299f55['or'](_0xb0ea('0x29'),_0x522883+'%');_0x299f55['or'](_0xb0ea('0x2a'),_0x522883+'%');_0x299f55['or'](_0xb0ea('0x2b'),_0x522883+'%');_0x299f55['or'](_0xb0ea('0x2c'),_0x522883+'%');}else if(qs[_0xb0ea('0x2d')](_0x522883)){_0x299f55['or']('c.email\x20LIKE\x20?',_0x522883+'%');}else{_0x299f55['or'](_0xb0ea('0x2e'),'%'+_0x522883+'%');_0x299f55['or'](_0xb0ea('0x2f'),'%'+_0x522883+'%');_0x299f55['or'](_0xb0ea('0x30'),'%'+_0x522883+'%');}}}return _0x299f55;}function parseAdvancedSearchFilter(_0x3ccea2,_0x568a22){var _0x5534cc=getSqlClauses();var _0x4d2fb8=as[_0xb0ea('0x31')](_0x3ccea2);var _0x113b7b=_0x4d2fb8[_0xb0ea('0x32')];for(var _0x1cf3d5=0x0;_0x1cf3d5<_0x4d2fb8['conditions'][_0xb0ea('0x27')];_0x1cf3d5++){var _0x1e6ce7=_0x4d2fb8['conditions'][_0x1cf3d5];var _0x55b381='c';var _0x5adcbf=_[_0xb0ea('0x33')](_0x568a22,[_0xb0ea('0x34'),_0x1e6ce7[_0xb0ea('0x21')]]);if(_0x5adcbf){if(_0x1e6ce7[_0xb0ea('0x21')]===_0xb0ea('0x35')||_0x5adcbf[_0xb0ea('0x36')]===_0xb0ea('0x37')){_0x1e6ce7[_0xb0ea('0x38')]=_0xb0ea('0x39');}var _0x3a6159=as[_0xb0ea('0x3a')](_0x55b381,_0x5adcbf[_0xb0ea('0x3b')],_0x1e6ce7);_0x5534cc[_0xb0ea('0x3c')][_0x113b7b](_0x3a6159[_0xb0ea('0x3d')],_0x3a6159['value'][_0xb0ea('0x3e')],_0x3a6159['value']['end']);}else{if(_0x1e6ce7['field']===_0xb0ea('0x3f')){var _0x542c6d=_0x1e6ce7[_0xb0ea('0x40')][_0xb0ea('0x41')](',')[_0xb0ea('0x42')](function(_0x30bed6){return Number(_0x30bed6);});var _0x216368=parseTagParameter(_0x542c6d);_0x5534cc[_0xb0ea('0x43')]['clause']['and'](_0x216368);_0x5534cc[_0xb0ea('0x43')][_0xb0ea('0x44')]=_0x542c6d;}else if(_0x1e6ce7[_0xb0ea('0x21')]===_0xb0ea('0x45')){_0x5534cc[_0xb0ea('0x46')][_0xb0ea('0x47')][_0xb0ea('0x48')](_0xb0ea('0x49'),_0x1e6ce7[_0xb0ea('0x40')]);_0x5534cc[_0xb0ea('0x46')][_0xb0ea('0x4a')]=!![];}}}return _0x5534cc;}function parseModelFields(_0x174880,_0x398b1d){var _0x5ac05a=squel[_0xb0ea('0x23')]();var _0x759450=_(_0x174880)['keys']()[_0xb0ea('0x42')](function(_0x518849){return _[_0xb0ea('0x4b')](_0x398b1d,[_0xb0ea('0x34'),_0x518849])?_0x518849:undefined;})[_0xb0ea('0x4c')]()['value']();if(_0x174880[_0xb0ea('0x4d')]){_0x759450['push']('Contact');}if(_0x174880[_0xb0ea('0x45')]){_0x759450[_0xb0ea('0x1f')](_0xb0ea('0x45'));}if(_0x759450[_0xb0ea('0x27')]>0x0){_0x759450[_0xb0ea('0x25')](function(_0x4cc148){if(_0x4cc148===_0xb0ea('0x9')){_0x5ac05a[_0xb0ea('0x48')](_0xb0ea('0x4e'),[]['concat'](_0x174880[_0x4cc148]));}else if(_0x4cc148==='Contact'){var _0x827edd='%'+_0x174880[_0x4cc148]+'%';_0x5ac05a['and'](_0xb0ea('0x4f'),_0x827edd);}else if(_0x4cc148===_0xb0ea('0x45')){_0x5ac05a[_0xb0ea('0x48')](_0xb0ea('0x49'),_0x174880[_0x4cc148]);}else{_0x5ac05a[_0xb0ea('0x48')]('c.'+_0x4cc148+_0xb0ea('0x50'),_0x174880[_0x4cc148]);}});}return _0x5ac05a;}function parseQueryParameters(_0x103471,_0x464a2d){var _0x2adad4=getSqlClauses();return Promise[_0xb0ea('0x51')]()[_0xb0ea('0x52')](function(){return parseModelFields(_0x103471,_0x464a2d);})['then'](function(_0xa19f79){_0x2adad4['fields'][_0xb0ea('0x48')](_0xa19f79);return parseTagParameter(_0x103471[_0xb0ea('0x53')]);})[_0xb0ea('0x52')](function(_0xfb2c83){_0x2adad4[_0xb0ea('0x43')][_0xb0ea('0x47')]['and'](_0xfb2c83);return parseSearchFilter(_0x103471[_0xb0ea('0x54')]);})[_0xb0ea('0x52')](function(_0x38b2be){_0x2adad4[_0xb0ea('0x54')]=_0x38b2be;return _0x2adad4;});}function checkListsRestrictions(_0x187d05,_0xf80b45,_0xb40904){var _0x6d92a7=squel[_0xb0ea('0x23')]();return Promise[_0xb0ea('0x51')]()[_0xb0ea('0x52')](function(){if(_0xf80b45['search']&&_0x187d05[_0xb0ea('0x6')]===_0xb0ea('0x7')&&!_0xb40904){return _0x187d05['getLists']({'attributes':['id'],'raw':!![]});}})[_0xb0ea('0x52')](function(_0x197f1f){if(_0x197f1f){if(_0x197f1f['length']===0x0){_0x6d92a7[_0xb0ea('0x48')](_0xb0ea('0x55'));}else{_0x6d92a7[_0xb0ea('0x48')]('c.ListId\x20IN\x20?',_[_0xb0ea('0x42')](_0x197f1f,'id'));}}})[_0xb0ea('0x52')](function(){return _0x6d92a7;});}function buildContactsQuery(_0xdb0b98,_0x2ee98e,_0x2dfaac,_0x140efe,_0x45e2f5,_0x29905c){if(_0x2ee98e){_0x2ee98e=_0x2dfaac[_0xb0ea('0x56')];}_0xdb0b98=addFieldsToQuery(_0xdb0b98,_0x2ee98e,_0x140efe,_0x29905c,!![]);var _0x5d2d3e=squel[_0xb0ea('0x57')]();_0x5d2d3e=addFieldsToQuery(_0x5d2d3e,_0x2ee98e,_0x140efe,_0x29905c,![]);if(_0x140efe||_0x29905c){_0xdb0b98=applyJoinClauses(_0xdb0b98,!![]);_0xdb0b98['group'](_0xb0ea('0x58'));if(_0x2dfaac[_0xb0ea('0x59')]){_0x5d2d3e['limit'](_0x2dfaac[_0xb0ea('0x59')]);}if(_0x2dfaac[_0xb0ea('0x5a')]){_0x5d2d3e[_0xb0ea('0x5a')](_0x2dfaac[_0xb0ea('0x5a')]);}}else{_0x5d2d3e=applyJoinClauses(_0x5d2d3e,![]);_0x5d2d3e['group']('subqry.id');if(_0x2dfaac[_0xb0ea('0x59')]){_0xdb0b98['limit'](_0x2dfaac[_0xb0ea('0x59')]);}if(_0x2dfaac[_0xb0ea('0x5a')]){_0xdb0b98[_0xb0ea('0x5a')](_0x2dfaac[_0xb0ea('0x5a')]);}}_0x5d2d3e[_0xb0ea('0x5b')](_0x45e2f5);if(_0x2dfaac[_0xb0ea('0x5c')]){_0x2dfaac[_0xb0ea('0x5c')][_0xb0ea('0x25')](function(_0x347d51){_0xdb0b98[_0xb0ea('0x5c')]('c.'+_0x347d51[0x0],_0x347d51[0x1]===_0xb0ea('0x5d')?![]:!![]);_0x5d2d3e[_0xb0ea('0x5c')](_0xb0ea('0x5e')+_0x347d51[0x0],_0x347d51[0x1]===_0xb0ea('0x5d')?![]:!![]);});}_0x5d2d3e['from'](_0xdb0b98,_0xb0ea('0x16'));return _0x5d2d3e;}function getFilteredContacts(_0x276270){var _0x2516d3=[];return db[_0xb0ea('0x3f')][_0xb0ea('0x5f')]({'attributes':['id',_0xb0ea('0x34'),'color'],'raw':!![]})[_0xb0ea('0x52')](function(_0x54b353){_0x2516d3=_[_0xb0ea('0x60')](_0x54b353,'id');var _0x4d0d27={'type':db[_0xb0ea('0x61')][_0xb0ea('0x62')]['SELECT'],'model':db[_0xb0ea('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb0ea('0x64')][_0xb0ea('0x65')](_0x276270[_0xb0ea('0x66')](),_0x4d0d27);})['then'](function(_0x23815e){_0x23815e[_0xb0ea('0x25')](function(_0x93c931){if(_0x93c931[_0xb0ea('0x20')]){_0x93c931['Tags']=[];_0x93c931[_0xb0ea('0x20')]['split'](',')[_0xb0ea('0x25')](function(_0xf15f23){_0x93c931[_0xb0ea('0x67')]['push'](_0x2516d3[_0xf15f23]);});}delete _0x93c931[_0xb0ea('0x20')];});return _0x23815e;});}function countFilteredContacts(_0x1470ac,_0x2d3d8f){var _0x1a8bba=_0x1470ac[_0xb0ea('0x68')]();_0x1a8bba['field'](_0xb0ea('0x69'));_0x1a8bba=applyJoinClauses(_0x1a8bba,!![]);_0x1470ac[_0xb0ea('0x6a')](_0xb0ea('0x58'));var _0x22dffc=utils[_0xb0ea('0x24')](_0x2d3d8f);if(!_['isEmpty'](_0x22dffc)){_0x1a8bba[_0xb0ea('0xd')](_0xb0ea('0x6b'),_0x22dffc);}var _0x34922d={'type':db[_0xb0ea('0x61')][_0xb0ea('0x62')]['SELECT'],'raw':!![]};return db['sequelize']['query'](_0x1a8bba[_0xb0ea('0x66')](),_0x34922d)[_0xb0ea('0x52')](function(_0x129516){return _0x129516[0x0][_0xb0ea('0x69')];});}module[_0xb0ea('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x0456=['cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','lastName','phone','mobile','email','CompanyId','updatedAt','includes','push','forEach','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','sqlOperator','conditions','length','find','name','fieldType','castTo','DATE','type','default','text','start','value','end','Tag','map','clause','tags','ids','User','user','and','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','then','fields','tag','filter','resolve','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','c.id','isEmpty','t.id\x20IN\x20?','SELECT','COUNT(*)','exports','squel','../interaction/utils','role','agent','ListId','autocomplete','true','select','from'];(function(_0xe0f3e9,_0x59fd23){var _0x589ff7=function(_0x3fe187){while(--_0x3fe187){_0xe0f3e9['push'](_0xe0f3e9['shift']());}};_0x589ff7(++_0x59fd23);}(_0x0456,0xcb));var _0x6045=function(_0x5e05ba,_0x404485){_0x5e05ba=_0x5e05ba-0x0;var _0x3cc565=_0x0456[_0x5e05ba];return _0x3cc565;};'use strict';var _=require('lodash');var squel=require(_0x6045('0x0'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0x6045('0x1'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x4adc69,_0x44b440){var _0x2dfa16=![];if(_0x4adc69[_0x6045('0x2')]===_0x6045('0x3')&&!_0x44b440['search']&&!_0x44b440[_0x6045('0x4')]&&_0x44b440[_0x6045('0x5')]!==_0x6045('0x6')){_0x2dfa16=!![];}return _0x2dfa16;}function getContactsSubquery(){return squel[_0x6045('0x7')]()[_0x6045('0x8')](_0x6045('0x9'),'c')[_0x6045('0xa')](_0x6045('0xb'));}function applyJoinClauses(_0x2c6290,_0xe78f0c){var _0x7ac679=_0xe78f0c?'c':_0x6045('0xc');_0x2c6290[_0x6045('0xd')](_0x6045('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x7ac679+_0x6045('0xf'))[_0x6045('0xd')]('cm_contact_has_tags','ct',_0x6045('0x10')+_0x7ac679+'.id')[_0x6045('0xd')]('tools_tags','t',_0x6045('0x11'));return _0x2c6290;}function addFieldsToQuery(_0x496010,_0x3c0999,_0x16194c,_0x41a9ce,_0x23fc64){var _0xd2d882=_0x23fc64?'c':'subqry';if(!_0x3c0999){_0x3c0999=['id','firstName',_0x6045('0x12'),_0x6045('0x13'),_0x6045('0x14'),'fax',_0x6045('0x15'),_0x6045('0x4'),_0x6045('0x16'),'createdAt',_0x6045('0x17'),'deletedAt','TagIds'];}else if(!_0x3c0999[_0x6045('0x18')]('id')){_0x3c0999[_0x6045('0x19')]('id');}var _0x116cd4=_0x16194c&&_0x23fc64||!_0x16194c&&!_0x23fc64;if(_0x41a9ce){_0x116cd4=_0x41a9ce&&_0x23fc64||!_0x41a9ce&&!_0x23fc64;}_0x3c0999[_0x6045('0x1a')](function(_0x2d1a9e){if(_0x2d1a9e===_0x6045('0x1b')){if(_0x116cd4){_0x496010['field'](_0x6045('0x1c'),_0x2d1a9e);}else if(_0x16194c||_0x41a9ce){_0x496010[_0x6045('0x1d')](_0xd2d882+'.'+_0x2d1a9e);}}else{_0x496010[_0x6045('0x1d')](_0xd2d882+'.'+_0x2d1a9e);}});return _0x496010;}function getSqlClauses(){var _0x2d838d={'default':squel['expr'](),'fields':squel[_0x6045('0x1e')](),'filter':squel[_0x6045('0x1e')](),'tags':{'clause':squel[_0x6045('0x1e')](),'ids':null},'user':{'clause':squel[_0x6045('0x1e')](),'skip':![]}};return _0x2d838d;}function parseTagParameter(_0x35c7be){var _0x57a8c1=squel[_0x6045('0x1e')]();if(_0x35c7be){var _0x12dbe3=utils[_0x6045('0x1f')](_0x35c7be);_0x12dbe3[_0x6045('0x1a')](function(_0x360128){_0x57a8c1['or'](_0x6045('0x20'),'%,'+_0x360128+',%');});}return _0x57a8c1;}function parseSearchFilter(_0x2027a1){var _0x295fb5=squel[_0x6045('0x1e')]();if(_0x2027a1){var _0x5c5d9f=_0x2027a1[_0x6045('0x21')]('\x5c','\x5c\x5c')[_0x6045('0x21')](/'/g,'\x27\x27');if(_0x5c5d9f[_0x6045('0x22')]('\x20')['length']>0x1){_0x295fb5['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6045('0x23')](_0x5c5d9f,!![]),null);}else{if(qs['isNumeric'](_0x5c5d9f)){_0x295fb5['or'](_0x6045('0x24'),_0x5c5d9f+'%');_0x295fb5['or'](_0x6045('0x25'),_0x5c5d9f+'%');_0x295fb5['or'](_0x6045('0x26'),_0x5c5d9f+'%');_0x295fb5['or'](_0x6045('0x27'),_0x5c5d9f+'%');}else if(qs[_0x6045('0x28')](_0x5c5d9f)){_0x295fb5['or']('c.email\x20LIKE\x20?',_0x5c5d9f+'%');}else{_0x295fb5['or'](_0x6045('0x29'),'%'+_0x5c5d9f+'%');_0x295fb5['or']('c.lastName\x20LIKE\x20?','%'+_0x5c5d9f+'%');_0x295fb5['or'](_0x6045('0x2a'),'%'+_0x5c5d9f+'%');}}}return _0x295fb5;}function parseAdvancedSearchFilter(_0x2fa27e,_0x4f7f92){var _0x39dd81=getSqlClauses();var _0x20bce8=as['parseSearch'](_0x2fa27e);var _0x3dd26b=_0x20bce8[_0x6045('0x2b')];for(var _0x58c399=0x0;_0x58c399<_0x20bce8[_0x6045('0x2c')][_0x6045('0x2d')];_0x58c399++){var _0x1e6205=_0x20bce8['conditions'][_0x58c399];var _0x36979d='c';var _0xde9e58=_[_0x6045('0x2e')](_0x4f7f92,[_0x6045('0x2f'),_0x1e6205['field']]);if(_0xde9e58){if(_0x1e6205[_0x6045('0x1d')]==='dateOfBirth'||_0xde9e58[_0x6045('0x30')]==='datetime'){_0x1e6205[_0x6045('0x31')]=_0x6045('0x32');}var _0x305d45=as['buildExpression'](_0x36979d,_0xde9e58[_0x6045('0x33')],_0x1e6205);_0x39dd81[_0x6045('0x34')][_0x3dd26b](_0x305d45[_0x6045('0x35')],_0x305d45['value'][_0x6045('0x36')],_0x305d45[_0x6045('0x37')][_0x6045('0x38')]);}else{if(_0x1e6205[_0x6045('0x1d')]===_0x6045('0x39')){var _0x144b4=_0x1e6205[_0x6045('0x37')][_0x6045('0x22')](',')[_0x6045('0x3a')](function(_0x3ea5eb){return Number(_0x3ea5eb);});var _0x88b73a=parseTagParameter(_0x144b4);_0x39dd81['tags'][_0x6045('0x3b')]['and'](_0x88b73a);_0x39dd81[_0x6045('0x3c')][_0x6045('0x3d')]=_0x144b4;}else if(_0x1e6205[_0x6045('0x1d')]===_0x6045('0x3e')){_0x39dd81[_0x6045('0x3f')][_0x6045('0x3b')][_0x6045('0x40')](_0x6045('0x41'),_0x1e6205[_0x6045('0x37')]);_0x39dd81[_0x6045('0x3f')][_0x6045('0x42')]=!![];}}}return _0x39dd81;}function parseModelFields(_0x5c9939,_0x47f33c){var _0x18ea77=squel['expr']();var _0x16ff30=_(_0x5c9939)[_0x6045('0x43')]()[_0x6045('0x3a')](function(_0x36e61c){return _[_0x6045('0x44')](_0x47f33c,[_0x6045('0x2f'),_0x36e61c])?_0x36e61c:undefined;})[_0x6045('0x45')]()[_0x6045('0x37')]();if(_0x5c9939[_0x6045('0x46')]){_0x16ff30[_0x6045('0x19')](_0x6045('0x46'));}if(_0x5c9939['User']){_0x16ff30[_0x6045('0x19')]('User');}if(_0x16ff30['length']>0x0){_0x16ff30[_0x6045('0x1a')](function(_0x5dfd0c){if(_0x5dfd0c===_0x6045('0x4')){_0x18ea77[_0x6045('0x40')](_0x6045('0x47'),[][_0x6045('0x48')](_0x5c9939[_0x5dfd0c]));}else if(_0x5dfd0c==='Contact'){var _0xd4420f='%'+_0x5c9939[_0x5dfd0c]+'%';_0x18ea77[_0x6045('0x40')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0xd4420f);}else if(_0x5dfd0c===_0x6045('0x3e')){_0x18ea77[_0x6045('0x40')](_0x6045('0x41'),_0x5c9939[_0x5dfd0c]);}else{_0x18ea77[_0x6045('0x40')]('c.'+_0x5dfd0c+_0x6045('0x49'),_0x5c9939[_0x5dfd0c]);}});}return _0x18ea77;}function parseQueryParameters(_0x138805,_0x117ae5){var _0x120c33=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x138805,_0x117ae5);})[_0x6045('0x4a')](function(_0x226294){_0x120c33[_0x6045('0x4b')][_0x6045('0x40')](_0x226294);return parseTagParameter(_0x138805[_0x6045('0x4c')]);})['then'](function(_0x426301){_0x120c33[_0x6045('0x3c')][_0x6045('0x3b')][_0x6045('0x40')](_0x426301);return parseSearchFilter(_0x138805[_0x6045('0x4d')]);})[_0x6045('0x4a')](function(_0x5132cb){_0x120c33['filter']=_0x5132cb;return _0x120c33;});}function checkListsRestrictions(_0x359c9e,_0x29538b,_0x3c32e1){var _0x393f55=squel['expr']();return Promise[_0x6045('0x4e')]()[_0x6045('0x4a')](function(){if(_0x29538b['search']&&_0x359c9e[_0x6045('0x2')]===_0x6045('0x3')&&!_0x3c32e1){return _0x359c9e[_0x6045('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x6045('0x4a')](function(_0x298bb3){if(_0x298bb3){if(_0x298bb3[_0x6045('0x2d')]===0x0){_0x393f55[_0x6045('0x40')](_0x6045('0x50'));}else{_0x393f55['and'](_0x6045('0x47'),_['map'](_0x298bb3,'id'));}}})['then'](function(){return _0x393f55;});}function buildContactsQuery(_0x4b72cd,_0x698aa5,_0x49194e,_0x4be78f,_0x20d12c,_0xb38142){if(_0x698aa5){_0x698aa5=_0x49194e[_0x6045('0x51')];}_0x4b72cd=addFieldsToQuery(_0x4b72cd,_0x698aa5,_0x4be78f,_0xb38142,!![]);var _0x6f374b=squel[_0x6045('0x7')]();_0x6f374b=addFieldsToQuery(_0x6f374b,_0x698aa5,_0x4be78f,_0xb38142,![]);if(_0x4be78f||_0xb38142){_0x4b72cd=applyJoinClauses(_0x4b72cd,!![]);_0x4b72cd[_0x6045('0x52')]('c.id');if(_0x49194e[_0x6045('0x53')]){_0x6f374b[_0x6045('0x53')](_0x49194e[_0x6045('0x53')]);}if(_0x49194e[_0x6045('0x54')]){_0x6f374b[_0x6045('0x54')](_0x49194e['offset']);}}else{_0x6f374b=applyJoinClauses(_0x6f374b,![]);_0x6f374b[_0x6045('0x52')](_0x6045('0x55'));if(_0x49194e['limit']){_0x4b72cd[_0x6045('0x53')](_0x49194e[_0x6045('0x53')]);}if(_0x49194e[_0x6045('0x54')]){_0x4b72cd[_0x6045('0x54')](_0x49194e[_0x6045('0x54')]);}}_0x6f374b[_0x6045('0x56')](_0x20d12c);if(_0x49194e[_0x6045('0x57')]){_0x49194e[_0x6045('0x57')][_0x6045('0x1a')](function(_0x4d1357){_0x4b72cd[_0x6045('0x57')]('c.'+_0x4d1357[0x0],_0x4d1357[0x1]===_0x6045('0x58')?![]:!![]);_0x6f374b[_0x6045('0x57')]('subqry.'+_0x4d1357[0x0],_0x4d1357[0x1]==='DESC'?![]:!![]);});}_0x6f374b[_0x6045('0x8')](_0x4b72cd,_0x6045('0xc'));return _0x6f374b;}function getFilteredContacts(_0x416dbc){var _0x1872e8=[];return db[_0x6045('0x39')][_0x6045('0x59')]({'attributes':['id',_0x6045('0x2f'),_0x6045('0x5a')],'raw':!![]})[_0x6045('0x4a')](function(_0x1c58b8){_0x1872e8=_[_0x6045('0x5b')](_0x1c58b8,'id');var _0x3bd429={'type':db[_0x6045('0x5c')][_0x6045('0x5d')]['SELECT'],'model':db[_0x6045('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6045('0x5f')][_0x6045('0x60')](_0x416dbc[_0x6045('0x61')](),_0x3bd429);})[_0x6045('0x4a')](function(_0x3caee1){_0x3caee1[_0x6045('0x1a')](function(_0x2c316c){if(_0x2c316c[_0x6045('0x1b')]){_0x2c316c[_0x6045('0x62')]=[];_0x2c316c[_0x6045('0x1b')]['split'](',')[_0x6045('0x1a')](function(_0x2d8c47){_0x2c316c['Tags'][_0x6045('0x19')](_0x1872e8[_0x2d8c47]);});}delete _0x2c316c[_0x6045('0x1b')];});return _0x3caee1;});}function countFilteredContacts(_0xdb8a8f,_0x4a1e71){var _0x1e9b66=_0xdb8a8f[_0x6045('0x63')]();_0x1e9b66['field']('COUNT(*)');_0x1e9b66=applyJoinClauses(_0x1e9b66,!![]);_0xdb8a8f['group'](_0x6045('0x64'));var _0x213a68=utils[_0x6045('0x1f')](_0x4a1e71);if(!_[_0x6045('0x65')](_0x213a68)){_0x1e9b66['where'](_0x6045('0x66'),_0x213a68);}var _0x491ec4={'type':db[_0x6045('0x5c')]['QueryTypes'][_0x6045('0x67')],'raw':!![]};return db[_0x6045('0x5f')][_0x6045('0x60')](_0x1e9b66[_0x6045('0x61')](),_0x491ec4)[_0x6045('0x4a')](function(_0x1d5d2f){return _0x1d5d2f[0x0][_0x6045('0x68')];});}module[_0x6045('0x69')]={'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 8bf251d..09db54b 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 _0x6a96=['secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','filter','indexOf','hasOwnProperty','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','createReadStream','createDecipher','close'];(function(_0x251fa4,_0x3d5860){var _0x453047=function(_0x337a6f){while(--_0x337a6f){_0x251fa4['push'](_0x251fa4['shift']());}};_0x453047(++_0x3d5860);}(_0x6a96,0x10c));var _0x66a9=function(_0x52eb16,_0x89c3d8){_0x52eb16=_0x52eb16-0x0;var _0x382d3f=_0x6a96[_0x52eb16];return _0x382d3f;};'use strict';var crypto=require(_0x66a9('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x66a9('0x1'));var config=require(_0x66a9('0x2'));var logger=require(_0x66a9('0x3'))(_0x66a9('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x66a9('0x5')][_0x66a9('0x6')],'algorithm':_0x66a9('0x7')};const fileOptions={'algorithm':_0x66a9('0x8')};if(config[_0x66a9('0x9')]&&config[_0x66a9('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x66a9('0x9')][_0x66a9('0xa')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x66a9('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x66a9('0xb')](',\x20');logger[_0x66a9('0xc')](config[_0x66a9('0x9')][_0x66a9('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x111b4d){return AES_SUPPORTED_RX[_0x66a9('0xd')](_0x111b4d);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x66a9('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x2be510){return getSupportedCiphers()[_0x66a9('0xf')](_0x2be510)>-0x1;}function combineOptions(_0x3edb66){var _0x2bdcaf={};for(var _0x27c5b9 in fileOptions){if(fileOptions['hasOwnProperty'](_0x27c5b9)){_0x2bdcaf[_0x27c5b9]=fileOptions[_0x27c5b9];}}if(_0x3edb66){for(var _0x5ae75e in _0x3edb66){if(_0x3edb66[_0x66a9('0x10')](_0x5ae75e)){_0x2bdcaf[_0x5ae75e]=_0x3edb66[_0x5ae75e];}}}return _0x2bdcaf;}exports['encryptFile']=function(_0x2f54b0,_0xd72e9b,_0x31da30,_0x174226){return new BPromise(function(_0x5a690,_0x44ade6){_0x174226=combineOptions(_0x174226);var _0xb1fe9=new Buffer(_0x31da30);var _0x5e2a10=fs['createReadStream'](_0x2f54b0);var _0x3c9725=fs[_0x66a9('0x11')](_0xd72e9b);var _0x4bb161=crypto[_0x66a9('0x12')](_0x174226[_0x66a9('0xa')],_0xb1fe9);_0x5e2a10['on'](_0x66a9('0x13'),function(_0x1ef307){var _0xa5c1c8=new Buffer(_0x4bb161[_0x66a9('0x14')](_0x1ef307),_0x66a9('0x15'));_0x3c9725[_0x66a9('0x16')](_0xa5c1c8);});_0x5e2a10['on'](_0x66a9('0x17'),function(){try{var _0x4f5f33=new Buffer(_0x4bb161[_0x66a9('0x18')](_0x66a9('0x15')),'binary');_0x3c9725[_0x66a9('0x16')](_0x4f5f33);_0x3c9725[_0x66a9('0x17')]();_0x3c9725['on']('close',function(){return _0x5a690(_0xd72e9b);});}catch(_0x3051f1){fs[_0x66a9('0x19')](_0xd72e9b);return _0x44ade6(_0x3051f1);}});});};exports['decryptFile']=function(_0x42b122,_0x137313,_0x13688c,_0x23147b){return new BPromise(function(_0x446399,_0x170827){_0x23147b=combineOptions(_0x23147b);var _0x14be0c=new Buffer(_0x13688c);var _0x5af18f=fs[_0x66a9('0x1a')](_0x42b122);var _0x295ef9=fs['createWriteStream'](_0x137313);var _0x5d491f=crypto[_0x66a9('0x1b')](_0x23147b['algorithm'],_0x14be0c);_0x5af18f['on'](_0x66a9('0x13'),function(_0x17c955){var _0x537c4b=new Buffer(_0x5d491f[_0x66a9('0x14')](_0x17c955),'binary');_0x295ef9[_0x66a9('0x16')](_0x537c4b);});_0x5af18f['on']('end',function(){try{var _0x540bd4=new Buffer(_0x5d491f[_0x66a9('0x18')](_0x66a9('0x15')),'binary');_0x295ef9['write'](_0x540bd4);_0x295ef9[_0x66a9('0x17')]();_0x295ef9['on'](_0x66a9('0x1c'),function(){return _0x446399(_0x137313);});}catch(_0x2aea28){fs['unlink'](_0x137313);return _0x170827(_0x2aea28);}});});};exports['encryptString']=function(_0x5dc231,_0x2fa7e5,_0x5056d1){var _0x4c48a5=_0x5056d1||stringOptions['algorithm'];var _0x5cf1e4=_0x2fa7e5||stringOptions[_0x66a9('0x1d')];var _0x11659a=crypto[_0x66a9('0x12')](_0x4c48a5,_0x5cf1e4);var _0x1234b5=_0x11659a[_0x66a9('0x14')](_0x5dc231,_0x66a9('0x1e'),'base64');_0x1234b5+=_0x11659a['final'](_0x66a9('0x1f'));return _0x1234b5;};exports[_0x66a9('0x20')]=function(_0x38f91b,_0x5eedc0,_0x59ca9a){var _0x253a22=_0x59ca9a||stringOptions[_0x66a9('0xa')];var _0x5721f5=_0x5eedc0||stringOptions[_0x66a9('0x1d')];var _0x29791a=crypto[_0x66a9('0x1b')](_0x253a22,_0x5721f5);var _0x5a1931=_0x29791a[_0x66a9('0x14')](_0x38f91b,_0x66a9('0x1f'),_0x66a9('0x1e'));_0x5a1931+=_0x29791a['final']('utf8');return _0x5a1931;}; \ No newline at end of file +var _0xda6a=['final','unlink','decryptFile','createReadStream','createDecipher','close','encryptString','secret','utf8','base64','decryptString','crypto','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end'];(function(_0x1a7c1a,_0x132b6d){var _0x239dba=function(_0x43394f){while(--_0x43394f){_0x1a7c1a['push'](_0x1a7c1a['shift']());}};_0x239dba(++_0x132b6d);}(_0xda6a,0x1af));var _0xada6=function(_0x58db5a,_0x26a3a0){_0x58db5a=_0x58db5a-0x0;var _0x42f89b=_0xda6a[_0x58db5a];return _0x42f89b;};'use strict';var crypto=require(_0xada6('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0xada6('0x1'));var logger=require('../../config/logger')(_0xada6('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xada6('0x3')][_0xada6('0x4')],'algorithm':_0xada6('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0xada6('0x6')]&&config[_0xada6('0x6')][_0xada6('0x7')]){var isSupported=isAlgorithmSupported(config[_0xada6('0x6')][_0xada6('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0xada6('0x6')][_0xada6('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xada6('0x8')](',\x20');logger[_0xada6('0x9')](config[_0xada6('0x6')][_0xada6('0x7')],_0xada6('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x2e60ee){return AES_SUPPORTED_RX[_0xada6('0xb')](_0x2e60ee);}function getSupportedCiphers(){return crypto[_0xada6('0xc')]()[_0xada6('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4d28fe){return getSupportedCiphers()[_0xada6('0xe')](_0x4d28fe)>-0x1;}function combineOptions(_0x106eca){var _0x53e52e={};for(var _0x39f86e in fileOptions){if(fileOptions[_0xada6('0xf')](_0x39f86e)){_0x53e52e[_0x39f86e]=fileOptions[_0x39f86e];}}if(_0x106eca){for(var _0x20afd0 in _0x106eca){if(_0x106eca['hasOwnProperty'](_0x20afd0)){_0x53e52e[_0x20afd0]=_0x106eca[_0x20afd0];}}}return _0x53e52e;}exports[_0xada6('0x10')]=function(_0x1b2ac9,_0x32d773,_0x39e315,_0x112fb7){return new BPromise(function(_0x8b6554,_0x1ee3f9){_0x112fb7=combineOptions(_0x112fb7);var _0x3831b8=new Buffer(_0x39e315);var _0x232689=fs['createReadStream'](_0x1b2ac9);var _0x7ba8d8=fs[_0xada6('0x11')](_0x32d773);var _0x1e4f94=crypto[_0xada6('0x12')](_0x112fb7['algorithm'],_0x3831b8);_0x232689['on'](_0xada6('0x13'),function(_0x5d1ab8){var _0x93b206=new Buffer(_0x1e4f94[_0xada6('0x14')](_0x5d1ab8),_0xada6('0x15'));_0x7ba8d8[_0xada6('0x16')](_0x93b206);});_0x232689['on'](_0xada6('0x17'),function(){try{var _0x3e1e76=new Buffer(_0x1e4f94[_0xada6('0x18')](_0xada6('0x15')),'binary');_0x7ba8d8[_0xada6('0x16')](_0x3e1e76);_0x7ba8d8[_0xada6('0x17')]();_0x7ba8d8['on']('close',function(){return _0x8b6554(_0x32d773);});}catch(_0x4bea1b){fs[_0xada6('0x19')](_0x32d773);return _0x1ee3f9(_0x4bea1b);}});});};exports[_0xada6('0x1a')]=function(_0x1a0b42,_0x56693d,_0x3cc961,_0x89f364){return new BPromise(function(_0x567e74,_0x53a318){_0x89f364=combineOptions(_0x89f364);var _0x19a6d4=new Buffer(_0x3cc961);var _0x3ce72a=fs[_0xada6('0x1b')](_0x1a0b42);var _0x34bf7c=fs['createWriteStream'](_0x56693d);var _0x291f27=crypto[_0xada6('0x1c')](_0x89f364[_0xada6('0x7')],_0x19a6d4);_0x3ce72a['on'](_0xada6('0x13'),function(_0x43b557){var _0x4e189e=new Buffer(_0x291f27[_0xada6('0x14')](_0x43b557),'binary');_0x34bf7c['write'](_0x4e189e);});_0x3ce72a['on']('end',function(){try{var _0x35d2cd=new Buffer(_0x291f27[_0xada6('0x18')](_0xada6('0x15')),_0xada6('0x15'));_0x34bf7c[_0xada6('0x16')](_0x35d2cd);_0x34bf7c[_0xada6('0x17')]();_0x34bf7c['on'](_0xada6('0x1d'),function(){return _0x567e74(_0x56693d);});}catch(_0x2ed4d4){fs[_0xada6('0x19')](_0x56693d);return _0x53a318(_0x2ed4d4);}});});};exports[_0xada6('0x1e')]=function(_0x1de42d,_0x375d61,_0x244777){var _0x497ae5=_0x244777||stringOptions['algorithm'];var _0x410999=_0x375d61||stringOptions[_0xada6('0x1f')];var _0x4daaa5=crypto[_0xada6('0x12')](_0x497ae5,_0x410999);var _0x246c10=_0x4daaa5[_0xada6('0x14')](_0x1de42d,_0xada6('0x20'),_0xada6('0x21'));_0x246c10+=_0x4daaa5[_0xada6('0x18')](_0xada6('0x21'));return _0x246c10;};exports[_0xada6('0x22')]=function(_0x526dbf,_0x30d2c6,_0xf80e42){var _0x3d0c39=_0xf80e42||stringOptions['algorithm'];var _0x28b6d9=_0x30d2c6||stringOptions['secret'];var _0x4fa34e=crypto[_0xada6('0x1c')](_0x3d0c39,_0x28b6d9);var _0x4faae2=_0x4fa34e[_0xada6('0x14')](_0x526dbf,_0xada6('0x21'),_0xada6('0x20'));_0x4faae2+=_0x4fa34e['final'](_0xada6('0x20'));return _0x4faae2;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 849dafb..e2c55e1 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 _0x5fae=['Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num'];(function(_0x900a62,_0x52889d){var _0x1f537a=function(_0x26b331){while(--_0x26b331){_0x900a62['push'](_0x900a62['shift']());}};_0x1f537a(++_0x52889d);}(_0x5fae,0x177));var _0xe5fa=function(_0x16e2e3,_0x4cfda9){_0x16e2e3=_0x16e2e3-0x0;var _0x20a490=_0x5fae[_0x16e2e3];return _0x20a490;};'use strict';var util=require(_0xe5fa('0x0'));var path=require(_0xe5fa('0x1'));var _=require(_0xe5fa('0x2'));var csv=require(_0xe5fa('0x3'));var fs=require('fs');var BPromise=require(_0xe5fa('0x4'));var zipdir=require(_0xe5fa('0x5'));var rimraf=require(_0xe5fa('0x6'));var db=require(_0xe5fa('0x7'))['db'];var dbH=require(_0xe5fa('0x7'))[_0xe5fa('0x8')];var logger=require('../../config/logger')(_0xe5fa('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe5fa('0xa')][0x2]);var QUERY=process[_0xe5fa('0xa')][0x3];var PATH=process[_0xe5fa('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4ab7d4,_0x22091d){var _0x252236={'status':_0x4ab7d4};var _0x50e705={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22091d){_0x252236['savename']=_0x22091d;}return db['AnalyticExtractedReport'][_0xe5fa('0xb')](_0x252236,_0x50e705);}function main(){var _0x484c29=0x1388;var _0x1d01b2;logger[_0xe5fa('0xc')](util[_0xe5fa('0xd')](_0xe5fa('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xe5fa('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe5fa('0x10'),'splitSizeCsv']})[_0xe5fa('0x11')](function(_0x47eb36){if(_0x47eb36){_0x1d01b2=_0x47eb36;_0x484c29=_0x1d01b2[_0xe5fa('0x12')]||0x1388;}})['then'](function(){return dbH[_0xe5fa('0x13')][_0xe5fa('0x14')](util['format'](_0xe5fa('0x15'),QUERY),{'type':dbH[_0xe5fa('0x13')][_0xe5fa('0x16')][_0xe5fa('0x17')]});})[_0xe5fa('0x11')](function(_0x45a2fd){if(!_0x45a2fd[0x0][_0xe5fa('0x18')]){return analyticExtractedReport(_0xe5fa('0x19'));}var _0x26d30b=[];var _0x28a07f=0x0;if(_0x1d01b2['split']){if(_0x45a2fd&&_0x45a2fd[_0xe5fa('0x1a')]){var _0x1e519a=_[_0xe5fa('0x1b')](_0x45a2fd[0x0][_0xe5fa('0x18')]/_0x484c29);var _0x3658e2=Number[_0xe5fa('0x1c')](_0x45a2fd[0x0][_0xe5fa('0x18')]/_0x484c29)?_0x45a2fd[0x0][_0xe5fa('0x18')]%_0x484c29:0x0;_0x1e519a[_0xe5fa('0x1d')](function(_0x86cd36){if(_0x86cd36>0x0){_0x28a07f+=_0x484c29;}_0x26d30b[_0xe5fa('0x1e')](dbH[_0xe5fa('0x13')][_0xe5fa('0x14')](util['format'](_0xe5fa('0x1f'),QUERY,_0x484c29,_0x28a07f),{'type':dbH[_0xe5fa('0x13')][_0xe5fa('0x16')][_0xe5fa('0x17')]}));});if(_0x3658e2>0x0){_0x28a07f+=_0x484c29;_0x26d30b[_0xe5fa('0x1e')](dbH[_0xe5fa('0x13')][_0xe5fa('0x14')](util['format'](_0xe5fa('0x1f'),QUERY,_0x3658e2,_0x28a07f),{'type':dbH[_0xe5fa('0x13')][_0xe5fa('0x16')][_0xe5fa('0x17')]}));}}}else{_0x26d30b[_0xe5fa('0x1e')](dbH[_0xe5fa('0x13')][_0xe5fa('0x14')](QUERY,{'type':dbH[_0xe5fa('0x13')]['QueryTypes']['SELECT']}));}var _0xf25641=path['dirname'](PATH);var _0x10817f=path[_0xe5fa('0x20')](PATH,_0xe5fa('0x21'));var _0x4988b4=_0x1d01b2[_0xe5fa('0x10')]&&_0x26d30b['length']>0x1;var _0x427237=[];if(!fs[_0xe5fa('0x22')](path[_0xe5fa('0x23')](_0xf25641,_0x10817f))&&_0x4988b4){fs[_0xe5fa('0x24')](path[_0xe5fa('0x23')](_0xf25641,_0x10817f));}return BPromise['each'](_0x26d30b,function(_0x209d32){_0x427237[_0xe5fa('0x1e')](_0x209d32);})['then'](function(){for(var _0x109e11=0x0;_0x109e11<_0x427237['length'];_0x109e11+=0x1){var _0x2e4ed7;var _0xfdf0ec=_0x427237[_0x109e11];if(_0x4988b4){_0x2e4ed7=path[_0xe5fa('0x23')](_0xf25641,_0x10817f,util[_0xe5fa('0xd')](_0xe5fa('0x25'),_0x10817f,_0x109e11,'csv'));}else{_0x2e4ed7=path[_0xe5fa('0x23')](_0xf25641,util[_0xe5fa('0xd')]('%s.%s',_0x10817f,_0xe5fa('0x26')));}fs[_0xe5fa('0x27')](_0x2e4ed7,csv(_0xfdf0ec));}})[_0xe5fa('0x11')](function(){if(_0x4988b4){return new Promise(function(_0x15c175){zipdir(path[_0xe5fa('0x23')](_0xf25641,_0x10817f),{'saveTo':path['join'](_0xf25641,util['format'](_0xe5fa('0x28'),_0x10817f,_0xe5fa('0x29')))},function(_0x3f91d2,_0xc14c09){rimraf(path['join'](_0xf25641,_0x10817f),function(){});_0x15c175(_0xe5fa('0x2a'));});});}})[_0xe5fa('0x11')](function(){logger[_0xe5fa('0xc')](util['format'](_0xe5fa('0x2b'),EXTRACTED_REPORT_ID,_0xe5fa('0x2c')));return analyticExtractedReport(_0xe5fa('0x2d'),_0x4988b4?util['format']('%s.%s',_0x10817f,_0x4988b4?'zip':_0xe5fa('0x26')):null);});})[_0xe5fa('0x2e')](function(_0x2cfcc1){logger[_0xe5fa('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe5fa('0x2c')),util['inspect'](_0x2cfcc1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe5fa('0x2f'));})[_0xe5fa('0x30')](function(){process[_0xe5fa('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x86a4=['QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','find','split','splitSizeCsv','then','sequelize','format'];(function(_0x4093ac,_0x1cdd3a){var _0x27629e=function(_0x15a493){while(--_0x15a493){_0x4093ac['push'](_0x4093ac['shift']());}};_0x27629e(++_0x1cdd3a);}(_0x86a4,0x1b5));var _0x486a=function(_0x4df9c7,_0x569f0d){_0x4df9c7=_0x4df9c7-0x0;var _0x812ce8=_0x86a4[_0x4df9c7];return _0x812ce8;};'use strict';var util=require(_0x486a('0x0'));var path=require(_0x486a('0x1'));var _=require(_0x486a('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x486a('0x3'));var zipdir=require(_0x486a('0x4'));var rimraf=require(_0x486a('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x486a('0x6'))[_0x486a('0x7')];var logger=require(_0x486a('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x486a('0x9')][0x2]);var QUERY=process[_0x486a('0x9')][0x3];var PATH=process[_0x486a('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x176633,_0x1edcce){var _0x2134eb={'status':_0x176633};var _0xa56e8e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1edcce){_0x2134eb[_0x486a('0xa')]=_0x1edcce;}return db[_0x486a('0xb')][_0x486a('0xc')](_0x2134eb,_0xa56e8e);}function main(){var _0x561be7=0x1388;var _0x5194f3;logger[_0x486a('0xd')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x486a('0xe')));return db[_0x486a('0xf')][_0x486a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x486a('0x11'),_0x486a('0x12')]})[_0x486a('0x13')](function(_0x385c40){if(_0x385c40){_0x5194f3=_0x385c40;_0x561be7=_0x5194f3[_0x486a('0x12')]||0x1388;}})[_0x486a('0x13')](function(){return dbH[_0x486a('0x14')]['query'](util[_0x486a('0x15')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x486a('0x16')][_0x486a('0x17')]});})[_0x486a('0x13')](function(_0x5c08ad){if(!_0x5c08ad[0x0]['num']){return analyticExtractedReport(_0x486a('0x18'));}var _0x1fc897=[];var _0x575133=0x0;if(_0x5194f3[_0x486a('0x11')]){if(_0x5c08ad&&_0x5c08ad[_0x486a('0x19')]){var _0x426741=_[_0x486a('0x1a')](_0x5c08ad[0x0][_0x486a('0x1b')]/_0x561be7);var _0x2f1667=Number[_0x486a('0x1c')](_0x5c08ad[0x0][_0x486a('0x1b')]/_0x561be7)?_0x5c08ad[0x0][_0x486a('0x1b')]%_0x561be7:0x0;_0x426741[_0x486a('0x1d')](function(_0x348aac){if(_0x348aac>0x0){_0x575133+=_0x561be7;}_0x1fc897[_0x486a('0x1e')](dbH[_0x486a('0x14')][_0x486a('0x1f')](util[_0x486a('0x15')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x561be7,_0x575133),{'type':dbH['sequelize'][_0x486a('0x16')][_0x486a('0x17')]}));});if(_0x2f1667>0x0){_0x575133+=_0x561be7;_0x1fc897[_0x486a('0x1e')](dbH['sequelize'][_0x486a('0x1f')](util[_0x486a('0x15')](_0x486a('0x20'),QUERY,_0x2f1667,_0x575133),{'type':dbH['sequelize'][_0x486a('0x16')][_0x486a('0x17')]}));}}}else{_0x1fc897['push'](dbH[_0x486a('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0x486a('0x16')]['SELECT']}));}var _0x17c230=path[_0x486a('0x21')](PATH);var _0x185a17=path[_0x486a('0x22')](PATH,_0x486a('0x23'));var _0x3b7d57=_0x5194f3['split']&&_0x1fc897[_0x486a('0x19')]>0x1;var _0x173be3=[];if(!fs['existsSync'](path[_0x486a('0x24')](_0x17c230,_0x185a17))&&_0x3b7d57){fs[_0x486a('0x25')](path[_0x486a('0x24')](_0x17c230,_0x185a17));}return BPromise[_0x486a('0x26')](_0x1fc897,function(_0x599940){_0x173be3[_0x486a('0x1e')](_0x599940);})[_0x486a('0x13')](function(){for(var _0x5748fe=0x0;_0x5748fe<_0x173be3[_0x486a('0x19')];_0x5748fe+=0x1){var _0x45ba6c;var _0x5b417f=_0x173be3[_0x5748fe];if(_0x3b7d57){_0x45ba6c=path[_0x486a('0x24')](_0x17c230,_0x185a17,util[_0x486a('0x15')](_0x486a('0x27'),_0x185a17,_0x5748fe,_0x486a('0x28')));}else{_0x45ba6c=path[_0x486a('0x24')](_0x17c230,util[_0x486a('0x15')](_0x486a('0x29'),_0x185a17,_0x486a('0x28')));}fs['writeFileSync'](_0x45ba6c,csv(_0x5b417f));}})[_0x486a('0x13')](function(){if(_0x3b7d57){return new Promise(function(_0x13d5ee){zipdir(path['join'](_0x17c230,_0x185a17),{'saveTo':path[_0x486a('0x24')](_0x17c230,util[_0x486a('0x15')]('%s.%s',_0x185a17,_0x486a('0x2a')))},function(_0x3b9034,_0x26706a){rimraf(path[_0x486a('0x24')](_0x17c230,_0x185a17),function(){});_0x13d5ee('zip\x20finished');});});}})[_0x486a('0x13')](function(){logger[_0x486a('0xd')](util[_0x486a('0x15')](_0x486a('0x2b'),EXTRACTED_REPORT_ID,_0x486a('0xe')));return analyticExtractedReport(_0x486a('0x2c'),_0x3b7d57?util[_0x486a('0x15')]('%s.%s',_0x185a17,_0x3b7d57?_0x486a('0x2a'):'csv'):null);});})[_0x486a('0x2d')](function(_0x3596c6){logger[_0x486a('0xd')](util[_0x486a('0x15')](_0x486a('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x486a('0x2f')](_0x3596c6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x486a('0x30'));})[_0x486a('0x31')](function(){process[_0x486a('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0c9f71d..a8639da 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 _0xf856=['startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','right','Empty','Setting','find','split','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','existsSync','mkdirSync','join','createPdfKitDocument','pdf','all','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0xf856,0xe8));var _0x6f85=function(_0x5b9886,_0x5f224f){_0x5b9886=_0x5b9886-0x0;var _0x3f1af3=_0xf856[_0x5b9886];return _0x3f1af3;};'use strict';var _=require(_0x6f85('0x0'));var fs=require('fs');var util=require(_0x6f85('0x1'));var path=require('path');var moment=require(_0x6f85('0x2'));var htmlToPdfmake=require(_0x6f85('0x3'));var PdfPrinter=require(_0x6f85('0x4'));var zipdir=require(_0x6f85('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x6f85('0x6'))[_0x6f85('0x7')];var window=new JSDOM('')[_0x6f85('0x8')];var BPromise=require(_0x6f85('0x9'));var db=require(_0x6f85('0xa'))['db'];var dbH=require(_0x6f85('0xa'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6f85('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6f85('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x6f85('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ac521,_0x3653b7){var _0x37daf5={'status':_0x2ac521};var _0x43c879={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3653b7){_0x37daf5[_0x6f85('0xd')]=_0x3653b7;}return db[_0x6f85('0xe')][_0x6f85('0xf')](_0x37daf5,_0x43c879);}function getHeaders(_0x39b72b){return _[_0x6f85('0x10')](_0x39b72b,function(_0x17f351){return{'text':_0x17f351,'style':_0x6f85('0x11')};});}function getRows(_0x182fc1,_0x2bcde7){return _[_0x6f85('0x10')](_0x2bcde7,function(_0x24846d){return _(_0x24846d)['pick'](_0x182fc1)[_0x6f85('0x10')](function(_0x3b933d){return _0x3b933d?_[_0x6f85('0x12')](_0x3b933d):'';})[_0x6f85('0x13')]();});}function createTable(_0x3a1bbe,_0x26fec0){var _0x3af3c6={'widths':_[_0x6f85('0x14')](Array(_0x3a1bbe[_0x6f85('0x15')]),0x91),'heights':function(_0x405413){return _0x405413===0x0?_0x6f85('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x359894=getHeaders(_0x3a1bbe);_0x3af3c6[_0x6f85('0x17')][_0x6f85('0x18')](_0x359894);var _0x2af807=getRows(_0x3a1bbe,_0x26fec0);_0x3af3c6[_0x6f85('0x17')]=_0x3af3c6[_0x6f85('0x17')][_0x6f85('0x19')](_0x2af807);return _0x3af3c6;}function createTables(_0x110130){var _0x1e683b=[];var _0x15545b=_[_0x6f85('0x1a')](Object[_0x6f85('0x1b')](_0x110130[0x0]),0x5);_0x15545b[_0x6f85('0x1c')](function(_0x1ec46c){_0x1e683b['push'](createTable(_0x1ec46c,_0x110130));});return _0x1e683b;}function getPDFDocDefinition(_0x376aa2){var _0x42d9dc=util[_0x6f85('0x1d')](_0x6f85('0x1e'),NAME,EXTRACTED_REPORT[_0x6f85('0x1f')],moment(EXTRACTED_REPORT[_0x6f85('0x20')])[_0x6f85('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x6f85('0x21')])[_0x6f85('0x1d')](FORMAT));var _0x166656=[];for(var _0x1472bd=0x0;_0x1472bd<_0x376aa2[_0x6f85('0x15')];_0x1472bd++){var _0x2fe3d6=[];if(_0x1472bd===0x0){_0x2fe3d6['push']({'text':_0x42d9dc,'style':_0x6f85('0x22')});}var _0x57b74a={'table':_0x376aa2[_0x1472bd]};if(_0x1472bd>0x0){_0x57b74a[_0x6f85('0x23')]='before';_0x57b74a[_0x6f85('0x24')]=[0x0,0x46,0x0,0x0];}_0x2fe3d6[_0x6f85('0x18')](_0x57b74a);_0x166656[_0x6f85('0x18')](_0x2fe3d6);}return{'pageSize':'A4','pageOrientation':_0x6f85('0x25'),'content':_0x166656,'footer':function(_0x2f79eb,_0x2efac7){return{'text':_0x2f79eb[_0x6f85('0x12')]()+_0x6f85('0x26')+_0x2efac7,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x6f85('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4f94b2){var _0x40ab9d=0x1388;var _0x42ae0b;if(!_0x4f94b2[0x0]['num']){return analyticExtractedReport(_0x6f85('0x28'));}return db[_0x6f85('0x29')][_0x6f85('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6f85('0x2b'),'splitSizePdf']})[_0x6f85('0x2c')](function(_0x248e69){if(_0x248e69){_0x42ae0b=_0x248e69;_0x40ab9d=_0x42ae0b['splitSizePdf']||0x3e8;}})['then'](function(){var _0x3839ad=[];var _0x5266ab=0x0;if(_0x42ae0b[_0x6f85('0x2b')]){if(_0x4f94b2&&_0x4f94b2[_0x6f85('0x15')]){var _0x4d4ecb=_[_0x6f85('0x2d')](_0x4f94b2[0x0]['num']/_0x40ab9d);var _0x33ab8c=Number[_0x6f85('0x2e')](_0x4f94b2[0x0]['num']/_0x40ab9d)?_0x4f94b2[0x0]['num']%_0x40ab9d:0x0;_0x4d4ecb[_0x6f85('0x1c')](function(_0x46b2ef){if(_0x46b2ef>0x0){_0x5266ab+=_0x40ab9d;}_0x3839ad[_0x6f85('0x18')](dbH[_0x6f85('0x2f')][_0x6f85('0x30')](util[_0x6f85('0x1d')](_0x6f85('0x31'),QUERY,_0x40ab9d,_0x5266ab),{'type':dbH[_0x6f85('0x2f')][_0x6f85('0x32')][_0x6f85('0x33')]}));});if(_0x33ab8c>0x0){_0x5266ab+=_0x40ab9d;_0x3839ad[_0x6f85('0x18')](dbH[_0x6f85('0x2f')][_0x6f85('0x30')](util[_0x6f85('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x33ab8c,_0x5266ab),{'type':dbH[_0x6f85('0x2f')][_0x6f85('0x32')][_0x6f85('0x33')]}));}}}else{_0x3839ad[_0x6f85('0x18')](dbH[_0x6f85('0x2f')][_0x6f85('0x30')](QUERY,{'type':dbH[_0x6f85('0x2f')]['QueryTypes'][_0x6f85('0x33')]}));}var _0x1b77ad=path[_0x6f85('0x34')](PATH);var _0x32f9cf=path['basename'](PATH,_0x6f85('0x35'));var _0x17d4b8=_0x42ae0b['split']&&_0x3839ad[_0x6f85('0x15')]>0x1;var _0x20955d=[];if(!fs[_0x6f85('0x36')](path['join'](_0x1b77ad,_0x32f9cf))&&_0x17d4b8){fs[_0x6f85('0x37')](path[_0x6f85('0x38')](_0x1b77ad,_0x32f9cf));}return BPromise['each'](_0x3839ad,function(_0x260e92){_0x20955d['push'](_0x260e92);})[_0x6f85('0x2c')](function(){var _0xbe8db1=[];for(var _0x1448c0=0x0;_0x1448c0<_0x20955d[_0x6f85('0x15')];_0x1448c0+=0x1){var _0x46aea6=_0x20955d[_0x1448c0];var _0x2267fe=createTables(_['flatten'](_0x46aea6));var _0x1288bc;var _0x2c9361=getPDFDocDefinition(_0x2267fe);var _0x1ab1a9=getPDFPrinter();var _0x47fa97=_0x1ab1a9[_0x6f85('0x39')](_0x2c9361);if(_0x17d4b8){_0x1288bc=path['join'](_0x1b77ad,_0x32f9cf,util['format']('%s%d.%s',_0x32f9cf,_0x1448c0,_0x6f85('0x3a')));}else{_0x1288bc=path[_0x6f85('0x38')](_0x1b77ad,util['format']('%s.%s',_0x32f9cf,_0x6f85('0x3a')));}_0xbe8db1[_0x6f85('0x18')](writePDFDocument(_0x47fa97,_0x1288bc));}return Promise[_0x6f85('0x3b')](_0xbe8db1);})[_0x6f85('0x2c')](function(){if(_0x17d4b8){return new Promise(function(_0x1916d9){zipdir(path[_0x6f85('0x38')](_0x1b77ad,_0x32f9cf),{'saveTo':path[_0x6f85('0x38')](_0x1b77ad,util['format'](_0x6f85('0x3c'),_0x32f9cf,_0x6f85('0x3d')))},function(){rimraf(path['join'](_0x1b77ad,_0x32f9cf),function(){});_0x1916d9('zip\x20finished');});});}})[_0x6f85('0x2c')](function(){if(!_0x17d4b8)return;rimraf(path['join'](_0x1b77ad,_0x32f9cf),function(){});})['then'](function(){logger['info'](util[_0x6f85('0x1d')](_0x6f85('0x3e'),EXTRACTED_REPORT_ID,_0x6f85('0x3f')));return analyticExtractedReport(_0x6f85('0x40'),_0x17d4b8?util['format'](_0x6f85('0x3c'),_0x32f9cf,_0x17d4b8?_0x6f85('0x3d'):_0x6f85('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x6f85('0x41')](util[_0x6f85('0x1d')](_0x6f85('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x6f85('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6f85('0x2c')](function(_0x2fc37c){EXTRACTED_REPORT=_0x2fc37c;return dbH['sequelize'][_0x6f85('0x30')](util[_0x6f85('0x1d')](_0x6f85('0x43'),QUERY),{'type':dbH['sequelize'][_0x6f85('0x32')][_0x6f85('0x33')]});})['then'](extractReport)[_0x6f85('0x44')](function(_0x5277bc){logger[_0x6f85('0x41')](util[_0x6f85('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6f85('0x3f')),util['inspect'](_0x5277bc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6f85('0x45'));})[_0x6f85('0x46')](function(){process[_0x6f85('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2729a1=new PdfPrinter({'Arial':{'normal':__dirname+_0x6f85('0x48'),'bold':__dirname+_0x6f85('0x49'),'italics':__dirname+_0x6f85('0x4a'),'bolditalics':__dirname+_0x6f85('0x4b')}});return _0x2729a1;}function getPDFDocDefinitionFromHTML(_0x434f13,_0x40d3ab){var _0x1be9c9=util[_0x6f85('0x1d')](_0x6f85('0x4c'),_0x40d3ab[_0x6f85('0x4d')],_0x40d3ab[_0x6f85('0x4e')]);var _0x3dbe80=moment()[_0x6f85('0x1d')](_0x6f85('0x4f'))[_0x6f85('0x12')]();var _0x5ca4dc=htmlToPdfmake(_0x434f13,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5ca4dc],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x6f85('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6f85('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6f85('0x50')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x6f85('0x22')}];},'footer':function(_0x310c9b,_0x53dbba){return[{'text':util['format'](_0x6f85('0x51'),_0x1be9c9,_0x310c9b,_0x53dbba,_0x3dbe80),'style':'footer'}];}};}function writePDFDocument(_0x4573fe,_0x572de5){return new Promise(function(_0x48311d,_0x4c3408){var _0x34e796=_0x4573fe[_0x6f85('0x52')](fs[_0x6f85('0x53')](_0x572de5));_0x34e796['on'](_0x6f85('0x54'),function(){_0x48311d(_0x6f85('0x54'));});_0x34e796['on'](_0x6f85('0x55'),function(_0x5713cd){_0x4c3408(_0x5713cd);});_0x4573fe[_0x6f85('0x56')]();});}exports[_0x6f85('0x57')]=function(_0x3af271,_0x4229db){var _0x1ee9bf=getPDFPrinter();var _0x3d03ea=getPDFDocDefinitionFromHTML(_0x3af271,_0x4229db);var _0x23a3c3=_0x1ee9bf[_0x6f85('0x39')](_0x3d03ea);return writePDFDocument(_0x23a3c3,_0x4229db['path'])['catch'](function(_0x344732){throw _0x344732;});}; \ No newline at end of file +var _0x25d7=['margin','landscape','toString','footer','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','QueryTypes','SELECT','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','createPdfFromHTML','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','map','tableHeader','pick','value','length','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','pageBreak','before'];(function(_0x3415d7,_0x664e60){var _0x5f0533=function(_0x268175){while(--_0x268175){_0x3415d7['push'](_0x3415d7['shift']());}};_0x5f0533(++_0x664e60);}(_0x25d7,0x159));var _0x725d=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x25d7[_0x59e862];return _0x1a25ee;};'use strict';var _=require(_0x725d('0x0'));var fs=require('fs');var util=require(_0x725d('0x1'));var path=require(_0x725d('0x2'));var moment=require(_0x725d('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x725d('0x4'));var zipdir=require(_0x725d('0x5'));var rimraf=require(_0x725d('0x6'));var JSDOM=require(_0x725d('0x7'))[_0x725d('0x8')];var window=new JSDOM('')[_0x725d('0x9')];var BPromise=require(_0x725d('0xa'));var db=require(_0x725d('0xb'))['db'];var dbH=require('../../mysqldb')[_0x725d('0xc')];var logger=require(_0x725d('0xd'))(_0x725d('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x725d('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x725d('0xf')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x581479,_0x4d4319){var _0x42b4b7={'status':_0x581479};var _0x3d4014={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d4319){_0x42b4b7[_0x725d('0x10')]=_0x4d4319;}return db['AnalyticExtractedReport'][_0x725d('0x11')](_0x42b4b7,_0x3d4014);}function getHeaders(_0x101b09){return _[_0x725d('0x12')](_0x101b09,function(_0x56f531){return{'text':_0x56f531,'style':_0x725d('0x13')};});}function getRows(_0x4e2e65,_0x1a60ba){return _[_0x725d('0x12')](_0x1a60ba,function(_0x22122a){return _(_0x22122a)[_0x725d('0x14')](_0x4e2e65)[_0x725d('0x12')](function(_0x53aaf6){return _0x53aaf6?_['toString'](_0x53aaf6):'';})[_0x725d('0x15')]();});}function createTable(_0x53e238,_0x5c48bb){var _0x41f22b={'widths':_['fill'](Array(_0x53e238[_0x725d('0x16')]),0x91),'heights':function(_0x275b24){return _0x275b24===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x127aaa=getHeaders(_0x53e238);_0x41f22b[_0x725d('0x17')]['push'](_0x127aaa);var _0x5cf321=getRows(_0x53e238,_0x5c48bb);_0x41f22b[_0x725d('0x17')]=_0x41f22b[_0x725d('0x17')][_0x725d('0x18')](_0x5cf321);return _0x41f22b;}function createTables(_0x5c63bc){var _0x24c8ac=[];var _0x39dda7=_[_0x725d('0x19')](Object[_0x725d('0x1a')](_0x5c63bc[0x0]),0x5);_0x39dda7[_0x725d('0x1b')](function(_0x4b1d33){_0x24c8ac[_0x725d('0x1c')](createTable(_0x4b1d33,_0x5c63bc));});return _0x24c8ac;}function getPDFDocDefinition(_0x3849b5){var _0x4e65b4=util[_0x725d('0x1d')](_0x725d('0x1e'),NAME,EXTRACTED_REPORT[_0x725d('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0x725d('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x725d('0x20')])[_0x725d('0x1d')](FORMAT));var _0x34030b=[];for(var _0x48b70b=0x0;_0x48b70b<_0x3849b5[_0x725d('0x16')];_0x48b70b++){var _0x418dc4=[];if(_0x48b70b===0x0){_0x418dc4[_0x725d('0x1c')]({'text':_0x4e65b4,'style':'header'});}var _0x218828={'table':_0x3849b5[_0x48b70b]};if(_0x48b70b>0x0){_0x218828[_0x725d('0x21')]=_0x725d('0x22');_0x218828[_0x725d('0x23')]=[0x0,0x46,0x0,0x0];}_0x418dc4[_0x725d('0x1c')](_0x218828);_0x34030b[_0x725d('0x1c')](_0x418dc4);}return{'pageSize':'A4','pageOrientation':_0x725d('0x24'),'content':_0x34030b,'footer':function(_0x1ef852,_0x5ab857){return{'text':_0x1ef852[_0x725d('0x25')]()+'\x20/\x20'+_0x5ab857,'style':_0x725d('0x26')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x725d('0x27')},'footer':{'alignment':_0x725d('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x173859){var _0x3aec7f=0x1388;var _0x275dae;if(!_0x173859[0x0][_0x725d('0x29')]){return analyticExtractedReport(_0x725d('0x2a'));}return db[_0x725d('0x2b')][_0x725d('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x725d('0x2d'),_0x725d('0x2e')]})['then'](function(_0x737927){if(_0x737927){_0x275dae=_0x737927;_0x3aec7f=_0x275dae[_0x725d('0x2e')]||0x3e8;}})[_0x725d('0x2f')](function(){var _0x3c3938=[];var _0x5ae0c1=0x0;if(_0x275dae[_0x725d('0x2d')]){if(_0x173859&&_0x173859[_0x725d('0x16')]){var _0x11ed3a=_[_0x725d('0x30')](_0x173859[0x0][_0x725d('0x29')]/_0x3aec7f);var _0x432715=Number[_0x725d('0x31')](_0x173859[0x0]['num']/_0x3aec7f)?_0x173859[0x0][_0x725d('0x29')]%_0x3aec7f:0x0;_0x11ed3a['forEach'](function(_0x461961){if(_0x461961>0x0){_0x5ae0c1+=_0x3aec7f;}_0x3c3938[_0x725d('0x1c')](dbH[_0x725d('0x32')]['query'](util[_0x725d('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3aec7f,_0x5ae0c1),{'type':dbH[_0x725d('0x32')][_0x725d('0x33')][_0x725d('0x34')]}));});if(_0x432715>0x0){_0x5ae0c1+=_0x3aec7f;_0x3c3938['push'](dbH[_0x725d('0x32')][_0x725d('0x35')](util[_0x725d('0x1d')](_0x725d('0x36'),QUERY,_0x432715,_0x5ae0c1),{'type':dbH['sequelize'][_0x725d('0x33')][_0x725d('0x34')]}));}}}else{_0x3c3938[_0x725d('0x1c')](dbH[_0x725d('0x32')][_0x725d('0x35')](QUERY,{'type':dbH[_0x725d('0x32')][_0x725d('0x33')]['SELECT']}));}var _0x24bde7=path[_0x725d('0x37')](PATH);var _0x5d8267=path[_0x725d('0x38')](PATH,_0x725d('0x39'));var _0x32dcb5=_0x275dae[_0x725d('0x2d')]&&_0x3c3938[_0x725d('0x16')]>0x1;var _0x790ae7=[];if(!fs[_0x725d('0x3a')](path[_0x725d('0x3b')](_0x24bde7,_0x5d8267))&&_0x32dcb5){fs[_0x725d('0x3c')](path[_0x725d('0x3b')](_0x24bde7,_0x5d8267));}return BPromise[_0x725d('0x3d')](_0x3c3938,function(_0x5e02cf){_0x790ae7[_0x725d('0x1c')](_0x5e02cf);})[_0x725d('0x2f')](function(){var _0x5a6fd0=[];for(var _0x167908=0x0;_0x167908<_0x790ae7[_0x725d('0x16')];_0x167908+=0x1){var _0x3ae3cb=_0x790ae7[_0x167908];var _0x13bcf2=createTables(_[_0x725d('0x3e')](_0x3ae3cb));var _0x58ffd4;var _0x911299=getPDFDocDefinition(_0x13bcf2);var _0x134953=getPDFPrinter();var _0x55ca2c=_0x134953[_0x725d('0x3f')](_0x911299);if(_0x32dcb5){_0x58ffd4=path[_0x725d('0x3b')](_0x24bde7,_0x5d8267,util[_0x725d('0x1d')](_0x725d('0x40'),_0x5d8267,_0x167908,_0x725d('0x41')));}else{_0x58ffd4=path[_0x725d('0x3b')](_0x24bde7,util[_0x725d('0x1d')](_0x725d('0x42'),_0x5d8267,_0x725d('0x41')));}_0x5a6fd0[_0x725d('0x1c')](writePDFDocument(_0x55ca2c,_0x58ffd4));}return Promise[_0x725d('0x43')](_0x5a6fd0);})[_0x725d('0x2f')](function(){if(_0x32dcb5){return new Promise(function(_0x2f5aac){zipdir(path['join'](_0x24bde7,_0x5d8267),{'saveTo':path[_0x725d('0x3b')](_0x24bde7,util['format'](_0x725d('0x42'),_0x5d8267,_0x725d('0x44')))},function(){rimraf(path[_0x725d('0x3b')](_0x24bde7,_0x5d8267),function(){});_0x2f5aac(_0x725d('0x45'));});});}})[_0x725d('0x2f')](function(){if(!_0x32dcb5)return;rimraf(path['join'](_0x24bde7,_0x5d8267),function(){});})[_0x725d('0x2f')](function(){logger['info'](util['format'](_0x725d('0x46'),EXTRACTED_REPORT_ID,_0x725d('0x47')));return analyticExtractedReport('Completed',_0x32dcb5?util[_0x725d('0x1d')]('%s.%s',_0x5d8267,_0x32dcb5?'zip':_0x725d('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x725d('0x48'),EXTRACTED_REPORT_ID,_0x725d('0x47')));return db[_0x725d('0x49')][_0x725d('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x725d('0x2f')](function(_0x347112){EXTRACTED_REPORT=_0x347112;return dbH[_0x725d('0x32')][_0x725d('0x35')](util['format'](_0x725d('0x4b'),QUERY),{'type':dbH[_0x725d('0x32')]['QueryTypes'][_0x725d('0x34')]});})[_0x725d('0x2f')](extractReport)[_0x725d('0x4c')](function(_0x53dcf6){logger[_0x725d('0x4d')](util[_0x725d('0x1d')](_0x725d('0x4e'),EXTRACTED_REPORT_ID,_0x725d('0x47')),util['inspect'](_0x53dcf6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x725d('0x4f')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2a5c10=new PdfPrinter({'Arial':{'normal':__dirname+_0x725d('0x50'),'bold':__dirname+_0x725d('0x51'),'italics':__dirname+_0x725d('0x52'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2a5c10;}function getPDFDocDefinitionFromHTML(_0x2424da,_0xde55d8){var _0x135bbd=util[_0x725d('0x1d')](_0x725d('0x53'),_0xde55d8[_0x725d('0x54')],_0xde55d8[_0x725d('0x55')]);var _0x3b262a=moment()[_0x725d('0x1d')](_0x725d('0x56'))['toString']();var _0x5c2073=htmlToPdfmake(_0x2424da,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5c2073],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x725d('0x57'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x725d('0x57'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x725d('0x57')}},'header':function(){return[{'text':_0x725d('0x58'),'style':_0x725d('0x59')}];},'footer':function(_0x129e3b,_0x224ca0){return[{'text':util['format'](_0x725d('0x5a'),_0x135bbd,_0x129e3b,_0x224ca0,_0x3b262a),'style':_0x725d('0x26')}];}};}function writePDFDocument(_0x4d8349,_0xc08ab9){return new Promise(function(_0x3976df,_0xcf5d4c){var _0x451c9b=_0x4d8349['pipe'](fs['createWriteStream'](_0xc08ab9));_0x451c9b['on'](_0x725d('0x5b'),function(){_0x3976df('finish');});_0x451c9b['on'](_0x725d('0x5c'),function(_0x2f0ed8){_0xcf5d4c(_0x2f0ed8);});_0x4d8349[_0x725d('0x5d')]();});}exports[_0x725d('0x5e')]=function(_0x2514d3,_0x27a88b){var _0x371f73=getPDFPrinter();var _0x246cad=getPDFDocDefinitionFromHTML(_0x2514d3,_0x27a88b);var _0x3f2bee=_0x371f73['createPdfKitDocument'](_0x246cad);return writePDFDocument(_0x3f2bee,_0x27a88b[_0x725d('0x2')])[_0x725d('0x4c')](function(_0x40487f){throw _0x40487f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index b55b2d7..a4f5530 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 _0xa0ed=['writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','length','existsSync','join','each','%s%d.%s','xlsx','%s.%s'];(function(_0x4cec01,_0x3e24b2){var _0x1ad81c=function(_0x3cd654){while(--_0x3cd654){_0x4cec01['push'](_0x4cec01['shift']());}};_0x1ad81c(++_0x3e24b2);}(_0xa0ed,0x1a2));var _0xda0e=function(_0x378e56,_0x1b4df4){_0x378e56=_0x378e56-0x0;var _0x9e6292=_0xa0ed[_0x378e56];return _0x9e6292;};'use strict';var util=require(_0xda0e('0x0'));var path=require(_0xda0e('0x1'));var _=require(_0xda0e('0x2'));var fs=require('fs');var json2xls=require(_0xda0e('0x3'));var BPromise=require(_0xda0e('0x4'));var zipdir=require(_0xda0e('0x5'));var rimraf=require(_0xda0e('0x6'));var db=require(_0xda0e('0x7'))['db'];var dbH=require(_0xda0e('0x7'))[_0xda0e('0x8')];var logger=require(_0xda0e('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xda0e('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xda0e('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x447dfd,_0x2874db){var _0x4a008f={'status':_0x447dfd};var _0x9f145d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2874db){_0x4a008f[_0xda0e('0xb')]=_0x2874db;}return db[_0xda0e('0xc')][_0xda0e('0xd')](_0x4a008f,_0x9f145d);}function main(){var _0x4443c5=0x1388;var _0x2e9731;logger[_0xda0e('0xe')](util[_0xda0e('0xf')](_0xda0e('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xda0e('0x11')][_0xda0e('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xda0e('0x13'),_0xda0e('0x14')]})['then'](function(_0x101a00){if(_0x101a00){_0x2e9731=_0x101a00;_0x4443c5=_0x2e9731[_0xda0e('0x14')]||0x1388;}})[_0xda0e('0x15')](function(){return dbH['sequelize'][_0xda0e('0x16')](util['format'](_0xda0e('0x17'),QUERY),{'type':dbH[_0xda0e('0x18')]['QueryTypes'][_0xda0e('0x19')]});})['then'](function(_0x155d4a){if(!_0x155d4a[0x0]['num']){return analyticExtractedReport('Empty');}var _0x3e51c2=[];var _0x55c570=0x0;if(_0x2e9731[_0xda0e('0x13')]){if(_0x155d4a&&_0x155d4a['length']){var _0x3e0f48=_['range'](_0x155d4a[0x0][_0xda0e('0x1a')]/_0x4443c5);var _0x17ff8f=Number['isInteger'](_0x155d4a[0x0]['num']/_0x4443c5)?_0x155d4a[0x0][_0xda0e('0x1a')]%_0x4443c5:0x0;_0x3e0f48[_0xda0e('0x1b')](function(_0x3e40eb){if(_0x3e40eb>0x0){_0x55c570+=_0x4443c5;}_0x3e51c2[_0xda0e('0x1c')](dbH[_0xda0e('0x18')][_0xda0e('0x16')](util['format'](_0xda0e('0x1d'),QUERY,_0x4443c5,_0x55c570),{'type':dbH[_0xda0e('0x18')][_0xda0e('0x1e')][_0xda0e('0x19')]}));});if(_0x17ff8f>0x0){_0x55c570+=_0x4443c5;_0x3e51c2[_0xda0e('0x1c')](dbH[_0xda0e('0x18')][_0xda0e('0x16')](util[_0xda0e('0xf')](_0xda0e('0x1d'),QUERY,_0x17ff8f,_0x55c570),{'type':dbH[_0xda0e('0x18')][_0xda0e('0x1e')][_0xda0e('0x19')]}));}}}else{_0x3e51c2[_0xda0e('0x1c')](dbH[_0xda0e('0x18')][_0xda0e('0x16')](QUERY,{'type':dbH[_0xda0e('0x18')]['QueryTypes']['SELECT']}));}var _0x263db8=path[_0xda0e('0x1f')](PATH);var _0x4be5ee=path[_0xda0e('0x20')](PATH,_0xda0e('0x21'));var _0x197e97=_0x2e9731[_0xda0e('0x13')]&&_0x3e51c2[_0xda0e('0x22')]>0x1;var _0x5ba47c=[];if(!fs[_0xda0e('0x23')](path[_0xda0e('0x24')](_0x263db8,_0x4be5ee))&&_0x197e97){fs['mkdirSync'](path[_0xda0e('0x24')](_0x263db8,_0x4be5ee));}return BPromise[_0xda0e('0x25')](_0x3e51c2,function(_0x4b6707){_0x5ba47c[_0xda0e('0x1c')](_0x4b6707);})[_0xda0e('0x15')](function(){for(var _0x3e2e7c=0x0;_0x3e2e7c<_0x5ba47c[_0xda0e('0x22')];_0x3e2e7c+=0x1){var _0x390cee;var _0x544609=_0x5ba47c[_0x3e2e7c];if(_0x197e97){_0x390cee=path[_0xda0e('0x24')](_0x263db8,_0x4be5ee,util[_0xda0e('0xf')](_0xda0e('0x26'),_0x4be5ee,_0x3e2e7c,_0xda0e('0x27')));}else{_0x390cee=path[_0xda0e('0x24')](_0x263db8,util[_0xda0e('0xf')](_0xda0e('0x28'),_0x4be5ee,_0xda0e('0x27')));}fs[_0xda0e('0x29')](_0x390cee,json2xls(_0x544609),_0xda0e('0x2a'));}})[_0xda0e('0x15')](function(){if(_0x197e97){return new Promise(function(_0x1c8aff){zipdir(path[_0xda0e('0x24')](_0x263db8,_0x4be5ee),{'saveTo':path[_0xda0e('0x24')](_0x263db8,util[_0xda0e('0xf')](_0xda0e('0x28'),_0x4be5ee,_0xda0e('0x2b')))},function(_0x50f29f,_0x2f307f){rimraf(path[_0xda0e('0x24')](_0x263db8,_0x4be5ee),function(){});_0x1c8aff(_0xda0e('0x2c'));});});}})['then'](function(){logger[_0xda0e('0xe')](util[_0xda0e('0xf')](_0xda0e('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xda0e('0x2e'),_0x197e97?util[_0xda0e('0xf')]('%s.%s',_0x4be5ee,_0x197e97?_0xda0e('0x2b'):_0xda0e('0x27')):null);});})['catch'](function(_0x47cda3){logger['info'](util[_0xda0e('0xf')](_0xda0e('0x2f'),EXTRACTED_REPORT_ID,_0xda0e('0x30')),util['inspect'](_0x47cda3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xda0e('0x31')](function(){process[_0xda0e('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xefdf=['%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','info','XLSX','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','argv','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','length','range','isInteger','forEach','push'];(function(_0x1363e5,_0x2795f5){var _0x4cd902=function(_0x22d81b){while(--_0x22d81b){_0x1363e5['push'](_0x1363e5['shift']());}};_0x4cd902(++_0x2795f5);}(_0xefdf,0x129));var _0xfefd=function(_0x9bca53,_0x59b4f8){_0x9bca53=_0x9bca53-0x0;var _0x3894bc=_0xefdf[_0x9bca53];return _0x3894bc;};'use strict';var util=require('util');var path=require(_0xfefd('0x0'));var _=require(_0xfefd('0x1'));var fs=require('fs');var json2xls=require(_0xfefd('0x2'));var BPromise=require(_0xfefd('0x3'));var zipdir=require(_0xfefd('0x4'));var rimraf=require('rimraf');var db=require(_0xfefd('0x5'))['db'];var dbH=require(_0xfefd('0x5'))['dbH'];var logger=require(_0xfefd('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xfefd('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xfefd('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cfce8,_0x463831){var _0x1ecb14={'status':_0x2cfce8};var _0x3bdeac={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x463831){_0x1ecb14['savename']=_0x463831;}return db['AnalyticExtractedReport']['update'](_0x1ecb14,_0x3bdeac);}function main(){var _0x4a7fc5=0x1388;var _0x3cdd0f;logger['info'](util[_0xfefd('0x8')](_0xfefd('0x9'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xfefd('0xa')][_0xfefd('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfefd('0xc'),'splitSizeXlsx']})[_0xfefd('0xd')](function(_0x5f1fd9){if(_0x5f1fd9){_0x3cdd0f=_0x5f1fd9;_0x4a7fc5=_0x3cdd0f[_0xfefd('0xe')]||0x1388;}})[_0xfefd('0xd')](function(){return dbH['sequelize']['query'](util['format'](_0xfefd('0xf'),QUERY),{'type':dbH[_0xfefd('0x10')][_0xfefd('0x11')][_0xfefd('0x12')]});})[_0xfefd('0xd')](function(_0x3348ce){if(!_0x3348ce[0x0][_0xfefd('0x13')]){return analyticExtractedReport('Empty');}var _0x4a0cd7=[];var _0x24fc83=0x0;if(_0x3cdd0f['split']){if(_0x3348ce&&_0x3348ce[_0xfefd('0x14')]){var _0x541e54=_[_0xfefd('0x15')](_0x3348ce[0x0][_0xfefd('0x13')]/_0x4a7fc5);var _0x85cb10=Number[_0xfefd('0x16')](_0x3348ce[0x0]['num']/_0x4a7fc5)?_0x3348ce[0x0][_0xfefd('0x13')]%_0x4a7fc5:0x0;_0x541e54[_0xfefd('0x17')](function(_0x31d510){if(_0x31d510>0x0){_0x24fc83+=_0x4a7fc5;}_0x4a0cd7[_0xfefd('0x18')](dbH[_0xfefd('0x10')]['query'](util[_0xfefd('0x8')](_0xfefd('0x19'),QUERY,_0x4a7fc5,_0x24fc83),{'type':dbH[_0xfefd('0x10')][_0xfefd('0x11')][_0xfefd('0x12')]}));});if(_0x85cb10>0x0){_0x24fc83+=_0x4a7fc5;_0x4a0cd7[_0xfefd('0x18')](dbH[_0xfefd('0x10')][_0xfefd('0x1a')](util[_0xfefd('0x8')](_0xfefd('0x19'),QUERY,_0x85cb10,_0x24fc83),{'type':dbH[_0xfefd('0x10')][_0xfefd('0x11')][_0xfefd('0x12')]}));}}}else{_0x4a0cd7[_0xfefd('0x18')](dbH[_0xfefd('0x10')][_0xfefd('0x1a')](QUERY,{'type':dbH[_0xfefd('0x10')]['QueryTypes'][_0xfefd('0x12')]}));}var _0x12ded8=path[_0xfefd('0x1b')](PATH);var _0x165723=path[_0xfefd('0x1c')](PATH,_0xfefd('0x1d'));var _0x14d1a2=_0x3cdd0f[_0xfefd('0xc')]&&_0x4a0cd7[_0xfefd('0x14')]>0x1;var _0x35a5e6=[];if(!fs['existsSync'](path[_0xfefd('0x1e')](_0x12ded8,_0x165723))&&_0x14d1a2){fs[_0xfefd('0x1f')](path[_0xfefd('0x1e')](_0x12ded8,_0x165723));}return BPromise[_0xfefd('0x20')](_0x4a0cd7,function(_0x414fb2){_0x35a5e6[_0xfefd('0x18')](_0x414fb2);})[_0xfefd('0xd')](function(){for(var _0x1457f6=0x0;_0x1457f6<_0x35a5e6[_0xfefd('0x14')];_0x1457f6+=0x1){var _0x3e846f;var _0x3d0a7f=_0x35a5e6[_0x1457f6];if(_0x14d1a2){_0x3e846f=path[_0xfefd('0x1e')](_0x12ded8,_0x165723,util[_0xfefd('0x8')](_0xfefd('0x21'),_0x165723,_0x1457f6,_0xfefd('0x22')));}else{_0x3e846f=path[_0xfefd('0x1e')](_0x12ded8,util['format'](_0xfefd('0x23'),_0x165723,_0xfefd('0x22')));}fs[_0xfefd('0x24')](_0x3e846f,json2xls(_0x3d0a7f),'binary');}})['then'](function(){if(_0x14d1a2){return new Promise(function(_0x3d0f7a){zipdir(path[_0xfefd('0x1e')](_0x12ded8,_0x165723),{'saveTo':path[_0xfefd('0x1e')](_0x12ded8,util['format']('%s.%s',_0x165723,_0xfefd('0x25')))},function(_0x1236f2,_0x233900){rimraf(path['join'](_0x12ded8,_0x165723),function(){});_0x3d0f7a('zip\x20finished');});});}})[_0xfefd('0xd')](function(){logger[_0xfefd('0x26')](util[_0xfefd('0x8')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfefd('0x27')));return analyticExtractedReport('Completed',_0x14d1a2?util[_0xfefd('0x8')](_0xfefd('0x23'),_0x165723,_0x14d1a2?_0xfefd('0x25'):_0xfefd('0x22')):null);});})[_0xfefd('0x28')](function(_0x4ba8fe){logger[_0xfefd('0x26')](util['format'](_0xfefd('0x29'),EXTRACTED_REPORT_ID,_0xfefd('0x27')),util[_0xfefd('0x2a')](_0x4ba8fe,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfefd('0x2b'));})[_0xfefd('0x2c')](function(){process[_0xfefd('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3ce780c..a81f0a4 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 _0xcaf4=['CDR(type)=%s','context','VoiceExtensionId','Set','CDR(routeid)=','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','updatedAt','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','Interval','findAll','then','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','find','push','type'];(function(_0x862675,_0x50f294){var _0x184170=function(_0xc32a33){while(--_0xc32a33){_0x862675['push'](_0x862675['shift']());}};_0x184170(++_0x50f294);}(_0xcaf4,0xbc));var _0x4caf=function(_0x5c42bd,_0x45b22b){_0x5c42bd=_0x5c42bd-0x0;var _0x5b3ea2=_0xcaf4[_0x5c42bd];return _0x5b3ea2;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x31731a,_0x340a32){var _0x342afb=this;return _0x31731a['models'][_0x4caf('0x0')][_0x4caf('0x1')]({'raw':!![]})[_0x4caf('0x2')](function(_0x80a1b5){_0x342afb['intervals']=_0x80a1b5;return _0x31731a[_0x4caf('0x3')][_0x4caf('0x4')][_0x4caf('0x1')]({'where':{'IntervalId':_0x340a32[_0x4caf('0x5')]},'raw':!![]});})['then'](function(_0x4ec326){return _0x31731a[_0x4caf('0x3')][_0x4caf('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x4caf('0x6')](_[_0x4caf('0x7')](_0x4ec326,_0x4caf('0x8')))}},'order':[{'raw':_0x4caf('0x9')}],'raw':!![]});})[_0x4caf('0x2')](function(_0x19dfec){var _0x422f3b=_[_0x4caf('0xa')](_0x19dfec,{'priority':'1'});var _0x53815b=_[_0x4caf('0xa')](_0x19dfec,{'isApp':0x1});var _0x9379b4=_['groupBy'](_0x53815b,_0x4caf('0x8'));var _0x21ba61=[_0x4caf('0xb'),'playback'];var _0x46db7d=[];var _0x58b517=[];for(var _0x554aef in _0x9379b4){if(_0x9379b4[_0x4caf('0xc')](_0x554aef)){_0x342afb[_0x4caf('0xd')]=0x2;_0x342afb[_0x4caf('0xe')]=[];_0x342afb[_0x4caf('0xf')]=_[_0x4caf('0x10')](_0x422f3b,{'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')]});_0x342afb['extensions'][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':'Set','appdata':util['format'](_0x4caf('0x13'),_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')]),'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0]['exten'],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});if(_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')]==='inbound'){_0x342afb[_0x4caf('0xe')]['push']({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x4caf('0x17')+_0x9379b4[_0x554aef][0x0]['VoiceExtensionId'],'context':_0x9379b4[_0x554aef][0x0]['context'],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});}else if(_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')]===_0x4caf('0x18')){if(_0x342afb[_0x4caf('0xf')]){_0x342afb[_0x4caf('0xe')][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':'Set','appdata':'CDR(destination)='+(_0x342afb[_0x4caf('0xf')][_0x4caf('0x19')]?_0x4caf('0x1a')+_0x342afb[_0x4caf('0xf')][_0x4caf('0x19')]+'}':_0x4caf('0x1b')),'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});}_0x342afb['extensions'][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x4caf('0x17')+_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')],'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb['priority']++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});var _0x561fec=_0x342afb['priority']++;_0x342afb['extensions'][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':_0x4caf('0x1c'),'appdata':_0x4caf('0x1d')+(_0x561fec+0x2)+_0x4caf('0x1e')+(_0x561fec+0x1)+')','context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x561fec,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});if(_0x342afb['extension']){_0x342afb[_0x4caf('0xe')][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x342afb[_0x4caf('0xf')][_0x4caf('0x19')]?_0x4caf('0x1f')+_0x342afb[_0x4caf('0xf')][_0x4caf('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x9379b4[_0x554aef][0x0]['context'],'exten':_0x9379b4[_0x554aef][0x0]['exten'],'priority':_0x342afb['priority']++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});}_0x342afb[_0x4caf('0xe')][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x4caf('0x20')+_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')],'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});if(_0x342afb[_0x4caf('0xf')]&&_0x342afb[_0x4caf('0xf')][_0x4caf('0xc')](_0x4caf('0x21'))&&_0x342afb['extension'][_0x4caf('0x21')]!==_0x4caf('0x22')){_0x342afb['extensions'][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x4caf('0x23'),'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});_0x342afb[_0x4caf('0xe')][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':'Set','appdata':_0x4caf('0x24')+_0x342afb[_0x4caf('0xf')][_0x4caf('0x21')]||_0x4caf('0x25'),'context':_0x9379b4[_0x554aef][0x0]['context'],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});}}_0x342afb[_0x4caf('0xe')]['push']({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':'Set','appdata':_0x4caf('0x26'),'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0]['VoiceExtensionId']});_0x342afb[_0x4caf('0xe')][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0][_0x4caf('0x12')],'app':'Set','appdata':_0x4caf('0x27'),'context':_0x9379b4[_0x554aef][0x0]['context'],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0]['VoiceExtensionId']});_0x342afb[_0x4caf('0xe')][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0]['type'],'app':'Set','appdata':_0x4caf('0x28'),'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'exten':_0x9379b4[_0x554aef][0x0][_0x4caf('0x8')],'priority':_0x342afb[_0x4caf('0xd')]++,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0]['VoiceExtensionId']});for(var _0x2ec733=0x0,_0x1aa431=0x0;_0x2ec733<_0x9379b4[_0x554aef]['length'];_0x2ec733+=0x1,_0x1aa431=0x0){var _0x5a7c36=_0x9379b4[_0x554aef][_0x2ec733];if(_0x5a7c36['type']){_0x5a7c36[_0x4caf('0x12')]=_0x5a7c36[_0x4caf('0x12')]['toLowerCase']();}var _0x1a7272=[];var _0x2fb88e=[];delete _0x5a7c36['id'];delete _0x5a7c36['createdAt'];delete _0x5a7c36[_0x4caf('0x29')];var _0x22370e=_0x5a7c36[_0x4caf('0x2a')]!=='*,*,*,*'?[_0x5a7c36[_0x4caf('0x2a')]]:_0x5a7c36[_0x4caf('0x5')]?_[_0x4caf('0x7')](_[_0x4caf('0xa')](_0x342afb['intervals'],{'IntervalId':_0x5a7c36[_0x4caf('0x5')]}),_0x4caf('0x2a')):[];if(_0x5a7c36[_0x4caf('0xc')](_0x4caf('0x2b'))){if(_0x5a7c36[_0x4caf('0x2b')]&&_0x5a7c36[_0x4caf('0x2b')]!=='--'){_0x1a7272[_0x4caf('0x11')]({'type':_0x5a7c36[_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x4caf('0x2c')+_0x5a7c36[_0x4caf('0x2b')],'context':_0x5a7c36[_0x4caf('0x14')],'exten':_0x5a7c36[_0x4caf('0x8')],'priority':_0x22370e[_0x4caf('0x2d')]+_0x342afb[_0x4caf('0xd')]+_0x1aa431++,'VoiceExtensionId':_0x5a7c36['VoiceExtensionId']});}}if(_0x5a7c36['type']===_0x4caf('0x18')&&_0x5a7c36[_0x4caf('0xc')](_0x4caf('0x2e'))){if(_0x5a7c36[_0x4caf('0x2e')]){_0x1a7272[_0x4caf('0x11')]({'type':_0x5a7c36[_0x4caf('0x12')],'app':_0x4caf('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5a7c36[_0x4caf('0x2e')]+')','context':_0x5a7c36[_0x4caf('0x14')],'exten':_0x5a7c36['exten'],'priority':_0x22370e[_0x4caf('0x2d')]+_0x342afb[_0x4caf('0xd')]+_0x1aa431++,'VoiceExtensionId':_0x5a7c36[_0x4caf('0x15')]});}else{_0x1a7272['push']({'type':_0x5a7c36['type'],'app':_0x4caf('0x1c'),'appdata':_0x4caf('0x2f'),'context':_0x5a7c36[_0x4caf('0x14')],'exten':_0x5a7c36[_0x4caf('0x8')],'priority':_0x22370e['length']+_0x342afb[_0x4caf('0xd')]+_0x1aa431++,'VoiceExtensionId':_0x5a7c36['VoiceExtensionId']});}}if(_0x5a7c36[_0x4caf('0xc')](_0x4caf('0x30'))){if(_0x21ba61[_0x4caf('0x31')](_0x5a7c36[_0x4caf('0x32')][_0x4caf('0x33')]())>=0x0&&_0x5a7c36[_0x4caf('0x34')]!==_0x4caf('0x35')){if(_0x5a7c36[_0x4caf('0x30')]){_0x1a7272[_0x4caf('0x11')]({'type':_0x5a7c36['type'],'app':'ExecIf','appdata':_0x4caf('0x36'),'context':_0x5a7c36['context'],'exten':_0x5a7c36[_0x4caf('0x8')],'priority':_0x22370e[_0x4caf('0x2d')]+_0x342afb[_0x4caf('0xd')]+_0x1aa431++,'VoiceExtensionId':_0x5a7c36['VoiceExtensionId']});_0x1a7272['push']({'type':_0x5a7c36[_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x4caf('0x37'),'context':_0x5a7c36['context'],'exten':_0x5a7c36[_0x4caf('0x8')],'priority':_0x22370e[_0x4caf('0x2d')]+_0x342afb[_0x4caf('0xd')]+_0x1aa431++,'VoiceExtensionId':_0x5a7c36[_0x4caf('0x15')]});}else{_0x1a7272[_0x4caf('0x11')]({'type':_0x5a7c36['type'],'app':'ExecIf','appdata':_0x4caf('0x38'),'context':_0x5a7c36[_0x4caf('0x14')],'exten':_0x5a7c36[_0x4caf('0x8')],'priority':_0x22370e[_0x4caf('0x2d')]+_0x342afb[_0x4caf('0xd')]+_0x1aa431++,'VoiceExtensionId':_0x5a7c36['VoiceExtensionId']});_0x1a7272[_0x4caf('0x11')]({'type':_0x5a7c36[_0x4caf('0x12')],'app':_0x4caf('0x16'),'appdata':_0x4caf('0x39'),'context':_0x5a7c36[_0x4caf('0x14')],'exten':_0x5a7c36['exten'],'priority':_0x22370e[_0x4caf('0x2d')]+_0x342afb['priority']+_0x1aa431++,'VoiceExtensionId':_0x5a7c36['VoiceExtensionId']});}}}for(var _0x48ff28=0x0;_0x48ff28<_0x22370e[_0x4caf('0x2d')];_0x48ff28+=0x1){var _0x33b307=_0x342afb[_0x4caf('0xd')]+_0x22370e[_0x4caf('0x2d')];var _0x1f0ae6=_0x48ff28===_0x22370e[_0x4caf('0x2d')]-0x1?_0x342afb[_0x4caf('0xd')]+_0x1a7272['length']+_0x2fb88e['length']+0x2:_0x342afb[_0x4caf('0xd')]+_0x48ff28+0x1;_0x1a7272[_0x4caf('0x3a')](_0x48ff28,0x0,{'type':_0x5a7c36[_0x4caf('0x12')],'app':'GotoIfTime','appdata':_0x22370e[_0x48ff28]+'?'+_0x5a7c36[_0x4caf('0x14')]+_0x4caf('0x3b')+_0x33b307+':'+_0x5a7c36[_0x4caf('0x14')]+_0x4caf('0x3b')+_0x1f0ae6,'exten':_0x5a7c36[_0x4caf('0x8')],'context':_0x5a7c36[_0x4caf('0x14')],'priority':_0x342afb['priority']+_0x48ff28,'VoiceExtensionId':_0x9379b4[_0x554aef][0x0]['VoiceExtensionId']});}_0x5a7c36[_0x4caf('0xd')]=_0x1a7272[_0x4caf('0x2d')]?_[_0x4caf('0x3c')](_0x1a7272)[_0x4caf('0xd')]+0x1:_0x342afb[_0x4caf('0xd')];_0x342afb['priority']=(_0x2fb88e[_0x4caf('0x2d')]?_[_0x4caf('0x3c')](_0x2fb88e)[_0x4caf('0xd')]:_0x5a7c36[_0x4caf('0xd')])+0x1;_0x342afb[_0x4caf('0xe')]=_[_0x4caf('0x3d')](_0x342afb[_0x4caf('0xe')],_0x1a7272,[_0x5a7c36],_0x2fb88e);}_0x342afb[_0x4caf('0xe')][_0x4caf('0x11')]({'type':_0x9379b4[_0x554aef][0x0]['type'],'app':_0x4caf('0x3e'),'exten':_0x9379b4[_0x554aef][0x0]['exten'],'context':_0x9379b4[_0x554aef][0x0][_0x4caf('0x14')],'priority':_0x342afb['priority'],'VoiceExtensionId':_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]});_0x46db7d[_0x4caf('0x11')](_0x9379b4[_0x554aef][0x0][_0x4caf('0x15')]);_0x58b517=_[_0x4caf('0x3d')](_0x58b517,_0x342afb[_0x4caf('0xe')]);}}return _0x31731a[_0x4caf('0x3f')](function(_0x5804dc){return _0x31731a[_0x4caf('0x3')][_0x4caf('0x4')][_0x4caf('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x46db7d}},'transaction':_0x5804dc})[_0x4caf('0x2')](function(_0x493d81){return _0x31731a[_0x4caf('0x3')][_0x4caf('0x4')][_0x4caf('0x41')](_[_0x4caf('0x42')](_0x58b517,_0x4caf('0xd')),{'transaction':_0x5804dc});});});})[_0x4caf('0x43')](function(_0x194a51){console[_0x4caf('0x44')](_0x194a51);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x7f46=['app','toLowerCase','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','util','models','findAll','then','intervals','VoiceExtension','IntervalId','map','groupBy','queue','priority','extensions','extension','find','exten','push','type','format','CDR(type)=%s','VoiceExtensionId','Set','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','filter','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf'];(function(_0x21a209,_0x1b8347){var _0x40c2a8=function(_0x25ed46){while(--_0x25ed46){_0x21a209['push'](_0x21a209['shift']());}};_0x40c2a8(++_0x1b8347);}(_0x7f46,0xda));var _0x67f4=function(_0x79324e,_0x4af67e){_0x79324e=_0x79324e-0x0;var _0x555666=_0x7f46[_0x79324e];return _0x555666;};'use strict';var _=require('lodash');var util=require(_0x67f4('0x0'));function rewrite(_0x2874fc,_0x51f86d){var _0x2c5153=this;return _0x2874fc[_0x67f4('0x1')]['Interval'][_0x67f4('0x2')]({'raw':!![]})[_0x67f4('0x3')](function(_0x30ed22){_0x2c5153[_0x67f4('0x4')]=_0x30ed22;return _0x2874fc['models'][_0x67f4('0x5')][_0x67f4('0x2')]({'where':{'IntervalId':_0x51f86d[_0x67f4('0x6')]},'raw':!![]});})['then'](function(_0x1bf5ab){return _0x2874fc[_0x67f4('0x1')][_0x67f4('0x5')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x67f4('0x7')](_0x1bf5ab,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x67f4('0x3')](function(_0x2daede){var _0x4e9d79=_['filter'](_0x2daede,{'priority':'1'});var _0x51a217=_['filter'](_0x2daede,{'isApp':0x1});var _0x190faf=_[_0x67f4('0x8')](_0x51a217,'exten');var _0x449bde=[_0x67f4('0x9'),'playback'];var _0x191b2a=[];var _0x4cf3af=[];for(var _0x2c817a in _0x190faf){if(_0x190faf['hasOwnProperty'](_0x2c817a)){_0x2c5153[_0x67f4('0xa')]=0x2;_0x2c5153[_0x67f4('0xb')]=[];_0x2c5153[_0x67f4('0xc')]=_[_0x67f4('0xd')](_0x4e9d79,{'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')]});_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':'Set','appdata':util[_0x67f4('0x11')](_0x67f4('0x12'),_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')]),'context':_0x190faf[_0x2c817a][0x0]['context'],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153[_0x67f4('0xa')]++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});if(_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')]==='inbound'){_0x2c5153[_0x67f4('0xb')]['push']({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':'CDR(routeid)='+_0x190faf[_0x2c817a][0x0]['VoiceExtensionId'],'context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153['priority']++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0]['VoiceExtensionId']});}else if(_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')]===_0x67f4('0x16')){if(_0x2c5153[_0x67f4('0xc')]){_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':_0x67f4('0x17')+(_0x2c5153['extension'][_0x67f4('0x18')]?_0x67f4('0x19')+_0x2c5153[_0x67f4('0xc')][_0x67f4('0x18')]+'}':_0x67f4('0x1a')),'context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153['priority']++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0]['VoiceExtensionId']});}_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':_0x67f4('0x1b')+_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')],'context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153['priority']++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0]['VoiceExtensionId']});var _0x3d8522=_0x2c5153[_0x67f4('0xa')]++;_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d8522+0x2)+'):Goto('+(_0x3d8522+0x1)+')','context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x3d8522,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});if(_0x2c5153[_0x67f4('0xc')]){_0x2c5153['extensions'][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0]['type'],'app':_0x67f4('0x14'),'appdata':_0x2c5153['extension'][_0x67f4('0x18')]?_0x67f4('0x1d')+_0x2c5153['extension'][_0x67f4('0x18')]+'}':_0x67f4('0x1e'),'context':_0x190faf[_0x2c817a][0x0]['context'],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153['priority']++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});}_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':'outboundrouteid='+_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')],'context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153[_0x67f4('0xa')]++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});if(_0x2c5153[_0x67f4('0xc')]&&_0x2c5153[_0x67f4('0xc')][_0x67f4('0x1f')](_0x67f4('0x20'))&&_0x2c5153[_0x67f4('0xc')][_0x67f4('0x20')]!==_0x67f4('0x21')){_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':'Set','appdata':_0x67f4('0x22'),'context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0]['exten'],'priority':_0x2c5153[_0x67f4('0xa')]++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2c5153[_0x67f4('0xc')][_0x67f4('0x20')]||'wav','context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153[_0x67f4('0xa')]++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});}}_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':_0x67f4('0x23'),'context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153[_0x67f4('0xa')]++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':_0x67f4('0x24'),'context':_0x190faf[_0x2c817a][0x0]['context'],'exten':_0x190faf[_0x2c817a][0x0][_0x67f4('0xe')],'priority':_0x2c5153[_0x67f4('0xa')]++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});_0x2c5153['extensions'][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':_0x67f4('0x25'),'context':_0x190faf[_0x2c817a][0x0]['context'],'exten':_0x190faf[_0x2c817a][0x0]['exten'],'priority':_0x2c5153[_0x67f4('0xa')]++,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});for(var _0x26680b=0x0,_0x3a9d0e=0x0;_0x26680b<_0x190faf[_0x2c817a]['length'];_0x26680b+=0x1,_0x3a9d0e=0x0){var _0x18ba45=_0x190faf[_0x2c817a][_0x26680b];if(_0x18ba45['type']){_0x18ba45[_0x67f4('0x10')]=_0x18ba45[_0x67f4('0x10')]['toLowerCase']();}var _0x2f612c=[];var _0x3c50a0=[];delete _0x18ba45['id'];delete _0x18ba45[_0x67f4('0x26')];delete _0x18ba45[_0x67f4('0x27')];var _0x1774a7=_0x18ba45[_0x67f4('0x28')]!==_0x67f4('0x29')?[_0x18ba45['interval']]:_0x18ba45[_0x67f4('0x6')]?_[_0x67f4('0x7')](_[_0x67f4('0x2a')](_0x2c5153[_0x67f4('0x4')],{'IntervalId':_0x18ba45[_0x67f4('0x6')]}),_0x67f4('0x28')):[];if(_0x18ba45['hasOwnProperty']('tag')){if(_0x18ba45[_0x67f4('0x2b')]&&_0x18ba45[_0x67f4('0x2b')]!=='--'){_0x2f612c[_0x67f4('0xf')]({'type':_0x18ba45[_0x67f4('0x10')],'app':'Set','appdata':_0x67f4('0x2c')+_0x18ba45['tag'],'context':_0x18ba45[_0x67f4('0x15')],'exten':_0x18ba45[_0x67f4('0xe')],'priority':_0x1774a7[_0x67f4('0x2d')]+_0x2c5153[_0x67f4('0xa')]+_0x3a9d0e++,'VoiceExtensionId':_0x18ba45[_0x67f4('0x13')]});}}if(_0x18ba45[_0x67f4('0x10')]==='outbound'&&_0x18ba45[_0x67f4('0x1f')](_0x67f4('0x2e'))){if(_0x18ba45[_0x67f4('0x2e')]){_0x2f612c['push']({'type':_0x18ba45[_0x67f4('0x10')],'app':'ExecIf','appdata':_0x67f4('0x2f')+_0x18ba45[_0x67f4('0x2e')]+')','context':_0x18ba45[_0x67f4('0x15')],'exten':_0x18ba45['exten'],'priority':_0x1774a7[_0x67f4('0x2d')]+_0x2c5153[_0x67f4('0xa')]+_0x3a9d0e++,'VoiceExtensionId':_0x18ba45['VoiceExtensionId']});}else{_0x2f612c[_0x67f4('0xf')]({'type':_0x18ba45[_0x67f4('0x10')],'app':_0x67f4('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x18ba45[_0x67f4('0x15')],'exten':_0x18ba45[_0x67f4('0xe')],'priority':_0x1774a7[_0x67f4('0x2d')]+_0x2c5153[_0x67f4('0xa')]+_0x3a9d0e++,'VoiceExtensionId':_0x18ba45[_0x67f4('0x13')]});}}if(_0x18ba45[_0x67f4('0x1f')](_0x67f4('0x30'))){if(_0x449bde[_0x67f4('0x31')](_0x18ba45[_0x67f4('0x32')][_0x67f4('0x33')]())>=0x0&&_0x18ba45[_0x67f4('0x34')]!=='custom'){if(_0x18ba45[_0x67f4('0x30')]){_0x2f612c[_0x67f4('0xf')]({'type':_0x18ba45[_0x67f4('0x10')],'app':_0x67f4('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x18ba45[_0x67f4('0x15')],'exten':_0x18ba45[_0x67f4('0xe')],'priority':_0x1774a7[_0x67f4('0x2d')]+_0x2c5153[_0x67f4('0xa')]+_0x3a9d0e++,'VoiceExtensionId':_0x18ba45[_0x67f4('0x13')]});_0x2f612c[_0x67f4('0xf')]({'type':_0x18ba45['type'],'app':_0x67f4('0x14'),'appdata':_0x67f4('0x35'),'context':_0x18ba45['context'],'exten':_0x18ba45[_0x67f4('0xe')],'priority':_0x1774a7['length']+_0x2c5153[_0x67f4('0xa')]+_0x3a9d0e++,'VoiceExtensionId':_0x18ba45['VoiceExtensionId']});}else{_0x2f612c['push']({'type':_0x18ba45[_0x67f4('0x10')],'app':'ExecIf','appdata':_0x67f4('0x36'),'context':_0x18ba45[_0x67f4('0x15')],'exten':_0x18ba45[_0x67f4('0xe')],'priority':_0x1774a7['length']+_0x2c5153[_0x67f4('0xa')]+_0x3a9d0e++,'VoiceExtensionId':_0x18ba45[_0x67f4('0x13')]});_0x2f612c[_0x67f4('0xf')]({'type':_0x18ba45[_0x67f4('0x10')],'app':_0x67f4('0x14'),'appdata':_0x67f4('0x37'),'context':_0x18ba45['context'],'exten':_0x18ba45[_0x67f4('0xe')],'priority':_0x1774a7[_0x67f4('0x2d')]+_0x2c5153['priority']+_0x3a9d0e++,'VoiceExtensionId':_0x18ba45['VoiceExtensionId']});}}}for(var _0x32dc54=0x0;_0x32dc54<_0x1774a7[_0x67f4('0x2d')];_0x32dc54+=0x1){var _0x21fa62=_0x2c5153[_0x67f4('0xa')]+_0x1774a7[_0x67f4('0x2d')];var _0xec61be=_0x32dc54===_0x1774a7[_0x67f4('0x2d')]-0x1?_0x2c5153[_0x67f4('0xa')]+_0x2f612c[_0x67f4('0x2d')]+_0x3c50a0[_0x67f4('0x2d')]+0x2:_0x2c5153['priority']+_0x32dc54+0x1;_0x2f612c[_0x67f4('0x38')](_0x32dc54,0x0,{'type':_0x18ba45[_0x67f4('0x10')],'app':_0x67f4('0x39'),'appdata':_0x1774a7[_0x32dc54]+'?'+_0x18ba45[_0x67f4('0x15')]+_0x67f4('0x3a')+_0x21fa62+':'+_0x18ba45[_0x67f4('0x15')]+_0x67f4('0x3a')+_0xec61be,'exten':_0x18ba45['exten'],'context':_0x18ba45[_0x67f4('0x15')],'priority':_0x2c5153[_0x67f4('0xa')]+_0x32dc54,'VoiceExtensionId':_0x190faf[_0x2c817a][0x0]['VoiceExtensionId']});}_0x18ba45[_0x67f4('0xa')]=_0x2f612c[_0x67f4('0x2d')]?_[_0x67f4('0x3b')](_0x2f612c)['priority']+0x1:_0x2c5153['priority'];_0x2c5153[_0x67f4('0xa')]=(_0x3c50a0['length']?_[_0x67f4('0x3b')](_0x3c50a0)[_0x67f4('0xa')]:_0x18ba45[_0x67f4('0xa')])+0x1;_0x2c5153[_0x67f4('0xb')]=_[_0x67f4('0x3c')](_0x2c5153[_0x67f4('0xb')],_0x2f612c,[_0x18ba45],_0x3c50a0);}_0x2c5153[_0x67f4('0xb')][_0x67f4('0xf')]({'type':_0x190faf[_0x2c817a][0x0][_0x67f4('0x10')],'app':_0x67f4('0x3d'),'exten':_0x190faf[_0x2c817a][0x0]['exten'],'context':_0x190faf[_0x2c817a][0x0][_0x67f4('0x15')],'priority':_0x2c5153[_0x67f4('0xa')],'VoiceExtensionId':_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]});_0x191b2a[_0x67f4('0xf')](_0x190faf[_0x2c817a][0x0][_0x67f4('0x13')]);_0x4cf3af=_[_0x67f4('0x3c')](_0x4cf3af,_0x2c5153[_0x67f4('0xb')]);}}return _0x2874fc[_0x67f4('0x3e')](function(_0x4ee349){return _0x2874fc[_0x67f4('0x1')][_0x67f4('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x191b2a}},'transaction':_0x4ee349})['then'](function(_0x2c64fa){return _0x2874fc['models'][_0x67f4('0x5')][_0x67f4('0x3f')](_[_0x67f4('0x40')](_0x4cf3af,_0x67f4('0xa')),{'transaction':_0x4ee349});});});})[_0x67f4('0x41')](function(_0x3da5b3){console['error'](_0x3da5b3);});}exports[_0x67f4('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d39da42..ac8dafd 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 _0x7497=['get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','catch','query','BlackLists','all','Campaign','CampaignId','onlyIfOpen','finally','emit','resume','resolve','contact:csv_','unlinkSync','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','length','map','message','join','data','firstName','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','duplicate','CmContact','create','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','insert','id\x20IN\x20?','calleridnum','cm_hopper_final','cm_hopper','str','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x7497,0x14f));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x7749('0x0'));var _=require(_0x7749('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7749('0x2'));var Redis=require(_0x7749('0x3'));var db=require(_0x7749('0x4'))['db'];var config=require(_0x7749('0x5'));var logger=require(_0x7749('0x6'))('api');config[_0x7749('0x7')]=_['defaults'](config[_0x7749('0x7')],{'host':_0x7749('0x8'),'port':0x18eb});var socket=require(_0x7749('0x9'))(new Redis(config[_0x7749('0x7')]));require(_0x7749('0xa'))['register'](socket);try{if(!process[_0x7749('0xb')][0x2]||process[_0x7749('0xb')][0x2]===_0x7749('0xc')||process[_0x7749('0xb')][0x2]===_0x7749('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x7749('0xb')][0x3]||process[_0x7749('0xb')][0x3]==='undefined'||process[_0x7749('0xb')][0x3]==='null'||!process[_0x7749('0xb')][0x4]||process[_0x7749('0xb')][0x4]===_0x7749('0xc')||process[_0x7749('0xb')][0x4]===_0x7749('0xd')){throw new Error(_0x7749('0xe'));}var FIELDS=_['zipObject'](process[_0x7749('0xb')][0x3][_0x7749('0xf')](','),process[_0x7749('0xb')][0x4][_0x7749('0xf')](','));if(!process[_0x7749('0xb')][0x5]||process[_0x7749('0xb')][0x5]==='undefined'||process['argv'][0x5]===_0x7749('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x7749('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x7749('0xb')][0x6]!==_0x7749('0xc')&&process['argv'][0x6]!==_0x7749('0xd')?process[_0x7749('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x7749('0xb')][0x7]!==_0x7749('0xd')?process['argv'][0x7]:null;if(!process[_0x7749('0xb')][0x8]||process[_0x7749('0xb')][0x8]===_0x7749('0xc')||process[_0x7749('0xb')][0x8]==='null'){throw new Error(_0x7749('0x10'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x186a8f){logger[_0x7749('0x11')](_0x186a8f);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(_0x7dbe7a,_0x560c0b,_0x41f54b,_0x2981d3){var _0x77c652={'message':_0x560c0b};_0x77c652[_0x7dbe7a]=!![];if(_0x41f54b){_0x77c652[_0x7749('0x12')]=_0x41f54b;}if(_0x2981d3){_0x77c652[_0x7749('0x13')]=_0x2981d3;}return _0x77c652;}function isEmail(_0x57253b){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))*$/[_0x7749('0x14')](_0x57253b);}function checkRow(_0x5e77d9,_0x805278,_0x46ad70){return new BPromise(function(_0x286634,_0x5549ce){if(_['isNil'](_0x5e77d9)){return _0x5549ce(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x46ad70));}if(_0x5e77d9['errors']&&_0x5e77d9[_0x7749('0x15')][_0x7749('0x16')]){var _0x540eae=_[_0x7749('0x17')](_0x5e77d9[_0x7749('0x15')],_0x7749('0x18'))[_0x7749('0x19')](';');return _0x5549ce(handleCheckRowError('error',_0x540eae,null,_0x46ad70));}var _0x5221ce={};for(var _0xf2bd57 in FIELDS){if(FIELDS['hasOwnProperty'](_0xf2bd57)&&FIELDS[_0xf2bd57]){_0x5221ce[_0xf2bd57]=_0x5e77d9['data'][0x0][FIELDS[_0xf2bd57]]||_0x5e77d9[_0x7749('0x1a')][0x0]['\ufeff'+FIELDS[_0xf2bd57]];}}if(!_0x5221ce[_0x7749('0x1b')]){return _0x5549ce(handleCheckRowError(_0x7749('0x11'),'firstName\x20not\x20specified!',null,_0x46ad70));}if(!_0x5221ce['phone']){return _0x5549ce(handleCheckRowError(_0x7749('0x11'),'phone\x20not\x20specified!',null,_0x46ad70));}if(_0x5221ce[_0x7749('0x1c')]){var _0x17c4c6=moment(_0x5221ce[_0x7749('0x1c')],_0x7749('0x1d'));if(!_0x17c4c6[_0x7749('0x1e')]()){return _0x5549ce(handleCheckRowError('error',_0x7749('0x1f'),null,_0x46ad70));}}if(_0x5221ce[_0x7749('0x20')]){if(!isEmail(_0x5221ce['email'])){return _0x5549ce(handleCheckRowError(_0x7749('0x11'),'email\x20format\x20is\x20not\x20valid!',null,_0x46ad70));}}_0x5221ce['ListId']=LISTID;_0x5221ce[_0x7749('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7749('0x16')]&&_0x805278){var _0x4c5468={};for(var _0x3108fe=0x0,_0x54b7d2=DUPLICATES[_0x7749('0x16')];_0x3108fe<_0x54b7d2;_0x3108fe+=0x1){_0x4c5468[DUPLICATES[_0x3108fe]]=_0x5221ce[DUPLICATES[_0x3108fe]];}var _0x47d1bf=_[_0x7749('0x22')](_0x805278,_0x4c5468);if(_0x47d1bf){return _0x5549ce(handleCheckRowError(_0x7749('0x23'),'Duplicate\x20Contact',_0x47d1bf,_0x46ad70));}}return db[_0x7749('0x24')][_0x7749('0x25')](_0x5221ce,{'raw':!![],'hooks':![],'fields':_[_0x7749('0x26')](_0x5221ce)})[_0x7749('0x27')](function(_0x4c5e00){if(DUPLICATES&&DUPLICATES[_0x7749('0x16')]&&_0x805278){_0x805278[_0x7749('0x28')](_['pick'](_0x5221ce,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4c5e00['id'];return _0x286634();})['catch'](function(_0x4a81f9){return _0x5549ce(handleCheckRowError('error',_0x7749('0x29')+(_0x4a81f9[_0x7749('0x18')]||JSON[_0x7749('0x2a')](_0x4a81f9)),null,_0x46ad70));});});}function checkHopper(){function _0x2f3e7d(){return function(_0x27f8d7){logger[_0x7749('0x11')]('cmContact',_0x7749('0x2b'),util[_0x7749('0x2c')](_0x27f8d7,{'showHidden':![],'depth':null}));};}var _0x4512f5=function(_0x4ee343,_0x41a8d8){var _0xd097d6=squel['insert']()[_0x7749('0x2d')]('cm_hopper')[_0x7749('0x2e')]([_0x7749('0x2f'),_0x7749('0x30'),_0x7749('0x31'),_0x7749('0x32'),_0x41a8d8,_0x7749('0x33'),_0x7749('0x34')],squel['select']()['field'](_0x7749('0x2f'),_0x7749('0x2f'))[_0x7749('0x35')](_0x7749('0x36'),_0x7749('0x30'))[_0x7749('0x35')]('id','ContactId')[_0x7749('0x35')](LISTID[_0x7749('0x37')](),_0x7749('0x32'))[_0x7749('0x35')](_0x4ee343['id'][_0x7749('0x37')](),_0x41a8d8)['field'](_0x7749('0x36'),_0x7749('0x33'))[_0x7749('0x35')](_0x7749('0x36'),_0x7749('0x34'))[_0x7749('0x38')](_0x7749('0x39'))[_0x7749('0x3a')](_0x7749('0x3b'))[_0x7749('0x3a')](_0x7749('0x3c'),LISTID[_0x7749('0x37')]())[_0x7749('0x3a')](_0x7749('0x3d'))['where'](_0x7749('0x3e'),squel[_0x7749('0x3f')]()['field'](_0x7749('0x2f'))[_0x7749('0x38')]('cm_hopper')[_0x7749('0x3a')](_0x41a8d8+_0x7749('0x40'),_0x4ee343['id'][_0x7749('0x37')]())))[_0x7749('0x37')]();return _0xd097d6;};var _0x535337=function(_0x199ec8,_0x56cfc4){var _0x5539a1=squel[_0x7749('0x41')]()[_0x7749('0x2d')]('cm_hopper')[_0x7749('0x2e')]([_0x7749('0x2f'),'scheduledAt',_0x7749('0x31'),_0x7749('0x32'),_0x56cfc4,_0x7749('0x33'),_0x7749('0x34')],squel[_0x7749('0x3f')]()[_0x7749('0x35')](_0x7749('0x2f'),_0x7749('0x2f'))['field'](_0x7749('0x36'),_0x7749('0x30'))[_0x7749('0x35')]('id',_0x7749('0x31'))[_0x7749('0x35')](LISTID[_0x7749('0x37')](),_0x7749('0x32'))[_0x7749('0x35')](_0x199ec8['id'][_0x7749('0x37')](),_0x56cfc4)[_0x7749('0x35')]('NOW()',_0x7749('0x33'))[_0x7749('0x35')](_0x7749('0x36'),_0x7749('0x34'))[_0x7749('0x38')](_0x7749('0x39'))[_0x7749('0x3a')](_0x7749('0x3b'))[_0x7749('0x3a')](_0x7749('0x3c'),LISTID[_0x7749('0x37')]())[_0x7749('0x3a')](_0x7749('0x42'),squel['str'](hopperContacts))[_0x7749('0x3a')](_0x7749('0x3d'))[_0x7749('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7749('0x3f')]()[_0x7749('0x35')](_0x7749('0x43'))[_0x7749('0x38')](_0x7749('0x44'))[_0x7749('0x3a')](_0x56cfc4+_0x7749('0x40'),_0x199ec8['id'][_0x7749('0x37')]()))[_0x7749('0x3a')](_0x7749('0x3e'),squel[_0x7749('0x3f')]()[_0x7749('0x35')](_0x7749('0x2f'))[_0x7749('0x38')](_0x7749('0x45'))[_0x7749('0x3a')](_0x56cfc4+_0x7749('0x40'),_0x199ec8['id'][_0x7749('0x37')]())))[_0x7749('0x37')]();return _0x5539a1;};function _0x2fee1f(_0x5ac2f4,_0x44ebea){var _0x4b44c1=squel['insert']()[_0x7749('0x2d')](_0x7749('0x45'))[_0x7749('0x2e')]([_0x7749('0x2f'),_0x7749('0x30'),'ContactId',_0x7749('0x32'),_0x44ebea,_0x7749('0x33'),_0x7749('0x34')],squel['select']()[_0x7749('0x35')]('phone','phone')[_0x7749('0x35')](_0x7749('0x36'),_0x7749('0x30'))[_0x7749('0x35')]('id','ContactId')[_0x7749('0x35')](LISTID[_0x7749('0x37')](),_0x7749('0x32'))[_0x7749('0x35')](_0x5ac2f4['id'][_0x7749('0x37')](),_0x44ebea)['field'](_0x7749('0x36'),_0x7749('0x33'))['field'](_0x7749('0x36'),_0x7749('0x34'))['from'](_0x7749('0x39'))[_0x7749('0x3a')](_0x7749('0x3b'))[_0x7749('0x3a')](_0x7749('0x3c'),LISTID[_0x7749('0x37')]())['where']('id\x20IN\x20?',squel[_0x7749('0x46')](hopperContacts))[_0x7749('0x3a')](_0x7749('0x3d')))[_0x7749('0x37')]();return _0x4b44c1;}function _0x1ed09e(_0x5dcf1f,_0x5bc600){var _0x2f765a=squel[_0x7749('0x41')]()[_0x7749('0x2d')](_0x7749('0x47'))[_0x7749('0x2e')]([_0x7749('0x2f'),_0x7749('0x31'),_0x7749('0x32'),_0x5bc600,_0x7749('0x33'),_0x7749('0x34')],squel[_0x7749('0x3f')]()[_0x7749('0x35')](_0x7749('0x2f'),_0x7749('0x2f'))[_0x7749('0x35')]('id','ContactId')[_0x7749('0x35')](LISTID[_0x7749('0x37')](),_0x7749('0x32'))[_0x7749('0x35')](_0x5dcf1f['id'][_0x7749('0x37')](),_0x5bc600)[_0x7749('0x35')](_0x7749('0x36'),'createdAt')[_0x7749('0x35')]('NOW()',_0x7749('0x34'))[_0x7749('0x38')](_0x7749('0x39'))[_0x7749('0x3a')](_0x7749('0x3b'))[_0x7749('0x3a')]('ListId\x20=\x20?',LISTID['toString']())[_0x7749('0x3a')](_0x7749('0x42'),squel[_0x7749('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x7749('0x37')]();return _0x2f765a;}return db[_0x7749('0x48')][_0x7749('0x49')]({'where':{'type':_0x7749('0x4a')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7749('0x4b')],'as':_0x7749('0x4c'),'where':{'id':LISTID}}]})[_0x7749('0x27')](function(_0x1ec67b){var _0x508674=[];if(_0x1ec67b){var _0x239254;for(var _0x284415=0x0,_0x22e49f;_0x284415<_0x1ec67b[_0x7749('0x16')];_0x284415+=0x1){_0x22e49f=_0x1ec67b[_0x284415][_0x7749('0x4d')]({'plain':!![]});switch(_0x22e49f[_0x7749('0x4e')]){case _0x7749('0x4f'):_0x508674['push'](db[_0x7749('0x50')]['query'](_0x535337(_0x22e49f,_0x7749('0x51')))[_0x7749('0x27')](function(){})[_0x7749('0x52')](_0x2f3e7d()));break;case'onlyIfOpen':_0x508674['push'](db[_0x7749('0x50')][_0x7749('0x53')](_0x4512f5(_0x22e49f,_0x7749('0x51')))[_0x7749('0x27')](function(){})[_0x7749('0x52')](_0x2f3e7d()));break;default:_0x508674[_0x7749('0x28')](db['sequelize'][_0x7749('0x53')](_0x2fee1f(_0x22e49f,'VoiceQueueId'))['then'](function(){})[_0x7749('0x52')](_0x2f3e7d()));}}}return _0x508674;})['all']()[_0x7749('0x27')](function(){return db[_0x7749('0x48')][_0x7749('0x49')]({'where':{'type':_0x7749('0x4a')},'attributes':['id'],'include':[{'model':db[_0x7749('0x4b')],'as':_0x7749('0x54'),'where':{'id':LISTID}}]})[_0x7749('0x27')](function(_0x1a7097){var _0x389fb0=[];if(_0x1a7097){var _0x3711a7;for(var _0x15e2a6=0x0,_0x453cff;_0x15e2a6<_0x1a7097[_0x7749('0x16')];_0x15e2a6+=0x1){_0x453cff=_0x1a7097[_0x15e2a6][_0x7749('0x4d')]({'plain':!![]});_0x389fb0[_0x7749('0x28')](db[_0x7749('0x50')][_0x7749('0x53')](_0x1ed09e(_0x453cff,_0x7749('0x51')))[_0x7749('0x27')](function(){})['catch'](_0x2f3e7d()));}}return _0x389fb0;})[_0x7749('0x55')]();})['then'](function(){return db[_0x7749('0x56')][_0x7749('0x49')]({'attributes':['id',_0x7749('0x4e')],'include':[{'model':db['CmList'],'as':_0x7749('0x4c'),'where':{'id':LISTID}}]})[_0x7749('0x27')](function(_0x5da858){var _0x5168b0=[];if(_0x5da858){for(var _0x11932e=0x0,_0x51d660;_0x11932e<_0x5da858[_0x7749('0x16')];_0x11932e+=0x1){_0x51d660=_0x5da858[_0x11932e][_0x7749('0x4d')]({'plain':!![]});switch(_0x51d660[_0x7749('0x4e')]){case'always':_0x5168b0[_0x7749('0x28')](db[_0x7749('0x50')]['query'](_0x535337(_0x51d660,_0x7749('0x57')))[_0x7749('0x27')](function(){})[_0x7749('0x52')](_0x2f3e7d()));break;case _0x7749('0x58'):_0x5168b0[_0x7749('0x28')](db[_0x7749('0x50')][_0x7749('0x53')](_0x4512f5(_0x51d660,'CampaignId'))[_0x7749('0x27')](function(){})['catch'](_0x2f3e7d()));break;default:_0x5168b0[_0x7749('0x28')](db['sequelize'][_0x7749('0x53')](_0x2fee1f(_0x51d660,'CampaignId'))[_0x7749('0x27')](function(){})[_0x7749('0x52')](_0x2f3e7d()));}}}return _0x5168b0;})['all']();})[_0x7749('0x27')](function(){return db[_0x7749('0x56')][_0x7749('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7749('0x54'),'where':{'id':LISTID}}]})[_0x7749('0x27')](function(_0x2858eb){var _0x10fab9=[];if(_0x2858eb){for(var _0x4bb9df=0x0,_0x45b394;_0x4bb9df<_0x2858eb[_0x7749('0x16')];_0x4bb9df+=0x1){_0x45b394=_0x2858eb[_0x4bb9df][_0x7749('0x4d')]({'plain':!![]});_0x10fab9[_0x7749('0x28')](db[_0x7749('0x50')]['query'](_0x1ed09e(_0x45b394,_0x7749('0x57')))['then'](function(){})[_0x7749('0x52')](_0x2f3e7d()));}}return _0x10fab9;})[_0x7749('0x55')]();})['catch'](function(_0x16b595){logger[_0x7749('0x11')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x16b595[_0x7749('0x18')]);});}var processPromises=function(_0x3e77a1){return BPromise['all'](promises)[_0x7749('0x27')](function(_0x35cd87){})['catch'](function(_0x59b197){logger[_0x7749('0x11')]('Error\x20processing\x20rows\x20block:',JSON[_0x7749('0x2a')](_0x59b197));})[_0x7749('0x59')](function(){socket[_0x7749('0x5a')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e77a1){return _0x3e77a1[_0x7749('0x5b')]();}});};var endCsv=function(){return BPromise[_0x7749('0x5c')]()[_0x7749('0x27')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x7749('0x5a')](_0x7749('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7749('0x5e')](FILEPATH);}catch(_0x21a601){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x7749('0x2a')](_0x21a601));}finally{process['exit'](0x0);}});};process['on'](_0x7749('0x5f'),function(){logger[_0x7749('0x60')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7749('0x5c')]()[_0x7749('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x7749('0x24')][_0x7749('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7749('0x27')](function(_0x482314){var _0x5d6986=fs[_0x7749('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7749('0x62')](_0x5d6986,{'header':!![],'skipEmptyLines':!![],'step':function(_0x37f8bc,_0x402b18){total+=0x1;var _0x18cbef=total;promises[_0x7749('0x28')](checkRow(_0x37f8bc,_0x482314,_0x18cbef)[_0x7749('0x27')](function(){success+=0x1;})['catch'](function(_0x40fc7a){if(_0x40fc7a[_0x7749('0x11')]){errors+=0x1;delete _0x40fc7a[_0x7749('0x11')];}else if(_0x40fc7a[_0x7749('0x23')]){duplicates+=0x1;delete _0x40fc7a[_0x7749('0x23')];}rows[_0x7749('0x28')](_0x40fc7a);}));if(total%0xc8===0x0){_0x402b18[_0x7749('0x63')]();return processPromises(_0x402b18);}},'complete':function(){return processPromises()[_0x7749('0x27')](function(){logger[_0x7749('0x60')](_0x7749('0x64'));endCsv();});},'error':function(_0x5862c2,_0x231fe3){logger[_0x7749('0x60')](_0x7749('0x65'),JSON['stringify'](_0x5862c2));endCsv();}});})[_0x7749('0x52')](function(_0x3b464f){logger[_0x7749('0x11')](_0x7749('0x66'),JSON[_0x7749('0x2a')](_0x3b464f));});}main(); \ No newline at end of file +var _0x3ed1=['CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','resume','resolve','emit','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','then','push','pick','catch','stringify','cmContact','checkHopper','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','insert','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','VoiceQueue','findAll','BlackLists','Campaign'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x3ed1,0x1c6));var _0x13ed=function(_0x4e938e,_0x37dba9){_0x4e938e=_0x4e938e-0x0;var _0x47aacf=_0x3ed1[_0x4e938e];return _0x47aacf;};'use strict';var BPromise=require(_0x13ed('0x0'));var util=require(_0x13ed('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x13ed('0x2'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x13ed('0x3'));var logger=require(_0x13ed('0x4'))(_0x13ed('0x5'));config['redis']=_['defaults'](config[_0x13ed('0x6')],{'host':_0x13ed('0x7'),'port':0x18eb});var socket=require(_0x13ed('0x8'))(new Redis(config['redis']));require(_0x13ed('0x9'))[_0x13ed('0xa')](socket);try{if(!process[_0x13ed('0xb')][0x2]||process[_0x13ed('0xb')][0x2]===_0x13ed('0xc')||process['argv'][0x2]===_0x13ed('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x13ed('0xb')][0x2];if(!process[_0x13ed('0xb')][0x3]||process[_0x13ed('0xb')][0x3]===_0x13ed('0xc')||process[_0x13ed('0xb')][0x3]===_0x13ed('0xd')||!process[_0x13ed('0xb')][0x4]||process[_0x13ed('0xb')][0x4]==='undefined'||process[_0x13ed('0xb')][0x4]===_0x13ed('0xd')){throw new Error(_0x13ed('0xe'));}var FIELDS=_[_0x13ed('0xf')](process[_0x13ed('0xb')][0x3][_0x13ed('0x10')](','),process['argv'][0x4][_0x13ed('0x10')](','));if(!process[_0x13ed('0xb')][0x5]||process[_0x13ed('0xb')][0x5]===_0x13ed('0xc')||process[_0x13ed('0xb')][0x5]===_0x13ed('0xd')){throw new Error(_0x13ed('0x11'));}var LISTID=process[_0x13ed('0xb')][0x5];var COMPANYID=process[_0x13ed('0xb')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!==_0x13ed('0xd')?process[_0x13ed('0xb')][0x6]:null;var DUPLICATES=process[_0x13ed('0xb')][0x7]&&process[_0x13ed('0xb')][0x7]!==_0x13ed('0xc')&&process[_0x13ed('0xb')][0x7]!==_0x13ed('0xd')?process[_0x13ed('0xb')][0x7]:null;if(!process[_0x13ed('0xb')][0x8]||process[_0x13ed('0xb')][0x8]==='undefined'||process['argv'][0x8]===_0x13ed('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x13ed('0xb')][0x8];}catch(_0x18d8fc){logger['error'](_0x18d8fc);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(_0x35fcab,_0x270073,_0x4d13e9,_0x53c1ea){var _0x3da692={'message':_0x270073};_0x3da692[_0x35fcab]=!![];if(_0x4d13e9){_0x3da692[_0x13ed('0x12')]=_0x4d13e9;}if(_0x53c1ea){_0x3da692[_0x13ed('0x13')]=_0x53c1ea;}return _0x3da692;}function isEmail(_0x24c8ca){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))*$/[_0x13ed('0x14')](_0x24c8ca);}function checkRow(_0x16e8ee,_0x2fa2d5,_0x58d28a){return new BPromise(function(_0x43614f,_0x4f6429){if(_[_0x13ed('0x15')](_0x16e8ee)){return _0x4f6429(handleCheckRowError(_0x13ed('0x16'),_0x13ed('0x17'),null,_0x58d28a));}if(_0x16e8ee[_0x13ed('0x18')]&&_0x16e8ee['errors'][_0x13ed('0x19')]){var _0x3dd79a=_[_0x13ed('0x1a')](_0x16e8ee[_0x13ed('0x18')],_0x13ed('0x1b'))['join'](';');return _0x4f6429(handleCheckRowError(_0x13ed('0x16'),_0x3dd79a,null,_0x58d28a));}var _0x335e71={};for(var _0x4a22ed in FIELDS){if(FIELDS[_0x13ed('0x1c')](_0x4a22ed)&&FIELDS[_0x4a22ed]){_0x335e71[_0x4a22ed]=_0x16e8ee[_0x13ed('0x1d')][0x0][FIELDS[_0x4a22ed]]||_0x16e8ee[_0x13ed('0x1d')][0x0]['\ufeff'+FIELDS[_0x4a22ed]];}}if(!_0x335e71[_0x13ed('0x1e')]){return _0x4f6429(handleCheckRowError(_0x13ed('0x16'),_0x13ed('0x1f'),null,_0x58d28a));}if(!_0x335e71[_0x13ed('0x20')]){return _0x4f6429(handleCheckRowError(_0x13ed('0x16'),_0x13ed('0x21'),null,_0x58d28a));}if(_0x335e71[_0x13ed('0x22')]){var _0x498785=moment(_0x335e71[_0x13ed('0x22')],_0x13ed('0x23'));if(!_0x498785[_0x13ed('0x24')]()){return _0x4f6429(handleCheckRowError(_0x13ed('0x16'),_0x13ed('0x25'),null,_0x58d28a));}}if(_0x335e71[_0x13ed('0x26')]){if(!isEmail(_0x335e71['email'])){return _0x4f6429(handleCheckRowError(_0x13ed('0x16'),_0x13ed('0x27'),null,_0x58d28a));}}_0x335e71[_0x13ed('0x28')]=LISTID;_0x335e71[_0x13ed('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x13ed('0x19')]&&_0x2fa2d5){var _0xda8e02={};for(var _0x14a674=0x0,_0x556073=DUPLICATES[_0x13ed('0x19')];_0x14a674<_0x556073;_0x14a674+=0x1){_0xda8e02[DUPLICATES[_0x14a674]]=_0x335e71[DUPLICATES[_0x14a674]];}var _0x135013=_['find'](_0x2fa2d5,_0xda8e02);if(_0x135013){return _0x4f6429(handleCheckRowError(_0x13ed('0x2a'),_0x13ed('0x2b'),_0x135013,_0x58d28a));}}return db[_0x13ed('0x2c')]['create'](_0x335e71,{'raw':!![],'hooks':![],'fields':_['keys'](_0x335e71)})[_0x13ed('0x2d')](function(_0xd9ea41){if(DUPLICATES&&DUPLICATES[_0x13ed('0x19')]&&_0x2fa2d5){_0x2fa2d5[_0x13ed('0x2e')](_[_0x13ed('0x2f')](_0x335e71,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xd9ea41['id'];return _0x43614f();})[_0x13ed('0x30')](function(_0x3f5d2a){return _0x4f6429(handleCheckRowError(_0x13ed('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3f5d2a[_0x13ed('0x1b')]||JSON[_0x13ed('0x31')](_0x3f5d2a)),null,_0x58d28a));});});}function checkHopper(){function _0x438996(){return function(_0x332540){logger[_0x13ed('0x16')](_0x13ed('0x32'),_0x13ed('0x33'),util['inspect'](_0x332540,{'showHidden':![],'depth':null}));};}var _0x41cdc7=function(_0x4cbd3d,_0x37be8e){var _0x2ceb22=squel['insert']()[_0x13ed('0x34')](_0x13ed('0x35'))[_0x13ed('0x36')]([_0x13ed('0x20'),_0x13ed('0x37'),_0x13ed('0x38'),_0x13ed('0x28'),_0x37be8e,_0x13ed('0x39'),_0x13ed('0x3a')],squel[_0x13ed('0x3b')]()[_0x13ed('0x3c')](_0x13ed('0x20'),'phone')[_0x13ed('0x3c')](_0x13ed('0x3d'),_0x13ed('0x37'))[_0x13ed('0x3c')]('id',_0x13ed('0x38'))[_0x13ed('0x3c')](LISTID[_0x13ed('0x3e')](),_0x13ed('0x28'))['field'](_0x4cbd3d['id']['toString'](),_0x37be8e)[_0x13ed('0x3c')]('NOW()',_0x13ed('0x39'))[_0x13ed('0x3c')](_0x13ed('0x3d'),_0x13ed('0x3a'))[_0x13ed('0x3f')](_0x13ed('0x40'))[_0x13ed('0x41')](_0x13ed('0x42'))[_0x13ed('0x41')]('ListId\x20=\x20?',LISTID[_0x13ed('0x3e')]())[_0x13ed('0x41')](_0x13ed('0x43'))[_0x13ed('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x13ed('0x3b')]()['field']('phone')['from'](_0x13ed('0x35'))[_0x13ed('0x41')](_0x37be8e+'\x20=\x20?',_0x4cbd3d['id'][_0x13ed('0x3e')]())))['toString']();return _0x2ceb22;};var _0x55d082=function(_0x291ac3,_0x51c513){var _0x3cc023=squel['insert']()['into']('cm_hopper')[_0x13ed('0x36')]([_0x13ed('0x20'),'scheduledAt','ContactId',_0x13ed('0x28'),_0x51c513,_0x13ed('0x39'),_0x13ed('0x3a')],squel[_0x13ed('0x3b')]()[_0x13ed('0x3c')](_0x13ed('0x20'),'phone')[_0x13ed('0x3c')]('NOW()',_0x13ed('0x37'))[_0x13ed('0x3c')]('id','ContactId')[_0x13ed('0x3c')](LISTID['toString'](),_0x13ed('0x28'))[_0x13ed('0x3c')](_0x291ac3['id'][_0x13ed('0x3e')](),_0x51c513)[_0x13ed('0x3c')](_0x13ed('0x3d'),_0x13ed('0x39'))[_0x13ed('0x3c')]('NOW()',_0x13ed('0x3a'))['from'](_0x13ed('0x40'))[_0x13ed('0x41')](_0x13ed('0x42'))[_0x13ed('0x41')](_0x13ed('0x44'),LISTID[_0x13ed('0x3e')]())[_0x13ed('0x41')](_0x13ed('0x45'),squel[_0x13ed('0x46')](hopperContacts))[_0x13ed('0x41')](_0x13ed('0x43'))[_0x13ed('0x41')](_0x13ed('0x47'),squel['select']()[_0x13ed('0x3c')](_0x13ed('0x48'))['from'](_0x13ed('0x49'))[_0x13ed('0x41')](_0x51c513+_0x13ed('0x4a'),_0x291ac3['id']['toString']()))[_0x13ed('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x13ed('0x3b')]()[_0x13ed('0x3c')](_0x13ed('0x20'))[_0x13ed('0x3f')](_0x13ed('0x35'))[_0x13ed('0x41')](_0x51c513+_0x13ed('0x4a'),_0x291ac3['id'][_0x13ed('0x3e')]())))['toString']();return _0x3cc023;};function _0x8cb052(_0x22422f,_0x4d0adf){var _0x120151=squel[_0x13ed('0x4b')]()[_0x13ed('0x34')](_0x13ed('0x35'))['fromQuery']([_0x13ed('0x20'),_0x13ed('0x37'),'ContactId',_0x13ed('0x28'),_0x4d0adf,'createdAt',_0x13ed('0x3a')],squel['select']()[_0x13ed('0x3c')]('phone',_0x13ed('0x20'))[_0x13ed('0x3c')]('NOW()',_0x13ed('0x37'))[_0x13ed('0x3c')]('id',_0x13ed('0x38'))['field'](LISTID[_0x13ed('0x3e')](),_0x13ed('0x28'))[_0x13ed('0x3c')](_0x22422f['id'][_0x13ed('0x3e')](),_0x4d0adf)[_0x13ed('0x3c')]('NOW()',_0x13ed('0x39'))[_0x13ed('0x3c')](_0x13ed('0x3d'),_0x13ed('0x3a'))[_0x13ed('0x3f')](_0x13ed('0x40'))['where'](_0x13ed('0x42'))[_0x13ed('0x41')](_0x13ed('0x44'),LISTID[_0x13ed('0x3e')]())[_0x13ed('0x41')](_0x13ed('0x45'),squel[_0x13ed('0x46')](hopperContacts))['where'](_0x13ed('0x43')))['toString']();return _0x120151;}function _0x171b74(_0x5eb500,_0x1ebee7){var _0x386312=squel['insert']()['into'](_0x13ed('0x4c'))['fromQuery']([_0x13ed('0x20'),_0x13ed('0x38'),_0x13ed('0x28'),_0x1ebee7,_0x13ed('0x39'),_0x13ed('0x3a')],squel[_0x13ed('0x3b')]()[_0x13ed('0x3c')](_0x13ed('0x20'),_0x13ed('0x20'))['field']('id',_0x13ed('0x38'))['field'](LISTID[_0x13ed('0x3e')](),_0x13ed('0x28'))[_0x13ed('0x3c')](_0x5eb500['id'][_0x13ed('0x3e')](),_0x1ebee7)[_0x13ed('0x3c')]('NOW()',_0x13ed('0x39'))[_0x13ed('0x3c')](_0x13ed('0x3d'),'updatedAt')['from']('cm_contacts')['where'](_0x13ed('0x42'))['where'](_0x13ed('0x44'),LISTID['toString']())[_0x13ed('0x41')](_0x13ed('0x45'),squel[_0x13ed('0x46')](hopperContacts))[_0x13ed('0x41')](_0x13ed('0x43')))[_0x13ed('0x3e')]();return _0x386312;}return db['VoiceQueue']['findAll']({'where':{'type':_0x13ed('0x4d')},'attributes':['id',_0x13ed('0x4e')],'include':[{'model':db[_0x13ed('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0x13ed('0x2d')](function(_0x452c3b){var _0x5a2bac=[];if(_0x452c3b){var _0x32d5e6;for(var _0x3e3e7a=0x0,_0x3994a2;_0x3e3e7a<_0x452c3b[_0x13ed('0x19')];_0x3e3e7a+=0x1){_0x3994a2=_0x452c3b[_0x3e3e7a][_0x13ed('0x50')]({'plain':!![]});switch(_0x3994a2[_0x13ed('0x4e')]){case _0x13ed('0x51'):_0x5a2bac[_0x13ed('0x2e')](db[_0x13ed('0x52')][_0x13ed('0x53')](_0x55d082(_0x3994a2,_0x13ed('0x54')))[_0x13ed('0x2d')](function(){})[_0x13ed('0x30')](_0x438996()));break;case _0x13ed('0x55'):_0x5a2bac[_0x13ed('0x2e')](db[_0x13ed('0x52')]['query'](_0x41cdc7(_0x3994a2,'VoiceQueueId'))[_0x13ed('0x2d')](function(){})[_0x13ed('0x30')](_0x438996()));break;default:_0x5a2bac[_0x13ed('0x2e')](db['sequelize'][_0x13ed('0x53')](_0x8cb052(_0x3994a2,_0x13ed('0x54')))['then'](function(){})['catch'](_0x438996()));}}}return _0x5a2bac;})[_0x13ed('0x56')]()['then'](function(){return db[_0x13ed('0x57')][_0x13ed('0x58')]({'where':{'type':_0x13ed('0x4d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x13ed('0x59'),'where':{'id':LISTID}}]})[_0x13ed('0x2d')](function(_0x210a1c){var _0x2f08e4=[];if(_0x210a1c){var _0x3ca155;for(var _0x6d0fef=0x0,_0x4ea441;_0x6d0fef<_0x210a1c[_0x13ed('0x19')];_0x6d0fef+=0x1){_0x4ea441=_0x210a1c[_0x6d0fef][_0x13ed('0x50')]({'plain':!![]});_0x2f08e4[_0x13ed('0x2e')](db[_0x13ed('0x52')][_0x13ed('0x53')](_0x171b74(_0x4ea441,_0x13ed('0x54')))[_0x13ed('0x2d')](function(){})['catch'](_0x438996()));}}return _0x2f08e4;})['all']();})['then'](function(){return db[_0x13ed('0x5a')]['findAll']({'attributes':['id',_0x13ed('0x4e')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x13ed('0x2d')](function(_0x2c9a1e){var _0x3c6166=[];if(_0x2c9a1e){for(var _0x3f11e0=0x0,_0x49359b;_0x3f11e0<_0x2c9a1e[_0x13ed('0x19')];_0x3f11e0+=0x1){_0x49359b=_0x2c9a1e[_0x3f11e0][_0x13ed('0x50')]({'plain':!![]});switch(_0x49359b[_0x13ed('0x4e')]){case _0x13ed('0x51'):_0x3c6166['push'](db[_0x13ed('0x52')][_0x13ed('0x53')](_0x55d082(_0x49359b,_0x13ed('0x5b')))[_0x13ed('0x2d')](function(){})['catch'](_0x438996()));break;case _0x13ed('0x55'):_0x3c6166[_0x13ed('0x2e')](db[_0x13ed('0x52')]['query'](_0x41cdc7(_0x49359b,'CampaignId'))[_0x13ed('0x2d')](function(){})[_0x13ed('0x30')](_0x438996()));break;default:_0x3c6166[_0x13ed('0x2e')](db[_0x13ed('0x52')][_0x13ed('0x53')](_0x8cb052(_0x49359b,_0x13ed('0x5b')))['then'](function(){})[_0x13ed('0x30')](_0x438996()));}}}return _0x3c6166;})[_0x13ed('0x56')]();})[_0x13ed('0x2d')](function(){return db[_0x13ed('0x5a')][_0x13ed('0x58')]({'attributes':['id'],'include':[{'model':db[_0x13ed('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x13ed('0x2d')](function(_0x453d81){var _0x52a4ff=[];if(_0x453d81){for(var _0x2e721e=0x0,_0xdc959f;_0x2e721e<_0x453d81['length'];_0x2e721e+=0x1){_0xdc959f=_0x453d81[_0x2e721e]['get']({'plain':!![]});_0x52a4ff[_0x13ed('0x2e')](db[_0x13ed('0x52')][_0x13ed('0x53')](_0x171b74(_0xdc959f,'CampaignId'))[_0x13ed('0x2d')](function(){})[_0x13ed('0x30')](_0x438996()));}}return _0x52a4ff;})['all']();})[_0x13ed('0x30')](function(_0x354a1e){logger[_0x13ed('0x16')](_0x13ed('0x5c'),_0x13ed('0x5d'),_0x354a1e[_0x13ed('0x1b')]);});}var processPromises=function(_0x3a9518){return BPromise['all'](promises)[_0x13ed('0x2d')](function(_0x2dc2df){})[_0x13ed('0x30')](function(_0x1e9f6f){logger[_0x13ed('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x13ed('0x31')](_0x1e9f6f));})[_0x13ed('0x5e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3a9518){return _0x3a9518[_0x13ed('0x5f')]();}});};var endCsv=function(){return BPromise[_0x13ed('0x60')]()[_0x13ed('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x13ed('0x2d')](function(){socket[_0x13ed('0x61')](_0x13ed('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x4ca1d4){logger[_0x13ed('0x16')](_0x13ed('0x63'),JSON['stringify'](_0x4ca1d4));}finally{process[_0x13ed('0x64')](0x0);}});};process['on'](_0x13ed('0x65'),function(){logger[_0x13ed('0x66')](_0x13ed('0x67'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x13ed('0x10')](',');return db[_0x13ed('0x2c')][_0x13ed('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x13ed('0x2d')](function(_0x5ad85d){var _0x5b612b=fs[_0x13ed('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x13ed('0x69')](_0x5b612b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x499b2b,_0x55ab03){total+=0x1;var _0x72d411=total;promises['push'](checkRow(_0x499b2b,_0x5ad85d,_0x72d411)[_0x13ed('0x2d')](function(){success+=0x1;})['catch'](function(_0x20c362){if(_0x20c362[_0x13ed('0x16')]){errors+=0x1;delete _0x20c362['error'];}else if(_0x20c362[_0x13ed('0x2a')]){duplicates+=0x1;delete _0x20c362[_0x13ed('0x2a')];}rows[_0x13ed('0x2e')](_0x20c362);}));if(total%0xc8===0x0){_0x55ab03[_0x13ed('0x6a')]();return processPromises(_0x55ab03);}},'complete':function(){return processPromises()[_0x13ed('0x2d')](function(){logger[_0x13ed('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3a55f3,_0x5e4964){logger[_0x13ed('0x66')](_0x13ed('0x6b'),JSON[_0x13ed('0x31')](_0x3a55f3));endCsv();}});})[_0x13ed('0x30')](function(_0x37df18){logger[_0x13ed('0x16')](_0x13ed('0x6c'),JSON['stringify'](_0x37df18));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index be58738..5e51ec1 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 _0x4b6e=['set','main','stringify','send','start','binding','clone','socket_timestamp','root','.csv','ContactItemType','name','_description','header','writeFileSync','parse','data','rows','find','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','YYYY-MM-DD','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','push','all','AdditionalPhones','split','length','isNil','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','updatedAt','cm_contacts','select','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','sequelize','query','spread','catch','error','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset'];(function(_0x40cf73,_0x19d475){var _0x239598=function(_0x4efb5e){while(--_0x4efb5e){_0x40cf73['push'](_0x40cf73['shift']());}};_0x239598(++_0x19d475);}(_0x4b6e,0x1be));var _0xe4b6=function(_0x4ab4a8,_0x360357){_0x4ab4a8=_0x4ab4a8-0x0;var _0x586b5d=_0x4b6e[_0x4ab4a8];return _0x586b5d;};'use strict';var fs=require('fs');var path=require(_0xe4b6('0x0'));var _=require(_0xe4b6('0x1'));var Papa=require(_0xe4b6('0x2'));var util=require(_0xe4b6('0x3'));var BPromise=require(_0xe4b6('0x4'));var moment=require(_0xe4b6('0x5'));var squel=require(_0xe4b6('0x6'));var Redis=require(_0xe4b6('0x7'));var db=require(_0xe4b6('0x8'))['db'];var config=require(_0xe4b6('0x9'));var shared=require(_0xe4b6('0xa'));var logger=require(_0xe4b6('0xb'))(_0xe4b6('0xc'));config[_0xe4b6('0xd')]=_['defaults'](config[_0xe4b6('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4b6('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xe4b6('0xe')](_0xe4b6('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xe4b6('0xe')](_0xe4b6('0xf'));function isEmail(_0x2c011a){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))*$/[_0xe4b6('0x10')](_0x2c011a);}function selectNotIn(_0xe69f8d,_0x27284c,_0x2cdb28,_0x5e1cf0,_0x7f384d){return squel['select']()[_0xe4b6('0x11')](_0xe4b6('0x12'))[_0xe4b6('0x13')](_0x5e1cf0)[_0xe4b6('0x14')](_0x27284c,null,_0x27284c+_0xe4b6('0x15')+_0x5e1cf0+'.'+_0x2cdb28)[_0xe4b6('0x16')](_0x5e1cf0+'.'+_0x2cdb28+_0xe4b6('0x17')+_0xe69f8d+'.'+_0x2cdb28)[_0xe4b6('0x16')](_0x27284c+_0xe4b6('0x18')+_0x7f384d[_0xe4b6('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5d69b6,_0x41b81f){promisesAdditionalPhones=[];return db[_0xe4b6('0x19')][_0xe4b6('0x1a')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xe4b6('0x1b')](function(_0x57cf6a){if(_0x57cf6a!==null){var _0x5ca1f0=[];for(var _0xfd248f=0x0;_0xfd248f<_0x57cf6a['length'];_0xfd248f++){var _0x60399=_0x57cf6a[_0xfd248f];_0x5ca1f0[_0xe4b6('0x1c')](insertAdditionalPhones(_0x60399));}}Promise[_0xe4b6('0x1d')](_0x5ca1f0)[_0xe4b6('0x1b')](function(){_0x5d69b6({'val':0x1});});});});}function insertAdditionalPhones(_0x13e3a6){return new Promise(function(_0x22710f,_0x170a99){var _0x5c47ca=_0x13e3a6[_0xe4b6('0x1e')];var _0x1e7fdd=_0x5c47ca[_0xe4b6('0x1f')](';');var _0x23898b=[];orderBy=0x0;for(var _0x44b92c=0x0;_0x44b92c<_0x1e7fdd[_0xe4b6('0x20')];_0x44b92c++){_0x23898b[_0xe4b6('0x1c')](splitAdditionalPhone(_0x13e3a6['id'],_0x1e7fdd[_0x44b92c]));}Promise['all'](_0x23898b)[_0xe4b6('0x1b')](function(){_0x22710f({'val':_0x1e7fdd[_0xe4b6('0x20')]});});});}function splitAdditionalPhone(_0x962c7e,_0x14ea62){return new Promise(function(_0x3a3572,_0x3067ce){var _0x52ed25=_0x14ea62['split'](':');var _0x4fb0d6=_0x52ed25[0x0];var _0x3d14df=_0x52ed25[0x1];if(!_[_0xe4b6('0x21')](_0x3d14df)){var _0x45329d=_0x3d14df[_0xe4b6('0x1f')]('|');var _0x39eb76=[];for(var _0x53a3ab=0x0;_0x53a3ab<_0x45329d['length'];_0x53a3ab++){if(_0x45329d[_0x53a3ab]!==''){var _0x2f49cd=_[_0xe4b6('0x22')](promisesAdditionalPhones,{'contactId':_0x962c7e,'phone':_0x45329d[_0x53a3ab]});if(_0x2f49cd['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x962c7e,'contactTypeId':_0x4fb0d6,'phone':_0x45329d[_0x53a3ab],'orderBy':orderBy});}}}_0x3a3572({'ok':0x1});}else _0x3a3572({'res':0x0});});}function createAdditionalPhone(_0x4d76a4,_0x3c9e8f,_0x28c42c,_0x39cf74){var _0x2dfc6b='';var _0x4b5abf='';var _0x40cb09=_0x28c42c[_0xe4b6('0x1f')]('§');_0x2dfc6b=_0x40cb09[0x0];if(_0x40cb09['length']==0x2)_0x4b5abf=_0x40cb09[0x1];return new Promise(function(_0x48b642,_0x12e691){return db['CmContactHasItem'][_0xe4b6('0x23')]({'where':{'CmContactId':_0x4d76a4,'item':_0x2dfc6b}})['then'](function(_0x3a7245){if(_0x3a7245){return db[_0xe4b6('0x24')][_0xe4b6('0x25')]({'ItemTypeId':_0x3c9e8f,'description':_0x4b5abf,'OrderBy':_0x39cf74},{'where':{'CmContactId':_0x4d76a4,'item':_0x2dfc6b}})[_0xe4b6('0x1b')](function(_0x138626){_0x48b642({'res':_0xe4b6('0x26')});});}else{return db[_0xe4b6('0x24')][_0xe4b6('0x27')]({'CmContactId':_0x4d76a4,'item':_0x2dfc6b,'description':_0x4b5abf,'ItemTypeId':_0x3c9e8f,'OrderBy':_0x39cf74,'ItemClass':_0xe4b6('0x28')})[_0xe4b6('0x1b')](function(_0x46f073){_0x48b642({'res':_0xe4b6('0x29')});});}});});}function insertCmHopper(_0x2d6a52,_0x5c7d54,_0x3c82e2,_0x319a32,_0x114809){var _0x1a7573=[_0xe4b6('0x2a'),_0xe4b6('0x2b'),_0xe4b6('0x2c'),_0xe4b6('0x2d'),_0x5c7d54+'.'+_0x319a32,_0xe4b6('0x2e'),_0xe4b6('0x2f'),_0xe4b6('0x30'),_0xe4b6('0x31'),'\x22'+_0x114809+'\x22'];return squel[_0xe4b6('0x32')]()[_0xe4b6('0x33')](_0xe4b6('0x34'))[_0xe4b6('0x35')]([_0xe4b6('0x12'),'scheduledat',_0xe4b6('0x36'),_0xe4b6('0x37'),_0x319a32,_0xe4b6('0x38'),'updatedAt',_0xe4b6('0x39'),_0xe4b6('0x3a'),'recallme'],squel['select']()[_0xe4b6('0x3b')](_0x1a7573)[_0xe4b6('0x13')](_0x5c7d54)[_0xe4b6('0x14')]('cm_contacts',null,_0xe4b6('0x3c')+_0x5c7d54+_0xe4b6('0x3d'))['join'](_0x3c82e2,null,_0x3c82e2+_0xe4b6('0x15')+_0x5c7d54+'.'+_0x319a32)[_0xe4b6('0x16')](_0x5c7d54+_0xe4b6('0x3e'),_0x2d6a52)[_0xe4b6('0x16')](_0xe4b6('0x3f'),NOW)[_0xe4b6('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5c7d54,_0x3c82e2,_0x319a32,'cm_hopper',[_0xe4b6('0x40'),_0xe4b6('0x41')]))[_0xe4b6('0x16')](_0xe4b6('0x42'),selectNotIn(_0x5c7d54,_0x3c82e2,_0x319a32,_0xe4b6('0x34'),[_0xe4b6('0x40')])))[_0xe4b6('0x43')]();}function insertCmHopperBlack(_0x29c8bc,_0x58311f,_0x4d6734,_0x220622){var _0x25cd1b=['cm_contacts.phone','cm_contacts.id',_0xe4b6('0x2d'),_0x58311f+'.'+_0x220622,'cm_contacts.createdAt',_0xe4b6('0x2f')];return squel[_0xe4b6('0x32')]()['into'](_0xe4b6('0x44'))[_0xe4b6('0x35')]([_0xe4b6('0x12'),_0xe4b6('0x36'),_0xe4b6('0x37'),_0x220622,_0xe4b6('0x38'),_0xe4b6('0x45')],squel['select']()[_0xe4b6('0x3b')](_0x25cd1b)['from'](_0x58311f)[_0xe4b6('0x14')](_0xe4b6('0x46'),null,_0xe4b6('0x3c')+_0x58311f+_0xe4b6('0x3d'))['join'](_0x4d6734,null,_0x4d6734+_0xe4b6('0x15')+_0x58311f+'.'+_0x220622)[_0xe4b6('0x16')](_0x58311f+'.CmListId\x20=\x20?',_0x29c8bc)[_0xe4b6('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe4b6('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xe4b6('0x47')]()[_0xe4b6('0x11')]('phone')[_0xe4b6('0x13')](_0xe4b6('0x44'))[_0xe4b6('0x16')](_0xe4b6('0x48'),_0x29c8bc)[_0xe4b6('0x16')](_0x220622+_0xe4b6('0x17')+_0x58311f+'.'+_0x220622)))[_0xe4b6('0x43')]();}function insertTzCmHopper(_0xe36ce8,_0x27dcdc,_0x14976c,_0x545909,_0x25c469,_0x2645f0){var _0x286c6e=[_0xe4b6('0x2a'),_0xe4b6('0x49')+_0x2645f0+_0xe4b6('0x4a'),_0xe4b6('0x2c'),'cm_contacts.ListId',_0x27dcdc+'.'+_0x545909,_0xe4b6('0x2e'),_0xe4b6('0x2f'),_0xe4b6('0x30'),'cm_contacts.UserId','\x22'+_0x25c469+'\x22'];var _0xb5700b=squel[_0xe4b6('0x32')]()[_0xe4b6('0x33')](_0xe4b6('0x34'))['fromQuery']([_0xe4b6('0x12'),'scheduledat',_0xe4b6('0x36'),'ListId',_0x545909,_0xe4b6('0x38'),_0xe4b6('0x45'),_0xe4b6('0x39'),'UserId',_0xe4b6('0x4b')],squel[_0xe4b6('0x47')]()['fields'](_0x286c6e)[_0xe4b6('0x13')](_0x27dcdc)['join'](_0xe4b6('0x46'),null,_0xe4b6('0x3c')+_0x27dcdc+_0xe4b6('0x3d'))[_0xe4b6('0x14')](_0x14976c,null,_0x14976c+'.id\x20=\x20'+_0x27dcdc+'.'+_0x545909)[_0xe4b6('0x14')](_0x2645f0,null,_0x2645f0+_0xe4b6('0x15')+_0x27dcdc+'.'+_0x545909)[_0xe4b6('0x16')](_0x27dcdc+_0xe4b6('0x3e'),_0xe36ce8)[_0xe4b6('0x16')](_0xe4b6('0x3f'),NOW)[_0xe4b6('0x16')](_0xe4b6('0x42'),selectNotIn(_0x27dcdc,_0x14976c,_0x545909,_0xe4b6('0x34'),[_0xe4b6('0x40'),_0xe4b6('0x41')]))[_0xe4b6('0x16')](_0xe4b6('0x42'),selectNotIn(_0x27dcdc,_0x14976c,_0x545909,'cm_hopper',['\x22always\x22'])))[_0xe4b6('0x43')]();return _0xb5700b;}function insertTzCmHopperBlack(_0x54f489,_0x281f25,_0xc121a6,_0x5bf8ef){var _0x70e4fd=['cm_contacts.phone',_0xe4b6('0x2c'),_0xe4b6('0x2d'),_0x281f25+'.'+_0x5bf8ef,_0xe4b6('0x2e'),_0xe4b6('0x2f')];return squel[_0xe4b6('0x32')]()[_0xe4b6('0x33')]('cm_hopper_black')[_0xe4b6('0x35')]([_0xe4b6('0x12'),'ContactId',_0xe4b6('0x37'),_0x5bf8ef,_0xe4b6('0x38'),_0xe4b6('0x45')],squel[_0xe4b6('0x47')]()[_0xe4b6('0x3b')](_0x70e4fd)[_0xe4b6('0x13')](_0x281f25)[_0xe4b6('0x14')](_0xe4b6('0x46'),null,_0xe4b6('0x3c')+_0x281f25+_0xe4b6('0x3d'))[_0xe4b6('0x14')](_0xc121a6,null,_0xc121a6+'.id\x20=\x20'+_0x281f25+'.'+_0x5bf8ef)[_0xe4b6('0x16')](_0x281f25+_0xe4b6('0x3e'),_0x54f489)[_0xe4b6('0x16')](_0xe4b6('0x3f'),NOW)[_0xe4b6('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xe4b6('0x47')]()[_0xe4b6('0x11')]('phone')[_0xe4b6('0x13')](_0xe4b6('0x44'))['where']('ListId\x20=\x20?',_0x54f489)[_0xe4b6('0x16')](_0x5bf8ef+_0xe4b6('0x17')+_0x281f25+'.'+_0x5bf8ef)))[_0xe4b6('0x43')]();}function insertCmHopperAdditionalPhones(_0xefc57c){var _0x50f454=[_0xe4b6('0x4c'),_0xe4b6('0x4d'),_0xe4b6('0x4e'),_0xe4b6('0x4f'),_0xe4b6('0x50')];return squel['insert']()[_0xe4b6('0x33')]('cm_hopper_additional_phones')[_0xe4b6('0x35')](['CmHopperId',_0xe4b6('0x12'),_0xe4b6('0x51'),_0xe4b6('0x38'),_0xe4b6('0x45')],squel[_0xe4b6('0x47')]()['fields'](_0x50f454)[_0xe4b6('0x13')](_0xe4b6('0x34'))['join'](_0xe4b6('0x46'),null,_0xe4b6('0x52'))[_0xe4b6('0x14')](_0xe4b6('0x53'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xe4b6('0x16')](_0xe4b6('0x54'),_0xefc57c)[_0xe4b6('0x16')](_0xe4b6('0x3f'),NOW))[_0xe4b6('0x43')]();}function insertCmContact(_0x4af457,_0x2d1784,_0x52fd68,_0x1d85a3){var _0x579472=_['concat'](_[_0xe4b6('0x55')](_0x1d85a3),[_0xe4b6('0x37'),_0xe4b6('0x56'),_0xe4b6('0x38'),_0xe4b6('0x45'),'scheduledAt']);return squel[_0xe4b6('0x32')]()['into'](_0xe4b6('0x46'))[_0xe4b6('0x35')](_0x579472,squel[_0xe4b6('0x47')]()['fields'](_0x579472)[_0xe4b6('0x13')](_0x2d1784)[_0xe4b6('0x16')]('('+_0x52fd68[_0xe4b6('0x14')](',')+_0xe4b6('0x57'),squel[_0xe4b6('0x47')]()['fields'](_0x52fd68)['from'](_0xe4b6('0x46'))['where']('ListId\x20=\x20?',_0x4af457)['where'](_0xe4b6('0x58')))['where']('id\x20IN\x20?',squel[_0xe4b6('0x47')]()[_0xe4b6('0x11')](_0xe4b6('0x59'),_0xe4b6('0x5a'))['from'](_0x2d1784)[_0xe4b6('0x5b')](_0x52fd68['join'](','))))[_0xe4b6('0x43')]();}function handleStop(){logger[_0xe4b6('0x5c')](_0xe4b6('0x5d'));stopped=!![];}function handleUncaughtException(_0x401d2d){logger['error'](_0x401d2d[_0xe4b6('0x5e')]);process[_0xe4b6('0x5f')](0x1);}function handleError(_0x163f1f,_0xa26229){stats[_0xe4b6('0x60')][_0xe4b6('0x1c')]({'name':_0xa26229['code'],'message':_0xa26229[_0xe4b6('0x5e')],'row':_0x163f1f});}function handleQuery(_0x1f6a64){logger[_0xe4b6('0x5c')](_0x1f6a64);return db[_0xe4b6('0x61')][_0xe4b6('0x62')](_0x1f6a64)[_0xe4b6('0x63')](function(_0x9fd9d4){results[_0xe4b6('0x1c')](_0x9fd9d4);})[_0xe4b6('0x64')](function(_0x59a948){logger[_0xe4b6('0x65')](_0x59a948['message']);});}function updateTzCampaigns(_0x35d4a9){return new Promise(function(_0x246aad,_0x3ec464){var _0x3ac9c1=squel['select']()[_0xe4b6('0x3b')]([_0xe4b6('0x66'),'campaigns.dialTimezone'])[_0xe4b6('0x13')](_0xe4b6('0x67'))[_0xe4b6('0x14')]('campaigns_has_cm_lists',null,_0xe4b6('0x68'))[_0xe4b6('0x16')](_0xe4b6('0x69')+_0x35d4a9);db[_0xe4b6('0x61')][_0xe4b6('0x62')](_0x3ac9c1[_0xe4b6('0x43')]())[_0xe4b6('0x63')](function(_0x28cdb6){var _0x763dc8=[];for(var _0x3257e5=0x0;_0x3257e5<_0x28cdb6[_0xe4b6('0x20')];_0x3257e5++){_0x763dc8['push'](getTimezoneData(_0x28cdb6[_0x3257e5],tmp_campaigns));}BPromise[_0xe4b6('0x1d')](_0x763dc8)[_0xe4b6('0x1b')](function(){_0x246aad({'val':0x1});});})[_0xe4b6('0x64')](function(_0x260b49){logger[_0xe4b6('0x65')](_0x260b49['message']);_0x246aad({'val':0x0});});});}function updateTzVoiceQueues(_0x44bfe2){return new Promise(function(_0x3fb4eb,_0x48a5f6){var _0x166745=squel[_0xe4b6('0x47')]()[_0xe4b6('0x3b')]([_0xe4b6('0x6a'),_0xe4b6('0x6b')])['from'](_0xe4b6('0x6c'))['join'](_0xe4b6('0x6d'),null,_0xe4b6('0x6e'))['where'](_0xe4b6('0x6f')+_0x44bfe2);db[_0xe4b6('0x61')][_0xe4b6('0x62')](_0x166745[_0xe4b6('0x43')]())[_0xe4b6('0x63')](function(_0xa8e443){var _0x50d9c3=[];for(var _0x9cfd16=0x0;_0x9cfd16<_0xa8e443[_0xe4b6('0x20')];_0x9cfd16++){_0x50d9c3['push'](getTimezoneData(_0xa8e443[_0x9cfd16],tmp_voice_queues));}BPromise[_0xe4b6('0x1d')](_0x50d9c3)[_0xe4b6('0x1b')](function(){_0x3fb4eb({'val':0x1});});})[_0xe4b6('0x64')](function(_0xf6f4e3){logger[_0xe4b6('0x65')](_0xf6f4e3['message']);_0x3fb4eb({'val':0x0});});});}function getTimezoneData(_0x35e6ad,_0x4910b5){return new Promise(function(_0x38fe3a,_0x4a6ceb){var _0x5459=shared[_0xe4b6('0x70')];var _0x3b2009=_0x5459[_0x35e6ad[_0xe4b6('0x71')]];if(_[_0xe4b6('0x21')](_0x3b2009)){_0x38fe3a({'ret':0x1});}else{var _0x59ada8=_0x3b2009[_0xe4b6('0x72')];var _0x4d6c39=squel[_0xe4b6('0x32')]()[_0xe4b6('0x33')](_0x4910b5)['set']('id',_0x35e6ad['id'])[_0xe4b6('0x73')]('offset',_0x59ada8)[_0xe4b6('0x73')](_0xe4b6('0x71'),_0x35e6ad[_0xe4b6('0x71')])[_0xe4b6('0x43')]();return db[_0xe4b6('0x61')]['query'](_0x4d6c39)['spread'](function(_0x1f2eb0){_0x38fe3a({'ret':0x1});})[_0xe4b6('0x64')](function(_0x159adb){logger['error'](_0x159adb[_0xe4b6('0x5e')]);_0x4a6ceb({'ret':0x1});});}});}function handleTZQuery(_0x49eacd){logger[_0xe4b6('0x5c')](_0x49eacd);return db['sequelize']['query'](_0x49eacd)['spread'](function(_0x19e524){})['catch'](function(_0x5aa0da){logger[_0xe4b6('0x65')](_0x5aa0da[_0xe4b6('0x5e')]);});}function main(_0x4cd543,_0x4c9eb4,_0x3eff2d,_0x4a9bf5){logger[_0xe4b6('0x5c')](_0xe4b6('0x74'),_0x4cd543,JSON[_0xe4b6('0x75')](_0x4c9eb4));process[_0xe4b6('0x76')](_0xe4b6('0x77'));var _0x57081c=_0x4c9eb4[_0xe4b6('0x78')];var _0x497c65=_[_0xe4b6('0x79')](_0x57081c);var _0xee9da5=_0x4c9eb4[_0xe4b6('0x7a')];var _0x5d346d=path[_0xe4b6('0x14')](config[_0xe4b6('0x7b')],'server/files/tmp',_0xee9da5+_0xe4b6('0x7c'));hasTZ=_[_0xe4b6('0x55')](_0x57081c)['includes'](_0xe4b6('0x71'));var _0x458999=_[_0xe4b6('0x55')](_0x57081c)['join']();logger['info']('header',_0x458999);db[_0xe4b6('0x7d')][_0xe4b6('0x1a')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x2d8a75){for(var _0x3b94df=0x0;_0x3b94df<_0x2d8a75[_0xe4b6('0x20')];_0x3b94df++){if(_0x2d8a75[_0x3b94df][_0xe4b6('0x7e')]in _0x57081c){contactItemTypes[_0xe4b6('0x1c')](_0x2d8a75[_0x3b94df]);delete _0x497c65[_0x2d8a75[_0x3b94df]['name']];hasAdditionalPhones=!![];}for(var _0x252f51 in _0x57081c){if(_0x2d8a75[_0x3b94df][_0xe4b6('0x7e')]+_0xe4b6('0x7f')===_0x252f51){phoneDescriptions[_0xe4b6('0x1c')]({'itemTypeId':_0x2d8a75[_0x3b94df]['id'],'description':_0x252f51});delete _0x497c65[_0x252f51];}}}if(hasAdditionalPhones)_0x497c65[_0xe4b6('0x1e')]='';var _0x993018=_['keys'](_0x497c65)[_0xe4b6('0x14')]();logger[_0xe4b6('0x5c')](_0xe4b6('0x80'),_0x993018);fs[_0xe4b6('0x81')](_0x5d346d,_0x993018+'\x0a');Papa[_0xe4b6('0x82')](fs['createReadStream'](_0x4cd543),{'header':!![],'skipEmptyLines':!![],'step':function(_0x496ec9,_0x3e6e1c){try{for(var _0x36359c=0x0,_0x1d70a2=[];_0x36359c<_0x496ec9[_0xe4b6('0x83')]['length'];_0x36359c++){stats[_0xe4b6('0x84')]+=0x1;if(_0x496ec9[_0xe4b6('0x60')][_0x36359c]){handleError(_0x496ec9['data'][_0x36359c],_0x496ec9[_0xe4b6('0x60')][_0x36359c]);}else{var _0x30d1cc=[];var _0x3f4080=[];var _0x588450={};for(var _0x2c7263 in _0x57081c){let _0x29876d=contactItemTypes[_0xe4b6('0x85')](_0x42d040=>_0x42d040['name']===_0x2c7263);let _0x3cf655=contactItemTypes['find'](_0x245af7=>_0x245af7['name']+_0xe4b6('0x7f')===_0x2c7263);if(_[_0xe4b6('0x21')](_0x29876d)&&_['isNil'](_0x3cf655)){if(_0x57081c['hasOwnProperty'](_0x2c7263)){if(_0x496ec9[_0xe4b6('0x83')][_0x36359c][_0x57081c[_0x2c7263]]){var _0x1905c5=_[_0xe4b6('0x86')](_0x496ec9['data'][_0x36359c][_0x57081c[_0x2c7263]]['replace'](/"/g,'\x27'));switch(_0x2c7263){case _0xe4b6('0x87'):var _0x53047b=moment(_0x1905c5,_0xe4b6('0xf'),!![]);if(_0x53047b[_0xe4b6('0x88')]()){_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x1905c5+'\x22');}else{_0x30d1cc['push'](_0xe4b6('0x89'));}break;case _0xe4b6('0x39'):var _0x5c29a6=parseInt(_0x1905c5);_0x1905c5=_[_0xe4b6('0x8a')](_0x5c29a6)||_0x5c29a6<0x0||_0x5c29a6>0x4?_0x4a9bf5?0x3:0x2:_0x5c29a6;_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x1905c5+'\x22');break;case'UserId':var _0x1cd63f=parseInt(_0x1905c5);if(_[_0xe4b6('0x8b')](_0x1cd63f)&&_[_0xe4b6('0x8c')](_0x3eff2d,_0x1cd63f)){_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x1cd63f+'\x22');}else{_0x30d1cc[_0xe4b6('0x1c')]('agent\x20not\x20exists');}break;case _0xe4b6('0x8d'):if(isEmail(_0x1905c5)){_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x1905c5+'\x22');}else{_0x30d1cc[_0xe4b6('0x1c')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1fac97=moment(_0x1905c5,_0xe4b6('0x8e'),!![]);if(_0x1fac97[_0xe4b6('0x88')]()){_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x1905c5+'\x22');}else{_0x30d1cc['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x3f027c=shared[_0xe4b6('0x70')];var _0x25ff0d=_0x3f027c[_0x1905c5];if(!_['isNil'](_0x25ff0d)){var _0x4591a2=_0x25ff0d[_0xe4b6('0x72')];_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x1905c5+'\x22');_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x4591a2+'\x22');}break;default:_0x1d70a2['push']('\x22'+_0x1905c5+'\x22');}}else{switch(_0x2c7263){case _0xe4b6('0x8f'):case _0xe4b6('0x12'):_0x30d1cc['push'](_0x2c7263+_0xe4b6('0x90'));break;default:_0x1d70a2[_0xe4b6('0x1c')]('\x22\x22');}}}}else{var _0x5642ca='';if(!_[_0xe4b6('0x21')](_0x29876d)){if(!_0x588450['hasOwnProperty'](_0x29876d['id'])){if(!_['isNil'](_0x496ec9[_0xe4b6('0x83')][_0x36359c][_0x57081c[_0x2c7263]])){var _0x1905c5=_[_0xe4b6('0x86')](_0x496ec9[_0xe4b6('0x83')][_0x36359c][_0x57081c[_0x2c7263]][_0xe4b6('0x91')](/"/g,'\x27'));var _0x586fbc=phoneDescriptions[_0xe4b6('0x85')](_0x2acb12=>_0x2acb12[_0xe4b6('0x92')]===_0x29876d['id']);if(!_[_0xe4b6('0x21')](_0x586fbc)){var _0x6952dd=_['trim'](_0x496ec9[_0xe4b6('0x83')][_0x36359c][_0x57081c[_0x586fbc[_0xe4b6('0x93')]]][_0xe4b6('0x91')](/"/g,'\x27'));if(!_[_0xe4b6('0x21')](_0x6952dd))_0x1905c5=_0x1905c5+'§'+_0x6952dd;}if(_0x5642ca=='')_0x5642ca=_0x1905c5;else _0x5642ca+='|'+_0x1905c5;}_0x3f4080[_0xe4b6('0x1c')](_0x29876d['id']+':'+_0x5642ca);_0x588450[_0x29876d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d70a2[_0xe4b6('0x1c')]('\x22'+_0x3f4080[_0xe4b6('0x14')](';')+'\x22');}if(_0x30d1cc[_0xe4b6('0x20')]){handleError(_0x496ec9[_0xe4b6('0x83')][_0x36359c],{'code':_0xe4b6('0x94'),'message':_0x30d1cc[_0xe4b6('0x14')]()});}else{fs[_0xe4b6('0x95')](_0x5d346d,_0x1d70a2[_0xe4b6('0x14')]()+'\x0a');}_0x1d70a2=[];}if(!(stats[_0xe4b6('0x84')]%0xc8)){socket[_0xe4b6('0x96')]('contact:import:'+_0xee9da5,stats);stats[_0xe4b6('0x60')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x3e6e1c[_0xe4b6('0x97')]();}}catch(_0x47de31){handleError(_0x496ec9['data'][_0x36359c],{'code':_0xe4b6('0x98'),'message':_0x47de31[_0xe4b6('0x5e')]});logger[_0xe4b6('0x65')]('step',_0x47de31[_0xe4b6('0x5e')]);}},'complete':function(){try{var _0xfca4a1=[];var _0x1dc345=[];var _0x1fd869='cm_contacts';if(_0x4c9eb4[_0xe4b6('0x99')]&&_0x4c9eb4[_0xe4b6('0x99')][_0xe4b6('0x20')]){_0x1fd869=_0xe4b6('0x9a')+_0xee9da5;_0xfca4a1['push'](_0xe4b6('0x9b')+_0x1fd869+_0xe4b6('0x9c'));}tmp_campaigns=_0xe4b6('0x9d')+_0xee9da5;tmp_voice_queues=_0xe4b6('0x9e')+_0xee9da5;_0x1dc345[_0xe4b6('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xe4b6('0x9f'));_0x1dc345[_0xe4b6('0x1c')](_0xe4b6('0x9b')+tmp_voice_queues+_0xe4b6('0x9f'));BPromise['each'](_0x1dc345,handleTZQuery)['then'](function(_0xbfd499){updateTzCampaigns(_0x4c9eb4[_0xe4b6('0x37')])[_0xe4b6('0x1b')](function(_0x5ad290){updateTzVoiceQueues(_0x4c9eb4[_0xe4b6('0x37')])[_0xe4b6('0x1b')](function(_0xcf9438){if(hasTZ)_0x993018=_0x993018[_0xe4b6('0x91')]('dialTimezone','dialTimezone,utcOffset');var _0x38b922=util[_0xe4b6('0xe')](_0xe4b6('0xa0'),_0x5d346d,_0x1fd869,_0x993018,_0x4c9eb4[_0xe4b6('0x37')],_0x4c9eb4[_0xe4b6('0x56')]||null,NOW,NOW);if(_[_0xe4b6('0x21')](_0x57081c[_0xe4b6('0x87')])){_0x38b922+=_0xe4b6('0xa1');}_0xfca4a1[_0xe4b6('0x1c')](_0x38b922);if(_0x4c9eb4[_0xe4b6('0x99')]&&_0x4c9eb4[_0xe4b6('0x99')][_0xe4b6('0x20')]){_0xfca4a1['push'](insertCmContact(_0x4c9eb4[_0xe4b6('0x37')],_0x1fd869,_0x4c9eb4['duplicates'],_0x57081c));_0xfca4a1[_0xe4b6('0x1c')](_0xe4b6('0xa2')+_0x1fd869+';');}BPromise[_0xe4b6('0xa3')](_0xfca4a1,handleQuery)['then'](function(_0x3a0d1f){BPromise[_0xe4b6('0x1d')]([handleAdditionalPhones()])[_0xe4b6('0x1b')](function(){_0xfca4a1=[];for(var _0x45f31c=0x0;_0x45f31c\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','AdditionalPhones','then','length','push','all','isNil','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','UserId','recallme'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0xe254,0x1ed));var _0x4e25=function(_0x1cd048,_0x5be423){_0x1cd048=_0x1cd048-0x0;var _0x27c998=_0xe254[_0x1cd048];return _0x27c998;};'use strict';var fs=require('fs');var path=require(_0x4e25('0x0'));var _=require(_0x4e25('0x1'));var Papa=require('papaparse');var util=require(_0x4e25('0x2'));var BPromise=require(_0x4e25('0x3'));var moment=require(_0x4e25('0x4'));var squel=require(_0x4e25('0x5'));var Redis=require(_0x4e25('0x6'));var db=require(_0x4e25('0x7'))['db'];var config=require(_0x4e25('0x8'));var shared=require(_0x4e25('0x9'));var logger=require(_0x4e25('0xa'))(_0x4e25('0xb'));config['redis']=_['defaults'](config[_0x4e25('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e25('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x4e25('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4e25('0xf')](_0x4e25('0xe'));function isEmail(_0x1d84bf){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))*$/[_0x4e25('0x10')](_0x1d84bf);}function selectNotIn(_0x37baa4,_0x35c103,_0x5e2433,_0x37accf,_0x5c1c5f){return squel[_0x4e25('0x11')]()[_0x4e25('0x12')](_0x4e25('0x13'))[_0x4e25('0x14')](_0x37accf)['join'](_0x35c103,null,_0x35c103+_0x4e25('0x15')+_0x37accf+'.'+_0x5e2433)['where'](_0x37accf+'.'+_0x5e2433+_0x4e25('0x16')+_0x37baa4+'.'+_0x5e2433)['where'](_0x35c103+_0x4e25('0x17')+_0x5c1c5f[_0x4e25('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2a4746,_0x1e824e){promisesAdditionalPhones=[];return db[_0x4e25('0x19')]['findAll']({'raw':!![],'attributes':['id',_0x4e25('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4e25('0x1b')](function(_0x2fe786){if(_0x2fe786!==null){var _0x162f96=[];for(var _0x2256e7=0x0;_0x2256e7<_0x2fe786[_0x4e25('0x1c')];_0x2256e7++){var _0x72715d=_0x2fe786[_0x2256e7];_0x162f96[_0x4e25('0x1d')](insertAdditionalPhones(_0x72715d));}}Promise[_0x4e25('0x1e')](_0x162f96)[_0x4e25('0x1b')](function(){_0x2a4746({'val':0x1});});});});}function insertAdditionalPhones(_0x1d2d7a){return new Promise(function(_0x5ddde9,_0x500b12){var _0x1310d5=_0x1d2d7a[_0x4e25('0x1a')];var _0x2d3d00=_0x1310d5['split'](';');var _0x5c7d06=[];orderBy=0x0;for(var _0x137f0b=0x0;_0x137f0b<_0x2d3d00[_0x4e25('0x1c')];_0x137f0b++){_0x5c7d06[_0x4e25('0x1d')](splitAdditionalPhone(_0x1d2d7a['id'],_0x2d3d00[_0x137f0b]));}Promise['all'](_0x5c7d06)[_0x4e25('0x1b')](function(){_0x5ddde9({'val':_0x2d3d00[_0x4e25('0x1c')]});});});}function splitAdditionalPhone(_0x2d96d2,_0x466455){return new Promise(function(_0x51e829,_0x303a92){var _0x465269=_0x466455['split'](':');var _0xaabcc9=_0x465269[0x0];var _0x5cf183=_0x465269[0x1];if(!_[_0x4e25('0x1f')](_0x5cf183)){var _0x342a5b=_0x5cf183[_0x4e25('0x20')]('|');var _0xfa76b2=[];for(var _0x247d56=0x0;_0x247d56<_0x342a5b['length'];_0x247d56++){if(_0x342a5b[_0x247d56]!==''){var _0x43c78e=_[_0x4e25('0x21')](promisesAdditionalPhones,{'contactId':_0x2d96d2,'phone':_0x342a5b[_0x247d56]});if(_0x43c78e[_0x4e25('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x4e25('0x1d')]({'contactId':_0x2d96d2,'contactTypeId':_0xaabcc9,'phone':_0x342a5b[_0x247d56],'orderBy':orderBy});}}}_0x51e829({'ok':0x1});}else _0x51e829({'res':0x0});});}function createAdditionalPhone(_0x1125c3,_0x565f44,_0x20395f,_0x1dbb52){var _0x5d58a7='';var _0x586553='';var _0x451d3d=_0x20395f[_0x4e25('0x20')]('§');_0x5d58a7=_0x451d3d[0x0];if(_0x451d3d[_0x4e25('0x1c')]==0x2)_0x586553=_0x451d3d[0x1];return new Promise(function(_0x5d3c32,_0x55d51c){return db[_0x4e25('0x22')][_0x4e25('0x23')]({'where':{'CmContactId':_0x1125c3,'item':_0x5d58a7}})[_0x4e25('0x1b')](function(_0x2f3f49){if(_0x2f3f49){return db['CmContactHasItem'][_0x4e25('0x24')]({'ItemTypeId':_0x565f44,'description':_0x586553,'OrderBy':_0x1dbb52},{'where':{'CmContactId':_0x1125c3,'item':_0x5d58a7}})[_0x4e25('0x1b')](function(_0x349f53){_0x5d3c32({'res':_0x4e25('0x25')});});}else{return db[_0x4e25('0x22')][_0x4e25('0x26')]({'CmContactId':_0x1125c3,'item':_0x5d58a7,'description':_0x586553,'ItemTypeId':_0x565f44,'OrderBy':_0x1dbb52,'ItemClass':_0x4e25('0x27')})[_0x4e25('0x1b')](function(_0x1f5b68){_0x5d3c32({'res':'inserted'});});}});});}function insertCmHopper(_0xc6162,_0x31a416,_0x5ed819,_0x5a2950,_0x198237){var _0x4914d1=['cm_contacts.phone','cm_contacts.scheduledat',_0x4e25('0x28'),_0x4e25('0x29'),_0x31a416+'.'+_0x5a2950,_0x4e25('0x2a'),'cm_contacts.updatedAt',_0x4e25('0x2b'),'cm_contacts.UserId','\x22'+_0x198237+'\x22'];return squel['insert']()[_0x4e25('0x2c')](_0x4e25('0x2d'))[_0x4e25('0x2e')](['phone',_0x4e25('0x2f'),_0x4e25('0x30'),_0x4e25('0x31'),_0x5a2950,'createdAt',_0x4e25('0x32'),'priority',_0x4e25('0x33'),_0x4e25('0x34')],squel[_0x4e25('0x11')]()[_0x4e25('0x35')](_0x4914d1)['from'](_0x31a416)[_0x4e25('0x18')](_0x4e25('0x36'),null,_0x4e25('0x37')+_0x31a416+_0x4e25('0x38'))[_0x4e25('0x18')](_0x5ed819,null,_0x5ed819+_0x4e25('0x15')+_0x31a416+'.'+_0x5a2950)[_0x4e25('0x39')](_0x31a416+_0x4e25('0x3a'),_0xc6162)[_0x4e25('0x39')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4e25('0x39')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x31a416,_0x5ed819,_0x5a2950,_0x4e25('0x2d'),['\x22always\x22',_0x4e25('0x3b')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x31a416,_0x5ed819,_0x5a2950,_0x4e25('0x2d'),[_0x4e25('0x3c')])))[_0x4e25('0x3d')]();}function insertCmHopperBlack(_0x29cc0d,_0x2990f8,_0x1bd464,_0x1084db){var _0x1584d=[_0x4e25('0x3e'),_0x4e25('0x28'),_0x4e25('0x29'),_0x2990f8+'.'+_0x1084db,_0x4e25('0x2a'),'cm_contacts.updatedAt'];return squel[_0x4e25('0x3f')]()['into'](_0x4e25('0x40'))['fromQuery']([_0x4e25('0x13'),_0x4e25('0x30'),'ListId',_0x1084db,_0x4e25('0x41'),_0x4e25('0x32')],squel[_0x4e25('0x11')]()[_0x4e25('0x35')](_0x1584d)[_0x4e25('0x14')](_0x2990f8)['join'](_0x4e25('0x36'),null,_0x4e25('0x37')+_0x2990f8+_0x4e25('0x38'))[_0x4e25('0x18')](_0x1bd464,null,_0x1bd464+'.id\x20=\x20'+_0x2990f8+'.'+_0x1084db)['where'](_0x2990f8+_0x4e25('0x3a'),_0x29cc0d)[_0x4e25('0x39')](_0x4e25('0x42'),NOW)[_0x4e25('0x39')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x4e25('0x11')]()[_0x4e25('0x12')](_0x4e25('0x13'))[_0x4e25('0x14')](_0x4e25('0x40'))[_0x4e25('0x39')](_0x4e25('0x43'),_0x29cc0d)['where'](_0x1084db+_0x4e25('0x16')+_0x2990f8+'.'+_0x1084db)))[_0x4e25('0x3d')]();}function insertTzCmHopper(_0x53c219,_0x65994f,_0x5cf543,_0x23790e,_0x5bb21e,_0x5d71c4){var _0xe482cc=[_0x4e25('0x3e'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x5d71c4+_0x4e25('0x44'),'cm_contacts.id',_0x4e25('0x29'),_0x65994f+'.'+_0x23790e,_0x4e25('0x2a'),'cm_contacts.updatedAt',_0x4e25('0x2b'),_0x4e25('0x45'),'\x22'+_0x5bb21e+'\x22'];var _0xa80fd4=squel[_0x4e25('0x3f')]()[_0x4e25('0x2c')]('cm_hopper')['fromQuery']([_0x4e25('0x13'),_0x4e25('0x2f'),'ContactId','ListId',_0x23790e,_0x4e25('0x41'),_0x4e25('0x32'),_0x4e25('0x46'),_0x4e25('0x33'),_0x4e25('0x34')],squel[_0x4e25('0x11')]()['fields'](_0xe482cc)[_0x4e25('0x14')](_0x65994f)[_0x4e25('0x18')](_0x4e25('0x36'),null,_0x4e25('0x37')+_0x65994f+'.CmListId')[_0x4e25('0x18')](_0x5cf543,null,_0x5cf543+_0x4e25('0x15')+_0x65994f+'.'+_0x23790e)[_0x4e25('0x18')](_0x5d71c4,null,_0x5d71c4+_0x4e25('0x15')+_0x65994f+'.'+_0x23790e)[_0x4e25('0x39')](_0x65994f+_0x4e25('0x3a'),_0x53c219)[_0x4e25('0x39')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4e25('0x39')](_0x4e25('0x47'),selectNotIn(_0x65994f,_0x5cf543,_0x23790e,_0x4e25('0x2d'),[_0x4e25('0x3c'),'\x22onlyIfOpen\x22']))[_0x4e25('0x39')](_0x4e25('0x47'),selectNotIn(_0x65994f,_0x5cf543,_0x23790e,_0x4e25('0x2d'),[_0x4e25('0x3c')])))[_0x4e25('0x3d')]();return _0xa80fd4;}function insertTzCmHopperBlack(_0x3f4d58,_0x4d0aa1,_0x5111b9,_0xb84edf){var _0x5c230b=[_0x4e25('0x3e'),'cm_contacts.id',_0x4e25('0x29'),_0x4d0aa1+'.'+_0xb84edf,_0x4e25('0x2a'),_0x4e25('0x48')];return squel[_0x4e25('0x3f')]()[_0x4e25('0x2c')](_0x4e25('0x40'))[_0x4e25('0x2e')]([_0x4e25('0x13'),'ContactId','ListId',_0xb84edf,_0x4e25('0x41'),_0x4e25('0x32')],squel[_0x4e25('0x11')]()[_0x4e25('0x35')](_0x5c230b)[_0x4e25('0x14')](_0x4d0aa1)[_0x4e25('0x18')](_0x4e25('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x4d0aa1+_0x4e25('0x38'))[_0x4e25('0x18')](_0x5111b9,null,_0x5111b9+_0x4e25('0x15')+_0x4d0aa1+'.'+_0xb84edf)[_0x4e25('0x39')](_0x4d0aa1+_0x4e25('0x3a'),_0x3f4d58)['where'](_0x4e25('0x42'),NOW)[_0x4e25('0x39')](_0x4e25('0x47'),squel[_0x4e25('0x11')]()['field'](_0x4e25('0x13'))[_0x4e25('0x14')](_0x4e25('0x40'))[_0x4e25('0x39')](_0x4e25('0x43'),_0x3f4d58)[_0x4e25('0x39')](_0xb84edf+_0x4e25('0x16')+_0x4d0aa1+'.'+_0xb84edf)))['toString']();}function insertCmHopperAdditionalPhones(_0x197155){var _0x55e2c3=[_0x4e25('0x49'),'cm_contact_has_items.item',_0x4e25('0x4a'),_0x4e25('0x4b'),_0x4e25('0x4c')];return squel['insert']()[_0x4e25('0x2c')]('cm_hopper_additional_phones')[_0x4e25('0x2e')](['CmHopperId',_0x4e25('0x13'),_0x4e25('0x4d'),_0x4e25('0x41'),_0x4e25('0x32')],squel['select']()[_0x4e25('0x35')](_0x55e2c3)[_0x4e25('0x14')]('cm_hopper')[_0x4e25('0x18')]('cm_contacts',null,_0x4e25('0x4e'))[_0x4e25('0x18')](_0x4e25('0x4f'),null,_0x4e25('0x50'))['where'](_0x4e25('0x51'),_0x197155)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x4e25('0x3d')]();}function insertCmContact(_0x4b200d,_0x24385d,_0x7f600e,_0x54ac04){var _0x9c2064=_[_0x4e25('0x52')](_[_0x4e25('0x53')](_0x54ac04),['ListId','CompanyId',_0x4e25('0x41'),_0x4e25('0x32'),_0x4e25('0x54')]);return squel[_0x4e25('0x3f')]()[_0x4e25('0x2c')]('cm_contacts')[_0x4e25('0x2e')](_0x9c2064,squel[_0x4e25('0x11')]()[_0x4e25('0x35')](_0x9c2064)[_0x4e25('0x14')](_0x24385d)[_0x4e25('0x39')]('('+_0x7f600e[_0x4e25('0x18')](',')+_0x4e25('0x55'),squel[_0x4e25('0x11')]()['fields'](_0x7f600e)[_0x4e25('0x14')](_0x4e25('0x36'))[_0x4e25('0x39')](_0x4e25('0x43'),_0x4b200d)[_0x4e25('0x39')]('deletedAt\x20IS\x20NULL'))[_0x4e25('0x39')](_0x4e25('0x56'),squel[_0x4e25('0x11')]()['field'](_0x4e25('0x57'),_0x4e25('0x58'))[_0x4e25('0x14')](_0x24385d)[_0x4e25('0x59')](_0x7f600e[_0x4e25('0x18')](','))))[_0x4e25('0x3d')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x511130){logger['error'](_0x511130['message']);process[_0x4e25('0x5a')](0x1);}function handleError(_0x25cf91,_0x11cea0){stats['errors'][_0x4e25('0x1d')]({'name':_0x11cea0['code'],'message':_0x11cea0[_0x4e25('0x5b')],'row':_0x25cf91});}function handleQuery(_0x2762fd){logger[_0x4e25('0x5c')](_0x2762fd);return db[_0x4e25('0x5d')][_0x4e25('0x5e')](_0x2762fd)[_0x4e25('0x5f')](function(_0x3ef979){results[_0x4e25('0x1d')](_0x3ef979);})['catch'](function(_0x4f21e5){logger['error'](_0x4f21e5['message']);});}function updateTzCampaigns(_0x357968){return new Promise(function(_0x5854ce,_0x570f34){var _0x52543a=squel[_0x4e25('0x11')]()[_0x4e25('0x35')]([_0x4e25('0x60'),_0x4e25('0x61')])[_0x4e25('0x14')](_0x4e25('0x62'))[_0x4e25('0x18')](_0x4e25('0x63'),null,_0x4e25('0x64'))['where'](_0x4e25('0x65')+_0x357968);db[_0x4e25('0x5d')][_0x4e25('0x5e')](_0x52543a[_0x4e25('0x3d')]())[_0x4e25('0x5f')](function(_0x26fafd){var _0x3cabba=[];for(var _0x26475d=0x0;_0x26475d<_0x26fafd['length'];_0x26475d++){_0x3cabba[_0x4e25('0x1d')](getTimezoneData(_0x26fafd[_0x26475d],tmp_campaigns));}BPromise['all'](_0x3cabba)[_0x4e25('0x1b')](function(){_0x5854ce({'val':0x1});});})['catch'](function(_0xd222aa){logger[_0x4e25('0x66')](_0xd222aa[_0x4e25('0x5b')]);_0x5854ce({'val':0x0});});});}function updateTzVoiceQueues(_0x2a01c4){return new Promise(function(_0x35f70a,_0x2ff548){var _0x156eac=squel[_0x4e25('0x11')]()[_0x4e25('0x35')]([_0x4e25('0x67'),_0x4e25('0x68')])['from'](_0x4e25('0x69'))[_0x4e25('0x18')]('voice_queues_has_cm_lists',null,_0x4e25('0x6a'))['where'](_0x4e25('0x6b')+_0x2a01c4);db[_0x4e25('0x5d')][_0x4e25('0x5e')](_0x156eac['toString']())[_0x4e25('0x5f')](function(_0x3a2431){var _0xe8411a=[];for(var _0x5817f6=0x0;_0x5817f6<_0x3a2431['length'];_0x5817f6++){_0xe8411a[_0x4e25('0x1d')](getTimezoneData(_0x3a2431[_0x5817f6],tmp_voice_queues));}BPromise[_0x4e25('0x1e')](_0xe8411a)['then'](function(){_0x35f70a({'val':0x1});});})[_0x4e25('0x6c')](function(_0x5d2e53){logger['error'](_0x5d2e53[_0x4e25('0x5b')]);_0x35f70a({'val':0x0});});});}function getTimezoneData(_0x11b7bd,_0x22e8c0){return new Promise(function(_0x3dfe8f,_0x56ba7d){var _0x43fb54=shared[_0x4e25('0x6d')];var _0x49f7eb=_0x43fb54[_0x11b7bd[_0x4e25('0x6e')]];if(_[_0x4e25('0x1f')](_0x49f7eb)){_0x3dfe8f({'ret':0x1});}else{var _0xebf3af=_0x49f7eb['utcOffset'];var _0x497f2e=squel[_0x4e25('0x3f')]()[_0x4e25('0x2c')](_0x22e8c0)[_0x4e25('0x6f')]('id',_0x11b7bd['id'])[_0x4e25('0x6f')](_0x4e25('0x70'),_0xebf3af)[_0x4e25('0x6f')](_0x4e25('0x6e'),_0x11b7bd[_0x4e25('0x6e')])[_0x4e25('0x3d')]();return db[_0x4e25('0x5d')][_0x4e25('0x5e')](_0x497f2e)[_0x4e25('0x5f')](function(_0xcafdf7){_0x3dfe8f({'ret':0x1});})[_0x4e25('0x6c')](function(_0x4d316f){logger['error'](_0x4d316f[_0x4e25('0x5b')]);_0x56ba7d({'ret':0x1});});}});}function handleTZQuery(_0x97a387){logger['info'](_0x97a387);return db['sequelize']['query'](_0x97a387)[_0x4e25('0x5f')](function(_0x2c7ede){})[_0x4e25('0x6c')](function(_0xd0cf4c){logger[_0x4e25('0x66')](_0xd0cf4c[_0x4e25('0x5b')]);});}function main(_0x15444e,_0x224a13,_0x401e30,_0x3590ba){logger[_0x4e25('0x5c')](_0x4e25('0x71'),_0x15444e,JSON['stringify'](_0x224a13));process[_0x4e25('0x72')](_0x4e25('0x73'));var _0x16494c=_0x224a13['binding'];var _0x5133d4=_[_0x4e25('0x74')](_0x16494c);var _0x1244c2=_0x224a13[_0x4e25('0x75')];var _0x2af132=path['join'](config[_0x4e25('0x76')],_0x4e25('0x77'),_0x1244c2+_0x4e25('0x78'));hasTZ=_['keys'](_0x16494c)[_0x4e25('0x79')](_0x4e25('0x6e'));var _0x5aa1e5=_[_0x4e25('0x53')](_0x16494c)[_0x4e25('0x18')]();logger[_0x4e25('0x5c')](_0x4e25('0x7a'),_0x5aa1e5);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x4e25('0x7b')]})[_0x4e25('0x1b')](function(_0x519b09){for(var _0x1c27e3=0x0;_0x1c27e3<_0x519b09[_0x4e25('0x1c')];_0x1c27e3++){if(_0x519b09[_0x1c27e3][_0x4e25('0x7b')]in _0x16494c){contactItemTypes[_0x4e25('0x1d')](_0x519b09[_0x1c27e3]);delete _0x5133d4[_0x519b09[_0x1c27e3][_0x4e25('0x7b')]];hasAdditionalPhones=!![];}for(var _0x2fcc78 in _0x16494c){if(_0x519b09[_0x1c27e3][_0x4e25('0x7b')]+_0x4e25('0x7c')===_0x2fcc78){phoneDescriptions['push']({'itemTypeId':_0x519b09[_0x1c27e3]['id'],'description':_0x2fcc78});delete _0x5133d4[_0x2fcc78];}}}if(hasAdditionalPhones)_0x5133d4[_0x4e25('0x1a')]='';var _0x1a63d5=_['keys'](_0x5133d4)[_0x4e25('0x18')]();logger[_0x4e25('0x5c')](_0x4e25('0x7a'),_0x1a63d5);fs['writeFileSync'](_0x2af132,_0x1a63d5+'\x0a');Papa['parse'](fs['createReadStream'](_0x15444e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x370f1e,_0x202ecc){try{for(var _0x1f0873=0x0,_0x3975b1=[];_0x1f0873<_0x370f1e['data'][_0x4e25('0x1c')];_0x1f0873++){stats[_0x4e25('0x7d')]+=0x1;if(_0x370f1e[_0x4e25('0x7e')][_0x1f0873]){handleError(_0x370f1e[_0x4e25('0x7f')][_0x1f0873],_0x370f1e[_0x4e25('0x7e')][_0x1f0873]);}else{var _0x1f2fb4=[];var _0x3a93d2=[];var _0x3eee9b={};for(var _0x5c6fc0 in _0x16494c){let _0x42b0d9=contactItemTypes[_0x4e25('0x80')](_0x3f0ccf=>_0x3f0ccf['name']===_0x5c6fc0);let _0xfab6ad=contactItemTypes[_0x4e25('0x80')](_0x20c15a=>_0x20c15a[_0x4e25('0x7b')]+'_description'===_0x5c6fc0);if(_[_0x4e25('0x1f')](_0x42b0d9)&&_[_0x4e25('0x1f')](_0xfab6ad)){if(_0x16494c[_0x4e25('0x81')](_0x5c6fc0)){if(_0x370f1e[_0x4e25('0x7f')][_0x1f0873][_0x16494c[_0x5c6fc0]]){var _0x193433=_[_0x4e25('0x82')](_0x370f1e['data'][_0x1f0873][_0x16494c[_0x5c6fc0]][_0x4e25('0x83')](/"/g,'\x27'));switch(_0x5c6fc0){case _0x4e25('0x2f'):var _0x60138=moment(_0x193433,_0x4e25('0xe'),!![]);if(_0x60138[_0x4e25('0x84')]()){_0x3975b1[_0x4e25('0x1d')]('\x22'+_0x193433+'\x22');}else{_0x1f2fb4[_0x4e25('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x4e25('0x46'):var _0x2622f7=parseInt(_0x193433);_0x193433=_[_0x4e25('0x85')](_0x2622f7)||_0x2622f7<0x0||_0x2622f7>0x4?_0x3590ba?0x3:0x2:_0x2622f7;_0x3975b1[_0x4e25('0x1d')]('\x22'+_0x193433+'\x22');break;case _0x4e25('0x33'):var _0x465ec=parseInt(_0x193433);if(_['isNumber'](_0x465ec)&&_[_0x4e25('0x79')](_0x401e30,_0x465ec)){_0x3975b1[_0x4e25('0x1d')]('\x22'+_0x465ec+'\x22');}else{_0x1f2fb4[_0x4e25('0x1d')]('agent\x20not\x20exists');}break;case _0x4e25('0x86'):if(isEmail(_0x193433)){_0x3975b1['push']('\x22'+_0x193433+'\x22');}else{_0x1f2fb4['push'](_0x4e25('0x87'));}break;case'dateOfBirth':var _0x3136e8=moment(_0x193433,'YYYY-MM-DD',!![]);if(_0x3136e8[_0x4e25('0x84')]()){_0x3975b1[_0x4e25('0x1d')]('\x22'+_0x193433+'\x22');}else{_0x1f2fb4[_0x4e25('0x1d')](_0x4e25('0x88'));}break;case _0x4e25('0x6e'):var _0x30380e=shared[_0x4e25('0x6d')];var _0xf9ac51=_0x30380e[_0x193433];if(!_[_0x4e25('0x1f')](_0xf9ac51)){var _0x12d7dd=_0xf9ac51[_0x4e25('0x89')];_0x3975b1[_0x4e25('0x1d')]('\x22'+_0x193433+'\x22');_0x3975b1['push']('\x22'+_0x12d7dd+'\x22');}break;default:_0x3975b1[_0x4e25('0x1d')]('\x22'+_0x193433+'\x22');}}else{switch(_0x5c6fc0){case _0x4e25('0x8a'):case _0x4e25('0x13'):_0x1f2fb4[_0x4e25('0x1d')](_0x5c6fc0+_0x4e25('0x8b'));break;default:_0x3975b1[_0x4e25('0x1d')]('\x22\x22');}}}}else{var _0x5eb133='';if(!_[_0x4e25('0x1f')](_0x42b0d9)){if(!_0x3eee9b[_0x4e25('0x81')](_0x42b0d9['id'])){if(!_[_0x4e25('0x1f')](_0x370f1e[_0x4e25('0x7f')][_0x1f0873][_0x16494c[_0x5c6fc0]])){var _0x193433=_[_0x4e25('0x82')](_0x370f1e[_0x4e25('0x7f')][_0x1f0873][_0x16494c[_0x5c6fc0]][_0x4e25('0x83')](/"/g,'\x27'));var _0x7b9b57=phoneDescriptions[_0x4e25('0x80')](_0x5de556=>_0x5de556[_0x4e25('0x8c')]===_0x42b0d9['id']);if(!_['isNil'](_0x7b9b57)){var _0x5f2285=_[_0x4e25('0x82')](_0x370f1e[_0x4e25('0x7f')][_0x1f0873][_0x16494c[_0x7b9b57[_0x4e25('0x8d')]]]['replace'](/"/g,'\x27'));if(!_[_0x4e25('0x1f')](_0x5f2285))_0x193433=_0x193433+'§'+_0x5f2285;}if(_0x5eb133=='')_0x5eb133=_0x193433;else _0x5eb133+='|'+_0x193433;}_0x3a93d2[_0x4e25('0x1d')](_0x42b0d9['id']+':'+_0x5eb133);_0x3eee9b[_0x42b0d9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3975b1['push']('\x22'+_0x3a93d2[_0x4e25('0x18')](';')+'\x22');}if(_0x1f2fb4[_0x4e25('0x1c')]){handleError(_0x370f1e[_0x4e25('0x7f')][_0x1f0873],{'code':_0x4e25('0x8e'),'message':_0x1f2fb4['join']()});}else{fs['appendFileSync'](_0x2af132,_0x3975b1[_0x4e25('0x18')]()+'\x0a');}_0x3975b1=[];}if(!(stats['rows']%0xc8)){socket[_0x4e25('0x8f')]('contact:import:'+_0x1244c2,stats);stats[_0x4e25('0x7e')]=[];}}if(stopped){logger['info'](_0x4e25('0x90'));_0x202ecc[_0x4e25('0x91')]();}}catch(_0x1efb93){handleError(_0x370f1e['data'][_0x1f0873],{'code':_0x4e25('0x92'),'message':_0x1efb93['message']});logger[_0x4e25('0x66')](_0x4e25('0x93'),_0x1efb93[_0x4e25('0x5b')]);}},'complete':function(){try{var _0x363b24=[];var _0x5c4920=[];var _0x38ad60=_0x4e25('0x36');if(_0x224a13[_0x4e25('0x94')]&&_0x224a13[_0x4e25('0x94')][_0x4e25('0x1c')]){_0x38ad60=_0x4e25('0x95')+_0x1244c2;_0x363b24[_0x4e25('0x1d')](_0x4e25('0x96')+_0x38ad60+_0x4e25('0x97'));}tmp_campaigns='campaigns_'+_0x1244c2;tmp_voice_queues=_0x4e25('0x98')+_0x1244c2;_0x5c4920[_0x4e25('0x1d')](_0x4e25('0x96')+tmp_campaigns+_0x4e25('0x99'));_0x5c4920[_0x4e25('0x1d')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x4e25('0x99'));BPromise[_0x4e25('0x9a')](_0x5c4920,handleTZQuery)['then'](function(_0x305c69){updateTzCampaigns(_0x224a13[_0x4e25('0x31')])['then'](function(_0x1f9a0d){updateTzVoiceQueues(_0x224a13[_0x4e25('0x31')])[_0x4e25('0x1b')](function(_0x8a455c){if(hasTZ)_0x1a63d5=_0x1a63d5[_0x4e25('0x83')](_0x4e25('0x6e'),_0x4e25('0x9b'));var _0x38d303=util[_0x4e25('0xf')](_0x4e25('0x9c'),_0x2af132,_0x38ad60,_0x1a63d5,_0x224a13[_0x4e25('0x31')],_0x224a13['CompanyId']||null,NOW,NOW);if(_[_0x4e25('0x1f')](_0x16494c[_0x4e25('0x2f')])){_0x38d303+=',\x20scheduledAt\x20=\x20NOW()';}_0x363b24[_0x4e25('0x1d')](_0x38d303);if(_0x224a13[_0x4e25('0x94')]&&_0x224a13[_0x4e25('0x94')][_0x4e25('0x1c')]){_0x363b24[_0x4e25('0x1d')](insertCmContact(_0x224a13[_0x4e25('0x31')],_0x38ad60,_0x224a13[_0x4e25('0x94')],_0x16494c));_0x363b24[_0x4e25('0x1d')](_0x4e25('0x9d')+_0x38ad60+';');}BPromise['each'](_0x363b24,handleQuery)[_0x4e25('0x1b')](function(_0x29d26a){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x363b24=[];for(var _0x58c7df=0x0;_0x58c7df\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/logger','redis','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','where','\x20=\x20','join','sequelize','select\x20*\x20from\x20','length','isNil','push','all','then','catch','error','message','AdditionalPhones','split','filter','update','updated','CmContactHasItem','create','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','updatedAt','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','min_id','group','info','exit','errors','code','query','spread','main','stringify','send','clone','socket_timestamp','root','server/files/tmp','.csv','name','_description','header','writeFileSync','parse','createReadStream','rows','data','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step'];(function(_0x7945df,_0xf1474c){var _0x5140b2=function(_0x5d171f){while(--_0x5d171f){_0x7945df['push'](_0x7945df['shift']());}};_0x5140b2(++_0xf1474c);}(_0xcf7e,0xaf));var _0xecf7=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xcf7e[_0x55e08b];return _0xd1a7ff;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xecf7('0x0'));var util=require(_0xecf7('0x1'));var BPromise=require(_0xecf7('0x2'));var moment=require('moment');var squel=require(_0xecf7('0x3'));var Redis=require(_0xecf7('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xecf7('0x5'));var logger=require(_0xecf7('0x6'))('import');config[_0xecf7('0x7')]=_['defaults'](config[_0xecf7('0x7')],{'host':_0xecf7('0x8'),'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()[_0xecf7('0x9')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xecf7('0xa')+moment()[_0xecf7('0x9')](_0xecf7('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1e400d){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))*$/[_0xecf7('0xc')](_0x1e400d);}function selectNotIn(_0x128217,_0xed97b0,_0x5e2a60,_0x88e7bf,_0x1499b1){return squel[_0xecf7('0xd')]()[_0xecf7('0xe')](_0xecf7('0xf'))[_0xecf7('0x10')](_0x88e7bf)['join'](_0xed97b0,null,_0xed97b0+'.id\x20=\x20'+_0x88e7bf+'.'+_0x5e2a60)[_0xecf7('0x11')](_0x88e7bf+'.'+_0x5e2a60+_0xecf7('0x12')+_0x128217+'.'+_0x5e2a60)[_0xecf7('0x11')](_0xed97b0+'.dialCheckDuplicateType\x20IN\x20('+_0x1499b1[_0xecf7('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5b7d97,_0xb92502){promisesAdditionalPhones=[];promisesContact=[];return db[_0xecf7('0x14')]['query'](_0xecf7('0x15')+tempTableName)['spread'](function(_0x5d7dbb){if(_0x5d7dbb!==null){var _0x2d5413=[];for(var _0x2e69c5=0x0;_0x2e69c5<_0x5d7dbb[_0xecf7('0x16')];_0x2e69c5++){var _0x3f771a=_0x5d7dbb[_0x2e69c5];if(!_[_0xecf7('0x17')](_0x3f771a['phone'])){if(!_[_0xecf7('0x17')](_0x3f771a['AdditionalPhones']))_0x2d5413[_0xecf7('0x18')](insertAdditionalPhones(_0x3f771a));promisesContact[_0xecf7('0x18')]({'contact':_0x3f771a});}}}Promise[_0xecf7('0x19')](_0x2d5413)[_0xecf7('0x1a')](function(){_0x5b7d97({'val':0x1});});})[_0xecf7('0x1b')](function(_0x787a5b){logger[_0xecf7('0x1c')](_0x787a5b[_0xecf7('0x1d')]);});});}function insertAdditionalPhones(_0x2e7a2e){return new Promise(function(_0xf1baa2,_0xafb3b5){var _0x485d68=_0x2e7a2e[_0xecf7('0x1e')];if(_[_0xecf7('0x17')](_0x485d68))_0xafb3b5({'val':0x0});else{var _0x50e6ac=_0x485d68['split'](';');var _0x58559d=[];orderBy=0x0;for(var _0x130149=0x0;_0x130149<_0x50e6ac[_0xecf7('0x16')];_0x130149++){_0x58559d[_0xecf7('0x18')](splitAdditionalPhone(_0x2e7a2e['id'],_0x50e6ac[_0x130149]));}Promise[_0xecf7('0x19')](_0x58559d)[_0xecf7('0x1a')](function(){_0xf1baa2({'val':_0x50e6ac[_0xecf7('0x16')]});});}});}function splitAdditionalPhone(_0x1135b9,_0x5579a6){return new Promise(function(_0x40a8c5,_0xdbf6c2){var _0x3f9e02=_0x5579a6[_0xecf7('0x1f')](':');var _0x544989=_0x3f9e02[0x0];var _0x1db045=_0x3f9e02[0x1];if(_0x1db045!==''){var _0x118ab0=_0x1db045[_0xecf7('0x1f')]('|');var _0x183119=[];for(var _0x96e7d=0x0;_0x96e7d<_0x118ab0[_0xecf7('0x16')];_0x96e7d++){if(_0x118ab0[_0x96e7d]!==''){var _0x5c6fd7=_[_0xecf7('0x20')](promisesAdditionalPhones,{'contactId':_0x1135b9,'phone':_0x118ab0[_0x96e7d]});if(_0x5c6fd7[_0xecf7('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0xecf7('0x18')]({'contactId':_0x1135b9,'contactTypeId':_0x544989,'phone':_0x118ab0[_0x96e7d],'orderBy':orderBy});}}}_0x40a8c5({'ok':0x1});}else _0x40a8c5({'res':0x0});});}function createAdditionalPhone(_0x567bf8,_0x54c109,_0x655285,_0x241bb0){var _0xabf159='';var _0x213756='';var _0x5ba877=_0x655285[_0xecf7('0x1f')]('§');_0xabf159=_0x5ba877[0x0];if(_0x5ba877[_0xecf7('0x16')]==0x2)_0x213756=_0x5ba877[0x1];return new Promise(function(_0x59dce9,_0x2296cd){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x567bf8,'item':_0xabf159}})['then'](function(_0x4cf7bb){if(_0x4cf7bb){return db['CmContactHasItem'][_0xecf7('0x21')]({'ItemTypeId':_0x54c109,'description':_0x213756,'OrderBy':_0x241bb0},{'where':{'CmContactId':_0x567bf8,'item':_0xabf159}})[_0xecf7('0x1a')](function(_0x255152){_0x59dce9({'res':_0xecf7('0x22')});});}else{return db[_0xecf7('0x23')][_0xecf7('0x24')]({'CmContactId':_0x567bf8,'item':_0xabf159,'ItemTypeId':_0x54c109,'description':_0x213756,'OrderBy':_0x241bb0,'ItemClass':'PHONE'})['then'](function(_0x58e84c){_0x59dce9({'res':'inserted'});});}});});}function updateContact(_0x2a4c7b){return new Promise(function(_0x52d6b6,_0x330be9){var _0x24966d=_0x2a4c7b['id'];delete _0x2a4c7b['id'];return db[_0xecf7('0x25')][_0xecf7('0x21')](_0x2a4c7b,{'where':{'id':_0x24966d}})[_0xecf7('0x1a')](function(_0xd2cd9){updatedRows+=0x1;return db[_0xecf7('0x26')][_0xecf7('0x21')]({'phone':_0x2a4c7b['phone']},{'where':{'ContactId':_0x24966d}})['then'](function(_0x364eaf){_0x52d6b6({'ret':'OK'});});});});}function insertCmHopper(_0x31845e,_0x5fe1cb,_0x444dfd,_0xf377bb,_0x2c78db){var _0x276a12=[_0xecf7('0x27'),'cm_contacts.scheduledat',_0xecf7('0x28'),_0xecf7('0x29'),_0x5fe1cb+'.'+_0xf377bb,_0xecf7('0x2a'),_0xecf7('0x2b'),_0xecf7('0x2c'),_0xecf7('0x2d'),'\x22'+_0x2c78db+'\x22'];return squel[_0xecf7('0x2e')]()[_0xecf7('0x2f')](_0xecf7('0x30'))[_0xecf7('0x31')]([_0xecf7('0xf'),_0xecf7('0x32'),_0xecf7('0x33'),_0xecf7('0x34'),_0xf377bb,_0xecf7('0x35'),'updatedAt',_0xecf7('0x36'),_0xecf7('0x37'),_0xecf7('0x38')],squel[_0xecf7('0xd')]()[_0xecf7('0x39')](_0x276a12)['from'](_0x5fe1cb)[_0xecf7('0x13')](_0xecf7('0x3a'),null,_0xecf7('0x3b')+_0x5fe1cb+_0xecf7('0x3c'))['join'](_0x444dfd,null,_0x444dfd+_0xecf7('0x3d')+_0x5fe1cb+'.'+_0xf377bb)['where'](_0x5fe1cb+_0xecf7('0x3e'),_0x31845e)[_0xecf7('0x11')](_0xecf7('0x3f'),NOW)[_0xecf7('0x11')](_0xecf7('0x40'),selectNotIn(_0x5fe1cb,_0x444dfd,_0xf377bb,_0xecf7('0x30'),[_0xecf7('0x41'),_0xecf7('0x42')]))[_0xecf7('0x11')](_0xecf7('0x40'),selectNotIn(_0x5fe1cb,_0x444dfd,_0xf377bb,_0xecf7('0x30'),[_0xecf7('0x41')])))['toString']();}function insertCmHopperBlack(_0x275380,_0x2e3541,_0x3d4239,_0x553bcf){var _0x51b31d=[_0xecf7('0x27'),_0xecf7('0x28'),'cm_contacts.ListId',_0x2e3541+'.'+_0x553bcf,_0xecf7('0x2a'),_0xecf7('0x2b')];return squel[_0xecf7('0x2e')]()[_0xecf7('0x2f')]('cm_hopper_black')['fromQuery']([_0xecf7('0xf'),_0xecf7('0x33'),_0xecf7('0x34'),_0x553bcf,_0xecf7('0x35'),_0xecf7('0x43')],squel[_0xecf7('0xd')]()[_0xecf7('0x39')](_0x51b31d)[_0xecf7('0x10')](_0x2e3541)[_0xecf7('0x13')](_0xecf7('0x3a'),null,_0xecf7('0x3b')+_0x2e3541+'.CmListId')['join'](_0x3d4239,null,_0x3d4239+_0xecf7('0x3d')+_0x2e3541+'.'+_0x553bcf)[_0xecf7('0x11')](_0x2e3541+_0xecf7('0x3e'),_0x275380)[_0xecf7('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xecf7('0x11')](_0xecf7('0x40'),squel[_0xecf7('0xd')]()['field']('phone')[_0xecf7('0x10')]('cm_hopper_black')[_0xecf7('0x11')]('ListId\x20=\x20?',_0x275380)[_0xecf7('0x11')](_0x553bcf+_0xecf7('0x44'),_0x2e3541+'.'+_0x553bcf)))[_0xecf7('0x45')]();}function insertCmHopperAdditionalPhones(_0x2fc9d4){var _0x33eb5f=[_0xecf7('0x46'),_0xecf7('0x47'),_0xecf7('0x48'),_0xecf7('0x49'),_0xecf7('0x4a')];return squel['insert']()['into'](_0xecf7('0x4b'))[_0xecf7('0x31')]([_0xecf7('0x4c'),_0xecf7('0xf'),_0xecf7('0x4d'),_0xecf7('0x35'),_0xecf7('0x43')],squel[_0xecf7('0xd')]()[_0xecf7('0x39')](_0x33eb5f)[_0xecf7('0x10')]('cm_hopper')[_0xecf7('0x13')](_0xecf7('0x3a'),null,_0xecf7('0x4e'))['join'](_0xecf7('0x4f'),null,_0xecf7('0x50'))[_0xecf7('0x11')](_0xecf7('0x51'),_0x2fc9d4)[_0xecf7('0x11')](_0xecf7('0x3f'),NOW))[_0xecf7('0x45')]();}function insertCmContact(_0x40403a,_0x16e0ae,_0x2aa439,_0x5608c5){var _0x5b0f0d=_['concat'](_[_0xecf7('0x52')](_0x5608c5),['ListId','CompanyId',_0xecf7('0x35'),_0xecf7('0x43')]);return squel[_0xecf7('0x2e')]()[_0xecf7('0x2f')]('cm_contacts')[_0xecf7('0x31')](_0x5b0f0d,squel['select']()[_0xecf7('0x39')](_0x5b0f0d)[_0xecf7('0x10')](_0x16e0ae)['where']('('+_0x2aa439[_0xecf7('0x13')](',')+_0xecf7('0x53'),squel[_0xecf7('0xd')]()[_0xecf7('0x39')](_0x2aa439)[_0xecf7('0x10')](_0xecf7('0x3a'))['where'](_0xecf7('0x54'),_0x40403a))['where'](_0xecf7('0x55'),squel[_0xecf7('0xd')]()[_0xecf7('0xe')]('MIN(id)',_0xecf7('0x56'))['from'](_0x16e0ae)[_0xecf7('0x57')](_0x2aa439[_0xecf7('0x13')](','))))[_0xecf7('0x45')]();}function handleStop(){logger[_0xecf7('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x162367){logger['error'](_0x162367[_0xecf7('0x1d')]);process[_0xecf7('0x59')](0x1);}function handleError(_0x12b778,_0x2c613e){stats[_0xecf7('0x5a')][_0xecf7('0x18')]({'name':_0x2c613e[_0xecf7('0x5b')],'message':_0x2c613e[_0xecf7('0x1d')],'row':_0x12b778});}function handleQuery(_0x5dc300){logger[_0xecf7('0x58')](_0x5dc300);return db[_0xecf7('0x14')][_0xecf7('0x5c')](_0x5dc300)[_0xecf7('0x5d')](function(_0x1f9984){results[_0xecf7('0x18')](_0x1f9984);})['catch'](function(_0x3eb6f7){logger[_0xecf7('0x1c')](_0x3eb6f7[_0xecf7('0x1d')]);});}function main(_0x4d0d5e,_0x1234e2,_0x10935c,_0x450a0d){logger[_0xecf7('0x58')](_0xecf7('0x5e'),_0x4d0d5e,JSON[_0xecf7('0x5f')](_0x1234e2));process[_0xecf7('0x60')]('start');var _0x1ef71b=_0x1234e2['binding'];var _0xf3192d=_[_0xecf7('0x61')](_0x1ef71b);var _0x12934b=_0x1234e2[_0xecf7('0x62')];var _0x20351f=path[_0xecf7('0x13')](config[_0xecf7('0x63')],_0xecf7('0x64'),_0x12934b+_0xecf7('0x65'));logger[_0xecf7('0x58')]('body',_0x1234e2);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})[_0xecf7('0x1a')](function(_0x575c56){for(var _0x2c41e0=0x0;_0x2c41e0<_0x575c56[_0xecf7('0x16')];_0x2c41e0++){if(_0x575c56[_0x2c41e0][_0xecf7('0x66')]in _0x1ef71b){contactItemTypes[_0xecf7('0x18')](_0x575c56[_0x2c41e0]);delete _0xf3192d[_0x575c56[_0x2c41e0][_0xecf7('0x66')]];hasAdditionalPhones=!![];}for(var _0x4de0c5 in _0x1ef71b){if(_0x575c56[_0x2c41e0][_0xecf7('0x66')]+_0xecf7('0x67')===_0x4de0c5){phoneDescriptions[_0xecf7('0x18')]({'itemTypeId':_0x575c56[_0x2c41e0]['id'],'description':_0x4de0c5});delete _0xf3192d[_0x4de0c5];}}}if(hasAdditionalPhones)_0xf3192d['AdditionalPhones']='';var _0x1249b6=_['keys'](_0xf3192d)[_0xecf7('0x13')]();logger[_0xecf7('0x58')](_0xecf7('0x68'),_0x1249b6);fs[_0xecf7('0x69')](_0x20351f,_0x1249b6+'\x0a');Papa[_0xecf7('0x6a')](fs[_0xecf7('0x6b')](_0x4d0d5e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3f8975,_0x257336){try{for(var _0x5ea807=0x0,_0x1bd814=[];_0x5ea807<_0x3f8975['data'][_0xecf7('0x16')];_0x5ea807++){stats[_0xecf7('0x6c')]+=0x1;if(_0x3f8975[_0xecf7('0x5a')][_0x5ea807]){handleError(_0x3f8975[_0xecf7('0x6d')][_0x5ea807],_0x3f8975[_0xecf7('0x5a')][_0x5ea807]);}else{var _0x5f06ac=[];var _0x3f4bf6=[];var _0x2c8a0e={};for(var _0x102ed7 in _0x1ef71b){let _0x4d1a57=contactItemTypes[_0xecf7('0x6e')](_0x1453e6=>_0x1453e6[_0xecf7('0x66')]===_0x102ed7);let _0x27711c=contactItemTypes['find'](_0x4bc2f7=>_0x4bc2f7[_0xecf7('0x66')]+_0xecf7('0x67')===_0x102ed7);if(_['isNil'](_0x4d1a57)&&_['isNil'](_0x27711c)){if(_0x1ef71b['hasOwnProperty'](_0x102ed7)){if(_0x3f8975[_0xecf7('0x6d')][_0x5ea807][_0x1ef71b[_0x102ed7]]){var _0x2d8cd0=_[_0xecf7('0x6f')](_0x3f8975['data'][_0x5ea807][_0x1ef71b[_0x102ed7]][_0xecf7('0x70')](/"/g,'\x27'));switch(_0x102ed7){case _0xecf7('0x32'):var _0x4bac0e=moment(_0x2d8cd0,_0xecf7('0x71'),!![]);if(_0x4bac0e['isValid']()){_0x1bd814[_0xecf7('0x18')]('\x22'+_0x2d8cd0+'\x22');}else{_0x5f06ac[_0xecf7('0x18')](_0xecf7('0x72'));}break;case _0xecf7('0x36'):var _0x18dadc=parseInt(_0x2d8cd0);_0x2d8cd0=_[_0xecf7('0x73')](_0x18dadc)||_0x18dadc<0x0||_0x18dadc>0x4?_0x450a0d?0x3:0x2:_0x18dadc;_0x1bd814['push']('\x22'+_0x2d8cd0+'\x22');break;case _0xecf7('0x37'):var _0x24e069=parseInt(_0x2d8cd0);if(_[_0xecf7('0x74')](_0x24e069)&&_[_0xecf7('0x75')](_0x10935c,_0x24e069)){_0x1bd814[_0xecf7('0x18')]('\x22'+_0x24e069+'\x22');}else{_0x5f06ac[_0xecf7('0x18')]('agent\x20not\x20exists');}break;case _0xecf7('0x76'):if(isEmail(_0x2d8cd0)){_0x1bd814[_0xecf7('0x18')]('\x22'+_0x2d8cd0+'\x22');}else{_0x5f06ac[_0xecf7('0x18')](_0xecf7('0x77'));}break;case'dateOfBirth':var _0x48be76=moment(_0x2d8cd0,_0xecf7('0x78'),!![]);if(_0x48be76['isValid']()){_0x1bd814['push']('\x22'+_0x2d8cd0+'\x22');}else{_0x5f06ac[_0xecf7('0x18')](_0xecf7('0x79'));}break;default:_0x1bd814['push']('\x22'+_0x2d8cd0+'\x22');}}else{switch(_0x102ed7){case'firstName':case _0xecf7('0xf'):_0x5f06ac['push'](_0x102ed7+_0xecf7('0x7a'));break;default:_0x1bd814[_0xecf7('0x18')]('\x22\x22');}}}}else{var _0x409b22='';if(!_['isNil'](_0x4d1a57)){if(!_0x2c8a0e[_0xecf7('0x7b')](_0x4d1a57['id'])){for(var _0x159ae5=0x0;_0x159ae5<_0x1ef71b[_0x102ed7][_0xecf7('0x16')];_0x159ae5++){var _0x2d8cd0=_[_0xecf7('0x6f')](_0x3f8975[_0xecf7('0x6d')][_0x5ea807][_0x1ef71b[_0x102ed7][_0x159ae5]][_0xecf7('0x70')](/"/g,'\x27'));var _0x4b43b4=phoneDescriptions[_0xecf7('0x6e')](_0x579739=>_0x579739[_0xecf7('0x7c')]===_0x4d1a57['id']);if(!_[_0xecf7('0x17')](_0x4b43b4)){var _0x12e2f2=_[_0xecf7('0x6f')](_0x3f8975[_0xecf7('0x6d')][_0x5ea807][_0x1ef71b[_0x4b43b4[_0xecf7('0x7d')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x12e2f2))_0x2d8cd0=_0x2d8cd0+'§'+_0x12e2f2;}if(_0x409b22=='')_0x409b22=_0x2d8cd0;else _0x409b22+='|'+_0x2d8cd0;}_0x3f4bf6[_0xecf7('0x18')](_0x4d1a57['id']+':'+_0x409b22);_0x2c8a0e[_0x4d1a57['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1bd814[_0xecf7('0x18')]('\x22'+_0x3f4bf6[_0xecf7('0x13')](';')+'\x22');}if(_0x5f06ac[_0xecf7('0x16')]){handleError(_0x3f8975[_0xecf7('0x6d')][_0x5ea807],{'code':_0xecf7('0x7e'),'message':_0x5f06ac[_0xecf7('0x13')]()});}else{fs[_0xecf7('0x7f')](_0x20351f,_0x1bd814[_0xecf7('0x13')]()+'\x0a');}_0x1bd814=[];}if(!(stats[_0xecf7('0x6c')]%0xc8)){socket[_0xecf7('0x80')]('contact:import:'+_0x12934b,stats);stats['errors']=[];}}if(stopped){logger[_0xecf7('0x58')](_0xecf7('0x81'));_0x257336[_0xecf7('0x82')]();}}catch(_0xe7cfab){handleError(_0x3f8975[_0xecf7('0x6d')][_0x5ea807],{'code':_0xecf7('0x83'),'message':_0xe7cfab[_0xecf7('0x1d')]});logger[_0xecf7('0x1c')](_0xecf7('0x84'),_0xe7cfab[_0xecf7('0x1d')]);}},'complete':function(){try{var _0x33ec76=[];var _0x1d12d3=tempTableName;_0x33ec76[_0xecf7('0x18')]('CREATE\x20TABLE\x20'+_0x1d12d3+_0xecf7('0x85'));logger['info'](_0xecf7('0x86'),contactItemTypes['length']);var _0x343447=util[_0xecf7('0x9')](_0xecf7('0x87'),_0x20351f,_0x1d12d3,_0x1249b6,_0x1234e2['ListId'],_0x1234e2[_0xecf7('0x88')]||null,NOW,NOW);if(_['isNil'](_0x1ef71b[_0xecf7('0x32')])){_0x343447+=_0xecf7('0x89');}_0x33ec76[_0xecf7('0x18')](_0x343447);BPromise[_0xecf7('0x8a')](_0x33ec76,handleQuery)[_0xecf7('0x1a')](function(_0x2ad797){BPromise[_0xecf7('0x19')]([handleAdditionalPhones()])[_0xecf7('0x1a')](function(){_0x33ec76=[];for(var _0x5e6263=0x0;_0x5e6263\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','lodash','papaparse','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','format','YYYYMMDDHHmmss','select'];(function(_0x5bd20c,_0x4e007a){var _0x33900b=function(_0x4ea0f2){while(--_0x4ea0f2){_0x5bd20c['push'](_0x5bd20c['shift']());}};_0x33900b(++_0x4e007a);}(_0x63ad,0x7d));var _0xd63a=function(_0x5dad53,_0x531d6f){_0x5dad53=_0x5dad53-0x0;var _0x48ca51=_0x63ad[_0x5dad53];return _0x48ca51;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xd63a('0x0'));var Papa=require(_0xd63a('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0xd63a('0x2'));var db=require(_0xd63a('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0xd63a('0x4'))(_0xd63a('0x5'));config[_0xd63a('0x6')]=_[_0xd63a('0x7')](config[_0xd63a('0x6')],{'host':_0xd63a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd63a('0x6')]));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()['format'](_0xd63a('0x9'));var tempTableName='cm_contacts_temp_'+moment()[_0xd63a('0xa')](_0xd63a('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x32e0d1){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'](_0x32e0d1);}function selectNotIn(_0x4baa08,_0x51612b,_0x3bf872,_0x5e2e07,_0x249b90){return squel[_0xd63a('0xc')]()['field'](_0xd63a('0xd'))[_0xd63a('0xe')](_0x5e2e07)[_0xd63a('0xf')](_0x51612b,null,_0x51612b+_0xd63a('0x10')+_0x5e2e07+'.'+_0x3bf872)[_0xd63a('0x11')](_0x5e2e07+'.'+_0x3bf872+_0xd63a('0x12')+_0x4baa08+'.'+_0x3bf872)[_0xd63a('0x11')](_0x51612b+'.dialCheckDuplicateType\x20IN\x20('+_0x249b90[_0xd63a('0xf')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24bd46,_0x3a84de){promisesAdditionalPhones=[];promisesContact=[];return db[_0xd63a('0x13')][_0xd63a('0x14')](_0xd63a('0x15')+tempTableName)[_0xd63a('0x16')](function(_0x59423d){if(_0x59423d!==null){var _0x3a0ce1=[];for(var _0x5f37a1=0x0;_0x5f37a1<_0x59423d[_0xd63a('0x17')];_0x5f37a1++){var _0x12ba93=_0x59423d[_0x5f37a1];if(!_[_0xd63a('0x18')](_0x12ba93[_0xd63a('0xd')])){if(!_[_0xd63a('0x18')](_0x12ba93[_0xd63a('0x19')]))_0x3a0ce1[_0xd63a('0x1a')](insertAdditionalPhones(_0x12ba93));promisesContact[_0xd63a('0x1a')]({'contact':_0x12ba93});}}}Promise['all'](_0x3a0ce1)[_0xd63a('0x1b')](function(){_0x24bd46({'val':0x1});});})['catch'](function(_0x587b6e){logger[_0xd63a('0x1c')](_0x587b6e['message']);});});}function insertAdditionalPhones(_0x4964ab){return new Promise(function(_0x39c30f,_0x30d7c1){var _0x1eccf6=_0x4964ab[_0xd63a('0x19')];if(_['isNil'](_0x1eccf6))_0x30d7c1({'val':0x0});else{var _0x2a1067=_0x1eccf6[_0xd63a('0x1d')](';');var _0x194bac=[];orderBy=0x0;for(var _0x1faf54=0x0;_0x1faf54<_0x2a1067['length'];_0x1faf54++){_0x194bac[_0xd63a('0x1a')](splitAdditionalPhone(_0x4964ab['id'],_0x2a1067[_0x1faf54]));}Promise['all'](_0x194bac)[_0xd63a('0x1b')](function(){_0x39c30f({'val':_0x2a1067[_0xd63a('0x17')]});});}});}function splitAdditionalPhone(_0x5e3148,_0x22e62f){return new Promise(function(_0x1c9921,_0x1924c6){var _0x5689bf=_0x22e62f['split'](':');var _0x3d7ba5=_0x5689bf[0x0];var _0x4a488c=_0x5689bf[0x1];if(_0x4a488c!==''){var _0x4e56be=_0x4a488c[_0xd63a('0x1d')]('|');var _0x26462c=[];for(var _0x12b1b4=0x0;_0x12b1b4<_0x4e56be[_0xd63a('0x17')];_0x12b1b4++){if(_0x4e56be[_0x12b1b4]!==''){var _0x20fb37=_[_0xd63a('0x1e')](promisesAdditionalPhones,{'contactId':_0x5e3148,'phone':_0x4e56be[_0x12b1b4]});if(_0x20fb37['length']==0x0){orderBy++;promisesAdditionalPhones[_0xd63a('0x1a')]({'contactId':_0x5e3148,'contactTypeId':_0x3d7ba5,'phone':_0x4e56be[_0x12b1b4],'orderBy':orderBy});}}}_0x1c9921({'ok':0x1});}else _0x1c9921({'res':0x0});});}function createAdditionalPhone(_0x4d2cf4,_0x533370,_0x49c815,_0x5b52c2){var _0x36f6d0='';var _0x1893ae='';var _0x47f01b=_0x49c815[_0xd63a('0x1d')]('§');_0x36f6d0=_0x47f01b[0x0];if(_0x47f01b[_0xd63a('0x17')]==0x2)_0x1893ae=_0x47f01b[0x1];return new Promise(function(_0x5dd045,_0x246f46){return db[_0xd63a('0x1f')][_0xd63a('0x20')]({'where':{'CmContactId':_0x4d2cf4,'item':_0x36f6d0}})[_0xd63a('0x1b')](function(_0x19c16d){if(_0x19c16d){return db[_0xd63a('0x1f')]['update']({'ItemTypeId':_0x533370,'description':_0x1893ae,'OrderBy':_0x5b52c2},{'where':{'CmContactId':_0x4d2cf4,'item':_0x36f6d0}})['then'](function(_0x2f3c62){_0x5dd045({'res':_0xd63a('0x21')});});}else{return db['CmContactHasItem'][_0xd63a('0x22')]({'CmContactId':_0x4d2cf4,'item':_0x36f6d0,'ItemTypeId':_0x533370,'description':_0x1893ae,'OrderBy':_0x5b52c2,'ItemClass':'PHONE'})['then'](function(_0x4e8030){_0x5dd045({'res':'inserted'});});}});});}function updateContact(_0x44dc9c){return new Promise(function(_0x5158a8,_0x3c8438){var _0x1b13ad=_0x44dc9c['id'];delete _0x44dc9c['id'];return db['CmContact'][_0xd63a('0x23')](_0x44dc9c,{'where':{'id':_0x1b13ad}})[_0xd63a('0x1b')](function(_0x530d9a){updatedRows+=0x1;return db[_0xd63a('0x24')][_0xd63a('0x23')]({'phone':_0x44dc9c['phone']},{'where':{'ContactId':_0x1b13ad}})[_0xd63a('0x1b')](function(_0x981d6d){_0x5158a8({'ret':'OK'});});});});}function insertCmHopper(_0x650165,_0x56d122,_0x2e9eb1,_0x34268b,_0x2a5edb){var _0x39252b=[_0xd63a('0x25'),_0xd63a('0x26'),_0xd63a('0x27'),_0xd63a('0x28'),_0x56d122+'.'+_0x34268b,_0xd63a('0x29'),'cm_contacts.updatedAt',_0xd63a('0x2a'),_0xd63a('0x2b'),'\x22'+_0x2a5edb+'\x22'];return squel['insert']()[_0xd63a('0x2c')](_0xd63a('0x2d'))[_0xd63a('0x2e')]([_0xd63a('0xd'),_0xd63a('0x2f'),_0xd63a('0x30'),_0xd63a('0x31'),_0x34268b,'createdAt','updatedAt',_0xd63a('0x32'),_0xd63a('0x33'),'recallme'],squel[_0xd63a('0xc')]()[_0xd63a('0x34')](_0x39252b)['from'](_0x56d122)[_0xd63a('0xf')](_0xd63a('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x56d122+_0xd63a('0x36'))[_0xd63a('0xf')](_0x2e9eb1,null,_0x2e9eb1+_0xd63a('0x10')+_0x56d122+'.'+_0x34268b)[_0xd63a('0x11')](_0x56d122+_0xd63a('0x37'),_0x650165)[_0xd63a('0x11')](_0xd63a('0x38'),NOW)[_0xd63a('0x11')](_0xd63a('0x39'),selectNotIn(_0x56d122,_0x2e9eb1,_0x34268b,_0xd63a('0x2d'),[_0xd63a('0x3a'),_0xd63a('0x3b')]))[_0xd63a('0x11')](_0xd63a('0x39'),selectNotIn(_0x56d122,_0x2e9eb1,_0x34268b,_0xd63a('0x2d'),['\x22always\x22'])))[_0xd63a('0x3c')]();}function insertCmHopperBlack(_0x456fe1,_0x5e137c,_0x15d882,_0x33a0e2){var _0x249f68=[_0xd63a('0x25'),_0xd63a('0x27'),_0xd63a('0x28'),_0x5e137c+'.'+_0x33a0e2,_0xd63a('0x29'),'cm_contacts.updatedAt'];return squel['insert']()['into']('cm_hopper_black')[_0xd63a('0x2e')]([_0xd63a('0xd'),_0xd63a('0x30'),'ListId',_0x33a0e2,_0xd63a('0x3d'),_0xd63a('0x3e')],squel[_0xd63a('0xc')]()[_0xd63a('0x34')](_0x249f68)[_0xd63a('0xe')](_0x5e137c)[_0xd63a('0xf')]('cm_contacts',null,_0xd63a('0x3f')+_0x5e137c+_0xd63a('0x36'))[_0xd63a('0xf')](_0x15d882,null,_0x15d882+_0xd63a('0x10')+_0x5e137c+'.'+_0x33a0e2)['where'](_0x5e137c+_0xd63a('0x37'),_0x456fe1)[_0xd63a('0x11')](_0xd63a('0x38'),NOW)[_0xd63a('0x11')](_0xd63a('0x39'),squel[_0xd63a('0xc')]()['field'](_0xd63a('0xd'))['from']('cm_hopper_black')[_0xd63a('0x11')]('ListId\x20=\x20?',_0x456fe1)[_0xd63a('0x11')](_0x33a0e2+_0xd63a('0x40'),_0x5e137c+'.'+_0x33a0e2)))[_0xd63a('0x3c')]();}function insertCmHopperAdditionalPhones(_0x5cff6b){var _0xbe579b=[_0xd63a('0x41'),'cm_contact_has_items.item',_0xd63a('0x42'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xd63a('0x43')]()[_0xd63a('0x2c')](_0xd63a('0x44'))['fromQuery']([_0xd63a('0x45'),_0xd63a('0xd'),_0xd63a('0x46'),_0xd63a('0x3d'),_0xd63a('0x3e')],squel[_0xd63a('0xc')]()[_0xd63a('0x34')](_0xbe579b)['from'](_0xd63a('0x2d'))[_0xd63a('0xf')](_0xd63a('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xd63a('0xf')]('cm_contact_has_items',null,_0xd63a('0x47'))[_0xd63a('0x11')](_0xd63a('0x48'),_0x5cff6b)[_0xd63a('0x11')](_0xd63a('0x38'),NOW))['toString']();}function insertCmContact(_0x1266bf,_0x514331,_0x4d7741,_0x1ebac2){var _0x35db7e=_[_0xd63a('0x49')](_[_0xd63a('0x4a')](_0x1ebac2),['ListId','CompanyId',_0xd63a('0x3d'),_0xd63a('0x3e')]);return squel[_0xd63a('0x43')]()[_0xd63a('0x2c')](_0xd63a('0x35'))[_0xd63a('0x2e')](_0x35db7e,squel[_0xd63a('0xc')]()[_0xd63a('0x34')](_0x35db7e)['from'](_0x514331)[_0xd63a('0x11')]('('+_0x4d7741[_0xd63a('0xf')](',')+_0xd63a('0x4b'),squel[_0xd63a('0xc')]()['fields'](_0x4d7741)['from'](_0xd63a('0x35'))[_0xd63a('0x11')](_0xd63a('0x4c'),_0x1266bf))[_0xd63a('0x11')](_0xd63a('0x4d'),squel[_0xd63a('0xc')]()['field']('MIN(id)',_0xd63a('0x4e'))[_0xd63a('0xe')](_0x514331)[_0xd63a('0x4f')](_0x4d7741['join'](','))))['toString']();}function handleStop(){logger[_0xd63a('0x50')](_0xd63a('0x51'));stopped=!![];}function handleUncaughtException(_0x3d9728){logger[_0xd63a('0x1c')](_0x3d9728[_0xd63a('0x52')]);process[_0xd63a('0x53')](0x1);}function handleError(_0x261324,_0xd74cd){stats['errors'][_0xd63a('0x1a')]({'name':_0xd74cd[_0xd63a('0x54')],'message':_0xd74cd[_0xd63a('0x52')],'row':_0x261324});}function handleQuery(_0x52324b){logger[_0xd63a('0x50')](_0x52324b);return db['sequelize']['query'](_0x52324b)[_0xd63a('0x16')](function(_0x2a3979){results[_0xd63a('0x1a')](_0x2a3979);})['catch'](function(_0x2ea550){logger[_0xd63a('0x1c')](_0x2ea550[_0xd63a('0x52')]);});}function main(_0x3aa156,_0x49524a,_0x486c8e,_0x5bcbdf){logger[_0xd63a('0x50')]('main',_0x3aa156,JSON[_0xd63a('0x55')](_0x49524a));process[_0xd63a('0x56')]('start');var _0x315a29=_0x49524a[_0xd63a('0x57')];var _0x253777=_[_0xd63a('0x58')](_0x315a29);var _0x380126=_0x49524a['socket_timestamp'];var _0xc821aa=path['join'](config[_0xd63a('0x59')],_0xd63a('0x5a'),_0x380126+_0xd63a('0x5b'));logger[_0xd63a('0x50')]('body',_0x49524a);db['ContactItemType'][_0xd63a('0x5c')]({'raw':!![],'attributes':['id',_0xd63a('0x5d')]})['then'](function(_0x5a1461){for(var _0x201e80=0x0;_0x201e80<_0x5a1461['length'];_0x201e80++){if(_0x5a1461[_0x201e80][_0xd63a('0x5d')]in _0x315a29){contactItemTypes[_0xd63a('0x1a')](_0x5a1461[_0x201e80]);delete _0x253777[_0x5a1461[_0x201e80][_0xd63a('0x5d')]];hasAdditionalPhones=!![];}for(var _0x150f80 in _0x315a29){if(_0x5a1461[_0x201e80]['name']+_0xd63a('0x5e')===_0x150f80){phoneDescriptions[_0xd63a('0x1a')]({'itemTypeId':_0x5a1461[_0x201e80]['id'],'description':_0x150f80});delete _0x253777[_0x150f80];}}}if(hasAdditionalPhones)_0x253777[_0xd63a('0x19')]='';var _0x297229=_[_0xd63a('0x4a')](_0x253777)[_0xd63a('0xf')]();logger[_0xd63a('0x50')](_0xd63a('0x5f'),_0x297229);fs['writeFileSync'](_0xc821aa,_0x297229+'\x0a');Papa[_0xd63a('0x60')](fs[_0xd63a('0x61')](_0x3aa156),{'header':!![],'skipEmptyLines':!![],'step':function(_0x589d96,_0x9879bc){try{for(var _0x54b47a=0x0,_0x287a80=[];_0x54b47a<_0x589d96[_0xd63a('0x62')][_0xd63a('0x17')];_0x54b47a++){stats[_0xd63a('0x63')]+=0x1;if(_0x589d96[_0xd63a('0x64')][_0x54b47a]){handleError(_0x589d96[_0xd63a('0x62')][_0x54b47a],_0x589d96[_0xd63a('0x64')][_0x54b47a]);}else{var _0x26849b=[];var _0x2cdc96=[];var _0x45ae04={};for(var _0x22bf3e in _0x315a29){let _0x5062a3=contactItemTypes[_0xd63a('0x65')](_0x46a636=>_0x46a636['name']===_0x22bf3e);let _0x2c960d=contactItemTypes[_0xd63a('0x65')](_0x1cc0db=>_0x1cc0db[_0xd63a('0x5d')]+_0xd63a('0x5e')===_0x22bf3e);if(_['isNil'](_0x5062a3)&&_['isNil'](_0x2c960d)){if(_0x315a29['hasOwnProperty'](_0x22bf3e)){if(_0x589d96[_0xd63a('0x62')][_0x54b47a][_0x315a29[_0x22bf3e]]){var _0x20e7d0=_['trim'](_0x589d96['data'][_0x54b47a][_0x315a29[_0x22bf3e]][_0xd63a('0x66')](/"/g,'\x27'));switch(_0x22bf3e){case _0xd63a('0x2f'):var _0x1ff0e9=moment(_0x20e7d0,_0xd63a('0x9'),!![]);if(_0x1ff0e9[_0xd63a('0x67')]()){_0x287a80[_0xd63a('0x1a')]('\x22'+_0x20e7d0+'\x22');}else{_0x26849b[_0xd63a('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xd63a('0x32'):var _0x2cf453=parseInt(_0x20e7d0);_0x20e7d0=_['isNaN'](_0x2cf453)||_0x2cf453<0x0||_0x2cf453>0x4?_0x5bcbdf?0x3:0x2:_0x2cf453;_0x287a80[_0xd63a('0x1a')]('\x22'+_0x20e7d0+'\x22');break;case _0xd63a('0x33'):var _0x34c5a7=parseInt(_0x20e7d0);if(_[_0xd63a('0x68')](_0x34c5a7)&&_[_0xd63a('0x69')](_0x486c8e,_0x34c5a7)){_0x287a80[_0xd63a('0x1a')]('\x22'+_0x34c5a7+'\x22');}else{_0x26849b[_0xd63a('0x1a')]('agent\x20not\x20exists');}break;case _0xd63a('0x6a'):if(isEmail(_0x20e7d0)){_0x287a80[_0xd63a('0x1a')]('\x22'+_0x20e7d0+'\x22');}else{_0x26849b[_0xd63a('0x1a')]('email\x20wrong\x20format');}break;case _0xd63a('0x6b'):var _0x73490d=moment(_0x20e7d0,_0xd63a('0x6c'),!![]);if(_0x73490d[_0xd63a('0x67')]()){_0x287a80[_0xd63a('0x1a')]('\x22'+_0x20e7d0+'\x22');}else{_0x26849b['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x287a80[_0xd63a('0x1a')]('\x22'+_0x20e7d0+'\x22');}}else{switch(_0x22bf3e){case _0xd63a('0x6d'):case'phone':_0x26849b[_0xd63a('0x1a')](_0x22bf3e+'\x20not\x20specified');break;default:_0x287a80[_0xd63a('0x1a')]('\x22\x22');}}}}else{var _0x4db37b='';if(!_['isNil'](_0x5062a3)){if(!_0x45ae04['hasOwnProperty'](_0x5062a3['id'])){for(var _0x4d7616=0x0;_0x4d7616<_0x315a29[_0x22bf3e]['length'];_0x4d7616++){var _0x20e7d0=_['trim'](_0x589d96[_0xd63a('0x62')][_0x54b47a][_0x315a29[_0x22bf3e][_0x4d7616]]['replace'](/"/g,'\x27'));var _0x156bd0=phoneDescriptions[_0xd63a('0x65')](_0xa5135e=>_0xa5135e[_0xd63a('0x6e')]===_0x5062a3['id']);if(!_[_0xd63a('0x18')](_0x156bd0)){var _0x36d3f1=_['trim'](_0x589d96['data'][_0x54b47a][_0x315a29[_0x156bd0['description']][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xd63a('0x18')](_0x36d3f1))_0x20e7d0=_0x20e7d0+'§'+_0x36d3f1;}if(_0x4db37b=='')_0x4db37b=_0x20e7d0;else _0x4db37b+='|'+_0x20e7d0;}_0x2cdc96['push'](_0x5062a3['id']+':'+_0x4db37b);_0x45ae04[_0x5062a3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x287a80[_0xd63a('0x1a')]('\x22'+_0x2cdc96[_0xd63a('0xf')](';')+'\x22');}if(_0x26849b[_0xd63a('0x17')]){handleError(_0x589d96[_0xd63a('0x62')][_0x54b47a],{'code':_0xd63a('0x6f'),'message':_0x26849b[_0xd63a('0xf')]()});}else{fs['appendFileSync'](_0xc821aa,_0x287a80[_0xd63a('0xf')]()+'\x0a');}_0x287a80=[];}if(!(stats[_0xd63a('0x63')]%0xc8)){socket[_0xd63a('0x70')](_0xd63a('0x71')+_0x380126,stats);stats[_0xd63a('0x64')]=[];}}if(stopped){logger['info'](_0xd63a('0x72'));_0x9879bc[_0xd63a('0x73')]();}}catch(_0xa0a2f0){handleError(_0x589d96[_0xd63a('0x62')][_0x54b47a],{'code':_0xd63a('0x74'),'message':_0xa0a2f0[_0xd63a('0x52')]});logger[_0xd63a('0x1c')]('step',_0xa0a2f0[_0xd63a('0x52')]);}},'complete':function(){try{var _0x2b7bbc=[];var _0x4f80a7=tempTableName;_0x2b7bbc[_0xd63a('0x1a')]('CREATE\x20TABLE\x20'+_0x4f80a7+'\x20LIKE\x20cm_contacts;');logger[_0xd63a('0x50')](_0xd63a('0x75'),contactItemTypes[_0xd63a('0x17')]);var _0x13855a=util[_0xd63a('0xa')](_0xd63a('0x76'),_0xc821aa,_0x4f80a7,_0x297229,_0x49524a[_0xd63a('0x31')],_0x49524a[_0xd63a('0x77')]||null,NOW,NOW);if(_[_0xd63a('0x18')](_0x315a29[_0xd63a('0x2f')])){_0x13855a+=_0xd63a('0x78');}_0x2b7bbc['push'](_0x13855a);BPromise[_0xd63a('0x79')](_0x2b7bbc,handleQuery)[_0xd63a('0x1b')](function(_0x2139af){BPromise[_0xd63a('0x7a')]([handleAdditionalPhones()])[_0xd63a('0x1b')](function(){_0x2b7bbc=[];for(var _0x11d163=0x0;_0x11d163\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','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','query','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','getSelectedTags','isEmpty','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','getAccountFK','agent','search','field','color','tools_tags','getInteractionFK','user_has_','ui.','from','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','select','interactions'];(function(_0x1a1ad2,_0x21e8a7){var _0x32ba06=function(_0x19a1dc){while(--_0x19a1dc){_0x1a1ad2['push'](_0x1a1ad2['shift']());}};_0x32ba06(++_0x21e8a7);}(_0xb304,0x128));var _0x4b30=function(_0x4a87da,_0x30004b){_0x4a87da=_0x4a87da-0x0;var _0x1509f2=_0xb304[_0x4a87da];return _0x1509f2;};'use strict';var _=require(_0x4b30('0x0'));var squel=require(_0x4b30('0x1'));var as=require(_0x4b30('0x2'));var qs=require(_0x4b30('0x3'));var updateInteraction=require(_0x4b30('0x4'))[_0x4b30('0x5')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x4afa38,_0x160473,_0x3f7c88){var _0x4d934b=![];var _0x508ad0=utils[_0x4b30('0x6')](_0x4afa38);if(_0x160473['role']===_0x4b30('0x7')&&!_0x3f7c88[_0x4b30('0x8')]&&!_0x3f7c88[_0x508ad0]){_0x4d934b=!![];}return _0x4d934b;}function getTagsQuery(){return squel['select']()[_0x4b30('0x9')]('id')['field']('name')['field'](_0x4b30('0xa'))['from'](_0x4b30('0xb'));}function getUsersQuery(_0x57a78c,_0x126746){var _0x14637e=utils[_0x4b30('0xc')](_0x57a78c);var _0x2467a1=_0x4b30('0xd')+_0x57a78c+'_interactions';var _0x4ac424=squel['select']()[_0x4b30('0x9')]('u.id')['field']('u.fullname')[_0x4b30('0x9')](_0x4b30('0xe')+_0x14637e)[_0x4b30('0xf')](_0x2467a1,'ui')['left_join'](_0x4b30('0x10'),'u',_0x4b30('0x11'));if(_0x126746[_0x4b30('0x12')]>0x0){_0x4ac424[_0x4b30('0x13')](_0x4b30('0xe')+_0x14637e+_0x4b30('0x14'),_['map'](_0x126746,'id'));}return _0x4ac424;}function getInteractionsQuery(_0x58353d){var _0x540927=utils[_0x4b30('0x15')](_0x58353d);var _0x253ee0=utils['getAccountFK'](_0x58353d);var _0x43bc2=utils['getInteractionFK'](_0x58353d);return squel[_0x4b30('0x16')]()['from'](_0x540927[_0x4b30('0x17')],'i')['left_join'](_0x4b30('0x18'),'c',_0x4b30('0x19'))[_0x4b30('0x1a')](_0x4b30('0x10'),'o',_0x4b30('0x1b'))[_0x4b30('0x1a')](_0x540927[_0x4b30('0x1c')],'a','a.id\x20=\x20i.'+_0x253ee0)[_0x4b30('0x1a')](_0x540927[_0x4b30('0x1d')],'me',_0x4b30('0x1e')+_0x43bc2+'\x20=\x20i.id')[_0x4b30('0x1a')](_0x540927['interactionsTags'],'it',_0x4b30('0x1f')+_0x43bc2+_0x4b30('0x20'))[_0x4b30('0x1a')]('tools_tags','t',_0x4b30('0x21'));}function getSqlClauses(){var _0x57b368={'body':squel[_0x4b30('0x22')](),'contact':squel[_0x4b30('0x22')](),'default':squel[_0x4b30('0x22')](),'fields':squel[_0x4b30('0x22')](),'filter':squel[_0x4b30('0x22')](),'read':squel[_0x4b30('0x22')](),'tags':{'clause':squel[_0x4b30('0x22')](),'ids':null},'user':squel['expr']()};return _0x57b368;}function parseTagParameter(_0x1fe7a9){var _0x58187c=squel['expr']();if(_0x1fe7a9){var _0x142150=utils['getSelectedTags'](_0x1fe7a9);_0x142150['forEach'](function(_0x3aac2d){_0x58187c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3aac2d+',%');});}return _0x58187c;}function parseReadParameter(_0x341e4f){var _0x1c963d='';if(_0x341e4f){_0x1c963d=_0x4b30('0x23');if(_0x341e4f==='1'){_0x1c963d=_0x1c963d[_0x4b30('0x24')](_0x4b30('0x25'),'=');}else{_0x1c963d=_0x1c963d['replace'](_0x4b30('0x25'),'>');}}return _0x1c963d;}function parseSearchFilter(_0x20abad,_0x2e58a0){var _0x13b896=squel[_0x4b30('0x22')]();if(_0x2e58a0){var _0x23158c=_0x2e58a0[_0x4b30('0x24')]('\x5c','\x5c\x5c')[_0x4b30('0x24')](/'/g,'\x27\x27');if(qs[_0x4b30('0x26')](_0x23158c)){_0x13b896['or'](_0x4b30('0x27'),_0x23158c+'%');if([_0x4b30('0x28'),'whatsapp'][_0x4b30('0x29')](_0x20abad)){_0x13b896['or'](_0x4b30('0x2a'),_0x23158c+'%');}else if(_0x20abad===_0x4b30('0x2b')){_0x13b896['or'](_0x4b30('0x2c'),_0x23158c+'%');}else if(_0x20abad===_0x4b30('0x2d')){_0x13b896['or'](_0x4b30('0x2e'),_0x23158c+'%');}}else if(_0x20abad===_0x4b30('0x2f')&&qs[_0x4b30('0x30')](_0x23158c)){_0x13b896['or'](_0x4b30('0x31'),_0x23158c+'%');}else{if(_0x20abad===_0x4b30('0x2f')){_0x13b896['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x23158c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4b30('0x32')](_0x23158c));}else if(_0x20abad!=='fax'){_0x13b896['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4b30('0x32')](_0x23158c));}_0x13b896['or'](_0x4b30('0x33'),qs[_0x4b30('0x32')](_0x23158c,!![]),null);}}return _0x13b896;}function parseAdvancedSearchFilter(_0x49b8bb,_0x5cb09c){var _0x4381be=getSqlClauses();var _0x3fdf97=as[_0x4b30('0x34')](_0x49b8bb);var _0x54783d=_0x3fdf97[_0x4b30('0x35')];for(var _0x249e38=0x0;_0x249e38<_0x3fdf97['conditions'][_0x4b30('0x12')];_0x249e38++){var _0x238c64=_0x3fdf97['conditions'][_0x249e38];var _0x466d9c='i';var _0x3a3d1a=_['find'](_0x5cb09c,[_0x4b30('0x36'),_0x238c64['field']]);if(_0x3a3d1a){var _0x5e080c=as['buildExpression'](_0x466d9c,_0x3a3d1a[_0x4b30('0x37')],_0x238c64);_0x4381be[_0x4b30('0x38')][_0x54783d](_0x5e080c[_0x4b30('0x39')],_0x5e080c[_0x4b30('0x3a')][_0x4b30('0x3b')],_0x5e080c[_0x4b30('0x3a')][_0x4b30('0x3c')]);}else{switch(_0x238c64[_0x4b30('0x9')]){case'unreadMessages':var _0x13303c=parseReadParameter(_0x238c64[_0x4b30('0x3a')]);_0x4381be[_0x4b30('0x3d')]['and'](_0x13303c);break;case'Contact':if(_0x238c64[_0x4b30('0x3e')]==='$substring'){if(_0x238c64[_0x4b30('0x3a')][_0x4b30('0x3f')]('\x20')['length']>0x1){_0x4381be[_0x4b30('0x40')][_0x54783d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4b30('0x32')](_0x238c64[_0x4b30('0x3a')],!![]),null);}else{var _0x3a355d='%'+_0x238c64[_0x4b30('0x3a')]+'%';_0x4381be[_0x4b30('0x40')][_0x54783d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3a355d,_0x3a355d,_0x3a355d);}}else{_0x3a3d1a=_[_0x4b30('0x41')](_0x5cb09c,['name','ContactId']);_0x238c64[_0x4b30('0x9')]='ContactId';_0x5e080c=as[_0x4b30('0x42')](_0x466d9c,_0x3a3d1a[_0x4b30('0x37')],_0x238c64);_0x4381be['contact'][_0x54783d](_0x5e080c[_0x4b30('0x39')],_0x5e080c[_0x4b30('0x3a')][_0x4b30('0x3b')],_0x5e080c[_0x4b30('0x3a')][_0x4b30('0x3c')]);}break;case _0x4b30('0x43'):var _0x1eeb9e=_0x238c64['value'][_0x4b30('0x3f')](',')[_0x4b30('0x44')](function(_0x5db08e){return Number(_0x5db08e);});var _0xc431a4=parseTagParameter(_0x1eeb9e);_0x4381be['tags'][_0x4b30('0x45')][_0x4b30('0x46')](_0xc431a4);_0x4381be['tags'][_0x4b30('0x47')]=_0x1eeb9e;break;case'User':if(_0x238c64[_0x4b30('0x3e')]===_0x4b30('0x48')){_0x4381be[_0x4b30('0x49')][_0x54783d](_0x4b30('0x4a'),'%'+_0x238c64[_0x4b30('0x3a')]+'%',null);}else{_0x3a3d1a=_[_0x4b30('0x41')](_0x5cb09c,[_0x4b30('0x36'),'UserId']);_0x238c64[_0x4b30('0x9')]=_0x4b30('0x4b');_0x5e080c=as[_0x4b30('0x42')](_0x466d9c,_0x3a3d1a[_0x4b30('0x37')],_0x238c64);_0x4381be[_0x4b30('0x49')][_0x54783d](_0x5e080c[_0x4b30('0x39')],_0x5e080c[_0x4b30('0x3a')][_0x4b30('0x3b')],_0x5e080c[_0x4b30('0x3a')]['end']);}break;case _0x4b30('0x4c'):case _0x4b30('0x4d'):_0x5e080c=as[_0x4b30('0x42')]('me',null,_0x238c64);_0x4381be['body'][_0x54783d](_0x5e080c[_0x4b30('0x39')],_0x5e080c[_0x4b30('0x3a')][_0x4b30('0x3b')],_0x5e080c[_0x4b30('0x3a')][_0x4b30('0x3c')]);break;}}}return _0x4381be;}function parseModelFields(_0x1b0597,_0x115df6,_0x55bb1){var _0x2c6f63=utils[_0x4b30('0x6')](_0x1b0597);var _0x540575=squel['expr']();var _0x5a8bb9=_(_0x115df6)['keys']()[_0x4b30('0x44')](function(_0x1e13e3){return _[_0x4b30('0x4e')](_0x55bb1,['name',_0x1e13e3])?_0x1e13e3:undefined;})['compact']()[_0x4b30('0x3a')]();if(_0x5a8bb9[_0x4b30('0x12')]>0x0){_0x5a8bb9[_0x4b30('0x4f')](function(_0x481556){if(_0x481556===_0x2c6f63){_0x540575[_0x4b30('0x46')]('i.'+_0x2c6f63+'\x20IN\x20?',[][_0x4b30('0x50')](_0x115df6[_0x481556]));}else if(_0x481556===_0x4b30('0x51')){var _0x4ca410=JSON['parse'](_0x115df6[_0x481556])[_0x4b30('0x52')];var _0x118a7c=JSON[_0x4b30('0x53')](_0x115df6[_0x481556])[_0x4b30('0x54')];_0x540575[_0x4b30('0x46')](_0x4b30('0x55'),_0x4ca410,_0x118a7c);}else{if(_0x115df6[_0x481556]===_0x4b30('0x56')){_0x540575['and']('i.'+_0x481556+_0x4b30('0x57'));}else{_0x540575[_0x4b30('0x46')]('i.'+_0x481556+_0x4b30('0x58'),_0x115df6[_0x481556]);}}});}return _0x540575;}function parseQueryParameters(_0x3e7a79,_0xb6d9c1,_0x40b1e7){var _0x53e2e5=getSqlClauses();return Promise['resolve']()[_0x4b30('0x59')](function(){return parseModelFields(_0x3e7a79,_0xb6d9c1,_0x40b1e7);})['then'](function(_0x18003c){_0x53e2e5[_0x4b30('0x5a')][_0x4b30('0x46')](_0x18003c);return parseReadParameter(_0xb6d9c1[_0x4b30('0x3d')]);})[_0x4b30('0x59')](function(_0x53c0d6){_0x53e2e5[_0x4b30('0x3d')][_0x4b30('0x46')](_0x53c0d6);return parseTagParameter(_0xb6d9c1[_0x4b30('0x5b')]);})[_0x4b30('0x59')](function(_0xe54114){_0x53e2e5['tags'][_0x4b30('0x45')][_0x4b30('0x46')](_0xe54114);return parseSearchFilter(_0x3e7a79,_0xb6d9c1[_0x4b30('0x5c')]);})['then'](function(_0x3989b8){_0x53e2e5[_0x4b30('0x5c')]=_0x3989b8;return _0x53e2e5;});}function checkAccountsRestrictions(_0x41b551,_0x1ae183,_0x3e57c8){var _0xc09fc4=utils[_0x4b30('0x6')](_0x41b551);var _0x5c307f='get'+_[_0x4b30('0x5d')](_0x41b551)+(_0x41b551===_0x4b30('0x5e')?_0x4b30('0x5f'):_0x4b30('0x60'));var _0x2db7e4=squel[_0x4b30('0x22')]();return Promise[_0x4b30('0x61')]()[_0x4b30('0x59')](function(){if(_0x3e57c8['search']&&_0x1ae183['role']===_0x4b30('0x7')){return _0x1ae183[_0x5c307f]({'attributes':['id'],'raw':!![]});}})[_0x4b30('0x59')](function(_0x521769){if(_0x521769){if(_0x521769[_0x4b30('0x12')]===0x0){_0x2db7e4['and']('i.'+_0xc09fc4+_0x4b30('0x57'));}else{_0x2db7e4[_0x4b30('0x46')]('i.'+_0xc09fc4+_0x4b30('0x14'),_[_0x4b30('0x44')](_0x521769,'id'));}}else if(!_0x3e57c8[_0xc09fc4]){_0x2db7e4['and']('i.'+_0xc09fc4+_0x4b30('0x62'));}})['then'](function(){return _0x2db7e4;});}function getClosedOrderClause(_0x1a618b,_0x3e42a8){var _0x2130d6='';var _0xd2d167=[_0x4b30('0x63'),_0x4b30('0x64'),'i.disposition'];if(_0x1a618b===_0x4b30('0x2f')){_0xd2d167[_0x4b30('0x65')](_0x4b30('0x66'));}if(_0x3e42a8[_0x4b30('0x67')]==='0'&&_0x1a618b===_0x4b30('0x2f')){_0x2130d6=_0x4b30('0x66');}else{if(_0x3e42a8[_0x4b30('0x67')]==='1'){_0xd2d167[_0x4b30('0x68')]();}_0x2130d6=_0x4b30('0x69')+_0xd2d167[_0x4b30('0x6a')](',\x20')+')';}return _0x2130d6;}function getFilteredInteractions(_0x5a1182,_0x5b393d,_0x96d55c,_0x2fe47a){var _0x88e444=utils[_0x4b30('0xc')](_0x5a1182);var _0x5f2203=_[_0x4b30('0x5d')](_0x5a1182)+_0x4b30('0x6b');var _0x1b9c40=[];var _0x25a795=getTagsQuery();var _0x5b8891={'type':db[_0x4b30('0x6c')][_0x4b30('0x6d')][_0x4b30('0x6e')],'raw':!![]};var _0x18dca6=[];var _0x29c3a2=[];return db[_0x4b30('0x6f')]['query'](_0x25a795[_0x4b30('0x70')](),_0x5b8891)[_0x4b30('0x59')](function(_0x4ba9f1){_0x1b9c40=_['keyBy'](_0x4ba9f1,'id');_0x5b8891=_[_0x4b30('0x71')](_0x5b8891,{'model':db[_0x5f2203],'mapToModel':!![],'nest':!![]});if(_0x96d55c['fields']){_0x2fe47a[_0x4b30('0x72')]['forEach'](function(_0x1897de){_0x5b393d[_0x4b30('0x9')]('i.'+_0x1897de);});}else{_0x5b393d[_0x4b30('0x9')](_0x4b30('0x73'),'unreadMessages');_0x5b393d[_0x4b30('0x9')](_0x4b30('0x74'),_0x4b30('0x75'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x76'),'Account.mandatoryDisposition');if(_0x5a1182===_0x4b30('0x2f')){_0x5b393d[_0x4b30('0x9')](_0x4b30('0x77'),_0x4b30('0x78'));_0x5b393d[_0x4b30('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5b393d[_0x4b30('0x9')](_0x4b30('0x79'));_0x5b393d['field'](_0x4b30('0x7a'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x7b'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x7c'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x7d'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x7e'));_0x5b393d['field'](_0x4b30('0x7f'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x80'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x81'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x82'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x64'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x63'));_0x5b393d[_0x4b30('0x9')]('i.substatus');_0x5b393d[_0x4b30('0x9')](_0x4b30('0x83'));_0x5b393d['field'](_0x4b30('0x84'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x85'));_0x5b393d[_0x4b30('0x9')]('i.UserId');}else if(_0x5a1182===_0x4b30('0x2d')){_0x5b393d[_0x4b30('0x9')]('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',_0x4b30('0x86'));}else{_0x5b393d[_0x4b30('0x9')](_0x4b30('0x87'),_0x4b30('0x86'));}if(_0x5a1182!==_0x4b30('0x2f')){_0x5b393d['field'](_0x4b30('0x88'));}_0x5b393d[_0x4b30('0x9')]('c.firstName','Contact.firstName');_0x5b393d[_0x4b30('0x9')](_0x4b30('0x89'),'Contact.lastName');_0x5b393d[_0x4b30('0x9')](_0x4b30('0x8a'),'Contact.email');_0x5b393d[_0x4b30('0x9')]('c.phone',_0x4b30('0x8b'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x8c'),_0x4b30('0x8d'));_0x5b393d[_0x4b30('0x9')](_0x4b30('0x8e'),_0x4b30('0x8f'));_0x5b393d['field'](_0x4b30('0x90'),_0x4b30('0x91'));_0x5b393d['field'](_0x4b30('0x92'),'Owner.internal');_0x5b393d['field'](_0x4b30('0x93'),'TagIds');}if(_0x2fe47a[_0x4b30('0x94')]){_0x5b393d[_0x4b30('0x94')](_0x2fe47a['limit']);}if(_0x2fe47a['offset']){_0x5b393d[_0x4b30('0x95')](_0x2fe47a[_0x4b30('0x95')]);}return db['sequelize']['query'](_0x5b393d[_0x4b30('0x70')](),_0x5b8891);})[_0x4b30('0x59')](function(_0x36a93c){_0x18dca6=_0x36a93c;var _0x4005be=getUsersQuery(_0x5a1182,_0x18dca6);return db[_0x4b30('0x6f')][_0x4b30('0x96')](_0x4005be['toString'](),_0x5b8891);})[_0x4b30('0x59')](function(_0x15a570){_0x29c3a2=_[_0x4b30('0x97')](_0x15a570,_0x88e444);if(_0x5a1182===_0x4b30('0x2f')){return db[_0x4b30('0x98')][_0x4b30('0x99')]({'attributes':[_0x4b30('0x9a')],'raw':!![]});}})['then'](function(_0x13e295){var _0x72ca36=_0x13e295?_0x13e295[_0x4b30('0x9a')]:undefined;var _0x4f9bf8=_0x18dca6[_0x4b30('0x44')](function(_0x4e8179){return updateInteraction(_0x4e8179,_0x1b9c40,_0x29c3a2,_0x72ca36);});return Promise['all'](_0x4f9bf8);});}function countFilteredInteractions(_0x351bb7,_0x486f45){var _0x2f9c4c=_0x351bb7[_0x4b30('0x9b')]();_0x2f9c4c[_0x4b30('0x9')](_0x4b30('0x9c'));_0x2f9c4c[_0x4b30('0x9')](_0x4b30('0x73'),'unreadMessages');var _0x5a4789=utils[_0x4b30('0x9d')](_0x486f45);if(!_[_0x4b30('0x9e')](_0x5a4789)){_0x2f9c4c[_0x4b30('0x13')]('t.id\x20IN\x20?',_0x5a4789);}var _0x22b346={'type':db[_0x4b30('0x6c')][_0x4b30('0x6d')][_0x4b30('0x6e')],'raw':!![]};return db[_0x4b30('0x6f')][_0x4b30('0x96')](_0x2f9c4c[_0x4b30('0x70')](),_0x22b346);}module[_0x4b30('0x9f')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x6ecb=['replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\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','length','conditions','type','default','value','start','end','unreadMessages','read','and','Contact','operator','split','contact','ContactId','buildExpression','Tag','tags','clause','ids','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','keys','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','Accounts','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','capitalize','Sequelize','QueryTypes','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','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','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.*','Contact.firstName','c.lastName','c.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','where','t.id\x20IN\x20?','SELECT','exports','lodash','../parsers/advancedSearch','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','name','field','color','tools_tags','user_has_','_interactions','select','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','\x20IN\x20?','map','getInteractionFK','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','unreadMessages\x20{OPERATOR}\x200'];(function(_0x16f06e,_0x1e380d){var _0xc5f54d=function(_0x59f8a9){while(--_0x59f8a9){_0x16f06e['push'](_0x16f06e['shift']());}};_0xc5f54d(++_0x1e380d);}(_0x6ecb,0x7e));var _0xb6ec=function(_0x3e2a18,_0x3029dd){_0x3e2a18=_0x3e2a18-0x0;var _0x6ce6ba=_0x6ecb[_0x3e2a18];return _0x6ce6ba;};'use strict';var _=require(_0xb6ec('0x0'));var squel=require('squel');var as=require(_0xb6ec('0x1'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0xb6ec('0x2')];var utils=require(_0xb6ec('0x3'));var db=require(_0xb6ec('0x4'))['db'];function skipInteractionsQuery(_0x7bf25c,_0xba8ca7,_0x3aae18){var _0x4c6555=![];var _0x34b4c0=utils[_0xb6ec('0x5')](_0x7bf25c);if(_0xba8ca7[_0xb6ec('0x6')]===_0xb6ec('0x7')&&!_0x3aae18[_0xb6ec('0x8')]&&!_0x3aae18[_0x34b4c0]){_0x4c6555=!![];}return _0x4c6555;}function getTagsQuery(){return squel['select']()['field']('id')['field'](_0xb6ec('0x9'))[_0xb6ec('0xa')](_0xb6ec('0xb'))['from'](_0xb6ec('0xc'));}function getUsersQuery(_0x215665,_0x34e109){var _0x10ab97=utils['getInteractionFK'](_0x215665);var _0x16fe84=_0xb6ec('0xd')+_0x215665+_0xb6ec('0xe');var _0x3944dd=squel[_0xb6ec('0xf')]()['field'](_0xb6ec('0x10'))[_0xb6ec('0xa')](_0xb6ec('0x11'))[_0xb6ec('0xa')](_0xb6ec('0x12')+_0x10ab97)[_0xb6ec('0x13')](_0x16fe84,'ui')[_0xb6ec('0x14')](_0xb6ec('0x15'),'u',_0xb6ec('0x16'));if(_0x34e109['length']>0x0){_0x3944dd['where'](_0xb6ec('0x12')+_0x10ab97+_0xb6ec('0x17'),_[_0xb6ec('0x18')](_0x34e109,'id'));}return _0x3944dd;}function getInteractionsQuery(_0x5bbb02){var _0x53837f=utils['getInteractionsTables'](_0x5bbb02);var _0x3983b8=utils[_0xb6ec('0x5')](_0x5bbb02);var _0x297c48=utils[_0xb6ec('0x19')](_0x5bbb02);return squel[_0xb6ec('0xf')]()[_0xb6ec('0x13')](_0x53837f['interactions'],'i')[_0xb6ec('0x14')](_0xb6ec('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb6ec('0x14')](_0xb6ec('0x15'),'o',_0xb6ec('0x1b'))['left_join'](_0x53837f[_0xb6ec('0x1c')],'a',_0xb6ec('0x1d')+_0x3983b8)[_0xb6ec('0x14')](_0x53837f[_0xb6ec('0x1e')],'me','me.'+_0x297c48+_0xb6ec('0x1f'))[_0xb6ec('0x14')](_0x53837f[_0xb6ec('0x20')],'it',_0xb6ec('0x21')+_0x297c48+'\x20=\x20i.id')[_0xb6ec('0x14')](_0xb6ec('0xc'),'t',_0xb6ec('0x22'));}function getSqlClauses(){var _0x403d8d={'body':squel[_0xb6ec('0x23')](),'contact':squel['expr'](),'default':squel[_0xb6ec('0x23')](),'fields':squel[_0xb6ec('0x23')](),'filter':squel['expr'](),'read':squel[_0xb6ec('0x23')](),'tags':{'clause':squel[_0xb6ec('0x23')](),'ids':null},'user':squel[_0xb6ec('0x23')]()};return _0x403d8d;}function parseTagParameter(_0x566e68){var _0x362ecd=squel[_0xb6ec('0x23')]();if(_0x566e68){var _0x175de5=utils['getSelectedTags'](_0x566e68);_0x175de5[_0xb6ec('0x24')](function(_0x2855a0){_0x362ecd['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2855a0+',%');});}return _0x362ecd;}function parseReadParameter(_0x3c701c){var _0xe8d8a3='';if(_0x3c701c){_0xe8d8a3=_0xb6ec('0x25');if(_0x3c701c==='1'){_0xe8d8a3=_0xe8d8a3[_0xb6ec('0x26')](_0xb6ec('0x27'),'=');}else{_0xe8d8a3=_0xe8d8a3[_0xb6ec('0x26')](_0xb6ec('0x27'),'>');}}return _0xe8d8a3;}function parseSearchFilter(_0x21e4fe,_0x4d8eb6){var _0x22d61d=squel[_0xb6ec('0x23')]();if(_0x4d8eb6){var _0x5e5fd7=_0x4d8eb6[_0xb6ec('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb6ec('0x28')](_0x5e5fd7)){_0x22d61d['or']('i.id\x20LIKE\x20?',_0x5e5fd7+'%');if([_0xb6ec('0x29'),_0xb6ec('0x2a')][_0xb6ec('0x2b')](_0x21e4fe)){_0x22d61d['or'](_0xb6ec('0x2c'),_0x5e5fd7+'%');}else if(_0x21e4fe===_0xb6ec('0x2d')){_0x22d61d['or'](_0xb6ec('0x2e'),_0x5e5fd7+'%');}else if(_0x21e4fe===_0xb6ec('0x2f')){_0x22d61d['or'](_0xb6ec('0x30'),_0x5e5fd7+'%');}}else if(_0x21e4fe==='mail'&&qs[_0xb6ec('0x31')](_0x5e5fd7)){_0x22d61d['or'](_0xb6ec('0x32'),_0x5e5fd7+'%');}else{if(_0x21e4fe===_0xb6ec('0x33')){_0x22d61d['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb6ec('0x34')](_0x5e5fd7,!![]))['or'](_0xb6ec('0x35'),qs['getFullTextValue'](_0x5e5fd7));}else if(_0x21e4fe!==_0xb6ec('0x2d')){_0x22d61d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb6ec('0x34')](_0x5e5fd7));}_0x22d61d['or'](_0xb6ec('0x36'),qs[_0xb6ec('0x34')](_0x5e5fd7,!![]),null);}}return _0x22d61d;}function parseAdvancedSearchFilter(_0x1d2cf0,_0x2b14f5){var _0x46def0=getSqlClauses();var _0x21c66d=as[_0xb6ec('0x37')](_0x1d2cf0);var _0x4ed43a=_0x21c66d['sqlOperator'];for(var _0x2dfff3=0x0;_0x2dfff3<_0x21c66d['conditions'][_0xb6ec('0x38')];_0x2dfff3++){var _0x2effa4=_0x21c66d[_0xb6ec('0x39')][_0x2dfff3];var _0xbe827b='i';var _0x1baf0d=_['find'](_0x2b14f5,[_0xb6ec('0x9'),_0x2effa4[_0xb6ec('0xa')]]);if(_0x1baf0d){var _0x16bbea=as['buildExpression'](_0xbe827b,_0x1baf0d[_0xb6ec('0x3a')],_0x2effa4);_0x46def0[_0xb6ec('0x3b')][_0x4ed43a](_0x16bbea['text'],_0x16bbea[_0xb6ec('0x3c')][_0xb6ec('0x3d')],_0x16bbea[_0xb6ec('0x3c')][_0xb6ec('0x3e')]);}else{switch(_0x2effa4[_0xb6ec('0xa')]){case _0xb6ec('0x3f'):var _0x5b2f44=parseReadParameter(_0x2effa4[_0xb6ec('0x3c')]);_0x46def0[_0xb6ec('0x40')][_0xb6ec('0x41')](_0x5b2f44);break;case _0xb6ec('0x42'):if(_0x2effa4[_0xb6ec('0x43')]==='$substring'){if(_0x2effa4[_0xb6ec('0x3c')][_0xb6ec('0x44')]('\x20')[_0xb6ec('0x38')]>0x1){_0x46def0[_0xb6ec('0x45')][_0x4ed43a](_0xb6ec('0x36'),qs['getFullTextValue'](_0x2effa4[_0xb6ec('0x3c')],!![]),null);}else{var _0x1137c4='%'+_0x2effa4[_0xb6ec('0x3c')]+'%';_0x46def0['contact'][_0x4ed43a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1137c4,_0x1137c4,_0x1137c4);}}else{_0x1baf0d=_['find'](_0x2b14f5,[_0xb6ec('0x9'),_0xb6ec('0x46')]);_0x2effa4[_0xb6ec('0xa')]='ContactId';_0x16bbea=as[_0xb6ec('0x47')](_0xbe827b,_0x1baf0d['type'],_0x2effa4);_0x46def0[_0xb6ec('0x45')][_0x4ed43a](_0x16bbea['text'],_0x16bbea[_0xb6ec('0x3c')][_0xb6ec('0x3d')],_0x16bbea[_0xb6ec('0x3c')]['end']);}break;case _0xb6ec('0x48'):var _0x241101=_0x2effa4[_0xb6ec('0x3c')][_0xb6ec('0x44')](',')[_0xb6ec('0x18')](function(_0x45018d){return Number(_0x45018d);});var _0x2fb999=parseTagParameter(_0x241101);_0x46def0[_0xb6ec('0x49')][_0xb6ec('0x4a')]['and'](_0x2fb999);_0x46def0[_0xb6ec('0x49')][_0xb6ec('0x4b')]=_0x241101;break;case _0xb6ec('0x4c'):if(_0x2effa4['operator']===_0xb6ec('0x4d')){_0x46def0[_0xb6ec('0x4e')][_0x4ed43a](_0xb6ec('0x4f'),'%'+_0x2effa4[_0xb6ec('0x3c')]+'%',null);}else{_0x1baf0d=_['find'](_0x2b14f5,[_0xb6ec('0x9'),_0xb6ec('0x50')]);_0x2effa4[_0xb6ec('0xa')]=_0xb6ec('0x50');_0x16bbea=as['buildExpression'](_0xbe827b,_0x1baf0d[_0xb6ec('0x3a')],_0x2effa4);_0x46def0[_0xb6ec('0x4e')][_0x4ed43a](_0x16bbea['text'],_0x16bbea[_0xb6ec('0x3c')][_0xb6ec('0x3d')],_0x16bbea['value'][_0xb6ec('0x3e')]);}break;case'body':case _0xb6ec('0x51'):_0x16bbea=as['buildExpression']('me',null,_0x2effa4);_0x46def0['body'][_0x4ed43a](_0x16bbea['text'],_0x16bbea['value'][_0xb6ec('0x3d')],_0x16bbea[_0xb6ec('0x3c')][_0xb6ec('0x3e')]);break;}}}return _0x46def0;}function parseModelFields(_0x1577d4,_0x4bf01d,_0x21f19a){var _0x4d7c16=utils[_0xb6ec('0x5')](_0x1577d4);var _0x2f58b9=squel['expr']();var _0x5807ab=_(_0x4bf01d)[_0xb6ec('0x52')]()[_0xb6ec('0x18')](function(_0x527f4e){return _['some'](_0x21f19a,['name',_0x527f4e])?_0x527f4e:undefined;})[_0xb6ec('0x53')]()[_0xb6ec('0x3c')]();if(_0x5807ab[_0xb6ec('0x38')]>0x0){_0x5807ab[_0xb6ec('0x24')](function(_0x1b0ad0){if(_0x1b0ad0===_0x4d7c16){_0x2f58b9[_0xb6ec('0x41')]('i.'+_0x4d7c16+'\x20IN\x20?',[][_0xb6ec('0x54')](_0x4bf01d[_0x1b0ad0]));}else if(_0x1b0ad0===_0xb6ec('0x55')){var _0x1f4d17=JSON[_0xb6ec('0x56')](_0x4bf01d[_0x1b0ad0])['$gte'];var _0x2c3e18=JSON[_0xb6ec('0x56')](_0x4bf01d[_0x1b0ad0])[_0xb6ec('0x57')];_0x2f58b9['and'](_0xb6ec('0x58'),_0x1f4d17,_0x2c3e18);}else{if(_0x4bf01d[_0x1b0ad0]===_0xb6ec('0x59')){_0x2f58b9[_0xb6ec('0x41')]('i.'+_0x1b0ad0+_0xb6ec('0x5a'));}else{_0x2f58b9['and']('i.'+_0x1b0ad0+_0xb6ec('0x5b'),_0x4bf01d[_0x1b0ad0]);}}});}return _0x2f58b9;}function parseQueryParameters(_0x1a1d2b,_0x4c9093,_0x5bb789){var _0x275064=getSqlClauses();return Promise[_0xb6ec('0x5c')]()[_0xb6ec('0x5d')](function(){return parseModelFields(_0x1a1d2b,_0x4c9093,_0x5bb789);})[_0xb6ec('0x5d')](function(_0x14edd8){_0x275064[_0xb6ec('0x5e')][_0xb6ec('0x41')](_0x14edd8);return parseReadParameter(_0x4c9093['read']);})['then'](function(_0x308b51){_0x275064[_0xb6ec('0x40')]['and'](_0x308b51);return parseTagParameter(_0x4c9093[_0xb6ec('0x5f')]);})['then'](function(_0x3989fd){_0x275064[_0xb6ec('0x49')]['clause']['and'](_0x3989fd);return parseSearchFilter(_0x1a1d2b,_0x4c9093[_0xb6ec('0x60')]);})[_0xb6ec('0x5d')](function(_0x278a2a){_0x275064[_0xb6ec('0x60')]=_0x278a2a;return _0x275064;});}function checkAccountsRestrictions(_0xf3165f,_0x1ea1e2,_0x31f63c){var _0xd063fe=utils[_0xb6ec('0x5')](_0xf3165f);var _0x37e72e=_0xb6ec('0x61')+_['capitalize'](_0xf3165f)+(_0xf3165f==='chat'?'Websites':_0xb6ec('0x62'));var _0x323108=squel[_0xb6ec('0x23')]();return Promise['resolve']()[_0xb6ec('0x5d')](function(){if(_0x31f63c[_0xb6ec('0x8')]&&_0x1ea1e2[_0xb6ec('0x6')]===_0xb6ec('0x7')){return _0x1ea1e2[_0x37e72e]({'attributes':['id'],'raw':!![]});}})[_0xb6ec('0x5d')](function(_0x32cfdf){if(_0x32cfdf){if(_0x32cfdf[_0xb6ec('0x38')]===0x0){_0x323108[_0xb6ec('0x41')]('i.'+_0xd063fe+'\x20IS\x20NULL');}else{_0x323108[_0xb6ec('0x41')]('i.'+_0xd063fe+_0xb6ec('0x17'),_[_0xb6ec('0x18')](_0x32cfdf,'id'));}}else if(!_0x31f63c[_0xd063fe]){_0x323108[_0xb6ec('0x41')]('i.'+_0xd063fe+'\x20IS\x20NOT\x20NULL');}})[_0xb6ec('0x5d')](function(){return _0x323108;});}function getClosedOrderClause(_0x41de7e,_0x221d6e){var _0x540fb7='';var _0x25df80=[_0xb6ec('0x63'),_0xb6ec('0x64'),_0xb6ec('0x65')];if(_0x41de7e===_0xb6ec('0x33')){_0x25df80[_0xb6ec('0x66')](_0xb6ec('0x67'));}if(_0x221d6e[_0xb6ec('0x68')]==='0'&&_0x41de7e===_0xb6ec('0x33')){_0x540fb7=_0xb6ec('0x67');}else{if(_0x221d6e[_0xb6ec('0x68')]==='1'){_0x25df80[_0xb6ec('0x69')]();}_0x540fb7='CONCAT_WS(\x27\x27,\x20'+_0x25df80[_0xb6ec('0x6a')](',\x20')+')';}return _0x540fb7;}function getFilteredInteractions(_0xab2f4e,_0x9405a5,_0xdfb5da,_0xe686dc){var _0x11417f=utils[_0xb6ec('0x19')](_0xab2f4e);var _0x3802c3=_[_0xb6ec('0x6b')](_0xab2f4e)+'Interaction';var _0x371c88=[];var _0x1cfd5a=getTagsQuery();var _0x543d05={'type':db[_0xb6ec('0x6c')][_0xb6ec('0x6d')]['SELECT'],'raw':!![]};var _0x342d0f=[];var _0x214a6d=[];return db[_0xb6ec('0x6e')][_0xb6ec('0x6f')](_0x1cfd5a[_0xb6ec('0x70')](),_0x543d05)[_0xb6ec('0x5d')](function(_0x59a28b){_0x371c88=_[_0xb6ec('0x71')](_0x59a28b,'id');_0x543d05=_[_0xb6ec('0x72')](_0x543d05,{'model':db[_0x3802c3],'mapToModel':!![],'nest':!![]});if(_0xdfb5da[_0xb6ec('0x5e')]){_0xe686dc[_0xb6ec('0x73')]['forEach'](function(_0x13b555){_0x9405a5['field']('i.'+_0x13b555);});}else{_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x74'),_0xb6ec('0x3f'));_0x9405a5['field'](_0xb6ec('0x75'),_0xb6ec('0x76'));_0x9405a5[_0xb6ec('0xa')]('a.mandatoryDisposition',_0xb6ec('0x77'));if(_0xab2f4e===_0xb6ec('0x33')){_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x78'),_0xb6ec('0x79'));_0x9405a5[_0xb6ec('0xa')]('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',_0xb6ec('0x7a'));_0x9405a5['field'](_0xb6ec('0x7b'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x7c'));_0x9405a5['field'](_0xb6ec('0x7d'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x7e'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x7f'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x80'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x81'));_0x9405a5['field'](_0xb6ec('0x82'));_0x9405a5['field'](_0xb6ec('0x83'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x65'));_0x9405a5['field'](_0xb6ec('0x64'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x63'));_0x9405a5[_0xb6ec('0xa')]('i.substatus');_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x84'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x85'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x86'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x87'));}else if(_0xab2f4e==='openchannel'){_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x88'),_0xb6ec('0x7a'));}else{_0x9405a5['field'](_0xb6ec('0x89'),'contactName');}if(_0xab2f4e!=='mail'){_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x8a'));}_0x9405a5['field']('c.firstName',_0xb6ec('0x8b'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x8c'),'Contact.lastName');_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x8d'),'Contact.email');_0x9405a5[_0xb6ec('0xa')]('c.phone',_0xb6ec('0x8e'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x8f'),'Contact.mobile');_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x90'),_0xb6ec('0x91'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x92'),'Owner.fullname');_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x93'),_0xb6ec('0x94'));_0x9405a5[_0xb6ec('0xa')](_0xb6ec('0x95'),_0xb6ec('0x96'));}if(_0xe686dc[_0xb6ec('0x97')]){_0x9405a5['limit'](_0xe686dc[_0xb6ec('0x97')]);}if(_0xe686dc[_0xb6ec('0x98')]){_0x9405a5[_0xb6ec('0x98')](_0xe686dc[_0xb6ec('0x98')]);}return db['sequelize'][_0xb6ec('0x6f')](_0x9405a5[_0xb6ec('0x70')](),_0x543d05);})[_0xb6ec('0x5d')](function(_0x27f2d8){_0x342d0f=_0x27f2d8;var _0xd132bb=getUsersQuery(_0xab2f4e,_0x342d0f);return db[_0xb6ec('0x6e')][_0xb6ec('0x6f')](_0xd132bb[_0xb6ec('0x70')](),_0x543d05);})[_0xb6ec('0x5d')](function(_0x57e22c){_0x214a6d=_['groupBy'](_0x57e22c,_0x11417f);if(_0xab2f4e===_0xb6ec('0x33')){return db[_0xb6ec('0x99')]['findOne']({'attributes':[_0xb6ec('0x9a')],'raw':!![]});}})[_0xb6ec('0x5d')](function(_0x104892){var _0x589e0b=_0x104892?_0x104892[_0xb6ec('0x9a')]:undefined;var _0x2ebf56=_0x342d0f[_0xb6ec('0x18')](function(_0x35ed75){return updateInteraction(_0x35ed75,_0x371c88,_0x214a6d,_0x589e0b);});return Promise[_0xb6ec('0x9b')](_0x2ebf56);});}function countFilteredInteractions(_0x3d4749,_0x5b2c68){var _0x2cb0b9=_0x3d4749[_0xb6ec('0x9c')]();_0x2cb0b9[_0xb6ec('0xa')](_0xb6ec('0x9d'));_0x2cb0b9[_0xb6ec('0xa')](_0xb6ec('0x74'),'unreadMessages');var _0x2e1d94=utils[_0xb6ec('0x9e')](_0x5b2c68);if(!_[_0xb6ec('0x9f')](_0x2e1d94)){_0x2cb0b9[_0xb6ec('0xa0')](_0xb6ec('0xa1'),_0x2e1d94);}var _0x16bd86={'type':db[_0xb6ec('0x6c')][_0xb6ec('0x6d')][_0xb6ec('0xa2')],'raw':!![]};return db[_0xb6ec('0x6e')][_0xb6ec('0x6f')](_0x2cb0b9[_0xb6ec('0x70')](),_0x16bd86);}module[_0xb6ec('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 e29abb9..815babd 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 _0x14a6=['catch','updateInteraction','then','Users','TagIds','Tags','lodash','map','fullname','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart'];(function(_0x4688bd,_0x2f7caa){var _0x388a80=function(_0x2bad55){while(--_0x2bad55){_0x4688bd['push'](_0x4688bd['shift']());}};_0x388a80(++_0x2f7caa);}(_0x14a6,0x124));var _0x614a=function(_0xd0448e,_0x2d3d92){_0xd0448e=_0xd0448e-0x0;var _0x3563cb=_0x14a6[_0xd0448e];return _0x3563cb;};'use strict';var _=require(_0x614a('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x47faca,_0x1036bc){return new Promise(function(_0x378ab1,_0x3124d1){try{var _0x50a13e=[];if(_0x1036bc[_0x47faca]){_0x50a13e=_0x1036bc[_0x47faca][_0x614a('0x1')](function(_0x33249c){return{'id':_0x33249c['id'],'fullname':_0x33249c[_0x614a('0x2')]};});}return _0x378ab1(_0x50a13e);}catch(_0x3db22b){_0x3124d1(_0x3db22b);}});}function getInteractionTags(_0x44437e,_0x2c70bb){var _0x41e240=[];if(_0x44437e){_0x44437e['split'](',')[_0x614a('0x3')](function(_0x4f8f9f){_0x41e240[_0x614a('0x4')](_0x2c70bb[_0x4f8f9f]);});}return _0x41e240;}function updateWaitingCounter(_0x15f036){if(_0x15f036[_0x614a('0x5')]){_0x15f036[_0x614a('0x5')]-=0x1;}}function updateInteractionCounters(_0x43e0e6){_0x43e0e6['waiting']=0x0;_0x43e0e6[_0x614a('0x6')]=0x0;_0x43e0e6[_0x614a('0x7')]=0x0;_0x43e0e6[_0x614a('0x8')]=0x0;_0x43e0e6[_0x614a('0x9')]=0x0;_0x43e0e6[_0x614a('0xa')]=0x0;if(_0x43e0e6[_0x614a('0xb')]){if(_0x43e0e6[_0x614a('0xc')]===_0x614a('0x9')){_0x43e0e6['abandoned']+=0x1;updateWaitingCounter(_0x43e0e6);}if(_0x43e0e6[_0x614a('0xd')]){_0x43e0e6[_0x614a('0x7')]+=0x1;if(_0x43e0e6[_0x614a('0x6')]){_0x43e0e6[_0x614a('0x6')]-=0x1;}}else{if(_0x43e0e6[_0x614a('0xc')]){_0x43e0e6['unmanaged']+=0x1;updateWaitingCounter(_0x43e0e6);}}}else{if(!_0x43e0e6[_0x614a('0xd')]){_0x43e0e6[_0x614a('0x5')]+=0x1;}if(_0x43e0e6[_0x614a('0xd')]){_0x43e0e6[_0x614a('0x6')]+=0x1;updateWaitingCounter(_0x43e0e6);}}_0x43e0e6[_0x614a('0xa')]+=0x1;return _0x43e0e6;}function getLastMessageText(_0x290355){return db[_0x614a('0xe')][_0x614a('0xf')]({'where':{'$and':[{'MailInteractionId':_0x290355['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x614a('0x10')],'order':_0x614a('0x11'),'raw':!![]})['then'](function(_0xd5911d){if(_0xd5911d&&_0xd5911d[_0x614a('0x10')]){_0x290355[_0x614a('0x12')]=_[_0x614a('0x13')](_0xd5911d[_0x614a('0x10')]);}return _0x290355;})[_0x614a('0x14')](function(_0x7d1875){throw _0x7d1875;});}exports[_0x614a('0x15')]=function(_0x1a6a5a,_0x1d633d,_0x3296b9,_0x4000d5){return new Promise(function(_0x2d8155,_0x58b699){return getInteractionUsers(_0x1a6a5a['id'],_0x3296b9)[_0x614a('0x16')](function(_0x54ea27){_0x1a6a5a[_0x614a('0x17')]=_0x54ea27;return getInteractionTags(_0x1a6a5a[_0x614a('0x18')],_0x1d633d);})[_0x614a('0x16')](function(_0x26ba80){_0x1a6a5a[_0x614a('0x19')]=_0x26ba80;delete _0x1a6a5a[_0x614a('0x18')];return updateInteractionCounters(_0x1a6a5a);})[_0x614a('0x16')](function(_0x5ce606){if(_0x4000d5){return getLastMessageText(_0x5ce606);}else{return _0x5ce606;}})[_0x614a('0x16')](function(_0x1977c5){_0x2d8155(_0x1977c5);})[_0x614a('0x14')](function(_0x16250e){_0x58b699(_0x16250e);});});}; \ No newline at end of file +var _0x9e5c=['catch','updateInteraction','then','Users','TagIds','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','answered','abandoned','total','closed','UserId','findOne','plainBody','-id','trimStart'];(function(_0x571dec,_0x1dcae4){var _0x2e67bf=function(_0x1ae945){while(--_0x1ae945){_0x571dec['push'](_0x571dec['shift']());}};_0x2e67bf(++_0x1dcae4);}(_0x9e5c,0xf7));var _0xc9e5=function(_0x237cc5,_0x69fe7c){_0x237cc5=_0x237cc5-0x0;var _0x20922f=_0x9e5c[_0x237cc5];return _0x20922f;};'use strict';var _=require(_0xc9e5('0x0'));var db=require(_0xc9e5('0x1'))['db'];function getInteractionUsers(_0x346821,_0x4fae9b){return new Promise(function(_0x561fc9,_0x313ef7){try{var _0x9032c1=[];if(_0x4fae9b[_0x346821]){_0x9032c1=_0x4fae9b[_0x346821][_0xc9e5('0x2')](function(_0x5c2f8c){return{'id':_0x5c2f8c['id'],'fullname':_0x5c2f8c['fullname']};});}return _0x561fc9(_0x9032c1);}catch(_0x35a65c){_0x313ef7(_0x35a65c);}});}function getInteractionTags(_0x3ec247,_0x1ddae7){var _0x380f99=[];if(_0x3ec247){_0x3ec247[_0xc9e5('0x3')](',')[_0xc9e5('0x4')](function(_0x1374ee){_0x380f99[_0xc9e5('0x5')](_0x1ddae7[_0x1374ee]);});}return _0x380f99;}function updateWaitingCounter(_0x2784af){if(_0x2784af[_0xc9e5('0x6')]){_0x2784af['waiting']-=0x1;}}function updateInteractionCounters(_0x1d808b){_0x1d808b[_0xc9e5('0x6')]=0x0;_0x1d808b[_0xc9e5('0x7')]=0x0;_0x1d808b[_0xc9e5('0x8')]=0x0;_0x1d808b['unmanaged']=0x0;_0x1d808b[_0xc9e5('0x9')]=0x0;_0x1d808b[_0xc9e5('0xa')]=0x0;if(_0x1d808b[_0xc9e5('0xb')]){if(_0x1d808b['disposition']===_0xc9e5('0x9')){_0x1d808b[_0xc9e5('0x9')]+=0x1;updateWaitingCounter(_0x1d808b);}if(_0x1d808b['UserId']){_0x1d808b[_0xc9e5('0x8')]+=0x1;if(_0x1d808b[_0xc9e5('0x7')]){_0x1d808b[_0xc9e5('0x7')]-=0x1;}}else{if(_0x1d808b['disposition']){_0x1d808b['unmanaged']+=0x1;updateWaitingCounter(_0x1d808b);}}}else{if(!_0x1d808b['UserId']){_0x1d808b['waiting']+=0x1;}if(_0x1d808b[_0xc9e5('0xc')]){_0x1d808b[_0xc9e5('0x7')]+=0x1;updateWaitingCounter(_0x1d808b);}}_0x1d808b[_0xc9e5('0xa')]+=0x1;return _0x1d808b;}function getLastMessageText(_0x14ac71){return db['MailMessage'][_0xc9e5('0xd')]({'where':{'$and':[{'MailInteractionId':_0x14ac71['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc9e5('0xe')],'order':_0xc9e5('0xf'),'raw':!![]})['then'](function(_0x45aac0){if(_0x45aac0&&_0x45aac0[_0xc9e5('0xe')]){_0x14ac71['lastMsgText']=_[_0xc9e5('0x10')](_0x45aac0[_0xc9e5('0xe')]);}return _0x14ac71;})[_0xc9e5('0x11')](function(_0x50ded9){throw _0x50ded9;});}exports[_0xc9e5('0x12')]=function(_0x5a1363,_0x3738d9,_0x15add6,_0x46b806){return new Promise(function(_0x1fd79b,_0x1c2b56){return getInteractionUsers(_0x5a1363['id'],_0x15add6)[_0xc9e5('0x13')](function(_0x505580){_0x5a1363[_0xc9e5('0x14')]=_0x505580;return getInteractionTags(_0x5a1363[_0xc9e5('0x15')],_0x3738d9);})[_0xc9e5('0x13')](function(_0x4ab099){_0x5a1363['Tags']=_0x4ab099;delete _0x5a1363[_0xc9e5('0x15')];return updateInteractionCounters(_0x5a1363);})[_0xc9e5('0x13')](function(_0x483d4f){if(_0x46b806){return getLastMessageText(_0x483d4f);}else{return _0x483d4f;}})[_0xc9e5('0x13')](function(_0x149087){_0x1fd79b(_0x149087);})[_0xc9e5('0x11')](function(_0x2d1044){_0x1c2b56(_0x2d1044);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index f015152..db5b7c5 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 _0x30d1=['isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','upperFirst','Interaction','findOne','then','catch','error','exports','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags'];(function(_0x31218c,_0x28ae34){var _0x13e4ab=function(_0x3e0521){while(--_0x3e0521){_0x31218c['push'](_0x31218c['shift']());}};_0x13e4ab(++_0x28ae34);}(_0x30d1,0x1a4));var _0x130d=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x30d1[_0x2feb53];return _0x5700ee;};'use strict';var _=require('lodash');var db=require(_0x130d('0x0'))['db'];var loggers={'openchannel':require(_0x130d('0x1'))('openchannel-interactions'),'mail':require(_0x130d('0x1'))(_0x130d('0x2')),'fax':require('../../config/logger')(_0x130d('0x3')),'sms':require(_0x130d('0x1'))(_0x130d('0x4')),'chat':require(_0x130d('0x1'))(_0x130d('0x5')),'whatsapp':require(_0x130d('0x1'))(_0x130d('0x6'))};function getAccountFK(_0x45a2a9){return _[_0x130d('0x7')](_0x45a2a9)+(_0x45a2a9===_0x130d('0x8')?'Website':'Account')+'Id';}function getInteractionFK(_0x13ae1f){return _['capitalize'](_0x13ae1f)+_0x130d('0x9');}function getInteractionId(_0xe4eb61,_0x4b93d1,_0x5c0b3e){if(_0xe4eb61&&_0xe4eb61[_['upperFirst'](_0x5c0b3e)+'InteractionId']){return _0xe4eb61[_['upperFirst'](_0x5c0b3e)+_0x130d('0x9')];}else if(_0xe4eb61&&_0xe4eb61['id']){return _0xe4eb61['id'];}else if(_0x4b93d1&&_0x4b93d1['id']){return _0x4b93d1['id'];}else{return _0x130d('0xa');}}function getInteractionsTables(_0x2f32bb){return{'accounts':_0x2f32bb+'_'+(_0x2f32bb===_0x130d('0x8')?_0x130d('0xb'):_0x130d('0xc')),'interactions':_0x2f32bb+_0x130d('0xd'),'interactionsTags':_0x2f32bb+_0x130d('0xe'),'messages':_0x2f32bb+'_messages','userInteractions':'user_has_'+_0x2f32bb+_0x130d('0xd')};}function getSelectedTags(_0x54de29){var _0x4a01ac=[];if(_0x54de29){_0x4a01ac=Array[_0x130d('0xf')](_0x54de29)?_0x54de29:[_0x54de29];}return _0x4a01ac;}function log(_0x3c6afd,_0xee47ee,_0x3d7f55,_0x307cc3,_0x372a2c,_0x47eff){loggers[_0x372a2c[_0x130d('0x10')]()][_0x3c6afd](_0x130d('0x11'),_0x47eff[_0x130d('0x12')](),_0xee47ee?_0xee47ee['id']:null,_0xee47ee?_0xee47ee[_0x130d('0x13')]:null,_0xee47ee?_0xee47ee[_0x130d('0x14')]:null,getInteractionId(_0x3d7f55,_0x307cc3,_0x372a2c),_0x3d7f55?JSON[_0x130d('0x15')](_0x3d7f55):'null');}function updateUser(_0x4364c5,_0x410135,_0x35a34d,_0x44f779,_0x3d5a16){db[_[_0x130d('0x16')](_0x44f779)+_0x130d('0x17')][_0x130d('0x18')]({'where':{'id':getInteractionId(_0x410135,_0x35a34d,_0x44f779)}})[_0x130d('0x19')](function(_0x345df1){if(_0x345df1){return _0x345df1['update']({'UserId':_0x4364c5?_0x4364c5['id']:null});}})[_0x130d('0x19')](function(_0x5e0b8c){if(_0x5e0b8c){log('info',_0x4364c5,_0x410135,_0x35a34d,_0x44f779,_0x3d5a16);}})[_0x130d('0x1a')](function(){log(_0x130d('0x1b'),_0x4364c5,_0x410135,_0x35a34d,_0x44f779,_0x3d5a16);});}module[_0x130d('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xcd62=['toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcd62,0x1ea));var _0x2cd6=function(_0x2e91ce,_0x169ee3){_0x2e91ce=_0x2e91ce-0x0;var _0x2df3b5=_0xcd62[_0x2e91ce];return _0x2df3b5;};'use strict';var _=require(_0x2cd6('0x0'));var db=require(_0x2cd6('0x1'))['db'];var loggers={'openchannel':require(_0x2cd6('0x2'))(_0x2cd6('0x3')),'mail':require('../../config/logger')(_0x2cd6('0x4')),'fax':require('../../config/logger')(_0x2cd6('0x5')),'sms':require('../../config/logger')(_0x2cd6('0x6')),'chat':require(_0x2cd6('0x2'))(_0x2cd6('0x7')),'whatsapp':require(_0x2cd6('0x2'))(_0x2cd6('0x8'))};function getAccountFK(_0x153a3e){return _['capitalize'](_0x153a3e)+(_0x153a3e===_0x2cd6('0x9')?_0x2cd6('0xa'):_0x2cd6('0xb'))+'Id';}function getInteractionFK(_0x36769a){return _[_0x2cd6('0xc')](_0x36769a)+_0x2cd6('0xd');}function getInteractionId(_0x1fb43c,_0x4d83ae,_0x18fea1){if(_0x1fb43c&&_0x1fb43c[_[_0x2cd6('0xe')](_0x18fea1)+_0x2cd6('0xd')]){return _0x1fb43c[_['upperFirst'](_0x18fea1)+_0x2cd6('0xd')];}else if(_0x1fb43c&&_0x1fb43c['id']){return _0x1fb43c['id'];}else if(_0x4d83ae&&_0x4d83ae['id']){return _0x4d83ae['id'];}else{return _0x2cd6('0xf');}}function getInteractionsTables(_0xd20f0c){return{'accounts':_0xd20f0c+'_'+(_0xd20f0c===_0x2cd6('0x9')?_0x2cd6('0x10'):'accounts'),'interactions':_0xd20f0c+_0x2cd6('0x11'),'interactionsTags':_0xd20f0c+_0x2cd6('0x12'),'messages':_0xd20f0c+_0x2cd6('0x13'),'userInteractions':_0x2cd6('0x14')+_0xd20f0c+_0x2cd6('0x11')};}function getSelectedTags(_0x310ef9){var _0x443cc1=[];if(_0x310ef9){_0x443cc1=Array[_0x2cd6('0x15')](_0x310ef9)?_0x310ef9:[_0x310ef9];}return _0x443cc1;}function log(_0x18967c,_0x4e8e9b,_0x25281d,_0x49e028,_0x1b1d65,_0x8ea7d9){loggers[_0x1b1d65[_0x2cd6('0x16')]()][_0x18967c](_0x2cd6('0x17'),_0x8ea7d9[_0x2cd6('0x18')](),_0x4e8e9b?_0x4e8e9b['id']:null,_0x4e8e9b?_0x4e8e9b[_0x2cd6('0x19')]:null,_0x4e8e9b?_0x4e8e9b[_0x2cd6('0x1a')]:null,getInteractionId(_0x25281d,_0x49e028,_0x1b1d65),_0x25281d?JSON[_0x2cd6('0x1b')](_0x25281d):_0x2cd6('0x1c'));}function updateUser(_0x32f516,_0x2b9a61,_0x5069e5,_0x4474cb,_0x2df843){db[_[_0x2cd6('0xe')](_0x4474cb)+_0x2cd6('0x1d')]['findOne']({'where':{'id':getInteractionId(_0x2b9a61,_0x5069e5,_0x4474cb)}})[_0x2cd6('0x1e')](function(_0x434f86){if(_0x434f86){return _0x434f86['update']({'UserId':_0x32f516?_0x32f516['id']:null});}})[_0x2cd6('0x1e')](function(_0x115632){if(_0x115632){log('info',_0x32f516,_0x2b9a61,_0x5069e5,_0x4474cb,_0x2df843);}})['catch'](function(){log('error',_0x32f516,_0x2b9a61,_0x5069e5,_0x4474cb,_0x2df843);});}module[_0x2cd6('0x1f')]={'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 1164490..b7316fb 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 _0xb6d2=['../../config/environment','data1','license','split','createDecipher','format','base64','final','utf8','parse','hasOwnProperty','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware'];(function(_0x439c8c,_0x40e2c1){var _0x127fec=function(_0x3e3cfd){while(--_0x3e3cfd){_0x439c8c['push'](_0x439c8c['shift']());}};_0x127fec(++_0x40e2c1);}(_0xb6d2,0x1ca));var _0x2b6d=function(_0x216449,_0x526553){_0x216449=_0x216449-0x0;var _0x3a82ef=_0xb6d2[_0x216449];return _0x3a82ef;};'use strict';var crypto=require('crypto');var util=require(_0x2b6d('0x0'));var compose=require(_0x2b6d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x2b6d('0x2'));function getValueFromLicense(_0x51e9ae,_0x131e4e){if(_0x51e9ae&&_0x131e4e){if(_0x131e4e[_0x2b6d('0x3')]&&_0x131e4e[_0x2b6d('0x4')]){var _0x3689f9=_0x131e4e[_0x2b6d('0x3')];var _0x1060e2=_0x131e4e[_0x2b6d('0x4')];var _0x2857b4=_0x3689f9[_0x2b6d('0x5')]('-')[0x4];var _0x438b93=_0x3689f9[_0x2b6d('0x5')]('-')[0x0];var _0x463cdf=crypto[_0x2b6d('0x6')]('aes-256-ctr',util[_0x2b6d('0x7')]('%s:%s:%s',_0x2857b4,_0x3689f9,_0x438b93));var _0x3d38c1=_0x463cdf['update'](_0x1060e2,_0x2b6d('0x8'),'utf8');_0x3d38c1+=_0x463cdf[_0x2b6d('0x9')](_0x2b6d('0xa'));var _0x534487=JSON[_0x2b6d('0xb')](_0x3d38c1);return _0x534487[_0x2b6d('0xc')](_0x51e9ae)?_0x534487[_0x51e9ae]:null;}}return null;}function isLimit(_0x1e4cfc,_0x2b6bcc,_0x390877,_0x2a38e3){var _0x3b2b35=_0x2b6bcc;return compose()['use'](function(_0x18d120,_0x3466fc,_0x52e0aa){return db['License'][_0x2b6d('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x2b6d('0xe')](function(_0x110348){var _0x233335=getValueFromLicense(_0x1e4cfc,_0x110348);return _0x233335?_0x233335:_0x3b2b35;})[_0x2b6d('0xe')](function(_0x4f39a4){_0x3b2b35=_0x4f39a4;return _0x390877['count'](_0x2a38e3);})[_0x2b6d('0xe')](function(_0x2a440d){if(_0x2a440d>=_0x3b2b35){return _0x3466fc['status'](0x193)[_0x2b6d('0xf')]({'message':util[_0x2b6d('0x7')](_0x2b6d('0x10'),_0x1e4cfc)});}_0x52e0aa();})[_0x2b6d('0x11')](function(_0x20c1e8){_0x52e0aa(_0x20c1e8);});});}function isUserLimit(){return isLimit(_0x2b6d('0x12'),0x1,db[_0x2b6d('0x13')],{'where':{'$or':[{'role':_0x2b6d('0x14')},{'role':_0x2b6d('0x15')}]}});}exports[_0x2b6d('0x16')]=isUserLimit; \ No newline at end of file +var _0x22dd=['then','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64','final','utf8','parse','use'];(function(_0x4bf51e,_0x138c9d){var _0xa91472=function(_0x43e7f8){while(--_0x43e7f8){_0x4bf51e['push'](_0x4bf51e['shift']());}};_0xa91472(++_0x138c9d);}(_0x22dd,0x199));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var compose=require(_0xd22d('0x2'));var db=require(_0xd22d('0x3'))['db'];var config=require(_0xd22d('0x4'));function getValueFromLicense(_0x2c39c6,_0x34099e){if(_0x2c39c6&&_0x34099e){if(_0x34099e[_0xd22d('0x5')]&&_0x34099e[_0xd22d('0x6')]){var _0x8d1b00=_0x34099e['data1'];var _0x2a1158=_0x34099e['license'];var _0x1bb377=_0x8d1b00[_0xd22d('0x7')]('-')[0x4];var _0x2b7019=_0x8d1b00['split']('-')[0x0];var _0x275899=crypto[_0xd22d('0x8')]('aes-256-ctr',util['format'](_0xd22d('0x9'),_0x1bb377,_0x8d1b00,_0x2b7019));var _0x427364=_0x275899[_0xd22d('0xa')](_0x2a1158,_0xd22d('0xb'),'utf8');_0x427364+=_0x275899[_0xd22d('0xc')](_0xd22d('0xd'));var _0x397152=JSON[_0xd22d('0xe')](_0x427364);return _0x397152['hasOwnProperty'](_0x2c39c6)?_0x397152[_0x2c39c6]:null;}}return null;}function isLimit(_0x4d016c,_0x35eb4f,_0x4ea4ec,_0x325b39){var _0x430beb=_0x35eb4f;return compose()[_0xd22d('0xf')](function(_0x4f7f16,_0x36cf1b,_0x1f967a){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xd22d('0x10')](function(_0x3b9c1b){var _0x2cd672=getValueFromLicense(_0x4d016c,_0x3b9c1b);return _0x2cd672?_0x2cd672:_0x430beb;})[_0xd22d('0x10')](function(_0x294617){_0x430beb=_0x294617;return _0x4ea4ec['count'](_0x325b39);})[_0xd22d('0x10')](function(_0x37cd76){if(_0x37cd76>=_0x430beb){return _0x36cf1b['status'](0x193)[_0xd22d('0x11')]({'message':util[_0xd22d('0x12')](_0xd22d('0x13'),_0x4d016c)});}_0x1f967a();})[_0xd22d('0x14')](function(_0x1cdfbf){_0x1f967a(_0x1cdfbf);});});}function isUserLimit(){return isLimit(_0xd22d('0x15'),0x1,db[_0xd22d('0x16')],{'where':{'$or':[{'role':_0xd22d('0x17')},{'role':_0xd22d('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8e653ef..084ab46 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 _0xb7f5=['days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','$gt','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$endsWith','$between','shift','pop','DATE','utcOffset','add','minutes','seconds','lodash','sqlOperator','startsWith','and','[$and]','replace','[$or]','length','split','slice','forEach','filter','indexOf','map','conditions','buildExpression','$eq','operator','includes','value'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0xb7f5,0x94));var _0x5b7f=function(_0x635bc2,_0x1c3ad9){_0x635bc2=_0x635bc2-0x0;var _0x59372c=_0xb7f5[_0x635bc2];return _0x59372c;};'use strict';var _=require(_0x5b7f('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x13cb6c){var _0x2b3cec={'conditions':[]};_0x2b3cec[_0x5b7f('0x1')]=_[_0x5b7f('0x2')](_0x13cb6c,'[$or]')?'or':_0x5b7f('0x3');var _0x1df5f5=_0x13cb6c['replace'](_0x5b7f('0x4'),'')[_0x5b7f('0x5')](_0x5b7f('0x6'),'')['split']('||');for(var _0x5d6c87=0x0;_0x5d6c87<_0x1df5f5[_0x5b7f('0x7')];_0x5d6c87++){var _0x2f7cf9=_0x1df5f5[_0x5d6c87][_0x5b7f('0x8')](':=');var _0x3a2988=_0x2f7cf9[0x0];var _0x467c12=_0x2f7cf9[_0x5b7f('0x9')](0x1);_0x467c12[_0x5b7f('0xa')](function(_0x59171f){var _0x13c694=_0x59171f[_0x5b7f('0x8')]('[')['shift']();var _0x4fdad9=_0x59171f['match'](/\[(.*?)\]/g);_0x4fdad9[_0x5b7f('0xa')](function(_0x3412e6){var _0x175837=_0x3412e6[_0x5b7f('0x8')]('[')[_0x5b7f('0xb')](function(_0x515421){return _0x515421[_0x5b7f('0xc')](']')>-0x1;})[_0x5b7f('0xd')](function(_0x451268){return _0x451268[_0x5b7f('0x8')](']')[0x0];})[0x0];_0x2b3cec[_0x5b7f('0xe')]['push']({'field':_0x3a2988,'operator':_0x13c694,'value':_0x175837});});});}return _0x2b3cec;};exports[_0x5b7f('0xf')]=function(_0x3aba12,_0x53d396,_0x45fede){var _0x5047ff={};if(_0x53d396==='DATE'){if(_0x45fede['operator']===_0x5b7f('0x10')){_0x45fede[_0x5b7f('0x11')]='$between';_0x45fede['value']+=','+_0x45fede['value'];}else if(_[_0x5b7f('0x12')](['$gt','$lte'],_0x45fede[_0x5b7f('0x11')])){_0x45fede[_0x5b7f('0x13')]=moment(_0x45fede[_0x5b7f('0x13')])['add'](0x1,_0x5b7f('0x14'))[_0x5b7f('0x15')](_0x5b7f('0x16'));}}if(_0x45fede[_0x5b7f('0x17')]){_0x53d396=_0x45fede['castTo'];_0x5047ff['text']=_0x5b7f('0x18')+_0x3aba12+'.'+_0x45fede[_0x5b7f('0x19')]+_0x5b7f('0x1a')+_0x45fede[_0x5b7f('0x17')]+')\x20'+parseOperator(_0x45fede['operator']);}else{_0x5047ff[_0x5b7f('0x1b')]=_0x3aba12+'.'+_0x45fede['field']+'\x20'+parseOperator(_0x45fede[_0x5b7f('0x11')]);}if(_[_0x5b7f('0x12')]([_0x5b7f('0x1c'),_0x5b7f('0x1d')],_0x45fede[_0x5b7f('0x11')]))_0x5047ff[_0x5b7f('0x1b')]='('+_0x5047ff[_0x5b7f('0x1b')]+_0x5b7f('0x1e')+_0x3aba12+'.'+_0x45fede[_0x5b7f('0x19')]+_0x5b7f('0x1f');_0x5047ff[_0x5b7f('0x13')]=parseValue(_0x53d396,_0x45fede['operator'],_0x45fede[_0x5b7f('0x13')]);return _0x5047ff;};function parseOperator(_0x1d1e8e){var _0x494ee5;switch(_0x1d1e8e){case'$in':_0x494ee5=_0x5b7f('0x20');break;case _0x5b7f('0x1d'):_0x494ee5=_0x5b7f('0x21');break;case _0x5b7f('0x10'):_0x494ee5=_0x5b7f('0x22');break;case _0x5b7f('0x1c'):_0x494ee5=_0x5b7f('0x23');break;case _0x5b7f('0x24'):case _0x5b7f('0x25'):case'$endsWith':_0x494ee5=_0x5b7f('0x26');break;case'$lt':_0x494ee5=_0x5b7f('0x27');break;case _0x5b7f('0x28'):_0x494ee5=_0x5b7f('0x29');break;case'$lte':_0x494ee5=_0x5b7f('0x2a');break;case'$gte':_0x494ee5=_0x5b7f('0x2b');break;case'$between':_0x494ee5=_0x5b7f('0x2c');break;}return _0x494ee5;}function parseValue(_0x1c64d5,_0xac3799,_0x394fba){var _0x57554c={'start':undefined,'end':undefined};switch(_0xac3799){case _0x5b7f('0x2d'):case _0x5b7f('0x1d'):_0x57554c['start']=_0x394fba[_0x5b7f('0x8')](',');break;case _0x5b7f('0x24'):_0x57554c['start']='%'+_0x394fba+'%';break;case'$startsWith':_0x57554c[_0x5b7f('0x2e')]=_0x394fba+'%';break;case _0x5b7f('0x2f'):_0x57554c[_0x5b7f('0x2e')]='%'+_0x394fba;break;case _0x5b7f('0x30'):var _0x5363fe=_0x394fba[_0x5b7f('0x8')](',');var _0x394fba=_0x5363fe[_0x5b7f('0x31')]();var _0x31fafe=_0x5363fe[_0x5b7f('0x32')]();if(_0x1c64d5===_0x5b7f('0x33')){_0x394fba=moment(_0x394fba)[_0x5b7f('0x34')](0x0,!![])['format']();_0x31fafe=moment(_0x31fafe)[_0x5b7f('0x34')](0x0,!![])[_0x5b7f('0x35')](0x17,'hours')['add'](0x3b,_0x5b7f('0x36'))[_0x5b7f('0x35')](0x3b,_0x5b7f('0x37'))[_0x5b7f('0x15')]();}_0x57554c={'start':_0x394fba,'end':_0x31fafe};break;default:_0x57554c[_0x5b7f('0x2e')]=_0x394fba;break;}return _0x57554c;} \ No newline at end of file +var _0xf077=['LIKE\x20?','$lt','<\x20?','>\x20?','$lte','BETWEEN\x20?\x20AND\x20?','start','$endsWith','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','filter','indexOf','map','conditions','buildExpression','DATE','operator','$between','value','$gt','add','days','format','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith'];(function(_0x276a45,_0x108b04){var _0x2f6a54=function(_0x3f4485){while(--_0x3f4485){_0x276a45['push'](_0x276a45['shift']());}};_0x2f6a54(++_0x108b04);}(_0xf077,0xad));var _0x7f07=function(_0x364f53,_0x14a6a3){_0x364f53=_0x364f53-0x0;var _0xc0e1b5=_0xf077[_0x364f53];return _0xc0e1b5;};'use strict';var _=require(_0x7f07('0x0'));var moment=require(_0x7f07('0x1'));exports[_0x7f07('0x2')]=function(_0x1b11b6){var _0x429ac5={'conditions':[]};_0x429ac5[_0x7f07('0x3')]=_[_0x7f07('0x4')](_0x1b11b6,_0x7f07('0x5'))?'or':_0x7f07('0x6');var _0x45e647=_0x1b11b6[_0x7f07('0x7')](_0x7f07('0x8'),'')['replace'](_0x7f07('0x5'),'')[_0x7f07('0x9')]('||');for(var _0x22fa0e=0x0;_0x22fa0e<_0x45e647[_0x7f07('0xa')];_0x22fa0e++){var _0x7fc73f=_0x45e647[_0x22fa0e][_0x7f07('0x9')](':=');var _0x5575c3=_0x7fc73f[0x0];var _0x5af15b=_0x7fc73f[_0x7f07('0xb')](0x1);_0x5af15b[_0x7f07('0xc')](function(_0x1f8f86){var _0xd0d996=_0x1f8f86['split']('[')[_0x7f07('0xd')]();var _0x5cf32c=_0x1f8f86['match'](/\[(.*?)\]/g);_0x5cf32c[_0x7f07('0xc')](function(_0x421406){var _0x4ae644=_0x421406[_0x7f07('0x9')]('[')[_0x7f07('0xe')](function(_0x5aa8da){return _0x5aa8da[_0x7f07('0xf')](']')>-0x1;})[_0x7f07('0x10')](function(_0xf1a16f){return _0xf1a16f['split'](']')[0x0];})[0x0];_0x429ac5[_0x7f07('0x11')]['push']({'field':_0x5575c3,'operator':_0xd0d996,'value':_0x4ae644});});});}return _0x429ac5;};exports[_0x7f07('0x12')]=function(_0x55f3c4,_0x40d972,_0x5ab82a){var _0x4527f5={};if(_0x40d972===_0x7f07('0x13')){if(_0x5ab82a['operator']==='$eq'){_0x5ab82a[_0x7f07('0x14')]=_0x7f07('0x15');_0x5ab82a[_0x7f07('0x16')]+=','+_0x5ab82a['value'];}else if(_['includes']([_0x7f07('0x17'),'$lte'],_0x5ab82a[_0x7f07('0x14')])){_0x5ab82a[_0x7f07('0x16')]=moment(_0x5ab82a['value'])[_0x7f07('0x18')](0x1,_0x7f07('0x19'))[_0x7f07('0x1a')](_0x7f07('0x1b'));}}if(_0x5ab82a[_0x7f07('0x1c')]){_0x40d972=_0x5ab82a['castTo'];_0x4527f5['text']=_0x7f07('0x1d')+_0x55f3c4+'.'+_0x5ab82a[_0x7f07('0x1e')]+'\x20AS\x20'+_0x5ab82a[_0x7f07('0x1c')]+')\x20'+parseOperator(_0x5ab82a[_0x7f07('0x14')]);}else{_0x4527f5[_0x7f07('0x1f')]=_0x55f3c4+'.'+_0x5ab82a['field']+'\x20'+parseOperator(_0x5ab82a[_0x7f07('0x14')]);}if(_['includes']([_0x7f07('0x20'),_0x7f07('0x21')],_0x5ab82a[_0x7f07('0x14')]))_0x4527f5[_0x7f07('0x1f')]='('+_0x4527f5[_0x7f07('0x1f')]+_0x7f07('0x22')+_0x55f3c4+'.'+_0x5ab82a[_0x7f07('0x1e')]+_0x7f07('0x23');_0x4527f5[_0x7f07('0x16')]=parseValue(_0x40d972,_0x5ab82a[_0x7f07('0x14')],_0x5ab82a['value']);return _0x4527f5;};function parseOperator(_0x148d9f){var _0x5ca754;switch(_0x148d9f){case _0x7f07('0x24'):_0x5ca754=_0x7f07('0x25');break;case'$notIn':_0x5ca754=_0x7f07('0x26');break;case _0x7f07('0x27'):_0x5ca754=_0x7f07('0x28');break;case _0x7f07('0x20'):_0x5ca754='<>\x20?';break;case _0x7f07('0x29'):case _0x7f07('0x2a'):case'$endsWith':_0x5ca754=_0x7f07('0x2b');break;case _0x7f07('0x2c'):_0x5ca754=_0x7f07('0x2d');break;case'$gt':_0x5ca754=_0x7f07('0x2e');break;case _0x7f07('0x2f'):_0x5ca754='<=\x20?';break;case'$gte':_0x5ca754='>=\x20?';break;case _0x7f07('0x15'):_0x5ca754=_0x7f07('0x30');break;}return _0x5ca754;}function parseValue(_0x33197d,_0x557f66,_0x55b77a){var _0x12185c={'start':undefined,'end':undefined};switch(_0x557f66){case _0x7f07('0x24'):case _0x7f07('0x21'):_0x12185c[_0x7f07('0x31')]=_0x55b77a['split'](',');break;case _0x7f07('0x29'):_0x12185c[_0x7f07('0x31')]='%'+_0x55b77a+'%';break;case _0x7f07('0x2a'):_0x12185c['start']=_0x55b77a+'%';break;case _0x7f07('0x32'):_0x12185c[_0x7f07('0x31')]='%'+_0x55b77a;break;case _0x7f07('0x15'):var _0x2a22e0=_0x55b77a[_0x7f07('0x9')](',');var _0x55b77a=_0x2a22e0[_0x7f07('0xd')]();var _0x3d13ad=_0x2a22e0['pop']();if(_0x33197d===_0x7f07('0x13')){_0x55b77a=moment(_0x55b77a)[_0x7f07('0x33')](0x0,!![])['format']();_0x3d13ad=moment(_0x3d13ad)[_0x7f07('0x33')](0x0,!![])[_0x7f07('0x18')](0x17,_0x7f07('0x34'))[_0x7f07('0x18')](0x3b,_0x7f07('0x35'))['add'](0x3b,'seconds')['format']();}_0x12185c={'start':_0x55b77a,'end':_0x3d13ad};break;default:_0x12185c[_0x7f07('0x31')]=_0x55b77a;break;}return _0x12185c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4d84607..408204a 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 _0x84a7=['forEach','replace','push','join','getOptions','query','$id','intersection','attributes','hasOwnProperty','nolimit','where','pick','filter','object','value','merge','type','VIRTUAL','lower','include','includeAll','keys','lodash','sequelize','moment','../../mysqldb','parse','includes','model','alias','fields','raw','split','filters','isEmpty','find','DATE','isPlainObject','$gte','utc','$lte','format','YYYY-MM-DD','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','unset','isNumeric','match','isEmail','\x22{EXPR}\x22','{EXPR}'];(function(_0x414519,_0x3d7396){var _0x5381ec=function(_0x5f3a91){while(--_0x5f3a91){_0x414519['push'](_0x414519['shift']());}};_0x5381ec(++_0x3d7396);}(_0x84a7,0xa1));var _0x784a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84a7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x784a('0x0'));var sequelize=require(_0x784a('0x1'));var moment=require(_0x784a('0x2'));var db=require(_0x784a('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x54b816){var _0x4afea3=['ne'];try{var _0x553f99=JSON[_0x784a('0x4')](_0x54b816);var _0x17ef27=Object['keys'](_0x553f99)[0x0];return _0x4afea3[_0x784a('0x5')](_0x17ef27);}catch(_0x260435){return![];}}function getOperatorValue(_0x3baf95){var _0x53afb6=JSON[_0x784a('0x4')](_0x3baf95);var _0x1321c5=Object['keys'](_0x53afb6)[0x0];var _0x225963=_0x53afb6[_0x1321c5];return{['$'+_0x1321c5]:_0x225963};}function parseIncludeModel(_0x54c28e){var _0x8fb84d=JSON['parse'](_0x54c28e);return{'model':db[_0x8fb84d[_0x784a('0x6')]],'as':_0x8fb84d[_0x784a('0x7')],'attributes':_0x8fb84d[_0x784a('0x8')],'raw':_0x8fb84d[_0x784a('0x9')]};}exports[_0x784a('0x8')]=function(_0x56e509){var _0x177894=null;if(_0x56e509){_0x177894=_0x56e509[_0x784a('0xa')](',');}return _0x177894;};exports[_0x784a('0xb')]=function(_0xe10c10,_0x923fd1){var _0xf68840={};if(!_[_0x784a('0xc')](_0xe10c10)){_['forOwn'](_0xe10c10,function(_0x5bbe09,_0x47bc12){try{if(_0x923fd1){var _0x47c391=_[_0x784a('0xd')](_0x923fd1,{'name':_0x47bc12})||{};if(hasSequelizeOperator(_0x5bbe09)){_0xf68840[_0x47bc12]=getOperatorValue(_0x5bbe09);}else if(_0x47c391['type']===_0x784a('0xe')&&_[_0x784a('0xf')](_0x5bbe09)){var _0x5b788f=JSON['parse'](_0x5bbe09);var _0x3c9d53={'$gte':moment(moment(_0x5b788f[_0x784a('0x10')])['format']('YYYY-MM-DD'))[_0x784a('0x11')]()['format'](),'$lte':moment(moment(_0x5b788f[_0x784a('0x12')])[_0x784a('0x13')](_0x784a('0x14')))[_0x784a('0x11')]()[_0x784a('0x15')](0x1,'s')['format']()};_0xf68840[_0x47bc12]=_0x3c9d53;}else if(_0x47c391[_0x784a('0x16')]==='uniqueid'){_0xf68840[_0x47bc12]=_0x5bbe09;}else{_0xf68840[_0x47bc12]=_[_0x784a('0x17')](_0x5bbe09)?_0x5bbe09:JSON[_0x784a('0x4')](_0x5bbe09);}}else{_0xf68840[_0x47bc12]=_[_0x784a('0x17')](_0x5bbe09)?_0x5bbe09:JSON[_0x784a('0x4')](_0x5bbe09);}}catch(_0x26b93e){_0xf68840[_0x47bc12]=_0x5bbe09['split'](',');}});}return _0xf68840;};exports[_0x784a('0x18')]=function(_0x1de9ac){_0x1de9ac=parseInt(_0x1de9ac,0xa);if(!_0x1de9ac||_0x1de9ac<0x0){_0x1de9ac=LIMIT_VALUE;}return _0x1de9ac;};exports[_0x784a('0x19')]=function(_0x343109){_0x343109=parseInt(_0x343109,0xa);if(!_0x343109||_0x343109<0x0){_0x343109=0x0;}return _0x343109;};exports[_0x784a('0x1a')]=function(_0x247b99){var _0x45c6a7,_0x3e7206=null;if(_0x247b99){_0x45c6a7=_0x247b99[_0x784a('0xa')](',');_0x3e7206=_[_0x784a('0x1b')](_0x45c6a7,function(_0x18563f){if(_0x18563f[_0x784a('0x1c')]('-')===0x0){return[_0x18563f===_0x784a('0x1d')?sequelize[_0x784a('0x1e')](sequelize[_0x784a('0x1f')]('priority'),_0x784a('0x20')):_0x18563f[_0x784a('0x21')](0x1),_0x784a('0x22')];}else{return[_0x18563f==='priority'?sequelize[_0x784a('0x1e')](sequelize[_0x784a('0x1f')]('priority'),_0x784a('0x20')):_0x18563f,_0x784a('0x23')];}});}return _0x3e7206;};exports[_0x784a('0x24')]=function(_0x5275e9,_0x565c5e){if(_[_0x784a('0xc')](_0x5275e9)){return _0x5275e9;}if(_[_0x784a('0x17')](_0x5275e9)){for(var _0x18366b=0x0;_0x18366b<_0x5275e9['length'];_0x18366b+=0x1){_0x5275e9[_0x18366b]=this[_0x784a('0x24')](_0x5275e9[_0x18366b],_0x565c5e);}return _0x5275e9;}if(!_[_0x784a('0x25')](_0x5275e9)){return _0x5275e9;}if(_[_0x784a('0x26')](_0x565c5e)){_0x565c5e=[_0x565c5e];}if(!_[_0x784a('0x17')](_0x565c5e)){return _0x5275e9;}for(var _0x4dc664=0x0;_0x4dc664<_0x565c5e[_0x784a('0x27')];_0x4dc664+=0x1){_[_0x784a('0x28')](_0x5275e9,_0x565c5e[_0x4dc664]);}for(var _0x293d3e in _0x5275e9){if(_0x5275e9['hasOwnProperty'](_0x293d3e)){_0x5275e9[_0x293d3e]=this['omit'](_0x5275e9[_0x293d3e],_0x565c5e);}}return _0x5275e9;};exports[_0x784a('0x29')]=function(_0x5143d8){return _0x5143d8[_0x784a('0x2a')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x784a('0x2b')]=function(_0x4197fa){return _0x4197fa[_0x784a('0x2a')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x32cfd1,_0x5abcf2){var _0x13bcbe=[];var _0x30fc0d=/[ `!@#$%^&*()_\-?~]/;var _0x4c23e9=_0x5abcf2?_0x784a('0x2c'):_0x784a('0x2d');_0x32cfd1['split'](/[ ,]+/)[_0x784a('0x2e')](function(_0x3cd425){_0x3cd425=_0x3cd425[_0x784a('0x2f')](/([^:]")"+/g,'$1');_0x3cd425='+'+_0x3cd425+'*';var _0x1bb185=_0x3cd425[_0x784a('0x2a')](_0x30fc0d);if(_0x1bb185){_0x3cd425='\x22'+_0x3cd425+'\x22';}_0x13bcbe[_0x784a('0x30')](_0x3cd425);});_0x4c23e9=_0x4c23e9[_0x784a('0x2f')](_0x784a('0x2d'),_0x13bcbe[_0x784a('0x31')]('\x20'));return _0x4c23e9;};exports[_0x784a('0x32')]=function(_0x456c46,_0x1e4f3f,_0x5936ff){var _0x217340={},_0x2d31f6={};if(_0x1e4f3f[_0x784a('0x33')][_0x784a('0x34')]){_0x1e4f3f[_0x784a('0x33')]['id']=_0x1e4f3f[_0x784a('0x33')][_0x784a('0x34')];delete _0x1e4f3f['query'][_0x784a('0x34')];}_0x217340[_0x784a('0x6')]=_[_0x784a('0x1b')](_0x456c46,_0x784a('0x16'));_0x217340[_0x784a('0x33')]=_['keys'](_0x1e4f3f[_0x784a('0x33')]);_0x217340[_0x784a('0xb')]=_[_0x784a('0x35')](_0x217340[_0x784a('0x6')],_0x217340['query']);_0x2d31f6[_0x784a('0x36')]=_[_0x784a('0x35')](_0x217340[_0x784a('0x6')],this[_0x784a('0x8')](_0x1e4f3f[_0x784a('0x33')]['fields']));_0x2d31f6['attributes']=_0x2d31f6['attributes']['length']?_0x2d31f6[_0x784a('0x36')]:_0x217340[_0x784a('0x6')];if(!_0x1e4f3f[_0x784a('0x33')][_0x784a('0x37')](_0x784a('0x38'))){_0x2d31f6[_0x784a('0x18')]=this['limit'](_0x1e4f3f[_0x784a('0x33')][_0x784a('0x18')]);_0x2d31f6[_0x784a('0x19')]=this[_0x784a('0x19')](_0x1e4f3f['query'][_0x784a('0x19')]);}_0x2d31f6['order']=this[_0x784a('0x1a')](_0x1e4f3f['query'][_0x784a('0x1a')]);_0x2d31f6[_0x784a('0x39')]=this['filters'](_[_0x784a('0x3a')](_0x1e4f3f[_0x784a('0x33')],_0x217340[_0x784a('0xb')]),_0x456c46);if(_0x1e4f3f['query'][_0x784a('0x3b')]){var _0x2c2baf=_0x456c46;var _0x1a1ad2=_0x1e4f3f[_0x784a('0x33')][_0x784a('0x3b')];if(typeof _0x1a1ad2===_0x784a('0x3c')){_0x2c2baf=_[_0x784a('0x3b')](_0x456c46,function(_0xd66f01){return _[_0x784a('0x5')](_0x1a1ad2['columns'],_0xd66f01[_0x784a('0x16')]);});_0x1a1ad2=_0x1a1ad2[_0x784a('0x3d')];}_0x2d31f6[_0x784a('0x39')]=_[_0x784a('0x3e')](_0x2d31f6[_0x784a('0x39')],{'$or':_[_0x784a('0x1b')](_0x2c2baf,function(_0x534b1c){if(_0x534b1c[_0x784a('0x3f')]!==_0x784a('0x40')){if(_0x5936ff){return sequelize[_0x784a('0x39')](sequelize['fn'](_0x784a('0x41'),sequelize[_0x784a('0x1f')](_0x534b1c['name'])),{'$like':sequelize['fn']('lower','%'+_0x1e4f3f['query'][_0x784a('0x3b')]+'%')});}else{var _0x2aefde={};_0x2aefde[_0x534b1c[_0x784a('0x16')]]={'$like':'%'+_0x1e4f3f[_0x784a('0x33')][_0x784a('0x3b')]+'%'};return _0x2aefde;}}})});}_0x2d31f6=_['merge']({},_0x2d31f6,_0x1e4f3f['options']);return _0x2d31f6;};exports[_0x784a('0x42')]=function(_0x387561){var _0x1d3968=[];if(_0x387561[_0x784a('0x43')]){_0x1d3968[_0x784a('0x30')]({'all':!![]});}else if(_0x387561[_0x784a('0x42')]){if(Array[_0x784a('0x17')](_0x387561[_0x784a('0x42')])){_0x1d3968=Object[_0x784a('0x44')](_0x387561[_0x784a('0x42')])[_0x784a('0x1b')](function(_0xd6d815){return parseIncludeModel(_0x387561[_0x784a('0x42')][_0xd6d815]);});}else{var _0x496066=parseIncludeModel(_0x387561[_0x784a('0x42')]);_0x1d3968['push'](_0x496066);}}return _0x1d3968;}; \ No newline at end of file +var _0xeedf=['isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','getOptions','query','$id','model','intersection','attributes','nolimit','pick','filter','object','columns','value','where','type','lower','merge','include','includeAll','push','lodash','sequelize','moment','parse','keys','alias','fields','raw','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','length','omit','isObject','unset','hasOwnProperty'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xeedf,0x12c));var _0xfeed=function(_0x4d2f8a,_0x4928ce){_0x4d2f8a=_0x4d2f8a-0x0;var _0xcb16af=_0xeedf[_0x4d2f8a];return _0xcb16af;};'use strict';var _=require(_0xfeed('0x0'));var sequelize=require(_0xfeed('0x1'));var moment=require(_0xfeed('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3b3a73){var _0x522c8e=['ne'];try{var _0x426cf2=JSON[_0xfeed('0x3')](_0x3b3a73);var _0x2b78f1=Object[_0xfeed('0x4')](_0x426cf2)[0x0];return _0x522c8e['includes'](_0x2b78f1);}catch(_0x5dc3c7){return![];}}function getOperatorValue(_0x2c211d){var _0x5df4fe=JSON[_0xfeed('0x3')](_0x2c211d);var _0x52286c=Object[_0xfeed('0x4')](_0x5df4fe)[0x0];var _0x5c147d=_0x5df4fe[_0x52286c];return{['$'+_0x52286c]:_0x5c147d};}function parseIncludeModel(_0x124bdf){var _0x55a598=JSON['parse'](_0x124bdf);return{'model':db[_0x55a598['model']],'as':_0x55a598[_0xfeed('0x5')],'attributes':_0x55a598[_0xfeed('0x6')],'raw':_0x55a598[_0xfeed('0x7')]};}exports[_0xfeed('0x6')]=function(_0x4df57a){var _0x1e39c8=null;if(_0x4df57a){_0x1e39c8=_0x4df57a[_0xfeed('0x8')](',');}return _0x1e39c8;};exports[_0xfeed('0x9')]=function(_0x1aa14a,_0x4dce80){var _0x55bc45={};if(!_[_0xfeed('0xa')](_0x1aa14a)){_[_0xfeed('0xb')](_0x1aa14a,function(_0x8b5c3e,_0xd0523b){try{if(_0x4dce80){var _0x23b516=_[_0xfeed('0xc')](_0x4dce80,{'name':_0xd0523b})||{};if(hasSequelizeOperator(_0x8b5c3e)){_0x55bc45[_0xd0523b]=getOperatorValue(_0x8b5c3e);}else if(_0x23b516['type']===_0xfeed('0xd')&&_[_0xfeed('0xe')](_0x8b5c3e)){var _0x44cc75=JSON[_0xfeed('0x3')](_0x8b5c3e);var _0x1ef929={'$gte':moment(moment(_0x44cc75[_0xfeed('0xf')])[_0xfeed('0x10')](_0xfeed('0x11')))[_0xfeed('0x12')]()[_0xfeed('0x10')](),'$lte':moment(moment(_0x44cc75[_0xfeed('0x13')])[_0xfeed('0x10')](_0xfeed('0x11')))[_0xfeed('0x12')]()['subtract'](0x1,'s')[_0xfeed('0x10')]()};_0x55bc45[_0xd0523b]=_0x1ef929;}else if(_0x23b516[_0xfeed('0x14')]===_0xfeed('0x15')){_0x55bc45[_0xd0523b]=_0x8b5c3e;}else{_0x55bc45[_0xd0523b]=_[_0xfeed('0x16')](_0x8b5c3e)?_0x8b5c3e:JSON[_0xfeed('0x3')](_0x8b5c3e);}}else{_0x55bc45[_0xd0523b]=_[_0xfeed('0x16')](_0x8b5c3e)?_0x8b5c3e:JSON[_0xfeed('0x3')](_0x8b5c3e);}}catch(_0x2e6f00){_0x55bc45[_0xd0523b]=_0x8b5c3e[_0xfeed('0x8')](',');}});}return _0x55bc45;};exports[_0xfeed('0x17')]=function(_0x4f8e36){_0x4f8e36=parseInt(_0x4f8e36,0xa);if(!_0x4f8e36||_0x4f8e36<0x0){_0x4f8e36=LIMIT_VALUE;}return _0x4f8e36;};exports[_0xfeed('0x18')]=function(_0x42ea72){_0x42ea72=parseInt(_0x42ea72,0xa);if(!_0x42ea72||_0x42ea72<0x0){_0x42ea72=0x0;}return _0x42ea72;};exports[_0xfeed('0x19')]=function(_0x5da2da){var _0x149ebe,_0x331338=null;if(_0x5da2da){_0x149ebe=_0x5da2da[_0xfeed('0x8')](',');_0x331338=_[_0xfeed('0x1a')](_0x149ebe,function(_0x16d82a){if(_0x16d82a[_0xfeed('0x1b')]('-')===0x0){return[_0x16d82a===_0xfeed('0x1c')?sequelize[_0xfeed('0x1d')](sequelize[_0xfeed('0x1e')](_0xfeed('0x1c')),_0xfeed('0x1f')):_0x16d82a[_0xfeed('0x20')](0x1),_0xfeed('0x21')];}else{return[_0x16d82a===_0xfeed('0x1c')?sequelize['cast'](sequelize['col']('priority'),_0xfeed('0x1f')):_0x16d82a,_0xfeed('0x22')];}});}return _0x331338;};exports['omit']=function(_0x126b88,_0x26959e){if(_[_0xfeed('0xa')](_0x126b88)){return _0x126b88;}if(_[_0xfeed('0x16')](_0x126b88)){for(var _0x50e114=0x0;_0x50e114<_0x126b88[_0xfeed('0x23')];_0x50e114+=0x1){_0x126b88[_0x50e114]=this[_0xfeed('0x24')](_0x126b88[_0x50e114],_0x26959e);}return _0x126b88;}if(!_[_0xfeed('0x25')](_0x126b88)){return _0x126b88;}if(_['isString'](_0x26959e)){_0x26959e=[_0x26959e];}if(!_[_0xfeed('0x16')](_0x26959e)){return _0x126b88;}for(var _0x31fbb5=0x0;_0x31fbb5<_0x26959e['length'];_0x31fbb5+=0x1){_[_0xfeed('0x26')](_0x126b88,_0x26959e[_0x31fbb5]);}for(var _0x57c0cd in _0x126b88){if(_0x126b88[_0xfeed('0x27')](_0x57c0cd)){_0x126b88[_0x57c0cd]=this[_0xfeed('0x24')](_0x126b88[_0x57c0cd],_0x26959e);}}return _0x126b88;};exports[_0xfeed('0x28')]=function(_0x137441){return _0x137441[_0xfeed('0x29')](RegExp(_0xfeed('0x2a')))?!![]:![];};exports[_0xfeed('0x2b')]=function(_0x387be2){return _0x387be2[_0xfeed('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0xfeed('0x2c')]=function(_0x121820,_0x545b40){var _0x4933db=[];var _0x8353e8=/[ `!@#$%^&*()_\-?~]/;var _0x3af790=_0x545b40?_0xfeed('0x2d'):_0xfeed('0x2e');_0x121820[_0xfeed('0x8')](/[ ,]+/)[_0xfeed('0x2f')](function(_0x41b686){_0x41b686=_0x41b686[_0xfeed('0x30')](/([^:]")"+/g,'$1');_0x41b686='+'+_0x41b686+'*';var _0x5385f9=_0x41b686[_0xfeed('0x29')](_0x8353e8);if(_0x5385f9){_0x41b686='\x22'+_0x41b686+'\x22';}_0x4933db['push'](_0x41b686);});_0x3af790=_0x3af790[_0xfeed('0x30')](_0xfeed('0x2e'),_0x4933db['join']('\x20'));return _0x3af790;};exports[_0xfeed('0x31')]=function(_0x274b8e,_0x52848b,_0xe585df){var _0x4dfc72={},_0x234c7e={};if(_0x52848b[_0xfeed('0x32')][_0xfeed('0x33')]){_0x52848b[_0xfeed('0x32')]['id']=_0x52848b['query'][_0xfeed('0x33')];delete _0x52848b['query']['$id'];}_0x4dfc72[_0xfeed('0x34')]=_[_0xfeed('0x1a')](_0x274b8e,_0xfeed('0x14'));_0x4dfc72[_0xfeed('0x32')]=_[_0xfeed('0x4')](_0x52848b[_0xfeed('0x32')]);_0x4dfc72[_0xfeed('0x9')]=_[_0xfeed('0x35')](_0x4dfc72[_0xfeed('0x34')],_0x4dfc72['query']);_0x234c7e[_0xfeed('0x36')]=_[_0xfeed('0x35')](_0x4dfc72['model'],this[_0xfeed('0x6')](_0x52848b[_0xfeed('0x32')]['fields']));_0x234c7e[_0xfeed('0x36')]=_0x234c7e[_0xfeed('0x36')][_0xfeed('0x23')]?_0x234c7e['attributes']:_0x4dfc72[_0xfeed('0x34')];if(!_0x52848b['query']['hasOwnProperty'](_0xfeed('0x37'))){_0x234c7e[_0xfeed('0x17')]=this['limit'](_0x52848b[_0xfeed('0x32')][_0xfeed('0x17')]);_0x234c7e[_0xfeed('0x18')]=this[_0xfeed('0x18')](_0x52848b[_0xfeed('0x32')][_0xfeed('0x18')]);}_0x234c7e['order']=this[_0xfeed('0x19')](_0x52848b[_0xfeed('0x32')][_0xfeed('0x19')]);_0x234c7e['where']=this[_0xfeed('0x9')](_[_0xfeed('0x38')](_0x52848b['query'],_0x4dfc72['filters']),_0x274b8e);if(_0x52848b[_0xfeed('0x32')]['filter']){var _0x5ed637=_0x274b8e;var _0x3ecd9b=_0x52848b[_0xfeed('0x32')][_0xfeed('0x39')];if(typeof _0x3ecd9b===_0xfeed('0x3a')){_0x5ed637=_[_0xfeed('0x39')](_0x274b8e,function(_0x5a51ef){return _['includes'](_0x3ecd9b[_0xfeed('0x3b')],_0x5a51ef[_0xfeed('0x14')]);});_0x3ecd9b=_0x3ecd9b[_0xfeed('0x3c')];}_0x234c7e[_0xfeed('0x3d')]=_['merge'](_0x234c7e[_0xfeed('0x3d')],{'$or':_['map'](_0x5ed637,function(_0x6342d6){if(_0x6342d6[_0xfeed('0x3e')]!=='VIRTUAL'){if(_0xe585df){return sequelize[_0xfeed('0x3d')](sequelize['fn']('lower',sequelize[_0xfeed('0x1e')](_0x6342d6[_0xfeed('0x14')])),{'$like':sequelize['fn'](_0xfeed('0x3f'),'%'+_0x52848b[_0xfeed('0x32')][_0xfeed('0x39')]+'%')});}else{var _0x343684={};_0x343684[_0x6342d6[_0xfeed('0x14')]]={'$like':'%'+_0x52848b[_0xfeed('0x32')]['filter']+'%'};return _0x343684;}}})});}_0x234c7e=_[_0xfeed('0x40')]({},_0x234c7e,_0x52848b['options']);return _0x234c7e;};exports[_0xfeed('0x41')]=function(_0x3df3aa){var _0x251dd0=[];if(_0x3df3aa[_0xfeed('0x42')]){_0x251dd0[_0xfeed('0x43')]({'all':!![]});}else if(_0x3df3aa[_0xfeed('0x41')]){if(Array[_0xfeed('0x16')](_0x3df3aa[_0xfeed('0x41')])){_0x251dd0=Object[_0xfeed('0x4')](_0x3df3aa[_0xfeed('0x41')])[_0xfeed('0x1a')](function(_0x305651){return parseIncludeModel(_0x3df3aa['include'][_0x305651]);});}else{var _0x4e6ddf=parseIncludeModel(_0x3df3aa[_0xfeed('0x41')]);_0x251dd0[_0xfeed('0x43')](_0x4e6ddf);}}return _0x251dd0;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 1affb43..6b9f7d0 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 _0x5fc3=['findOne','getAgents','all','flatten','map','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','fullname','mailPause','openchannelPause','voicePause','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','pauseType','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','value','filterAgentAttributes','name','faxStatusTime','whatsappStatusTime','mailCurrentCapacity','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','chatPause','faxPause','smsPause','whatsappPause','every','filter','length','idle','unknown','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','busy','getAgentStatus','isArray','startCase','Queue'];(function(_0x15814b,_0x39ea20){var _0x1f1012=function(_0x236477){while(--_0x236477){_0x15814b['push'](_0x15814b['shift']());}};_0x1f1012(++_0x39ea20);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x5fc3[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x35fc('0x0'));var jayson=require(_0x35fc('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x35fc('0x2')][_0x35fc('0x3')]({'port':0x232a});var routingClient=jayson[_0x35fc('0x2')][_0x35fc('0x3')]({'port':0x232c});function isAgentPaused(_0xb4f9ce,_0x5e75e6){var _0x2d1404=[_0xb4f9ce[_0x35fc('0x4')],_0xb4f9ce[_0x35fc('0x5')],_0xb4f9ce['mailPause'],_0xb4f9ce['openchannelPause'],_0xb4f9ce[_0x35fc('0x6')],_0xb4f9ce['voicePause'],_0xb4f9ce[_0x35fc('0x7')]];if(!_0x5e75e6)return _[_0x35fc('0x8')](_0x2d1404);var _0xc72d93=_[_0x35fc('0x9')](_0x2d1404);return _0xc72d93[_0x35fc('0xa')]>0x0&&_0xc72d93[_0x35fc('0xa')]<_0x2d1404[_0x35fc('0xa')]?!![]:![];}function isIdle(_0x565f95){return _0x565f95===_0x35fc('0xb')||_0x565f95===_0x35fc('0xc')||_0x565f95==='unavailable'||_0x565f95===_0x35fc('0xd')||_[_0x35fc('0xe')](_0x565f95);}function isAgentIdle(_0x5021d4){if(_0x5021d4[_0x35fc('0xf')]!==_0x35fc('0xb')&&_0x5021d4['voicePause']){_0x5021d4['voiceStatus']=_0x35fc('0x10');return![];}return _['every']([_0x5021d4[_0x35fc('0x11')],_0x5021d4[_0x35fc('0x12')],_0x5021d4[_0x35fc('0x13')],_0x5021d4[_0x35fc('0x14')],_0x5021d4[_0x35fc('0x15')],_0x5021d4['voiceStatus'],_0x5021d4['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x35fc('0x16')](function(_0x229d56){if(_0x229d56[_0x35fc('0x17')]){throw new Error(_0x35fc('0x18'));}var _0x227a49=_0x229d56[_0x35fc('0x19')];return routingClient['request'](_0x35fc('0x1a'),{})[_0x35fc('0x16')](function(_0x553677){if(_0x553677[_0x35fc('0x17')]){throw new Error(_0x35fc('0x1b'));}var _0x2e513b=_0x553677['result'];return _[_0x35fc('0x1c')]({},_0x227a49,_0x2e513b);});})[_0x35fc('0x1d')](function(_0x465eb3){throw _0x465eb3;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x402cff){var _0x350a27=_0x35fc('0xc');if(isAgentPaused(_0x402cff))_0x350a27=_0x35fc('0x10');else if(isAgentPaused(_0x402cff,!![]))_0x350a27=_0x35fc('0x1e');else if(isAgentIdle(_0x402cff))_0x350a27=_0x35fc('0xb');else _0x350a27=_0x35fc('0x1f');return _0x350a27;}exports[_0x35fc('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x2405e8,_0x427eae){var _0x5bd2b8=_[_0x35fc('0x21')](_0x2405e8)?_0x2405e8:[_0x2405e8];var _0xd5399f=_[_0x35fc('0x22')](_0x427eae)+_0x35fc('0x23');var _0x3b4743=_['map'](_0x5bd2b8,function(_0x33f5e8){return db[_0xd5399f][_0x35fc('0x24')]({'where':{'id':_0x33f5e8}})['then'](function(_0x265324){if(!_0x265324)return[];return _0x265324[_0x35fc('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x35fc('0x26')](_0x3b4743)['then'](function(_0x4086e9){var _0x598d7a=_(_0x4086e9)[_0x35fc('0x27')]()[_0x35fc('0x28')]('id')['uniq']()['value']();return _0x598d7a;});}exports[_0x35fc('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58edb6,_0x274208,_0x1a5d92){try{if(_0x274208['length']>0x0){_0x58edb6=_0x58edb6[_0x35fc('0x9')](function(_0x645eac){return _0x274208[_0x35fc('0x2a')](_0x645eac['id']);});}var _0x9f3c8a=_0x58edb6[_0x35fc('0x9')](function(_0x134dfa){var _0x11ccdb=_0x35fc('0x1f');if(isAgentIdle(_0x134dfa)){_0x11ccdb='idle';}return _0x11ccdb===_0x1a5d92;});return _[_0x35fc('0x28')](_0x9f3c8a,'id');}catch(_0x220931){throw _0x220931;}}exports[_0x35fc('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x52acc5,_0xe79f52,_0x16f067){return Promise[_0x35fc('0x2c')]()[_0x35fc('0x16')](function(){if(_0xe79f52[_0x35fc('0xa')]>0x0){_0x52acc5=_0x52acc5[_0x35fc('0x9')](function(_0x222ddb){return _0xe79f52[_0x35fc('0x2a')](_0x222ddb['id']);});}return _0x52acc5;})[_0x35fc('0x16')](function(){return db[_0x35fc('0x2d')]['findAll']({'attributes':['id','name',_0x35fc('0x2e'),'chatPause',_0x35fc('0x5'),_0x35fc('0x2f'),_0x35fc('0x30'),_0x35fc('0x6'),_0x35fc('0x31'),_0x35fc('0x7'),'pauseType'],'where':{'id':{'$in':_[_0x35fc('0x28')](_0x52acc5,'id')}},'raw':!![]});})[_0x35fc('0x16')](function(_0x46b9ef){return _0x46b9ef[_0x35fc('0x28')](function(_0x2bbd36){var _0x2f823b=_['find'](_0x52acc5,['id',_0x2bbd36['id']]);var _0x2483be=filterAgentAttributes(_0x2f823b);_[_0x35fc('0x1c')](_0x2bbd36,_0x2483be);_0x2bbd36[_0x35fc('0x32')]=getAgentStatus(_0x2bbd36);return _0x2bbd36;});})['then'](function(_0x2c657d){var _0x48d223=sortAgentsByStatus(_0x2c657d,_0x16f067);return _[_0x35fc('0x28')](_0x48d223,'id');})[_0x35fc('0x1d')](function(_0x266a11){throw _0x266a11;});}exports[_0x35fc('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4de4b7){var _0x54fcf1={'fields':[],'order':null};var _0x59e4fb=_0x4de4b7[_0x35fc('0x34')](',');_0x54fcf1['fields']=_[_0x35fc('0x9')](_0x59e4fb,function(_0x4b4d4a){if(!_0x4b4d4a[_0x35fc('0x2a')](_0x35fc('0x32'))){return!![];}_0x54fcf1[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x4b4d4a,'-')?_0x35fc('0x37'):_0x35fc('0x38');return![];});return _0x54fcf1;}exports[_0x35fc('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x4ec0dc){if(!_0x4ec0dc){_0x4ec0dc=_0x35fc('0x3a');}if(_0x4ec0dc[_0x35fc('0x2a')]('fullname')&&!_0x4ec0dc[_0x35fc('0x2a')](_0x35fc('0x3b'))){var _0x1aac67=_0x4ec0dc[_0x35fc('0x3c')](0x0,_0x4ec0dc[_0x35fc('0x3d')](_0x35fc('0x2e')));_0x4ec0dc+=','+_0x1aac67+'internal';}return _0x4ec0dc;}exports[_0x35fc('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x267858,_0x392806){var _0x52543b=_0x267858[_0x35fc('0x3f')](function(_0x350a96,_0x596919){if(_0x350a96[_0x35fc('0x32')]===_0x596919[_0x35fc('0x32')]){if(_0x350a96[_0x35fc('0x32')]===_0x35fc('0x10')){if(_0x392806===_0x35fc('0x37')){return(_0x350a96[_0x35fc('0x40')]||'')<(_0x596919[_0x35fc('0x40')]||'')||_0x350a96[_0x35fc('0x2e')]['toLowerCase']()>_0x596919['fullname'][_0x35fc('0x41')]()?0x1:-0x1;}else{return(_0x350a96[_0x35fc('0x40')]||'')<(_0x596919['pauseType']||'')||_0x350a96['fullname']['toLowerCase']()>_0x596919[_0x35fc('0x2e')][_0x35fc('0x41')]()?-0x1:0x1;}}else{if(_0x392806==='DESC'){return _0x350a96[_0x35fc('0x2e')][_0x35fc('0x41')]()<_0x596919[_0x35fc('0x2e')][_0x35fc('0x41')]()?0x1:-0x1;}else{return _0x350a96['fullname']['toLowerCase']()<_0x596919['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x392806==='DESC'){return _0x350a96[_0x35fc('0x32')]<_0x596919[_0x35fc('0x32')]?0x1:-0x1;}else{return _0x350a96['globalStatus']<_0x596919[_0x35fc('0x32')]?-0x1:0x1;}}});return _0x52543b;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x13d16c){var _0x40797d=[_0x35fc('0x42'),_0x35fc('0x43'),_0x35fc('0x44'),'lastPauseAt',_0x35fc('0x40'),_0x35fc('0x45'),'internal',_0x35fc('0x46'),_0x35fc('0x4'),_0x35fc('0x30'),_0x35fc('0x2f'),'smsPause',_0x35fc('0x7'),'faxPause','voicePause',_0x35fc('0x47'),_0x35fc('0x48'),_0x35fc('0x49'),_0x35fc('0x4a'),_0x35fc('0x4b'),_0x35fc('0x4c'),_0x35fc('0x4d'),_0x35fc('0x4e'),'mailCurrentCapacity',_0x35fc('0x4f'),_0x35fc('0x50'),_0x35fc('0x51'),_0x35fc('0x11'),_0x35fc('0x14'),_0x35fc('0x13'),_0x35fc('0x15'),_0x35fc('0x52'),_0x35fc('0x12'),_0x35fc('0xf'),_0x35fc('0x53'),_0x35fc('0x54'),_0x35fc('0x55'),_0x35fc('0x56'),'whatsappStatusTime','faxStatusTime',_0x35fc('0x57'),_0x35fc('0x58'),_0x35fc('0x59'),_0x35fc('0x5a'),_0x35fc('0x5b'),_0x35fc('0x5c'),'routealias'];var _0x4f024c=[_0x35fc('0x4'),_0x35fc('0x30'),_0x35fc('0x2f'),_0x35fc('0x6'),'whatsappPause',_0x35fc('0x5'),_0x35fc('0x31'),'online'];var _0x199a00=_(_0x13d16c)[_0x35fc('0x5d')](_0x4f024c)['pick'](_0x40797d)[_0x35fc('0x5e')]();return _0x199a00;}exports[_0x35fc('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x35fc('0x60'),_0x35fc('0x2e'),'role','internal','online',_0x35fc('0x32'),_0x35fc('0x42'),'lastLoginAt',_0x35fc('0x40'),_0x35fc('0x45'),_0x35fc('0x5'),_0x35fc('0x4'),_0x35fc('0x2f'),'openchannelPause',_0x35fc('0x6'),_0x35fc('0x31'),_0x35fc('0x7'),'chatStatus',_0x35fc('0x12'),_0x35fc('0x13'),'openchannelStatus',_0x35fc('0x15'),_0x35fc('0xf'),_0x35fc('0x52'),_0x35fc('0x53'),_0x35fc('0x61'),_0x35fc('0x55'),_0x35fc('0x54'),_0x35fc('0x56'),'voiceStatusTime',_0x35fc('0x62'),_0x35fc('0x47'),_0x35fc('0x4c'),'mailCapacity',_0x35fc('0x48'),'smsCapacity','whatsappCapacity','chatCurrentCapacity',_0x35fc('0x51'),_0x35fc('0x63'),_0x35fc('0x4e'),_0x35fc('0x4f'),_0x35fc('0x50'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold','queue',_0x35fc('0x64'),_0x35fc('0x5a')];}exports[_0x35fc('0x65')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xda19=['filterAgentAttributes','role','smsStatus','mailStatusTime','openchannelStatusTime','faxCapacity','mailCapacity','onhold','getRealtimeAgentsQueryFields','jayson/promise','../../mysqldb','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','ringing','isNil','pause','chatStatus','faxStatus','openchannelStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','findOne','getAgents','flatten','map','getAgentIdsByQueues','includes','filter','getAgentIdsByStatus','User','findAll','name','fullname','pauseType','find','globalStatus','split','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','internal','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','voiceStatus','chatStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','value'];(function(_0x294fb3,_0x14d74d){var _0x5c9821=function(_0x2ea882){while(--_0x2ea882){_0x294fb3['push'](_0x294fb3['shift']());}};_0x5c9821(++_0x14d74d);}(_0xda19,0xd5));var _0x9da1=function(_0x738f1c,_0xb9b4ac){_0x738f1c=_0x738f1c-0x0;var _0x369c9b=_0xda19[_0x738f1c];return _0x369c9b;};'use strict';var _=require('lodash');var jayson=require(_0x9da1('0x0'));var db=require(_0x9da1('0x1'))['db'];var amiClient=jayson['client'][_0x9da1('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x9da1('0x2')]({'port':0x232c});function isAgentPaused(_0x4c9c86,_0x2a77c7){var _0xef6f5a=[_0x4c9c86[_0x9da1('0x3')],_0x4c9c86[_0x9da1('0x4')],_0x4c9c86[_0x9da1('0x5')],_0x4c9c86[_0x9da1('0x6')],_0x4c9c86[_0x9da1('0x7')],_0x4c9c86[_0x9da1('0x8')],_0x4c9c86[_0x9da1('0x9')]];if(!_0x2a77c7)return _[_0x9da1('0xa')](_0xef6f5a);var _0x47df89=_['filter'](_0xef6f5a);return _0x47df89['length']>0x0&&_0x47df89[_0x9da1('0xb')]<_0xef6f5a['length']?!![]:![];}function isIdle(_0x33cfe5){return _0x33cfe5===_0x9da1('0xc')||_0x33cfe5===_0x9da1('0xd')||_0x33cfe5===_0x9da1('0xe')||_0x33cfe5===_0x9da1('0xf')||_[_0x9da1('0x10')](_0x33cfe5);}function isAgentIdle(_0x9fd032){if(_0x9fd032['voiceStatus']!=='idle'&&_0x9fd032[_0x9da1('0x8')]){_0x9fd032['voiceStatus']=_0x9da1('0x11');return![];}return _[_0x9da1('0xa')]([_0x9fd032[_0x9da1('0x12')],_0x9fd032[_0x9da1('0x13')],_0x9fd032['mailStatus'],_0x9fd032[_0x9da1('0x14')],_0x9fd032['smsStatus'],_0x9fd032['voiceStatus'],_0x9fd032[_0x9da1('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x9da1('0x16'),{})[_0x9da1('0x17')](function(_0x37653d){if(_0x37653d[_0x9da1('0x18')]){throw new Error(_0x9da1('0x19'));}var _0x514d8e=_0x37653d[_0x9da1('0x1a')];return routingClient[_0x9da1('0x1b')](_0x9da1('0x16'),{})[_0x9da1('0x17')](function(_0xfb278d){if(_0xfb278d[_0x9da1('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4d4541=_0xfb278d[_0x9da1('0x1a')];return _[_0x9da1('0x1c')]({},_0x514d8e,_0x4d4541);});})[_0x9da1('0x1d')](function(_0x41e555){throw _0x41e555;});}exports[_0x9da1('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x3b1645){var _0xe56279='unknown';if(isAgentPaused(_0x3b1645))_0xe56279=_0x9da1('0x11');else if(isAgentPaused(_0x3b1645,!![]))_0xe56279=_0x9da1('0x1f');else if(isAgentIdle(_0x3b1645))_0xe56279=_0x9da1('0xc');else _0xe56279=_0x9da1('0x20');return _0xe56279;}exports[_0x9da1('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x4e9d7d,_0x5454d3){var _0x14793b=_[_0x9da1('0x22')](_0x4e9d7d)?_0x4e9d7d:[_0x4e9d7d];var _0x16ee0c=_[_0x9da1('0x23')](_0x5454d3)+_0x9da1('0x24');var _0x165b73=_['map'](_0x14793b,function(_0x2413fe){return db[_0x16ee0c][_0x9da1('0x25')]({'where':{'id':_0x2413fe}})['then'](function(_0x45fcce){if(!_0x45fcce)return[];return _0x45fcce[_0x9da1('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x165b73)[_0x9da1('0x17')](function(_0x16e12f){var _0x4b1152=_(_0x16e12f)[_0x9da1('0x27')]()[_0x9da1('0x28')]('id')['uniq']()['value']();return _0x4b1152;});}exports[_0x9da1('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x47055e,_0x5eca5b,_0x27c6e2){try{if(_0x5eca5b['length']>0x0){_0x47055e=_0x47055e['filter'](function(_0x5a59c2){return _0x5eca5b[_0x9da1('0x2a')](_0x5a59c2['id']);});}var _0x404b86=_0x47055e[_0x9da1('0x2b')](function(_0x26dd58){var _0x140c6c='busy';if(isAgentIdle(_0x26dd58)){_0x140c6c=_0x9da1('0xc');}return _0x140c6c===_0x27c6e2;});return _['map'](_0x404b86,'id');}catch(_0x1feae0){throw _0x1feae0;}}exports[_0x9da1('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5b38b3,_0xc29ba8,_0x2eb48f){return Promise['resolve']()[_0x9da1('0x17')](function(){if(_0xc29ba8[_0x9da1('0xb')]>0x0){_0x5b38b3=_0x5b38b3[_0x9da1('0x2b')](function(_0x2b2b48){return _0xc29ba8['includes'](_0x2b2b48['id']);});}return _0x5b38b3;})['then'](function(){return db[_0x9da1('0x2d')][_0x9da1('0x2e')]({'attributes':['id',_0x9da1('0x2f'),_0x9da1('0x30'),_0x9da1('0x3'),'faxPause',_0x9da1('0x5'),_0x9da1('0x6'),_0x9da1('0x7'),_0x9da1('0x8'),_0x9da1('0x9'),_0x9da1('0x31')],'where':{'id':{'$in':_['map'](_0x5b38b3,'id')}},'raw':!![]});})[_0x9da1('0x17')](function(_0x5af570){return _0x5af570['map'](function(_0x3e62e1){var _0x484f39=_[_0x9da1('0x32')](_0x5b38b3,['id',_0x3e62e1['id']]);var _0x23b8e5=filterAgentAttributes(_0x484f39);_[_0x9da1('0x1c')](_0x3e62e1,_0x23b8e5);_0x3e62e1[_0x9da1('0x33')]=getAgentStatus(_0x3e62e1);return _0x3e62e1;});})[_0x9da1('0x17')](function(_0x5efa40){var _0x3b280a=sortAgentsByStatus(_0x5efa40,_0x2eb48f);return _[_0x9da1('0x28')](_0x3b280a,'id');})['catch'](function(_0x41172d){throw _0x41172d;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x22a42f){var _0x5d7365={'fields':[],'order':null};var _0x5eaa7e=_0x22a42f[_0x9da1('0x34')](',');_0x5d7365['fields']=_[_0x9da1('0x2b')](_0x5eaa7e,function(_0x227a1c){if(!_0x227a1c['includes'](_0x9da1('0x33'))){return!![];}_0x5d7365[_0x9da1('0x35')]=_[_0x9da1('0x36')](_0x227a1c,'-')?_0x9da1('0x37'):'ASC';return![];});return _0x5d7365;}exports[_0x9da1('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x5e7846){if(!_0x5e7846){_0x5e7846=_0x9da1('0x39');}if(_0x5e7846['includes'](_0x9da1('0x30'))&&!_0x5e7846[_0x9da1('0x2a')]('internal')){var _0x345edb=_0x5e7846[_0x9da1('0x3a')](0x0,_0x5e7846[_0x9da1('0x3b')]('fullname'));_0x5e7846+=','+_0x345edb+'internal';}return _0x5e7846;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x27e78c,_0x5541c4){var _0x5b215c=_0x27e78c[_0x9da1('0x3c')](function(_0x118be7,_0x43c064){if(_0x118be7['globalStatus']===_0x43c064[_0x9da1('0x33')]){if(_0x118be7[_0x9da1('0x33')]===_0x9da1('0x11')){if(_0x5541c4===_0x9da1('0x37')){return(_0x118be7[_0x9da1('0x31')]||'')<(_0x43c064[_0x9da1('0x31')]||'')||_0x118be7[_0x9da1('0x30')]['toLowerCase']()>_0x43c064[_0x9da1('0x30')]['toLowerCase']()?0x1:-0x1;}else{return(_0x118be7[_0x9da1('0x31')]||'')<(_0x43c064['pauseType']||'')||_0x118be7[_0x9da1('0x30')][_0x9da1('0x3d')]()>_0x43c064['fullname'][_0x9da1('0x3d')]()?-0x1:0x1;}}else{if(_0x5541c4===_0x9da1('0x37')){return _0x118be7['fullname'][_0x9da1('0x3d')]()<_0x43c064['fullname'][_0x9da1('0x3d')]()?0x1:-0x1;}else{return _0x118be7[_0x9da1('0x30')]['toLowerCase']()<_0x43c064['fullname'][_0x9da1('0x3d')]()?-0x1:0x1;}}}else{if(_0x5541c4===_0x9da1('0x37')){return _0x118be7[_0x9da1('0x33')]<_0x43c064[_0x9da1('0x33')]?0x1:-0x1;}else{return _0x118be7[_0x9da1('0x33')]<_0x43c064[_0x9da1('0x33')]?-0x1:0x1;}}});return _0x5b215c;}exports[_0x9da1('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x379552){var _0x598843=[_0x9da1('0x3f'),_0x9da1('0x40'),_0x9da1('0x41'),'lastPauseAt',_0x9da1('0x31'),_0x9da1('0x42'),_0x9da1('0x43'),'address',_0x9da1('0x3'),_0x9da1('0x6'),_0x9da1('0x5'),'smsPause',_0x9da1('0x9'),'faxPause','voicePause',_0x9da1('0x44'),_0x9da1('0x45'),'mailCapacity',_0x9da1('0x46'),_0x9da1('0x47'),'faxCapacity',_0x9da1('0x48'),_0x9da1('0x49'),_0x9da1('0x4a'),_0x9da1('0x4b'),_0x9da1('0x4c'),_0x9da1('0x4d'),_0x9da1('0x12'),_0x9da1('0x14'),_0x9da1('0x4e'),'smsStatus',_0x9da1('0x15'),_0x9da1('0x13'),_0x9da1('0x4f'),_0x9da1('0x50'),'openchannelStatusTime','mailStatusTime',_0x9da1('0x51'),_0x9da1('0x52'),_0x9da1('0x53'),_0x9da1('0x54'),_0x9da1('0x55'),_0x9da1('0x56'),_0x9da1('0x57'),_0x9da1('0x58'),_0x9da1('0x59'),_0x9da1('0x5a')];var _0x868167=[_0x9da1('0x3'),_0x9da1('0x6'),_0x9da1('0x5'),'smsPause',_0x9da1('0x9'),_0x9da1('0x4'),'voicePause',_0x9da1('0x40')];var _0x4a1e45=_(_0x379552)[_0x9da1('0x5b')](_0x868167)['pick'](_0x598843)[_0x9da1('0x5c')]();return _0x4a1e45;}exports[_0x9da1('0x5d')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x9da1('0x2f'),_0x9da1('0x30'),_0x9da1('0x5e'),_0x9da1('0x43'),_0x9da1('0x40'),_0x9da1('0x33'),_0x9da1('0x3f'),_0x9da1('0x41'),'pauseType',_0x9da1('0x42'),_0x9da1('0x4'),_0x9da1('0x3'),_0x9da1('0x5'),_0x9da1('0x6'),_0x9da1('0x7'),_0x9da1('0x8'),_0x9da1('0x9'),_0x9da1('0x12'),_0x9da1('0x13'),'mailStatus',_0x9da1('0x14'),_0x9da1('0x5f'),'voiceStatus',_0x9da1('0x15'),_0x9da1('0x50'),_0x9da1('0x53'),_0x9da1('0x60'),_0x9da1('0x61'),_0x9da1('0x51'),_0x9da1('0x54'),'whatsappStatusTime',_0x9da1('0x44'),_0x9da1('0x62'),_0x9da1('0x63'),_0x9da1('0x45'),'smsCapacity',_0x9da1('0x47'),'chatCurrentCapacity',_0x9da1('0x4d'),_0x9da1('0x4a'),_0x9da1('0x49'),_0x9da1('0x4b'),_0x9da1('0x4c'),_0x9da1('0x58'),'phoneBarEnableAutomaticScreenRecording','destconnectedlinenum',_0x9da1('0x64'),'queue','routealias','screenrecording'];}exports[_0x9da1('0x65')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index b8649b1..1a578ec 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 _0x8cee=['predictiveIntervalAvgTalktime','voice','request','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','outbound','map','get','paused','find','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','talking','unavailable','pTalking','originated','message','dialMethod','Trunk','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8cee,0xd2));var _0xe8ce=function(_0x1a907f,_0x5e370b){_0x1a907f=_0x1a907f-0x0;var _0x310dc9=_0x8cee[_0x1a907f];return _0x310dc9;};'use strict';var _=require(_0xe8ce('0x0'));var jayson=require(_0xe8ce('0x1'));var util=require(_0xe8ce('0x2'));var amiClient=jayson[_0xe8ce('0x3')][_0xe8ce('0x4')]({'port':0x232a});var routingClient=jayson[_0xe8ce('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xe8ce('0x5'),_0xe8ce('0x6'),'paused',_0xe8ce('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xe8ce('0x8'),_0xe8ce('0x9'),_0xe8ce('0xa'),_0xe8ce('0xb'),'notInUse',_0xe8ce('0xc'),_0xe8ce('0xd'),'ringInUse',_0xe8ce('0xe'),_0xe8ce('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xe8ce('0x10'),_0xe8ce('0x11'),_0xe8ce('0x12'),'statusMessage','dialActive',_0xe8ce('0x13'),_0xe8ce('0x14'),'startPredictive','startProgressive',_0xe8ce('0x15'),_0xe8ce('0x16'),'erlangAbandonmentRate',_0xe8ce('0x17'),_0xe8ce('0x18'),_0xe8ce('0x19'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0xe8ce('0x1a'),_0xe8ce('0x1b'),_0xe8ce('0x1c'),_0xe8ce('0x1d'),_0xe8ce('0x1e')];function getRealtimeQueues(_0x319cc9,_0x9e6829){var _0xa10218=_0x9e6829===_0xe8ce('0x1f')?amiClient:routingClient;return _0xa10218[_0xe8ce('0x20')](_['startCase'](_0x9e6829)+_0xe8ce('0x21'),_0x319cc9)[_0xe8ce('0x22')](function(_0x36c818){if(_0x36c818['error'])throw new Error(util[_0xe8ce('0x23')](_0xe8ce('0x24'),_0x9e6829));return _0x36c818[_0xe8ce('0x25')];})[_0xe8ce('0x26')](function(_0x322b8d){throw _0x322b8d;});}exports[_0xe8ce('0x27')]=getRealtimeQueues;function initializeQueues(_0xde60ca,_0x5d5f87,_0x6aef55,_0x136de9){var _0x106413=DEFAULT_QUEUE_ATTRIBUTES;if(_0x6aef55===_0xe8ce('0x1f')){if(_0x136de9===_0xe8ce('0x28')){_0x106413=_0x106413['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x136de9===_0xe8ce('0x29')){_0x106413=_0x106413['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xde60ca[_0xe8ce('0x2a')](function(_0x4c332f){var _0x2d1a3d=_0x4c332f[_0xe8ce('0x2b')]({'plain':!![]});_0x2d1a3d[_0xe8ce('0x2c')]=0x0;_0x2d1a3d[_0xe8ce('0xb')]=0x0;_0x2d1a3d[_0xe8ce('0x6')]=0x0;_0x2d1a3d[_0xe8ce('0x5')]=0x0;_0x2d1a3d[_0xe8ce('0x7')]=0x0;if(_0x6aef55==='voice'){_0x2d1a3d[_0xe8ce('0xe')]=0x0;_0x2d1a3d[_0xe8ce('0x8')]=0x0;if(_0x136de9===_0xe8ce('0x29')){_0x2d1a3d[_0xe8ce('0x10')]=0x0;_0x2d1a3d[_0xe8ce('0x11')]=0x0;}}var _0x215072=_[_0xe8ce('0x2d')](_0x5d5f87,['id',_0x2d1a3d['id']]);if(_0x215072){_['merge'](_0x2d1a3d,_[_0xe8ce('0x2e')](_0x215072,_0x106413));}return _0x2d1a3d;});}exports[_0xe8ce('0x2f')]=initializeQueues; \ No newline at end of file +var _0xc65d=['waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','request','startCase','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','voice','concat','map','get','paused','outbound','originated','find','merge','pick','initializeQueues','jayson/promise','client','available','loggedIn'];(function(_0x3c055d,_0x431f09){var _0x57609a=function(_0x13d203){while(--_0x13d203){_0x3c055d['push'](_0x3c055d['shift']());}};_0x57609a(++_0x431f09);}(_0xc65d,0x122));var _0xdc65=function(_0x302e5b,_0x49138c){_0x302e5b=_0x302e5b-0x0;var _0x25c248=_0xc65d[_0x302e5b];return _0x25c248;};'use strict';var _=require('lodash');var jayson=require(_0xdc65('0x0'));var util=require('util');var amiClient=jayson[_0xdc65('0x1')]['http']({'port':0x232a});var routingClient=jayson[_0xdc65('0x1')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdc65('0x2'),_0xdc65('0x3'),'paused',_0xdc65('0x4')];var VOICE_QUEUE_ATTRIBUTES=[_0xdc65('0x5'),_0xdc65('0x6'),_0xdc65('0x7'),_0xdc65('0x8'),_0xdc65('0x9'),_0xdc65('0xa'),_0xdc65('0xb'),_0xdc65('0xc'),_0xdc65('0xd'),_0xdc65('0xe'),_0xdc65('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xdc65('0x10'),'originated',_0xdc65('0x11'),'statusMessage',_0xdc65('0x12'),_0xdc65('0x13'),_0xdc65('0x14'),_0xdc65('0x15'),'startProgressive',_0xdc65('0x16'),_0xdc65('0x17'),_0xdc65('0x18'),'erlangBusyFactor',_0xdc65('0x19'),_0xdc65('0x1a'),_0xdc65('0x1b'),_0xdc65('0x1c'),_0xdc65('0x1d'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xdc65('0x1e'),'predictiveIntervalAvgHoldtime',_0xdc65('0x1f')];function getRealtimeQueues(_0x1651d8,_0x15fe0e){var _0x453734=_0x15fe0e==='voice'?amiClient:routingClient;return _0x453734[_0xdc65('0x20')](_[_0xdc65('0x21')](_0x15fe0e)+'Queues',_0x1651d8)[_0xdc65('0x22')](function(_0x16fd7c){if(_0x16fd7c['error'])throw new Error(util[_0xdc65('0x23')](_0xdc65('0x24'),_0x15fe0e));return _0x16fd7c['result'];})[_0xdc65('0x25')](function(_0x2835fb){throw _0x2835fb;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x28a7a6,_0xf53c03,_0x5da97e,_0x24b84e){var _0x4b275d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5da97e===_0xdc65('0x26')){if(_0x24b84e==='inbound'){_0x4b275d=_0x4b275d[_0xdc65('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x24b84e==='outbound'){_0x4b275d=_0x4b275d[_0xdc65('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x28a7a6[_0xdc65('0x28')](function(_0x3b49d4){var _0x51c24e=_0x3b49d4[_0xdc65('0x29')]({'plain':!![]});_0x51c24e[_0xdc65('0x2a')]=0x0;_0x51c24e[_0xdc65('0x8')]=0x0;_0x51c24e[_0xdc65('0x3')]=0x0;_0x51c24e[_0xdc65('0x2')]=0x0;_0x51c24e[_0xdc65('0x4')]=0x0;if(_0x5da97e===_0xdc65('0x26')){_0x51c24e[_0xdc65('0xd')]=0x0;_0x51c24e[_0xdc65('0x5')]=0x0;if(_0x24b84e===_0xdc65('0x2b')){_0x51c24e[_0xdc65('0x10')]=0x0;_0x51c24e[_0xdc65('0x2c')]=0x0;}}var _0x3a07da=_[_0xdc65('0x2d')](_0xf53c03,['id',_0x51c24e['id']]);if(_0x3a07da){_[_0xdc65('0x2e')](_0x51c24e,_[_0xdc65('0x2f')](_0x3a07da,_0x4b275d));}return _0x51c24e;});}exports[_0xdc65('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index bf55786..2cdd2ce 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(_0x47c75a,_0x447086){var _0x1e6f62=function(_0x1a2907){while(--_0x1a2907){_0x47c75a['push'](_0x47c75a['shift']());}};_0x1e6f62(++_0x447086);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0xc80b2b,_0x5a12e9){var _0x22af6f=function(_0x418bf5){while(--_0x418bf5){_0xc80b2b['push'](_0xc80b2b['shift']());}};_0x22af6f(++_0x5a12e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index cf0080d..ed44e6e 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 _0xa877=['00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','update','hex','getUuid','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','keys','length','filter','family','IPv4','head','mac'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa877,0x1f2));var _0x7a87=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa877[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7a87('0x0'));var os=require('os');var crypto=require(_0x7a87('0x1'));var machine=require(_0x7a87('0x2'));var exec=require('child_process')[_0x7a87('0x3')];var config=require(_0x7a87('0x4'));function getInterfaces(){var _0x196117=[];var _0x1e9234=os['networkInterfaces']();var _0x3ddb3d=_['orderBy'](_[_0x7a87('0x5')](_0x1e9234));for(var _0x2d997c=0x0;_0x2d997c<_0x3ddb3d[_0x7a87('0x6')];_0x2d997c++){var _0x970584=_0x1e9234[_0x3ddb3d[_0x2d997c]][_0x7a87('0x7')](function(_0x40e54d){return _0x40e54d[_0x7a87('0x8')]===_0x7a87('0x9')&&_0x40e54d['internal']===![];});_0x196117=_0x196117['concat'](_0x970584);}return _0x196117;}function getFirstInterface(){var _0x46fbc5=_[_0x7a87('0xa')](getInterfaces());return{'macAddress':_0x46fbc5&&_0x46fbc5[_0x7a87('0xb')]?_0x46fbc5[_0x7a87('0xb')]:_0x7a87('0xc'),'ipAddress':_0x46fbc5&&_0x46fbc5[_0x7a87('0xd')]?_0x46fbc5[_0x7a87('0xd')]:_0x7a87('0xe')};}exports[_0x7a87('0xf')]=getFirstInterface;function getCPUhash(){var _0x3eb857=_[_0x7a87('0x10')](os['cpus']()[_0x7a87('0x11')](function(_0x38dcc4){return _0x38dcc4[_0x7a87('0x12')];}))[_0x7a87('0x13')](':');return crypto[_0x7a87('0x14')](_0x7a87('0x15'))[_0x7a87('0x16')](_0x3eb857)['digest'](_0x7a87('0x17'));}exports[_0x7a87('0x18')]=function(){var _0x582c34=os['platform']();var _0x54f503=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x54f503[_0x7a87('0x19')](config[_0x7a87('0x1a')])){return config['licenseToken'];}else if(_0x582c34==='win32'){return exec(_0x7a87('0x1b'),{'encoding':_0x7a87('0x1c')})[_0x7a87('0x1d')]('\x0d\x0a','');}else{var _0x1bcc26=getFirstInterface();var _0x3ac1d2=getCPUhash();var _0x3cd770=_0x3ac1d2+'|'+os[_0x7a87('0x1e')]()+'|'+_0x1bcc26[_0x7a87('0x1f')]+'|'+_0x1bcc26[_0x7a87('0x20')];var _0x4bc027=crypto['createHash'](_0x7a87('0x15'))[_0x7a87('0x16')](_0x3cd770)['digest']('hex');return _0x4bc027[_0x7a87('0x21')](0x0,0x8)+'-'+_0x4bc027[_0x7a87('0x21')](0x8,0xc)+'-'+_0x4bc027[_0x7a87('0x21')](0xc,0x10)+'-'+_0x4bc027[_0x7a87('0x21')](0x10,0x14)+'-'+_0x4bc027[_0x7a87('0x21')](0x14);}}; \ No newline at end of file +var _0x45c1=['length','filter','family','IPv4','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','update','hex','platform','licenseToken','dmidecode\x20--string\x20system-uuid','replace','ipAddress','md5','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x45c1,0x1e6));var _0x145c=function(_0x2a25cf,_0x13eda7){_0x2a25cf=_0x2a25cf-0x0;var _0x4b46ce=_0x45c1[_0x2a25cf];return _0x4b46ce;};'use strict';var _=require(_0x145c('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x145c('0x1'));var exec=require(_0x145c('0x2'))[_0x145c('0x3')];var config=require(_0x145c('0x4'));function getInterfaces(){var _0x1891f0=[];var _0x43f497=os['networkInterfaces']();var _0x42564a=_[_0x145c('0x5')](_[_0x145c('0x6')](_0x43f497));for(var _0x49ba7f=0x0;_0x49ba7f<_0x42564a[_0x145c('0x7')];_0x49ba7f++){var _0x4a15aa=_0x43f497[_0x42564a[_0x49ba7f]][_0x145c('0x8')](function(_0x5e8871){return _0x5e8871[_0x145c('0x9')]===_0x145c('0xa')&&_0x5e8871['internal']===![];});_0x1891f0=_0x1891f0['concat'](_0x4a15aa);}return _0x1891f0;}function getFirstInterface(){var _0x107b5b=_['head'](getInterfaces());return{'macAddress':_0x107b5b&&_0x107b5b['mac']?_0x107b5b['mac']:_0x145c('0xb'),'ipAddress':_0x107b5b&&_0x107b5b[_0x145c('0xc')]?_0x107b5b[_0x145c('0xc')]:_0x145c('0xd')};}exports[_0x145c('0xe')]=getFirstInterface;function getCPUhash(){var _0x4b295f=_[_0x145c('0x5')](os[_0x145c('0xf')]()[_0x145c('0x10')](function(_0x287bce){return _0x287bce['model'];}))[_0x145c('0x11')](':');return crypto[_0x145c('0x12')]('md5')[_0x145c('0x13')](_0x4b295f)['digest'](_0x145c('0x14'));}exports['getUuid']=function(){var _0x20d7f0=os[_0x145c('0x15')]();var _0x47a449=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x47a449['test'](config[_0x145c('0x16')])){return config['licenseToken'];}else if(_0x20d7f0==='win32'){return exec(_0x145c('0x17'),{'encoding':'utf8'})[_0x145c('0x18')]('\x0d\x0a','');}else{var _0x4be284=getFirstInterface();var _0x29c129=getCPUhash();var _0x57222d=_0x29c129+'|'+os['hostname']()+'|'+_0x4be284['macAddress']+'|'+_0x4be284[_0x145c('0x19')];var _0x1f81a8=crypto[_0x145c('0x12')](_0x145c('0x1a'))[_0x145c('0x13')](_0x57222d)[_0x145c('0x1b')]('hex');return _0x1f81a8[_0x145c('0x1c')](0x0,0x8)+'-'+_0x1f81a8[_0x145c('0x1c')](0x8,0xc)+'-'+_0x1f81a8[_0x145c('0x1c')](0xc,0x10)+'-'+_0x1f81a8[_0x145c('0x1c')](0x10,0x14)+'-'+_0x1f81a8[_0x145c('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 027b83c..a90da28 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 _0x9915=['toUpperCase','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','then','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','get','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x9915,0x150));var _0x5991=function(_0x41eb29,_0x56ea18){_0x41eb29=_0x41eb29-0x0;var _0x4ae3f3=_0x9915[_0x41eb29];return _0x4ae3f3;};'use strict';var util=require(_0x5991('0x0'));var moment=require(_0x5991('0x1'));var rp=require('request-promise');var BPromise=require(_0x5991('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x5991('0x3'));var hardware=require('./hardware');var logger=require(_0x5991('0x4'))(_0x5991('0x5'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3d9afa){return new BPromise(function(_0x27e6ab,_0x384413){var _0x3401f1=util[_0x5991('0x6')](_0x5991('0x7'),HOST,_0x3d9afa,module['exports'][_0x5991('0x8')]);if(oldToken){_0x3401f1=util['format'](_0x5991('0x9'),HOST,_0x3d9afa,module[_0x5991('0xa')]['version'],oldToken);}var _0x69397c={'uri':_0x3401f1,'method':_0x5991('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x69397c)['then'](function(_0x152f9d){_0x27e6ab(_0x152f9d);})['catch'](function(_0x115a37){_0x384413(_0x115a37);});});}function manageLicense(_0x3939d7,_0xde79c4){var _0x340414=_0xde79c4[_0x5991('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x340414[_0x5991('0xd')]!==_0x3939d7&&!_0x340414['data2']){oldToken=_0x340414['data1'];}httpRequest(_0x3939d7)['then'](function(_0x13a736){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x13a736[_0x5991('0xe')]){isOldTokenSent=![];if(!_0x340414[_0x5991('0x5')]&&_0x340414[_0x5991('0x5')]!=_0x13a736['license']||_0x340414[_0x5991('0x5')]&&_0x340414['data2']){logger[_0x5991('0xf')](_0x5991('0x10'));}if(_0x340414[_0x5991('0x5')]&&!_0x340414[_0x5991('0x11')]&&_0x340414[_0x5991('0x5')]!=_0x13a736[_0x5991('0x5')]){logger[_0x5991('0xf')](_0x5991('0x12'));}if(_0x340414['license']&&!_0x340414['data2']&&_0x340414[_0x5991('0x5')]==_0x13a736[_0x5991('0x5')]){return _0xde79c4;}return _0xde79c4[_0x5991('0x13')]({'data1':_0x3939d7,'data2':null,'license':_0x13a736[_0x5991('0x5')]});}else{if(_0x13a736['license']||_0x340414[_0x5991('0x5')]){if(!_0x340414[_0x5991('0x11')]){if(_0x340414[_0x5991('0xd')]==_0x3939d7){GRAY_PERIOD_REASON=_0x5991('0x14');logger['info'](_0x5991('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x5991('0xf')](_0x5991('0x16'),_0x340414['data1'],_0x3939d7);}logger[_0x5991('0xf')](_0x5991('0x17'),GRAY_PERIOD_REASON[_0x5991('0x18')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0xde79c4[_0x5991('0x13')]({'data2':encryptor[_0x5991('0x19')](moment()[_0x5991('0x6')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x5991('0x1a')](encryptor['decryptString'](_0x340414['data2']),_0x5991('0x1b'))>DAYS){logger[_0x5991('0xf')](_0x5991('0x1c'),moment()[_0x5991('0x6')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xde79c4[_0x5991('0x13')]({'data1':_0x3939d7,'data2':null,'license':null});}}}else{if(_0x340414['data1']!=_0x3939d7){logger[_0x5991('0xf')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x340414[_0x5991('0xd')],_0x3939d7);return _0xde79c4[_0x5991('0x13')]({'data1':_0x3939d7,'data2':null,'license':null});}}}return _0xde79c4;})[_0x5991('0x1d')](function(_0x212dd9){_0xde79c4=_0x212dd9;})[_0x5991('0x1e')](function(_0xf2bb2a){logger[_0x5991('0x1f')](_0xf2bb2a[_0x5991('0x20')]);})[_0x5991('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x5991('0x22')](),_0xde79c4);},TIME);});}function defaultLicense(){var _0xcf5e42=hardware[_0x5991('0x22')]();if(_0xcf5e42){return db[_0x5991('0x23')][_0x5991('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xcf5e42}})[_0x5991('0x25')](function(_0xeab90b,_0x4514d0){logger[_0x5991('0xf')](_0x5991('0x26'),_0xcf5e42);manageLicense(_0xcf5e42,_0xeab90b);})[_0x5991('0x1e')](function(_0x3aeac2){logger[_0x5991('0x1f')](_0x3aeac2[_0x5991('0x20')]);});}}exports[_0x5991('0x27')]=defaultLicense; \ No newline at end of file +var _0x7169=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','moment','bluebird','version','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data2','data1','then'];(function(_0x4b627f,_0x139bd4){var _0x2951c2=function(_0x475533){while(--_0x475533){_0x4b627f['push'](_0x4b627f['shift']());}};_0x2951c2(++_0x139bd4);}(_0x7169,0xbc));var _0x9716=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7169[_0x5f09c5];return _0x426ad9;};'use strict';var util=require('util');var moment=require(_0x9716('0x0'));var rp=require('request-promise');var BPromise=require(_0x9716('0x1'));var pkginfo=require('pkginfo')(module,_0x9716('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x9716('0x3'));var logger=require(_0x9716('0x4'))(_0x9716('0x5'));var HOST=_0x9716('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5765a4){return new BPromise(function(_0x276b17,_0x198f84){var _0x298ff5=util[_0x9716('0x7')](_0x9716('0x8'),HOST,_0x5765a4,module[_0x9716('0x9')]['version']);if(oldToken){_0x298ff5=util[_0x9716('0x7')](_0x9716('0xa'),HOST,_0x5765a4,module[_0x9716('0x9')][_0x9716('0x2')],oldToken);}var _0x5a2268={'uri':_0x298ff5,'method':_0x9716('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x5a2268)['then'](function(_0x47878f){_0x276b17(_0x47878f);})[_0x9716('0xc')](function(_0x2b2956){_0x198f84(_0x2b2956);});});}function manageLicense(_0x5d9f91,_0x2df3e5){var _0x29eb88=_0x2df3e5['get']({'plain':!![]});if(!isOldTokenSent&&_0x29eb88['data1']!==_0x5d9f91&&!_0x29eb88[_0x9716('0xd')]){oldToken=_0x29eb88[_0x9716('0xe')];}httpRequest(_0x5d9f91)[_0x9716('0xf')](function(_0x53e0df){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x53e0df['active']){isOldTokenSent=![];if(!_0x29eb88[_0x9716('0x5')]&&_0x29eb88['license']!=_0x53e0df[_0x9716('0x5')]||_0x29eb88['license']&&_0x29eb88[_0x9716('0xd')]){logger['info'](_0x9716('0x10'));}if(_0x29eb88[_0x9716('0x5')]&&!_0x29eb88[_0x9716('0xd')]&&_0x29eb88[_0x9716('0x5')]!=_0x53e0df[_0x9716('0x5')]){logger[_0x9716('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x29eb88[_0x9716('0x5')]&&!_0x29eb88[_0x9716('0xd')]&&_0x29eb88['license']==_0x53e0df[_0x9716('0x5')]){return _0x2df3e5;}return _0x2df3e5[_0x9716('0x12')]({'data1':_0x5d9f91,'data2':null,'license':_0x53e0df[_0x9716('0x5')]});}else{if(_0x53e0df['license']||_0x29eb88[_0x9716('0x5')]){if(!_0x29eb88[_0x9716('0xd')]){if(_0x29eb88[_0x9716('0xe')]==_0x5d9f91){GRAY_PERIOD_REASON=_0x9716('0x13');logger['info'](_0x9716('0x14'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x29eb88['data1'],_0x5d9f91);}logger[_0x9716('0x11')](_0x9716('0x15'),GRAY_PERIOD_REASON[_0x9716('0x16')](),moment()[_0x9716('0x7')](_0x9716('0x17')));return _0x2df3e5[_0x9716('0x12')]({'data2':encryptor[_0x9716('0x18')](moment()[_0x9716('0x7')](_0x9716('0x17')))});}else{if(moment()[_0x9716('0x19')](encryptor['decryptString'](_0x29eb88[_0x9716('0xd')]),_0x9716('0x1a'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x9716('0x7')](_0x9716('0x17')));isOldTokenSent=![];return _0x2df3e5['update']({'data1':_0x5d9f91,'data2':null,'license':null});}}}else{if(_0x29eb88[_0x9716('0xe')]!=_0x5d9f91){logger[_0x9716('0x11')](_0x9716('0x1b'),_0x29eb88[_0x9716('0xe')],_0x5d9f91);return _0x2df3e5[_0x9716('0x12')]({'data1':_0x5d9f91,'data2':null,'license':null});}}}return _0x2df3e5;})[_0x9716('0xf')](function(_0x1052e7){_0x2df3e5=_0x1052e7;})['catch'](function(_0xea258e){logger[_0x9716('0x1c')](_0xea258e[_0x9716('0x1d')]);})[_0x9716('0x1e')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2df3e5);},TIME);});}function defaultLicense(){var _0x53c1a2=hardware[_0x9716('0x1f')]();if(_0x53c1a2){return db[_0x9716('0x20')][_0x9716('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x53c1a2}})['spread'](function(_0x48001f,_0x529452){logger[_0x9716('0x11')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x53c1a2);manageLicense(_0x53c1a2,_0x48001f);})[_0x9716('0xc')](function(_0x283292){logger[_0x9716('0x1c')](_0x283292[_0x9716('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 269e5a9..362fdea 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 _0xab78=['findAll','role','COUNT','sequelize','col','user','telephone','users','telephones','forEach','count','pick','countBy','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User'];(function(_0x200421,_0x327b9b){var _0x28c464=function(_0xd9a83b){while(--_0xd9a83b){_0x200421['push'](_0x200421['shift']());}};_0x28c464(++_0x327b9b);}(_0xab78,0x16f));var _0x8ab7=function(_0x1fd92d,_0x64061c){_0x1fd92d=_0x1fd92d-0x0;var _0x96f4a6=_0xab78[_0x1fd92d];return _0x96f4a6;};'use strict';var util=require(_0x8ab7('0x0'));var _=require(_0x8ab7('0x1'));var moment=require('moment');var BPromise=require(_0x8ab7('0x2'));var hardware=require(_0x8ab7('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x8ab7('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x8ab7('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8ab7('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8ab7('0x7'),'machineUuid':hardware[_0x8ab7('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4f5b4c){return new BPromise(function(_0x32b620,_0x5bd98d){return db[_0x8ab7('0x8')][_0x8ab7('0x9')](_['defaults'](_0x4f5b4c,{'raw':!![],'where':{'id':0x1}}))[_0x8ab7('0xa')](function(_0x57a5aa){return checkLicense(_0x57a5aa,null);})[_0x8ab7('0xa')](function(_0x1661c1){_0x32b620(_0x1661c1);return;})[_0x8ab7('0xb')](function(_0xbf8440){_0x5bd98d(_0xbf8440);});});}function checkLicense(_0x84717,_0x454f5f){if(!_0x84717){demoLicense['uuid']=_0x84717[_0x8ab7('0xc')];return demoLicense;}try{var _0x1ebb34=_0x454f5f||_0x84717['license'];if(_[_0x8ab7('0xd')](_0x1ebb34)){throw new Error(_0x8ab7('0xe'));}var _0x31b7c4=_0x84717[_0x8ab7('0xc')];var _0x3cb467=_0x84717[_0x8ab7('0xf')];var _0x1e443d=_0x31b7c4[_0x8ab7('0x10')]('-')[0x4];var _0x4444d1=_0x31b7c4[_0x8ab7('0x10')]('-')[0x0];var _0x18ad38=encryptor[_0x8ab7('0x11')](_0x1ebb34,util[_0x8ab7('0x12')](_0x8ab7('0x13'),_0x1e443d,_0x31b7c4,_0x4444d1));var _0x1d7606=JSON[_0x8ab7('0x14')](_0x18ad38);_0x1d7606[_0x8ab7('0x15')]=![];_0x1d7606[_0x8ab7('0x16')]=_0x31b7c4;_0x1d7606['machineUuid']=hardware[_0x8ab7('0x5')]();if(_0x3cb467){var _0xcf57fa=encryptor[_0x8ab7('0x11')](_0x3cb467);_0x1d7606[_0x8ab7('0x17')]=_0xcf57fa;_0x1d7606[_0x8ab7('0x18')]=moment(_0xcf57fa)[_0x8ab7('0x19')](0x7,_0x8ab7('0x1a'))['format']();_0x1d7606[_0x8ab7('0x1b')]=_0x1d7606[_0x8ab7('0x16')]!=_0x1d7606[_0x8ab7('0x1c')]?_0x8ab7('0x1d'):_0x8ab7('0x1e');}return _0x1d7606;}catch(_0x268851){breakingLicense[_0x8ab7('0x16')]=_0x84717['data1'];breakingLicense[_0x8ab7('0x1f')]=_0x268851[_0x8ab7('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3f1d1f,_0x406c09){getLicense()['then'](function(_0x2d8518){return db[_0x8ab7('0x20')][_0x8ab7('0x21')]({'attributes':[_0x8ab7('0x22'),[db['sequelize']['fn'](_0x8ab7('0x23'),db[_0x8ab7('0x24')][_0x8ab7('0x25')](_0x8ab7('0x22'))),'count']],'group':'role','where':{'role':{'$or':['admin',_0x8ab7('0x26'),_0x8ab7('0x27')]}},'raw':!![]})['then'](function(_0x2e4a3e){var _0x5e435e={'user':_0x2d8518[_0x8ab7('0x28')]||0x0,'telephone':_0x2d8518[_0x8ab7('0x29')]||0x0};_0x2e4a3e[_0x8ab7('0x2a')](function(_0x143e23){var _0xafd177=_0x143e23[_0x8ab7('0x22')]==='admin'?_0x8ab7('0x26'):_0x143e23['role'];_0x5e435e[_0xafd177]-=_0x143e23[_0x8ab7('0x2b')];if(_0x5e435e[_0xafd177]<0x0)_0x5e435e[_0xafd177]=0x0;});_0x3f1d1f(_0x5e435e);return;});})['catch'](function(_0x4f170e){_0x406c09(_0x4f170e);});});}function checkUserLimits(_0x446b73){return new BPromise(function(_0x1b62ed,_0x25096c){getLimits()[_0x8ab7('0xa')](function(_0x301b4a){var _0x30b302=_[_0x8ab7('0x2c')](_[_0x8ab7('0x2d')](_0x446b73,_0x8ab7('0x22')),[_0x8ab7('0x2e'),'user',_0x8ab7('0x27')]);var _0x49f255=(_0x30b302['admin']||0x0)+(_0x30b302[_0x8ab7('0x26')]||0x0);var _0x4d13e3=_0x30b302[_0x8ab7('0x27')]||0x0;if(_0x49f255>_0x301b4a[_0x8ab7('0x26')])return _0x25096c(_0x8ab7('0x2f'));if(_0x4d13e3>_0x301b4a[_0x8ab7('0x27')])return _0x25096c(_0x8ab7('0x30'));return _0x1b62ed();})['catch'](function(_0x3ad52c){_0x25096c(_0x3ad52c);});});}module[_0x8ab7('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x50c2=['catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','format','parse','uuid','machineUuid','decryptString','gray','deadline','days','grayReason','changed','message','User','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then'];(function(_0x301c7,_0x1e804b){var _0x2ee7bc=function(_0x16d2ab){while(--_0x16d2ab){_0x301c7['push'](_0x301c7['shift']());}};_0x2ee7bc(++_0x1e804b);}(_0x50c2,0x1a4));var _0x250c=function(_0x1201bd,_0x44ad0b){_0x1201bd=_0x1201bd-0x0;var _0x302b73=_0x50c2[_0x1201bd];return _0x302b73;};'use strict';var util=require(_0x250c('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x250c('0x1'));var encryptor=require(_0x250c('0x2'));var db=require(_0x250c('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x250c('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x250c('0x5'),'machineUuid':hardware[_0x250c('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x250c('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x250c('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x241ea9){return new BPromise(function(_0x545d64,_0xd65d5f){return db[_0x250c('0x7')][_0x250c('0x8')](_['defaults'](_0x241ea9,{'raw':!![],'where':{'id':0x1}}))[_0x250c('0x9')](function(_0x496961){return checkLicense(_0x496961,null);})[_0x250c('0x9')](function(_0x42238a){_0x545d64(_0x42238a);return;})[_0x250c('0xa')](function(_0x28e588){_0xd65d5f(_0x28e588);});});}function checkLicense(_0x35a3a6,_0x59c9e1){if(!_0x35a3a6){demoLicense['uuid']=_0x35a3a6[_0x250c('0xb')];return demoLicense;}try{var _0x46f34f=_0x59c9e1||_0x35a3a6[_0x250c('0xc')];if(_[_0x250c('0xd')](_0x46f34f)){throw new Error(_0x250c('0xe'));}var _0x1f58df=_0x35a3a6['data1'];var _0x534701=_0x35a3a6['data2'];var _0x587c91=_0x1f58df[_0x250c('0xf')]('-')[0x4];var _0x1b0394=_0x1f58df[_0x250c('0xf')]('-')[0x0];var _0x224cc5=encryptor['decryptString'](_0x46f34f,util[_0x250c('0x10')]('%s:%s:%s',_0x587c91,_0x1f58df,_0x1b0394));var _0x2ab751=JSON[_0x250c('0x11')](_0x224cc5);_0x2ab751['demo']=![];_0x2ab751[_0x250c('0x12')]=_0x1f58df;_0x2ab751[_0x250c('0x13')]=hardware[_0x250c('0x6')]();if(_0x534701){var _0x41d0c7=encryptor[_0x250c('0x14')](_0x534701);_0x2ab751[_0x250c('0x15')]=_0x41d0c7;_0x2ab751[_0x250c('0x16')]=moment(_0x41d0c7)['add'](0x7,_0x250c('0x17'))[_0x250c('0x10')]();_0x2ab751[_0x250c('0x18')]=_0x2ab751[_0x250c('0x12')]!=_0x2ab751[_0x250c('0x13')]?_0x250c('0x19'):'disabled';}return _0x2ab751;}catch(_0x48810e){breakingLicense[_0x250c('0x12')]=_0x35a3a6[_0x250c('0xb')];breakingLicense[_0x250c('0x1a')]=_0x48810e[_0x250c('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x35285a,_0x16fc43){getLicense()['then'](function(_0x43e9a6){return db[_0x250c('0x1b')][_0x250c('0x1c')]({'attributes':[_0x250c('0x1d'),[db[_0x250c('0x1e')]['fn']('COUNT',db[_0x250c('0x1e')][_0x250c('0x1f')](_0x250c('0x1d'))),_0x250c('0x20')]],'group':'role','where':{'role':{'$or':[_0x250c('0x21'),_0x250c('0x22'),_0x250c('0x23')]}},'raw':!![]})[_0x250c('0x9')](function(_0x282d60){var _0x4f8769={'user':_0x43e9a6[_0x250c('0x24')]||0x0,'telephone':_0x43e9a6[_0x250c('0x25')]||0x0};_0x282d60[_0x250c('0x26')](function(_0x2ce362){var _0x317072=_0x2ce362[_0x250c('0x1d')]===_0x250c('0x21')?'user':_0x2ce362[_0x250c('0x1d')];_0x4f8769[_0x317072]-=_0x2ce362['count'];if(_0x4f8769[_0x317072]<0x0)_0x4f8769[_0x317072]=0x0;});_0x35285a(_0x4f8769);return;});})[_0x250c('0xa')](function(_0x49c17d){_0x16fc43(_0x49c17d);});});}function checkUserLimits(_0x29d9ce){return new BPromise(function(_0x23e7ae,_0x32fa9c){getLimits()[_0x250c('0x9')](function(_0x54421c){var _0x1bd1c2=_['pick'](_[_0x250c('0x27')](_0x29d9ce,_0x250c('0x1d')),[_0x250c('0x21'),_0x250c('0x22'),_0x250c('0x23')]);var _0x26d1a4=(_0x1bd1c2[_0x250c('0x21')]||0x0)+(_0x1bd1c2[_0x250c('0x22')]||0x0);var _0x27c2d9=_0x1bd1c2[_0x250c('0x23')]||0x0;if(_0x26d1a4>_0x54421c[_0x250c('0x22')])return _0x32fa9c(_0x250c('0x28'));if(_0x27c2d9>_0x54421c[_0x250c('0x23')])return _0x32fa9c(_0x250c('0x29'));return _0x23e7ae();})[_0x250c('0xa')](function(_0x57d7a0){_0x32fa9c(_0x57d7a0);});});}module[_0x250c('0x2a')]={'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 8f6e358..0cf4f91 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 _0x7916=['myappanuglar-secret','app-id','exports'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x7916,0x128));var _0x6791=function(_0x193d38,_0x5d4cad){_0x193d38=_0x193d38-0x0;var _0x1294b8=_0x7916[_0x193d38];return _0x1294b8;};'use strict';module[_0x6791('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x6791('0x1'),'GOOGLE_ID':_0x6791('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x757a=['http://localhost:9000','myappanuglar-secret'];(function(_0x1f41dd,_0x5ae579){var _0x427535=function(_0x25a76a){while(--_0x25a76a){_0x1f41dd['push'](_0x1f41dd['shift']());}};_0x427535(++_0x5ae579);}(_0x757a,0xde));var _0xa757=function(_0x2db088,_0x118141){_0x2db088=_0x2db088-0x0;var _0x36f1a7=_0x757a[_0x2db088];return _0x36f1a7;};'use strict';module['exports']={'DOMAIN':_0xa757('0x0'),'SESSION_SECRET':_0xa757('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9ba7362..ac5291c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x268d=['../utils/loggers','fileLogger'];(function(_0x153299,_0x380065){var _0x698056=function(_0x5654c4){while(--_0x5654c4){_0x153299['push'](_0x153299['shift']());}};_0x698056(++_0x380065);}(_0x268d,0x158));var _0xd268=function(_0x41603d,_0xfb9ad8){_0x41603d=_0x41603d-0x0;var _0x239700=_0x268d[_0x41603d];return _0x239700;};'use strict';var fileLogger=require(_0xd268('0x0'))[_0xd268('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xd961=['../utils/loggers','exports'];(function(_0x102dd1,_0x582a9f){var _0x4cbb39=function(_0x1007cd){while(--_0x1007cd){_0x102dd1['push'](_0x102dd1['shift']());}};_0x4cbb39(++_0x582a9f);}(_0xd961,0xc2));var _0x1d96=function(_0x4595c7,_0x1dfd25){_0x4595c7=_0x4595c7-0x0;var _0x506697=_0xd961[_0x4595c7];return _0x506697;};'use strict';var fileLogger=require(_0x1d96('0x0'))['fileLogger'];module[_0x1d96('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5ace1f5..ab0175d 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 _0x572f=['root','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','resolve'];(function(_0xda582b,_0x27008d){var _0x57abfb=function(_0x55e7fe){while(--_0x55e7fe){_0xda582b['push'](_0xda582b['shift']());}};_0x57abfb(++_0x27008d);}(_0x572f,0x154));var _0xf572=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x572f[_0x42cae2];return _0x5f256f;};'use strict';var path=require(_0xf572('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xf572('0x1')](path['join'](cfg[_0xf572('0x2')],_0xf572('0x3')))};var pm2config={'apps':[{'name':_0xf572('0x4'),'script':path[_0xf572('0x5')](__dirname,_0xf572('0x6')),'env':env},{'name':_0xf572('0x7'),'script':path[_0xf572('0x5')](__dirname,_0xf572('0x8')),'env':env},{'name':_0xf572('0x9'),'script':path['join'](__dirname,_0xf572('0xa')),'env':env},{'name':_0xf572('0xb'),'script':path[_0xf572('0x5')](__dirname,_0xf572('0xc')),'env':env},{'name':_0xf572('0xd'),'script':path[_0xf572('0x5')](__dirname,_0xf572('0xe')),'env':env},{'name':_0xf572('0xf'),'script':path[_0xf572('0x5')](__dirname,_0xf572('0x10')),'env':env}]};module[_0xf572('0x11')]=pm2config; \ No newline at end of file +var _0x5373=['../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','../../config/environment','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x5a1d97,_0x265b5a){var _0x401646=function(_0x4dd898){while(--_0x4dd898){_0x5a1d97['push'](_0x5a1d97['shift']());}};_0x401646(++_0x265b5a);}(_0x5373,0xe7));var _0x3537=function(_0x4d863e,_0x49c467){_0x4d863e=_0x4d863e-0x0;var _0x2a1394=_0x5373[_0x4d863e];return _0x2a1394;};'use strict';var path=require(_0x3537('0x0'));var cfg=require(_0x3537('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x3537('0x2')](cfg[_0x3537('0x3')],_0x3537('0x4')))};var pm2config={'apps':[{'name':_0x3537('0x5'),'script':path[_0x3537('0x2')](__dirname,_0x3537('0x6')),'env':env},{'name':_0x3537('0x7'),'script':path[_0x3537('0x2')](__dirname,_0x3537('0x8')),'env':env},{'name':'agi','script':path[_0x3537('0x2')](__dirname,_0x3537('0x9')),'env':env},{'name':_0x3537('0xa'),'script':path[_0x3537('0x2')](__dirname,_0x3537('0xb')),'env':env},{'name':'routing','script':path[_0x3537('0x2')](__dirname,_0x3537('0xc')),'env':env},{'name':'xdr','script':path[_0x3537('0x2')](__dirname,_0x3537('0xd')),'env':env}]};module[_0x3537('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c5e9007..a35385a 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 _0x1286=['list','describe','delete','dump','saved','pm2','bluebird','connected','start','then','disconnect','stop','restart'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1286,0x116));var _0x6128=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x1286[_0x581249];return _0x284bae;};'use strict';var pm2=require(_0x6128('0x0'));var BPromise=require(_0x6128('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x129983,_0x10c207){return pm2['connect'](function(_0x5f95d2){if(_0x5f95d2){return _0x10c207(_0x5f95d2);}return _0x129983(_0x6128('0x2'));});});};exports[_0x6128('0x3')]=function(_0x46f7a4){return connect()[_0x6128('0x4')](function(){return new BPromise(function(_0xba176a,_0x105081){return pm2[_0x6128('0x3')](_0x46f7a4,function(_0x5dd65f,_0x13fe08){if(_0x5dd65f){return _0x105081(_0x5dd65f);}pm2[_0x6128('0x5')]();return _0xba176a(_0x13fe08);});});});};exports[_0x6128('0x6')]=function(_0x327e2f){return connect()['then'](function(){return new BPromise(function(_0x5d1de5,_0x503899){return pm2[_0x6128('0x6')](_0x327e2f,function(_0x50391e,_0xd1a333){if(_0x50391e){return _0x503899(_0x50391e);}pm2[_0x6128('0x5')]();return _0x5d1de5(_0xd1a333);});});});};exports[_0x6128('0x7')]=function(_0x4cf56b){return connect()[_0x6128('0x4')](function(){return new BPromise(function(_0x13b2db,_0x515a8f){return pm2[_0x6128('0x7')](_0x4cf56b,function(_0x3d0543,_0x163956){if(_0x3d0543){return _0x515a8f(_0x3d0543);}pm2[_0x6128('0x5')]();return _0x13b2db(_0x163956);});});});};exports[_0x6128('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3aaeb8,_0x2aeb21){return pm2[_0x6128('0x8')](function(_0x321ac1,_0x192657){if(_0x321ac1){return _0x2aeb21(_0x321ac1);}pm2['disconnect']();return _0x3aaeb8(_0x192657);});});});};exports['describe']=function(_0x364f9d){return connect()['then'](function(){return new BPromise(function(_0x1ce03c,_0x5e7ea7){return pm2[_0x6128('0x9')](_0x364f9d,function(_0xbc8cbb,_0x12eab4){if(_0xbc8cbb){return _0x5e7ea7(_0xbc8cbb);}pm2[_0x6128('0x5')]();return _0x1ce03c(_0x12eab4);});});});};exports[_0x6128('0xa')]=function(_0x486853){return connect()['then'](function(){return new BPromise(function(_0x475ea4,_0x34993e){return pm2[_0x6128('0xa')](_0x486853,function(_0x5eb199,_0x504ebe){if(_0x5eb199){return _0x34993e(_0x5eb199);}pm2[_0x6128('0x5')]();return _0x475ea4(_0x504ebe);});});});};exports[_0x6128('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x57a26f,_0x48bc74){return pm2[_0x6128('0xb')](function(_0x5330b7){if(_0x5330b7){return _0x48bc74(_0x5330b7);}return _0x57a26f(_0x6128('0xc'));});});});}; \ No newline at end of file +var _0xfb9a=['./config','connect','connected','stop','then','disconnect','restart','list','describe','delete','dump','saved','bluebird'];(function(_0x1f1b75,_0x27bc90){var _0x47db21=function(_0x35d611){while(--_0x35d611){_0x1f1b75['push'](_0x1f1b75['shift']());}};_0x47db21(++_0x27bc90);}(_0xfb9a,0x1d3));var _0xafb9=function(_0x4a8f4f,_0xe38feb){_0x4a8f4f=_0x4a8f4f-0x0;var _0x334cc4=_0xfb9a[_0x4a8f4f];return _0x334cc4;};'use strict';var pm2=require('pm2');var BPromise=require(_0xafb9('0x0'));var config=require(_0xafb9('0x1'));function connect(){return new BPromise(function(_0x12c40f,_0x115ddc){return pm2[_0xafb9('0x2')](function(_0x4ffde1){if(_0x4ffde1){return _0x115ddc(_0x4ffde1);}return _0x12c40f(_0xafb9('0x3'));});});};exports['start']=function(_0x51b770){return connect()['then'](function(){return new BPromise(function(_0x13444b,_0x1b6263){return pm2['start'](_0x51b770,function(_0x32f49c,_0xf3e1c1){if(_0x32f49c){return _0x1b6263(_0x32f49c);}pm2['disconnect']();return _0x13444b(_0xf3e1c1);});});});};exports[_0xafb9('0x4')]=function(_0x924718){return connect()[_0xafb9('0x5')](function(){return new BPromise(function(_0x18505c,_0xff13ba){return pm2[_0xafb9('0x4')](_0x924718,function(_0x3cf487,_0x4bdbea){if(_0x3cf487){return _0xff13ba(_0x3cf487);}pm2[_0xafb9('0x6')]();return _0x18505c(_0x4bdbea);});});});};exports[_0xafb9('0x7')]=function(_0x1b2bf1){return connect()['then'](function(){return new BPromise(function(_0x537e8c,_0x2264af){return pm2[_0xafb9('0x7')](_0x1b2bf1,function(_0x5ca284,_0x381dc6){if(_0x5ca284){return _0x2264af(_0x5ca284);}pm2[_0xafb9('0x6')]();return _0x537e8c(_0x381dc6);});});});};exports[_0xafb9('0x8')]=function(){return connect()[_0xafb9('0x5')](function(){return new BPromise(function(_0x3490ed,_0x15298a){return pm2['list'](function(_0x4c60ad,_0x43619f){if(_0x4c60ad){return _0x15298a(_0x4c60ad);}pm2[_0xafb9('0x6')]();return _0x3490ed(_0x43619f);});});});};exports[_0xafb9('0x9')]=function(_0xe2c5ff){return connect()['then'](function(){return new BPromise(function(_0x36dcc9,_0x4747f4){return pm2[_0xafb9('0x9')](_0xe2c5ff,function(_0xe6622,_0x47672a){if(_0xe6622){return _0x4747f4(_0xe6622);}pm2['disconnect']();return _0x36dcc9(_0x47672a);});});});};exports[_0xafb9('0xa')]=function(_0x3404fe){return connect()['then'](function(){return new BPromise(function(_0x4d63a5,_0x596b3b){return pm2[_0xafb9('0xa')](_0x3404fe,function(_0x55e1ff,_0xa36603){if(_0x55e1ff){return _0x596b3b(_0x55e1ff);}pm2[_0xafb9('0x6')]();return _0x4d63a5(_0xa36603);});});});};exports[_0xafb9('0xb')]=function(){return connect()[_0xafb9('0x5')](function(){return new BPromise(function(_0x5d8548,_0x49d43c){return pm2[_0xafb9('0xb')](function(_0x567ba5){if(_0x567ba5){return _0x49d43c(_0x567ba5);}return _0x5d8548(_0xafb9('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 73906a0..02d96d9 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 _0x0791=['format','YYYY-MM-DD\x20HH:mm:ss','length','join','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','redis','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','map','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','timeout'];(function(_0x1e1b1d,_0x7a2644){var _0x257147=function(_0x58b972){while(--_0x58b972){_0x1e1b1d['push'](_0x1e1b1d['shift']());}};_0x257147(++_0x7a2644);}(_0x0791,0x1a1));var _0x1079=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x0791[_0x58a4ac];return _0x545810;};'use strict';var _=require(_0x1079('0x0'));var moment=require(_0x1079('0x1'));var Redis=require(_0x1079('0x2'));var util=require(_0x1079('0x3'));var config=require(_0x1079('0x4'));var db=require(_0x1079('0x5'))['db'];var logger=require(_0x1079('0x6'))(_0x1079('0x7'));config['redis']=_[_0x1079('0x8')](config['redis'],{'host':_0x1079('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1079('0xa')]));function closeInteractions(){var _0x445d8d=0x0;var _0x7b202=[];return db[_0x1079('0xb')][_0x1079('0xc')]({'raw':!![],'attributes':['id',_0x1079('0xd')],'where':{'id':0x1}})[_0x1079('0xe')](function(_0x1ad163){_0x445d8d=_0x1ad163['chatTimeout'];if(_0x445d8d){return db['ChatInteraction'][_0x1079('0xf')]({'raw':!![],'attributes':['id',_0x1079('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1079('0x11')](_0x1ad163[_0x1079('0xd')],'minutes')}}});}else{return[];}})['then'](function(_0x4e0c13){if(_0x4e0c13&&_0x4e0c13['length']){_0x7b202=_[_0x1079('0x12')](_0x4e0c13||[],'id');logger[_0x1079('0x13')](_0x1079('0x14'),_0x7b202['join']());return db[_0x1079('0x15')][_0x1079('0x16')]({'closeReason':_0x1079('0x17'),'disposition':_0x1079('0x18'),'closed':!![],'closedAt':moment()[_0x1079('0x19')](_0x1079('0x1a'))},{'where':{'id':_0x7b202}});}})[_0x1079('0xe')](function(){if(_0x7b202&&_0x7b202[_0x1079('0x1b')]){logger[_0x1079('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x7b202[_0x1079('0x1c')]());for(var _0x90180e=0x0;_0x90180e<_0x7b202[_0x1079('0x1b')];_0x90180e++){io['emit'](_0x1079('0x1d'),{'id':_0x7b202[_0x90180e],'closed':!![]});}}})[_0x1079('0x1e')](function(_0x1398dc){logger[_0x1079('0x1f')](_0x1079('0x20'),_0x1398dc?util['inspect'](_0x1398dc,{'showHidden':![],'depth':null}):'');});}exports[_0x1079('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x86d1=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x86d1,0x17c));var _0x186d=function(_0x410d5e,_0x5e9946){_0x410d5e=_0x410d5e-0x0;var _0xac4e89=_0x86d1[_0x410d5e];return _0xac4e89;};'use strict';var _=require(_0x186d('0x0'));var moment=require(_0x186d('0x1'));var Redis=require(_0x186d('0x2'));var util=require(_0x186d('0x3'));var config=require(_0x186d('0x4'));var db=require(_0x186d('0x5'))['db'];var logger=require(_0x186d('0x6'))(_0x186d('0x7'));config[_0x186d('0x8')]=_['defaults'](config[_0x186d('0x8')],{'host':_0x186d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x186d('0x8')]));function closeInteractions(){var _0x4b550b=0x0;var _0x3e5842=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x186d('0xa')],'where':{'id':0x1}})[_0x186d('0xb')](function(_0x34fc0a){_0x4b550b=_0x34fc0a[_0x186d('0xa')];if(_0x4b550b){return db['ChatInteraction'][_0x186d('0xc')]({'raw':!![],'attributes':['id',_0x186d('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x186d('0xe')](_0x34fc0a[_0x186d('0xa')],_0x186d('0xf'))}}});}else{return[];}})['then'](function(_0x4cdfa7){if(_0x4cdfa7&&_0x4cdfa7[_0x186d('0x10')]){_0x3e5842=_[_0x186d('0x11')](_0x4cdfa7||[],'id');logger[_0x186d('0x12')](_0x186d('0x13'),_0x3e5842[_0x186d('0x14')]());return db[_0x186d('0x15')][_0x186d('0x16')]({'closeReason':_0x186d('0x17'),'disposition':_0x186d('0x18'),'closed':!![],'closedAt':moment()[_0x186d('0x19')](_0x186d('0x1a'))},{'where':{'id':_0x3e5842}});}})['then'](function(){if(_0x3e5842&&_0x3e5842[_0x186d('0x10')]){logger[_0x186d('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3e5842[_0x186d('0x14')]());for(var _0xbf33ee=0x0;_0xbf33ee<_0x3e5842['length'];_0xbf33ee++){io['emit'](_0x186d('0x1b'),{'id':_0x3e5842[_0xbf33ee],'closed':!![]});}}})['catch'](function(_0x28f215){logger['error'](_0x186d('0x1c'),_0x28f215?util[_0x186d('0x1d')](_0x28f215,{'showHidden':![],'depth':null}):'');});}exports[_0x186d('0x1e')]=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 4c71555..9488245 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 _0x5c09=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x11025b,_0x2e5cf5){var _0x54b836=function(_0x38117c){while(--_0x38117c){_0x11025b['push'](_0x11025b['shift']());}};_0x54b836(++_0x2e5cf5);}(_0x5c09,0x15d));var _0x95c0=function(_0x1efc32,_0x404db2){_0x1efc32=_0x1efc32-0x0;var _0x46702a=_0x5c09[_0x1efc32];return _0x46702a;};'use strict';function start(){var _0x406eab=require(_0x95c0('0x0'));return _0x406eab['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x5391=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0x5391,0x12a));var _0x1539=function(_0x1cfc75,_0x4649c2){_0x1cfc75=_0x1cfc75-0x0;var _0x15484b=_0x5391[_0x1cfc75];return _0x15484b;};'use strict';function start(){var _0x2d3e23=require(_0x1539('0x0'));return _0x2d3e23[_0x1539('0x1')]();}module[_0x1539('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 358ff18..d165ced 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 _0x6c4f=['text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','catch','error\x20mail','stringify','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','toString','keyBy','difference','intersection','exists','stop','delete\x20cron','toRun','length','index','my\x20id','resolve','isBetween','start','add\x20cron','stop\x20cron','cron','startAt','endAt','update','update\x20cron','run','util','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','format','name','MailAccount','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','message','attachments'];(function(_0x5ec91d,_0x151905){var _0xa1c14c=function(_0x32fd28){while(--_0x32fd28){_0x5ec91d['push'](_0x5ec91d['shift']());}};_0xa1c14c(++_0x151905);}(_0x6c4f,0x17b));var _0xf6c4=function(_0x426cab,_0x25fea1){_0x426cab=_0x426cab-0x0;var _0x589794=_0x6c4f[_0x426cab];return _0x589794;};'use strict';var fs=require('fs');var util=require(_0xf6c4('0x0'));var path=require('path');var _=require(_0xf6c4('0x1'));var moment=require(_0xf6c4('0x2'));var CronJobManager=require(_0xf6c4('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xf6c4('0x4'))(_0xf6c4('0x5'));var db=require(_0xf6c4('0x6'))['db'];var analyticCustomReportController=require(_0xf6c4('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xf6c4('0x8')][_0xf6c4('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2c2974,_0x385b54){return function(){logger[_0xf6c4('0xa')](_0xf6c4('0xb'),_0x2c2974[_0xf6c4('0xc')]);var _0x50281d=!![];var _0x95e584=_0x2c2974['MailAccount']['getSmtpOptions']();var _0x43e646={'account':_0x95e584,'message':{'from':util[_0xf6c4('0xd')]('\x22%s\x22\x20<%s>',_0x2c2974['MailAccount'][_0xf6c4('0xe')],_0x2c2974[_0xf6c4('0xf')]['email']||_0x2c2974['MailAccount'][_0xf6c4('0x10')]['user']),'to':_0x2c2974[_0xf6c4('0xc')],'cc':_0x2c2974['cc'],'bcc':_0x2c2974[_0xf6c4('0x11')],'subject':util[_0xf6c4('0xd')](_0xf6c4('0x12'),_0x385b54['name'],_0x2c2974['subtractNumber'],_0x2c2974[_0xf6c4('0x13')])}};var _0x29b470=path[_0xf6c4('0x14')](__dirname,_0xf6c4('0x15'));var _0x3bd719=_0x385b54[_0xf6c4('0x16')];var _0x20cdd8=util[_0xf6c4('0xd')](_0xf6c4('0x17'),path['basename'](_0x385b54[_0xf6c4('0x16')],path[_0xf6c4('0x18')](_0x385b54[_0xf6c4('0x16')])),_0xf6c4('0x19'));var _0x5105c5=path[_0xf6c4('0x14')](_0x29b470,_0x3bd719);var _0x5cba4b=path[_0xf6c4('0x14')](_0x29b470,_0x20cdd8);if(fs[_0xf6c4('0x1a')](_0x5105c5)){_0x385b54[_0xf6c4('0x1b')]=_0xf6c4('0x1c');_0x43e646[_0xf6c4('0x1d')][_0xf6c4('0x1e')]=[{'filename':_0x3bd719,'path':_0x5105c5}];_0x43e646['message'][_0xf6c4('0x1f')]=util[_0xf6c4('0xd')](_0xf6c4('0x20'),JSON['stringify'](_0x385b54,null,0x2));}else if(fs[_0xf6c4('0x1a')](_0x5cba4b)){_0x385b54['status']=_0xf6c4('0x1c');_0x43e646[_0xf6c4('0x1d')]['attachments']=[{'filename':_0x20cdd8,'path':_0x5cba4b}];}else{_0x43e646['message'][_0xf6c4('0x1f')]=_0xf6c4('0x21');if(!_0x2c2974[_0xf6c4('0x22')]){_0x50281d=![];logger[_0xf6c4('0xa')](_0xf6c4('0x23'));}}if(_0x50281d){return client['request'](_0xf6c4('0x24'),_0x43e646)[_0xf6c4('0x25')](function(_0x4d3685){if(_0x4d3685['error']){return logger[_0xf6c4('0x26')]('error\x20mail',JSON['stringify'](_0x4d3685));}return logger[_0xf6c4('0xa')]('email\x20sent');})[_0xf6c4('0x27')](function(_0x399f68){return logger[_0xf6c4('0x26')](_0xf6c4('0x28'),JSON[_0xf6c4('0x29')](_0x399f68));});}};}function handleError(){return function(_0x102a9b){return logger[_0xf6c4('0x26')](JSON[_0xf6c4('0x29')](_0x102a9b));};}function handleResult(_0x5af0cc){return function(_0x3a5177){logger[_0xf6c4('0xa')](_0xf6c4('0x2a'),JSON[_0xf6c4('0x29')](_0x3a5177));if(_0x5af0cc['MailAccount']&&_0x5af0cc[_0xf6c4('0xf')][_0xf6c4('0x10')]&&!_[_0xf6c4('0x2b')](_0x5af0cc[_0xf6c4('0xc')])){setTimeout(handleSendEmail(_0x5af0cc,_0x3a5177),0x3c*0x3e8);}};}function handleJob(_0x3d980c){return function(){try{if(_[_0xf6c4('0x2b')](_0x3d980c[_0xf6c4('0x2c')])){return logger[_0xf6c4('0xa')](_0xf6c4('0x2d'));}if(_[_0xf6c4('0x2b')](_0x3d980c[_0xf6c4('0x13')])){return logger[_0xf6c4('0xa')](_0xf6c4('0x2e'));}var _0x5f27cc={'startDate':moment()[_0xf6c4('0x2f')](_0x3d980c['subtractNumber'],_0x3d980c[_0xf6c4('0x13')])[_0xf6c4('0xd')](_0xf6c4('0x30')),'endDate':moment()[_0xf6c4('0xd')](_0xf6c4('0x30')),'type':_0xf6c4('0x31'),'output':_0x3d980c[_0xf6c4('0x32')],'name':_0x3d980c['name']};if(!_[_0xf6c4('0x2b')](_0x3d980c[_0xf6c4('0x33')])){logger[_0xf6c4('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x3d980c[_0xf6c4('0x33')]);return analyticDefaultReportController[_0xf6c4('0x34')]({'id':_0x3d980c[_0xf6c4('0x33')]},_0x5f27cc)['then'](handleResult(_0x3d980c))[_0xf6c4('0x27')](handleError());}if(!_[_0xf6c4('0x2b')](_0x3d980c[_0xf6c4('0x35')])){logger[_0xf6c4('0xa')]('exec\x20custom\x20report\x20id:%s',_0x3d980c['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x3d980c[_0xf6c4('0x35')]},_0x5f27cc)[_0xf6c4('0x25')](handleResult(_0x3d980c))[_0xf6c4('0x27')](handleError());}}catch(_0x221c6f){logger[_0xf6c4('0x26')](JSON[_0xf6c4('0x29')](_0x221c6f));}return logger[_0xf6c4('0xa')](_0xf6c4('0x36'));};}function getJobs(_0x5ecaa6){var _0x348bde={};if(_0x5ecaa6){_0x348bde['id']=_0x5ecaa6;}return db[_0xf6c4('0x37')][_0xf6c4('0x38')]({'where':_0x348bde,'include':[{'model':db[_0xf6c4('0xf')],'attributes':['id',_0xf6c4('0xe'),_0xf6c4('0xc')],'include':[{'model':db[_0xf6c4('0x39')],'as':_0xf6c4('0x10'),'include':[{'model':db[_0xf6c4('0x3a')],'as':_0xf6c4('0x3a')}]}]}]})['then'](function(_0x487f16){var _0x2d1ce4=_['keys'](manager[_0xf6c4('0x3b')]);var _0x456ff4=_['map'](_0x487f16,function(_0x27d5ff){return _0x27d5ff['id'][_0xf6c4('0x3c')]();});var _0x1c89a9=_[_0xf6c4('0x3d')](_0x487f16,function(_0x1dd082){return _0x1dd082['id'][_0xf6c4('0x3c')]();});var _0x444747=_0x5ecaa6?_0x456ff4:_[_0xf6c4('0x3e')](_0x456ff4,_0x2d1ce4);var _0x16e1c9=_[_0xf6c4('0x3f')](_0x456ff4,_0x2d1ce4);var _0x12d678=_[_0xf6c4('0x3e')](_0x2d1ce4,_0x456ff4);var _0x3355d3;var _0x5b167e;for(_0x3355d3=0x0;_0x3355d3<_0x12d678['length']&&!_0x5ecaa6;_0x3355d3+=0x1){_0x5b167e=_0x12d678[_0x3355d3]['toString']();if(manager[_0xf6c4('0x40')](_0x5b167e)){manager[_0xf6c4('0x41')](_0x5b167e);manager['deleteJob'](_0x5b167e);logger[_0xf6c4('0xa')](_0xf6c4('0x42'),_0x5b167e);}}logger[_0xf6c4('0xa')](_0xf6c4('0x43'),JSON[_0xf6c4('0x29')](_0x444747));for(_0x3355d3=0x0;_0x3355d3<_0x444747[_0xf6c4('0x44')];_0x3355d3+=0x1){_0x5b167e=_0x444747[_0x3355d3][_0xf6c4('0x3c')]();logger[_0xf6c4('0xa')](_0xf6c4('0x45'),_0x5b167e);if(_0x5ecaa6){logger['info'](_0xf6c4('0x46'),_0x5ecaa6);logger['info'](JSON[_0xf6c4('0x29')](_0x1c89a9[_0x5b167e]));BPromise[_0xf6c4('0x47')]()[_0xf6c4('0x25')](handleJob(_0x1c89a9[_0x5b167e]));logger[_0xf6c4('0xa')]('run\x20job',_0x1c89a9[_0x5b167e][_0xf6c4('0xe')],_0x1c89a9[_0x5b167e]['cron']);}else if(_0x1c89a9[_0x5b167e]['cron']&&_0x1c89a9[_0x5b167e]['active']&&moment()[_0xf6c4('0x48')](_0x1c89a9[_0x5b167e]['startAt'],_0x1c89a9[_0x5b167e]['endAt'])){manager['add'](_0x5b167e,_0x1c89a9[_0x5b167e]['cron'],handleJob(_0x1c89a9[_0x5b167e]));manager[_0xf6c4('0x49')](_0x5b167e);logger[_0xf6c4('0xa')](_0xf6c4('0x4a'),_0x1c89a9[_0x5b167e]['name'],_0x1c89a9[_0x5b167e]['cron']);}else if(manager[_0xf6c4('0x40')](_0x5b167e)){manager[_0xf6c4('0x41')](_0x5b167e);manager['deleteJob'](_0x5b167e);logger[_0xf6c4('0xa')](_0xf6c4('0x4b'),_0x1c89a9[_0x5b167e]['name'],_0x1c89a9[_0x5b167e][_0xf6c4('0x4c')]);}}for(_0x3355d3=0x0,_0x5b167e;_0x3355d3<_0x16e1c9['length']&&!_0x5ecaa6;_0x3355d3+=0x1){_0x5b167e=_0x16e1c9[_0x3355d3][_0xf6c4('0x3c')]();if(manager[_0xf6c4('0x40')](_0x5b167e)){if(_0x1c89a9[_0x5b167e][_0xf6c4('0x4c')]&&_0x1c89a9[_0x5b167e]['active']&&moment()[_0xf6c4('0x48')](_0x1c89a9[_0x5b167e][_0xf6c4('0x4d')],_0x1c89a9[_0x5b167e][_0xf6c4('0x4e')])){manager[_0xf6c4('0x4f')](_0x5b167e,_0x1c89a9[_0x5b167e][_0xf6c4('0x4c')],handleJob(_0x1c89a9[_0x5b167e]));logger['info'](_0xf6c4('0x50'),_0x1c89a9[_0x5b167e]['name'],_0x1c89a9[_0x5b167e]['cron']);}else{manager[_0xf6c4('0x41')](_0x5b167e);manager['deleteJob'](_0x5b167e);logger[_0xf6c4('0xa')](_0xf6c4('0x4b'),_0x1c89a9[_0x5b167e][_0xf6c4('0xe')],_0x1c89a9[_0x5b167e]['cron']);}}}})[_0xf6c4('0x27')](function(_0x4bae5f){logger[_0xf6c4('0x26')](JSON[_0xf6c4('0x29')](_0x4bae5f));});}exports[_0xf6c4('0x51')]=function(_0x85e06a){return getJobs(_0x85e06a);};exports[_0xf6c4('0x49')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xfbae=['output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','index','run\x20job','cron','active','endAt','start','add\x20cron','exists','stop\x20cron','startAt','update','update\x20cron','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled'];(function(_0xa3d5bd,_0x231305){var _0x4a87a0=function(_0x5c9648){while(--_0x5c9648){_0xa3d5bd['push'](_0xa3d5bd['shift']());}};_0x4a87a0(++_0x231305);}(_0xfbae,0xc1));var _0xefba=function(_0x17082b,_0x98e92f){_0x17082b=_0x17082b-0x0;var _0x39f36a=_0xfbae[_0x17082b];return _0x39f36a;};'use strict';var fs=require('fs');var util=require(_0xefba('0x0'));var path=require(_0xefba('0x1'));var _=require(_0xefba('0x2'));var moment=require('moment');var CronJobManager=require(_0xefba('0x3'));var jayson=require(_0xefba('0x4'));var BPromise=require(_0xefba('0x5'));var logger=require(_0xefba('0x6'))(_0xefba('0x7'));var db=require(_0xefba('0x8'))['db'];var analyticCustomReportController=require(_0xefba('0x9'));var analyticDefaultReportController=require(_0xefba('0xa'));var client=jayson[_0xefba('0xb')][_0xefba('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x98bb5d,_0x1edb64){return function(){logger[_0xefba('0xd')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x98bb5d[_0xefba('0xe')]);var _0x4127f3=!![];var _0x58b22d=_0x98bb5d[_0xefba('0xf')]['getSmtpOptions']();var _0x2665c7={'account':_0x58b22d,'message':{'from':util[_0xefba('0x10')](_0xefba('0x11'),_0x98bb5d[_0xefba('0xf')][_0xefba('0x12')],_0x98bb5d[_0xefba('0xf')][_0xefba('0xe')]||_0x98bb5d['MailAccount']['Smtp']['user']),'to':_0x98bb5d['email'],'cc':_0x98bb5d['cc'],'bcc':_0x98bb5d[_0xefba('0x13')],'subject':util[_0xefba('0x10')](_0xefba('0x14'),_0x1edb64[_0xefba('0x12')],_0x98bb5d[_0xefba('0x15')],_0x98bb5d[_0xefba('0x16')])}};var _0x127740=path[_0xefba('0x17')](__dirname,_0xefba('0x18'));var _0x2ceca0=_0x1edb64['savename'];var _0x1d946f=util[_0xefba('0x10')](_0xefba('0x19'),path[_0xefba('0x1a')](_0x1edb64[_0xefba('0x1b')],path['extname'](_0x1edb64[_0xefba('0x1b')])),_0xefba('0x1c'));var _0x436935=path['join'](_0x127740,_0x2ceca0);var _0x31a08c=path[_0xefba('0x17')](_0x127740,_0x1d946f);if(fs[_0xefba('0x1d')](_0x436935)){_0x1edb64[_0xefba('0x1e')]=_0xefba('0x1f');_0x2665c7[_0xefba('0x20')][_0xefba('0x21')]=[{'filename':_0x2ceca0,'path':_0x436935}];_0x2665c7[_0xefba('0x20')][_0xefba('0x22')]=util[_0xefba('0x10')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x1edb64,null,0x2));}else if(fs[_0xefba('0x1d')](_0x31a08c)){_0x1edb64['status']=_0xefba('0x1f');_0x2665c7[_0xefba('0x20')][_0xefba('0x21')]=[{'filename':_0x1d946f,'path':_0x31a08c}];}else{_0x2665c7[_0xefba('0x20')][_0xefba('0x22')]=_0xefba('0x23');if(!_0x98bb5d['sendIfEmpty']){_0x4127f3=![];logger[_0xefba('0xd')](_0xefba('0x24'));}}if(_0x4127f3){return client[_0xefba('0x25')](_0xefba('0x26'),_0x2665c7)[_0xefba('0x27')](function(_0x4d68dc){if(_0x4d68dc[_0xefba('0x28')]){return logger[_0xefba('0x28')](_0xefba('0x29'),JSON[_0xefba('0x2a')](_0x4d68dc));}return logger[_0xefba('0xd')](_0xefba('0x2b'));})[_0xefba('0x2c')](function(_0x49a0e3){return logger[_0xefba('0x28')](_0xefba('0x29'),JSON['stringify'](_0x49a0e3));});}};}function handleError(){return function(_0x86fb90){return logger['error'](JSON[_0xefba('0x2a')](_0x86fb90));};}function handleResult(_0x7c26c4){return function(_0xbd96b5){logger['info'](_0xefba('0x2d'),JSON[_0xefba('0x2a')](_0xbd96b5));if(_0x7c26c4[_0xefba('0xf')]&&_0x7c26c4[_0xefba('0xf')]['Smtp']&&!_[_0xefba('0x2e')](_0x7c26c4[_0xefba('0xe')])){setTimeout(handleSendEmail(_0x7c26c4,_0xbd96b5),0x3c*0x3e8);}};}function handleJob(_0x16dd07){return function(){try{if(_[_0xefba('0x2e')](_0x16dd07['subtractNumber'])){return logger[_0xefba('0xd')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xefba('0x2e')](_0x16dd07[_0xefba('0x16')])){return logger['info'](_0xefba('0x2f'));}var _0x302e88={'startDate':moment()['subtract'](_0x16dd07['subtractNumber'],_0x16dd07[_0xefba('0x16')])['format'](_0xefba('0x30')),'endDate':moment()[_0xefba('0x10')](_0xefba('0x30')),'type':_0xefba('0x31'),'output':_0x16dd07[_0xefba('0x32')],'name':_0x16dd07['name']};if(!_[_0xefba('0x2e')](_0x16dd07[_0xefba('0x33')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x16dd07[_0xefba('0x33')]);return analyticDefaultReportController['runReport']({'id':_0x16dd07['DefaultReportId']},_0x302e88)[_0xefba('0x27')](handleResult(_0x16dd07))[_0xefba('0x2c')](handleError());}if(!_[_0xefba('0x2e')](_0x16dd07[_0xefba('0x34')])){logger[_0xefba('0xd')](_0xefba('0x35'),_0x16dd07[_0xefba('0x34')]);return analyticCustomReportController['runReport']({'id':_0x16dd07['CustomReportId']},_0x302e88)['then'](handleResult(_0x16dd07))['catch'](handleError());}}catch(_0x105456){logger['error'](JSON['stringify'](_0x105456));}return logger[_0xefba('0xd')](_0xefba('0x36'));};}function getJobs(_0x450527){var _0x334bac={};if(_0x450527){_0x334bac['id']=_0x450527;}return db[_0xefba('0x37')][_0xefba('0x38')]({'where':_0x334bac,'include':[{'model':db[_0xefba('0xf')],'attributes':['id',_0xefba('0x12'),_0xefba('0xe')],'include':[{'model':db[_0xefba('0x39')],'as':'Smtp','include':[{'model':db[_0xefba('0x3a')],'as':'CloudProvider'}]}]}]})[_0xefba('0x27')](function(_0x59d33d){var _0x12219f=_['keys'](manager[_0xefba('0x3b')]);var _0x52edcc=_[_0xefba('0x3c')](_0x59d33d,function(_0x518beb){return _0x518beb['id'][_0xefba('0x3d')]();});var _0x345cc9=_[_0xefba('0x3e')](_0x59d33d,function(_0x24354a){return _0x24354a['id'][_0xefba('0x3d')]();});var _0x4fe9e1=_0x450527?_0x52edcc:_[_0xefba('0x3f')](_0x52edcc,_0x12219f);var _0xb5a20f=_['intersection'](_0x52edcc,_0x12219f);var _0x418ef4=_['difference'](_0x12219f,_0x52edcc);var _0x589fb2;var _0x1dcff0;for(_0x589fb2=0x0;_0x589fb2<_0x418ef4[_0xefba('0x40')]&&!_0x450527;_0x589fb2+=0x1){_0x1dcff0=_0x418ef4[_0x589fb2][_0xefba('0x3d')]();if(manager['exists'](_0x1dcff0)){manager[_0xefba('0x41')](_0x1dcff0);manager[_0xefba('0x42')](_0x1dcff0);logger[_0xefba('0xd')](_0xefba('0x43'),_0x1dcff0);}}logger[_0xefba('0xd')](_0xefba('0x44'),JSON['stringify'](_0x4fe9e1));for(_0x589fb2=0x0;_0x589fb2<_0x4fe9e1[_0xefba('0x40')];_0x589fb2+=0x1){_0x1dcff0=_0x4fe9e1[_0x589fb2][_0xefba('0x3d')]();logger[_0xefba('0xd')](_0xefba('0x45'),_0x1dcff0);if(_0x450527){logger['info']('my\x20id',_0x450527);logger[_0xefba('0xd')](JSON['stringify'](_0x345cc9[_0x1dcff0]));BPromise['resolve']()[_0xefba('0x27')](handleJob(_0x345cc9[_0x1dcff0]));logger[_0xefba('0xd')](_0xefba('0x46'),_0x345cc9[_0x1dcff0]['name'],_0x345cc9[_0x1dcff0]['cron']);}else if(_0x345cc9[_0x1dcff0][_0xefba('0x47')]&&_0x345cc9[_0x1dcff0][_0xefba('0x48')]&&moment()['isBetween'](_0x345cc9[_0x1dcff0]['startAt'],_0x345cc9[_0x1dcff0][_0xefba('0x49')])){manager['add'](_0x1dcff0,_0x345cc9[_0x1dcff0][_0xefba('0x47')],handleJob(_0x345cc9[_0x1dcff0]));manager[_0xefba('0x4a')](_0x1dcff0);logger[_0xefba('0xd')](_0xefba('0x4b'),_0x345cc9[_0x1dcff0][_0xefba('0x12')],_0x345cc9[_0x1dcff0][_0xefba('0x47')]);}else if(manager[_0xefba('0x4c')](_0x1dcff0)){manager[_0xefba('0x41')](_0x1dcff0);manager[_0xefba('0x42')](_0x1dcff0);logger[_0xefba('0xd')](_0xefba('0x4d'),_0x345cc9[_0x1dcff0]['name'],_0x345cc9[_0x1dcff0]['cron']);}}for(_0x589fb2=0x0,_0x1dcff0;_0x589fb2<_0xb5a20f[_0xefba('0x40')]&&!_0x450527;_0x589fb2+=0x1){_0x1dcff0=_0xb5a20f[_0x589fb2][_0xefba('0x3d')]();if(manager[_0xefba('0x4c')](_0x1dcff0)){if(_0x345cc9[_0x1dcff0][_0xefba('0x47')]&&_0x345cc9[_0x1dcff0][_0xefba('0x48')]&&moment()['isBetween'](_0x345cc9[_0x1dcff0][_0xefba('0x4e')],_0x345cc9[_0x1dcff0]['endAt'])){manager[_0xefba('0x4f')](_0x1dcff0,_0x345cc9[_0x1dcff0][_0xefba('0x47')],handleJob(_0x345cc9[_0x1dcff0]));logger['info'](_0xefba('0x50'),_0x345cc9[_0x1dcff0][_0xefba('0x12')],_0x345cc9[_0x1dcff0][_0xefba('0x47')]);}else{manager[_0xefba('0x41')](_0x1dcff0);manager[_0xefba('0x42')](_0x1dcff0);logger[_0xefba('0xd')]('stop\x20cron',_0x345cc9[_0x1dcff0]['name'],_0x345cc9[_0x1dcff0][_0xefba('0x47')]);}}}})['catch'](function(_0x547eb3){logger[_0xefba('0x28')](JSON['stringify'](_0x547eb3));});}exports['run']=function(_0x12989c){return getJobs(_0x12989c);};exports[_0xefba('0x4a')]=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 38eff89..8405beb 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 _0xadcc=['sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','fileText','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','Positive','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','all','catch','error','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sentiment\x20Analysis\x20not\x20requested'];(function(_0x1b2688,_0x281ea1){var _0x3b08e8=function(_0x782136){while(--_0x782136){_0x1b2688['push'](_0x1b2688['shift']());}};_0x3b08e8(++_0x281ea1);}(_0xadcc,0x76));var _0xcadc=function(_0x4e1d2b,_0x5034c9){_0x4e1d2b=_0x4e1d2b-0x0;var _0x309c7c=_0xadcc[_0x4e1d2b];return _0x309c7c;};var _=require(_0xcadc('0x0'));var AWS=require('aws-sdk');var rp=require(_0xcadc('0x1'));var util=require(_0xcadc('0x2'));var BPromise=require(_0xcadc('0x3'));var db=require(_0xcadc('0x4'))['db'];var logger=require(_0xcadc('0x5'))('transcribe');function getTranscriptionJob(_0x53330e,_0x23b7d1,_0x333f8c,_0x40f07f){return new Promise(function(_0x25ab60,_0x3aaa29){var _0x294977=new AWS[(_0xcadc('0x6'))]({'accessKeyId':_0x23b7d1,'secretAccessKey':_0x53330e,'region':_0x333f8c});_0x294977[_0xcadc('0x7')]({'TranscriptionJobName':_0x40f07f},function(_0x1d3edf,_0x204f2b){if(_0x1d3edf){return _0x3aaa29(_0x1d3edf);}else{return _0x25ab60(_0x204f2b);}});});}function sentiment(_0x14af1e,_0x13ccbc,_0x22268c,_0x38cfee,_0x56907c){return new Promise(function(_0x56cbe7,_0x2b23cf){var _0x23fac5=new AWS['Comprehend']({'accessKeyId':_0x13ccbc,'secretAccessKey':_0x14af1e,'region':_0x22268c});_0x23fac5[_0xcadc('0x8')]({'Text':_0x38cfee,'LanguageCode':_0x56907c[_0xcadc('0x9')](0x0,0x2)},function(_0x41581a,_0x52c540){if(_0x41581a){return _0x2b23cf(_0x41581a);}else{return _0x56cbe7(_0x52c540);}});});}function checkTranscribeJob(_0x4b35c4,_0x1b53ac,_0x365ac7){var _0x118388;return new BPromise(function(_0x3fa2a1,_0x579bda){logger[_0xcadc('0xa')](util['format'](_0xcadc('0xb'),_0x4b35c4['id'],_0x4b35c4[_0xcadc('0xc')]));return getTranscriptionJob(_0x365ac7[_0xcadc('0xd')],_0x365ac7['data2'],_0x1b53ac[_0xcadc('0xe')],_0x4b35c4[_0xcadc('0xc')])['then'](function(_0x31bf31){logger['info'](util[_0xcadc('0xf')](_0xcadc('0x10'),_0x4b35c4['id'],_0x4b35c4[_0xcadc('0xc')],_0x31bf31[_0xcadc('0x11')][_0xcadc('0x12')]));if(!_0x4b35c4['fileText']){switch(_0x31bf31[_0xcadc('0x11')][_0xcadc('0x12')]){case _0xcadc('0x13'):var _0x308694={'transcribeStatus':_0x31bf31[_0xcadc('0x11')][_0xcadc('0x12')],'fileUri':_0x31bf31[_0xcadc('0x11')][_0xcadc('0x14')]['TranscriptFileUri']};logger['info'](util[_0xcadc('0xf')](_0xcadc('0x15'),_0x4b35c4['id']));return rp({'uri':_0x31bf31['TranscriptionJob'][_0xcadc('0x14')][_0xcadc('0x16')],'json':!![]})['then'](function(_0x496289){logger[_0xcadc('0xa')](util['format'](_0xcadc('0x17'),_0x4b35c4['id']));if(_0x496289&&_0x496289['results']&&_0x496289[_0xcadc('0x18')][_0xcadc('0x19')]&&_0x496289['results'][_0xcadc('0x19')][_0xcadc('0x1a')]){_0x308694['fileText']='';for(var _0x58532d=0x0;_0x58532d<_0x496289['results'][_0xcadc('0x19')][_0xcadc('0x1a')];_0x58532d++){_0x308694['fileText']+=_0x496289[_0xcadc('0x18')]['transcripts'][_0x58532d][_0xcadc('0x1b')]+'';}}return _0x4b35c4[_0xcadc('0x1c')](_0x308694);})[_0xcadc('0x1d')](function(){logger[_0xcadc('0xa')](util[_0xcadc('0xf')](_0xcadc('0x1e'),_0x4b35c4['id']));if(!_0x4b35c4['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xcadc('0x1f'));}if(!_0x1b53ac[_0xcadc('0x20')]||!_0x1b53ac[_0xcadc('0x21')]||!_0x1b53ac[_0xcadc('0x22')]||!_0x1b53ac[_0xcadc('0x23')]||!_0x1b53ac[_0xcadc('0x24')]){throw new db[(_0xcadc('0x25'))][(_0xcadc('0x26'))](_0xcadc('0x27'));}if(!_0x308694[_0xcadc('0x28')]){throw new Error(_0xcadc('0x29'));}if(_0x1b53ac['sentimentAccountId']===_0x365ac7['id']){return _0x365ac7;}else{return db['CloudProvider'][_0xcadc('0x2a')]({'where':{'id':_settings[_0xcadc('0x21')]}});}})[_0xcadc('0x1d')](function(_0x36bc0c){if(!_0x36bc0c){throw new db[(_0xcadc('0x25'))][(_0xcadc('0x26'))](_0xcadc('0x2b'));}if(!_0x36bc0c[_0xcadc('0xd')]||!_0x36bc0c[_0xcadc('0x2c')]){throw new db[(_0xcadc('0x25'))][(_0xcadc('0x26'))](_0xcadc('0x2d'));}_0x118388=_0x36bc0c;logger[_0xcadc('0xa')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4b35c4['id']));return sentiment(_0x118388['data1'],_0x118388['data2'],_0x1b53ac[_0xcadc('0x22')],_0x308694['fileText'],_0x1b53ac['language']);})[_0xcadc('0x1d')](function(_0x1ca3a7){logger[_0xcadc('0xa')](util[_0xcadc('0xf')](_0xcadc('0x2e'),_0x4b35c4['id']));return _0x4b35c4['update']({'sentiment':_0x1ca3a7[_0xcadc('0x2f')],'sPositive':_0x1ca3a7[_0xcadc('0x30')]['Positive'],'sNegative':_0x1ca3a7[_0xcadc('0x30')][_0xcadc('0x31')],'sMixed':_0x1ca3a7[_0xcadc('0x30')][_0xcadc('0x32')],'sNeutral':_0x1ca3a7['SentimentScore'][_0xcadc('0x33')]});})[_0xcadc('0x1d')](function(){logger[_0xcadc('0xa')](util[_0xcadc('0xf')](_0xcadc('0x1e'),_0x4b35c4['id']));_0x3fa2a1();});case _0xcadc('0x34'):return _0x4b35c4['update']({'transcribeStatus':_0xcadc('0x34'),'failureReason':_0x31bf31['TranscriptionJob'][_0xcadc('0x35')]})[_0xcadc('0x1d')](function(){logger[_0xcadc('0xa')](util[_0xcadc('0xf')](_0xcadc('0x1e'),_0x4b35c4['id']));_0x3fa2a1();});default:logger[_0xcadc('0xa')](util[_0xcadc('0xf')](_0xcadc('0x36'),_0x4b35c4['id']));break;}}else{return BPromise[_0xcadc('0x37')]()[_0xcadc('0x1d')](function(){if(!_0x4b35c4['tempSentiment']){throw new db[(_0xcadc('0x25'))][(_0xcadc('0x26'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1b53ac['sentiment']||!_0x1b53ac[_0xcadc('0x21')]||!_0x1b53ac[_0xcadc('0x22')]||!_0x1b53ac[_0xcadc('0x23')]||!_0x1b53ac[_0xcadc('0x24')]){throw new db[(_0xcadc('0x25'))][(_0xcadc('0x26'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4b35c4['fileText']){throw new Error(_0xcadc('0x29'));}if(_0x1b53ac[_0xcadc('0x21')]===_0x365ac7['id']){return _0x365ac7;}else{return db[_0xcadc('0x38')][_0xcadc('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xcadc('0x1d')](function(_0x421b7d){if(!_0x421b7d){throw new db[(_0xcadc('0x25'))][(_0xcadc('0x26'))](_0xcadc('0x2b'));}if(!_0x421b7d[_0xcadc('0xd')]||!_0x421b7d[_0xcadc('0x2c')]){throw new db[(_0xcadc('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x118388=_0x421b7d;logger[_0xcadc('0xa')](util[_0xcadc('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4b35c4['id']));return sentiment(_0x118388[_0xcadc('0xd')],_0x118388[_0xcadc('0x2c')],_0x1b53ac[_0xcadc('0x22')],_0x4b35c4['fileText'],_0x1b53ac[_0xcadc('0x23')]);})[_0xcadc('0x1d')](function(_0x465f27){logger[_0xcadc('0xa')](util[_0xcadc('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4b35c4['id']));return _0x4b35c4[_0xcadc('0x1c')]({'sentiment':_0x465f27[_0xcadc('0x2f')],'sPositive':_0x465f27[_0xcadc('0x30')][_0xcadc('0x39')],'sNegative':_0x465f27[_0xcadc('0x30')][_0xcadc('0x31')],'sMixed':_0x465f27[_0xcadc('0x30')][_0xcadc('0x32')],'sNeutral':_0x465f27[_0xcadc('0x30')]['Neutral'],'transcribeStatus':_0xcadc('0x13')});})[_0xcadc('0x1d')](function(){logger['info'](util[_0xcadc('0xf')](_0xcadc('0x1e'),_0x4b35c4['id']));_0x3fa2a1();});}})['catch'](function(_0x319051){if(_0x319051){if(!_0x319051[_0xcadc('0x3a')]||_0x319051[_0xcadc('0x3a')]!==_0xcadc('0x3b')){logger['error'](util[_0xcadc('0xf')](_0xcadc('0x3c'),_0x4b35c4['id']),util[_0xcadc('0x3d')](_0x319051,{'showHidden':![],'depth':null}));}}_0x3fa2a1();});});}function checkTranscribe(){var _0x3bd06d;var _0xa04d9c;var _0x26e6e5;return db[_0xcadc('0x3e')][_0xcadc('0x3f')]({'where':{'transcribeStatus':_0xcadc('0x40')}})[_0xcadc('0x1d')](function(_0x2e64ef){if(!_0x2e64ef||!_0x2e64ef[_0xcadc('0x1a')]){throw new db['Sequelize'][(_0xcadc('0x26'))](_0xcadc('0x41'));}_0x3bd06d=_0x2e64ef;return db['Setting'][_0xcadc('0x2a')]({'where':{'id':0x1}});})[_0xcadc('0x1d')](function(_0x337c70){if(!_0x337c70){throw new db[(_0xcadc('0x25'))]['ValidationError'](_0xcadc('0x42'));}_0xa04d9c=_0x337c70;if(!_0xa04d9c[_0xcadc('0x43')]||!_0xa04d9c['transcribeAccountId']||!_0xa04d9c[_0xcadc('0xe')]||!_0xa04d9c['language']||!_0xa04d9c['bucket']){throw new db['Sequelize'][(_0xcadc('0x26'))]('Transcribe\x20not\x20configured');}return db[_0xcadc('0x38')]['findOne']({'where':{'id':_0xa04d9c[_0xcadc('0x44')]}});})[_0xcadc('0x1d')](function(_0xc228a){if(!_0xc228a){throw new db['Sequelize'][(_0xcadc('0x26'))](_0xcadc('0x2b'));}if(!_0xc228a[_0xcadc('0xd')]||!_0xc228a[_0xcadc('0x2c')]){throw new db['Sequelize'][(_0xcadc('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x26e6e5=_0xc228a;var _0x2c9814=[];_0x3bd06d[_0xcadc('0x45')](function(_0x5b6af8){_0x2c9814[_0xcadc('0x46')](checkTranscribeJob(_0x5b6af8,_0xa04d9c,_0x26e6e5));});return BPromise[_0xcadc('0x47')](_0x2c9814);})[_0xcadc('0x48')](function(_0x581d8f){if(_0x581d8f){if(!_0x581d8f['name']||_0x581d8f[_0xcadc('0x3a')]!=='SequelizeValidationError'){logger[_0xcadc('0x49')](util[_0xcadc('0x3d')](_0x581d8f,{'showHidden':![],'depth':null}));}}});}exports[_0xcadc('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3423=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','then','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','error','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update'];(function(_0x116873,_0x4d8906){var _0x47bf1c=function(_0x575964){while(--_0x575964){_0x116873['push'](_0x116873['shift']());}};_0x47bf1c(++_0x4d8906);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var BPromise=require(_0x3342('0x2'));var db=require(_0x3342('0x3'))['db'];var logger=require(_0x3342('0x4'))(_0x3342('0x5'));function getTranscriptionJob(_0x2207ce,_0x3c5d8d,_0x3075f8,_0x19206f){return new Promise(function(_0x467453,_0x2ccbe0){var _0x29c40c=new AWS[(_0x3342('0x6'))]({'accessKeyId':_0x3c5d8d,'secretAccessKey':_0x2207ce,'region':_0x3075f8});_0x29c40c[_0x3342('0x7')]({'TranscriptionJobName':_0x19206f},function(_0xce08ab,_0x305d13){if(_0xce08ab){return _0x2ccbe0(_0xce08ab);}else{return _0x467453(_0x305d13);}});});}function sentiment(_0xd9d129,_0x9cc419,_0x4ae4f3,_0x582c37,_0x2d0cb0){return new Promise(function(_0x481a17,_0x5a1fba){var _0x51b276=new AWS['Comprehend']({'accessKeyId':_0x9cc419,'secretAccessKey':_0xd9d129,'region':_0x4ae4f3});_0x51b276[_0x3342('0x8')]({'Text':_0x582c37,'LanguageCode':_0x2d0cb0[_0x3342('0x9')](0x0,0x2)},function(_0x51496d,_0x2d14c4){if(_0x51496d){return _0x5a1fba(_0x51496d);}else{return _0x481a17(_0x2d14c4);}});});}function checkTranscribeJob(_0x5a3cb1,_0x716d80,_0x36e1f4){var _0x592ba8;return new BPromise(function(_0x3e418d,_0x334f0e){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0xc'),_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')]));return getTranscriptionJob(_0x36e1f4[_0x3342('0xe')],_0x36e1f4['data2'],_0x716d80[_0x3342('0xf')],_0x5a3cb1[_0x3342('0xd')])['then'](function(_0x40d609){logger[_0x3342('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')],_0x40d609[_0x3342('0x10')][_0x3342('0x11')]));if(!_0x5a3cb1[_0x3342('0x12')]){switch(_0x40d609[_0x3342('0x10')][_0x3342('0x11')]){case _0x3342('0x13'):var _0x3ebf6b={'transcribeStatus':_0x40d609[_0x3342('0x10')]['TranscriptionJobStatus'],'fileUri':_0x40d609[_0x3342('0x10')][_0x3342('0x14')][_0x3342('0x15')]};logger['info'](util[_0x3342('0xb')](_0x3342('0x16'),_0x5a3cb1['id']));return rp({'uri':_0x40d609['TranscriptionJob'][_0x3342('0x14')][_0x3342('0x15')],'json':!![]})['then'](function(_0x4e1b19){logger['info'](util[_0x3342('0xb')](_0x3342('0x17'),_0x5a3cb1['id']));if(_0x4e1b19&&_0x4e1b19[_0x3342('0x18')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')][_0x3342('0x1a')]){_0x3ebf6b['fileText']='';for(var _0x30ffc9=0x0;_0x30ffc9<_0x4e1b19['results']['transcripts'][_0x3342('0x1a')];_0x30ffc9++){_0x3ebf6b['fileText']+=_0x4e1b19['results'][_0x3342('0x19')][_0x30ffc9]['transcript']+'';}}return _0x5a3cb1[_0x3342('0x1b')](_0x3ebf6b);})['then'](function(){logger['info'](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x1f'));}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80[_0x3342('0x22')]||!_0x716d80['language']||!_0x716d80[_0x3342('0x23')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x3ebf6b[_0x3342('0x12')]){throw new Error(_0x3342('0x26'));}if(_0x716d80[_0x3342('0x21')]===_0x36e1f4['id']){return _0x36e1f4;}else{return db['CloudProvider'][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x407f8c){if(!_0x407f8c){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x407f8c[_0x3342('0xe')]||!_0x407f8c[_0x3342('0x2a')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x592ba8=_0x407f8c;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x3ebf6b[_0x3342('0x12')],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x30dcea){logger['info'](util['format'](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x30dcea[_0x3342('0x2f')],'sPositive':_0x30dcea[_0x3342('0x30')][_0x3342('0x31')],'sNegative':_0x30dcea[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x30dcea[_0x3342('0x30')][_0x3342('0x33')],'sNeutral':_0x30dcea['SentimentScore'][_0x3342('0x34')]});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});case'FAILED':return _0x5a3cb1[_0x3342('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x40d609[_0x3342('0x10')][_0x3342('0x35')]})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});default:logger['info'](util[_0x3342('0xb')](_0x3342('0x36'),_0x5a3cb1['id']));break;}}else{return BPromise[_0x3342('0x37')]()[_0x3342('0x28')](function(){if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80['sentimentRegion']||!_0x716d80[_0x3342('0x2d')]||!_0x716d80[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x5a3cb1['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x716d80['sentimentAccountId']===_0x36e1f4['id']){return _0x36e1f4;}else{return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x2a1f7e){if(!_0x2a1f7e){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2a1f7e[_0x3342('0xe')]||!_0x2a1f7e[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592ba8=_0x2a1f7e;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x5a3cb1['fileText'],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x283ce9){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x283ce9[_0x3342('0x2f')],'sPositive':_0x283ce9['SentimentScore'][_0x3342('0x31')],'sNegative':_0x283ce9[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x283ce9[_0x3342('0x30')]['Mixed'],'sNeutral':_0x283ce9[_0x3342('0x30')][_0x3342('0x34')],'transcribeStatus':'COMPLETED'});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});}})['catch'](function(_0x2e2ebc){if(_0x2e2ebc){if(!_0x2e2ebc[_0x3342('0x39')]||_0x2e2ebc['name']!==_0x3342('0x3a')){logger['error'](util['format'](_0x3342('0x3b'),_0x5a3cb1['id']),util[_0x3342('0x3c')](_0x2e2ebc,{'showHidden':![],'depth':null}));}}_0x3e418d();});});}function checkTranscribe(){var _0x346534;var _0x296cbb;var _0x23925e;return db[_0x3342('0x3d')][_0x3342('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3817fd){if(!_0x3817fd||!_0x3817fd['length']){throw new db[(_0x3342('0x1e'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x346534=_0x3817fd;return db['Setting'][_0x3342('0x27')]({'where':{'id':0x1}});})[_0x3342('0x28')](function(_0x29ccb6){if(!_0x29ccb6){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x3f'));}_0x296cbb=_0x29ccb6;if(!_0x296cbb[_0x3342('0x5')]||!_0x296cbb['transcribeAccountId']||!_0x296cbb[_0x3342('0xf')]||!_0x296cbb[_0x3342('0x2d')]||!_0x296cbb[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x40'));}return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_0x296cbb[_0x3342('0x41')]}});})['then'](function(_0x2699d2){if(!_0x2699d2){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2699d2[_0x3342('0xe')]||!_0x2699d2[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x23925e=_0x2699d2;var _0x542181=[];_0x346534[_0x3342('0x42')](function(_0x4eebaa){_0x542181[_0x3342('0x43')](checkTranscribeJob(_0x4eebaa,_0x296cbb,_0x23925e));});return BPromise['all'](_0x542181);})['catch'](function(_0x5bff74){if(_0x5bff74){if(!_0x5bff74['name']||_0x5bff74[_0x3342('0x39')]!==_0x3342('0x3a')){logger[_0x3342('0x44')](util[_0x3342('0x3c')](_0x5bff74,{'showHidden':![],'depth':null}));}}});}exports[_0x3342('0x45')]=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 558b60e..f4324c5 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 _0x9d01=['WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter'];(function(_0x44ff3a,_0x46f40d){var _0x333bc1=function(_0x1114aa){while(--_0x1114aa){_0x44ff3a['push'](_0x44ff3a['shift']());}};_0x333bc1(++_0x46f40d);}(_0x9d01,0x76));var _0x19d0=function(_0x237f07,_0x2142a9){_0x237f07=_0x237f07-0x0;var _0x22c133=_0x9d01[_0x237f07];return _0x22c133;};'use strict';var _=require('lodash');var moment=require(_0x19d0('0x0'));var Redis=require(_0x19d0('0x1'));var util=require(_0x19d0('0x2'));var config=require('../../config/environment');var db=require(_0x19d0('0x3'))['db'];var logger=require(_0x19d0('0x4'))(_0x19d0('0x5'));config['redis']=_[_0x19d0('0x6')](config[_0x19d0('0x7')],{'host':_0x19d0('0x8'),'port':0x18eb});var io=require(_0x19d0('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x3a2ac6=[];return db[_0x19d0('0xa')][_0x19d0('0xb')]({'raw':!![],'attributes':['id',_0x19d0('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x19d0('0xd')](0x18,_0x19d0('0xe'))}}})[_0x19d0('0xf')](function(_0x5b582a){if(_0x5b582a&&_0x5b582a[_0x19d0('0x10')]){_0x3a2ac6=_[_0x19d0('0x11')](_0x5b582a||[],'id');logger[_0x19d0('0x12')](_0x19d0('0x13'),_0x3a2ac6[_0x19d0('0x14')]());return db[_0x19d0('0xa')][_0x19d0('0x15')]({'closeReason':'system','disposition':_0x19d0('0x16'),'closed':!![],'closedAt':moment()[_0x19d0('0x17')](_0x19d0('0x18'))},{'where':{'id':_0x3a2ac6}});}})[_0x19d0('0xf')](function(){if(_0x3a2ac6&&_0x3a2ac6[_0x19d0('0x10')]){logger['info'](_0x19d0('0x19'),_0x3a2ac6[_0x19d0('0x14')]());for(var _0x4c8c05=0x0;_0x4c8c05<_0x3a2ac6[_0x19d0('0x10')];_0x4c8c05++){io[_0x19d0('0x1a')]('whatsappInteraction:update',{'id':_0x3a2ac6[_0x4c8c05],'closed':!![]});}}})[_0x19d0('0x1b')](function(_0x5b8537){logger[_0x19d0('0x1c')](_0x19d0('0x1d'),_0x5b8537?util[_0x19d0('0x1e')](_0x5b8537,{'showHidden':![],'depth':null}):'');});}exports[_0x19d0('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x47e3=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','join','whatsappInteraction:update','catch','error','start','moment','ioredis','util','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','length'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x47e3,0x17a));var _0x347e=function(_0x4bcc00,_0x5b2db5){_0x4bcc00=_0x4bcc00-0x0;var _0x4d356b=_0x47e3[_0x4bcc00];return _0x4d356b;};'use strict';var _=require('lodash');var moment=require(_0x347e('0x0'));var Redis=require(_0x347e('0x1'));var util=require(_0x347e('0x2'));var config=require(_0x347e('0x3'));var db=require(_0x347e('0x4'))['db'];var logger=require('../logger')('schedule');config[_0x347e('0x5')]=_['defaults'](config[_0x347e('0x5')],{'host':_0x347e('0x6'),'port':0x18eb});var io=require(_0x347e('0x7'))(new Redis(config[_0x347e('0x5')]));function closeInteractions(){var _0x20d54a=[];return db['WhatsappInteraction'][_0x347e('0x8')]({'raw':!![],'attributes':['id',_0x347e('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x347e('0xa')](0x18,'hours')}}})['then'](function(_0x23c49c){if(_0x23c49c&&_0x23c49c[_0x347e('0xb')]){_0x20d54a=_[_0x347e('0xc')](_0x23c49c||[],'id');logger[_0x347e('0xd')](_0x347e('0xe'),_0x20d54a['join']());return db[_0x347e('0xf')][_0x347e('0x10')]({'closeReason':'system','disposition':_0x347e('0x11'),'closed':!![],'closedAt':moment()[_0x347e('0x12')](_0x347e('0x13'))},{'where':{'id':_0x20d54a}});}})[_0x347e('0x14')](function(){if(_0x20d54a&&_0x20d54a['length']){logger[_0x347e('0xd')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x20d54a[_0x347e('0x15')]());for(var _0x30f6c4=0x0;_0x30f6c4<_0x20d54a['length'];_0x30f6c4++){io['emit'](_0x347e('0x16'),{'id':_0x20d54a[_0x30f6c4],'closed':!![]});}}})[_0x347e('0x17')](function(_0x2d515c){logger[_0x347e('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2d515c?util['inspect'](_0x2d515c,{'showHidden':![],'depth':null}):'');});}exports[_0x347e('0x19')]=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 fcb7f0b..cdfcbeb 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99a0=['finished\x20populating','contacts1','destroy','contacts2','CmHopper','hopper2','catch','util','push','Biondo','innocenzo.biondo','now','Innocenzo','@xcally.com','CmContact','bulkCreate','then','log'];(function(_0x533785,_0x109c40){var _0x22d76f=function(_0x1d8fd6){while(--_0x1d8fd6){_0x533785['push'](_0x533785['shift']());}};_0x22d76f(++_0x109c40);}(_0x99a0,0xdf));var _0x099a=function(_0x2493c7,_0x4d0f8c){_0x2493c7=_0x2493c7-0x0;var _0x2cc468=_0x99a0[_0x2493c7];return _0x2cc468;};'use strict';var util=require(_0x099a('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x099a('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x099a('0x2')+i,'phone':0xf879fb460+i,'email':_0x099a('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x099a('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x099a('0x4')](),'updatedAt':Date[_0x099a('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x099a('0x1')]({'id':i,'firstName':_0x099a('0x5')+i,'lastName':_0x099a('0x2')+i,'phone':0xf879fb460+i,'email':_0x099a('0x3')+i+_0x099a('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x099a('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x099a('0x4')](),'updatedAt':Date[_0x099a('0x4')]()});}db[_0x099a('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x099a('0x7')][_0x099a('0x8')](contacts);})[_0x099a('0x9')](function(){console[_0x099a('0xa')](_0x099a('0xb'),_0x099a('0xc'));return db['CmHopper'][_0x099a('0xd')]({'where':{}});})[_0x099a('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0x099a('0xa')](_0x099a('0xb'),'hopper1');return db[_0x099a('0x7')][_0x099a('0x8')](contacts2);})[_0x099a('0x9')](function(){console['log'](_0x099a('0xb'),_0x099a('0xe'));return db[_0x099a('0xf')]['bulkCreate'](hopper2);})[_0x099a('0x9')](function(){console[_0x099a('0xa')]('finished\x20populating',_0x099a('0x10'));})[_0x099a('0x11')](function(_0x359b80){console[_0x099a('0xa')](_0x359b80);}); \ No newline at end of file +var _0xe785=['now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper2','catch','util','../mysqldb','@xcally.com','push'];(function(_0x3aaa02,_0x163f9b){var _0x1ee044=function(_0x50cb2f){while(--_0x50cb2f){_0x3aaa02['push'](_0x3aaa02['shift']());}};_0x1ee044(++_0x163f9b);}(_0xe785,0x13c));var _0x5e78=function(_0xb8484a,_0x95e48d){_0xb8484a=_0xb8484a-0x0;var _0x4dbbe7=_0xe785[_0xb8484a];return _0x4dbbe7;};'use strict';var util=require(_0x5e78('0x0'));var db=require(_0x5e78('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x5e78('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5e78('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x5e78('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5e78('0x4')](),'updatedAt':Date[_0x5e78('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5e78('0x3')]({'id':i,'firstName':_0x5e78('0x5')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5e78('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5e78('0x4')](),'updatedAt':Date[_0x5e78('0x4')]()});}db[_0x5e78('0x6')][_0x5e78('0x7')]({'where':{}})[_0x5e78('0x8')](function(){return db[_0x5e78('0x6')][_0x5e78('0x9')](contacts);})[_0x5e78('0x8')](function(){console[_0x5e78('0xa')](_0x5e78('0xb'),_0x5e78('0xc'));return db[_0x5e78('0xd')]['destroy']({'where':{}});})[_0x5e78('0x8')](function(){return db[_0x5e78('0xd')][_0x5e78('0x9')](hopper);})[_0x5e78('0x8')](function(){console[_0x5e78('0xa')]('finished\x20populating','hopper1');return db[_0x5e78('0x6')][_0x5e78('0x9')](contacts2);})[_0x5e78('0x8')](function(){console[_0x5e78('0xa')]('finished\x20populating','contacts2');return db['CmHopper']['bulkCreate'](hopper2);})[_0x5e78('0x8')](function(){console['log']('finished\x20populating',_0x5e78('0xe'));})[_0x5e78('0xf')](function(_0x3b5723){console[_0x5e78('0xa')](_0x3b5723);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b0bbaac..3b7556a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08df=['agent','format','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','%s%s'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x08df,0x1df));var _0xf08d=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0x08df[_0x33c603];return _0xae96f4;};'use strict';var util=require(_0xf08d('0x0'));var db=require(_0xf08d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf08d('0x2')]({'name':util['format'](_0xf08d('0x3'),'agent',i),'fullname':util['format'](_0xf08d('0x3'),_0xf08d('0x4'),i),'email':util[_0xf08d('0x5')]('%s%s@xcally.com','agent',i),'role':_0xf08d('0x4'),'password':_0xf08d('0x6'),'internal':0xfa0+i,'type':_0xf08d('0x7'),'transport':[_0xf08d('0x8'),'ws',_0xf08d('0x9')],'disallow':[_0xf08d('0xa')],'allow':[_0xf08d('0xb')],'defaultuser':util[_0xf08d('0x5')](_0xf08d('0x3'),_0xf08d('0x4'),i),'encryption':_0xf08d('0xc'),'avpf':_0xf08d('0xc'),'force_avp':'yes','icesupport':_0xf08d('0xc'),'dtlsenable':_0xf08d('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf08d('0xd'),'dtlssetup':_0xf08d('0xe'),'callerid':util[_0xf08d('0x5')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0xf08d('0x4'),i),0xfa0+i)});}db[_0xf08d('0xf')][_0xf08d('0x10')](users)[_0xf08d('0x11')](function(){console[_0xf08d('0x12')](_0xf08d('0x13'));})[_0xf08d('0x14')](function(_0x44ebee){console['log'](_0x44ebee);}); \ No newline at end of file +var _0xac07=['add\x20user','util','../mysqldb','push','format','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','%s%s','yes','\x22%s\x22\x20<%s>','User','bulkCreate','then','log'];(function(_0x4f5916,_0x39c8f5){var _0x35137b=function(_0x4875ff){while(--_0x4875ff){_0x4f5916['push'](_0x4f5916['shift']());}};_0x35137b(++_0x39c8f5);}(_0xac07,0x65));var _0x7ac0=function(_0x4e30a1,_0x5bf449){_0x4e30a1=_0x4e30a1-0x0;var _0x4288b4=_0xac07[_0x4e30a1];return _0x4288b4;};'use strict';var util=require(_0x7ac0('0x0'));var db=require(_0x7ac0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7ac0('0x2')]({'name':util[_0x7ac0('0x3')]('%s%s','agent',i),'fullname':util['format']('%s%s',_0x7ac0('0x4'),i),'email':util[_0x7ac0('0x3')](_0x7ac0('0x5'),_0x7ac0('0x4'),i),'role':'agent','password':_0x7ac0('0x6'),'internal':0xfa0+i,'type':_0x7ac0('0x7'),'transport':[_0x7ac0('0x8'),'ws',_0x7ac0('0x9')],'disallow':[_0x7ac0('0xa')],'allow':[_0x7ac0('0xb')],'defaultuser':util[_0x7ac0('0x3')](_0x7ac0('0xc'),_0x7ac0('0x4'),i),'encryption':_0x7ac0('0xd'),'avpf':'yes','force_avp':_0x7ac0('0xd'),'icesupport':_0x7ac0('0xd'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0x7ac0('0xe'),util[_0x7ac0('0x3')](_0x7ac0('0xc'),'agent',i),0xfa0+i)});}db[_0x7ac0('0xf')][_0x7ac0('0x10')](users)[_0x7ac0('0x11')](function(){console[_0x7ac0('0x12')](_0x7ac0('0x13'));})['catch'](function(_0x15bc24){console[_0x7ac0('0x12')](_0x15bc24);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 19ed746..ff986c3 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6257=['request','remoteAddress','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','MailQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','map','where','Campaign','length','format','handshake','query','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','user:%s','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:inbound','userProfileId','ChatQueues','FaxQueues','SmsQueues','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','fax','sms','mail','openchannel','telephone:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x6257,0x1d4));var _0x7625=function(_0x1e951e,_0x48ce7d){_0x1e951e=_0x1e951e-0x0;var _0x4239e9=_0x6257[_0x1e951e];return _0x4239e9;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var BPromise=require(_0x7625('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7625('0x2')],'include':[{'as':_0x7625('0x3'),'model':db[_0x7625('0x4')],'attributes':['id',_0x7625('0x2'),_0x7625('0x5')],'raw':!![],'where':{'role':_0x7625('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7625('0x2')],'where':{'role':_0x7625('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7625('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x7625('0x2')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x7625('0x8')],'where':{'type':_0x7625('0x9')}};function getAssociatedResources(_0x59ec60,_0x3a3918,_0x2a2625){return db[_0x7625('0xa')]['findOne']({'where':{'name':_0x59ec60,'userProfileId':_0x3a3918},'raw':!![]})[_0x7625('0xb')](function(_0x1fe373){if(_0x1fe373){if(_0x1fe373['autoAssociation']){switch(_0x59ec60){case _0x7625('0xc'):case'ChatQueues':case'FaxQueues':case'SmsQueues':case _0x7625('0xd'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2a2625]['findAll'](queryQueues);case _0x7625('0xe'):return db[_0x2a2625][_0x7625('0xf')](queryTelephones);case _0x7625('0x10'):return db[_0x2a2625][_0x7625('0xf')](queryTrunks);case _0x7625('0x11'):return db[_0x2a2625][_0x7625('0xf')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x7625('0x12')],'where':{'sectionId':_0x1fe373['id']},'raw':!![]})['then'](function(_0x3cabf6){if(_0x3cabf6){var _0x1359ef={'where':{'id':_[_0x7625('0x13')](_0x3cabf6,'resourceId')},'raw':!![]};switch(_0x2a2625){case'User':_0x1359ef[_0x7625('0x14')][_0x7625('0x5')]=_0x7625('0x7');break;case _0x7625('0x15'):_0x1359ef[_0x7625('0x14')][_0x7625('0x8')]=_0x7625('0x9');break;}return db[_0x2a2625]['findAll'](_0x1359ef);}else{return[];}});}}else{return[];}})[_0x7625('0xb')](function(_0x486ce4){return _0x486ce4;});}function joinOrLeaveQueues(_0xde024d,_0x555a6f,_0x4ba21a,_0x23dcce){_0xde024d[_0x555a6f](util['format']('%s:queue:%s',_0x4ba21a,_0x23dcce[_0x7625('0x2')]));if(_0x23dcce[_0x7625('0x3')]){for(var _0x510877=0x0;_0x510877<_0x23dcce[_0x7625('0x3')][_0x7625('0x16')];_0x510877+=0x1){_0xde024d[_0x555a6f](util[_0x7625('0x17')]('user:%s',_0x23dcce[_0x7625('0x3')][_0x510877][_0x7625('0x2')]));}}}function joinOrLeave(_0x306e0b,_0x424f8b,_0x3b1e83){var _0xc8b3ae;if(_0x306e0b[_0x7625('0x18')][_0x7625('0x19')]['id']){db[_0x7625('0x4')]['find']({'attributes':['id','name','role','userProfileId'],'where':{'id':_0x306e0b['handshake'][_0x7625('0x19')]['id']},'include':[{'model':db[_0x7625('0x1a')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7625('0x1b')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7625('0x1c')],'as':_0x7625('0x1d'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7625('0x1e'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x7625('0x1f'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x7625('0x20'),'attributes':['id'],'raw':!![]}]})[_0x7625('0xb')](function(_0x29e7bb){if(_0x29e7bb){_0xc8b3ae=_0x29e7bb;_0x306e0b[_0x424f8b](util[_0x7625('0x17')](_0x7625('0x21'),_0x29e7bb[_0x7625('0x2')]));var _0x7941b1=[];switch(_0x29e7bb[_0x7625('0x5')]){case'admin':_0x306e0b[_0x424f8b]('voice:inbound');_0x306e0b[_0x424f8b](_0x7625('0x22'));if(queryQueues[_0x7625('0x23')]('include')){delete queryQueues[_0x7625('0x24')];}_0x7941b1[_0x7625('0x25')](db[_0x7625('0x26')][_0x7625('0xf')](queryQueues));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x27')][_0x7625('0xf')](queryQueues));_0x7941b1['push'](db[_0x7625('0x28')]['findAll'](queryQueues));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x29')][_0x7625('0xf')](queryQueues));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x2a')][_0x7625('0xf')](queryQueues));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x2b')][_0x7625('0xf')](queryQueues));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x2c')][_0x7625('0xf')](queryQueues));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x4')][_0x7625('0xf')](queryTelephones));_0x7941b1[_0x7625('0x25')](db['Trunk']['findAll'](queryTrunks));_0x7941b1[_0x7625('0x25')](db['Campaign']['findAll'](queryCampaigns));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x4')]['findAll'](queryAgents));break;case _0x7625('0x2d'):_0x306e0b[_0x424f8b](_0x7625('0x2e'));_0x306e0b[_0x424f8b](_0x7625('0x22'));_0x7941b1[_0x7625('0x25')](getAssociatedResources(_0x7625('0xc'),_0x29e7bb[_0x7625('0x2f')],'VoiceQueue'));_0x7941b1['push'](getAssociatedResources(_0x7625('0x30'),_0x29e7bb['userProfileId'],'ChatQueue'));_0x7941b1[_0x7625('0x25')](getAssociatedResources(_0x7625('0x31'),_0x29e7bb[_0x7625('0x2f')],_0x7625('0x28')));_0x7941b1[_0x7625('0x25')](getAssociatedResources(_0x7625('0x32'),_0x29e7bb[_0x7625('0x2f')],'SmsQueue'));_0x7941b1[_0x7625('0x25')](getAssociatedResources('MailQueues',_0x29e7bb[_0x7625('0x2f')],_0x7625('0x2a')));_0x7941b1['push'](getAssociatedResources('OpenchannelQueues',_0x29e7bb[_0x7625('0x2f')],'OpenchannelQueue'));_0x7941b1['push'](getAssociatedResources('WhatsappQueues',_0x29e7bb['userProfileId'],_0x7625('0x2c')));_0x7941b1[_0x7625('0x25')](getAssociatedResources(_0x7625('0xe'),_0x29e7bb[_0x7625('0x2f')],'User'));_0x7941b1[_0x7625('0x25')](getAssociatedResources(_0x7625('0x10'),_0x29e7bb[_0x7625('0x2f')],_0x7625('0x33')));_0x7941b1[_0x7625('0x25')](getAssociatedResources('IvrCampaigns',_0x29e7bb['userProfileId'],'Campaign'));_0x7941b1[_0x7625('0x25')](db[_0x7625('0x4')][_0x7625('0xf')](queryAgents));break;case _0x7625('0x6'):_0x306e0b[_0x424f8b]('voice:inbound');_0x306e0b[_0x424f8b](_0x7625('0x22'));_0x7941b1['push'](_0x29e7bb[_0x7625('0x34')]({'attributes':['id',_0x7625('0x2')]}));_0x7941b1[_0x7625('0x25')](_0x29e7bb[_0x7625('0x35')]({'attributes':['id',_0x7625('0x2')]}));_0x7941b1['push'](_0x29e7bb['getFaxQueues']({'attributes':['id',_0x7625('0x2')]}));_0x7941b1['push'](_0x29e7bb[_0x7625('0x36')]({'attributes':['id',_0x7625('0x2')]}));_0x7941b1[_0x7625('0x25')](_0x29e7bb[_0x7625('0x37')]({'attributes':['id','name']}));_0x7941b1[_0x7625('0x25')](_0x29e7bb['getOpenchannelQueues']({'attributes':['id',_0x7625('0x2')]}));_0x7941b1[_0x7625('0x25')](_0x29e7bb[_0x7625('0x38')]({'attributes':['id',_0x7625('0x2')]}));break;}return BPromise['all'](_0x7941b1);}})['then'](function(_0x4d8e79){if(_0x4d8e79&&_0x4d8e79[_0x7625('0x16')]){for(var _0x553023=0x0;_0x553023<_0x4d8e79[_0x7625('0x16')];_0x553023+=0x1){for(var _0xccc8f5=0x0;_0xccc8f5<_0x4d8e79[_0x553023][_0x7625('0x16')];_0xccc8f5+=0x1){switch(_0x553023){case 0x0:joinOrLeaveQueues(_0x306e0b,_0x424f8b,'voice',_0x4d8e79[_0x553023][_0xccc8f5]);break;case 0x1:joinOrLeaveQueues(_0x306e0b,_0x424f8b,'chat',_0x4d8e79[_0x553023][_0xccc8f5]);break;case 0x2:joinOrLeaveQueues(_0x306e0b,_0x424f8b,_0x7625('0x39'),_0x4d8e79[_0x553023][_0xccc8f5]);break;case 0x3:joinOrLeaveQueues(_0x306e0b,_0x424f8b,_0x7625('0x3a'),_0x4d8e79[_0x553023][_0xccc8f5]);break;case 0x4:joinOrLeaveQueues(_0x306e0b,_0x424f8b,_0x7625('0x3b'),_0x4d8e79[_0x553023][_0xccc8f5]);break;case 0x5:joinOrLeaveQueues(_0x306e0b,_0x424f8b,_0x7625('0x3c'),_0x4d8e79[_0x553023][_0xccc8f5]);break;case 0x6:joinOrLeaveQueues(_0x306e0b,_0x424f8b,'whatsapp',_0x4d8e79[_0x553023][_0xccc8f5]);break;case 0x7:if(_0xc8b3ae[_0x7625('0x5')]!==_0x7625('0x6'))_0x306e0b[_0x424f8b](util['format'](_0x7625('0x3d'),_0x4d8e79[_0x553023][_0xccc8f5][_0x7625('0x2')]));break;case 0x8:if(_0xc8b3ae[_0x7625('0x5')]!==_0x7625('0x6'))_0x306e0b[_0x424f8b](util[_0x7625('0x17')]('trunk:%s',_0x4d8e79[_0x553023][_0xccc8f5][_0x7625('0x2')]));break;case 0x9:if(_0xc8b3ae[_0x7625('0x5')]!==_0x7625('0x6'))_0x306e0b[_0x424f8b](util[_0x7625('0x17')](_0x7625('0x3e'),_0x4d8e79[_0x553023][_0xccc8f5]['type'],_0x4d8e79[_0x553023][_0xccc8f5][_0x7625('0x2')]));break;case 0xa:_0x306e0b[_0x424f8b](util[_0x7625('0x17')](_0x7625('0x21'),_0x4d8e79[_0x553023][_0xccc8f5]['name']));break;}}}}})[_0x7625('0xb')](function(){if(_0x424f8b===_0x7625('0x3f')){var _0x8ba990=_['map'](_0xc8b3ae[_0x7625('0x40')],'id');return _0xc8b3ae[_0x7625('0x41')](_0x8ba990)['then'](function(){for(var _0x2a1f48=0x0;_0x2a1f48<_0x8ba990[_0x7625('0x16')];_0x2a1f48+=0x1){_0x3b1e83[_0x7625('0x42')](_0x7625('0x43'),{'ChatInteractionId':Number(_0x8ba990[_0x2a1f48]),'UserId':Number(_0xc8b3ae['id'])});}});}})[_0x7625('0xb')](function(){if(_0x424f8b===_0x7625('0x3f')){var _0x4ebeff=_[_0x7625('0x13')](_0xc8b3ae[_0x7625('0x44')],'id');return _0xc8b3ae[_0x7625('0x45')](_0x4ebeff)[_0x7625('0xb')](function(){for(var _0x37d3a0=0x0;_0x37d3a0<_0x4ebeff[_0x7625('0x16')];_0x37d3a0+=0x1){_0x3b1e83[_0x7625('0x42')](_0x7625('0x46'),{'MailInteractionId':Number(_0x4ebeff[_0x37d3a0]),'UserId':Number(_0xc8b3ae['id'])});}});}})['then'](function(){if(_0x424f8b===_0x7625('0x3f')){var _0x5178d8=_['map'](_0xc8b3ae[_0x7625('0x1d')],'id');return _0xc8b3ae[_0x7625('0x47')](_0x5178d8)[_0x7625('0xb')](function(){for(var _0xa1130e=0x0;_0xa1130e<_0x5178d8[_0x7625('0x16')];_0xa1130e+=0x1){_0x3b1e83[_0x7625('0x42')](_0x7625('0x48'),{'FaxInteractionId':Number(_0x5178d8[_0xa1130e]),'UserId':Number(_0xc8b3ae['id'])});}});}})[_0x7625('0xb')](function(){if(_0x424f8b===_0x7625('0x3f')){var _0x489146=_[_0x7625('0x13')](_0xc8b3ae['SmsInteractions'],'id');return _0xc8b3ae['removeSmsInteractions'](_0x489146)[_0x7625('0xb')](function(){for(var _0x2a033b=0x0;_0x2a033b<_0x489146[_0x7625('0x16')];_0x2a033b+=0x1){_0x3b1e83[_0x7625('0x42')](_0x7625('0x49'),{'SmsInteractionId':Number(_0x489146[_0x2a033b]),'UserId':Number(_0xc8b3ae['id'])});}});}})[_0x7625('0xb')](function(){if(_0x424f8b===_0x7625('0x3f')){var _0x555687=_['map'](_0xc8b3ae[_0x7625('0x1f')],'id');return _0xc8b3ae['removeOpenchannelInteractions'](_0x555687)[_0x7625('0xb')](function(){for(var _0x3b8266=0x0;_0x3b8266<_0x555687[_0x7625('0x16')];_0x3b8266+=0x1){_0x3b1e83[_0x7625('0x42')](_0x7625('0x4a'),{'OpenchannelInteractionId':Number(_0x555687[_0x3b8266]),'UserId':Number(_0xc8b3ae['id'])});}});}})[_0x7625('0xb')](function(){if(_0x424f8b===_0x7625('0x3f')){var _0x27fee6=_['map'](_0xc8b3ae['WhatsappInteractions'],'id');return _0xc8b3ae[_0x7625('0x4b')](_0x27fee6)[_0x7625('0xb')](function(){for(var _0x23199a=0x0;_0x23199a<_0x27fee6[_0x7625('0x16')];_0x23199a+=0x1){_0x3b1e83['emit'](_0x7625('0x4c'),{'WhatsappInteractionId':Number(_0x27fee6[_0x23199a]),'UserId':Number(_0xc8b3ae['id'])});}});}})[_0x7625('0x4d')](function(_0x1abf67){_0x306e0b[_0x7625('0x4e')](_0x1abf67);});}}function onDisconnect(_0x4524f1,_0x301851){joinOrLeave(_0x4524f1,'leave',_0x301851);}function onConnect(_0x4b7458){joinOrLeave(_0x4b7458,_0x7625('0x4f'));}exports[_0x7625('0x50')]=function(_0x501b9c){_0x501b9c['on'](_0x7625('0x51'),function(_0x8daa28){_0x8daa28[_0x7625('0x52')](0x0);_0x8daa28[_0x7625('0x53')]=_0x8daa28[_0x7625('0x54')]['connection'][_0x7625('0x55')]+':'+_0x8daa28[_0x7625('0x54')][_0x7625('0x51')][_0x7625('0x56')];_0x8daa28[_0x7625('0x57')]=new Date();_0x8daa28[_0x7625('0x4e')]=function(_0x293203){console[_0x7625('0x4e')](_0x7625('0x58')+_0x8daa28['nsp']['name']+'['+_0x8daa28[_0x7625('0x53')]+']',_0x293203);};_0x8daa28['on'](_0x7625('0x59'),function(){onDisconnect(_0x8daa28,_0x501b9c);_0x8daa28[_0x7625('0x4e')](_0x7625('0x5a'));});onConnect(_0x8daa28);_0x8daa28[_0x7625('0x4e')](_0x7625('0x5b'));});}; \ No newline at end of file +var _0x505d=['WhatsappQueue','Trunk','Campaign','user','voice:outbound','VoiceQueues','SmsQueue','MailQueues','WhatsappQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','length','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','connection','remoteAddress','request','connectedAt','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','bluebird','../mysqldb','./environment','name','Agents','role','agent','ivr','UserProfileSection','then','autoAssociation','ChatQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','User','where','telephone','type','format','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0x505d,0x93));var _0xd505=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x505d[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xd505('0x0'));var db=require(_0xd505('0x1'))['db'];var config=require(_0xd505('0x2'));var queryQueues={'attributes':['id',_0xd505('0x3')],'include':[{'as':_0xd505('0x4'),'model':db['User'],'attributes':['id',_0xd505('0x3'),_0xd505('0x5')],'raw':!![],'where':{'role':_0xd505('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd505('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xd505('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd505('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd505('0x3'),'type'],'where':{'type':_0xd505('0x7')}};function getAssociatedResources(_0x287276,_0x4de6b6,_0x47b37a){return db[_0xd505('0x8')]['findOne']({'where':{'name':_0x287276,'userProfileId':_0x4de6b6},'raw':!![]})[_0xd505('0x9')](function(_0x5d0112){if(_0x5d0112){if(_0x5d0112[_0xd505('0xa')]){switch(_0x287276){case'VoiceQueues':case _0xd505('0xb'):case'FaxQueues':case'SmsQueues':case'MailQueues':case _0xd505('0xc'):case'WhatsappQueues':return db[_0x47b37a][_0xd505('0xd')](queryQueues);case _0xd505('0xe'):return db[_0x47b37a]['findAll'](queryTelephones);case'Trunks':return db[_0x47b37a][_0xd505('0xd')](queryTrunks);case _0xd505('0xf'):return db[_0x47b37a][_0xd505('0xd')](queryCampaigns);}}else{return db[_0xd505('0x10')][_0xd505('0xd')]({'attributes':[_0xd505('0x11')],'where':{'sectionId':_0x5d0112['id']},'raw':!![]})[_0xd505('0x9')](function(_0x1052da){if(_0x1052da){var _0x20088a={'where':{'id':_['map'](_0x1052da,_0xd505('0x11'))},'raw':!![]};switch(_0x47b37a){case _0xd505('0x12'):_0x20088a[_0xd505('0x13')]['role']=_0xd505('0x14');break;case'Campaign':_0x20088a[_0xd505('0x13')][_0xd505('0x15')]='ivr';break;}return db[_0x47b37a][_0xd505('0xd')](_0x20088a);}else{return[];}});}}else{return[];}})[_0xd505('0x9')](function(_0x471797){return _0x471797;});}function joinOrLeaveQueues(_0x8d42e4,_0x405471,_0x4fafba,_0x43b76e){_0x8d42e4[_0x405471](util[_0xd505('0x16')]('%s:queue:%s',_0x4fafba,_0x43b76e['name']));if(_0x43b76e['Agents']){for(var _0x24acdb=0x0;_0x24acdb<_0x43b76e[_0xd505('0x4')]['length'];_0x24acdb+=0x1){_0x8d42e4[_0x405471](util[_0xd505('0x16')]('user:%s',_0x43b76e['Agents'][_0x24acdb][_0xd505('0x3')]));}}}function joinOrLeave(_0x4fcbf8,_0x574a7c,_0x4118c5){var _0x50ebfa;if(_0x4fcbf8['handshake'][_0xd505('0x17')]['id']){db[_0xd505('0x12')][_0xd505('0x18')]({'attributes':['id','name',_0xd505('0x5'),_0xd505('0x19')],'where':{'id':_0x4fcbf8['handshake']['query']['id']},'include':[{'model':db[_0xd505('0x1a')],'as':_0xd505('0x1b'),'attributes':['id'],'raw':!![]},{'model':db[_0xd505('0x1c')],'as':_0xd505('0x1d'),'attributes':['id'],'raw':!![]},{'model':db[_0xd505('0x1e')],'as':_0xd505('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xd505('0x20')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd505('0x21')],'as':_0xd505('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xd505('0x23')],'as':_0xd505('0x24'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2d8d67){if(_0x2d8d67){_0x50ebfa=_0x2d8d67;_0x4fcbf8[_0x574a7c](util[_0xd505('0x16')]('user:%s',_0x2d8d67['name']));var _0x4c33ea=[];switch(_0x2d8d67[_0xd505('0x5')]){case _0xd505('0x25'):_0x4fcbf8[_0x574a7c](_0xd505('0x26'));_0x4fcbf8[_0x574a7c]('voice:outbound');if(queryQueues[_0xd505('0x27')]('include')){delete queryQueues[_0xd505('0x28')];}_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x2a')]['findAll'](queryQueues));_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x2b')]['findAll'](queryQueues));_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x2c')][_0xd505('0xd')](queryQueues));_0x4c33ea[_0xd505('0x29')](db['SmsQueue']['findAll'](queryQueues));_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x2d')][_0xd505('0xd')](queryQueues));_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x2e')][_0xd505('0xd')](queryQueues));_0x4c33ea['push'](db[_0xd505('0x2f')]['findAll'](queryQueues));_0x4c33ea[_0xd505('0x29')](db['User'][_0xd505('0xd')](queryTelephones));_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x30')][_0xd505('0xd')](queryTrunks));_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x31')][_0xd505('0xd')](queryCampaigns));_0x4c33ea[_0xd505('0x29')](db['User']['findAll'](queryAgents));break;case _0xd505('0x32'):_0x4fcbf8[_0x574a7c](_0xd505('0x26'));_0x4fcbf8[_0x574a7c](_0xd505('0x33'));_0x4c33ea['push'](getAssociatedResources(_0xd505('0x34'),_0x2d8d67[_0xd505('0x19')],_0xd505('0x2a')));_0x4c33ea[_0xd505('0x29')](getAssociatedResources(_0xd505('0xb'),_0x2d8d67[_0xd505('0x19')],_0xd505('0x2b')));_0x4c33ea[_0xd505('0x29')](getAssociatedResources('FaxQueues',_0x2d8d67[_0xd505('0x19')],_0xd505('0x2c')));_0x4c33ea[_0xd505('0x29')](getAssociatedResources('SmsQueues',_0x2d8d67[_0xd505('0x19')],_0xd505('0x35')));_0x4c33ea['push'](getAssociatedResources(_0xd505('0x36'),_0x2d8d67[_0xd505('0x19')],_0xd505('0x2d')));_0x4c33ea['push'](getAssociatedResources(_0xd505('0xc'),_0x2d8d67[_0xd505('0x19')],_0xd505('0x2e')));_0x4c33ea[_0xd505('0x29')](getAssociatedResources(_0xd505('0x37'),_0x2d8d67[_0xd505('0x19')],_0xd505('0x2f')));_0x4c33ea['push'](getAssociatedResources(_0xd505('0xe'),_0x2d8d67[_0xd505('0x19')],'User'));_0x4c33ea[_0xd505('0x29')](getAssociatedResources(_0xd505('0x38'),_0x2d8d67[_0xd505('0x19')],_0xd505('0x30')));_0x4c33ea[_0xd505('0x29')](getAssociatedResources(_0xd505('0xf'),_0x2d8d67['userProfileId'],'Campaign'));_0x4c33ea[_0xd505('0x29')](db[_0xd505('0x12')]['findAll'](queryAgents));break;case _0xd505('0x6'):_0x4fcbf8[_0x574a7c](_0xd505('0x26'));_0x4fcbf8[_0x574a7c]('voice:outbound');_0x4c33ea[_0xd505('0x29')](_0x2d8d67[_0xd505('0x39')]({'attributes':['id',_0xd505('0x3')]}));_0x4c33ea[_0xd505('0x29')](_0x2d8d67[_0xd505('0x3a')]({'attributes':['id',_0xd505('0x3')]}));_0x4c33ea[_0xd505('0x29')](_0x2d8d67[_0xd505('0x3b')]({'attributes':['id','name']}));_0x4c33ea[_0xd505('0x29')](_0x2d8d67[_0xd505('0x3c')]({'attributes':['id',_0xd505('0x3')]}));_0x4c33ea[_0xd505('0x29')](_0x2d8d67[_0xd505('0x3d')]({'attributes':['id',_0xd505('0x3')]}));_0x4c33ea['push'](_0x2d8d67['getOpenchannelQueues']({'attributes':['id','name']}));_0x4c33ea['push'](_0x2d8d67[_0xd505('0x3e')]({'attributes':['id',_0xd505('0x3')]}));break;}return BPromise['all'](_0x4c33ea);}})[_0xd505('0x9')](function(_0xe4ad3b){if(_0xe4ad3b&&_0xe4ad3b[_0xd505('0x3f')]){for(var _0x49f855=0x0;_0x49f855<_0xe4ad3b['length'];_0x49f855+=0x1){for(var _0x43301f=0x0;_0x43301f<_0xe4ad3b[_0x49f855][_0xd505('0x3f')];_0x43301f+=0x1){switch(_0x49f855){case 0x0:joinOrLeaveQueues(_0x4fcbf8,_0x574a7c,'voice',_0xe4ad3b[_0x49f855][_0x43301f]);break;case 0x1:joinOrLeaveQueues(_0x4fcbf8,_0x574a7c,'chat',_0xe4ad3b[_0x49f855][_0x43301f]);break;case 0x2:joinOrLeaveQueues(_0x4fcbf8,_0x574a7c,'fax',_0xe4ad3b[_0x49f855][_0x43301f]);break;case 0x3:joinOrLeaveQueues(_0x4fcbf8,_0x574a7c,_0xd505('0x40'),_0xe4ad3b[_0x49f855][_0x43301f]);break;case 0x4:joinOrLeaveQueues(_0x4fcbf8,_0x574a7c,'mail',_0xe4ad3b[_0x49f855][_0x43301f]);break;case 0x5:joinOrLeaveQueues(_0x4fcbf8,_0x574a7c,_0xd505('0x41'),_0xe4ad3b[_0x49f855][_0x43301f]);break;case 0x6:joinOrLeaveQueues(_0x4fcbf8,_0x574a7c,_0xd505('0x42'),_0xe4ad3b[_0x49f855][_0x43301f]);break;case 0x7:if(_0x50ebfa[_0xd505('0x5')]!==_0xd505('0x6'))_0x4fcbf8[_0x574a7c](util[_0xd505('0x16')](_0xd505('0x43'),_0xe4ad3b[_0x49f855][_0x43301f][_0xd505('0x3')]));break;case 0x8:if(_0x50ebfa['role']!==_0xd505('0x6'))_0x4fcbf8[_0x574a7c](util[_0xd505('0x16')](_0xd505('0x44'),_0xe4ad3b[_0x49f855][_0x43301f]['name']));break;case 0x9:if(_0x50ebfa[_0xd505('0x5')]!=='agent')_0x4fcbf8[_0x574a7c](util[_0xd505('0x16')](_0xd505('0x45'),_0xe4ad3b[_0x49f855][_0x43301f][_0xd505('0x15')],_0xe4ad3b[_0x49f855][_0x43301f]['name']));break;case 0xa:_0x4fcbf8[_0x574a7c](util[_0xd505('0x16')]('user:%s',_0xe4ad3b[_0x49f855][_0x43301f][_0xd505('0x3')]));break;}}}}})[_0xd505('0x9')](function(){if(_0x574a7c===_0xd505('0x46')){var _0x8ba858=_[_0xd505('0x47')](_0x50ebfa[_0xd505('0x1b')],'id');return _0x50ebfa['removeChatInteractions'](_0x8ba858)[_0xd505('0x9')](function(){for(var _0x36a0bc=0x0;_0x36a0bc<_0x8ba858['length'];_0x36a0bc+=0x1){_0x4118c5[_0xd505('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x8ba858[_0x36a0bc]),'UserId':Number(_0x50ebfa['id'])});}});}})[_0xd505('0x9')](function(){if(_0x574a7c===_0xd505('0x46')){var _0x3486fd=_[_0xd505('0x47')](_0x50ebfa['MailInteractions'],'id');return _0x50ebfa[_0xd505('0x49')](_0x3486fd)['then'](function(){for(var _0x1c00c4=0x0;_0x1c00c4<_0x3486fd['length'];_0x1c00c4+=0x1){_0x4118c5[_0xd505('0x48')](_0xd505('0x4a'),{'MailInteractionId':Number(_0x3486fd[_0x1c00c4]),'UserId':Number(_0x50ebfa['id'])});}});}})[_0xd505('0x9')](function(){if(_0x574a7c===_0xd505('0x46')){var _0x20dc7b=_['map'](_0x50ebfa['FaxInteractions'],'id');return _0x50ebfa[_0xd505('0x4b')](_0x20dc7b)[_0xd505('0x9')](function(){for(var _0x3e45ef=0x0;_0x3e45ef<_0x20dc7b['length'];_0x3e45ef+=0x1){_0x4118c5['emit'](_0xd505('0x4c'),{'FaxInteractionId':Number(_0x20dc7b[_0x3e45ef]),'UserId':Number(_0x50ebfa['id'])});}});}})[_0xd505('0x9')](function(){if(_0x574a7c===_0xd505('0x46')){var _0x2916c9=_[_0xd505('0x47')](_0x50ebfa['SmsInteractions'],'id');return _0x50ebfa[_0xd505('0x4d')](_0x2916c9)[_0xd505('0x9')](function(){for(var _0x19bfc6=0x0;_0x19bfc6<_0x2916c9[_0xd505('0x3f')];_0x19bfc6+=0x1){_0x4118c5['emit'](_0xd505('0x4e'),{'SmsInteractionId':Number(_0x2916c9[_0x19bfc6]),'UserId':Number(_0x50ebfa['id'])});}});}})[_0xd505('0x9')](function(){if(_0x574a7c==='leave'){var _0x1c9486=_[_0xd505('0x47')](_0x50ebfa['OpenchannelInteractions'],'id');return _0x50ebfa[_0xd505('0x4f')](_0x1c9486)['then'](function(){for(var _0x5ab495=0x0;_0x5ab495<_0x1c9486[_0xd505('0x3f')];_0x5ab495+=0x1){_0x4118c5[_0xd505('0x48')](_0xd505('0x50'),{'OpenchannelInteractionId':Number(_0x1c9486[_0x5ab495]),'UserId':Number(_0x50ebfa['id'])});}});}})[_0xd505('0x9')](function(){if(_0x574a7c===_0xd505('0x46')){var _0x2afd75=_[_0xd505('0x47')](_0x50ebfa[_0xd505('0x24')],'id');return _0x50ebfa[_0xd505('0x51')](_0x2afd75)[_0xd505('0x9')](function(){for(var _0x36a29c=0x0;_0x36a29c<_0x2afd75[_0xd505('0x3f')];_0x36a29c+=0x1){_0x4118c5[_0xd505('0x48')](_0xd505('0x52'),{'WhatsappInteractionId':Number(_0x2afd75[_0x36a29c]),'UserId':Number(_0x50ebfa['id'])});}});}})[_0xd505('0x53')](function(_0x15f77e){_0x4fcbf8[_0xd505('0x54')](_0x15f77e);});}}function onDisconnect(_0x119a68,_0x1bca5f){joinOrLeave(_0x119a68,_0xd505('0x46'),_0x1bca5f);}function onConnect(_0x58dcc8){joinOrLeave(_0x58dcc8,_0xd505('0x55'));}exports[_0xd505('0x56')]=function(_0x365057){_0x365057['on']('connection',function(_0x42212e){_0x42212e[_0xd505('0x57')](0x0);_0x42212e['address']=_0x42212e['request'][_0xd505('0x58')][_0xd505('0x59')]+':'+_0x42212e[_0xd505('0x5a')][_0xd505('0x58')]['remotePort'];_0x42212e[_0xd505('0x5b')]=new Date();_0x42212e[_0xd505('0x54')]=function(_0x44e530){console['log'](_0xd505('0x5c')+_0x42212e[_0xd505('0x5d')][_0xd505('0x3')]+'['+_0x42212e[_0xd505('0x5e')]+']',_0x44e530);};_0x42212e['on'](_0xd505('0x5f'),function(){onDisconnect(_0x42212e,_0x365057);_0x42212e['log'](_0xd505('0x60'));});onConnect(_0x42212e);_0x42212e[_0xd505('0x54')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c29c1da..dd7ed9e 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 _0x1a0c=['closedinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','WhatsappInteraction','Whatsapp','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','EventManager','then','Trigger,\x20%s','error','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','contact','UserId','interface','incomingmessage','outgoingmessage','AfterCreateMessage','Sequelize','QueryTypes','format','SIP/%s','name','AfterCreate','changed','substatus','agent','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction'];(function(_0x45bc26,_0x4032d1){var _0x8d2e86=function(_0x43e6ee){while(--_0x43e6ee){_0x45bc26['push'](_0x45bc26['shift']());}};_0x8d2e86(++_0x4032d1);}(_0x1a0c,0xc8));var _0xc1a0=function(_0x5920c9,_0x562f1e){_0x5920c9=_0x5920c9-0x0;var _0x1781de=_0x1a0c[_0x5920c9];return _0x1781de;};'use strict';var util=require(_0xc1a0('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc1a0('0x1'));var logger=require(_0xc1a0('0x2'))(_0xc1a0('0x3'));var client=jayson[_0xc1a0('0x4')][_0xc1a0('0x5')]({'port':0x232a});var triggers=[{'channel':_0xc1a0('0x6'),'model':_0xc1a0('0x7'),'event':_0xc1a0('0x8'),'condition':_0xc1a0('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0xc1a0('0x7'),'event':'afterUpdate','condition':_0xc1a0('0xa'),'callback':afterUpdate},{'channel':_0xc1a0('0x6'),'model':'ChatMessage','event':'afterCreate','condition':_0xc1a0('0xb'),'callback':afterCreateMessage},{'channel':_0xc1a0('0x6'),'model':_0xc1a0('0xc'),'event':_0xc1a0('0x8'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xc1a0('0xd'),'model':_0xc1a0('0xe'),'event':'afterCreate','condition':_0xc1a0('0x9'),'callback':afterCreate},{'channel':_0xc1a0('0xd'),'model':_0xc1a0('0xe'),'event':_0xc1a0('0xf'),'condition':_0xc1a0('0xa'),'callback':afterUpdate},{'channel':_0xc1a0('0xd'),'model':'SmsMessage','event':'afterCreate','condition':_0xc1a0('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':'afterCreate','condition':_0xc1a0('0x9'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xc1a0('0x10'),'event':'afterUpdate','condition':_0xc1a0('0xa'),'callback':afterUpdate},{'channel':_0xc1a0('0x11'),'model':_0xc1a0('0x12'),'event':'afterCreate','condition':_0xc1a0('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xc1a0('0x13'),'event':_0xc1a0('0x8'),'condition':_0xc1a0('0x9'),'callback':afterCreate},{'channel':_0xc1a0('0x14'),'model':'FaxInteraction','event':_0xc1a0('0xf'),'condition':_0xc1a0('0xa'),'callback':afterUpdate},{'channel':_0xc1a0('0x14'),'model':_0xc1a0('0x15'),'event':_0xc1a0('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xc1a0('0x16'),'model':_0xc1a0('0x17'),'event':'afterCreate','condition':_0xc1a0('0x9'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0xc1a0('0xf'),'condition':_0xc1a0('0xa'),'callback':afterUpdate},{'channel':_0xc1a0('0x16'),'model':'MailMessage','event':_0xc1a0('0x8'),'condition':_0xc1a0('0xb'),'callback':afterCreateMessage},{'channel':_0xc1a0('0x18'),'model':_0xc1a0('0x19'),'event':'afterCreate','condition':_0xc1a0('0x9'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xc1a0('0xf'),'condition':_0xc1a0('0xa'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0xc1a0('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0xed65a1){return client['request'](_0xc1a0('0x1a'),_0xed65a1)[_0xc1a0('0x1b')](function(_0x1ea298){logger['info'](_0xc1a0('0x1c'),_0xc1a0('0x1a'),_0x1ea298);if(_0x1ea298['error']){if(_0x1ea298[_0xc1a0('0x1d')]['code']===0x1f4){logger['error'](_0xc1a0('0x1c'),_0xc1a0('0x1a'),_0x1ea298['error']);}}})[_0xc1a0('0x1e')](function(_0x2ef447){logger[_0xc1a0('0x1d')](_0xc1a0('0x1c'),'EventManager',_0x2ef447);});}function afterCreateMessage(_0x5dedb4){return function(_0x2e702e){_0x2e702e=_0x2e702e[_0xc1a0('0x1f')]({'plain':!![]});_0x2e702e[_0xc1a0('0x20')]=_0x5dedb4;_0x2e702e[_0xc1a0('0x21')]=_0x5dedb4;_0x2e702e[_0xc1a0('0x22')]=_0x2e702e[_0xc1a0('0x23')];Promise[_0xc1a0('0x24')]()[_0xc1a0('0x1b')](function(){if(typeof _0x2e702e[_0xc1a0('0x25')]===_0xc1a0('0x26'))return null;var _0x4892ad=_0xc1a0('0x27')+_0x2e702e[_0xc1a0('0x25')];return db[_0xc1a0('0x28')][_0xc1a0('0x29')](_0x4892ad,{'type':db['Sequelize']['QueryTypes'][_0xc1a0('0x2a')],'raw':!![]});})[_0xc1a0('0x1b')](function(_0x11a9c5){if(_0x11a9c5){_0x2e702e[_0xc1a0('0x2b')]=_0x11a9c5[0x0];}if(typeof _0x2e702e[_0xc1a0('0x2c')]===_0xc1a0('0x26'))return;return getAgent(_0x2e702e[_0xc1a0('0x2c')]);})['then'](function(_0x5d897f){if(_0x5d897f){_0x2e702e[_0xc1a0('0x2d')]=util['format']('SIP/%s',_0x5d897f['name']);_0x2e702e['agent']=_0x5d897f;_0x2e702e[_0xc1a0('0x20')]=_0x5dedb4;return request({'event':_0xc1a0('0x2e'),'message':_0x2e702e});}else{return request({'event':_0xc1a0('0x2f'),'message':_0x2e702e});}})[_0xc1a0('0x1e')](function(_0x3489d1){logger['error']('Trigger,\x20%s',_0xc1a0('0x30'),_0x3489d1);});};}function afterCreateOfflineMessage(_0x2b6734){return function(_0x264b49){_0x264b49=_0x264b49[_0xc1a0('0x1f')]({'plain':!![]});_0x264b49[_0xc1a0('0x20')]=_0x2b6734;_0x264b49[_0xc1a0('0x21')]=_0x2b6734;_0x264b49[_0xc1a0('0x22')]='offlineMessage';return request({'event':_0x264b49[_0xc1a0('0x22')],'message':_0x264b49});};}function afterCreate(_0x5c81e6,_0x1d5700){return function(_0x56ea18){_0x56ea18=_0x56ea18[_0xc1a0('0x1f')]({'plain':!![]});_0x56ea18[_0xc1a0('0x20')]=_0x5c81e6;_0x56ea18[_0xc1a0('0x21')]=_0x5c81e6;_0x56ea18[_0xc1a0('0x22')]='opened';Promise[_0xc1a0('0x24')]()['then'](function(){var _0x46b461=_0xc1a0('0x27')+_0x56ea18[_0xc1a0('0x25')];return db[_0xc1a0('0x28')][_0xc1a0('0x29')](_0x46b461,{'type':db[_0xc1a0('0x31')][_0xc1a0('0x32')][_0xc1a0('0x2a')],'raw':!![]});})[_0xc1a0('0x1b')](function(_0xba64e7){if(_0xba64e7){_0x56ea18['contact']=_0xba64e7[0x0];}if(typeof _0x56ea18[_0xc1a0('0x2c')]===_0xc1a0('0x26'))return;return getAgent(_0x56ea18[_0xc1a0('0x2c')]);})['then'](function(_0x5a663c){if(_0x5a663c){_0x56ea18[_0xc1a0('0x2d')]=util[_0xc1a0('0x33')](_0xc1a0('0x34'),_0x5a663c[_0xc1a0('0x35')]);_0x56ea18['agent']=_0x5a663c;}return request({'event':_0x1d5700,'message':_0x56ea18});})[_0xc1a0('0x1e')](function(_0x49ec27){logger['error'](_0xc1a0('0x1c'),_0xc1a0('0x36'),_0x49ec27);});};}function afterUpdate(_0x13c3b7){return function(_0x3b0ba1){var _0x2adfac=_0x3b0ba1[_0xc1a0('0x37')]('closed')&&_0x3b0ba1['closed'];var _0x47860b=_0x3b0ba1[_0xc1a0('0x37')](_0xc1a0('0x38'));if(_0x2adfac||_0x47860b){var _0x18bc33=_0x2adfac?_0xc1a0('0xa'):'substatus';var _0x51a6b1=_0x3b0ba1[_0xc1a0('0x1f')]({'plain':!![]});_0x51a6b1[_0xc1a0('0x20')]=_0x13c3b7;_0x51a6b1[_0xc1a0('0x21')]=_0x13c3b7;_0x51a6b1['event']=_0x2adfac?'closed':_0xc1a0('0x38');var _0x38ba31=_0xc1a0('0x27')+_0x51a6b1[_0xc1a0('0x25')];return db[_0xc1a0('0x28')][_0xc1a0('0x29')](_0x38ba31,{'type':db['Sequelize'][_0xc1a0('0x32')][_0xc1a0('0x2a')],'raw':!![]})['then'](function(_0x292f21){if(_0x292f21){_0x51a6b1[_0xc1a0('0x2b')]=_0x292f21[0x0];}if(typeof _0x51a6b1[_0xc1a0('0x2c')]===_0xc1a0('0x26'))return;return getAgent(_0x51a6b1[_0xc1a0('0x2c')]);})[_0xc1a0('0x1b')](function(_0x310032){if(_0x310032){_0x51a6b1[_0xc1a0('0x2d')]=util[_0xc1a0('0x33')](_0xc1a0('0x34'),_0x310032[_0xc1a0('0x35')]);_0x51a6b1[_0xc1a0('0x39')]=_0x310032;}return request({'event':_0x18bc33,'message':_0x51a6b1});})[_0xc1a0('0x1e')](function(_0x331f49){logger['error'](_0xc1a0('0x1c'),'AfterUpdate',_0x331f49);});}};}function getAgent(_0x19a1f3){return db[_0xc1a0('0x3a')][_0xc1a0('0x3b')]({'where':{'id':_0x19a1f3},'attributes':['id',_0xc1a0('0x35'),_0xc1a0('0x3c'),_0xc1a0('0x3d'),_0xc1a0('0x3e')],'raw':!![]})['then'](function(_0x5850cf){return _0x5850cf;});}exports[_0xc1a0('0x3f')]=function(){for(var _0x2ddf58=0x0;_0x2ddf58=_0x2e750f[_0xe1f5('0xf')]){throw Error(_0xe1f5('0x10'));}_0x2d955c(_0x313b90);})[_0xe1f5('0x11')](function(_0x2de1fa){_0x5aa3a8(_0x2de1fa);});});}; \ No newline at end of file +var _0x0184=['count','then','agents','lodash','../mysqldb','./license/util','voice','mail','chat','sms','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User'];(function(_0x97def9,_0x320c56){var _0x53c5ad=function(_0x24cb55){while(--_0x24cb55){_0x97def9['push'](_0x97def9['shift']());}};_0x53c5ad(++_0x320c56);}(_0x0184,0x163));var _0x4018=function(_0xf38492,_0x45d84e){_0xf38492=_0xf38492-0x0;var _0x3e66e3=_0x0184[_0xf38492];return _0x3e66e3;};'use strict';var _=require(_0x4018('0x0'));var BPromise=require('bluebird');var db=require(_0x4018('0x1'))['db'];var util=require(_0x4018('0x2'));var channels=[_0x4018('0x3'),_0x4018('0x4'),_0x4018('0x5'),'fax',_0x4018('0x6'),'whatsapp',_0x4018('0x7')];exports['getChannels']=function(){return channels;};exports[_0x4018('0x8')]=function(_0x4e12a9){_0x4e12a9=_0x4e12a9[_0x4018('0x9')]();return _[_0x4018('0xa')](channels,_0x4e12a9);};exports[_0x4018('0xb')]=function(_0x310fbb,_0x1834a6,_0x3aebf9,_0x40525a){var _0x52e246={'loginAttempts':_0x1834a6,'blocked':_0x3aebf9};if(!_[_0x4018('0xc')](_0x40525a)){_0x52e246[_0x4018('0xd')]=_0x40525a;}return _0x310fbb[_0x4018('0xe')](_0x52e246);};exports[_0x4018('0xf')]=function(_0x1774fd){return new BPromise(function(_0x1834e5,_0x563206){var _0x5b66e2=0x0;if(_0x1774fd[_0x4018('0x10')]!==_0x4018('0x11')){_0x1834e5(_0x1774fd);}db[_0x4018('0x12')][_0x4018('0x13')]({'where':{'role':_0x4018('0x11'),'online':!![],'id':{'$ne':_0x1774fd['id']}}})['then'](function(_0x2cd2d8){_0x5b66e2=_0x2cd2d8;return util[_0x4018('0xf')]();})[_0x4018('0x14')](function(_0x554749){if(_0x554749&&_0x554749[_0x4018('0x15')]&&_0x5b66e2>=_0x554749[_0x4018('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1834e5(_0x1774fd);})['catch'](function(_0x5931f7){_0x563206(_0x5931f7);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 1422564..173cd5b 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x4448dc,_0x28053b){var _0x1f5d87=function(_0x8a4f7c){while(--_0x8a4f7c){_0x4448dc['push'](_0x4448dc['shift']());}};_0x1f5d87(++_0x28053b);}(_0x814b,0x1a2));var _0xb814=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x814b[_0x326d35];return _0xd3f8f3;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x144932,_0x29eb6a){var _0x46e030=function(_0x183573){while(--_0x183573){_0x144932['push'](_0x144932['shift']());}};_0x46e030(++_0x29eb6a);}(_0x814b,0x1a2));var _0xb814=function(_0x3cbe3a,_0x78bfce){_0x3cbe3a=_0x3cbe3a-0x0;var _0x24ffc1=_0x814b[_0x3cbe3a];return _0x24ffc1;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f60c199..a63e276 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5cc=['404','status','render','json','send','exports'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0xd5cc,0xfb));var _0xcd5c=function(_0x2108b7,_0x4eef6e){_0x2108b7=_0x2108b7-0x0;var _0x2048b1=_0xd5cc[_0x2108b7];return _0x2048b1;};'use strict';module[_0xcd5c('0x0')][0x194]=function pageNotFound(_0x351eda,_0x1a8891){var _0x3e2ea3=_0xcd5c('0x1');var _0x151e95=0x194;var _0x1937d8={'status':_0x151e95};_0x1a8891['status'](_0x1937d8[_0xcd5c('0x2')]);_0x1a8891[_0xcd5c('0x3')](_0x3e2ea3,{},function(_0x4607ff,_0x287618){if(_0x4607ff){return _0x1a8891['status'](_0x1937d8['status'])[_0xcd5c('0x4')](_0x1937d8);}_0x1a8891[_0xcd5c('0x5')](_0x287618);});}; \ No newline at end of file +var _0x95fa=['render','send','exports','status'];(function(_0x25234a,_0x5dc6b1){var _0x3ffa6d=function(_0x37d95d){while(--_0x37d95d){_0x25234a['push'](_0x25234a['shift']());}};_0x3ffa6d(++_0x5dc6b1);}(_0x95fa,0x196));var _0xa95f=function(_0x73dc3e,_0x3ab832){_0x73dc3e=_0x73dc3e-0x0;var _0x2083c5=_0x95fa[_0x73dc3e];return _0x2083c5;};'use strict';module[_0xa95f('0x0')][0x194]=function pageNotFound(_0x2273e8,_0x4ea0ca){var _0x11a377='404';var _0x1bd254=0x194;var _0x537d2b={'status':_0x1bd254};_0x4ea0ca[_0xa95f('0x1')](_0x537d2b[_0xa95f('0x1')]);_0x4ea0ca[_0xa95f('0x2')](_0x11a377,{},function(_0x14117a,_0xea5c32){if(_0x14117a){return _0x4ea0ca['status'](_0x537d2b['status'])['json'](_0x537d2b);}_0x4ea0ca[_0xa95f('0x3')](_0xea5c32);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 80f0609..55748e8 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(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 0f3a41f..77229f5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1542=['appPath','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/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/fax/reports/queue','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/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/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','join','/www','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve'];(function(_0x29df99,_0x46c1bb){var _0x5338a4=function(_0x585e7f){while(--_0x585e7f){_0x29df99['push'](_0x29df99['shift']());}};_0x5338a4(++_0x46c1bb);}(_0x1542,0x116));var _0x2154=function(_0x145229,_0x50dcd1){_0x145229=_0x145229-0x0;var _0xc9a6cf=_0x1542[_0x145229];return _0xc9a6cf;};'use strict';var path=require(_0x2154('0x0'));var express=require(_0x2154('0x1'));var errors=require(_0x2154('0x2'));var config=require(_0x2154('0x3'));var setupLoggers=require(_0x2154('0x4'))['setupLoggers'];var clientSideLogs=require(_0x2154('0x5'));exports[_0x2154('0x6')]=function(_0x13e41b){return setupLoggers(_0x13e41b)['then'](function(){_0x13e41b[_0x2154('0x7')](_0x2154('0x8'),require('./api/user'));_0x13e41b[_0x2154('0x7')](_0x2154('0x9'),require(_0x2154('0xa')));_0x13e41b[_0x2154('0x7')](_0x2154('0xb'),require(_0x2154('0xc')));_0x13e41b[_0x2154('0x7')](_0x2154('0xd'),require(_0x2154('0xe')));_0x13e41b[_0x2154('0x7')]('/api/voice/mohs',require(_0x2154('0xf')));_0x13e41b[_0x2154('0x7')](_0x2154('0x10'),require(_0x2154('0x11')));_0x13e41b['use'](_0x2154('0x12'),require(_0x2154('0x13')));_0x13e41b['use'](_0x2154('0x14'),require(_0x2154('0x15')));_0x13e41b[_0x2154('0x7')](_0x2154('0x16'),require(_0x2154('0x17')));_0x13e41b[_0x2154('0x7')](_0x2154('0x18'),require('./api/voiceMailMessage'));_0x13e41b['use'](_0x2154('0x19'),require('./api/voiceCallReport'));_0x13e41b[_0x2154('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x13e41b['use'](_0x2154('0x1a'),require('./api/voiceAgentReport'));_0x13e41b[_0x2154('0x7')]('/api/voice/queues/reports',require(_0x2154('0x1b')));_0x13e41b[_0x2154('0x7')](_0x2154('0x1c'),require(_0x2154('0x1d')));_0x13e41b[_0x2154('0x7')](_0x2154('0x1e'),require(_0x2154('0x1f')));_0x13e41b[_0x2154('0x7')](_0x2154('0x20'),require(_0x2154('0x21')));_0x13e41b['use'](_0x2154('0x22'),require(_0x2154('0x23')));_0x13e41b[_0x2154('0x7')]('/api/mail/accounts',require(_0x2154('0x24')));_0x13e41b[_0x2154('0x7')](_0x2154('0x25'),require(_0x2154('0x26')));_0x13e41b['use'](_0x2154('0x27'),require(_0x2154('0x28')));_0x13e41b[_0x2154('0x7')]('/api/mail/interactions',require('./api/mailInteraction'));_0x13e41b[_0x2154('0x7')](_0x2154('0x29'),require(_0x2154('0x2a')));_0x13e41b['use']('/api/mail/applications',require(_0x2154('0x2b')));_0x13e41b[_0x2154('0x7')](_0x2154('0x2c'),require(_0x2154('0x2d')));_0x13e41b['use'](_0x2154('0x2e'),require(_0x2154('0x2f')));_0x13e41b[_0x2154('0x7')]('/api/dashboards/items',require('./api/dashboardItem'));_0x13e41b[_0x2154('0x7')](_0x2154('0x30'),require(_0x2154('0x31')));_0x13e41b['use'](_0x2154('0x32'),require(_0x2154('0x33')));_0x13e41b[_0x2154('0x7')](_0x2154('0x34'),require(_0x2154('0x35')));_0x13e41b['use'](_0x2154('0x36'),require(_0x2154('0x37')));_0x13e41b[_0x2154('0x7')](_0x2154('0x38'),require(_0x2154('0x39')));_0x13e41b[_0x2154('0x7')](_0x2154('0x3a'),require('./api/faxQueueReport'));_0x13e41b[_0x2154('0x7')](_0x2154('0x3b'),require('./api/smsAccount'));_0x13e41b[_0x2154('0x7')]('/api/sms/applications',require('./api/smsApplication'));_0x13e41b[_0x2154('0x7')](_0x2154('0x3c'),require(_0x2154('0x3d')));_0x13e41b['use'](_0x2154('0x3e'),require(_0x2154('0x3f')));_0x13e41b[_0x2154('0x7')](_0x2154('0x40'),require(_0x2154('0x41')));_0x13e41b[_0x2154('0x7')](_0x2154('0x42'),require(_0x2154('0x43')));_0x13e41b['use'](_0x2154('0x44'),require('./api/openchannelApplication'));_0x13e41b[_0x2154('0x7')](_0x2154('0x45'),require(_0x2154('0x46')));_0x13e41b[_0x2154('0x7')](_0x2154('0x47'),require('./api/openchannelMessage'));_0x13e41b['use'](_0x2154('0x48'),require(_0x2154('0x49')));_0x13e41b[_0x2154('0x7')](_0x2154('0x4a'),require(_0x2154('0x4b')));_0x13e41b[_0x2154('0x7')](_0x2154('0x4c'),require(_0x2154('0x4d')));_0x13e41b[_0x2154('0x7')](_0x2154('0x4e'),require('./api/chatApplication'));_0x13e41b[_0x2154('0x7')]('/api/chat/interactions',require(_0x2154('0x4f')));_0x13e41b[_0x2154('0x7')](_0x2154('0x50'),require(_0x2154('0x51')));_0x13e41b[_0x2154('0x7')](_0x2154('0x52'),require('./api/chatOfflineMessage'));_0x13e41b[_0x2154('0x7')](_0x2154('0x53'),require(_0x2154('0x54')));_0x13e41b[_0x2154('0x7')](_0x2154('0x55'),require(_0x2154('0x56')));_0x13e41b[_0x2154('0x7')](_0x2154('0x57'),require(_0x2154('0x58')));_0x13e41b[_0x2154('0x7')]('/api/cm/companies',require('./api/cmCompany'));_0x13e41b[_0x2154('0x7')](_0x2154('0x59'),require('./api/cmContact'));_0x13e41b[_0x2154('0x7')](_0x2154('0x5a'),require('./api/cmHopper'));_0x13e41b[_0x2154('0x7')](_0x2154('0x5b'),require('./api/cmHopperBlack'));_0x13e41b['use'](_0x2154('0x5c'),require(_0x2154('0x5d')));_0x13e41b[_0x2154('0x7')](_0x2154('0x5e'),require(_0x2154('0x5f')));_0x13e41b[_0x2154('0x7')](_0x2154('0x60'),require(_0x2154('0x61')));_0x13e41b[_0x2154('0x7')](_0x2154('0x62'),require(_0x2154('0x63')));_0x13e41b['use']('/api/automations',require(_0x2154('0x64')));_0x13e41b['use'](_0x2154('0x65'),require(_0x2154('0x66')));_0x13e41b[_0x2154('0x7')](_0x2154('0x67'),require('./api/disposition'));_0x13e41b[_0x2154('0x7')](_0x2154('0x68'),require(_0x2154('0x69')));_0x13e41b[_0x2154('0x7')](_0x2154('0x6a'),require(_0x2154('0x6b')));_0x13e41b['use']('/api/pauses',require('./api/pause'));_0x13e41b[_0x2154('0x7')]('/api/cdr',require('./api/cdr'));_0x13e41b[_0x2154('0x7')](_0x2154('0x6c'),require(_0x2154('0x6d')));_0x13e41b[_0x2154('0x7')](_0x2154('0x6e'),require(_0x2154('0x6f')));_0x13e41b[_0x2154('0x7')](_0x2154('0x70'),require('./api/sound'));_0x13e41b[_0x2154('0x7')](_0x2154('0x71'),require(_0x2154('0x72')));_0x13e41b['use']('/api/contact_item_types',require(_0x2154('0x73')));_0x13e41b[_0x2154('0x7')](_0x2154('0x74'),require('./api/cmContactHasItem'));_0x13e41b[_0x2154('0x7')](_0x2154('0x75'),require(_0x2154('0x76')));_0x13e41b[_0x2154('0x7')](_0x2154('0x77'),require(_0x2154('0x78')));_0x13e41b[_0x2154('0x7')](_0x2154('0x79'),require('./api/trigger'));_0x13e41b[_0x2154('0x7')](_0x2154('0x7a'),require(_0x2154('0x7b')));_0x13e41b[_0x2154('0x7')]('/api/integrations',require(_0x2154('0x7c')));_0x13e41b['use']('/api/integrations/reports',require(_0x2154('0x7d')));_0x13e41b[_0x2154('0x7')](_0x2154('0x7e'),require(_0x2154('0x7f')));_0x13e41b[_0x2154('0x7')](_0x2154('0x80'),require(_0x2154('0x81')));_0x13e41b[_0x2154('0x7')](_0x2154('0x82'),require(_0x2154('0x83')));_0x13e41b['use']('/api/analytics/metrics',require(_0x2154('0x84')));_0x13e41b['use'](_0x2154('0x85'),require('./api/analyticFieldReport'));_0x13e41b[_0x2154('0x7')](_0x2154('0x86'),require(_0x2154('0x87')));_0x13e41b[_0x2154('0x7')](_0x2154('0x88'),require(_0x2154('0x89')));_0x13e41b[_0x2154('0x7')](_0x2154('0x8a'),require(_0x2154('0x8b')));_0x13e41b[_0x2154('0x7')](_0x2154('0x8c'),require(_0x2154('0x8d')));_0x13e41b[_0x2154('0x7')](_0x2154('0x8e'),require('./api/intSugarcrmAccount'));_0x13e41b['use'](_0x2154('0x8f'),require(_0x2154('0x90')));_0x13e41b[_0x2154('0x7')](_0x2154('0x91'),require(_0x2154('0x92')));_0x13e41b['use']('/api/integrations/desk/accounts',require(_0x2154('0x93')));_0x13e41b[_0x2154('0x7')](_0x2154('0x94'),require(_0x2154('0x95')));_0x13e41b[_0x2154('0x7')]('/api/integrations/desk/fields',require(_0x2154('0x96')));_0x13e41b[_0x2154('0x7')](_0x2154('0x97'),require(_0x2154('0x98')));_0x13e41b[_0x2154('0x7')]('/api/integrations/zoho/configurations',require(_0x2154('0x99')));_0x13e41b['use'](_0x2154('0x9a'),require(_0x2154('0x9b')));_0x13e41b[_0x2154('0x7')](_0x2154('0x9c'),require(_0x2154('0x9d')));_0x13e41b[_0x2154('0x7')]('/api/integrations/zendesk/configurations',require(_0x2154('0x9e')));_0x13e41b[_0x2154('0x7')](_0x2154('0x9f'),require(_0x2154('0xa0')));_0x13e41b[_0x2154('0x7')](_0x2154('0xa1'),require(_0x2154('0xa2')));_0x13e41b['use'](_0x2154('0xa3'),require(_0x2154('0xa4')));_0x13e41b[_0x2154('0x7')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x13e41b['use'](_0x2154('0xa5'),require('./api/intVtigerAccount'));_0x13e41b[_0x2154('0x7')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x13e41b[_0x2154('0x7')]('/api/integrations/vtiger/fields',require(_0x2154('0xa6')));_0x13e41b[_0x2154('0x7')](_0x2154('0xa7'),require('./api/intServicenowAccount'));_0x13e41b[_0x2154('0x7')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x13e41b[_0x2154('0x7')](_0x2154('0xa8'),require(_0x2154('0xa9')));_0x13e41b[_0x2154('0x7')](_0x2154('0xaa'),require('./api/intDynamics365Account'));_0x13e41b[_0x2154('0x7')]('/api/integrations/dynamics365/configurations',require(_0x2154('0xab')));_0x13e41b[_0x2154('0x7')](_0x2154('0xac'),require(_0x2154('0xad')));_0x13e41b['use'](_0x2154('0xae'),require('./api/intFreshsalesAccount'));_0x13e41b[_0x2154('0x7')](_0x2154('0xaf'),require('./api/intFreshsalesConfiguration'));_0x13e41b[_0x2154('0x7')](_0x2154('0xb0'),require(_0x2154('0xb1')));_0x13e41b['use']('/api/networks',require(_0x2154('0xb2')));_0x13e41b[_0x2154('0x7')]('/api/chat/reports/queue',require(_0x2154('0xb3')));_0x13e41b[_0x2154('0x7')](_0x2154('0xb4'),require(_0x2154('0xb5')));_0x13e41b[_0x2154('0x7')](_0x2154('0xb6'),require(_0x2154('0xb7')));_0x13e41b[_0x2154('0x7')](_0x2154('0xb8'),require(_0x2154('0xb9')));_0x13e41b[_0x2154('0x7')](_0x2154('0xba'),require(_0x2154('0xbb')));_0x13e41b[_0x2154('0x7')](_0x2154('0xbc'),require(_0x2154('0xbd')));_0x13e41b[_0x2154('0x7')](_0x2154('0xbe'),require(_0x2154('0xbf')));_0x13e41b['use'](_0x2154('0xc0'),require(_0x2154('0xc1')));_0x13e41b[_0x2154('0x7')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x13e41b[_0x2154('0x7')]('/api/settings',require('./api/setting'));_0x13e41b['use'](_0x2154('0xc2'),require(_0x2154('0xc3')));_0x13e41b[_0x2154('0x7')](_0x2154('0xc4'),require(_0x2154('0xc5')));_0x13e41b['use'](_0x2154('0xc6'),require(_0x2154('0xc7')));_0x13e41b['use'](_0x2154('0xc8'),require(_0x2154('0xc9')));_0x13e41b[_0x2154('0x7')](_0x2154('0xca'),require(_0x2154('0xcb')));_0x13e41b['use']('/api/license',require('./api/license'));_0x13e41b['use'](_0x2154('0xcc'),require(_0x2154('0xcd')));_0x13e41b['use'](_0x2154('0xce'),require(_0x2154('0xcf')));_0x13e41b[_0x2154('0x7')]('/api/attachments',require(_0x2154('0xd0')));_0x13e41b[_0x2154('0x7')]('/api/plugins',require(_0x2154('0xd1')));_0x13e41b[_0x2154('0x7')](_0x2154('0xd2'),require(_0x2154('0xd3')));_0x13e41b[_0x2154('0x7')](_0x2154('0xd4'),require('./api/chatTransferReport'));_0x13e41b[_0x2154('0x7')](_0x2154('0xd5'),require(_0x2154('0xd6')));_0x13e41b[_0x2154('0x7')](_0x2154('0xd7'),require(_0x2154('0xd8')));_0x13e41b[_0x2154('0x7')](_0x2154('0xd9'),require('./api/smsTransferReport'));_0x13e41b[_0x2154('0x7')](_0x2154('0xda'),require(_0x2154('0xdb')));_0x13e41b['use'](_0x2154('0xdc'),require(_0x2154('0xdd')));_0x13e41b[_0x2154('0x7')]('/api/userProfiles',require(_0x2154('0xde')));_0x13e41b[_0x2154('0x7')](_0x2154('0xdf'),require(_0x2154('0xe0')));_0x13e41b[_0x2154('0x7')]('/api/userProfile/resources',require(_0x2154('0xe1')));_0x13e41b[_0x2154('0x7')](_0x2154('0xe2'),require(_0x2154('0xe3')));_0x13e41b['use'](_0x2154('0xe4'),require(_0x2154('0xe5')));_0x13e41b['use'](_0x2154('0xe6'),require(_0x2154('0xe7')));_0x13e41b[_0x2154('0x7')]('/api/whatsapp/interactions',require(_0x2154('0xe8')));_0x13e41b[_0x2154('0x7')]('/api/whatsapp/messages',require(_0x2154('0xe9')));_0x13e41b['use'](_0x2154('0xea'),require(_0x2154('0xeb')));_0x13e41b[_0x2154('0x7')](_0x2154('0xec'),require('./api/whatsappTransferReport'));_0x13e41b[_0x2154('0x7')](_0x2154('0xed'),require(_0x2154('0xee')));_0x13e41b[_0x2154('0x7')](_0x2154('0xef'),require(_0x2154('0xf0')));_0x13e41b['use'](_0x2154('0xf1'),require(_0x2154('0xf2')));_0x13e41b[_0x2154('0x7')](_0x2154('0xf3'),require('./api/user-setting'));_0x13e41b[_0x2154('0x7')](_0x2154('0xf4'),require('./api/authLocal'));_0x13e41b[_0x2154('0x7')](_0x2154('0xf5'),require(_0x2154('0xf6')));_0x13e41b[_0x2154('0x7')](_0x2154('0xf7'),require('./api/authActiveDirectory'));_0x13e41b[_0x2154('0x7')](_0x2154('0xf8'),require(_0x2154('0xf9')));_0x13e41b[_0x2154('0x7')](_0x2154('0xfa'),require(_0x2154('0xfb')));_0x13e41b[_0x2154('0x7')](_0x2154('0xfc'),require(_0x2154('0xfd')));_0x13e41b[_0x2154('0x7')]('/api/system',require(_0x2154('0xfe')));_0x13e41b[_0x2154('0x7')](_0x2154('0xff'),require(_0x2154('0x100')));_0x13e41b[_0x2154('0x7')](_0x2154('0x101'),require(_0x2154('0x102')));_0x13e41b[_0x2154('0x7')](_0x2154('0x103'),clientSideLogs);_0x13e41b['use'](_0x2154('0x104'),express[_0x2154('0x105')](path['join'](config[_0x2154('0x106')],_0x2154('0x104'))));_0x13e41b[_0x2154('0x7')]('/www',express[_0x2154('0x105')](path[_0x2154('0x107')](config[_0x2154('0x106')],_0x2154('0x108'))));_0x13e41b[_0x2154('0x7')](_0x2154('0x109'),express['static'](path[_0x2154('0x107')](config[_0x2154('0x106')],_0x2154('0x109'))));_0x13e41b[_0x2154('0x7')](_0x2154('0x10a'),express[_0x2154('0x105')](path['join'](config[_0x2154('0x106')],_0x2154('0x10b'),_0x2154('0x10c'))));_0x13e41b[_0x2154('0x7')](_0x2154('0x10d'),express[_0x2154('0x105')](path['join'](config['root'],_0x2154('0x10e'))));_0x13e41b[_0x2154('0x10f')](_0x2154('0x110'))[_0x2154('0x111')](errors[0x194]);_0x13e41b[_0x2154('0x10f')]('/*')[_0x2154('0x111')](function(_0xb06a3,_0x54c797){_0x54c797[_0x2154('0x112')](path[_0x2154('0x113')](_0x13e41b[_0x2154('0x111')](_0x2154('0x114'))+'/index.html'));});return _0x13e41b;});}; \ No newline at end of file +var _0xa101=['./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReportDetail','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./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/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','3.5.0','route','get','sendFile','resolve','appPath','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/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/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./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/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks'];(function(_0x44529c,_0x50b252){var _0xe5c58e=function(_0x53f7c5){while(--_0x53f7c5){_0x44529c['push'](_0x44529c['shift']());}};_0xe5c58e(++_0x50b252);}(_0xa101,0x15f));var _0x1a10=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xa101[_0x1fd9e7];return _0x1781f2;};'use strict';var path=require(_0x1a10('0x0'));var express=require(_0x1a10('0x1'));var errors=require('./errors');var config=require(_0x1a10('0x2'));var setupLoggers=require(_0x1a10('0x3'))['setupLoggers'];var clientSideLogs=require(_0x1a10('0x4'));exports[_0x1a10('0x5')]=function(_0x51baf6){return setupLoggers(_0x51baf6)[_0x1a10('0x6')](function(){_0x51baf6[_0x1a10('0x7')](_0x1a10('0x8'),require(_0x1a10('0x9')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xa'),require('./api/voiceChanSpy'));_0x51baf6['use'](_0x1a10('0xb'),require(_0x1a10('0xc')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xd'),require(_0x1a10('0xe')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xf'),require('./api/voiceMusicOnHold'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x10'),require(_0x1a10('0x11')));_0x51baf6['use'](_0x1a10('0x12'),require(_0x1a10('0x13')));_0x51baf6[_0x1a10('0x7')]('/api/screen/recordings',require(_0x1a10('0x14')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x15'),require(_0x1a10('0x16')));_0x51baf6[_0x1a10('0x7')]('/api/voice/mails/messages',require(_0x1a10('0x17')));_0x51baf6['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x18'),require(_0x1a10('0x19')));_0x51baf6[_0x1a10('0x7')]('/api/voice/agents/reports',require(_0x1a10('0x1a')));_0x51baf6[_0x1a10('0x7')]('/api/voice/queues/reports',require(_0x1a10('0x1b')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x1c'),require(_0x1a10('0x1d')));_0x51baf6['use'](_0x1a10('0x1e'),require(_0x1a10('0x1f')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x20'),require(_0x1a10('0x21')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x22'),require(_0x1a10('0x23')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x24'),require(_0x1a10('0x25')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x26'),require(_0x1a10('0x27')));_0x51baf6[_0x1a10('0x7')]('/api/mail/substatuses',require(_0x1a10('0x28')));_0x51baf6['use'](_0x1a10('0x29'),require('./api/mailInteraction'));_0x51baf6[_0x1a10('0x7')]('/api/mail/messages',require(_0x1a10('0x2a')));_0x51baf6[_0x1a10('0x7')]('/api/mail/applications',require(_0x1a10('0x2b')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x2c'),require(_0x1a10('0x2d')));_0x51baf6['use'](_0x1a10('0x2e'),require(_0x1a10('0x2f')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x30'),require(_0x1a10('0x31')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x32'),require(_0x1a10('0x33')));_0x51baf6['use']('/api/fax/applications',require('./api/faxApplication'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x34'),require(_0x1a10('0x35')));_0x51baf6[_0x1a10('0x7')]('/api/fax/messages',require(_0x1a10('0x36')));_0x51baf6[_0x1a10('0x7')]('/api/fax/queues',require(_0x1a10('0x37')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x38'),require('./api/faxQueueReport'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x39'),require(_0x1a10('0x3a')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x3b'),require('./api/smsApplication'));_0x51baf6[_0x1a10('0x7')]('/api/sms/interactions',require(_0x1a10('0x3c')));_0x51baf6[_0x1a10('0x7')]('/api/sms/messages',require(_0x1a10('0x3d')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x3e'),require('./api/smsQueue'));_0x51baf6['use'](_0x1a10('0x3f'),require(_0x1a10('0x40')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x41'),require(_0x1a10('0x42')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x43'),require(_0x1a10('0x44')));_0x51baf6['use'](_0x1a10('0x45'),require(_0x1a10('0x46')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x47'),require(_0x1a10('0x48')));_0x51baf6[_0x1a10('0x7')]('/api/chat/websites',require(_0x1a10('0x49')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x4a'),require(_0x1a10('0x4b')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x4c'),require(_0x1a10('0x4d')));_0x51baf6[_0x1a10('0x7')]('/api/chat/interactions',require(_0x1a10('0x4e')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x4f'),require(_0x1a10('0x50')));_0x51baf6['use'](_0x1a10('0x51'),require('./api/chatOfflineMessage'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x52'),require(_0x1a10('0x53')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x54'),require(_0x1a10('0x55')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x56'),require('./api/chatProactiveAction'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x57'),require(_0x1a10('0x58')));_0x51baf6[_0x1a10('0x7')]('/api/cm/contacts',require(_0x1a10('0x59')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x5a'),require('./api/cmHopper'));_0x51baf6['use']('/api/cm/hopper_black',require(_0x1a10('0x5b')));_0x51baf6['use']('/api/cm/hopper_final',require(_0x1a10('0x5c')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x5d'),require(_0x1a10('0x5e')));_0x51baf6[_0x1a10('0x7')]('/api/cm/custom_fields',require(_0x1a10('0x5f')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x60'),require(_0x1a10('0x61')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x62'),require('./api/automation'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x63'),require(_0x1a10('0x64')));_0x51baf6['use'](_0x1a10('0x65'),require(_0x1a10('0x66')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x67'),require('./api/condition'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x68'),require('./api/interval'));_0x51baf6['use'](_0x1a10('0x69'),require(_0x1a10('0x6a')));_0x51baf6[_0x1a10('0x7')]('/api/cdr',require(_0x1a10('0x6b')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x6c'),require(_0x1a10('0x6d')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x6e'),require(_0x1a10('0x6f')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x70'),require(_0x1a10('0x71')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x72'),require(_0x1a10('0x73')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x74'),require(_0x1a10('0x75')));_0x51baf6[_0x1a10('0x7')]('/api/cm_contact_has_items',require(_0x1a10('0x76')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x77'),require('./api/cmHopperAdditionalPhone'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x78'),require(_0x1a10('0x79')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x7a'),require('./api/trigger'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x7b'),require('./api/variable'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x7c'),require(_0x1a10('0x7d')));_0x51baf6['use'](_0x1a10('0x7e'),require(_0x1a10('0x7f')));_0x51baf6[_0x1a10('0x7')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x51baf6['use'](_0x1a10('0x80'),require(_0x1a10('0x81')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x82'),require('./api/analyticExtractedReport'));_0x51baf6['use'](_0x1a10('0x83'),require('./api/analyticMetric'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x84'),require(_0x1a10('0x85')));_0x51baf6['use'](_0x1a10('0x86'),require(_0x1a10('0x87')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x88'),require(_0x1a10('0x89')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x8a'),require(_0x1a10('0x8b')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x8c'),require(_0x1a10('0x8d')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x8e'),require(_0x1a10('0x8f')));_0x51baf6['use'](_0x1a10('0x90'),require(_0x1a10('0x91')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x92'),require(_0x1a10('0x93')));_0x51baf6[_0x1a10('0x7')]('/api/integrations/desk/accounts',require(_0x1a10('0x94')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x95'),require(_0x1a10('0x96')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x97'),require(_0x1a10('0x98')));_0x51baf6[_0x1a10('0x7')]('/api/integrations/zoho/accounts',require(_0x1a10('0x99')));_0x51baf6[_0x1a10('0x7')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x9a'),require('./api/intZohoField'));_0x51baf6['use'](_0x1a10('0x9b'),require('./api/intZendeskAccount'));_0x51baf6['use'](_0x1a10('0x9c'),require(_0x1a10('0x9d')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x9e'),require(_0x1a10('0x9f')));_0x51baf6[_0x1a10('0x7')]('/api/integrations/freshdesk/accounts',require(_0x1a10('0xa0')));_0x51baf6['use'](_0x1a10('0xa1'),require(_0x1a10('0xa2')));_0x51baf6[_0x1a10('0x7')]('/api/integrations/freshdesk/fields',require(_0x1a10('0xa3')));_0x51baf6['use'](_0x1a10('0xa4'),require(_0x1a10('0xa5')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xa6'),require(_0x1a10('0xa7')));_0x51baf6['use'](_0x1a10('0xa8'),require(_0x1a10('0xa9')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xaa'),require(_0x1a10('0xab')));_0x51baf6['use']('/api/integrations/servicenow/configurations',require(_0x1a10('0xac')));_0x51baf6['use'](_0x1a10('0xad'),require(_0x1a10('0xae')));_0x51baf6['use'](_0x1a10('0xaf'),require(_0x1a10('0xb0')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xb1'),require(_0x1a10('0xb2')));_0x51baf6['use'](_0x1a10('0xb3'),require('./api/intDynamics365Field'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xb4'),require(_0x1a10('0xb5')));_0x51baf6[_0x1a10('0x7')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xb6'),require(_0x1a10('0xb7')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xb8'),require('./api/network'));_0x51baf6['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x51baf6[_0x1a10('0x7')]('/api/chat/internal/messages',require(_0x1a10('0xb9')));_0x51baf6['use']('/api/jscripty/answers/reports',require(_0x1a10('0xba')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xbb'),require(_0x1a10('0xbc')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xbd'),require(_0x1a10('0xbe')));_0x51baf6[_0x1a10('0x7')]('/api/sms/reports/queue',require(_0x1a10('0xbf')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xc0'),require('./api/squareReport'));_0x51baf6['use']('/api/square/details/reports',require(_0x1a10('0xc1')));_0x51baf6[_0x1a10('0x7')]('/api/jscripty/projects',require(_0x1a10('0xc2')));_0x51baf6[_0x1a10('0x7')]('/api/settings',require('./api/setting'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xc3'),require(_0x1a10('0xc4')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xc5'),require(_0x1a10('0xc6')));_0x51baf6[_0x1a10('0x7')]('/api/square/recordings',require(_0x1a10('0xc7')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xc8'),require(_0x1a10('0xc9')));_0x51baf6['use']('/api/teams',require(_0x1a10('0xca')));_0x51baf6['use'](_0x1a10('0xcb'),require(_0x1a10('0xcc')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xcd'),require('./api/campaign'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xce'),require(_0x1a10('0xcf')));_0x51baf6['use'](_0x1a10('0xd0'),require(_0x1a10('0xd1')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xd2'),require('./api/plugin'));_0x51baf6['use'](_0x1a10('0xd3'),require(_0x1a10('0xd4')));_0x51baf6['use']('/api/chat/reports/transfer',require(_0x1a10('0xd5')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xd6'),require('./api/faxTransferReport'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xd7'),require('./api/openchannelTransferReport'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xd8'),require(_0x1a10('0xd9')));_0x51baf6['use'](_0x1a10('0xda'),require('./api/cmList'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xdb'),require('./api/voicePrefix'));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xdc'),require(_0x1a10('0xdd')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xde'),require(_0x1a10('0xdf')));_0x51baf6['use'](_0x1a10('0xe0'),require(_0x1a10('0xe1')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xe2'),require(_0x1a10('0xe3')));_0x51baf6['use']('/api/whatsapp/accounts',require(_0x1a10('0xe4')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xe5'),require('./api/whatsappApplication'));_0x51baf6[_0x1a10('0x7')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x51baf6[_0x1a10('0x7')]('/api/whatsapp/messages',require(_0x1a10('0xe6')));_0x51baf6['use'](_0x1a10('0xe7'),require('./api/whatsappQueueReport'));_0x51baf6[_0x1a10('0x7')]('/api/whatsapp/reports/transfer',require(_0x1a10('0xe8')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xe9'),require(_0x1a10('0xea')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xeb'),require(_0x1a10('0xec')));_0x51baf6['use'](_0x1a10('0xed'),require(_0x1a10('0xee')));_0x51baf6[_0x1a10('0x7')]('/api/user-settings',require(_0x1a10('0xef')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xf0'),require('./api/authLocal'));_0x51baf6[_0x1a10('0x7')]('/api/auth/google',require(_0x1a10('0xf1')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xf2'),require(_0x1a10('0xf3')));_0x51baf6['use'](_0x1a10('0xf4'),require(_0x1a10('0xf5')));_0x51baf6['use'](_0x1a10('0xf6'),require(_0x1a10('0xf7')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xf8'),require(_0x1a10('0xf9')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xfa'),require(_0x1a10('0xfb')));_0x51baf6[_0x1a10('0x7')]('/api/pm2',require(_0x1a10('0xfc')));_0x51baf6[_0x1a10('0x7')](_0x1a10('0xfd'),require(_0x1a10('0xfe')));_0x51baf6['use']('/api/logs',clientSideLogs);_0x51baf6[_0x1a10('0x7')](_0x1a10('0xff'),express['static'](path[_0x1a10('0x100')](config[_0x1a10('0x101')],_0x1a10('0xff'))));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x102'),express['static'](path['join'](config[_0x1a10('0x101')],_0x1a10('0x102'))));_0x51baf6['use']('/demo',express[_0x1a10('0x103')](path[_0x1a10('0x100')](config[_0x1a10('0x101')],_0x1a10('0x104'))));_0x51baf6[_0x1a10('0x7')](_0x1a10('0x105'),express[_0x1a10('0x103')](path[_0x1a10('0x100')](config[_0x1a10('0x101')],'snippet',_0x1a10('0x106'))));_0x51baf6[_0x1a10('0x7')]('/plugins',express[_0x1a10('0x103')](path[_0x1a10('0x100')](config[_0x1a10('0x101')],'/server/files/plugins')));_0x51baf6[_0x1a10('0x107')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1a10('0x108')](errors[0x194]);_0x51baf6[_0x1a10('0x107')]('/*')[_0x1a10('0x108')](function(_0x4d93ad,_0x432f98){_0x432f98[_0x1a10('0x109')](path[_0x1a10('0x10a')](_0x51baf6[_0x1a10('0x108')](_0x1a10('0x10b'))+'/index.html'));});return _0x51baf6;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 18e70be..3e15ae1 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x830f=['../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.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/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x830f,0x1a0));var _0xf830=function(_0x1ace35,_0x57ffbf){_0x1ace35=_0x1ace35-0x0;var _0x14bb0e=_0x830f[_0x1ace35];return _0x14bb0e;};'use strict';var jayson=require(_0xf830('0x0'));var _=require(_0xf830('0x1'));var config=require(_0xf830('0x2'));exports[_0xf830('0x3')]=function(){return new Promise(function(_0x5c9382,_0x4ca7bd){var _0x5833f4={};_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x4')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x6')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x7')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x8')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x9')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0xa')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0xb')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0xc')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0xd')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0xe')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0xf')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/mailServerIn/mailServerIn.rpc'));_0x5833f4=_['merge'](_0x5833f4,require('../api/mailAccount/mailAccount.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x10')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x11')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x12')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x13')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x14')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x15')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x16')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x17')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x18')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x19')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x1a')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x1b')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x1c')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x1d')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x1e')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x1f')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x20')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x21')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x22')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x23')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x24')));_0x5833f4=_['merge'](_0x5833f4,require('../api/chatQueue/chatQueue.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x25')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x26')));_0x5833f4=_['merge'](_0x5833f4,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x27')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x28')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x29')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/interval/interval.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x2a')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x2b')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x2c')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x2d')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x2e')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x2f')));_0x5833f4=_['merge'](_0x5833f4,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x30')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x31')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x32')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x33')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x34')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x35')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x36')));_0x5833f4=_['merge'](_0x5833f4,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x37')));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x38')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x39')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x3a')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x3b')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/squareProject/squareProject.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x3c')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x3d')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/campaign/campaign.rpc'));_0x5833f4=_['merge'](_0x5833f4,require(_0xf830('0x3e')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require('../api/plugin/plugin.rpc'));_0x5833f4=_['merge'](_0x5833f4,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x3f')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x40')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x41')));_0x5833f4=_[_0xf830('0x5')](_0x5833f4,require(_0xf830('0x42')));var _0x593292=jayson['server'](_0x5833f4)[_0xf830('0x43')]();var _0x3870ae=config[_0xf830('0x44')][_0xf830('0x45')]||config[_0xf830('0x45')]+0x1;var _0xf612cd=config[_0xf830('0x44')]['ip']||_0xf830('0x46');_0x593292['on'](_0xf830('0x47'),function(_0x2e556c){return _0x4ca7bd(_0x2e556c);});_0x593292[_0xf830('0x3')](_0x3870ae,_0xf612cd,function(){console[_0xf830('0x48')](_0xf830('0x49'),_0xf612cd,_0x3870ae);require('../config/triggers')[_0xf830('0x4a')]();return _0x5c9382(_0xf830('0x4b')+_0xf612cd+':'+_0x3870ae);});});}; \ No newline at end of file +var _0x0683=['../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.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/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc'];(function(_0x20473a,_0x38b93f){var _0x5b11ff=function(_0xddd1d2){while(--_0xddd1d2){_0x20473a['push'](_0x20473a['shift']());}};_0x5b11ff(++_0x38b93f);}(_0x0683,0xe1));var _0x3068=function(_0x49145f,_0x3715e1){_0x49145f=_0x49145f-0x0;var _0x28bac3=_0x0683[_0x49145f];return _0x28bac3;};'use strict';var jayson=require('jayson/promise');var _=require(_0x3068('0x0'));var config=require('../config/environment');exports[_0x3068('0x1')]=function(){return new Promise(function(_0x3f61ca,_0x526bc9){var _0xfe3989={};_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x3')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x4')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/voiceQueue/voiceQueue.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x5')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x6')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x7')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x8')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x9')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/memberReport/memberReport.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0xa')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0xb')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0xc')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/mailServerIn/mailServerIn.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0xd')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0xe')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/mailInteraction/mailInteraction.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/mailMessage/mailMessage.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0xf')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x10')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x11')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/faxInteraction/faxInteraction.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x12')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x13')));_0xfe3989=_['merge'](_0xfe3989,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x14')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x15')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x16')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x17')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x18')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x19')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x1a')));_0xfe3989=_['merge'](_0xfe3989,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x1b')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x1c')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x1d')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x1e')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x1f')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x20')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x21')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x22')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x23')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x24')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x25')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x26')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0xfe3989=_['merge'](_0xfe3989,require('../api/template/template.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x27')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x28')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x29')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x2a')));_0xfe3989=_['merge'](_0xfe3989,require('../api/intDeskAccount/intDeskAccount.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x2b')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x2c')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x2d')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x2e')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xfe3989=_['merge'](_0xfe3989,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x2f')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x30')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x31')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x32')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x33')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/squareRecording/squareRecording.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/squareMessage/squareMessage.rpc'));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x34')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/attachment/attachment.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require('../api/plugin/plugin.rpc'));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x35')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x36')));_0xfe3989=_['merge'](_0xfe3989,require(_0x3068('0x37')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x38')));_0xfe3989=_[_0x3068('0x2')](_0xfe3989,require(_0x3068('0x39')));var _0x32bc1b=jayson[_0x3068('0x3a')](_0xfe3989)['http']();var _0xf8529c=config['rpc'][_0x3068('0x3b')]||config[_0x3068('0x3b')]+0x1;var _0x426d18=config[_0x3068('0x3c')]['ip']||_0x3068('0x3d');_0x32bc1b['on'](_0x3068('0x3e'),function(_0x239a21){return _0x526bc9(_0x239a21);});_0x32bc1b[_0x3068('0x1')](_0xf8529c,_0x426d18,function(){console[_0x3068('0x3f')](_0x3068('0x40'),_0x426d18,_0xf8529c);require('../config/triggers')[_0x3068('0x41')]();return _0x3f61ca(_0x3068('0x42')+_0x426d18+':'+_0xf8529c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b00c4f4..88a0bad 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 _0xc7b4=['wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','utf8','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sendRequest','command','answer','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','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','recordFile','BEEP','streamFile'];(function(_0x23c2e3,_0x1a3376){var _0x1e6f3d=function(_0x1c68a5){while(--_0x1c68a5){_0x23c2e3['push'](_0x23c2e3['shift']());}};_0x1e6f3d(++_0x1a3376);}(_0xc7b4,0x1cd));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4c7b('0x0'));var _=require('lodash');var EventEmitter=require(_0x4c7b('0x1'))[_0x4c7b('0x2')];var AGIReply=require(_0x4c7b('0x3'));var AGIError=require('./error');function AGIChannel(_0x53fc21){var _0x11c316=this,_0x4fba4a=new AGIReply(),_0x3936f3=![],_0x343ce5={};EventEmitter['call'](_0x11c316);_0x53fc21['setEncoding'](_0x4c7b('0x4'));_0x53fc21['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x4fba4a[_0x4c7b('0x5')](_0x4c7b('0x4'));_0x4fba4a['on'](_0x4c7b('0x6'),function(_0xcd29b1){for(var _0x15022d in _0xcd29b1){_0x11c316[_0x15022d]=_0xcd29b1[_0x15022d];}_0x11c316[_0x4c7b('0x7')](_0x4c7b('0x8'));});_0x4fba4a['on'](_0x4c7b('0x9'),function(_0x19141d){if(_0x19141d[_0x4c7b('0xa')]()==_0x4c7b('0xb')){_0x11c316[_0x4c7b('0x7')](_0x4c7b('0xb'));return;}if(_0x19141d[_0x4c7b('0xc')](0x0,0xb)=='520-Invalid'){_0x3936f3=!![];}if(_0x3936f3){_0x343ce5['rx']+=_0x19141d+'\x0a';if(_0x19141d['search'](_0x4c7b('0xd'))!=-0x1){_0x3936f3=![];}}else{_0x343ce5['rx']=_0x19141d;}if(_0x3936f3){return;}if(typeof _0x343ce5['cb']==_0x4c7b('0xe')){var _0x469d31=_0x343ce5['rx']['substring'](0x0,0x3),_0x8facce=null,_0xf176f=null;_0x469d31=parseInt(_0x469d31);if(isNaN(_0x469d31)){_0x343ce5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4c7b('0xf')});return;}if(_0x469d31!=0xc8){_0x343ce5['cb'](null,{'code':_0x469d31,'result':-0x1,'extra':'KO'});return;}_0x8facce=_0x343ce5['rx'][_0x4c7b('0xc')](0x4)[_0x4c7b('0x10')](_0x4c7b('0x11'),'');if(_0x8facce[_0x4c7b('0x12')]('\x20')!=-0x1){_0x8facce=_0x8facce[_0x4c7b('0x13')](0x0,_0x8facce['indexOf']('\x20'));}if(_[_0x4c7b('0x14')](_0x8facce,'-1')){_0x8facce=parseInt(_0x8facce);}_0xf176f=_0x343ce5['rx'][_0x4c7b('0x15')]('\x20');if(_0xf176f[_0x4c7b('0x16')]==0x3){_0xf176f=_0xf176f[0x2][_0x4c7b('0xc')](0x1,_0xf176f[0x2][_0x4c7b('0x16')]-0x1);}else if(_0xf176f[_0x4c7b('0x16')]>0x3){var _0x5dbf68=/\((.+)\)/;var _0x45909c=_0x343ce5['rx'][_0x4c7b('0x17')](_0x5dbf68);if(_0x45909c){_0xf176f=_0x45909c[0x1];}else{_0xf176f=null;}}else{_0xf176f=null;}_0x343ce5['cb'](null,{'code':_0x469d31,'result':_0x8facce,'extra':_0xf176f});}});_0x53fc21['on']('error',function(_0x31eb05){_0x11c316[_0x4c7b('0x7')](_0x4c7b('0x18'),new AGIError(_0x4c7b('0x19'),_0x31eb05[_0x4c7b('0x1a')]));});_0x53fc21['on'](_0x4c7b('0x1b'),function(){_0x11c316['emit'](_0x4c7b('0x1b'),new AGIError(_0x4c7b('0x1c')));});_0x53fc21['on'](_0x4c7b('0x1d'),function(){_0x11c316['emit']('timeout',new AGIError(_0x4c7b('0x1e')));_0x53fc21[_0x4c7b('0x1f')]();});_0x53fc21[_0x4c7b('0x20')](_0x4fba4a);this['command']=function(_0x2e30d0,_0x492476){var _0x2e30d0=_0x2e30d0||'',_0x492476=typeof _0x492476==_0x4c7b('0xe')?_0x492476:new Function();_0x343ce5={'tx':_0x2e30d0,'rx':'','cb':_0x492476};_0x53fc21[_0x4c7b('0x21')](_0x2e30d0+'\x0a');},this[_0x4c7b('0x1b')]=function(){_0x53fc21[_0x4c7b('0x1f')]();};}util[_0x4c7b('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x24')]=function(_0x3bc147){return this[_0x4c7b('0x25')]['sync'](this,_0x3bc147);};AGIChannel['prototype'][_0x4c7b('0x26')]=function(){return this['sendRequest'](_0x4c7b('0x27'));};AGIChannel[_0x4c7b('0x23')]['getData']=function(_0x4f7a76,_0x2dd3ed,_0x4a357b){_0x4f7a76=_0x4f7a76===undefined?_0x4c7b('0x28'):_0x4f7a76;_0x2dd3ed=_0x2dd3ed===undefined?'5':_0x2dd3ed;_0x4a357b=_0x4a357b===undefined?'1':_0x4a357b;return this[_0x4c7b('0x24')](util['format'](_0x4c7b('0x29'),_0x4f7a76,_0x2dd3ed*0x3e8,_0x4a357b));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x2a')]=function(_0x26dc65){_0x26dc65=_0x26dc65||_0x4c7b('0x2b');return this[_0x4c7b('0x24')](util[_0x4c7b('0x2c')]('VERBOSE\x20\x22%s\x22',_0x26dc65));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x2d')]=function(_0x1a3a76,_0x3d5c36){if(_[_0x4c7b('0x2e')](_0x3d5c36)){return this[_0x4c7b('0x24')](util[_0x4c7b('0x2c')]('EXEC\x20%s\x20%s',_0x1a3a76,_0x3d5c36['join'](',')));}return this[_0x4c7b('0x24')](util['format'](_0x4c7b('0x2f'),_0x1a3a76,_0x3d5c36));};AGIChannel[_0x4c7b('0x23')]['setContext']=function(_0x1b9b0c){return this['sendRequest'](util[_0x4c7b('0x2c')](_0x4c7b('0x30'),_0x1b9b0c));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x31')]=function(_0x3d3bde){return this[_0x4c7b('0x24')](util[_0x4c7b('0x2c')](_0x4c7b('0x32'),_0x3d3bde));};AGIChannel['prototype'][_0x4c7b('0x33')]=function(_0x1baf82){return this[_0x4c7b('0x24')](util[_0x4c7b('0x2c')](_0x4c7b('0x34'),_0x1baf82));};AGIChannel['prototype'][_0x4c7b('0xb')]=function(){return this[_0x4c7b('0x24')](_0x4c7b('0x35'));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x36')]=function(_0xbed40d,_0x1d45bb){var _0xb3dd3=_[_0x4c7b('0x37')](_0x1d45bb)||_['isNumber'](_0x1d45bb)?_0x1d45bb[_0x4c7b('0x38')]():_0x1d45bb;return this['sendRequest'](util[_0x4c7b('0x2c')](_0x4c7b('0x39'),_0xbed40d,_0xb3dd3?_0xb3dd3[_0x4c7b('0x38')]()[_0x4c7b('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x3a')]=function(_0x30ae42,_0x137684){return this['sendRequest'](util[_0x4c7b('0x2c')](_0x4c7b('0x3b'),_0x30ae42,_0x137684));};AGIChannel[_0x4c7b('0x23')]['sayDigits']=function(_0x429a3c,_0x4ffff2){return this[_0x4c7b('0x24')](util[_0x4c7b('0x2c')]('SAY\x20DIGITS\x20%s\x20%s',_0x429a3c,_0x4ffff2));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x3c')]=function(_0x46ca2c,_0x5f1dc1){return this['sendRequest'](util[_0x4c7b('0x2c')](_0x4c7b('0x3d'),_0x46ca2c,_0x5f1dc1));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x3e')]=function(_0x3bf076,_0x692e0a,_0x116649){_0x692e0a=_0x692e0a||this[_0x4c7b('0x3f')];_0x116649=_0x116649||0x1;this[_0x4c7b('0x40')](_0x3bf076);this[_0x4c7b('0x31')](_0x692e0a);this[_0x4c7b('0x33')](_0x116649);return this[_0x4c7b('0x2a')](util[_0x4c7b('0x2c')](_0x4c7b('0x41'),_0x3bf076,_0x692e0a,_0x116649));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x42')]=function(_0x510bc1){return this[_0x4c7b('0x24')](util[_0x4c7b('0x2c')](_0x4c7b('0x43'),_0x510bc1));};AGIChannel['prototype'][_0x4c7b('0x44')]=function(_0x8fe898,_0x6433a6,_0x4a65c9,_0x372093,_0x32bd13,_0x559207){_0x6433a6=_0x6433a6||'wav';_0x4a65c9=_0x4a65c9||'';_0x372093=_0x372093===undefined?-0x1:_0x372093==='-1'?-0x1:_0x372093*0x3e8;_0x32bd13=_0x32bd13===undefined?'':'s='+_0x32bd13;_0x559207=_0x559207?_0x4c7b('0x45'):'';return this[_0x4c7b('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x8fe898,_0x6433a6,_0x4a65c9,_0x372093,_0x559207,_0x32bd13));};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x46')]=function(_0xb5ca1d,_0x49d10e){_0x49d10e=_0x49d10e||'';return this[_0x4c7b('0x24')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xb5ca1d,_0x49d10e));};AGIChannel[_0x4c7b('0x23')]['agi']=function(_0x1cb3af){return this[_0x4c7b('0x2d')]('AGI',_0x1cb3af);};AGIChannel[_0x4c7b('0x23')][_0x4c7b('0x47')]=function(_0x385498){return this[_0x4c7b('0x2d')](_0x4c7b('0x48'),_0x385498);};AGIChannel[_0x4c7b('0x23')]['error']=function(_0xf4bf05,_0x4297a8){this[_0x4c7b('0x2a')](util[_0x4c7b('0x2c')](_0x4c7b('0x49'),_0xf4bf05['id'],_0xf4bf05[_0x4c7b('0x4a')],_0x4297a8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4c7b('0x4b')]=AGIChannel; \ No newline at end of file +var _0xa3fe=['utf8','headers','ready','toLowerCase','hangup','emit','search','520\x20End\x20of\x20proper','function','no\x20code','substring','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','write','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','noop','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','util','events','EventEmitter','./error','call','setEncoding'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa3fe,0xd8));var _0xea3f=function(_0x2d0356,_0x43b671){_0x2d0356=_0x2d0356-0x0;var _0x5f1ac6=_0xa3fe[_0x2d0356];return _0x5f1ac6;};'use strict';var util=require(_0xea3f('0x0'));var _=require('lodash');var EventEmitter=require(_0xea3f('0x1'))[_0xea3f('0x2')];var AGIReply=require('./reply');var AGIError=require(_0xea3f('0x3'));function AGIChannel(_0x43f13b){var _0xc23ba9=this,_0x5d6309=new AGIReply(),_0x2880a2=![],_0x4e8978={};EventEmitter[_0xea3f('0x4')](_0xc23ba9);_0x43f13b[_0xea3f('0x5')](_0xea3f('0x6'));_0x43f13b['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5d6309['setEncoding'](_0xea3f('0x6'));_0x5d6309['on'](_0xea3f('0x7'),function(_0x3c4807){for(var _0x5dbd3e in _0x3c4807){_0xc23ba9[_0x5dbd3e]=_0x3c4807[_0x5dbd3e];}_0xc23ba9['emit'](_0xea3f('0x8'));});_0x5d6309['on']('line',function(_0x526024){if(_0x526024[_0xea3f('0x9')]()==_0xea3f('0xa')){_0xc23ba9[_0xea3f('0xb')]('hangup');return;}if(_0x526024['substring'](0x0,0xb)=='520-Invalid'){_0x2880a2=!![];}if(_0x2880a2){_0x4e8978['rx']+=_0x526024+'\x0a';if(_0x526024[_0xea3f('0xc')](_0xea3f('0xd'))!=-0x1){_0x2880a2=![];}}else{_0x4e8978['rx']=_0x526024;}if(_0x2880a2){return;}if(typeof _0x4e8978['cb']==_0xea3f('0xe')){var _0x363046=_0x4e8978['rx']['substring'](0x0,0x3),_0x4a36da=null,_0x5afd23=null;_0x363046=parseInt(_0x363046);if(isNaN(_0x363046)){_0x4e8978['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xea3f('0xf')});return;}if(_0x363046!=0xc8){_0x4e8978['cb'](null,{'code':_0x363046,'result':-0x1,'extra':'KO'});return;}_0x4a36da=_0x4e8978['rx'][_0xea3f('0x10')](0x4)['replace'](_0xea3f('0x11'),'');if(_0x4a36da[_0xea3f('0x12')]('\x20')!=-0x1){_0x4a36da=_0x4a36da['substr'](0x0,_0x4a36da[_0xea3f('0x12')]('\x20'));}if(_[_0xea3f('0x13')](_0x4a36da,'-1')){_0x4a36da=parseInt(_0x4a36da);}_0x5afd23=_0x4e8978['rx'][_0xea3f('0x14')]('\x20');if(_0x5afd23[_0xea3f('0x15')]==0x3){_0x5afd23=_0x5afd23[0x2][_0xea3f('0x10')](0x1,_0x5afd23[0x2][_0xea3f('0x15')]-0x1);}else if(_0x5afd23[_0xea3f('0x15')]>0x3){var _0x2585f1=/\((.+)\)/;var _0x18301f=_0x4e8978['rx'][_0xea3f('0x16')](_0x2585f1);if(_0x18301f){_0x5afd23=_0x18301f[0x1];}else{_0x5afd23=null;}}else{_0x5afd23=null;}_0x4e8978['cb'](null,{'code':_0x363046,'result':_0x4a36da,'extra':_0x5afd23});}});_0x43f13b['on'](_0xea3f('0x17'),function(_0x31b8ca){_0xc23ba9[_0xea3f('0xb')](_0xea3f('0x17'),new AGIError(_0xea3f('0x18'),_0x31b8ca[_0xea3f('0x19')]));});_0x43f13b['on'](_0xea3f('0x1a'),function(){_0xc23ba9[_0xea3f('0xb')]('close',new AGIError(_0xea3f('0x1b')));});_0x43f13b['on'](_0xea3f('0x1c'),function(){_0xc23ba9[_0xea3f('0xb')](_0xea3f('0x1c'),new AGIError(_0xea3f('0x1d')));_0x43f13b['destroy']();});_0x43f13b['pipe'](_0x5d6309);this[_0xea3f('0x1e')]=function(_0x29dd1f,_0x4c6d50){var _0x29dd1f=_0x29dd1f||'',_0x4c6d50=typeof _0x4c6d50==_0xea3f('0xe')?_0x4c6d50:new Function();_0x4e8978={'tx':_0x29dd1f,'rx':'','cb':_0x4c6d50};_0x43f13b[_0xea3f('0x1f')](_0x29dd1f+'\x0a');},this['close']=function(){_0x43f13b['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xea3f('0x20')][_0xea3f('0x21')]=function(_0x1499f2){return this[_0xea3f('0x1e')][_0xea3f('0x22')](this,_0x1499f2);};AGIChannel[_0xea3f('0x20')][_0xea3f('0x23')]=function(){return this['sendRequest'](_0xea3f('0x24'));};AGIChannel['prototype'][_0xea3f('0x25')]=function(_0x22cd02,_0x1f66b3,_0x1e2932){_0x22cd02=_0x22cd02===undefined?_0xea3f('0x26'):_0x22cd02;_0x1f66b3=_0x1f66b3===undefined?'5':_0x1f66b3;_0x1e2932=_0x1e2932===undefined?'1':_0x1e2932;return this['sendRequest'](util[_0xea3f('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x22cd02,_0x1f66b3*0x3e8,_0x1e2932));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x28')]=function(_0x20e014){_0x20e014=_0x20e014||'NO\x20MESSAGE';return this[_0xea3f('0x21')](util[_0xea3f('0x27')]('VERBOSE\x20\x22%s\x22',_0x20e014));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x29')]=function(_0x373413,_0x391828){if(_[_0xea3f('0x2a')](_0x391828)){return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x2b'),_0x373413,_0x391828[_0xea3f('0x2c')](',')));}return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x2b'),_0x373413,_0x391828));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x2d')]=function(_0x302fdc){return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x2e'),_0x302fdc));};AGIChannel[_0xea3f('0x20')]['setExtension']=function(_0x3cc4bb){return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x2f'),_0x3cc4bb));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x30')]=function(_0x35cbcb){return this[_0xea3f('0x21')](util[_0xea3f('0x27')]('SET\x20PRIORITY\x20%s',_0x35cbcb));};AGIChannel[_0xea3f('0x20')][_0xea3f('0xa')]=function(){return this[_0xea3f('0x21')](_0xea3f('0x31'));};AGIChannel[_0xea3f('0x20')]['setVariable']=function(_0x4d46f2,_0x145fdf){var _0x497008=_[_0xea3f('0x32')](_0x145fdf)||_[_0xea3f('0x33')](_0x145fdf)?_0x145fdf[_0xea3f('0x34')]():_0x145fdf;return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x35'),_0x4d46f2,_0x497008?_0x497008['toString']()[_0xea3f('0x36')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x5ef92d,_0x236757){return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x37'),_0x5ef92d,_0x236757));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x38')]=function(_0x2d07ef,_0x365033){return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x39'),_0x2d07ef,_0x365033));};AGIChannel[_0xea3f('0x20')]['sayPhonetic']=function(_0xb7d4e5,_0x531d4c){return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x3a'),_0xb7d4e5,_0x531d4c));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x3b')]=function(_0x5e6bd9,_0x3ca2b5,_0x4af967){_0x3ca2b5=_0x3ca2b5||this[_0xea3f('0x3c')];_0x4af967=_0x4af967||0x1;this[_0xea3f('0x2d')](_0x5e6bd9);this[_0xea3f('0x3d')](_0x3ca2b5);this[_0xea3f('0x30')](_0x4af967);return this[_0xea3f('0x28')](util[_0xea3f('0x27')](_0xea3f('0x3e'),_0x5e6bd9,_0x3ca2b5,_0x4af967));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x3f')]=function(_0x2c018c){return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x40'),_0x2c018c));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x41')]=function(_0x4e064d,_0x15f0f3,_0x56094e,_0x23168c,_0x525591,_0x306574){_0x15f0f3=_0x15f0f3||_0xea3f('0x42');_0x56094e=_0x56094e||'';_0x23168c=_0x23168c===undefined?-0x1:_0x23168c==='-1'?-0x1:_0x23168c*0x3e8;_0x525591=_0x525591===undefined?'':'s='+_0x525591;_0x306574=_0x306574?'BEEP':'';return this[_0xea3f('0x21')](util[_0xea3f('0x27')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x4e064d,_0x15f0f3,_0x56094e,_0x23168c,_0x306574,_0x525591));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x43')]=function(_0x1081b0,_0x58e8f0){_0x58e8f0=_0x58e8f0||'';return this[_0xea3f('0x21')](util[_0xea3f('0x27')](_0xea3f('0x44'),_0x1081b0,_0x58e8f0));};AGIChannel[_0xea3f('0x20')][_0xea3f('0x45')]=function(_0x14f63f){return this[_0xea3f('0x29')](_0xea3f('0x46'),_0x14f63f);};AGIChannel[_0xea3f('0x20')][_0xea3f('0x47')]=function(_0x1d8e5f){return this[_0xea3f('0x29')](_0xea3f('0x48'),_0x1d8e5f);};AGIChannel[_0xea3f('0x20')]['error']=function(_0x5ebca3,_0x7f50cd){this['noop'](util[_0xea3f('0x27')](_0xea3f('0x49'),_0x5ebca3['id'],_0x5ebca3['label'],_0x7f50cd));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9958642..20e395b 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 _0xa915=['format','apply','message','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0x3cbfa4,_0x2cf506){var _0x28be12=function(_0x3c2cc2){while(--_0x3c2cc2){_0x3cbfa4['push'](_0x3cbfa4['shift']());}};_0x28be12(++_0x2cf506);}(_0xa915,0xba));var _0x5a91=function(_0x1a17d9,_0x4db427){_0x1a17d9=_0x1a17d9-0x0;var _0x481201=_0xa915[_0x1a17d9];return _0x481201;};'use strict';var util=require(_0x5a91('0x0'));var error={'E_AGI_UNDEFINED':_0x5a91('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x5a91('0x2'),'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':_0x5a91('0x3'),'E_AGI_SOCKET_CLOSE':_0x5a91('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x5a91('0x5'),'E_AGI_COMMAND_EMPTY':_0x5a91('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5a91('0x7'),'E_AGI_IVR_ENTRY':_0x5a91('0x8')};function AGIError(_0x1f2c40){var _0x1f2c40=_0x1f2c40||null,_0x30a86f=_0x30a86f||[],_0x7e685d=0x1,_0x486832='';if(!error[_0x1f2c40]){_0x1f2c40='E_AGI_UNDEFINED';}_0x30a86f[_0x5a91('0x9')](error[_0x1f2c40]);while(arguments[_0x7e685d]){_0x30a86f[_0x5a91('0x9')](arguments[_0x7e685d]);_0x7e685d++;}_0x486832=util[_0x5a91('0xa')][_0x5a91('0xb')](util,_0x30a86f);this[_0x5a91('0xc')]=_0x486832;this[_0x5a91('0xd')]=_0x1f2c40;}module['exports']=AGIError; \ No newline at end of file +var _0x54f1=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util'];(function(_0x59a9b3,_0x24a97d){var _0x344912=function(_0x53e679){while(--_0x53e679){_0x59a9b3['push'](_0x59a9b3['shift']());}};_0x344912(++_0x24a97d);}(_0x54f1,0x77));var _0x154f=function(_0x200b07,_0x49d462){_0x200b07=_0x200b07-0x0;var _0x9d9428=_0x54f1[_0x200b07];return _0x9d9428;};'use strict';var util=require(_0x154f('0x0'));var error={'E_AGI_UNDEFINED':_0x154f('0x1'),'E_AGI_ARGUMENT_PORT':_0x154f('0x2'),'E_AGI_SERVER_ERROR':_0x154f('0x3'),'E_AGI_SERVER_CLOSE':_0x154f('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x154f('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x154f('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x154f('0x7'),'E_AGI_IVR_ENTRY':_0x154f('0x8')};function AGIError(_0x66951){var _0x66951=_0x66951||null,_0x8f4634=_0x8f4634||[],_0x1b3ba6=0x1,_0x1a1b92='';if(!error[_0x66951]){_0x66951=_0x154f('0x9');}_0x8f4634['push'](error[_0x66951]);while(arguments[_0x1b3ba6]){_0x8f4634[_0x154f('0xa')](arguments[_0x1b3ba6]);_0x1b3ba6++;}_0x1a1b92=util[_0x154f('0xb')][_0x154f('0xc')](util,_0x8f4634);this[_0x154f('0xd')]=_0x1a1b92;this[_0x154f('0xe')]=_0x66951;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index a0d3ed1..e2163dc 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 _0x008d=['lodash','ioredis','./error','redis','subscribe','agi','error','E_AGI_SERVER_ERROR','message','emit','projectUpdate','exports'];(function(_0x45ec51,_0x3b04fa){var _0x584eb2=function(_0x514786){while(--_0x514786){_0x45ec51['push'](_0x45ec51['shift']());}};_0x584eb2(++_0x3b04fa);}(_0x008d,0x84));var _0xd008=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x008d[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xd008('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0xd008('0x1'));var AGIError=require(_0xd008('0x2'));var config=require('../../config/environment');config[_0xd008('0x3')]=_['defaults'](config[_0xd008('0x3')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xd008('0x3')]);sub[_0xd008('0x4')](_0xd008('0x5'),function(_0x4c8892){if(_0x4c8892)return eventEmitter['emit'](_0xd008('0x6'),new AGIError(_0xd008('0x7'),_0x4c8892));});sub['on'](_0xd008('0x8'),function(_0x1753c1,_0x4beef0){if(_0x1753c1!==_0xd008('0x5'))return;try{var _0x5586e0=JSON['parse'](_0x4beef0);eventEmitter[_0xd008('0x9')](_0xd008('0xa'),_0x5586e0);}catch(_0x3d3439){eventEmitter['emit'](_0xd008('0x6'),new AGIError(_0xd008('0x7'),_0x3d3439));}});module[_0xd008('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xf4d0=['parse','projectUpdate','exports','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi'];(function(_0x4e3ebc,_0x5111ea){var _0x4bd1c9=function(_0x25c717){while(--_0x25c717){_0x4e3ebc['push'](_0x4e3ebc['shift']());}};_0x4bd1c9(++_0x5111ea);}(_0xf4d0,0x18a));var _0x0f4d=function(_0x55ab99,_0x416f58){_0x55ab99=_0x55ab99-0x0;var _0x5b71cc=_0xf4d0[_0x55ab99];return _0x5b71cc;};'use strict';var _=require('lodash');var EventEmitter=require(_0x0f4d('0x0'))[_0x0f4d('0x1')];var Redis=require(_0x0f4d('0x2'));var AGIError=require(_0x0f4d('0x3'));var config=require(_0x0f4d('0x4'));config[_0x0f4d('0x5')]=_[_0x0f4d('0x6')](config[_0x0f4d('0x5')],{'host':_0x0f4d('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x0f4d('0x5')]);sub[_0x0f4d('0x8')]('agi',function(_0x306707){if(_0x306707)return eventEmitter[_0x0f4d('0x9')](_0x0f4d('0xa'),new AGIError(_0x0f4d('0xb'),_0x306707));});sub['on'](_0x0f4d('0xc'),function(_0x2c8002,_0x586bfc){if(_0x2c8002!==_0x0f4d('0xd'))return;try{var _0x26cd8d=JSON[_0x0f4d('0xe')](_0x586bfc);eventEmitter[_0x0f4d('0x9')](_0x0f4d('0xf'),_0x26cd8d);}catch(_0x3b1719){eventEmitter[_0x0f4d('0x9')](_0x0f4d('0xa'),new AGIError(_0x0f4d('0xb'),_0x3b1719));}});module[_0x0f4d('0x10')]={'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 b84bfe1..a3b2332 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 _0x08bd=['no\x20vertex\x20found','length','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','numberOfEdges','prototype','addEdge','size','relations','traverseBFS','info'];(function(_0x16f2df,_0x23470a){var _0x5975f1=function(_0x741aff){while(--_0x741aff){_0x16f2df['push'](_0x16f2df['shift']());}};_0x5975f1(++_0x23470a);}(_0x08bd,0xd3));var _0xd08b=function(_0x346a0d,_0x161251){_0x346a0d=_0x346a0d-0x0;var _0x2ae904=_0x08bd[_0x346a0d];return _0x2ae904;};'use strict';var _=require(_0xd08b('0x0'));var logger=require(_0xd08b('0x1'))(_0xd08b('0x2'));var verticesWithRetry=[_0xd08b('0x3'),_0xd08b('0x4'),'getsecretdigits'];var Graph=function(){this[_0xd08b('0x5')]={};this[_0xd08b('0x6')]={};this[_0xd08b('0x7')]=0x0;};Graph['prototype']['addVertex']=function(_0x3b4202){this[_0xd08b('0x5')][_0x3b4202['id']]=_0x3b4202;this['edges'][_0x3b4202['id']]=[];};Graph[_0xd08b('0x8')][_0xd08b('0x9')]=function(_0x43a423,_0x2bcdf3,_0x59739d){this['edges'][_0x43a423]['push']({'target':_0x2bcdf3,'condition':_0x59739d});this['numberOfEdges']+=0x1;};Graph[_0xd08b('0x8')][_0xd08b('0xa')]=function(){return _[_0xd08b('0xa')](this[_0xd08b('0x5')]);};Graph['prototype'][_0xd08b('0xb')]=function(){return this[_0xd08b('0x7')];};Graph[_0xd08b('0x8')]['getVertex']=function(_0x32a94f){return this[_0xd08b('0x5')][_0x32a94f];};Graph[_0xd08b('0x8')][_0xd08b('0xc')]=function(_0x1dd417,_0x3521f3){if(!this['vertices'][_0x1dd417]){return logger[_0xd08b('0xd')](_0xd08b('0xe'));}var _0x530ed4=_0x3521f3(this[_0xd08b('0x5')][_0x1dd417]);if(!_0x530ed4){return logger[_0xd08b('0xd')]('stop\x20traverse');}if(this[_0xd08b('0x6')][_0x1dd417][_0xd08b('0xf')]===0x0){return logger[_0xd08b('0xd')]('no\x20edge/s\x20available');}for(var _0x28b005=0x0,_0x4e1e75=[],_0x5cd27f=![];_0x28b005\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','close','timeout','handleNotFound','production','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','syncho','../../config/logger','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','findIndex','deleted','push'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x36f7,0xd4));var _0x736f=function(_0x575bd6,_0x14b78a){_0x575bd6=_0x575bd6-0x0;var _0x487be8=_0x36f7[_0x575bd6];return _0x487be8;};'use strict';var _=require(_0x736f('0x0'));var syncho=require(_0x736f('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0x736f('0x2'))(_0x736f('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x736f('0x4'));var Project=require(_0x736f('0x5'));var AGIEmitter=require(_0x736f('0x6'))[_0x736f('0x7')];var projects=[];config[_0x736f('0x3')]=_[_0x736f('0x8')](config[_0x736f('0x3')],{'ip':_0x736f('0x9'),'port':0x11dd});AGIEmitter['on'](_0x736f('0xa'),projectUpdateHandler);function connectionHandler(_0x5ea641){process[_0x736f('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5ea641);agiHandler(_0x5ea641);}catch(_0x1523b9){logger[_0x736f('0xc')](_0x1523b9['stack']);}});});}function projectUpdateHandler(_0x215af5){try{var _0x3e8890=_[_0x736f('0xd')](projects,['id',_0x215af5['id']]);if(_0x3e8890>-0x1){if(_0x215af5[_0x736f('0xe')]===!![]){projects['splice'](_0x3e8890,0x1);}else{projects[_0x3e8890]=_0x215af5;}}else{projects[_0x736f('0xf')](_0x215af5);}}catch(_0x462597){logger['error'](_0x462597[_0x736f('0x10')]);}}function listeningHandler(){console['log'](_0x736f('0x11'),config[_0x736f('0x3')][_0x736f('0x12')]);logger[_0x736f('0x13')](util[_0x736f('0x14')](_0x736f('0x15'),config[_0x736f('0x3')]['ip'],config[_0x736f('0x3')]['port']));}function errorHandler(_0x49acb0){if(_0x49acb0&&_0x49acb0[_0x736f('0x16')]&&_0x49acb0['message']){logger['error'](util['format'](_0x736f('0x17'),_0x49acb0[_0x736f('0x16')],_0x49acb0[_0x736f('0x18')]));}else{logger[_0x736f('0xc')](util[_0x736f('0x14')](_0x736f('0x19'),_0x49acb0[_0x736f('0x10')]));}}function closeHandler(){logger[_0x736f('0x13')](util['format'](_0x736f('0x1a'),this[_0x736f('0x1b')],this['calleridname'],this[_0x736f('0x1c')],this[_0x736f('0x1d')],this[_0x736f('0x1e')]));try{createSquareReport(this);}catch(_0x199ce6){logger[_0x736f('0xc')](_0x199ce6[_0x736f('0x10')]);}}function timeoutHandler(){logger[_0x736f('0x13')](util[_0x736f('0x14')](_0x736f('0x1f'),this[_0x736f('0x1b')],this['calleridname'],this[_0x736f('0x1c')],this[_0x736f('0x1d')],this[_0x736f('0x1e')]));}function hangupHandler(){logger[_0x736f('0x13')](util[_0x736f('0x14')](_0x736f('0x20'),this[_0x736f('0x1b')],this['calleridname'],this[_0x736f('0x1c')],this[_0x736f('0x1d')],this[_0x736f('0x1e')]));this[_0x736f('0x21')]=!![];}function createSquareReport(_0x4fb79a,_0x216b9e){rpc[_0x736f('0x22')](_0x4fb79a)[_0x736f('0x23')](function(_0x5efe64){if(_0x216b9e){_0x216b9e(null,_0x5efe64);}})[_0x736f('0x24')](function(_0x39c5a0){if(_0x216b9e){_0x216b9e(null,_0x39c5a0);}});}function setChannelVariables(_0x4ab9f9){for(var _0x3e6dc2 in _0x4ab9f9){if(_0x4ab9f9[_0x736f('0x25')](_0x3e6dc2)){if(_0x3e6dc2['indexOf'](_0x736f('0x26'))===0x0){_0x4ab9f9[_0x3e6dc2[_0x736f('0x27')](0x4)]=_0x4ab9f9[_0x3e6dc2];delete _0x4ab9f9[_0x3e6dc2];}}}}function agiHandler(_0x4266ed){logger[_0x736f('0x28')]('variables',JSON[_0x736f('0x29')](_0x4266ed,null,0x2));logger[_0x736f('0x13')](util[_0x736f('0x14')](_0x736f('0x2a'),_0x4266ed[_0x736f('0x1b')],_0x4266ed[_0x736f('0x2b')],_0x4266ed[_0x736f('0x1c')],_0x4266ed[_0x736f('0x1d')],_0x4266ed[_0x736f('0x1e')]));_0x4266ed['on']('error',errorHandler);_0x4266ed['on'](_0x736f('0x2c'),closeHandler);_0x4266ed['on'](_0x736f('0x2d'),timeoutHandler);_0x4266ed[_0x736f('0x21')]=![];_0x4266ed['on']('hangup',hangupHandler);var _0x125314=_['find'](projects,[_0x736f('0x16'),_0x4266ed['arg_1']]);if(!_0x125314)return Project[_0x736f('0x2e')](_0x4266ed);if(!_0x125314[_0x736f('0x2f')])return Project['handleUnpublished'](_0x4266ed);return Project['initialize'](_0x125314,_0x4266ed);}function main(){var _0x16dd22;return utilLicense['getLicense']()[_0x736f('0x23')](function(_0x5d2f7e){if(!_0x5d2f7e)return;if(_0x5d2f7e[_0x736f('0x30')]){if(_0x5d2f7e[_0x736f('0x31')]&&_0x5d2f7e[_0x736f('0x31')]>0x0){logger[_0x736f('0x13')](util[_0x736f('0x14')](_0x736f('0x32'),_0x5d2f7e[_0x736f('0x31')]));_0x16dd22=_0x5d2f7e[_0x736f('0x31')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x736f('0x13')](_0x736f('0x33'));_0x16dd22=-0x1;}})[_0x736f('0x23')](function(){return Project[_0x736f('0x34')]();})[_0x736f('0x23')](function(_0x280ec7){projects=_0x280ec7;return;})['catch'](function(_0xe447c3){logger[_0x736f('0xc')](_0x736f('0x35'),_0xe447c3['stack']);})[_0x736f('0x36')](function(){var _0x1eea0a=require('./server')(config['agi'][_0x736f('0x12')],config['agi']['ip'],_0x16dd22);_0x1eea0a['on'](_0x736f('0xc'),errorHandler);_0x1eea0a['on'](_0x736f('0x37'),listeningHandler);_0x1eea0a['on'](_0x736f('0x38'),connectionHandler);_0x1eea0a['on'](_0x736f('0x2c'),closeHandler);});}main(); \ No newline at end of file +var _0xd114=['createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','stringify','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','port','listening','lodash','syncho','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','deleted','splice','push','log','info','format','name','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup'];(function(_0x161b12,_0x212d41){var _0x21ac59=function(_0x395234){while(--_0x395234){_0x161b12['push'](_0x161b12['shift']());}};_0x21ac59(++_0x212d41);}(_0xd114,0x170));var _0x4d11=function(_0x5f1fd9,_0x18b21d){_0x5f1fd9=_0x5f1fd9-0x0;var _0x3cc0bd=_0xd114[_0x5f1fd9];return _0x3cc0bd;};'use strict';var _=require(_0x4d11('0x0'));var syncho=require(_0x4d11('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0x4d11('0x2'))(_0x4d11('0x3'));var utilLicense=require(_0x4d11('0x4'));var rpc=require(_0x4d11('0x5'));var Project=require(_0x4d11('0x6'));var AGIEmitter=require(_0x4d11('0x7'))['EventEmitter'];var projects=[];config[_0x4d11('0x3')]=_[_0x4d11('0x8')](config[_0x4d11('0x3')],{'ip':_0x4d11('0x9'),'port':0x11dd});AGIEmitter['on'](_0x4d11('0xa'),projectUpdateHandler);function connectionHandler(_0x6f0769){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x6f0769);agiHandler(_0x6f0769);}catch(_0x32569f){logger[_0x4d11('0xb')](_0x32569f[_0x4d11('0xc')]);}});});}function projectUpdateHandler(_0x24af91){try{var _0x505cd6=_[_0x4d11('0xd')](projects,['id',_0x24af91['id']]);if(_0x505cd6>-0x1){if(_0x24af91[_0x4d11('0xe')]===!![]){projects[_0x4d11('0xf')](_0x505cd6,0x1);}else{projects[_0x505cd6]=_0x24af91;}}else{projects[_0x4d11('0x10')](_0x24af91);}}catch(_0x45a9ba){logger[_0x4d11('0xb')](_0x45a9ba[_0x4d11('0xc')]);}}function listeningHandler(){console[_0x4d11('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x4d11('0x3')]['port']);logger[_0x4d11('0x12')](util[_0x4d11('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x4d11('0x3')]['ip'],config['agi']['port']));}function errorHandler(_0x5d40e9){if(_0x5d40e9&&_0x5d40e9[_0x4d11('0x14')]&&_0x5d40e9['message']){logger[_0x4d11('0xb')](util[_0x4d11('0x13')](_0x4d11('0x15'),_0x5d40e9[_0x4d11('0x14')],_0x5d40e9['message']));}else{logger[_0x4d11('0xb')](util[_0x4d11('0x13')]('[ERROR]\x20%s',_0x5d40e9['stack']));}}function closeHandler(){logger['info'](util[_0x4d11('0x13')](_0x4d11('0x16'),this['arg_1'],this[_0x4d11('0x17')],this['callerid'],this[_0x4d11('0x18')],this[_0x4d11('0x19')]));try{createSquareReport(this);}catch(_0xc44946){logger['error'](_0xc44946[_0x4d11('0xc')]);}}function timeoutHandler(){logger[_0x4d11('0x12')](util[_0x4d11('0x13')](_0x4d11('0x1a'),this[_0x4d11('0x1b')],this[_0x4d11('0x17')],this[_0x4d11('0x1c')],this[_0x4d11('0x18')],this[_0x4d11('0x19')]));}function hangupHandler(){logger[_0x4d11('0x12')](util[_0x4d11('0x13')](_0x4d11('0x1d'),this['arg_1'],this[_0x4d11('0x17')],this['callerid'],this[_0x4d11('0x18')],this[_0x4d11('0x19')]));this[_0x4d11('0x1e')]=!![];}function createSquareReport(_0x18e88e,_0x3e4631){rpc[_0x4d11('0x1f')](_0x18e88e)[_0x4d11('0x20')](function(_0x5eb9b1){if(_0x3e4631){_0x3e4631(null,_0x5eb9b1);}})[_0x4d11('0x21')](function(_0x5b6458){if(_0x3e4631){_0x3e4631(null,_0x5b6458);}});}function setChannelVariables(_0x3a69ac){for(var _0x1b64ba in _0x3a69ac){if(_0x3a69ac[_0x4d11('0x22')](_0x1b64ba)){if(_0x1b64ba['indexOf'](_0x4d11('0x23'))===0x0){_0x3a69ac[_0x1b64ba[_0x4d11('0x24')](0x4)]=_0x3a69ac[_0x1b64ba];delete _0x3a69ac[_0x1b64ba];}}}}function agiHandler(_0x390fa7){logger[_0x4d11('0x25')]('variables',JSON[_0x4d11('0x26')](_0x390fa7,null,0x2));logger[_0x4d11('0x12')](util[_0x4d11('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x390fa7[_0x4d11('0x1b')],_0x390fa7[_0x4d11('0x17')],_0x390fa7['callerid'],_0x390fa7[_0x4d11('0x18')],_0x390fa7[_0x4d11('0x19')]));_0x390fa7['on'](_0x4d11('0xb'),errorHandler);_0x390fa7['on'](_0x4d11('0x27'),closeHandler);_0x390fa7['on'](_0x4d11('0x28'),timeoutHandler);_0x390fa7['evtHangup']=![];_0x390fa7['on'](_0x4d11('0x29'),hangupHandler);var _0x3be6ad=_[_0x4d11('0x2a')](projects,[_0x4d11('0x14'),_0x390fa7[_0x4d11('0x1b')]]);if(!_0x3be6ad)return Project[_0x4d11('0x2b')](_0x390fa7);if(!_0x3be6ad[_0x4d11('0x2c')])return Project[_0x4d11('0x2d')](_0x390fa7);return Project[_0x4d11('0x2e')](_0x3be6ad,_0x390fa7);}function main(){var _0x3fbd47;return utilLicense[_0x4d11('0x2f')]()[_0x4d11('0x20')](function(_0xd0214b){if(!_0xd0214b)return;if(_0xd0214b[_0x4d11('0x30')]){if(_0xd0214b[_0x4d11('0x31')]&&_0xd0214b['callysquare']>0x0){logger[_0x4d11('0x12')](util[_0x4d11('0x13')](_0x4d11('0x32'),_0xd0214b[_0x4d11('0x31')]));_0x3fbd47=_0xd0214b[_0x4d11('0x31')];}else{logger[_0x4d11('0x12')](_0x4d11('0x33'));}}else{logger['info'](_0x4d11('0x34'));_0x3fbd47=-0x1;}})[_0x4d11('0x20')](function(){return Project['getAll']();})[_0x4d11('0x20')](function(_0x206246){projects=_0x206246;return;})[_0x4d11('0x21')](function(_0x58108b){logger[_0x4d11('0xb')](_0x4d11('0x35'),_0x58108b['stack']);})[_0x4d11('0x36')](function(){var _0xcb36e2=require('./server')(config[_0x4d11('0x3')][_0x4d11('0x37')],config[_0x4d11('0x3')]['ip'],_0x3fbd47);_0xcb36e2['on'](_0x4d11('0xb'),errorHandler);_0xcb36e2['on'](_0x4d11('0x38'),listeningHandler);_0xcb36e2['on']('connection',connectionHandler);_0xcb36e2['on'](_0x4d11('0x27'),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 6dacd8d..0470f29 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 _0x296e=['SendMail','bluebird','jayson/promise','http','request','then','error','message','result','catch'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x296e,0xbf));var _0xe296=function(_0x1c0361,_0x164df6){_0x1c0361=_0x1c0361-0x0;var _0xbfd2b5=_0x296e[_0x1c0361];return _0xbfd2b5;};'use strict';var BPromise=require(_0xe296('0x0'));var jayson=require(_0xe296('0x1'));var client=jayson['client'][_0xe296('0x2')]({'port':0x232b});function request(_0x445711,_0x53c79c){return new BPromise(function(_0x60878f,_0x5247e6){return client[_0xe296('0x3')](_0x445711,_0x53c79c)[_0xe296('0x4')](function(_0x477679){if(_0x477679[_0xe296('0x5')]){return _0x5247e6(_0x477679[_0xe296('0x5')][_0xe296('0x6')]);}else{return _0x60878f(_0x477679[_0xe296('0x7')]);}})[_0xe296('0x8')](function(_0x323fc3){return _0x5247e6(_0x323fc3);});});}exports['sendMailMessage']=function(_0xab8612,_0x24ecfa){return request(_0xe296('0x9'),{'account':_0xab8612,'message':_0x24ecfa});}; \ No newline at end of file +var _0x161c=['client','http','request','then','error','message','result','catch','SendMail','bluebird','jayson/promise'];(function(_0xb90c93,_0x1c85c4){var _0x267c48=function(_0x4358c6){while(--_0x4358c6){_0xb90c93['push'](_0xb90c93['shift']());}};_0x267c48(++_0x1c85c4);}(_0x161c,0x17f));var _0xc161=function(_0x3c0a0e,_0x1fcb7b){_0x3c0a0e=_0x3c0a0e-0x0;var _0x1e6845=_0x161c[_0x3c0a0e];return _0x1e6845;};'use strict';var BPromise=require(_0xc161('0x0'));var jayson=require(_0xc161('0x1'));var client=jayson[_0xc161('0x2')][_0xc161('0x3')]({'port':0x232b});function request(_0x53b879,_0x541df8){return new BPromise(function(_0x185b40,_0x7cfb6c){return client[_0xc161('0x4')](_0x53b879,_0x541df8)[_0xc161('0x5')](function(_0x20028c){if(_0x20028c[_0xc161('0x6')]){return _0x7cfb6c(_0x20028c[_0xc161('0x6')][_0xc161('0x7')]);}else{return _0x185b40(_0x20028c[_0xc161('0x8')]);}})[_0xc161('0x9')](function(_0x1a3d9a){return _0x7cfb6c(_0x1a3d9a);});});}exports['sendMailMessage']=function(_0x567b7f,_0x4a3d37){return request(_0xc161('0xa'),{'account':_0x567b7f,'message':_0x4a3d37});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 5d6255b..cfbe46d 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 _0x7044=['calleridname','callerid','dnid','traverseBFS','clear','vertex','context','extension','priority','result','evtHangup','response','toString','error','agicommand\x20not\x20found','finally','uniqueid','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','util','agi','./rpc','./mailRpc','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','toJson','mxGraphModel','inspect','start','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','arg_1'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7044,0x191));var _0x4704=function(_0x568fc3,_0x56fedc){_0x568fc3=_0x568fc3-0x0;var _0x160dbe=_0x7044[_0x568fc3];return _0x160dbe;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require('xml2json');var util=require(_0x4704('0x0'));var logger=require('../../config/logger')(_0x4704('0x1'));var rpc=require(_0x4704('0x2'));var mailRpc=require(_0x4704('0x3'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4704('0x4')]()['catch'](function(_0x640d47){logger['error'](_0x4704('0x5'),_0x640d47[_0x4704('0x6')]);return[];});}function addVertex(_0x32789d,_0x3b5212,_0x283a17){_0x3b5212[_0x4704('0x7')]=_0x283a17;if(_0x3b5212[_0x4704('0x8')](_0x4704('0x9'))){_0x3b5212[_0x4704('0xa')]=parseInt(_0x3b5212[_0x4704('0x9')],0xa);}_0x32789d[_0x4704('0xb')](_[_0x4704('0xc')](_0x3b5212,_0x4704('0xd')));}function initGraph(_0x38f66e,_0x59ece1){var _0x260cf9=new Graph();for(var _0x20fdec in _0x38f66e){if(_0x38f66e[_0x4704('0x8')](_0x20fdec)){if(_[_0x4704('0xe')](_0x38f66e[_0x20fdec])){for(var _0x3fc7c3=0x0;_0x3fc7c3<_0x38f66e[_0x20fdec][_0x4704('0xf')];_0x3fc7c3+=0x1){addVertex(_0x260cf9,_0x38f66e[_0x20fdec][_0x3fc7c3],_0x20fdec);}}else{addVertex(_0x260cf9,_0x38f66e[_0x20fdec],_0x20fdec);}}}for(var _0x4deee3=0x0;_0x4deee3<_0x59ece1[_0x4704('0xf')];_0x4deee3+=0x1){if(_0x59ece1[_0x4deee3][_0x4704('0x10')]&&_0x59ece1[_0x4deee3]['target']){_0x260cf9[_0x4704('0x11')](_0x59ece1[_0x4deee3][_0x4704('0x10')],_0x59ece1[_0x4deee3][_0x4704('0x12')],_0x59ece1[_0x4deee3]['value']);}}return _0x260cf9;}function getRoot(_0x311306){return parser[_0x4704('0x13')](_0x311306,{'object':!![]})[_0x4704('0x14')]['root'];}function inspect(_0x4c096b){return util[_0x4704('0x15')](_0x4c096b,{'showHidden':![],'depth':null});}function initialize(_0x46a6bd,_0x5d4381){var _0x3a1ada=getRoot(_0x46a6bd['production']);if(!_0x3a1ada||!_0x3a1ada[_0x4704('0x16')])return;var _0x47f967,_0x6cf037,_0x408c45;logger[_0x4704('0x17')](_0x4704('0x18'),JSON[_0x4704('0x19')](_0x3a1ada,null,0x2));_0x5d4381[_0x4704('0x1a')]=moment()['format'](_0x4704('0x1b'));_0x47f967=initGraph(_[_0x4704('0xc')](_0x3a1ada,_0x4704('0xd')),_0x3a1ada['mxCell']);_0x6cf037=new Vertices(_0x5d4381,rpc,mailRpc);logger[_0x4704('0x1c')](util[_0x4704('0x1d')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5d4381[_0x4704('0x1e')],_0x5d4381[_0x4704('0x1f')],_0x5d4381[_0x4704('0x20')],_0x5d4381[_0x4704('0x21')],_0x5d4381['uniqueid']));_0x47f967[_0x4704('0x22')](_0x3a1ada['start']['id'],function(_0x454a4a){try{_0x454a4a=_0x6cf037[_0x4704('0x23')](_0x454a4a);logger[_0x4704('0x17')](_0x4704('0x24'),JSON['stringify'](_0x454a4a,null,0x2));if(_0x454a4a[_0x4704('0x7')]==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5d4381['context']=_0x454a4a[_0x4704('0x25')]||_0x5d4381[_0x4704('0x25')];_0x5d4381[_0x4704('0x26')]=_0x454a4a[_0x4704('0x26')];_0x5d4381[_0x4704('0x27')]=_0x454a4a[_0x4704('0x27')]?_0x454a4a[_0x4704('0x27')]-0x1:0x1;return null;}else if(_0x454a4a&&_0x6cf037[_0x454a4a[_0x4704('0x7')]]){_0x408c45=_0x6cf037[_0x454a4a[_0x4704('0x7')]](_0x454a4a);logger[_0x4704('0x1c')]('response',JSON[_0x4704('0x19')](_0x408c45,null,0x2));if(_0x408c45&&_0x408c45['code']===AGI_CODE_SUCCESS&&_0x408c45[_0x4704('0x28')]!==AGI_RESULT_ERROR&&!_0x5d4381[_0x4704('0x29')]){logger[_0x4704('0x17')](_0x4704('0x2a'),inspect(_0x408c45));return _['isUndefined'](_0x408c45[_0x4704('0x28')])?null:_0x408c45[_0x4704('0x28')][_0x4704('0x2b')]();}else{logger[_0x4704('0x2c')](_0x4704('0x2a'),inspect(_0x408c45));return null;}}else{logger[_0x4704('0x2c')](_0x4704('0x2d'));return null;}}catch(_0x247c5d){logger[_0x4704('0x2c')](_0x247c5d[_0x4704('0x6')]);return null;}});if(_0x3a1ada[_0x4704('0x2e')]){logger[_0x4704('0x1c')](util[_0x4704('0x1d')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5d4381[_0x4704('0x1e')],_0x5d4381['calleridname'],_0x5d4381[_0x4704('0x20')],_0x5d4381[_0x4704('0x21')],_0x5d4381[_0x4704('0x2f')]));_0x47f967[_0x4704('0x22')](_0x3a1ada[_0x4704('0x2e')]['id'],function(_0x201531){try{_0x201531=_0x6cf037[_0x4704('0x23')](_0x201531);logger[_0x4704('0x17')](_0x4704('0x24'),JSON[_0x4704('0x19')](_0x201531,null,0x2));if(_0x201531&&_0x6cf037[_0x201531[_0x4704('0x7')]]){_0x408c45=_0x6cf037[_0x201531[_0x4704('0x7')]](_0x201531);if(_0x408c45){logger[_0x4704('0x17')](_0x4704('0x2a'),inspect(_0x408c45));return _[_0x4704('0x30')](_0x408c45[_0x4704('0x28')])?null:_0x408c45['result']['toString']();}else{logger[_0x4704('0x2c')](_0x4704('0x2a'),inspect(_0x408c45));return null;}}else{logger[_0x4704('0x2c')]('agicommand\x20not\x20found');return null;}}catch(_0x3cf637){logger[_0x4704('0x2c')](_0x3cf637[_0x4704('0x6')]);return null;}});}logger['info'](util['format'](_0x4704('0x31'),_0x5d4381[_0x4704('0x1e')],_0x5d4381[_0x4704('0x1f')],_0x5d4381[_0x4704('0x20')],_0x5d4381[_0x4704('0x21')],_0x5d4381['uniqueid']));logger[_0x4704('0x1c')](util[_0x4704('0x1d')](_0x4704('0x32'),_0x5d4381['context'],_0x5d4381['extension'],parseInt(_0x5d4381['priority'],0xa)+0x1));_0x5d4381['continueAt'](_0x5d4381[_0x4704('0x25')],_0x5d4381[_0x4704('0x26')],parseInt(_0x5d4381[_0x4704('0x27')],0xa)+0x1);_0x5d4381[_0x4704('0x33')]();}function handleNotFound(_0x9cb921){logger[_0x4704('0x2c')](util[_0x4704('0x1d')](_0x4704('0x34'),_0x9cb921[_0x4704('0x1e')]));_0x9cb921['continueAt'](_0x9cb921[_0x4704('0x25')],_0x9cb921[_0x4704('0x26')],parseInt(_0x9cb921[_0x4704('0x27')],0xa)+0x1);_0x9cb921[_0x4704('0x33')]();}function handleUnpublished(_0x7e571){logger[_0x4704('0x2c')](util[_0x4704('0x1d')](_0x4704('0x35'),_0x7e571['arg_1']));_0x7e571['continueAt'](_0x7e571[_0x4704('0x25')],_0x7e571['extension'],parseInt(_0x7e571[_0x4704('0x27')],0xa)+0x1);_0x7e571[_0x4704('0x33')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x87e4=['[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','./mailRpc','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','source','target','addEdge','value','toJson','root','inspect','production','start','stringify','joinAt','format','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','context','extension','priority','code','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x5ab340,_0x3bf3e4){var _0x2ed5b7=function(_0x3178f9){while(--_0x3178f9){_0x5ab340['push'](_0x5ab340['shift']());}};_0x2ed5b7(++_0x3bf3e4);}(_0x87e4,0xb1));var _0x487e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x87e4[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x487e('0x0'));var moment=require(_0x487e('0x1'));var parser=require(_0x487e('0x2'));var util=require(_0x487e('0x3'));var logger=require(_0x487e('0x4'))('agi');var rpc=require('./rpc');var mailRpc=require(_0x487e('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x487e('0x6')]()[_0x487e('0x7')](function(_0x1d95a8){logger[_0x487e('0x8')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x1d95a8[_0x487e('0x9')]);return[];});}function addVertex(_0x333f71,_0x58ec77,_0x450fd7){_0x58ec77[_0x487e('0xa')]=_0x450fd7;if(_0x58ec77[_0x487e('0xb')](_0x487e('0xc'))){_0x58ec77['maxRetry']=parseInt(_0x58ec77[_0x487e('0xc')],0xa);}_0x333f71[_0x487e('0xd')](_[_0x487e('0xe')](_0x58ec77,_0x487e('0xf')));}function initGraph(_0x248963,_0x4881b5){var _0x208f11=new Graph();for(var _0x99f901 in _0x248963){if(_0x248963[_0x487e('0xb')](_0x99f901)){if(_[_0x487e('0x10')](_0x248963[_0x99f901])){for(var _0x11756f=0x0;_0x11756f<_0x248963[_0x99f901]['length'];_0x11756f+=0x1){addVertex(_0x208f11,_0x248963[_0x99f901][_0x11756f],_0x99f901);}}else{addVertex(_0x208f11,_0x248963[_0x99f901],_0x99f901);}}}for(var _0x44b5e0=0x0;_0x44b5e0<_0x4881b5['length'];_0x44b5e0+=0x1){if(_0x4881b5[_0x44b5e0][_0x487e('0x11')]&&_0x4881b5[_0x44b5e0][_0x487e('0x12')]){_0x208f11[_0x487e('0x13')](_0x4881b5[_0x44b5e0][_0x487e('0x11')],_0x4881b5[_0x44b5e0][_0x487e('0x12')],_0x4881b5[_0x44b5e0][_0x487e('0x14')]);}}return _0x208f11;}function getRoot(_0x3b50ae){return parser[_0x487e('0x15')](_0x3b50ae,{'object':!![]})['mxGraphModel'][_0x487e('0x16')];}function inspect(_0x317d7f){return util[_0x487e('0x17')](_0x317d7f,{'showHidden':![],'depth':null});}function initialize(_0x32eea0,_0x31e8df){var _0x7a6e45=getRoot(_0x32eea0[_0x487e('0x18')]);if(!_0x7a6e45||!_0x7a6e45[_0x487e('0x19')])return;var _0x431509,_0x1a1584,_0x44ab68;logger['debug'](_0x487e('0x16'),JSON[_0x487e('0x1a')](_0x7a6e45,null,0x2));_0x31e8df[_0x487e('0x1b')]=moment()[_0x487e('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0x431509=initGraph(_['omit'](_0x7a6e45,_0x487e('0xf')),_0x7a6e45['mxCell']);_0x1a1584=new Vertices(_0x31e8df,rpc,mailRpc);logger[_0x487e('0x1d')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x31e8df[_0x487e('0x1e')],_0x31e8df[_0x487e('0x1f')],_0x31e8df[_0x487e('0x20')],_0x31e8df[_0x487e('0x21')],_0x31e8df[_0x487e('0x22')]));_0x431509[_0x487e('0x23')](_0x7a6e45[_0x487e('0x19')]['id'],function(_0x58ee38){try{_0x58ee38=_0x1a1584[_0x487e('0x24')](_0x58ee38);logger[_0x487e('0x25')](_0x487e('0x26'),JSON['stringify'](_0x58ee38,null,0x2));if(_0x58ee38[_0x487e('0xa')]==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x31e8df[_0x487e('0x27')]=_0x58ee38[_0x487e('0x27')]||_0x31e8df[_0x487e('0x27')];_0x31e8df[_0x487e('0x28')]=_0x58ee38[_0x487e('0x28')];_0x31e8df[_0x487e('0x29')]=_0x58ee38[_0x487e('0x29')]?_0x58ee38['priority']-0x1:0x1;return null;}else if(_0x58ee38&&_0x1a1584[_0x58ee38[_0x487e('0xa')]]){_0x44ab68=_0x1a1584[_0x58ee38[_0x487e('0xa')]](_0x58ee38);logger[_0x487e('0x1d')]('response',JSON[_0x487e('0x1a')](_0x44ab68,null,0x2));if(_0x44ab68&&_0x44ab68[_0x487e('0x2a')]===AGI_CODE_SUCCESS&&_0x44ab68['result']!==AGI_RESULT_ERROR&&!_0x31e8df['evtHangup']){logger[_0x487e('0x25')](_0x487e('0x2b'),inspect(_0x44ab68));return _[_0x487e('0x2c')](_0x44ab68[_0x487e('0x2d')])?null:_0x44ab68[_0x487e('0x2d')][_0x487e('0x2e')]();}else{logger[_0x487e('0x8')](_0x487e('0x2b'),inspect(_0x44ab68));return null;}}else{logger[_0x487e('0x8')](_0x487e('0x2f'));return null;}}catch(_0x1b8bd1){logger['error'](_0x1b8bd1[_0x487e('0x9')]);return null;}});if(_0x7a6e45[_0x487e('0x30')]){logger['info'](util[_0x487e('0x1c')](_0x487e('0x31'),_0x31e8df[_0x487e('0x1e')],_0x31e8df[_0x487e('0x1f')],_0x31e8df[_0x487e('0x20')],_0x31e8df['dnid'],_0x31e8df[_0x487e('0x22')]));_0x431509['traverseBFS'](_0x7a6e45[_0x487e('0x30')]['id'],function(_0xe8bcd5){try{_0xe8bcd5=_0x1a1584[_0x487e('0x24')](_0xe8bcd5);logger['debug'](_0x487e('0x26'),JSON['stringify'](_0xe8bcd5,null,0x2));if(_0xe8bcd5&&_0x1a1584[_0xe8bcd5[_0x487e('0xa')]]){_0x44ab68=_0x1a1584[_0xe8bcd5[_0x487e('0xa')]](_0xe8bcd5);if(_0x44ab68){logger[_0x487e('0x25')]('response',inspect(_0x44ab68));return _['isUndefined'](_0x44ab68[_0x487e('0x2d')])?null:_0x44ab68['result']['toString']();}else{logger[_0x487e('0x8')](_0x487e('0x2b'),inspect(_0x44ab68));return null;}}else{logger[_0x487e('0x8')](_0x487e('0x2f'));return null;}}catch(_0x5c7e66){logger[_0x487e('0x8')](_0x5c7e66[_0x487e('0x9')]);return null;}});}logger[_0x487e('0x1d')](util[_0x487e('0x1c')](_0x487e('0x32'),_0x31e8df[_0x487e('0x1e')],_0x31e8df['calleridname'],_0x31e8df[_0x487e('0x20')],_0x31e8df[_0x487e('0x21')],_0x31e8df[_0x487e('0x22')]));logger[_0x487e('0x1d')](util[_0x487e('0x1c')](_0x487e('0x33'),_0x31e8df['context'],_0x31e8df['extension'],parseInt(_0x31e8df[_0x487e('0x29')],0xa)+0x1));_0x31e8df[_0x487e('0x34')](_0x31e8df[_0x487e('0x27')],_0x31e8df['extension'],parseInt(_0x31e8df[_0x487e('0x29')],0xa)+0x1);_0x31e8df[_0x487e('0x35')]();}function handleNotFound(_0x2d8e6b){logger[_0x487e('0x8')](util[_0x487e('0x1c')](_0x487e('0x36'),_0x2d8e6b[_0x487e('0x1e')]));_0x2d8e6b[_0x487e('0x34')](_0x2d8e6b['context'],_0x2d8e6b['extension'],parseInt(_0x2d8e6b[_0x487e('0x29')],0xa)+0x1);_0x2d8e6b[_0x487e('0x35')]();}function handleUnpublished(_0x2fb969){logger[_0x487e('0x8')](util[_0x487e('0x1c')](_0x487e('0x37'),_0x2fb969[_0x487e('0x1e')]));_0x2fb969['continueAt'](_0x2fb969[_0x487e('0x27')],_0x2fb969[_0x487e('0x28')],parseInt(_0x2fb969[_0x487e('0x29')],0xa)+0x1);_0x2fb969[_0x487e('0x35')]();}module[_0x487e('0x38')]={'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 40f0a0d..94c2f4f 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 _0xbbfa=['_inBody','inherits','prototype','_transform','indexOf','length','split','trim','emit','headers','substring','line','exports','util','Transform','call','_localBuffer'];(function(_0xddc1f9,_0x5644bd){var _0x352453=function(_0x135028){while(--_0x135028){_0xddc1f9['push'](_0xddc1f9['shift']());}};_0x352453(++_0x5644bd);}(_0xbbfa,0x1e9));var _0xabbf=function(_0xafcf00,_0x4429a3){_0xafcf00=_0xafcf00-0x0;var _0x513af4=_0xbbfa[_0xafcf00];return _0x513af4;};'use strict';var util=require(_0xabbf('0x0'));var Transform=require('stream')[_0xabbf('0x1')];function AGIReply(_0x59c76b){Transform[_0xabbf('0x2')](this,_0x59c76b);this[_0xabbf('0x3')]='';this[_0xabbf('0x4')]=![];}util[_0xabbf('0x5')](AGIReply,Transform);AGIReply[_0xabbf('0x6')][_0xabbf('0x7')]=function(_0x1c5596,_0x45b118,_0x120840){var _0x7d0c02='\x0a',_0x45b7d6=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x58f0a8=-0x1,_0x5b471b=-0x1,_0x536a4c='',_0x1380cd=0x0,_0x260181='',_0x564e4b='';this[_0xabbf('0x3')]+=_0x1c5596['toString']();_0x260181=this[_0xabbf('0x3')];if(!this['_inBody']){_0x1380cd=0x0;while(_0x45b7d6[_0x1380cd]){while((_0x5b471b=_0x260181[_0xabbf('0x8')](_0x45b7d6[_0x1380cd]))!=-0x1){_0x536a4c=_0x45b7d6[_0x1380cd];_0x564e4b=_0x260181['substring'](0x0,_0x5b471b);_0x260181=_0x260181['substring'](_0x5b471b+_0x536a4c[_0xabbf('0x9')]);var _0x2e9b83=_0x564e4b[_0xabbf('0xa')](_0x7d0c02),_0x345023=0x0,_0x3f03be={},_0x265487='',_0x1cc1a0='',_0x28fb83=-0x1;while(_0x2e9b83[_0x345023]){_0x28fb83=_0x2e9b83[_0x345023][_0xabbf('0x8')](':');if(_0x28fb83!=-0x1){_0x265487=_0x2e9b83[_0x345023]['slice'](0x0,_0x28fb83)[_0xabbf('0xb')]();_0x1cc1a0=_0x2e9b83[_0x345023]['slice'](_0x28fb83+0x1)[_0xabbf('0xb')]();if(_0x265487['length']>0x0){_0x3f03be[_0x265487]=_0x1cc1a0;}}else{}_0x345023++;}this[_0xabbf('0xc')](_0xabbf('0xd'),_0x3f03be);this[_0xabbf('0x4')]=!![];}_0x1380cd++;}this[_0xabbf('0x3')]=_0x260181;}else{while((_0x58f0a8=_0x260181['indexOf'](_0x7d0c02))!=-0x1){_0x564e4b=_0x260181[_0xabbf('0xe')](0x0,_0x58f0a8);this[_0xabbf('0xc')](_0xabbf('0xf'),_0x564e4b);_0x260181=_0x260181[_0xabbf('0xe')](_0x58f0a8+_0x7d0c02[_0xabbf('0x9')]);}this['_localBuffer']=_0x260181;}_0x120840();};module[_0xabbf('0x10')]=AGIReply; \ No newline at end of file +var _0x7510=['call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','line','exports','stream','Transform'];(function(_0x4e9e0b,_0x1d4aa8){var _0x280541=function(_0x1034cd){while(--_0x1034cd){_0x4e9e0b['push'](_0x4e9e0b['shift']());}};_0x280541(++_0x1d4aa8);}(_0x7510,0x18a));var _0x0751=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7510[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var Transform=require(_0x0751('0x0'))[_0x0751('0x1')];function AGIReply(_0x353d5b){Transform[_0x0751('0x2')](this,_0x353d5b);this[_0x0751('0x3')]='';this[_0x0751('0x4')]=![];}util[_0x0751('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x0751('0x6')]=function(_0x14f412,_0x31ba24,_0x5db425){var _0xb41bca='\x0a',_0x1ad494=['\x0a\x0a',_0x0751('0x7')],_0x162368=-0x1,_0x5acb1e=-0x1,_0x44c788='',_0x47909a=0x0,_0x15d8d4='',_0x4b9234='';this[_0x0751('0x3')]+=_0x14f412[_0x0751('0x8')]();_0x15d8d4=this['_localBuffer'];if(!this[_0x0751('0x4')]){_0x47909a=0x0;while(_0x1ad494[_0x47909a]){while((_0x5acb1e=_0x15d8d4[_0x0751('0x9')](_0x1ad494[_0x47909a]))!=-0x1){_0x44c788=_0x1ad494[_0x47909a];_0x4b9234=_0x15d8d4[_0x0751('0xa')](0x0,_0x5acb1e);_0x15d8d4=_0x15d8d4[_0x0751('0xa')](_0x5acb1e+_0x44c788[_0x0751('0xb')]);var _0x5b258=_0x4b9234[_0x0751('0xc')](_0xb41bca),_0x56d1a3=0x0,_0x19983b={},_0x17ab72='',_0x1753e='',_0x2789c9=-0x1;while(_0x5b258[_0x56d1a3]){_0x2789c9=_0x5b258[_0x56d1a3][_0x0751('0x9')](':');if(_0x2789c9!=-0x1){_0x17ab72=_0x5b258[_0x56d1a3][_0x0751('0xd')](0x0,_0x2789c9)[_0x0751('0xe')]();_0x1753e=_0x5b258[_0x56d1a3][_0x0751('0xd')](_0x2789c9+0x1)[_0x0751('0xe')]();if(_0x17ab72[_0x0751('0xb')]>0x0){_0x19983b[_0x17ab72]=_0x1753e;}}else{}_0x56d1a3++;}this['emit'](_0x0751('0xf'),_0x19983b);this['_inBody']=!![];}_0x47909a++;}this[_0x0751('0x3')]=_0x15d8d4;}else{while((_0x162368=_0x15d8d4[_0x0751('0x9')](_0xb41bca))!=-0x1){_0x4b9234=_0x15d8d4[_0x0751('0xa')](0x0,_0x162368);this['emit'](_0x0751('0x10'),_0x4b9234);_0x15d8d4=_0x15d8d4[_0x0751('0xa')](_0x162368+_0xb41bca[_0x0751('0xb')]);}this[_0x0751('0x3')]=_0x15d8d4;}_0x5db425();};module[_0x0751('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index f5418e7..d17754d 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 _0xda55=['agentPause','agentLogout','LogoutUser','lodash','moment','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_2','createSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','LoginUser'];(function(_0x520334,_0x2345ce){var _0xc5f28f=function(_0x447d8d){while(--_0x447d8d){_0x520334['push'](_0x520334['shift']());}};_0xc5f28f(++_0x2345ce);}(_0xda55,0x6d));var _0x5da5=function(_0x5be7d2,_0xebc786){_0x5be7d2=_0x5be7d2-0x0;var _0x49a38d=_0xda55[_0x5be7d2];return _0x49a38d;};'use strict';var _=require(_0x5da5('0x0'));var moment=require(_0x5da5('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5da5('0x2')]({'port':0x2329});function request(_0x240a49,_0x26a443){return new Promise(function(_0x50cf9f,_0x1c3afd){return client['request'](_0x240a49,_0x26a443)[_0x5da5('0x3')](function(_0x4b4010){if(_0x4b4010[_0x5da5('0x4')]){return _0x1c3afd(_0x4b4010['error'][_0x5da5('0x5')]);}else{return _0x50cf9f(_0x4b4010[_0x5da5('0x6')]);}})[_0x5da5('0x7')](function(_0x46290d){return _0x1c3afd(_0x46290d);});});}exports[_0x5da5('0x8')]=function(){return request(_0x5da5('0x9'),{'options':{'raw':![],'attributes':['id',_0x5da5('0xa'),_0x5da5('0xb')]}});};exports['getSquareProject']=function(_0x3ed24c){return request(_0x5da5('0xc'),{'options':{'raw':![],'where':{'name':_0x3ed24c},'attributes':[_0x5da5('0xb')]}});};exports[_0x5da5('0xd')]=function(_0x1a047e){return request(_0x5da5('0xe'),{'options':{'raw':![],'where':{'id':_0x1a047e},'include':[{'model':_0x5da5('0xf'),'as':'Smtp','include':[{'model':_0x5da5('0x10'),'as':_0x5da5('0x10')}]}],'attributes':['id','name',_0x5da5('0x11')],'smtp':!![]}});};exports[_0x5da5('0x12')]=function(_0x3ced00){return request(_0x5da5('0xc'),{'options':{'where':{'id':_0x3ced00},'attributes':[_0x5da5('0xa')]}});};exports[_0x5da5('0x13')]=function(_0x481562){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x481562},'attributes':['name']}});};exports[_0x5da5('0x14')]=function(_0x126fc8){return request(_0x5da5('0x15'),{'options':{'where':{'id':_0x126fc8},'attributes':[_0x5da5('0xa')]}});};exports[_0x5da5('0x16')]=function(_0x134afa){return request(_0x5da5('0x17'),{'options':{'where':{'id':_0x134afa},'attributes':['dsn']}});};exports[_0x5da5('0x18')]=function(_0x290136){return request(_0x5da5('0x19'),{'options':{'where':{'id':_0x290136},'attributes':[_0x5da5('0xa')]}});};exports[_0x5da5('0x1a')]=function(_0x428b07){return request('GetContactByPhone',{'options':{'where':{'phone':_0x428b07[_0x5da5('0x1b')]},'attributes':['id']}});};exports[_0x5da5('0x1c')]=function(_0x3d3d26){return request(_0x5da5('0x1d'),{'options':{'where':{'id':_0x3d3d26},'attributes':[_0x5da5('0xa')]}});};exports['getSoundById']=function(_0x4393d7){return request(_0x5da5('0x1e'),{'options':{'where':{'id':_0x4393d7},'attributes':[_0x5da5('0x1f')]}});};exports['getIntervalById']=function(_0x3e0b28){return request(_0x5da5('0x20'),{'options':{'raw':![],'where':{'id':_0x3e0b28},'include':[{'model':_0x5da5('0x21'),'as':_0x5da5('0x22')}]}});};exports[_0x5da5('0x23')]=function(_0x436960){return request('ShowSmsAccount',{'options':{'where':{'id':_0x436960},'attributes':['id',_0x5da5('0xa')]}});};exports['createSmsMessage']=function(_0x1b67c4){return request(_0x5da5('0x24'),{'body':_0x1b67c4});};exports[_0x5da5('0x25')]=function(_0x5d983c){return request(_0x5da5('0x26'),{'body':_0x5d983c});};exports[_0x5da5('0x27')]=function(_0x39dd93){return request(_0x5da5('0x28'),{'body':_['merge'](_0x39dd93,{'project_name':_0x39dd93['arg_1'],'prev_project_name':_0x39dd93['arg_2']||'','is_subproject':_0x39dd93[_0x5da5('0x29')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x5da5('0x2a')]=function(_0x3974d8){return request('CreateSquareRecording',{'body':_0x3974d8});};exports[_0x5da5('0x2b')]=function(_0x1ab83e){return request('CreateSquareMessage',{'body':_0x1ab83e});};exports[_0x5da5('0x2c')]=function(_0x27de55){return request(_0x5da5('0x2d'),{'options':{'raw':![],'where':{'phone':_0x27de55[_0x5da5('0x1b')],'ListId':_0x27de55[_0x5da5('0x2e')]}}})['then'](function(_0x3ae664){if(_0x3ae664){return _0x3ae664;}return request(_0x5da5('0x2f'),{'body':_0x27de55});});};exports[_0x5da5('0x30')]=function(_0x15a0c0){return request('ShowPause',{'options':{'where':{'id':_0x15a0c0},'attributes':['name']}});};exports['agentLogin']=function(_0x245273,_0x27ed41){return request(_0x5da5('0x31'),{'body':{'interface':_0x27ed41},'options':{'where':_0x245273}});};exports[_0x5da5('0x32')]=function(_0x51b712,_0x585298,_0x24e115){return request('PauseUser',{'body':{'type':_0x585298,'uniqueid':_0x24e115},'options':{'where':_0x51b712}});};exports['agentUnpause']=function(_0x2dd4b6){return request('UnpauseUser',{'body':{},'options':{'where':_0x2dd4b6}});};exports[_0x5da5('0x33')]=function(_0x59fba9){return request(_0x5da5('0x34'),{'body':{},'options':{'where':_0x59fba9}});}; \ No newline at end of file +var _0x0fc2=['error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','format','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0fc2,0x6e));var _0x20fc=function(_0x594b71,_0x511a22){_0x594b71=_0x594b71-0x0;var _0x33eef7=_0x0fc2[_0x594b71];return _0x33eef7;};'use strict';var _=require(_0x20fc('0x0'));var moment=require(_0x20fc('0x1'));var jayson=require(_0x20fc('0x2'));var client=jayson[_0x20fc('0x3')]['http']({'port':0x2329});function request(_0x46b3ae,_0xba56f5){return new Promise(function(_0x4765f2,_0x2b95b8){return client[_0x20fc('0x4')](_0x46b3ae,_0xba56f5)[_0x20fc('0x5')](function(_0x4d2146){if(_0x4d2146[_0x20fc('0x6')]){return _0x2b95b8(_0x4d2146[_0x20fc('0x6')][_0x20fc('0x7')]);}else{return _0x4765f2(_0x4d2146[_0x20fc('0x8')]);}})[_0x20fc('0x9')](function(_0x24b617){return _0x2b95b8(_0x24b617);});});}exports[_0x20fc('0xa')]=function(){return request(_0x20fc('0xb'),{'options':{'raw':![],'attributes':['id',_0x20fc('0xc'),'production']}});};exports[_0x20fc('0xd')]=function(_0x3f25d1){return request(_0x20fc('0xe'),{'options':{'raw':![],'where':{'name':_0x3f25d1},'attributes':['production']}});};exports[_0x20fc('0xf')]=function(_0x42537c){return request(_0x20fc('0x10'),{'options':{'raw':![],'where':{'id':_0x42537c},'include':[{'model':_0x20fc('0x11'),'as':_0x20fc('0x12'),'include':[{'model':_0x20fc('0x13'),'as':_0x20fc('0x13')}]}],'attributes':['id',_0x20fc('0xc'),'email'],'smtp':!![]}});};exports[_0x20fc('0x14')]=function(_0x54caf2){return request(_0x20fc('0xe'),{'options':{'where':{'id':_0x54caf2},'attributes':['name']}});};exports[_0x20fc('0x15')]=function(_0x4c7f0e){return request(_0x20fc('0x16'),{'options':{'where':{'id':_0x4c7f0e},'attributes':[_0x20fc('0xc')]}});};exports[_0x20fc('0x17')]=function(_0x25f620){return request(_0x20fc('0x18'),{'options':{'where':{'id':_0x25f620},'attributes':[_0x20fc('0xc')]}});};exports[_0x20fc('0x19')]=function(_0x368662){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x368662},'attributes':['dsn']}});};exports[_0x20fc('0x1a')]=function(_0x3dbdc0){return request(_0x20fc('0x1b'),{'options':{'where':{'id':_0x3dbdc0},'attributes':[_0x20fc('0xc')]}});};exports['getContactByPhone']=function(_0x3f4190){return request(_0x20fc('0x1c'),{'options':{'where':{'phone':_0x3f4190[_0x20fc('0x1d')]},'attributes':['id']}});};exports[_0x20fc('0x1e')]=function(_0x1eaebd){return request(_0x20fc('0x1f'),{'options':{'where':{'id':_0x1eaebd},'attributes':[_0x20fc('0xc')]}});};exports[_0x20fc('0x20')]=function(_0x3ef728){return request(_0x20fc('0x21'),{'options':{'where':{'id':_0x3ef728},'attributes':['save_name']}});};exports[_0x20fc('0x22')]=function(_0x14b835){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x14b835},'include':[{'model':_0x20fc('0x23'),'as':_0x20fc('0x24')}]}});};exports[_0x20fc('0x25')]=function(_0x39339a){return request(_0x20fc('0x26'),{'options':{'where':{'id':_0x39339a},'attributes':['id',_0x20fc('0xc')]}});};exports[_0x20fc('0x27')]=function(_0x4bc36b){return request(_0x20fc('0x28'),{'body':_0x4bc36b});};exports[_0x20fc('0x29')]=function(_0x4bc227){return request(_0x20fc('0x2a'),{'body':_0x4bc227});};exports[_0x20fc('0x2b')]=function(_0x227ea1){return request(_0x20fc('0x2c'),{'body':_['merge'](_0x227ea1,{'project_name':_0x227ea1[_0x20fc('0x2d')],'prev_project_name':_0x227ea1['arg_2']||'','is_subproject':_0x227ea1['arg_2']?!![]:![],'leaveAt':moment()[_0x20fc('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x20fc('0x2f')]=function(_0x1d387f){return request(_0x20fc('0x30'),{'body':_0x1d387f});};exports['createSquareMessage']=function(_0x4fd3ba){return request('CreateSquareMessage',{'body':_0x4fd3ba});};exports[_0x20fc('0x31')]=function(_0x295f9a){return request(_0x20fc('0x32'),{'options':{'raw':![],'where':{'phone':_0x295f9a[_0x20fc('0x1d')],'ListId':_0x295f9a['ListId']}}})['then'](function(_0x2e4115){if(_0x2e4115){return _0x2e4115;}return request(_0x20fc('0x33'),{'body':_0x295f9a});});};exports['getPauseById']=function(_0x5923b1){return request(_0x20fc('0x34'),{'options':{'where':{'id':_0x5923b1},'attributes':['name']}});};exports[_0x20fc('0x35')]=function(_0x40fe37,_0x1865db){return request(_0x20fc('0x36'),{'body':{'interface':_0x1865db},'options':{'where':_0x40fe37}});};exports[_0x20fc('0x37')]=function(_0x2ddb7d,_0x4bfa23,_0x1f3413){return request('PauseUser',{'body':{'type':_0x4bfa23,'uniqueid':_0x1f3413},'options':{'where':_0x2ddb7d}});};exports['agentUnpause']=function(_0x10f891){return request('UnpauseUser',{'body':{},'options':{'where':_0x10f891}});};exports[_0x20fc('0x38')]=function(_0x2e2bbd){return request(_0x20fc('0x39'),{'body':{},'options':{'where':_0x2e2bbd}});}; \ 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 491df55..da52471 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 _0xad78=['./polly'];(function(_0x365093,_0x2a5559){var _0x1e20f0=function(_0x4719d5){while(--_0x4719d5){_0x365093['push'](_0x365093['shift']());}};_0x1e20f0(++_0x2a5559);}(_0xad78,0x149));var _0x8ad7=function(_0x586f74,_0x23b886){_0x586f74=_0x586f74-0x0;var _0x34e8c4=_0xad78[_0x586f74];return _0x34e8c4;};var polly=require(_0x8ad7('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb1aa=['./lex','./polly'];(function(_0x44528b,_0xda2e20){var _0x4fe13d=function(_0x3da08e){while(--_0x3da08e){_0x44528b['push'](_0x44528b['shift']());}};_0x4fe13d(++_0xda2e20);}(_0xb1aa,0x159));var _0xab1a=function(_0x3954a0,_0x4c1019){_0x3954a0=_0x3954a0-0x0;var _0x13ad3d=_0xb1aa[_0x3954a0];return _0x13ad3d;};var polly=require(_0xab1a('0x0'));var lex=require(_0xab1a('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 6c6d4a1..119efe2 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(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48){return lex(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48);}; \ No newline at end of file +var _0xa571=['exports','./lib/api'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xa571,0x107));var _0x1a57=function(_0x1ebeaf,_0x2b7387){_0x1ebeaf=_0x1ebeaf-0x0;var _0x388001=_0xa571[_0x1ebeaf];return _0x388001;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ 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 1d60711..991ac83 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(_0x4f36f9,_0x5d7cd1){var _0x135a8d=function(_0x43a640){while(--_0x43a640){_0x4f36f9['push'](_0x4f36f9['shift']());}};_0x135a8d(++_0x5d7cd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x17d2a4,_0x3899e2){var _0x5256f0=function(_0x8e06fa){while(--_0x8e06fa){_0x17d2a4['push'](_0x17d2a4['shift']());}};_0x5256f0(++_0x3899e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 3c9eb3a..4434170 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 _0x52d0=['exports','./lib/api'];(function(_0x1f44ef,_0x486a89){var _0x1ace26=function(_0x58bb28){while(--_0x58bb28){_0x1f44ef['push'](_0x1f44ef['shift']());}};_0x1ace26(++_0x486a89);}(_0x52d0,0xeb));var _0x052d=function(_0x2a4553,_0x124001){_0x2a4553=_0x2a4553-0x0;var _0x495ae5=_0x52d0[_0x2a4553];return _0x495ae5;};'use strict';var polly=require(_0x052d('0x0'));module[_0x052d('0x1')]=function(_0xf3b08d,_0x1b1f08,_0x355339,_0x2c6e96,_0x2be143,_0x2144a7,_0x9b28e2){return polly(_0xf3b08d,_0x1b1f08,_0x355339,_0x2c6e96,_0x2be143,_0x2144a7,_0x9b28e2);}; \ No newline at end of file +var _0x4279=['./lib/api'];(function(_0x3c352c,_0x47f92f){var _0x275212=function(_0x498517){while(--_0x498517){_0x3c352c['push'](_0x3c352c['shift']());}};_0x275212(++_0x47f92f);}(_0x4279,0x1e9));var _0x9427=function(_0x588b68,_0x440c3d){_0x588b68=_0x588b68-0x0;var _0x184ad7=_0x4279[_0x588b68];return _0x184ad7;};'use strict';var polly=require(_0x9427('0x0'));module['exports']=function(_0x2444f0,_0x43a9ee,_0x3f1a05,_0x1392c2,_0x305347,_0x49171b,_0x50cd23){return polly(_0x2444f0,_0x43a9ee,_0x3f1a05,_0x1392c2,_0x305347,_0x49171b,_0x50cd23);}; \ 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 dc4f159..d188318 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 _0x442e=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','randomstring'];(function(_0xd94791,_0x1e1c23){var _0x21494d=function(_0x1f459f){while(--_0x1f459f){_0xd94791['push'](_0xd94791['shift']());}};_0x21494d(++_0x1e1c23);}(_0x442e,0x12a));var _0xe442=function(_0x4ecb6a,_0x3f632b){_0x4ecb6a=_0x4ecb6a-0x0;var _0x1144b5=_0x442e[_0x4ecb6a];return _0x1144b5;};'use strict';var fs=require('fs');var path=require(_0xe442('0x0'));var BPromise=require('bluebird');var rs=require(_0xe442('0x1'));var AWS=require(_0xe442('0x2'));function pollyResult(_0x3daebd,_0x2efd34,_0x422bf0){return new BPromise(function(_0x3da063,_0x4cbad6){_0x3daebd[_0xe442('0x3')](_0x2efd34,function(_0x44ca77,_0x3f49bb){if(_0x44ca77){_0x4cbad6(_0x44ca77);}else if(_0x3f49bb){if(_0x3f49bb[_0xe442('0x4')]instanceof Buffer){fs[_0xe442('0x5')](_0x422bf0,_0x3f49bb['AudioStream'],function(_0x3a56ed){if(_0x3a56ed){_0x4cbad6(_0x3a56ed);}else{_0x3da063();}});}else{_0x4cbad6(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4cbad6(new Error(_0xe442('0x6')));}});});}module[_0xe442('0x7')]=function(_0xa28524,_0x11a21b,_0x29da54,_0x33785f,_0x1b72b1,_0x1787cf,_0x476522){var _0x53f6de=new AWS[(_0xe442('0x8'))]({'accessKeyId':_0xa28524,'secretAccessKey':_0x11a21b,'region':_0x29da54});var _0xc75d57={'Text':_0x1b72b1,'TextType':_0x1787cf||_0xe442('0x9'),'OutputFormat':'mp3','VoiceId':_0x33785f};return pollyResult(_0x53f6de,_0xc75d57,_0x476522);}; \ No newline at end of file +var _0x62e3=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4690e9,_0x3e6808){var _0x4c15b1=function(_0x4f3c33){while(--_0x4f3c33){_0x4690e9['push'](_0x4690e9['shift']());}};_0x4c15b1(++_0x3e6808);}(_0x62e3,0x101));var _0x362e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62e3[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x362e('0x0'));var BPromise=require(_0x362e('0x1'));var rs=require('randomstring');var AWS=require(_0x362e('0x2'));function pollyResult(_0x18b7de,_0x1b0efb,_0x317291){return new BPromise(function(_0x4495b6,_0x8c97d9){_0x18b7de[_0x362e('0x3')](_0x1b0efb,function(_0x22e73e,_0x2ee344){if(_0x22e73e){_0x8c97d9(_0x22e73e);}else if(_0x2ee344){if(_0x2ee344['AudioStream']instanceof Buffer){fs[_0x362e('0x4')](_0x317291,_0x2ee344[_0x362e('0x5')],function(_0x45980b){if(_0x45980b){_0x8c97d9(_0x45980b);}else{_0x4495b6();}});}else{_0x8c97d9(new Error(_0x362e('0x6')));}}else{_0x8c97d9(new Error(_0x362e('0x7')));}});});}module[_0x362e('0x8')]=function(_0xffb315,_0x28a57a,_0x3b2461,_0x29854e,_0x1f25a2,_0x8cccaa,_0x12f1ec){var _0xa4e125=new AWS['Polly']({'accessKeyId':_0xffb315,'secretAccessKey':_0x28a57a,'region':_0x3b2461});var _0x38530d={'Text':_0x1f25a2,'TextType':_0x8cccaa||_0x362e('0x9'),'OutputFormat':_0x362e('0xa'),'VoiceId':_0x29854e};return pollyResult(_0xa4e125,_0x38530d,_0x12f1ec);}; \ 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 0f89bbb..0e7006f 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 _0x3c08=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c08,0x147));var _0x83c0=function(_0x3f78db,_0x4fa49e){_0x3f78db=_0x3f78db-0x0;var _0x20ef2e=_0x3c08[_0x3f78db];return _0x20ef2e;};'use strict';var asr=require(_0x83c0('0x0'));module[_0x83c0('0x1')]=function(_0x1fd344,_0x400132,_0x19d430,_0x3a6c71){return asr(_0x1fd344,_0x400132,_0x19d430);}; \ No newline at end of file +var _0xde3b=['exports','./lib/api'];(function(_0x2dec52,_0x450783){var _0x527538=function(_0x72d19b){while(--_0x72d19b){_0x2dec52['push'](_0x2dec52['shift']());}};_0x527538(++_0x450783);}(_0xde3b,0x189));var _0xbde3=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xde3b[_0x46d0c9];return _0x174506;};'use strict';var asr=require(_0xbde3('0x0'));module[_0xbde3('0x1')]=function(_0x459805,_0x17cb24,_0x3ff0d0,_0x57cb33){return asr(_0x459805,_0x17cb24,_0x3ff0d0);}; \ 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 1c79042..10f4580 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 _0x8a55=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8a55,0x185));var _0x58a5=function(_0x11dec4,_0x5676db){_0x11dec4=_0x11dec4-0x0;var _0x2aff59=_0x8a55[_0x11dec4];return _0x2aff59;};'use strict';var url=require(_0x58a5('0x0'));var BPromise=require(_0x58a5('0x1'));var fs=require('fs');var host=_0x58a5('0x2');module[_0x58a5('0x3')]=function(_0x2befd3,_0x1cfb30,_0x2ae19a){return new BPromise(function(_0x1f68ef,_0x5d7d07){var _0x3d864a;if(typeof _0x2befd3!==_0x58a5('0x4')||_0x2befd3[_0x58a5('0x5')]===0x0){return _0x5d7d07(_0x58a5('0x6'));}if(typeof _0x1cfb30!==_0x58a5('0x4')||_0x1cfb30[_0x58a5('0x5')]===0x0){return _0x5d7d07(_0x58a5('0x7'));}if(typeof _0x2ae19a!==_0x58a5('0x8')&&(typeof _0x2ae19a!==_0x58a5('0x4')||_0x2ae19a['length']===0x0)){return _0x5d7d07(_0x58a5('0x9'));}try{_0x3d864a=fs[_0x58a5('0xa')](_0x2befd3)[_0x58a5('0xb')](_0x58a5('0xc'));}catch(_0x3b13fe){return _0x5d7d07(_0x3b13fe);}return _0x1f68ef({'method':_0x58a5('0xd'),'uri':host+_0x58a5('0xe')+_0x1cfb30,'body':{'config':{'encoding':_0x58a5('0xf'),'sampleRateHertz':_0x58a5('0x10'),'languageCode':_0x2ae19a},'audio':{'content':_0x3d864a}},'json':!![]});});}; \ No newline at end of file +var _0x6f7a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x165d79,_0x18a3bc){var _0x324215=function(_0x299a8a){while(--_0x299a8a){_0x165d79['push'](_0x165d79['shift']());}};_0x324215(++_0x18a3bc);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xd7a34c,_0x501a35){_0xd7a34c=_0xd7a34c-0x0;var _0x3ecdb4=_0x6f7a[_0xd7a34c];return _0x3ecdb4;};'use strict';var url=require(_0xa6f7('0x0'));var BPromise=require(_0xa6f7('0x1'));var fs=require('fs');var host=_0xa6f7('0x2');module[_0xa6f7('0x3')]=function(_0x4dd99d,_0x93614a,_0x407de3){return new BPromise(function(_0x12ecb8,_0x1da6dc){var _0x22e529;if(typeof _0x4dd99d!==_0xa6f7('0x4')||_0x4dd99d[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x6'));}if(typeof _0x93614a!==_0xa6f7('0x4')||_0x93614a[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x7'));}if(typeof _0x407de3!=='undefined'&&(typeof _0x407de3!=='string'||_0x407de3[_0xa6f7('0x5')]===0x0)){return _0x1da6dc(_0xa6f7('0x8'));}try{_0x22e529=fs[_0xa6f7('0x9')](_0x4dd99d)[_0xa6f7('0xa')](_0xa6f7('0xb'));}catch(_0x49a451){return _0x1da6dc(_0x49a451);}return _0x12ecb8({'method':'POST','uri':host+_0xa6f7('0xc')+_0x93614a,'body':{'config':{'encoding':_0xa6f7('0xd'),'sampleRateHertz':'8000','languageCode':_0x407de3},'audio':{'content':_0x22e529}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 966fbe7..4d94b69 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 _0x7e8e=['./asr','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x7e8e,0x1ac));var _0xe7e8=function(_0x408753,_0x5176e1){_0x408753=_0x408753-0x0;var _0x1ba6f1=_0x7e8e[_0x408753];return _0x1ba6f1;};var asr=require(_0xe7e8('0x0'));module[_0xe7e8('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3aae=['./asr'];(function(_0x2c25c7,_0x57f2d7){var _0x1e51bd=function(_0x544467){while(--_0x544467){_0x2c25c7['push'](_0x2c25c7['shift']());}};_0x1e51bd(++_0x57f2d7);}(_0x3aae,0x158));var _0xe3aa=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3aae[_0x502c7d];return _0x30b7ed;};var asr=require(_0xe3aa('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 692cba2..4241bc4 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 _0x6da5=['Data','audiofile','dirName','apiai-promise','bluebird','md5','path','querystring','request-promise','randomstring','url','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','WHAT_EVER','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts'];(function(_0x3c66b3,_0x16c189){var _0x44d0a0=function(_0x357599){while(--_0x357599){_0x3c66b3['push'](_0x3c66b3['shift']());}};_0x44d0a0(++_0x16c189);}(_0x6da5,0x11f));var _0x56da=function(_0x446bef,_0x36527f){_0x446bef=_0x446bef-0x0;var _0x5b715c=_0x6da5[_0x446bef];return _0x5b715c;};'use strict';var apiai=require(_0x56da('0x0'));var BPromise=require(_0x56da('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x56da('0x2'));var path=require(_0x56da('0x3'));var querystring=require(_0x56da('0x4'));var rp=require(_0x56da('0x5'));var rs=require(_0x56da('0x6'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x56da('0x7'))['parse'];var util=require('util');var aws=require(_0x56da('0x8'));var google=require(_0x56da('0x9'));var sestek=require('./sestek');var tilde=require(_0x56da('0xa'));var logger=require(_0x56da('0xb'))('agi');var ISPEECH_API=_0x56da('0xc');function downloadFile(_0x2d8a61,_0x4722b8){return new BPromise(function(_0x2ff813,_0x4690d4){var _0x46c7d3=urlParse(_0x2d8a61);var _0x51d38e=_0x46c7d3[_0x56da('0xd')]===_0x56da('0xe')?https:http;var _0x20b9df={'host':_0x46c7d3[_0x56da('0xf')],'path':_0x46c7d3['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x51d38e[_0x56da('0x10')](_0x20b9df,function(_0x2fc304){if(_0x2fc304[_0x56da('0x11')]!==0xc8){logger[_0x56da('0x12')](_0x56da('0x13')+_0x2d8a61+'\x20failed,\x20status\x20code\x20=\x20'+_0x2fc304[_0x56da('0x11')]+'\x20('+_0x2fc304[_0x56da('0x14')]+')');_0x4690d4(new Error('request\x20to\x20'+_0x2d8a61+_0x56da('0x15')+_0x2fc304['statusCode']+'\x20('+_0x2fc304['statusMessage']+')'));return;}var _0x160083=fs[_0x56da('0x16')](_0x4722b8);_0x160083['on'](_0x56da('0x17'),function(){logger[_0x56da('0x18')](_0x56da('0x19'));_0x160083[_0x56da('0x1a')](_0x2ff813);});_0x160083['on'](_0x56da('0x12'),function(_0x3c5a86){fs['unlink'](_0x4722b8);logger[_0x56da('0x12')](_0x56da('0x1b'),_0x3c5a86);_0x4690d4(_0x3c5a86);});_0x2fc304[_0x56da('0x1c')](_0x160083);})['on'](_0x56da('0x12'),function(_0x5e0112){logger[_0x56da('0x12')](_0x5e0112);_0x4690d4(_0x5e0112);})['end']();});}function uploadFile(_0xd627b9){return new BPromise(function(_0x48e869,_0x3e71f0){var _0x34ac06=urlParse(_0xd627b9);var _0x2abcac=_0x34ac06[_0x56da('0xd')]===_0x56da('0xe')?https:http;var _0xd033da={'host':_0x34ac06[_0x56da('0xf')],'path':_0x34ac06[_0x56da('0x3')],'headers':{'user-agent':_0x56da('0x1d')}};_0x2abcac[_0x56da('0x10')](_0xd033da,function(_0x215378){if(_0x215378[_0x56da('0x11')]!==0xc8){_0x3e71f0(new Error(_0x56da('0x13')+_0xd627b9+_0x56da('0x15')+_0x215378[_0x56da('0x11')]+'\x20('+_0x215378[_0x56da('0x14')]+')'));return;}var _0x52b90b='';_0x215378['on'](_0x56da('0x1e'),function(_0x1f18d6){_0x52b90b+=_0x1f18d6;});_0x215378['on'](_0x56da('0x1f'),function(){_0x48e869(_0x52b90b);});})['on'](_0x56da('0x12'),function(_0x130332){_0x3e71f0(_0x130332);})[_0x56da('0x1f')]();});}function convertFile(_0x30f8a1,_0x2cd951){return new BPromise(function(_0x44b11d,_0xcd4dfd){var _0x4393a9=sox[_0x56da('0x20')](_0x30f8a1,_0x2cd951,{'sampleRate':0x1f40,'format':_0x56da('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4393a9['on']('error',function(_0x492308){logger['error'](_0x56da('0x22'),_0x492308);_0xcd4dfd(_0x492308);});_0x4393a9['on'](_0x56da('0x1f'),function(){logger['info'](_0x56da('0x23'));_0x44b11d();});_0x4393a9[_0x56da('0x24')]();});}function base64Decode(_0x1551a2,_0x45c5d7){var _0x231fa1=path[_0x56da('0x25')](__dirname,_0x56da('0x26'),rs[_0x56da('0x27')](0x4)+_0x56da('0x28'));fs[_0x56da('0x29')](_0x231fa1,_0x1551a2,_0x56da('0x2a'));return convertFile(_0x231fa1,_0x45c5d7)[_0x56da('0x2b')](function(){try{fs[_0x56da('0x2c')](_0x231fa1);fs[_0x56da('0x2d')](_0x45c5d7,_0x56da('0x2e'));}catch(_0x2fe44f){logger[_0x56da('0x12')](_0x2fe44f);}return _0x45c5d7[_0x56da('0x2f')]('.')[0x0];});}function base64Encode(_0x44df9b){var _0xfb96a4=fs['readFileSync'](_0x44df9b);return new Buffer(_0xfb96a4)[_0x56da('0x30')](_0x56da('0x2a'));}exports['googleCloudTTS']=function(_0x2f5d6c,_0x2fd9ab,_0x57dbc2,_0x31bcd2,_0x30d4ed,_0x45bbfe){var _0x2e43c8,_0x31da55;var _0x24017c=_0x56da('0x31');var _0x314c87=_0x56da('0x32')+_0x2f5d6c;var _0x1ab90d={};if(_0x2fd9ab==='ssml'){_0x1ab90d['input']={'ssml':_0x57dbc2};}else{_0x1ab90d[_0x56da('0x33')]={'text':_0x57dbc2};};_0x1ab90d[_0x56da('0x34')]={'languageCode':_0x31bcd2,'ssmlGender':_0x30d4ed};_0x1ab90d[_0x56da('0x35')]={'audioEncoding':_0x56da('0x36'),'sampleRateHertz':0x1f40};var _0x502c6c={'url':_0x24017c+_0x56da('0x37')+_0x314c87,'method':_0x56da('0x38'),'json':!![],'body':_0x1ab90d};return rp(_0x502c6c)[_0x56da('0x2b')](function(_0x3b548f){return new BPromise(function(_0x20cde2,_0x5be2a1){_0x2e43c8=path[_0x56da('0x25')](__dirname,_0x56da('0x26'),rs[_0x56da('0x27')](0x4)+'.mp3');var _0x399503=Buffer[_0x56da('0x39')](_0x3b548f[_0x56da('0x3a')],_0x56da('0x2a'));return fs[_0x56da('0x3b')](_0x2e43c8,_0x399503,function(_0x1e2e1c){_0x5be2a1(_0x1e2e1c);},function(_0x48b957){fs[_0x56da('0x2d')](_0x2e43c8,'777');_0x20cde2(_0x48b957);});});})[_0x56da('0x2b')](function(_0x98e17b){_0x31da55=path['resolve'](__dirname,_0x56da('0x26'),rs[_0x56da('0x27')](0x4)+_0x56da('0x28'));return convertFile(_0x2e43c8,_0x31da55);})[_0x56da('0x2b')](function(){try{fs[_0x56da('0x2c')](_0x2e43c8);fs[_0x56da('0x2d')](_0x31da55,_0x56da('0x2e'));}catch(_0x162a57){logger['error'](_0x162a57);}logger[_0x56da('0x18')](_0x56da('0x3c'),_0x31da55[_0x56da('0x2f')]('.')[0x0]);return _0x31da55[_0x56da('0x2f')]('.')[0x0];});};exports[_0x56da('0x3d')]=function(_0x53a5e4,_0x95bb4d){var _0x1a14ec=_0x56da('0x3e');var _0x466cf4,_0x25c9d;var _0x1f59d7;var _0x26f2ee={'encoding':_0x56da('0x3f'),'method':_0x56da('0x38'),'timeout':0x2710,'url':_0x1a14ec,'headers':{'Content-Type':_0x56da('0x40')},'body':_0x56da('0x41')+encodeURIComponent(JSON['stringify']([[[_0x56da('0x42'),JSON[_0x56da('0x43')]([_0x53a5e4,_0x95bb4d||'en',![],_0x56da('0x44')]),null,_0x56da('0x45')]]]))};return rp(_0x26f2ee)['then'](function(_0x3d63fe){try{_0x1f59d7=eval(_0x3d63fe[_0x56da('0x46')](0x5))[0x0][0x2];}catch(_0x5bd181){throw new Error(_0x56da('0x47')+_0x3d63fe['data']);}if(!_0x1f59d7){if(_0x53a5e4[_0x56da('0x48')]>0xc8){throw new Error(_0x56da('0x49'));}else{throw new Error(_0x56da('0x4a')+_0x95bb4d+_0x56da('0x4b'));}}try{_0x1f59d7=eval(_0x1f59d7)[0x0];}catch(_0x23fbe6){throw new Error(_0x56da('0x47')+res[_0x56da('0x1e')]);}const _0x55cc9e=_0x1f59d7;_0x466cf4=path[_0x56da('0x25')](__dirname,_0x56da('0x26'),rs[_0x56da('0x27')](0x4)+'.mp3');fs[_0x56da('0x29')](_0x466cf4,_0x1f59d7,{'encoding':_0x56da('0x2a')});_0x25c9d=path[_0x56da('0x25')](__dirname,'tmp',rs[_0x56da('0x27')](0x4)+_0x56da('0x28'));return convertFile(_0x466cf4,_0x25c9d);})[_0x56da('0x2b')](function(){try{fs['unlink'](_0x466cf4);fs[_0x56da('0x2d')](_0x25c9d,'777');}catch(_0x2ffc93){logger[_0x56da('0x12')](_0x2ffc93);}logger[_0x56da('0x18')](_0x56da('0x4c'),_0x25c9d['split']('.')[0x0]);return _0x25c9d[_0x56da('0x2f')]('.')[0x0];});};exports[_0x56da('0x4d')]=function(_0x411c8e,_0x24e97f,_0x26d84e){return google['asr'](_0x411c8e,_0x24e97f,_0x26d84e)['then'](function(_0x3e5f4f){logger[_0x56da('0x18')](_0x3e5f4f[_0x56da('0x4e')]);return rp(_0x3e5f4f);})['then'](function(_0x5647ef){var _0x53ef44='';var _0x3b9aac=0x0;try{fs[_0x56da('0x2c')](_0x411c8e);}catch(_0x208fce){logger[_0x56da('0x12')](_0x208fce);}if(_0x5647ef&&_0x5647ef['results']){_0x53ef44=_0x5647ef[_0x56da('0x4f')]['map'](function(_0x32c660){return _0x32c660&&_0x32c660[_0x56da('0x50')][0x0]&&_0x32c660['alternatives'][0x0][_0x56da('0x51')]?_0x32c660[_0x56da('0x50')][0x0][_0x56da('0x51')]:'';})[_0x56da('0x52')]('\x0a');_0x3b9aac=_0x5647ef[_0x56da('0x4f')][_0x56da('0x53')](function(_0x416460){return _0x416460&&_0x416460[_0x56da('0x50')][0x0]&&_0x416460['alternatives'][0x0]['confidence']?_0x416460[_0x56da('0x50')][0x0][_0x56da('0x54')]:0x0;})[_0x56da('0x52')]('\x0a');}logger['info'](_0x56da('0x55'),_0x53ef44);logger[_0x56da('0x18')](_0x56da('0x56'),_0x3b9aac);return{'transcript':_0x53ef44,'confidence':_0x3b9aac};})[_0x56da('0x57')](function(_0x3d82ab){logger[_0x56da('0x12')](_0x56da('0x58'),_0x3d82ab[_0x56da('0x11')],_0x3d82ab[_0x56da('0x59')],_0x3d82ab[_0x56da('0x5a')]);});};exports[_0x56da('0x5b')]=function(_0x5bd3ec,_0x193f84,_0x38d3a9,_0x4b1a3c){var _0x4b0759=apiai(_0x193f84,{'language':_0x4b1a3c||'en'});return _0x4b0759[_0x56da('0x5c')](_0x38d3a9,{'sessionId':md5(_0x5bd3ec)})[_0x56da('0x2b')](function(_0x333c31){logger[_0x56da('0x18')](JSON[_0x56da('0x43')](_0x333c31));return{'source':_0x333c31['result'][_0x56da('0x5d')],'resolvedQuery':_0x333c31[_0x56da('0x5e')][_0x56da('0x5f')],'action':_0x333c31[_0x56da('0x5e')][_0x56da('0x60')],'actionIncomplete':_0x333c31[_0x56da('0x5e')]['actionIncomplete'],'speech':_0x333c31['result'][_0x56da('0x61')]['speech'],'score':_0x333c31[_0x56da('0x5e')][_0x56da('0x62')],'statusCode':_0x333c31[_0x56da('0x63')][_0x56da('0x64')],'endConversation':_0x333c31[_0x56da('0x5e')][_0x56da('0x65')][_0x56da('0x66')]||![],'isFallbackIntent':_0x333c31['result'][_0x56da('0x65')][_0x56da('0x67')]};});};exports[_0x56da('0x68')]=function(_0x5237be,_0x46e11c,_0x567b84,_0x139123,_0x12530e,_0x5d4bca){var _0x216cb9=_0x139123[_0x56da('0x69')](/\\n/g,'\x0a');var _0x5bb9db={'credentials':{'private_key':_0x216cb9,'client_email':_0x567b84}};var _0x205915=new dialogflow[(_0x56da('0x6a'))](_0x5bb9db);var _0x25c560=_0x205915['sessionPath'](_0x46e11c,md5(_0x5237be));var _0x169b47={'session':_0x25c560,'queryInput':{'text':{'text':_0x12530e,'languageCode':_0x5d4bca}}};return _0x205915[_0x56da('0x6b')](_0x169b47)['then'](function(_0x53854d){if(_0x53854d&&_0x53854d[_0x56da('0x48')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x56da('0x43')](_0x53854d));var _0x37cb84=_0x53854d[0x0];if(_0x37cb84){var _0x4f1e4a={'action':_0x37cb84[_0x56da('0x6c')]['action'],'allRequiredParamsPresent':_0x37cb84['queryResult'][_0x56da('0x6d')],'endConversation':_0x37cb84[_0x56da('0x6c')][_0x56da('0x6e')]&&_0x37cb84['queryResult'][_0x56da('0x6e')][_0x56da('0x6f')]?_0x37cb84[_0x56da('0x6c')]['diagnosticInfo']['fields'][_0x56da('0x70')]['boolValue']:![],'fulfillmentText':_0x37cb84[_0x56da('0x6c')]['fulfillmentText'],'intentName':_0x37cb84['queryResult'][_0x56da('0x71')][_0x56da('0x59')],'intentDisplayName':_0x37cb84['queryResult'][_0x56da('0x71')]['displayName'],'isFallbackIntent':_0x37cb84[_0x56da('0x6c')]['intent'][_0x56da('0x72')],'languageCode':_0x37cb84[_0x56da('0x6c')][_0x56da('0x73')],'queryText':_0x37cb84[_0x56da('0x6c')][_0x56da('0x74')],'responseId':_0x37cb84[_0x56da('0x75')],'score':_0x37cb84[_0x56da('0x6c')][_0x56da('0x76')],'speech':_0x37cb84['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x56da('0x43')](_0x53854d)};return _0x4f1e4a;}}});};exports[_0x56da('0x77')]=function(_0x4fbf0a,_0x4ea97b,_0x30f725,_0x7e93d5){return tilde[_0x56da('0x78')](_0x4fbf0a,_0x4ea97b,_0x30f725,_0x7e93d5)[_0x56da('0x2b')](function(_0x4fc081){try{fs[_0x56da('0x2c')](_0x4fbf0a);}catch(_0x2d498d){logger[_0x56da('0x12')](_0x2d498d);}logger[_0x56da('0x18')]('Tilde\x20ASR\x20transcription',_0x4fc081[_0x56da('0x51')]);logger[_0x56da('0x18')](_0x56da('0x79'),_0x4fc081[_0x56da('0x54')]);return _0x4fc081;});};exports[_0x56da('0x7a')]=function(_0x183df0,_0x174e33,_0x217a9c,_0x1bdaec,_0x58e722,_0x22f468){var _0x37a0c0=path[_0x56da('0x25')](__dirname,'tmp',rs[_0x56da('0x27')](0x4)+'.mp3');var _0x26860f;return aws[_0x56da('0x7b')](_0x183df0,_0x174e33,_0x217a9c,_0x1bdaec,_0x58e722,_0x22f468,_0x37a0c0)[_0x56da('0x2b')](function(){_0x26860f=path['resolve'](__dirname,_0x56da('0x26'),rs[_0x56da('0x27')](0x4)+_0x56da('0x28'));return convertFile(_0x37a0c0,_0x26860f);})[_0x56da('0x2b')](function(){try{fs[_0x56da('0x2c')](_0x37a0c0);fs['chmodSync'](_0x26860f,_0x56da('0x2e'));}catch(_0x2c92fd){logger[_0x56da('0x12')](_0x2c92fd);}return _0x26860f['split']('.')[0x0];});};exports[_0x56da('0x7c')]=function(_0x52cc00,_0x129e24,_0x421447,_0xf47b20,_0x4766db,_0x4640c2){return aws[_0x56da('0x7d')](_0x52cc00,_0x129e24,_0x421447,_0xf47b20,_0x4766db,_0x4640c2)[_0x56da('0x2b')](function(_0x2b4faa){logger[_0x56da('0x18')](JSON[_0x56da('0x43')](_0x2b4faa));return _0x2b4faa;});};exports[_0x56da('0x7e')]=function(_0x8b8a68,_0x45124b,_0x3629c0,_0xba9d1a){var _0x369a13=util['format'](_0x56da('0x7f'),ISPEECH_API,_0x8b8a68,encodeURIComponent(_0x45124b),_0x3629c0,_0xba9d1a);var _0x11d20a=path[_0x56da('0x25')](__dirname,_0x56da('0x26'),rs['generate'](0x4)+'.mp3');var _0x5c0ecc;return downloadFile(_0x369a13,_0x11d20a)[_0x56da('0x2b')](function(){_0x5c0ecc=path[_0x56da('0x25')](__dirname,_0x56da('0x26'),rs[_0x56da('0x27')](0x4)+_0x56da('0x28'));return convertFile(_0x11d20a,_0x5c0ecc);})['then'](function(){try{fs['unlink'](_0x11d20a);fs[_0x56da('0x2d')](_0x5c0ecc,_0x56da('0x2e'));}catch(_0x1c67c0){logger[_0x56da('0x12')](_0x1c67c0);}return _0x5c0ecc[_0x56da('0x2f')]('.')[0x0];});};exports[_0x56da('0x80')]=function(_0x5967d9,_0x3bac71,_0x4c2e49,_0x2e0ebd){var _0x5bae79=util[_0x56da('0x81')](_0x56da('0x82'),ISPEECH_API,_0x3bac71,_0x4c2e49,base64Encode(_0x5967d9),_0x2e0ebd?util[_0x56da('0x81')](_0x56da('0x83'),encodeURIComponent(_0x2e0ebd)):_0x56da('0x84'));return uploadFile(_0x5bae79)[_0x56da('0x2b')](function(_0x59fae6){return querystring['parse'](_0x59fae6);});};exports[_0x56da('0x85')]=function(_0x47820c,_0x442ccc){return sestek[_0x56da('0x86')](_0x47820c,_0x442ccc)[_0x56da('0x2b')](function(_0x3b3e56){logger[_0x56da('0x18')](JSON['stringify'](_0x3b3e56));var _0xff5bdd={'speech':_0x3b3e56['text'],'action':_0x3b3e56[_0x56da('0x87')]?_0x3b3e56['channelData'][_0x56da('0x88')]:undefined,'actiondata':_0x3b3e56['channelData']?_0x3b3e56[_0x56da('0x87')][_0x56da('0x89')]:undefined};if(_0x3b3e56[_0x56da('0x87')]&&_0x3b3e56[_0x56da('0x87')]['AudioFromTts']){return base64Decode(_0x3b3e56[_0x56da('0x87')][_0x56da('0x8a')][_0x56da('0x8b')],path['resolve'](__dirname,_0x56da('0x26'),rs[_0x56da('0x27')](0x4)+'.wav'))['then'](function(_0xb903a2){_0xff5bdd[_0x56da('0x8c')]=_0xb903a2;return _0xff5bdd;});}return _0xff5bdd;});};exports[_0x56da('0x8d')]=function(){return __dirname;}; \ No newline at end of file +var _0x6816=['writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','url','parse','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','data','transcode','wav','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','voice','MP3','text:synthesize','POST','.mp3','audioContent'];(function(_0x353caa,_0x4f934a){var _0x4e9b56=function(_0xbba612){while(--_0xbba612){_0x353caa['push'](_0x353caa['shift']());}};_0x4e9b56(++_0x4f934a);}(_0x6816,0xdb));var _0x6681=function(_0x22fc37,_0x1282e2){_0x22fc37=_0x22fc37-0x0;var _0x140b92=_0x6816[_0x22fc37];return _0x140b92;};'use strict';var apiai=require(_0x6681('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x6681('0x1'));var fs=require('fs');var http=require(_0x6681('0x2'));var https=require(_0x6681('0x3'));var md5=require(_0x6681('0x4'));var path=require(_0x6681('0x5'));var querystring=require(_0x6681('0x6'));var rp=require(_0x6681('0x7'));var rs=require(_0x6681('0x8'));var sox=require(_0x6681('0x9'));var tts=require('google-tts-api');var urlParse=require(_0x6681('0xa'))[_0x6681('0xb')];var util=require('util');var aws=require(_0x6681('0xc'));var google=require('./google');var sestek=require(_0x6681('0xd'));var tilde=require('./tilde');var logger=require(_0x6681('0xe'))(_0x6681('0xf'));var ISPEECH_API=_0x6681('0x10');function downloadFile(_0x4dab81,_0x250e7f){return new BPromise(function(_0x4a6c73,_0x557a6c){var _0x3b4b86=urlParse(_0x4dab81);var _0x1ef766=_0x3b4b86[_0x6681('0x11')]===_0x6681('0x12')?https:http;var _0x32e89f={'host':_0x3b4b86['host'],'path':_0x3b4b86['path'],'headers':{'user-agent':_0x6681('0x13')}};_0x1ef766[_0x6681('0x14')](_0x32e89f,function(_0x5e16bd){if(_0x5e16bd[_0x6681('0x15')]!==0xc8){logger[_0x6681('0x16')](_0x6681('0x17')+_0x4dab81+_0x6681('0x18')+_0x5e16bd[_0x6681('0x15')]+'\x20('+_0x5e16bd[_0x6681('0x19')]+')');_0x557a6c(new Error('request\x20to\x20'+_0x4dab81+_0x6681('0x18')+_0x5e16bd[_0x6681('0x15')]+'\x20('+_0x5e16bd['statusMessage']+')'));return;}var _0x2ca03b=fs[_0x6681('0x1a')](_0x250e7f);_0x2ca03b['on'](_0x6681('0x1b'),function(){logger[_0x6681('0x1c')](_0x6681('0x1d'));_0x2ca03b[_0x6681('0x1e')](_0x4a6c73);});_0x2ca03b['on'](_0x6681('0x16'),function(_0x58f6c4){fs[_0x6681('0x1f')](_0x250e7f);logger['error'](_0x6681('0x20'),_0x58f6c4);_0x557a6c(_0x58f6c4);});_0x5e16bd[_0x6681('0x21')](_0x2ca03b);})['on'](_0x6681('0x16'),function(_0xcb8be9){logger['error'](_0xcb8be9);_0x557a6c(_0xcb8be9);})[_0x6681('0x22')]();});}function uploadFile(_0x1b44e9){return new BPromise(function(_0x45bfcc,_0x23ba2a){var _0x22d3ac=urlParse(_0x1b44e9);var _0x1ec750=_0x22d3ac[_0x6681('0x11')]==='https:'?https:http;var _0x27cc43={'host':_0x22d3ac[_0x6681('0x23')],'path':_0x22d3ac[_0x6681('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x1ec750[_0x6681('0x14')](_0x27cc43,function(_0x1e6285){if(_0x1e6285[_0x6681('0x15')]!==0xc8){_0x23ba2a(new Error(_0x6681('0x17')+_0x1b44e9+_0x6681('0x18')+_0x1e6285[_0x6681('0x15')]+'\x20('+_0x1e6285[_0x6681('0x19')]+')'));return;}var _0x8180e3='';_0x1e6285['on'](_0x6681('0x24'),function(_0x150392){_0x8180e3+=_0x150392;});_0x1e6285['on'](_0x6681('0x22'),function(){_0x45bfcc(_0x8180e3);});})['on'](_0x6681('0x16'),function(_0x242881){_0x23ba2a(_0x242881);})[_0x6681('0x22')]();});}function convertFile(_0x49d3e1,_0x464f6a){return new BPromise(function(_0x2d4734,_0x2ea2ff){var _0x2029e5=sox[_0x6681('0x25')](_0x49d3e1,_0x464f6a,{'sampleRate':0x1f40,'format':_0x6681('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2029e5['on']('error',function(_0x53951a){logger[_0x6681('0x16')]('error\x20convert',_0x53951a);_0x2ea2ff(_0x53951a);});_0x2029e5['on'](_0x6681('0x22'),function(){logger[_0x6681('0x1c')](_0x6681('0x27'));_0x2d4734();});_0x2029e5['start']();});}function base64Decode(_0x33a55d,_0x281b7e){var _0x26da27=path[_0x6681('0x28')](__dirname,_0x6681('0x29'),rs[_0x6681('0x2a')](0x4)+_0x6681('0x2b'));fs[_0x6681('0x2c')](_0x26da27,_0x33a55d,_0x6681('0x2d'));return convertFile(_0x26da27,_0x281b7e)[_0x6681('0x2e')](function(){try{fs[_0x6681('0x1f')](_0x26da27);fs[_0x6681('0x2f')](_0x281b7e,_0x6681('0x30'));}catch(_0x3ae3fb){logger[_0x6681('0x16')](_0x3ae3fb);}return _0x281b7e[_0x6681('0x31')]('.')[0x0];});}function base64Encode(_0x44b128){var _0x57d5aa=fs[_0x6681('0x32')](_0x44b128);return new Buffer(_0x57d5aa)[_0x6681('0x33')]('base64');}exports[_0x6681('0x34')]=function(_0x1a4e12,_0x4e6303,_0x4bd8fd,_0x524e19,_0x14525f,_0x200bb8){var _0x26a9b8,_0x4eec03;var _0x3fc873='https://texttospeech.googleapis.com/v1/';var _0x4b185b=_0x6681('0x35')+_0x1a4e12;var _0xf23f58={};if(_0x4e6303===_0x6681('0x36')){_0xf23f58['input']={'ssml':_0x4bd8fd};}else{_0xf23f58['input']={'text':_0x4bd8fd};};_0xf23f58[_0x6681('0x37')]={'languageCode':_0x524e19,'ssmlGender':_0x14525f};_0xf23f58['audioConfig']={'audioEncoding':_0x6681('0x38'),'sampleRateHertz':0x1f40};var _0x51e560={'url':_0x3fc873+_0x6681('0x39')+_0x4b185b,'method':_0x6681('0x3a'),'json':!![],'body':_0xf23f58};return rp(_0x51e560)[_0x6681('0x2e')](function(_0x50baf2){return new BPromise(function(_0x4a9c83,_0x36274c){_0x26a9b8=path['resolve'](__dirname,'tmp',rs[_0x6681('0x2a')](0x4)+_0x6681('0x3b'));var _0x45d35b=Buffer['from'](_0x50baf2[_0x6681('0x3c')],_0x6681('0x2d'));return fs[_0x6681('0x3d')](_0x26a9b8,_0x45d35b,function(_0x370549){_0x36274c(_0x370549);},function(_0x1a41e7){fs['chmodSync'](_0x26a9b8,'777');_0x4a9c83(_0x1a41e7);});});})['then'](function(_0x5d4d7c){_0x4eec03=path[_0x6681('0x28')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x26a9b8,_0x4eec03);})['then'](function(){try{fs[_0x6681('0x1f')](_0x26a9b8);fs[_0x6681('0x2f')](_0x4eec03,_0x6681('0x30'));}catch(_0x4baaad){logger['error'](_0x4baaad);}logger[_0x6681('0x1c')](_0x6681('0x3e'),_0x4eec03['split']('.')[0x0]);return _0x4eec03[_0x6681('0x31')]('.')[0x0];});};exports['googleTTS']=function(_0xb2069b,_0x309574){var _0x4cb7aa=_0x6681('0x3f');var _0x588cf7,_0x3cc596;var _0x242f99;var _0x348018={'encoding':_0x6681('0x40'),'method':_0x6681('0x3a'),'timeout':0x2710,'url':_0x4cb7aa,'headers':{'Content-Type':_0x6681('0x41')},'body':_0x6681('0x42')+encodeURIComponent(JSON[_0x6681('0x43')]([[[_0x6681('0x44'),JSON[_0x6681('0x43')]([_0xb2069b,_0x309574||'en',![],_0x6681('0x45')]),null,_0x6681('0x46')]]]))};return rp(_0x348018)['then'](function(_0x2eed5a){try{_0x242f99=eval(_0x2eed5a[_0x6681('0x47')](0x5))[0x0][0x2];}catch(_0xe94ba1){throw new Error(_0x6681('0x48')+_0x2eed5a[_0x6681('0x24')]);}if(!_0x242f99){if(_0xb2069b[_0x6681('0x49')]>0xc8){throw new Error(_0x6681('0x4a'));}else{throw new Error(_0x6681('0x4b')+_0x309574+_0x6681('0x4c'));}}try{_0x242f99=eval(_0x242f99)[0x0];}catch(_0x3415fb){throw new Error(_0x6681('0x48')+res[_0x6681('0x24')]);}const _0x375deb=_0x242f99;_0x588cf7=path[_0x6681('0x28')](__dirname,_0x6681('0x29'),rs[_0x6681('0x2a')](0x4)+_0x6681('0x3b'));fs[_0x6681('0x2c')](_0x588cf7,_0x242f99,{'encoding':'base64'});_0x3cc596=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x588cf7,_0x3cc596);})[_0x6681('0x2e')](function(){try{fs[_0x6681('0x1f')](_0x588cf7);fs[_0x6681('0x2f')](_0x3cc596,_0x6681('0x30'));}catch(_0x2dd30d){logger['error'](_0x2dd30d);}logger[_0x6681('0x1c')](_0x6681('0x4d'),_0x3cc596['split']('.')[0x0]);return _0x3cc596['split']('.')[0x0];});};exports[_0x6681('0x4e')]=function(_0x11d966,_0x1dc9b6,_0x47dd04){return google[_0x6681('0x4f')](_0x11d966,_0x1dc9b6,_0x47dd04)[_0x6681('0x2e')](function(_0x3030c3){logger[_0x6681('0x1c')](_0x3030c3[_0x6681('0x50')]);return rp(_0x3030c3);})[_0x6681('0x2e')](function(_0x3cae6b){var _0x4376c9='';var _0x1b6695=0x0;try{fs[_0x6681('0x1f')](_0x11d966);}catch(_0x2ced67){logger[_0x6681('0x16')](_0x2ced67);}if(_0x3cae6b&&_0x3cae6b[_0x6681('0x51')]){_0x4376c9=_0x3cae6b[_0x6681('0x51')]['map'](function(_0x26c5ac){return _0x26c5ac&&_0x26c5ac[_0x6681('0x52')][0x0]&&_0x26c5ac[_0x6681('0x52')][0x0][_0x6681('0x53')]?_0x26c5ac[_0x6681('0x52')][0x0]['transcript']:'';})[_0x6681('0x54')]('\x0a');_0x1b6695=_0x3cae6b[_0x6681('0x51')]['map'](function(_0x388e86){return _0x388e86&&_0x388e86[_0x6681('0x52')][0x0]&&_0x388e86[_0x6681('0x52')][0x0][_0x6681('0x55')]?_0x388e86[_0x6681('0x52')][0x0][_0x6681('0x55')]:0x0;})['join']('\x0a');}logger[_0x6681('0x1c')](_0x6681('0x56'),_0x4376c9);logger[_0x6681('0x1c')](_0x6681('0x57'),_0x1b6695);return{'transcript':_0x4376c9,'confidence':_0x1b6695};})[_0x6681('0x58')](function(_0x10f688){logger[_0x6681('0x16')](_0x6681('0x59'),_0x10f688['statusCode'],_0x10f688[_0x6681('0x5a')],_0x10f688['message']);});};exports[_0x6681('0x5b')]=function(_0x2bf56d,_0x1e6816,_0x53b871,_0x468931){var _0x5c4be2=apiai(_0x1e6816,{'language':_0x468931||'en'});return _0x5c4be2['textRequest'](_0x53b871,{'sessionId':md5(_0x2bf56d)})[_0x6681('0x2e')](function(_0x17f6c9){logger[_0x6681('0x1c')](JSON['stringify'](_0x17f6c9));return{'source':_0x17f6c9[_0x6681('0x5c')][_0x6681('0x5d')],'resolvedQuery':_0x17f6c9['result'][_0x6681('0x5e')],'action':_0x17f6c9[_0x6681('0x5c')][_0x6681('0x5f')],'actionIncomplete':_0x17f6c9['result'][_0x6681('0x60')],'speech':_0x17f6c9[_0x6681('0x5c')][_0x6681('0x61')][_0x6681('0x62')],'score':_0x17f6c9[_0x6681('0x5c')]['score'],'statusCode':_0x17f6c9[_0x6681('0x63')][_0x6681('0x64')],'endConversation':_0x17f6c9[_0x6681('0x5c')][_0x6681('0x65')][_0x6681('0x66')]||![],'isFallbackIntent':_0x17f6c9[_0x6681('0x5c')]['metadata'][_0x6681('0x67')]};});};exports[_0x6681('0x68')]=function(_0x3c43ee,_0x48a9c1,_0x42dd14,_0x5f3009,_0x6c885c,_0x6f8990){var _0x4c8fcb=_0x5f3009[_0x6681('0x69')](/\\n/g,'\x0a');var _0x4c8d08={'credentials':{'private_key':_0x4c8fcb,'client_email':_0x42dd14}};var _0x232323=new dialogflow['SessionsClient'](_0x4c8d08);var _0x24ee41=_0x232323[_0x6681('0x6a')](_0x48a9c1,md5(_0x3c43ee));var _0x1535df={'session':_0x24ee41,'queryInput':{'text':{'text':_0x6c885c,'languageCode':_0x6f8990}}};return _0x232323[_0x6681('0x6b')](_0x1535df)[_0x6681('0x2e')](function(_0x599bed){if(_0x599bed&&_0x599bed[_0x6681('0x49')]){logger[_0x6681('0x1c')](_0x6681('0x6c'),JSON['stringify'](_0x599bed));var _0x485e4c=_0x599bed[0x0];if(_0x485e4c){var _0x4e22e0={'action':_0x485e4c['queryResult']['action'],'allRequiredParamsPresent':_0x485e4c['queryResult'][_0x6681('0x6d')],'endConversation':_0x485e4c['queryResult'][_0x6681('0x6e')]&&_0x485e4c[_0x6681('0x6f')][_0x6681('0x6e')]['fields']?_0x485e4c[_0x6681('0x6f')]['diagnosticInfo'][_0x6681('0x70')]['end_conversation'][_0x6681('0x71')]:![],'fulfillmentText':_0x485e4c[_0x6681('0x6f')][_0x6681('0x72')],'intentName':_0x485e4c['queryResult'][_0x6681('0x73')][_0x6681('0x5a')],'intentDisplayName':_0x485e4c[_0x6681('0x6f')][_0x6681('0x73')][_0x6681('0x74')],'isFallbackIntent':_0x485e4c['queryResult']['intent'][_0x6681('0x75')],'languageCode':_0x485e4c[_0x6681('0x6f')][_0x6681('0x76')],'queryText':_0x485e4c[_0x6681('0x6f')][_0x6681('0x77')],'responseId':_0x485e4c[_0x6681('0x78')],'score':_0x485e4c[_0x6681('0x6f')][_0x6681('0x79')],'speech':_0x485e4c[_0x6681('0x6f')]['fulfillmentText'],'providerResponse':JSON[_0x6681('0x43')](_0x599bed)};return _0x4e22e0;}}});};exports[_0x6681('0x7a')]=function(_0xb41e39,_0x2ad80b,_0x3fa679,_0x3542ec){return tilde[_0x6681('0x4f')](_0xb41e39,_0x2ad80b,_0x3fa679,_0x3542ec)['then'](function(_0x1c6e6a){try{fs[_0x6681('0x1f')](_0xb41e39);}catch(_0xf5c738){logger[_0x6681('0x16')](_0xf5c738);}logger[_0x6681('0x1c')]('Tilde\x20ASR\x20transcription',_0x1c6e6a[_0x6681('0x53')]);logger[_0x6681('0x1c')](_0x6681('0x7b'),_0x1c6e6a[_0x6681('0x55')]);return _0x1c6e6a;});};exports['awsPolly']=function(_0x39aa5d,_0x49f593,_0x2ab6af,_0xefa99a,_0x499aec,_0x3b59a8){var _0x4d9607=path['resolve'](__dirname,_0x6681('0x29'),rs['generate'](0x4)+_0x6681('0x3b'));var _0x521f1d;return aws[_0x6681('0x7c')](_0x39aa5d,_0x49f593,_0x2ab6af,_0xefa99a,_0x499aec,_0x3b59a8,_0x4d9607)[_0x6681('0x2e')](function(){_0x521f1d=path[_0x6681('0x28')](__dirname,_0x6681('0x29'),rs[_0x6681('0x2a')](0x4)+_0x6681('0x2b'));return convertFile(_0x4d9607,_0x521f1d);})[_0x6681('0x2e')](function(){try{fs[_0x6681('0x1f')](_0x4d9607);fs[_0x6681('0x2f')](_0x521f1d,_0x6681('0x30'));}catch(_0x17a0c6){logger['error'](_0x17a0c6);}return _0x521f1d[_0x6681('0x31')]('.')[0x0];});};exports[_0x6681('0x7d')]=function(_0x1c3d10,_0x4a0691,_0x2c09b7,_0x206c51,_0x49df99,_0x49defc){return aws['lex'](_0x1c3d10,_0x4a0691,_0x2c09b7,_0x206c51,_0x49df99,_0x49defc)[_0x6681('0x2e')](function(_0x178c10){logger[_0x6681('0x1c')](JSON[_0x6681('0x43')](_0x178c10));return _0x178c10;});};exports[_0x6681('0x7e')]=function(_0x384991,_0xcd11c8,_0x125157,_0x3aef96){var _0x5085de=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x384991,encodeURIComponent(_0xcd11c8),_0x125157,_0x3aef96);var _0x1a8b3b=path[_0x6681('0x28')](__dirname,_0x6681('0x29'),rs[_0x6681('0x2a')](0x4)+_0x6681('0x3b'));var _0xffa782;return downloadFile(_0x5085de,_0x1a8b3b)[_0x6681('0x2e')](function(){_0xffa782=path[_0x6681('0x28')](__dirname,_0x6681('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x1a8b3b,_0xffa782);})[_0x6681('0x2e')](function(){try{fs['unlink'](_0x1a8b3b);fs[_0x6681('0x2f')](_0xffa782,_0x6681('0x30'));}catch(_0x2e8192){logger[_0x6681('0x16')](_0x2e8192);}return _0xffa782['split']('.')[0x0];});};exports['ispeechASR']=function(_0x15a9f2,_0x470f4c,_0x9b72cf,_0x49a584){var _0x40b008=util[_0x6681('0x7f')](_0x6681('0x80'),ISPEECH_API,_0x470f4c,_0x9b72cf,base64Encode(_0x15a9f2),_0x49a584?util[_0x6681('0x7f')](_0x6681('0x81'),encodeURIComponent(_0x49a584)):_0x6681('0x82'));return uploadFile(_0x40b008)['then'](function(_0x5c619c){return querystring[_0x6681('0xb')](_0x5c619c);});};exports[_0x6681('0x83')]=function(_0x80e26e,_0x17bb2b){return sestek[_0x6681('0x84')](_0x80e26e,_0x17bb2b)[_0x6681('0x2e')](function(_0x48ad92){logger[_0x6681('0x1c')](JSON['stringify'](_0x48ad92));var _0xc3bc29={'speech':_0x48ad92[_0x6681('0x85')],'action':_0x48ad92[_0x6681('0x86')]?_0x48ad92[_0x6681('0x86')]['CustomAction']:undefined,'actiondata':_0x48ad92[_0x6681('0x86')]?_0x48ad92['channelData'][_0x6681('0x87')]:undefined};if(_0x48ad92[_0x6681('0x86')]&&_0x48ad92[_0x6681('0x86')][_0x6681('0x88')]){return base64Decode(_0x48ad92[_0x6681('0x86')]['AudioFromTts'][_0x6681('0x89')],path['resolve'](__dirname,'tmp',rs[_0x6681('0x2a')](0x4)+_0x6681('0x2b')))[_0x6681('0x2e')](function(_0x52ac0e){_0xc3bc29[_0x6681('0x8a')]=_0x52ac0e;return _0xc3bc29;});}return _0xc3bc29;});};exports[_0x6681('0x8b')]=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 78f4477..3cac721 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 _0x04a5=['./nda','exports'];(function(_0x59869d,_0x3e2365){var _0x174365=function(_0x76803a){while(--_0x76803a){_0x59869d['push'](_0x59869d['shift']());}};_0x174365(++_0x3e2365);}(_0x04a5,0x192));var _0x504a=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x04a5[_0x1c34e7];return _0x378cb1;};var nda=require(_0x504a('0x0'));module[_0x504a('0x1')]={'nda':nda}; \ No newline at end of file +var _0x0dfc=['exports'];(function(_0x324484,_0x479aba){var _0x302eaf=function(_0x3de7e8){while(--_0x3de7e8){_0x324484['push'](_0x324484['shift']());}};_0x302eaf(++_0x479aba);}(_0x0dfc,0xd2));var _0xc0df=function(_0x1c3127,_0xd6de1f){_0x1c3127=_0x1c3127-0x0;var _0x4ddb8b=_0x0dfc[_0x1c3127];return _0x4ddb8b;};var nda=require('./nda');module[_0xc0df('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 c081932..c8b3d82 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 _0xf996=['uniqueid','callerid','calleridname','dnid','text','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf996,0x74));var _0x6f99=function(_0x1b8d78,_0x8606df){_0x1b8d78=_0x1b8d78-0x0;var _0x44a515=_0xf996[_0x1b8d78];return _0x44a515;};'use strict';var rp=require(_0x6f99('0x0'));var url=require(_0x6f99('0x1'));var logger=require(_0x6f99('0x2'))('agi');module[_0x6f99('0x3')]=function(_0x56fd3f,_0x5ceb57){var _0x2eb1fc={'method':_0x6f99('0x4'),'uri':url[_0x6f99('0x5')](_0x5ceb57[_0x6f99('0x6')],_0x6f99('0x7')),'form':{'grant_type':_0x6f99('0x8'),'username':_0x5ceb57[_0x6f99('0x9')],'password':_0x5ceb57[_0x6f99('0x8')]},'json':!![]};return rp(_0x2eb1fc)[_0x6f99('0xa')](function(_0x1e4805){var _0x5d8b7f={'method':_0x6f99('0x4'),'uri':url['resolve'](_0x5ceb57[_0x6f99('0xb')],_0x6f99('0xc')),'body':{'type':_0x5ceb57[_0x6f99('0xd')]||_0x6f99('0xe'),'channelId':_0x6f99('0xf'),'conversation':{'id':_0x56fd3f[_0x6f99('0x10')]},'from':{'id':_0x56fd3f[_0x6f99('0x11')],'name':_0x56fd3f[_0x6f99('0x12')]},'recipient':{'id':_0x56fd3f[_0x6f99('0x13')],'name':_0x56fd3f['extension']},'text':_0x5ceb57[_0x6f99('0x14')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x1e4805['access_token']},'json':!![]};if(_0x5ceb57['project']){_0x5d8b7f[_0x6f99('0x15')][_0x6f99('0x16')][_0x6f99('0x17')]=_0x5ceb57[_0x6f99('0x18')];}if(_0x5ceb57[_0x6f99('0x19')]=='1'){_0x5d8b7f[_0x6f99('0x15')][_0x6f99('0x16')][_0x6f99('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6f99('0x1b')};}if(_0x5ceb57[_0x6f99('0x1c')]){_0x5d8b7f[_0x6f99('0x15')][_0x6f99('0x16')]['CustomAction']=_0x5ceb57[_0x6f99('0x1c')];if(_0x5ceb57[_0x6f99('0x1d')]){_0x5d8b7f['body']['channelData'][_0x6f99('0x1e')]=_0x5ceb57['custom_action_data'];}}logger[_0x6f99('0x1f')](JSON[_0x6f99('0x20')](_0x5d8b7f));return rp(_0x5d8b7f);});}; \ No newline at end of file +var _0x00b3=['message','Nda','uniqueid','callerid','dnid','extension','text','access_token','project','body','channelData','ProjectName','ndagenerate_audio','CustomAction','custom_action','CustomActionData','custom_action_data','info','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x341b1c,_0x269c47){var _0x3f4221=function(_0x282767){while(--_0x282767){_0x341b1c['push'](_0x341b1c['shift']());}};_0x3f4221(++_0x269c47);}(_0x00b3,0x17a));var _0x300b=function(_0x2e64b3,_0x8b4e27){_0x2e64b3=_0x2e64b3-0x0;var _0x28e43b=_0x00b3[_0x2e64b3];return _0x28e43b;};'use strict';var rp=require('request-promise');var url=require(_0x300b('0x0'));var logger=require(_0x300b('0x1'))(_0x300b('0x2'));module[_0x300b('0x3')]=function(_0x59cc42,_0x2fbccc){var _0x534310={'method':_0x300b('0x4'),'uri':url['resolve'](_0x2fbccc[_0x300b('0x5')],_0x300b('0x6')),'form':{'grant_type':_0x300b('0x7'),'username':_0x2fbccc[_0x300b('0x8')],'password':_0x2fbccc['password']},'json':!![]};return rp(_0x534310)['then'](function(_0x30b3fe){var _0x590c4d={'method':'POST','uri':url[_0x300b('0x9')](_0x2fbccc[_0x300b('0xa')],_0x300b('0xb')),'body':{'type':_0x2fbccc['ndaactivity_type']||_0x300b('0xc'),'channelId':_0x300b('0xd'),'conversation':{'id':_0x59cc42[_0x300b('0xe')]},'from':{'id':_0x59cc42[_0x300b('0xf')],'name':_0x59cc42['calleridname']},'recipient':{'id':_0x59cc42[_0x300b('0x10')],'name':_0x59cc42[_0x300b('0x11')]},'text':_0x2fbccc[_0x300b('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x30b3fe[_0x300b('0x13')]},'json':!![]};if(_0x2fbccc[_0x300b('0x14')]){_0x590c4d[_0x300b('0x15')][_0x300b('0x16')][_0x300b('0x17')]=_0x2fbccc[_0x300b('0x14')];}if(_0x2fbccc[_0x300b('0x18')]=='1'){_0x590c4d[_0x300b('0x15')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2fbccc['custom_action']){_0x590c4d[_0x300b('0x15')][_0x300b('0x16')][_0x300b('0x19')]=_0x2fbccc[_0x300b('0x1a')];if(_0x2fbccc['custom_action_data']){_0x590c4d['body'][_0x300b('0x16')][_0x300b('0x1b')]=_0x2fbccc[_0x300b('0x1c')];}}logger[_0x300b('0x1d')](JSON['stringify'](_0x590c4d));return rp(_0x590c4d);});}; \ 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 24d7590..081a822 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 _0x7e4d=['exports','./lib/api'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0x7e4d,0xab));var _0xd7e4=function(_0x52e751,_0x1334f6){_0x52e751=_0x52e751-0x0;var _0x428b75=_0x7e4d[_0x52e751];return _0x428b75;};'use strict';var asr=require(_0xd7e4('0x0'));module[_0xd7e4('0x1')]=function(_0x57db33,_0x39603e,_0x30a55a,_0x39ab75){return asr(_0x57db33,_0x39603e,_0x30a55a,_0x39ab75);}; \ No newline at end of file +var _0x6a55=['exports','./lib/api'];(function(_0x120096,_0x593804){var _0x51d60e=function(_0x1d66b0){while(--_0x1d66b0){_0x120096['push'](_0x120096['shift']());}};_0x51d60e(++_0x593804);}(_0x6a55,0xb3));var _0x56a5=function(_0x55a76a,_0x2d0203){_0x55a76a=_0x55a76a-0x0;var _0x45885a=_0x6a55[_0x55a76a];return _0x45885a;};'use strict';var asr=require(_0x56a5('0x0'));module[_0x56a5('0x1')]=function(_0x3cba31,_0x170821,_0x1c0872,_0x4b6737){return asr(_0x3cba31,_0x170821,_0x1c0872,_0x4b6737);}; \ 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 305fc91..b1a6183 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 _0xe166=['unix','stringify','createReadStream','close','send','EOS','Tilde\x20ASR\x20send\x20error','parse','result','final','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.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x3a39f9,_0x1e9da8){var _0x305044=function(_0x50fcbf){while(--_0x50fcbf){_0x3a39f9['push'](_0x3a39f9['shift']());}};_0x305044(++_0x1e9da8);}(_0xe166,0x19f));var _0x6e16=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xe166[_0xefd519];return _0x4bb882;};'use strict';var BPromise=require(_0x6e16('0x0'));var _=require(_0x6e16('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6e16('0x2'));var crypto=require(_0x6e16('0x3'));var logger=require('../../../../../../config/logger')('agi');module[_0x6e16('0x4')]=function(_0x4dc6dc,_0x4b90c8,_0x5db5bd,_0x2e6596){return new BPromise(function(_0x3337e2,_0x9dc40d){logger[_0x6e16('0x5')](_0x6e16('0x6'),_0x2e6596||_0x6e16('0x7'));var _0x584b4b=new WebSocket(_0x2e6596||_0x6e16('0x7'),{'perMessageDeflate':![]});var _0x22448a='';var _0x2abb3a='0';var _0x223156='1';var _0x5393b6=_0x6e16('0x8');function _0x48b7d9(_0x44ef42){var _0x291bd9=crypto[_0x6e16('0x9')]('sha1');_0x291bd9[_0x6e16('0xa')](_0x44ef42);return _0x291bd9[_0x6e16('0xb')](_0x6e16('0xc'));}function _0x2a877a(){try{logger['info'](_0x6e16('0xd'));var _0x519c26=moment()[_0x6e16('0xe')]();var _0x4ecab7=_0x48b7d9(_0x519c26+_0x4b90c8+_0x5db5bd);_0x584b4b['send'](JSON[_0x6e16('0xf')]({'appID':_0x4b90c8,'timestamp':_0x519c26,'appKey':_0x4ecab7}));var _0x48d766=fs[_0x6e16('0x10')](_0x4dc6dc);_0x48d766['on']('data',function(_0x3cff79){_0x584b4b['send'](_0x3cff79);});_0x48d766['on'](_0x6e16('0x11'),function(){_0x584b4b[_0x6e16('0x12')](_0x6e16('0x13'));});}catch(_0x55377a){logger['error'](_0x6e16('0x14'),JSON[_0x6e16('0xf')](_0x55377a));_0x584b4b['terminate']();}}function _0x402317(_0x112cb3){try{if(_0x112cb3){var _0x1b8d6f=JSON[_0x6e16('0x15')](_0x112cb3);switch(_0x1b8d6f['status']){case 0x0:if(_0x1b8d6f[_0x6e16('0x16')]){if(_0x1b8d6f[_0x6e16('0x16')][_0x6e16('0x17')]){logger[_0x6e16('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x6e16('0xf')](_0x1b8d6f[_0x6e16('0x16')][_0x6e16('0x18')]));_0x22448a=_0x1b8d6f['result']['hypotheses'][0x0][_0x6e16('0x19')];_0x2abb3a=_0x1b8d6f[_0x6e16('0x16')]['hypotheses'][0x0][_0x6e16('0x1a')];_0x223156='0';_0x5393b6=_0x6e16('0x1b');_0x584b4b['terminate']();}}break;case 0x1:logger['info'](_0x6e16('0x8'));_0x223156='1';_0x5393b6=_0x6e16('0x8');break;case 0x2:logger[_0x6e16('0x5')](_0x6e16('0x1c'));_0x223156='2';_0x5393b6=_0x6e16('0x1c');break;case 0x9:logger['info'](_0x6e16('0x1d'));_0x223156='9';_0x5393b6=_0x6e16('0x1d');break;case 0xa:logger[_0x6e16('0x5')](_0x6e16('0x1e'));_0x223156='10';_0x5393b6=_0x6e16('0x1e');break;case 0xb:logger['info'](_0x6e16('0x1f'));_0x223156='11';_0x5393b6='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x3c672c){logger[_0x6e16('0x20')](_0x6e16('0x21'),JSON[_0x6e16('0xf')](_0x3c672c));_0x584b4b['terminate']();}}function _0x400e8f(){logger[_0x6e16('0x5')](_0x6e16('0x22'));_0x3337e2({'transcript':_0x22448a,'confidence':_0x2abb3a,'status':_0x223156,'status_message':_0x5393b6});}function _0x14d471(_0x1c6c39){logger[_0x6e16('0x20')](_0x6e16('0x23'));if(!_['isNil'](_0x1c6c39)){logger['error'](_[_0x6e16('0x24')](_0x1c6c39)?JSON[_0x6e16('0xf')](_0x1c6c39):_0x1c6c39);}}_0x584b4b['on'](_0x6e16('0x25'),_0x2a877a);_0x584b4b['on'](_0x6e16('0x26'),_0x402317);_0x584b4b['on'](_0x6e16('0x11'),_0x400e8f);_0x584b4b['on']('error',_0x14d471);});}; \ No newline at end of file +var _0xb177=['createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','moment','crypto','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x432bee,_0x6641ad){var _0x40bd5a=function(_0x70dfad){while(--_0x70dfad){_0x432bee['push'](_0x432bee['shift']());}};_0x40bd5a(++_0x6641ad);}(_0xb177,0xac));var _0x7b17=function(_0x41dc39,_0x165079){_0x41dc39=_0x41dc39-0x0;var _0x213c81=_0xb177[_0x41dc39];return _0x213c81;};'use strict';var BPromise=require(_0x7b17('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7b17('0x1'));var crypto=require(_0x7b17('0x2'));var logger=require(_0x7b17('0x3'))(_0x7b17('0x4'));module['exports']=function(_0x4926fe,_0x1228db,_0x1dd247,_0x39bdb5){return new BPromise(function(_0x468658,_0x47cc96){logger[_0x7b17('0x5')]('Tilde\x20URI',_0x39bdb5||_0x7b17('0x6'));var _0x1a92de=new WebSocket(_0x39bdb5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x46a15e='';var _0xd31fd6='0';var _0x1d88d4='1';var _0x1dc391=_0x7b17('0x7');function _0x5335cb(_0xc02530){var _0x35e5ac=crypto['createHash'](_0x7b17('0x8'));_0x35e5ac[_0x7b17('0x9')](_0xc02530);return _0x35e5ac['digest']('hex');}function _0x493e18(){try{logger['info'](_0x7b17('0xa'));var _0xd2f6aa=moment()[_0x7b17('0xb')]();var _0x3a0063=_0x5335cb(_0xd2f6aa+_0x1228db+_0x1dd247);_0x1a92de[_0x7b17('0xc')](JSON['stringify']({'appID':_0x1228db,'timestamp':_0xd2f6aa,'appKey':_0x3a0063}));var _0x139b8a=fs[_0x7b17('0xd')](_0x4926fe);_0x139b8a['on'](_0x7b17('0xe'),function(_0x1e5eaf){_0x1a92de[_0x7b17('0xc')](_0x1e5eaf);});_0x139b8a['on'](_0x7b17('0xf'),function(){_0x1a92de['send'](_0x7b17('0x10'));});}catch(_0x270659){logger[_0x7b17('0x11')](_0x7b17('0x12'),JSON[_0x7b17('0x13')](_0x270659));_0x1a92de[_0x7b17('0x14')]();}}function _0x1b44c6(_0x10a457){try{if(_0x10a457){var _0x52fe8c=JSON[_0x7b17('0x15')](_0x10a457);switch(_0x52fe8c[_0x7b17('0x16')]){case 0x0:if(_0x52fe8c[_0x7b17('0x17')]){if(_0x52fe8c[_0x7b17('0x17')]['final']){logger[_0x7b17('0x5')](_0x7b17('0x18'),JSON['stringify'](_0x52fe8c['result'][_0x7b17('0x19')]));_0x46a15e=_0x52fe8c[_0x7b17('0x17')][_0x7b17('0x19')][0x0]['transcript'];_0xd31fd6=_0x52fe8c[_0x7b17('0x17')][_0x7b17('0x19')][0x0]['likelihood'];_0x1d88d4='0';_0x1dc391=_0x7b17('0x1a');_0x1a92de[_0x7b17('0x14')]();}}break;case 0x1:logger[_0x7b17('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1d88d4='1';_0x1dc391=_0x7b17('0x7');break;case 0x2:logger[_0x7b17('0x5')](_0x7b17('0x1b'));_0x1d88d4='2';_0x1dc391=_0x7b17('0x1b');break;case 0x9:logger[_0x7b17('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x1d88d4='9';_0x1dc391=_0x7b17('0x1c');break;case 0xa:logger[_0x7b17('0x5')]('Authentication\x20failed.');_0x1d88d4='10';_0x1dc391=_0x7b17('0x1d');break;case 0xb:logger[_0x7b17('0x5')](_0x7b17('0x1e'));_0x1d88d4='11';_0x1dc391=_0x7b17('0x1e');}}}catch(_0x15b186){logger[_0x7b17('0x11')](_0x7b17('0x1f'),JSON[_0x7b17('0x13')](_0x15b186));_0x1a92de[_0x7b17('0x14')]();}}function _0x3877fa(){logger[_0x7b17('0x5')](_0x7b17('0x20'));_0x468658({'transcript':_0x46a15e,'confidence':_0xd31fd6,'status':_0x1d88d4,'status_message':_0x1dc391});}function _0x595374(_0x16764d){logger[_0x7b17('0x11')](_0x7b17('0x21'));if(!_[_0x7b17('0x22')](_0x16764d)){logger['error'](_[_0x7b17('0x23')](_0x16764d)?JSON[_0x7b17('0x13')](_0x16764d):_0x16764d);}}_0x1a92de['on']('open',_0x493e18);_0x1a92de['on'](_0x7b17('0x24'),_0x1b44c6);_0x1a92de['on']('close',_0x3877fa);_0x1a92de['on'](_0x7b17('0x11'),_0x595374);});}; \ 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 e811747..a3066f6 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 _0xe041=['exports'];(function(_0x12a612,_0x2a147e){var _0x20eea8=function(_0x1745b3){while(--_0x1745b3){_0x12a612['push'](_0x12a612['shift']());}};_0x20eea8(++_0x2a147e);}(_0xe041,0x137));var _0x1e04=function(_0x101158,_0x49e3c6){_0x101158=_0x101158-0x0;var _0x3842e2=_0xe041[_0x101158];return _0x3842e2;};var asr=require('./asr');module[_0x1e04('0x0')]={'asr':asr}; \ No newline at end of file +var _0x63f8=['./asr','exports'];(function(_0x12375a,_0x4d208e){var _0x199fe8=function(_0x1e87ef){while(--_0x1e87ef){_0x12375a['push'](_0x12375a['shift']());}};_0x199fe8(++_0x4d208e);}(_0x63f8,0x128));var _0x863f=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x63f8[_0x2cfb58];return _0xd99951;};var asr=require(_0x863f('0x0'));module[_0x863f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 935aeb3..c3983e2 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(_0x28c6fe,_0x395159){var _0x523a43=function(_0x738af0){while(--_0x738af0){_0x28c6fe['push'](_0x28c6fe['shift']());}};_0x523a43(++_0x395159);}(_0x34e8,0x12c));var _0x834e=function(_0xe8d73,_0x199c95){_0xe8d73=_0xe8d73-0x0;var _0x4cc0ce=_0x34e8[_0xe8d73];return _0x4cc0ce;};'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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index ff8738e..561dc8e 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 _0xde64=['file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','rawBody','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','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','length','saveRestApiResult','%s.%s','recursiveNodeIndex','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','grammar','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','Sestek\x20NDA\x20%s\x20file\x20created','unlink','audiofile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','goal','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','awslex','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','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','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','calleridname','context','extension','priority','accountcode','dnid'];(function(_0x1da305,_0x42c723){var _0x14a523=function(_0x3daae9){while(--_0x3daae9){_0x1da305['push'](_0x1da305['shift']());}};_0x14a523(++_0x42c723);}(_0xde64,0x17c));var _0x4de6=function(_0x537365,_0x1d7f56){_0x537365=_0x537365-0x0;var _0x7ec1b4=_0xde64[_0x537365];return _0x7ec1b4;};'use strict';var fs=require('fs');var util=require(_0x4de6('0x0'));var _=require(_0x4de6('0x1'));var sh=require(_0x4de6('0x2'));var odbc=require(_0x4de6('0x3'))();var rs=require(_0x4de6('0x4'));var moment=require(_0x4de6('0x5'));var Mustache=require('mustache');var rp=require(_0x4de6('0x6'));var logger=require(_0x4de6('0x7'))('agi');var config=require('../../config/environment');var scripts=require(_0x4de6('0x8'));var FILES_PATH=_0x4de6('0x9');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x4de6('0xa'),_0x4de6('0xb'),_0x4de6('0xc')];var AGIVertices=function(_0x248e39,_0x34f7a4,_0x202cdc){this['channel']=_0x248e39;this[_0x4de6('0xd')]=_0x34f7a4;this[_0x4de6('0xe')]=_0x202cdc;};AGIVertices[_0x4de6('0xf')]['getVariable']=function(_0x1cefc6,_0x170183){this[_0x4de6('0xd')][_0x4de6('0x10')](_0x1cefc6)[_0x4de6('0x11')](function(_0x4d4236){_0x170183(null,_0x4d4236?_0x4d4236[_0x4de6('0x12')]:![]);})[_0x4de6('0x13')](function(_0xb8e256){_0x170183(_0xb8e256);});};AGIVertices['prototype'][_0x4de6('0x14')]=function(_0x216a84,_0x27c108){this[_0x4de6('0xd')]['getVoiceQueueById'](_0x216a84)[_0x4de6('0x11')](function(_0x28f985){_0x27c108(null,_0x28f985?_0x28f985[_0x4de6('0x12')]:![]);})['catch'](function(_0x33fd67){_0x27c108(_0x33fd67);});};AGIVertices['prototype']['getSquareProject']=function(_0x30b3b8,_0x3ef217){this[_0x4de6('0xd')][_0x4de6('0x15')](_0x30b3b8)[_0x4de6('0x11')](function(_0x279278){_0x3ef217(null,_0x279278?_0x279278[_0x4de6('0x12')]:![]);})['catch'](function(_0x420f7c){_0x3ef217(_0x420f7c);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x16')]=function(_0x23294d,_0x167c7c){this[_0x4de6('0xd')][_0x4de6('0x17')](_0x23294d)[_0x4de6('0x11')](function(_0x1b935f){_0x167c7c(null,_0x1b935f?_0x1b935f[_0x4de6('0x18')]:![]);})['catch'](function(_0x3db97d){_0x167c7c(_0x3db97d);});};AGIVertices['prototype'][_0x4de6('0x19')]=function(_0x7af040,_0x43771b){this['rpc'][_0x4de6('0x1a')](_0x7af040)['then'](function(_0x195ec2){_0x43771b(null,_0x195ec2?_0x195ec2[_0x4de6('0x12')]:![]);})[_0x4de6('0x13')](function(_0x5ddbab){_0x43771b(_0x5ddbab);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x1b')]=function(_0x2191db,_0x3be904){this[_0x4de6('0xd')][_0x4de6('0x1c')](_0x2191db)[_0x4de6('0x11')](function(_0x5cbecd){_0x3be904(null,_0x5cbecd?_0x5cbecd[_0x4de6('0x12')]:![]);})[_0x4de6('0x13')](function(_0x426a15){_0x3be904(_0x426a15);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x1d')]=function(_0x281060,_0xa2b88c){var _0x7bc61e=this;this[_0x4de6('0xd')]['getSoundById'](_0x281060)[_0x4de6('0x11')](function(_0x2a5592){_0xa2b88c(null,_0x2a5592?_0x7bc61e[_0x4de6('0x1e')](_0x2a5592[_0x4de6('0x1f')]):![]);})[_0x4de6('0x13')](function(_0x51717c){_0xa2b88c(_0x51717c);});};AGIVertices[_0x4de6('0xf')]['getMailAccount']=function(_0x9ea4e1,_0x2bfc77){this[_0x4de6('0xd')][_0x4de6('0x20')](_0x9ea4e1)['then'](function(_0x5593e8){_0x2bfc77(null,_0x5593e8?_0x5593e8:![]);})['catch'](function(_0x55276b){_0x2bfc77(_0x55276b);});};AGIVertices['prototype'][_0x4de6('0x21')]=function(_0x1da3b1,_0x4a5274,_0x3638f1){this[_0x4de6('0xe')][_0x4de6('0x21')](_0x1da3b1,_0x4a5274)[_0x4de6('0x11')](function(){_0x3638f1(null);})[_0x4de6('0x13')](function(_0x175ee9){_0x3638f1(_0x175ee9);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x22')]=function(_0x331378,_0xcf091f){this[_0x4de6('0xd')][_0x4de6('0x23')](_0x331378)[_0x4de6('0x11')](function(_0x182400){if(_0x182400){if(_0x182400[_0x4de6('0x24')]){_0xcf091f(null,[_0x182400[_0x4de6('0x25')]]);}else{_0xcf091f(null,_[_0x4de6('0x26')](_0x182400[_0x4de6('0x27')],_0x4de6('0x25')));}}else{_0xcf091f(null,![]);}})[_0x4de6('0x13')](function(_0x2631c9){_0xcf091f(_0x2631c9);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x1e')]=function(_0x3bb5ac){return util[_0x4de6('0x28')](_0x4de6('0x29'),FILES_PATH,_0x3bb5ac);};AGIVertices['prototype'][_0x4de6('0x2a')]=function(_0x11a83d,_0x1217d7,_0x3bf31f){odbc['open'](_0x11a83d,function(_0x26f1f2){if(_0x26f1f2){logger[_0x4de6('0x2b')](_0x4de6('0x2c'),_0x26f1f2);_0x3bf31f(_0x26f1f2);}else{logger[_0x4de6('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x4de6('0x2e')](_0x1217d7,function(_0x519d1e,_0x3535a6){if(_0x519d1e){logger[_0x4de6('0x2d')](_0x4de6('0x2f'),_0x1217d7);_0x3bf31f(_0x519d1e);}else{logger[_0x4de6('0x2d')](_0x4de6('0x30'),_0x1217d7);odbc[_0x4de6('0x31')](function(_0x2bdd41){if(_0x2bdd41){logger[_0x4de6('0x2b')](_0x4de6('0x32'),_0x2bdd41);}_0x3bf31f(null,_0x3535a6);});}});}});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x33')]=function(_0x1f0262,_0x551440){this['rpc'][_0x4de6('0x34')](_0x1f0262)[_0x4de6('0x11')](function(_0x114971){_0x551440(null,_0x114971?_0x114971:![]);})[_0x4de6('0x13')](function(_0x4fce0d){_0x551440(_0x4fce0d);});};AGIVertices['prototype'][_0x4de6('0x35')]=function(_0x5cc733,_0x22fe9c){this['rpc'][_0x4de6('0x35')](_0x5cc733)['then'](function(_0x162a73){_0x22fe9c(null,_0x162a73);})[_0x4de6('0x13')](function(_0x2ef030){_0x22fe9c(_0x2ef030);});};AGIVertices[_0x4de6('0xf')]['createSquareDetailsReport']=function(_0x4cb97b,_0x4049ed,_0x4ea54b){this['rpc'][_0x4de6('0x36')]({'uniqueid':this['channel'][_0x4de6('0x37')],'node':_0x4cb97b[_0x4de6('0x38')],'application':_0x4cb97b[_0x4de6('0x39')],'data':_0x4049ed||null,'project_name':this[_0x4de6('0x3a')][_0x4de6('0x3b')],'callerid':this[_0x4de6('0x3a')][_0x4de6('0x3c')]})[_0x4de6('0x11')](function(_0xd8b73a){if(_0x4ea54b){_0x4ea54b(null,_0xd8b73a);}})[_0x4de6('0x13')](function(_0x2cb079){if(_0x4ea54b){_0x4ea54b(_0x2cb079);}});};AGIVertices[_0x4de6('0xf')]['createSquareRecording']=function(_0x4ca848,_0x584014,_0x170a74,_0x4dd834){this['rpc']['createSquareRecording']({'uniqueid':this[_0x4de6('0x3a')]['uniqueid'],'callerid':this[_0x4de6('0x3a')][_0x4de6('0x3c')],'calleridname':this['channel'][_0x4de6('0x3d')],'context':this[_0x4de6('0x3a')][_0x4de6('0x3e')],'extension':this[_0x4de6('0x3a')][_0x4de6('0x3f')],'priority':this['channel'][_0x4de6('0x40')],'accountcode':this[_0x4de6('0x3a')][_0x4de6('0x41')],'dnid':this[_0x4de6('0x3a')][_0x4de6('0x42')],'projectName':this[_0x4de6('0x3a')][_0x4de6('0x3b')],'saveName':_0x584014,'filename':_0x4ca848[_0x4de6('0x43')]||_0x584014,'savePath':_0x170a74})[_0x4de6('0x11')](function(_0x3126f1){_0x4dd834(null,_0x3126f1);})[_0x4de6('0x13')](function(_0x35df53){_0x4dd834(_0x35df53);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x44')]=function(_0x354558,_0x12ce25,_0x171171,_0x48044e,_0x5eab19){this[_0x4de6('0xd')][_0x4de6('0x44')]({'uniqueid':this['channel'][_0x4de6('0x37')],'body':_0x354558,'direction':_0x12ce25,'providerName':_0x171171,'providerResponse':_0x48044e})[_0x4de6('0x11')](function(_0x1ff273){if(_0x5eab19){_0x5eab19(null,_0x1ff273);}})[_0x4de6('0x13')](function(_0x151468){if(_0x5eab19){_0x5eab19(_0x151468);}});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x45')]=function(_0x502e4d,_0x29dcca){this['rpc'][_0x4de6('0x45')]({'firstName':_[_0x4de6('0x46')](_0x502e4d[_0x4de6('0x12')])||_[_0x4de6('0x47')](_0x502e4d[_0x4de6('0x12')])?_0x4de6('0x48')+Math[_0x4de6('0x49')]():_0x502e4d[_0x4de6('0x12')],'lastName':_['isEmpty'](_0x502e4d['lastName'])||_[_0x4de6('0x47')](_0x502e4d[_0x4de6('0x4a')])?null:_0x502e4d[_0x4de6('0x4a')],'phone':_0x502e4d[_0x4de6('0x4b')],'ListId':_0x502e4d['list_id'],'scheduledat':_0x502e4d[_0x4de6('0x4c')],'callbackUniqueid':this[_0x4de6('0x3a')][_0x4de6('0x37')],'tags':'callback','description':_0x4de6('0x4d')+_0x502e4d['scheduledAt'][_0x4de6('0x4e')](),'priority':_0x502e4d[_0x4de6('0x4f')]})['then'](function(_0x19f34a){_0x29dcca(null,_0x19f34a);})[_0x4de6('0x13')](function(_0x5bcd23){_0x29dcca(_0x5bcd23);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x50')]=function(_0x1175a4,_0x377127){this[_0x4de6('0xd')][_0x4de6('0x51')](_0x1175a4)[_0x4de6('0x11')](function(_0x14d6f6){_0x377127(null,_0x14d6f6?_0x14d6f6[_0x4de6('0x12')]:![]);})[_0x4de6('0x13')](function(_0x4766b4){_0x377127(_0x4766b4);});};AGIVertices['prototype'][_0x4de6('0x52')]=function(_0x225bde,_0x4207fe,_0x47a0ea){var _0x25ac8e={'role':_0x4de6('0x53')};_0x25ac8e[_0x225bde]=this['channel'][_0x4de6('0x3c')];this[_0x4de6('0xd')][_0x4de6('0x52')](_0x25ac8e,_0x4207fe,this[_0x4de6('0x3a')]['uniqueid'])[_0x4de6('0x11')](function(_0x1ebfe3){_0x47a0ea(null,_[_0x4de6('0x47')](_0x1ebfe3)?![]:!![]);})['catch'](function(_0x121f4b){logger[_0x4de6('0x2b')](_0x121f4b);_0x47a0ea(null,![]);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x54')]=function(_0x1e4dc2,_0x358faa){var _0x266950={'role':_0x4de6('0x53')};_0x266950[_0x1e4dc2]=this[_0x4de6('0x3a')][_0x4de6('0x3c')];this[_0x4de6('0xd')][_0x4de6('0x54')](_0x266950)[_0x4de6('0x11')](function(_0x320dc4){_0x358faa(null,_['isNil'](_0x320dc4)?![]:!![]);})[_0x4de6('0x13')](function(_0x143e95){logger['error'](_0x143e95);_0x358faa(null,![]);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x55')]=function(_0x545781,_0x47a96c){var _0x5b4fe9={'role':'agent'};_0x5b4fe9[_0x545781]=this[_0x4de6('0x3a')][_0x4de6('0x3c')];this[_0x4de6('0xd')][_0x4de6('0x55')](_0x5b4fe9)[_0x4de6('0x11')](function(_0x2841ca){_0x47a96c(null,_[_0x4de6('0x47')](_0x2841ca)?![]:!![]);})[_0x4de6('0x13')](function(_0x40a182){logger['error'](_0x40a182);_0x47a96c(null,![]);});};AGIVertices['prototype'][_0x4de6('0x56')]=function(_0x20fbfb,_0x4ea5de){var _0x1dbc7c={'role':_0x4de6('0x53')};_0x1dbc7c[_0x20fbfb]=this[_0x4de6('0x3a')][_0x4de6('0x3c')];var _0x1e9b53=_0x20fbfb!=_0x4de6('0x57')?util[_0x4de6('0x28')](_0x4de6('0x58'),'LOCAL',this[_0x4de6('0x3a')][_0x4de6('0x3c')]):undefined;this['rpc']['agentLogin'](_0x1dbc7c,_0x1e9b53)[_0x4de6('0x11')](function(_0x18f93d){_0x4ea5de(null,_[_0x4de6('0x47')](_0x18f93d)?![]:!![]);})[_0x4de6('0x13')](function(_0x52ebd1){logger[_0x4de6('0x2b')](_0x52ebd1);_0x4ea5de(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0xb11740,_0x5ddf2e){sh['exec'](_[_0x4de6('0x59')](_0xb11740),function(_0x228241,_0x52750d){var _0x1d7bb6=_0x52750d[_0x4de6('0x5a')](/(\r\n|\n|\r)/gm,'');_0x5ddf2e(null,_0x1d7bb6);});};AGIVertices[_0x4de6('0xf')]['googleCloudTTS']=function(_0x4c87c5,_0x4d64d0){scripts[_0x4de6('0x5b')](_0x4c87c5[_0x4de6('0x5c')],_0x4c87c5[_0x4de6('0x5d')]||_0x4de6('0x5e'),_0x4c87c5[_0x4de6('0x5e')],_0x4c87c5[_0x4de6('0x5f')]||'en-US',_0x4c87c5[_0x4de6('0x60')]||_0x4de6('0x61'),_0x4c87c5['audioEncoding']||'MP3')[_0x4de6('0x11')](function(_0x1cb56b){_0x4d64d0(null,_0x1cb56b);})['catch'](function(_0xb98385){_0x4d64d0(_0xb98385);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x62')]=function(_0x437087,_0x509a3b){scripts[_0x4de6('0x62')](_0x437087[_0x4de6('0x5e')],_0x437087['google_tts_language']||'en',0x1)[_0x4de6('0x11')](function(_0x2934f7){_0x509a3b(null,_0x2934f7);})[_0x4de6('0x13')](function(_0x1763fd){_0x509a3b(_0x1763fd);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x63')]=function(_0xeaf72e,_0x5f3afe){var _0x318caa={'uri':_0xeaf72e[_0x4de6('0x64')],'method':_0xeaf72e[_0x4de6('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xeaf72e[_0x4de6('0x66')])===_0x4de6('0x67')&&parseInt(_0xeaf72e[_0x4de6('0x66')])>=0x1?parseInt(_0xeaf72e['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x4de6('0x68')]([_0x4de6('0x69'),_0x4de6('0x6a')],_0x318caa[_0x4de6('0x65')][_0x4de6('0x6b')]())){try{_0x318caa[_0x4de6('0x6c')]=_0xeaf72e[_0x4de6('0x6d')]?JSON[_0x4de6('0x6e')](_0xeaf72e[_0x4de6('0x6d')]):{};}catch(_0x3dd55f){logger[_0x4de6('0x2b')](_0x4de6('0x6f'),_0x3dd55f);}}try{_0x318caa[_0x4de6('0x70')]=_0xeaf72e[_0x4de6('0x71')]?JSON[_0x4de6('0x6e')](_0xeaf72e[_0x4de6('0x71')]):{};}catch(_0x2391a0){logger['error'](_0x4de6('0x72'),_0x2391a0);}if(_0xeaf72e[_0x4de6('0x73')]){try{var _0x143622=require(_0xeaf72e[_0x4de6('0x73')])['sync'](this,_0x318caa);_0x318caa[_0x4de6('0x74')]=Mustache['render'](_0xeaf72e[_0x4de6('0x64')],_0x143622,{},['$$','$$']);if(_0x318caa[_0x4de6('0x70')]){_0x318caa[_0x4de6('0x70')]=JSON[_0x4de6('0x6e')](Mustache[_0x4de6('0x75')](JSON['stringify'](_0x318caa[_0x4de6('0x70')]),_0x143622,{},['$$','$$']));}if(_0x318caa['body']){_0x318caa[_0x4de6('0x6c')]=JSON[_0x4de6('0x6e')](Mustache['render'](JSON[_0x4de6('0x76')](_0x318caa['body']),_0x143622,{},['$$','$$']));}}catch(_0x4d0cde){logger['error'](_0x4de6('0x77'),_0x4d0cde);}}rp(_0x318caa)[_0x4de6('0x11')](function(_0x2a9a36){var _0x2965ce={'statusCode':_0x2a9a36[_0x4de6('0x78')]||0xc8,'statusMessage':_0x2a9a36[_0x4de6('0x79')]||'OK','headers':_0x2a9a36[_0x4de6('0x70')]||{},'body':_0x2a9a36[_0x4de6('0x6c')]||{}};_0x5f3afe(null,_0x2965ce);})['catch'](function(_0x424bb9){var _0x3721c0={'statusCode':_0x424bb9[_0x4de6('0x78')]||0x1f4,'statusMessage':_0x424bb9[_0x4de6('0x7a')]||_0x4de6('0x7b'),'headers':_0x424bb9[_0x4de6('0x7c')][_0x4de6('0x70')]||{},'body':_0x424bb9[_0x4de6('0x7c')][_0x4de6('0x6c')]||{}};_0x5f3afe(null,_0x3721c0);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x7d')]=function(_0x1582be,_0x4cfe36){scripts['googleDialogflow'](this[_0x4de6('0x3a')][_0x4de6('0x37')],_0x1582be[_0x4de6('0x7e')],_0x1582be[_0x4de6('0x5e')],_0x1582be[_0x4de6('0x7f')]||'en')[_0x4de6('0x11')](function(_0x3794e3){_0x4cfe36(null,_0x3794e3);})['catch'](function(_0x49dda7){_0x4cfe36(_0x49dda7);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x80')]=function(_0x427a2b,_0x556bd4){scripts[_0x4de6('0x80')](this[_0x4de6('0x3a')][_0x4de6('0x37')],_0x427a2b[_0x4de6('0x81')],_0x427a2b[_0x4de6('0x82')],_0x427a2b[_0x4de6('0x83')],_0x427a2b[_0x4de6('0x5e')],_0x427a2b['dialogflowV2_language']||'en')[_0x4de6('0x11')](function(_0x316709){_0x556bd4(null,_0x316709);})['catch'](function(_0x33754a){_0x556bd4(_0x33754a);});};AGIVertices[_0x4de6('0xf')]['sestekNDA']=function(_0x3598f3,_0x581eac){scripts[_0x4de6('0x84')](this['channel'],_0x3598f3)[_0x4de6('0x11')](function(_0x4811a0){_0x581eac(null,_0x4811a0);})[_0x4de6('0x13')](function(_0x396cfa){_0x581eac(_0x396cfa);});};AGIVertices['prototype'][_0x4de6('0x85')]=function(_0x3da629,_0x4df255){scripts[_0x4de6('0x85')](_0x3da629[_0x4de6('0x7e')],_0x3da629[_0x4de6('0x5e')],_0x3da629[_0x4de6('0x86')]||_0x4de6('0x87'),_0x3da629['speed'])['then'](function(_0x3894a3){_0x4df255(null,_0x3894a3);})['catch'](function(_0x1bf59a){_0x4df255(_0x1bf59a);});};AGIVertices['prototype'][_0x4de6('0x88')]=function(_0x30a96c,_0xefa87,_0x4d27aa){scripts['ispeechASR'](_0xefa87,_0x30a96c[_0x4de6('0x7e')],_0x30a96c[_0x4de6('0x89')]||_0x4de6('0x87'),this[_0x4de6('0x8a')](_0x30a96c[_0x4de6('0x8b')])?_0x30a96c[_0x4de6('0x8b')]:undefined)[_0x4de6('0x11')](function(_0x449db3){_0x4d27aa(null,_0x449db3);})[_0x4de6('0x13')](function(_0xfd785b){_0x4d27aa(_0xfd785b);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x8c')]=function(_0x5d5212,_0x32401c){scripts[_0x4de6('0x8c')](_0x5d5212['aws_access_key_id'],_0x5d5212['aws_secret_access_key'],_0x5d5212[_0x4de6('0x8d')],_0x5d5212[_0x4de6('0x8e')]||'Amy',_0x5d5212[_0x4de6('0x5e')],_0x5d5212[_0x4de6('0x8f')]||_0x4de6('0x5e'))[_0x4de6('0x11')](function(_0x15699c){_0x32401c(null,_0x15699c);})[_0x4de6('0x13')](function(_0x15b1c3){_0x32401c(_0x15b1c3);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x90')]=function(_0x53fb78,_0x75645f){scripts[_0x4de6('0x90')](this['channel'][_0x4de6('0x37')],_0x53fb78[_0x4de6('0x91')],_0x53fb78['aws_secret_access_key'],_0x53fb78['aws_lex_region'],_0x53fb78[_0x4de6('0x5e')],_0x53fb78[_0x4de6('0x92')])[_0x4de6('0x11')](function(_0x37b025){_0x75645f(null,_0x37b025);})[_0x4de6('0x13')](function(_0x1b1fca){_0x75645f(_0x1b1fca);});};AGIVertices[_0x4de6('0xf')]['googleASR']=function(_0x4adf37,_0x19170a,_0xeda383){scripts[_0x4de6('0x93')](_0x19170a,_0x4adf37[_0x4de6('0x7e')],_0x4adf37[_0x4de6('0x94')]||_0x4de6('0x87'))[_0x4de6('0x11')](function(_0xe3affd){_0xeda383(null,_0xe3affd);})[_0x4de6('0x13')](function(_0x32bef6){_0xeda383(_0x32bef6);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x95')]=function(_0x21235c,_0x24307d,_0x502182){scripts[_0x4de6('0x95')](_0x24307d,_0x21235c[_0x4de6('0x96')],_0x21235c[_0x4de6('0x97')],_0x21235c[_0x4de6('0x74')])[_0x4de6('0x11')](function(_0x459b33){_0x502182(null,_0x459b33);})['catch'](function(_0x18f760){_0x502182(_0x18f760);});};AGIVertices[_0x4de6('0xf')][_0x4de6('0x98')]=function(_0x483ee7){var _0x3329cb=_[_0x4de6('0x68')](verticesWithRetry,_0x483ee7[_0x4de6('0x39')])?_0x483ee7:_[_0x4de6('0x99')](_0x483ee7);for(var _0x3caf65 in _0x3329cb){if(_0x3329cb[_0x4de6('0x9a')](_0x3caf65)){if(_0x3329cb[_0x3caf65]&&_[_0x4de6('0x9b')](_0x3329cb[_0x3caf65])){if(_['includes'](recursiveMapAttributes,_0x3caf65)){_0x3329cb[_0x3caf65]=this[_0x4de6('0x9c')](_0x3329cb[_0x3caf65]);}else{_0x3329cb[_0x3caf65]=this[_0x4de6('0x9d')](_0x3329cb[_0x3caf65]);}}}}return _0x3329cb;};AGIVertices[_0x4de6('0xf')]['recursiveNodeIndex']=function(_0x4bd616){for(var _0x40a2c5 in _0x4bd616){if(_0x4bd616[_0x4de6('0x9a')](_0x40a2c5)){if(_[_0x4de6('0x9e')](_0x4bd616[_0x40a2c5])){this['recursiveNodeIndex'](_0x4bd616[_0x40a2c5]);}else if(_[_0x4de6('0x9f')](_0x4bd616[_0x40a2c5])){for(var _0x1ffdf5=0x0;_0x1ffdf5<_0x4bd616[_0x40a2c5][_0x4de6('0xa0')];_0x1ffdf5++){this['recursiveNodeIndex'](_0x4bd616[_0x40a2c5][_0x1ffdf5]);}}else if(_['isString'](_0x4bd616[_0x40a2c5])){_0x4bd616[_0x40a2c5]=this['replaceAllVariables'](_0x4bd616[_0x40a2c5]);}}}};AGIVertices[_0x4de6('0xf')]['saveRestApiResult']=function(_0x2e7aa9,_0x323311){for(var _0x4c74ed in _0x2e7aa9){if(_0x2e7aa9[_0x4de6('0x9a')](_0x4c74ed)){if(_[_0x4de6('0x9e')](_0x2e7aa9[_0x4c74ed])){if(!_[_0x4de6('0x46')](_0x2e7aa9[_0x4c74ed])){this[_0x4de6('0xa1')](_0x2e7aa9[_0x4c74ed],util[_0x4de6('0x28')](_0x4de6('0xa2'),_0x323311,_0x4c74ed));}}else if(_[_0x4de6('0x9f')](_0x2e7aa9[_0x4c74ed])){for(var _0x1fa40b=0x0;_0x1fa40b<_0x2e7aa9[_0x4c74ed][_0x4de6('0xa0')];_0x1fa40b++){this[_0x4de6('0xa1')](_0x2e7aa9[_0x4c74ed][_0x1fa40b],util[_0x4de6('0x28')](_0x4de6('0xa2'),_0x323311,_0x4c74ed+'['+_0x1fa40b+']'));}}else{if(!_[_0x4de6('0x47')](_0x2e7aa9[_0x4c74ed])){this[_0x4de6('0x3a')]['setVariable'](util[_0x4de6('0x28')](_0x4de6('0xa2'),_0x323311,_0x4c74ed),_0x2e7aa9[_0x4c74ed]);}}}}};AGIVertices[_0x4de6('0xf')][_0x4de6('0x9c')]=function(_0x44c41f){try{var _0x1574ff=JSON[_0x4de6('0x6e')](_0x44c41f);this[_0x4de6('0xa3')](_0x1574ff);return JSON[_0x4de6('0x76')](_0x1574ff);}catch(_0x243f3f){return this[_0x4de6('0x9d')](_0x44c41f);}};AGIVertices[_0x4de6('0xf')]['replaceAllVariables']=function(_0x4004a9){var _0x47ea4a=_0x4004a9['split']('{');for(var _0x68a383=0x1;_0x68a383<_0x47ea4a[_0x4de6('0xa0')];_0x68a383+=0x1){var _0x59d4d4=_0x47ea4a[_0x68a383][_0x4de6('0xa4')]('}');if(_0x59d4d4[_0x4de6('0xa0')]>0x1){_0x4004a9=_0x4004a9[_0x4de6('0xa5')]('{'+_0x59d4d4[0x0]+'}',this['channel'][_0x4de6('0xa6')](_0x59d4d4[0x0])[_0x4de6('0xa7')]||_0x59d4d4[0x0]);}}if(_0x47ea4a[_0x4de6('0xa0')]===0x1){return _0x4004a9[_0x4de6('0x4e')]();}return this[_0x4de6('0x9d')](_0x4004a9);};AGIVertices['prototype'][_0x4de6('0xa8')]=function(_0x5e4a9b,_0x4864a9){var _0x45dd0a=this[_0x4de6('0x3a')][_0x4de6('0xa6')](_0x5e4a9b);if(_0x45dd0a[_0x4de6('0xa9')]===-0x1){return _0x45dd0a;}logger['info'](util[_0x4de6('0x28')](_0x4de6('0xaa'),_0x4864a9,_0x45dd0a[_0x4de6('0xa7')]));return this['channel'][_0x4de6('0xab')](_0x4864a9,_0x45dd0a[_0x4de6('0xa7')]);};AGIVertices[_0x4de6('0xf')]['isConfigured']=function(_0x32b38c){return _0x32b38c&&_0x32b38c!=='0'&&_0x32b38c!=='-1'&&_0x32b38c!=='';};AGIVertices[_0x4de6('0xf')][_0x4de6('0xac')]=function(_0x5c1add){this['createSquareDetailsReport'][_0x4de6('0xad')](this,_0x5c1add,'-');_0x5c1add[_0x4de6('0xae')]=_0x5c1add[_0x4de6('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4de6('0xf')]['mrcpsynth']=function(_0x96b683){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x96b683['label']));if(!this[_0x4de6('0x8a')](_0x96b683[_0x4de6('0x5e')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')]('no\x20text\x20configured');}var _0x3c3ac8='\x22'+_0x96b683[_0x4de6('0x5e')]+'\x22';if(this['isConfigured'](_0x96b683[_0x4de6('0x7c')])){_0x3c3ac8+=','+_0x96b683[_0x4de6('0x7c')];}var _0x5c0fe7=this[_0x4de6('0x3a')][_0x4de6('0xb0')](_0x4de6('0xb1'),_0x3c3ac8);if(_0x5c0fe7[_0x4de6('0xa9')]===-0x1){return _0x5c0fe7;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format'](_0x4de6('0xb2'),_0x3c3ac8));};AGIVertices[_0x4de6('0xf')]['mrcprecog']=function(_0x487c4f){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0xb3'),_0x487c4f[_0x4de6('0x38')]));if(!this['isConfigured'](_0x487c4f['grammar'])){return this[_0x4de6('0x3a')]['noop'](_0x4de6('0xb4'));}var _0x4d4f88=_0x487c4f['grammar'];if(this[_0x4de6('0x8a')](_0x487c4f[_0x4de6('0x7c')])){_0x4d4f88+=','+_0x487c4f['options'];}var _0x38e0a7=this[_0x4de6('0x3a')][_0x4de6('0xb0')](_0x4de6('0xb5'),_0x4d4f88);if(_0x38e0a7['result']===-0x1){return _0x38e0a7;}var _0xd02180=this[_0x4de6('0xa8')](_0x4de6('0xb6'),_0x4de6('0xb7'));if(_0xd02180[_0x4de6('0xa9')]===-0x1){return _0xd02180;}var _0x181e51=this[_0x4de6('0xa8')]('RECOG_INPUT()',_0x4de6('0xb8'));if(_0x181e51[_0x4de6('0xa9')]===-0x1){return _0x181e51;}var _0x1a176a=this[_0x4de6('0xa8')](_0x4de6('0xb9'),'MRCP_RECOG_INSTANCE');if(_0x1a176a[_0x4de6('0xa9')]===-0x1){return _0x1a176a;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0xba'),_0x4d4f88));};AGIVertices['prototype'][_0x4de6('0xbb')]=function(_0x400b84){logger['info'](util['format'](_0x4de6('0xbc'),_0x400b84[_0x4de6('0x38')]));return this['channel'][_0x4de6('0xbb')]([_0x400b84[_0x4de6('0xbd')],_0x400b84['args']]);};AGIVertices[_0x4de6('0xf')][_0x4de6('0xbe')]=function(_0x30d10e){logger['info'](util[_0x4de6('0x28')](_0x4de6('0xbf'),_0x30d10e[_0x4de6('0x38')]));if(this[_0x4de6('0x8a')](_0x30d10e['timeout'])){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x30d10e[_0x4de6('0x66')]));var _0x1a01d2=this[_0x4de6('0x3a')][_0x4de6('0xc0')](_0x30d10e['timeout']);if(_0x1a01d2['result']===-0x1){return _0x1a01d2;}}return this['channel'][_0x4de6('0xbe')]();};AGIVertices[_0x4de6('0xf')][_0x4de6('0xc1')]=function(_0x142b89){logger[_0x4de6('0x2d')](util['format'](_0x4de6('0xc2'),_0x142b89['label']));if(!this[_0x4de6('0x8a')](_0x142b89[_0x4de6('0xc3')])){return this[_0x4de6('0x3a')]['error'](_0x142b89,_0x4de6('0xc4'));}_0x142b89['scheduledAt']=moment();if(this[_0x4de6('0x8a')](_0x142b89[_0x4de6('0xc5')])){_0x142b89['scheduledAt']=moment()['add'](_0x142b89['delay'],'minutes');}if(!this[_0x4de6('0x8a')](_0x142b89[_0x4de6('0x4f')])){_0x142b89[_0x4de6('0x4f')]=0x2;}this['createCmContact'][_0x4de6('0xad')](this,_0x142b89);return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0xc6'),_0x142b89[_0x4de6('0x4b')],_0x142b89['list_id'],_0x142b89[_0x4de6('0x4c')]));};AGIVertices[_0x4de6('0xf')][_0x4de6('0xc7')]=function(_0xdf0f1f){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0xc8'),_0xdf0f1f['label']));var _0x3317c1=this['channel']['exec'](_0xdf0f1f[_0x4de6('0xc9')],_0xdf0f1f[_0x4de6('0x7c')]);if(_0x3317c1['result']===-0x1){return _0x3317c1;}return this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0xca'),_0xdf0f1f[_0x4de6('0xc9')],_0xdf0f1f[_0x4de6('0x7c')]));};AGIVertices[_0x4de6('0xf')][_0x4de6('0xcb')]=function(_0x327df2){logger['info'](util[_0x4de6('0x28')](_0x4de6('0xcc'),_0x327df2['label']));if(!this['isConfigured'](_0x327df2[_0x4de6('0x5e')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0xcd'));}var _0x478e97='\x22'+_0x327df2[_0x4de6('0x5e')]+'\x22';if(this[_0x4de6('0x8a')](_0x327df2[_0x4de6('0x7c')])){_0x478e97+=','+_0x327df2[_0x4de6('0x7c')];}var _0x120326=this[_0x4de6('0x3a')][_0x4de6('0xb0')](_0x4de6('0xb1'),_0x478e97);if(_0x120326[_0x4de6('0xa9')]===-0x1){return _0x120326;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x478e97));};AGIVertices[_0x4de6('0xf')]['sestektts']=function(_0x400393){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0xce'),_0x400393['label']));if(!this[_0x4de6('0x8a')](_0x400393[_0x4de6('0x5e')])){return this['channel'][_0x4de6('0xaf')]('no\x20text\x20configured');}var _0x4fc4ab='\x22'+_0x400393[_0x4de6('0x5e')]+'\x22';if(this[_0x4de6('0x8a')](_0x400393[_0x4de6('0x7c')])){_0x4fc4ab+=','+_0x400393[_0x4de6('0x7c')];}var _0x115be3=this[_0x4de6('0x3a')][_0x4de6('0xb0')]('MRCPSynth',_0x4fc4ab);if(_0x115be3[_0x4de6('0xa9')]===-0x1){return _0x115be3;}return this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4fc4ab));};AGIVertices[_0x4de6('0xf')][_0x4de6('0xcf')]=function(_0x918cb8){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x918cb8[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x918cb8[_0x4de6('0xd0')])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0xb4'));}var _0x867dea=_0x918cb8['grammar'];if(this['isConfigured'](_0x918cb8[_0x4de6('0x7c')])){_0x867dea+=','+_0x918cb8[_0x4de6('0x7c')];}var _0x53d8bd=this[_0x4de6('0x3a')][_0x4de6('0xb0')](_0x4de6('0xb5'),_0x867dea);if(_0x53d8bd[_0x4de6('0xa9')]===-0x1){return _0x53d8bd;}var _0x405fe0=this[_0x4de6('0xa8')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x405fe0[_0x4de6('0xa9')]===-0x1){return _0x405fe0;}var _0x54a586=this[_0x4de6('0xa8')]('RECOG_INPUT()',_0x4de6('0xd1'));if(_0x54a586['result']===-0x1){return _0x54a586;}var _0x15fce5=this[_0x4de6('0xa8')](_0x4de6('0xb9'),_0x4de6('0xd2'));if(_0x15fce5['result']===-0x1){return _0x15fce5;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0xba'),_0x867dea));};AGIVertices[_0x4de6('0xf')][_0x4de6('0xd3')]=function(_0xd5dc21){logger[_0x4de6('0x2d')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xd5dc21[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0xd5dc21['grammar'])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0xb4'));}var _0x41c99f=_0xd5dc21['grammar'];if(this[_0x4de6('0x8a')](_0xd5dc21[_0x4de6('0x7c')])){_0x41c99f+=','+_0xd5dc21[_0x4de6('0x7c')];}var _0x1d5f66=this[_0x4de6('0x3a')][_0x4de6('0xb0')](_0x4de6('0xb5'),_0x41c99f);if(_0x1d5f66[_0x4de6('0xa9')]===-0x1){return _0x1d5f66;}var _0x34e54b=this['getAndSetVariable'](_0x4de6('0xb6'),_0x4de6('0xd4'));if(_0x34e54b['result']===-0x1){return _0x34e54b;}var _0xdfef7=this[_0x4de6('0xa8')](_0x4de6('0xd5'),_0x4de6('0xd6'));if(_0xdfef7[_0x4de6('0xa9')]===-0x1){return _0xdfef7;}var _0x315c99=this['getAndSetVariable'](_0x4de6('0xb9'),'SESTEK_ASR_INSTANCE');if(_0x315c99[_0x4de6('0xa9')]===-0x1){return _0x315c99;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x41c99f));};AGIVertices['prototype'][_0x4de6('0xd7')]=function(_0x282246){logger[_0x4de6('0x2d')](util['format'](_0x4de6('0xd8'),_0x282246[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x282246[_0x4de6('0xd9')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x282246,_0x4de6('0xda'));}var _0x33b2d9=this[_0x4de6('0x16')][_0x4de6('0xad')](this,_0x282246[_0x4de6('0xd9')]);if(!_0x33b2d9){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x282246,_0x4de6('0xdb'));}if(!this[_0x4de6('0x8a')](_0x282246[_0x4de6('0x2e')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x282246,_0x4de6('0xdc'));}var _0x2865e4=_0x282246[_0x4de6('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0xdd'),_0x2865e4));var _0x4b61f8=this[_0x4de6('0x2a')]['sync'](this,_0x33b2d9,_0x2865e4);this['createSquareDetailsReport'][_0x4de6('0xad')](this,_0x282246,_0x2865e4);if(!this[_0x4de6('0x8a')](_0x282246[_0x4de6('0xde')])){return this[_0x4de6('0x3a')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1da154=this['getVariable'][_0x4de6('0xad')](this,_0x282246[_0x4de6('0xde')]);if(!_0x1da154){return this[_0x4de6('0x3a')]['error'](_0x282246,_0x4de6('0xdf'));}var _0x53008c=this;_0x4b61f8[_0x4de6('0xe0')](function(_0x13a4f9,_0x29607d){Object[_0x4de6('0xe1')](_0x13a4f9)[_0x4de6('0xe0')](function(_0x5c58cc){_0x53008c[_0x4de6('0x3a')][_0x4de6('0xab')](util[_0x4de6('0x28')](_0x4de6('0xe2'),_0x1da154,_0x29607d,_0x5c58cc),_0x13a4f9[_0x5c58cc]);});});this[_0x4de6('0x3a')][_0x4de6('0xab')](util[_0x4de6('0x28')](_0x4de6('0xe3'),_0x1da154),_0x4b61f8['length']);return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format'](_0x4de6('0xe4'),_0x1da154));};AGIVertices[_0x4de6('0xf')][_0x4de6('0xe5')]=function(_0x11b91d){logger[_0x4de6('0xe6')](util[_0x4de6('0x28')](_0x4de6('0xe7'),_0x11b91d[_0x4de6('0x38')]));if(!this['isConfigured'](_0x11b91d[_0x4de6('0xe8')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x11b91d,_0x4de6('0xe9'));}var _0x265d0e=this[_0x4de6('0x19')][_0x4de6('0xad')](this,_0x11b91d[_0x4de6('0xe8')]);if(!_0x265d0e){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x11b91d,_0x4de6('0xea'));}var _0x57556e=this[_0x4de6('0x3a')][_0x4de6('0xb0')]('DIAL',[util[_0x4de6('0x28')](_0x4de6('0xeb'),_0x265d0e),_0x11b91d['timeout'],_0x11b91d[_0x4de6('0xec')],_0x11b91d[_0x4de6('0x64')]]);if(_0x57556e[_0x4de6('0xa9')]===-0x1){return _0x57556e;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0xed'),_0x4de6('0xee')));};AGIVertices[_0x4de6('0xf')][_0x4de6('0xef')]=function(_0x1fecb4){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0xf0'),_0x1fecb4[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x1fecb4[_0x4de6('0x7e')])){return this[_0x4de6('0x3a')]['noop'](_0x4de6('0xf1'));}if(!this[_0x4de6('0x8a')](_0x1fecb4[_0x4de6('0x5e')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0xcd'));}this[_0x4de6('0x3a')][_0x4de6('0xf2')]=!![];this['createSquareDetailsReport'](_0x1fecb4);this[_0x4de6('0x44')](_0x1fecb4[_0x4de6('0x5e')],'in','','');this[_0x4de6('0x3a')]['noop'](util['format'](_0x4de6('0xf3'),_0x1fecb4[_0x4de6('0x5e')]));var _0x501c52=this['googleDialogflow'][_0x4de6('0xad')](this,_0x1fecb4);if(_0x501c52){for(var _0x73f64a in _0x501c52){if(_0x501c52[_0x4de6('0x9a')](_0x73f64a)){this['channel'][_0x4de6('0xab')](util[_0x4de6('0x28')](_0x4de6('0xf4'),_0x73f64a[_0x4de6('0x6b')]()),_0x501c52[_0x73f64a]);}}this['createSquareMessage'](_0x501c52[_0x4de6('0xf5')],_0x4de6('0xf6'),'dialogflow','');return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')]('Dialogflow\x20Result\x20%s',_0x501c52['speech']));}return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x1fecb4,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x4de6('0xf')]['dialogflowV2']=function(_0x262583){logger['info'](util[_0x4de6('0x28')](_0x4de6('0xf7'),_0x262583[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x262583[_0x4de6('0x81')])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0xf8'));}if(!this[_0x4de6('0x8a')](_0x262583[_0x4de6('0x82')])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0xf9'));}if(!this[_0x4de6('0x8a')](_0x262583[_0x4de6('0x83')])){return this[_0x4de6('0x3a')]['noop']('no\x20private_key\x20configured');}if(!this[_0x4de6('0x8a')](_0x262583['dialogflowV2_language'])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0xfa'));}if(!this[_0x4de6('0x8a')](_0x262583['text'])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0xcd'));}this[_0x4de6('0x3a')][_0x4de6('0xf2')]=!![];this['createSquareDetailsReport'](_0x262583);this[_0x4de6('0x44')](_0x262583[_0x4de6('0x5e')],'in','','');this['channel'][_0x4de6('0xaf')](util['format'](_0x4de6('0xfb'),_0x262583[_0x4de6('0x5e')]));var _0x30b879=this[_0x4de6('0x80')][_0x4de6('0xad')](this,_0x262583);if(_0x30b879){for(var _0xd57bee in _0x30b879){if(_0x30b879[_0x4de6('0x9a')](_0xd57bee)){if(_0xd57bee!==_0x4de6('0xfc')){this[_0x4de6('0x3a')][_0x4de6('0xab')](util['format']('DIALOGFLOW_%s',_0xd57bee[_0x4de6('0x6b')]()),_0x30b879[_0xd57bee]);}}}this[_0x4de6('0x44')](_0x30b879[_0x4de6('0xf5')],_0x4de6('0xf6'),_0x4de6('0xfd'),_0x30b879[_0x4de6('0xfc')]);return this['channel'][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0xfe'),_0x30b879[_0x4de6('0xf5')]));}return this['channel'][_0x4de6('0x2b')](_0x262583,_0x4de6('0xff'));};AGIVertices[_0x4de6('0xf')][_0x4de6('0x100')]=function(_0x135d57){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x101'),_0x135d57[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x135d57[_0x4de6('0x102')])){return this['channel'][_0x4de6('0xaf')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x4de6('0x8a')](_0x135d57['username'])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x103'));}if(!this['isConfigured'](_0x135d57['password'])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')]('no\x20password\x20configured');}if(!this[_0x4de6('0x8a')](_0x135d57['ndassistant_url'])){return this[_0x4de6('0x3a')]['noop'](_0x4de6('0xcd'));}this[_0x4de6('0x3a')][_0x4de6('0xf2')]=!![];this['createSquareDetailsReport'](_0x135d57);this[_0x4de6('0x44')](_0x135d57[_0x4de6('0x5e')],'in','','');this[_0x4de6('0x3a')]['noop'](util['format']('Trying\x20SestekNDA:\x20%s',_0x135d57[_0x4de6('0x5e')]));var _0x1b8265=this[_0x4de6('0x84')][_0x4de6('0xad')](this,_0x135d57);if(_0x1b8265){for(var _0xcdd136 in _0x1b8265){if(_0x1b8265['hasOwnProperty'](_0xcdd136)){this[_0x4de6('0x3a')][_0x4de6('0xab')](util[_0x4de6('0x28')]('SESTEK_NDA_%s',_0xcdd136[_0x4de6('0x6b')]()),_0x1b8265[_0xcdd136]);}}this[_0x4de6('0x44')](_0x1b8265['speech'],_0x4de6('0xf6'),'sesteknda','');if(_0x1b8265['audiofile']){this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x104'),_0x1b8265['audiofile']));var _0x4e5280=this['channel']['streamFile'](_0x1b8265['audiofile']);try{fs[_0x4de6('0x105')](_0x1b8265[_0x4de6('0x106')]+_0x4de6('0x107'));}catch(_0x271cb1){logger[_0x4de6('0x2b')](_0x271cb1);}return _0x4e5280;}else{return this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')]('SestekNDA\x20Result\x20%s',_0x1b8265[_0x4de6('0xf5')]));}}return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x135d57,_0x4de6('0x108'));};AGIVertices[_0x4de6('0xf')][_0x4de6('0x109')]=function(_0x189ec4){logger[_0x4de6('0x2d')](util['format'](_0x4de6('0x10a'),_0x189ec4['label']));return this['channel'][_0x4de6('0xaf')](_0x4de6('0x109'));};AGIVertices[_0x4de6('0xf')]['ext_dial']=function(_0x518d85){logger['info'](util[_0x4de6('0x28')](_0x4de6('0x10b'),_0x518d85[_0x4de6('0x38')]));var _0x3a5c98='';if(_0x518d85[_0x4de6('0x10c')]){if(!this[_0x4de6('0x8a')](_0x518d85['trunk_id'])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x518d85,'no\x20trunk\x20selected');}else{var _0x18e070=parseInt(_0x518d85[_0x4de6('0x10c')],0xa);if(isNaN(_0x18e070)){_0x3a5c98=_0x518d85[_0x4de6('0x10c')];}else{_0x3a5c98=this[_0x4de6('0x1b')][_0x4de6('0xad')](this,_0x518d85[_0x4de6('0x10c')]);if(!_0x3a5c98){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x518d85,_0x4de6('0x10d'));}}}}else if(_0x518d85[_0x4de6('0x10e')]){_0x3a5c98=_0x518d85['trunk_name'];}else{return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x518d85,_0x4de6('0x10f'));}var _0x514f67=this[_0x4de6('0x3a')]['exec'](_0x4de6('0xee'),[util[_0x4de6('0x28')](_0x4de6('0x110'),_0x3a5c98,_0x518d85['phone']),_0x518d85[_0x4de6('0x66')],_0x518d85[_0x4de6('0xec')],_0x518d85[_0x4de6('0x64')]]);if(_0x514f67['result']===-0x1){return _0x514f67;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')]('Executed\x20command\x20%s',_0x4de6('0xee')));};AGIVertices[_0x4de6('0xf')]['finally']=function(_0x8342d0){logger['info'](util[_0x4de6('0x28')](_0x4de6('0x111'),_0x8342d0['label']));return this[_0x4de6('0x3a')]['noop'](_0x4de6('0x112'));};AGIVertices['prototype'][_0x4de6('0xb')]=function(_0x5d0cb8){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5d0cb8['label']));if(_0x5d0cb8[_0x4de6('0xae')]===0x0){return this['maxRetry'](_0x5d0cb8);}_0x5d0cb8[_0x4de6('0xae')]-=0x1;if(!this['isConfigured'](_0x5d0cb8['file_id'])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x5d0cb8,_0x4de6('0x113'));}var _0x509b43=this['getSound'][_0x4de6('0xad')](this,_0x5d0cb8[_0x4de6('0x114')]);if(!_0x509b43){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x5d0cb8,_0x4de6('0x115'));}if(!this['isConfigured'](_0x5d0cb8[_0x4de6('0xde')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x4de6('0x116'));}var _0x3b3d6e=this[_0x4de6('0x3a')][_0x4de6('0x117')](_0x509b43,_0x5d0cb8[_0x4de6('0x118')],_0x5d0cb8[_0x4de6('0x119')]);var _0x185c10=_0x3b3d6e[_0x4de6('0xa9')]?_0x3b3d6e['result'][_0x4de6('0x4e')]():'';logger[_0x4de6('0x2d')](_0x4de6('0x11a'),JSON[_0x4de6('0x76')](_0x3b3d6e));if(_0x3b3d6e['result']===-0x1){this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0x5d0cb8,_0x185c10);return _0x3b3d6e;}else if(_0x3b3d6e[_0x4de6('0xa7')]==='timeout'){_0x3b3d6e[_0x4de6('0xa9')]=_0x185c10[_0x4de6('0xa0')]>=parseInt(_0x5d0cb8[_0x4de6('0x11b')])?'x':'i';}else{_0x3b3d6e[_0x4de6('0xa9')]=_0x185c10[_0x4de6('0xa0')]>=parseInt(_0x5d0cb8[_0x4de6('0x11b')])&&_0x185c10[_0x4de6('0xa0')]<=parseInt(_0x5d0cb8[_0x4de6('0x119')])?'x':'i';}var _0x4cf88e=this[_0x4de6('0xa6')][_0x4de6('0xad')](this,_0x5d0cb8[_0x4de6('0xde')]);if(!_0x4cf88e){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x5d0cb8,_0x4de6('0xdf'));}this['channel'][_0x4de6('0xab')](_0x4cf88e,_0x185c10);if(this[_0x4de6('0x8a')](_0x5d0cb8[_0x4de6('0x11c')])){var _0x41e153=parseInt(_0x5d0cb8[_0x4de6('0x11c')],0xa);var _0x373440=rs[_0x4de6('0x11d')]({'charset':'*','length':_0x41e153});var _0x39dbd6=_0x185c10[_0x4de6('0xa0')];if(_0x39dbd6>0x0){if(_0x39dbd6>_0x41e153){this['createSquareDetailsReport'][_0x4de6('0xad')](this,_0x5d0cb8,_0x5d0cb8['hiddendigitspos']===_0x4de6('0x11e')?_0x373440+_0x185c10[_0x4de6('0x11f')](_0x41e153):_0x185c10[_0x4de6('0x11f')](0x0,_0x39dbd6-_0x41e153)+_0x373440);}else{this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0x5d0cb8,rs[_0x4de6('0x11d')]({'charset':'*','length':_0x39dbd6}));}}else{this[_0x4de6('0x36')]['sync'](this,_0x5d0cb8,'');}}else{this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0x5d0cb8,_0x185c10);}return _0x3b3d6e;};AGIVertices[_0x4de6('0xf')][_0x4de6('0xc')]=function(_0x2b405c){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2b405c[_0x4de6('0x38')]));return this[_0x4de6('0xb')](_0x2b405c);};AGIVertices[_0x4de6('0xf')][_0x4de6('0x120')]=function(_0x309023){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x309023[_0x4de6('0x38')]));this[_0x4de6('0x36')]['sync'](this,_0x309023,_0x309023[_0x4de6('0x121')]);return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')]('GOAL\x20%s',_0x309023[_0x4de6('0x121')]));};AGIVertices[_0x4de6('0xf')][_0x4de6('0x122')]=function(_0x59a639){logger[_0x4de6('0x2d')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x59a639['label']));if(!this['isConfigured'](_0x59a639[_0x4de6('0x91')])||!this[_0x4de6('0x8a')](_0x59a639['aws_secret_access_key'])){return this[_0x4de6('0x3a')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x4de6('0x8a')](_0x59a639[_0x4de6('0x5e')])){return this[_0x4de6('0x3a')]['noop'](_0x4de6('0xcd'));}this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x123'),_0x59a639[_0x4de6('0x5e')]));var _0x2abb6b=this[_0x4de6('0x8c')]['sync'](this,_0x59a639);if(_0x2abb6b){this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x2abb6b));var _0x43d289=this[_0x4de6('0x3a')]['streamFile'](_0x2abb6b);try{fs[_0x4de6('0x105')](_0x2abb6b+_0x4de6('0x107'));}catch(_0x5ec98a){logger[_0x4de6('0x2b')](_0x5ec98a);}return _0x43d289;}return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x59a639,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x4de6('0x124')]=function(_0x5ecf0d){logger['info'](util[_0x4de6('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5ecf0d[_0x4de6('0x38')]));if(!this['isConfigured'](_0x5ecf0d[_0x4de6('0x91')])||!this[_0x4de6('0x8a')](_0x5ecf0d[_0x4de6('0x125')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x126'));}if(!this[_0x4de6('0x8a')](_0x5ecf0d[_0x4de6('0x92')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')]('no\x20bot\x20name\x20configured');}if(!this[_0x4de6('0x8a')](_0x5ecf0d[_0x4de6('0x5e')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x4de6('0x3a')][_0x4de6('0xf2')]=!![];this[_0x4de6('0x36')](_0x5ecf0d);this[_0x4de6('0x44')](_0x5ecf0d[_0x4de6('0x5e')],'in','','');this['channel']['noop'](util[_0x4de6('0x28')](_0x4de6('0x127'),_0x5ecf0d[_0x4de6('0x5e')]));var _0x4c5cc2=this[_0x4de6('0x90')][_0x4de6('0xad')](this,_0x5ecf0d);if(_0x4c5cc2){for(var _0x2c348e in _0x4c5cc2){if(_0x4c5cc2['hasOwnProperty'](_0x2c348e)&&_['isString'](_0x4c5cc2[_0x2c348e])){this['channel'][_0x4de6('0xab')](util[_0x4de6('0x28')](_0x4de6('0x128'),_0x2c348e[_0x4de6('0x6b')]()),_0x4c5cc2[_0x2c348e]);}}if(_['isNil'](_0x4c5cc2[_0x4de6('0x7a')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x4de6('0x44')](_0x4c5cc2[_0x4de6('0x7a')],_0x4de6('0xf6'),'amazonlex','');return this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0x129'),_0x4c5cc2[_0x4de6('0x7a')]));}}return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x5ecf0d,_0x4de6('0x12a'));};AGIVertices['prototype'][_0x4de6('0x12b')]=function(_0x420aa5){logger[_0x4de6('0x2d')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x420aa5[_0x4de6('0x38')],_0x420aa5[_0x4de6('0x66')]));if(!this[_0x4de6('0x8a')](_0x420aa5['key'])){return this[_0x4de6('0x3a')]['noop'](_0x4de6('0xf1'));}var _0x92a22b='wav';var _0xbe3ad6=util[_0x4de6('0x28')](_0x4de6('0x12c'),FILES_PATH,rs[_0x4de6('0x11d')](0x4));var _0xead0c2=util[_0x4de6('0x28')](_0x4de6('0xa2'),_0xbe3ad6,_0x92a22b);var _0x2d7cd5=!![];if(_0x420aa5[_0x4de6('0x12d')]===_0x4de6('0x12e')){_0x2d7cd5=![];}var _0x322c42=this[_0x4de6('0x3a')][_0x4de6('0x12f')](_0xbe3ad6,_0x92a22b,_0x420aa5['intKey'],_0x420aa5[_0x4de6('0x66')],undefined,_0x2d7cd5);if(_0x322c42[_0x4de6('0xa9')]!==-0x1){this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0x130'),_0xead0c2));var _0x10b3ff=this[_0x4de6('0x93')][_0x4de6('0xad')](this,_0x420aa5,_0xead0c2);if(_0x10b3ff){for(var _0x41b388 in _0x10b3ff){if(_0x10b3ff['hasOwnProperty'](_0x41b388)){this[_0x4de6('0x3a')][_0x4de6('0xab')](util['format']('GOOGLE_ASR_%s',_0x41b388[_0x4de6('0x6b')]()),_0x10b3ff[_0x41b388]);}}return this[_0x4de6('0x3a')]['noop'](util['format'](_0x4de6('0x131'),JSON[_0x4de6('0x76')](_0x10b3ff)));}}return _0x322c42;};AGIVertices[_0x4de6('0xf')]['tildeasr']=function(_0x266da1){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x132'),_0x266da1[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x266da1[_0x4de6('0x96')])){return this['channel']['noop'](_0x4de6('0x133'));}if(!this['isConfigured'](_0x266da1['appsecret'])){return this[_0x4de6('0x3a')]['noop'](_0x4de6('0x134'));}var _0x23bf47=_0x4de6('0x135');var _0x282825=util[_0x4de6('0x28')](_0x4de6('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x5dad96=util['format'](_0x4de6('0xa2'),_0x282825,_0x23bf47);var _0x24f11c=!![];if(_0x266da1['beep']===_0x4de6('0x12e')){_0x24f11c=![];}var _0x555940=this[_0x4de6('0x3a')]['recordFile'](_0x282825,_0x23bf47,_0x266da1[_0x4de6('0x136')],_0x266da1[_0x4de6('0x66')],undefined,_0x24f11c);if(_0x555940[_0x4de6('0xa9')]!==-0x1){this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x137'),_0x5dad96));var _0x560440=this[_0x4de6('0x95')][_0x4de6('0xad')](this,_0x266da1,_0x5dad96);if(_0x560440){for(var _0x3fd18c in _0x560440){if(_0x560440[_0x4de6('0x9a')](_0x3fd18c)){this['channel']['setVariable'](util[_0x4de6('0x28')]('TILDE_ASR_%s',_0x3fd18c[_0x4de6('0x6b')]()),_0x560440[_0x3fd18c]);}}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x138'),JSON[_0x4de6('0x76')](_0x560440)));}}return _0x555940;};AGIVertices[_0x4de6('0xf')]['gotoc']=function(_0x1d9ed0){logger['info'](util[_0x4de6('0x28')](_0x4de6('0x139'),_0x1d9ed0[_0x4de6('0x38')]));return this[_0x4de6('0x3a')]['continueAt'](_0x1d9ed0['context'],_0x1d9ed0[_0x4de6('0x3f')],_0x1d9ed0['priority']);};AGIVertices[_0x4de6('0xf')][_0x4de6('0x13a')]=function(_0x433271){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x13b'),_0x433271['label']));if(!this['isConfigured'](_0x433271[_0x4de6('0x13c')])){return this[_0x4de6('0x3a')]['error'](_0x433271,_0x4de6('0x13d'));}try{var _0x41a12e=eval(_0x433271[_0x4de6('0x13c')])?_0x4de6('0x13e'):'false';this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0x13f'),_0x433271[_0x4de6('0x13c')],_0x41a12e));return{'code':0xc8,'result':_0x41a12e};}catch(_0x4c2291){return{'code':0xc8,'result':_0x4de6('0x140')};}};AGIVertices[_0x4de6('0xf')][_0x4de6('0x141')]=function(_0x40b35c){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x40b35c[_0x4de6('0x38')]));if(!this['isConfigured'](_0x40b35c[_0x4de6('0x142')])){return this[_0x4de6('0x3a')]['error'](_0x40b35c,'no\x20interval\x20configured');}var _0x1f7e47=this['getIntervals']['sync'](this,_0x40b35c['interval_id']);if(!_0x1f7e47){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x40b35c,_0x4de6('0x143'));}for(var _0x47c09c=0x0;_0x47c09c<_0x1f7e47['length'];_0x47c09c+=0x1){var _0x4f0238=this[_0x4de6('0x3a')][_0x4de6('0xa6')](util[_0x4de6('0x28')](_0x4de6('0x144'),_0x1f7e47[_0x47c09c]));if(_0x4f0238[_0x4de6('0xa9')]===-0x1){return _0x4f0238;}logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x145'),_0x1f7e47[_0x47c09c],_0x4f0238[_0x4de6('0xa7')]));if(_0x4f0238['extra']==='true'){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x145'),_0x1f7e47[_0x47c09c],_0x4de6('0x13e')));this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')]('IFTIME\x20%s\x20%s',_0x1f7e47[_0x47c09c],_0x4de6('0x13e')));return{'code':0xc8,'result':_0x4de6('0x13e')};}else{logger['info'](util['format'](_0x4de6('0x145'),_0x1f7e47[_0x47c09c],_0x4de6('0x140')));this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format']('IFTIME\x20%s\x20%s',_0x1f7e47[_0x47c09c],_0x4de6('0x140')));}}return{'code':0xc8,'result':_0x4de6('0x140')};};AGIVertices['prototype']['hangup']=function(_0x13e414){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x13e414[_0x4de6('0x38')]));return this['channel']['hangup']();};AGIVertices[_0x4de6('0xf')][_0x4de6('0x146')]=function(_0x4c47b9){logger[_0x4de6('0x2d')](util['format'](_0x4de6('0x147'),_0x4c47b9[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x4c47b9[_0x4de6('0x7e')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0xf1'));}var _0x1a1c18=_0x4de6('0x135');var _0x22efc1=util['format'](_0x4de6('0x12c'),FILES_PATH,rs[_0x4de6('0x11d')](0x4));var _0x3444=util['format'](_0x4de6('0xa2'),_0x22efc1,_0x1a1c18);var _0x39b8ec=!![];if(_0x4c47b9[_0x4de6('0x12d')]===_0x4de6('0x12e')){_0x39b8ec=![];}var _0xe0a091=this['channel'][_0x4de6('0x12f')](_0x22efc1,_0x1a1c18,_0x4c47b9['intKey'],_0x4c47b9['timeout'],undefined,_0x39b8ec);if(_0xe0a091['result']!==-0x1){this['channel'][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x148'),_0x3444));var _0x245800=this[_0x4de6('0x88')][_0x4de6('0xad')](this,_0x4c47b9,_0x3444);if(_0x245800){for(var _0x14fa4a in _0x245800){if(_0x245800[_0x4de6('0x9a')](_0x14fa4a)){this[_0x4de6('0x3a')][_0x4de6('0xab')](util[_0x4de6('0x28')]('ISPEECH_ASR_%s',_0x14fa4a[_0x4de6('0x6b')]()),_0x245800[_0x14fa4a]);}}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x149'),JSON[_0x4de6('0x76')](_0x245800)));}}return _0xe0a091;};AGIVertices[_0x4de6('0xf')][_0x4de6('0x14a')]=function(_0x48675e){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x14b'),_0x48675e[_0x4de6('0x38')]));if(!this['isConfigured'](_0x48675e['key'])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0xf1'));}if(!this[_0x4de6('0x8a')](_0x48675e[_0x4de6('0x5e')])){return this[_0x4de6('0x3a')]['noop']('no\x20text\x20configured');}this['channel'][_0x4de6('0xaf')](util[_0x4de6('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x48675e['text']));var _0x3bec66=this[_0x4de6('0x85')][_0x4de6('0xad')](this,_0x48675e);if(_0x3bec66){this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x148'),_0x3bec66));var _0x1dc8be=this[_0x4de6('0x3a')][_0x4de6('0x14c')](_0x3bec66,_0x48675e[_0x4de6('0x136')]);try{fs[_0x4de6('0x105')](_0x3bec66+'.wav');}catch(_0x7fab2){logger[_0x4de6('0x2b')](_0x7fab2);}return _0x1dc8be;}return this['channel']['error'](_0x48675e,_0x4de6('0x14d'));};AGIVertices[_0x4de6('0xf')][_0x4de6('0x14e')]=function(_0x1c5940){logger['info'](util[_0x4de6('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1c5940[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x1c5940['findBy'])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x1c5940,_0x4de6('0x14f'));}logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x150'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x1c5940[_0x4de6('0x151')]));var _0x352fdc=this[_0x4de6('0x56')][_0x4de6('0xad')](this,_0x1c5940[_0x4de6('0x151')]);if(_0x352fdc){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x152'),this[_0x4de6('0x3a')]['callerid'],_0x1c5940[_0x4de6('0x151')]));this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x152'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x1c5940[_0x4de6('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x153'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x1c5940[_0x4de6('0x151')]));this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x153'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x1c5940['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4de6('0xf')]['logout']=function(_0x23514b){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x154'),_0x23514b[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x23514b[_0x4de6('0x151')])){return this[_0x4de6('0x3a')]['error'](_0x23514b,_0x4de6('0x14f'));}logger[_0x4de6('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x23514b[_0x4de6('0x151')]));var _0x13b6e7=this[_0x4de6('0x55')][_0x4de6('0xad')](this,_0x23514b['findBy']);if(_0x13b6e7){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x152'),this['channel']['callerid'],_0x23514b['findBy']));this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x23514b['findBy']));return{'code':0xc8,'result':_0x4de6('0x155')};}else{logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4de6('0x3c')],_0x23514b[_0x4de6('0x151')]));this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x153'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x23514b[_0x4de6('0x151')]));return{'code':0xc8,'result':_0x4de6('0x156')};}};AGIVertices[_0x4de6('0xf')]['math']=function(_0x2ccbe9){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2ccbe9[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x2ccbe9[_0x4de6('0x157')])){return this[_0x4de6('0x3a')]['error'](_0x2ccbe9,_0x4de6('0x158'));}this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format'](_0x4de6('0x159'),_0x2ccbe9['operation']));var _0x2df0c0=eval(_0x2ccbe9[_0x4de6('0x157')]);if(!this[_0x4de6('0x8a')](_0x2ccbe9[_0x4de6('0xde')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x116'));}var _0x4f5e23=this['getVariable'][_0x4de6('0xad')](this,_0x2ccbe9[_0x4de6('0xde')]);if(!_0x4f5e23){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x2ccbe9,_0x4de6('0xdf'));}if(_['isArray'](_0x2df0c0)){var _0x55f81e=this;_0x2df0c0[_0x4de6('0xe0')](function(_0x2a45b8,_0x371972){_0x55f81e[_0x4de6('0x3a')][_0x4de6('0xab')](util[_0x4de6('0x28')](_0x4de6('0x15a'),_0x4f5e23,_0x371972),_0x2a45b8);});return this['channel'][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x15b'),_0x4f5e23));}else{return this[_0x4de6('0x3a')]['setVariable'](_0x4f5e23,_0x2df0c0);}};AGIVertices[_0x4de6('0xf')][_0x4de6('0xa')]=function(_0x2d00c4){logger['info'](util[_0x4de6('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2d00c4[_0x4de6('0x38')]));if(_0x2d00c4[_0x4de6('0xae')]===0x0){return this[_0x4de6('0xac')](_0x2d00c4);}_0x2d00c4[_0x4de6('0xae')]-=0x1;if(!this[_0x4de6('0x8a')](_0x2d00c4['file_id'])){return this['channel'][_0x4de6('0x2b')](_0x2d00c4,_0x4de6('0x113'));}var _0x343c00=this[_0x4de6('0x1d')][_0x4de6('0xad')](this,_0x2d00c4[_0x4de6('0x114')]);if(!_0x343c00){return this['channel'][_0x4de6('0x2b')](_0x2d00c4,_0x4de6('0x115'));}var _0x263c67=this[_0x4de6('0x3a')][_0x4de6('0x117')](_0x343c00,_0x2d00c4['response'],_0x2d00c4['digit']);var _0x870ab0=_0x263c67[_0x4de6('0xa9')];if(_0x263c67[_0x4de6('0xa9')]===-0x1){this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0x2d00c4,'-1');return _0x263c67;}else if(_0x263c67[_0x4de6('0xa7')]===_0x4de6('0x66')){_0x263c67[_0x4de6('0xa9')]=_0x263c67[_0x4de6('0xa9')][_0x4de6('0xa0')]>0x0?_0x263c67[_0x4de6('0xa9')]:'t';}else if(_['isEmpty'](_0x263c67['result'])){_0x263c67[_0x4de6('0xa9')]='#';_0x870ab0='#';}if(!this['isConfigured'](_0x2d00c4[_0x4de6('0xde')])){this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x116'));}else{var _0x163483=this[_0x4de6('0xa6')][_0x4de6('0xad')](this,_0x2d00c4[_0x4de6('0xde')]);if(!_0x163483){return this[_0x4de6('0x3a')]['error'](_0x2d00c4,_0x4de6('0xdf'));}this[_0x4de6('0x3a')]['setVariable'](_0x163483,_0x870ab0);}this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0x2d00c4,_0x870ab0);return _0x263c67;};AGIVertices[_0x4de6('0xf')][_0x4de6('0xaf')]=function(_0xaf4096){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x15c'),_0xaf4096[_0x4de6('0x38')]));return this[_0x4de6('0x3a')]['noop'](_0xaf4096[_0x4de6('0x15d')]||_0xaf4096[_0x4de6('0x38')]);};AGIVertices['prototype'][_0x4de6('0x15e')]=function(_0x4ef9c0){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x15f'),_0x4ef9c0[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x4ef9c0[_0x4de6('0x151')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x4ef9c0,_0x4de6('0x14f'));}logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x150'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x4ef9c0[_0x4de6('0x151')]));var _0x431e9f=this[_0x4de6('0x50')][_0x4de6('0xad')](this,_0x4ef9c0['pause_id']);var _0x4a9a0a=this[_0x4de6('0x52')][_0x4de6('0xad')](this,_0x4ef9c0[_0x4de6('0x151')],_0x431e9f);if(_0x4a9a0a){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x152'),this[_0x4de6('0x3a')]['callerid'],_0x4ef9c0[_0x4de6('0x151')]));this['channel'][_0x4de6('0xaf')](util['format'](_0x4de6('0x152'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x4ef9c0[_0x4de6('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x153'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x4ef9c0[_0x4de6('0x151')]));this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format'](_0x4de6('0x152'),this['channel'][_0x4de6('0x3c')],_0x4ef9c0['findBy']));return{'code':0xc8,'result':_0x4de6('0x156')};}};AGIVertices[_0x4de6('0xf')][_0x4de6('0x160')]=function(_0x530529){logger[_0x4de6('0x2d')](util['format'](_0x4de6('0x161'),_0x530529[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x530529['file_id'])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x530529,_0x4de6('0x113'));}var _0x2dc434=this['getSound'][_0x4de6('0xad')](this,_0x530529[_0x4de6('0x114')]);if(!_0x2dc434){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x530529,_0x4de6('0x115'));}var _0x440c95=this[_0x4de6('0x3a')][_0x4de6('0xb0')]('PLAYBACK',[_0x2dc434,_0x530529[_0x4de6('0xec')]]);if(_0x440c95['result']===-0x1){return _0x440c95;}return this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0xca'),_0x4de6('0x162'),_0x2dc434));};AGIVertices[_0x4de6('0xf')][_0x4de6('0x163')]=function(_0x1a0d3f){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x164'),_0x1a0d3f[_0x4de6('0x38')]));if(!this['isConfigured'](_0x1a0d3f[_0x4de6('0x165')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x1a0d3f,'no\x20queue\x20selected');}var _0x194e9f='';var _0x261f2a=parseInt(_0x1a0d3f['queue_id'],0xa);if(isNaN(_0x261f2a)){_0x194e9f=_0x1a0d3f[_0x4de6('0x165')];}else{_0x194e9f=this[_0x4de6('0x14')][_0x4de6('0xad')](this,_0x1a0d3f[_0x4de6('0x165')]);if(!_0x194e9f){return this['channel'][_0x4de6('0x2b')](_0x1a0d3f,'no\x20queue\x20found');}}var _0x101e4a='';if(this[_0x4de6('0x8a')](_0x1a0d3f[_0x4de6('0x114')])){var _0x5e3b90=this['getSound'][_0x4de6('0xad')](this,_0x1a0d3f['file_id']);if(_0x5e3b90){_0x101e4a=_0x5e3b90;}}this[_0x4de6('0x36')]['sync'](this,_0x1a0d3f,_0x194e9f);if(_0x1a0d3f[_0x4de6('0xec')][_0x4de6('0x166')]('x')<0x0){_0x1a0d3f[_0x4de6('0xec')]+='x';}if(_0x1a0d3f['opts'][_0x4de6('0x166')]('X')<0x0){_0x1a0d3f['opts']+='X';}this[_0x4de6('0x3a')][_0x4de6('0xab')](_0x4de6('0x167'),_0x194e9f?_0x194e9f[_0x4de6('0x168')]():'');var _0x730a59=this[_0x4de6('0x3a')][_0x4de6('0xb0')](_0x4de6('0x169'),[_0x194e9f,_0x1a0d3f[_0x4de6('0xec')],_0x1a0d3f[_0x4de6('0x64')],_0x101e4a,_0x1a0d3f[_0x4de6('0x66')],_0x1a0d3f[_0x4de6('0xbb')],_0x1a0d3f['macro'],_0x1a0d3f[_0x4de6('0x16a')],'',_0x1a0d3f[_0x4de6('0x16b')]]);if(_0x730a59[_0x4de6('0xa9')]===-0x1){return _0x730a59;}return this['channel']['noop'](util[_0x4de6('0x28')](_0x4de6('0xca'),_0x4de6('0x169'),_0x194e9f));};AGIVertices[_0x4de6('0xf')][_0x4de6('0x16c')]=function(_0x22a48b){logger['info'](util[_0x4de6('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x22a48b[_0x4de6('0x38')]));var _0x3ff065=_0x22a48b[_0x4de6('0x16d')]||_0x4de6('0x135');var _0x50ee37=util[_0x4de6('0x28')](_0x4de6('0x16e'),this[_0x4de6('0x3a')]['uniqueid'],rs[_0x4de6('0x11d')](0x5));var _0x33077e=util[_0x4de6('0x28')](_0x4de6('0x16f'),FILES_PATH,_0x50ee37,_0x3ff065);var _0x3c6c79=util['format'](_0x4de6('0x12c'),FILES_PATH,_0x50ee37);this[_0x4de6('0x170')][_0x4de6('0xad')](this,_0x22a48b,_0x50ee37,_0x33077e);this['channel'][_0x4de6('0xab')](_0x4de6('0x171'),_0x50ee37);logger[_0x4de6('0x2d')](_0x4de6('0x172'),_0x3c6c79,_0x3ff065,_0x22a48b[_0x4de6('0x173')],_0x22a48b[_0x4de6('0x66')]);return this[_0x4de6('0x3a')]['recordFile'](_0x3c6c79,_0x3ff065,_0x22a48b['escape_digits'],_0x22a48b[_0x4de6('0x66')],undefined,!![]);};AGIVertices[_0x4de6('0xf')]['restapi']=function(_0x25a5c7){logger[_0x4de6('0x2d')](util['format'](_0x4de6('0x174'),_0x25a5c7[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x25a5c7[_0x4de6('0x64')])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0x175'));}var _0xc3f5b5=this['restAPI'][_0x4de6('0xad')](this,_0x25a5c7);logger[_0x4de6('0x2d')](util['format'](_0x4de6('0x176'),util[_0x4de6('0x177')](_0xc3f5b5,{'showHidden':![],'depth':null})));if(!this[_0x4de6('0x8a')](_0x25a5c7[_0x4de6('0xde')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x178'));}var _0x363788=this[_0x4de6('0xa6')]['sync'](this,_0x25a5c7[_0x4de6('0xde')]);if(!_0x363788){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x25a5c7,_0x4de6('0xdf'));}this[_0x4de6('0x3a')][_0x4de6('0xab')](util[_0x4de6('0x28')](_0x4de6('0x179'),_0x363788),_0xc3f5b5[_0x4de6('0x78')]?_0xc3f5b5[_0x4de6('0x78')]:_0x4de6('0x17a'));this[_0x4de6('0x3a')][_0x4de6('0xab')](util[_0x4de6('0x28')](_0x4de6('0x17b'),_0x363788),_0xc3f5b5[_0x4de6('0x79')]?_0xc3f5b5['statusMessage']:'OK');if(_0xc3f5b5[_0x4de6('0x6c')]){try{this[_0x4de6('0xa1')](_0xc3f5b5['body'],_0x363788);}catch(_0x3eef89){logger['error'](util[_0x4de6('0x28')](_0x4de6('0x17c'),_0x363788));}}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0xe4'),_0x363788));};AGIVertices['prototype'][_0x4de6('0x17d')]=function(_0x2da091){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x17e'),_0x2da091['label']));return this[_0x4de6('0x3a')][_0x4de6('0x17f')](_0x2da091[_0x4de6('0x180')][_0x4de6('0x5a')](/\s+/g,''),_0x2da091[_0x4de6('0x173')]);};AGIVertices[_0x4de6('0xf')][_0x4de6('0x181')]=function(_0x4586c5){logger[_0x4de6('0x2d')](util['format'](_0x4de6('0x182'),_0x4586c5['label']));return this[_0x4de6('0x3a')][_0x4de6('0x183')](_0x4586c5[_0x4de6('0x67')][_0x4de6('0x5a')](/\s+/g,''),_0x4586c5[_0x4de6('0x173')]);};AGIVertices[_0x4de6('0xf')]['sayphonetic']=function(_0x54ddca){logger['info'](util[_0x4de6('0x28')](_0x4de6('0x184'),_0x54ddca['label']));return this['channel'][_0x4de6('0x185')](_0x54ddca[_0x4de6('0x5e')],_0x54ddca['escape_digits']);};AGIVertices['prototype'][_0x4de6('0x186')]=function(_0x3552ff){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3552ff[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x3552ff[_0x4de6('0x187')])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0x188'));}var _0x3a2d03=this[_0x4de6('0x189')][_0x4de6('0xad')](this,_0x3552ff[_0x4de6('0x187')]);if(!_0x3a2d03||!_0x3a2d03[_0x4de6('0x18a')]){return this[_0x4de6('0x3a')]['error'](_0x3552ff,'no\x20mail\x20account\x20found');}var _0x2b2da3={'from':util[_0x4de6('0x28')](_0x4de6('0x18b'),_0x3a2d03['name'],_0x3a2d03[_0x4de6('0x18c')]||_0x3a2d03[_0x4de6('0x18a')][_0x4de6('0x18d')]),'to':_0x3552ff['to']||'','cc':_0x3552ff['cc']||'','bcc':_0x3552ff['bcc']||'','subject':_0x3552ff[_0x4de6('0x18e')],'html':_0x3552ff[_0x4de6('0x5e')],'text':_0x3552ff['text']};if(this[_0x4de6('0x8a')](_0x3552ff[_0x4de6('0x18f')])){}logger['debug'](_0x4de6('0x190'),JSON['stringify'](_0x2b2da3));this['createSquareDetailsReport'][_0x4de6('0xad')](this,_0x3552ff,_0x3552ff[_0x4de6('0x187')]);this['channel'][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x191'),_0x3a2d03['name']));this[_0x4de6('0x21')][_0x4de6('0xad')](this,_0x3a2d03[_0x4de6('0x192')],_0x2b2da3);return this[_0x4de6('0x3a')][_0x4de6('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4de6('0xf')][_0x4de6('0x193')]=function(_0x4d8a45){logger['info'](util[_0x4de6('0x28')](_0x4de6('0x194'),_0x4d8a45[_0x4de6('0x38')]));return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x195'));};AGIVertices[_0x4de6('0xf')][_0x4de6('0x196')]=function(_0xe44b5f){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x197'),_0xe44b5f[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0xe44b5f[_0x4de6('0x198')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x199'));}var _0x169597=this[_0x4de6('0x33')][_0x4de6('0xad')](this,_0xe44b5f[_0x4de6('0x198')]);if(!_0x169597){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0xe44b5f,_0x4de6('0x19a'));}var _0x297cc4={'body':_0xe44b5f[_0x4de6('0x19b')],'phone':_0xe44b5f['to']||'','SmsAccountId':_0x169597['id']};logger['debug'](_0x4de6('0x19c'),JSON[_0x4de6('0x76')](_0x297cc4));this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0xe44b5f,_0xe44b5f[_0x4de6('0x198')]);this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x19d'),_0x169597[_0x4de6('0x12')]));this[_0x4de6('0x35')][_0x4de6('0xad')](this,_0x297cc4);return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x19e'));};AGIVertices['prototype'][_0x4de6('0x19f')]=function(_0x19dda1){logger[_0x4de6('0x2d')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x19dda1[_0x4de6('0x38')]));if(!this['isConfigured'](_0x19dda1[_0x4de6('0xde')])){return this[_0x4de6('0x3a')]['error'](_0x19dda1,_0x4de6('0x1a0'));}var _0x5225bf=this[_0x4de6('0xa6')]['sync'](this,_0x19dda1[_0x4de6('0xde')]);if(!_0x5225bf){return this[_0x4de6('0x3a')]['error'](_0x19dda1,_0x4de6('0xdf'));}return this['channel'][_0x4de6('0xab')](_0x5225bf,_0x19dda1['variable_value']);};AGIVertices[_0x4de6('0xf')][_0x4de6('0x1a1')]=function(_0x3ffc93){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x1a2'),_0x3ffc93[_0x4de6('0x38')]));this[_0x4de6('0x3a')]['noop'](_0x4de6('0x1a3'));var _0x5e7661=this[_0x4de6('0x3a')][_0x4de6('0xa6')](_0x4de6('0x1a4'));if(!_['isEmpty'](_0x5e7661[_0x4de6('0xa7')])){this['channel'][_0x4de6('0x37')]=_0x5e7661['extra'];}if(_0x3ffc93['answer']==='yes'){this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x1a5'));return this[_0x4de6('0x3a')][_0x4de6('0xbe')]();}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0x1a6'));};AGIVertices[_0x4de6('0xf')]['subproject']=function(_0x843148){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x843148[_0x4de6('0x38')]));if(!this[_0x4de6('0x8a')](_0x843148[_0x4de6('0x1a7')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x843148,_0x4de6('0x1a8'));}var _0x6fe952=this['getSquareProject']['sync'](this,_0x843148[_0x4de6('0x1a7')]);if(!this['isConfigured'](_0x6fe952)){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x843148,util[_0x4de6('0x28')](_0x4de6('0x1a9'),_0x843148[_0x4de6('0x1a7')]));}if(_0x6fe952===this[_0x4de6('0x3a')]['arg_1']){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x843148,_0x4de6('0x1aa'));}this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0x843148,_0x6fe952);var _0x37e509=this['channel'][_0x4de6('0xb0')](_0x4de6('0x1ab'),util[_0x4de6('0x28')](_0x4de6('0x1ac'),config[_0x4de6('0xbb')][_0x4de6('0x1ad')]||_0x4de6('0x1ae'),_0x6fe952,this[_0x4de6('0x3a')][_0x4de6('0x3b')]));if(_0x37e509[_0x4de6('0xa9')]===-0x1){return _0x37e509;}return this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0xca'),_0x4de6('0x1ab'),_0x6fe952));};AGIVertices['prototype']['system']=function(_0x58f714){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x1af'),_0x58f714['label']));var _0xaa89d7=this['shellCommand']['sync'](this,_0x58f714[_0x4de6('0xbd')]);this[_0x4de6('0x36')][_0x4de6('0xad')](this,_0x58f714,_0x58f714[_0x4de6('0xbd')]);if(this[_0x4de6('0x8a')](_0x58f714[_0x4de6('0xde')])){var _0x39d2e1=this[_0x4de6('0xa6')][_0x4de6('0xad')](this,_0x58f714[_0x4de6('0xde')]);if(_0x39d2e1){this[_0x4de6('0x3a')][_0x4de6('0xab')](_0x39d2e1,_0xaa89d7);return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x1b0'),_0x58f714[_0x4de6('0xbd')],_0x39d2e1));}}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')](_0x4de6('0x1b1'),_0x58f714['command']));};AGIVertices['prototype'][_0x4de6('0x1b2')]=function(_0x49eec6){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x1b3'),_0x49eec6[_0x4de6('0x38')]));_0x49eec6['text']=_0x49eec6[_0x4de6('0x5e')][_0x4de6('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x49eec6[_0x4de6('0x5c')])){return this[_0x4de6('0x3a')]['noop'](_0x4de6('0x1b4'));}if(!this[_0x4de6('0x8a')](_0x49eec6[_0x4de6('0x5e')])){return this[_0x4de6('0x3a')][_0x4de6('0xaf')](_0x4de6('0xcd'));}this[_0x4de6('0x3a')][_0x4de6('0xaf')](util[_0x4de6('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x49eec6['text']));var _0x300df0=this['googleCloudTTS'][_0x4de6('0xad')](this,_0x49eec6);if(_0x300df0){this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')](_0x4de6('0x1b5'),_0x300df0));var _0x1e56cd=this['channel'][_0x4de6('0x14c')](_0x300df0);try{fs['unlink'](_0x300df0+_0x4de6('0x107'));}catch(_0x2eea9d){logger[_0x4de6('0x2b')](_0x2eea9d);}return _0x1e56cd;}return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x49eec6,_0x4de6('0x1b6'));};AGIVertices['prototype'][_0x4de6('0x1b7')]=function(_0x21a5ec){logger[_0x4de6('0x2d')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x21a5ec[_0x4de6('0x38')]));_0x21a5ec[_0x4de6('0x5e')]=_0x21a5ec[_0x4de6('0x5e')][_0x4de6('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4de6('0x8a')](_0x21a5ec[_0x4de6('0x5e')])){return this['channel'][_0x4de6('0xaf')](_0x4de6('0xcd'));}this['channel'][_0x4de6('0xaf')](util[_0x4de6('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x21a5ec[_0x4de6('0x5e')]));var _0x544732=this['googleTTS'][_0x4de6('0xad')](this,_0x21a5ec);if(_0x544732){this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x544732));var _0x2e2bf4=this['channel'][_0x4de6('0x14c')](_0x544732);try{fs['unlink'](_0x544732+_0x4de6('0x107'));}catch(_0x3b291e){logger['error'](_0x3b291e);}return _0x2e2bf4;}return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x21a5ec,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x4de6('0x1b8')]=function(_0x1c5778){logger[_0x4de6('0x2d')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1c5778['label']));if(!this[_0x4de6('0x8a')](_0x1c5778[_0x4de6('0x151')])){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x1c5778,_0x4de6('0x14f'));}logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x150'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x1c5778[_0x4de6('0x151')]));var _0x449b79=this[_0x4de6('0x54')][_0x4de6('0xad')](this,_0x1c5778[_0x4de6('0x151')]);if(_0x449b79){logger['info'](util[_0x4de6('0x28')](_0x4de6('0x152'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x1c5778[_0x4de6('0x151')]));this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format'](_0x4de6('0x152'),this[_0x4de6('0x3a')][_0x4de6('0x3c')],_0x1c5778['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x153'),this[_0x4de6('0x3a')]['callerid'],_0x1c5778[_0x4de6('0x151')]));this[_0x4de6('0x3a')]['noop'](util[_0x4de6('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4de6('0x3a')]['callerid'],_0x1c5778[_0x4de6('0x151')]));return{'code':0xc8,'result':_0x4de6('0x156')};}};AGIVertices[_0x4de6('0xf')][_0x4de6('0x1b9')]=function(_0x1bc9ea){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')](_0x4de6('0x1ba'),_0x1bc9ea[_0x4de6('0x38')]));var _0x327486=this['channel'][_0x4de6('0xb0')](_0x4de6('0x1bb'),[_0x1bc9ea[_0x4de6('0x1bc')],_0x1bc9ea[_0x4de6('0x7c')]]);if(_0x327486[_0x4de6('0xa9')]===-0x1){return _0x327486;}return this[_0x4de6('0x3a')][_0x4de6('0xaf')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x1bc9ea[_0x4de6('0x1bc')]));};AGIVertices['prototype']['vswitch']=function(_0x35827a){logger[_0x4de6('0x2d')](util[_0x4de6('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x35827a[_0x4de6('0x38')]));if(!this['isConfigured'](_0x35827a[_0x4de6('0xde')])){return this[_0x4de6('0x3a')]['error'](_0x35827a,'no\x20variable\x20selected');}var _0xe53349=this[_0x4de6('0xa6')]['sync'](this,_0x35827a[_0x4de6('0xde')]);if(!_0xe53349){return this[_0x4de6('0x3a')][_0x4de6('0x2b')](_0x35827a,_0x4de6('0xdf'));}var _0x2b809f=this[_0x4de6('0x3a')][_0x4de6('0xa6')](_0xe53349);return{'code':0xc8,'result':_0x2b809f[_0x4de6('0xa7')]?_0x2b809f[_0x4de6('0xa7')]:'-'};};String[_0x4de6('0xf')][_0x4de6('0xa5')]=function(_0x4702b4,_0x550998){return this[_0x4de6('0xa4')](_0x4702b4)[_0x4de6('0x1bd')](_0x550998);};module[_0x4de6('0x1be')]=AGIVertices; \ No newline at end of file +var _0xd13e=['accountcode','file','createSquareMessage','createCmContact','isEmpty','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','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','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','odbc_id','no\x20odbc\x20database\x20found','replace','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','template_id','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','debug','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','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','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','request-promise','agi','../../config/environment','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','then','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getUserById','getTrunk','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','IntervalId','interval','Intervals','getSoundPath','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority'];(function(_0x48d34e,_0x29037b){var _0x5dd409=function(_0x1a5acb){while(--_0x1a5acb){_0x48d34e['push'](_0x48d34e['shift']());}};_0x5dd409(++_0x29037b);}(_0xd13e,0x193));var _0xed13=function(_0x8d169c,_0x1167eb){_0x8d169c=_0x8d169c-0x0;var _0x21004e=_0xd13e[_0x8d169c];return _0x21004e;};'use strict';var fs=require('fs');var util=require(_0xed13('0x0'));var _=require(_0xed13('0x1'));var sh=require(_0xed13('0x2'));var odbc=require(_0xed13('0x3'))();var rs=require('randomstring');var moment=require(_0xed13('0x4'));var Mustache=require('mustache');var rp=require(_0xed13('0x5'));var logger=require('../../config/logger')(_0xed13('0x6'));var config=require(_0xed13('0x7'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xed13('0x8')];var verticesWithRetry=[_0xed13('0x9'),_0xed13('0xa'),_0xed13('0xb')];var AGIVertices=function(_0x369798,_0x2ba0d2,_0x13372c){this[_0xed13('0xc')]=_0x369798;this[_0xed13('0xd')]=_0x2ba0d2;this['mailRpc']=_0x13372c;};AGIVertices[_0xed13('0xe')][_0xed13('0xf')]=function(_0x11adaf,_0x39575c){this[_0xed13('0xd')]['getVariableById'](_0x11adaf)[_0xed13('0x10')](function(_0x18d7f9){_0x39575c(null,_0x18d7f9?_0x18d7f9[_0xed13('0x11')]:![]);})[_0xed13('0x12')](function(_0x936103){_0x39575c(_0x936103);});};AGIVertices[_0xed13('0xe')]['getVoiceQueue']=function(_0xdee482,_0x4a3ff4){this[_0xed13('0xd')]['getVoiceQueueById'](_0xdee482)[_0xed13('0x10')](function(_0x56108d){_0x4a3ff4(null,_0x56108d?_0x56108d[_0xed13('0x11')]:![]);})['catch'](function(_0x38901a){_0x4a3ff4(_0x38901a);});};AGIVertices[_0xed13('0xe')][_0xed13('0x13')]=function(_0xa260ed,_0x1d0ebf){this[_0xed13('0xd')][_0xed13('0x14')](_0xa260ed)[_0xed13('0x10')](function(_0xc46ae5){_0x1d0ebf(null,_0xc46ae5?_0xc46ae5[_0xed13('0x11')]:![]);})[_0xed13('0x12')](function(_0x31de07){_0x1d0ebf(_0x31de07);});};AGIVertices[_0xed13('0xe')][_0xed13('0x15')]=function(_0x356344,_0x2f38c9){this['rpc']['getSquareOdbcById'](_0x356344)[_0xed13('0x10')](function(_0xfd0dd5){_0x2f38c9(null,_0xfd0dd5?_0xfd0dd5['dsn']:![]);})[_0xed13('0x12')](function(_0x4a85a3){_0x2f38c9(_0x4a85a3);});};AGIVertices['prototype'][_0xed13('0x16')]=function(_0x3a2b76,_0x2d62cd){this[_0xed13('0xd')][_0xed13('0x17')](_0x3a2b76)[_0xed13('0x10')](function(_0x4a5dea){_0x2d62cd(null,_0x4a5dea?_0x4a5dea['name']:![]);})['catch'](function(_0x19d51b){_0x2d62cd(_0x19d51b);});};AGIVertices[_0xed13('0xe')][_0xed13('0x18')]=function(_0x3898d9,_0x1a0458){this[_0xed13('0xd')][_0xed13('0x19')](_0x3898d9)[_0xed13('0x10')](function(_0x2410e2){_0x1a0458(null,_0x2410e2?_0x2410e2[_0xed13('0x11')]:![]);})[_0xed13('0x12')](function(_0x3bc666){_0x1a0458(_0x3bc666);});};AGIVertices[_0xed13('0xe')][_0xed13('0x1a')]=function(_0x4e03d1,_0x5e399c){var _0x12a019=this;this[_0xed13('0xd')]['getSoundById'](_0x4e03d1)[_0xed13('0x10')](function(_0x40444a){_0x5e399c(null,_0x40444a?_0x12a019['getSoundPath'](_0x40444a[_0xed13('0x1b')]):![]);})[_0xed13('0x12')](function(_0x323156){_0x5e399c(_0x323156);});};AGIVertices['prototype'][_0xed13('0x1c')]=function(_0x3b2bf4,_0x489840){this[_0xed13('0xd')][_0xed13('0x1d')](_0x3b2bf4)['then'](function(_0x11cb93){_0x489840(null,_0x11cb93?_0x11cb93:![]);})[_0xed13('0x12')](function(_0x2bcc8b){_0x489840(_0x2bcc8b);});};AGIVertices[_0xed13('0xe')][_0xed13('0x1e')]=function(_0x40660d,_0xe332,_0x5b3828){this[_0xed13('0x1f')]['sendMailMessage'](_0x40660d,_0xe332)['then'](function(){_0x5b3828(null);})[_0xed13('0x12')](function(_0x378fd3){_0x5b3828(_0x378fd3);});};AGIVertices[_0xed13('0xe')]['getIntervals']=function(_0x2ee6e3,_0x2dc3cb){this[_0xed13('0xd')]['getIntervalById'](_0x2ee6e3)[_0xed13('0x10')](function(_0x1c6070){if(_0x1c6070){if(_0x1c6070[_0xed13('0x20')]){_0x2dc3cb(null,[_0x1c6070[_0xed13('0x21')]]);}else{_0x2dc3cb(null,_['map'](_0x1c6070[_0xed13('0x22')],_0xed13('0x21')));}}else{_0x2dc3cb(null,![]);}})[_0xed13('0x12')](function(_0xed7343){_0x2dc3cb(_0xed7343);});};AGIVertices[_0xed13('0xe')][_0xed13('0x23')]=function(_0x4ec2d8){return util[_0xed13('0x24')](_0xed13('0x25'),FILES_PATH,_0x4ec2d8);};AGIVertices[_0xed13('0xe')]['getQueryOdbc']=function(_0x2342a5,_0x31f6e5,_0x59384b){odbc['open'](_0x2342a5,function(_0x49208e){if(_0x49208e){logger[_0xed13('0x26')](_0xed13('0x27'),_0x49208e);_0x59384b(_0x49208e);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xed13('0x28')](_0x31f6e5,function(_0x130aa9,_0x3e7e59){if(_0x130aa9){logger[_0xed13('0x29')](_0xed13('0x2a'),_0x31f6e5);_0x59384b(_0x130aa9);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x31f6e5);odbc[_0xed13('0x2b')](function(_0x487cd0){if(_0x487cd0){logger[_0xed13('0x26')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x487cd0);}_0x59384b(null,_0x3e7e59);});}});}});};AGIVertices[_0xed13('0xe')]['getSmsAccount']=function(_0x4d6429,_0x5edd28){this[_0xed13('0xd')][_0xed13('0x2c')](_0x4d6429)[_0xed13('0x10')](function(_0x42d5f7){_0x5edd28(null,_0x42d5f7?_0x42d5f7:![]);})[_0xed13('0x12')](function(_0x56ae05){_0x5edd28(_0x56ae05);});};AGIVertices[_0xed13('0xe')][_0xed13('0x2d')]=function(_0xa83253,_0x166bf4){this[_0xed13('0xd')]['createSmsMessage'](_0xa83253)[_0xed13('0x10')](function(_0x34df0d){_0x166bf4(null,_0x34df0d);})[_0xed13('0x12')](function(_0x346c9c){_0x166bf4(_0x346c9c);});};AGIVertices[_0xed13('0xe')][_0xed13('0x2e')]=function(_0x535de7,_0x2f04ef,_0x3262ac){this[_0xed13('0xd')][_0xed13('0x2e')]({'uniqueid':this[_0xed13('0xc')][_0xed13('0x2f')],'node':_0x535de7[_0xed13('0x30')],'application':_0x535de7[_0xed13('0x31')],'data':_0x2f04ef||null,'project_name':this[_0xed13('0xc')][_0xed13('0x32')],'callerid':this[_0xed13('0xc')][_0xed13('0x33')]})[_0xed13('0x10')](function(_0x7c97a7){if(_0x3262ac){_0x3262ac(null,_0x7c97a7);}})['catch'](function(_0x1ee94a){if(_0x3262ac){_0x3262ac(_0x1ee94a);}});};AGIVertices[_0xed13('0xe')]['createSquareRecording']=function(_0x18408c,_0xbcaba0,_0x351d76,_0x5e7591){this[_0xed13('0xd')][_0xed13('0x34')]({'uniqueid':this[_0xed13('0xc')]['uniqueid'],'callerid':this['channel'][_0xed13('0x33')],'calleridname':this[_0xed13('0xc')]['calleridname'],'context':this[_0xed13('0xc')][_0xed13('0x35')],'extension':this[_0xed13('0xc')][_0xed13('0x36')],'priority':this['channel'][_0xed13('0x37')],'accountcode':this[_0xed13('0xc')][_0xed13('0x38')],'dnid':this[_0xed13('0xc')]['dnid'],'projectName':this[_0xed13('0xc')]['arg_1'],'saveName':_0xbcaba0,'filename':_0x18408c[_0xed13('0x39')]||_0xbcaba0,'savePath':_0x351d76})['then'](function(_0x5a0828){_0x5e7591(null,_0x5a0828);})[_0xed13('0x12')](function(_0x3c13ee){_0x5e7591(_0x3c13ee);});};AGIVertices['prototype'][_0xed13('0x3a')]=function(_0x2fd788,_0x41df8f,_0x1f2116,_0x561eb1,_0x1d866d){this['rpc'][_0xed13('0x3a')]({'uniqueid':this[_0xed13('0xc')][_0xed13('0x2f')],'body':_0x2fd788,'direction':_0x41df8f,'providerName':_0x1f2116,'providerResponse':_0x561eb1})[_0xed13('0x10')](function(_0x29dab5){if(_0x1d866d){_0x1d866d(null,_0x29dab5);}})[_0xed13('0x12')](function(_0x414df9){if(_0x1d866d){_0x1d866d(_0x414df9);}});};AGIVertices[_0xed13('0xe')]['createCmContact']=function(_0x1aa7b8,_0x38f66d){this[_0xed13('0xd')][_0xed13('0x3b')]({'firstName':_['isEmpty'](_0x1aa7b8[_0xed13('0x11')])||_['isNil'](_0x1aa7b8[_0xed13('0x11')])?'callback_'+Math['random']():_0x1aa7b8['name'],'lastName':_[_0xed13('0x3c')](_0x1aa7b8[_0xed13('0x3d')])||_[_0xed13('0x3e')](_0x1aa7b8['lastName'])?null:_0x1aa7b8[_0xed13('0x3d')],'phone':_0x1aa7b8[_0xed13('0x3f')],'ListId':_0x1aa7b8[_0xed13('0x40')],'scheduledat':_0x1aa7b8[_0xed13('0x41')],'callbackUniqueid':this[_0xed13('0xc')]['uniqueid'],'tags':_0xed13('0x42'),'description':_0xed13('0x43')+_0x1aa7b8[_0xed13('0x41')][_0xed13('0x44')](),'priority':_0x1aa7b8['callback_priority']})[_0xed13('0x10')](function(_0x2d4abf){_0x38f66d(null,_0x2d4abf);})[_0xed13('0x12')](function(_0x24a00d){_0x38f66d(_0x24a00d);});};AGIVertices[_0xed13('0xe')][_0xed13('0x45')]=function(_0x5f0ac3,_0x51fd4b){this[_0xed13('0xd')]['getPauseById'](_0x5f0ac3)[_0xed13('0x10')](function(_0x5c83f3){_0x51fd4b(null,_0x5c83f3?_0x5c83f3[_0xed13('0x11')]:![]);})[_0xed13('0x12')](function(_0x6591ad){_0x51fd4b(_0x6591ad);});};AGIVertices[_0xed13('0xe')][_0xed13('0x46')]=function(_0x50d211,_0x569405,_0x31907c){var _0x380b62={'role':_0xed13('0x47')};_0x380b62[_0x50d211]=this[_0xed13('0xc')][_0xed13('0x33')];this[_0xed13('0xd')][_0xed13('0x46')](_0x380b62,_0x569405,this[_0xed13('0xc')][_0xed13('0x2f')])['then'](function(_0x4bff68){_0x31907c(null,_['isNil'](_0x4bff68)?![]:!![]);})[_0xed13('0x12')](function(_0x292b9b){logger[_0xed13('0x26')](_0x292b9b);_0x31907c(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x154799,_0x3f17d4){var _0x3a7c31={'role':'agent'};_0x3a7c31[_0x154799]=this['channel']['callerid'];this['rpc'][_0xed13('0x48')](_0x3a7c31)[_0xed13('0x10')](function(_0x404fee){_0x3f17d4(null,_['isNil'](_0x404fee)?![]:!![]);})[_0xed13('0x12')](function(_0x435a5f){logger['error'](_0x435a5f);_0x3f17d4(null,![]);});};AGIVertices[_0xed13('0xe')][_0xed13('0x49')]=function(_0x568cc0,_0x28bd7b){var _0xb723e3={'role':_0xed13('0x47')};_0xb723e3[_0x568cc0]=this[_0xed13('0xc')][_0xed13('0x33')];this[_0xed13('0xd')]['agentLogout'](_0xb723e3)[_0xed13('0x10')](function(_0x2fb6ad){_0x28bd7b(null,_[_0xed13('0x3e')](_0x2fb6ad)?![]:!![]);})[_0xed13('0x12')](function(_0x57d0fa){logger['error'](_0x57d0fa);_0x28bd7b(null,![]);});};AGIVertices['prototype'][_0xed13('0x4a')]=function(_0x3b589b,_0x5c5833){var _0x19a2a4={'role':_0xed13('0x47')};_0x19a2a4[_0x3b589b]=this[_0xed13('0xc')][_0xed13('0x33')];var _0x1b28fd=_0x3b589b!=_0xed13('0x4b')?util[_0xed13('0x24')](_0xed13('0x4c'),_0xed13('0x4d'),this[_0xed13('0xc')][_0xed13('0x33')]):undefined;this[_0xed13('0xd')][_0xed13('0x4a')](_0x19a2a4,_0x1b28fd)['then'](function(_0x90b96c){_0x5c5833(null,_[_0xed13('0x3e')](_0x90b96c)?![]:!![]);})[_0xed13('0x12')](function(_0x260372){logger[_0xed13('0x26')](_0x260372);_0x5c5833(null,![]);});};AGIVertices[_0xed13('0xe')][_0xed13('0x4e')]=function(_0x52d2ba,_0x4f7a33){sh[_0xed13('0x4f')](_[_0xed13('0x50')](_0x52d2ba),function(_0x37b244,_0xedef4d){var _0x312e03=_0xedef4d['replace'](/(\r\n|\n|\r)/gm,'');_0x4f7a33(null,_0x312e03);});};AGIVertices['prototype'][_0xed13('0x51')]=function(_0x2b1285,_0x25cbd2){scripts[_0xed13('0x51')](_0x2b1285[_0xed13('0x52')],_0x2b1285['google_cloud_tts_text_type']||_0xed13('0x53'),_0x2b1285[_0xed13('0x53')],_0x2b1285[_0xed13('0x54')]||_0xed13('0x55'),_0x2b1285[_0xed13('0x56')]||_0xed13('0x57'),_0x2b1285[_0xed13('0x58')]||_0xed13('0x59'))[_0xed13('0x10')](function(_0x3ad30e){_0x25cbd2(null,_0x3ad30e);})[_0xed13('0x12')](function(_0x1a8aa0){_0x25cbd2(_0x1a8aa0);});};AGIVertices[_0xed13('0xe')][_0xed13('0x5a')]=function(_0x57c172,_0x134463){scripts[_0xed13('0x5a')](_0x57c172[_0xed13('0x53')],_0x57c172[_0xed13('0x5b')]||'en',0x1)['then'](function(_0x57f5e3){_0x134463(null,_0x57f5e3);})[_0xed13('0x12')](function(_0x5b0264){_0x134463(_0x5b0264);});};AGIVertices[_0xed13('0xe')][_0xed13('0x5c')]=function(_0x5e0551,_0x521c36){var _0x3eefce={'uri':_0x5e0551[_0xed13('0x5d')],'method':_0x5e0551[_0xed13('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5e0551[_0xed13('0x5f')])===_0xed13('0x60')&&parseInt(_0x5e0551['timeout'])>=0x1?parseInt(_0x5e0551[_0xed13('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0xed13('0x61')]([_0xed13('0x62'),_0xed13('0x63')],_0x3eefce[_0xed13('0x5e')]['toUpperCase']())){try{_0x3eefce[_0xed13('0x64')]=_0x5e0551[_0xed13('0x8')]?JSON[_0xed13('0x65')](_0x5e0551['rawBody']):{};}catch(_0x31b065){logger[_0xed13('0x26')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x31b065);}}try{_0x3eefce[_0xed13('0x66')]=_0x5e0551['rawHeaders']?JSON['parse'](_0x5e0551[_0xed13('0x67')]):{};}catch(_0x148d91){logger['error'](_0xed13('0x68'),_0x148d91);}if(_0x5e0551[_0xed13('0x69')]){try{var _0x410a12=require(_0x5e0551[_0xed13('0x69')])[_0xed13('0x6a')](this,_0x3eefce);_0x3eefce['uri']=Mustache[_0xed13('0x6b')](_0x5e0551[_0xed13('0x5d')],_0x410a12,{},['$$','$$']);if(_0x3eefce[_0xed13('0x66')]){_0x3eefce[_0xed13('0x66')]=JSON['parse'](Mustache[_0xed13('0x6b')](JSON[_0xed13('0x6c')](_0x3eefce[_0xed13('0x66')]),_0x410a12,{},['$$','$$']));}if(_0x3eefce[_0xed13('0x64')]){_0x3eefce[_0xed13('0x64')]=JSON[_0xed13('0x65')](Mustache['render'](JSON[_0xed13('0x6c')](_0x3eefce[_0xed13('0x64')]),_0x410a12,{},['$$','$$']));}}catch(_0x4b62d5){logger['error'](_0xed13('0x6d'),_0x4b62d5);}}rp(_0x3eefce)[_0xed13('0x10')](function(_0x29ce69){var _0x4316ae={'statusCode':_0x29ce69[_0xed13('0x6e')]||0xc8,'statusMessage':_0x29ce69[_0xed13('0x6f')]||'OK','headers':_0x29ce69[_0xed13('0x66')]||{},'body':_0x29ce69['body']||{}};_0x521c36(null,_0x4316ae);})[_0xed13('0x12')](function(_0x52bcc2){var _0x499647={'statusCode':_0x52bcc2[_0xed13('0x6e')]||0x1f4,'statusMessage':_0x52bcc2[_0xed13('0x70')]||_0xed13('0x71'),'headers':_0x52bcc2[_0xed13('0x72')][_0xed13('0x66')]||{},'body':_0x52bcc2['options'][_0xed13('0x64')]||{}};_0x521c36(null,_0x499647);});};AGIVertices['prototype']['googleDialogflow']=function(_0x17950a,_0x52455b){scripts['googleDialogflow'](this[_0xed13('0xc')][_0xed13('0x2f')],_0x17950a[_0xed13('0x73')],_0x17950a[_0xed13('0x53')],_0x17950a[_0xed13('0x74')]||'en')[_0xed13('0x10')](function(_0x24025f){_0x52455b(null,_0x24025f);})[_0xed13('0x12')](function(_0x18b1a0){_0x52455b(_0x18b1a0);});};AGIVertices[_0xed13('0xe')]['googleDialogflowV2']=function(_0x495ada,_0x577539){scripts[_0xed13('0x75')](this['channel']['uniqueid'],_0x495ada[_0xed13('0x76')],_0x495ada[_0xed13('0x77')],_0x495ada[_0xed13('0x78')],_0x495ada[_0xed13('0x53')],_0x495ada['dialogflowV2_language']||'en')[_0xed13('0x10')](function(_0x51f14c){_0x577539(null,_0x51f14c);})[_0xed13('0x12')](function(_0x535b5d){_0x577539(_0x535b5d);});};AGIVertices[_0xed13('0xe')][_0xed13('0x79')]=function(_0x4abed7,_0x52ac1d){scripts['sestekNDA'](this[_0xed13('0xc')],_0x4abed7)[_0xed13('0x10')](function(_0x3cb4ec){_0x52ac1d(null,_0x3cb4ec);})[_0xed13('0x12')](function(_0x4f120e){_0x52ac1d(_0x4f120e);});};AGIVertices['prototype']['ispeechTTS']=function(_0x5d2535,_0x13cc9f){scripts[_0xed13('0x7a')](_0x5d2535['key'],_0x5d2535[_0xed13('0x53')],_0x5d2535[_0xed13('0x7b')]||_0xed13('0x55'),_0x5d2535['speed'])['then'](function(_0x33b0d5){_0x13cc9f(null,_0x33b0d5);})[_0xed13('0x12')](function(_0xb838f2){_0x13cc9f(_0xb838f2);});};AGIVertices[_0xed13('0xe')]['ispeechASR']=function(_0x5aac50,_0x51bece,_0x2e849d){scripts[_0xed13('0x7c')](_0x51bece,_0x5aac50[_0xed13('0x73')],_0x5aac50[_0xed13('0x7d')]||_0xed13('0x55'),this[_0xed13('0x7e')](_0x5aac50[_0xed13('0x7f')])?_0x5aac50[_0xed13('0x7f')]:undefined)['then'](function(_0x3d5ccf){_0x2e849d(null,_0x3d5ccf);})[_0xed13('0x12')](function(_0x17dc13){_0x2e849d(_0x17dc13);});};AGIVertices[_0xed13('0xe')]['awsPolly']=function(_0x605034,_0x3e50e9){scripts['awsPolly'](_0x605034[_0xed13('0x80')],_0x605034[_0xed13('0x81')],_0x605034[_0xed13('0x82')],_0x605034[_0xed13('0x83')]||_0xed13('0x84'),_0x605034[_0xed13('0x53')],_0x605034[_0xed13('0x85')]||_0xed13('0x53'))[_0xed13('0x10')](function(_0x1fb2c3){_0x3e50e9(null,_0x1fb2c3);})[_0xed13('0x12')](function(_0x4f8daf){_0x3e50e9(_0x4f8daf);});};AGIVertices[_0xed13('0xe')]['awsLex']=function(_0x1ae106,_0xb4b23){scripts['awsLex'](this[_0xed13('0xc')][_0xed13('0x2f')],_0x1ae106['aws_access_key_id'],_0x1ae106[_0xed13('0x81')],_0x1ae106[_0xed13('0x86')],_0x1ae106[_0xed13('0x53')],_0x1ae106[_0xed13('0x87')])[_0xed13('0x10')](function(_0x4b03b6){_0xb4b23(null,_0x4b03b6);})[_0xed13('0x12')](function(_0x34e8f4){_0xb4b23(_0x34e8f4);});};AGIVertices['prototype'][_0xed13('0x88')]=function(_0x14dc2a,_0x4c8db7,_0x2f1bcc){scripts['googleASR'](_0x4c8db7,_0x14dc2a[_0xed13('0x73')],_0x14dc2a['google_asr_language']||'en-US')['then'](function(_0x60f4d0){_0x2f1bcc(null,_0x60f4d0);})[_0xed13('0x12')](function(_0x57d65f){_0x2f1bcc(_0x57d65f);});};AGIVertices[_0xed13('0xe')][_0xed13('0x89')]=function(_0x4eb5e6,_0x57be37,_0x5105b8){scripts['tildeASR'](_0x57be37,_0x4eb5e6[_0xed13('0x8a')],_0x4eb5e6[_0xed13('0x8b')],_0x4eb5e6['uri'])['then'](function(_0x4c3221){_0x5105b8(null,_0x4c3221);})[_0xed13('0x12')](function(_0x2e1b27){_0x5105b8(_0x2e1b27);});};AGIVertices['prototype']['clear']=function(_0x4fd052){var _0x421849=_[_0xed13('0x61')](verticesWithRetry,_0x4fd052['agicommand'])?_0x4fd052:_[_0xed13('0x8c')](_0x4fd052);for(var _0x25574f in _0x421849){if(_0x421849[_0xed13('0x8d')](_0x25574f)){if(_0x421849[_0x25574f]&&_[_0xed13('0x8e')](_0x421849[_0x25574f])){if(_[_0xed13('0x61')](recursiveMapAttributes,_0x25574f)){_0x421849[_0x25574f]=this[_0xed13('0x8f')](_0x421849[_0x25574f]);}else{_0x421849[_0x25574f]=this[_0xed13('0x90')](_0x421849[_0x25574f]);}}}}return _0x421849;};AGIVertices[_0xed13('0xe')][_0xed13('0x91')]=function(_0x46c2c6){for(var _0x34b1f0 in _0x46c2c6){if(_0x46c2c6[_0xed13('0x8d')](_0x34b1f0)){if(_[_0xed13('0x92')](_0x46c2c6[_0x34b1f0])){this[_0xed13('0x91')](_0x46c2c6[_0x34b1f0]);}else if(_['isArray'](_0x46c2c6[_0x34b1f0])){for(var _0x63db4c=0x0;_0x63db4c<_0x46c2c6[_0x34b1f0][_0xed13('0x93')];_0x63db4c++){this[_0xed13('0x91')](_0x46c2c6[_0x34b1f0][_0x63db4c]);}}else if(_[_0xed13('0x8e')](_0x46c2c6[_0x34b1f0])){_0x46c2c6[_0x34b1f0]=this[_0xed13('0x90')](_0x46c2c6[_0x34b1f0]);}}}};AGIVertices[_0xed13('0xe')][_0xed13('0x94')]=function(_0x143617,_0xe58480){for(var _0x679415 in _0x143617){if(_0x143617[_0xed13('0x8d')](_0x679415)){if(_[_0xed13('0x92')](_0x143617[_0x679415])){if(!_[_0xed13('0x3c')](_0x143617[_0x679415])){this['saveRestApiResult'](_0x143617[_0x679415],util[_0xed13('0x24')](_0xed13('0x95'),_0xe58480,_0x679415));}}else if(_[_0xed13('0x96')](_0x143617[_0x679415])){for(var _0x4d13d0=0x0;_0x4d13d0<_0x143617[_0x679415]['length'];_0x4d13d0++){this['saveRestApiResult'](_0x143617[_0x679415][_0x4d13d0],util['format'](_0xed13('0x95'),_0xe58480,_0x679415+'['+_0x4d13d0+']'));}}else{if(!_[_0xed13('0x3e')](_0x143617[_0x679415])){this[_0xed13('0xc')][_0xed13('0x97')](util[_0xed13('0x24')](_0xed13('0x95'),_0xe58480,_0x679415),_0x143617[_0x679415]);}}}}};AGIVertices[_0xed13('0xe')][_0xed13('0x8f')]=function(_0xa8128e){try{var _0x51661a=JSON['parse'](_0xa8128e);this[_0xed13('0x91')](_0x51661a);return JSON[_0xed13('0x6c')](_0x51661a);}catch(_0x4e2288){return this[_0xed13('0x90')](_0xa8128e);}};AGIVertices[_0xed13('0xe')]['replaceAllVariables']=function(_0x5d53c3){var _0x5a8cd3=_0x5d53c3['split']('{');for(var _0x4095b2=0x1;_0x4095b2<_0x5a8cd3[_0xed13('0x93')];_0x4095b2+=0x1){var _0x1fc358=_0x5a8cd3[_0x4095b2][_0xed13('0x98')]('}');if(_0x1fc358[_0xed13('0x93')]>0x1){_0x5d53c3=_0x5d53c3[_0xed13('0x99')]('{'+_0x1fc358[0x0]+'}',this[_0xed13('0xc')][_0xed13('0xf')](_0x1fc358[0x0])[_0xed13('0x9a')]||_0x1fc358[0x0]);}}if(_0x5a8cd3[_0xed13('0x93')]===0x1){return _0x5d53c3[_0xed13('0x44')]();}return this['replaceAllVariables'](_0x5d53c3);};AGIVertices[_0xed13('0xe')][_0xed13('0x9b')]=function(_0x18ca10,_0x3c720d){var _0x1e10bc=this[_0xed13('0xc')][_0xed13('0xf')](_0x18ca10);if(_0x1e10bc[_0xed13('0x9c')]===-0x1){return _0x1e10bc;}logger['info'](util['format'](_0xed13('0x9d'),_0x3c720d,_0x1e10bc['extra']));return this[_0xed13('0xc')][_0xed13('0x97')](_0x3c720d,_0x1e10bc['extra']);};AGIVertices['prototype'][_0xed13('0x7e')]=function(_0x14d945){return _0x14d945&&_0x14d945!=='0'&&_0x14d945!=='-1'&&_0x14d945!=='';};AGIVertices[_0xed13('0xe')][_0xed13('0x9e')]=function(_0x24e694){this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x24e694,'-');_0x24e694[_0xed13('0x9f')]=_0x24e694[_0xed13('0x9e')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x335ef7){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xa0'),_0x335ef7[_0xed13('0x30')]));if(!this['isConfigured'](_0x335ef7[_0xed13('0x53')])){return this['channel'][_0xed13('0xa1')](_0xed13('0xa2'));}var _0x4bf3c6='\x22'+_0x335ef7['text']+'\x22';if(this[_0xed13('0x7e')](_0x335ef7[_0xed13('0x72')])){_0x4bf3c6+=','+_0x335ef7[_0xed13('0x72')];}var _0x4072a6=this[_0xed13('0xc')][_0xed13('0x4f')]('MRCPSynth',_0x4bf3c6);if(_0x4072a6[_0xed13('0x9c')]===-0x1){return _0x4072a6;}return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xa3'),_0x4bf3c6));};AGIVertices[_0xed13('0xe')][_0xed13('0xa4')]=function(_0x4bcc5f){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xa5'),_0x4bcc5f[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x4bcc5f[_0xed13('0xa6')])){return this[_0xed13('0xc')]['noop']('no\x20grammar\x20configured');}var _0xd7b355=_0x4bcc5f['grammar'];if(this[_0xed13('0x7e')](_0x4bcc5f['options'])){_0xd7b355+=','+_0x4bcc5f['options'];}var _0x293c36=this[_0xed13('0xc')][_0xed13('0x4f')](_0xed13('0xa7'),_0xd7b355);if(_0x293c36[_0xed13('0x9c')]===-0x1){return _0x293c36;}var _0x34c2ce=this[_0xed13('0x9b')](_0xed13('0xa8'),'MRCP_RECOG_CONFIDENCE');if(_0x34c2ce[_0xed13('0x9c')]===-0x1){return _0x34c2ce;}var _0x3b3831=this['getAndSetVariable'](_0xed13('0xa9'),_0xed13('0xaa'));if(_0x3b3831[_0xed13('0x9c')]===-0x1){return _0x3b3831;}var _0x57342b=this[_0xed13('0x9b')]('RECOG_INSTANCE()',_0xed13('0xab'));if(_0x57342b[_0xed13('0x9c')]===-0x1){return _0x57342b;}return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xac'),_0xd7b355));};AGIVertices[_0xed13('0xe')]['agi']=function(_0x5c79d4){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xad'),_0x5c79d4[_0xed13('0x30')]));return this['channel'][_0xed13('0x6')]([_0x5c79d4[_0xed13('0xae')],_0x5c79d4['args']]);};AGIVertices[_0xed13('0xe')][_0xed13('0xaf')]=function(_0x3280b2){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xb0'),_0x3280b2[_0xed13('0x30')]));if(this[_0xed13('0x7e')](_0x3280b2[_0xed13('0x5f')])){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3280b2[_0xed13('0x5f')]));var _0x5981e5=this[_0xed13('0xc')]['wait'](_0x3280b2[_0xed13('0x5f')]);if(_0x5981e5['result']===-0x1){return _0x5981e5;}}return this[_0xed13('0xc')][_0xed13('0xaf')]();};AGIVertices['prototype']['callback']=function(_0x392b3b){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x392b3b[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x392b3b[_0xed13('0x40')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x392b3b,_0xed13('0xb1'));}_0x392b3b[_0xed13('0x41')]=moment();if(this[_0xed13('0x7e')](_0x392b3b[_0xed13('0xb2')])){_0x392b3b[_0xed13('0x41')]=moment()['add'](_0x392b3b[_0xed13('0xb2')],_0xed13('0xb3'));}if(!this['isConfigured'](_0x392b3b[_0xed13('0xb4')])){_0x392b3b[_0xed13('0xb4')]=0x2;}this[_0xed13('0x3b')][_0xed13('0x6a')](this,_0x392b3b);return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xb5'),_0x392b3b['phone'],_0x392b3b[_0xed13('0x40')],_0x392b3b[_0xed13('0x41')]));};AGIVertices[_0xed13('0xe')][_0xed13('0xb6')]=function(_0x2cce15){logger['info'](util[_0xed13('0x24')](_0xed13('0xb7'),_0x2cce15[_0xed13('0x30')]));var _0x30a900=this[_0xed13('0xc')][_0xed13('0x4f')](_0x2cce15[_0xed13('0xb8')],_0x2cce15['options']);if(_0x30a900[_0xed13('0x9c')]===-0x1){return _0x30a900;}return this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')]('Executed\x20command\x20%s\x20%s',_0x2cce15[_0xed13('0xb8')],_0x2cce15[_0xed13('0x72')]));};AGIVertices['prototype'][_0xed13('0xb9')]=function(_0x4327bd){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xba'),_0x4327bd[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x4327bd[_0xed13('0x53')])){return this[_0xed13('0xc')]['noop'](_0xed13('0xa2'));}var _0x1f06cd='\x22'+_0x4327bd[_0xed13('0x53')]+'\x22';if(this[_0xed13('0x7e')](_0x4327bd['options'])){_0x1f06cd+=','+_0x4327bd[_0xed13('0x72')];}var _0x5d365e=this['channel'][_0xed13('0x4f')](_0xed13('0xbb'),_0x1f06cd);if(_0x5d365e[_0xed13('0x9c')]===-0x1){return _0x5d365e;}return this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xa3'),_0x1f06cd));};AGIVertices[_0xed13('0xe')][_0xed13('0xbc')]=function(_0xf40c6a){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xbd'),_0xf40c6a[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0xf40c6a[_0xed13('0x53')])){return this['channel'][_0xed13('0xa1')](_0xed13('0xa2'));}var _0x27c055='\x22'+_0xf40c6a[_0xed13('0x53')]+'\x22';if(this[_0xed13('0x7e')](_0xf40c6a[_0xed13('0x72')])){_0x27c055+=','+_0xf40c6a[_0xed13('0x72')];}var _0x57e888=this[_0xed13('0xc')]['exec']('MRCPSynth',_0x27c055);if(_0x57e888[_0xed13('0x9c')]===-0x1){return _0x57e888;}return this['channel']['noop'](util[_0xed13('0x24')](_0xed13('0xa3'),_0x27c055));};AGIVertices[_0xed13('0xe')][_0xed13('0xbe')]=function(_0x2ec85a){logger[_0xed13('0x29')](util['format'](_0xed13('0xbf'),_0x2ec85a['label']));if(!this[_0xed13('0x7e')](_0x2ec85a[_0xed13('0xa6')])){return this['channel'][_0xed13('0xa1')](_0xed13('0xc0'));}var _0x3f99a2=_0x2ec85a['grammar'];if(this[_0xed13('0x7e')](_0x2ec85a[_0xed13('0x72')])){_0x3f99a2+=','+_0x2ec85a[_0xed13('0x72')];}var _0x16f5c7=this['channel']['exec'](_0xed13('0xa7'),_0x3f99a2);if(_0x16f5c7[_0xed13('0x9c')]===-0x1){return _0x16f5c7;}var _0x5404cc=this['getAndSetVariable'](_0xed13('0xa8'),_0xed13('0xc1'));if(_0x5404cc[_0xed13('0x9c')]===-0x1){return _0x5404cc;}var _0x1d6da1=this[_0xed13('0x9b')]('RECOG_INPUT()',_0xed13('0xc2'));if(_0x1d6da1[_0xed13('0x9c')]===-0x1){return _0x1d6da1;}var _0x33cf9c=this[_0xed13('0x9b')](_0xed13('0xc3'),'LUMENVOX_ASR_INSTANCE');if(_0x33cf9c[_0xed13('0x9c')]===-0x1){return _0x33cf9c;}return this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3f99a2));};AGIVertices['prototype'][_0xed13('0xc4')]=function(_0x1433f2){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xc5'),_0x1433f2[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x1433f2[_0xed13('0xa6')])){return this[_0xed13('0xc')]['noop']('no\x20grammar\x20configured');}var _0x3108c5=_0x1433f2[_0xed13('0xa6')];if(this[_0xed13('0x7e')](_0x1433f2[_0xed13('0x72')])){_0x3108c5+=','+_0x1433f2[_0xed13('0x72')];}var _0x486722=this[_0xed13('0xc')]['exec'](_0xed13('0xa7'),_0x3108c5);if(_0x486722[_0xed13('0x9c')]===-0x1){return _0x486722;}var _0x6099ce=this['getAndSetVariable'](_0xed13('0xa8'),_0xed13('0xc6'));if(_0x6099ce[_0xed13('0x9c')]===-0x1){return _0x6099ce;}var _0x2f3b6d=this[_0xed13('0x9b')](_0xed13('0xa9'),_0xed13('0xc7'));if(_0x2f3b6d[_0xed13('0x9c')]===-0x1){return _0x2f3b6d;}var _0xfecd34=this['getAndSetVariable'](_0xed13('0xc3'),'SESTEK_ASR_INSTANCE');if(_0xfecd34[_0xed13('0x9c')]===-0x1){return _0xfecd34;}return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xac'),_0x3108c5));};AGIVertices[_0xed13('0xe')][_0xed13('0xc8')]=function(_0x33c053){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x33c053[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x33c053[_0xed13('0xc9')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x33c053,'no\x20database\x20selected');}var _0x46d69f=this[_0xed13('0x15')][_0xed13('0x6a')](this,_0x33c053[_0xed13('0xc9')]);if(!_0x46d69f){return this[_0xed13('0xc')][_0xed13('0x26')](_0x33c053,_0xed13('0xca'));}if(!this[_0xed13('0x7e')](_0x33c053[_0xed13('0x28')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x33c053,'no\x20query\x20configured');}var _0x43bf7a=_0x33c053[_0xed13('0x28')][_0xed13('0xcb')](/(\r\n|\n|\r)/gm,'\x20');this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')](_0xed13('0xcc'),_0x43bf7a));var _0x32ad40=this['getQueryOdbc'][_0xed13('0x6a')](this,_0x46d69f,_0x43bf7a);this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x33c053,_0x43bf7a);if(!this[_0xed13('0x7e')](_0x33c053[_0xed13('0xcd')])){return this[_0xed13('0xc')][_0xed13('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x59fae7=this[_0xed13('0xf')][_0xed13('0x6a')](this,_0x33c053[_0xed13('0xcd')]);if(!_0x59fae7){return this[_0xed13('0xc')][_0xed13('0x26')](_0x33c053,_0xed13('0xce'));}var _0x3dfb84=this;_0x32ad40['forEach'](function(_0x4647dc,_0x563b6b){Object['keys'](_0x4647dc)[_0xed13('0xcf')](function(_0x4d8172){_0x3dfb84[_0xed13('0xc')][_0xed13('0x97')](util['format']('%s[%s][%s]',_0x59fae7,_0x563b6b,_0x4d8172),_0x4647dc[_0x4d8172]);});});this[_0xed13('0xc')][_0xed13('0x97')](util[_0xed13('0x24')](_0xed13('0xd0'),_0x59fae7),_0x32ad40[_0xed13('0x93')]);return this[_0xed13('0xc')]['noop'](util['format'](_0xed13('0xd1'),_0x59fae7));};AGIVertices[_0xed13('0xe')][_0xed13('0xd2')]=function(_0x8db1fe){logger['debug'](util[_0xed13('0x24')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x8db1fe[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x8db1fe['sip_id'])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x8db1fe,_0xed13('0xd3'));}var _0x5be451=this[_0xed13('0x16')][_0xed13('0x6a')](this,_0x8db1fe[_0xed13('0xd4')]);if(!_0x5be451){return this['channel'][_0xed13('0x26')](_0x8db1fe,_0xed13('0xd5'));}var _0x5c8af8=this['channel'][_0xed13('0x4f')]('DIAL',[util['format'](_0xed13('0xd6'),_0x5be451),_0x8db1fe[_0xed13('0x5f')],_0x8db1fe['opts'],_0x8db1fe['url']]);if(_0x5c8af8['result']===-0x1){return _0x5c8af8;}return this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')]('Executed\x20command\x20%s',_0xed13('0xd7')));};AGIVertices[_0xed13('0xe')][_0xed13('0xd8')]=function(_0x4677f2){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xd9'),_0x4677f2[_0xed13('0x30')]));if(!this['isConfigured'](_0x4677f2['key'])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xda'));}if(!this[_0xed13('0x7e')](_0x4677f2[_0xed13('0x53')])){return this[_0xed13('0xc')][_0xed13('0xa1')]('no\x20text\x20configured');}this[_0xed13('0xc')][_0xed13('0xdb')]=!![];this[_0xed13('0x2e')](_0x4677f2);this[_0xed13('0x3a')](_0x4677f2[_0xed13('0x53')],'in','','');this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')]('Trying\x20Dialogflow:\x20%s',_0x4677f2[_0xed13('0x53')]));var _0x5016a2=this['googleDialogflow'][_0xed13('0x6a')](this,_0x4677f2);if(_0x5016a2){for(var _0x58c097 in _0x5016a2){if(_0x5016a2[_0xed13('0x8d')](_0x58c097)){this[_0xed13('0xc')]['setVariable'](util[_0xed13('0x24')](_0xed13('0xdc'),_0x58c097[_0xed13('0xdd')]()),_0x5016a2[_0x58c097]);}}this[_0xed13('0x3a')](_0x5016a2[_0xed13('0xde')],_0xed13('0xdf'),_0xed13('0xd8'),'');return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xe0'),_0x5016a2[_0xed13('0xde')]));}return this[_0xed13('0xc')][_0xed13('0x26')](_0x4677f2,_0xed13('0xe1'));};AGIVertices[_0xed13('0xe')][_0xed13('0xe2')]=function(_0x12380e){logger[_0xed13('0x29')](util['format'](_0xed13('0xe3'),_0x12380e[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x12380e[_0xed13('0x76')])){return this['channel'][_0xed13('0xa1')](_0xed13('0xe4'));}if(!this['isConfigured'](_0x12380e[_0xed13('0x77')])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xe5'));}if(!this[_0xed13('0x7e')](_0x12380e[_0xed13('0x78')])){return this[_0xed13('0xc')]['noop'](_0xed13('0xe6'));}if(!this['isConfigured'](_0x12380e['dialogflowV2_language'])){return this[_0xed13('0xc')]['noop'](_0xed13('0xe7'));}if(!this[_0xed13('0x7e')](_0x12380e[_0xed13('0x53')])){return this[_0xed13('0xc')]['noop'](_0xed13('0xa2'));}this[_0xed13('0xc')][_0xed13('0xdb')]=!![];this[_0xed13('0x2e')](_0x12380e);this['createSquareMessage'](_0x12380e[_0xed13('0x53')],'in','','');this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xe8'),_0x12380e[_0xed13('0x53')]));var _0x1cd8de=this['googleDialogflowV2'][_0xed13('0x6a')](this,_0x12380e);if(_0x1cd8de){for(var _0x1e2c49 in _0x1cd8de){if(_0x1cd8de[_0xed13('0x8d')](_0x1e2c49)){if(_0x1e2c49!==_0xed13('0xe9')){this[_0xed13('0xc')][_0xed13('0x97')](util[_0xed13('0x24')]('DIALOGFLOW_%s',_0x1e2c49[_0xed13('0xdd')]()),_0x1cd8de[_0x1e2c49]);}}}this[_0xed13('0x3a')](_0x1cd8de[_0xed13('0xde')],'out','dialogflowV2',_0x1cd8de[_0xed13('0xe9')]);return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xea'),_0x1cd8de['speech']));}return this[_0xed13('0xc')]['error'](_0x12380e,_0xed13('0xeb'));};AGIVertices['prototype'][_0xed13('0xec')]=function(_0x22f5fb){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xed'),_0x22f5fb[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x22f5fb['ndauth_url'])){return this[_0xed13('0xc')]['noop'](_0xed13('0xee'));}if(!this[_0xed13('0x7e')](_0x22f5fb[_0xed13('0xef')])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xf0'));}if(!this['isConfigured'](_0x22f5fb['password'])){return this['channel'][_0xed13('0xa1')](_0xed13('0xf1'));}if(!this[_0xed13('0x7e')](_0x22f5fb[_0xed13('0xf2')])){return this['channel'][_0xed13('0xa1')](_0xed13('0xa2'));}this[_0xed13('0xc')][_0xed13('0xdb')]=!![];this[_0xed13('0x2e')](_0x22f5fb);this[_0xed13('0x3a')](_0x22f5fb['text'],'in','','');this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')](_0xed13('0xf3'),_0x22f5fb[_0xed13('0x53')]));var _0x569b09=this[_0xed13('0x79')][_0xed13('0x6a')](this,_0x22f5fb);if(_0x569b09){for(var _0x249a02 in _0x569b09){if(_0x569b09[_0xed13('0x8d')](_0x249a02)){this['channel'][_0xed13('0x97')](util['format'](_0xed13('0xf4'),_0x249a02[_0xed13('0xdd')]()),_0x569b09[_0x249a02]);}}this[_0xed13('0x3a')](_0x569b09[_0xed13('0xde')],_0xed13('0xdf'),_0xed13('0xec'),'');if(_0x569b09[_0xed13('0xf5')]){this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xf6'),_0x569b09[_0xed13('0xf5')]));var _0x54475d=this[_0xed13('0xc')][_0xed13('0xf7')](_0x569b09[_0xed13('0xf5')]);try{fs[_0xed13('0xf8')](_0x569b09[_0xed13('0xf5')]+_0xed13('0xf9'));}catch(_0x278969){logger[_0xed13('0x26')](_0x278969);}return _0x54475d;}else{return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0xfa'),_0x569b09[_0xed13('0xde')]));}}return this[_0xed13('0xc')]['error'](_0x22f5fb,_0xed13('0xfb'));};AGIVertices[_0xed13('0xe')][_0xed13('0xfc')]=function(_0x1ba961){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0xfd'),_0x1ba961[_0xed13('0x30')]));return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xfc'));};AGIVertices[_0xed13('0xe')][_0xed13('0xfe')]=function(_0x35d392){logger['info'](util[_0xed13('0x24')](_0xed13('0xff'),_0x35d392[_0xed13('0x30')]));var _0xa8c8fe='';if(_0x35d392[_0xed13('0x100')]){if(!this[_0xed13('0x7e')](_0x35d392[_0xed13('0x100')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x35d392,_0xed13('0x101'));}else{var _0x491da8=parseInt(_0x35d392[_0xed13('0x100')],0xa);if(isNaN(_0x491da8)){_0xa8c8fe=_0x35d392['trunk_id'];}else{_0xa8c8fe=this[_0xed13('0x18')]['sync'](this,_0x35d392[_0xed13('0x100')]);if(!_0xa8c8fe){return this[_0xed13('0xc')][_0xed13('0x26')](_0x35d392,'no\x20trunk\x20found');}}}}else if(_0x35d392[_0xed13('0x102')]){_0xa8c8fe=_0x35d392[_0xed13('0x102')];}else{return this[_0xed13('0xc')]['error'](_0x35d392,_0xed13('0x101'));}var _0x5d9020=this['channel']['exec'](_0xed13('0xd7'),[util[_0xed13('0x24')](_0xed13('0x103'),_0xa8c8fe,_0x35d392['phone']),_0x35d392['timeout'],_0x35d392[_0xed13('0x104')],_0x35d392[_0xed13('0x5d')]]);if(_0x5d9020[_0xed13('0x9c')]===-0x1){return _0x5d9020;}return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x105'),_0xed13('0xd7')));};AGIVertices[_0xed13('0xe')]['finally']=function(_0x31071a){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x31071a['label']));return this['channel']['noop']('finally');};AGIVertices['prototype'][_0xed13('0xa')]=function(_0x3b02d8){logger[_0xed13('0x29')](util['format'](_0xed13('0x106'),_0x3b02d8['label']));if(_0x3b02d8[_0xed13('0x9f')]===0x0){return this['maxRetry'](_0x3b02d8);}_0x3b02d8[_0xed13('0x9f')]-=0x1;if(!this[_0xed13('0x7e')](_0x3b02d8['file_id'])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x3b02d8,_0xed13('0x107'));}var _0x50751c=this[_0xed13('0x1a')][_0xed13('0x6a')](this,_0x3b02d8[_0xed13('0x108')]);if(!_0x50751c){return this[_0xed13('0xc')]['error'](_0x3b02d8,_0xed13('0x109'));}if(!this[_0xed13('0x7e')](_0x3b02d8[_0xed13('0xcd')])){return this[_0xed13('0xc')]['error'](_0xed13('0x10a'));}var _0x8bf8d5=this[_0xed13('0xc')]['getData'](_0x50751c,_0x3b02d8[_0xed13('0x10b')],_0x3b02d8[_0xed13('0x10c')]);var _0x5974d2=_0x8bf8d5[_0xed13('0x9c')]?_0x8bf8d5['result'][_0xed13('0x44')]():'';logger[_0xed13('0x29')](_0xed13('0x10d'),JSON[_0xed13('0x6c')](_0x8bf8d5));if(_0x8bf8d5['result']===-0x1){this['createSquareDetailsReport'][_0xed13('0x6a')](this,_0x3b02d8,_0x5974d2);return _0x8bf8d5;}else if(_0x8bf8d5[_0xed13('0x9a')]===_0xed13('0x5f')){_0x8bf8d5[_0xed13('0x9c')]=_0x5974d2[_0xed13('0x93')]>=parseInt(_0x3b02d8[_0xed13('0x10e')])?'x':'i';}else{_0x8bf8d5['result']=_0x5974d2[_0xed13('0x93')]>=parseInt(_0x3b02d8[_0xed13('0x10e')])&&_0x5974d2[_0xed13('0x93')]<=parseInt(_0x3b02d8[_0xed13('0x10c')])?'x':'i';}var _0x5ead7b=this[_0xed13('0xf')][_0xed13('0x6a')](this,_0x3b02d8[_0xed13('0xcd')]);if(!_0x5ead7b){return this[_0xed13('0xc')][_0xed13('0x26')](_0x3b02d8,'no\x20variable\x20found');}this[_0xed13('0xc')][_0xed13('0x97')](_0x5ead7b,_0x5974d2);if(this[_0xed13('0x7e')](_0x3b02d8['hiddendigitsnum'])){var _0x2927f8=parseInt(_0x3b02d8[_0xed13('0x10f')],0xa);var _0x5029ab=rs[_0xed13('0x110')]({'charset':'*','length':_0x2927f8});var _0x27ed23=_0x5974d2[_0xed13('0x93')];if(_0x27ed23>0x0){if(_0x27ed23>_0x2927f8){this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x3b02d8,_0x3b02d8[_0xed13('0x111')]===_0xed13('0x112')?_0x5029ab+_0x5974d2[_0xed13('0x113')](_0x2927f8):_0x5974d2[_0xed13('0x113')](0x0,_0x27ed23-_0x2927f8)+_0x5029ab);}else{this[_0xed13('0x2e')]['sync'](this,_0x3b02d8,rs[_0xed13('0x110')]({'charset':'*','length':_0x27ed23}));}}else{this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x3b02d8,'');}}else{this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x3b02d8,_0x5974d2);}return _0x8bf8d5;};AGIVertices[_0xed13('0xe')][_0xed13('0xb')]=function(_0x35363e){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x35363e[_0xed13('0x30')]));return this[_0xed13('0xa')](_0x35363e);};AGIVertices['prototype'][_0xed13('0x114')]=function(_0x14b2d3){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x115'),_0x14b2d3['label']));this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x14b2d3,_0x14b2d3[_0xed13('0x116')]);return this[_0xed13('0xc')][_0xed13('0xa1')](util['format'](_0xed13('0x117'),_0x14b2d3[_0xed13('0x116')]));};AGIVertices['prototype'][_0xed13('0x118')]=function(_0x54a354){logger[_0xed13('0x29')](util['format'](_0xed13('0x119'),_0x54a354[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x54a354[_0xed13('0x80')])||!this[_0xed13('0x7e')](_0x54a354[_0xed13('0x81')])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0x11a'));}if(!this[_0xed13('0x7e')](_0x54a354[_0xed13('0x53')])){return this['channel'][_0xed13('0xa1')](_0xed13('0xa2'));}this['channel']['noop'](util['format'](_0xed13('0x11b'),_0x54a354[_0xed13('0x53')]));var _0x1392c2=this[_0xed13('0x11c')][_0xed13('0x6a')](this,_0x54a354);if(_0x1392c2){this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x11d'),_0x1392c2));var _0x3874db=this[_0xed13('0xc')][_0xed13('0xf7')](_0x1392c2);try{fs[_0xed13('0xf8')](_0x1392c2+'.wav');}catch(_0x204f37){logger[_0xed13('0x26')](_0x204f37);}return _0x3874db;}return this[_0xed13('0xc')][_0xed13('0x26')](_0x54a354,_0xed13('0x11e'));};AGIVertices[_0xed13('0xe')][_0xed13('0x11f')]=function(_0x31f431){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x120'),_0x31f431[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x31f431[_0xed13('0x80')])||!this['isConfigured'](_0x31f431[_0xed13('0x81')])){return this['channel'][_0xed13('0xa1')](_0xed13('0x11a'));}if(!this[_0xed13('0x7e')](_0x31f431[_0xed13('0x87')])){return this[_0xed13('0xc')][_0xed13('0xa1')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x31f431[_0xed13('0x53')])){return this['channel'][_0xed13('0xa1')]('no\x20text\x20configured');}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x31f431);this['createSquareMessage'](_0x31f431[_0xed13('0x53')],'in','','');this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x121'),_0x31f431[_0xed13('0x53')]));var _0x35f923=this[_0xed13('0x122')]['sync'](this,_0x31f431);if(_0x35f923){for(var _0x1bc8e3 in _0x35f923){if(_0x35f923[_0xed13('0x8d')](_0x1bc8e3)&&_[_0xed13('0x8e')](_0x35f923[_0x1bc8e3])){this['channel'][_0xed13('0x97')](util['format'](_0xed13('0x123'),_0x1bc8e3[_0xed13('0xdd')]()),_0x35f923[_0x1bc8e3]);}}if(_[_0xed13('0x3e')](_0x35f923['message'])){return this[_0xed13('0xc')]['noop'](_0xed13('0x124'));}else{this[_0xed13('0x3a')](_0x35f923['message'],_0xed13('0xdf'),'amazonlex','');return this[_0xed13('0xc')][_0xed13('0xa1')](util['format'](_0xed13('0x125'),_0x35f923[_0xed13('0x70')]));}}return this[_0xed13('0xc')][_0xed13('0x26')](_0x31f431,_0xed13('0x126'));};AGIVertices[_0xed13('0xe')][_0xed13('0x127')]=function(_0x106aad){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x128'),_0x106aad['label'],_0x106aad[_0xed13('0x5f')]));if(!this['isConfigured'](_0x106aad[_0xed13('0x73')])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xda'));}var _0x1aa7f1=_0xed13('0x129');var _0x3a3fe3=util['format'](_0xed13('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x5d92d9=util[_0xed13('0x24')](_0xed13('0x95'),_0x3a3fe3,_0x1aa7f1);var _0x28c095=!![];if(_0x106aad[_0xed13('0x12b')]===_0xed13('0x12c')){_0x28c095=![];}var _0xf7060f=this[_0xed13('0xc')]['recordFile'](_0x3a3fe3,_0x1aa7f1,_0x106aad['intKey'],_0x106aad[_0xed13('0x5f')],undefined,_0x28c095);if(_0xf7060f[_0xed13('0x9c')]!==-0x1){this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x12d'),_0x5d92d9));var _0xa711e0=this['googleASR'][_0xed13('0x6a')](this,_0x106aad,_0x5d92d9);if(_0xa711e0){for(var _0x25fe41 in _0xa711e0){if(_0xa711e0[_0xed13('0x8d')](_0x25fe41)){this[_0xed13('0xc')]['setVariable'](util[_0xed13('0x24')]('GOOGLE_ASR_%s',_0x25fe41['toUpperCase']()),_0xa711e0[_0x25fe41]);}}return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x12e'),JSON[_0xed13('0x6c')](_0xa711e0)));}}return _0xf7060f;};AGIVertices[_0xed13('0xe')][_0xed13('0x12f')]=function(_0x541833){logger[_0xed13('0x29')](util['format'](_0xed13('0x130'),_0x541833['label']));if(!this[_0xed13('0x7e')](_0x541833[_0xed13('0x8a')])){return this['channel'][_0xed13('0xa1')](_0xed13('0x131'));}if(!this[_0xed13('0x7e')](_0x541833[_0xed13('0x8b')])){return this['channel']['noop'](_0xed13('0x132'));}var _0x15f76b='wav';var _0x5f43bf=util['format'](_0xed13('0x12a'),FILES_PATH,rs[_0xed13('0x110')](0x4));var _0x3664b7=util[_0xed13('0x24')](_0xed13('0x95'),_0x5f43bf,_0x15f76b);var _0x3b774e=!![];if(_0x541833[_0xed13('0x12b')]===_0xed13('0x12c')){_0x3b774e=![];}var _0x450d49=this[_0xed13('0xc')][_0xed13('0x133')](_0x5f43bf,_0x15f76b,_0x541833['intKey'],_0x541833[_0xed13('0x5f')],undefined,_0x3b774e);if(_0x450d49[_0xed13('0x9c')]!==-0x1){this[_0xed13('0xc')]['noop'](util['format'](_0xed13('0x134'),_0x3664b7));var _0x570551=this[_0xed13('0x89')][_0xed13('0x6a')](this,_0x541833,_0x3664b7);if(_0x570551){for(var _0x30678d in _0x570551){if(_0x570551[_0xed13('0x8d')](_0x30678d)){this[_0xed13('0xc')][_0xed13('0x97')](util[_0xed13('0x24')](_0xed13('0x135'),_0x30678d[_0xed13('0xdd')]()),_0x570551[_0x30678d]);}}return this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x136'),JSON[_0xed13('0x6c')](_0x570551)));}}return _0x450d49;};AGIVertices['prototype'][_0xed13('0x137')]=function(_0x55a3da){logger[_0xed13('0x29')](util['format'](_0xed13('0x138'),_0x55a3da[_0xed13('0x30')]));return this[_0xed13('0xc')][_0xed13('0x139')](_0x55a3da['context'],_0x55a3da[_0xed13('0x36')],_0x55a3da[_0xed13('0x37')]);};AGIVertices[_0xed13('0xe')][_0xed13('0x13a')]=function(_0x2f4545){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2f4545[_0xed13('0x30')]));if(!this['isConfigured'](_0x2f4545[_0xed13('0x13b')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x2f4545,_0xed13('0x13c'));}try{var _0x16fc96=eval(_0x2f4545[_0xed13('0x13b')])?'true':_0xed13('0x13d');this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')](_0xed13('0x13e'),_0x2f4545[_0xed13('0x13b')],_0x16fc96));return{'code':0xc8,'result':_0x16fc96};}catch(_0x58075c){return{'code':0xc8,'result':_0xed13('0x13d')};}};AGIVertices[_0xed13('0xe')][_0xed13('0x13f')]=function(_0x5e451c){logger['info'](util[_0xed13('0x24')](_0xed13('0x140'),_0x5e451c[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x5e451c[_0xed13('0x141')])){return this[_0xed13('0xc')]['error'](_0x5e451c,_0xed13('0x142'));}var _0x361903=this[_0xed13('0x143')][_0xed13('0x6a')](this,_0x5e451c[_0xed13('0x141')]);if(!_0x361903){return this[_0xed13('0xc')][_0xed13('0x26')](_0x5e451c,'no\x20intervals\x20found');}for(var _0x4862dd=0x0;_0x4862dd<_0x361903[_0xed13('0x93')];_0x4862dd+=0x1){var _0x3e8cb7=this[_0xed13('0xc')][_0xed13('0xf')](util[_0xed13('0x24')]('IFTIME(%s?true:false)',_0x361903[_0x4862dd]));if(_0x3e8cb7['result']===-0x1){return _0x3e8cb7;}logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x144'),_0x361903[_0x4862dd],_0x3e8cb7['extra']));if(_0x3e8cb7['extra']===_0xed13('0x145')){logger[_0xed13('0x29')](util['format'](_0xed13('0x144'),_0x361903[_0x4862dd],_0xed13('0x145')));this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x144'),_0x361903[_0x4862dd],_0xed13('0x145')));return{'code':0xc8,'result':_0xed13('0x145')};}else{logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x144'),_0x361903[_0x4862dd],'false'));this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')]('IFTIME\x20%s\x20%s',_0x361903[_0x4862dd],_0xed13('0x13d')));}}return{'code':0xc8,'result':_0xed13('0x13d')};};AGIVertices[_0xed13('0xe')][_0xed13('0x146')]=function(_0x12612d){logger['info'](util[_0xed13('0x24')](_0xed13('0x147'),_0x12612d[_0xed13('0x30')]));return this['channel'][_0xed13('0x146')]();};AGIVertices[_0xed13('0xe')][_0xed13('0x148')]=function(_0x944c87){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x149'),_0x944c87[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x944c87[_0xed13('0x73')])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xda'));}var _0x41d027=_0xed13('0x129');var _0x5606c4=util[_0xed13('0x24')]('%s/recordings/%s',FILES_PATH,rs[_0xed13('0x110')](0x4));var _0x24e20b=util[_0xed13('0x24')](_0xed13('0x95'),_0x5606c4,_0x41d027);var _0x294e5c=!![];if(_0x944c87[_0xed13('0x12b')]===_0xed13('0x12c')){_0x294e5c=![];}var _0x116832=this[_0xed13('0xc')][_0xed13('0x133')](_0x5606c4,_0x41d027,_0x944c87[_0xed13('0x14a')],_0x944c87[_0xed13('0x5f')],undefined,_0x294e5c);if(_0x116832['result']!==-0x1){this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')]('ispeech\x20%s\x20file\x20created',_0x24e20b));var _0x4faa71=this['ispeechASR']['sync'](this,_0x944c87,_0x24e20b);if(_0x4faa71){for(var _0x53c508 in _0x4faa71){if(_0x4faa71[_0xed13('0x8d')](_0x53c508)){this['channel'][_0xed13('0x97')](util[_0xed13('0x24')]('ISPEECH_ASR_%s',_0x53c508[_0xed13('0xdd')]()),_0x4faa71[_0x53c508]);}}return this['channel'][_0xed13('0xa1')](util['format'](_0xed13('0x14b'),JSON[_0xed13('0x6c')](_0x4faa71)));}}return _0x116832;};AGIVertices[_0xed13('0xe')][_0xed13('0x14c')]=function(_0x440e80){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x14d'),_0x440e80['label']));if(!this[_0xed13('0x7e')](_0x440e80[_0xed13('0x73')])){return this['channel']['noop'](_0xed13('0xda'));}if(!this[_0xed13('0x7e')](_0x440e80[_0xed13('0x53')])){return this['channel'][_0xed13('0xa1')](_0xed13('0xa2'));}this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x14e'),_0x440e80['text']));var _0x34acb5=this[_0xed13('0x7a')][_0xed13('0x6a')](this,_0x440e80);if(_0x34acb5){this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')](_0xed13('0x14f'),_0x34acb5));var _0x3d534d=this[_0xed13('0xc')][_0xed13('0xf7')](_0x34acb5,_0x440e80['intKey']);try{fs['unlink'](_0x34acb5+_0xed13('0xf9'));}catch(_0x3be232){logger[_0xed13('0x26')](_0x3be232);}return _0x3d534d;}return this[_0xed13('0xc')][_0xed13('0x26')](_0x440e80,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xed13('0xe')]['login']=function(_0x1e6561){logger[_0xed13('0x29')](util['format'](_0xed13('0x150'),_0x1e6561['label']));if(!this[_0xed13('0x7e')](_0x1e6561[_0xed13('0x151')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x1e6561,_0xed13('0x152'));}logger[_0xed13('0x29')](util[_0xed13('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xed13('0xc')]['callerid'],_0x1e6561['findBy']));var _0x575883=this['agentLogin'][_0xed13('0x6a')](this,_0x1e6561[_0xed13('0x151')]);if(_0x575883){logger[_0xed13('0x29')](util['format'](_0xed13('0x153'),this[_0xed13('0xc')][_0xed13('0x33')],_0x1e6561[_0xed13('0x151')]));this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x153'),this[_0xed13('0xc')][_0xed13('0x33')],_0x1e6561['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xed13('0x29')](util[_0xed13('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xed13('0x33')],_0x1e6561[_0xed13('0x151')]));this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x154'),this[_0xed13('0xc')]['callerid'],_0x1e6561[_0xed13('0x151')]));return{'code':0xc8,'result':_0xed13('0x155')};}};AGIVertices[_0xed13('0xe')][_0xed13('0x156')]=function(_0x4f1c31){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x157'),_0x4f1c31[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x4f1c31[_0xed13('0x151')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x4f1c31,_0xed13('0x152'));}logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x158'),this['channel'][_0xed13('0x33')],_0x4f1c31[_0xed13('0x151')]));var _0x2509ec=this[_0xed13('0x49')]['sync'](this,_0x4f1c31[_0xed13('0x151')]);if(_0x2509ec){logger[_0xed13('0x29')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xed13('0xc')][_0xed13('0x33')],_0x4f1c31[_0xed13('0x151')]));this['channel'][_0xed13('0xa1')](util['format'](_0xed13('0x153'),this[_0xed13('0xc')][_0xed13('0x33')],_0x4f1c31['findBy']));return{'code':0xc8,'result':_0xed13('0x159')};}else{logger[_0xed13('0x29')](util[_0xed13('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xed13('0xc')][_0xed13('0x33')],_0x4f1c31[_0xed13('0x151')]));this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x154'),this[_0xed13('0xc')][_0xed13('0x33')],_0x4f1c31[_0xed13('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xed13('0xe')][_0xed13('0x15a')]=function(_0xe3ac00){logger[_0xed13('0x29')](util['format'](_0xed13('0x15b'),_0xe3ac00[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0xe3ac00[_0xed13('0x15c')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0xe3ac00,_0xed13('0x15d'));}this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')](_0xed13('0x15e'),_0xe3ac00[_0xed13('0x15c')]));var _0x5ecead=eval(_0xe3ac00[_0xed13('0x15c')]);if(!this[_0xed13('0x7e')](_0xe3ac00[_0xed13('0xcd')])){return this['channel'][_0xed13('0xa1')](_0xed13('0x10a'));}var _0x4b7d7c=this[_0xed13('0xf')][_0xed13('0x6a')](this,_0xe3ac00[_0xed13('0xcd')]);if(!_0x4b7d7c){return this['channel'][_0xed13('0x26')](_0xe3ac00,_0xed13('0xce'));}if(_['isArray'](_0x5ecead)){var _0x464748=this;_0x5ecead[_0xed13('0xcf')](function(_0x30da63,_0x4f07ee){_0x464748[_0xed13('0xc')][_0xed13('0x97')](util[_0xed13('0x24')]('%s[%s]',_0x4b7d7c,_0x4f07ee),_0x30da63);});return this[_0xed13('0xc')]['noop'](util['format'](_0xed13('0x15f'),_0x4b7d7c));}else{return this[_0xed13('0xc')][_0xed13('0x97')](_0x4b7d7c,_0x5ecead);}};AGIVertices[_0xed13('0xe')][_0xed13('0x9')]=function(_0x316ff5){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x160'),_0x316ff5[_0xed13('0x30')]));if(_0x316ff5[_0xed13('0x9f')]===0x0){return this[_0xed13('0x9e')](_0x316ff5);}_0x316ff5[_0xed13('0x9f')]-=0x1;if(!this[_0xed13('0x7e')](_0x316ff5[_0xed13('0x108')])){return this['channel'][_0xed13('0x26')](_0x316ff5,_0xed13('0x107'));}var _0x2ee03f=this[_0xed13('0x1a')][_0xed13('0x6a')](this,_0x316ff5[_0xed13('0x108')]);if(!_0x2ee03f){return this[_0xed13('0xc')][_0xed13('0x26')](_0x316ff5,_0xed13('0x109'));}var _0x510e3c=this[_0xed13('0xc')]['getData'](_0x2ee03f,_0x316ff5[_0xed13('0x10b')],_0x316ff5[_0xed13('0x161')]);var _0x3ac19c=_0x510e3c[_0xed13('0x9c')];if(_0x510e3c['result']===-0x1){this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x316ff5,'-1');return _0x510e3c;}else if(_0x510e3c['extra']===_0xed13('0x5f')){_0x510e3c[_0xed13('0x9c')]=_0x510e3c['result']['length']>0x0?_0x510e3c[_0xed13('0x9c')]:'t';}else if(_[_0xed13('0x3c')](_0x510e3c['result'])){_0x510e3c[_0xed13('0x9c')]='#';_0x3ac19c='#';}if(!this[_0xed13('0x7e')](_0x316ff5[_0xed13('0xcd')])){this[_0xed13('0xc')][_0xed13('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x180cbd=this['getVariable'][_0xed13('0x6a')](this,_0x316ff5[_0xed13('0xcd')]);if(!_0x180cbd){return this[_0xed13('0xc')][_0xed13('0x26')](_0x316ff5,_0xed13('0xce'));}this[_0xed13('0xc')]['setVariable'](_0x180cbd,_0x3ac19c);}this[_0xed13('0x2e')]['sync'](this,_0x316ff5,_0x3ac19c);return _0x510e3c;};AGIVertices[_0xed13('0xe')]['noop']=function(_0x34650e){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x162'),_0x34650e[_0xed13('0x30')]));return this['channel'][_0xed13('0xa1')](_0x34650e[_0xed13('0x163')]||_0x34650e['label']);};AGIVertices['prototype']['pause']=function(_0x2c3158){logger['info'](util[_0xed13('0x24')](_0xed13('0x164'),_0x2c3158[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x2c3158[_0xed13('0x151')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x2c3158,'no\x20find\x20by\x20configured');}logger['info'](util[_0xed13('0x24')](_0xed13('0x158'),this[_0xed13('0xc')][_0xed13('0x33')],_0x2c3158[_0xed13('0x151')]));var _0x8af44b=this[_0xed13('0x45')][_0xed13('0x6a')](this,_0x2c3158[_0xed13('0x165')]);var _0x2457d1=this[_0xed13('0x46')][_0xed13('0x6a')](this,_0x2c3158[_0xed13('0x151')],_0x8af44b);if(_0x2457d1){logger[_0xed13('0x29')](util['format'](_0xed13('0x153'),this[_0xed13('0xc')]['callerid'],_0x2c3158['findBy']));this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xed13('0xc')][_0xed13('0x33')],_0x2c3158['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x154'),this[_0xed13('0xc')][_0xed13('0x33')],_0x2c3158[_0xed13('0x151')]));this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x153'),this[_0xed13('0xc')]['callerid'],_0x2c3158[_0xed13('0x151')]));return{'code':0xc8,'result':_0xed13('0x155')};}};AGIVertices[_0xed13('0xe')][_0xed13('0x166')]=function(_0x5916a4){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x167'),_0x5916a4[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x5916a4[_0xed13('0x108')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x5916a4,_0xed13('0x107'));}var _0x122892=this[_0xed13('0x1a')][_0xed13('0x6a')](this,_0x5916a4[_0xed13('0x108')]);if(!_0x122892){return this[_0xed13('0xc')][_0xed13('0x26')](_0x5916a4,_0xed13('0x109'));}var _0x418adc=this['channel'][_0xed13('0x4f')](_0xed13('0x168'),[_0x122892,_0x5916a4['opts']]);if(_0x418adc['result']===-0x1){return _0x418adc;}return this[_0xed13('0xc')][_0xed13('0xa1')](util['format'](_0xed13('0x169'),'PLAYBACK',_0x122892));};AGIVertices[_0xed13('0xe')][_0xed13('0x16a')]=function(_0x37fcc2){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x37fcc2[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x37fcc2['queue_id'])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x37fcc2,_0xed13('0x16b'));}var _0x3c1df4='';var _0xe12ad4=parseInt(_0x37fcc2[_0xed13('0x16c')],0xa);if(isNaN(_0xe12ad4)){_0x3c1df4=_0x37fcc2['queue_id'];}else{_0x3c1df4=this[_0xed13('0x16d')][_0xed13('0x6a')](this,_0x37fcc2[_0xed13('0x16c')]);if(!_0x3c1df4){return this[_0xed13('0xc')][_0xed13('0x26')](_0x37fcc2,_0xed13('0x16e'));}}var _0x27de58='';if(this[_0xed13('0x7e')](_0x37fcc2[_0xed13('0x108')])){var _0x452cd6=this[_0xed13('0x1a')][_0xed13('0x6a')](this,_0x37fcc2['file_id']);if(_0x452cd6){_0x27de58=_0x452cd6;}}this['createSquareDetailsReport'][_0xed13('0x6a')](this,_0x37fcc2,_0x3c1df4);if(_0x37fcc2['opts'][_0xed13('0x16f')]('x')<0x0){_0x37fcc2[_0xed13('0x104')]+='x';}if(_0x37fcc2[_0xed13('0x104')][_0xed13('0x16f')]('X')<0x0){_0x37fcc2[_0xed13('0x104')]+='X';}this['channel'][_0xed13('0x97')](_0xed13('0x170'),_0x3c1df4?_0x3c1df4[_0xed13('0x171')]():'');var _0x149afe=this[_0xed13('0xc')][_0xed13('0x4f')](_0xed13('0x172'),[_0x3c1df4,_0x37fcc2[_0xed13('0x104')],_0x37fcc2[_0xed13('0x5d')],_0x27de58,_0x37fcc2['timeout'],_0x37fcc2['agi'],_0x37fcc2[_0xed13('0x173')],_0x37fcc2[_0xed13('0x174')],'',_0x37fcc2['position']]);if(_0x149afe['result']===-0x1){return _0x149afe;}return this[_0xed13('0xc')][_0xed13('0xa1')](util['format'](_0xed13('0x169'),'QUEUE',_0x3c1df4));};AGIVertices[_0xed13('0xe')][_0xed13('0x175')]=function(_0x279889){logger['info'](util[_0xed13('0x24')](_0xed13('0x176'),_0x279889[_0xed13('0x30')]));var _0x52139b=_0x279889[_0xed13('0x177')]||_0xed13('0x129');var _0x21ae1c=util[_0xed13('0x24')](_0xed13('0x178'),this[_0xed13('0xc')][_0xed13('0x2f')],rs[_0xed13('0x110')](0x5));var _0x243332=util[_0xed13('0x24')]('%s/recordings/%s.%s',FILES_PATH,_0x21ae1c,_0x52139b);var _0x483edc=util[_0xed13('0x24')]('%s/recordings/%s',FILES_PATH,_0x21ae1c);this[_0xed13('0x34')][_0xed13('0x6a')](this,_0x279889,_0x21ae1c,_0x243332);this['channel'][_0xed13('0x97')](_0xed13('0x179'),_0x21ae1c);logger[_0xed13('0x29')](_0xed13('0x17a'),_0x483edc,_0x52139b,_0x279889[_0xed13('0x17b')],_0x279889[_0xed13('0x5f')]);return this[_0xed13('0xc')][_0xed13('0x133')](_0x483edc,_0x52139b,_0x279889[_0xed13('0x17b')],_0x279889[_0xed13('0x5f')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x4ba752){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x17c'),_0x4ba752[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x4ba752[_0xed13('0x5d')])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0x17d'));}var _0x3eadd1=this[_0xed13('0x5c')][_0xed13('0x6a')](this,_0x4ba752);logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x17e'),util[_0xed13('0x17f')](_0x3eadd1,{'showHidden':![],'depth':null})));if(!this[_0xed13('0x7e')](_0x4ba752[_0xed13('0xcd')])){return this['channel']['noop'](_0xed13('0x180'));}var _0x1c212d=this[_0xed13('0xf')]['sync'](this,_0x4ba752[_0xed13('0xcd')]);if(!_0x1c212d){return this['channel'][_0xed13('0x26')](_0x4ba752,_0xed13('0xce'));}this['channel'][_0xed13('0x97')](util[_0xed13('0x24')](_0xed13('0x181'),_0x1c212d),_0x3eadd1[_0xed13('0x6e')]?_0x3eadd1[_0xed13('0x6e')]:_0xed13('0x182'));this[_0xed13('0xc')][_0xed13('0x97')](util['format'](_0xed13('0x183'),_0x1c212d),_0x3eadd1[_0xed13('0x6f')]?_0x3eadd1[_0xed13('0x6f')]:'OK');if(_0x3eadd1[_0xed13('0x64')]){try{this[_0xed13('0x94')](_0x3eadd1[_0xed13('0x64')],_0x1c212d);}catch(_0x4b25eb){logger[_0xed13('0x26')](util[_0xed13('0x24')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1c212d));}}return this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')](_0xed13('0xd1'),_0x1c212d));};AGIVertices[_0xed13('0xe')][_0xed13('0x184')]=function(_0x185e16){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x185'),_0x185e16[_0xed13('0x30')]));return this[_0xed13('0xc')][_0xed13('0x186')](_0x185e16[_0xed13('0x187')][_0xed13('0xcb')](/\s+/g,''),_0x185e16[_0xed13('0x17b')]);};AGIVertices[_0xed13('0xe')][_0xed13('0x188')]=function(_0x3bbdb6){logger['info'](util[_0xed13('0x24')](_0xed13('0x189'),_0x3bbdb6[_0xed13('0x30')]));return this[_0xed13('0xc')][_0xed13('0x18a')](_0x3bbdb6[_0xed13('0x60')][_0xed13('0xcb')](/\s+/g,''),_0x3bbdb6[_0xed13('0x17b')]);};AGIVertices[_0xed13('0xe')][_0xed13('0x18b')]=function(_0x36a3cc){logger['info'](util[_0xed13('0x24')](_0xed13('0x18c'),_0x36a3cc['label']));return this[_0xed13('0xc')][_0xed13('0x18d')](_0x36a3cc['text'],_0x36a3cc[_0xed13('0x17b')]);};AGIVertices[_0xed13('0xe')][_0xed13('0x18e')]=function(_0x47224b){logger[_0xed13('0x29')](util[_0xed13('0x24')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x47224b[_0xed13('0x30')]));if(!this['isConfigured'](_0x47224b[_0xed13('0x18f')])){return this[_0xed13('0xc')][_0xed13('0xa1')]('no\x20mail\x20account\x20configured');}var _0x301d5a=this['getMailAccount'][_0xed13('0x6a')](this,_0x47224b[_0xed13('0x18f')]);if(!_0x301d5a||!_0x301d5a[_0xed13('0x190')]){return this[_0xed13('0xc')][_0xed13('0x26')](_0x47224b,_0xed13('0x191'));}var _0x5e7a96={'from':util['format'](_0xed13('0x192'),_0x301d5a[_0xed13('0x11')],_0x301d5a['email']||_0x301d5a[_0xed13('0x190')][_0xed13('0x193')]),'to':_0x47224b['to']||'','cc':_0x47224b['cc']||'','bcc':_0x47224b[_0xed13('0x194')]||'','subject':_0x47224b['subject'],'html':_0x47224b[_0xed13('0x53')],'text':_0x47224b[_0xed13('0x53')]};if(this[_0xed13('0x7e')](_0x47224b[_0xed13('0x195')])){}logger['debug']('sendMail\x20message',JSON[_0xed13('0x6c')](_0x5e7a96));this['createSquareDetailsReport'][_0xed13('0x6a')](this,_0x47224b,_0x47224b['account_id']);this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x301d5a[_0xed13('0x11')]));this[_0xed13('0x1e')][_0xed13('0x6a')](this,_0x301d5a['smtpOptions'],_0x5e7a96);return this[_0xed13('0xc')][_0xed13('0xa1')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xed13('0xe')][_0xed13('0x196')]=function(_0x5dfd6a){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x197'),_0x5dfd6a[_0xed13('0x30')]));return this[_0xed13('0xc')]['noop'](_0xed13('0x198'));};AGIVertices['prototype'][_0xed13('0x199')]=function(_0x2e5335){logger['info'](util[_0xed13('0x24')](_0xed13('0x19a'),_0x2e5335[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x2e5335['sms_account_id'])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0x19b'));}var _0xbf349c=this[_0xed13('0x19c')][_0xed13('0x6a')](this,_0x2e5335['sms_account_id']);if(!_0xbf349c){return this[_0xed13('0xc')][_0xed13('0x26')](_0x2e5335,_0xed13('0x19d'));}var _0x33687c={'body':_0x2e5335['sms_text'],'phone':_0x2e5335['to']||'','SmsAccountId':_0xbf349c['id']};logger[_0xed13('0x19e')](_0xed13('0x19f'),JSON[_0xed13('0x6c')](_0x33687c));this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x2e5335,_0x2e5335[_0xed13('0x1a0')]);this[_0xed13('0xc')]['noop'](util['format'](_0xed13('0x1a1'),_0xbf349c[_0xed13('0x11')]));this[_0xed13('0x2d')][_0xed13('0x6a')](this,_0x33687c);return this['channel'][_0xed13('0xa1')](_0xed13('0x1a2'));};AGIVertices['prototype'][_0xed13('0x1a3')]=function(_0x37eb92){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x1a4'),_0x37eb92['label']));if(!this[_0xed13('0x7e')](_0x37eb92[_0xed13('0xcd')])){return this[_0xed13('0xc')]['error'](_0x37eb92,_0xed13('0x1a5'));}var _0x3831f1=this[_0xed13('0xf')][_0xed13('0x6a')](this,_0x37eb92[_0xed13('0xcd')]);if(!_0x3831f1){return this['channel']['error'](_0x37eb92,'no\x20variable\x20found');}return this[_0xed13('0xc')][_0xed13('0x97')](_0x3831f1,_0x37eb92[_0xed13('0x1a6')]);};AGIVertices[_0xed13('0xe')][_0xed13('0x1a7')]=function(_0x2ed4b5){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x1a8'),_0x2ed4b5[_0xed13('0x30')]));this[_0xed13('0xc')][_0xed13('0xa1')]('START\x20CALLY\x20SQUARE');var _0x5be722=this[_0xed13('0xc')]['getVariable'](_0xed13('0x1a9'));if(!_[_0xed13('0x3c')](_0x5be722[_0xed13('0x9a')])){this[_0xed13('0xc')]['uniqueid']=_0x5be722[_0xed13('0x9a')];}if(_0x2ed4b5['answer']==='yes'){this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0x1aa'));return this[_0xed13('0xc')][_0xed13('0xaf')]();}return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0x1ab'));};AGIVertices[_0xed13('0xe')][_0xed13('0x1ac')]=function(_0x2a4119){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x1ad'),_0x2a4119[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x2a4119[_0xed13('0x1ae')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x2a4119,_0xed13('0x1af'));}var _0x5d39bb=this[_0xed13('0x13')][_0xed13('0x6a')](this,_0x2a4119['project_id']);if(!this[_0xed13('0x7e')](_0x5d39bb)){return this[_0xed13('0xc')][_0xed13('0x26')](_0x2a4119,util['format'](_0xed13('0x1b0'),_0x2a4119[_0xed13('0x1ae')]));}if(_0x5d39bb===this['channel'][_0xed13('0x32')]){return this[_0xed13('0xc')][_0xed13('0x26')](_0x2a4119,_0xed13('0x1b1'));}this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x2a4119,_0x5d39bb);var _0x1c15b7=this[_0xed13('0xc')][_0xed13('0x4f')](_0xed13('0x1b2'),util[_0xed13('0x24')](_0xed13('0x1b3'),config[_0xed13('0x6')][_0xed13('0x1b4')]||_0xed13('0x1b5'),_0x5d39bb,this[_0xed13('0xc')][_0xed13('0x32')]));if(_0x1c15b7[_0xed13('0x9c')]===-0x1){return _0x1c15b7;}return this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x169'),'AGI',_0x5d39bb));};AGIVertices[_0xed13('0xe')][_0xed13('0x1b6')]=function(_0x16f633){logger[_0xed13('0x29')](util['format'](_0xed13('0x1b7'),_0x16f633[_0xed13('0x30')]));var _0x4752bc=this[_0xed13('0x4e')]['sync'](this,_0x16f633['command']);this[_0xed13('0x2e')][_0xed13('0x6a')](this,_0x16f633,_0x16f633[_0xed13('0xae')]);if(this['isConfigured'](_0x16f633[_0xed13('0xcd')])){var _0x35b3d0=this[_0xed13('0xf')][_0xed13('0x6a')](this,_0x16f633[_0xed13('0xcd')]);if(_0x35b3d0){this[_0xed13('0xc')]['setVariable'](_0x35b3d0,_0x4752bc);return this[_0xed13('0xc')]['noop'](util[_0xed13('0x24')](_0xed13('0x1b8'),_0x16f633[_0xed13('0xae')],_0x35b3d0));}}return this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x1b9'),_0x16f633[_0xed13('0xae')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x31a072){logger[_0xed13('0x29')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x31a072[_0xed13('0x30')]));_0x31a072[_0xed13('0x53')]=_0x31a072[_0xed13('0x53')][_0xed13('0xcb')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xed13('0x7e')](_0x31a072['apiKey'])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0x1ba'));}if(!this[_0xed13('0x7e')](_0x31a072['text'])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xa2'));}this['channel'][_0xed13('0xa1')](util['format'](_0xed13('0x1bb'),_0x31a072[_0xed13('0x53')]));var _0x3ac44e=this[_0xed13('0x51')][_0xed13('0x6a')](this,_0x31a072);if(_0x3ac44e){this['channel']['noop'](util[_0xed13('0x24')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3ac44e));var _0x50e258=this[_0xed13('0xc')][_0xed13('0xf7')](_0x3ac44e);try{fs[_0xed13('0xf8')](_0x3ac44e+_0xed13('0xf9'));}catch(_0x32044c){logger['error'](_0x32044c);}return _0x50e258;}return this['channel'][_0xed13('0x26')](_0x31a072,_0xed13('0x1bc'));};AGIVertices[_0xed13('0xe')][_0xed13('0x1bd')]=function(_0x5d40c3){logger[_0xed13('0x29')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5d40c3[_0xed13('0x30')]));_0x5d40c3[_0xed13('0x53')]=_0x5d40c3['text'][_0xed13('0xcb')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xed13('0x7e')](_0x5d40c3[_0xed13('0x53')])){return this[_0xed13('0xc')][_0xed13('0xa1')](_0xed13('0xa2'));}this[_0xed13('0xc')]['noop'](util['format'](_0xed13('0x1be'),_0x5d40c3[_0xed13('0x53')]));var _0x544364=this[_0xed13('0x5a')][_0xed13('0x6a')](this,_0x5d40c3);if(_0x544364){this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x1bf'),_0x544364));var _0x116cbd=this[_0xed13('0xc')][_0xed13('0xf7')](_0x544364);try{fs[_0xed13('0xf8')](_0x544364+_0xed13('0xf9'));}catch(_0x2d5ee7){logger[_0xed13('0x26')](_0x2d5ee7);}return _0x116cbd;}return this[_0xed13('0xc')][_0xed13('0x26')](_0x5d40c3,_0xed13('0x1c0'));};AGIVertices[_0xed13('0xe')][_0xed13('0x1c1')]=function(_0x203cb9){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x1c2'),_0x203cb9[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x203cb9[_0xed13('0x151')])){return this[_0xed13('0xc')][_0xed13('0x26')](_0x203cb9,_0xed13('0x152'));}logger['info'](util[_0xed13('0x24')](_0xed13('0x158'),this[_0xed13('0xc')][_0xed13('0x33')],_0x203cb9[_0xed13('0x151')]));var _0x484b78=this[_0xed13('0x48')][_0xed13('0x6a')](this,_0x203cb9[_0xed13('0x151')]);if(_0x484b78){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x153'),this[_0xed13('0xc')][_0xed13('0x33')],_0x203cb9[_0xed13('0x151')]));this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x153'),this[_0xed13('0xc')]['callerid'],_0x203cb9[_0xed13('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x154'),this[_0xed13('0xc')][_0xed13('0x33')],_0x203cb9[_0xed13('0x151')]));this['channel'][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x154'),this[_0xed13('0xc')][_0xed13('0x33')],_0x203cb9[_0xed13('0x151')]));return{'code':0xc8,'result':_0xed13('0x155')};}};AGIVertices[_0xed13('0xe')][_0xed13('0x1c3')]=function(_0x1b93e8){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x1c4'),_0x1b93e8['label']));var _0x5eb417=this[_0xed13('0xc')][_0xed13('0x4f')](_0xed13('0x1c5'),[_0x1b93e8[_0xed13('0x1c6')],_0x1b93e8[_0xed13('0x72')]]);if(_0x5eb417[_0xed13('0x9c')]===-0x1){return _0x5eb417;}return this[_0xed13('0xc')][_0xed13('0xa1')](util[_0xed13('0x24')](_0xed13('0x169'),_0xed13('0x1c5'),_0x1b93e8[_0xed13('0x1c6')]));};AGIVertices[_0xed13('0xe')][_0xed13('0x1c7')]=function(_0x454263){logger[_0xed13('0x29')](util[_0xed13('0x24')](_0xed13('0x1c8'),_0x454263[_0xed13('0x30')]));if(!this[_0xed13('0x7e')](_0x454263[_0xed13('0xcd')])){return this[_0xed13('0xc')]['error'](_0x454263,_0xed13('0x1a5'));}var _0x4db10a=this[_0xed13('0xf')][_0xed13('0x6a')](this,_0x454263[_0xed13('0xcd')]);if(!_0x4db10a){return this[_0xed13('0xc')][_0xed13('0x26')](_0x454263,_0xed13('0xce'));}var _0x31fad9=this['channel'][_0xed13('0xf')](_0x4db10a);return{'code':0xc8,'result':_0x31fad9[_0xed13('0x9a')]?_0x31fad9[_0xed13('0x9a')]:'-'};};String[_0xed13('0xe')][_0xed13('0x99')]=function(_0x3f2b0d,_0x18d747){return this['split'](_0x3f2b0d)[_0xed13('0x1c9')](_0x18d747);};module[_0xed13('0x1ca')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6e54baa..ef379a8 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 _0x40cf=['isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','updateAcw','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','paused','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x40cf,0x1ab));var _0xf40c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40cf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf40c('0x0'));var moment=require('moment');var ami=require(_0xf40c('0x1'));var logger=require(_0xf40c('0x2'))(_0xf40c('0x3'));var RpcUser=require(_0xf40c('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1f0e58){this['voiceQueues']=_0x1f0e58[_0xf40c('0x5')];this[_0xf40c('0x6')]=_0x1f0e58['agents'];this[_0xf40c('0x7')]=_0x1f0e58['timers'];this[_0xf40c('0x8')]={};ami['on'](_0xf40c('0x9'),this[_0xf40c('0xa')][_0xf40c('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on']('hangup',this[_0xf40c('0xc')][_0xf40c('0xb')](this));ami['on']('agentringnoanswer',this[_0xf40c('0xd')][_0xf40c('0xb')](this));ami['on'](_0xf40c('0xe'),this[_0xf40c('0xf')][_0xf40c('0xb')](this));ami['on'](_0xf40c('0x10'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xf40c('0x11'),this['syncAgentConnectPreview'][_0xf40c('0xb')](this));}function getDiff(_0x472fce){var _0x428542=moment()['milliseconds'](0x0);var _0x3fb7c9=moment(_0x472fce)['milliseconds'](0x0);return _0x428542['diff'](_0x3fb7c9,'seconds');}Acw['prototype'][_0xf40c('0x12')]=function(_0x453573,_0x3d16e0){var _0x10c0ad=this;var _0x10ad75=getDiff(_0x10c0ad[_0xf40c('0x7')][_0x453573]['lastPauseAt']);clearTimeout(_0x10c0ad[_0xf40c('0x7')][_0x453573][_0xf40c('0x13')]);_0x10c0ad[_0xf40c('0x7')][_0x453573][_0xf40c('0x13')]=![];return RpcVoiceAgentReport[_0xf40c('0x14')]({'acwtime':_0x10ad75},_0x10c0ad[_0xf40c('0x7')][_0x453573][_0xf40c('0x15')],_0x453573)[_0xf40c('0x16')](function(_0x12e36c){logger[_0xf40c('0x17')](_0xf40c('0x18'),_0x3d16e0,_0x10ad75,_0x12e36c);})[_0xf40c('0x19')](function(_0x42713c){logger[_0xf40c('0x1a')](_0xf40c('0x1b'),_0x3d16e0,_0x42713c);})['finally'](function(){delete _0x10c0ad[_0xf40c('0x7')][_0x453573];});};Acw[_0xf40c('0x1c')]['startAcw']=function(_0x2728ff){try{var _0x1ec02d=this;var _0x4c79cd=this[_0xf40c('0x8')][_0x2728ff][_0xf40c('0x1d')];var _0x34a85d=this['channels'][_0x2728ff][_0xf40c('0x1e')];var _0x499967=this[_0xf40c('0x5')][_0x34a85d];var _0xba52d3=![];var _0x487bb8=_0xf40c('0x1f');if(_0x499967[_0xf40c('0x20')]&&_0x499967[_0xf40c('0x21')][_0xf40c('0x22')]){_0xba52d3=!![];_0x487bb8=_0x499967[_0xf40c('0x21')][_0xf40c('0x22')];}if(!_0x1ec02d[_0xf40c('0x6')][_0x4c79cd]){return Promise[_0xf40c('0x23')]();}return RpcUser[_0xf40c('0x24')](_0x1ec02d[_0xf40c('0x6')][_0x4c79cd]['id'])[_0xf40c('0x16')](function(_0x2eee5d){if(!_0x2eee5d||_0x2eee5d[_0xf40c('0x25')]){logger[_0xf40c('0x17')](_0xf40c('0x26'),_0x2728ff,_0x4c79cd,_0x34a85d);return;}logger[_0xf40c('0x17')](_0xf40c('0x27'),_0x2728ff,_0x4c79cd,_0x34a85d);var _0x4620a6=_0x1ec02d['channels'][_0x2728ff][_0xf40c('0x28')]&&_0x1ec02d[_0xf40c('0x8')][_0x2728ff][_0xf40c('0x29')]?_0x1ec02d[_0xf40c('0x8')][_0x2728ff][_0xf40c('0x29')]:_0x2728ff;return RpcUser['savePause'](_0x1ec02d[_0xf40c('0x6')][_0x4c79cd],_0x487bb8,_0x4620a6)[_0xf40c('0x16')](function(_0x4fe147){_0x1ec02d[_0xf40c('0x5')][_0x34a85d][_0xf40c('0x2a')]-=0x1;_0x1ec02d[_0xf40c('0x5')][_0x34a85d][_0xf40c('0x2b')]+=0x1;return _0x4fe147;});})[_0xf40c('0x16')](function(_0x4c2e42){if(_0xba52d3||!_0x4c2e42){return;}_0x1ec02d[_0xf40c('0x7')][_0x4c79cd]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2728ff,_0x1ec02d[_0xf40c('0x5')][_0x34a85d][_0xf40c('0x2c')],_0x4c79cd,_0x34a85d);_0x1ec02d[_0xf40c('0x7')][_0x4c79cd][_0xf40c('0x13')]=setTimeout(_0x1ec02d['stopAcw']['bind'](_0x1ec02d,_0x4c79cd),_0x1ec02d['voiceQueues'][_0x34a85d][_0xf40c('0x2c')]*0x3e8);_0x1ec02d[_0xf40c('0x7')][_0x4c79cd]['lastPauseAt']=moment()[_0xf40c('0x2d')](_0xf40c('0x2e'));_0x1ec02d[_0xf40c('0x7')][_0x4c79cd]['uniqueid']=_0x2728ff;_0x1ec02d['timers'][_0x4c79cd][_0xf40c('0x1e')]=_0x34a85d;_0x1ec02d[_0xf40c('0x7')][_0x4c79cd]['updateAcw']=_0x1ec02d[_0xf40c('0x12')][_0xf40c('0xb')](_0x1ec02d,_0x4c79cd,_0x2728ff);})[_0xf40c('0x19')](function(){logger[_0xf40c('0x1a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2728ff,_0x1ec02d['voiceQueues'][_0x34a85d][_0xf40c('0x2c')],_0x4c79cd,_0x34a85d);})['finally'](function(){delete _0x1ec02d[_0xf40c('0x8')][_0x2728ff];});}catch(_0x17cbf0){logger[_0xf40c('0x1a')](_0xf40c('0x2f'),_0x17cbf0['message']);}};Acw[_0xf40c('0x1c')]['stopAcw']=function(_0x37760f){try{var _0x10f5a0=this;if(_0x10f5a0[_0xf40c('0x7')][_0x37760f]){_0x10f5a0['timers'][_0x37760f][_0xf40c('0x13')]=![];var _0x496692=_0x10f5a0['timers'][_0x37760f][_0xf40c('0x15')];var _0x24ec2a=_0x10f5a0[_0xf40c('0x7')][_0x37760f][_0xf40c('0x1e')];var _0x5d75f5=_0x10f5a0[_0xf40c('0x5')][_0x24ec2a][_0xf40c('0x2c')];logger[_0xf40c('0x17')](_0xf40c('0x30'),_0x496692,_0x37760f);RpcUser[_0xf40c('0x24')](this[_0xf40c('0x6')][_0x37760f]['id'])['then'](function(_0x573d3f){if(_0x573d3f[_0xf40c('0x31')]===_0xf40c('0x1f')){return RpcUser[_0xf40c('0x32')](_0x10f5a0[_0xf40c('0x6')][_0x37760f]);}});RpcVoiceAgentReport[_0xf40c('0x14')]({'acwtime':_0x5d75f5,'agentacw':!![]},_0x496692,_0x37760f)[_0xf40c('0x16')](function(_0x422e1f){logger[_0xf40c('0x17')](_0xf40c('0x18'),_0x496692,_0x5d75f5,_0x422e1f);})['catch'](function(_0x12a2a1){logger[_0xf40c('0x1a')]('[%s][UPDATE][ERRORS:%s]',_0x496692,_0x12a2a1);});}else{logger['error'](_0xf40c('0x33'),_0x37760f);if(_0x10f5a0[_0xf40c('0x7')]){logger[_0xf40c('0x17')](_0xf40c('0x34'),JSON[_0xf40c('0x35')](_0x10f5a0[_0xf40c('0x7')]));}}}catch(_0x3c8e58){logger[_0xf40c('0x1a')](_0xf40c('0x36'),_0x3c8e58[_0xf40c('0x37')]);}};Acw['prototype'][_0xf40c('0xa')]=function(_0x2c66fd){try{if(this['voiceQueues'][_0x2c66fd[_0xf40c('0x1e')]]&&(this[_0xf40c('0x5')][_0x2c66fd[_0xf40c('0x1e')]]['acw']||this[_0xf40c('0x5')][_0x2c66fd[_0xf40c('0x1e')]][_0xf40c('0x20')])){if(this['agents'][_0x2c66fd[_0xf40c('0x1d')]]){this[_0xf40c('0x8')][_0x2c66fd['uniqueid']]={'queue':_0x2c66fd[_0xf40c('0x1e')],'interface':_0x2c66fd[_0xf40c('0x1d')],'destlinkedid':_0x2c66fd['destlinkedid']};}}}catch(_0x53630d){logger['error'](_0xf40c('0x38'),_0x53630d['message']);}};Acw[_0xf40c('0x1c')][_0xf40c('0x39')]=function(_0x4e86b8){try{if(this[_0xf40c('0x5')][_0x4e86b8['queue']]&&(this[_0xf40c('0x5')][_0x4e86b8['queue']]['acw']||this[_0xf40c('0x5')][_0x4e86b8['queue']]['mandatoryDisposition'])){if(this['agents'][_0x4e86b8[_0xf40c('0x1d')]]){this[_0xf40c('0x8')][_0x4e86b8['uniqueid']]={'queue':_0x4e86b8['queue'],'interface':_0x4e86b8[_0xf40c('0x1d')]};}}}catch(_0x357b0e){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x357b0e[_0xf40c('0x37')]);}};Acw[_0xf40c('0x1c')]['syncHangupRequest']=function(_0x230c53){try{if(this[_0xf40c('0x8')][_0x230c53[_0xf40c('0x15')]]&&_[_0xf40c('0x3a')](this[_0xf40c('0x8')][_0x230c53[_0xf40c('0x15')]][_0xf40c('0x28')])){logger[_0xf40c('0x17')]('[%s][HANGUP:UNIQUEID]',_0x230c53['uniqueid']);this['startAcw'](_0x230c53[_0xf40c('0x15')]);}else if(this[_0xf40c('0x8')][_0x230c53[_0xf40c('0x3b')]]&&_[_0xf40c('0x3a')](this[_0xf40c('0x8')][_0x230c53[_0xf40c('0x3b')]][_0xf40c('0x28')])){logger[_0xf40c('0x17')](_0xf40c('0x3c'),_0x230c53[_0xf40c('0x3b')]);this[_0xf40c('0x3d')](_0x230c53[_0xf40c('0x3b')]);}}catch(_0x5298ec){logger['error'](_0xf40c('0x3e'),_0x5298ec['message']);}};Acw['prototype']['syncHangup']=function(_0x389a7c){try{if(this[_0xf40c('0x8')][_0x389a7c[_0xf40c('0x15')]]&&this[_0xf40c('0x8')][_0x389a7c[_0xf40c('0x15')]][_0xf40c('0x28')]){logger[_0xf40c('0x17')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x389a7c[_0xf40c('0x15')]);this[_0xf40c('0x3d')](_0x389a7c[_0xf40c('0x15')]);}else if(this[_0xf40c('0x8')][_0x389a7c[_0xf40c('0x3b')]]&&this[_0xf40c('0x8')][_0x389a7c[_0xf40c('0x3b')]][_0xf40c('0x28')]){logger[_0xf40c('0x17')](_0xf40c('0x3f'),_0x389a7c['linkedid']);this[_0xf40c('0x3d')](_0x389a7c['linkedid']);}}catch(_0x391c10){logger[_0xf40c('0x1a')](_0xf40c('0x40'),_0x391c10['message']);}};Acw[_0xf40c('0x1c')][_0xf40c('0xf')]=function(_0x1017fd){try{if(!_[_0xf40c('0x41')](this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x42')]])){this[_0xf40c('0x3d')](_0x1017fd['transfereeuniqueid']);if(this[_0xf40c('0x8')][_0x1017fd['secondtransfereruniqueid']]){this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x43')]]['attended']=!![];this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x44')]]=this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x43')]];delete this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x43')]];}}else if(!_[_0xf40c('0x41')](this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x44')]])){this[_0xf40c('0x3d')](_0x1017fd['transfertargetuniqueid']);if(this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x45')]]){this['channels'][_0x1017fd['origtransfereruniqueid']]['attended']=!![];this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x42')]]=this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x45')]];delete this[_0xf40c('0x8')][_0x1017fd[_0xf40c('0x45')]];}}}catch(_0xf370c){logger[_0xf40c('0x1a')]('[ACW][syncAttendedTransfer]\x20%s',_0xf370c[_0xf40c('0x37')]);}};Acw['prototype'][_0xf40c('0x46')]=function(_0x165340){try{if(this['channels'][_0x165340[_0xf40c('0x47')]]){logger['info'](_0xf40c('0x48'),JSON[_0xf40c('0x35')](_0x165340[_0xf40c('0x47')]));this[_0xf40c('0x3d')](_0x165340['transfereruniqueid']);}else if(this[_0xf40c('0x8')][_0x165340['transfererlinkedid']]){logger[_0xf40c('0x17')](_0xf40c('0x49'),JSON['stringify'](_0x165340[_0xf40c('0x4a')]));this[_0xf40c('0x3d')](_0x165340[_0xf40c('0x4a')]);}}catch(_0x4869e6){logger[_0xf40c('0x1a')](_0xf40c('0x4b'),_0x4869e6[_0xf40c('0x37')]);}};Acw[_0xf40c('0x1c')][_0xf40c('0xd')]=function(_0x2e2d95){try{if(this[_0xf40c('0x5')][_0x2e2d95[_0xf40c('0x1e')]]&&this[_0xf40c('0x5')][_0x2e2d95[_0xf40c('0x1e')]][_0xf40c('0x4c')]==='all'){if(this[_0xf40c('0x6')][_0x2e2d95['interface']]){logger[_0xf40c('0x17')](_0xf40c('0x4d'),_0x2e2d95[_0xf40c('0x15')],_0x2e2d95[_0xf40c('0x1d')],_0x2e2d95['queue']);return RpcUser[_0xf40c('0x4e')](this['agents'][_0x2e2d95[_0xf40c('0x1d')]],_0xf40c('0x4f'),_0x2e2d95[_0xf40c('0x15')]);}}}catch(_0x2b633e){logger[_0xf40c('0x1a')](_0xf40c('0x50'),_0x2b633e[_0xf40c('0x37')]);}};module[_0xf40c('0x51')]=Acw; \ No newline at end of file +var _0x3855=['resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','then','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','stopAcw','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x3855,0x180));var _0x5385=function(_0x561c5b,_0x2daeb3){_0x561c5b=_0x561c5b-0x0;var _0x3d67a5=_0x3855[_0x561c5b];return _0x3d67a5;};'use strict';var _=require(_0x5385('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x5385('0x1'))(_0x5385('0x2'));var RpcUser=require(_0x5385('0x3'));var RpcVoiceAgentReport=require(_0x5385('0x4'));function Acw(_0x1c6fc8){this[_0x5385('0x5')]=_0x1c6fc8['voiceQueues'];this[_0x5385('0x6')]=_0x1c6fc8[_0x5385('0x6')];this['timers']=_0x1c6fc8[_0x5385('0x7')];this[_0x5385('0x8')]={};ami['on']('agentconnect',this[_0x5385('0x9')][_0x5385('0xa')](this));ami['on'](_0x5385('0xb'),this[_0x5385('0xc')][_0x5385('0xa')](this));ami['on'](_0x5385('0xd'),this[_0x5385('0xe')]['bind'](this));ami['on'](_0x5385('0xf'),this[_0x5385('0x10')][_0x5385('0xa')](this));ami['on'](_0x5385('0x11'),this[_0x5385('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x5385('0x13')][_0x5385('0xa')](this));ami['on'](_0x5385('0x14'),this['syncAgentConnectPreview'][_0x5385('0xa')](this));}function getDiff(_0x137e89){var _0x255847=moment()[_0x5385('0x15')](0x0);var _0x59b0f1=moment(_0x137e89)[_0x5385('0x15')](0x0);return _0x255847[_0x5385('0x16')](_0x59b0f1,_0x5385('0x17'));}Acw[_0x5385('0x18')][_0x5385('0x19')]=function(_0xcb2cfe,_0x19adce){var _0x2ccd95=this;var _0x555d1e=getDiff(_0x2ccd95['timers'][_0xcb2cfe][_0x5385('0x1a')]);clearTimeout(_0x2ccd95['timers'][_0xcb2cfe][_0x5385('0x1b')]);_0x2ccd95[_0x5385('0x7')][_0xcb2cfe][_0x5385('0x1b')]=![];return RpcVoiceAgentReport[_0x5385('0x1c')]({'acwtime':_0x555d1e},_0x2ccd95[_0x5385('0x7')][_0xcb2cfe][_0x5385('0x1d')],_0xcb2cfe)['then'](function(_0x625d21){logger['info'](_0x5385('0x1e'),_0x19adce,_0x555d1e,_0x625d21);})[_0x5385('0x1f')](function(_0x210f99){logger[_0x5385('0x20')](_0x5385('0x21'),_0x19adce,_0x210f99);})['finally'](function(){delete _0x2ccd95[_0x5385('0x7')][_0xcb2cfe];});};Acw[_0x5385('0x18')][_0x5385('0x22')]=function(_0x44422e){try{var _0x165e0b=this;var _0x39ceef=this[_0x5385('0x8')][_0x44422e][_0x5385('0x23')];var _0x533aa8=this[_0x5385('0x8')][_0x44422e][_0x5385('0x24')];var _0x9b563e=this[_0x5385('0x5')][_0x533aa8];var _0x52da8a=![];var _0x137f26=_0x5385('0x25');if(_0x9b563e[_0x5385('0x26')]&&_0x9b563e[_0x5385('0x27')][_0x5385('0x28')]){_0x52da8a=!![];_0x137f26=_0x9b563e[_0x5385('0x27')][_0x5385('0x28')];}if(!_0x165e0b[_0x5385('0x6')][_0x39ceef]){return Promise[_0x5385('0x29')]();}return RpcUser[_0x5385('0x2a')](_0x165e0b['agents'][_0x39ceef]['id'])['then'](function(_0x38515d){if(!_0x38515d||_0x38515d[_0x5385('0x2b')]){logger['info'](_0x5385('0x2c'),_0x44422e,_0x39ceef,_0x533aa8);return;}logger[_0x5385('0x2d')](_0x5385('0x2e'),_0x44422e,_0x39ceef,_0x533aa8);var _0x40307e=_0x165e0b[_0x5385('0x8')][_0x44422e][_0x5385('0x2f')]&&_0x165e0b[_0x5385('0x8')][_0x44422e][_0x5385('0x30')]?_0x165e0b[_0x5385('0x8')][_0x44422e][_0x5385('0x30')]:_0x44422e;return RpcUser[_0x5385('0x31')](_0x165e0b['agents'][_0x39ceef],_0x137f26,_0x40307e)['then'](function(_0x2cb1a6){_0x165e0b['voiceQueues'][_0x533aa8][_0x5385('0x32')]-=0x1;_0x165e0b[_0x5385('0x5')][_0x533aa8][_0x5385('0x33')]+=0x1;return _0x2cb1a6;});})[_0x5385('0x34')](function(_0x283b1c){if(_0x52da8a||!_0x283b1c){return;}_0x165e0b[_0x5385('0x7')][_0x39ceef]={};logger[_0x5385('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x44422e,_0x165e0b['voiceQueues'][_0x533aa8][_0x5385('0x35')],_0x39ceef,_0x533aa8);_0x165e0b[_0x5385('0x7')][_0x39ceef][_0x5385('0x1b')]=setTimeout(_0x165e0b['stopAcw']['bind'](_0x165e0b,_0x39ceef),_0x165e0b[_0x5385('0x5')][_0x533aa8][_0x5385('0x35')]*0x3e8);_0x165e0b[_0x5385('0x7')][_0x39ceef][_0x5385('0x1a')]=moment()[_0x5385('0x36')](_0x5385('0x37'));_0x165e0b[_0x5385('0x7')][_0x39ceef]['uniqueid']=_0x44422e;_0x165e0b[_0x5385('0x7')][_0x39ceef]['queue']=_0x533aa8;_0x165e0b[_0x5385('0x7')][_0x39ceef][_0x5385('0x19')]=_0x165e0b[_0x5385('0x19')][_0x5385('0xa')](_0x165e0b,_0x39ceef,_0x44422e);})[_0x5385('0x1f')](function(){logger[_0x5385('0x20')](_0x5385('0x38'),_0x44422e,_0x165e0b[_0x5385('0x5')][_0x533aa8][_0x5385('0x35')],_0x39ceef,_0x533aa8);})['finally'](function(){delete _0x165e0b[_0x5385('0x8')][_0x44422e];});}catch(_0x468dd0){logger['error'](_0x5385('0x39'),_0x468dd0[_0x5385('0x3a')]);}};Acw[_0x5385('0x18')][_0x5385('0x3b')]=function(_0x41b0f4){try{var _0x2cd738=this;if(_0x2cd738[_0x5385('0x7')][_0x41b0f4]){_0x2cd738[_0x5385('0x7')][_0x41b0f4][_0x5385('0x1b')]=![];var _0x4db2c7=_0x2cd738['timers'][_0x41b0f4][_0x5385('0x1d')];var _0x1aaa30=_0x2cd738[_0x5385('0x7')][_0x41b0f4][_0x5385('0x24')];var _0x144802=_0x2cd738[_0x5385('0x5')][_0x1aaa30][_0x5385('0x35')];logger[_0x5385('0x2d')]('[%s][TIMER][STOP][AGENT:%s]',_0x4db2c7,_0x41b0f4);RpcUser[_0x5385('0x2a')](this[_0x5385('0x6')][_0x41b0f4]['id'])[_0x5385('0x34')](function(_0x4c1f94){if(_0x4c1f94['pauseType']===_0x5385('0x25')){return RpcUser[_0x5385('0x3c')](_0x2cd738[_0x5385('0x6')][_0x41b0f4]);}});RpcVoiceAgentReport[_0x5385('0x1c')]({'acwtime':_0x144802,'agentacw':!![]},_0x4db2c7,_0x41b0f4)[_0x5385('0x34')](function(_0x2f77a3){logger[_0x5385('0x2d')](_0x5385('0x1e'),_0x4db2c7,_0x144802,_0x2f77a3);})[_0x5385('0x1f')](function(_0x2ab18e){logger[_0x5385('0x20')](_0x5385('0x21'),_0x4db2c7,_0x2ab18e);});}else{logger[_0x5385('0x20')](_0x5385('0x3d'),_0x41b0f4);if(_0x2cd738[_0x5385('0x7')]){logger['info'](_0x5385('0x3e'),JSON['stringify'](_0x2cd738[_0x5385('0x7')]));}}}catch(_0x514846){logger['error']('[ACW][STOP]\x20%s',_0x514846[_0x5385('0x3a')]);}};Acw['prototype'][_0x5385('0x9')]=function(_0xa73c07){try{if(this[_0x5385('0x5')][_0xa73c07[_0x5385('0x24')]]&&(this[_0x5385('0x5')][_0xa73c07['queue']][_0x5385('0x2')]||this[_0x5385('0x5')][_0xa73c07[_0x5385('0x24')]][_0x5385('0x26')])){if(this[_0x5385('0x6')][_0xa73c07[_0x5385('0x23')]]){this['channels'][_0xa73c07['uniqueid']]={'queue':_0xa73c07[_0x5385('0x24')],'interface':_0xa73c07[_0x5385('0x23')],'destlinkedid':_0xa73c07[_0x5385('0x30')]};}}}catch(_0x348828){logger[_0x5385('0x20')]('[ACW][syncAgentConnect]\x20%s',_0x348828[_0x5385('0x3a')]);}};Acw[_0x5385('0x18')][_0x5385('0x3f')]=function(_0xbbcfc4){try{if(this[_0x5385('0x5')][_0xbbcfc4[_0x5385('0x24')]]&&(this[_0x5385('0x5')][_0xbbcfc4['queue']][_0x5385('0x2')]||this['voiceQueues'][_0xbbcfc4[_0x5385('0x24')]][_0x5385('0x26')])){if(this[_0x5385('0x6')][_0xbbcfc4['interface']]){this[_0x5385('0x8')][_0xbbcfc4[_0x5385('0x1d')]]={'queue':_0xbbcfc4[_0x5385('0x24')],'interface':_0xbbcfc4['interface']};}}}catch(_0x2c91b4){logger[_0x5385('0x20')](_0x5385('0x40'),_0x2c91b4[_0x5385('0x3a')]);}};Acw[_0x5385('0x18')][_0x5385('0xc')]=function(_0x26f139){try{if(this[_0x5385('0x8')][_0x26f139[_0x5385('0x1d')]]&&_[_0x5385('0x41')](this['channels'][_0x26f139[_0x5385('0x1d')]][_0x5385('0x2f')])){logger[_0x5385('0x2d')]('[%s][HANGUP:UNIQUEID]',_0x26f139[_0x5385('0x1d')]);this[_0x5385('0x22')](_0x26f139[_0x5385('0x1d')]);}else if(this['channels'][_0x26f139[_0x5385('0x42')]]&&_[_0x5385('0x41')](this[_0x5385('0x8')][_0x26f139['linkedid']][_0x5385('0x2f')])){logger[_0x5385('0x2d')]('[%s][HANGUP:LINKEDID]',_0x26f139[_0x5385('0x42')]);this[_0x5385('0x22')](_0x26f139[_0x5385('0x42')]);}}catch(_0x44e05b){logger[_0x5385('0x20')](_0x5385('0x43'),_0x44e05b['message']);}};Acw['prototype'][_0x5385('0xe')]=function(_0x39b380){try{if(this[_0x5385('0x8')][_0x39b380[_0x5385('0x1d')]]&&this[_0x5385('0x8')][_0x39b380[_0x5385('0x1d')]][_0x5385('0x2f')]){logger[_0x5385('0x2d')](_0x5385('0x44'),_0x39b380['uniqueid']);this[_0x5385('0x22')](_0x39b380['uniqueid']);}else if(this[_0x5385('0x8')][_0x39b380['linkedid']]&&this[_0x5385('0x8')][_0x39b380[_0x5385('0x42')]]['attended']){logger[_0x5385('0x2d')](_0x5385('0x45'),_0x39b380[_0x5385('0x42')]);this['startAcw'](_0x39b380[_0x5385('0x42')]);}}catch(_0x43502a){logger[_0x5385('0x20')](_0x5385('0x46'),_0x43502a['message']);}};Acw[_0x5385('0x18')][_0x5385('0x12')]=function(_0x1b92a7){try{if(!_[_0x5385('0x47')](this[_0x5385('0x8')][_0x1b92a7['transfereeuniqueid']])){this[_0x5385('0x22')](_0x1b92a7[_0x5385('0x48')]);if(this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x49')]]){this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x49')]][_0x5385('0x2f')]=!![];this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x4a')]]=this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x49')]];delete this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x49')]];}}else if(!_[_0x5385('0x47')](this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x4a')]])){this[_0x5385('0x22')](_0x1b92a7[_0x5385('0x4a')]);if(this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x4b')]]){this['channels'][_0x1b92a7[_0x5385('0x4b')]][_0x5385('0x2f')]=!![];this['channels'][_0x1b92a7[_0x5385('0x48')]]=this[_0x5385('0x8')][_0x1b92a7['origtransfereruniqueid']];delete this[_0x5385('0x8')][_0x1b92a7[_0x5385('0x4b')]];}}}catch(_0x47b5ee){logger[_0x5385('0x20')](_0x5385('0x4c'),_0x47b5ee[_0x5385('0x3a')]);}};Acw[_0x5385('0x18')][_0x5385('0x13')]=function(_0xa146df){try{if(this['channels'][_0xa146df[_0x5385('0x4d')]]){logger['info'](_0x5385('0x4e'),JSON[_0x5385('0x4f')](_0xa146df['transfereruniqueid']));this[_0x5385('0x22')](_0xa146df[_0x5385('0x4d')]);}else if(this[_0x5385('0x8')][_0xa146df['transfererlinkedid']]){logger[_0x5385('0x2d')](_0x5385('0x50'),JSON[_0x5385('0x4f')](_0xa146df[_0x5385('0x51')]));this[_0x5385('0x22')](_0xa146df[_0x5385('0x51')]);}}catch(_0x23e7d3){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x23e7d3[_0x5385('0x3a')]);}};Acw[_0x5385('0x18')]['syncAgentRingNoAnswer']=function(_0x5287e2){try{if(this[_0x5385('0x5')][_0x5287e2['queue']]&&this[_0x5385('0x5')][_0x5287e2['queue']][_0x5385('0x52')]==='all'){if(this['agents'][_0x5287e2[_0x5385('0x23')]]){logger['info'](_0x5385('0x53'),_0x5287e2[_0x5385('0x1d')],_0x5287e2[_0x5385('0x23')],_0x5287e2[_0x5385('0x24')]);return RpcUser['savePause'](this[_0x5385('0x6')][_0x5287e2[_0x5385('0x23')]],'Auto-Pause',_0x5287e2[_0x5385('0x1d')]);}}}catch(_0x2029bf){logger[_0x5385('0x20')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2029bf[_0x5385('0x3a')]);}};module[_0x5385('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f2cead2..66af4af 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 _0xa3da=['catch','[ami.js][fullybooted]','close','exports','asterisk-manager','bluebird','util','../../config/logger','ami','asterisk','port','password','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0xa3da,0x114));var _0xaa3d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa3da[_0x6c993a];return _0x27f547;};'use strict';var Manager=require(_0xaa3d('0x0'));var BPromise=require(_0xaa3d('0x1'));var util=require(_0xaa3d('0x2'));var logger=require(_0xaa3d('0x3'))(_0xaa3d('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0xaa3d('0x5')][_0xaa3d('0x6')],config[_0xaa3d('0x5')]['ip'],config[_0xaa3d('0x5')]['username'],config[_0xaa3d('0x5')][_0xaa3d('0x7')],!![]);ami['keepConnected']();ami[_0xaa3d('0x8')]=BPromise['promisify'](ami['action']);function error(_0x4e35d7){logger[_0xaa3d('0x9')](util[_0xaa3d('0xa')](_0xaa3d('0xb'),config[_0xaa3d('0x5')][_0xaa3d('0xc')],config[_0xaa3d('0x5')]['ip'],config[_0xaa3d('0x5')]['port'],util[_0xaa3d('0xd')](_0x4e35d7,![],null)));}function close(){logger['error'](util[_0xaa3d('0xa')](_0xaa3d('0xe'),config[_0xaa3d('0x5')][_0xaa3d('0xc')],config[_0xaa3d('0x5')]['ip'],config['asterisk'][_0xaa3d('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xaa3d('0x8')]({'action':_0xaa3d('0xf')});};};ami[_0xaa3d('0x10')]=function(){return function(){return ami[_0xaa3d('0x8')]({'action':_0xaa3d('0x11')});};};ami[_0xaa3d('0x12')]=function(){return function(){return ami['Action']({'action':_0xaa3d('0x13')});};};ami[_0xaa3d('0x14')]=function(){return function(){return ami[_0xaa3d('0x8')]({'action':_0xaa3d('0x15')});};};ami[_0xaa3d('0x16')]=function(){return function(){return ami[_0xaa3d('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0xaa3d('0x17')](util[_0xaa3d('0xa')](_0xaa3d('0x18'),config['asterisk'][_0xaa3d('0xc')],config['asterisk']['ip'],config[_0xaa3d('0x5')][_0xaa3d('0x6')]));ami[_0xaa3d('0x19')](_0xaa3d('0x9'),error);ami['once']('close',close);}ami['on']('connect',connect);ami['on'](_0xaa3d('0x1a'),function(_0xf7c951){logger[_0xaa3d('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xaa3d('0x5')]['username'],config[_0xaa3d('0x5')]['ip'],config[_0xaa3d('0x5')][_0xaa3d('0x6')],util['inspect'](_0xf7c951,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0xaa3d('0xa')](_0xaa3d('0x1b'),config[_0xaa3d('0x5')][_0xaa3d('0xc')],config['asterisk']['ip'],config['asterisk'][_0xaa3d('0x6')]));return Promise[_0xaa3d('0x1c')]()[_0xaa3d('0x1d')](ami['actionSipShowRegistry']())[_0xaa3d('0x1d')](ami[_0xaa3d('0x10')]())[_0xaa3d('0x1d')](ami[_0xaa3d('0x12')]())[_0xaa3d('0x1d')](ami[_0xaa3d('0x14')]())['then'](ami['actionCoreShowChannels']())[_0xaa3d('0x1e')](function(_0x487987){logger[_0xaa3d('0x9')](_0xaa3d('0x1f'),util[_0xaa3d('0xd')](_0x487987,{'showHidden':![],'depth':null}));});});ami[_0xaa3d('0x19')](_0xaa3d('0x9'),error);ami[_0xaa3d('0x19')](_0xaa3d('0x20'),close);module[_0xaa3d('0x21')]=ami; \ No newline at end of file +var _0x503f=['bluebird','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','[ami.js][fullybooted]','exports'];(function(_0x5541e3,_0x2c84d8){var _0x9ac56d=function(_0x4736d5){while(--_0x4736d5){_0x5541e3['push'](_0x5541e3['shift']());}};_0x9ac56d(++_0x2c84d8);}(_0x503f,0x6f));var _0xf503=function(_0x96f0dd,_0x5b7305){_0x96f0dd=_0x96f0dd-0x0;var _0x2b3fd5=_0x503f[_0x96f0dd];return _0x2b3fd5;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xf503('0x0'));var util=require(_0xf503('0x1'));var logger=require(_0xf503('0x2'))(_0xf503('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0xf503('0x4')][_0xf503('0x5')],config[_0xf503('0x4')]['ip'],config[_0xf503('0x4')][_0xf503('0x6')],config[_0xf503('0x4')][_0xf503('0x7')],!![]);ami[_0xf503('0x8')]();ami[_0xf503('0x9')]=BPromise[_0xf503('0xa')](ami[_0xf503('0xb')]);function error(_0x377c2a){logger[_0xf503('0xc')](util[_0xf503('0xd')](_0xf503('0xe'),config[_0xf503('0x4')]['username'],config['asterisk']['ip'],config[_0xf503('0x4')]['port'],util[_0xf503('0xf')](_0x377c2a,![],null)));}function close(){logger[_0xf503('0xc')](util[_0xf503('0xd')](_0xf503('0x10'),config[_0xf503('0x4')][_0xf503('0x6')],config[_0xf503('0x4')]['ip'],config[_0xf503('0x4')][_0xf503('0x5')]));}ami[_0xf503('0x11')]=function(){return function(){return ami['Action']({'action':_0xf503('0x12')});};};ami[_0xf503('0x13')]=function(){return function(){return ami[_0xf503('0x9')]({'action':_0xf503('0x14')});};};ami[_0xf503('0x15')]=function(){return function(){return ami[_0xf503('0x9')]({'action':'sippeerstatus'});};};ami[_0xf503('0x16')]=function(){return function(){return ami[_0xf503('0x9')]({'action':_0xf503('0x17')});};};ami[_0xf503('0x18')]=function(){return function(){return ami[_0xf503('0x9')]({'action':_0xf503('0x19')});};};function connect(){logger['info'](util['format'](_0xf503('0x1a'),config['asterisk'][_0xf503('0x6')],config[_0xf503('0x4')]['ip'],config[_0xf503('0x4')][_0xf503('0x5')]));ami[_0xf503('0x1b')](_0xf503('0xc'),error);ami['once'](_0xf503('0x1c'),close);}ami['on'](_0xf503('0x1d'),connect);ami['on'](_0xf503('0x1e'),function(_0x10b547){logger['info'](util[_0xf503('0xd')](_0xf503('0x1f'),config['asterisk'][_0xf503('0x6')],config[_0xf503('0x4')]['ip'],config['asterisk'][_0xf503('0x5')],util[_0xf503('0xf')](_0x10b547,![],null)));});ami['on']('fullybooted',function(){logger[_0xf503('0x20')](util['format'](_0xf503('0x21'),config[_0xf503('0x4')]['username'],config[_0xf503('0x4')]['ip'],config[_0xf503('0x4')][_0xf503('0x5')]));return Promise['resolve']()[_0xf503('0x22')](ami[_0xf503('0x11')]())[_0xf503('0x22')](ami[_0xf503('0x13')]())[_0xf503('0x22')](ami['actionSipPeerStatus']())[_0xf503('0x22')](ami[_0xf503('0x16')]())[_0xf503('0x22')](ami[_0xf503('0x18')]())['catch'](function(_0x4000de){logger[_0xf503('0xc')](_0xf503('0x23'),util[_0xf503('0xf')](_0x4000de,{'showHidden':![],'depth':null}));});});ami[_0xf503('0x1b')](_0xf503('0xc'),error);ami['once'](_0xf503('0x1c'),close);module[_0xf503('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 8e6b221..e529a8d 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x9bde,0xe1));var _0xe9bd=function(_0x32e3e0,_0x327214){_0x32e3e0=_0x32e3e0-0x0;var _0x266dce=_0x9bde[_0x32e3e0];return _0x266dce;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xe706,0xa3));var _0x6e70=function(_0x519b55,_0x1597a7){_0x519b55=_0x519b55-0x0;var _0x5baf3d=_0xe706[_0x519b55];return _0x5baf3d;};'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 diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 2eff425..5f52bc7 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 _0xe5e8=['unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','emit','custom:amd','buildObj','amd','MACHINE','Machine','countmachineretry','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','membername','countcongestionretry','reason19\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','running','INACTIVE','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','undefined','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','UserId','[emptyContact][createHistory]','[emptyContact]','saveInDb','[syncQueueCallerAbandon]\x20[Drop]','Agent','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','loggedIn','outboundQueuePauses','abandonmentRate','[CatchErlangB]','check\x20failure','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','run','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','ivrTotalCallsDays','Contact','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','getContactDialer','countReScheduled','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','[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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','erlangb','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','type','debug','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','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','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','message','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:save','originated','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','stringify','isTrunkReachable','active','SIP/%s','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','all','some','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','booked','Queue','method\x20not\x20recognized','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','queue','outboundAnswerCallsDay','reason','agent','agiafterat','[syncAgentComplete][createHistory]','moveContactManagedDialer','syncQueueCallerAbandon','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','createHistory','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','verifyAdditionalPhones','countabandonedretry','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr'];(function(_0x31b761,_0x1f1619){var _0x1fd625=function(_0x29615b){while(--_0x29615b){_0x31b761['push'](_0x31b761['shift']());}};_0x1fd625(++_0x1f1619);}(_0xe5e8,0x125));var _0x8e5e=function(_0x4e1f10,_0x396128){_0x4e1f10=_0x4e1f10-0x0;var _0x81fa33=_0xe5e8[_0x4e1f10];return _0x81fa33;};'use strict';var util=require(_0x8e5e('0x0'));var _=require(_0x8e5e('0x1'));var uuid=require(_0x8e5e('0x2'));var moment=require(_0x8e5e('0x3'));var rr=require('rr');var Redis=require(_0x8e5e('0x4'));var utils=require(_0x8e5e('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x8e5e('0x6'));var config=require(_0x8e5e('0x7'));var logger=require('../../../config/logger')(_0x8e5e('0x8'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x8e5e('0x9'))(_0x8e5e('0xa'));var loggerPredictiveCalls=require(_0x8e5e('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x8e5e('0xb'));var ami=require('../ami');config[_0x8e5e('0xc')]=_['defaults'](config[_0x8e5e('0xc')],{'host':_0x8e5e('0xd'),'port':0x18eb});var io=require(_0x8e5e('0xe'))(new Redis(config[_0x8e5e('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x8e5e('0xf'));var RpcSetting=require(_0x8e5e('0x10'));var Interval=require(_0x8e5e('0x11'));var Action=require(_0x8e5e('0x12'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x8e5e('0x13'));var QueueCallerAbandon=require(_0x8e5e('0x14'));var Hangup=require(_0x8e5e('0x15'));var ipAgi=process[_0x8e5e('0x16')][_0x8e5e('0x17')]||_0x8e5e('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8e5e('0x19')][_0x8e5e('0x1a')]=function(_0x35b32e){this[_0x8e5e('0x1b')]=this[_0x8e5e('0x1b')]?this['tail'][_0x8e5e('0x1c')](_0x35b32e):_0x35b32e();};function Dialer(_0x29b340,_0x3f1ff0){this[_0x8e5e('0x1d')]=new Sequence();this[_0x8e5e('0x1e')]=_0x3f1ff0;this['voiceQueues']=_0x29b340[_0x8e5e('0x1f')];this[_0x8e5e('0x20')]=_0x29b340[_0x8e5e('0x20')];this[_0x8e5e('0x21')]=_0x29b340[_0x8e5e('0x21')];this[_0x8e5e('0x22')]=_0x29b340[_0x8e5e('0x22')];this[_0x8e5e('0x23')]=config[_0x8e5e('0x23')]||0x2;this[_0x8e5e('0x24')]={};this[_0x8e5e('0x25')]={};this['contactsId']={};this[_0x8e5e('0x26')]={};this['optionPredictive']={};this[_0x8e5e('0x27')]={};this[_0x8e5e('0x28')]={};this['ivrOriginated']={};this[_0x8e5e('0x29')]={};this[_0x8e5e('0x2a')]={};this[_0x8e5e('0x2b')]={};ami['on'](_0x8e5e('0x2c'),this[_0x8e5e('0x2d')][_0x8e5e('0x2e')](this));ami['on'](_0x8e5e('0x2f'),this['syncQueueCallerAbandon'][_0x8e5e('0x2e')](this));ami['on']('originateresponse',this[_0x8e5e('0x30')][_0x8e5e('0x2e')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x8e5e('0x2e')](this));ami['on'](_0x8e5e('0x31'),this[_0x8e5e('0xb')][_0x8e5e('0x2e')](this));ami['on'](_0x8e5e('0x32'),this[_0x8e5e('0x33')][_0x8e5e('0x2e')](this));ami['on'](_0x8e5e('0x34'),this[_0x8e5e('0x35')][_0x8e5e('0x2e')](this));ami['on'](_0x8e5e('0x36'),this[_0x8e5e('0x37')][_0x8e5e('0x2e')](this));ami['on']('varset',this[_0x8e5e('0x38')][_0x8e5e('0x2e')](this));ami['on'](_0x8e5e('0x39'),this[_0x8e5e('0x3a')][_0x8e5e('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x8e5e('0x3b')]['bind'](this));this[_0x8e5e('0x3c')]();this[_0x8e5e('0x3d')]();RpcSetting[_0x8e5e('0x3e')]()[_0x8e5e('0x3f')](function(_0x27a361){previewRecallmeReminderInterval=_0x27a361['previewRecallmeReminderInterval'];});}function isNotNull(_0x4c28d7){return _0x4c28d7!==null&&!_[_0x8e5e('0x40')](_0x4c28d7);}function msgResponse(_0x3cfc0a,_0x1d092d,_0x3a7e22){return{'action':_0x3cfc0a,'response':_0x1d092d,'message':_0x3a7e22,'stack':_0x3a7e22};}function emit(_0x12969e,_0x4f0b3b,_0x4a1c18){io['to'](_0x12969e)['emit'](_0x4f0b3b,_0x4a1c18);}function emitOutboundVoiceQueueSummary(_0x255c24){if(_0x255c24[_0x8e5e('0x41')]==='outbound'){logger[_0x8e5e('0x42')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x8e5e('0x43')](_0x255c24,{'showHidden':![],'depth':null}));emit(util[_0x8e5e('0x44')](_0x8e5e('0x45'),_0x255c24[_0x8e5e('0x46')]),_0x8e5e('0x47'),_0x255c24);}}function checkGetDataPredictive(_0x5c53f8){if(isNotNull(_0x5c53f8)&&!_[_0x8e5e('0x48')](_0x5c53f8)){loggerPredictive['info'](_0x8e5e('0x49'));loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x4b'),_0x5c53f8[_0x8e5e('0x4c')]);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x4d'),_0x5c53f8[_0x8e5e('0x4e')]);loggerPredictive[_0x8e5e('0x4a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c53f8['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x4f'),_0x5c53f8[_0x8e5e('0x50')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c53f8[_0x8e5e('0x51')]);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x52'),_0x5c53f8[_0x8e5e('0x53')]);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x54'));if(_0x5c53f8[_0x8e5e('0x4c')]>0x0){if(!_['isUndefined'](_0x5c53f8[_0x8e5e('0x53')])&&_0x5c53f8[_0x8e5e('0x53')]>0x0){return!![];}loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x55'));if(!_['isUndefined'](_0x5c53f8[_0x8e5e('0x51')])&&_0x5c53f8[_0x8e5e('0x51')]>0x0){return!![];}loggerPredictive['info'](_0x8e5e('0x56'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x57'));}return![];}function mergeDataErlangB(_0x1bd382){return function(_0x4bce0d){loggerPredictive['info'](_0x8e5e('0x58'));loggerPredictive[_0x8e5e('0x4a')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4bce0d[_0x8e5e('0x59')]);loggerPredictive['info'](_0x8e5e('0x5a'),_0x4bce0d['erlangCallToSecond']);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x5b'),_0x4bce0d[_0x8e5e('0x5c')]);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x5d'),_0x4bce0d[_0x8e5e('0x5e')]);loggerPredictive[_0x8e5e('0x4a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4bce0d[_0x8e5e('0x5c')]);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x54'));_[_0x8e5e('0x5f')](_0x1bd382,_0x4bce0d);};}function ifInterval(_0x311c67,_0x4b5a06){if(_['isUndefined'](_0x4b5a06)){return![];}return utils[_0x8e5e('0x60')](undefined,_0x4b5a06)<_0x311c67*0x3c;}function clearPredictiveAttributes(_0x44b1c9){if(_0x44b1c9[_0x8e5e('0x28')]){_0x44b1c9[_0x8e5e('0x28')]=undefined;loggerPredictive[_0x8e5e('0x42')](_0x44b1c9[_0x8e5e('0x46')],'startProgressive\x20value\x20cleared');}if(_0x44b1c9[_0x8e5e('0x27')]){_0x44b1c9[_0x8e5e('0x27')]=undefined;loggerPredictive[_0x8e5e('0x42')](_0x44b1c9[_0x8e5e('0x46')],'startPredictive\x20value\x20cleared');}if(_0x44b1c9[_0x8e5e('0x61')]){clearInterval(_0x44b1c9['handlePredictive']);_0x44b1c9[_0x8e5e('0x61')]=undefined;loggerPredictive[_0x8e5e('0x42')](_0x44b1c9[_0x8e5e('0x46')],_0x8e5e('0x62'));}}function loggerCatchPredictive(_0x2a843d,_0x220642){return function(_0x116f84){loggerPredictive[_0x8e5e('0x63')](_0x220642[_0x8e5e('0x46')],_0x2a843d);loggerPredictive[_0x8e5e('0x63')](_0x116f84['stack']);clearPredictiveAttributes(_0x220642);};}function loggerCatch(_0x392989){return function(_0x52ea64){logger['error'](_0x392989,util[_0x8e5e('0x43')](_0x52ea64,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x52522e,_0x59d613,_0x5d00aa){return function(_0x117337){utils['checkContactLowerLimitOriginate'](_0x59d613,_0x5d00aa,0x0);_0x59d613['temp']=0x0;logger[_0x8e5e('0x63')](_0x52522e,util[_0x8e5e('0x43')](_0x117337,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xdf4070){return function(_0xbfa462){if(isNotNull(_0xbfa462)&&isNotNull(_0xbfa462[0x0])){if(_0xbfa462[0x0][_0x8e5e('0x64')]>0x0){_0xdf4070['message']=utils[_0x8e5e('0x65')]['CONTACTS_RESCHEDULED'];logger[_0x8e5e('0x4a')](_0x8e5e('0x66')+_0xdf4070[_0x8e5e('0x46')],_0xbfa462[0x0][_0x8e5e('0x64')],'contacts');}else{_0xdf4070[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x8e5e('0x68')+_0xdf4070['name']);}}};}function createObjHistory(_0x5ae3dd,_0x353d52,_0x32be44,_0x4bf6d1,_0xeb1337){_0x5ae3dd[_0x8e5e('0x67')]=_0x32be44;var _0x54c6e4=new Action(_0x5ae3dd,_0x353d52);var _0x4251a4=new History(_0x54c6e4);_0x4251a4[_0x8e5e('0x69')]=_0x4bf6d1;_0x4251a4[_0x8e5e('0x6a')]=_0xeb1337;_0x4251a4[_0x8e5e('0x6b')]=_0x54c6e4['starttime'];return _0x4251a4;}function unlockQueueStatus(_0x3a98af,_0x37a8b1){setTimeout(function(){if(_[_0x8e5e('0x40')](_0x3a98af[_0x8e5e('0x6c')])){loggerBooked[_0x8e5e('0x63')](_0x8e5e('0x6d'),_0x37a8b1);}_0x3a98af[_0x8e5e('0x6c')]=!![];loggerBooked[_0x8e5e('0x4a')](_0x8e5e('0x6e'),_0x37a8b1,JSON['stringify'](_[_0x8e5e('0x6f')](_0x3a98af,[_0x8e5e('0x46'),_0x8e5e('0x6c')])));},0x1f3);}function checkInterval(_0x319255){return function(){if(!isNotNull(_0x319255[_0x8e5e('0x70')])){_0x319255[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x71')];throw _0x319255[_0x8e5e('0x46')]+_0x8e5e('0x72');}if(!isNotNull(_0x319255[_0x8e5e('0x70')][_0x8e5e('0x73')])){_0x319255[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x71')];throw _0x319255['name']+_0x8e5e('0x72');}if(!isNotNull(_[_0x8e5e('0x48')](_0x319255[_0x8e5e('0x70')][_0x8e5e('0x73')]))){_0x319255[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x71')];throw _0x319255[_0x8e5e('0x46')]+_0x8e5e('0x72');}};}function checkIsIVRCampaignActive(_0x482c69){return function(){if(!utils[_0x8e5e('0x74')](_0x482c69)){_0x482c69[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')]['INACTIVE'];throw _0x482c69[_0x8e5e('0x46')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x474356){if(utils[_0x8e5e('0x75')](_0x474356)){emit(util[_0x8e5e('0x44')]('campaign:ivr:%s',_0x474356[_0x8e5e('0x46')]),_0x8e5e('0x76'),_0x474356);}}function loggerCatchQueueSummary(_0x577255,_0x474ab4){return function(_0x4ae756){clearPredictiveAttributes(_0x474ab4);emitCampaignSummary(_0x474ab4);loggerSyncQueueSummary['debug'](_0x577255,util[_0x8e5e('0x43')](_0x4ae756,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x47b3bd){if(_0x47b3bd['sendMessageOneNotActive']){if(_0x47b3bd[_0x8e5e('0x77')]===0x0){_0x47b3bd[_0x8e5e('0x78')]=![];_0x47b3bd['message']=utils[_0x8e5e('0x65')]['INACTIVE'];loggerSyncQueueSummary[_0x8e5e('0x42')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x47b3bd['name'],_0x8e5e('0x79'));}else{_0x47b3bd[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x7a')];loggerSyncQueueSummary[_0x8e5e('0x42')](_0x8e5e('0x7b'),_0x47b3bd[_0x8e5e('0x46')],_0x8e5e('0x7c'));}emitCampaignSummary(_0x47b3bd);}}function myreject(_0x4c2e7d){return function(_0x597e28){return _0x4c2e7d(msgResponse(_0x8e5e('0x7d'),_0x8e5e('0x7e'),JSON[_0x8e5e('0x7f')](_0x597e28)));};}Dialer[_0x8e5e('0x19')][_0x8e5e('0x80')]=function(_0x511f29){return!_['isUndefined'](_0x511f29)&&_0x511f29&&!_['isUndefined'](_0x511f29[_0x8e5e('0x46')])&&!_['isUndefined'](_0x511f29[_0x8e5e('0x81')])&&_0x511f29[_0x8e5e('0x81')]&&(this['trunks'][util[_0x8e5e('0x44')](_0x8e5e('0x82'),_0x511f29[_0x8e5e('0x46')])][_0x8e5e('0x83')]==='reachable'||this[_0x8e5e('0x22')][util[_0x8e5e('0x44')](_0x8e5e('0x82'),_0x511f29[_0x8e5e('0x46')])]['status']===_0x8e5e('0x84'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x4b0775){var _0x40a98a=this;return function(){if(!_0x40a98a['isTrunkReachable'](_0x4b0775[_0x8e5e('0x85')])){if(!_0x40a98a[_0x8e5e('0x80')](_0x4b0775[_0x8e5e('0x86')])){_0x4b0775['message']=utils[_0x8e5e('0x65')][_0x8e5e('0x87')];throw _0x4b0775['name']+_0x8e5e('0x88');}}};};Dialer[_0x8e5e('0x19')][_0x8e5e('0x89')]=function(_0x562cae,_0x3ac264,_0xd6040f,_0x2aa893){var _0x2f238c=this;return function(){var _0x2bc020=!![];return _0x2f238c[_0x8e5e('0x8a')](_0x562cae,_0x3ac264,_0xd6040f,_0x2aa893,_0x2bc020);};};Dialer[_0x8e5e('0x19')][_0x8e5e('0x8b')]=function(_0x422676,_0x226f49,_0x35e108,_0x48ae63){var _0x124ab9=this;return function(){var _0x29ed43=![];return _0x124ab9[_0x8e5e('0x8a')](_0x422676[_0x8e5e('0x73')],_0x226f49,_0x35e108,_0x48ae63,_0x29ed43);};};Dialer[_0x8e5e('0x19')][_0x8e5e('0x8a')]=function(_0x4ffd5e,_0x4062bf,_0x1ed765,_0xe71bb2,_0x19d662){var _0x3a5a1d=[];return new Promise(function(_0x421e4b,_0x49f04e){if(!isNotNull(_0x4ffd5e)){_0xe71bb2[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x71')];return _0x49f04e(msgResponse('ifTime',_0x8e5e('0x8c'),_0x1ed765+_0x8e5e('0x8d')));}if(_[_0x8e5e('0x48')](_0x4ffd5e)){_0xe71bb2[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x8e')];return _0x49f04e(msgResponse(_0x8e5e('0x8f'),_0x8e5e('0x8c'),_0x1ed765+'\x20Intervals\x20is\x20empty\x20'));}if(_0x4062bf&&_[_0x8e5e('0x40')](config[_0x8e5e('0x90')][_0x4062bf])){_0xe71bb2[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x91')];return _0x49f04e(msgResponse(_0x8e5e('0x8f'),'Failure',_0x1ed765+_0x8e5e('0x92')+_0x4062bf));}if(_[_0x8e5e('0x93')](_0x4ffd5e)){for(var _0x1cc938=0x0;_0x1cc938<_0x4ffd5e[_0x8e5e('0x94')];_0x1cc938+=0x1){_0x3a5a1d[_0x8e5e('0x95')](ami[_0x8e5e('0x96')]({'action':_0x8e5e('0x97'),'command':util[_0x8e5e('0x44')](_0x8e5e('0x98'),_0x4ffd5e[_0x1cc938][_0x8e5e('0x99')],!_[_0x8e5e('0x40')](config[_0x8e5e('0x90')][_0x4062bf])?_0x4062bf:'')})[_0x8e5e('0x3f')](function(_0x22db5d){return _0x22db5d[_0x8e5e('0x9a')][_0x8e5e('0x9b')](_0x8e5e('0x9c'))>=0x0;})[_0x8e5e('0x9d')](myreject(_0x49f04e)));}}else{_0x3a5a1d[_0x8e5e('0x95')](ami[_0x8e5e('0x96')]({'action':_0x8e5e('0x97'),'command':util[_0x8e5e('0x44')](_0x8e5e('0x98'),_0x4ffd5e,!_[_0x8e5e('0x40')](config[_0x8e5e('0x90')][_0x4062bf])?_0x4062bf:'')})[_0x8e5e('0x3f')](function(_0x338af5){return _0x338af5[_0x8e5e('0x9a')][_0x8e5e('0x9b')](_0x8e5e('0x9c'))>=0x0;})[_0x8e5e('0x9d')](myreject(_0x49f04e)));}Promise[_0x8e5e('0x9e')](_0x3a5a1d)[_0x8e5e('0x3f')](function(_0x11c1bc){var _0x5ba039=_[_0x8e5e('0x9f')](_0x11c1bc);if(_0x5ba039){return _0x421e4b(_0x5ba039);}else{_0xe71bb2[_0x8e5e('0x67')]=_0x19d662?utils[_0x8e5e('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x8e5e('0x65')]['OVERTIME_INTERVAL'];return _0x49f04e(msgResponse('[ifTime][promiseAll]','Failure',_0x8e5e('0xa0')+_0x19d662+'\x20'+_0x1ed765+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x4ffd5e,{'showHidden':![],'depth':null})+_0x8e5e('0xa1')+_0x4062bf));}})['catch'](function(_0x1ca461){return _0x49f04e(msgResponse(_0x8e5e('0x8f'),_0x8e5e('0x8c'),JSON[_0x8e5e('0x7f')](_0x1ca461)));});});};Dialer[_0x8e5e('0x19')]['loopCampaigns']=function(){var _0x271e21=this;return cmHopper[_0x8e5e('0xa2')]({'active':![]},{'where':{'active':!![]}})[_0x8e5e('0x3f')](function(){setInterval(function(){_0x271e21[_0x8e5e('0xa3')]();},0x3e8);});};Dialer[_0x8e5e('0x19')][_0x8e5e('0xa3')]=function(){var _0x46aa24=this;var _0x1b4512;for(var _0x3f5343 in this[_0x8e5e('0x20')]){if(typeof this[_0x8e5e('0x20')][_0x3f5343]!=='undefined'){_0x1b4512=this['campaigns'][_0x3f5343];if(utils[_0x8e5e('0x75')](_0x1b4512)&&utils['isIVRCampaignActive'](_0x1b4512)){_0x1b4512[_0x8e5e('0x78')]=!![];Promise[_0x8e5e('0xa4')]()[_0x8e5e('0x3f')](checkIsIVRCampaignActive(_0x1b4512))[_0x8e5e('0x3f')](checkInterval(_0x1b4512))[_0x8e5e('0x3f')](_0x46aa24[_0x8e5e('0xa5')](_0x1b4512))[_0x8e5e('0x3f')](_0x46aa24[_0x8e5e('0x89')](_0x1b4512[_0x8e5e('0xa6')],_0x1b4512['dialTimezone'],_0x1b4512[_0x8e5e('0x46')],_0x1b4512))[_0x8e5e('0x3f')](_0x46aa24[_0x8e5e('0x8b')](_0x1b4512[_0x8e5e('0x70')],_0x1b4512[_0x8e5e('0xa7')],_0x1b4512[_0x8e5e('0x46')],_0x1b4512))[_0x8e5e('0x3f')](_0x46aa24[_0x8e5e('0xa8')](_0x1b4512))[_0x8e5e('0x9d')](loggerCatchQueueSummary(_0x8e5e('0xa9'),_0x1b4512));}else{notSendMessagesCampaign(_0x1b4512);}}}};Dialer[_0x8e5e('0x19')][_0x8e5e('0xaa')]=function(_0x577aec){if(_0x577aec[_0x8e5e('0xab')]!=='predictive'){clearPredictiveAttributes(_0x577aec);}switch(_0x577aec[_0x8e5e('0xab')]){case _0x8e5e('0xac'):this[_0x8e5e('0xad')](_0x577aec,0x1);break;case'power':this[_0x8e5e('0xad')](_0x577aec,_0x577aec['dialPowerLevel']);break;case _0x8e5e('0xa'):this[_0x8e5e('0xa')](_0x577aec);break;case _0x8e5e('0xae'):this[_0x8e5e('0xad')](_0x577aec,0x1);break;default:logger[_0x8e5e('0x63')](_0x8e5e('0xaf'),_0x577aec[_0x8e5e('0x46')],_0x8e5e('0xb0'));}};Dialer[_0x8e5e('0x19')]['ifTime']=function(_0x1492bd,_0x1f63cb){var _0x2f3619=_0x1492bd[_0x8e5e('0xa7')];var _0x19a322=_0x1f63cb?_0x1492bd[_0x8e5e('0xa6')]:_0x1492bd[_0x8e5e('0x70')][_0x8e5e('0x73')];logger['silly']('Dialer::ifTime()',_0x19a322,_0x2f3619,_0x1492bd[_0x8e5e('0x46')],util[_0x8e5e('0x44')](_0x8e5e('0xb1'),_0x1492bd[_0x8e5e('0x46')],_0x1492bd['id']));var _0xf77126=null;return Interval[_0x8e5e('0xb2')](_0x19a322,_0x2f3619)['then'](function(_0x46c5cf){if(_0x46c5cf===!![]){return _0x46c5cf;}else{_0x1492bd[_0x8e5e('0x67')]=_0x1f63cb?utils['CAMPAIGN_STATUS'][_0x8e5e('0xb3')]:utils['CAMPAIGN_STATUS'][_0x8e5e('0xb4')];_0xf77126=msgResponse(_0x8e5e('0xb5'),_0x8e5e('0x8c'),_0x8e5e('0xa0')+_0x1f63cb+'\x20'+_0x1492bd[_0x8e5e('0x46')]+_0x8e5e('0xb6')+util[_0x8e5e('0x43')](_0x19a322,{'showHidden':![],'depth':null})+_0x8e5e('0xa1')+_0x2f3619);}if(_0xf77126!==null){logger[_0x8e5e('0xb7')](_0x8e5e('0xb8'),_0xf77126);_0xf77126[_0x8e5e('0xb9')]=_0x1f63cb;throw _0xf77126;}})[_0x8e5e('0x9d')](function(_0x158c6a){logger[_0x8e5e('0x63')](_0x8e5e('0xba'),_0x158c6a);throw msgResponse(_0x8e5e('0x7d'),_0x8e5e('0x7e'),util[_0x8e5e('0x43')](_0x158c6a,{'showHidden':![],'depth':null}));});};Dialer[_0x8e5e('0x19')]['syncAgentConnect']=function(_0x721b41){if(this[_0x8e5e('0x1f')][_0x721b41['queue']]){if(this[_0x8e5e('0x26')][_0x721b41[_0x8e5e('0xbb')]]&&this[_0x8e5e('0x26')][_0x721b41['uniqueid']][_0x8e5e('0x41')]!==_0x8e5e('0xbc')){this['updateOriginated'](this[_0x8e5e('0x1f')][_0x721b41['queue']]);this[_0x8e5e('0x26')][_0x721b41[_0x8e5e('0xbb')]][_0x8e5e('0xbd')]=moment()[_0x8e5e('0x44')](_0x8e5e('0xbe'));}}};Dialer[_0x8e5e('0x19')][_0x8e5e('0xbf')]=function(_0x4c7ddb){var _0x32cdda=this[_0x8e5e('0x26')][_0x4c7ddb[_0x8e5e('0xbb')]];if(this[_0x8e5e('0x1f')][_0x4c7ddb[_0x8e5e('0xc0')]]){if(_0x32cdda&&_0x32cdda[_0x8e5e('0x41')]!==_0x8e5e('0xbc')){delete this[_0x8e5e('0x26')][_0x4c7ddb[_0x8e5e('0xbb')]];this['voiceQueues'][_0x4c7ddb[_0x8e5e('0xc0')]][_0x8e5e('0xc1')]+=0x1;var _0x3961e2=new AgentComplete(_0x32cdda,_0x4c7ddb);if(_0x4c7ddb[_0x8e5e('0xc2')]===_0x8e5e('0xc3')){_0x3961e2[_0x8e5e('0xc4')]=this[_0x8e5e('0x1f')][_0x4c7ddb[_0x8e5e('0xc0')]]['dialQueueProject2']&&this[_0x8e5e('0x1f')][_0x4c7ddb['queue']]['dialAgiAfterHangupAgent']?moment()[_0x8e5e('0x44')](_0x8e5e('0xbe')):undefined;}hopperUtils['createHistory'](_0x3961e2)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0xc5')));hopperUtils[_0x8e5e('0xc6')](_0x3961e2)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x8e5e('0x19')][_0x8e5e('0xc7')]=function(_0x118fa7){var _0x456ed4=this[_0x8e5e('0x26')][_0x118fa7[_0x8e5e('0xbb')]];var _0x285c0a=this;var _0x43c474=![];var _0x5ae880;var _0x4dd65a;if(this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]]){if(_0x456ed4&&_0x456ed4[_0x8e5e('0x41')]!==_0x8e5e('0xbc')){delete this[_0x8e5e('0x26')][_0x118fa7[_0x8e5e('0xbb')]];this[_0x8e5e('0xc8')](this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]]);_0x456ed4[_0x8e5e('0xc9')]=moment()[_0x8e5e('0x44')](_0x8e5e('0xbe'));var _0x5b8ae6=new QueueCallerAbandon(_0x456ed4,_0x118fa7);if(utils['getSeconds'](_0x456ed4['droptime'],_0x456ed4[_0x8e5e('0xca')])>=_0x456ed4[_0x8e5e('0xcb')]){this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xcc')]+=0x1;this[_0x8e5e('0x1f')][_0x118fa7['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xcd')]+=0x1;_0x5b8ae6[_0x8e5e('0x69')]=0xa;_0x5b8ae6[_0x8e5e('0x6a')]=_0x8e5e('0xce');_0x5b8ae6[_0x8e5e('0xcf')]='TIMEOUT';_0x5b8ae6[_0x8e5e('0xc4')]=this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xd0')]?moment()[_0x8e5e('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5b8ae6[_0x8e5e('0xd1')]+=0x1;_0x5b8ae6['countglobal']+=0x1;_0x5ae880=this[_0x8e5e('0x1f')][_0x118fa7['queue']][_0x8e5e('0xd2')];_0x4dd65a=this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xd3')];hopperUtils['verifyAdditionalPhones'](_0x5b8ae6,_0x5b8ae6[_0x8e5e('0x69')],_0x456ed4[_0x8e5e('0xd4')])[_0x8e5e('0x3f')](function(_0x1d5642){_0x43c474=_0x1d5642[_0x8e5e('0xd5')]==0x1;if(_0x5b8ae6[_0x8e5e('0xd1')]>=_0x285c0a[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]]['dialDropMaxRetry']){_0x285c0a[_0x8e5e('0xd6')](_0x5b8ae6,_0x1d5642[_0x8e5e('0xd5')]);}else{hopperUtils[_0x8e5e('0xd7')]({'active':![],'countdropretry':_0x5b8ae6[_0x8e5e('0xd1')],'scheduledat':moment()[_0x8e5e('0xd8')](_0x285c0a['voiceQueues'][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xd2')],_0x8e5e('0xd9'))[_0x8e5e('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x456ed4[_0x8e5e('0xda')],'ListId':_0x456ed4[_0x8e5e('0xdb')],'VoiceQueueId':_0x456ed4[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x456ed4[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch('[rescheduleContact][Drop]'));var _0x5bff4c=new History(_0x5b8ae6);_0x5bff4c[_0x8e5e('0x69')]=0xa;_0x5bff4c[_0x8e5e('0x6a')]=_0x8e5e('0xce');_0x5bff4c[_0x8e5e('0xde')]=moment()[_0x8e5e('0x44')](_0x8e5e('0xbe'));_0x5bff4c[_0x8e5e('0x6b')]=_0x5bff4c[_0x8e5e('0xde')];_0x5bff4c['calleridname']=_0x5b8ae6[_0x8e5e('0xdf')];_0x5bff4c[_0x8e5e('0xe0')]=_0x5b8ae6[_0x8e5e('0xe0')];hopperUtils[_0x8e5e('0xe1')](_0x5bff4c)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x43c474)hopperUtils[_0x8e5e('0xe2')](_0x5b8ae6,_0x5ae880,_0x4dd65a)[_0x8e5e('0x3f')](function(){return 0x1;});});}else{this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0x50')]+=0x1;this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xe3')]+=0x1;_0x5b8ae6[_0x8e5e('0x69')]=0xb;_0x5b8ae6[_0x8e5e('0x6a')]=_0x8e5e('0xe4');_0x5b8ae6['dropreason']=_0x8e5e('0xe5');_0x5b8ae6['countabandonedretry']+=0x1;_0x5b8ae6[_0x8e5e('0xe6')]+=0x1;_0x5ae880=this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xe7')];_0x4dd65a=this[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x8e5e('0xe8')](_0x5b8ae6,_0x5b8ae6['state'],_0x456ed4['voiceQueue'])[_0x8e5e('0x3f')](function(_0x5a9d02){if(_0x5b8ae6[_0x8e5e('0xe9')]>=_0x285c0a[_0x8e5e('0x1f')][_0x118fa7['queue']][_0x8e5e('0xea')]){_0x285c0a[_0x8e5e('0xd6')](_0x5b8ae6,_0x5a9d02[_0x8e5e('0xd5')]);}else{hopperUtils[_0x8e5e('0xd7')]({'active':![],'countabandonedretry':_0x5b8ae6[_0x8e5e('0xe9')],'scheduledat':moment()[_0x8e5e('0xd8')](_0x285c0a[_0x8e5e('0x1f')][_0x118fa7[_0x8e5e('0xc0')]][_0x8e5e('0xe7')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x456ed4[_0x8e5e('0xda')],'ListId':_0x456ed4[_0x8e5e('0xdb')],'VoiceQueueId':_0x456ed4[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x456ed4[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0xeb')));var _0x6d6104=new History(_0x5b8ae6);_0x6d6104[_0x8e5e('0x69')]=0xb;_0x6d6104[_0x8e5e('0x6a')]=_0x8e5e('0xe4');_0x6d6104['starttime']=moment()[_0x8e5e('0x44')](_0x8e5e('0xbe'));_0x6d6104[_0x8e5e('0x6b')]=_0x6d6104[_0x8e5e('0xde')];_0x6d6104[_0x8e5e('0xdf')]=_0x5b8ae6[_0x8e5e('0xdf')];_0x6d6104[_0x8e5e('0xe0')]=_0x5b8ae6[_0x8e5e('0xe0')];hopperUtils[_0x8e5e('0xe1')](_0x6d6104)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0xec')));}})[_0x8e5e('0x3f')](function(){if(_0x43c474)hopperUtils[_0x8e5e('0xe2')](_0x5b8ae6,_0x5ae880,_0x4dd65a)[_0x8e5e('0x3f')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x3b0398){if(this[_0x8e5e('0x25')][_0x3b0398['uniqueid']]){this['actions'][_0x3b0398[_0x8e5e('0xbb')]][_0x8e5e('0xed')]=_0x3b0398[_0x8e5e('0xed')];}if(this[_0x8e5e('0x26')][_0x3b0398[_0x8e5e('0xbb')]]){this[_0x8e5e('0x26')][_0x3b0398['uniqueid']][_0x8e5e('0xed')]=_0x3b0398[_0x8e5e('0xed')];}};Dialer[_0x8e5e('0x19')][_0x8e5e('0x3a')]=function(_0x572501){if(!this[_0x8e5e('0x25')][_0x572501[_0x8e5e('0xee')]]){return;}var _0x398c32=this[_0x8e5e('0x1f')][this[_0x8e5e('0x25')][_0x572501[_0x8e5e('0xee')]][_0x8e5e('0xc0')]][_0x8e5e('0xef')]||_0x8e5e('0xf0');if(_0x398c32===_0x8e5e('0xf1')){if(this[_0x8e5e('0x25')][_0x572501['actionid']]&&_[_0x8e5e('0xf2')](this[_0x8e5e('0x25')][_0x572501[_0x8e5e('0xee')]][_0x8e5e('0xf3')])&&_0x572501['status']==='1'&&_0x572501[_0x8e5e('0xf4')]==='0'){if(this[_0x8e5e('0x21')][_0x572501['stateinterface']]){if(!this[_0x8e5e('0x21')][_0x572501[_0x8e5e('0xf5')]][_0x8e5e('0xf3')]){this[_0x8e5e('0x21')][_0x572501[_0x8e5e('0xf5')]]['locked']=!![];this['actions'][_0x572501[_0x8e5e('0xee')]][_0x8e5e('0xf3')]=!![];this['actions'][_0x572501[_0x8e5e('0xee')]][_0x8e5e('0xf5')]=_0x572501['stateinterface'];}}}}else if(_0x398c32==='rrmemory'){if(this[_0x8e5e('0x25')][_0x572501['actionid']]){if(this[_0x8e5e('0x21')][_0x572501[_0x8e5e('0xf5')]]){this['actions'][_0x572501[_0x8e5e('0xee')]][_0x8e5e('0xf5')]=_0x572501[_0x8e5e('0xf5')];if(_['isNil'](this['queueBooked'][this[_0x8e5e('0x25')][_0x572501[_0x8e5e('0xee')]][_0x8e5e('0xc0')]])){this[_0x8e5e('0x29')][this[_0x8e5e('0x25')][_0x572501[_0x8e5e('0xee')]]['queue']]=[];}this[_0x8e5e('0x29')][this[_0x8e5e('0x25')][_0x572501['actionid']][_0x8e5e('0xc0')]]['push'](_['merge'](_[_0x8e5e('0x6f')](this['actions'][_0x572501[_0x8e5e('0xee')]],[_0x8e5e('0xf6'),'stateinterface']),{'status':_0x572501[_0x8e5e('0x83')],'paused':_0x572501[_0x8e5e('0xf4')]}));}}}};Dialer[_0x8e5e('0x19')][_0x8e5e('0x3b')]=function(_0x1daa00){if(!this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]]){return;}var _0x1a56ec=this;var _0x2b570c=this['voiceQueues'][this['actions'][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]];var _0x10bd61=_0x2b570c['strategy']||'rrmemory';if(_0x10bd61===_0x8e5e('0xf1')){if(this[_0x8e5e('0x25')][_0x1daa00['actionid']]&&this['actions'][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xf5')]){this['preview']['run'](this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]]['idHopper'],this[_0x8e5e('0x25')][_0x1daa00['actionid']][_0x8e5e('0xf5')])['catch'](function(_0x2e5eee){logger[_0x8e5e('0x63')](_0x8e5e('0xf7'),util[_0x8e5e('0x43')](_0x2e5eee,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1a56ec[_0x8e5e('0xc8')](_0x1a56ec[_0x8e5e('0x1f')][_0x1a56ec[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]]);_0x1a56ec[_0x8e5e('0x21')][_0x1a56ec[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xf5')]][_0x8e5e('0xf3')]=![];delete _0x1a56ec[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]];unlockQueueStatus(_0x2b570c);});}else{this[_0x8e5e('0xc8')](this[_0x8e5e('0x1f')][this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x8e5e('0x25')][_0x1daa00['actionid']]['ContactId'],'ListId':this['actions'][_0x1daa00['actionid']][_0x8e5e('0xdb')],'VoiceQueueId':this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xdc')]||undefined,'CampaignId':this[_0x8e5e('0x25')][_0x1daa00['actionid']][_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0xf8')));delete this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]];unlockQueueStatus(_0x2b570c);}}else if(_0x10bd61===_0x8e5e('0xf0')){var _0x494eef;if(this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]]&&!_[_0x8e5e('0x48')](this[_0x8e5e('0x29')][this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]])){if(this['queueBookedRR'][_0x1a56ec['actions'][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]]){this['queueBookedRR'][_0x1a56ec[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]]=this['queueBookedRR'][this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]]?this[_0x8e5e('0x2a')][this['actions'][_0x1daa00['actionid']][_0x8e5e('0xc0')]]:this[_0x8e5e('0x29')][this['actions'][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]]?this[_0x8e5e('0x29')][this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]][_0x8e5e('0xf9')]||0x0:0x0;}this[_0x8e5e('0x29')][this['actions'][_0x1daa00['actionid']][_0x8e5e('0xc0')]][_0x8e5e('0xf9')]=this[_0x8e5e('0x2a')][this[_0x8e5e('0x25')][_0x1daa00[_0x8e5e('0xee')]][_0x8e5e('0xc0')]];for(var _0x2dd94d=0x0;_0x2dd94d=_0xeceab2[_0x8e5e('0x11b')]){_0x396de2[_0x8e5e('0x11c')](_0x3afdcb,_0x1c2ba3,_0x121e56,'reason19\x20machine....');}else{if(_0x3afdcb['countmachineretry']>=_0xeceab2[_0x8e5e('0x11d')]){_0x396de2[_0x8e5e('0x11e')](_0x3afdcb,_0x1c2ba3,_0x121e56,_0x8e5e('0x11f'));}else{hopperUtils[_0x8e5e('0xd7')]({'active':![],'countmachineretry':_0x3afdcb[_0x8e5e('0x116')],'scheduledat':moment()[_0x8e5e('0xd8')](_0xeceab2['dialMachineRetryFrequency'],'minutes')[_0x8e5e('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3afdcb[_0x8e5e('0xda')],'ListId':_0x3afdcb[_0x8e5e('0xdb')],'VoiceQueueId':_0x3afdcb['VoiceQueueId']||undefined,'CampaignId':_0x3afdcb[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x120')));_0x1c2ba3({'reschedule':0x1});}}});}if(_0x14664a[_0x8e5e('0x41')]===_0x8e5e('0xbc')&&this[_0x8e5e('0x20')][_0x14664a[_0x8e5e('0xc0')]][_0x8e5e('0x10b')]&&_0x39ef4d[_0x8e5e('0x10c')]===_0x8e5e('0x10d')){delete this[_0x8e5e('0x26')][_0x39ef4d['uniqueid']];this[_0x8e5e('0xc8')](this[_0x8e5e('0x20')][_0x14664a[_0x8e5e('0xc0')]]);_0x34af49=new Hangup(_0x14664a,_0x39ef4d);_0x34af49['state']=0x12;_0x34af49[_0x8e5e('0x6a')]=_0x8e5e('0x10f');_0x34af49['membername']=_0x8e5e('0x121');ami[_0x8e5e('0x110')](_0x8e5e('0x111'),ut[_0x8e5e('0x112')](_0x34af49,'amd'));this['saveInDb'](_0x34af49,_0x8e5e('0x122'),_0x8e5e('0x123'));}if(_0x14664a['type']==='ivr'&&this['campaigns'][_0x14664a[_0x8e5e('0xc0')]]['dialAMDActive']&&_0x39ef4d['value']===_0x8e5e('0x114')){return new Promise(function(_0x21d47b,_0x45134a){delete _0x396de2[_0x8e5e('0x26')][_0x39ef4d[_0x8e5e('0xbb')]];_0x396de2['updateOriginated'](_0x396de2[_0x8e5e('0x20')][_0x14664a[_0x8e5e('0xc0')]]);_0x396de2[_0x8e5e('0x20')][_0x14664a[_0x8e5e('0xc0')]][_0x8e5e('0xc1')]+=0x1;_0x396de2[_0x8e5e('0x20')][_0x14664a[_0x8e5e('0xc0')]][_0x8e5e('0x10e')]+=0x1;var _0x8fb6e6=_0x396de2[_0x8e5e('0x20')][_0x14664a[_0x8e5e('0xc0')]];var _0x2b31ee=new Hangup(_0x14664a,_0x39ef4d);_0x2b31ee[_0x8e5e('0x69')]=0x13;_0x2b31ee[_0x8e5e('0x6a')]=_0x8e5e('0x115');_0x2b31ee[_0x8e5e('0x124')]=_0x8e5e('0x121');_0x2b31ee['countmachineretry']+=0x1;_0x2b31ee[_0x8e5e('0xe6')]+=0x1;_0x2b31ee[_0x8e5e('0x113')]=!![];ami[_0x8e5e('0x110')]('custom:amd',ut[_0x8e5e('0x112')](_0x2b31ee,'amd'));hopperUtils[_0x8e5e('0xe1')](_0x2b31ee)[_0x8e5e('0x9d')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2b31ee[_0x8e5e('0x117')]+_0x2b31ee[_0x8e5e('0x125')]+_0x2b31ee[_0x8e5e('0x118')]+_0x2b31ee[_0x8e5e('0x119')]+_0x2b31ee[_0x8e5e('0xd1')]+_0x2b31ee['countabandonedretry']+_0x2b31ee['countmachineretry']+_0x2b31ee[_0x8e5e('0x11a')]>=_0x8fb6e6[_0x8e5e('0x11b')]){_0x396de2[_0x8e5e('0x11c')](_0x2b31ee,_0x21d47b,_0x45134a,_0x8e5e('0x126'));}else{if(_0x2b31ee[_0x8e5e('0x116')]>=_0x8fb6e6['dialMachineMaxRetry']){_0x396de2[_0x8e5e('0x11e')](_0x2b31ee,_0x21d47b,_0x45134a,_0x8e5e('0x11f'));}else{hopperUtils[_0x8e5e('0xd7')]({'active':![],'countmachineretry':_0x2b31ee[_0x8e5e('0x116')],'scheduledat':moment()[_0x8e5e('0xd8')](_0x8fb6e6[_0x8e5e('0x127')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x2b31ee[_0x8e5e('0xda')],'ListId':_0x2b31ee[_0x8e5e('0xdb')],'VoiceQueueId':_0x2b31ee[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x2b31ee[_0x8e5e('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x21d47b({'reschedule':0x1});}}});}}};Dialer[_0x8e5e('0x19')][_0x8e5e('0x35')]=function(_0x59ed5f){var _0x2426b9=this[_0x8e5e('0x26')][_0x59ed5f[_0x8e5e('0xbb')]];var _0x4da44f;if(_0x2426b9&&_0x2426b9[_0x8e5e('0x41')]===_0x8e5e('0xbc')){delete this[_0x8e5e('0x26')][_0x59ed5f[_0x8e5e('0xbb')]];this[_0x8e5e('0xc8')](this[_0x8e5e('0x20')][_0x2426b9[_0x8e5e('0xc0')]]);this[_0x8e5e('0x20')][_0x2426b9[_0x8e5e('0xc0')]][_0x8e5e('0x128')]+=0x1;_0x4da44f=new Hangup(_0x2426b9,_0x59ed5f);hopperUtils['createHistory'](_0x4da44f)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x129')));hopperUtils['moveContactManagedDialer'](_0x4da44f)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x12a')));}if(_0x2426b9&&_0x2426b9[_0x8e5e('0x41')]!==_0x8e5e('0xbc')&&isNotNull(this[_0x8e5e('0x1f')][_0x2426b9[_0x8e5e('0xc0')]][_0x8e5e('0x12b')])){delete this['uniqueId'][_0x59ed5f[_0x8e5e('0xbb')]];this['updateOriginated'](this[_0x8e5e('0x1f')][_0x2426b9['queue']]);this[_0x8e5e('0x1f')][_0x2426b9[_0x8e5e('0xc0')]][_0x8e5e('0xc1')]+=0x1;this['voiceQueues'][_0x2426b9[_0x8e5e('0xc0')]][_0x8e5e('0x10e')]+=0x1;_0x4da44f=new Hangup(_0x2426b9,_0x59ed5f);_0x4da44f['state']=0x10;_0x4da44f[_0x8e5e('0x6a')]=_0x8e5e('0x12c');_0x4da44f[_0x8e5e('0x124')]=_0x8e5e('0x12d');hopperUtils[_0x8e5e('0xe1')](_0x4da44f)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x129')));hopperUtils[_0x8e5e('0xc6')](_0x4da44f)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x12a')));}if(_0x2426b9&&_0x2426b9[_0x8e5e('0x41')]!==_0x8e5e('0xbc')&&!isNotNull(this[_0x8e5e('0x1f')][_0x2426b9[_0x8e5e('0xc0')]]['dialQueueProject'])){delete this[_0x8e5e('0x26')][_0x59ed5f[_0x8e5e('0xbb')]];this[_0x8e5e('0xc8')](this['voiceQueues'][_0x2426b9[_0x8e5e('0xc0')]]);this[_0x8e5e('0x1f')][_0x2426b9[_0x8e5e('0xc0')]][_0x8e5e('0x12e')]+=0x1;_0x4da44f=new Hangup(_0x2426b9,_0x59ed5f);_0x4da44f[_0x8e5e('0x69')]=0xc;_0x4da44f[_0x8e5e('0x6a')]=_0x59ed5f['cause-txt'];_0x4da44f['membername']=_0x8e5e('0x12f');hopperUtils[_0x8e5e('0xe1')](_0x4da44f)[_0x8e5e('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x8e5e('0xc6')](_0x4da44f)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x8e5e('0x19')][_0x8e5e('0xb')]=function(_0x52a248){var _0x2c728c=this;if(!_0x2c728c['queuesSummary'][_0x52a248['name']]){_0x2c728c[_0x8e5e('0x2b')][_0x52a248[_0x8e5e('0x46')]]={'running':![]};}else if(_0x2c728c['queuesSummary'][_0x52a248[_0x8e5e('0x46')]][_0x8e5e('0x130')]===!![]){return;}else if(_0x2c728c[_0x8e5e('0x2b')][_0x52a248[_0x8e5e('0x46')]][_0x8e5e('0x130')]===![]){_0x2c728c[_0x8e5e('0x2b')][_0x52a248[_0x8e5e('0x46')]]['running']=!![];}var _0x205a3e=_0x2c728c[_0x8e5e('0x1f')][_0x52a248[_0x8e5e('0x46')]];var _0x4f908c=_0x205a3e['message']!==utils['CAMPAIGN_STATUS'][_0x8e5e('0x131')];var _0x474364=utils[_0x8e5e('0x132')](_0x205a3e);_0x205a3e[_0x8e5e('0x133')]=utils[_0x8e5e('0x134')](_0x205a3e,_0x2c728c[_0x8e5e('0x22')]);Promise['resolve']()['then'](function(){if(_0x205a3e[_0x8e5e('0x133')]===utils[_0x8e5e('0x65')]['INACTIVE']){if(_0x4f908c){clearPredictiveAttributes(_0x205a3e);_0x52a248['startPredictive']=undefined;_0x52a248[_0x8e5e('0x28')]=undefined;}if(_0x205a3e[_0x8e5e('0x133')]===utils[_0x8e5e('0x65')][_0x8e5e('0x131')]){_0x52a248[_0x8e5e('0x135')]=0x0;_0x52a248[_0x8e5e('0xf4')]=0x0;_0x52a248[_0x8e5e('0x136')]=0x0;_0x52a248[_0x8e5e('0x137')]=0x0;_0x52a248[_0x8e5e('0x138')]=0x0;}}else if(_0x205a3e[_0x8e5e('0x133')]===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x474364){return _0x2c728c[_0x8e5e('0x8f')](_0x205a3e,!![])['then'](function(){return _0x2c728c['ifTime'](_0x205a3e,![]);})[_0x8e5e('0x3f')](function(){return _0x2c728c['checkDialMethod'](_0x205a3e);})[_0x8e5e('0x9d')](function(_0x1ac05b){loggerSyncQueueSummary[_0x8e5e('0x42')](_0x8e5e('0x139'),util[_0x8e5e('0x43')](_0x1ac05b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x205a3e);});}else{clearPredictiveAttributes(_0x205a3e);}})['then'](function(){var _0x3f3b30=_0x52a248[_0x8e5e('0x13a')](_0x205a3e);if(_0x3f3b30||_0x205a3e[_0x8e5e('0x13b')]){_0x205a3e[_0x8e5e('0x13b')]=![];_0x52a248[_0x8e5e('0x13c')](_0x205a3e);Object[_0x8e5e('0x13d')](_0x205a3e,_0x52a248);emitOutboundVoiceQueueSummary(_0x52a248);}_0x2c728c[_0x8e5e('0x2b')][_0x205a3e[_0x8e5e('0x46')]][_0x8e5e('0x130')]=![];})[_0x8e5e('0x9d')](function(_0xa1041a){logger[_0x8e5e('0x63')](_0x8e5e('0x139'),util[_0x8e5e('0x43')](_0xa1041a,{'showHidden':![],'depth':null}));_0x2c728c[_0x8e5e('0x2b')][_0x205a3e[_0x8e5e('0x46')]][_0x8e5e('0x130')]=![];});};Dialer[_0x8e5e('0x19')][_0x8e5e('0x33')]=_['throttle'](function(){var _0x3d183c=_[_0x8e5e('0x13e')](this[_0x8e5e('0x1f')],function(_0x320462){return _0x320462[_0x8e5e('0x13f')];});var _0x2eb633=_[_0x8e5e('0x13e')](this[_0x8e5e('0x21')],function(_0x271897){return _0x271897[_0x8e5e('0x140')]&&_0x271897[_0x8e5e('0x83')]==='reachable';});if(_0x3d183c[_0x8e5e('0x94')]>0x0&&_0x2eb633[_0x8e5e('0x94')]>0x0){return Promise['resolve']()['then'](cmHopper[_0x8e5e('0x141')](_[_0x8e5e('0x142')](_0x3d183c,'id'),previewRecallmeReminderInterval,_[_0x8e5e('0x142')](_0x2eb633,'id')))[_0x8e5e('0x3f')](function(_0x5f30d6){for(var _0x38f178=0x0;_0x38f178<_0x5f30d6['length'];_0x38f178++){var _0x2431f7=_0x5f30d6[_0x38f178]['Agent'][_0x8e5e('0x46')];if(_0x2431f7)io['to'](util['format'](_0x8e5e('0x143'),_0x2431f7))[_0x8e5e('0x110')](_0x8e5e('0x144'),{'hopper':_0x5f30d6[_0x38f178]});}})[_0x8e5e('0x9d')](function(_0x30a60e){logger[_0x8e5e('0x63')](_0x8e5e('0x145'),_0x30a60e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8e5e('0x19')][_0x8e5e('0x3d')]=function(){var _0x176236=this;setInterval(function(){_0x176236['clearZombieChannels'](_0x176236[_0x8e5e('0x26')],'[uniqueid]');_0x176236[_0x8e5e('0x146')](_0x176236[_0x8e5e('0x25')],_0x8e5e('0x147'));},0x32c8);};Dialer[_0x8e5e('0x19')][_0x8e5e('0x146')]=function(_0x1d13e2,_0xd12b5b){var _0x1fcc91=this;for(var _0x6f0b0d in _0x1d13e2){if(typeof _0x1d13e2[_0x6f0b0d]!==_0x8e5e('0x148')){this['sequence'][_0x8e5e('0x1a')](function(){if(!_['isNil'](_0x1d13e2[_0x6f0b0d])){return ami['Action']({'action':'status','channel':_0x1d13e2[_0x6f0b0d]['channel']})[_0x8e5e('0x9d')](function(_0x28591a){if(_0x28591a[_0x8e5e('0x67')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1d13e2[_0x6f0b0d]&&_0x1d13e2[_0x6f0b0d][_0x8e5e('0x41')]!==_0x8e5e('0xbc')){_0x1fcc91[_0x8e5e('0xc8')](_0x1fcc91['voiceQueues'][_0x1d13e2[_0x6f0b0d][_0x8e5e('0xc0')]]);logger[_0x8e5e('0x63')](_0x8e5e('0x149'),_0xd12b5b,_0x6f0b0d,_0x1d13e2[_0x6f0b0d]['queue']);delete _0x1d13e2[_0x6f0b0d];}if(_0x1d13e2[_0x6f0b0d]&&_0x1d13e2[_0x6f0b0d][_0x8e5e('0x41')]===_0x8e5e('0xbc')){_0x1fcc91['updateOriginated'](_0x1fcc91[_0x8e5e('0x20')][_0x1d13e2[_0x6f0b0d][_0x8e5e('0xc0')]]);logger['error']('[Dialer][checkChannel][ivr]',_0xd12b5b,_0x6f0b0d,_0x1d13e2[_0x6f0b0d][_0x8e5e('0xc0')]);delete _0x1d13e2[_0x6f0b0d];}},0x2328);}});}});}}};Dialer[_0x8e5e('0x19')][_0x8e5e('0x14a')]=function(_0x59cbb7){return Promise[_0x8e5e('0xa4')]()['then'](voiceQueueRt[_0x8e5e('0x14a')](_0x59cbb7))[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x14b')));};Dialer['prototype'][_0x8e5e('0xc8')]=function(_0x3fcd6d){if(!_['isUndefined'](_0x3fcd6d)&&_0x3fcd6d!==null){if(typeof _0x3fcd6d[_0x8e5e('0x77')]!==_0x8e5e('0x148')){if(_0x3fcd6d[_0x8e5e('0x77')]>0x0){_0x3fcd6d[_0x8e5e('0x77')]-=0x1;}else{logger[_0x8e5e('0x63')](_0x8e5e('0x14c'));}}}else{logger[_0x8e5e('0x63')](_0x8e5e('0x14d'));}};Dialer[_0x8e5e('0x19')]['loggerHandler']=function(_0x4a0347,_0x1164a9){var _0x1f62bd=this;return function(_0xd80f84){_0x1f62bd[_0x8e5e('0xc8')](_0x1164a9);logger[_0x8e5e('0x63')](_0x4a0347,util[_0x8e5e('0x43')](_0xd80f84,{'showHidden':![],'depth':null}));};};Dialer[_0x8e5e('0x19')][_0x8e5e('0x14e')]=function(_0x96346f,_0x13e590,_0x11f8d1){var _0x37108e={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x13e590);this['saveInDb'](_[_0x8e5e('0x5f')](_0x37108e,_['pick'](_0x11f8d1,[_0x8e5e('0xda'),_0x8e5e('0xdb'),_0x8e5e('0x14f'),_0x8e5e('0xdc'),'CampaignId'])),_0x8e5e('0x150'),_0x8e5e('0x151'));logger[_0x8e5e('0x63')](_0x96346f);};Dialer['prototype'][_0x8e5e('0x152')]=function(_0x2f30bf,_0x4fb546,_0x4d3569){hopperUtils[_0x8e5e('0xe1')](_0x2f30bf)[_0x8e5e('0x9d')](loggerCatch(_0x4fb546));hopperUtils[_0x8e5e('0xc6')](_0x2f30bf)[_0x8e5e('0x9d')](loggerCatch(_0x4d3569));};Dialer['prototype'][_0x8e5e('0xd6')]=function(_0x471363,_0x5bacb6){hopperUtils[_0x8e5e('0xe1')](_0x471363)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0xc5')));if(_0x5bacb6==0x0){hopperUtils['moveContactManagedDialer'](_0x471363)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x153')));}};Dialer[_0x8e5e('0x19')]['checkPreviewRecallReminder']=function(_0x1f2f6c){return Promise[_0x8e5e('0xa4')]()[_0x8e5e('0x3f')](cmHopper[_0x8e5e('0x141')](_0x1f2f6c['id'],previewRecallmeReminderInterval))[_0x8e5e('0x3f')](function(_0x4ebf23){for(var _0x18544f=0x0;_0x18544f<_0x4ebf23['length'];_0x18544f++){var _0x5a39aa=_0x4ebf23[_0x18544f][_0x8e5e('0x154')]['name'];if(_0x5a39aa)io['to'](util[_0x8e5e('0x44')](_0x8e5e('0x143'),_0x5a39aa))['emit'](_0x8e5e('0x144'),{'hopper':_0x4ebf23[_0x18544f]});}})[_0x8e5e('0x9d')](function(){});};Dialer[_0x8e5e('0x19')][_0x8e5e('0xa8')]=function(_0x4e9d68){var _0x533e7c=this;return function(){_0x533e7c[_0x8e5e('0x155')](_0x4e9d68);};};Dialer[_0x8e5e('0x19')][_0x8e5e('0x156')]=function(_0xf28167,_0x2fe6e9){var _0x14845b=this;var _0x166bcd=uuid['v4']();this['actions'][_0x166bcd]=new Action(_0xf28167,_0x2fe6e9,_0x166bcd);return new Promise(function(_0x4add5d,_0x42a4f4){if(_[_0x8e5e('0x40')](_0xf28167)&&typeof _0xf28167!=='object'){return _0x42a4f4(msgResponse(_0x8e5e('0x157'),_0x8e5e('0x8c'),_0x8e5e('0x158')));}if(_[_0x8e5e('0x40')](_0x2fe6e9['phone'])||_0x2fe6e9[_0x8e5e('0x159')]===null){return _0x42a4f4(msgResponse(_0x8e5e('0x157'),'Failure',_0x8e5e('0x15a')));}var _0x19a796={'XMD-CALLERID':_0x14845b['actions'][_0x166bcd]['getCaller'](),'XMD-AGI':_0xf28167[_0x8e5e('0x12b')]?util[_0x8e5e('0x44')](_0x8e5e('0x15b'),ipAgi,_0xf28167[_0x8e5e('0x12b')]):_0x8e5e('0x15c'),'XMD-AGIAFTER':_0xf28167['dialQueueProject2']?util[_0x8e5e('0x44')](_0x8e5e('0x15b'),ipAgi,_0xf28167[_0x8e5e('0xd0')]):_0x8e5e('0x15c'),'XMD-QUEUE':utils[_0x8e5e('0x15d')](_0xf28167)?util['format']('\x22%s,%s%s,,,%s\x22',_0xf28167[_0x8e5e('0x46')],_0xf28167[_0x8e5e('0x15e')]||'',_0xf28167[_0x8e5e('0x15f')]?'c':'',_0xf28167[_0x8e5e('0xcb')]||0x3):'NONE','XMD-CONTACTID':_0x2fe6e9[_0x8e5e('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x14845b[_0x8e5e('0x25')][_0x166bcd]['getCaller'](),'XMD-AMD':_0xf28167[_0x8e5e('0x10b')]?_0x8e5e('0x160'):_0x8e5e('0x15c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xf28167['dialAMDActive']){_0x19a796['XMD-AMDINITIALSILENCE']=_0xf28167[_0x8e5e('0x161')]||0x9c4;_0x19a796[_0x8e5e('0x162')]=_0xf28167['dialAMDGreeting']||0x5dc;_0x19a796['XMD-AMDAFTERGREETINGSILENCE']=_0xf28167[_0x8e5e('0x163')]||0x320;_0x19a796[_0x8e5e('0x164')]=_0xf28167[_0x8e5e('0x165')]||0x1388;_0x19a796['XMD-AMDMINWORDLENGTH']=_0xf28167[_0x8e5e('0x166')]||0x64;_0x19a796['XMD-AMDBETWEENWORDSSILENCE']=_0xf28167[_0x8e5e('0x167')]||0x32;_0x19a796[_0x8e5e('0x168')]=_0xf28167[_0x8e5e('0x169')]||0x3;_0x19a796[_0x8e5e('0x16a')]=_0xf28167[_0x8e5e('0x16b')]||0x100;_0x19a796['XMD-AMDMAXIMUMWORDLENGTH']=_0xf28167[_0x8e5e('0x16c')]||0x1388;}if(utils['isOutboundQueue'](_0xf28167)){_0x19a796[_0x8e5e('0x16d')]=_0x2fe6e9['VoiceQueueId'];}else{_0x19a796[_0x8e5e('0x16e')]=_0x2fe6e9[_0x8e5e('0xdd')];}var _0x323686=utils['setXMDContactVariables'](_0x2fe6e9['Contact']);Object['assign'](_0x19a796,_0x323686);var _0x212653=_0x14845b[_0x8e5e('0x80')](_0xf28167[_0x8e5e('0x85')])?utils[_0x8e5e('0x16f')](_0xf28167[_0x8e5e('0x85')][_0x8e5e('0x170')],_0xf28167[_0x8e5e('0x171')],_0xf28167[_0x8e5e('0x172')]>0x0?utils[_0x8e5e('0x173')](_0xf28167[_0x8e5e('0x174')],_0xf28167[_0x8e5e('0x172')]):_0xf28167[_0x8e5e('0x174')]):utils[_0x8e5e('0x16f')](_[_0x8e5e('0xf2')](_0xf28167[_0x8e5e('0x86')])?_0xf28167[_0x8e5e('0x85')][_0x8e5e('0x170')]:_0xf28167[_0x8e5e('0x86')]['callerid'],_0xf28167[_0x8e5e('0x171')],_0xf28167['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0xf28167['dialOriginateCallerIdNumber'],_0xf28167[_0x8e5e('0x172')]):_0xf28167[_0x8e5e('0x174')]);if(_0x212653){_0x19a796['XMD-ORIGINATECALLERIDNAME']=_0x14845b[_0x8e5e('0x25')][_0x166bcd][_0x8e5e('0x175')]=utils[_0x8e5e('0x176')](_0x212653);_0x19a796[_0x8e5e('0x177')]=_0x2fe6e9['phone'];}_0xf28167['variables']=_0x19a796;return ami[_0x8e5e('0x96')]({'actionid':_0x166bcd,'action':_0x8e5e('0x157'),'channel':_0x14845b[_0x8e5e('0x80')](_0xf28167[_0x8e5e('0x85')])?util[_0x8e5e('0x44')](_0x8e5e('0x178'),_0xf28167[_0x8e5e('0x85')][_0x8e5e('0x46')],isNotNull(_0xf28167['dialPrefix'])?_0xf28167['dialPrefix'][_0x8e5e('0x179')]()||'':'',_0xf28167['dialCutDigit']>0x0?_0x2fe6e9[_0x8e5e('0x159')]['substring'](_0xf28167[_0x8e5e('0x17a')]):_0x2fe6e9['phone']):util['format'](_0x8e5e('0x178'),_['isNil'](_0xf28167['TrunkBackup'])?_0xf28167['Trunk'][_0x8e5e('0x46')]:_0xf28167[_0x8e5e('0x86')][_0x8e5e('0x46')],isNotNull(_0xf28167[_0x8e5e('0x17b')])?_0xf28167[_0x8e5e('0x17b')][_0x8e5e('0x179')]()||'':'',_0xf28167['dialCutDigit']>0x0?_0x2fe6e9[_0x8e5e('0x159')][_0x8e5e('0x17c')](_0xf28167[_0x8e5e('0x17a')]):_0x2fe6e9[_0x8e5e('0x159')]),'callerid':_0x212653,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x19a796,'timeout':(_0xf28167[_0x8e5e('0x17d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x166bcd})[_0x8e5e('0x3f')](function(_0x11dbd4){return _0x4add5d(_0x11dbd4);})['catch'](function(_0x599250){_0xf28167[_0x8e5e('0x17e')]+=0x1;var _0x523d26=new History(_0x14845b['actions'][_0x166bcd]);logger[_0x8e5e('0x63')](util[_0x8e5e('0x44')](_0x8e5e('0x17f'),JSON[_0x8e5e('0x7f')](_0x599250)));_0x523d26[_0x8e5e('0x69')]=0xe;_0x523d26[_0x8e5e('0x6a')]=_0x8e5e('0x180');_0x523d26[_0x8e5e('0xde')]=moment()[_0x8e5e('0x44')](_0x8e5e('0xbe'));_0x523d26[_0x8e5e('0x6b')]=_0x523d26['starttime'];hopperUtils[_0x8e5e('0xe1')](_0x523d26)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x181')));_0x14845b[_0x8e5e('0xc6')](_0x523d26)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x181')))[_0x8e5e('0x1c')](function(){delete _0x14845b[_0x8e5e('0x25')][_0x166bcd];return _0x42a4f4(msgResponse(_0x8e5e('0x157'),'Error',_0x8e5e('0x182')));});});});};Dialer[_0x8e5e('0x19')][_0x8e5e('0x183')]=function(_0x476f0c,_0x1ddf08,_0x58e668){var _0x1aef05=new History(_0x1ddf08);if(_0x1aef05[_0x8e5e('0x117')]+_0x1aef05['countcongestionretry']+_0x1aef05[_0x8e5e('0x118')]+_0x1aef05['countnosuchnumberretry']+_0x1aef05[_0x8e5e('0xd1')]+_0x1aef05[_0x8e5e('0xe9')]+_0x1aef05[_0x8e5e('0x116')]+_0x1aef05[_0x8e5e('0x11a')]>=_0x58e668[_0x8e5e('0x11b')]-0x1){return!![];}switch(_0x476f0c){case 0x3:if(_0x1aef05[_0x8e5e('0x118')]>=_0x58e668[_0x8e5e('0x184')]-0x1){return!![];}hopperUtils[_0x8e5e('0xd7')]({'active':![],'countnoanswerretry':_0x1aef05[_0x8e5e('0x118')]+=0x1,'scheduledat':moment()[_0x8e5e('0xd8')](_0x58e668[_0x8e5e('0x185')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x1aef05[_0x8e5e('0xda')],'ListId':_0x1aef05[_0x8e5e('0xdb')],'VoiceQueueId':_0x1aef05[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x186')));break;case 0x5:if(_0x1aef05['countbusyretry']>=_0x58e668['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1aef05[_0x8e5e('0x117')]+=0x1,'scheduledat':moment()[_0x8e5e('0xd8')](_0x58e668[_0x8e5e('0x187')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x1aef05[_0x8e5e('0xda')],'ListId':_0x1aef05[_0x8e5e('0xdb')],'VoiceQueueId':_0x1aef05['VoiceQueueId']||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x188')));break;case 0x8:if(_0x1aef05[_0x8e5e('0x125')]>=_0x58e668[_0x8e5e('0x189')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1aef05[_0x8e5e('0x125')]+=0x1,'scheduledat':moment()[_0x8e5e('0xd8')](_0x58e668[_0x8e5e('0x18a')],_0x8e5e('0xd9'))['format'](_0x8e5e('0xbe')),'ContactId':_0x1aef05['ContactId'],'ListId':_0x1aef05[_0x8e5e('0xdb')],'VoiceQueueId':_0x1aef05[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})['catch'](loggerCatch(_0x8e5e('0x18b')));break;case 0x0:if(_0x1aef05['countnosuchnumberretry']>=_0x58e668[_0x8e5e('0x18c')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1aef05[_0x8e5e('0x119')]+=0x1,'scheduledat':moment()[_0x8e5e('0xd8')](_0x58e668[_0x8e5e('0x18d')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x1aef05[_0x8e5e('0xda')],'ListId':_0x1aef05[_0x8e5e('0xdb')],'VoiceQueueId':_0x1aef05[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x18e')));}break;case 0xa:if(_0x1aef05['countdropretry']>=_0x58e668[_0x8e5e('0x18f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1aef05[_0x8e5e('0xd1')]+=0x1,'scheduledat':moment()['add'](_0x58e668[_0x8e5e('0xd2')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x1aef05[_0x8e5e('0xda')],'ListId':_0x1aef05['ListId'],'VoiceQueueId':_0x1aef05[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x190')));break;case 0xb:if(_0x1aef05['countabandonedretry']>=_0x58e668['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x8e5e('0xd7')]({'active':![],'countabandonedretry':_0x1aef05[_0x8e5e('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x58e668[_0x8e5e('0xe7')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x1aef05[_0x8e5e('0xda')],'ListId':_0x1aef05['ListId'],'VoiceQueueId':_0x1aef05[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1aef05[_0x8e5e('0x116')]>=_0x58e668[_0x8e5e('0x11d')]-0x1){return!![];}hopperUtils[_0x8e5e('0xd7')]({'active':![],'countmachineretry':_0x1aef05[_0x8e5e('0x116')]+=0x1,'scheduledat':moment()[_0x8e5e('0xd8')](_0x58e668[_0x8e5e('0x127')],_0x8e5e('0xd9'))[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x1aef05[_0x8e5e('0xda')],'ListId':_0x1aef05[_0x8e5e('0xdb')],'VoiceQueueId':_0x1aef05[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x120')));break;case 0x14:if(_0x1aef05['countagentrejectretry']>=_0x58e668[_0x8e5e('0x191')]-0x1){return!![];}hopperUtils[_0x8e5e('0xd7')]({'active':![],'countagentrejectretry':_0x1aef05['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x8e5e('0xd8')](_0x58e668[_0x8e5e('0x192')],'minutes')[_0x8e5e('0x44')](_0x8e5e('0xbe')),'ContactId':_0x1aef05['ContactId'],'ListId':_0x1aef05[_0x8e5e('0xdb')],'VoiceQueueId':_0x1aef05[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x1aef05[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x193')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x4789ec,_0x38b848,_0x2c748c){var _0x263210=this;var _0x284d88=new History(_0x4789ec);var _0x1792be=![];var _0x21ebbc;var _0x12f2fc;return new Promise(function(_0x68bfce,_0x56387c){if(_[_0x8e5e('0x40')](_0x38b848)&&typeof _0x38b848!==_0x8e5e('0x194')){return _0x56387c(msgResponse('[callProgressDetecting]','Failure',_0x8e5e('0x195')));}if(_[_0x8e5e('0x40')](_0x2c748c)&&typeof _0x2c748c!=='object'){return _0x56387c(msgResponse(_0x8e5e('0x196'),_0x8e5e('0x8c'),_0x8e5e('0x197')));}hopperUtils[_0x8e5e('0xe8')](_0x284d88,_0x2c748c[_0x8e5e('0xc2')],_0x38b848)[_0x8e5e('0x3f')](function(_0x200bee){if(_0x200bee['additional']==0x1)_0x1792be=!![];switch(_0x2c748c[_0x8e5e('0xc2')]){case'0':_0x38b848[_0x8e5e('0x198')]+=0x1;_0x284d88[_0x8e5e('0x69')]=0x0;_0x284d88[_0x8e5e('0x6a')]=_0x8e5e('0x199');_0x284d88[_0x8e5e('0x119')]+=0x1;_0x284d88[_0x8e5e('0xe6')]+=0x1;ami['emit'](_0x8e5e('0x19a'),ut[_0x8e5e('0x112')](_0x4789ec,'nosuchnumber'));_0x21ebbc=_0x38b848[_0x8e5e('0x18d')];_0x12f2fc=_0x38b848['callAdditionalPhoneAfterMin'];hopperUtils[_0x8e5e('0xe1')](_0x284d88)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x19b')));if(_0x263210[_0x8e5e('0x183')](0x0,_0x4789ec,_0x38b848)&&!_0x1792be){if(_0x284d88[_0x8e5e('0x119')]>=_0x38b848[_0x8e5e('0x18c')]){_0x263210[_0x8e5e('0x11e')](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x19c'));}else{_0x263210[_0x8e5e('0x11c')](_0x284d88,_0x68bfce,_0x56387c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x38b848[_0x8e5e('0x19d')]+=0x1;_0x284d88[_0x8e5e('0x69')]=0x3;_0x284d88[_0x8e5e('0x6a')]=_0x8e5e('0x19e');_0x284d88[_0x8e5e('0x118')]+=0x1;_0x284d88[_0x8e5e('0xe6')]+=0x1;var _0x48eaca=ut['buildNoAnswerEventPayload'](_0x4789ec,_0x38b848);ami[_0x8e5e('0x110')](_0x8e5e('0x19f'),_0x48eaca);_0x21ebbc=_0x38b848[_0x8e5e('0x185')];_0x12f2fc=_0x38b848[_0x8e5e('0xd3')];hopperUtils['createHistory'](_0x284d88)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x1a0')));if(_0x263210['checkRetriveMax'](0x3,_0x4789ec,_0x38b848)&&!_0x1792be){if(_0x284d88['countnoanswerretry']>=_0x38b848[_0x8e5e('0x184')]){_0x263210[_0x8e5e('0x11e')](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1a1'));}else{_0x263210['stateGlobal'](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1a1'));}}break;case'5':_0x38b848[_0x8e5e('0x1a2')]+=0x1;_0x284d88[_0x8e5e('0x69')]=0x5;_0x284d88[_0x8e5e('0x6a')]=_0x8e5e('0x1a3');_0x284d88['countbusyretry']+=0x1;_0x284d88[_0x8e5e('0xe6')]+=0x1;ami[_0x8e5e('0x110')](_0x8e5e('0x1a4'),ut[_0x8e5e('0x112')](_0x4789ec,'busy'));_0x21ebbc=_0x38b848[_0x8e5e('0x187')];_0x12f2fc=_0x38b848['callAdditionalPhoneAfterMin'];hopperUtils[_0x8e5e('0xe1')](_0x284d88)[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x1a5')));if(_0x263210[_0x8e5e('0x183')](0x5,_0x4789ec,_0x38b848)&&!_0x1792be){if(_0x284d88[_0x8e5e('0x117')]>=_0x38b848[_0x8e5e('0x1a6')]){_0x263210[_0x8e5e('0x11e')](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1a7'));}else{_0x263210[_0x8e5e('0x11c')](_0x284d88,_0x68bfce,_0x56387c,'reason\x205\x20busy');}}break;case'8':_0x38b848['outboundCongestionCallsDay']+=0x1;_0x284d88[_0x8e5e('0x69')]=0x8;_0x284d88[_0x8e5e('0x6a')]=_0x8e5e('0x1a8');_0x284d88[_0x8e5e('0x125')]+=0x1;_0x284d88[_0x8e5e('0xe6')]+=0x1;_0x21ebbc=_0x38b848[_0x8e5e('0x18a')];_0x12f2fc=_0x38b848[_0x8e5e('0xd3')];ami[_0x8e5e('0x110')]('custom:agentcongestion',ut['buildObj'](_0x4789ec,_0x8e5e('0x1a9')));hopperUtils[_0x8e5e('0xe1')](_0x284d88)['catch'](loggerCatch(_0x8e5e('0x1aa')));if(_0x263210[_0x8e5e('0x183')](0x8,_0x4789ec,_0x38b848)&&!_0x1792be){if(_0x284d88[_0x8e5e('0x125')]>=_0x38b848[_0x8e5e('0x189')]){_0x263210[_0x8e5e('0x11e')](_0x284d88,_0x68bfce,_0x56387c,'reason\x208\x20congestion');}else{_0x263210['stateGlobal'](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1ab'));}}break;case'11':_0x38b848[_0x8e5e('0x1ac')]+=0x1;_0x284d88[_0x8e5e('0x69')]=0xb;_0x284d88['statedesc']=_0x8e5e('0xe4');_0x284d88[_0x8e5e('0xe9')]+=0x1;_0x284d88[_0x8e5e('0xe6')]+=0x1;_0x21ebbc=_0x38b848[_0x8e5e('0xe7')];_0x12f2fc=_0x38b848[_0x8e5e('0xd3')];hopperUtils[_0x8e5e('0xe1')](_0x284d88)['catch'](loggerCatch(_0x8e5e('0xec')));if(_0x263210[_0x8e5e('0x183')](0xb,_0x4789ec,_0x38b848)&&!_0x1792be){if(_0x284d88['countabandonedretry']>=_0x38b848[_0x8e5e('0xea')]){_0x263210[_0x8e5e('0x11e')](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1ad'));}else{_0x263210[_0x8e5e('0x11c')](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1ad'));}}break;case'20':_0x38b848[_0x8e5e('0x1ae')]+=0x1;_0x284d88[_0x8e5e('0x69')]=0x14;_0x284d88['statedesc']=_0x8e5e('0x1af');_0x284d88[_0x8e5e('0x11a')]+=0x1;_0x284d88[_0x8e5e('0xe6')]+=0x1;_0x21ebbc=_0x38b848['dialAgentRejectRetryFrequency'];_0x12f2fc=_0x38b848[_0x8e5e('0xd3')];ami['emit'](_0x8e5e('0x1b0'),ut[_0x8e5e('0x112')](_0x4789ec,_0x8e5e('0x1b1')));hopperUtils[_0x8e5e('0xe1')](_0x284d88)['catch'](loggerCatch(_0x8e5e('0x1b2')));if(_0x263210[_0x8e5e('0x183')](0x14,_0x4789ec,_0x38b848)&&!_0x1792be){if(_0x284d88['countagentrejectretry']>=_0x38b848[_0x8e5e('0x191')]){_0x263210[_0x8e5e('0x11e')](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1b3'));}else{_0x263210[_0x8e5e('0x11c')](_0x284d88,_0x68bfce,_0x56387c,_0x8e5e('0x1b3'));}}break;default:_0x38b848[_0x8e5e('0x12e')]+=0x1;_0x284d88[_0x8e5e('0x69')]=0xc;_0x284d88['statedesc']=_0x2c748c['reason'];_0x21ebbc=_0x38b848[_0x8e5e('0x192')];_0x12f2fc=_0x38b848[_0x8e5e('0xd3')];hopperUtils['createHistory'](_0x284d88)['catch'](loggerCatch(_0x8e5e('0x1b4')));if(_0x263210[_0x8e5e('0x183')](_0x2c748c[_0x8e5e('0xc2')],_0x4789ec,_0x38b848)&&!_0x1792be){if(_0x284d88[_0x8e5e('0x117')]+_0x284d88[_0x8e5e('0x125')]+_0x284d88[_0x8e5e('0x118')]+_0x284d88[_0x8e5e('0x119')]+_0x284d88[_0x8e5e('0xd1')]+_0x284d88[_0x8e5e('0xe9')]+_0x284d88[_0x8e5e('0x116')]+_0x284d88['countagentrejectretry']>=_0x38b848['dialGlobalMaxRetry']){_0x263210[_0x8e5e('0x11c')](_0x284d88,_0x68bfce,_0x56387c,_0x2c748c[_0x8e5e('0xc2')]);}else{_0x263210['createStateFinal'](_0x284d88,_0x68bfce,_0x56387c,_0x2c748c[_0x8e5e('0xc2')]);}}}})[_0x8e5e('0x3f')](function(){if(_0x1792be){hopperUtils['swapAdditionalPhones'](_0x284d88,_0x21ebbc,_0x12f2fc)[_0x8e5e('0x3f')](function(){return _0x68bfce(0x1);});}});});};Dialer[_0x8e5e('0x19')][_0x8e5e('0x11c')]=function(_0x184761,_0x3537fd,_0x18e4d4,_0x7bbaee){var _0x144b38=new Final(_0x184761);_0x144b38['state']=0xf;_0x144b38[_0x8e5e('0x6a')]='Global';this['createStateFinal'](_0x144b38,_0x3537fd,_0x18e4d4,_0x7bbaee);};Dialer[_0x8e5e('0x19')]['createStateFinal']=function(_0x3418a5,_0x1052b4,_0x2dbb6e,_0x396608){hopperUtils['moveContactManagedDialer'](_0x3418a5)[_0x8e5e('0x3f')](function(){return _0x1052b4(msgResponse('[callProgressDetecting]','Success',_0x396608));})['catch'](function(){return _0x2dbb6e(msgResponse(_0x8e5e('0x1b5'),'Failure',_0x8e5e('0x1b6')));});};Dialer[_0x8e5e('0x19')]['predictive']=function(_0x1b5790){var _0x2d9678=_0x1b5790[_0x8e5e('0x1b7')]/0x64;var _0x383ee9=_0x1b5790[_0x8e5e('0x1b8')]/(_0x1b5790['outboundDropCallsDayTimeout']+_0x1b5790[_0x8e5e('0xc1')]);var _0x3187e8=Math[_0x8e5e('0x1b9')](_0x1b5790[_0x8e5e('0x1ba')]*(_0x1b5790[_0x8e5e('0x1bb')]/0x64));var _0x531d4f=Math['round'](_0x1b5790[_0x8e5e('0x1ba')]*(_0x1b5790['predictiveIntervalMinThreshold']/0x64));var _0xa14458=_0x1b5790[_0x8e5e('0x135')]+_0x1b5790['talking'];var _0x10a3a0=Math[_0x8e5e('0x1bc')](_0x1b5790[_0x8e5e('0x59')]*_0x1b5790[_0x8e5e('0x5c')]*_0x1b5790[_0x8e5e('0x1bd')]*_0x1b5790[_0x8e5e('0x1be')]);if(_[_0x8e5e('0x40')](_0x1b5790[_0x8e5e('0x28')])){if(!_['isUndefined'](_0x1b5790[_0x8e5e('0x27')])){_0x1b5790[_0x8e5e('0x27')]=undefined;loggerPredictive[_0x8e5e('0x63')](_0x8e5e('0x1bf'),_0x8e5e('0x1c0'));}if(!_[_0x8e5e('0x40')](_0x1b5790['handlePredictive'])){loggerPredictive[_0x8e5e('0x63')](_0x8e5e('0x1bf'),_0x8e5e('0x1c1'));clearInterval(_0x1b5790['handlePredictive']);_0x1b5790[_0x8e5e('0x61')]=undefined;}_0x1b5790[_0x8e5e('0x28')]=moment()[_0x8e5e('0x44')](_0x8e5e('0xbe'));loggerPredictive[_0x8e5e('0x4a')](_0x1b5790[_0x8e5e('0x46')],_0x8e5e('0x1c2'),_0x1b5790['startProgressive']);this['handlePower'](_0x1b5790,0x1);}else if(ifInterval(_0x1b5790[_0x8e5e('0x1c3')],_0x1b5790[_0x8e5e('0x28')])){this[_0x8e5e('0xad')](_0x1b5790,0x1);loggerPredictiveCalls[_0x8e5e('0x4a')](_0x8e5e('0x1c4'),_0x1b5790[_0x8e5e('0x28')],_0x1b5790['name']);_0x1b5790[_0x8e5e('0x59')]=0x0;_0x1b5790['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2d9678<_0x383ee9&&_0x1b5790[_0x8e5e('0x1c5')]==='dropRate'){clearPredictiveAttributes(_0x1b5790);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x8e5e('0x1c6'),_0x383ee9,_0x8e5e('0x28'),_0x1b5790['name']);}else if(_0x10a3a0<_0x1b5790['predictiveIntervalErlangCallsDroppedCalls']&&_0x1b5790['dialPredictiveOptimization']===_0x8e5e('0x1c7')){clearPredictiveAttributes(_0x1b5790);loggerPredictive['info'](_0x8e5e('0x1c8'),_0x8e5e('0x1c9'),_0x10a3a0,'Drop\x20in\x20this\x20interval',_0x1b5790[_0x8e5e('0xcd')],_0x8e5e('0x28'),_0x1b5790[_0x8e5e('0x46')]);}else if(!ifInterval(_0x1b5790[_0x8e5e('0x1c3')],_0x1b5790[_0x8e5e('0x28')])&&_['isUndefined'](_0x1b5790[_0x8e5e('0x27')])&&!_[_0x8e5e('0x40')](_0x1b5790[_0x8e5e('0x28')])){_0x1b5790[_0x8e5e('0x27')]=moment()['format'](_0x8e5e('0xbe'));loggerPredictive['info'](_0x1b5790[_0x8e5e('0x46')],_0x8e5e('0x1ca'),_0x1b5790[_0x8e5e('0x27')]);hopperUtils['avgHandleTime'](_0x1b5790[_0x8e5e('0x1c3')])[_0x8e5e('0x3f')](this[_0x8e5e('0x1cb')](_0x1b5790))[_0x8e5e('0x3f')](mergeDataErlangB(_0x1b5790))['then'](this['startMethodPredictive'](_0x1b5790))[_0x8e5e('0x9d')](loggerCatchPredictive(_0x8e5e('0x1cc'),_0x1b5790));}else if(!ifInterval(_0x1b5790[_0x8e5e('0x1c3')],_0x1b5790[_0x8e5e('0x27')])){_0x1b5790[_0x8e5e('0xcd')]=0x0;_0x1b5790[_0x8e5e('0x27')]=moment()['format'](_0x8e5e('0xbe'));loggerPredictive['info'](_0x1b5790[_0x8e5e('0x46')],_0x8e5e('0x1cd'),_0x1b5790[_0x8e5e('0x27')]);clearInterval(_0x1b5790[_0x8e5e('0x61')]);_0x1b5790[_0x8e5e('0x61')]=undefined;hopperUtils['avgHandleTime'](_0x1b5790[_0x8e5e('0x1c3')])[_0x8e5e('0x3f')](this[_0x8e5e('0x1cb')](_0x1b5790))[_0x8e5e('0x3f')](mergeDataErlangB(_0x1b5790))[_0x8e5e('0x3f')](this['startMethodPredictive'](_0x1b5790))[_0x8e5e('0x9d')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1b5790));}else if(_0x1b5790['predictiveIntervalAvailable']&&_0xa14458<_0x1b5790['predictiveIntervalAvailable']-_0x531d4f){clearPredictiveAttributes(_0x1b5790);loggerPredictive['info'](_0x1b5790['name'],_0x8e5e('0x1ce'),_0xa14458,_0x8e5e('0x1cf'),_0x1b5790[_0x8e5e('0x1ba')],'-',_0x531d4f,'=',_0x1b5790['predictiveIntervalAvailable']-_0x531d4f,')');}else if(_0x1b5790[_0x8e5e('0x1ba')]&&_0xa14458>_0x1b5790[_0x8e5e('0x1ba')]+_0x3187e8){clearPredictiveAttributes(_0x1b5790);loggerPredictive[_0x8e5e('0x4a')](_0x1b5790[_0x8e5e('0x46')],_0x8e5e('0x1ce'),_0xa14458,_0x8e5e('0x1d0'),_0x1b5790[_0x8e5e('0x1ba')],'+',_0x3187e8,'=',_0x1b5790[_0x8e5e('0x1ba')]+_0x3187e8,')');}};Dialer['prototype'][_0x8e5e('0x1cb')]=function(_0x1f9937){var _0x31ffe7=this;return function(_0x33fb5d){return new Promise(function(_0x2c7ab3,_0x1e3142){_[_0x8e5e('0x5f')](_0x1f9937,_0x33fb5d[0x0]);if(checkGetDataPredictive(_0x33fb5d[0x0])){var _0x1175cb=_0x1f9937['predictiveIntervalAvailable']=_0x1f9937[_0x8e5e('0x137')]+_0x1f9937[_0x8e5e('0x135')];var _0x210afa=_0x1f9937[_0x8e5e('0x1c3')]*0x3c;var _0x46d66d=_0x33fb5d[0x0][_0x8e5e('0x53')]+_0x33fb5d[0x0][_0x8e5e('0x51')];var _0x1a0607=(_0x33fb5d[0x0][_0x8e5e('0x4e')]+_0x33fb5d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x33fb5d[0x0][_0x8e5e('0x50')])/_0x33fb5d[0x0][_0x8e5e('0x4c')];_0x1f9937[_0x8e5e('0x1bd')]=_0x1a0607>0x0?_0x1a0607:0x1;switch(_0x1f9937[_0x8e5e('0x1c5')]){case _0x8e5e('0x1c7'):var _0xcdd8e1=_0x1f9937[_0x8e5e('0x1b7')]/0x64;return _0x31ffe7['abandonmentRate'](_0x1175cb,_0x210afa,_0x46d66d,_0x1a0607,_0xcdd8e1)[_0x8e5e('0x3f')](function(_0x2686fc){return _0x2c7ab3(_0x2686fc);});case _0x8e5e('0x1d1'):var _0x189ce9=_0x1f9937[_0x8e5e('0x1b7')]/0x64;return _0x31ffe7[_0x8e5e('0x1d2')](_0x1175cb,_0x210afa,_0x46d66d,_0x1a0607,_0x189ce9)[_0x8e5e('0x3f')](function(_0x26f004){return _0x2c7ab3(_0x26f004);});default:return _0x1e3142(msgResponse('[getDataPredictive]',_0x8e5e('0x8c'),_0x8e5e('0x1d3')));}}else{return _0x1e3142(msgResponse(_0x8e5e('0x1d4'),'Failure','check\x20failure'));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x429b68){var _0x598426=this;return function(_0x1033ca){return new Promise(function(_0x2507f3,_0x42db63){_[_0x8e5e('0x5f')](_0x429b68,_0x1033ca[0x0]);if(checkGetDataPredictive(_0x1033ca[0x0])){loggerPredictive[_0x8e5e('0x4a')](JSON[_0x8e5e('0x7f')](_0x1033ca[0x0]));if(_0x429b68[_0x8e5e('0x1c5')]===_0x8e5e('0x1c7')){return _0x598426['getVoiceQueueRtPauses'](_0x429b68['id'])['then'](function(_0x44e385){var _0x258b06=_0x429b68[_0x8e5e('0x1d5')]-_0x44e385[0x0][_0x8e5e('0x1d6')];var _0x38a634=_0x429b68[_0x8e5e('0x1c3')]*0x3c;var _0x19d251=_0x1033ca[0x0]['predictiveIntervalAvgTalktime']+_0x1033ca[0x0][_0x8e5e('0x51')];var _0x345328=(_0x1033ca[0x0][_0x8e5e('0x4e')]+_0x1033ca[0x0][_0x8e5e('0xcc')]+_0x1033ca[0x0][_0x8e5e('0x50')])/_0x1033ca[0x0][_0x8e5e('0x4c')];var _0x5b5a94=_0x429b68['dialPredictiveOptimizationPercentage']/0x64;_0x429b68['predictiveIntervalPauses']=_0x44e385[0x0][_0x8e5e('0x1d6')]||0x0;_0x429b68[_0x8e5e('0x1bd')]=_0x345328>0x0?_0x345328:0x1;return _0x598426[_0x8e5e('0x1d7')](_0x258b06,_0x38a634,_0x19d251,_0x345328,_0x5b5a94);})[_0x8e5e('0x3f')](function(_0x2cc6b7){return _0x2507f3(_0x2cc6b7);})[_0x8e5e('0x9d')](function(_0x4f51fa){return _0x42db63(msgResponse(_0x8e5e('0x1d8'),_0x8e5e('0x8c'),JSON[_0x8e5e('0x7f')](_0x4f51fa)));});}if(_0x429b68[_0x8e5e('0x1c5')]===_0x8e5e('0x1d1')){return _0x598426[_0x8e5e('0x14a')](_0x429b68['id'])[_0x8e5e('0x3f')](function(_0x1459e4){var _0x36df65=_0x429b68[_0x8e5e('0x1d5')]-_0x1459e4[0x0][_0x8e5e('0x1d6')];var _0x58b032=_0x429b68[_0x8e5e('0x1c3')]*0x3c;var _0x550112=_0x1033ca[0x0][_0x8e5e('0x53')]+_0x1033ca[0x0][_0x8e5e('0x51')];var _0x1070aa=(_0x1033ca[0x0][_0x8e5e('0x4e')]+_0x1033ca[0x0][_0x8e5e('0xcc')]+_0x1033ca[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1033ca[0x0][_0x8e5e('0x4c')];var _0x1dcf77=_0x429b68['dialPredictiveOptimizationPercentage']/0x64;_0x429b68['predictiveIntervalPauses']=_0x1459e4[0x0]['outboundQueuePauses']||0x0;_0x429b68[_0x8e5e('0x1bd')]=_0x1070aa>0x0?_0x1070aa:0x1;return _0x598426[_0x8e5e('0x1d2')](_0x36df65,_0x58b032,_0x550112,_0x1070aa,_0x1dcf77);})[_0x8e5e('0x3f')](function(_0x4d96f8){return _0x2507f3(_0x4d96f8);})[_0x8e5e('0x9d')](function(_0x127c75){return _0x42db63(msgResponse(_0x8e5e('0x1d8'),_0x8e5e('0x8c'),JSON['stringify'](_0x127c75)));});}}else{return _0x42db63(msgResponse(_0x8e5e('0x1d4'),'Failure',_0x8e5e('0x1d9')));}});};};Dialer[_0x8e5e('0x19')]['startMethodPredictive']=function(_0xa09409){var _0xbac955=this;return function(){var _0x145c1e=0x0;var _0x274707=Math[_0x8e5e('0x1bc')](_0xa09409['erlangCallToSecond']*0x3e8);if(_0x274707>0x0){_0x274707=_0x274707<0x64?0x64:_0x274707;loggerPredictive['info'](_0xa09409[_0x8e5e('0x46')],'one\x20call\x20every:',_0x274707,'milliseconds');_0xa09409[_0x8e5e('0x61')]=setInterval(function(){_0xbac955['handlePredictive'](_0xa09409);loggerPredictiveCalls['info'](_0x8e5e('0x1da'),_0x145c1e+=0x1);},_0x274707);}else{loggerPredictive[_0x8e5e('0x4a')](_0xa09409[_0x8e5e('0x46')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x8e5e('0x19')][_0x8e5e('0x1db')]=function(_0x5e7417,_0x484054){var _0x16d738=this;return function(_0x475d03){if(_[_0x8e5e('0x48')](_0x475d03)){if(_[_0x8e5e('0xf2')](_0x484054[_0x8e5e('0x14f')])||!_0x484054[_0x8e5e('0x1dc')]){if(_0x5e7417[_0x8e5e('0xab')]===_0x8e5e('0xae')){_0x5e7417[_0x8e5e('0x6c')]=_[_0x8e5e('0x40')](_0x5e7417['queueStatusComplete'])?!![]:_0x5e7417[_0x8e5e('0x6c')];var _0x522a5c=uuid['v4']();_0x16d738[_0x8e5e('0x25')][_0x522a5c]=new Action(_0x5e7417,_0x484054,_0x522a5c);loggerBooked[_0x8e5e('0x4a')](_0x8e5e('0x1dd'),_0x522a5c,_0x8e5e('0x1de'),JSON[_0x8e5e('0x7f')](_0x5e7417[_0x8e5e('0x6c')]),_0x8e5e('0x1df'),_0x5e7417[_0x8e5e('0x46')]);if(_0x5e7417[_0x8e5e('0x6c')]){_0x5e7417['queueStatusComplete']=![];_0x16d738['queueBooked'][_0x16d738[_0x8e5e('0x25')][_0x522a5c][_0x8e5e('0xc0')]]=[];ami[_0x8e5e('0x96')]({'actionid':_0x522a5c,'action':_0x8e5e('0x1e0'),'queue':_0x5e7417[_0x8e5e('0x46')]})[_0x8e5e('0x9d')](function(){_0x16d738[_0x8e5e('0xc8')](_0x5e7417);hopperUtils[_0x8e5e('0xd7')]({'active':![],'ContactId':_0x16d738[_0x8e5e('0x25')][_0x522a5c][_0x8e5e('0xda')],'ListId':_0x16d738[_0x8e5e('0x25')][_0x522a5c][_0x8e5e('0xdb')],'VoiceQueueId':_0x16d738[_0x8e5e('0x25')][_0x522a5c]['VoiceQueueId']||undefined,'CampaignId':_0x16d738[_0x8e5e('0x25')][_0x522a5c][_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x1e1')));delete _0x16d738['actions'][_0x522a5c];});}else{loggerBooked[_0x8e5e('0x4a')](_0x8e5e('0x1e2'),JSON[_0x8e5e('0x7f')](_0x5e7417[_0x8e5e('0x6c')]),_0x8e5e('0x1df'),_0x5e7417['name']);_0x16d738[_0x8e5e('0xc8')](_0x5e7417);hopperUtils[_0x8e5e('0xd7')]({'active':![],'ContactId':_0x16d738[_0x8e5e('0x25')][_0x522a5c][_0x8e5e('0xda')],'ListId':_0x16d738['actions'][_0x522a5c][_0x8e5e('0xdb')],'VoiceQueueId':_0x16d738[_0x8e5e('0x25')][_0x522a5c][_0x8e5e('0xdc')]||undefined,'CampaignId':_0x16d738['actions'][_0x522a5c]['CampaignId']||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x1e1')));delete _0x16d738[_0x8e5e('0x25')][_0x522a5c];}}else{return _0x16d738['actionOriginate'](_0x5e7417,_0x484054);}}else{if(utils['getSeconds'](undefined,_0x484054[_0x8e5e('0x1e3')])<_0x5e7417[_0x8e5e('0x1e4')]*0x3c){if(_0x484054['Agent']&&!_0x484054['Agent'][_0x8e5e('0x1e5')]){_0x16d738['preview'][_0x8e5e('0x1e6')](_0x484054['id'])[_0x8e5e('0x1c')](function(){_0x16d738[_0x8e5e('0xc8')](_0x5e7417);});}else{hopperUtils[_0x8e5e('0x1e7')]({'active':![]},_0x484054['id'],0x1)[_0x8e5e('0x1c')](function(){_0x16d738[_0x8e5e('0xc8')](_0x5e7417);});}}else{_0x5e7417[_0x8e5e('0x1e8')]+=0x1;_0x16d738[_0x8e5e('0xc8')](_0x5e7417);if(_0x5e7417[_0x8e5e('0x1e9')]){hopperUtils[_0x8e5e('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x484054[_0x8e5e('0xda')],'ListId':_0x484054[_0x8e5e('0xdb')],'VoiceQueueId':_0x484054[_0x8e5e('0xdc')]||undefined,'CampaignId':_0x484054[_0x8e5e('0xdd')]||undefined})[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x1ea')));hopperUtils[_0x8e5e('0xe1')](createObjHistory(_0x5e7417,_0x484054,utils[_0x8e5e('0x65')]['QUEUE_RECALL'],0x17,_0x8e5e('0x1eb')))[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x1ec')));}else{_0x16d738[_0x8e5e('0x152')](createObjHistory(_0x5e7417,_0x484054,utils[_0x8e5e('0x65')][_0x8e5e('0x1ed')],0x16,'RecallFailedTimeout'),_0x8e5e('0x1ee'),_0x8e5e('0x1ef'));}}}}else{_0x5e7417[_0x8e5e('0x1f0')]+=0x1;_0x16d738[_0x8e5e('0x152')](createObjHistory(_0x5e7417,_0x484054,utils[_0x8e5e('0x65')][_0x8e5e('0x1f1')],0xd,_0x8e5e('0x1f2')),_0x8e5e('0x1f3'),'[Originate][MoveBlacklist]');throw _0x8e5e('0x1f4');}};};Dialer['prototype'][_0x8e5e('0x155')]=function(_0x29f5a0){var _0x58265c=this;var _0x80a6da=_0x29f5a0[_0x8e5e('0x1f5')]-_0x29f5a0['originated'];emitCampaignSummary(_0x29f5a0);if(_0x80a6da>0x0&&_0x29f5a0['temp']==0x0){if(_0x80a6da>this[_0x8e5e('0x23')]){_0x80a6da=this['maxNumberOriginate'];}_0x29f5a0[_0x8e5e('0x1f6')]=0x1;hopperUtils[_0x8e5e('0x1f7')](_0x29f5a0,_0x80a6da)[_0x8e5e('0x3f')](function(_0x42bc8b){_0x29f5a0[_0x8e5e('0x1f6')]=0x0;if(_0x42bc8b){if(!utils[_0x8e5e('0x1f8')](_0x42bc8b)){_0x29f5a0[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x1f9')];logger['info'](_0x8e5e('0x1fa')+_0x29f5a0[_0x8e5e('0x46')]);}else{_0x29f5a0[_0x8e5e('0x77')]+=_0x42bc8b[_0x8e5e('0x94')];_0x29f5a0['message']=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x3d2750=0x0;_0x3d2750<_0x42bc8b[_0x8e5e('0x94')];_0x3d2750+=0x1){_0x29f5a0[_0x8e5e('0x1fb')]+=0x1;if(_['isNil'](_0x42bc8b[_0x3d2750])||_['isNil'](_0x42bc8b[_0x3d2750][_0x8e5e('0x1fc')])||_[_0x8e5e('0xf2')](_0x42bc8b[_0x3d2750][_0x8e5e('0x159')])){_0x58265c[_0x8e5e('0x14e')](_0x8e5e('0x1fd'),_0x29f5a0,_0x42bc8b[_0x3d2750]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x8e5e('0x6f')](_0x42bc8b[_0x3d2750],[_0x8e5e('0xdd'),_0x8e5e('0x159')]))['then'](_0x58265c[_0x8e5e('0x1db')](_0x29f5a0,_0x42bc8b[_0x3d2750]))[_0x8e5e('0x9d')](_0x58265c[_0x8e5e('0x1fe')](_0x8e5e('0x1ff'),_0x29f5a0));}}}}})[_0x8e5e('0x9d')](loggerGetContactDialer(_0x8e5e('0x200'),_0x29f5a0,_0x80a6da));}};Dialer[_0x8e5e('0x19')][_0x8e5e('0xad')]=function(_0x41d9b2,_0x5cbb78){var _0x571bdf=this;var _0x55f760=[];if(_0x5cbb78<0x1||_0x41d9b2[_0x8e5e('0xab')]===_0x8e5e('0xae')){_0x5cbb78=0x1;}var _0xe16c18=Math[_0x8e5e('0x1bc')](_0x41d9b2['available']*_0x5cbb78)-_0x41d9b2['originated'];if(_0x41d9b2[_0x8e5e('0x201')]>0x0){var _0x48be59=_0x41d9b2[_0x8e5e('0x201')]-_0x41d9b2[_0x8e5e('0x77')]-_0x41d9b2[_0x8e5e('0x137')]-_0x41d9b2['pTalking'];if(_0xe16c18>_0x48be59){_0xe16c18=_0x48be59;}}if(_0xe16c18>0x0&&_0x41d9b2['temp']==0x0){if(_0x41d9b2[_0x8e5e('0xab')]===_0x8e5e('0xae')){_0xe16c18=0x1;}if(_0xe16c18>this[_0x8e5e('0x23')]){_0xe16c18=this[_0x8e5e('0x23')];}for(var _0x450c4a in this[_0x8e5e('0x21')]){if(typeof this['agents'][_0x450c4a]!==_0x8e5e('0x148')){if(this[_0x8e5e('0x21')][_0x450c4a][_0x8e5e('0x69')]===_0x8e5e('0x202')&&this['agents'][_0x450c4a]['status']===_0x8e5e('0x203')){_0x55f760[_0x8e5e('0x95')](this[_0x8e5e('0x21')][_0x450c4a]['id']);}}}_0x41d9b2[_0x8e5e('0x1f6')]=0x1;hopperUtils[_0x8e5e('0x204')](_0x41d9b2,_0x55f760,_0xe16c18)[_0x8e5e('0x3f')](function(_0x1b4a1c){_0x41d9b2[_0x8e5e('0x1f6')]=0x0;if(_0x1b4a1c){if(!utils['checkContactEmpty'](_0x1b4a1c)){hopperUtils[_0x8e5e('0x205')](_0x41d9b2)['then'](sendMessageReschedule(_0x41d9b2))[_0x8e5e('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x41d9b2[_0x8e5e('0x77')]+=_0x1b4a1c['length'];_0x41d9b2[_0x8e5e('0x67')]=_0x41d9b2[_0x8e5e('0xab')]===_0x8e5e('0xae')?utils[_0x8e5e('0x65')][_0x8e5e('0x160')]:utils['CAMPAIGN_STATUS'][_0x8e5e('0x206')];for(var _0x1945b0=0x0;_0x1945b0<_0x1b4a1c[_0x8e5e('0x94')];_0x1945b0+=0x1){if(_[_0x8e5e('0xf2')](_0x1b4a1c[_0x1945b0])||_[_0x8e5e('0xf2')](_0x1b4a1c[_0x1945b0][_0x8e5e('0x1fc')])||_[_0x8e5e('0xf2')](_0x1b4a1c[_0x1945b0][_0x8e5e('0x159')])){_0x571bdf['emptyContact'](_0x8e5e('0x1fd'),_0x41d9b2,_0x1b4a1c[_0x1945b0]);}else{hopperUtils[_0x8e5e('0x207')](_[_0x8e5e('0x6f')](_0x1b4a1c[_0x1945b0],['VoiceQueueId',_0x8e5e('0x159')]))[_0x8e5e('0x3f')](_0x571bdf['checkContactBlack'](_0x41d9b2,_0x1b4a1c[_0x1945b0]))[_0x8e5e('0x9d')](_0x571bdf[_0x8e5e('0x1fe')](_0x8e5e('0x1fd'),_0x41d9b2));}}}}})[_0x8e5e('0x9d')](loggerGetContactDialer(_0x8e5e('0x208'),_0x41d9b2,_0xe16c18));}};Dialer[_0x8e5e('0x19')][_0x8e5e('0x61')]=function(_0x57271d){if(_0x57271d[_0x8e5e('0x201')]>0x0){var _0xc50ccb=_0x57271d[_0x8e5e('0x201')]-_0x57271d[_0x8e5e('0x77')]-_0x57271d[_0x8e5e('0x137')];if(_0xc50ccb>0x0&&_0x57271d[_0x8e5e('0x1f6')]==0x0){this[_0x8e5e('0x209')](_0x57271d);}else{loggerPredictiveCalls[_0x8e5e('0x4a')](_0x8e5e('0x20a'));}}else{this[_0x8e5e('0x209')](_0x57271d);}};Dialer[_0x8e5e('0x19')]['tryOriginatePredictive']=function(_0x5c8144){var _0x509aac=this;var _0x4a9378=[];_0x5c8144[_0x8e5e('0x77')]+=0x1;for(var _0x524d69 in this['agents']){if(typeof this[_0x8e5e('0x21')][_0x524d69]!==_0x8e5e('0x148')){if(this['agents'][_0x524d69][_0x8e5e('0x69')]===_0x8e5e('0x202')&&this[_0x8e5e('0x21')][_0x524d69][_0x8e5e('0x83')]===_0x8e5e('0x203')){_0x4a9378['push'](this[_0x8e5e('0x21')][_0x524d69]['id']);}}}_0x5c8144[_0x8e5e('0x1f6')]=0x1;return this[_0x8e5e('0x204')](_0x5c8144['id'],_0x4a9378,0x1,_0x5c8144[_0x8e5e('0x20b')],_0x5c8144)[_0x8e5e('0x3f')](function(_0xf7381f){_0x5c8144[_0x8e5e('0x1f6')]=0x1;if(_0xf7381f){if(!utils[_0x8e5e('0x1f8')](_0xf7381f)){utils['checkContactLowerLimitOriginate'](_0x5c8144,0x1,0x0);return hopperUtils[_0x8e5e('0x205')](_0x5c8144)[_0x8e5e('0x3f')](sendMessageReschedule(_0x5c8144))[_0x8e5e('0x9d')](loggerCatch(_0x8e5e('0x20c')));}else{_0x5c8144[_0x8e5e('0x67')]=utils[_0x8e5e('0x65')][_0x8e5e('0x206')];if(_[_0x8e5e('0xf2')](_0xf7381f[0x0])||_['isNil'](_0xf7381f[0x0]['Contact'])||_['isNil'](_0xf7381f[0x0][_0x8e5e('0x159')])){_0x509aac[_0x8e5e('0x14e')](_0x8e5e('0x1fd'),_0x5c8144,_0xf7381f[0x0]);}else{return hopperUtils[_0x8e5e('0x207')](_[_0x8e5e('0x6f')](_0xf7381f[0x0],['VoiceQueueId',_0x8e5e('0x159')]))[_0x8e5e('0x3f')](_0x509aac['checkContactBlack'](_0x5c8144,_0xf7381f[0x0]))[_0x8e5e('0x9d')](_0x509aac[_0x8e5e('0x1fe')](_0x8e5e('0x20d'),_0x5c8144));}}}})[_0x8e5e('0x9d')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5c8144,0x1));};Dialer[_0x8e5e('0x19')]['abandonmentRate']=function(_0xa51c74,_0x20c518,_0x675a86,_0x25ad7c,_0x30d336,_0x3e52f9){loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x20e'));loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x20f'),_0xa51c74);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20c518);loggerPredictive['info'](_0x8e5e('0x210'),_0x675a86);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x211'),_0x25ad7c);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x212'),_0x30d336);loggerPredictive['info'](_0x8e5e('0x54'));return new Promise(function(_0x4f20b8,_0x83660f){if(_0xa51c74<=0x0||isNaN(_0xa51c74)){return _0x83660f(msgResponse(_0x8e5e('0x213'),_0x8e5e('0x7e'),_0x8e5e('0x214')+_0xa51c74));}if(_0x675a86<=0x0||isNaN(_0x675a86)){return _0x83660f(msgResponse(_0x8e5e('0x213'),'Error',_0x8e5e('0x215')+_0x675a86));}if(_0x25ad7c<=0x0||isNaN(_0x25ad7c)){return _0x83660f(msgResponse(_0x8e5e('0x213'),_0x8e5e('0x7e'),_0x8e5e('0x216')+_0x25ad7c));}if(_0x20c518<=0x0||isNaN(_0x20c518)){return _0x83660f(msgResponse(_0x8e5e('0x213'),_0x8e5e('0x7e'),_0x8e5e('0x217')+_0x20c518));}if(_0x30d336<=0x0||isNaN(_0x30d336)){return _0x83660f(msgResponse(_0x8e5e('0x213'),'Error',_0x8e5e('0x218')+_0x30d336));}_0x3e52f9=_0x3e52f9||0x0;var _0xef5262=0x1/_0x675a86;var _0x2589c3=0x0;var _0x16e458=0x0;var _0x5efc22=0x0;var _0x3bf235=0x0;for(var _0x4ff166=0x0;_0x5efc22<_0x30d336;_0x4ff166+=0x1){_0x16e458=_0x4ff166/_0x20c518;_0x2589c3=(_0x25ad7c*_0x16e458+_0x3e52f9)/_0xef5262;_0x5efc22=utils['erlangb'](_0x2589c3,_0xa51c74);_0x3bf235=_0x2589c3/_0xa51c74*(0x1-utils['erlangb'](_0x2589c3,_0xa51c74));}return _0x4f20b8({'erlangCalls':_0x4ff166,'erlangCallToSecond':_0x20c518/_0x4ff166,'erlangAbandonmentRate':_0x5efc22,'erlangBusyFactor':_0x3bf235});});};Dialer[_0x8e5e('0x19')][_0x8e5e('0x1d2')]=function(_0x2bcf87,_0x42d8b5,_0x91bf8f,_0x664785,_0x59db90,_0x4896b7){loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x219'));loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x20f'),_0x2bcf87);loggerPredictive[_0x8e5e('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42d8b5);loggerPredictive[_0x8e5e('0x4a')]('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',_0x91bf8f);loggerPredictive[_0x8e5e('0x4a')]('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',_0x664785);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x21a'),_0x59db90);loggerPredictive[_0x8e5e('0x4a')](_0x8e5e('0x54'));return new Promise(function(_0x2d9929,_0x258845){if(_0x2bcf87<=0x0||isNaN(_0x2bcf87)){return _0x258845(msgResponse(_0x8e5e('0x21b'),_0x8e5e('0x7e'),_0x8e5e('0x214')+_0x2bcf87));}if(_0x91bf8f<=0x0||isNaN(_0x91bf8f)){return _0x258845(msgResponse(_0x8e5e('0x21b'),_0x8e5e('0x7e'),_0x8e5e('0x215')+_0x91bf8f));}if(_0x664785<=0x0||isNaN(_0x664785)){return _0x258845(msgResponse(_0x8e5e('0x21b'),_0x8e5e('0x7e'),_0x8e5e('0x216')+_0x664785));}if(_0x42d8b5<=0x0||isNaN(_0x42d8b5)){return _0x258845(msgResponse(_0x8e5e('0x21b'),_0x8e5e('0x7e'),_0x8e5e('0x217')+_0x42d8b5));}if(_0x59db90<=0x0||isNaN(_0x59db90)){return _0x258845(msgResponse(_0x8e5e('0x21b'),_0x8e5e('0x7e'),_0x8e5e('0x21c')+_0x59db90));}_0x4896b7=_0x4896b7||0x0;var _0x5e1794=0x1/_0x91bf8f;var _0x5373a1=0x0;var _0x3b4f3d=0x0;var _0x3f0d3f=0x0;var _0x16bad3=0x0;for(var _0x431927=0x0;_0x16bad3<_0x59db90;_0x431927+=0x1){_0x3b4f3d=_0x431927/_0x42d8b5;_0x5373a1=(_0x664785*_0x3b4f3d+_0x4896b7)/_0x5e1794;_0x3f0d3f=utils[_0x8e5e('0x21d')](_0x5373a1,_0x2bcf87);_0x16bad3=_0x5373a1/_0x2bcf87*(0x1-utils[_0x8e5e('0x21d')](_0x5373a1,_0x2bcf87));}return _0x2d9929({'erlangCalls':_0x431927,'erlangCallToSecond':_0x42d8b5/_0x431927,'erlangAbandonmentRate':_0x3f0d3f,'erlangBusyFactor':_0x16bad3});});};module[_0x8e5e('0x21e')]=Dialer; \ No newline at end of file +var _0x6a82=['NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','Unknown\x20Predictive','[getDataPredictive]','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','loggedIn','check\x20failure','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','[actionOriginate]\x20','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','ACTIVE','RUNNING','checkIsBlackList','tryOriginatePredictive','dialOrderByScheduledAt','[countReScheduled]\x20','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','uuid','moment','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','startPredictive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','message','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','format','campaign:save','sendMessageOneNotActive','originated','INACTIVE','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','active','status','SIP/%s','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','catch','true','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Failure','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','dialMethod','progressive','power','handlePower','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','isGlobal','AMI\x20IfTime','uniqueid','updateOriginated','queue','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','TIMEOUT','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','starttime','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','countabandonedretry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','paused','agents','stateinterface','isNil','queueBooked','merge','idHopper','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','responsetime','response','Success','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','value','MACHINE','Machine','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HangupInAMD','membername','saveInDb','[syncHangupInAMDIvr][createHistory]','dialGlobalMaxRetry','dialMachineMaxRetry','reason\x2019\x20machine....','ivrAnswerCallsDay','moveContactManagedDialer','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','available','inUse','pTalking','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','originate','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x6a82,0x7d));var _0x26a8=function(_0x4901d0,_0x2969f5){_0x4901d0=_0x4901d0-0x0;var _0x3899bc=_0x6a82[_0x4901d0];return _0x3899bc;};'use strict';var util=require(_0x26a8('0x0'));var _=require('lodash');var uuid=require(_0x26a8('0x1'));var moment=require(_0x26a8('0x2'));var rr=require('rr');var Redis=require(_0x26a8('0x3'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require(_0x26a8('0x4'));var config=require('../../../config/environment/');var logger=require(_0x26a8('0x5'))(_0x26a8('0x6'));var loggerBooked=require(_0x26a8('0x5'))(_0x26a8('0x7'));var loggerPredictive=require(_0x26a8('0x5'))(_0x26a8('0x8'));var loggerPredictiveCalls=require(_0x26a8('0x5'))(_0x26a8('0x9'));var loggerSyncQueueSummary=require(_0x26a8('0x5'))(_0x26a8('0xa'));var ami=require(_0x26a8('0xb'));config['redis']=_[_0x26a8('0xc')](config[_0x26a8('0xd')],{'host':_0x26a8('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x26a8('0xd')]));var cmHopper=require(_0x26a8('0xf'));var voiceQueueRt=require(_0x26a8('0x10'));var RpcSetting=require(_0x26a8('0x11'));var Interval=require(_0x26a8('0x12'));var Action=require('./models/action');var History=require(_0x26a8('0x13'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x26a8('0x14'));var ipAgi=process[_0x26a8('0x15')][_0x26a8('0x16')]||_0x26a8('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x26a8('0x18')][_0x26a8('0x19')]=function(_0x4e5bc9){this[_0x26a8('0x1a')]=this[_0x26a8('0x1a')]?this[_0x26a8('0x1a')][_0x26a8('0x1b')](_0x4e5bc9):_0x4e5bc9();};function Dialer(_0x442168,_0x38d6a9){this[_0x26a8('0x1c')]=new Sequence();this[_0x26a8('0x1d')]=_0x38d6a9;this[_0x26a8('0x1e')]=_0x442168[_0x26a8('0x1e')];this[_0x26a8('0x1f')]=_0x442168['campaigns'];this['agents']=_0x442168['agents'];this[_0x26a8('0x20')]=_0x442168['trunks'];this[_0x26a8('0x21')]=config[_0x26a8('0x21')]||0x2;this['channels']={};this['actions']={};this[_0x26a8('0x22')]={};this[_0x26a8('0x23')]={};this[_0x26a8('0x24')]={};this[_0x26a8('0x25')]={};this[_0x26a8('0x26')]={};this[_0x26a8('0x27')]={};this['queueBooked']={};this[_0x26a8('0x28')]={};this[_0x26a8('0x29')]={};ami['on'](_0x26a8('0x2a'),this[_0x26a8('0x2b')]['bind'](this));ami['on'](_0x26a8('0x2c'),this[_0x26a8('0x2d')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x26a8('0x2e')](this));ami['on'](_0x26a8('0x2f'),this[_0x26a8('0x30')][_0x26a8('0x2e')](this));ami['on'](_0x26a8('0x31'),this[_0x26a8('0xa')]['bind'](this));ami['on'](_0x26a8('0x32'),this[_0x26a8('0x33')][_0x26a8('0x2e')](this));ami['on'](_0x26a8('0x34'),this[_0x26a8('0x35')][_0x26a8('0x2e')](this));ami['on'](_0x26a8('0x36'),this[_0x26a8('0x37')][_0x26a8('0x2e')](this));ami['on'](_0x26a8('0x38'),this[_0x26a8('0x39')][_0x26a8('0x2e')](this));ami['on'](_0x26a8('0x3a'),this['syncQueueMember'][_0x26a8('0x2e')](this));ami['on'](_0x26a8('0x3b'),this[_0x26a8('0x3c')][_0x26a8('0x2e')](this));this[_0x26a8('0x3d')]();this[_0x26a8('0x3e')]();RpcSetting['getSettings']()[_0x26a8('0x3f')](function(_0x3837d9){previewRecallmeReminderInterval=_0x3837d9[_0x26a8('0x40')];});}function isNotNull(_0x261024){return _0x261024!==null&&!_[_0x26a8('0x41')](_0x261024);}function msgResponse(_0x340731,_0x2db7da,_0xb6bd46){return{'action':_0x340731,'response':_0x2db7da,'message':_0xb6bd46,'stack':_0xb6bd46};}function emit(_0x55d401,_0x2700d4,_0x45b27f){io['to'](_0x55d401)[_0x26a8('0x42')](_0x2700d4,_0x45b27f);}function emitOutboundVoiceQueueSummary(_0x452078){if(_0x452078[_0x26a8('0x43')]==='outbound'){logger[_0x26a8('0x44')](_0x26a8('0x45'),util[_0x26a8('0x46')](_0x452078,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0x452078[_0x26a8('0x47')]),_0x26a8('0x48'),_0x452078);}}function checkGetDataPredictive(_0x392c27){if(isNotNull(_0x392c27)&&!_[_0x26a8('0x49')](_0x392c27)){loggerPredictive[_0x26a8('0x4a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x26a8('0x4a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x392c27[_0x26a8('0x4b')]);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x4c'),_0x392c27[_0x26a8('0x4d')]);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x4e'),_0x392c27['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x26a8('0x4f'),_0x392c27[_0x26a8('0x50')]);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x51'),_0x392c27[_0x26a8('0x52')]);loggerPredictive['info'](_0x26a8('0x53'),_0x392c27['predictiveIntervalAvgTalktime']);loggerPredictive[_0x26a8('0x4a')]('---------------------------');if(_0x392c27[_0x26a8('0x4b')]>0x0){if(!_['isUndefined'](_0x392c27[_0x26a8('0x54')])&&_0x392c27[_0x26a8('0x54')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x26a8('0x41')](_0x392c27[_0x26a8('0x52')])&&_0x392c27[_0x26a8('0x52')]>0x0){return!![];}loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x55'));}else{loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x56'));}}else{loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x57'));}return![];}function mergeDataErlangB(_0x50507c){return function(_0x2b6a77){loggerPredictive['info'](_0x26a8('0x58'));loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x59'),_0x2b6a77[_0x26a8('0x5a')]);loggerPredictive['info'](_0x26a8('0x5b'),_0x2b6a77[_0x26a8('0x5c')]);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x5d'),_0x2b6a77[_0x26a8('0x5e')]);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x5f'),_0x2b6a77[_0x26a8('0x60')]);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x5d'),_0x2b6a77[_0x26a8('0x5e')]);loggerPredictive['info'](_0x26a8('0x61'));_['merge'](_0x50507c,_0x2b6a77);};}function ifInterval(_0x18583e,_0xc52fda){if(_['isUndefined'](_0xc52fda)){return![];}return utils[_0x26a8('0x62')](undefined,_0xc52fda)<_0x18583e*0x3c;}function clearPredictiveAttributes(_0x1f60ec){if(_0x1f60ec[_0x26a8('0x26')]){_0x1f60ec['startProgressive']=undefined;loggerPredictive['debug'](_0x1f60ec['name'],_0x26a8('0x63'));}if(_0x1f60ec[_0x26a8('0x25')]){_0x1f60ec[_0x26a8('0x25')]=undefined;loggerPredictive[_0x26a8('0x44')](_0x1f60ec['name'],_0x26a8('0x64'));}if(_0x1f60ec[_0x26a8('0x65')]){clearInterval(_0x1f60ec[_0x26a8('0x65')]);_0x1f60ec[_0x26a8('0x65')]=undefined;loggerPredictive[_0x26a8('0x44')](_0x1f60ec['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x3ac704,_0x4c0fe3){return function(_0x24edd2){loggerPredictive[_0x26a8('0x66')](_0x4c0fe3['name'],_0x3ac704);loggerPredictive['error'](_0x24edd2['stack']);clearPredictiveAttributes(_0x4c0fe3);};}function loggerCatch(_0x3a4a0c){return function(_0x2c3be0){logger[_0x26a8('0x66')](_0x3a4a0c,util[_0x26a8('0x46')](_0x2c3be0,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x354e97,_0x41f639,_0x5bd454){return function(_0x1a3cdd){utils[_0x26a8('0x67')](_0x41f639,_0x5bd454,0x0);_0x41f639[_0x26a8('0x68')]=0x0;logger[_0x26a8('0x66')](_0x354e97,util[_0x26a8('0x46')](_0x1a3cdd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d210a){return function(_0x1eaeea){if(isNotNull(_0x1eaeea)&&isNotNull(_0x1eaeea[0x0])){if(_0x1eaeea[0x0][_0x26a8('0x69')]>0x0){_0x1d210a['message']=utils[_0x26a8('0x6a')]['CONTACTS_RESCHEDULED'];logger[_0x26a8('0x4a')](_0x26a8('0x6b')+_0x1d210a[_0x26a8('0x47')],_0x1eaeea[0x0]['contactsRescheduled'],'contacts');}else{_0x1d210a[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x6d')];logger['info']('[getContactDialer2][Empty]'+_0x1d210a[_0x26a8('0x47')]);}}};}function createObjHistory(_0x3d71a4,_0x46a248,_0x38a9e7,_0x318136,_0x3574ea){_0x3d71a4['message']=_0x38a9e7;var _0x359406=new Action(_0x3d71a4,_0x46a248);var _0x4d3e36=new History(_0x359406);_0x4d3e36[_0x26a8('0x6e')]=_0x318136;_0x4d3e36[_0x26a8('0x6f')]=_0x3574ea;_0x4d3e36[_0x26a8('0x70')]=_0x359406['starttime'];return _0x4d3e36;}function unlockQueueStatus(_0x180f78,_0xf7e3df){setTimeout(function(){if(_[_0x26a8('0x41')](_0x180f78['queueStatusComplete'])){loggerBooked[_0x26a8('0x66')](_0x26a8('0x71'),_0xf7e3df);}_0x180f78[_0x26a8('0x72')]=!![];loggerBooked[_0x26a8('0x4a')](_0x26a8('0x73'),_0xf7e3df,JSON[_0x26a8('0x74')](_[_0x26a8('0x75')](_0x180f78,[_0x26a8('0x47'),_0x26a8('0x72')])));},0x1f3);}function checkInterval(_0x93baac){return function(){if(!isNotNull(_0x93baac[_0x26a8('0x76')])){_0x93baac[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x77')];throw _0x93baac['name']+_0x26a8('0x78');}if(!isNotNull(_0x93baac[_0x26a8('0x76')][_0x26a8('0x79')])){_0x93baac[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')]['NULL_INTERVAL'];throw _0x93baac[_0x26a8('0x47')]+_0x26a8('0x78');}if(!isNotNull(_[_0x26a8('0x49')](_0x93baac[_0x26a8('0x76')]['Intervals']))){_0x93baac[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x77')];throw _0x93baac['name']+_0x26a8('0x78');}};}function checkIsIVRCampaignActive(_0x14355c){return function(){if(!utils[_0x26a8('0x7a')](_0x14355c)){_0x14355c[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')]['INACTIVE'];throw _0x14355c['name']+_0x26a8('0x7b');}};}function emitCampaignSummary(_0x3f46c6){if(utils[_0x26a8('0x7c')](_0x3f46c6)){emit(util[_0x26a8('0x7d')]('campaign:ivr:%s',_0x3f46c6['name']),_0x26a8('0x7e'),_0x3f46c6);}}function loggerCatchQueueSummary(_0x1425f6,_0x5ef5bd){return function(_0x4c07c2){clearPredictiveAttributes(_0x5ef5bd);emitCampaignSummary(_0x5ef5bd);loggerSyncQueueSummary[_0x26a8('0x44')](_0x1425f6,util[_0x26a8('0x46')](_0x4c07c2,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x183415){if(_0x183415[_0x26a8('0x7f')]){if(_0x183415[_0x26a8('0x80')]===0x0){_0x183415[_0x26a8('0x7f')]=![];_0x183415[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x81')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x183415['name'],_0x26a8('0x82'));}else{_0x183415[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x83')];loggerSyncQueueSummary[_0x26a8('0x44')](_0x26a8('0x84'),_0x183415[_0x26a8('0x47')],_0x26a8('0x85'));}emitCampaignSummary(_0x183415);}}function myreject(_0x47e780){return function(_0x4abbfe){return _0x47e780(msgResponse(_0x26a8('0x86'),_0x26a8('0x87'),JSON[_0x26a8('0x74')](_0x4abbfe)));};}Dialer[_0x26a8('0x18')]['isTrunkReachable']=function(_0x812f29){return!_['isUndefined'](_0x812f29)&&_0x812f29&&!_[_0x26a8('0x41')](_0x812f29['name'])&&!_[_0x26a8('0x41')](_0x812f29[_0x26a8('0x88')])&&_0x812f29[_0x26a8('0x88')]&&(this[_0x26a8('0x20')][util['format']('SIP/%s',_0x812f29['name'])][_0x26a8('0x89')]==='reachable'||this[_0x26a8('0x20')][util[_0x26a8('0x7d')](_0x26a8('0x8a'),_0x812f29[_0x26a8('0x47')])][_0x26a8('0x89')]===_0x26a8('0x8b'));};Dialer[_0x26a8('0x18')][_0x26a8('0x8c')]=function(_0x52a409){var _0x10685e=this;return function(){if(!_0x10685e[_0x26a8('0x8d')](_0x52a409[_0x26a8('0x8e')])){if(!_0x10685e[_0x26a8('0x8d')](_0x52a409[_0x26a8('0x8f')])){_0x52a409['message']=utils[_0x26a8('0x6a')][_0x26a8('0x90')];throw _0x52a409[_0x26a8('0x47')]+_0x26a8('0x91');}}};};Dialer[_0x26a8('0x18')][_0x26a8('0x92')]=function(_0x400d81,_0x140894,_0x117bb6,_0xd0b472){var _0x29cc28=this;return function(){var _0x4c2594=!![];return _0x29cc28[_0x26a8('0x93')](_0x400d81,_0x140894,_0x117bb6,_0xd0b472,_0x4c2594);};};Dialer['prototype'][_0x26a8('0x94')]=function(_0x53e517,_0x4c6161,_0x572cc5,_0x515aea){var _0x46785c=this;return function(){var _0x6157f0=![];return _0x46785c['ifTimeIvr'](_0x53e517[_0x26a8('0x79')],_0x4c6161,_0x572cc5,_0x515aea,_0x6157f0);};};Dialer[_0x26a8('0x18')][_0x26a8('0x93')]=function(_0x34d27d,_0x217e02,_0x5b9414,_0x144334,_0x527fd2){var _0x383fe4=[];return new Promise(function(_0x14efdb,_0x4439cc){if(!isNotNull(_0x34d27d)){_0x144334[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x77')];return _0x4439cc(msgResponse('ifTime','Failure',_0x5b9414+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x26a8('0x49')](_0x34d27d)){_0x144334['message']=utils[_0x26a8('0x6a')]['EMPTY_INTERVAL'];return _0x4439cc(msgResponse(_0x26a8('0x95'),'Failure',_0x5b9414+_0x26a8('0x96')));}if(_0x217e02&&_['isUndefined'](config[_0x26a8('0x97')][_0x217e02])){_0x144334[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x98')];return _0x4439cc(msgResponse(_0x26a8('0x95'),'Failure',_0x5b9414+_0x26a8('0x99')+_0x217e02));}if(_[_0x26a8('0x9a')](_0x34d27d)){for(var _0x3021ea=0x0;_0x3021ea<_0x34d27d[_0x26a8('0x9b')];_0x3021ea+=0x1){_0x383fe4[_0x26a8('0x9c')](ami[_0x26a8('0x9d')]({'action':_0x26a8('0x9e'),'command':util[_0x26a8('0x7d')](_0x26a8('0x9f'),_0x34d27d[_0x3021ea][_0x26a8('0xa0')],!_[_0x26a8('0x41')](config[_0x26a8('0x97')][_0x217e02])?_0x217e02:'')})[_0x26a8('0x3f')](function(_0x37f5b2){return _0x37f5b2[_0x26a8('0xa1')][_0x26a8('0xa2')]('true')>=0x0;})[_0x26a8('0xa3')](myreject(_0x4439cc)));}}else{_0x383fe4[_0x26a8('0x9c')](ami[_0x26a8('0x9d')]({'action':'command','command':util[_0x26a8('0x7d')](_0x26a8('0x9f'),_0x34d27d,!_[_0x26a8('0x41')](config['timezones'][_0x217e02])?_0x217e02:'')})['then'](function(_0x139185){return _0x139185[_0x26a8('0xa1')]['indexOf'](_0x26a8('0xa4'))>=0x0;})[_0x26a8('0xa3')](myreject(_0x4439cc)));}Promise[_0x26a8('0xa5')](_0x383fe4)[_0x26a8('0x3f')](function(_0x3c5ae7){var _0x478eb5=_[_0x26a8('0xa6')](_0x3c5ae7);if(_0x478eb5){return _0x14efdb(_0x478eb5);}else{_0x144334[_0x26a8('0x6c')]=_0x527fd2?utils['CAMPAIGN_STATUS'][_0x26a8('0xa7')]:utils[_0x26a8('0x6a')]['OVERTIME_INTERVAL'];return _0x4439cc(msgResponse(_0x26a8('0xa8'),_0x26a8('0xa9'),_0x26a8('0xaa')+_0x527fd2+'\x20'+_0x5b9414+_0x26a8('0xab')+util[_0x26a8('0x46')](_0x34d27d,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x217e02));}})[_0x26a8('0xa3')](function(_0x5df0bb){return _0x4439cc(msgResponse(_0x26a8('0x95'),_0x26a8('0xa9'),JSON[_0x26a8('0x74')](_0x5df0bb)));});});};Dialer[_0x26a8('0x18')][_0x26a8('0x3d')]=function(){var _0x30798b=this;return cmHopper[_0x26a8('0xac')]({'active':![]},{'where':{'active':!![]}})[_0x26a8('0x3f')](function(){setInterval(function(){_0x30798b[_0x26a8('0xad')]();},0x3e8);});};Dialer[_0x26a8('0x18')][_0x26a8('0xad')]=function(){var _0x5d6db0=this;var _0x4dfea3;for(var _0x4094ee in this[_0x26a8('0x1f')]){if(typeof this['campaigns'][_0x4094ee]!==_0x26a8('0xae')){_0x4dfea3=this[_0x26a8('0x1f')][_0x4094ee];if(utils[_0x26a8('0x7c')](_0x4dfea3)&&utils[_0x26a8('0x7a')](_0x4dfea3)){_0x4dfea3[_0x26a8('0x7f')]=!![];Promise[_0x26a8('0xaf')]()['then'](checkIsIVRCampaignActive(_0x4dfea3))['then'](checkInterval(_0x4dfea3))['then'](_0x5d6db0['checkIsTrunkReachable'](_0x4dfea3))[_0x26a8('0x3f')](_0x5d6db0[_0x26a8('0x92')](_0x4dfea3[_0x26a8('0xb0')],_0x4dfea3[_0x26a8('0xb1')],_0x4dfea3[_0x26a8('0x47')],_0x4dfea3))['then'](_0x5d6db0[_0x26a8('0x94')](_0x4dfea3[_0x26a8('0x76')],_0x4dfea3[_0x26a8('0xb1')],_0x4dfea3[_0x26a8('0x47')],_0x4dfea3))[_0x26a8('0x3f')](_0x5d6db0[_0x26a8('0xb2')](_0x4dfea3))[_0x26a8('0xa3')](loggerCatchQueueSummary('[syncCampaigns]',_0x4dfea3));}else{notSendMessagesCampaign(_0x4dfea3);}}}};Dialer['prototype']['checkDialMethod']=function(_0x244839){if(_0x244839[_0x26a8('0xb3')]!=='predictive'){clearPredictiveAttributes(_0x244839);}switch(_0x244839[_0x26a8('0xb3')]){case _0x26a8('0xb4'):this['handlePower'](_0x244839,0x1);break;case _0x26a8('0xb5'):this[_0x26a8('0xb6')](_0x244839,_0x244839['dialPowerLevel']);break;case'predictive':this[_0x26a8('0x8')](_0x244839);break;case _0x26a8('0x7'):this[_0x26a8('0xb6')](_0x244839,0x1);break;default:logger[_0x26a8('0x66')](_0x26a8('0xb7'),_0x244839['name'],_0x26a8('0xb8'));}};Dialer[_0x26a8('0x18')]['ifTime']=function(_0x36a3a0,_0x26435f){var _0x4d89b8=_0x36a3a0[_0x26a8('0xb1')];var _0x5c8552=_0x26435f?_0x36a3a0[_0x26a8('0xb0')]:_0x36a3a0[_0x26a8('0x76')][_0x26a8('0x79')];logger[_0x26a8('0xb9')]('Dialer::ifTime()',_0x5c8552,_0x4d89b8,_0x36a3a0['name'],util[_0x26a8('0x7d')](_0x26a8('0xba'),_0x36a3a0[_0x26a8('0x47')],_0x36a3a0['id']));var _0x563f0b=null;return Interval[_0x26a8('0xbb')](_0x5c8552,_0x4d89b8)[_0x26a8('0x3f')](function(_0x232d0b){if(_0x232d0b===!![]){return _0x232d0b;}else{_0x36a3a0[_0x26a8('0x6c')]=_0x26435f?utils['CAMPAIGN_STATUS'][_0x26a8('0xa7')]:utils[_0x26a8('0x6a')][_0x26a8('0xbc')];_0x563f0b=msgResponse(_0x26a8('0xa8'),_0x26a8('0xa9'),'Global:\x20'+_0x26435f+'\x20'+_0x36a3a0['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0x26a8('0x46')](_0x5c8552,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4d89b8);}if(_0x563f0b!==null){logger[_0x26a8('0xb9')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x563f0b);_0x563f0b[_0x26a8('0xbd')]=_0x26435f;throw _0x563f0b;}})[_0x26a8('0xa3')](function(_0x4eb648){logger[_0x26a8('0x66')](_0x26a8('0xbe'),_0x4eb648);throw msgResponse(_0x26a8('0x86'),'Error',util[_0x26a8('0x46')](_0x4eb648,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x26a8('0x2b')]=function(_0x2b56cd){if(this[_0x26a8('0x1e')][_0x2b56cd['queue']]){if(this[_0x26a8('0x23')][_0x2b56cd[_0x26a8('0xbf')]]&&this[_0x26a8('0x23')][_0x2b56cd['uniqueid']][_0x26a8('0x43')]!=='ivr'){this[_0x26a8('0xc0')](this[_0x26a8('0x1e')][_0x2b56cd[_0x26a8('0xc1')]]);this[_0x26a8('0x23')][_0x2b56cd[_0x26a8('0xbf')]]['answertime']=moment()[_0x26a8('0x7d')](_0x26a8('0xc2'));}}};Dialer['prototype']['syncAgentComplete']=function(_0x442fb2){var _0x1f29a7=this[_0x26a8('0x23')][_0x442fb2[_0x26a8('0xbf')]];if(this[_0x26a8('0x1e')][_0x442fb2[_0x26a8('0xc1')]]){if(_0x1f29a7&&_0x1f29a7['type']!==_0x26a8('0xc3')){delete this[_0x26a8('0x23')][_0x442fb2['uniqueid']];this[_0x26a8('0x1e')][_0x442fb2[_0x26a8('0xc1')]][_0x26a8('0xc4')]+=0x1;var _0x1e44c7=new AgentComplete(_0x1f29a7,_0x442fb2);if(_0x442fb2['reason']===_0x26a8('0xc5')){_0x1e44c7[_0x26a8('0xc6')]=this[_0x26a8('0x1e')][_0x442fb2[_0x26a8('0xc1')]][_0x26a8('0xc7')]&&this['voiceQueues'][_0x442fb2[_0x26a8('0xc1')]][_0x26a8('0xc8')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x26a8('0xc9')](_0x1e44c7)[_0x26a8('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1e44c7)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0xca')));}}};Dialer['prototype'][_0x26a8('0x2d')]=function(_0x3f7986){var _0x2dafad=this[_0x26a8('0x23')][_0x3f7986[_0x26a8('0xbf')]];var _0x2eb1df=this;var _0x334d1d=![];var _0x2be139;var _0x1b1c9e;if(this[_0x26a8('0x1e')][_0x3f7986['queue']]){if(_0x2dafad&&_0x2dafad[_0x26a8('0x43')]!==_0x26a8('0xc3')){delete this[_0x26a8('0x23')][_0x3f7986['uniqueid']];this[_0x26a8('0xc0')](this[_0x26a8('0x1e')][_0x3f7986['queue']]);_0x2dafad[_0x26a8('0xcb')]=moment()[_0x26a8('0x7d')](_0x26a8('0xc2'));var _0x236dd5=new QueueCallerAbandon(_0x2dafad,_0x3f7986);if(utils[_0x26a8('0x62')](_0x2dafad[_0x26a8('0xcb')],_0x2dafad['responsetime'])>=_0x2dafad[_0x26a8('0xcc')]){this[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]][_0x26a8('0xcd')]+=0x1;this[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]][_0x26a8('0xce')]+=0x1;_0x236dd5['state']=0xa;_0x236dd5[_0x26a8('0x6f')]='Drop';_0x236dd5['dropreason']=_0x26a8('0xcf');_0x236dd5[_0x26a8('0xc6')]=this[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]][_0x26a8('0xc7')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x236dd5['countdropretry']+=0x1;_0x236dd5[_0x26a8('0xd0')]+=0x1;_0x2be139=this[_0x26a8('0x1e')][_0x3f7986['queue']]['dialDropRetryFrequency'];_0x1b1c9e=this['voiceQueues'][_0x3f7986[_0x26a8('0xc1')]][_0x26a8('0xd1')];hopperUtils[_0x26a8('0xd2')](_0x236dd5,_0x236dd5[_0x26a8('0x6e')],_0x2dafad[_0x26a8('0xd3')])[_0x26a8('0x3f')](function(_0xd6ac85){_0x334d1d=_0xd6ac85[_0x26a8('0xd4')]==0x1;if(_0x236dd5[_0x26a8('0xd5')]>=_0x2eb1df[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]]['dialDropMaxRetry']){_0x2eb1df[_0x26a8('0xd6')](_0x236dd5,_0xd6ac85[_0x26a8('0xd4')]);}else{hopperUtils[_0x26a8('0xd7')]({'active':![],'countdropretry':_0x236dd5['countdropretry'],'scheduledat':moment()[_0x26a8('0xd8')](_0x2eb1df[_0x26a8('0x1e')][_0x3f7986['queue']][_0x26a8('0xd9')],'minutes')[_0x26a8('0x7d')](_0x26a8('0xc2')),'ContactId':_0x2dafad[_0x26a8('0xda')],'ListId':_0x2dafad[_0x26a8('0xdb')],'VoiceQueueId':_0x2dafad[_0x26a8('0xdc')]||undefined,'CampaignId':_0x2dafad[_0x26a8('0xdd')]||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0xde')));var _0x586c42=new History(_0x236dd5);_0x586c42[_0x26a8('0x6e')]=0xa;_0x586c42['statedesc']=_0x26a8('0xdf');_0x586c42['starttime']=moment()[_0x26a8('0x7d')](_0x26a8('0xc2'));_0x586c42['endtime']=_0x586c42[_0x26a8('0xe0')];_0x586c42[_0x26a8('0xe1')]=_0x236dd5[_0x26a8('0xe1')];_0x586c42[_0x26a8('0xe2')]=_0x236dd5['calleridnum'];hopperUtils['createHistory'](_0x586c42)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x26a8('0x3f')](function(){if(_0x334d1d)hopperUtils[_0x26a8('0xe3')](_0x236dd5,_0x2be139,_0x1b1c9e)[_0x26a8('0x3f')](function(){return 0x1;});});}else{this['voiceQueues'][_0x3f7986['queue']][_0x26a8('0x50')]+=0x1;this['voiceQueues'][_0x3f7986[_0x26a8('0xc1')]][_0x26a8('0xe4')]+=0x1;_0x236dd5[_0x26a8('0x6e')]=0xb;_0x236dd5[_0x26a8('0x6f')]=_0x26a8('0xe5');_0x236dd5[_0x26a8('0xe6')]=_0x26a8('0xe7');_0x236dd5['countabandonedretry']+=0x1;_0x236dd5[_0x26a8('0xd0')]+=0x1;_0x2be139=this[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]][_0x26a8('0xe8')];_0x1b1c9e=this['voiceQueues'][_0x3f7986['queue']][_0x26a8('0xd1')];hopperUtils[_0x26a8('0xd2')](_0x236dd5,_0x236dd5[_0x26a8('0x6e')],_0x2dafad[_0x26a8('0xd3')])[_0x26a8('0x3f')](function(_0x42f855){if(_0x236dd5['countabandonedretry']>=_0x2eb1df[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]][_0x26a8('0xe9')]){_0x2eb1df['queueCallerAbandonCreateState'](_0x236dd5,_0x42f855['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x236dd5[_0x26a8('0xea')],'scheduledat':moment()[_0x26a8('0xd8')](_0x2eb1df[_0x26a8('0x1e')][_0x3f7986[_0x26a8('0xc1')]]['dialAbandonedRetryFrequency'],'minutes')[_0x26a8('0x7d')](_0x26a8('0xc2')),'ContactId':_0x2dafad[_0x26a8('0xda')],'ListId':_0x2dafad['ListId'],'VoiceQueueId':_0x2dafad['VoiceQueueId']||undefined,'CampaignId':_0x2dafad['CampaignId']||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0xeb')));var _0x14d042=new History(_0x236dd5);_0x14d042[_0x26a8('0x6e')]=0xb;_0x14d042[_0x26a8('0x6f')]=_0x26a8('0xe5');_0x14d042[_0x26a8('0xe0')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14d042[_0x26a8('0x70')]=_0x14d042['starttime'];_0x14d042['calleridname']=_0x236dd5[_0x26a8('0xe1')];_0x14d042['calleridnum']=_0x236dd5[_0x26a8('0xe2')];hopperUtils[_0x26a8('0xc9')](_0x14d042)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0xec')));}})[_0x26a8('0x3f')](function(){if(_0x334d1d)hopperUtils[_0x26a8('0xe3')](_0x236dd5,_0x2be139,_0x1b1c9e)[_0x26a8('0x3f')](function(){return 0x1;});});}}}};Dialer[_0x26a8('0x18')]['syncNewExten']=function(_0x35071e){if(this[_0x26a8('0xed')][_0x35071e[_0x26a8('0xbf')]]){this[_0x26a8('0xed')][_0x35071e['uniqueid']][_0x26a8('0xee')]=_0x35071e[_0x26a8('0xee')];}if(this[_0x26a8('0x23')][_0x35071e[_0x26a8('0xbf')]]){this[_0x26a8('0x23')][_0x35071e[_0x26a8('0xbf')]][_0x26a8('0xee')]=_0x35071e[_0x26a8('0xee')];}};Dialer[_0x26a8('0x18')][_0x26a8('0xef')]=function(_0x2d94bf){if(!this['actions'][_0x2d94bf['actionid']]){return;}var _0x30ea06=this['voiceQueues'][this[_0x26a8('0xed')][_0x2d94bf[_0x26a8('0xf0')]][_0x26a8('0xc1')]][_0x26a8('0xf1')]||_0x26a8('0xf2');if(_0x30ea06===_0x26a8('0xf3')){if(this[_0x26a8('0xed')][_0x2d94bf['actionid']]&&_['isNil'](this[_0x26a8('0xed')][_0x2d94bf[_0x26a8('0xf0')]][_0x26a8('0xf4')])&&_0x2d94bf[_0x26a8('0x89')]==='1'&&_0x2d94bf[_0x26a8('0xf5')]==='0'){if(this['agents'][_0x2d94bf['stateinterface']]){if(!this[_0x26a8('0xf6')][_0x2d94bf[_0x26a8('0xf7')]][_0x26a8('0xf4')]){this['agents'][_0x2d94bf[_0x26a8('0xf7')]][_0x26a8('0xf4')]=!![];this[_0x26a8('0xed')][_0x2d94bf[_0x26a8('0xf0')]][_0x26a8('0xf4')]=!![];this[_0x26a8('0xed')][_0x2d94bf[_0x26a8('0xf0')]][_0x26a8('0xf7')]=_0x2d94bf[_0x26a8('0xf7')];}}}}else if(_0x30ea06===_0x26a8('0xf2')){if(this[_0x26a8('0xed')][_0x2d94bf['actionid']]){if(this[_0x26a8('0xf6')][_0x2d94bf[_0x26a8('0xf7')]]){this[_0x26a8('0xed')][_0x2d94bf[_0x26a8('0xf0')]]['stateinterface']=_0x2d94bf['stateinterface'];if(_[_0x26a8('0xf8')](this[_0x26a8('0xf9')][this['actions'][_0x2d94bf[_0x26a8('0xf0')]][_0x26a8('0xc1')]])){this[_0x26a8('0xf9')][this[_0x26a8('0xed')][_0x2d94bf['actionid']][_0x26a8('0xc1')]]=[];}this['queueBooked'][this[_0x26a8('0xed')][_0x2d94bf[_0x26a8('0xf0')]]['queue']][_0x26a8('0x9c')](_[_0x26a8('0xfa')](_[_0x26a8('0x75')](this[_0x26a8('0xed')][_0x2d94bf[_0x26a8('0xf0')]],[_0x26a8('0xfb'),_0x26a8('0xf7')]),{'status':_0x2d94bf[_0x26a8('0x89')],'paused':_0x2d94bf[_0x26a8('0xf5')]}));}}}};Dialer['prototype'][_0x26a8('0x3c')]=function(_0x3958a3){if(!this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]]){return;}var _0x1a1792=this;var _0x238509=this[_0x26a8('0x1e')][this[_0x26a8('0xed')][_0x3958a3['actionid']]['queue']];var _0x3e04e6=_0x238509[_0x26a8('0xf1')]||_0x26a8('0xf2');if(_0x3e04e6==='roundrobin'){if(this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]]&&this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]][_0x26a8('0xf7')]){this[_0x26a8('0x1d')][_0x26a8('0xfc')](this[_0x26a8('0xed')][_0x3958a3['actionid']][_0x26a8('0xfb')],this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]][_0x26a8('0xf7')])[_0x26a8('0xa3')](function(_0x281c25){logger[_0x26a8('0x66')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x281c25,{'showHidden':![],'depth':null}));})[_0x26a8('0x1b')](function(){_0x1a1792[_0x26a8('0xc0')](_0x1a1792[_0x26a8('0x1e')][_0x1a1792['actions'][_0x3958a3[_0x26a8('0xf0')]][_0x26a8('0xc1')]]);_0x1a1792[_0x26a8('0xf6')][_0x1a1792['actions'][_0x3958a3['actionid']][_0x26a8('0xf7')]]['locked']=![];delete _0x1a1792[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]];unlockQueueStatus(_0x238509);});}else{this[_0x26a8('0xc0')](this['voiceQueues'][this[_0x26a8('0xed')][_0x3958a3['actionid']][_0x26a8('0xc1')]]);hopperUtils[_0x26a8('0xd7')]({'active':![],'ContactId':this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]][_0x26a8('0xda')],'ListId':this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]]['ListId'],'VoiceQueueId':this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]][_0x26a8('0xdc')]||undefined,'CampaignId':this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]][_0x26a8('0xdd')]||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0xfd')));delete this['actions'][_0x3958a3[_0x26a8('0xf0')]];unlockQueueStatus(_0x238509);}}else if(_0x3e04e6==='rrmemory'){var _0x36df78;if(this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]]&&!_[_0x26a8('0x49')](this[_0x26a8('0xf9')][this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]]['queue']])){if(this[_0x26a8('0x28')][_0x1a1792[_0x26a8('0xed')][_0x3958a3['actionid']][_0x26a8('0xc1')]]){this[_0x26a8('0x28')][_0x1a1792['actions'][_0x3958a3['actionid']][_0x26a8('0xc1')]]=this[_0x26a8('0x28')][this[_0x26a8('0xed')][_0x3958a3['actionid']][_0x26a8('0xc1')]]?this[_0x26a8('0x28')][this[_0x26a8('0xed')][_0x3958a3['actionid']][_0x26a8('0xc1')]]:this[_0x26a8('0xf9')][this['actions'][_0x3958a3['actionid']][_0x26a8('0xc1')]]?this['queueBooked'][this['actions'][_0x3958a3['actionid']][_0x26a8('0xc1')]][_0x26a8('0xfe')]||0x0:0x0;}this[_0x26a8('0xf9')][this[_0x26a8('0xed')][_0x3958a3['actionid']]['queue']]['_rr']=this[_0x26a8('0x28')][this[_0x26a8('0xed')][_0x3958a3[_0x26a8('0xf0')]][_0x26a8('0xc1')]];for(var _0xfc0456=0x0;_0xfc0456=_0x3570ed['dialGlobalMaxRetry']){_0x2291bc[_0x26a8('0x124')](_0x58ab95,_0x26807b,_0x4679f6,_0x26a8('0x125'));}else{if(_0x58ab95[_0x26a8('0x122')]>=_0x3570ed['dialMachineMaxRetry']){_0x2291bc[_0x26a8('0x126')](_0x58ab95,_0x26807b,_0x4679f6,'reason\x2019\x20machine....');}else{hopperUtils[_0x26a8('0xd7')]({'active':![],'countmachineretry':_0x58ab95[_0x26a8('0x122')],'scheduledat':moment()[_0x26a8('0xd8')](_0x3570ed[_0x26a8('0x127')],_0x26a8('0x128'))[_0x26a8('0x7d')](_0x26a8('0xc2')),'ContactId':_0x58ab95[_0x26a8('0xda')],'ListId':_0x58ab95[_0x26a8('0xdb')],'VoiceQueueId':_0x58ab95['VoiceQueueId']||undefined,'CampaignId':_0x58ab95[_0x26a8('0xdd')]||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x129')));_0x26807b({'reschedule':0x1});}}});}if(_0x18eb1d['type']===_0x26a8('0xc3')&&this[_0x26a8('0x1f')][_0x18eb1d[_0x26a8('0xc1')]][_0x26a8('0x112')]&&_0x15e4fd[_0x26a8('0x119')]===_0x26a8('0x113')){delete this[_0x26a8('0x23')][_0x15e4fd[_0x26a8('0xbf')]];this[_0x26a8('0xc0')](this[_0x26a8('0x1f')][_0x18eb1d[_0x26a8('0xc1')]]);_0x499a30=new Hangup(_0x18eb1d,_0x15e4fd);_0x499a30[_0x26a8('0x6e')]=0x12;_0x499a30[_0x26a8('0x6f')]=_0x26a8('0x12a');_0x499a30[_0x26a8('0x12b')]=_0x26a8('0x115');ami[_0x26a8('0x42')](_0x26a8('0x116'),ut[_0x26a8('0x117')](_0x499a30,_0x26a8('0x11c')));this[_0x26a8('0x12c')](_0x499a30,_0x26a8('0x12d'),'[syncHangupInAMDIvr]');}if(_0x18eb1d[_0x26a8('0x43')]===_0x26a8('0xc3')&&this['campaigns'][_0x18eb1d[_0x26a8('0xc1')]][_0x26a8('0x112')]&&_0x15e4fd[_0x26a8('0x119')]===_0x26a8('0x11a')){return new Promise(function(_0x20c099,_0x469d03){delete _0x2291bc[_0x26a8('0x23')][_0x15e4fd[_0x26a8('0xbf')]];_0x2291bc[_0x26a8('0xc0')](_0x2291bc['campaigns'][_0x18eb1d['queue']]);_0x2291bc['campaigns'][_0x18eb1d[_0x26a8('0xc1')]]['outboundAnswerCallsDay']+=0x1;_0x2291bc[_0x26a8('0x1f')][_0x18eb1d['queue']][_0x26a8('0x114')]+=0x1;var _0x555e92=_0x2291bc[_0x26a8('0x1f')][_0x18eb1d[_0x26a8('0xc1')]];var _0x52258b=new Hangup(_0x18eb1d,_0x15e4fd);_0x52258b[_0x26a8('0x6e')]=0x13;_0x52258b[_0x26a8('0x6f')]='Machine';_0x52258b['membername']='AMD';_0x52258b[_0x26a8('0x122')]+=0x1;_0x52258b['countglobal']+=0x1;_0x52258b['amd']=!![];ami[_0x26a8('0x42')](_0x26a8('0x116'),ut[_0x26a8('0x117')](_0x52258b,_0x26a8('0x11c')));hopperUtils[_0x26a8('0xc9')](_0x52258b)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x11d')));if(_0x52258b[_0x26a8('0x11e')]+_0x52258b[_0x26a8('0x11f')]+_0x52258b[_0x26a8('0x120')]+_0x52258b[_0x26a8('0x121')]+_0x52258b[_0x26a8('0xd5')]+_0x52258b[_0x26a8('0xea')]+_0x52258b['countmachineretry']+_0x52258b['countagentrejectretry']>=_0x555e92[_0x26a8('0x12e')]){_0x2291bc[_0x26a8('0x124')](_0x52258b,_0x20c099,_0x469d03,'reason19\x20machine....');}else{if(_0x52258b[_0x26a8('0x122')]>=_0x555e92[_0x26a8('0x12f')]){_0x2291bc[_0x26a8('0x126')](_0x52258b,_0x20c099,_0x469d03,_0x26a8('0x130'));}else{hopperUtils[_0x26a8('0xd7')]({'active':![],'countmachineretry':_0x52258b[_0x26a8('0x122')],'scheduledat':moment()[_0x26a8('0xd8')](_0x555e92[_0x26a8('0x127')],'minutes')['format'](_0x26a8('0xc2')),'ContactId':_0x52258b['ContactId'],'ListId':_0x52258b[_0x26a8('0xdb')],'VoiceQueueId':_0x52258b[_0x26a8('0xdc')]||undefined,'CampaignId':_0x52258b['CampaignId']||undefined})['catch'](loggerCatch(_0x26a8('0x129')));_0x20c099({'reschedule':0x1});}}});}}};Dialer[_0x26a8('0x18')][_0x26a8('0x35')]=function(_0x22f57e){var _0x20c39e=this['uniqueId'][_0x22f57e['uniqueid']];var _0x475379;if(_0x20c39e&&_0x20c39e[_0x26a8('0x43')]===_0x26a8('0xc3')){delete this[_0x26a8('0x23')][_0x22f57e[_0x26a8('0xbf')]];this[_0x26a8('0xc0')](this['campaigns'][_0x20c39e[_0x26a8('0xc1')]]);this['campaigns'][_0x20c39e['queue']][_0x26a8('0x131')]+=0x1;_0x475379=new Hangup(_0x20c39e,_0x22f57e);hopperUtils[_0x26a8('0xc9')](_0x475379)[_0x26a8('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x26a8('0x132')](_0x475379)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x20c39e&&_0x20c39e[_0x26a8('0x43')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x20c39e[_0x26a8('0xc1')]][_0x26a8('0x133')])){delete this[_0x26a8('0x23')][_0x22f57e[_0x26a8('0xbf')]];this[_0x26a8('0xc0')](this[_0x26a8('0x1e')][_0x20c39e[_0x26a8('0xc1')]]);this['voiceQueues'][_0x20c39e[_0x26a8('0xc1')]][_0x26a8('0xc4')]+=0x1;this[_0x26a8('0x1e')][_0x20c39e[_0x26a8('0xc1')]][_0x26a8('0x114')]+=0x1;_0x475379=new Hangup(_0x20c39e,_0x22f57e);_0x475379[_0x26a8('0x6e')]=0x10;_0x475379[_0x26a8('0x6f')]=_0x26a8('0x134');_0x475379[_0x26a8('0x12b')]=_0x26a8('0x135');hopperUtils[_0x26a8('0xc9')](_0x475379)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x136')));hopperUtils[_0x26a8('0x132')](_0x475379)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x20c39e&&_0x20c39e[_0x26a8('0x43')]!==_0x26a8('0xc3')&&!isNotNull(this[_0x26a8('0x1e')][_0x20c39e[_0x26a8('0xc1')]][_0x26a8('0x133')])){delete this['uniqueId'][_0x22f57e[_0x26a8('0xbf')]];this[_0x26a8('0xc0')](this['voiceQueues'][_0x20c39e[_0x26a8('0xc1')]]);this['voiceQueues'][_0x20c39e[_0x26a8('0xc1')]]['outboundUnknownCallsDay']+=0x1;_0x475379=new Hangup(_0x20c39e,_0x22f57e);_0x475379['state']=0xc;_0x475379[_0x26a8('0x6f')]=_0x22f57e[_0x26a8('0x137')];_0x475379[_0x26a8('0x12b')]=_0x26a8('0x138');hopperUtils[_0x26a8('0xc9')](_0x475379)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x136')));hopperUtils[_0x26a8('0x132')](_0x475379)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x139')));}};Dialer['prototype'][_0x26a8('0xa')]=function(_0xca6d69){var _0xbc4971=this;if(!_0xbc4971['queuesSummary'][_0xca6d69[_0x26a8('0x47')]]){_0xbc4971[_0x26a8('0x29')][_0xca6d69['name']]={'running':![]};}else if(_0xbc4971[_0x26a8('0x29')][_0xca6d69[_0x26a8('0x47')]][_0x26a8('0x13a')]===!![]){return;}else if(_0xbc4971[_0x26a8('0x29')][_0xca6d69[_0x26a8('0x47')]][_0x26a8('0x13a')]===![]){_0xbc4971[_0x26a8('0x29')][_0xca6d69[_0x26a8('0x47')]][_0x26a8('0x13a')]=!![];}var _0x273344=_0xbc4971[_0x26a8('0x1e')][_0xca6d69[_0x26a8('0x47')]];var _0x2a8e4a=_0x273344[_0x26a8('0x6c')]!==utils[_0x26a8('0x6a')]['INACTIVE'];var _0xba0a56=utils[_0x26a8('0x13b')](_0x273344);_0x273344[_0x26a8('0x13c')]=utils['getQueueCampaignStatusMessage'](_0x273344,_0xbc4971[_0x26a8('0x20')]);Promise[_0x26a8('0xaf')]()[_0x26a8('0x3f')](function(){if(_0x273344[_0x26a8('0x13c')]===utils[_0x26a8('0x6a')][_0x26a8('0x81')]){if(_0x2a8e4a){clearPredictiveAttributes(_0x273344);_0xca6d69['startPredictive']=undefined;_0xca6d69['startProgressive']=undefined;}if(_0x273344['statusMessage']===utils[_0x26a8('0x6a')]['INACTIVE']){_0xca6d69[_0x26a8('0x13d')]=0x0;_0xca6d69[_0x26a8('0xf5')]=0x0;_0xca6d69[_0x26a8('0x13e')]=0x0;_0xca6d69['talking']=0x0;_0xca6d69[_0x26a8('0x13f')]=0x0;}}else if(_0x273344['statusMessage']===utils[_0x26a8('0x6a')]['ACTIVE']&&!_0xba0a56){return _0xbc4971[_0x26a8('0x95')](_0x273344,!![])[_0x26a8('0x3f')](function(){return _0xbc4971[_0x26a8('0x95')](_0x273344,![]);})[_0x26a8('0x3f')](function(){return _0xbc4971[_0x26a8('0x140')](_0x273344);})[_0x26a8('0xa3')](function(_0x2b9eaa){loggerSyncQueueSummary['debug'](_0x26a8('0x141'),util[_0x26a8('0x46')](_0x2b9eaa,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x273344);});}else{clearPredictiveAttributes(_0x273344);}})[_0x26a8('0x3f')](function(){var _0x330ab6=_0xca6d69[_0x26a8('0x142')](_0x273344);if(_0x330ab6||_0x273344[_0x26a8('0x143')]){_0x273344['queueSummaryCountersUpdated']=![];_0xca6d69[_0x26a8('0x144')](_0x273344);Object[_0x26a8('0x145')](_0x273344,_0xca6d69);emitOutboundVoiceQueueSummary(_0xca6d69);}_0xbc4971[_0x26a8('0x29')][_0x273344['name']][_0x26a8('0x13a')]=![];})[_0x26a8('0xa3')](function(_0x184d5a){logger['error'](_0x26a8('0x141'),util['inspect'](_0x184d5a,{'showHidden':![],'depth':null}));_0xbc4971[_0x26a8('0x29')][_0x273344[_0x26a8('0x47')]][_0x26a8('0x13a')]=![];});};Dialer[_0x26a8('0x18')][_0x26a8('0x33')]=_[_0x26a8('0x146')](function(){var _0x3520bd=_[_0x26a8('0x147')](this[_0x26a8('0x1e')],function(_0x2988fc){return _0x2988fc[_0x26a8('0x148')];});var _0x4a83a2=_[_0x26a8('0x147')](this['agents'],function(_0x5a60e5){return _0x5a60e5[_0x26a8('0x149')]&&_0x5a60e5[_0x26a8('0x89')]===_0x26a8('0x14a');});if(_0x3520bd[_0x26a8('0x9b')]>0x0&&_0x4a83a2['length']>0x0){return Promise[_0x26a8('0xaf')]()[_0x26a8('0x3f')](cmHopper[_0x26a8('0x14b')](_['map'](_0x3520bd,'id'),previewRecallmeReminderInterval,_[_0x26a8('0x14c')](_0x4a83a2,'id')))['then'](function(_0x4f6696){for(var _0x26ebf5=0x0;_0x26ebf5<_0x4f6696[_0x26a8('0x9b')];_0x26ebf5++){var _0x54e8ef=_0x4f6696[_0x26ebf5][_0x26a8('0x14d')]['name'];if(_0x54e8ef)io['to'](util[_0x26a8('0x7d')](_0x26a8('0x14e'),_0x54e8ef))[_0x26a8('0x42')](_0x26a8('0x14f'),{'hopper':_0x4f6696[_0x26ebf5]});}})['catch'](function(_0x341c04){logger[_0x26a8('0x66')]('checkPreviewRecallReminder',_0x341c04);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x26a8('0x18')][_0x26a8('0x3e')]=function(){var _0x347459=this;setInterval(function(){_0x347459[_0x26a8('0x150')](_0x347459[_0x26a8('0x23')],_0x26a8('0x151'));_0x347459[_0x26a8('0x150')](_0x347459[_0x26a8('0xed')],_0x26a8('0x152'));},0x32c8);};Dialer[_0x26a8('0x18')][_0x26a8('0x150')]=function(_0x432e6b,_0xa00e5a){var _0x16ed8a=this;for(var _0x537c3a in _0x432e6b){if(typeof _0x432e6b[_0x537c3a]!==_0x26a8('0xae')){this[_0x26a8('0x1c')][_0x26a8('0x19')](function(){if(!_['isNil'](_0x432e6b[_0x537c3a])){return ami['Action']({'action':_0x26a8('0x89'),'channel':_0x432e6b[_0x537c3a][_0x26a8('0xee')]})[_0x26a8('0xa3')](function(_0xb9f46a){if(_0xb9f46a[_0x26a8('0x6c')]===_0x26a8('0x153')){setTimeout(function(){if(_0x432e6b[_0x537c3a]&&_0x432e6b[_0x537c3a][_0x26a8('0x43')]!==_0x26a8('0xc3')){_0x16ed8a['updateOriginated'](_0x16ed8a[_0x26a8('0x1e')][_0x432e6b[_0x537c3a][_0x26a8('0xc1')]]);logger['error'](_0x26a8('0x154'),_0xa00e5a,_0x537c3a,_0x432e6b[_0x537c3a][_0x26a8('0xc1')]);delete _0x432e6b[_0x537c3a];}if(_0x432e6b[_0x537c3a]&&_0x432e6b[_0x537c3a][_0x26a8('0x43')]===_0x26a8('0xc3')){_0x16ed8a['updateOriginated'](_0x16ed8a[_0x26a8('0x1f')][_0x432e6b[_0x537c3a]['queue']]);logger['error']('[Dialer][checkChannel][ivr]',_0xa00e5a,_0x537c3a,_0x432e6b[_0x537c3a][_0x26a8('0xc1')]);delete _0x432e6b[_0x537c3a];}},0x2328);}});}});}}};Dialer['prototype'][_0x26a8('0x155')]=function(_0x1168ad){return Promise['resolve']()['then'](voiceQueueRt[_0x26a8('0x155')](_0x1168ad))['catch'](loggerCatch(_0x26a8('0x156')));};Dialer['prototype'][_0x26a8('0xc0')]=function(_0x52aed){if(!_[_0x26a8('0x41')](_0x52aed)&&_0x52aed!==null){if(typeof _0x52aed['originated']!=='undefined'){if(_0x52aed[_0x26a8('0x80')]>0x0){_0x52aed[_0x26a8('0x80')]-=0x1;}else{logger['error'](_0x26a8('0x157'));}}}else{logger[_0x26a8('0x66')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x26a8('0x158')]=function(_0x3b7915,_0x134a85){var _0x4a585=this;return function(_0x3b74a4){_0x4a585['updateOriginated'](_0x134a85);logger[_0x26a8('0x66')](_0x3b7915,util[_0x26a8('0x46')](_0x3b74a4,{'showHidden':![],'depth':null}));};};Dialer[_0x26a8('0x18')][_0x26a8('0x159')]=function(_0x31b24e,_0x4f5288,_0x35f7f3){var _0x4d38f1={'state':0x19,'statedesc':_0x26a8('0x15a')};this[_0x26a8('0xc0')](_0x4f5288);this[_0x26a8('0x12c')](_['merge'](_0x4d38f1,_[_0x26a8('0x75')](_0x35f7f3,['ContactId',_0x26a8('0xdb'),'UserId',_0x26a8('0xdc'),'CampaignId'])),_0x26a8('0x15b'),_0x26a8('0x15c'));logger['error'](_0x31b24e);};Dialer['prototype'][_0x26a8('0x12c')]=function(_0x31bddc,_0xb0c3ad,_0x21056d){hopperUtils[_0x26a8('0xc9')](_0x31bddc)[_0x26a8('0xa3')](loggerCatch(_0xb0c3ad));hopperUtils[_0x26a8('0x132')](_0x31bddc)['catch'](loggerCatch(_0x21056d));};Dialer[_0x26a8('0x18')][_0x26a8('0xd6')]=function(_0x13b925,_0x22f2e7){hopperUtils[_0x26a8('0xc9')](_0x13b925)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x15d')));if(_0x22f2e7==0x0){hopperUtils[_0x26a8('0x132')](_0x13b925)['catch'](loggerCatch(_0x26a8('0x15e')));}};Dialer[_0x26a8('0x18')][_0x26a8('0x15f')]=function(_0x1d6565){return Promise[_0x26a8('0xaf')]()[_0x26a8('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0x1d6565['id'],previewRecallmeReminderInterval))[_0x26a8('0x3f')](function(_0x1ff145){for(var _0x39b5d2=0x0;_0x39b5d2<_0x1ff145[_0x26a8('0x9b')];_0x39b5d2++){var _0x424470=_0x1ff145[_0x39b5d2][_0x26a8('0x14d')][_0x26a8('0x47')];if(_0x424470)io['to'](util[_0x26a8('0x7d')](_0x26a8('0x14e'),_0x424470))[_0x26a8('0x42')](_0x26a8('0x14f'),{'hopper':_0x1ff145[_0x39b5d2]});}})[_0x26a8('0xa3')](function(){});};Dialer['prototype'][_0x26a8('0xb2')]=function(_0x28b195){var _0x3d9e27=this;return function(){_0x3d9e27['handleIvr'](_0x28b195);};};Dialer['prototype'][_0x26a8('0x160')]=function(_0x412003,_0x55b520){var _0x174e70=this;var _0x51fd91=uuid['v4']();this[_0x26a8('0xed')][_0x51fd91]=new Action(_0x412003,_0x55b520,_0x51fd91);return new Promise(function(_0x41c908,_0x1cd239){if(_[_0x26a8('0x41')](_0x412003)&&typeof _0x412003!==_0x26a8('0x161')){return _0x1cd239(msgResponse('originate','Failure',_0x26a8('0x162')));}if(_[_0x26a8('0x41')](_0x55b520[_0x26a8('0x163')])||_0x55b520[_0x26a8('0x163')]===null){return _0x1cd239(msgResponse('originate',_0x26a8('0xa9'),_0x26a8('0x164')));}var _0x14f6a2={'XMD-CALLERID':_0x174e70[_0x26a8('0xed')][_0x51fd91]['getCaller'](),'XMD-AGI':_0x412003[_0x26a8('0x133')]?util[_0x26a8('0x7d')](_0x26a8('0x165'),ipAgi,_0x412003[_0x26a8('0x133')]):'NONE','XMD-AGIAFTER':_0x412003[_0x26a8('0xc7')]?util[_0x26a8('0x7d')](_0x26a8('0x165'),ipAgi,_0x412003['dialQueueProject2']):_0x26a8('0x166'),'XMD-QUEUE':utils[_0x26a8('0x167')](_0x412003)?util['format']('\x22%s,%s%s,,,%s\x22',_0x412003[_0x26a8('0x47')],_0x412003[_0x26a8('0x168')]||'',_0x412003[_0x26a8('0xc8')]?'c':'',_0x412003[_0x26a8('0xcc')]||0x3):'NONE','XMD-CONTACTID':_0x55b520[_0x26a8('0xda')],'XMD-CDRTYPE':_0x26a8('0x6'),'CALLERID(all)':_0x174e70[_0x26a8('0xed')][_0x51fd91][_0x26a8('0x169')](),'XMD-AMD':_0x412003[_0x26a8('0x112')]?'ACTIVE':_0x26a8('0x166'),'XMD-DESTINATION':_0x26a8('0x111')};if(_0x412003['dialAMDActive']){_0x14f6a2[_0x26a8('0x16a')]=_0x412003['dialAMDInitialSilence']||0x9c4;_0x14f6a2[_0x26a8('0x16b')]=_0x412003[_0x26a8('0x16c')]||0x5dc;_0x14f6a2[_0x26a8('0x16d')]=_0x412003[_0x26a8('0x16e')]||0x320;_0x14f6a2[_0x26a8('0x16f')]=_0x412003['dialAMDTotalAnalysisTime']||0x1388;_0x14f6a2[_0x26a8('0x170')]=_0x412003[_0x26a8('0x171')]||0x64;_0x14f6a2[_0x26a8('0x172')]=_0x412003[_0x26a8('0x173')]||0x32;_0x14f6a2[_0x26a8('0x174')]=_0x412003[_0x26a8('0x175')]||0x3;_0x14f6a2[_0x26a8('0x176')]=_0x412003['dialAMDSilenceThreshold']||0x100;_0x14f6a2[_0x26a8('0x177')]=_0x412003[_0x26a8('0x178')]||0x1388;}if(utils[_0x26a8('0x167')](_0x412003)){_0x14f6a2['XMD-VOICEQUEUEID']=_0x55b520[_0x26a8('0xdc')];}else{_0x14f6a2[_0x26a8('0x179')]=_0x55b520[_0x26a8('0xdd')];}var _0x7fdad7=utils[_0x26a8('0x17a')](_0x55b520[_0x26a8('0x17b')]);Object[_0x26a8('0x145')](_0x14f6a2,_0x7fdad7);var _0xfa0f61=_0x174e70[_0x26a8('0x8d')](_0x412003['Trunk'])?utils[_0x26a8('0x17c')](_0x412003['Trunk'][_0x26a8('0x17d')],_0x412003[_0x26a8('0x17e')],_0x412003[_0x26a8('0x17f')]>0x0?utils[_0x26a8('0x180')](_0x412003[_0x26a8('0x181')],_0x412003[_0x26a8('0x17f')]):_0x412003[_0x26a8('0x181')]):utils[_0x26a8('0x17c')](_['isNil'](_0x412003['TrunkBackup'])?_0x412003[_0x26a8('0x8e')][_0x26a8('0x17d')]:_0x412003['TrunkBackup'][_0x26a8('0x17d')],_0x412003[_0x26a8('0x17e')],_0x412003['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x412003['dialOriginateCallerIdNumber'],_0x412003['dialRandomLastDigitCallerIdNumber']):_0x412003[_0x26a8('0x181')]);if(_0xfa0f61){_0x14f6a2['XMD-ORIGINATECALLERIDNAME']=_0x174e70[_0x26a8('0xed')][_0x51fd91][_0x26a8('0x182')]=utils[_0x26a8('0x183')](_0xfa0f61);_0x14f6a2[_0x26a8('0x184')]=_0x55b520[_0x26a8('0x163')];}_0x412003['variables']=_0x14f6a2;return ami['Action']({'actionid':_0x51fd91,'action':_0x26a8('0x185'),'channel':_0x174e70[_0x26a8('0x8d')](_0x412003[_0x26a8('0x8e')])?util['format'](_0x26a8('0x186'),_0x412003[_0x26a8('0x8e')]['name'],isNotNull(_0x412003[_0x26a8('0x187')])?_0x412003[_0x26a8('0x187')][_0x26a8('0x188')]()||'':'',_0x412003[_0x26a8('0x189')]>0x0?_0x55b520['phone'][_0x26a8('0x18a')](_0x412003['dialCutDigit']):_0x55b520['phone']):util[_0x26a8('0x7d')](_0x26a8('0x186'),_[_0x26a8('0xf8')](_0x412003['TrunkBackup'])?_0x412003[_0x26a8('0x8e')][_0x26a8('0x47')]:_0x412003[_0x26a8('0x8f')][_0x26a8('0x47')],isNotNull(_0x412003[_0x26a8('0x187')])?_0x412003[_0x26a8('0x187')][_0x26a8('0x188')]()||'':'',_0x412003['dialCutDigit']>0x0?_0x55b520[_0x26a8('0x163')][_0x26a8('0x18a')](_0x412003[_0x26a8('0x189')]):_0x55b520[_0x26a8('0x163')]),'callerid':_0xfa0f61,'Exten':_0x26a8('0x111'),'Context':_0x26a8('0x18b'),'Priority':'1','variable':_0x14f6a2,'timeout':(_0x412003[_0x26a8('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x51fd91})[_0x26a8('0x3f')](function(_0x12d5e8){return _0x41c908(_0x12d5e8);})[_0x26a8('0xa3')](function(_0xc09b00){_0x412003[_0x26a8('0x18d')]+=0x1;var _0x33fe2d=new History(_0x174e70[_0x26a8('0xed')][_0x51fd91]);logger[_0x26a8('0x66')](util['format']('[originateError]:\x20%s',JSON['stringify'](_0xc09b00)));_0x33fe2d[_0x26a8('0x6e')]=0xe;_0x33fe2d[_0x26a8('0x6f')]='OriginateError';_0x33fe2d[_0x26a8('0xe0')]=moment()[_0x26a8('0x7d')](_0x26a8('0xc2'));_0x33fe2d[_0x26a8('0x70')]=_0x33fe2d['starttime'];hopperUtils['createHistory'](_0x33fe2d)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x18e')));_0x174e70[_0x26a8('0x132')](_0x33fe2d)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x18e')))[_0x26a8('0x1b')](function(){delete _0x174e70[_0x26a8('0xed')][_0x51fd91];return _0x1cd239(msgResponse('originate',_0x26a8('0x87'),_0x26a8('0x18f')));});});});};Dialer[_0x26a8('0x18')][_0x26a8('0x190')]=function(_0xf4eb25,_0x2959da,_0x4fc4a9){var _0x364816=new History(_0x2959da);if(_0x364816['countbusyretry']+_0x364816['countcongestionretry']+_0x364816[_0x26a8('0x120')]+_0x364816[_0x26a8('0x121')]+_0x364816[_0x26a8('0xd5')]+_0x364816[_0x26a8('0xea')]+_0x364816['countmachineretry']+_0x364816[_0x26a8('0x123')]>=_0x4fc4a9[_0x26a8('0x12e')]-0x1){return!![];}switch(_0xf4eb25){case 0x3:if(_0x364816[_0x26a8('0x120')]>=_0x4fc4a9[_0x26a8('0x191')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x364816['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x4fc4a9[_0x26a8('0x192')],_0x26a8('0x128'))[_0x26a8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x364816[_0x26a8('0xda')],'ListId':_0x364816[_0x26a8('0xdb')],'VoiceQueueId':_0x364816[_0x26a8('0xdc')]||undefined,'CampaignId':_0x364816[_0x26a8('0xdd')]||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x193')));break;case 0x5:if(_0x364816[_0x26a8('0x11e')]>=_0x4fc4a9[_0x26a8('0x194')]-0x1){return!![];}hopperUtils[_0x26a8('0xd7')]({'active':![],'countbusyretry':_0x364816['countbusyretry']+=0x1,'scheduledat':moment()[_0x26a8('0xd8')](_0x4fc4a9[_0x26a8('0x195')],'minutes')[_0x26a8('0x7d')](_0x26a8('0xc2')),'ContactId':_0x364816[_0x26a8('0xda')],'ListId':_0x364816['ListId'],'VoiceQueueId':_0x364816[_0x26a8('0xdc')]||undefined,'CampaignId':_0x364816['CampaignId']||undefined})[_0x26a8('0xa3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x364816[_0x26a8('0x11f')]>=_0x4fc4a9[_0x26a8('0x196')]-0x1){return!![];}hopperUtils[_0x26a8('0xd7')]({'active':![],'countcongestionretry':_0x364816['countcongestionretry']+=0x1,'scheduledat':moment()[_0x26a8('0xd8')](_0x4fc4a9[_0x26a8('0x197')],'minutes')[_0x26a8('0x7d')](_0x26a8('0xc2')),'ContactId':_0x364816[_0x26a8('0xda')],'ListId':_0x364816[_0x26a8('0xdb')],'VoiceQueueId':_0x364816[_0x26a8('0xdc')]||undefined,'CampaignId':_0x364816['CampaignId']||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x198')));break;case 0x0:if(_0x364816[_0x26a8('0x121')]>=_0x4fc4a9[_0x26a8('0x199')]-0x1){return!![];}else{hopperUtils[_0x26a8('0xd7')]({'active':![],'countnosuchnumberretry':_0x364816['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x26a8('0xd8')](_0x4fc4a9[_0x26a8('0x19a')],_0x26a8('0x128'))[_0x26a8('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x364816['ContactId'],'ListId':_0x364816[_0x26a8('0xdb')],'VoiceQueueId':_0x364816[_0x26a8('0xdc')]||undefined,'CampaignId':_0x364816[_0x26a8('0xdd')]||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x19b')));}break;case 0xa:if(_0x364816[_0x26a8('0xd5')]>=_0x4fc4a9[_0x26a8('0x19c')]-0x1){return!![];}hopperUtils[_0x26a8('0xd7')]({'active':![],'countdropretry':_0x364816['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x4fc4a9['dialDropRetryFrequency'],_0x26a8('0x128'))['format'](_0x26a8('0xc2')),'ContactId':_0x364816[_0x26a8('0xda')],'ListId':_0x364816[_0x26a8('0xdb')],'VoiceQueueId':_0x364816['VoiceQueueId']||undefined,'CampaignId':_0x364816[_0x26a8('0xdd')]||undefined})['catch'](loggerCatch(_0x26a8('0xde')));break;case 0xb:if(_0x364816[_0x26a8('0xea')]>=_0x4fc4a9[_0x26a8('0xe9')]-0x1){return!![];}hopperUtils[_0x26a8('0xd7')]({'active':![],'countabandonedretry':_0x364816[_0x26a8('0xea')]+=0x1,'scheduledat':moment()[_0x26a8('0xd8')](_0x4fc4a9[_0x26a8('0xe8')],_0x26a8('0x128'))[_0x26a8('0x7d')](_0x26a8('0xc2')),'ContactId':_0x364816['ContactId'],'ListId':_0x364816[_0x26a8('0xdb')],'VoiceQueueId':_0x364816['VoiceQueueId']||undefined,'CampaignId':_0x364816[_0x26a8('0xdd')]||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0xeb')));break;case 0x13:if(_0x364816[_0x26a8('0x122')]>=_0x4fc4a9[_0x26a8('0x12f')]-0x1){return!![];}hopperUtils[_0x26a8('0xd7')]({'active':![],'countmachineretry':_0x364816[_0x26a8('0x122')]+=0x1,'scheduledat':moment()[_0x26a8('0xd8')](_0x4fc4a9[_0x26a8('0x127')],'minutes')['format'](_0x26a8('0xc2')),'ContactId':_0x364816['ContactId'],'ListId':_0x364816['ListId'],'VoiceQueueId':_0x364816[_0x26a8('0xdc')]||undefined,'CampaignId':_0x364816[_0x26a8('0xdd')]||undefined})['catch'](loggerCatch(_0x26a8('0x129')));break;case 0x14:if(_0x364816['countagentrejectretry']>=_0x4fc4a9[_0x26a8('0x19d')]-0x1){return!![];}hopperUtils[_0x26a8('0xd7')]({'active':![],'countagentrejectretry':_0x364816[_0x26a8('0x123')]+=0x1,'scheduledat':moment()[_0x26a8('0xd8')](_0x4fc4a9[_0x26a8('0x19e')],_0x26a8('0x128'))[_0x26a8('0x7d')](_0x26a8('0xc2')),'ContactId':_0x364816[_0x26a8('0xda')],'ListId':_0x364816[_0x26a8('0xdb')],'VoiceQueueId':_0x364816[_0x26a8('0xdc')]||undefined,'CampaignId':_0x364816[_0x26a8('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x26a8('0x18')][_0x26a8('0x19f')]=function(_0x143b90,_0x35f88c,_0x27bf38){var _0x3a83d2=this;var _0x3b37ee=new History(_0x143b90);var _0x91f86d=![];var _0xfb768a;var _0x2592c8;return new Promise(function(_0x1d2a2b,_0x38fbd9){if(_[_0x26a8('0x41')](_0x35f88c)&&typeof _0x35f88c!==_0x26a8('0x161')){return _0x38fbd9(msgResponse(_0x26a8('0x1a0'),_0x26a8('0xa9'),_0x26a8('0x1a1')));}if(_[_0x26a8('0x41')](_0x27bf38)&&typeof _0x27bf38!=='object'){return _0x38fbd9(msgResponse(_0x26a8('0x1a0'),_0x26a8('0xa9'),_0x26a8('0x1a2')));}hopperUtils['verifyAdditionalPhones'](_0x3b37ee,_0x27bf38[_0x26a8('0x1a3')],_0x35f88c)['then'](function(_0x504e3d){if(_0x504e3d[_0x26a8('0xd4')]==0x1)_0x91f86d=!![];switch(_0x27bf38[_0x26a8('0x1a3')]){case'0':_0x35f88c[_0x26a8('0x1a4')]+=0x1;_0x3b37ee[_0x26a8('0x6e')]=0x0;_0x3b37ee[_0x26a8('0x6f')]=_0x26a8('0x1a5');_0x3b37ee['countnosuchnumberretry']+=0x1;_0x3b37ee[_0x26a8('0xd0')]+=0x1;ami['emit'](_0x26a8('0x1a6'),ut[_0x26a8('0x117')](_0x143b90,_0x26a8('0x1a7')));_0xfb768a=_0x35f88c['dialNoSuchNumberRetryFrequency'];_0x2592c8=_0x35f88c['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3b37ee)['catch'](loggerCatch(_0x26a8('0x11d')));if(_0x3a83d2[_0x26a8('0x190')](0x0,_0x143b90,_0x35f88c)&&!_0x91f86d){if(_0x3b37ee['countnosuchnumberretry']>=_0x35f88c[_0x26a8('0x199')]){_0x3a83d2[_0x26a8('0x126')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,'reason\x200\x20no\x20such\x20number....');}else{_0x3a83d2[_0x26a8('0x124')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1a8'));}}break;case'3':_0x35f88c[_0x26a8('0x1a9')]+=0x1;_0x3b37ee['state']=0x3;_0x3b37ee[_0x26a8('0x6f')]=_0x26a8('0x1aa');_0x3b37ee[_0x26a8('0x120')]+=0x1;_0x3b37ee[_0x26a8('0xd0')]+=0x1;var _0x405c0e=ut['buildNoAnswerEventPayload'](_0x143b90,_0x35f88c);ami[_0x26a8('0x42')](_0x26a8('0x1ab'),_0x405c0e);_0xfb768a=_0x35f88c[_0x26a8('0x192')];_0x2592c8=_0x35f88c[_0x26a8('0xd1')];hopperUtils[_0x26a8('0xc9')](_0x3b37ee)['catch'](loggerCatch(_0x26a8('0x1ac')));if(_0x3a83d2[_0x26a8('0x190')](0x3,_0x143b90,_0x35f88c)&&!_0x91f86d){if(_0x3b37ee[_0x26a8('0x120')]>=_0x35f88c['dialNoAnswerMaxRetry']){_0x3a83d2[_0x26a8('0x126')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3a83d2['stateGlobal'](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1ad'));}}break;case'5':_0x35f88c['outboundBusyCallsDay']+=0x1;_0x3b37ee['state']=0x5;_0x3b37ee['statedesc']=_0x26a8('0x1ae');_0x3b37ee['countbusyretry']+=0x1;_0x3b37ee[_0x26a8('0xd0')]+=0x1;ami[_0x26a8('0x42')]('custom:agentbusy',ut[_0x26a8('0x117')](_0x143b90,_0x26a8('0x1af')));_0xfb768a=_0x35f88c['dialBusyRetryFrequency'];_0x2592c8=_0x35f88c[_0x26a8('0xd1')];hopperUtils[_0x26a8('0xc9')](_0x3b37ee)[_0x26a8('0xa3')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x3a83d2[_0x26a8('0x190')](0x5,_0x143b90,_0x35f88c)&&!_0x91f86d){if(_0x3b37ee['countbusyretry']>=_0x35f88c[_0x26a8('0x194')]){_0x3a83d2[_0x26a8('0x126')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1b0'));}else{_0x3a83d2[_0x26a8('0x124')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1b0'));}}break;case'8':_0x35f88c[_0x26a8('0x1b1')]+=0x1;_0x3b37ee['state']=0x8;_0x3b37ee['statedesc']=_0x26a8('0x1b2');_0x3b37ee['countcongestionretry']+=0x1;_0x3b37ee[_0x26a8('0xd0')]+=0x1;_0xfb768a=_0x35f88c[_0x26a8('0x197')];_0x2592c8=_0x35f88c[_0x26a8('0xd1')];ami['emit']('custom:agentcongestion',ut[_0x26a8('0x117')](_0x143b90,_0x26a8('0x1b3')));hopperUtils['createHistory'](_0x3b37ee)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x1b4')));if(_0x3a83d2[_0x26a8('0x190')](0x8,_0x143b90,_0x35f88c)&&!_0x91f86d){if(_0x3b37ee[_0x26a8('0x11f')]>=_0x35f88c['dialCongestionMaxRetry']){_0x3a83d2[_0x26a8('0x126')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1b5'));}else{_0x3a83d2[_0x26a8('0x124')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1b5'));}}break;case'11':_0x35f88c[_0x26a8('0x1b6')]+=0x1;_0x3b37ee[_0x26a8('0x6e')]=0xb;_0x3b37ee[_0x26a8('0x6f')]=_0x26a8('0xe5');_0x3b37ee['countabandonedretry']+=0x1;_0x3b37ee[_0x26a8('0xd0')]+=0x1;_0xfb768a=_0x35f88c[_0x26a8('0xe8')];_0x2592c8=_0x35f88c[_0x26a8('0xd1')];hopperUtils[_0x26a8('0xc9')](_0x3b37ee)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0xec')));if(_0x3a83d2[_0x26a8('0x190')](0xb,_0x143b90,_0x35f88c)&&!_0x91f86d){if(_0x3b37ee[_0x26a8('0xea')]>=_0x35f88c[_0x26a8('0xe9')]){_0x3a83d2[_0x26a8('0x126')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1b7'));}else{_0x3a83d2['stateGlobal'](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1b7'));}}break;case'20':_0x35f88c[_0x26a8('0x1b8')]+=0x1;_0x3b37ee[_0x26a8('0x6e')]=0x14;_0x3b37ee[_0x26a8('0x6f')]=_0x26a8('0x1b9');_0x3b37ee[_0x26a8('0x123')]+=0x1;_0x3b37ee[_0x26a8('0xd0')]+=0x1;_0xfb768a=_0x35f88c['dialAgentRejectRetryFrequency'];_0x2592c8=_0x35f88c[_0x26a8('0xd1')];ami['emit'](_0x26a8('0x1ba'),ut['buildObj'](_0x143b90,_0x26a8('0x1bb')));hopperUtils[_0x26a8('0xc9')](_0x3b37ee)['catch'](loggerCatch(_0x26a8('0x1bc')));if(_0x3a83d2['checkRetriveMax'](0x14,_0x143b90,_0x35f88c)&&!_0x91f86d){if(_0x3b37ee['countagentrejectretry']>=_0x35f88c[_0x26a8('0x19d')]){_0x3a83d2[_0x26a8('0x126')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x26a8('0x1bd'));}else{_0x3a83d2[_0x26a8('0x124')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,'reason\x2020\x20agentreject');}}break;default:_0x35f88c['outboundUnknownCallsDay']+=0x1;_0x3b37ee[_0x26a8('0x6e')]=0xc;_0x3b37ee['statedesc']=_0x27bf38[_0x26a8('0x1a3')];_0xfb768a=_0x35f88c[_0x26a8('0x19e')];_0x2592c8=_0x35f88c[_0x26a8('0xd1')];hopperUtils[_0x26a8('0xc9')](_0x3b37ee)[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x1be')));if(_0x3a83d2[_0x26a8('0x190')](_0x27bf38[_0x26a8('0x1a3')],_0x143b90,_0x35f88c)&&!_0x91f86d){if(_0x3b37ee[_0x26a8('0x11e')]+_0x3b37ee[_0x26a8('0x11f')]+_0x3b37ee[_0x26a8('0x120')]+_0x3b37ee[_0x26a8('0x121')]+_0x3b37ee[_0x26a8('0xd5')]+_0x3b37ee[_0x26a8('0xea')]+_0x3b37ee['countmachineretry']+_0x3b37ee['countagentrejectretry']>=_0x35f88c['dialGlobalMaxRetry']){_0x3a83d2[_0x26a8('0x124')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x27bf38['reason']);}else{_0x3a83d2[_0x26a8('0x126')](_0x3b37ee,_0x1d2a2b,_0x38fbd9,_0x27bf38[_0x26a8('0x1a3')]);}}}})[_0x26a8('0x3f')](function(){if(_0x91f86d){hopperUtils[_0x26a8('0xe3')](_0x3b37ee,_0xfb768a,_0x2592c8)['then'](function(){return _0x1d2a2b(0x1);});}});});};Dialer[_0x26a8('0x18')][_0x26a8('0x124')]=function(_0x5c08b9,_0x26eec7,_0x33d1c5,_0xd27d){var _0x16618a=new Final(_0x5c08b9);_0x16618a['state']=0xf;_0x16618a[_0x26a8('0x6f')]=_0x26a8('0x1bf');this[_0x26a8('0x126')](_0x16618a,_0x26eec7,_0x33d1c5,_0xd27d);};Dialer[_0x26a8('0x18')]['createStateFinal']=function(_0x3dfc77,_0x37e639,_0x140987,_0x6e8518){hopperUtils[_0x26a8('0x132')](_0x3dfc77)[_0x26a8('0x3f')](function(){return _0x37e639(msgResponse('[callProgressDetecting]',_0x26a8('0x10d'),_0x6e8518));})[_0x26a8('0xa3')](function(){return _0x140987(msgResponse(_0x26a8('0x1c0'),_0x26a8('0xa9'),_0x26a8('0x1c1')));});};Dialer[_0x26a8('0x18')][_0x26a8('0x8')]=function(_0x544c1d){var _0x2c7e96=_0x544c1d['dialPredictiveOptimizationPercentage']/0x64;var _0x5ae00c=_0x544c1d[_0x26a8('0x1c2')]/(_0x544c1d['outboundDropCallsDayTimeout']+_0x544c1d['outboundAnswerCallsDay']);var _0x44a90e=Math[_0x26a8('0x1c3')](_0x544c1d['predictiveIntervalAvailable']*(_0x544c1d[_0x26a8('0x1c4')]/0x64));var _0x3386ef=Math[_0x26a8('0x1c3')](_0x544c1d['predictiveIntervalAvailable']*(_0x544c1d[_0x26a8('0x1c5')]/0x64));var _0x231451=_0x544c1d[_0x26a8('0x13d')]+_0x544c1d['talking'];var _0x22d05a=Math[_0x26a8('0x1c6')](_0x544c1d[_0x26a8('0x5a')]*_0x544c1d[_0x26a8('0x5e')]*_0x544c1d['predictiveIntervalHitRate']*_0x544c1d[_0x26a8('0x1c7')]);if(_['isUndefined'](_0x544c1d[_0x26a8('0x26')])){if(!_[_0x26a8('0x41')](_0x544c1d[_0x26a8('0x25')])){_0x544c1d[_0x26a8('0x25')]=undefined;loggerPredictive[_0x26a8('0x66')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x26a8('0x41')](_0x544c1d['handlePredictive'])){loggerPredictive[_0x26a8('0x66')](_0x26a8('0x1c8'),_0x26a8('0x1c9'));clearInterval(_0x544c1d['handlePredictive']);_0x544c1d[_0x26a8('0x65')]=undefined;}_0x544c1d['startProgressive']=moment()[_0x26a8('0x7d')](_0x26a8('0xc2'));loggerPredictive[_0x26a8('0x4a')](_0x544c1d['name'],_0x26a8('0x1ca'),_0x544c1d['startProgressive']);this[_0x26a8('0xb6')](_0x544c1d,0x1);}else if(ifInterval(_0x544c1d['dialPredictiveInterval'],_0x544c1d['startProgressive'])){this['handlePower'](_0x544c1d,0x1);loggerPredictiveCalls['info'](_0x26a8('0x1cb'),_0x544c1d['startProgressive'],_0x544c1d[_0x26a8('0x47')]);_0x544c1d[_0x26a8('0x5a')]=0x0;_0x544c1d['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2c7e96<_0x5ae00c&&_0x544c1d[_0x26a8('0x1cc')]===_0x26a8('0x1cd')){clearPredictiveAttributes(_0x544c1d);loggerPredictive[_0x26a8('0x4a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x26a8('0x1ce'),_0x5ae00c,_0x26a8('0x26'),_0x544c1d[_0x26a8('0x47')]);}else if(_0x22d05a<_0x544c1d[_0x26a8('0xce')]&&_0x544c1d[_0x26a8('0x1cc')]==='dropRate'){clearPredictiveAttributes(_0x544c1d);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x1cf'),_0x26a8('0x1d0'),_0x22d05a,_0x26a8('0x1d1'),_0x544c1d[_0x26a8('0xce')],_0x26a8('0x26'),_0x544c1d['name']);}else if(!ifInterval(_0x544c1d[_0x26a8('0x1d2')],_0x544c1d[_0x26a8('0x26')])&&_[_0x26a8('0x41')](_0x544c1d[_0x26a8('0x25')])&&!_['isUndefined'](_0x544c1d[_0x26a8('0x26')])){_0x544c1d[_0x26a8('0x25')]=moment()['format'](_0x26a8('0xc2'));loggerPredictive[_0x26a8('0x4a')](_0x544c1d[_0x26a8('0x47')],_0x26a8('0x1d3'),_0x544c1d['startPredictive']);hopperUtils[_0x26a8('0x1d4')](_0x544c1d[_0x26a8('0x1d2')])['then'](this[_0x26a8('0x1d5')](_0x544c1d))[_0x26a8('0x3f')](mergeDataErlangB(_0x544c1d))[_0x26a8('0x3f')](this[_0x26a8('0x1d6')](_0x544c1d))[_0x26a8('0xa3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x544c1d));}else if(!ifInterval(_0x544c1d[_0x26a8('0x1d2')],_0x544c1d[_0x26a8('0x25')])){_0x544c1d[_0x26a8('0xce')]=0x0;_0x544c1d[_0x26a8('0x25')]=moment()['format'](_0x26a8('0xc2'));loggerPredictive[_0x26a8('0x4a')](_0x544c1d[_0x26a8('0x47')],_0x26a8('0x1d7'),_0x544c1d[_0x26a8('0x25')]);clearInterval(_0x544c1d[_0x26a8('0x65')]);_0x544c1d[_0x26a8('0x65')]=undefined;hopperUtils['avgHandleTime'](_0x544c1d[_0x26a8('0x1d2')])[_0x26a8('0x3f')](this[_0x26a8('0x1d5')](_0x544c1d))['then'](mergeDataErlangB(_0x544c1d))[_0x26a8('0x3f')](this['startMethodPredictive'](_0x544c1d))[_0x26a8('0xa3')](loggerCatchPredictive(_0x26a8('0x1d8'),_0x544c1d));}else if(_0x544c1d['predictiveIntervalAvailable']&&_0x231451<_0x544c1d['predictiveIntervalAvailable']-_0x3386ef){clearPredictiveAttributes(_0x544c1d);loggerPredictive[_0x26a8('0x4a')](_0x544c1d[_0x26a8('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x231451,_0x26a8('0x1d9'),_0x544c1d[_0x26a8('0x1da')],'-',_0x3386ef,'=',_0x544c1d[_0x26a8('0x1da')]-_0x3386ef,')');}else if(_0x544c1d[_0x26a8('0x1da')]&&_0x231451>_0x544c1d[_0x26a8('0x1da')]+_0x44a90e){clearPredictiveAttributes(_0x544c1d);loggerPredictive[_0x26a8('0x4a')](_0x544c1d[_0x26a8('0x47')],_0x26a8('0x1db'),_0x231451,_0x26a8('0x1dc'),_0x544c1d[_0x26a8('0x1da')],'+',_0x44a90e,'=',_0x544c1d[_0x26a8('0x1da')]+_0x44a90e,')');}};Dialer['prototype']['getDataPredictive']=function(_0x4a844a){var _0x1febe4=this;return function(_0xf6ecff){return new Promise(function(_0x5c0f08,_0xe89b2b){_[_0x26a8('0xfa')](_0x4a844a,_0xf6ecff[0x0]);if(checkGetDataPredictive(_0xf6ecff[0x0])){var _0x5eccc2=_0x4a844a[_0x26a8('0x1da')]=_0x4a844a[_0x26a8('0x1dd')]+_0x4a844a[_0x26a8('0x13d')];var _0x45e352=_0x4a844a[_0x26a8('0x1d2')]*0x3c;var _0x4fdbe4=_0xf6ecff[0x0][_0x26a8('0x54')]+_0xf6ecff[0x0]['predictiveIntervalAvgHoldtime'];var _0x4d34bd=(_0xf6ecff[0x0][_0x26a8('0x4d')]+_0xf6ecff[0x0][_0x26a8('0xcd')]+_0xf6ecff[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf6ecff[0x0][_0x26a8('0x4b')];_0x4a844a['predictiveIntervalHitRate']=_0x4d34bd>0x0?_0x4d34bd:0x1;switch(_0x4a844a[_0x26a8('0x1cc')]){case _0x26a8('0x1cd'):var _0x1300f2=_0x4a844a['dialPredictiveOptimizationPercentage']/0x64;return _0x1febe4[_0x26a8('0x1de')](_0x5eccc2,_0x45e352,_0x4fdbe4,_0x4d34bd,_0x1300f2)[_0x26a8('0x3f')](function(_0x3ee098){return _0x5c0f08(_0x3ee098);});case _0x26a8('0x1df'):var _0x48503b=_0x4a844a[_0x26a8('0x1e0')]/0x64;return _0x1febe4[_0x26a8('0x1e1')](_0x5eccc2,_0x45e352,_0x4fdbe4,_0x4d34bd,_0x48503b)[_0x26a8('0x3f')](function(_0x2f7eb9){return _0x5c0f08(_0x2f7eb9);});default:return _0xe89b2b(msgResponse('[getDataPredictive]','Failure',_0x26a8('0x1e2')));}}else{return _0xe89b2b(msgResponse(_0x26a8('0x1e3'),_0x26a8('0xa9'),'check\x20failure'));}});};};Dialer[_0x26a8('0x18')]['getDataPredictiveOld']=function(_0x4e1e68){var _0x14ea3c=this;return function(_0x1ec30f){return new Promise(function(_0x446a62,_0x29fdc7){_[_0x26a8('0xfa')](_0x4e1e68,_0x1ec30f[0x0]);if(checkGetDataPredictive(_0x1ec30f[0x0])){loggerPredictive[_0x26a8('0x4a')](JSON[_0x26a8('0x74')](_0x1ec30f[0x0]));if(_0x4e1e68[_0x26a8('0x1cc')]===_0x26a8('0x1cd')){return _0x14ea3c[_0x26a8('0x155')](_0x4e1e68['id'])['then'](function(_0x517997){var _0x1426e1=_0x4e1e68['loggedIn']-_0x517997[0x0][_0x26a8('0x1e4')];var _0x52a194=_0x4e1e68['dialPredictiveInterval']*0x3c;var _0x4b2630=_0x1ec30f[0x0][_0x26a8('0x54')]+_0x1ec30f[0x0][_0x26a8('0x52')];var _0x1bce60=(_0x1ec30f[0x0][_0x26a8('0x4d')]+_0x1ec30f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1ec30f[0x0][_0x26a8('0x50')])/_0x1ec30f[0x0][_0x26a8('0x4b')];var _0x2ebd78=_0x4e1e68[_0x26a8('0x1e0')]/0x64;_0x4e1e68[_0x26a8('0x1e5')]=_0x517997[0x0][_0x26a8('0x1e4')]||0x0;_0x4e1e68[_0x26a8('0x1e6')]=_0x1bce60>0x0?_0x1bce60:0x1;return _0x14ea3c[_0x26a8('0x1de')](_0x1426e1,_0x52a194,_0x4b2630,_0x1bce60,_0x2ebd78);})[_0x26a8('0x3f')](function(_0x125966){return _0x446a62(_0x125966);})['catch'](function(_0x183d29){return _0x29fdc7(msgResponse(_0x26a8('0x1e7'),_0x26a8('0xa9'),JSON[_0x26a8('0x74')](_0x183d29)));});}if(_0x4e1e68['dialPredictiveOptimization']===_0x26a8('0x1df')){return _0x14ea3c[_0x26a8('0x155')](_0x4e1e68['id'])['then'](function(_0x10f230){var _0x115230=_0x4e1e68[_0x26a8('0x1e8')]-_0x10f230[0x0][_0x26a8('0x1e4')];var _0x4a6f3f=_0x4e1e68[_0x26a8('0x1d2')]*0x3c;var _0x5d0de9=_0x1ec30f[0x0]['predictiveIntervalAvgTalktime']+_0x1ec30f[0x0][_0x26a8('0x52')];var _0x325287=(_0x1ec30f[0x0][_0x26a8('0x4d')]+_0x1ec30f[0x0][_0x26a8('0xcd')]+_0x1ec30f[0x0][_0x26a8('0x50')])/_0x1ec30f[0x0][_0x26a8('0x4b')];var _0x117528=_0x4e1e68['dialPredictiveOptimizationPercentage']/0x64;_0x4e1e68[_0x26a8('0x1e5')]=_0x10f230[0x0][_0x26a8('0x1e4')]||0x0;_0x4e1e68['predictiveIntervalHitRate']=_0x325287>0x0?_0x325287:0x1;return _0x14ea3c[_0x26a8('0x1e1')](_0x115230,_0x4a6f3f,_0x5d0de9,_0x325287,_0x117528);})['then'](function(_0x24d421){return _0x446a62(_0x24d421);})[_0x26a8('0xa3')](function(_0x4b929a){return _0x29fdc7(msgResponse(_0x26a8('0x1e7'),_0x26a8('0xa9'),JSON[_0x26a8('0x74')](_0x4b929a)));});}}else{return _0x29fdc7(msgResponse(_0x26a8('0x1e3'),_0x26a8('0xa9'),_0x26a8('0x1e9')));}});};};Dialer[_0x26a8('0x18')][_0x26a8('0x1d6')]=function(_0x45a96c){var _0x39352e=this;return function(){var _0x2a297b=0x0;var _0x57667f=Math['floor'](_0x45a96c['erlangCallToSecond']*0x3e8);if(_0x57667f>0x0){_0x57667f=_0x57667f<0x64?0x64:_0x57667f;loggerPredictive[_0x26a8('0x4a')](_0x45a96c[_0x26a8('0x47')],_0x26a8('0x1ea'),_0x57667f,_0x26a8('0x1eb'));_0x45a96c[_0x26a8('0x65')]=setInterval(function(){_0x39352e[_0x26a8('0x65')](_0x45a96c);loggerPredictiveCalls['info']('[handlePredictive]',_0x2a297b+=0x1);},_0x57667f);}else{loggerPredictive['info'](_0x45a96c[_0x26a8('0x47')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x26a8('0x18')][_0x26a8('0x1ec')]=function(_0x277525,_0x4a7bd1){var _0x2a8223=this;return function(_0x13a274){if(_[_0x26a8('0x49')](_0x13a274)){if(_[_0x26a8('0xf8')](_0x4a7bd1['UserId'])||!_0x4a7bd1[_0x26a8('0x1ed')]){if(_0x277525[_0x26a8('0xb3')]===_0x26a8('0x7')){_0x277525[_0x26a8('0x72')]=_[_0x26a8('0x41')](_0x277525[_0x26a8('0x72')])?!![]:_0x277525[_0x26a8('0x72')];var _0x723718=uuid['v4']();_0x2a8223[_0x26a8('0xed')][_0x723718]=new Action(_0x277525,_0x4a7bd1,_0x723718);loggerBooked[_0x26a8('0x4a')](_0x26a8('0x1ee'),_0x723718,_0x26a8('0x1ef'),JSON[_0x26a8('0x74')](_0x277525['queueStatusComplete']),_0x26a8('0x1f0'),_0x277525[_0x26a8('0x47')]);if(_0x277525[_0x26a8('0x72')]){_0x277525['queueStatusComplete']=![];_0x2a8223[_0x26a8('0xf9')][_0x2a8223[_0x26a8('0xed')][_0x723718][_0x26a8('0xc1')]]=[];ami[_0x26a8('0x9d')]({'actionid':_0x723718,'action':_0x26a8('0x1f1'),'queue':_0x277525[_0x26a8('0x47')]})[_0x26a8('0xa3')](function(){_0x2a8223[_0x26a8('0xc0')](_0x277525);hopperUtils[_0x26a8('0xd7')]({'active':![],'ContactId':_0x2a8223['actions'][_0x723718][_0x26a8('0xda')],'ListId':_0x2a8223[_0x26a8('0xed')][_0x723718][_0x26a8('0xdb')],'VoiceQueueId':_0x2a8223[_0x26a8('0xed')][_0x723718][_0x26a8('0xdc')]||undefined,'CampaignId':_0x2a8223['actions'][_0x723718][_0x26a8('0xdd')]||undefined})[_0x26a8('0xa3')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2a8223[_0x26a8('0xed')][_0x723718];});}else{loggerBooked['info'](_0x26a8('0x1f2'),JSON['stringify'](_0x277525[_0x26a8('0x72')]),_0x26a8('0x1f0'),_0x277525['name']);_0x2a8223['updateOriginated'](_0x277525);hopperUtils[_0x26a8('0xd7')]({'active':![],'ContactId':_0x2a8223[_0x26a8('0xed')][_0x723718][_0x26a8('0xda')],'ListId':_0x2a8223['actions'][_0x723718][_0x26a8('0xdb')],'VoiceQueueId':_0x2a8223[_0x26a8('0xed')][_0x723718][_0x26a8('0xdc')]||undefined,'CampaignId':_0x2a8223['actions'][_0x723718]['CampaignId']||undefined})[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x1f3')));delete _0x2a8223[_0x26a8('0xed')][_0x723718];}}else{return _0x2a8223[_0x26a8('0x160')](_0x277525,_0x4a7bd1);}}else{if(utils[_0x26a8('0x62')](undefined,_0x4a7bd1['scheduledat'])<_0x277525[_0x26a8('0x1f4')]*0x3c){if(_0x4a7bd1['Agent']&&!_0x4a7bd1[_0x26a8('0x14d')][_0x26a8('0x1f5')]){_0x2a8223[_0x26a8('0x1d')][_0x26a8('0xfc')](_0x4a7bd1['id'])[_0x26a8('0x1b')](function(){_0x2a8223[_0x26a8('0xc0')](_0x277525);});}else{hopperUtils[_0x26a8('0x1f6')]({'active':![]},_0x4a7bd1['id'],0x1)[_0x26a8('0x1b')](function(){_0x2a8223[_0x26a8('0xc0')](_0x277525);});}}else{_0x277525[_0x26a8('0x1f7')]+=0x1;_0x2a8223[_0x26a8('0xc0')](_0x277525);if(_0x277525[_0x26a8('0x1f8')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a7bd1[_0x26a8('0xda')],'ListId':_0x4a7bd1[_0x26a8('0xdb')],'VoiceQueueId':_0x4a7bd1[_0x26a8('0xdc')]||undefined,'CampaignId':_0x4a7bd1[_0x26a8('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x26a8('0xc9')](createObjHistory(_0x277525,_0x4a7bd1,utils['CAMPAIGN_STATUS'][_0x26a8('0x1f9')],0x17,_0x26a8('0x1fa')))[_0x26a8('0xa3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2a8223[_0x26a8('0x12c')](createObjHistory(_0x277525,_0x4a7bd1,utils[_0x26a8('0x6a')][_0x26a8('0x1fb')],0x16,_0x26a8('0x1fc')),_0x26a8('0x1fd'),_0x26a8('0x1fe'));}}}}else{_0x277525['outboundBlacklistCallsDay']+=0x1;_0x2a8223[_0x26a8('0x12c')](createObjHistory(_0x277525,_0x4a7bd1,utils[_0x26a8('0x6a')]['BLACKLIST'],0xd,_0x26a8('0x1ff')),_0x26a8('0x200'),_0x26a8('0x201'));throw'inBlackList';}};};Dialer[_0x26a8('0x18')][_0x26a8('0x202')]=function(_0x2e64b1){var _0x35616a=this;var _0x16d8f1=_0x2e64b1['limitCalls']-_0x2e64b1['originated'];emitCampaignSummary(_0x2e64b1);if(_0x16d8f1>0x0&&_0x2e64b1[_0x26a8('0x68')]==0x0){if(_0x16d8f1>this['maxNumberOriginate']){_0x16d8f1=this['maxNumberOriginate'];}_0x2e64b1[_0x26a8('0x68')]=0x1;hopperUtils[_0x26a8('0x203')](_0x2e64b1,_0x16d8f1)[_0x26a8('0x3f')](function(_0x2ff675){_0x2e64b1[_0x26a8('0x68')]=0x0;if(_0x2ff675){if(!utils[_0x26a8('0x204')](_0x2ff675)){_0x2e64b1[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x6d')];logger[_0x26a8('0x4a')](_0x26a8('0x205')+_0x2e64b1[_0x26a8('0x47')]);}else{_0x2e64b1[_0x26a8('0x80')]+=_0x2ff675[_0x26a8('0x9b')];_0x2e64b1[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')]['RUNNING'];for(var _0x866100=0x0;_0x866100<_0x2ff675['length'];_0x866100+=0x1){_0x2e64b1['ivrTotalCallsDays']+=0x1;if(_[_0x26a8('0xf8')](_0x2ff675[_0x866100])||_[_0x26a8('0xf8')](_0x2ff675[_0x866100]['Contact'])||_[_0x26a8('0xf8')](_0x2ff675[_0x866100][_0x26a8('0x163')])){_0x35616a['emptyContact'](_0x26a8('0x206'),_0x2e64b1,_0x2ff675[_0x866100]);}else{hopperUtils[_0x26a8('0x207')](_['pick'](_0x2ff675[_0x866100],[_0x26a8('0xdd'),_0x26a8('0x163')]))['then'](_0x35616a[_0x26a8('0x1ec')](_0x2e64b1,_0x2ff675[_0x866100]))[_0x26a8('0xa3')](_0x35616a[_0x26a8('0x158')]('[actionOriginateIvr]\x20',_0x2e64b1));}}}}})[_0x26a8('0xa3')](loggerGetContactDialer(_0x26a8('0x208'),_0x2e64b1,_0x16d8f1));}};Dialer[_0x26a8('0x18')][_0x26a8('0xb6')]=function(_0x5661ae,_0x44b07e){var _0x42bc10=this;var _0x13116b=[];if(_0x44b07e<0x1||_0x5661ae['dialMethod']===_0x26a8('0x7')){_0x44b07e=0x1;}var _0x104889=Math[_0x26a8('0x1c6')](_0x5661ae['available']*_0x44b07e)-_0x5661ae[_0x26a8('0x80')];if(_0x5661ae['dialLimitQueue']>0x0){var _0x57c85c=_0x5661ae[_0x26a8('0x209')]-_0x5661ae[_0x26a8('0x80')]-_0x5661ae[_0x26a8('0x1dd')]-_0x5661ae['pTalking'];if(_0x104889>_0x57c85c){_0x104889=_0x57c85c;}}if(_0x104889>0x0&&_0x5661ae[_0x26a8('0x68')]==0x0){if(_0x5661ae[_0x26a8('0xb3')]===_0x26a8('0x7')){_0x104889=0x1;}if(_0x104889>this[_0x26a8('0x21')]){_0x104889=this[_0x26a8('0x21')];}for(var _0x25dae3 in this[_0x26a8('0xf6')]){if(typeof this['agents'][_0x25dae3]!=='undefined'){if(this[_0x26a8('0xf6')][_0x25dae3]['state']===_0x26a8('0x20a')&&this['agents'][_0x25dae3][_0x26a8('0x89')]==='reachable'){_0x13116b[_0x26a8('0x9c')](this['agents'][_0x25dae3]['id']);}}}_0x5661ae[_0x26a8('0x68')]=0x1;hopperUtils['getContactDialer'](_0x5661ae,_0x13116b,_0x104889)[_0x26a8('0x3f')](function(_0x2fa3f7){_0x5661ae[_0x26a8('0x68')]=0x0;if(_0x2fa3f7){if(!utils[_0x26a8('0x204')](_0x2fa3f7)){hopperUtils[_0x26a8('0x20b')](_0x5661ae)['then'](sendMessageReschedule(_0x5661ae))[_0x26a8('0xa3')](loggerCatch('[countReScheduled]\x20'));}else{_0x5661ae[_0x26a8('0x80')]+=_0x2fa3f7[_0x26a8('0x9b')];_0x5661ae[_0x26a8('0x6c')]=_0x5661ae[_0x26a8('0xb3')]==='booked'?utils[_0x26a8('0x6a')][_0x26a8('0x20c')]:utils['CAMPAIGN_STATUS'][_0x26a8('0x20d')];for(var _0x54a81c=0x0;_0x54a81c<_0x2fa3f7[_0x26a8('0x9b')];_0x54a81c+=0x1){if(_[_0x26a8('0xf8')](_0x2fa3f7[_0x54a81c])||_[_0x26a8('0xf8')](_0x2fa3f7[_0x54a81c][_0x26a8('0x17b')])||_[_0x26a8('0xf8')](_0x2fa3f7[_0x54a81c][_0x26a8('0x163')])){_0x42bc10[_0x26a8('0x159')]('[actionOriginate]\x20',_0x5661ae,_0x2fa3f7[_0x54a81c]);}else{hopperUtils[_0x26a8('0x20e')](_[_0x26a8('0x75')](_0x2fa3f7[_0x54a81c],[_0x26a8('0xdc'),_0x26a8('0x163')]))[_0x26a8('0x3f')](_0x42bc10[_0x26a8('0x1ec')](_0x5661ae,_0x2fa3f7[_0x54a81c]))[_0x26a8('0xa3')](_0x42bc10[_0x26a8('0x158')]('[actionOriginate]\x20',_0x5661ae));}}}}})[_0x26a8('0xa3')](loggerGetContactDialer('[getContactDialer2]',_0x5661ae,_0x104889));}};Dialer[_0x26a8('0x18')][_0x26a8('0x65')]=function(_0x753d58){if(_0x753d58[_0x26a8('0x209')]>0x0){var _0xaa6db=_0x753d58['dialLimitQueue']-_0x753d58[_0x26a8('0x80')]-_0x753d58['talking'];if(_0xaa6db>0x0&&_0x753d58[_0x26a8('0x68')]==0x0){this['tryOriginatePredictive'](_0x753d58);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x26a8('0x20f')](_0x753d58);}};Dialer[_0x26a8('0x18')][_0x26a8('0x20f')]=function(_0x3e05eb){var _0x18001c=this;var _0x1940e9=[];_0x3e05eb[_0x26a8('0x80')]+=0x1;for(var _0x3db175 in this[_0x26a8('0xf6')]){if(typeof this[_0x26a8('0xf6')][_0x3db175]!==_0x26a8('0xae')){if(this['agents'][_0x3db175][_0x26a8('0x6e')]===_0x26a8('0x20a')&&this[_0x26a8('0xf6')][_0x3db175][_0x26a8('0x89')]==='reachable'){_0x1940e9[_0x26a8('0x9c')](this['agents'][_0x3db175]['id']);}}}_0x3e05eb['temp']=0x1;return this['getContactDialer'](_0x3e05eb['id'],_0x1940e9,0x1,_0x3e05eb[_0x26a8('0x210')],_0x3e05eb)[_0x26a8('0x3f')](function(_0x488cb4){_0x3e05eb[_0x26a8('0x68')]=0x1;if(_0x488cb4){if(!utils[_0x26a8('0x204')](_0x488cb4)){utils[_0x26a8('0x67')](_0x3e05eb,0x1,0x0);return hopperUtils['countReScheduled'](_0x3e05eb)[_0x26a8('0x3f')](sendMessageReschedule(_0x3e05eb))[_0x26a8('0xa3')](loggerCatch(_0x26a8('0x211')));}else{_0x3e05eb[_0x26a8('0x6c')]=utils[_0x26a8('0x6a')][_0x26a8('0x20d')];if(_[_0x26a8('0xf8')](_0x488cb4[0x0])||_['isNil'](_0x488cb4[0x0][_0x26a8('0x17b')])||_[_0x26a8('0xf8')](_0x488cb4[0x0][_0x26a8('0x163')])){_0x18001c[_0x26a8('0x159')](_0x26a8('0x206'),_0x3e05eb,_0x488cb4[0x0]);}else{return hopperUtils[_0x26a8('0x20e')](_[_0x26a8('0x75')](_0x488cb4[0x0],[_0x26a8('0xdc'),_0x26a8('0x163')]))[_0x26a8('0x3f')](_0x18001c[_0x26a8('0x1ec')](_0x3e05eb,_0x488cb4[0x0]))['catch'](_0x18001c['loggerHandler'](_0x26a8('0x212'),_0x3e05eb));}}}})[_0x26a8('0xa3')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3e05eb,0x1));};Dialer[_0x26a8('0x18')][_0x26a8('0x1de')]=function(_0xd0d19f,_0x1dde80,_0x221694,_0x1c55f2,_0x1831e2,_0x514fce){loggerPredictive['info'](_0x26a8('0x213'));loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x214'),_0xd0d19f);loggerPredictive[_0x26a8('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1dde80);loggerPredictive[_0x26a8('0x4a')]('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',_0x221694);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x215'),_0x1c55f2);loggerPredictive[_0x26a8('0x4a')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1831e2);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x61'));return new Promise(function(_0xd42cd2,_0x1dcdca){if(_0xd0d19f<=0x0||isNaN(_0xd0d19f)){return _0x1dcdca(msgResponse(_0x26a8('0x216'),_0x26a8('0x87'),_0x26a8('0x217')+_0xd0d19f));}if(_0x221694<=0x0||isNaN(_0x221694)){return _0x1dcdca(msgResponse(_0x26a8('0x216'),_0x26a8('0x87'),'Ts\x20=\x20'+_0x221694));}if(_0x1c55f2<=0x0||isNaN(_0x1c55f2)){return _0x1dcdca(msgResponse(_0x26a8('0x216'),_0x26a8('0x87'),'p\x20=\x20'+_0x1c55f2));}if(_0x1dde80<=0x0||isNaN(_0x1dde80)){return _0x1dcdca(msgResponse('[abandonmentRate]',_0x26a8('0x87'),_0x26a8('0x218')+_0x1dde80));}if(_0x1831e2<=0x0||isNaN(_0x1831e2)){return _0x1dcdca(msgResponse('[abandonmentRate]',_0x26a8('0x87'),_0x26a8('0x219')+_0x1831e2));}_0x514fce=_0x514fce||0x0;var _0x55f3f2=0x1/_0x221694;var _0xe867df=0x0;var _0x9c1415=0x0;var _0x5a9b1c=0x0;var _0xffaa1b=0x0;for(var _0x334e6a=0x0;_0x5a9b1c<_0x1831e2;_0x334e6a+=0x1){_0x9c1415=_0x334e6a/_0x1dde80;_0xe867df=(_0x1c55f2*_0x9c1415+_0x514fce)/_0x55f3f2;_0x5a9b1c=utils[_0x26a8('0x21a')](_0xe867df,_0xd0d19f);_0xffaa1b=_0xe867df/_0xd0d19f*(0x1-utils[_0x26a8('0x21a')](_0xe867df,_0xd0d19f));}return _0xd42cd2({'erlangCalls':_0x334e6a,'erlangCallToSecond':_0x1dde80/_0x334e6a,'erlangAbandonmentRate':_0x5a9b1c,'erlangBusyFactor':_0xffaa1b});});};Dialer[_0x26a8('0x18')][_0x26a8('0x1e1')]=function(_0x40ab89,_0x13dbfa,_0x51539d,_0x529ca3,_0x5c51fb,_0x3cffe6){loggerPredictive['info'](_0x26a8('0x21b'));loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x214'),_0x40ab89);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x21c'),_0x13dbfa);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x51539d);loggerPredictive['info'](_0x26a8('0x215'),_0x529ca3);loggerPredictive[_0x26a8('0x4a')](_0x26a8('0x21d'),_0x5c51fb);loggerPredictive['info']('---------------------------');return new Promise(function(_0xb22760,_0x138fba){if(_0x40ab89<=0x0||isNaN(_0x40ab89)){return _0x138fba(msgResponse(_0x26a8('0x21e'),_0x26a8('0x87'),_0x26a8('0x217')+_0x40ab89));}if(_0x51539d<=0x0||isNaN(_0x51539d)){return _0x138fba(msgResponse('[busyFactor]',_0x26a8('0x87'),_0x26a8('0x21f')+_0x51539d));}if(_0x529ca3<=0x0||isNaN(_0x529ca3)){return _0x138fba(msgResponse(_0x26a8('0x21e'),_0x26a8('0x87'),'p\x20=\x20'+_0x529ca3));}if(_0x13dbfa<=0x0||isNaN(_0x13dbfa)){return _0x138fba(msgResponse('[busyFactor]','Error',_0x26a8('0x218')+_0x13dbfa));}if(_0x5c51fb<=0x0||isNaN(_0x5c51fb)){return _0x138fba(msgResponse(_0x26a8('0x21e'),_0x26a8('0x87'),_0x26a8('0x220')+_0x5c51fb));}_0x3cffe6=_0x3cffe6||0x0;var _0xd54f8f=0x1/_0x51539d;var _0x3ef045=0x0;var _0x2c90ba=0x0;var _0x2f7732=0x0;var _0x58543c=0x0;for(var _0x2873b6=0x0;_0x58543c<_0x5c51fb;_0x2873b6+=0x1){_0x2c90ba=_0x2873b6/_0x13dbfa;_0x3ef045=(_0x529ca3*_0x2c90ba+_0x3cffe6)/_0xd54f8f;_0x2f7732=utils[_0x26a8('0x21a')](_0x3ef045,_0x40ab89);_0x58543c=_0x3ef045/_0x40ab89*(0x1-utils[_0x26a8('0x21a')](_0x3ef045,_0x40ab89));}return _0xb22760({'erlangCalls':_0x2873b6,'erlangCallToSecond':_0x13dbfa/_0x2873b6,'erlangAbandonmentRate':_0x2f7732,'erlangBusyFactor':_0x58543c});});};module[_0x26a8('0x221')]=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 0eb9215..ae31055 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 _0xf048=['firstName','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact'];(function(_0x5c5c0d,_0x1dbe17){var _0x79db1c=function(_0x4e32de){while(--_0x4e32de){_0x5c5c0d['push'](_0x5c5c0d['shift']());}};_0x79db1c(++_0x1dbe17);}(_0xf048,0x85));var _0x8f04=function(_0x77b607,_0x18e6c8){_0x77b607=_0x77b607-0x0;var _0x136258=_0xf048[_0x77b607];return _0x136258;};'use strict';var util=require(_0x8f04('0x0'));var _=require('lodash');var moment=require(_0x8f04('0x1'));function checkNameSurname(_0x2da5ca,_0x5bc018,_0x319daf){var _0x1e3ce0='';if(!_[_0x8f04('0x2')](_0x5bc018)&&_0x8f04('0x3')===typeof _0x5bc018){_0x1e3ce0+=_0x5bc018;}if(!_[_0x8f04('0x2')](_0x319daf)&&_0x8f04('0x3')===typeof _0x319daf){_0x1e3ce0+='\x20'+_0x319daf;}if(_0x1e3ce0!==''){return _0x1e3ce0;}return _0x2da5ca;}function Action(_0x466ea5,_0x533134,_0x7297f5){this[_0x8f04('0x4')]=_0x466ea5;this[_0x8f04('0x5')]=_0x7297f5||undefined;this[_0x8f04('0x6')]=checkNameSurname(_0x533134['Contact']['phone'],_0x533134[_0x8f04('0x7')][_0x8f04('0x8')],_0x533134[_0x8f04('0x7')][_0x8f04('0x9')]);this['number']=_0x533134[_0x8f04('0xa')];this[_0x8f04('0xb')]=_0x466ea5[_0x8f04('0x6')];this[_0x8f04('0xc')]=_0x533134['active']||![];this['type']=_0x466ea5[_0x8f04('0xd')];this[_0x8f04('0xe')]=_0x466ea5[_0x8f04('0xe')]||0x3;this[_0x8f04('0xf')]=_0x533134[_0x8f04('0xf')];this['countbusyretry']=_0x533134[_0x8f04('0x10')];this[_0x8f04('0x11')]=_0x533134[_0x8f04('0x11')];this[_0x8f04('0x12')]=_0x533134['countnoanswerretry'];this['countnosuchnumberretry']=_0x533134[_0x8f04('0x13')];this[_0x8f04('0x14')]=_0x533134[_0x8f04('0x14')];this[_0x8f04('0x15')]=_0x533134[_0x8f04('0x15')];this['countmachineretry']=_0x533134[_0x8f04('0x16')];this[_0x8f04('0x17')]=_0x533134[_0x8f04('0x17')];this[_0x8f04('0x18')]=_0x533134[_0x8f04('0x18')];this['ListId']=_0x533134['ListId'];this[_0x8f04('0x19')]=_0x533134[_0x8f04('0x19')];this[_0x8f04('0x1a')]=_0x533134[_0x8f04('0x1a')];this['CampaignId']=_0x533134[_0x8f04('0x1b')];this[_0x8f04('0x1c')]=_0x533134['id'];this[_0x8f04('0x1d')]=_0x533134[_0x8f04('0x7')][_0x8f04('0x8')]||'';this[_0x8f04('0x1e')]=moment()[_0x8f04('0x1f')](_0x8f04('0x20'));this['callback']=_0x533134[_0x8f04('0x21')];this[_0x8f04('0x22')]=_0x533134[_0x8f04('0x22')];this['callbackat']=_0x533134[_0x8f04('0x23')];this['recallme']=_0x533134[_0x8f04('0x24')];this[_0x8f04('0x25')]='';this[_0x8f04('0x26')]='';}Action[_0x8f04('0x27')][_0x8f04('0x28')]=function(){return util[_0x8f04('0x1f')](_0x8f04('0x29'),this['name'],this[_0x8f04('0x4')][_0x8f04('0x2a')]>0x0?this['number'][_0x8f04('0x2b')](this[_0x8f04('0x4')][_0x8f04('0x2a')]):this[_0x8f04('0x2c')]);};Action[_0x8f04('0x27')][_0x8f04('0x2d')]=function(){return this[_0x8f04('0xb')];};module[_0x8f04('0x2e')]=Action; \ No newline at end of file +var _0xeaaf=['idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','exports','lodash','isNil','string','voiceQueue','phone','Contact','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x54fc54,_0x5a19d9){var _0x5ee0ee=function(_0x2ca530){while(--_0x2ca530){_0x54fc54['push'](_0x54fc54['shift']());}};_0x5ee0ee(++_0x5a19d9);}(_0xeaaf,0x6b));var _0xfeaa=function(_0x153934,_0x236774){_0x153934=_0x153934-0x0;var _0x109015=_0xeaaf[_0x153934];return _0x109015;};'use strict';var util=require('util');var _=require(_0xfeaa('0x0'));var moment=require('moment');function checkNameSurname(_0x31d0dc,_0x26294e,_0x1e248b){var _0x41d893='';if(!_[_0xfeaa('0x1')](_0x26294e)&&_0xfeaa('0x2')===typeof _0x26294e){_0x41d893+=_0x26294e;}if(!_[_0xfeaa('0x1')](_0x1e248b)&&'string'===typeof _0x1e248b){_0x41d893+='\x20'+_0x1e248b;}if(_0x41d893!==''){return _0x41d893;}return _0x31d0dc;}function Action(_0x2b2e4c,_0x4581fb,_0x557bc3){this[_0xfeaa('0x3')]=_0x2b2e4c;this['uniqueid']=_0x557bc3||undefined;this['name']=checkNameSurname(_0x4581fb['Contact'][_0xfeaa('0x4')],_0x4581fb[_0xfeaa('0x5')][_0xfeaa('0x6')],_0x4581fb['Contact'][_0xfeaa('0x7')]);this[_0xfeaa('0x8')]=_0x4581fb[_0xfeaa('0x4')];this[_0xfeaa('0x9')]=_0x2b2e4c[_0xfeaa('0xa')];this[_0xfeaa('0xb')]=_0x4581fb[_0xfeaa('0xb')]||![];this[_0xfeaa('0xc')]=_0x2b2e4c[_0xfeaa('0xc')];this['dialQueueTimeout']=_0x2b2e4c[_0xfeaa('0xd')]||0x3;this['scheduledat']=_0x4581fb[_0xfeaa('0xe')];this[_0xfeaa('0xf')]=_0x4581fb['countbusyretry'];this[_0xfeaa('0x10')]=_0x4581fb[_0xfeaa('0x10')];this[_0xfeaa('0x11')]=_0x4581fb[_0xfeaa('0x11')];this[_0xfeaa('0x12')]=_0x4581fb[_0xfeaa('0x12')];this[_0xfeaa('0x13')]=_0x4581fb['countdropretry'];this[_0xfeaa('0x14')]=_0x4581fb[_0xfeaa('0x14')];this[_0xfeaa('0x15')]=_0x4581fb[_0xfeaa('0x15')];this['countagentrejectretry']=_0x4581fb[_0xfeaa('0x16')];this[_0xfeaa('0x17')]=_0x4581fb['ContactId'];this[_0xfeaa('0x18')]=_0x4581fb['ListId'];this[_0xfeaa('0x19')]=_0x4581fb[_0xfeaa('0x19')];this['VoiceQueueId']=_0x4581fb[_0xfeaa('0x1a')];this['CampaignId']=_0x4581fb[_0xfeaa('0x1b')];this[_0xfeaa('0x1c')]=_0x4581fb['id'];this[_0xfeaa('0x1d')]=_0x4581fb[_0xfeaa('0x5')]['firstName']||'';this[_0xfeaa('0x1e')]=moment()[_0xfeaa('0x1f')](_0xfeaa('0x20'));this[_0xfeaa('0x21')]=_0x4581fb[_0xfeaa('0x21')];this['callbackuniqueid']=_0x4581fb['callbackuniqueid'];this[_0xfeaa('0x22')]=_0x4581fb[_0xfeaa('0x22')];this['recallme']=_0x4581fb[_0xfeaa('0x23')];this[_0xfeaa('0x24')]='';this[_0xfeaa('0x25')]='';}Action[_0xfeaa('0x26')][_0xfeaa('0x27')]=function(){return util[_0xfeaa('0x1f')](_0xfeaa('0x28'),this['name'],this[_0xfeaa('0x3')]['dialCutDigit']>0x0?this[_0xfeaa('0x8')][_0xfeaa('0x29')](this[_0xfeaa('0x3')][_0xfeaa('0x2a')]):this[_0xfeaa('0x8')]);};Action[_0xfeaa('0x26')][_0xfeaa('0x2b')]=function(){return this[_0xfeaa('0x9')];};module[_0xfeaa('0x2c')]=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 6f1b155..65c4429 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 _0xcc6f=['starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','getSeconds','queue','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','number'];(function(_0x22b739,_0x4dd13c){var _0x20efed=function(_0x3c0f0c){while(--_0x3c0f0c){_0x22b739['push'](_0x22b739['shift']());}};_0x20efed(++_0x4dd13c);}(_0xcc6f,0x19b));var _0xfcc6=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xcc6f[_0x1928c9];return _0x51b5fb;};'use strict';var moment=require(_0xfcc6('0x0'));var utils=require('../utils');function AgentComplete(_0x2e2065,_0x3379f1){this[_0xfcc6('0x1')]=0x4;this['statedesc']=_0xfcc6('0x2');this[_0xfcc6('0x3')]=_0x2e2065[_0xfcc6('0x3')];this[_0xfcc6('0x4')]=_0x2e2065[_0xfcc6('0x4')];this['campaigntype']=_0x2e2065['type']===_0xfcc6('0x5')?'queue':_0x2e2065['type'];this[_0xfcc6('0x6')]=_0x2e2065[_0xfcc6('0x6')];this[_0xfcc6('0x7')]=_0x2e2065[_0xfcc6('0x7')];this['countnoanswerretry']=_0x2e2065[_0xfcc6('0x8')];this[_0xfcc6('0x9')]=_0x2e2065[_0xfcc6('0x6')]+_0x2e2065[_0xfcc6('0x7')]+_0x2e2065[_0xfcc6('0x8')]+_0x2e2065[_0xfcc6('0xa')]+_0x2e2065[_0xfcc6('0xb')]+_0x2e2065['countabandonedretry']+_0x2e2065[_0xfcc6('0xc')]+_0x2e2065[_0xfcc6('0xd')];this[_0xfcc6('0xa')]=_0x2e2065[_0xfcc6('0xa')];this[_0xfcc6('0xb')]=_0x2e2065[_0xfcc6('0xb')];this[_0xfcc6('0xe')]=_0x2e2065['countabandonedretry'];this[_0xfcc6('0xc')]=_0x2e2065[_0xfcc6('0xc')];this['countagentrejectretry']=_0x2e2065['countagentrejectretry'];this[_0xfcc6('0xf')]=_0x3379f1[_0xfcc6('0xf')];this['calleridname']=_0x2e2065[_0xfcc6('0x10')];this[_0xfcc6('0x11')]=_0x2e2065[_0xfcc6('0x12')];this[_0xfcc6('0x13')]=_0x2e2065[_0xfcc6('0x13')];this[_0xfcc6('0x14')]=_0x2e2065[_0xfcc6('0x14')];this['answertime']=_0x2e2065[_0xfcc6('0x15')];this[_0xfcc6('0x16')]=moment()[_0xfcc6('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfcc6('0x18')]=utils['getSeconds'](_0x2e2065['responsetime'],_0x2e2065[_0xfcc6('0x13')]);this[_0xfcc6('0x19')]=utils['getSeconds'](_0x2e2065[_0xfcc6('0x15')],_0x2e2065[_0xfcc6('0x14')]);this[_0xfcc6('0x1a')]=utils[_0xfcc6('0x1b')](this[_0xfcc6('0x16')],_0x2e2065['answertime']);this[_0xfcc6('0x1c')]=_0x3379f1[_0xfcc6('0x1c')];this[_0xfcc6('0x1d')]=_0x3379f1[_0xfcc6('0x1d')];this[_0xfcc6('0x1e')]=_0x3379f1[_0xfcc6('0x1e')];this[_0xfcc6('0x1f')]=_0x2e2065[_0xfcc6('0x1f')];this[_0xfcc6('0x20')]=_0x2e2065['callbackuniqueid'];this[_0xfcc6('0x21')]=_0x2e2065['callbackat'];this['recallme']=_0x2e2065['recallme'];this[_0xfcc6('0x22')]=_0x2e2065[_0xfcc6('0x22')];this[_0xfcc6('0x23')]=_0x2e2065[_0xfcc6('0x23')];this[_0xfcc6('0x24')]=_0x2e2065[_0xfcc6('0x24')];this[_0xfcc6('0x25')]=_0x2e2065[_0xfcc6('0x25')];this[_0xfcc6('0x26')]=_0x2e2065['CampaignId'];this[_0xfcc6('0x27')]=_0x2e2065[_0xfcc6('0x27')]||'';this['originatecalleridname']=_0x2e2065[_0xfcc6('0x28')]||'';this[_0xfcc6('0x29')]=_0x2e2065[_0xfcc6('0x29')];}module[_0xfcc6('0x2a')]=AgentComplete; \ No newline at end of file +var _0xb4c0=['reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','moment','../utils','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername'];(function(_0x162853,_0x57dc49){var _0x2bf3f8=function(_0x4148f1){while(--_0x4148f1){_0x162853['push'](_0x162853['shift']());}};_0x2bf3f8(++_0x57dc49);}(_0xb4c0,0xb7));var _0x0b4c=function(_0x29106c,_0x4371d6){_0x29106c=_0x29106c-0x0;var _0x4133ac=_0xb4c0[_0x29106c];return _0x4133ac;};'use strict';var moment=require(_0x0b4c('0x0'));var utils=require(_0x0b4c('0x1'));function AgentComplete(_0x1001eb,_0x332e36){this['state']=0x4;this[_0x0b4c('0x2')]=_0x0b4c('0x3');this[_0x0b4c('0x4')]=_0x1001eb[_0x0b4c('0x4')];this[_0x0b4c('0x5')]=_0x1001eb[_0x0b4c('0x5')];this['campaigntype']=_0x1001eb[_0x0b4c('0x5')]===_0x0b4c('0x6')?_0x0b4c('0x7'):_0x1001eb[_0x0b4c('0x5')];this[_0x0b4c('0x8')]=_0x1001eb['countbusyretry'];this[_0x0b4c('0x9')]=_0x1001eb[_0x0b4c('0x9')];this[_0x0b4c('0xa')]=_0x1001eb[_0x0b4c('0xa')];this[_0x0b4c('0xb')]=_0x1001eb[_0x0b4c('0x8')]+_0x1001eb['countcongestionretry']+_0x1001eb[_0x0b4c('0xa')]+_0x1001eb['countnosuchnumberretry']+_0x1001eb['countdropretry']+_0x1001eb[_0x0b4c('0xc')]+_0x1001eb[_0x0b4c('0xd')]+_0x1001eb[_0x0b4c('0xe')];this[_0x0b4c('0xf')]=_0x1001eb[_0x0b4c('0xf')];this['countdropretry']=_0x1001eb[_0x0b4c('0x10')];this[_0x0b4c('0xc')]=_0x1001eb[_0x0b4c('0xc')];this[_0x0b4c('0xd')]=_0x1001eb[_0x0b4c('0xd')];this['countagentrejectretry']=_0x1001eb[_0x0b4c('0xe')];this['uniqueid']=_0x332e36[_0x0b4c('0x11')];this[_0x0b4c('0x12')]=_0x1001eb[_0x0b4c('0x13')];this[_0x0b4c('0x14')]=_0x1001eb['number'];this[_0x0b4c('0x15')]=_0x1001eb[_0x0b4c('0x15')];this[_0x0b4c('0x16')]=_0x1001eb[_0x0b4c('0x16')];this[_0x0b4c('0x17')]=_0x1001eb['answertime'];this[_0x0b4c('0x18')]=moment()[_0x0b4c('0x19')](_0x0b4c('0x1a'));this[_0x0b4c('0x1b')]=utils['getSeconds'](_0x1001eb[_0x0b4c('0x16')],_0x1001eb[_0x0b4c('0x15')]);this[_0x0b4c('0x1c')]=utils[_0x0b4c('0x1d')](_0x1001eb['answertime'],_0x1001eb['responsetime']);this[_0x0b4c('0x1e')]=utils[_0x0b4c('0x1d')](this[_0x0b4c('0x18')],_0x1001eb[_0x0b4c('0x17')]);this[_0x0b4c('0x7')]=_0x332e36['queue'];this['membername']=_0x332e36[_0x0b4c('0x1f')];this['reason']=_0x332e36[_0x0b4c('0x20')];this[_0x0b4c('0x21')]=_0x1001eb[_0x0b4c('0x21')];this[_0x0b4c('0x22')]=_0x1001eb[_0x0b4c('0x22')];this[_0x0b4c('0x23')]=_0x1001eb[_0x0b4c('0x23')];this[_0x0b4c('0x24')]=_0x1001eb[_0x0b4c('0x24')];this['ContactId']=_0x1001eb['ContactId'];this[_0x0b4c('0x25')]=_0x1001eb['ListId'];this['UserId']=_0x1001eb[_0x0b4c('0x26')];this[_0x0b4c('0x27')]=_0x1001eb[_0x0b4c('0x27')];this[_0x0b4c('0x28')]=_0x1001eb[_0x0b4c('0x28')];this[_0x0b4c('0x29')]=_0x1001eb['originatecalleridnum']||'';this['originatecalleridname']=_0x1001eb['originatecalleridname']||'';this[_0x0b4c('0x2a')]=_0x1001eb[_0x0b4c('0x2a')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index fa1d15f..604ec03 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 _0xb2e4=['exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0xb2e4,0x91));var _0x4b2e=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xb2e4[_0x512c83];return _0x1f7f25;};'use strict';function Final(_0x2d60d9){this['uniqueid']=_0x2d60d9[_0x4b2e('0x0')];this['scheduledat']=_0x2d60d9[_0x4b2e('0x1')];this[_0x4b2e('0x2')]=_0x2d60d9[_0x4b2e('0x2')];this[_0x4b2e('0x3')]=_0x2d60d9[_0x4b2e('0x2')]===_0x4b2e('0x4')?_0x4b2e('0x5'):_0x2d60d9[_0x4b2e('0x2')];this[_0x4b2e('0x6')]=_0x2d60d9[_0x4b2e('0x6')];this[_0x4b2e('0x7')]=_0x2d60d9[_0x4b2e('0x7')];this[_0x4b2e('0x8')]=_0x2d60d9[_0x4b2e('0x8')];this[_0x4b2e('0x9')]=_0x2d60d9[_0x4b2e('0x6')]+_0x2d60d9[_0x4b2e('0x7')]+_0x2d60d9[_0x4b2e('0x8')]+_0x2d60d9[_0x4b2e('0xa')]+_0x2d60d9[_0x4b2e('0xb')]+_0x2d60d9['countabandonedretry']+_0x2d60d9['countmachineretry']+_0x2d60d9[_0x4b2e('0xc')];this[_0x4b2e('0xa')]=_0x2d60d9[_0x4b2e('0xa')];this[_0x4b2e('0xb')]=_0x2d60d9[_0x4b2e('0xb')];this[_0x4b2e('0xd')]=_0x2d60d9['countabandonedretry'];this[_0x4b2e('0xe')]=_0x2d60d9[_0x4b2e('0xe')];this[_0x4b2e('0xc')]=_0x2d60d9[_0x4b2e('0xc')];this[_0x4b2e('0x5')]=_0x2d60d9[_0x4b2e('0x5')];this['calleridname']=_0x2d60d9['calleridname'];this[_0x4b2e('0xf')]=_0x2d60d9[_0x4b2e('0xf')];this[_0x4b2e('0x10')]=_0x2d60d9[_0x4b2e('0x10')];this[_0x4b2e('0x11')]=_0x2d60d9['responsetime'];this[_0x4b2e('0x12')]=_0x2d60d9['responsetime'];this['ringtime']=_0x2d60d9[_0x4b2e('0x13')]||0x0;this[_0x4b2e('0x14')]=_0x2d60d9[_0x4b2e('0x14')]||0x0;this[_0x4b2e('0x15')]=_0x2d60d9[_0x4b2e('0x15')]||0x0;this[_0x4b2e('0x16')]=_0x2d60d9[_0x4b2e('0x16')];this[_0x4b2e('0x17')]=_0x2d60d9['callbackuniqueid'];this[_0x4b2e('0x18')]=_0x2d60d9['callbackat'];this[_0x4b2e('0x19')]=_0x2d60d9[_0x4b2e('0x19')];this[_0x4b2e('0x1a')]=_0x2d60d9['ContactId'];this[_0x4b2e('0x1b')]=_0x2d60d9[_0x4b2e('0x1b')];this[_0x4b2e('0x1c')]=_0x2d60d9[_0x4b2e('0x1c')];this['VoiceQueueId']=_0x2d60d9[_0x4b2e('0x1d')];this[_0x4b2e('0x1e')]=_0x2d60d9[_0x4b2e('0x1e')];this[_0x4b2e('0x1f')]=_0x2d60d9[_0x4b2e('0x1f')]||'';this['originatecalleridname']=_0x2d60d9[_0x4b2e('0x20')]||'';this[_0x4b2e('0x21')]=_0x2d60d9['state'];this[_0x4b2e('0x22')]=_0x2d60d9[_0x4b2e('0x22')];}module[_0x4b2e('0x23')]=Final; \ No newline at end of file +var _0xac80=['campaigntype','type','outbound','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xac80,0x196));var _0x0ac8=function(_0x36dea4,_0x988d5){_0x36dea4=_0x36dea4-0x0;var _0x22418b=_0xac80[_0x36dea4];return _0x22418b;};'use strict';function Final(_0x3a7066){this[_0x0ac8('0x0')]=_0x3a7066[_0x0ac8('0x0')];this[_0x0ac8('0x1')]=_0x3a7066[_0x0ac8('0x1')];this['type']=_0x3a7066['type'];this[_0x0ac8('0x2')]=_0x3a7066[_0x0ac8('0x3')]===_0x0ac8('0x4')?'queue':_0x3a7066[_0x0ac8('0x3')];this[_0x0ac8('0x5')]=_0x3a7066[_0x0ac8('0x5')];this['countcongestionretry']=_0x3a7066['countcongestionretry'];this[_0x0ac8('0x6')]=_0x3a7066[_0x0ac8('0x6')];this[_0x0ac8('0x7')]=_0x3a7066[_0x0ac8('0x5')]+_0x3a7066['countcongestionretry']+_0x3a7066[_0x0ac8('0x6')]+_0x3a7066[_0x0ac8('0x8')]+_0x3a7066[_0x0ac8('0x9')]+_0x3a7066[_0x0ac8('0xa')]+_0x3a7066['countmachineretry']+_0x3a7066[_0x0ac8('0xb')];this[_0x0ac8('0x8')]=_0x3a7066[_0x0ac8('0x8')];this[_0x0ac8('0x9')]=_0x3a7066['countdropretry'];this['countabandonedretry']=_0x3a7066[_0x0ac8('0xa')];this[_0x0ac8('0xc')]=_0x3a7066[_0x0ac8('0xc')];this[_0x0ac8('0xb')]=_0x3a7066['countagentrejectretry'];this['queue']=_0x3a7066['queue'];this[_0x0ac8('0xd')]=_0x3a7066[_0x0ac8('0xd')];this[_0x0ac8('0xe')]=_0x3a7066[_0x0ac8('0xe')];this[_0x0ac8('0xf')]=_0x3a7066[_0x0ac8('0xf')];this['responsetime']=_0x3a7066['responsetime'];this[_0x0ac8('0x10')]=_0x3a7066[_0x0ac8('0x11')];this['ringtime']=_0x3a7066[_0x0ac8('0x12')]||0x0;this[_0x0ac8('0x13')]=_0x3a7066[_0x0ac8('0x13')]||0x0;this['talktime']=_0x3a7066['talktime']||0x0;this[_0x0ac8('0x14')]=_0x3a7066['callback'];this[_0x0ac8('0x15')]=_0x3a7066['callbackuniqueid'];this[_0x0ac8('0x16')]=_0x3a7066['callbackat'];this[_0x0ac8('0x17')]=_0x3a7066[_0x0ac8('0x17')];this[_0x0ac8('0x18')]=_0x3a7066[_0x0ac8('0x18')];this[_0x0ac8('0x19')]=_0x3a7066[_0x0ac8('0x19')];this[_0x0ac8('0x1a')]=_0x3a7066['UserId'];this['VoiceQueueId']=_0x3a7066[_0x0ac8('0x1b')];this['CampaignId']=_0x3a7066[_0x0ac8('0x1c')];this['originatecalleridnum']=_0x3a7066[_0x0ac8('0x1d')]||'';this[_0x0ac8('0x1e')]=_0x3a7066[_0x0ac8('0x1e')]||'';this['state']=_0x3a7066[_0x0ac8('0x1f')];this[_0x0ac8('0x20')]=_0x3a7066[_0x0ac8('0x20')];}module[_0x0ac8('0x21')]=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 53c9f7b..add0eda 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 _0xf284=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','endtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x1d664a,_0x149a34){var _0x335345=function(_0x461fac){while(--_0x461fac){_0x1d664a['push'](_0x1d664a['shift']());}};_0x335345(++_0x149a34);}(_0xf284,0x118));var _0x4f28=function(_0x2920f5,_0x249428){_0x2920f5=_0x2920f5-0x0;var _0x58d76a=_0xf284[_0x2920f5];return _0x58d76a;};'use strict';var moment=require(_0x4f28('0x0'));var utils=require(_0x4f28('0x1'));function Hangup(_0x3aa457,_0x4505e2){this[_0x4f28('0x2')]=0x4;this[_0x4f28('0x3')]=_0x4f28('0x4');this[_0x4f28('0x5')]=_0x3aa457['scheduledat'];this['type']=_0x3aa457[_0x4f28('0x6')];this[_0x4f28('0x7')]=_0x3aa457[_0x4f28('0x6')]===_0x4f28('0x8')?_0x4f28('0x9'):_0x3aa457[_0x4f28('0x6')];this[_0x4f28('0xa')]=_0x3aa457[_0x4f28('0xa')]||![];this[_0x4f28('0xb')]=_0x3aa457[_0x4f28('0xb')];this[_0x4f28('0xc')]=_0x3aa457[_0x4f28('0xc')];this[_0x4f28('0xd')]=_0x3aa457[_0x4f28('0xd')];this[_0x4f28('0xe')]=_0x3aa457['countbusyretry']+_0x3aa457[_0x4f28('0xc')]+_0x3aa457['countnoanswerretry']+_0x3aa457[_0x4f28('0xf')]+_0x3aa457['countdropretry']+_0x3aa457[_0x4f28('0x10')]+_0x3aa457[_0x4f28('0x11')]+_0x3aa457['countagentrejectretry'];this[_0x4f28('0xf')]=_0x3aa457['countnosuchnumberretry'];this[_0x4f28('0x12')]=_0x3aa457[_0x4f28('0x12')];this[_0x4f28('0x10')]=_0x3aa457['countabandonedretry'];this[_0x4f28('0x11')]=_0x3aa457[_0x4f28('0x11')];this[_0x4f28('0x13')]=_0x3aa457[_0x4f28('0x13')];this[_0x4f28('0x14')]=_0x4505e2['uniqueid'];this['calleridname']=_0x3aa457[_0x4f28('0x15')];this[_0x4f28('0x16')]=_0x3aa457['number'];this[_0x4f28('0x17')]=_0x3aa457['starttime'];this['responsetime']=_0x3aa457[_0x4f28('0x18')];this['endtime']=moment()['format'](_0x4f28('0x19'));this['ringtime']=utils[_0x4f28('0x1a')](_0x3aa457['responsetime'],_0x3aa457['starttime']);this['holdtime']=0x0;this[_0x4f28('0x1b')]=utils[_0x4f28('0x1a')](this[_0x4f28('0x1c')],_0x3aa457[_0x4f28('0x18')]);this[_0x4f28('0x9')]=_0x3aa457[_0x4f28('0x9')];this[_0x4f28('0x1d')]=_0x4f28('0x1e');this[_0x4f28('0x1f')]=_0x4505e2['cause-txt'];this['callback']=_0x3aa457[_0x4f28('0x20')];this[_0x4f28('0x21')]=_0x3aa457['callbackuniqueid'];this[_0x4f28('0x22')]=_0x3aa457[_0x4f28('0x22')];this[_0x4f28('0x23')]=_0x3aa457['recallme'];this[_0x4f28('0x24')]=_0x3aa457[_0x4f28('0x24')];this[_0x4f28('0x25')]=_0x3aa457['ListId'];this['UserId']=_0x3aa457[_0x4f28('0x26')];this[_0x4f28('0x27')]=_0x3aa457['VoiceQueueId'];this[_0x4f28('0x28')]=_0x3aa457[_0x4f28('0x28')];}module[_0x4f28('0x29')]=Hangup; \ No newline at end of file +var _0x6806=['getSeconds','holdtime','endtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6806,0xbd));var _0x6680=function(_0x306d5c,_0x361748){_0x306d5c=_0x306d5c-0x0;var _0x1efc5d=_0x6806[_0x306d5c];return _0x1efc5d;};'use strict';var moment=require('moment');var utils=require(_0x6680('0x0'));function Hangup(_0x281a1c,_0x40e6c5){this[_0x6680('0x1')]=0x4;this[_0x6680('0x2')]=_0x6680('0x3');this['scheduledat']=_0x281a1c[_0x6680('0x4')];this[_0x6680('0x5')]=_0x281a1c['type'];this[_0x6680('0x6')]=_0x281a1c['type']===_0x6680('0x7')?'queue':_0x281a1c[_0x6680('0x5')];this[_0x6680('0x8')]=_0x281a1c[_0x6680('0x8')]||![];this[_0x6680('0x9')]=_0x281a1c[_0x6680('0x9')];this[_0x6680('0xa')]=_0x281a1c[_0x6680('0xa')];this[_0x6680('0xb')]=_0x281a1c[_0x6680('0xb')];this[_0x6680('0xc')]=_0x281a1c['countbusyretry']+_0x281a1c[_0x6680('0xa')]+_0x281a1c[_0x6680('0xb')]+_0x281a1c[_0x6680('0xd')]+_0x281a1c[_0x6680('0xe')]+_0x281a1c['countabandonedretry']+_0x281a1c[_0x6680('0xf')]+_0x281a1c['countagentrejectretry'];this['countnosuchnumberretry']=_0x281a1c[_0x6680('0xd')];this[_0x6680('0xe')]=_0x281a1c[_0x6680('0xe')];this[_0x6680('0x10')]=_0x281a1c[_0x6680('0x10')];this[_0x6680('0xf')]=_0x281a1c[_0x6680('0xf')];this['countagentrejectretry']=_0x281a1c[_0x6680('0x11')];this['uniqueid']=_0x40e6c5[_0x6680('0x12')];this[_0x6680('0x13')]=_0x281a1c[_0x6680('0x14')];this['calleridnum']=_0x281a1c[_0x6680('0x15')];this[_0x6680('0x16')]=_0x281a1c['starttime'];this[_0x6680('0x17')]=_0x281a1c['responsetime'];this['endtime']=moment()[_0x6680('0x18')](_0x6680('0x19'));this['ringtime']=utils[_0x6680('0x1a')](_0x281a1c[_0x6680('0x17')],_0x281a1c[_0x6680('0x16')]);this[_0x6680('0x1b')]=0x0;this['talktime']=utils[_0x6680('0x1a')](this[_0x6680('0x1c')],_0x281a1c[_0x6680('0x17')]);this[_0x6680('0x1d')]=_0x281a1c[_0x6680('0x1d')];this[_0x6680('0x1e')]=_0x6680('0x1f');this[_0x6680('0x20')]=_0x40e6c5[_0x6680('0x21')];this[_0x6680('0x22')]=_0x281a1c[_0x6680('0x22')];this[_0x6680('0x23')]=_0x281a1c[_0x6680('0x23')];this[_0x6680('0x24')]=_0x281a1c[_0x6680('0x24')];this[_0x6680('0x25')]=_0x281a1c[_0x6680('0x25')];this['ContactId']=_0x281a1c[_0x6680('0x26')];this[_0x6680('0x27')]=_0x281a1c[_0x6680('0x27')];this[_0x6680('0x28')]=_0x281a1c[_0x6680('0x28')];this['VoiceQueueId']=_0x281a1c[_0x6680('0x29')];this[_0x6680('0x2a')]=_0x281a1c[_0x6680('0x2a')];}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 c9df7d4..8a2c97d 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 _0xbfca=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xbfca,0xba));var _0xabfc=function(_0x2a286f,_0x17d60c){_0x2a286f=_0x2a286f-0x0;var _0x3889df=_0xbfca[_0x2a286f];return _0x3889df;};'use strict';var utils=require(_0xabfc('0x0'));function History(_0x421f5f){this['uniqueid']=_0x421f5f[_0xabfc('0x1')];this[_0xabfc('0x2')]=_0x421f5f[_0xabfc('0x2')]||undefined;this[_0xabfc('0x3')]=_0x421f5f['type'];this[_0xabfc('0x4')]=_0x421f5f[_0xabfc('0x3')]===_0xabfc('0x5')?_0xabfc('0x6'):_0x421f5f['type'];this[_0xabfc('0x7')]=_0x421f5f[_0xabfc('0x7')];this[_0xabfc('0x8')]=_0x421f5f['countcongestionretry'];this[_0xabfc('0x9')]=_0x421f5f[_0xabfc('0x9')];this[_0xabfc('0xa')]=_0x421f5f[_0xabfc('0x7')]+_0x421f5f[_0xabfc('0x8')]+_0x421f5f[_0xabfc('0x9')]+_0x421f5f['countnosuchnumberretry']+_0x421f5f[_0xabfc('0xb')]+_0x421f5f['countabandonedretry']+_0x421f5f['countmachineretry']+_0x421f5f[_0xabfc('0xc')];this[_0xabfc('0xd')]=_0x421f5f[_0xabfc('0xd')];this[_0xabfc('0xb')]=_0x421f5f[_0xabfc('0xb')];this[_0xabfc('0xe')]=_0x421f5f[_0xabfc('0xe')];this['countmachineretry']=_0x421f5f[_0xabfc('0xf')];this['countagentrejectretry']=_0x421f5f[_0xabfc('0xc')];this[_0xabfc('0x6')]=_0x421f5f[_0xabfc('0x6')];this['calleridname']=_0x421f5f[_0xabfc('0x10')];this[_0xabfc('0x11')]=_0x421f5f['number'];this[_0xabfc('0x12')]=_0x421f5f[_0xabfc('0x12')];this[_0xabfc('0x13')]=_0x421f5f['responsetime'];this['endtime']=_0x421f5f['responsetime'];this[_0xabfc('0x14')]=utils['getSeconds'](_0x421f5f[_0xabfc('0x13')],_0x421f5f['starttime']);this[_0xabfc('0x15')]=0x0;this[_0xabfc('0x16')]=0x0;this[_0xabfc('0x17')]=_0x421f5f['callback'];this[_0xabfc('0x18')]=_0x421f5f['callbackuniqueid'];this[_0xabfc('0x19')]=_0x421f5f[_0xabfc('0x19')];this[_0xabfc('0x1a')]=_0x421f5f[_0xabfc('0x1a')];this[_0xabfc('0x1b')]=_0x421f5f[_0xabfc('0x1b')];this[_0xabfc('0x1c')]=_0x421f5f['ListId'];this[_0xabfc('0x1d')]=_0x421f5f[_0xabfc('0x1d')];this[_0xabfc('0x1e')]=_0x421f5f['VoiceQueueId'];this['CampaignId']=_0x421f5f[_0xabfc('0x1f')];this[_0xabfc('0x20')]=_0x421f5f[_0xabfc('0x20')]||'';this[_0xabfc('0x21')]=_0x421f5f[_0xabfc('0x21')]||'';this['state']=_0x421f5f['state'];this['statedesc']=_0x421f5f['statedesc'];}module[_0xabfc('0x22')]=History; \ No newline at end of file +var _0x87ee=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','campaigntype','type'];(function(_0x739d75,_0x8db80d){var _0x452430=function(_0x1aebf0){while(--_0x1aebf0){_0x739d75['push'](_0x739d75['shift']());}};_0x452430(++_0x8db80d);}(_0x87ee,0x67));var _0xe87e=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x87ee[_0x543084];return _0x306a57;};'use strict';var utils=require(_0xe87e('0x0'));function History(_0x3d445c){this[_0xe87e('0x1')]=_0x3d445c[_0xe87e('0x1')];this['scheduledat']=_0x3d445c[_0xe87e('0x2')]||undefined;this['type']=_0x3d445c['type'];this[_0xe87e('0x3')]=_0x3d445c[_0xe87e('0x4')]===_0xe87e('0x5')?'queue':_0x3d445c['type'];this[_0xe87e('0x6')]=_0x3d445c[_0xe87e('0x6')];this[_0xe87e('0x7')]=_0x3d445c[_0xe87e('0x7')];this[_0xe87e('0x8')]=_0x3d445c[_0xe87e('0x8')];this[_0xe87e('0x9')]=_0x3d445c[_0xe87e('0x6')]+_0x3d445c[_0xe87e('0x7')]+_0x3d445c[_0xe87e('0x8')]+_0x3d445c['countnosuchnumberretry']+_0x3d445c[_0xe87e('0xa')]+_0x3d445c[_0xe87e('0xb')]+_0x3d445c[_0xe87e('0xc')]+_0x3d445c[_0xe87e('0xd')];this[_0xe87e('0xe')]=_0x3d445c[_0xe87e('0xe')];this['countdropretry']=_0x3d445c[_0xe87e('0xa')];this[_0xe87e('0xb')]=_0x3d445c['countabandonedretry'];this[_0xe87e('0xc')]=_0x3d445c['countmachineretry'];this[_0xe87e('0xd')]=_0x3d445c['countagentrejectretry'];this['queue']=_0x3d445c[_0xe87e('0xf')];this[_0xe87e('0x10')]=_0x3d445c[_0xe87e('0x11')];this[_0xe87e('0x12')]=_0x3d445c['number'];this[_0xe87e('0x13')]=_0x3d445c[_0xe87e('0x13')];this[_0xe87e('0x14')]=_0x3d445c[_0xe87e('0x14')];this[_0xe87e('0x15')]=_0x3d445c['responsetime'];this[_0xe87e('0x16')]=utils[_0xe87e('0x17')](_0x3d445c[_0xe87e('0x14')],_0x3d445c[_0xe87e('0x13')]);this[_0xe87e('0x18')]=0x0;this[_0xe87e('0x19')]=0x0;this[_0xe87e('0x1a')]=_0x3d445c[_0xe87e('0x1a')];this['callbackuniqueid']=_0x3d445c[_0xe87e('0x1b')];this[_0xe87e('0x1c')]=_0x3d445c['callbackat'];this['recallme']=_0x3d445c['recallme'];this['ContactId']=_0x3d445c[_0xe87e('0x1d')];this[_0xe87e('0x1e')]=_0x3d445c[_0xe87e('0x1e')];this['UserId']=_0x3d445c['UserId'];this[_0xe87e('0x1f')]=_0x3d445c[_0xe87e('0x1f')];this['CampaignId']=_0x3d445c['CampaignId'];this[_0xe87e('0x20')]=_0x3d445c[_0xe87e('0x20')]||'';this[_0xe87e('0x21')]=_0x3d445c[_0xe87e('0x21')]||'';this[_0xe87e('0x22')]=_0x3d445c[_0xe87e('0x22')];this[_0xe87e('0x23')]=_0x3d445c['statedesc'];}module['exports']=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 82e4aed..080d8b4 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 _0xaca6=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x8e08e6,_0x304871){var _0x2952f3=function(_0x3dd6fd){while(--_0x3dd6fd){_0x8e08e6['push'](_0x8e08e6['shift']());}};_0x2952f3(++_0x304871);}(_0xaca6,0x136));var _0x6aca=function(_0x593636,_0x5d0757){_0x593636=_0x593636-0x0;var _0x5b20f1=_0xaca6[_0x593636];return _0x5b20f1;};'use strict';var utils=require(_0x6aca('0x0'));function QueueCallerAbandon(_0x11c08e,_0x451ae1){this[_0x6aca('0x1')]=_0x11c08e[_0x6aca('0x1')];this[_0x6aca('0x2')]=_0x11c08e['type'];this[_0x6aca('0x3')]=_0x11c08e[_0x6aca('0x2')]==='outbound'?_0x6aca('0x4'):_0x11c08e[_0x6aca('0x2')];this[_0x6aca('0x5')]=_0x11c08e[_0x6aca('0x5')];this[_0x6aca('0x6')]=_0x11c08e[_0x6aca('0x6')];this['countnoanswerretry']=_0x11c08e['countnoanswerretry'];this['countglobal']=_0x11c08e[_0x6aca('0x5')]+_0x11c08e[_0x6aca('0x6')]+_0x11c08e[_0x6aca('0x7')]+_0x11c08e[_0x6aca('0x8')]+_0x11c08e[_0x6aca('0x9')]+_0x11c08e[_0x6aca('0xa')]+_0x11c08e[_0x6aca('0xb')]+_0x11c08e['countagentrejectretry'];this[_0x6aca('0x8')]=_0x11c08e[_0x6aca('0x8')];this[_0x6aca('0x9')]=_0x11c08e[_0x6aca('0x9')];this['countabandonedretry']=_0x11c08e[_0x6aca('0xa')];this[_0x6aca('0xb')]=_0x11c08e['countmachineretry'];this['countagentrejectretry']=_0x11c08e[_0x6aca('0xc')];this[_0x6aca('0xd')]=_0x451ae1[_0x6aca('0xd')];this[_0x6aca('0xe')]=_0x11c08e[_0x6aca('0xf')];this[_0x6aca('0x10')]=_0x11c08e['number'];this['starttime']=_0x11c08e[_0x6aca('0x11')];this['responsetime']=_0x11c08e[_0x6aca('0x12')];this[_0x6aca('0x13')]=_0x11c08e[_0x6aca('0x13')];this[_0x6aca('0x14')]=_0x11c08e[_0x6aca('0x14')];this[_0x6aca('0x15')]=this[_0x6aca('0x13')];this[_0x6aca('0x16')]=utils[_0x6aca('0x17')](_0x11c08e[_0x6aca('0x12')],_0x11c08e[_0x6aca('0x11')]);this['holdtime']=utils[_0x6aca('0x17')](this[_0x6aca('0x13')],_0x11c08e[_0x6aca('0x12')]);this[_0x6aca('0x18')]=0x0;this[_0x6aca('0x4')]=_0x451ae1[_0x6aca('0x4')];this['membername']=_0x451ae1['connectedlinename'];this[_0x6aca('0x19')]=_0x451ae1[_0x6aca('0x19')];this[_0x6aca('0x1a')]=_0x11c08e[_0x6aca('0x1a')];this[_0x6aca('0x1b')]=_0x11c08e[_0x6aca('0x1b')];this[_0x6aca('0x1c')]=_0x11c08e[_0x6aca('0x1c')];this[_0x6aca('0x1d')]=_0x11c08e['recallme'];this['ContactId']=_0x11c08e[_0x6aca('0x1e')];this[_0x6aca('0x1f')]=_0x11c08e[_0x6aca('0x1f')];this[_0x6aca('0x20')]=_0x11c08e['UserId'];this['VoiceQueueId']=_0x11c08e['VoiceQueueId'];this[_0x6aca('0x21')]=_0x11c08e[_0x6aca('0x21')];this[_0x6aca('0x22')]=_0x11c08e[_0x6aca('0x22')]||'';this[_0x6aca('0x23')]=_0x11c08e[_0x6aca('0x23')]||'';this['agiafterat']=_0x11c08e[_0x6aca('0x24')];this[_0x6aca('0x25')]=_0x11c08e[_0x6aca('0x25')];this[_0x6aca('0x26')]=_0x11c08e[_0x6aca('0x26')];}module[_0x6aca('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x0d5a=['droptime','endtime','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x0d5a,0xe8));var _0xa0d5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0d5a[_0x397e5f];return _0x5302b8;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x2b935d,_0x4b8721){this[_0xa0d5('0x0')]=_0x2b935d[_0xa0d5('0x0')];this[_0xa0d5('0x1')]=_0x2b935d[_0xa0d5('0x1')];this[_0xa0d5('0x2')]=_0x2b935d['type']===_0xa0d5('0x3')?_0xa0d5('0x4'):_0x2b935d[_0xa0d5('0x1')];this[_0xa0d5('0x5')]=_0x2b935d[_0xa0d5('0x5')];this['countcongestionretry']=_0x2b935d[_0xa0d5('0x6')];this['countnoanswerretry']=_0x2b935d['countnoanswerretry'];this[_0xa0d5('0x7')]=_0x2b935d['countbusyretry']+_0x2b935d[_0xa0d5('0x6')]+_0x2b935d[_0xa0d5('0x8')]+_0x2b935d[_0xa0d5('0x9')]+_0x2b935d[_0xa0d5('0xa')]+_0x2b935d['countabandonedretry']+_0x2b935d[_0xa0d5('0xb')]+_0x2b935d['countagentrejectretry'];this['countnosuchnumberretry']=_0x2b935d['countnosuchnumberretry'];this[_0xa0d5('0xa')]=_0x2b935d[_0xa0d5('0xa')];this[_0xa0d5('0xc')]=_0x2b935d[_0xa0d5('0xc')];this['countmachineretry']=_0x2b935d[_0xa0d5('0xb')];this[_0xa0d5('0xd')]=_0x2b935d[_0xa0d5('0xd')];this[_0xa0d5('0xe')]=_0x4b8721[_0xa0d5('0xe')];this[_0xa0d5('0xf')]=_0x2b935d[_0xa0d5('0x10')];this[_0xa0d5('0x11')]=_0x2b935d[_0xa0d5('0x12')];this['starttime']=_0x2b935d['starttime'];this[_0xa0d5('0x13')]=_0x2b935d[_0xa0d5('0x13')];this[_0xa0d5('0x14')]=_0x2b935d[_0xa0d5('0x14')];this['dropreason']=_0x2b935d['dropreason'];this[_0xa0d5('0x15')]=this[_0xa0d5('0x14')];this[_0xa0d5('0x16')]=utils[_0xa0d5('0x17')](_0x2b935d[_0xa0d5('0x13')],_0x2b935d['starttime']);this[_0xa0d5('0x18')]=utils[_0xa0d5('0x17')](this['droptime'],_0x2b935d['responsetime']);this[_0xa0d5('0x19')]=0x0;this[_0xa0d5('0x4')]=_0x4b8721['queue'];this[_0xa0d5('0x1a')]=_0x4b8721['connectedlinename'];this[_0xa0d5('0x1b')]=_0x4b8721[_0xa0d5('0x1b')];this[_0xa0d5('0x1c')]=_0x2b935d['callback'];this['callbackuniqueid']=_0x2b935d['callbackuniqueid'];this[_0xa0d5('0x1d')]=_0x2b935d[_0xa0d5('0x1d')];this[_0xa0d5('0x1e')]=_0x2b935d[_0xa0d5('0x1e')];this[_0xa0d5('0x1f')]=_0x2b935d[_0xa0d5('0x1f')];this[_0xa0d5('0x20')]=_0x2b935d[_0xa0d5('0x20')];this[_0xa0d5('0x21')]=_0x2b935d['UserId'];this[_0xa0d5('0x22')]=_0x2b935d[_0xa0d5('0x22')];this[_0xa0d5('0x23')]=_0x2b935d[_0xa0d5('0x23')];this[_0xa0d5('0x24')]=_0x2b935d['originatecalleridnum']||'';this[_0xa0d5('0x25')]=_0x2b935d['originatecalleridname']||'';this['agiafterat']=_0x2b935d[_0xa0d5('0x26')];this[_0xa0d5('0x27')]=_0x2b935d[_0xa0d5('0x27')];this[_0xa0d5('0x28')]=_0x2b935d[_0xa0d5('0x28')];}module[_0xa0d5('0x29')]=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 7ab8a1e..d1f5850 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 _0xcaf2=['../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','temp','error','getContactDialerIvr','dialOrderByScheduledAt','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer'];(function(_0x140308,_0x3443fc){var _0xc1f132=function(_0x26c0e6){while(--_0x26c0e6){_0x140308['push'](_0x140308['shift']());}};_0xc1f132(++_0x3443fc);}(_0xcaf2,0x8a));var _0x2caf=function(_0x3ae34a,_0x143082){_0x3ae34a=_0x3ae34a-0x0;var _0x4c9edc=_0xcaf2[_0x3ae34a];return _0x4c9edc;};'use strict';var util=require(_0x2caf('0x0'));var logger=require('../../../../config/logger')(_0x2caf('0x1'));var cmHopper=require(_0x2caf('0x2'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x2caf('0x3'));var cmHopperHistory=require(_0x2caf('0x4'));function inspectError(_0x5b4a90){return util[_0x2caf('0x5')](_0x5b4a90,{'showHidden':![],'depth':null});}function getContactDialer(_0x4d046b,_0x335e3c,_0xae320c){return cmHopper[_0x2caf('0x6')](_0x4d046b['id'],_0x335e3c,_0xae320c,_0x4d046b['dialOrderByScheduledAt'])[_0x2caf('0x7')](function(_0x314486){_0x4d046b[_0x2caf('0x8')]=0x0;logger[_0x2caf('0x9')]('[getContactDialer]',inspectError(_0x314486));});}exports[_0x2caf('0x6')]=getContactDialer;function getContactDialerIvr(_0xb56cd1,_0x45e520){return cmHopper[_0x2caf('0xa')](_0xb56cd1['id'],_0x45e520,_0xb56cd1[_0x2caf('0xb')])[_0x2caf('0x7')](function(_0x1b20e3){_0xb56cd1[_0x2caf('0x8')]=0x0;logger[_0x2caf('0x9')]('[getContactDialerIvr]',inspectError(_0x1b20e3));});}exports[_0x2caf('0xa')]=getContactDialerIvr;function countReScheduled(_0xc494fc){return cmHopper[_0x2caf('0xc')](_0xc494fc)[_0x2caf('0x7')](function(_0x1dda08){logger[_0x2caf('0x9')](_0x2caf('0xd'),inspectError(_0x1dda08));});}exports[_0x2caf('0xc')]=countReScheduled;function rescheduleContact(_0x5106fd){return cmHopper[_0x2caf('0xe')](_0x5106fd)[_0x2caf('0x7')](function(_0x502033){logger['error']('[rescheduleContact]',inspectError(_0x502033));});}exports[_0x2caf('0xe')]=rescheduleContact;function unlockContact(_0x4da5ba,_0x388e05,_0xa75896){return cmHopper[_0x2caf('0xf')](_0x4da5ba,_0x388e05,_0xa75896)[_0x2caf('0x7')](function(_0x486b8d){logger[_0x2caf('0x9')]('[unlockContact]',inspectError(_0x486b8d));});}exports[_0x2caf('0xf')]=unlockContact;function moveContactManagedDialer(_0x57f3cd){return cmHopper['moveContactManagedDialer'](_0x57f3cd)[_0x2caf('0x7')](function(_0x58047b){logger[_0x2caf('0x9')](_0x2caf('0x10'),inspectError(_0x58047b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x12624b){return cmHopperBlack[_0x2caf('0x11')](_0x12624b)[_0x2caf('0x7')](function(_0x255c08){logger[_0x2caf('0x9')]('[checkIsBlackList]',inspectError(_0x255c08));});}exports[_0x2caf('0x11')]=checkIsBlackList;function checkIsBlackListIvr(_0x3eac27){return cmHopperBlack[_0x2caf('0x12')](_0x3eac27)[_0x2caf('0x7')](function(_0x424d42){logger[_0x2caf('0x9')](_0x2caf('0x13'),inspectError(_0x424d42));});}exports[_0x2caf('0x12')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3332b1,_0xb60d47,_0x6814bc){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x3332b1,_0xb60d47,_0x6814bc)[_0x2caf('0x7')](function(_0x14bfd2){logger[_0x2caf('0x9')](_0x2caf('0x14'),inspectError(_0x14bfd2));});}exports[_0x2caf('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x25ebea,_0x392196,_0x164da){return cmHopperAdditionalPhone[_0x2caf('0x16')](_0x25ebea,_0x392196,_0x164da)[_0x2caf('0x7')](function(_0x5ad211){logger[_0x2caf('0x9')](_0x2caf('0x17'),inspectError(_0x5ad211));});}exports[_0x2caf('0x16')]=swapAdditionalPhones;function avgHandleTime(_0x37b08f){return cmHopperHistory[_0x2caf('0x18')](_0x37b08f)[_0x2caf('0x7')](function(_0x13e8d9){logger[_0x2caf('0x9')](_0x2caf('0x19'),inspectError(_0x13e8d9));});}exports[_0x2caf('0x18')]=avgHandleTime;function createHistory(_0x30da75){return cmHopperHistory[_0x2caf('0x1a')](_0x30da75)[_0x2caf('0x7')](function(_0x48b5f7){logger[_0x2caf('0x9')](_0x2caf('0x1b'),inspectError(_0x48b5f7));});}exports[_0x2caf('0x1a')]=createHistory; \ No newline at end of file +var _0xa46e=['getContactDialerIvr','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]'];(function(_0x45d5ef,_0x10c29b){var _0x474d19=function(_0xc182bf){while(--_0xc182bf){_0x45d5ef['push'](_0x45d5ef['shift']());}};_0x474d19(++_0x10c29b);}(_0xa46e,0x8a));var _0xea46=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xa46e[_0x10852d];return _0x13a8d6;};'use strict';var util=require(_0xea46('0x0'));var logger=require(_0xea46('0x1'))('dialer');var cmHopper=require(_0xea46('0x2'));var cmHopperAdditionalPhone=require(_0xea46('0x3'));var cmHopperBlack=require(_0xea46('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x19f135){return util['inspect'](_0x19f135,{'showHidden':![],'depth':null});}function getContactDialer(_0x3a2209,_0x47d633,_0x3599fc){return cmHopper['getContactDialer'](_0x3a2209['id'],_0x47d633,_0x3599fc,_0x3a2209[_0xea46('0x5')])[_0xea46('0x6')](function(_0x5f1cd1){_0x3a2209[_0xea46('0x7')]=0x0;logger[_0xea46('0x8')](_0xea46('0x9'),inspectError(_0x5f1cd1));});}exports[_0xea46('0xa')]=getContactDialer;function getContactDialerIvr(_0x468322,_0x4cf206){return cmHopper['getContactDialerIvr'](_0x468322['id'],_0x4cf206,_0x468322['dialOrderByScheduledAt'])[_0xea46('0x6')](function(_0x45550a){_0x468322['temp']=0x0;logger[_0xea46('0x8')](_0xea46('0xb'),inspectError(_0x45550a));});}exports[_0xea46('0xc')]=getContactDialerIvr;function countReScheduled(_0x594694){return cmHopper[_0xea46('0xd')](_0x594694)[_0xea46('0x6')](function(_0x4e10f3){logger[_0xea46('0x8')](_0xea46('0xe'),inspectError(_0x4e10f3));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x20955e){return cmHopper['rescheduleContact'](_0x20955e)[_0xea46('0x6')](function(_0x42c328){logger[_0xea46('0x8')](_0xea46('0xf'),inspectError(_0x42c328));});}exports[_0xea46('0x10')]=rescheduleContact;function unlockContact(_0x2ef436,_0x81ee45,_0x20a79c){return cmHopper[_0xea46('0x11')](_0x2ef436,_0x81ee45,_0x20a79c)['catch'](function(_0x2fa2f9){logger[_0xea46('0x8')](_0xea46('0x12'),inspectError(_0x2fa2f9));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x58b4da){return cmHopper[_0xea46('0x13')](_0x58b4da)[_0xea46('0x6')](function(_0x5cf5dd){logger['error'](_0xea46('0x14'),inspectError(_0x5cf5dd));});}exports[_0xea46('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x4ff93d){return cmHopperBlack[_0xea46('0x15')](_0x4ff93d)[_0xea46('0x6')](function(_0x1adba1){logger[_0xea46('0x8')]('[checkIsBlackList]',inspectError(_0x1adba1));});}exports[_0xea46('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x4e220f){return cmHopperBlack['checkIsBlackListIvr'](_0x4e220f)[_0xea46('0x6')](function(_0x59e431){logger['error']('[checkIsBlackListIvr]',inspectError(_0x59e431));});}exports[_0xea46('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x36f982,_0x3d1850,_0x5beb44){return cmHopperAdditionalPhone[_0xea46('0x17')](_0x36f982,_0x3d1850,_0x5beb44)['catch'](function(_0x12e688){logger[_0xea46('0x8')]('[verifyAdditionalPhone]',inspectError(_0x12e688));});}exports[_0xea46('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5480eb,_0x2b3a8f,_0x114bf9){return cmHopperAdditionalPhone[_0xea46('0x18')](_0x5480eb,_0x2b3a8f,_0x114bf9)['catch'](function(_0x5d2de1){logger[_0xea46('0x8')](_0xea46('0x19'),inspectError(_0x5d2de1));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x3b3928){return cmHopperHistory['avgHandleTime'](_0x3b3928)[_0xea46('0x6')](function(_0x51ca27){logger[_0xea46('0x8')](_0xea46('0x1a'),inspectError(_0x51ca27));});}exports[_0xea46('0x1b')]=avgHandleTime;function createHistory(_0x44517d){return cmHopperHistory[_0xea46('0x1c')](_0x44517d)[_0xea46('0x6')](function(_0x4a5149){logger[_0xea46('0x8')](_0xea46('0x1d'),inspectError(_0x4a5149));});}exports[_0xea46('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 6328e2b..5b14379 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 _0x80a0=['dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','status','TrunkBackup','includes','INACTIVE','loggedIn','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','available','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x80a0,0x187));var _0x080a=function(_0x2b0973,_0xc46bce){_0x2b0973=_0x2b0973-0x0;var _0x45dac4=_0x80a0[_0x2b0973];return _0x45dac4;};'use strict';var _=require(_0x080a('0x0'));var moment=require(_0x080a('0x1'));var util=require(_0x080a('0x2'));var logger=require(_0x080a('0x3'))('dialer');var timezones=require(_0x080a('0x4'))[_0x080a('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x080a('0x6'),'BLACKLIST':_0x080a('0x7'),'CONTACTS_RESCHEDULED':_0x080a('0x8'),'DEACTIVATED':_0x080a('0x9'),'DISACTIVED':_0x080a('0xa'),'EMPTY_INTERVAL':_0x080a('0xb'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x080a('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x080a('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x080a('0xe'),'QUEUE_RECALL':_0x080a('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x080a('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2fa296){return _0x2fa296[_0x080a('0x11')]===_0x080a('0x12');}exports[_0x080a('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x11b437){return _0x11b437[_0x080a('0x14')]===_0x080a('0x15');}exports[_0x080a('0x16')]=isIVRCampaign;function isOutboundQueue(_0x32c89e){return _0x32c89e[_0x080a('0x14')]===_0x080a('0x17');}exports[_0x080a('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x17285b){return _0x17285b[_0x080a('0x19')];}exports[_0x080a('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2bfc63){return _0x2bfc63[_0x080a('0x1b')];}exports[_0x080a('0x1c')]=isIVRCampaignActive;function getSeconds(_0x499fe8,_0x2f7432){var _0x2fbb00=moment(_0x499fe8)[_0x080a('0x1d')](0x0);var _0x1cce37=moment(_0x2f7432)['milliseconds'](0x0);return _0x2fbb00[_0x080a('0x1e')](_0x1cce37,_0x080a('0x1f'));}exports[_0x080a('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x1d3a86,_0x2feadf){var _0x297b33=![];var _0x2b8b83=_0x1d3a86['dialMethod']!==_0x2feadf[_0x080a('0x11')]||_0x1d3a86[_0x080a('0x19')]!==_0x2feadf['dialActive']||_0x1d3a86['message']!==_0x2feadf['message'];var _0x266e50=_0x1d3a86[_0x080a('0x21')]!==_0x2feadf[_0x080a('0x21')]||_0x1d3a86['loggedIn']!==_0x2feadf['loggedIn']||_0x1d3a86[_0x080a('0x22')]!==_0x2feadf[_0x080a('0x22')]||_0x1d3a86[_0x080a('0x23')]!==_0x2feadf[_0x080a('0x23')]||_0x1d3a86[_0x080a('0x24')]!==_0x2feadf[_0x080a('0x24')]||_0x1d3a86['pTalking']!==_0x2feadf[_0x080a('0x25')]||_0x1d3a86[_0x080a('0x26')]!==_0x2feadf['waiting']||_0x1d3a86[_0x080a('0x27')]!==_0x2feadf['inUse']||_0x1d3a86[_0x080a('0x28')]!==_0x2feadf[_0x080a('0x28')];if(_0x1d3a86[_0x080a('0x29')]&&_0x2feadf[_0x080a('0x29')]){_0x297b33=_0x1d3a86['Trunk']['name']!==_0x2feadf['Trunk'][_0x080a('0x2a')]||_0x1d3a86[_0x080a('0x29')][_0x080a('0x1b')]!==_0x2feadf[_0x080a('0x29')][_0x080a('0x1b')];}return _0x2b8b83||_0x266e50||_0x297b33;}exports[_0x080a('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x256d1b){var _0x54ae9e=null;var _0x3db502=_0x256d1b[_0x080a('0x2c')];if(_[_0x080a('0x2d')](_0x256d1b[_0x080a('0x2e')])||_[_0x080a('0x2d')](_0x256d1b[_0x080a('0x2f')])||_[_0x080a('0x2d')](_0x256d1b[_0x080a('0x2f')][_0x080a('0x30')])){_0x54ae9e=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x080a('0x31')](_0x256d1b[_0x080a('0x2e')])||_[_0x080a('0x31')](_0x256d1b['Interval'][_0x080a('0x30')])){_0x54ae9e=CAMPAIGN_STATUS[_0x080a('0x32')];}else if(_0x3db502&&!timezones[_0x3db502]){_0x54ae9e=CAMPAIGN_STATUS[_0x080a('0x33')];}return _0x54ae9e;}function checkAnyValidTrunk(_0x177589,_0x2099c7){var _0x568994=null;var _0x2bcde7=_0x080a('0x34');var _0x48b167=['reachable',_0x080a('0x35')];var _0x260194=!![];if(_0x177589[_0x080a('0x29')]&&_0x177589[_0x080a('0x29')][_0x080a('0x1b')]){_0x2bcde7+=_0x177589['Trunk']['name'];_0x568994=_0x2099c7[_0x2bcde7];_0x260194=_0x48b167['includes'](_0x568994[_0x080a('0x36')]);}else if(_0x177589[_0x080a('0x37')]&&_0x177589[_0x080a('0x37')][_0x080a('0x1b')]){_0x2bcde7+=_0x177589[_0x080a('0x37')][_0x080a('0x2a')];_0x568994=_0x2099c7[_0x2bcde7];_0x260194=_0x48b167[_0x080a('0x38')](_0x568994[_0x080a('0x36')]);}return _0x260194;}function getQueueCampaignStatusMessage(_0x335b9a,_0x398032){var _0x5e1381=CAMPAIGN_STATUS[_0x080a('0x6')];var _0x452bd5=isPreviewCampaign(_0x335b9a);if(!isQueueCampaignActive(_0x335b9a)){if(_0x452bd5){_0x5e1381=CAMPAIGN_STATUS[_0x080a('0x39')];}else{if(_0x335b9a[_0x080a('0x28')]===0x0&&_0x335b9a[_0x080a('0x24')]===0x0&&_0x335b9a[_0x080a('0x26')]===0x0&&(_0x335b9a[_0x080a('0x25')]||0x0)===0x0){_0x5e1381=CAMPAIGN_STATUS['INACTIVE'];}else{_0x5e1381=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x335b9a[_0x080a('0x3a')]===0x0){_0x5e1381=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x335b9a,_0x398032)){_0x5e1381=CAMPAIGN_STATUS[_0x080a('0x3b')];}else if(!isPreviewCampaign(_0x335b9a)){var _0x8db75f=checkAnyValidQueueCampaignInterval(_0x335b9a);if(_0x8db75f){_0x5e1381=_0x8db75f;}}return _0x5e1381;}exports[_0x080a('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xb379b4){var _0x173a24=CAMPAIGN_STATUS[_0x080a('0x3d')];if(_0xb379b4['originated']===0x0&&_0xb379b4[_0x080a('0x24')]===0x0&&_0xb379b4['waiting']===0x0&&(_0xb379b4[_0x080a('0x25')]||0x0)===0x0){_0x173a24=CAMPAIGN_STATUS[_0x080a('0x39')];}return _0x173a24;}exports[_0x080a('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x197afa){var _0x375033=_0x197afa[_0x080a('0x3f')](/"(.*?)"/);return _0x375033?_0x375033[0x1]:_0x197afa;}exports[_0x080a('0x40')]=extractCalleridName;function getCallerId(_0x51532a,_0x127a6a,_0x3ad9a6){if(!_[_0x080a('0x41')](_0x3ad9a6)&&typeof _0x3ad9a6==='string'&&!_[_0x080a('0x31')](_0x3ad9a6)){if(!_['isUndefined'](_0x127a6a)&&typeof _0x127a6a===_0x080a('0x42')&&!_[_0x080a('0x31')](_0x127a6a)){return util[_0x080a('0x43')](_0x080a('0x44'),_0x127a6a,_0x3ad9a6);}return util['format'](_0x080a('0x44'),_0x3ad9a6,_0x3ad9a6);}if(!_[_0x080a('0x41')](_0x51532a)&&typeof _0x51532a==='string'&&!_[_0x080a('0x31')](_0x51532a)){return _0x51532a;}return _0x080a('0x45');}exports[_0x080a('0x46')]=getCallerId;function getCallerIdRandom(_0x740cfb,_0x1f7cf0){var _0x3f90ad;var _0x3030b1;var _0x50d488;if(_0x1f7cf0<=0x0){_0x1f7cf0=0x1;}_0x3f90ad=new RegExp(_0x080a('0x47')+_0x1f7cf0+'}$');_0x3030b1=Math[_0x080a('0x48')](0xa,_0x1f7cf0-0x1);_0x50d488=Math['pow'](0xa,_0x1f7cf0)-0x1;return util[_0x080a('0x43')]('%s',_[_0x080a('0x49')](_0x740cfb,_0x3f90ad,_[_0x080a('0x4a')](_0x3030b1,_0x50d488)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x106626){if(_0x106626['originated']&&_0x106626[_0x080a('0x28')]>0x0){_0x106626[_0x080a('0x28')]-=0x1;}else{logger[_0x080a('0x4b')](_0x080a('0x4c'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x805bbc){return _0x805bbc&&_0x805bbc[_0x080a('0x4d')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x54432f,_0x356523){if(_0x356523===0x0){return 0x0;}var _0x4d6cc8=0x1;for(var _0x1cfed3=0x1;_0x1cfed3<=_0x356523;_0x1cfed3+=0x1){_0x4d6cc8=0x1+_0x4d6cc8*_0x1cfed3/_0x54432f;}return 0x1/_0x4d6cc8;}exports[_0x080a('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x1728b7,_0xa2c122,_0x4430c4){if(_0xa2c122>_0x4430c4){for(var _0x3452ed=0x0;_0x3452ed<_0xa2c122-_0x4430c4;_0x3452ed+=0x1){decrementOriginate(_0x1728b7);}}}exports[_0x080a('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2f6b65){var _0x59a7e4={};var _0x4fcc68=['id',_0x080a('0x50'),'description',_0x080a('0x51'),_0x080a('0x52')];if(_0x2f6b65){for(var _0x38acc4 in _0x2f6b65){if(typeof _0x2f6b65[_0x38acc4]!==_0x080a('0x53')){if(!_[_0x080a('0x2d')](_0x2f6b65[_0x38acc4])&&!_0x4fcc68[_0x080a('0x38')](_0x38acc4)){_0x59a7e4[util[_0x080a('0x43')]('%s%s',_0x080a('0x54'),_0x38acc4[_0x080a('0x55')]())]=_0x2f6b65[_0x38acc4];}}}}return _0x59a7e4;}exports[_0x080a('0x56')]=setXMDContactVariables; \ No newline at end of file +var _0x2a83=['error','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','description','tags','updatedAt','%s%s','XMD-','lodash','moment','util','../../../../config/logger','dialer','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','outbound','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','replace','random'];(function(_0x463b6a,_0x2ea1a3){var _0x10e1b8=function(_0x515501){while(--_0x515501){_0x463b6a['push'](_0x463b6a['shift']());}};_0x10e1b8(++_0x2ea1a3);}(_0x2a83,0xb7));var _0x32a8=function(_0xc7ed6a,_0x5bf601){_0xc7ed6a=_0xc7ed6a-0x0;var _0x3b3f5f=_0x2a83[_0xc7ed6a];return _0x3b3f5f;};'use strict';var _=require(_0x32a8('0x0'));var moment=require(_0x32a8('0x1'));var util=require(_0x32a8('0x2'));var logger=require(_0x32a8('0x3'))(_0x32a8('0x4'));var timezones=require('../../../../config/environment/shared')[_0x32a8('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x32a8('0x6'),'CONTACTS_RESCHEDULED':_0x32a8('0x7'),'DEACTIVATED':_0x32a8('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x32a8('0x9'),'INACTIVE':_0x32a8('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x32a8('0xb'),'NULL_INTERVAL':_0x32a8('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x32a8('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x32a8('0xe'),'RUNNING':_0x32a8('0xf'),'UNKNOWN_TIMEZONE':_0x32a8('0x10'),'UNREACHABLE_TRUNK':_0x32a8('0x11')};exports[_0x32a8('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x9fab81){return _0x9fab81[_0x32a8('0x13')]===_0x32a8('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x213d79){return _0x213d79[_0x32a8('0x15')]===_0x32a8('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x3fdd7d){return _0x3fdd7d[_0x32a8('0x15')]===_0x32a8('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x2896b6){return _0x2896b6['dialActive'];}exports[_0x32a8('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x7cbb28){return _0x7cbb28[_0x32a8('0x19')];}exports[_0x32a8('0x1a')]=isIVRCampaignActive;function getSeconds(_0x4236d0,_0x1d7f9c){var _0x421cd1=moment(_0x4236d0)[_0x32a8('0x1b')](0x0);var _0x2349ca=moment(_0x1d7f9c)[_0x32a8('0x1b')](0x0);return _0x421cd1[_0x32a8('0x1c')](_0x2349ca,_0x32a8('0x1d'));}exports[_0x32a8('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x1beb94,_0x19b0c5){var _0x53dc4e=![];var _0x1ee6be=_0x1beb94[_0x32a8('0x13')]!==_0x19b0c5[_0x32a8('0x13')]||_0x1beb94['dialActive']!==_0x19b0c5[_0x32a8('0x1f')]||_0x1beb94[_0x32a8('0x20')]!==_0x19b0c5[_0x32a8('0x20')];var _0x46fbe7=_0x1beb94[_0x32a8('0x21')]!==_0x19b0c5[_0x32a8('0x21')]||_0x1beb94[_0x32a8('0x22')]!==_0x19b0c5['loggedIn']||_0x1beb94[_0x32a8('0x23')]!==_0x19b0c5[_0x32a8('0x23')]||_0x1beb94[_0x32a8('0x24')]!==_0x19b0c5['paused']||_0x1beb94[_0x32a8('0x25')]!==_0x19b0c5['talking']||_0x1beb94[_0x32a8('0x26')]!==_0x19b0c5[_0x32a8('0x26')]||_0x1beb94[_0x32a8('0x27')]!==_0x19b0c5[_0x32a8('0x27')]||_0x1beb94['inUse']!==_0x19b0c5['inUse']||_0x1beb94[_0x32a8('0x28')]!==_0x19b0c5[_0x32a8('0x28')];if(_0x1beb94[_0x32a8('0x29')]&&_0x19b0c5['Trunk']){_0x53dc4e=_0x1beb94[_0x32a8('0x29')]['name']!==_0x19b0c5['Trunk'][_0x32a8('0x2a')]||_0x1beb94[_0x32a8('0x29')][_0x32a8('0x19')]!==_0x19b0c5[_0x32a8('0x29')][_0x32a8('0x19')];}return _0x1ee6be||_0x46fbe7||_0x53dc4e;}exports[_0x32a8('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4c8e53){var _0x278990=null;var _0x200aac=_0x4c8e53[_0x32a8('0x2c')];if(_[_0x32a8('0x2d')](_0x4c8e53[_0x32a8('0x2e')])||_['isNil'](_0x4c8e53[_0x32a8('0x2f')])||_['isNil'](_0x4c8e53[_0x32a8('0x2f')][_0x32a8('0x30')])){_0x278990=CAMPAIGN_STATUS[_0x32a8('0x31')];}else if(_['isEmpty'](_0x4c8e53['dialGlobalInterval'])||_['isEmpty'](_0x4c8e53['Interval'][_0x32a8('0x30')])){_0x278990=CAMPAIGN_STATUS[_0x32a8('0x32')];}else if(_0x200aac&&!timezones[_0x200aac]){_0x278990=CAMPAIGN_STATUS[_0x32a8('0x33')];}return _0x278990;}function checkAnyValidTrunk(_0x3446f1,_0x4982db){var _0x214813=null;var _0x13f2d5='SIP/';var _0x327afa=[_0x32a8('0x34'),_0x32a8('0x35')];var _0x5debbe=!![];if(_0x3446f1[_0x32a8('0x29')]&&_0x3446f1[_0x32a8('0x29')][_0x32a8('0x19')]){_0x13f2d5+=_0x3446f1['Trunk']['name'];_0x214813=_0x4982db[_0x13f2d5];_0x5debbe=_0x327afa[_0x32a8('0x36')](_0x214813[_0x32a8('0x37')]);}else if(_0x3446f1[_0x32a8('0x38')]&&_0x3446f1['TrunkBackup'][_0x32a8('0x19')]){_0x13f2d5+=_0x3446f1[_0x32a8('0x38')][_0x32a8('0x2a')];_0x214813=_0x4982db[_0x13f2d5];_0x5debbe=_0x327afa['includes'](_0x214813['status']);}return _0x5debbe;}function getQueueCampaignStatusMessage(_0x39d929,_0x3b5530){var _0x624f73=CAMPAIGN_STATUS[_0x32a8('0x39')];var _0x4faf36=isPreviewCampaign(_0x39d929);if(!isQueueCampaignActive(_0x39d929)){if(_0x4faf36){_0x624f73=CAMPAIGN_STATUS[_0x32a8('0x3a')];}else{if(_0x39d929['originated']===0x0&&_0x39d929['talking']===0x0&&_0x39d929[_0x32a8('0x27')]===0x0&&(_0x39d929[_0x32a8('0x26')]||0x0)===0x0){_0x624f73=CAMPAIGN_STATUS[_0x32a8('0x3a')];}else{_0x624f73=CAMPAIGN_STATUS[_0x32a8('0x3b')];}}}else if(_0x39d929[_0x32a8('0x22')]===0x0){_0x624f73=CAMPAIGN_STATUS[_0x32a8('0x3c')];}else if(!checkAnyValidTrunk(_0x39d929,_0x3b5530)){_0x624f73=CAMPAIGN_STATUS[_0x32a8('0x3d')];}else if(!isPreviewCampaign(_0x39d929)){var _0x14bf7e=checkAnyValidQueueCampaignInterval(_0x39d929);if(_0x14bf7e){_0x624f73=_0x14bf7e;}}return _0x624f73;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xde141e){var _0x5f5583=CAMPAIGN_STATUS[_0x32a8('0x3b')];if(_0xde141e[_0x32a8('0x28')]===0x0&&_0xde141e['talking']===0x0&&_0xde141e[_0x32a8('0x27')]===0x0&&(_0xde141e[_0x32a8('0x26')]||0x0)===0x0){_0x5f5583=CAMPAIGN_STATUS[_0x32a8('0x3a')];}return _0x5f5583;}exports[_0x32a8('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x385b46){var _0x40d539=_0x385b46[_0x32a8('0x3f')](/"(.*?)"/);return _0x40d539?_0x40d539[0x1]:_0x385b46;}exports[_0x32a8('0x40')]=extractCalleridName;function getCallerId(_0xf13a57,_0x1fd29d,_0x309224){if(!_['isUndefined'](_0x309224)&&typeof _0x309224===_0x32a8('0x41')&&!_['isEmpty'](_0x309224)){if(!_[_0x32a8('0x42')](_0x1fd29d)&&typeof _0x1fd29d===_0x32a8('0x41')&&!_[_0x32a8('0x43')](_0x1fd29d)){return util['format'](_0x32a8('0x44'),_0x1fd29d,_0x309224);}return util[_0x32a8('0x45')]('\x22%s\x22\x20<%s>',_0x309224,_0x309224);}if(!_['isUndefined'](_0xf13a57)&&typeof _0xf13a57===_0x32a8('0x41')&&!_[_0x32a8('0x43')](_0xf13a57)){return _0xf13a57;}return'\x22\x22\x20<>';}exports[_0x32a8('0x46')]=getCallerId;function getCallerIdRandom(_0x3ad33d,_0x544fc2){var _0x5b5093;var _0x3e4365;var _0x5f5c97;if(_0x544fc2<=0x0){_0x544fc2=0x1;}_0x5b5093=new RegExp(_0x32a8('0x47')+_0x544fc2+'}$');_0x3e4365=Math['pow'](0xa,_0x544fc2-0x1);_0x5f5c97=Math[_0x32a8('0x48')](0xa,_0x544fc2)-0x1;return util[_0x32a8('0x45')]('%s',_[_0x32a8('0x49')](_0x3ad33d,_0x5b5093,_[_0x32a8('0x4a')](_0x3e4365,_0x5f5c97)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x55ac72){if(_0x55ac72[_0x32a8('0x28')]&&_0x55ac72[_0x32a8('0x28')]>0x0){_0x55ac72[_0x32a8('0x28')]-=0x1;}else{logger[_0x32a8('0x4b')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x32a8('0x4c')]=decrementOriginate;function checkContactEmpty(_0x5acf18){return _0x5acf18&&_0x5acf18[_0x32a8('0x4d')]>0x0;}exports[_0x32a8('0x4e')]=checkContactEmpty;function erlangb(_0x5d6f04,_0x5dc8f9){if(_0x5dc8f9===0x0){return 0x0;}var _0x445755=0x1;for(var _0x332905=0x1;_0x332905<=_0x5dc8f9;_0x332905+=0x1){_0x445755=0x1+_0x445755*_0x332905/_0x5d6f04;}return 0x1/_0x445755;}exports[_0x32a8('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x4c213e,_0x29d938,_0x54ec2c){if(_0x29d938>_0x54ec2c){for(var _0x186831=0x0;_0x186831<_0x29d938-_0x54ec2c;_0x186831+=0x1){decrementOriginate(_0x4c213e);}}}exports[_0x32a8('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x93a925){var _0x248f08={};var _0x2040cf=['id','createdAt',_0x32a8('0x51'),_0x32a8('0x52'),_0x32a8('0x53')];if(_0x93a925){for(var _0x4e5b2c in _0x93a925){if(typeof _0x93a925[_0x4e5b2c]!=='undefined'){if(!_[_0x32a8('0x2d')](_0x93a925[_0x4e5b2c])&&!_0x2040cf[_0x32a8('0x36')](_0x4e5b2c)){_0x248f08[util['format'](_0x32a8('0x54'),_0x32a8('0x55'),_0x4e5b2c['toUpperCase']())]=_0x93a925[_0x4e5b2c];}}}}return _0x248f08;}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 2cafced..9d9e3fd 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(_0x27d1e1,_0x3cea80){var _0xb3a85f=function(_0x10c70f){while(--_0x10c70f){_0x27d1e1['push'](_0x27d1e1['shift']());}};_0xb3a85f(++_0x3cea80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x5943ff,_0x4b76d2){var _0x201c8d=function(_0x55c6de){while(--_0x55c6de){_0x5943ff['push'](_0x5943ff['shift']());}};_0x201c8d(++_0x4b76d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 c42ca37..218b992 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 _0xa87b=['\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','bind','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','error'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa87b,0x12e));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xba87('0x0'));var _=require(_0xba87('0x1'));var BPromise=require(_0xba87('0x2'));var uuid=require('uuid');var moment=require(_0xba87('0x3'));var path=require(_0xba87('0x4'));var tiff2pdf=require(_0xba87('0x5'));var gs=require(_0xba87('0x6'));var logger=require('../../../config/logger')(_0xba87('0x7'));var ami=require(_0xba87('0x8'));var rpcDb=require(_0xba87('0x9'));var Channel=require(_0xba87('0xa'));var ut=require(_0xba87('0xb'));var Action=require(_0xba87('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xba87('0xd'));var faxMessage=require(_0xba87('0xe'));function Fax(_0x21bb2e){this[_0xba87('0xf')]={};this[_0xba87('0x10')]=_0x21bb2e[_0xba87('0x10')];this[_0xba87('0x11')]=_0x21bb2e[_0xba87('0x11')];this[_0xba87('0x12')]={};ami['on'](_0xba87('0x13'),this[_0xba87('0x14')]['bind'](this));ami['on'](_0xba87('0x15'),this[_0xba87('0x16')]['bind'](this));ami['on'](_0xba87('0x17'),this[_0xba87('0x18')]['bind'](this));ami['on'](_0xba87('0x19'),this[_0xba87('0x1a')]['bind'](this));ami['on']('faxstatus',this[_0xba87('0x1b')][_0xba87('0x1c')](this));ami['on'](_0xba87('0x1d'),this[_0xba87('0x1e')][_0xba87('0x1c')](this));ami['on'](_0xba87('0x1f'),this[_0xba87('0x20')][_0xba87('0x1c')](this));ami['on'](_0xba87('0x21'),this[_0xba87('0x22')][_0xba87('0x1c')](this));}Fax[_0xba87('0x23')][_0xba87('0x14')]=function(_0x42a858){if(_0x42a858[_0xba87('0x24')]===_0xba87('0x25')){for(var _0x386386 in this[_0xba87('0x10')]){if(this[_0xba87('0x10')][_0xba87('0x26')](_0x386386)){if(_0x42a858[_0xba87('0x27')]===this[_0xba87('0x10')][_0x386386][_0xba87('0x28')]){this[_0xba87('0xf')][_0x42a858[_0xba87('0x29')]]={};this[_0xba87('0xf')][_0x42a858[_0xba87('0x29')]][_0xba87('0x2a')]=_0x42a858[_0xba87('0x2a')];this[_0xba87('0xf')][_0x42a858[_0xba87('0x29')]]['id']=this['faxAccounts'][_0x386386]['id'];this[_0xba87('0xf')][_0x42a858['uniqueid']][_0xba87('0x2b')]=this['faxAccounts'][_0x386386][_0xba87('0x2b')];logger[_0xba87('0x2c')](_0x42a858[_0xba87('0x29')],_0xba87('0x2d'));}}}}if(this[_0xba87('0x12')][_0x42a858[_0xba87('0x29')]]){this[_0xba87('0xf')][_0x42a858[_0xba87('0x29')]]={};this[_0xba87('0xf')][_0x42a858['uniqueid']][_0xba87('0x2a')]=_0x42a858[_0xba87('0x2a')];logger[_0xba87('0x2c')](_0x42a858['uniqueid'],_0xba87('0x2d'));}};Fax['prototype'][_0xba87('0x16')]=function(_0x32e1fd){if(this[_0xba87('0xf')][_0x32e1fd[_0xba87('0x29')]]){for(var _0x10f561 in _0x32e1fd[_0xba87('0x2e')]){if(_0x32e1fd['variable'][_0xba87('0x26')](_0x10f561)){this[_0xba87('0xf')][_0x32e1fd[_0xba87('0x29')]][_0x10f561]=_0x32e1fd[_0xba87('0x2f')];}}}};Fax[_0xba87('0x23')][_0xba87('0x18')]=function(_0x255957){if(this[_0xba87('0xf')][_0x255957['uniqueid']]){this[_0xba87('0xf')][_0x255957[_0xba87('0x29')]][_0xba87('0x30')]=_0x255957[_0xba87('0x30')];this[_0xba87('0xf')][_0x255957[_0xba87('0x29')]]['channelstatedesc']=_0x255957['channelstatedesc'];}};Fax['prototype'][_0xba87('0x1a')]=function(_0x36fabf){if(this[_0xba87('0xf')][_0x36fabf[_0xba87('0x29')]]){for(var _0x13e16f in _0x36fabf[_0xba87('0x2e')]){if(_0x36fabf[_0xba87('0x2e')][_0xba87('0x26')](_0x13e16f)){this['channels'][_0x36fabf[_0xba87('0x29')]][_0x13e16f]=_0x36fabf[_0xba87('0x2f')];}}}};Fax[_0xba87('0x23')]['syncFaxStatus']=function(_0x1ad4ba){if(this['channels'][_0x1ad4ba['uniqueid']]){this['channels'][_0x1ad4ba[_0xba87('0x29')]][_0xba87('0x31')]=_0x1ad4ba[_0xba87('0x31')];this[_0xba87('0xf')][_0x1ad4ba['uniqueid']][_0xba87('0x32')]=_0x1ad4ba[_0xba87('0x32')];this[_0xba87('0xf')][_0x1ad4ba['uniqueid']][_0xba87('0x28')]=_0x1ad4ba[_0xba87('0x28')];this[_0xba87('0xf')][_0x1ad4ba['uniqueid']][_0xba87('0x33')]=_0x1ad4ba[_0xba87('0x33')];logger[_0xba87('0x2c')](_0x1ad4ba[_0xba87('0x29')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xba87('0x1e')]=function(_0x28ce58){var _0x318433=this;if(this[_0xba87('0xf')][_0x28ce58[_0xba87('0x29')]]){var _0x9e9e5b=this[_0xba87('0xf')][_0x28ce58[_0xba87('0x29')]]['id'];this[_0xba87('0xf')][_0x28ce58['uniqueid']][_0xba87('0x34')]=_0x28ce58[_0xba87('0x34')];this['channels'][_0x28ce58[_0xba87('0x29')]][_0xba87('0x35')]=_0x28ce58['pagestransferred'];this['channels'][_0x28ce58['uniqueid']][_0xba87('0x28')]=_0x28ce58[_0xba87('0x28')];this[_0xba87('0xf')][_0x28ce58[_0xba87('0x29')]][_0xba87('0x36')]=_0x28ce58[_0xba87('0x36')];this['channels'][_0x28ce58[_0xba87('0x29')]]['transferrate']=_0x28ce58[_0xba87('0x37')];this['channels'][_0x28ce58['uniqueid']][_0xba87('0x33')]=_0x28ce58[_0xba87('0x33')];this[_0xba87('0xf')][_0x28ce58['uniqueid']][_0xba87('0x38')]=_0x28ce58[_0xba87('0x38')];if(this[_0xba87('0xf')][_0x28ce58[_0xba87('0x29')]][_0xba87('0x35')]>0x0){tiff2pdf(_0x28ce58[_0xba87('0x33')],_0xba87('0x39'),function(_0x11eb97){logger[_0xba87('0x2c')](_0x28ce58['uniqueid'],_0xba87('0x3a'),_0x11eb97[_0xba87('0x3b')]);attachment[_0xba87('0x3c')]({'name':path['parse'](_0x28ce58[_0xba87('0x33')])[_0xba87('0x2b')],'basename':path[_0xba87('0x3d')](_0x28ce58[_0xba87('0x33')])['name']+_0xba87('0x3e'),'type':_0xba87('0x3f')})[_0xba87('0x40')](function(_0xd8d795){faxAccount[_0xba87('0x41')](_0x9e9e5b,{'from':_0x28ce58[_0xba87('0x38')],'mapKey':'fax','body':path[_0xba87('0x3d')](_0x28ce58[_0xba87('0x33')])[_0xba87('0x2b')]+'.pdf','AttachmentId':_0xd8d795['id']})['catch'](function(_0x314833){logger[_0xba87('0x42')](_0x28ce58[_0xba87('0x29')],_0xba87('0x43'),JSON[_0xba87('0x44')](_0x314833));});})[_0xba87('0x45')](function(_0x53c24c){logger[_0xba87('0x42')](_0x28ce58[_0xba87('0x29')],_0xba87('0x46'),JSON[_0xba87('0x44')](_0x53c24c));});});}logger['info'](_0x28ce58['uniqueid'],_0xba87('0x46'));}};Fax[_0xba87('0x23')][_0xba87('0x22')]=function(_0x2ca38d){if(this[_0xba87('0x12')][_0x2ca38d['uniqueid']]){_[_0xba87('0x47')](this[_0xba87('0xf')][_0x2ca38d[_0xba87('0x29')]],_[_0xba87('0x48')](_0x2ca38d,['response',_0xba87('0x49')]));}};function updateStatus(_0x15b99d){if(_0x15b99d[_0xba87('0x4a')]){faxMessage[_0xba87('0x4b')](_0x15b99d[_0xba87('0x4a')],{'failMessage':_0xba87('0x4c')})[_0xba87('0x40')](function(_0x11a938){ut[_0xba87('0x4d')](_0xba87('0x4e'),_0x11a938);})['catch'](function(_0x3b39b3){ut[_0xba87('0x4d')](_0xba87('0x4f'),_0x3b39b3);});}else{ut[_0xba87('0x4d')](_0xba87('0x50'));}}Fax[_0xba87('0x23')]['updateStatus']=function(_0x1631bf,_0x66cb3,_0x2aa6bb){var _0x444006=this;var _0x106104={};if(_0x66cb3){_0x106104={'read':_0x66cb3};}else{_0x106104={'failMessage':_0x2aa6bb};}if(this[_0xba87('0x12')][_0x1631bf][_0xba87('0x4a')]){faxMessage['update'](this[_0xba87('0x12')][_0x1631bf]['AttachmentId'],_0x106104)[_0xba87('0x40')](function(_0x79b83e){ut[_0xba87('0x4d')]('[Fax][Message][Updated]',_0x79b83e);})[_0xba87('0x45')](function(_0x39eb54){ut[_0xba87('0x4d')](_0xba87('0x51'),_0x39eb54);})['finally'](function(){delete _0x444006[_0xba87('0xf')][_0x1631bf];delete _0x444006[_0xba87('0x12')][_0x1631bf];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this['channels'][_0x1631bf];delete this[_0xba87('0x12')][_0x1631bf];}};Fax[_0xba87('0x23')][_0xba87('0x20')]=function(_0x2b371){var _0x421ed7=this;if(this['channels'][_0x2b371[_0xba87('0x29')]]){if(this['actions'][_0x2b371[_0xba87('0x29')]]){this[_0xba87('0xf')][_0x2b371[_0xba87('0x29')]]['id']=this[_0xba87('0x12')][_0x2b371['uniqueid']]['id'];this[_0xba87('0xf')][_0x2b371[_0xba87('0x29')]][_0xba87('0x2b')]=this[_0xba87('0x12')][_0x2b371[_0xba87('0x29')]][_0xba87('0x2b')];}logger[_0xba87('0x2c')](_0x2b371[_0xba87('0x29')],this[_0xba87('0x12')][_0x2b371['uniqueid']]?_0xba87('0x52'):_0xba87('0x53'),JSON[_0xba87('0x44')](this['channels'][_0x2b371['uniqueid']]));if(this[_0xba87('0x12')][_0x2b371[_0xba87('0x29')]]){if(this[_0xba87('0xf')][_0x2b371[_0xba87('0x29')]][_0xba87('0x54')]>0x0&&this[_0xba87('0xf')][_0x2b371[_0xba87('0x29')]][_0xba87('0x55')]===_0xba87('0x56')){this[_0xba87('0x57')](_0x2b371[_0xba87('0x29')],!![]);}else{this[_0xba87('0x57')](_0x2b371[_0xba87('0x29')],![],this['channels'][_0x2b371[_0xba87('0x29')]][_0xba87('0x58')]?_0xba87('0x59')+this['channels'][_0x2b371['uniqueid']][_0xba87('0x58')]:_0xba87('0x5a'));}}}};Fax[_0xba87('0x23')][_0xba87('0x5b')]=function(_0x18107b){var _0x34c820=this;return new BPromise(function(_0x354a15,_0x4ec878){_0x34c820[_0xba87('0x5c')](_0x18107b,_0x34c820['faxAccounts'][_0x18107b[_0xba87('0x5d')]])[_0xba87('0x40')](function(_0x11d584){ut[_0xba87('0x4d')]('[Fax][execOriginate][success]',_0x11d584);_0x354a15(ut[_0xba87('0x3b')](_0xba87('0x5e')));})[_0xba87('0x45')](function(_0x358640){ut[_0xba87('0x4d')](_0xba87('0x5f'),_0x358640);updateStatus(_0x18107b);_0x4ec878(ut[_0xba87('0x3b')]('Fax\x20failed'));});});};Fax[_0xba87('0x23')][_0xba87('0x60')]=function(_0x251a8b){var _0x1c104f=this;return new BPromise(function(_0x334e57,_0x5a4ae5){var _0x420f30=_0x1c104f[_0xba87('0x61')](_0x1c104f[_0xba87('0x10')][_0x251a8b[_0xba87('0x5d')]][_0xba87('0x62')],_0x251a8b);if(_0x420f30[_0xba87('0x63')]){_0x334e57(ut[_0xba87('0x3b')](_0xba87('0x64')));}else{_0x5a4ae5(ut[_0xba87('0x3b')](_0x420f30[_0xba87('0x3b')]));}});};function originate(_0x4bc6c7,_0x1732cc,_0xd6247d){return new BPromise(function(_0x2399de,_0x423cdb){if(_0xd6247d){var _0xecbc44=util[_0xba87('0x65')](_0xba87('0x66'),path['parse'](_0x4bc6c7['path'])[_0xba87('0x2b')],_0x4bc6c7[_0xba87('0x4')]);gs['execute'](_0xecbc44)[_0xba87('0x40')](function(){_0x4bc6c7[_0xba87('0x4')]=util[_0xba87('0x65')](_0xba87('0x67'),path[_0xba87('0x3d')](_0x4bc6c7[_0xba87('0x4')])['dir'],path[_0xba87('0x3d')](_0x4bc6c7[_0xba87('0x4')])['name']);_0x1732cc[_0xba87('0x68')]=_0x4bc6c7['path'];ut[_0xba87('0x4d')](_0xba87('0x69'),'');ami[_0xba87('0x6a')](ut[_0xba87('0x6b')](_0x4bc6c7,_0x1732cc))[_0xba87('0x40')](function(_0x5bcab5){_0x2399de(_0x5bcab5);})['catch'](function(_0x38576b){_0x423cdb(_0x38576b);});})['catch'](function(_0x4a2f6f){_0x423cdb(_0x4a2f6f);});}else{ami[_0xba87('0x6a')](ut['variablesAction'](_0x4bc6c7,_0x1732cc))[_0xba87('0x40')](function(_0x1199d5){_0x2399de(_0x1199d5);})[_0xba87('0x45')](function(_0x15d644){_0x423cdb(_0x15d644);});}});}Fax['prototype'][_0xba87('0x5c')]=function(_0x39dc70,_0x5819ab){var _0x1ed75b=this;return new BPromise(function(_0x4c967c,_0x1f9556){var _0xecd931=uuid['v4']();var _0xd069d9=ut['addVariables'](_0x39dc70,_0x5819ab);_0x1ed75b[_0xba87('0x12')][_0xecd931]=new Action(_0xecd931,_0x5819ab,_0x39dc70);var _0x348e39=_0x1ed75b[_0xba87('0x12')][_0xecd931];if(path['parse'](_0x39dc70[_0xba87('0x4')])[_0xba87('0x6c')]===_0xba87('0x3e')){originate(_0x348e39,_0xd069d9,!![])[_0xba87('0x40')](function(_0x23ec9d){_0x4c967c(_0x23ec9d);})['catch'](function(_0x5ed054){_0x1f9556(_0x5ed054);});}else{originate(_0x348e39,_0xd069d9,![])[_0xba87('0x40')](function(_0x2a6727){_0x4c967c(_0x2a6727);})[_0xba87('0x45')](function(_0x2d081c){_0x1f9556(_0x2d081c);});}});};Fax[_0xba87('0x23')][_0xba87('0x6d')]=function(_0x3f2f4a){return!_[_0xba87('0x6e')](_0x3f2f4a)&&!_[_0xba87('0x6e')](_0x3f2f4a[_0xba87('0x2b')])&&!_['isNil'](_0x3f2f4a[_0xba87('0x6f')])&&_0x3f2f4a[_0xba87('0x6f')]&&!_['isNil'](this[_0xba87('0x11')][util[_0xba87('0x65')]('SIP/%s',_0x3f2f4a[_0xba87('0x2b')])])&&!_[_0xba87('0x6e')](this[_0xba87('0x11')][util[_0xba87('0x65')](_0xba87('0x70'),_0x3f2f4a[_0xba87('0x2b')])][_0xba87('0x32')])&&(this[_0xba87('0x11')][util['format'](_0xba87('0x70'),_0x3f2f4a[_0xba87('0x2b')])][_0xba87('0x32')]===_0xba87('0x71')||this[_0xba87('0x11')][util[_0xba87('0x65')](_0xba87('0x70'),_0x3f2f4a['name'])][_0xba87('0x32')]===_0xba87('0x72'));};Fax[_0xba87('0x23')][_0xba87('0x61')]=function(_0xb02235,_0x25eb85){if(!this['isTrunkReachable'](_0xb02235)){ut[_0xba87('0x4d')](_0xba87('0x73'),_['isNil'](_0xb02235)?'':_0xb02235['name']+_0xba87('0x74'));return{'isValid':![],'message':_0xba87('0x75')};}if(_['isNil'](_0x25eb85[_0xba87('0x7')])){ut[_0xba87('0x4d')](_0xba87('0x76'),JSON[_0xba87('0x44')](_0x25eb85));return{'isValid':![],'message':_0xba87('0x77')};}if(_[_0xba87('0x6e')](_0x25eb85[_0xba87('0x4')])){ut['logger'](_0xba87('0x78'),JSON[_0xba87('0x44')](_0x25eb85));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xba87('0x79')};};module[_0xba87('0x7a')]=Fax; \ No newline at end of file +var _0x7c24=['.pdf','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','status','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncFaxStatus','receivefax','syncReceiveFax','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','channelstatedesc','syncNewExten','value','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7c24,0x1dc));var _0x47c2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7c24[_0x3e5086];return _0xfeb102;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x47c2('0x0'));var moment=require(_0x47c2('0x1'));var path=require(_0x47c2('0x2'));var tiff2pdf=require(_0x47c2('0x3'));var gs=require(_0x47c2('0x4'));var logger=require(_0x47c2('0x5'))(_0x47c2('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x47c2('0x7'));var ut=require(_0x47c2('0x8'));var Action=require(_0x47c2('0x9'));var faxAccount=require(_0x47c2('0xa'));var attachment=require(_0x47c2('0xb'));var faxMessage=require(_0x47c2('0xc'));function Fax(_0x3b2f49){this['channels']={};this[_0x47c2('0xd')]=_0x3b2f49[_0x47c2('0xd')];this[_0x47c2('0xe')]=_0x3b2f49[_0x47c2('0xe')];this['actions']={};ami['on'](_0x47c2('0xf'),this[_0x47c2('0x10')][_0x47c2('0x11')](this));ami['on'](_0x47c2('0x12'),this[_0x47c2('0x13')][_0x47c2('0x11')](this));ami['on'](_0x47c2('0x14'),this[_0x47c2('0x15')][_0x47c2('0x11')](this));ami['on']('newexten',this['syncNewExten'][_0x47c2('0x11')](this));ami['on']('faxstatus',this[_0x47c2('0x16')][_0x47c2('0x11')](this));ami['on'](_0x47c2('0x17'),this[_0x47c2('0x18')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x47c2('0x11')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x47c2('0x11')](this));}Fax[_0x47c2('0x19')]['syncNewchannel']=function(_0x2ce963){if(_0x2ce963[_0x47c2('0x1a')]===_0x47c2('0x1b')){for(var _0x18b03c in this[_0x47c2('0xd')]){if(this[_0x47c2('0xd')][_0x47c2('0x1c')](_0x18b03c)){if(_0x2ce963[_0x47c2('0x1d')]===this[_0x47c2('0xd')][_0x18b03c][_0x47c2('0x1e')]){this[_0x47c2('0x1f')][_0x2ce963[_0x47c2('0x20')]]={};this[_0x47c2('0x1f')][_0x2ce963[_0x47c2('0x20')]]['channel']=_0x2ce963[_0x47c2('0x21')];this['channels'][_0x2ce963[_0x47c2('0x20')]]['id']=this[_0x47c2('0xd')][_0x18b03c]['id'];this[_0x47c2('0x1f')][_0x2ce963[_0x47c2('0x20')]][_0x47c2('0x22')]=this[_0x47c2('0xd')][_0x18b03c]['name'];logger[_0x47c2('0x23')](_0x2ce963[_0x47c2('0x20')],_0x47c2('0x24'));}}}}if(this[_0x47c2('0x25')][_0x2ce963[_0x47c2('0x20')]]){this[_0x47c2('0x1f')][_0x2ce963[_0x47c2('0x20')]]={};this[_0x47c2('0x1f')][_0x2ce963[_0x47c2('0x20')]][_0x47c2('0x21')]=_0x2ce963['channel'];logger[_0x47c2('0x23')](_0x2ce963[_0x47c2('0x20')],_0x47c2('0x24'));}};Fax[_0x47c2('0x19')][_0x47c2('0x13')]=function(_0x4bf4fc){if(this[_0x47c2('0x1f')][_0x4bf4fc['uniqueid']]){for(var _0xfa31e3 in _0x4bf4fc[_0x47c2('0x26')]){if(_0x4bf4fc[_0x47c2('0x26')]['hasOwnProperty'](_0xfa31e3)){this['channels'][_0x4bf4fc[_0x47c2('0x20')]][_0xfa31e3]=_0x4bf4fc['value'];}}}};Fax[_0x47c2('0x19')][_0x47c2('0x15')]=function(_0x472d2a){if(this[_0x47c2('0x1f')][_0x472d2a[_0x47c2('0x20')]]){this[_0x47c2('0x1f')][_0x472d2a[_0x47c2('0x20')]][_0x47c2('0x27')]=_0x472d2a[_0x47c2('0x27')];this[_0x47c2('0x1f')][_0x472d2a[_0x47c2('0x20')]][_0x47c2('0x28')]=_0x472d2a[_0x47c2('0x28')];}};Fax['prototype'][_0x47c2('0x29')]=function(_0x5d10dd){if(this[_0x47c2('0x1f')][_0x5d10dd[_0x47c2('0x20')]]){for(var _0x58164a in _0x5d10dd[_0x47c2('0x26')]){if(_0x5d10dd[_0x47c2('0x26')][_0x47c2('0x1c')](_0x58164a)){this[_0x47c2('0x1f')][_0x5d10dd[_0x47c2('0x20')]][_0x58164a]=_0x5d10dd[_0x47c2('0x2a')];}}}};Fax[_0x47c2('0x19')]['syncFaxStatus']=function(_0x42042f){if(this[_0x47c2('0x1f')][_0x42042f[_0x47c2('0x20')]]){this['channels'][_0x42042f[_0x47c2('0x20')]][_0x47c2('0x2b')]=_0x42042f[_0x47c2('0x2b')];this[_0x47c2('0x1f')][_0x42042f['uniqueid']]['status']=_0x42042f['status'];this[_0x47c2('0x1f')][_0x42042f[_0x47c2('0x20')]][_0x47c2('0x1e')]=_0x42042f['localstationid'];this[_0x47c2('0x1f')][_0x42042f[_0x47c2('0x20')]][_0x47c2('0x2c')]=_0x42042f['filename'];logger[_0x47c2('0x23')](_0x42042f['uniqueid'],_0x47c2('0x2d'));}};Fax[_0x47c2('0x19')][_0x47c2('0x18')]=function(_0x3a798e){var _0x320a6a=this;if(this[_0x47c2('0x1f')][_0x3a798e['uniqueid']]){var _0x104aa3=this[_0x47c2('0x1f')][_0x3a798e[_0x47c2('0x20')]]['id'];this[_0x47c2('0x1f')][_0x3a798e['uniqueid']][_0x47c2('0x2e')]=_0x3a798e['remotestationid'];this['channels'][_0x3a798e[_0x47c2('0x20')]][_0x47c2('0x2f')]=_0x3a798e['pagestransferred'];this[_0x47c2('0x1f')][_0x3a798e['uniqueid']][_0x47c2('0x1e')]=_0x3a798e[_0x47c2('0x1e')];this['channels'][_0x3a798e[_0x47c2('0x20')]][_0x47c2('0x30')]=_0x3a798e[_0x47c2('0x30')];this[_0x47c2('0x1f')][_0x3a798e[_0x47c2('0x20')]][_0x47c2('0x31')]=_0x3a798e[_0x47c2('0x31')];this[_0x47c2('0x1f')][_0x3a798e[_0x47c2('0x20')]][_0x47c2('0x2c')]=_0x3a798e[_0x47c2('0x2c')];this['channels'][_0x3a798e[_0x47c2('0x20')]][_0x47c2('0x32')]=_0x3a798e[_0x47c2('0x32')];if(this[_0x47c2('0x1f')][_0x3a798e[_0x47c2('0x20')]]['pagestransferred']>0x0){tiff2pdf(_0x3a798e[_0x47c2('0x2c')],_0x47c2('0x33'),function(_0x58cb6a){logger['info'](_0x3a798e[_0x47c2('0x20')],'\x20result\x20conversion\x20file\x20',_0x58cb6a[_0x47c2('0x34')]);attachment['create']({'name':path['parse'](_0x3a798e[_0x47c2('0x2c')])[_0x47c2('0x22')],'basename':path[_0x47c2('0x35')](_0x3a798e[_0x47c2('0x2c')])[_0x47c2('0x22')]+_0x47c2('0x36'),'type':'application/pdf'})['then'](function(_0x3ead07){faxAccount[_0x47c2('0x37')](_0x104aa3,{'from':_0x3a798e[_0x47c2('0x32')],'mapKey':_0x47c2('0x6'),'body':path['parse'](_0x3a798e[_0x47c2('0x2c')])[_0x47c2('0x22')]+_0x47c2('0x36'),'AttachmentId':_0x3ead07['id']})[_0x47c2('0x38')](function(_0x5df37d){logger['error'](_0x3a798e['uniqueid'],_0x47c2('0x39'),JSON[_0x47c2('0x3a')](_0x5df37d));});})['catch'](function(_0x340e94){logger[_0x47c2('0x3b')](_0x3a798e[_0x47c2('0x20')],_0x47c2('0x3c'),JSON['stringify'](_0x340e94));});});}logger[_0x47c2('0x23')](_0x3a798e[_0x47c2('0x20')],'\x20receiveFax\x20');}};Fax[_0x47c2('0x19')][_0x47c2('0x3d')]=function(_0x113c14){if(this[_0x47c2('0x25')][_0x113c14[_0x47c2('0x20')]]){_[_0x47c2('0x3e')](this['channels'][_0x113c14[_0x47c2('0x20')]],_[_0x47c2('0x3f')](_0x113c14,[_0x47c2('0x40'),'reason']));}};function updateStatus(_0x18029c){if(_0x18029c[_0x47c2('0x41')]){faxMessage[_0x47c2('0x42')](_0x18029c[_0x47c2('0x41')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x3fb1a2){ut[_0x47c2('0x43')](_0x47c2('0x44'),_0x3fb1a2);})['catch'](function(_0x102bbb){ut['logger'](_0x47c2('0x45'),_0x102bbb);});}else{ut[_0x47c2('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x47c2('0x19')][_0x47c2('0x46')]=function(_0x18ea1f,_0x560a29,_0x19e75b){var _0x435474=this;var _0x455f35={};if(_0x560a29){_0x455f35={'read':_0x560a29};}else{_0x455f35={'failMessage':_0x19e75b};}if(this['actions'][_0x18ea1f]['AttachmentId']){faxMessage['update'](this[_0x47c2('0x25')][_0x18ea1f][_0x47c2('0x41')],_0x455f35)[_0x47c2('0x47')](function(_0x56e874){ut[_0x47c2('0x43')](_0x47c2('0x48'),_0x56e874);})[_0x47c2('0x38')](function(_0x421a98){ut[_0x47c2('0x43')](_0x47c2('0x49'),_0x421a98);})[_0x47c2('0x4a')](function(){delete _0x435474[_0x47c2('0x1f')][_0x18ea1f];delete _0x435474[_0x47c2('0x25')][_0x18ea1f];});}else{ut[_0x47c2('0x43')](_0x47c2('0x4b'));delete this[_0x47c2('0x1f')][_0x18ea1f];delete this[_0x47c2('0x25')][_0x18ea1f];}};Fax[_0x47c2('0x19')][_0x47c2('0x4c')]=function(_0x57e175){var _0x4f118f=this;if(this[_0x47c2('0x1f')][_0x57e175[_0x47c2('0x20')]]){if(this['actions'][_0x57e175[_0x47c2('0x20')]]){this[_0x47c2('0x1f')][_0x57e175[_0x47c2('0x20')]]['id']=this[_0x47c2('0x25')][_0x57e175[_0x47c2('0x20')]]['id'];this[_0x47c2('0x1f')][_0x57e175[_0x47c2('0x20')]]['name']=this['actions'][_0x57e175[_0x47c2('0x20')]][_0x47c2('0x22')];}logger['info'](_0x57e175[_0x47c2('0x20')],this['actions'][_0x57e175[_0x47c2('0x20')]]?_0x47c2('0x4d'):_0x47c2('0x4e'),JSON['stringify'](this[_0x47c2('0x1f')][_0x57e175[_0x47c2('0x20')]]));if(this[_0x47c2('0x25')][_0x57e175['uniqueid']]){if(this[_0x47c2('0x1f')][_0x57e175[_0x47c2('0x20')]]['faxpages']>0x0&&this[_0x47c2('0x1f')][_0x57e175['uniqueid']]['faxstatus']===_0x47c2('0x4f')){this[_0x47c2('0x46')](_0x57e175[_0x47c2('0x20')],!![]);}else{this[_0x47c2('0x46')](_0x57e175[_0x47c2('0x20')],![],this[_0x47c2('0x1f')][_0x57e175[_0x47c2('0x20')]][_0x47c2('0x50')]?_0x47c2('0x51')+this['channels'][_0x57e175[_0x47c2('0x20')]][_0x47c2('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x47c2('0x19')][_0x47c2('0x52')]=function(_0x18525f){var _0xd759f6=this;return new BPromise(function(_0x565a69,_0x35f21b){_0xd759f6[_0x47c2('0x53')](_0x18525f,_0xd759f6[_0x47c2('0xd')][_0x18525f['FaxAccountId']])[_0x47c2('0x47')](function(_0x1d4b7f){ut[_0x47c2('0x43')](_0x47c2('0x54'),_0x1d4b7f);_0x565a69(ut[_0x47c2('0x34')](_0x47c2('0x55')));})[_0x47c2('0x38')](function(_0x5c942e){ut[_0x47c2('0x43')]('[Fax][execOriginate][failure]',_0x5c942e);updateStatus(_0x18525f);_0x35f21b(ut[_0x47c2('0x34')]('Fax\x20failed'));});});};Fax[_0x47c2('0x19')][_0x47c2('0x56')]=function(_0x1793e1){var _0x2b35b9=this;return new BPromise(function(_0x4ef291,_0x2483f5){var _0x4bfcfc=_0x2b35b9[_0x47c2('0x57')](_0x2b35b9['faxAccounts'][_0x1793e1[_0x47c2('0x58')]][_0x47c2('0x59')],_0x1793e1);if(_0x4bfcfc['isValid']){_0x4ef291(ut[_0x47c2('0x34')](_0x47c2('0x5a')));}else{_0x2483f5(ut[_0x47c2('0x34')](_0x4bfcfc[_0x47c2('0x34')]));}});};function originate(_0x37dcf3,_0x81c3d0,_0x2ee7df){return new BPromise(function(_0x497903,_0x3345f2){if(_0x2ee7df){var _0x3f54e2=util[_0x47c2('0x5b')](_0x47c2('0x5c'),path[_0x47c2('0x35')](_0x37dcf3[_0x47c2('0x2')])[_0x47c2('0x22')],_0x37dcf3[_0x47c2('0x2')]);gs['execute'](_0x3f54e2)[_0x47c2('0x47')](function(){_0x37dcf3[_0x47c2('0x2')]=util[_0x47c2('0x5b')]('%s/%s.tif',path[_0x47c2('0x35')](_0x37dcf3[_0x47c2('0x2')])['dir'],path[_0x47c2('0x35')](_0x37dcf3[_0x47c2('0x2')])[_0x47c2('0x22')]);_0x81c3d0[_0x47c2('0x5d')]=_0x37dcf3[_0x47c2('0x2')];ut[_0x47c2('0x43')](_0x47c2('0x5e'),'');ami[_0x47c2('0x5f')](ut['variablesAction'](_0x37dcf3,_0x81c3d0))[_0x47c2('0x47')](function(_0x5c6fe7){_0x497903(_0x5c6fe7);})['catch'](function(_0x42375b){_0x3345f2(_0x42375b);});})[_0x47c2('0x38')](function(_0x3b73c6){_0x3345f2(_0x3b73c6);});}else{ami[_0x47c2('0x5f')](ut[_0x47c2('0x60')](_0x37dcf3,_0x81c3d0))[_0x47c2('0x47')](function(_0x38ae9a){_0x497903(_0x38ae9a);})[_0x47c2('0x38')](function(_0xd05af0){_0x3345f2(_0xd05af0);});}});}Fax[_0x47c2('0x19')][_0x47c2('0x53')]=function(_0x5a9cd9,_0x3b62ed){var _0x7de778=this;return new BPromise(function(_0x5ec2cc,_0x151ec1){var _0x1ebebb=uuid['v4']();var _0xe41594=ut['addVariables'](_0x5a9cd9,_0x3b62ed);_0x7de778['actions'][_0x1ebebb]=new Action(_0x1ebebb,_0x3b62ed,_0x5a9cd9);var _0x313605=_0x7de778[_0x47c2('0x25')][_0x1ebebb];if(path[_0x47c2('0x35')](_0x5a9cd9[_0x47c2('0x2')])[_0x47c2('0x61')]==='.pdf'){originate(_0x313605,_0xe41594,!![])[_0x47c2('0x47')](function(_0x4d9b18){_0x5ec2cc(_0x4d9b18);})[_0x47c2('0x38')](function(_0x533edb){_0x151ec1(_0x533edb);});}else{originate(_0x313605,_0xe41594,![])['then'](function(_0x467a4d){_0x5ec2cc(_0x467a4d);})[_0x47c2('0x38')](function(_0x418078){_0x151ec1(_0x418078);});}});};Fax['prototype']['isTrunkReachable']=function(_0x122123){return!_[_0x47c2('0x62')](_0x122123)&&!_['isNil'](_0x122123[_0x47c2('0x22')])&&!_[_0x47c2('0x62')](_0x122123['active'])&&_0x122123['active']&&!_['isNil'](this[_0x47c2('0xe')][util['format']('SIP/%s',_0x122123[_0x47c2('0x22')])])&&!_[_0x47c2('0x62')](this[_0x47c2('0xe')][util[_0x47c2('0x5b')]('SIP/%s',_0x122123[_0x47c2('0x22')])][_0x47c2('0x63')])&&(this[_0x47c2('0xe')][util[_0x47c2('0x5b')]('SIP/%s',_0x122123[_0x47c2('0x22')])]['status']==='reachable'||this['trunks'][util[_0x47c2('0x5b')]('SIP/%s',_0x122123['name'])]['status']===_0x47c2('0x64'));};Fax[_0x47c2('0x19')]['checkTrunk']=function(_0x6d8828,_0x4a0e8b){if(!this['isTrunkReachable'](_0x6d8828)){ut[_0x47c2('0x43')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x47c2('0x62')](_0x6d8828)?'':_0x6d8828[_0x47c2('0x22')]+_0x47c2('0x65'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x47c2('0x62')](_0x4a0e8b[_0x47c2('0x6')])){ut[_0x47c2('0x43')](_0x47c2('0x66'),JSON[_0x47c2('0x3a')](_0x4a0e8b));return{'isValid':![],'message':_0x47c2('0x67')};}if(_['isNil'](_0x4a0e8b[_0x47c2('0x2')])){ut[_0x47c2('0x43')](_0x47c2('0x68'),JSON[_0x47c2('0x3a')](_0x4a0e8b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x47c2('0x69')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 44f3fa4..111e31c 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 _0x041e=['error','inspect','notify','catch','preview','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x041e,0x76));var _0xe041=function(_0x56bf50,_0x37979a){_0x56bf50=_0x56bf50-0x0;var _0x277d0c=_0x041e[_0x56bf50];return _0x277d0c;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0xe041('0x0'));var _=require(_0xe041('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xfeba29){return function(_0x16798b){logger[_0xe041('0x2')](_0xfeba29,util[_0xe041('0x3')](_0x16798b,{'showHidden':![],'depth':null}));};}exports[_0xe041('0x4')]=function(_0x11f35f,_0x23fe96){return BPromise['resolve']()['then'](faxAccount['notify'](_0x11f35f,_0x23fe96))[_0xe041('0x5')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x091e=['resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect','notify'];(function(_0x4d620b,_0x27b3d5){var _0x3ba6df=function(_0x48d671){while(--_0x48d671){_0x4d620b['push'](_0x4d620b['shift']());}};_0x3ba6df(++_0x27b3d5);}(_0x091e,0x67));var _0xe091=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x091e[_0x46d0c9];return _0x174506;};'use strict';var util=require(_0xe091('0x0'));var BPromise=require(_0xe091('0x1'));var logger=require(_0xe091('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0xe091('0x3'));function loggerCatch(_0xb7c527){return function(_0x3bd030){logger[_0xe091('0x4')](_0xb7c527,util[_0xe091('0x5')](_0x3bd030,{'showHidden':![],'depth':null}));};}exports[_0xe091('0x6')]=function(_0x30bb0c,_0x18eaa1){return BPromise[_0xe091('0x7')]()[_0xe091('0x8')](faxAccount[_0xe091('0x6')](_0x30bb0c,_0x18eaa1))[_0xe091('0x9')](loggerCatch(_0xe091('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 84fae1d..2cd5b1c 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 _0xb168=['Exec\x20gs','\x20Error\x20:','../../../../config/logger','fax','bluebird','info'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xb168,0xec));var _0x8b16=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xb168[_0x1c8c28];return _0x1f59b4;};'use strict';var util=require('util');var logger=require(_0x8b16('0x0'))(_0x8b16('0x1'));var BPromise=require(_0x8b16('0x2'));var exec=require('child_process')['exec'];exports['execute']=function(_0x623e33){return new BPromise(function(_0x40961a,_0xf5d07){exec(_0x623e33,function(_0x21d5ce,_0x55d127,_0xc7ddfa){logger[_0x8b16('0x3')](_0x8b16('0x4'),_0x55d127);if(_0x21d5ce){logger[_0x8b16('0x3')](_0x8b16('0x4'),_0x8b16('0x5'),util['inspect'](_0x21d5ce,{'showHidden':![],'depth':null}),_0x55d127,_0xc7ddfa);_0xf5d07(_0x21d5ce);}_0x40961a(_0x55d127);});});}; \ No newline at end of file +var _0xf083=['bluebird','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax'];(function(_0x28902e,_0x3263f1){var _0x4bcf67=function(_0x11a5f3){while(--_0x11a5f3){_0x28902e['push'](_0x28902e['shift']());}};_0x4bcf67(++_0x3263f1);}(_0xf083,0x106));var _0x3f08=function(_0x4fa601,_0x14a3db){_0x4fa601=_0x4fa601-0x0;var _0x22b20e=_0xf083[_0x4fa601];return _0x22b20e;};'use strict';var util=require(_0x3f08('0x0'));var logger=require('../../../../config/logger')(_0x3f08('0x1'));var BPromise=require(_0x3f08('0x2'));var exec=require('child_process')['exec'];exports[_0x3f08('0x3')]=function(_0x196cd4){return new BPromise(function(_0x45a81e,_0x1b74ba){exec(_0x196cd4,function(_0x5708c0,_0x59a5c9,_0x566206){logger[_0x3f08('0x4')](_0x3f08('0x5'),_0x59a5c9);if(_0x5708c0){logger[_0x3f08('0x4')]('Exec\x20gs',_0x3f08('0x6'),util[_0x3f08('0x7')](_0x5708c0,{'showHidden':![],'depth':null}),_0x59a5c9,_0x566206);_0x1b74ba(_0x5708c0);}_0x45a81e(_0x59a5c9);});});}; \ 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 3032692..8d819ab 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 _0x692c=['format','\x22%s\x22','modem','gateway','t38timeout','path','uniqueid','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','fax','message','logger','inspect','addVariables','ecm','maxrate'];(function(_0x5e3a04,_0x20597d){var _0x19bf30=function(_0x130560){while(--_0x130560){_0x5e3a04['push'](_0x5e3a04['shift']());}};_0x19bf30(++_0x20597d);}(_0x692c,0x107));var _0xc692=function(_0x47a34b,_0x3ebeee){_0x47a34b=_0x47a34b-0x0;var _0x370de0=_0x692c[_0x47a34b];return _0x370de0;};'use strict';var util=require(_0xc692('0x0'));var _=require(_0xc692('0x1'));var moment=require(_0xc692('0x2'));var logger=require('../../../../config/logger')(_0xc692('0x3'));exports[_0xc692('0x4')]=function(_0x5b1874){return{'message':_0x5b1874};};exports[_0xc692('0x5')]=function(_0x159b2f,_0x1571fe){logger['info'](_0x159b2f,util[_0xc692('0x6')](_0x1571fe,{'showHidden':![],'depth':null}));};exports[_0xc692('0x7')]=function(_0x4c61f3,_0x342aa7){var _0x338162={'XMF-ECM':_0x342aa7[_0xc692('0x8')],'XMF-HEADERINFO':_0x342aa7['headerinfo'],'XMF-MINRATE':_0x342aa7['minrate'],'XMF-MAXRATE':_0x342aa7[_0xc692('0x9')],'XMF-MODEM':util[_0xc692('0xa')](_0xc692('0xb'),_0x342aa7[_0xc692('0xc')]),'XMF-GATEWAY':_0x342aa7[_0xc692('0xd')],'XMF-FAXDETECT':_0x342aa7['faxdetect'],'XMF-T38TIMEOUT':_0x342aa7[_0xc692('0xe')],'XMF-LOCALSTATIONID':_0x342aa7['localstationid'],'XMF-PATH':_0x4c61f3[_0xc692('0xf')]};return _0x338162;};exports['variablesAction']=function(_0x26732e,_0x22fd9d){return{'actionid':_0x26732e[_0xc692('0x10')],'action':'originate','channel':_0x26732e['channel'],'Exten':_0xc692('0x11'),'Context':'from-sip','Priority':'1','callerid':util[_0xc692('0xa')](_0xc692('0x12'),_0x26732e[_0xc692('0x13')]?_0x26732e[_0xc692('0x13')]:'',_0x26732e[_0xc692('0x14')]),'variable':_0x22fd9d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x26732e[_0xc692('0x10')]};}; \ No newline at end of file +var _0xe0da=['modem','gateway','faxdetect','localstationid','uniqueid','originate','channel','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format'];(function(_0x266987,_0x45702f){var _0x3cf377=function(_0x33670c){while(--_0x33670c){_0x266987['push'](_0x266987['shift']());}};_0x3cf377(++_0x45702f);}(_0xe0da,0x16f));var _0xae0d=function(_0x1f329c,_0x4863ac){_0x1f329c=_0x1f329c-0x0;var _0x28fc7f=_0xe0da[_0x1f329c];return _0x28fc7f;};'use strict';var util=require('util');var _=require(_0xae0d('0x0'));var moment=require(_0xae0d('0x1'));var logger=require(_0xae0d('0x2'))(_0xae0d('0x3'));exports[_0xae0d('0x4')]=function(_0x2732c6){return{'message':_0x2732c6};};exports[_0xae0d('0x5')]=function(_0x361a6d,_0x2708b4){logger[_0xae0d('0x6')](_0x361a6d,util[_0xae0d('0x7')](_0x2708b4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x198a6a,_0x203e4d){var _0x4c3fb8={'XMF-ECM':_0x203e4d[_0xae0d('0x8')],'XMF-HEADERINFO':_0x203e4d[_0xae0d('0x9')],'XMF-MINRATE':_0x203e4d[_0xae0d('0xa')],'XMF-MAXRATE':_0x203e4d[_0xae0d('0xb')],'XMF-MODEM':util[_0xae0d('0xc')]('\x22%s\x22',_0x203e4d[_0xae0d('0xd')]),'XMF-GATEWAY':_0x203e4d[_0xae0d('0xe')],'XMF-FAXDETECT':_0x203e4d[_0xae0d('0xf')],'XMF-T38TIMEOUT':_0x203e4d['t38timeout'],'XMF-LOCALSTATIONID':_0x203e4d[_0xae0d('0x10')],'XMF-PATH':_0x198a6a['path']};return _0x4c3fb8;};exports['variablesAction']=function(_0x539d52,_0x55447a){return{'actionid':_0x539d52[_0xae0d('0x11')],'action':_0xae0d('0x12'),'channel':_0x539d52[_0xae0d('0x13')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0xae0d('0xc')]('\x22%s\x22\x20<%s>',_0x539d52[_0xae0d('0x9')]?_0x539d52[_0xae0d('0x9')]:'',_0x539d52[_0xae0d('0x10')]),'variable':_0x55447a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x539d52['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d530f45..c4abf1e 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 _0x67dd=['./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getTelephones','initTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport'];(function(_0x4950c8,_0x42ba75){var _0x396df7=function(_0x4958fc){while(--_0x4958fc){_0x4950c8['push'](_0x4950c8['shift']());}};_0x396df7(++_0x42ba75);}(_0x67dd,0x136));var _0xd67d=function(_0x527670,_0x141c42){_0x527670=_0x527670-0x0;var _0x2ef29e=_0x67dd[_0x527670];return _0x2ef29e;};'use strict';var util=require('util');var moment=require(_0xd67d('0x0'));var server=require(_0xd67d('0x1'));var Realtime=require(_0xd67d('0x2'));var Report=require(_0xd67d('0x3'));var Acw=require(_0xd67d('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xd67d('0x5'));var Preview=require(_0xd67d('0x6'));var Fax=require('./fax');var user=require(_0xd67d('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xd67d('0x8'));var voiceCallReport=require(_0xd67d('0x9'));var trunk=require(_0xd67d('0xa'));var trigger=require(_0xd67d('0xb'));var template=require(_0xd67d('0xc'));var cmHopperHistory=require(_0xd67d('0xd'));var campaign=require(_0xd67d('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xd67d('0xf'));var zendesk=require(_0xd67d('0x10'));var salesforce=require(_0xd67d('0x11'));var sugarcrm=require(_0xd67d('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xd67d('0x13'));var servicenow=require(_0xd67d('0x14'));var dynamics365=require(_0xd67d('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xd67d('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd67d('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd67d('0x17')](_0xd67d('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd67d('0x19')]()[_0xd67d('0x1a')](user['getAgents']())[_0xd67d('0x1a')](realtime['initAgents']())[_0xd67d('0x1a')](user[_0xd67d('0x1b')]())[_0xd67d('0x1a')](realtime['initTelephones']())[_0xd67d('0x1a')](trunk['getTrunks']())[_0xd67d('0x1a')](realtime[_0xd67d('0x1c')]())['then'](voiceQueue['getVoiceQueues']())[_0xd67d('0x1a')](realtime[_0xd67d('0x1d')]())[_0xd67d('0x1a')](trigger[_0xd67d('0x1e')]())[_0xd67d('0x1a')](realtime['initTriggers']())[_0xd67d('0x1a')](template[_0xd67d('0x1f')]())['then'](realtime[_0xd67d('0x20')]())['then'](zendesk[_0xd67d('0x21')]())['then'](realtime[_0xd67d('0x22')]())[_0xd67d('0x1a')](salesforce[_0xd67d('0x23')]())['then'](realtime['initSalesforceAccounts']())[_0xd67d('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0xd67d('0x1a')](realtime[_0xd67d('0x24')]())[_0xd67d('0x1a')](freshdesk['getFreshdeskAccounts']())[_0xd67d('0x1a')](realtime[_0xd67d('0x25')]())['then'](desk[_0xd67d('0x26')]())[_0xd67d('0x1a')](realtime[_0xd67d('0x27')]())['then'](zoho['getZohoAccounts']())['then'](realtime[_0xd67d('0x28')]())[_0xd67d('0x1a')](vtiger[_0xd67d('0x29')]())['then'](realtime[_0xd67d('0x2a')]())[_0xd67d('0x1a')](freshsales[_0xd67d('0x2b')]())['then'](realtime[_0xd67d('0x2c')]())[_0xd67d('0x1a')](servicenow[_0xd67d('0x2d')]())[_0xd67d('0x1a')](realtime['initServicenowAccounts']())[_0xd67d('0x1a')](dynamics365[_0xd67d('0x2e')]())[_0xd67d('0x1a')](realtime[_0xd67d('0x2f')]())['then'](campaign['getCampaigns']())[_0xd67d('0x1a')](realtime[_0xd67d('0x30')]())[_0xd67d('0x1a')](voiceExtension[_0xd67d('0x31')]())[_0xd67d('0x1a')](realtime[_0xd67d('0x32')]())[_0xd67d('0x1a')](faxAccount[_0xd67d('0x33')]())[_0xd67d('0x1a')](realtime[_0xd67d('0x34')]())[_0xd67d('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0xd67d('0x19')]()[_0xd67d('0x1a')](voiceQueueReport[_0xd67d('0x35')]())[_0xd67d('0x1a')](realtime['initVoiceQueueReports']())[_0xd67d('0x1a')](cmHopperHistory[_0xd67d('0x36')]())[_0xd67d('0x1a')](realtime[_0xd67d('0x37')]())[_0xd67d('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0xd67d('0x1a')](realtime['initCampaignHopperHistory']())[_0xd67d('0x1a')](voiceCallReport[_0xd67d('0x38')]())['then'](realtime[_0xd67d('0x39')]())[_0xd67d('0x3a')](function(_0x21bae9){logger[_0xd67d('0x3b')]('[index.js][initParams]',util[_0xd67d('0x3c')](_0x21bae9,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd67d('0x3d')](realtime,preview,fax)[_0xd67d('0x1a')](function(){return initRealtime();})[_0xd67d('0x1a')](function(){return initParams();})['then'](function(){report[_0xd67d('0x3e')]();setInterval(initRealtime,0x1388);})[_0xd67d('0x3a')](function(_0x1432e4){logger[_0xd67d('0x3b')](_0xd67d('0x3f'),util[_0xd67d('0x3c')](_0x1432e4,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x58b8=['initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','catch','error','[index.js][initParams]','listen','[index.js][main]','inspect','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts'];(function(_0x2dfde8,_0x17145c){var _0xa08275=function(_0x4e8e0b){while(--_0x4e8e0b){_0x2dfde8['push'](_0x2dfde8['shift']());}};_0xa08275(++_0x17145c);}(_0x58b8,0x143));var _0x858b=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0x58b8[_0x4f83ca];return _0x1fbac3;};'use strict';var util=require('util');var moment=require(_0x858b('0x0'));var server=require('./server');var Realtime=require(_0x858b('0x1'));var Report=require(_0x858b('0x2'));var Acw=require(_0x858b('0x3'));var Trigger=require(_0x858b('0x4'));var Dialer=require(_0x858b('0x5'));var Preview=require(_0x858b('0x6'));var Fax=require(_0x858b('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x858b('0x8'));var voiceQueueReport=require(_0x858b('0x9'));var voiceCallReport=require(_0x858b('0xa'));var trunk=require(_0x858b('0xb'));var trigger=require(_0x858b('0xc'));var template=require(_0x858b('0xd'));var cmHopperHistory=require(_0x858b('0xe'));var campaign=require(_0x858b('0xf'));var voiceExtension=require(_0x858b('0x10'));var faxAccount=require(_0x858b('0x11'));var zendesk=require(_0x858b('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x858b('0x13'));var freshdesk=require(_0x858b('0x14'));var desk=require(_0x858b('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x858b('0x16'));var freshsales=require(_0x858b('0x17'));var servicenow=require(_0x858b('0x18'));var dynamics365=require(_0x858b('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x858b('0x1a'))(_0x858b('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x858b('0x1c')](_0x858b('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x858b('0x1c')](_0x858b('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x858b('0x1e')]()[_0x858b('0x1f')](user[_0x858b('0x20')]())[_0x858b('0x1f')](realtime[_0x858b('0x21')]())[_0x858b('0x1f')](user[_0x858b('0x22')]())[_0x858b('0x1f')](realtime[_0x858b('0x23')]())[_0x858b('0x1f')](trunk[_0x858b('0x24')]())[_0x858b('0x1f')](realtime[_0x858b('0x25')]())[_0x858b('0x1f')](voiceQueue[_0x858b('0x26')]())[_0x858b('0x1f')](realtime[_0x858b('0x27')]())['then'](trigger['getTriggers']())[_0x858b('0x1f')](realtime[_0x858b('0x28')]())['then'](template['getTemplates']())['then'](realtime[_0x858b('0x29')]())['then'](zendesk[_0x858b('0x2a')]())[_0x858b('0x1f')](realtime[_0x858b('0x2b')]())[_0x858b('0x1f')](salesforce[_0x858b('0x2c')]())[_0x858b('0x1f')](realtime[_0x858b('0x2d')]())[_0x858b('0x1f')](sugarcrm[_0x858b('0x2e')]())[_0x858b('0x1f')](realtime[_0x858b('0x2f')]())[_0x858b('0x1f')](freshdesk[_0x858b('0x30')]())['then'](realtime['initFreshdeskAccounts']())[_0x858b('0x1f')](desk['getDeskAccounts']())[_0x858b('0x1f')](realtime[_0x858b('0x31')]())[_0x858b('0x1f')](zoho[_0x858b('0x32')]())[_0x858b('0x1f')](realtime[_0x858b('0x33')]())[_0x858b('0x1f')](vtiger['getVtigerAccounts']())[_0x858b('0x1f')](realtime[_0x858b('0x34')]())['then'](freshsales[_0x858b('0x35')]())['then'](realtime[_0x858b('0x36')]())['then'](servicenow[_0x858b('0x37')]())['then'](realtime[_0x858b('0x38')]())[_0x858b('0x1f')](dynamics365[_0x858b('0x39')]())[_0x858b('0x1f')](realtime['initDynamics365Accounts']())['then'](campaign[_0x858b('0x3a')]())['then'](realtime[_0x858b('0x3b')]())['then'](voiceExtension[_0x858b('0x3c')]())[_0x858b('0x1f')](realtime[_0x858b('0x3d')]())[_0x858b('0x1f')](faxAccount[_0x858b('0x3e')]())[_0x858b('0x1f')](realtime['initFaxAccounts']())[_0x858b('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0x858b('0x1e')]()['then'](voiceQueueReport[_0x858b('0x3f')]())[_0x858b('0x1f')](realtime[_0x858b('0x40')]())[_0x858b('0x1f')](cmHopperHistory[_0x858b('0x41')]())[_0x858b('0x1f')](realtime[_0x858b('0x42')]())[_0x858b('0x1f')](cmHopperHistory[_0x858b('0x43')]())[_0x858b('0x1f')](realtime['initCampaignHopperHistory']())[_0x858b('0x1f')](voiceCallReport['getVoiceCallReports']())[_0x858b('0x1f')](realtime['initVoiceCallReports']())[_0x858b('0x44')](function(_0x3e581b){logger[_0x858b('0x45')](_0x858b('0x46'),util['inspect'](_0x3e581b,{'showHidden':![],'depth':null}));});}function main(){return server[_0x858b('0x47')](realtime,preview,fax)[_0x858b('0x1f')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x858b('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x858b('0x44')](function(_0x30e26d){logger[_0x858b('0x45')](_0x858b('0x48'),util[_0x858b('0x49')](_0x30e26d,{'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 f85e243..fcb3ec9 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 _0x2cc4=['talking','voiceStatus','statePause','voiceStatusTime','toNumber','format','accountcode','voiceStatusQueue','stringify','user:%s','emit','user:ami:update','omit','exports','util','moment','md5','../../../config/environment','redis','defaults','localhost','name','email','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusCallerIdNumber','onhold','updateStatusRealtime','toLowerCase','idle','inuse'];(function(_0x2b980e,_0x5d5c6d){var _0x594c72=function(_0x3c6868){while(--_0x3c6868){_0x2b980e['push'](_0x2b980e['shift']());}};_0x594c72(++_0x5d5c6d);}(_0x2cc4,0x16d));var _0x42cc=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x2cc4[_0x623e7];return _0x121131;};'use strict';var _=require('lodash');var util=require(_0x42cc('0x0'));var moment=require(_0x42cc('0x1'));var md5=require(_0x42cc('0x2'));var Redis=require('ioredis');var config=require(_0x42cc('0x3'));config[_0x42cc('0x4')]=_[_0x42cc('0x5')](config[_0x42cc('0x4')],{'host':_0x42cc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x42cc('0x4')]));function Agent(_0x2884e5){this['id']=_0x2884e5['id']||0x0;this[_0x42cc('0x7')]=_0x2884e5[_0x42cc('0x7')]||'';this[_0x42cc('0x8')]=_0x2884e5[_0x42cc('0x8')]||'';this['accountcode']=_0x2884e5['accountcode']||'';this[_0x42cc('0x9')]=_0x2884e5[_0x42cc('0x9')]||'';this[_0x42cc('0xa')]=_0x42cc('0xb');this[_0x42cc('0xc')]=0x0;this[_0x42cc('0xd')]=_0x42cc('0xb');this[_0x42cc('0xe')]='';this[_0x42cc('0xf')]='';this[_0x42cc('0x10')]='';this[_0x42cc('0x11')]='';this[_0x42cc('0x12')]=_0x2884e5[_0x42cc('0x12')]||![];this['voiceStatus']=_0x42cc('0xb');this['voiceStatusTime']=0x0;this[_0x42cc('0x13')]='';this['voiceStatusQueue']='';this[_0x42cc('0x14')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x42cc('0x15')]=function(_0x4a3409){var _0x1b3984;if(_0x4a3409&&_0x4a3409['state']){_0x1b3984=_0x4a3409[_0x42cc('0xa')][_0x42cc('0x16')]();switch(_0x1b3984){case'not_inuse':_0x1b3984=_0x42cc('0x17');break;case _0x42cc('0x18'):_0x1b3984=_0x42cc('0x19');break;}}if(_0x1b3984&&this[_0x42cc('0x1a')]!==_0x1b3984||_0x4a3409[_0x42cc('0x1b')]){this[_0x42cc('0x1c')]=_[_0x42cc('0x1d')](moment()[_0x42cc('0x1e')]('x'));}if(_0x1b3984){this[_0x42cc('0x1a')]=_0x1b3984;}var _0x149429={'id':this['id'],'name':this[_0x42cc('0x7')],'email':this[_0x42cc('0x8')],'accountcode':this[_0x42cc('0x1f')],'fullname':this[_0x42cc('0x9')],'state':this[_0x42cc('0xa')],'stateTime':this[_0x42cc('0xc')],'status':this[_0x42cc('0xd')],'address':this[_0x42cc('0xe')],'online':this[_0x42cc('0x12')],'voiceStatus':this[_0x42cc('0x1a')],'voiceStatusTime':this[_0x42cc('0x1c')],'voiceStatusCallerIdNumber':this[_0x42cc('0x13')],'voiceStatusQueue':this[_0x42cc('0x20')],'interface':this['interface'],'onhold':this[_0x42cc('0x14')]};var _0x21addb=md5(JSON[_0x42cc('0x21')](_0x149429));if(this['md5']!==_0x21addb){this['md5']=_0x21addb;io['to'](util[_0x42cc('0x1e')](_0x42cc('0x22'),_0x149429['name']))[_0x42cc('0x23')](_0x42cc('0x24'),_[_0x42cc('0x25')](_0x149429,[_0x42cc('0x12')]));io['emit']('user:presence',_0x149429);}};module[_0x42cc('0x26')]=Agent; \ No newline at end of file +var _0x22ec=['redis','name','email','accountcode','fullname','state','status','unknown','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','not_inuse','inuse','statePause','format','stateTime','address','voiceStatusCallerIdNumber','user:%s','emit','user:ami:update','omit','user:presence','exports','util','md5','defaults','localhost'];(function(_0x1f8dd9,_0x3536fe){var _0x559151=function(_0xdb1107){while(--_0xdb1107){_0x1f8dd9['push'](_0x1f8dd9['shift']());}};_0x559151(++_0x3536fe);}(_0x22ec,0x114));var _0xc22e=function(_0x5b9f79,_0x4c20a9){_0x5b9f79=_0x5b9f79-0x0;var _0x297e5e=_0x22ec[_0x5b9f79];return _0x297e5e;};'use strict';var _=require('lodash');var util=require(_0xc22e('0x0'));var moment=require('moment');var md5=require(_0xc22e('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xc22e('0x2')](config['redis'],{'host':_0xc22e('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc22e('0x4')]));function Agent(_0x23ce88){this['id']=_0x23ce88['id']||0x0;this[_0xc22e('0x5')]=_0x23ce88[_0xc22e('0x5')]||'';this[_0xc22e('0x6')]=_0x23ce88[_0xc22e('0x6')]||'';this[_0xc22e('0x7')]=_0x23ce88['accountcode']||'';this[_0xc22e('0x8')]=_0x23ce88['fullname']||'';this[_0xc22e('0x9')]='unknown';this['stateTime']=0x0;this[_0xc22e('0xa')]=_0xc22e('0xb');this['address']='';this[_0xc22e('0xc')]='';this[_0xc22e('0xd')]='';this[_0xc22e('0xe')]='';this[_0xc22e('0xf')]=_0x23ce88[_0xc22e('0xf')]||![];this[_0xc22e('0x10')]=_0xc22e('0xb');this[_0xc22e('0x11')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xc22e('0x12')]='';this[_0xc22e('0x13')]=![];this[_0xc22e('0x14')]=![];this[_0xc22e('0x1')]='';}Agent['prototype'][_0xc22e('0x15')]=function(_0x97eb47){var _0x34b6bf;if(_0x97eb47&&_0x97eb47['state']){_0x34b6bf=_0x97eb47[_0xc22e('0x9')]['toLowerCase']();switch(_0x34b6bf){case _0xc22e('0x16'):_0x34b6bf='idle';break;case _0xc22e('0x17'):_0x34b6bf='talking';break;}}if(_0x34b6bf&&this[_0xc22e('0x10')]!==_0x34b6bf||_0x97eb47[_0xc22e('0x18')]){this['voiceStatusTime']=_['toNumber'](moment()[_0xc22e('0x19')]('x'));}if(_0x34b6bf){this[_0xc22e('0x10')]=_0x34b6bf;}var _0x1454b8={'id':this['id'],'name':this[_0xc22e('0x5')],'email':this[_0xc22e('0x6')],'accountcode':this[_0xc22e('0x7')],'fullname':this[_0xc22e('0x8')],'state':this['state'],'stateTime':this[_0xc22e('0x1a')],'status':this[_0xc22e('0xa')],'address':this[_0xc22e('0x1b')],'online':this[_0xc22e('0xf')],'voiceStatus':this[_0xc22e('0x10')],'voiceStatusTime':this[_0xc22e('0x11')],'voiceStatusCallerIdNumber':this[_0xc22e('0x1c')],'voiceStatusQueue':this[_0xc22e('0x12')],'interface':this[_0xc22e('0xe')],'onhold':this[_0xc22e('0x13')]};var _0x35e98c=md5(JSON['stringify'](_0x1454b8));if(this[_0xc22e('0x1')]!==_0x35e98c){this[_0xc22e('0x1')]=_0x35e98c;io['to'](util[_0xc22e('0x19')](_0xc22e('0x1d'),_0x1454b8[_0xc22e('0x5')]))[_0xc22e('0x1e')](_0xc22e('0x1f'),_[_0xc22e('0x20')](_0x1454b8,[_0xc22e('0xf')]));io['emit'](_0xc22e('0x21'),_0x1454b8);}};module[_0xc22e('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 2386db6..19d1ba1 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 _0x0848=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x5aab40,_0x5c354c){var _0x1f4254=function(_0x10df02){while(--_0x10df02){_0x5aab40['push'](_0x5aab40['shift']());}};_0x1f4254(++_0x5c354c);}(_0x0848,0xb8));var _0x8084=function(_0x27cb29,_0x5d1d08){_0x27cb29=_0x27cb29-0x0;var _0x20487c=_0x0848[_0x27cb29];return _0x20487c;};'use strict';function Campaign(_0x17838d){this['id']=_0x17838d['id']||0x0;this['name']=_0x17838d[_0x8084('0x0')]||'';this[_0x8084('0x1')]=_0x17838d[_0x8084('0x1')]||_0x8084('0x2');this[_0x8084('0x3')]=0x0;this[_0x8084('0x4')]=0x0;this[_0x8084('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x8084('0x6')]=!![];this[_0x8084('0x7')]=_0x17838d['active'];this[_0x8084('0x8')]=_0x17838d[_0x8084('0x8')];this[_0x8084('0x9')]=_0x17838d[_0x8084('0x9')]||null;this[_0x8084('0xa')]=_0x17838d[_0x8084('0xa')]?_0x17838d[_0x8084('0xa')]:null;this[_0x8084('0xb')]=_0x17838d[_0x8084('0xb')];this[_0x8084('0xc')]=_0x17838d['dialOriginateCallerIdNumber'];this[_0x8084('0xd')]=_0x17838d[_0x8084('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x17838d[_0x8084('0xe')];this[_0x8084('0xf')]=_0x17838d['dialCongestionRetryFrequency'];this[_0x8084('0x10')]=_0x17838d[_0x8084('0x10')];this[_0x8084('0x11')]=_0x17838d[_0x8084('0x11')];this[_0x8084('0x12')]=_0x17838d[_0x8084('0x12')];this['dialNoAnswerRetryFrequency']=_0x17838d[_0x8084('0x13')];this[_0x8084('0x14')]=_0x17838d[_0x8084('0x14')];this['dialNoSuchNumberMaxRetry']=_0x17838d['dialNoSuchNumberMaxRetry']||0x3;this[_0x8084('0x15')]=_0x17838d[_0x8084('0x15')]||0x96;this['dialDropMaxRetry']=_0x17838d[_0x8084('0x16')]||0x3;this[_0x8084('0x17')]=_0x17838d[_0x8084('0x17')]||0x96;this[_0x8084('0x18')]=_0x17838d[_0x8084('0x18')]||0x3;this[_0x8084('0x19')]=_0x17838d[_0x8084('0x19')]||0x96;this[_0x8084('0x1a')]=_0x17838d[_0x8084('0x1a')]||0x3;this[_0x8084('0x1b')]=_0x17838d[_0x8084('0x1b')]||0x96;this[_0x8084('0x1c')]=_0x17838d[_0x8084('0x1c')]||0x3;this[_0x8084('0x1d')]=_0x17838d[_0x8084('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x17838d['dialOrderByScheduledAt']||_0x8084('0x1e');this[_0x8084('0x1f')]=_0x17838d[_0x8084('0x1f')]||undefined;this[_0x8084('0x20')]=_0x17838d[_0x8084('0x20')]||undefined;this[_0x8084('0x21')]=_0x17838d[_0x8084('0x21')]||undefined;this['TrunkBackup']=_0x17838d[_0x8084('0x22')]?_0x17838d[_0x8084('0x22')]:undefined;this[_0x8084('0x23')]=_0x17838d['Trunk']?_0x17838d['Trunk']:undefined;this[_0x8084('0x24')]=_0x17838d[_0x8084('0x24')]?_0x17838d[_0x8084('0x24')]:undefined;this[_0x8084('0x25')]=_0x17838d['SquareProject']?_0x17838d[_0x8084('0x25')]:undefined;this[_0x8084('0x26')]=_0x17838d[_0x8084('0x25')]?_0x17838d[_0x8084('0x25')][_0x8084('0x0')]:undefined;this['dialAMDActive']=_0x17838d[_0x8084('0x27')]||![];this[_0x8084('0x28')]=_0x17838d[_0x8084('0x28')];this[_0x8084('0x29')]=_0x17838d[_0x8084('0x29')];this[_0x8084('0x2a')]=_0x17838d[_0x8084('0x2a')];this[_0x8084('0x2b')]=_0x17838d['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x17838d[_0x8084('0x2c')];this[_0x8084('0x2d')]=_0x17838d[_0x8084('0x2d')];this[_0x8084('0x2e')]=_0x17838d[_0x8084('0x2e')];this['dialAMDSilenceThreshold']=_0x17838d[_0x8084('0x2f')];this[_0x8084('0x30')]=_0x17838d[_0x8084('0x30')];}module[_0x8084('0x31')]=Campaign; \ No newline at end of file +var _0xd0be=['name','type','originated','temp','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0be,0x1ef));var _0xed0b=function(_0x1ada8b,_0x2b4817){_0x1ada8b=_0x1ada8b-0x0;var _0x5ca2e7=_0xd0be[_0x1ada8b];return _0x5ca2e7;};'use strict';function Campaign(_0x366cb5){this['id']=_0x366cb5['id']||0x0;this[_0xed0b('0x0')]=_0x366cb5['name']||'';this[_0xed0b('0x1')]=_0x366cb5[_0xed0b('0x1')]||'campaign';this[_0xed0b('0x2')]=0x0;this[_0xed0b('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0xed0b('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0xed0b('0x5')]=_0x366cb5['active'];this['limitCalls']=_0x366cb5[_0xed0b('0x6')];this[_0xed0b('0x7')]=_0x366cb5['dialTimezone']||null;this[_0xed0b('0x8')]=_0x366cb5[_0xed0b('0x8')]?_0x366cb5[_0xed0b('0x8')]:null;this['dialOriginateCallerIdName']=_0x366cb5[_0xed0b('0x9')];this[_0xed0b('0xa')]=_0x366cb5[_0xed0b('0xa')];this[_0xed0b('0xb')]=_0x366cb5['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x366cb5[_0xed0b('0xc')];this[_0xed0b('0xd')]=_0x366cb5['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x366cb5['dialBusyMaxRetry'];this[_0xed0b('0xe')]=_0x366cb5[_0xed0b('0xe')];this['dialNoAnswerMaxRetry']=_0x366cb5[_0xed0b('0xf')];this[_0xed0b('0x10')]=_0x366cb5[_0xed0b('0x10')];this[_0xed0b('0x11')]=_0x366cb5[_0xed0b('0x11')];this[_0xed0b('0x12')]=_0x366cb5[_0xed0b('0x12')]||0x3;this[_0xed0b('0x13')]=_0x366cb5[_0xed0b('0x13')]||0x96;this[_0xed0b('0x14')]=_0x366cb5[_0xed0b('0x14')]||0x3;this[_0xed0b('0x15')]=_0x366cb5[_0xed0b('0x15')]||0x96;this[_0xed0b('0x16')]=_0x366cb5[_0xed0b('0x16')]||0x3;this[_0xed0b('0x17')]=_0x366cb5[_0xed0b('0x17')]||0x96;this[_0xed0b('0x18')]=_0x366cb5[_0xed0b('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x366cb5[_0xed0b('0x19')]||0x96;this['dialAgentRejectMaxRetry']=_0x366cb5['dialAgentRejectMaxRetry']||0x3;this[_0xed0b('0x1a')]=_0x366cb5[_0xed0b('0x1a')]||0x96;this[_0xed0b('0x1b')]=_0x366cb5[_0xed0b('0x1b')]||_0xed0b('0x1c');this[_0xed0b('0x1d')]=_0x366cb5['dialPrefix']||undefined;this[_0xed0b('0x1e')]=_0x366cb5['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xed0b('0x1f')]=_0x366cb5[_0xed0b('0x1f')]||undefined;this[_0xed0b('0x20')]=_0x366cb5['TrunkBackup']?_0x366cb5[_0xed0b('0x20')]:undefined;this[_0xed0b('0x21')]=_0x366cb5['Trunk']?_0x366cb5[_0xed0b('0x21')]:undefined;this[_0xed0b('0x22')]=_0x366cb5[_0xed0b('0x22')]?_0x366cb5[_0xed0b('0x22')]:undefined;this['SquareProject']=_0x366cb5[_0xed0b('0x23')]?_0x366cb5['SquareProject']:undefined;this['dialQueueProject']=_0x366cb5[_0xed0b('0x23')]?_0x366cb5[_0xed0b('0x23')][_0xed0b('0x0')]:undefined;this[_0xed0b('0x24')]=_0x366cb5[_0xed0b('0x24')]||![];this[_0xed0b('0x25')]=_0x366cb5[_0xed0b('0x25')];this['dialAMDGreeting']=_0x366cb5[_0xed0b('0x26')];this[_0xed0b('0x27')]=_0x366cb5['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x366cb5['dialAMDTotalAnalysisTime'];this[_0xed0b('0x28')]=_0x366cb5[_0xed0b('0x28')];this[_0xed0b('0x29')]=_0x366cb5[_0xed0b('0x29')];this[_0xed0b('0x2a')]=_0x366cb5[_0xed0b('0x2a')];this['dialAMDSilenceThreshold']=_0x366cb5[_0xed0b('0x2b')];this['dialAMDMaximumWordLength']=_0x366cb5[_0xed0b('0x2c')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 461cc01..0fa0e5d 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 _0x4ca7=['monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','context','linkedid','exten','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag'];(function(_0x4871a9,_0x8e0e9e){var _0x43279e=function(_0x25b154){while(--_0x25b154){_0x4871a9['push'](_0x4871a9['shift']());}};_0x43279e(++_0x8e0e9e);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x113177,_0x3f077a){_0x113177=_0x113177-0x0;var _0x3a029a=_0x4ca7[_0x113177];return _0x3a029a;};'use strict';function Channel(){this[_0x74ca('0x0')]=null;this[_0x74ca('0x1')]='';this[_0x74ca('0x2')]='';this['calleridnum']=0x0;this[_0x74ca('0x3')]='';this[_0x74ca('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x74ca('0x5')]='';this['uniqueid']=0x0;this[_0x74ca('0x6')]=0x0;this[_0x74ca('0x7')]=0x0;this['answered']=![];this[_0x74ca('0x8')]=null;this['endtime']=null;this[_0x74ca('0x9')]=![];this[_0x74ca('0xa')]=![];this[_0x74ca('0xb')]='';this[_0x74ca('0xc')]='';this[_0x74ca('0xd')]=0x0;this[_0x74ca('0xe')]=0x0;this[_0x74ca('0xf')]=0x0;this['type']=null;this[_0x74ca('0x10')]=null;this['disposition']=null;this[_0x74ca('0x11')]=![];this[_0x74ca('0x12')]=null;this['queue']=null;this[_0x74ca('0x13')]=[];this[_0x74ca('0x14')]=undefined;this[_0x74ca('0x15')]=undefined;this[_0x74ca('0x16')]=undefined;this[_0x74ca('0x17')]=0x0;}module[_0x74ca('0x18')]=Channel; \ No newline at end of file +var _0x94e6=['endtime','unmanaged','lastdata','type','tag','disposition','monitor','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','answertime'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x94e6,0x194));var _0x694e=function(_0x4eca33,_0x5e1be0){_0x4eca33=_0x4eca33-0x0;var _0x5bac31=_0x94e6[_0x4eca33];return _0x5bac31;};'use strict';function Channel(){this[_0x694e('0x0')]=null;this['channel']='';this[_0x694e('0x1')]='';this[_0x694e('0x2')]=0x0;this[_0x694e('0x3')]='';this[_0x694e('0x4')]=undefined;this[_0x694e('0x5')]=undefined;this[_0x694e('0x6')]=0x0;this['context']='';this[_0x694e('0x7')]=0x0;this[_0x694e('0x8')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x694e('0x9')]=null;this[_0x694e('0xa')]=null;this[_0x694e('0xb')]=![];this['abandoned']=![];this['lastapplication']='';this[_0x694e('0xc')]='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x694e('0xd')]=null;this[_0x694e('0xe')]=null;this[_0x694e('0xf')]=null;this[_0x694e('0x10')]=![];this['monitorFilename']=null;this[_0x694e('0x11')]=null;this[_0x694e('0x12')]=[];this['transfercalleridnum']=undefined;this[_0x694e('0x13')]=undefined;this[_0x694e('0x14')]=undefined;this[_0x694e('0x15')]=0x0;}module[_0x694e('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b3f8429..9eadd81 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 _0x93bd=['remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x598d17,_0x57d353){var _0x5c8c59=function(_0x4ab314){while(--_0x4ab314){_0x598d17['push'](_0x598d17['shift']());}};_0x5c8c59(++_0x57d353);}(_0x93bd,0x136));var _0xd93b=function(_0x1d4d89,_0xef7756){_0x1d4d89=_0x1d4d89-0x0;var _0x38f888=_0x93bd[_0x1d4d89];return _0x38f888;};'use strict';function DeskAccount(_0xc73ebf){this['id']=_0xc73ebf['id']||0x0;this[_0xd93b('0x0')]=_0xc73ebf['name']||'';this['username']=_0xc73ebf[_0xd93b('0x1')]||'';this['remoteUri']=_0xc73ebf[_0xd93b('0x2')]||'';this['authType']=_0xc73ebf[_0xd93b('0x3')]||'';this[_0xd93b('0x4')]=_0xc73ebf[_0xd93b('0x4')]||'';this['consumerKey']=_0xc73ebf['consumerKey']||'';this[_0xd93b('0x5')]=_0xc73ebf[_0xd93b('0x5')]||'';this[_0xd93b('0x6')]=_0xc73ebf[_0xd93b('0x6')]||'';this[_0xd93b('0x7')]=_0xc73ebf[_0xd93b('0x7')]||'';this[_0xd93b('0x8')]=_0xc73ebf[_0xd93b('0x8')]||'';this[_0xd93b('0x9')]=_0xc73ebf[_0xd93b('0x9')]||'';this['Configurations']=_0xc73ebf[_0xd93b('0xa')]||{};}module[_0xd93b('0xb')]=DeskAccount; \ No newline at end of file +var _0x60b2=['consumerSecret','token','tokenSecret','type','Configurations','name','username','remoteUri','authType','consumerKey'];(function(_0x4ab62e,_0x1c9869){var _0x19c3d1=function(_0x2fd5b6){while(--_0x2fd5b6){_0x4ab62e['push'](_0x4ab62e['shift']());}};_0x19c3d1(++_0x1c9869);}(_0x60b2,0x177));var _0x260b=function(_0x53b55f,_0x7980d0){_0x53b55f=_0x53b55f-0x0;var _0x71d9fa=_0x60b2[_0x53b55f];return _0x71d9fa;};'use strict';function DeskAccount(_0x48eb86){this['id']=_0x48eb86['id']||0x0;this[_0x260b('0x0')]=_0x48eb86['name']||'';this[_0x260b('0x1')]=_0x48eb86[_0x260b('0x1')]||'';this[_0x260b('0x2')]=_0x48eb86[_0x260b('0x2')]||'';this[_0x260b('0x3')]=_0x48eb86[_0x260b('0x3')]||'';this['password']=_0x48eb86['password']||'';this[_0x260b('0x4')]=_0x48eb86[_0x260b('0x4')]||'';this[_0x260b('0x5')]=_0x48eb86[_0x260b('0x5')]||'';this[_0x260b('0x6')]=_0x48eb86['token']||'';this[_0x260b('0x7')]=_0x48eb86[_0x260b('0x7')]||'';this['type']=_0x48eb86[_0x260b('0x8')]||'';this['serverUrl']=_0x48eb86['serverUrl']||'';this[_0x260b('0x9')]=_0x48eb86[_0x260b('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4ea7948..ac6c998 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 _0x8502=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0xc2327a,_0x2bca46){var _0x2f99bf=function(_0x5d4be){while(--_0x5d4be){_0xc2327a['push'](_0xc2327a['shift']());}};_0x2f99bf(++_0x2bca46);}(_0x8502,0xb8));var _0x2850=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x8502[_0x458363];return _0x4d0290;};'use strict';function Dynamics365Account(_0x14dfb4){this['id']=_0x14dfb4['id']||0x0;this['name']=_0x14dfb4[_0x2850('0x0')]||'';this[_0x2850('0x1')]=_0x14dfb4[_0x2850('0x1')]||'';this['password']=_0x14dfb4[_0x2850('0x2')]||'';this[_0x2850('0x3')]=_0x14dfb4[_0x2850('0x3')]||'';this[_0x2850('0x4')]=_0x14dfb4[_0x2850('0x4')]||'';this[_0x2850('0x5')]=_0x14dfb4[_0x2850('0x5')]||'';this[_0x2850('0x6')]=_0x14dfb4['clientSecret']||{};this[_0x2850('0x7')]=_0x14dfb4[_0x2850('0x7')]||'';this[_0x2850('0x8')]=_0x14dfb4[_0x2850('0x8')]||![];this[_0x2850('0x9')]=_0x14dfb4[_0x2850('0x9')]||{};this[_0x2850('0xa')]=_0x14dfb4['CloudProvider']||{};}module[_0x2850('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xa230=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xa230,0x1d9));var _0x0a23=function(_0xb0d828,_0x8966cd){_0xb0d828=_0xb0d828-0x0;var _0x1d774f=_0xa230[_0xb0d828];return _0x1d774f;};'use strict';function Dynamics365Account(_0x50caf7){this['id']=_0x50caf7['id']||0x0;this[_0x0a23('0x0')]=_0x50caf7[_0x0a23('0x0')]||'';this[_0x0a23('0x1')]=_0x50caf7[_0x0a23('0x1')]||'';this[_0x0a23('0x2')]=_0x50caf7[_0x0a23('0x2')]||'';this[_0x0a23('0x3')]=_0x50caf7[_0x0a23('0x3')]||'';this[_0x0a23('0x4')]=_0x50caf7[_0x0a23('0x4')]||'';this['clientId']=_0x50caf7[_0x0a23('0x5')]||'';this[_0x0a23('0x6')]=_0x50caf7[_0x0a23('0x6')]||{};this[_0x0a23('0x7')]=_0x50caf7[_0x0a23('0x7')]||'';this[_0x0a23('0x8')]=_0x50caf7[_0x0a23('0x8')]||![];this[_0x0a23('0x9')]=_0x50caf7['Configurations']||{};this[_0x0a23('0xa')]=_0x50caf7[_0x0a23('0xa')]||{};}module[_0x0a23('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 9f54289..738833f 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 _0x6a1e=['tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x219a16,_0x9275b4){var _0x4b573a=function(_0xcbc5c2){while(--_0xcbc5c2){_0x219a16['push'](_0x219a16['shift']());}};_0x4b573a(++_0x9275b4);}(_0x6a1e,0x85));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x50825f){this['id']=_0x50825f['id']||0x0;this[_0xe6a1('0x0')]=_0x50825f[_0xe6a1('0x0')]||'';this[_0xe6a1('0x1')]=_0x50825f[_0xe6a1('0x1')];this[_0xe6a1('0x2')]=_0x50825f['ecm'];this[_0xe6a1('0x3')]=_0x50825f['headerinfo'];this['localstationid']=_0x50825f[_0xe6a1('0x4')];this['minrate']=_0x50825f['minrate']||0x960;this[_0xe6a1('0x5')]=_0x50825f['maxrate']||0x3840;this[_0xe6a1('0x6')]=_0x50825f[_0xe6a1('0x6')]||_0xe6a1('0x7');this[_0xe6a1('0x8')]=_0x50825f[_0xe6a1('0x8')]||'no';this[_0xe6a1('0x9')]=_0x50825f['faxdetect']||'no';this[_0xe6a1('0xa')]=_0x50825f['t38timeout']||0x1388;this[_0xe6a1('0xb')]=_0x50825f[_0xe6a1('0xb')]||_0xe6a1('0xc');this['Trunk']=_0x50825f[_0xe6a1('0xd')]?_0x50825f['Trunk']:undefined;this[_0xe6a1('0xe')]=_0x50825f[_0xe6a1('0xe')];this['key']=_0x50825f['key'];}module[_0xe6a1('0xf')]=FaxAccount; \ No newline at end of file +var _0x1f5f=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','headerinfo','localstationid'];(function(_0x282bc0,_0x494ca8){var _0x2ccc4b=function(_0x369492){while(--_0x369492){_0x282bc0['push'](_0x282bc0['shift']());}};_0x2ccc4b(++_0x494ca8);}(_0x1f5f,0x1bc));var _0xf1f5=function(_0x20d69d,_0x22e9a8){_0x20d69d=_0x20d69d-0x0;var _0x456227=_0x1f5f[_0x20d69d];return _0x456227;};'use strict';function FaxAccount(_0x265e46){this['id']=_0x265e46['id']||0x0;this['name']=_0x265e46[_0xf1f5('0x0')]||'';this['description']=_0x265e46[_0xf1f5('0x1')];this['ecm']=_0x265e46['ecm'];this['headerinfo']=_0x265e46[_0xf1f5('0x2')];this['localstationid']=_0x265e46[_0xf1f5('0x3')];this['minrate']=_0x265e46['minrate']||0x960;this[_0xf1f5('0x4')]=_0x265e46[_0xf1f5('0x4')]||0x3840;this[_0xf1f5('0x5')]=_0x265e46[_0xf1f5('0x5')]||_0xf1f5('0x6');this[_0xf1f5('0x7')]=_0x265e46[_0xf1f5('0x7')]||'no';this[_0xf1f5('0x8')]=_0x265e46[_0xf1f5('0x8')]||'no';this[_0xf1f5('0x9')]=_0x265e46[_0xf1f5('0x9')]||0x1388;this[_0xf1f5('0xa')]=_0x265e46['tech']||_0xf1f5('0xb');this[_0xf1f5('0xc')]=_0x265e46['Trunk']?_0x265e46[_0xf1f5('0xc')]:undefined;this['ListId']=_0x265e46[_0xf1f5('0xd')];this[_0xf1f5('0xe')]=_0x265e46[_0xf1f5('0xe')];}module[_0xf1f5('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 39d1bb9..e717de8 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 _0x5de3=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4a1673,_0x3b0403){var _0x196878=function(_0x134a37){while(--_0x134a37){_0x4a1673['push'](_0x4a1673['shift']());}};_0x196878(++_0x3b0403);}(_0x5de3,0xad));var _0x35de=function(_0x3aaef5,_0x16cdc8){_0x3aaef5=_0x3aaef5-0x0;var _0x4c0ed5=_0x5de3[_0x3aaef5];return _0x4c0ed5;};'use strict';function FreshdeskAccount(_0x3cc236){this['id']=_0x3cc236['id']||0x0;this[_0x35de('0x0')]=_0x3cc236['name']||'';this['username']=_0x3cc236[_0x35de('0x1')]||'';this['apiKey']=_0x3cc236[_0x35de('0x2')]||'';this[_0x35de('0x3')]=_0x3cc236['remoteUri']||'';this[_0x35de('0x4')]=_0x3cc236[_0x35de('0x4')]||'';this['Configurations']=_0x3cc236[_0x35de('0x5')]||{};}module[_0x35de('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x6e38=['name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x165dc2,_0x54ea02){var _0x427d14=function(_0x70510d){while(--_0x70510d){_0x165dc2['push'](_0x165dc2['shift']());}};_0x427d14(++_0x54ea02);}(_0x6e38,0x19e));var _0x86e3=function(_0x4e128a,_0x3ad506){_0x4e128a=_0x4e128a-0x0;var _0x3829f6=_0x6e38[_0x4e128a];return _0x3829f6;};'use strict';function FreshdeskAccount(_0x1bbaf0){this['id']=_0x1bbaf0['id']||0x0;this[_0x86e3('0x0')]=_0x1bbaf0[_0x86e3('0x0')]||'';this['username']=_0x1bbaf0[_0x86e3('0x1')]||'';this[_0x86e3('0x2')]=_0x1bbaf0['token']||'';this[_0x86e3('0x3')]=_0x1bbaf0['remoteUri']||'';this[_0x86e3('0x4')]=_0x1bbaf0[_0x86e3('0x4')]||'';this[_0x86e3('0x5')]=_0x1bbaf0[_0x86e3('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 0a29f51..c19079b 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 _0x18af=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x18af,0x8b));var _0xf18a=function(_0x521a87,_0x4ffbb0){_0x521a87=_0x521a87-0x0;var _0x291c20=_0x18af[_0x521a87];return _0x291c20;};'use strict';function FreshsalesAccount(_0x211cc7){this['id']=_0x211cc7['id']||0x0;this['name']=_0x211cc7[_0xf18a('0x0')]||'';this['username']=_0x211cc7[_0xf18a('0x1')]||'';this['apiKey']=_0x211cc7['token']||'';this['remoteUri']=_0x211cc7[_0xf18a('0x2')]||'';this[_0xf18a('0x3')]=_0x211cc7[_0xf18a('0x3')]||'';this[_0xf18a('0x4')]=_0x211cc7['Configurations']||{};}module[_0xf18a('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xd7ce=['serverUrl','Configurations','exports','name','username','token'];(function(_0x3520c1,_0x1257ad){var _0x24e55c=function(_0x18eb61){while(--_0x18eb61){_0x3520c1['push'](_0x3520c1['shift']());}};_0x24e55c(++_0x1257ad);}(_0xd7ce,0x16b));var _0xed7c=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0xd7ce[_0x13187a];return _0x65b85f;};'use strict';function FreshsalesAccount(_0x9eb2f6){this['id']=_0x9eb2f6['id']||0x0;this[_0xed7c('0x0')]=_0x9eb2f6[_0xed7c('0x0')]||'';this[_0xed7c('0x1')]=_0x9eb2f6['username']||'';this['apiKey']=_0x9eb2f6[_0xed7c('0x2')]||'';this['remoteUri']=_0x9eb2f6['remoteUri']||'';this['serverUrl']=_0x9eb2f6[_0xed7c('0x3')]||'';this[_0xed7c('0x4')]=_0x9eb2f6[_0xed7c('0x4')]||{};}module[_0xed7c('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index e6e0884..9179554 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 _0x604c=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','queue','queuecallerjoinAt','count','queuecallerabandon'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x604c,0x189));var _0xc604=function(_0xc313b6,_0x220274){_0xc313b6=_0xc313b6-0x0;var _0x16a022=_0x604c[_0xc313b6];return _0x16a022;};'use strict';function QueueReport(){this[_0xc604('0x0')]=_0xc604('0x1');this[_0xc604('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0xc604('0x3')]='';this[_0xc604('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0xc604('0x5')]=0x1;this[_0xc604('0x6')]=![];this[_0xc604('0x7')]=null;this[_0xc604('0x8')]=![];this[_0xc604('0x9')]=null;this[_0xc604('0xa')]=![];this[_0xc604('0xb')]=null;this[_0xc604('0xc')]=0x1;this[_0xc604('0xd')]='';this['connectedlinenum']='';this[_0xc604('0xe')]='';this['accountcode']='';this[_0xc604('0xf')]='';this['exten']='';this[_0xc604('0x10')]='';this[_0xc604('0x11')]=0x0;this[_0xc604('0x12')]=![];this[_0xc604('0x13')]='';this['motionChannel']=_0xc604('0x14');this[_0xc604('0x15')]=null;this[_0xc604('0x16')]=0x0;this[_0xc604('0x17')]={};}module[_0xc604('0x18')]=QueueReport; \ No newline at end of file +var _0xb68b=['queuecallercomplete','queuecallerexit','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','assigned','motionChannel','voice','routealias','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt'];(function(_0x25a155,_0x49ae81){var _0x5f5258=function(_0x137a94){while(--_0x137a94){_0x25a155['push'](_0x25a155['shift']());}};_0x5f5258(++_0x49ae81);}(_0xb68b,0x16e));var _0xbb68=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb68b[_0x19950b];return _0x3c6b41;};'use strict';function QueueReport(){this[_0xbb68('0x0')]='inbound';this[_0xbb68('0x1')]='';this[_0xbb68('0x2')]='';this[_0xbb68('0x3')]='';this[_0xbb68('0x4')]='';this[_0xbb68('0x5')]=null;this[_0xbb68('0x6')]=null;this['position']=0x1;this[_0xbb68('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xbb68('0x8')]=null;this[_0xbb68('0x9')]=![];this['queuecallercompleteAt']=null;this[_0xbb68('0xa')]=![];this['queuecallerexitAt']=null;this[_0xbb68('0xb')]=0x1;this['channel']='';this[_0xbb68('0xc')]='';this[_0xbb68('0xd')]='';this[_0xbb68('0xe')]='';this[_0xbb68('0xf')]='';this[_0xbb68('0x10')]='';this['priority']='';this[_0xbb68('0x11')]=0x0;this[_0xbb68('0x12')]=![];this['lastAssignedTo']='';this[_0xbb68('0x13')]=_0xbb68('0x14');this[_0xbb68('0x15')]=null;this[_0xbb68('0x16')]=0x0;this[_0xbb68('0x17')]={};}module[_0xbb68('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 4ed904e..7a14b8d 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 _0x25a9=['Configurations','name','username','remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x25a9,0xf1));var _0x925a=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0x25a9[_0x4d1d2c];return _0x2c4cb9;};'use strict';function SalesforceAccount(_0x10009a){this['id']=_0x10009a['id']||0x0;this[_0x925a('0x0')]=_0x10009a[_0x925a('0x0')]||'';this[_0x925a('0x1')]=_0x10009a[_0x925a('0x1')]||'';this[_0x925a('0x2')]=_0x10009a['remoteUri']||'';this[_0x925a('0x3')]=_0x10009a[_0x925a('0x3')]||'';this['clientId']=_0x10009a['clientId']||'';this[_0x925a('0x4')]=_0x10009a['clientSecret']||'';this[_0x925a('0x5')]=_0x10009a[_0x925a('0x5')]||'';this[_0x925a('0x6')]=_0x10009a[_0x925a('0x6')]||_0x925a('0x7');this[_0x925a('0x8')]=_0x10009a[_0x925a('0x8')]||'';this['Configurations']=_0x10009a[_0x925a('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x3f21=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x799d4d,_0x2e9985){var _0x2004c3=function(_0x343fce){while(--_0x343fce){_0x799d4d['push'](_0x799d4d['shift']());}};_0x2004c3(++_0x2e9985);}(_0x3f21,0x7b));var _0x13f2=function(_0x329424,_0x2b114a){_0x329424=_0x329424-0x0;var _0x86f8c2=_0x3f21[_0x329424];return _0x86f8c2;};'use strict';function SalesforceAccount(_0x2121c9){this['id']=_0x2121c9['id']||0x0;this[_0x13f2('0x0')]=_0x2121c9[_0x13f2('0x0')]||'';this[_0x13f2('0x1')]=_0x2121c9['username']||'';this[_0x13f2('0x2')]=_0x2121c9[_0x13f2('0x2')]||'';this[_0x13f2('0x3')]=_0x2121c9[_0x13f2('0x3')]||'';this[_0x13f2('0x4')]=_0x2121c9[_0x13f2('0x4')]||'';this[_0x13f2('0x5')]=_0x2121c9[_0x13f2('0x5')]||'';this[_0x13f2('0x6')]=_0x2121c9[_0x13f2('0x6')]||'';this[_0x13f2('0x7')]=_0x2121c9[_0x13f2('0x7')]||_0x13f2('0x8');this['serverUrl']=_0x2121c9['serverUrl']||'';this[_0x13f2('0x9')]=_0x2121c9[_0x13f2('0x9')]||{};}module[_0x13f2('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 cc2a7e9..ea70529 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 _0xabcd=['password','remoteUri','serverUrl','name','username'];(function(_0x10fa34,_0x54ded1){var _0x4b2b77=function(_0x24af4f){while(--_0x24af4f){_0x10fa34['push'](_0x10fa34['shift']());}};_0x4b2b77(++_0x54ded1);}(_0xabcd,0x17a));var _0xdabc=function(_0x352b6d,_0x309d88){_0x352b6d=_0x352b6d-0x0;var _0x125a25=_0xabcd[_0x352b6d];return _0x125a25;};'use strict';function ServicenowAccount(_0x544a95){this['id']=_0x544a95['id']||0x0;this[_0xdabc('0x0')]=_0x544a95['name']||'';this[_0xdabc('0x1')]=_0x544a95['username']||'';this['password']=_0x544a95[_0xdabc('0x2')]||'';this[_0xdabc('0x3')]=_0x544a95[_0xdabc('0x3')]||'';this[_0xdabc('0x4')]=_0x544a95[_0xdabc('0x4')]||'';this['Configurations']=_0x544a95['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x446c=['name','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x446c,0x114));var _0xc446=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x446c[_0x43c8b8];return _0x413be3;};'use strict';function ServicenowAccount(_0x3dee3a){this['id']=_0x3dee3a['id']||0x0;this[_0xc446('0x0')]=_0x3dee3a[_0xc446('0x0')]||'';this['username']=_0x3dee3a['username']||'';this[_0xc446('0x1')]=_0x3dee3a[_0xc446('0x1')]||'';this['remoteUri']=_0x3dee3a[_0xc446('0x2')]||'';this[_0xc446('0x3')]=_0x3dee3a[_0xc446('0x3')]||'';this[_0xc446('0x4')]=_0x3dee3a[_0xc446('0x4')]||{};}module[_0xc446('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 108e3d9..c6c7b8e 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 _0x64f4=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0x64f4,0x180));var _0x464f=function(_0x2e1c3d,_0x3eeaa3){_0x2e1c3d=_0x2e1c3d-0x0;var _0x5ddf58=_0x64f4[_0x2e1c3d];return _0x5ddf58;};'use strict';function SugarcrmAccount(_0x5ee57a){this['id']=_0x5ee57a['id']||0x0;this[_0x464f('0x0')]=_0x5ee57a[_0x464f('0x0')]||'';this[_0x464f('0x1')]=_0x5ee57a[_0x464f('0x1')]||'';this[_0x464f('0x2')]=_0x5ee57a[_0x464f('0x2')]||'';this['remoteUri']=_0x5ee57a[_0x464f('0x3')]||'';this[_0x464f('0x4')]=_0x5ee57a[_0x464f('0x4')]||'';this[_0x464f('0x5')]=_0x5ee57a[_0x464f('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xeacc=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeacc,0x7e));var _0xceac=function(_0x19e146,_0x5ee698){_0x19e146=_0x19e146-0x0;var _0x52178e=_0xeacc[_0x19e146];return _0x52178e;};'use strict';function SugarcrmAccount(_0x358c1c){this['id']=_0x358c1c['id']||0x0;this[_0xceac('0x0')]=_0x358c1c['name']||'';this[_0xceac('0x1')]=_0x358c1c[_0xceac('0x1')]||'';this[_0xceac('0x2')]=_0x358c1c[_0xceac('0x2')]||'';this['remoteUri']=_0x358c1c[_0xceac('0x3')]||'';this[_0xceac('0x4')]=_0x358c1c[_0xceac('0x4')]||'';this[_0xceac('0x5')]=_0x358c1c[_0xceac('0x5')]||{};}module[_0xceac('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 72c443c..35598bb 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 _0xbf3f=['exports','unknown','stateTime','status','address'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xbf3f,0x10f));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x2a57e6){this['id']=_0x2a57e6['id']||0x0;this['name']=_0x2a57e6['name']||'';this['accountcode']=_0x2a57e6['accountcode']||'';this['state']=_0xfbf3('0x0');this[_0xfbf3('0x1')]=0x0;this[_0xfbf3('0x2')]='unknown';this[_0xfbf3('0x3')]='';}module[_0xfbf3('0x4')]=Telephone; \ No newline at end of file +var _0xdc64=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x29aabe,_0x6cb895){var _0x20c06e=function(_0x50cf69){while(--_0x50cf69){_0x29aabe['push'](_0x29aabe['shift']());}};_0x20c06e(++_0x6cb895);}(_0xdc64,0x80));var _0x4dc6=function(_0x531144,_0xc6b3fc){_0x531144=_0x531144-0x0;var _0xa3c0e3=_0xdc64[_0x531144];return _0xa3c0e3;};'use strict';function Telephone(_0x22e240){this['id']=_0x22e240['id']||0x0;this[_0x4dc6('0x0')]=_0x22e240[_0x4dc6('0x0')]||'';this[_0x4dc6('0x1')]=_0x22e240['accountcode']||'';this[_0x4dc6('0x2')]=_0x4dc6('0x3');this[_0x4dc6('0x4')]=0x0;this[_0x4dc6('0x5')]=_0x4dc6('0x3');this[_0x4dc6('0x6')]='';}module[_0x4dc6('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 fa5ba64..7a2b0a5 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x3d7700,_0xfc1dfa){var _0x4d8038=function(_0x640fd2){while(--_0x640fd2){_0x3d7700['push'](_0x3d7700['shift']());}};_0x4d8038(++_0xfc1dfa);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a3e30,_0x5996b5){_0x3a3e30=_0x3a3e30-0x0;var _0x19f849=_0xb10b[_0x3a3e30];return _0x19f849;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x2c0372,_0x1b070f){var _0x56946f=function(_0x5bbdfc){while(--_0x5bbdfc){_0x2c0372['push'](_0x2c0372['shift']());}};_0x56946f(++_0x1b070f);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f8a7c,_0x3f65fd){_0x2f8a7c=_0x2f8a7c-0x0;var _0x257e01=_0xb10b[_0x2f8a7c];return _0x257e01;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index e90a599..6d9fcd9 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(_0x39b65a,_0x2a9be5){var _0x4dc4a0=function(_0xc6da3d){while(--_0xc6da3d){_0x39b65a['push'](_0x39b65a['shift']());}};_0x4dc4a0(++_0x2a9be5);}(_0x8603,0x190));var _0x3860=function(_0x154d88,_0x485504){_0x154d88=_0x154d88-0x0;var _0x5f2793=_0x8603[_0x154d88];return _0x5f2793;};'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 _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a85,0x178));var _0x51a8=function(_0x32c8c2,_0x5e0ab0){_0x32c8c2=_0x32c8c2-0x0;var _0x16ed42=_0x1a85[_0x32c8c2];return _0x16ed42;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 38e1364..8299be2 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 _0x3a18=['exports','active','name','state','unknown','stateTime','registry','indexOf','host','port','domain','refresh','registrationtime','address','defaultuser'];(function(_0x30e1e4,_0x73e4f9){var _0x5e3720=function(_0x4e7df2){while(--_0x4e7df2){_0x30e1e4['push'](_0x30e1e4['shift']());}};_0x5e3720(++_0x73e4f9);}(_0x3a18,0xe2));var _0x83a1=function(_0x4a7f6a,_0x4f04c2){_0x4a7f6a=_0x4a7f6a-0x0;var _0x138985=_0x3a18[_0x4a7f6a];return _0x138985;};'use strict';function Trunk(_0x258a80){this['id']=_0x258a80['id']||0x0;this[_0x83a1('0x0')]=_0x258a80['active']||![];this['name']=_0x258a80[_0x83a1('0x1')]||'';this[_0x83a1('0x2')]=_0x83a1('0x3');this[_0x83a1('0x4')]=0x0;this['status']=_0x83a1('0x3');this[_0x83a1('0x5')]=_0x258a80[_0x83a1('0x5')]&&_0x258a80[_0x83a1('0x5')][_0x83a1('0x6')](':')?_0x258a80[_0x83a1('0x5')]['split'](':')[0x0]:'';this[_0x83a1('0x7')]='';this[_0x83a1('0x8')]='';this[_0x83a1('0x9')]='';this['domainport']='';this[_0x83a1('0xa')]='';this['stateRegistry']='unknown';this[_0x83a1('0xb')]='';this[_0x83a1('0xc')]='';this['defaultuser']=_0x258a80[_0x83a1('0xd')]||'';}module[_0x83a1('0xe')]=Trunk; \ No newline at end of file +var _0x9115=['status','registry','split','host','port','domain','domainport','refresh','defaultuser','active','name','state','unknown'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x9115,0xcc));var _0x5911=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x9115[_0x2e3545];return _0xcf18f;};'use strict';function Trunk(_0xcac989){this['id']=_0xcac989['id']||0x0;this[_0x5911('0x0')]=_0xcac989[_0x5911('0x0')]||![];this[_0x5911('0x1')]=_0xcac989[_0x5911('0x1')]||'';this[_0x5911('0x2')]=_0x5911('0x3');this['stateTime']=0x0;this[_0x5911('0x4')]=_0x5911('0x3');this[_0x5911('0x5')]=_0xcac989[_0x5911('0x5')]&&_0xcac989[_0x5911('0x5')]['indexOf'](':')?_0xcac989['registry'][_0x5911('0x6')](':')[0x0]:'';this[_0x5911('0x7')]='';this[_0x5911('0x8')]='';this[_0x5911('0x9')]='';this[_0x5911('0xa')]='';this[_0x5911('0xb')]='';this['stateRegistry']=_0x5911('0x3');this['registrationtime']='';this['address']='';this[_0x5911('0xc')]=_0xcac989['defaultuser']||'';}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 62cae5a..27f48b6 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 _0x5fe3=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x5fe3,0xfb));var _0x35fe=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x5fe3[_0x12aaee];return _0x37c350;};'use strict';function voiceExtension(_0x488aef){this['id']=_0x488aef['id']||0x0;this[_0x35fe('0x0')]=_0x488aef[_0x35fe('0x0')]||'';this['recordingFormat']=_0x488aef[_0x35fe('0x1')]||'none';this['mandatoryDisposition']=_0x488aef[_0x35fe('0x2')]||![];}module[_0x35fe('0x3')]=voiceExtension; \ No newline at end of file +var _0x945f=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x5adcc9,_0x271a23){var _0x26f24a=function(_0x2dad78){while(--_0x2dad78){_0x5adcc9['push'](_0x5adcc9['shift']());}};_0x26f24a(++_0x271a23);}(_0x945f,0xf3));var _0xf945=function(_0x8d06a7,_0x54328e){_0x8d06a7=_0x8d06a7-0x0;var _0x25b606=_0x945f[_0x8d06a7];return _0x25b606;};'use strict';function voiceExtension(_0x5ee01b){this['id']=_0x5ee01b['id']||0x0;this[_0xf945('0x0')]=_0x5ee01b[_0xf945('0x0')]||'';this[_0xf945('0x1')]=_0x5ee01b[_0xf945('0x1')]||_0xf945('0x2');this[_0xf945('0x3')]=_0x5ee01b[_0xf945('0x3')]||![];}module[_0xf945('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ee5bbde..9152b84 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 _0x9aac=['dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','wav','gsm','fewestcalls','linear','ringall','rrmemory','rrordered','name','monitor_format','type','waiting','total','answered','sumBillable','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0xb18948,_0x44499c){var _0x3eb80e=function(_0x1c09bb){while(--_0x1c09bb){_0xb18948['push'](_0xb18948['shift']());}};_0x3eb80e(++_0x44499c);}(_0x9aac,0x135));var _0xc9aa=function(_0x14d022,_0x45e73d){_0x14d022=_0x14d022-0x0;var _0x37d93f=_0x9aac[_0x14d022];return _0x37d93f;};'use strict';var monitorFormat={'wav':_0xc9aa('0x0'),'wav49':'wav49','gsm':_0xc9aa('0x1')};var strategy={'fewestcalls':_0xc9aa('0x2'),'leastrecent':'leastrecent','linear':_0xc9aa('0x3'),'random':'random','ringall':_0xc9aa('0x4'),'rr':'roundrobin','rrmemory':_0xc9aa('0x5'),'rrordered':_0xc9aa('0x6'),'wrandom':'wrandom'};function VoiceQueue(_0x280687){this['id']=_0x280687['id']||0x0;this[_0xc9aa('0x7')]=_0x280687[_0xc9aa('0x7')]||'';this['monitor_format']=_0x280687[_0xc9aa('0x8')]||'';this[_0xc9aa('0x9')]=_0x280687[_0xc9aa('0x9')]||'inbound';this[_0xc9aa('0xa')]=0x0;this[_0xc9aa('0xb')]=0x0;this[_0xc9aa('0xc')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xc9aa('0xd')]=0x0;this['unmanaged']=0x0;this[_0xc9aa('0xe')]=0x0;this[_0xc9aa('0xf')]=0x0;this[_0xc9aa('0x10')]=0x0;this[_0xc9aa('0x11')]=0x0;this[_0xc9aa('0x12')]=0x0;this[_0xc9aa('0x13')]=0x0;this[_0xc9aa('0x14')]=0x0;this[_0xc9aa('0x15')]=0x0;this[_0xc9aa('0x16')]=0x0;this[_0xc9aa('0x17')]=0x0;this[_0xc9aa('0x18')]=0x0;this[_0xc9aa('0x19')]=0x0;this[_0xc9aa('0x1a')]=0x0;this[_0xc9aa('0x1b')]=0x0;this[_0xc9aa('0x1c')]=_0x280687[_0xc9aa('0x1c')]||![];this[_0xc9aa('0x1d')]=_0x280687['acwTimeout']||0xa;this[_0xc9aa('0x1e')]=_0x280687['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0xc9aa('0x1f')]='';this[_0xc9aa('0x20')]='';this[_0xc9aa('0x21')]=0x0;this[_0xc9aa('0x22')]=0x0;this['dialTimezone']=_0x280687[_0xc9aa('0x23')]||null;this[_0xc9aa('0x24')]=_0x280687[_0xc9aa('0x24')]?_0x280687['dialGlobalInterval']:null;this[_0xc9aa('0x25')]=_0x280687[_0xc9aa('0x25')];this[_0xc9aa('0x26')]=_0x280687[_0xc9aa('0x26')]||_0xc9aa('0x27');this[_0xc9aa('0x28')]=_0x280687['dialLimitChannel']||0x0;this[_0xc9aa('0x29')]=_0x280687['dialLimitQueue']||0x0;this[_0xc9aa('0x2a')]=_0x280687['dialPowerLevel']||0x1;this[_0xc9aa('0x2b')]=_0x280687['dialPredictiveOptimization']||_0xc9aa('0x2c');this[_0xc9aa('0x2d')]=_0x280687[_0xc9aa('0x2d')]||0.03;this[_0xc9aa('0x2e')]=_0x280687['dialPredictiveInterval']||0x258;this[_0xc9aa('0x2f')]=_0x280687[_0xc9aa('0x2f')]||_0xc9aa('0x30');this[_0xc9aa('0x31')]=_0x280687[_0xc9aa('0x31')]||'anonymous';this[_0xc9aa('0x32')]=_0x280687[_0xc9aa('0x32')]||0x1e;this[_0xc9aa('0x33')]=_0x280687[_0xc9aa('0x33')]||_0xc9aa('0x34');this[_0xc9aa('0x35')]=_0x280687[_0xc9aa('0x35')]||0x3;this['dialQueueProject']=_0x280687[_0xc9aa('0x36')]||undefined;this[_0xc9aa('0x37')]=_0x280687['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x280687[_0xc9aa('0x38')]||0x96;this[_0xc9aa('0x39')]=_0x280687[_0xc9aa('0x39')]||0x3;this[_0xc9aa('0x3a')]=_0x280687[_0xc9aa('0x3a')]||0x96;this[_0xc9aa('0x3b')]=_0x280687[_0xc9aa('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x280687[_0xc9aa('0x3c')]||0x96;this[_0xc9aa('0x3d')]=_0x280687[_0xc9aa('0x3d')]||0x3;this[_0xc9aa('0x3e')]=_0x280687[_0xc9aa('0x3e')]||0x96;this[_0xc9aa('0x3f')]=_0x280687[_0xc9aa('0x3f')]||0x3;this['dialDropRetryFrequency']=_0x280687[_0xc9aa('0x40')]||0x96;this[_0xc9aa('0x41')]=_0x280687[_0xc9aa('0x41')]||0x3;this[_0xc9aa('0x42')]=_0x280687[_0xc9aa('0x42')]||0x96;this[_0xc9aa('0x43')]=_0x280687[_0xc9aa('0x43')]||0x3;this[_0xc9aa('0x44')]=_0x280687[_0xc9aa('0x44')]||0x96;this[_0xc9aa('0x45')]=_0x280687[_0xc9aa('0x45')]||0x3;this['dialAgentRejectRetryFrequency']=_0x280687['dialAgentRejectRetryFrequency']||0x96;this[_0xc9aa('0x46')]=_0x280687['callAdditionalPhoneAfterMin']||0x3;this[_0xc9aa('0x47')]=_0x280687[_0xc9aa('0x47')]||0x4;this[_0xc9aa('0x48')]=_0x280687['Trunk']?_0x280687[_0xc9aa('0x48')]:undefined;this[_0xc9aa('0x49')]=_0x280687['TrunkBackup']?_0x280687[_0xc9aa('0x49')]:undefined;this[_0xc9aa('0x4a')]=_0x280687['dialPrefix']||undefined;this[_0xc9aa('0x4b')]=_0x280687[_0xc9aa('0x4b')]?_0x280687[_0xc9aa('0x4b')]:undefined;this[_0xc9aa('0x4c')]=_0x280687['dialOrderByScheduledAt']||_0xc9aa('0x4d');this[_0xc9aa('0x4e')]=_0x280687['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc9aa('0x4f')]=_0x280687[_0xc9aa('0x4f')]||undefined;this[_0xc9aa('0x50')]=strategy[_0x280687[_0xc9aa('0x50')]];this[_0xc9aa('0x51')]=!![];this[_0xc9aa('0x52')]=_0x280687['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x280687[_0xc9aa('0x53')];this[_0xc9aa('0x54')]=_0x280687[_0xc9aa('0x54')];this[_0xc9aa('0x55')]=_0x280687[_0xc9aa('0x55')];this[_0xc9aa('0x56')]=_0x280687[_0xc9aa('0x56')];this['dialAMDMinWordLength']=_0x280687[_0xc9aa('0x57')];this[_0xc9aa('0x58')]=_0x280687[_0xc9aa('0x58')];this[_0xc9aa('0x59')]=_0x280687['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x280687['dialAMDSilenceThreshold'];this[_0xc9aa('0x5a')]=_0x280687[_0xc9aa('0x5a')];this[_0xc9aa('0x5b')]=0x0;this[_0xc9aa('0x5c')]=0x0;this[_0xc9aa('0x5d')]=_0x280687[_0xc9aa('0x5d')];this[_0xc9aa('0x5e')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xc9aa('0x5f')]=0x0;this[_0xc9aa('0x60')]=0x0;this[_0xc9aa('0x61')]=0x0;this[_0xc9aa('0x62')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xc9aa('0x63')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xc9aa('0x64')]=0x0;this[_0xc9aa('0x65')]=0x0;this[_0xc9aa('0x66')]=0x0;this[_0xc9aa('0x67')]=0x0;this['startProgressive']=undefined;this[_0xc9aa('0x68')]=undefined;this['handlePredictive']=undefined;this[_0xc9aa('0x69')]=1.05;this[_0xc9aa('0x6a')]=0x0;this[_0xc9aa('0x6b')]=0x0;this[_0xc9aa('0x6c')]=0x0;this[_0xc9aa('0x6d')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xc9aa('0x6e')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xc9aa('0x6f')]=0x0;this[_0xc9aa('0x70')]=_0x280687[_0xc9aa('0x71')]||0x14;this[_0xc9aa('0x72')]=_0x280687[_0xc9aa('0x71')]||0xa;this[_0xc9aa('0x73')]=0x0;this[_0xc9aa('0x74')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0xc9aa('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xc9aa('0x76')]=0x0;this['dialRecallMeTimeout']=_0x280687[_0xc9aa('0x77')]||0x1e;this[_0xc9aa('0x78')]=_0x280687[_0xc9aa('0x78')]||![];this[_0xc9aa('0x79')]=!!_0x280687[_0xc9aa('0x79')]||![];this[_0xc9aa('0x7a')]=!!_0x280687[_0xc9aa('0x7a')]||![];this[_0xc9aa('0x7b')]=_0x280687[_0xc9aa('0x7b')]||undefined;this[_0xc9aa('0x7c')]=_0x280687[_0xc9aa('0x7c')]||![];this[_0xc9aa('0x7d')]=_0x280687['dialAgiAfterHangupAgent']||![];this[_0xc9aa('0x8')]=monitorFormat[_0x280687[_0xc9aa('0x8')]]?monitorFormat[_0x280687[_0xc9aa('0x8')]]:undefined;this['mandatoryDisposition']=_0x280687['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x280687['mandatoryDispositionPause']?_0x280687['mandatoryDispositionPause']:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0x0e76=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','wav','fewestcalls','linear','random','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','answered','sumHoldTime','sumBillable','abandoned','busy','inUse','notInUse','onHold','paused','ringing','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x47883c,_0x22fc42){var _0x1bd962=function(_0x5c19aa){while(--_0x5c19aa){_0x47883c['push'](_0x47883c['shift']());}};_0x1bd962(++_0x22fc42);}(_0x0e76,0xc4));var _0x60e7=function(_0xeadc11,_0x27e378){_0xeadc11=_0xeadc11-0x0;var _0x4257b6=_0x0e76[_0xeadc11];return _0x4257b6;};'use strict';var monitorFormat={'wav':_0x60e7('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0x60e7('0x1'),'leastrecent':'leastrecent','linear':_0x60e7('0x2'),'random':_0x60e7('0x3'),'ringall':_0x60e7('0x4'),'rr':_0x60e7('0x5'),'rrmemory':_0x60e7('0x6'),'rrordered':'rrordered','wrandom':_0x60e7('0x7')};function VoiceQueue(_0x35b628){this['id']=_0x35b628['id']||0x0;this[_0x60e7('0x8')]=_0x35b628[_0x60e7('0x8')]||'';this[_0x60e7('0x9')]=_0x35b628[_0x60e7('0x9')]||'';this['type']=_0x35b628[_0x60e7('0xa')]||_0x60e7('0xb');this[_0x60e7('0xc')]=0x0;this['total']=0x0;this[_0x60e7('0xd')]=0x0;this['sumDuration']=0x0;this[_0x60e7('0xe')]=0x0;this[_0x60e7('0xf')]=0x0;this['unmanaged']=0x0;this[_0x60e7('0x10')]=0x0;this['available']=0x0;this[_0x60e7('0x11')]=0x0;this[_0x60e7('0x12')]=0x0;this['invalid']=0x0;this['loggedIn']=0x0;this[_0x60e7('0x13')]=0x0;this[_0x60e7('0x14')]=0x0;this[_0x60e7('0x15')]=0x0;this[_0x60e7('0x16')]=0x0;this['ringInUse']=0x0;this[_0x60e7('0x17')]=0x0;this['unavailable']=0x0;this[_0x60e7('0x18')]=0x0;this[_0x60e7('0x19')]=_0x35b628['acw']||![];this[_0x60e7('0x1a')]=_0x35b628['acwTimeout']||0xa;this[_0x60e7('0x1b')]=_0x35b628[_0x60e7('0x1b')]||'no';this[_0x60e7('0x1c')]=!![];this['message']='';this['statusMessage']='';this[_0x60e7('0x1d')]=0x0;this['temp']=0x0;this[_0x60e7('0x1e')]=_0x35b628[_0x60e7('0x1e')]||null;this[_0x60e7('0x1f')]=_0x35b628[_0x60e7('0x1f')]?_0x35b628['dialGlobalInterval']:null;this[_0x60e7('0x20')]=_0x35b628['dialActive'];this[_0x60e7('0x21')]=_0x35b628[_0x60e7('0x21')]||_0x60e7('0x22');this[_0x60e7('0x23')]=_0x35b628[_0x60e7('0x23')]||0x0;this[_0x60e7('0x24')]=_0x35b628[_0x60e7('0x24')]||0x0;this[_0x60e7('0x25')]=_0x35b628['dialPowerLevel']||0x1;this[_0x60e7('0x26')]=_0x35b628[_0x60e7('0x26')]||'dropRate';this[_0x60e7('0x27')]=_0x35b628['dialPredictiveOptimizationPercentage']||0.03;this[_0x60e7('0x28')]=_0x35b628[_0x60e7('0x28')]||0x258;this[_0x60e7('0x29')]=_0x35b628[_0x60e7('0x29')]||_0x60e7('0x2a');this[_0x60e7('0x2b')]=_0x35b628['dialOriginateCallerIdNumber']||_0x60e7('0x2a');this[_0x60e7('0x2c')]=_0x35b628[_0x60e7('0x2c')]||0x1e;this['dialQueueOptions']=_0x35b628['dialQueueOptions']||_0x60e7('0x2d');this[_0x60e7('0x2e')]=_0x35b628[_0x60e7('0x2e')]||0x3;this[_0x60e7('0x2f')]=_0x35b628['dialQueueProject']||undefined;this[_0x60e7('0x30')]=_0x35b628[_0x60e7('0x30')]||0x3;this[_0x60e7('0x31')]=_0x35b628[_0x60e7('0x31')]||0x96;this[_0x60e7('0x32')]=_0x35b628['dialBusyMaxRetry']||0x3;this[_0x60e7('0x33')]=_0x35b628[_0x60e7('0x33')]||0x96;this[_0x60e7('0x34')]=_0x35b628[_0x60e7('0x34')]||0x3;this[_0x60e7('0x35')]=_0x35b628[_0x60e7('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x35b628[_0x60e7('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x35b628[_0x60e7('0x37')]||0x96;this['dialDropMaxRetry']=_0x35b628[_0x60e7('0x38')]||0x3;this[_0x60e7('0x39')]=_0x35b628[_0x60e7('0x39')]||0x96;this[_0x60e7('0x3a')]=_0x35b628[_0x60e7('0x3a')]||0x3;this[_0x60e7('0x3b')]=_0x35b628[_0x60e7('0x3b')]||0x96;this['dialMachineMaxRetry']=_0x35b628[_0x60e7('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x35b628[_0x60e7('0x3d')]||0x96;this[_0x60e7('0x3e')]=_0x35b628[_0x60e7('0x3e')]||0x3;this[_0x60e7('0x3f')]=_0x35b628[_0x60e7('0x3f')]||0x96;this[_0x60e7('0x40')]=_0x35b628[_0x60e7('0x40')]||0x3;this[_0x60e7('0x41')]=_0x35b628['dialGlobalMaxRetry']||0x4;this[_0x60e7('0x42')]=_0x35b628['Trunk']?_0x35b628[_0x60e7('0x42')]:undefined;this['TrunkBackup']=_0x35b628['TrunkBackup']?_0x35b628['TrunkBackup']:undefined;this['dialPrefix']=_0x35b628['dialPrefix']||undefined;this['Interval']=_0x35b628['Interval']?_0x35b628[_0x60e7('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x35b628[_0x60e7('0x44')]||_0x60e7('0x45');this[_0x60e7('0x46')]=_0x35b628[_0x60e7('0x46')]||undefined;this[_0x60e7('0x47')]=_0x35b628[_0x60e7('0x47')]||undefined;this[_0x60e7('0x48')]=strategy[_0x35b628[_0x60e7('0x48')]];this[_0x60e7('0x49')]=!![];this['dialAMDActive']=_0x35b628[_0x60e7('0x4a')]||![];this['dialAMDInitialSilence']=_0x35b628[_0x60e7('0x4b')];this[_0x60e7('0x4c')]=_0x35b628[_0x60e7('0x4c')];this[_0x60e7('0x4d')]=_0x35b628['dialAMDAfterGreetingSilence'];this[_0x60e7('0x4e')]=_0x35b628[_0x60e7('0x4e')];this[_0x60e7('0x4f')]=_0x35b628[_0x60e7('0x4f')];this[_0x60e7('0x50')]=_0x35b628[_0x60e7('0x50')];this['dialAMDMaximumNumberOfWords']=_0x35b628[_0x60e7('0x51')];this[_0x60e7('0x52')]=_0x35b628[_0x60e7('0x52')];this[_0x60e7('0x53')]=_0x35b628[_0x60e7('0x53')];this[_0x60e7('0x54')]=0x0;this[_0x60e7('0x55')]=0x0;this[_0x60e7('0x56')]=_0x35b628[_0x60e7('0x56')];this[_0x60e7('0x57')]=0x0;this[_0x60e7('0x58')]=0x0;this[_0x60e7('0x59')]=0x0;this[_0x60e7('0x5a')]=0x0;this[_0x60e7('0x5b')]=0x0;this[_0x60e7('0x5c')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x60e7('0x5d')]=0x0;this[_0x60e7('0x5e')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x60e7('0x5f')]=0x0;this[_0x60e7('0x60')]=0x0;this[_0x60e7('0x61')]=0x0;this[_0x60e7('0x62')]=undefined;this['startPredictive']=undefined;this[_0x60e7('0x63')]=undefined;this[_0x60e7('0x64')]=1.05;this[_0x60e7('0x65')]=0x0;this[_0x60e7('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x60e7('0x67')]=0x0;this[_0x60e7('0x68')]=0x0;this[_0x60e7('0x69')]=0x0;this[_0x60e7('0x6a')]=0x0;this[_0x60e7('0x6b')]=0x0;this[_0x60e7('0x6c')]=_0x35b628[_0x60e7('0x6d')]||0x14;this[_0x60e7('0x6e')]=_0x35b628['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x60e7('0x6f')]=0x0;this[_0x60e7('0x70')]=0x0;this[_0x60e7('0x71')]=0x1;this['erlangCalls']=0x0;this[_0x60e7('0x72')]=0x0;this[_0x60e7('0x73')]=0x0;this['erlangBusyFactor']=0x0;this[_0x60e7('0x74')]=_0x35b628['dialRecallMeTimeout']||0x1e;this[_0x60e7('0x75')]=_0x35b628['dialRecallInQueue']||![];this[_0x60e7('0x76')]=!!_0x35b628['dialPreviewAutoRecallMe']||![];this[_0x60e7('0x77')]=!!_0x35b628[_0x60e7('0x77')]||![];this[_0x60e7('0x78')]=_0x35b628[_0x60e7('0x78')]||undefined;this[_0x60e7('0x79')]=_0x35b628[_0x60e7('0x79')]||![];this[_0x60e7('0x7a')]=_0x35b628[_0x60e7('0x7a')]||![];this['monitor_format']=monitorFormat[_0x35b628[_0x60e7('0x9')]]?monitorFormat[_0x35b628[_0x60e7('0x9')]]:undefined;this['mandatoryDisposition']=_0x35b628['mandatoryDisposition']||![];this[_0x60e7('0x7b')]=_0x35b628['mandatoryDispositionPause']?_0x35b628[_0x60e7('0x7b')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 955c4f4..74a10c2 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 _0xa049=['predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','status','keys','queue','dialer','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','paused','ringing','talking','waiting','answered','inUse','loggedInDb','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xa049,0x1db));var _0x9a04=function(_0x4ea728,_0x3ba8a8){_0x4ea728=_0x4ea728-0x0;var _0x290764=_0xa049[_0x4ea728];return _0x290764;};'use strict';var INBOUND_COUNTERS=[_0x9a04('0x0'),_0x9a04('0x1'),'loggedInDb',_0x9a04('0x2'),_0x9a04('0x3'),_0x9a04('0x4'),_0x9a04('0x5')];var OUTBOUND_COUNTERS=[_0x9a04('0x0'),_0x9a04('0x6'),_0x9a04('0x7'),_0x9a04('0x1'),_0x9a04('0x8'),'originated',_0x9a04('0x9'),_0x9a04('0xa'),'outboundBlacklistCallsDay',_0x9a04('0xb'),_0x9a04('0xc'),_0x9a04('0xd'),_0x9a04('0xe'),_0x9a04('0xf'),_0x9a04('0x10'),'outboundUnknownCallsDay',_0x9a04('0x2'),_0x9a04('0x11'),_0x9a04('0x4'),_0x9a04('0x12'),_0x9a04('0x13'),_0x9a04('0x14'),'waiting'];function VoiceQueueSummary(_0x2e9ccb){this['id']=_0x2e9ccb['id'];this[_0x9a04('0x15')]=_0x2e9ccb[_0x9a04('0x15')];this['strategy']=_0x2e9ccb[_0x9a04('0x16')];this[_0x9a04('0x17')]=_0x2e9ccb[_0x9a04('0x17')]||0x0;this[_0x9a04('0x6')]=_0x2e9ccb[_0x9a04('0x6')]||0x0;this['available']=_0x2e9ccb[_0x9a04('0x0')]||0x0;this['busy']=_0x2e9ccb[_0x9a04('0x18')]||0x0;this[_0x9a04('0x7')]=_0x2e9ccb['inUse']||0x0;this[_0x9a04('0x19')]=_0x2e9ccb[_0x9a04('0x19')]||0x0;this['loggedIn']=_0x2e9ccb[_0x9a04('0x1')]||0x0;this[_0x9a04('0x8')]=_0x2e9ccb[_0x9a04('0x8')]||0x0;this[_0x9a04('0x1a')]=_0x2e9ccb[_0x9a04('0x1a')]||0x0;this['notInUse']=_0x2e9ccb[_0x9a04('0x1b')]||0x0;this[_0x9a04('0x2')]=_0x2e9ccb[_0x9a04('0x2')]||0x0;this[_0x9a04('0x3')]=_0x2e9ccb[_0x9a04('0x3')]||0x0;this[_0x9a04('0x1c')]=_0x2e9ccb[_0x9a04('0x1c')];this['sumBillable']=_0x2e9ccb['sumBillable'];this[_0x9a04('0x13')]=_0x2e9ccb[_0x9a04('0x13')];this[_0x9a04('0x1d')]=_0x2e9ccb[_0x9a04('0x1d')]||0x0;this[_0x9a04('0x4')]=_0x2e9ccb[_0x9a04('0x4')]||0x0;this[_0x9a04('0x14')]=_0x2e9ccb[_0x9a04('0x14')]||0x0;this[_0x9a04('0x1e')]=_0x2e9ccb[_0x9a04('0x1e')];this['unavailable']=_0x2e9ccb[_0x9a04('0x1f')]||0x0;this[_0x9a04('0x20')]=_0x2e9ccb['unknown']||0x0;this[_0x9a04('0x21')]=_0x2e9ccb[_0x9a04('0x21')]||0x0;this[_0x9a04('0x5')]=_0x2e9ccb['waiting']||0x0;if(_0x2e9ccb[_0x9a04('0x1e')]==='outbound'){this[_0x9a04('0x11')]=_0x2e9ccb[_0x9a04('0x11')]||0x0;this['dialActive']=_0x2e9ccb[_0x9a04('0x22')];this[_0x9a04('0x23')]=_0x2e9ccb[_0x9a04('0x23')];this[_0x9a04('0x24')]=_0x2e9ccb[_0x9a04('0x24')];this[_0x9a04('0x25')]=_0x2e9ccb['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x2e9ccb[_0x9a04('0x26')];this[_0x9a04('0x27')]=_0x2e9ccb[_0x9a04('0x27')];this[_0x9a04('0x28')]=_0x2e9ccb[_0x9a04('0x28')];this[_0x9a04('0x29')]=_0x2e9ccb[_0x9a04('0x29')];this[_0x9a04('0xa')]=_0x2e9ccb[_0x9a04('0xa')];this['outboundBlacklistCallsDay']=_0x2e9ccb[_0x9a04('0x2a')];this[_0x9a04('0xb')]=_0x2e9ccb[_0x9a04('0xb')];this[_0x9a04('0xc')]=_0x2e9ccb[_0x9a04('0xc')];this[_0x9a04('0x2b')]=_0x2e9ccb[_0x9a04('0x2b')];this[_0x9a04('0x2c')]=_0x2e9ccb[_0x9a04('0x2c')];this[_0x9a04('0x2d')]=_0x2e9ccb[_0x9a04('0x2d')];this[_0x9a04('0xd')]=_0x2e9ccb[_0x9a04('0xd')];this[_0x9a04('0xe')]=_0x2e9ccb[_0x9a04('0xe')];this[_0x9a04('0x2e')]=_0x2e9ccb[_0x9a04('0x2e')];this[_0x9a04('0xf')]=_0x2e9ccb[_0x9a04('0xf')];this[_0x9a04('0x10')]=_0x2e9ccb[_0x9a04('0x10')];this[_0x9a04('0x2f')]=_0x2e9ccb['outboundUnknownCallsDay'];this[_0x9a04('0x30')]=_0x2e9ccb[_0x9a04('0x30')];this[_0x9a04('0x31')]=_0x2e9ccb[_0x9a04('0x31')];this[_0x9a04('0x32')]=_0x2e9ccb['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x2e9ccb['predictiveIntervalDroppedCallsCallersExit'];this[_0x9a04('0x33')]=_0x2e9ccb[_0x9a04('0x33')];this[_0x9a04('0x34')]=_0x2e9ccb[_0x9a04('0x34')];this[_0x9a04('0x35')]=_0x2e9ccb[_0x9a04('0x35')];this[_0x9a04('0x36')]=_0x2e9ccb[_0x9a04('0x36')];this[_0x9a04('0x37')]=_0x2e9ccb[_0x9a04('0x37')];this[_0x9a04('0x38')]=_0x2e9ccb[_0x9a04('0x38')];this[_0x9a04('0x39')]=_0x2e9ccb['predictiveIntervalAvailable'];this[_0x9a04('0x3a')]=_0x2e9ccb[_0x9a04('0x3a')];this[_0x9a04('0x3b')]=_0x2e9ccb[_0x9a04('0x3b')];this[_0x9a04('0x3c')]=_0x2e9ccb[_0x9a04('0x3c')];this['erlangCallToSecond']=_0x2e9ccb[_0x9a04('0x3d')];this['erlangAbandonmentRate']=_0x2e9ccb[_0x9a04('0x3e')];this[_0x9a04('0x3f')]=_0x2e9ccb['erlangBusyFactor'];this['startPredictive']=_0x2e9ccb['startPredictive'];this[_0x9a04('0x40')]=_0x2e9ccb[_0x9a04('0x40')];this[_0x9a04('0x41')]=_0x2e9ccb['message'];this[_0x9a04('0x42')]=_0x2e9ccb['statusMessage'];}if(_0x2e9ccb['Trunk']){this[_0x9a04('0x43')]={'id':_0x2e9ccb[_0x9a04('0x43')]['id'],'name':_0x2e9ccb[_0x9a04('0x43')]['name'],'active':_0x2e9ccb[_0x9a04('0x43')][_0x9a04('0x44')],'callerid':_0x2e9ccb[_0x9a04('0x43')][_0x9a04('0x45')]};}}VoiceQueueSummary[_0x9a04('0x46')][_0x9a04('0x47')]=function(_0x40aacf,_0x34520f,_0x447c83,_0x55a485){this['loggedInDb']=0x0;this[_0x9a04('0x4')]=0x0;this[_0x9a04('0x2')]=0x0;this['unknown']=0x0;this[_0x9a04('0x1b')]=0x0;this[_0x9a04('0x7')]=0x0;this[_0x9a04('0x18')]=0x0;this[_0x9a04('0x19')]=0x0;this['unavailable']=0x0;this[_0x9a04('0x3')]=0x0;this[_0x9a04('0x1c')]=0x0;this[_0x9a04('0x1a')]=0x0;if(_0x447c83){if(_0x447c83[_0x9a04('0x0')]){this[_0x9a04('0x0')]=Number(_0x447c83[_0x9a04('0x0')]);}if(_0x447c83[_0x9a04('0x48')]){this[_0x9a04('0x1')]=Number(_0x447c83[_0x9a04('0x48')]);}if(_0x447c83['callers']){this[_0x9a04('0x5')]=Number(_0x447c83[_0x9a04('0x49')]);}}for(var _0x111eab=0x0;_0x111eab<_0x40aacf[_0x9a04('0x4a')];_0x111eab++){var _0x2cee12=_0x34520f[_0x9a04('0x4b')+_0x40aacf[_0x111eab]['name']];if(_0x2cee12&&_0x2cee12[_0x9a04('0x4c')]){this['loggedInDb']+=0x1;}if(_0x40aacf[_0x111eab]['incall']==='1'){this['talking']+=0x1;}if(_0x40aacf[_0x111eab][_0x9a04('0x2')]==='1'&&!['2','7','8']['includes'](_0x40aacf[_0x111eab][_0x9a04('0x4d')])){this[_0x9a04('0x2')]+=0x1;}switch(_0x40aacf[_0x111eab][_0x9a04('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x9a04('0x1b')]+=0x1;break;case'2':this[_0x9a04('0x7')]+=0x1;break;case'3':this[_0x9a04('0x18')]+=0x1;break;case'4':this[_0x9a04('0x19')]+=0x1;break;case'5':this[_0x9a04('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x9a04('0x1c')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x4da309=Object[_0x9a04('0x4e')](_0x55a485);for(var _0x234d74=0x0;_0x234d74<_0x4da309[_0x9a04('0x4a')];_0x234d74++){var _0x3408de=_0x4da309[_0x234d74];var _0x556b38=_0x55a485[_0x3408de];if(_0x556b38[_0x9a04('0x4f')]===this[_0x9a04('0x15')]&&_0x556b38[_0x9a04('0x1e')]===_0x9a04('0x50')&&_0x556b38['exten']===_0x9a04('0x51')){this[_0x9a04('0x4')]+=0x1;}}if(this[_0x9a04('0x4')]>this['inUse']){this[_0x9a04('0x4')]=this[_0x9a04('0x7')];}this[_0x9a04('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x9a04('0x52')]=function(_0x2e45b1){var _0x361ee5=![];if(_0x2e45b1){_0x361ee5=INBOUND_COUNTERS['some'](function(_0x5e4a7f){return this[_0x5e4a7f]!==_0x2e45b1[_0x5e4a7f];},this);}return _0x361ee5;};VoiceQueueSummary[_0x9a04('0x46')][_0x9a04('0x53')]=function(_0x578d14){var _0x21789e=![];var _0x4757d0=![];var _0x4c449e=![];if(_0x578d14){_0x21789e=this[_0x9a04('0x23')]!==_0x578d14[_0x9a04('0x23')]||this[_0x9a04('0x22')]!==_0x578d14[_0x9a04('0x22')]||this[_0x9a04('0x41')]!==_0x578d14[_0x9a04('0x41')]||this[_0x9a04('0x42')]!==_0x578d14[_0x9a04('0x42')];_0x4757d0=OUTBOUND_COUNTERS[_0x9a04('0x54')](function(_0x266267){return this[_0x266267]!==_0x578d14[_0x266267];},this);if(this[_0x9a04('0x43')]&&_0x578d14[_0x9a04('0x43')]){_0x4c449e=this['Trunk'][_0x9a04('0x15')]!==_0x578d14[_0x9a04('0x43')]['name']||this[_0x9a04('0x43')][_0x9a04('0x44')]!==_0x578d14[_0x9a04('0x43')][_0x9a04('0x44')];}}return _0x21789e||_0x4757d0||_0x4c449e;};VoiceQueueSummary[_0x9a04('0x46')][_0x9a04('0x55')]=function(_0x5acd10){this[_0x9a04('0x6')]=_0x5acd10[_0x9a04('0x6')];this[_0x9a04('0x41')]=_0x5acd10[_0x9a04('0x41')];this[_0x9a04('0x42')]=_0x5acd10[_0x9a04('0x42')];this[_0x9a04('0x3b')]=_0x5acd10[_0x9a04('0x3b')];this[_0x9a04('0x9')]=_0x5acd10['outboundAbandonedCallsDay'];this[_0x9a04('0xa')]=_0x5acd10['outboundAnswerCallsDay'];this[_0x9a04('0x2a')]=_0x5acd10[_0x9a04('0x2a')];this[_0x9a04('0xb')]=_0x5acd10['outboundBusyCallsDay'];this[_0x9a04('0xc')]=_0x5acd10['outboundCongestionCallsDay'];this[_0x9a04('0xd')]=_0x5acd10[_0x9a04('0xd')];this[_0x9a04('0xe')]=_0x5acd10[_0x9a04('0xe')];this[_0x9a04('0xf')]=_0x5acd10[_0x9a04('0xf')];this['outboundRejectCallsDay']=_0x5acd10[_0x9a04('0x10')];this['outboundUnknownCallsDay']=_0x5acd10['outboundUnknownCallsDay'];this[_0x9a04('0x12')]=_0x5acd10['sumBillable'];this[_0x9a04('0x13')]=_0x5acd10[_0x9a04('0x13')];this['total']=_0x5acd10[_0x9a04('0x14')];if(this[_0x9a04('0x23')]===_0x9a04('0x56')){this[_0x9a04('0x11')]=_0x5acd10[_0x9a04('0x11')];}};module[_0x9a04('0x57')]=VoiceQueueSummary; \ No newline at end of file +var _0x535d=['temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','SIP/','online','incall','status','booked','keys','length','queue','dialer','xcally-motion-preview','prototype','compareToInboundQueue','some','dialActive','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','paused','ringing','answered','inUse','loggedInDb','originated','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','waiting','pTalking','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix'];(function(_0x53d420,_0x15ac1e){var _0xceb6a5=function(_0x280abb){while(--_0x280abb){_0x53d420['push'](_0x53d420['shift']());}};_0xceb6a5(++_0x15ac1e);}(_0x535d,0xe8));var _0xd535=function(_0x3a9d3f,_0x2be4d8){_0x3a9d3f=_0x3a9d3f-0x0;var _0x5b1abc=_0x535d[_0x3a9d3f];return _0x5b1abc;};'use strict';var INBOUND_COUNTERS=[_0xd535('0x0'),_0xd535('0x1'),'loggedInDb',_0xd535('0x2'),_0xd535('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0xd535('0x0'),_0xd535('0x4'),_0xd535('0x5'),_0xd535('0x1'),_0xd535('0x6'),_0xd535('0x7'),'outboundAbandonedCallsDay','outboundAnswerCallsDay',_0xd535('0x8'),_0xd535('0x9'),'outboundCongestionCallsDay',_0xd535('0xa'),'outboundNoSuchCallsDay',_0xd535('0xb'),_0xd535('0xc'),_0xd535('0xd'),_0xd535('0x2'),'pTalking',_0xd535('0xe'),_0xd535('0xf'),_0xd535('0x10'),_0xd535('0x11'),'waiting'];function VoiceQueueSummary(_0x2f9373){this['id']=_0x2f9373['id'];this[_0xd535('0x12')]=_0x2f9373[_0xd535('0x12')];this[_0xd535('0x13')]=_0x2f9373[_0xd535('0x13')];this[_0xd535('0x14')]=_0x2f9373[_0xd535('0x14')]||0x0;this['answered']=_0x2f9373[_0xd535('0x4')]||0x0;this['available']=_0x2f9373['available']||0x0;this[_0xd535('0x15')]=_0x2f9373[_0xd535('0x15')]||0x0;this['inUse']=_0x2f9373[_0xd535('0x5')]||0x0;this[_0xd535('0x16')]=_0x2f9373[_0xd535('0x16')]||0x0;this[_0xd535('0x1')]=_0x2f9373['loggedIn']||0x0;this[_0xd535('0x6')]=_0x2f9373[_0xd535('0x6')]||0x0;this[_0xd535('0x17')]=_0x2f9373[_0xd535('0x17')]||0x0;this['notInUse']=_0x2f9373[_0xd535('0x18')]||0x0;this['paused']=_0x2f9373[_0xd535('0x2')]||0x0;this['ringing']=_0x2f9373[_0xd535('0x3')]||0x0;this['ringInUse']=_0x2f9373[_0xd535('0x19')];this[_0xd535('0xf')]=_0x2f9373[_0xd535('0xf')];this[_0xd535('0x10')]=_0x2f9373['sumDuration'];this['sumHoldTime']=_0x2f9373[_0xd535('0x1a')]||0x0;this['talking']=_0x2f9373['talking']||0x0;this[_0xd535('0x11')]=_0x2f9373[_0xd535('0x11')]||0x0;this[_0xd535('0x1b')]=_0x2f9373[_0xd535('0x1b')];this[_0xd535('0x1c')]=_0x2f9373[_0xd535('0x1c')]||0x0;this['unknown']=_0x2f9373[_0xd535('0x1d')]||0x0;this[_0xd535('0x1e')]=_0x2f9373[_0xd535('0x1e')]||0x0;this[_0xd535('0x1f')]=_0x2f9373[_0xd535('0x1f')]||0x0;if(_0x2f9373['type']==='outbound'){this[_0xd535('0x20')]=_0x2f9373[_0xd535('0x20')]||0x0;this['dialActive']=_0x2f9373['dialActive'];this[_0xd535('0x21')]=_0x2f9373[_0xd535('0x21')];this[_0xd535('0x22')]=_0x2f9373['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x2f9373[_0xd535('0x23')];this[_0xd535('0x24')]=_0x2f9373[_0xd535('0x24')];this[_0xd535('0x25')]=_0x2f9373[_0xd535('0x25')];this[_0xd535('0x26')]=_0x2f9373[_0xd535('0x26')];this['outboundAnswerAgiCallsDay']=_0x2f9373[_0xd535('0x27')];this[_0xd535('0x28')]=_0x2f9373['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x2f9373['outboundBlacklistCallsDay'];this[_0xd535('0x9')]=_0x2f9373[_0xd535('0x9')];this[_0xd535('0x29')]=_0x2f9373[_0xd535('0x29')];this[_0xd535('0x2a')]=_0x2f9373['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x2f9373[_0xd535('0x2b')];this[_0xd535('0x2c')]=_0x2f9373[_0xd535('0x2c')];this[_0xd535('0xa')]=_0x2f9373['outboundNoAnswerCallsDay'];this[_0xd535('0x2d')]=_0x2f9373[_0xd535('0x2d')];this[_0xd535('0x2e')]=_0x2f9373[_0xd535('0x2e')];this[_0xd535('0xb')]=_0x2f9373[_0xd535('0xb')];this['outboundRejectCallsDay']=_0x2f9373[_0xd535('0xc')];this[_0xd535('0xd')]=_0x2f9373[_0xd535('0xd')];this['predictiveIntervalAnsweredCalls']=_0x2f9373[_0xd535('0x2f')];this[_0xd535('0x30')]=_0x2f9373[_0xd535('0x30')];this[_0xd535('0x31')]=_0x2f9373[_0xd535('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0x2f9373['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x2f9373[_0xd535('0x32')];this[_0xd535('0x33')]=_0x2f9373[_0xd535('0x33')];this[_0xd535('0x34')]=_0x2f9373[_0xd535('0x34')];this[_0xd535('0x35')]=_0x2f9373['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x2f9373[_0xd535('0x36')];this['predictiveIntervalPauses']=_0x2f9373[_0xd535('0x37')];this['predictiveIntervalAvailable']=_0x2f9373[_0xd535('0x38')];this['predictiveIntervalTotalCalls']=_0x2f9373[_0xd535('0x39')];this['originated']=_0x2f9373[_0xd535('0x7')];this[_0xd535('0x3a')]=_0x2f9373[_0xd535('0x3a')];this[_0xd535('0x3b')]=_0x2f9373['erlangCallToSecond'];this[_0xd535('0x3c')]=_0x2f9373[_0xd535('0x3c')];this['erlangBusyFactor']=_0x2f9373[_0xd535('0x3d')];this[_0xd535('0x3e')]=_0x2f9373[_0xd535('0x3e')];this[_0xd535('0x3f')]=_0x2f9373[_0xd535('0x3f')];this[_0xd535('0x40')]=_0x2f9373[_0xd535('0x40')];this[_0xd535('0x41')]=_0x2f9373[_0xd535('0x41')];}if(_0x2f9373[_0xd535('0x42')]){this['Trunk']={'id':_0x2f9373[_0xd535('0x42')]['id'],'name':_0x2f9373[_0xd535('0x42')][_0xd535('0x12')],'active':_0x2f9373['Trunk'][_0xd535('0x43')],'callerid':_0x2f9373[_0xd535('0x42')][_0xd535('0x44')]};}}VoiceQueueSummary['prototype'][_0xd535('0x45')]=function(_0x2fd8a3,_0x502885,_0x41ad7f,_0x49e767){this[_0xd535('0x6')]=0x0;this[_0xd535('0xe')]=0x0;this[_0xd535('0x2')]=0x0;this[_0xd535('0x1d')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0xd535('0x1c')]=0x0;this[_0xd535('0x3')]=0x0;this['ringInUse']=0x0;this[_0xd535('0x17')]=0x0;if(_0x41ad7f){if(_0x41ad7f['available']){this[_0xd535('0x0')]=Number(_0x41ad7f[_0xd535('0x0')]);}if(_0x41ad7f['loggedin']){this['loggedIn']=Number(_0x41ad7f[_0xd535('0x46')]);}if(_0x41ad7f[_0xd535('0x47')]){this[_0xd535('0x1f')]=Number(_0x41ad7f['callers']);}}for(var _0x173a8c=0x0;_0x173a8c<_0x2fd8a3['length'];_0x173a8c++){var _0x3cc9dc=_0x502885[_0xd535('0x48')+_0x2fd8a3[_0x173a8c][_0xd535('0x12')]];if(_0x3cc9dc&&_0x3cc9dc[_0xd535('0x49')]){this[_0xd535('0x6')]+=0x1;}if(_0x2fd8a3[_0x173a8c][_0xd535('0x4a')]==='1'){this[_0xd535('0xe')]+=0x1;}if(_0x2fd8a3[_0x173a8c]['paused']==='1'&&!['2','7','8']['includes'](_0x2fd8a3[_0x173a8c][_0xd535('0x4b')])){this[_0xd535('0x2')]+=0x1;}switch(_0x2fd8a3[_0x173a8c][_0xd535('0x4b')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xd535('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xd535('0x15')]+=0x1;break;case'4':this[_0xd535('0x16')]+=0x1;break;case'5':this[_0xd535('0x1c')]+=0x1;break;case'6':this[_0xd535('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xd535('0x17')]+=0x1;break;}}if(this[_0xd535('0x21')]===_0xd535('0x4c')){var _0x9641c2=Object[_0xd535('0x4d')](_0x49e767);for(var _0x2535e4=0x0;_0x2535e4<_0x9641c2[_0xd535('0x4e')];_0x2535e4++){var _0x1f7490=_0x9641c2[_0x2535e4];var _0x1eb78b=_0x49e767[_0x1f7490];if(_0x1eb78b[_0xd535('0x4f')]===this['name']&&_0x1eb78b[_0xd535('0x1b')]===_0xd535('0x50')&&_0x1eb78b['exten']===_0xd535('0x51')){this[_0xd535('0xe')]+=0x1;}}if(this[_0xd535('0xe')]>this[_0xd535('0x5')]){this[_0xd535('0xe')]=this['inUse'];}this[_0xd535('0x20')]=0x0;}return this;};VoiceQueueSummary[_0xd535('0x52')][_0xd535('0x53')]=function(_0x262433){var _0x587882=![];if(_0x262433){_0x587882=INBOUND_COUNTERS[_0xd535('0x54')](function(_0x4629ef){return this[_0x4629ef]!==_0x262433[_0x4629ef];},this);}return _0x587882;};VoiceQueueSummary[_0xd535('0x52')]['compareToOutboundQueue']=function(_0x82f2cc){var _0x17c9cd=![];var _0x182a47=![];var _0x380b4e=![];if(_0x82f2cc){_0x17c9cd=this['dialMethod']!==_0x82f2cc[_0xd535('0x21')]||this[_0xd535('0x55')]!==_0x82f2cc[_0xd535('0x55')]||this['message']!==_0x82f2cc[_0xd535('0x40')]||this[_0xd535('0x41')]!==_0x82f2cc[_0xd535('0x41')];_0x182a47=OUTBOUND_COUNTERS['some'](function(_0x12875e){return this[_0x12875e]!==_0x82f2cc[_0x12875e];},this);if(this[_0xd535('0x42')]&&_0x82f2cc[_0xd535('0x42')]){_0x380b4e=this[_0xd535('0x42')][_0xd535('0x12')]!==_0x82f2cc[_0xd535('0x42')][_0xd535('0x12')]||this[_0xd535('0x42')][_0xd535('0x43')]!==_0x82f2cc[_0xd535('0x42')][_0xd535('0x43')];}}return _0x17c9cd||_0x182a47||_0x380b4e;};VoiceQueueSummary[_0xd535('0x52')][_0xd535('0x56')]=function(_0x4d0a60){this['answered']=_0x4d0a60['answered'];this[_0xd535('0x40')]=_0x4d0a60['message'];this['statusMessage']=_0x4d0a60['statusMessage'];this[_0xd535('0x7')]=_0x4d0a60['originated'];this[_0xd535('0x57')]=_0x4d0a60[_0xd535('0x57')];this[_0xd535('0x28')]=_0x4d0a60['outboundAnswerCallsDay'];this[_0xd535('0x8')]=_0x4d0a60['outboundBlacklistCallsDay'];this[_0xd535('0x9')]=_0x4d0a60['outboundBusyCallsDay'];this[_0xd535('0x29')]=_0x4d0a60[_0xd535('0x29')];this[_0xd535('0xa')]=_0x4d0a60[_0xd535('0xa')];this[_0xd535('0x2d')]=_0x4d0a60['outboundNoSuchCallsDay'];this[_0xd535('0xb')]=_0x4d0a60['outboundReCallsDay'];this[_0xd535('0xc')]=_0x4d0a60['outboundRejectCallsDay'];this[_0xd535('0xd')]=_0x4d0a60[_0xd535('0xd')];this[_0xd535('0xf')]=_0x4d0a60[_0xd535('0xf')];this[_0xd535('0x10')]=_0x4d0a60[_0xd535('0x10')];this[_0xd535('0x11')]=_0x4d0a60[_0xd535('0x11')];if(this[_0xd535('0x21')]===_0xd535('0x58')){this['pTalking']=_0x4d0a60[_0xd535('0x20')];}};module[_0xd535('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 938247f..83bdabd 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 _0xbe98=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3fc3ad,_0x3beea){var _0x1ad7f2=function(_0x224e19){while(--_0x224e19){_0x3fc3ad['push'](_0x3fc3ad['shift']());}};_0x1ad7f2(++_0x3beea);}(_0xbe98,0xbb));var _0x8be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe98[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x4765b5){this['id']=_0x4765b5['id']||0x0;this[_0x8be9('0x0')]=_0x4765b5[_0x8be9('0x0')]||'';this[_0x8be9('0x1')]=_0x4765b5[_0x8be9('0x1')]||'';this[_0x8be9('0x2')]=_0x4765b5[_0x8be9('0x2')]||'';this['remoteUri']=_0x4765b5[_0x8be9('0x3')]||'';this['serverUrl']=_0x4765b5[_0x8be9('0x4')]||'';this[_0x8be9('0x5')]=_0x4765b5[_0x8be9('0x5')]||{};}module[_0x8be9('0x6')]=VtigerAccount; \ No newline at end of file +var _0x61d7=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x16fd68,_0x3d394d){var _0x12cf8e=function(_0x4728c1){while(--_0x4728c1){_0x16fd68['push'](_0x16fd68['shift']());}};_0x12cf8e(++_0x3d394d);}(_0x61d7,0x1dd));var _0x761d=function(_0x4ae555,_0x350295){_0x4ae555=_0x4ae555-0x0;var _0x4863ec=_0x61d7[_0x4ae555];return _0x4863ec;};'use strict';function VtigerAccount(_0x240ccd){this['id']=_0x240ccd['id']||0x0;this[_0x761d('0x0')]=_0x240ccd[_0x761d('0x0')]||'';this[_0x761d('0x1')]=_0x240ccd[_0x761d('0x1')]||'';this[_0x761d('0x2')]=_0x240ccd[_0x761d('0x2')]||'';this[_0x761d('0x3')]=_0x240ccd[_0x761d('0x3')]||'';this[_0x761d('0x4')]=_0x240ccd[_0x761d('0x4')]||'';this[_0x761d('0x5')]=_0x240ccd[_0x761d('0x5')]||{};}module[_0x761d('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 eefc736..2907df6 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 _0x3b16=['serverUrl','Configurations','exports','name','password','token','authType','type','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b16,0x123));var _0x63b1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3b16[_0x3947c9];return _0x2e7871;};'use strict';function ZendeskAccount(_0x480fc5){this['id']=_0x480fc5['id']||0x0;this[_0x63b1('0x0')]=_0x480fc5[_0x63b1('0x0')]||'';this['username']=_0x480fc5['username']||'';this[_0x63b1('0x1')]=_0x480fc5[_0x63b1('0x1')]||'';this[_0x63b1('0x2')]=_0x480fc5[_0x63b1('0x2')]||'';this['remoteUri']=_0x480fc5['remoteUri']||'';this[_0x63b1('0x3')]=_0x480fc5[_0x63b1('0x3')]||'';this[_0x63b1('0x4')]=_0x480fc5[_0x63b1('0x4')]||_0x63b1('0x5');this[_0x63b1('0x6')]=_0x480fc5[_0x63b1('0x6')]||'';this[_0x63b1('0x7')]=_0x480fc5['Configurations']||{};}module[_0x63b1('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x5117=['exports','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x5117,0x157));var _0x7511=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0x5117[_0x55d829];return _0x52163b;};'use strict';function ZendeskAccount(_0x488b3c){this['id']=_0x488b3c['id']||0x0;this['name']=_0x488b3c['name']||'';this[_0x7511('0x0')]=_0x488b3c[_0x7511('0x0')]||'';this[_0x7511('0x1')]=_0x488b3c[_0x7511('0x1')]||'';this[_0x7511('0x2')]=_0x488b3c['token']||'';this[_0x7511('0x3')]=_0x488b3c[_0x7511('0x3')]||'';this[_0x7511('0x4')]=_0x488b3c[_0x7511('0x4')]||'';this[_0x7511('0x5')]=_0x488b3c['type']||_0x7511('0x6');this[_0x7511('0x7')]=_0x488b3c['serverUrl']||'';this['Configurations']=_0x488b3c['Configurations']||{};}module[_0x7511('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 0c651a9..12432b5 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 _0xd63f=['Configurations','name','description','host','zone','clientSecret','serverUrl','code','refreshToken'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xd63f,0x18d));var _0xfd63=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd63f[_0x20a584];return _0x4b41a8;};'use strict';function ZohoAccount(_0x131fae){this['id']=_0x131fae['id']||0x0;this[_0xfd63('0x0')]=_0x131fae[_0xfd63('0x0')]||'';this[_0xfd63('0x1')]=_0x131fae['description']||'';this[_0xfd63('0x2')]=_0x131fae[_0xfd63('0x2')]||'';this[_0xfd63('0x3')]=_0x131fae[_0xfd63('0x3')]||'';this['clientId']=_0x131fae['clientId']||'';this['clientSecret']=_0x131fae[_0xfd63('0x4')]||'';this['serverUrl']=_0x131fae[_0xfd63('0x5')]||'';this['code']=_0x131fae[_0xfd63('0x6')]||'';this[_0xfd63('0x7')]=_0x131fae[_0xfd63('0x7')]||'';this[_0xfd63('0x8')]=_0x131fae[_0xfd63('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x2b99=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x1f6f39,_0x13ccaa){var _0x2e1686=function(_0x3559e1){while(--_0x3559e1){_0x1f6f39['push'](_0x1f6f39['shift']());}};_0x2e1686(++_0x13ccaa);}(_0x2b99,0x10c));var _0x92b9=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2b99[_0x4b7895];return _0x264180;};'use strict';function ZohoAccount(_0x1d0dc8){this['id']=_0x1d0dc8['id']||0x0;this[_0x92b9('0x0')]=_0x1d0dc8[_0x92b9('0x0')]||'';this[_0x92b9('0x1')]=_0x1d0dc8['description']||'';this[_0x92b9('0x2')]=_0x1d0dc8[_0x92b9('0x2')]||'';this[_0x92b9('0x3')]=_0x1d0dc8[_0x92b9('0x3')]||'';this[_0x92b9('0x4')]=_0x1d0dc8[_0x92b9('0x4')]||'';this[_0x92b9('0x5')]=_0x1d0dc8[_0x92b9('0x5')]||'';this[_0x92b9('0x6')]=_0x1d0dc8[_0x92b9('0x6')]||'';this[_0x92b9('0x7')]=_0x1d0dc8['code']||'';this[_0x92b9('0x8')]=_0x1d0dc8['refreshToken']||'';this[_0x92b9('0x9')]=_0x1d0dc8['Configurations']||{};}module[_0x92b9('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 3d84821..35220d3 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 _0x1893=['type','queue','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','idContact','name'];(function(_0x4be5a7,_0x55a464){var _0x452382=function(_0x577d77){while(--_0x577d77){_0x4be5a7['push'](_0x4be5a7['shift']());}};_0x452382(++_0x55a464);}(_0x1893,0xa2));var _0x3189=function(_0x428029,_0x1a5eb3){_0x428029=_0x428029-0x0;var _0x52033a=_0x1893[_0x428029];return _0x52033a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3189('0x0'));function checkNameSurname(_0x3aec2b,_0x1b12ad,_0x106df4){var _0x10c189='';if(!_[_0x3189('0x1')](_0x1b12ad)&&_0x3189('0x2')===typeof _0x1b12ad){_0x10c189+=_0x1b12ad;}if(!_['isNil'](_0x106df4)&&_0x3189('0x2')===typeof _0x106df4){_0x10c189+='\x20'+_0x106df4;}if(_0x10c189!==''){return _0x10c189;}return _0x3aec2b;}function Action(_0x4faebf,_0x2333e6,_0x4080a9,_0x77c566,_0x118970){this[_0x3189('0x3')]=_0x4080a9||undefined;this[_0x3189('0x4')]=_0x4faebf['id'];this['queue']=_0x2333e6[_0x3189('0x5')];this['type']=_0x2333e6[_0x3189('0x6')];this['campaigntype']=_0x3189('0x7');this[_0x3189('0x8')]=![];this[_0x3189('0x9')]=_[_0x3189('0x1')](_0x4faebf['Agent'])?undefined:_0x4faebf[_0x3189('0xa')][_0x3189('0x5')];this[_0x3189('0xb')]=this[_0x3189('0x9')]?util[_0x3189('0xc')]('SIP/%s',this[_0x3189('0x9')]):_0x77c566||undefined;this[_0x3189('0xd')]=checkNameSurname(_0x4faebf[_0x3189('0xe')][_0x3189('0xf')],_0x4faebf[_0x3189('0xe')][_0x3189('0x10')],_0x4faebf[_0x3189('0xe')][_0x3189('0x11')]);this['active']=_0x4faebf[_0x3189('0x12')]||![];this[_0x3189('0x13')]=_0x4faebf[_0x3189('0xf')];this[_0x3189('0x14')]=_0x4faebf['scheduledat'];this[_0x3189('0x15')]=_0x4faebf['countbusyretry']||0x0;this['countcongestionretry']=_0x4faebf[_0x3189('0x16')]||0x0;this['countnoanswerretry']=_0x4faebf[_0x3189('0x17')]||0x0;this[_0x3189('0x18')]=(_0x4faebf[_0x3189('0x15')]||0x0)+(_0x4faebf[_0x3189('0x16')]||0x0)+(_0x4faebf['countnoanswerretry']||0x0)+(_0x4faebf[_0x3189('0x19')]||0x0)+(_0x4faebf[_0x3189('0x1a')]||0x0)+(_0x4faebf[_0x3189('0x1b')]||0x0)+(_0x4faebf['countmachineretry']||0x0)+(_0x4faebf[_0x3189('0x1c')]||0x0);this[_0x3189('0x19')]=_0x4faebf[_0x3189('0x19')]||0x0;this[_0x3189('0x1a')]=_0x4faebf[_0x3189('0x1a')]||0x0;this['countabandonedretry']=_0x4faebf[_0x3189('0x1b')]||0x0;this[_0x3189('0x1d')]=_0x4faebf[_0x3189('0x1d')]||0x0;this['countagentrejectretry']=_0x4faebf[_0x3189('0x1c')]||0x0;this['callback']=_0x4faebf[_0x3189('0x1e')];this[_0x3189('0x1f')]=_0x4faebf[_0x3189('0x1f')];this[_0x3189('0x20')]=_0x4faebf[_0x3189('0x20')];this[_0x3189('0x21')]=_0x4faebf['recallme'];this['ContactId']=_0x4faebf[_0x3189('0x22')];this[_0x3189('0x23')]=_0x4faebf[_0x3189('0x23')];this[_0x3189('0x24')]=_[_0x3189('0x1')](_0x4faebf[_0x3189('0xa')])?_0x4faebf[_0x3189('0x24')]:_0x4faebf[_0x3189('0xa')]['id'];this[_0x3189('0x25')]=_0x4faebf[_0x3189('0x25')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x3189('0x26')]=function(){return util[_0x3189('0xc')](_0x3189('0x27'),this[_0x3189('0xd')],this[_0x3189('0x28')]);};module[_0x3189('0x29')]=Action; \ No newline at end of file +var _0x236c=['recallme','ContactId','ListId','UserId','originatecalleridnum','prototype','calleridname','number','util','moment','string','isNil','uniqueid','type','campaigntype','queue','dialAnswer','membername','Agent','name','format','phone','Contact','firstName','active','scheduledat','countbusyretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x1804f3,_0x1ee881){var _0x7ba2b0=function(_0x288a27){while(--_0x288a27){_0x1804f3['push'](_0x1804f3['shift']());}};_0x7ba2b0(++_0x1ee881);}(_0x236c,0x155));var _0xc236=function(_0x4e559e,_0x97674a){_0x4e559e=_0x4e559e-0x0;var _0xb5b344=_0x236c[_0x4e559e];return _0xb5b344;};'use strict';var util=require(_0xc236('0x0'));var _=require('lodash');var moment=require(_0xc236('0x1'));function checkNameSurname(_0x404d50,_0x39c024,_0x8072){var _0x2bf2d3='';if(!_['isNil'](_0x39c024)&&_0xc236('0x2')===typeof _0x39c024){_0x2bf2d3+=_0x39c024;}if(!_[_0xc236('0x3')](_0x8072)&&_0xc236('0x2')===typeof _0x8072){_0x2bf2d3+='\x20'+_0x8072;}if(_0x2bf2d3!==''){return _0x2bf2d3;}return _0x404d50;}function Action(_0xd582f6,_0x23d3cc,_0x461c3a,_0x5abd65,_0xd612c6){this[_0xc236('0x4')]=_0x461c3a||undefined;this['idContact']=_0xd582f6['id'];this['queue']=_0x23d3cc['name'];this[_0xc236('0x5')]=_0x23d3cc['type'];this[_0xc236('0x6')]=_0xc236('0x7');this[_0xc236('0x8')]=![];this[_0xc236('0x9')]=_[_0xc236('0x3')](_0xd582f6['Agent'])?undefined:_0xd582f6[_0xc236('0xa')][_0xc236('0xb')];this['channelAgent']=this[_0xc236('0x9')]?util[_0xc236('0xc')]('SIP/%s',this[_0xc236('0x9')]):_0x5abd65||undefined;this['calleridname']=checkNameSurname(_0xd582f6['Contact'][_0xc236('0xd')],_0xd582f6[_0xc236('0xe')][_0xc236('0xf')],_0xd582f6[_0xc236('0xe')]['lastName']);this[_0xc236('0x10')]=_0xd582f6['active']||![];this['calleridnum']=_0xd582f6[_0xc236('0xd')];this[_0xc236('0x11')]=_0xd582f6[_0xc236('0x11')];this[_0xc236('0x12')]=_0xd582f6[_0xc236('0x12')]||0x0;this['countcongestionretry']=_0xd582f6['countcongestionretry']||0x0;this['countnoanswerretry']=_0xd582f6[_0xc236('0x13')]||0x0;this[_0xc236('0x14')]=(_0xd582f6[_0xc236('0x12')]||0x0)+(_0xd582f6['countcongestionretry']||0x0)+(_0xd582f6[_0xc236('0x13')]||0x0)+(_0xd582f6['countnosuchnumberretry']||0x0)+(_0xd582f6['countdropretry']||0x0)+(_0xd582f6[_0xc236('0x15')]||0x0)+(_0xd582f6[_0xc236('0x16')]||0x0)+(_0xd582f6[_0xc236('0x17')]||0x0);this[_0xc236('0x18')]=_0xd582f6[_0xc236('0x18')]||0x0;this[_0xc236('0x19')]=_0xd582f6[_0xc236('0x19')]||0x0;this[_0xc236('0x15')]=_0xd582f6[_0xc236('0x15')]||0x0;this[_0xc236('0x16')]=_0xd582f6[_0xc236('0x16')]||0x0;this['countagentrejectretry']=_0xd582f6[_0xc236('0x17')]||0x0;this[_0xc236('0x1a')]=_0xd582f6[_0xc236('0x1a')];this[_0xc236('0x1b')]=_0xd582f6[_0xc236('0x1b')];this[_0xc236('0x1c')]=_0xd582f6[_0xc236('0x1c')];this[_0xc236('0x1d')]=_0xd582f6[_0xc236('0x1d')];this[_0xc236('0x1e')]=_0xd582f6[_0xc236('0x1e')];this['ListId']=_0xd582f6[_0xc236('0x1f')];this[_0xc236('0x20')]=_[_0xc236('0x3')](_0xd582f6[_0xc236('0xa')])?_0xd582f6['UserId']:_0xd582f6[_0xc236('0xa')]['id'];this['VoiceQueueId']=_0xd582f6['VoiceQueueId'];this[_0xc236('0x21')]='';this['originatecalleridname']='';}Action[_0xc236('0x22')]['getCaller']=function(){return util[_0xc236('0xc')]('\x22%s\x22\x20<%s>',this[_0xc236('0x23')],this[_0xc236('0x24')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8a4d469..b720959 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x5155b8,_0xa14239){var _0x2d5034=function(_0x45356f){while(--_0x45356f){_0x5155b8['push'](_0x5155b8['shift']());}};_0x2d5034(++_0xa14239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x45b93a,_0x551518){var _0x95bc9a=function(_0x1b9547){while(--_0x1b9547){_0x45b93a['push'](_0x45b93a['shift']());}};_0x95bc9a(++_0x551518);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b1c6d48..aa9b4c6 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 _0xb7a3=['context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','then','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercompleteAt','endtime','connectedlinename','membername'];(function(_0x4582a3,_0x14c3bc){var _0xc25652=function(_0x5d2339){while(--_0x5d2339){_0x4582a3['push'](_0x4582a3['shift']());}};_0xc25652(++_0x14c3bc);}(_0xb7a3,0xe9));var _0x3b7a=function(_0x11a854,_0x5047d2){_0x11a854=_0x11a854-0x0;var _0x1d494b=_0xb7a3[_0x11a854];return _0x1d494b;};'use strict';var util=require(_0x3b7a('0x0'));var BPromise=require('bluebird');var logger=require(_0x3b7a('0x1'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x3b7a('0x2'));var cmHopperBlack=require(_0x3b7a('0x3'));var agentReportPreview=require(_0x3b7a('0x4'));var voiceQueueReport=require(_0x3b7a('0x5'));function loggerCatch(_0x1631cc){return function(_0x47d82e){logger[_0x3b7a('0x6')](_0x1631cc,util[_0x3b7a('0x7')](_0x47d82e,{'showHidden':![],'depth':null}));};}function create(_0x1504f9){return cmHopperHistory[_0x3b7a('0x8')](_0x1504f9)[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0xa')));}function createAgent(_0x48f87e){return BPromise[_0x3b7a('0xb')]()['then'](agentReportPreview[_0x3b7a('0x8')](_0x48f87e))[_0x3b7a('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x1c8d35){return cmHopper[_0x3b7a('0xc')](_0x1c8d35,!![])[_0x3b7a('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x32d3ed){return cmHopperBlack[_0x3b7a('0xd')](_0x32d3ed)[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0xe')));};exports['getContactPreview']=function(_0x1a3bf4){return BPromise[_0x3b7a('0xb')]()[_0x3b7a('0xf')](cmHopper[_0x3b7a('0x10')](_0x1a3bf4))[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0x11')));};exports['createHistory']=function(_0x453e33,_0x24f6f6){create(_0x453e33)['catch'](loggerCatch(_0x24f6f6));moveContact(_0x453e33)[_0x3b7a('0x9')](loggerCatch(_0x24f6f6));};exports[_0x3b7a('0x12')]=function(_0x56f5bf,_0xc6195e){createAgent(_0x56f5bf)[_0x3b7a('0x9')](loggerCatch(_0xc6195e));};exports[_0x3b7a('0x13')]=function(_0x3e7edc,_0x46de27){create(_0x3e7edc)[_0x3b7a('0x9')](loggerCatch(_0x46de27));};exports[_0x3b7a('0x14')]=function(_0x533e93,_0x5fe782){moveContact(_0x533e93)[_0x3b7a('0x9')](loggerCatch(_0x5fe782));};exports[_0x3b7a('0x15')]=function(_0x5a4a30,_0x35d02b,_0xa74019){if(_0x35d02b){_0x5a4a30[_0x3b7a('0x16')]=null;}if(_0xa74019){_0x5a4a30[_0x3b7a('0x17')]=![];}return cmHopper[_0x3b7a('0x15')](_0x5a4a30)[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0x18')));};exports['countReScheduled']=function(_0x4e7fd3){return cmHopper[_0x3b7a('0x19')](_0x4e7fd3)[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0x1a')));};exports['unlockContact']=function(_0x250098){return cmHopper[_0x3b7a('0x1b')]({'UserId':null},_0x250098,0x1)[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0x1c')));};exports[_0x3b7a('0x1d')]=function(_0x2136ac){return cmHopper[_0x3b7a('0x1b')]({'active':![]},_0x2136ac,0x1)[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0x1e')));};exports[_0x3b7a('0x1f')]=function(_0x59ad37){var _0x142aaf={};_0x142aaf[_0x3b7a('0x20')]=_0x59ad37[_0x3b7a('0x20')];_0x142aaf[_0x3b7a('0x21')]=_0x59ad37[_0x3b7a('0x21')];_0x142aaf[_0x3b7a('0x22')]=_0x59ad37[_0x3b7a('0x22')];_0x142aaf[_0x3b7a('0x23')]=_0x59ad37[_0x3b7a('0x23')];_0x142aaf['queue']=_0x59ad37[_0x3b7a('0x24')];_0x142aaf['queuecallerjoinAt']=_0x59ad37[_0x3b7a('0x25')];_0x142aaf['queuecallerleaveAt']=_0x59ad37[_0x3b7a('0x25')];_0x142aaf['queuecallercomplete']=0x1;_0x142aaf[_0x3b7a('0x26')]=_0x59ad37[_0x3b7a('0x27')];_0x142aaf[_0x3b7a('0x28')]=_0x59ad37[_0x3b7a('0x29')];_0x142aaf[_0x3b7a('0x2a')]=_0x3b7a('0x2b');_0x142aaf[_0x3b7a('0x2c')]=_0x3b7a('0x2d');_0x142aaf[_0x3b7a('0x2e')]=0x0;_0x142aaf[_0x3b7a('0x2f')]=0x1;_0x142aaf[_0x3b7a('0x30')]=_0x59ad37['membername'];_0x142aaf[_0x3b7a('0x31')]=_0x3b7a('0x32');return BPromise['resolve']()[_0x3b7a('0xf')](voiceQueueReport[_0x3b7a('0x33')](_0x142aaf))[_0x3b7a('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x3b7a('0x34')]=function(_0x49ad6f,_0x3464c2){return BPromise[_0x3b7a('0xb')]()['then'](cmHopper['getContactRecallMe'](_0x49ad6f,_0x3464c2))[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0x35')));};exports['rescheduleContactInQueue']=function(_0x2561c6){return cmHopper[_0x3b7a('0x15')](_0x2561c6,!![],!![])[_0x3b7a('0x9')](loggerCatch(_0x3b7a('0x36')));}; \ No newline at end of file +var _0xd041=['calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','[rescheduleContact]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid'];(function(_0x10ab64,_0x292c80){var _0x3cd372=function(_0x475dcd){while(--_0x475dcd){_0x10ab64['push'](_0x10ab64['shift']());}};_0x3cd372(++_0x292c80);}(_0xd041,0x17a));var _0x1d04=function(_0x45081a,_0x3ae384){_0x45081a=_0x45081a-0x0;var _0x55bfe2=_0xd041[_0x45081a];return _0x55bfe2;};'use strict';var util=require(_0x1d04('0x0'));var BPromise=require(_0x1d04('0x1'));var logger=require(_0x1d04('0x2'))('preview');var cmHopper=require(_0x1d04('0x3'));var cmHopperHistory=require(_0x1d04('0x4'));var cmHopperBlack=require(_0x1d04('0x5'));var agentReportPreview=require(_0x1d04('0x6'));var voiceQueueReport=require(_0x1d04('0x7'));function loggerCatch(_0x537e63){return function(_0xcf59aa){logger[_0x1d04('0x8')](_0x537e63,util[_0x1d04('0x9')](_0xcf59aa,{'showHidden':![],'depth':null}));};}function create(_0x5b961b){return cmHopperHistory['createHistory'](_0x5b961b)[_0x1d04('0xa')](loggerCatch(_0x1d04('0xb')));}function createAgent(_0x4b3573){return BPromise[_0x1d04('0xc')]()[_0x1d04('0xd')](agentReportPreview[_0x1d04('0xe')](_0x4b3573))['catch'](loggerCatch(_0x1d04('0xb')));}function moveContact(_0x229896){return cmHopper[_0x1d04('0xf')](_0x229896,!![])[_0x1d04('0xa')](loggerCatch(_0x1d04('0x10')));}exports[_0x1d04('0x11')]=function(_0x37e704){return cmHopperBlack[_0x1d04('0x11')](_0x37e704)[_0x1d04('0xa')](loggerCatch(_0x1d04('0x12')));};exports[_0x1d04('0x13')]=function(_0x388183){return BPromise[_0x1d04('0xc')]()[_0x1d04('0xd')](cmHopper[_0x1d04('0x13')](_0x388183))[_0x1d04('0xa')](loggerCatch(_0x1d04('0x14')));};exports[_0x1d04('0xe')]=function(_0x9a585e,_0x23736f){create(_0x9a585e)[_0x1d04('0xa')](loggerCatch(_0x23736f));moveContact(_0x9a585e)[_0x1d04('0xa')](loggerCatch(_0x23736f));};exports['createAgentHistory']=function(_0x333d36,_0x51b96c){createAgent(_0x333d36)[_0x1d04('0xa')](loggerCatch(_0x51b96c));};exports[_0x1d04('0x15')]=function(_0x1abe49,_0x1dcc5e){create(_0x1abe49)[_0x1d04('0xa')](loggerCatch(_0x1dcc5e));};exports[_0x1d04('0x16')]=function(_0x5f46f5,_0x2dfd6b){moveContact(_0x5f46f5)[_0x1d04('0xa')](loggerCatch(_0x2dfd6b));};exports['rescheduleContact']=function(_0x28d419,_0x3d758d,_0x45b766){if(_0x3d758d){_0x28d419[_0x1d04('0x17')]=null;}if(_0x45b766){_0x28d419['active']=![];}return cmHopper[_0x1d04('0x18')](_0x28d419)['catch'](loggerCatch(_0x1d04('0x19')));};exports['countReScheduled']=function(_0x248137){return cmHopper['countReScheduled'](_0x248137)[_0x1d04('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x163220){return cmHopper[_0x1d04('0x1a')]({'UserId':null},_0x163220,0x1)[_0x1d04('0xa')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x59a69d){return cmHopper[_0x1d04('0x1a')]({'active':![]},_0x59a69d,0x1)[_0x1d04('0xa')](loggerCatch('[activeContact]\x20'));};exports[_0x1d04('0x1b')]=function(_0x1dd611){var _0x11398c={};_0x11398c[_0x1d04('0x1c')]=_0x1dd611[_0x1d04('0x1c')];_0x11398c[_0x1d04('0x1d')]=_0x1dd611[_0x1d04('0x1d')];_0x11398c[_0x1d04('0x1e')]=_0x1dd611['calleridnum'];_0x11398c['calleridname']=_0x1dd611['calleridname'];_0x11398c[_0x1d04('0x1f')]=_0x1dd611[_0x1d04('0x1f')];_0x11398c[_0x1d04('0x20')]=_0x1dd611[_0x1d04('0x21')];_0x11398c[_0x1d04('0x22')]=_0x1dd611[_0x1d04('0x21')];_0x11398c[_0x1d04('0x23')]=0x1;_0x11398c[_0x1d04('0x24')]=_0x1dd611[_0x1d04('0x25')];_0x11398c['connectedlinename']=_0x1dd611[_0x1d04('0x26')];_0x11398c[_0x1d04('0x27')]='from-sip';_0x11398c[_0x1d04('0x28')]=_0x1d04('0x29');_0x11398c['holdtime']=0x0;_0x11398c[_0x1d04('0x2a')]=0x1;_0x11398c[_0x1d04('0x2b')]=_0x1dd611['membername'];_0x11398c[_0x1d04('0x2c')]=_0x1d04('0x2d');return BPromise[_0x1d04('0xc')]()['then'](voiceQueueReport[_0x1d04('0x2e')](_0x11398c))[_0x1d04('0xa')](loggerCatch(_0x1d04('0x2f')));};exports[_0x1d04('0x30')]=function(_0x2edeb8,_0x2b7a00){return BPromise[_0x1d04('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x2edeb8,_0x2b7a00))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x1d04('0x31')]=function(_0x4fb35e){return cmHopper[_0x1d04('0x18')](_0x4fb35e,!![],!![])[_0x1d04('0xa')](loggerCatch(_0x1d04('0x32')));}; \ 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 23d4a17..c5cba4f 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 _0x43af=['CampaignId','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','updateOriginated','hasOwnProperty','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','statedesc','endtime','answertime','variablesAction','RECALL','BOOKED','originate','calleridnum','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','scheduledAt','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','interface','channelAgent','voice','mandatoryDisposition','buildObj','agentReadyId','reachable','push','getDiff','milliseconds','createBody'];(function(_0x4bf573,_0x4530e3){var _0x19af7f=function(_0x46954b){while(--_0x46954b){_0x4bf573['push'](_0x4bf573['shift']());}};_0x19af7f(++_0x4530e3);}(_0x43af,0x1ac));var _0xf43a=function(_0x57f99a,_0x43bcd6){_0x57f99a=_0x57f99a-0x0;var _0x4b95c9=_0x43af[_0x57f99a];return _0x4b95c9;};'use strict';var util=require(_0xf43a('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xf43a('0x1'))(_0xf43a('0x2'));var ipAgi=process[_0xf43a('0x3')][_0xf43a('0x4')]||_0xf43a('0x5');var utils=require(_0xf43a('0x6'));exports[_0xf43a('0x7')]=function(_0x14f357){return function(_0x20b298){logger['error'](_0x14f357,util[_0xf43a('0x8')](_0x20b298,{'showHidden':![],'depth':null}));};};exports[_0xf43a('0x9')]=function(_0xf78bf8,_0x2918ad){logger[_0xf43a('0xa')](_0xf78bf8,util[_0xf43a('0x8')](_0x2918ad,{'showHidden':![],'depth':null}));};exports[_0xf43a('0xb')]=function(_0x255e5f,_0x5ad00c){logger[_0xf43a('0xc')](_0x255e5f,util[_0xf43a('0x8')](_0x5ad00c,{'showHidden':![],'depth':null}));};exports[_0xf43a('0xd')]=function(_0x1606f5){return function(_0x24c043){logger[_0xf43a('0xa')](_0x1606f5,util[_0xf43a('0x8')](_0x24c043,{'showHidden':![],'depth':null}));};};exports[_0xf43a('0xe')]=function(_0x3a0b09,_0x4b5035,_0x5b56cf){return{'message':_0x3a0b09,'unlock':_0x4b5035,'active':_0x5b56cf};};exports['getCallerId']=function(_0x5c72b9,_0x416289,_0xd0bc23){if(!_[_0xf43a('0xf')](_0xd0bc23)&&_0xf43a('0x10')===typeof _0xd0bc23&&!_[_0xf43a('0x11')](_0xd0bc23)){if(!_[_0xf43a('0xf')](_0x416289)&&_0xf43a('0x10')===typeof _0x416289&&!_[_0xf43a('0x11')](_0x416289)){return util[_0xf43a('0x12')](_0xf43a('0x13'),_0x416289,_0xd0bc23);}return util[_0xf43a('0x12')](_0xf43a('0x13'),_0xd0bc23,_0xd0bc23);}if(!_['isUndefined'](_0x5c72b9)&&_0xf43a('0x10')===typeof _0x5c72b9&&!_[_0xf43a('0x11')](_0x5c72b9)){return _0x5c72b9;}return'\x22\x22\x20<>';};exports[_0xf43a('0x14')]=function(_0x5d39c5){if(_[_0xf43a('0x15')](_0x5d39c5)){return![];}return _0x5d39c5;};exports[_0xf43a('0x16')]=function(_0x40be39,_0x10c624,_0x1c4d10,_0x1c4052,_0x320434,_0x3cfc97){var _0x5a6b43={'XMD-QUEUE':_0x10c624[_0xf43a('0x17')]?_0x10c624[_0xf43a('0x17')][_0xf43a('0x18')]:'','XMD-CALLERID':_0x1c4052,'XMD-CALLERID-PREVIEW':_0x3cfc97?util[_0xf43a('0x12')](_0xf43a('0x13'),_0x3cfc97[_0xf43a('0x19')],_0x3cfc97['calleridnum']):_0x1c4052,'XMD-DIALID':_0x320434,'XMD-CONTACTID':_0x10c624['ContactId'],'XMD-CDRTYPE':_0xf43a('0x1a'),'CALLERID(all)':_0x1c4052,'XMD-VOICEQUEUEID':_0x10c624[_0xf43a('0x1b')],'XMD-DIALCHANNEL':_0x1c4d10,'XMD-DIALTIMEOUT':_0x40be39[_0xf43a('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xf43a('0x12')](_0xf43a('0x1d'),_0x40be39['dialQueueProject2']?'g':'',_['isEmpty'](_0x40be39[_0xf43a('0x1e')])?'':_0xf43a('0x1f')),'XMD-DIALURL':_0x40be39[_0xf43a('0x20')]||'','XMD-AGI':_0x40be39[_0xf43a('0x21')]?util[_0xf43a('0x12')](_0xf43a('0x22'),ipAgi,_0x40be39[_0xf43a('0x21')]):'NONE','XMD-AGIAFTER':_0x40be39[_0xf43a('0x23')]?util[_0xf43a('0x12')](_0xf43a('0x22'),ipAgi,_0x40be39['dialQueueProject2']):_0xf43a('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x3cfc97?_0x3cfc97[_0xf43a('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x3cfc97?_0x3cfc97[_0xf43a('0x26')]:'','XMD-DESTINATION':_0xf43a('0x27'),'SIPADDHEADER':_0xf43a('0x28')};if(!_[_0xf43a('0x11')](_0x40be39[_0xf43a('0x1e')])){_0x5a6b43[util[_0xf43a('0x12')]('%s',_0xf43a('0x29'))]=_0x40be39[_0xf43a('0x1e')];_0x5a6b43[util[_0xf43a('0x12')]('%s',_0xf43a('0x2a'))]=_0x320434;}return _0x5a6b43;};exports[_0xf43a('0x2b')]=function(_0x29ed86){var _0x437989={};for(var _0x40916f in _0x29ed86){if(_0x29ed86['hasOwnProperty'](_0x40916f)){_0x437989[util['format']('%s',_['toLower'](_0x40916f))]=_0x29ed86[_0x40916f];}}return{'variables':_0x437989};};exports[_0xf43a('0x2c')]=function(_0x6a2769,_0x3f8500){if(!_[_0xf43a('0x15')](_0x6a2769)){if(_0x6a2769[_0xf43a('0x2d')](_0xf43a('0x2e'))){if(_0x6a2769[_0xf43a('0x2e')]>0x0){_0x6a2769[_0xf43a('0x2e')]-=0x1;}else{logger[_0xf43a('0xc')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3f8500);}}}else{logger[_0xf43a('0xc')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3f8500);}};exports[_0xf43a('0x2f')]=function(_0x4e9d1c){var _0x3a7781=moment()['format'](_0xf43a('0x30'));_0x4e9d1c[_0xf43a('0x31')]=0xd;_0x4e9d1c['statedesc']=_0xf43a('0x32');_0x4e9d1c[_0xf43a('0x33')]=_0x3a7781;_0x4e9d1c[_0xf43a('0x34')]=_0x3a7781;_0x4e9d1c['endtime']=_0x3a7781;};exports['logAgent']=function(_0x2bf9c4,_0xecc2c6,_0x246518){var _0x4f97e7=moment()['format'](_0xf43a('0x30'));_0x2bf9c4[_0xf43a('0x31')]=_0xecc2c6;_0x2bf9c4['statedesc']=_0x246518;_0x2bf9c4['responsetime']=_0x4f97e7;_0x2bf9c4[_0xf43a('0x35')]=utils[_0xf43a('0x36')](_0x2bf9c4['responsetime'],_0x2bf9c4['starttime']);};exports[_0xf43a('0x37')]=function(_0x3e1b0a,_0x421197,_0x1ece6c){_0x3e1b0a[_0xf43a('0x38')]=_0x421197;_0x3e1b0a[_0xf43a('0x39')]=_0x1ece6c;};exports['logCustomer']=function(_0x418ef5,_0x114d8b,_0xdea2ab){var _0x6e68d4=moment()[_0xf43a('0x12')](_0xf43a('0x30'));_0x418ef5[_0xf43a('0x31')]=_0x114d8b;_0x418ef5[_0xf43a('0x3a')]=_0xdea2ab;_0x418ef5['responsetime']=_0x418ef5[_0xf43a('0x34')]?_0x418ef5[_0xf43a('0x34')]:_0x6e68d4;_0x418ef5[_0xf43a('0x3b')]=_0x418ef5[_0xf43a('0x3b')]?_0x418ef5[_0xf43a('0x3b')]:_0x6e68d4;_0x418ef5['ringtime']=utils['getSeconds'](_0x418ef5[_0xf43a('0x34')]||0x0,_0x418ef5[_0xf43a('0x33')]||0x0);_0x418ef5['talktime']=_0x418ef5[_0xf43a('0x3c')]?utils[_0xf43a('0x36')](_0x418ef5['endtime'],_0x418ef5[_0xf43a('0x3c')]):0x0;};exports['isFailure']=function(_0x56c28e){return _0x56c28e==='Failure';};exports[_0xf43a('0x3d')]=function(_0x13c9f5,_0x3fdd7a,_0x54bf8c,_0x359c01,_0x3bb624){var _0x32cce2=_0x359c01?_0xf43a('0x3e'):_0x13c9f5['calleridname'];_0x32cce2=_0x3bb624?_0xf43a('0x3f'):_0x32cce2;return{'actionid':_0x13c9f5['uniqueid'],'action':_0xf43a('0x40'),'channel':_0x13c9f5['channelAgent'],'callerid':util[_0xf43a('0x12')](_0xf43a('0x13'),_0x32cce2,_0x13c9f5[_0xf43a('0x41')]),'Exten':_0xf43a('0x27'),'Context':'from-sip','Priority':'1','variable':_0x54bf8c,'timeout':(_0x3fdd7a[_0xf43a('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x13c9f5[_0xf43a('0x43')]};};exports[_0xf43a('0x44')]=function(_0xb3f0c0){return _0xb3f0c0[_0xf43a('0x45')]+_0xb3f0c0[_0xf43a('0x46')]+_0xb3f0c0[_0xf43a('0x47')]+_0xb3f0c0[_0xf43a('0x48')]+_0xb3f0c0['countnosuchnumberretry'];};exports['cloneAction']=function(_0x562294){var _0x21ad20=_[_0xf43a('0x49')](_0x562294);_0x21ad20[_0xf43a('0x31')]=0xf;_0x21ad20['statedesc']='Global';return _0x21ad20;};exports[_0xf43a('0x4a')]=function(_0x42745c,_0x16e036,_0x4e4d12){var _0x4d549b={};_0x4d549b[_0x16e036]=_0x42745c[_0x16e036];_0x4d549b[_0xf43a('0x4b')]=![];_0x4d549b['scheduledat']=moment()[_0xf43a('0x4c')](_0x4e4d12,_0xf43a('0x4d'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d549b[_0xf43a('0x4e')]=_0x42745c['ContactId'];_0x4d549b[_0xf43a('0x4f')]=_0x42745c['ListId'];_0x4d549b[_0xf43a('0x1b')]=_0x42745c[_0xf43a('0x1b')]||undefined;return _0x4d549b;};exports[_0xf43a('0x50')]=function(_0x44b244,_0x4326c3){if(!_['isNil'](_0x44b244)){if(_0x44b244[_0xf43a('0x51')]>0x0){_0x44b244[_0xf43a('0x51')]-=0x1;}else{logger[_0xf43a('0xc')](_0x4326c3,_0xf43a('0x52'));}}else{logger[_0xf43a('0xc')](_0x4326c3,_0xf43a('0x53'));}};exports['IsNotLoggedIn']=function(_0x5748fd){if(_0x5748fd<=0x0){return!![];}return![];};function buildObj(_0x13109a,_0x216f0f,_0x3bac56){_0x13109a[_0xf43a('0x54')]=_0x216f0f;_0x13109a[_0xf43a('0x18')]=_0x13109a['queue'];_0x13109a[_0xf43a('0x55')]=_0x13109a[_0xf43a('0x56')];_0x13109a['motionChannel']=_0xf43a('0x57');if(_0x3bac56){_0x13109a['mandatoryDisposition']=_0x3bac56[_0xf43a('0x58')];}return _0x13109a;}exports[_0xf43a('0x59')]=buildObj;exports[_0xf43a('0x5a')]=function(_0x32a0f2){var _0x14817f=[];for(var _0x5b467f in _0x32a0f2){if(_0x32a0f2[_0xf43a('0x2d')](_0x5b467f)){if(!_[_0xf43a('0x15')](_0x32a0f2[_0x5b467f])&&_0x32a0f2[_0x5b467f][_0xf43a('0x31')]==='not_inuse'&&_0x32a0f2[_0x5b467f]['status']===_0xf43a('0x5b')){_0x14817f[_0xf43a('0x5c')](_0x32a0f2[_0x5b467f]['id']);}}}return _0x14817f;};exports[_0xf43a('0x5d')]=function(_0x4c1e9e){var _0x4f482e=moment()[_0xf43a('0x5e')](0x0);var _0x5eff1e=moment(_0x4c1e9e)[_0xf43a('0x5e')](0x0);return _0x4f482e['diff'](_0x5eff1e,'seconds');};exports[_0xf43a('0x5f')]=function(_0x966147){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x966147['ContactId'],'ListId':_0x966147[_0xf43a('0x4f')],'VoiceQueueId':_0x966147[_0xf43a('0x1b')]||undefined,'CampaignId':_0x966147[_0xf43a('0x60')]||undefined};};exports['filterKey']=function(_0x7f365e){if(_0x7f365e===_0xf43a('0x43')||_0x7f365e==='idContact'||_0x7f365e==='queue'||_0x7f365e==='type'||_0x7f365e==='campaigntype'||_0x7f365e==='dialAnswer'||_0x7f365e===_0xf43a('0x38')||_0x7f365e===_0xf43a('0x56')||_0x7f365e===_0xf43a('0x19')||_0x7f365e===_0xf43a('0x4b')||_0x7f365e==='calleridnum'||_0x7f365e==='scheduledat'||_0x7f365e===_0xf43a('0x45')||_0x7f365e===_0xf43a('0x46')||_0x7f365e===_0xf43a('0x47')||_0x7f365e==='countglobal'||_0x7f365e===_0xf43a('0x61')||_0x7f365e===_0xf43a('0x62')||_0x7f365e===_0xf43a('0x63')||_0x7f365e===_0xf43a('0x64')||_0x7f365e===_0xf43a('0x4e')||_0x7f365e===_0xf43a('0x4f')||_0x7f365e==='UserId'||_0x7f365e===_0xf43a('0x1b')||_0x7f365e==='sipcallid'||_0x7f365e==='xmd-voicequeueid'||_0x7f365e===_0xf43a('0x65')||_0x7f365e==='xmd-phone'||_0x7f365e===_0xf43a('0x66')||_0x7f365e===_0xf43a('0x67')||_0x7f365e==='xmd-dialtimeout'||_0x7f365e===_0xf43a('0x68')||_0x7f365e===_0xf43a('0x69')||_0x7f365e===_0xf43a('0x6a')||_0x7f365e===_0xf43a('0x6b')||_0x7f365e===_0xf43a('0x6c')||_0x7f365e==='xmd-callerid'||_0x7f365e===_0xf43a('0x6d')||_0x7f365e==='xmd-agi'||_0x7f365e==='rtpaudioqos'||_0x7f365e===_0xf43a('0x6e')||_0x7f365e===_0xf43a('0x6f')||_0x7f365e===_0xf43a('0x70')||_0x7f365e==='rtpaudioqosloss'||_0x7f365e==='rtpaudioqoslossbridged'||_0x7f365e===_0xf43a('0x71')||_0x7f365e===_0xf43a('0x72')||_0x7f365e===_0xf43a('0x73')||_0x7f365e==='rtpaudioqosbridged'||_0x7f365e===_0xf43a('0x6f')||_0x7f365e===_0xf43a('0x70')||_0x7f365e===_0xf43a('0x74')||_0x7f365e==='rtpaudioqoslossbridged'||_0x7f365e===_0xf43a('0x71')||_0x7f365e===_0xf43a('0x72')||_0x7f365e===_0xf43a('0x75')||_0x7f365e===_0xf43a('0x76')||_0x7f365e===_0xf43a('0x31')||_0x7f365e===_0xf43a('0x3a')){return![];}return!![];};exports[_0xf43a('0x77')]=function(_0x42233c,_0xbec5aa){var _0x521790,_0x207eda,_0x4d0711;if(_0xbec5aa<=0x0){_0xbec5aa=0x1;}_0x521790=new RegExp('\x5cw{0,'+_0xbec5aa+'}$');_0x207eda=Math[_0xf43a('0x78')](0xa,_0xbec5aa-0x1);_0x4d0711=Math[_0xf43a('0x78')](0xa,_0xbec5aa)-0x1;return util['format']('%s',_[_0xf43a('0x79')](_0x42233c,_0x521790,_[_0xf43a('0x7a')](_0x207eda,_0x4d0711)));};exports[_0xf43a('0x7b')]=function(_0x4a1cdc){var _0x1d40a0=_0x4a1cdc[_0xf43a('0x7c')](/"(.*?)"/);return _0x1d40a0?_0x1d40a0[0x1]:_0x4a1cdc;};exports[_0xf43a('0x7d')]=function(_0x317172){var _0x3c8f65=_0x317172['match'](/<(.*?)>/);return _0x3c8f65?_0x3c8f65[0x1]:_0x317172;};function buildNoAnswerEventPayload(_0x51f08f,_0x3c2dc4){var _0x1f822c=buildObj(_0x51f08f,_0xf43a('0x7e'));if(!_[_0xf43a('0x11')](_0x3c2dc4[_0xf43a('0x7f')])){Object[_0xf43a('0x80')](_0x3c2dc4[_0xf43a('0x7f')])[_0xf43a('0x81')](function(_0x16f9df){_0x1f822c[_0x16f9df['toLowerCase']()]=_0x3c2dc4[_0xf43a('0x7f')][_0x16f9df];});}return _0x1f822c;}exports[_0xf43a('0x82')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xba6e=['YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','getSeconds','logLookAgent','UserId','logCustomer','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','voice','mandatoryDisposition','buildObj','agentReadyId','reachable','push','getDiff','seconds','createBody','CampaignId','idContact','queue','campaigntype','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined'];(function(_0x18b641,_0x12c769){var _0x19c739=function(_0x30bac9){while(--_0x30bac9){_0x18b641['push'](_0x18b641['shift']());}};_0x19c739(++_0x12c769);}(_0xba6e,0x168));var _0xeba6=function(_0x17af6e,_0x41b592){_0x17af6e=_0x17af6e-0x0;var _0x1bcfd5=_0xba6e[_0x17af6e];return _0x1bcfd5;};'use strict';var util=require(_0xeba6('0x0'));var _=require(_0xeba6('0x1'));var moment=require('moment');var logger=require(_0xeba6('0x2'))('preview');var ipAgi=process[_0xeba6('0x3')][_0xeba6('0x4')]||_0xeba6('0x5');var utils=require(_0xeba6('0x6'));exports[_0xeba6('0x7')]=function(_0x341894){return function(_0x70666){logger[_0xeba6('0x8')](_0x341894,util[_0xeba6('0x9')](_0x70666,{'showHidden':![],'depth':null}));};};exports[_0xeba6('0xa')]=function(_0x330f1a,_0xded387){logger[_0xeba6('0xb')](_0x330f1a,util['inspect'](_0xded387,{'showHidden':![],'depth':null}));};exports[_0xeba6('0xc')]=function(_0x2a0e54,_0x1c99b4){logger[_0xeba6('0x8')](_0x2a0e54,util[_0xeba6('0x9')](_0x1c99b4,{'showHidden':![],'depth':null}));};exports[_0xeba6('0xd')]=function(_0x59c0b8){return function(_0x3b713e){logger[_0xeba6('0xb')](_0x59c0b8,util[_0xeba6('0x9')](_0x3b713e,{'showHidden':![],'depth':null}));};};exports[_0xeba6('0xe')]=function(_0xc349cc,_0x5466e1,_0x37e65b){return{'message':_0xc349cc,'unlock':_0x5466e1,'active':_0x37e65b};};exports[_0xeba6('0xf')]=function(_0x2847cf,_0x9b58c9,_0x185ce0){if(!_['isUndefined'](_0x185ce0)&&_0xeba6('0x10')===typeof _0x185ce0&&!_['isEmpty'](_0x185ce0)){if(!_[_0xeba6('0x11')](_0x9b58c9)&&_0xeba6('0x10')===typeof _0x9b58c9&&!_[_0xeba6('0x12')](_0x9b58c9)){return util[_0xeba6('0x13')](_0xeba6('0x14'),_0x9b58c9,_0x185ce0);}return util[_0xeba6('0x13')](_0xeba6('0x14'),_0x185ce0,_0x185ce0);}if(!_['isUndefined'](_0x2847cf)&&_0xeba6('0x10')===typeof _0x2847cf&&!_[_0xeba6('0x12')](_0x2847cf)){return _0x2847cf;}return'\x22\x22\x20<>';};exports[_0xeba6('0x15')]=function(_0x1948f3){if(_[_0xeba6('0x16')](_0x1948f3)){return![];}return _0x1948f3;};exports[_0xeba6('0x17')]=function(_0x3a43f6,_0x346d44,_0x168df8,_0x1157a5,_0x3721ac,_0x44ed37){var _0xcc0fc6={'XMD-QUEUE':_0x346d44[_0xeba6('0x18')]?_0x346d44[_0xeba6('0x18')][_0xeba6('0x19')]:'','XMD-CALLERID':_0x1157a5,'XMD-CALLERID-PREVIEW':_0x44ed37?util['format'](_0xeba6('0x14'),_0x44ed37[_0xeba6('0x1a')],_0x44ed37[_0xeba6('0x1b')]):_0x1157a5,'XMD-DIALID':_0x3721ac,'XMD-CONTACTID':_0x346d44['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1157a5,'XMD-VOICEQUEUEID':_0x346d44[_0xeba6('0x1c')],'XMD-DIALCHANNEL':_0x168df8,'XMD-DIALTIMEOUT':_0x3a43f6[_0xeba6('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xeba6('0x13')](_0xeba6('0x1e'),_0x3a43f6[_0xeba6('0x1f')]?'g':'',_[_0xeba6('0x12')](_0x3a43f6[_0xeba6('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3a43f6[_0xeba6('0x21')]||'','XMD-AGI':_0x3a43f6[_0xeba6('0x22')]?util[_0xeba6('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3a43f6[_0xeba6('0x22')]):_0xeba6('0x23'),'XMD-AGIAFTER':_0x3a43f6[_0xeba6('0x1f')]?util[_0xeba6('0x13')](_0xeba6('0x24'),ipAgi,_0x3a43f6[_0xeba6('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x44ed37?_0x44ed37[_0xeba6('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x44ed37?_0x44ed37[_0xeba6('0x26')]:'','XMD-DESTINATION':_0xeba6('0x27'),'SIPADDHEADER':_0xeba6('0x28')};if(!_['isEmpty'](_0x3a43f6[_0xeba6('0x20')])){_0xcc0fc6[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3a43f6[_0xeba6('0x20')];_0xcc0fc6[util['format']('%s',_0xeba6('0x29'))]=_0x3721ac;}return _0xcc0fc6;};exports[_0xeba6('0x2a')]=function(_0x4a6a19){var _0x4ad2bc={};for(var _0x1a69d6 in _0x4a6a19){if(_0x4a6a19[_0xeba6('0x2b')](_0x1a69d6)){_0x4ad2bc[util['format']('%s',_[_0xeba6('0x2c')](_0x1a69d6))]=_0x4a6a19[_0x1a69d6];}}return{'variables':_0x4ad2bc};};exports[_0xeba6('0x2d')]=function(_0x5c6797,_0x2f8ef6){if(!_['isNil'](_0x5c6797)){if(_0x5c6797[_0xeba6('0x2b')](_0xeba6('0x2e'))){if(_0x5c6797[_0xeba6('0x2e')]>0x0){_0x5c6797['originated']-=0x1;}else{logger[_0xeba6('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2f8ef6);}}}else{logger[_0xeba6('0x8')](_0xeba6('0x2f'),_0x2f8ef6);}};exports['logBlacklist']=function(_0x16e61f){var _0xf51cbb=moment()[_0xeba6('0x13')](_0xeba6('0x30'));_0x16e61f[_0xeba6('0x31')]=0xd;_0x16e61f[_0xeba6('0x32')]=_0xeba6('0x33');_0x16e61f[_0xeba6('0x34')]=_0xf51cbb;_0x16e61f[_0xeba6('0x35')]=_0xf51cbb;_0x16e61f[_0xeba6('0x36')]=_0xf51cbb;};exports['logAgent']=function(_0x3069e6,_0x2046ef,_0x30b488){var _0x3abc2e=moment()[_0xeba6('0x13')](_0xeba6('0x30'));_0x3069e6[_0xeba6('0x31')]=_0x2046ef;_0x3069e6[_0xeba6('0x32')]=_0x30b488;_0x3069e6['responsetime']=_0x3abc2e;_0x3069e6[_0xeba6('0x37')]=utils[_0xeba6('0x38')](_0x3069e6[_0xeba6('0x35')],_0x3069e6['starttime']);};exports[_0xeba6('0x39')]=function(_0x314294,_0x291c83,_0x2c06ab){_0x314294['membername']=_0x291c83;_0x314294[_0xeba6('0x3a')]=_0x2c06ab;};exports[_0xeba6('0x3b')]=function(_0x2b6044,_0x1bf7cb,_0xf220df){var _0x592cec=moment()[_0xeba6('0x13')](_0xeba6('0x30'));_0x2b6044[_0xeba6('0x31')]=_0x1bf7cb;_0x2b6044[_0xeba6('0x32')]=_0xf220df;_0x2b6044[_0xeba6('0x35')]=_0x2b6044[_0xeba6('0x35')]?_0x2b6044[_0xeba6('0x35')]:_0x592cec;_0x2b6044[_0xeba6('0x36')]=_0x2b6044[_0xeba6('0x36')]?_0x2b6044['endtime']:_0x592cec;_0x2b6044[_0xeba6('0x37')]=utils['getSeconds'](_0x2b6044['responsetime']||0x0,_0x2b6044['starttime']||0x0);_0x2b6044['talktime']=_0x2b6044['answertime']?utils[_0xeba6('0x38')](_0x2b6044[_0xeba6('0x36')],_0x2b6044[_0xeba6('0x3c')]):0x0;};exports['isFailure']=function(_0x42e4f5){return _0x42e4f5===_0xeba6('0x3d');};exports[_0xeba6('0x3e')]=function(_0xa8b4b4,_0x2af9c0,_0x188543,_0x26c746,_0x4f5ba9){var _0x2acb49=_0x26c746?_0xeba6('0x3f'):_0xa8b4b4[_0xeba6('0x1a')];_0x2acb49=_0x4f5ba9?_0xeba6('0x40'):_0x2acb49;return{'actionid':_0xa8b4b4[_0xeba6('0x41')],'action':_0xeba6('0x42'),'channel':_0xa8b4b4[_0xeba6('0x43')],'callerid':util[_0xeba6('0x13')](_0xeba6('0x14'),_0x2acb49,_0xa8b4b4[_0xeba6('0x1b')]),'Exten':'xcally-motion-preview','Context':_0xeba6('0x44'),'Priority':'1','variable':_0x188543,'timeout':(_0x2af9c0[_0xeba6('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0xa8b4b4[_0xeba6('0x41')]};};exports['totalGlobal']=function(_0x51b557){return _0x51b557[_0xeba6('0x46')]+_0x51b557[_0xeba6('0x47')]+_0x51b557[_0xeba6('0x48')]+_0x51b557[_0xeba6('0x49')]+_0x51b557['countnosuchnumberretry'];};exports[_0xeba6('0x4a')]=function(_0x3ac5b0){var _0x1360a7=_['clone'](_0x3ac5b0);_0x1360a7['state']=0xf;_0x1360a7[_0xeba6('0x32')]=_0xeba6('0x4b');return _0x1360a7;};exports[_0xeba6('0x4c')]=function(_0x538254,_0x1ad7aa,_0x5ecabf){var _0x554b9c={};_0x554b9c[_0x1ad7aa]=_0x538254[_0x1ad7aa];_0x554b9c['active']=![];_0x554b9c[_0xeba6('0x4d')]=moment()[_0xeba6('0x4e')](_0x5ecabf,_0xeba6('0x4f'))[_0xeba6('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x554b9c[_0xeba6('0x50')]=_0x538254[_0xeba6('0x50')];_0x554b9c[_0xeba6('0x51')]=_0x538254[_0xeba6('0x51')];_0x554b9c[_0xeba6('0x1c')]=_0x538254[_0xeba6('0x1c')]||undefined;return _0x554b9c;};exports['decrementTalkink']=function(_0x10bf55,_0x1b3e28){if(!_[_0xeba6('0x16')](_0x10bf55)){if(_0x10bf55[_0xeba6('0x52')]>0x0){_0x10bf55[_0xeba6('0x52')]-=0x1;}else{logger[_0xeba6('0x8')](_0x1b3e28,_0xeba6('0x53'));}}else{logger[_0xeba6('0x8')](_0x1b3e28,_0xeba6('0x54'));}};exports[_0xeba6('0x55')]=function(_0x1a1bba){if(_0x1a1bba<=0x0){return!![];}return![];};function buildObj(_0x57e711,_0x31a7ac,_0x58cdf2){_0x57e711[_0xeba6('0x56')]=_0x31a7ac;_0x57e711[_0xeba6('0x19')]=_0x57e711['queue'];_0x57e711[_0xeba6('0x57')]=_0x57e711[_0xeba6('0x43')];_0x57e711['motionChannel']=_0xeba6('0x58');if(_0x58cdf2){_0x57e711[_0xeba6('0x59')]=_0x58cdf2[_0xeba6('0x59')];}return _0x57e711;}exports[_0xeba6('0x5a')]=buildObj;exports[_0xeba6('0x5b')]=function(_0x56d754){var _0x9d3da5=[];for(var _0x1c5f31 in _0x56d754){if(_0x56d754[_0xeba6('0x2b')](_0x1c5f31)){if(!_[_0xeba6('0x16')](_0x56d754[_0x1c5f31])&&_0x56d754[_0x1c5f31][_0xeba6('0x31')]==='not_inuse'&&_0x56d754[_0x1c5f31]['status']===_0xeba6('0x5c')){_0x9d3da5[_0xeba6('0x5d')](_0x56d754[_0x1c5f31]['id']);}}}return _0x9d3da5;};exports[_0xeba6('0x5e')]=function(_0x6ddbb3){var _0x4c8677=moment()['milliseconds'](0x0);var _0x5c0399=moment(_0x6ddbb3)['milliseconds'](0x0);return _0x4c8677['diff'](_0x5c0399,_0xeba6('0x5f'));};exports[_0xeba6('0x60')]=function(_0x30b491){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x30b491['ContactId'],'ListId':_0x30b491[_0xeba6('0x51')],'VoiceQueueId':_0x30b491[_0xeba6('0x1c')]||undefined,'CampaignId':_0x30b491[_0xeba6('0x61')]||undefined};};exports['filterKey']=function(_0x314363){if(_0x314363===_0xeba6('0x41')||_0x314363===_0xeba6('0x62')||_0x314363===_0xeba6('0x63')||_0x314363==='type'||_0x314363===_0xeba6('0x64')||_0x314363==='dialAnswer'||_0x314363==='membername'||_0x314363===_0xeba6('0x43')||_0x314363==='calleridname'||_0x314363===_0xeba6('0x65')||_0x314363===_0xeba6('0x1b')||_0x314363===_0xeba6('0x4d')||_0x314363===_0xeba6('0x46')||_0x314363===_0xeba6('0x47')||_0x314363===_0xeba6('0x48')||_0x314363===_0xeba6('0x66')||_0x314363===_0xeba6('0x67')||_0x314363===_0xeba6('0x68')||_0x314363===_0xeba6('0x69')||_0x314363===_0xeba6('0x6a')||_0x314363===_0xeba6('0x50')||_0x314363===_0xeba6('0x51')||_0x314363===_0xeba6('0x3a')||_0x314363===_0xeba6('0x1c')||_0x314363===_0xeba6('0x6b')||_0x314363==='xmd-voicequeueid'||_0x314363==='xmd-queue'||_0x314363===_0xeba6('0x6c')||_0x314363===_0xeba6('0x6d')||_0x314363==='xmd-dialurl'||_0x314363===_0xeba6('0x6e')||_0x314363===_0xeba6('0x6f')||_0x314363==='xmd-dialid'||_0x314363===_0xeba6('0x70')||_0x314363===_0xeba6('0x71')||_0x314363===_0xeba6('0x72')||_0x314363===_0xeba6('0x73')||_0x314363==='xmd-agiafter'||_0x314363===_0xeba6('0x74')||_0x314363===_0xeba6('0x75')||_0x314363===_0xeba6('0x76')||_0x314363===_0xeba6('0x77')||_0x314363===_0xeba6('0x78')||_0x314363==='rtpaudioqosloss'||_0x314363==='rtpaudioqoslossbridged'||_0x314363===_0xeba6('0x79')||_0x314363===_0xeba6('0x7a')||_0x314363==='rtpaudioqos'||_0x314363===_0xeba6('0x76')||_0x314363===_0xeba6('0x77')||_0x314363===_0xeba6('0x78')||_0x314363==='rtpaudioqosloss'||_0x314363===_0xeba6('0x7b')||_0x314363==='rtpaudioqosrtt'||_0x314363==='rtpaudioqosrttbridged'||_0x314363==='bridgepeer'||_0x314363===_0xeba6('0x7c')||_0x314363===_0xeba6('0x31')||_0x314363===_0xeba6('0x32')){return![];}return!![];};exports[_0xeba6('0x7d')]=function(_0x463450,_0x3b58f1){var _0x200aef,_0x1703b9,_0x49c416;if(_0x3b58f1<=0x0){_0x3b58f1=0x1;}_0x200aef=new RegExp(_0xeba6('0x7e')+_0x3b58f1+'}$');_0x1703b9=Math[_0xeba6('0x7f')](0xa,_0x3b58f1-0x1);_0x49c416=Math[_0xeba6('0x7f')](0xa,_0x3b58f1)-0x1;return util['format']('%s',_['replace'](_0x463450,_0x200aef,_[_0xeba6('0x80')](_0x1703b9,_0x49c416)));};exports[_0xeba6('0x81')]=function(_0x40a866){var _0xb29808=_0x40a866['match'](/"(.*?)"/);return _0xb29808?_0xb29808[0x1]:_0x40a866;};exports[_0xeba6('0x82')]=function(_0x2fcd2b){var _0x2934e2=_0x2fcd2b[_0xeba6('0x83')](/<(.*?)>/);return _0x2934e2?_0x2934e2[0x1]:_0x2fcd2b;};function buildNoAnswerEventPayload(_0x2d36c4,_0x45815c){var _0x1624d3=buildObj(_0x2d36c4,_0xeba6('0x84'));if(!_[_0xeba6('0x12')](_0x45815c[_0xeba6('0x85')])){Object['keys'](_0x45815c[_0xeba6('0x85')])['forEach'](function(_0x472541){_0x1624d3[_0x472541[_0xeba6('0x86')]()]=_0x45815c[_0xeba6('0x85')][_0x472541];});}return _0x1624d3;}exports[_0xeba6('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 55ebcc4..0603128 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 _0x463e=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x463e,0x13f));var _0xe463=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x463e[_0x187ee1];return _0x388160;};'use strict';exports[_0xe463('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xe463('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xe463('0x2'),'required':![]}};exports[_0xe463('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xe463('0x1'),'required':!![]}};exports[_0xe463('0x4')]={'interface':{'type':_0xe463('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0xe463('0x5')]={'module':{'type':_0xe463('0x1'),'required':![]}};exports[_0xe463('0x6')]={'uniqueid':{'type':_0xe463('0x1'),'required':!![]}};exports[_0xe463('0x7')]={'uniqueid':{'type':_0xe463('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xe463('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xe463('0x8')]={'uniqueid':{'type':_0xe463('0x1'),'required':!![]}};exports[_0xe463('0x9')]={'uniqueid':{'type':_0xe463('0x1'),'required':!![]},'exten':{'type':_0xe463('0x1'),'required':!![]},'context':{'type':_0xe463('0x1')}}; \ No newline at end of file +var _0xb93f=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean','queuepause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb93f,0x9d));var _0xfb93=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xb93f[_0x2077c2];return _0x312f9f;};'use strict';exports[_0xfb93('0x0')]={'queue':{'type':_0xfb93('0x1'),'required':!![]},'interface':{'type':_0xfb93('0x1'),'required':!![]},'membername':{'type':_0xfb93('0x1'),'required':!![]},'penalty':{'type':_0xfb93('0x2'),'required':![]},'paused':{'type':_0xfb93('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xfb93('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xfb93('0x4')]={'interface':{'type':_0xfb93('0x1'),'required':!![]},'paused':{'type':_0xfb93('0x3')},'reason':{'type':_0xfb93('0x1'),'required':![]}};exports[_0xfb93('0x5')]={'module':{'type':_0xfb93('0x1'),'required':![]}};exports[_0xfb93('0x6')]={'uniqueid':{'type':_0xfb93('0x1'),'required':!![]}};exports[_0xfb93('0x7')]={'uniqueid':{'type':_0xfb93('0x1'),'required':!![]},'filename':{'type':_0xfb93('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xfb93('0x1')}};exports[_0xfb93('0x8')]={'uniqueid':{'type':_0xfb93('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xfb93('0x1'),'required':!![]},'context':{'type':_0xfb93('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 3091cc1..dfb79fa 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x527a53,_0x3265d6){_0x527a53=_0x527a53-0x0;var _0x2332f5=_0x0b0e[_0x527a53];return _0x2332f5;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x0b0e[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 6ee0ba6..cefacc6 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 _0x517e=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x3d8e71,_0x32df4d){var _0x36cd6c=function(_0x5b2926){while(--_0x5b2926){_0x3d8e71['push'](_0x3d8e71['shift']());}};_0x36cd6c(++_0x32df4d);}(_0x517e,0x15d));var _0xe517=function(_0x479c46,_0x1810a3){_0x479c46=_0x479c46-0x0;var _0x24c111=_0x517e[_0x479c46];return _0x24c111;};'use strict';function mergeDBDataToRealtime(_0x5a1981,_0x3f3137){var _0x7439f4=Object[_0xe517('0x0')]({},_0x5a1981);for(var _0x121f01 in _0x3f3137){if(_0x7439f4[_0xe517('0x1')](_0x121f01)){_0x7439f4[_0x121f01]=_0x3f3137[_0x121f01];}}return _0x7439f4;}exports[_0xe517('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xc02e=['hasOwnProperty'];(function(_0x250c8c,_0x50e758){var _0x48ad39=function(_0x59cb5f){while(--_0x59cb5f){_0x250c8c['push'](_0x250c8c['shift']());}};_0x48ad39(++_0x50e758);}(_0xc02e,0x154));var _0xec02=function(_0x4292cd,_0x327a40){_0x4292cd=_0x4292cd-0x0;var _0x5e4838=_0xc02e[_0x4292cd];return _0x5e4838;};'use strict';function mergeDBDataToRealtime(_0xa4fe2a,_0x361d32){var _0x164ca9=Object['assign']({},_0xa4fe2a);for(var _0x451be4 in _0x361d32){if(_0x164ca9[_0xec02('0x0')](_0x451be4)){_0x164ca9[_0x451be4]=_0x361d32[_0x451be4];}}return _0x164ca9;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 91e03b2..725c87a 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 _0x493e=['connectedlinename','membername','isArray','startsWith','indexOf','phone','substring','lastIndexOf','blindTransfer','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','name','isNil','interface','format','SIP/%s','voiceQueueReport','length','findAgent','connectedlinenum','accountcode','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','calleridnum','internal','exten','type','dialer','lastapplication','queue','context','from-voip-provider','destination','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfers','transfereelinkedid','split','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview'];(function(_0x2a4cae,_0x319f9d){var _0x3ec0cf=function(_0x5ad9c9){while(--_0x5ad9c9){_0x2a4cae['push'](_0x2a4cae['shift']());}};_0x3ec0cf(++_0x319f9d);}(_0x493e,0x110));var _0xe493=function(_0x2e70d0,_0x4dc9fe){_0x2e70d0=_0x2e70d0-0x0;var _0x2ef66c=_0x493e[_0x2e70d0];return _0x2ef66c;};'use strict';var _=require(_0xe493('0x0'));var moment=require(_0xe493('0x1'));var util=require(_0xe493('0x2'));var config=require(_0xe493('0x3'));var ami=require(_0xe493('0x4'));var RpcVoiceAgentReport=require(_0xe493('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xe493('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xe493('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xe493('0x8'));var VoiceAgentReport=require(_0xe493('0x9'));var VoiceDialReport=require(_0xe493('0xa'));var UserReport=require(_0xe493('0xb'));function Report(_0x18de3c){this[_0xe493('0xc')]=_0x18de3c;this[_0xe493('0xd')]=_0x18de3c[_0xe493('0xd')];this[_0xe493('0xe')]=_0x18de3c[_0xe493('0xe')];}Report[_0xe493('0xf')][_0xe493('0x10')]=function(_0xd6fddd){var _0x5adf66=new VoiceQueueReport(this[_0xe493('0xc')]);var _0x61c30a=new VoiceAgentReport(this[_0xe493('0xc')]);var _0x25316e=new VoiceDialReport(this[_0xe493('0xc')]);var _0x3b81a6=new VoiceCallReport(this[_0xe493('0xc')]);var _0x34a2a4=new UserReport(this[_0xe493('0xc')]);if(config['xdr']&&config['xdr']['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xe493('0x11')](this));ami['on'](_0xe493('0x12'),this[_0xe493('0x13')][_0xe493('0x11')](this));ami['on'](_0xe493('0x14'),this[_0xe493('0x15')][_0xe493('0x11')](this));ami['on'](_0xe493('0x16'),this[_0xe493('0x17')]['bind'](this));ami['on'](_0xe493('0x18'),this['blindTransfer'][_0xe493('0x11')](this));ami['on'](_0xe493('0x19'),this[_0xe493('0x1a')][_0xe493('0x11')](this));}};Report['prototype']['findAgent']=function(_0x3ada68){var _0x2254a8;_0x2254a8=_[_0xe493('0x1b')](this[_0xe493('0xd')],function(_0x3fec15){return _0x3fec15['accountcode']==_0x3ada68||_0x3fec15[_0xe493('0x1c')]==_0x3ada68;});if(_[_0xe493('0x1d')](_0x2254a8)){var _0x84fcc8=_[_0xe493('0x1b')](this[_0xe493('0xe')],function(_0x2ff807){return _0x2ff807['accountcode']==_0x3ada68||_0x2ff807[_0xe493('0x1c')]==_0x3ada68;});if(_0x84fcc8){_0x2254a8=_[_0xe493('0x1b')](this[_0xe493('0xd')],function(_0x5ba531){return _0x5ba531[_0xe493('0x1e')]==util[_0xe493('0x1f')](_0xe493('0x20'),_0x84fcc8[_0xe493('0x1c')]);});}}return _0x2254a8;};Report[_0xe493('0xf')][_0xe493('0x21')]=function(_0x53cefd){for(var _0x2055bb=0x0;_0x2055bb<_0x53cefd[_0xe493('0x22')];_0x2055bb+=0x1){var _0x21f13d=this[_0xe493('0x23')](_0x53cefd[_0x2055bb][_0xe493('0x24')]);if(_0x21f13d){_0x53cefd[_0x2055bb][_0xe493('0x25')]=_0x21f13d[_0xe493('0x25')];_0x53cefd[_0x2055bb]['assigned']=!![];_0x53cefd[_0x2055bb][_0xe493('0x26')]=_0x21f13d[_0xe493('0x1c')];_0x53cefd[_0x2055bb][_0xe493('0x1e')]=_[_0xe493('0x1d')](_0x21f13d[_0xe493('0x1e')])?util[_0xe493('0x1f')](_0xe493('0x20'),_0x21f13d['name']):_0x21f13d[_0xe493('0x1e')];if(_0x53cefd[_0x2055bb][_0xe493('0x27')]){_0x53cefd[_0x2055bb]['queuecallercompleteAt']=moment()[_0xe493('0x1f')](_0xe493('0x28'));}if(_0x53cefd[_0x2055bb]['queuecallerexit']){_0x53cefd[_0x2055bb][_0xe493('0x29')]=moment()[_0xe493('0x1f')](_0xe493('0x28'));}RpcMemberReport[_0xe493('0x21')](_0x53cefd[_0x2055bb]);}RpcVoiceQueueReport[_0xe493('0x2a')](_0x53cefd[_0x2055bb]);}};function extractCalleridNumber(_0x4056a1){var _0x2a4bea=_0x4056a1[_0xe493('0x2b')](/<(.*?)>/);return _0x2a4bea?_0x2a4bea[0x1]:_0x4056a1;}Report[_0xe493('0xf')][_0xe493('0x2c')]=function(_0x4c8398){for(var _0x4398d0=0x0;_0x4398d0','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitors','createdAt','xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport'];(function(_0x49d0d6,_0x57fb4e){var _0x541fde=function(_0x1e987c){while(--_0x1e987c){_0x49d0d6['push'](_0x49d0d6['shift']());}};_0x541fde(++_0x57fb4e);}(_0x1082,0x9c));var _0x2108=function(_0x23abe8,_0x2a1839){_0x23abe8=_0x23abe8-0x0;var _0x2f01c0=_0x1082[_0x23abe8];return _0x2f01c0;};'use strict';var _=require(_0x2108('0x0'));var moment=require(_0x2108('0x1'));var util=require(_0x2108('0x2'));var config=require(_0x2108('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2108('0x4'));var RpcVoiceCallReport=require(_0x2108('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x2108('0x6'));var RpcVoiceQueueReport=require(_0x2108('0x7'));var RpcVoiceRecording=require(_0x2108('0x8'));var RpcVoiceTransferReport=require(_0x2108('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x2108('0xa'));var VoiceAgentReport=require(_0x2108('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2108('0xc'));function Report(_0x274bee){this[_0x2108('0xd')]=_0x274bee;this[_0x2108('0xe')]=_0x274bee[_0x2108('0xe')];this[_0x2108('0xf')]=_0x274bee[_0x2108('0xf')];}Report[_0x2108('0x10')][_0x2108('0x11')]=function(_0x5a5a14){var _0xb1145e=new VoiceQueueReport(this[_0x2108('0xd')]);var _0x2f7709=new VoiceAgentReport(this[_0x2108('0xd')]);var _0x20c3a8=new VoiceDialReport(this[_0x2108('0xd')]);var _0x5c8841=new VoiceCallReport(this[_0x2108('0xd')]);var _0x5f5aca=new UserReport(this['realtime']);if(config[_0x2108('0x12')]&&config[_0x2108('0x12')][_0x2108('0x13')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on'](_0x2108('0x14'),this[_0x2108('0x15')]['bind'](this));ami['on'](_0x2108('0x16'),this[_0x2108('0x17')][_0x2108('0x18')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x2108('0x18')](this));ami['on'](_0x2108('0x19'),this[_0x2108('0x1a')]['bind'](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0x2108('0x10')][_0x2108('0x1b')]=function(_0x56293a){var _0x35bebc;_0x35bebc=_['find'](this[_0x2108('0xe')],function(_0x301a3d){return _0x301a3d[_0x2108('0x1c')]==_0x56293a||_0x301a3d['name']==_0x56293a;});if(_[_0x2108('0x1d')](_0x35bebc)){var _0x23b5cc=_['find'](this[_0x2108('0xf')],function(_0x3b6b13){return _0x3b6b13[_0x2108('0x1c')]==_0x56293a||_0x3b6b13[_0x2108('0x1e')]==_0x56293a;});if(_0x23b5cc){_0x35bebc=_[_0x2108('0x1f')](this[_0x2108('0xe')],function(_0x465d55){return _0x465d55[_0x2108('0x20')]==util[_0x2108('0x21')](_0x2108('0x22'),_0x23b5cc[_0x2108('0x1e')]);});}}return _0x35bebc;};Report[_0x2108('0x10')][_0x2108('0x23')]=function(_0x51d0ab){for(var _0x28a4f4=0x0;_0x28a4f4<_0x51d0ab[_0x2108('0x24')];_0x28a4f4+=0x1){var _0x41f0c8=this[_0x2108('0x1b')](_0x51d0ab[_0x28a4f4][_0x2108('0x25')]);if(_0x41f0c8){_0x51d0ab[_0x28a4f4]['accountcode']=_0x41f0c8[_0x2108('0x1c')];_0x51d0ab[_0x28a4f4]['assigned']=!![];_0x51d0ab[_0x28a4f4][_0x2108('0x26')]=_0x41f0c8[_0x2108('0x1e')];_0x51d0ab[_0x28a4f4][_0x2108('0x20')]=_[_0x2108('0x1d')](_0x41f0c8[_0x2108('0x20')])?util['format'](_0x2108('0x22'),_0x41f0c8['name']):_0x41f0c8[_0x2108('0x20')];if(_0x51d0ab[_0x28a4f4][_0x2108('0x27')]){_0x51d0ab[_0x28a4f4]['queuecallercompleteAt']=moment()['format'](_0x2108('0x28'));}if(_0x51d0ab[_0x28a4f4]['queuecallerexit']){_0x51d0ab[_0x28a4f4][_0x2108('0x29')]=moment()[_0x2108('0x21')](_0x2108('0x28'));}RpcMemberReport[_0x2108('0x23')](_0x51d0ab[_0x28a4f4]);}RpcVoiceQueueReport[_0x2108('0x2a')](_0x51d0ab[_0x28a4f4]);}};function extractCalleridNumber(_0x240f96){var _0x12a87c=_0x240f96[_0x2108('0x2b')](/<(.*?)>/);return _0x12a87c?_0x12a87c[0x1]:_0x240f96;}Report[_0x2108('0x10')][_0x2108('0x2c')]=function(_0x2c0540){for(var _0x5da9c5=0x0;_0x5da9c50x0?!![]:![];if(!_0x272b2c){return this[_0x0d9c('0x1d')](this[_0x0d9c('0x19')][_0x0d9c('0x76')]);}};VoiceQueueReport['prototype'][_0x0d9c('0x77')]=function(_0xff1c27){var _0x2401c9=this[_0x0d9c('0x19')]['id'];if(this[_0x0d9c('0x19')]['queuestatus'][_0x2401c9]&&this[_0x0d9c('0x19')][_0x0d9c('0x72')][_0x2401c9][_0xff1c27['actionid']]){this[_0x0d9c('0x19')][_0x0d9c('0x72')][_0x2401c9][_0xff1c27[_0x0d9c('0x6a')]][_0x0d9c('0x14')][_0x0d9c('0x78')](_0xff1c27);}};VoiceQueueReport[_0x0d9c('0xe')][_0x0d9c('0x79')]=function(_0x3cb9e3){var _0x5a1838=this;try{if(this[_0x0d9c('0x63')](_0x3cb9e3)&&this['isNotNull'](_0x3cb9e3[_0x0d9c('0x55')])){logger[_0x0d9c('0x50')](_0x0d9c('0x7a'),util['inspect'](_0x3cb9e3,{'showHidden':![],'depth':null}));var _0x87392c=this['voiceQueues'][_0x3cb9e3[_0x0d9c('0x55')]];if(_0x87392c){logger[_0x0d9c('0x50')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x87392c[_0x0d9c('0x61')]);this['summary'][_0x0d9c('0x66')][_0x87392c[_0x0d9c('0x61')]]={'summaryEvent':_0x3cb9e3};this['summary']['statusRequests']+=0x1;return ami[_0x0d9c('0x65')]({'action':'queuestatus','queue':_0x87392c['name']})[_0x0d9c('0x69')](function(_0x54cff6){if(!_0x5a1838[_0x0d9c('0x19')]['queuestatus'][_0x3cb9e3[_0x0d9c('0x6a')]]){_0x5a1838[_0x0d9c('0x19')][_0x0d9c('0x72')][_0x3cb9e3[_0x0d9c('0x6a')]]={};}_0x5a1838[_0x0d9c('0x19')]['queuestatus'][_0x3cb9e3['actionid']][_0x54cff6[_0x0d9c('0x6a')]]={'queue':_0x87392c[_0x0d9c('0x61')],'agents':[]};})[_0x0d9c('0x44')](function(_0x540418){throw _0x540418;});}}}catch(_0x4ff7ec){logger[_0x0d9c('0x49')](_0x0d9c('0x6b'),util[_0x0d9c('0x47')](_0x4ff7ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0d9c('0x1d')]=function(_0x40e69f){if(this[_0x0d9c('0x19')][_0x0d9c('0x75')]>0x0){this['summary'][_0x0d9c('0x76')]=_0x40e69f;return;}logger[_0x0d9c('0x50')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0d9c('0x47')](_0x40e69f,{'showHidden':![],'depth':null}));this[_0x0d9c('0x19')]=initializeSummary();ami[_0x0d9c('0x4e')](_0x0d9c('0x7b'),{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x30bfd4){try{if(this['isNotNull'](_0x30bfd4)){logger[_0x0d9c('0x50')](_0x0d9c('0x7c'),_0x30bfd4['uniqueid'],util[_0x0d9c('0x47')](_0x30bfd4,{'showHidden':![],'depth':null}));if(_[_0x0d9c('0x7d')](this[_0x0d9c('0x48')][_0x30bfd4[_0x0d9c('0x52')]])){this[_0x0d9c('0x48')][_0x30bfd4[_0x0d9c('0x52')]]=[];}if(_[_0x0d9c('0x7d')](this[_0x0d9c('0x15')][_0x30bfd4[_0x0d9c('0x52')]])){this[_0x0d9c('0x15')][_0x30bfd4[_0x0d9c('0x52')]]={};}var _0x5d90e0=new QueueReport();_0x5d90e0['queue']=_0x30bfd4[_0x0d9c('0x55')];_0x5d90e0[_0x0d9c('0x5e')]=this['voiceQueues'][_0x5d90e0['queue']]&&this['voiceQueues'][_0x5d90e0[_0x0d9c('0x55')]][_0x0d9c('0x5e')]?this[_0x0d9c('0x17')][_0x5d90e0['queue']]['type']||_0x0d9c('0x5f'):'inbound';_0x5d90e0[_0x0d9c('0x7e')]=moment()['format'](_0x0d9c('0x7f'));_0x5d90e0[_0x0d9c('0x80')]=_0x30bfd4[_0x0d9c('0x80')];_0x5d90e0['count']=_0x30bfd4['count'];_0x5d90e0[_0x0d9c('0x52')]=_0x30bfd4[_0x0d9c('0x52')];_0x5d90e0[_0x0d9c('0x81')]=this['channels'][_0x30bfd4['uniqueid']]['routealias'];logger[_0x0d9c('0x82')](_0x0d9c('0x83'),_0x5d90e0[_0x0d9c('0x55')],_0x5d90e0[_0x0d9c('0x5e')]);Object[_0x0d9c('0x71')](_0x5d90e0,_[_0x0d9c('0x84')](_0x30bfd4,_[_0x0d9c('0x85')](_0x5d90e0)));this[_0x0d9c('0x48')][_0x30bfd4['uniqueid']][_0x0d9c('0x78')](_0x5d90e0);this[_0x0d9c('0x15')][_0x30bfd4[_0x0d9c('0x52')]]=_0x5d90e0;this['emitVoiceQueueChannelSave'](_0x5d90e0,_0x0d9c('0x22'));}}catch(_0x5e26de){logger[_0x0d9c('0x49')](_0x0d9c('0x7c'),_0x30bfd4['uniqueid'],util[_0x0d9c('0x47')](_0x5e26de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d9c('0xe')][_0x0d9c('0x25')]=function(_0x1fdf8b){try{if(this[_0x0d9c('0x63')](_0x1fdf8b)){logger[_0x0d9c('0x50')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1fdf8b[_0x0d9c('0x52')],util[_0x0d9c('0x47')](_0x1fdf8b,{'showHidden':![],'depth':null}));if(this[_0x0d9c('0x48')][_0x1fdf8b[_0x0d9c('0x52')]]){var _0x1ff951=_[_0x0d9c('0x86')](this[_0x0d9c('0x48')][_0x1fdf8b['uniqueid']]);_0x1ff951[_0x0d9c('0x3f')]=![];_0x1ff951['queuecallercompleteAt']=null;_0x1ff951[_0x0d9c('0x87')]=_0x1fdf8b[_0x0d9c('0x87')];_0x1ff951['originalposition']=_0x1fdf8b[_0x0d9c('0x88')];_0x1ff951['queuecallerabandon']=!![];_0x1ff951[_0x0d9c('0x89')]=moment()['format'](_0x0d9c('0x7f'));_0x1ff951[_0x0d9c('0x5a')]=_0x0d9c('0x8a');_0x1ff951[_0x0d9c('0x8b')]=null;logger['info'](_0x0d9c('0x8c'),_0x1ff951[_0x0d9c('0x55')],_0x1ff951[_0x0d9c('0x5e')]);this[_0x0d9c('0x15')][_0x1fdf8b['uniqueid']]=_0x1ff951;this['emitVoiceQueueChannelRemove'](_0x1ff951,'queuecallerabandon');}}}catch(_0x59abe9){logger[_0x0d9c('0x49')](_0x0d9c('0x8d'),_0x1fdf8b[_0x0d9c('0x52')],util[_0x0d9c('0x47')](_0x59abe9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d9c('0xe')][_0x0d9c('0x27')]=function(_0x21bd71){try{if(this['isNotNull'](_0x21bd71)){logger[_0x0d9c('0x50')]('[%s][voiceQueueReport][queuecallerleave]',_0x21bd71[_0x0d9c('0x52')],util[_0x0d9c('0x47')](_0x21bd71,{'showHidden':![],'depth':null}));if(this[_0x0d9c('0x48')][_0x21bd71[_0x0d9c('0x52')]]){var _0x108c2b=_['last'](this[_0x0d9c('0x48')][_0x21bd71['uniqueid']]);_0x108c2b[_0x0d9c('0x8e')]=moment()[_0x0d9c('0x53')](_0x0d9c('0x7f'));_0x108c2b['connectedlinenum']=_0x21bd71[_0x0d9c('0x8f')];_0x108c2b[_0x0d9c('0x90')]=_0x21bd71[_0x0d9c('0x90')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x108c2b['queue'],_0x108c2b[_0x0d9c('0x5e')],_0x21bd71[_0x0d9c('0x8f')],_0x21bd71[_0x0d9c('0x90')]);this[_0x0d9c('0x15')][_0x21bd71[_0x0d9c('0x52')]]=_0x108c2b;this[_0x0d9c('0x4f')](_0x108c2b,_0x0d9c('0x26'));}}}catch(_0x1034c4){logger[_0x0d9c('0x49')](_0x0d9c('0x91'),_0x21bd71[_0x0d9c('0x52')],util[_0x0d9c('0x47')](_0x1034c4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d9c('0xe')][_0x0d9c('0x92')]=function(_0x537439){try{if(this[_0x0d9c('0x63')](_0x537439)){logger[_0x0d9c('0x50')]('[%s][voiceQueueReport][agentconnect]',_0x537439['uniqueid'],util[_0x0d9c('0x47')](_0x537439,{'showHidden':![],'depth':null}));if(this[_0x0d9c('0x48')][_0x537439[_0x0d9c('0x52')]]){var _0x20b338=_['last'](this[_0x0d9c('0x48')][_0x537439[_0x0d9c('0x52')]]);_0x20b338[_0x0d9c('0x3f')]=!![];_0x20b338['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x0d9c('0x82')](_0x0d9c('0x93'),_0x20b338[_0x0d9c('0x55')],_0x20b338[_0x0d9c('0x5e')]);}}}catch(_0x1045aa){logger['error'](_0x0d9c('0x94'),_0x537439['uniqueid'],util[_0x0d9c('0x47')](_0x1045aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0d9c('0x29')]=function(_0x50dfc8){try{if(this['isNotNull'](_0x50dfc8)){logger[_0x0d9c('0x50')](_0x0d9c('0x95'),_0x50dfc8[_0x0d9c('0x52')],util[_0x0d9c('0x47')](_0x50dfc8,{'showHidden':![],'depth':null}));if(this[_0x0d9c('0x48')][_0x50dfc8[_0x0d9c('0x52')]]){var _0x4502a8=_['last'](this[_0x0d9c('0x48')][_0x50dfc8[_0x0d9c('0x52')]]);_0x4502a8[_0x0d9c('0x24')]=![];_0x4502a8[_0x0d9c('0x89')]=null;_0x4502a8[_0x0d9c('0x96')]=!![];_0x4502a8[_0x0d9c('0x8b')]=_0x50dfc8[_0x0d9c('0x97')];_0x4502a8['holdtime']=_0x50dfc8[_0x0d9c('0x87')];_0x4502a8[_0x0d9c('0x3f')]=!![];_0x4502a8[_0x0d9c('0x3e')]=![];_0x4502a8[_0x0d9c('0x98')]=null;if(!_0x4502a8['transfer']){if(_0x50dfc8[_0x0d9c('0x99')]=='transfer'){_0x4502a8['queuecallerexitreason']=_0x0d9c('0x9a');logger[_0x0d9c('0x82')](_0x0d9c('0x9b'),_0x4502a8[_0x0d9c('0x55')],_0x4502a8[_0x0d9c('0x5e')]);}else{if(_[_0x0d9c('0x9c')](_0x50dfc8[_0x0d9c('0x43')][_0x0d9c('0x9d')](),_0x0d9c('0x9e'))){if(this[_0x0d9c('0x48')][_0x50dfc8['linkedid']]){var _0xb417fa=_[_0x0d9c('0x86')](this[_0x0d9c('0x48')][_0x50dfc8['linkedid']]);_0xb417fa[_0x0d9c('0x3f')]=![];_0xb417fa['queuecallerexit']=!![];_0xb417fa['queuecallerexitAt']=moment(_0x4502a8[_0x0d9c('0x7e')])[_0x0d9c('0x9f')](_0x50dfc8['holdtime'],'seconds')[_0x0d9c('0x53')](_0x0d9c('0x7f'));_0xb417fa['queuecallerexitreason']='FORWARDTRANSFER';_0xb417fa[_0x0d9c('0xa0')]=!![];_0xb417fa[_0x0d9c('0xa1')]='FORWARD';_0xb417fa[_0x0d9c('0xa2')]=_0x50dfc8[_0x0d9c('0xa3')];_0xb417fa[_0x0d9c('0xa4')]=_0x50dfc8[_0x0d9c('0x52')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xb417fa[_0x0d9c('0x55')],_0xb417fa[_0x0d9c('0x5e')]);var _0x1ca32b=this['queueReports'][_0x50dfc8['linkedid']];this[_0x0d9c('0x48')][_0x50dfc8['linkedid']]=this['queueReports'][_0x50dfc8[_0x0d9c('0x52')]];this['queueReports'][_0x50dfc8['uniqueid']]=_0x1ca32b;}}else{_0x4502a8['queuecallerexitreason']='COMPLETEDBY'+_0x50dfc8[_0x0d9c('0x99')]['toUpperCase']();logger['info'](_0x0d9c('0xa5'),_0x4502a8[_0x0d9c('0x55')],_0x4502a8[_0x0d9c('0x5e')],_0x4502a8[_0x0d9c('0x5a')]);}}}this[_0x0d9c('0x15')][_0x50dfc8['uniqueid']]=_0x4502a8;}}}catch(_0x3149f7){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x50dfc8[_0x0d9c('0x52')],util[_0x0d9c('0x47')](_0x3149f7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d9c('0xe')][_0x0d9c('0xa6')]=function(_0x5a3324){try{if(this[_0x0d9c('0x63')](_0x5a3324)){logger['debug'](_0x0d9c('0xa7'),_0x5a3324['uniqueid'],util['inspect'](_0x5a3324,{'showHidden':![],'depth':null}));this[_0x0d9c('0xa8')](_0x5a3324[_0x0d9c('0x52')],_[_0x0d9c('0x85')](_0x5a3324['variable'])[0x0],_0x5a3324[_0x0d9c('0xa9')]);if(this[_0x0d9c('0x48')][_0x5a3324['uniqueid']]){var _0x2c3964=_[_0x0d9c('0x86')](this[_0x0d9c('0x48')][_0x5a3324[_0x0d9c('0x52')]]);if(_0x2c3964){if(this[_0x0d9c('0x63')](_0x5a3324[_0x0d9c('0xaa')])&&this['isNotNull'](_0x5a3324[_0x0d9c('0xaa')][_0x0d9c('0x72')])){switch(_0x5a3324[_0x0d9c('0xa9')]){case _0x0d9c('0xab'):_0x2c3964[_0x0d9c('0x3e')]=![];_0x2c3964[_0x0d9c('0x98')]=null;break;case'TIMEOUT':_0x2c3964[_0x0d9c('0xac')]=_0x0d9c('0xad');_0x2c3964[_0x0d9c('0x3e')]=!![];_0x2c3964[_0x0d9c('0x98')]=moment()['format'](_0x0d9c('0x7f'));_0x2c3964[_0x0d9c('0x8e')]=moment()[_0x0d9c('0x53')](_0x0d9c('0x7f'));logger[_0x0d9c('0x50')](_0x0d9c('0xae'),_0x5a3324[_0x0d9c('0x52')],util['inspect'](_0x2c3964,{'showHidden':![],'depth':null}));ami[_0x0d9c('0x4e')](_0x0d9c('0xaf'),_0x2c3964);break;default:_0x2c3964[_0x0d9c('0x3e')]=!![];_0x2c3964[_0x0d9c('0x98')]=moment()[_0x0d9c('0x53')](_0x0d9c('0x7f'));_0x2c3964[_0x0d9c('0x8e')]=moment()[_0x0d9c('0x53')](_0x0d9c('0x7f'));}_0x2c3964[_0x0d9c('0x24')]=![];_0x2c3964[_0x0d9c('0x89')]=null;_0x2c3964[_0x0d9c('0x5a')]=_0x5a3324['value'];this[_0x0d9c('0x15')][_0x5a3324['uniqueid']]=_0x2c3964;this[_0x0d9c('0x58')](_0x2c3964,_0x0d9c('0x2b'));}else if(this['isNotNull'](_0x5a3324['variable'])&&this['isNotNull'](_0x5a3324['variable']['queueposition'])){if(!_0x2c3964[_0x0d9c('0x24')]){_0x2c3964[_0x0d9c('0x3e')]=!![];_0x2c3964[_0x0d9c('0x98')]=moment()['format'](_0x0d9c('0x7f'));_0x2c3964['queuecallerexitreason']=_0x0d9c('0xb0');_0x2c3964[_0x0d9c('0x8e')]=moment()[_0x0d9c('0x53')](_0x0d9c('0x7f'));this[_0x0d9c('0x15')][_0x5a3324[_0x0d9c('0x52')]]=_0x2c3964;}}logger['info'](_0x0d9c('0xb1'),_0x5a3324['uniqueid'],_0x2c3964['queue'],_0x2c3964[_0x0d9c('0x5e')],_['keys'](_0x5a3324[_0x0d9c('0xaa')])[0x0],_0x5a3324[_0x0d9c('0xa9')]);_0x2c3964[_0x0d9c('0x1a')]=this['variables'][_0x5a3324[_0x0d9c('0x52')]];}}}}catch(_0x26bf9c){logger[_0x0d9c('0x49')](_0x0d9c('0xa7'),_0x5a3324[_0x0d9c('0x52')],util[_0x0d9c('0x47')](_0x26bf9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0d9c('0xe')][_0x0d9c('0xa8')]=function(_0x525bea,_0x169746,_0x32a592){var _0x1b1ea5=[_0x0d9c('0xb2'),_0x0d9c('0xb3'),_0x0d9c('0xb4'),_0x0d9c('0xb5'),_0x0d9c('0xb6'),_0x0d9c('0xb7'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri',_0x0d9c('0xb8'),_0x0d9c('0xb9'),_0x0d9c('0xba'),'memberdynamic',_0x0d9c('0xbb'),'memberlastcall','membername',_0x0d9c('0xbc'),'memberrealtime'];if(!_[_0x0d9c('0x41')](_0x169746)&&!_['includes'](_0x1b1ea5,_0x169746)){if(_[_0x0d9c('0x7d')](this[_0x0d9c('0x1a')][_0x525bea])){this[_0x0d9c('0x1a')][_0x525bea]={};}this['variables'][_0x525bea][_0x169746]=_0x32a592;}};VoiceQueueReport[_0x0d9c('0xe')][_0x0d9c('0xbd')]=function(_0x345c93,_0x456d1e,_0x4ad3d5){try{var _0x108acc={};if(this[_0x0d9c('0x48')][_0x345c93]){for(var _0x2b6b62=0x0;_0x2b6b620x0?!![]:![];if(!_0x48e910){return this[_0xecfa('0x18')](this['summary']['completeEvent']);}};VoiceQueueReport[_0xecfa('0xa')][_0xecfa('0x1a')]=function(_0x32236f){var _0x4845b0=this[_0xecfa('0x13')]['id'];if(this[_0xecfa('0x13')]['queuestatus'][_0x4845b0]&&this[_0xecfa('0x13')][_0xecfa('0x5c')][_0x4845b0][_0x32236f['actionid']]){this[_0xecfa('0x13')]['queuestatus'][_0x4845b0][_0x32236f[_0xecfa('0x5d')]]['agents']['push'](_0x32236f);}};VoiceQueueReport['prototype'][_0xecfa('0x16')]=function(_0x2c665c){var _0x267208=this;try{if(this['isNotNull'](_0x2c665c)&&this['isNotNull'](_0x2c665c[_0xecfa('0x4a')])){logger[_0xecfa('0x46')](_0xecfa('0x68'),util[_0xecfa('0x3c')](_0x2c665c,{'showHidden':![],'depth':null}));var _0x3fe0a2=this[_0xecfa('0x11')][_0x2c665c['queue']];if(_0x3fe0a2){logger['debug'](_0xecfa('0x69'),_0x3fe0a2[_0xecfa('0x61')]);this['summary'][_0xecfa('0x59')][_0x3fe0a2['name']]={'summaryEvent':_0x2c665c};this[_0xecfa('0x13')][_0xecfa('0x67')]+=0x1;return ami[_0xecfa('0x38')]({'action':_0xecfa('0x5c'),'queue':_0x3fe0a2[_0xecfa('0x61')]})['then'](function(_0x497eee){if(!_0x267208['summary'][_0xecfa('0x5c')][_0x2c665c[_0xecfa('0x5d')]]){_0x267208[_0xecfa('0x13')]['queuestatus'][_0x2c665c[_0xecfa('0x5d')]]={};}_0x267208[_0xecfa('0x13')]['queuestatus'][_0x2c665c[_0xecfa('0x5d')]][_0x497eee['actionid']]={'queue':_0x3fe0a2[_0xecfa('0x61')],'agents':[]};})[_0xecfa('0x5e')](function(_0xe5d704){throw _0xe5d704;});}}}catch(_0x218844){logger[_0xecfa('0x3a')](_0xecfa('0x5f'),util[_0xecfa('0x3c')](_0x218844,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecfa('0xa')][_0xecfa('0x18')]=function(_0x5e1f2f){if(this[_0xecfa('0x13')][_0xecfa('0x67')]>0x0){this['summary'][_0xecfa('0x6a')]=_0x5e1f2f;return;}logger[_0xecfa('0x46')](_0xecfa('0x6b'),util['inspect'](_0x5e1f2f,{'showHidden':![],'depth':null}));this[_0xecfa('0x13')]=initializeSummary();ami[_0xecfa('0x44')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xecfa('0xa')][_0xecfa('0x6c')]=function(_0x51b699){try{if(this[_0xecfa('0x57')](_0x51b699)){logger[_0xecfa('0x46')](_0xecfa('0x6d'),_0x51b699[_0xecfa('0x49')],util['inspect'](_0x51b699,{'showHidden':![],'depth':null}));if(_[_0xecfa('0x58')](this[_0xecfa('0x3d')][_0x51b699[_0xecfa('0x49')]])){this[_0xecfa('0x3d')][_0x51b699[_0xecfa('0x49')]]=[];}if(_[_0xecfa('0x58')](this[_0xecfa('0x34')][_0x51b699[_0xecfa('0x49')]])){this[_0xecfa('0x34')][_0x51b699['uniqueid']]={};}var _0x1ff1ef=new QueueReport();_0x1ff1ef[_0xecfa('0x4a')]=_0x51b699[_0xecfa('0x4a')];_0x1ff1ef[_0xecfa('0x53')]=this[_0xecfa('0x11')][_0x1ff1ef[_0xecfa('0x4a')]]&&this['voiceQueues'][_0x1ff1ef[_0xecfa('0x4a')]][_0xecfa('0x53')]?this['voiceQueues'][_0x1ff1ef['queue']]['type']||'inbound':_0xecfa('0x54');_0x1ff1ef['queuecallerjoinAt']=moment()[_0xecfa('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ff1ef[_0xecfa('0x6e')]=_0x51b699['position'];_0x1ff1ef[_0xecfa('0x6f')]=_0x51b699['count'];_0x1ff1ef[_0xecfa('0x49')]=_0x51b699[_0xecfa('0x49')];_0x1ff1ef['routealias']=this[_0xecfa('0x34')][_0x51b699[_0xecfa('0x49')]][_0xecfa('0x70')];logger[_0xecfa('0x71')](_0xecfa('0x72'),_0x1ff1ef[_0xecfa('0x4a')],_0x1ff1ef[_0xecfa('0x53')]);Object[_0xecfa('0x73')](_0x1ff1ef,_[_0xecfa('0x74')](_0x51b699,_[_0xecfa('0x75')](_0x1ff1ef)));this[_0xecfa('0x3d')][_0x51b699['uniqueid']][_0xecfa('0x76')](_0x1ff1ef);this[_0xecfa('0x34')][_0x51b699[_0xecfa('0x49')]]=_0x1ff1ef;this['emitVoiceQueueChannelSave'](_0x1ff1ef,_0xecfa('0x1c'));}}catch(_0x518160){logger[_0xecfa('0x3a')](_0xecfa('0x6d'),_0x51b699[_0xecfa('0x49')],util[_0xecfa('0x3c')](_0x518160,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x2a5305){try{if(this[_0xecfa('0x57')](_0x2a5305)){logger[_0xecfa('0x46')](_0xecfa('0x77'),_0x2a5305[_0xecfa('0x49')],util[_0xecfa('0x3c')](_0x2a5305,{'showHidden':![],'depth':null}));if(this[_0xecfa('0x3d')][_0x2a5305[_0xecfa('0x49')]]){var _0x59dc2b=_[_0xecfa('0x78')](this[_0xecfa('0x3d')][_0x2a5305[_0xecfa('0x49')]]);_0x59dc2b[_0xecfa('0x32')]=![];_0x59dc2b[_0xecfa('0x79')]=null;_0x59dc2b[_0xecfa('0x7a')]=_0x2a5305[_0xecfa('0x7a')];_0x59dc2b[_0xecfa('0x7b')]=_0x2a5305[_0xecfa('0x7b')];_0x59dc2b[_0xecfa('0x1d')]=!![];_0x59dc2b[_0xecfa('0x7c')]=moment()[_0xecfa('0x4f')](_0xecfa('0x7d'));_0x59dc2b[_0xecfa('0x4d')]='ABANDONED';_0x59dc2b['lastAssignedTo']=null;logger[_0xecfa('0x71')](_0xecfa('0x7e'),_0x59dc2b[_0xecfa('0x4a')],_0x59dc2b['type']);this[_0xecfa('0x34')][_0x2a5305['uniqueid']]=_0x59dc2b;this[_0xecfa('0x42')](_0x59dc2b,'queuecallerabandon');}}}catch(_0x28e5c5){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x2a5305[_0xecfa('0x49')],util[_0xecfa('0x3c')](_0x28e5c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecfa('0xa')][_0xecfa('0x1f')]=function(_0x2e6ad1){try{if(this[_0xecfa('0x57')](_0x2e6ad1)){logger[_0xecfa('0x46')](_0xecfa('0x7f'),_0x2e6ad1[_0xecfa('0x49')],util[_0xecfa('0x3c')](_0x2e6ad1,{'showHidden':![],'depth':null}));if(this[_0xecfa('0x3d')][_0x2e6ad1['uniqueid']]){var _0x300d07=_[_0xecfa('0x78')](this[_0xecfa('0x3d')][_0x2e6ad1[_0xecfa('0x49')]]);_0x300d07[_0xecfa('0x80')]=moment()[_0xecfa('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x300d07[_0xecfa('0x81')]=_0x2e6ad1['connectedlinenum'];_0x300d07['connectedlinename']=_0x2e6ad1[_0xecfa('0x82')];logger['info'](_0xecfa('0x83'),_0x300d07[_0xecfa('0x4a')],_0x300d07['type'],_0x2e6ad1[_0xecfa('0x81')],_0x2e6ad1[_0xecfa('0x82')]);this[_0xecfa('0x34')][_0x2e6ad1[_0xecfa('0x49')]]=_0x300d07;this[_0xecfa('0x45')](_0x300d07,_0xecfa('0x84'));}}}catch(_0x3783eb){logger[_0xecfa('0x3a')](_0xecfa('0x7f'),_0x2e6ad1['uniqueid'],util['inspect'](_0x3783eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecfa('0xa')]['syncAgentConnect']=function(_0x1c73f5){try{if(this[_0xecfa('0x57')](_0x1c73f5)){logger[_0xecfa('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x1c73f5[_0xecfa('0x49')],util[_0xecfa('0x3c')](_0x1c73f5,{'showHidden':![],'depth':null}));if(this[_0xecfa('0x3d')][_0x1c73f5[_0xecfa('0x49')]]){var _0x1baa23=_[_0xecfa('0x78')](this['queueReports'][_0x1c73f5[_0xecfa('0x49')]]);_0x1baa23[_0xecfa('0x32')]=!![];_0x1baa23[_0xecfa('0x4d')]=_0xecfa('0x85');logger[_0xecfa('0x71')](_0xecfa('0x86'),_0x1baa23[_0xecfa('0x4a')],_0x1baa23['type']);}}}catch(_0x40fefd){logger[_0xecfa('0x3a')](_0xecfa('0x87'),_0x1c73f5[_0xecfa('0x49')],util[_0xecfa('0x3c')](_0x40fefd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecfa('0xa')][_0xecfa('0x88')]=function(_0x7245f6){try{if(this[_0xecfa('0x57')](_0x7245f6)){logger[_0xecfa('0x46')](_0xecfa('0x89'),_0x7245f6['uniqueid'],util[_0xecfa('0x3c')](_0x7245f6,{'showHidden':![],'depth':null}));if(this[_0xecfa('0x3d')][_0x7245f6[_0xecfa('0x49')]]){var _0x2252a6=_['last'](this['queueReports'][_0x7245f6[_0xecfa('0x49')]]);_0x2252a6[_0xecfa('0x1d')]=![];_0x2252a6[_0xecfa('0x7c')]=null;_0x2252a6[_0xecfa('0x8a')]=!![];_0x2252a6[_0xecfa('0x8b')]=_0x7245f6['membername'];_0x2252a6[_0xecfa('0x7a')]=_0x7245f6['holdtime'];_0x2252a6['queuecallercomplete']=!![];_0x2252a6[_0xecfa('0x31')]=![];_0x2252a6[_0xecfa('0x8c')]=null;if(!_0x2252a6['transfer']){if(_0x7245f6[_0xecfa('0x8d')]==_0xecfa('0x8e')){_0x2252a6[_0xecfa('0x4d')]=_0xecfa('0x8f');logger['info'](_0xecfa('0x90'),_0x2252a6['queue'],_0x2252a6[_0xecfa('0x53')]);}else{if(_[_0xecfa('0x91')](_0x7245f6[_0xecfa('0x92')][_0xecfa('0x93')](),_0xecfa('0x94'))){if(this['queueReports'][_0x7245f6['linkedid']]){var _0x171b3e=_[_0xecfa('0x78')](this['queueReports'][_0x7245f6[_0xecfa('0x95')]]);_0x171b3e['queuecallercomplete']=![];_0x171b3e[_0xecfa('0x31')]=!![];_0x171b3e['queuecallerexitAt']=moment(_0x2252a6['queuecallerjoinAt'])[_0xecfa('0x96')](_0x7245f6[_0xecfa('0x7a')],_0xecfa('0x97'))[_0xecfa('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x171b3e['queuecallerexitreason']='FORWARDTRANSFER';_0x171b3e[_0xecfa('0x8e')]=!![];_0x171b3e['transfertype']=_0xecfa('0x98');_0x171b3e[_0xecfa('0x99')]=_0x7245f6[_0xecfa('0x9a')];_0x171b3e[_0xecfa('0x9b')]=_0x7245f6[_0xecfa('0x49')];logger['info'](_0xecfa('0x9c'),_0x171b3e[_0xecfa('0x4a')],_0x171b3e[_0xecfa('0x53')]);var _0x1de037=this['queueReports'][_0x7245f6[_0xecfa('0x95')]];this[_0xecfa('0x3d')][_0x7245f6['linkedid']]=this['queueReports'][_0x7245f6[_0xecfa('0x49')]];this[_0xecfa('0x3d')][_0x7245f6[_0xecfa('0x49')]]=_0x1de037;}}else{_0x2252a6['queuecallerexitreason']=_0xecfa('0x9d')+_0x7245f6['reason'][_0xecfa('0x9e')]();logger[_0xecfa('0x71')](_0xecfa('0x9f'),_0x2252a6[_0xecfa('0x4a')],_0x2252a6['type'],_0x2252a6[_0xecfa('0x4d')]);}}}this['channels'][_0x7245f6[_0xecfa('0x49')]]=_0x2252a6;}}}catch(_0xf9a6d5){logger[_0xecfa('0x3a')](_0xecfa('0x89'),_0x7245f6[_0xecfa('0x49')],util['inspect'](_0xf9a6d5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecfa('0xa')][_0xecfa('0xa0')]=function(_0x171ff0){try{if(this[_0xecfa('0x57')](_0x171ff0)){logger['debug'](_0xecfa('0xa1'),_0x171ff0[_0xecfa('0x49')],util['inspect'](_0x171ff0,{'showHidden':![],'depth':null}));this[_0xecfa('0xa2')](_0x171ff0[_0xecfa('0x49')],_['keys'](_0x171ff0[_0xecfa('0xa3')])[0x0],_0x171ff0['value']);if(this[_0xecfa('0x3d')][_0x171ff0['uniqueid']]){var _0x2893dd=_[_0xecfa('0x78')](this['queueReports'][_0x171ff0[_0xecfa('0x49')]]);if(_0x2893dd){if(this[_0xecfa('0x57')](_0x171ff0[_0xecfa('0xa3')])&&this['isNotNull'](_0x171ff0[_0xecfa('0xa3')][_0xecfa('0x5c')])){switch(_0x171ff0[_0xecfa('0xa4')]){case _0xecfa('0xa5'):_0x2893dd['queuecallerexit']=![];_0x2893dd['queuecallerexitAt']=null;break;case _0xecfa('0xa6'):_0x2893dd[_0xecfa('0xa7')]='timeout';_0x2893dd['queuecallerexit']=!![];_0x2893dd['queuecallerexitAt']=moment()[_0xecfa('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2893dd[_0xecfa('0x80')]=moment()[_0xecfa('0x4f')](_0xecfa('0x7d'));logger[_0xecfa('0x46')](_0xecfa('0xa8'),_0x171ff0[_0xecfa('0x49')],util[_0xecfa('0x3c')](_0x2893dd,{'showHidden':![],'depth':null}));ami['emit'](_0xecfa('0xa9'),_0x2893dd);break;default:_0x2893dd[_0xecfa('0x31')]=!![];_0x2893dd[_0xecfa('0x8c')]=moment()[_0xecfa('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2893dd[_0xecfa('0x80')]=moment()['format'](_0xecfa('0x7d'));}_0x2893dd['queuecallerabandon']=![];_0x2893dd['queuecallerabandonAt']=null;_0x2893dd['queuecallerexitreason']=_0x171ff0[_0xecfa('0xa4')];this[_0xecfa('0x34')][_0x171ff0[_0xecfa('0x49')]]=_0x2893dd;this[_0xecfa('0x42')](_0x2893dd,_0xecfa('0xaa'));}else if(this[_0xecfa('0x57')](_0x171ff0[_0xecfa('0xa3')])&&this[_0xecfa('0x57')](_0x171ff0['variable']['queueposition'])){if(!_0x2893dd[_0xecfa('0x1d')]){_0x2893dd[_0xecfa('0x31')]=!![];_0x2893dd['queuecallerexitAt']=moment()[_0xecfa('0x4f')](_0xecfa('0x7d'));_0x2893dd[_0xecfa('0x4d')]=_0xecfa('0xab');_0x2893dd[_0xecfa('0x80')]=moment()[_0xecfa('0x4f')](_0xecfa('0x7d'));this[_0xecfa('0x34')][_0x171ff0['uniqueid']]=_0x2893dd;}}logger[_0xecfa('0x71')](_0xecfa('0xac'),_0x171ff0['uniqueid'],_0x2893dd[_0xecfa('0x4a')],_0x2893dd[_0xecfa('0x53')],_[_0xecfa('0x75')](_0x171ff0[_0xecfa('0xa3')])[0x0],_0x171ff0[_0xecfa('0xa4')]);_0x2893dd[_0xecfa('0x14')]=this[_0xecfa('0x14')][_0x171ff0['uniqueid']];}}}}catch(_0x90ee60){logger[_0xecfa('0x3a')](_0xecfa('0xa1'),_0x171ff0['uniqueid'],util[_0xecfa('0x3c')](_0x90ee60,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xecfa('0xa2')]=function(_0x18442b,_0x3bf242,_0x5e87fa){var _0x34b9a4=['rtpaudioqos',_0xecfa('0xad'),_0xecfa('0xae'),_0xecfa('0xaf'),_0xecfa('0xb0'),_0xecfa('0xb1'),_0xecfa('0xb2'),_0xecfa('0xb3'),_0xecfa('0xb4'),'sipuri',_0xecfa('0xb5'),_0xecfa('0xb6'),_0xecfa('0xb7'),_0xecfa('0xb8'),_0xecfa('0xb9'),'memberlastcall',_0xecfa('0xba'),'memberpenalty',_0xecfa('0xbb')];if(!_[_0xecfa('0x37')](_0x3bf242)&&!_[_0xecfa('0xbc')](_0x34b9a4,_0x3bf242)){if(_[_0xecfa('0x58')](this[_0xecfa('0x14')][_0x18442b])){this['variables'][_0x18442b]={};}this[_0xecfa('0x14')][_0x18442b][_0x3bf242]=_0x5e87fa;}};VoiceQueueReport['prototype'][_0xecfa('0xbd')]=function(_0x4c8154,_0x33bd64,_0x3b4461){try{var _0x135deb={};if(this[_0xecfa('0x3d')][_0x4c8154]){for(var _0x450bc3=0x0;_0x450bc3=0x0?moment(_0x1563eb[_0xd484('0x19')])[_0xd484('0xd')](_0x1563eb[_0xd484('0x1a')],'seconds'):null,'data1':'outbound','data2':_0x1563eb[_0xd484('0x14')],'data3':_0x1563eb[_0xd484('0x12')],'data4':_0x1563eb[_0xd484('0x1b')]||null,'role':_0xd484('0x13'),'internal':_0x1563eb['accountcode']?_[_0xd484('0x15')](_0x1563eb[_0xd484('0x14')]):undefined,'uniqueid':_0x1563eb[_0xd484('0x16')]},'log':_0xd484('0x6')});}; \ No newline at end of file +var _0x7fbb=['../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','agent','accountcode','toNumber','uniqueid','membername','starttime','outbound','exten','lodash','util'];(function(_0xaa31a1,_0x44e424){var _0x437cc7=function(_0x317df8){while(--_0x317df8){_0xaa31a1['push'](_0xaa31a1['shift']());}};_0x437cc7(++_0x44e424);}(_0x7fbb,0xc2));var _0xb7fb=function(_0x56ac56,_0x23cd16){_0x56ac56=_0x56ac56-0x0;var _0x17dc18=_0x7fbb[_0x56ac56];return _0x17dc18;};'use strict';var moment=require('moment');var _=require(_0xb7fb('0x0'));var util=require(_0xb7fb('0x1'));var client=require(_0xb7fb('0x2'));exports[_0xb7fb('0x3')]=function(_0x255298){var _0x4d8d5f=_0x255298[_0xb7fb('0x4')]||_0x255298[_0xb7fb('0x5')];return client[_0xb7fb('0x6')](_0xb7fb('0x7'),{'body':{'channel':_0xb7fb('0x8'),'membername':_0x255298['lastAssignedTo'],'interface':_[_0xb7fb('0x9')](_0x255298[_0xb7fb('0xa')])?util[_0xb7fb('0xb')](_0xb7fb('0xc'),_0x255298[_0xb7fb('0xd')]):_0x255298[_0xb7fb('0xa')],'type':_0xb7fb('0xe'),'enterAt':_0x255298[_0xb7fb('0xf')],'exitAt':_0x4d8d5f,'duration':moment(_0x4d8d5f)[_0xb7fb('0x10')](_0x255298[_0xb7fb('0xf')],_0xb7fb('0x11')),'data1':_0xb7fb('0x12'),'data2':_0x255298[_0xb7fb('0x13')],'data3':_0x255298['exten'],'data4':null,'data5':_0x255298['queue'],'role':_0xb7fb('0x14'),'internal':_0x255298[_0xb7fb('0x15')]?_[_0xb7fb('0x16')](_0x255298[_0xb7fb('0x15')]):undefined,'uniqueid':_0x255298[_0xb7fb('0x17')]},'log':_0xb7fb('0x7')});};exports['voiceDialReport']=function(_0x2d262f){return client[_0xb7fb('0x6')](_0xb7fb('0x7'),{'body':{'channel':'voice','membername':_0x2d262f[_0xb7fb('0x18')],'interface':_0x2d262f[_0xb7fb('0xa')],'type':_0xb7fb('0xe'),'enterAt':_0x2d262f[_0xb7fb('0x19')],'exitAt':_0x2d262f['endtime'],'duration':moment(_0x2d262f['endtime'])[_0xb7fb('0x10')](_0x2d262f[_0xb7fb('0x19')],'seconds')>=0x0?moment(_0x2d262f['endtime'])[_0xb7fb('0x10')](_0x2d262f['starttime'],_0xb7fb('0x11')):null,'data1':_0xb7fb('0x1a'),'data2':_0x2d262f[_0xb7fb('0x15')],'data3':_0x2d262f[_0xb7fb('0x1b')],'data4':_0x2d262f['dialstring']||null,'role':_0xb7fb('0x14'),'internal':_0x2d262f['accountcode']?_[_0xb7fb('0x16')](_0x2d262f[_0xb7fb('0x15')]):undefined,'uniqueid':_0x2d262f['uniqueid']},'log':_0xb7fb('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index a5fe73a..46f4985 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 _0x7916=['GetSettings','../client','Request','ShowSetting','previewRecallmeReminderInterval'];(function(_0x168057,_0x18fae0){var _0x470c2f=function(_0x540df1){while(--_0x540df1){_0x168057['push'](_0x168057['shift']());}};_0x470c2f(++_0x18fae0);}(_0x7916,0x128));var _0x6791=function(_0x545b65,_0x314672){_0x545b65=_0x545b65-0x0;var _0x4cd3b0=_0x7916[_0x545b65];return _0x4cd3b0;};'use strict';var client=require(_0x6791('0x0'));exports['getSettings']=function(){return client[_0x6791('0x1')](_0x6791('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x6791('0x3')]},'log':_0x6791('0x4')});}; \ No newline at end of file +var _0x83d4=['previewRecallmeReminderInterval','../client','ShowSetting'];(function(_0x1f7c09,_0xe3dc0d){var _0x5a3eee=function(_0x1c2309){while(--_0x1c2309){_0x1f7c09['push'](_0x1f7c09['shift']());}};_0x5a3eee(++_0xe3dc0d);}(_0x83d4,0xf1));var _0x483d=function(_0xcc0203,_0x5a4073){_0xcc0203=_0xcc0203-0x0;var _0x2c0c1b=_0x83d4[_0xcc0203];return _0x2c0c1b;};'use strict';var client=require(_0x483d('0x0'));exports['getSettings']=function(){return client['Request'](_0x483d('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x483d('0x2')]},'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 aaf14c7..357e2aa 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 _0x4dfc=['name','html','Request','GetTemplate'];(function(_0x485ebb,_0x43ebf2){var _0x16aac8=function(_0x4b48e0){while(--_0x4b48e0){_0x485ebb['push'](_0x485ebb['shift']());}};_0x16aac8(++_0x43ebf2);}(_0x4dfc,0xda));var _0xc4df=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x4dfc[_0x413aac];return _0x569b11;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4edcd3){return function(_0x4114c8){return client[_0xc4df('0x0')](_0xc4df('0x1'),{'options':{'raw':!![],'attributes':['id',_0xc4df('0x2'),_0xc4df('0x3')]},'log':_0xc4df('0x1')});};}; \ No newline at end of file +var _0xcb10=['../client','getTemplates','Request','name','GetTemplate'];(function(_0xd9ce1,_0x517167){var _0x54be53=function(_0x27a6bd){while(--_0x27a6bd){_0xd9ce1['push'](_0xd9ce1['shift']());}};_0x54be53(++_0x517167);}(_0xcb10,0x104));var _0x0cb1=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xcb10[_0x42bdad];return _0x122626;};'use strict';var client=require(_0x0cb1('0x0'));exports[_0x0cb1('0x1')]=function(_0x568ead){return function(_0x8e770b){return client[_0x0cb1('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x0cb1('0x3'),'html']},'log':_0x0cb1('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 40bbe9f..35e4b24 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 _0xea7d=['GetTrigger','channel','status','Condition','AllConditions','value','AnyConditions','field','operator','Action','Actions','action','data1','data2','data3','data5','data6','data7','../client','Request'];(function(_0x2fe4b5,_0x439480){var _0x2b9c0b=function(_0x5bfca9){while(--_0x5bfca9){_0x2fe4b5['push'](_0x2fe4b5['shift']());}};_0x2b9c0b(++_0x439480);}(_0xea7d,0xb2));var _0xdea7=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xea7d[_0x810e4d];return _0x13f01c;};'use strict';var client=require(_0xdea7('0x0'));exports['getTriggers']=function(_0x2bfbd3){return function(_0x434754){return client[_0xdea7('0x1')](_0xdea7('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xdea7('0x3'),_0xdea7('0x4')],'include':[{'model':_0xdea7('0x5'),'as':_0xdea7('0x6'),'attributes':['id','field','operator',_0xdea7('0x7')]},{'model':'Condition','as':_0xdea7('0x8'),'attributes':['id',_0xdea7('0x9'),_0xdea7('0xa'),'value']},{'model':_0xdea7('0xb'),'as':_0xdea7('0xc'),'attributes':['id',_0xdea7('0xd'),_0xdea7('0xe'),_0xdea7('0xf'),_0xdea7('0x10'),'data4',_0xdea7('0x11'),_0xdea7('0x12'),_0xdea7('0x13')]}]},'log':_0xdea7('0x2')});};}; \ No newline at end of file +var _0xa736=['data4','data5','getTriggers','Request','GetTrigger','channel','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2'];(function(_0x4ca3e2,_0x5ba485){var _0x5ed6a4=function(_0xd220b8){while(--_0xd220b8){_0x4ca3e2['push'](_0x4ca3e2['shift']());}};_0x5ed6a4(++_0x5ba485);}(_0xa736,0x178));var _0x6a73=function(_0x564795,_0x1091a4){_0x564795=_0x564795-0x0;var _0x4d9b93=_0xa736[_0x564795];return _0x4d9b93;};'use strict';var client=require('../client');exports[_0x6a73('0x0')]=function(_0x56ef8c){return function(_0xec203c){return client[_0x6a73('0x1')](_0x6a73('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6a73('0x3'),_0x6a73('0x4')],'include':[{'model':_0x6a73('0x5'),'as':'AllConditions','attributes':['id',_0x6a73('0x6'),_0x6a73('0x7'),_0x6a73('0x8')]},{'model':_0x6a73('0x5'),'as':_0x6a73('0x9'),'attributes':['id',_0x6a73('0x6'),'operator',_0x6a73('0x8')]},{'model':_0x6a73('0xa'),'as':_0x6a73('0xb'),'attributes':['id',_0x6a73('0xc'),_0x6a73('0xd'),_0x6a73('0xe'),'data3',_0x6a73('0xf'),_0x6a73('0x10'),'data6','data7']}]},'log':_0x6a73('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 11812f2..1cebb79 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 _0x26ac=['defaultuser','getTrunks','name'];(function(_0x2e53fe,_0x3c5c05){var _0x41ad1e=function(_0x10aaa4){while(--_0x10aaa4){_0x2e53fe['push'](_0x2e53fe['shift']());}};_0x41ad1e(++_0x3c5c05);}(_0x26ac,0x106));var _0xc26a=function(_0x2f94fd,_0x367f2c){_0x2f94fd=_0x2f94fd-0x0;var _0x223222=_0x26ac[_0x2f94fd];return _0x223222;};'use strict';var client=require('../client');exports[_0xc26a('0x0')]=function(_0x1c0665){return function(_0x4c8a2a){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc26a('0x1'),'registry',_0xc26a('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x3b18=['Request','GetTrunk','registry','defaultuser'];(function(_0x39c4ea,_0x1bb06b){var _0x45866a=function(_0x195437){while(--_0x195437){_0x39c4ea['push'](_0x39c4ea['shift']());}};_0x45866a(++_0x1bb06b);}(_0x3b18,0x1d4));var _0x83b1=function(_0x23f9a7,_0xb795c){_0x23f9a7=_0x23f9a7-0x0;var _0x4e0776=_0x3b18[_0x23f9a7];return _0x4e0776;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x51c3f9){return function(_0x3129f4){return client[_0x83b1('0x0')](_0x83b1('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x83b1('0x2'),_0x83b1('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 671de6e..90f436f 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x2801d8,_0x1ac46a){var _0x8ce80c=function(_0x3eb6b2){while(--_0x3eb6b2){_0x2801d8['push'](_0x2801d8['shift']());}};_0x8ce80c(++_0x1ac46a);}(_0x34e8,0x12c));var _0x834e=function(_0x2b1afa,_0x511a6d){_0x2b1afa=_0x2b1afa-0x0;var _0xa90a17=_0x34e8[_0x2b1afa];return _0xa90a17;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe706,0xa3));var _0x6e70=function(_0x2a5f37,_0x34adf4){_0x2a5f37=_0x2a5f37-0x0;var _0x37789a=_0xe706[_0x2a5f37];return _0x37789a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a5840b2..ce045f2 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 _0x9d01=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x111bd0,_0x34bf7b){var _0x30edfa=function(_0x31e4f9){while(--_0x31e4f9){_0x111bd0['push'](_0x111bd0['shift']());}};_0x30edfa(++_0x34bf7b);}(_0x9d01,0x19a));var _0x19d0=function(_0x131fb3,_0x257913){_0x131fb3=_0x131fb3-0x0;var _0x4c08be=_0x9d01[_0x131fb3];return _0x4c08be;};'use strict';var client=require(_0x19d0('0x0'));exports[_0x19d0('0x1')]=function(_0x483c14){return client['Request'](_0x19d0('0x2'),{'body':_0x483c14,'log':_0x19d0('0x2')});};exports[_0x19d0('0x3')]=function(_0xca12e2,_0x4f9fa1,_0x50e8b3){return client[_0x19d0('0x4')](_0x19d0('0x5'),{'body':_0xca12e2,'options':{'where':{'uniqueid':_0x4f9fa1,'interface':_0x50e8b3,'agentcomplete':!![]}},'log':_0x19d0('0x5')});}; \ No newline at end of file +var _0x7ec6=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x251fa4,_0x3d5860){var _0x453047=function(_0x337a6f){while(--_0x337a6f){_0x251fa4['push'](_0x251fa4['shift']());}};_0x453047(++_0x3d5860);}(_0x7ec6,0x151));var _0x67ec=function(_0x22048f,_0x21a347){_0x22048f=_0x22048f-0x0;var _0x1570dd=_0x7ec6[_0x22048f];return _0x1570dd;};'use strict';var client=require(_0x67ec('0x0'));exports[_0x67ec('0x1')]=function(_0x1bd24f){return client['Request'](_0x67ec('0x2'),{'body':_0x1bd24f,'log':'CreateVoiceAgentReport'});};exports[_0x67ec('0x3')]=function(_0x366ff8,_0x51d3b2,_0x436055){return client[_0x67ec('0x4')](_0x67ec('0x5'),{'body':_0x366ff8,'options':{'where':{'uniqueid':_0x51d3b2,'interface':_0x436055,'agentcomplete':!![]}},'log':_0x67ec('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 8821196..5568570 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 _0x7f26=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport'];(function(_0x31930c,_0x482a58){var _0x24a041=function(_0x33e98f){while(--_0x33e98f){_0x31930c['push'](_0x31930c['shift']());}};_0x24a041(++_0x482a58);}(_0x7f26,0x1ed));var _0x67f2=function(_0x38abc0,_0x24ca9a){_0x38abc0=_0x38abc0-0x0;var _0x2227cc=_0x7f26[_0x38abc0];return _0x2227cc;};'use strict';var moment=require(_0x67f2('0x0'));var util=require(_0x67f2('0x1'));var _=require(_0x67f2('0x2'));var client=require(_0x67f2('0x3'));exports[_0x67f2('0x4')]=function(_0x2969e4){return client['Request']('CreateVoiceCallReport',{'body':_[_0x67f2('0x5')](_0x2969e4,{'source':_0x2969e4[_0x67f2('0x6')],'destinationcontext':_0x2969e4[_0x67f2('0x7')],'callerid':_0x2969e4[_0x67f2('0x8')],'amaflags':_0x67f2('0x9')}),'log':_0x67f2('0xa')});};exports[_0x67f2('0xb')]=function(){return function(){return client['Request'](_0x67f2('0xc'),{'options':{'where':{'type':[_0x67f2('0xd')],'createdAt':{'$between':[moment()[_0x67f2('0xe')](_0x67f2('0xf'))[_0x67f2('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x67f2('0xf'))['format'](_0x67f2('0x11'))]}},'attributes':[_0x67f2('0x12'),_0x67f2('0x13'),_0x67f2('0x14'),_0x67f2('0x15')]},'log':_0x67f2('0x16')});};}; \ No newline at end of file +var _0x2ce3=['type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x47e6db,_0x39e83e){var _0x38a53d=function(_0x2f11f5){while(--_0x2f11f5){_0x47e6db['push'](_0x47e6db['shift']());}};_0x38a53d(++_0x39e83e);}(_0x2ce3,0x14e));var _0x32ce=function(_0x24f894,_0x2e838b){_0x24f894=_0x24f894-0x0;var _0x36e466=_0x2ce3[_0x24f894];return _0x36e466;};'use strict';var moment=require(_0x32ce('0x0'));var util=require(_0x32ce('0x1'));var _=require(_0x32ce('0x2'));var client=require(_0x32ce('0x3'));exports[_0x32ce('0x4')]=function(_0x2b8a92){return client[_0x32ce('0x5')](_0x32ce('0x6'),{'body':_[_0x32ce('0x7')](_0x2b8a92,{'source':_0x2b8a92['calleridnum'],'destinationcontext':_0x2b8a92[_0x32ce('0x8')],'callerid':_0x2b8a92['callerid'],'amaflags':_0x32ce('0x9')}),'log':_0x32ce('0x6')});};exports[_0x32ce('0xa')]=function(){return function(){return client[_0x32ce('0x5')](_0x32ce('0xb'),{'options':{'where':{'type':[_0x32ce('0xc')],'createdAt':{'$between':[moment()[_0x32ce('0xd')](_0x32ce('0xe'))[_0x32ce('0xf')](_0x32ce('0x10')),moment()[_0x32ce('0x11')](_0x32ce('0xe'))[_0x32ce('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x32ce('0x12'),_0x32ce('0x13'),'duration',_0x32ce('0x14')]},'log':_0x32ce('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 7fc52da..6c82d2f 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 _0x3a64=['create','CreateVoiceDialReport','../client'];(function(_0xb399d5,_0x39a1c8){var _0x4f80d6=function(_0x3140c1){while(--_0x3140c1){_0xb399d5['push'](_0xb399d5['shift']());}};_0x4f80d6(++_0x39a1c8);}(_0x3a64,0x68));var _0x43a6=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x3a64[_0xb24a3e];return _0x4038d7;};'use strict';var client=require(_0x43a6('0x0'));exports[_0x43a6('0x1')]=function(_0x411a5c){return client['Request'](_0x43a6('0x2'),{'body':_0x411a5c,'log':_0x43a6('0x2')});}; \ No newline at end of file +var _0x21de=['Request','../client','create'];(function(_0x3e16ff,_0x18aab9){var _0x3a057d=function(_0x5c0bd0){while(--_0x5c0bd0){_0x3e16ff['push'](_0x3e16ff['shift']());}};_0x3a057d(++_0x18aab9);}(_0x21de,0xb8));var _0xe21d=function(_0x1f2644,_0x5acc2b){_0x1f2644=_0x1f2644-0x0;var _0x1f06ae=_0x21de[_0x1f2644];return _0x1f06ae;};'use strict';var client=require(_0xe21d('0x0'));exports[_0xe21d('0x1')]=function(_0x36cbfb){return client[_0xe21d('0x2')]('CreateVoiceDialReport',{'body':_0x36cbfb,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b38896c..07543f3 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 _0xa249=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x435e5c,_0x4cd325){var _0x55c174=function(_0x233e87){while(--_0x233e87){_0x435e5c['push'](_0x435e5c['shift']());}};_0x55c174(++_0x4cd325);}(_0xa249,0x183));var _0x9a24=function(_0x298100,_0x2f09f0){_0x298100=_0x298100-0x0;var _0x5eb98a=_0xa249[_0x298100];return _0x5eb98a;};'use strict';var client=require(_0x9a24('0x0'));exports[_0x9a24('0x1')]=function(){return function(){return client['Request'](_0x9a24('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9a24('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x9a24('0x1')});};}; \ No newline at end of file +var _0x04b8=['getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x36988b,_0x4fd583){var _0xd6bd=function(_0x15588e){while(--_0x15588e){_0x36988b['push'](_0x36988b['shift']());}};_0xd6bd(++_0x4fd583);}(_0x04b8,0x159));var _0x804b=function(_0x4711fc,_0x31742c){_0x4711fc=_0x4711fc-0x0;var _0x4c1eaf=_0x04b8[_0x4711fc];return _0x4c1eaf;};'use strict';var client=require('../client');exports[_0x804b('0x0')]=function(){return function(){return client['Request'](_0x804b('0x1'),{'options':{'raw':!![],'attributes':['id',_0x804b('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x804b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9e9e831..3296715 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 _0x0f45=['Trunk','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','active','Pause'];(function(_0xac972b,_0x5c17a7){var _0xa2cee4=function(_0x59ccc9){while(--_0x59ccc9){_0xac972b['push'](_0xac972b['shift']());}};_0xa2cee4(++_0x5c17a7);}(_0x0f45,0x7f));var _0x50f4=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x0f45[_0x44bcb0];return _0xfaf881;};'use strict';var client=require(_0x50f4('0x0'));exports[_0x50f4('0x1')]=function(){return function(){return client[_0x50f4('0x2')](_0x50f4('0x3'),{'options':{'raw':![],'attributes':['id',_0x50f4('0x4'),_0x50f4('0x5'),'acwTimeout',_0x50f4('0x6'),'monitor_format',_0x50f4('0x7'),'dialActive',_0x50f4('0x8'),'dialLimitChannel',_0x50f4('0x9'),_0x50f4('0xa'),_0x50f4('0xb'),_0x50f4('0xc'),_0x50f4('0xd'),_0x50f4('0xe'),'dialOriginateCallerIdNumber',_0x50f4('0xf'),_0x50f4('0x10'),_0x50f4('0x11'),'dialQueueProject','dialCongestionMaxRetry',_0x50f4('0x12'),_0x50f4('0x13'),_0x50f4('0x14'),_0x50f4('0x15'),'dialNoAnswerRetryFrequency',_0x50f4('0x16'),'dialTimezone',_0x50f4('0x17'),_0x50f4('0x18'),_0x50f4('0x19'),_0x50f4('0x1a'),_0x50f4('0x1b'),_0x50f4('0x1c'),'dialAMDAfterGreetingSilence',_0x50f4('0x1d'),_0x50f4('0x1e'),_0x50f4('0x1f'),'dialAMDMaximumNumberOfWords',_0x50f4('0x20'),_0x50f4('0x21'),'timeout',_0x50f4('0x22'),'dialRecallInQueue',_0x50f4('0x23'),_0x50f4('0x24'),'dialAgiAfterHangupClient',_0x50f4('0x25'),_0x50f4('0x26'),_0x50f4('0x27'),'dialRandomLastDigitCallerIdNumber',_0x50f4('0x28'),_0x50f4('0x29'),_0x50f4('0x2a'),_0x50f4('0x2b'),_0x50f4('0x2c'),_0x50f4('0x2d'),'dialAbandonedRetryFrequency',_0x50f4('0x2e'),_0x50f4('0x2f'),_0x50f4('0x30'),_0x50f4('0x31'),_0x50f4('0x32'),'dialPredictiveIntervalMaxThreshold',_0x50f4('0x33'),_0x50f4('0x34'),_0x50f4('0x35')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x50f4('0x4'),'callerid',_0x50f4('0x36')]},{'model':_0x50f4('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x50f4('0x4')]},{'model':_0x50f4('0x38'),'as':_0x50f4('0x39'),'attributes':['id',_0x50f4('0x4'),'callerid',_0x50f4('0x36')]},{'model':_0x50f4('0x3a'),'as':_0x50f4('0x3a'),'attributes':['id',_0x50f4('0x4')],'include':[{'model':_0x50f4('0x3a'),'as':_0x50f4('0x3b'),'attributes':['id',_0x50f4('0x4'),_0x50f4('0x3c')]}]}]},'log':_0x50f4('0x1')});};}; \ No newline at end of file +var _0xab2d=['dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive'];(function(_0x10c043,_0xf3fec){var _0x966819=function(_0x2d6af4){while(--_0x2d6af4){_0x10c043['push'](_0x10c043['shift']());}};_0x966819(++_0xf3fec);}(_0xab2d,0x177));var _0xdab2=function(_0x5e6610,_0x37ea6c){_0x5e6610=_0x5e6610-0x0;var _0x10dae4=_0xab2d[_0x5e6610];return _0x10dae4;};'use strict';var client=require(_0xdab2('0x0'));exports[_0xdab2('0x1')]=function(){return function(){return client['Request'](_0xdab2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdab2('0x3'),_0xdab2('0x4'),_0xdab2('0x5'),_0xdab2('0x6'),'monitor_format',_0xdab2('0x7'),_0xdab2('0x8'),_0xdab2('0x9'),_0xdab2('0xa'),_0xdab2('0xb'),_0xdab2('0xc'),'dialPredictiveOptimization',_0xdab2('0xd'),'dialPredictiveInterval',_0xdab2('0xe'),'dialOriginateCallerIdNumber',_0xdab2('0xf'),'dialQueueOptions',_0xdab2('0x10'),'dialQueueProject','dialCongestionMaxRetry',_0xdab2('0x11'),_0xdab2('0x12'),_0xdab2('0x13'),'dialNoAnswerMaxRetry',_0xdab2('0x14'),_0xdab2('0x15'),_0xdab2('0x16'),_0xdab2('0x17'),_0xdab2('0x18'),'dialCheckDuplicateType',_0xdab2('0x19'),_0xdab2('0x1a'),_0xdab2('0x1b'),_0xdab2('0x1c'),_0xdab2('0x1d'),_0xdab2('0x1e'),_0xdab2('0x1f'),_0xdab2('0x20'),_0xdab2('0x21'),_0xdab2('0x22'),_0xdab2('0x23'),'dialRecallMeTimeout',_0xdab2('0x24'),_0xdab2('0x25'),_0xdab2('0x26'),_0xdab2('0x27'),_0xdab2('0x28'),_0xdab2('0x29'),_0xdab2('0x2a'),_0xdab2('0x2b'),_0xdab2('0x2c'),_0xdab2('0x2d'),_0xdab2('0x2e'),_0xdab2('0x2f'),_0xdab2('0x30'),_0xdab2('0x31'),_0xdab2('0x32'),_0xdab2('0x33'),_0xdab2('0x34'),_0xdab2('0x35'),_0xdab2('0x36'),'mandatoryDisposition',_0xdab2('0x37'),_0xdab2('0x38'),_0xdab2('0x39'),'dialPreviewRecallmeReminder'],'include':[{'model':_0xdab2('0x3a'),'as':_0xdab2('0x3a'),'attributes':['id','name',_0xdab2('0x3b'),'active']},{'model':'Pause','as':_0xdab2('0x3c'),'attributes':['id',_0xdab2('0x3')]},{'model':_0xdab2('0x3a'),'as':'TrunkBackup','attributes':['id',_0xdab2('0x3'),'callerid','active']},{'model':_0xdab2('0x3d'),'as':_0xdab2('0x3d'),'attributes':['id',_0xdab2('0x3')],'include':[{'model':_0xdab2('0x3d'),'as':_0xdab2('0x3e'),'attributes':['id',_0xdab2('0x3'),_0xdab2('0x3f')]}]}]},'log':_0xdab2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d38ca70..9f34df7 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(_0xd7233a,_0x4a9cbb){var _0x274849=function(_0x5281bb){while(--_0x5281bb){_0xd7233a['push'](_0xd7233a['shift']());}};_0x274849(++_0x4a9cbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x2448d7,_0x1960c3){var _0x57d2ab=function(_0xc2b9d8){while(--_0xc2b9d8){_0x2448d7['push'](_0x2448d7['shift']());}};_0x57d2ab(++_0x1960c3);}(_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 2a80a21..47db9d7 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 _0x400e=['Request','../client'];(function(_0x119be3,_0x504f65){var _0x52281b=function(_0x1ea2dc){while(--_0x1ea2dc){_0x119be3['push'](_0x119be3['shift']());}};_0x52281b(++_0x504f65);}(_0x400e,0x131));var _0xe400=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x400e[_0xdc37a1];return _0x99b4fe;};'use strict';var client=require(_0xe400('0x0'));exports['getVoiceQueueRtPauses']=function(_0x46e4fa){return function(){return client[_0xe400('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x46e4fa,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xd85e=['Request','getVoiceQueueRtPauses','../client'];(function(_0x5a48cb,_0x5bed68){var _0x2f8e61=function(_0x1eddb4){while(--_0x1eddb4){_0x5a48cb['push'](_0x5a48cb['shift']());}};_0x2f8e61(++_0x5bed68);}(_0xd85e,0x116));var _0xed85=function(_0x47f7af,_0x491454){_0x47f7af=_0x47f7af-0x0;var _0x165a0b=_0xd85e[_0x47f7af];return _0x165a0b;};'use strict';var client=require(_0xed85('0x0'));exports['getVoiceQueueRtPauses']=function(_0x22145a){return function(){return client[_0xed85('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x22145a,'paused':!![]},'raw':!![]},'log':_0xed85('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b4ee31e..d8338d9 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(_0x5a2fe0,_0x511ff3){var _0x10ba7c=function(_0x4bdba1){while(--_0x4bdba1){_0x5a2fe0['push'](_0x5a2fe0['shift']());}};_0x10ba7c(++_0x511ff3);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x100c93,_0x251a31){var _0x54e834=function(_0x5e8484){while(--_0x5e8484){_0x100c93['push'](_0x100c93['shift']());}};_0x54e834(++_0x251a31);}(_0x7a54,0x106));var _0x47a5=function(_0x349a1c,_0x479ec2){_0x349a1c=_0x349a1c-0x0;var _0x3f0b02=_0x7a54[_0x349a1c];return _0x3f0b02;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 186a1ef..6b14f7a 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 _0x3c77=['transfereeexten','isexternal','context','extension','blind','result','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x3c77,0xc2));var _0x73c7=function(_0x5f54ca,_0x193bbd){_0x5f54ca=_0x5f54ca-0x0;var _0x290a3d=_0x3c77[_0x5f54ca];return _0x290a3d;};'use strict';var client=require('../client');exports[_0x73c7('0x0')]={};exports[_0x73c7('0x1')]=function(_0x1ae88b){return client[_0x73c7('0x2')](_0x73c7('0x3'),{'body':{'result':_0x1ae88b['result'],'transfererchannel':_0x1ae88b[_0x73c7('0x4')],'transferercalleridnum':_0x1ae88b[_0x73c7('0x5')],'transferercalleridname':_0x1ae88b['transferercalleridname'],'transfererconnectedlinenum':_0x1ae88b[_0x73c7('0x6')],'transfererconnectedlinename':_0x1ae88b[_0x73c7('0x7')],'transfereraccountcode':_0x1ae88b[_0x73c7('0x8')],'transferercontext':_0x1ae88b['transferercontext'],'transfererexten':_0x1ae88b[_0x73c7('0x9')],'transfererlinkedid':_0x1ae88b[_0x73c7('0xa')],'transfereechannel':_0x1ae88b['transfereechannel'],'transfereecalleridnum':_0x1ae88b[_0x73c7('0xb')],'transfereecalleridname':_0x1ae88b[_0x73c7('0xc')],'transfereeconnectedlinenum':_0x1ae88b[_0x73c7('0xd')],'transfereeconnectedlinename':_0x1ae88b[_0x73c7('0xe')],'transfereeaccountcode':_0x1ae88b['transfereeaccountcode'],'transfereecontext':_0x1ae88b[_0x73c7('0xf')],'transfereeexten':_0x1ae88b[_0x73c7('0x10')],'transfereelinkedid':_0x1ae88b['transfereelinkedid'],'isexternal':_0x1ae88b[_0x73c7('0x11')],'context':_0x1ae88b[_0x73c7('0x12')],'extension':_0x1ae88b[_0x73c7('0x13')],'type':_0x73c7('0x14')},'log':_0x73c7('0x3')});};exports['attendedTransfer']=function(_0xe74152){return client[_0x73c7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0xe74152[_0x73c7('0x15')],'transfererchannel':_0xe74152['origtransfererchannel'],'transferercalleridnum':_0xe74152['origtransferercalleridnum'],'transferercalleridname':_0xe74152[_0x73c7('0x16')],'transfererconnectedlinenum':_0xe74152['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xe74152[_0x73c7('0x17')],'transfereraccountcode':_0xe74152[_0x73c7('0x18')],'transferercontext':_0xe74152[_0x73c7('0x19')],'transfererexten':_0xe74152[_0x73c7('0x1a')],'transfererlinkedid':_0xe74152[_0x73c7('0x1b')],'transfereechannel':_0xe74152[_0x73c7('0x1c')],'transfereecalleridnum':_0xe74152['transfertargetcalleridnum'],'transfereecalleridname':_0xe74152[_0x73c7('0x1d')],'transfereeconnectedlinenum':_0xe74152[_0x73c7('0x1e')],'transfereeconnectedlinename':_0xe74152[_0x73c7('0x1f')],'transfereeaccountcode':_0xe74152['transfertargetaccountcode'],'transfereecontext':_0xe74152[_0x73c7('0x20')],'transfereeexten':_0xe74152[_0x73c7('0x21')],'transfereelinkedid':_0xe74152['transfertargetlinkedid'],'isexternal':_0xe74152[_0x73c7('0x11')],'context':_0xe74152['origtransferercontext'],'extension':_0xe74152['origtransfererexten'],'type':_0x73c7('0x22')},'log':_0x73c7('0x3')});}; \ No newline at end of file +var _0x8796=['attended','../client','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','Request','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext'];(function(_0x84a78b,_0x367470){var _0xfec07f=function(_0x432728){while(--_0x432728){_0x84a78b['push'](_0x84a78b['shift']());}};_0xfec07f(++_0x367470);}(_0x8796,0x172));var _0x6879=function(_0xbf5bc8,_0x2192f4){_0xbf5bc8=_0xbf5bc8-0x0;var _0x5a43dd=_0x8796[_0xbf5bc8];return _0x5a43dd;};'use strict';var client=require(_0x6879('0x0'));exports['transfers']={};exports[_0x6879('0x1')]=function(_0xfe4e8e){return client['Request'](_0x6879('0x2'),{'body':{'result':_0xfe4e8e['result'],'transfererchannel':_0xfe4e8e[_0x6879('0x3')],'transferercalleridnum':_0xfe4e8e[_0x6879('0x4')],'transferercalleridname':_0xfe4e8e[_0x6879('0x5')],'transfererconnectedlinenum':_0xfe4e8e[_0x6879('0x6')],'transfererconnectedlinename':_0xfe4e8e[_0x6879('0x7')],'transfereraccountcode':_0xfe4e8e[_0x6879('0x8')],'transferercontext':_0xfe4e8e[_0x6879('0x9')],'transfererexten':_0xfe4e8e['transfererexten'],'transfererlinkedid':_0xfe4e8e[_0x6879('0xa')],'transfereechannel':_0xfe4e8e[_0x6879('0xb')],'transfereecalleridnum':_0xfe4e8e[_0x6879('0xc')],'transfereecalleridname':_0xfe4e8e[_0x6879('0xd')],'transfereeconnectedlinenum':_0xfe4e8e[_0x6879('0xe')],'transfereeconnectedlinename':_0xfe4e8e[_0x6879('0xf')],'transfereeaccountcode':_0xfe4e8e[_0x6879('0x10')],'transfereecontext':_0xfe4e8e[_0x6879('0x11')],'transfereeexten':_0xfe4e8e[_0x6879('0x12')],'transfereelinkedid':_0xfe4e8e[_0x6879('0x13')],'isexternal':_0xfe4e8e[_0x6879('0x14')],'context':_0xfe4e8e['context'],'extension':_0xfe4e8e[_0x6879('0x15')],'type':_0x6879('0x16')},'log':_0x6879('0x2')});};exports[_0x6879('0x17')]=function(_0x4165bf){return client[_0x6879('0x18')](_0x6879('0x2'),{'body':{'result':_0x4165bf[_0x6879('0x19')],'transfererchannel':_0x4165bf['origtransfererchannel'],'transferercalleridnum':_0x4165bf[_0x6879('0x1a')],'transferercalleridname':_0x4165bf[_0x6879('0x1b')],'transfererconnectedlinenum':_0x4165bf[_0x6879('0x1c')],'transfererconnectedlinename':_0x4165bf[_0x6879('0x1d')],'transfereraccountcode':_0x4165bf[_0x6879('0x1e')],'transferercontext':_0x4165bf[_0x6879('0x1f')],'transfererexten':_0x4165bf[_0x6879('0x20')],'transfererlinkedid':_0x4165bf['origtransfererlinkedid'],'transfereechannel':_0x4165bf['transfertargetchannel'],'transfereecalleridnum':_0x4165bf[_0x6879('0x21')],'transfereecalleridname':_0x4165bf[_0x6879('0x22')],'transfereeconnectedlinenum':_0x4165bf[_0x6879('0x23')],'transfereeconnectedlinename':_0x4165bf['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4165bf[_0x6879('0x24')],'transfereecontext':_0x4165bf[_0x6879('0x25')],'transfereeexten':_0x4165bf[_0x6879('0x26')],'transfereelinkedid':_0x4165bf['transfertargetlinkedid'],'isexternal':_0x4165bf[_0x6879('0x14')],'context':_0x4165bf[_0x6879('0x27')],'extension':_0x4165bf['origtransfererexten'],'type':_0x6879('0x28')},'log':_0x6879('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index a8df3dd..89856c1 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(_0xa0965,_0x33489d){var _0x55eee1=function(_0x2739c0){while(--_0x2739c0){_0xa0965['push'](_0xa0965['shift']());}};_0x55eee1(++_0x33489d);}(_0x7a54,0x106));var _0x47a5=function(_0x40f920,_0x29edd7){_0x40f920=_0x40f920-0x0;var _0x317dde=_0x7a54[_0x40f920];return _0x317dde;};'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(_0xc19e36,_0x516aab){var _0x1b9c77=function(_0x45aac6){while(--_0x45aac6){_0xc19e36['push'](_0xc19e36['shift']());}};_0x1b9c77(++_0x516aab);}(_0x7a54,0x106));var _0x47a5=function(_0x280310,_0x51527d){_0x280310=_0x280310-0x0;var _0x41b7ae=_0x7a54[_0x280310];return _0x41b7ae;};'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 8e9ac6b..8df8718 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 _0x3c6a=['isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','destcalleridnum','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4'];(function(_0x487e48,_0x232219){var _0x934dbb=function(_0x12a6bb){while(--_0x12a6bb){_0x487e48['push'](_0x487e48['shift']());}};_0x934dbb(++_0x232219);}(_0x3c6a,0xb5));var _0xa3c6=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x3c6a[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0xa3c6('0x0'));var BPromise=require(_0xa3c6('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xa3c6('0x2'));var logger=require('../../../../config/logger')(_0xa3c6('0x3'));var cmContactRpc=require(_0xa3c6('0x4'));config[_0xa3c6('0x5')]=_[_0xa3c6('0x6')](config['redis'],{'host':_0xa3c6('0x7'),'port':0x18eb});var io=require(_0xa3c6('0x8'))(new Redis(config[_0xa3c6('0x5')]));function emit(_0x128cc2,_0x93316a,_0x1cfd8f,_0x38c35d,_0x3a8181){logger[_0xa3c6('0x9')]('[CM][%s][%s]',_0x128cc2,_0x93316a['id'],_0x1cfd8f,_0x38c35d,JSON[_0xa3c6('0xa')](_0x3a8181));io['to'](_0x1cfd8f)['emit'](_0x38c35d,_0x3a8181);}exports[_0xa3c6('0xb')]=function(_0x4fedcc,_0x7fc320,_0x4467cd,_0x293a58){var _0x554a7d,_0x3bf50b;var _0x4e048e={};var _0x534107;var _0x31f8a2=Number(_0x4467cd[_0xa3c6('0xc')]);var _0x1a8dd8=_0x4467cd[_0xa3c6('0xd')]?Boolean(Number(_0x4467cd[_0xa3c6('0xd')])):![];var _0x3d1770;var _0x1991ab=![];if(!_['isNil'](_0x4467cd['data5'])){if(_0x4467cd[_0xa3c6('0xe')]=='1')_0x1991ab=!![];}if(!_0x1991ab){if(_0x293a58[_0xa3c6('0xf')]){_0x4e048e['id']=_0x293a58['xmd-contactid'];}}if(!_0x4e048e['id']){_0x4e048e[_0xa3c6('0x10')]=_0x31f8a2;_0x3d1770=_0x4467cd[_0xa3c6('0x11')]&&_0x4467cd[_0xa3c6('0x11')]!=='0'?_0x4467cd[_0xa3c6('0x11')][_0xa3c6('0x12')](','):[_0xa3c6('0x13')];_0x4e048e[_0xa3c6('0x14')]=_[_0xa3c6('0x15')](_0x3d1770,function(_0xb709fc){var _0x1c67d7={};_0x1c67d7[_0xb709fc]=_0x293a58[_0xa3c6('0x16')]?_0x293a58['destcalleridnum']:_0x293a58[_0xa3c6('0x17')];return _0x1c67d7;});_0x534107=_0x293a58['routeId']?_0x293a58[_0xa3c6('0x18')]:_0x293a58[_0xa3c6('0x17')];}var _0x58a06e=['id','firstName',_0xa3c6('0x19'),'phone',_0xa3c6('0x1a'),_0xa3c6('0x1b'),_0xa3c6('0x10'),'createdAt',_0xa3c6('0x1c'),_0xa3c6('0x1d')];var _0x1ef207=_[_0xa3c6('0x1e')](_0x58a06e,_0x3d1770);BPromise[_0xa3c6('0x1f')]()[_0xa3c6('0x20')](cmContactRpc['getContacts']({'attributes':_0x1ef207,'where':_0x4e048e,'phone':_0x534107}))['then'](function(_0x354319){_0x3bf50b=_0x354319;if(!_[_0xa3c6('0x21')](_0x3bf50b)){if(_0x3bf50b[_0xa3c6('0x22')]===0x1){_0x554a7d=_0x3bf50b[0x0];logger[_0xa3c6('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x293a58[_0xa3c6('0x23')],_0x7fc320['id'],_0x554a7d['id']);}else{logger[_0xa3c6('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x293a58[_0xa3c6('0x23')],_0x7fc320['id'],_[_0xa3c6('0x15')](_0x3bf50b,'id')[_0xa3c6('0x24')](','));}return;}else{logger['info'](_0xa3c6('0x25'),_0x293a58[_0xa3c6('0x23')],_0x7fc320['id']);var _0x412689={'ListId':_0x31f8a2};var _0x2a30ed=_0x4467cd['data4']&&_0x4467cd[_0xa3c6('0x26')]!=='0'?_0x4467cd['data4']:'phone';if(_0x1a8dd8){logger[_0xa3c6('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x293a58['uniqueid'],_0x7fc320['id']);_0x412689[_0x2a30ed]=_[_0xa3c6('0x27')](_0x293a58[_0xa3c6('0x16')])?_0x293a58[_0xa3c6('0x17')]:_0x293a58[_0xa3c6('0x18')];if(_[_0xa3c6('0x27')](_0x293a58[_0xa3c6('0x16')])){_0x412689[_0xa3c6('0x28')]=_0x293a58[_0xa3c6('0x29')]&&_0x293a58[_0xa3c6('0x29')]!==_0xa3c6('0x2a')?_0x293a58[_0xa3c6('0x29')]:_0xa3c6('0x2b');}else{_0x412689[_0xa3c6('0x28')]=_0x293a58[_0xa3c6('0x2c')]&&_0x293a58[_0xa3c6('0x2c')]!==_0xa3c6('0x2a')?_0x293a58['destcalleridname']:'Unknown';}return BPromise[_0xa3c6('0x1f')]()[_0xa3c6('0x20')](cmContactRpc[_0xa3c6('0x2d')](_0x412689))[_0xa3c6('0x20')](function(_0x591c72){_0x554a7d=_0x591c72;_0x3bf50b[_0xa3c6('0x2e')](_0x591c72);if(_0x554a7d){logger[_0xa3c6('0x9')](_0xa3c6('0x2f'),_0x293a58['uniqueid'],_0x7fc320['id'],_0x554a7d['id']);}return;});}else{logger[_0xa3c6('0x9')](_0xa3c6('0x30'),_0x293a58[_0xa3c6('0x23')],_0x7fc320['id']);_0x412689[_0x2a30ed]=_[_0xa3c6('0x27')](_0x293a58[_0xa3c6('0x16')])?_0x293a58['calleridnum']:_0x293a58[_0xa3c6('0x18')];if(_[_0xa3c6('0x27')](_0x293a58[_0xa3c6('0x16')])){_0x412689[_0xa3c6('0x28')]=_0x293a58[_0xa3c6('0x29')]&&_0x293a58['calleridname']!==_0xa3c6('0x2a')?_0x293a58[_0xa3c6('0x29')]:_0xa3c6('0x2b');}else{_0x412689[_0xa3c6('0x28')]=_0x293a58[_0xa3c6('0x2c')]&&_0x293a58[_0xa3c6('0x2c')]!==_0xa3c6('0x2a')?_0x293a58[_0xa3c6('0x2c')]:'Unknown';}_0x554a7d=_0x412689;_0x3bf50b[_0xa3c6('0x2e')](_0x412689);return;}}})[_0xa3c6('0x20')](function(){if(_0x4fedcc){emit(_0x293a58['uniqueid'],_0x7fc320,util['format']('user:%s',_0x4fedcc[_0xa3c6('0x31')]),util[_0xa3c6('0x32')](_0xa3c6('0x33'),_0x4467cd[_0xa3c6('0x34')][_0xa3c6('0x35')]()),{'evt':_[_0xa3c6('0x36')](_0x293a58,{'autoCreate':_0x1a8dd8}),'contact':_0x554a7d===undefined?{}:_0x554a7d,'contacts':_0x3bf50b[_0xa3c6('0x22')]===0x0?undefined:_0x3bf50b});}});}; \ No newline at end of file +var _0xb356=['util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','emit','data1','data2','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis'];(function(_0x231c69,_0x408239){var _0x19a22f=function(_0x3c65e4){while(--_0x3c65e4){_0x231c69['push'](_0x231c69['shift']());}};_0x19a22f(++_0x408239);}(_0xb356,0x135));var _0x6b35=function(_0x4195d6,_0x4dd2f7){_0x4195d6=_0x4195d6-0x0;var _0x442173=_0xb356[_0x4195d6];return _0x442173;};'use strict';var _=require(_0x6b35('0x0'));var BPromise=require(_0x6b35('0x1'));var Redis=require(_0x6b35('0x2'));var util=require(_0x6b35('0x3'));var config=require(_0x6b35('0x4'));var logger=require(_0x6b35('0x5'))(_0x6b35('0x6'));var cmContactRpc=require(_0x6b35('0x7'));config[_0x6b35('0x8')]=_[_0x6b35('0x9')](config[_0x6b35('0x8')],{'host':_0x6b35('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3de7ba,_0x33b964,_0x21d5a7,_0x476ff5,_0x431974){logger[_0x6b35('0xb')]('[CM][%s][%s]',_0x3de7ba,_0x33b964['id'],_0x21d5a7,_0x476ff5,JSON['stringify'](_0x431974));io['to'](_0x21d5a7)[_0x6b35('0xc')](_0x476ff5,_0x431974);}exports['exec']=function(_0x19475c,_0x5b4978,_0x2c8f71,_0x4739d9){var _0x5ec333,_0x15ee29;var _0x356446={};var _0x188018;var _0x217763=Number(_0x2c8f71[_0x6b35('0xd')]);var _0x576648=_0x2c8f71[_0x6b35('0xe')]?Boolean(Number(_0x2c8f71['data2'])):![];var _0x35a9ec;var _0x34981a=![];if(!_['isNil'](_0x2c8f71[_0x6b35('0xf')])){if(_0x2c8f71[_0x6b35('0xf')]=='1')_0x34981a=!![];}if(!_0x34981a){if(_0x4739d9[_0x6b35('0x10')]){_0x356446['id']=_0x4739d9['xmd-contactid'];}}if(!_0x356446['id']){_0x356446['ListId']=_0x217763;_0x35a9ec=_0x2c8f71[_0x6b35('0x11')]&&_0x2c8f71[_0x6b35('0x11')]!=='0'?_0x2c8f71['data3'][_0x6b35('0x12')](','):[_0x6b35('0x13')];_0x356446[_0x6b35('0x14')]=_[_0x6b35('0x15')](_0x35a9ec,function(_0x430482){var _0x44ac4b={};_0x44ac4b[_0x430482]=_0x4739d9['routeId']?_0x4739d9['destcalleridnum']:_0x4739d9['calleridnum'];return _0x44ac4b;});_0x188018=_0x4739d9[_0x6b35('0x16')]?_0x4739d9[_0x6b35('0x17')]:_0x4739d9[_0x6b35('0x18')];}var _0xab9339=['id',_0x6b35('0x19'),'lastName',_0x6b35('0x13'),'mobile','fax','ListId',_0x6b35('0x1a'),_0x6b35('0x1b'),_0x6b35('0x1c')];var _0x474c27=_[_0x6b35('0x1d')](_0xab9339,_0x35a9ec);BPromise['resolve']()[_0x6b35('0x1e')](cmContactRpc[_0x6b35('0x1f')]({'attributes':_0x474c27,'where':_0x356446,'phone':_0x188018}))[_0x6b35('0x1e')](function(_0x43b378){_0x15ee29=_0x43b378;if(!_[_0x6b35('0x20')](_0x15ee29)){if(_0x15ee29[_0x6b35('0x21')]===0x1){_0x5ec333=_0x15ee29[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x4739d9['uniqueid'],_0x5b4978['id'],_0x5ec333['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4739d9[_0x6b35('0x22')],_0x5b4978['id'],_[_0x6b35('0x15')](_0x15ee29,'id')[_0x6b35('0x23')](','));}return;}else{logger[_0x6b35('0xb')](_0x6b35('0x24'),_0x4739d9[_0x6b35('0x22')],_0x5b4978['id']);var _0x5876ed={'ListId':_0x217763};var _0x507e2e=_0x2c8f71['data4']&&_0x2c8f71['data4']!=='0'?_0x2c8f71[_0x6b35('0x25')]:_0x6b35('0x13');if(_0x576648){logger[_0x6b35('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4739d9[_0x6b35('0x22')],_0x5b4978['id']);_0x5876ed[_0x507e2e]=_[_0x6b35('0x26')](_0x4739d9[_0x6b35('0x16')])?_0x4739d9['calleridnum']:_0x4739d9[_0x6b35('0x17')];if(_['isNil'](_0x4739d9[_0x6b35('0x16')])){_0x5876ed['firstName']=_0x4739d9[_0x6b35('0x27')]&&_0x4739d9[_0x6b35('0x27')]!==_0x6b35('0x28')?_0x4739d9[_0x6b35('0x27')]:_0x6b35('0x29');}else{_0x5876ed['firstName']=_0x4739d9[_0x6b35('0x2a')]&&_0x4739d9[_0x6b35('0x2a')]!==_0x6b35('0x28')?_0x4739d9[_0x6b35('0x2a')]:_0x6b35('0x29');}return BPromise[_0x6b35('0x2b')]()['then'](cmContactRpc['createContact'](_0x5876ed))['then'](function(_0xba8aa2){_0x5ec333=_0xba8aa2;_0x15ee29[_0x6b35('0x2c')](_0xba8aa2);if(_0x5ec333){logger[_0x6b35('0xb')](_0x6b35('0x2d'),_0x4739d9[_0x6b35('0x22')],_0x5b4978['id'],_0x5ec333['id']);}return;});}else{logger[_0x6b35('0xb')](_0x6b35('0x2e'),_0x4739d9[_0x6b35('0x22')],_0x5b4978['id']);_0x5876ed[_0x507e2e]=_[_0x6b35('0x26')](_0x4739d9['routeId'])?_0x4739d9[_0x6b35('0x18')]:_0x4739d9[_0x6b35('0x17')];if(_[_0x6b35('0x26')](_0x4739d9['routeId'])){_0x5876ed[_0x6b35('0x19')]=_0x4739d9[_0x6b35('0x27')]&&_0x4739d9[_0x6b35('0x27')]!==_0x6b35('0x28')?_0x4739d9[_0x6b35('0x27')]:_0x6b35('0x29');}else{_0x5876ed['firstName']=_0x4739d9[_0x6b35('0x2a')]&&_0x4739d9[_0x6b35('0x2a')]!==_0x6b35('0x28')?_0x4739d9['destcalleridname']:_0x6b35('0x29');}_0x5ec333=_0x5876ed;_0x15ee29[_0x6b35('0x2c')](_0x5876ed);return;}}})['then'](function(){if(_0x19475c){emit(_0x4739d9['uniqueid'],_0x5b4978,util[_0x6b35('0x2f')](_0x6b35('0x30'),_0x19475c['name']),util[_0x6b35('0x2f')](_0x6b35('0x31'),_0x2c8f71['action'][_0x6b35('0x32')]()),{'evt':_[_0x6b35('0x33')](_0x4739d9,{'autoCreate':_0x576648}),'contact':_0x5ec333===undefined?{}:_0x5ec333,'contacts':_0x15ee29[_0x6b35('0x21')]===0x0?undefined:_0x15ee29});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 980bd47..aa4ca02 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 _0xe65b=['templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','zohoAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','motionChannel','undefined','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','action','contactmanager','motionbar','browser','data1','TemplateId','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','trigger:%s:%s','toLowerCase','jscripty','trigger:%s','name','exec','integration','accounts','queue','routeId','urlforward','script','query','search','replace','channel','length','every','AllConditions','checkConditions','AnyConditions','some','evt','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues'];(function(_0x36375a,_0x43ede3){var _0xe646d0=function(_0x4e9ea2){while(--_0x4e9ea2){_0x36375a['push'](_0x36375a['shift']());}};_0xe646d0(++_0x43ede3);}(_0xe65b,0xf9));var _0xbe65=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe65b[_0x413feb];return _0x40ee88;};'use strict';var util=require(_0xbe65('0x0'));var _=require(_0xbe65('0x1'));var url=require(_0xbe65('0x2'));var Mustache=require(_0xbe65('0x3'));var Redis=require(_0xbe65('0x4'));var urlforward=require(_0xbe65('0x5'));var integration=require(_0xbe65('0x6'));var cmContact=require(_0xbe65('0x7'));var script=require(_0xbe65('0x8'));var config=require(_0xbe65('0x9'));var logger=require('../../../config/logger')(_0xbe65('0xa'));var ami=require(_0xbe65('0xb'));config[_0xbe65('0xc')]=_['defaults'](config[_0xbe65('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xbe65('0xd'))(new Redis(config[_0xbe65('0xc')]));var operators={'equals':function(_0x47ac38,_0x1ea751){return _0x47ac38==_0x1ea751;},'not_equals':function(_0x39ea56,_0x5d2f15){return _0x39ea56!=_0x5d2f15;}};var barAndWebActions=[_0xbe65('0xe'),_0xbe65('0x2'),_0xbe65('0xf')];function Trigger(_0x1e50c1){this[_0xbe65('0x10')]=_0x1e50c1[_0xbe65('0x10')];this[_0xbe65('0x11')]=_0x1e50c1[_0xbe65('0x11')];this[_0xbe65('0x12')]=_0x1e50c1['voiceQueues'];this[_0xbe65('0x13')]=_0x1e50c1[_0xbe65('0x13')];this[_0xbe65('0x14')]=_0x1e50c1[_0xbe65('0x14')];this[_0xbe65('0x15')]=_0x1e50c1[_0xbe65('0x15')];this[_0xbe65('0x16')]=_0x1e50c1[_0xbe65('0x16')];this[_0xbe65('0x17')]=_0x1e50c1[_0xbe65('0x17')];this[_0xbe65('0x18')]=_0x1e50c1[_0xbe65('0x18')];this['zohoAccounts']=_0x1e50c1['zohoAccounts'];this[_0xbe65('0x19')]=_0x1e50c1[_0xbe65('0x19')];this[_0xbe65('0x1a')]=_0x1e50c1['vtigerAccounts'];this[_0xbe65('0x1b')]=_0x1e50c1[_0xbe65('0x1b')];this[_0xbe65('0x1c')]=_0x1e50c1[_0xbe65('0x1c')];this[_0xbe65('0x1d')]=_0x1e50c1[_0xbe65('0x1d')];this['accounts']={'zendesk':this[_0xbe65('0x15')],'salesforce':this[_0xbe65('0x17')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xbe65('0x18')],'zoho':this[_0xbe65('0x1e')],'desk':this[_0xbe65('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xbe65('0x1c')],'freshsales':this[_0xbe65('0x1d')],'servicenow':this[_0xbe65('0x1b')]};ami['on'](_0xbe65('0x1f'),this[_0xbe65('0x20')]['bind'](this));ami['on'](_0xbe65('0x21'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x23'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on']('custom:agentcomplete',this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x24'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x25'),this['syncCustomEvent'][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0xbe65('0x27'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x28'),this['syncCustomEvent'][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x29'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on']('custom:queuecallerabandon',this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x2a'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x2b'),this[_0xbe65('0x2c')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x2d'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0xbe65('0x2c')][_0xbe65('0x22')](this));ami['on']('custom:newinteraction',this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x2e'),this[_0xbe65('0x20')]['bind'](this));ami['on'](_0xbe65('0x2f'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x30'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x31'),this['syncCustomEvent'][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x32'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on'](_0xbe65('0x33'),this[_0xbe65('0x20')][_0xbe65('0x22')](this));ami['on']('custom:offlineMessage',this[_0xbe65('0x20')][_0xbe65('0x22')](this));}Trigger[_0xbe65('0x34')][_0xbe65('0x35')]=function(_0x23e4a2,_0x31d80e,_0x11363e){logger['info'](_0x23e4a2,_0x31d80e,JSON[_0xbe65('0x36')](_0x11363e));io['to'](_0x23e4a2)[_0xbe65('0x35')](_0x31d80e,_0x11363e);};Trigger['prototype'][_0xbe65('0x20')]=function(_0x3b6b26){var _0x32a11c=_[_0xbe65('0x37')](_0x3b6b26);if(typeof _0x32a11c[_0xbe65('0x38')]===_0xbe65('0x39')){_0x32a11c[_0xbe65('0x38')]='voice';}logger[_0xbe65('0x3a')](_0xbe65('0x20'),util[_0xbe65('0x3b')](_0x32a11c,{'showHidden':!![],'depth':null}));this[_0xbe65('0x3c')](_0x32a11c);};Trigger['prototype'][_0xbe65('0x2c')]=function(_0x288d83){if(this[_0xbe65('0x11')][_0x288d83[_0xbe65('0x3d')]]){this[_0xbe65('0x20')](_0x288d83);}};Trigger['prototype'][_0xbe65('0x3c')]=function(_0xbfdb99){var _0x32b43e;for(var _0x590da5 in this[_0xbe65('0x10')]){if(this[_0xbe65('0x10')][_0xbe65('0x3e')](_0x590da5)){if(this['triggers'][_0x590da5][_0xbe65('0x3f')]){_0x32b43e=this[_0xbe65('0x40')](this[_0xbe65('0x10')][_0x590da5],_0xbfdb99);if(_0x32b43e){_[_0xbe65('0x41')](_0xbfdb99,_0xbfdb99[_0xbe65('0x42')]);for(var _0xc79328=0x0,_0x5465bb,_0x2ffec1,_0x427b62;_0xc793280x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x326f,0xd1));var _0xf326=function(_0x5b3b94,_0xd5bb39){_0x5b3b94=_0x5b3b94-0x0;var _0x2f39b6=_0x326f[_0x5b3b94];return _0x2f39b6;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 fc83fca..afceae0 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 _0xbd5c=['internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','catch','toLowerCase','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','outbound','destcalleridnum','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','4.0','nothing','includes','string','picklist','type','nameField','customField','idField','substring','indexOf','content','ticketType','incident','assign','getString','/contacts(','phonecall','queue','callDirection','phonecalls','Subjects','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','password','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','validateEmail','email','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd5c,0x11a));var _0xcbd5=function(_0x2e3648,_0x34aa0e){_0x2e3648=_0x2e3648-0x0;var _0xbbad0f=_0xbd5c[_0x2e3648];return _0xbbad0f;};'use strict';var _=require('lodash');var rp=require(_0xcbd5('0x0'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0xcbd5('0x1'))(_0xcbd5('0x2'));var config=require('../../../../config/environment');config[_0xcbd5('0x3')]=_['defaults'](config[_0xcbd5('0x3')],{'host':_0xcbd5('0x4'),'port':0x18eb});var io=require(_0xcbd5('0x5'))(new Redis(config[_0xcbd5('0x3')]));function getAuthToken(_0x24f333,_0x192126,_0x1ec6b3){if(_0x24f333['modernAuthentication']){_0x24f333[_0xcbd5('0x6')]=_0x24f333[_0xcbd5('0x7')][_0xcbd5('0x8')];_0x24f333[_0xcbd5('0x9')]=_0x24f333[_0xcbd5('0x7')][_0xcbd5('0xa')];return Promise[_0xcbd5('0xb')](_0x24f333['CloudProvider'][_0xcbd5('0xc')]);}var _0x253816={'method':_0xcbd5('0xd'),'uri':_0x192126,'form':{'client_id':_0x24f333[_0xcbd5('0xe')],'resource':_0x24f333[_0xcbd5('0x6')],'username':_0x24f333['username'],'password':_0x24f333['password'],'grant_type':_0xcbd5('0xf'),'client_secret':_0x24f333['clientSecret']},'json':!![]};return rp(_0x253816)[_0xcbd5('0x10')](function(_0x1e72f8){return _0x1e72f8['access_token'];})['catch'](function(_0x2d13ba){logger[_0xcbd5('0x11')]('['+[_0x1ec6b3[_0xcbd5('0x12')]()]+_0xcbd5('0x13'));return _0x2d13ba[_0xcbd5('0x14')];});}function getUser(_0x17ce8b,_0x174987,_0x568ad8,_0x410ad1,_0x2f905a,_0x3929ad){return new Promise(function(_0x53b135,_0x434bc6){return getAuthToken(_0x174987,_0x410ad1,_0x3929ad)[_0xcbd5('0x10')](function(_0x43ce30){var _0x3b2d8a={'method':_0xcbd5('0x15'),'uri':_0x2f905a+_0xcbd5('0x16'),'headers':{'Authorization':_0xcbd5('0x17')+_0x43ce30,'OData-Version':'4.0'},'json':!![]};return rp(_0x3b2d8a);})[_0xcbd5('0x10')](function(_0x15dd75){var _0x46fe0e=_0x15dd75['value'];var _0x743579=![];var _0x293126=null;if(!_['isNil'](_0x568ad8)){if(intUtil[_0xcbd5('0x18')](_0x568ad8[_0xcbd5('0x19')])){_0x17ce8b['userEmail']=_0x568ad8['email'];for(_0x293126=0x0;_0x293126<_0x46fe0e[_0xcbd5('0x1a')];_0x293126++){if(_0x46fe0e[_0x293126][_0xcbd5('0x1b')]===_0x568ad8['email']&&!_0x46fe0e[_0x293126][_0xcbd5('0x1c')]){_0x743579=!![];logger[_0xcbd5('0x1d')]('['+[_0x3929ad[_0xcbd5('0x12')]()]+_0xcbd5('0x1e')+_0x46fe0e[_0x293126][_0xcbd5('0x1f')]+'!');_0x17ce8b[_0xcbd5('0x20')]=_0x46fe0e[_0x293126][_0xcbd5('0x1f')];}}}}if(!_0x743579){logger[_0xcbd5('0x1d')]('['+[_0x3929ad[_0xcbd5('0x12')]()]+_0xcbd5('0x21'));_0x17ce8b[_0xcbd5('0x22')]=_0x174987[_0xcbd5('0x23')];for(_0x293126=0x0;_0x293126<_0x46fe0e[_0xcbd5('0x1a')];_0x293126++){if(_0x46fe0e[_0x293126][_0xcbd5('0x1b')]===_0x174987[_0xcbd5('0x23')]){_0x17ce8b[_0xcbd5('0x20')]=_0x46fe0e[_0x293126]['systemuserid'];}}}_0x53b135(_0x17ce8b);})[_0xcbd5('0x24')](function(_0x8f308b){_0x434bc6(_0x8f308b[_0xcbd5('0x14')]);});});}function createEndUser(_0xa18a9,_0x337c5b,_0x2bd7fd,_0x5cb162,_0x4f36e4,_0x26ace0,_0x240754){return new Promise(function(_0x3930b3,_0x2f5978){return getAuthToken(_0x337c5b,_0x2bd7fd,_0x26ace0)[_0xcbd5('0x10')](function(_0xc32b10){var _0x25e8bf=_0x26ace0[_0xcbd5('0x25')]()==='outbound'?_0x4f36e4['destcalleridnum']:_0x4f36e4[_0xcbd5('0x26')];var _0x345933={'method':_0xcbd5('0xd'),'uri':_0x5cb162+_0xcbd5('0x27'),'body':{'fullname':_0x25e8bf,'firstname':_0x25e8bf,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xcbd5('0x28')+_0xa18a9[_0xcbd5('0x20')]+')'},'headers':{'Authorization':_0xcbd5('0x17')+_0xc32b10,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x345933['body'][_0x240754]=_0x25e8bf;return rp(_0x345933);})[_0xcbd5('0x10')](function(_0x44c60f){var _0x30fad5=_0x44c60f[_0xcbd5('0x29')][_0xcbd5('0x2a')];var _0x3eca8e=_0x30fad5['substring'](_0x30fad5['lastIndexOf']('(')+0x1,_0x30fad5[_0xcbd5('0x2b')](')'));_0xa18a9[_0xcbd5('0x2c')]=_0x3eca8e;_0x3930b3(_0xa18a9);})['catch'](function(_0x5851f9){_0x2f5978(_0x5851f9[_0xcbd5('0x14')]);});});}function getEndUser(_0x2a8387,_0x496475,_0x147330,_0x5e9317,_0xdb8d48,_0x2d59db,_0x3309b3,_0x4d609f){var _0x5e986b=_0x2d59db['toLowerCase']()===_0xcbd5('0x2d')?_0xdb8d48[_0xcbd5('0x2e')]:_0xdb8d48[_0xcbd5('0x26')];return getAuthToken(_0x496475,_0x147330,_0x2d59db)[_0xcbd5('0x10')](function(_0x50d9ba){_0x4d609f=_0x4d609f?_0x4d609f:'telephone1';var _0x3b40bd={'method':_0xcbd5('0x15'),'uri':_0x5e9317+_0xcbd5('0x2f')+_0x4d609f+_0xcbd5('0x30')+_0x4d609f+_0xcbd5('0x31')+_0x5e986b[_0xcbd5('0x32')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x50d9ba,'If-None-Match':null,'OData-Version':_0xcbd5('0x33')},'json':!![]};return rp(_0x3b40bd);})[_0xcbd5('0x10')](function(_0x49d346){var _0xa22aa2=![];if(!_0x49d346)return _0xa22aa2;var _0x46a769=_0x49d346['value'];for(var _0x4ed265=0x0;_0x4ed265<_0x46a769['length'];_0x4ed265++){if(_0x46a769[_0x4ed265][_0x4d609f]===_0x5e986b){_0xa22aa2=!![];_0x2a8387[_0xcbd5('0x2c')]=_0x46a769[_0x4ed265]['contactid'];}}return _0xa22aa2;})[_0xcbd5('0x10')](function(_0x4bcd1b){if(_0x4bcd1b)return _0x2a8387;if(_0x3309b3===_0xcbd5('0x34')){logger[_0xcbd5('0x1d')]('['+[_0x2d59db['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x2a8387;}return createEndUser(_0x2a8387,_0x496475,_0x147330,_0x5e9317,_0xdb8d48,_0x2d59db,_0x4d609f)[_0xcbd5('0x10')](function(_0x200b9f){logger[_0xcbd5('0x1d')]('['+[_0x2d59db[_0xcbd5('0x12')]()]+']\x20Enduser\x20created!',_0x200b9f[_0xcbd5('0x2c')]);return _0x200b9f;});});}function getCustomFields(_0x933c51,_0xfd30d7,_0x160008){var _0x42723b={};if(_0x933c51[_0xcbd5('0x1a')]>0x0){_['forEach'](_0x933c51,function(_0x462681){if(_[_0xcbd5('0x35')]([_0xcbd5('0x36'),_0xcbd5('0x37')],_0x462681[_0xcbd5('0x38')])&&_0x462681[_0xcbd5('0x39')]&&!_0x462681[_0xcbd5('0x3a')]){var _0x39de3b=_0x462681[_0xcbd5('0x3b')]['toLowerCase']();var _0x1a92c=_0x39de3b[_0xcbd5('0x3c')](0x0,_0x39de3b[_0xcbd5('0x3d')]('_'));var _0xff820c=_0x39de3b['substring'](_0x39de3b['indexOf']('_')+0x1);if(_0x1a92c===_0x160008){_0x42723b[_0xff820c]=_0x462681[_0xcbd5('0x3e')];}}});}return _0x42723b;}function getTicket(_0x19d373,_0x372579,_0xc83712,_0x325f02,_0x1ce435,_0x23a4d1,_0xe26874){return new Promise(function(_0x130a43,_0x53248e){var _0x417cf6;return getAuthToken(_0x372579,_0xc83712,_0xe26874)[_0xcbd5('0x10')](function(_0x475092){if(_0x23a4d1[_0xcbd5('0x3f')]===_0xcbd5('0x40')){_0x417cf6={'method':_0xcbd5('0xd'),'uri':_0x325f02+'incidents','body':Object[_0xcbd5('0x41')]({},{'title':intUtil[_0xcbd5('0x42')](_0x23a4d1['Subjects'],_0x1ce435,'\x20'),'description':intUtil[_0xcbd5('0x42')](_0x23a4d1['Descriptions'],_0x1ce435,'\x0a'),'customerid_contact@odata.bind':_0x19d373[_0xcbd5('0x2c')]?_0xcbd5('0x43')+_0x19d373[_0xcbd5('0x2c')]+')':undefined,'ownerid@odata.bind':_0xcbd5('0x28')+_0x19d373[_0xcbd5('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x23a4d1['Fields'],_0x1ce435,_0x23a4d1['ticketType'])),'headers':{'Authorization':_0xcbd5('0x17')+_0x475092,'OData-Version':_0xcbd5('0x33')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x23a4d1[_0xcbd5('0x3f')]===_0xcbd5('0x44')){var _0x49cfff=_0x19d373[_0xcbd5('0x2c')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x19d373['userId']+')','participationtypemask':_0x19d373['callDirection']===_0xcbd5('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xcbd5('0x43')+_0x19d373[_0xcbd5('0x2c')]+')','participationtypemask':_0x19d373[_0xcbd5('0x46')]===_0xcbd5('0x45')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xcbd5('0x28')+_0x19d373[_0xcbd5('0x20')]+')','participationtypemask':_0x19d373['callDirection']===_0xcbd5('0x45')?0x2:0x1}];_0x417cf6={'method':'POST','uri':_0x325f02+_0xcbd5('0x47'),'body':Object[_0xcbd5('0x41')]({},{'subject':intUtil['getString'](_0x23a4d1[_0xcbd5('0x48')],_0x1ce435,'\x20'),'phonenumber':String(_0x1ce435[_0xcbd5('0x26')]),'description':intUtil['getString'](_0x23a4d1['Descriptions'],_0x1ce435,'\x0a'),'regardingobjectid_contact@odata.bind':_0x19d373[_0xcbd5('0x2c')]?'/contacts('+_0x19d373[_0xcbd5('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x19d373[_0xcbd5('0x20')]+')','directioncode':_0x19d373['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x49cfff},getCustomFields(_0x23a4d1[_0xcbd5('0x49')],_0x1ce435,_0x23a4d1['ticketType'])),'headers':{'Authorization':_0xcbd5('0x17')+_0x475092,'OData-Version':_0xcbd5('0x33')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x417cf6);})[_0xcbd5('0x10')](function(_0x3c77f5){var _0x1ed85d=_0x3c77f5[_0xcbd5('0x29')][_0xcbd5('0x2a')];var _0x539f00=_0x1ed85d[_0xcbd5('0x3c')](_0x1ed85d['lastIndexOf']('(')+0x1,_0x1ed85d['lastIndexOf'](')'));_0x19d373[_0xcbd5('0x4a')]=_0x539f00;_0x130a43(_0x19d373);})[_0xcbd5('0x24')](function(_0x5a9aba){_0x53248e(_0x5a9aba[_0xcbd5('0x14')]);});});}function emit(_0x57cb87,_0x169762,_0x1e030f,_0x28c589){var _0x2d6ada={'uri':util[_0xcbd5('0x4b')](_0xcbd5('0x4c'),_0x57cb87,_0x1e030f,_0x28c589)};io['to'](util[_0xcbd5('0x4b')](_0xcbd5('0x4d'),_0x169762))[_0xcbd5('0x4e')](_0xcbd5('0x4f'),_0x2d6ada);}exports['cs']=function(_0x48a40c,_0x5e8b4e,_0x3b1476,_0x39fa55,_0x5ee903,_0x43bbe0,_0x4332e6,_0x33d31e){var _0x2cd879={};_0x43bbe0[_0xcbd5('0x6')]=_0x43bbe0[_0xcbd5('0x50')]?intUtil[_0xcbd5('0x51')](_0x43bbe0[_0xcbd5('0x7')]['data7']):intUtil['stripTrailingSlash'](_0x43bbe0[_0xcbd5('0x6')]);_0x43bbe0[_0xcbd5('0x52')]=intUtil[_0xcbd5('0x51')](_0x43bbe0[_0xcbd5('0x52')]);_0x2cd879[_0xcbd5('0x46')]=_0x33d31e===_0xcbd5('0x45')||_0x33d31e==='unmanaged'?_0xcbd5('0x45'):'outbound';var _0x4b50b4=_0x43bbe0[_0xcbd5('0x50')]?util['format'](_0xcbd5('0x53'),_0x43bbe0[_0xcbd5('0x7')][_0xcbd5('0x8')]):util[_0xcbd5('0x4b')](_0xcbd5('0x53'),_0x43bbe0[_0xcbd5('0x6')]);var _0x5a50a2=util['format'](_0xcbd5('0x54'),_0x43bbe0['tenantId']);var _0x4e44e4=util['format'](_0xcbd5('0x55'),_0x43bbe0['serverUrl'],_0x5e8b4e['uniqueid'],md5(_0x5e8b4e[_0xcbd5('0x56')]));if(_0x5ee903&&_0x5ee903['monitor_format']){logger[_0xcbd5('0x1d')](_0xcbd5('0x57'),_0xcbd5('0x58'));_0x5e8b4e[_0xcbd5('0x59')]=_0x4e44e4;}else if(_0x4332e6&&_0x4332e6['recordingFormat']&&_0x4332e6[_0xcbd5('0x5a')]!==_0xcbd5('0x5b')){logger[_0xcbd5('0x1d')](_0xcbd5('0x5c'),'Recording\x20is\x20enabled!');_0x5e8b4e[_0xcbd5('0x59')]=_0x4e44e4;}else{_0x5e8b4e['recordingURL']='';}return getUser(_0x2cd879,_0x43bbe0,_0x39fa55,_0x5a50a2,_0x4b50b4,_0x33d31e)['then'](function(_0x1b2ea9){logger[_0xcbd5('0x1d')]('['+_0x33d31e['toUpperCase']()+_0xcbd5('0x5d'),_0x1b2ea9[_0xcbd5('0x20')]);logger[_0xcbd5('0x1d')]('['+_0x33d31e[_0xcbd5('0x12')]()+_0xcbd5('0x5e'),_0x1b2ea9[_0xcbd5('0x22')]);return getEndUser(_0x1b2ea9,_0x43bbe0,_0x5a50a2,_0x4b50b4,_0x5e8b4e,_0x33d31e,_0x3b1476['moduleCreate'],_0x3b1476[_0xcbd5('0x5f')]);})['then'](function(_0x21117f){logger[_0xcbd5('0x1d')]('['+_0x33d31e[_0xcbd5('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x21117f[_0xcbd5('0x2c')]);logger[_0xcbd5('0x1d')]('['+_0x33d31e[_0xcbd5('0x12')]()+_0xcbd5('0x60'),_0x5e8b4e[_0xcbd5('0x26')]);return getTicket(_0x21117f,_0x43bbe0,_0x5a50a2,_0x4b50b4,_0x5e8b4e,_0x3b1476,_0x33d31e);})['then'](function(_0x2045f0){logger['info'](util['format']('['+_0x33d31e[_0xcbd5('0x12')]()+_0xcbd5('0x61'),_0x3b1476[_0xcbd5('0x3f')],_0x2045f0['ticketId']));logger[_0xcbd5('0x1d')](util[_0xcbd5('0x4b')]('['+_0x33d31e['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x33d31e));if(_0x33d31e!=='unmanaged'&&_0x3b1476[_0xcbd5('0x62')]){logger['info']('['+_0x33d31e['toUpperCase']()+']',_0xcbd5('0x63'));emit(_0x43bbe0[_0xcbd5('0x6')],_0x39fa55[_0xcbd5('0x64')],_0x3b1476['ticketType'],_0x2045f0[_0xcbd5('0x4a')]);}})[_0xcbd5('0x24')](function(_0xe7ab97){logger[_0xcbd5('0x11')]('['+_0x33d31e[_0xcbd5('0x12')]()+_0xcbd5('0x65'),_0xe7ab97[_0xcbd5('0x14')]);console[_0xcbd5('0x11')](_0xcbd5('0x66'),_0xe7ab97);});}; \ No newline at end of file +var _0xb0dc=['contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','enduserId','string','picklist','type','nameField','idField','indexOf','ticketType','incident','incidents','assign','getString','/contacts(','Fields','queue','phonecalls','Subjects','Descriptions','callDirection','ticketId','format','user:%s','emit','remoteUri','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\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','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','userEmail','email','length','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','4.0','body','headers','odata-entityid','substring','lastIndexOf','telephone1','contacts?$select=','&$filter=','%2b'];(function(_0x3acaa2,_0x316a08){var _0x5ef89f=function(_0x5b9495){while(--_0x5b9495){_0x3acaa2['push'](_0x3acaa2['shift']());}};_0x5ef89f(++_0x316a08);}(_0xb0dc,0x1ec));var _0xcb0d=function(_0x508c77,_0x4a45ae){_0x508c77=_0x508c77-0x0;var _0x1e57ad=_0xb0dc[_0x508c77];return _0x1e57ad;};'use strict';var _=require(_0xcb0d('0x0'));var rp=require(_0xcb0d('0x1'));var util=require(_0xcb0d('0x2'));var intUtil=require(_0xcb0d('0x3'));var md5=require('md5');var Redis=require(_0xcb0d('0x4'));var logger=require(_0xcb0d('0x5'))(_0xcb0d('0x6'));var config=require(_0xcb0d('0x7'));config[_0xcb0d('0x8')]=_[_0xcb0d('0x9')](config[_0xcb0d('0x8')],{'host':_0xcb0d('0xa'),'port':0x18eb});var io=require(_0xcb0d('0xb'))(new Redis(config[_0xcb0d('0x8')]));function getAuthToken(_0x41be2e,_0x2168b2,_0x279a22){if(_0x41be2e[_0xcb0d('0xc')]){_0x41be2e['remoteUri']=_0x41be2e['CloudProvider']['data7'];_0x41be2e['tenantId']=_0x41be2e[_0xcb0d('0xd')]['data2'];return Promise['resolve'](_0x41be2e[_0xcb0d('0xd')][_0xcb0d('0xe')]);}var _0x5f0faf={'method':_0xcb0d('0xf'),'uri':_0x2168b2,'form':{'client_id':_0x41be2e[_0xcb0d('0x10')],'resource':_0x41be2e['remoteUri'],'username':_0x41be2e[_0xcb0d('0x11')],'password':_0x41be2e[_0xcb0d('0x12')],'grant_type':_0xcb0d('0x12'),'client_secret':_0x41be2e[_0xcb0d('0x13')]},'json':!![]};return rp(_0x5f0faf)[_0xcb0d('0x14')](function(_0x59a47c){return _0x59a47c[_0xcb0d('0x15')];})[_0xcb0d('0x16')](function(_0x9ae434){logger[_0xcb0d('0x17')]('['+[_0x279a22[_0xcb0d('0x18')]()]+_0xcb0d('0x19'));return _0x9ae434[_0xcb0d('0x1a')];});}function getUser(_0x7abfd,_0x7c5ae1,_0x156e11,_0x217b25,_0x35b8f5,_0xc3ed35){return new Promise(function(_0x13ca58,_0x181f31){return getAuthToken(_0x7c5ae1,_0x217b25,_0xc3ed35)['then'](function(_0x27bc9c){var _0x227e94={'method':_0xcb0d('0x1b'),'uri':_0x35b8f5+_0xcb0d('0x1c'),'headers':{'Authorization':'Bearer\x20'+_0x27bc9c,'OData-Version':'4.0'},'json':!![]};return rp(_0x227e94);})[_0xcb0d('0x14')](function(_0x1e2e23){var _0x125ab8=_0x1e2e23[_0xcb0d('0x1d')];var _0x42d857=![];var _0x129901=null;if(!_[_0xcb0d('0x1e')](_0x156e11)){if(intUtil[_0xcb0d('0x1f')](_0x156e11['email'])){_0x7abfd[_0xcb0d('0x20')]=_0x156e11[_0xcb0d('0x21')];for(_0x129901=0x0;_0x129901<_0x125ab8[_0xcb0d('0x22')];_0x129901++){if(_0x125ab8[_0x129901]['internalemailaddress']===_0x156e11['email']&&!_0x125ab8[_0x129901]['isdisabled']){_0x42d857=!![];logger[_0xcb0d('0x23')]('['+[_0xc3ed35[_0xcb0d('0x18')]()]+_0xcb0d('0x24')+_0x125ab8[_0x129901][_0xcb0d('0x25')]+'!');_0x7abfd[_0xcb0d('0x26')]=_0x125ab8[_0x129901][_0xcb0d('0x25')];}}}}if(!_0x42d857){logger[_0xcb0d('0x23')]('['+[_0xc3ed35[_0xcb0d('0x18')]()]+_0xcb0d('0x27'));_0x7abfd[_0xcb0d('0x20')]=_0x7c5ae1[_0xcb0d('0x11')];for(_0x129901=0x0;_0x129901<_0x125ab8['length'];_0x129901++){if(_0x125ab8[_0x129901][_0xcb0d('0x28')]===_0x7c5ae1[_0xcb0d('0x11')]){_0x7abfd[_0xcb0d('0x26')]=_0x125ab8[_0x129901][_0xcb0d('0x25')];}}}_0x13ca58(_0x7abfd);})[_0xcb0d('0x16')](function(_0x130d33){_0x181f31(_0x130d33[_0xcb0d('0x1a')]);});});}function createEndUser(_0xfc7105,_0x2c21d0,_0x58da91,_0x4fd064,_0x33749d,_0x40ea0e,_0x277633){return new Promise(function(_0xdbde40,_0x248597){return getAuthToken(_0x2c21d0,_0x58da91,_0x40ea0e)[_0xcb0d('0x14')](function(_0x40a1cd){var _0x8c143c=_0x40ea0e[_0xcb0d('0x29')]()===_0xcb0d('0x2a')?_0x33749d[_0xcb0d('0x2b')]:_0x33749d[_0xcb0d('0x2c')];var _0xcae778={'method':_0xcb0d('0xf'),'uri':_0x4fd064+_0xcb0d('0x2d'),'body':{'fullname':_0x8c143c,'firstname':_0x8c143c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xcb0d('0x2e')+_0xfc7105[_0xcb0d('0x26')]+')'},'headers':{'Authorization':_0xcb0d('0x2f')+_0x40a1cd,'OData-Version':_0xcb0d('0x30')},'json':!![],'resolveWithFullResponse':!![]};_0xcae778[_0xcb0d('0x31')][_0x277633]=_0x8c143c;return rp(_0xcae778);})[_0xcb0d('0x14')](function(_0x54c37d){var _0x4b6208=_0x54c37d[_0xcb0d('0x32')][_0xcb0d('0x33')];var _0x5ac9c7=_0x4b6208[_0xcb0d('0x34')](_0x4b6208[_0xcb0d('0x35')]('(')+0x1,_0x4b6208[_0xcb0d('0x35')](')'));_0xfc7105['enduserId']=_0x5ac9c7;_0xdbde40(_0xfc7105);})[_0xcb0d('0x16')](function(_0x565e14){_0x248597(_0x565e14[_0xcb0d('0x1a')]);});});}function getEndUser(_0x1e0789,_0x5e38d1,_0x1823b6,_0x553c8b,_0x45ea77,_0xc1823a,_0x31e830,_0x1d9105){var _0x4f08a7=_0xc1823a['toLowerCase']()===_0xcb0d('0x2a')?_0x45ea77[_0xcb0d('0x2b')]:_0x45ea77['calleridnum'];return getAuthToken(_0x5e38d1,_0x1823b6,_0xc1823a)[_0xcb0d('0x14')](function(_0x3eb5a6){_0x1d9105=_0x1d9105?_0x1d9105:_0xcb0d('0x36');var _0x4f4130={'method':_0xcb0d('0x1b'),'uri':_0x553c8b+_0xcb0d('0x37')+_0x1d9105+_0xcb0d('0x38')+_0x1d9105+'\x20eq\x20\x27'+_0x4f08a7['replace']('+',_0xcb0d('0x39'))+'\x27','headers':{'Authorization':_0xcb0d('0x2f')+_0x3eb5a6,'If-None-Match':null,'OData-Version':_0xcb0d('0x30')},'json':!![]};return rp(_0x4f4130);})[_0xcb0d('0x14')](function(_0x1a7fcf){var _0x2a5434=![];if(!_0x1a7fcf)return _0x2a5434;var _0x357998=_0x1a7fcf['value'];for(var _0x25d226=0x0;_0x25d226<_0x357998['length'];_0x25d226++){if(_0x357998[_0x25d226][_0x1d9105]===_0x4f08a7){_0x2a5434=!![];_0x1e0789['enduserId']=_0x357998[_0x25d226][_0xcb0d('0x3a')];}}return _0x2a5434;})[_0xcb0d('0x14')](function(_0x548feb){if(_0x548feb)return _0x1e0789;if(_0x31e830===_0xcb0d('0x3b')){logger[_0xcb0d('0x23')]('['+[_0xc1823a[_0xcb0d('0x18')]()]+_0xcb0d('0x3c'));return _0x1e0789;}return createEndUser(_0x1e0789,_0x5e38d1,_0x1823b6,_0x553c8b,_0x45ea77,_0xc1823a,_0x1d9105)[_0xcb0d('0x14')](function(_0x2ca487){logger[_0xcb0d('0x23')]('['+[_0xc1823a['toUpperCase']()]+_0xcb0d('0x3d'),_0x2ca487[_0xcb0d('0x3e')]);return _0x2ca487;});});}function getCustomFields(_0x5a7b9a,_0xb4c32f,_0x410dca){var _0x17d3de={};if(_0x5a7b9a[_0xcb0d('0x22')]>0x0){_['forEach'](_0x5a7b9a,function(_0x696405){if(_['includes']([_0xcb0d('0x3f'),_0xcb0d('0x40')],_0x696405[_0xcb0d('0x41')])&&_0x696405[_0xcb0d('0x42')]&&!_0x696405['customField']){var _0x56b3b1=_0x696405[_0xcb0d('0x43')][_0xcb0d('0x29')]();var _0x5e667d=_0x56b3b1['substring'](0x0,_0x56b3b1[_0xcb0d('0x44')]('_'));var _0x3cca40=_0x56b3b1[_0xcb0d('0x34')](_0x56b3b1['indexOf']('_')+0x1);if(_0x5e667d===_0x410dca){_0x17d3de[_0x3cca40]=_0x696405['content'];}}});}return _0x17d3de;}function getTicket(_0x3767f9,_0x2a9226,_0x5bc3e7,_0x1e3fe0,_0x3d29e0,_0x49f3ac,_0x4d50a6){return new Promise(function(_0xe1abac,_0x3dd53c){var _0x752b85;return getAuthToken(_0x2a9226,_0x5bc3e7,_0x4d50a6)[_0xcb0d('0x14')](function(_0x1b7a92){if(_0x49f3ac[_0xcb0d('0x45')]===_0xcb0d('0x46')){_0x752b85={'method':'POST','uri':_0x1e3fe0+_0xcb0d('0x47'),'body':Object[_0xcb0d('0x48')]({},{'title':intUtil[_0xcb0d('0x49')](_0x49f3ac['Subjects'],_0x3d29e0,'\x20'),'description':intUtil[_0xcb0d('0x49')](_0x49f3ac['Descriptions'],_0x3d29e0,'\x0a'),'customerid_contact@odata.bind':_0x3767f9[_0xcb0d('0x3e')]?_0xcb0d('0x4a')+_0x3767f9[_0xcb0d('0x3e')]+')':undefined,'ownerid@odata.bind':_0xcb0d('0x2e')+_0x3767f9[_0xcb0d('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x49f3ac[_0xcb0d('0x4b')],_0x3d29e0,_0x49f3ac['ticketType'])),'headers':{'Authorization':_0xcb0d('0x2f')+_0x1b7a92,'OData-Version':_0xcb0d('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x49f3ac[_0xcb0d('0x45')]==='phonecall'){var _0x103112=_0x3767f9[_0xcb0d('0x3e')]?[{'partyid_systemuser@odata.bind':_0xcb0d('0x2e')+_0x3767f9['userId']+')','participationtypemask':_0x3767f9['callDirection']===_0xcb0d('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0xcb0d('0x4a')+_0x3767f9['enduserId']+')','participationtypemask':_0x3767f9['callDirection']===_0xcb0d('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xcb0d('0x2e')+_0x3767f9[_0xcb0d('0x26')]+')','participationtypemask':_0x3767f9['callDirection']===_0xcb0d('0x4c')?0x2:0x1}];_0x752b85={'method':_0xcb0d('0xf'),'uri':_0x1e3fe0+_0xcb0d('0x4d'),'body':Object['assign']({},{'subject':intUtil[_0xcb0d('0x49')](_0x49f3ac[_0xcb0d('0x4e')],_0x3d29e0,'\x20'),'phonenumber':String(_0x3d29e0[_0xcb0d('0x2c')]),'description':intUtil[_0xcb0d('0x49')](_0x49f3ac[_0xcb0d('0x4f')],_0x3d29e0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3767f9[_0xcb0d('0x3e')]?'/contacts('+_0x3767f9['enduserId']+')':undefined,'ownerid@odata.bind':_0xcb0d('0x2e')+_0x3767f9[_0xcb0d('0x26')]+')','directioncode':_0x3767f9[_0xcb0d('0x50')]===_0xcb0d('0x4c')?![]:!![],'phonecall_activity_parties':_0x103112},getCustomFields(_0x49f3ac['Fields'],_0x3d29e0,_0x49f3ac[_0xcb0d('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x1b7a92,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x752b85);})['then'](function(_0x2cec67){var _0xdf133b=_0x2cec67[_0xcb0d('0x32')][_0xcb0d('0x33')];var _0x516d7c=_0xdf133b[_0xcb0d('0x34')](_0xdf133b[_0xcb0d('0x35')]('(')+0x1,_0xdf133b[_0xcb0d('0x35')](')'));_0x3767f9[_0xcb0d('0x51')]=_0x516d7c;_0xe1abac(_0x3767f9);})[_0xcb0d('0x16')](function(_0x1e8477){_0x3dd53c(_0x1e8477[_0xcb0d('0x1a')]);});});}function emit(_0x2f448e,_0x769567,_0x3fbe8f,_0xc2c030){var _0x3e8b6c={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x2f448e,_0x3fbe8f,_0xc2c030)};io['to'](util[_0xcb0d('0x52')](_0xcb0d('0x53'),_0x769567))[_0xcb0d('0x54')]('trigger:browser:url',_0x3e8b6c);}exports['cs']=function(_0x40c843,_0x296745,_0x1265b7,_0x701e83,_0x14f7c7,_0x1a9a65,_0x20f5e4,_0x5a0281){var _0x11a910={};_0x1a9a65[_0xcb0d('0x55')]=_0x1a9a65['modernAuthentication']?intUtil[_0xcb0d('0x56')](_0x1a9a65['CloudProvider'][_0xcb0d('0x57')]):intUtil[_0xcb0d('0x56')](_0x1a9a65[_0xcb0d('0x55')]);_0x1a9a65['serverUrl']=intUtil[_0xcb0d('0x56')](_0x1a9a65[_0xcb0d('0x58')]);_0x11a910[_0xcb0d('0x50')]=_0x5a0281==='queue'||_0x5a0281===_0xcb0d('0x59')?_0xcb0d('0x4c'):_0xcb0d('0x2a');var _0x1f6643=_0x1a9a65[_0xcb0d('0xc')]?util[_0xcb0d('0x52')](_0xcb0d('0x5a'),_0x1a9a65[_0xcb0d('0xd')][_0xcb0d('0x57')]):util[_0xcb0d('0x52')](_0xcb0d('0x5a'),_0x1a9a65[_0xcb0d('0x55')]);var _0x1db30a=util[_0xcb0d('0x52')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1a9a65[_0xcb0d('0x5b')]);var _0x4b1a5a=util['format'](_0xcb0d('0x5c'),_0x1a9a65['serverUrl'],_0x296745[_0xcb0d('0x5d')],md5(_0x296745['uniqueid']));if(_0x14f7c7&&_0x14f7c7[_0xcb0d('0x5e')]){logger[_0xcb0d('0x23')]('[QUEUE]',_0xcb0d('0x5f'));_0x296745[_0xcb0d('0x60')]=_0x4b1a5a;}else if(_0x20f5e4&&_0x20f5e4['recordingFormat']&&_0x20f5e4[_0xcb0d('0x61')]!==_0xcb0d('0x62')){logger['info'](_0xcb0d('0x63'),'Recording\x20is\x20enabled!');_0x296745[_0xcb0d('0x60')]=_0x4b1a5a;}else{_0x296745['recordingURL']='';}return getUser(_0x11a910,_0x1a9a65,_0x701e83,_0x1db30a,_0x1f6643,_0x5a0281)['then'](function(_0x2b17d5){logger['info']('['+_0x5a0281['toUpperCase']()+_0xcb0d('0x64'),_0x2b17d5[_0xcb0d('0x26')]);logger[_0xcb0d('0x23')]('['+_0x5a0281['toUpperCase']()+_0xcb0d('0x65'),_0x2b17d5[_0xcb0d('0x20')]);return getEndUser(_0x2b17d5,_0x1a9a65,_0x1db30a,_0x1f6643,_0x296745,_0x5a0281,_0x1265b7[_0xcb0d('0x66')],_0x1265b7['additionalSearchContact']);})[_0xcb0d('0x14')](function(_0x1ea14f){logger[_0xcb0d('0x23')]('['+_0x5a0281[_0xcb0d('0x18')]()+_0xcb0d('0x67'),_0x1ea14f['enduserId']);logger[_0xcb0d('0x23')]('['+_0x5a0281[_0xcb0d('0x18')]()+_0xcb0d('0x68'),_0x296745[_0xcb0d('0x2c')]);return getTicket(_0x1ea14f,_0x1a9a65,_0x1db30a,_0x1f6643,_0x296745,_0x1265b7,_0x5a0281);})['then'](function(_0x3685bc){logger['info'](util[_0xcb0d('0x52')]('['+_0x5a0281[_0xcb0d('0x18')]()+_0xcb0d('0x69'),_0x1265b7['ticketType'],_0x3685bc['ticketId']));logger['info'](util['format']('['+_0x5a0281[_0xcb0d('0x18')]()+_0xcb0d('0x6a'),_0x5a0281));if(_0x5a0281!=='unmanaged'&&_0x1265b7['openNewTab']){logger['info']('['+_0x5a0281['toUpperCase']()+']',_0xcb0d('0x6b'));emit(_0x1a9a65[_0xcb0d('0x55')],_0x701e83[_0xcb0d('0x6c')],_0x1265b7[_0xcb0d('0x45')],_0x3685bc[_0xcb0d('0x51')]);}})[_0xcb0d('0x16')](function(_0xde4362){logger[_0xcb0d('0x17')]('['+_0x5a0281[_0xcb0d('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0xde4362[_0xcb0d('0x1a')]);console[_0xcb0d('0x17')](_0xcb0d('0x6d'),_0xde4362);});}; \ 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 58e4599..67116b6 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 _0x1799=['info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','then','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','customField','idField','push','content','variableName','customVariable','Variable','toLowerCase','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','outbound','recordingFormat','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Authorization','catch','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','application/json','emit'];(function(_0x565b47,_0x2ee1bf){var _0x1ba108=function(_0x17613d){while(--_0x17613d){_0x565b47['push'](_0x565b47['shift']());}};_0x1ba108(++_0x2ee1bf);}(_0x1799,0x158));var _0x9179=function(_0x22a920,_0x94967){_0x22a920=_0x22a920-0x0;var _0x4ca1a9=_0x1799[_0x22a920];return _0x4ca1a9;};'use strict';var _=require('lodash');var rp=require(_0x9179('0x0'));var md5=require(_0x9179('0x1'));var util=require(_0x9179('0x2'));var Redis=require(_0x9179('0x3'));var intUtil=require(_0x9179('0x4'));var config=require(_0x9179('0x5'));var logger=require(_0x9179('0x6'))(_0x9179('0x7'));config[_0x9179('0x8')]=_[_0x9179('0x9')](config[_0x9179('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9179('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x9179('0xa')};function emit(_0x4d5b94,_0x659ac5,_0x287d3a){io['to'](_0x4d5b94)[_0x9179('0xb')](_0x659ac5,_0x287d3a);}function getTicket(_0x11cb67,_0x1545dd,_0x842036,_0x1c82dd,_0x3249f8){logger[_0x9179('0xc')]('Creating\x20new\x20ticket...');var _0x546236=_[_0x9179('0xd')]({'responder_id':_0x1545dd['id'],'requester_id':_0x842036['id'],'name':util[_0x9179('0xe')](_0x9179('0xf'),_0x3249f8[_0x9179('0x10')]),'phone':_0x3249f8[_0x9179('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9179('0x12')](_0x1c82dd[_0x9179('0x13')],_0x3249f8,'\x20'),'description':intUtil['getString'](_0x1c82dd['Descriptions'],_0x3249f8,'
'),'tags':getTags(_0x1c82dd[_0x9179('0x14')],_0x9179('0x15'))},getCustomFields(_0x1c82dd[_0x9179('0x16')],_0x3249f8));_0x546236[_0x9179('0x17')]=_[_0x9179('0x18')](_[_0x9179('0x19')](_0x546236[_0x9179('0x17')],'id'),'value');return request({'uri':util['format'](_0x9179('0x1a'),_0x11cb67['remoteUri']),'method':_0x9179('0x1b'),'body':_0x546236})[_0x9179('0x1c')](function(_0x10cefe){logger[_0x9179('0xc')]('Ticket\x20created!');return _0x10cefe;});}function getUser(_0x597be5,_0x42951c){if(intUtil[_0x9179('0x1d')](_0x42951c)){return request({'uri':util[_0x9179('0xe')](_0x9179('0x1e'),_0x597be5[_0x9179('0x1f')]),'qs':{'email':_0x42951c}})[_0x9179('0x1c')](function(_0x19a635){if(_0x19a635['length']){logger[_0x9179('0xc')](_0x9179('0x20'));return _[_0x9179('0x21')](_0x19a635,function(_0x1ec64a){return _0x1ec64a[_0x9179('0x22')][_0x9179('0x23')]===_0x42951c;});}else{logger[_0x9179('0xc')](_0x9179('0x24'));return request({'uri':util[_0x9179('0xe')](_0x9179('0x25'),_0x597be5[_0x9179('0x1f')])})[_0x9179('0x1c')](function(_0x13be9e){logger['info'](_0x9179('0x26'));return _0x13be9e;});}});}else{logger[_0x9179('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9179('0xe')](_0x9179('0x25'),_0x597be5['remoteUri'])})[_0x9179('0x1c')](function(_0x52ee2f){logger[_0x9179('0xc')](_0x9179('0x26'));return _0x52ee2f;});}}function getEndUser(_0x54c8e7,_0x158140,_0xb0370a){logger[_0x9179('0xc')]('Searching\x20enduser\x20with\x20phone',_0xb0370a);return request({'uri':util[_0x9179('0xe')](_0x9179('0x27'),_0x54c8e7[_0x9179('0x1f')]),'qs':{'phone':_0xb0370a}})['then'](function(_0x5b58ad){if(_0x5b58ad[_0x9179('0x28')]){logger[_0x9179('0xc')](_0x9179('0x29'));return _[_0x9179('0x21')](_0x5b58ad,{'phone':_0xb0370a});}else{logger[_0x9179('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x9179('0xe')](_0x9179('0x27'),_0x54c8e7[_0x9179('0x1f')]),'method':_0x9179('0x1b'),'body':{'name':_0x158140,'phone':_0xb0370a}})[_0x9179('0x1c')](function(_0x47ca81){logger['info'](_0x9179('0x2a'));return _0x47ca81;});}});}function getAuth(_0x3c70be){return util[_0x9179('0xe')](_0x9179('0x2b'),new Buffer(_0x3c70be[_0x9179('0x2c')]+':X')[_0x9179('0x2d')]('base64'));}function request(_0x2ca77e){logger['debug'](_0x9179('0x2e'),JSON['stringify'](_0x2ca77e));return rp(_[_0x9179('0x9')](_0x2ca77e,{'method':_0x9179('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x22620a,_0x58ba4a){var _0x2d5efd=[];if(_0x22620a&&_0x22620a[_0x9179('0x28')]>0x0){_0x2d5efd=_[_0x9179('0x30')](_0x22620a,_0x58ba4a);}return _0x2d5efd;}function getCustomFields(_0x1b0df5,_0x16225f){var _0x21be2c=[];var _0x21824f={'custom_fields':[]};if(_0x1b0df5[_0x9179('0x28')]>0x0){_[_0x9179('0x31')](_0x1b0df5,function(_0x376858){if(_[_0x9179('0x32')]([_0x9179('0x33'),_0x9179('0x34')],_0x376858[_0x9179('0x35')])&&_0x376858[_0x9179('0x36')]&&!_0x376858[_0x9179('0x37')]){_0x21824f[_0x376858['nameField']['toLowerCase']()]=_0x376858['content'][_0x9179('0x2d')]();}else if(_['includes']([_0x9179('0x33'),'picklist'],_0x376858[_0x9179('0x35')])&&_0x376858[_0x9179('0x38')]&&_0x376858[_0x9179('0x37')]){_0x21824f[_0x9179('0x17')][_0x9179('0x39')]({'id':_0x376858[_0x9179('0x38')],'value':_0x376858[_0x9179('0x3a')][_0x9179('0x2d')]()});}else if(_0x376858[_0x9179('0x35')]==='variable'&&_0x376858[_0x9179('0x3b')]&&_0x376858[_0x9179('0x38')]&&_0x376858[_0x9179('0x37')]){_0x16225f[_0x376858['variableName']]&&_0x21824f[_0x9179('0x17')][_0x9179('0x39')]({'id':_0x376858[_0x9179('0x38')],'value':_0x16225f[_0x376858[_0x9179('0x3b')]][_0x9179('0x2d')]()});}else if(_0x376858[_0x9179('0x35')]===_0x9179('0x3c')&&_0x376858['Variable']&&_0x376858[_0x9179('0x3d')][_0x9179('0x15')]&&_0x376858[_0x9179('0x38')]&&_0x376858[_0x9179('0x37')]){_0x16225f[_0x376858[_0x9179('0x3d')][_0x9179('0x15')][_0x9179('0x3e')]()]&&_0x21824f['custom_fields'][_0x9179('0x39')]({'id':_0x376858[_0x9179('0x38')],'value':_0x16225f[_0x376858[_0x9179('0x3d')][_0x9179('0x15')][_0x9179('0x3e')]()][_0x9179('0x2d')]()});}});}return _0x21824f;}exports['queue']=function(_0x5d92b6,_0x3a70de,_0x5069fe,_0x3a09c5,_0x119c6e,_0x2dc375){var _0x31333c,_0xf2e3cd;_0x2dc375[_0x9179('0x1f')]=intUtil['stripTrailingSlash'](_0x2dc375[_0x9179('0x1f')]);_0x2dc375[_0x9179('0x3f')]=intUtil[_0x9179('0x40')](_0x2dc375['serverUrl']);if(_0x119c6e&&_0x119c6e[_0x9179('0x41')]){logger[_0x9179('0xc')](_0x9179('0x42'),_0x9179('0x43'));_0x3a70de[_0x9179('0x44')]=util[_0x9179('0xe')](_0x9179('0x45'),_0x2dc375[_0x9179('0x3f')],_0x3a70de[_0x9179('0x46')],md5(_0x3a70de[_0x9179('0x46')]));}else{_0x3a70de[_0x9179('0x44')]='';}headers['Authorization']=getAuth(_0x2dc375);return getUser(_0x2dc375,_0x3a09c5['email'])[_0x9179('0x1c')](function(_0x51f631){_0x31333c=_0x51f631;logger['info'](_0x9179('0x47'),_0x31333c['id']);return getEndUser(_0x2dc375,_0x3a70de[_0x9179('0x10')],_0x3a70de[_0x9179('0x11')]);})[_0x9179('0x1c')](function(_0x324fb2){_0xf2e3cd=_0x324fb2;logger[_0x9179('0xc')](_0x9179('0x48'),_0xf2e3cd['id']);return getTicket(_0x2dc375,_0x31333c,_0xf2e3cd,_0x5069fe,_0x3a70de);})[_0x9179('0x1c')](function(_0x1672be){if(_0x1672be&&_0x1672be['id']){logger[_0x9179('0xc')](_0x9179('0x49'));logger['info'](_0x9179('0x4a'),_0x1672be['id']);logger[_0x9179('0xc')]('[QUEUE]',_0x9179('0x4b'));emit(util[_0x9179('0xe')](_0x9179('0x4c'),_0x3a09c5[_0x9179('0x15')]),_0x9179('0x4d'),{'uri':util[_0x9179('0xe')](_0x9179('0x4e'),_0x2dc375[_0x9179('0x1f')],_0x1672be['id'])});}})['catch'](function(_0x38755b){logger[_0x9179('0x4f')](_0x9179('0x42'),JSON[_0x9179('0x50')](_0x38755b));});};exports[_0x9179('0x51')]=function(_0x5af2c3,_0x29d888,_0x4ca395,_0x560240,_0x143c97,_0x271e87,_0x3274bc){var _0x5eac51,_0x144c50;_0x271e87[_0x9179('0x1f')]=intUtil[_0x9179('0x40')](_0x271e87[_0x9179('0x1f')]);_0x271e87[_0x9179('0x3f')]=intUtil[_0x9179('0x40')](_0x271e87[_0x9179('0x3f')]);if(_0x3274bc&&_0x3274bc[_0x9179('0x52')]&&_0x3274bc[_0x9179('0x52')]!=='none'){logger[_0x9179('0xc')](_0x9179('0x53'),'Recording\x20is\x20enabled!');_0x29d888[_0x9179('0x44')]=util[_0x9179('0xe')](_0x9179('0x45'),_0x271e87['serverUrl'],_0x29d888['uniqueid'],md5(_0x29d888[_0x9179('0x46')]));}headers['Authorization']=getAuth(_0x271e87);return getUser(_0x271e87,_0x560240[_0x9179('0x23')])['then'](function(_0x4908bb){_0x5eac51=_0x4908bb;logger[_0x9179('0xc')](_0x9179('0x47'),_0x5eac51['id']);return getEndUser(_0x271e87,_0x29d888['destcalleridname'],_0x29d888['destcalleridnum']);})[_0x9179('0x1c')](function(_0x3965c2){_0x144c50=_0x3965c2;logger[_0x9179('0xc')](_0x9179('0x48'),_0x144c50['id']);return getTicket(_0x271e87,_0x5eac51,_0x144c50,_0x4ca395,_0x29d888);})[_0x9179('0x1c')](function(_0x25f6a6){if(_0x25f6a6&&_0x25f6a6['id']){logger['info'](_0x9179('0x49'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x25f6a6['id']);logger[_0x9179('0xc')]('[OUTBOUND]',_0x9179('0x4b'));emit(util[_0x9179('0xe')](_0x9179('0x4c'),_0x560240[_0x9179('0x15')]),_0x9179('0x4d'),{'uri':util[_0x9179('0xe')]('%s/helpdesk/tickets/%d',_0x271e87[_0x9179('0x1f')],_0x25f6a6['id'])});}})['catch'](function(_0x1193a8){logger[_0x9179('0x4f')](_0x9179('0x53'),JSON[_0x9179('0x50')](_0x1193a8));});};exports[_0x9179('0x54')]=function(_0x3d6563,_0x280281,_0x1e8f79,_0x40bab0,_0x58a3fc,_0x282afe){var _0x101b70,_0x119726;_0x282afe['remoteUri']=intUtil['stripTrailingSlash'](_0x282afe[_0x9179('0x1f')]);_0x282afe[_0x9179('0x3f')]=intUtil['stripTrailingSlash'](_0x282afe[_0x9179('0x3f')]);if(_0x58a3fc&&_0x58a3fc['monitor_format']){logger[_0x9179('0xc')]('['+_0x280281[_0x9179('0x55')][_0x9179('0x56')]()+']',_0x9179('0x43'));_0x280281[_0x9179('0x44')]=util[_0x9179('0xe')](_0x9179('0x45'),_0x282afe[_0x9179('0x3f')],_0x280281[_0x9179('0x46')],md5(_0x280281[_0x9179('0x46')]));}else{_0x280281[_0x9179('0x44')]='';}headers[_0x9179('0x57')]=getAuth(_0x282afe);return getUser(_0x282afe,'')['then'](function(_0x4c3340){_0x101b70=_0x4c3340;logger[_0x9179('0xc')](_0x9179('0x47'),_0x101b70['id']);return getEndUser(_0x282afe,_0x280281[_0x9179('0x10')],_0x280281['calleridnum']);})[_0x9179('0x1c')](function(_0x26b81b){_0x119726=_0x26b81b;logger['info'](_0x9179('0x48'),_0x119726['id']);return getTicket(_0x282afe,_0x101b70,_0x119726,_0x1e8f79,_0x280281);})[_0x9179('0x1c')](function(_0x2c17e5){if(_0x2c17e5){logger[_0x9179('0xc')](_0x9179('0x49'));logger[_0x9179('0xc')](_0x9179('0x4a'),_0x2c17e5['id']);}})[_0x9179('0x58')](function(_0x2fd969){logger[_0x9179('0x4f')]('['+_0x280281[_0x9179('0x55')]['toUpperCase']()+']',JSON[_0x9179('0x50')](_0x2fd969));});}; \ No newline at end of file +var _0xa2d8=['Authorization','destcalleridnum','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','unmanaged','monitor_format','lastevent','toUpperCase','recordingURL','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','value','remoteUri','POST','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','then','apiKey','toString','debug','[HTTP]','stringify','map','string','picklist','type','nameField','customField','content','includes','idField','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','none','[OUTBOUND]'];(function(_0x2c969f,_0x7cf099){var _0x488c8f=function(_0x2e0983){while(--_0x2e0983){_0x2c969f['push'](_0x2c969f['shift']());}};_0x488c8f(++_0x7cf099);}(_0xa2d8,0x124));var _0x8a2d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa2d8[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x8a2d('0x0'));var rp=require(_0x8a2d('0x1'));var md5=require(_0x8a2d('0x2'));var util=require(_0x8a2d('0x3'));var Redis=require(_0x8a2d('0x4'));var intUtil=require(_0x8a2d('0x5'));var config=require(_0x8a2d('0x6'));var logger=require(_0x8a2d('0x7'))(_0x8a2d('0x8'));config['redis']=_[_0x8a2d('0x9')](config[_0x8a2d('0xa')],{'host':_0x8a2d('0xb'),'port':0x18eb});var io=require(_0x8a2d('0xc'))(new Redis(config['redis']));var headers={'Content-Type':_0x8a2d('0xd'),'Accept':'application/json'};function emit(_0x221b54,_0x150cf8,_0x1adc01){io['to'](_0x221b54)[_0x8a2d('0xe')](_0x150cf8,_0x1adc01);}function getTicket(_0x414c2f,_0x5d97c7,_0x596bd6,_0x5da7fc,_0xbf2549){logger[_0x8a2d('0xf')](_0x8a2d('0x10'));var _0xa0e4bf=_[_0x8a2d('0x11')]({'responder_id':_0x5d97c7['id'],'requester_id':_0x596bd6['id'],'name':util[_0x8a2d('0x12')]('Caller\x20-\x20%s',_0xbf2549[_0x8a2d('0x13')]),'phone':_0xbf2549[_0x8a2d('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8a2d('0x15')](_0x5da7fc[_0x8a2d('0x16')],_0xbf2549,'\x20'),'description':intUtil[_0x8a2d('0x15')](_0x5da7fc[_0x8a2d('0x17')],_0xbf2549,_0x8a2d('0x18')),'tags':getTags(_0x5da7fc[_0x8a2d('0x19')],_0x8a2d('0x1a'))},getCustomFields(_0x5da7fc[_0x8a2d('0x1b')],_0xbf2549));_0xa0e4bf[_0x8a2d('0x1c')]=_['mapValues'](_['keyBy'](_0xa0e4bf['custom_fields'],'id'),_0x8a2d('0x1d'));return request({'uri':util[_0x8a2d('0x12')]('%s/api/v2/tickets',_0x414c2f[_0x8a2d('0x1e')]),'method':_0x8a2d('0x1f'),'body':_0xa0e4bf})['then'](function(_0xc25b60){logger[_0x8a2d('0xf')]('Ticket\x20created!');return _0xc25b60;});}function getUser(_0x1b6074,_0x1daed6){if(intUtil[_0x8a2d('0x20')](_0x1daed6)){return request({'uri':util[_0x8a2d('0x12')](_0x8a2d('0x21'),_0x1b6074[_0x8a2d('0x1e')]),'qs':{'email':_0x1daed6}})['then'](function(_0x28740d){if(_0x28740d['length']){logger[_0x8a2d('0xf')](_0x8a2d('0x22'));return _[_0x8a2d('0x23')](_0x28740d,function(_0x487089){return _0x487089[_0x8a2d('0x24')][_0x8a2d('0x25')]===_0x1daed6;});}else{logger[_0x8a2d('0xf')](_0x8a2d('0x26'));return request({'uri':util[_0x8a2d('0x12')](_0x8a2d('0x27'),_0x1b6074['remoteUri'])})['then'](function(_0x22979e){logger[_0x8a2d('0xf')](_0x8a2d('0x28'));return _0x22979e;});}});}else{logger[_0x8a2d('0xf')](_0x8a2d('0x29'));return request({'uri':util[_0x8a2d('0x12')](_0x8a2d('0x27'),_0x1b6074['remoteUri'])})['then'](function(_0x31ec5c){logger[_0x8a2d('0xf')](_0x8a2d('0x28'));return _0x31ec5c;});}}function getEndUser(_0x41d40d,_0x4e6d3c,_0x2756a8){logger['info'](_0x8a2d('0x2a'),_0x2756a8);return request({'uri':util[_0x8a2d('0x12')](_0x8a2d('0x2b'),_0x41d40d[_0x8a2d('0x1e')]),'qs':{'phone':_0x2756a8}})['then'](function(_0x4dca85){if(_0x4dca85[_0x8a2d('0x2c')]){logger[_0x8a2d('0xf')](_0x8a2d('0x2d'));return _['find'](_0x4dca85,{'phone':_0x2756a8});}else{logger[_0x8a2d('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x8a2d('0x12')]('%s/api/v2/contacts',_0x41d40d[_0x8a2d('0x1e')]),'method':_0x8a2d('0x1f'),'body':{'name':_0x4e6d3c,'phone':_0x2756a8}})[_0x8a2d('0x2e')](function(_0x3a1a4b){logger[_0x8a2d('0xf')]('Enduser\x20created.');return _0x3a1a4b;});}});}function getAuth(_0x333604){return util[_0x8a2d('0x12')]('Basic\x20%s',new Buffer(_0x333604[_0x8a2d('0x2f')]+':X')[_0x8a2d('0x30')]('base64'));}function request(_0x3df336){logger[_0x8a2d('0x31')](_0x8a2d('0x32'),JSON[_0x8a2d('0x33')](_0x3df336));return rp(_[_0x8a2d('0x9')](_0x3df336,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x239163,_0x55d916){var _0x36c958=[];if(_0x239163&&_0x239163[_0x8a2d('0x2c')]>0x0){_0x36c958=_[_0x8a2d('0x34')](_0x239163,_0x55d916);}return _0x36c958;}function getCustomFields(_0x68a321,_0x4fb3d9){var _0x211b1d=[];var _0x40c361={'custom_fields':[]};if(_0x68a321['length']>0x0){_['forEach'](_0x68a321,function(_0x42ee88){if(_['includes']([_0x8a2d('0x35'),_0x8a2d('0x36')],_0x42ee88[_0x8a2d('0x37')])&&_0x42ee88[_0x8a2d('0x38')]&&!_0x42ee88[_0x8a2d('0x39')]){_0x40c361[_0x42ee88['nameField']['toLowerCase']()]=_0x42ee88[_0x8a2d('0x3a')][_0x8a2d('0x30')]();}else if(_[_0x8a2d('0x3b')]([_0x8a2d('0x35'),_0x8a2d('0x36')],_0x42ee88[_0x8a2d('0x37')])&&_0x42ee88[_0x8a2d('0x3c')]&&_0x42ee88['customField']){_0x40c361[_0x8a2d('0x1c')][_0x8a2d('0x3d')]({'id':_0x42ee88[_0x8a2d('0x3c')],'value':_0x42ee88[_0x8a2d('0x3a')]['toString']()});}else if(_0x42ee88[_0x8a2d('0x37')]===_0x8a2d('0x3e')&&_0x42ee88[_0x8a2d('0x3f')]&&_0x42ee88[_0x8a2d('0x3c')]&&_0x42ee88[_0x8a2d('0x39')]){_0x4fb3d9[_0x42ee88['variableName']]&&_0x40c361[_0x8a2d('0x1c')][_0x8a2d('0x3d')]({'id':_0x42ee88[_0x8a2d('0x3c')],'value':_0x4fb3d9[_0x42ee88['variableName']][_0x8a2d('0x30')]()});}else if(_0x42ee88[_0x8a2d('0x37')]==='customVariable'&&_0x42ee88[_0x8a2d('0x40')]&&_0x42ee88[_0x8a2d('0x40')][_0x8a2d('0x1a')]&&_0x42ee88[_0x8a2d('0x3c')]&&_0x42ee88[_0x8a2d('0x39')]){_0x4fb3d9[_0x42ee88[_0x8a2d('0x40')][_0x8a2d('0x1a')]['toLowerCase']()]&&_0x40c361[_0x8a2d('0x1c')][_0x8a2d('0x3d')]({'id':_0x42ee88['idField'],'value':_0x4fb3d9[_0x42ee88['Variable'][_0x8a2d('0x1a')][_0x8a2d('0x41')]()]['toString']()});}});}return _0x40c361;}exports[_0x8a2d('0x42')]=function(_0x225ecc,_0x2ae104,_0x16b198,_0x3c5ae8,_0xfd1f7d,_0x507ad5){var _0x5e79c3,_0x2cd5ca;_0x507ad5['remoteUri']=intUtil[_0x8a2d('0x43')](_0x507ad5[_0x8a2d('0x1e')]);_0x507ad5[_0x8a2d('0x44')]=intUtil[_0x8a2d('0x43')](_0x507ad5[_0x8a2d('0x44')]);if(_0xfd1f7d&&_0xfd1f7d['monitor_format']){logger['info'](_0x8a2d('0x45'),_0x8a2d('0x46'));_0x2ae104['recordingURL']=util[_0x8a2d('0x12')](_0x8a2d('0x47'),_0x507ad5['serverUrl'],_0x2ae104[_0x8a2d('0x48')],md5(_0x2ae104[_0x8a2d('0x48')]));}else{_0x2ae104['recordingURL']='';}headers['Authorization']=getAuth(_0x507ad5);return getUser(_0x507ad5,_0x3c5ae8['email'])[_0x8a2d('0x2e')](function(_0x41517d){_0x5e79c3=_0x41517d;logger[_0x8a2d('0xf')](_0x8a2d('0x49'),_0x5e79c3['id']);return getEndUser(_0x507ad5,_0x2ae104['calleridname'],_0x2ae104['calleridnum']);})[_0x8a2d('0x2e')](function(_0x143cb7){_0x2cd5ca=_0x143cb7;logger['info'](_0x8a2d('0x4a'),_0x2cd5ca['id']);return getTicket(_0x507ad5,_0x5e79c3,_0x2cd5ca,_0x16b198,_0x2ae104);})[_0x8a2d('0x2e')](function(_0x1c9110){if(_0x1c9110&&_0x1c9110['id']){logger[_0x8a2d('0xf')](_0x8a2d('0x4b'));logger[_0x8a2d('0xf')](_0x8a2d('0x4c'),_0x1c9110['id']);logger[_0x8a2d('0xf')](_0x8a2d('0x45'),_0x8a2d('0x4d'));emit(util['format']('user:%s',_0x3c5ae8[_0x8a2d('0x1a')]),'trigger:browser:url',{'uri':util[_0x8a2d('0x12')]('%s/helpdesk/tickets/%d',_0x507ad5[_0x8a2d('0x1e')],_0x1c9110['id'])});}})[_0x8a2d('0x4e')](function(_0x35d2d3){logger[_0x8a2d('0x4f')](_0x8a2d('0x45'),JSON[_0x8a2d('0x33')](_0x35d2d3));});};exports[_0x8a2d('0x50')]=function(_0x25f98f,_0x26dbe2,_0x287e9c,_0x31cf7b,_0x272846,_0x2d33dc,_0x1baee8){var _0x1954b0,_0x5b4898;_0x2d33dc['remoteUri']=intUtil[_0x8a2d('0x43')](_0x2d33dc[_0x8a2d('0x1e')]);_0x2d33dc[_0x8a2d('0x44')]=intUtil[_0x8a2d('0x43')](_0x2d33dc[_0x8a2d('0x44')]);if(_0x1baee8&&_0x1baee8[_0x8a2d('0x51')]&&_0x1baee8['recordingFormat']!==_0x8a2d('0x52')){logger[_0x8a2d('0xf')](_0x8a2d('0x53'),_0x8a2d('0x46'));_0x26dbe2['recordingURL']=util[_0x8a2d('0x12')](_0x8a2d('0x47'),_0x2d33dc[_0x8a2d('0x44')],_0x26dbe2[_0x8a2d('0x48')],md5(_0x26dbe2[_0x8a2d('0x48')]));}headers[_0x8a2d('0x54')]=getAuth(_0x2d33dc);return getUser(_0x2d33dc,_0x31cf7b[_0x8a2d('0x25')])[_0x8a2d('0x2e')](function(_0x524945){_0x1954b0=_0x524945;logger['info']('The\x20User\x20ID\x20is:',_0x1954b0['id']);return getEndUser(_0x2d33dc,_0x26dbe2['destcalleridname'],_0x26dbe2[_0x8a2d('0x55')]);})[_0x8a2d('0x2e')](function(_0x4dfeb8){_0x5b4898=_0x4dfeb8;logger['info'](_0x8a2d('0x4a'),_0x5b4898['id']);return getTicket(_0x2d33dc,_0x1954b0,_0x5b4898,_0x287e9c,_0x26dbe2);})[_0x8a2d('0x2e')](function(_0x182403){if(_0x182403&&_0x182403['id']){logger[_0x8a2d('0xf')](_0x8a2d('0x4b'));logger[_0x8a2d('0xf')](_0x8a2d('0x4c'),_0x182403['id']);logger['info'](_0x8a2d('0x53'),_0x8a2d('0x4d'));emit(util['format'](_0x8a2d('0x56'),_0x31cf7b[_0x8a2d('0x1a')]),_0x8a2d('0x57'),{'uri':util['format'](_0x8a2d('0x58'),_0x2d33dc[_0x8a2d('0x1e')],_0x182403['id'])});}})[_0x8a2d('0x4e')](function(_0x4222f0){logger[_0x8a2d('0x4f')](_0x8a2d('0x53'),JSON[_0x8a2d('0x33')](_0x4222f0));});};exports[_0x8a2d('0x59')]=function(_0x2f4387,_0x36ae27,_0x48860d,_0x12d91a,_0x552863,_0x11d43c){var _0x4bf087,_0x254045;_0x11d43c['remoteUri']=intUtil[_0x8a2d('0x43')](_0x11d43c['remoteUri']);_0x11d43c[_0x8a2d('0x44')]=intUtil[_0x8a2d('0x43')](_0x11d43c[_0x8a2d('0x44')]);if(_0x552863&&_0x552863[_0x8a2d('0x5a')]){logger[_0x8a2d('0xf')]('['+_0x36ae27[_0x8a2d('0x5b')][_0x8a2d('0x5c')]()+']',_0x8a2d('0x46'));_0x36ae27[_0x8a2d('0x5d')]=util[_0x8a2d('0x12')](_0x8a2d('0x47'),_0x11d43c[_0x8a2d('0x44')],_0x36ae27[_0x8a2d('0x48')],md5(_0x36ae27[_0x8a2d('0x48')]));}else{_0x36ae27['recordingURL']='';}headers[_0x8a2d('0x54')]=getAuth(_0x11d43c);return getUser(_0x11d43c,'')[_0x8a2d('0x2e')](function(_0x2f35d1){_0x4bf087=_0x2f35d1;logger['info'](_0x8a2d('0x49'),_0x4bf087['id']);return getEndUser(_0x11d43c,_0x36ae27['calleridname'],_0x36ae27[_0x8a2d('0x14')]);})[_0x8a2d('0x2e')](function(_0x110fa6){_0x254045=_0x110fa6;logger[_0x8a2d('0xf')]('The\x20Enduser\x20ID\x20is:',_0x254045['id']);return getTicket(_0x11d43c,_0x4bf087,_0x254045,_0x48860d,_0x36ae27);})[_0x8a2d('0x2e')](function(_0x38ffb6){if(_0x38ffb6){logger['info'](_0x8a2d('0x4b'));logger[_0x8a2d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x38ffb6['id']);}})[_0x8a2d('0x4e')](function(_0x3532c2){logger[_0x8a2d('0x4f')]('['+_0x36ae27['lastevent']['toUpperCase']()+']',JSON[_0x8a2d('0x33')](_0x3532c2));});}; \ 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 0157eb5..97414b5 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 _0x948f=['moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','&f=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','format','add','ticketId','task','Task\x20created:','/contacts/','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util'];(function(_0x38a9a7,_0x55e71d){var _0x20d700=function(_0x300438){while(--_0x300438){_0x38a9a7['push'](_0x38a9a7['shift']());}};_0x20d700(++_0x55e71d);}(_0x948f,0xa9));var _0xf948=function(_0x456f35,_0x124842){_0x456f35=_0x456f35-0x0;var _0x2e65dd=_0x948f[_0x456f35];return _0x2e65dd;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xf948('0x0'));var moment=require(_0xf948('0x1'));var Promise=require('bluebird');var Redis=require(_0xf948('0x2'));var intUtil=require(_0xf948('0x3'));var config=require(_0xf948('0x4'));var logger=require(_0xf948('0x5'))(_0xf948('0x6'));config[_0xf948('0x7')]=_[_0xf948('0x8')](config['redis'],{'host':_0xf948('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf948('0x7')]));function getAdminId(_0x2a5508,_0x21544c,_0x9d9b16,_0x434873){return new Promise(function(_0x464f29,_0x72130a){var _0x2c2d82=![];var _0x1fb3e1={'method':_0xf948('0xa'),'uri':_0x434873+'/api/selector/owners','json':!![]};_0x1fb3e1[_0xf948('0xb')]=_0x9d9b16;logger[_0xf948('0xc')](_0xf948('0xd'));return rp(_0x1fb3e1)[_0xf948('0xe')](function(_0x50f8e3){if(_0x50f8e3){var _0x53d517=_0x50f8e3[_0xf948('0xf')];var _0xb1b771=null;for(_0xb1b771=0x0;_0xb1b771<_0x53d517[_0xf948('0x10')];_0xb1b771++){if(_0x53d517[_0xb1b771][_0xf948('0x11')]===_0x2a5508[_0xf948('0x12')]){_0x2a5508[_0xf948('0x13')]=_0x53d517[_0xb1b771]['id'];_0x2c2d82=!![];}}if(_0x2c2d82){logger[_0xf948('0xc')](_0xf948('0x14'),_0x2a5508[_0xf948('0x13')]);_0x464f29(_0x2a5508);}else{_0x72130a({'statusCode':0x194,'message':_0xf948('0x15')});}}else{_0x72130a({'statusCode':0x194,'message':_0xf948('0x15')});}})[_0xf948('0x16')](function(_0x43af08){logger[_0xf948('0x17')]('['+[_0x21544c[_0xf948('0x18')]()]+']',_0x43af08[_0xf948('0x19')]);_0x72130a(_0x43af08);});});}function getUser(_0x2cb11f,_0x5ab838,_0x51f63c){return function(_0x2ef912){return new Promise(function(_0x2d77d6,_0x7b062a){var _0x164966={'method':_0xf948('0xa'),'uri':_0x51f63c+_0xf948('0x1a'),'json':!![]};_0x164966[_0xf948('0xb')]=_0x5ab838;logger[_0xf948('0xc')](_0xf948('0x1b'));return rp(_0x164966)['then'](function(_0x4791f2){if(_0x4791f2){var _0x153af4=_0x4791f2['users'];var _0x48f49e=![];var _0x45247c=null;if(_0x2ef912[_0xf948('0x1c')]!==null){logger[_0xf948('0xc')](_0xf948('0x1d'),_0x2ef912['agentEmail']);_0x2ef912[_0xf948('0x1e')]=_0x2ef912[_0xf948('0x1c')];for(_0x45247c=0x0;_0x45247c<_0x153af4[_0xf948('0x10')];_0x45247c++){if(_0x153af4[_0x45247c][_0xf948('0x11')]===_0x2ef912[_0xf948('0x1c')]){_0x48f49e=!![];_0x2ef912[_0xf948('0x1f')]=_0x153af4[_0x45247c]['id'];logger['info'](_0xf948('0x20'),_0x2ef912[_0xf948('0x1f')]);}}}if(!_0x48f49e){logger[_0xf948('0xc')]('Admin\x20selected');_0x2ef912[_0xf948('0x1e')]=_0x2ef912['adminEmail'];_0x2ef912[_0xf948('0x1f')]=_0x2ef912['adminId'];_0x48f49e=!![];}if(_0x48f49e){_0x2d77d6(_0x2ef912);}else{_0x7b062a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x7b062a({'statusCode':0x194,'message':_0xf948('0x15')});}})['catch'](function(_0x18ce1a){logger[_0xf948('0x17')]('['+[_0x2cb11f[_0xf948('0x18')]()]+']',_0x18ce1a[_0xf948('0x19')]);_0x7b062a(_0x18ce1a);});});};}function searchContact(_0x3a3659,_0x224916,_0x189455,_0x841d73){return new Promise(function(_0x4c13e7,_0xef0f50){var _0x347a8c={'method':'GET','headers':_0x224916,'uri':_0x3a3659+'/api/lookup?q='+_0x841d73+_0xf948('0x21')+_0x189455+_0xf948('0x22'),'json':!![]};rp(_0x347a8c)[_0xf948('0xe')](function(_0x168a85){var _0x4e8c0d=_['find'](_0x168a85[_0xf948('0x23')][_0xf948('0x23')],[_0x189455,_0x841d73]);_0x4c13e7(_0x4e8c0d);})[_0xf948('0x16')](function(_0x483d45){_0xef0f50(_0x483d45);});});}function getEndUser(_0x103b83,_0x1e012a,_0x1d2a81){return function(_0x1ad7ee){return new Promise(function(_0x49f25b,_0x3eb8a2){logger[_0xf948('0xc')](util['format'](_0xf948('0x24'),_0x1ad7ee[_0xf948('0x25')]));searchContact(_0x1d2a81,_0x1e012a,_0xf948('0x26'),_0x1ad7ee[_0xf948('0x25')])[_0xf948('0xe')](function(_0x2a33b1){if(_0x2a33b1){_0x1ad7ee['endUserId']=_0x2a33b1['id'];logger['info'](_0xf948('0x27'),_0x1ad7ee[_0xf948('0x28')]);return _0x49f25b(_0x1ad7ee);}searchContact(_0x1d2a81,_0x1e012a,_0xf948('0x29'),_0x1ad7ee[_0xf948('0x25')])[_0xf948('0xe')](function(_0x26692d){if(_0x26692d){_0x1ad7ee[_0xf948('0x28')]=_0x26692d['id'];logger['info'](_0xf948('0x2a'),_0x1ad7ee[_0xf948('0x28')]);return _0x49f25b(_0x1ad7ee);}createEndUser(_0x1ad7ee,_0x103b83,_0x1e012a,_0x1d2a81)[_0xf948('0xe')](function(_0x47add){logger['info'](_0xf948('0x2b'),_0x47add[_0xf948('0x28')]);return _0x49f25b(_0x47add);});});})[_0xf948('0x16')](function(_0x49a34c){_0x3eb8a2(_0x49a34c);});});};}function createEndUser(_0x2cbb21,_0x5f15bc,_0x1e5125,_0x57ca44){return new Promise(function(_0x14067a,_0xd517c2){var _0x149560=moment();var _0x313a63={'method':'POST','uri':_0x57ca44+_0xf948('0x2c'),'body':{'contact':{'last_name':_0x2cbb21['contactNumber'],'work_number':_0x2cbb21[_0xf948('0x25')],'mobile_number':_0x2cbb21[_0xf948('0x25')],'owner_id':_0x2cbb21[_0xf948('0x1f')],'created_at':_0x149560['format'](_0xf948('0x2d'))}},'json':!![]};_0x313a63[_0xf948('0xb')]=_0x1e5125;logger['info'](_0xf948('0x2e'));return rp(_0x313a63)[_0xf948('0xe')](function(_0x3d8948){_0x2cbb21[_0xf948('0x28')]=_0x3d8948[_0xf948('0x2f')]['id'];_0x14067a(_0x2cbb21);})['catch'](function(_0x4c80e9){logger[_0xf948('0x17')]('['+[_0x5f15bc[_0xf948('0x18')]()]+']',_0x4c80e9['message']);_0xd517c2(_0x4c80e9[_0xf948('0x19')]);});});}function getTicket(_0x74e336,_0x13cbef,_0x4b109e,_0x4c25f9,_0x514a53){return function(_0x3ca9eb){logger[_0xf948('0xc')](_0xf948('0x30'));return new Promise(function(_0x5e8f38,_0x1df352){var _0x4442c3=moment();var _0xe23471={'method':_0xf948('0x31'),'uri':_0x4b109e+_0xf948('0x32'),'body':{'title':intUtil[_0xf948('0x33')](_0x4c25f9[_0xf948('0x34')],_0x514a53,'\x20'),'description':intUtil[_0xf948('0x33')](_0x4c25f9[_0xf948('0x35')],_0x514a53,'\x0a'),'owner_id':_0x3ca9eb[_0xf948('0x1f')],'creater_id':_0x3ca9eb['adminId'],'targetable_id':_0x3ca9eb[_0xf948('0x28')],'targetable_type':_0xf948('0x36'),'created_at':_0x4442c3[_0xf948('0x37')](_0xf948('0x2d')),'due_date':_0x4442c3[_0xf948('0x38')](0x1e,'m')[_0xf948('0x37')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xe23471[_0xf948('0xb')]=_0x13cbef;return rp(_0xe23471)['then'](function(_0x211ab6){_0x3ca9eb[_0xf948('0x39')]=_0x211ab6[_0xf948('0x3a')]['id'];logger[_0xf948('0xc')](_0xf948('0x3b'),_0x3ca9eb[_0xf948('0x39')]);_0x5e8f38(_0x3ca9eb);})['catch'](function(_0x46e9ee){logger[_0xf948('0x17')]('['+[_0x74e336['toUpperCase']()]+']',_0x46e9ee[_0xf948('0x19')]);_0x1df352(_0x46e9ee['message']);});});};}function emit(_0x58b5c4,_0x42697b,_0x20dcda){var _0x53905e={'uri':_0x58b5c4+_0xf948('0x3c')+_0x20dcda};io['to'](util[_0xf948('0x37')]('user:%s',_0x42697b))[_0xf948('0x3d')]('trigger:browser:url',_0x53905e);}exports['cs']=function(_0x335c46,_0x44ae24,_0x255f7d,_0x43897b,_0x5add72,_0x155bc8,_0x283b34,_0x35f9b2){var _0x4a9569={};var _0x31a836={'Authorization':_0xf948('0x3e')+_0x155bc8[_0xf948('0x3f')]};_0x155bc8[_0xf948('0x40')]=intUtil[_0xf948('0x41')](_0x155bc8[_0xf948('0x40')]);_0x155bc8['serverUrl']=intUtil[_0xf948('0x41')](_0x155bc8[_0xf948('0x42')]);var _0x539f93=_0x155bc8[_0xf948('0x40')];_0x4a9569[_0xf948('0x12')]=_0x155bc8[_0xf948('0x43')];_0x4a9569[_0xf948('0x25')]=_0x35f9b2[_0xf948('0x44')]()===_0xf948('0x45')?_0x44ae24[_0xf948('0x46')]:_0x44ae24[_0xf948('0x47')];_0x4a9569[_0xf948('0x48')]=_0x35f9b2===_0xf948('0x49')||_0x35f9b2===_0xf948('0x4a')?_0xf948('0x49'):_0xf948('0x45');if(_0x43897b){_0x4a9569[_0xf948('0x1c')]=_0x43897b[_0xf948('0x11')];}var _0x360517=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x155bc8[_0xf948('0x42')],_0x44ae24[_0xf948('0x4b')],md5(_0x44ae24['uniqueid']));if(_0x5add72&&_0x5add72[_0xf948('0x4c')]){logger[_0xf948('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x44ae24[_0xf948('0x4d')]=_0x360517;}else if(_0x283b34&&_0x283b34[_0xf948('0x4e')]&&_0x283b34[_0xf948('0x4e')]!==_0xf948('0x4f')){logger[_0xf948('0xc')]('[OUTBOUND]',_0xf948('0x50'));_0x44ae24['recordingURL']=_0x360517;}else{_0x44ae24[_0xf948('0x4d')]='';}return getAdminId(_0x4a9569,_0x35f9b2,_0x31a836,_0x539f93)[_0xf948('0xe')](getUser(_0x35f9b2,_0x31a836,_0x539f93))[_0xf948('0xe')](getEndUser(_0x35f9b2,_0x31a836,_0x539f93))[_0xf948('0xe')](getTicket(_0x35f9b2,_0x31a836,_0x539f93,_0x255f7d,_0x44ae24))[_0xf948('0xe')](function(_0x1e842e){logger[_0xf948('0xc')](util[_0xf948('0x37')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1e842e[_0xf948('0x39')]));if(_0x35f9b2!==_0xf948('0x4a')){logger[_0xf948('0xc')]('['+[_0x35f9b2[_0xf948('0x18')]()]+']',_0xf948('0x51'));emit(_0x539f93,_0x43897b[_0xf948('0x52')],_0x1e842e[_0xf948('0x28')]);}})[_0xf948('0x16')](function(_0x24b1f5){logger['error']('['+[_0x35f9b2['toUpperCase']()]+_0xf948('0x53'),util[_0xf948('0x54')](_0x24b1f5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5e3b=['getString','Descriptions','add','task','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','message','/api/lookup?q=','&f=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','error','Creating\x20new\x20task','Subjects'];(function(_0x42e25e,_0x46cfd1){var _0x1ed3a6=function(_0x3558e8){while(--_0x3558e8){_0x42e25e['push'](_0x42e25e['shift']());}};_0x1ed3a6(++_0x46cfd1);}(_0x5e3b,0x170));var _0xb5e3=function(_0x12531b,_0x27c805){_0x12531b=_0x12531b-0x0;var _0x11a9bc=_0x5e3b[_0x12531b];return _0x11a9bc;};'use strict';var _=require(_0xb5e3('0x0'));var rp=require('request-promise');var md5=require(_0xb5e3('0x1'));var util=require('util');var moment=require(_0xb5e3('0x2'));var Promise=require(_0xb5e3('0x3'));var Redis=require(_0xb5e3('0x4'));var intUtil=require(_0xb5e3('0x5'));var config=require(_0xb5e3('0x6'));var logger=require(_0xb5e3('0x7'))(_0xb5e3('0x8'));config['redis']=_[_0xb5e3('0x9')](config[_0xb5e3('0xa')],{'host':_0xb5e3('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb5e3('0xa')]));function getAdminId(_0xf735a9,_0x510e20,_0x273e1b,_0x583eb7){return new Promise(function(_0xe8f17b,_0x3dfe0c){var _0x28529c=![];var _0x14d766={'method':_0xb5e3('0xc'),'uri':_0x583eb7+_0xb5e3('0xd'),'json':!![]};_0x14d766[_0xb5e3('0xe')]=_0x273e1b;logger['info'](_0xb5e3('0xf'));return rp(_0x14d766)[_0xb5e3('0x10')](function(_0x3fe29b){if(_0x3fe29b){var _0x6a31a2=_0x3fe29b[_0xb5e3('0x11')];var _0xabeeb=null;for(_0xabeeb=0x0;_0xabeeb<_0x6a31a2[_0xb5e3('0x12')];_0xabeeb++){if(_0x6a31a2[_0xabeeb][_0xb5e3('0x13')]===_0xf735a9[_0xb5e3('0x14')]){_0xf735a9['adminId']=_0x6a31a2[_0xabeeb]['id'];_0x28529c=!![];}}if(_0x28529c){logger[_0xb5e3('0x15')](_0xb5e3('0x16'),_0xf735a9[_0xb5e3('0x17')]);_0xe8f17b(_0xf735a9);}else{_0x3dfe0c({'statusCode':0x194,'message':_0xb5e3('0x18')});}}else{_0x3dfe0c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb5e3('0x19')](function(_0x1b8ef5){logger['error']('['+[_0x510e20[_0xb5e3('0x1a')]()]+']',_0x1b8ef5['message']);_0x3dfe0c(_0x1b8ef5);});});}function getUser(_0x32a850,_0x4fa50f,_0x387957){return function(_0x206437){return new Promise(function(_0x3a8e0f,_0x1b29b6){var _0x1eb0e7={'method':_0xb5e3('0xc'),'uri':_0x387957+_0xb5e3('0xd'),'json':!![]};_0x1eb0e7[_0xb5e3('0xe')]=_0x4fa50f;logger[_0xb5e3('0x15')](_0xb5e3('0x1b'));return rp(_0x1eb0e7)[_0xb5e3('0x10')](function(_0xda24d0){if(_0xda24d0){var _0xbbd0ff=_0xda24d0[_0xb5e3('0x11')];var _0x151833=![];var _0x280631=null;if(_0x206437[_0xb5e3('0x1c')]!==null){logger['info'](_0xb5e3('0x1d'),_0x206437[_0xb5e3('0x1c')]);_0x206437[_0xb5e3('0x1e')]=_0x206437[_0xb5e3('0x1c')];for(_0x280631=0x0;_0x280631<_0xbbd0ff[_0xb5e3('0x12')];_0x280631++){if(_0xbbd0ff[_0x280631]['email']===_0x206437[_0xb5e3('0x1c')]){_0x151833=!![];_0x206437[_0xb5e3('0x1f')]=_0xbbd0ff[_0x280631]['id'];logger[_0xb5e3('0x15')](_0xb5e3('0x20'),_0x206437[_0xb5e3('0x1f')]);}}}if(!_0x151833){logger[_0xb5e3('0x15')]('Admin\x20selected');_0x206437[_0xb5e3('0x1e')]=_0x206437[_0xb5e3('0x14')];_0x206437[_0xb5e3('0x1f')]=_0x206437[_0xb5e3('0x17')];_0x151833=!![];}if(_0x151833){_0x3a8e0f(_0x206437);}else{_0x1b29b6({'statusCode':0x194,'message':_0xb5e3('0x18')});}}else{_0x1b29b6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb5e3('0x19')](function(_0x21cd18){logger['error']('['+[_0x32a850[_0xb5e3('0x1a')]()]+']',_0x21cd18[_0xb5e3('0x21')]);_0x1b29b6(_0x21cd18);});});};}function searchContact(_0x42f7df,_0x5a5354,_0x29dff4,_0x57b27c){return new Promise(function(_0x53c551,_0x1925c8){var _0x5e7d45={'method':_0xb5e3('0xc'),'headers':_0x5a5354,'uri':_0x42f7df+_0xb5e3('0x22')+_0x57b27c+_0xb5e3('0x23')+_0x29dff4+'&entities=contact','json':!![]};rp(_0x5e7d45)[_0xb5e3('0x10')](function(_0x24bbc8){var _0x1334ab=_[_0xb5e3('0x24')](_0x24bbc8[_0xb5e3('0x25')][_0xb5e3('0x25')],[_0x29dff4,_0x57b27c]);_0x53c551(_0x1334ab);})[_0xb5e3('0x19')](function(_0xcdb659){_0x1925c8(_0xcdb659);});});}function getEndUser(_0x33221c,_0x42277e,_0x19358e){return function(_0x39842e){return new Promise(function(_0x4a8a08,_0x33ea22){logger[_0xb5e3('0x15')](util['format'](_0xb5e3('0x26'),_0x39842e[_0xb5e3('0x27')]));searchContact(_0x19358e,_0x42277e,'mobile_number',_0x39842e['contactNumber'])[_0xb5e3('0x10')](function(_0x57336d){if(_0x57336d){_0x39842e[_0xb5e3('0x28')]=_0x57336d['id'];logger[_0xb5e3('0x15')](_0xb5e3('0x29'),_0x39842e['endUserId']);return _0x4a8a08(_0x39842e);}searchContact(_0x19358e,_0x42277e,'work_number',_0x39842e[_0xb5e3('0x27')])[_0xb5e3('0x10')](function(_0x2dab4f){if(_0x2dab4f){_0x39842e[_0xb5e3('0x28')]=_0x2dab4f['id'];logger[_0xb5e3('0x15')](_0xb5e3('0x2a'),_0x39842e[_0xb5e3('0x28')]);return _0x4a8a08(_0x39842e);}createEndUser(_0x39842e,_0x33221c,_0x42277e,_0x19358e)[_0xb5e3('0x10')](function(_0x5f01bf){logger[_0xb5e3('0x15')](_0xb5e3('0x2b'),_0x5f01bf[_0xb5e3('0x28')]);return _0x4a8a08(_0x5f01bf);});});})[_0xb5e3('0x19')](function(_0x4b4317){_0x33ea22(_0x4b4317);});});};}function createEndUser(_0x23e690,_0x171f65,_0x2cc863,_0x3ec346){return new Promise(function(_0x408431,_0x25b08e){var _0x2da476=moment();var _0x59a505={'method':_0xb5e3('0x2c'),'uri':_0x3ec346+_0xb5e3('0x2d'),'body':{'contact':{'last_name':_0x23e690['contactNumber'],'work_number':_0x23e690[_0xb5e3('0x27')],'mobile_number':_0x23e690[_0xb5e3('0x27')],'owner_id':_0x23e690[_0xb5e3('0x1f')],'created_at':_0x2da476[_0xb5e3('0x2e')](_0xb5e3('0x2f'))}},'json':!![]};_0x59a505[_0xb5e3('0xe')]=_0x2cc863;logger[_0xb5e3('0x15')](_0xb5e3('0x30'));return rp(_0x59a505)[_0xb5e3('0x10')](function(_0x357b5e){_0x23e690[_0xb5e3('0x28')]=_0x357b5e['contact']['id'];_0x408431(_0x23e690);})[_0xb5e3('0x19')](function(_0x2d437e){logger[_0xb5e3('0x31')]('['+[_0x171f65[_0xb5e3('0x1a')]()]+']',_0x2d437e['message']);_0x25b08e(_0x2d437e[_0xb5e3('0x21')]);});});}function getTicket(_0x106540,_0x5a462f,_0x4d1eb7,_0x1cb518,_0x51ffea){return function(_0x273801){logger['info'](_0xb5e3('0x32'));return new Promise(function(_0x4a2427,_0x4f9996){var _0x21efe0=moment();var _0xf9ab46={'method':_0xb5e3('0x2c'),'uri':_0x4d1eb7+'/api/tasks','body':{'title':intUtil['getString'](_0x1cb518[_0xb5e3('0x33')],_0x51ffea,'\x20'),'description':intUtil[_0xb5e3('0x34')](_0x1cb518[_0xb5e3('0x35')],_0x51ffea,'\x0a'),'owner_id':_0x273801['userId'],'creater_id':_0x273801[_0xb5e3('0x17')],'targetable_id':_0x273801[_0xb5e3('0x28')],'targetable_type':'Contact','created_at':_0x21efe0[_0xb5e3('0x2e')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x21efe0[_0xb5e3('0x36')](0x1e,'m')[_0xb5e3('0x2e')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xf9ab46[_0xb5e3('0xe')]=_0x5a462f;return rp(_0xf9ab46)[_0xb5e3('0x10')](function(_0x1db292){_0x273801['ticketId']=_0x1db292[_0xb5e3('0x37')]['id'];logger[_0xb5e3('0x15')]('Task\x20created:',_0x273801[_0xb5e3('0x38')]);_0x4a2427(_0x273801);})[_0xb5e3('0x19')](function(_0x427d11){logger[_0xb5e3('0x31')]('['+[_0x106540['toUpperCase']()]+']',_0x427d11[_0xb5e3('0x21')]);_0x4f9996(_0x427d11['message']);});});};}function emit(_0x379f1f,_0x15c0f4,_0x1527de){var _0x300af1={'uri':_0x379f1f+_0xb5e3('0x39')+_0x1527de};io['to'](util['format'](_0xb5e3('0x3a'),_0x15c0f4))['emit'](_0xb5e3('0x3b'),_0x300af1);}exports['cs']=function(_0x43e7ac,_0x205fa3,_0xeadb85,_0x23198,_0x1d99a9,_0x123f31,_0x225aff,_0xfb0c67){var _0x1b5292={};var _0x10f6fb={'Authorization':_0xb5e3('0x3c')+_0x123f31[_0xb5e3('0x3d')]};_0x123f31[_0xb5e3('0x3e')]=intUtil[_0xb5e3('0x3f')](_0x123f31[_0xb5e3('0x3e')]);_0x123f31[_0xb5e3('0x40')]=intUtil[_0xb5e3('0x3f')](_0x123f31[_0xb5e3('0x40')]);var _0x810260=_0x123f31[_0xb5e3('0x3e')];_0x1b5292[_0xb5e3('0x14')]=_0x123f31['username'];_0x1b5292[_0xb5e3('0x27')]=_0xfb0c67[_0xb5e3('0x41')]()===_0xb5e3('0x42')?_0x205fa3[_0xb5e3('0x43')]:_0x205fa3[_0xb5e3('0x44')];_0x1b5292[_0xb5e3('0x45')]=_0xfb0c67===_0xb5e3('0x46')||_0xfb0c67===_0xb5e3('0x47')?_0xb5e3('0x46'):_0xb5e3('0x42');if(_0x23198){_0x1b5292['agentEmail']=_0x23198[_0xb5e3('0x13')];}var _0x2c7b97=util[_0xb5e3('0x2e')](_0xb5e3('0x48'),_0x123f31['serverUrl'],_0x205fa3[_0xb5e3('0x49')],md5(_0x205fa3[_0xb5e3('0x49')]));if(_0x1d99a9&&_0x1d99a9[_0xb5e3('0x4a')]){logger[_0xb5e3('0x15')](_0xb5e3('0x4b'),_0xb5e3('0x4c'));_0x205fa3[_0xb5e3('0x4d')]=_0x2c7b97;}else if(_0x225aff&&_0x225aff[_0xb5e3('0x4e')]&&_0x225aff['recordingFormat']!=='none'){logger['info'](_0xb5e3('0x4f'),_0xb5e3('0x4c'));_0x205fa3[_0xb5e3('0x4d')]=_0x2c7b97;}else{_0x205fa3[_0xb5e3('0x4d')]='';}return getAdminId(_0x1b5292,_0xfb0c67,_0x10f6fb,_0x810260)[_0xb5e3('0x10')](getUser(_0xfb0c67,_0x10f6fb,_0x810260))['then'](getEndUser(_0xfb0c67,_0x10f6fb,_0x810260))['then'](getTicket(_0xfb0c67,_0x10f6fb,_0x810260,_0xeadb85,_0x205fa3))[_0xb5e3('0x10')](function(_0x3810f1){logger[_0xb5e3('0x15')](util[_0xb5e3('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3810f1[_0xb5e3('0x38')]));if(_0xfb0c67!==_0xb5e3('0x47')){logger['info']('['+[_0xfb0c67[_0xb5e3('0x1a')]()]+']',_0xb5e3('0x50'));emit(_0x810260,_0x23198[_0xb5e3('0x51')],_0x3810f1[_0xb5e3('0x28')]);}})['catch'](function(_0x12900c){logger[_0xb5e3('0x31')]('['+[_0xfb0c67[_0xb5e3('0x1a')]()]+_0xb5e3('0x52'),util[_0xb5e3('0x53')](_0x12900c,{'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 eda4a4e..ee3c795 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 _0x33d7=['error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','salesforce','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','../../../../config/logger'];(function(_0x56d5d3,_0x81753b){var _0x164907=function(_0x4bdfc2){while(--_0x4bdfc2){_0x56d5d3['push'](_0x56d5d3['shift']());}};_0x164907(++_0x81753b);}(_0x33d7,0x13f));var _0x733d=function(_0x1c1016,_0xaf27e7){_0x1c1016=_0x1c1016-0x0;var _0x4c84c8=_0x33d7[_0x1c1016];return _0x4c84c8;};'use strict';var _=require(_0x733d('0x0'));var util=require(_0x733d('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x733d('0x2'));var sugarcrm=require(_0x733d('0x3'));var freshdesk=require(_0x733d('0x4'));var zoho=require(_0x733d('0x5'));var desk=require(_0x733d('0x6'));var vtiger=require(_0x733d('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x733d('0x8'));var freshsales=require(_0x733d('0x9'));var integrations=['zendesk',_0x733d('0xa'),'sugarcrm','freshdesk',_0x733d('0xb'),_0x733d('0xc'),_0x733d('0xd'),_0x733d('0xe'),_0x733d('0xf'),_0x733d('0x10')];exports[_0x733d('0x11')]=function(_0x27d9b3,_0x53c4e7,_0x5655bb,_0x1e151c,_0x151f49,_0x11b38b){if(_0x5655bb){if(_[_0x733d('0x12')](integrations,_0x27d9b3['data1'][_0x733d('0x13')]())){try{var _0x32f181=null;var _0x80a1bc='';var _0x1b5425=_0x5655bb[_0x27d9b3[_0x733d('0x14')]['toLowerCase']()];if(_0x1b5425){var _0x1215bf=_0x1b5425[_0x27d9b3['data2']];if(_0x1215bf){var _0x7f611e=_['find'](_0x1215bf[_0x733d('0x15')],{'id':parseInt(_0x27d9b3[_0x733d('0x16')],0xa)});if(_0x7f611e){if(_0x1e151c){if(_0x151f49&&_0x53c4e7[_0x733d('0x17')]){_0x80a1bc=_0x733d('0x17');}else if(_0x53c4e7[_0x733d('0x18')]){_0x80a1bc=_0x733d('0x19');}else{console['log'](_0x733d('0x1a'),_0x53c4e7);}}else{_0x80a1bc=_0x733d('0x1b');}switch(_0x27d9b3[_0x733d('0x14')][_0x733d('0x13')]()){case'zendesk':zendesk[_0x80a1bc](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b);break;case _0x733d('0xa'):salesforce[_0x80a1bc](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b);break;case'sugarcrm':sugarcrm[_0x80a1bc](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b);break;case _0x733d('0x1c'):freshdesk[_0x80a1bc](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b);break;case _0x733d('0xb'):zoho[_0x80a1bc](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b);break;case _0x733d('0xc'):desk[_0x80a1bc](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b);break;case _0x733d('0xd'):vtiger[_0x80a1bc](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b);break;case _0x733d('0xf'):freshsales['cs'](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b,_0x80a1bc);break;case _0x733d('0x10'):servicenow['cs'](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b,_0x80a1bc);break;case _0x733d('0xe'):dynamics365['cs'](_0x27d9b3,_0x53c4e7,_0x7f611e,_0x1e151c,_0x151f49,_0x1215bf,_0x11b38b,_0x80a1bc);break;default:console['log'](_0x733d('0x1d'));}}else{_0x32f181=require(_0x733d('0x1e'))(_0x27d9b3[_0x733d('0x14')]['toLowerCase']());_0x32f181[_0x733d('0x1f')](_0x733d('0x20'),util[_0x733d('0x21')](_0x733d('0x22'),_0x27d9b3[_0x733d('0x14')][_0x733d('0x13')](),_0x27d9b3[_0x733d('0x16')]));}}else{_0x32f181=require(_0x733d('0x1e'))(_0x27d9b3[_0x733d('0x14')][_0x733d('0x13')]());_0x32f181[_0x733d('0x1f')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x27d9b3[_0x733d('0x14')][_0x733d('0x13')](),_0x27d9b3['data2']));}}else{}}catch(_0x2b6190){console['error'](_0x2b6190);}}}}; \ No newline at end of file +var _0xa7b5=['./dynamics365','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','unmanaged','zoho','servicenow','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./desk','./vtiger','./servicenow'];(function(_0x36bdf7,_0x160108){var _0x52cc70=function(_0x5b9c4a){while(--_0x5b9c4a){_0x36bdf7['push'](_0x36bdf7['shift']());}};_0x52cc70(++_0x160108);}(_0xa7b5,0x145));var _0x5a7b=function(_0x5e0d6a,_0x1221ce){_0x5e0d6a=_0x5e0d6a-0x0;var _0x53f1d7=_0xa7b5[_0x5e0d6a];return _0x53f1d7;};'use strict';var _=require(_0x5a7b('0x0'));var util=require(_0x5a7b('0x1'));var zendesk=require(_0x5a7b('0x2'));var salesforce=require(_0x5a7b('0x3'));var sugarcrm=require(_0x5a7b('0x4'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x5a7b('0x5'));var vtiger=require(_0x5a7b('0x6'));var servicenow=require(_0x5a7b('0x7'));var dynamics365=require(_0x5a7b('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x5a7b('0x9'),_0x5a7b('0xa'),_0x5a7b('0xb'),'zoho',_0x5a7b('0xc'),_0x5a7b('0xd'),_0x5a7b('0xe'),_0x5a7b('0xf'),'servicenow'];exports[_0x5a7b('0x10')]=function(_0x5eec2c,_0x3060e2,_0x2397f0,_0x13edad,_0x2e9bcf,_0x50ec17){if(_0x2397f0){if(_[_0x5a7b('0x11')](integrations,_0x5eec2c['data1'][_0x5a7b('0x12')]())){try{var _0x4eb142=null;var _0x374400='';var _0xfbf875=_0x2397f0[_0x5eec2c[_0x5a7b('0x13')][_0x5a7b('0x12')]()];if(_0xfbf875){var _0x20f86d=_0xfbf875[_0x5eec2c[_0x5a7b('0x14')]];if(_0x20f86d){var _0x459c55=_[_0x5a7b('0x15')](_0x20f86d[_0x5a7b('0x16')],{'id':parseInt(_0x5eec2c[_0x5a7b('0x17')],0xa)});if(_0x459c55){if(_0x13edad){if(_0x2e9bcf&&_0x3060e2[_0x5a7b('0x18')]){_0x374400=_0x5a7b('0x18');}else if(_0x3060e2[_0x5a7b('0x19')]){_0x374400='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x3060e2);}}else{_0x374400=_0x5a7b('0x1a');}switch(_0x5eec2c['data1']['toLowerCase']()){case'zendesk':zendesk[_0x374400](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17);break;case _0x5a7b('0x9'):salesforce[_0x374400](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17);break;case'sugarcrm':sugarcrm[_0x374400](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17);break;case _0x5a7b('0xb'):freshdesk[_0x374400](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17);break;case _0x5a7b('0x1b'):zoho[_0x374400](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17);break;case _0x5a7b('0xc'):desk[_0x374400](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17);break;case _0x5a7b('0xd'):vtiger[_0x374400](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17);break;case _0x5a7b('0xf'):freshsales['cs'](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17,_0x374400);break;case _0x5a7b('0x1c'):servicenow['cs'](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17,_0x374400);break;case'dynamics365':dynamics365['cs'](_0x5eec2c,_0x3060e2,_0x459c55,_0x13edad,_0x2e9bcf,_0x20f86d,_0x50ec17,_0x374400);break;default:console[_0x5a7b('0x1d')](_0x5a7b('0x1e'));}}else{_0x4eb142=require(_0x5a7b('0x1f'))(_0x5eec2c[_0x5a7b('0x13')]['toLowerCase']());_0x4eb142[_0x5a7b('0x20')](_0x5a7b('0x21'),util[_0x5a7b('0x22')](_0x5a7b('0x23'),_0x5eec2c[_0x5a7b('0x13')][_0x5a7b('0x12')](),_0x5eec2c['data3']));}}else{_0x4eb142=require('../../../../config/logger')(_0x5eec2c['data1']['toLowerCase']());_0x4eb142[_0x5a7b('0x20')](_0x5a7b('0x21'),util[_0x5a7b('0x22')](_0x5a7b('0x24'),_0x5eec2c[_0x5a7b('0x13')]['toLowerCase'](),_0x5eec2c[_0x5a7b('0x14')]));}}else{}}catch(_0x499c7d){console[_0x5a7b('0x20')](_0x499c7d);}}}}; \ 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 70f6484..5ff7fd3 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 _0x8dde=['Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','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','Caller\x20-\x20%s','','format','Company','No\x20Company','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','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','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','unmanaged','lastevent','toUpperCase','recordingURL',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','leadId','info','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name'];(function(_0x185998,_0x228571){var _0x464dfd=function(_0x554eab){while(--_0x554eab){_0x185998['push'](_0x185998['shift']());}};_0x464dfd(++_0x228571);}(_0x8dde,0x1e4));var _0xe8dd=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x8dde[_0x870b62];return _0x2dcb39;};'use strict';var _=require(_0xe8dd('0x0'));var rp=require(_0xe8dd('0x1'));var moment=require(_0xe8dd('0x2'));var BPromise=require(_0xe8dd('0x3'));var md5=require(_0xe8dd('0x4'));var jsforce=require(_0xe8dd('0x5'));var util=require(_0xe8dd('0x6'));var Redis=require(_0xe8dd('0x7'));var intUtil=require(_0xe8dd('0x8'));var config=require('../../../../config/environment');var logger=require(_0xe8dd('0x9'))('salesforce');config[_0xe8dd('0xa')]=_[_0xe8dd('0xb')](config[_0xe8dd('0xa')],{'host':_0xe8dd('0xc'),'port':0x18eb});var io=require(_0xe8dd('0xd'))(new Redis(config[_0xe8dd('0xa')]));function emit(_0x55ef3c,_0x15b617,_0x1b4b5e){io['to'](_0x55ef3c)[_0xe8dd('0xe')](_0x15b617,_0x1b4b5e);}function getTicket(_0x4c4a89,_0x346723,_0x13fecf,_0x3bca46,_0x31c1a7,_0x4eadd3,_0x4e2ce1,_0x3b2306){var _0x3db011=Object[_0xe8dd('0xf')]({},{'OwnerId':_0x346723['id'],'Subject':intUtil[_0xe8dd('0x10')](_0x3bca46[_0xe8dd('0x11')],_0x31c1a7,'\x20'),'Description':intUtil[_0xe8dd('0x10')](_0x3bca46[_0xe8dd('0x12')],_0x31c1a7,'\x0a')},getCustomFields(_0x4eadd3,_0x31c1a7));if(_0x13fecf){if(_0x3bca46[_0xe8dd('0x13')]===_0xe8dd('0x14')){_0x3db011[_0xe8dd('0x15')]=moment[_0xe8dd('0x16')]();_0x3db011[_0xe8dd('0x17')]=![];_0x3db011[_0xe8dd('0x18')]=![];if(_0x13fecf[_0xe8dd('0x19')]===_0xe8dd('0x1a')||_0x13fecf[_0xe8dd('0x19')]===_0xe8dd('0x1b')){_0x3db011[_0xe8dd('0x1c')]=_0x13fecf['id'];}else if(_0x13fecf[_0xe8dd('0x19')]==='account'){_0x3db011[_0xe8dd('0x1d')]=_0x13fecf['id'];}}else if(_0x3bca46['ticketType']===_0xe8dd('0x1e')){if(_0x13fecf[_0xe8dd('0x19')]==='contact'){_0x3db011[_0xe8dd('0x1f')]=_0x13fecf['id'];}else if(_0x13fecf[_0xe8dd('0x19')]===_0xe8dd('0x20')){_0x3db011['AccountId']=_0x13fecf['id'];}else if(_0x13fecf[_0xe8dd('0x19')]===_0xe8dd('0x1b')&&_0x3bca46['leadId']){_0x3db011[_0x3bca46[_0xe8dd('0x21')]]=_0x13fecf['id'];}else{logger[_0xe8dd('0x22')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4e2ce1[_0xe8dd('0x23')](_0x3bca46[_0xe8dd('0x13')])[_0xe8dd('0x24')](_0x3db011);}function getUser(_0x4e97aa,_0x36b834,_0x241c0b){if(!_[_0xe8dd('0x25')](_0x36b834)&&intUtil[_0xe8dd('0x26')](_0x36b834)){var _0x4c864b={'Email':_0x36b834};var _0x231d00={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x241c0b[_0xe8dd('0x23')](_0xe8dd('0x27'))[_0xe8dd('0x28')](_0x4c864b,_0x231d00)[_0xe8dd('0x29')]()[_0xe8dd('0x2a')](function(_0x20e48a){if(_0x20e48a[_0xe8dd('0x2b')]){var _0x2d52dd=_[_0xe8dd('0x28')](_0x20e48a,function(_0x57f56c){return _0x57f56c[_0xe8dd('0x2c')]===_0x36b834;});if(_0x2d52dd){logger[_0xe8dd('0x22')](_0xe8dd('0x2d'),_0x36b834);return BPromise['resolve']({'id':_0x2d52dd['Id'],'name':_0x2d52dd[_0xe8dd('0x2e')]});}}else{logger[_0xe8dd('0x22')](_0xe8dd('0x2f'),_0x36b834);return _0x241c0b[_0xe8dd('0x30')]()[_0xe8dd('0x2a')](function(_0x1fc5a4){return BPromise[_0xe8dd('0x31')]({'id':_0x1fc5a4[_0xe8dd('0x32')],'name':_0x1fc5a4[_0xe8dd('0x33')]});});}});}else{logger[_0xe8dd('0x22')](_0xe8dd('0x2f'),_0x36b834);return _0x241c0b[_0xe8dd('0x30')]()[_0xe8dd('0x2a')](function(_0x18b24b){return BPromise[_0xe8dd('0x31')]({'id':_0x18b24b[_0xe8dd('0x32')],'name':_0x18b24b['display_name']});});}}function getEndUser(_0x2bba05,_0xbfcabb,_0x5aaf56,_0x4a39e1,_0xaad891){var _0x32945e={'$or':{'Phone':_0x4a39e1}};var _0x1d6b92={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe8dd('0x2a')](function(){logger[_0xe8dd('0x22')](_0xe8dd('0x34'),_0x4a39e1,_0xbfcabb[_0xe8dd('0x35')]);switch(_0xbfcabb[_0xe8dd('0x35')]){case _0xe8dd('0x36'):var _0x2e4356=_['cloneDeep'](_0x32945e);if(_0xbfcabb[_0xe8dd('0x37')]){var _0x4de8f5={};_0x4de8f5[_0xbfcabb[_0xe8dd('0x37')]]=_0x4a39e1;_[_0xe8dd('0x38')](_0x2e4356[_0xe8dd('0x39')],_0x4de8f5);}return _0xaad891[_0xe8dd('0x23')](_0xe8dd('0x3a'))[_0xe8dd('0x28')](_0x2e4356,_0x1d6b92)[_0xe8dd('0x29')]()[_0xe8dd('0x2a')](function(_0x336076){if(_0x336076&&_0x336076[_0xe8dd('0x2b')]){return _0x336076;}else{var _0x42a00f=_[_0xe8dd('0x3b')](_0x32945e);if(_0xbfcabb[_0xe8dd('0x3c')]){var _0x1747c9={};_0x1747c9[_0xbfcabb[_0xe8dd('0x3c')]]=_0x4a39e1;_[_0xe8dd('0x38')](_0x42a00f[_0xe8dd('0x39')],_0x1747c9);}return _0xaad891['sobject']('Lead')[_0xe8dd('0x28')](_0x42a00f,_0x1d6b92);}});case _0xe8dd('0x3d'):var _0x18da57=_[_0xe8dd('0x3b')](_0x32945e);if(_0xbfcabb[_0xe8dd('0x3e')]){var _0x4de8f5={};_0x4de8f5[_0xbfcabb[_0xe8dd('0x3e')]]=_0x4a39e1;_[_0xe8dd('0x38')](_0x18da57[_0xe8dd('0x39')],_0x4de8f5);}return _0xaad891[_0xe8dd('0x23')](_0xe8dd('0x3f'))[_0xe8dd('0x28')](_0x18da57,_0x1d6b92)[_0xe8dd('0x29')]()['then'](function(_0x5a789a){if(_0x5a789a&&_0x5a789a['length']){return _0x5a789a;}else{var _0x28fdd4=_[_0xe8dd('0x3b')](_0x32945e);if(_0xbfcabb[_0xe8dd('0x37')]){var _0x1a99a6={};_0x1a99a6[_0xbfcabb[_0xe8dd('0x37')]]=_0x4a39e1;_[_0xe8dd('0x38')](_0x28fdd4[_0xe8dd('0x39')],_0x1a99a6);}return _0xaad891[_0xe8dd('0x23')](_0xe8dd('0x3a'))[_0xe8dd('0x28')](_0x28fdd4,_0x1d6b92)['then'](function(_0x7eac79){if(_0x7eac79&&_0x7eac79[_0xe8dd('0x2b')]){return _0x7eac79;}else{var _0x24009b=_[_0xe8dd('0x3b')](_0x32945e);if(_0xbfcabb[_0xe8dd('0x3c')]){var _0x44c756={};_0x44c756[_0xbfcabb[_0xe8dd('0x3c')]]=_0x4a39e1;_['merge'](_0x24009b[_0xe8dd('0x39')],_0x44c756);}return _0xaad891[_0xe8dd('0x23')](_0xe8dd('0x40'))['find'](_0x24009b,_0x1d6b92);}});}});case _0xe8dd('0x1a'):var _0x2e4356=_[_0xe8dd('0x3b')](_0x32945e);if(_0xbfcabb[_0xe8dd('0x37')]){var _0x4de8f5={};_0x4de8f5[_0xbfcabb[_0xe8dd('0x37')]]=_0x4a39e1;_[_0xe8dd('0x38')](_0x2e4356[_0xe8dd('0x39')],_0x4de8f5);}return _0xaad891[_0xe8dd('0x23')](_0xe8dd('0x3a'))['find'](_0x2e4356,_0x1d6b92)[_0xe8dd('0x29')]();case _0xe8dd('0x1b'):var _0x246945=_[_0xe8dd('0x3b')](_0x32945e);if(_0xbfcabb['additionalSearchLead']){var _0x4de8f5={};_0x4de8f5[_0xbfcabb[_0xe8dd('0x3c')]]=_0x4a39e1;_['merge'](_0x246945[_0xe8dd('0x39')],_0x4de8f5);}return _0xaad891[_0xe8dd('0x23')](_0xe8dd('0x40'))['find'](_0x246945,_0x1d6b92);case _0xe8dd('0x20'):var _0x18da57=_['cloneDeep'](_0x32945e);if(_0xbfcabb[_0xe8dd('0x3e')]){var _0x4de8f5={};_0x4de8f5[_0xbfcabb[_0xe8dd('0x3e')]]=_0x4a39e1;_[_0xe8dd('0x38')](_0x18da57[_0xe8dd('0x39')],_0x4de8f5);}return _0xaad891['sobject']('Account')[_0xe8dd('0x28')](_0x18da57,_0x1d6b92);default:return null;}})[_0xe8dd('0x2a')](function(_0x2b84a0){if(_0x2b84a0&&_0x2b84a0['length']){var _0xad08a3=_[_0xe8dd('0x41')](_0x2b84a0);if(_0xad08a3){return BPromise[_0xe8dd('0x31')]({'id':_0xad08a3['Id'],'name':_0xad08a3[_0xe8dd('0x2e')],'phone':_0xad08a3[_0xe8dd('0x42')],'endUserType':_0xad08a3[_0xe8dd('0x43')][_0xe8dd('0x44')][_0xe8dd('0x45')]()});}}})[_0xe8dd('0x2a')](function(_0x1e2b2f){if(_0x1e2b2f){logger[_0xe8dd('0x22')](_0xe8dd('0x46'),_0x1e2b2f[_0xe8dd('0x19')],_0x4a39e1);return BPromise[_0xe8dd('0x31')](_0x1e2b2f);}else{logger[_0xe8dd('0x22')](_0xe8dd('0x47'),_0x4a39e1);var _0x24f74a={'Phone':_0x4a39e1};if(_0xbfcabb[_0xe8dd('0x48')]){if(_0xbfcabb[_0xe8dd('0x48')]===_0xe8dd('0x1a')){logger[_0xe8dd('0x22')](_0xe8dd('0x49'),_0x4a39e1,_0xbfcabb[_0xe8dd('0x48')]);_0x24f74a[_0xe8dd('0x4a')]=_0x5aaf56!==''?_0x5aaf56:util['format'](_0xe8dd('0x4b'),_0x4a39e1);}else if(_0xbfcabb[_0xe8dd('0x48')]===_0xe8dd('0x1b')){logger[_0xe8dd('0x22')](_0xe8dd('0x49'),_0x4a39e1,_0xbfcabb['moduleCreate']);_0x24f74a[_0xe8dd('0x4a')]=_0x5aaf56!==_0xe8dd('0x4c')?_0x5aaf56:util[_0xe8dd('0x4d')](_0xe8dd('0x4b'),_0x4a39e1);_0x24f74a[_0xe8dd('0x4e')]=_0xe8dd('0x4f');}else if(_0xbfcabb[_0xe8dd('0x48')]===_0xe8dd('0x20')){logger['info'](_0xe8dd('0x49'),_0x4a39e1,_0xbfcabb[_0xe8dd('0x48')]);_0x24f74a['Name']=_0x5aaf56!==''?_0x5aaf56:util[_0xe8dd('0x4d')]('Caller\x20-\x20%s',_0x4a39e1);}else{return null;}}return _0xaad891['sobject'](_[_0xe8dd('0x50')](_0xbfcabb[_0xe8dd('0x48')]))[_0xe8dd('0x24')](_0x24f74a)[_0xe8dd('0x2a')](function(_0x42bc3a){return BPromise[_0xe8dd('0x31')]({'id':_0x42bc3a['id'],'endUserType':_0xbfcabb[_0xe8dd('0x48')]});});}});}function getCustomFields(_0x2cb3ee,_0x465764){var _0x33afbe={};if(_0x2cb3ee['length']>0x0){_[_0xe8dd('0x51')](_0x2cb3ee,function(_0x45659a){if(_[_0xe8dd('0x52')]([_0xe8dd('0x53'),'picklist'],_0x45659a['type'])&&_0x45659a[_0xe8dd('0x54')]){_0x33afbe[_0x45659a['idField']]=_0x45659a[_0xe8dd('0x55')][_0xe8dd('0x56')]();}else if(_0x45659a[_0xe8dd('0x44')]===_0xe8dd('0x57')&&_0x45659a['variableName']&&_0x45659a['idField']){_0x465764[_0x45659a['variableName']]&&(_0x33afbe[_0x45659a[_0xe8dd('0x54')]]=_0x465764[_0x45659a[_0xe8dd('0x58')]][_0xe8dd('0x56')]());}else if(_0x45659a[_0xe8dd('0x44')]===_0xe8dd('0x59')&&_0x45659a[_0xe8dd('0x5a')]&&_0x45659a['Variable'][_0xe8dd('0x5b')]&&_0x45659a[_0xe8dd('0x54')]){_0x465764[_0x45659a[_0xe8dd('0x5a')]['name'][_0xe8dd('0x45')]()]&&(_0x33afbe[_0x45659a[_0xe8dd('0x54')]]=_0x465764[_0x45659a[_0xe8dd('0x5a')]['name'][_0xe8dd('0x45')]()][_0xe8dd('0x56')]());}});}return _0x33afbe;}function getConnection(_0x29f2a3){var _0x349042=_0x29f2a3[_0xe8dd('0x5c')]['concat'](_0x29f2a3[_0xe8dd('0x5d')]);var _0x3286f2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x29f2a3['remoteUri']||'https://login.salesforce.com','clientId':_0x29f2a3['clientId'],'clientSecret':_0x29f2a3[_0xe8dd('0x5e')]}});return _0x3286f2[_0xe8dd('0x5f')](_0x29f2a3[_0xe8dd('0x60')],_0x349042)[_0xe8dd('0x2a')](function(){logger['info'](_0xe8dd('0x61'));return _0x3286f2;});}exports['queue']=function(_0x5ccff7,_0x4e0319,_0x412456,_0x5122be,_0x2881a0,_0x3d1f08){var _0x2fade2,_0x39c7f7,_0x386157,_0x5ea346;_0x3d1f08[_0xe8dd('0x62')]=intUtil[_0xe8dd('0x63')](_0x3d1f08[_0xe8dd('0x62')]);_0x3d1f08['remoteUri']=intUtil['stripTrailingSlash'](_0x3d1f08[_0xe8dd('0x64')]);if(_0x2881a0&&_0x2881a0[_0xe8dd('0x65')]){logger['info']('[QUEUE]',_0xe8dd('0x66'));_0x4e0319['recordingURL']=util[_0xe8dd('0x4d')](_0xe8dd('0x67'),_0x3d1f08[_0xe8dd('0x62')],_0x4e0319[_0xe8dd('0x68')],md5(_0x4e0319[_0xe8dd('0x68')]));}else{_0x4e0319['recordingURL']='';}return getConnection(_0x3d1f08)[_0xe8dd('0x2a')](function(_0x43c53f){_0x5ea346=_0x43c53f;return getUser(_0x3d1f08,_0x5122be[_0xe8dd('0x69')],_0x5ea346);})[_0xe8dd('0x2a')](function(_0x1c3e81){_0x2fade2=_0x1c3e81;return getEndUser(_0x3d1f08,_0x412456,_0x4e0319[_0xe8dd('0x6a')],_0x4e0319['calleridnum'],_0x5ea346);})[_0xe8dd('0x2a')](function(_0x13b0e6){_0x39c7f7=_0x13b0e6;return getTicket(_0x3d1f08,_0x2fade2,_0x39c7f7,_0x412456,_0x4e0319,_0x412456[_0xe8dd('0x6b')],_0x5ea346,_0xe8dd('0x6c'));})[_0xe8dd('0x2a')](function(_0x55beeb){_0x386157=_0x55beeb;logger[_0xe8dd('0x22')](_0xe8dd('0x6d'),_0x386157['id']);logger['info'](_0xe8dd('0x6e'),_0x386157['id'],_0x5122be[_0xe8dd('0x5b')],_0x3d1f08[_0xe8dd('0x44')]);switch(_0x3d1f08['type']){case _0xe8dd('0x6f'):emit(util[_0xe8dd('0x4d')](_0xe8dd('0x70'),_0x5122be[_0xe8dd('0x5b')]),_0xe8dd('0x71'),{'recordId':_0x386157['id']});break;case _0xe8dd('0x72'):emit(util['format'](_0xe8dd('0x70'),_0x5122be['name']),_0xe8dd('0x73'),{'uri':util['format']('%s/%s/e',_0x5ea346[_0xe8dd('0x74')],_0x386157['id'])});break;default:logger[_0xe8dd('0x75')](_0xe8dd('0x76'));}})[_0xe8dd('0x77')](function(_0x1ffc84){logger[_0xe8dd('0x75')]('[QUEUE]',_0x1ffc84);});};exports[_0xe8dd('0x78')]=function(_0x7a24d3,_0x51d462,_0xcac40c,_0x4ecf80,_0xda2fd2,_0x349b76,_0x5b5ed1){var _0x5e12eb,_0x4876aa,_0x8611f4,_0x30a426;_0x349b76[_0xe8dd('0x62')]=intUtil[_0xe8dd('0x63')](_0x349b76[_0xe8dd('0x62')]);_0x349b76[_0xe8dd('0x64')]=intUtil['stripTrailingSlash'](_0x349b76['remoteUri']);if(_0x5b5ed1&&_0x5b5ed1[_0xe8dd('0x79')]&&_0x5b5ed1[_0xe8dd('0x79')]!==_0xe8dd('0x7a')){logger['info'](_0xe8dd('0x7b'),'Recording\x20is\x20enabled!');_0x51d462['recordingURL']=util[_0xe8dd('0x4d')](_0xe8dd('0x67'),_0x349b76['serverUrl'],_0x51d462[_0xe8dd('0x68')],md5(_0x51d462[_0xe8dd('0x68')]));}return getConnection(_0x349b76)[_0xe8dd('0x2a')](function(_0x5c64fa){_0x30a426=_0x5c64fa;return getUser(_0x349b76,_0x4ecf80[_0xe8dd('0x69')],_0x30a426);})[_0xe8dd('0x2a')](function(_0x177950){_0x5e12eb=_0x177950;return getEndUser(_0x349b76,_0xcac40c,_0x51d462[_0xe8dd('0x7c')],_0x51d462[_0xe8dd('0x7d')],_0x30a426);})[_0xe8dd('0x2a')](function(_0x49aef4){_0x4876aa=_0x49aef4;return getTicket(_0x349b76,_0x5e12eb,_0x4876aa,_0xcac40c,_0x51d462,_0xcac40c[_0xe8dd('0x6b')],_0x30a426,'outbound');})[_0xe8dd('0x2a')](function(_0x179c06){_0x8611f4=_0x179c06;logger[_0xe8dd('0x22')](_0xe8dd('0x7e'),_0x8611f4['id']);logger['info'](_0xe8dd('0x7f'),_0x8611f4['id'],_0x4ecf80[_0xe8dd('0x5b')],_0x349b76['type']);switch(_0x349b76[_0xe8dd('0x44')]){case _0xe8dd('0x6f'):emit(util[_0xe8dd('0x4d')](_0xe8dd('0x70'),_0x4ecf80[_0xe8dd('0x5b')]),_0xe8dd('0x71'),{'recordId':_0x8611f4['id']});break;case _0xe8dd('0x72'):emit(util[_0xe8dd('0x4d')]('user:%s',_0x4ecf80[_0xe8dd('0x5b')]),_0xe8dd('0x73'),{'uri':util[_0xe8dd('0x4d')](_0xe8dd('0x80'),_0x30a426[_0xe8dd('0x74')],_0x8611f4['id'])});break;default:logger[_0xe8dd('0x75')](_0xe8dd('0x7b'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x1d681f){logger[_0xe8dd('0x75')](_0xe8dd('0x7b'),_0x1d681f);});};exports[_0xe8dd('0x81')]=function(_0x3ccb16,_0x4e0c8d,_0x1e34db,_0x2fde5a,_0x55f1d6,_0x3f96ed){var _0x49b532,_0x285efb,_0x3466ad,_0x2589d6;_0x3f96ed[_0xe8dd('0x62')]=intUtil[_0xe8dd('0x63')](_0x3f96ed[_0xe8dd('0x62')]);_0x3f96ed['remoteUri']=intUtil[_0xe8dd('0x63')](_0x3f96ed[_0xe8dd('0x64')]);if(_0x55f1d6&&_0x55f1d6['monitor_format']){logger['info']('['+_0x4e0c8d[_0xe8dd('0x82')][_0xe8dd('0x83')]()+']',_0xe8dd('0x66'));_0x4e0c8d[_0xe8dd('0x84')]=util[_0xe8dd('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f96ed['serverUrl'],_0x4e0c8d[_0xe8dd('0x68')],md5(_0x4e0c8d[_0xe8dd('0x68')]));}else{_0x4e0c8d[_0xe8dd('0x84')]='';}return getConnection(_0x3f96ed)[_0xe8dd('0x2a')](function(_0x49dfa8){_0x2589d6=_0x49dfa8;if(!_[_0xe8dd('0x25')](_0x2fde5a)){return getUser(_0x3f96ed,_0x2fde5a[_0xe8dd('0x5b')],_0x2589d6);}else{return getUser(_0x3f96ed,null,_0x2589d6);}})[_0xe8dd('0x2a')](function(_0x32dc7a){_0x49b532=_0x32dc7a;return getEndUser(_0x3f96ed,_0x1e34db,_0x4e0c8d['calleridname'],_0x4e0c8d['calleridnum'],_0x2589d6);})[_0xe8dd('0x2a')](function(_0x1ff675){_0x285efb=_0x1ff675;return getTicket(_0x3f96ed,_0x49b532,_0x285efb,_0x1e34db,_0x4e0c8d,_0x1e34db['Fields'],_0x2589d6);})[_0xe8dd('0x2a')](function(_0x18b3df){_0x3466ad=_0x18b3df;logger[_0xe8dd('0x22')]('['+_0x4e0c8d['lastevent'][_0xe8dd('0x83')]()+']\x20Ticket\x20%s\x20created.',_0x3466ad['id']);logger[_0xe8dd('0x22')]('['+_0x4e0c8d['lastevent'][_0xe8dd('0x83')]()+_0xe8dd('0x85'),_0x3f96ed[_0xe8dd('0x44')]);})['catch'](function(_0x501886){logger[_0xe8dd('0x75')]('['+_0x4e0c8d[_0xe8dd('0x82')]['toUpperCase']()+']',_0x501886);});}; \ No newline at end of file +var _0x98c5=['Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','No\x20Company','upperFirst','forEach','string','idField','variable','variableName','customVariable','Variable','name','toString','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[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','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','getString','Descriptions','ticketType','Task','IsReminderSet','endUserType','contact','lead','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','','format','Caller\x20-\x20%s'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x98c5,0xbe));var _0x598c=function(_0x29e230,_0x1a2569){_0x29e230=_0x29e230-0x0;var _0x410e77=_0x98c5[_0x29e230];return _0x410e77;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x598c('0x0'));var BPromise=require(_0x598c('0x1'));var md5=require(_0x598c('0x2'));var jsforce=require('jsforce');var util=require(_0x598c('0x3'));var Redis=require(_0x598c('0x4'));var intUtil=require(_0x598c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x598c('0x6'))(_0x598c('0x7'));config[_0x598c('0x8')]=_[_0x598c('0x9')](config[_0x598c('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x598c('0xa'))(new Redis(config[_0x598c('0x8')]));function emit(_0x265bd1,_0x26fe5b,_0x5c3431){io['to'](_0x265bd1)[_0x598c('0xb')](_0x26fe5b,_0x5c3431);}function getTicket(_0x47351b,_0x2a0e3b,_0x5926fc,_0x2f9a32,_0x13d1cb,_0x435c1d,_0x26e469,_0x29d1e0){var _0xa09139=Object['assign']({},{'OwnerId':_0x2a0e3b['id'],'Subject':intUtil[_0x598c('0xc')](_0x2f9a32['Subjects'],_0x13d1cb,'\x20'),'Description':intUtil[_0x598c('0xc')](_0x2f9a32[_0x598c('0xd')],_0x13d1cb,'\x0a')},getCustomFields(_0x435c1d,_0x13d1cb));if(_0x5926fc){if(_0x2f9a32[_0x598c('0xe')]===_0x598c('0xf')){_0xa09139['ActivityDate']=moment['utc']();_0xa09139[_0x598c('0x10')]=![];_0xa09139['IsRecurrence']=![];if(_0x5926fc[_0x598c('0x11')]===_0x598c('0x12')||_0x5926fc['endUserType']===_0x598c('0x13')){_0xa09139['WhoId']=_0x5926fc['id'];}else if(_0x5926fc[_0x598c('0x11')]===_0x598c('0x14')){_0xa09139[_0x598c('0x15')]=_0x5926fc['id'];}}else if(_0x2f9a32['ticketType']===_0x598c('0x16')){if(_0x5926fc[_0x598c('0x11')]===_0x598c('0x12')){_0xa09139[_0x598c('0x17')]=_0x5926fc['id'];}else if(_0x5926fc['endUserType']===_0x598c('0x14')){_0xa09139[_0x598c('0x18')]=_0x5926fc['id'];}else if(_0x5926fc[_0x598c('0x11')]===_0x598c('0x13')&&_0x2f9a32[_0x598c('0x19')]){_0xa09139[_0x2f9a32[_0x598c('0x19')]]=_0x5926fc['id'];}else{logger[_0x598c('0x1a')](_0x598c('0x1b'));}}}return _0x26e469[_0x598c('0x1c')](_0x2f9a32[_0x598c('0xe')])[_0x598c('0x1d')](_0xa09139);}function getUser(_0x27d723,_0x1a43bf,_0x5d382b){if(!_[_0x598c('0x1e')](_0x1a43bf)&&intUtil[_0x598c('0x1f')](_0x1a43bf)){var _0x1d7f1a={'Email':_0x1a43bf};var _0x30af92={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5d382b[_0x598c('0x1c')](_0x598c('0x20'))[_0x598c('0x21')](_0x1d7f1a,_0x30af92)['execute']()[_0x598c('0x22')](function(_0x4eabba){if(_0x4eabba[_0x598c('0x23')]){var _0x55333b=_[_0x598c('0x21')](_0x4eabba,function(_0x570e26){return _0x570e26[_0x598c('0x24')]===_0x1a43bf;});if(_0x55333b){logger[_0x598c('0x1a')](_0x598c('0x25'),_0x1a43bf);return BPromise[_0x598c('0x26')]({'id':_0x55333b['Id'],'name':_0x55333b[_0x598c('0x27')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1a43bf);return _0x5d382b['identity']()['then'](function(_0x4c0363){return BPromise['resolve']({'id':_0x4c0363[_0x598c('0x28')],'name':_0x4c0363[_0x598c('0x29')]});});}});}else{logger[_0x598c('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1a43bf);return _0x5d382b[_0x598c('0x2a')]()[_0x598c('0x22')](function(_0x1028a8){return BPromise[_0x598c('0x26')]({'id':_0x1028a8[_0x598c('0x28')],'name':_0x1028a8[_0x598c('0x29')]});});}}function getEndUser(_0x533930,_0x475fa8,_0x561d28,_0x10fb05,_0x483fa0){var _0x29f01d={'$or':{'Phone':_0x10fb05}};var _0xbd4c26={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x598c('0x22')](function(){logger[_0x598c('0x1a')](_0x598c('0x2b'),_0x10fb05,_0x475fa8[_0x598c('0x2c')]);switch(_0x475fa8['moduleSearch']){case _0x598c('0x2d'):var _0x44f97f=_['cloneDeep'](_0x29f01d);if(_0x475fa8[_0x598c('0x2e')]){var _0x2c290c={};_0x2c290c[_0x475fa8[_0x598c('0x2e')]]=_0x10fb05;_[_0x598c('0x2f')](_0x44f97f[_0x598c('0x30')],_0x2c290c);}return _0x483fa0[_0x598c('0x1c')](_0x598c('0x31'))['find'](_0x44f97f,_0xbd4c26)[_0x598c('0x32')]()[_0x598c('0x22')](function(_0x1ead90){if(_0x1ead90&&_0x1ead90[_0x598c('0x23')]){return _0x1ead90;}else{var _0x1720e1=_[_0x598c('0x33')](_0x29f01d);if(_0x475fa8[_0x598c('0x34')]){var _0x1af898={};_0x1af898[_0x475fa8[_0x598c('0x34')]]=_0x10fb05;_[_0x598c('0x2f')](_0x1720e1[_0x598c('0x30')],_0x1af898);}return _0x483fa0[_0x598c('0x1c')](_0x598c('0x35'))['find'](_0x1720e1,_0xbd4c26);}});case _0x598c('0x36'):var _0x44cabf=_[_0x598c('0x33')](_0x29f01d);if(_0x475fa8[_0x598c('0x37')]){var _0x2c290c={};_0x2c290c[_0x475fa8[_0x598c('0x37')]]=_0x10fb05;_[_0x598c('0x2f')](_0x44cabf[_0x598c('0x30')],_0x2c290c);}return _0x483fa0['sobject']('Account')[_0x598c('0x21')](_0x44cabf,_0xbd4c26)[_0x598c('0x32')]()[_0x598c('0x22')](function(_0x2a736a){if(_0x2a736a&&_0x2a736a[_0x598c('0x23')]){return _0x2a736a;}else{var _0x547692=_[_0x598c('0x33')](_0x29f01d);if(_0x475fa8[_0x598c('0x2e')]){var _0x322917={};_0x322917[_0x475fa8['additionalSearchContact']]=_0x10fb05;_[_0x598c('0x2f')](_0x547692[_0x598c('0x30')],_0x322917);}return _0x483fa0[_0x598c('0x1c')](_0x598c('0x31'))[_0x598c('0x21')](_0x547692,_0xbd4c26)[_0x598c('0x22')](function(_0x1fb835){if(_0x1fb835&&_0x1fb835['length']){return _0x1fb835;}else{var _0xac624e=_[_0x598c('0x33')](_0x29f01d);if(_0x475fa8[_0x598c('0x34')]){var _0x2bbba2={};_0x2bbba2[_0x475fa8[_0x598c('0x34')]]=_0x10fb05;_[_0x598c('0x2f')](_0xac624e[_0x598c('0x30')],_0x2bbba2);}return _0x483fa0['sobject'](_0x598c('0x35'))[_0x598c('0x21')](_0xac624e,_0xbd4c26);}});}});case _0x598c('0x12'):var _0x44f97f=_[_0x598c('0x33')](_0x29f01d);if(_0x475fa8[_0x598c('0x2e')]){var _0x2c290c={};_0x2c290c[_0x475fa8[_0x598c('0x2e')]]=_0x10fb05;_[_0x598c('0x2f')](_0x44f97f[_0x598c('0x30')],_0x2c290c);}return _0x483fa0[_0x598c('0x1c')](_0x598c('0x31'))[_0x598c('0x21')](_0x44f97f,_0xbd4c26)['execute']();case _0x598c('0x13'):var _0x25f4bf=_[_0x598c('0x33')](_0x29f01d);if(_0x475fa8['additionalSearchLead']){var _0x2c290c={};_0x2c290c[_0x475fa8['additionalSearchLead']]=_0x10fb05;_[_0x598c('0x2f')](_0x25f4bf[_0x598c('0x30')],_0x2c290c);}return _0x483fa0[_0x598c('0x1c')]('Lead')[_0x598c('0x21')](_0x25f4bf,_0xbd4c26);case _0x598c('0x14'):var _0x44cabf=_[_0x598c('0x33')](_0x29f01d);if(_0x475fa8['additionalSearchAccount']){var _0x2c290c={};_0x2c290c[_0x475fa8['additionalSearchAccount']]=_0x10fb05;_[_0x598c('0x2f')](_0x44cabf['$or'],_0x2c290c);}return _0x483fa0[_0x598c('0x1c')]('Account')['find'](_0x44cabf,_0xbd4c26);default:return null;}})[_0x598c('0x22')](function(_0x22c6d1){if(_0x22c6d1&&_0x22c6d1[_0x598c('0x23')]){var _0x451b5d=_[_0x598c('0x38')](_0x22c6d1);if(_0x451b5d){return BPromise['resolve']({'id':_0x451b5d['Id'],'name':_0x451b5d[_0x598c('0x27')],'phone':_0x451b5d['Phone'],'endUserType':_0x451b5d[_0x598c('0x39')][_0x598c('0x3a')][_0x598c('0x3b')]()});}}})[_0x598c('0x22')](function(_0x1a6c6b){if(_0x1a6c6b){logger[_0x598c('0x1a')](_0x598c('0x3c'),_0x1a6c6b['endUserType'],_0x10fb05);return BPromise[_0x598c('0x26')](_0x1a6c6b);}else{logger[_0x598c('0x1a')](_0x598c('0x3d'),_0x10fb05);var _0x252fcf={'Phone':_0x10fb05};if(_0x475fa8[_0x598c('0x3e')]){if(_0x475fa8[_0x598c('0x3e')]==='contact'){logger[_0x598c('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x10fb05,_0x475fa8[_0x598c('0x3e')]);_0x252fcf['LastName']=_0x561d28!==_0x598c('0x3f')?_0x561d28:util[_0x598c('0x40')](_0x598c('0x41'),_0x10fb05);}else if(_0x475fa8[_0x598c('0x3e')]===_0x598c('0x13')){logger['info'](_0x598c('0x42'),_0x10fb05,_0x475fa8[_0x598c('0x3e')]);_0x252fcf[_0x598c('0x43')]=_0x561d28!==_0x598c('0x3f')?_0x561d28:util[_0x598c('0x40')](_0x598c('0x41'),_0x10fb05);_0x252fcf['Company']=_0x598c('0x44');}else if(_0x475fa8[_0x598c('0x3e')]==='account'){logger[_0x598c('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x10fb05,_0x475fa8[_0x598c('0x3e')]);_0x252fcf[_0x598c('0x27')]=_0x561d28!==_0x598c('0x3f')?_0x561d28:util[_0x598c('0x40')]('Caller\x20-\x20%s',_0x10fb05);}else{return null;}}return _0x483fa0[_0x598c('0x1c')](_[_0x598c('0x45')](_0x475fa8[_0x598c('0x3e')]))['create'](_0x252fcf)[_0x598c('0x22')](function(_0x202ee6){return BPromise[_0x598c('0x26')]({'id':_0x202ee6['id'],'endUserType':_0x475fa8[_0x598c('0x3e')]});});}});}function getCustomFields(_0x45a34f,_0x25008d){var _0x538029={};if(_0x45a34f[_0x598c('0x23')]>0x0){_[_0x598c('0x46')](_0x45a34f,function(_0x33c72a){if(_['includes']([_0x598c('0x47'),'picklist'],_0x33c72a['type'])&&_0x33c72a[_0x598c('0x48')]){_0x538029[_0x33c72a['idField']]=_0x33c72a['content']['toString']();}else if(_0x33c72a[_0x598c('0x3a')]===_0x598c('0x49')&&_0x33c72a[_0x598c('0x4a')]&&_0x33c72a[_0x598c('0x48')]){_0x25008d[_0x33c72a[_0x598c('0x4a')]]&&(_0x538029[_0x33c72a[_0x598c('0x48')]]=_0x25008d[_0x33c72a[_0x598c('0x4a')]]['toString']());}else if(_0x33c72a[_0x598c('0x3a')]===_0x598c('0x4b')&&_0x33c72a['Variable']&&_0x33c72a[_0x598c('0x4c')][_0x598c('0x4d')]&&_0x33c72a['idField']){_0x25008d[_0x33c72a[_0x598c('0x4c')][_0x598c('0x4d')][_0x598c('0x3b')]()]&&(_0x538029[_0x33c72a['idField']]=_0x25008d[_0x33c72a[_0x598c('0x4c')][_0x598c('0x4d')]['toLowerCase']()][_0x598c('0x4e')]());}});}return _0x538029;}function getConnection(_0x3e08a2){var _0x4c2e2b=_0x3e08a2[_0x598c('0x4f')][_0x598c('0x50')](_0x3e08a2[_0x598c('0x51')]);var _0x38966f=new jsforce[(_0x598c('0x52'))]({'oauth2':{'loginUrl':_0x3e08a2[_0x598c('0x53')]||_0x598c('0x54'),'clientId':_0x3e08a2[_0x598c('0x55')],'clientSecret':_0x3e08a2[_0x598c('0x56')]}});return _0x38966f[_0x598c('0x57')](_0x3e08a2[_0x598c('0x58')],_0x4c2e2b)[_0x598c('0x22')](function(){logger[_0x598c('0x1a')]('Connection\x20established.');return _0x38966f;});}exports[_0x598c('0x59')]=function(_0xe14deb,_0x20dacb,_0x416ce6,_0x21753a,_0x16d3c4,_0x4a71fa){var _0x36e514,_0x1906c0,_0x205bb5,_0x24d204;_0x4a71fa['serverUrl']=intUtil[_0x598c('0x5a')](_0x4a71fa['serverUrl']);_0x4a71fa['remoteUri']=intUtil[_0x598c('0x5a')](_0x4a71fa['remoteUri']);if(_0x16d3c4&&_0x16d3c4[_0x598c('0x5b')]){logger[_0x598c('0x1a')]('[QUEUE]',_0x598c('0x5c'));_0x20dacb[_0x598c('0x5d')]=util[_0x598c('0x40')](_0x598c('0x5e'),_0x4a71fa[_0x598c('0x5f')],_0x20dacb[_0x598c('0x60')],md5(_0x20dacb['uniqueid']));}else{_0x20dacb['recordingURL']='';}return getConnection(_0x4a71fa)[_0x598c('0x22')](function(_0x103086){_0x24d204=_0x103086;return getUser(_0x4a71fa,_0x21753a[_0x598c('0x61')],_0x24d204);})['then'](function(_0x2ff644){_0x36e514=_0x2ff644;return getEndUser(_0x4a71fa,_0x416ce6,_0x20dacb[_0x598c('0x62')],_0x20dacb[_0x598c('0x63')],_0x24d204);})[_0x598c('0x22')](function(_0x4c1a03){_0x1906c0=_0x4c1a03;return getTicket(_0x4a71fa,_0x36e514,_0x1906c0,_0x416ce6,_0x20dacb,_0x416ce6[_0x598c('0x64')],_0x24d204,'queue');})[_0x598c('0x22')](function(_0x49820c){_0x205bb5=_0x49820c;logger[_0x598c('0x1a')](_0x598c('0x65'),_0x205bb5['id']);logger[_0x598c('0x1a')](_0x598c('0x66'),_0x205bb5['id'],_0x21753a[_0x598c('0x4d')],_0x4a71fa[_0x598c('0x3a')]);switch(_0x4a71fa[_0x598c('0x3a')]){case _0x598c('0x67'):emit(util[_0x598c('0x40')](_0x598c('0x68'),_0x21753a['name']),_0x598c('0x69'),{'recordId':_0x205bb5['id']});break;case'newTab':emit(util[_0x598c('0x40')](_0x598c('0x68'),_0x21753a[_0x598c('0x4d')]),_0x598c('0x6a'),{'uri':util['format'](_0x598c('0x6b'),_0x24d204[_0x598c('0x6c')],_0x205bb5['id'])});break;default:logger[_0x598c('0x6d')](_0x598c('0x6e'));}})[_0x598c('0x6f')](function(_0x1e4b75){logger[_0x598c('0x6d')](_0x598c('0x70'),_0x1e4b75);});};exports[_0x598c('0x71')]=function(_0x988fd8,_0x55241a,_0x1c9416,_0x8fb9a,_0x576168,_0x4c6855,_0xb91909){var _0x3c350a,_0x14ca6e,_0x12c402,_0x27d2e7;_0x4c6855[_0x598c('0x5f')]=intUtil[_0x598c('0x5a')](_0x4c6855[_0x598c('0x5f')]);_0x4c6855[_0x598c('0x53')]=intUtil[_0x598c('0x5a')](_0x4c6855[_0x598c('0x53')]);if(_0xb91909&&_0xb91909[_0x598c('0x72')]&&_0xb91909['recordingFormat']!==_0x598c('0x73')){logger['info'](_0x598c('0x74'),_0x598c('0x5c'));_0x55241a[_0x598c('0x5d')]=util[_0x598c('0x40')](_0x598c('0x5e'),_0x4c6855[_0x598c('0x5f')],_0x55241a[_0x598c('0x60')],md5(_0x55241a[_0x598c('0x60')]));}return getConnection(_0x4c6855)[_0x598c('0x22')](function(_0x41c81b){_0x27d2e7=_0x41c81b;return getUser(_0x4c6855,_0x8fb9a['email'],_0x27d2e7);})[_0x598c('0x22')](function(_0x4d4d55){_0x3c350a=_0x4d4d55;return getEndUser(_0x4c6855,_0x1c9416,_0x55241a[_0x598c('0x75')],_0x55241a[_0x598c('0x76')],_0x27d2e7);})[_0x598c('0x22')](function(_0x44427c){_0x14ca6e=_0x44427c;return getTicket(_0x4c6855,_0x3c350a,_0x14ca6e,_0x1c9416,_0x55241a,_0x1c9416[_0x598c('0x64')],_0x27d2e7,_0x598c('0x71'));})[_0x598c('0x22')](function(_0x42fc5e){_0x12c402=_0x42fc5e;logger[_0x598c('0x1a')](_0x598c('0x77'),_0x12c402['id']);logger[_0x598c('0x1a')](_0x598c('0x78'),_0x12c402['id'],_0x8fb9a[_0x598c('0x4d')],_0x4c6855[_0x598c('0x3a')]);switch(_0x4c6855['type']){case _0x598c('0x67'):emit(util[_0x598c('0x40')](_0x598c('0x68'),_0x8fb9a[_0x598c('0x4d')]),_0x598c('0x69'),{'recordId':_0x12c402['id']});break;case _0x598c('0x79'):emit(util['format']('user:%s',_0x8fb9a['name']),_0x598c('0x6a'),{'uri':util['format'](_0x598c('0x6b'),_0x27d2e7[_0x598c('0x6c')],_0x12c402['id'])});break;default:logger[_0x598c('0x6d')](_0x598c('0x74'),_0x598c('0x7a'));}})[_0x598c('0x6f')](function(_0x412b9c){logger[_0x598c('0x6d')]('[OUTBOUND]',_0x412b9c);});};exports[_0x598c('0x7b')]=function(_0x23f6f1,_0x1d4d02,_0x5dfe63,_0x2270ef,_0x28c655,_0x267f94){var _0x138184,_0x54f7da,_0x2b322f,_0x2b8a3f;_0x267f94[_0x598c('0x5f')]=intUtil[_0x598c('0x5a')](_0x267f94[_0x598c('0x5f')]);_0x267f94[_0x598c('0x53')]=intUtil[_0x598c('0x5a')](_0x267f94[_0x598c('0x53')]);if(_0x28c655&&_0x28c655['monitor_format']){logger['info']('['+_0x1d4d02['lastevent'][_0x598c('0x7c')]()+']',_0x598c('0x5c'));_0x1d4d02[_0x598c('0x5d')]=util[_0x598c('0x40')](_0x598c('0x5e'),_0x267f94['serverUrl'],_0x1d4d02[_0x598c('0x60')],md5(_0x1d4d02['uniqueid']));}else{_0x1d4d02[_0x598c('0x5d')]='';}return getConnection(_0x267f94)['then'](function(_0x89c679){_0x2b8a3f=_0x89c679;if(!_[_0x598c('0x1e')](_0x2270ef)){return getUser(_0x267f94,_0x2270ef[_0x598c('0x4d')],_0x2b8a3f);}else{return getUser(_0x267f94,null,_0x2b8a3f);}})[_0x598c('0x22')](function(_0x5980f7){_0x138184=_0x5980f7;return getEndUser(_0x267f94,_0x5dfe63,_0x1d4d02[_0x598c('0x62')],_0x1d4d02[_0x598c('0x63')],_0x2b8a3f);})[_0x598c('0x22')](function(_0x4e0571){_0x54f7da=_0x4e0571;return getTicket(_0x267f94,_0x138184,_0x54f7da,_0x5dfe63,_0x1d4d02,_0x5dfe63['Fields'],_0x2b8a3f);})[_0x598c('0x22')](function(_0x14f7d7){_0x2b322f=_0x14f7d7;logger['info']('['+_0x1d4d02[_0x598c('0x7d')]['toUpperCase']()+_0x598c('0x7e'),_0x2b322f['id']);logger[_0x598c('0x1a')]('['+_0x1d4d02[_0x598c('0x7d')][_0x598c('0x7c')]()+_0x598c('0x7f'),_0x267f94[_0x598c('0x3a')]);})[_0x598c('0x6f')](function(_0x41ce49){logger['error']('['+_0x1d4d02['lastevent'][_0x598c('0x7c')]()+']',_0x41ce49);});}; \ 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 931204c..0f7a2a5 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 _0xccb5=['label','?sysparm_query=name%3D','label_entry','Incident','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','customField','nameField','toLowerCase','content','variable','variableName','idField','customVariable','Variable','name','toString',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm'];(function(_0x217d3a,_0x78f399){var _0x56e096=function(_0x31e3cd){while(--_0x31e3cd){_0x217d3a['push'](_0x217d3a['shift']());}};_0x56e096(++_0x78f399);}(_0xccb5,0x1f2));var _0x5ccb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xccb5[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5ccb('0x0'));var Promise=require(_0x5ccb('0x1'));var rp=require(_0x5ccb('0x2'));var util=require('util');var md5=require(_0x5ccb('0x3'));var Redis=require(_0x5ccb('0x4'));var intUtil=require(_0x5ccb('0x5'));var config=require(_0x5ccb('0x6'));var logger=require(_0x5ccb('0x7'))(_0x5ccb('0x8'));config[_0x5ccb('0x9')]=_[_0x5ccb('0xa')](config[_0x5ccb('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x1e49bf,_0x46ce96,_0x54b6ab,_0x4ac012,_0x20f06d,_0x40b2c1){return new Promise(function(_0x4e79da,_0x805eae){var _0x3e2f49={'method':_0x5ccb('0xb'),'uri':_0x4ac012+_0x5ccb('0xc')+'&'+_0x20f06d+'&'+_0x40b2c1,'auth':_0x46ce96,'json':!![]};return rp(_0x3e2f49)[_0x5ccb('0xd')](function(_0x3cd569){if(_0x3cd569[_0x5ccb('0xe')][_0x5ccb('0xf')]>0x0){_0x54b6ab[_0x5ccb('0x10')]=_0x3cd569[_0x5ccb('0xe')][0x0][_0x5ccb('0x11')];}logger[_0x5ccb('0x12')]('['+[_0x1e49bf[_0x5ccb('0x13')]()]+_0x5ccb('0x14'),_0x54b6ab);_0x4e79da(_0x54b6ab);})[_0x5ccb('0x15')](function(_0x169d67){logger[_0x5ccb('0x16')]('['+[_0x1e49bf[_0x5ccb('0x13')]()]+']',_0x169d67[_0x5ccb('0x17')]);_0x805eae(_0x169d67['message']);});});}function getUser(_0x1f1f88,_0x445213,_0x198e9c,_0x37cce1,_0x5c9ab6){return function(_0x458f0a){logger[_0x5ccb('0x12')]('['+[_0x1f1f88[_0x5ccb('0x13')]()]+_0x5ccb('0x18'),_0x458f0a);return new Promise(function(_0x3bc96f,_0x55c81e){if(intUtil['validateEmail'](_0x458f0a['userEmail'])){var _0x53cd39={'method':_0x5ccb('0xb'),'uri':_0x198e9c+_0x5ccb('0x19')+_0x458f0a[_0x5ccb('0x1a')]+'&'+_0x37cce1+'&'+_0x5c9ab6,'auth':_0x445213,'json':!![]};logger['info']('['+[_0x1f1f88[_0x5ccb('0x13')]()]+_0x5ccb('0x1b'),_0x53cd39);return rp(_0x53cd39)[_0x5ccb('0xd')](function(_0x31ab34){logger[_0x5ccb('0x12')]('['+[_0x1f1f88[_0x5ccb('0x13')]()]+_0x5ccb('0x1c'),_0x31ab34);if(_0x31ab34[_0x5ccb('0xe')]['length']>0x0&&String(_0x31ab34[_0x5ccb('0xe')][0x0]['active'])===_0x5ccb('0x1d')){_0x458f0a[_0x5ccb('0x1e')]=_0x31ab34[_0x5ccb('0xe')][0x0][_0x5ccb('0x11')];}else{_0x458f0a[_0x5ccb('0x1e')]=_0x458f0a[_0x5ccb('0x10')];_0x458f0a[_0x5ccb('0x1a')]=_0x458f0a[_0x5ccb('0x1f')];}logger[_0x5ccb('0x12')]('['+[_0x1f1f88['toUpperCase']()]+'],\x20getUser\x20crm',_0x458f0a);_0x3bc96f(_0x458f0a);})[_0x5ccb('0x15')](function(_0x4ad485){logger[_0x5ccb('0x16')]('['+[_0x1f1f88[_0x5ccb('0x13')]()]+']',_0x4ad485[_0x5ccb('0x17')]);_0x55c81e(_0x4ad485[_0x5ccb('0x17')]);});}else{logger['info']('['+[_0x1f1f88[_0x5ccb('0x13')]()]+_0x5ccb('0x20'));_0x458f0a[_0x5ccb('0x1e')]=_0x458f0a[_0x5ccb('0x10')];_0x458f0a[_0x5ccb('0x1a')]=_0x458f0a[_0x5ccb('0x1f')];_0x3bc96f(_0x458f0a);}});};}function createEndUser(_0x2c5719,_0x59c063,_0x13cb87,_0x377851,_0x4b05cb){logger[_0x5ccb('0x12')]('['+[_0x2c5719['toUpperCase']()]+_0x5ccb('0x21'),_0x13cb87);return new Promise(function(_0xaf709e,_0x526291){var _0x485b16={'method':_0x5ccb('0x22'),'uri':_0x377851+_0x5ccb('0x23')+_0x4b05cb,'body':{'user_name':_0x13cb87[_0x5ccb('0x24')],'roles':_0x5ccb('0x25'),'first_name':_0x13cb87[_0x5ccb('0x24')],'active':_0x5ccb('0x1d'),'date_format':'System','phone':_0x13cb87[_0x5ccb('0x24')]},'auth':_0x59c063,'json':!![]};return rp(_0x485b16)[_0x5ccb('0xd')](function(_0x43d42a){logger[_0x5ccb('0x12')]('['+[_0x2c5719[_0x5ccb('0x13')]()]+_0x5ccb('0x26'),_0x43d42a['result']);_0x13cb87[_0x5ccb('0x27')]=_0x43d42a[_0x5ccb('0xe')]['sys_id'];_0xaf709e(_0x13cb87);})[_0x5ccb('0x15')](function(_0x1721b6){logger[_0x5ccb('0x16')]('['+[_0x2c5719[_0x5ccb('0x13')]()]+']',_0x1721b6[_0x5ccb('0x17')]);_0x526291(_0x1721b6[_0x5ccb('0x17')]);});});}function getEndUser(_0x21de8a,_0x500a3b,_0x1ef117,_0x4349c9,_0x56ab8b){return function(_0x54b425){logger[_0x5ccb('0x12')]('['+[_0x21de8a[_0x5ccb('0x13')]()]+_0x5ccb('0x28'),_0x54b425);return new Promise(function(_0x5ad59f,_0x5f2b6c){var _0x408924={'method':_0x5ccb('0xb'),'uri':_0x1ef117+_0x5ccb('0x29')+_0x54b425[_0x5ccb('0x24')]+'&'+_0x4349c9+'&'+_0x56ab8b,'auth':_0x500a3b,'json':!![]};return rp(_0x408924)[_0x5ccb('0xd')](function(_0x2f1c1e){if(_0x2f1c1e[_0x5ccb('0xe')][_0x5ccb('0xf')]>0x0){_0x54b425[_0x5ccb('0x27')]=_0x2f1c1e[_0x5ccb('0xe')][0x0][_0x5ccb('0x11')];logger[_0x5ccb('0x12')]('['+[_0x21de8a['toUpperCase']()]+_0x5ccb('0x2a'),_0x54b425);_0x5ad59f(_0x54b425);}else{return createEndUser(_0x21de8a,_0x500a3b,_0x54b425,_0x1ef117,_0x4349c9)[_0x5ccb('0xd')](function(_0x2ec108){logger[_0x5ccb('0x12')]('['+[_0x21de8a[_0x5ccb('0x13')]()]+_0x5ccb('0x2b'),_0x2ec108);_0x5ad59f(_0x2ec108);});}})[_0x5ccb('0x15')](function(_0x11d404){logger[_0x5ccb('0x16')]('['+[_0x21de8a[_0x5ccb('0x13')]()]+']',_0x11d404[_0x5ccb('0x17')]);_0x5f2b6c(_0x11d404[_0x5ccb('0x17')]);});});};}function getCustomFields(_0x37922f,_0x5589b7){var _0x5962cb={};if(_0x37922f[_0x5ccb('0xf')]>0x0){_['forEach'](_0x37922f,function(_0x42acd3){if(_[_0x5ccb('0x2c')]([_0x5ccb('0x2d'),_0x5ccb('0x2e')],_0x42acd3[_0x5ccb('0x2f')])&&_0x42acd3['nameField']&&!_0x42acd3[_0x5ccb('0x30')]){_0x5962cb[_0x42acd3[_0x5ccb('0x31')][_0x5ccb('0x32')]()]=_0x42acd3[_0x5ccb('0x33')]['toString']();}else if(_[_0x5ccb('0x2c')](['string',_0x5ccb('0x2e')],_0x42acd3[_0x5ccb('0x2f')])&&_0x42acd3['idField']&&_0x42acd3[_0x5ccb('0x30')]){_0x5962cb[_0x42acd3['idField'][_0x5ccb('0x32')]()]=_0x42acd3[_0x5ccb('0x33')]['toString']();}else if(_0x42acd3[_0x5ccb('0x2f')]===_0x5ccb('0x34')&&_0x42acd3[_0x5ccb('0x35')]&&_0x42acd3['idField']&&_0x42acd3['customField']){_0x5962cb[_0x42acd3[_0x5ccb('0x36')][_0x5ccb('0x32')]()]=_0x5589b7[_0x42acd3[_0x5ccb('0x35')]]['toString']();}else if(_0x42acd3['type']===_0x5ccb('0x37')&&_0x42acd3[_0x5ccb('0x38')]&&_0x42acd3[_0x5ccb('0x38')][_0x5ccb('0x39')]&&_0x42acd3[_0x5ccb('0x36')]&&_0x42acd3[_0x5ccb('0x30')]){_0x5962cb[_0x42acd3[_0x5ccb('0x36')][_0x5ccb('0x32')]()]=_0x5589b7[_0x42acd3[_0x5ccb('0x38')][_0x5ccb('0x39')][_0x5ccb('0x32')]()][_0x5ccb('0x3a')]();}});}return _0x5962cb;}function getTicket(_0x4caadd,_0x37eadf,_0x50e148,_0x44feca,_0x7df401,_0x354642){return function(_0x386c87){logger[_0x5ccb('0x12')]('['+[_0x4caadd[_0x5ccb('0x13')]()]+_0x5ccb('0x3b'),_0x386c87);return new Promise(function(_0x4fb8d9,_0x3039e1){var _0x4094fc=_0x4caadd[_0x5ccb('0x32')]()===_0x5ccb('0x3c')?_0x386c87[_0x5ccb('0x1e')]:_0x386c87['endUserId'];var _0x4fb84b={'method':_0x5ccb('0x22'),'uri':_0x50e148+_0x5ccb('0x3d')+'?'+_0x354642,'body':Object[_0x5ccb('0x3e')]({},{'active':_0x5ccb('0x1d'),'caller_id':_0x4094fc,'assigned_to':_0x386c87[_0x5ccb('0x1e')],'short_description':intUtil['getString'](_0x44feca[_0x5ccb('0x3f')],_0x7df401,'\x20'),'description':intUtil[_0x5ccb('0x40')](_0x44feca[_0x5ccb('0x41')],_0x7df401,'\x0a')},getCustomFields(_0x44feca[_0x5ccb('0x42')],_0x7df401)),'auth':_0x37eadf,'json':!![]};return rp(_0x4fb84b)['then'](function(_0x598903){logger[_0x5ccb('0x12')]('['+[_0x4caadd[_0x5ccb('0x13')]()]+_0x5ccb('0x43'),_0x598903[_0x5ccb('0xe')]);_0x386c87[_0x5ccb('0x44')]=_0x598903[_0x5ccb('0xe')][_0x5ccb('0x11')];_0x386c87[_0x5ccb('0x45')]=_0x598903[_0x5ccb('0xe')][_0x5ccb('0x46')];logger[_0x5ccb('0x12')]('['+[_0x4caadd[_0x5ccb('0x13')]()]+_0x5ccb('0x47'),_0x386c87);_0x4fb8d9(_0x386c87);})[_0x5ccb('0x15')](function(_0x234db7){logger[_0x5ccb('0x16')]('['+[_0x4caadd[_0x5ccb('0x13')]()]+']',_0x234db7[_0x5ccb('0x17')]);_0x3039e1(_0x234db7[_0x5ccb('0x17')]);});});};}function createRemoteTag(_0x4ea3cb,_0x262155,_0x31c3d6,_0x7bcec4){return new Promise(function(_0x546204,_0x15193c){var _0x169404={'method':'POST','uri':_0x31c3d6+_0x5ccb('0x48')+'?'+_0x7bcec4,'body':{'short_description':_0x4ea3cb,'global':!![],'active':!![],'name':_0x4ea3cb},'auth':_0x262155,'json':!![]};return rp(_0x169404)[_0x5ccb('0xd')](function(_0x453f72){var _0x68d322=_0x453f72[_0x5ccb('0xe')][_0x5ccb('0x11')];_0x546204(_0x68d322);});});}function getRemoteTag(_0xb718c,_0x3e2656,_0x5cdd93,_0x12df5e,_0x241b9d){return new Promise(function(_0x21fb9f,_0x552909){var _0x2c46cc={'method':_0x5ccb('0xb'),'uri':_0x5cdd93+_0x5ccb('0x48')+_0x5ccb('0x49')+_0xb718c+'&'+_0x12df5e,'auth':_0x3e2656,'json':!![]};return rp(_0x2c46cc)[_0x5ccb('0xd')](function(_0x31997d){if(_0x31997d['result'][_0x5ccb('0xf')]>0x0){var _0x1398b1=_0x31997d[_0x5ccb('0xe')][0x0][_0x5ccb('0x11')];_0x21fb9f(_0x1398b1);}else{return createRemoteTag(_0xb718c,_0x3e2656,_0x5cdd93,_0x12df5e)[_0x5ccb('0xd')](function(_0x512f60){_0x21fb9f(_0x512f60);});}});});}function assignTagToIncident(_0x1959d9,_0x1dcc30,_0x378011,_0x26d157,_0xc6f31c){return new Promise(function(_0x56a423,_0x1bc462){var _0xb8e9bc={'method':_0x5ccb('0x22'),'uri':_0x378011+_0x5ccb('0x4a')+'?'+_0xc6f31c,'body':{'label':_0x1959d9,'table':'incident','id_type':_0x5ccb('0x4b'),'table_key':_0x26d157[_0x5ccb('0x44')],'title':'Incident\x20-\x20'+_0x26d157[_0x5ccb('0x45')],'id_display':_0x26d157[_0x5ccb('0x45')]},'auth':_0x1dcc30,'json':!![]};return rp(_0xb8e9bc)[_0x5ccb('0xd')](function(_0x1887dc){_0x56a423();})[_0x5ccb('0x15')](function(){_0x56a423();});});}function manageTags(_0x11f7d0,_0x41ca8c,_0x5a0ca5,_0xfc4054,_0x5221b0,_0x30090e,_0x3e023c){return new Promise(function(_0x36152f,_0x33d5bd){var _0xaa740e=[];_0x41ca8c[_0x5ccb('0x4c')](function(_0x3dc834){_0xaa740e['push'](getRemoteTag(_0x3dc834,_0x5a0ca5,_0xfc4054,_0x30090e,_0x3e023c));});return Promise['all'](_0xaa740e)['then'](function(_0x3c31bb){if(_0x3c31bb[_0x5ccb('0xf')]){logger[_0x5ccb('0x12')]('['+[_0x11f7d0[_0x5ccb('0x13')]()]+_0x5ccb('0x4d'),_0x3c31bb);var _0x36fc2d=[];_0x3c31bb['forEach'](function(_0xafc141){_0x36fc2d[_0x5ccb('0x4e')](assignTagToIncident(_0xafc141,_0x5a0ca5,_0xfc4054,_0x5221b0,_0x30090e));});return Promise['all'](_0x36fc2d)['then'](function(){_0x36152f();})[_0x5ccb('0x15')](function(){_0x36152f();});}else{_0x36152f();}});});}function getTags(_0x2e134e,_0x3d5b8f,_0x374245,_0x38645,_0xa6087f,_0x58b6ae){return function(_0x2f3feb){return new Promise(function(_0x138942,_0x17cbb1){var _0x3adc85=[];var _0x2f30d5=_0x38645[_0x5ccb('0x4f')];if(_0x2f30d5&&_0x2f30d5['length']>0x0){_0x3adc85=_[_0x5ccb('0x50')](_0x2f30d5,_0x5ccb('0x39'));}if(_0x3adc85['length']>0x0){return manageTags(_0x2e134e,_0x3adc85,_0x3d5b8f,_0x374245,_0x2f3feb,_0xa6087f,_0x58b6ae)[_0x5ccb('0xd')](function(){_0x138942(_0x2f3feb);});}else{_0x138942(_0x2f3feb);}});};}function emit(_0x1e5588,_0x1a91fd,_0x51fe43){var _0x431c89=_0x5ccb('0x51')+_0x5ccb('0x52')+_0x5ccb('0x53')+_0x5ccb('0x54');var _0xc50ebe={'uri':_0x1e5588+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x51fe43+_0x431c89};io['to'](util[_0x5ccb('0x55')](_0x5ccb('0x56'),_0x1a91fd))['emit'](_0x5ccb('0x57'),_0xc50ebe);}exports['cs']=function(_0x467c4d,_0x85306f,_0x25975b,_0x414fbb,_0x243d1e,_0x5bf166,_0x430d4a,_0x190297){var _0x6ee1d4={};var _0x7bc34f={'user':_0x5bf166[_0x5ccb('0x58')],'pass':_0x5bf166[_0x5ccb('0x59')]};var _0x216208=_0x5ccb('0x5a');var _0x1525a4=_0x5ccb('0x5b');_0x5bf166['remoteUri']=intUtil[_0x5ccb('0x5c')](_0x5bf166[_0x5ccb('0x5d')]);_0x5bf166['serverUrl']=intUtil[_0x5ccb('0x5c')](_0x5bf166['serverUrl']);var _0x38f72f=util[_0x5ccb('0x55')](_0x5ccb('0x5e'),_0x5bf166[_0x5ccb('0x5d')]);_0x6ee1d4[_0x5ccb('0x1a')]=!_[_0x5ccb('0x5f')](_0x414fbb)?_0x414fbb['email']:null;_0x6ee1d4[_0x5ccb('0x1f')]=_0x5bf166[_0x5ccb('0x60')];_0x6ee1d4[_0x5ccb('0x24')]=_0x190297[_0x5ccb('0x32')]()===_0x5ccb('0x3c')?_0x85306f[_0x5ccb('0x61')]:_0x85306f[_0x5ccb('0x62')];_0x6ee1d4[_0x5ccb('0x63')]=_0x190297===_0x5ccb('0x64')||_0x190297===_0x5ccb('0x65')?_0x5ccb('0x64'):_0x5ccb('0x3c');var _0x22b75e=util['format'](_0x5ccb('0x66'),_0x5bf166['serverUrl'],_0x85306f[_0x5ccb('0x67')],md5(_0x85306f['uniqueid']));if(_0x243d1e&&_0x243d1e[_0x5ccb('0x68')]){logger[_0x5ccb('0x12')](_0x5ccb('0x69'),'Recording\x20is\x20enabled!');_0x85306f[_0x5ccb('0x6a')]=_0x22b75e;}else if(_0x430d4a&&_0x430d4a[_0x5ccb('0x6b')]&&_0x430d4a[_0x5ccb('0x6b')]!==_0x5ccb('0x6c')){logger[_0x5ccb('0x12')]('[OUTBOUND]',_0x5ccb('0x6d'));_0x85306f[_0x5ccb('0x6a')]=_0x22b75e;}else{_0x85306f[_0x5ccb('0x6a')]='';}return getAdminUser(_0x190297,_0x7bc34f,_0x6ee1d4,_0x38f72f,_0x1525a4,_0x216208)[_0x5ccb('0xd')](getUser(_0x190297,_0x7bc34f,_0x38f72f,_0x1525a4,_0x216208))[_0x5ccb('0xd')](getEndUser(_0x190297,_0x7bc34f,_0x38f72f,_0x1525a4,_0x216208))[_0x5ccb('0xd')](getTicket(_0x190297,_0x7bc34f,_0x38f72f,_0x25975b,_0x85306f,_0x1525a4))[_0x5ccb('0xd')](function(_0x182277){logger['info'](util['format'](_0x5ccb('0x6e'),_0x182277[_0x5ccb('0x44')]));logger[_0x5ccb('0x12')](util[_0x5ccb('0x55')](_0x5ccb('0x6f'),_0x190297));if(_0x190297!=='unmanaged'){logger[_0x5ccb('0x12')]('['+[_0x190297[_0x5ccb('0x13')]()]+']',_0x5ccb('0x70'));emit(_0x5bf166[_0x5ccb('0x5d')],_0x414fbb[_0x5ccb('0x39')],_0x182277[_0x5ccb('0x44')]);}})['catch'](function(_0xab3c01){logger['error']('['+[_0x190297[_0x5ccb('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x5ccb('0x71')](_0xab3c01,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3024=['variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','destcalleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','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','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','toString','idField'];(function(_0x5104ec,_0x11722d){var _0x22b805=function(_0x51bf40){while(--_0x51bf40){_0x5104ec['push'](_0x5104ec['shift']());}};_0x22b805(++_0x11722d);}(_0x3024,0x17b));var _0x4302=function(_0x13c802,_0x3f2590){_0x13c802=_0x13c802-0x0;var _0x253700=_0x3024[_0x13c802];return _0x253700;};'use strict';var _=require('lodash');var Promise=require(_0x4302('0x0'));var rp=require(_0x4302('0x1'));var util=require('util');var md5=require('md5');var Redis=require(_0x4302('0x2'));var intUtil=require(_0x4302('0x3'));var config=require('../../../../config/environment');var logger=require(_0x4302('0x4'))('servicenow');config[_0x4302('0x5')]=_['defaults'](config['redis'],{'host':_0x4302('0x6'),'port':0x18eb});var io=require(_0x4302('0x7'))(new Redis(config[_0x4302('0x5')]));function getAdminUser(_0x243932,_0x3f9736,_0x278ce0,_0xc38f08,_0x2532ff,_0x305c59){return new Promise(function(_0x4abf0e,_0x1c48a9){var _0x37e8e6={'method':_0x4302('0x8'),'uri':_0xc38f08+_0x4302('0x9')+'&'+_0x2532ff+'&'+_0x305c59,'auth':_0x3f9736,'json':!![]};return rp(_0x37e8e6)[_0x4302('0xa')](function(_0x40135a){if(_0x40135a[_0x4302('0xb')][_0x4302('0xc')]>0x0){_0x278ce0[_0x4302('0xd')]=_0x40135a[_0x4302('0xb')][0x0][_0x4302('0xe')];}logger[_0x4302('0xf')]('['+[_0x243932['toUpperCase']()]+_0x4302('0x10'),_0x278ce0);_0x4abf0e(_0x278ce0);})[_0x4302('0x11')](function(_0x5f080d){logger[_0x4302('0x12')]('['+[_0x243932[_0x4302('0x13')]()]+']',_0x5f080d[_0x4302('0x14')]);_0x1c48a9(_0x5f080d[_0x4302('0x14')]);});});}function getUser(_0x31dfe9,_0xbe2995,_0x2d9967,_0x558537,_0x1c7ed3){return function(_0x360fc5){logger[_0x4302('0xf')]('['+[_0x31dfe9[_0x4302('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x360fc5);return new Promise(function(_0x5b37c9,_0x24c42f){if(intUtil[_0x4302('0x15')](_0x360fc5[_0x4302('0x16')])){var _0x44cd76={'method':'GET','uri':_0x2d9967+'sys_user?sysparm_query=email%3D'+_0x360fc5[_0x4302('0x16')]+'&'+_0x558537+'&'+_0x1c7ed3,'auth':_0xbe2995,'json':!![]};logger['info']('['+[_0x31dfe9[_0x4302('0x13')]()]+_0x4302('0x17'),_0x44cd76);return rp(_0x44cd76)['then'](function(_0x286915){logger[_0x4302('0xf')]('['+[_0x31dfe9[_0x4302('0x13')]()]+_0x4302('0x18'),_0x286915);if(_0x286915[_0x4302('0xb')][_0x4302('0xc')]>0x0&&String(_0x286915['result'][0x0][_0x4302('0x19')])===_0x4302('0x1a')){_0x360fc5['userId']=_0x286915['result'][0x0][_0x4302('0xe')];}else{_0x360fc5[_0x4302('0x1b')]=_0x360fc5['adminId'];_0x360fc5['userEmail']=_0x360fc5[_0x4302('0x1c')];}logger[_0x4302('0xf')]('['+[_0x31dfe9[_0x4302('0x13')]()]+_0x4302('0x1d'),_0x360fc5);_0x5b37c9(_0x360fc5);})[_0x4302('0x11')](function(_0x3c2edb){logger['error']('['+[_0x31dfe9[_0x4302('0x13')]()]+']',_0x3c2edb[_0x4302('0x14')]);_0x24c42f(_0x3c2edb[_0x4302('0x14')]);});}else{logger['info']('['+[_0x31dfe9['toUpperCase']()]+_0x4302('0x1e'));_0x360fc5[_0x4302('0x1b')]=_0x360fc5[_0x4302('0xd')];_0x360fc5[_0x4302('0x16')]=_0x360fc5[_0x4302('0x1c')];_0x5b37c9(_0x360fc5);}});};}function createEndUser(_0x3741c7,_0x2193cf,_0x47681a,_0x47556d,_0x612673){logger['info']('['+[_0x3741c7[_0x4302('0x13')]()]+_0x4302('0x1f'),_0x47681a);return new Promise(function(_0x335103,_0x4b426e){var _0x1afe14={'method':_0x4302('0x20'),'uri':_0x47556d+_0x4302('0x21')+_0x612673,'body':{'user_name':_0x47681a[_0x4302('0x22')],'roles':_0x4302('0x23'),'first_name':_0x47681a[_0x4302('0x22')],'active':'true','date_format':_0x4302('0x24'),'phone':_0x47681a['endUserNumber']},'auth':_0x2193cf,'json':!![]};return rp(_0x1afe14)[_0x4302('0xa')](function(_0x2ed19f){logger['info']('['+[_0x3741c7[_0x4302('0x13')]()]+_0x4302('0x25'),_0x2ed19f[_0x4302('0xb')]);_0x47681a[_0x4302('0x26')]=_0x2ed19f[_0x4302('0xb')][_0x4302('0xe')];_0x335103(_0x47681a);})[_0x4302('0x11')](function(_0x515956){logger[_0x4302('0x12')]('['+[_0x3741c7[_0x4302('0x13')]()]+']',_0x515956[_0x4302('0x14')]);_0x4b426e(_0x515956[_0x4302('0x14')]);});});}function getEndUser(_0x390685,_0x197b46,_0x3a5300,_0x26ddf0,_0x46bc40){return function(_0x47ebd9){logger[_0x4302('0xf')]('['+[_0x390685[_0x4302('0x13')]()]+_0x4302('0x27'),_0x47ebd9);return new Promise(function(_0xdb9b6e,_0x3479f4){var _0x5becb5={'method':'GET','uri':_0x3a5300+_0x4302('0x28')+_0x47ebd9[_0x4302('0x22')]+'&'+_0x26ddf0+'&'+_0x46bc40,'auth':_0x197b46,'json':!![]};return rp(_0x5becb5)[_0x4302('0xa')](function(_0x1900e5){if(_0x1900e5[_0x4302('0xb')][_0x4302('0xc')]>0x0){_0x47ebd9['endUserId']=_0x1900e5[_0x4302('0xb')][0x0]['sys_id'];logger[_0x4302('0xf')]('['+[_0x390685[_0x4302('0x13')]()]+'],\x20getEndUser\x20crm',_0x47ebd9);_0xdb9b6e(_0x47ebd9);}else{return createEndUser(_0x390685,_0x197b46,_0x47ebd9,_0x3a5300,_0x26ddf0)[_0x4302('0xa')](function(_0x243f87){logger[_0x4302('0xf')]('['+[_0x390685[_0x4302('0x13')]()]+_0x4302('0x29'),_0x243f87);_0xdb9b6e(_0x243f87);});}})['catch'](function(_0x53e98f){logger['error']('['+[_0x390685['toUpperCase']()]+']',_0x53e98f[_0x4302('0x14')]);_0x3479f4(_0x53e98f['message']);});});};}function getCustomFields(_0x33e670,_0x27e116){var _0x4d84cd={};if(_0x33e670['length']>0x0){_[_0x4302('0x2a')](_0x33e670,function(_0x4dc34a){if(_[_0x4302('0x2b')]([_0x4302('0x2c'),_0x4302('0x2d')],_0x4dc34a['type'])&&_0x4dc34a[_0x4302('0x2e')]&&!_0x4dc34a[_0x4302('0x2f')]){_0x4d84cd[_0x4dc34a[_0x4302('0x2e')][_0x4302('0x30')]()]=_0x4dc34a[_0x4302('0x31')]['toString']();}else if(_[_0x4302('0x2b')]([_0x4302('0x2c'),_0x4302('0x2d')],_0x4dc34a[_0x4302('0x32')])&&_0x4dc34a['idField']&&_0x4dc34a[_0x4302('0x2f')]){_0x4d84cd[_0x4dc34a['idField'][_0x4302('0x30')]()]=_0x4dc34a[_0x4302('0x31')][_0x4302('0x33')]();}else if(_0x4dc34a[_0x4302('0x32')]==='variable'&&_0x4dc34a['variableName']&&_0x4dc34a[_0x4302('0x34')]&&_0x4dc34a[_0x4302('0x2f')]){_0x4d84cd[_0x4dc34a[_0x4302('0x34')]['toLowerCase']()]=_0x27e116[_0x4dc34a[_0x4302('0x35')]][_0x4302('0x33')]();}else if(_0x4dc34a[_0x4302('0x32')]===_0x4302('0x36')&&_0x4dc34a['Variable']&&_0x4dc34a[_0x4302('0x37')][_0x4302('0x38')]&&_0x4dc34a[_0x4302('0x34')]&&_0x4dc34a[_0x4302('0x2f')]){_0x4d84cd[_0x4dc34a[_0x4302('0x34')][_0x4302('0x30')]()]=_0x27e116[_0x4dc34a['Variable'][_0x4302('0x38')][_0x4302('0x30')]()][_0x4302('0x33')]();}});}return _0x4d84cd;}function getTicket(_0x4211a4,_0x4cb0cd,_0x5e978f,_0x374f4d,_0x49b17f,_0x33be46){return function(_0x2a0868){logger['info']('['+[_0x4211a4[_0x4302('0x13')]()]+_0x4302('0x39'),_0x2a0868);return new Promise(function(_0x3d0112,_0x5ace09){var _0x123522=_0x4211a4[_0x4302('0x30')]()===_0x4302('0x3a')?_0x2a0868[_0x4302('0x1b')]:_0x2a0868[_0x4302('0x26')];var _0xa96e4f={'method':_0x4302('0x20'),'uri':_0x5e978f+_0x4302('0x3b')+'?'+_0x33be46,'body':Object[_0x4302('0x3c')]({},{'active':'true','caller_id':_0x123522,'assigned_to':_0x2a0868[_0x4302('0x1b')],'short_description':intUtil[_0x4302('0x3d')](_0x374f4d[_0x4302('0x3e')],_0x49b17f,'\x20'),'description':intUtil[_0x4302('0x3d')](_0x374f4d['Descriptions'],_0x49b17f,'\x0a')},getCustomFields(_0x374f4d[_0x4302('0x3f')],_0x49b17f)),'auth':_0x4cb0cd,'json':!![]};return rp(_0xa96e4f)[_0x4302('0xa')](function(_0x2f8bd1){logger['info']('['+[_0x4211a4[_0x4302('0x13')]()]+_0x4302('0x40'),_0x2f8bd1[_0x4302('0xb')]);_0x2a0868[_0x4302('0x41')]=_0x2f8bd1[_0x4302('0xb')][_0x4302('0xe')];_0x2a0868['ticketNumber']=_0x2f8bd1[_0x4302('0xb')][_0x4302('0x42')];logger['info']('['+[_0x4211a4[_0x4302('0x13')]()]+']\x20getTicket\x20crm',_0x2a0868);_0x3d0112(_0x2a0868);})[_0x4302('0x11')](function(_0x22cade){logger[_0x4302('0x12')]('['+[_0x4211a4[_0x4302('0x13')]()]+']',_0x22cade[_0x4302('0x14')]);_0x5ace09(_0x22cade[_0x4302('0x14')]);});});};}function createRemoteTag(_0x35cbb2,_0x179514,_0x1d7a4b,_0x5eabc2){return new Promise(function(_0x4df087,_0x45c61a){var _0x2a0234={'method':_0x4302('0x20'),'uri':_0x1d7a4b+_0x4302('0x43')+'?'+_0x5eabc2,'body':{'short_description':_0x35cbb2,'global':!![],'active':!![],'name':_0x35cbb2},'auth':_0x179514,'json':!![]};return rp(_0x2a0234)[_0x4302('0xa')](function(_0x501646){var _0x39cee7=_0x501646[_0x4302('0xb')][_0x4302('0xe')];_0x4df087(_0x39cee7);});});}function getRemoteTag(_0x9bfeaa,_0x1671f5,_0x3cf35c,_0x581a4b,_0x28675a){return new Promise(function(_0x395636,_0x4bbd35){var _0x1830a2={'method':_0x4302('0x8'),'uri':_0x3cf35c+_0x4302('0x43')+_0x4302('0x44')+_0x9bfeaa+'&'+_0x581a4b,'auth':_0x1671f5,'json':!![]};return rp(_0x1830a2)[_0x4302('0xa')](function(_0x38dc00){if(_0x38dc00['result']['length']>0x0){var _0x19e5ab=_0x38dc00['result'][0x0][_0x4302('0xe')];_0x395636(_0x19e5ab);}else{return createRemoteTag(_0x9bfeaa,_0x1671f5,_0x3cf35c,_0x581a4b)[_0x4302('0xa')](function(_0x2e36e3){_0x395636(_0x2e36e3);});}});});}function assignTagToIncident(_0x227d68,_0x4de1ae,_0x432191,_0x59028e,_0x5330fe){return new Promise(function(_0x643517,_0x1ef97a){var _0x1d64a5={'method':'POST','uri':_0x432191+_0x4302('0x45')+'?'+_0x5330fe,'body':{'label':_0x227d68,'table':_0x4302('0x3b'),'id_type':'Incident','table_key':_0x59028e[_0x4302('0x41')],'title':_0x4302('0x46')+_0x59028e[_0x4302('0x47')],'id_display':_0x59028e[_0x4302('0x47')]},'auth':_0x4de1ae,'json':!![]};return rp(_0x1d64a5)[_0x4302('0xa')](function(_0xd78b0f){_0x643517();})[_0x4302('0x11')](function(){_0x643517();});});}function manageTags(_0x5c8245,_0x4344de,_0x3fbabc,_0x34a94d,_0x225bc9,_0x403554,_0x3019bb){return new Promise(function(_0x5e2132,_0x165f24){var _0x3435e5=[];_0x4344de[_0x4302('0x2a')](function(_0x383fd0){_0x3435e5[_0x4302('0x48')](getRemoteTag(_0x383fd0,_0x3fbabc,_0x34a94d,_0x403554,_0x3019bb));});return Promise[_0x4302('0x49')](_0x3435e5)[_0x4302('0xa')](function(_0x3f8b56){if(_0x3f8b56[_0x4302('0xc')]){logger[_0x4302('0xf')]('['+[_0x5c8245[_0x4302('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x3f8b56);var _0xa39c0d=[];_0x3f8b56[_0x4302('0x2a')](function(_0x30b8a5){_0xa39c0d[_0x4302('0x48')](assignTagToIncident(_0x30b8a5,_0x3fbabc,_0x34a94d,_0x225bc9,_0x403554));});return Promise[_0x4302('0x49')](_0xa39c0d)[_0x4302('0xa')](function(){_0x5e2132();})['catch'](function(){_0x5e2132();});}else{_0x5e2132();}});});}function getTags(_0x5f1368,_0x385ce3,_0x47c802,_0x227dfb,_0x403044,_0x229d8f){return function(_0x4447b0){return new Promise(function(_0x3fff77,_0x4838fa){var _0x3d837e=[];var _0x1f978f=_0x227dfb[_0x4302('0x4a')];if(_0x1f978f&&_0x1f978f[_0x4302('0xc')]>0x0){_0x3d837e=_[_0x4302('0x4b')](_0x1f978f,_0x4302('0x38'));}if(_0x3d837e[_0x4302('0xc')]>0x0){return manageTags(_0x5f1368,_0x3d837e,_0x385ce3,_0x47c802,_0x4447b0,_0x403044,_0x229d8f)[_0x4302('0xa')](function(){_0x3fff77(_0x4447b0);});}else{_0x3fff77(_0x4447b0);}});};}function emit(_0x542acc,_0x5381d2,_0x476c9d){var _0x427b23=_0x4302('0x4c')+_0x4302('0x4d')+_0x4302('0x4e')+'%255EORDERBYDESCnumber';var _0x17a732={'uri':_0x542acc+_0x4302('0x4f')+_0x476c9d+_0x427b23};io['to'](util[_0x4302('0x50')](_0x4302('0x51'),_0x5381d2))[_0x4302('0x52')](_0x4302('0x53'),_0x17a732);}exports['cs']=function(_0x43a799,_0x592b6d,_0x2c3cda,_0x34552c,_0x4eb415,_0x1e7b77,_0x210cff,_0x3defa6){var _0x1758ee={};var _0x116067={'user':_0x1e7b77[_0x4302('0x54')],'pass':_0x1e7b77[_0x4302('0x55')]};var _0x43244c=_0x4302('0x56');var _0x1330d5=_0x4302('0x57');_0x1e7b77['remoteUri']=intUtil[_0x4302('0x58')](_0x1e7b77['remoteUri']);_0x1e7b77['serverUrl']=intUtil[_0x4302('0x58')](_0x1e7b77[_0x4302('0x59')]);var _0x422f07=util['format'](_0x4302('0x5a'),_0x1e7b77[_0x4302('0x5b')]);_0x1758ee[_0x4302('0x16')]=!_[_0x4302('0x5c')](_0x34552c)?_0x34552c['email']:null;_0x1758ee[_0x4302('0x1c')]=_0x1e7b77['email'];_0x1758ee[_0x4302('0x22')]=_0x3defa6[_0x4302('0x30')]()==='outbound'?_0x592b6d[_0x4302('0x5d')]:_0x592b6d['calleridnum'];_0x1758ee['callDirection']=_0x3defa6===_0x4302('0x5e')||_0x3defa6===_0x4302('0x5f')?'queue':_0x4302('0x3a');var _0x1188f8=util[_0x4302('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e7b77[_0x4302('0x59')],_0x592b6d[_0x4302('0x60')],md5(_0x592b6d[_0x4302('0x60')]));if(_0x4eb415&&_0x4eb415[_0x4302('0x61')]){logger[_0x4302('0xf')]('[QUEUE]',_0x4302('0x62'));_0x592b6d[_0x4302('0x63')]=_0x1188f8;}else if(_0x210cff&&_0x210cff[_0x4302('0x64')]&&_0x210cff[_0x4302('0x64')]!==_0x4302('0x65')){logger['info'](_0x4302('0x66'),_0x4302('0x62'));_0x592b6d[_0x4302('0x63')]=_0x1188f8;}else{_0x592b6d[_0x4302('0x63')]='';}return getAdminUser(_0x3defa6,_0x116067,_0x1758ee,_0x422f07,_0x1330d5,_0x43244c)[_0x4302('0xa')](getUser(_0x3defa6,_0x116067,_0x422f07,_0x1330d5,_0x43244c))['then'](getEndUser(_0x3defa6,_0x116067,_0x422f07,_0x1330d5,_0x43244c))['then'](getTicket(_0x3defa6,_0x116067,_0x422f07,_0x2c3cda,_0x592b6d,_0x1330d5))['then'](function(_0x4154c7){logger['info'](util[_0x4302('0x50')](_0x4302('0x67'),_0x4154c7[_0x4302('0x41')]));logger['info'](util[_0x4302('0x50')](_0x4302('0x68'),_0x3defa6));if(_0x3defa6!==_0x4302('0x5f')){logger[_0x4302('0xf')]('['+[_0x3defa6[_0x4302('0x13')]()]+']',_0x4302('0x69'));emit(_0x1e7b77[_0x4302('0x5b')],_0x34552c[_0x4302('0x38')],_0x4154c7[_0x4302('0x41')]);}})[_0x4302('0x11')](function(_0x348882){logger[_0x4302('0x12')]('['+[_0x3defa6[_0x4302('0x13')]()]+_0x4302('0x6a'),util[_0x4302('0x6b')](_0x348882,{'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 e135343..eb7b07b 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 _0x311c=['serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','calleridnum','lodash','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','name','getString','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','merge','map','type','string','nameField','content','customField','custom_fields','variable','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x311c,0x9a));var _0xc311=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x311c[_0x237546];return _0x233e29;};'use strict';var _=require(_0xc311('0x0'));var rp=require('request-promise');var BPromise=require(_0xc311('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xc311('0x2'));var intUtil=require(_0xc311('0x3'));var config=require(_0xc311('0x4'));var logger=require(_0xc311('0x5'))(_0xc311('0x6'));config['redis']=_['defaults'](config[_0xc311('0x7')],{'host':_0xc311('0x8'),'port':0x18eb});var io=require(_0xc311('0x9'))(new Redis(config[_0xc311('0x7')]));var def={'method':_0xc311('0xa'),'json':!![]};function emit(_0x371a0b,_0x23ae05,_0x444951){io['to'](_0x371a0b)[_0xc311('0xb')](_0x23ae05,_0x444951);}function getTicket(_0x45a808,_0x5e1c23,_0x1d365c,_0x45df49,_0x506744,_0x5b80c6,_0x14a901,_0x248fc2){logger[_0xc311('0xc')]('Creating\x20new\x20ticket...');var _0x1a03d9=new Date();var _0x65b841=[{'name':_0xc311('0xd'),'value':intUtil[_0xc311('0xe')](_0x45df49['Subjects'],_0x506744,'\x20')},{'name':_0xc311('0xf'),'value':_0x5e1c23['id']},{'name':_0xc311('0x10'),'value':_0x5e1c23['id']},{'name':_0xc311('0x11'),'value':intUtil[_0xc311('0xe')](_0x45df49['Descriptions'],_0x506744,'\x0a')},{'name':_0xc311('0x12'),'value':_0x1a03d9[_0xc311('0x13')]()[_0xc311('0x14')](0x0,0x13)[_0xc311('0x15')]('T','\x20')},{'name':_0xc311('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xc311('0x17'),'value':_0x1d365c['id']},{'name':_0xc311('0x18'),'value':'Contacts'},{'name':'parent_name','value':_0x1d365c[_0xc311('0xd')]},{'name':'direction','value':_0x248fc2}];if(_0x5b80c6[_0xc311('0x19')]){_[_0xc311('0x1a')](_0x5b80c6,function(_0x542783){if(_0x506744[_0x542783[_0xc311('0x1b')]]){_0x65b841[_0xc311('0x1c')]({'name':_0x542783[_0xc311('0x1d')],'value':_0x506744[_0x542783[_0xc311('0x1b')]]});}});}return request({'form':{'method':_0xc311('0x1e'),'input_type':_0xc311('0x1f'),'response_type':_0xc311('0x1f'),'rest_data':JSON[_0xc311('0x20')]({'session':_0x14a901['id'],'module_name':_0xc311('0x21'),'name_value_list':_0x65b841})}});}function getAuth(_0x3e42df){return util[_0xc311('0x22')](_0xc311('0x23'),new Buffer(_0x3e42df[_0xc311('0x24')]+':X')[_0xc311('0x25')](_0xc311('0x26')));}function getServerInfo(_0x305f54){return request({'form':{'method':'get_server_info','input_type':_0xc311('0x1f'),'response_type':_0xc311('0x1f'),'rest_data':JSON[_0xc311('0x20')]({'session':_0x305f54['id']})}});}function getUser(_0x519458,_0x116e7a,_0x432481){if(!_[_0xc311('0x27')](_0x116e7a)){logger['info'](_0xc311('0x28'),_0x116e7a);return request({'form':{'method':_0xc311('0x29'),'input_type':_0xc311('0x1f'),'response_type':_0xc311('0x1f'),'rest_data':JSON['stringify']({'session':_0x432481['id'],'module_name':'Employees','query':util[_0xc311('0x22')](_0xc311('0x2a'),_0x116e7a),'order_by':'','offset':'0','select_fields':['id','name',_0xc311('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc311('0x2c')](function(_0x2d2c8d){if(_0x2d2c8d['entry_list'][_0xc311('0x19')]){var _0x3e5167=_[_0xc311('0x2d')](_0x2d2c8d[_0xc311('0x2e')],function(_0x475a49){return _0x475a49[_0xc311('0x2f')][_0xc311('0x2b')]['value']===_0x116e7a;});if(_0x3e5167){logger[_0xc311('0xc')](_0xc311('0x30'));return BPromise[_0xc311('0x31')]({'id':_0x3e5167['name_value_list']['id'][_0xc311('0x32')],'name':_0x3e5167[_0xc311('0x2f')][_0xc311('0xd')][_0xc311('0x32')]});}}logger[_0xc311('0xc')](_0xc311('0x33'));return BPromise[_0xc311('0x31')]({'id':_0x432481[_0xc311('0x2f')][_0xc311('0x34')]['value'],'name':_0x432481[_0xc311('0x2f')][_0xc311('0x2b')][_0xc311('0x32')]});});}else{logger['info'](_0xc311('0x35'));return BPromise['resolve']({'id':_0x432481[_0xc311('0x2f')][_0xc311('0x34')][_0xc311('0x32')],'name':_0x432481[_0xc311('0x2f')][_0xc311('0x2b')][_0xc311('0x32')]});}}function getEndUser(_0x1472fc,_0x50f380,_0xe71570,_0x1b7df6){logger['info']('Searching\x20enduser\x20with\x20phone',_0xe71570);return request({'form':{'method':_0xc311('0x29'),'input_type':'JSON','response_type':_0xc311('0x1f'),'rest_data':JSON['stringify']({'session':_0x1b7df6['id'],'module_name':_0xc311('0x36'),'query':util['format'](_0xc311('0x37'),_0xe71570),'order_by':'','offset':'0','select_fields':['id',_0xc311('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc311('0x2c')](function(_0x26b334){if(_0x26b334[_0xc311('0x2e')][_0xc311('0x19')]){var _0x41cd3a=_['find'](_0x26b334[_0xc311('0x2e')],function(_0x4f0d7b){return _0x4f0d7b[_0xc311('0x2f')][_0xc311('0x38')][_0xc311('0x32')]===_0xe71570;});if(_0x41cd3a){logger['info']('Enduser\x20found!');return BPromise[_0xc311('0x31')]({'id':_0x41cd3a[_0xc311('0x2f')]['id'][_0xc311('0x32')],'name':_0x41cd3a[_0xc311('0x2f')][_0xc311('0xd')][_0xc311('0x32')],'phone':_0x41cd3a[_0xc311('0x2f')][_0xc311('0x38')][_0xc311('0x32')]});}}else{logger['info'](_0xc311('0x39'));return request({'form':{'method':_0xc311('0x1e'),'input_type':'JSON','response_type':_0xc311('0x1f'),'rest_data':JSON[_0xc311('0x20')]({'session':_0x1b7df6['id'],'module_name':_0xc311('0x36'),'name_value_list':[{'name':_0xc311('0x3a'),'value':_0x50f380!==''?_0x50f380:util[_0xc311('0x22')]('Caller\x20-\x20%s',_0xe71570)},{'name':_0xc311('0x38'),'value':_0xe71570}]})}})[_0xc311('0x2c')](function(_0x58ba24){logger[_0xc311('0xc')](_0xc311('0x3b'));return BPromise[_0xc311('0x31')]({'id':_0x58ba24['id'],'name':_0x58ba24[_0xc311('0x2e')][_0xc311('0x3a')]['value'],'phone':_0x58ba24[_0xc311('0x2e')][_0xc311('0x38')][_0xc311('0x32')]});});}});}function request(_0x79e498){logger[_0xc311('0x3c')]('[HTTP]',JSON['stringify'](_0x79e498));return rp(_[_0xc311('0x3d')](def,_0x79e498));}function getTags(_0x121282,_0x457503){var _0x128f27=[];if(_0x121282&&_0x121282[_0xc311('0x19')]>0x0){_0x128f27=_[_0xc311('0x3e')](_0x121282,_0x457503);}return _0x128f27;}function getCustomFields(_0x29a485,_0x2f54c0){var _0x29c0d4=[];var _0x488288={'custom_fields':[]};if(_0x29a485['length']>0x0){_[_0xc311('0x1a')](_0x29a485,function(_0x1f774c){if(_0x1f774c[_0xc311('0x3f')]===_0xc311('0x40')&&_0x1f774c['nameField']&&!_0x1f774c['customField']){_0x488288[_0x1f774c[_0xc311('0x41')]['toLowerCase']()]=_0x1f774c[_0xc311('0x42')][_0xc311('0x25')]();}else if(_0x1f774c[_0xc311('0x3f')]==='string'&&_0x1f774c[_0xc311('0x1d')]&&_0x1f774c[_0xc311('0x43')]){_0x488288[_0xc311('0x44')]['push']({'id':_0x1f774c[_0xc311('0x1d')],'value':_0x1f774c[_0xc311('0x42')][_0xc311('0x25')]()});}else if(_0x1f774c['type']===_0xc311('0x45')&&_0x1f774c['variableName']&&_0x1f774c[_0xc311('0x1d')]&&_0x1f774c[_0xc311('0x43')]){_0x2f54c0[_0x1f774c[_0xc311('0x1b')]]&&_0x488288[_0xc311('0x44')][_0xc311('0x1c')]({'id':_0x1f774c[_0xc311('0x1d')],'value':_0x2f54c0[_0x1f774c[_0xc311('0x1b')]][_0xc311('0x25')]()});}else if(_0x1f774c[_0xc311('0x3f')]===_0xc311('0x46')&&_0x1f774c[_0xc311('0x47')]&&_0x1f774c[_0xc311('0x47')][_0xc311('0xd')]&&_0x1f774c['idField']&&_0x1f774c['customField']){_0x2f54c0[_0x1f774c['Variable'][_0xc311('0xd')][_0xc311('0x48')]()]&&_0x488288['custom_fields'][_0xc311('0x1c')]({'id':_0x1f774c[_0xc311('0x1d')],'value':_0x2f54c0[_0x1f774c[_0xc311('0x47')][_0xc311('0xd')][_0xc311('0x48')]()][_0xc311('0x25')]()});}});}return _0x488288;}function getConnection(_0x35806a){return request({'method':_0xc311('0xa'),'form':{'method':_0xc311('0x49'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc311('0x20')]({'user_auth':{'user_name':_0x35806a['username'],'password':_0x35806a[_0xc311('0x4a')],'encryption':_0xc311('0x4b')},'application':_0xc311('0x4c')})}})[_0xc311('0x2c')](function(_0x1a5edf){var _0x26baaa=_0x1a5edf;if(_0x26baaa['id']){def['sessionID']=_0x26baaa['id'];return BPromise['resolve'](_0x26baaa);}else{throw new Error(util['format'](_0xc311('0x4d'),_0x35806a['id']));}});}function setRelationship(_0x234956,_0x5a5cb5,_0x24f717,_0x2cb8a5){return request({'form':{'method':_0xc311('0x4e'),'input_type':_0xc311('0x1f'),'response_type':_0xc311('0x1f'),'rest_data':JSON['stringify']({'session':_0x234956['id'],'module_name':_0xc311('0x21'),'module_id':_0x24f717['id'],'link_field_name':_0x2cb8a5,'related_ids':[_0x5a5cb5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc311('0x4f')]=function(_0x3ebd52,_0x3c6a0c,_0x58e70c,_0x5408c4,_0x5779e6,_0x3099d2){var _0x3ddc0f,_0x4eb6d1,_0x3f5db2,_0x1200ff;_0x3099d2[_0xc311('0x50')]=intUtil[_0xc311('0x51')](_0x3099d2[_0xc311('0x50')]);_0x3099d2[_0xc311('0x52')]=intUtil[_0xc311('0x51')](_0x3099d2[_0xc311('0x52')]);def[_0xc311('0x53')]=util['format'](_0xc311('0x54'),_0x3099d2[_0xc311('0x50')]);if(_0x5779e6&&_0x5779e6[_0xc311('0x55')]){logger['info'](_0xc311('0x56'),'Recording\x20is\x20enabled!');_0x3c6a0c[_0xc311('0x57')]=util[_0xc311('0x22')](_0xc311('0x58'),_0x3099d2[_0xc311('0x52')],_0x3c6a0c[_0xc311('0x59')],md5(_0x3c6a0c[_0xc311('0x59')]));}else{_0x3c6a0c[_0xc311('0x57')]='';}return getConnection(_0x3099d2)['then'](function(_0xe27189){_0x1200ff=_0xe27189;return getUser(_0x3099d2,_0x5408c4[_0xc311('0xd')],_0x1200ff);})['then'](function(_0x75738b){_0x3ddc0f=_0x75738b;logger[_0xc311('0xc')](_0xc311('0x5a'),_0x3ddc0f['id']);return getEndUser(_0x3099d2,_0x3c6a0c[_0xc311('0x5b')],_0x3c6a0c['calleridnum'],_0x1200ff);})[_0xc311('0x2c')](function(_0x5220c8){_0x4eb6d1=_0x5220c8;logger[_0xc311('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4eb6d1['id']);return getTicket(_0x3099d2,_0x3ddc0f,_0x4eb6d1,_0x58e70c,_0x3c6a0c,_0x58e70c[_0xc311('0x5c')],_0x1200ff,_0xc311('0x5d'));})['then'](function(_0x44cbf1){_0x3f5db2=_0x44cbf1;logger[_0xc311('0xc')]('Ticket\x20created!');logger[_0xc311('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3f5db2['id']);return setRelationship(_0x1200ff,_0x3ddc0f,_0x3f5db2,_0xc311('0x5e'));})[_0xc311('0x2c')](function(){return setRelationship(_0x1200ff,_0x4eb6d1,_0x3f5db2,_0xc311('0x5f'));})[_0xc311('0x2c')](function(){return getServerInfo(_0x1200ff);})[_0xc311('0x2c')](function(_0x3fd595){var _0x367016=parseInt(_0x3fd595[_0xc311('0x60')][_0xc311('0x61')](0x0));var _0x485c48=util[_0xc311('0x22')](_0xc311('0x62'),_0x3099d2[_0xc311('0x50')],_0x3f5db2['id']);if(_0x367016>0x6){_0x485c48=util['format'](_0xc311('0x63'),_0x3099d2[_0xc311('0x50')],_0x3f5db2['id']);}logger['info'](_0xc311('0x56'),_0xc311('0x64'));emit(util[_0xc311('0x22')](_0xc311('0x65'),_0x5408c4[_0xc311('0xd')]),_0xc311('0x66'),{'uri':_0x485c48});})[_0xc311('0x67')](function(_0x3f30c8){logger[_0xc311('0x68')]('[QUEUE]',JSON[_0xc311('0x20')](_0x3f30c8));});};exports['outbound']=function(_0x6aed5b,_0x3a15a6,_0x494bd7,_0x2d3d05,_0xbdf821,_0x46b0f9,_0x335030){var _0x5c2c6e,_0x1e3573,_0x18e9a5,_0x1ab287;_0x46b0f9['remoteUri']=intUtil['stripTrailingSlash'](_0x46b0f9[_0xc311('0x50')]);_0x46b0f9[_0xc311('0x52')]=intUtil[_0xc311('0x51')](_0x46b0f9[_0xc311('0x52')]);def['uri']=util['format'](_0xc311('0x54'),_0x46b0f9[_0xc311('0x50')]);if(_0x335030&&_0x335030[_0xc311('0x69')]&&_0x335030['recordingFormat']!==_0xc311('0x6a')){logger[_0xc311('0xc')]('[OUTBOUND]',_0xc311('0x6b'));_0x3a15a6[_0xc311('0x57')]=util[_0xc311('0x22')](_0xc311('0x58'),_0x46b0f9[_0xc311('0x52')],_0x3a15a6[_0xc311('0x59')],md5(_0x3a15a6[_0xc311('0x59')]));}return getConnection(_0x46b0f9)[_0xc311('0x2c')](function(_0x3b2afe){_0x1ab287=_0x3b2afe;return getUser(_0x46b0f9,_0x2d3d05[_0xc311('0xd')],_0x1ab287);})[_0xc311('0x2c')](function(_0x2cda83){_0x5c2c6e=_0x2cda83;logger[_0xc311('0xc')]('The\x20User\x20ID\x20is:',_0x5c2c6e['id']);return getEndUser(_0x46b0f9,_0x3a15a6[_0xc311('0x6c')],_0x3a15a6[_0xc311('0x6d')],_0x1ab287);})[_0xc311('0x2c')](function(_0x3d1c80){_0x1e3573=_0x3d1c80;logger[_0xc311('0xc')](_0xc311('0x6e'),_0x1e3573['id']);return getTicket(_0x46b0f9,_0x5c2c6e,_0x1e3573,_0x494bd7,_0x3a15a6,_0x494bd7['Fields'],_0x1ab287,_0xc311('0x6f'));})[_0xc311('0x2c')](function(_0x34708c){_0x18e9a5=_0x34708c;logger[_0xc311('0xc')](_0xc311('0x70'));logger[_0xc311('0xc')](_0xc311('0x71'),_0x18e9a5['id']);return setRelationship(_0x1ab287,_0x5c2c6e,_0x18e9a5,_0xc311('0x5e'));})['then'](function(){return setRelationship(_0x1ab287,_0x1e3573,_0x18e9a5,_0xc311('0x5f'));})[_0xc311('0x2c')](function(){return getServerInfo(_0x1ab287);})['then'](function(_0x3c758b){var _0xbe55a=parseInt(_0x3c758b[_0xc311('0x60')][_0xc311('0x61')](0x0));var _0xdcfc=util[_0xc311('0x22')](_0xc311('0x62'),_0x46b0f9[_0xc311('0x50')],_0x18e9a5['id']);if(_0xbe55a>0x6){_0xdcfc=util[_0xc311('0x22')](_0xc311('0x63'),_0x46b0f9[_0xc311('0x50')],_0x18e9a5['id']);}logger[_0xc311('0xc')]('[OUTBOUND]',_0xc311('0x64'));emit(util['format'](_0xc311('0x65'),_0x2d3d05[_0xc311('0xd')]),'trigger:browser:url',{'uri':_0xdcfc});})['catch'](function(_0x2e629b){logger[_0xc311('0x68')]('[OUTBOUND]',JSON[_0xc311('0x20')](_0x2e629b));});};exports[_0xc311('0x72')]=function(_0x29ae1c,_0x2f2d75,_0x72623f,_0x5a5f27,_0x2958e5,_0x1bafa4){var _0x44fa76,_0x5458dc,_0x3e48fe,_0x500ce1;_0x1bafa4[_0xc311('0x50')]=intUtil[_0xc311('0x51')](_0x1bafa4[_0xc311('0x50')]);_0x1bafa4[_0xc311('0x52')]=intUtil['stripTrailingSlash'](_0x1bafa4[_0xc311('0x52')]);def[_0xc311('0x53')]=util[_0xc311('0x22')](_0xc311('0x54'),_0x1bafa4[_0xc311('0x50')]);if(_0x2958e5&&_0x2958e5[_0xc311('0x55')]){logger[_0xc311('0xc')]('['+_0x2f2d75[_0xc311('0x73')][_0xc311('0x74')]()+']','Recording\x20is\x20enabled!');_0x2f2d75['recordingURL']=util[_0xc311('0x22')](_0xc311('0x58'),_0x1bafa4[_0xc311('0x52')],_0x2f2d75['uniqueid'],md5(_0x2f2d75[_0xc311('0x59')]));}else{_0x2f2d75['recordingURL']='';}return getConnection(_0x1bafa4)['then'](function(_0x16ede6){_0x500ce1=_0x16ede6;if(!_['isNil'](_0x5a5f27)){return getUser(_0x1bafa4,_0x5a5f27['name'],_0x500ce1);}else{return getUser(_0x1bafa4,null,_0x500ce1);}})[_0xc311('0x2c')](function(_0x2ffd18){_0x44fa76=_0x2ffd18;logger[_0xc311('0xc')](_0xc311('0x5a'),_0x44fa76['id']);return getEndUser(_0x1bafa4,_0x2f2d75['calleridname'],_0x2f2d75[_0xc311('0x75')],_0x500ce1);})[_0xc311('0x2c')](function(_0x135d71){_0x5458dc=_0x135d71;logger[_0xc311('0xc')](_0xc311('0x6e'),_0x5458dc['id']);return getTicket(_0x1bafa4,_0x44fa76,_0x5458dc,_0x72623f,_0x2f2d75,_0x72623f[_0xc311('0x5c')],_0x500ce1,_0xc311('0x5d'));})[_0xc311('0x2c')](function(_0x4a5f8a){_0x3e48fe=_0x4a5f8a;logger[_0xc311('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3e48fe['id']);return setRelationship(_0x500ce1,_0x44fa76,_0x3e48fe,_0xc311('0x5e'));})[_0xc311('0x2c')](function(){return setRelationship(_0x500ce1,_0x5458dc,_0x3e48fe,_0xc311('0x5f'));})['then'](function(){return getServerInfo(_0x500ce1);})[_0xc311('0x67')](function(_0x15842b){logger[_0xc311('0x68')]('['+_0x2f2d75[_0xc311('0x73')][_0xc311('0x74')]()+']',JSON[_0xc311('0x20')](_0x15842b));});}; \ No newline at end of file +var _0x0465=['queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','[HTTP]','map','type','string','customField','nameField','toLowerCase','custom_fields','push','content','variable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID'];(function(_0x107b3e,_0x3ae8e5){var _0x321d93=function(_0x2e04ba){while(--_0x2e04ba){_0x107b3e['push'](_0x107b3e['shift']());}};_0x321d93(++_0x3ae8e5);}(_0x0465,0x9d));var _0x5046=function(_0x61c17d,_0x5467b6){_0x61c17d=_0x61c17d-0x0;var _0x10e0f4=_0x0465[_0x61c17d];return _0x10e0f4;};'use strict';var _=require(_0x5046('0x0'));var rp=require(_0x5046('0x1'));var BPromise=require(_0x5046('0x2'));var md5=require(_0x5046('0x3'));var util=require(_0x5046('0x4'));var Redis=require(_0x5046('0x5'));var intUtil=require(_0x5046('0x6'));var config=require(_0x5046('0x7'));var logger=require(_0x5046('0x8'))('sugarcrm');config[_0x5046('0x9')]=_['defaults'](config['redis'],{'host':_0x5046('0xa'),'port':0x18eb});var io=require(_0x5046('0xb'))(new Redis(config['redis']));var def={'method':_0x5046('0xc'),'json':!![]};function emit(_0x17149e,_0x2a01fd,_0x29aaa5){io['to'](_0x17149e)['emit'](_0x2a01fd,_0x29aaa5);}function getTicket(_0x440b24,_0x8cfc48,_0x5ac1da,_0xfbec25,_0x2a6dfc,_0x191b18,_0x296719,_0x30c9c1){logger[_0x5046('0xd')](_0x5046('0xe'));var _0x2d3685=new Date();var _0x37bf14=[{'name':_0x5046('0xf'),'value':intUtil[_0x5046('0x10')](_0xfbec25[_0x5046('0x11')],_0x2a6dfc,'\x20')},{'name':_0x5046('0x12'),'value':_0x8cfc48['id']},{'name':_0x5046('0x13'),'value':_0x8cfc48['id']},{'name':'description','value':intUtil[_0x5046('0x10')](_0xfbec25['Descriptions'],_0x2a6dfc,'\x0a')},{'name':_0x5046('0x14'),'value':_0x2d3685[_0x5046('0x15')]()[_0x5046('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0x5046('0x17'),'value':'0'},{'name':_0x5046('0x18'),'value':'15'},{'name':_0x5046('0x19'),'value':_0x5ac1da['id']},{'name':_0x5046('0x1a'),'value':'Contacts'},{'name':_0x5046('0x1b'),'value':_0x5ac1da[_0x5046('0xf')]},{'name':_0x5046('0x1c'),'value':_0x30c9c1}];if(_0x191b18[_0x5046('0x1d')]){_[_0x5046('0x1e')](_0x191b18,function(_0x580d08){if(_0x2a6dfc[_0x580d08[_0x5046('0x1f')]]){_0x37bf14['push']({'name':_0x580d08[_0x5046('0x20')],'value':_0x2a6dfc[_0x580d08[_0x5046('0x1f')]]});}});}return request({'form':{'method':_0x5046('0x21'),'input_type':'JSON','response_type':_0x5046('0x22'),'rest_data':JSON[_0x5046('0x23')]({'session':_0x296719['id'],'module_name':'Calls','name_value_list':_0x37bf14})}});}function getAuth(_0x180cb4){return util[_0x5046('0x24')](_0x5046('0x25'),new Buffer(_0x180cb4[_0x5046('0x26')]+':X')[_0x5046('0x27')]('base64'));}function getServerInfo(_0x477c79){return request({'form':{'method':'get_server_info','input_type':_0x5046('0x22'),'response_type':'JSON','rest_data':JSON[_0x5046('0x23')]({'session':_0x477c79['id']})}});}function getUser(_0x508c76,_0x28a49e,_0x403857){if(!_[_0x5046('0x28')](_0x28a49e)){logger[_0x5046('0xd')](_0x5046('0x29'),_0x28a49e);return request({'form':{'method':_0x5046('0x2a'),'input_type':_0x5046('0x22'),'response_type':_0x5046('0x22'),'rest_data':JSON['stringify']({'session':_0x403857['id'],'module_name':_0x5046('0x2b'),'query':util[_0x5046('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x28a49e),'order_by':'','offset':'0','select_fields':['id',_0x5046('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5046('0x2c')](function(_0x253a22){if(_0x253a22[_0x5046('0x2d')][_0x5046('0x1d')]){var _0x56c420=_[_0x5046('0x2e')](_0x253a22[_0x5046('0x2d')],function(_0x2902f1){return _0x2902f1[_0x5046('0x2f')][_0x5046('0x30')][_0x5046('0x31')]===_0x28a49e;});if(_0x56c420){logger[_0x5046('0xd')](_0x5046('0x32'));return BPromise[_0x5046('0x33')]({'id':_0x56c420[_0x5046('0x2f')]['id'][_0x5046('0x31')],'name':_0x56c420[_0x5046('0x2f')][_0x5046('0xf')][_0x5046('0x31')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5046('0x33')]({'id':_0x403857[_0x5046('0x2f')][_0x5046('0x34')][_0x5046('0x31')],'name':_0x403857['name_value_list'][_0x5046('0x30')][_0x5046('0x31')]});});}else{logger[_0x5046('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x403857[_0x5046('0x2f')][_0x5046('0x34')][_0x5046('0x31')],'name':_0x403857[_0x5046('0x2f')]['user_name'][_0x5046('0x31')]});}}function getEndUser(_0x43fb88,_0x422b4c,_0x59c040,_0x4d2df5){logger['info']('Searching\x20enduser\x20with\x20phone',_0x59c040);return request({'form':{'method':_0x5046('0x2a'),'input_type':_0x5046('0x22'),'response_type':_0x5046('0x22'),'rest_data':JSON['stringify']({'session':_0x4d2df5['id'],'module_name':_0x5046('0x35'),'query':util[_0x5046('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x59c040),'order_by':'','offset':'0','select_fields':['id','name',_0x5046('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5046('0x2c')](function(_0x238049){if(_0x238049[_0x5046('0x2d')][_0x5046('0x1d')]){var _0x4a7b0f=_[_0x5046('0x2e')](_0x238049[_0x5046('0x2d')],function(_0x437620){return _0x437620[_0x5046('0x2f')][_0x5046('0x36')]['value']===_0x59c040;});if(_0x4a7b0f){logger[_0x5046('0xd')](_0x5046('0x37'));return BPromise['resolve']({'id':_0x4a7b0f[_0x5046('0x2f')]['id'][_0x5046('0x31')],'name':_0x4a7b0f[_0x5046('0x2f')]['name'][_0x5046('0x31')],'phone':_0x4a7b0f[_0x5046('0x2f')][_0x5046('0x36')][_0x5046('0x31')]});}}else{logger['info'](_0x5046('0x38'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x5046('0x22'),'rest_data':JSON[_0x5046('0x23')]({'session':_0x4d2df5['id'],'module_name':'Contacts','name_value_list':[{'name':_0x5046('0x39'),'value':_0x422b4c!==_0x5046('0x3a')?_0x422b4c:util[_0x5046('0x24')](_0x5046('0x3b'),_0x59c040)},{'name':_0x5046('0x36'),'value':_0x59c040}]})}})[_0x5046('0x2c')](function(_0x405145){logger[_0x5046('0xd')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x405145['id'],'name':_0x405145[_0x5046('0x2d')][_0x5046('0x39')]['value'],'phone':_0x405145[_0x5046('0x2d')][_0x5046('0x36')][_0x5046('0x31')]});});}});}function request(_0x2bff2f){logger['debug'](_0x5046('0x3c'),JSON[_0x5046('0x23')](_0x2bff2f));return rp(_['merge'](def,_0x2bff2f));}function getTags(_0x32c11a,_0x4629ff){var _0x2cd87f=[];if(_0x32c11a&&_0x32c11a[_0x5046('0x1d')]>0x0){_0x2cd87f=_[_0x5046('0x3d')](_0x32c11a,_0x4629ff);}return _0x2cd87f;}function getCustomFields(_0x32132c,_0x3f9049){var _0x31fbcd=[];var _0x39c747={'custom_fields':[]};if(_0x32132c[_0x5046('0x1d')]>0x0){_[_0x5046('0x1e')](_0x32132c,function(_0x4cf080){if(_0x4cf080[_0x5046('0x3e')]===_0x5046('0x3f')&&_0x4cf080['nameField']&&!_0x4cf080[_0x5046('0x40')]){_0x39c747[_0x4cf080[_0x5046('0x41')][_0x5046('0x42')]()]=_0x4cf080['content'][_0x5046('0x27')]();}else if(_0x4cf080[_0x5046('0x3e')]===_0x5046('0x3f')&&_0x4cf080[_0x5046('0x20')]&&_0x4cf080[_0x5046('0x40')]){_0x39c747[_0x5046('0x43')][_0x5046('0x44')]({'id':_0x4cf080['idField'],'value':_0x4cf080[_0x5046('0x45')][_0x5046('0x27')]()});}else if(_0x4cf080[_0x5046('0x3e')]===_0x5046('0x46')&&_0x4cf080[_0x5046('0x1f')]&&_0x4cf080[_0x5046('0x20')]&&_0x4cf080[_0x5046('0x40')]){_0x3f9049[_0x4cf080[_0x5046('0x1f')]]&&_0x39c747['custom_fields'][_0x5046('0x44')]({'id':_0x4cf080[_0x5046('0x20')],'value':_0x3f9049[_0x4cf080['variableName']]['toString']()});}else if(_0x4cf080[_0x5046('0x3e')]==='customVariable'&&_0x4cf080[_0x5046('0x47')]&&_0x4cf080['Variable'][_0x5046('0xf')]&&_0x4cf080[_0x5046('0x20')]&&_0x4cf080[_0x5046('0x40')]){_0x3f9049[_0x4cf080[_0x5046('0x47')][_0x5046('0xf')][_0x5046('0x42')]()]&&_0x39c747[_0x5046('0x43')]['push']({'id':_0x4cf080[_0x5046('0x20')],'value':_0x3f9049[_0x4cf080[_0x5046('0x47')][_0x5046('0xf')][_0x5046('0x42')]()][_0x5046('0x27')]()});}});}return _0x39c747;}function getConnection(_0x29163a){return request({'method':_0x5046('0xc'),'form':{'method':_0x5046('0x48'),'input_type':_0x5046('0x22'),'response_type':_0x5046('0x22'),'rest_data':JSON[_0x5046('0x23')]({'user_auth':{'user_name':_0x29163a[_0x5046('0x49')],'password':_0x29163a[_0x5046('0x4a')],'encryption':'PLAIN'},'application':_0x5046('0x4b')})}})[_0x5046('0x2c')](function(_0x12403d){var _0x399978=_0x12403d;if(_0x399978['id']){def[_0x5046('0x4c')]=_0x399978['id'];return BPromise['resolve'](_0x399978);}else{throw new Error(util[_0x5046('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x29163a['id']));}});}function setRelationship(_0x124d44,_0x180800,_0x58afa5,_0x5b6b56){return request({'form':{'method':'set_relationship','input_type':_0x5046('0x22'),'response_type':'JSON','rest_data':JSON[_0x5046('0x23')]({'session':_0x124d44['id'],'module_name':'Calls','module_id':_0x58afa5['id'],'link_field_name':_0x5b6b56,'related_ids':[_0x180800['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5046('0x4d')]=function(_0x59076c,_0x4b915a,_0xc727cc,_0x54f859,_0x4bdf04,_0x5ac4c0){var _0x5c91cc,_0x52a198,_0x478b33,_0x326bbf;_0x5ac4c0[_0x5046('0x4e')]=intUtil['stripTrailingSlash'](_0x5ac4c0[_0x5046('0x4e')]);_0x5ac4c0[_0x5046('0x4f')]=intUtil[_0x5046('0x50')](_0x5ac4c0[_0x5046('0x4f')]);def[_0x5046('0x51')]=util[_0x5046('0x24')](_0x5046('0x52'),_0x5ac4c0[_0x5046('0x4e')]);if(_0x4bdf04&&_0x4bdf04[_0x5046('0x53')]){logger['info']('[QUEUE]',_0x5046('0x54'));_0x4b915a[_0x5046('0x55')]=util[_0x5046('0x24')](_0x5046('0x56'),_0x5ac4c0[_0x5046('0x4f')],_0x4b915a[_0x5046('0x57')],md5(_0x4b915a[_0x5046('0x57')]));}else{_0x4b915a[_0x5046('0x55')]='';}return getConnection(_0x5ac4c0)[_0x5046('0x2c')](function(_0x4079f2){_0x326bbf=_0x4079f2;return getUser(_0x5ac4c0,_0x54f859[_0x5046('0xf')],_0x326bbf);})['then'](function(_0x1817ed){_0x5c91cc=_0x1817ed;logger[_0x5046('0xd')]('The\x20User\x20ID\x20is:',_0x5c91cc['id']);return getEndUser(_0x5ac4c0,_0x4b915a[_0x5046('0x58')],_0x4b915a[_0x5046('0x59')],_0x326bbf);})[_0x5046('0x2c')](function(_0x5df201){_0x52a198=_0x5df201;logger[_0x5046('0xd')](_0x5046('0x5a'),_0x52a198['id']);return getTicket(_0x5ac4c0,_0x5c91cc,_0x52a198,_0xc727cc,_0x4b915a,_0xc727cc[_0x5046('0x5b')],_0x326bbf,_0x5046('0x5c'));})[_0x5046('0x2c')](function(_0x1376cc){_0x478b33=_0x1376cc;logger[_0x5046('0xd')]('Ticket\x20created!');logger[_0x5046('0xd')](_0x5046('0x5d'),_0x478b33['id']);return setRelationship(_0x326bbf,_0x5c91cc,_0x478b33,_0x5046('0x5e'));})['then'](function(){return setRelationship(_0x326bbf,_0x52a198,_0x478b33,_0x5046('0x5f'));})['then'](function(){return getServerInfo(_0x326bbf);})[_0x5046('0x2c')](function(_0x338222){var _0x4d4ab4=parseInt(_0x338222[_0x5046('0x60')][_0x5046('0x61')](0x0));var _0xc800e6=util['format'](_0x5046('0x62'),_0x5ac4c0[_0x5046('0x4e')],_0x478b33['id']);if(_0x4d4ab4>0x6){_0xc800e6=util['format'](_0x5046('0x63'),_0x5ac4c0['remoteUri'],_0x478b33['id']);}logger['info'](_0x5046('0x64'),_0x5046('0x65'));emit(util[_0x5046('0x24')](_0x5046('0x66'),_0x54f859['name']),'trigger:browser:url',{'uri':_0xc800e6});})[_0x5046('0x67')](function(_0x5afd26){logger[_0x5046('0x68')](_0x5046('0x64'),JSON['stringify'](_0x5afd26));});};exports[_0x5046('0x69')]=function(_0xbf8172,_0x470a07,_0x5309f2,_0x1a748c,_0x5287f7,_0x73a914,_0x28a89f){var _0x53fd9e,_0x37a738,_0x108f7a,_0x3b1d25;_0x73a914['remoteUri']=intUtil[_0x5046('0x50')](_0x73a914['remoteUri']);_0x73a914[_0x5046('0x4f')]=intUtil[_0x5046('0x50')](_0x73a914[_0x5046('0x4f')]);def[_0x5046('0x51')]=util[_0x5046('0x24')](_0x5046('0x52'),_0x73a914[_0x5046('0x4e')]);if(_0x28a89f&&_0x28a89f[_0x5046('0x6a')]&&_0x28a89f[_0x5046('0x6a')]!=='none'){logger['info'](_0x5046('0x6b'),_0x5046('0x54'));_0x470a07[_0x5046('0x55')]=util[_0x5046('0x24')](_0x5046('0x56'),_0x73a914[_0x5046('0x4f')],_0x470a07[_0x5046('0x57')],md5(_0x470a07[_0x5046('0x57')]));}return getConnection(_0x73a914)[_0x5046('0x2c')](function(_0x169a11){_0x3b1d25=_0x169a11;return getUser(_0x73a914,_0x1a748c[_0x5046('0xf')],_0x3b1d25);})[_0x5046('0x2c')](function(_0x223a45){_0x53fd9e=_0x223a45;logger[_0x5046('0xd')](_0x5046('0x6c'),_0x53fd9e['id']);return getEndUser(_0x73a914,_0x470a07[_0x5046('0x6d')],_0x470a07[_0x5046('0x6e')],_0x3b1d25);})[_0x5046('0x2c')](function(_0x571d9d){_0x37a738=_0x571d9d;logger['info'](_0x5046('0x5a'),_0x37a738['id']);return getTicket(_0x73a914,_0x53fd9e,_0x37a738,_0x5309f2,_0x470a07,_0x5309f2['Fields'],_0x3b1d25,_0x5046('0x6f'));})[_0x5046('0x2c')](function(_0x2524c7){_0x108f7a=_0x2524c7;logger[_0x5046('0xd')](_0x5046('0x70'));logger[_0x5046('0xd')](_0x5046('0x5d'),_0x108f7a['id']);return setRelationship(_0x3b1d25,_0x53fd9e,_0x108f7a,_0x5046('0x5e'));})[_0x5046('0x2c')](function(){return setRelationship(_0x3b1d25,_0x37a738,_0x108f7a,_0x5046('0x5f'));})['then'](function(){return getServerInfo(_0x3b1d25);})[_0x5046('0x2c')](function(_0x389760){var _0x48350e=parseInt(_0x389760[_0x5046('0x60')][_0x5046('0x61')](0x0));var _0x11c415=util[_0x5046('0x24')](_0x5046('0x62'),_0x73a914[_0x5046('0x4e')],_0x108f7a['id']);if(_0x48350e>0x6){_0x11c415=util['format'](_0x5046('0x63'),_0x73a914[_0x5046('0x4e')],_0x108f7a['id']);}logger[_0x5046('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5046('0x24')](_0x5046('0x66'),_0x1a748c['name']),_0x5046('0x71'),{'uri':_0x11c415});})[_0x5046('0x67')](function(_0x364f72){logger[_0x5046('0x68')](_0x5046('0x6b'),JSON[_0x5046('0x23')](_0x364f72));});};exports[_0x5046('0x72')]=function(_0x2c35d9,_0x1ea825,_0x2665ef,_0x1043c8,_0x230614,_0xbfe8ba){var _0x3290f8,_0x1ed08a,_0x1dbc5a,_0x351c02;_0xbfe8ba[_0x5046('0x4e')]=intUtil[_0x5046('0x50')](_0xbfe8ba[_0x5046('0x4e')]);_0xbfe8ba[_0x5046('0x4f')]=intUtil['stripTrailingSlash'](_0xbfe8ba[_0x5046('0x4f')]);def['uri']=util['format'](_0x5046('0x52'),_0xbfe8ba[_0x5046('0x4e')]);if(_0x230614&&_0x230614[_0x5046('0x53')]){logger[_0x5046('0xd')]('['+_0x1ea825[_0x5046('0x73')][_0x5046('0x74')]()+']',_0x5046('0x54'));_0x1ea825[_0x5046('0x55')]=util[_0x5046('0x24')](_0x5046('0x56'),_0xbfe8ba[_0x5046('0x4f')],_0x1ea825['uniqueid'],md5(_0x1ea825[_0x5046('0x57')]));}else{_0x1ea825[_0x5046('0x55')]='';}return getConnection(_0xbfe8ba)['then'](function(_0x12d98c){_0x351c02=_0x12d98c;if(!_[_0x5046('0x28')](_0x1043c8)){return getUser(_0xbfe8ba,_0x1043c8[_0x5046('0xf')],_0x351c02);}else{return getUser(_0xbfe8ba,null,_0x351c02);}})['then'](function(_0x373216){_0x3290f8=_0x373216;logger[_0x5046('0xd')](_0x5046('0x6c'),_0x3290f8['id']);return getEndUser(_0xbfe8ba,_0x1ea825[_0x5046('0x58')],_0x1ea825['calleridnum'],_0x351c02);})[_0x5046('0x2c')](function(_0x381324){_0x1ed08a=_0x381324;logger[_0x5046('0xd')](_0x5046('0x5a'),_0x1ed08a['id']);return getTicket(_0xbfe8ba,_0x3290f8,_0x1ed08a,_0x2665ef,_0x1ea825,_0x2665ef[_0x5046('0x5b')],_0x351c02,'Inbound');})[_0x5046('0x2c')](function(_0x4ab715){_0x1dbc5a=_0x4ab715;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x1dbc5a['id']);return setRelationship(_0x351c02,_0x3290f8,_0x1dbc5a,'users');})[_0x5046('0x2c')](function(){return setRelationship(_0x351c02,_0x1ed08a,_0x1dbc5a,_0x5046('0x5f'));})[_0x5046('0x2c')](function(){return getServerInfo(_0x351c02);})[_0x5046('0x67')](function(_0x2b1d12){logger[_0x5046('0x68')]('['+_0x1ea825[_0x5046('0x73')]['toUpperCase']()+']',JSON[_0x5046('0x23')](_0x2b1d12));});}; \ 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 05545ee..f9460e2 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 _0x9b89=['keyValue','keyType','key','format','%s:\x20%s','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','util','getString','length','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x266c68,_0x375611){var _0x9e2231=function(_0x2685bf){while(--_0x2685bf){_0x266c68['push'](_0x266c68['shift']());}};_0x9e2231(++_0x375611);}(_0x9b89,0x1eb));var _0x99b8=function(_0x5e227e,_0x547714){_0x5e227e=_0x5e227e-0x0;var _0x125963=_0x9b89[_0x5e227e];return _0x125963;};'use strict';var _=require('lodash');var util=require(_0x99b8('0x0'));exports[_0x99b8('0x1')]=function(_0x579361,_0x549e66,_0x23b04a){var _0x1bbdbf=[];if(_0x579361[_0x99b8('0x2')]>0x0){var _0x18f3bb=_['sortBy'](_0x579361,['id']);for(var _0x3520b8=0x0;_0x3520b8<_0x18f3bb[_0x99b8('0x2')];_0x3520b8++){var _0x21b0eb=_0x18f3bb[_0x3520b8];if(_0x21b0eb[_0x99b8('0x3')]===_0x99b8('0x4')){_0x1bbdbf[_0x99b8('0x5')](_0x21b0eb['content']);}else if(_0x21b0eb[_0x99b8('0x3')]===_0x99b8('0x6')&&_0x21b0eb[_0x99b8('0x7')]){_0x549e66[_0x21b0eb['variableName']]&&_0x1bbdbf[_0x99b8('0x5')](_0x549e66[_0x21b0eb['variableName']][_0x99b8('0x8')]());}else if(_0x21b0eb['type']===_0x99b8('0x9')&&_0x21b0eb[_0x99b8('0xa')]&&_0x21b0eb[_0x99b8('0xa')][_0x99b8('0xb')]){_0x549e66[_0x21b0eb[_0x99b8('0xa')][_0x99b8('0xb')][_0x99b8('0xc')]()]&&_0x1bbdbf[_0x99b8('0x5')](_0x549e66[_0x21b0eb[_0x99b8('0xa')][_0x99b8('0xb')]['toLowerCase']()][_0x99b8('0x8')]());}else if(_0x21b0eb['type']===_0x99b8('0xd')){if(_0x21b0eb[_0x99b8('0xe')]===_0x99b8('0x4')&&_0x21b0eb[_0x99b8('0xf')]){_0x1bbdbf[_0x99b8('0x5')](util[_0x99b8('0x10')]('%s:\x20%s',_0x21b0eb[_0x99b8('0xf')],_0x21b0eb['keyContent']));}else if(_0x21b0eb[_0x99b8('0xe')]===_0x99b8('0x6')&&_0x21b0eb[_0x99b8('0x7')]&&_0x21b0eb[_0x99b8('0xf')]){_0x549e66[_0x21b0eb[_0x99b8('0x7')]]&&_0x1bbdbf[_0x99b8('0x5')](util['format'](_0x99b8('0x11'),_0x21b0eb['key'],_0x549e66[_0x21b0eb[_0x99b8('0x7')]]));}else if(_0x21b0eb[_0x99b8('0xe')]===_0x99b8('0x9')&&_0x21b0eb[_0x99b8('0xa')]&&_0x21b0eb['Variable']['name']&&_0x21b0eb['key']){_0x549e66[_0x21b0eb[_0x99b8('0xa')][_0x99b8('0xb')]['toLowerCase']()]&&_0x1bbdbf[_0x99b8('0x5')](util[_0x99b8('0x10')](_0x99b8('0x11'),_0x21b0eb[_0x99b8('0xf')],_0x549e66[_0x21b0eb['Variable'][_0x99b8('0xb')][_0x99b8('0xc')]()]));}}}}return _0x1bbdbf['join'](_0x23b04a);};exports[_0x99b8('0x12')]=function(_0x11d5da){var _0x4503d5=_0x11d5da[_0x99b8('0x13')](-0x1);if(_0x4503d5==='/'){_0x11d5da=_0x11d5da['substring'](0x0,_0x11d5da[_0x99b8('0x14')](_0x4503d5));}return _0x11d5da;};exports[_0x99b8('0x15')]=function(_0x38f228){if(!_[_0x99b8('0x16')](_0x38f228)&&_0x38f228!==''){var _0x2e36cc=/^(([^<>()\[\]\\.,;:\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 _0x2e36cc[_0x99b8('0x17')](String(_0x38f228)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x1e38=['sortBy','type','content','variableName','customVariable','Variable','name','toLowerCase','push','toString','keyValue','keyType','string','key','format','keyContent','%s:\x20%s','stripTrailingSlash','substring','isNil','test','util','getString','length'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x1e38,0xa5));var _0x81e3=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x1e38[_0x3c81b5];return _0x5888c4;};'use strict';var _=require('lodash');var util=require(_0x81e3('0x0'));exports[_0x81e3('0x1')]=function(_0xad06fc,_0x5c2bc0,_0x13ca84){var _0xf2455f=[];if(_0xad06fc[_0x81e3('0x2')]>0x0){var _0x34507a=_[_0x81e3('0x3')](_0xad06fc,['id']);for(var _0x39dc93=0x0;_0x39dc93<_0x34507a[_0x81e3('0x2')];_0x39dc93++){var _0x37eb72=_0x34507a[_0x39dc93];if(_0x37eb72[_0x81e3('0x4')]==='string'){_0xf2455f['push'](_0x37eb72[_0x81e3('0x5')]);}else if(_0x37eb72[_0x81e3('0x4')]==='variable'&&_0x37eb72[_0x81e3('0x6')]){_0x5c2bc0[_0x37eb72[_0x81e3('0x6')]]&&_0xf2455f['push'](_0x5c2bc0[_0x37eb72[_0x81e3('0x6')]]['toString']());}else if(_0x37eb72[_0x81e3('0x4')]===_0x81e3('0x7')&&_0x37eb72[_0x81e3('0x8')]&&_0x37eb72['Variable'][_0x81e3('0x9')]){_0x5c2bc0[_0x37eb72['Variable'][_0x81e3('0x9')][_0x81e3('0xa')]()]&&_0xf2455f[_0x81e3('0xb')](_0x5c2bc0[_0x37eb72[_0x81e3('0x8')][_0x81e3('0x9')][_0x81e3('0xa')]()][_0x81e3('0xc')]());}else if(_0x37eb72[_0x81e3('0x4')]===_0x81e3('0xd')){if(_0x37eb72[_0x81e3('0xe')]===_0x81e3('0xf')&&_0x37eb72[_0x81e3('0x10')]){_0xf2455f['push'](util[_0x81e3('0x11')]('%s:\x20%s',_0x37eb72[_0x81e3('0x10')],_0x37eb72[_0x81e3('0x12')]));}else if(_0x37eb72['keyType']==='variable'&&_0x37eb72[_0x81e3('0x6')]&&_0x37eb72[_0x81e3('0x10')]){_0x5c2bc0[_0x37eb72['variableName']]&&_0xf2455f['push'](util[_0x81e3('0x11')](_0x81e3('0x13'),_0x37eb72[_0x81e3('0x10')],_0x5c2bc0[_0x37eb72['variableName']]));}else if(_0x37eb72['keyType']===_0x81e3('0x7')&&_0x37eb72['Variable']&&_0x37eb72[_0x81e3('0x8')][_0x81e3('0x9')]&&_0x37eb72[_0x81e3('0x10')]){_0x5c2bc0[_0x37eb72[_0x81e3('0x8')][_0x81e3('0x9')][_0x81e3('0xa')]()]&&_0xf2455f[_0x81e3('0xb')](util['format'](_0x81e3('0x13'),_0x37eb72[_0x81e3('0x10')],_0x5c2bc0[_0x37eb72['Variable'][_0x81e3('0x9')]['toLowerCase']()]));}}}}return _0xf2455f['join'](_0x13ca84);};exports[_0x81e3('0x14')]=function(_0x3efc07){var _0x2b4bc1=_0x3efc07['slice'](-0x1);if(_0x2b4bc1==='/'){_0x3efc07=_0x3efc07[_0x81e3('0x15')](0x0,_0x3efc07['lastIndexOf'](_0x2b4bc1));}return _0x3efc07;};exports['validateEmail']=function(_0x4c4085){if(!_[_0x81e3('0x16')](_0x4c4085)&&_0x4c4085!==''){var _0x4cf09f=/^(([^<>()\[\]\\.,;:\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 _0x4cf09f[_0x81e3('0x17')](String(_0x4c4085)[_0x81e3('0xa')]());}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 a2b40f8..a7ca614 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 6eaddd4..caaf1c7 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 _0x8cff=['error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','integrationTab','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','request-promise','md5','util','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','results','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2'];(function(_0x50e189,_0x68e527){var _0x4e6951=function(_0x1fdcef){while(--_0x1fdcef){_0x50e189['push'](_0x50e189['shift']());}};_0x4e6951(++_0x68e527);}(_0x8cff,0x173));var _0xf8cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf8cf('0x0'));var rp=require(_0xf8cf('0x1'));var md5=require(_0xf8cf('0x2'));var util=require(_0xf8cf('0x3'));var Redis=require('ioredis');var intUtil=require(_0xf8cf('0x4'));var config=require('../../../../config/environment');var logger=require(_0xf8cf('0x5'))('zendesk');config['redis']=_[_0xf8cf('0x6')](config[_0xf8cf('0x7')],{'host':_0xf8cf('0x8'),'port':0x18eb});var io=require(_0xf8cf('0x9'))(new Redis(config[_0xf8cf('0x7')]));function emit(_0xd02a3a,_0x3c042a,_0x11972a){io['to'](_0xd02a3a)[_0xf8cf('0xa')](_0x3c042a,_0x11972a);}var headers={'Content-Type':_0xf8cf('0xb'),'Accept':_0xf8cf('0xb')};function getTicket(_0x55e2d0,_0x269b8b,_0x24bb50,_0x580161,_0x5082d7){logger[_0xf8cf('0xc')](_0xf8cf('0xd'));return request({'uri':util[_0xf8cf('0xe')](_0xf8cf('0xf'),_0x55e2d0[_0xf8cf('0x10')]),'method':_0xf8cf('0x11'),'body':{'ticket':_[_0xf8cf('0x12')]({'requester_id':_0x24bb50['id'],'submitter_id':_0x269b8b?_0x269b8b['id']:undefined,'assignee_id':_0x269b8b?_0x269b8b['id']:undefined,'tags':getTags(_0x580161[_0xf8cf('0x13')],_0xf8cf('0x14')),'subject':intUtil[_0xf8cf('0x15')](_0x580161['Subjects'],_0x5082d7,'\x20'),'description':intUtil[_0xf8cf('0x15')](_0x580161[_0xf8cf('0x16')],_0x5082d7,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf8cf('0x15')](_0x580161[_0xf8cf('0x16')],_0x5082d7,'\x0a')}},getCustomFields(_0x580161[_0xf8cf('0x17')],_0x5082d7))}})[_0xf8cf('0x18')](function(_0x5b0918){logger[_0xf8cf('0xc')](_0xf8cf('0x19'));return _0x5b0918['ticket'];});}function getUser(_0x4db52f,_0x5bea44){if(intUtil['validateEmail'](_0x5bea44)){logger['info'](_0xf8cf('0x1a'),_0x5bea44);return request({'uri':util['format'](_0xf8cf('0x1b'),_0x4db52f['remoteUri']),'qs':{'query':util[_0xf8cf('0xe')](_0xf8cf('0x1c'),_0x5bea44)}})[_0xf8cf('0x18')](function(_0x4cd67a){if(_0x4cd67a[_0xf8cf('0x1d')]){logger[_0xf8cf('0xc')](_0xf8cf('0x1e'));return _[_0xf8cf('0x1f')](_0x4cd67a['results'],{'email':_0x5bea44,'role':_0xf8cf('0x20')});}else{logger['info'](_0xf8cf('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x4db52f['remoteUri'])})[_0xf8cf('0x18')](function(_0x3fc4c2){logger[_0xf8cf('0xc')](_0xf8cf('0x22'));return _0x3fc4c2[_0xf8cf('0x23')];});}});}else{logger['info'](_0xf8cf('0x21'));return request({'uri':util[_0xf8cf('0xe')](_0xf8cf('0x24'),_0x4db52f[_0xf8cf('0x10')])})['then'](function(_0x1f7a02){logger[_0xf8cf('0xc')](_0xf8cf('0x22'));return _0x1f7a02[_0xf8cf('0x23')];});}}function getEndUser(_0x27b1e6,_0x46b317,_0x1977f8){logger[_0xf8cf('0xc')](_0xf8cf('0x25'),_0x1977f8);return request({'uri':util[_0xf8cf('0xe')](_0xf8cf('0x1b'),_0x27b1e6[_0xf8cf('0x10')]),'qs':{'query':util[_0xf8cf('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x1977f8)}})[_0xf8cf('0x18')](function(_0x26433f){var _0x2510f1;if(_0x26433f[_0xf8cf('0x26')][_0xf8cf('0x27')]){_0x26433f[_0xf8cf('0x26')]=_[_0xf8cf('0x28')](_0x26433f[_0xf8cf('0x26')],{'suspended':![],'role':'end-user'});if(_0x26433f[_0xf8cf('0x26')][_0xf8cf('0x27')]){_0x2510f1=_[_0xf8cf('0x29')](_0x26433f[_0xf8cf('0x26')]);}}if(_0x2510f1){logger[_0xf8cf('0xc')](_0xf8cf('0x2a'));return _0x2510f1;}else{logger[_0xf8cf('0xc')](_0xf8cf('0x2b'));return request({'uri':util[_0xf8cf('0xe')](_0xf8cf('0x2c'),_0x27b1e6[_0xf8cf('0x10')]),'method':_0xf8cf('0x11'),'body':{'user':{'role':_0xf8cf('0x2d'),'name':util[_0xf8cf('0xe')](_0xf8cf('0x2e'),_0x46b317||_0x1977f8),'phone':_0x1977f8}}})[_0xf8cf('0x18')](function(_0x2239ee){logger['info'](_0xf8cf('0x2f'));return _0x2239ee[_0xf8cf('0x23')];});}});}function getAuth(_0x1ff9e7){var _0x1db66c;if(_0x1ff9e7['authType']===_0xf8cf('0x30')){_0x1db66c=util['format']('%s:%s',_0x1ff9e7[_0xf8cf('0x31')],_0x1ff9e7['password']);}else if(_0x1ff9e7[_0xf8cf('0x32')]===_0xf8cf('0x33')){_0x1db66c=util['format'](_0xf8cf('0x34'),_0x1ff9e7[_0xf8cf('0x31')],_0x1ff9e7[_0xf8cf('0x33')]);}return util[_0xf8cf('0xe')](_0xf8cf('0x35'),new Buffer(_0x1db66c)[_0xf8cf('0x36')](_0xf8cf('0x37')));}function request(_0x3ae5a1){logger[_0xf8cf('0x38')](_0xf8cf('0x39'),JSON['stringify'](_0x3ae5a1));return rp(_[_0xf8cf('0x6')](_0x3ae5a1,{'method':_0xf8cf('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x2dc1bd,_0x37ef48){var _0xb18d44=[];if(_0x2dc1bd&&_0x2dc1bd[_0xf8cf('0x27')]>0x0){_0xb18d44=_['map'](_0x2dc1bd,_0x37ef48);}return _0xb18d44;}function getCustomFields(_0x360283,_0x23b234){var _0x3edb6c=[];var _0x37ab48={'custom_fields':[]};if(_0x360283[_0xf8cf('0x27')]>0x0){_[_0xf8cf('0x3b')](_0x360283,function(_0x9e2d49){if(_[_0xf8cf('0x3c')]([_0xf8cf('0x3d'),_0xf8cf('0x3e')],_0x9e2d49[_0xf8cf('0x3f')])&&_0x9e2d49[_0xf8cf('0x40')]&&!_0x9e2d49[_0xf8cf('0x41')]){_0x37ab48[_0x9e2d49['nameField'][_0xf8cf('0x42')]()]=_0x9e2d49[_0xf8cf('0x43')]['toString']();}else if(_[_0xf8cf('0x3c')]([_0xf8cf('0x3d'),_0xf8cf('0x3e')],_0x9e2d49['type'])&&_0x9e2d49[_0xf8cf('0x44')]&&_0x9e2d49['customField']){_0x37ab48[_0xf8cf('0x45')][_0xf8cf('0x46')]({'id':_0x9e2d49[_0xf8cf('0x44')],'value':_0x9e2d49['content'][_0xf8cf('0x36')]()});}else if(_0x9e2d49[_0xf8cf('0x3f')]===_0xf8cf('0x47')&&_0x9e2d49[_0xf8cf('0x48')]&&_0x9e2d49[_0xf8cf('0x44')]&&_0x9e2d49[_0xf8cf('0x41')]){_0x23b234[_0x9e2d49[_0xf8cf('0x48')]]&&_0x37ab48[_0xf8cf('0x45')][_0xf8cf('0x46')]({'id':_0x9e2d49[_0xf8cf('0x44')],'value':_0x23b234[_0x9e2d49[_0xf8cf('0x48')]]['toString']()});}else if(_0x9e2d49['type']===_0xf8cf('0x49')&&_0x9e2d49[_0xf8cf('0x4a')]&&_0x9e2d49[_0xf8cf('0x4a')][_0xf8cf('0x14')]&&_0x9e2d49[_0xf8cf('0x44')]&&_0x9e2d49[_0xf8cf('0x41')]){_0x23b234[_0x9e2d49[_0xf8cf('0x4a')][_0xf8cf('0x14')]['toLowerCase']()]&&_0x37ab48[_0xf8cf('0x45')][_0xf8cf('0x46')]({'id':_0x9e2d49['idField'],'value':_0x23b234[_0x9e2d49[_0xf8cf('0x4a')][_0xf8cf('0x14')][_0xf8cf('0x42')]()][_0xf8cf('0x36')]()});}});}return _0x37ab48;}exports[_0xf8cf('0x4b')]=function(_0x404495,_0x3bbac7,_0x1ea6bf,_0x5c140a,_0x146adb,_0x475b2b){var _0xbd28a3,_0x2eb057;_0x475b2b['remoteUri']=intUtil[_0xf8cf('0x4c')](_0x475b2b['remoteUri']);_0x475b2b[_0xf8cf('0x4d')]=intUtil['stripTrailingSlash'](_0x475b2b[_0xf8cf('0x4d')]);if(_0x146adb&&_0x146adb[_0xf8cf('0x4e')]){logger[_0xf8cf('0xc')]('[QUEUE]',_0xf8cf('0x4f'));_0x3bbac7['recordingURL']=util[_0xf8cf('0xe')](_0xf8cf('0x50'),_0x475b2b[_0xf8cf('0x4d')],_0x3bbac7[_0xf8cf('0x51')],md5(_0x3bbac7['uniqueid']));}else{_0x3bbac7[_0xf8cf('0x52')]='';}headers[_0xf8cf('0x53')]=getAuth(_0x475b2b);return getUser(_0x475b2b,_0x5c140a['email'])[_0xf8cf('0x18')](function(_0x1d5ade){_0xbd28a3=_0x1d5ade;logger[_0xf8cf('0xc')]('The\x20User\x20ID\x20is:',_0xbd28a3['id']);return getEndUser(_0x475b2b,_0x3bbac7[_0xf8cf('0x54')],_0x3bbac7[_0xf8cf('0x55')]);})[_0xf8cf('0x18')](function(_0x1a0994){_0x2eb057=_0x1a0994;logger[_0xf8cf('0xc')](_0xf8cf('0x56'),_0x2eb057['id']);return getTicket(_0x475b2b,_0xbd28a3,_0x2eb057,_0x1ea6bf,_0x3bbac7);})['then'](function(_0x5a72fb){if(_0x5a72fb){logger['info'](_0xf8cf('0x57'),_0x5a72fb['id']);switch(_0x475b2b[_0xf8cf('0x3f')]){case'integrationTab':logger[_0xf8cf('0xc')](_0xf8cf('0x58'),_0xf8cf('0x59'));return request({'uri':util[_0xf8cf('0xe')](_0xf8cf('0x5a'),_0x475b2b[_0xf8cf('0x10')],_0xbd28a3['id'],_0x5a72fb['id']),'method':'POST'});case _0xf8cf('0x5b'):logger['info']('[QUEUE]',_0xf8cf('0x5c'));emit(util[_0xf8cf('0xe')](_0xf8cf('0x5d'),_0x5c140a['name']),_0xf8cf('0x5e'),{'uri':util[_0xf8cf('0xe')](_0xf8cf('0x5f'),_0x475b2b[_0xf8cf('0x10')]['replace'](_0xf8cf('0x60'),''),_0x5a72fb['id'])});break;default:logger[_0xf8cf('0x61')](_0xf8cf('0x58'),_0xf8cf('0x62'));}}})['catch'](function(_0x4b2613){logger[_0xf8cf('0x61')](_0xf8cf('0x63'),util['inspect'](_0x4b2613,{'showHidden':!![],'depth':null}));});};exports[_0xf8cf('0x64')]=function(_0x5a95cb,_0x2f6f8c,_0x3e4028,_0x524f94,_0x1d21aa,_0xe81d5a,_0x36e2ad){var _0x4e51eb,_0x57bddd;_0xe81d5a[_0xf8cf('0x10')]=intUtil[_0xf8cf('0x4c')](_0xe81d5a[_0xf8cf('0x10')]);_0xe81d5a['serverUrl']=intUtil[_0xf8cf('0x4c')](_0xe81d5a[_0xf8cf('0x4d')]);if(_0x36e2ad&&_0x36e2ad[_0xf8cf('0x65')]&&_0x36e2ad[_0xf8cf('0x65')]!==_0xf8cf('0x66')){logger[_0xf8cf('0xc')](_0xf8cf('0x67'),_0xf8cf('0x4f'));_0x2f6f8c[_0xf8cf('0x52')]=util[_0xf8cf('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe81d5a['serverUrl'],_0x2f6f8c[_0xf8cf('0x51')],md5(_0x2f6f8c[_0xf8cf('0x51')]));}headers[_0xf8cf('0x53')]=getAuth(_0xe81d5a);return getUser(_0xe81d5a,_0x524f94[_0xf8cf('0x68')])[_0xf8cf('0x18')](function(_0x234c16){_0x4e51eb=_0x234c16;logger[_0xf8cf('0xc')](_0xf8cf('0x69'),_0x4e51eb['id']);return getEndUser(_0xe81d5a,_0x2f6f8c[_0xf8cf('0x6a')],_0x2f6f8c[_0xf8cf('0x6b')]);})[_0xf8cf('0x18')](function(_0x2f50ec){_0x57bddd=_0x2f50ec;logger[_0xf8cf('0xc')]('The\x20Enduser\x20ID\x20is:',_0x57bddd['id']);return getTicket(_0xe81d5a,_0x4e51eb,_0x57bddd,_0x3e4028,_0x2f6f8c);})[_0xf8cf('0x18')](function(_0x4ef63f){if(_0x4ef63f){logger[_0xf8cf('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4ef63f['id']);switch(_0xe81d5a[_0xf8cf('0x3f')]){case _0xf8cf('0x6c'):logger[_0xf8cf('0xc')](_0xf8cf('0x67'),_0xf8cf('0x59'));return request({'uri':util[_0xf8cf('0xe')](_0xf8cf('0x5a'),_0xe81d5a[_0xf8cf('0x10')],_0x4e51eb['id'],_0x4ef63f['id']),'method':_0xf8cf('0x11')});case _0xf8cf('0x5b'):logger['info'](_0xf8cf('0x67'),_0xf8cf('0x5c'));emit(util[_0xf8cf('0xe')](_0xf8cf('0x5d'),_0x524f94[_0xf8cf('0x14')]),_0xf8cf('0x5e'),{'uri':util['format'](_0xf8cf('0x5f'),_0xe81d5a[_0xf8cf('0x10')][_0xf8cf('0x6d')]('/api/v2',''),_0x4ef63f['id'])});break;default:logger['error']('[OUTBOUND]',_0xf8cf('0x62'));}}})[_0xf8cf('0x6e')](function(_0x5f1b0c){logger['error'](_0xf8cf('0x6f'),util['inspect'](_0x5f1b0c,{'showHidden':!![],'depth':null}));});};exports[_0xf8cf('0x70')]=function(_0xad63cf,_0x4322d3,_0x30570b,_0x49a1ae,_0x43727d,_0x5a9e84){var _0x41d448,_0xb878b;_0x5a9e84[_0xf8cf('0x10')]=intUtil[_0xf8cf('0x4c')](_0x5a9e84[_0xf8cf('0x10')]);_0x5a9e84[_0xf8cf('0x4d')]=intUtil[_0xf8cf('0x4c')](_0x5a9e84['serverUrl']);if(_0x43727d&&_0x43727d[_0xf8cf('0x4e')]){logger[_0xf8cf('0xc')]('['+_0x4322d3[_0xf8cf('0x71')][_0xf8cf('0x72')]()+']',_0xf8cf('0x4f'));_0x4322d3['recordingURL']=util['format'](_0xf8cf('0x50'),_0x5a9e84[_0xf8cf('0x4d')],_0x4322d3[_0xf8cf('0x51')],md5(_0x4322d3['uniqueid']));}else{_0x4322d3['recordingURL']='';}headers['Authorization']=getAuth(_0x5a9e84);return getUser(_0x5a9e84)[_0xf8cf('0x18')](function(_0x2a6c20){_0x41d448=_0x2a6c20;logger['info']('The\x20User\x20ID\x20is:',_0x41d448['id']);return getEndUser(_0x5a9e84,_0x4322d3['calleridname'],_0x4322d3[_0xf8cf('0x55')]);})[_0xf8cf('0x18')](function(_0x48fcc1){_0xb878b=_0x48fcc1;logger[_0xf8cf('0xc')](_0xf8cf('0x56'),_0xb878b['id']);return getTicket(_0x5a9e84,_0x41d448,_0xb878b,_0x30570b,_0x4322d3);})['then'](function(_0x5e47e1){if(_0x5e47e1){logger[_0xf8cf('0xc')](_0xf8cf('0x57'),_0x5e47e1['id']);}})[_0xf8cf('0x6e')](function(_0x37cb8d){logger[_0xf8cf('0x61')]('['+_0x4322d3[_0xf8cf('0x71')][_0xf8cf('0x72')]()+']'+_0xf8cf('0x73'),util[_0xf8cf('0x74')](_0x37cb8d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x88df=['%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','Recording\x20is\x20enabled!','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','POST','merge','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','username','authType','token','%s/token:%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x88df,0xfc));var _0xf88d=function(_0x2d227f,_0x1846e9){_0x2d227f=_0x2d227f-0x0;var _0x27c6f9=_0x88df[_0x2d227f];return _0x27c6f9;};'use strict';var _=require(_0xf88d('0x0'));var rp=require(_0xf88d('0x1'));var md5=require(_0xf88d('0x2'));var util=require(_0xf88d('0x3'));var Redis=require(_0xf88d('0x4'));var intUtil=require(_0xf88d('0x5'));var config=require(_0xf88d('0x6'));var logger=require(_0xf88d('0x7'))('zendesk');config[_0xf88d('0x8')]=_[_0xf88d('0x9')](config[_0xf88d('0x8')],{'host':_0xf88d('0xa'),'port':0x18eb});var io=require(_0xf88d('0xb'))(new Redis(config['redis']));function emit(_0x540aa9,_0x517b4d,_0x371abf){io['to'](_0x540aa9)[_0xf88d('0xc')](_0x517b4d,_0x371abf);}var headers={'Content-Type':_0xf88d('0xd'),'Accept':_0xf88d('0xd')};function getTicket(_0x460048,_0x180e76,_0xa6d8da,_0x479302,_0xa1ccb5){logger[_0xf88d('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xf88d('0xf')](_0xf88d('0x10'),_0x460048['remoteUri']),'method':_0xf88d('0x11'),'body':{'ticket':_[_0xf88d('0x12')]({'requester_id':_0xa6d8da['id'],'submitter_id':_0x180e76?_0x180e76['id']:undefined,'assignee_id':_0x180e76?_0x180e76['id']:undefined,'tags':getTags(_0x479302['Tags'],_0xf88d('0x13')),'subject':intUtil[_0xf88d('0x14')](_0x479302['Subjects'],_0xa1ccb5,'\x20'),'description':intUtil['getString'](_0x479302[_0xf88d('0x15')],_0xa1ccb5,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf88d('0x14')](_0x479302[_0xf88d('0x15')],_0xa1ccb5,'\x0a')}},getCustomFields(_0x479302[_0xf88d('0x16')],_0xa1ccb5))}})[_0xf88d('0x17')](function(_0x5d9054){logger['info'](_0xf88d('0x18'));return _0x5d9054[_0xf88d('0x19')];});}function getUser(_0x6cdd81,_0xc68abb){if(intUtil['validateEmail'](_0xc68abb)){logger[_0xf88d('0xe')](_0xf88d('0x1a'),_0xc68abb);return request({'uri':util[_0xf88d('0xf')](_0xf88d('0x1b'),_0x6cdd81[_0xf88d('0x1c')]),'qs':{'query':util['format'](_0xf88d('0x1d'),_0xc68abb)}})[_0xf88d('0x17')](function(_0x280a40){if(_0x280a40[_0xf88d('0x1e')]){logger[_0xf88d('0xe')](_0xf88d('0x1f'));return _[_0xf88d('0x20')](_0x280a40[_0xf88d('0x21')],{'email':_0xc68abb,'role':_0xf88d('0x22')});}else{logger[_0xf88d('0xe')](_0xf88d('0x23'));return request({'uri':util[_0xf88d('0xf')](_0xf88d('0x24'),_0x6cdd81[_0xf88d('0x1c')])})['then'](function(_0x57b918){logger[_0xf88d('0xe')](_0xf88d('0x25'));return _0x57b918[_0xf88d('0x26')];});}});}else{logger[_0xf88d('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf88d('0xf')](_0xf88d('0x24'),_0x6cdd81[_0xf88d('0x1c')])})[_0xf88d('0x17')](function(_0x433253){logger['info']('Admin\x20account\x20selected.');return _0x433253[_0xf88d('0x26')];});}}function getEndUser(_0x202059,_0x393f4f,_0x892265){logger['info'](_0xf88d('0x27'),_0x892265);return request({'uri':util[_0xf88d('0xf')]('%s/search.json',_0x202059[_0xf88d('0x1c')]),'qs':{'query':util[_0xf88d('0xf')](_0xf88d('0x28'),_0x892265)}})[_0xf88d('0x17')](function(_0x1d85e9){var _0x5c8694;if(_0x1d85e9[_0xf88d('0x21')]['length']){_0x1d85e9[_0xf88d('0x21')]=_[_0xf88d('0x29')](_0x1d85e9[_0xf88d('0x21')],{'suspended':![],'role':_0xf88d('0x2a')});if(_0x1d85e9[_0xf88d('0x21')][_0xf88d('0x2b')]){_0x5c8694=_['first'](_0x1d85e9[_0xf88d('0x21')]);}}if(_0x5c8694){logger[_0xf88d('0xe')]('Enduser\x20found!');return _0x5c8694;}else{logger[_0xf88d('0xe')](_0xf88d('0x2c'));return request({'uri':util[_0xf88d('0xf')](_0xf88d('0x2d'),_0x202059[_0xf88d('0x1c')]),'method':_0xf88d('0x11'),'body':{'user':{'role':'end-user','name':util[_0xf88d('0xf')](_0xf88d('0x2e'),_0x393f4f||_0x892265),'phone':_0x892265}}})[_0xf88d('0x17')](function(_0x54cf61){logger[_0xf88d('0xe')](_0xf88d('0x2f'));return _0x54cf61['user'];});}});}function getAuth(_0x1ba06a){var _0x51ed8a;if(_0x1ba06a['authType']===_0xf88d('0x30')){_0x51ed8a=util[_0xf88d('0xf')]('%s:%s',_0x1ba06a[_0xf88d('0x31')],_0x1ba06a[_0xf88d('0x30')]);}else if(_0x1ba06a[_0xf88d('0x32')]===_0xf88d('0x33')){_0x51ed8a=util[_0xf88d('0xf')](_0xf88d('0x34'),_0x1ba06a[_0xf88d('0x31')],_0x1ba06a[_0xf88d('0x33')]);}return util[_0xf88d('0xf')]('Basic\x20%s',new Buffer(_0x51ed8a)[_0xf88d('0x35')]('base64'));}function request(_0x47250a){logger[_0xf88d('0x36')](_0xf88d('0x37'),JSON[_0xf88d('0x38')](_0x47250a));return rp(_[_0xf88d('0x9')](_0x47250a,{'method':_0xf88d('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3b2c6b,_0x159c55){var _0x150e13=[];if(_0x3b2c6b&&_0x3b2c6b[_0xf88d('0x2b')]>0x0){_0x150e13=_[_0xf88d('0x3a')](_0x3b2c6b,_0x159c55);}return _0x150e13;}function getCustomFields(_0x5e61c3,_0x3eb6f0){var _0x2ec04d=[];var _0x13da4a={'custom_fields':[]};if(_0x5e61c3['length']>0x0){_[_0xf88d('0x3b')](_0x5e61c3,function(_0x30df78){if(_[_0xf88d('0x3c')]([_0xf88d('0x3d'),_0xf88d('0x3e')],_0x30df78[_0xf88d('0x3f')])&&_0x30df78[_0xf88d('0x40')]&&!_0x30df78[_0xf88d('0x41')]){_0x13da4a[_0x30df78[_0xf88d('0x40')]['toLowerCase']()]=_0x30df78[_0xf88d('0x42')][_0xf88d('0x35')]();}else if(_[_0xf88d('0x3c')](['string','picklist'],_0x30df78[_0xf88d('0x3f')])&&_0x30df78[_0xf88d('0x43')]&&_0x30df78['customField']){_0x13da4a[_0xf88d('0x44')][_0xf88d('0x45')]({'id':_0x30df78[_0xf88d('0x43')],'value':_0x30df78['content']['toString']()});}else if(_0x30df78['type']===_0xf88d('0x46')&&_0x30df78[_0xf88d('0x47')]&&_0x30df78['idField']&&_0x30df78[_0xf88d('0x41')]){_0x3eb6f0[_0x30df78[_0xf88d('0x47')]]&&_0x13da4a[_0xf88d('0x44')][_0xf88d('0x45')]({'id':_0x30df78[_0xf88d('0x43')],'value':_0x3eb6f0[_0x30df78[_0xf88d('0x47')]][_0xf88d('0x35')]()});}else if(_0x30df78[_0xf88d('0x3f')]===_0xf88d('0x48')&&_0x30df78[_0xf88d('0x49')]&&_0x30df78['Variable'][_0xf88d('0x13')]&&_0x30df78['idField']&&_0x30df78['customField']){_0x3eb6f0[_0x30df78[_0xf88d('0x49')]['name'][_0xf88d('0x4a')]()]&&_0x13da4a[_0xf88d('0x44')][_0xf88d('0x45')]({'id':_0x30df78['idField'],'value':_0x3eb6f0[_0x30df78[_0xf88d('0x49')][_0xf88d('0x13')]['toLowerCase']()][_0xf88d('0x35')]()});}});}return _0x13da4a;}exports[_0xf88d('0x4b')]=function(_0xbfa789,_0x42867c,_0x1a9196,_0x190ee3,_0x16d17e,_0x5d5925){var _0xbadeb6,_0x42c05a;_0x5d5925[_0xf88d('0x1c')]=intUtil[_0xf88d('0x4c')](_0x5d5925[_0xf88d('0x1c')]);_0x5d5925[_0xf88d('0x4d')]=intUtil['stripTrailingSlash'](_0x5d5925[_0xf88d('0x4d')]);if(_0x16d17e&&_0x16d17e[_0xf88d('0x4e')]){logger[_0xf88d('0xe')](_0xf88d('0x4f'),'Recording\x20is\x20enabled!');_0x42867c[_0xf88d('0x50')]=util['format'](_0xf88d('0x51'),_0x5d5925[_0xf88d('0x4d')],_0x42867c[_0xf88d('0x52')],md5(_0x42867c[_0xf88d('0x52')]));}else{_0x42867c['recordingURL']='';}headers[_0xf88d('0x53')]=getAuth(_0x5d5925);return getUser(_0x5d5925,_0x190ee3[_0xf88d('0x54')])[_0xf88d('0x17')](function(_0x372f1){_0xbadeb6=_0x372f1;logger[_0xf88d('0xe')](_0xf88d('0x55'),_0xbadeb6['id']);return getEndUser(_0x5d5925,_0x42867c[_0xf88d('0x56')],_0x42867c[_0xf88d('0x57')]);})[_0xf88d('0x17')](function(_0x36ec18){_0x42c05a=_0x36ec18;logger[_0xf88d('0xe')]('The\x20Enduser\x20ID\x20is:',_0x42c05a['id']);return getTicket(_0x5d5925,_0xbadeb6,_0x42c05a,_0x1a9196,_0x42867c);})[_0xf88d('0x17')](function(_0x3f417f){if(_0x3f417f){logger[_0xf88d('0xe')](_0xf88d('0x58'),_0x3f417f['id']);switch(_0x5d5925[_0xf88d('0x3f')]){case _0xf88d('0x59'):logger[_0xf88d('0xe')](_0xf88d('0x4f'),_0xf88d('0x5a'));return request({'uri':util['format'](_0xf88d('0x5b'),_0x5d5925['remoteUri'],_0xbadeb6['id'],_0x3f417f['id']),'method':_0xf88d('0x11')});case _0xf88d('0x5c'):logger[_0xf88d('0xe')](_0xf88d('0x4f'),_0xf88d('0x5d'));emit(util['format'](_0xf88d('0x5e'),_0x190ee3['name']),_0xf88d('0x5f'),{'uri':util['format'](_0xf88d('0x60'),_0x5d5925[_0xf88d('0x1c')][_0xf88d('0x61')](_0xf88d('0x62'),''),_0x3f417f['id'])});break;default:logger[_0xf88d('0x63')](_0xf88d('0x4f'),_0xf88d('0x64'));}}})[_0xf88d('0x65')](function(_0x17877b){logger[_0xf88d('0x63')](_0xf88d('0x66'),util['inspect'](_0x17877b,{'showHidden':!![],'depth':null}));});};exports[_0xf88d('0x67')]=function(_0xc7607f,_0x184fda,_0x223c93,_0x49128a,_0x60eb97,_0x32088c,_0x1016ad){var _0x5b820a,_0x1caa83;_0x32088c[_0xf88d('0x1c')]=intUtil['stripTrailingSlash'](_0x32088c['remoteUri']);_0x32088c['serverUrl']=intUtil[_0xf88d('0x4c')](_0x32088c[_0xf88d('0x4d')]);if(_0x1016ad&&_0x1016ad[_0xf88d('0x68')]&&_0x1016ad[_0xf88d('0x68')]!==_0xf88d('0x69')){logger[_0xf88d('0xe')](_0xf88d('0x6a'),'Recording\x20is\x20enabled!');_0x184fda[_0xf88d('0x50')]=util[_0xf88d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32088c[_0xf88d('0x4d')],_0x184fda[_0xf88d('0x52')],md5(_0x184fda[_0xf88d('0x52')]));}headers[_0xf88d('0x53')]=getAuth(_0x32088c);return getUser(_0x32088c,_0x49128a['email'])[_0xf88d('0x17')](function(_0x24fb92){_0x5b820a=_0x24fb92;logger[_0xf88d('0xe')](_0xf88d('0x55'),_0x5b820a['id']);return getEndUser(_0x32088c,_0x184fda[_0xf88d('0x6b')],_0x184fda[_0xf88d('0x6c')]);})[_0xf88d('0x17')](function(_0x2ac526){_0x1caa83=_0x2ac526;logger['info'](_0xf88d('0x6d'),_0x1caa83['id']);return getTicket(_0x32088c,_0x5b820a,_0x1caa83,_0x223c93,_0x184fda);})[_0xf88d('0x17')](function(_0x5f97f6){if(_0x5f97f6){logger[_0xf88d('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5f97f6['id']);switch(_0x32088c[_0xf88d('0x3f')]){case'integrationTab':logger[_0xf88d('0xe')](_0xf88d('0x6a'),_0xf88d('0x5a'));return request({'uri':util[_0xf88d('0xf')](_0xf88d('0x5b'),_0x32088c['remoteUri'],_0x5b820a['id'],_0x5f97f6['id']),'method':_0xf88d('0x11')});case _0xf88d('0x5c'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf88d('0xf')](_0xf88d('0x5e'),_0x49128a[_0xf88d('0x13')]),_0xf88d('0x5f'),{'uri':util[_0xf88d('0xf')]('%s/agent/tickets/%s',_0x32088c[_0xf88d('0x1c')][_0xf88d('0x61')](_0xf88d('0x62'),''),_0x5f97f6['id'])});break;default:logger['error'](_0xf88d('0x6a'),_0xf88d('0x64'));}}})[_0xf88d('0x65')](function(_0x5d2b34){logger[_0xf88d('0x63')](_0xf88d('0x6e'),util[_0xf88d('0x6f')](_0x5d2b34,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x244ab4,_0x26f9f,_0x4c0c91,_0x5aa382,_0x114877,_0x3db1ea){var _0x1f7b4e,_0x29d8b6;_0x3db1ea[_0xf88d('0x1c')]=intUtil[_0xf88d('0x4c')](_0x3db1ea[_0xf88d('0x1c')]);_0x3db1ea[_0xf88d('0x4d')]=intUtil[_0xf88d('0x4c')](_0x3db1ea[_0xf88d('0x4d')]);if(_0x114877&&_0x114877['monitor_format']){logger[_0xf88d('0xe')]('['+_0x26f9f[_0xf88d('0x70')]['toUpperCase']()+']',_0xf88d('0x71'));_0x26f9f[_0xf88d('0x50')]=util[_0xf88d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3db1ea['serverUrl'],_0x26f9f['uniqueid'],md5(_0x26f9f['uniqueid']));}else{_0x26f9f['recordingURL']='';}headers['Authorization']=getAuth(_0x3db1ea);return getUser(_0x3db1ea)[_0xf88d('0x17')](function(_0x51577c){_0x1f7b4e=_0x51577c;logger[_0xf88d('0xe')](_0xf88d('0x55'),_0x1f7b4e['id']);return getEndUser(_0x3db1ea,_0x26f9f[_0xf88d('0x56')],_0x26f9f['calleridnum']);})[_0xf88d('0x17')](function(_0x2f152c){_0x29d8b6=_0x2f152c;logger[_0xf88d('0xe')](_0xf88d('0x6d'),_0x29d8b6['id']);return getTicket(_0x3db1ea,_0x1f7b4e,_0x29d8b6,_0x4c0c91,_0x26f9f);})['then'](function(_0x19f905){if(_0x19f905){logger[_0xf88d('0xe')](_0xf88d('0x58'),_0x19f905['id']);}})[_0xf88d('0x65')](function(_0x122da2){logger[_0xf88d('0x63')]('['+_0x26f9f[_0xf88d('0x70')][_0xf88d('0x72')]()+']'+_0xf88d('0x73'),util[_0xf88d('0x6f')](_0x122da2,{'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 475e27c..40b0611 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 _0x858f=['nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','Call_Duration','utc','talktime','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','Leads'];(function(_0x47cfe0,_0x4b6ee1){var _0x40a336=function(_0x15e504){while(--_0x15e504){_0x47cfe0['push'](_0x47cfe0['shift']());}};_0x40a336(++_0x4b6ee1);}(_0x858f,0xeb));var _0xf858=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0x858f[_0x403cff];return _0x5a7c56;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf858('0x0'));var util=require(_0xf858('0x1'));var intUtil=require(_0xf858('0x2'));var moment=require(_0xf858('0x3'));var Redis=require(_0xf858('0x4'));var BPromise=require(_0xf858('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf858('0x6'))(_0xf858('0x7'));config['redis']=_[_0xf858('0x8')](config['redis'],{'host':_0xf858('0x9'),'port':0x18eb});var io=require(_0xf858('0xa'))(new Redis(config[_0xf858('0xb')]));function emit(_0x50bc02,_0x13599d,_0x4024b5){io['to'](_0x50bc02)[_0xf858('0xc')](_0x13599d,_0x4024b5);}function request(_0x3f5018){logger[_0xf858('0xd')](_0xf858('0xe'),JSON[_0xf858('0xf')](_0x3f5018));return rp(_0x3f5018);}function getCustomFields(_0x28efb2,_0x23934c){var _0x17c157={};if(_0x28efb2[_0xf858('0x10')]>0x0){_[_0xf858('0x11')](_0x28efb2,function(_0x537b0c){if(_['includes']([_0xf858('0x12'),_0xf858('0x13')],_0x537b0c[_0xf858('0x14')])&&_0x537b0c[_0xf858('0x15')]){_0x17c157[_0x537b0c[_0xf858('0x15')]]=_0x537b0c['content'][_0xf858('0x16')]();}else if(_0x537b0c[_0xf858('0x14')]==='variable'&&_0x537b0c[_0xf858('0x17')]&&_0x537b0c[_0xf858('0x15')]&&_0x23934c[_0x537b0c['variableName']]){_0x17c157[_0x537b0c[_0xf858('0x15')]]=_0x23934c[_0x537b0c[_0xf858('0x17')]]['toString']();}else if(_0x537b0c[_0xf858('0x14')]===_0xf858('0x18')&&_0x537b0c[_0xf858('0x19')]&&_0x537b0c[_0xf858('0x19')][_0xf858('0x1a')]&&_0x537b0c[_0xf858('0x15')]&&_0x23934c[_0x537b0c[_0xf858('0x19')][_0xf858('0x1a')][_0xf858('0x1b')]()]){_0x17c157[_0x537b0c[_0xf858('0x15')]]=_0x23934c[_0x537b0c[_0xf858('0x19')][_0xf858('0x1a')][_0xf858('0x1b')]()][_0xf858('0x16')]();}});}return _0x17c157;}function getName(_0x10cb5f){if(_0x10cb5f['indexOf']('\x20')>0x0){var _0x58dbca=_0x10cb5f[_0xf858('0x1c')](/ (.+)/);if(_0x58dbca[0x1]){return _0x58dbca;}}return[_0x10cb5f,_0x10cb5f];}var accountsTokens={};function getAccessToken(_0x48c903){return new Promise(function(_0x57cf28,_0x3519e3){if(!_[_0xf858('0x1d')](accountsTokens[_0x48c903['id']])&&!_[_0xf858('0x1d')](accountsTokens[_0x48c903['id']]['access_token'])){if(moment()[_0xf858('0x1e')](accountsTokens[_0x48c903['id']][_0xf858('0x1f')])){_0x57cf28(accountsTokens[_0x48c903['id']][_0xf858('0x20')]);}}var _0x5e52f4;switch(_0x48c903[_0xf858('0x21')]){case'US':_0x5e52f4='https://accounts.zoho.com';break;case'AU':_0x5e52f4=_0xf858('0x22');break;case'EU':_0x5e52f4=_0xf858('0x23');break;case'IN':_0x5e52f4='https://accounts.zoho.in';break;case'CN':_0x5e52f4='https://accounts.zoho.com.cn';break;default:_0x5e52f4=_0xf858('0x23');break;}var _0x314b29={'method':_0xf858('0x24'),'uri':_0x5e52f4+_0xf858('0x25'),'qs':{'refresh_token':_0x48c903[_0xf858('0x26')],'client_id':_0x48c903[_0xf858('0x27')],'client_secret':_0x48c903[_0xf858('0x28')],'grant_type':_0xf858('0x29')},'json':!![]};return rp(_0x314b29)[_0xf858('0x2a')](function(_0x3e00d8){accountsTokens[_0x48c903['id']]={'access_token':_0x3e00d8[_0xf858('0x20')],'expires_in':moment()[_0xf858('0x2b')](_0x3e00d8[_0xf858('0x1f')],_0xf858('0x2c'))};_0x57cf28(_0x3e00d8[_0xf858('0x20')]);})[_0xf858('0x2d')](function(_0x1ce64b){logger['error'](_0xf858('0x2e'),_0x1ce64b[_0xf858('0x2f')]);_0x3519e3(_0x1ce64b);});});}function getUser(_0x3181ac,_0xa8c23c,_0x116fcb,_0x57b3cb){logger['info'](_0xf858('0x30'));return request({'method':_0xf858('0x31'),'uri':util[_0xf858('0x32')](_0xf858('0x33'),_0xa8c23c),'qs':{'type':_0xf858('0x34')},'headers':{'Authorization':_0xf858('0x35')+_0x3181ac},'json':!![]})['then'](function(_0x2187cb){if(_0x2187cb[_0xf858('0x36')]){var _0x553356=-0x1;if(_['isArrayLikeObject'](_0x2187cb['users'])){if(!_[_0xf858('0x1d')](_0x57b3cb)){_0x553356=_[_0xf858('0x37')](_0x2187cb[_0xf858('0x36')],function(_0x2b0367){return _0x2b0367[_0xf858('0x38')]===_0x57b3cb;});}if(_0x553356>=0x0){logger[_0xf858('0x39')](_0xf858('0x3a'));}else{logger[_0xf858('0x39')](_0xf858('0x3b'));_0x553356=_[_0xf858('0x37')](_0x2187cb[_0xf858('0x36')],function(_0xe599f1){return _0xe599f1[_0xf858('0x3c')]['name']===_0xf858('0x3d');});}return _0x2187cb['users'][_0x553356];}else{if(_0x2187cb[_0xf858('0x3e')][_0xf858('0x3c')][_0xf858('0x1a')]==='Administrator'){logger[_0xf858('0x39')](_0xf858('0x3b'));user=_0x2187cb[_0xf858('0x3e')];return user;}else{logger['error'](_0xf858('0x3f'),JSON['stringify'](_0x2187cb));throw new Error(_0xf858('0x40')+JSON[_0xf858('0xf')](_0x2187cb));}}}else{logger[_0xf858('0x41')]('The\x20failing\x20result\x20is',JSON[_0xf858('0xf')](_0x2187cb));throw new Error(_0xf858('0x40')+JSON[_0xf858('0xf')](_0x2187cb));}})[_0xf858('0x2d')](function(_0xd88408){console[_0xf858('0x41')](_0xd88408);});}function getZohoUser(_0x589d6f,_0x569c00){return new BPromise(function(_0x32d7a6,_0x10d08c){request(_0x589d6f)[_0xf858('0x2a')](function(_0x28fe6f){var _0x1cbe61=null;if(_0x28fe6f){_0x1cbe61=_0x28fe6f[_0xf858('0x42')][0x0];_0x1cbe61[_0xf858('0x43')]=_0x569c00;}_0x32d7a6(_0x1cbe61);})[_0xf858('0x2d')](function(_0x5b0005){_0x10d08c(_0x5b0005);});});}function createEndUser(_0x267cd1,_0x4364f5,_0x39f99e,_0x5627bf,_0x317d35,_0x40bcc6){var _0x39f99e=getName(_0x39f99e);return request({'method':'POST','uri':_0xf858('0x44')+_0x4364f5+_0xf858('0x45')+_['startCase'](_0x40bcc6[_0xf858('0x46')])+'s','body':{'data':[{'Last_Name':_0x39f99e[0x1],'First_Name':_0x39f99e[0x0],'Phone':_0x5627bf,'Owner':{'name':!_['isNil'](_0x317d35['role'][_0xf858('0x1a')])?_0x317d35[_0xf858('0x47')][_0xf858('0x1a')]:!_[_0xf858('0x1d')](_0x317d35['first_name'])?_0x317d35[_0xf858('0x48')]+'\x20'+_0x317d35[_0xf858('0x49')]:_0x317d35[_0xf858('0x49')],'id':_0x317d35['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x267cd1},'json':!![]})['then'](function(_0x2f822e){if(_0x2f822e&&_0x2f822e[_0xf858('0x42')][0x0][_0xf858('0x4a')]===_0xf858('0x4b')){var _0x33c155=_0x2f822e[_0xf858('0x42')][0x0][_0xf858('0x4c')];_0x33c155[_0xf858('0x43')]=_['startCase'](_0x40bcc6[_0xf858('0x46')])+'s';return _0x33c155;}logger[_0xf858('0x41')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xf858('0x4d')+JSON['stringify'](data));})[_0xf858('0x2d')](function(_0x2bc555){console[_0xf858('0x4e')](_0xf858('0x4f'),_0x2bc555);});}function getEndUser(_0x2f2a4f,_0x45af06,_0x490485,_0x26ba03,_0x12dfbf,_0x151e0d,_0x4198f7){var _0x1b03cd={'method':_0xf858('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2f2a4f},'json':!![]};switch(_0x4198f7['moduleSearch']){case _0xf858('0x50'):_0x1b03cd['uri']='https://www.zohoapis.'+_0x45af06+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x12dfbf+'))';return getZohoUser(_0x1b03cd,'Contacts')['then'](function(_0x51b03c){if(_0x51b03c)return _0x51b03c;_0x1b03cd[_0xf858('0x51')]=_0xf858('0x44')+_0x45af06+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x12dfbf+'))';return getZohoUser(_0x1b03cd,_0xf858('0x52'))['then'](function(_0x330307){if(_0x330307)return _0x330307;if(_0x4198f7[_0xf858('0x46')]!=_0xf858('0x53')){return createEndUser(_0x2f2a4f,_0x45af06,_0x26ba03,_0x12dfbf,_0x151e0d,_0x4198f7);}else{return{};}});});break;case _0xf858('0x54'):_0x1b03cd['uri']='https://www.zohoapis.'+_0x45af06+_0xf858('0x55')+_0x12dfbf+'))';return getZohoUser(_0x1b03cd,_0xf858('0x56'))['then'](function(_0x5bae90){if(_0x5bae90)return _0x5bae90;if(_0x4198f7[_0xf858('0x46')]!=_0xf858('0x53')){return createEndUser(_0x2f2a4f,_0x45af06,_0x26ba03,_0x12dfbf,_0x151e0d,_0x4198f7);}else{return{};}});break;case _0xf858('0x57'):_0x1b03cd[_0xf858('0x51')]=_0xf858('0x44')+_0x45af06+_0xf858('0x58')+_0x12dfbf+'))';return getZohoUser(_0x1b03cd,_0xf858('0x52'))[_0xf858('0x2a')](function(_0x801048){if(_0x801048)return _0x801048;if(_0x4198f7['moduleCreate']!='nothing'){return createEndUser(_0x2f2a4f,_0x45af06,_0x26ba03,_0x12dfbf,_0x151e0d,_0x4198f7);}else{return{};}});break;}}function getCall(_0x58f378,_0x4ece9e,_0x44e05e,_0x451fcb,_0x1eaeab,_0x555db4,_0x4224c3,_0x4ab231){logger['info']('Creating\x20new\x20call...');var _0x4ffb6b={};_0x4ffb6b[_0xf858('0x59')]={'name':!_[_0xf858('0x1d')](_0x451fcb[_0xf858('0x47')][_0xf858('0x1a')])&&!_['isNil'](_0x451fcb[_0xf858('0x3c')][_0xf858('0x1a')])&&_0x451fcb[_0xf858('0x3c')][_0xf858('0x1a')]==='administrator'?_0x451fcb[_0xf858('0x47')][_0xf858('0x1a')]:!_['isNil'](_0x451fcb[_0xf858('0x48')])?_0x451fcb[_0xf858('0x48')]+'\x20'+_0x451fcb['last_name']:_0x451fcb['last_name'],'id':_0x451fcb['id']};_0x4ffb6b[_0xf858('0x5a')]=intUtil[_0xf858('0x5b')](_0x555db4[_0xf858('0x5c')],_0x4224c3,'\x20');_0x4ffb6b[_0xf858('0x5d')]=intUtil[_0xf858('0x5b')](_0x555db4[_0xf858('0x5e')],_0x4224c3,'\x0a');if(_0x1eaeab[_0xf858('0x43')]==='Contacts'){_0x4ffb6b['Who_Id']={'name':!_[_0xf858('0x1d')](_0x1eaeab[_0xf858('0x5f')])?_0x1eaeab[_0xf858('0x5f')]:!_[_0xf858('0x1d')](_0x1eaeab['First_Name'])?_0x1eaeab[_0xf858('0x60')]+'\x20'+_0x1eaeab['Last_Name']:_0x1eaeab[_0xf858('0x61')],'id':_0x1eaeab['id']};}if(_0x1eaeab[_0xf858('0x43')]===_0xf858('0x52')){_0x4ffb6b[_0xf858('0x62')]={'name':!_[_0xf858('0x1d')](_0x1eaeab[_0xf858('0x5f')])?_0x1eaeab['Full_Name']:!_['isNil'](_0x1eaeab[_0xf858('0x60')])?_0x1eaeab['First_Name']+'\x20'+_0x1eaeab[_0xf858('0x61')]:_0x1eaeab[_0xf858('0x61')],'id':_0x1eaeab['id']};_0x4ffb6b[_0xf858('0x63')]=_[_0xf858('0x64')](_0x1eaeab[_0xf858('0x43')]);}if(_0x4224c3['talktime']){_0x4ffb6b[_0xf858('0x65')]=moment[_0xf858('0x66')](parseInt(_0x4224c3[_0xf858('0x67')])*0x3e8)[_0xf858('0x32')](_0xf858('0x68'));}else if(_0x4224c3[_0xf858('0x69')]&&_0x4224c3['endtime']){_0x4ffb6b[_0xf858('0x65')]=moment[_0xf858('0x66')](moment(_0x4224c3['endtime'],_0xf858('0x6a'))[_0xf858('0x6b')](moment(_0x4224c3[_0xf858('0x6c')],_0xf858('0x6a'))))[_0xf858('0x32')](_0xf858('0x68'));}switch(_0x4224c3[_0xf858('0x6d')]){case _0xf858('0x6e'):_0x4ffb6b[_0xf858('0x6f')]=_0xf858('0x70');break;case _0xf858('0x71'):case _0xf858('0x72'):_0x4ffb6b[_0xf858('0x6f')]=_0xf858('0x73');break;case _0xf858('0x74'):_0x4ffb6b[_0xf858('0x6f')]=_0xf858('0x75');break;case _0xf858('0x76'):_0x4ffb6b['Call_Result']='Abandoned';break;case'timeout':_0x4ffb6b['Call_Result']=_0xf858('0x77');default:}_0x4ffb6b[_0xf858('0x78')]=(_0x4ab231===_0xf858('0x79')?moment(_0x4224c3[_0xf858('0x6c')])[_0xf858('0x32')](_0xf858('0x6a')):moment(_0x4224c3['agentcalledAt'])[_0xf858('0x32')](_0xf858('0x6a')))||moment()[_0xf858('0x32')](_0xf858('0x6a'));_0x4ffb6b[_0xf858('0x7a')]=_0x4ab231||_0xf858('0x7b');_0x4ffb6b=_[_0xf858('0x7c')](_0x4ffb6b,getCustomFields(_0x555db4[_0xf858('0x7d')],_0x4224c3));return request({'method':_0xf858('0x24'),'uri':_0xf858('0x44')+_0x4ece9e+_0xf858('0x7e'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x58f378},'body':{'data':[_0x4ffb6b]},'json':!![]})[_0xf858('0x2a')](function(_0x464fa3){if(_0x464fa3&&_0x464fa3['data'][0x0][_0xf858('0x4a')]==='SUCCESS'){logger['info'](_0xf858('0x7f'));return{'id':_0x464fa3[_0xf858('0x42')][0x0][_0xf858('0x4c')]['id']};}})[_0xf858('0x2d')](function(_0x4e9b91){logger[_0xf858('0x39')](_0xf858('0x80'),_0x4e9b91[_0xf858('0x2f')]);console[_0xf858('0x4e')](_0xf858('0x80'),_0x4e9b91);});}exports[_0xf858('0x81')]=function(_0x441e54,_0x27c2e8,_0x32f819,_0x2d4c71,_0x9475f,_0x32ee78){var _0x415f94,_0x56804c,_0x4eae70;_0x32ee78[_0xf858('0x82')]=intUtil[_0xf858('0x83')](_0x32ee78[_0xf858('0x82')]);_0x32ee78[_0xf858('0x84')]=intUtil['stripTrailingSlash'](_0x32ee78[_0xf858('0x84')]);if(_0x9475f&&_0x9475f[_0xf858('0x85')]){logger[_0xf858('0x39')]('[QUEUE]','Recording\x20is\x20enabled!');_0x27c2e8[_0xf858('0x86')]=_0x32ee78[_0xf858('0x84')]+_0xf858('0x87')+_0x27c2e8['uniqueid']+_0xf858('0x88')+md5(_0x27c2e8[_0xf858('0x89')]);}else{_0x27c2e8[_0xf858('0x86')]='';}var _0x13a0f6=_0x32ee78[_0xf858('0x82')]===_0xf858('0x8a')?'eu':_0xf858('0x8b');return getAccessToken(_0x32ee78)[_0xf858('0x2a')](function(_0x2ff544){_0x4eae70=_0x2ff544;return getUser(_0x4eae70,_0x13a0f6,_0x32ee78,_0x2d4c71['email']);})['then'](function(_0xbbfc2e){_0x415f94=_0xbbfc2e;logger[_0xf858('0x39')](_0xf858('0x8c'),_0x415f94['id']);return getEndUser(_0x4eae70,_0x13a0f6,_0x32ee78,_0x27c2e8[_0xf858('0x8d')],_0x27c2e8[_0xf858('0x8e')],_0x415f94,_0x32f819);})['then'](function(_0x3598c0){_0x56804c=_0x3598c0;return getCall(_0x4eae70,_0x13a0f6,_0x32ee78,_0x415f94,_0x56804c,_0x32f819,_0x27c2e8,_0xf858('0x7b'));})[_0xf858('0x2a')](function(_0x2f9d24){if(_0x2f9d24){logger[_0xf858('0x39')]('The\x20Call\x20ID\x20is:',_0x2f9d24['id']);logger[_0xf858('0x39')](_0xf858('0x8f'),_0xf858('0x90'));emit(util['format'](_0xf858('0x91'),_0x2d4c71[_0xf858('0x1a')]),_0xf858('0x92'),{'uri':_0xf858('0x93')+_0x32ee78[_0xf858('0x82')]+_0xf858('0x94')+_0x2f9d24['id']});}})[_0xf858('0x2d')](function(_0x1ab964){logger[_0xf858('0x41')](_0xf858('0x8f'),JSON[_0xf858('0xf')](_0x1ab964));});};exports[_0xf858('0x79')]=function(_0x58a415,_0x14304c,_0x4607e5,_0x7270fa,_0x314fe4,_0x246614,_0x151b69){var _0x3dd0db,_0x3eeeda,_0x50ef2a;_0x246614['host']=intUtil[_0xf858('0x83')](_0x246614[_0xf858('0x82')]);_0x246614[_0xf858('0x84')]=intUtil[_0xf858('0x83')](_0x246614[_0xf858('0x84')]);if(_0x151b69&&_0x151b69['recordingFormat']&&_0x151b69[_0xf858('0x95')]!==_0xf858('0x96')){logger[_0xf858('0x39')]('[OUTBOUND]',_0xf858('0x97'));_0x14304c[_0xf858('0x86')]=_0x246614[_0xf858('0x84')]+_0xf858('0x87')+_0x14304c[_0xf858('0x89')]+_0xf858('0x88')+md5(_0x14304c[_0xf858('0x89')]);}var _0x1ced3d=_0x246614['host']===_0xf858('0x8a')?'eu':_0xf858('0x8b');return getAccessToken(_0x246614)[_0xf858('0x2a')](function(_0x2f3bba){_0x50ef2a=_0x2f3bba;return getUser(_0x50ef2a,_0x1ced3d,_0x246614,_0x7270fa[_0xf858('0x38')]);})[_0xf858('0x2a')](function(_0x3f5d25){_0x3dd0db=_0x3f5d25;logger[_0xf858('0x39')]('The\x20User\x20ID\x20is:',_0x3dd0db['id']);return getEndUser(_0x50ef2a,_0x1ced3d,_0x246614,_0x14304c[_0xf858('0x98')],_0x14304c[_0xf858('0x99')],_0x3dd0db,_0x4607e5);})[_0xf858('0x2a')](function(_0xd24ad2){_0x3eeeda=_0xd24ad2;return getCall(_0x50ef2a,_0x1ced3d,_0x246614,_0x3dd0db,_0x3eeeda,_0x4607e5,_0x14304c,_0xf858('0x9a'));})[_0xf858('0x2a')](function(_0x2f422e){if(_0x2f422e){logger['info'](_0xf858('0x9b'),_0x2f422e['id']);logger[_0xf858('0x39')](_0xf858('0x9c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf858('0x32')](_0xf858('0x91'),_0x7270fa[_0xf858('0x1a')]),_0xf858('0x92'),{'uri':_0xf858('0x93')+_0x246614['host']+_0xf858('0x94')+_0x2f422e['id']});}})['catch'](function(_0x15e0e8){logger[_0xf858('0x41')](_0xf858('0x9c'),JSON[_0xf858('0xf')](_0x15e0e8));});};exports[_0xf858('0x9d')]=function(_0x2ca948,_0x3e393d,_0x1901e0,_0x1fbc1c,_0x437b02,_0x47efce){var _0x5dbcca,_0x56e7df,_0x65ba01;_0x47efce[_0xf858('0x82')]=intUtil[_0xf858('0x83')](_0x47efce[_0xf858('0x82')]);_0x47efce[_0xf858('0x84')]=intUtil[_0xf858('0x83')](_0x47efce['serverUrl']);if(_0x437b02&&_0x437b02[_0xf858('0x85')]){logger[_0xf858('0x39')]('['+_0x3e393d['lastevent'][_0xf858('0x9e')]()+']','Recording\x20is\x20enabled!');_0x3e393d[_0xf858('0x86')]=_0x47efce[_0xf858('0x84')]+_0xf858('0x87')+_0x3e393d[_0xf858('0x89')]+_0xf858('0x88')+md5(_0x3e393d[_0xf858('0x89')]);}else{_0x3e393d[_0xf858('0x86')]='';}var _0x4d3e85=_0x47efce[_0xf858('0x82')]==='zoho.eu'?'eu':_0xf858('0x8b');return getAccessToken(_0x47efce)['then'](function(_0x4d2808){_0x65ba01=_0x4d2808;return getUser(_0x65ba01,_0x4d3e85,_0x47efce);})[_0xf858('0x2a')](function(_0x5a9f78){_0x5dbcca=_0x5a9f78;logger[_0xf858('0x39')](_0xf858('0x8c'),_0x5dbcca['id']);return getEndUser(_0x65ba01,_0x4d3e85,_0x47efce,_0x3e393d[_0xf858('0x8d')],_0x3e393d['calleridnum'],_0x5dbcca,_0x1901e0);})[_0xf858('0x2a')](function(_0x545847){_0x56e7df=_0x545847;return getCall(_0x65ba01,_0x4d3e85,_0x47efce,_0x5dbcca,_0x56e7df,_0x1901e0,_0x3e393d,'Inbound');})['then'](function(_0x4bf4c8){if(_0x4bf4c8){logger[_0xf858('0x39')](_0xf858('0x9b'),_0x4bf4c8['id']);}})[_0xf858('0x2d')](function(_0x31e713){logger[_0xf858('0x41')]('['+_0x3e393d['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x31e713));});}; \ No newline at end of file +var _0x5cbc=['GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','/crm/v2/','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','enduserType','startCase','Error:\x20','CREATE\x20ERROR','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','com','email','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','[OUTBOUND]','unmanaged','monitor_format','recordingURL','toUpperCase','lodash','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','emit','[HTTP]','length','includes','string','idField','toString','type','variable','variableName','customVariable','Variable','name','indexOf','split','isNil','isBefore','access_token','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','clientId','then','add','expires_in','seconds','error','stack','info','Search\x20user'];(function(_0x2135a8,_0x2d5706){var _0x3dd593=function(_0x3c4c5d){while(--_0x3c4c5d){_0x2135a8['push'](_0x2135a8['shift']());}};_0x3dd593(++_0x2d5706);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x2c98d9,_0x10d27f){_0x2c98d9=_0x2c98d9-0x0;var _0x4a0f83=_0x5cbc[_0x2c98d9];return _0x4a0f83;};'use strict';var _=require(_0xc5cb('0x0'));var rp=require('request-promise');var md5=require(_0xc5cb('0x1'));var util=require(_0xc5cb('0x2'));var intUtil=require(_0xc5cb('0x3'));var moment=require(_0xc5cb('0x4'));var Redis=require('ioredis');var BPromise=require(_0xc5cb('0x5'));var config=require(_0xc5cb('0x6'));var logger=require(_0xc5cb('0x7'))('zoho');config[_0xc5cb('0x8')]=_['defaults'](config[_0xc5cb('0x8')],{'host':_0xc5cb('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc5cb('0x8')]));function emit(_0x59cd41,_0xf8bea9,_0x3cd76c){io['to'](_0x59cd41)[_0xc5cb('0xa')](_0xf8bea9,_0x3cd76c);}function request(_0x45da1d){logger['debug'](_0xc5cb('0xb'),JSON['stringify'](_0x45da1d));return rp(_0x45da1d);}function getCustomFields(_0x46d8d3,_0x5d8973){var _0x5c1c39={};if(_0x46d8d3[_0xc5cb('0xc')]>0x0){_['forEach'](_0x46d8d3,function(_0x3b7be4){if(_[_0xc5cb('0xd')]([_0xc5cb('0xe'),'picklist'],_0x3b7be4['type'])&&_0x3b7be4[_0xc5cb('0xf')]){_0x5c1c39[_0x3b7be4[_0xc5cb('0xf')]]=_0x3b7be4['content'][_0xc5cb('0x10')]();}else if(_0x3b7be4[_0xc5cb('0x11')]===_0xc5cb('0x12')&&_0x3b7be4[_0xc5cb('0x13')]&&_0x3b7be4[_0xc5cb('0xf')]&&_0x5d8973[_0x3b7be4['variableName']]){_0x5c1c39[_0x3b7be4['idField']]=_0x5d8973[_0x3b7be4[_0xc5cb('0x13')]][_0xc5cb('0x10')]();}else if(_0x3b7be4[_0xc5cb('0x11')]===_0xc5cb('0x14')&&_0x3b7be4['Variable']&&_0x3b7be4[_0xc5cb('0x15')][_0xc5cb('0x16')]&&_0x3b7be4[_0xc5cb('0xf')]&&_0x5d8973[_0x3b7be4[_0xc5cb('0x15')]['name']['toLowerCase']()]){_0x5c1c39[_0x3b7be4['idField']]=_0x5d8973[_0x3b7be4[_0xc5cb('0x15')][_0xc5cb('0x16')]['toLowerCase']()][_0xc5cb('0x10')]();}});}return _0x5c1c39;}function getName(_0x3719f0){if(_0x3719f0[_0xc5cb('0x17')]('\x20')>0x0){var _0x2fffd0=_0x3719f0[_0xc5cb('0x18')](/ (.+)/);if(_0x2fffd0[0x1]){return _0x2fffd0;}}return[_0x3719f0,_0x3719f0];}var accountsTokens={};function getAccessToken(_0x585648){return new Promise(function(_0x156ce4,_0x35c4f2){if(!_[_0xc5cb('0x19')](accountsTokens[_0x585648['id']])&&!_['isNil'](accountsTokens[_0x585648['id']]['access_token'])){if(moment()[_0xc5cb('0x1a')](accountsTokens[_0x585648['id']]['expires_in'])){_0x156ce4(accountsTokens[_0x585648['id']][_0xc5cb('0x1b')]);}}var _0x28aae8;switch(_0x585648['zone']){case'US':_0x28aae8='https://accounts.zoho.com';break;case'AU':_0x28aae8=_0xc5cb('0x1c');break;case'EU':_0x28aae8='https://accounts.zoho.eu';break;case'IN':_0x28aae8=_0xc5cb('0x1d');break;case'CN':_0x28aae8='https://accounts.zoho.com.cn';break;default:_0x28aae8=_0xc5cb('0x1e');break;}var _0x159f35={'method':_0xc5cb('0x1f'),'uri':_0x28aae8+'/oauth/v2/token','qs':{'refresh_token':_0x585648['refreshToken'],'client_id':_0x585648[_0xc5cb('0x20')],'client_secret':_0x585648['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x159f35)[_0xc5cb('0x21')](function(_0x24a02e){accountsTokens[_0x585648['id']]={'access_token':_0x24a02e[_0xc5cb('0x1b')],'expires_in':moment()[_0xc5cb('0x22')](_0x24a02e[_0xc5cb('0x23')],_0xc5cb('0x24'))};_0x156ce4(_0x24a02e[_0xc5cb('0x1b')]);})['catch'](function(_0x57dd34){logger[_0xc5cb('0x25')]('Failing\x20creating\x20the\x20access_token',_0x57dd34[_0xc5cb('0x26')]);_0x35c4f2(_0x57dd34);});});}function getUser(_0x3cbac5,_0x452787,_0x1f4566,_0x38e7f2){logger[_0xc5cb('0x27')](_0xc5cb('0x28'));return request({'method':_0xc5cb('0x29'),'uri':util[_0xc5cb('0x2a')]('https://www.zohoapis.%s/crm/v2/users',_0x452787),'qs':{'type':_0xc5cb('0x2b')},'headers':{'Authorization':_0xc5cb('0x2c')+_0x3cbac5},'json':!![]})[_0xc5cb('0x21')](function(_0x48a300){if(_0x48a300['users']){var _0x131afc=-0x1;if(_['isArrayLikeObject'](_0x48a300['users'])){if(!_[_0xc5cb('0x19')](_0x38e7f2)){_0x131afc=_['findIndex'](_0x48a300[_0xc5cb('0x2d')],function(_0x41ae19){return _0x41ae19['email']===_0x38e7f2;});}if(_0x131afc>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xc5cb('0x27')](_0xc5cb('0x2e'));_0x131afc=_[_0xc5cb('0x2f')](_0x48a300[_0xc5cb('0x2d')],function(_0x24f587){return _0x24f587[_0xc5cb('0x30')]['name']===_0xc5cb('0x31');});}return _0x48a300[_0xc5cb('0x2d')][_0x131afc];}else{if(_0x48a300[_0xc5cb('0x32')]['profile'][_0xc5cb('0x16')]===_0xc5cb('0x31')){logger[_0xc5cb('0x27')](_0xc5cb('0x2e'));user=_0x48a300[_0xc5cb('0x32')];return user;}else{logger[_0xc5cb('0x25')](_0xc5cb('0x33'),JSON[_0xc5cb('0x34')](_0x48a300));throw new Error(_0xc5cb('0x35')+JSON[_0xc5cb('0x34')](_0x48a300));}}}else{logger[_0xc5cb('0x25')](_0xc5cb('0x33'),JSON['stringify'](_0x48a300));throw new Error(_0xc5cb('0x35')+JSON[_0xc5cb('0x34')](_0x48a300));}})[_0xc5cb('0x36')](function(_0x1c384a){console[_0xc5cb('0x25')](_0x1c384a);});}function getZohoUser(_0x4f4e46,_0x21ee3c){return new BPromise(function(_0xae230d,_0x445bc8){request(_0x4f4e46)[_0xc5cb('0x21')](function(_0x2ffcba){var _0x4b1e0a=null;if(_0x2ffcba){_0x4b1e0a=_0x2ffcba['data'][0x0];_0x4b1e0a['enduserType']=_0x21ee3c;}_0xae230d(_0x4b1e0a);})[_0xc5cb('0x36')](function(_0x58d7fa){_0x445bc8(_0x58d7fa);});});}function createEndUser(_0x33c27b,_0x307a62,_0x2a1ae7,_0x457e83,_0x1d34b6,_0x2693b3){var _0x2a1ae7=getName(_0x2a1ae7);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x307a62+_0xc5cb('0x37')+_['startCase'](_0x2693b3[_0xc5cb('0x38')])+'s','body':{'data':[{'Last_Name':_0x2a1ae7[0x1],'First_Name':_0x2a1ae7[0x0],'Phone':_0x457e83,'Owner':{'name':!_[_0xc5cb('0x19')](_0x1d34b6[_0xc5cb('0x39')][_0xc5cb('0x16')])?_0x1d34b6[_0xc5cb('0x39')][_0xc5cb('0x16')]:!_[_0xc5cb('0x19')](_0x1d34b6[_0xc5cb('0x3a')])?_0x1d34b6[_0xc5cb('0x3a')]+'\x20'+_0x1d34b6[_0xc5cb('0x3b')]:_0x1d34b6['last_name'],'id':_0x1d34b6['id']}}]},'headers':{'Authorization':_0xc5cb('0x2c')+_0x33c27b},'json':!![]})['then'](function(_0x594fd7){if(_0x594fd7&&_0x594fd7[_0xc5cb('0x3c')][0x0][_0xc5cb('0x3d')]===_0xc5cb('0x3e')){var _0x2f77dc=_0x594fd7['data'][0x0][_0xc5cb('0x3f')];_0x2f77dc[_0xc5cb('0x40')]=_[_0xc5cb('0x41')](_0x2693b3['moduleCreate'])+'s';return _0x2f77dc;}logger[_0xc5cb('0x25')]('The\x20failing\x20result\x20is',JSON[_0xc5cb('0x34')](data));throw new Error(_0xc5cb('0x42')+JSON[_0xc5cb('0x34')](data));})[_0xc5cb('0x36')](function(_0xb5a141){console['log'](_0xc5cb('0x43'),_0xb5a141);});}function getEndUser(_0x235d6a,_0x375656,_0x465cd0,_0x1141f5,_0x476914,_0x5975e1,_0xd22589){var _0x2ee2b9={'method':_0xc5cb('0x29'),'uri':'','headers':{'Authorization':_0xc5cb('0x2c')+_0x235d6a},'json':!![]};switch(_0xd22589['moduleSearch']){case'contact_lead':_0x2ee2b9[_0xc5cb('0x44')]=_0xc5cb('0x45')+_0x375656+_0xc5cb('0x46')+_0x476914+'))';return getZohoUser(_0x2ee2b9,_0xc5cb('0x47'))['then'](function(_0x1b2a69){if(_0x1b2a69)return _0x1b2a69;_0x2ee2b9[_0xc5cb('0x44')]=_0xc5cb('0x45')+_0x375656+_0xc5cb('0x48')+_0x476914+'))';return getZohoUser(_0x2ee2b9,_0xc5cb('0x49'))[_0xc5cb('0x21')](function(_0xb79579){if(_0xb79579)return _0xb79579;if(_0xd22589[_0xc5cb('0x38')]!='nothing'){return createEndUser(_0x235d6a,_0x375656,_0x1141f5,_0x476914,_0x5975e1,_0xd22589);}else{return{};}});});break;case'contact':_0x2ee2b9[_0xc5cb('0x44')]=_0xc5cb('0x45')+_0x375656+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x476914+'))';return getZohoUser(_0x2ee2b9,_0xc5cb('0x47'))[_0xc5cb('0x21')](function(_0x43653a){if(_0x43653a)return _0x43653a;if(_0xd22589[_0xc5cb('0x38')]!=_0xc5cb('0x4a')){return createEndUser(_0x235d6a,_0x375656,_0x1141f5,_0x476914,_0x5975e1,_0xd22589);}else{return{};}});break;case _0xc5cb('0x4b'):_0x2ee2b9[_0xc5cb('0x44')]=_0xc5cb('0x45')+_0x375656+_0xc5cb('0x48')+_0x476914+'))';return getZohoUser(_0x2ee2b9,_0xc5cb('0x49'))[_0xc5cb('0x21')](function(_0x19c7d3){if(_0x19c7d3)return _0x19c7d3;if(_0xd22589['moduleCreate']!='nothing'){return createEndUser(_0x235d6a,_0x375656,_0x1141f5,_0x476914,_0x5975e1,_0xd22589);}else{return{};}});break;}}function getCall(_0x2d775c,_0x27ebdf,_0x446bda,_0x47840b,_0x31bca5,_0x3706c1,_0x3ae00e,_0x52a052){logger['info'](_0xc5cb('0x4c'));var _0x58969e={};_0x58969e[_0xc5cb('0x4d')]={'name':!_[_0xc5cb('0x19')](_0x47840b[_0xc5cb('0x39')]['name'])&&!_[_0xc5cb('0x19')](_0x47840b['profile'][_0xc5cb('0x16')])&&_0x47840b[_0xc5cb('0x30')][_0xc5cb('0x16')]==='administrator'?_0x47840b[_0xc5cb('0x39')]['name']:!_[_0xc5cb('0x19')](_0x47840b[_0xc5cb('0x3a')])?_0x47840b['first_name']+'\x20'+_0x47840b['last_name']:_0x47840b['last_name'],'id':_0x47840b['id']};_0x58969e[_0xc5cb('0x4e')]=intUtil[_0xc5cb('0x4f')](_0x3706c1[_0xc5cb('0x50')],_0x3ae00e,'\x20');_0x58969e[_0xc5cb('0x51')]=intUtil[_0xc5cb('0x4f')](_0x3706c1['Descriptions'],_0x3ae00e,'\x0a');if(_0x31bca5[_0xc5cb('0x40')]===_0xc5cb('0x47')){_0x58969e[_0xc5cb('0x52')]={'name':!_[_0xc5cb('0x19')](_0x31bca5[_0xc5cb('0x53')])?_0x31bca5[_0xc5cb('0x53')]:!_[_0xc5cb('0x19')](_0x31bca5[_0xc5cb('0x54')])?_0x31bca5[_0xc5cb('0x54')]+'\x20'+_0x31bca5['Last_Name']:_0x31bca5[_0xc5cb('0x55')],'id':_0x31bca5['id']};}if(_0x31bca5['enduserType']===_0xc5cb('0x49')){_0x58969e[_0xc5cb('0x56')]={'name':!_[_0xc5cb('0x19')](_0x31bca5[_0xc5cb('0x53')])?_0x31bca5[_0xc5cb('0x53')]:!_[_0xc5cb('0x19')](_0x31bca5['First_Name'])?_0x31bca5[_0xc5cb('0x54')]+'\x20'+_0x31bca5[_0xc5cb('0x55')]:_0x31bca5[_0xc5cb('0x55')],'id':_0x31bca5['id']};_0x58969e['$se_module']=_[_0xc5cb('0x41')](_0x31bca5[_0xc5cb('0x40')]);}if(_0x3ae00e[_0xc5cb('0x57')]){_0x58969e['Call_Duration']=moment[_0xc5cb('0x58')](parseInt(_0x3ae00e[_0xc5cb('0x57')])*0x3e8)[_0xc5cb('0x2a')](_0xc5cb('0x59'));}else if(_0x3ae00e[_0xc5cb('0x5a')]&&_0x3ae00e['endtime']){_0x58969e['Call_Duration']=moment['utc'](moment(_0x3ae00e[_0xc5cb('0x5b')],_0xc5cb('0x5c'))[_0xc5cb('0x5d')](moment(_0x3ae00e['starttime'],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x3ae00e[_0xc5cb('0x5e')]){case'called':_0x58969e['Call_Result']=_0xc5cb('0x5f');break;case _0xc5cb('0x60'):case _0xc5cb('0x61'):_0x58969e[_0xc5cb('0x62')]=_0xc5cb('0x63');break;case _0xc5cb('0x64'):_0x58969e[_0xc5cb('0x62')]=_0xc5cb('0x65');break;case _0xc5cb('0x66'):_0x58969e[_0xc5cb('0x62')]=_0xc5cb('0x67');break;case _0xc5cb('0x68'):_0x58969e[_0xc5cb('0x62')]=_0xc5cb('0x69');default:}_0x58969e[_0xc5cb('0x6a')]=(_0x52a052===_0xc5cb('0x6b')?moment(_0x3ae00e['starttime'])[_0xc5cb('0x2a')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3ae00e['agentcalledAt'])['format'](_0xc5cb('0x5c')))||moment()[_0xc5cb('0x2a')](_0xc5cb('0x5c'));_0x58969e[_0xc5cb('0x6c')]=_0x52a052||_0xc5cb('0x6d');_0x58969e=_[_0xc5cb('0x6e')](_0x58969e,getCustomFields(_0x3706c1[_0xc5cb('0x6f')],_0x3ae00e));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x27ebdf+_0xc5cb('0x70'),'headers':{'Authorization':_0xc5cb('0x2c')+_0x2d775c},'body':{'data':[_0x58969e]},'json':!![]})['then'](function(_0x5822de){if(_0x5822de&&_0x5822de[_0xc5cb('0x3c')][0x0][_0xc5cb('0x3d')]===_0xc5cb('0x3e')){logger[_0xc5cb('0x27')](_0xc5cb('0x71'));return{'id':_0x5822de[_0xc5cb('0x3c')][0x0]['details']['id']};}})['catch'](function(_0x49fa24){logger[_0xc5cb('0x27')](_0xc5cb('0x72'),_0x49fa24[_0xc5cb('0x26')]);console[_0xc5cb('0x73')](_0xc5cb('0x72'),_0x49fa24);});}exports['queue']=function(_0x533742,_0x544aca,_0x2951f4,_0x28bd92,_0x1f3e25,_0x45498){var _0x4cce39,_0x37deb7,_0x50ac09;_0x45498['host']=intUtil[_0xc5cb('0x74')](_0x45498[_0xc5cb('0x75')]);_0x45498['serverUrl']=intUtil['stripTrailingSlash'](_0x45498[_0xc5cb('0x76')]);if(_0x1f3e25&&_0x1f3e25['monitor_format']){logger[_0xc5cb('0x27')](_0xc5cb('0x77'),_0xc5cb('0x78'));_0x544aca['recordingURL']=_0x45498[_0xc5cb('0x76')]+_0xc5cb('0x79')+_0x544aca['uniqueid']+_0xc5cb('0x7a')+md5(_0x544aca[_0xc5cb('0x7b')]);}else{_0x544aca['recordingURL']='';}var _0x44c7c7=_0x45498[_0xc5cb('0x75')]===_0xc5cb('0x7c')?'eu':'com';return getAccessToken(_0x45498)['then'](function(_0x14a4ce){_0x50ac09=_0x14a4ce;return getUser(_0x50ac09,_0x44c7c7,_0x45498,_0x28bd92['email']);})['then'](function(_0x7f6867){_0x4cce39=_0x7f6867;logger['info'](_0xc5cb('0x7d'),_0x4cce39['id']);return getEndUser(_0x50ac09,_0x44c7c7,_0x45498,_0x544aca[_0xc5cb('0x7e')],_0x544aca[_0xc5cb('0x7f')],_0x4cce39,_0x2951f4);})[_0xc5cb('0x21')](function(_0x15fe5f){_0x37deb7=_0x15fe5f;return getCall(_0x50ac09,_0x44c7c7,_0x45498,_0x4cce39,_0x37deb7,_0x2951f4,_0x544aca,_0xc5cb('0x6d'));})[_0xc5cb('0x21')](function(_0x5b10e1){if(_0x5b10e1){logger[_0xc5cb('0x27')](_0xc5cb('0x80'),_0x5b10e1['id']);logger[_0xc5cb('0x27')](_0xc5cb('0x77'),_0xc5cb('0x81'));emit(util['format'](_0xc5cb('0x82'),_0x28bd92['name']),'trigger:browser:url',{'uri':_0xc5cb('0x83')+_0x45498['host']+_0xc5cb('0x84')+_0x5b10e1['id']});}})[_0xc5cb('0x36')](function(_0x4e6b9d){logger[_0xc5cb('0x25')](_0xc5cb('0x77'),JSON[_0xc5cb('0x34')](_0x4e6b9d));});};exports[_0xc5cb('0x6b')]=function(_0x2bcd9a,_0x1736b4,_0x50868c,_0x28605a,_0x504bf8,_0x241c98,_0x1c80c9){var _0x45b809,_0x36d75d,_0x2c680c;_0x241c98[_0xc5cb('0x75')]=intUtil[_0xc5cb('0x74')](_0x241c98[_0xc5cb('0x75')]);_0x241c98['serverUrl']=intUtil[_0xc5cb('0x74')](_0x241c98['serverUrl']);if(_0x1c80c9&&_0x1c80c9[_0xc5cb('0x85')]&&_0x1c80c9[_0xc5cb('0x85')]!==_0xc5cb('0x86')){logger[_0xc5cb('0x27')]('[OUTBOUND]',_0xc5cb('0x78'));_0x1736b4['recordingURL']=_0x241c98[_0xc5cb('0x76')]+_0xc5cb('0x79')+_0x1736b4[_0xc5cb('0x7b')]+_0xc5cb('0x7a')+md5(_0x1736b4[_0xc5cb('0x7b')]);}var _0x1bafa3=_0x241c98[_0xc5cb('0x75')]==='zoho.eu'?'eu':_0xc5cb('0x87');return getAccessToken(_0x241c98)[_0xc5cb('0x21')](function(_0x3342a4){_0x2c680c=_0x3342a4;return getUser(_0x2c680c,_0x1bafa3,_0x241c98,_0x28605a[_0xc5cb('0x88')]);})[_0xc5cb('0x21')](function(_0x31e5b2){_0x45b809=_0x31e5b2;logger[_0xc5cb('0x27')](_0xc5cb('0x7d'),_0x45b809['id']);return getEndUser(_0x2c680c,_0x1bafa3,_0x241c98,_0x1736b4[_0xc5cb('0x89')],_0x1736b4[_0xc5cb('0x8a')],_0x45b809,_0x50868c);})[_0xc5cb('0x21')](function(_0x49ee65){_0x36d75d=_0x49ee65;return getCall(_0x2c680c,_0x1bafa3,_0x241c98,_0x45b809,_0x36d75d,_0x50868c,_0x1736b4,_0xc5cb('0x8b'));})['then'](function(_0x3ec37c){if(_0x3ec37c){logger['info'](_0xc5cb('0x80'),_0x3ec37c['id']);logger['info']('[OUTBOUND]',_0xc5cb('0x81'));emit(util['format'](_0xc5cb('0x82'),_0x28605a[_0xc5cb('0x16')]),_0xc5cb('0x8c'),{'uri':_0xc5cb('0x83')+_0x241c98[_0xc5cb('0x75')]+_0xc5cb('0x84')+_0x3ec37c['id']});}})['catch'](function(_0x3597e6){logger['error'](_0xc5cb('0x8d'),JSON[_0xc5cb('0x34')](_0x3597e6));});};exports[_0xc5cb('0x8e')]=function(_0x52e0ef,_0x198d96,_0x227c27,_0x1c7565,_0x2b5c21,_0xaf77f7){var _0x5e155c,_0x513707,_0x24d407;_0xaf77f7[_0xc5cb('0x75')]=intUtil[_0xc5cb('0x74')](_0xaf77f7['host']);_0xaf77f7[_0xc5cb('0x76')]=intUtil[_0xc5cb('0x74')](_0xaf77f7[_0xc5cb('0x76')]);if(_0x2b5c21&&_0x2b5c21[_0xc5cb('0x8f')]){logger[_0xc5cb('0x27')]('['+_0x198d96[_0xc5cb('0x5e')]['toUpperCase']()+']',_0xc5cb('0x78'));_0x198d96[_0xc5cb('0x90')]=_0xaf77f7[_0xc5cb('0x76')]+_0xc5cb('0x79')+_0x198d96[_0xc5cb('0x7b')]+'/downloads?type=uniqueid&token='+md5(_0x198d96['uniqueid']);}else{_0x198d96[_0xc5cb('0x90')]='';}var _0x3b58ed=_0xaf77f7['host']==='zoho.eu'?'eu':_0xc5cb('0x87');return getAccessToken(_0xaf77f7)[_0xc5cb('0x21')](function(_0x124ff7){_0x24d407=_0x124ff7;return getUser(_0x24d407,_0x3b58ed,_0xaf77f7);})[_0xc5cb('0x21')](function(_0x160764){_0x5e155c=_0x160764;logger['info']('The\x20User\x20ID\x20is:',_0x5e155c['id']);return getEndUser(_0x24d407,_0x3b58ed,_0xaf77f7,_0x198d96[_0xc5cb('0x7e')],_0x198d96[_0xc5cb('0x7f')],_0x5e155c,_0x227c27);})[_0xc5cb('0x21')](function(_0x521088){_0x513707=_0x521088;return getCall(_0x24d407,_0x3b58ed,_0xaf77f7,_0x5e155c,_0x513707,_0x227c27,_0x198d96,'Inbound');})[_0xc5cb('0x21')](function(_0x4812af){if(_0x4812af){logger['info'](_0xc5cb('0x80'),_0x4812af['id']);}})[_0xc5cb('0x36')](function(_0x3ebdc4){logger['error']('['+_0x198d96[_0xc5cb('0x5e')][_0xc5cb('0x91')]()+']',JSON[_0xc5cb('0x34')](_0x3ebdc4));});}; \ 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 9f7c495..7634272 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 _0x0a57=['data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','trigger','exec'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0a57,0xd4));var _0x70a5=function(_0x47f028,_0x14f19d){_0x47f028=_0x47f028-0x0;var _0x4ca978=_0x0a57[_0x47f028];return _0x4ca978;};'use strict';var util=require('util');var sh=require(_0x70a5('0x0'));var Mustache=require(_0x70a5('0x1'));var logger=require('../../../../config/logger')(_0x70a5('0x2'));exports[_0x70a5('0x3')]=function(_0x2a2298,_0x4c4e23){var _0x38f684=_0x2a2298[_0x70a5('0x4')]?_0x2a2298[_0x70a5('0x4')]:_0x70a5('0x5');var _0x44da35=_0x2a2298[_0x70a5('0x6')]?Mustache['render'](_0x2a2298['data3'],_0x4c4e23):_0x4c4e23;sh['exec'](_0x44da35,function(_0x1cb010,_0x311ec4,_0x2ae8d4){if(_0x1cb010!==0x0){logger[_0x70a5('0x7')](util[_0x70a5('0x8')](_0x70a5('0x9'),_0x38f684,_0x44da35,_0x1cb010,_0x2ae8d4));}else{logger[_0x70a5('0xa')](util[_0x70a5('0x8')](_0x70a5('0xb'),_0x38f684,_0x44da35,_0x311ec4));}});}; \ No newline at end of file +var _0xce3d=['exec','data2','render','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger'];(function(_0x4837f8,_0x15255b){var _0x40f70b=function(_0x546074){while(--_0x546074){_0x4837f8['push'](_0x4837f8['shift']());}};_0x40f70b(++_0x15255b);}(_0xce3d,0x17e));var _0xdce3=function(_0x5c879e,_0xe58074){_0x5c879e=_0x5c879e-0x0;var _0x30942b=_0xce3d[_0x5c879e];return _0x30942b;};'use strict';var util=require(_0xdce3('0x0'));var sh=require('shelljs');var Mustache=require(_0xdce3('0x1'));var logger=require(_0xdce3('0x2'))('trigger');exports[_0xdce3('0x3')]=function(_0x4304b9,_0x18b2cc){var _0x2516bb=_0x4304b9[_0xdce3('0x4')]?_0x4304b9[_0xdce3('0x4')]:'Script';var _0x265ba0=_0x4304b9['data3']?Mustache[_0xdce3('0x5')](_0x4304b9[_0xdce3('0x6')],_0x18b2cc):_0x18b2cc;sh['exec'](_0x265ba0,function(_0x5c3a4c,_0xab8288,_0x408eaa){if(_0x5c3a4c!==0x0){logger[_0xdce3('0x7')](util['format'](_0xdce3('0x8'),_0x2516bb,_0x265ba0,_0x5c3a4c,_0x408eaa));}else{logger[_0xdce3('0x9')](util['format'](_0xdce3('0xa'),_0x2516bb,_0x265ba0,_0xab8288));}});}; \ 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 312b6af..7cdaa95 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 _0x8f37=['isNil','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','name','message','request-promise','../../../../config/logger','trigger','exec','data1','data2','data5','headers','render','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7','parse','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then'];(function(_0x329c3b,_0x373190){var _0x26a8f4=function(_0x8df95a){while(--_0x8df95a){_0x329c3b['push'](_0x329c3b['shift']());}};_0x26a8f4(++_0x373190);}(_0x8f37,0x1c8));var _0x78f3=function(_0x460fa3,_0x2331e0){_0x460fa3=_0x460fa3-0x0;var _0x362564=_0x8f37[_0x460fa3];return _0x362564;};'use strict';var rp=require(_0x78f3('0x0'));var util=require('util');var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x78f3('0x1'))(_0x78f3('0x2'));exports[_0x78f3('0x3')]=function(_0x758235,_0x390600){var _0x2d5d40,_0x32c921;var _0x8f6f03={'method':_0x758235[_0x78f3('0x4')]['toUpperCase'](),'uri':Mustache['render'](_0x758235[_0x78f3('0x5')],_0x390600),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x758235[_0x78f3('0x6')])==='number'&&parseInt(_0x758235['data5'])>=0x1&&parseInt(_0x758235[_0x78f3('0x6')])<=0xa?parseInt(_0x758235[_0x78f3('0x6')])*0x3e8:0x5*0x3e8};try{_0x8f6f03[_0x78f3('0x7')]=_0x758235['data6']?JSON['parse'](Mustache[_0x78f3('0x8')](_0x758235['data6'],_0x390600)):{};}catch(_0x4a84ce){logger[_0x78f3('0x9')](_0x4a84ce[_0x78f3('0xa')]);}switch(_0x758235[_0x78f3('0x4')][_0x78f3('0xb')]()){case _0x78f3('0xc'):case _0x78f3('0xd'):_0x2d5d40=null;_0x8f6f03['qs']=_0x390600;break;case _0x78f3('0xe'):case _0x78f3('0xf'):if(_0x758235[_0x78f3('0x10')]){try{_0x2d5d40=JSON[_0x78f3('0x11')](Mustache[_0x78f3('0x8')](_0x758235['data7'],_0x390600));_0x8f6f03['body']=_0x2d5d40;}catch(_0x538429){logger[_0x78f3('0x9')](_0x538429['stack']);logger[_0x78f3('0x9')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2d5d40=_0x390600;_0x8f6f03[_0x78f3('0x12')]=_0x2d5d40;}break;}logger[_0x78f3('0x13')](util[_0x78f3('0x14')](_0x78f3('0x15'),_0x758235['data1'],_0x758235[_0x78f3('0x5')],JSON[_0x78f3('0x16')](_0x8f6f03)));rp(_0x8f6f03)[_0x78f3('0x17')](function(_0x44cc29){_0x2d5d40=!_[_0x78f3('0x18')](_0x2d5d40)?',\x20request\x20body:\x20'+_0x2d5d40:'';_0x32c921=typeof _0x44cc29[_0x78f3('0x12')]===_0x78f3('0x19')?JSON[_0x78f3('0x16')](_0x44cc29[_0x78f3('0x12')]):_0x44cc29['body'];logger[_0x78f3('0x13')](util[_0x78f3('0x14')](_0x78f3('0x1a'),_0x758235[_0x78f3('0x4')],_0x758235[_0x78f3('0x5')],_0x44cc29[_0x78f3('0x1b')],_0x32c921));})[_0x78f3('0x1c')](function(_0x419cee){logger['error'](util[_0x78f3('0x14')](_0x78f3('0x1d'),_0x758235[_0x78f3('0x4')],_0x758235[_0x78f3('0x5')],_0x419cee['statusCode'],_0x419cee[_0x78f3('0x1e')],_0x419cee[_0x78f3('0x1f')]));});}; \ No newline at end of file +var _0xa9f7=['data7','parse','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','data5','number','headers','render','data6','stack','GET'];(function(_0x4e825c,_0x935119){var _0x3f94ab=function(_0x4669ea){while(--_0x4669ea){_0x4e825c['push'](_0x4e825c['shift']());}};_0x3f94ab(++_0x935119);}(_0xa9f7,0x145));var _0x7a9f=function(_0x20abeb,_0xd05d05){_0x20abeb=_0x20abeb-0x0;var _0x4ce008=_0xa9f7[_0x20abeb];return _0x4ce008;};'use strict';var rp=require(_0x7a9f('0x0'));var util=require(_0x7a9f('0x1'));var _=require(_0x7a9f('0x2'));var Mustache=require(_0x7a9f('0x3'));var logger=require(_0x7a9f('0x4'))('trigger');exports[_0x7a9f('0x5')]=function(_0x379c9b,_0x26b721){var _0x59f674,_0x1acae6;var _0x56d3c6={'method':_0x379c9b[_0x7a9f('0x6')][_0x7a9f('0x7')](),'uri':Mustache['render'](_0x379c9b['data2'],_0x26b721),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x379c9b[_0x7a9f('0x8')])===_0x7a9f('0x9')&&parseInt(_0x379c9b[_0x7a9f('0x8')])>=0x1&&parseInt(_0x379c9b[_0x7a9f('0x8')])<=0xa?parseInt(_0x379c9b[_0x7a9f('0x8')])*0x3e8:0x5*0x3e8};try{_0x56d3c6[_0x7a9f('0xa')]=_0x379c9b['data6']?JSON['parse'](Mustache[_0x7a9f('0xb')](_0x379c9b[_0x7a9f('0xc')],_0x26b721)):{};}catch(_0x21d59e){logger['error'](_0x21d59e[_0x7a9f('0xd')]);}switch(_0x379c9b[_0x7a9f('0x6')][_0x7a9f('0x7')]()){case _0x7a9f('0xe'):case'DELETE':_0x59f674=null;_0x56d3c6['qs']=_0x26b721;break;case'POST':case'PUT':if(_0x379c9b[_0x7a9f('0xf')]){try{_0x59f674=JSON[_0x7a9f('0x10')](Mustache[_0x7a9f('0xb')](_0x379c9b['data7'],_0x26b721));_0x56d3c6[_0x7a9f('0x11')]=_0x59f674;}catch(_0x187cab){logger['error'](_0x187cab[_0x7a9f('0xd')]);logger[_0x7a9f('0x12')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x59f674=_0x26b721;_0x56d3c6[_0x7a9f('0x11')]=_0x59f674;}break;}logger[_0x7a9f('0x13')](util[_0x7a9f('0x14')](_0x7a9f('0x15'),_0x379c9b[_0x7a9f('0x6')],_0x379c9b[_0x7a9f('0x16')],JSON['stringify'](_0x56d3c6)));rp(_0x56d3c6)[_0x7a9f('0x17')](function(_0x2d6e0b){_0x59f674=!_[_0x7a9f('0x18')](_0x59f674)?_0x7a9f('0x19')+_0x59f674:'';_0x1acae6=typeof _0x2d6e0b[_0x7a9f('0x11')]===_0x7a9f('0x1a')?JSON[_0x7a9f('0x1b')](_0x2d6e0b[_0x7a9f('0x11')]):_0x2d6e0b[_0x7a9f('0x11')];logger[_0x7a9f('0x13')](util[_0x7a9f('0x14')](_0x7a9f('0x1c'),_0x379c9b[_0x7a9f('0x6')],_0x379c9b[_0x7a9f('0x16')],_0x2d6e0b[_0x7a9f('0x1d')],_0x1acae6));})[_0x7a9f('0x1e')](function(_0x2fee05){logger[_0x7a9f('0x12')](util[_0x7a9f('0x14')](_0x7a9f('0x1f'),_0x379c9b[_0x7a9f('0x6')],_0x379c9b[_0x7a9f('0x16')],_0x2fee05['statusCode'],_0x2fee05[_0x7a9f('0x20')],_0x2fee05[_0x7a9f('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 84b3546..a4bf504 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 _0xb05d=['routing','http','Request','request','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger'];(function(_0x586b59,_0x3fb6ed){var _0x46a605=function(_0x4d8d9a){while(--_0x4d8d9a){_0x586b59['push'](_0x586b59['shift']());}};_0x46a605(++_0x3fb6ed);}(_0xb05d,0xd6));var _0xdb05=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xb05d[_0x35c5a8];return _0x34782c;};'use strict';var jayson=require(_0xdb05('0x0'));var BPromise=require('bluebird');var logger=require(_0xdb05('0x1'))(_0xdb05('0x2'));var client=jayson['client'][_0xdb05('0x3')]({'port':0x2329});client[_0xdb05('0x4')]=function(_0x1db452,_0x4d643b){return new BPromise(function(_0x3c68cd,_0x4eed59){return client[_0xdb05('0x5')](_0x1db452,_0x4d643b)['then'](function(_0x4fd473){logger['debug'](_0xdb05('0x6'),_0xdb05('0x2'),_0x1db452,_0x4d643b,_0x4fd473);if(_0x4fd473['error']){logger['error'](_0xdb05('0x6'),_0xdb05('0x2'),_0x1db452,_0x4fd473[_0xdb05('0x7')][_0xdb05('0x8')],_0x4d643b);return _0x4eed59(_0x4fd473['error'][_0xdb05('0x8')]);}else{return _0x3c68cd(_0x4fd473[_0xdb05('0x9')]);}})[_0xdb05('0xa')](function(_0x1c059d){logger[_0xdb05('0x7')](_0xdb05('0x6'),_0xdb05('0x2'),_0x1db452,_0x1c059d,_0x4d643b);return _0x4eed59(_0x1c059d);});});};module[_0xdb05('0xb')]=client; \ No newline at end of file +var _0x779d=['../../config/logger','client','http','then','debug','rpc','routing','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0x779d,0xce));var _0xd779=function(_0x52d8f4,_0x30b3d9){_0x52d8f4=_0x52d8f4-0x0;var _0xb4d91a=_0x779d[_0x52d8f4];return _0xb4d91a;};'use strict';var jayson=require(_0xd779('0x0'));var BPromise=require(_0xd779('0x1'));var logger=require(_0xd779('0x2'))('routing');var client=jayson[_0xd779('0x3')][_0xd779('0x4')]({'port':0x2329});client['Request']=function(_0x127bf9,_0x478dcd){return new BPromise(function(_0x5f01a1,_0x719403){return client['request'](_0x127bf9,_0x478dcd)[_0xd779('0x5')](function(_0x33d4c4){logger[_0xd779('0x6')](_0xd779('0x7'),_0xd779('0x8'),_0x127bf9,_0x478dcd,_0x33d4c4);if(_0x33d4c4['error']){logger[_0xd779('0x9')](_0xd779('0x7'),'routing',_0x127bf9,_0x33d4c4[_0xd779('0x9')][_0xd779('0xa')],_0x478dcd);return _0x719403(_0x33d4c4[_0xd779('0x9')]['message']);}else{return _0x5f01a1(_0x33d4c4['result']);}})[_0xd779('0xb')](function(_0x3c8c36){logger['error'](_0xd779('0x7'),_0xd779('0x8'),_0x127bf9,_0x3c8c36,_0x478dcd);return _0x719403(_0x3c8c36);});});};module[_0xd779('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index b14fd7f..7a350f9 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 _0x7c0f=['error','Email\x20service\x20initialization','./server','./lib/email','./rpc/setting','email','getMailAccounts','then','initMailAccounts','listen','getSettings','catch'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7c0f,0x116));var _0xf7c0=function(_0x57648c,_0x1a9b0d){_0x57648c=_0x57648c-0x0;var _0x5651e2=_0x7c0f[_0x57648c];return _0x5651e2;};'use strict';var server=require(_0xf7c0('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xf7c0('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xf7c0('0x2'));var logger=require('../../config/logger')(_0xf7c0('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0xf7c0('0x4')]())[_0xf7c0('0x5')](realtime[_0xf7c0('0x6')]())[_0xf7c0('0x5')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xf7c0('0x7')](realtime,email)[_0xf7c0('0x5')](function(){return initRealtime();})[_0xf7c0('0x5')](function(){return setting[_0xf7c0('0x8')]();})[_0xf7c0('0x5')](function(_0x47f698){return setInterval(initRealtime,_0x47f698['loginMailFrequency']*0x3e8);})[_0xf7c0('0x9')](function(_0x1a72ac){logger[_0xf7c0('0xa')](_0xf7c0('0xb'),_0x1a72ac);});}main(); \ No newline at end of file +var _0x7988=['mailAccounts','getSettings','loginMailFrequency','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','refresh'];(function(_0x277ed4,_0x374a8b){var _0x63b575=function(_0x30e81b){while(--_0x30e81b){_0x277ed4['push'](_0x277ed4['shift']());}};_0x63b575(++_0x374a8b);}(_0x7988,0xf5));var _0x8798=function(_0x3edead,_0x35df0b){_0x3edead=_0x3edead-0x0;var _0x8e103f=_0x7988[_0x3edead];return _0x8e103f;};'use strict';var server=require(_0x8798('0x0'));var Realtime=require(_0x8798('0x1'));var EmailChannel=require(_0x8798('0x2'));var mailAccount=require(_0x8798('0x3'));var setting=require(_0x8798('0x4'));var logger=require(_0x8798('0x5'))(_0x8798('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8798('0x7')]()[_0x8798('0x8')](mailAccount['getMailAccounts']())[_0x8798('0x8')](realtime['initMailAccounts']())['then'](function(){email[_0x8798('0x9')](realtime[_0x8798('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8798('0x8')](function(){return initRealtime();})[_0x8798('0x8')](function(){return setting[_0x8798('0xb')]();})[_0x8798('0x8')](function(_0x6c69b1){return setInterval(initRealtime,_0x6c69b1[_0x8798('0xc')]*0x3e8);})[_0x8798('0xd')](function(_0x37b408){logger[_0x8798('0xe')]('Email\x20service\x20initialization',_0x37b408);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 671f539..3e281ac 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 _0xc776=['handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','handleImapBox','bind','end','handleImapEnd','error','status','disabled','messageStatus','connected','messages'];(function(_0x5b5188,_0x47aa21){var _0x28292e=function(_0x11427f){while(--_0x11427f){_0x5b5188['push'](_0x5b5188['shift']());}};_0x28292e(++_0x47aa21);}(_0xc776,0x80));var _0x6c77=function(_0x4d84ce,_0x249c37){_0x4d84ce=_0x4d84ce-0x0;var _0x4bdbb4=_0xc776[_0x4d84ce];return _0x4bdbb4;};'use strict';var _=require(_0x6c77('0x0'));var moment=require(_0x6c77('0x1'));var BPromise=require(_0x6c77('0x2'));var md5=require(_0x6c77('0x3'));var Redis=require(_0x6c77('0x4'));var config=require(_0x6c77('0x5'));var logger=require(_0x6c77('0x6'))(_0x6c77('0x7'));config[_0x6c77('0x8')]=_['defaults'](config['redis'],{'host':_0x6c77('0x9'),'port':0x18eb});var io=require(_0x6c77('0xa'))(new Redis(config[_0x6c77('0x8')]));var EmailImap=require(_0x6c77('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x6c77('0xc'));var md5Accounts={};function EmailChannel(_0x1f9401){logger[_0x6c77('0xd')](_0x6c77('0xe'));this[_0x6c77('0xf')]=_0x1f9401[_0x6c77('0xf')];this[_0x6c77('0x10')]={};this[_0x6c77('0x11')]=new EmailSmtp();}EmailChannel[_0x6c77('0x12')][_0x6c77('0x13')]=function(_0x51754){var _0x40bff5=this[_0x6c77('0xf')][_0x51754];var _0x502e66={'id':_0x40bff5['id'],'name':_0x40bff5[_0x6c77('0x14')],'key':_0x40bff5[_0x6c77('0x15')],'active':_0x40bff5[_0x6c77('0x16')],'Imap':{'status':_0x40bff5[_0x6c77('0x17')]['status'],'messageStatus':_0x40bff5['Imap']['messageStatus'],'total':_0x40bff5[_0x6c77('0x17')][_0x6c77('0x18')]}};if(_[_0x6c77('0x19')](md5Accounts[_0x51754])){md5Accounts[_0x51754]={};}var _0x4f144f=md5(JSON[_0x6c77('0x1a')](_0x502e66));if(md5Accounts[_0x51754][_0x6c77('0x3')]!==_0x4f144f){md5Accounts[_0x51754]['md5']=_0x4f144f;io[_0x6c77('0x13')](_0x6c77('0x1b'),_0x502e66);}};EmailChannel[_0x6c77('0x12')][_0x6c77('0x1c')]=function(_0x1ba24e){for(var _0x4abdad in _0x1ba24e){if(_0x1ba24e[_0x6c77('0x1d')](_0x4abdad)){if(_0x1ba24e[_0x4abdad][_0x6c77('0x17')]&&_0x1ba24e[_0x4abdad]['active']){var _0x5572f5=_0x1ba24e[_0x4abdad][_0x6c77('0x17')];if(!_0x5572f5[_0x6c77('0x1e')]&&_0x1ba24e[_0x4abdad][_0x6c77('0x1f')]!==_0x6c77('0x20'))_0x5572f5[_0x6c77('0x1e')]=_0x1ba24e[_0x4abdad][_0x6c77('0x1f')];if(!this['imapAccounts'][_0x6c77('0x1d')](_0x5572f5['id'])){this[_0x6c77('0x10')][_0x5572f5['id']]=new EmailImap(_0x5572f5,_0x1ba24e[_0x4abdad][_0x6c77('0x7')]);this['imapAccounts'][_0x5572f5['id']]['on']('box',this[_0x6c77('0x21')]['bind'](this,_0x4abdad));this[_0x6c77('0x10')][_0x5572f5['id']]['on'](_0x6c77('0x7'),this['handleImapEmail'][_0x6c77('0x22')](this,_0x4abdad));this[_0x6c77('0x10')][_0x5572f5['id']]['on'](_0x6c77('0x23'),this[_0x6c77('0x24')]['bind'](this,_0x4abdad));this[_0x6c77('0x10')][_0x5572f5['id']]['on'](_0x6c77('0x25'),this['handleImapError'][_0x6c77('0x22')](this,_0x4abdad));}}else{if(_['isNil'](this[_0x6c77('0xf')][_0x4abdad][_0x6c77('0x17')])){this[_0x6c77('0xf')][_0x4abdad][_0x6c77('0x17')]={};}this[_0x6c77('0xf')][_0x4abdad][_0x6c77('0x17')][_0x6c77('0x26')]=_0x6c77('0x27');this[_0x6c77('0xf')][_0x4abdad][_0x6c77('0x17')][_0x6c77('0x28')]='';this[_0x6c77('0x13')](_0x4abdad);}}}};EmailChannel[_0x6c77('0x12')][_0x6c77('0x21')]=function(_0x301c4b,_0x31c204){if(this[_0x6c77('0xf')][_0x301c4b]){this[_0x6c77('0xf')][_0x301c4b][_0x6c77('0x17')][_0x6c77('0x26')]=_0x6c77('0x29');this[_0x6c77('0xf')][_0x301c4b][_0x6c77('0x17')][_0x6c77('0x28')]=_0x31c204['name'];if(_0x31c204[_0x6c77('0x2a')]){this['mailAccounts'][_0x301c4b][_0x6c77('0x17')]['total']=_0x31c204[_0x6c77('0x2a')][_0x6c77('0x18')];}return this[_0x6c77('0x13')](_0x301c4b);}};EmailChannel[_0x6c77('0x12')][_0x6c77('0x2b')]=function(_0x52007a,_0x2fb1d9){logger[_0x6c77('0xd')](_0x6c77('0x2c'),_0x2fb1d9['firstName'],_0x2fb1d9['lastName'],_0x2fb1d9[_0x6c77('0x2d')],_0x52007a);if(this[_0x6c77('0xf')][_0x52007a]){return mailAccount[_0x6c77('0x2e')](_0x52007a,_0x2fb1d9)[_0x6c77('0x2f')](function(_0x2d4627){if(_0x2d4627){logger[_0x6c77('0xd')](_0x6c77('0x30'));}})[_0x6c77('0x31')](function(_0x264ddd){logger[_0x6c77('0x25')](_0x6c77('0x32'),JSON[_0x6c77('0x1a')](_0x264ddd));});}};EmailChannel[_0x6c77('0x12')]['handleImapEnd']=function(_0xb2417f){if(this[_0x6c77('0xf')][_0xb2417f]&&this[_0x6c77('0xf')][_0xb2417f]['Imap']){if(this['imapAccounts'][this[_0x6c77('0xf')][_0xb2417f][_0x6c77('0x17')]['id']]){delete this[_0x6c77('0x10')][this[_0x6c77('0xf')][_0xb2417f][_0x6c77('0x17')]['id']];}this[_0x6c77('0xf')][_0xb2417f][_0x6c77('0x17')][_0x6c77('0x33')]=moment();this[_0x6c77('0x13')](_0xb2417f);}};EmailChannel[_0x6c77('0x12')]['handleImapError']=function(_0x2cb127,_0x185a49){if(this[_0x6c77('0xf')][_0x2cb127]){this[_0x6c77('0xf')][_0x2cb127][_0x6c77('0x17')][_0x6c77('0x26')]=_0x6c77('0x25');this[_0x6c77('0xf')][_0x2cb127][_0x6c77('0x17')][_0x6c77('0x28')]=_0x185a49;return this[_0x6c77('0x13')](_0x2cb127);}};EmailChannel['prototype'][_0x6c77('0x34')]=function(_0x510210,_0x458e0b){return this[_0x6c77('0x11')]['send'](_0x510210,_0x458e0b);};EmailChannel[_0x6c77('0x12')][_0x6c77('0x35')]=function(_0x54793e){var _0x522bd9=this;if(this[_0x6c77('0xf')][_0x54793e['id']]){if(_[_0x6c77('0x19')](this[_0x6c77('0xf')][_0x54793e['id']][_0x6c77('0x36')])){this['mailAccounts'][_0x54793e['id']][_0x6c77('0x36')]={};}this[_0x6c77('0xf')][_0x54793e['id']]['Smtp'][_0x6c77('0x33')]=moment();return new BPromise(function(_0x44edeb,_0x3670ee){return _0x522bd9[_0x6c77('0x11')][_0x6c77('0x37')](_0x54793e)[_0x6c77('0x2f')](function(_0x43e45d){_0x522bd9[_0x6c77('0xf')][_0x54793e['id']][_0x6c77('0x36')]['status']='verified';_0x522bd9[_0x6c77('0xf')][_0x54793e['id']][_0x6c77('0x36')]['messageStatus']='';_0x522bd9[_0x6c77('0x13')](_0x54793e['id']);_0x44edeb(_0x43e45d);})[_0x6c77('0x31')](function(_0x5ec60b){_0x522bd9[_0x6c77('0xf')][_0x54793e['id']][_0x6c77('0x36')][_0x6c77('0x26')]=_0x6c77('0x25');_0x522bd9[_0x6c77('0xf')][_0x54793e['id']][_0x6c77('0x36')][_0x6c77('0x28')]=_0x5ec60b;_0x522bd9[_0x6c77('0x13')](_0x54793e['id']);_0x3670ee(_0x5ec60b);});});}return this['smtp'][_0x6c77('0x37')](_0x54793e);};module[_0x6c77('0x38')]=EmailChannel; \ No newline at end of file +var _0x2a79=['Smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','name','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','disabled','emit','status','connected','messages','info','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','lastSync','handleImapError','sendMail','send','verifySmtp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a79,0xb4));var _0x92a7=function(_0x2edd29,_0x4cea5b){_0x2edd29=_0x2edd29-0x0;var _0x56a7de=_0x2a79[_0x2edd29];return _0x56a7de;};'use strict';var _=require(_0x92a7('0x0'));var moment=require(_0x92a7('0x1'));var BPromise=require(_0x92a7('0x2'));var md5=require(_0x92a7('0x3'));var Redis=require(_0x92a7('0x4'));var config=require(_0x92a7('0x5'));var logger=require(_0x92a7('0x6'))(_0x92a7('0x7'));config[_0x92a7('0x8')]=_[_0x92a7('0x9')](config[_0x92a7('0x8')],{'host':_0x92a7('0xa'),'port':0x18eb});var io=require(_0x92a7('0xb'))(new Redis(config[_0x92a7('0x8')]));var EmailImap=require(_0x92a7('0xc'));var EmailSmtp=require(_0x92a7('0xd'));var mailAccount=require(_0x92a7('0xe'));var md5Accounts={};function EmailChannel(_0x6b0923){logger['info'](_0x92a7('0xf'));this[_0x92a7('0x10')]=_0x6b0923[_0x92a7('0x10')];this['imapAccounts']={};this[_0x92a7('0x11')]=new EmailSmtp();}EmailChannel[_0x92a7('0x12')]['emit']=function(_0x1067e3){var _0x2c1975=this['mailAccounts'][_0x1067e3];var _0x2fb589={'id':_0x2c1975['id'],'name':_0x2c1975[_0x92a7('0x13')],'key':_0x2c1975['key'],'active':_0x2c1975[_0x92a7('0x14')],'Imap':{'status':_0x2c1975[_0x92a7('0x15')]['status'],'messageStatus':_0x2c1975[_0x92a7('0x15')][_0x92a7('0x16')],'total':_0x2c1975[_0x92a7('0x15')][_0x92a7('0x17')]}};if(_[_0x92a7('0x18')](md5Accounts[_0x1067e3])){md5Accounts[_0x1067e3]={};}var _0x2bb6bb=md5(JSON[_0x92a7('0x19')](_0x2fb589));if(md5Accounts[_0x1067e3][_0x92a7('0x3')]!==_0x2bb6bb){md5Accounts[_0x1067e3][_0x92a7('0x3')]=_0x2bb6bb;io['emit'](_0x92a7('0x1a'),_0x2fb589);}};EmailChannel[_0x92a7('0x12')][_0x92a7('0x1b')]=function(_0x41a959){for(var _0x47ae75 in _0x41a959){if(_0x41a959[_0x92a7('0x1c')](_0x47ae75)){if(_0x41a959[_0x47ae75][_0x92a7('0x15')]&&_0x41a959[_0x47ae75][_0x92a7('0x14')]){var _0x295fc2=_0x41a959[_0x47ae75][_0x92a7('0x15')];if(!_0x295fc2['service']&&_0x41a959[_0x47ae75]['provider']!=='custom')_0x295fc2[_0x92a7('0x1d')]=_0x41a959[_0x47ae75][_0x92a7('0x1e')];if(!this[_0x92a7('0x1f')][_0x92a7('0x1c')](_0x295fc2['id'])){this[_0x92a7('0x1f')][_0x295fc2['id']]=new EmailImap(_0x295fc2,_0x41a959[_0x47ae75][_0x92a7('0x7')]);this[_0x92a7('0x1f')][_0x295fc2['id']]['on'](_0x92a7('0x20'),this[_0x92a7('0x21')][_0x92a7('0x22')](this,_0x47ae75));this[_0x92a7('0x1f')][_0x295fc2['id']]['on']('email',this[_0x92a7('0x23')][_0x92a7('0x22')](this,_0x47ae75));this[_0x92a7('0x1f')][_0x295fc2['id']]['on'](_0x92a7('0x24'),this[_0x92a7('0x25')]['bind'](this,_0x47ae75));this[_0x92a7('0x1f')][_0x295fc2['id']]['on']('error',this['handleImapError'][_0x92a7('0x22')](this,_0x47ae75));}}else{if(_[_0x92a7('0x18')](this[_0x92a7('0x10')][_0x47ae75][_0x92a7('0x15')])){this[_0x92a7('0x10')][_0x47ae75][_0x92a7('0x15')]={};}this[_0x92a7('0x10')][_0x47ae75][_0x92a7('0x15')]['status']=_0x92a7('0x26');this[_0x92a7('0x10')][_0x47ae75][_0x92a7('0x15')][_0x92a7('0x16')]='';this[_0x92a7('0x27')](_0x47ae75);}}}};EmailChannel['prototype'][_0x92a7('0x21')]=function(_0x31941b,_0x480be2){if(this[_0x92a7('0x10')][_0x31941b]){this['mailAccounts'][_0x31941b][_0x92a7('0x15')][_0x92a7('0x28')]=_0x92a7('0x29');this[_0x92a7('0x10')][_0x31941b]['Imap']['messageStatus']=_0x480be2[_0x92a7('0x13')];if(_0x480be2[_0x92a7('0x2a')]){this['mailAccounts'][_0x31941b]['Imap']['total']=_0x480be2[_0x92a7('0x2a')][_0x92a7('0x17')];}return this[_0x92a7('0x27')](_0x31941b);}};EmailChannel[_0x92a7('0x12')][_0x92a7('0x23')]=function(_0x3ccb07,_0x4dee19){logger[_0x92a7('0x2b')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4dee19['firstName'],_0x4dee19[_0x92a7('0x2c')],_0x4dee19[_0x92a7('0x2d')],_0x3ccb07);if(this[_0x92a7('0x10')][_0x3ccb07]){return mailAccount[_0x92a7('0x2e')](_0x3ccb07,_0x4dee19)[_0x92a7('0x2f')](function(_0x18616d){if(_0x18616d){logger[_0x92a7('0x2b')](_0x92a7('0x30'));}})[_0x92a7('0x31')](function(_0x21a704){logger[_0x92a7('0x32')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x21a704));});}};EmailChannel[_0x92a7('0x12')][_0x92a7('0x25')]=function(_0x4301da){if(this[_0x92a7('0x10')][_0x4301da]&&this[_0x92a7('0x10')][_0x4301da]['Imap']){if(this[_0x92a7('0x1f')][this[_0x92a7('0x10')][_0x4301da][_0x92a7('0x15')]['id']]){delete this['imapAccounts'][this[_0x92a7('0x10')][_0x4301da][_0x92a7('0x15')]['id']];}this['mailAccounts'][_0x4301da]['Imap'][_0x92a7('0x33')]=moment();this[_0x92a7('0x27')](_0x4301da);}};EmailChannel[_0x92a7('0x12')][_0x92a7('0x34')]=function(_0x5191cc,_0x5a0780){if(this[_0x92a7('0x10')][_0x5191cc]){this[_0x92a7('0x10')][_0x5191cc][_0x92a7('0x15')][_0x92a7('0x28')]=_0x92a7('0x32');this['mailAccounts'][_0x5191cc]['Imap'][_0x92a7('0x16')]=_0x5a0780;return this[_0x92a7('0x27')](_0x5191cc);}};EmailChannel[_0x92a7('0x12')][_0x92a7('0x35')]=function(_0x470677,_0x12cf7b){return this['smtp'][_0x92a7('0x36')](_0x470677,_0x12cf7b);};EmailChannel[_0x92a7('0x12')][_0x92a7('0x37')]=function(_0x5a85e2){var _0x2e0dae=this;if(this[_0x92a7('0x10')][_0x5a85e2['id']]){if(_['isNil'](this[_0x92a7('0x10')][_0x5a85e2['id']]['Smtp'])){this[_0x92a7('0x10')][_0x5a85e2['id']][_0x92a7('0x38')]={};}this[_0x92a7('0x10')][_0x5a85e2['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x51b09f,_0x5c90fe){return _0x2e0dae[_0x92a7('0x11')][_0x92a7('0x39')](_0x5a85e2)[_0x92a7('0x2f')](function(_0x21878d){_0x2e0dae['mailAccounts'][_0x5a85e2['id']][_0x92a7('0x38')]['status']=_0x92a7('0x3a');_0x2e0dae[_0x92a7('0x10')][_0x5a85e2['id']]['Smtp'][_0x92a7('0x16')]='';_0x2e0dae[_0x92a7('0x27')](_0x5a85e2['id']);_0x51b09f(_0x21878d);})[_0x92a7('0x31')](function(_0x48bb08){_0x2e0dae[_0x92a7('0x10')][_0x5a85e2['id']][_0x92a7('0x38')][_0x92a7('0x28')]=_0x92a7('0x32');_0x2e0dae[_0x92a7('0x10')][_0x5a85e2['id']]['Smtp'][_0x92a7('0x16')]=_0x48bb08;_0x2e0dae[_0x92a7('0x27')](_0x5a85e2['id']);_0x5c90fe(_0x48bb08);});});}return this[_0x92a7('0x11')][_0x92a7('0x39')](_0x5a85e2);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index cc7ea69..f799372 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 _0x8d3e=['EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','handleReady','bind','handleEnd','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','error','handleFetchEnd','closeBox','body','attributes','handleMessageBody','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser','emit','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','Iconv'];(function(_0x267ec8,_0x12ad4f){var _0x1473b4=function(_0xd24ca6){while(--_0xd24ca6){_0x267ec8['push'](_0x267ec8['shift']());}};_0x1473b4(++_0x12ad4f);}(_0x8d3e,0x1b3));var _0xe8d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d3e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8d3('0x0'));var util=require('util');var Imap=require(_0xe8d3('0x1'));var simpleParser=require(_0xe8d3('0x2'))[_0xe8d3('0x3')];var Iconv=require(_0xe8d3('0x4'))[_0xe8d3('0x5')];var EventEmitter=require('events')[_0xe8d3('0x6')];var utils=require(_0xe8d3('0x7'));var logger=require(_0xe8d3('0x8'))(_0xe8d3('0x9'));function EmailImap(_0x2c6e0d,_0x194ae4){this[_0xe8d3('0xa')]=_0x2c6e0d['mailbox'];this[_0xe8d3('0xb')]=this['getAccount'](_0x2c6e0d,_0x194ae4);this[_0xe8d3('0x1')]=new Imap(this[_0xe8d3('0xb')]);this[_0xe8d3('0x1')][_0xe8d3('0xc')]('ready',this[_0xe8d3('0xd')][_0xe8d3('0xe')](this));this['imap'][_0xe8d3('0xc')]('end',this[_0xe8d3('0xf')][_0xe8d3('0xe')](this));this[_0xe8d3('0x1')]['on']('error',this[_0xe8d3('0x10')][_0xe8d3('0xe')](this));this[_0xe8d3('0x1')]['connect']();}util[_0xe8d3('0x11')](EmailImap,EventEmitter);EmailImap[_0xe8d3('0x12')][_0xe8d3('0x13')]=function(_0x20cf5a,_0x4a6da2){var _0x425d1d={'connTimeout':_0x20cf5a[_0xe8d3('0x14')]?_0x20cf5a[_0xe8d3('0x14')]*0x3e8:0x2710,'authTimeout':_0x20cf5a[_0xe8d3('0x15')]?_0x20cf5a[_0xe8d3('0x15')]*0x3e8:0x1388};if(_0x20cf5a[_0xe8d3('0x16')]){_0x425d1d['user']=_0x20cf5a[_0xe8d3('0x17')];if(_0x20cf5a['modernAuthentication']){_0x425d1d[_0xe8d3('0x18')]=utils[_0xe8d3('0x19')](_0x20cf5a[_0xe8d3('0x1a')]['data5'],_0x20cf5a[_0xe8d3('0x17')]);}else{_0x425d1d['password']=_0x20cf5a[_0xe8d3('0x1b')];}}else{if(_0x20cf5a[_0xe8d3('0x1c')]){_0x425d1d['user']=_0x20cf5a[_0xe8d3('0x17')];_0x425d1d[_0xe8d3('0x1b')]=_0x20cf5a[_0xe8d3('0x1b')];}}_0x425d1d[_0xe8d3('0x9')]=_0x4a6da2||_0x20cf5a[_0xe8d3('0x17')]||_0xe8d3('0x1d');_0x425d1d[_0xe8d3('0x1e')]=_0x20cf5a[_0xe8d3('0x1e')];_0x425d1d[_0xe8d3('0x1f')]=_0x20cf5a[_0xe8d3('0x1f')]||0x3e1;if(_0x20cf5a[_0xe8d3('0x20')]){_0x425d1d[_0xe8d3('0x20')]=!![];}else{_0x425d1d[_0xe8d3('0x20')]=![];_0x425d1d[_0xe8d3('0x21')]=_0xe8d3('0x22');}return _0x425d1d;};EmailImap[_0xe8d3('0x12')][_0xe8d3('0xd')]=function(){this[_0xe8d3('0x1')][_0xe8d3('0x23')](this[_0xe8d3('0xa')],![],this[_0xe8d3('0x24')]['bind'](this));};EmailImap['prototype'][_0xe8d3('0x24')]=function(_0x394854,_0x95486c){if(_0x394854){this['handleError'](_0x394854,!![]);}else{this['emit']('box',_0x95486c);this[_0xe8d3('0x25')]();}};EmailImap['prototype'][_0xe8d3('0x26')]=function(_0x42cee4){if(_0x42cee4){this['handleError'](_0x42cee4,!![]);}else{this[_0xe8d3('0x1')][_0xe8d3('0x27')]();}};EmailImap[_0xe8d3('0x12')]['readUnseen']=function(){this[_0xe8d3('0x1')][_0xe8d3('0x28')]([_0xe8d3('0x29')],this['handleReadUnseen'][_0xe8d3('0xe')](this));};EmailImap[_0xe8d3('0x12')][_0xe8d3('0x2a')]=function(_0x1569d9,_0x13093a){if(_0x1569d9){this[_0xe8d3('0x10')](_0x1569d9,!![]);}else{if(_0x13093a[_0xe8d3('0x2b')]){try{var _0x1e8e9a=this[_0xe8d3('0x1')]['fetch'](_0x13093a,{'bodies':'','markSeen':!![]});_0x1e8e9a['on'](_0xe8d3('0x2c'),this[_0xe8d3('0x2d')][_0xe8d3('0xe')](this));_0x1e8e9a[_0xe8d3('0xc')](_0xe8d3('0x2e'),this['handleFetchError'][_0xe8d3('0xe')](this));_0x1e8e9a['once']('end',this[_0xe8d3('0x2f')]['bind'](this));}catch(_0xfc4115){logger['error'](_0xfc4115);}}else{this['imap'][_0xe8d3('0x30')](!![],this[_0xe8d3('0x26')][_0xe8d3('0xe')](this));}}};EmailImap[_0xe8d3('0x12')][_0xe8d3('0x2d')]=function(_0x573c73){_0x573c73['on'](_0xe8d3('0x31'),this['handleMessageBody'][_0xe8d3('0xe')](this));_0x573c73[_0xe8d3('0xc')](_0xe8d3('0x32'),this['handleMessageAttributes'][_0xe8d3('0xe')](this));_0x573c73[_0xe8d3('0xc')](_0xe8d3('0x27'),this['handleMessageEnd'][_0xe8d3('0xe')](this));};EmailImap[_0xe8d3('0x12')][_0xe8d3('0x33')]=function(_0x1ca934){simpleParser(_0x1ca934,{'Iconv':Iconv},this[_0xe8d3('0x34')][_0xe8d3('0xe')](this));};EmailImap['prototype'][_0xe8d3('0x35')]=function(){};EmailImap['prototype'][_0xe8d3('0x36')]=function(){};EmailImap['prototype'][_0xe8d3('0x34')]=function(_0x204eec,_0x22c4b0){if(_0x204eec){logger[_0xe8d3('0x2e')](_0x204eec);}else{var _0x105b36=this;utils[_0xe8d3('0x37')](this['account'],_0x22c4b0,function(_0x39ba60){_0x105b36[_0xe8d3('0x38')]('email',_0x39ba60);});}};EmailImap[_0xe8d3('0x12')]['handleFetchEnd']=function(){this['imap'][_0xe8d3('0x30')](!![],this[_0xe8d3('0x26')][_0xe8d3('0xe')](this));};EmailImap[_0xe8d3('0x12')][_0xe8d3('0x39')]=function(_0x2eee94){this[_0xe8d3('0x10')](_0x2eee94);this[_0xe8d3('0x1')][_0xe8d3('0x30')](!![],this['handleCloseBox'][_0xe8d3('0xe')](this));};EmailImap[_0xe8d3('0x12')][_0xe8d3('0xf')]=function(){this[_0xe8d3('0x38')](_0xe8d3('0x27'));};EmailImap[_0xe8d3('0x12')]['handleError']=function(_0x3ae41f,_0xedab1){logger[_0xe8d3('0x2e')](_0xe8d3('0x10'),this[_0xe8d3('0xb')][_0xe8d3('0x9')],JSON[_0xe8d3('0x3a')](_0x3ae41f));var _0x2e8fe8='';if(_0x3ae41f){if(_0x3ae41f['textCode']){_0x2e8fe8=_0x3ae41f[_0xe8d3('0x3b')];}else{for(var _0x5a3459 in _0x3ae41f){if(_0x3ae41f[_0xe8d3('0x3c')](_0x5a3459)){_0x2e8fe8+=_[_0xe8d3('0x3d')](_0x5a3459)+':\x20'+_0x3ae41f[_0x5a3459]+'\x0a';}}}}if(_0xedab1){this[_0xe8d3('0x1')]['end']();}else{this['emit'](_0xe8d3('0x2e'),_0x2e8fe8);this[_0xe8d3('0x38')](_0xe8d3('0x27'));}};module[_0xe8d3('0x3e')]=EmailImap; \ No newline at end of file +var _0x74ad=['handleFetchError','end','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','handleEnd','inherits','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','prototype','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleError','search','handleReadUnseen','length','fetch','message','handleFetchMessage','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x74ad,0x181));var _0xd74a=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x74ad[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xd74a('0x0'));var util=require(_0xd74a('0x1'));var Imap=require(_0xd74a('0x2'));var simpleParser=require(_0xd74a('0x3'))[_0xd74a('0x4')];var Iconv=require(_0xd74a('0x5'))[_0xd74a('0x6')];var EventEmitter=require(_0xd74a('0x7'))[_0xd74a('0x8')];var utils=require('./utils');var logger=require(_0xd74a('0x9'))(_0xd74a('0xa'));function EmailImap(_0x36a85a,_0x30e25b){this['mailbox']=_0x36a85a[_0xd74a('0xb')];this[_0xd74a('0xc')]=this[_0xd74a('0xd')](_0x36a85a,_0x30e25b);this[_0xd74a('0x2')]=new Imap(this[_0xd74a('0xc')]);this[_0xd74a('0x2')]['once'](_0xd74a('0xe'),this[_0xd74a('0xf')][_0xd74a('0x10')](this));this[_0xd74a('0x2')][_0xd74a('0x11')]('end',this[_0xd74a('0x12')]['bind'](this));this['imap']['on']('error',this['handleError'][_0xd74a('0x10')](this));this[_0xd74a('0x2')]['connect']();}util[_0xd74a('0x13')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x357bfd,_0x4a5c50){var _0x59abdd={'connTimeout':_0x357bfd[_0xd74a('0x14')]?_0x357bfd[_0xd74a('0x14')]*0x3e8:0x2710,'authTimeout':_0x357bfd[_0xd74a('0x15')]?_0x357bfd[_0xd74a('0x15')]*0x3e8:0x1388};if(_0x357bfd['service']){_0x59abdd['user']=_0x357bfd[_0xd74a('0x16')];if(_0x357bfd[_0xd74a('0x17')]){_0x59abdd[_0xd74a('0x18')]=utils[_0xd74a('0x19')](_0x357bfd[_0xd74a('0x1a')][_0xd74a('0x1b')],_0x357bfd[_0xd74a('0x16')]);}else{_0x59abdd[_0xd74a('0x1c')]=_0x357bfd['password'];}}else{if(_0x357bfd[_0xd74a('0x1d')]){_0x59abdd[_0xd74a('0x16')]=_0x357bfd['user'];_0x59abdd['password']=_0x357bfd['password'];}}_0x59abdd['email']=_0x4a5c50||_0x357bfd[_0xd74a('0x16')]||'anonymous@xcally.com';_0x59abdd[_0xd74a('0x1e')]=_0x357bfd[_0xd74a('0x1e')];_0x59abdd['port']=_0x357bfd[_0xd74a('0x1f')]||0x3e1;if(_0x357bfd[_0xd74a('0x20')]){_0x59abdd[_0xd74a('0x20')]=!![];}else{_0x59abdd['tls']=![];_0x59abdd[_0xd74a('0x21')]=_0xd74a('0x22');}return _0x59abdd;};EmailImap[_0xd74a('0x23')][_0xd74a('0xf')]=function(){this[_0xd74a('0x2')]['openBox'](this[_0xd74a('0xb')],![],this[_0xd74a('0x24')]['bind'](this));};EmailImap[_0xd74a('0x23')][_0xd74a('0x24')]=function(_0x1a915d,_0x1e43c2){if(_0x1a915d){this['handleError'](_0x1a915d,!![]);}else{this[_0xd74a('0x25')](_0xd74a('0x26'),_0x1e43c2);this[_0xd74a('0x27')]();}};EmailImap[_0xd74a('0x23')][_0xd74a('0x28')]=function(_0x215ab8){if(_0x215ab8){this[_0xd74a('0x29')](_0x215ab8,!![]);}else{this[_0xd74a('0x2')]['end']();}};EmailImap['prototype']['readUnseen']=function(){this[_0xd74a('0x2')][_0xd74a('0x2a')](['UNSEEN'],this[_0xd74a('0x2b')][_0xd74a('0x10')](this));};EmailImap[_0xd74a('0x23')][_0xd74a('0x2b')]=function(_0x2971ba,_0x239159){if(_0x2971ba){this['handleError'](_0x2971ba,!![]);}else{if(_0x239159[_0xd74a('0x2c')]){try{var _0x37ff77=this[_0xd74a('0x2')][_0xd74a('0x2d')](_0x239159,{'bodies':'','markSeen':!![]});_0x37ff77['on'](_0xd74a('0x2e'),this[_0xd74a('0x2f')][_0xd74a('0x10')](this));_0x37ff77[_0xd74a('0x11')](_0xd74a('0x30'),this[_0xd74a('0x31')][_0xd74a('0x10')](this));_0x37ff77[_0xd74a('0x11')](_0xd74a('0x32'),this[_0xd74a('0x33')][_0xd74a('0x10')](this));}catch(_0x4faa47){logger[_0xd74a('0x30')](_0x4faa47);}}else{this[_0xd74a('0x2')][_0xd74a('0x34')](!![],this[_0xd74a('0x28')]['bind'](this));}}};EmailImap[_0xd74a('0x23')]['handleFetchMessage']=function(_0x15399a){_0x15399a['on'](_0xd74a('0x35'),this[_0xd74a('0x36')]['bind'](this));_0x15399a[_0xd74a('0x11')]('attributes',this['handleMessageAttributes'][_0xd74a('0x10')](this));_0x15399a['once'](_0xd74a('0x32'),this[_0xd74a('0x37')][_0xd74a('0x10')](this));};EmailImap['prototype'][_0xd74a('0x36')]=function(_0x28c6f7){simpleParser(_0x28c6f7,{'Iconv':Iconv},this[_0xd74a('0x38')]['bind'](this));};EmailImap['prototype'][_0xd74a('0x39')]=function(){};EmailImap[_0xd74a('0x23')][_0xd74a('0x37')]=function(){};EmailImap[_0xd74a('0x23')][_0xd74a('0x38')]=function(_0x6031e8,_0x53d6f5){if(_0x6031e8){logger['error'](_0x6031e8);}else{var _0x42abe4=this;utils[_0xd74a('0x3a')](this[_0xd74a('0xc')],_0x53d6f5,function(_0x45bd2f){_0x42abe4[_0xd74a('0x25')](_0xd74a('0xa'),_0x45bd2f);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xd74a('0x2')]['closeBox'](!![],this[_0xd74a('0x28')][_0xd74a('0x10')](this));};EmailImap[_0xd74a('0x23')][_0xd74a('0x31')]=function(_0x46c3db){this[_0xd74a('0x29')](_0x46c3db);this[_0xd74a('0x2')][_0xd74a('0x34')](!![],this[_0xd74a('0x28')][_0xd74a('0x10')](this));};EmailImap[_0xd74a('0x23')][_0xd74a('0x12')]=function(){this[_0xd74a('0x25')](_0xd74a('0x32'));};EmailImap[_0xd74a('0x23')]['handleError']=function(_0x422933,_0x2c6219){logger[_0xd74a('0x30')]('handleError',this['account'][_0xd74a('0xa')],JSON[_0xd74a('0x3b')](_0x422933));var _0x288b8a='';if(_0x422933){if(_0x422933[_0xd74a('0x3c')]){_0x288b8a=_0x422933[_0xd74a('0x3c')];}else{for(var _0x4f2501 in _0x422933){if(_0x422933[_0xd74a('0x3d')](_0x4f2501)){_0x288b8a+=_['upperFirst'](_0x4f2501)+':\x20'+_0x422933[_0x4f2501]+'\x0a';}}}}if(_0x2c6219){this[_0xd74a('0x2')][_0xd74a('0x32')]();}else{this['emit'](_0xd74a('0x30'),_0x288b8a);this[_0xd74a('0x25')](_0xd74a('0x32'));}};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 6bc0ec9..02704ca 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 _0x3d37=['sendMail','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile'];(function(_0x2e4d6b,_0x2750de){var _0x121440=function(_0x20f6fa){while(--_0x20f6fa){_0x2e4d6b['push'](_0x2e4d6b['shift']());}};_0x121440(++_0x2750de);}(_0x3d37,0x122));var _0x73d3=function(_0x506d52,_0x58c446){_0x506d52=_0x506d52-0x0;var _0x3b0c64=_0x3d37[_0x506d52];return _0x3b0c64;};'use strict';var nodemailer=require(_0x73d3('0x0'));var inlineBase64=require(_0x73d3('0x1'));function EmailSmtp(){}EmailSmtp[_0x73d3('0x2')][_0x73d3('0x3')]=function(_0x1fe781,_0x26fbb9){return new Promise(function(_0x56365d,_0x59439e){var _0x532c90=nodemailer[_0x73d3('0x4')](_0x1fe781);_0x532c90[_0x73d3('0x5')](_0x73d3('0x6'),inlineBase64());_0x532c90[_0x73d3('0x7')](_0x26fbb9,function(_0x2d1ed4,_0x12852e){if(_0x2d1ed4){_0x59439e(_0x2d1ed4['toString']());}else{_0x56365d(_0x12852e);}});});};EmailSmtp[_0x73d3('0x2')][_0x73d3('0x8')]=function(_0x4d2744){return new Promise(function(_0x48810d,_0x5f22c1){var _0x277978=nodemailer[_0x73d3('0x4')](_0x4d2744);_0x277978['verify'](function(_0x1415d2,_0x350ca7){if(_0x1415d2){_0x5f22c1(_0x1415d2['toString']());}else{if(_0x350ca7){_0x48810d(_0x350ca7);}else{_0x5f22c1(_0x73d3('0x9'));}}});});};module[_0x73d3('0xa')]=EmailSmtp; \ No newline at end of file +var _0xd86f=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','compile','toString','prototype','verify','createTransport'];(function(_0x30c981,_0x4800a8){var _0x4c403b=function(_0x31b2fa){while(--_0x31b2fa){_0x30c981['push'](_0x30c981['shift']());}};_0x4c403b(++_0x4800a8);}(_0xd86f,0x142));var _0xfd86=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd86f[_0x46698a];return _0x356db0;};'use strict';var nodemailer=require(_0xfd86('0x0'));var inlineBase64=require(_0xfd86('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xfd86('0x2')]=function(_0x2b4837,_0x50327f){return new Promise(function(_0x5a532f,_0x1a65af){var _0xa40087=nodemailer['createTransport'](_0x2b4837);_0xa40087['use'](_0xfd86('0x3'),inlineBase64());_0xa40087['sendMail'](_0x50327f,function(_0x47bcc3,_0x6ef2ff){if(_0x47bcc3){_0x1a65af(_0x47bcc3[_0xfd86('0x4')]());}else{_0x5a532f(_0x6ef2ff);}});});};EmailSmtp[_0xfd86('0x5')][_0xfd86('0x6')]=function(_0x403590){return new Promise(function(_0x1a9ad7,_0x4ea7e7){var _0x4b96e3=nodemailer[_0xfd86('0x7')](_0x403590);_0x4b96e3['verify'](function(_0x42b45e,_0x3c520e){if(_0x42b45e){_0x4ea7e7(_0x42b45e['toString']());}else{if(_0x3c520e){_0x1a9ad7(_0x3c520e);}else{_0x4ea7e7(_0xfd86('0x8'));}}});});};module[_0xfd86('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index ff94086..2d67974 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 _0x5155=['content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','isAutoreply','parser','from','subject','messageId','inReplyTo','date','filter','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','base64','lodash','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','pop','isEmpty','test','html','replace','includes','attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x98b851[_0x5515('0x10')](0x0,-0x1)[_0x5515('0x11')]('\x20'):_0x5bfd9a['name'];}return'Anonymous';}function getLastName(_0x20f497){var _0x543457=_[_0x5515('0x6')](_0x20f497[_0x5515('0x7')]);if(_0x543457&&_0x543457['name']){var _0x33c535=_0x543457['name'][_0x5515('0xe')](/\s+/);return _0x33c535[_0x5515('0xf')]>0x1?_0x33c535[_0x5515('0x12')]():'';}return'';}function getMails(_0x4a47df,_0x453aee){var _0x47d362='';for(var _0x315da1=0x0;_0x315da1<_0x453aee['value'][_0x5515('0xf')];_0x315da1+=0x1){if(_0x453aee[_0x5515('0x7')][_0x315da1][_0x5515('0x8')]!==_0x4a47df){if(!_[_0x5515('0x13')](_0x47d362)){_0x47d362+=',';}_0x47d362+=_0x453aee[_0x5515('0x7')][_0x315da1]['name']||_0x453aee[_0x5515('0x7')][_0x315da1]['address']||'';_0x47d362+='\x20<';_0x47d362+=_0x453aee[_0x5515('0x7')][_0x315da1][_0x5515('0x8')]?_0x453aee[_0x5515('0x7')][_0x315da1][_0x5515('0x8')]:_0x5515('0x9')+random[_0x5515('0xa')](0x6)+_0x5515('0xb');_0x47d362+='>';}}return _0x47d362;}function parseEmail(_0x5c4a48,_0x4b40d1,_0x4047dd){if(_0x4b40d1['html']){var _0x54afaf=/)<[^<]*)*<\/script>/gi;while(_0x54afaf[_0x5515('0x14')](_0x4b40d1[_0x5515('0x15')])){_0x4b40d1['html']=_0x4b40d1[_0x5515('0x15')][_0x5515('0x16')](_0x54afaf,'');}if(_0x4b40d1['html'][_0x5515('0x17')]('{_0x3f070b[_0x5515('0x1a')](_0x12fb8e['filename']);});var _0x2084f3=/]+>/g;var _0x432c6d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x29f2cc=_0x4b40d1['html']['replace'](_0x432c6d,_0x5515('0x1b'));var _0xc1954c=_0x29f2cc[_0x5515('0x16')](_0x2084f3,_0x5515('0x1c'));for(let _0x1e6151=0x0;_0x1e6151<_0x3f070b[_0x5515('0xf')];_0x1e6151++){var _0x1adb77=_0xc1954c[_0x5515('0x16')](_0x5515('0x1c'),_0x5515('0x1d')+_0x3f070b[_0x1e6151]+'\x20]');_0xc1954c=_0x1adb77;}_0x4b40d1[_0x5515('0x15')]=_0xc1954c;}_0x4047dd[_0x5515('0x1e')]=_0x4b40d1[_0x5515('0x15')];}else{_0x4047dd[_0x5515('0x1e')]=_0x4b40d1[_0x5515('0x1f')];}if(_0x4047dd['body']){_0x4047dd[_0x5515('0x1e')]=_0x4047dd[_0x5515('0x1e')][_0x5515('0x16')](/0x0){var _0x5bc2a0=[_0x5515('0x33'),_0x5515('0x34'),_0x5515('0x35')];for(var _0x5488b2=0x0;_0x5488b2<_0x4b40d1[_0x5515('0x32')][_0x5515('0xf')];_0x5488b2++){var _0x1e607d=_[_0x5515('0x36')](_0x5bc2a0,_0x4b40d1[_0x5515('0x32')][_0x5488b2]['line']);if(_0x1e607d>=0x0){_0x4047dd[_0x5515('0x37')]=!![];}}}return _0x4047dd;}exports[_0x5515('0x38')]=function(_0x22b42f,_0x165abb,_0x172d70){var _0x13a31d={'from':getAddress(_0x165abb[_0x5515('0x39')]),'firstName':getFirstName(_0x165abb[_0x5515('0x39')]),'lastName':getLastName(_0x165abb['from']),'mapKey':_0x5515('0x22'),'message':{'from':getMails(_0x22b42f[_0x5515('0x22')],_0x165abb[_0x5515('0x39')]),'to':_0x22b42f[_0x5515('0x22')],'cc':'','subject':_0x165abb[_0x5515('0x3a')]||'','messageId':_0x165abb[_0x5515('0x3b')],'inReplyTo':_0x165abb[_0x5515('0x3c')],'sentAt':moment(_0x165abb[_0x5515('0x3d')])[_0x5515('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x165abb[_0x5515('0x15')]&&!_0x165abb['textAsHtml']){var _0x2f0d3d=_[_0x5515('0x3e')](_0x165abb['attachments'],{'contentType':'application/ms-tnef'});if(_0x2f0d3d[_0x5515('0xf')]){logger[_0x5515('0x3f')](util[_0x5515('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x165abb[_0x5515('0x3b')]));tnef[_0x5515('0x40')](_[_0x5515('0x41')](_0x2f0d3d)['content'],function(_0x26aeeb,_0x1385d7){if(_0x1385d7){_0x165abb[_0x5515('0x15')]=_0x1385d7[_0x5515('0x42')]||_0x5515('0x43');if(_0x1385d7[_0x5515('0x44')]){for(var _0x52cb8a=0x0;_0x52cb8a<_0x1385d7[_0x5515('0x44')][_0x5515('0xf')];_0x52cb8a++){var _0x2bd01f=_0x1385d7['Attachments'][_0x52cb8a];_0x13a31d[_0x5515('0x23')][_0x5515('0x18')][_0x5515('0x1a')]({'filename':_0x2bd01f['Title'],'content':Buffer['from'](_0x2bd01f[_0x5515('0x45')])});}}}_0x172d70(parseEmail(_0x22b42f,_0x165abb,_0x13a31d));});}else{_0x165abb['html']='

Empty\x20message

';_0x172d70(parseEmail(_0x22b42f,_0x165abb,_0x13a31d));}}else{_0x172d70(parseEmail(_0x22b42f,_0x165abb,_0x13a31d));}};exports[_0x5515('0x46')]=function(_0x18e9f0,_0x434c8b){var _0x3199e8=[_0x5515('0x47')+(_0x434c8b||''),_0x5515('0x48')+_0x18e9f0,'',''];return Buffer[_0x5515('0x39')](_0x3199e8[_0x5515('0x11')](''),'utf-8')['toString'](_0x5515('0x49'));}; \ No newline at end of file +var _0xdc92=['lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','value','address','generate','@xcally.com','name','substring','split','length','slice','join','head','isEmpty','html','replace','attachments','forEach','push','filename','_SRC','_IMG','\x20]','body','textAsHtml','originTo','message','email','includes','originCc','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','indexOf','line','parser','from','inReplyTo','date','filter','application/ms-tnef','messageId','parseBuffer','first','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','utf-8','toString','base64'];(function(_0x726624,_0x21f598){var _0x14fb9f=function(_0x11b31a){while(--_0x11b31a){_0x726624['push'](_0x726624['shift']());}};_0x14fb9f(++_0x21f598);}(_0xdc92,0x1ce));var _0x2dc9=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0xdc92[_0x45f111];return _0x483508;};'use strict';var _=require(_0x2dc9('0x0'));var moment=require(_0x2dc9('0x1'));var random=require(_0x2dc9('0x2'));var fs=require('fs');var path=require(_0x2dc9('0x3'));var util=require(_0x2dc9('0x4'));var tnef=require(_0x2dc9('0x5'));var logger=require(_0x2dc9('0x6'))('email');var config=require('../../../config/environment');function getAddress(_0x2106f1){var _0x475ea8=_['head'](_0x2106f1[_0x2dc9('0x7')]);return _0x475ea8&&_0x475ea8[_0x2dc9('0x8')]?_0x475ea8[_0x2dc9('0x8')]:'anonymous'+random[_0x2dc9('0x9')](0x6)+_0x2dc9('0xa');}function getFirstName(_0x48d181){var _0x2ff19a=_['head'](_0x48d181[_0x2dc9('0x7')]);if(_0x2ff19a&&_0x2ff19a['name']){if(_0x2ff19a['name']==_0x2ff19a[_0x2dc9('0x8')]){return _0x2ff19a[_0x2dc9('0xb')][_0x2dc9('0xc')](0x0,_0x2ff19a[_0x2dc9('0xb')]['indexOf']('@'));}var _0x540747=_0x2ff19a['name'][_0x2dc9('0xd')](/\s+/);return _0x540747[_0x2dc9('0xe')]>0x1?_0x540747[_0x2dc9('0xf')](0x0,-0x1)[_0x2dc9('0x10')]('\x20'):_0x2ff19a[_0x2dc9('0xb')];}return'Anonymous';}function getLastName(_0x24b68f){var _0x318860=_[_0x2dc9('0x11')](_0x24b68f[_0x2dc9('0x7')]);if(_0x318860&&_0x318860['name']){var _0x5740d8=_0x318860[_0x2dc9('0xb')][_0x2dc9('0xd')](/\s+/);return _0x5740d8['length']>0x1?_0x5740d8['pop']():'';}return'';}function getMails(_0x4fa6c5,_0x427599){var _0x5ee0ff='';for(var _0xbfee6c=0x0;_0xbfee6c<_0x427599[_0x2dc9('0x7')][_0x2dc9('0xe')];_0xbfee6c+=0x1){if(_0x427599[_0x2dc9('0x7')][_0xbfee6c][_0x2dc9('0x8')]!==_0x4fa6c5){if(!_[_0x2dc9('0x12')](_0x5ee0ff)){_0x5ee0ff+=',';}_0x5ee0ff+=_0x427599[_0x2dc9('0x7')][_0xbfee6c][_0x2dc9('0xb')]||_0x427599[_0x2dc9('0x7')][_0xbfee6c]['address']||'';_0x5ee0ff+='\x20<';_0x5ee0ff+=_0x427599[_0x2dc9('0x7')][_0xbfee6c]['address']?_0x427599[_0x2dc9('0x7')][_0xbfee6c]['address']:'anonymous'+random[_0x2dc9('0x9')](0x6)+_0x2dc9('0xa');_0x5ee0ff+='>';}}return _0x5ee0ff;}function parseEmail(_0x347c62,_0x541c1c,_0x29a179){if(_0x541c1c[_0x2dc9('0x13')]){var _0xd7d910=/)<[^<]*)*<\/script>/gi;while(_0xd7d910['test'](_0x541c1c[_0x2dc9('0x13')])){_0x541c1c[_0x2dc9('0x13')]=_0x541c1c[_0x2dc9('0x13')][_0x2dc9('0x14')](_0xd7d910,'');}if(_0x541c1c[_0x2dc9('0x13')]['includes']('{_0x447d50[_0x2dc9('0x17')](_0x2320ba[_0x2dc9('0x18')]);});var _0x2f6f66=/]+>/g;var _0x5e9fe1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4fae03=_0x541c1c[_0x2dc9('0x13')][_0x2dc9('0x14')](_0x5e9fe1,_0x2dc9('0x19'));var _0x51fc7c=_0x4fae03['replace'](_0x2f6f66,_0x2dc9('0x1a'));for(let _0x2590f2=0x0;_0x2590f2<_0x447d50[_0x2dc9('0xe')];_0x2590f2++){var _0x374234=_0x51fc7c['replace'](_0x2dc9('0x1a'),'\x20[Attachment:\x20'+_0x447d50[_0x2590f2]+_0x2dc9('0x1b'));_0x51fc7c=_0x374234;}_0x541c1c[_0x2dc9('0x13')]=_0x51fc7c;}_0x29a179[_0x2dc9('0x1c')]=_0x541c1c[_0x2dc9('0x13')];}else{_0x29a179[_0x2dc9('0x1c')]=_0x541c1c[_0x2dc9('0x1d')];}if(_0x29a179['body']){_0x29a179[_0x2dc9('0x1c')]=_0x29a179[_0x2dc9('0x1c')][_0x2dc9('0x14')](/0x0){var _0x213797=[_0x2dc9('0x2e'),'X-Auto-Response-Suppress:\x20All',_0x2dc9('0x2f')];for(var _0x8b083b=0x0;_0x8b083b<_0x541c1c[_0x2dc9('0x2d')][_0x2dc9('0xe')];_0x8b083b++){var _0x592695=_[_0x2dc9('0x30')](_0x213797,_0x541c1c[_0x2dc9('0x2d')][_0x8b083b][_0x2dc9('0x31')]);if(_0x592695>=0x0){_0x29a179['isAutoreply']=!![];}}}return _0x29a179;}exports[_0x2dc9('0x32')]=function(_0x416c0d,_0x316d5b,_0x46fb0f){var _0x4c9d44={'from':getAddress(_0x316d5b[_0x2dc9('0x33')]),'firstName':getFirstName(_0x316d5b[_0x2dc9('0x33')]),'lastName':getLastName(_0x316d5b[_0x2dc9('0x33')]),'mapKey':_0x2dc9('0x20'),'message':{'from':getMails(_0x416c0d[_0x2dc9('0x20')],_0x316d5b['from']),'to':_0x416c0d['email'],'cc':'','subject':_0x316d5b['subject']||'','messageId':_0x316d5b['messageId'],'inReplyTo':_0x316d5b[_0x2dc9('0x34')],'sentAt':moment(_0x316d5b[_0x2dc9('0x35')])[_0x2dc9('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x316d5b[_0x2dc9('0x13')]&&!_0x316d5b[_0x2dc9('0x1d')]){var _0x168d49=_[_0x2dc9('0x36')](_0x316d5b[_0x2dc9('0x15')],{'contentType':_0x2dc9('0x37')});if(_0x168d49[_0x2dc9('0xe')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x316d5b[_0x2dc9('0x38')]));tnef[_0x2dc9('0x39')](_[_0x2dc9('0x3a')](_0x168d49)[_0x2dc9('0x2c')],function(_0x55d5e5,_0x9211c5){if(_0x9211c5){_0x316d5b['html']=_0x9211c5['BodyHTML']||_0x2dc9('0x3b');if(_0x9211c5[_0x2dc9('0x3c')]){for(var _0x1a906e=0x0;_0x1a906e<_0x9211c5['Attachments'][_0x2dc9('0xe')];_0x1a906e++){var _0x5c0844=_0x9211c5[_0x2dc9('0x3c')][_0x1a906e];_0x4c9d44[_0x2dc9('0x1f')][_0x2dc9('0x15')][_0x2dc9('0x17')]({'filename':_0x5c0844[_0x2dc9('0x3d')],'content':Buffer[_0x2dc9('0x33')](_0x5c0844['Data'])});}}}_0x46fb0f(parseEmail(_0x416c0d,_0x316d5b,_0x4c9d44));});}else{_0x316d5b[_0x2dc9('0x13')]='

Empty\x20message

';_0x46fb0f(parseEmail(_0x416c0d,_0x316d5b,_0x4c9d44));}}else{_0x46fb0f(parseEmail(_0x416c0d,_0x316d5b,_0x4c9d44));}};exports[_0x2dc9('0x3e')]=function(_0x239f9c,_0x98690c){var _0x531b9b=['user='+(_0x98690c||''),'auth=Bearer\x20'+_0x239f9c,'',''];return Buffer[_0x2dc9('0x33')](_0x531b9b[_0x2dc9('0x10')](''),_0x2dc9('0x3f'))[_0x2dc9('0x40')](_0x2dc9('0x41'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3916ca0..b037244 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 _0x09cc=['Smtp','exports','name','key','SERV','active','Imap'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x09cc,0xb8));var _0xc09c=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x09cc[_0x119d5a];return _0x15bff4;};'use strict';var _=require('lodash');function MailAccount(_0xf0834f){this['id']=_0xf0834f['id']||0x0;this[_0xc09c('0x0')]=_0xf0834f[_0xc09c('0x0')]||'Service';this[_0xc09c('0x1')]=_0xf0834f[_0xc09c('0x1')]||_0xc09c('0x2');this[_0xc09c('0x3')]=_0xf0834f['active']||![];this[_0xc09c('0x4')]=_0xf0834f[_0xc09c('0x4')]||[];this[_0xc09c('0x5')]=_0xf0834f[_0xc09c('0x5')]||[];}module[_0xc09c('0x6')]=MailAccount; \ No newline at end of file +var _0x4063=['Imap','Smtp','exports','lodash','name','key','active'];(function(_0x255593,_0x1c5ee3){var _0xd4a76d=function(_0x553b27){while(--_0x553b27){_0x255593['push'](_0x255593['shift']());}};_0xd4a76d(++_0x1c5ee3);}(_0x4063,0x1ed));var _0x3406=function(_0x4ae58a,_0x72bd08){_0x4ae58a=_0x4ae58a-0x0;var _0x3c0445=_0x4063[_0x4ae58a];return _0x3c0445;};'use strict';var _=require(_0x3406('0x0'));function MailAccount(_0x3d0300){this['id']=_0x3d0300['id']||0x0;this[_0x3406('0x1')]=_0x3d0300[_0x3406('0x1')]||'Service';this[_0x3406('0x2')]=_0x3d0300[_0x3406('0x2')]||'SERV';this[_0x3406('0x3')]=_0x3d0300[_0x3406('0x3')]||![];this[_0x3406('0x4')]=_0x3d0300[_0x3406('0x4')]||[];this[_0x3406('0x5')]=_0x3d0300[_0x3406('0x5')]||[];}module[_0x3406('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8806ad9..a3e62df 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 _0x10d7=['mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined','merge','exports','lodash','mapKeys','hasOwnProperty','prototype'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x10d7,0x1bf));var _0x710d=function(_0x6adbaf,_0x5d0699){_0x6adbaf=_0x6adbaf-0x0;var _0x5eda35=_0x10d7[_0x6adbaf];return _0x5eda35;};'use strict';var _=require(_0x710d('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2a72f3,_0x1100da,_0xea671a){var _0x17671a=_[_0x710d('0x1')](_0x2a72f3,function(_0x43fa8d,_0x20f2f3){return _0x43fa8d[_0xea671a];});for(var _0xe3eb43 in _0x1100da){if(_0x1100da[_0x710d('0x2')](_0xe3eb43)){if(!_0x17671a[_0xe3eb43]){delete _0x1100da[_0xe3eb43];}}}}Realtime[_0x710d('0x3')][_0x710d('0x4')]=function(_0x8523a7,_0x43a275){for(var _0x423c95 in _0x43a275){if(_0x8523a7[_0x710d('0x2')](_0x423c95)){_0x8523a7[_0x423c95]=_0x43a275[_0x423c95];}}};Realtime[_0x710d('0x3')][_0x710d('0x5')]=function(){var _0x230498=this;return function(_0x5d1a85){if(_0x5d1a85){freeIsNotKey(_0x5d1a85,_0x230498[_0x710d('0x6')],'id');for(var _0x4a33f4=0x0,_0x39fcbc={},_0x58bee7={};_0x4a33f4<_0x5d1a85[_0x710d('0x7')];_0x4a33f4+=0x1){_0x39fcbc=_0x5d1a85[_0x4a33f4];if(_[_0x710d('0x8')](_0x230498[_0x710d('0x6')][_0x39fcbc['id']])){_0x230498[_0x710d('0x6')][_0x39fcbc['id']]=new MailAccount(_0x39fcbc);}else{_[_0x710d('0x9')](_0x230498[_0x710d('0x6')][_0x39fcbc['id']],_0x39fcbc);}}}return _0x230498[_0x710d('0x6')];};};module[_0x710d('0xa')]=Realtime; \ No newline at end of file +var _0x3bf0=['length','merge','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','initMailAccounts'];(function(_0x3e52e7,_0x3c665a){var _0x26515b=function(_0x54bef7){while(--_0x54bef7){_0x3e52e7['push'](_0x3e52e7['shift']());}};_0x26515b(++_0x3c665a);}(_0x3bf0,0xc0));var _0x03bf=function(_0xc887a4,_0xeef5e5){_0xc887a4=_0xc887a4-0x0;var _0x346274=_0x3bf0[_0xc887a4];return _0x346274;};'use strict';var _=require(_0x03bf('0x0'));var MailAccount=require(_0x03bf('0x1'));var Realtime=function(){this[_0x03bf('0x2')]={};};function freeIsNotKey(_0x6c44e0,_0x55d27a,_0x42a26e){var _0x5d16e2=_['mapKeys'](_0x6c44e0,function(_0x438523,_0x38a884){return _0x438523[_0x42a26e];});for(var _0xad6bb0 in _0x55d27a){if(_0x55d27a[_0x03bf('0x3')](_0xad6bb0)){if(!_0x5d16e2[_0xad6bb0]){delete _0x55d27a[_0xad6bb0];}}}}Realtime[_0x03bf('0x4')]['mergeFromDatabase']=function(_0x1fb370,_0x3be064){for(var _0x612769 in _0x3be064){if(_0x1fb370[_0x03bf('0x3')](_0x612769)){_0x1fb370[_0x612769]=_0x3be064[_0x612769];}}};Realtime[_0x03bf('0x4')][_0x03bf('0x5')]=function(){var _0x5f2833=this;return function(_0x3d2daf){if(_0x3d2daf){freeIsNotKey(_0x3d2daf,_0x5f2833[_0x03bf('0x2')],'id');for(var _0x3839de=0x0,_0x293245={},_0x1b2c98={};_0x3839de<_0x3d2daf[_0x03bf('0x6')];_0x3839de+=0x1){_0x293245=_0x3d2daf[_0x3839de];if(_['isUndefined'](_0x5f2833[_0x03bf('0x2')][_0x293245['id']])){_0x5f2833['mailAccounts'][_0x293245['id']]=new MailAccount(_0x293245);}else{_[_0x03bf('0x7')](_0x5f2833[_0x03bf('0x2')][_0x293245['id']],_0x293245);}}}return _0x5f2833[_0x03bf('0x2')];};};module[_0x03bf('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 6d824bc..3197b71 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 _0x4744=['ListId','Imap','CloudProvider','type','data5','Smtp','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','provider','service','email','active','key'];(function(_0x4daaa5,_0x5e7e54){var _0x547596=function(_0x319d19){while(--_0x319d19){_0x4daaa5['push'](_0x4daaa5['shift']());}};_0x547596(++_0x5e7e54);}(_0x4744,0x107));var _0x4474=function(_0x298c77,_0x333670){_0x298c77=_0x298c77-0x0;var _0x342f5b=_0x4744[_0x298c77];return _0x342f5b;};'use strict';var client=require(_0x4474('0x0'));exports[_0x4474('0x1')]=function(){return function(){return client['Request'](_0x4474('0x2'),{'options':{'attributes':['id',_0x4474('0x3'),_0x4474('0x4'),_0x4474('0x5'),_0x4474('0x6'),_0x4474('0x7'),_0x4474('0x8'),_0x4474('0x9'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x4474('0xa'),'include':[{'model':_0x4474('0xb'),'attributes':['id',_0x4474('0x3'),_0x4474('0x5'),_0x4474('0xc'),_0x4474('0xd')],'as':_0x4474('0xb')}]},{'model':'MailServerOut','as':_0x4474('0xe'),'include':[{'model':_0x4474('0xb'),'attributes':['id',_0x4474('0x3'),_0x4474('0x5'),_0x4474('0xc'),_0x4474('0xd')],'as':_0x4474('0xb')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x59c67a,_0x5f2783){return client[_0x4474('0xf')](_0x4474('0x10'),{'account':{'id':_0x59c67a},'body':_0x5f2783,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xb235=['service','email','active','key','TemplateId','MailServerIn','Imap','data5','CloudProvider','Smtp','type','getMailAccount','notify','NotifyMailAccount','GetMailAccount','name','provider'];(function(_0xa02382,_0x681641){var _0x1deffc=function(_0x247038){while(--_0x247038){_0xa02382['push'](_0xa02382['shift']());}};_0x1deffc(++_0x681641);}(_0xb235,0x10d));var _0x5b23=function(_0x2fa9ef,_0x11eb49){_0x2fa9ef=_0x2fa9ef-0x0;var _0x40a7db=_0xb235[_0x2fa9ef];return _0x40a7db;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0x5b23('0x0'),{'options':{'attributes':['id',_0x5b23('0x1'),_0x5b23('0x2'),_0x5b23('0x3'),_0x5b23('0x4'),_0x5b23('0x5'),_0x5b23('0x6'),'ListId',_0x5b23('0x7')],'raw':![],'include':[{'model':_0x5b23('0x8'),'as':_0x5b23('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x5b23('0x1'),'service','type',_0x5b23('0xa')],'as':_0x5b23('0xb')}]},{'model':'MailServerOut','as':_0x5b23('0xc'),'include':[{'model':_0x5b23('0xb'),'attributes':['id',_0x5b23('0x1'),_0x5b23('0x3'),_0x5b23('0xd'),_0x5b23('0xa')],'as':_0x5b23('0xb')}]}]},'log':_0x5b23('0xe')});};};exports[_0x5b23('0xf')]=function(_0x317d57,_0x46c971){return client['Request'](_0x5b23('0x10'),{'account':{'id':_0x317d57},'body':_0x46c971,'log':_0x5b23('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 694f881..0a808ba 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 _0x34d3=['../client','Request','ShowSetting','loginMailFrequency'];(function(_0x22a42f,_0x3295a8){var _0x5ec443=function(_0x228927){while(--_0x228927){_0x22a42f['push'](_0x22a42f['shift']());}};_0x5ec443(++_0x3295a8);}(_0x34d3,0x110));var _0x334d=function(_0x71342e,_0x319f7a){_0x71342e=_0x71342e-0x0;var _0xc788b5=_0x34d3[_0x71342e];return _0xc788b5;};'use strict';var client=require(_0x334d('0x0'));exports['getSettings']=function(){return client[_0x334d('0x1')](_0x334d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x334d('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x6c98=['getSettings','Request','loginMailFrequency','../client'];(function(_0x279742,_0x3d5924){var _0x17aaac=function(_0x2b2aeb){while(--_0x2b2aeb){_0x279742['push'](_0x279742['shift']());}};_0x17aaac(++_0x3d5924);}(_0x6c98,0xe7));var _0x86c9=function(_0x138435,_0x4cf81f){_0x138435=_0x138435-0x0;var _0x7581ac=_0x6c98[_0x138435];return _0x7581ac;};'use strict';var client=require(_0x86c9('0x0'));exports[_0x86c9('0x1')]=function(){return client[_0x86c9('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x86c9('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6174ccc..9308749 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 851118e..a421576 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 _0x32fd=['ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','../../config/triggers','../../config/socketio','default','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session'];(function(_0x520e6a,_0x261d9e){var _0x5c3fec=function(_0x8997f8){while(--_0x8997f8){_0x520e6a['push'](_0x520e6a['shift']());}};_0x5c3fec(++_0x261d9e);}(_0x32fd,0xef));var _0xd32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd32f('0x0'));var http=require(_0xd32f('0x1'));var express=require('express');var sticky=require(_0xd32f('0x2'));var Redis=require(_0xd32f('0x3'));var config=require(_0xd32f('0x4'));var app=express();var server=http[_0xd32f('0x5')](app);server[_0xd32f('0x6')]=0xdbba0;if(sticky[_0xd32f('0x7')](server,config[_0xd32f('0x8')])){var socketio=require(_0xd32f('0x9'))(server,{'transports':[_0xd32f('0xa'),'polling']});config[_0xd32f('0xb')]=_[_0xd32f('0xc')](config[_0xd32f('0xb')],{'host':_0xd32f('0xd'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xd32f('0xb')]),'subClient':new Redis(config[_0xd32f('0xb')])}));require(_0xd32f('0xe'))['default']();require(_0xd32f('0xf'))[_0xd32f('0x10')](socketio);require(_0xd32f('0x11'))[_0xd32f('0x10')](app);require('../../routes')[_0xd32f('0x10')](app);}else{server[_0xd32f('0x12')](_0xd32f('0x13'),function(){console['log'](_0xd32f('0x14'),config[_0xd32f('0x8')]);});}exports=module[_0xd32f('0x15')]=app; \ No newline at end of file +var _0x4f8d=['exports','lodash','express','sticky-session','../../config/environment','createServer','listen','port','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x186595,_0x1b90a0){var _0x1c3d59=function(_0x15666b){while(--_0x15666b){_0x186595['push'](_0x186595['shift']());}};_0x1c3d59(++_0x1b90a0);}(_0x4f8d,0x15a));var _0xd4f8=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x4f8d[_0x60286b];return _0x5dff69;};'use strict';var _=require(_0xd4f8('0x0'));var http=require('http');var express=require(_0xd4f8('0x1'));var sticky=require(_0xd4f8('0x2'));var Redis=require('ioredis');var config=require(_0xd4f8('0x3'));var app=express();var server=http[_0xd4f8('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xd4f8('0x5')](server,config[_0xd4f8('0x6')])){var socketio=require(_0xd4f8('0x7'))(server,{'transports':['websocket',_0xd4f8('0x8')]});config[_0xd4f8('0x9')]=_['defaults'](config['redis'],{'host':_0xd4f8('0xa'),'port':0x18eb});socketio[_0xd4f8('0xb')](require(_0xd4f8('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xd4f8('0x9')])}));require(_0xd4f8('0xd'))[_0xd4f8('0xe')]();require(_0xd4f8('0xf'))[_0xd4f8('0xe')](socketio);require(_0xd4f8('0x10'))[_0xd4f8('0xe')](app);require(_0xd4f8('0x11'))[_0xd4f8('0xe')](app);}else{server[_0xd4f8('0x12')](_0xd4f8('0x13'),function(){console[_0xd4f8('0x14')](_0xd4f8('0x15'),config[_0xd4f8('0x6')]);});}exports=module[_0xd4f8('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index f7d5692..ef2db39 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 _0x92fc=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92fc,0x13c));var _0xc92f=function(_0x52d231,_0x37bc71){_0x52d231=_0x52d231-0x0;var _0x550ac5=_0x92fc[_0x52d231];return _0x550ac5;};'use strict';var jayson=require(_0xc92f('0x0'));var BPromise=require(_0xc92f('0x1'));var logger=require(_0xc92f('0x2'))(_0xc92f('0x3'));var client=jayson[_0xc92f('0x4')][_0xc92f('0x5')]({'port':0x2329});client['Request']=function(_0x2b25b2,_0x1ceca8){return new BPromise(function(_0x4ca94c,_0x1740e0){return client[_0xc92f('0x6')](_0x2b25b2,_0x1ceca8)[_0xc92f('0x7')](function(_0x126a0f){logger[_0xc92f('0x8')](_0xc92f('0x9'),_0xc92f('0x3'),_0x2b25b2,_0x1ceca8,_0x126a0f);if(_0x126a0f['error']){logger[_0xc92f('0xa')]('rpc',_0xc92f('0x3'),_0x2b25b2,_0x126a0f[_0xc92f('0xa')][_0xc92f('0xb')],_0x1ceca8);return _0x1740e0(_0x126a0f[_0xc92f('0xa')]['message']);}else{return _0x4ca94c(_0x126a0f[_0xc92f('0xc')]);}})[_0xc92f('0xd')](function(_0x2b2c31){logger[_0xc92f('0xa')](_0xc92f('0x9'),_0xc92f('0x3'),_0x2b25b2,_0x2b2c31,_0x1ceca8);return _0x1740e0(_0x2b2c31);});});};module[_0xc92f('0xe')]=client; \ No newline at end of file +var _0xab3d=['client','http','debug','rpc','routing','error','message','result','catch','jayson/promise','../../config/logger'];(function(_0x5b5d84,_0xee8e96){var _0x2cde78=function(_0x5b2460){while(--_0x5b2460){_0x5b5d84['push'](_0x5b5d84['shift']());}};_0x2cde78(++_0xee8e96);}(_0xab3d,0x11c));var _0xdab3=function(_0x41308a,_0x2858fd){_0x41308a=_0x41308a-0x0;var _0x5882f3=_0xab3d[_0x41308a];return _0x5882f3;};'use strict';var jayson=require(_0xdab3('0x0'));var BPromise=require('bluebird');var logger=require(_0xdab3('0x1'))('routing');var client=jayson[_0xdab3('0x2')][_0xdab3('0x3')]({'port':0x2329});client['Request']=function(_0x49eaa3,_0x848f38){return new BPromise(function(_0x19e251,_0x3319cf){return client['request'](_0x49eaa3,_0x848f38)['then'](function(_0x3309de){logger[_0xdab3('0x4')](_0xdab3('0x5'),_0xdab3('0x6'),_0x49eaa3,_0x848f38,_0x3309de);if(_0x3309de[_0xdab3('0x7')]){logger[_0xdab3('0x7')](_0xdab3('0x5'),_0xdab3('0x6'),_0x49eaa3,_0x3309de[_0xdab3('0x7')][_0xdab3('0x8')],_0x848f38);return _0x3319cf(_0x3309de[_0xdab3('0x7')][_0xdab3('0x8')]);}else{return _0x19e251(_0x3309de[_0xdab3('0x9')]);}})[_0xdab3('0xa')](function(_0x43e794){logger['error']('rpc',_0xdab3('0x6'),_0x49eaa3,_0x43e794,_0x848f38);return _0x3319cf(_0x43e794);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 5ea7543..68dcbdc 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 _0x92d0=['bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log'];(function(_0x3c2c93,_0x29bb55){var _0x2b2c8b=function(_0x5ce8f3){while(--_0x5ce8f3){_0x3c2c93['push'](_0x3c2c93['shift']());}};_0x2b2c8b(++_0x29bb55);}(_0x92d0,0x82));var _0x092d=function(_0x581cbe,_0x36b230){_0x581cbe=_0x581cbe-0x0;var _0x57e008=_0x92d0[_0x581cbe];return _0x57e008;};'use strict';var BPromise=require(_0x092d('0x0'));var server=require(_0x092d('0x1'));var Realtime=require(_0x092d('0x2'));var user=require(_0x092d('0x3'));var interval=require(_0x092d('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x092d('0x5'));var smsQueue=require(_0x092d('0x6'));var mailQueue=require(_0x092d('0x7'));var faxQueue=require(_0x092d('0x8'));var whatsappQueue=require(_0x092d('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x092d('0xa')]()[_0x092d('0xb')](user[_0x092d('0xc')]())[_0x092d('0xb')](realtime[_0x092d('0xd')]())[_0x092d('0xb')](interval[_0x092d('0xe')]())[_0x092d('0xb')](realtime['initIntervals']())[_0x092d('0xb')](openchannelQueue['getOpenchannelQueues']())[_0x092d('0xb')](realtime['initOpenchannelQueues']())[_0x092d('0xb')](chatQueue[_0x092d('0xf')]())[_0x092d('0xb')](realtime[_0x092d('0x10')]())['then'](smsQueue[_0x092d('0x11')]())[_0x092d('0xb')](realtime[_0x092d('0x12')]())[_0x092d('0xb')](mailQueue[_0x092d('0x13')]())[_0x092d('0xb')](realtime[_0x092d('0x14')]())[_0x092d('0xb')](faxQueue[_0x092d('0x15')]())[_0x092d('0xb')](realtime['initFaxQueues']())[_0x092d('0xb')](whatsappQueue[_0x092d('0x16')]())[_0x092d('0xb')](realtime[_0x092d('0x17')]())[_0x092d('0xb')](function(){return realtime;});}function main(){return server[_0x092d('0x18')](realtime)[_0x092d('0xb')](function(_0x56cb66){return initRealtime();})[_0x092d('0xb')](function(_0x309e15){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3d89c7){console[_0x092d('0x19')](_0x3d89c7);});}main(); \ No newline at end of file +var _0x9051=['getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','initMailQueues'];(function(_0x48c8dc,_0x175d24){var _0x2fb966=function(_0x1d7fe0){while(--_0x1d7fe0){_0x48c8dc['push'](_0x48c8dc['shift']());}};_0x2fb966(++_0x175d24);}(_0x9051,0x8f));var _0x1905=function(_0x2cd816,_0x5b6de8){_0x2cd816=_0x2cd816-0x0;var _0x19db27=_0x9051[_0x2cd816];return _0x19db27;};'use strict';var BPromise=require('bluebird');var server=require(_0x1905('0x0'));var Realtime=require(_0x1905('0x1'));var user=require(_0x1905('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x1905('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x1905('0x4'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x1905('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1905('0x6')]()[_0x1905('0x7')](user[_0x1905('0x8')]())[_0x1905('0x7')](realtime[_0x1905('0x9')]())[_0x1905('0x7')](interval[_0x1905('0xa')]())[_0x1905('0x7')](realtime[_0x1905('0xb')]())[_0x1905('0x7')](openchannelQueue[_0x1905('0xc')]())[_0x1905('0x7')](realtime[_0x1905('0xd')]())[_0x1905('0x7')](chatQueue[_0x1905('0xe')]())['then'](realtime['initChatQueues']())[_0x1905('0x7')](smsQueue[_0x1905('0xf')]())[_0x1905('0x7')](realtime[_0x1905('0x10')]())[_0x1905('0x7')](mailQueue['getMailQueues']())[_0x1905('0x7')](realtime[_0x1905('0x11')]())[_0x1905('0x7')](faxQueue[_0x1905('0x12')]())[_0x1905('0x7')](realtime['initFaxQueues']())[_0x1905('0x7')](whatsappQueue[_0x1905('0x13')]())[_0x1905('0x7')](realtime[_0x1905('0x14')]())[_0x1905('0x7')](function(){return realtime;});}function main(){return server[_0x1905('0x15')](realtime)[_0x1905('0x7')](function(_0x38cf20){return initRealtime();})[_0x1905('0x7')](function(_0x1df1be){return setInterval(initRealtime,0x1388);})[_0x1905('0x16')](function(_0x1e6d5c){console['log'](_0x1e6d5c);});}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 676a15a..6c29f00 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x356f83,_0x4b6fa7){var _0x35d5c9=function(_0xd110c0){while(--_0xd110c0){_0x356f83['push'](_0x356f83['shift']());}};_0x35d5c9(++_0x4b6fa7);}(_0x814b,0x1a2));var _0xb814=function(_0x1e7345,_0x18bcce){_0x1e7345=_0x1e7345-0x0;var _0x33017c=_0x814b[_0x1e7345];return _0x33017c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0xa4f047,_0x30cffe){var _0x280a03=function(_0x1c4c36){while(--_0x1c4c36){_0xa4f047['push'](_0xa4f047['shift']());}};_0x280a03(++_0x30cffe);}(_0x5fc3,0xa8));var _0x35fc=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x5fc3[_0x506d2f];return _0x101255;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 9ee1555..be35a0d 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 _0xd109=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error'];(function(_0x3b0948,_0x1b8bab){var _0x110d79=function(_0x553d0e){while(--_0x553d0e){_0x3b0948['push'](_0x3b0948['shift']());}};_0x110d79(++_0x1b8bab);}(_0xd109,0x144));var _0x9d10=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xd109[_0x1589dd];return _0x1bddd1;};'use strict';var BPromise=require(_0x9d10('0x0'));var jayson=require(_0x9d10('0x1'));var client=jayson[_0x9d10('0x2')][_0x9d10('0x3')]({'port':0x232b});function request(_0x47d01a,_0x106162){return new BPromise(function(_0x390c7d,_0x34f750){return client['request'](_0x47d01a,_0x106162)[_0x9d10('0x4')](function(_0x5b4fe3){if(_0x5b4fe3[_0x9d10('0x5')]){return _0x34f750(_0x5b4fe3[_0x9d10('0x5')][_0x9d10('0x6')]);}else{return _0x390c7d(_0x5b4fe3[_0x9d10('0x7')]);}})[_0x9d10('0x8')](function(_0xf00e85){return _0x34f750(_0xf00e85);});});}exports[_0x9d10('0x9')]=function(_0x564522,_0x3d780c){return request(_0x9d10('0xa'),{'account':_0x564522,'message':_0x3d780c});}; \ No newline at end of file +var _0xf580=['catch','SendMail','bluebird','client','error','message','result'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0xf580,0x1d7));var _0x0f58=function(_0x75b8ce,_0x3ba174){_0x75b8ce=_0x75b8ce-0x0;var _0x8993c6=_0xf580[_0x75b8ce];return _0x8993c6;};'use strict';var BPromise=require(_0x0f58('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x0f58('0x1')]['http']({'port':0x232b});function request(_0x1dd50a,_0x2d581c){return new BPromise(function(_0x15827f,_0x40c5b9){return client['request'](_0x1dd50a,_0x2d581c)['then'](function(_0x22c58b){if(_0x22c58b[_0x0f58('0x2')]){return _0x40c5b9(_0x22c58b[_0x0f58('0x2')][_0x0f58('0x3')]);}else{return _0x15827f(_0x22c58b[_0x0f58('0x4')]);}})[_0x0f58('0x5')](function(_0x1276cc){return _0x40c5b9(_0x1276cc);});});}exports['sendMailMessage']=function(_0xd6793a,_0x21c55a){return request(_0x0f58('0x6'),{'account':_0xd6793a,'message':_0x21c55a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3726342..53c121b 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 _0x4e2e=['mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','chat','openchannel','fax','whatsapp','length','StatusTime','toNumber','Status','mailStatusTime','emit','user:routing:update','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x263b9a,_0x12dd64){var _0x2151cf=function(_0x4a1b2e){while(--_0x4a1b2e){_0x263b9a['push'](_0x263b9a['shift']());}};_0x2151cf(++_0x12dd64);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x55b087,_0x5a4ac3){_0x55b087=_0x55b087-0x0;var _0x48bd99=_0x4e2e[_0x55b087];return _0x48bd99;};'use strict';var _=require('lodash');var md5=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var Redis=require(_0xe4e2('0x2'));var config=require(_0xe4e2('0x3'));config[_0xe4e2('0x4')]=_[_0xe4e2('0x5')](config['redis'],{'host':_0xe4e2('0x6'),'port':0x18eb});var io=require(_0xe4e2('0x7'))(new Redis(config[_0xe4e2('0x4')]));function Agent(_0x38c84c){this['id']=_0x38c84c['id']||0x0;this['name']=_0x38c84c[_0xe4e2('0x8')]||'';this[_0xe4e2('0x9')]=_0x38c84c[_0xe4e2('0x9')]||!![];this[_0xe4e2('0xa')]=_0x38c84c[_0xe4e2('0xa')]||![];this[_0xe4e2('0xb')]=_0x38c84c[_0xe4e2('0xb')]||![];this[_0xe4e2('0xc')]=_0x38c84c['mailPause']||![];this[_0xe4e2('0xd')]=_0x38c84c[_0xe4e2('0xd')]||![];this[_0xe4e2('0xe')]=_0x38c84c['smsPause']||![];this[_0xe4e2('0xf')]=_0x38c84c[_0xe4e2('0xf')]||![];this[_0xe4e2('0x10')]=_0xe4e2('0x11');this[_0xe4e2('0x12')]=0x0;this['chatCapacity']=_0x38c84c[_0xe4e2('0x13')]||0x0;this[_0xe4e2('0x14')]=0x0;this[_0xe4e2('0x15')]=_0xe4e2('0x11');this['mailStatusTime']=0x0;this[_0xe4e2('0x16')]=_0x38c84c[_0xe4e2('0x16')]||0x0;this[_0xe4e2('0x17')]=0x0;this[_0xe4e2('0x18')]=_0xe4e2('0x11');this['faxStatusTime']=0x0;this['faxCapacity']=_0x38c84c[_0xe4e2('0x19')]||0x0;this[_0xe4e2('0x1a')]=0x0;this[_0xe4e2('0x1b')]=_0xe4e2('0x11');this[_0xe4e2('0x1c')]=0x0;this['smsCapacity']=_0x38c84c[_0xe4e2('0x1d')]||0x0;this[_0xe4e2('0x1e')]=0x0;this[_0xe4e2('0x1f')]='unknown';this[_0xe4e2('0x20')]=0x0;this['whatsappCapacity']=_0x38c84c[_0xe4e2('0x21')]||0x0;this[_0xe4e2('0x22')]=0x0;this[_0xe4e2('0x23')]=_0xe4e2('0x11');this[_0xe4e2('0x24')]=0x0;this[_0xe4e2('0x25')]=_0x38c84c[_0xe4e2('0x25')]||0x0;this[_0xe4e2('0x26')]=0x0;this[_0xe4e2('0x27')]=![];this[_0xe4e2('0x28')]=undefined;this['md5']='';this[_0xe4e2('0x29')]={};this[_0xe4e2('0x2a')]={};this[_0xe4e2('0x2b')]={};this[_0xe4e2('0x2c')]={};this[_0xe4e2('0x2d')]={};this[_0xe4e2('0x2e')]={};this[_0xe4e2('0x2f')]();}Agent['prototype'][_0xe4e2('0x30')]=function(_0x2ab435){if(this[_0x2ab435+_0xe4e2('0x31')]>0x0){if(this[_0x2ab435+'Capacity']>0x0&&this[_0x2ab435+_0xe4e2('0x31')]>=this[_0x2ab435+_0xe4e2('0x32')]){return'maxcapacity';}else{return _0xe4e2('0x33');}}else{return _0xe4e2('0x34');}};Agent[_0xe4e2('0x35')][_0xe4e2('0x2f')]=function(){var _0x249b7e=['mail',_0xe4e2('0x36'),_0xe4e2('0x37'),_0xe4e2('0x38'),'sms',_0xe4e2('0x39')];for(var _0x41cfd9=0x0;_0x41cfd9<_0x249b7e[_0xe4e2('0x3a')];_0x41cfd9+=0x1){var _0x5ec692=this[_0xe4e2('0x30')](_0x249b7e[_0x41cfd9]);if(this[_0x249b7e[_0x41cfd9]+'Status']!==_0x5ec692){this[_0x249b7e[_0x41cfd9]+_0xe4e2('0x3b')]=_[_0xe4e2('0x3c')](moment()['format']('x'));}this[_0x249b7e[_0x41cfd9]+_0xe4e2('0x3d')]=_0x5ec692;}var _0x18e2e5={'id':this['id'],'name':this[_0xe4e2('0x8')],'online':this[_0xe4e2('0x9')],'voicePause':this[_0xe4e2('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xe4e2('0xe')],'faxPause':this[_0xe4e2('0xd')],'openchannelPause':this[_0xe4e2('0xf')],'chatStatus':this[_0xe4e2('0x10')],'chatStatusTime':this[_0xe4e2('0x12')],'chatCapacity':this[_0xe4e2('0x13')],'chatCurrentCapacity':this[_0xe4e2('0x14')],'mailStatus':this[_0xe4e2('0x15')],'mailStatusTime':this[_0xe4e2('0x3e')],'mailCapacity':this[_0xe4e2('0x16')],'mailCurrentCapacity':this[_0xe4e2('0x17')],'faxStatus':this[_0xe4e2('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xe4e2('0x19')],'faxCurrentCapacity':this[_0xe4e2('0x1a')],'smsStatus':this[_0xe4e2('0x1b')],'smsStatusTime':this[_0xe4e2('0x1c')],'smsCapacity':this[_0xe4e2('0x1d')],'smsCurrentCapacity':this[_0xe4e2('0x1e')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xe4e2('0x20')],'whatsappCapacity':this[_0xe4e2('0x21')],'whatsappCurrentCapacity':this[_0xe4e2('0x22')],'openchannelStatus':this[_0xe4e2('0x23')],'openchannelStatusTime':this[_0xe4e2('0x24')],'openchannelCapacity':this[_0xe4e2('0x25')],'openchannelCurrentCapacity':this[_0xe4e2('0x26')],'busy':this[_0xe4e2('0x27')],'busyQueue':this[_0xe4e2('0x28')],'chatWaitingInteractions':this[_0xe4e2('0x29')],'faxWaitingInteractions':this[_0xe4e2('0x2a')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xe4e2('0x2c')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xe4e2('0x2e')]};var _0x2cd933=md5(JSON['stringify'](_0x18e2e5));if(this[_0xe4e2('0x0')]!==_0x2cd933){this[_0xe4e2('0x0')]=_0x2cd933;io[_0xe4e2('0x3f')](_0xe4e2('0x40'),_['omit'](_0x18e2e5,[_0xe4e2('0x9')]));}};module['exports']=Agent; \ No newline at end of file +var _0xdb28=['user:routing:update','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','idle','mail','chat','fax','sms','whatsapp','Status','StatusTime','toNumber','format','mailStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelCurrentCapacity','stringify'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xdb28,0x106));var _0x8db2=function(_0x3210c7,_0x11fb23){_0x3210c7=_0x3210c7-0x0;var _0xe90fc=_0xdb28[_0x3210c7];return _0xe90fc;};'use strict';var _=require(_0x8db2('0x0'));var md5=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var Redis=require(_0x8db2('0x3'));var config=require('../../../config/environment');config[_0x8db2('0x4')]=_[_0x8db2('0x5')](config[_0x8db2('0x4')],{'host':_0x8db2('0x6'),'port':0x18eb});var io=require(_0x8db2('0x7'))(new Redis(config['redis']));function Agent(_0x21a03e){this['id']=_0x21a03e['id']||0x0;this[_0x8db2('0x8')]=_0x21a03e['name']||'';this['online']=_0x21a03e[_0x8db2('0x9')]||!![];this[_0x8db2('0xa')]=_0x21a03e[_0x8db2('0xa')]||![];this[_0x8db2('0xb')]=_0x21a03e[_0x8db2('0xb')]||![];this[_0x8db2('0xc')]=_0x21a03e[_0x8db2('0xc')]||![];this['faxPause']=_0x21a03e[_0x8db2('0xd')]||![];this[_0x8db2('0xe')]=_0x21a03e[_0x8db2('0xe')]||![];this['openchannelPause']=_0x21a03e[_0x8db2('0xf')]||![];this[_0x8db2('0x10')]='unknown';this[_0x8db2('0x11')]=0x0;this[_0x8db2('0x12')]=_0x21a03e[_0x8db2('0x12')]||0x0;this[_0x8db2('0x13')]=0x0;this[_0x8db2('0x14')]='unknown';this['mailStatusTime']=0x0;this[_0x8db2('0x15')]=_0x21a03e[_0x8db2('0x15')]||0x0;this[_0x8db2('0x16')]=0x0;this[_0x8db2('0x17')]=_0x8db2('0x18');this[_0x8db2('0x19')]=0x0;this[_0x8db2('0x1a')]=_0x21a03e[_0x8db2('0x1a')]||0x0;this[_0x8db2('0x1b')]=0x0;this[_0x8db2('0x1c')]='unknown';this[_0x8db2('0x1d')]=0x0;this[_0x8db2('0x1e')]=_0x21a03e['smsCapacity']||0x0;this[_0x8db2('0x1f')]=0x0;this[_0x8db2('0x20')]=_0x8db2('0x18');this[_0x8db2('0x21')]=0x0;this[_0x8db2('0x22')]=_0x21a03e[_0x8db2('0x22')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x8db2('0x18');this[_0x8db2('0x23')]=0x0;this[_0x8db2('0x24')]=_0x21a03e[_0x8db2('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8db2('0x25')]=![];this[_0x8db2('0x26')]=undefined;this[_0x8db2('0x1')]='';this[_0x8db2('0x27')]={};this[_0x8db2('0x28')]={};this['mailWaitingInteractions']={};this[_0x8db2('0x29')]={};this[_0x8db2('0x2a')]={};this[_0x8db2('0x2b')]={};this[_0x8db2('0x2c')]();}Agent[_0x8db2('0x2d')][_0x8db2('0x2e')]=function(_0x796ec1){if(this[_0x796ec1+'CurrentCapacity']>0x0){if(this[_0x796ec1+_0x8db2('0x2f')]>0x0&&this[_0x796ec1+'CurrentCapacity']>=this[_0x796ec1+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0x8db2('0x30');}};Agent[_0x8db2('0x2d')][_0x8db2('0x2c')]=function(){var _0x2baed0=[_0x8db2('0x31'),_0x8db2('0x32'),'openchannel',_0x8db2('0x33'),_0x8db2('0x34'),_0x8db2('0x35')];for(var _0x8b7cec=0x0;_0x8b7cec<_0x2baed0['length'];_0x8b7cec+=0x1){var _0x2e0691=this[_0x8db2('0x2e')](_0x2baed0[_0x8b7cec]);if(this[_0x2baed0[_0x8b7cec]+_0x8db2('0x36')]!==_0x2e0691){this[_0x2baed0[_0x8b7cec]+_0x8db2('0x37')]=_[_0x8db2('0x38')](moment()[_0x8db2('0x39')]('x'));}this[_0x2baed0[_0x8b7cec]+_0x8db2('0x36')]=_0x2e0691;}var _0x3124d5={'id':this['id'],'name':this[_0x8db2('0x8')],'online':this['online'],'voicePause':this[_0x8db2('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x8db2('0xe')],'faxPause':this[_0x8db2('0xd')],'openchannelPause':this[_0x8db2('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x8db2('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x8db2('0x13')],'mailStatus':this[_0x8db2('0x14')],'mailStatusTime':this[_0x8db2('0x3a')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x8db2('0x17')],'faxStatusTime':this[_0x8db2('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x8db2('0x1c')],'smsStatusTime':this[_0x8db2('0x1d')],'smsCapacity':this[_0x8db2('0x1e')],'smsCurrentCapacity':this[_0x8db2('0x1f')],'whatsappStatus':this[_0x8db2('0x20')],'whatsappStatusTime':this[_0x8db2('0x21')],'whatsappCapacity':this[_0x8db2('0x22')],'whatsappCurrentCapacity':this[_0x8db2('0x3b')],'openchannelStatus':this[_0x8db2('0x3c')],'openchannelStatusTime':this[_0x8db2('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8db2('0x3d')],'busy':this[_0x8db2('0x25')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x8db2('0x27')],'faxWaitingInteractions':this[_0x8db2('0x28')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x8db2('0x2a')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x3dfbaa=md5(JSON[_0x8db2('0x3e')](_0x3124d5));if(this[_0x8db2('0x1')]!==_0x3dfbaa){this[_0x8db2('0x1')]=_0x3dfbaa;io['emit'](_0x8db2('0x3f'),_['omit'](_0x3124d5,[_0x8db2('0x9')]));}};module[_0x8db2('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index f4ba35e..8a9fcdf 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 _0xfe93=['loggedIn','length','online','paused','available','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map'];(function(_0x3ed967,_0x955d93){var _0x418592=function(_0x527198){while(--_0x527198){_0x3ed967['push'](_0x3ed967['shift']());}};_0x418592(++_0x955d93);}(_0xfe93,0x15b));var _0x3fe9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfe93[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var md5=require(_0x3fe9('0x0'));var util=require(_0x3fe9('0x1'));var Redis=require(_0x3fe9('0x2'));var config=require(_0x3fe9('0x3'));config['redis']=_[_0x3fe9('0x4')](config[_0x3fe9('0x5')],{'host':_0x3fe9('0x6'),'port':0x18eb});var io=require(_0x3fe9('0x7'))(new Redis(config['redis']));function ChatQueue(_0x5ba3bc){this['id']=_0x5ba3bc['id']||0x0;this['name']=_0x5ba3bc[_0x3fe9('0x8')]||'';this['timeout']=_0x5ba3bc['timeout']||0xa;this[_0x3fe9('0x9')]=_0x5ba3bc[_0x3fe9('0x9')]||'beepall';this[_0x3fe9('0xa')]=_0x5ba3bc['Agents'];this[_0x3fe9('0xb')]={};this[_0x3fe9('0xc')]=0x0;this[_0x3fe9('0x0')]='';this[_0x3fe9('0xd')]();this[_0x3fe9('0xe')]();}ChatQueue[_0x3fe9('0xf')]['updateRouting']=function(){var _0x3423e5=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x3fe9('0x10')](this[_0x3fe9('0xa')],'id');this[_0x3fe9('0xb')]['_rr']=_0x3423e5;};ChatQueue['prototype'][_0x3fe9('0xe')]=function(){this[_0x3fe9('0x11')]=0x0;this['paused']=0x0;for(var _0x1a7dcd=0x0;_0x1a7dcd=0x0?this[_0x3fe9('0x15')]:0x0;var _0x40546b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x3fe9('0x8')],'paused':this[_0x3fe9('0x14')],'waiting':this[_0x3fe9('0xc')]};var _0x551a8a=md5(JSON['stringify'](_0x40546b));if(this['md5']!==_0x551a8a){this[_0x3fe9('0x0')]=_0x551a8a;io['to'](util['format'](_0x3fe9('0x16'),_0x40546b[_0x3fe9('0x8')]))[_0x3fe9('0x17')](_0x3fe9('0x18'),_0x40546b);}};module[_0x3fe9('0x19')]=ChatQueue; \ No newline at end of file +var _0x6798=['md5','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','length','chatPause','paused','available','stringify','format','emit','exports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6798,0x67));var _0x8679=function(_0x252ddb,_0x418945){_0x252ddb=_0x252ddb-0x0;var _0x6a1a90=_0x6798[_0x252ddb];return _0x6a1a90;};'use strict';var _=require(_0x8679('0x0'));var md5=require(_0x8679('0x1'));var util=require(_0x8679('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x8679('0x3')]=_['defaults'](config[_0x8679('0x3')],{'host':_0x8679('0x4'),'port':0x18eb});var io=require(_0x8679('0x5'))(new Redis(config[_0x8679('0x3')]));function ChatQueue(_0x5901ba){this['id']=_0x5901ba['id']||0x0;this[_0x8679('0x6')]=_0x5901ba[_0x8679('0x6')]||'';this[_0x8679('0x7')]=_0x5901ba[_0x8679('0x7')]||0xa;this[_0x8679('0x8')]=_0x5901ba[_0x8679('0x8')]||_0x8679('0x9');this[_0x8679('0xa')]=_0x5901ba[_0x8679('0xa')];this[_0x8679('0xb')]={};this[_0x8679('0xc')]=0x0;this[_0x8679('0x1')]='';this['updateRouting']();this[_0x8679('0xd')]();}ChatQueue[_0x8679('0xe')]['updateRouting']=function(){var _0x4735cc=this[_0x8679('0xb')][_0x8679('0xf')];this[_0x8679('0xb')]=_[_0x8679('0x10')](this[_0x8679('0xa')],'id');this['mapAgentsId'][_0x8679('0xf')]=_0x4735cc;};ChatQueue[_0x8679('0xe')][_0x8679('0xd')]=function(){this[_0x8679('0x11')]=0x0;this['paused']=0x0;for(var _0x23f07c=0x0;_0x23f07c=0x0?this['available']:0x0;var _0x5e81c5={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x8679('0x6')],'paused':this['paused'],'waiting':this[_0x8679('0xc')]};var _0x45b700=md5(JSON[_0x8679('0x16')](_0x5e81c5));if(this['md5']!==_0x45b700){this[_0x8679('0x1')]=_0x45b700;io['to'](util[_0x8679('0x17')]('chat:queue:%s',_0x5e81c5['name']))[_0x8679('0x18')]('chat_queue:save',_0x5e81c5);}};module[_0x8679('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4a59ede..5806d6e 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 _0xb568=['defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','_rr','map','mapAgentsId','loggedIn','paused','length','online','faxPause','available','stringify','format','emit','fax_queue:save','exports','md5','util','ioredis'];(function(_0x50a635,_0x158de3){var _0x15fcdf=function(_0x16342e){while(--_0x16342e){_0x50a635['push'](_0x50a635['shift']());}};_0x15fcdf(++_0x158de3);}(_0xb568,0x93));var _0x8b56=function(_0x4f8258,_0x18fe18){_0x4f8258=_0x4f8258-0x0;var _0x2882f9=_0xb568[_0x4f8258];return _0x2882f9;};'use strict';var _=require('lodash');var md5=require(_0x8b56('0x0'));var util=require(_0x8b56('0x1'));var Redis=require(_0x8b56('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x8b56('0x3')](config[_0x8b56('0x4')],{'host':_0x8b56('0x5'),'port':0x18eb});var io=require(_0x8b56('0x6'))(new Redis(config[_0x8b56('0x4')]));function FaxQueue(_0x483090){this['id']=_0x483090['id']||0x0;this[_0x8b56('0x7')]=_0x483090[_0x8b56('0x7')]||'';this['timeout']=_0x483090[_0x8b56('0x8')]||0xa;this[_0x8b56('0x9')]=_0x483090[_0x8b56('0x9')]||_0x8b56('0xa');this['Agents']=_0x483090[_0x8b56('0xb')];this['mapAgentsId']={};this[_0x8b56('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x8b56('0xd')]();}FaxQueue[_0x8b56('0xe')][_0x8b56('0xf')]=function(){var _0x15204c=this['mapAgentsId'][_0x8b56('0x10')];this['mapAgentsId']=_[_0x8b56('0x11')](this[_0x8b56('0xb')],'id');this[_0x8b56('0x12')][_0x8b56('0x10')]=_0x15204c;};FaxQueue[_0x8b56('0xe')][_0x8b56('0xd')]=function(){this[_0x8b56('0x13')]=0x0;this[_0x8b56('0x14')]=0x0;for(var _0xa82911=0x0;_0xa82911=0x0?this['available']:0x0;var _0x36c7c3={'id':this['id'],'available':this[_0x8b56('0x18')],'loggedIn':this[_0x8b56('0x13')],'name':this[_0x8b56('0x7')],'paused':this[_0x8b56('0x14')],'waiting':this[_0x8b56('0xc')]};var _0x155add=md5(JSON[_0x8b56('0x19')](_0x36c7c3));if(this['md5']!==_0x155add){this['md5']=_0x155add;io['to'](util[_0x8b56('0x1a')]('fax:queue:%s',_0x36c7c3[_0x8b56('0x7')]))[_0x8b56('0x1b')](_0x8b56('0x1c'),_0x36c7c3);}};module[_0x8b56('0x1d')]=FaxQueue; \ No newline at end of file +var _0xf3d1=['available','stringify','format','emit','fax_queue:save','exports','lodash','util','ioredis','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','faxPause','paused'];(function(_0x55daf2,_0x1b48de){var _0x1c8500=function(_0x4686b5){while(--_0x4686b5){_0x55daf2['push'](_0x55daf2['shift']());}};_0x1c8500(++_0x1b48de);}(_0xf3d1,0xbc));var _0x1f3d=function(_0x43e19a,_0x3127f2){_0x43e19a=_0x43e19a-0x0;var _0x35099e=_0xf3d1[_0x43e19a];return _0x35099e;};'use strict';var _=require(_0x1f3d('0x0'));var md5=require('md5');var util=require(_0x1f3d('0x1'));var Redis=require(_0x1f3d('0x2'));var config=require('../../../config/environment');config[_0x1f3d('0x3')]=_['defaults'](config['redis'],{'host':_0x1f3d('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1f3d('0x3')]));function FaxQueue(_0x35c0a9){this['id']=_0x35c0a9['id']||0x0;this[_0x1f3d('0x5')]=_0x35c0a9[_0x1f3d('0x5')]||'';this[_0x1f3d('0x6')]=_0x35c0a9[_0x1f3d('0x6')]||0xa;this[_0x1f3d('0x7')]=_0x35c0a9[_0x1f3d('0x7')]||'beepall';this[_0x1f3d('0x8')]=_0x35c0a9[_0x1f3d('0x8')];this[_0x1f3d('0x9')]={};this[_0x1f3d('0xa')]=0x0;this[_0x1f3d('0xb')]='';this[_0x1f3d('0xc')]();this[_0x1f3d('0xd')]();}FaxQueue[_0x1f3d('0xe')]['updateRouting']=function(){var _0x2438c9=this[_0x1f3d('0x9')][_0x1f3d('0xf')];this['mapAgentsId']=_[_0x1f3d('0x10')](this[_0x1f3d('0x8')],'id');this[_0x1f3d('0x9')]['_rr']=_0x2438c9;};FaxQueue['prototype'][_0x1f3d('0xd')]=function(){this[_0x1f3d('0x11')]=0x0;this['paused']=0x0;for(var _0x1af6fd=0x0;_0x1af6fd=0x0?this[_0x1f3d('0x14')]:0x0;var _0xeb63f3={'id':this['id'],'available':this[_0x1f3d('0x14')],'loggedIn':this[_0x1f3d('0x11')],'name':this[_0x1f3d('0x5')],'paused':this['paused'],'waiting':this['waiting']};var _0x2e7965=md5(JSON[_0x1f3d('0x15')](_0xeb63f3));if(this[_0x1f3d('0xb')]!==_0x2e7965){this['md5']=_0x2e7965;io['to'](util[_0x1f3d('0x16')]('fax:queue:%s',_0xeb63f3[_0x1f3d('0x5')]))[_0x1f3d('0x17')](_0x1f3d('0x18'),_0xeb63f3);}};module[_0x1f3d('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d949acf..57f589c 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 _0xfc43=['exports','name','Intervals'];(function(_0x4f3dc3,_0x21b289){var _0x19641f=function(_0x1c6d2a){while(--_0x1c6d2a){_0x4f3dc3['push'](_0x4f3dc3['shift']());}};_0x19641f(++_0x21b289);}(_0xfc43,0x18d));var _0x3fc4=function(_0x294865,_0x456f68){_0x294865=_0x294865-0x0;var _0x3c9356=_0xfc43[_0x294865];return _0x3c9356;};'use strict';function Interval(_0x10fdee){this['id']=_0x10fdee['id']||0x0;this['name']=_0x10fdee[_0x3fc4('0x0')]||'';this[_0x3fc4('0x1')]=_0x10fdee[_0x3fc4('0x1')]||{};}module[_0x3fc4('0x2')]=Interval; \ No newline at end of file +var _0xea56=['name','Intervals','exports'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xea56,0x132));var _0x6ea5=function(_0x2f1d2f,_0x527d85){_0x2f1d2f=_0x2f1d2f-0x0;var _0x2874cf=_0xea56[_0x2f1d2f];return _0x2874cf;};'use strict';function Interval(_0x1e6e1b){this['id']=_0x1e6e1b['id']||0x0;this['name']=_0x1e6e1b[_0x6ea5('0x0')]||'';this[_0x6ea5('0x1')]=_0x1e6e1b[_0x6ea5('0x1')]||{};}module[_0x6ea5('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 45a4ff3..14cd5e9 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 _0xc8fc=['updateRouting','updateRealtime','prototype','map','_rr','paused','length','loggedIn','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x1d49ef,_0x544121){var _0x2f9c0e=function(_0x121b35){while(--_0x121b35){_0x1d49ef['push'](_0x1d49ef['shift']());}};_0x2f9c0e(++_0x544121);}(_0xc8fc,0x87));var _0xcc8f=function(_0x2312a3,_0x28e8f7){_0x2312a3=_0x2312a3-0x0;var _0x3163e3=_0xc8fc[_0x2312a3];return _0x3163e3;};'use strict';var _=require(_0xcc8f('0x0'));var md5=require(_0xcc8f('0x1'));var util=require(_0xcc8f('0x2'));var Redis=require(_0xcc8f('0x3'));var config=require(_0xcc8f('0x4'));config[_0xcc8f('0x5')]=_['defaults'](config[_0xcc8f('0x5')],{'host':_0xcc8f('0x6'),'port':0x18eb});var io=require(_0xcc8f('0x7'))(new Redis(config['redis']));function MailQueue(_0x47d2ee){this['id']=_0x47d2ee['id']||0x0;this[_0xcc8f('0x8')]=_0x47d2ee[_0xcc8f('0x8')]||'';this['timeout']=_0x47d2ee[_0xcc8f('0x9')]||0xa;this[_0xcc8f('0xa')]=_0x47d2ee[_0xcc8f('0xa')]||_0xcc8f('0xb');this[_0xcc8f('0xc')]=_0x47d2ee[_0xcc8f('0xc')];this[_0xcc8f('0xd')]={};this[_0xcc8f('0xe')]=0x0;this[_0xcc8f('0x1')]='';this[_0xcc8f('0xf')]();this[_0xcc8f('0x10')]();}MailQueue[_0xcc8f('0x11')][_0xcc8f('0xf')]=function(){var _0x2b535d=this[_0xcc8f('0xd')]['_rr'];this['mapAgentsId']=_[_0xcc8f('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xcc8f('0x13')]=_0x2b535d;};MailQueue[_0xcc8f('0x11')][_0xcc8f('0x10')]=function(){this['loggedIn']=0x0;this[_0xcc8f('0x14')]=0x0;for(var _0x215017=0x0;_0x215017=0x0?this[_0xcc8f('0x18')]:0x0;var _0x161f10={'id':this['id'],'available':this[_0xcc8f('0x18')],'loggedIn':this[_0xcc8f('0x16')],'name':this[_0xcc8f('0x8')],'paused':this[_0xcc8f('0x14')],'waiting':this[_0xcc8f('0xe')]};var _0x37309e=md5(JSON[_0xcc8f('0x19')](_0x161f10));if(this[_0xcc8f('0x1')]!==_0x37309e){this['md5']=_0x37309e;io['to'](util['format'](_0xcc8f('0x1a'),_0x161f10['name']))[_0xcc8f('0x1b')](_0xcc8f('0x1c'),_0x161f10);}};module[_0xcc8f('0x1d')]=MailQueue; \ No newline at end of file +var _0x1258=['loggedIn','mailPause','paused','available','mail:queue:%s','mail_queue:save','exports','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','updateRouting','_rr','mapAgentsId','map','prototype','length','online'];(function(_0x4b0de9,_0x128b9b){var _0xb9e0e9=function(_0x1928d8){while(--_0x1928d8){_0x4b0de9['push'](_0x4b0de9['shift']());}};_0xb9e0e9(++_0x128b9b);}(_0x1258,0x1e3));var _0x8125=function(_0x4d1349,_0x2e9efd){_0x4d1349=_0x4d1349-0x0;var _0x5b0fcc=_0x1258[_0x4d1349];return _0x5b0fcc;};'use strict';var _=require('lodash');var md5=require(_0x8125('0x0'));var util=require(_0x8125('0x1'));var Redis=require('ioredis');var config=require(_0x8125('0x2'));config[_0x8125('0x3')]=_[_0x8125('0x4')](config['redis'],{'host':_0x8125('0x5'),'port':0x18eb});var io=require(_0x8125('0x6'))(new Redis(config[_0x8125('0x3')]));function MailQueue(_0x5abdfb){this['id']=_0x5abdfb['id']||0x0;this[_0x8125('0x7')]=_0x5abdfb['name']||'';this['timeout']=_0x5abdfb[_0x8125('0x8')]||0xa;this[_0x8125('0x9')]=_0x5abdfb['strategy']||_0x8125('0xa');this['Agents']=_0x5abdfb[_0x8125('0xb')];this['mapAgentsId']={};this[_0x8125('0xc')]=0x0;this[_0x8125('0x0')]='';this['updateRouting']();this[_0x8125('0xd')]();}MailQueue['prototype'][_0x8125('0xe')]=function(){var _0x3de74d=this['mapAgentsId'][_0x8125('0xf')];this[_0x8125('0x10')]=_[_0x8125('0x11')](this['Agents'],'id');this[_0x8125('0x10')][_0x8125('0xf')]=_0x3de74d;};MailQueue[_0x8125('0x12')][_0x8125('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2c26b3=0x0;_0x2c26b3=0x0?this[_0x8125('0x18')]:0x0;var _0x23df77={'id':this['id'],'available':this[_0x8125('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x8125('0x7')],'paused':this[_0x8125('0x17')],'waiting':this['waiting']};var _0x3ed6b4=md5(JSON['stringify'](_0x23df77));if(this[_0x8125('0x0')]!==_0x3ed6b4){this[_0x8125('0x0')]=_0x3ed6b4;io['to'](util['format'](_0x8125('0x19'),_0x23df77[_0x8125('0x7')]))['emit'](_0x8125('0x1a'),_0x23df77);}};module[_0x8125('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d4b091b..50e8833 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x5ece84,_0xc06c9f){var _0x2a12c4=function(_0x133bf3){while(--_0x133bf3){_0x5ece84['push'](_0x5ece84['shift']());}};_0x2a12c4(++_0xc06c9f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x5fc3[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7f27dd2..a57b9f1 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 _0x9234=['length','online','smsPause','paused','available','stringify','md5','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x9234,0x1bd));var _0x4923=function(_0x54c695,_0x5d6677){_0x54c695=_0x54c695-0x0;var _0x3ce06b=_0x9234[_0x54c695];return _0x3ce06b;};'use strict';var _=require(_0x4923('0x0'));var md5=require('md5');var util=require(_0x4923('0x1'));var Redis=require(_0x4923('0x2'));var config=require(_0x4923('0x3'));config[_0x4923('0x4')]=_['defaults'](config[_0x4923('0x4')],{'host':_0x4923('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4923('0x4')]));function SmsQueue(_0x1184c3){this['id']=_0x1184c3['id']||0x0;this[_0x4923('0x6')]=_0x1184c3[_0x4923('0x6')]||'';this[_0x4923('0x7')]=_0x1184c3[_0x4923('0x7')]||0xa;this[_0x4923('0x8')]=_0x1184c3['strategy']||_0x4923('0x9');this['Agents']=_0x1184c3[_0x4923('0xa')];this[_0x4923('0xb')]={};this[_0x4923('0xc')]=0x0;this['md5']='';this[_0x4923('0xd')]();this[_0x4923('0xe')]();}SmsQueue[_0x4923('0xf')][_0x4923('0xd')]=function(){var _0x35d9a8=this[_0x4923('0xb')][_0x4923('0x10')];this[_0x4923('0xb')]=_[_0x4923('0x11')](this[_0x4923('0xa')],'id');this['mapAgentsId']['_rr']=_0x35d9a8;};SmsQueue[_0x4923('0xf')][_0x4923('0xe')]=function(){this[_0x4923('0x12')]=0x0;this['paused']=0x0;for(var _0x31a469=0x0;_0x31a469=0x0?this[_0x4923('0x17')]:0x0;var _0x517b95={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4923('0x12')],'name':this['name'],'paused':this[_0x4923('0x16')],'waiting':this[_0x4923('0xc')]};var _0x5dbddb=md5(JSON[_0x4923('0x18')](_0x517b95));if(this[_0x4923('0x19')]!==_0x5dbddb){this[_0x4923('0x19')]=_0x5dbddb;io['to'](util[_0x4923('0x1a')]('sms:queue:%s',_0x517b95[_0x4923('0x6')]))[_0x4923('0x1b')]('sms_queue:save',_0x517b95);}};module[_0x4923('0x1c')]=SmsQueue; \ No newline at end of file +var _0x4a81=['ioredis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','mapAgentsId','_rr','map','loggedIn','length','online','smsPause','available','paused','stringify','format','sms_queue:save','lodash','md5','util'];(function(_0x13ad7e,_0x1e1eec){var _0x5afa34=function(_0xf6a5e1){while(--_0xf6a5e1){_0x13ad7e['push'](_0x13ad7e['shift']());}};_0x5afa34(++_0x1e1eec);}(_0x4a81,0x1b7));var _0x14a8=function(_0x47c20a,_0x589cb2){_0x47c20a=_0x47c20a-0x0;var _0x1d1d38=_0x4a81[_0x47c20a];return _0x1d1d38;};'use strict';var _=require(_0x14a8('0x0'));var md5=require(_0x14a8('0x1'));var util=require(_0x14a8('0x2'));var Redis=require(_0x14a8('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x14a8('0x4')](config['redis'],{'host':_0x14a8('0x5'),'port':0x18eb});var io=require(_0x14a8('0x6'))(new Redis(config['redis']));function SmsQueue(_0x5c04ef){this['id']=_0x5c04ef['id']||0x0;this[_0x14a8('0x7')]=_0x5c04ef['name']||'';this[_0x14a8('0x8')]=_0x5c04ef['timeout']||0xa;this[_0x14a8('0x9')]=_0x5c04ef[_0x14a8('0x9')]||_0x14a8('0xa');this[_0x14a8('0xb')]=_0x5c04ef[_0x14a8('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x14a8('0x1')]='';this[_0x14a8('0xc')]();this[_0x14a8('0xd')]();}SmsQueue['prototype'][_0x14a8('0xc')]=function(){var _0x34f6e1=this[_0x14a8('0xe')][_0x14a8('0xf')];this[_0x14a8('0xe')]=_[_0x14a8('0x10')](this[_0x14a8('0xb')],'id');this[_0x14a8('0xe')]['_rr']=_0x34f6e1;};SmsQueue['prototype'][_0x14a8('0xd')]=function(){this[_0x14a8('0x11')]=0x0;this['paused']=0x0;for(var _0x19d25e=0x0;_0x19d25e=0x0?this[_0x14a8('0x15')]:0x0;var _0x1dac45={'id':this['id'],'available':this[_0x14a8('0x15')],'loggedIn':this[_0x14a8('0x11')],'name':this[_0x14a8('0x7')],'paused':this[_0x14a8('0x16')],'waiting':this['waiting']};var _0x208f70=md5(JSON[_0x14a8('0x17')](_0x1dac45));if(this['md5']!==_0x208f70){this['md5']=_0x208f70;io['to'](util[_0x14a8('0x18')]('sms:queue:%s',_0x1dac45[_0x14a8('0x7')]))['emit'](_0x14a8('0x19'),_0x1dac45);}};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 03c0b5f..d0efbdb 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 _0x4910=['lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x1eeece,_0x1643bc){var _0x367401=function(_0x438511){while(--_0x438511){_0x1eeece['push'](_0x1eeece['shift']());}};_0x367401(++_0x1643bc);}(_0x4910,0xe8));var _0x0491=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4910[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0491('0x0'));var md5=require(_0x0491('0x1'));var util=require(_0x0491('0x2'));var Redis=require(_0x0491('0x3'));var config=require('../../../config/environment');config[_0x0491('0x4')]=_[_0x0491('0x5')](config[_0x0491('0x4')],{'host':_0x0491('0x6'),'port':0x18eb});var io=require(_0x0491('0x7'))(new Redis(config[_0x0491('0x4')]));function WhatsappQueue(_0x24631e){this['id']=_0x24631e['id']||0x0;this['name']=_0x24631e[_0x0491('0x8')]||'';this[_0x0491('0x9')]=_0x24631e[_0x0491('0x9')]||0xa;this[_0x0491('0xa')]=_0x24631e[_0x0491('0xa')]||_0x0491('0xb');this[_0x0491('0xc')]=_0x24631e['Agents'];this[_0x0491('0xd')]={};this[_0x0491('0xe')]=0x0;this['md5']='';this[_0x0491('0xf')]();this['updateRealtime']();}WhatsappQueue[_0x0491('0x10')][_0x0491('0xf')]=function(){var _0x3bb453=this[_0x0491('0xd')][_0x0491('0x11')];this[_0x0491('0xd')]=_['map'](this[_0x0491('0xc')],'id');this['mapAgentsId']['_rr']=_0x3bb453;};WhatsappQueue['prototype'][_0x0491('0x12')]=function(){this[_0x0491('0x13')]=0x0;this[_0x0491('0x14')]=0x0;for(var _0x103d2f=0x0;_0x103d2f=0x0?this[_0x0491('0x18')]:0x0;var _0x491597={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0491('0x13')],'name':this[_0x0491('0x8')],'paused':this[_0x0491('0x14')],'waiting':this[_0x0491('0xe')]};var _0x57ee6d=md5(JSON['stringify'](_0x491597));if(this[_0x0491('0x1')]!==_0x57ee6d){this['md5']=_0x57ee6d;io['to'](util['format'](_0x0491('0x19'),_0x491597[_0x0491('0x8')]))[_0x0491('0x1a')](_0x0491('0x1b'),_0x491597);}};module[_0x0491('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x4319=['md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x20d176,_0x212743){var _0x9ac9a1=function(_0x1879ce){while(--_0x1879ce){_0x20d176['push'](_0x20d176['shift']());}};_0x9ac9a1(++_0x212743);}(_0x4319,0xae));var _0x9431=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0x4319[_0x5c78d9];return _0x69ae1f;};'use strict';var _=require('lodash');var md5=require(_0x9431('0x0'));var util=require(_0x9431('0x1'));var Redis=require(_0x9431('0x2'));var config=require(_0x9431('0x3'));config[_0x9431('0x4')]=_[_0x9431('0x5')](config[_0x9431('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9431('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x43e05d){this['id']=_0x43e05d['id']||0x0;this[_0x9431('0x7')]=_0x43e05d[_0x9431('0x7')]||'';this[_0x9431('0x8')]=_0x43e05d['timeout']||0xa;this[_0x9431('0x9')]=_0x43e05d['strategy']||'beepall';this[_0x9431('0xa')]=_0x43e05d[_0x9431('0xa')];this['mapAgentsId']={};this[_0x9431('0xb')]=0x0;this[_0x9431('0x0')]='';this[_0x9431('0xc')]();this[_0x9431('0xd')]();}WhatsappQueue[_0x9431('0xe')]['updateRouting']=function(){var _0xbb96a0=this[_0x9431('0xf')][_0x9431('0x10')];this[_0x9431('0xf')]=_[_0x9431('0x11')](this['Agents'],'id');this[_0x9431('0xf')][_0x9431('0x10')]=_0xbb96a0;};WhatsappQueue[_0x9431('0xe')][_0x9431('0xd')]=function(){this[_0x9431('0x12')]=0x0;this[_0x9431('0x13')]=0x0;for(var _0x3495aa=0x0;_0x3495aa=0x0?this[_0x9431('0x16')]:0x0;var _0x1577a8={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9431('0x12')],'name':this[_0x9431('0x7')],'paused':this[_0x9431('0x13')],'waiting':this[_0x9431('0xb')]};var _0x2f9018=md5(JSON[_0x9431('0x17')](_0x1577a8));if(this[_0x9431('0x0')]!==_0x2f9018){this['md5']=_0x2f9018;io['to'](util[_0x9431('0x18')](_0x9431('0x19'),_0x1577a8['name']))[_0x9431('0x1a')](_0x9431('0x1b'),_0x1577a8);}};module[_0x9431('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b84165e..b978420 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(_0x5263c4,_0x3ca5d6){var _0x21eda6=function(_0x2fc103){while(--_0x2fc103){_0x5263c4['push'](_0x5263c4['shift']());}};_0x21eda6(++_0x3ca5d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1aebfe,_0xb00c5b){_0x1aebfe=_0x1aebfe-0x0;var _0x3f0f9b=_0xb10b[_0x1aebfe];return _0x3f0f9b;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 70cd3d4..be7b48a 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 _0x0ca6=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0ca6,0x1c6));var _0x60ca=function(_0x4ac89b,_0x441b62){_0x4ac89b=_0x4ac89b-0x0;var _0x2e918c=_0x0ca6[_0x4ac89b];return _0x2e918c;};'use strict';var client=require(_0x60ca('0x0'));exports[_0x60ca('0x1')]=function(_0x200d97,_0x27749d){return client[_0x60ca('0x2')](_0x60ca('0x3'),{'body':_0x27749d,'options':{'where':{'id':_0x200d97}},'log':_0x60ca('0x4')});};exports[_0x60ca('0x5')]=function(_0x116143,_0x2fe306){return client[_0x60ca('0x2')](_0x60ca('0x6'),{'body':_0x2fe306,'options':{'where':{'id':_0x116143}},'log':_0x60ca('0x7')});}; \ No newline at end of file +var _0x7f96=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0xe6d9a7,_0x1b245e){var _0x242fbf=function(_0x262c9f){while(--_0x262c9f){_0xe6d9a7['push'](_0xe6d9a7['shift']());}};_0x242fbf(++_0x1b245e);}(_0x7f96,0x19f));var _0x67f9=function(_0x4b0c8b,_0x3524dc){_0x4b0c8b=_0x4b0c8b-0x0;var _0x2c8b7d=_0x7f96[_0x4b0c8b];return _0x2c8b7d;};'use strict';var client=require(_0x67f9('0x0'));exports[_0x67f9('0x1')]=function(_0x136416,_0x46ac14){return client[_0x67f9('0x2')](_0x67f9('0x3'),{'body':_0x46ac14,'options':{'where':{'id':_0x136416}},'log':_0x67f9('0x4')});};exports['addTags']=function(_0xd37785,_0x5ea424){return client[_0x67f9('0x2')](_0x67f9('0x5'),{'body':_0x5ea424,'options':{'where':{'id':_0xd37785}},'log':_0x67f9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3647042..1ebb5d4 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. * // * * // ************************************************************************* -'use strict';var client=require('../client');exports['create']=function(_0x388495){return client['Request']('CreateChatMessage',{'body':_0x388495,'log':'createChatMessage'});}; \ No newline at end of file +var _0xd51e=['Request','createChatMessage','../client'];(function(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0xd51e,0xda));var _0xed51=function(_0x2b92ec,_0x18e0e3){_0x2b92ec=_0x2b92ec-0x0;var _0x12be46=_0xd51e[_0x2b92ec];return _0x12be46;};'use strict';var client=require(_0xed51('0x0'));exports['create']=function(_0x3b7ef9){return client[_0xed51('0x1')]('CreateChatMessage',{'body':_0x3b7ef9,'log':_0xed51('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4d0c84d..3d17113 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 _0xe7de=['timeout','strategy','User','Agents','name','online','chatPause','../client','getChatQueues','Request'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xe7de,0x165));var _0xee7d=function(_0x2910f7,_0x37dddf){_0x2910f7=_0x2910f7-0x0;var _0x3d26ec=_0xe7de[_0x2910f7];return _0x3d26ec;};'use strict';var client=require(_0xee7d('0x0'));exports[_0xee7d('0x1')]=function(){return function(){return client[_0xee7d('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xee7d('0x3'),_0xee7d('0x4')],'include':[{'model':_0xee7d('0x5'),'as':_0xee7d('0x6'),'attributes':['id',_0xee7d('0x7'),_0xee7d('0x8'),_0xee7d('0x9')]}]},'log':_0xee7d('0x1')});};}; \ No newline at end of file +var _0x3148=['getChatQueues','GetChatQueue','name','timeout','strategy','Agents','online','chatPause','../client'];(function(_0x6da001,_0xd9b4b1){var _0x39b0fd=function(_0xcd962e){while(--_0xcd962e){_0x6da001['push'](_0x6da001['shift']());}};_0x39b0fd(++_0xd9b4b1);}(_0x3148,0x1d3));var _0x8314=function(_0x5f3450,_0x21d23a){_0x5f3450=_0x5f3450-0x0;var _0x58db0d=_0x3148[_0x5f3450];return _0x58db0d;};'use strict';var client=require(_0x8314('0x0'));exports[_0x8314('0x1')]=function(){return function(){return client['Request'](_0x8314('0x2'),{'options':{'raw':![],'attributes':['id',_0x8314('0x3'),_0x8314('0x4'),_0x8314('0x5')],'include':[{'model':'User','as':_0x8314('0x6'),'attributes':['id',_0x8314('0x3'),_0x8314('0x7'),_0x8314('0x8')]}]},'log':_0x8314('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 9f36ad0..b1919b8 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 _0xad95=['update','Request','../client','create','CreateChatQueueReport'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xad95,0x70));var _0x5ad9=function(_0x18221c,_0x5c41c0){_0x18221c=_0x18221c-0x0;var _0x569d4d=_0xad95[_0x18221c];return _0x569d4d;};'use strict';var client=require(_0x5ad9('0x0'));exports[_0x5ad9('0x1')]=function(_0x1fe578){return client['Request']('CreateChatQueueReport',{'body':_0x1fe578,'log':_0x5ad9('0x2')});};exports[_0x5ad9('0x3')]=function(_0x59809d,_0x5c9fd6){return client[_0x5ad9('0x4')]('UpdateChatQueueReport',{'body':_0x5c9fd6,'options':{'where':{'uniqueid':_0x59809d},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xac31=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client','create'];(function(_0x54b66d,_0x262448){var _0xc34c0e=function(_0x1693cf){while(--_0x1693cf){_0x54b66d['push'](_0x54b66d['shift']());}};_0xc34c0e(++_0x262448);}(_0xac31,0xca));var _0x1ac3=function(_0x1626e1,_0x20a87e){_0x1626e1=_0x1626e1-0x0;var _0x5006e9=_0xac31[_0x1626e1];return _0x5006e9;};'use strict';var client=require(_0x1ac3('0x0'));exports[_0x1ac3('0x1')]=function(_0x1cd966){return client[_0x1ac3('0x2')](_0x1ac3('0x3'),{'body':_0x1cd966,'log':_0x1ac3('0x3')});};exports[_0x1ac3('0x4')]=function(_0x59b42c,_0x33b5ab){return client[_0x1ac3('0x2')]('UpdateChatQueueReport',{'body':_0x33b5ab,'options':{'where':{'uniqueid':_0x59b42c},'order':[['id','DESC']],'limit':0x1},'log':_0x1ac3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 1a89d4a..96efebc 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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4e07c6,_0x5d8c10){var _0x37023e=function(_0x339588){while(--_0x339588){_0x4e07c6['push'](_0x4e07c6['shift']());}};_0x37023e(++_0x5d8c10);}(_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 +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x528761,_0x567136){var _0x5f37fe=function(_0x3dd9db){while(--_0x3dd9db){_0x528761['push'](_0x528761['shift']());}};_0x5f37fe(++_0x567136);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 21be208..605c200 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 _0xce74=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x2bf299,_0x4f1b0a){var _0x18cc1d=function(_0x3ab987){while(--_0x3ab987){_0x2bf299['push'](_0x2bf299['shift']());}};_0x18cc1d(++_0x4f1b0a);}(_0xce74,0x7a));var _0x4ce7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xce74[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x4ce7('0x0'));exports[_0x4ce7('0x1')]=function(_0x4d1a6b){return client[_0x4ce7('0x2')](_0x4ce7('0x3'),{'body':_0x4d1a6b,'log':_0x4ce7('0x4')});}; \ No newline at end of file +var _0x108f=['create'];(function(_0x34335a,_0xba7e1){var _0x1bab84=function(_0x42a15c){while(--_0x42a15c){_0x34335a['push'](_0x34335a['shift']());}};_0x1bab84(++_0xba7e1);}(_0x108f,0xdb));var _0xf108=function(_0x31dc8a,_0x5a2e52){_0x31dc8a=_0x31dc8a-0x0;var _0x4631d6=_0x108f[_0x31dc8a];return _0x4631d6;};'use strict';var client=require('../client');exports[_0xf108('0x0')]=function(_0x12fd3d){return client['Request']('CreateFaxMessage',{'body':_0x12fd3d,'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 91e4d61..378dd4b 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 _0x87c5=['strategy','User','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x31d34b,_0x4fef97){var _0x314175=function(_0x5708aa){while(--_0x5708aa){_0x31d34b['push'](_0x31d34b['shift']());}};_0x314175(++_0x4fef97);}(_0x87c5,0x175));var _0x587c=function(_0x491d62,_0x5bb056){_0x491d62=_0x491d62-0x0;var _0x3757e7=_0x87c5[_0x491d62];return _0x3757e7;};'use strict';var client=require('../client');exports[_0x587c('0x0')]=function(){return function(){return client[_0x587c('0x1')](_0x587c('0x2'),{'options':{'raw':![],'attributes':['id',_0x587c('0x3'),_0x587c('0x4'),_0x587c('0x5')],'include':[{'model':_0x587c('0x6'),'as':'Agents','attributes':['id',_0x587c('0x3'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x256c=['User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x1954ca,_0x54487d){var _0x20140d=function(_0x27abc1){while(--_0x27abc1){_0x1954ca['push'](_0x1954ca['shift']());}};_0x20140d(++_0x54487d);}(_0x256c,0x164));var _0xc256=function(_0x420e7e,_0x18b1bf){_0x420e7e=_0x420e7e-0x0;var _0x2a9893=_0x256c[_0x420e7e];return _0x2a9893;};'use strict';var client=require(_0xc256('0x0'));exports[_0xc256('0x1')]=function(){return function(){return client[_0xc256('0x2')](_0xc256('0x3'),{'options':{'raw':![],'attributes':['id',_0xc256('0x4'),_0xc256('0x5'),_0xc256('0x6')],'include':[{'model':_0xc256('0x7'),'as':_0xc256('0x8'),'attributes':['id','name',_0xc256('0x9'),_0xc256('0xa')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7e765e4..b38efc5 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 _0x0331=['update','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0331,0x1d0));var _0x1033=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x0331[_0x356e8d];return _0x39e65a;};'use strict';var client=require(_0x1033('0x0'));exports[_0x1033('0x1')]=function(_0xfe5e45){return client[_0x1033('0x2')]('CreateFaxQueueReport',{'body':_0xfe5e45,'log':_0x1033('0x3')});};exports[_0x1033('0x4')]=function(_0x2f2934,_0x526e53){return client[_0x1033('0x2')](_0x1033('0x5'),{'body':_0x526e53,'options':{'where':{'uniqueid':_0x2f2934},'order':[['id','DESC']],'limit':0x1},'log':_0x1033('0x5')});}; \ No newline at end of file +var _0x7c0f=['update','UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0x7c0f,0x135));var _0xf7c0=function(_0x20c4a8,_0x461d7e){_0x20c4a8=_0x20c4a8-0x0;var _0x8815b=_0x7c0f[_0x20c4a8];return _0x8815b;};'use strict';var client=require(_0xf7c0('0x0'));exports['create']=function(_0x5e539e){return client[_0xf7c0('0x1')](_0xf7c0('0x2'),{'body':_0x5e539e,'log':_0xf7c0('0x2')});};exports[_0xf7c0('0x3')]=function(_0x530410,_0x1a8c98){return client[_0xf7c0('0x1')](_0xf7c0('0x4'),{'body':_0x1a8c98,'options':{'where':{'uniqueid':_0x530410},'order':[['id',_0xf7c0('0x5')]],'limit':0x1},'log':_0xf7c0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c708b71..da6123f 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 _0xa17d=['Request','GetInterval','name','Interval','getIntervals'];(function(_0x5a3a47,_0x5a4faf){var _0x397615=function(_0x3dbd32){while(--_0x3dbd32){_0x5a3a47['push'](_0x5a3a47['shift']());}};_0x397615(++_0x5a4faf);}(_0xa17d,0x190));var _0xda17=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0xa17d[_0x5e4b85];return _0x5cd3cb;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xda17('0x0')](_0xda17('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xda17('0x2')],'include':[{'model':_0xda17('0x3'),'as':'Intervals','attributes':['id',_0xda17('0x2'),'interval']}]},'log':_0xda17('0x4')});};}; \ No newline at end of file +var _0x1bc5=['interval','../client','Request','GetInterval','Interval','name'];(function(_0x43b236,_0x13e164){var _0x2dd786=function(_0x316ba3){while(--_0x316ba3){_0x43b236['push'](_0x43b236['shift']());}};_0x2dd786(++_0x13e164);}(_0x1bc5,0x1c3));var _0x51bc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1bc5[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x51bc('0x0'));exports['getIntervals']=function(){return function(){return client[_0x51bc('0x1')](_0x51bc('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x51bc('0x3'),'as':'Intervals','attributes':['id',_0x51bc('0x4'),_0x51bc('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 7aca153..a973656 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 _0xf4f4=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x2a3931,_0x176657){var _0x32b519=function(_0x5e1e0c){while(--_0x5e1e0c){_0x2a3931['push'](_0x2a3931['shift']());}};_0x32b519(++_0x176657);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x16f8da,_0x251b0d){_0x16f8da=_0x16f8da-0x0;var _0x35f922=_0xf4f4[_0x16f8da];return _0x35f922;};'use strict';var client=require(_0x4f4f('0x0'));exports[_0x4f4f('0x1')]=function(_0x533895,_0x16a496){return client[_0x4f4f('0x2')](_0x4f4f('0x3'),{'body':_0x16a496,'options':{'where':{'id':_0x533895}},'log':_0x4f4f('0x4')});};exports[_0x4f4f('0x5')]=function(_0x510b24,_0x5a752b){return client['Request'](_0x4f4f('0x6'),{'body':_0x5a752b,'options':{'where':{'id':_0x510b24}},'log':_0x4f4f('0x7')});}; \ No newline at end of file +var _0x4bd3=['../client','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x510bef,_0x45d98e){var _0x5af891=function(_0x477668){while(--_0x477668){_0x510bef['push'](_0x510bef['shift']());}};_0x5af891(++_0x45d98e);}(_0x4bd3,0x174));var _0x34bd=function(_0x4ceba2,_0xee6f52){_0x4ceba2=_0x4ceba2-0x0;var _0x319cea=_0x4bd3[_0x4ceba2];return _0x319cea;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateMailInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateMailInteraction'});};exports[_0x34bd('0x1')]=function(_0x44854a,_0x1fc8eb){return client['Request'](_0x34bd('0x2'),{'body':_0x1fc8eb,'options':{'where':{'id':_0x44854a}},'log':_0x34bd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b194fe1..353128e 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 _0x01cd=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x01cd,0xc3));var _0xd01c=function(_0x50644d,_0x3a15fa){_0x50644d=_0x50644d-0x0;var _0x32c522=_0x01cd[_0x50644d];return _0x32c522;};'use strict';var client=require(_0xd01c('0x0'));exports[_0xd01c('0x1')]=function(_0x5197bc){return client[_0xd01c('0x2')](_0xd01c('0x3'),{'body':_0x5197bc,'log':_0xd01c('0x4')});}; \ No newline at end of file +var _0x0494=['create','Request','createMailMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0494,0x197));var _0x4049=function(_0x51830c,_0x49fa85){_0x51830c=_0x51830c-0x0;var _0x154efd=_0x0494[_0x51830c];return _0x154efd;};'use strict';var client=require(_0x4049('0x0'));exports[_0x4049('0x1')]=function(_0x109ccf){return client[_0x4049('0x2')]('CreateMailMessage',{'body':_0x109ccf,'log':_0x4049('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c98c4d1..2096105 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 _0x00d2=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','Agents','online'];(function(_0x195a66,_0x2a70e5){var _0x3c2d7c=function(_0x34d091){while(--_0x34d091){_0x195a66['push'](_0x195a66['shift']());}};_0x3c2d7c(++_0x2a70e5);}(_0x00d2,0xc9));var _0x200d=function(_0xcffae0,_0x1f70ca){_0xcffae0=_0xcffae0-0x0;var _0x24f329=_0x00d2[_0xcffae0];return _0x24f329;};'use strict';var client=require(_0x200d('0x0'));exports[_0x200d('0x1')]=function(){return function(){return client[_0x200d('0x2')](_0x200d('0x3'),{'options':{'raw':![],'attributes':['id',_0x200d('0x4'),_0x200d('0x5'),_0x200d('0x6')],'include':[{'model':'User','as':_0x200d('0x7'),'attributes':['id',_0x200d('0x4'),_0x200d('0x8'),_0x200d('0x9')]}]},'log':_0x200d('0x1')});};}; \ No newline at end of file +var _0x050a=['Request','name','timeout','strategy','User','online','mailPause','../client','getMailQueues'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x050a,0x1a5));var _0xa050=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x050a[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xa050('0x0'));exports[_0xa050('0x1')]=function(){return function(){return client[_0xa050('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xa050('0x3'),_0xa050('0x4'),_0xa050('0x5')],'include':[{'model':_0xa050('0x6'),'as':'Agents','attributes':['id','name',_0xa050('0x7'),_0xa050('0x8')]}]},'log':_0xa050('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 46cc0b0..589ff5e 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 _0xa489=['Request','UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update'];(function(_0x398823,_0x48697b){var _0x13e560=function(_0x6786f3){while(--_0x6786f3){_0x398823['push'](_0x398823['shift']());}};_0x13e560(++_0x48697b);}(_0xa489,0x88));var _0x9a48=function(_0x22215b,_0x42bd61){_0x22215b=_0x22215b-0x0;var _0x3f532d=_0xa489[_0x22215b];return _0x3f532d;};'use strict';var client=require(_0x9a48('0x0'));exports[_0x9a48('0x1')]=function(_0x1a3096){return client['Request']('CreateMailQueueReport',{'body':_0x1a3096,'log':_0x9a48('0x2')});};exports[_0x9a48('0x3')]=function(_0x486244,_0x5aadfc){return client[_0x9a48('0x4')](_0x9a48('0x5'),{'body':_0x5aadfc,'options':{'where':{'uniqueid':_0x486244},'order':[['id',_0x9a48('0x6')]],'limit':0x1},'log':_0x9a48('0x5')});}; \ No newline at end of file +var _0x5996=['CreateMailQueueReport','update','DESC','UpdateMailQueueReport','Request'];(function(_0x1b2aa8,_0x8e18f9){var _0x1d4f54=function(_0x1a8b27){while(--_0x1a8b27){_0x1b2aa8['push'](_0x1b2aa8['shift']());}};_0x1d4f54(++_0x8e18f9);}(_0x5996,0x1df));var _0x6599=function(_0x2c9ec0,_0x33ac4e){_0x2c9ec0=_0x2c9ec0-0x0;var _0x5d7c6b=_0x5996[_0x2c9ec0];return _0x5d7c6b;};'use strict';var client=require('../client');exports['create']=function(_0x34fc68){return client[_0x6599('0x0')](_0x6599('0x1'),{'body':_0x34fc68,'log':_0x6599('0x1')});};exports[_0x6599('0x2')]=function(_0x2c3394,_0xa6ca7){return client[_0x6599('0x0')]('UpdateMailQueueReport',{'body':_0xa6ca7,'options':{'where':{'uniqueid':_0x2c3394},'order':[['id',_0x6599('0x3')]],'limit':0x1},'log':_0x6599('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f5ad98b..bfd36f5 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 _0xeca5=['update','Request','UpdateOpenchannelInteraction','addTagsToChatInteraction'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xeca5,0x100));var _0x5eca=function(_0x2dbce3,_0x272e65){_0x2dbce3=_0x2dbce3-0x0;var _0x246f8c=_0xeca5[_0x2dbce3];return _0x246f8c;};'use strict';var client=require('../client');exports[_0x5eca('0x0')]=function(_0x1f9a5d,_0x4b6cac){return client[_0x5eca('0x1')](_0x5eca('0x2'),{'body':_0x4b6cac,'options':{'where':{'id':_0x1f9a5d}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x33e793,_0x4d6755){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x4d6755,'options':{'where':{'id':_0x33e793}},'log':_0x5eca('0x3')});}; \ No newline at end of file +var _0x9bdf=['updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x9bdf,0x1ed));var _0xf9bd=function(_0x2cb766,_0x1096f1){_0x2cb766=_0x2cb766-0x0;var _0x3edc14=_0x9bdf[_0x2cb766];return _0x3edc14;};'use strict';var client=require(_0xf9bd('0x0'));exports[_0xf9bd('0x1')]=function(_0x4f2f44,_0x4e1789){return client['Request'](_0xf9bd('0x2'),{'body':_0x4e1789,'options':{'where':{'id':_0x4f2f44}},'log':_0xf9bd('0x3')});};exports[_0xf9bd('0x4')]=function(_0x51c76e,_0x1be868){return client[_0xf9bd('0x5')](_0xf9bd('0x6'),{'body':_0x1be868,'options':{'where':{'id':_0x51c76e}},'log':_0xf9bd('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index fdf86e3..3ae82a1 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 _0xa64a=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xa64a,0xd0));var _0xaa64=function(_0x1527e0,_0x142cb8){_0x1527e0=_0x1527e0-0x0;var _0x5b4735=_0xa64a[_0x1527e0];return _0x5b4735;};'use strict';var client=require(_0xaa64('0x0'));exports['create']=function(_0x243b2e){return client[_0xaa64('0x1')](_0xaa64('0x2'),{'body':_0x243b2e,'log':_0xaa64('0x3')});}; \ No newline at end of file +var _0x5844=['Request','createOpenchannelMessage','create'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5844,0x179));var _0x4584=function(_0x197402,_0x488dcf){_0x197402=_0x197402-0x0;var _0x1eba07=_0x5844[_0x197402];return _0x1eba07;};'use strict';var client=require('../client');exports[_0x4584('0x0')]=function(_0x36b199){return client[_0x4584('0x1')]('CreateOpenchannelMessage',{'body':_0x36b199,'log':_0x4584('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2cdc915..d0c0358 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 _0x0304=['openchannelPause','getOpenchannelQueues','Request','name','timeout','strategy','Agents','online'];(function(_0x10edda,_0x5b5c41){var _0x10d591=function(_0x395abd){while(--_0x395abd){_0x10edda['push'](_0x10edda['shift']());}};_0x10d591(++_0x5b5c41);}(_0x0304,0x99));var _0x4030=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x0304[_0xbf8ebe];return _0x1e25e8;};'use strict';var client=require('../client');exports[_0x4030('0x0')]=function(){return function(){return client[_0x4030('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x4030('0x2'),_0x4030('0x3'),_0x4030('0x4')],'include':[{'model':'User','as':_0x4030('0x5'),'attributes':['id',_0x4030('0x2'),_0x4030('0x6'),_0x4030('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x35f9=['Request','GetOpenchannelQueue','name','timeout','User','Agents','online','openchannelPause','getOpenchannelQueues','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x35f9,0x8b));var _0x935f=function(_0x509e06,_0x3fe786){_0x509e06=_0x509e06-0x0;var _0x3df5ce=_0x35f9[_0x509e06];return _0x3df5ce;};'use strict';var client=require(_0x935f('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x935f('0x1')](_0x935f('0x2'),{'options':{'raw':![],'attributes':['id',_0x935f('0x3'),_0x935f('0x4'),'strategy'],'include':[{'model':_0x935f('0x5'),'as':_0x935f('0x6'),'attributes':['id',_0x935f('0x3'),_0x935f('0x7'),_0x935f('0x8')]}]},'log':_0x935f('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index fb1553d..e7f9004 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 _0x6244=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0xdb27ce,_0x21e4f6){var _0x2a9fcb=function(_0x4cbc6b){while(--_0x4cbc6b){_0xdb27ce['push'](_0xdb27ce['shift']());}};_0x2a9fcb(++_0x21e4f6);}(_0x6244,0x1ad));var _0x4624=function(_0x5f15f1,_0x192571){_0x5f15f1=_0x5f15f1-0x0;var _0x5e79ca=_0x6244[_0x5f15f1];return _0x5e79ca;};'use strict';var client=require(_0x4624('0x0'));exports[_0x4624('0x1')]=function(_0x5148a7){return client[_0x4624('0x2')](_0x4624('0x3'),{'body':_0x5148a7,'log':_0x4624('0x3')});};exports[_0x4624('0x4')]=function(_0x108194,_0x50c01c){return client[_0x4624('0x2')](_0x4624('0x5'),{'body':_0x50c01c,'options':{'where':{'uniqueid':_0x108194},'order':[['id',_0x4624('0x6')]],'limit':0x1},'log':_0x4624('0x5')});}; \ No newline at end of file +var _0xe782=['update','UpdateOpenchannelQueueReport','create','Request','CreateOpenchannelQueueReport'];(function(_0xca1bd6,_0x1b92d8){var _0x35091e=function(_0x3a126f){while(--_0x3a126f){_0xca1bd6['push'](_0xca1bd6['shift']());}};_0x35091e(++_0x1b92d8);}(_0xe782,0x133));var _0x2e78=function(_0x5c874d,_0xbe86ee){_0x5c874d=_0x5c874d-0x0;var _0x1e4d5e=_0xe782[_0x5c874d];return _0x1e4d5e;};'use strict';var client=require('../client');exports[_0x2e78('0x0')]=function(_0x3e7739){return client[_0x2e78('0x1')]('CreateOpenchannelQueueReport',{'body':_0x3e7739,'log':_0x2e78('0x2')});};exports[_0x2e78('0x3')]=function(_0x21be17,_0x32df05){return client[_0x2e78('0x1')](_0x2e78('0x4'),{'body':_0x32df05,'options':{'where':{'uniqueid':_0x21be17},'order':[['id','DESC']],'limit':0x1},'log':_0x2e78('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 2101d16..0f7ddb5 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 _0x98d5=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x98d5,0xfb));var _0x598d=function(_0x47a2d3,_0x280c1c){_0x47a2d3=_0x47a2d3-0x0;var _0x2b542e=_0x98d5[_0x47a2d3];return _0x2b542e;};'use strict';var client=require(_0x598d('0x0'));exports['update']=function(_0x491dcb,_0x1db125){return client[_0x598d('0x1')](_0x598d('0x2'),{'body':_0x1db125,'options':{'where':{'id':_0x491dcb}},'log':_0x598d('0x3')});};exports[_0x598d('0x4')]=function(_0x3890f3,_0x2a3fe3){return client[_0x598d('0x1')]('AddTagsToSmsInteraction',{'body':_0x2a3fe3,'options':{'where':{'id':_0x3890f3}},'log':_0x598d('0x5')});}; \ No newline at end of file +var _0x61a5=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x22d1c3,_0x104f55){var _0x1dd36c=function(_0x4e47a4){while(--_0x4e47a4){_0x22d1c3['push'](_0x22d1c3['shift']());}};_0x1dd36c(++_0x104f55);}(_0x61a5,0xf0));var _0x561a=function(_0x542e14,_0x5dfd4b){_0x542e14=_0x542e14-0x0;var _0xe3bbb=_0x61a5[_0x542e14];return _0xe3bbb;};'use strict';var client=require(_0x561a('0x0'));exports['update']=function(_0x412b10,_0x28892d){return client[_0x561a('0x1')](_0x561a('0x2'),{'body':_0x28892d,'options':{'where':{'id':_0x412b10}},'log':_0x561a('0x3')});};exports['addTags']=function(_0xe92b4d,_0x33c0f5){return client['Request'](_0x561a('0x4'),{'body':_0x33c0f5,'options':{'where':{'id':_0xe92b4d}},'log':_0x561a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index df15227..d0b525b 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 _0xab2d=['CreateSmsMessage','createSmsMessage','create'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xab2d,0xef));var _0xdab2=function(_0x3b2b2e,_0x54a98f){_0x3b2b2e=_0x3b2b2e-0x0;var _0x41a877=_0xab2d[_0x3b2b2e];return _0x41a877;};'use strict';var client=require('../client');exports[_0xdab2('0x0')]=function(_0x518c7b){return client['Request'](_0xdab2('0x1'),{'body':_0x518c7b,'log':_0xdab2('0x2')});}; \ No newline at end of file +var _0x0046=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x0046,0x1c4));var _0x6004=function(_0x4e72c8,_0x1770b0){_0x4e72c8=_0x4e72c8-0x0;var _0xad622f=_0x0046[_0x4e72c8];return _0xad622f;};'use strict';var client=require(_0x6004('0x0'));exports[_0x6004('0x1')]=function(_0xd5bd8){return client[_0x6004('0x2')](_0x6004('0x3'),{'body':_0xd5bd8,'log':_0x6004('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 662b624..7643398 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x536e50,_0xe6818f){var _0x16d84a=function(_0xfd4360){while(--_0xfd4360){_0x536e50['push'](_0x536e50['shift']());}};_0x16d84a(++_0xe6818f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb7e7[_0x3ea913];return _0x2b4f28;};'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 +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x5d7830,_0x3c4eab){var _0x11e995=function(_0x2c01a1){while(--_0x2c01a1){_0x5d7830['push'](_0x5d7830['shift']());}};_0x11e995(++_0x3c4eab);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ea72a9d..88b1996 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2295b8,_0x149063){var _0x78b3eb=function(_0x58de0b){while(--_0x58de0b){_0x2295b8['push'](_0x2295b8['shift']());}};_0x78b3eb(++_0x149063);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x2ca2e4,_0x29f928){var _0x3ac386=function(_0x2fae78){while(--_0x2fae78){_0x2ca2e4['push'](_0x2ca2e4['shift']());}};_0x3ac386(++_0x29f928);}(_0x55ca,0x126));var _0xa55c=function(_0x1bfb48,_0x2de37a){_0x1bfb48=_0x1bfb48-0x0;var _0x1f432a=_0x55ca[_0x1bfb48];return _0x1f432a;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 9178719..e481598 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(_0x7168ec,_0xb6a17b){var _0x36e2a5=function(_0x23744d){while(--_0x23744d){_0x7168ec['push'](_0x7168ec['shift']());}};_0x36e2a5(++_0xb6a17b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x5a6373,_0x36ba57){var _0x2b1976=function(_0xe4ba37){while(--_0xe4ba37){_0x5a6373['push'](_0x5a6373['shift']());}};_0x2b1976(++_0x36ba57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 25504ef..57d6661 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 _0x41d0=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x3f4653,_0x5ebfa3){var _0x1b494d=function(_0x437657){while(--_0x437657){_0x3f4653['push'](_0x3f4653['shift']());}};_0x1b494d(++_0x5ebfa3);}(_0x41d0,0x1c6));var _0x041d=function(_0x13ae89,_0x832c38){_0x13ae89=_0x13ae89-0x0;var _0x1744a0=_0x41d0[_0x13ae89];return _0x1744a0;};'use strict';var client=require(_0x041d('0x0'));exports[_0x041d('0x1')]=function(_0x2326c5,_0x288ebb){return client['Request'](_0x041d('0x2'),{'body':_0x288ebb,'options':{'where':{'id':_0x2326c5}},'log':_0x041d('0x3')});};exports[_0x041d('0x4')]=function(_0x397dad,_0x41e587){return client[_0x041d('0x5')](_0x041d('0x6'),{'body':_0x41e587,'options':{'where':{'id':_0x397dad}},'log':_0x041d('0x7')});}; \ No newline at end of file +var _0xbff5=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x23ee67,_0x4ba178){var _0x41a9d4=function(_0x20e131){while(--_0x20e131){_0x23ee67['push'](_0x23ee67['shift']());}};_0x41a9d4(++_0x4ba178);}(_0xbff5,0x1bc));var _0x5bff=function(_0x1b5527,_0x6a2fca){_0x1b5527=_0x1b5527-0x0;var _0x2531c2=_0xbff5[_0x1b5527];return _0x2531c2;};'use strict';var client=require(_0x5bff('0x0'));exports[_0x5bff('0x1')]=function(_0xd96d55,_0x271c07){return client[_0x5bff('0x2')](_0x5bff('0x3'),{'body':_0x271c07,'options':{'where':{'id':_0xd96d55}},'log':_0x5bff('0x4')});};exports['addTags']=function(_0x3868ae,_0x486083){return client['Request'](_0x5bff('0x5'),{'body':_0x486083,'options':{'where':{'id':_0x3868ae}},'log':_0x5bff('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e2974f4..1fcf8c2 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 _0x0875=['../client','create','CreateWhatsappMessage'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x0875,0x1c5));var _0x5087=function(_0x508ed6,_0x5e0a5f){_0x508ed6=_0x508ed6-0x0;var _0x175ed1=_0x0875[_0x508ed6];return _0x175ed1;};'use strict';var client=require(_0x5087('0x0'));exports[_0x5087('0x1')]=function(_0x2b787d){return client['Request'](_0x5087('0x2'),{'body':_0x2b787d,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x65de=['createWhatsappMessage','Request','CreateWhatsappMessage'];(function(_0x375162,_0x574dbe){var _0x1bccc8=function(_0x2f4889){while(--_0x2f4889){_0x375162['push'](_0x375162['shift']());}};_0x1bccc8(++_0x574dbe);}(_0x65de,0x175));var _0xe65d=function(_0x12ef14,_0x57db7e){_0x12ef14=_0x12ef14-0x0;var _0x5ebb41=_0x65de[_0x12ef14];return _0x5ebb41;};'use strict';var client=require('../client');exports['create']=function(_0x11b5d5){return client[_0xe65d('0x0')](_0xe65d('0x1'),{'body':_0x11b5d5,'log':_0xe65d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index fa73ce5..b593507 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 _0xb2ed=['whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','User','Agents','online'];(function(_0x349afb,_0x308d44){var _0x1d6394=function(_0x5860fd){while(--_0x5860fd){_0x349afb['push'](_0x349afb['shift']());}};_0x1d6394(++_0x308d44);}(_0xb2ed,0x120));var _0xdb2e=function(_0x45096e,_0x17e82d){_0x45096e=_0x45096e-0x0;var _0xba1fa3=_0xb2ed[_0x45096e];return _0xba1fa3;};'use strict';var client=require('../client');exports[_0xdb2e('0x0')]=function(){return function(){return client['Request'](_0xdb2e('0x1'),{'options':{'raw':![],'attributes':['id',_0xdb2e('0x2'),'timeout','strategy'],'include':[{'model':_0xdb2e('0x3'),'as':_0xdb2e('0x4'),'attributes':['id',_0xdb2e('0x2'),_0xdb2e('0x5'),_0xdb2e('0x6')]}]},'log':_0xdb2e('0x0')});};}; \ No newline at end of file +var _0x01d0=['online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x248638,_0x58e0a6){var _0xe13214=function(_0x30892e){while(--_0x30892e){_0x248638['push'](_0x248638['shift']());}};_0xe13214(++_0x58e0a6);}(_0x01d0,0x110));var _0x001d=function(_0x39fddd,_0x36105a){_0x39fddd=_0x39fddd-0x0;var _0x285ce4=_0x01d0[_0x39fddd];return _0x285ce4;};'use strict';var client=require(_0x001d('0x0'));exports[_0x001d('0x1')]=function(){return function(){return client['Request'](_0x001d('0x2'),{'options':{'raw':![],'attributes':['id',_0x001d('0x3'),_0x001d('0x4'),_0x001d('0x5')],'include':[{'model':_0x001d('0x6'),'as':_0x001d('0x7'),'attributes':['id','name',_0x001d('0x8'),_0x001d('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3548e74..c2d7e76 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 _0x4b0f=['DESC','../client','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport'];(function(_0x5e5c44,_0x4be120){var _0x5276d9=function(_0x39426a){while(--_0x39426a){_0x5e5c44['push'](_0x5e5c44['shift']());}};_0x5276d9(++_0x4be120);}(_0x4b0f,0x114));var _0xf4b0=function(_0x1b5b29,_0xfd5dd8){_0x1b5b29=_0x1b5b29-0x0;var _0x2b125e=_0x4b0f[_0x1b5b29];return _0x2b125e;};'use strict';var client=require(_0xf4b0('0x0'));exports['create']=function(_0x4dbddc){return client[_0xf4b0('0x1')](_0xf4b0('0x2'),{'body':_0x4dbddc,'log':_0xf4b0('0x2')});};exports['update']=function(_0x530662,_0x3143c5){return client[_0xf4b0('0x1')](_0xf4b0('0x3'),{'body':_0x3143c5,'options':{'where':{'uniqueid':_0x530662},'order':[['id',_0xf4b0('0x4')]],'limit':0x1},'log':_0xf4b0('0x3')});}; \ No newline at end of file +var _0xaa41=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x7a543a,_0x191279){var _0x59ac6f=function(_0x1701b1){while(--_0x1701b1){_0x7a543a['push'](_0x7a543a['shift']());}};_0x59ac6f(++_0x191279);}(_0xaa41,0x171));var _0x1aa4=function(_0x40b957,_0x31380b){_0x40b957=_0x40b957-0x0;var _0xd61bdf=_0xaa41[_0x40b957];return _0xd61bdf;};'use strict';var client=require(_0x1aa4('0x0'));exports[_0x1aa4('0x1')]=function(_0x206098){return client[_0x1aa4('0x2')](_0x1aa4('0x3'),{'body':_0x206098,'log':'CreateWhatsappQueueReport'});};exports[_0x1aa4('0x4')]=function(_0x3df002,_0x4b31a5){return client['Request'](_0x1aa4('0x5'),{'body':_0x4b31a5,'options':{'where':{'uniqueid':_0x3df002},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 800af2b..117ce22 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 _0x5254=['log','[%s][QUEUE]\x20%s','validate','seq-queue','../../../../config/logger','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x35d092,_0x3c91ef){var _0x12972a=function(_0x183d46){while(--_0x183d46){_0x35d092['push'](_0x35d092['shift']());}};_0x12972a(++_0x3c91ef);}(_0x5254,0x182));var _0x4525=function(_0x8be34a,_0x446d42){_0x8be34a=_0x8be34a-0x0;var _0x33b2db=_0x5254[_0x8be34a];return _0x33b2db;};'use strict';var schema=require(_0x4525('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x4525('0x1'));var logger=require(_0x4525('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x4525('0x3'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3a9271,_0x57d06a,_0x3a6b67){return logger[_0x4525('0x4')](util[_0x4525('0x5')](_0x4525('0x6'),_0x3a9271,_0x57d06a[_0x4525('0x7')],_0x3a6b67));}function handleFindAgent(_0x2fee70){return function(_0x34aeba){return _0x34aeba[_0x4525('0x7')][_0x4525('0x8')]()===_0x2fee70['toLowerCase']();};}exports['consequence']=function(_0x56aa9a,_0x2112f5,_0x3360c2,_0x30ab17){return function(_0x53def1){try{var _0x1076c1={'name':_0x2112f5[0x0],'timeout':_0x2112f5[0x1]};var _0x4aab4d=queue[_0x4525('0x0')](_0x1076c1,{'typecast':!![]});if(_0x4aab4d[_0x4525('0x9')]){logger[_0x4525('0xa')](_0x4525('0xb'),_0x56aa9a,_[_0x4525('0xc')](_0x4aab4d,_0x4525('0xd'))['join'](',\x20'));_0x53def1[_0x4525('0xe')]();}else{var _0x271f59=_[_0x4525('0xf')](_0x3360c2[_0x4525('0x10')],handleFindAgent(_0x1076c1[_0x4525('0x7')]));if(_0x271f59){var _0x5c59f1=(_0x1076c1[_0x4525('0x11')]||0xa)*0x3e8;var _0x2bb230,_0x4972c6;var _0x498fe1=seqqueue[_0x4525('0x12')](_0x5c59f1);_0x498fe1['id']=_0x56aa9a;_0x498fe1[_0x4525('0x13')]=_0x5c59f1;_0x498fe1[_0x4525('0x14')]=_0x30ab17[_0x4525('0x14')];writeLog(_0x56aa9a,_0x271f59,util[_0x4525('0x5')]('START:%s',_0x5c59f1));_0x3360c2[_0x4525('0x15')][_0x56aa9a]['on'](_0x4525('0x16'),function(){logger['info'](_0x4525('0x17'),_0x56aa9a);clearTimeout(_0x4972c6);_0x4972c6=undefined;_0x498fe1[_0x4525('0x18')]();if(_0x3360c2[_0x4525('0x15')][_0x56aa9a]){delete _0x3360c2[_0x4525('0x15')][_0x56aa9a];}_0x53def1[_0x4525('0xe')]();});_0x3360c2['rules'][_0x56aa9a]['on'](_0x4525('0x19'),function(){if(_0x3360c2[_0x4525('0x15')][_0x56aa9a]){delete _0x3360c2[_0x4525('0x15')][_0x56aa9a];}});_0x4972c6=setTimeout(function(){logger['info'](_0x4525('0x1a'),_0x56aa9a);clearTimeout(_0x4972c6);_0x498fe1[_0x4525('0x18')]();_0x53def1[_0x4525('0x1b')]();},_0x5c59f1);strategy[_0x4525('0x1c')](_0x498fe1,_0x271f59,_0x3360c2,_0x30ab17);}else{logger[_0x4525('0xa')](_0x4525('0x1d'),_0x56aa9a,_0x1076c1[_0x4525('0x7')]);_0x53def1[_0x4525('0xe')]();}}}catch(_0x538512){console[_0x4525('0x1e')](_0x538512);logger['error'](_0x4525('0x1f'),_0x56aa9a,_0x538512['stack']);_0x53def1[_0x4525('0xe')]();}};}; \ No newline at end of file +var _0x9ada=['[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log'];(function(_0x48026e,_0x231d79){var _0x23eece=function(_0x501ffe){while(--_0x501ffe){_0x48026e['push'](_0x48026e['shift']());}};_0x23eece(++_0x231d79);}(_0x9ada,0x6a));var _0xa9ad=function(_0x5ebfaf,_0x51dab9){_0x5ebfaf=_0x5ebfaf-0x0;var _0x3a2e30=_0x9ada[_0x5ebfaf];return _0x3a2e30;};'use strict';var schema=require(_0xa9ad('0x0'));var _=require(_0xa9ad('0x1'));var util=require(_0xa9ad('0x2'));var seqqueue=require(_0xa9ad('0x3'));var logger=require(_0xa9ad('0x4'))(_0xa9ad('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xa9ad('0x6')},'timeout':{'type':_0xa9ad('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2e0fa0,_0x297b91,_0x23be77){return logger[_0xa9ad('0x8')](util[_0xa9ad('0x9')](_0xa9ad('0xa'),_0x2e0fa0,_0x297b91['name'],_0x23be77));}function handleFindAgent(_0x4d80cb){return function(_0x50dbf0){return _0x50dbf0[_0xa9ad('0xb')][_0xa9ad('0xc')]()===_0x4d80cb[_0xa9ad('0xc')]();};}exports[_0xa9ad('0xd')]=function(_0x3a2e5c,_0x423beb,_0x4e99e8,_0x1475eb){return function(_0x169577){try{var _0x377371={'name':_0x423beb[0x0],'timeout':_0x423beb[0x1]};var _0x1379f8=queue[_0xa9ad('0x0')](_0x377371,{'typecast':!![]});if(_0x1379f8[_0xa9ad('0xe')]){logger[_0xa9ad('0xf')](_0xa9ad('0x10'),_0x3a2e5c,_[_0xa9ad('0x11')](_0x1379f8,_0xa9ad('0x12'))[_0xa9ad('0x13')](',\x20'));_0x169577['stop']();}else{var _0x384cee=_['find'](_0x4e99e8[_0xa9ad('0x14')],handleFindAgent(_0x377371[_0xa9ad('0xb')]));if(_0x384cee){var _0x17ad9f=(_0x377371[_0xa9ad('0x15')]||0xa)*0x3e8;var _0x3c3c56,_0x33dc15;var _0x48fc1c=seqqueue[_0xa9ad('0x16')](_0x17ad9f);_0x48fc1c['id']=_0x3a2e5c;_0x48fc1c[_0xa9ad('0x17')]=_0x17ad9f;_0x48fc1c[_0xa9ad('0x18')]=_0x1475eb[_0xa9ad('0x18')];writeLog(_0x3a2e5c,_0x384cee,util[_0xa9ad('0x9')]('START:%s',_0x17ad9f));_0x4e99e8[_0xa9ad('0x19')][_0x3a2e5c]['on'](_0xa9ad('0x1a'),function(){logger['info'](_0xa9ad('0x1b'),_0x3a2e5c);clearTimeout(_0x33dc15);_0x33dc15=undefined;_0x48fc1c[_0xa9ad('0x1c')]();if(_0x4e99e8['rules'][_0x3a2e5c]){delete _0x4e99e8[_0xa9ad('0x19')][_0x3a2e5c];}_0x169577['stop']();});_0x4e99e8['rules'][_0x3a2e5c]['on']('complete',function(){if(_0x4e99e8[_0xa9ad('0x19')][_0x3a2e5c]){delete _0x4e99e8[_0xa9ad('0x19')][_0x3a2e5c];}});_0x33dc15=setTimeout(function(){logger[_0xa9ad('0x8')](_0xa9ad('0x1d'),_0x3a2e5c);clearTimeout(_0x33dc15);_0x48fc1c[_0xa9ad('0x1c')]();_0x169577[_0xa9ad('0x1e')]();},_0x17ad9f);strategy['agent'](_0x48fc1c,_0x384cee,_0x4e99e8,_0x1475eb);}else{logger[_0xa9ad('0xf')](_0xa9ad('0x1f'),_0x3a2e5c,_0x377371[_0xa9ad('0xb')]);_0x169577[_0xa9ad('0x20')]();}}}catch(_0x2f59ea){console[_0xa9ad('0x21')](_0x2f59ea);logger[_0xa9ad('0xf')](_0xa9ad('0x22'),_0x3a2e5c,_0x2f59ea['stack']);_0x169577['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 45bca27..a907f8b 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 _0x9cfd=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','postText','amazonlex','providerName','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction'];(function(_0x37d4df,_0x30f586){var _0x1f743d=function(_0x9ef39f){while(--_0x9ef39f){_0x37d4df['push'](_0x37d4df['shift']());}};_0x1f743d(++_0x30f586);}(_0x9cfd,0x129));var _0xd9cf=function(_0x35018d,_0x47ad84){_0x35018d=_0x35018d-0x0;var _0x454777=_0x9cfd[_0x35018d];return _0x454777;};'use strict';var _=require(_0xd9cf('0x0'));var moment=require(_0xd9cf('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xd9cf('0x2')),'openchannelMessage':require(_0xd9cf('0x3')),'mailMessage':require(_0xd9cf('0x4')),'smsMessage':require(_0xd9cf('0x5')),'faxMessage':require(_0xd9cf('0x6')),'whatsappMessage':require(_0xd9cf('0x7'))};exports[_0xd9cf('0x8')]=function(_0x504744,_0x4b0f09){return function(_0x119348){try{if(!_[_0xd9cf('0x9')](this[_0xd9cf('0xa')]['UserId'])){logger[_0xd9cf('0xb')](_0xd9cf('0xc'),_0x504744,_0xd9cf('0xd'));return _0x119348[_0xd9cf('0xe')]();}var _0x283b86={'ContactId':this[_0xd9cf('0xf')]['id'],'sentAt':moment()[_0xd9cf('0x10')](_0xd9cf('0x11')),'direction':_0xd9cf('0x12')};if(this[_0xd9cf('0x13')]===_0xd9cf('0x14')||this[_0xd9cf('0x13')]===_0xd9cf('0x15')){_0x283b86[_0xd9cf('0x16')]=this['interaction']['phone'];}var _0x30c472=this[_0xd9cf('0x13')];if(_0x30c472==='chat'){_0x283b86[_0xd9cf('0x17')]=this['account']['id'];}else{_0x283b86[_[_0xd9cf('0x18')](_0x30c472)+'AccountId']=this['account']['id'];}_0x283b86[_[_0xd9cf('0x18')](_0x30c472)+_0xd9cf('0x19')]=this['interaction']['id'];if(this[_0xd9cf('0xa')][_0xd9cf('0x1a')]){var _0x505378=_0x4b0f09[0x4];if(!_[_0xd9cf('0x1b')](_0x505378)){_0x283b86[_0xd9cf('0x1c')]=utils[_0xd9cf('0x1d')](_0x505378,this);return rpc[_0x30c472+_0xd9cf('0x1e')][_0xd9cf('0x1f')](_0x283b86)[_0xd9cf('0x20')](function(_0xefde3d){logger[_0xd9cf('0xb')](_0xd9cf('0xc'),_0x504744,_0x283b86[_0xd9cf('0x1c')]);})[_0xd9cf('0x21')](function(_0x420986){logger[_0xd9cf('0x22')](_0xd9cf('0xc'),_0x504744,JSON[_0xd9cf('0x23')](_0x420986));})['finally'](function(){logger[_0xd9cf('0xb')](_0xd9cf('0x24'),_0x504744);_0x119348['stop']();});}else{logger['info'](_0xd9cf('0x25'),_0x504744);_0x119348[_0xd9cf('0x26')]();}}else{var _0x4b2e51=this;var _0x5cb075=new AWS['LexRuntime']({'accessKeyId':_0x4b0f09[0x0],'secretAccessKey':_0x4b0f09[0x1],'region':_0x4b0f09[0x2]});var _0x4ec53c={'botAlias':_0xd9cf('0x27'),'botName':_0x4b0f09[0x3],'inputText':this[_0xd9cf('0x28')][_0xd9cf('0x1c')],'userId':this[_0xd9cf('0x13')]+':'+this[_0xd9cf('0xa')]['id']['toString']()};_0x5cb075[_0xd9cf('0x29')](_0x4ec53c,function(_0x282e16,_0x2b1b7d){if(_0x282e16){logger['error'](_0xd9cf('0xc'),_0x504744,_0x282e16[_0xd9cf('0x28')]);_0x119348[_0xd9cf('0xe')]();}else if(_0x2b1b7d&&_0x2b1b7d[_0xd9cf('0x28')]){_0x4b2e51[_0xd9cf('0x1c')][_0xd9cf('0x2a')]=_0x2b1b7d;_0x283b86['body']=_0x2b1b7d[_0xd9cf('0x28')];_0x283b86[_0xd9cf('0x2b')]=_0xd9cf('0x2a');_0x283b86['providerResponse']=JSON[_0xd9cf('0x23')](_0x2b1b7d);return rpc[_0x30c472+_0xd9cf('0x1e')][_0xd9cf('0x1f')](_0x283b86)['then'](function(_0x1ef75e){logger[_0xd9cf('0xb')]('[%s][AMAZONLEX]\x20%s',_0x504744,_0x283b86[_0xd9cf('0x1c')]);if(_0x2b1b7d['dialogState']=='Failed'){_0x119348[_0xd9cf('0xe')]();}else{_0x119348[_0xd9cf('0x26')]();}})[_0xd9cf('0x21')](function(_0x275768){logger[_0xd9cf('0x22')]('[%s][AMAZONLEX]\x20%s',_0x504744,JSON['stringify'](_0x275768));_0x119348[_0xd9cf('0xe')]();});}else{_0x119348[_0xd9cf('0xe')]();}});}}catch(_0x34908c){logger['error']('[%s][AMAZONLEX]\x20%s',_0x504744,JSON[_0xd9cf('0x23')](_0x34908c));_0x119348[_0xd9cf('0x26')]();}};}; \ No newline at end of file +var _0xf775=['getMustacheRender','create','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','providerName','providerResponse','then','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body'];(function(_0x17491f,_0x3e1d71){var _0x315d8d=function(_0x263af0){while(--_0x263af0){_0x17491f['push'](_0x17491f['shift']());}};_0x315d8d(++_0x3e1d71);}(_0xf775,0x1e8));var _0x5f77=function(_0x251b1f,_0x41ecf4){_0x251b1f=_0x251b1f-0x0;var _0xeb5d2f=_0xf775[_0x251b1f];return _0xeb5d2f;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x5f77('0x0'));var utils=require(_0x5f77('0x1'));var logger=require(_0x5f77('0x2'))(_0x5f77('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5f77('0x4')),'mailMessage':require(_0x5f77('0x5')),'smsMessage':require(_0x5f77('0x6')),'faxMessage':require(_0x5f77('0x7')),'whatsappMessage':require(_0x5f77('0x8'))};exports[_0x5f77('0x9')]=function(_0xb763fa,_0x2a30c2){return function(_0x3b1a29){try{if(!_['isNil'](this[_0x5f77('0xa')][_0x5f77('0xb')])){logger[_0x5f77('0xc')](_0x5f77('0xd'),_0xb763fa,_0x5f77('0xe'));return _0x3b1a29[_0x5f77('0xf')]();}var _0x422b00={'ContactId':this[_0x5f77('0x10')]['id'],'sentAt':moment()[_0x5f77('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x5f77('0x12')]===_0x5f77('0x13')||this[_0x5f77('0x12')]===_0x5f77('0x14')){_0x422b00[_0x5f77('0x15')]=this[_0x5f77('0xa')][_0x5f77('0x15')];}var _0x6dc7c7=this[_0x5f77('0x12')];if(_0x6dc7c7==='chat'){_0x422b00[_0x5f77('0x16')]=this[_0x5f77('0x17')]['id'];}else{_0x422b00[_[_0x5f77('0x18')](_0x6dc7c7)+'AccountId']=this[_0x5f77('0x17')]['id'];}_0x422b00[_[_0x5f77('0x18')](_0x6dc7c7)+_0x5f77('0x19')]=this[_0x5f77('0xa')]['id'];if(this[_0x5f77('0xa')][_0x5f77('0x1a')]){var _0x3bab21=_0x2a30c2[0x4];if(!_[_0x5f77('0x1b')](_0x3bab21)){_0x422b00[_0x5f77('0x1c')]=utils[_0x5f77('0x1d')](_0x3bab21,this);return rpc[_0x6dc7c7+'Message'][_0x5f77('0x1e')](_0x422b00)['then'](function(_0x401d44){logger[_0x5f77('0xc')](_0x5f77('0xd'),_0xb763fa,_0x422b00['body']);})[_0x5f77('0x1f')](function(_0x680d){logger['error'](_0x5f77('0xd'),_0xb763fa,JSON[_0x5f77('0x20')](_0x680d));})[_0x5f77('0x21')](function(){logger['info'](_0x5f77('0x22'),_0xb763fa);_0x3b1a29['stop']();});}else{logger[_0x5f77('0xc')](_0x5f77('0x23'),_0xb763fa);_0x3b1a29[_0x5f77('0x24')]();}}else{var _0x4b4a82=this;var _0x58d664=new AWS[(_0x5f77('0x25'))]({'accessKeyId':_0x2a30c2[0x0],'secretAccessKey':_0x2a30c2[0x1],'region':_0x2a30c2[0x2]});var _0x4fa126={'botAlias':_0x5f77('0x26'),'botName':_0x2a30c2[0x3],'inputText':this[_0x5f77('0x27')][_0x5f77('0x1c')],'userId':this['channel']+':'+this['interaction']['id'][_0x5f77('0x28')]()};_0x58d664[_0x5f77('0x29')](_0x4fa126,function(_0x43331a,_0x1b7de3){if(_0x43331a){logger[_0x5f77('0x2a')](_0x5f77('0xd'),_0xb763fa,_0x43331a[_0x5f77('0x27')]);_0x3b1a29['next']();}else if(_0x1b7de3&&_0x1b7de3[_0x5f77('0x27')]){_0x4b4a82['body'][_0x5f77('0x2b')]=_0x1b7de3;_0x422b00[_0x5f77('0x1c')]=_0x1b7de3['message'];_0x422b00[_0x5f77('0x2c')]=_0x5f77('0x2b');_0x422b00[_0x5f77('0x2d')]=JSON[_0x5f77('0x20')](_0x1b7de3);return rpc[_0x6dc7c7+'Message'][_0x5f77('0x1e')](_0x422b00)[_0x5f77('0x2e')](function(_0x2770d4){logger['info'](_0x5f77('0xd'),_0xb763fa,_0x422b00[_0x5f77('0x1c')]);if(_0x1b7de3['dialogState']=='Failed'){_0x3b1a29['next']();}else{_0x3b1a29[_0x5f77('0x24')]();}})['catch'](function(_0x54ebb5){logger[_0x5f77('0x2a')]('[%s][AMAZONLEX]\x20%s',_0xb763fa,JSON['stringify'](_0x54ebb5));_0x3b1a29[_0x5f77('0xf')]();});}else{_0x3b1a29[_0x5f77('0xf')]();}});}}catch(_0x4c356c){logger[_0x5f77('0x2a')](_0x5f77('0xd'),_0xb763fa,JSON[_0x5f77('0x20')](_0x4c356c));_0x3b1a29[_0x5f77('0x24')]();}};}; \ 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 e8d1a6e..77df826 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 _0x3812=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','All','auto_reply','sendMailMessage','smtpOptions','create','then','stringify','catch','resolve','autoreplyExecuted','Interaction','update','error','finally','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','mail','body','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x4c54c3,_0x52e094){var _0x401a74=function(_0x119247){while(--_0x119247){_0x4c54c3['push'](_0x4c54c3['shift']());}};_0x401a74(++_0x52e094);}(_0x3812,0xee));var _0x2381=function(_0xfd48c8,_0x1782d5){_0xfd48c8=_0xfd48c8-0x0;var _0x4cb58f=_0x3812[_0xfd48c8];return _0x4cb58f;};'use strict';var _=require(_0x2381('0x0'));var moment=require(_0x2381('0x1'));var utils=require('./utils');var logger=require(_0x2381('0x2'))(_0x2381('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2381('0x4')),'mailMessage':require(_0x2381('0x5')),'smsMessage':require(_0x2381('0x6')),'faxMessage':require(_0x2381('0x7')),'whatsappMessage':require(_0x2381('0x8')),'chatInteraction':require(_0x2381('0x9')),'openchannelInteraction':require(_0x2381('0xa')),'mailInteraction':require(_0x2381('0xb')),'smsInteraction':require(_0x2381('0xc')),'faxInteraction':require(_0x2381('0xd')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3b4aa0,_0x48ab46,_0x19741b,_0x1de4b2){return function(_0x2975a6){try{var _0x4b2cf3=this['channel'];if(_0x4b2cf3===_0x2381('0xe')&&_0x1de4b2[_0x2381('0xf')][_0x2381('0x10')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3b4aa0,_0x2381('0x11'));return _0x2975a6[_0x2381('0x12')]();}if(_0x48ab46[0x0]==='1'&&(_[_0x2381('0x13')](this[_0x2381('0x14')]['created'])||!this[_0x2381('0x14')][_0x2381('0x15')])){logger['info'](_0x2381('0x16'),_0x3b4aa0,_0x2381('0x17'));return _0x2975a6['next']();}if(_0x48ab46[0x0]==='2'&&this[_0x2381('0x14')]['autoreplyExecuted']){logger[_0x2381('0x18')](_0x2381('0x19'),_0x3b4aa0,'One\x20Time\x20already\x20sent');return _0x2975a6[_0x2381('0x12')]();}var _0x5d90ad={'ContactId':this[_0x2381('0x1a')]['id'],'sentAt':moment()[_0x2381('0x1b')](_0x2381('0x1c')),'direction':_0x2381('0x1d')};if(this[_0x2381('0x1e')]===_0x2381('0xe')){_0x5d90ad[_0x2381('0xf')]=utils['getMustacheRender'](_0x48ab46[0x2],this);}else{_0x5d90ad[_0x2381('0xf')]=utils['getMustacheRender'](_0x48ab46[0x1],this);}if(this[_0x2381('0x1f')]){_0x5d90ad['to']=this[_0x2381('0x1f')][_0x2381('0x20')]||'';if(this['channel']==='mail'&&_0x48ab46[0x1]==='1'){_0x5d90ad['cc']=this['message']['cc']||'';}_0x5d90ad[_0x2381('0x20')]=this[_0x2381('0x1f')]['to']||'';_0x5d90ad['phone']=this[_0x2381('0x1f')][_0x2381('0x21')]||'';_0x5d90ad['read']=!![];if(this['message']['subject']){_0x5d90ad[_0x2381('0x22')]='';_0x5d90ad['subject']+=_[_0x2381('0x23')](this[_0x2381('0x1f')][_0x2381('0x22')],_0x2381('0x24'))?'':'Re:\x20';_0x5d90ad[_0x2381('0x22')]+=this['message'][_0x2381('0x22')];}}if(this[_0x2381('0x1e')]===_0x2381('0x25')){_0x5d90ad[_0x2381('0x26')]=this[_0x2381('0x27')]['id'];}else{_0x5d90ad[_[_0x2381('0x28')](this[_0x2381('0x1e')])+_0x2381('0x29')]=this[_0x2381('0x27')]['id'];}_0x5d90ad[_[_0x2381('0x28')](this[_0x2381('0x1e')])+_0x2381('0x2a')]=this[_0x2381('0x14')]['id'];var _0x3d51f3=this['interaction'];if(rpc[this[_0x2381('0x1e')]+_0x2381('0x2b')]){if(this['channel']===_0x2381('0xe')){_0x5d90ad[_0x2381('0x2c')]=this[_0x2381('0x1f')][_0x2381('0x2d')];_0x5d90ad[_0x2381('0x2e')]=_0x2381('0x2f')+_[_0x2381('0x30')](_0x5d90ad[_0x2381('0xf')],_0x2381('0x31'),_0x2381('0x32'))+_0x2381('0x33');_0x5d90ad['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x2381('0x34'),'Precedence':_0x2381('0x35')};return mailRpc[_0x2381('0x36')](this[_0x2381('0x27')][_0x2381('0x37')],_0x5d90ad)['then'](function(_0x5b32bf){logger[_0x2381('0x18')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3b4aa0);_0x5d90ad[_0x2381('0x2d')]=_0x5b32bf['message'][_0x2381('0x2d')];return rpc[_0x4b2cf3+_0x2381('0x2b')][_0x2381('0x38')](_0x5d90ad);})[_0x2381('0x39')](function(_0x26a8b0){logger[_0x2381('0x18')](_0x2381('0x16'),_0x3b4aa0,JSON[_0x2381('0x3a')](_0x26a8b0));})[_0x2381('0x3b')](function(_0x3ac976){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x3b4aa0,JSON[_0x2381('0x3a')](_0x3ac976));})['finally'](function(){Promise[_0x2381('0x3c')]()[_0x2381('0x39')](function(){if(_0x48ab46[0x0]!=='2'||_0x3d51f3[_0x2381('0x3d')])return;return rpc[_0x4b2cf3+_0x2381('0x3e')][_0x2381('0x3f')](_0x3d51f3['id'],{'autoreplyExecuted':!![]})[_0x2381('0x39')](function(_0x29b5b9){logger['info'](_0x2381('0x19'),_0x3b4aa0,JSON[_0x2381('0x3a')](_0x29b5b9));})[_0x2381('0x3b')](function(_0x4751f6){logger[_0x2381('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b4aa0,JSON[_0x2381('0x3a')](_0x4751f6));});})[_0x2381('0x39')](function(){_0x2975a6[_0x2381('0x12')]();});});}else{return rpc[this[_0x2381('0x1e')]+_0x2381('0x2b')][_0x2381('0x38')](_0x5d90ad)['then'](function(){logger['info'](_0x2381('0x16'),_0x3b4aa0,_0x5d90ad[_0x2381('0xf')]);})['catch'](function(_0x172235){logger[_0x2381('0x40')](_0x2381('0x16'),_0x3b4aa0,JSON[_0x2381('0x3a')](_0x172235));})[_0x2381('0x41')](function(){Promise[_0x2381('0x3c')]()[_0x2381('0x39')](function(){if(_0x48ab46[0x0]!=='2'||_0x3d51f3[_0x2381('0x3d')])return;return rpc[_0x4b2cf3+'Interaction'][_0x2381('0x3f')](_0x3d51f3['id'],{'autoreplyExecuted':!![]})[_0x2381('0x39')](function(_0x261331){logger[_0x2381('0x18')](_0x2381('0x19'),_0x3b4aa0,JSON[_0x2381('0x3a')](_0x261331));})[_0x2381('0x3b')](function(_0x31c75d){logger[_0x2381('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b4aa0,JSON[_0x2381('0x3a')](_0x31c75d));});})[_0x2381('0x39')](function(){_0x2975a6[_0x2381('0x12')]();});});}}}catch(_0x18abd6){logger['error'](_0x2381('0x16'),_0x3b4aa0,JSON[_0x2381('0x3a')](_0x18abd6));_0x2975a6['stop']();}};}; \ No newline at end of file +var _0x850a=['interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html',''+_['replace'](_0x13108c[_0xa850('0xc')],_0xa850('0x2a'),_0xa850('0x2b'))+'';_0x13108c[_0xa850('0x2c')]={'Auto-Submitted':_0xa850('0x2d'),'X-Auto-Response-Suppress':'All','Precedence':_0xa850('0x2e')};return mailRpc[_0xa850('0x2f')](this[_0xa850('0x22')]['smtpOptions'],_0x13108c)[_0xa850('0x30')](function(_0x5e39fb){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3b9fca);_0x13108c[_0xa850('0x28')]=_0x5e39fb[_0xa850('0x1b')]['messageId'];return rpc[_0x585c09+_0xa850('0x26')][_0xa850('0x31')](_0x13108c);})[_0xa850('0x30')](function(_0x449bf4){logger[_0xa850('0xe')](_0xa850('0xf'),_0x3b9fca,JSON[_0xa850('0x32')](_0x449bf4));})[_0xa850('0x33')](function(_0x10318c){logger[_0xa850('0x34')](_0xa850('0x35'),_0x3b9fca,JSON['stringify'](_0x10318c));})[_0xa850('0x36')](function(){Promise[_0xa850('0x37')]()['then'](function(){if(_0x481aa6[0x0]!=='2'||_0x5c7814[_0xa850('0x15')])return;return rpc[_0x585c09+_0xa850('0x38')][_0xa850('0x39')](_0x5c7814['id'],{'autoreplyExecuted':!![]})[_0xa850('0x30')](function(_0x49d9e4){logger[_0xa850('0xe')](_0xa850('0x16'),_0x3b9fca,JSON[_0xa850('0x32')](_0x49d9e4));})[_0xa850('0x33')](function(_0x2b0217){logger[_0xa850('0x34')](_0xa850('0x3a'),_0x3b9fca,JSON['stringify'](_0x2b0217));});})['then'](function(){_0x340818[_0xa850('0x11')]();});});}else{return rpc[this[_0xa850('0xa')]+'Message'][_0xa850('0x31')](_0x13108c)[_0xa850('0x30')](function(){logger[_0xa850('0xe')]('[%s][AUTOREPLY]\x20%s',_0x3b9fca,_0x13108c[_0xa850('0xc')]);})[_0xa850('0x33')](function(_0x3b5462){logger[_0xa850('0x34')](_0xa850('0xf'),_0x3b9fca,JSON['stringify'](_0x3b5462));})[_0xa850('0x36')](function(){Promise[_0xa850('0x37')]()[_0xa850('0x30')](function(){if(_0x481aa6[0x0]!=='2'||_0x5c7814[_0xa850('0x15')])return;return rpc[_0x585c09+_0xa850('0x38')][_0xa850('0x39')](_0x5c7814['id'],{'autoreplyExecuted':!![]})[_0xa850('0x30')](function(_0x559c43){logger[_0xa850('0xe')](_0xa850('0x16'),_0x3b9fca,JSON[_0xa850('0x32')](_0x559c43));})[_0xa850('0x33')](function(_0x1024e0){logger[_0xa850('0x34')](_0xa850('0x3a'),_0x3b9fca,JSON[_0xa850('0x32')](_0x1024e0));});})[_0xa850('0x30')](function(){_0x340818[_0xa850('0x11')]();});});}}}catch(_0x4c5de1){logger[_0xa850('0x34')](_0xa850('0xf'),_0x3b9fca,JSON[_0xa850('0x32')](_0x4c5de1));_0x340818[_0xa850('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index de45969..5dc2f6e 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x651f=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','stringify','finally','stop','error','moment','../../../../config/logger','routing'];(function(_0x53e19d,_0x604957){var _0x5ba332=function(_0x34f66e){while(--_0x34f66e){_0x53e19d['push'](_0x53e19d['shift']());}};_0x5ba332(++_0x604957);}(_0x651f,0x165));var _0xf651=function(_0x4dbd0f,_0x5247b6){_0x4dbd0f=_0x4dbd0f-0x0;var _0x2af85a=_0x651f[_0x4dbd0f];return _0x2af85a;};'use strict';var moment=require(_0xf651('0x0'));var logger=require(_0xf651('0x1'))(_0xf651('0x2'));var rpc={'chatInteraction':require(_0xf651('0x3')),'openchannelInteraction':require(_0xf651('0x4')),'smsInteraction':require(_0xf651('0x5')),'mailInteraction':require(_0xf651('0x6')),'faxInteraction':require(_0xf651('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xf651('0x8')]=function(_0x554b51,_0x263d2e,_0x5952de,_0x1f2188){return function(_0x4747f6){try{logger[_0xf651('0x9')](_0xf651('0xa'),_0x554b51,_0x263d2e[0x0]);var _0x22e983={'closed':0x1,'closedAt':moment()[_0xf651('0xb')](_0xf651('0xc')),'closeReason':_0xf651('0xd'),'disposition':_0x263d2e[0x0]};if(rpc[_0x1f2188['channel']+'Interaction']){rpc[_0x1f2188[_0xf651('0xe')]+_0xf651('0xf')][_0xf651('0x10')](_0x1f2188[_0xf651('0x11')]['id'],_0x22e983)[_0xf651('0x12')](function(_0x3ae881){logger[_0xf651('0x9')](_0xf651('0x13'),_0x554b51,_0x1f2188[_0xf651('0x11')]['id']);})['catch'](function(_0x3ff6f4){logger['error']('[%s][CLOSE]\x20%s',_0x554b51,JSON[_0xf651('0x14')](_0x3ff6f4));})[_0xf651('0x15')](function(){_0x4747f6[_0xf651('0x16')]();});}}catch(_0x2a9984){logger[_0xf651('0x17')]('[%s][CLOSE]\x20%s',_0x554b51,JSON[_0xf651('0x14')](_0x2a9984));_0x4747f6['stop']();}};}; \ No newline at end of file +var _0xf8b0=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xf8b0,0x163));var _0x0f8b=function(_0x458632,_0x3fdb39){_0x458632=_0x458632-0x0;var _0x4116b0=_0xf8b0[_0x458632];return _0x4116b0;};'use strict';var moment=require(_0x0f8b('0x0'));var logger=require(_0x0f8b('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0f8b('0x2')),'smsInteraction':require(_0x0f8b('0x3')),'mailInteraction':require(_0x0f8b('0x4')),'faxInteraction':require(_0x0f8b('0x5')),'whatsappInteraction':require(_0x0f8b('0x6'))};exports['consequence']=function(_0x3106b2,_0x564ba2,_0x5957d5,_0x205735){return function(_0xf2661c){try{logger[_0x0f8b('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x3106b2,_0x564ba2[0x0]);var _0x2219d9={'closed':0x1,'closedAt':moment()['format'](_0x0f8b('0x8')),'closeReason':'system','disposition':_0x564ba2[0x0]};if(rpc[_0x205735[_0x0f8b('0x9')]+_0x0f8b('0xa')]){rpc[_0x205735[_0x0f8b('0x9')]+'Interaction'][_0x0f8b('0xb')](_0x205735[_0x0f8b('0xc')]['id'],_0x2219d9)['then'](function(_0x12fc24){logger['info'](_0x0f8b('0xd'),_0x3106b2,_0x205735['interaction']['id']);})[_0x0f8b('0xe')](function(_0x5c0c2e){logger['error'](_0x0f8b('0xf'),_0x3106b2,JSON[_0x0f8b('0x10')](_0x5c0c2e));})[_0x0f8b('0x11')](function(){_0xf2661c[_0x0f8b('0x12')]();});}}catch(_0x155896){logger[_0x0f8b('0x13')]('[%s][CLOSE]\x20%s',_0x3106b2,JSON[_0x0f8b('0x10')](_0x155896));_0xf2661c[_0x0f8b('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 10d7a10..9cbc10b 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f0d=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','then','dialogflow','result','speech','providerResponse','create','endConversation','../../../../config/logger'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x4f0d[_0x59e821];return _0x5333f6;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require('./utils');var logger=require(_0xd4f0('0x0'))(_0xd4f0('0x1'));var rpc={'chatMessage':require(_0xd4f0('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd4f0('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd4f0('0x4'))};exports['consequence']=function(_0x16da18,_0x4dd938){return function(_0x50e79f){try{if(!_[_0xd4f0('0x5')](this[_0xd4f0('0x6')][_0xd4f0('0x7')])){logger[_0xd4f0('0x8')](_0xd4f0('0x9'),_0x16da18,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x50e79f[_0xd4f0('0xa')]();}var _0x40ed12={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xd4f0('0xb')),'direction':_0xd4f0('0xc')};if(this['channel']===_0xd4f0('0xd')||this[_0xd4f0('0xe')]===_0xd4f0('0xf')){_0x40ed12[_0xd4f0('0x10')]=this[_0xd4f0('0x6')]['phone'];}var _0xdddd54=this[_0xd4f0('0xe')];if(_0xdddd54===_0xd4f0('0x11')){_0x40ed12[_0xd4f0('0x12')]=this[_0xd4f0('0x13')]['id'];}else{_0x40ed12[_[_0xd4f0('0x14')](_0xdddd54)+_0xd4f0('0x15')]=this[_0xd4f0('0x13')]['id'];}_0x40ed12[_[_0xd4f0('0x14')](_0xdddd54)+_0xd4f0('0x16')]=this[_0xd4f0('0x6')]['id'];if(this[_0xd4f0('0x6')]['created']){var _0x5adf8a=_0x4dd938[0x2];if(!_[_0xd4f0('0x17')](_0x5adf8a)){_0x40ed12[_0xd4f0('0x18')]=utils[_0xd4f0('0x19')](_0x5adf8a,this);return rpc[_0xdddd54+_0xd4f0('0x1a')]['create'](_0x40ed12)['then'](function(_0x122d27){logger[_0xd4f0('0x8')](_0xd4f0('0x9'),_0x16da18,_0x40ed12[_0xd4f0('0x18')]);})[_0xd4f0('0x1b')](function(_0x410a93){logger[_0xd4f0('0x1c')](_0xd4f0('0x9'),_0x16da18,JSON[_0xd4f0('0x1d')](_0x410a93));})[_0xd4f0('0x1e')](function(){logger['info'](_0xd4f0('0x1f'),_0x16da18);_0x50e79f[_0xd4f0('0x20')]();});}else{logger[_0xd4f0('0x8')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x16da18);_0x50e79f[_0xd4f0('0x20')]();}}else{var _0x31c7a0=this;var _0x655480=apiai(_0x4dd938[0x0],{'language':_0x4dd938[0x1]||'en'});return _0x655480['textRequest'](this[_0xd4f0('0x21')][_0xd4f0('0x18')],{'sessionId':md5(this[_0xd4f0('0x6')]['id'])})[_0xd4f0('0x22')](function(_0x4fd650){_0x31c7a0[_0xd4f0('0x18')][_0xd4f0('0x23')]=_0x4fd650;_0x40ed12[_0xd4f0('0x18')]=_0x4fd650[_0xd4f0('0x24')]['fulfillment'][_0xd4f0('0x25')];_0x40ed12['providerName']=_0xd4f0('0x23');_0x40ed12[_0xd4f0('0x26')]=JSON[_0xd4f0('0x1d')](_0x4fd650);return rpc[_0xdddd54+_0xd4f0('0x1a')][_0xd4f0('0x27')](_0x40ed12)[_0xd4f0('0x22')](function(_0x1dd584){logger[_0xd4f0('0x8')](_0xd4f0('0x9'),_0x16da18,_0x40ed12[_0xd4f0('0x18')]);if(_0x4fd650[_0xd4f0('0x24')]['metadata'][_0xd4f0('0x28')]){_0x50e79f[_0xd4f0('0xa')]();}else{_0x50e79f[_0xd4f0('0x20')]();}})[_0xd4f0('0x1b')](function(_0x54cb05){logger[_0xd4f0('0x1c')](_0xd4f0('0x9'),_0x16da18,JSON[_0xd4f0('0x1d')](_0x54cb05));_0x50e79f[_0xd4f0('0xa')]();});})['catch'](function(_0x39c44a){logger[_0xd4f0('0x1c')](_0xd4f0('0x9'),_0x16da18,_0x39c44a[_0xd4f0('0x21')]);_0x50e79f['next']();});}}catch(_0x8af72e){logger[_0xd4f0('0x1c')](_0xd4f0('0x9'),_0x16da18,JSON[_0xd4f0('0x1d')](_0x8af72e));_0x50e79f[_0xd4f0('0x20')]();}};}; \ No newline at end of file +var _0xbdb9=['phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','dialogflow','result','fulfillment','providerName','providerResponse','stringify','metadata','endConversation','catch','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xbdb9,0xac));var _0x9bdb=function(_0x4f06fe,_0x59001a){_0x4f06fe=_0x4f06fe-0x0;var _0x130d66=_0xbdb9[_0x4f06fe];return _0x130d66;};'use strict';var _=require(_0x9bdb('0x0'));var moment=require(_0x9bdb('0x1'));var apiai=require(_0x9bdb('0x2'));var md5=require(_0x9bdb('0x3'));var utils=require(_0x9bdb('0x4'));var logger=require('../../../../config/logger')(_0x9bdb('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9bdb('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9bdb('0x7')]=function(_0x4e9c54,_0x369e4a){return function(_0x27cdd8){try{if(!_[_0x9bdb('0x8')](this[_0x9bdb('0x9')][_0x9bdb('0xa')])){logger[_0x9bdb('0xb')](_0x9bdb('0xc'),_0x4e9c54,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x27cdd8[_0x9bdb('0xd')]();}var _0x355bad={'ContactId':this[_0x9bdb('0xe')]['id'],'sentAt':moment()[_0x9bdb('0xf')](_0x9bdb('0x10')),'direction':'out'};if(this['channel']===_0x9bdb('0x11')||this[_0x9bdb('0x12')]===_0x9bdb('0x13')){_0x355bad[_0x9bdb('0x14')]=this[_0x9bdb('0x9')][_0x9bdb('0x14')];}var _0x5d626d=this[_0x9bdb('0x12')];if(_0x5d626d===_0x9bdb('0x15')){_0x355bad[_0x9bdb('0x16')]=this[_0x9bdb('0x17')]['id'];}else{_0x355bad[_[_0x9bdb('0x18')](_0x5d626d)+'AccountId']=this[_0x9bdb('0x17')]['id'];}_0x355bad[_[_0x9bdb('0x18')](_0x5d626d)+_0x9bdb('0x19')]=this['interaction']['id'];if(this[_0x9bdb('0x9')][_0x9bdb('0x1a')]){var _0x1cb06d=_0x369e4a[0x2];if(!_[_0x9bdb('0x1b')](_0x1cb06d)){_0x355bad[_0x9bdb('0x1c')]=utils[_0x9bdb('0x1d')](_0x1cb06d,this);return rpc[_0x5d626d+_0x9bdb('0x1e')][_0x9bdb('0x1f')](_0x355bad)[_0x9bdb('0x20')](function(_0x38b812){logger['info'](_0x9bdb('0xc'),_0x4e9c54,_0x355bad[_0x9bdb('0x1c')]);})['catch'](function(_0x119c69){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON['stringify'](_0x119c69));})[_0x9bdb('0x22')](function(){logger[_0x9bdb('0xb')](_0x9bdb('0x23'),_0x4e9c54);_0x27cdd8['stop']();});}else{logger[_0x9bdb('0xb')](_0x9bdb('0x24'),_0x4e9c54);_0x27cdd8[_0x9bdb('0x25')]();}}else{var _0x2150da=this;var _0x41a213=apiai(_0x369e4a[0x0],{'language':_0x369e4a[0x1]||'en'});return _0x41a213[_0x9bdb('0x26')](this['message']['body'],{'sessionId':md5(this[_0x9bdb('0x9')]['id'])})[_0x9bdb('0x20')](function(_0x1bba44){_0x2150da['body'][_0x9bdb('0x27')]=_0x1bba44;_0x355bad[_0x9bdb('0x1c')]=_0x1bba44[_0x9bdb('0x28')][_0x9bdb('0x29')]['speech'];_0x355bad[_0x9bdb('0x2a')]='dialogflow';_0x355bad[_0x9bdb('0x2b')]=JSON[_0x9bdb('0x2c')](_0x1bba44);return rpc[_0x5d626d+_0x9bdb('0x1e')]['create'](_0x355bad)[_0x9bdb('0x20')](function(_0xab83c9){logger[_0x9bdb('0xb')](_0x9bdb('0xc'),_0x4e9c54,_0x355bad[_0x9bdb('0x1c')]);if(_0x1bba44[_0x9bdb('0x28')][_0x9bdb('0x2d')][_0x9bdb('0x2e')]){_0x27cdd8[_0x9bdb('0xd')]();}else{_0x27cdd8[_0x9bdb('0x25')]();}})['catch'](function(_0x3af112){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON[_0x9bdb('0x2c')](_0x3af112));_0x27cdd8[_0x9bdb('0xd')]();});})[_0x9bdb('0x2f')](function(_0x106160){logger['error'](_0x9bdb('0xc'),_0x4e9c54,_0x106160['message']);_0x27cdd8[_0x9bdb('0xd')]();});}}catch(_0xed0f41){logger[_0x9bdb('0x21')](_0x9bdb('0xc'),_0x4e9c54,JSON[_0x9bdb('0x2c')](_0xed0f41));_0x27cdd8[_0x9bdb('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2c87625..497ae10 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1094=['SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','error','stack','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','body','stringify','consequence','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','catch','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace'];(function(_0xbd236a,_0x274557){var _0x19154b=function(_0x31295f){while(--_0x31295f){_0xbd236a['push'](_0xbd236a['shift']());}};_0x19154b(++_0x274557);}(_0x1094,0xa7));var _0x4109=function(_0x20afc3,_0x2f189a){_0x20afc3=_0x20afc3-0x0;var _0x4cbb43=_0x1094[_0x20afc3];return _0x4cbb43;};'use strict';var _=require('lodash');var dialogflow=require(_0x4109('0x0'));var md5=require(_0x4109('0x1'));var moment=require(_0x4109('0x2'));var Promise=require(_0x4109('0x3'));var logger=require(_0x4109('0x4'))(_0x4109('0x5'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4109('0x6')),'smsMessage':require(_0x4109('0x7')),'faxMessage':require(_0x4109('0x8')),'whatsappMessage':require(_0x4109('0x9'))};function createMessage(_0x30c8a1,_0x1ac0e1,_0xd9e491,_0x19facc){return new Promise(function(_0x485e09,_0x1998e1){var _0x2dad21=_[_0x4109('0xa')](_0xd9e491);_0x2dad21['body']=_0x19facc;return rpc[_0x1ac0e1+_0x4109('0xb')][_0x4109('0xc')](_0x2dad21)[_0x4109('0xd')](function(){logger[_0x4109('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x30c8a1,_0x2dad21[_0x4109('0xf')]);_0x485e09();})['catch'](function(_0x484d22){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x30c8a1,JSON[_0x4109('0x10')](_0x484d22));_0x1998e1(_0x484d22);});});}exports[_0x4109('0x11')]=function(_0xf89e85,_0x333a26){return function(_0x508922){try{if(!_['isNil'](this['interaction'][_0x4109('0x12')])){logger['info'](_0x4109('0x13'),_0xf89e85,_0x4109('0x14'));return _0x508922[_0x4109('0x15')]();}var _0x11bbf0={'ContactId':this[_0x4109('0x16')]['id'],'sentAt':moment()[_0x4109('0x17')](_0x4109('0x18')),'direction':_0x4109('0x19')};if(this[_0x4109('0x1a')]===_0x4109('0x1b')||this['channel']===_0x4109('0x1c')){_0x11bbf0[_0x4109('0x1d')]=this[_0x4109('0x1e')][_0x4109('0x1d')];}var _0x1872f5=this[_0x4109('0x1a')];if(_0x1872f5===_0x4109('0x1f')){_0x11bbf0[_0x4109('0x20')]=this[_0x4109('0x21')]['id'];}else{_0x11bbf0[_[_0x4109('0x22')](_0x1872f5)+'AccountId']=this[_0x4109('0x21')]['id'];}_0x11bbf0[_[_0x4109('0x22')](_0x1872f5)+_0x4109('0x23')]=this[_0x4109('0x1e')]['id'];if(this[_0x4109('0x1e')][_0x4109('0x24')]){var _0x57ea8e=_0x333a26[0x4];if(!_[_0x4109('0x25')](_0x57ea8e)){_0x11bbf0['body']=utils['getMustacheRender'](_0x57ea8e,this);return rpc[_0x1872f5+_0x4109('0xb')][_0x4109('0xc')](_0x11bbf0)[_0x4109('0xd')](function(_0x468677){logger[_0x4109('0xe')](_0x4109('0x13'),_0xf89e85,_0x11bbf0[_0x4109('0xf')]);})[_0x4109('0x26')](function(_0x58f4ca){logger['error'](_0x4109('0x13'),_0xf89e85,JSON[_0x4109('0x10')](_0x58f4ca));})['finally'](function(){logger[_0x4109('0xe')](_0x4109('0x27'),_0xf89e85);_0x508922[_0x4109('0x28')]();});}else{logger['info'](_0x4109('0x29'),_0xf89e85);_0x508922['stop']();}}else{var _0x1ca447=this;var _0x44e26c=_0x333a26[0x2][_0x4109('0x2a')](/\\n/g,'\x0a');var _0x40c770={'credentials':{'private_key':_0x44e26c,'client_email':_0x333a26[0x1]}};var _0x321d0e=new dialogflow[(_0x4109('0x2b'))](_0x40c770);var _0x2039fc=_0x321d0e['sessionPath'](_0x333a26[0x0],md5(_0x1ca447[_0x4109('0x1e')]['id']));var _0x4e9c58={'session':_0x2039fc,'queryInput':{'text':{'text':_0x1ca447[_0x4109('0x2c')]['body'],'languageCode':_0x333a26[0x3]||'en'}}};return _0x321d0e[_0x4109('0x2d')](_0x4e9c58)[_0x4109('0xd')](function(_0xfea2b0){if(_0xfea2b0&&_0xfea2b0['length']){_0x1ca447[_0x4109('0xf')][_0x4109('0x2e')]=_0xfea2b0;var _0x5f5312=_0xfea2b0[0x0];var _0x20d5bb=_0x5f5312[_0x4109('0x2f')][_0x4109('0x30')]&&_0x5f5312['queryResult']['diagnosticInfo'][_0x4109('0x31')]?_0x5f5312[_0x4109('0x2f')][_0x4109('0x30')][_0x4109('0x31')][_0x4109('0x32')][_0x4109('0x33')]:![];_0x1ca447['body']['DIALOGFLOWV2_ACTION']=_0x5f5312[_0x4109('0x2f')][_0x4109('0x34')];_0x1ca447[_0x4109('0xf')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5f5312[_0x4109('0x2f')]['allRequiredParamsPresent'];_0x1ca447[_0x4109('0xf')][_0x4109('0x35')]=_0x5f5312[_0x4109('0x2f')][_0x4109('0x30')]&&_0x5f5312[_0x4109('0x2f')][_0x4109('0x30')][_0x4109('0x31')]?_0x5f5312[_0x4109('0x2f')][_0x4109('0x30')]['fields'][_0x4109('0x32')][_0x4109('0x33')]:![];_0x1ca447[_0x4109('0xf')][_0x4109('0x36')]=_0x5f5312['queryResult'][_0x4109('0x37')][_0x4109('0x38')];_0x1ca447[_0x4109('0xf')][_0x4109('0x39')]=_0x5f5312['queryResult'][_0x4109('0x37')][_0x4109('0x3a')];_0x1ca447[_0x4109('0xf')][_0x4109('0x3b')]=_0x5f5312['queryResult'][_0x4109('0x37')][_0x4109('0x3c')];_0x1ca447[_0x4109('0xf')][_0x4109('0x3d')]=_0x5f5312[_0x4109('0x2f')]['languageCode'];_0x1ca447[_0x4109('0xf')]['DIALOGFLOWV2_QUERYTEXT']=_0x5f5312[_0x4109('0x2f')]['queryText'];_0x1ca447[_0x4109('0xf')][_0x4109('0x3e')]=_0x5f5312[_0x4109('0x2f')]['intentDetectionConfidence'];_0x11bbf0[_0x4109('0x3f')]=_0x4109('0x2e');_0x11bbf0[_0x4109('0x40')]=JSON[_0x4109('0x10')](_0xfea2b0);var _0x3c2b5e=[];for(var _0x50ac70=0x0;_0x50ac70<_0xfea2b0['length'];_0x50ac70++){var _0xb8e1ff=_0xfea2b0[_0x50ac70];if(_0xb8e1ff&&_0xb8e1ff[_0x4109('0x2f')]&&_0xb8e1ff[_0x4109('0x2f')][_0x4109('0x41')]){_0x3c2b5e[_0x4109('0x42')](createMessage(_0xf89e85,_0x1872f5,_0x11bbf0,_0xb8e1ff[_0x4109('0x2f')][_0x4109('0x41')]));}}return Promise[_0x4109('0x43')](_0x3c2b5e)[_0x4109('0xd')](function(){if(_0x20d5bb){_0x508922[_0x4109('0x15')]();}else{_0x508922[_0x4109('0x28')]();}})[_0x4109('0x26')](function(_0x204d44){logger['error'](_0x4109('0x13'),_0xf89e85,JSON['stringify'](_0x204d44));_0x508922[_0x4109('0x15')]();});}})[_0x4109('0x26')](function(_0xb79494){logger[_0x4109('0x44')](_0x4109('0x13'),_0xf89e85,_0xb79494[_0x4109('0x2c')],_0xb79494[_0x4109('0x45')]);_0x508922[_0x4109('0x15')]();});}}catch(_0x40ee07){logger['error'](_0x4109('0x13'),_0xf89e85,JSON[_0x4109('0x10')](_0x40ee07));_0x508922[_0x4109('0x28')]();}};}; \ No newline at end of file +var _0x7ac9=['create','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','then','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','isFallback','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','stack','lodash','md5','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body'];(function(_0x3ed5bb,_0x54269f){var _0x430c2f=function(_0x33535f){while(--_0x33535f){_0x3ed5bb['push'](_0x3ed5bb['shift']());}};_0x430c2f(++_0x54269f);}(_0x7ac9,0x1de));var _0x97ac=function(_0x265518,_0x22b501){_0x265518=_0x265518-0x0;var _0x10c134=_0x7ac9[_0x265518];return _0x10c134;};'use strict';var _=require(_0x97ac('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x97ac('0x1'));var moment=require(_0x97ac('0x2'));var Promise=require('bluebird');var logger=require(_0x97ac('0x3'))(_0x97ac('0x4'));var utils=require(_0x97ac('0x5'));var rpc={'chatMessage':require(_0x97ac('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x97ac('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x97ac('0x8')),'whatsappMessage':require(_0x97ac('0x9'))};function createMessage(_0x41ca36,_0x433c7e,_0x4af025,_0x6317c1){return new Promise(function(_0xa8aee6,_0x62789d){var _0x2b982b=_[_0x97ac('0xa')](_0x4af025);_0x2b982b[_0x97ac('0xb')]=_0x6317c1;return rpc[_0x433c7e+'Message'][_0x97ac('0xc')](_0x2b982b)['then'](function(){logger[_0x97ac('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x41ca36,_0x2b982b[_0x97ac('0xb')]);_0xa8aee6();})[_0x97ac('0xe')](function(_0x2e95d0){logger[_0x97ac('0xf')](_0x97ac('0x10'),_0x41ca36,JSON['stringify'](_0x2e95d0));_0x62789d(_0x2e95d0);});});}exports[_0x97ac('0x11')]=function(_0x3b792c,_0x160ab7){return function(_0x1b58f8){try{if(!_[_0x97ac('0x12')](this[_0x97ac('0x13')]['UserId'])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x3b792c,_0x97ac('0x14'));return _0x1b58f8[_0x97ac('0x15')]();}var _0x59b9a3={'ContactId':this[_0x97ac('0x16')]['id'],'sentAt':moment()[_0x97ac('0x17')](_0x97ac('0x18')),'direction':_0x97ac('0x19')};if(this[_0x97ac('0x1a')]===_0x97ac('0x1b')||this[_0x97ac('0x1a')]===_0x97ac('0x1c')){_0x59b9a3[_0x97ac('0x1d')]=this['interaction'][_0x97ac('0x1d')];}var _0x386913=this[_0x97ac('0x1a')];if(_0x386913==='chat'){_0x59b9a3[_0x97ac('0x1e')]=this[_0x97ac('0x1f')]['id'];}else{_0x59b9a3[_[_0x97ac('0x20')](_0x386913)+_0x97ac('0x21')]=this[_0x97ac('0x1f')]['id'];}_0x59b9a3[_['upperFirst'](_0x386913)+_0x97ac('0x22')]=this[_0x97ac('0x13')]['id'];if(this[_0x97ac('0x13')][_0x97ac('0x23')]){var _0x3467e5=_0x160ab7[0x4];if(!_[_0x97ac('0x24')](_0x3467e5)){_0x59b9a3[_0x97ac('0xb')]=utils['getMustacheRender'](_0x3467e5,this);return rpc[_0x386913+_0x97ac('0x25')][_0x97ac('0xc')](_0x59b9a3)[_0x97ac('0x26')](function(_0x2e79f7){logger[_0x97ac('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x3b792c,_0x59b9a3['body']);})[_0x97ac('0xe')](function(_0x45ff06){logger[_0x97ac('0xf')](_0x97ac('0x10'),_0x3b792c,JSON[_0x97ac('0x27')](_0x45ff06));})[_0x97ac('0x28')](function(){logger['info'](_0x97ac('0x29'),_0x3b792c);_0x1b58f8['stop']();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3b792c);_0x1b58f8[_0x97ac('0x2a')]();}}else{var _0x25fa53=this;var _0x194814=_0x160ab7[0x2][_0x97ac('0x2b')](/\\n/g,'\x0a');var _0x250f5f={'credentials':{'private_key':_0x194814,'client_email':_0x160ab7[0x1]}};var _0x3f565c=new dialogflow[(_0x97ac('0x2c'))](_0x250f5f);var _0x7a4b3e=_0x3f565c[_0x97ac('0x2d')](_0x160ab7[0x0],md5(_0x25fa53[_0x97ac('0x13')]['id']));var _0x2bae30={'session':_0x7a4b3e,'queryInput':{'text':{'text':_0x25fa53[_0x97ac('0x2e')][_0x97ac('0xb')],'languageCode':_0x160ab7[0x3]||'en'}}};return _0x3f565c[_0x97ac('0x2f')](_0x2bae30)[_0x97ac('0x26')](function(_0x58fc33){if(_0x58fc33&&_0x58fc33[_0x97ac('0x30')]){_0x25fa53['body']['dialogflowV2']=_0x58fc33;var _0x32ba14=_0x58fc33[0x0];var _0xa35e44=_0x32ba14[_0x97ac('0x31')][_0x97ac('0x32')]&&_0x32ba14[_0x97ac('0x31')][_0x97ac('0x32')][_0x97ac('0x33')]?_0x32ba14[_0x97ac('0x31')][_0x97ac('0x32')][_0x97ac('0x33')][_0x97ac('0x34')][_0x97ac('0x35')]:![];_0x25fa53[_0x97ac('0xb')][_0x97ac('0x36')]=_0x32ba14['queryResult']['action'];_0x25fa53[_0x97ac('0xb')][_0x97ac('0x37')]=_0x32ba14[_0x97ac('0x31')][_0x97ac('0x38')];_0x25fa53[_0x97ac('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x32ba14['queryResult'][_0x97ac('0x32')]&&_0x32ba14[_0x97ac('0x31')]['diagnosticInfo'][_0x97ac('0x33')]?_0x32ba14[_0x97ac('0x31')][_0x97ac('0x32')][_0x97ac('0x33')][_0x97ac('0x34')]['boolValue']:![];_0x25fa53[_0x97ac('0xb')][_0x97ac('0x39')]=_0x32ba14[_0x97ac('0x31')][_0x97ac('0x3a')][_0x97ac('0x3b')];_0x25fa53['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x32ba14[_0x97ac('0x31')][_0x97ac('0x3a')]['displayName'];_0x25fa53['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x32ba14[_0x97ac('0x31')][_0x97ac('0x3a')][_0x97ac('0x3c')];_0x25fa53[_0x97ac('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x32ba14[_0x97ac('0x31')][_0x97ac('0x3d')];_0x25fa53['body']['DIALOGFLOWV2_QUERYTEXT']=_0x32ba14['queryResult'][_0x97ac('0x3e')];_0x25fa53[_0x97ac('0xb')][_0x97ac('0x3f')]=_0x32ba14[_0x97ac('0x31')][_0x97ac('0x40')];_0x59b9a3[_0x97ac('0x41')]='dialogflowV2';_0x59b9a3[_0x97ac('0x42')]=JSON['stringify'](_0x58fc33);var _0x5998f5=[];for(var _0x116f85=0x0;_0x116f85<_0x58fc33[_0x97ac('0x30')];_0x116f85++){var _0x1f6422=_0x58fc33[_0x116f85];if(_0x1f6422&&_0x1f6422['queryResult']&&_0x1f6422[_0x97ac('0x31')]['fulfillmentText']){_0x5998f5['push'](createMessage(_0x3b792c,_0x386913,_0x59b9a3,_0x1f6422[_0x97ac('0x31')][_0x97ac('0x43')]));}}return Promise[_0x97ac('0x44')](_0x5998f5)[_0x97ac('0x26')](function(){if(_0xa35e44){_0x1b58f8[_0x97ac('0x15')]();}else{_0x1b58f8[_0x97ac('0x2a')]();}})[_0x97ac('0xe')](function(_0xbdf068){logger['error'](_0x97ac('0x10'),_0x3b792c,JSON[_0x97ac('0x27')](_0xbdf068));_0x1b58f8[_0x97ac('0x15')]();});}})['catch'](function(_0x3d957c){logger[_0x97ac('0xf')](_0x97ac('0x10'),_0x3b792c,_0x3d957c['message'],_0x3d957c[_0x97ac('0x45')]);_0x1b58f8['next']();});}}catch(_0x5e1e95){logger[_0x97ac('0xf')](_0x97ac('0x10'),_0x3b792c,JSON[_0x97ac('0x27')](_0x5e1e95));_0x1b58f8[_0x97ac('0x2a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 821d66c..99e0d26 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd608=['getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString'];(function(_0x57e899,_0x43b3b6){var _0x49c537=function(_0x507222){while(--_0x507222){_0x57e899['push'](_0x57e899['shift']());}};_0x49c537(++_0x43b3b6);}(_0xd608,0x102));var _0x8d60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd608[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x8d60('0x0'));var _=require(_0x8d60('0x1'));var htmlToText=require(_0x8d60('0x2'));var utils=require(_0x8d60('0x3'));var logger=require(_0x8d60('0x4'))(_0x8d60('0x5'));var gotoif=schema({'condition':{'type':_0x8d60('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x8d60('0x7'),'message':_0x8d60('0x8')},'priorityFalse':{'type':_0x8d60('0x7'),'message':_0x8d60('0x9')}});exports[_0x8d60('0xa')]=function(_0xb6d1c2,_0x4f3118){return function(_0x4f9a33){try{var _0x59655b={'condition':htmlToText[_0x8d60('0xb')](utils[_0x8d60('0xc')](_0x4f3118[0x0],this),{'wordwrap':![]})[_0x8d60('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4f3118[0x1],'priorityFalse':_0x4f3118[0x2]};var _0xeef259=gotoif[_0x8d60('0x0')](_0x59655b,{'typecast':!![]});if(_0xeef259[_0x8d60('0xe')]){logger[_0x8d60('0xf')](_0x8d60('0x10'),_0xb6d1c2,_[_0x8d60('0x11')](_0xeef259,_0x8d60('0x12'))['join'](',\x20'));_0x4f9a33[_0x8d60('0x13')]();}else{try{var _0x35762c=eval('('+_0x59655b['condition']+')');var _0x2d921e=_0x35762c?_0x59655b[_0x8d60('0x14')]:_0x59655b[_0x8d60('0x15')];logger[_0x8d60('0x16')](_0x8d60('0x17'),_0xb6d1c2,_0x59655b[_0x8d60('0x18')],_0x35762c,_0x2d921e||'next');if(_0x2d921e){var _0x37ff84=_['findIndex'](_0x4f9a33[_0x8d60('0x19')](),{'p':_0x2d921e});if(_0x37ff84>=0x0){logger[_0x8d60('0x16')](_0x8d60('0x1a'),_0xb6d1c2,_0x2d921e||_0x8d60('0x1b'),_0x37ff84);_0x4f9a33[_0x8d60('0x1b')](_0x37ff84);}else{logger[_0x8d60('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0xb6d1c2,_0x2d921e||_0x8d60('0x1b'));_0x4f9a33['stop']();}}else{_0x4f9a33[_0x8d60('0x1b')]();}}catch(_0x4b42dc){logger[_0x8d60('0xf')](_0x8d60('0x1c'),_0xb6d1c2,_0x4b42dc[_0x8d60('0x12')]);_0x4f9a33[_0x8d60('0x13')]();}}}catch(_0x276dde){logger['error'](_0x8d60('0x10'),_0xb6d1c2,JSON[_0x8d60('0x1d')](_0x276dde));_0x4f9a33[_0x8d60('0x13')]();}};}; \ No newline at end of file +var _0x3db0=['lodash','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate'];(function(_0x3f0945,_0x334806){var _0x6ed8c6=function(_0x508c2d){while(--_0x508c2d){_0x3f0945['push'](_0x3f0945['shift']());}};_0x6ed8c6(++_0x334806);}(_0x3db0,0x81));var _0x03db=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0x3db0[_0x23b57c];return _0x4c3b1d;};'use strict';var schema=require(_0x03db('0x0'));var _=require(_0x03db('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x03db('0x2'));var logger=require(_0x03db('0x3'))(_0x03db('0x4'));var gotoif=schema({'condition':{'type':_0x03db('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x03db('0x6'),'message':_0x03db('0x7')},'priorityFalse':{'type':'number','message':_0x03db('0x8')}});exports[_0x03db('0x9')]=function(_0x4cf776,_0x1bdfe2){return function(_0x3867c6){try{var _0x2260d0={'condition':htmlToText[_0x03db('0xa')](utils['getMustacheRender'](_0x1bdfe2[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1bdfe2[0x1],'priorityFalse':_0x1bdfe2[0x2]};var _0x2db6ed=gotoif[_0x03db('0x0')](_0x2260d0,{'typecast':!![]});if(_0x2db6ed[_0x03db('0xb')]){logger[_0x03db('0xc')](_0x03db('0xd'),_0x4cf776,_[_0x03db('0xe')](_0x2db6ed,'message')['join'](',\x20'));_0x3867c6[_0x03db('0xf')]();}else{try{var _0x423146=eval('('+_0x2260d0[_0x03db('0x10')]+')');var _0x1fcb43=_0x423146?_0x2260d0[_0x03db('0x11')]:_0x2260d0[_0x03db('0x12')];logger[_0x03db('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4cf776,_0x2260d0[_0x03db('0x10')],_0x423146,_0x1fcb43||_0x03db('0x14'));if(_0x1fcb43){var _0x2695c2=_[_0x03db('0x15')](_0x3867c6[_0x03db('0x16')](),{'p':_0x1fcb43});if(_0x2695c2>=0x0){logger[_0x03db('0x13')](_0x03db('0x17'),_0x4cf776,_0x1fcb43||_0x03db('0x14'),_0x2695c2);_0x3867c6[_0x03db('0x14')](_0x2695c2);}else{logger[_0x03db('0x13')](_0x03db('0x18'),_0x4cf776,_0x1fcb43||_0x03db('0x14'));_0x3867c6[_0x03db('0xf')]();}}else{_0x3867c6[_0x03db('0x14')]();}}catch(_0x49afe2){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4cf776,_0x49afe2['message']);_0x3867c6[_0x03db('0xf')]();}}}catch(_0x1a533e){logger['error']('[%s][GOTOIF]\x20%s',_0x4cf776,JSON[_0x03db('0x19')](_0x1a533e));_0x3867c6['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 6bbef90..5c69c81 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 _0xe90d=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','join','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','lodash','../../../../config/logger','routing'];(function(_0x35230b,_0x5558f4){var _0x5a64cf=function(_0x58f561){while(--_0x58f561){_0x35230b['push'](_0x35230b['shift']());}};_0x5a64cf(++_0x5558f4);}(_0xe90d,0x9d));var _0xde90=function(_0x1c7972,_0xb4bf0a){_0x1c7972=_0x1c7972-0x0;var _0x51fe55=_0xe90d[_0x1c7972];return _0x51fe55;};'use strict';var schema=require('validate');var _=require(_0xde90('0x0'));var logger=require(_0xde90('0x1'))(_0xde90('0x2'));var gotop=schema({'priority':{'type':_0xde90('0x3'),'required':!![],'message':_0xde90('0x4')}});exports[_0xde90('0x5')]=function(_0x994758,_0x240e6e){return function(_0x31045c){try{var _0x1c4be0={'priority':_0x240e6e[0x0]};var _0x1f3247=gotop[_0xde90('0x6')](_0x1c4be0,{'typecast':!![]});if(_0x1f3247[_0xde90('0x7')]){logger[_0xde90('0x8')](_0xde90('0x9'),_0x994758,_['map'](_0x1f3247,'message')[_0xde90('0xa')](',\x20'));_0x31045c['stop']();}else{logger[_0xde90('0xb')](_0xde90('0xc'),_0x994758,_0x1c4be0[_0xde90('0xd')]);if(_0x1c4be0[_0xde90('0xd')]){var _0x3d2b30=_['findIndex'](_0x31045c[_0xde90('0xe')](),{'p':_0x1c4be0[_0xde90('0xd')]});if(_0x3d2b30>=0x0){logger['info'](_0xde90('0xf'),_0x994758,_0x1c4be0[_0xde90('0xd')]||'next',_0x3d2b30);_0x31045c[_0xde90('0x10')](_0x3d2b30);}else{logger[_0xde90('0xb')](_0xde90('0x11'),_0x994758,_0x1c4be0[_0xde90('0xd')]||'next');_0x31045c['stop']();}}else{_0x31045c[_0xde90('0x10')]();}}}catch(_0x5d35ee){logger['error'](_0xde90('0x9'),_0x994758,JSON[_0xde90('0x12')](_0x5d35ee));_0x31045c[_0xde90('0x13')]();}};}; \ No newline at end of file +var _0x3df5=['error','[%s][GOTOP]\x20%s','map','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0xf95def,_0xa45441){var _0x27ea9e=function(_0x49624d){while(--_0x49624d){_0xf95def['push'](_0xf95def['shift']());}};_0x27ea9e(++_0xa45441);}(_0x3df5,0x70));var _0x53df=function(_0x296bd2,_0x4de71e){_0x296bd2=_0x296bd2-0x0;var _0x38628a=_0x3df5[_0x296bd2];return _0x38628a;};'use strict';var schema=require(_0x53df('0x0'));var _=require(_0x53df('0x1'));var logger=require(_0x53df('0x2'))(_0x53df('0x3'));var gotop=schema({'priority':{'type':_0x53df('0x4'),'required':!![],'message':_0x53df('0x5')}});exports[_0x53df('0x6')]=function(_0xee99b6,_0x17edac){return function(_0xc58b07){try{var _0x1aa4a3={'priority':_0x17edac[0x0]};var _0x18919c=gotop[_0x53df('0x0')](_0x1aa4a3,{'typecast':!![]});if(_0x18919c[_0x53df('0x7')]){logger[_0x53df('0x8')](_0x53df('0x9'),_0xee99b6,_[_0x53df('0xa')](_0x18919c,'message')['join'](',\x20'));_0xc58b07['stop']();}else{logger[_0x53df('0xb')](_0x53df('0xc'),_0xee99b6,_0x1aa4a3['priority']);if(_0x1aa4a3[_0x53df('0xd')]){var _0x53e9d0=_[_0x53df('0xe')](_0xc58b07[_0x53df('0xf')](),{'p':_0x1aa4a3[_0x53df('0xd')]});if(_0x53e9d0>=0x0){logger[_0x53df('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xee99b6,_0x1aa4a3['priority']||_0x53df('0x10'),_0x53e9d0);_0xc58b07[_0x53df('0x10')](_0x53e9d0);}else{logger['info'](_0x53df('0x11'),_0xee99b6,_0x1aa4a3[_0x53df('0xd')]||_0x53df('0x10'));_0xc58b07[_0x53df('0x12')]();}}else{_0xc58b07[_0x53df('0x10')]();}}}catch(_0x46314d){logger[_0x53df('0x8')]('[%s][GOTOP]\x20%s',_0xee99b6,JSON[_0x53df('0x13')](_0x46314d));_0xc58b07['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 d0d026d..551894e 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 _0xd3b0=['then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message'];(function(_0x5a297c,_0x197245){var _0xc407a3=function(_0x14dc3a){while(--_0x14dc3a){_0x5a297c['push'](_0x5a297c['shift']());}};_0xc407a3(++_0x197245);}(_0xd3b0,0x1f4));var _0x0d3b=function(_0x325481,_0x1ff4e0){_0x325481=_0x325481-0x0;var _0x35c152=_0xd3b0[_0x325481];return _0x35c152;};'use strict';var _=require(_0x0d3b('0x0'));var utils=require(_0x0d3b('0x1'));var logger=require(_0x0d3b('0x2'))(_0x0d3b('0x3'));var rpc={'chatMessage':require(_0x0d3b('0x4')),'openchannelMessage':require(_0x0d3b('0x5')),'mailMessage':require(_0x0d3b('0x6')),'smsMessage':require(_0x0d3b('0x7')),'faxMessage':require(_0x0d3b('0x8')),'whatsappMessage':require(_0x0d3b('0x9'))};exports[_0x0d3b('0xa')]=function(_0x59d98c,_0x4bea5c){return function(_0x192adf){try{var _0x3eafc8={'body':utils[_0x0d3b('0xb')](_0x4bea5c[0x0],this),'ContactId':this[_0x0d3b('0xc')]['id']};if(this[_0x0d3b('0xd')]===_0x0d3b('0xe')){_0x3eafc8[_0x0d3b('0xf')]=this[_0x0d3b('0x10')]['id'];}else{_0x3eafc8[_['upperFirst'](this['channel'])+_0x0d3b('0x11')]=this[_0x0d3b('0x10')]['id'];}_0x3eafc8[_[_0x0d3b('0x12')](this[_0x0d3b('0xd')])+_0x0d3b('0x13')]=this[_0x0d3b('0x14')]['id'];if(rpc[this[_0x0d3b('0xd')]+_0x0d3b('0x15')]){return rpc[this[_0x0d3b('0xd')]+'Message']['create'](_0x3eafc8)[_0x0d3b('0x16')](function(_0x52735e){logger[_0x0d3b('0x17')](_0x0d3b('0x18'),_0x59d98c,_0x3eafc8['body']);_0x192adf[_0x0d3b('0x19')]();})['catch'](function(_0x1ddaa9){logger[_0x0d3b('0x1a')]('[%s][MESSAGE]\x20%s',_0x59d98c,JSON[_0x0d3b('0x1b')](_0x1ddaa9));_0x192adf[_0x0d3b('0x1c')]();});}}catch(_0x4df2c8){logger[_0x0d3b('0x1a')](_0x0d3b('0x18'),_0x59d98c,JSON[_0x0d3b('0x1b')](_0x4df2c8));_0x192adf[_0x0d3b('0x1c')]();}};}; \ No newline at end of file +var _0xc288=['ChatWebsiteId','account','upperFirst','channel','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat'];(function(_0xf33afd,_0x2363b6){var _0x5f432a=function(_0x2599b5){while(--_0x2599b5){_0xf33afd['push'](_0xf33afd['shift']());}};_0x5f432a(++_0x2363b6);}(_0xc288,0x197));var _0x8c28=function(_0x499c27,_0x32dd8e){_0x499c27=_0x499c27-0x0;var _0x2b0ba1=_0xc288[_0x499c27];return _0x2b0ba1;};'use strict';var _=require(_0x8c28('0x0'));var utils=require(_0x8c28('0x1'));var logger=require(_0x8c28('0x2'))(_0x8c28('0x3'));var rpc={'chatMessage':require(_0x8c28('0x4')),'openchannelMessage':require(_0x8c28('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8c28('0x6')),'faxMessage':require(_0x8c28('0x7')),'whatsappMessage':require(_0x8c28('0x8'))};exports[_0x8c28('0x9')]=function(_0x468a1e,_0x55bdaa){return function(_0x4ac558){try{var _0x3e5436={'body':utils[_0x8c28('0xa')](_0x55bdaa[0x0],this),'ContactId':this[_0x8c28('0xb')]['id']};if(this['channel']===_0x8c28('0xc')){_0x3e5436[_0x8c28('0xd')]=this[_0x8c28('0xe')]['id'];}else{_0x3e5436[_[_0x8c28('0xf')](this['channel'])+'AccountId']=this['account']['id'];}_0x3e5436[_[_0x8c28('0xf')](this[_0x8c28('0x10')])+_0x8c28('0x11')]=this[_0x8c28('0x12')]['id'];if(rpc[this[_0x8c28('0x10')]+_0x8c28('0x13')]){return rpc[this[_0x8c28('0x10')]+'Message'][_0x8c28('0x14')](_0x3e5436)['then'](function(_0x47a371){logger['info'](_0x8c28('0x15'),_0x468a1e,_0x3e5436[_0x8c28('0x16')]);_0x4ac558[_0x8c28('0x17')]();})[_0x8c28('0x18')](function(_0x472bf3){logger[_0x8c28('0x19')](_0x8c28('0x15'),_0x468a1e,JSON[_0x8c28('0x1a')](_0x472bf3));_0x4ac558[_0x8c28('0x1b')]();});}}catch(_0x56a439){logger['error']('[%s][MESSAGE]\x20%s',_0x468a1e,JSON[_0x8c28('0x1a')](_0x56a439));_0x4ac558[_0x8c28('0x1b')]();}};}; \ 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 4f08b19..bab4797 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 _0x80df=['getMustacheRender','next','error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x514451,_0x350f4e){var _0x588103=function(_0x42ebe1){while(--_0x42ebe1){_0x514451['push'](_0x514451['shift']());}};_0x588103(++_0x350f4e);}(_0x80df,0x19f));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0xf80d('0x0'));var logger=require('../../../../config/logger')(_0xf80d('0x1'));exports[_0xf80d('0x2')]=function(_0xa57776,_0x80d3c6){return function(_0x52f49c){try{logger[_0xf80d('0x3')](_0xf80d('0x4'),_0xa57776,utils[_0xf80d('0x5')](_0x80d3c6[0x0],this));_0x52f49c[_0xf80d('0x6')]();}catch(_0x3aa60f){logger[_0xf80d('0x7')]('[%s][NOOP]\x20%s',_0xa57776,JSON[_0xf80d('0x8')](_0x3aa60f));_0x52f49c[_0xf80d('0x9')]();}};}; \ No newline at end of file +var _0x2d7a=['routing','consequence','info','getMustacheRender','next','error','stringify'];(function(_0x3c874e,_0x4a6d0a){var _0x1a5efd=function(_0x90b8c7){while(--_0x90b8c7){_0x3c874e['push'](_0x3c874e['shift']());}};_0x1a5efd(++_0x4a6d0a);}(_0x2d7a,0x1e3));var _0xa2d7=function(_0x54f080,_0x16ae93){_0x54f080=_0x54f080-0x0;var _0x273816=_0x2d7a[_0x54f080];return _0x273816;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xa2d7('0x0'));exports[_0xa2d7('0x1')]=function(_0xc9ebe9,_0x1099e9){return function(_0x52f4c0){try{logger[_0xa2d7('0x2')]('[%s][NOOP]\x20%s',_0xc9ebe9,utils[_0xa2d7('0x3')](_0x1099e9[0x0],this));_0x52f4c0[_0xa2d7('0x4')]();}catch(_0x40cd00){logger[_0xa2d7('0x5')]('[%s][NOOP]\x20%s',_0xc9ebe9,JSON[_0xa2d7('0x6')](_0x40cd00));_0x52f4c0['stop']();}};}; \ 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 7c14a52..b884d1a 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 _0x3b98=['number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','message','AccountId','WebsiteId','info','name','QueueReport','create','catch','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','interaction','then','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','./strategy','redis','defaults','localhost','queue_id','account','from','joinAt','emit','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x2e440b,_0x540f27){var _0x46e1a4=function(_0x953321){while(--_0x953321){_0x2e440b['push'](_0x2e440b['shift']());}};_0x46e1a4(++_0x540f27);}(_0x3b98,0x1bf));var _0x83b9=function(_0x47be82,_0x434ddc){_0x47be82=_0x47be82-0x0;var _0x4dfd95=_0x3b98[_0x47be82];return _0x4dfd95;};'use strict';var schema=require(_0x83b9('0x0'));var _=require(_0x83b9('0x1'));var util=require(_0x83b9('0x2'));var seqqueue=require(_0x83b9('0x3'));var moment=require(_0x83b9('0x4'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x83b9('0x5'));config[_0x83b9('0x6')]=_[_0x83b9('0x7')](config[_0x83b9('0x6')],{'host':_0x83b9('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x83b9('0x9'),_0x83b9('0xa'),'queue',_0x83b9('0xb'),_0x83b9('0xc')];function emit(_0xaa7eab,_0x8d84db,_0x97734b){io['to'](_0xaa7eab)[_0x83b9('0xd')](_0x8d84db,_0x97734b);}function emitChannelQueueInteraction(_0x14c9ec,_0x7d9b0a,_0x32c444,_0x59d611,_0x4e8a4b,_0x5420cc,_0x512f0f,_0x36b223){var _0x467741=_['clone'](_0x32c444);_0x467741[_0x83b9('0x9')]=_0x36b223;_0x467741['queue']=_0x7d9b0a;_0x467741[_0x83b9('0xa')]=_0x59d611;_0x467741['id']=_0x4e8a4b;if(_0x5420cc){attributes[_0x83b9('0xe')](_['capitalize'](_0x14c9ec)+_0x83b9('0xf'));_0x512f0f[util[_0x83b9('0x10')](_0x83b9('0x11'),_0x14c9ec)][_0x4e8a4b]=_[_0x83b9('0x12')](_0x467741,attributes);}else{delete _0x512f0f[util[_0x83b9('0x10')](_0x83b9('0x11'),_0x14c9ec)][_0x4e8a4b];}emit(util[_0x83b9('0x10')]('%s:queue:%s',_0x14c9ec,_0x7d9b0a),util['format'](_0x83b9('0x13'),_0x14c9ec,_0x5420cc?_0x83b9('0x14'):_0x83b9('0x15')),_[_0x83b9('0x12')](_0x467741,attributes));}var rpc={'openchannelQueueReport':require(_0x83b9('0x16')),'mailQueueReport':require(_0x83b9('0x17')),'chatQueueReport':require(_0x83b9('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x83b9('0x19')),'whatsappQueueReport':require(_0x83b9('0x1a')),'chatInteraction':require(_0x83b9('0x1b')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x83b9('0x1c')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x83b9('0x1d')),'whatsappInteraction':require(_0x83b9('0x1e'))};var queue=schema({'name':{'type':_0x83b9('0x1f'),'required':!![],'message':_0x83b9('0x20')},'timeout':{'type':_0x83b9('0x21'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x25a9ba,_0x57a7c9,_0x46d476,_0x31030c){if(_0x25a9ba&&_0x57a7c9&&_0x46d476){_0x57a7c9[_0x83b9('0x22')]+=0x1;var _0x42e352={'uniqueid':_0x25a9ba,'from':_0x46d476[_0x83b9('0x23')]?_0x46d476[_0x83b9('0x23')][_0x83b9('0xb')]:'','joinAt':moment()[_0x83b9('0x10')](_0x83b9('0x24')),'ContactId':_0x46d476[_0x83b9('0x25')]?_0x46d476['contact']['id']:null,'ListId':_0x46d476[_0x83b9('0x26')]?_0x46d476['list']['id']:null};_0x42e352[_[_0x83b9('0x27')](_0x46d476['channel'])+_0x83b9('0x28')]=_0x57a7c9['id']||null;_0x42e352[_[_0x83b9('0x27')](_0x46d476[_0x83b9('0x29')])+_0x83b9('0xf')]=_0x46d476['interaction']?_0x46d476['interaction']['id']:null;_0x42e352[_['upperFirst'](_0x46d476[_0x83b9('0x29')])+'MessageId']=_0x46d476['message']?_0x46d476[_0x83b9('0x2a')]['id']:null;_0x42e352[_[_0x83b9('0x27')](_0x46d476['channel'])+(_0x46d476['channel']!=='chat'?_0x83b9('0x2b'):_0x83b9('0x2c'))]=_0x46d476[_0x83b9('0xa')]?_0x46d476[_0x83b9('0xa')]['id']:null;logger[_0x83b9('0x2d')](util[_0x83b9('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x25a9ba,_0x57a7c9[_0x83b9('0x2e')]));emitChannelQueueInteraction(_0x46d476[_0x83b9('0x29')],_0x57a7c9[_0x83b9('0x2e')],_0x42e352,_0x46d476[_0x83b9('0xa')][_0x83b9('0x2e')],_0x46d476[_0x83b9('0x2a')]['id'],!![],_0x31030c,_0x57a7c9['id']);if(rpc[_0x46d476[_0x83b9('0x29')]+_0x83b9('0x2f')]){return rpc[_0x46d476['channel']+_0x83b9('0x2f')][_0x83b9('0x30')](_0x42e352)[_0x83b9('0x31')](function(_0x56386b){logger['error']('create\x20queue\x20report',_0x56386b);});}}}function stopRouting(_0x327c6f,_0x2b987f,_0x57083c,_0x40b6ab){if(_0x327c6f&&_0x2b987f){_0x2b987f[_0x83b9('0x22')]-=0x1;var _0x3e02d3={'leaveAt':moment()[_0x83b9('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x83b9('0x10')](_0x83b9('0x24')),'reason':_0x83b9('0x32')};logger[_0x83b9('0x2d')](util[_0x83b9('0x10')](_0x83b9('0x33'),_0x327c6f,_0x2b987f[_0x83b9('0x2e')]));emitChannelQueueInteraction(_0x57083c[_0x83b9('0x29')],_0x2b987f[_0x83b9('0x2e')],_0x57083c[_0x83b9('0x23')],_0x57083c[_0x83b9('0xa')][_0x83b9('0x2e')],_0x57083c[_0x83b9('0x2a')]['id'],![],_0x40b6ab,_0x2b987f['id']);return rpc[_0x57083c[_0x83b9('0x29')]+_0x83b9('0x34')]['update'](_0x57083c[_0x83b9('0x35')]['id'],{'queueId':_0x2b987f['id']})[_0x83b9('0x36')](function(){if(rpc[_0x57083c[_0x83b9('0x29')]+_0x83b9('0x2f')]){return rpc[_0x57083c[_0x83b9('0x29')]+_0x83b9('0x2f')][_0x83b9('0x37')](_0x327c6f,_0x3e02d3)[_0x83b9('0x31')](function(_0x4a3d95){logger[_0x83b9('0x38')](_0x83b9('0x39'),_0x4a3d95);});}});}}function endRouting(_0x7d9fd8,_0x4fd0f6,_0x9711b0,_0x37339e){if(_0x7d9fd8&&_0x4fd0f6){_0x4fd0f6[_0x83b9('0x22')]-=0x1;var _0x252634={'leaveAt':moment()[_0x83b9('0x10')](_0x83b9('0x24')),'exitAt':moment()[_0x83b9('0x10')](_0x83b9('0x24')),'reason':_0x83b9('0x3a')};logger['info'](util[_0x83b9('0x10')](_0x83b9('0x3b'),_0x7d9fd8,_0x4fd0f6[_0x83b9('0x2e')]));emitChannelQueueInteraction(_0x9711b0[_0x83b9('0x29')],_0x4fd0f6['name'],_0x9711b0[_0x83b9('0x23')],_0x9711b0[_0x83b9('0xa')][_0x83b9('0x2e')],_0x9711b0[_0x83b9('0x2a')]['id'],![],_0x37339e);if(rpc[_0x9711b0[_0x83b9('0x29')]+'QueueReport']){return rpc[_0x9711b0['channel']+'QueueReport'][_0x83b9('0x37')](_0x7d9fd8,_0x252634)[_0x83b9('0x31')](function(_0x21cf4c){logger[_0x83b9('0x38')](_0x83b9('0x39'),_0x21cf4c);});}}}function handleFindQueue(_0x46ae07){return function(_0x538910){return _0x538910[_0x83b9('0x2e')]['toLowerCase']()===_0x46ae07['toLowerCase']();};}exports[_0x83b9('0x3c')]=function(_0x2861cd,_0xb97ae5,_0x5564a7,_0x4a3e02){return function(_0x1c7929){try{var _0xe4e1d2={'name':_0xb97ae5[0x0],'timeout':_0xb97ae5[0x1]};var _0x55b6b8=queue[_0x83b9('0x0')](_0xe4e1d2,{'typecast':!![]});if(_0x55b6b8[_0x83b9('0x3d')]){logger[_0x83b9('0x38')](_0x83b9('0x3e'),_0x2861cd,_[_0x83b9('0x3f')](_0x55b6b8,_0x83b9('0x2a'))['join'](',\x20'));_0x1c7929[_0x83b9('0x40')]();}else{var _0x47c4b4=_[_0x83b9('0x41')](_0x5564a7[_0x4a3e02['channel']+_0x83b9('0x42')],handleFindQueue(_0xe4e1d2[_0x83b9('0x2e')]));if(_0x47c4b4){startRouting(_0x2861cd,_0x47c4b4,_0x4a3e02,_0x5564a7);var _0x28de22=(_0x47c4b4[_0x83b9('0x3a')]||0xa)*0x3e8;var _0x210ced=(_0xe4e1d2['timeout']||0x14)*0x3e8;var _0x4c5626;if(_0x28de22>_0x210ced){_0x210ced=_0x28de22;}var _0x45a942=seqqueue['createQueue'](_0x28de22);_0x45a942['id']=_0x2861cd;_0x45a942[_0x83b9('0x43')]=_0x28de22;_0x45a942[_0x83b9('0x44')]=_0x210ced;_0x45a942[_0x83b9('0x29')]=_0x4a3e02[_0x83b9('0x29')];_0x5564a7[_0x83b9('0x45')][_0x2861cd]['on']('end',function(){logger[_0x83b9('0x2d')](_0x83b9('0x46'),_0x2861cd);stopRouting(_0x2861cd,_0x47c4b4,_0x4a3e02,_0x5564a7);clearTimeout(_0x4c5626);_0x4c5626=undefined;_0x45a942[_0x83b9('0x47')](!![]);if(_0x5564a7['rules'][_0x2861cd]){delete _0x5564a7[_0x83b9('0x45')][_0x2861cd];}_0x1c7929[_0x83b9('0x40')]();});_0x5564a7[_0x83b9('0x45')][_0x2861cd]['on'](_0x83b9('0x48'),function(){if(_0x5564a7['rules'][_0x2861cd]){delete _0x5564a7[_0x83b9('0x45')][_0x2861cd];}});_0x4c5626=setTimeout(function(){logger[_0x83b9('0x2d')](_0x83b9('0x49'),_0x2861cd);endRouting(_0x2861cd,_0x47c4b4,_0x4a3e02,_0x5564a7);clearTimeout(_0x4c5626);_0x45a942[_0x83b9('0x47')](!![]);_0x1c7929[_0x83b9('0x4a')]();},_0x210ced);switch(_0x47c4b4[_0x83b9('0x4b')]){case'rrmemory':strategy[_0x83b9('0x4c')](_0x45a942,_0x47c4b4,_0x5564a7,_0x4a3e02);break;default:strategy[_0x83b9('0x4d')](_0x45a942,_0x47c4b4,_0x5564a7,_0x4a3e02);}}else{logger[_0x83b9('0x38')](_0x83b9('0x4e'),_0x2861cd,_0xe4e1d2[_0x83b9('0x2e')]);_0x1c7929[_0x83b9('0x40')]();}}}catch(_0x174249){logger[_0x83b9('0x38')](_0x83b9('0x3e'),_0x2861cd,_0x174249[_0x83b9('0x4f')]);_0x1c7929[_0x83b9('0x40')]();}};}; \ No newline at end of file +var _0xfdba=['join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','queue','joinAt','emit','queue_id','account','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../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','body','from','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map'];(function(_0x3c95c4,_0xb86b0){var _0x20bc24=function(_0x5631d0){while(--_0x5631d0){_0x3c95c4['push'](_0x3c95c4['shift']());}};_0x20bc24(++_0xb86b0);}(_0xfdba,0x170));var _0xafdb=function(_0x379db3,_0x41c0e9){_0x379db3=_0x379db3-0x0;var _0x4f525d=_0xfdba[_0x379db3];return _0x4f525d;};'use strict';var schema=require(_0xafdb('0x0'));var _=require(_0xafdb('0x1'));var util=require(_0xafdb('0x2'));var seqqueue=require(_0xafdb('0x3'));var moment=require(_0xafdb('0x4'));var Redis=require(_0xafdb('0x5'));var config=require(_0xafdb('0x6'));var logger=require(_0xafdb('0x7'))(_0xafdb('0x8'));var strategy=require(_0xafdb('0x9'));config[_0xafdb('0xa')]=_['defaults'](config[_0xafdb('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xafdb('0xa')]));var attributes=['id','queue_id','account',_0xafdb('0xb'),'from',_0xafdb('0xc')];function emit(_0x2a881d,_0x11ebdf,_0x2ad4dc){io['to'](_0x2a881d)[_0xafdb('0xd')](_0x11ebdf,_0x2ad4dc);}function emitChannelQueueInteraction(_0x269331,_0x5e006f,_0x5cf2d7,_0x50608a,_0x449d5c,_0x1f4670,_0x4c600a,_0x567277){var _0x13dc96=_['clone'](_0x5cf2d7);_0x13dc96[_0xafdb('0xe')]=_0x567277;_0x13dc96[_0xafdb('0xb')]=_0x5e006f;_0x13dc96[_0xafdb('0xf')]=_0x50608a;_0x13dc96['id']=_0x449d5c;if(_0x1f4670){attributes['push'](_[_0xafdb('0x10')](_0x269331)+_0xafdb('0x11'));_0x4c600a[util[_0xafdb('0x12')]('%sQueuesWaitingInteractions',_0x269331)][_0x449d5c]=_['pick'](_0x13dc96,attributes);}else{delete _0x4c600a[util[_0xafdb('0x12')](_0xafdb('0x13'),_0x269331)][_0x449d5c];}emit(util['format'](_0xafdb('0x14'),_0x269331,_0x5e006f),util[_0xafdb('0x12')](_0xafdb('0x15'),_0x269331,_0x1f4670?_0xafdb('0x16'):_0xafdb('0x17')),_[_0xafdb('0x18')](_0x13dc96,attributes));}var rpc={'openchannelQueueReport':require(_0xafdb('0x19')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xafdb('0x1a')),'smsQueueReport':require(_0xafdb('0x1b')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xafdb('0x1c')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xafdb('0x1d')),'mailInteraction':require(_0xafdb('0x1e')),'openchannelInteraction':require(_0xafdb('0x1f')),'smsInteraction':require(_0xafdb('0x20')),'whatsappInteraction':require(_0xafdb('0x21'))};var queue=schema({'name':{'type':_0xafdb('0x22'),'required':!![],'message':_0xafdb('0x23')},'timeout':{'type':_0xafdb('0x24'),'message':_0xafdb('0x25')}});function startRouting(_0x55325a,_0x4c9b6a,_0x2ee14e,_0x4a93f6){if(_0x55325a&&_0x4c9b6a&&_0x2ee14e){_0x4c9b6a['waiting']+=0x1;var _0x513ec8={'uniqueid':_0x55325a,'from':_0x2ee14e['body']?_0x2ee14e[_0xafdb('0x26')][_0xafdb('0x27')]:'','joinAt':moment()[_0xafdb('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2ee14e[_0xafdb('0x28')]?_0x2ee14e[_0xafdb('0x28')]['id']:null,'ListId':_0x2ee14e[_0xafdb('0x29')]?_0x2ee14e[_0xafdb('0x29')]['id']:null};_0x513ec8[_[_0xafdb('0x2a')](_0x2ee14e[_0xafdb('0x2b')])+_0xafdb('0x2c')]=_0x4c9b6a['id']||null;_0x513ec8[_[_0xafdb('0x2a')](_0x2ee14e[_0xafdb('0x2b')])+_0xafdb('0x11')]=_0x2ee14e[_0xafdb('0x2d')]?_0x2ee14e[_0xafdb('0x2d')]['id']:null;_0x513ec8[_['upperFirst'](_0x2ee14e['channel'])+_0xafdb('0x2e')]=_0x2ee14e[_0xafdb('0x2f')]?_0x2ee14e['message']['id']:null;_0x513ec8[_['upperFirst'](_0x2ee14e['channel'])+(_0x2ee14e[_0xafdb('0x2b')]!=='chat'?_0xafdb('0x30'):_0xafdb('0x31'))]=_0x2ee14e[_0xafdb('0xf')]?_0x2ee14e[_0xafdb('0xf')]['id']:null;logger[_0xafdb('0x32')](util[_0xafdb('0x12')](_0xafdb('0x33'),_0x55325a,_0x4c9b6a['name']));emitChannelQueueInteraction(_0x2ee14e[_0xafdb('0x2b')],_0x4c9b6a[_0xafdb('0x34')],_0x513ec8,_0x2ee14e[_0xafdb('0xf')][_0xafdb('0x34')],_0x2ee14e[_0xafdb('0x2f')]['id'],!![],_0x4a93f6,_0x4c9b6a['id']);if(rpc[_0x2ee14e['channel']+_0xafdb('0x35')]){return rpc[_0x2ee14e[_0xafdb('0x2b')]+_0xafdb('0x35')][_0xafdb('0x36')](_0x513ec8)[_0xafdb('0x37')](function(_0x5e1b9f){logger[_0xafdb('0x38')](_0xafdb('0x39'),_0x5e1b9f);});}}}function stopRouting(_0x2ed28a,_0x15d4ba,_0x4ed355,_0x137a65){if(_0x2ed28a&&_0x15d4ba){_0x15d4ba[_0xafdb('0x3a')]-=0x1;var _0xcc8022={'leaveAt':moment()['format'](_0xafdb('0x3b')),'acceptAt':moment()['format'](_0xafdb('0x3b')),'reason':'accepted'};logger[_0xafdb('0x32')](util[_0xafdb('0x12')](_0xafdb('0x3c'),_0x2ed28a,_0x15d4ba['name']));emitChannelQueueInteraction(_0x4ed355[_0xafdb('0x2b')],_0x15d4ba[_0xafdb('0x34')],_0x4ed355[_0xafdb('0x26')],_0x4ed355[_0xafdb('0xf')][_0xafdb('0x34')],_0x4ed355['message']['id'],![],_0x137a65,_0x15d4ba['id']);return rpc[_0x4ed355['channel']+_0xafdb('0x3d')][_0xafdb('0x3e')](_0x4ed355[_0xafdb('0x2d')]['id'],{'queueId':_0x15d4ba['id']})[_0xafdb('0x3f')](function(){if(rpc[_0x4ed355['channel']+_0xafdb('0x35')]){return rpc[_0x4ed355['channel']+_0xafdb('0x35')][_0xafdb('0x3e')](_0x2ed28a,_0xcc8022)['catch'](function(_0x1f727f){logger[_0xafdb('0x38')](_0xafdb('0x40'),_0x1f727f);});}});}}function endRouting(_0x39b2b4,_0x205d80,_0x1a34ab,_0x9a1e74){if(_0x39b2b4&&_0x205d80){_0x205d80['waiting']-=0x1;var _0x2641c={'leaveAt':moment()[_0xafdb('0x12')](_0xafdb('0x3b')),'exitAt':moment()['format'](_0xafdb('0x3b')),'reason':_0xafdb('0x41')};logger[_0xafdb('0x32')](util['format'](_0xafdb('0x42'),_0x39b2b4,_0x205d80[_0xafdb('0x34')]));emitChannelQueueInteraction(_0x1a34ab[_0xafdb('0x2b')],_0x205d80[_0xafdb('0x34')],_0x1a34ab[_0xafdb('0x26')],_0x1a34ab['account'][_0xafdb('0x34')],_0x1a34ab[_0xafdb('0x2f')]['id'],![],_0x9a1e74);if(rpc[_0x1a34ab['channel']+_0xafdb('0x35')]){return rpc[_0x1a34ab['channel']+'QueueReport']['update'](_0x39b2b4,_0x2641c)[_0xafdb('0x37')](function(_0x5640ed){logger[_0xafdb('0x38')](_0xafdb('0x40'),_0x5640ed);});}}}function handleFindQueue(_0x139c8e){return function(_0x3f384e){return _0x3f384e[_0xafdb('0x34')][_0xafdb('0x43')]()===_0x139c8e[_0xafdb('0x43')]();};}exports[_0xafdb('0x44')]=function(_0x2b2eef,_0x3817e4,_0x372c55,_0x2181b2){return function(_0x1ae493){try{var _0x316f58={'name':_0x3817e4[0x0],'timeout':_0x3817e4[0x1]};var _0x30d5bc=queue[_0xafdb('0x0')](_0x316f58,{'typecast':!![]});if(_0x30d5bc[_0xafdb('0x45')]){logger[_0xafdb('0x38')](_0xafdb('0x46'),_0x2b2eef,_[_0xafdb('0x47')](_0x30d5bc,_0xafdb('0x2f'))[_0xafdb('0x48')](',\x20'));_0x1ae493[_0xafdb('0x49')]();}else{var _0x36256d=_[_0xafdb('0x4a')](_0x372c55[_0x2181b2[_0xafdb('0x2b')]+_0xafdb('0x4b')],handleFindQueue(_0x316f58['name']));if(_0x36256d){startRouting(_0x2b2eef,_0x36256d,_0x2181b2,_0x372c55);var _0x413ddd=(_0x36256d[_0xafdb('0x41')]||0xa)*0x3e8;var _0x2dd793=(_0x316f58['timeout']||0x14)*0x3e8;var _0xcb2697;if(_0x413ddd>_0x2dd793){_0x2dd793=_0x413ddd;}var _0xb2e325=seqqueue[_0xafdb('0x4c')](_0x413ddd);_0xb2e325['id']=_0x2b2eef;_0xb2e325['atimeout']=_0x413ddd;_0xb2e325[_0xafdb('0x4d')]=_0x2dd793;_0xb2e325['channel']=_0x2181b2[_0xafdb('0x2b')];_0x372c55[_0xafdb('0x4e')][_0x2b2eef]['on'](_0xafdb('0x4f'),function(){logger['info'](_0xafdb('0x50'),_0x2b2eef);stopRouting(_0x2b2eef,_0x36256d,_0x2181b2,_0x372c55);clearTimeout(_0xcb2697);_0xcb2697=undefined;_0xb2e325[_0xafdb('0x51')](!![]);if(_0x372c55[_0xafdb('0x4e')][_0x2b2eef]){delete _0x372c55['rules'][_0x2b2eef];}_0x1ae493['stop']();});_0x372c55[_0xafdb('0x4e')][_0x2b2eef]['on'](_0xafdb('0x52'),function(){if(_0x372c55[_0xafdb('0x4e')][_0x2b2eef]){delete _0x372c55[_0xafdb('0x4e')][_0x2b2eef];}});_0xcb2697=setTimeout(function(){logger[_0xafdb('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x2b2eef);endRouting(_0x2b2eef,_0x36256d,_0x2181b2,_0x372c55);clearTimeout(_0xcb2697);_0xb2e325[_0xafdb('0x51')](!![]);_0x1ae493[_0xafdb('0x53')]();},_0x2dd793);switch(_0x36256d[_0xafdb('0x54')]){case _0xafdb('0x55'):strategy[_0xafdb('0x55')](_0xb2e325,_0x36256d,_0x372c55,_0x2181b2);break;default:strategy[_0xafdb('0x56')](_0xb2e325,_0x36256d,_0x372c55,_0x2181b2);}}else{logger[_0xafdb('0x38')](_0xafdb('0x57'),_0x2b2eef,_0x316f58[_0xafdb('0x34')]);_0x1ae493[_0xafdb('0x49')]();}}}catch(_0x53ad7f){logger[_0xafdb('0x38')](_0xafdb('0x46'),_0x2b2eef,_0x53ad7f['stack']);_0x1ae493[_0xafdb('0x49')]();}};}; \ 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 21f8430..a3fcede 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 _0x7a2c=['squeue','isNil','agents','forcedOwnership','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','channel','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x32798c,_0x3ff775){var _0x3c1345=function(_0x64f26c){while(--_0x64f26c){_0x32798c['push'](_0x32798c['shift']());}};_0x3c1345(++_0x3ff775);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x32311d,_0x408f88){_0x32311d=_0x32311d-0x0;var _0x255ecb=_0x7a2c[_0x32311d];return _0x255ecb;};'use strict';var _=require(_0xc7a2('0x0'));var uuid=require('uuid');var util=require(_0xc7a2('0x1'));var logger=require(_0xc7a2('0x2'))(_0xc7a2('0x3'));var Agent=function(_0x26fb61,_0x44d702,_0x2abba8,_0x3f2b0d){this[_0xc7a2('0x4')]=uuid['v4']();this['squeue']=_0x26fb61;this[_0xc7a2('0x5')]=_0x44d702;this[_0xc7a2('0x6')]=_0x2abba8;this['routing']=_0x3f2b0d;this['squeue']['push'](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xa'),this[_0xc7a2('0x9')][_0xc7a2('0x8')](this));this['squeue']['on'](_0xc7a2('0xb'),this['handleDrained'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xd')]=function(){this['squeue'][_0xc7a2('0xd')](this[_0xc7a2('0x7')][_0xc7a2('0x8')](this),this['handleTimeout'][_0xc7a2('0x8')](this));};Agent[_0xc7a2('0xc')][_0xc7a2('0xe')]=function(){this[_0xc7a2('0x9')](!![]);};Agent[_0xc7a2('0xc')][_0xc7a2('0x7')]=function(){logger[_0xc7a2('0xf')](_0xc7a2('0x10'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){logger[_0xc7a2('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc7a2('0x11')]['id'],this['agent']['id']);setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}else{if(this[_0xc7a2('0x3')][_0xc7a2('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],this['squeue']['channel'],![])){this[_0xc7a2('0x6')]['agents'][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x15')]=!![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x17')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this['squeue']['channel']);util[_0xc7a2('0x18')](this[_0xc7a2('0x4')],this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']],null,this[_0xc7a2('0x3')]);util[_0xc7a2('0x19')](this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0xc7a2('0x1a')+(this['routing'][_0xc7a2('0x14')]?':FORCED':''));}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1b'),this[_0xc7a2('0x11')]['id'],this[_0xc7a2('0x5')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xc7a2('0xc')][_0xc7a2('0x9')]=function(_0x272c6b){if(_[_0xc7a2('0x12')](this[_0xc7a2('0x6')][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']])){return logger['debug'](_0xc7a2('0x1c'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);}else{logger[_0xc7a2('0xf')](_0xc7a2('0x1d'),this[_0xc7a2('0x11')]['id'],this['agent']['id']);util[_0xc7a2('0x1e')](this['notificationId'],this[_0xc7a2('0x11')]['id'],this['realtime']['agents'][this[_0xc7a2('0x5')]['id']],null,this['routing']);this['realtime'][_0xc7a2('0x13')][this['agent']['id']][_0xc7a2('0x15')]=![];this['realtime'][_0xc7a2('0x13')][this[_0xc7a2('0x5')]['id']][_0xc7a2('0x16')]=undefined;util[_0xc7a2('0x1f')](this[_0xc7a2('0x6')],this[_0xc7a2('0x3')],this[_0xc7a2('0x5')],this[_0xc7a2('0x11')][_0xc7a2('0x20')]);util[_0xc7a2('0x19')](this['squeue']['id'],this[_0xc7a2('0x6')][_0xc7a2('0x13')][this['agent']['id']],_0x272c6b?_0xc7a2('0x21'):_0xc7a2('0x22'));}if(!_0x272c6b){setTimeout(this[_0xc7a2('0xd')][_0xc7a2('0x8')](this),0x3e8);}};function agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4){return new Agent(_0x178c3e,_0x46a665,_0x3a7845,_0x4972a4);}module[_0xc7a2('0x23')]=agent; \ No newline at end of file +var _0x9957=['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','lodash','uuid','./util','../../../../../config/logger','squeue','agent','realtime','routing','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','channel','busyQueue'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var uuid=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var logger=require(_0x7995('0x3'))('routing');var Agent=function(_0x86c128,_0x3c58eb,_0x1902b4,_0x462a03){this['notificationId']=uuid['v4']();this[_0x7995('0x4')]=_0x86c128;this[_0x7995('0x5')]=_0x3c58eb;this[_0x7995('0x6')]=_0x1902b4;this[_0x7995('0x7')]=_0x462a03;this[_0x7995('0x4')][_0x7995('0x8')](this['handleRun'][_0x7995('0x9')](this),this[_0x7995('0xa')]['bind'](this));this[_0x7995('0x4')]['on'](_0x7995('0xb'),this[_0x7995('0xa')][_0x7995('0x9')](this));this[_0x7995('0x4')]['on'](_0x7995('0xc'),this[_0x7995('0xd')]['bind'](this));};Agent[_0x7995('0xe')][_0x7995('0x8')]=function(){this['squeue'][_0x7995('0x8')](this[_0x7995('0xf')][_0x7995('0x9')](this),this[_0x7995('0xa')][_0x7995('0x9')](this));};Agent[_0x7995('0xe')][_0x7995('0xd')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x7995('0xf')]=function(){logger[_0x7995('0x10')](_0x7995('0x11'),this[_0x7995('0x4')]['id'],this[_0x7995('0x5')]['id']);if(_[_0x7995('0x12')](this[_0x7995('0x6')][_0x7995('0x13')][this['agent']['id']])){logger[_0x7995('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7995('0x4')]['id'],this[_0x7995('0x5')]['id']);setTimeout(this[_0x7995('0x8')][_0x7995('0x9')](this),0x3e8);}else{if(this[_0x7995('0x7')][_0x7995('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x7995('0x6')]['agents'][this['agent']['id']],this[_0x7995('0x4')][_0x7995('0x15')],![])){this['realtime'][_0x7995('0x13')][this['agent']['id']]['busy']=!![];this[_0x7995('0x6')][_0x7995('0x13')][this[_0x7995('0x5')]['id']][_0x7995('0x16')]=undefined;util[_0x7995('0x17')](this[_0x7995('0x6')],this['routing'],this[_0x7995('0x5')],this[_0x7995('0x4')][_0x7995('0x15')]);util[_0x7995('0x18')](this[_0x7995('0x19')],this[_0x7995('0x4')]['id'],this[_0x7995('0x6')][_0x7995('0x13')][this['agent']['id']],null,this[_0x7995('0x7')]);util[_0x7995('0x1a')](this[_0x7995('0x4')]['id'],this[_0x7995('0x6')][_0x7995('0x13')][this[_0x7995('0x5')]['id']],'RINGING'+(this[_0x7995('0x7')]['forcedOwnership']?_0x7995('0x1b'):''));}else{logger[_0x7995('0x10')](_0x7995('0x1c'),this[_0x7995('0x4')]['id'],this[_0x7995('0x5')]['id']);setTimeout(this['push'][_0x7995('0x9')](this),0x3e8);}}};Agent['prototype'][_0x7995('0xa')]=function(_0x3250e0){if(_[_0x7995('0x12')](this['realtime']['agents'][this['agent']['id']])){return logger[_0x7995('0x10')](_0x7995('0x1d'),this[_0x7995('0x4')]['id'],this[_0x7995('0x5')]['id']);}else{logger[_0x7995('0x10')](_0x7995('0x1e'),this['squeue']['id'],this['agent']['id']);util[_0x7995('0x1f')](this['notificationId'],this[_0x7995('0x4')]['id'],this[_0x7995('0x6')][_0x7995('0x13')][this[_0x7995('0x5')]['id']],null,this[_0x7995('0x7')]);this['realtime'][_0x7995('0x13')][this[_0x7995('0x5')]['id']]['busy']=![];this['realtime']['agents'][this[_0x7995('0x5')]['id']][_0x7995('0x16')]=undefined;util['removeWaitingNotification'](this[_0x7995('0x6')],this['routing'],this[_0x7995('0x5')],this[_0x7995('0x4')][_0x7995('0x15')]);util['writeLog'](this['squeue']['id'],this[_0x7995('0x6')]['agents'][this['agent']['id']],_0x3250e0?_0x7995('0x20'):_0x7995('0x21'));}if(!_0x3250e0){setTimeout(this['push'][_0x7995('0x9')](this),0x3e8);}};function agent(_0x1922b4,_0x2b772f,_0x18667c,_0x1e3dbf){return new Agent(_0x1922b4,_0x2b772f,_0x18667c,_0x1e3dbf);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 905aea0..08d13cb 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 _0x0e4c=['uuid','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','handleTimeout','bind','timeout','drained','prototype','handleDrained','Agents','length','realtime','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','isNil','hideNotification','busyQueue','removeWaitingNotification','lodash'];(function(_0x34285f,_0x2624e2){var _0xb5674d=function(_0x539467){while(--_0x539467){_0x34285f['push'](_0x34285f['shift']());}};_0xb5674d(++_0x2624e2);}(_0x0e4c,0x87));var _0xc0e4=function(_0x50e6e9,_0x606270){_0x50e6e9=_0x50e6e9-0x0;var _0x497f8a=_0x0e4c[_0x50e6e9];return _0x497f8a;};'use strict';var _=require(_0xc0e4('0x0'));var uuid=require(_0xc0e4('0x1'));var util=require('./util');var logger=require(_0xc0e4('0x2'))(_0xc0e4('0x3'));var Beepall=function(_0x2b4347,_0x4ac6b4,_0x22fa62,_0x1521ae){this[_0xc0e4('0x4')]=uuid['v4']();this[_0xc0e4('0x5')]=_0x2b4347;this[_0xc0e4('0x6')]=_0x4ac6b4;this['realtime']=_0x22fa62;this[_0xc0e4('0x3')]=_0x1521ae;this[_0xc0e4('0x5')][_0xc0e4('0x7')](this[_0xc0e4('0x8')]['bind'](this),this[_0xc0e4('0x9')][_0xc0e4('0xa')](this));this[_0xc0e4('0x5')]['on'](_0xc0e4('0xb'),this[_0xc0e4('0x9')]['bind'](this));this[_0xc0e4('0x5')]['on'](_0xc0e4('0xc'),this['handleDrained'][_0xc0e4('0xa')](this));};Beepall['prototype']['push']=function(){this[_0xc0e4('0x5')][_0xc0e4('0x7')](this[_0xc0e4('0x8')]['bind'](this),this[_0xc0e4('0x9')]['bind'](this));};Beepall[_0xc0e4('0xd')][_0xc0e4('0xe')]=function(){this[_0xc0e4('0x9')](!![]);};Beepall[_0xc0e4('0xd')][_0xc0e4('0x8')]=function(){var _0x4c3092=!![];if(!_['isNil'](this[_0xc0e4('0x6')])&&!_['isNil'](this[_0xc0e4('0x6')][_0xc0e4('0xf')])&&this[_0xc0e4('0x6')][_0xc0e4('0xf')][_0xc0e4('0x10')]>0x0){for(var _0x19504f=0x0,_0x48be83;_0x19504f0x0){for(var _0xe0cd93=0x0,_0x1e7dca;_0xe0cd930x0&&_0xe2a28a[_0x245e2b+'CurrentCapacity']>=_0xe2a28a[_0x245e2b+_0xc988('0x1f')]){writeLog(_0x5c85e0,_0xe2a28a,_0x245e2b['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xc988('0x20')]=function(_0x2ae8d5,_0x406c76,_0x536df4,_0x54479a,_0x432e63){return sendNotification(!![],_0x2ae8d5,_0x406c76,_0x536df4,_0x54479a,_0x432e63);};exports[_0xc988('0x21')]=function(_0x421e3b,_0x222e51,_0x298fba,_0x4d98bf,_0x45ce34){return sendNotification(![],_0x421e3b,_0x222e51,_0x298fba,_0x4d98bf,_0x45ce34);};exports[_0xc988('0x22')]=function(_0x47a6ad,_0xbce18b,_0x3c11a5){var _0x4fff71=_0xbce18b[_0xc988('0x23')]['UserId'];if(!_0x4fff71&&_0x3c11a5){_0x4fff71=_0x3c11a5['id'];}var _0x20b170=_['some'](_0x47a6ad[_0xbce18b['channel']+_0xc988('0x24')],function(_0x26c869){var _0x7da212=_[_0xc988('0x25')](_0xbce18b[_0xc988('0x26')])+_0xc988('0x27');return _0x26c869[_0x7da212]===_0xbce18b[_0xc988('0x23')]['id'];});if(!_0x20b170&&_0x4fff71&&_0x47a6ad[_0xc988('0x28')][_0x4fff71]){_0x20b170=_[_0xc988('0x29')](_0x47a6ad[_0xc988('0x28')][_0x4fff71][_0xbce18b[_0xc988('0x26')]+_0xc988('0x2a')],function(_0x34b16d){return _0x34b16d['id']===_0xbce18b[_0xc988('0x23')]['id'];});}return _0x20b170;};exports[_0xc988('0x2b')]=function(_0x54390a,_0x15c9fe,_0x4bde93,_0x103f83){if(_0x4bde93&&_0x4bde93['id']&&_0x54390a[_0xc988('0x28')]&&_0x54390a['agents'][_0x4bde93['id']]){_0x54390a[_0xc988('0x28')][_0x4bde93['id']][_0x103f83+'WaitingInteractions'][_0x15c9fe[_0xc988('0x14')]['id']]={'id':_0x15c9fe[_0xc988('0x23')]['id']};}};exports[_0xc988('0x2c')]=function(_0x525a1b,_0x1a4fc5,_0x49392a,_0x1f6b50){if(_0x49392a&&_0x49392a['id']&&_0x525a1b[_0xc988('0x28')]&&_0x525a1b['agents'][_0x49392a['id']]){delete _0x525a1b['agents'][_0x49392a['id']][_0x1f6b50+_0xc988('0x2a')][_0x1a4fc5[_0xc988('0x14')]['id']];}};exports[_0xc988('0x2d')]=writeLog; \ No newline at end of file +var _0x0776=['busy','online','OFFLINE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','checkWaitingNotifications','interaction','UserId','some','channel','capitalize','agents','saveWaitingNotification','WaitingInteractions','message','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','socket.io-emitter','split','\x20interaction','name','account','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','user:%s','emit','notification:%s','remove','debug'];(function(_0x5c25f7,_0x3a69dc){var _0x1d51d1=function(_0x284c00){while(--_0x284c00){_0x5c25f7['push'](_0x5c25f7['shift']());}};_0x1d51d1(++_0x3a69dc);}(_0x0776,0x128));var _0x6077=function(_0x25bc87,_0x182191){_0x25bc87=_0x25bc87-0x0;var _0x6ae53c=_0x0776[_0x25bc87];return _0x6ae53c;};'use strict';var _=require(_0x6077('0x0'));var util=require(_0x6077('0x1'));var utils=require(_0x6077('0x2'));var Redis=require(_0x6077('0x3'));var config=require(_0x6077('0x4'));var logger=require(_0x6077('0x5'))('routing');config[_0x6077('0x6')]=_[_0x6077('0x7')](config[_0x6077('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6077('0x8'))(new Redis(config[_0x6077('0x6')]));function sendNotification(_0x5d3c70,_0x19b64b,_0x54c2d6,_0x2da4e4,_0x145429,_0x101cc9){var _0x3cd350=_0x101cc9||{};var _0x5754f1=_0x54c2d6[_0x6077('0x9')]('.');var _0x1c4c12={'uniqueid':_0x19b64b,'channel':_0x5754f1[0x0],'id':_0x5754f1[0x1],'title':_0x5754f1[0x0]+_0x6077('0xa'),'interactionId':_0x5754f1[0x2],'queue':_0x145429?_0x145429[_0x6077('0xb')]:null,'sound':_0x3cd350[_0x6077('0xc')]['notificationSound'],'shake':_0x3cd350['account']['notificationShake']};try{if(!_0x3cd350['body']){_0x3cd350['body']={};}if(_0x145429){_0x3cd350['body'][_0x6077('0xd')]=_0x145429;}else if(_0x3cd350['body'][_0x6077('0xd')]){delete _0x3cd350['body'][_0x6077('0xd')];}_0x1c4c12[_0x6077('0xe')]=utils[_0x6077('0xf')](_0x3cd350[_0x6077('0xc')][_0x6077('0x10')],_0x3cd350);}catch(_0x6d167d){_0x1c4c12['msg']=_0x6077('0x11');logger[_0x6077('0x12')](util[_0x6077('0x13')](_0x6077('0x14'),_0x19b64b,_0x6d167d['message']));}io['to'](util[_0x6077('0x13')](_0x6077('0x15'),_0x2da4e4['name']))[_0x6077('0x16')](util[_0x6077('0x13')](_0x6077('0x17'),_0x5d3c70?'save':_0x6077('0x18')),_0x1c4c12);}function writeLog(_0x4eaebd,_0x237814,_0x1bcfee){return logger[_0x6077('0x19')](util[_0x6077('0x13')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4eaebd,_0x237814[_0x6077('0xb')],_0x1bcfee));}exports['isAgentAvailable']=function(_0x203174,_0x20382f,_0x5102a1,_0x3b5790){if(_0x20382f[_0x6077('0x1a')]){writeLog(_0x203174,_0x20382f,'BUSY');return![];}if(!_0x20382f[_0x6077('0x1b')]){writeLog(_0x203174,_0x20382f,_0x6077('0x1c'));return![];}if(_0x20382f[_0x5102a1+'Pause']){writeLog(_0x203174,_0x20382f,'PAUSE');return![];}if(_0x3b5790&&_0x20382f[_0x6077('0x1d')](_0x5102a1+_0x6077('0x1e'))&&_0x20382f[_0x6077('0x1d')](_0x5102a1+_0x6077('0x1f'))){if(_0x20382f[_0x5102a1+_0x6077('0x1e')]>0x0&&_0x20382f[_0x5102a1+'CurrentCapacity']>=_0x20382f[_0x5102a1+_0x6077('0x1e')]){writeLog(_0x203174,_0x20382f,_0x5102a1[_0x6077('0x20')]()+_0x6077('0x21'));return![];}}return!![];};exports['showNotification']=function(_0x53f6ae,_0x1cd735,_0x54720a,_0x15a78e,_0x4d0dd2){return sendNotification(!![],_0x53f6ae,_0x1cd735,_0x54720a,_0x15a78e,_0x4d0dd2);};exports['hideNotification']=function(_0x446329,_0x285db9,_0x454162,_0x418633,_0x25312c){return sendNotification(![],_0x446329,_0x285db9,_0x454162,_0x418633,_0x25312c);};exports[_0x6077('0x22')]=function(_0x463cf5,_0xe89316,_0x4e408c){var _0x425203=_0xe89316[_0x6077('0x23')][_0x6077('0x24')];if(!_0x425203&&_0x4e408c){_0x425203=_0x4e408c['id'];}var _0x51f101=_[_0x6077('0x25')](_0x463cf5[_0xe89316[_0x6077('0x26')]+'QueuesWaitingInteractions'],function(_0x5ac816){var _0x44a47a=_[_0x6077('0x27')](_0xe89316[_0x6077('0x26')])+'InteractionId';return _0x5ac816[_0x44a47a]===_0xe89316['interaction']['id'];});if(!_0x51f101&&_0x425203&&_0x463cf5[_0x6077('0x28')][_0x425203]){_0x51f101=_[_0x6077('0x25')](_0x463cf5['agents'][_0x425203][_0xe89316[_0x6077('0x26')]+'WaitingInteractions'],function(_0x3a6929){return _0x3a6929['id']===_0xe89316[_0x6077('0x23')]['id'];});}return _0x51f101;};exports[_0x6077('0x29')]=function(_0x42e2e8,_0x4602e9,_0x23b645,_0x4a952b){if(_0x23b645&&_0x23b645['id']&&_0x42e2e8[_0x6077('0x28')]&&_0x42e2e8[_0x6077('0x28')][_0x23b645['id']]){_0x42e2e8[_0x6077('0x28')][_0x23b645['id']][_0x4a952b+_0x6077('0x2a')][_0x4602e9[_0x6077('0x2b')]['id']]={'id':_0x4602e9[_0x6077('0x23')]['id']};}};exports[_0x6077('0x2c')]=function(_0x16a8e1,_0x453432,_0x1832fe,_0x18325b){if(_0x1832fe&&_0x1832fe['id']&&_0x16a8e1['agents']&&_0x16a8e1[_0x6077('0x28')][_0x1832fe['id']]){delete _0x16a8e1[_0x6077('0x28')][_0x1832fe['id']][_0x18325b+_0x6077('0x2a')][_0x453432['message']['id']];}};exports[_0x6077('0x2d')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 38565e2..f910755 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 _0xc903=['info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join'];(function(_0x59beb6,_0x10d085){var _0x331d47=function(_0x367f16){while(--_0x367f16){_0x59beb6['push'](_0x59beb6['shift']());}};_0x331d47(++_0x10d085);}(_0xc903,0x1bd));var _0x3c90=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0xc903[_0x5976f8];return _0x179715;};'use strict';var schema=require(_0x3c90('0x0'));var sh=require(_0x3c90('0x1'));var _=require('lodash');var utils=require(_0x3c90('0x2'));var logger=require(_0x3c90('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x3c90('0x4')}});exports[_0x3c90('0x5')]=function(_0x326341,_0xc4e5e9){return function(_0x1ebfed){try{var _0x3f02e0={'command':_0xc4e5e9[0x0]};var _0x5d2f3a=system[_0x3c90('0x0')](_0x3f02e0,{'typecast':!![]});if(_0x5d2f3a[_0x3c90('0x6')]){logger[_0x3c90('0x7')]('[%s][SYSTEM]\x20%s',_0x326341,_[_0x3c90('0x8')](_0x5d2f3a,_0x3c90('0x9'))[_0x3c90('0xa')](',\x20'));logger[_0x3c90('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x326341);_0x1ebfed[_0x3c90('0xc')]();}else{var _0x1fdf0b=this;var _0x3bf3f6=utils[_0x3c90('0xd')](_0xc4e5e9[0x0],this);logger[_0x3c90('0xb')](_0x3c90('0xe'),_0x326341,_0x3bf3f6);sh[_0x3c90('0xf')](_[_0x3c90('0x10')](_0x3bf3f6),function(_0x45d65e,_0x1d2cc7){logger[_0x3c90('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x326341,_0x45d65e);if(_0x45d65e==0x0){var _0x1be688=_0x1d2cc7[_0x3c90('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x3c90('0x12')](_0xc4e5e9[0x1])||_['isEmpty'](_0xc4e5e9[0x1])){logger[_0x3c90('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x326341);_0x1fdf0b[_0x3c90('0x13')][_0xc4e5e9[0x1]]=_0x1be688;}else{logger[_0x3c90('0xb')](_0x3c90('0x14'),_0x326341,_0xc4e5e9[0x1],_0x1be688);_0x1fdf0b['body'][_0xc4e5e9[0x1]]=_0x1be688;}}_0x1ebfed['next']();});}}catch(_0x53b8cc){logger[_0x3c90('0x7')]('[%s][SYSTEM]\x20%s',_0x326341,_[_0x3c90('0x15')](_0x53b8cc)?JSON[_0x3c90('0x16')](_0x53b8cc):_0x53b8cc);logger['info'](_0x3c90('0x17'),_0x326341);_0x1ebfed['next']();}};}; \ No newline at end of file +var _0x92e1=['[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92e1,0xa8));var _0x192e=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0x92e1[_0x203d64];return _0x462ab3;};'use strict';var schema=require(_0x192e('0x0'));var sh=require(_0x192e('0x1'));var _=require(_0x192e('0x2'));var utils=require(_0x192e('0x3'));var logger=require('../../../../config/logger')(_0x192e('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x192e('0x5')}});exports[_0x192e('0x6')]=function(_0x540fda,_0xe4e31b){return function(_0x56d287){try{var _0x250119={'command':_0xe4e31b[0x0]};var _0x30beda=system[_0x192e('0x0')](_0x250119,{'typecast':!![]});if(_0x30beda['length']){logger[_0x192e('0x7')](_0x192e('0x8'),_0x540fda,_[_0x192e('0x9')](_0x30beda,_0x192e('0xa'))[_0x192e('0xb')](',\x20'));logger[_0x192e('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x540fda);_0x56d287['next']();}else{var _0x9b01e8=this;var _0x458130=utils[_0x192e('0xd')](_0xe4e31b[0x0],this);logger[_0x192e('0xc')](_0x192e('0xe'),_0x540fda,_0x458130);sh['exec'](_[_0x192e('0xf')](_0x458130),function(_0x1a42df,_0x1c9254){logger['info'](_0x192e('0x10'),_0x540fda,_0x1a42df);if(_0x1a42df==0x0){var _0x7683ec=_0x1c9254['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x192e('0x11')](_0xe4e31b[0x1])||_['isEmpty'](_0xe4e31b[0x1])){logger[_0x192e('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x540fda);_0x9b01e8[_0x192e('0x12')][_0xe4e31b[0x1]]=_0x7683ec;}else{logger[_0x192e('0xc')](_0x192e('0x13'),_0x540fda,_0xe4e31b[0x1],_0x7683ec);_0x9b01e8['body'][_0xe4e31b[0x1]]=_0x7683ec;}}_0x56d287[_0x192e('0x14')]();});}}catch(_0x142abd){logger[_0x192e('0x7')](_0x192e('0x8'),_0x540fda,_[_0x192e('0x15')](_0x142abd)?JSON['stringify'](_0x142abd):_0x142abd);logger[_0x192e('0xc')](_0x192e('0x16'),_0x540fda);_0x56d287[_0x192e('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index e5675f2..746e38a 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 _0x071b=['length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','stringify','finally','isObject','validate','lodash','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence'];(function(_0xcb0f49,_0x1db837){var _0x3a7359=function(_0x51d882){while(--_0x51d882){_0xcb0f49['push'](_0xcb0f49['shift']());}};_0x3a7359(++_0x1db837);}(_0x071b,0xe1));var _0xb071=function(_0x1574a2,_0x5200bc){_0x1574a2=_0x1574a2-0x0;var _0x1c6f36=_0x071b[_0x1574a2];return _0x1c6f36;};'use strict';var schema=require(_0xb071('0x0'));var _=require(_0xb071('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xb071('0x2')),'faxInteraction':require(_0xb071('0x3')),'whatsappInteraction':require(_0xb071('0x4'))};var logger=require(_0xb071('0x5'))(_0xb071('0x6'));var tag=schema({'tag':{'type':_0xb071('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xb071('0x8')]=function(_0x239bd6,_0x30759b,_0x1e3ce0,_0xeb6386){return function(_0xe536b4){try{var _0x34976d={'tag':_0x30759b[0x0]};var _0x49f5a1=tag['validate'](_0x34976d,{'typecast':!![]});if(_0x49f5a1[_0xb071('0x9')]){logger['error'](_0xb071('0xa'),_0x239bd6,_[_0xb071('0xb')](_0x49f5a1,_0xb071('0xc'))[_0xb071('0xd')](',\x20'));logger[_0xb071('0xe')](_0xb071('0xf'),_0x239bd6);_0xe536b4[_0xb071('0x10')]();}else{var _0x5e805b={'ids':[_0x30759b[0x0]]};if(rpc[_0xeb6386['channel']+'Interaction']){rpc[_0xeb6386[_0xb071('0x11')]+_0xb071('0x12')][_0xb071('0x13')](_0xeb6386[_0xb071('0x14')]['id'],_0x5e805b)['then'](function(_0x2c1923){logger[_0xb071('0xe')](_0xb071('0x15'),_0x239bd6,_0x30759b[0x1],_0xeb6386['channel'],_0xeb6386[_0xb071('0x14')]['id']);})['catch'](function(_0x4d475){logger[_0xb071('0x16')]('[%s][TAG]\x20%s',_0x239bd6,JSON[_0xb071('0x17')](_0x4d475));logger[_0xb071('0xe')](_0xb071('0xf'),_0x239bd6);})[_0xb071('0x18')](function(){_0xe536b4[_0xb071('0x10')]();});}}}catch(_0x369dd2){logger[_0xb071('0x16')](_0xb071('0xa'),_0x239bd6,_[_0xb071('0x19')](_0x369dd2)?JSON[_0xb071('0x17')](_0x369dd2):_0x369dd2);logger[_0xb071('0xe')](_0xb071('0xf'),_0x239bd6);_0xe536b4[_0xb071('0x10')]();}};}; \ No newline at end of file +var _0x921f=['../../../../config/logger','number','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x162ab0,_0x48ad72){var _0x40bd54=function(_0xd0a683){while(--_0xd0a683){_0x162ab0['push'](_0x162ab0['shift']());}};_0x40bd54(++_0x48ad72);}(_0x921f,0x1a3));var _0xf921=function(_0x2fd251,_0x5e9a35){_0x2fd251=_0x2fd251-0x0;var _0x1fa832=_0x921f[_0x2fd251];return _0x1fa832;};'use strict';var schema=require(_0xf921('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xf921('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xf921('0x2')),'mailInteraction':require(_0xf921('0x3')),'faxInteraction':require(_0xf921('0x4')),'whatsappInteraction':require(_0xf921('0x5'))};var logger=require(_0xf921('0x6'))('routing');var tag=schema({'tag':{'type':_0xf921('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4057cd,_0x27c4e1,_0xfdec5c,_0x5d227e){return function(_0x1f9cc5){try{var _0xc083b3={'tag':_0x27c4e1[0x0]};var _0x485be9=tag[_0xf921('0x0')](_0xc083b3,{'typecast':!![]});if(_0x485be9['length']){logger[_0xf921('0x8')](_0xf921('0x9'),_0x4057cd,_[_0xf921('0xa')](_0x485be9,_0xf921('0xb'))[_0xf921('0xc')](',\x20'));logger[_0xf921('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4057cd);_0x1f9cc5[_0xf921('0xe')]();}else{var _0x278d95={'ids':[_0x27c4e1[0x0]]};if(rpc[_0x5d227e[_0xf921('0xf')]+_0xf921('0x10')]){rpc[_0x5d227e[_0xf921('0xf')]+_0xf921('0x10')][_0xf921('0x11')](_0x5d227e[_0xf921('0x12')]['id'],_0x278d95)[_0xf921('0x13')](function(_0x33aac4){logger[_0xf921('0xd')](_0xf921('0x14'),_0x4057cd,_0x27c4e1[0x1],_0x5d227e[_0xf921('0xf')],_0x5d227e[_0xf921('0x12')]['id']);})[_0xf921('0x15')](function(_0x2cb1f4){logger[_0xf921('0x8')](_0xf921('0x9'),_0x4057cd,JSON[_0xf921('0x16')](_0x2cb1f4));logger[_0xf921('0xd')](_0xf921('0x17'),_0x4057cd);})[_0xf921('0x18')](function(){_0x1f9cc5['next']();});}}}catch(_0x340cbb){logger['error']('[%s][TAG]\x20%s',_0x4057cd,_['isObject'](_0x340cbb)?JSON[_0xf921('0x16')](_0x340cbb):_0x340cbb);logger[_0xf921('0xd')](_0xf921('0x17'),_0x4057cd);_0x1f9cc5[_0xf921('0xe')]();}};}; \ 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 b477ddd..014a010 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 _0xbf18=['catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','login','stringify','POST','application/json-rpc','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s'];(function(_0x361bb4,_0x411189){var _0x3e88c3=function(_0x263662){while(--_0x263662){_0x361bb4['push'](_0x361bb4['shift']());}};_0x3e88c3(++_0x411189);}(_0xbf18,0xba));var _0x8bf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf18[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x8bf1('0x0'));var logger=require(_0x8bf1('0x1'))(_0x8bf1('0x2'));var _=require('lodash');var arr=[];exports[_0x8bf1('0x3')]=function(_0x2a2999,_0x50540e){return function(_0xdce604){var _0x3144a2=_0x50540e[0xa];var _0x2b25b6=_0x50540e[0xb];var _0x722df7=_0x50540e[0xc];var _0x1639ab=_0x50540e[0xd];var _0x33e71f=_0x50540e[0xe];var _0x147bae=_0x50540e[0xf][_0x8bf1('0x4')](/\n/g,_0x8bf1('0x5'));var _0x4f45e2=_0x50540e[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x8bf1('0x6')](_0x2b25b6)){arr[_0x8bf1('0x7')](_0x2b25b6);var _0x575802=_0x50540e[0x3];var _0x12d57c=_0x50540e[0x4];var _0xfdf20f=_0x50540e[0x1];var _0x3fd177=_0x50540e[0x0];var _0x2eb1eb={};_0x2eb1eb[_0x8bf1('0x8')]=_0x50540e[0x8]+_0x8bf1('0x9')+_0x722df7+'|'+_0x3144a2+'|'+_0x1639ab+'|'+_0x2b25b6+'|'+_0x33e71f;_0x2eb1eb[_0x8bf1('0xa')]=_0x50540e[0x7]+_0x8bf1('0x9')+_0x722df7+'|'+_0x3144a2+'|'+_0x1639ab+'|'+_0x2b25b6+'|'+_0x33e71f+'|'+_0x147bae+'|'+_0x4f45e2;_0x2eb1eb['title']=_0x50540e[0x9];var _0x251294={};_0x251294[_0x8bf1('0xb')]=_0x8bf1('0xc');_0x251294['method']=_0x8bf1('0xd');var _0x4559ce=[];_0x4559ce[_0x8bf1('0x7')](_0x50540e[0x2]);_0x4559ce[_0x8bf1('0x7')](_0x50540e[0x5]);_0x4559ce['push'](_0x50540e[0x6]);_0x251294['params']=_0x4559ce;_0x251294['id']=0x1;var _0x7405b5=JSON[_0x8bf1('0xe')](_0x251294);var _0x4dd79e={'encoding':'utf8','method':_0x8bf1('0xf'),'timeout':0x2710,'url':_0x575802,'headers':{'Content-Type':_0x8bf1('0x10')},'body':_0x7405b5};return rp(_0x4dd79e)['then'](function(_0x6a26c6){const _0x40a88a=JSON['parse'](_0x6a26c6);if(!_0x40a88a[_0x8bf1('0x11')]['logged']){throw new Error(_0x8bf1('0x12'));}var _0x171eb8=_0x2b25b6;var _0x59b66b='channelId='+_0xfdf20f+'&serviceId='+_0x3fd177+_0x8bf1('0x13')+_0x171eb8+_0x8bf1('0x14')+JSON[_0x8bf1('0xe')](_0x2eb1eb);var _0x230bf8=_0x12d57c+'?'+_0x59b66b;return rp(_0x230bf8);})[_0x8bf1('0x15')](function(_0x4adc1b){logger[_0x8bf1('0x16')](_0x8bf1('0x17'),_0x2a2999,_0x4adc1b);_0xdce604['stop']();})[_0x8bf1('0x18')](function(_0x4496e6){logger[_0x8bf1('0x19')](_0x8bf1('0x1a'),_0x2a2999,_[_0x8bf1('0x1b')](_0x4496e6)?JSON[_0x8bf1('0xe')](_0x4496e6):_0x4496e6);_0xdce604['stop']();});}else{logger[_0x8bf1('0x16')](_0x8bf1('0x1c'),_0x2a2999);_0xdce604[_0x8bf1('0x1d')]();}};}; \ No newline at end of file +var _0x9556=['[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','jsonrpc','method','stringify','utf8','POST','application/json-rpc','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch'];(function(_0x123018,_0x9ee0){var _0x11cb7c=function(_0x184d2b){while(--_0x184d2b){_0x123018['push'](_0x123018['shift']());}};_0x11cb7c(++_0x9ee0);}(_0x9556,0x71));var _0x6955=function(_0x57790f,_0x2cb59f){_0x57790f=_0x57790f-0x0;var _0x12d415=_0x9556[_0x57790f];return _0x12d415;};'use strict';var rp=require('request-promise');var logger=require(_0x6955('0x0'))('routing');var _=require(_0x6955('0x1'));var arr=[];exports[_0x6955('0x2')]=function(_0x212e78,_0xb14f11){return function(_0x29285a){var _0x3fcee7=_0xb14f11[0xa];var _0x2e6af4=_0xb14f11[0xb];var _0x57a6ef=_0xb14f11[0xc];var _0x5844e4=_0xb14f11[0xd];var _0x2119d7=_0xb14f11[0xe];var _0x2fe482=_0xb14f11[0xf][_0x6955('0x3')](/\n/g,_0x6955('0x4'));var _0x3b3a1e=_0xb14f11[0x10][_0x6955('0x3')](/\n/g,'\x20');if(!arr['includes'](_0x2e6af4)){arr[_0x6955('0x5')](_0x2e6af4);var _0x453875=_0xb14f11[0x3];var _0x1dad82=_0xb14f11[0x4];var _0x10ba81=_0xb14f11[0x1];var _0x313ec6=_0xb14f11[0x0];var _0x120125={};_0x120125[_0x6955('0x6')]=_0xb14f11[0x8]+_0x6955('0x7')+_0x57a6ef+'|'+_0x3fcee7+'|'+_0x5844e4+'|'+_0x2e6af4+'|'+_0x2119d7;_0x120125['urlOnRing']=_0xb14f11[0x7]+_0x6955('0x7')+_0x57a6ef+'|'+_0x3fcee7+'|'+_0x5844e4+'|'+_0x2e6af4+'|'+_0x2119d7+'|'+_0x2fe482+'|'+_0x3b3a1e;_0x120125['title']=_0xb14f11[0x9];var _0x32ccc1={};_0x32ccc1[_0x6955('0x8')]='2.0';_0x32ccc1[_0x6955('0x9')]='login';var _0x4ae5bb=[];_0x4ae5bb[_0x6955('0x5')](_0xb14f11[0x2]);_0x4ae5bb[_0x6955('0x5')](_0xb14f11[0x5]);_0x4ae5bb['push'](_0xb14f11[0x6]);_0x32ccc1['params']=_0x4ae5bb;_0x32ccc1['id']=0x1;var _0x1cf7ce=JSON[_0x6955('0xa')](_0x32ccc1);var _0x26e99b={'encoding':_0x6955('0xb'),'method':_0x6955('0xc'),'timeout':0x2710,'url':_0x453875,'headers':{'Content-Type':_0x6955('0xd')},'body':_0x1cf7ce};return rp(_0x26e99b)['then'](function(_0x1488bd){const _0x3066d0=JSON[_0x6955('0xe')](_0x1488bd);if(!_0x3066d0['result'][_0x6955('0xf')]){throw new Error(_0x6955('0x10'));}var _0x4fe13d=_0x2e6af4;var _0xbddcd3=_0x6955('0x11')+_0x10ba81+_0x6955('0x12')+_0x313ec6+'&sessionId='+_0x4fe13d+'&data='+JSON[_0x6955('0xa')](_0x120125);var _0x295ba5=_0x1dad82+'?'+_0xbddcd3;return rp(_0x295ba5);})['then'](function(_0x559cfa){logger['info'](_0x6955('0x13'),_0x212e78,_0x559cfa);_0x29285a[_0x6955('0x14')]();})[_0x6955('0x15')](function(_0x2b1cad){logger['error'](_0x6955('0x16'),_0x212e78,_[_0x6955('0x17')](_0x2b1cad)?JSON[_0x6955('0xa')](_0x2b1cad):_0x2b1cad);_0x29285a['stop']();});}else{logger[_0x6955('0x18')](_0x6955('0x19'),_0x212e78);_0x29285a[_0x6955('0x1a')]();}};}; \ 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 6d0728e..74e714a 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x128dba,_0x4c8e5f){var _0x23e4a3=function(_0x3c5e5b){while(--_0x3c5e5b){_0x128dba['push'](_0x128dba['shift']());}};_0x23e4a3(++_0x4c8e5f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x417d4b,_0x36295c){var _0x405cf7=function(_0x2a1857){while(--_0x2a1857){_0x417d4b['push'](_0x417d4b['shift']());}};_0x405cf7(++_0x36295c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 959e153..4569aca 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 _0xb3f9=['openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','lodash','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','length','join','.js','app','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','split','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agents','agent','busy','end','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions'];(function(_0x22185a,_0x2c9c0f){var _0x27e1f1=function(_0x9ed420){while(--_0x9ed420){_0x22185a['push'](_0x22185a['shift']());}};_0x27e1f1(++_0x2c9c0f);}(_0xb3f9,0x122));var _0x9b3f=function(_0x2ece8f,_0x1b6d91){_0x2ece8f=_0x2ece8f-0x0;var _0xf3f143=_0xb3f9[_0x2ece8f];return _0xf3f143;};'use strict';var _=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var path=require(_0x9b3f('0x2'));var fs=require('fs');var jayson=require(_0x9b3f('0x3'));var BPromise=require(_0x9b3f('0x4'));var utils=require('./applications/utils');var sUtils=require(_0x9b3f('0x5'));var logger=require(_0x9b3f('0x6'))(_0x9b3f('0x7'));var rpc={'openchannelQueueReport':require(_0x9b3f('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x9b3f('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x9b3f('0xa')),'whatsappQueueReport':require(_0x9b3f('0xb'))};var RuleEngine=require(_0x9b3f('0xc'));function getId(_0x384694,_0x52a320,_0x580b87){return util[_0x9b3f('0xd')](_0x9b3f('0xe'),_0x384694,_0x52a320||0x0,_0x580b87||0x0);}function getIntervals(_0x41a78c,_0x23305a){var _0x3864d9=[];if(!_[_0x9b3f('0xf')](_0x23305a[_0x9b3f('0x10')])&&!_[_0x9b3f('0xf')](_0x41a78c[_0x23305a[_0x9b3f('0x10')]])&&!_[_0x9b3f('0xf')](_0x41a78c[_0x23305a[_0x9b3f('0x10')]][_0x9b3f('0x11')])){_0x3864d9=_[_0x9b3f('0x12')](_0x41a78c[_0x23305a['IntervalId']][_0x9b3f('0x11')],_0x9b3f('0x13'));}else if(!_[_0x9b3f('0xf')](_0x23305a[_0x9b3f('0x13')])){_0x3864d9=[_0x23305a[_0x9b3f('0x13')]];}return _0x3864d9;}exports[_0x9b3f('0x14')]=function(_0x6b1d57){_0x6b1d57[_0x9b3f('0x15')]={};return new BPromise(function(_0x25dcef,_0x39a810){var _0x21fef5={'Start':function(_0xb1de73){var _0x21cd24=this;return new Promise(function(_0x495554,_0x267da8){if(_0xb1de73){try{var _0x32b0e1=[];var _0x1a4567=getId(_0xb1de73[_0x9b3f('0x16')],_0xb1de73['message']?_0xb1de73[_0x9b3f('0x17')]['id']:0x0,_0xb1de73[_0x9b3f('0x18')]?_0xb1de73[_0x9b3f('0x18')]['id']:0x0);var _0x2fa5ca=sUtils[_0x9b3f('0x19')](_0x6b1d57,_0xb1de73);if(_0xb1de73['transfer']||!_0x2fa5ca&&_0xb1de73[_0x9b3f('0x1a')]&&_['isArray'](_0xb1de73[_0x9b3f('0x1a')])&&_0xb1de73[_0x9b3f('0x1a')][_0x9b3f('0x1b')]){for(var _0x110388=0x0;_0x110388<_0xb1de73[_0x9b3f('0x1a')]['length'];_0x110388+=0x1){var _0x17545b=_0xb1de73[_0x9b3f('0x1a')][_0x110388];if(fs['existsSync'](path[_0x9b3f('0x1c')](__dirname,'applications',_0x17545b['app']+_0x9b3f('0x1d')))){var _0x58898e=[];switch(_0x17545b[_0x9b3f('0x1e')][_0x9b3f('0x1f')]()){case _0x9b3f('0x20'):var _0x4a4fd5=_0x17545b['appdata']['split'](',');if(_0xb1de73[_0x9b3f('0x16')]===_0x9b3f('0x21')){_0x58898e['push'](_0x4a4fd5[0x0]);_0x58898e['push'](_0x4a4fd5[0x1]);_0x58898e[_0x9b3f('0x22')](_0x4a4fd5['slice'](0x2,_0x4a4fd5[_0x9b3f('0x1b')])[_0x9b3f('0x1c')](','));}else{_0x58898e[_0x9b3f('0x22')](_0x4a4fd5[0x0]);_0x58898e[_0x9b3f('0x22')](_0x4a4fd5[_0x9b3f('0x23')](0x1,_0x4a4fd5[_0x9b3f('0x1b')])[_0x9b3f('0x1c')](','));}break;case _0x9b3f('0x24'):var _0x108ec8=_0x17545b[_0x9b3f('0x25')][_0x9b3f('0x26')](',');_0x58898e['push'](_0x108ec8[0x0]);_0x58898e['push'](_0x108ec8[0x1]);_0x58898e['push'](_0x108ec8[_0x9b3f('0x23')](0x2,_0x108ec8[_0x9b3f('0x1b')])[_0x9b3f('0x1c')](','));break;case'dialogflowv2':var _0x1134fa=_0x17545b[_0x9b3f('0x25')][_0x9b3f('0x26')](',');_0x58898e['push'](_0x1134fa[0x0]);_0x58898e['push'](_0x1134fa[0x1]);_0x58898e['push'](_0x1134fa[0x2]);_0x58898e[_0x9b3f('0x22')](_0x1134fa[0x3]);_0x58898e[_0x9b3f('0x22')](_0x1134fa['slice'](0x4,_0x1134fa['length'])['join'](','));break;case _0x9b3f('0x27'):var _0x432532=_0x17545b['appdata'][_0x9b3f('0x26')](',');_0x58898e[_0x9b3f('0x22')](_0x432532[0x0]);_0x58898e['push'](_0x432532[0x1]);_0x58898e[_0x9b3f('0x22')](_0x432532[0x2]);_0x58898e[_0x9b3f('0x22')](_0x432532[0x3]);_0x58898e[_0x9b3f('0x22')](_0x432532[_0x9b3f('0x23')](0x4,_0x432532[_0x9b3f('0x1b')])[_0x9b3f('0x1c')](','));break;case _0x9b3f('0x17'):_0x58898e[_0x9b3f('0x22')](_0x17545b['appdata']);break;case _0x9b3f('0x28'):_0x58898e[_0x9b3f('0x22')](_0x17545b[_0x9b3f('0x29')]);_0x58898e['push'](_0x17545b[_0x9b3f('0x25')]);break;case _0x9b3f('0x2a'):var _0x3ea89a=utils[_0x9b3f('0x2b')](_0xb1de73[_0x9b3f('0x2c')][_0x9b3f('0x2d')],_0xb1de73);var _0x58b30b=_0x17545b['appdata'][_0x9b3f('0x26')](',');_0x58898e[_0x9b3f('0x22')](_0x58b30b[0x0]);_0x58898e['push'](_0x58b30b[0x1]);_0x58898e['push'](_0x58b30b[0x2]);_0x58898e[_0x9b3f('0x22')](_0x58b30b[0x3]);_0x58898e[_0x9b3f('0x22')](_0x58b30b[0x4]);_0x58898e[_0x9b3f('0x22')](_0x58b30b[0x5]);_0x58898e[_0x9b3f('0x22')](_0x58b30b[0x6]);_0x58898e[_0x9b3f('0x22')](_0x58b30b[0x7]);_0x58898e['push'](_0x58b30b[0x8]);_0x58898e[_0x9b3f('0x22')](_0x58b30b[0x9]);_0x58898e[_0x9b3f('0x22')](_0x58b30b[0xa]);_0x58898e[_0x9b3f('0x22')](_0xb1de73[_0x9b3f('0x18')]['id']);_0x58898e[_0x9b3f('0x22')](_0xb1de73[_0x9b3f('0x17')]['id']);_0x58898e['push'](_0x17545b['ChatWebsiteId']);_0x58898e['push'](_0xb1de73[_0x9b3f('0x18')][_0x9b3f('0x2e')]);_0x58898e['push'](_0xb1de73[_0x9b3f('0x2f')][_0x9b3f('0x2f')]);_0x58898e[_0x9b3f('0x22')](_0x3ea89a);break;default:_0x58898e=_[_0x9b3f('0xf')](_0x17545b['appdata'])?[]:_0x17545b[_0x9b3f('0x25')][_0x9b3f('0x26')](',');}var _0x45d0c4={'id':util[_0x9b3f('0xd')]('%s:%s:%s',_0x1a4567,_0x17545b['id'],_0x17545b[_0x9b3f('0x1e')]),'condition':require('./interval')['condition'](_0x1a4567,getIntervals(_0x6b1d57['intervals'],_0x17545b),_0x6b1d57),'consequence':require(_0x9b3f('0x30')+_0x17545b['app'])['consequence'](_0x1a4567,_0x58898e,_0x6b1d57,_0xb1de73),'p':_0x17545b[_0x9b3f('0x31')]||0x0};logger['info'](_0x9b3f('0x32'),_0x45d0c4['id'],_0x9b3f('0x33'),getIntervals(_0x6b1d57['intervals'],_0x17545b)[_0x9b3f('0x1c')](_0x9b3f('0x34')));_0x32b0e1[_0x9b3f('0x22')](_0x45d0c4);}else{logger[_0x9b3f('0x35')](_0x9b3f('0x36'),path[_0x9b3f('0x1c')](__dirname,_0x9b3f('0x1a'),_0x17545b['app']+_0x9b3f('0x1d')));}}_0x6b1d57[_0x9b3f('0x15')][_0x1a4567]=new RuleEngine(_0x32b0e1);_0x6b1d57['rules'][_0x1a4567]['execute'](_0xb1de73,function(_0x124078){logger[_0x9b3f('0x37')](_0x9b3f('0x38'),JSON[_0x9b3f('0x39')](_0x124078[_0x9b3f('0x3a')]));if(_0x6b1d57[_0x9b3f('0x15')][_0x1a4567]){_0x6b1d57[_0x9b3f('0x15')][_0x1a4567][_0x9b3f('0x3b')](_0x9b3f('0x3c'));}});return _0x495554({'code':0xc8,'message':_0xb1de73});}else{if(_0x2fa5ca){logger[_0x9b3f('0x37')](util[_0x9b3f('0xd')](_0x9b3f('0x3d'),_0x1a4567));}else{logger[_0x9b3f('0x37')](_0x9b3f('0x3e'));}return _0x495554({'code':0xc8,'message':_0xb1de73});}}catch(_0x12dabf){logger[_0x9b3f('0x35')](_0x12dabf[_0x9b3f('0x3f')]);return _0x267da8(_0x21cd24[_0x9b3f('0x35')](0x1f4,_0x12dabf));}}return _0x267da8(_0x9b3f('0x40'));});},'AcceptMessage':function(_0x43ca30){var _0x29bab9=this;return new Promise(function(_0x5cf3a3,_0x5ab9be){if(_0x43ca30['agent']&&_0x43ca30['agent']['id']){if(_0x6b1d57[_0x9b3f('0x41')][_0x43ca30[_0x9b3f('0x42')]['id']]){_0x6b1d57['agents'][_0x43ca30['agent']['id']][_0x9b3f('0x43')]=![];_0x6b1d57[_0x9b3f('0x41')][_0x43ca30['agent']['id']]['busyQueue']=undefined;}}if(_0x43ca30[_0x9b3f('0x17')]&&_0x43ca30['message']['id']){try{var _0x562577=getId(_0x43ca30['channel'],_0x43ca30[_0x9b3f('0x17')]?_0x43ca30[_0x9b3f('0x17')]['id']:0x0,_0x43ca30[_0x9b3f('0x18')]?_0x43ca30[_0x9b3f('0x18')]['id']:0x0);if(_0x6b1d57[_0x9b3f('0x15')][_0x562577]){_0x6b1d57[_0x9b3f('0x15')][_0x562577][_0x9b3f('0x3b')](_0x9b3f('0x44'));if(rpc[_0x43ca30[_0x9b3f('0x16')]+'QueueReport']){rpc[_0x43ca30[_0x9b3f('0x16')]+_0x9b3f('0x45')]['update'](_0x562577,{'UserId':_0x43ca30['message'][_0x9b3f('0x46')]})[_0x9b3f('0x47')](function(){logger[_0x9b3f('0x35')]('error\x20update\x20queue\x20report');});}}return _0x5cf3a3({'code':0xc8,'message':_0x43ca30});}catch(_0x2742e7){logger['error'](_0x2742e7['stack']);return _0x5ab9be(_0x29bab9[_0x9b3f('0x35')](0x1f4,_0x2742e7));}}logger[_0x9b3f('0x35')]('message\x20is\x20empty');return _0x5ab9be(_0x29bab9[_0x9b3f('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3f705e){var _0xa354f2=this;return new Promise(function(_0x5624d1,_0x2d7231){if(_0x3f705e[_0x9b3f('0x42')]&&_0x3f705e['agent']['id']){try{if(_0x6b1d57['agents'][_0x3f705e['agent']['id']]){_0x6b1d57[_0x9b3f('0x41')][_0x3f705e[_0x9b3f('0x42')]['id']][_0x9b3f('0x43')]=![];_0x6b1d57[_0x9b3f('0x41')][_0x3f705e[_0x9b3f('0x42')]['id']]['busyQueue']=undefined;}return _0x5624d1({'code':0xc8,'message':_0x3f705e});}catch(_0x54d9ed){logger['error'](_0x54d9ed['stack']);return _0x2d7231(_0xa354f2[_0x9b3f('0x35')](0x1f4,_0x54d9ed));}}logger['error'](_0x9b3f('0x48'));return _0x2d7231(_0xa354f2[_0x9b3f('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5af60a){var _0x3eb81a=this;return new Promise(function(_0x2c0f0c,_0x215c3d){if(_0x5af60a[_0x9b3f('0x16')]&&_0x5af60a[_0x9b3f('0x18')]&&_0x5af60a[_0x9b3f('0x18')]['id']){try{var _0x1d2376=getId(_0x5af60a[_0x9b3f('0x16')],_0x5af60a[_0x9b3f('0x17')]?_0x5af60a[_0x9b3f('0x17')]['id']:0x0,_0x5af60a[_0x9b3f('0x18')]?_0x5af60a[_0x9b3f('0x18')]['id']:0x0);if(_0x6b1d57[_0x9b3f('0x15')][_0x1d2376]){_0x6b1d57[_0x9b3f('0x15')][_0x1d2376][_0x9b3f('0x3b')](_0x9b3f('0x44'));}return _0x2c0f0c({'code':0xc8,'message':_0x5af60a});}catch(_0x2db10c){logger[_0x9b3f('0x35')](_0x2db10c['stack']);return _0x215c3d(_0x3eb81a[_0x9b3f('0x35')](0x1f4,_0x2db10c));}}logger['error'](_0x9b3f('0x48'));return _0x215c3d(_0x3eb81a[_0x9b3f('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xb7249b){var _0x2dce32=this;return new Promise(function(_0x520b8e,_0x5ec7dc){if(_0x6b1d57[_0x9b3f('0x41')][_0x9b3f('0x49')](_0xb7249b['id'])){for(var _0x4d7017 in _0xb7249b['capacity']){if(_0xb7249b[_0x9b3f('0x4a')][_0x9b3f('0x49')](_0x4d7017)){if(_0x6b1d57[_0x9b3f('0x41')][_0xb7249b['id']][_0x9b3f('0x49')](_0x4d7017+_0x9b3f('0x4b'))){_0x6b1d57[_0x9b3f('0x41')][_0xb7249b['id']][_0x4d7017+'CurrentCapacity']=parseInt(_0xb7249b[_0x9b3f('0x4a')][_0x4d7017],0xa);}}}_0x6b1d57[_0x9b3f('0x41')][_0xb7249b['id']]['updateRealtime']();return _0x520b8e({'code':0xc8,'message':_0x6b1d57[_0x9b3f('0x41')][_0xb7249b['id']]});}else{return _0x5ec7dc(_0x2dce32[_0x9b3f('0x35')](0x1f4,_0x9b3f('0x4c')));}});},'Agents':function(_0x328cc7){return new Promise(function(_0xc83f1d){var _0x5a83df=_[_0x9b3f('0x4d')](_0x6b1d57[_0x9b3f('0x41')]);if(_0x328cc7&&_0x328cc7['id']){var _0x4546da=_['find'](_0x5a83df,function(_0x97fc1f){return _0x97fc1f['id']===_0x328cc7['id'];});_0xc83f1d(_0x4546da);}else{_0xc83f1d({'count':_0x5a83df[_0x9b3f('0x1b')],'rows':_0x5a83df});}});},'ChatQueues':function(){return new Promise(function(_0x4228c7){var _0x3ebe1d=[];for(var _0x1a26cd in _0x6b1d57[_0x9b3f('0x4e')]){if(_0x6b1d57[_0x9b3f('0x4e')][_0x9b3f('0x49')](_0x1a26cd)){var _0x48773f=_0x6b1d57[_0x9b3f('0x4e')][_0x1a26cd];var _0x1296c4={'id':_0x48773f['id'],'available':_0x48773f[_0x9b3f('0x4f')],'loggedIn':_0x48773f[_0x9b3f('0x50')],'name':_0x48773f[_0x9b3f('0x51')],'paused':_0x48773f[_0x9b3f('0x52')],'waiting':_0x48773f['waiting']};_0x3ebe1d['push'](_0x1296c4);}}_0x4228c7({'count':_0x3ebe1d['length'],'rows':_0x3ebe1d});});},'MailQueues':function(){return new Promise(function(_0x2c861f){var _0x7cc6ac=[];for(var _0x29c91d in _0x6b1d57[_0x9b3f('0x53')]){if(_0x6b1d57['mailQueues']['hasOwnProperty'](_0x29c91d)){var _0x2e97d3=_0x6b1d57['mailQueues'][_0x29c91d];var _0x5607a4={'id':_0x2e97d3['id'],'available':_0x2e97d3[_0x9b3f('0x4f')],'loggedIn':_0x2e97d3['loggedIn'],'name':_0x2e97d3[_0x9b3f('0x51')],'paused':_0x2e97d3['paused'],'waiting':_0x2e97d3[_0x9b3f('0x54')]};_0x7cc6ac['push'](_0x5607a4);}}_0x2c861f({'count':_0x7cc6ac[_0x9b3f('0x1b')],'rows':_0x7cc6ac});});},'OpenchannelQueues':function(){return new Promise(function(_0x4d7b58){var _0x394239=[];for(var _0x207a1e in _0x6b1d57[_0x9b3f('0x55')]){if(_0x6b1d57[_0x9b3f('0x55')][_0x9b3f('0x49')](_0x207a1e)){var _0x3815e0=_0x6b1d57['openchannelQueues'][_0x207a1e];var _0x1d2ea0={'id':_0x3815e0['id'],'available':_0x3815e0[_0x9b3f('0x4f')],'loggedIn':_0x3815e0[_0x9b3f('0x50')],'name':_0x3815e0[_0x9b3f('0x51')],'paused':_0x3815e0[_0x9b3f('0x52')],'waiting':_0x3815e0[_0x9b3f('0x54')]};_0x394239[_0x9b3f('0x22')](_0x1d2ea0);}}_0x4d7b58({'count':_0x394239[_0x9b3f('0x1b')],'rows':_0x394239});});},'SmsQueues':function(){return new Promise(function(_0x5940d4){var _0x3a5a61=[];for(var _0x85a3cd in _0x6b1d57['smsQueues']){if(_0x6b1d57['smsQueues'][_0x9b3f('0x49')](_0x85a3cd)){var _0x29dfc6=_0x6b1d57[_0x9b3f('0x56')][_0x85a3cd];var _0x2dbc3a={'id':_0x29dfc6['id'],'available':_0x29dfc6[_0x9b3f('0x4f')],'loggedIn':_0x29dfc6[_0x9b3f('0x50')],'name':_0x29dfc6['name'],'paused':_0x29dfc6[_0x9b3f('0x52')],'waiting':_0x29dfc6['waiting']};_0x3a5a61[_0x9b3f('0x22')](_0x2dbc3a);}}_0x5940d4({'count':_0x3a5a61['length'],'rows':_0x3a5a61});});},'FaxQueues':function(){return new Promise(function(_0x4573ac){var _0x328e05=[];for(var _0x7f93fa in _0x6b1d57[_0x9b3f('0x57')]){if(_0x6b1d57[_0x9b3f('0x57')]['hasOwnProperty'](_0x7f93fa)){var _0x442536=_0x6b1d57[_0x9b3f('0x57')][_0x7f93fa];var _0x439733={'id':_0x442536['id'],'available':_0x442536[_0x9b3f('0x4f')],'loggedIn':_0x442536[_0x9b3f('0x50')],'name':_0x442536['name'],'paused':_0x442536[_0x9b3f('0x52')],'waiting':_0x442536[_0x9b3f('0x54')]};_0x328e05[_0x9b3f('0x22')](_0x439733);}}_0x4573ac({'count':_0x328e05[_0x9b3f('0x1b')],'rows':_0x328e05});});},'WhatsappQueues':function(){return new Promise(function(_0xb9f259){var _0x591df1=[];for(var _0x1061b0 in _0x6b1d57[_0x9b3f('0x58')]){if(_0x6b1d57['whatsappQueues'][_0x9b3f('0x49')](_0x1061b0)){var _0x4e9c8e=_0x6b1d57[_0x9b3f('0x58')][_0x1061b0];var _0x1e4844={'id':_0x4e9c8e['id'],'available':_0x4e9c8e[_0x9b3f('0x4f')],'loggedIn':_0x4e9c8e[_0x9b3f('0x50')],'name':_0x4e9c8e[_0x9b3f('0x51')],'paused':_0x4e9c8e[_0x9b3f('0x52')],'waiting':_0x4e9c8e[_0x9b3f('0x54')]};_0x591df1[_0x9b3f('0x22')](_0x1e4844);}}_0xb9f259({'count':_0x591df1[_0x9b3f('0x1b')],'rows':_0x591df1});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2df27c){var _0x6823a3=_['values'](_0x6b1d57[_0x9b3f('0x59')]);_0x2df27c({'count':_0x6823a3['length'],'rows':_0x6823a3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3dd3a5){var _0x2d7800=_[_0x9b3f('0x4d')](_0x6b1d57['mailQueuesWaitingInteractions']);_0x3dd3a5({'count':_0x2d7800[_0x9b3f('0x1b')],'rows':_0x2d7800});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4afc6b){var _0x52f4bf=_[_0x9b3f('0x4d')](_0x6b1d57[_0x9b3f('0x5a')]);_0x4afc6b({'count':_0x52f4bf[_0x9b3f('0x1b')],'rows':_0x52f4bf});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xc9275){var _0x3b99ab=_[_0x9b3f('0x4d')](_0x6b1d57['smsQueuesWaitingInteractions']);_0xc9275({'count':_0x3b99ab['length'],'rows':_0x3b99ab});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x233525){var _0x578100=_[_0x9b3f('0x4d')](_0x6b1d57['faxQueuesWaitingInteractions']);_0x233525({'count':_0x578100[_0x9b3f('0x1b')],'rows':_0x578100});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x17223b){var _0x220b04=_['values'](_0x6b1d57[_0x9b3f('0x5b')]);_0x17223b({'count':_0x220b04[_0x9b3f('0x1b')],'rows':_0x220b04});});}};var _0x243d07=jayson[_0x9b3f('0x5c')](_0x21fef5)['http']();_0x243d07['on'](_0x9b3f('0x35'),function(_0x254094){logger[_0x9b3f('0x35')](JSON['stringify'](_0x254094));return _0x39a810(_0x254094);});_0x243d07['listen'](0x232c,_0x9b3f('0x5d'),function(){console[_0x9b3f('0x5e')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x25dcef('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x7d5d=['isNil','IntervalId','Intervals','interval','rules','channel','message','applications','length','existsSync','join','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','tag','TagId','getMustacheRender','account','notificationTemplate','%s:%s:%s','app','./interval','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','interaction','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s'];(function(_0x27e16a,_0x1a77c5){var _0x5aae9b=function(_0x5218f9){while(--_0x5218f9){_0x27e16a['push'](_0x27e16a['shift']());}};_0x5aae9b(++_0x1a77c5);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0xe0342f,_0x4d503e){_0xe0342f=_0xe0342f-0x0;var _0x44cc72=_0x7d5d[_0xe0342f];return _0x44cc72;};'use strict';var _=require('lodash');var util=require(_0xd7d5('0x0'));var path=require(_0xd7d5('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0xd7d5('0x2'));var sUtils=require(_0xd7d5('0x3'));var logger=require(_0xd7d5('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0xd7d5('0x5')),'mailQueueReport':require(_0xd7d5('0x6')),'chatQueueReport':require(_0xd7d5('0x7')),'smsQueueReport':require(_0xd7d5('0x8')),'faxQueueReport':require(_0xd7d5('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xd7d5('0xa'));function getId(_0x29267f,_0x2da908,_0x4c0605){return util[_0xd7d5('0xb')](_0xd7d5('0xc'),_0x29267f,_0x2da908||0x0,_0x4c0605||0x0);}function getIntervals(_0x4c3b64,_0x19a60d){var _0x23b02e=[];if(!_[_0xd7d5('0xd')](_0x19a60d['IntervalId'])&&!_[_0xd7d5('0xd')](_0x4c3b64[_0x19a60d[_0xd7d5('0xe')]])&&!_[_0xd7d5('0xd')](_0x4c3b64[_0x19a60d[_0xd7d5('0xe')]]['Intervals'])){_0x23b02e=_['map'](_0x4c3b64[_0x19a60d[_0xd7d5('0xe')]][_0xd7d5('0xf')],_0xd7d5('0x10'));}else if(!_[_0xd7d5('0xd')](_0x19a60d[_0xd7d5('0x10')])){_0x23b02e=[_0x19a60d[_0xd7d5('0x10')]];}return _0x23b02e;}exports['listen']=function(_0x12327e){_0x12327e[_0xd7d5('0x11')]={};return new BPromise(function(_0x2c38f1,_0x3a01d9){var _0x237c1f={'Start':function(_0x4a4cb5){var _0x4508f2=this;return new Promise(function(_0x125302,_0xe24a6){if(_0x4a4cb5){try{var _0x25b1cb=[];var _0x103aad=getId(_0x4a4cb5[_0xd7d5('0x12')],_0x4a4cb5[_0xd7d5('0x13')]?_0x4a4cb5[_0xd7d5('0x13')]['id']:0x0,_0x4a4cb5['interaction']?_0x4a4cb5['interaction']['id']:0x0);var _0xdc774c=sUtils['checkWaitingNotifications'](_0x12327e,_0x4a4cb5);if(_0x4a4cb5['transfer']||!_0xdc774c&&_0x4a4cb5[_0xd7d5('0x14')]&&_['isArray'](_0x4a4cb5[_0xd7d5('0x14')])&&_0x4a4cb5['applications'][_0xd7d5('0x15')]){for(var _0x3acc3d=0x0;_0x3acc3d<_0x4a4cb5[_0xd7d5('0x14')][_0xd7d5('0x15')];_0x3acc3d+=0x1){var _0x1dea83=_0x4a4cb5['applications'][_0x3acc3d];if(fs[_0xd7d5('0x16')](path[_0xd7d5('0x17')](__dirname,_0xd7d5('0x14'),_0x1dea83['app']+'.js'))){var _0x2945b1=[];switch(_0x1dea83['app'][_0xd7d5('0x18')]()){case _0xd7d5('0x19'):var _0x22c202=_0x1dea83[_0xd7d5('0x1a')][_0xd7d5('0x1b')](',');if(_0x4a4cb5[_0xd7d5('0x12')]===_0xd7d5('0x1c')){_0x2945b1['push'](_0x22c202[0x0]);_0x2945b1[_0xd7d5('0x1d')](_0x22c202[0x1]);_0x2945b1[_0xd7d5('0x1d')](_0x22c202['slice'](0x2,_0x22c202[_0xd7d5('0x15')])[_0xd7d5('0x17')](','));}else{_0x2945b1[_0xd7d5('0x1d')](_0x22c202[0x0]);_0x2945b1[_0xd7d5('0x1d')](_0x22c202[_0xd7d5('0x1e')](0x1,_0x22c202[_0xd7d5('0x15')])[_0xd7d5('0x17')](','));}break;case _0xd7d5('0x1f'):var _0x3bd423=_0x1dea83[_0xd7d5('0x1a')][_0xd7d5('0x1b')](',');_0x2945b1[_0xd7d5('0x1d')](_0x3bd423[0x0]);_0x2945b1[_0xd7d5('0x1d')](_0x3bd423[0x1]);_0x2945b1[_0xd7d5('0x1d')](_0x3bd423[_0xd7d5('0x1e')](0x2,_0x3bd423['length'])[_0xd7d5('0x17')](','));break;case _0xd7d5('0x20'):var _0x5bed84=_0x1dea83[_0xd7d5('0x1a')][_0xd7d5('0x1b')](',');_0x2945b1[_0xd7d5('0x1d')](_0x5bed84[0x0]);_0x2945b1[_0xd7d5('0x1d')](_0x5bed84[0x1]);_0x2945b1[_0xd7d5('0x1d')](_0x5bed84[0x2]);_0x2945b1[_0xd7d5('0x1d')](_0x5bed84[0x3]);_0x2945b1['push'](_0x5bed84[_0xd7d5('0x1e')](0x4,_0x5bed84[_0xd7d5('0x15')])['join'](','));break;case'amazonlex':var _0x50ab34=_0x1dea83['appdata'][_0xd7d5('0x1b')](',');_0x2945b1[_0xd7d5('0x1d')](_0x50ab34[0x0]);_0x2945b1[_0xd7d5('0x1d')](_0x50ab34[0x1]);_0x2945b1[_0xd7d5('0x1d')](_0x50ab34[0x2]);_0x2945b1[_0xd7d5('0x1d')](_0x50ab34[0x3]);_0x2945b1[_0xd7d5('0x1d')](_0x50ab34[_0xd7d5('0x1e')](0x4,_0x50ab34[_0xd7d5('0x15')])[_0xd7d5('0x17')](','));break;case'message':_0x2945b1[_0xd7d5('0x1d')](_0x1dea83[_0xd7d5('0x1a')]);break;case _0xd7d5('0x21'):_0x2945b1[_0xd7d5('0x1d')](_0x1dea83[_0xd7d5('0x22')]);_0x2945b1[_0xd7d5('0x1d')](_0x1dea83['appdata']);break;case'tvox':var _0x9dbe0c=utils[_0xd7d5('0x23')](_0x4a4cb5[_0xd7d5('0x24')][_0xd7d5('0x25')],_0x4a4cb5);var _0x3e380b=_0x1dea83[_0xd7d5('0x1a')][_0xd7d5('0x1b')](',');_0x2945b1[_0xd7d5('0x1d')](_0x3e380b[0x0]);_0x2945b1['push'](_0x3e380b[0x1]);_0x2945b1[_0xd7d5('0x1d')](_0x3e380b[0x2]);_0x2945b1[_0xd7d5('0x1d')](_0x3e380b[0x3]);_0x2945b1['push'](_0x3e380b[0x4]);_0x2945b1[_0xd7d5('0x1d')](_0x3e380b[0x5]);_0x2945b1['push'](_0x3e380b[0x6]);_0x2945b1['push'](_0x3e380b[0x7]);_0x2945b1[_0xd7d5('0x1d')](_0x3e380b[0x8]);_0x2945b1[_0xd7d5('0x1d')](_0x3e380b[0x9]);_0x2945b1[_0xd7d5('0x1d')](_0x3e380b[0xa]);_0x2945b1[_0xd7d5('0x1d')](_0x4a4cb5['interaction']['id']);_0x2945b1[_0xd7d5('0x1d')](_0x4a4cb5['message']['id']);_0x2945b1[_0xd7d5('0x1d')](_0x1dea83['ChatWebsiteId']);_0x2945b1['push'](_0x4a4cb5['interaction']['ContactId']);_0x2945b1[_0xd7d5('0x1d')](_0x4a4cb5['body']['body']);_0x2945b1[_0xd7d5('0x1d')](_0x9dbe0c);break;default:_0x2945b1=_[_0xd7d5('0xd')](_0x1dea83[_0xd7d5('0x1a')])?[]:_0x1dea83['appdata'][_0xd7d5('0x1b')](',');}var _0x4af7e0={'id':util[_0xd7d5('0xb')](_0xd7d5('0x26'),_0x103aad,_0x1dea83['id'],_0x1dea83[_0xd7d5('0x27')]),'condition':require(_0xd7d5('0x28'))['condition'](_0x103aad,getIntervals(_0x12327e['intervals'],_0x1dea83),_0x12327e),'consequence':require('./applications/'+_0x1dea83[_0xd7d5('0x27')])[_0xd7d5('0x29')](_0x103aad,_0x2945b1,_0x12327e,_0x4a4cb5),'p':_0x1dea83['priority']||0x0};logger[_0xd7d5('0x2a')](_0xd7d5('0x2b'),_0x4af7e0['id'],_0xd7d5('0x2c'),getIntervals(_0x12327e[_0xd7d5('0x2d')],_0x1dea83)[_0xd7d5('0x17')]('\x20|\x20'));_0x25b1cb['push'](_0x4af7e0);}else{logger[_0xd7d5('0x2e')](_0xd7d5('0x2f'),path['join'](__dirname,'applications',_0x1dea83['app']+_0xd7d5('0x30')));}}_0x12327e[_0xd7d5('0x11')][_0x103aad]=new RuleEngine(_0x25b1cb);_0x12327e['rules'][_0x103aad]['execute'](_0x4a4cb5,function(_0x17aa45){logger['info'](_0xd7d5('0x31'),JSON['stringify'](_0x17aa45[_0xd7d5('0x32')]));if(_0x12327e[_0xd7d5('0x11')][_0x103aad]){_0x12327e[_0xd7d5('0x11')][_0x103aad]['emit'](_0xd7d5('0x33'));}});return _0x125302({'code':0xc8,'message':_0x4a4cb5});}else{if(_0xdc774c){logger[_0xd7d5('0x2a')](util['format'](_0xd7d5('0x34'),_0x103aad));}else{logger[_0xd7d5('0x2a')](_0xd7d5('0x35'));}return _0x125302({'code':0xc8,'message':_0x4a4cb5});}}catch(_0x57cbb0){logger[_0xd7d5('0x2e')](_0x57cbb0[_0xd7d5('0x36')]);return _0xe24a6(_0x4508f2['error'](0x1f4,_0x57cbb0));}}return _0xe24a6(_0xd7d5('0x37'));});},'AcceptMessage':function(_0x284c59){var _0x35a837=this;return new Promise(function(_0x3019ef,_0x2bd015){if(_0x284c59[_0xd7d5('0x38')]&&_0x284c59[_0xd7d5('0x38')]['id']){if(_0x12327e[_0xd7d5('0x39')][_0x284c59[_0xd7d5('0x38')]['id']]){_0x12327e['agents'][_0x284c59[_0xd7d5('0x38')]['id']][_0xd7d5('0x3a')]=![];_0x12327e[_0xd7d5('0x39')][_0x284c59[_0xd7d5('0x38')]['id']][_0xd7d5('0x3b')]=undefined;}}if(_0x284c59[_0xd7d5('0x13')]&&_0x284c59[_0xd7d5('0x13')]['id']){try{var _0x5624e4=getId(_0x284c59['channel'],_0x284c59['message']?_0x284c59[_0xd7d5('0x13')]['id']:0x0,_0x284c59[_0xd7d5('0x3c')]?_0x284c59[_0xd7d5('0x3c')]['id']:0x0);if(_0x12327e['rules'][_0x5624e4]){_0x12327e[_0xd7d5('0x11')][_0x5624e4][_0xd7d5('0x3d')]('end');if(rpc[_0x284c59[_0xd7d5('0x12')]+_0xd7d5('0x3e')]){rpc[_0x284c59[_0xd7d5('0x12')]+_0xd7d5('0x3e')][_0xd7d5('0x3f')](_0x5624e4,{'UserId':_0x284c59[_0xd7d5('0x13')][_0xd7d5('0x40')]})[_0xd7d5('0x41')](function(){logger['error'](_0xd7d5('0x42'));});}}return _0x3019ef({'code':0xc8,'message':_0x284c59});}catch(_0x19ff04){logger[_0xd7d5('0x2e')](_0x19ff04['stack']);return _0x2bd015(_0x35a837['error'](0x1f4,_0x19ff04));}}logger[_0xd7d5('0x2e')](_0xd7d5('0x43'));return _0x2bd015(_0x35a837[_0xd7d5('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xd1255c){var _0x4aaa1d=this;return new Promise(function(_0x4c07ed,_0x440cee){if(_0xd1255c['agent']&&_0xd1255c['agent']['id']){try{if(_0x12327e[_0xd7d5('0x39')][_0xd1255c[_0xd7d5('0x38')]['id']]){_0x12327e[_0xd7d5('0x39')][_0xd1255c[_0xd7d5('0x38')]['id']][_0xd7d5('0x3a')]=![];_0x12327e[_0xd7d5('0x39')][_0xd1255c[_0xd7d5('0x38')]['id']][_0xd7d5('0x3b')]=undefined;}return _0x4c07ed({'code':0xc8,'message':_0xd1255c});}catch(_0x4a9869){logger[_0xd7d5('0x2e')](_0x4a9869['stack']);return _0x440cee(_0x4aaa1d[_0xd7d5('0x2e')](0x1f4,_0x4a9869));}}logger[_0xd7d5('0x2e')]('message\x20is\x20empty');return _0x440cee(_0x4aaa1d[_0xd7d5('0x2e')](0x1f4,_0xd7d5('0x43')));});},'AbandonInteraction':function(_0x5041d3){var _0x3b57bf=this;return new Promise(function(_0x1bcf5a,_0x22b552){if(_0x5041d3[_0xd7d5('0x12')]&&_0x5041d3[_0xd7d5('0x3c')]&&_0x5041d3[_0xd7d5('0x3c')]['id']){try{var _0x592681=getId(_0x5041d3[_0xd7d5('0x12')],_0x5041d3[_0xd7d5('0x13')]?_0x5041d3[_0xd7d5('0x13')]['id']:0x0,_0x5041d3[_0xd7d5('0x3c')]?_0x5041d3[_0xd7d5('0x3c')]['id']:0x0);if(_0x12327e['rules'][_0x592681]){_0x12327e['rules'][_0x592681]['emit'](_0xd7d5('0x44'));}return _0x1bcf5a({'code':0xc8,'message':_0x5041d3});}catch(_0x232af9){logger[_0xd7d5('0x2e')](_0x232af9[_0xd7d5('0x36')]);return _0x22b552(_0x3b57bf[_0xd7d5('0x2e')](0x1f4,_0x232af9));}}logger[_0xd7d5('0x2e')](_0xd7d5('0x43'));return _0x22b552(_0x3b57bf[_0xd7d5('0x2e')](0x1f4,_0xd7d5('0x43')));});},'AgentCapacity':function(_0x1e73ff){var _0x33b08e=this;return new Promise(function(_0x11ba72,_0x390e4c){if(_0x12327e['agents']['hasOwnProperty'](_0x1e73ff['id'])){for(var _0x5fefd4 in _0x1e73ff[_0xd7d5('0x45')]){if(_0x1e73ff[_0xd7d5('0x45')][_0xd7d5('0x46')](_0x5fefd4)){if(_0x12327e['agents'][_0x1e73ff['id']][_0xd7d5('0x46')](_0x5fefd4+'CurrentCapacity')){_0x12327e[_0xd7d5('0x39')][_0x1e73ff['id']][_0x5fefd4+_0xd7d5('0x47')]=parseInt(_0x1e73ff[_0xd7d5('0x45')][_0x5fefd4],0xa);}}}_0x12327e[_0xd7d5('0x39')][_0x1e73ff['id']][_0xd7d5('0x48')]();return _0x11ba72({'code':0xc8,'message':_0x12327e['agents'][_0x1e73ff['id']]});}else{return _0x390e4c(_0x33b08e[_0xd7d5('0x2e')](0x1f4,_0xd7d5('0x49')));}});},'Agents':function(_0x28f827){return new Promise(function(_0x364d46){var _0x171229=_[_0xd7d5('0x4a')](_0x12327e[_0xd7d5('0x39')]);if(_0x28f827&&_0x28f827['id']){var _0x1e4753=_[_0xd7d5('0x4b')](_0x171229,function(_0x3a7238){return _0x3a7238['id']===_0x28f827['id'];});_0x364d46(_0x1e4753);}else{_0x364d46({'count':_0x171229[_0xd7d5('0x15')],'rows':_0x171229});}});},'ChatQueues':function(){return new Promise(function(_0x173435){var _0x2d5210=[];for(var _0x65e40a in _0x12327e['chatQueues']){if(_0x12327e[_0xd7d5('0x4c')][_0xd7d5('0x46')](_0x65e40a)){var _0x46ec99=_0x12327e[_0xd7d5('0x4c')][_0x65e40a];var _0x7039ec={'id':_0x46ec99['id'],'available':_0x46ec99[_0xd7d5('0x4d')],'loggedIn':_0x46ec99[_0xd7d5('0x4e')],'name':_0x46ec99['name'],'paused':_0x46ec99[_0xd7d5('0x4f')],'waiting':_0x46ec99[_0xd7d5('0x50')]};_0x2d5210[_0xd7d5('0x1d')](_0x7039ec);}}_0x173435({'count':_0x2d5210[_0xd7d5('0x15')],'rows':_0x2d5210});});},'MailQueues':function(){return new Promise(function(_0xb1cddb){var _0x3e2b5e=[];for(var _0x2a4e27 in _0x12327e[_0xd7d5('0x51')]){if(_0x12327e[_0xd7d5('0x51')][_0xd7d5('0x46')](_0x2a4e27)){var _0x7b4336=_0x12327e[_0xd7d5('0x51')][_0x2a4e27];var _0x5ad5c9={'id':_0x7b4336['id'],'available':_0x7b4336[_0xd7d5('0x4d')],'loggedIn':_0x7b4336[_0xd7d5('0x4e')],'name':_0x7b4336[_0xd7d5('0x52')],'paused':_0x7b4336['paused'],'waiting':_0x7b4336['waiting']};_0x3e2b5e[_0xd7d5('0x1d')](_0x5ad5c9);}}_0xb1cddb({'count':_0x3e2b5e[_0xd7d5('0x15')],'rows':_0x3e2b5e});});},'OpenchannelQueues':function(){return new Promise(function(_0x2284e3){var _0x1e328f=[];for(var _0x49fecd in _0x12327e['openchannelQueues']){if(_0x12327e[_0xd7d5('0x53')][_0xd7d5('0x46')](_0x49fecd)){var _0x40e666=_0x12327e[_0xd7d5('0x53')][_0x49fecd];var _0x43d62e={'id':_0x40e666['id'],'available':_0x40e666[_0xd7d5('0x4d')],'loggedIn':_0x40e666[_0xd7d5('0x4e')],'name':_0x40e666[_0xd7d5('0x52')],'paused':_0x40e666['paused'],'waiting':_0x40e666[_0xd7d5('0x50')]};_0x1e328f[_0xd7d5('0x1d')](_0x43d62e);}}_0x2284e3({'count':_0x1e328f['length'],'rows':_0x1e328f});});},'SmsQueues':function(){return new Promise(function(_0x4bf9d3){var _0x50fc7a=[];for(var _0x419e4e in _0x12327e[_0xd7d5('0x54')]){if(_0x12327e[_0xd7d5('0x54')]['hasOwnProperty'](_0x419e4e)){var _0x58873e=_0x12327e[_0xd7d5('0x54')][_0x419e4e];var _0x3da063={'id':_0x58873e['id'],'available':_0x58873e[_0xd7d5('0x4d')],'loggedIn':_0x58873e['loggedIn'],'name':_0x58873e[_0xd7d5('0x52')],'paused':_0x58873e[_0xd7d5('0x4f')],'waiting':_0x58873e['waiting']};_0x50fc7a[_0xd7d5('0x1d')](_0x3da063);}}_0x4bf9d3({'count':_0x50fc7a[_0xd7d5('0x15')],'rows':_0x50fc7a});});},'FaxQueues':function(){return new Promise(function(_0x365820){var _0x50e58f=[];for(var _0x4684bf in _0x12327e['faxQueues']){if(_0x12327e[_0xd7d5('0x55')]['hasOwnProperty'](_0x4684bf)){var _0x1d4d2c=_0x12327e[_0xd7d5('0x55')][_0x4684bf];var _0x107818={'id':_0x1d4d2c['id'],'available':_0x1d4d2c[_0xd7d5('0x4d')],'loggedIn':_0x1d4d2c[_0xd7d5('0x4e')],'name':_0x1d4d2c[_0xd7d5('0x52')],'paused':_0x1d4d2c['paused'],'waiting':_0x1d4d2c['waiting']};_0x50e58f[_0xd7d5('0x1d')](_0x107818);}}_0x365820({'count':_0x50e58f[_0xd7d5('0x15')],'rows':_0x50e58f});});},'WhatsappQueues':function(){return new Promise(function(_0x11a1a2){var _0x506dce=[];for(var _0x217bdb in _0x12327e[_0xd7d5('0x56')]){if(_0x12327e['whatsappQueues'][_0xd7d5('0x46')](_0x217bdb)){var _0x104651=_0x12327e[_0xd7d5('0x56')][_0x217bdb];var _0x439f8b={'id':_0x104651['id'],'available':_0x104651['available'],'loggedIn':_0x104651[_0xd7d5('0x4e')],'name':_0x104651[_0xd7d5('0x52')],'paused':_0x104651['paused'],'waiting':_0x104651[_0xd7d5('0x50')]};_0x506dce[_0xd7d5('0x1d')](_0x439f8b);}}_0x11a1a2({'count':_0x506dce['length'],'rows':_0x506dce});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3903be){var _0x2455df=_[_0xd7d5('0x4a')](_0x12327e[_0xd7d5('0x57')]);_0x3903be({'count':_0x2455df[_0xd7d5('0x15')],'rows':_0x2455df});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2ed71b){var _0x577882=_[_0xd7d5('0x4a')](_0x12327e[_0xd7d5('0x58')]);_0x2ed71b({'count':_0x577882[_0xd7d5('0x15')],'rows':_0x577882});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5929c8){var _0x1422c8=_[_0xd7d5('0x4a')](_0x12327e['openchannelQueuesWaitingInteractions']);_0x5929c8({'count':_0x1422c8[_0xd7d5('0x15')],'rows':_0x1422c8});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5f4690){var _0xbd1d39=_[_0xd7d5('0x4a')](_0x12327e[_0xd7d5('0x59')]);_0x5f4690({'count':_0xbd1d39['length'],'rows':_0xbd1d39});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x521ae5){var _0x34b697=_[_0xd7d5('0x4a')](_0x12327e[_0xd7d5('0x5a')]);_0x521ae5({'count':_0x34b697[_0xd7d5('0x15')],'rows':_0x34b697});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x313424){var _0x5bdabf=_[_0xd7d5('0x4a')](_0x12327e[_0xd7d5('0x5b')]);_0x313424({'count':_0x5bdabf[_0xd7d5('0x15')],'rows':_0x5bdabf});});}};var _0x47442b=jayson['server'](_0x237c1f)[_0xd7d5('0x5c')]();_0x47442b['on']('error',function(_0x2d0973){logger[_0xd7d5('0x2e')](JSON[_0xd7d5('0x5d')](_0x2d0973));return _0x3a01d9(_0x2d0973);});_0x47442b[_0xd7d5('0x5e')](0x232c,_0xd7d5('0x5f'),function(){console[_0xd7d5('0x60')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2c38f1(_0xd7d5('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 302826e..6e82a7e 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 _0x288b=['stop','some','info','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','routing','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x346f02,_0xd302cd){var _0x580e7c=function(_0x19f1d2){while(--_0x19f1d2){_0x346f02['push'](_0x346f02['shift']());}};_0x580e7c(++_0xd302cd);}(_0x288b,0x182));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb288('0x0'));var iftime=require('../../../utils/iftime')[_0xb288('0x1')];var logger=require('../../../config/logger')(_0xb288('0x2'));exports[_0xb288('0x3')]=function(_0x1dd9cf,_0x22abfe,_0x45b6ee){return function(_0xea5c3){if(_0x45b6ee[_0xb288('0x4')]&&!_0x45b6ee[_0xb288('0x4')][_0x1dd9cf]){logger['info'](_0xb288('0x5'),_0x1dd9cf);return _0xea5c3[_0xb288('0x6')]();}var _0x5a4df8=_0x22abfe['map'](function(_0x1129d2){return iftime(_0x1129d2);});var _0x59caa3=_[_0xb288('0x7')](_0x5a4df8);if(_0x59caa3){logger[_0xb288('0x8')](_0xb288('0x9'),_0x1dd9cf,_0x22abfe[_0xb288('0xa')](_0xb288('0xb')),_0x59caa3);_0xea5c3[_0xb288('0xc')](_0x59caa3);}else{logger[_0xb288('0x8')](_0xb288('0xd'),_0x1dd9cf,_0x22abfe[_0xb288('0xa')](_0xb288('0xb')));_0xea5c3[_0xb288('0x6')]();}};}; \ No newline at end of file +var _0xb973=['[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','../../../config/logger','condition','rules','info','stop','map','some'];(function(_0x4b4a7e,_0x2f8b44){var _0x1cd820=function(_0x1d2b60){while(--_0x1d2b60){_0x4b4a7e['push'](_0x4b4a7e['shift']());}};_0x1cd820(++_0x2f8b44);}(_0xb973,0xc9));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var iftime=require('../../../utils/iftime')[_0x3b97('0x1')];var logger=require(_0x3b97('0x2'))('routing');exports[_0x3b97('0x3')]=function(_0x241ff3,_0x2c918e,_0x41c084){return function(_0xbaee2c){if(_0x41c084[_0x3b97('0x4')]&&!_0x41c084[_0x3b97('0x4')][_0x241ff3]){logger[_0x3b97('0x5')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x241ff3);return _0xbaee2c[_0x3b97('0x6')]();}var _0x2f6a3e=_0x2c918e[_0x3b97('0x7')](function(_0x7e23b8){return iftime(_0x7e23b8);});var _0x27e67f=_[_0x3b97('0x8')](_0x2f6a3e);if(_0x27e67f){logger[_0x3b97('0x5')](_0x3b97('0x9'),_0x241ff3,_0x2c918e[_0x3b97('0xa')](_0x3b97('0xb')),_0x27e67f);_0xbaee2c[_0x3b97('0xc')](_0x27e67f);}else{logger[_0x3b97('0x5')](_0x3b97('0xd'),_0x241ff3,_0x2c918e[_0x3b97('0xa')](_0x3b97('0xb')));_0xbaee2c['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 41c8189..04ac9c5 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 _0xbfcc=['now','lastevent','called','connectedlinename','agentringnoanswer','isNil','debug','timeout','reason','holdtime','ringtime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','talktime','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','info','format','membername','interface','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','uniqueid'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xbfcc[_0x34021d];return _0x16597b;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1a2fe0,_0x2d1386){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1a2fe0['uniqueid'],_0x1a2fe0['channel'],_0x1a2fe0['queue'],_0x1a2fe0[_0xcbfc('0x3')],_0x1a2fe0[_0xcbfc('0x4')],_0x1a2fe0['calleridnum'],_0x1a2fe0[_0xcbfc('0x5')],_0x1a2fe0['lastevent']));if(_0x1a2fe0[_0xcbfc('0x6')]){utils[_0xcbfc('0x7')](_0x1a2fe0[_0xcbfc('0x6')])[_0xcbfc('0x8')](function(_0x4eff22){if(_0x4eff22){_0x1a2fe0[_0xcbfc('0x9')]=_0x4eff22[_0xcbfc('0x9')];_0x1a2fe0[_0xcbfc('0xa')]=_0x1a2fe0[_0xcbfc('0xb')]?_0x4eff22[_0xcbfc('0xc')]:![];_0x1a2fe0[_0xcbfc('0xd')]=_0x1a2fe0['agentacw']?_0x4eff22[_0xcbfc('0xe')]:0x0;}utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);});}else{utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);}if(_0x2d1386){delete transfers[_0x1a2fe0['uniqueid']];}else{delete agents[_0x1a2fe0[_0xcbfc('0x11')]];}}exports[_0xcbfc('0x12')]=function(_0x80d08d){try{utils['debug'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x80d08d);agents[_0x80d08d[_0xcbfc('0x11')]]=_0x80d08d;agents[_0x80d08d[_0xcbfc('0x11')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x16')]=_0xcbfc('0x17');agents[_0x80d08d['destuniqueid']]['connectedlinenum']=null;agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x18')]=null;utils[_0xcbfc('0x1')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x80d08d[_0xcbfc('0x14')],agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x80d08d['destuniqueid']));}catch(_0x3825d5){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x3825d5);}};exports[_0xcbfc('0x19')]=function(_0x25c167){try{if(!_[_0xcbfc('0x1a')](agents[_0x25c167['destuniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')]('[%s][agents][agentringnoanswer]',_0x25c167[_0xcbfc('0x14')]),_0x25c167);utils['info'](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x25c167[_0xcbfc('0x14')],agents[_0x25c167['destuniqueid']]['membername'],_0x25c167[_0xcbfc('0x11')]));agents[_0x25c167[_0xcbfc('0x11')]][_0xcbfc('0x19')]=!![];agents[_0x25c167[_0xcbfc('0x11')]]['agentringnoanswerAt']=utils[_0xcbfc('0x15')]();agents[_0x25c167['destuniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1d')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1e')]=_0x25c167[_0xcbfc('0x1f')]?parseInt(_0x25c167[_0xcbfc('0x1f')])/0x3e8:0x0;agents[_0x25c167[_0xcbfc('0x11')]]['talktime']=0x0;unanswered[_0xcbfc('0x20')](_0x25c167[_0xcbfc('0x11')]);}}catch(_0x4f632a){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x22'),_0x25c167[_0xcbfc('0x14')]),_0x4f632a);}};exports[_0xcbfc('0x23')]=function(_0x19d2e){try{_[_0xcbfc('0x24')](agents,function(_0x5366cf,_0x41b68b){if(_0x5366cf[_0xcbfc('0x14')]==_0x19d2e[_0xcbfc('0x14')]&&!_[_0xcbfc('0x25')](unanswered,_0x5366cf['destuniqueid'])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x19d2e);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x27'),_0x19d2e['uniqueid'],_0x5366cf[_0xcbfc('0x3')],_0x5366cf[_0xcbfc('0x11')]));_0x5366cf['agentringnoanswer']=!![];_0x5366cf[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x5366cf[_0xcbfc('0x16')]='abandoned';_0x5366cf['reason']='abandoned';_0x5366cf[_0xcbfc('0x1e')]=_0x19d2e[_0xcbfc('0x1e')];_0x5366cf[_0xcbfc('0x29')]=0x0;writeDB(_0x5366cf);}});}catch(_0x9c1ff3){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x9c1ff3);}};exports['agentconnect']=function(_0x2f14ff){try{if(agents[_0x2f14ff[_0xcbfc('0x11')]]){utils['debug'](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]',_0x2f14ff[_0xcbfc('0x14')]),_0x2f14ff);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f14ff[_0xcbfc('0x14')],agents[_0x2f14ff['destuniqueid']]['membername'],_0x2f14ff[_0xcbfc('0x11')]));agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x5')]=_0x2f14ff[_0xcbfc('0x5')];agents[_0x2f14ff[_0xcbfc('0x11')]]['connectedlinename']=_0x2f14ff[_0xcbfc('0x18')];agents[_0x2f14ff['destuniqueid']][_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x16')]='connect';_['forIn'](agents,function(_0x236b66,_0x1c678b){if(_0x236b66[_0xcbfc('0x11')]!=_0x2f14ff[_0xcbfc('0x11')]&&_0x236b66[_0xcbfc('0x14')]==_0x2f14ff['uniqueid']){_0x236b66[_0xcbfc('0x29')]=0x0;_0x236b66[_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];_0x236b66['agentringnoanswer']=!![];_0x236b66[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x236b66[_0xcbfc('0x16')]='answered_elsewhere';_0x236b66[_0xcbfc('0x1d')]=_0xcbfc('0x2b');_0x236b66[_0xcbfc('0x2c')]=_0x2f14ff[_0xcbfc('0x11')];_0x236b66[_0xcbfc('0x2d')]=_0x2f14ff[_0xcbfc('0x3')];writeDB(_0x236b66);}});}}catch(_0x1e14bb){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x2e'),_0x2f14ff['uniqueid']),_0x1e14bb);}};exports[_0xcbfc('0xb')]=function(_0x50a01c){try{if(!_[_0xcbfc('0x1a')](agents[_0x50a01c[_0xcbfc('0x11')]])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x2f'),_0x50a01c[_0xcbfc('0x14')]),_0x50a01c);utils['info'](util[_0xcbfc('0x2')](_0xcbfc('0x30'),_0x50a01c[_0xcbfc('0x14')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x50a01c[_0xcbfc('0x11')]));agents[_0x50a01c[_0xcbfc('0x11')]]['agentcomplete']=!![];agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x31')]=utils['now']();agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x50a01c['destuniqueid']][_0xcbfc('0x31')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x2a')]);agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x1d')]=_0x50a01c[_0xcbfc('0x1d')];agents[_0x50a01c[_0xcbfc('0x11')]]['lastevent']='complete';writeDB(agents[_0x50a01c[_0xcbfc('0x11')]]);}}catch(_0x94398c){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')]('[%s][agents][agentcomplete]',_0x50a01c['uniqueid']),_0x94398c);}};exports[_0xcbfc('0x33')]=function(_0xe5c5ef){try{if(!_[_0xcbfc('0x1a')](agents[_0xe5c5ef['transfereruniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x34'),_0xe5c5ef['uniqueid']),_0xe5c5ef);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x35'),_0xe5c5ef[_0xcbfc('0x14')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x3')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')]));agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x37')]=!![];agents[_0xe5c5ef['transfereruniqueid']][_0xcbfc('0x38')]=_0xcbfc('0x39');agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferexten']=_0xe5c5ef[_0xcbfc('0x3a')];agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferuniqueid']=agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')];}}catch(_0x38db76){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x34'),_0xe5c5ef[_0xcbfc('0x14')]),_0x38db76);}};exports['attendedtransfer']=function(_0x2fe240){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x3b'),_0x2fe240[_0xcbfc('0x3c')]),_0x2fe240);if(_0x2fe240[_0xcbfc('0x3c')]==_0x2fe240[_0xcbfc('0x3d')]){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3e')]])){utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x3f'),_0x2fe240['origtransfereruniqueid'],agents[_0x2fe240['secondtransfereruniqueid']]['membername']));agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x42')];agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3c')];}if(_0x2fe240[_0xcbfc('0x44')]&&agents[_0x2fe240['transfereeuniqueid']]){agents[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x45')]=0x1;transfers[_0x2fe240[_0xcbfc('0x44')]]=_[_0xcbfc('0x46')](agents[_0x2fe240[_0xcbfc('0x44')]]);transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x47')]=agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x47')];transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x48')]=agents[_0x2fe240[_0xcbfc('0x3e')]]['calleridname'];transfers[_0x2fe240[_0xcbfc('0x44')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x45')]=0x2;}}else if(_0x2fe240[_0xcbfc('0x3e')]==_0x2fe240['secondtransfererlinkedid']){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3c')]])){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x3f'),_0x2fe240[_0xcbfc('0x3c')],agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x3')]));agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x49')];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3e')];}if(_0x2fe240['transfertargetuniqueid']&&agents[_0x2fe240[_0xcbfc('0x4a')]]){agents[_0x2fe240[_0xcbfc('0x4a')]]['agententerreason']=0x1;transfers[_0x2fe240[_0xcbfc('0x4a')]]=_['clone'](agents[_0x2fe240['transfertargetuniqueid']]);transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x47')]=agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x47')];transfers[_0x2fe240[_0xcbfc('0x4a')]]['calleridname']=agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x48')];transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x4b')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]]['agentconnectAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4c3d4d){utils[_0xcbfc('0x21')](util['format']('[%s][agents][attendedtransfer]',_0x2fe240[_0xcbfc('0x3c')]),_0x4c3d4d);}};exports['hangup']=function(_0x99068f){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x99068f);if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]===_0xcbfc('0x1c')){if(_0x99068f['cause']==='21'){agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x4d');agents[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x4d');}utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x4e'),_0x99068f[_0xcbfc('0x14')],agents[_0x99068f[_0xcbfc('0x14')]]['membername'],agents[_0x99068f[_0xcbfc('0x14')]]['reason'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);var _0x51019a=unanswered[_0xcbfc('0x4f')](_0x99068f['uniqueid']);if(_0x51019a>-0x1){unanswered[_0xcbfc('0x50')](_0x51019a,0x1);}}if(transfers[_0x99068f[_0xcbfc('0x14')]]){transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0xb')]=!![];transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();transfers[_0x99068f['uniqueid']][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](transfers[_0x99068f[_0xcbfc('0x14')]]['agentcompleteAt'],transfers[_0x99068f[_0xcbfc('0x14')]]['agentconnectAt']);transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x51');transfers[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x52');utils['info'](util[_0xcbfc('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x99068f[_0xcbfc('0x14')],transfers[_0x99068f['uniqueid']][_0xcbfc('0x3')],transfers[_0x99068f[_0xcbfc('0x14')]]['reason'],transfers[_0x99068f[_0xcbfc('0x14')]]['lastevent']));writeDB(transfers[_0x99068f[_0xcbfc('0x14')]],!![]);}if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]){agents[_0x99068f['uniqueid']][_0xcbfc('0xb')]=!![];agents[_0x99068f['uniqueid']][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]);agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x37')]?_0xcbfc('0x37'):_0xcbfc('0x51');agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]='complete';utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x4e'),_0x99068f['uniqueid'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x3')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);}}catch(_0x4f38cb){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x4f38cb);}}; \ No newline at end of file +var _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x3f8766,_0x558df8){var _0x2be85d=function(_0x329fa6){while(--_0x329fa6){_0x3f8766['push'](_0x3f8766['shift']());}};_0x2be85d(++_0x558df8);}(_0xe706,0xa3));var _0x6e70=function(_0x26b1b8,_0x35bfd4){_0x26b1b8=_0x26b1b8-0x0;var _0x401762=_0xe706[_0x26b1b8];return _0x401762;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9bef7f9..8b52d1a 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 _0x4581=['[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','cdr','appdata','substring','lastIndexOf','includes','noop','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','[%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','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','billableseconds','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0x4581,0x1bd));var _0x1458=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4581[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1458('0x0'));var util=require(_0x1458('0x1'));var utils=require('./utils');var dispositions=[_0x1458('0x2'),_0x1458('0x3'),_0x1458('0x3'),_0x1458('0x2'),'NO\x20ANSWER',_0x1458('0x2'),_0x1458('0x4'),_0x1458('0x5'),_0x1458('0x3'),_0x1458('0x3'),_0x1458('0x3')];var channels={};function writeDB(_0x46a42b){utils[_0x1458('0x6')](util[_0x1458('0x7')](_0x1458('0x8'),_0x46a42b[_0x1458('0x9')],_0x46a42b[_0x1458('0xa')],_0x46a42b[_0x1458('0xb')],_0x46a42b[_0x1458('0xc')],_0x46a42b[_0x1458('0xd')],_0x46a42b[_0x1458('0xe')],_0x46a42b['connectedlinenum'],_0x46a42b['lastevent']));if(_0x46a42b[_0x1458('0xf')]){utils['getUserByInternal'](_0x46a42b[_0x1458('0xf')])[_0x1458('0x10')](function(_0x201e75){if(_0x201e75){_0x46a42b[_0x1458('0x11')]=_0x201e75['id'];}utils[_0x1458('0x12')](_0x1458('0x13'),_0x46a42b);});}else{utils['request'](_0x1458('0x13'),_0x46a42b);}if(channels[_0x46a42b[_0x1458('0x9')]]){delete channels[_0x46a42b[_0x1458('0x9')]];}}exports[_0x1458('0x14')]=function(_0x27fbd3){try{utils[_0x1458('0x15')](util['format'](_0x1458('0x16'),_0x27fbd3[_0x1458('0x9')]),_0x27fbd3);if(_0x27fbd3[_0x1458('0x9')]==_0x27fbd3[_0x1458('0x17')]&&_0x27fbd3[_0x1458('0xa')]!=_0x1458('0x18')){utils[_0x1458('0x6')](util[_0x1458('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x27fbd3[_0x1458('0x9')],_0x27fbd3[_0x1458('0x19')],_0x27fbd3[_0x1458('0x1a')]));channels[_0x27fbd3['uniqueid']]={'uniqueid':_0x27fbd3[_0x1458('0x9')],'accountcode':_0x27fbd3[_0x1458('0xf')],'source':_0x27fbd3[_0x1458('0xe')],'destination':_0x27fbd3['exten'],'destinationcontext':_0x27fbd3[_0x1458('0x19')],'channel':_0x27fbd3[_0x1458('0xa')],'starttime':utils[_0x1458('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1458('0x2'),'amaflags':_0x1458('0x1c')};}}catch(_0x3ecf9a){utils[_0x1458('0x1d')](util[_0x1458('0x7')](_0x1458('0x16'),_0x27fbd3['uniqueid']),_0x3ecf9a);}};exports['newstate']=function(_0x2e2d49){try{utils[_0x1458('0x15')](util[_0x1458('0x7')](_0x1458('0x1e'),_0x2e2d49[_0x1458('0x9')]),_0x2e2d49);if(!_[_0x1458('0x1f')](channels[_0x2e2d49[_0x1458('0x9')]])&&_0x2e2d49[_0x1458('0x20')]==0x6){utils[_0x1458('0x6')](util['format'](_0x1458('0x21'),_0x2e2d49[_0x1458('0x9')],_0x2e2d49[_0x1458('0x19')],_0x2e2d49[_0x1458('0xa')]));if(_[_0x1458('0x1f')](channels[_0x2e2d49[_0x1458('0x9')]][_0x1458('0x22')])){channels[_0x2e2d49[_0x1458('0x9')]][_0x1458('0x22')]=utils['now']();}}else if(!_[_0x1458('0x1f')](channels[_0x2e2d49[_0x1458('0x17')]])&&_0x2e2d49[_0x1458('0x20')]==0x6&&_0x2e2d49[_0x1458('0x19')]!=_0x1458('0x23')){utils[_0x1458('0x6')](util[_0x1458('0x7')](_0x1458('0x24'),_0x2e2d49[_0x1458('0x9')],_0x2e2d49[_0x1458('0x17')],_0x2e2d49['context'],_0x2e2d49['channel']));channels[_0x2e2d49[_0x1458('0x17')]][_0x1458('0xf')]=_0x2e2d49['accountcode'];channels[_0x2e2d49[_0x1458('0x17')]][_0x1458('0x25')]=_0x2e2d49[_0x1458('0xa')];if(_[_0x1458('0x1f')](channels[_0x2e2d49[_0x1458('0x17')]][_0x1458('0x26')])){channels[_0x2e2d49[_0x1458('0x17')]][_0x1458('0x26')]=utils[_0x1458('0x1b')]();}channels[_0x2e2d49['linkedid']][_0x1458('0x27')]=dispositions[_[_0x1458('0x28')](_0x2e2d49[_0x1458('0x20')])]||_0x1458('0x4');}}catch(_0x3953d2){utils['error'](util[_0x1458('0x7')](_0x1458('0x1e'),_0x2e2d49['uniqueid']),_0x3953d2);}};exports[_0x1458('0x29')]=function(_0x97e235){try{if(!_[_0x1458('0x1f')](channels[_0x97e235[_0x1458('0x9')]])){utils[_0x1458('0x15')](util[_0x1458('0x7')]('[%s][calls][hangup]',_0x97e235[_0x1458('0x9')]),_0x97e235);if(_[_0x1458('0x1f')](channels[_0x97e235['uniqueid']][_0x1458('0x2a')])){channels[_0x97e235[_0x1458('0x9')]][_0x1458('0x2a')]=_0x97e235[_0x1458('0x2b')]+'\x20<'+_0x97e235[_0x1458('0xe')]+'>';}utils[_0x1458('0x6')](util[_0x1458('0x7')](_0x1458('0x2c'),_0x97e235[_0x1458('0x9')],channels[_0x97e235['uniqueid']][_0x1458('0x2a')],_0x97e235[_0x1458('0x2d')]));channels[_0x97e235[_0x1458('0x9')]]['endtime']=utils[_0x1458('0x1b')]();channels[_0x97e235['uniqueid']]['duration']=utils[_0x1458('0x2e')](channels[_0x97e235['uniqueid']]['endtime'],channels[_0x97e235['uniqueid']]['starttime']);channels[_0x97e235[_0x1458('0x9')]][_0x1458('0x2f')]=channels[_0x97e235[_0x1458('0x9')]][_0x1458('0x26')]?utils['diffTime'](channels[_0x97e235['uniqueid']]['endtime'],channels[_0x97e235['uniqueid']][_0x1458('0x26')]):0x0;writeDB(channels[_0x97e235[_0x1458('0x9')]]);}}catch(_0x453a2b){utils['error'](util['format'](_0x1458('0x30'),_0x97e235[_0x1458('0x9')]),_0x453a2b);}};exports[_0x1458('0x31')]=function(_0x3e9e0a){try{if(!_['isNil'](channels[_0x3e9e0a['localtwolinkedid']])){utils[_0x1458('0x15')](util[_0x1458('0x7')](_0x1458('0x32'),_0x3e9e0a[_0x1458('0x33')]),_0x3e9e0a);if(channels[_0x3e9e0a['localtwolinkedid']][_0x1458('0xa')]==_0x3e9e0a[_0x1458('0x34')]){utils[_0x1458('0x6')](util[_0x1458('0x7')](_0x1458('0x35'),_0x3e9e0a[_0x1458('0x33')],_0x3e9e0a[_0x1458('0x36')],_0x3e9e0a['secondtransfererchannel']));channels[_0x3e9e0a[_0x1458('0x36')]][_0x1458('0x25')]=_0x3e9e0a['secondtransfererchannel'];channels[_0x3e9e0a[_0x1458('0x36')]]['userfield']=_0x1458('0x37');}else if(channels[_0x3e9e0a[_0x1458('0x36')]][_0x1458('0xa')]=_0x3e9e0a['transfertargetchannel']){utils['info'](util['format'](_0x1458('0x35'),_0x3e9e0a[_0x1458('0x33')],_0x3e9e0a[_0x1458('0x36')],_0x3e9e0a[_0x1458('0x38')]));channels[_0x3e9e0a[_0x1458('0x36')]][_0x1458('0x25')]=_0x3e9e0a['origtransfererchannel'];channels[_0x3e9e0a[_0x1458('0x36')]][_0x1458('0x39')]='_attended';}}}catch(_0x4c85ca){utils[_0x1458('0x1d')](util['format'](_0x1458('0x32'),_0x3e9e0a[_0x1458('0x33')]),_0x4c85ca);}};exports[_0x1458('0x3a')]=function(_0x3a0116){try{if(!_[_0x1458('0x1f')](channels[_0x3a0116[_0x1458('0x9')]])){utils['debug'](util[_0x1458('0x7')](_0x1458('0x3b'),_0x3a0116[_0x1458('0x9')]),_0x3a0116);channels[_0x3a0116[_0x1458('0x9')]][_0x1458('0x3c')]=utils[_0x1458('0x1b')]();utils['info'](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3a0116[_0x1458('0x9')],channels[_0x3a0116[_0x1458('0x9')]][_0x1458('0x3c')]));}}catch(_0x3190e8){utils['error'](util[_0x1458('0x7')](_0x1458('0x3b'),_0x3a0116[_0x1458('0x9')]),_0x3190e8);}};exports[_0x1458('0x3d')]=function(_0x22b671){try{if(!_[_0x1458('0x1f')](channels[_0x22b671[_0x1458('0x9')]])){utils[_0x1458('0x15')](util[_0x1458('0x7')](_0x1458('0x3e'),_0x22b671['uniqueid']),_0x22b671);if(!_[_0x1458('0x1f')](channels[_0x22b671[_0x1458('0x9')]]['musiconholdstartAt'])){channels[_0x22b671[_0x1458('0x9')]][_0x1458('0x3f')]+=utils[_0x1458('0x2e')](utils['now'](),channels[_0x22b671[_0x1458('0x9')]][_0x1458('0x3c')]);utils[_0x1458('0x6')](util[_0x1458('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x22b671['uniqueid'],channels[_0x22b671['uniqueid']][_0x1458('0x3f')]));delete channels[_0x22b671[_0x1458('0x9')]]['musiconholdstartAt'];}}}catch(_0x51e311){utils[_0x1458('0x1d')](util[_0x1458('0x7')](_0x1458('0x3e'),_0x22b671[_0x1458('0x9')]),_0x51e311);}};exports['varset']=function(_0x29dada){try{if(!_[_0x1458('0x1f')](channels[_0x29dada[_0x1458('0x9')]])){utils[_0x1458('0x15')](util[_0x1458('0x7')](_0x1458('0x40'),_0x29dada[_0x1458('0x9')]),_0x29dada);if(!_['isNil'](_0x29dada['variable']['xmd-originatecalleridnum'])){utils['info'](util[_0x1458('0x7')](_0x1458('0x41'),_0x29dada[_0x1458('0x9')],_0x29dada[_0x1458('0x42')]));channels[_0x29dada['uniqueid']][_0x1458('0x43')]=_0x29dada[_0x1458('0x42')];}if(!_[_0x1458('0x1f')](_0x29dada[_0x1458('0x44')][_0x1458('0x45')])){utils[_0x1458('0x6')](util[_0x1458('0x7')](_0x1458('0x46'),_0x29dada[_0x1458('0x9')],_0x29dada[_0x1458('0x42')]));channels[_0x29dada[_0x1458('0x9')]][_0x1458('0x47')]=_0x29dada[_0x1458('0x42')];channels[_0x29dada[_0x1458('0x9')]]['callerid']='\x22'+_0x29dada[_0x1458('0x42')]+_0x1458('0x48')+_0x29dada[_0x1458('0x42')]+'>';}if(!_[_0x1458('0x1f')](_0x29dada['variable'][_0x1458('0x49')])||!_[_0x1458('0x1f')](_0x29dada['variable']['xmd-callerid'])){utils[_0x1458('0x6')](util['format'](_0x1458('0x4a'),_0x29dada[_0x1458('0x9')],!_['isNil'](_0x29dada[_0x1458('0x44')][_0x1458('0x49')])?'xmd-callerid-preview':_0x1458('0x4b'),_0x29dada[_0x1458('0x42')]));channels[_0x29dada[_0x1458('0x9')]]['callerid']=_0x29dada[_0x1458('0x42')];}if(!_[_0x1458('0x1f')](_0x29dada['variable']['xmd-queue'])||!_['isNil'](_0x29dada[_0x1458('0x44')][_0x1458('0x4c')])){utils[_0x1458('0x6')](util['format'](_0x1458('0x4a'),_0x29dada[_0x1458('0x9')],!_[_0x1458('0x1f')](_0x29dada[_0x1458('0x44')][_0x1458('0x4d')])?_0x1458('0x4d'):_0x1458('0x4c'),_0x29dada[_0x1458('0x42')]));channels[_0x29dada[_0x1458('0x9')]][_0x1458('0x4e')]=_0x1458('0x4f');channels[_0x29dada[_0x1458('0x9')]][_0x1458('0x50')]=_0x29dada[_0x1458('0x42')];channels[_0x29dada[_0x1458('0x9')]][_0x1458('0xb')]=!![];}if(!_['isNil'](_0x29dada[_0x1458('0x44')]['xmd-contactid'])){utils[_0x1458('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x29dada[_0x1458('0x9')],_0x29dada[_0x1458('0x42')]));channels[_0x29dada[_0x1458('0x9')]][_0x1458('0x51')]=_0x29dada[_0x1458('0x42')];}if(!_[_0x1458('0x1f')](_0x29dada[_0x1458('0x44')][_0x1458('0x52')])){utils[_0x1458('0x6')](util[_0x1458('0x7')](_0x1458('0x53'),_0x29dada['uniqueid'],_0x29dada[_0x1458('0x42')]));channels[_0x29dada['uniqueid']][_0x1458('0x54')]=_0x29dada['value'];}if(!_['isNil'](_0x29dada[_0x1458('0x44')][_0x1458('0x55')])){utils['info'](util[_0x1458('0x7')](_0x1458('0x56'),_0x29dada['uniqueid'],_0x29dada['value']));channels[_0x29dada['uniqueid']][_0x1458('0x57')]=_0x29dada[_0x1458('0x42')];}if(!_[_0x1458('0x1f')](_0x29dada['variable'][_0x1458('0x58')])){utils[_0x1458('0x6')](util[_0x1458('0x7')](_0x1458('0x59'),_0x29dada[_0x1458('0x9')],_0x29dada['value']));channels[_0x29dada[_0x1458('0x9')]][_0x1458('0x58')]=_0x29dada['value'];}}}catch(_0x1d7de1){utils[_0x1458('0x1d')](util['format'](_0x1458('0x40'),_0x29dada[_0x1458('0x9')]),_0x1d7de1);}};exports[_0x1458('0x5a')]=function(_0x1ab1cd){try{if(!_[_0x1458('0x1f')](channels[_0x1ab1cd[_0x1458('0x9')]])){utils[_0x1458('0x15')](util[_0x1458('0x7')](_0x1458('0x5b'),_0x1ab1cd[_0x1458('0x9')]),_0x1ab1cd);utils['info'](util[_0x1458('0x7')](_0x1458('0x5c'),_0x1ab1cd[_0x1458('0x9')],_0x1ab1cd['application'],_0x1ab1cd['appdata']));if(_0x1ab1cd[_0x1458('0x5d')][_0x1458('0x5e')]()==_0x1458('0x5f')&&_['startsWith'](_0x1ab1cd['appdata'][_0x1458('0x5e')](),_0x1458('0x60'))){var _0x10ca9b=_0x1ab1cd[_0x1458('0x61')]['split']('=');var _0x25fa91=_0x10ca9b[0x0][_0x1458('0x62')](_0x10ca9b[0x0][_0x1458('0x63')]('(')+0x1,_0x10ca9b[0x0]['lastIndexOf'](')'));var _0x2c7913=_0x10ca9b[0x1];channels[_0x1ab1cd['uniqueid']][_0x25fa91]=_0x2c7913;}if(!_[_0x1458('0x64')]([_0x1458('0x29'),_0x1458('0x65'),'execif','set','gotoif'],_0x1ab1cd[_0x1458('0x5d')][_0x1458('0x5e')]())){channels[_0x1ab1cd['uniqueid']][_0x1458('0x4e')]=_0x1ab1cd[_0x1458('0x5d')];channels[_0x1ab1cd['uniqueid']][_0x1458('0x50')]=_0x1ab1cd[_0x1458('0x61')];}}}catch(_0x7933ec){utils[_0x1458('0x1d')](util[_0x1458('0x7')](_0x1458('0x5b'),_0x1ab1cd[_0x1458('0x9')]),_0x7933ec);}}; \ No newline at end of file +var _0xa017=['ANSWERED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','NO\x20ANSWER','FAILED'];(function(_0x42322c,_0x4f81d1){var _0x5a3b62=function(_0x5b49fa){while(--_0x5b49fa){_0x42322c['push'](_0x42322c['shift']());}};_0x5a3b62(++_0x4f81d1);}(_0xa017,0xd4));var _0x7a01=function(_0xd34208,_0x26345a){_0xd34208=_0xd34208-0x0;var _0x1a1991=_0xa017[_0xd34208];return _0x1a1991;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var utils=require('./utils');var dispositions=[_0x7a01('0x2'),_0x7a01('0x3'),_0x7a01('0x3'),_0x7a01('0x2'),_0x7a01('0x2'),_0x7a01('0x2'),_0x7a01('0x4'),'BUSY',_0x7a01('0x3'),'FAILED',_0x7a01('0x3')];var channels={};function writeDB(_0x5e999c){utils[_0x7a01('0x5')](util['format'](_0x7a01('0x6'),_0x5e999c[_0x7a01('0x7')],_0x5e999c[_0x7a01('0x8')],_0x5e999c[_0x7a01('0x9')],_0x5e999c[_0x7a01('0xa')],_0x5e999c['interface'],_0x5e999c[_0x7a01('0xb')],_0x5e999c[_0x7a01('0xc')],_0x5e999c['lastevent']));if(_0x5e999c[_0x7a01('0xd')]){utils[_0x7a01('0xe')](_0x5e999c[_0x7a01('0xd')])[_0x7a01('0xf')](function(_0xc48d98){if(_0xc48d98){_0x5e999c[_0x7a01('0x10')]=_0xc48d98['id'];}utils[_0x7a01('0x11')](_0x7a01('0x12'),_0x5e999c);});}else{utils['request'](_0x7a01('0x12'),_0x5e999c);}if(channels[_0x5e999c[_0x7a01('0x7')]]){delete channels[_0x5e999c['uniqueid']];}}exports[_0x7a01('0x13')]=function(_0xe49fe1){try{utils[_0x7a01('0x14')](util['format'](_0x7a01('0x15'),_0xe49fe1['uniqueid']),_0xe49fe1);if(_0xe49fe1['uniqueid']==_0xe49fe1[_0x7a01('0x16')]&&_0xe49fe1['channel']!=_0x7a01('0x17')){utils[_0x7a01('0x5')](util[_0x7a01('0x18')](_0x7a01('0x19'),_0xe49fe1[_0x7a01('0x7')],_0xe49fe1['context'],_0xe49fe1[_0x7a01('0x1a')]));channels[_0xe49fe1[_0x7a01('0x7')]]={'uniqueid':_0xe49fe1['uniqueid'],'accountcode':_0xe49fe1[_0x7a01('0xd')],'source':_0xe49fe1['calleridnum'],'destination':_0xe49fe1[_0x7a01('0x1a')],'destinationcontext':_0xe49fe1[_0x7a01('0x1b')],'channel':_0xe49fe1[_0x7a01('0x8')],'starttime':utils[_0x7a01('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x7a01('0x1d')};}}catch(_0x3aeb18){utils[_0x7a01('0x1e')](util[_0x7a01('0x18')]('[%s][calls][newchannel]',_0xe49fe1[_0x7a01('0x7')]),_0x3aeb18);}};exports[_0x7a01('0x1f')]=function(_0x148a2c){try{utils[_0x7a01('0x14')](util[_0x7a01('0x18')](_0x7a01('0x20'),_0x148a2c[_0x7a01('0x7')]),_0x148a2c);if(!_['isNil'](channels[_0x148a2c[_0x7a01('0x7')]])&&_0x148a2c[_0x7a01('0x21')]==0x6){utils['info'](util['format'](_0x7a01('0x22'),_0x148a2c[_0x7a01('0x7')],_0x148a2c['context'],_0x148a2c[_0x7a01('0x8')]));if(_[_0x7a01('0x23')](channels[_0x148a2c[_0x7a01('0x7')]][_0x7a01('0x24')])){channels[_0x148a2c[_0x7a01('0x7')]][_0x7a01('0x24')]=utils[_0x7a01('0x1c')]();}}else if(!_['isNil'](channels[_0x148a2c[_0x7a01('0x16')]])&&_0x148a2c[_0x7a01('0x21')]==0x6&&_0x148a2c['context']!=_0x7a01('0x25')){utils[_0x7a01('0x5')](util[_0x7a01('0x18')](_0x7a01('0x26'),_0x148a2c['uniqueid'],_0x148a2c[_0x7a01('0x16')],_0x148a2c[_0x7a01('0x1b')],_0x148a2c[_0x7a01('0x8')]));channels[_0x148a2c['linkedid']][_0x7a01('0xd')]=_0x148a2c[_0x7a01('0xd')];channels[_0x148a2c[_0x7a01('0x16')]][_0x7a01('0x27')]=_0x148a2c['channel'];if(_[_0x7a01('0x23')](channels[_0x148a2c['linkedid']][_0x7a01('0x28')])){channels[_0x148a2c[_0x7a01('0x16')]]['answertime']=utils['now']();}channels[_0x148a2c['linkedid']]['disposition']=dispositions[_[_0x7a01('0x29')](_0x148a2c[_0x7a01('0x21')])]||'ANSWERED';}}catch(_0x37f9f2){utils['error'](util[_0x7a01('0x18')]('[%s][calls][newstate]',_0x148a2c[_0x7a01('0x7')]),_0x37f9f2);}};exports[_0x7a01('0x2a')]=function(_0x38281b){try{if(!_['isNil'](channels[_0x38281b[_0x7a01('0x7')]])){utils[_0x7a01('0x14')](util[_0x7a01('0x18')](_0x7a01('0x2b'),_0x38281b[_0x7a01('0x7')]),_0x38281b);if(_[_0x7a01('0x23')](channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x2c')])){channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x2c')]=_0x38281b['calleridname']+'\x20<'+_0x38281b[_0x7a01('0xb')]+'>';}utils[_0x7a01('0x5')](util[_0x7a01('0x18')](_0x7a01('0x2d'),_0x38281b[_0x7a01('0x7')],channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x2c')],_0x38281b[_0x7a01('0x2e')]));channels[_0x38281b['uniqueid']]['endtime']=utils[_0x7a01('0x1c')]();channels[_0x38281b['uniqueid']][_0x7a01('0x2f')]=utils[_0x7a01('0x30')](channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x31')],channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x32')]);channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x33')]=channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x28')]?utils[_0x7a01('0x30')](channels[_0x38281b['uniqueid']][_0x7a01('0x31')],channels[_0x38281b[_0x7a01('0x7')]][_0x7a01('0x28')]):0x0;writeDB(channels[_0x38281b['uniqueid']]);}}catch(_0x5a326c){utils[_0x7a01('0x1e')](util[_0x7a01('0x18')](_0x7a01('0x2b'),_0x38281b[_0x7a01('0x7')]),_0x5a326c);}};exports[_0x7a01('0x34')]=function(_0x53f269){try{if(!_[_0x7a01('0x23')](channels[_0x53f269[_0x7a01('0x35')]])){utils['debug'](util[_0x7a01('0x18')](_0x7a01('0x36'),_0x53f269[_0x7a01('0x37')]),_0x53f269);if(channels[_0x53f269['localtwolinkedid']][_0x7a01('0x8')]==_0x53f269['transfereechannel']){utils[_0x7a01('0x5')](util[_0x7a01('0x18')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x53f269[_0x7a01('0x37')],_0x53f269[_0x7a01('0x35')],_0x53f269['secondtransfererchannel']));channels[_0x53f269[_0x7a01('0x35')]][_0x7a01('0x27')]=_0x53f269[_0x7a01('0x38')];channels[_0x53f269[_0x7a01('0x35')]][_0x7a01('0x39')]=_0x7a01('0x3a');}else if(channels[_0x53f269[_0x7a01('0x35')]][_0x7a01('0x8')]=_0x53f269[_0x7a01('0x3b')]){utils['info'](util[_0x7a01('0x18')](_0x7a01('0x3c'),_0x53f269[_0x7a01('0x37')],_0x53f269[_0x7a01('0x35')],_0x53f269['origtransfererchannel']));channels[_0x53f269[_0x7a01('0x35')]][_0x7a01('0x27')]=_0x53f269['origtransfererchannel'];channels[_0x53f269['localtwolinkedid']][_0x7a01('0x39')]=_0x7a01('0x3a');}}}catch(_0x318962){utils[_0x7a01('0x1e')](util[_0x7a01('0x18')](_0x7a01('0x36'),_0x53f269[_0x7a01('0x37')]),_0x318962);}};exports[_0x7a01('0x3d')]=function(_0x47e52b){try{if(!_[_0x7a01('0x23')](channels[_0x47e52b[_0x7a01('0x7')]])){utils[_0x7a01('0x14')](util[_0x7a01('0x18')](_0x7a01('0x3e'),_0x47e52b[_0x7a01('0x7')]),_0x47e52b);channels[_0x47e52b['uniqueid']][_0x7a01('0x3f')]=utils[_0x7a01('0x1c')]();utils[_0x7a01('0x5')](util[_0x7a01('0x18')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x47e52b[_0x7a01('0x7')],channels[_0x47e52b['uniqueid']][_0x7a01('0x3f')]));}}catch(_0x36703c){utils[_0x7a01('0x1e')](util[_0x7a01('0x18')](_0x7a01('0x3e'),_0x47e52b['uniqueid']),_0x36703c);}};exports[_0x7a01('0x40')]=function(_0xe85bec){try{if(!_[_0x7a01('0x23')](channels[_0xe85bec['uniqueid']])){utils[_0x7a01('0x14')](util['format']('[%s][calls][musiconholdstop]',_0xe85bec[_0x7a01('0x7')]),_0xe85bec);if(!_[_0x7a01('0x23')](channels[_0xe85bec['uniqueid']]['musiconholdstartAt'])){channels[_0xe85bec[_0x7a01('0x7')]][_0x7a01('0x41')]+=utils[_0x7a01('0x30')](utils['now'](),channels[_0xe85bec[_0x7a01('0x7')]][_0x7a01('0x3f')]);utils['info'](util[_0x7a01('0x18')](_0x7a01('0x42'),_0xe85bec['uniqueid'],channels[_0xe85bec['uniqueid']][_0x7a01('0x41')]));delete channels[_0xe85bec[_0x7a01('0x7')]]['musiconholdstartAt'];}}}catch(_0x3cae94){utils[_0x7a01('0x1e')](util[_0x7a01('0x18')](_0x7a01('0x43'),_0xe85bec[_0x7a01('0x7')]),_0x3cae94);}};exports[_0x7a01('0x44')]=function(_0x2db278){try{if(!_[_0x7a01('0x23')](channels[_0x2db278[_0x7a01('0x7')]])){utils['debug'](util[_0x7a01('0x18')](_0x7a01('0x45'),_0x2db278[_0x7a01('0x7')]),_0x2db278);if(!_['isNil'](_0x2db278[_0x7a01('0x46')][_0x7a01('0x47')])){utils[_0x7a01('0x5')](util[_0x7a01('0x18')](_0x7a01('0x48'),_0x2db278[_0x7a01('0x7')],_0x2db278['value']));channels[_0x2db278[_0x7a01('0x7')]][_0x7a01('0x49')]=_0x2db278[_0x7a01('0x4a')];}if(!_[_0x7a01('0x23')](_0x2db278[_0x7a01('0x46')][_0x7a01('0x4b')])){utils[_0x7a01('0x5')](util['format'](_0x7a01('0x4c'),_0x2db278[_0x7a01('0x7')],_0x2db278['value']));channels[_0x2db278[_0x7a01('0x7')]]['destination']=_0x2db278[_0x7a01('0x4a')];channels[_0x2db278[_0x7a01('0x7')]][_0x7a01('0x2c')]='\x22'+_0x2db278['value']+_0x7a01('0x4d')+_0x2db278[_0x7a01('0x4a')]+'>';}if(!_[_0x7a01('0x23')](_0x2db278[_0x7a01('0x46')][_0x7a01('0x4e')])||!_['isNil'](_0x2db278['variable'][_0x7a01('0x4f')])){utils[_0x7a01('0x5')](util['format'](_0x7a01('0x50'),_0x2db278[_0x7a01('0x7')],!_['isNil'](_0x2db278[_0x7a01('0x46')]['xmd-callerid-preview'])?_0x7a01('0x4e'):_0x7a01('0x4f'),_0x2db278['value']));channels[_0x2db278[_0x7a01('0x7')]][_0x7a01('0x2c')]=_0x2db278[_0x7a01('0x4a')];}if(!_[_0x7a01('0x23')](_0x2db278['variable'][_0x7a01('0x51')])||!_[_0x7a01('0x23')](_0x2db278[_0x7a01('0x46')][_0x7a01('0x52')])){utils['info'](util[_0x7a01('0x18')](_0x7a01('0x50'),_0x2db278['uniqueid'],!_['isNil'](_0x2db278['variable'][_0x7a01('0x51')])?_0x7a01('0x51'):_0x7a01('0x52'),_0x2db278['value']));channels[_0x2db278['uniqueid']][_0x7a01('0x53')]=_0x7a01('0x54');channels[_0x2db278['uniqueid']]['lastdata']=_0x2db278[_0x7a01('0x4a')];channels[_0x2db278[_0x7a01('0x7')]][_0x7a01('0x9')]=!![];}if(!_['isNil'](_0x2db278[_0x7a01('0x46')][_0x7a01('0x55')])){utils[_0x7a01('0x5')](util['format'](_0x7a01('0x56'),_0x2db278['uniqueid'],_0x2db278[_0x7a01('0x4a')]));channels[_0x2db278[_0x7a01('0x7')]]['ContactId']=_0x2db278[_0x7a01('0x4a')];}if(!_['isNil'](_0x2db278[_0x7a01('0x46')][_0x7a01('0x57')])){utils[_0x7a01('0x5')](util['format'](_0x7a01('0x58'),_0x2db278[_0x7a01('0x7')],_0x2db278[_0x7a01('0x4a')]));channels[_0x2db278[_0x7a01('0x7')]][_0x7a01('0x59')]=_0x2db278[_0x7a01('0x4a')];}if(!_[_0x7a01('0x23')](_0x2db278[_0x7a01('0x46')][_0x7a01('0x5a')])){utils[_0x7a01('0x5')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2db278[_0x7a01('0x7')],_0x2db278[_0x7a01('0x4a')]));channels[_0x2db278['uniqueid']][_0x7a01('0x5b')]=_0x2db278['value'];}if(!_[_0x7a01('0x23')](_0x2db278[_0x7a01('0x46')][_0x7a01('0x5c')])){utils[_0x7a01('0x5')](util[_0x7a01('0x18')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x2db278[_0x7a01('0x7')],_0x2db278['value']));channels[_0x2db278[_0x7a01('0x7')]][_0x7a01('0x5c')]=_0x2db278['value'];}}}catch(_0x1838e9){utils['error'](util[_0x7a01('0x18')](_0x7a01('0x45'),_0x2db278[_0x7a01('0x7')]),_0x1838e9);}};exports[_0x7a01('0x5d')]=function(_0x20d5b2){try{if(!_['isNil'](channels[_0x20d5b2[_0x7a01('0x7')]])){utils['debug'](util[_0x7a01('0x18')](_0x7a01('0x5e'),_0x20d5b2[_0x7a01('0x7')]),_0x20d5b2);utils['info'](util[_0x7a01('0x18')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x20d5b2['uniqueid'],_0x20d5b2['application'],_0x20d5b2[_0x7a01('0x5f')]));if(_0x20d5b2[_0x7a01('0x60')][_0x7a01('0x61')]()==_0x7a01('0x62')&&_[_0x7a01('0x63')](_0x20d5b2['appdata'][_0x7a01('0x61')](),_0x7a01('0x64'))){var _0x1b9c93=_0x20d5b2[_0x7a01('0x5f')][_0x7a01('0x65')]('=');var _0x4f418d=_0x1b9c93[0x0][_0x7a01('0x66')](_0x1b9c93[0x0][_0x7a01('0x67')]('(')+0x1,_0x1b9c93[0x0][_0x7a01('0x67')](')'));var _0x455e7e=_0x1b9c93[0x1];channels[_0x20d5b2[_0x7a01('0x7')]][_0x4f418d]=_0x455e7e;}if(!_[_0x7a01('0x68')]([_0x7a01('0x2a'),_0x7a01('0x69'),_0x7a01('0x6a'),_0x7a01('0x62'),_0x7a01('0x6b')],_0x20d5b2[_0x7a01('0x60')]['toLowerCase']())){channels[_0x20d5b2['uniqueid']]['lastapplication']=_0x20d5b2[_0x7a01('0x60')];channels[_0x20d5b2[_0x7a01('0x7')]]['lastdata']=_0x20d5b2[_0x7a01('0x5f')];}}}catch(_0xd938fb){utils[_0x7a01('0x1e')](util[_0x7a01('0x18')](_0x7a01('0x5e'),_0x20d5b2[_0x7a01('0x7')]),_0xd938fb);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 1c81842..7126437 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 _0xf088=['[core]\x20close','managerevent','./utils','connect','fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x5bda1d,_0x1b1c5b){var _0x4be2b0=function(_0xdb2785){while(--_0xdb2785){_0x5bda1d['push'](_0x5bda1d['shift']());}};_0x4be2b0(++_0x1b1c5b);}(_0xf088,0x106));var _0x8f08=function(_0x29af19,_0x5f391d){_0x29af19=_0x29af19-0x0;var _0x33d68f=_0xf088[_0x29af19];return _0x33d68f;};'use strict';var utils=require(_0x8f08('0x0'));exports[_0x8f08('0x1')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils['info']('[core]\x20shutdown');};exports[_0x8f08('0x2')]=function(){utils[_0x8f08('0x3')](_0x8f08('0x4'));};exports[_0x8f08('0x5')]=function(_0x1899e1){utils[_0x8f08('0x5')](_0x8f08('0x6'),_0x1899e1);};exports[_0x8f08('0x7')]=function(){utils[_0x8f08('0x3')](_0x8f08('0x8'));};exports[_0x8f08('0x9')]=function(_0x29dac1){}; \ No newline at end of file +var _0x680b=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x12fec1,_0x20be9c){var _0x26c3af=function(_0xedc7c6){while(--_0xedc7c6){_0x12fec1['push'](_0x12fec1['shift']());}};_0x26c3af(++_0x20be9c);}(_0x680b,0x140));var _0xb680=function(_0x1aab38,_0x23cb17){_0x1aab38=_0x1aab38-0x0;var _0x13e6e5=_0x680b[_0x1aab38];return _0x13e6e5;};'use strict';var utils=require('./utils');exports[_0xb680('0x0')]=function(){utils['info'](_0xb680('0x1'));};exports[_0xb680('0x2')]=function(){utils['info'](_0xb680('0x3'));};exports[_0xb680('0x4')]=function(){utils[_0xb680('0x5')](_0xb680('0x6'));};exports[_0xb680('0x7')]=function(_0x379c57){utils[_0xb680('0x7')](_0xb680('0x8'),_0x379c57);};exports[_0xb680('0x9')]=function(){utils[_0xb680('0x5')](_0xb680('0xa'));};exports[_0xb680('0xb')]=function(_0x3621dc){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e9d4070..77ba0a4 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 _0xd739=['toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','isNil','[%s][dials][hangup]','calleridname','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0x5b876d,_0x19e607){var _0x10afc5=function(_0x120130){while(--_0x120130){_0x5b876d['push'](_0x5b876d['shift']());}};_0x10afc5(++_0x19e607);}(_0xd739,0x18d));var _0x9d73=function(_0x3d4563,_0x351a7f){_0x3d4563=_0x3d4563-0x0;var _0x3d606a=_0xd739[_0x3d4563];return _0x3d606a;};'use strict';var _=require(_0x9d73('0x0'));var util=require(_0x9d73('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x9f8f12){utils[_0x9d73('0x2')](util['format'](_0x9d73('0x3'),_0x9f8f12[_0x9d73('0x4')],_0x9f8f12[_0x9d73('0x5')],_0x9f8f12[_0x9d73('0x6')],_0x9f8f12[_0x9d73('0x7')],_0x9f8f12[_0x9d73('0x8')],_0x9f8f12[_0x9d73('0x9')]));utils[_0x9d73('0xa')](_0x9d73('0xb'),_0x9f8f12);delete dials[_0x9f8f12[_0x9d73('0x4')]];}exports[_0x9d73('0xc')]=function(_0x1c1b22){try{utils[_0x9d73('0xd')](util[_0x9d73('0xe')](_0x9d73('0xf'),_0x1c1b22[_0x9d73('0x4')]),_0x1c1b22);utils[_0x9d73('0x2')](util[_0x9d73('0xe')](_0x9d73('0x10'),_0x1c1b22['uniqueid'],_0x1c1b22[_0x9d73('0x11')],_0x1c1b22[_0x9d73('0x12')]));if(_0x1c1b22['application'][_0x9d73('0x13')]()=='set'&&_[_0x9d73('0x14')](_0x1c1b22[_0x9d73('0x12')][_0x9d73('0x13')](),_0x9d73('0x15'))){var _0x5bd661=_0x1c1b22[_0x9d73('0x12')][_0x9d73('0x16')]('=');dials[_0x1c1b22[_0x9d73('0x4')]]={'routeId':_0x5bd661[0x1]};}}catch(_0xf06373){utils[_0x9d73('0x17')](util[_0x9d73('0xe')](_0x9d73('0xf'),_0x1c1b22[_0x9d73('0x4')]),_0xf06373);}};exports[_0x9d73('0x18')]=function(_0x524ddc){try{utils['debug'](util[_0x9d73('0xe')](_0x9d73('0x19'),_0x524ddc[_0x9d73('0x4')]),_0x524ddc);if(!_['isNil'](_0x524ddc[_0x9d73('0x1a')][_0x9d73('0x1b')])){utils[_0x9d73('0x2')](util[_0x9d73('0xe')](_0x9d73('0x1c'),_0x524ddc['uniqueid'],_0x524ddc[_0x9d73('0x1d')]));dials[_0x524ddc[_0x9d73('0x4')]]={'routeId':_0x524ddc[_0x9d73('0x1d')]};}}catch(_0x2a11ba){utils['error'](util[_0x9d73('0xe')](_0x9d73('0x19'),_0x524ddc[_0x9d73('0x4')]),_0x2a11ba);}};exports[_0x9d73('0x1e')]=function(_0x433448){try{if(!_['isNil'](dials[_0x433448[_0x9d73('0x4')]])){utils['debug'](util[_0x9d73('0xe')](_0x9d73('0x1f'),_0x433448['uniqueid']),_0x433448);dials[_0x433448['uniqueid']]=_[_0x9d73('0x20')](dials[_0x433448[_0x9d73('0x4')]],_0x433448);dials[_0x433448[_0x9d73('0x4')]][_0x9d73('0x21')]=utils[_0x9d73('0x22')]();dials[_0x433448[_0x9d73('0x4')]][_0x9d73('0x23')]='called';utils[_0x9d73('0x2')](util[_0x9d73('0xe')](_0x9d73('0x24'),_0x433448[_0x9d73('0x4')],dials[_0x433448['uniqueid']]['starttime']));}}catch(_0x5e7a48){utils[_0x9d73('0x17')](util['format'](_0x9d73('0x1f'),_0x433448['uniqueid']),_0x5e7a48);}};exports[_0x9d73('0x25')]=function(_0x3891dc){try{if(!_['isNil'](dials[_0x3891dc[_0x9d73('0x4')]])){utils[_0x9d73('0xd')](util[_0x9d73('0xe')](_0x9d73('0x26'),_0x3891dc[_0x9d73('0x4')]),_0x3891dc);dials[_0x3891dc['uniqueid']][_0x9d73('0x9')]=_0x3891dc[_0x9d73('0x9')];if(_0x3891dc[_0x9d73('0x9')]=='ANSWER'){dials[_0x3891dc[_0x9d73('0x4')]]=_[_0x9d73('0x20')](dials[_0x3891dc[_0x9d73('0x4')]],_0x3891dc);dials[_0x3891dc[_0x9d73('0x4')]][_0x9d73('0x27')]=utils[_0x9d73('0x22')]();dials[_0x3891dc[_0x9d73('0x4')]][_0x9d73('0x23')]=_0x9d73('0x28');utils[_0x9d73('0x2')](util[_0x9d73('0xe')](_0x9d73('0x29'),_0x3891dc['uniqueid'],_0x3891dc[_0x9d73('0x9')],dials[_0x3891dc[_0x9d73('0x4')]][_0x9d73('0x27')]));}else{utils[_0x9d73('0x2')](util[_0x9d73('0xe')](_0x9d73('0x2a'),_0x3891dc[_0x9d73('0x4')],_0x3891dc['dialstatus']));}}}catch(_0x43b50e){utils['error'](util[_0x9d73('0xe')](_0x9d73('0x26'),_0x3891dc[_0x9d73('0x4')]),_0x43b50e);}};exports[_0x9d73('0x2b')]=function(_0x232d0b){try{if(!_[_0x9d73('0x2c')](dials[_0x232d0b[_0x9d73('0x4')]])){utils['debug'](util['format'](_0x9d73('0x2d'),_0x232d0b[_0x9d73('0x4')]),_0x232d0b);utils[_0x9d73('0x2')](util[_0x9d73('0xe')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x232d0b[_0x9d73('0x4')],_0x232d0b['calleridnum'],_0x232d0b[_0x9d73('0x2e')],_0x232d0b['cause-txt']));dials[_0x232d0b[_0x9d73('0x4')]]=_['assign'](dials[_0x232d0b['uniqueid']],{'endtime':utils[_0x9d73('0x22')](),'lastevent':'complete'});dials[_0x232d0b[_0x9d73('0x4')]][_0x9d73('0x2f')]=utils[_0x9d73('0x30')](dials[_0x232d0b[_0x9d73('0x4')]]['endtime'],dials[_0x232d0b[_0x9d73('0x4')]][_0x9d73('0x21')]);dials[_0x232d0b[_0x9d73('0x4')]][_0x9d73('0x31')]=utils[_0x9d73('0x30')](dials[_0x232d0b['uniqueid']][_0x9d73('0x27')]||dials[_0x232d0b[_0x9d73('0x4')]][_0x9d73('0x32')],dials[_0x232d0b['uniqueid']][_0x9d73('0x21')]);dials[_0x232d0b[_0x9d73('0x4')]][_0x9d73('0x33')]=dials[_0x232d0b[_0x9d73('0x4')]][_0x9d73('0x27')]?utils[_0x9d73('0x30')](dials[_0x232d0b[_0x9d73('0x4')]]['endtime'],dials[_0x232d0b[_0x9d73('0x4')]][_0x9d73('0x27')]):0x0;writeDB(dials[_0x232d0b[_0x9d73('0x4')]]);}}catch(_0x3438b7){utils[_0x9d73('0x17')](util[_0x9d73('0xe')](_0x9d73('0x2d'),_0x232d0b[_0x9d73('0x4')]),_0x3438b7);}}; \ No newline at end of file +var _0xc15b=['error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','debug','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','cause-txt','complete','duration','diffTime','endtime','billableseconds','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split'];(function(_0x8e1d8d,_0x5260cc){var _0x170093=function(_0x384cc5){while(--_0x384cc5){_0x8e1d8d['push'](_0x8e1d8d['shift']());}};_0x170093(++_0x5260cc);}(_0xc15b,0x7d));var _0xbc15=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xc15b[_0x1573ea];return _0x51c0e2;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xbc15('0x0'));var dials={};function writeDB(_0x5ba34b){utils[_0xbc15('0x1')](util['format'](_0xbc15('0x2'),_0x5ba34b[_0xbc15('0x3')],_0x5ba34b['channel'],_0x5ba34b['dialstring'],_0x5ba34b[_0xbc15('0x4')],_0x5ba34b['connectedlinenum'],_0x5ba34b[_0xbc15('0x5')]));utils[_0xbc15('0x6')](_0xbc15('0x7'),_0x5ba34b);delete dials[_0x5ba34b[_0xbc15('0x3')]];}exports[_0xbc15('0x8')]=function(_0x445f9a){try{utils['debug'](util[_0xbc15('0x9')](_0xbc15('0xa'),_0x445f9a[_0xbc15('0x3')]),_0x445f9a);utils[_0xbc15('0x1')](util[_0xbc15('0x9')](_0xbc15('0xb'),_0x445f9a[_0xbc15('0x3')],_0x445f9a[_0xbc15('0xc')],_0x445f9a['appdata']));if(_0x445f9a[_0xbc15('0xc')][_0xbc15('0xd')]()==_0xbc15('0xe')&&_[_0xbc15('0xf')](_0x445f9a[_0xbc15('0x10')][_0xbc15('0xd')](),_0xbc15('0x11'))){var _0x4df3ab=_0x445f9a[_0xbc15('0x10')][_0xbc15('0x12')]('=');dials[_0x445f9a[_0xbc15('0x3')]]={'routeId':_0x4df3ab[0x1]};}}catch(_0x48d6b7){utils[_0xbc15('0x13')](util[_0xbc15('0x9')]('[%s][dials][newexten]',_0x445f9a[_0xbc15('0x3')]),_0x48d6b7);}};exports[_0xbc15('0x14')]=function(_0x45ab60){try{utils['debug'](util[_0xbc15('0x9')](_0xbc15('0x15'),_0x45ab60['uniqueid']),_0x45ab60);if(!_[_0xbc15('0x16')](_0x45ab60[_0xbc15('0x17')][_0xbc15('0x18')])){utils[_0xbc15('0x1')](util[_0xbc15('0x9')](_0xbc15('0x19'),_0x45ab60[_0xbc15('0x3')],_0x45ab60['value']));dials[_0x45ab60[_0xbc15('0x3')]]={'routeId':_0x45ab60[_0xbc15('0x1a')]};}}catch(_0x536ead){utils['error'](util['format'](_0xbc15('0x15'),_0x45ab60[_0xbc15('0x3')]),_0x536ead);}};exports['dialbegin']=function(_0x4cbdaa){try{if(!_['isNil'](dials[_0x4cbdaa[_0xbc15('0x3')]])){utils[_0xbc15('0x1b')](util[_0xbc15('0x9')](_0xbc15('0x1c'),_0x4cbdaa[_0xbc15('0x3')]),_0x4cbdaa);dials[_0x4cbdaa[_0xbc15('0x3')]]=_[_0xbc15('0x1d')](dials[_0x4cbdaa[_0xbc15('0x3')]],_0x4cbdaa);dials[_0x4cbdaa['uniqueid']][_0xbc15('0x1e')]=utils[_0xbc15('0x1f')]();dials[_0x4cbdaa['uniqueid']][_0xbc15('0x20')]=_0xbc15('0x21');utils['info'](util['format'](_0xbc15('0x22'),_0x4cbdaa[_0xbc15('0x3')],dials[_0x4cbdaa[_0xbc15('0x3')]]['starttime']));}}catch(_0x507a65){utils['error'](util[_0xbc15('0x9')](_0xbc15('0x1c'),_0x4cbdaa[_0xbc15('0x3')]),_0x507a65);}};exports[_0xbc15('0x23')]=function(_0x154e89){try{if(!_[_0xbc15('0x16')](dials[_0x154e89[_0xbc15('0x3')]])){utils[_0xbc15('0x1b')](util[_0xbc15('0x9')](_0xbc15('0x24'),_0x154e89[_0xbc15('0x3')]),_0x154e89);dials[_0x154e89[_0xbc15('0x3')]][_0xbc15('0x5')]=_0x154e89[_0xbc15('0x5')];if(_0x154e89[_0xbc15('0x5')]==_0xbc15('0x25')){dials[_0x154e89[_0xbc15('0x3')]]=_[_0xbc15('0x1d')](dials[_0x154e89['uniqueid']],_0x154e89);dials[_0x154e89[_0xbc15('0x3')]][_0xbc15('0x26')]=utils[_0xbc15('0x1f')]();dials[_0x154e89[_0xbc15('0x3')]][_0xbc15('0x20')]='connect';utils[_0xbc15('0x1')](util[_0xbc15('0x9')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x154e89[_0xbc15('0x3')],_0x154e89[_0xbc15('0x5')],dials[_0x154e89[_0xbc15('0x3')]][_0xbc15('0x26')]));}else{utils['info'](util[_0xbc15('0x9')](_0xbc15('0x27'),_0x154e89[_0xbc15('0x3')],_0x154e89[_0xbc15('0x5')]));}}}catch(_0x1a7621){utils[_0xbc15('0x13')](util['format'](_0xbc15('0x24'),_0x154e89[_0xbc15('0x3')]),_0x1a7621);}};exports[_0xbc15('0x28')]=function(_0x4620f4){try{if(!_[_0xbc15('0x16')](dials[_0x4620f4[_0xbc15('0x3')]])){utils['debug'](util['format'](_0xbc15('0x29'),_0x4620f4[_0xbc15('0x3')]),_0x4620f4);utils[_0xbc15('0x1')](util[_0xbc15('0x9')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4620f4[_0xbc15('0x3')],_0x4620f4[_0xbc15('0x4')],_0x4620f4['calleridname'],_0x4620f4[_0xbc15('0x2a')]));dials[_0x4620f4[_0xbc15('0x3')]]=_[_0xbc15('0x1d')](dials[_0x4620f4[_0xbc15('0x3')]],{'endtime':utils[_0xbc15('0x1f')](),'lastevent':_0xbc15('0x2b')});dials[_0x4620f4[_0xbc15('0x3')]][_0xbc15('0x2c')]=utils[_0xbc15('0x2d')](dials[_0x4620f4[_0xbc15('0x3')]][_0xbc15('0x2e')],dials[_0x4620f4[_0xbc15('0x3')]]['starttime']);dials[_0x4620f4['uniqueid']]['holdtime']=utils['diffTime'](dials[_0x4620f4[_0xbc15('0x3')]][_0xbc15('0x26')]||dials[_0x4620f4[_0xbc15('0x3')]][_0xbc15('0x2e')],dials[_0x4620f4[_0xbc15('0x3')]][_0xbc15('0x1e')]);dials[_0x4620f4['uniqueid']][_0xbc15('0x2f')]=dials[_0x4620f4[_0xbc15('0x3')]][_0xbc15('0x26')]?utils[_0xbc15('0x2d')](dials[_0x4620f4['uniqueid']]['endtime'],dials[_0x4620f4[_0xbc15('0x3')]]['answertime']):0x0;writeDB(dials[_0x4620f4[_0xbc15('0x3')]]);}}catch(_0x881e54){utils[_0xbc15('0x13')](util[_0xbc15('0x9')](_0xbc15('0x29'),_0x4620f4[_0xbc15('0x3')]),_0x881e54);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0160896..cdbc0ae 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 _0x9121=['hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','port','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','[%s][index][devicestatechange]','device','devicestatechange','format','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]'];(function(_0x31c906,_0x2d0ad1){var _0x37362a=function(_0x2036d1){while(--_0x2036d1){_0x31c906['push'](_0x31c906['shift']());}};_0x37362a(++_0x2d0ad1);}(_0x9121,0x9d));var _0x1912=function(_0x4b6966,_0x4bae93){_0x4b6966=_0x4b6966-0x0;var _0x2bfcf4=_0x9121[_0x4b6966];return _0x2bfcf4;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1912('0x0'));var utils=require(_0x1912('0x1'));var util=require(_0x1912('0x2'));var isXDREnabled=config[_0x1912('0x3')]&&config[_0x1912('0x3')][_0x1912('0x4')]?!config[_0x1912('0x3')]['disabled']:!![];var isProduction=config[_0x1912('0x5')]===_0x1912('0x6')||![];var isLocalAsterisk=config[_0x1912('0x3')]&&config[_0x1912('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x1912('0x7')][_0x1912('0x8')],config[_0x1912('0x7')]['ip'],config[_0x1912('0x7')][_0x1912('0x9')],config[_0x1912('0x7')][_0x1912('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x1912('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1912('0xc')](_0x1912('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x1912('0xe'));var queues=require(_0x1912('0xf'));var recordings=require(_0x1912('0x10'));var members=require('./members.controller');var dials=require(_0x1912('0x11'));var transfers=require(_0x1912('0x12'));var core=require('./core.controller');ami['on'](_0x1912('0x13'),core[_0x1912('0x13')]);ami['on'](_0x1912('0x14'),core['shutdown']);ami['on'](_0x1912('0x15'),core[_0x1912('0x15')]);ami['on']('error',core[_0x1912('0x16')]);ami['on'](_0x1912('0x17'),core[_0x1912('0x17')]);ami['on'](_0x1912('0x18'),core[_0x1912('0x18')]);ami['on']('devicestatechange',function(_0x38b025){try{utils['debug'](util['format'](_0x1912('0x19'),_0x38b025[_0x1912('0x1a')]),_0x38b025);members[_0x1912('0x1b')](_0x38b025);}catch(_0x55d367){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x19'),_0x38b025[_0x1912('0x1a')]),_0x55d367);}});ami['on']('agentcalled',function(_0x2cb25f){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x1e'),_0x2cb25f[_0x1912('0x1f')]),_0x2cb25f);agents[_0x1912('0x20')](_0x2cb25f);}catch(_0x4769a5){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x1e'),_0x2cb25f[_0x1912('0x1f')]),_0x4769a5);}});ami['on'](_0x1912('0x21'),function(_0x308130){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x22'),_0x308130['uniqueid']),_0x308130);agents[_0x1912('0x21')](_0x308130);}catch(_0x489470){utils[_0x1912('0x16')](util[_0x1912('0x1c')]('[%s][index][agentringnoanswer]',_0x308130[_0x1912('0x1f')]),_0x489470);}});ami['on'](_0x1912('0x23'),function(_0x40cbf3){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x24'),_0x40cbf3[_0x1912('0x1f')]),_0x40cbf3);agents[_0x1912('0x23')](_0x40cbf3);queues['agentconnect'](_0x40cbf3);}catch(_0x579407){utils[_0x1912('0x16')](util['format'](_0x1912('0x24'),_0x40cbf3[_0x1912('0x1f')]),_0x579407);}});ami['on'](_0x1912('0x25'),function(_0x499cc1){try{utils[_0x1912('0x1d')](util['format'](_0x1912('0x26'),_0x499cc1[_0x1912('0x1f')]),_0x499cc1);agents[_0x1912('0x25')](_0x499cc1);queues[_0x1912('0x25')](_0x499cc1);members[_0x1912('0x25')](_0x499cc1);}catch(_0x4a7807){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x26'),_0x499cc1[_0x1912('0x1f')]),_0x4a7807);}});ami['on']('queuecallerabandon',function(_0xc6720c){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x27'),_0xc6720c[_0x1912('0x1f')]),_0xc6720c);agents[_0x1912('0x28')](_0xc6720c);queues[_0x1912('0x28')](_0xc6720c);}catch(_0x3f64e9){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x27'),_0xc6720c[_0x1912('0x1f')]),_0x3f64e9);}});ami['on'](_0x1912('0x29'),function(_0x3f235a){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x2a'),_0x3f235a[_0x1912('0x1f')]),_0x3f235a);queues[_0x1912('0x29')](_0x3f235a);recordings[_0x1912('0x29')](_0x3f235a);}catch(_0x1c954d){utils['error'](util[_0x1912('0x1c')](_0x1912('0x2a'),_0x3f235a[_0x1912('0x1f')]),_0x1c954d);}});ami['on']('queuecallerleave',function(_0x1c86be){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')]('[%s][index][queuecallerleave]',_0x1c86be[_0x1912('0x1f')]),_0x1c86be);queues['queuecallerleave'](_0x1c86be);}catch(_0x536876){utils[_0x1912('0x16')](util['format'](_0x1912('0x2b'),_0x1c86be[_0x1912('0x1f')]),_0x536876);}});ami['on'](_0x1912('0x2c'),function(_0x15097c){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x2d'),_0x15097c[_0x1912('0x1f')]),_0x15097c);queues[_0x1912('0x2c')](_0x15097c);calls[_0x1912('0x2c')](_0x15097c);}catch(_0x58b311){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x2d'),_0x15097c[_0x1912('0x1f')]),_0x58b311);}});ami['on'](_0x1912('0x2e'),function(_0x3b25ae){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x2f'),_0x3b25ae[_0x1912('0x1f')]),_0x3b25ae);queues[_0x1912('0x2e')](_0x3b25ae);calls[_0x1912('0x2e')](_0x3b25ae);}catch(_0x10fb51){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x2f'),_0x3b25ae[_0x1912('0x1f')]),_0x10fb51);}});ami['on'](_0x1912('0x30'),function(_0x3f1fee){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x31'),_0x3f1fee[_0x1912('0x1f')]),_0x3f1fee);calls[_0x1912('0x30')](_0x3f1fee);recordings[_0x1912('0x30')](_0x3f1fee);}catch(_0x4285c4){utils[_0x1912('0x16')](util[_0x1912('0x1c')]('[%s][index][newstate]',_0x3f1fee[_0x1912('0x1f')]),_0x4285c4);}});ami['on'](_0x1912('0x32'),function(_0xdd79d8){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x33'),_0xdd79d8[_0x1912('0x1f')]),_0xdd79d8);calls[_0x1912('0x32')](_0xdd79d8);recordings[_0x1912('0x32')](_0xdd79d8);dials[_0x1912('0x32')](_0xdd79d8);agents[_0x1912('0x32')](_0xdd79d8);queues[_0x1912('0x32')](_0xdd79d8);}catch(_0x5dd821){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x33'),_0xdd79d8[_0x1912('0x1f')]),_0x5dd821);}});ami['on'](_0x1912('0x34'),function(_0x21d45a){try{utils[_0x1912('0x1d')](util['format']('[%s][index][cdr]',_0x21d45a[_0x1912('0x1f')]),_0x21d45a);members[_0x1912('0x34')](_0x21d45a);}catch(_0x4a6baa){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x35'),_0x21d45a[_0x1912('0x1f')]),_0x4a6baa);}});ami['on'](_0x1912('0x36'),function(_0x49e4b5){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')]('[%s][index][blindtransfer]',_0x49e4b5[_0x1912('0x1f')]),_0x49e4b5);queues[_0x1912('0x36')](_0x49e4b5);agents[_0x1912('0x36')](_0x49e4b5);transfers[_0x1912('0x36')](_0x49e4b5);}catch(_0x5b6842){utils[_0x1912('0x16')](util['format'](_0x1912('0x37'),_0x49e4b5[_0x1912('0x1f')]),_0x5b6842);}});ami['on']('attendedtransfer',function(_0x3308ae){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x38'),_0x3308ae[_0x1912('0x39')]),_0x3308ae);queues[_0x1912('0x3a')](_0x3308ae);transfers[_0x1912('0x3a')](_0x3308ae);agents['attendedtransfer'](_0x3308ae);calls[_0x1912('0x3a')](_0x3308ae);}catch(_0x552c38){utils['error'](util[_0x1912('0x1c')](_0x1912('0x38'),_0x3308ae[_0x1912('0x39')]),_0x552c38);}});ami['on'](_0x1912('0x3b'),function(_0x50d263){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x3c'),_0x50d263[_0x1912('0x1f')]),_0x50d263);queues[_0x1912('0x3b')](_0x50d263);recordings[_0x1912('0x3b')](_0x50d263);calls[_0x1912('0x3b')](_0x50d263);dials[_0x1912('0x3b')](_0x50d263);}catch(_0x366ecd){utils['error'](util[_0x1912('0x1c')](_0x1912('0x3c'),_0x50d263[_0x1912('0x1f')]),_0x366ecd);}});ami['on'](_0x1912('0x3d'),function(_0x3662e5){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x3e'),_0x3662e5[_0x1912('0x1f')]),_0x3662e5);calls[_0x1912('0x3d')](_0x3662e5);recordings['newexten'](_0x3662e5);dials[_0x1912('0x3d')](_0x3662e5);}catch(_0x34912b){utils[_0x1912('0x16')](util[_0x1912('0x1c')]('[%s][index][newexten]',_0x3662e5[_0x1912('0x1f')]),_0x34912b);}});ami['on'](_0x1912('0x3f'),function(_0x136b85){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')](_0x1912('0x40'),_0x136b85['uniqueid']),_0x136b85);calls[_0x1912('0x3f')](_0x136b85);recordings[_0x1912('0x3f')](_0x136b85);}catch(_0x3eadd3){utils[_0x1912('0x16')](util['format'](_0x1912('0x40'),_0x136b85[_0x1912('0x1f')]),_0x3eadd3);}});ami['on'](_0x1912('0x41'),function(_0xce504b){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0xce504b[_0x1912('0x1f')]),_0xce504b);dials['dialbegin'](_0xce504b);}catch(_0x55025e){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x42'),_0xce504b[_0x1912('0x1f')]),_0x55025e);}});ami['on'](_0x1912('0x43'),function(_0x5782ee){try{utils[_0x1912('0x1d')](util[_0x1912('0x1c')]('[%s][index][dialend]',_0x5782ee['uniqueid']),_0x5782ee);dials[_0x1912('0x43')](_0x5782ee);}catch(_0x4c11c8){utils[_0x1912('0x16')](util[_0x1912('0x1c')](_0x1912('0x44'),_0x5782ee[_0x1912('0x1f')]),_0x4c11c8);}});} \ No newline at end of file +var _0xcc6d=['asterisk-manager','../../config/environment','./utils','util','disabled','env','production','xdr','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','debug','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]'];(function(_0x19dadd,_0x22f6c5){var _0x1d5fa2=function(_0x2dbcd2){while(--_0x2dbcd2){_0x19dadd['push'](_0x19dadd['shift']());}};_0x1d5fa2(++_0x22f6c5);}(_0xcc6d,0x159));var _0xdcc6=function(_0x16f2a6,_0x9757bb){_0x16f2a6=_0x16f2a6-0x0;var _0x5095d7=_0xcc6d[_0x16f2a6];return _0x5095d7;};var AsteriskManager=require(_0xdcc6('0x0'));var config=require(_0xdcc6('0x1'));var utils=require(_0xdcc6('0x2'));var util=require(_0xdcc6('0x3'));var isXDREnabled=config['xdr']&&config['xdr'][_0xdcc6('0x4')]?!config['xdr']['disabled']:!![];var isProduction=config[_0xdcc6('0x5')]===_0xdcc6('0x6')||![];var isLocalAsterisk=config[_0xdcc6('0x7')]&&config[_0xdcc6('0x7')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xdcc6('0x8')],config[_0xdcc6('0x9')]['ip'],config['asterisk'][_0xdcc6('0xa')],config['asterisk'][_0xdcc6('0xb')],!![]);ami[_0xdcc6('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xdcc6('0xd')](_0xdcc6('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0xdcc6('0xf'));var queues=require(_0xdcc6('0x10'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xdcc6('0x11'));var transfers=require(_0xdcc6('0x12'));var core=require(_0xdcc6('0x13'));ami['on'](_0xdcc6('0x14'),core[_0xdcc6('0x14')]);ami['on'](_0xdcc6('0x15'),core[_0xdcc6('0x15')]);ami['on'](_0xdcc6('0x16'),core[_0xdcc6('0x16')]);ami['on']('error',core[_0xdcc6('0x17')]);ami['on'](_0xdcc6('0x18'),core['close']);ami['on'](_0xdcc6('0x19'),core[_0xdcc6('0x19')]);ami['on'](_0xdcc6('0x1a'),function(_0xc74e3f){try{utils['debug'](util['format'](_0xdcc6('0x1b'),_0xc74e3f[_0xdcc6('0x1c')]),_0xc74e3f);members[_0xdcc6('0x1a')](_0xc74e3f);}catch(_0x278157){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')]('[%s][index][devicestatechange]',_0xc74e3f[_0xdcc6('0x1c')]),_0x278157);}});ami['on']('agentcalled',function(_0x22995a){try{utils[_0xdcc6('0x1e')](util['format'](_0xdcc6('0x1f'),_0x22995a['uniqueid']),_0x22995a);agents[_0xdcc6('0x20')](_0x22995a);}catch(_0x29d89b){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x1f'),_0x22995a[_0xdcc6('0x21')]),_0x29d89b);}});ami['on'](_0xdcc6('0x22'),function(_0x23a637){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x23'),_0x23a637[_0xdcc6('0x21')]),_0x23a637);agents[_0xdcc6('0x22')](_0x23a637);}catch(_0x5f090b){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x23'),_0x23a637[_0xdcc6('0x21')]),_0x5f090b);}});ami['on'](_0xdcc6('0x24'),function(_0x4a6b65){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x25'),_0x4a6b65[_0xdcc6('0x21')]),_0x4a6b65);agents[_0xdcc6('0x24')](_0x4a6b65);queues['agentconnect'](_0x4a6b65);}catch(_0x1444e3){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x25'),_0x4a6b65[_0xdcc6('0x21')]),_0x1444e3);}});ami['on']('agentcomplete',function(_0x83517e){try{utils[_0xdcc6('0x1e')](util['format']('[%s][index][agentcomplete]',_0x83517e[_0xdcc6('0x21')]),_0x83517e);agents[_0xdcc6('0x26')](_0x83517e);queues['agentcomplete'](_0x83517e);members[_0xdcc6('0x26')](_0x83517e);}catch(_0x50e1b2){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')]('[%s][index][agentcomplete]',_0x83517e[_0xdcc6('0x21')]),_0x50e1b2);}});ami['on'](_0xdcc6('0x27'),function(_0x4d990d){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x28'),_0x4d990d[_0xdcc6('0x21')]),_0x4d990d);agents[_0xdcc6('0x27')](_0x4d990d);queues['queuecallerabandon'](_0x4d990d);}catch(_0x271aee){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x28'),_0x4d990d[_0xdcc6('0x21')]),_0x271aee);}});ami['on'](_0xdcc6('0x29'),function(_0x531b7e){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x2a'),_0x531b7e[_0xdcc6('0x21')]),_0x531b7e);queues['queuecallerjoin'](_0x531b7e);recordings[_0xdcc6('0x29')](_0x531b7e);}catch(_0x4df678){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x2a'),_0x531b7e[_0xdcc6('0x21')]),_0x4df678);}});ami['on'](_0xdcc6('0x2b'),function(_0x46505c){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x2c'),_0x46505c['uniqueid']),_0x46505c);queues[_0xdcc6('0x2b')](_0x46505c);}catch(_0x55d7c2){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x2c'),_0x46505c[_0xdcc6('0x21')]),_0x55d7c2);}});ami['on']('musiconholdstart',function(_0x4b7982){try{utils[_0xdcc6('0x1e')](util['format'](_0xdcc6('0x2d'),_0x4b7982['uniqueid']),_0x4b7982);queues['musiconholdstart'](_0x4b7982);calls[_0xdcc6('0x2e')](_0x4b7982);}catch(_0x2b1d6b){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x2d'),_0x4b7982[_0xdcc6('0x21')]),_0x2b1d6b);}});ami['on'](_0xdcc6('0x2f'),function(_0x495e27){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x30'),_0x495e27[_0xdcc6('0x21')]),_0x495e27);queues[_0xdcc6('0x2f')](_0x495e27);calls['musiconholdstop'](_0x495e27);}catch(_0x5ddc8d){utils['error'](util[_0xdcc6('0x1d')](_0xdcc6('0x30'),_0x495e27[_0xdcc6('0x21')]),_0x5ddc8d);}});ami['on'](_0xdcc6('0x31'),function(_0x10c18d){try{utils['debug'](util[_0xdcc6('0x1d')]('[%s][index][newstate]',_0x10c18d[_0xdcc6('0x21')]),_0x10c18d);calls[_0xdcc6('0x31')](_0x10c18d);recordings[_0xdcc6('0x31')](_0x10c18d);}catch(_0x308b0f){utils[_0xdcc6('0x17')](util['format']('[%s][index][newstate]',_0x10c18d[_0xdcc6('0x21')]),_0x308b0f);}});ami['on'](_0xdcc6('0x32'),function(_0x3215ac){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x33'),_0x3215ac[_0xdcc6('0x21')]),_0x3215ac);calls[_0xdcc6('0x32')](_0x3215ac);recordings[_0xdcc6('0x32')](_0x3215ac);dials[_0xdcc6('0x32')](_0x3215ac);agents[_0xdcc6('0x32')](_0x3215ac);queues[_0xdcc6('0x32')](_0x3215ac);}catch(_0x3120d3){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x33'),_0x3215ac[_0xdcc6('0x21')]),_0x3120d3);}});ami['on']('cdr',function(_0xfb7300){try{utils['debug'](util['format'](_0xdcc6('0x34'),_0xfb7300['uniqueid']),_0xfb7300);members[_0xdcc6('0x35')](_0xfb7300);}catch(_0x45f3cf){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x34'),_0xfb7300[_0xdcc6('0x21')]),_0x45f3cf);}});ami['on']('blindtransfer',function(_0xed413c){try{utils['debug'](util[_0xdcc6('0x1d')](_0xdcc6('0x36'),_0xed413c[_0xdcc6('0x21')]),_0xed413c);queues[_0xdcc6('0x37')](_0xed413c);agents['blindtransfer'](_0xed413c);transfers[_0xdcc6('0x37')](_0xed413c);}catch(_0xdfc369){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x36'),_0xed413c[_0xdcc6('0x21')]),_0xdfc369);}});ami['on'](_0xdcc6('0x38'),function(_0x59bd54){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x39'),_0x59bd54[_0xdcc6('0x3a')]),_0x59bd54);queues['attendedtransfer'](_0x59bd54);transfers[_0xdcc6('0x38')](_0x59bd54);agents[_0xdcc6('0x38')](_0x59bd54);calls['attendedtransfer'](_0x59bd54);}catch(_0xa4b10b){utils[_0xdcc6('0x17')](util['format']('[%s][index][attendedtransfer]',_0x59bd54[_0xdcc6('0x3a')]),_0xa4b10b);}});ami['on'](_0xdcc6('0x3b'),function(_0x40a0f6){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')]('[%s][index][varset]',_0x40a0f6['uniqueid']),_0x40a0f6);queues[_0xdcc6('0x3b')](_0x40a0f6);recordings[_0xdcc6('0x3b')](_0x40a0f6);calls['varset'](_0x40a0f6);dials[_0xdcc6('0x3b')](_0x40a0f6);}catch(_0x567f7d){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x3c'),_0x40a0f6[_0xdcc6('0x21')]),_0x567f7d);}});ami['on'](_0xdcc6('0x3d'),function(_0x50bb01){try{utils[_0xdcc6('0x1e')](util['format'](_0xdcc6('0x3e'),_0x50bb01[_0xdcc6('0x21')]),_0x50bb01);calls[_0xdcc6('0x3d')](_0x50bb01);recordings[_0xdcc6('0x3d')](_0x50bb01);dials[_0xdcc6('0x3d')](_0x50bb01);}catch(_0x55fa0e){utils['error'](util[_0xdcc6('0x1d')]('[%s][index][newexten]',_0x50bb01[_0xdcc6('0x21')]),_0x55fa0e);}});ami['on'](_0xdcc6('0x3f'),function(_0x1b3dc8){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x40'),_0x1b3dc8[_0xdcc6('0x21')]),_0x1b3dc8);calls['newchannel'](_0x1b3dc8);recordings[_0xdcc6('0x3f')](_0x1b3dc8);}catch(_0x40e3b6){utils[_0xdcc6('0x17')](util['format'](_0xdcc6('0x40'),_0x1b3dc8['uniqueid']),_0x40e3b6);}});ami['on']('dialbegin',function(_0x53bbb5){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')](_0xdcc6('0x41'),_0x53bbb5['uniqueid']),_0x53bbb5);dials['dialbegin'](_0x53bbb5);}catch(_0xd4e20b){utils['error'](util[_0xdcc6('0x1d')](_0xdcc6('0x42'),_0x53bbb5['uniqueid']),_0xd4e20b);}});ami['on'](_0xdcc6('0x43'),function(_0x212177){try{utils[_0xdcc6('0x1e')](util[_0xdcc6('0x1d')]('[%s][index][dialend]',_0x212177[_0xdcc6('0x21')]),_0x212177);dials[_0xdcc6('0x43')](_0x212177);}catch(_0x30128d){utils[_0xdcc6('0x17')](util[_0xdcc6('0x1d')](_0xdcc6('0x44'),_0x212177[_0xdcc6('0x21')]),_0x30128d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 61fb88d..a8718fe 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 _0xcca0=['agent','NOT_INUSE','isNil','exitAt','duration','enterAt','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','type','source','data3','destination','data1','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','then','internal','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xcca0,0x1d3));var _0x0cca=function(_0x39439d,_0xd99786){_0x39439d=_0x39439d-0x0;var _0x78bfe9=_0xcca0[_0x39439d];return _0x78bfe9;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0cca('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x0cca('0x1')];function writeDB(_0x60637f){utils[_0x0cca('0x2')](util[_0x0cca('0x3')](_0x0cca('0x4'),_0x60637f[_0x0cca('0x5')],_0x60637f[_0x0cca('0x6')],_0x60637f[_0x0cca('0x7')],_0x60637f[_0x0cca('0x8')],_0x60637f[_0x0cca('0x9')],_0x60637f['type']));if(_0x60637f[_0x0cca('0x6')]){utils[_0x0cca('0xa')](_0x60637f[_0x0cca('0x6')])[_0x0cca('0xb')](function(_0x5682a7){if(_0x5682a7){_0x60637f[_0x0cca('0x9')]=_0x5682a7['name'];_0x60637f['internal']=_0x5682a7[_0x0cca('0xc')];utils['request'](_0x0cca('0xd'),_0x60637f);}else{utils[_0x0cca('0xe')](_0x60637f['interface'][_0x0cca('0xf')]('/')[0x1])[_0x0cca('0xb')](function(_0x39d81e){if(_0x39d81e){_0x60637f[_0x0cca('0x9')]=_0x39d81e[_0x0cca('0x10')];_0x60637f['internal']=_0x39d81e[_0x0cca('0xc')];utils['request']('CreateMemberReport',_0x60637f);}});}})[_0x0cca('0x11')](function(_0x320210){utils[_0x0cca('0x12')](util[_0x0cca('0x3')](_0x0cca('0x13'),_0x60637f[_0x0cca('0x5')]),_0x320210);});}delete members[_0x60637f[_0x0cca('0x6')]];}function startsWith(_0x4544de,_0x48de99){return _[_0x0cca('0x14')](_0x4544de,function(_0x4e694d){return _[_0x0cca('0x15')](_0x48de99,_0x4e694d);});}exports[_0x0cca('0x16')]=function(_0x3bdfbe){try{utils[_0x0cca('0x17')](util['format'](_0x0cca('0x18'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x5')]:_0x3bdfbe[_0x0cca('0x19')]),_0x3bdfbe);utils[_0x0cca('0x2')](util['format'](_0x0cca('0x1a'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe['device']]['uniqueid']:_0x3bdfbe[_0x0cca('0x19')],_0x3bdfbe[_0x0cca('0x1b')],_0x3bdfbe[_0x0cca('0x19')]));switch(_0x3bdfbe[_0x0cca('0x1b')]){case _0x0cca('0x1c'):case _0x0cca('0x1d'):if(!startsWith(exclude,_0x3bdfbe[_0x0cca('0x19')])){members[_0x3bdfbe[_0x0cca('0x19')]]={'channel':_0x0cca('0x1e'),'interface':_0x3bdfbe['device'],'type':_0x0cca('0x1f'),'enterAt':utils[_0x0cca('0x20')](),'role':_0x0cca('0x21')};}break;case _0x0cca('0x22'):if(!_[_0x0cca('0x23')](members[_0x3bdfbe[_0x0cca('0x19')]])){members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x24')]=utils[_0x0cca('0x20')]();members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x25')]=utils['diffTime'](members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x24')],members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x26')]);if(members[_0x3bdfbe['device']][_0x0cca('0x5')]){writeDB(members[_0x3bdfbe[_0x0cca('0x19')]]);}}break;default:break;}}catch(_0xa2fe58){utils['error'](util[_0x0cca('0x3')](_0x0cca('0x18'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe['device']]['uniqueid']:_0x3bdfbe[_0x0cca('0x19')]),_0xa2fe58);}};exports['agentcomplete']=function(_0x38f513){try{if(!_[_0x0cca('0x23')](members[_0x38f513[_0x0cca('0x6')]])){utils[_0x0cca('0x17')](util[_0x0cca('0x3')]('[%s][members][agentcomplete]',_0x38f513[_0x0cca('0x5')]),_0x38f513);utils[_0x0cca('0x2')](util[_0x0cca('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x38f513[_0x0cca('0x5')],_0x38f513['interface'],_0x38f513['queue']));members[_0x38f513['interface']]=_[_0x0cca('0x27')](members[_0x38f513[_0x0cca('0x6')]],{'data4':_0x38f513['queue'],'uniqueid':_0x38f513[_0x0cca('0x5')]});}}catch(_0x475a23){utils['error'](util['format'](_0x0cca('0x28'),_0x38f513[_0x0cca('0x5')]),_0x475a23);}};exports[_0x0cca('0x29')]=function(_0x2949f3){try{utils['debug'](util[_0x0cca('0x3')](_0x0cca('0x2a'),_0x2949f3[_0x0cca('0x5')]),_0x2949f3);if(_0x2949f3[_0x0cca('0x7')]){var _0x22d210=_0x2949f3['channel'][_0x0cca('0xf')]('-')[0x0];if(!_[_0x0cca('0x23')](members[_0x22d210])){members[_0x22d210]=_[_0x0cca('0x27')](members[_0x22d210],{'data1':members[_0x22d210]['data1']||_0x2949f3[_0x0cca('0x2b')],'data2':members[_0x22d210]['data2']||_0x2949f3[_0x0cca('0x2c')],'data3':members[_0x22d210][_0x0cca('0x2d')]||_0x2949f3[_0x0cca('0x2e')],'uniqueid':members[_0x22d210][_0x0cca('0x5')]||_0x2949f3[_0x0cca('0x5')]});utils[_0x0cca('0x2')](util[_0x0cca('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2949f3[_0x0cca('0x5')],members[_0x22d210][_0x0cca('0x2f')],members[_0x22d210][_0x0cca('0x8')],members[_0x22d210][_0x0cca('0x2d')]));if(members[_0x22d210][_0x0cca('0x24')]){writeDB(members[_0x22d210]);}}}if(_0x2949f3['destinationchannel']){var _0x378976=_0x2949f3[_0x0cca('0x30')][_0x0cca('0xf')]('-')[0x0];if(!_[_0x0cca('0x23')](members[_0x378976])){members[_0x378976]=_['assign'](members[_0x378976],{'data1':members[_0x378976][_0x0cca('0x2f')]||_0x2949f3['type'],'data2':members[_0x378976][_0x0cca('0x8')]||_0x2949f3[_0x0cca('0x2c')],'data3':members[_0x378976]['data3']||_0x2949f3[_0x0cca('0x2e')],'uniqueid':members[_0x378976]['uniqueid']||_0x2949f3['uniqueid']});utils[_0x0cca('0x2')](util[_0x0cca('0x3')](_0x0cca('0x31'),_0x2949f3[_0x0cca('0x5')],members[_0x378976][_0x0cca('0x2f')],members[_0x378976][_0x0cca('0x8')],members[_0x378976]['data3']));if(members[_0x378976][_0x0cca('0x24')]){writeDB(members[_0x378976]);}}}}catch(_0x3fa7a5){utils[_0x0cca('0x12')](util[_0x0cca('0x3')](_0x0cca('0x2a'),_0x2949f3[_0x0cca('0x5')]),_0x3fa7a5);}}; \ No newline at end of file +var _0x447b=['membername','name','internal','request','CreateMemberReport','getUserByName','split','error','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','source','data3','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','then'];(function(_0x10f387,_0x4ccb71){var _0x3de1b8=function(_0x325fbe){while(--_0x325fbe){_0x10f387['push'](_0x10f387['shift']());}};_0x3de1b8(++_0x4ccb71);}(_0x447b,0xe4));var _0xb447=function(_0x4fb955,_0x481977){_0x4fb955=_0x4fb955-0x0;var _0x4f9797=_0x447b[_0x4fb955];return _0x4f9797;};'use strict';var _=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var utils=require('./utils');var members={};var exclude=[_0xb447('0x2'),_0xb447('0x3')];function writeDB(_0x2a45d2){utils[_0xb447('0x4')](util[_0xb447('0x5')](_0xb447('0x6'),_0x2a45d2[_0xb447('0x7')],_0x2a45d2[_0xb447('0x8')],_0x2a45d2[_0xb447('0x9')],_0x2a45d2[_0xb447('0xa')],_0x2a45d2['membername'],_0x2a45d2['type']));if(_0x2a45d2[_0xb447('0x8')]){utils['getUserByInterface'](_0x2a45d2[_0xb447('0x8')])[_0xb447('0xb')](function(_0x270edf){if(_0x270edf){_0x2a45d2[_0xb447('0xc')]=_0x270edf[_0xb447('0xd')];_0x2a45d2['internal']=_0x270edf[_0xb447('0xe')];utils[_0xb447('0xf')](_0xb447('0x10'),_0x2a45d2);}else{utils[_0xb447('0x11')](_0x2a45d2['interface'][_0xb447('0x12')]('/')[0x1])[_0xb447('0xb')](function(_0x3ef180){if(_0x3ef180){_0x2a45d2[_0xb447('0xc')]=_0x3ef180[_0xb447('0xd')];_0x2a45d2[_0xb447('0xe')]=_0x3ef180[_0xb447('0xe')];utils[_0xb447('0xf')](_0xb447('0x10'),_0x2a45d2);}});}})['catch'](function(_0x4a8d6f){utils[_0xb447('0x13')](util[_0xb447('0x5')]('[%s][members][writeDB]',_0x2a45d2[_0xb447('0x7')]),_0x4a8d6f);});}delete members[_0x2a45d2[_0xb447('0x8')]];}function startsWith(_0x43f53f,_0x557701){return _['some'](_0x43f53f,function(_0x86993a){return _['startsWith'](_0x557701,_0x86993a);});}exports[_0xb447('0x14')]=function(_0x5c98a9){try{utils[_0xb447('0x15')](util[_0xb447('0x5')](_0xb447('0x16'),members[_0x5c98a9[_0xb447('0x17')]]?members[_0x5c98a9[_0xb447('0x17')]][_0xb447('0x7')]:_0x5c98a9[_0xb447('0x17')]),_0x5c98a9);utils['info'](util['format'](_0xb447('0x18'),members[_0x5c98a9[_0xb447('0x17')]]?members[_0x5c98a9[_0xb447('0x17')]]['uniqueid']:_0x5c98a9[_0xb447('0x17')],_0x5c98a9[_0xb447('0x19')],_0x5c98a9[_0xb447('0x17')]));switch(_0x5c98a9[_0xb447('0x19')]){case _0xb447('0x1a'):case'BUSY':if(!startsWith(exclude,_0x5c98a9[_0xb447('0x17')])){members[_0x5c98a9[_0xb447('0x17')]]={'channel':_0xb447('0x1b'),'interface':_0x5c98a9[_0xb447('0x17')],'type':_0xb447('0x1c'),'enterAt':utils[_0xb447('0x1d')](),'role':'agent'};}break;case _0xb447('0x1e'):if(!_[_0xb447('0x1f')](members[_0x5c98a9[_0xb447('0x17')]])){members[_0x5c98a9[_0xb447('0x17')]][_0xb447('0x20')]=utils['now']();members[_0x5c98a9[_0xb447('0x17')]][_0xb447('0x21')]=utils[_0xb447('0x22')](members[_0x5c98a9[_0xb447('0x17')]][_0xb447('0x20')],members[_0x5c98a9[_0xb447('0x17')]][_0xb447('0x23')]);if(members[_0x5c98a9[_0xb447('0x17')]]['uniqueid']){writeDB(members[_0x5c98a9[_0xb447('0x17')]]);}}break;default:break;}}catch(_0x6eaf85){utils[_0xb447('0x13')](util[_0xb447('0x5')](_0xb447('0x16'),members[_0x5c98a9[_0xb447('0x17')]]?members[_0x5c98a9[_0xb447('0x17')]][_0xb447('0x7')]:_0x5c98a9[_0xb447('0x17')]),_0x6eaf85);}};exports['agentcomplete']=function(_0x533444){try{if(!_['isNil'](members[_0x533444[_0xb447('0x8')]])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x533444[_0xb447('0x7')]),_0x533444);utils[_0xb447('0x4')](util[_0xb447('0x5')](_0xb447('0x24'),_0x533444['uniqueid'],_0x533444[_0xb447('0x8')],_0x533444[_0xb447('0x25')]));members[_0x533444[_0xb447('0x8')]]=_[_0xb447('0x26')](members[_0x533444[_0xb447('0x8')]],{'data4':_0x533444[_0xb447('0x25')],'uniqueid':_0x533444[_0xb447('0x7')]});}}catch(_0x3c3025){utils[_0xb447('0x13')](util[_0xb447('0x5')](_0xb447('0x27'),_0x533444[_0xb447('0x7')]),_0x3c3025);}};exports[_0xb447('0x28')]=function(_0x34f96f){try{utils['debug'](util[_0xb447('0x5')](_0xb447('0x29'),_0x34f96f[_0xb447('0x7')]),_0x34f96f);if(_0x34f96f[_0xb447('0x9')]){var _0x1b7fee=_0x34f96f[_0xb447('0x9')]['split']('-')[0x0];if(!_[_0xb447('0x1f')](members[_0x1b7fee])){members[_0x1b7fee]=_[_0xb447('0x26')](members[_0x1b7fee],{'data1':members[_0x1b7fee][_0xb447('0x2a')]||_0x34f96f['type'],'data2':members[_0x1b7fee]['data2']||_0x34f96f[_0xb447('0x2b')],'data3':members[_0x1b7fee]['data3']||_0x34f96f['destination'],'uniqueid':members[_0x1b7fee][_0xb447('0x7')]||_0x34f96f[_0xb447('0x7')]});utils[_0xb447('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x34f96f['uniqueid'],members[_0x1b7fee][_0xb447('0x2a')],members[_0x1b7fee]['data2'],members[_0x1b7fee][_0xb447('0x2c')]));if(members[_0x1b7fee][_0xb447('0x20')]){writeDB(members[_0x1b7fee]);}}}if(_0x34f96f[_0xb447('0x2d')]){var _0x31e16b=_0x34f96f[_0xb447('0x2d')][_0xb447('0x12')]('-')[0x0];if(!_[_0xb447('0x1f')](members[_0x31e16b])){members[_0x31e16b]=_[_0xb447('0x26')](members[_0x31e16b],{'data1':members[_0x31e16b][_0xb447('0x2a')]||_0x34f96f['type'],'data2':members[_0x31e16b][_0xb447('0xa')]||_0x34f96f['source'],'data3':members[_0x31e16b][_0xb447('0x2c')]||_0x34f96f[_0xb447('0x2e')],'uniqueid':members[_0x31e16b][_0xb447('0x7')]||_0x34f96f['uniqueid']});utils[_0xb447('0x4')](util[_0xb447('0x5')](_0xb447('0x2f'),_0x34f96f[_0xb447('0x7')],members[_0x31e16b][_0xb447('0x2a')],members[_0x31e16b][_0xb447('0xa')],members[_0x31e16b]['data3']));if(members[_0x31e16b][_0xb447('0x20')]){writeDB(members[_0x31e16b]);}}}}catch(_0x3fee12){utils['error'](util[_0xb447('0x5')](_0xb447('0x29'),_0x34f96f['uniqueid']),_0x3fee12);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 142a07f..1cc987e 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 _0xae82=['transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','secondtransfereruniqueid','transfertargetlinkedid','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','position','assign','now','error','[%s][queues][queuecallerjoin]','debug','[%s][queues][hangup]','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','isNil','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xae82,0xf7));var _0x2ae8=function(_0x298ecf,_0x33f35e){_0x298ecf=_0x298ecf-0x0;var _0x4bf003=_0xae82[_0x298ecf];return _0x4bf003;};'use strict';var _=require(_0x2ae8('0x0'));var util=require(_0x2ae8('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x44a6fe){utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x4'),_0x44a6fe[_0x2ae8('0x5')],_0x44a6fe['channel'],_0x44a6fe[_0x2ae8('0x6')],_0x44a6fe[_0x2ae8('0x7')],_0x44a6fe['calleridnum'],_0x44a6fe['accountcode'],_0x44a6fe[_0x2ae8('0x8')]));if(_0x44a6fe[_0x2ae8('0x6')]){utils[_0x2ae8('0x9')](_0x44a6fe[_0x2ae8('0x6')])['then'](function(_0x565547){if(_0x565547){_0x44a6fe[_0x2ae8('0xa')]=_0x565547['type'];}utils[_0x2ae8('0xb')](_0x2ae8('0xc'),_0x44a6fe);});}else{utils['request'](_0x2ae8('0xc'),_0x44a6fe);}if(_0x44a6fe[_0x2ae8('0xd')]){delete queues[_0x44a6fe[_0x2ae8('0xd')]];}else{delete queues[_0x44a6fe['uniqueid']];}}exports[_0x2ae8('0xe')]=function(_0x11c3bb){try{utils['debug'](util[_0x2ae8('0x3')]('[%s][queues][queuecallerjoin]',_0x11c3bb[_0x2ae8('0x5')]),_0x11c3bb);utils[_0x2ae8('0x2')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x11c3bb[_0x2ae8('0x5')],_0x11c3bb[_0x2ae8('0x6')],_0x11c3bb[_0x2ae8('0xf')]));queues[_0x11c3bb[_0x2ae8('0x5')]]=_[_0x2ae8('0x10')](_0x11c3bb,{'originalposition':_0x11c3bb[_0x2ae8('0xf')],'queuecallerjoinAt':utils[_0x2ae8('0x11')](),'mohtime':0x0});}catch(_0x18be19){utils[_0x2ae8('0x12')](util['format'](_0x2ae8('0x13'),_0x11c3bb['uniqueid']),_0x18be19);}};exports['hangup']=function(_0x39f6c5){try{if(!_['isNil'](queues[_0x39f6c5['uniqueid']])){utils[_0x2ae8('0x14')](util[_0x2ae8('0x3')](_0x2ae8('0x15'),_0x39f6c5[_0x2ae8('0x5')]),_0x39f6c5);if(queues[_0x39f6c5[_0x2ae8('0x5')]]['queuecallerleaveAt']){if(!queues[_0x39f6c5[_0x2ae8('0x5')]]['queuecallerabandon']&&!queues[_0x39f6c5[_0x2ae8('0x5')]]['queuecallerexit']){queues[_0x39f6c5[_0x2ae8('0x5')]][_0x2ae8('0x16')]=!![];queues[_0x39f6c5['uniqueid']][_0x2ae8('0x17')]=utils[_0x2ae8('0x11')]();queues[_0x39f6c5[_0x2ae8('0x5')]][_0x2ae8('0x8')]='COMPLETEDBYAGENT';}utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x18'),_0x39f6c5[_0x2ae8('0x5')],queues[_0x39f6c5[_0x2ae8('0x5')]][_0x2ae8('0x19')],queues[_0x39f6c5[_0x2ae8('0x5')]][_0x2ae8('0x8')]));writeDB(queues[_0x39f6c5[_0x2ae8('0x5')]]);}else if(queues[_0x39f6c5[_0x2ae8('0x5')]][_0x2ae8('0xd')]){utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x1a'),_0x39f6c5['uniqueid'],queues[_0x39f6c5[_0x2ae8('0x5')]][_0x2ae8('0x19')],queues[_0x39f6c5[_0x2ae8('0x5')]]['transfereduniqueid']));queues[queues[_0x39f6c5['uniqueid']][_0x2ae8('0xd')]]=queues[_0x39f6c5[_0x2ae8('0x5')]];queues[queues[_0x39f6c5[_0x2ae8('0x5')]][_0x2ae8('0xd')]][_0x2ae8('0x1b')]=0x2;delete queues[_0x39f6c5[_0x2ae8('0x5')]];}}}catch(_0x5eed52){utils['error'](util[_0x2ae8('0x3')](_0x2ae8('0x15'),_0x39f6c5[_0x2ae8('0x5')]),_0x5eed52);}};exports[_0x2ae8('0x1c')]=function(_0x4957a1){try{utils['debug'](util['format']('[%s][queues][varset]',_0x4957a1[_0x2ae8('0x5')]),_0x4957a1);if(!_['isNil'](_0x4957a1[_0x2ae8('0x1d')][_0x2ae8('0x1e')])&&_0x4957a1[_0x2ae8('0x1f')][_0x2ae8('0x20')]()!==_0x2ae8('0x21')){if(!_[_0x2ae8('0x22')](queues[_0x4957a1[_0x2ae8('0x5')]])){queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x23')]=![];queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x24')]=null;queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x25')]=!![];queues[_0x4957a1['uniqueid']][_0x2ae8('0x26')]=utils[_0x2ae8('0x11')]();queues[_0x4957a1['uniqueid']][_0x2ae8('0x8')]=_0x4957a1['value'][_0x2ae8('0x20')]();utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x27'),_0x4957a1['uniqueid'],queues[_0x4957a1[_0x2ae8('0x5')]]['name'],_0x4957a1[_0x2ae8('0x1f')],queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x8')]));writeDB(queues[_0x4957a1['uniqueid']]);}}else if(!_[_0x2ae8('0x22')](_0x4957a1['variable']['queueposition'])){if(!_['isNil'](queues[_0x4957a1[_0x2ae8('0x5')]])&&!queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x23')]){queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x23')]=![];queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x24')]=null;queues[_0x4957a1[_0x2ae8('0x5')]]['queuecallerexit']=!![];queues[_0x4957a1[_0x2ae8('0x5')]]['queuecallerexitAt']=utils[_0x2ae8('0x11')]();queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x8')]='EXITWITHKEY';utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x28'),_0x4957a1['uniqueid'],queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x19')],_0x4957a1[_0x2ae8('0x1f')],queues[_0x4957a1[_0x2ae8('0x5')]][_0x2ae8('0x8')]));}}}catch(_0x45ace0){utils[_0x2ae8('0x12')](util[_0x2ae8('0x3')](_0x2ae8('0x29'),_0x4957a1['uniqueid']),_0x45ace0);}};exports[_0x2ae8('0x23')]=function(_0xab57f8){try{if(!_[_0x2ae8('0x22')](queues[_0xab57f8[_0x2ae8('0x5')]])){utils[_0x2ae8('0x14')](util[_0x2ae8('0x3')](_0x2ae8('0x2a'),_0xab57f8[_0x2ae8('0x5')]),_0xab57f8);queues[_0xab57f8['uniqueid']][_0x2ae8('0x25')]=![];queues[_0xab57f8[_0x2ae8('0x5')]][_0x2ae8('0x26')]=null;queues[_0xab57f8['uniqueid']]['queuecallerabandon']=!![];queues[_0xab57f8[_0x2ae8('0x5')]][_0x2ae8('0x24')]=utils[_0x2ae8('0x11')]();queues[_0xab57f8['uniqueid']][_0x2ae8('0x8')]=_0x2ae8('0x2b');utils['info'](util[_0x2ae8('0x3')](_0x2ae8('0x2c'),_0xab57f8[_0x2ae8('0x5')],queues[_0xab57f8[_0x2ae8('0x5')]][_0x2ae8('0x19')],queues[_0xab57f8[_0x2ae8('0x5')]][_0x2ae8('0x8')]));}}catch(_0x26baee){utils[_0x2ae8('0x12')](util[_0x2ae8('0x3')](_0x2ae8('0x2a'),_0xab57f8[_0x2ae8('0x5')]),_0x26baee);}};exports['queuecallerleave']=function(_0x5e1e2c){try{if(!_[_0x2ae8('0x22')](queues[_0x5e1e2c[_0x2ae8('0x5')]])){utils[_0x2ae8('0x14')](util['format'](_0x2ae8('0x2d'),_0x5e1e2c[_0x2ae8('0x5')]),_0x5e1e2c);utils['info'](util[_0x2ae8('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5e1e2c['uniqueid'],queues[_0x5e1e2c['uniqueid']][_0x2ae8('0x19')],_0x5e1e2c[_0x2ae8('0x2e')],_0x5e1e2c[_0x2ae8('0x2f')]));queues[_0x5e1e2c['uniqueid']][_0x2ae8('0x30')]=!![];queues[_0x5e1e2c[_0x2ae8('0x5')]][_0x2ae8('0x31')]=utils[_0x2ae8('0x11')]();queues[_0x5e1e2c['uniqueid']]['holdtime']=utils[_0x2ae8('0x32')](queues[_0x5e1e2c['uniqueid']][_0x2ae8('0x31')],queues[_0x5e1e2c[_0x2ae8('0x5')]]['queuecallerjoinAt']);queues[_0x5e1e2c[_0x2ae8('0x5')]][_0x2ae8('0xf')]=_0x5e1e2c['position'];queues[_0x5e1e2c[_0x2ae8('0x5')]][_0x2ae8('0x33')]=_0x5e1e2c[_0x2ae8('0x33')];queues[_0x5e1e2c[_0x2ae8('0x5')]][_0x2ae8('0x2e')]=_0x5e1e2c[_0x2ae8('0x2e')];queues[_0x5e1e2c[_0x2ae8('0x5')]]['connectedlinename']=_0x5e1e2c['connectedlinename'];}}catch(_0x5df59c){utils[_0x2ae8('0x12')](util[_0x2ae8('0x3')](_0x2ae8('0x2d'),_0x5e1e2c['uniqueid']),_0x5df59c);}};exports[_0x2ae8('0x34')]=function(_0x559081){try{if(!_[_0x2ae8('0x22')](queues[_0x559081[_0x2ae8('0x5')]])){utils[_0x2ae8('0x14')](util['format'](_0x2ae8('0x35'),_0x559081[_0x2ae8('0x5')]),_0x559081);utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x36'),_0x559081[_0x2ae8('0x5')],queues[_0x559081[_0x2ae8('0x5')]][_0x2ae8('0x19')],_0x559081['membername'],_0x559081[_0x2ae8('0x37')]));queues[_0x559081[_0x2ae8('0x5')]][_0x2ae8('0x23')]=![];queues[_0x559081['uniqueid']][_0x2ae8('0x23')]=![];queues[_0x559081['uniqueid']][_0x2ae8('0x24')]=null;queues[_0x559081['uniqueid']]['queuecallerexit']=![];queues[_0x559081['uniqueid']][_0x2ae8('0x8')]=null;queues[_0x559081[_0x2ae8('0x5')]][_0x2ae8('0x26')]=null;queues[_0x559081['uniqueid']][_0x2ae8('0x38')]=!![];queues[_0x559081[_0x2ae8('0x5')]]['accountcode']=_0x559081[_0x2ae8('0x37')];queues[_0x559081[_0x2ae8('0x5')]][_0x2ae8('0x7')]=_0x559081[_0x2ae8('0x39')];}}catch(_0x17bc51){utils[_0x2ae8('0x12')](util['format'](_0x2ae8('0x35'),_0x559081[_0x2ae8('0x5')]),_0x17bc51);}};exports[_0x2ae8('0x3a')]=function(_0xbe1d3b){try{if(!_[_0x2ae8('0x22')](queues[_0xbe1d3b[_0x2ae8('0x5')]])){if(queues[_0xbe1d3b[_0x2ae8('0x5')]][_0x2ae8('0x31')]){utils[_0x2ae8('0x14')](util[_0x2ae8('0x3')](_0x2ae8('0x3b'),_0xbe1d3b[_0x2ae8('0x5')]),_0xbe1d3b);queues[_0xbe1d3b['uniqueid']][_0x2ae8('0x23')]=![];queues[_0xbe1d3b[_0x2ae8('0x5')]][_0x2ae8('0x23')]=![];queues[_0xbe1d3b['uniqueid']][_0x2ae8('0x24')]=null;queues[_0xbe1d3b['uniqueid']][_0x2ae8('0x25')]=![];queues[_0xbe1d3b['uniqueid']][_0x2ae8('0x26')]=null;queues[_0xbe1d3b[_0x2ae8('0x5')]]['assigned']=!![];queues[_0xbe1d3b['uniqueid']][_0x2ae8('0x7')]=_0xbe1d3b[_0x2ae8('0x39')];queues[_0xbe1d3b[_0x2ae8('0x5')]][_0x2ae8('0x16')]=!![];queues[_0xbe1d3b[_0x2ae8('0x5')]][_0x2ae8('0x17')]=utils['now']();if(_0xbe1d3b['reason']==_0x2ae8('0x3c')){if(!queues[_0xbe1d3b[_0x2ae8('0x5')]][_0x2ae8('0x3c')]){queues[_0xbe1d3b['uniqueid']]['queuecallerexitreason']=_0x2ae8('0x3d');}}else{queues[_0xbe1d3b[_0x2ae8('0x5')]]['queuecallerexitreason']=_0x2ae8('0x3e')+_0xbe1d3b['reason']['toUpperCase']();}utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x3f'),_0xbe1d3b['uniqueid'],queues[_0xbe1d3b[_0x2ae8('0x5')]][_0x2ae8('0x19')],_0xbe1d3b[_0x2ae8('0x39')],queues[_0xbe1d3b['uniqueid']][_0x2ae8('0x8')]));writeDB(queues[_0xbe1d3b[_0x2ae8('0x5')]]);}}}catch(_0x4c0296){utils['error'](util['format'](_0x2ae8('0x3b'),_0xbe1d3b[_0x2ae8('0x5')]),_0x4c0296);}};exports[_0x2ae8('0x40')]=function(_0x92af9){try{if(!_[_0x2ae8('0x22')](queues[_0x92af9[_0x2ae8('0x41')]])){utils[_0x2ae8('0x14')](util[_0x2ae8('0x3')]('[%s][queues][blindtransfer]',_0x92af9['uniqueid']),_0x92af9);queues[_0x92af9[_0x2ae8('0x41')]][_0x2ae8('0x3c')]=!![];queues[_0x92af9['transfereeuniqueid']][_0x2ae8('0x42')]=_0x2ae8('0x43');queues[_0x92af9[_0x2ae8('0x41')]]['transferexten']=_0x92af9[_0x2ae8('0x44')];queues[_0x92af9[_0x2ae8('0x41')]][_0x2ae8('0x45')]=_0x92af9[_0x2ae8('0x41')];queues[_0x92af9[_0x2ae8('0x41')]][_0x2ae8('0x8')]=_0x2ae8('0x46');utils[_0x2ae8('0x2')](util['format'](_0x2ae8('0x47'),_0x92af9[_0x2ae8('0x5')],queues[_0x92af9[_0x2ae8('0x41')]][_0x2ae8('0x19')],_0x92af9[_0x2ae8('0x41')],_0x92af9[_0x2ae8('0x44')]));}}catch(_0x48067f){utils[_0x2ae8('0x12')](util[_0x2ae8('0x3')](_0x2ae8('0x48'),_0x92af9[_0x2ae8('0x5')]),_0x48067f);}};exports[_0x2ae8('0x49')]=function(_0x4c2494){try{utils[_0x2ae8('0x14')](util[_0x2ae8('0x3')](_0x2ae8('0x4a'),_0x4c2494[_0x2ae8('0x4b')]),_0x4c2494);if(_0x4c2494[_0x2ae8('0x4b')]==_0x4c2494[_0x2ae8('0x4c')]){if(!_[_0x2ae8('0x22')](queues[_0x4c2494['secondtransfererlinkedid']])){utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x4d'),_0x4c2494[_0x2ae8('0x4b')],queues[_0x4c2494[_0x2ae8('0x4e')]][_0x2ae8('0x19')],_0x4c2494[_0x2ae8('0x4f')]));queues[_0x4c2494['secondtransfererlinkedid']][_0x2ae8('0x3c')]=!![];queues[_0x4c2494[_0x2ae8('0x4e')]][_0x2ae8('0x42')]='ATTENDED';queues[_0x4c2494[_0x2ae8('0x4e')]][_0x2ae8('0x50')]=_0x4c2494[_0x2ae8('0x4f')];queues[_0x4c2494[_0x2ae8('0x4e')]][_0x2ae8('0x45')]=_0x4c2494['origtransfereruniqueid'];queues[_0x4c2494[_0x2ae8('0x4e')]]['queuecallerexitreason']=_0x2ae8('0x51');}if(!_['isNil'](queues[_0x4c2494['origtransfererlinkedid']])){if(_0x4c2494[_0x2ae8('0x52')]&&queues[_0x4c2494['transfereelinkedid']]){queues[_0x4c2494[_0x2ae8('0x52')]]['queuecallerenterreason']=0x1;queues[_0x4c2494[_0x2ae8('0x41')]]=_[_0x2ae8('0x53')](queues[_0x4c2494[_0x2ae8('0x52')]]);queues[_0x4c2494[_0x2ae8('0x41')]][_0x2ae8('0xd')]=_0x4c2494[_0x2ae8('0x54')];queues[_0x4c2494['transfereeuniqueid']][_0x2ae8('0x1b')]=0x2;queues[_0x4c2494[_0x2ae8('0x41')]]['calleridnum']=queues[_0x4c2494[_0x2ae8('0x4e')]][_0x2ae8('0x55')];queues[_0x4c2494[_0x2ae8('0x41')]][_0x2ae8('0x56')]=queues[_0x4c2494['secondtransfererlinkedid']][_0x2ae8('0x56')];queues[_0x4c2494['transfereeuniqueid']][_0x2ae8('0x57')]=utils[_0x2ae8('0x11')]();queues[_0x4c2494['transfereeuniqueid']][_0x2ae8('0x31')]=utils[_0x2ae8('0x11')]();queues[_0x4c2494[_0x2ae8('0x41')]]['holdtime']=0x0;queues[_0x4c2494['transfereeuniqueid']][_0x2ae8('0x58')]=0x0;utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x59'),_0x4c2494[_0x2ae8('0x4b')],queues[_0x4c2494[_0x2ae8('0x41')]][_0x2ae8('0x19')],queues[_0x4c2494[_0x2ae8('0x41')]][_0x2ae8('0x55')],queues[_0x4c2494[_0x2ae8('0x41')]][_0x2ae8('0x56')]));}else{utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x5a'),_0x4c2494[_0x2ae8('0x4b')],queues[_0x4c2494[_0x2ae8('0x4c')]][_0x2ae8('0x19')],_0x4c2494['secondtransfererlinkedid']));queues[_0x4c2494[_0x2ae8('0x4c')]][_0x2ae8('0xd')]=_0x4c2494[_0x2ae8('0x4e')];}}}else if(_0x4c2494['secondtransfereruniqueid']==_0x4c2494[_0x2ae8('0x4e')]){if(!_['isNil'](queues[_0x4c2494[_0x2ae8('0x4c')]])){utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x5b'),_0x4c2494[_0x2ae8('0x4b')],queues[_0x4c2494['origtransfererlinkedid']]['name'],_0x4c2494['secondtransfereruniqueid'],_0x4c2494[_0x2ae8('0x5c')]));queues[_0x4c2494[_0x2ae8('0x4c')]][_0x2ae8('0x3c')]=!![];queues[_0x4c2494['origtransfererlinkedid']][_0x2ae8('0x42')]=_0x2ae8('0x5d');queues[_0x4c2494[_0x2ae8('0x4c')]][_0x2ae8('0x50')]=_0x4c2494[_0x2ae8('0x5c')];queues[_0x4c2494['origtransfererlinkedid']]['transferuniqueid']=_0x4c2494[_0x2ae8('0x5e')];queues[_0x4c2494[_0x2ae8('0x4c')]][_0x2ae8('0x8')]=_0x2ae8('0x51');}if(!_['isNil'](queues[_0x4c2494[_0x2ae8('0x4e')]])){if(_0x4c2494[_0x2ae8('0x5f')]&&queues[_0x4c2494[_0x2ae8('0x5f')]]){queues[_0x4c2494[_0x2ae8('0x5f')]][_0x2ae8('0x1b')]=0x1;queues[_0x4c2494[_0x2ae8('0x54')]]=_['clone'](queues[_0x4c2494[_0x2ae8('0x5f')]]);queues[_0x4c2494[_0x2ae8('0x54')]][_0x2ae8('0xd')]=_0x4c2494['transfertargetuniqueid'];queues[_0x4c2494[_0x2ae8('0x54')]][_0x2ae8('0x1b')]=0x2;queues[_0x4c2494['transfertargetuniqueid']][_0x2ae8('0x55')]=queues[_0x4c2494[_0x2ae8('0x4c')]]['calleridnum'];queues[_0x4c2494['transfertargetuniqueid']][_0x2ae8('0x56')]=queues[_0x4c2494[_0x2ae8('0x4c')]][_0x2ae8('0x56')];queues[_0x4c2494['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x2ae8('0x11')]();queues[_0x4c2494['transfertargetuniqueid']][_0x2ae8('0x31')]=utils[_0x2ae8('0x11')]();queues[_0x4c2494[_0x2ae8('0x54')]][_0x2ae8('0x60')]=0x0;queues[_0x4c2494[_0x2ae8('0x54')]]['mohtime']=0x0;utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')](_0x2ae8('0x61'),_0x4c2494['origtransfereruniqueid'],queues[_0x4c2494[_0x2ae8('0x54')]][_0x2ae8('0x19')],queues[_0x4c2494[_0x2ae8('0x54')]][_0x2ae8('0xd')],queues[_0x4c2494[_0x2ae8('0x54')]][_0x2ae8('0x55')],queues[_0x4c2494[_0x2ae8('0x54')]]['calleridname']));}else{utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4c2494[_0x2ae8('0x4b')],queues[_0x4c2494[_0x2ae8('0x4e')]][_0x2ae8('0x19')],_0x4c2494['origtransfererlinkedid']));queues[_0x4c2494[_0x2ae8('0x4e')]]['transfereduniqueid']=_0x4c2494[_0x2ae8('0x4c')];}}}}catch(_0x8d5c58){utils['error'](util[_0x2ae8('0x3')](_0x2ae8('0x4a'),_0x4c2494[_0x2ae8('0x4b')]),_0x8d5c58);}};exports[_0x2ae8('0x62')]=function(_0x3c9b19){try{if(!_[_0x2ae8('0x22')](queues[_0x3c9b19[_0x2ae8('0x5')]])){utils[_0x2ae8('0x14')](util[_0x2ae8('0x3')](_0x2ae8('0x63'),_0x3c9b19['uniqueid']),_0x3c9b19);queues[_0x3c9b19[_0x2ae8('0x5')]]['musiconholdstartAt']=utils[_0x2ae8('0x11')]();utils[_0x2ae8('0x2')](util['format'](_0x2ae8('0x64'),_0x3c9b19[_0x2ae8('0x5')],queues[_0x3c9b19[_0x2ae8('0x5')]]['name'],queues[_0x3c9b19[_0x2ae8('0x5')]]['musiconholdstartAt']));}}catch(_0x38cf6a){utils[_0x2ae8('0x12')](util['format'](_0x2ae8('0x63'),_0x3c9b19[_0x2ae8('0x5')]),_0x38cf6a);}};exports[_0x2ae8('0x65')]=function(_0x54a0e0){try{if(!_[_0x2ae8('0x22')](queues[_0x54a0e0[_0x2ae8('0x5')]])){if(!_[_0x2ae8('0x22')](queues[_0x54a0e0[_0x2ae8('0x5')]][_0x2ae8('0x66')])){utils['debug'](util[_0x2ae8('0x3')]('[%s][queues][musiconholdstop]',_0x54a0e0[_0x2ae8('0x5')]),_0x54a0e0);queues[_0x54a0e0[_0x2ae8('0x5')]][_0x2ae8('0x58')]+=utils[_0x2ae8('0x32')](utils[_0x2ae8('0x11')](),queues[_0x54a0e0[_0x2ae8('0x5')]][_0x2ae8('0x66')]);utils[_0x2ae8('0x2')](util[_0x2ae8('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x54a0e0[_0x2ae8('0x5')],queues[_0x54a0e0[_0x2ae8('0x5')]]['name'],queues[_0x54a0e0[_0x2ae8('0x5')]][_0x2ae8('0x58')]));delete queues[_0x54a0e0[_0x2ae8('0x5')]]['musiconholdstartAt'];}}}catch(_0x121306){utils[_0x2ae8('0x12')](util[_0x2ae8('0x3')](_0x2ae8('0x67'),_0x54a0e0[_0x2ae8('0x5')]),_0x121306);}}; \ No newline at end of file +var _0x7a0c=['then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','now','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','isNil','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','secondtransfererlinkedid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName'];(function(_0x32e33c,_0x2c4cf7){var _0x1805a2=function(_0x34ec7e){while(--_0x34ec7e){_0x32e33c['push'](_0x32e33c['shift']());}};_0x1805a2(++_0x2c4cf7);}(_0x7a0c,0xcb));var _0xc7a0=function(_0x1ef8ec,_0x77b1eb){_0x1ef8ec=_0x1ef8ec-0x0;var _0x23667a=_0x7a0c[_0x1ef8ec];return _0x23667a;};'use strict';var _=require(_0xc7a0('0x0'));var util=require(_0xc7a0('0x1'));var utils=require(_0xc7a0('0x2'));var queues={};function writeDB(_0x318232){utils['info'](util[_0xc7a0('0x3')](_0xc7a0('0x4'),_0x318232[_0xc7a0('0x5')],_0x318232['channel'],_0x318232[_0xc7a0('0x6')],_0x318232[_0xc7a0('0x7')],_0x318232['calleridnum'],_0x318232[_0xc7a0('0x8')],_0x318232[_0xc7a0('0x9')]));if(_0x318232['queue']){utils[_0xc7a0('0xa')](_0x318232[_0xc7a0('0x6')])[_0xc7a0('0xb')](function(_0x55a512){if(_0x55a512){_0x318232['type']=_0x55a512[_0xc7a0('0xc')];}utils['request'](_0xc7a0('0xd'),_0x318232);});}else{utils[_0xc7a0('0xe')](_0xc7a0('0xd'),_0x318232);}if(_0x318232[_0xc7a0('0xf')]){delete queues[_0x318232[_0xc7a0('0xf')]];}else{delete queues[_0x318232[_0xc7a0('0x5')]];}}exports[_0xc7a0('0x10')]=function(_0x539bab){try{utils[_0xc7a0('0x11')](util[_0xc7a0('0x3')](_0xc7a0('0x12'),_0x539bab[_0xc7a0('0x5')]),_0x539bab);utils['info'](util[_0xc7a0('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x539bab['uniqueid'],_0x539bab['queue'],_0x539bab['position']));queues[_0x539bab['uniqueid']]=_['assign'](_0x539bab,{'originalposition':_0x539bab[_0xc7a0('0x13')],'queuecallerjoinAt':utils[_0xc7a0('0x14')](),'mohtime':0x0});}catch(_0x32c382){utils['error'](util[_0xc7a0('0x3')]('[%s][queues][queuecallerjoin]',_0x539bab['uniqueid']),_0x32c382);}};exports[_0xc7a0('0x15')]=function(_0x96560a){try{if(!_['isNil'](queues[_0x96560a[_0xc7a0('0x5')]])){utils['debug'](util[_0xc7a0('0x3')]('[%s][queues][hangup]',_0x96560a[_0xc7a0('0x5')]),_0x96560a);if(queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0x16')]){if(!queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0x17')]&&!queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0x18')]){queues[_0x96560a[_0xc7a0('0x5')]]['queuecallercomplete']=!![];queues[_0x96560a['uniqueid']][_0xc7a0('0x19')]=utils[_0xc7a0('0x14')]();queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0x9')]=_0xc7a0('0x1a');}utils[_0xc7a0('0x1b')](util['format'](_0xc7a0('0x1c'),_0x96560a['uniqueid'],queues[_0x96560a['uniqueid']][_0xc7a0('0x1d')],queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0x9')]));writeDB(queues[_0x96560a['uniqueid']]);}else if(queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0xf')]){utils[_0xc7a0('0x1b')](util[_0xc7a0('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x96560a[_0xc7a0('0x5')],queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0x1d')],queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0xf')]));queues[queues[_0x96560a[_0xc7a0('0x5')]]['transfereduniqueid']]=queues[_0x96560a[_0xc7a0('0x5')]];queues[queues[_0x96560a[_0xc7a0('0x5')]][_0xc7a0('0xf')]][_0xc7a0('0x1e')]=0x2;delete queues[_0x96560a['uniqueid']];}}}catch(_0x573b2e){utils['error'](util[_0xc7a0('0x3')](_0xc7a0('0x1f'),_0x96560a[_0xc7a0('0x5')]),_0x573b2e);}};exports[_0xc7a0('0x20')]=function(_0x1992da){try{utils[_0xc7a0('0x11')](util[_0xc7a0('0x3')](_0xc7a0('0x21'),_0x1992da[_0xc7a0('0x5')]),_0x1992da);if(!_['isNil'](_0x1992da['variable'][_0xc7a0('0x22')])&&_0x1992da[_0xc7a0('0x23')][_0xc7a0('0x24')]()!==_0xc7a0('0x25')){if(!_['isNil'](queues[_0x1992da[_0xc7a0('0x5')]])){queues[_0x1992da[_0xc7a0('0x5')]]['queuecallerabandon']=![];queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x26')]=null;queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x18')]=!![];queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x27')]=utils[_0xc7a0('0x14')]();queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x9')]=_0x1992da['value'][_0xc7a0('0x24')]();utils[_0xc7a0('0x1b')](util['format'](_0xc7a0('0x28'),_0x1992da['uniqueid'],queues[_0x1992da['uniqueid']][_0xc7a0('0x1d')],_0x1992da[_0xc7a0('0x23')],queues[_0x1992da[_0xc7a0('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x1992da[_0xc7a0('0x5')]]);}}else if(!_[_0xc7a0('0x29')](_0x1992da[_0xc7a0('0x2a')][_0xc7a0('0x2b')])){if(!_['isNil'](queues[_0x1992da['uniqueid']])&&!queues[_0x1992da['uniqueid']][_0xc7a0('0x17')]){queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x17')]=![];queues[_0x1992da['uniqueid']][_0xc7a0('0x26')]=null;queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x18')]=!![];queues[_0x1992da['uniqueid']][_0xc7a0('0x27')]=utils[_0xc7a0('0x14')]();queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x9')]=_0xc7a0('0x2c');utils['info'](util[_0xc7a0('0x3')](_0xc7a0('0x2d'),_0x1992da['uniqueid'],queues[_0x1992da[_0xc7a0('0x5')]][_0xc7a0('0x1d')],_0x1992da[_0xc7a0('0x23')],queues[_0x1992da[_0xc7a0('0x5')]]['queuecallerexitreason']));}}}catch(_0x455407){utils[_0xc7a0('0x2e')](util[_0xc7a0('0x3')](_0xc7a0('0x21'),_0x1992da['uniqueid']),_0x455407);}};exports[_0xc7a0('0x17')]=function(_0x1c559c){try{if(!_['isNil'](queues[_0x1c559c[_0xc7a0('0x5')]])){utils[_0xc7a0('0x11')](util[_0xc7a0('0x3')]('[%s][queues][queuecallerabandon]',_0x1c559c['uniqueid']),_0x1c559c);queues[_0x1c559c[_0xc7a0('0x5')]][_0xc7a0('0x18')]=![];queues[_0x1c559c[_0xc7a0('0x5')]][_0xc7a0('0x27')]=null;queues[_0x1c559c[_0xc7a0('0x5')]][_0xc7a0('0x17')]=!![];queues[_0x1c559c['uniqueid']][_0xc7a0('0x26')]=utils[_0xc7a0('0x14')]();queues[_0x1c559c[_0xc7a0('0x5')]][_0xc7a0('0x9')]=_0xc7a0('0x2f');utils['info'](util[_0xc7a0('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1c559c[_0xc7a0('0x5')],queues[_0x1c559c[_0xc7a0('0x5')]][_0xc7a0('0x1d')],queues[_0x1c559c[_0xc7a0('0x5')]]['queuecallerexitreason']));}}catch(_0x24f3b4){utils[_0xc7a0('0x2e')](util[_0xc7a0('0x3')](_0xc7a0('0x30'),_0x1c559c[_0xc7a0('0x5')]),_0x24f3b4);}};exports[_0xc7a0('0x31')]=function(_0x3d3d7f){try{if(!_['isNil'](queues[_0x3d3d7f[_0xc7a0('0x5')]])){utils['debug'](util[_0xc7a0('0x3')](_0xc7a0('0x32'),_0x3d3d7f[_0xc7a0('0x5')]),_0x3d3d7f);utils[_0xc7a0('0x1b')](util[_0xc7a0('0x3')](_0xc7a0('0x33'),_0x3d3d7f[_0xc7a0('0x5')],queues[_0x3d3d7f[_0xc7a0('0x5')]]['name'],_0x3d3d7f[_0xc7a0('0x34')],_0x3d3d7f[_0xc7a0('0x35')]));queues[_0x3d3d7f[_0xc7a0('0x5')]][_0xc7a0('0x31')]=!![];queues[_0x3d3d7f['uniqueid']][_0xc7a0('0x16')]=utils[_0xc7a0('0x14')]();queues[_0x3d3d7f[_0xc7a0('0x5')]][_0xc7a0('0x36')]=utils[_0xc7a0('0x37')](queues[_0x3d3d7f[_0xc7a0('0x5')]][_0xc7a0('0x16')],queues[_0x3d3d7f[_0xc7a0('0x5')]][_0xc7a0('0x38')]);queues[_0x3d3d7f[_0xc7a0('0x5')]][_0xc7a0('0x13')]=_0x3d3d7f[_0xc7a0('0x13')];queues[_0x3d3d7f[_0xc7a0('0x5')]][_0xc7a0('0x39')]=_0x3d3d7f[_0xc7a0('0x39')];queues[_0x3d3d7f[_0xc7a0('0x5')]]['connectedlinenum']=_0x3d3d7f[_0xc7a0('0x34')];queues[_0x3d3d7f['uniqueid']]['connectedlinename']=_0x3d3d7f[_0xc7a0('0x35')];}}catch(_0x1e4f14){utils[_0xc7a0('0x2e')](util[_0xc7a0('0x3')]('[%s][queues][queuecallerleave]',_0x3d3d7f[_0xc7a0('0x5')]),_0x1e4f14);}};exports[_0xc7a0('0x3a')]=function(_0x4ccb6f){try{if(!_[_0xc7a0('0x29')](queues[_0x4ccb6f[_0xc7a0('0x5')]])){utils[_0xc7a0('0x11')](util['format'](_0xc7a0('0x3b'),_0x4ccb6f[_0xc7a0('0x5')]),_0x4ccb6f);utils[_0xc7a0('0x1b')](util[_0xc7a0('0x3')](_0xc7a0('0x3c'),_0x4ccb6f[_0xc7a0('0x5')],queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x1d')],_0x4ccb6f[_0xc7a0('0x3d')],_0x4ccb6f['destaccountcode']));queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x17')]=![];queues[_0x4ccb6f[_0xc7a0('0x5')]]['queuecallerabandon']=![];queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x26')]=null;queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x18')]=![];queues[_0x4ccb6f['uniqueid']][_0xc7a0('0x9')]=null;queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x27')]=null;queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x3e')]=!![];queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x8')]=_0x4ccb6f['destaccountcode'];queues[_0x4ccb6f[_0xc7a0('0x5')]][_0xc7a0('0x7')]=_0x4ccb6f[_0xc7a0('0x3d')];}}catch(_0xa03ccd){utils[_0xc7a0('0x2e')](util[_0xc7a0('0x3')]('[%s][queues][agentconnect]',_0x4ccb6f[_0xc7a0('0x5')]),_0xa03ccd);}};exports[_0xc7a0('0x3f')]=function(_0x3fe8de){try{if(!_[_0xc7a0('0x29')](queues[_0x3fe8de['uniqueid']])){if(queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x16')]){utils[_0xc7a0('0x11')](util['format']('[%s][queues][agentcomplete]',_0x3fe8de[_0xc7a0('0x5')]),_0x3fe8de);queues[_0x3fe8de['uniqueid']][_0xc7a0('0x17')]=![];queues[_0x3fe8de['uniqueid']]['queuecallerabandon']=![];queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x26')]=null;queues[_0x3fe8de['uniqueid']][_0xc7a0('0x18')]=![];queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x27')]=null;queues[_0x3fe8de['uniqueid']][_0xc7a0('0x3e')]=!![];queues[_0x3fe8de[_0xc7a0('0x5')]]['lastAssignedTo']=_0x3fe8de[_0xc7a0('0x3d')];queues[_0x3fe8de['uniqueid']]['queuecallercomplete']=!![];queues[_0x3fe8de['uniqueid']]['queuecallercompleteAt']=utils[_0xc7a0('0x14')]();if(_0x3fe8de[_0xc7a0('0x40')]==_0xc7a0('0x41')){if(!queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x41')]){queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x9')]=_0xc7a0('0x42');}}else{queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x9')]=_0xc7a0('0x43')+_0x3fe8de[_0xc7a0('0x40')][_0xc7a0('0x24')]();}utils[_0xc7a0('0x1b')](util[_0xc7a0('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3fe8de[_0xc7a0('0x5')],queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x1d')],_0x3fe8de[_0xc7a0('0x3d')],queues[_0x3fe8de[_0xc7a0('0x5')]][_0xc7a0('0x9')]));writeDB(queues[_0x3fe8de[_0xc7a0('0x5')]]);}}}catch(_0x22ece3){utils[_0xc7a0('0x2e')](util[_0xc7a0('0x3')](_0xc7a0('0x44'),_0x3fe8de[_0xc7a0('0x5')]),_0x22ece3);}};exports[_0xc7a0('0x45')]=function(_0x241285){try{if(!_[_0xc7a0('0x29')](queues[_0x241285['transfereeuniqueid']])){utils[_0xc7a0('0x11')](util[_0xc7a0('0x3')]('[%s][queues][blindtransfer]',_0x241285[_0xc7a0('0x5')]),_0x241285);queues[_0x241285['transfereeuniqueid']][_0xc7a0('0x41')]=!![];queues[_0x241285[_0xc7a0('0x46')]][_0xc7a0('0x47')]=_0xc7a0('0x48');queues[_0x241285[_0xc7a0('0x46')]][_0xc7a0('0x49')]=_0x241285[_0xc7a0('0x4a')];queues[_0x241285[_0xc7a0('0x46')]][_0xc7a0('0x4b')]=_0x241285['transfereeuniqueid'];queues[_0x241285[_0xc7a0('0x46')]][_0xc7a0('0x9')]=_0xc7a0('0x4c');utils['info'](util[_0xc7a0('0x3')](_0xc7a0('0x4d'),_0x241285[_0xc7a0('0x5')],queues[_0x241285[_0xc7a0('0x46')]][_0xc7a0('0x1d')],_0x241285[_0xc7a0('0x46')],_0x241285[_0xc7a0('0x4a')]));}}catch(_0x41600e){utils[_0xc7a0('0x2e')](util['format'](_0xc7a0('0x4e'),_0x241285['uniqueid']),_0x41600e);}};exports[_0xc7a0('0x4f')]=function(_0x4f0679){try{utils[_0xc7a0('0x11')](util['format'](_0xc7a0('0x50'),_0x4f0679['origtransfereruniqueid']),_0x4f0679);if(_0x4f0679['origtransfereruniqueid']==_0x4f0679[_0xc7a0('0x51')]){if(!_[_0xc7a0('0x29')](queues[_0x4f0679['secondtransfererlinkedid']])){utils['info'](util['format'](_0xc7a0('0x52'),_0x4f0679[_0xc7a0('0x53')],queues[_0x4f0679['secondtransfererlinkedid']][_0xc7a0('0x1d')],_0x4f0679['origtransfererexten']));queues[_0x4f0679[_0xc7a0('0x54')]]['transfer']=!![];queues[_0x4f0679[_0xc7a0('0x54')]]['transfertype']='ATTENDED';queues[_0x4f0679['secondtransfererlinkedid']][_0xc7a0('0x49')]=_0x4f0679['origtransfererexten'];queues[_0x4f0679[_0xc7a0('0x54')]][_0xc7a0('0x4b')]=_0x4f0679[_0xc7a0('0x53')];queues[_0x4f0679[_0xc7a0('0x54')]]['queuecallerexitreason']=_0xc7a0('0x55');}if(!_[_0xc7a0('0x29')](queues[_0x4f0679[_0xc7a0('0x51')]])){if(_0x4f0679[_0xc7a0('0x56')]&&queues[_0x4f0679[_0xc7a0('0x56')]]){queues[_0x4f0679[_0xc7a0('0x56')]][_0xc7a0('0x1e')]=0x1;queues[_0x4f0679[_0xc7a0('0x46')]]=_[_0xc7a0('0x57')](queues[_0x4f0679[_0xc7a0('0x56')]]);queues[_0x4f0679[_0xc7a0('0x46')]]['transfereduniqueid']=_0x4f0679[_0xc7a0('0x58')];queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x1e')]=0x2;queues[_0x4f0679['transfereeuniqueid']][_0xc7a0('0x59')]=queues[_0x4f0679[_0xc7a0('0x54')]][_0xc7a0('0x59')];queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x5a')]=queues[_0x4f0679['secondtransfererlinkedid']][_0xc7a0('0x5a')];queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x38')]=utils[_0xc7a0('0x14')]();queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x16')]=utils[_0xc7a0('0x14')]();queues[_0x4f0679[_0xc7a0('0x46')]]['holdtime']=0x0;queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x5b')]=0x0;utils[_0xc7a0('0x1b')](util['format'](_0xc7a0('0x5c'),_0x4f0679[_0xc7a0('0x53')],queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x1d')],queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x59')],queues[_0x4f0679[_0xc7a0('0x46')]][_0xc7a0('0x5a')]));}else{utils[_0xc7a0('0x1b')](util[_0xc7a0('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4f0679[_0xc7a0('0x53')],queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x1d')],_0x4f0679[_0xc7a0('0x54')]));queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0xf')]=_0x4f0679[_0xc7a0('0x54')];}}}else if(_0x4f0679[_0xc7a0('0x5d')]==_0x4f0679['secondtransfererlinkedid']){if(!_[_0xc7a0('0x29')](queues[_0x4f0679['origtransfererlinkedid']])){utils[_0xc7a0('0x1b')](util[_0xc7a0('0x3')](_0xc7a0('0x5e'),_0x4f0679[_0xc7a0('0x53')],queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x1d')],_0x4f0679[_0xc7a0('0x5d')],_0x4f0679[_0xc7a0('0x5f')]));queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x41')]=!![];queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x47')]=_0xc7a0('0x60');queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x49')]=_0x4f0679[_0xc7a0('0x5f')];queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x4b')]=_0x4f0679['secondtransfereruniqueid'];queues[_0x4f0679['origtransfererlinkedid']][_0xc7a0('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xc7a0('0x29')](queues[_0x4f0679[_0xc7a0('0x54')]])){if(_0x4f0679[_0xc7a0('0x61')]&&queues[_0x4f0679[_0xc7a0('0x61')]]){queues[_0x4f0679[_0xc7a0('0x61')]][_0xc7a0('0x1e')]=0x1;queues[_0x4f0679[_0xc7a0('0x58')]]=_[_0xc7a0('0x57')](queues[_0x4f0679[_0xc7a0('0x61')]]);queues[_0x4f0679[_0xc7a0('0x58')]][_0xc7a0('0xf')]=_0x4f0679[_0xc7a0('0x58')];queues[_0x4f0679[_0xc7a0('0x58')]]['queuecallerenterreason']=0x2;queues[_0x4f0679[_0xc7a0('0x58')]][_0xc7a0('0x59')]=queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x59')];queues[_0x4f0679['transfertargetuniqueid']]['calleridname']=queues[_0x4f0679[_0xc7a0('0x51')]][_0xc7a0('0x5a')];queues[_0x4f0679['transfertargetuniqueid']][_0xc7a0('0x38')]=utils[_0xc7a0('0x14')]();queues[_0x4f0679['transfertargetuniqueid']][_0xc7a0('0x16')]=utils['now']();queues[_0x4f0679[_0xc7a0('0x58')]][_0xc7a0('0x36')]=0x0;queues[_0x4f0679[_0xc7a0('0x58')]][_0xc7a0('0x5b')]=0x0;utils['info'](util[_0xc7a0('0x3')](_0xc7a0('0x62'),_0x4f0679[_0xc7a0('0x53')],queues[_0x4f0679[_0xc7a0('0x58')]][_0xc7a0('0x1d')],queues[_0x4f0679[_0xc7a0('0x58')]]['transfereduniqueid'],queues[_0x4f0679['transfertargetuniqueid']][_0xc7a0('0x59')],queues[_0x4f0679['transfertargetuniqueid']]['calleridname']));}else{utils[_0xc7a0('0x1b')](util[_0xc7a0('0x3')](_0xc7a0('0x63'),_0x4f0679[_0xc7a0('0x53')],queues[_0x4f0679[_0xc7a0('0x54')]][_0xc7a0('0x1d')],_0x4f0679['origtransfererlinkedid']));queues[_0x4f0679[_0xc7a0('0x54')]][_0xc7a0('0xf')]=_0x4f0679[_0xc7a0('0x51')];}}}}catch(_0x506f50){utils['error'](util['format'](_0xc7a0('0x50'),_0x4f0679['origtransfereruniqueid']),_0x506f50);}};exports[_0xc7a0('0x64')]=function(_0x1adb98){try{if(!_['isNil'](queues[_0x1adb98[_0xc7a0('0x5')]])){utils['debug'](util[_0xc7a0('0x3')]('[%s][queues][musiconholdstart]',_0x1adb98['uniqueid']),_0x1adb98);queues[_0x1adb98[_0xc7a0('0x5')]]['musiconholdstartAt']=utils[_0xc7a0('0x14')]();utils['info'](util[_0xc7a0('0x3')](_0xc7a0('0x65'),_0x1adb98['uniqueid'],queues[_0x1adb98[_0xc7a0('0x5')]][_0xc7a0('0x1d')],queues[_0x1adb98[_0xc7a0('0x5')]][_0xc7a0('0x66')]));}}catch(_0xf48407){utils[_0xc7a0('0x2e')](util[_0xc7a0('0x3')](_0xc7a0('0x67'),_0x1adb98[_0xc7a0('0x5')]),_0xf48407);}};exports[_0xc7a0('0x68')]=function(_0x143ada){try{if(!_['isNil'](queues[_0x143ada[_0xc7a0('0x5')]])){if(!_[_0xc7a0('0x29')](queues[_0x143ada[_0xc7a0('0x5')]]['musiconholdstartAt'])){utils[_0xc7a0('0x11')](util[_0xc7a0('0x3')]('[%s][queues][musiconholdstop]',_0x143ada[_0xc7a0('0x5')]),_0x143ada);queues[_0x143ada[_0xc7a0('0x5')]][_0xc7a0('0x5b')]+=utils[_0xc7a0('0x37')](utils[_0xc7a0('0x14')](),queues[_0x143ada[_0xc7a0('0x5')]]['musiconholdstartAt']);utils['info'](util['format'](_0xc7a0('0x69'),_0x143ada[_0xc7a0('0x5')],queues[_0x143ada['uniqueid']][_0xc7a0('0x1d')],queues[_0x143ada[_0xc7a0('0x5')]][_0xc7a0('0x5b')]));delete queues[_0x143ada['uniqueid']][_0xc7a0('0x66')];}}}catch(_0x5aa68a){utils[_0xc7a0('0x2e')](util[_0xc7a0('0x3')](_0xc7a0('0x6a'),_0x143ada[_0xc7a0('0x5')]),_0x5aa68a);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index d5a792a..6e1e598 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 _0xa626=['CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','membername','name','UserId'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0xa626,0x75));var _0x6a62=function(_0xcc23ef,_0x40f405){_0xcc23ef=_0xcc23ef-0x0;var _0x5ab95d=_0xa626[_0xcc23ef];return _0x5ab95d;};'use strict';var _=require(_0x6a62('0x0'));var util=require('util');var utils=require(_0x6a62('0x1'));var recordings={};function writeDB(_0xdf9cb0){utils[_0x6a62('0x2')](util['format'](_0x6a62('0x3'),_0xdf9cb0[_0x6a62('0x4')]));if(_0xdf9cb0[_0x6a62('0x5')]){utils['getUserByInternal'](_0xdf9cb0['accountcode'])['then'](function(_0x46573e){if(_0x46573e){_0xdf9cb0[_0x6a62('0x6')]=_0x46573e[_0x6a62('0x7')];_0xdf9cb0[_0x6a62('0x8')]=_0x46573e['id'];}utils['request'](_0x6a62('0x9'),_0xdf9cb0);});}else{utils['request'](_0x6a62('0x9'),_0xdf9cb0);}}exports['newchannel']=function(_0x4f60a6){try{utils[_0x6a62('0xa')](util[_0x6a62('0xb')](_0x6a62('0xc'),_0x4f60a6['uniqueid']),_0x4f60a6);if(_0x4f60a6[_0x6a62('0x4')]==_0x4f60a6[_0x6a62('0xd')]){utils['info'](util[_0x6a62('0xb')](_0x6a62('0xe'),_0x4f60a6['uniqueid'],_0x4f60a6[_0x6a62('0xf')],_0x4f60a6[_0x6a62('0x10')]));recordings[_0x4f60a6[_0x6a62('0x4')]]={'uniqueid':_0x4f60a6[_0x6a62('0x4')],'accountcode':_0x4f60a6[_0x6a62('0x5')],'exten':_0x4f60a6[_0x6a62('0x10')],'context':_0x4f60a6[_0x6a62('0xf')],'channel':_0x4f60a6[_0x6a62('0x11')],'monitors':[]};}}catch(_0x41b234){utils[_0x6a62('0x12')](util[_0x6a62('0xb')](_0x6a62('0xc'),_0x4f60a6[_0x6a62('0x4')]),_0x41b234);}};exports[_0x6a62('0x13')]=function(_0x17bc87){try{utils[_0x6a62('0xa')](util[_0x6a62('0xb')](_0x6a62('0x14'),_0x17bc87[_0x6a62('0x4')]),_0x17bc87);if(!_[_0x6a62('0x15')](recordings[_0x17bc87[_0x6a62('0x4')]])&&_0x17bc87[_0x6a62('0x16')]==0x6){utils['info'](util['format'](_0x6a62('0x17'),_0x17bc87['uniqueid'],_0x17bc87[_0x6a62('0xf')],_0x17bc87[_0x6a62('0x11')]));}else if(!_[_0x6a62('0x15')](recordings[_0x17bc87['linkedid']])&&_0x17bc87[_0x6a62('0x16')]==0x6&&_0x17bc87['context']!=_0x6a62('0x18')){utils[_0x6a62('0x2')](util['format'](_0x6a62('0x19'),_0x17bc87['uniqueid'],_0x17bc87[_0x6a62('0xd')],_0x17bc87[_0x6a62('0xf')],_0x17bc87['channel']));recordings[_0x17bc87['linkedid']][_0x6a62('0x5')]=_0x17bc87['accountcode'];}}catch(_0x5dfe7a){utils[_0x6a62('0x12')](util[_0x6a62('0xb')](_0x6a62('0x14'),_0x17bc87['uniqueid']),_0x5dfe7a);}};exports[_0x6a62('0x1a')]=function(_0xa01fff){try{if(!_[_0x6a62('0x15')](_0xa01fff[_0x6a62('0x1b')])&&!_['isNil'](_0xa01fff[_0x6a62('0x1b')][_0x6a62('0x1c')])){utils[_0x6a62('0xa')](util[_0x6a62('0xb')](_0x6a62('0x1d'),_0xa01fff[_0x6a62('0x4')]),_0xa01fff);utils[_0x6a62('0x2')](util[_0x6a62('0xb')](_0x6a62('0x1e'),_0xa01fff[_0x6a62('0x4')],_0xa01fff[_0x6a62('0x1b')],_0xa01fff['value']));if(_['endsWith'](_0xa01fff[_0x6a62('0x1f')],'.wav49')){_0xa01fff['value']=_0xa01fff[_0x6a62('0x1f')][_0x6a62('0x20')](_0x6a62('0x21'),'.WAV');}if(recordings[_0xa01fff[_0x6a62('0xd')]]){var _0x39d7b8=_[_0x6a62('0x22')](recordings[_0xa01fff[_0x6a62('0xd')]]['monitors'],{'value':_0xa01fff[_0x6a62('0x1f')]});if(_['isNil'](_0x39d7b8)){recordings[_0xa01fff[_0x6a62('0xd')]][_0x6a62('0x23')][_0x6a62('0x24')]({'value':_0xa01fff[_0x6a62('0x1f')]});}}}}catch(_0x1f2145){utils['error'](util['format']('[%s][recordings][varset]',_0xa01fff[_0x6a62('0x4')]),_0x1f2145);}};exports[_0x6a62('0x25')]=function(_0x168754){try{if(!_[_0x6a62('0x15')](recordings[_0x168754[_0x6a62('0x4')]])){utils['debug'](util[_0x6a62('0xb')](_0x6a62('0x26'),_0x168754[_0x6a62('0x4')]),_0x168754);utils[_0x6a62('0x2')](util[_0x6a62('0xb')](_0x6a62('0x27'),_0x168754['uniqueid'],_0x168754[_0x6a62('0x28')],_0x168754['calleridname'],_0x168754['cause-txt']));recordings[_0x168754['uniqueid']][_0x6a62('0x28')]=_0x168754['calleridnum'];recordings[_0x168754['uniqueid']][_0x6a62('0x29')]=_0x168754[_0x6a62('0x29')];recordings[_0x168754[_0x6a62('0x4')]]['connectedlinenum']=_0x168754[_0x6a62('0x2a')];recordings[_0x168754[_0x6a62('0x4')]]['connectedlinename']=_0x168754[_0x6a62('0x2b')];if(recordings[_0x168754['uniqueid']][_0x6a62('0x2c')]==_0x6a62('0x2d')&&recordings[_0x168754[_0x6a62('0x4')]][_0x6a62('0x5')]){recordings[_0x168754['uniqueid']]['connectedlinenum']=recordings[_0x168754[_0x6a62('0x4')]][_0x6a62('0x5')];recordings[_0x168754[_0x6a62('0x4')]]['connectedlinename']='';}recordings[_0x168754[_0x6a62('0x4')]][_0x6a62('0x23')][_0x6a62('0x2e')](function(_0x4adcb3){var _0x2c06ce=_['clone'](recordings[_0x168754[_0x6a62('0x4')]]);_0x2c06ce[_0x6a62('0x1f')]=_0x4adcb3[_0x6a62('0x1f')];writeDB(_0x2c06ce);});delete recordings[_0x168754[_0x6a62('0x4')]];}}catch(_0x195ded){utils['error'](util[_0x6a62('0xb')](_0x6a62('0x26'),_0x168754[_0x6a62('0x4')]),_0x195ded);}};exports[_0x6a62('0x2f')]=function(_0x2dc60d){try{if(!_[_0x6a62('0x15')](recordings[_0x2dc60d[_0x6a62('0x4')]])){utils['debug'](util[_0x6a62('0xb')](_0x6a62('0x30'),_0x2dc60d['uniqueid']),_0x2dc60d);utils[_0x6a62('0x2')](util['format'](_0x6a62('0x31'),_0x2dc60d[_0x6a62('0x4')],_0x2dc60d[_0x6a62('0x32')],_0x2dc60d['appdata']));if(_0x2dc60d['application']['toLowerCase']()==_0x6a62('0x33')&&_[_0x6a62('0x34')](_0x2dc60d[_0x6a62('0x35')][_0x6a62('0x36')](),_0x6a62('0x37'))){var _0xf8f8d3=_0x2dc60d[_0x6a62('0x35')][_0x6a62('0x38')]('=');var _0x514543=_0xf8f8d3[0x0][_0x6a62('0x39')](_0xf8f8d3[0x0][_0x6a62('0x3a')]('(')+0x1,_0xf8f8d3[0x0][_0x6a62('0x3a')](')'));var _0x138c8c=_0xf8f8d3[0x1];recordings[_0x2dc60d['uniqueid']][_0x514543]=_0x138c8c;}}}catch(_0x565728){utils[_0x6a62('0x12')](util[_0x6a62('0xb')]('[%s][recordings][newexten]',_0x2dc60d[_0x6a62('0x4')]),_0x565728);}};exports[_0x6a62('0x3b')]=function(_0x26a4df){try{if(!_[_0x6a62('0x15')](recordings[_0x26a4df[_0x6a62('0x4')]])){utils[_0x6a62('0xa')](util['format'](_0x6a62('0x3c'),_0x26a4df['uniqueid']),_0x26a4df);utils['info'](util[_0x6a62('0xb')](_0x6a62('0x3d'),_0x26a4df[_0x6a62('0x4')],_0x26a4df[_0x6a62('0x3e')]));recordings[_0x26a4df[_0x6a62('0x4')]][_0x6a62('0x3e')]=_0x26a4df[_0x6a62('0x3e')];}}catch(_0x545dbc){utils[_0x6a62('0x12')](util[_0x6a62('0xb')](_0x6a62('0x3c'),_0x26a4df[_0x6a62('0x4')]),_0x545dbc);}}; \ No newline at end of file +var _0x5a68=['uniqueid','accountcode','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','linkedid','context','exten','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','info','format'];(function(_0x52816b,_0x5d594c){var _0x1ebd4a=function(_0x31b33f){while(--_0x31b33f){_0x52816b['push'](_0x52816b['shift']());}};_0x1ebd4a(++_0x5d594c);}(_0x5a68,0x75));var _0x85a6=function(_0x3a3469,_0x5edf99){_0x3a3469=_0x3a3469-0x0;var _0xa94576=_0x5a68[_0x3a3469];return _0xa94576;};'use strict';var _=require('lodash');var util=require(_0x85a6('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x555ff3){utils[_0x85a6('0x1')](util[_0x85a6('0x2')]('[%s][recordings][writeDB]',_0x555ff3[_0x85a6('0x3')]));if(_0x555ff3[_0x85a6('0x4')]){utils['getUserByInternal'](_0x555ff3[_0x85a6('0x4')])[_0x85a6('0x5')](function(_0x5185bd){if(_0x5185bd){_0x555ff3[_0x85a6('0x6')]=_0x5185bd[_0x85a6('0x7')];_0x555ff3[_0x85a6('0x8')]=_0x5185bd['id'];}utils['request'](_0x85a6('0x9'),_0x555ff3);});}else{utils[_0x85a6('0xa')](_0x85a6('0x9'),_0x555ff3);}}exports[_0x85a6('0xb')]=function(_0x107ab4){try{utils[_0x85a6('0xc')](util[_0x85a6('0x2')]('[%s][recordings][newchannel]',_0x107ab4[_0x85a6('0x3')]),_0x107ab4);if(_0x107ab4[_0x85a6('0x3')]==_0x107ab4[_0x85a6('0xd')]){utils[_0x85a6('0x1')](util[_0x85a6('0x2')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x107ab4[_0x85a6('0x3')],_0x107ab4[_0x85a6('0xe')],_0x107ab4[_0x85a6('0xf')]));recordings[_0x107ab4['uniqueid']]={'uniqueid':_0x107ab4[_0x85a6('0x3')],'accountcode':_0x107ab4[_0x85a6('0x4')],'exten':_0x107ab4['exten'],'context':_0x107ab4[_0x85a6('0xe')],'channel':_0x107ab4['channel'],'monitors':[]};}}catch(_0x2f1508){utils['error'](util['format']('[%s][recordings][newchannel]',_0x107ab4[_0x85a6('0x3')]),_0x2f1508);}};exports[_0x85a6('0x10')]=function(_0x2c8b3e){try{utils['debug'](util[_0x85a6('0x2')](_0x85a6('0x11'),_0x2c8b3e[_0x85a6('0x3')]),_0x2c8b3e);if(!_[_0x85a6('0x12')](recordings[_0x2c8b3e[_0x85a6('0x3')]])&&_0x2c8b3e['channelstate']==0x6){utils[_0x85a6('0x1')](util[_0x85a6('0x2')](_0x85a6('0x13'),_0x2c8b3e[_0x85a6('0x3')],_0x2c8b3e[_0x85a6('0xe')],_0x2c8b3e[_0x85a6('0x14')]));}else if(!_[_0x85a6('0x12')](recordings[_0x2c8b3e[_0x85a6('0xd')]])&&_0x2c8b3e[_0x85a6('0x15')]==0x6&&_0x2c8b3e[_0x85a6('0xe')]!=_0x85a6('0x16')){utils[_0x85a6('0x1')](util['format'](_0x85a6('0x17'),_0x2c8b3e[_0x85a6('0x3')],_0x2c8b3e[_0x85a6('0xd')],_0x2c8b3e[_0x85a6('0xe')],_0x2c8b3e[_0x85a6('0x14')]));recordings[_0x2c8b3e[_0x85a6('0xd')]]['accountcode']=_0x2c8b3e[_0x85a6('0x4')];}}catch(_0x965bd3){utils[_0x85a6('0x18')](util[_0x85a6('0x2')](_0x85a6('0x11'),_0x2c8b3e[_0x85a6('0x3')]),_0x965bd3);}};exports[_0x85a6('0x19')]=function(_0x4252c4){try{if(!_[_0x85a6('0x12')](_0x4252c4[_0x85a6('0x1a')])&&!_[_0x85a6('0x12')](_0x4252c4[_0x85a6('0x1a')][_0x85a6('0x1b')])){utils[_0x85a6('0xc')](util[_0x85a6('0x2')](_0x85a6('0x1c'),_0x4252c4[_0x85a6('0x3')]),_0x4252c4);utils[_0x85a6('0x1')](util[_0x85a6('0x2')](_0x85a6('0x1d'),_0x4252c4[_0x85a6('0x3')],_0x4252c4[_0x85a6('0x1a')],_0x4252c4[_0x85a6('0x1e')]));if(_[_0x85a6('0x1f')](_0x4252c4[_0x85a6('0x1e')],_0x85a6('0x20'))){_0x4252c4['value']=_0x4252c4['value'][_0x85a6('0x21')](_0x85a6('0x20'),'.WAV');}if(recordings[_0x4252c4[_0x85a6('0xd')]]){var _0x3554fa=_[_0x85a6('0x22')](recordings[_0x4252c4[_0x85a6('0xd')]][_0x85a6('0x23')],{'value':_0x4252c4['value']});if(_[_0x85a6('0x12')](_0x3554fa)){recordings[_0x4252c4[_0x85a6('0xd')]][_0x85a6('0x23')][_0x85a6('0x24')]({'value':_0x4252c4[_0x85a6('0x1e')]});}}}}catch(_0x5aa49f){utils[_0x85a6('0x18')](util[_0x85a6('0x2')]('[%s][recordings][varset]',_0x4252c4[_0x85a6('0x3')]),_0x5aa49f);}};exports['hangup']=function(_0x46ef86){try{if(!_[_0x85a6('0x12')](recordings[_0x46ef86[_0x85a6('0x3')]])){utils['debug'](util[_0x85a6('0x2')](_0x85a6('0x25'),_0x46ef86[_0x85a6('0x3')]),_0x46ef86);utils[_0x85a6('0x1')](util['format'](_0x85a6('0x26'),_0x46ef86[_0x85a6('0x3')],_0x46ef86[_0x85a6('0x27')],_0x46ef86[_0x85a6('0x28')],_0x46ef86[_0x85a6('0x29')]));recordings[_0x46ef86[_0x85a6('0x3')]][_0x85a6('0x27')]=_0x46ef86['calleridnum'];recordings[_0x46ef86[_0x85a6('0x3')]]['calleridname']=_0x46ef86['calleridname'];recordings[_0x46ef86['uniqueid']][_0x85a6('0x2a')]=_0x46ef86['connectedlinenum'];recordings[_0x46ef86[_0x85a6('0x3')]][_0x85a6('0x2b')]=_0x46ef86[_0x85a6('0x2b')];if(recordings[_0x46ef86[_0x85a6('0x3')]]['type']==_0x85a6('0x2c')&&recordings[_0x46ef86['uniqueid']][_0x85a6('0x4')]){recordings[_0x46ef86[_0x85a6('0x3')]][_0x85a6('0x2a')]=recordings[_0x46ef86['uniqueid']][_0x85a6('0x4')];recordings[_0x46ef86[_0x85a6('0x3')]][_0x85a6('0x2b')]='';}recordings[_0x46ef86[_0x85a6('0x3')]][_0x85a6('0x23')][_0x85a6('0x2d')](function(_0x13585a){var _0x284394=_[_0x85a6('0x2e')](recordings[_0x46ef86['uniqueid']]);_0x284394[_0x85a6('0x1e')]=_0x13585a[_0x85a6('0x1e')];writeDB(_0x284394);});delete recordings[_0x46ef86['uniqueid']];}}catch(_0x2db02b){utils[_0x85a6('0x18')](util[_0x85a6('0x2')]('[%s][recordings][hangup]',_0x46ef86[_0x85a6('0x3')]),_0x2db02b);}};exports['newexten']=function(_0x1a77aa){try{if(!_['isNil'](recordings[_0x1a77aa[_0x85a6('0x3')]])){utils[_0x85a6('0xc')](util['format'](_0x85a6('0x2f'),_0x1a77aa['uniqueid']),_0x1a77aa);utils[_0x85a6('0x1')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1a77aa['uniqueid'],_0x1a77aa[_0x85a6('0x30')],_0x1a77aa['appdata']));if(_0x1a77aa[_0x85a6('0x30')][_0x85a6('0x31')]()==_0x85a6('0x32')&&_[_0x85a6('0x33')](_0x1a77aa[_0x85a6('0x34')][_0x85a6('0x31')](),'cdr')){var _0x47db2e=_0x1a77aa[_0x85a6('0x34')][_0x85a6('0x35')]('=');var _0x2a4d80=_0x47db2e[0x0][_0x85a6('0x36')](_0x47db2e[0x0][_0x85a6('0x37')]('(')+0x1,_0x47db2e[0x0][_0x85a6('0x37')](')'));var _0x43fd41=_0x47db2e[0x1];recordings[_0x1a77aa[_0x85a6('0x3')]][_0x2a4d80]=_0x43fd41;}}}catch(_0x4f47dc){utils[_0x85a6('0x18')](util[_0x85a6('0x2')]('[%s][recordings][newexten]',_0x1a77aa['uniqueid']),_0x4f47dc);}};exports[_0x85a6('0x38')]=function(_0x35e15e){try{if(!_[_0x85a6('0x12')](recordings[_0x35e15e[_0x85a6('0x3')]])){utils['debug'](util[_0x85a6('0x2')](_0x85a6('0x39'),_0x35e15e[_0x85a6('0x3')]),_0x35e15e);utils[_0x85a6('0x1')](util[_0x85a6('0x2')](_0x85a6('0x3a'),_0x35e15e[_0x85a6('0x3')],_0x35e15e[_0x85a6('0x3b')]));recordings[_0x35e15e[_0x85a6('0x3')]][_0x85a6('0x3b')]=_0x35e15e[_0x85a6('0x3b')];}}catch(_0xfbe9b5){utils[_0x85a6('0x18')](util[_0x85a6('0x2')]('[%s][recordings][queuecallerjoin]',_0x35e15e[_0x85a6('0x3')]),_0xfbe9b5);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ea9dac5..22ac08e 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 _0xf754=['transfertargetaccountcode','lodash','util','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x289b7d,_0x5ab647){var _0x20965b=function(_0x456f58){while(--_0x456f58){_0x289b7d['push'](_0x289b7d['shift']());}};_0x20965b(++_0x5ab647);}(_0xf754,0x1b1));var _0x4f75=function(_0x538037,_0x31d193){_0x538037=_0x538037-0x0;var _0x306123=_0xf754[_0x538037];return _0x306123;};'use strict';var _=require(_0x4f75('0x0'));var util=require(_0x4f75('0x1'));var utils=require('./utils');function writeDB(_0x109fef){utils[_0x4f75('0x2')](util[_0x4f75('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x109fef[_0x4f75('0x4')]===_0x4f75('0x5')?_0x109fef[_0x4f75('0x6')]:_0x109fef[_0x4f75('0x7')],_0x109fef[_0x4f75('0x4')]));utils[_0x4f75('0x8')](_0x4f75('0x9'),_0x109fef);}exports[_0x4f75('0xa')]=function(_0x52106a){try{utils['debug'](util[_0x4f75('0x3')]('[%s][transfers][blindtransfer]',_0x52106a['uniqueid']),_0x52106a);utils[_0x4f75('0x2')](util[_0x4f75('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x52106a[_0x4f75('0x7')],_0x52106a[_0x4f75('0xb')],_0x52106a[_0x4f75('0xc')],_0x52106a[_0x4f75('0xd')],_0x52106a[_0x4f75('0xe')]));_0x52106a[_0x4f75('0x4')]=_0x4f75('0xf');writeDB(_0x52106a);}catch(_0x53e406){utils[_0x4f75('0x10')](util[_0x4f75('0x3')](_0x4f75('0x11'),_0x52106a['uniqueid']),_0x53e406);}};exports[_0x4f75('0x12')]=function(_0x51cb83){try{utils[_0x4f75('0x13')](util[_0x4f75('0x3')](_0x4f75('0x14'),_0x51cb83['origtransfereruniqueid']),_0x51cb83);utils[_0x4f75('0x2')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x51cb83['origtransfereruniqueid'],_0x51cb83[_0x4f75('0x15')],_0x51cb83[_0x4f75('0x16')],_0x51cb83[_0x4f75('0x17')],_0x51cb83[_0x4f75('0x18')]));_0x51cb83=_['assign'](_0x51cb83,{'transfererchannel':_0x51cb83[_0x4f75('0x19')],'transferercalleridnum':_0x51cb83[_0x4f75('0x15')],'transferercalleridname':_0x51cb83['origtransferercalleridname'],'transfererconnectedlinenum':_0x51cb83['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x51cb83[_0x4f75('0x1a')],'transfereraccountcode':_0x51cb83[_0x4f75('0x1b')],'transferercontext':_0x51cb83[_0x4f75('0x1c')],'transfererexten':_0x51cb83[_0x4f75('0x1d')],'transfererlinkedid':_0x51cb83[_0x4f75('0x1e')],'context':_0x51cb83[_0x4f75('0x1f')],'extension':_0x51cb83['origtransfererexten'],'type':_0x4f75('0x5')});if(_['isNil'](_0x51cb83[_0x4f75('0x20')])){_0x51cb83=_['assign'](_0x51cb83,{'transfereechannel':_0x51cb83['transfertargetchannel'],'transfereecalleridnum':_0x51cb83[_0x4f75('0x17')],'transfereecalleridname':_0x51cb83[_0x4f75('0x18')],'transfereeconnectedlinenum':_0x51cb83[_0x4f75('0x21')],'transfereeconnectedlinename':_0x51cb83[_0x4f75('0x22')],'transfereeaccountcode':_0x51cb83[_0x4f75('0x23')],'transfereecontext':_0x51cb83['transfertargetcontext'],'transfereeexten':_0x51cb83['transfertargetexten'],'transfereelinkedid':_0x51cb83['transfertargetlinkedid']});}writeDB(_0x51cb83);}catch(_0x3346c3){utils[_0x4f75('0x10')](util[_0x4f75('0x3')](_0x4f75('0x14'),_0x51cb83[_0x4f75('0x6')]),_0x3346c3);}}; \ No newline at end of file +var _0x3c00=['isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','transferercalleridnum','transfereecalleridnum','transfereecalleridname','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten'];(function(_0x1658e8,_0x426cfb){var _0x537c5b=function(_0x27a741){while(--_0x27a741){_0x1658e8['push'](_0x1658e8['shift']());}};_0x537c5b(++_0x426cfb);}(_0x3c00,0x149));var _0x03c0=function(_0x5a9716,_0x1c6a6b){_0x5a9716=_0x5a9716-0x0;var _0x3f5e33=_0x3c00[_0x5a9716];return _0x3f5e33;};'use strict';var _=require(_0x03c0('0x0'));var util=require(_0x03c0('0x1'));var utils=require(_0x03c0('0x2'));function writeDB(_0x151de9){utils[_0x03c0('0x3')](util['format'](_0x03c0('0x4'),_0x151de9[_0x03c0('0x5')]===_0x03c0('0x6')?_0x151de9[_0x03c0('0x7')]:_0x151de9[_0x03c0('0x8')],_0x151de9['type']));utils[_0x03c0('0x9')](_0x03c0('0xa'),_0x151de9);}exports[_0x03c0('0xb')]=function(_0x25af28){try{utils[_0x03c0('0xc')](util['format']('[%s][transfers][blindtransfer]',_0x25af28[_0x03c0('0x8')]),_0x25af28);utils[_0x03c0('0x3')](util[_0x03c0('0xd')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x25af28[_0x03c0('0x8')],_0x25af28[_0x03c0('0xe')],_0x25af28['transferercalleridname'],_0x25af28[_0x03c0('0xf')],_0x25af28[_0x03c0('0x10')]));_0x25af28['type']='blind';writeDB(_0x25af28);}catch(_0xade7ff){utils['error'](util[_0x03c0('0xd')]('[%s][transfers][blindtransfer]',_0x25af28[_0x03c0('0x8')]),_0xade7ff);}};exports[_0x03c0('0x11')]=function(_0x232742){try{utils['debug'](util['format'](_0x03c0('0x12'),_0x232742[_0x03c0('0x7')]),_0x232742);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x232742['origtransfereruniqueid'],_0x232742[_0x03c0('0x13')],_0x232742[_0x03c0('0x14')],_0x232742[_0x03c0('0x15')],_0x232742[_0x03c0('0x16')]));_0x232742=_['assign'](_0x232742,{'transfererchannel':_0x232742['origtransfererchannel'],'transferercalleridnum':_0x232742[_0x03c0('0x13')],'transferercalleridname':_0x232742[_0x03c0('0x14')],'transfererconnectedlinenum':_0x232742[_0x03c0('0x17')],'transfererconnectedlinename':_0x232742[_0x03c0('0x18')],'transfereraccountcode':_0x232742[_0x03c0('0x19')],'transferercontext':_0x232742[_0x03c0('0x1a')],'transfererexten':_0x232742[_0x03c0('0x1b')],'transfererlinkedid':_0x232742[_0x03c0('0x1c')],'context':_0x232742[_0x03c0('0x1d')],'extension':_0x232742[_0x03c0('0x1e')],'type':'attended'});if(_[_0x03c0('0x1f')](_0x232742[_0x03c0('0x20')])){_0x232742=_[_0x03c0('0x21')](_0x232742,{'transfereechannel':_0x232742[_0x03c0('0x22')],'transfereecalleridnum':_0x232742['transfertargetcalleridnum'],'transfereecalleridname':_0x232742['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x232742[_0x03c0('0x23')],'transfereeconnectedlinename':_0x232742[_0x03c0('0x24')],'transfereeaccountcode':_0x232742['transfertargetaccountcode'],'transfereecontext':_0x232742[_0x03c0('0x25')],'transfereeexten':_0x232742[_0x03c0('0x26')],'transfereelinkedid':_0x232742['transfertargetlinkedid']});}writeDB(_0x232742);}catch(_0x4a5bbf){utils[_0x03c0('0x27')](util[_0x03c0('0xd')](_0x03c0('0x12'),_0x232742[_0x03c0('0x7')]),_0x4a5bbf);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 9a34d62..51ba4b4 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 _0xb0df=['../../config/logger','xdr','info','inspect','debug','request','then','catch','error','[utils][request]\x20name:%s','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb0df,0x85));var _0xfb0d=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0xb0df[_0x1d94d1];return _0x23c397;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xfb0d('0x0'));var moment=require(_0xfb0d('0x1'));var util=require(_0xfb0d('0x2'));var client=jayson[_0xfb0d('0x3')][_0xfb0d('0x4')]({'port':0x2329});var logger=require(_0xfb0d('0x5'))(_0xfb0d('0x6'));exports[_0xfb0d('0x7')]=function(_0x3348e0,_0x4ff814){logger[_0xfb0d('0x7')](_0x3348e0,_0x4ff814?util[_0xfb0d('0x8')](_0x4ff814,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5b7591,_0xd9beab){logger[_0xfb0d('0x9')](_0x5b7591,_0xd9beab?util['inspect'](_0xd9beab,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3092de,_0x2f7ddc){logger['error'](_0x3092de,_0x2f7ddc?util[_0xfb0d('0x8')](_0x2f7ddc,{'showHidden':![],'depth':null}):'');};exports[_0xfb0d('0xa')]=function(_0x34398f,_0x36043a){return client[_0xfb0d('0xa')](_0x34398f,{'body':_0x36043a})[_0xfb0d('0xb')](function(_0x4936a1){logger[_0xfb0d('0x9')]('[utils][request]\x20name:%s',_0x34398f,_0x4936a1?util[_0xfb0d('0x8')](_0x4936a1,{'showHidden':![],'depth':null}):'');})[_0xfb0d('0xc')](function(_0x254576){logger[_0xfb0d('0xd')](_0xfb0d('0xe'),_0x34398f,_0x254576?util[_0xfb0d('0x8')](_0x254576,{'showHidden':![],'depth':null}):'');});};function getUser(_0x303aa3){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xfb0d('0xf'),_0xfb0d('0x10')],'where':_0x303aa3,'limit':0x1}})[_0xfb0d('0xb')](function(_0x14751e){logger[_0xfb0d('0x9')](_0xfb0d('0x11'),JSON[_0xfb0d('0x12')](_0x303aa3),_0x14751e?util['inspect'](_0x14751e,{'showHidden':![],'depth':null}):'');return _0x14751e[_0xfb0d('0x13')][_0xfb0d('0x14')]?_0x14751e[_0xfb0d('0x13')][0x0]:null;});}exports[_0xfb0d('0x15')]=function(_0x58b1cc){return new BPromise(function(_0x28f8dc,_0x318c5e){if(_0x58b1cc){return getUser({'internal':_0x58b1cc})[_0xfb0d('0xb')](function(_0x443e2d){logger[_0xfb0d('0x7')](_0xfb0d('0x16'),_0x58b1cc,_0x443e2d?_0xfb0d('0x17'):'notfound');return _0x28f8dc(_0x443e2d);})[_0xfb0d('0xc')](function(_0xa5da11){logger[_0xfb0d('0xd')](_0xfb0d('0x18'),_0xa5da11?util[_0xfb0d('0x8')](_0xa5da11,{'showHidden':![],'depth':null}):'');return _0x28f8dc(null);});}return _0x28f8dc(null);});};exports[_0xfb0d('0x19')]=function(_0x2fb83c){return new BPromise(function(_0x27a5cf,_0x391ec6){if(_0x2fb83c){return getUser({'interface':_0x2fb83c})[_0xfb0d('0xb')](function(_0x3411cb){logger[_0xfb0d('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x2fb83c,_0x3411cb?_0xfb0d('0x17'):_0xfb0d('0x1a'));return _0x27a5cf(_0x3411cb);})['catch'](function(_0x580c01){logger[_0xfb0d('0xd')](_0xfb0d('0x1b'),_0x580c01?util['inspect'](_0x580c01,{'showHidden':![],'depth':null}):'');return _0x27a5cf(null);});}return _0x27a5cf(null);});};exports[_0xfb0d('0x1c')]=function(_0x29be8f){return new BPromise(function(_0x1c234c,_0x3f27a6){if(_0x29be8f){return getUser({'name':_0x29be8f})[_0xfb0d('0xb')](function(_0x10c1f9){logger[_0xfb0d('0x7')](_0xfb0d('0x1d'),_0x29be8f,_0x10c1f9?_0xfb0d('0x17'):_0xfb0d('0x1a'));return _0x1c234c(_0x10c1f9);})[_0xfb0d('0xc')](function(_0x803bdd){logger['error'](_0xfb0d('0x1e'),_0x803bdd?util[_0xfb0d('0x8')](_0x803bdd,{'showHidden':![],'depth':null}):'');return _0x1c234c(null);});}return _0x1c234c(null);});};exports['getVoiceQueueByName']=function(_0x13de4){return new BPromise(function(_0x2a2838,_0x2a0c29){if(_0x13de4){return client[_0xfb0d('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0xfb0d('0x1f'),'acw',_0xfb0d('0x20')],'where':{'name':_0x13de4},'limit':0x1}})['then'](function(_0x38bdfc){logger[_0xfb0d('0x9')](_0xfb0d('0x21'),_0x13de4,_0x38bdfc?util[_0xfb0d('0x8')](_0x38bdfc,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x13de4,_0x38bdfc?_0xfb0d('0x17'):_0xfb0d('0x1a'));return _0x2a2838(_0x38bdfc[_0xfb0d('0x13')][_0xfb0d('0x14')]?_0x38bdfc['result'][0x0]:null);})[_0xfb0d('0xc')](function(_0x4e2c40){logger[_0xfb0d('0xd')]('[utils][getVoiceQueueByName]',_0x4e2c40?util[_0xfb0d('0x8')](_0x4e2c40,{'showHidden':![],'depth':null}):'');return _0x2a2838(null);});}return _0x2a2838(null);});};exports[_0xfb0d('0x22')]=function(_0x470071,_0x1ac68a){return moment(_0x470071)[_0xfb0d('0x23')](_0x1ac68a,_0xfb0d('0x24'))['format'](_0xfb0d('0x25'));};exports[_0xfb0d('0x26')]=function(_0x6dfe88,_0x394c85){return moment(_0x6dfe88)[_0xfb0d('0x27')](_0x394c85,'seconds')[_0xfb0d('0x28')](_0xfb0d('0x25'));};exports[_0xfb0d('0x29')]=function(_0xedc0f9,_0x47c1be){return moment(_0xedc0f9)['diff'](moment(_0x47c1be),'seconds');};exports[_0xfb0d('0x2a')]=function(_0x127116,_0x2e33e9){return parseInt(_0x127116,0xa)+parseInt(_0x2e33e9,0xa);};exports[_0xfb0d('0x2b')]=function(){return moment()[_0xfb0d('0x28')](_0xfb0d('0x25'));};exports[_0xfb0d('0x2c')]=function(_0x5664bb,_0x402bfa){if(_0x402bfa){return moment(_0x5664bb)[_0xfb0d('0x2c')](_0x402bfa);}return!![];};exports['isBefore']=function(_0x5b6e5a,_0x116b06){if(_0x116b06){return moment(_0x5b6e5a)[_0xfb0d('0x2d')](_0x116b06);}else if(_0x5b6e5a){return!![];}return![];}; \ No newline at end of file +var _0xab72=['[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','result','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','[utils][getUser]\x20where:%s','stringify','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName'];(function(_0x40ab6e,_0xdeb7f9){var _0x6f6bbc=function(_0x1b3ff1){while(--_0x1b3ff1){_0x40ab6e['push'](_0x40ab6e['shift']());}};_0x6f6bbc(++_0xdeb7f9);}(_0xab72,0x71));var _0x2ab7=function(_0x529c5b,_0xd3054a){_0x529c5b=_0x529c5b-0x0;var _0xd84ac5=_0xab72[_0x529c5b];return _0xd84ac5;};'use strict';var BPromise=require(_0x2ab7('0x0'));var jayson=require(_0x2ab7('0x1'));var moment=require(_0x2ab7('0x2'));var util=require(_0x2ab7('0x3'));var client=jayson['client'][_0x2ab7('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x2ab7('0x5'));exports[_0x2ab7('0x6')]=function(_0x14337a,_0x167020){logger[_0x2ab7('0x6')](_0x14337a,_0x167020?util['inspect'](_0x167020,{'showHidden':![],'depth':null}):'');};exports[_0x2ab7('0x7')]=function(_0xe379d8,_0x154ade){logger[_0x2ab7('0x7')](_0xe379d8,_0x154ade?util[_0x2ab7('0x8')](_0x154ade,{'showHidden':![],'depth':null}):'');};exports[_0x2ab7('0x9')]=function(_0x5a2907,_0x160ac0){logger[_0x2ab7('0x9')](_0x5a2907,_0x160ac0?util[_0x2ab7('0x8')](_0x160ac0,{'showHidden':![],'depth':null}):'');};exports[_0x2ab7('0xa')]=function(_0xef46ee,_0x399fc9){return client[_0x2ab7('0xa')](_0xef46ee,{'body':_0x399fc9})[_0x2ab7('0xb')](function(_0x167799){logger[_0x2ab7('0x7')](_0x2ab7('0xc'),_0xef46ee,_0x167799?util[_0x2ab7('0x8')](_0x167799,{'showHidden':![],'depth':null}):'');})[_0x2ab7('0xd')](function(_0x185b02){logger['error'](_0x2ab7('0xc'),_0xef46ee,_0x185b02?util[_0x2ab7('0x8')](_0x185b02,{'showHidden':![],'depth':null}):'');});};function getUser(_0x9068c2){return client[_0x2ab7('0xa')](_0x2ab7('0xe'),{'options':{'raw':!![],'attributes':['id',_0x2ab7('0xf'),'name','interface'],'where':_0x9068c2,'limit':0x1}})[_0x2ab7('0xb')](function(_0x398df8){logger[_0x2ab7('0x7')](_0x2ab7('0x10'),JSON[_0x2ab7('0x11')](_0x9068c2),_0x398df8?util[_0x2ab7('0x8')](_0x398df8,{'showHidden':![],'depth':null}):'');return _0x398df8['result'][_0x2ab7('0x12')]?_0x398df8['result'][0x0]:null;});}exports[_0x2ab7('0x13')]=function(_0x3e18b3){return new BPromise(function(_0x170569,_0x155071){if(_0x3e18b3){return getUser({'internal':_0x3e18b3})[_0x2ab7('0xb')](function(_0x5f3f87){logger[_0x2ab7('0x6')](_0x2ab7('0x14'),_0x3e18b3,_0x5f3f87?_0x2ab7('0x15'):'notfound');return _0x170569(_0x5f3f87);})[_0x2ab7('0xd')](function(_0xba0889){logger[_0x2ab7('0x9')](_0x2ab7('0x16'),_0xba0889?util[_0x2ab7('0x8')](_0xba0889,{'showHidden':![],'depth':null}):'');return _0x170569(null);});}return _0x170569(null);});};exports[_0x2ab7('0x17')]=function(_0x3957d2){return new BPromise(function(_0x59b5a3,_0x142a7a){if(_0x3957d2){return getUser({'interface':_0x3957d2})[_0x2ab7('0xb')](function(_0x277745){logger[_0x2ab7('0x6')](_0x2ab7('0x18'),_0x3957d2,_0x277745?_0x2ab7('0x15'):_0x2ab7('0x19'));return _0x59b5a3(_0x277745);})[_0x2ab7('0xd')](function(_0x4eff23){logger['error'](_0x2ab7('0x1a'),_0x4eff23?util[_0x2ab7('0x8')](_0x4eff23,{'showHidden':![],'depth':null}):'');return _0x59b5a3(null);});}return _0x59b5a3(null);});};exports[_0x2ab7('0x1b')]=function(_0x5ef541){return new BPromise(function(_0xb7ff97,_0x5b3fe8){if(_0x5ef541){return getUser({'name':_0x5ef541})[_0x2ab7('0xb')](function(_0x22166f){logger[_0x2ab7('0x6')](_0x2ab7('0x1c'),_0x5ef541,_0x22166f?'found':'notfound');return _0xb7ff97(_0x22166f);})[_0x2ab7('0xd')](function(_0x5731da){logger['error'](_0x2ab7('0x1d'),_0x5731da?util['inspect'](_0x5731da,{'showHidden':![],'depth':null}):'');return _0xb7ff97(null);});}return _0xb7ff97(null);});};exports[_0x2ab7('0x1e')]=function(_0x10815d){return new BPromise(function(_0x7c80a3,_0x5e91dc){if(_0x10815d){return client[_0x2ab7('0xa')](_0x2ab7('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x2ab7('0x20'),'type',_0x2ab7('0x21'),_0x2ab7('0x22')],'where':{'name':_0x10815d},'limit':0x1}})[_0x2ab7('0xb')](function(_0x3ee998){logger[_0x2ab7('0x7')](_0x2ab7('0x23'),_0x10815d,_0x3ee998?util['inspect'](_0x3ee998,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x10815d,_0x3ee998?_0x2ab7('0x15'):'notfound');return _0x7c80a3(_0x3ee998[_0x2ab7('0x24')][_0x2ab7('0x12')]?_0x3ee998[_0x2ab7('0x24')][0x0]:null);})[_0x2ab7('0xd')](function(_0x1f7d4c){logger[_0x2ab7('0x9')]('[utils][getVoiceQueueByName]',_0x1f7d4c?util[_0x2ab7('0x8')](_0x1f7d4c,{'showHidden':![],'depth':null}):'');return _0x7c80a3(null);});}return _0x7c80a3(null);});};exports[_0x2ab7('0x25')]=function(_0x339a8f,_0x15c3ba){return moment(_0x339a8f)['add'](_0x15c3ba,_0x2ab7('0x26'))[_0x2ab7('0x27')](_0x2ab7('0x28'));};exports['subtractTime']=function(_0x2e994e,_0x1cc5ed){return moment(_0x2e994e)[_0x2ab7('0x29')](_0x1cc5ed,_0x2ab7('0x26'))[_0x2ab7('0x27')](_0x2ab7('0x28'));};exports[_0x2ab7('0x2a')]=function(_0x1e92a9,_0x4a518d){return moment(_0x1e92a9)['diff'](moment(_0x4a518d),_0x2ab7('0x26'));};exports[_0x2ab7('0x2b')]=function(_0x4ae236,_0x1af7d9){return parseInt(_0x4ae236,0xa)+parseInt(_0x1af7d9,0xa);};exports[_0x2ab7('0x2c')]=function(){return moment()[_0x2ab7('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2ab7('0x2d')]=function(_0x13ff2d,_0x29f097){if(_0x29f097){return moment(_0x13ff2d)[_0x2ab7('0x2d')](_0x29f097);}return!![];};exports[_0x2ab7('0x2e')]=function(_0x503acb,_0x2e98d4){if(_0x2e98d4){return moment(_0x503acb)[_0x2ab7('0x2e')](_0x2e98d4);}else if(_0x503acb){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 2f6ad2e..36a91f3 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 _0xb29b=['headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','agent_id','agent_name','test','fs-extra','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','ensureDir','then','catch','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','method'];(function(_0x41d02a,_0x355e19){var _0x4c3983=function(_0x4802a7){while(--_0x4802a7){_0x41d02a['push'](_0x41d02a['shift']());}};_0x4c3983(++_0x355e19);}(_0xb29b,0x152));var _0xbb29=function(_0x3ac5bc,_0x4922da){_0x3ac5bc=_0x3ac5bc-0x0;var _0x458c1f=_0xb29b[_0x3ac5bc];return _0x458c1f;};var fs=require(_0xbb29('0x0'));var _=require('lodash');var ewinston=require(_0xbb29('0x1'));var path=require(_0xbb29('0x2'));var util=require(_0xbb29('0x3'));var fileLogger=require(_0xbb29('0x4'))['fileLogger'];var safeTemplate=require(_0xbb29('0x5'))[_0xbb29('0x6')];var maskSensitiveData=require(_0xbb29('0x7'))[_0xbb29('0x8')];function ClientSideLogger(){function _0x4003ec(_0x441d3c){var _0x590d12=path['join'](_0xbb29('0x9'),_0xbb29('0xa'),_0xbb29('0xb'));var _0x4014be=path[_0xbb29('0xc')](_0xbb29('0xd'),_0x441d3c[_0xbb29('0xe')]+'-'+_0x441d3c['name']);return fs[_0xbb29('0xf')](path[_0xbb29('0xc')](_0x590d12,_0x4014be))[_0xbb29('0x10')](function(){var _0x52bac9=fileLogger(_0xbb29('0xd'),path[_0xbb29('0xc')](_0x590d12,_0x4014be));return _0x52bac9;})[_0xbb29('0x11')](function(_0x1577dd){throw _0x1577dd;});}this[_0xbb29('0xa')]=function(_0x43ab56,_0x3f338e,_0x4e3bdb,_0x3b477e){return _0x4003ec(_0x43ab56['user'])[_0xbb29('0x10')](function(_0x24a781){var _0x4dc519=_0x24a781[_0x3f338e];return _0x4dc519;})[_0xbb29('0x10')](function(_0xd09ff5){var _0x16162f=_0x43ab56['user']?_0x43ab56['user']['id']:'no-user';var _0x57d8ba=_0x3b477e['data'];var _0x3ca156=_0x3b477e['timestamp'];var _0x305fb8=new Date(Number(_0x3ca156));return _0xd09ff5(_0x16162f,_0x305fb8,_0x4e3bdb,_0x57d8ba);})[_0xbb29('0x11')](function(_0x25bc44){fileLogger('client')[_0xbb29('0x12')](_0x25bc44);});};}function setupLoggers(_0x18404a){return new Promise(function(_0x1c1bf1){var _0x48ef0c=new ClientSideLogger();var _0x2caf99=fileLogger(_0xbb29('0x13'));var _0x2e5e46=fileLogger(_0xbb29('0x14'));_0x18404a[_0xbb29('0x15')](_0xbb29('0x16'),_0x48ef0c);_0x18404a[_0xbb29('0x17')](ewinston[_0xbb29('0x18')]({'winstonInstance':_0x2caf99,'meta':![],'statusLevels':!![],'msg':function(_0x1b647d,_0x25abdf){var _0x6f2d92=_0xbb29('0x19');if(!_['isEmpty'](_0x1b647d['body'])){_0x6f2d92+=_0xbb29('0x1a');var _0x26070b=_0x1b647d[_0xbb29('0x1b')];maskSensitiveData(_0x26070b);}return safeTemplate(util[_0xbb29('0x1c')](_0x6f2d92,_0x1b647d[_0xbb29('0x1d')],_0x1b647d[_0xbb29('0x1e')]['x-forwarded-for']?_0x1b647d[_0xbb29('0x1e')][_0xbb29('0x1f')]:_0x1b647d[_0xbb29('0x20')][_0xbb29('0x21')]||_0x1b647d['ip'],_0x1b647d[_0xbb29('0x22')],_0x25abdf[_0xbb29('0x23')],_0x25abdf[_0xbb29('0x24')],_0x1b647d[_0xbb29('0x25')]?_0x1b647d['user']['id']:null,_0x1b647d[_0xbb29('0x25')]?_0x1b647d['user']['name']:null,_0x1b647d[_0xbb29('0x25')]?_0x1b647d[_0xbb29('0x25')][_0xbb29('0xe')]:null,_0x26070b?util[_0xbb29('0x26')](_0x26070b,![],null):''));}}));_0x18404a[_0xbb29('0x17')](ewinston['logger']({'winstonInstance':_0x2e5e46,'meta':![],'statusLevels':!![],'msg':function(_0x48144e,_0x4a9ce4){var _0x1b518b=_0xbb29('0x27');if(_0x48144e[_0xbb29('0x1b')]&&_0x48144e['body'][_0xbb29('0x28')]&&_0x48144e[_0xbb29('0x1b')]['agent_id']){_0x1b518b=_0xbb29('0x29');}return util['format'](_0x1b518b,_0x48144e[_0xbb29('0x1d')],_0x48144e[_0xbb29('0x1e')]['x-forwarded-for']?_0x48144e[_0xbb29('0x1e')][_0xbb29('0x1f')]:_0x48144e[_0xbb29('0x20')][_0xbb29('0x21')]||_0x48144e['ip'],_0x48144e['url'],_0x4a9ce4[_0xbb29('0x23')],_0x4a9ce4['responseTime'],_0x48144e[_0xbb29('0x25')]?_0x48144e[_0xbb29('0x25')]['id']:null,_0x48144e['user']?_0x48144e[_0xbb29('0x25')][_0xbb29('0x2a')]:null,_0x48144e[_0xbb29('0x25')]?_0x48144e[_0xbb29('0x25')][_0xbb29('0xe')]:null,_0x48144e[_0xbb29('0x1b')]&&_0x48144e[_0xbb29('0x1b')][_0xbb29('0x28')]?_0x48144e['body'][_0xbb29('0x28')]:'other',_0x48144e['body']&&_0x48144e[_0xbb29('0x1b')][_0xbb29('0x2b')]?_0x48144e['body']['agent_id']:'',_0x48144e['body']&&_0x48144e[_0xbb29('0x1b')][_0xbb29('0x2c')]?_0x48144e[_0xbb29('0x1b')][_0xbb29('0x2c')]:'');},'ignoreRoute':function(_0x2234e2){var _0x1abdec=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1abdec[_0xbb29('0x2d')](_0x2234e2[_0xbb29('0x22')]);}}));return _0x1c1bf1();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x2f7e=['x-forwarded-for','connection','url','statusCode','responseTime','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','headers','remoteAddress','other','agent_name','test','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method'];(function(_0xb3b400,_0x1378c5){var _0x166634=function(_0xaabdca){while(--_0xaabdca){_0xb3b400['push'](_0xb3b400['shift']());}};_0x166634(++_0x1378c5);}(_0x2f7e,0xa5));var _0xe2f7=function(_0x88ad71,_0x1fedf3){_0x88ad71=_0x88ad71-0x0;var _0x12150d=_0x2f7e[_0x88ad71];return _0x12150d;};var fs=require(_0xe2f7('0x0'));var _=require(_0xe2f7('0x1'));var ewinston=require(_0xe2f7('0x2'));var path=require(_0xe2f7('0x3'));var util=require(_0xe2f7('0x4'));var fileLogger=require(_0xe2f7('0x5'))[_0xe2f7('0x6')];var safeTemplate=require(_0xe2f7('0x7'))[_0xe2f7('0x8')];var maskSensitiveData=require(_0xe2f7('0x9'))[_0xe2f7('0xa')];function ClientSideLogger(){function _0x18ae44(_0x2ddd78){var _0x984feb=path[_0xe2f7('0xb')](_0xe2f7('0xc'),'log',_0xe2f7('0xd'));var _0x32bce1=path['join'](_0xe2f7('0xe'),_0x2ddd78[_0xe2f7('0xf')]+'-'+_0x2ddd78[_0xe2f7('0x10')]);return fs[_0xe2f7('0x11')](path['join'](_0x984feb,_0x32bce1))[_0xe2f7('0x12')](function(){var _0x1832b9=fileLogger(_0xe2f7('0xe'),path[_0xe2f7('0xb')](_0x984feb,_0x32bce1));return _0x1832b9;})[_0xe2f7('0x13')](function(_0x4c17ae){throw _0x4c17ae;});}this['log']=function(_0x2b5a2c,_0x391116,_0x3aefee,_0x21cd49){return _0x18ae44(_0x2b5a2c[_0xe2f7('0x14')])[_0xe2f7('0x12')](function(_0xc81e7b){var _0x249b78=_0xc81e7b[_0x391116];return _0x249b78;})[_0xe2f7('0x12')](function(_0x308008){var _0x33e33f=_0x2b5a2c[_0xe2f7('0x14')]?_0x2b5a2c[_0xe2f7('0x14')]['id']:_0xe2f7('0x15');var _0x84ca09=_0x21cd49[_0xe2f7('0x16')];var _0x522505=_0x21cd49['timestamp'];var _0x3d18ad=new Date(Number(_0x522505));return _0x308008(_0x33e33f,_0x3d18ad,_0x3aefee,_0x84ca09);})[_0xe2f7('0x13')](function(_0x5c9222){fileLogger(_0xe2f7('0xe'))[_0xe2f7('0x17')](_0x5c9222);});};}function setupLoggers(_0x38e8dc){return new Promise(function(_0xf80562){var _0x75f3e6=new ClientSideLogger();var _0x1b84b7=fileLogger(_0xe2f7('0x18'));var _0x2f2e95=fileLogger(_0xe2f7('0x19'));_0x38e8dc[_0xe2f7('0x1a')](_0xe2f7('0x1b'),_0x75f3e6);_0x38e8dc[_0xe2f7('0x1c')](ewinston[_0xe2f7('0x1d')]({'winstonInstance':_0x1b84b7,'meta':![],'statusLevels':!![],'msg':function(_0x4d8f87,_0x11a0d1){var _0x111bd7=_0xe2f7('0x1e');if(!_[_0xe2f7('0x1f')](_0x4d8f87[_0xe2f7('0x20')])){_0x111bd7+=_0xe2f7('0x21');var _0x23f7ac=_0x4d8f87[_0xe2f7('0x20')];maskSensitiveData(_0x23f7ac);}return safeTemplate(util['format'](_0x111bd7,_0x4d8f87[_0xe2f7('0x22')],_0x4d8f87['headers'][_0xe2f7('0x23')]?_0x4d8f87['headers'][_0xe2f7('0x23')]:_0x4d8f87[_0xe2f7('0x24')]['remoteAddress']||_0x4d8f87['ip'],_0x4d8f87[_0xe2f7('0x25')],_0x11a0d1[_0xe2f7('0x26')],_0x11a0d1[_0xe2f7('0x27')],_0x4d8f87['user']?_0x4d8f87['user']['id']:null,_0x4d8f87[_0xe2f7('0x14')]?_0x4d8f87[_0xe2f7('0x14')][_0xe2f7('0x10')]:null,_0x4d8f87[_0xe2f7('0x14')]?_0x4d8f87[_0xe2f7('0x14')][_0xe2f7('0xf')]:null,_0x23f7ac?util[_0xe2f7('0x28')](_0x23f7ac,![],null):''));}}));_0x38e8dc['use'](ewinston[_0xe2f7('0x1d')]({'winstonInstance':_0x2f2e95,'meta':![],'statusLevels':!![],'msg':function(_0x215cec,_0x193e73){var _0x3e0c0c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x215cec['body']&&_0x215cec[_0xe2f7('0x20')][_0xe2f7('0x29')]&&_0x215cec[_0xe2f7('0x20')][_0xe2f7('0x2a')]){_0x3e0c0c=_0xe2f7('0x2b');}return util[_0xe2f7('0x2c')](_0x3e0c0c,_0x215cec['method'],_0x215cec[_0xe2f7('0x2d')][_0xe2f7('0x23')]?_0x215cec['headers'][_0xe2f7('0x23')]:_0x215cec[_0xe2f7('0x24')][_0xe2f7('0x2e')]||_0x215cec['ip'],_0x215cec['url'],_0x193e73[_0xe2f7('0x26')],_0x193e73[_0xe2f7('0x27')],_0x215cec['user']?_0x215cec['user']['id']:null,_0x215cec[_0xe2f7('0x14')]?_0x215cec[_0xe2f7('0x14')]['name']:null,_0x215cec[_0xe2f7('0x14')]?_0x215cec[_0xe2f7('0x14')][_0xe2f7('0xf')]:null,_0x215cec[_0xe2f7('0x20')]&&_0x215cec[_0xe2f7('0x20')][_0xe2f7('0x29')]?_0x215cec['body']['device']:_0xe2f7('0x2f'),_0x215cec[_0xe2f7('0x20')]&&_0x215cec['body'][_0xe2f7('0x2a')]?_0x215cec['body'][_0xe2f7('0x2a')]:'',_0x215cec[_0xe2f7('0x20')]&&_0x215cec[_0xe2f7('0x20')][_0xe2f7('0x30')]?_0x215cec['body']['agent_name']:'');},'ignoreRoute':function(_0x5ca6ac){var _0x459b92=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x459b92[_0xe2f7('0x31')](_0x5ca6ac[_0xe2f7('0x25')]);}}));return _0xf80562();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index c9fdfe8..6c1beb8 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0153=['isMoment','length','padStart','lodash','moment-timezone','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','date','daysInMonth','max','min','monthCompare','guess','test'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x0153,0x12b));var _0x3015=function(_0x56a020,_0x3065c6){_0x56a020=_0x56a020-0x0;var _0xc4220c=_0x0153[_0x56a020];return _0xc4220c;};var _=require(_0x3015('0x0'));var moment=require(_0x3015('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x369d16){return _0x369d16['source'];})[_0x3015('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3015('0x3');var EINVALID_DATE=_0x3015('0x4');function throwIfDateNotValid(_0xee8fb1){if(!_0xee8fb1['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0xdc3e7d){var _0x4752e5=_0xdc3e7d[_0x3015('0x5')](':')[_0x3015('0x6')](function(_0x31a8f6){return parseInt(_0x31a8f6,0xa);});var _0x40cfec=_0x4752e5[0x0];var _0x46c190=_0x4752e5[0x1];if(_0x40cfec<0x0||_0x40cfec>0x17||_0x46c190<0x0||_0x46c190>0x3b){throw new Error(EINVALID_DATE);}return[_0x40cfec,_0x46c190];}function circularDoWInterval(_0x4f47c7,_0x70bf03){if(_0x4f47c7===_0x70bf03){return[_0x4f47c7];}else{var _0x4affe4=moment['locale']();moment[_0x3015('0x7')]('en');var _0x55f82f=moment[_0x3015('0x8')]()[_0x3015('0x6')](function(_0x4a6fe9){return _0x4a6fe9[_0x3015('0x9')]();});moment['locale'](_0x4affe4);var _0x1ee5d4=_0x55f82f['indexOf'](_0x4f47c7);var _0x3b56e1=_0x55f82f[_0x3015('0xa')](_0x70bf03);if(_0x3b56e1>_0x1ee5d4){return _0x55f82f[_0x3015('0xb')](_0x1ee5d4,_0x3b56e1+0x1);}else{var _0x1e9b41=_0x55f82f['slice'](0x0,_0x3b56e1+0x1);var _0x172a2d=_0x55f82f['slice'](_0x1ee5d4);return _0x172a2d[_0x3015('0xc')](_0x1e9b41);}}}module[_0x3015('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x545cb7,_0x24f634){if(_0x545cb7===_0x24f634){return[_0x545cb7];}else{var _0x51c0e3=moment[_0x3015('0x7')]();moment[_0x3015('0x7')]('en');var _0x41ceec=moment[_0x3015('0xe')]()['map'](function(_0x48ddc6){return _0x48ddc6['toLowerCase']();});moment[_0x3015('0x7')](_0x51c0e3);var _0x1a74dc=_0x41ceec['indexOf'](_0x545cb7);var _0x19127d=_0x41ceec[_0x3015('0xa')](_0x24f634);if(_0x19127d>_0x1a74dc){return _0x41ceec[_0x3015('0xb')](_0x1a74dc,_0x19127d+0x1);}else{var _0x4941b2=_0x41ceec[_0x3015('0xb')](0x0,_0x19127d+0x1);var _0x1d1c4e=_0x41ceec[_0x3015('0xb')](_0x1a74dc);return _0x1d1c4e[_0x3015('0xc')](_0x4941b2);}}}module[_0x3015('0xd')][_0x3015('0xf')]=circularMonthInterval;function parseDom(_0x26cbd2){var _0x3b16af=parseInt(_0x26cbd2,0xa);if(_0x3b16af<0x1||_0x3b16af>0x1f){throw new Error(EINVALID_DATE);}return _0x3b16af;}function timeCompare(_0x36ce76,_0x1c4a56,_0x1a8749){var _0x57404c=_0x36ce76[_0x3015('0x10')]();var _0x1f6468=extractTime(_0x1c4a56);var _0x3af7b7=_0x1f6468[0x0];var _0x64241e=_0x1f6468[0x1];var _0x282811=_0x36ce76[_0x3015('0x10')]()[_0x3015('0x11')](_0x3af7b7)[_0x3015('0x12')](_0x64241e);throwIfDateNotValid(_0x282811);var _0x4cbaec=extractTime(_0x1a8749);var _0x401286=_0x4cbaec[0x0];var _0x34a560=_0x4cbaec[0x1];var _0x970052=_0x36ce76[_0x3015('0x10')]()[_0x3015('0x11')](_0x401286)[_0x3015('0x12')](_0x34a560);throwIfDateNotValid(_0x970052);if(_0x970052['isBefore'](_0x282811)){var _0x135214=_0x57404c[_0x3015('0x10')]()[_0x3015('0x13')](_0x3015('0x14'));var _0x4a724a=_0x57404c[_0x3015('0x10')]()[_0x3015('0x15')](_0x3015('0x14'));return _0x57404c[_0x3015('0x16')](_0x282811,_0x4a724a,undefined,'[]')||_0x57404c['isBetween'](_0x135214,_0x970052,undefined,'[]');}else{return _0x57404c[_0x3015('0x16')](_0x282811,_0x970052,undefined,'[]');}}module[_0x3015('0xd')][_0x3015('0x17')]=timeCompare;function dowCompare(_0x314556,_0xc2ce6b,_0x48849b){var _0x156383=_0x314556[_0x3015('0x7')]('en')[_0x3015('0x18')](_0x3015('0x19'))['toLowerCase']();return circularDoWInterval(_0xc2ce6b,_0x48849b)['includes'](_0x156383);}module[_0x3015('0xd')][_0x3015('0x1a')]=dowCompare;function domCompare(_0xbeba3,_0x4d7b15,_0x4b11ea){var _0x436113=_0xbeba3[_0x3015('0x1b')]();if(_0x4d7b15===_0x4b11ea){return _0x436113===_0x4d7b15;}else{var _0x15ea53=_0xbeba3[_0x3015('0x1c')]();var _0x4f2b07=_0x4d7b15<_0x4b11ea;let _0x40ac92=![];var _0x1b8ad7=0x0;var _0x4e5b92=0x0;if(_0x4f2b07){_0x1b8ad7=Math[_0x3015('0x1d')](0x1,_0x4d7b15);_0x4e5b92=Math[_0x3015('0x1e')](_0x4b11ea,_0x15ea53);_0x40ac92=_0x436113>=_0x1b8ad7&&_0x436113<=_0x4e5b92;}else{_0x1b8ad7=Math[_0x3015('0x1e')](_0x4d7b15,_0x15ea53);_0x4e5b92=Math[_0x3015('0x1d')](0x1,_0x4b11ea);_0x40ac92=_0x436113>=_0x1b8ad7||_0x436113<=_0x4e5b92;}return _0x40ac92;}}module[_0x3015('0xd')]['domCompare']=domCompare;function monthCompare(_0x2aa632,_0x1100c5,_0xd33522){var _0x159311=_0x2aa632['locale']('en')['format']('MMM')['toLowerCase']();return circularMonthInterval(_0x1100c5,_0xd33522)['includes'](_0x159311);}module['exports'][_0x3015('0x1f')]=monthCompare;function iftime(_0x2d24bc,_0x7a29bd=moment['tz'][_0x3015('0x20')](),_0x390433=moment()){if(!validateRx[_0x3015('0x21')](_0x2d24bc)){throw new Error(EINVALID_STRING);}else{var _0x3d1663=(moment[_0x3015('0x22')](_0x390433)?_0x390433[_0x3015('0x10')]():moment(_0x390433))['tz'](_0x7a29bd)[_0x3015('0x7')]('en');throwIfDateNotValid(_0x3d1663);var _0x45f9e3=_0x2d24bc[_0x3015('0x5')](',');var _0x507aa0=_0x45f9e3[0x0];var _0x3fed45=_0x45f9e3[0x1];var _0x238d4f=_0x45f9e3[0x2];var _0x4cf894=_0x45f9e3[0x3];let _0x11a52c=!![];if(_0x507aa0!=='*'){var _0x59c512=_0x507aa0[_0x3015('0x5')]('-');var _0x481011=_['padStart'](_0x59c512[0x0],0x5,'0');var _0x349da6=_0x59c512[_0x3015('0x23')]===0x2?_[_0x3015('0x24')](_0x59c512[0x1],0x5,'0'):_0x481011;_0x11a52c=timeCompare(_0x3d1663,_0x481011,_0x349da6);}let _0x5623ec=!![];if(_0x3fed45!=='*'){var _0x254e13=_0x3fed45[_0x3015('0x5')]('-');var _0x2c50a4=_0x254e13[0x0];var _0x5410b8=_0x254e13[_0x3015('0x23')]===0x2?_0x254e13[0x1]:_0x2c50a4;_0x5623ec=dowCompare(_0x3d1663,_0x2c50a4,_0x5410b8);}let _0x3e65ff=!![];if(_0x238d4f!=='*'){var _0x51e347=_0x238d4f[_0x3015('0x5')]('-');var _0x4ce75f=parseDom(_0x51e347[0x0]);var _0x56b168=_0x51e347[_0x3015('0x23')]===0x2?parseDom(_0x51e347[0x1]):_0x4ce75f;_0x3e65ff=domCompare(_0x3d1663,_0x4ce75f,_0x56b168);}let _0x4f9070=!![];if(_0x4cf894!=='*'){var _0x65384b=_0x4cf894['split']('-');var _0x4ee705=_0x65384b[0x0];var _0x4a55ec=_0x65384b[_0x3015('0x23')]===0x2?_0x65384b[0x1]:_0x65384b[0x0];_0x4f9070=monthCompare(_0x3d1663,_0x4ee705,_0x4a55ec);}return _0x11a52c&&_0x5623ec&&_0x3e65ff&&_0x4f9070;}}module['exports']['iftime']=iftime; \ No newline at end of file +var _0x7af3=['guess','length','lodash','moment-timezone','map','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','startOf','day','isBetween','timeCompare','format','includes','date','daysInMonth','max','min','domCompare','MMM','monthCompare'];(function(_0x49441e,_0x40816f){var _0x1dc5ae=function(_0x1f437e){while(--_0x1f437e){_0x49441e['push'](_0x49441e['shift']());}};_0x1dc5ae(++_0x40816f);}(_0x7af3,0x11a));var _0x37af=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7af3[_0x17b6e3];return _0x3906f3;};var _=require(_0x37af('0x0'));var moment=require(_0x37af('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][_0x37af('0x2')](function(_0x3e414e){return _0x3e414e['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x37af('0x3');var EINVALID_DATE=_0x37af('0x4');function throwIfDateNotValid(_0x4a57b7){if(!_0x4a57b7[_0x37af('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x22bb1b){var _0x585d4d=_0x22bb1b[_0x37af('0x6')](':')[_0x37af('0x2')](function(_0x18deda){return parseInt(_0x18deda,0xa);});var _0x437af2=_0x585d4d[0x0];var _0x3df7ff=_0x585d4d[0x1];if(_0x437af2<0x0||_0x437af2>0x17||_0x3df7ff<0x0||_0x3df7ff>0x3b){throw new Error(EINVALID_DATE);}return[_0x437af2,_0x3df7ff];}function circularDoWInterval(_0x357b5d,_0x494fb1){if(_0x357b5d===_0x494fb1){return[_0x357b5d];}else{var _0x12aab8=moment[_0x37af('0x7')]();moment['locale']('en');var _0x4febb4=moment[_0x37af('0x8')]()[_0x37af('0x2')](function(_0x2f7bbb){return _0x2f7bbb[_0x37af('0x9')]();});moment['locale'](_0x12aab8);var _0x4b7157=_0x4febb4[_0x37af('0xa')](_0x357b5d);var _0x11c9c6=_0x4febb4[_0x37af('0xa')](_0x494fb1);if(_0x11c9c6>_0x4b7157){return _0x4febb4[_0x37af('0xb')](_0x4b7157,_0x11c9c6+0x1);}else{var _0x37b253=_0x4febb4['slice'](0x0,_0x11c9c6+0x1);var _0xa5b162=_0x4febb4[_0x37af('0xb')](_0x4b7157);return _0xa5b162[_0x37af('0xc')](_0x37b253);}}}module[_0x37af('0xd')][_0x37af('0xe')]=circularDoWInterval;function circularMonthInterval(_0x3472ce,_0x5d1ce8){if(_0x3472ce===_0x5d1ce8){return[_0x3472ce];}else{var _0x1f3b7d=moment[_0x37af('0x7')]();moment[_0x37af('0x7')]('en');var _0x4fcd32=moment[_0x37af('0xf')]()[_0x37af('0x2')](function(_0x394000){return _0x394000['toLowerCase']();});moment[_0x37af('0x7')](_0x1f3b7d);var _0x144a6a=_0x4fcd32[_0x37af('0xa')](_0x3472ce);var _0x360fc2=_0x4fcd32[_0x37af('0xa')](_0x5d1ce8);if(_0x360fc2>_0x144a6a){return _0x4fcd32[_0x37af('0xb')](_0x144a6a,_0x360fc2+0x1);}else{var _0x5095cf=_0x4fcd32[_0x37af('0xb')](0x0,_0x360fc2+0x1);var _0x11b689=_0x4fcd32[_0x37af('0xb')](_0x144a6a);return _0x11b689[_0x37af('0xc')](_0x5095cf);}}}module['exports'][_0x37af('0x10')]=circularMonthInterval;function parseDom(_0x2aa0cf){var _0x4823a3=parseInt(_0x2aa0cf,0xa);if(_0x4823a3<0x1||_0x4823a3>0x1f){throw new Error(EINVALID_DATE);}return _0x4823a3;}function timeCompare(_0x575ec1,_0x5ce8f1,_0x5a736e){var _0x5a67cc=_0x575ec1[_0x37af('0x11')]();var _0x559b60=extractTime(_0x5ce8f1);var _0x28ec7f=_0x559b60[0x0];var _0x14abed=_0x559b60[0x1];var _0x546aa4=_0x575ec1[_0x37af('0x11')]()[_0x37af('0x12')](_0x28ec7f)[_0x37af('0x13')](_0x14abed);throwIfDateNotValid(_0x546aa4);var _0x1ecf0a=extractTime(_0x5a736e);var _0x328235=_0x1ecf0a[0x0];var _0x5dc71e=_0x1ecf0a[0x1];var _0x2b7bf2=_0x575ec1['clone']()[_0x37af('0x12')](_0x328235)[_0x37af('0x13')](_0x5dc71e);throwIfDateNotValid(_0x2b7bf2);if(_0x2b7bf2['isBefore'](_0x546aa4)){var _0x3a5d57=_0x5a67cc[_0x37af('0x11')]()[_0x37af('0x14')]('day');var _0x45a765=_0x5a67cc[_0x37af('0x11')]()['endOf'](_0x37af('0x15'));return _0x5a67cc[_0x37af('0x16')](_0x546aa4,_0x45a765,undefined,'[]')||_0x5a67cc[_0x37af('0x16')](_0x3a5d57,_0x2b7bf2,undefined,'[]');}else{return _0x5a67cc['isBetween'](_0x546aa4,_0x2b7bf2,undefined,'[]');}}module[_0x37af('0xd')][_0x37af('0x17')]=timeCompare;function dowCompare(_0x4cfadb,_0x400557,_0x14680d){var _0x8674a5=_0x4cfadb[_0x37af('0x7')]('en')[_0x37af('0x18')]('ddd')[_0x37af('0x9')]();return circularDoWInterval(_0x400557,_0x14680d)[_0x37af('0x19')](_0x8674a5);}module[_0x37af('0xd')]['dowCompare']=dowCompare;function domCompare(_0x508eca,_0x4744a1,_0x3ddadf){var _0x40b95b=_0x508eca[_0x37af('0x1a')]();if(_0x4744a1===_0x3ddadf){return _0x40b95b===_0x4744a1;}else{var _0x4690fb=_0x508eca[_0x37af('0x1b')]();var _0x3084f9=_0x4744a1<_0x3ddadf;let _0x1a4e68=![];var _0x4a62b=0x0;var _0x433da3=0x0;if(_0x3084f9){_0x4a62b=Math[_0x37af('0x1c')](0x1,_0x4744a1);_0x433da3=Math[_0x37af('0x1d')](_0x3ddadf,_0x4690fb);_0x1a4e68=_0x40b95b>=_0x4a62b&&_0x40b95b<=_0x433da3;}else{_0x4a62b=Math[_0x37af('0x1d')](_0x4744a1,_0x4690fb);_0x433da3=Math[_0x37af('0x1c')](0x1,_0x3ddadf);_0x1a4e68=_0x40b95b>=_0x4a62b||_0x40b95b<=_0x433da3;}return _0x1a4e68;}}module[_0x37af('0xd')][_0x37af('0x1e')]=domCompare;function monthCompare(_0x38899d,_0x5b4996,_0x18565e){var _0x46c3cb=_0x38899d[_0x37af('0x7')]('en')[_0x37af('0x18')](_0x37af('0x1f'))[_0x37af('0x9')]();return circularMonthInterval(_0x5b4996,_0x18565e)['includes'](_0x46c3cb);}module[_0x37af('0xd')][_0x37af('0x20')]=monthCompare;function iftime(_0x1c2f3b,_0x5d5f15=moment['tz'][_0x37af('0x21')](),_0x23860a=moment()){if(!validateRx['test'](_0x1c2f3b)){throw new Error(EINVALID_STRING);}else{var _0x1d5e1b=(moment['isMoment'](_0x23860a)?_0x23860a[_0x37af('0x11')]():moment(_0x23860a))['tz'](_0x5d5f15)['locale']('en');throwIfDateNotValid(_0x1d5e1b);var _0x3ef434=_0x1c2f3b[_0x37af('0x6')](',');var _0x5bed74=_0x3ef434[0x0];var _0x35e680=_0x3ef434[0x1];var _0x4299e3=_0x3ef434[0x2];var _0x40ca26=_0x3ef434[0x3];let _0x14d007=!![];if(_0x5bed74!=='*'){var _0x2b2526=_0x5bed74['split']('-');var _0x3b0167=_['padStart'](_0x2b2526[0x0],0x5,'0');var _0x4156cb=_0x2b2526[_0x37af('0x22')]===0x2?_['padStart'](_0x2b2526[0x1],0x5,'0'):_0x3b0167;_0x14d007=timeCompare(_0x1d5e1b,_0x3b0167,_0x4156cb);}let _0x3242c0=!![];if(_0x35e680!=='*'){var _0x10a881=_0x35e680[_0x37af('0x6')]('-');var _0x11baab=_0x10a881[0x0];var _0x1e468f=_0x10a881[_0x37af('0x22')]===0x2?_0x10a881[0x1]:_0x11baab;_0x3242c0=dowCompare(_0x1d5e1b,_0x11baab,_0x1e468f);}let _0x1abb4b=!![];if(_0x4299e3!=='*'){var _0x50a254=_0x4299e3[_0x37af('0x6')]('-');var _0x1fb4e0=parseDom(_0x50a254[0x0]);var _0x7c7d30=_0x50a254[_0x37af('0x22')]===0x2?parseDom(_0x50a254[0x1]):_0x1fb4e0;_0x1abb4b=domCompare(_0x1d5e1b,_0x1fb4e0,_0x7c7d30);}let _0x49b21b=!![];if(_0x40ca26!=='*'){var _0xb22e2d=_0x40ca26[_0x37af('0x6')]('-');var _0x3d347c=_0xb22e2d[0x0];var _0x3f539f=_0xb22e2d[_0x37af('0x22')]===0x2?_0xb22e2d[0x1]:_0xb22e2d[0x0];_0x49b21b=monthCompare(_0x1d5e1b,_0x3d347c,_0x3f539f);}return _0x14d007&&_0x3242c0&&_0x1abb4b&&_0x49b21b;}}module[_0x37af('0xd')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index d3353f1..a12d7b2 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc11d=['moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','join','format','%s-%s.log','message','{{{','replace','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','Console','warn','transports','File','%s-%s','error','consoleLogger','fileLogger','path','util'];(function(_0xbc6200,_0x1aec68){var _0x3495f9=function(_0x2db33c){while(--_0x2db33c){_0xbc6200['push'](_0xbc6200['shift']());}};_0x3495f9(++_0x1aec68);}(_0xc11d,0x15d));var _0xdc11=function(_0x37bf28,_0x231e02){_0x37bf28=_0x37bf28-0x0;var _0x42ef25=_0xc11d[_0x37bf28];return _0x42ef25;};'use strict';var path=require(_0xdc11('0x0'));var util=require(_0xdc11('0x1'));var moment=require(_0xdc11('0x2'));var winston=require(_0xdc11('0x3'));var config=require(_0xdc11('0x4'));var debugLevel=config[_0xdc11('0x5')]?config[_0xdc11('0x5')][_0xdc11('0x6')]():_0xdc11('0x7');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':_0xdc11('0x8'),'error':_0xdc11('0x9'),'warn':_0xdc11('0xa'),'info':_0xdc11('0xb'),'print':'bold\x20white','success':_0xdc11('0xc'),'http':_0xdc11('0xd'),'verbose':'bold\x20magenta','debug':_0xdc11('0xe'),'silly':_0xdc11('0xf')};winston[_0xdc11('0x10')](XC_LOG_COLORS);function getLogFileName(_0x2ba5de,_0x2ca939,_0x5c04ce){var _0x45dd84=_0x2ba5de||'/var/log/xcally';return path[_0xdc11('0x11')](_0x45dd84,util[_0xdc11('0x12')](_0xdc11('0x13'),_0x2ca939,_0x5c04ce));}function formatter(_0x3cb5f9,_0x3aa628){_0x3aa628['message']=_0x3aa628[_0xdc11('0x14')]['replace'](/@@{/g,_0xdc11('0x15'))[_0xdc11('0x16')](/}@@/g,'}}}')[_0xdc11('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xdc11('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xdc11('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3aa628['level'][_0xdc11('0x17')](),_0x3cb5f9,_0x3aa628[_0xdc11('0x14')]);}function fileFormat(_0x15e99c,_0x2e7763){_0x2e7763[_0xdc11('0x14')]=_0x2e7763[_0xdc11('0x14')][_0xdc11('0x16')](/@@{/g,'{{{')[_0xdc11('0x16')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xdc11('0x16')](/}@/g,'}}');var _0x166d2b=_0x2e7763[_0xdc11('0x18')]&&Object[_0xdc11('0x19')](_0x2e7763[_0xdc11('0x18')])['length']?'\x0a\x09'+JSON[_0xdc11('0x1a')](_0x2e7763['meta']):'';return util[_0xdc11('0x12')](_0xdc11('0x1b'),moment()[_0xdc11('0x12')](_0xdc11('0x1c')),_0x2e7763[_0xdc11('0x1d')][_0xdc11('0x17')](),_0x15e99c,_0x2e7763[_0xdc11('0x14')],_0x166d2b);}function consoleLogger(){var _0x1de549=new winston[(_0xdc11('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xdc11('0x1f'))]({'level':_0xdc11('0x20'),'json':![],'formatter':function(_0x585509){return formatter('',_0x585509);}})]});return _0x1de549;}function fileLogger(_0x2e0b19,_0x3c927b){var _0x5f394b=new winston[(_0xdc11('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xdc11('0x21'))][(_0xdc11('0x22'))]({'name':util[_0xdc11('0x12')](_0xdc11('0x23'),_0x2e0b19,'error'),'filename':getLogFileName(_0x3c927b,_0x2e0b19,_0xdc11('0x24')),'level':_0xdc11('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1a78cd){return fileFormat(_0x2e0b19,_0x1a78cd);}}),new winston[(_0xdc11('0x21'))][(_0xdc11('0x22'))]({'name':util['format']('%s-%s',_0x2e0b19,debugLevel),'filename':getLogFileName(_0x3c927b,_0x2e0b19,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x498c8e){return fileFormat(_0x2e0b19,_0x498c8e);}}),new winston[(_0xdc11('0x21'))]['Console']({'level':_0xdc11('0x20'),'json':![],'formatter':function(_0x50ba44){return fileFormat(_0x2e0b19,_0x50ba44);}})]});return _0x5f394b;}exports[_0xdc11('0x25')]=consoleLogger;exports[_0xdc11('0x26')]=fileLogger; \ No newline at end of file +var _0x4b4e=['transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20blue','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','toUpperCase','keys','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x3f96a0,_0x16ccb9){var _0x26d21e=function(_0x2de4dd){while(--_0x2de4dd){_0x3f96a0['push'](_0x3f96a0['shift']());}};_0x26d21e(++_0x16ccb9);}(_0x4b4e,0xcc));var _0xe4b4=function(_0x4caf0b,_0x1f06b6){_0x4caf0b=_0x4caf0b-0x0;var _0x42ff72=_0x4b4e[_0x4caf0b];return _0x42ff72;};'use strict';var path=require('path');var util=require(_0xe4b4('0x0'));var moment=require(_0xe4b4('0x1'));var winston=require('winston');var config=require(_0xe4b4('0x2'));var debugLevel=config['debugLevel']?config[_0xe4b4('0x3')][_0xe4b4('0x4')]():_0xe4b4('0x5');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':_0xe4b4('0x6'),'error':_0xe4b4('0x7'),'warn':_0xe4b4('0x8'),'info':_0xe4b4('0x9'),'print':_0xe4b4('0xa'),'success':_0xe4b4('0xb'),'http':_0xe4b4('0xc'),'verbose':'bold\x20magenta','debug':_0xe4b4('0xd'),'silly':'bold\x20cyan'};winston[_0xe4b4('0xe')](XC_LOG_COLORS);function getLogFileName(_0x2d1149,_0x4efc49,_0x1b669e){var _0x575d19=_0x2d1149||_0xe4b4('0xf');return path[_0xe4b4('0x10')](_0x575d19,util[_0xe4b4('0x11')](_0xe4b4('0x12'),_0x4efc49,_0x1b669e));}function formatter(_0x32ed86,_0x9f7050){_0x9f7050[_0xe4b4('0x13')]=_0x9f7050['message']['replace'](/@@{/g,_0xe4b4('0x14'))['replace'](/}@@/g,_0xe4b4('0x15'))[_0xe4b4('0x16')](/@{/g,'{{')[_0xe4b4('0x16')](/}@/g,'}}');return util['format'](_0xe4b4('0x17'),moment()[_0xe4b4('0x11')](_0xe4b4('0x18')),_0x9f7050[_0xe4b4('0x19')][_0xe4b4('0x1a')](),_0x32ed86,_0x9f7050[_0xe4b4('0x13')]);}function fileFormat(_0x352427,_0x170f8e){_0x170f8e[_0xe4b4('0x13')]=_0x170f8e[_0xe4b4('0x13')][_0xe4b4('0x16')](/@@{/g,'{{{')[_0xe4b4('0x16')](/}@@/g,_0xe4b4('0x15'))[_0xe4b4('0x16')](/@{/g,'{{')[_0xe4b4('0x16')](/}@/g,'}}');var _0x3eac96=_0x170f8e['meta']&&Object[_0xe4b4('0x1b')](_0x170f8e[_0xe4b4('0x1c')])['length']?'\x0a\x09'+JSON['stringify'](_0x170f8e[_0xe4b4('0x1c')]):'';return util[_0xe4b4('0x11')](_0xe4b4('0x1d'),moment()[_0xe4b4('0x11')](_0xe4b4('0x18')),_0x170f8e[_0xe4b4('0x19')][_0xe4b4('0x1a')](),_0x352427,_0x170f8e['message'],_0x3eac96);}function consoleLogger(){var _0xdb06de=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe4b4('0x1e'))][(_0xe4b4('0x1f'))]({'level':_0xe4b4('0x20'),'json':![],'formatter':function(_0x254d49){return formatter('',_0x254d49);}})]});return _0xdb06de;}function fileLogger(_0x3888e8,_0x5bcd17){var _0x159536=new winston[(_0xe4b4('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe4b4('0x1e'))][(_0xe4b4('0x22'))]({'name':util['format'](_0xe4b4('0x23'),_0x3888e8,_0xe4b4('0x24')),'filename':getLogFileName(_0x5bcd17,_0x3888e8,_0xe4b4('0x24')),'level':_0xe4b4('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x132553){return fileFormat(_0x3888e8,_0x132553);}}),new winston['transports'][(_0xe4b4('0x22'))]({'name':util[_0xe4b4('0x11')](_0xe4b4('0x23'),_0x3888e8,debugLevel),'filename':getLogFileName(_0x5bcd17,_0x3888e8,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x51702b){return fileFormat(_0x3888e8,_0x51702b);}}),new winston[(_0xe4b4('0x1e'))][(_0xe4b4('0x1f'))]({'level':_0xe4b4('0x20'),'json':![],'formatter':function(_0x210785){return fileFormat(_0x3888e8,_0x210785);}})]});return _0x159536;}exports[_0xe4b4('0x25')]=consoleLogger;exports[_0xe4b4('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 6514dc3..5f83170 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x1967,0x173));var _0x7196=function(_0x392263,_0x33b0cb){_0x392263=_0x392263-0x0;var _0x2ca4c5=_0x1967[_0x392263];return _0x2ca4c5;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x1967,0x173));var _0x7196=function(_0x3ba1b0,_0x42b9ce){_0x3ba1b0=_0x3ba1b0-0x0;var _0x41d981=_0x1967[_0x3ba1b0];return _0x41d981;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 94b341a..0b81332 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 _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x240289,_0x2b1170){var _0x242b43=function(_0x3c96a6){while(--_0x3c96a6){_0x240289['push'](_0x240289['shift']());}};_0x242b43(++_0x2b1170);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file +var _0xb62e=['map','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x21a276,_0xd2ff4e){var _0x17a4cb=function(_0x3e161c){while(--_0x3e161c){_0x21a276['push'](_0x21a276['shift']());}};_0x17a4cb(++_0xd2ff4e);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};var _=require(_0xeb62('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x46335b){return _0x46335b==='{{'?_0xeb62('0x1'):_0xeb62('0x2');}function safeTemplate(_0x57a5ba){var _0x3dfdef=_0x57a5ba;if(typeof _0x57a5ba===_0xeb62('0x3')){_0x3dfdef=_0x57a5ba[_0xeb62('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xeb62('0x5')](_0x57a5ba)){_0x3dfdef=_0x57a5ba[_0xeb62('0x6')](function(_0x1ebdbb){return safeTemplate(_0x1ebdbb);});}else if(_['isPlainObject'](_0x57a5ba)){_0x3dfdef=Object[_0xeb62('0x7')](_0x57a5ba)[_0xeb62('0x8')](function(_0x31f5ea,_0x5e0dc4){_0x31f5ea[_0x5e0dc4]=safeTemplate(_0x57a5ba[_0x5e0dc4]);return _0x31f5ea;},{});}return _0x3dfdef;}module[_0xeb62('0x9')][_0xeb62('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index b9c8a74..398f28b 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 _0xaf30=['fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','motion2','env','NODE_PATH','string','then'];(function(_0x36e7da,_0x3cda27){var _0x487eb8=function(_0x43cee4){while(--_0x43cee4){_0x36e7da['push'](_0x36e7da['shift']());}};_0x487eb8(++_0x3cda27);}(_0xaf30,0x1ce));var _0x0af3=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0xaf30[_0x22bdd3];return _0x44d9d9;};var fs=require(_0x0af3('0x0'));var path=require(_0x0af3('0x1'));var config=require(_0x0af3('0x2'));var root=config[_0x0af3('0x3')];var APP_JSON_PATH=path[_0x0af3('0x4')](root,_0x0af3('0x5'));var NODEPATH=path[_0x0af3('0x4')](root,_0x0af3('0x6'));function setLegacyLibsNodeEnvPath(_0x4596bc){let _0x2830de=![];if(Array[_0x0af3('0x7')](_0x4596bc[_0x0af3('0x8')])){var _0x1dc609=_0x4596bc[_0x0af3('0x8')]['findIndex'](function(_0x93aa08){return _0x93aa08['name']===_0x0af3('0x9');});if(_0x1dc609>-0x1){var _0x53e7e9=_0x4596bc[_0x0af3('0x8')][_0x1dc609];if(typeof _0x53e7e9[_0x0af3('0xa')][_0x0af3('0xb')]!==_0x0af3('0xc')){_0x53e7e9[_0x0af3('0xa')][_0x0af3('0xb')]=NODEPATH;_0x2830de=!![];}}return{'appConfig':_0x4596bc,'updated':_0x2830de};}}function updateAppConfig(_0x7ec4cb){return fs['pathExists'](APP_JSON_PATH)[_0x0af3('0xd')](function(_0x29f6f4){if(_0x29f6f4){return fs['readJSON'](APP_JSON_PATH)[_0x0af3('0xd')](function(_0x2ddcca){var _0x541530=setLegacyLibsNodeEnvPath(_0x2ddcca);if(_0x541530['updated']){_0x7ec4cb['info']('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x2ddcca,{'spaces':0x2});}else{return Promise[_0x0af3('0x4')]();}});}else{return Promise[_0x0af3('0x4')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x9011=['legacy-libs','isArray','apps','string','env','NODE_PATH','then','readJSON','updated','info','Updating\x20app.json','writeJSON','resolve','exports','fs-extra','path','../config/environment','root','server/app.json'];(function(_0x381dc4,_0x3c8bec){var _0x551e21=function(_0x498650){while(--_0x498650){_0x381dc4['push'](_0x381dc4['shift']());}};_0x551e21(++_0x3c8bec);}(_0x9011,0xcc));var _0x1901=function(_0x213b72,_0x1c479a){_0x213b72=_0x213b72-0x0;var _0x1b02f5=_0x9011[_0x213b72];return _0x1b02f5;};var fs=require(_0x1901('0x0'));var path=require(_0x1901('0x1'));var config=require(_0x1901('0x2'));var root=config[_0x1901('0x3')];var APP_JSON_PATH=path['resolve'](root,_0x1901('0x4'));var NODEPATH=path['resolve'](root,_0x1901('0x5'));function setLegacyLibsNodeEnvPath(_0x10480d){let _0x64bb31=![];if(Array[_0x1901('0x6')](_0x10480d[_0x1901('0x7')])){var _0x50a158=_0x10480d[_0x1901('0x7')]['findIndex'](function(_0x4fb898){return _0x4fb898['name']==='motion2';});if(_0x50a158>-0x1){var _0x2dd5eb=_0x10480d['apps'][_0x50a158];if(typeof _0x2dd5eb['env']['NODE_PATH']!==_0x1901('0x8')){_0x2dd5eb[_0x1901('0x9')][_0x1901('0xa')]=NODEPATH;_0x64bb31=!![];}}return{'appConfig':_0x10480d,'updated':_0x64bb31};}}function updateAppConfig(_0x5570ab){return fs['pathExists'](APP_JSON_PATH)[_0x1901('0xb')](function(_0xa1e72e){if(_0xa1e72e){return fs[_0x1901('0xc')](APP_JSON_PATH)[_0x1901('0xb')](function(_0x1d76c3){var _0x528f24=setLegacyLibsNodeEnvPath(_0x1d76c3);if(_0x528f24[_0x1901('0xd')]){_0x5570ab[_0x1901('0xe')](_0x1901('0xf'));return fs[_0x1901('0x10')](APP_JSON_PATH,_0x1d76c3,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x1901('0x11')]();}});}module[_0x1901('0x12')]=updateAppConfig; \ No newline at end of file